From: Cris Di Sclafani Date: Fri, 12 Mar 2021 13:36:11 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.21 X-Git-Url: http://repos.xcallymotion.com/base//%22http:/www.gravatar.com/avatar/%7B%7Bhash%7D%7D/%22?a=commitdiff_plain;h=9e3fa6f16e885762656f50f083b52517cf1878a5;p=motion2.git Built motion from commit (unavailable).|2.5.21 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 11164e7..6d3ff0f 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.21", "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-03-12T13:10:48.914Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.21", "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-03-12T13:28:36.490Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 604071f..1c70564 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.21", "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-03-12T13:10:48.914Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.21", "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-03-12T13:28:36.490Z", "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 8fff4f1..23da435 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 _0xd1ce=['exports','INTEGER'];(function(_0x58183f,_0x524f08){var _0x399cb9=function(_0x3f0c3d){while(--_0x3f0c3d){_0x58183f['push'](_0x58183f['shift']());}};_0x399cb9(++_0x524f08);}(_0xd1ce,0x1e6));var _0xed1c=function(_0x2cd647,_0x22d7cf){_0x2cd647=_0x2cd647-0x0;var _0x2c0be7=_0xd1ce[_0x2cd647];return _0x2c0be7;};'use strict';var Sequelize=require('sequelize');module[_0xed1c('0x0')]={'ChatInteractionId':{'type':Sequelize[_0xed1c('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xed1c('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0xe176=['INTEGER'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0xe176,0x136));var _0x6e17=function(_0x52ac91,_0x5e1bfc){_0x52ac91=_0x52ac91-0x0;var _0x5abb38=_0xe176[_0x52ac91];return _0x5abb38;};'use strict';var Sequelize=require('sequelize');module['exports']={'ChatInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x6e17('0x0')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.controller.js b/server/api/UserChatInteraction/UserChatInteraction.controller.js index 130f3cc..4612de7 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 _0x6d40=['apply','reject','save','then','destroy','get','UserChatInteractions','end','stack','name','send','index','map','UserChatInteraction','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range'];(function(_0x17714d,_0xbf2f96){var _0x43cd86=function(_0xa15152){while(--_0xa15152){_0x17714d['push'](_0x17714d['shift']());}};_0x43cd86(++_0xbf2f96);}(_0x6d40,0x1ec));var _0x06d4=function(_0x413601,_0x458b0e){_0x413601=_0x413601-0x0;var _0x394ad7=_0x6d40[_0x413601];return _0x394ad7;};'use strict';var pdf=require(_0x06d4('0x0'));var emlformat=require(_0x06d4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x06d4('0x2'));var jsonpatch=require(_0x06d4('0x3'));var rp=require(_0x06d4('0x4'));var moment=require(_0x06d4('0x5'));var BPromise=require(_0x06d4('0x6'));var Mustache=require(_0x06d4('0x7'));var util=require(_0x06d4('0x8'));var path=require(_0x06d4('0x9'));var sox=require('sox');var csv=require(_0x06d4('0xa'));var ejs=require(_0x06d4('0xb'));var fs=require('fs');var _=require(_0x06d4('0xc'));var squel=require(_0x06d4('0xd'));var crypto=require(_0x06d4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x06d4('0xf'));var toCsv=require(_0x06d4('0xa'));var querystring=require(_0x06d4('0x10'));var Papa=require(_0x06d4('0x11'));var Redis=require(_0x06d4('0x12'));var authService=require(_0x06d4('0x13'));var qs=require(_0x06d4('0x14'));var as=require(_0x06d4('0x15'));var hardwareService=require(_0x06d4('0x16'));var logger=require(_0x06d4('0x17'))(_0x06d4('0x18'));var utils=require(_0x06d4('0x19'));var config=require(_0x06d4('0x1a'));var licenseUtil=require(_0x06d4('0x1b'));var db=require(_0x06d4('0x1c'))['db'];function respondWithStatusCode(_0x2dbe6b,_0x1a01be){_0x1a01be=_0x1a01be||0xcc;return function(_0x42f178){if(_0x42f178){return _0x2dbe6b[_0x06d4('0x1d')](_0x1a01be);}return _0x2dbe6b['status'](_0x1a01be)['end']();};}function respondWithResult(_0x25ce2d,_0x51d6d5){_0x51d6d5=_0x51d6d5||0xc8;return function(_0x19a6d9){if(_0x19a6d9){return _0x25ce2d[_0x06d4('0x1e')](_0x51d6d5)[_0x06d4('0x1f')](_0x19a6d9);}};}function respondWithFilteredResult(_0x4be28c,_0x479807){return function(_0x4ee146){if(_0x4ee146){var _0x26ccab=_0x4ee146[_0x06d4('0x20')],_0x125016=_0x479807['offset'],_0x1409c7=_0x479807[_0x06d4('0x21')]+_0x479807['limit'],_0x1be3c2;if(_0x1409c7>=_0x26ccab){_0x1409c7=_0x26ccab;_0x1be3c2=0xc8;}else{_0x1be3c2=0xce;}_0x4be28c[_0x06d4('0x1e')](_0x1be3c2);return _0x4be28c[_0x06d4('0x22')](_0x06d4('0x23'),_0x125016+'-'+_0x1409c7+'/'+_0x26ccab)[_0x06d4('0x1f')](_0x4ee146);}return null;};}function patchUpdates(_0x4ab933){return function(_0x5c50f3){try{jsonpatch[_0x06d4('0x24')](_0x5c50f3,_0x4ab933,!![]);}catch(_0x360c13){return BPromise[_0x06d4('0x25')](_0x360c13);}return _0x5c50f3[_0x06d4('0x26')]();};}function saveUpdates(_0x10fbeb,_0x24e9c7){return function(_0x4678f6){if(_0x4678f6){return _0x4678f6['update'](_0x10fbeb)[_0x06d4('0x27')](function(_0x1f2276){return _0x1f2276;});}return null;};}function removeEntity(_0x10bac6,_0x4cd163){return function(_0x2f9388){if(_0x2f9388){return _0x2f9388[_0x06d4('0x28')]()[_0x06d4('0x27')](function(){var _0x589922=_0x2f9388[_0x06d4('0x29')]({'plain':!![]});var _0x184627=_0x06d4('0x2a');return db['UserProfileResource'][_0x06d4('0x28')]({'where':{'type':_0x184627,'resourceId':_0x589922['id']}})[_0x06d4('0x27')](function(){return _0x2f9388;});})[_0x06d4('0x27')](function(){_0x10bac6[_0x06d4('0x1e')](0xcc)[_0x06d4('0x2b')]();});}};}function handleEntityNotFound(_0x25ce0b,_0x36ab81){return function(_0x32969d){if(!_0x32969d){_0x25ce0b[_0x06d4('0x1d')](0x194);}return _0x32969d;};}function handleError(_0x5bd65,_0x4ec83e){_0x4ec83e=_0x4ec83e||0x1f4;return function(_0xd73dca){logger['error'](_0xd73dca[_0x06d4('0x2c')]);if(_0xd73dca[_0x06d4('0x2d')]){delete _0xd73dca['name'];}_0x5bd65[_0x06d4('0x1e')](_0x4ec83e)[_0x06d4('0x2e')](_0xd73dca);};}exports[_0x06d4('0x2f')]=function(_0x2f8599,_0x51aec7){var _0xff84fa={},_0x3c081b={},_0x249a37={'count':0x0,'rows':[]};var _0x263295=_[_0x06d4('0x30')](db[_0x06d4('0x31')][_0x06d4('0x32')],function(_0x3d0c46){return{'name':_0x3d0c46[_0x06d4('0x33')],'type':_0x3d0c46['type'][_0x06d4('0x34')]};});_0x3c081b[_0x06d4('0x35')]=_[_0x06d4('0x30')](_0x263295,_0x06d4('0x2d'));_0x3c081b['query']=_[_0x06d4('0x36')](_0x2f8599[_0x06d4('0x37')]);_0x3c081b['filters']=_['intersection'](_0x3c081b[_0x06d4('0x35')],_0x3c081b[_0x06d4('0x37')]);_0xff84fa[_0x06d4('0x38')]=_[_0x06d4('0x39')](_0x3c081b[_0x06d4('0x35')],qs[_0x06d4('0x3a')](_0x2f8599[_0x06d4('0x37')][_0x06d4('0x3a')]));_0xff84fa[_0x06d4('0x38')]=_0xff84fa[_0x06d4('0x38')][_0x06d4('0x3b')]?_0xff84fa[_0x06d4('0x38')]:_0x3c081b[_0x06d4('0x35')];if(!_0x2f8599[_0x06d4('0x37')][_0x06d4('0x3c')](_0x06d4('0x3d'))){_0xff84fa['limit']=qs[_0x06d4('0x3e')](_0x2f8599[_0x06d4('0x37')]['limit']);_0xff84fa[_0x06d4('0x21')]=qs['offset'](_0x2f8599['query'][_0x06d4('0x21')]);}_0xff84fa[_0x06d4('0x3f')]=qs[_0x06d4('0x40')](_0x2f8599[_0x06d4('0x37')][_0x06d4('0x40')]);_0xff84fa['where']=qs[_0x06d4('0x41')](_[_0x06d4('0x42')](_0x2f8599[_0x06d4('0x37')],_0x3c081b[_0x06d4('0x41')]),_0x263295);if(_0x2f8599[_0x06d4('0x37')][_0x06d4('0x43')]){_0xff84fa['where']=_[_0x06d4('0x44')](_0xff84fa[_0x06d4('0x45')],{'$or':_['map'](_0x263295,function(_0x39f040){if(_0x39f040['type']!=='VIRTUAL'){var _0x3560b4={};_0x3560b4[_0x39f040[_0x06d4('0x2d')]]={'$like':'%'+_0x2f8599[_0x06d4('0x37')]['filter']+'%'};return _0x3560b4;}})});}_0xff84fa=_[_0x06d4('0x44')]({},_0xff84fa,_0x2f8599[_0x06d4('0x46')]);var _0x5a027e={'where':_0xff84fa['where']};return db['UserChatInteraction'][_0x06d4('0x20')](_0x5a027e)[_0x06d4('0x27')](function(_0x3b416f){_0x249a37[_0x06d4('0x20')]=_0x3b416f;if(_0x2f8599[_0x06d4('0x37')][_0x06d4('0x47')]){_0xff84fa[_0x06d4('0x48')]=[{'all':!![]}];}return db[_0x06d4('0x31')][_0x06d4('0x49')](_0xff84fa);})['then'](function(_0x54004a){_0x249a37[_0x06d4('0x4a')]=_0x54004a;return _0x249a37;})[_0x06d4('0x27')](respondWithFilteredResult(_0x51aec7,_0xff84fa))[_0x06d4('0x4b')](handleError(_0x51aec7,null));};exports[_0x06d4('0x4c')]=function(_0x9659e2,_0x1c3058){var _0x3d76ff={'raw':!![],'where':{'id':_0x9659e2[_0x06d4('0x4d')]['id']}},_0x16f63d={};_0x16f63d[_0x06d4('0x35')]=_[_0x06d4('0x36')](db['UserChatInteraction'][_0x06d4('0x32')]);_0x16f63d['query']=_['keys'](_0x9659e2[_0x06d4('0x37')]);_0x16f63d['filters']=_[_0x06d4('0x39')](_0x16f63d[_0x06d4('0x35')],_0x16f63d[_0x06d4('0x37')]);_0x3d76ff['attributes']=_[_0x06d4('0x39')](_0x16f63d[_0x06d4('0x35')],qs['fields'](_0x9659e2[_0x06d4('0x37')][_0x06d4('0x3a')]));_0x3d76ff[_0x06d4('0x38')]=_0x3d76ff[_0x06d4('0x38')][_0x06d4('0x3b')]?_0x3d76ff[_0x06d4('0x38')]:_0x16f63d[_0x06d4('0x35')];if(_0x9659e2[_0x06d4('0x37')]['includeAll']){_0x3d76ff[_0x06d4('0x48')]=[{'all':!![]}];}_0x3d76ff=_['merge']({},_0x3d76ff,_0x9659e2[_0x06d4('0x46')]);return db[_0x06d4('0x31')][_0x06d4('0x4e')](_0x3d76ff)[_0x06d4('0x27')](handleEntityNotFound(_0x1c3058,null))[_0x06d4('0x27')](respondWithResult(_0x1c3058,null))[_0x06d4('0x4b')](handleError(_0x1c3058,null));};exports[_0x06d4('0x4f')]=function(_0x169e49,_0x8d173d){return db['UserChatInteraction']['create'](_0x169e49['body'],{})[_0x06d4('0x27')](function(_0x5739d9){var _0xd5ecfb=_0x169e49[_0x06d4('0x50')][_0x06d4('0x29')]({'plain':!![]});if(!_0xd5ecfb)throw new Error(_0x06d4('0x51'));if(_0xd5ecfb[_0x06d4('0x52')]==='user'){var _0x56079c=_0x5739d9[_0x06d4('0x29')]({'plain':!![]});var _0x3f0002=_0x06d4('0x2a');return db[_0x06d4('0x53')]['find']({'where':{'name':_0x3f0002,'userProfileId':_0xd5ecfb[_0x06d4('0x54')]},'raw':!![]})[_0x06d4('0x27')](function(_0xff7ff2){if(_0xff7ff2&&_0xff7ff2[_0x06d4('0x55')]===0x0){return db[_0x06d4('0x56')]['create']({'name':_0x56079c[_0x06d4('0x2d')],'resourceId':_0x56079c['id'],'type':_0xff7ff2['name'],'sectionId':_0xff7ff2['id']},{})[_0x06d4('0x27')](function(){return _0x5739d9;});}else{return _0x5739d9;}})[_0x06d4('0x4b')](function(_0x417b34){logger['error'](_0x06d4('0x57'),_0x417b34);throw _0x417b34;});}return _0x5739d9;})[_0x06d4('0x27')](respondWithResult(_0x8d173d,0xc9))[_0x06d4('0x4b')](handleError(_0x8d173d,null));};exports['update']=function(_0x388c69,_0x5ec16f){if(_0x388c69['body']['id']){delete _0x388c69['body']['id'];}return db[_0x06d4('0x31')][_0x06d4('0x4e')]({'where':{'id':_0x388c69['params']['id']}})[_0x06d4('0x27')](handleEntityNotFound(_0x5ec16f,null))[_0x06d4('0x27')](saveUpdates(_0x388c69['body'],null))[_0x06d4('0x27')](respondWithResult(_0x5ec16f,null))['catch'](handleError(_0x5ec16f,null));};exports['destroy']=function(_0x2605fe,_0x2c59b1){return db[_0x06d4('0x31')][_0x06d4('0x4e')]({'where':{'id':_0x2605fe[_0x06d4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c59b1,null))['then'](removeEntity(_0x2c59b1,null))[_0x06d4('0x4b')](handleError(_0x2c59b1,null));}; \ No newline at end of file +var _0xb033=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','get','UserChatInteractions','UserProfileResource','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','UserChatInteraction','includeAll','findAll','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x54fae0,_0x15fd1a){var _0x26125c=function(_0x4f1028){while(--_0x4f1028){_0x54fae0['push'](_0x54fae0['shift']());}};_0x26125c(++_0x15fd1a);}(_0xb033,0x9f));var _0x3b03=function(_0x57ec85,_0x258ef4){_0x57ec85=_0x57ec85-0x0;var _0x479695=_0xb033[_0x57ec85];return _0x479695;};'use strict';var pdf=require(_0x3b03('0x0'));var emlformat=require(_0x3b03('0x1'));var rimraf=require(_0x3b03('0x2'));var zipdir=require(_0x3b03('0x3'));var jsonpatch=require(_0x3b03('0x4'));var rp=require(_0x3b03('0x5'));var moment=require(_0x3b03('0x6'));var BPromise=require(_0x3b03('0x7'));var Mustache=require(_0x3b03('0x8'));var util=require(_0x3b03('0x9'));var path=require(_0x3b03('0xa'));var sox=require(_0x3b03('0xb'));var csv=require(_0x3b03('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b03('0xd'));var squel=require(_0x3b03('0xe'));var crypto=require('crypto');var jsforce=require(_0x3b03('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3b03('0xc'));var querystring=require(_0x3b03('0x10'));var Papa=require(_0x3b03('0x11'));var Redis=require(_0x3b03('0x12'));var authService=require(_0x3b03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3b03('0x14'));var hardwareService=require(_0x3b03('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x3b03('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3b03('0x17'));var db=require(_0x3b03('0x18'))['db'];function respondWithStatusCode(_0x4abc45,_0x14b018){_0x14b018=_0x14b018||0xcc;return function(_0x46d23b){if(_0x46d23b){return _0x4abc45[_0x3b03('0x19')](_0x14b018);}return _0x4abc45[_0x3b03('0x1a')](_0x14b018)['end']();};}function respondWithResult(_0x1bef1f,_0x5ee511){_0x5ee511=_0x5ee511||0xc8;return function(_0x5bf95b){if(_0x5bf95b){return _0x1bef1f['status'](_0x5ee511)[_0x3b03('0x1b')](_0x5bf95b);}};}function respondWithFilteredResult(_0x1b5800,_0x4f7a9a){return function(_0x5c96bf){if(_0x5c96bf){var _0x5e1d4d=_0x5c96bf[_0x3b03('0x1c')],_0x3ea46a=_0x4f7a9a[_0x3b03('0x1d')],_0x4ae87e=_0x4f7a9a[_0x3b03('0x1d')]+_0x4f7a9a[_0x3b03('0x1e')],_0xf38f3c;if(_0x4ae87e>=_0x5e1d4d){_0x4ae87e=_0x5e1d4d;_0xf38f3c=0xc8;}else{_0xf38f3c=0xce;}_0x1b5800[_0x3b03('0x1a')](_0xf38f3c);return _0x1b5800[_0x3b03('0x1f')]('Content-Range',_0x3ea46a+'-'+_0x4ae87e+'/'+_0x5e1d4d)[_0x3b03('0x1b')](_0x5c96bf);}return null;};}function patchUpdates(_0x2a439b){return function(_0x3eecfd){try{jsonpatch[_0x3b03('0x20')](_0x3eecfd,_0x2a439b,!![]);}catch(_0x31837f){return BPromise[_0x3b03('0x21')](_0x31837f);}return _0x3eecfd[_0x3b03('0x22')]();};}function saveUpdates(_0x36e355,_0x29b0ce){return function(_0x2a20f8){if(_0x2a20f8){return _0x2a20f8['update'](_0x36e355)['then'](function(_0x38c14f){return _0x38c14f;});}return null;};}function removeEntity(_0x2387e0,_0x2d5958){return function(_0x47c9d3){if(_0x47c9d3){return _0x47c9d3['destroy']()[_0x3b03('0x23')](function(){var _0x521516=_0x47c9d3[_0x3b03('0x24')]({'plain':!![]});var _0x3a0150=_0x3b03('0x25');return db[_0x3b03('0x26')][_0x3b03('0x27')]({'where':{'type':_0x3a0150,'resourceId':_0x521516['id']}})['then'](function(){return _0x47c9d3;});})['then'](function(){_0x2387e0['status'](0xcc)[_0x3b03('0x28')]();});}};}function handleEntityNotFound(_0x52f2df,_0x52b184){return function(_0x1d37c9){if(!_0x1d37c9){_0x52f2df['sendStatus'](0x194);}return _0x1d37c9;};}function handleError(_0x3a5f73,_0x428f96){_0x428f96=_0x428f96||0x1f4;return function(_0x3ed18e){logger['error'](_0x3ed18e[_0x3b03('0x29')]);if(_0x3ed18e[_0x3b03('0x2a')]){delete _0x3ed18e[_0x3b03('0x2a')];}_0x3a5f73['status'](_0x428f96)['send'](_0x3ed18e);};}exports[_0x3b03('0x2b')]=function(_0x327958,_0x3574dd){var _0x417a5e={},_0x18b65f={},_0x15be83={'count':0x0,'rows':[]};var _0x46c873=_[_0x3b03('0x2c')](db['UserChatInteraction'][_0x3b03('0x2d')],function(_0xfb450a){return{'name':_0xfb450a[_0x3b03('0x2e')],'type':_0xfb450a[_0x3b03('0x2f')][_0x3b03('0x30')]};});_0x18b65f[_0x3b03('0x31')]=_['map'](_0x46c873,_0x3b03('0x2a'));_0x18b65f[_0x3b03('0x32')]=_[_0x3b03('0x33')](_0x327958[_0x3b03('0x32')]);_0x18b65f[_0x3b03('0x34')]=_[_0x3b03('0x35')](_0x18b65f[_0x3b03('0x31')],_0x18b65f['query']);_0x417a5e['attributes']=_[_0x3b03('0x35')](_0x18b65f[_0x3b03('0x31')],qs[_0x3b03('0x36')](_0x327958[_0x3b03('0x32')]['fields']));_0x417a5e['attributes']=_0x417a5e[_0x3b03('0x37')][_0x3b03('0x38')]?_0x417a5e[_0x3b03('0x37')]:_0x18b65f[_0x3b03('0x31')];if(!_0x327958['query'][_0x3b03('0x39')](_0x3b03('0x3a'))){_0x417a5e[_0x3b03('0x1e')]=qs[_0x3b03('0x1e')](_0x327958['query'][_0x3b03('0x1e')]);_0x417a5e['offset']=qs[_0x3b03('0x1d')](_0x327958[_0x3b03('0x32')][_0x3b03('0x1d')]);}_0x417a5e['order']=qs[_0x3b03('0x3b')](_0x327958['query'][_0x3b03('0x3b')]);_0x417a5e[_0x3b03('0x3c')]=qs[_0x3b03('0x34')](_[_0x3b03('0x3d')](_0x327958[_0x3b03('0x32')],_0x18b65f[_0x3b03('0x34')]),_0x46c873);if(_0x327958[_0x3b03('0x32')][_0x3b03('0x3e')]){_0x417a5e[_0x3b03('0x3c')]=_[_0x3b03('0x3f')](_0x417a5e['where'],{'$or':_['map'](_0x46c873,function(_0x4ace90){if(_0x4ace90[_0x3b03('0x2f')]!=='VIRTUAL'){var _0xdfc48e={};_0xdfc48e[_0x4ace90[_0x3b03('0x2a')]]={'$like':'%'+_0x327958[_0x3b03('0x32')]['filter']+'%'};return _0xdfc48e;}})});}_0x417a5e=_[_0x3b03('0x3f')]({},_0x417a5e,_0x327958[_0x3b03('0x40')]);var _0xe3baeb={'where':_0x417a5e[_0x3b03('0x3c')]};return db[_0x3b03('0x41')][_0x3b03('0x1c')](_0xe3baeb)['then'](function(_0x24566b){_0x15be83[_0x3b03('0x1c')]=_0x24566b;if(_0x327958[_0x3b03('0x32')][_0x3b03('0x42')]){_0x417a5e['include']=[{'all':!![]}];}return db['UserChatInteraction'][_0x3b03('0x43')](_0x417a5e);})['then'](function(_0x2dd819){_0x15be83['rows']=_0x2dd819;return _0x15be83;})[_0x3b03('0x23')](respondWithFilteredResult(_0x3574dd,_0x417a5e))['catch'](handleError(_0x3574dd,null));};exports[_0x3b03('0x44')]=function(_0x44e9cc,_0x5e325c){var _0x263ed5={'raw':!![],'where':{'id':_0x44e9cc[_0x3b03('0x45')]['id']}},_0x53784={};_0x53784['model']=_[_0x3b03('0x33')](db[_0x3b03('0x41')][_0x3b03('0x2d')]);_0x53784[_0x3b03('0x32')]=_[_0x3b03('0x33')](_0x44e9cc[_0x3b03('0x32')]);_0x53784[_0x3b03('0x34')]=_[_0x3b03('0x35')](_0x53784[_0x3b03('0x31')],_0x53784[_0x3b03('0x32')]);_0x263ed5[_0x3b03('0x37')]=_[_0x3b03('0x35')](_0x53784[_0x3b03('0x31')],qs[_0x3b03('0x36')](_0x44e9cc[_0x3b03('0x32')][_0x3b03('0x36')]));_0x263ed5['attributes']=_0x263ed5[_0x3b03('0x37')][_0x3b03('0x38')]?_0x263ed5[_0x3b03('0x37')]:_0x53784[_0x3b03('0x31')];if(_0x44e9cc[_0x3b03('0x32')][_0x3b03('0x42')]){_0x263ed5[_0x3b03('0x46')]=[{'all':!![]}];}_0x263ed5=_[_0x3b03('0x3f')]({},_0x263ed5,_0x44e9cc[_0x3b03('0x40')]);return db[_0x3b03('0x41')][_0x3b03('0x47')](_0x263ed5)[_0x3b03('0x23')](handleEntityNotFound(_0x5e325c,null))[_0x3b03('0x23')](respondWithResult(_0x5e325c,null))[_0x3b03('0x48')](handleError(_0x5e325c,null));};exports[_0x3b03('0x49')]=function(_0x41c5f1,_0x3083bf){return db[_0x3b03('0x41')][_0x3b03('0x49')](_0x41c5f1[_0x3b03('0x4a')],{})[_0x3b03('0x23')](function(_0x4d0150){var _0x356cc2=_0x41c5f1[_0x3b03('0x4b')][_0x3b03('0x24')]({'plain':!![]});if(!_0x356cc2)throw new Error(_0x3b03('0x4c'));if(_0x356cc2[_0x3b03('0x4d')]===_0x3b03('0x4b')){var _0x4fba88=_0x4d0150['get']({'plain':!![]});var _0x452fea=_0x3b03('0x25');return db[_0x3b03('0x4e')]['find']({'where':{'name':_0x452fea,'userProfileId':_0x356cc2['userProfileId']},'raw':!![]})[_0x3b03('0x23')](function(_0x15c486){if(_0x15c486&&_0x15c486[_0x3b03('0x4f')]===0x0){return db['UserProfileResource'][_0x3b03('0x49')]({'name':_0x4fba88['name'],'resourceId':_0x4fba88['id'],'type':_0x15c486[_0x3b03('0x2a')],'sectionId':_0x15c486['id']},{})[_0x3b03('0x23')](function(){return _0x4d0150;});}else{return _0x4d0150;}})[_0x3b03('0x48')](function(_0x379adc){logger[_0x3b03('0x50')](_0x3b03('0x51'),_0x379adc);throw _0x379adc;});}return _0x4d0150;})[_0x3b03('0x23')](respondWithResult(_0x3083bf,0xc9))[_0x3b03('0x48')](handleError(_0x3083bf,null));};exports['update']=function(_0x259d39,_0x186d6b){if(_0x259d39[_0x3b03('0x4a')]['id']){delete _0x259d39['body']['id'];}return db[_0x3b03('0x41')]['find']({'where':{'id':_0x259d39['params']['id']}})[_0x3b03('0x23')](handleEntityNotFound(_0x186d6b,null))[_0x3b03('0x23')](saveUpdates(_0x259d39[_0x3b03('0x4a')],null))['then'](respondWithResult(_0x186d6b,null))[_0x3b03('0x48')](handleError(_0x186d6b,null));};exports[_0x3b03('0x27')]=function(_0x252b7b,_0x529e77){return db[_0x3b03('0x41')][_0x3b03('0x47')]({'where':{'id':_0x252b7b[_0x3b03('0x45')]['id']}})[_0x3b03('0x23')](handleEntityNotFound(_0x529e77,null))['then'](removeEntity(_0x529e77,null))[_0x3b03('0x48')](handleError(_0x529e77,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index ad9f7e4..afb3f0d 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 _0xc3b4=['UserChatInteraction','user_has_chat_interactions','lodash','api','moment','bluebird','request-promise','path','./UserChatInteraction.attributes','define'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc3b4,0x160));var _0x4c3b=function(_0x12ef39,_0x18d320){_0x12ef39=_0x12ef39-0x0;var _0x47a734=_0xc3b4[_0x12ef39];return _0x47a734;};'use strict';var _=require(_0x4c3b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4c3b('0x1'));var moment=require(_0x4c3b('0x2'));var BPromise=require(_0x4c3b('0x3'));var rp=require(_0x4c3b('0x4'));var fs=require('fs');var path=require(_0x4c3b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4c3b('0x6'));module['exports']=function(_0x1db315,_0xfa15a0){return _0x1db315[_0x4c3b('0x7')](_0x4c3b('0x8'),attributes,{'tableName':_0x4c3b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5182=['util','../../config/logger','bluebird','path','./UserChatInteraction.attributes','exports','define'];(function(_0x3b8f15,_0x495f02){var _0x557dd7=function(_0x3b2c21){while(--_0x3b2c21){_0x3b8f15['push'](_0x3b8f15['shift']());}};_0x557dd7(++_0x495f02);}(_0x5182,0x10a));var _0x2518=function(_0x2d1965,_0x5811b0){_0x2d1965=_0x2d1965-0x0;var _0x38f880=_0x5182[_0x2d1965];return _0x38f880;};'use strict';var _=require('lodash');var util=require(_0x2518('0x0'));var logger=require(_0x2518('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2518('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2518('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2518('0x4'));module[_0x2518('0x5')]=function(_0x4daca7,_0x154623){return _0x4daca7[_0x2518('0x6')]('UserChatInteraction',attributes,{'tableName':'user_has_chat_interactions','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 275aa26..03e7fcb 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 _0xc97c=['request','then','info','UserChatInteraction,\x20%s,\x20%s','debug','UserChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0xc97c,0x10f));var _0xcc97=function(_0x4f5a0e,_0x58e64d){_0x4f5a0e=_0x4f5a0e-0x0;var _0x535e40=_0xc97c[_0x4f5a0e];return _0x535e40;};'use strict';var _=require(_0xcc97('0x0'));var util=require(_0xcc97('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc97('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcc97('0x3'));var logger=require(_0xcc97('0x4'))(_0xcc97('0x5'));var config=require(_0xcc97('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcc97('0x7')][_0xcc97('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x130b84,_0x4c16,_0x2f2b06){return new BPromise(function(_0x2ae460,_0x53ba8a){return client[_0xcc97('0x9')](_0x130b84,_0x2f2b06)[_0xcc97('0xa')](function(_0x93901f){logger[_0xcc97('0xb')](_0xcc97('0xc'),_0x4c16,'request\x20sent');logger[_0xcc97('0xd')](_0xcc97('0xe'),_0x4c16,_0xcc97('0xf'),JSON[_0xcc97('0x10')](_0x93901f));if(_0x93901f['error']){if(_0x93901f[_0xcc97('0x11')][_0xcc97('0x12')]===0x1f4){logger[_0xcc97('0x11')](_0xcc97('0xc'),_0x4c16,_0x93901f['error'][_0xcc97('0x13')]);return _0x53ba8a(_0x93901f[_0xcc97('0x11')][_0xcc97('0x13')]);}logger[_0xcc97('0x11')](_0xcc97('0xc'),_0x4c16,_0x93901f[_0xcc97('0x11')][_0xcc97('0x13')]);return _0x2ae460(_0x93901f[_0xcc97('0x11')][_0xcc97('0x13')]);}else{logger['info'](_0xcc97('0xc'),_0x4c16,_0xcc97('0xf'));_0x2ae460(_0x93901f['result']['message']);}})['catch'](function(_0x461cfa){logger[_0xcc97('0x11')](_0xcc97('0xc'),_0x4c16,_0x461cfa);_0x53ba8a(_0x461cfa);});});} \ No newline at end of file +var _0x30fb=['../../config/environment','jayson/promise','request','UserChatInteraction,\x20%s,\x20%s','debug','UserChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1d3e8e,_0x5894bb){var _0x6b6b8d=function(_0x1caea8){while(--_0x1caea8){_0x1d3e8e['push'](_0x1d3e8e['shift']());}};_0x6b6b8d(++_0x5894bb);}(_0x30fb,0x15f));var _0xb30f=function(_0x30f8ed,_0x1309da){_0x30f8ed=_0x30f8ed-0x0;var _0x43bee0=_0x30fb[_0x30f8ed];return _0x43bee0;};'use strict';var _=require(_0xb30f('0x0'));var util=require('util');var moment=require(_0xb30f('0x1'));var BPromise=require(_0xb30f('0x2'));var rs=require(_0xb30f('0x3'));var fs=require('fs');var Redis=require(_0xb30f('0x4'));var db=require(_0xb30f('0x5'))['db'];var utils=require(_0xb30f('0x6'));var logger=require(_0xb30f('0x7'))(_0xb30f('0x8'));var config=require(_0xb30f('0x9'));var jayson=require(_0xb30f('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3827d0,_0x1b779e,_0x548531){return new BPromise(function(_0x981c00,_0x38af14){return client[_0xb30f('0xb')](_0x3827d0,_0x548531)['then'](function(_0x330271){logger['info'](_0xb30f('0xc'),_0x1b779e,'request\x20sent');logger[_0xb30f('0xd')](_0xb30f('0xe'),_0x1b779e,'request\x20sent',JSON[_0xb30f('0xf')](_0x330271));if(_0x330271['error']){if(_0x330271[_0xb30f('0x10')]['code']===0x1f4){logger[_0xb30f('0x10')](_0xb30f('0xc'),_0x1b779e,_0x330271['error'][_0xb30f('0x11')]);return _0x38af14(_0x330271['error'][_0xb30f('0x11')]);}logger[_0xb30f('0x10')](_0xb30f('0xc'),_0x1b779e,_0x330271[_0xb30f('0x10')][_0xb30f('0x11')]);return _0x981c00(_0x330271['error'][_0xb30f('0x11')]);}else{logger['info']('UserChatInteraction,\x20%s,\x20%s',_0x1b779e,'request\x20sent');_0x981c00(_0x330271[_0xb30f('0x12')][_0xb30f('0x11')]);}})[_0xb30f('0x13')](function(_0x3426cc){logger[_0xb30f('0x10')](_0xb30f('0xc'),_0x1b779e,_0x3426cc);_0x38af14(_0x3426cc);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index d845ca6..c494256 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 _0xbdf3=['Router','../../components/auth/service','../../config/environment','./UserChatInteraction.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x2f17f0,_0x295b24){var _0xb35b34=function(_0x141ab7){while(--_0x141ab7){_0x2f17f0['push'](_0x2f17f0['shift']());}};_0xb35b34(++_0x295b24);}(_0xbdf3,0x67));var _0x3bdf=function(_0x75ce5b,_0x3b582f){_0x75ce5b=_0x75ce5b-0x0;var _0x22195e=_0xbdf3[_0x75ce5b];return _0x22195e;};'use strict';var multer=require(_0x3bdf('0x0'));var util=require(_0x3bdf('0x1'));var path=require(_0x3bdf('0x2'));var timeout=require(_0x3bdf('0x3'));var express=require(_0x3bdf('0x4'));var router=express[_0x3bdf('0x5')]();var auth=require(_0x3bdf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3bdf('0x7'));var controller=require(_0x3bdf('0x8'));router[_0x3bdf('0x9')]('/',auth[_0x3bdf('0xa')](),controller[_0x3bdf('0xb')]);router[_0x3bdf('0x9')](_0x3bdf('0xc'),auth[_0x3bdf('0xa')](),controller[_0x3bdf('0xd')]);router[_0x3bdf('0xe')]('/',auth['isAuthenticated'](),controller[_0x3bdf('0xf')]);router['put'](_0x3bdf('0xc'),auth[_0x3bdf('0xa')](),controller[_0x3bdf('0x10')]);router['delete'](_0x3bdf('0xc'),auth['isAuthenticated'](),controller[_0x3bdf('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8443=['/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserChatInteraction.controller','get','isAuthenticated','index'];(function(_0x9fc395,_0x2cde4c){var _0x1912f2=function(_0x312c5c){while(--_0x312c5c){_0x9fc395['push'](_0x9fc395['shift']());}};_0x1912f2(++_0x2cde4c);}(_0x8443,0x7f));var _0x3844=function(_0x176cbe,_0xfbbda6){_0x176cbe=_0x176cbe-0x0;var _0x1490cc=_0x8443[_0x176cbe];return _0x1490cc;};'use strict';var multer=require(_0x3844('0x0'));var util=require(_0x3844('0x1'));var path=require(_0x3844('0x2'));var timeout=require(_0x3844('0x3'));var express=require(_0x3844('0x4'));var router=express[_0x3844('0x5')]();var auth=require(_0x3844('0x6'));var interaction=require(_0x3844('0x7'));var config=require(_0x3844('0x8'));var controller=require(_0x3844('0x9'));router[_0x3844('0xa')]('/',auth[_0x3844('0xb')](),controller[_0x3844('0xc')]);router['get'](_0x3844('0xd'),auth[_0x3844('0xb')](),controller[_0x3844('0xe')]);router[_0x3844('0xf')]('/',auth[_0x3844('0xb')](),controller[_0x3844('0x10')]);router[_0x3844('0x11')](_0x3844('0xd'),auth[_0x3844('0xb')](),controller[_0x3844('0x12')]);router[_0x3844('0x13')](_0x3844('0xd'),auth[_0x3844('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index dc11514..2c20f29 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 _0xfad8=['INTEGER','sequelize','exports'];(function(_0x207372,_0x1c4519){var _0x1dbcbd=function(_0x4958e1){while(--_0x4958e1){_0x207372['push'](_0x207372['shift']());}};_0x1dbcbd(++_0x1c4519);}(_0xfad8,0x118));var _0x8fad=function(_0x350b22,_0x1050c1){_0x350b22=_0x350b22-0x0;var _0x22bc89=_0xfad8[_0x350b22];return _0x22bc89;};'use strict';var Sequelize=require(_0x8fad('0x0'));module[_0x8fad('0x1')]={'FaxInteractionId':{'type':Sequelize[_0x8fad('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x8fad('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x2a85=['INTEGER','exports'];(function(_0x57f74a,_0x3f8b13){var _0x15b677=function(_0x332610){while(--_0x332610){_0x57f74a['push'](_0x57f74a['shift']());}};_0x15b677(++_0x3f8b13);}(_0x2a85,0x161));var _0x52a8=function(_0x26b367,_0x158299){_0x26b367=_0x26b367-0x0;var _0x5a7c9f=_0x2a85[_0x26b367];return _0x5a7c9f;};'use strict';var Sequelize=require('sequelize');module[_0x52a8('0x0')]={'FaxInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x52a8('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.controller.js b/server/api/UserFaxInteraction/UserFaxInteraction.controller.js index 17b4482..fbeee52 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 _0xaf25=['offset','limit','Content-Range','json','apply','save','update','destroy','get','UserFaxInteractions','UserProfileResource','then','error','name','send','index','map','UserFaxInteraction','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','count'];(function(_0x25f686,_0x199629){var _0x54ad10=function(_0x1f9083){while(--_0x1f9083){_0x25f686['push'](_0x25f686['shift']());}};_0x54ad10(++_0x199629);}(_0xaf25,0x116));var _0x5af2=function(_0x40f742,_0x478d98){_0x40f742=_0x40f742-0x0;var _0x30c3e4=_0xaf25[_0x40f742];return _0x30c3e4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5af2('0x0'));var rimraf=require(_0x5af2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5af2('0x2'));var rp=require('request-promise');var moment=require(_0x5af2('0x3'));var BPromise=require(_0x5af2('0x4'));var Mustache=require(_0x5af2('0x5'));var util=require(_0x5af2('0x6'));var path=require('path');var sox=require(_0x5af2('0x7'));var csv=require(_0x5af2('0x8'));var ejs=require(_0x5af2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5af2('0xa'));var crypto=require(_0x5af2('0xb'));var jsforce=require(_0x5af2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5af2('0x8'));var querystring=require(_0x5af2('0xd'));var Papa=require(_0x5af2('0xe'));var Redis=require(_0x5af2('0xf'));var authService=require(_0x5af2('0x10'));var qs=require(_0x5af2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5af2('0x12'));var logger=require(_0x5af2('0x13'))(_0x5af2('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5af2('0x15'))['db'];function respondWithStatusCode(_0x55d1e0,_0x5ec7e1){_0x5ec7e1=_0x5ec7e1||0xcc;return function(_0x5c3725){if(_0x5c3725){return _0x55d1e0[_0x5af2('0x16')](_0x5ec7e1);}return _0x55d1e0[_0x5af2('0x17')](_0x5ec7e1)[_0x5af2('0x18')]();};}function respondWithResult(_0x4e53d9,_0x205154){_0x205154=_0x205154||0xc8;return function(_0x5a053f){if(_0x5a053f){return _0x4e53d9[_0x5af2('0x17')](_0x205154)['json'](_0x5a053f);}};}function respondWithFilteredResult(_0x5ceb32,_0x368e33){return function(_0xc7c33f){if(_0xc7c33f){var _0x674e3=_0xc7c33f[_0x5af2('0x19')],_0x1d701c=_0x368e33[_0x5af2('0x1a')],_0x276c69=_0x368e33['offset']+_0x368e33[_0x5af2('0x1b')],_0x4e2a54;if(_0x276c69>=_0x674e3){_0x276c69=_0x674e3;_0x4e2a54=0xc8;}else{_0x4e2a54=0xce;}_0x5ceb32['status'](_0x4e2a54);return _0x5ceb32['set'](_0x5af2('0x1c'),_0x1d701c+'-'+_0x276c69+'/'+_0x674e3)[_0x5af2('0x1d')](_0xc7c33f);}return null;};}function patchUpdates(_0x317235){return function(_0x1f7c7e){try{jsonpatch[_0x5af2('0x1e')](_0x1f7c7e,_0x317235,!![]);}catch(_0x2a6d77){return BPromise['reject'](_0x2a6d77);}return _0x1f7c7e[_0x5af2('0x1f')]();};}function saveUpdates(_0x2fa021,_0x123213){return function(_0x5471e5){if(_0x5471e5){return _0x5471e5[_0x5af2('0x20')](_0x2fa021)['then'](function(_0x444836){return _0x444836;});}return null;};}function removeEntity(_0x1f8d97,_0x375a8a){return function(_0x4570c2){if(_0x4570c2){return _0x4570c2[_0x5af2('0x21')]()['then'](function(){var _0x473099=_0x4570c2[_0x5af2('0x22')]({'plain':!![]});var _0x3f2eac=_0x5af2('0x23');return db[_0x5af2('0x24')]['destroy']({'where':{'type':_0x3f2eac,'resourceId':_0x473099['id']}})[_0x5af2('0x25')](function(){return _0x4570c2;});})['then'](function(){_0x1f8d97[_0x5af2('0x17')](0xcc)[_0x5af2('0x18')]();});}};}function handleEntityNotFound(_0x4244f8,_0x18fcc3){return function(_0x5ce7f8){if(!_0x5ce7f8){_0x4244f8['sendStatus'](0x194);}return _0x5ce7f8;};}function handleError(_0x3a2092,_0x2c1f62){_0x2c1f62=_0x2c1f62||0x1f4;return function(_0x30f2ba){logger[_0x5af2('0x26')](_0x30f2ba['stack']);if(_0x30f2ba[_0x5af2('0x27')]){delete _0x30f2ba[_0x5af2('0x27')];}_0x3a2092[_0x5af2('0x17')](_0x2c1f62)[_0x5af2('0x28')](_0x30f2ba);};}exports[_0x5af2('0x29')]=function(_0x10645c,_0x247614){var _0x35fc97={},_0x3dee65={},_0x3bc84c={'count':0x0,'rows':[]};var _0x52d8e4=_[_0x5af2('0x2a')](db[_0x5af2('0x2b')][_0x5af2('0x2c')],function(_0x4ea4a7){return{'name':_0x4ea4a7['fieldName'],'type':_0x4ea4a7['type']['key']};});_0x3dee65[_0x5af2('0x2d')]=_[_0x5af2('0x2a')](_0x52d8e4,'name');_0x3dee65[_0x5af2('0x2e')]=_[_0x5af2('0x2f')](_0x10645c[_0x5af2('0x2e')]);_0x3dee65[_0x5af2('0x30')]=_[_0x5af2('0x31')](_0x3dee65['model'],_0x3dee65[_0x5af2('0x2e')]);_0x35fc97['attributes']=_[_0x5af2('0x31')](_0x3dee65[_0x5af2('0x2d')],qs[_0x5af2('0x32')](_0x10645c[_0x5af2('0x2e')][_0x5af2('0x32')]));_0x35fc97[_0x5af2('0x33')]=_0x35fc97[_0x5af2('0x33')][_0x5af2('0x34')]?_0x35fc97['attributes']:_0x3dee65[_0x5af2('0x2d')];if(!_0x10645c[_0x5af2('0x2e')]['hasOwnProperty'](_0x5af2('0x35'))){_0x35fc97[_0x5af2('0x1b')]=qs['limit'](_0x10645c['query'][_0x5af2('0x1b')]);_0x35fc97[_0x5af2('0x1a')]=qs['offset'](_0x10645c[_0x5af2('0x2e')][_0x5af2('0x1a')]);}_0x35fc97[_0x5af2('0x36')]=qs[_0x5af2('0x37')](_0x10645c[_0x5af2('0x2e')][_0x5af2('0x37')]);_0x35fc97[_0x5af2('0x38')]=qs[_0x5af2('0x30')](_[_0x5af2('0x39')](_0x10645c[_0x5af2('0x2e')],_0x3dee65['filters']),_0x52d8e4);if(_0x10645c[_0x5af2('0x2e')][_0x5af2('0x3a')]){_0x35fc97[_0x5af2('0x38')]=_[_0x5af2('0x3b')](_0x35fc97[_0x5af2('0x38')],{'$or':_['map'](_0x52d8e4,function(_0x40e342){if(_0x40e342['type']!==_0x5af2('0x3c')){var _0x2cfce1={};_0x2cfce1[_0x40e342[_0x5af2('0x27')]]={'$like':'%'+_0x10645c['query'][_0x5af2('0x3a')]+'%'};return _0x2cfce1;}})});}_0x35fc97=_[_0x5af2('0x3b')]({},_0x35fc97,_0x10645c[_0x5af2('0x3d')]);var _0x2e73aa={'where':_0x35fc97[_0x5af2('0x38')]};return db['UserFaxInteraction'][_0x5af2('0x19')](_0x2e73aa)['then'](function(_0x4e03ca){_0x3bc84c[_0x5af2('0x19')]=_0x4e03ca;if(_0x10645c[_0x5af2('0x2e')][_0x5af2('0x3e')]){_0x35fc97[_0x5af2('0x3f')]=[{'all':!![]}];}return db[_0x5af2('0x2b')][_0x5af2('0x40')](_0x35fc97);})[_0x5af2('0x25')](function(_0x3f2b90){_0x3bc84c[_0x5af2('0x41')]=_0x3f2b90;return _0x3bc84c;})['then'](respondWithFilteredResult(_0x247614,_0x35fc97))['catch'](handleError(_0x247614,null));};exports['show']=function(_0x2f1e81,_0x513bd2){var _0x3fd048={'raw':!![],'where':{'id':_0x2f1e81[_0x5af2('0x42')]['id']}},_0x3bbee6={};_0x3bbee6[_0x5af2('0x2d')]=_['keys'](db[_0x5af2('0x2b')][_0x5af2('0x2c')]);_0x3bbee6[_0x5af2('0x2e')]=_['keys'](_0x2f1e81[_0x5af2('0x2e')]);_0x3bbee6[_0x5af2('0x30')]=_[_0x5af2('0x31')](_0x3bbee6['model'],_0x3bbee6[_0x5af2('0x2e')]);_0x3fd048[_0x5af2('0x33')]=_['intersection'](_0x3bbee6[_0x5af2('0x2d')],qs['fields'](_0x2f1e81[_0x5af2('0x2e')]['fields']));_0x3fd048['attributes']=_0x3fd048['attributes'][_0x5af2('0x34')]?_0x3fd048[_0x5af2('0x33')]:_0x3bbee6[_0x5af2('0x2d')];if(_0x2f1e81[_0x5af2('0x2e')][_0x5af2('0x3e')]){_0x3fd048[_0x5af2('0x3f')]=[{'all':!![]}];}_0x3fd048=_[_0x5af2('0x3b')]({},_0x3fd048,_0x2f1e81[_0x5af2('0x3d')]);return db['UserFaxInteraction'][_0x5af2('0x43')](_0x3fd048)['then'](handleEntityNotFound(_0x513bd2,null))[_0x5af2('0x25')](respondWithResult(_0x513bd2,null))['catch'](handleError(_0x513bd2,null));};exports[_0x5af2('0x44')]=function(_0x4b14e5,_0xeee0c6){return db[_0x5af2('0x2b')][_0x5af2('0x44')](_0x4b14e5[_0x5af2('0x45')],{})[_0x5af2('0x25')](function(_0x44fa10){var _0x144284=_0x4b14e5[_0x5af2('0x46')][_0x5af2('0x22')]({'plain':!![]});if(!_0x144284)throw new Error(_0x5af2('0x47'));if(_0x144284[_0x5af2('0x48')]==='user'){var _0x14c618=_0x44fa10[_0x5af2('0x22')]({'plain':!![]});var _0x3d6886=_0x5af2('0x23');return db['UserProfileSection'][_0x5af2('0x43')]({'where':{'name':_0x3d6886,'userProfileId':_0x144284['userProfileId']},'raw':!![]})[_0x5af2('0x25')](function(_0x51da91){if(_0x51da91&&_0x51da91[_0x5af2('0x49')]===0x0){return db[_0x5af2('0x24')][_0x5af2('0x44')]({'name':_0x14c618[_0x5af2('0x27')],'resourceId':_0x14c618['id'],'type':_0x51da91['name'],'sectionId':_0x51da91['id']},{})['then'](function(){return _0x44fa10;});}else{return _0x44fa10;}})['catch'](function(_0x443cb9){logger[_0x5af2('0x26')](_0x5af2('0x4a'),_0x443cb9);throw _0x443cb9;});}return _0x44fa10;})[_0x5af2('0x25')](respondWithResult(_0xeee0c6,0xc9))[_0x5af2('0x4b')](handleError(_0xeee0c6,null));};exports[_0x5af2('0x20')]=function(_0x427549,_0x35af34){if(_0x427549[_0x5af2('0x45')]['id']){delete _0x427549[_0x5af2('0x45')]['id'];}return db[_0x5af2('0x2b')]['find']({'where':{'id':_0x427549[_0x5af2('0x42')]['id']}})['then'](handleEntityNotFound(_0x35af34,null))[_0x5af2('0x25')](saveUpdates(_0x427549[_0x5af2('0x45')],null))[_0x5af2('0x25')](respondWithResult(_0x35af34,null))['catch'](handleError(_0x35af34,null));};exports[_0x5af2('0x21')]=function(_0xc97f3f,_0x26d6dd){return db['UserFaxInteraction'][_0x5af2('0x43')]({'where':{'id':_0xc97f3f[_0x5af2('0x42')]['id']}})['then'](handleEntityNotFound(_0x26d6dd,null))[_0x5af2('0x25')](removeEntity(_0x26d6dd,null))[_0x5af2('0x4b')](handleError(_0x26d6dd,null));}; \ No newline at end of file +var _0x9325=['index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','VIRTUAL','filter','UserFaxInteraction','count','include','findAll','rows','catch','show','includeAll','create','body','user','role','get','UserFaxInteractions','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','set','Content-Range','apply','destroy','then','sendStatus','stack','name','send'];(function(_0x26ae05,_0x53e7ea){var _0x1e8338=function(_0x241a59){while(--_0x241a59){_0x26ae05['push'](_0x26ae05['shift']());}};_0x1e8338(++_0x53e7ea);}(_0x9325,0x1f4));var _0x5932=function(_0x3c0085,_0x214c62){_0x3c0085=_0x3c0085-0x0;var _0x530b41=_0x9325[_0x3c0085];return _0x530b41;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5932('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5932('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5932('0x2'));var BPromise=require(_0x5932('0x3'));var Mustache=require(_0x5932('0x4'));var util=require(_0x5932('0x5'));var path=require('path');var sox=require(_0x5932('0x6'));var csv=require(_0x5932('0x7'));var ejs=require(_0x5932('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5932('0x9'));var crypto=require(_0x5932('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5932('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5932('0xc'));var Papa=require(_0x5932('0xd'));var Redis=require(_0x5932('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5932('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x5932('0x10'));var config=require(_0x5932('0x11'));var licenseUtil=require(_0x5932('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc27a,_0x2c79dc){_0x2c79dc=_0x2c79dc||0xcc;return function(_0x384bb2){if(_0x384bb2){return _0xc27a['sendStatus'](_0x2c79dc);}return _0xc27a[_0x5932('0x13')](_0x2c79dc)[_0x5932('0x14')]();};}function respondWithResult(_0x3ed24d,_0x1984fa){_0x1984fa=_0x1984fa||0xc8;return function(_0x412a7d){if(_0x412a7d){return _0x3ed24d[_0x5932('0x13')](_0x1984fa)[_0x5932('0x15')](_0x412a7d);}};}function respondWithFilteredResult(_0xc52ef8,_0x36f695){return function(_0x1e11c6){if(_0x1e11c6){var _0x598c7a=_0x1e11c6['count'],_0x2ce388=_0x36f695['offset'],_0x5770a9=_0x36f695['offset']+_0x36f695[_0x5932('0x16')],_0x16f5b5;if(_0x5770a9>=_0x598c7a){_0x5770a9=_0x598c7a;_0x16f5b5=0xc8;}else{_0x16f5b5=0xce;}_0xc52ef8[_0x5932('0x13')](_0x16f5b5);return _0xc52ef8[_0x5932('0x17')](_0x5932('0x18'),_0x2ce388+'-'+_0x5770a9+'/'+_0x598c7a)[_0x5932('0x15')](_0x1e11c6);}return null;};}function patchUpdates(_0xcd2ac6){return function(_0x779332){try{jsonpatch[_0x5932('0x19')](_0x779332,_0xcd2ac6,!![]);}catch(_0x3ffe8e){return BPromise['reject'](_0x3ffe8e);}return _0x779332['save']();};}function saveUpdates(_0x3f46e8,_0x2589de){return function(_0x4d87b2){if(_0x4d87b2){return _0x4d87b2['update'](_0x3f46e8)['then'](function(_0x397c42){return _0x397c42;});}return null;};}function removeEntity(_0x59feb9,_0x5ad5ed){return function(_0x4ae442){if(_0x4ae442){return _0x4ae442[_0x5932('0x1a')]()[_0x5932('0x1b')](function(){var _0x4c7e46=_0x4ae442['get']({'plain':!![]});var _0x4b7e62='UserFaxInteractions';return db['UserProfileResource'][_0x5932('0x1a')]({'where':{'type':_0x4b7e62,'resourceId':_0x4c7e46['id']}})[_0x5932('0x1b')](function(){return _0x4ae442;});})[_0x5932('0x1b')](function(){_0x59feb9[_0x5932('0x13')](0xcc)[_0x5932('0x14')]();});}};}function handleEntityNotFound(_0x398fef,_0x5a4ed5){return function(_0x3eb73a){if(!_0x3eb73a){_0x398fef[_0x5932('0x1c')](0x194);}return _0x3eb73a;};}function handleError(_0x32cf8b,_0x5d2610){_0x5d2610=_0x5d2610||0x1f4;return function(_0x42c2f0){logger['error'](_0x42c2f0[_0x5932('0x1d')]);if(_0x42c2f0[_0x5932('0x1e')]){delete _0x42c2f0[_0x5932('0x1e')];}_0x32cf8b[_0x5932('0x13')](_0x5d2610)[_0x5932('0x1f')](_0x42c2f0);};}exports[_0x5932('0x20')]=function(_0x17d8e8,_0x3c9ebe){var _0x35f460={},_0x2d9960={},_0x5b1f51={'count':0x0,'rows':[]};var _0x2f0b57=_[_0x5932('0x21')](db['UserFaxInteraction'][_0x5932('0x22')],function(_0x5a853e){return{'name':_0x5a853e[_0x5932('0x23')],'type':_0x5a853e[_0x5932('0x24')][_0x5932('0x25')]};});_0x2d9960[_0x5932('0x26')]=_[_0x5932('0x21')](_0x2f0b57,_0x5932('0x1e'));_0x2d9960['query']=_[_0x5932('0x27')](_0x17d8e8['query']);_0x2d9960[_0x5932('0x28')]=_['intersection'](_0x2d9960[_0x5932('0x26')],_0x2d9960['query']);_0x35f460['attributes']=_[_0x5932('0x29')](_0x2d9960[_0x5932('0x26')],qs['fields'](_0x17d8e8[_0x5932('0x2a')][_0x5932('0x2b')]));_0x35f460[_0x5932('0x2c')]=_0x35f460['attributes'][_0x5932('0x2d')]?_0x35f460[_0x5932('0x2c')]:_0x2d9960[_0x5932('0x26')];if(!_0x17d8e8[_0x5932('0x2a')][_0x5932('0x2e')](_0x5932('0x2f'))){_0x35f460[_0x5932('0x16')]=qs[_0x5932('0x16')](_0x17d8e8[_0x5932('0x2a')][_0x5932('0x16')]);_0x35f460[_0x5932('0x30')]=qs[_0x5932('0x30')](_0x17d8e8[_0x5932('0x2a')][_0x5932('0x30')]);}_0x35f460[_0x5932('0x31')]=qs[_0x5932('0x32')](_0x17d8e8[_0x5932('0x2a')]['sort']);_0x35f460['where']=qs[_0x5932('0x28')](_[_0x5932('0x33')](_0x17d8e8[_0x5932('0x2a')],_0x2d9960[_0x5932('0x28')]),_0x2f0b57);if(_0x17d8e8[_0x5932('0x2a')]['filter']){_0x35f460[_0x5932('0x34')]=_[_0x5932('0x35')](_0x35f460[_0x5932('0x34')],{'$or':_[_0x5932('0x21')](_0x2f0b57,function(_0x12b6b2){if(_0x12b6b2[_0x5932('0x24')]!==_0x5932('0x36')){var _0x54db10={};_0x54db10[_0x12b6b2[_0x5932('0x1e')]]={'$like':'%'+_0x17d8e8[_0x5932('0x2a')][_0x5932('0x37')]+'%'};return _0x54db10;}})});}_0x35f460=_[_0x5932('0x35')]({},_0x35f460,_0x17d8e8['options']);var _0x24961c={'where':_0x35f460[_0x5932('0x34')]};return db[_0x5932('0x38')]['count'](_0x24961c)[_0x5932('0x1b')](function(_0x3a707a){_0x5b1f51[_0x5932('0x39')]=_0x3a707a;if(_0x17d8e8[_0x5932('0x2a')]['includeAll']){_0x35f460[_0x5932('0x3a')]=[{'all':!![]}];}return db[_0x5932('0x38')][_0x5932('0x3b')](_0x35f460);})[_0x5932('0x1b')](function(_0x528de5){_0x5b1f51[_0x5932('0x3c')]=_0x528de5;return _0x5b1f51;})[_0x5932('0x1b')](respondWithFilteredResult(_0x3c9ebe,_0x35f460))[_0x5932('0x3d')](handleError(_0x3c9ebe,null));};exports[_0x5932('0x3e')]=function(_0x52c4c7,_0x102410){var _0x2bc142={'raw':!![],'where':{'id':_0x52c4c7['params']['id']}},_0xf26387={};_0xf26387[_0x5932('0x26')]=_[_0x5932('0x27')](db[_0x5932('0x38')]['rawAttributes']);_0xf26387[_0x5932('0x2a')]=_[_0x5932('0x27')](_0x52c4c7[_0x5932('0x2a')]);_0xf26387['filters']=_[_0x5932('0x29')](_0xf26387[_0x5932('0x26')],_0xf26387['query']);_0x2bc142[_0x5932('0x2c')]=_['intersection'](_0xf26387['model'],qs[_0x5932('0x2b')](_0x52c4c7[_0x5932('0x2a')][_0x5932('0x2b')]));_0x2bc142[_0x5932('0x2c')]=_0x2bc142[_0x5932('0x2c')][_0x5932('0x2d')]?_0x2bc142['attributes']:_0xf26387[_0x5932('0x26')];if(_0x52c4c7[_0x5932('0x2a')][_0x5932('0x3f')]){_0x2bc142[_0x5932('0x3a')]=[{'all':!![]}];}_0x2bc142=_[_0x5932('0x35')]({},_0x2bc142,_0x52c4c7['options']);return db[_0x5932('0x38')]['find'](_0x2bc142)[_0x5932('0x1b')](handleEntityNotFound(_0x102410,null))['then'](respondWithResult(_0x102410,null))[_0x5932('0x3d')](handleError(_0x102410,null));};exports[_0x5932('0x40')]=function(_0xbb978b,_0x3613e7){return db['UserFaxInteraction'][_0x5932('0x40')](_0xbb978b[_0x5932('0x41')],{})['then'](function(_0x25db88){var _0x2c67db=_0xbb978b[_0x5932('0x42')]['get']({'plain':!![]});if(!_0x2c67db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c67db[_0x5932('0x43')]===_0x5932('0x42')){var _0x11526b=_0x25db88[_0x5932('0x44')]({'plain':!![]});var _0x5cbd38=_0x5932('0x45');return db[_0x5932('0x46')]['find']({'where':{'name':_0x5cbd38,'userProfileId':_0x2c67db['userProfileId']},'raw':!![]})[_0x5932('0x1b')](function(_0x3e9b69){if(_0x3e9b69&&_0x3e9b69[_0x5932('0x47')]===0x0){return db[_0x5932('0x48')][_0x5932('0x40')]({'name':_0x11526b[_0x5932('0x1e')],'resourceId':_0x11526b['id'],'type':_0x3e9b69['name'],'sectionId':_0x3e9b69['id']},{})['then'](function(){return _0x25db88;});}else{return _0x25db88;}})[_0x5932('0x3d')](function(_0x5d6444){logger['error'](_0x5932('0x49'),_0x5d6444);throw _0x5d6444;});}return _0x25db88;})[_0x5932('0x1b')](respondWithResult(_0x3613e7,0xc9))[_0x5932('0x3d')](handleError(_0x3613e7,null));};exports[_0x5932('0x4a')]=function(_0x5a9f5d,_0x2b09ab){if(_0x5a9f5d['body']['id']){delete _0x5a9f5d[_0x5932('0x41')]['id'];}return db['UserFaxInteraction'][_0x5932('0x4b')]({'where':{'id':_0x5a9f5d['params']['id']}})[_0x5932('0x1b')](handleEntityNotFound(_0x2b09ab,null))[_0x5932('0x1b')](saveUpdates(_0x5a9f5d['body'],null))[_0x5932('0x1b')](respondWithResult(_0x2b09ab,null))[_0x5932('0x3d')](handleError(_0x2b09ab,null));};exports[_0x5932('0x1a')]=function(_0x3f1a26,_0x3b6ba8){return db[_0x5932('0x38')][_0x5932('0x4b')]({'where':{'id':_0x3f1a26['params']['id']}})[_0x5932('0x1b')](handleEntityNotFound(_0x3b6ba8,null))[_0x5932('0x1b')](removeEntity(_0x3b6ba8,null))[_0x5932('0x3d')](handleError(_0x3b6ba8,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index d153fb0..3752044 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 _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','lodash','util'];(function(_0x2307fe,_0x413da5){var _0x4453da=function(_0x5f4cb3){while(--_0x5f4cb3){_0x2307fe['push'](_0x2307fe['shift']());}};_0x4453da(++_0x413da5);}(_0xdb28,0x106));var _0x8db2=function(_0x33c430,_0x565e91){_0x33c430=_0x33c430-0x0;var _0x46cc9b=_0xdb28[_0x33c430];return _0x46cc9b;};'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('./UserFaxInteraction.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','lodash','util'];(function(_0x323362,_0x2a9ad1){var _0x10d9d6=function(_0x38c189){while(--_0x38c189){_0x323362['push'](_0x323362['shift']());}};_0x10d9d6(++_0x2a9ad1);}(_0xdb28,0x106));var _0x8db2=function(_0x2df8dc,_0x55229){_0x2df8dc=_0x2df8dc-0x0;var _0x2bb133=_0xdb28[_0x2df8dc];return _0x2bb133;};'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('./UserFaxInteraction.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'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 c61dbb6..db90de1 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 _0xfee3=['UserFaxInteraction,\x20%s,\x20%s','request\x20sent','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xfee3,0x183));var _0x3fee=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0xfee3[_0x2bcb75];return _0x175345;};'use strict';var _=require(_0x3fee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3fee('0x1'));var fs=require('fs');var Redis=require(_0x3fee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fee('0x3'));var logger=require(_0x3fee('0x4'))(_0x3fee('0x5'));var config=require(_0x3fee('0x6'));var jayson=require(_0x3fee('0x7'));var client=jayson[_0x3fee('0x8')][_0x3fee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b0465,_0x14b7e4,_0x4227da){return new BPromise(function(_0x581bfb,_0x1eb658){return client['request'](_0x2b0465,_0x4227da)[_0x3fee('0xa')](function(_0x2e9835){logger[_0x3fee('0xb')](_0x3fee('0xc'),_0x14b7e4,_0x3fee('0xd'));logger[_0x3fee('0xe')](_0x3fee('0xf'),_0x14b7e4,_0x3fee('0xd'),JSON[_0x3fee('0x10')](_0x2e9835));if(_0x2e9835['error']){if(_0x2e9835[_0x3fee('0x11')][_0x3fee('0x12')]===0x1f4){logger[_0x3fee('0x11')]('UserFaxInteraction,\x20%s,\x20%s',_0x14b7e4,_0x2e9835[_0x3fee('0x11')][_0x3fee('0x13')]);return _0x1eb658(_0x2e9835[_0x3fee('0x11')][_0x3fee('0x13')]);}logger[_0x3fee('0x11')](_0x3fee('0xc'),_0x14b7e4,_0x2e9835[_0x3fee('0x11')]['message']);return _0x581bfb(_0x2e9835['error'][_0x3fee('0x13')]);}else{logger[_0x3fee('0xb')](_0x3fee('0xc'),_0x14b7e4,_0x3fee('0xd'));_0x581bfb(_0x2e9835[_0x3fee('0x14')][_0x3fee('0x13')]);}})['catch'](function(_0x2000c7){logger[_0x3fee('0x11')]('UserFaxInteraction,\x20%s,\x20%s',_0x14b7e4,_0x2000c7);_0x1eb658(_0x2000c7);});});} \ No newline at end of file +var _0xa519=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxInteraction,\x20%s,\x20%s','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x231cdc,_0x5ede8f){var _0x36043c=function(_0xa16153){while(--_0xa16153){_0x231cdc['push'](_0x231cdc['shift']());}};_0x36043c(++_0x5ede8f);}(_0xa519,0x114));var _0x9a51=function(_0x3f1e64,_0x42c2bc){_0x3f1e64=_0x3f1e64-0x0;var _0x21dcb0=_0xa519[_0x3f1e64];return _0x21dcb0;};'use strict';var _=require(_0x9a51('0x0'));var util=require(_0x9a51('0x1'));var moment=require(_0x9a51('0x2'));var BPromise=require(_0x9a51('0x3'));var rs=require(_0x9a51('0x4'));var fs=require('fs');var Redis=require(_0x9a51('0x5'));var db=require(_0x9a51('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a51('0x7'))('rpc');var config=require(_0x9a51('0x8'));var jayson=require(_0x9a51('0x9'));var client=jayson[_0x9a51('0xa')][_0x9a51('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c8af9,_0x4a7143,_0x26c953){return new BPromise(function(_0x4a996b,_0x16fba5){return client[_0x9a51('0xc')](_0x5c8af9,_0x26c953)[_0x9a51('0xd')](function(_0x3750f3){logger[_0x9a51('0xe')](_0x9a51('0xf'),_0x4a7143,'request\x20sent');logger[_0x9a51('0x10')](_0x9a51('0x11'),_0x4a7143,'request\x20sent',JSON[_0x9a51('0x12')](_0x3750f3));if(_0x3750f3[_0x9a51('0x13')]){if(_0x3750f3[_0x9a51('0x13')][_0x9a51('0x14')]===0x1f4){logger[_0x9a51('0x13')]('UserFaxInteraction,\x20%s,\x20%s',_0x4a7143,_0x3750f3[_0x9a51('0x13')][_0x9a51('0x15')]);return _0x16fba5(_0x3750f3[_0x9a51('0x13')][_0x9a51('0x15')]);}logger[_0x9a51('0x13')](_0x9a51('0xf'),_0x4a7143,_0x3750f3['error'][_0x9a51('0x15')]);return _0x4a996b(_0x3750f3[_0x9a51('0x13')]['message']);}else{logger['info'](_0x9a51('0xf'),_0x4a7143,_0x9a51('0x16'));_0x4a996b(_0x3750f3[_0x9a51('0x17')][_0x9a51('0x15')]);}})[_0x9a51('0x18')](function(_0xc01c01){logger[_0x9a51('0x13')](_0x9a51('0xf'),_0x4a7143,_0xc01c01);_0x16fba5(_0xc01c01);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index 0ab1d9a..89f9974 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 _0x2861=['put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserFaxInteraction.controller','index','get','/:id','isAuthenticated','post','create'];(function(_0x222925,_0x30b750){var _0x522d23=function(_0x1c82e0){while(--_0x1c82e0){_0x222925['push'](_0x222925['shift']());}};_0x522d23(++_0x30b750);}(_0x2861,0x1c5));var _0x1286=function(_0x11ea64,_0x59f7a2){_0x11ea64=_0x11ea64-0x0;var _0x30590a=_0x2861[_0x11ea64];return _0x30590a;};'use strict';var multer=require('multer');var util=require(_0x1286('0x0'));var path=require(_0x1286('0x1'));var timeout=require(_0x1286('0x2'));var express=require(_0x1286('0x3'));var router=express[_0x1286('0x4')]();var auth=require(_0x1286('0x5'));var interaction=require(_0x1286('0x6'));var config=require(_0x1286('0x7'));var controller=require(_0x1286('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1286('0x9')]);router[_0x1286('0xa')](_0x1286('0xb'),auth[_0x1286('0xc')](),controller['show']);router[_0x1286('0xd')]('/',auth[_0x1286('0xc')](),controller[_0x1286('0xe')]);router[_0x1286('0xf')](_0x1286('0xb'),auth[_0x1286('0xc')](),controller[_0x1286('0x10')]);router['delete']('/:id',auth[_0x1286('0xc')](),controller[_0x1286('0x11')]);module['exports']=router; \ No newline at end of file +var _0x19a8=['isAuthenticated','/:id','show','create','put','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x19a8,0x88));var _0x819a=function(_0x584015,_0x1af916){_0x584015=_0x584015-0x0;var _0x5a8926=_0x19a8[_0x584015];return _0x5a8926;};'use strict';var multer=require(_0x819a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x819a('0x1'));var express=require(_0x819a('0x2'));var router=express[_0x819a('0x3')]();var auth=require(_0x819a('0x4'));var interaction=require(_0x819a('0x5'));var config=require(_0x819a('0x6'));var controller=require('./UserFaxInteraction.controller');router[_0x819a('0x7')]('/',auth[_0x819a('0x8')](),controller['index']);router[_0x819a('0x7')](_0x819a('0x9'),auth[_0x819a('0x8')](),controller[_0x819a('0xa')]);router['post']('/',auth[_0x819a('0x8')](),controller[_0x819a('0xb')]);router[_0x819a('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x819a('0xd')]);router[_0x819a('0xe')](_0x819a('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x819a('0xf')]=router; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.attributes.js b/server/api/UserMailInteraction/UserMailInteraction.attributes.js index 55a3225..979e828 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 _0x617f=['INTEGER','sequelize'];(function(_0x1d2240,_0x1fd90d){var _0x3da2c6=function(_0x5c70a0){while(--_0x5c70a0){_0x1d2240['push'](_0x1d2240['shift']());}};_0x3da2c6(++_0x1fd90d);}(_0x617f,0x9b));var _0xf617=function(_0x4f274f,_0x16a70c){_0x4f274f=_0x4f274f-0x0;var _0x18345b=_0x617f[_0x4f274f];return _0x18345b;};'use strict';var Sequelize=require(_0xf617('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize[_0xf617('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xf617('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0x45ab=['INTEGER'];(function(_0x3cb872,_0x4b26e2){var _0x288d59=function(_0x30276e){while(--_0x30276e){_0x3cb872['push'](_0x3cb872['shift']());}};_0x288d59(++_0x4b26e2);}(_0x45ab,0xe6));var _0xb45a=function(_0x23bfbb,_0x3b0fa2){_0x23bfbb=_0x23bfbb-0x0;var _0x383576=_0x45ab[_0x23bfbb];return _0x383576;};'use strict';var Sequelize=require('sequelize');module['exports']={'MailInteractionId':{'type':Sequelize[_0xb45a('0x0')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xb45a('0x0')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.controller.js b/server/api/UserMailInteraction/UserMailInteraction.controller.js index c93869b..dec8143 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 _0x0ab0=['bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','Content-Range','apply','save','update','then','destroy','UserMailInteractions','UserProfileResource','error','name','send','index','map','UserMailInteraction','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x207fea,_0x114dc4){var _0x5f6933=function(_0x4caf6e){while(--_0x4caf6e){_0x207fea['push'](_0x207fea['shift']());}};_0x5f6933(++_0x114dc4);}(_0x0ab0,0x9c));var _0x00ab=function(_0x4e8c30,_0x58e486){_0x4e8c30=_0x4e8c30-0x0;var _0x293496=_0x0ab0[_0x4e8c30];return _0x293496;};'use strict';var pdf=require(_0x00ab('0x0'));var emlformat=require(_0x00ab('0x1'));var rimraf=require(_0x00ab('0x2'));var zipdir=require(_0x00ab('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x00ab('0x4'));var Mustache=require(_0x00ab('0x5'));var util=require(_0x00ab('0x6'));var path=require(_0x00ab('0x7'));var sox=require(_0x00ab('0x8'));var csv=require(_0x00ab('0x9'));var ejs=require(_0x00ab('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x00ab('0xb'));var jsforce=require(_0x00ab('0xc'));var deskjs=require(_0x00ab('0xd'));var toCsv=require(_0x00ab('0x9'));var querystring=require(_0x00ab('0xe'));var Papa=require(_0x00ab('0xf'));var Redis=require('ioredis');var authService=require(_0x00ab('0x10'));var qs=require(_0x00ab('0x11'));var as=require(_0x00ab('0x12'));var hardwareService=require(_0x00ab('0x13'));var logger=require(_0x00ab('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x00ab('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x00ab('0x16'))['db'];function respondWithStatusCode(_0x985422,_0x260026){_0x260026=_0x260026||0xcc;return function(_0x35d641){if(_0x35d641){return _0x985422[_0x00ab('0x17')](_0x260026);}return _0x985422['status'](_0x260026)[_0x00ab('0x18')]();};}function respondWithResult(_0x13166d,_0x23056a){_0x23056a=_0x23056a||0xc8;return function(_0x3b755a){if(_0x3b755a){return _0x13166d[_0x00ab('0x19')](_0x23056a)[_0x00ab('0x1a')](_0x3b755a);}};}function respondWithFilteredResult(_0x32389b,_0x143d2b){return function(_0x5239d4){if(_0x5239d4){var _0x112697=_0x5239d4[_0x00ab('0x1b')],_0x246370=_0x143d2b['offset'],_0x4a46d2=_0x143d2b['offset']+_0x143d2b[_0x00ab('0x1c')],_0x5e0b50;if(_0x4a46d2>=_0x112697){_0x4a46d2=_0x112697;_0x5e0b50=0xc8;}else{_0x5e0b50=0xce;}_0x32389b[_0x00ab('0x19')](_0x5e0b50);return _0x32389b['set'](_0x00ab('0x1d'),_0x246370+'-'+_0x4a46d2+'/'+_0x112697)[_0x00ab('0x1a')](_0x5239d4);}return null;};}function patchUpdates(_0x3e6819){return function(_0x13f5c6){try{jsonpatch[_0x00ab('0x1e')](_0x13f5c6,_0x3e6819,!![]);}catch(_0x301e6b){return BPromise['reject'](_0x301e6b);}return _0x13f5c6[_0x00ab('0x1f')]();};}function saveUpdates(_0x1baf70,_0x253228){return function(_0x5922d0){if(_0x5922d0){return _0x5922d0[_0x00ab('0x20')](_0x1baf70)[_0x00ab('0x21')](function(_0x4d0d98){return _0x4d0d98;});}return null;};}function removeEntity(_0x2f7df8,_0x24a4de){return function(_0x1b7ad6){if(_0x1b7ad6){return _0x1b7ad6[_0x00ab('0x22')]()[_0x00ab('0x21')](function(){var _0x4806b3=_0x1b7ad6['get']({'plain':!![]});var _0x5c87d6=_0x00ab('0x23');return db[_0x00ab('0x24')][_0x00ab('0x22')]({'where':{'type':_0x5c87d6,'resourceId':_0x4806b3['id']}})[_0x00ab('0x21')](function(){return _0x1b7ad6;});})[_0x00ab('0x21')](function(){_0x2f7df8[_0x00ab('0x19')](0xcc)[_0x00ab('0x18')]();});}};}function handleEntityNotFound(_0x4c40f1,_0x192c3c){return function(_0x1959bd){if(!_0x1959bd){_0x4c40f1[_0x00ab('0x17')](0x194);}return _0x1959bd;};}function handleError(_0x1b61db,_0x24baad){_0x24baad=_0x24baad||0x1f4;return function(_0x17f721){logger[_0x00ab('0x25')](_0x17f721['stack']);if(_0x17f721[_0x00ab('0x26')]){delete _0x17f721[_0x00ab('0x26')];}_0x1b61db[_0x00ab('0x19')](_0x24baad)[_0x00ab('0x27')](_0x17f721);};}exports[_0x00ab('0x28')]=function(_0x3110f8,_0x56a95d){var _0x3a0b19={},_0x293c42={},_0x5290b4={'count':0x0,'rows':[]};var _0x34f76b=_[_0x00ab('0x29')](db[_0x00ab('0x2a')][_0x00ab('0x2b')],function(_0x5a8c52){return{'name':_0x5a8c52[_0x00ab('0x2c')],'type':_0x5a8c52[_0x00ab('0x2d')]['key']};});_0x293c42['model']=_['map'](_0x34f76b,_0x00ab('0x26'));_0x293c42[_0x00ab('0x2e')]=_[_0x00ab('0x2f')](_0x3110f8[_0x00ab('0x2e')]);_0x293c42[_0x00ab('0x30')]=_['intersection'](_0x293c42['model'],_0x293c42['query']);_0x3a0b19[_0x00ab('0x31')]=_[_0x00ab('0x32')](_0x293c42[_0x00ab('0x33')],qs[_0x00ab('0x34')](_0x3110f8[_0x00ab('0x2e')][_0x00ab('0x34')]));_0x3a0b19[_0x00ab('0x31')]=_0x3a0b19['attributes'][_0x00ab('0x35')]?_0x3a0b19[_0x00ab('0x31')]:_0x293c42[_0x00ab('0x33')];if(!_0x3110f8['query'][_0x00ab('0x36')](_0x00ab('0x37'))){_0x3a0b19[_0x00ab('0x1c')]=qs[_0x00ab('0x1c')](_0x3110f8[_0x00ab('0x2e')][_0x00ab('0x1c')]);_0x3a0b19[_0x00ab('0x38')]=qs[_0x00ab('0x38')](_0x3110f8[_0x00ab('0x2e')]['offset']);}_0x3a0b19[_0x00ab('0x39')]=qs['sort'](_0x3110f8[_0x00ab('0x2e')][_0x00ab('0x3a')]);_0x3a0b19[_0x00ab('0x3b')]=qs[_0x00ab('0x30')](_[_0x00ab('0x3c')](_0x3110f8[_0x00ab('0x2e')],_0x293c42[_0x00ab('0x30')]),_0x34f76b);if(_0x3110f8['query']['filter']){_0x3a0b19[_0x00ab('0x3b')]=_['merge'](_0x3a0b19['where'],{'$or':_[_0x00ab('0x29')](_0x34f76b,function(_0x575bcc){if(_0x575bcc[_0x00ab('0x2d')]!==_0x00ab('0x3d')){var _0x2371ba={};_0x2371ba[_0x575bcc['name']]={'$like':'%'+_0x3110f8[_0x00ab('0x2e')][_0x00ab('0x3e')]+'%'};return _0x2371ba;}})});}_0x3a0b19=_[_0x00ab('0x3f')]({},_0x3a0b19,_0x3110f8[_0x00ab('0x40')]);var _0x239a07={'where':_0x3a0b19[_0x00ab('0x3b')]};return db[_0x00ab('0x2a')][_0x00ab('0x1b')](_0x239a07)[_0x00ab('0x21')](function(_0x23b63b){_0x5290b4[_0x00ab('0x1b')]=_0x23b63b;if(_0x3110f8[_0x00ab('0x2e')][_0x00ab('0x41')]){_0x3a0b19['include']=[{'all':!![]}];}return db[_0x00ab('0x2a')]['findAll'](_0x3a0b19);})[_0x00ab('0x21')](function(_0x3b85c6){_0x5290b4[_0x00ab('0x42')]=_0x3b85c6;return _0x5290b4;})[_0x00ab('0x21')](respondWithFilteredResult(_0x56a95d,_0x3a0b19))[_0x00ab('0x43')](handleError(_0x56a95d,null));};exports[_0x00ab('0x44')]=function(_0x26ba81,_0x214d26){var _0x5261f0={'raw':!![],'where':{'id':_0x26ba81[_0x00ab('0x45')]['id']}},_0x2678b3={};_0x2678b3[_0x00ab('0x33')]=_[_0x00ab('0x2f')](db[_0x00ab('0x2a')][_0x00ab('0x2b')]);_0x2678b3[_0x00ab('0x2e')]=_['keys'](_0x26ba81[_0x00ab('0x2e')]);_0x2678b3[_0x00ab('0x30')]=_[_0x00ab('0x32')](_0x2678b3['model'],_0x2678b3[_0x00ab('0x2e')]);_0x5261f0[_0x00ab('0x31')]=_[_0x00ab('0x32')](_0x2678b3[_0x00ab('0x33')],qs['fields'](_0x26ba81[_0x00ab('0x2e')][_0x00ab('0x34')]));_0x5261f0[_0x00ab('0x31')]=_0x5261f0[_0x00ab('0x31')]['length']?_0x5261f0['attributes']:_0x2678b3['model'];if(_0x26ba81[_0x00ab('0x2e')]['includeAll']){_0x5261f0[_0x00ab('0x46')]=[{'all':!![]}];}_0x5261f0=_[_0x00ab('0x3f')]({},_0x5261f0,_0x26ba81[_0x00ab('0x40')]);return db[_0x00ab('0x2a')][_0x00ab('0x47')](_0x5261f0)[_0x00ab('0x21')](handleEntityNotFound(_0x214d26,null))[_0x00ab('0x21')](respondWithResult(_0x214d26,null))['catch'](handleError(_0x214d26,null));};exports[_0x00ab('0x48')]=function(_0x405e71,_0x2dffe3){return db[_0x00ab('0x2a')]['create'](_0x405e71[_0x00ab('0x49')],{})[_0x00ab('0x21')](function(_0x324b1a){var _0x2bd042=_0x405e71[_0x00ab('0x4a')]['get']({'plain':!![]});if(!_0x2bd042)throw new Error(_0x00ab('0x4b'));if(_0x2bd042[_0x00ab('0x4c')]===_0x00ab('0x4a')){var _0x2c03b9=_0x324b1a[_0x00ab('0x4d')]({'plain':!![]});var _0x3b6485=_0x00ab('0x23');return db['UserProfileSection'][_0x00ab('0x47')]({'where':{'name':_0x3b6485,'userProfileId':_0x2bd042[_0x00ab('0x4e')]},'raw':!![]})[_0x00ab('0x21')](function(_0x2cb9e2){if(_0x2cb9e2&&_0x2cb9e2['autoAssociation']===0x0){return db[_0x00ab('0x24')]['create']({'name':_0x2c03b9[_0x00ab('0x26')],'resourceId':_0x2c03b9['id'],'type':_0x2cb9e2[_0x00ab('0x26')],'sectionId':_0x2cb9e2['id']},{})[_0x00ab('0x21')](function(){return _0x324b1a;});}else{return _0x324b1a;}})[_0x00ab('0x43')](function(_0x11f9b5){logger['error'](_0x00ab('0x4f'),_0x11f9b5);throw _0x11f9b5;});}return _0x324b1a;})['then'](respondWithResult(_0x2dffe3,0xc9))[_0x00ab('0x43')](handleError(_0x2dffe3,null));};exports['update']=function(_0x4f0098,_0x6e13dd){if(_0x4f0098['body']['id']){delete _0x4f0098[_0x00ab('0x49')]['id'];}return db['UserMailInteraction'][_0x00ab('0x47')]({'where':{'id':_0x4f0098['params']['id']}})['then'](handleEntityNotFound(_0x6e13dd,null))[_0x00ab('0x21')](saveUpdates(_0x4f0098[_0x00ab('0x49')],null))[_0x00ab('0x21')](respondWithResult(_0x6e13dd,null))[_0x00ab('0x43')](handleError(_0x6e13dd,null));};exports[_0x00ab('0x22')]=function(_0x33d046,_0x29a029){return db[_0x00ab('0x2a')][_0x00ab('0x47')]({'where':{'id':_0x33d046[_0x00ab('0x45')]['id']}})[_0x00ab('0x21')](handleEntityNotFound(_0x29a029,null))[_0x00ab('0x21')](removeEntity(_0x29a029,null))[_0x00ab('0x43')](handleError(_0x29a029,null));}; \ No newline at end of file +var _0x3d52=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserMailInteractions','UserProfileResource','error','name','send','map','UserMailInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','type','merge','options','includeAll','include','rows','catch','show','params','length','create','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x3811e6,_0x332420){var _0x31c379=function(_0x48e625){while(--_0x48e625){_0x3811e6['push'](_0x3811e6['shift']());}};_0x31c379(++_0x332420);}(_0x3d52,0x8e));var _0x23d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d52[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x23d5('0x0'));var rimraf=require(_0x23d5('0x1'));var zipdir=require(_0x23d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23d5('0x3'));var moment=require('moment');var BPromise=require(_0x23d5('0x4'));var Mustache=require(_0x23d5('0x5'));var util=require(_0x23d5('0x6'));var path=require(_0x23d5('0x7'));var sox=require(_0x23d5('0x8'));var csv=require('to-csv');var ejs=require(_0x23d5('0x9'));var fs=require('fs');var _=require(_0x23d5('0xa'));var squel=require(_0x23d5('0xb'));var crypto=require(_0x23d5('0xc'));var jsforce=require(_0x23d5('0xd'));var deskjs=require(_0x23d5('0xe'));var toCsv=require(_0x23d5('0xf'));var querystring=require(_0x23d5('0x10'));var Papa=require(_0x23d5('0x11'));var Redis=require(_0x23d5('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x23d5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x23d5('0x14'))(_0x23d5('0x15'));var utils=require(_0x23d5('0x16'));var config=require(_0x23d5('0x17'));var licenseUtil=require(_0x23d5('0x18'));var db=require(_0x23d5('0x19'))['db'];function respondWithStatusCode(_0x39b77b,_0x1bce38){_0x1bce38=_0x1bce38||0xcc;return function(_0x23a446){if(_0x23a446){return _0x39b77b[_0x23d5('0x1a')](_0x1bce38);}return _0x39b77b[_0x23d5('0x1b')](_0x1bce38)[_0x23d5('0x1c')]();};}function respondWithResult(_0x32ce49,_0x5f37cd){_0x5f37cd=_0x5f37cd||0xc8;return function(_0x52a132){if(_0x52a132){return _0x32ce49[_0x23d5('0x1b')](_0x5f37cd)['json'](_0x52a132);}};}function respondWithFilteredResult(_0x11d291,_0x44a114){return function(_0x120246){if(_0x120246){var _0x45bee7=_0x120246[_0x23d5('0x1d')],_0x10db6e=_0x44a114['offset'],_0x1b8e0c=_0x44a114[_0x23d5('0x1e')]+_0x44a114[_0x23d5('0x1f')],_0x36d86e;if(_0x1b8e0c>=_0x45bee7){_0x1b8e0c=_0x45bee7;_0x36d86e=0xc8;}else{_0x36d86e=0xce;}_0x11d291[_0x23d5('0x1b')](_0x36d86e);return _0x11d291[_0x23d5('0x20')](_0x23d5('0x21'),_0x10db6e+'-'+_0x1b8e0c+'/'+_0x45bee7)['json'](_0x120246);}return null;};}function patchUpdates(_0x2d1a4b){return function(_0xbf6c31){try{jsonpatch[_0x23d5('0x22')](_0xbf6c31,_0x2d1a4b,!![]);}catch(_0x37e431){return BPromise[_0x23d5('0x23')](_0x37e431);}return _0xbf6c31[_0x23d5('0x24')]();};}function saveUpdates(_0x17fa70,_0x4dc562){return function(_0x12d584){if(_0x12d584){return _0x12d584[_0x23d5('0x25')](_0x17fa70)[_0x23d5('0x26')](function(_0x1fb7ab){return _0x1fb7ab;});}return null;};}function removeEntity(_0x15c14f,_0x50c372){return function(_0x407962){if(_0x407962){return _0x407962[_0x23d5('0x27')]()[_0x23d5('0x26')](function(){var _0x1bd1a0=_0x407962[_0x23d5('0x28')]({'plain':!![]});var _0x277163=_0x23d5('0x29');return db[_0x23d5('0x2a')][_0x23d5('0x27')]({'where':{'type':_0x277163,'resourceId':_0x1bd1a0['id']}})[_0x23d5('0x26')](function(){return _0x407962;});})['then'](function(){_0x15c14f[_0x23d5('0x1b')](0xcc)[_0x23d5('0x1c')]();});}};}function handleEntityNotFound(_0xc805fc,_0x23ca42){return function(_0xc89d91){if(!_0xc89d91){_0xc805fc[_0x23d5('0x1a')](0x194);}return _0xc89d91;};}function handleError(_0x1c9696,_0x584101){_0x584101=_0x584101||0x1f4;return function(_0x5ac98f){logger[_0x23d5('0x2b')](_0x5ac98f['stack']);if(_0x5ac98f[_0x23d5('0x2c')]){delete _0x5ac98f[_0x23d5('0x2c')];}_0x1c9696[_0x23d5('0x1b')](_0x584101)[_0x23d5('0x2d')](_0x5ac98f);};}exports['index']=function(_0x3b8d0d,_0x73c81e){var _0x335664={},_0x24a1f8={},_0x3ecc39={'count':0x0,'rows':[]};var _0x43c29c=_[_0x23d5('0x2e')](db[_0x23d5('0x2f')][_0x23d5('0x30')],function(_0xb69c61){return{'name':_0xb69c61[_0x23d5('0x31')],'type':_0xb69c61['type']['key']};});_0x24a1f8[_0x23d5('0x32')]=_[_0x23d5('0x2e')](_0x43c29c,_0x23d5('0x2c'));_0x24a1f8[_0x23d5('0x33')]=_[_0x23d5('0x34')](_0x3b8d0d[_0x23d5('0x33')]);_0x24a1f8[_0x23d5('0x35')]=_[_0x23d5('0x36')](_0x24a1f8[_0x23d5('0x32')],_0x24a1f8[_0x23d5('0x33')]);_0x335664['attributes']=_[_0x23d5('0x36')](_0x24a1f8[_0x23d5('0x32')],qs[_0x23d5('0x37')](_0x3b8d0d[_0x23d5('0x33')][_0x23d5('0x37')]));_0x335664['attributes']=_0x335664[_0x23d5('0x38')]['length']?_0x335664['attributes']:_0x24a1f8[_0x23d5('0x32')];if(!_0x3b8d0d['query']['hasOwnProperty'](_0x23d5('0x39'))){_0x335664[_0x23d5('0x1f')]=qs[_0x23d5('0x1f')](_0x3b8d0d['query']['limit']);_0x335664[_0x23d5('0x1e')]=qs[_0x23d5('0x1e')](_0x3b8d0d[_0x23d5('0x33')]['offset']);}_0x335664[_0x23d5('0x3a')]=qs[_0x23d5('0x3b')](_0x3b8d0d[_0x23d5('0x33')][_0x23d5('0x3b')]);_0x335664['where']=qs[_0x23d5('0x35')](_[_0x23d5('0x3c')](_0x3b8d0d[_0x23d5('0x33')],_0x24a1f8[_0x23d5('0x35')]),_0x43c29c);if(_0x3b8d0d[_0x23d5('0x33')][_0x23d5('0x3d')]){_0x335664['where']=_['merge'](_0x335664[_0x23d5('0x3e')],{'$or':_[_0x23d5('0x2e')](_0x43c29c,function(_0x57edf7){if(_0x57edf7[_0x23d5('0x3f')]!=='VIRTUAL'){var _0x36b7b7={};_0x36b7b7[_0x57edf7[_0x23d5('0x2c')]]={'$like':'%'+_0x3b8d0d[_0x23d5('0x33')][_0x23d5('0x3d')]+'%'};return _0x36b7b7;}})});}_0x335664=_[_0x23d5('0x40')]({},_0x335664,_0x3b8d0d[_0x23d5('0x41')]);var _0x247f6f={'where':_0x335664[_0x23d5('0x3e')]};return db['UserMailInteraction']['count'](_0x247f6f)[_0x23d5('0x26')](function(_0x105209){_0x3ecc39[_0x23d5('0x1d')]=_0x105209;if(_0x3b8d0d[_0x23d5('0x33')][_0x23d5('0x42')]){_0x335664[_0x23d5('0x43')]=[{'all':!![]}];}return db[_0x23d5('0x2f')]['findAll'](_0x335664);})[_0x23d5('0x26')](function(_0x280894){_0x3ecc39[_0x23d5('0x44')]=_0x280894;return _0x3ecc39;})[_0x23d5('0x26')](respondWithFilteredResult(_0x73c81e,_0x335664))[_0x23d5('0x45')](handleError(_0x73c81e,null));};exports[_0x23d5('0x46')]=function(_0x41113d,_0xbf8c91){var _0x53ccc4={'raw':!![],'where':{'id':_0x41113d[_0x23d5('0x47')]['id']}},_0x2920a6={};_0x2920a6['model']=_[_0x23d5('0x34')](db['UserMailInteraction'][_0x23d5('0x30')]);_0x2920a6[_0x23d5('0x33')]=_['keys'](_0x41113d['query']);_0x2920a6[_0x23d5('0x35')]=_[_0x23d5('0x36')](_0x2920a6['model'],_0x2920a6['query']);_0x53ccc4[_0x23d5('0x38')]=_['intersection'](_0x2920a6[_0x23d5('0x32')],qs['fields'](_0x41113d[_0x23d5('0x33')][_0x23d5('0x37')]));_0x53ccc4[_0x23d5('0x38')]=_0x53ccc4[_0x23d5('0x38')][_0x23d5('0x48')]?_0x53ccc4['attributes']:_0x2920a6[_0x23d5('0x32')];if(_0x41113d[_0x23d5('0x33')][_0x23d5('0x42')]){_0x53ccc4[_0x23d5('0x43')]=[{'all':!![]}];}_0x53ccc4=_[_0x23d5('0x40')]({},_0x53ccc4,_0x41113d['options']);return db['UserMailInteraction']['find'](_0x53ccc4)[_0x23d5('0x26')](handleEntityNotFound(_0xbf8c91,null))[_0x23d5('0x26')](respondWithResult(_0xbf8c91,null))[_0x23d5('0x45')](handleError(_0xbf8c91,null));};exports[_0x23d5('0x49')]=function(_0x39f747,_0x2b99de){return db[_0x23d5('0x2f')]['create'](_0x39f747['body'],{})[_0x23d5('0x26')](function(_0x504557){var _0x5600c8=_0x39f747[_0x23d5('0x4a')][_0x23d5('0x28')]({'plain':!![]});if(!_0x5600c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5600c8[_0x23d5('0x4b')]===_0x23d5('0x4a')){var _0x2717e8=_0x504557[_0x23d5('0x28')]({'plain':!![]});var _0x38afa8='UserMailInteractions';return db[_0x23d5('0x4c')][_0x23d5('0x4d')]({'where':{'name':_0x38afa8,'userProfileId':_0x5600c8['userProfileId']},'raw':!![]})[_0x23d5('0x26')](function(_0x4dafff){if(_0x4dafff&&_0x4dafff[_0x23d5('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x2717e8['name'],'resourceId':_0x2717e8['id'],'type':_0x4dafff[_0x23d5('0x2c')],'sectionId':_0x4dafff['id']},{})[_0x23d5('0x26')](function(){return _0x504557;});}else{return _0x504557;}})[_0x23d5('0x45')](function(_0x36c387){logger['error'](_0x23d5('0x4f'),_0x36c387);throw _0x36c387;});}return _0x504557;})[_0x23d5('0x26')](respondWithResult(_0x2b99de,0xc9))[_0x23d5('0x45')](handleError(_0x2b99de,null));};exports[_0x23d5('0x25')]=function(_0x26686e,_0x248a15){if(_0x26686e['body']['id']){delete _0x26686e[_0x23d5('0x50')]['id'];}return db[_0x23d5('0x2f')][_0x23d5('0x4d')]({'where':{'id':_0x26686e[_0x23d5('0x47')]['id']}})[_0x23d5('0x26')](handleEntityNotFound(_0x248a15,null))[_0x23d5('0x26')](saveUpdates(_0x26686e[_0x23d5('0x50')],null))[_0x23d5('0x26')](respondWithResult(_0x248a15,null))[_0x23d5('0x45')](handleError(_0x248a15,null));};exports[_0x23d5('0x27')]=function(_0x509687,_0x29cbc1){return db['UserMailInteraction'][_0x23d5('0x4d')]({'where':{'id':_0x509687[_0x23d5('0x47')]['id']}})['then'](handleEntityNotFound(_0x29cbc1,null))['then'](removeEntity(_0x29cbc1,null))['catch'](handleError(_0x29cbc1,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index ed7ced4..220a393 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 _0x2cbd=['rimraf','exports','define','user_has_mail_interactions','lodash','util','api','moment','bluebird','path'];(function(_0x35e3ec,_0x41a89a){var _0x420cba=function(_0x2a9e98){while(--_0x2a9e98){_0x35e3ec['push'](_0x35e3ec['shift']());}};_0x420cba(++_0x41a89a);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0x2cbd[_0x2f227c];return _0x5032bc;};'use strict';var _=require(_0xd2cb('0x0'));var util=require(_0xd2cb('0x1'));var logger=require('../../config/logger')(_0xd2cb('0x2'));var moment=require(_0xd2cb('0x3'));var BPromise=require(_0xd2cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2cb('0x5'));var rimraf=require(_0xd2cb('0x6'));var config=require('../../config/environment');var attributes=require('./UserMailInteraction.attributes');module[_0xd2cb('0x7')]=function(_0x20ff39,_0x3894f9){return _0x20ff39[_0xd2cb('0x8')]('UserMailInteraction',attributes,{'tableName':_0xd2cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7072=['exports','define','UserMailInteraction','user_has_mail_interactions','util','../../config/logger','api','moment','bluebird','rimraf','./UserMailInteraction.attributes'];(function(_0x356a21,_0x13419f){var _0x5a110d=function(_0x311ec2){while(--_0x311ec2){_0x356a21['push'](_0x356a21['shift']());}};_0x5a110d(++_0x13419f);}(_0x7072,0x138));var _0x2707=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7072[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var logger=require(_0x2707('0x1'))(_0x2707('0x2'));var moment=require(_0x2707('0x3'));var BPromise=require(_0x2707('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2707('0x5'));var config=require('../../config/environment');var attributes=require(_0x2707('0x6'));module[_0x2707('0x7')]=function(_0x1e86f2,_0x194132){return _0x1e86f2[_0x2707('0x8')](_0x2707('0x9'),attributes,{'tableName':_0x2707('0xa'),'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 8418d31..3964fbf 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 _0x204e=['info','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserMailInteraction,\x20%s,\x20%s','message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x17bdad,_0x19221c){var _0xdaf7c3=function(_0x36389e){while(--_0x36389e){_0x17bdad['push'](_0x17bdad['shift']());}};_0xdaf7c3(++_0x19221c);}(_0x204e,0xd0));var _0xe204=function(_0xaa325c,_0x487521){_0xaa325c=_0xaa325c-0x0;var _0x11c719=_0x204e[_0xaa325c];return _0x11c719;};'use strict';var _=require('lodash');var util=require(_0xe204('0x0'));var moment=require(_0xe204('0x1'));var BPromise=require(_0xe204('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe204('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe204('0x4'));var logger=require(_0xe204('0x5'))(_0xe204('0x6'));var config=require(_0xe204('0x7'));var jayson=require(_0xe204('0x8'));var client=jayson[_0xe204('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43f546,_0x33687c,_0xe45a9e){return new BPromise(function(_0x3b222d,_0x11f0ee){return client[_0xe204('0xa')](_0x43f546,_0xe45a9e)[_0xe204('0xb')](function(_0xdb6081){logger[_0xe204('0xc')]('UserMailInteraction,\x20%s,\x20%s',_0x33687c,'request\x20sent');logger[_0xe204('0xd')](_0xe204('0xe'),_0x33687c,_0xe204('0xf'),JSON[_0xe204('0x10')](_0xdb6081));if(_0xdb6081[_0xe204('0x11')]){if(_0xdb6081['error'][_0xe204('0x12')]===0x1f4){logger[_0xe204('0x11')](_0xe204('0x13'),_0x33687c,_0xdb6081[_0xe204('0x11')][_0xe204('0x14')]);return _0x11f0ee(_0xdb6081[_0xe204('0x11')][_0xe204('0x14')]);}logger[_0xe204('0x11')](_0xe204('0x13'),_0x33687c,_0xdb6081[_0xe204('0x11')][_0xe204('0x14')]);return _0x3b222d(_0xdb6081['error'][_0xe204('0x14')]);}else{logger['info'](_0xe204('0x13'),_0x33687c,_0xe204('0xf'));_0x3b222d(_0xdb6081[_0xe204('0x15')][_0xe204('0x14')]);}})['catch'](function(_0x6565b1){logger[_0xe204('0x11')](_0xe204('0x13'),_0x33687c,_0x6565b1);_0x11f0ee(_0x6565b1);});});} \ No newline at end of file +var _0xc43d=['UserMailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0xc43d,0xb2));var _0xdc43=function(_0x233dc0,_0x2866ad){_0x233dc0=_0x233dc0-0x0;var _0x1fc160=_0xc43d[_0x233dc0];return _0x1fc160;};'use strict';var _=require(_0xdc43('0x0'));var util=require(_0xdc43('0x1'));var moment=require(_0xdc43('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc43('0x3'));var fs=require('fs');var Redis=require(_0xdc43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc43('0x5'));var logger=require(_0xdc43('0x6'))(_0xdc43('0x7'));var config=require(_0xdc43('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdc43('0x9')][_0xdc43('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f82a2,_0x33aae1,_0x4e48d1){return new BPromise(function(_0xd17205,_0x436b5a){return client['request'](_0x3f82a2,_0x4e48d1)['then'](function(_0x1620a6){logger[_0xdc43('0xb')](_0xdc43('0xc'),_0x33aae1,_0xdc43('0xd'));logger[_0xdc43('0xe')]('UserMailInteraction,\x20%s,\x20%s,\x20%s',_0x33aae1,'request\x20sent',JSON[_0xdc43('0xf')](_0x1620a6));if(_0x1620a6[_0xdc43('0x10')]){if(_0x1620a6[_0xdc43('0x10')]['code']===0x1f4){logger[_0xdc43('0x10')](_0xdc43('0xc'),_0x33aae1,_0x1620a6['error'][_0xdc43('0x11')]);return _0x436b5a(_0x1620a6[_0xdc43('0x10')][_0xdc43('0x11')]);}logger[_0xdc43('0x10')](_0xdc43('0xc'),_0x33aae1,_0x1620a6[_0xdc43('0x10')][_0xdc43('0x11')]);return _0xd17205(_0x1620a6['error']['message']);}else{logger[_0xdc43('0xb')]('UserMailInteraction,\x20%s,\x20%s',_0x33aae1,_0xdc43('0xd'));_0xd17205(_0x1620a6['result'][_0xdc43('0x11')]);}})[_0xdc43('0x12')](function(_0x540395){logger[_0xdc43('0x10')](_0xdc43('0xc'),_0x33aae1,_0x540395);_0x436b5a(_0x540395);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index e8dbc95..0f3f51f 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 _0x7c09=['update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','/:id','isAuthenticated','show','post','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c09,0x102));var _0x97c0=function(_0x4e2887,_0x34eefd){_0x4e2887=_0x4e2887-0x0;var _0x3e0a06=_0x7c09[_0x4e2887];return _0x3e0a06;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var auth=require(_0x97c0('0x4'));var interaction=require(_0x97c0('0x5'));var config=require(_0x97c0('0x6'));var controller=require(_0x97c0('0x7'));router[_0x97c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x97c0('0x9'),auth[_0x97c0('0xa')](),controller[_0x97c0('0xb')]);router[_0x97c0('0xc')]('/',auth[_0x97c0('0xa')](),controller['create']);router[_0x97c0('0xd')]('/:id',auth[_0x97c0('0xa')](),controller[_0x97c0('0xe')]);router['delete']('/:id',auth[_0x97c0('0xa')](),controller[_0x97c0('0xf')]);module[_0x97c0('0x10')]=router; \ No newline at end of file +var _0x1261=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x1261,0x144));var _0x1126=function(_0x44c325,_0x19c625){_0x44c325=_0x44c325-0x0;var _0x55f09e=_0x1261[_0x44c325];return _0x55f09e;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0xc')]('/',auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router[_0x1126('0xf')]('/:id',auth[_0x1126('0xd')](),controller[_0x1126('0x10')]);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xd')](),controller['destroy']);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 0e8321b..511ce83 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 _0x1069=['exports','INTEGER'];(function(_0x3715df,_0x578cb0){var _0xdf69b=function(_0x57f107){while(--_0x57f107){_0x3715df['push'](_0x3715df['shift']());}};_0xdf69b(++_0x578cb0);}(_0x1069,0x1ea));var _0x9106=function(_0x529e42,_0x602dc0){_0x529e42=_0x529e42-0x0;var _0x50f702=_0x1069[_0x529e42];return _0x50f702;};'use strict';var Sequelize=require('sequelize');module[_0x9106('0x0')]={'OpenchannelInteractionId':{'type':Sequelize[_0x9106('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x9106('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0x9ec6=['exports'];(function(_0xa9430,_0x14f536){var _0x220b68=function(_0x591147){while(--_0x591147){_0xa9430['push'](_0xa9430['shift']());}};_0x220b68(++_0x14f536);}(_0x9ec6,0x136));var _0x69ec=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x9ec6[_0x4f2c3a];return _0x17d91c;};'use strict';var Sequelize=require('sequelize');module[_0x69ec('0x0')]={'OpenchannelInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js index 1eb9dea..ec2a744 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 _0x070c=['to-csv','ejs','lodash','squel','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','end','status','json','offset','set','Content-Range','apply','reject','save','then','get','UserOpenchannelInteraction','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox'];(function(_0x58c0ee,_0x4c96aa){var _0x575521=function(_0x56ae1d){while(--_0x56ae1d){_0x58c0ee['push'](_0x58c0ee['shift']());}};_0x575521(++_0x4c96aa);}(_0x070c,0xfb));var _0xc070=function(_0x28a54b,_0x27345c){_0x28a54b=_0x28a54b-0x0;var _0x458ed8=_0x070c[_0x28a54b];return _0x458ed8;};'use strict';var pdf=require(_0xc070('0x0'));var emlformat=require(_0xc070('0x1'));var rimraf=require(_0xc070('0x2'));var zipdir=require(_0xc070('0x3'));var jsonpatch=require(_0xc070('0x4'));var rp=require(_0xc070('0x5'));var moment=require('moment');var BPromise=require(_0xc070('0x6'));var Mustache=require('mustache');var util=require(_0xc070('0x7'));var path=require(_0xc070('0x8'));var sox=require(_0xc070('0x9'));var csv=require(_0xc070('0xa'));var ejs=require(_0xc070('0xb'));var fs=require('fs');var _=require(_0xc070('0xc'));var squel=require(_0xc070('0xd'));var crypto=require(_0xc070('0xe'));var jsforce=require(_0xc070('0xf'));var deskjs=require(_0xc070('0x10'));var toCsv=require(_0xc070('0xa'));var querystring=require(_0xc070('0x11'));var Papa=require(_0xc070('0x12'));var Redis=require(_0xc070('0x13'));var authService=require(_0xc070('0x14'));var qs=require(_0xc070('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc070('0x16'))(_0xc070('0x17'));var utils=require(_0xc070('0x18'));var config=require(_0xc070('0x19'));var licenseUtil=require(_0xc070('0x1a'));var db=require(_0xc070('0x1b'))['db'];function respondWithStatusCode(_0x2574fd,_0x18afc9){_0x18afc9=_0x18afc9||0xcc;return function(_0x2c277b){if(_0x2c277b){return _0x2574fd[_0xc070('0x1c')](_0x18afc9);}return _0x2574fd['status'](_0x18afc9)[_0xc070('0x1d')]();};}function respondWithResult(_0x2ec485,_0x345c28){_0x345c28=_0x345c28||0xc8;return function(_0x2256bd){if(_0x2256bd){return _0x2ec485[_0xc070('0x1e')](_0x345c28)[_0xc070('0x1f')](_0x2256bd);}};}function respondWithFilteredResult(_0x5856ab,_0x3cc199){return function(_0x12b5bb){if(_0x12b5bb){var _0x2cc4bf=_0x12b5bb['count'],_0x4b7596=_0x3cc199[_0xc070('0x20')],_0x41354f=_0x3cc199['offset']+_0x3cc199['limit'],_0x5bf030;if(_0x41354f>=_0x2cc4bf){_0x41354f=_0x2cc4bf;_0x5bf030=0xc8;}else{_0x5bf030=0xce;}_0x5856ab[_0xc070('0x1e')](_0x5bf030);return _0x5856ab[_0xc070('0x21')](_0xc070('0x22'),_0x4b7596+'-'+_0x41354f+'/'+_0x2cc4bf)[_0xc070('0x1f')](_0x12b5bb);}return null;};}function patchUpdates(_0x3c7c74){return function(_0x2563f1){try{jsonpatch[_0xc070('0x23')](_0x2563f1,_0x3c7c74,!![]);}catch(_0x8e9094){return BPromise[_0xc070('0x24')](_0x8e9094);}return _0x2563f1[_0xc070('0x25')]();};}function saveUpdates(_0x5dfb33,_0x5d858d){return function(_0x26801f){if(_0x26801f){return _0x26801f['update'](_0x5dfb33)[_0xc070('0x26')](function(_0x472dd7){return _0x472dd7;});}return null;};}function removeEntity(_0x36a431,_0x5f4408){return function(_0xab7654){if(_0xab7654){return _0xab7654['destroy']()[_0xc070('0x26')](function(){var _0x36a6cf=_0xab7654[_0xc070('0x27')]({'plain':!![]});var _0x573c1c=_0xc070('0x28');return db[_0xc070('0x29')][_0xc070('0x2a')]({'where':{'type':_0x573c1c,'resourceId':_0x36a6cf['id']}})[_0xc070('0x26')](function(){return _0xab7654;});})[_0xc070('0x26')](function(){_0x36a431[_0xc070('0x1e')](0xcc)[_0xc070('0x1d')]();});}};}function handleEntityNotFound(_0x5386c9,_0x54a678){return function(_0x5fd8c){if(!_0x5fd8c){_0x5386c9[_0xc070('0x1c')](0x194);}return _0x5fd8c;};}function handleError(_0x3c6ca7,_0x201a49){_0x201a49=_0x201a49||0x1f4;return function(_0x555154){logger['error'](_0x555154[_0xc070('0x2b')]);if(_0x555154[_0xc070('0x2c')]){delete _0x555154[_0xc070('0x2c')];}_0x3c6ca7[_0xc070('0x1e')](_0x201a49)[_0xc070('0x2d')](_0x555154);};}exports[_0xc070('0x2e')]=function(_0x183aeb,_0x4ad3cb){var _0x55cc19={},_0x1bc4b4={},_0x33d333={'count':0x0,'rows':[]};var _0x8019e9=_[_0xc070('0x2f')](db[_0xc070('0x28')][_0xc070('0x30')],function(_0x4dbce3){return{'name':_0x4dbce3['fieldName'],'type':_0x4dbce3[_0xc070('0x31')][_0xc070('0x32')]};});_0x1bc4b4[_0xc070('0x33')]=_[_0xc070('0x2f')](_0x8019e9,'name');_0x1bc4b4[_0xc070('0x34')]=_[_0xc070('0x35')](_0x183aeb[_0xc070('0x34')]);_0x1bc4b4[_0xc070('0x36')]=_[_0xc070('0x37')](_0x1bc4b4[_0xc070('0x33')],_0x1bc4b4[_0xc070('0x34')]);_0x55cc19[_0xc070('0x38')]=_['intersection'](_0x1bc4b4[_0xc070('0x33')],qs[_0xc070('0x39')](_0x183aeb['query']['fields']));_0x55cc19['attributes']=_0x55cc19[_0xc070('0x38')]['length']?_0x55cc19[_0xc070('0x38')]:_0x1bc4b4['model'];if(!_0x183aeb[_0xc070('0x34')][_0xc070('0x3a')](_0xc070('0x3b'))){_0x55cc19['limit']=qs['limit'](_0x183aeb['query'][_0xc070('0x3c')]);_0x55cc19[_0xc070('0x20')]=qs[_0xc070('0x20')](_0x183aeb[_0xc070('0x34')][_0xc070('0x20')]);}_0x55cc19[_0xc070('0x3d')]=qs[_0xc070('0x3e')](_0x183aeb[_0xc070('0x34')]['sort']);_0x55cc19[_0xc070('0x3f')]=qs[_0xc070('0x36')](_['pick'](_0x183aeb[_0xc070('0x34')],_0x1bc4b4[_0xc070('0x36')]),_0x8019e9);if(_0x183aeb[_0xc070('0x34')][_0xc070('0x40')]){_0x55cc19[_0xc070('0x3f')]=_[_0xc070('0x41')](_0x55cc19[_0xc070('0x3f')],{'$or':_['map'](_0x8019e9,function(_0xf0c51c){if(_0xf0c51c[_0xc070('0x31')]!==_0xc070('0x42')){var _0x104496={};_0x104496[_0xf0c51c[_0xc070('0x2c')]]={'$like':'%'+_0x183aeb['query']['filter']+'%'};return _0x104496;}})});}_0x55cc19=_['merge']({},_0x55cc19,_0x183aeb[_0xc070('0x43')]);var _0x436987={'where':_0x55cc19[_0xc070('0x3f')]};return db[_0xc070('0x28')]['count'](_0x436987)[_0xc070('0x26')](function(_0x30f02a){_0x33d333['count']=_0x30f02a;if(_0x183aeb[_0xc070('0x34')][_0xc070('0x44')]){_0x55cc19[_0xc070('0x45')]=[{'all':!![]}];}return db[_0xc070('0x28')][_0xc070('0x46')](_0x55cc19);})[_0xc070('0x26')](function(_0x2127fe){_0x33d333[_0xc070('0x47')]=_0x2127fe;return _0x33d333;})[_0xc070('0x26')](respondWithFilteredResult(_0x4ad3cb,_0x55cc19))[_0xc070('0x48')](handleError(_0x4ad3cb,null));};exports[_0xc070('0x49')]=function(_0x257627,_0x34cb01){var _0x3664b4={'raw':!![],'where':{'id':_0x257627[_0xc070('0x4a')]['id']}},_0xf8938e={};_0xf8938e[_0xc070('0x33')]=_[_0xc070('0x35')](db[_0xc070('0x28')]['rawAttributes']);_0xf8938e[_0xc070('0x34')]=_[_0xc070('0x35')](_0x257627[_0xc070('0x34')]);_0xf8938e[_0xc070('0x36')]=_['intersection'](_0xf8938e[_0xc070('0x33')],_0xf8938e['query']);_0x3664b4['attributes']=_[_0xc070('0x37')](_0xf8938e[_0xc070('0x33')],qs['fields'](_0x257627[_0xc070('0x34')][_0xc070('0x39')]));_0x3664b4['attributes']=_0x3664b4['attributes'][_0xc070('0x4b')]?_0x3664b4[_0xc070('0x38')]:_0xf8938e[_0xc070('0x33')];if(_0x257627['query'][_0xc070('0x44')]){_0x3664b4[_0xc070('0x45')]=[{'all':!![]}];}_0x3664b4=_[_0xc070('0x41')]({},_0x3664b4,_0x257627[_0xc070('0x43')]);return db['UserOpenchannelInteraction'][_0xc070('0x4c')](_0x3664b4)[_0xc070('0x26')](handleEntityNotFound(_0x34cb01,null))['then'](respondWithResult(_0x34cb01,null))['catch'](handleError(_0x34cb01,null));};exports[_0xc070('0x4d')]=function(_0x556732,_0xc0c528){return db[_0xc070('0x28')][_0xc070('0x4d')](_0x556732['body'],{})[_0xc070('0x26')](function(_0x3394ed){var _0x51376d=_0x556732[_0xc070('0x4e')]['get']({'plain':!![]});if(!_0x51376d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51376d[_0xc070('0x4f')]===_0xc070('0x4e')){var _0x2b1dc2=_0x3394ed[_0xc070('0x27')]({'plain':!![]});var _0x57d4e7=_0xc070('0x28');return db[_0xc070('0x50')][_0xc070('0x4c')]({'where':{'name':_0x57d4e7,'userProfileId':_0x51376d[_0xc070('0x51')]},'raw':!![]})[_0xc070('0x26')](function(_0x5bfa7c){if(_0x5bfa7c&&_0x5bfa7c[_0xc070('0x52')]===0x0){return db[_0xc070('0x29')][_0xc070('0x4d')]({'name':_0x2b1dc2[_0xc070('0x2c')],'resourceId':_0x2b1dc2['id'],'type':_0x5bfa7c[_0xc070('0x2c')],'sectionId':_0x5bfa7c['id']},{})[_0xc070('0x26')](function(){return _0x3394ed;});}else{return _0x3394ed;}})[_0xc070('0x48')](function(_0x21d986){logger[_0xc070('0x53')](_0xc070('0x54'),_0x21d986);throw _0x21d986;});}return _0x3394ed;})['then'](respondWithResult(_0xc0c528,0xc9))[_0xc070('0x48')](handleError(_0xc0c528,null));};exports[_0xc070('0x55')]=function(_0x47249f,_0x462298){if(_0x47249f['body']['id']){delete _0x47249f[_0xc070('0x56')]['id'];}return db[_0xc070('0x28')][_0xc070('0x4c')]({'where':{'id':_0x47249f[_0xc070('0x4a')]['id']}})['then'](handleEntityNotFound(_0x462298,null))[_0xc070('0x26')](saveUpdates(_0x47249f['body'],null))['then'](respondWithResult(_0x462298,null))[_0xc070('0x48')](handleError(_0x462298,null));};exports[_0xc070('0x2a')]=function(_0x59f81b,_0x426de6){return db[_0xc070('0x28')][_0xc070('0x4c')]({'where':{'id':_0x59f81b[_0xc070('0x4a')]['id']}})[_0xc070('0x26')](handleEntityNotFound(_0x426de6,null))[_0xc070('0x26')](removeEntity(_0x426de6,null))[_0xc070('0x48')](handleError(_0x426de6,null));}; \ No newline at end of file +var _0xe4ef=['mustache','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','apply','save','update','then','get','UserOpenchannelInteraction','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','count','include','rows','catch','params','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x23520a,_0x4aa7a){var _0x239e43=function(_0x3d7ee8){while(--_0x3d7ee8){_0x23520a['push'](_0x23520a['shift']());}};_0x239e43(++_0x4aa7a);}(_0xe4ef,0x17b));var _0xfe4e=function(_0xc2454b,_0x377b47){_0xc2454b=_0xc2454b-0x0;var _0x493b97=_0xe4ef[_0xc2454b];return _0x493b97;};'use strict';var pdf=require(_0xfe4e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfe4e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe4e('0x2'));var rp=require(_0xfe4e('0x3'));var moment=require(_0xfe4e('0x4'));var BPromise=require(_0xfe4e('0x5'));var Mustache=require(_0xfe4e('0x6'));var util=require(_0xfe4e('0x7'));var path=require(_0xfe4e('0x8'));var sox=require(_0xfe4e('0x9'));var csv=require(_0xfe4e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfe4e('0xb'));var squel=require('squel');var crypto=require(_0xfe4e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfe4e('0xd'));var toCsv=require(_0xfe4e('0xa'));var querystring=require('querystring');var Papa=require(_0xfe4e('0xe'));var Redis=require(_0xfe4e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfe4e('0x10'));var as=require(_0xfe4e('0x11'));var hardwareService=require(_0xfe4e('0x12'));var logger=require(_0xfe4e('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfe4e('0x14'));var db=require(_0xfe4e('0x15'))['db'];function respondWithStatusCode(_0x5cb3d8,_0x2e5d61){_0x2e5d61=_0x2e5d61||0xcc;return function(_0x31d9d6){if(_0x31d9d6){return _0x5cb3d8[_0xfe4e('0x16')](_0x2e5d61);}return _0x5cb3d8[_0xfe4e('0x17')](_0x2e5d61)[_0xfe4e('0x18')]();};}function respondWithResult(_0x50b19d,_0x86c1b6){_0x86c1b6=_0x86c1b6||0xc8;return function(_0x107dbc){if(_0x107dbc){return _0x50b19d[_0xfe4e('0x17')](_0x86c1b6)[_0xfe4e('0x19')](_0x107dbc);}};}function respondWithFilteredResult(_0x5308c5,_0x422c88){return function(_0x3c1cad){if(_0x3c1cad){var _0x378d5e=_0x3c1cad['count'],_0x129772=_0x422c88['offset'],_0x242c09=_0x422c88['offset']+_0x422c88[_0xfe4e('0x1a')],_0x2dcd52;if(_0x242c09>=_0x378d5e){_0x242c09=_0x378d5e;_0x2dcd52=0xc8;}else{_0x2dcd52=0xce;}_0x5308c5[_0xfe4e('0x17')](_0x2dcd52);return _0x5308c5[_0xfe4e('0x1b')]('Content-Range',_0x129772+'-'+_0x242c09+'/'+_0x378d5e)[_0xfe4e('0x19')](_0x3c1cad);}return null;};}function patchUpdates(_0x19d169){return function(_0x565df4){try{jsonpatch[_0xfe4e('0x1c')](_0x565df4,_0x19d169,!![]);}catch(_0x1284f0){return BPromise['reject'](_0x1284f0);}return _0x565df4[_0xfe4e('0x1d')]();};}function saveUpdates(_0xa4b52,_0x47ef51){return function(_0x39479a){if(_0x39479a){return _0x39479a[_0xfe4e('0x1e')](_0xa4b52)[_0xfe4e('0x1f')](function(_0x5d2f01){return _0x5d2f01;});}return null;};}function removeEntity(_0x35d3f8,_0x554362){return function(_0x4b2191){if(_0x4b2191){return _0x4b2191['destroy']()[_0xfe4e('0x1f')](function(){var _0x1d92d0=_0x4b2191[_0xfe4e('0x20')]({'plain':!![]});var _0x13330b=_0xfe4e('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x13330b,'resourceId':_0x1d92d0['id']}})['then'](function(){return _0x4b2191;});})[_0xfe4e('0x1f')](function(){_0x35d3f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e1fe3,_0x3dda5a){return function(_0x2d11d1){if(!_0x2d11d1){_0x3e1fe3[_0xfe4e('0x16')](0x194);}return _0x2d11d1;};}function handleError(_0x1bf68f,_0x431c9c){_0x431c9c=_0x431c9c||0x1f4;return function(_0x10aa37){logger[_0xfe4e('0x22')](_0x10aa37[_0xfe4e('0x23')]);if(_0x10aa37[_0xfe4e('0x24')]){delete _0x10aa37[_0xfe4e('0x24')];}_0x1bf68f['status'](_0x431c9c)[_0xfe4e('0x25')](_0x10aa37);};}exports['index']=function(_0x179818,_0x335ee1){var _0x365962={},_0x314d6e={},_0x229699={'count':0x0,'rows':[]};var _0x1990d7=_[_0xfe4e('0x26')](db[_0xfe4e('0x21')][_0xfe4e('0x27')],function(_0x304769){return{'name':_0x304769[_0xfe4e('0x28')],'type':_0x304769['type'][_0xfe4e('0x29')]};});_0x314d6e[_0xfe4e('0x2a')]=_[_0xfe4e('0x26')](_0x1990d7,_0xfe4e('0x24'));_0x314d6e[_0xfe4e('0x2b')]=_[_0xfe4e('0x2c')](_0x179818[_0xfe4e('0x2b')]);_0x314d6e['filters']=_[_0xfe4e('0x2d')](_0x314d6e['model'],_0x314d6e[_0xfe4e('0x2b')]);_0x365962[_0xfe4e('0x2e')]=_[_0xfe4e('0x2d')](_0x314d6e[_0xfe4e('0x2a')],qs[_0xfe4e('0x2f')](_0x179818[_0xfe4e('0x2b')][_0xfe4e('0x2f')]));_0x365962[_0xfe4e('0x2e')]=_0x365962[_0xfe4e('0x2e')][_0xfe4e('0x30')]?_0x365962[_0xfe4e('0x2e')]:_0x314d6e['model'];if(!_0x179818[_0xfe4e('0x2b')][_0xfe4e('0x31')](_0xfe4e('0x32'))){_0x365962['limit']=qs[_0xfe4e('0x1a')](_0x179818[_0xfe4e('0x2b')][_0xfe4e('0x1a')]);_0x365962[_0xfe4e('0x33')]=qs[_0xfe4e('0x33')](_0x179818[_0xfe4e('0x2b')][_0xfe4e('0x33')]);}_0x365962['order']=qs[_0xfe4e('0x34')](_0x179818['query'][_0xfe4e('0x34')]);_0x365962[_0xfe4e('0x35')]=qs[_0xfe4e('0x36')](_[_0xfe4e('0x37')](_0x179818[_0xfe4e('0x2b')],_0x314d6e[_0xfe4e('0x36')]),_0x1990d7);if(_0x179818[_0xfe4e('0x2b')][_0xfe4e('0x38')]){_0x365962[_0xfe4e('0x35')]=_[_0xfe4e('0x39')](_0x365962[_0xfe4e('0x35')],{'$or':_[_0xfe4e('0x26')](_0x1990d7,function(_0x3883a8){if(_0x3883a8['type']!=='VIRTUAL'){var _0x1a111f={};_0x1a111f[_0x3883a8[_0xfe4e('0x24')]]={'$like':'%'+_0x179818[_0xfe4e('0x2b')][_0xfe4e('0x38')]+'%'};return _0x1a111f;}})});}_0x365962=_[_0xfe4e('0x39')]({},_0x365962,_0x179818['options']);var _0x113764={'where':_0x365962[_0xfe4e('0x35')]};return db['UserOpenchannelInteraction'][_0xfe4e('0x3a')](_0x113764)[_0xfe4e('0x1f')](function(_0x25ef28){_0x229699[_0xfe4e('0x3a')]=_0x25ef28;if(_0x179818[_0xfe4e('0x2b')]['includeAll']){_0x365962[_0xfe4e('0x3b')]=[{'all':!![]}];}return db['UserOpenchannelInteraction']['findAll'](_0x365962);})[_0xfe4e('0x1f')](function(_0xe7e4cb){_0x229699[_0xfe4e('0x3c')]=_0xe7e4cb;return _0x229699;})['then'](respondWithFilteredResult(_0x335ee1,_0x365962))[_0xfe4e('0x3d')](handleError(_0x335ee1,null));};exports['show']=function(_0x505bca,_0x1dd97a){var _0x41b8d1={'raw':!![],'where':{'id':_0x505bca[_0xfe4e('0x3e')]['id']}},_0x2a48ba={};_0x2a48ba[_0xfe4e('0x2a')]=_[_0xfe4e('0x2c')](db[_0xfe4e('0x21')][_0xfe4e('0x27')]);_0x2a48ba[_0xfe4e('0x2b')]=_['keys'](_0x505bca[_0xfe4e('0x2b')]);_0x2a48ba[_0xfe4e('0x36')]=_[_0xfe4e('0x2d')](_0x2a48ba[_0xfe4e('0x2a')],_0x2a48ba[_0xfe4e('0x2b')]);_0x41b8d1['attributes']=_[_0xfe4e('0x2d')](_0x2a48ba['model'],qs[_0xfe4e('0x2f')](_0x505bca['query'][_0xfe4e('0x2f')]));_0x41b8d1[_0xfe4e('0x2e')]=_0x41b8d1['attributes'][_0xfe4e('0x30')]?_0x41b8d1[_0xfe4e('0x2e')]:_0x2a48ba[_0xfe4e('0x2a')];if(_0x505bca[_0xfe4e('0x2b')][_0xfe4e('0x3f')]){_0x41b8d1[_0xfe4e('0x3b')]=[{'all':!![]}];}_0x41b8d1=_[_0xfe4e('0x39')]({},_0x41b8d1,_0x505bca[_0xfe4e('0x40')]);return db[_0xfe4e('0x21')][_0xfe4e('0x41')](_0x41b8d1)['then'](handleEntityNotFound(_0x1dd97a,null))[_0xfe4e('0x1f')](respondWithResult(_0x1dd97a,null))[_0xfe4e('0x3d')](handleError(_0x1dd97a,null));};exports[_0xfe4e('0x42')]=function(_0x86c26d,_0x13b0e0){return db[_0xfe4e('0x21')][_0xfe4e('0x42')](_0x86c26d['body'],{})[_0xfe4e('0x1f')](function(_0x263f70){var _0x420323=_0x86c26d['user'][_0xfe4e('0x20')]({'plain':!![]});if(!_0x420323)throw new Error(_0xfe4e('0x43'));if(_0x420323[_0xfe4e('0x44')]===_0xfe4e('0x45')){var _0xc1af49=_0x263f70[_0xfe4e('0x20')]({'plain':!![]});var _0x193c83='UserOpenchannelInteraction';return db[_0xfe4e('0x46')]['find']({'where':{'name':_0x193c83,'userProfileId':_0x420323[_0xfe4e('0x47')]},'raw':!![]})[_0xfe4e('0x1f')](function(_0x21327d){if(_0x21327d&&_0x21327d[_0xfe4e('0x48')]===0x0){return db[_0xfe4e('0x49')][_0xfe4e('0x42')]({'name':_0xc1af49['name'],'resourceId':_0xc1af49['id'],'type':_0x21327d['name'],'sectionId':_0x21327d['id']},{})[_0xfe4e('0x1f')](function(){return _0x263f70;});}else{return _0x263f70;}})[_0xfe4e('0x3d')](function(_0x33ab52){logger[_0xfe4e('0x22')](_0xfe4e('0x4a'),_0x33ab52);throw _0x33ab52;});}return _0x263f70;})[_0xfe4e('0x1f')](respondWithResult(_0x13b0e0,0xc9))[_0xfe4e('0x3d')](handleError(_0x13b0e0,null));};exports[_0xfe4e('0x1e')]=function(_0x168471,_0x488bd6){if(_0x168471[_0xfe4e('0x4b')]['id']){delete _0x168471[_0xfe4e('0x4b')]['id'];}return db['UserOpenchannelInteraction'][_0xfe4e('0x41')]({'where':{'id':_0x168471[_0xfe4e('0x3e')]['id']}})[_0xfe4e('0x1f')](handleEntityNotFound(_0x488bd6,null))[_0xfe4e('0x1f')](saveUpdates(_0x168471['body'],null))['then'](respondWithResult(_0x488bd6,null))[_0xfe4e('0x3d')](handleError(_0x488bd6,null));};exports[_0xfe4e('0x4c')]=function(_0x2c0de4,_0x2fdd6c){return db[_0xfe4e('0x21')][_0xfe4e('0x41')]({'where':{'id':_0x2c0de4[_0xfe4e('0x3e')]['id']}})[_0xfe4e('0x1f')](handleEntityNotFound(_0x2fdd6c,null))[_0xfe4e('0x1f')](removeEntity(_0x2fdd6c,null))[_0xfe4e('0x3d')](handleError(_0x2fdd6c,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index a71a1a0..0d234a2 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 _0x1659=['path','rimraf','../../config/environment','./UserOpenchannelInteraction.attributes','exports','lodash','util','request-promise'];(function(_0x7cf3ac,_0x5f2ec1){var _0x3dd953=function(_0x18e29c){while(--_0x18e29c){_0x7cf3ac['push'](_0x7cf3ac['shift']());}};_0x3dd953(++_0x5f2ec1);}(_0x1659,0x175));var _0x9165=function(_0x107f33,_0xbf8b0f){_0x107f33=_0x107f33-0x0;var _0x351ef0=_0x1659[_0x107f33];return _0x351ef0;};'use strict';var _=require(_0x9165('0x0'));var util=require(_0x9165('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9165('0x2'));var fs=require('fs');var path=require(_0x9165('0x3'));var rimraf=require(_0x9165('0x4'));var config=require(_0x9165('0x5'));var attributes=require(_0x9165('0x6'));module[_0x9165('0x7')]=function(_0x49a94c,_0x4244db){return _0x49a94c['define']('UserOpenchannelInteraction',attributes,{'tableName':'user_has_openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16f4=['api','request-promise','rimraf','define','lodash','util'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x16f4,0x160));var _0x416f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x16f4[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x416f('0x0'));var util=require(_0x416f('0x1'));var logger=require('../../config/logger')(_0x416f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x416f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x416f('0x4'));var config=require('../../config/environment');var attributes=require('./UserOpenchannelInteraction.attributes');module['exports']=function(_0x5a5bed,_0xcab9a3){return _0x5a5bed[_0x416f('0x5')]('UserOpenchannelInteraction',attributes,{'tableName':'user_has_openchannel_interactions','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 b5055c7..2976000 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 _0x072e=['request','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','debug','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x8b42e1,_0x30f8d7){var _0xa90d10=function(_0x22f9a8){while(--_0x22f9a8){_0x8b42e1['push'](_0x8b42e1['shift']());}};_0xa90d10(++_0x30f8d7);}(_0x072e,0x1aa));var _0xe072=function(_0x433c13,_0x24d0fc){_0x433c13=_0x433c13-0x0;var _0x12ff31=_0x072e[_0x433c13];return _0x12ff31;};'use strict';var _=require(_0xe072('0x0'));var util=require(_0xe072('0x1'));var moment=require(_0xe072('0x2'));var BPromise=require(_0xe072('0x3'));var rs=require(_0xe072('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe072('0x5'))['db'];var utils=require(_0xe072('0x6'));var logger=require(_0xe072('0x7'))('rpc');var config=require(_0xe072('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe072('0x9')][_0xe072('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1615c8,_0x245cb7,_0x143f9a){return new BPromise(function(_0x249d5c,_0x2774a1){return client[_0xe072('0xb')](_0x1615c8,_0x143f9a)[_0xe072('0xc')](function(_0x24366d){logger[_0xe072('0xd')](_0xe072('0xe'),_0x245cb7,'request\x20sent');logger[_0xe072('0xf')](_0xe072('0x10'),_0x245cb7,'request\x20sent',JSON[_0xe072('0x11')](_0x24366d));if(_0x24366d[_0xe072('0x12')]){if(_0x24366d[_0xe072('0x12')][_0xe072('0x13')]===0x1f4){logger[_0xe072('0x12')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x245cb7,_0x24366d[_0xe072('0x12')][_0xe072('0x14')]);return _0x2774a1(_0x24366d[_0xe072('0x12')][_0xe072('0x14')]);}logger['error'](_0xe072('0xe'),_0x245cb7,_0x24366d[_0xe072('0x12')][_0xe072('0x14')]);return _0x249d5c(_0x24366d[_0xe072('0x12')]['message']);}else{logger[_0xe072('0xd')](_0xe072('0xe'),_0x245cb7,_0xe072('0x15'));_0x249d5c(_0x24366d['result']['message']);}})[_0xe072('0x16')](function(_0x44f695){logger[_0xe072('0x12')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x245cb7,_0x44f695);_0x2774a1(_0x44f695);});});} \ No newline at end of file +var _0x5f6f=['http','request','then','request\x20sent','debug','stringify','error','code','UserOpenchannelInteraction,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1301aa,_0x4da5c4){var _0x5146a1=function(_0x417cd1){while(--_0x417cd1){_0x1301aa['push'](_0x1301aa['shift']());}};_0x5146a1(++_0x4da5c4);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x2f63a0,_0x51855d){_0x2f63a0=_0x2f63a0-0x0;var _0x536ae8=_0x5f6f[_0x2f63a0];return _0x536ae8;};'use strict';var _=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var moment=require(_0xf5f6('0x2'));var BPromise=require(_0xf5f6('0x3'));var rs=require(_0xf5f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5f6('0x5'))['db'];var utils=require(_0xf5f6('0x6'));var logger=require(_0xf5f6('0x7'))('rpc');var config=require(_0xf5f6('0x8'));var jayson=require(_0xf5f6('0x9'));var client=jayson[_0xf5f6('0xa')][_0xf5f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x508c02,_0x54054c,_0xa635ff){return new BPromise(function(_0x2fa090,_0x22f837){return client[_0xf5f6('0xc')](_0x508c02,_0xa635ff)[_0xf5f6('0xd')](function(_0x13cb75){logger['info']('UserOpenchannelInteraction,\x20%s,\x20%s',_0x54054c,_0xf5f6('0xe'));logger[_0xf5f6('0xf')]('UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x54054c,_0xf5f6('0xe'),JSON[_0xf5f6('0x10')](_0x13cb75));if(_0x13cb75[_0xf5f6('0x11')]){if(_0x13cb75[_0xf5f6('0x11')][_0xf5f6('0x12')]===0x1f4){logger['error'](_0xf5f6('0x13'),_0x54054c,_0x13cb75['error'][_0xf5f6('0x14')]);return _0x22f837(_0x13cb75[_0xf5f6('0x11')][_0xf5f6('0x14')]);}logger[_0xf5f6('0x11')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x54054c,_0x13cb75[_0xf5f6('0x11')][_0xf5f6('0x14')]);return _0x2fa090(_0x13cb75[_0xf5f6('0x11')][_0xf5f6('0x14')]);}else{logger['info'](_0xf5f6('0x13'),_0x54054c,_0xf5f6('0xe'));_0x2fa090(_0x13cb75[_0xf5f6('0x15')][_0xf5f6('0x14')]);}})['catch'](function(_0x5bc2dc){logger[_0xf5f6('0x11')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x54054c,_0x5bc2dc);_0x22f837(_0x5bc2dc);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index 637bb08..5d7b6d4 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 _0x6c4c=['isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./UserOpenchannelInteraction.controller','get'];(function(_0x542ef3,_0x54d9cf){var _0x6fa444=function(_0x5ac8d2){while(--_0x5ac8d2){_0x542ef3['push'](_0x542ef3['shift']());}};_0x6fa444(++_0x54d9cf);}(_0x6c4c,0x16e));var _0xc6c4=function(_0x351781,_0xdf3a2c){_0x351781=_0x351781-0x0;var _0x1c773b=_0x6c4c[_0x351781];return _0x1c773b;};'use strict';var multer=require(_0xc6c4('0x0'));var util=require('util');var path=require(_0xc6c4('0x1'));var timeout=require(_0xc6c4('0x2'));var express=require('express');var router=express[_0xc6c4('0x3')]();var auth=require(_0xc6c4('0x4'));var interaction=require(_0xc6c4('0x5'));var config=require('../../config/environment');var controller=require(_0xc6c4('0x6'));router[_0xc6c4('0x7')]('/',auth[_0xc6c4('0x8')](),controller['index']);router[_0xc6c4('0x7')](_0xc6c4('0x9'),auth['isAuthenticated'](),controller[_0xc6c4('0xa')]);router[_0xc6c4('0xb')]('/',auth[_0xc6c4('0x8')](),controller[_0xc6c4('0xc')]);router['put'](_0xc6c4('0x9'),auth[_0xc6c4('0x8')](),controller[_0xc6c4('0xd')]);router[_0xc6c4('0xe')](_0xc6c4('0x9'),auth[_0xc6c4('0x8')](),controller[_0xc6c4('0xf')]);module[_0xc6c4('0x10')]=router; \ No newline at end of file +var _0x9ba0=['create','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserOpenchannelInteraction.controller','get','isAuthenticated','index','/:id','show'];(function(_0x11a3b7,_0x29ec86){var _0x59fb0d=function(_0x2c111f){while(--_0x2c111f){_0x11a3b7['push'](_0x11a3b7['shift']());}};_0x59fb0d(++_0x29ec86);}(_0x9ba0,0x1c7));var _0x09ba=function(_0x5184d1,_0x12d323){_0x5184d1=_0x5184d1-0x0;var _0x1a8857=_0x9ba0[_0x5184d1];return _0x1a8857;};'use strict';var multer=require(_0x09ba('0x0'));var util=require(_0x09ba('0x1'));var path=require(_0x09ba('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x09ba('0x3')]();var auth=require(_0x09ba('0x4'));var interaction=require(_0x09ba('0x5'));var config=require(_0x09ba('0x6'));var controller=require(_0x09ba('0x7'));router[_0x09ba('0x8')]('/',auth[_0x09ba('0x9')](),controller[_0x09ba('0xa')]);router[_0x09ba('0x8')](_0x09ba('0xb'),auth[_0x09ba('0x9')](),controller[_0x09ba('0xc')]);router['post']('/',auth[_0x09ba('0x9')](),controller[_0x09ba('0xd')]);router['put'](_0x09ba('0xb'),auth[_0x09ba('0x9')](),controller[_0x09ba('0xe')]);router[_0x09ba('0xf')]('/:id',auth[_0x09ba('0x9')](),controller[_0x09ba('0x10')]);module[_0x09ba('0x11')]=router; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js b/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js index 40fb3de..6bfb35b 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 _0x7de2=['INTEGER','sequelize'];(function(_0x428890,_0x5e452d){var _0x1de408=function(_0x311ee2){while(--_0x311ee2){_0x428890['push'](_0x428890['shift']());}};_0x1de408(++_0x5e452d);}(_0x7de2,0x133));var _0x27de=function(_0x5f2e9b,_0x541e12){_0x5f2e9b=_0x5f2e9b-0x0;var _0x40e995=_0x7de2[_0x5f2e9b];return _0x40e995;};'use strict';var Sequelize=require(_0x27de('0x0'));module['exports']={'SmsInteractionId':{'type':Sequelize[_0x27de('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x27de('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0xf995=['exports','INTEGER'];(function(_0x145544,_0x557894){var _0x66fdd9=function(_0x16502a){while(--_0x16502a){_0x145544['push'](_0x145544['shift']());}};_0x66fdd9(++_0x557894);}(_0xf995,0x110));var _0x5f99=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf995[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x5f99('0x0')]={'SmsInteractionId':{'type':Sequelize[_0x5f99('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js index e550f05..57c065b 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(_0x127bca,_0x2d7c2f){var _0x5dcc52=function(_0x5f4f69){while(--_0x5f4f69){_0x127bca['push'](_0x127bca['shift']());}};_0x5dcc52(++_0x2d7c2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0xdaad83,_0x1f6ae1){var _0x3dbaa9=function(_0x5ec0d8){while(--_0x5ec0d8){_0xdaad83['push'](_0xdaad83['shift']());}};_0x3dbaa9(++_0x1f6ae1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 5aea48a..d9fbc18 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 _0x4211=['request-promise','path','rimraf','exports','UserSmsInteraction','user_has_sms_interactions','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1512f0,_0x4e00a3){var _0x55e2cb=function(_0x25a019){while(--_0x25a019){_0x1512f0['push'](_0x1512f0['shift']());}};_0x55e2cb(++_0x4e00a3);}(_0x4211,0x1b3));var _0x1421=function(_0x946edc,_0x3fdfdd){_0x946edc=_0x946edc-0x0;var _0x4d8aeb=_0x4211[_0x946edc];return _0x4d8aeb;};'use strict';var _=require(_0x1421('0x0'));var util=require(_0x1421('0x1'));var logger=require(_0x1421('0x2'))('api');var moment=require(_0x1421('0x3'));var BPromise=require(_0x1421('0x4'));var rp=require(_0x1421('0x5'));var fs=require('fs');var path=require(_0x1421('0x6'));var rimraf=require(_0x1421('0x7'));var config=require('../../config/environment');var attributes=require('./UserSmsInteraction.attributes');module[_0x1421('0x8')]=function(_0x401469,_0x19a69b){return _0x401469['define'](_0x1421('0x9'),attributes,{'tableName':_0x1421('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2091=['path','rimraf','../../config/environment','exports','define','UserSmsInteraction','lodash','api','moment','bluebird','request-promise'];(function(_0xf6aec0,_0x51ffd6){var _0x59a51b=function(_0x57adc6){while(--_0x57adc6){_0xf6aec0['push'](_0xf6aec0['shift']());}};_0x59a51b(++_0x51ffd6);}(_0x2091,0x7f));var _0x1209=function(_0x43f3fe,_0x19bb95){_0x43f3fe=_0x43f3fe-0x0;var _0x41827a=_0x2091[_0x43f3fe];return _0x41827a;};'use strict';var _=require(_0x1209('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1209('0x1'));var moment=require(_0x1209('0x2'));var BPromise=require(_0x1209('0x3'));var rp=require(_0x1209('0x4'));var fs=require('fs');var path=require(_0x1209('0x5'));var rimraf=require(_0x1209('0x6'));var config=require(_0x1209('0x7'));var attributes=require('./UserSmsInteraction.attributes');module[_0x1209('0x8')]=function(_0x1fb444,_0x1b37d7){return _0x1fb444[_0x1209('0x9')](_0x1209('0xa'),attributes,{'tableName':'user_has_sms_interactions','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 2293aa3..6a2cb20 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 _0x3deb=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsInteraction,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util','moment'];(function(_0x16b411,_0x51bbdc){var _0x1509b4=function(_0x208fcd){while(--_0x208fcd){_0x16b411['push'](_0x16b411['shift']());}};_0x1509b4(++_0x51bbdc);}(_0x3deb,0xa5));var _0xb3de=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x3deb[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0xb3de('0x0'));var util=require(_0xb3de('0x1'));var moment=require(_0xb3de('0x2'));var BPromise=require(_0xb3de('0x3'));var rs=require(_0xb3de('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3de('0x5'))['db'];var utils=require(_0xb3de('0x6'));var logger=require(_0xb3de('0x7'))(_0xb3de('0x8'));var config=require(_0xb3de('0x9'));var jayson=require(_0xb3de('0xa'));var client=jayson[_0xb3de('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf96719,_0x3030bb,_0x2134b2){return new BPromise(function(_0x31ab88,_0x1f32c8){return client['request'](_0xf96719,_0x2134b2)[_0xb3de('0xc')](function(_0xc0d965){logger['info']('UserSmsInteraction,\x20%s,\x20%s',_0x3030bb,'request\x20sent');logger[_0xb3de('0xd')](_0xb3de('0xe'),_0x3030bb,'request\x20sent',JSON[_0xb3de('0xf')](_0xc0d965));if(_0xc0d965['error']){if(_0xc0d965[_0xb3de('0x10')][_0xb3de('0x11')]===0x1f4){logger[_0xb3de('0x10')](_0xb3de('0x12'),_0x3030bb,_0xc0d965[_0xb3de('0x10')]['message']);return _0x1f32c8(_0xc0d965[_0xb3de('0x10')][_0xb3de('0x13')]);}logger[_0xb3de('0x10')](_0xb3de('0x12'),_0x3030bb,_0xc0d965[_0xb3de('0x10')][_0xb3de('0x13')]);return _0x31ab88(_0xc0d965[_0xb3de('0x10')]['message']);}else{logger[_0xb3de('0x14')](_0xb3de('0x12'),_0x3030bb,_0xb3de('0x15'));_0x31ab88(_0xc0d965[_0xb3de('0x16')][_0xb3de('0x13')]);}})[_0xb3de('0x17')](function(_0x9d04b2){logger[_0xb3de('0x10')](_0xb3de('0x12'),_0x3030bb,_0x9d04b2);_0x1f32c8(_0x9d04b2);});});} \ No newline at end of file +var _0xdda0=['../../config/logger','rpc','client','http','info','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','bluebird','../../mysqldb','../../config/utils'];(function(_0x4b4b09,_0x6383a2){var _0x42489f=function(_0x45fba7){while(--_0x45fba7){_0x4b4b09['push'](_0x4b4b09['shift']());}};_0x42489f(++_0x6383a2);}(_0xdda0,0x1cd));var _0x0dda=function(_0x31e1c2,_0x2dea86){_0x31e1c2=_0x31e1c2-0x0;var _0x58e436=_0xdda0[_0x31e1c2];return _0x58e436;};'use strict';var _=require(_0x0dda('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0dda('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0dda('0x2'))['db'];var utils=require(_0x0dda('0x3'));var logger=require(_0x0dda('0x4'))(_0x0dda('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0dda('0x6')][_0x0dda('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f9768,_0x35a261,_0x451a64){return new BPromise(function(_0x1689e7,_0x257754){return client['request'](_0x1f9768,_0x451a64)['then'](function(_0x4a3176){logger[_0x0dda('0x8')](_0x0dda('0x9'),_0x35a261,'request\x20sent');logger['debug']('UserSmsInteraction,\x20%s,\x20%s,\x20%s',_0x35a261,_0x0dda('0xa'),JSON['stringify'](_0x4a3176));if(_0x4a3176[_0x0dda('0xb')]){if(_0x4a3176[_0x0dda('0xb')][_0x0dda('0xc')]===0x1f4){logger[_0x0dda('0xb')](_0x0dda('0x9'),_0x35a261,_0x4a3176[_0x0dda('0xb')][_0x0dda('0xd')]);return _0x257754(_0x4a3176[_0x0dda('0xb')][_0x0dda('0xd')]);}logger[_0x0dda('0xb')](_0x0dda('0x9'),_0x35a261,_0x4a3176[_0x0dda('0xb')][_0x0dda('0xd')]);return _0x1689e7(_0x4a3176[_0x0dda('0xb')]['message']);}else{logger[_0x0dda('0x8')](_0x0dda('0x9'),_0x35a261,_0x0dda('0xa'));_0x1689e7(_0x4a3176['result'][_0x0dda('0xd')]);}})[_0x0dda('0xe')](function(_0x22e99a){logger[_0x0dda('0xb')]('UserSmsInteraction,\x20%s,\x20%s',_0x35a261,_0x22e99a);_0x257754(_0x22e99a);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index ec86c34..7e58650 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 _0x4122=['post','create','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserSmsInteraction.controller','get','isAuthenticated','/:id','show'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4122,0x16e));var _0x2412=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4122[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x2412('0x0'));var util=require(_0x2412('0x1'));var path=require(_0x2412('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2412('0x3')]();var auth=require(_0x2412('0x4'));var interaction=require(_0x2412('0x5'));var config=require(_0x2412('0x6'));var controller=require(_0x2412('0x7'));router[_0x2412('0x8')]('/',auth[_0x2412('0x9')](),controller['index']);router[_0x2412('0x8')](_0x2412('0xa'),auth['isAuthenticated'](),controller[_0x2412('0xb')]);router[_0x2412('0xc')]('/',auth[_0x2412('0x9')](),controller[_0x2412('0xd')]);router[_0x2412('0xe')](_0x2412('0xa'),auth[_0x2412('0x9')](),controller[_0x2412('0xf')]);router['delete'](_0x2412('0xa'),auth[_0x2412('0x9')](),controller[_0x2412('0x10')]);module[_0x2412('0x11')]=router; \ No newline at end of file +var _0xbfa4=['destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./UserSmsInteraction.controller','isAuthenticated','/:id','show','post','create','put','delete'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0xbfa4,0x82));var _0x4bfa=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xbfa4[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x4bfa('0x0'));var util=require('util');var path=require(_0x4bfa('0x1'));var timeout=require(_0x4bfa('0x2'));var express=require(_0x4bfa('0x3'));var router=express['Router']();var auth=require(_0x4bfa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4bfa('0x5'));var controller=require(_0x4bfa('0x6'));router['get']('/',auth[_0x4bfa('0x7')](),controller['index']);router['get'](_0x4bfa('0x8'),auth[_0x4bfa('0x7')](),controller[_0x4bfa('0x9')]);router[_0x4bfa('0xa')]('/',auth[_0x4bfa('0x7')](),controller[_0x4bfa('0xb')]);router[_0x4bfa('0xc')](_0x4bfa('0x8'),auth[_0x4bfa('0x7')](),controller['update']);router[_0x4bfa('0xd')](_0x4bfa('0x8'),auth[_0x4bfa('0x7')](),controller[_0x4bfa('0xe')]);module[_0x4bfa('0xf')]=router; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js index 4e800eb..755b4f7 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 _0x24db=['INTEGER','exports'];(function(_0x1b852e,_0x185f0d){var _0x2fd5cf=function(_0x1dc638){while(--_0x1dc638){_0x1b852e['push'](_0x1b852e['shift']());}};_0x2fd5cf(++_0x185f0d);}(_0x24db,0x17d));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xb24d('0x0')]={'WhatsappInteractionId':{'type':Sequelize[_0xb24d('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xb24d('0x1')],'primaryKey':!![]}}; \ No newline at end of file +var _0x9909=['exports','INTEGER'];(function(_0x500a3d,_0x124482){var _0x110d50=function(_0x29ffb5){while(--_0x29ffb5){_0x500a3d['push'](_0x500a3d['shift']());}};_0x110d50(++_0x124482);}(_0x9909,0x9e));var _0x9990=function(_0x393c24,_0x29c062){_0x393c24=_0x393c24-0x0;var _0x273e83=_0x9909[_0x393c24];return _0x273e83;};'use strict';var Sequelize=require('sequelize');module[_0x9990('0x0')]={'WhatsappInteractionId':{'type':Sequelize[_0x9990('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js index be7479a..3c02b09 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 _0xb088=['error','stack','name','send','index','UserWhatsappInteraction','rawAttributes','fieldName','key','query','model','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','filters','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserWhatsappInteractions'];(function(_0x340e41,_0x59a793){var _0x39061a=function(_0x58094b){while(--_0x58094b){_0x340e41['push'](_0x340e41['shift']());}};_0x39061a(++_0x59a793);}(_0xb088,0xd1));var _0x8b08=function(_0x554d7a,_0x1d82d9){_0x554d7a=_0x554d7a-0x0;var _0x3dfdec=_0xb088[_0x554d7a];return _0x3dfdec;};'use strict';var pdf=require(_0x8b08('0x0'));var emlformat=require(_0x8b08('0x1'));var rimraf=require(_0x8b08('0x2'));var zipdir=require(_0x8b08('0x3'));var jsonpatch=require(_0x8b08('0x4'));var rp=require(_0x8b08('0x5'));var moment=require(_0x8b08('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8b08('0x7'));var util=require('util');var path=require(_0x8b08('0x8'));var sox=require(_0x8b08('0x9'));var csv=require(_0x8b08('0xa'));var ejs=require(_0x8b08('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b08('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8b08('0xa'));var querystring=require(_0x8b08('0xd'));var Papa=require(_0x8b08('0xe'));var Redis=require(_0x8b08('0xf'));var authService=require(_0x8b08('0x10'));var qs=require(_0x8b08('0x11'));var as=require(_0x8b08('0x12'));var hardwareService=require(_0x8b08('0x13'));var logger=require(_0x8b08('0x14'))(_0x8b08('0x15'));var utils=require(_0x8b08('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8b08('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37465d,_0x527763){_0x527763=_0x527763||0xcc;return function(_0x26c5f8){if(_0x26c5f8){return _0x37465d[_0x8b08('0x18')](_0x527763);}return _0x37465d[_0x8b08('0x19')](_0x527763)[_0x8b08('0x1a')]();};}function respondWithResult(_0x4f0391,_0x594c3b){_0x594c3b=_0x594c3b||0xc8;return function(_0x830e7a){if(_0x830e7a){return _0x4f0391[_0x8b08('0x19')](_0x594c3b)[_0x8b08('0x1b')](_0x830e7a);}};}function respondWithFilteredResult(_0x5dad58,_0x45e416){return function(_0x3dbbd3){if(_0x3dbbd3){var _0x50ce6f=_0x3dbbd3[_0x8b08('0x1c')],_0x2532b9=_0x45e416[_0x8b08('0x1d')],_0x4d8dc7=_0x45e416['offset']+_0x45e416['limit'],_0x7174ae;if(_0x4d8dc7>=_0x50ce6f){_0x4d8dc7=_0x50ce6f;_0x7174ae=0xc8;}else{_0x7174ae=0xce;}_0x5dad58[_0x8b08('0x19')](_0x7174ae);return _0x5dad58[_0x8b08('0x1e')](_0x8b08('0x1f'),_0x2532b9+'-'+_0x4d8dc7+'/'+_0x50ce6f)[_0x8b08('0x1b')](_0x3dbbd3);}return null;};}function patchUpdates(_0x4d4e6d){return function(_0x2cfa57){try{jsonpatch[_0x8b08('0x20')](_0x2cfa57,_0x4d4e6d,!![]);}catch(_0x2ad8e6){return BPromise[_0x8b08('0x21')](_0x2ad8e6);}return _0x2cfa57[_0x8b08('0x22')]();};}function saveUpdates(_0x458b31,_0x24964e){return function(_0x1828f2){if(_0x1828f2){return _0x1828f2[_0x8b08('0x23')](_0x458b31)[_0x8b08('0x24')](function(_0x3f3ad3){return _0x3f3ad3;});}return null;};}function removeEntity(_0x4d1cb9,_0x429aca){return function(_0x280473){if(_0x280473){return _0x280473[_0x8b08('0x25')]()[_0x8b08('0x24')](function(){var _0x203370=_0x280473[_0x8b08('0x26')]({'plain':!![]});var _0x147214=_0x8b08('0x27');return db['UserProfileResource'][_0x8b08('0x25')]({'where':{'type':_0x147214,'resourceId':_0x203370['id']}})[_0x8b08('0x24')](function(){return _0x280473;});})[_0x8b08('0x24')](function(){_0x4d1cb9['status'](0xcc)[_0x8b08('0x1a')]();});}};}function handleEntityNotFound(_0x37cd15,_0x51c896){return function(_0xd8f748){if(!_0xd8f748){_0x37cd15[_0x8b08('0x18')](0x194);}return _0xd8f748;};}function handleError(_0x31ad0a,_0x38806a){_0x38806a=_0x38806a||0x1f4;return function(_0x4498ce){logger[_0x8b08('0x28')](_0x4498ce[_0x8b08('0x29')]);if(_0x4498ce['name']){delete _0x4498ce[_0x8b08('0x2a')];}_0x31ad0a[_0x8b08('0x19')](_0x38806a)[_0x8b08('0x2b')](_0x4498ce);};}exports[_0x8b08('0x2c')]=function(_0x1f34a3,_0x2ddfdc){var _0x283627={},_0x5a3a41={},_0x221b4f={'count':0x0,'rows':[]};var _0x55a60b=_['map'](db[_0x8b08('0x2d')][_0x8b08('0x2e')],function(_0x18a913){return{'name':_0x18a913[_0x8b08('0x2f')],'type':_0x18a913['type'][_0x8b08('0x30')]};});_0x5a3a41['model']=_['map'](_0x55a60b,_0x8b08('0x2a'));_0x5a3a41[_0x8b08('0x31')]=_['keys'](_0x1f34a3['query']);_0x5a3a41['filters']=_['intersection'](_0x5a3a41[_0x8b08('0x32')],_0x5a3a41[_0x8b08('0x31')]);_0x283627['attributes']=_[_0x8b08('0x33')](_0x5a3a41[_0x8b08('0x32')],qs[_0x8b08('0x34')](_0x1f34a3[_0x8b08('0x31')]['fields']));_0x283627[_0x8b08('0x35')]=_0x283627[_0x8b08('0x35')][_0x8b08('0x36')]?_0x283627[_0x8b08('0x35')]:_0x5a3a41[_0x8b08('0x32')];if(!_0x1f34a3['query'][_0x8b08('0x37')]('nolimit')){_0x283627[_0x8b08('0x38')]=qs[_0x8b08('0x38')](_0x1f34a3[_0x8b08('0x31')][_0x8b08('0x38')]);_0x283627[_0x8b08('0x1d')]=qs[_0x8b08('0x1d')](_0x1f34a3[_0x8b08('0x31')]['offset']);}_0x283627['order']=qs[_0x8b08('0x39')](_0x1f34a3['query'][_0x8b08('0x39')]);_0x283627[_0x8b08('0x3a')]=qs[_0x8b08('0x3b')](_[_0x8b08('0x3c')](_0x1f34a3['query'],_0x5a3a41[_0x8b08('0x3b')]),_0x55a60b);if(_0x1f34a3[_0x8b08('0x31')][_0x8b08('0x3d')]){_0x283627['where']=_['merge'](_0x283627[_0x8b08('0x3a')],{'$or':_[_0x8b08('0x3e')](_0x55a60b,function(_0x2bca45){if(_0x2bca45[_0x8b08('0x3f')]!==_0x8b08('0x40')){var _0xfa1954={};_0xfa1954[_0x2bca45[_0x8b08('0x2a')]]={'$like':'%'+_0x1f34a3[_0x8b08('0x31')][_0x8b08('0x3d')]+'%'};return _0xfa1954;}})});}_0x283627=_[_0x8b08('0x41')]({},_0x283627,_0x1f34a3[_0x8b08('0x42')]);var _0x8260fb={'where':_0x283627['where']};return db['UserWhatsappInteraction'][_0x8b08('0x1c')](_0x8260fb)[_0x8b08('0x24')](function(_0x521bbe){_0x221b4f['count']=_0x521bbe;if(_0x1f34a3[_0x8b08('0x31')][_0x8b08('0x43')]){_0x283627[_0x8b08('0x44')]=[{'all':!![]}];}return db[_0x8b08('0x2d')][_0x8b08('0x45')](_0x283627);})['then'](function(_0x14e82c){_0x221b4f['rows']=_0x14e82c;return _0x221b4f;})['then'](respondWithFilteredResult(_0x2ddfdc,_0x283627))['catch'](handleError(_0x2ddfdc,null));};exports[_0x8b08('0x46')]=function(_0x432b0f,_0x13ade4){var _0x1d659b={'raw':!![],'where':{'id':_0x432b0f[_0x8b08('0x47')]['id']}},_0x2b163b={};_0x2b163b[_0x8b08('0x32')]=_[_0x8b08('0x48')](db[_0x8b08('0x2d')]['rawAttributes']);_0x2b163b['query']=_[_0x8b08('0x48')](_0x432b0f[_0x8b08('0x31')]);_0x2b163b[_0x8b08('0x3b')]=_['intersection'](_0x2b163b[_0x8b08('0x32')],_0x2b163b[_0x8b08('0x31')]);_0x1d659b[_0x8b08('0x35')]=_[_0x8b08('0x33')](_0x2b163b[_0x8b08('0x32')],qs[_0x8b08('0x34')](_0x432b0f[_0x8b08('0x31')]['fields']));_0x1d659b[_0x8b08('0x35')]=_0x1d659b[_0x8b08('0x35')][_0x8b08('0x36')]?_0x1d659b['attributes']:_0x2b163b[_0x8b08('0x32')];if(_0x432b0f['query'][_0x8b08('0x43')]){_0x1d659b[_0x8b08('0x44')]=[{'all':!![]}];}_0x1d659b=_[_0x8b08('0x41')]({},_0x1d659b,_0x432b0f[_0x8b08('0x42')]);return db['UserWhatsappInteraction']['find'](_0x1d659b)['then'](handleEntityNotFound(_0x13ade4,null))['then'](respondWithResult(_0x13ade4,null))[_0x8b08('0x49')](handleError(_0x13ade4,null));};exports['create']=function(_0x1e275a,_0x33fa9b){return db['UserWhatsappInteraction'][_0x8b08('0x4a')](_0x1e275a[_0x8b08('0x4b')],{})[_0x8b08('0x24')](function(_0x1acc8b){var _0x2417ea=_0x1e275a['user'][_0x8b08('0x26')]({'plain':!![]});if(!_0x2417ea)throw new Error(_0x8b08('0x4c'));if(_0x2417ea[_0x8b08('0x4d')]===_0x8b08('0x4e')){var _0x1c19d6=_0x1acc8b['get']({'plain':!![]});var _0x4c3e39='UserWhatsappInteractions';return db[_0x8b08('0x4f')][_0x8b08('0x50')]({'where':{'name':_0x4c3e39,'userProfileId':_0x2417ea[_0x8b08('0x51')]},'raw':!![]})[_0x8b08('0x24')](function(_0x4ac01b){if(_0x4ac01b&&_0x4ac01b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1c19d6[_0x8b08('0x2a')],'resourceId':_0x1c19d6['id'],'type':_0x4ac01b[_0x8b08('0x2a')],'sectionId':_0x4ac01b['id']},{})[_0x8b08('0x24')](function(){return _0x1acc8b;});}else{return _0x1acc8b;}})['catch'](function(_0x59e21c){logger[_0x8b08('0x28')](_0x8b08('0x52'),_0x59e21c);throw _0x59e21c;});}return _0x1acc8b;})['then'](respondWithResult(_0x33fa9b,0xc9))[_0x8b08('0x49')](handleError(_0x33fa9b,null));};exports[_0x8b08('0x23')]=function(_0x52414a,_0x59949f){if(_0x52414a[_0x8b08('0x4b')]['id']){delete _0x52414a[_0x8b08('0x4b')]['id'];}return db['UserWhatsappInteraction'][_0x8b08('0x50')]({'where':{'id':_0x52414a[_0x8b08('0x47')]['id']}})[_0x8b08('0x24')](handleEntityNotFound(_0x59949f,null))['then'](saveUpdates(_0x52414a[_0x8b08('0x4b')],null))[_0x8b08('0x24')](respondWithResult(_0x59949f,null))[_0x8b08('0x49')](handleError(_0x59949f,null));};exports[_0x8b08('0x25')]=function(_0x9fe462,_0x605617){return db[_0x8b08('0x2d')][_0x8b08('0x50')]({'where':{'id':_0x9fe462[_0x8b08('0x47')]['id']}})[_0x8b08('0x24')](handleEntityNotFound(_0x605617,null))[_0x8b08('0x24')](removeEntity(_0x605617,null))[_0x8b08('0x49')](handleError(_0x605617,null));}; \ No newline at end of file +var _0x5e39=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','UserWhatsappInteraction','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','json','reject','save','update','then','get','UserWhatsappInteractions','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key'];(function(_0x1334f6,_0x58f249){var _0xd11209=function(_0x37db27){while(--_0x37db27){_0x1334f6['push'](_0x1334f6['shift']());}};_0xd11209(++_0x58f249);}(_0x5e39,0x79));var _0x95e3=function(_0xeeb3a5,_0x461960){_0xeeb3a5=_0xeeb3a5-0x0;var _0x4945eb=_0x5e39[_0xeeb3a5];return _0x4945eb;};'use strict';var pdf=require(_0x95e3('0x0'));var emlformat=require(_0x95e3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x95e3('0x2'));var jsonpatch=require(_0x95e3('0x3'));var rp=require(_0x95e3('0x4'));var moment=require(_0x95e3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x95e3('0x6'));var util=require(_0x95e3('0x7'));var path=require(_0x95e3('0x8'));var sox=require(_0x95e3('0x9'));var csv=require('to-csv');var ejs=require(_0x95e3('0xa'));var fs=require('fs');var _=require(_0x95e3('0xb'));var squel=require(_0x95e3('0xc'));var crypto=require(_0x95e3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x95e3('0xe'));var toCsv=require(_0x95e3('0xf'));var querystring=require(_0x95e3('0x10'));var Papa=require('papaparse');var Redis=require(_0x95e3('0x11'));var authService=require(_0x95e3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x95e3('0x13'));var hardwareService=require(_0x95e3('0x14'));var logger=require('../../config/logger')(_0x95e3('0x15'));var utils=require(_0x95e3('0x16'));var config=require(_0x95e3('0x17'));var licenseUtil=require(_0x95e3('0x18'));var db=require(_0x95e3('0x19'))['db'];function respondWithStatusCode(_0x27eff5,_0x2fff8a){_0x2fff8a=_0x2fff8a||0xcc;return function(_0x11fe25){if(_0x11fe25){return _0x27eff5['sendStatus'](_0x2fff8a);}return _0x27eff5[_0x95e3('0x1a')](_0x2fff8a)['end']();};}function respondWithResult(_0x4f7d27,_0x2c73b3){_0x2c73b3=_0x2c73b3||0xc8;return function(_0x4a0dfc){if(_0x4a0dfc){return _0x4f7d27['status'](_0x2c73b3)['json'](_0x4a0dfc);}};}function respondWithFilteredResult(_0x52dcc8,_0x1f5d6e){return function(_0x13a35d){if(_0x13a35d){var _0xaa1eb4=_0x13a35d[_0x95e3('0x1b')],_0x391ea4=_0x1f5d6e[_0x95e3('0x1c')],_0x355069=_0x1f5d6e[_0x95e3('0x1c')]+_0x1f5d6e[_0x95e3('0x1d')],_0x26091d;if(_0x355069>=_0xaa1eb4){_0x355069=_0xaa1eb4;_0x26091d=0xc8;}else{_0x26091d=0xce;}_0x52dcc8[_0x95e3('0x1a')](_0x26091d);return _0x52dcc8[_0x95e3('0x1e')]('Content-Range',_0x391ea4+'-'+_0x355069+'/'+_0xaa1eb4)[_0x95e3('0x1f')](_0x13a35d);}return null;};}function patchUpdates(_0x2f7aa9){return function(_0x489216){try{jsonpatch['apply'](_0x489216,_0x2f7aa9,!![]);}catch(_0x539e94){return BPromise[_0x95e3('0x20')](_0x539e94);}return _0x489216[_0x95e3('0x21')]();};}function saveUpdates(_0x131f75,_0x14943b){return function(_0x44d662){if(_0x44d662){return _0x44d662[_0x95e3('0x22')](_0x131f75)[_0x95e3('0x23')](function(_0x358788){return _0x358788;});}return null;};}function removeEntity(_0x497824,_0x43e9ce){return function(_0xa540c6){if(_0xa540c6){return _0xa540c6['destroy']()[_0x95e3('0x23')](function(){var _0x2c031a=_0xa540c6[_0x95e3('0x24')]({'plain':!![]});var _0x362e4e=_0x95e3('0x25');return db[_0x95e3('0x26')][_0x95e3('0x27')]({'where':{'type':_0x362e4e,'resourceId':_0x2c031a['id']}})[_0x95e3('0x23')](function(){return _0xa540c6;});})[_0x95e3('0x23')](function(){_0x497824[_0x95e3('0x1a')](0xcc)[_0x95e3('0x28')]();});}};}function handleEntityNotFound(_0x5f1c07,_0x1753f4){return function(_0x2ba531){if(!_0x2ba531){_0x5f1c07[_0x95e3('0x29')](0x194);}return _0x2ba531;};}function handleError(_0x1f116e,_0x5a1a01){_0x5a1a01=_0x5a1a01||0x1f4;return function(_0x11c96f){logger[_0x95e3('0x2a')](_0x11c96f[_0x95e3('0x2b')]);if(_0x11c96f[_0x95e3('0x2c')]){delete _0x11c96f[_0x95e3('0x2c')];}_0x1f116e[_0x95e3('0x1a')](_0x5a1a01)[_0x95e3('0x2d')](_0x11c96f);};}exports[_0x95e3('0x2e')]=function(_0x3fe468,_0x326a15){var _0x54affe={},_0x846d64={},_0x1723f5={'count':0x0,'rows':[]};var _0x198743=_[_0x95e3('0x2f')](db['UserWhatsappInteraction'][_0x95e3('0x30')],function(_0x55c292){return{'name':_0x55c292[_0x95e3('0x31')],'type':_0x55c292['type'][_0x95e3('0x32')]};});_0x846d64[_0x95e3('0x33')]=_[_0x95e3('0x2f')](_0x198743,'name');_0x846d64[_0x95e3('0x34')]=_[_0x95e3('0x35')](_0x3fe468[_0x95e3('0x34')]);_0x846d64['filters']=_[_0x95e3('0x36')](_0x846d64['model'],_0x846d64['query']);_0x54affe[_0x95e3('0x37')]=_['intersection'](_0x846d64[_0x95e3('0x33')],qs[_0x95e3('0x38')](_0x3fe468[_0x95e3('0x34')]['fields']));_0x54affe[_0x95e3('0x37')]=_0x54affe[_0x95e3('0x37')]['length']?_0x54affe[_0x95e3('0x37')]:_0x846d64['model'];if(!_0x3fe468[_0x95e3('0x34')][_0x95e3('0x39')](_0x95e3('0x3a'))){_0x54affe[_0x95e3('0x1d')]=qs[_0x95e3('0x1d')](_0x3fe468[_0x95e3('0x34')][_0x95e3('0x1d')]);_0x54affe['offset']=qs['offset'](_0x3fe468[_0x95e3('0x34')][_0x95e3('0x1c')]);}_0x54affe[_0x95e3('0x3b')]=qs[_0x95e3('0x3c')](_0x3fe468[_0x95e3('0x34')]['sort']);_0x54affe[_0x95e3('0x3d')]=qs[_0x95e3('0x3e')](_[_0x95e3('0x3f')](_0x3fe468[_0x95e3('0x34')],_0x846d64[_0x95e3('0x3e')]),_0x198743);if(_0x3fe468[_0x95e3('0x34')][_0x95e3('0x40')]){_0x54affe[_0x95e3('0x3d')]=_[_0x95e3('0x41')](_0x54affe[_0x95e3('0x3d')],{'$or':_['map'](_0x198743,function(_0x4a5050){if(_0x4a5050[_0x95e3('0x42')]!==_0x95e3('0x43')){var _0x1b95c7={};_0x1b95c7[_0x4a5050['name']]={'$like':'%'+_0x3fe468[_0x95e3('0x34')][_0x95e3('0x40')]+'%'};return _0x1b95c7;}})});}_0x54affe=_[_0x95e3('0x41')]({},_0x54affe,_0x3fe468[_0x95e3('0x44')]);var _0x3b4848={'where':_0x54affe['where']};return db[_0x95e3('0x45')][_0x95e3('0x1b')](_0x3b4848)[_0x95e3('0x23')](function(_0x63cb7e){_0x1723f5['count']=_0x63cb7e;if(_0x3fe468[_0x95e3('0x34')]['includeAll']){_0x54affe[_0x95e3('0x46')]=[{'all':!![]}];}return db[_0x95e3('0x45')][_0x95e3('0x47')](_0x54affe);})[_0x95e3('0x23')](function(_0x5c00ec){_0x1723f5[_0x95e3('0x48')]=_0x5c00ec;return _0x1723f5;})[_0x95e3('0x23')](respondWithFilteredResult(_0x326a15,_0x54affe))[_0x95e3('0x49')](handleError(_0x326a15,null));};exports[_0x95e3('0x4a')]=function(_0x1776f7,_0x2fbfa5){var _0x1ac097={'raw':!![],'where':{'id':_0x1776f7[_0x95e3('0x4b')]['id']}},_0x148396={};_0x148396[_0x95e3('0x33')]=_['keys'](db[_0x95e3('0x45')][_0x95e3('0x30')]);_0x148396[_0x95e3('0x34')]=_[_0x95e3('0x35')](_0x1776f7['query']);_0x148396[_0x95e3('0x3e')]=_[_0x95e3('0x36')](_0x148396[_0x95e3('0x33')],_0x148396[_0x95e3('0x34')]);_0x1ac097[_0x95e3('0x37')]=_[_0x95e3('0x36')](_0x148396[_0x95e3('0x33')],qs[_0x95e3('0x38')](_0x1776f7['query'][_0x95e3('0x38')]));_0x1ac097['attributes']=_0x1ac097['attributes']['length']?_0x1ac097[_0x95e3('0x37')]:_0x148396[_0x95e3('0x33')];if(_0x1776f7[_0x95e3('0x34')][_0x95e3('0x4c')]){_0x1ac097['include']=[{'all':!![]}];}_0x1ac097=_[_0x95e3('0x41')]({},_0x1ac097,_0x1776f7[_0x95e3('0x44')]);return db[_0x95e3('0x45')][_0x95e3('0x4d')](_0x1ac097)[_0x95e3('0x23')](handleEntityNotFound(_0x2fbfa5,null))[_0x95e3('0x23')](respondWithResult(_0x2fbfa5,null))[_0x95e3('0x49')](handleError(_0x2fbfa5,null));};exports[_0x95e3('0x4e')]=function(_0x48b11f,_0x469a00){return db[_0x95e3('0x45')][_0x95e3('0x4e')](_0x48b11f['body'],{})[_0x95e3('0x23')](function(_0x4d104e){var _0x5ce279=_0x48b11f[_0x95e3('0x4f')][_0x95e3('0x24')]({'plain':!![]});if(!_0x5ce279)throw new Error(_0x95e3('0x50'));if(_0x5ce279[_0x95e3('0x51')]===_0x95e3('0x4f')){var _0x355ee2=_0x4d104e[_0x95e3('0x24')]({'plain':!![]});var _0x3fef73=_0x95e3('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x3fef73,'userProfileId':_0x5ce279[_0x95e3('0x52')]},'raw':!![]})['then'](function(_0x115e02){if(_0x115e02&&_0x115e02[_0x95e3('0x53')]===0x0){return db['UserProfileResource'][_0x95e3('0x4e')]({'name':_0x355ee2[_0x95e3('0x2c')],'resourceId':_0x355ee2['id'],'type':_0x115e02[_0x95e3('0x2c')],'sectionId':_0x115e02['id']},{})['then'](function(){return _0x4d104e;});}else{return _0x4d104e;}})[_0x95e3('0x49')](function(_0x123b1e){logger['error'](_0x95e3('0x54'),_0x123b1e);throw _0x123b1e;});}return _0x4d104e;})[_0x95e3('0x23')](respondWithResult(_0x469a00,0xc9))[_0x95e3('0x49')](handleError(_0x469a00,null));};exports[_0x95e3('0x22')]=function(_0x27ec8a,_0xf88eaa){if(_0x27ec8a[_0x95e3('0x55')]['id']){delete _0x27ec8a['body']['id'];}return db[_0x95e3('0x45')][_0x95e3('0x4d')]({'where':{'id':_0x27ec8a[_0x95e3('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf88eaa,null))[_0x95e3('0x23')](saveUpdates(_0x27ec8a[_0x95e3('0x55')],null))[_0x95e3('0x23')](respondWithResult(_0xf88eaa,null))[_0x95e3('0x49')](handleError(_0xf88eaa,null));};exports['destroy']=function(_0x25d431,_0x5a3f56){return db[_0x95e3('0x45')][_0x95e3('0x4d')]({'where':{'id':_0x25d431[_0x95e3('0x4b')]['id']}})[_0x95e3('0x23')](handleEntityNotFound(_0x5a3f56,null))['then'](removeEntity(_0x5a3f56,null))['catch'](handleError(_0x5a3f56,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index f95ab65..68ed886 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 _0xf805=['bluebird','request-promise','rimraf','../../config/environment','./UserWhatsappInteraction.attributes','exports','define','UserWhatsappInteraction','user_has_whatsapp_interactions','lodash','../../config/logger','api'];(function(_0x543c51,_0xff0084){var _0x360555=function(_0x2a0801){while(--_0x2a0801){_0x543c51['push'](_0x543c51['shift']());}};_0x360555(++_0xff0084);}(_0xf805,0x1ad));var _0x5f80=function(_0x459112,_0x3a05f9){_0x459112=_0x459112-0x0;var _0x1b0204=_0xf805[_0x459112];return _0x1b0204;};'use strict';var _=require(_0x5f80('0x0'));var util=require('util');var logger=require(_0x5f80('0x1'))(_0x5f80('0x2'));var moment=require('moment');var BPromise=require(_0x5f80('0x3'));var rp=require(_0x5f80('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f80('0x5'));var config=require(_0x5f80('0x6'));var attributes=require(_0x5f80('0x7'));module[_0x5f80('0x8')]=function(_0x12986d,_0x1113fd){return _0x12986d[_0x5f80('0x9')](_0x5f80('0xa'),attributes,{'tableName':_0x5f80('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x774d=['bluebird','rimraf','../../config/environment','exports','define','UserWhatsappInteraction','lodash','util','../../config/logger','api'];(function(_0x1b4986,_0x1f6fc1){var _0x1e5711=function(_0x2dcea9){while(--_0x2dcea9){_0x1b4986['push'](_0x1b4986['shift']());}};_0x1e5711(++_0x1f6fc1);}(_0x774d,0xd8));var _0xd774=function(_0x2aa5dd,_0x4fc0dc){_0x2aa5dd=_0x2aa5dd-0x0;var _0x16f30e=_0x774d[_0x2aa5dd];return _0x16f30e;};'use strict';var _=require(_0xd774('0x0'));var util=require(_0xd774('0x1'));var logger=require(_0xd774('0x2'))(_0xd774('0x3'));var moment=require('moment');var BPromise=require(_0xd774('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd774('0x5'));var config=require(_0xd774('0x6'));var attributes=require('./UserWhatsappInteraction.attributes');module[_0xd774('0x7')]=function(_0x51c39c,_0x38e832){return _0x51c39c[_0xd774('0x8')](_0xd774('0x9'),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 fc9da5e..af2bf05 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 _0xb7ef=['../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0xb7ef,0x1bf));var _0xfb7e=function(_0x4229bf,_0x111a6a){_0x4229bf=_0x4229bf-0x0;var _0x3ac6ac=_0xb7ef[_0x4229bf];return _0x3ac6ac;};'use strict';var _=require(_0xfb7e('0x0'));var util=require('util');var moment=require(_0xfb7e('0x1'));var BPromise=require(_0xfb7e('0x2'));var rs=require(_0xfb7e('0x3'));var fs=require('fs');var Redis=require(_0xfb7e('0x4'));var db=require(_0xfb7e('0x5'))['db'];var utils=require(_0xfb7e('0x6'));var logger=require(_0xfb7e('0x7'))(_0xfb7e('0x8'));var config=require(_0xfb7e('0x9'));var jayson=require(_0xfb7e('0xa'));var client=jayson[_0xfb7e('0xb')][_0xfb7e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40df92,_0x45874c,_0x31546e){return new BPromise(function(_0x1cc479,_0x5ebc2e){return client[_0xfb7e('0xd')](_0x40df92,_0x31546e)[_0xfb7e('0xe')](function(_0x45b657){logger[_0xfb7e('0xf')](_0xfb7e('0x10'),_0x45874c,_0xfb7e('0x11'));logger[_0xfb7e('0x12')](_0xfb7e('0x13'),_0x45874c,_0xfb7e('0x11'),JSON[_0xfb7e('0x14')](_0x45b657));if(_0x45b657[_0xfb7e('0x15')]){if(_0x45b657[_0xfb7e('0x15')][_0xfb7e('0x16')]===0x1f4){logger[_0xfb7e('0x15')](_0xfb7e('0x10'),_0x45874c,_0x45b657[_0xfb7e('0x15')][_0xfb7e('0x17')]);return _0x5ebc2e(_0x45b657[_0xfb7e('0x15')][_0xfb7e('0x17')]);}logger[_0xfb7e('0x15')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x45874c,_0x45b657[_0xfb7e('0x15')][_0xfb7e('0x17')]);return _0x1cc479(_0x45b657[_0xfb7e('0x15')][_0xfb7e('0x17')]);}else{logger[_0xfb7e('0xf')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x45874c,'request\x20sent');_0x1cc479(_0x45b657['result'][_0xfb7e('0x17')]);}})['catch'](function(_0x5359a0){logger['error'](_0xfb7e('0x10'),_0x45874c,_0x5359a0);_0x5ebc2e(_0x5359a0);});});} \ No newline at end of file +var _0xcf5a=['info','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','UserWhatsappInteraction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x309bde,_0x3ef7f5){var _0x5fa8bc=function(_0x521e70){while(--_0x521e70){_0x309bde['push'](_0x309bde['shift']());}};_0x5fa8bc(++_0x3ef7f5);}(_0xcf5a,0x1ba));var _0xacf5=function(_0x29639f,_0x163f84){_0x29639f=_0x29639f-0x0;var _0x587fa6=_0xcf5a[_0x29639f];return _0x587fa6;};'use strict';var _=require(_0xacf5('0x0'));var util=require(_0xacf5('0x1'));var moment=require(_0xacf5('0x2'));var BPromise=require(_0xacf5('0x3'));var rs=require(_0xacf5('0x4'));var fs=require('fs');var Redis=require(_0xacf5('0x5'));var db=require(_0xacf5('0x6'))['db'];var utils=require(_0xacf5('0x7'));var logger=require('../../config/logger')(_0xacf5('0x8'));var config=require(_0xacf5('0x9'));var jayson=require(_0xacf5('0xa'));var client=jayson[_0xacf5('0xb')][_0xacf5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33e777,_0x5ab66e,_0x312e90){return new BPromise(function(_0x3b5a66,_0x38c596){return client['request'](_0x33e777,_0x312e90)[_0xacf5('0xd')](function(_0x1ff7ea){logger[_0xacf5('0xe')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x5ab66e,_0xacf5('0xf'));logger[_0xacf5('0x10')](_0xacf5('0x11'),_0x5ab66e,'request\x20sent',JSON[_0xacf5('0x12')](_0x1ff7ea));if(_0x1ff7ea[_0xacf5('0x13')]){if(_0x1ff7ea[_0xacf5('0x13')]['code']===0x1f4){logger[_0xacf5('0x13')](_0xacf5('0x14'),_0x5ab66e,_0x1ff7ea['error'][_0xacf5('0x15')]);return _0x38c596(_0x1ff7ea['error'][_0xacf5('0x15')]);}logger['error']('UserWhatsappInteraction,\x20%s,\x20%s',_0x5ab66e,_0x1ff7ea[_0xacf5('0x13')][_0xacf5('0x15')]);return _0x3b5a66(_0x1ff7ea[_0xacf5('0x13')][_0xacf5('0x15')]);}else{logger['info']('UserWhatsappInteraction,\x20%s,\x20%s',_0x5ab66e,'request\x20sent');_0x3b5a66(_0x1ff7ea[_0xacf5('0x16')][_0xacf5('0x15')]);}})[_0xacf5('0x17')](function(_0x23996){logger[_0xacf5('0x13')](_0xacf5('0x14'),_0x5ab66e,_0x23996);_0x38c596(_0x23996);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index b41f5b0..16b0cfd 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 _0x2f38=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x316af7,_0x72e80c){var _0x286d96=function(_0x1c1d7b){while(--_0x1c1d7b){_0x316af7['push'](_0x316af7['shift']());}};_0x286d96(++_0x72e80c);}(_0x2f38,0x1a7));var _0x82f3=function(_0xd6fafb,_0x3e2d5a){_0xd6fafb=_0xd6fafb-0x0;var _0x2c4bb9=_0x2f38[_0xd6fafb];return _0x2c4bb9;};'use strict';var multer=require('multer');var util=require(_0x82f3('0x0'));var path=require('path');var timeout=require(_0x82f3('0x1'));var express=require(_0x82f3('0x2'));var router=express[_0x82f3('0x3')]();var auth=require(_0x82f3('0x4'));var interaction=require(_0x82f3('0x5'));var config=require(_0x82f3('0x6'));var controller=require('./UserWhatsappInteraction.controller');router[_0x82f3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x82f3('0x7')](_0x82f3('0x8'),auth[_0x82f3('0x9')](),controller[_0x82f3('0xa')]);router[_0x82f3('0xb')]('/',auth[_0x82f3('0x9')](),controller[_0x82f3('0xc')]);router[_0x82f3('0xd')](_0x82f3('0x8'),auth[_0x82f3('0x9')](),controller[_0x82f3('0xe')]);router[_0x82f3('0xf')](_0x82f3('0x8'),auth['isAuthenticated'](),controller[_0x82f3('0x10')]);module[_0x82f3('0x11')]=router; \ No newline at end of file +var _0xa664=['destroy','exports','util','path','connect-timeout','express','../../components/auth/service','./UserWhatsappInteraction.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x3fba41,_0x39825c){var _0x12e6a2=function(_0x5dda68){while(--_0x5dda68){_0x3fba41['push'](_0x3fba41['shift']());}};_0x12e6a2(++_0x39825c);}(_0xa664,0x132));var _0x4a66=function(_0x48417e,_0x293db3){_0x48417e=_0x48417e-0x0;var _0x3f9c3f=_0xa664[_0x48417e];return _0x3f9c3f;};'use strict';var multer=require('multer');var util=require(_0x4a66('0x0'));var path=require(_0x4a66('0x1'));var timeout=require(_0x4a66('0x2'));var express=require(_0x4a66('0x3'));var router=express['Router']();var auth=require(_0x4a66('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4a66('0x5'));router[_0x4a66('0x6')]('/',auth[_0x4a66('0x7')](),controller[_0x4a66('0x8')]);router[_0x4a66('0x6')](_0x4a66('0x9'),auth[_0x4a66('0x7')](),controller['show']);router[_0x4a66('0xa')]('/',auth[_0x4a66('0x7')](),controller[_0x4a66('0xb')]);router[_0x4a66('0xc')]('/:id',auth[_0x4a66('0x7')](),controller[_0x4a66('0xd')]);router['delete'](_0x4a66('0x9'),auth[_0x4a66('0x7')](),controller[_0x4a66('0xe')]);module[_0x4a66('0xf')]=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 1512947..7d37f98 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 _0x2560=['contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x246926,_0x4a3811){var _0x35f007=function(_0x38ae4d){while(--_0x38ae4d){_0x246926['push'](_0x246926['shift']());}};_0x35f007(++_0x4a3811);}(_0x2560,0x104));var _0x0256=function(_0xd42c9,_0x21182c){_0xd42c9=_0xd42c9-0x0;var _0x1b47b6=_0x2560[_0xd42c9];return _0x1b47b6;};'use strict';var Sequelize=require(_0x0256('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4ab441){return this[_0x0256('0x1')](_0x0256('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x0256('0x3'),_0x0256('0x4'),_0x0256('0x5'),_0x0256('0x6'),_0x0256('0x7'),'browser','bot',_0x0256('0x8')]],'msg':_0x0256('0x9')}},'comment':_0x0256('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x0256('0xa')},'data2':{'type':Sequelize[_0x0256('0xb')](0x1000),'comment':_0x0256('0xc')},'data3':{'type':Sequelize[_0x0256('0xb')](0x1000),'comment':_0x0256('0xd')},'data4':{'type':Sequelize[_0x0256('0xb')](0x1000)},'data5':{'type':Sequelize[_0x0256('0xb')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x0256('0xe')]}}; \ No newline at end of file +var _0x8176=['motionbar','jscripty','urlForward','browser','bot','script','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','sequelize','VIRTUAL','getDataValue','action','contactManager'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x8176,0x127));var _0x6817=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x8176[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x6817('0x0'));module['exports']={'name':{'type':Sequelize[_0x6817('0x1')],'get':function(_0xf0fe39){return this[_0x6817('0x2')](_0x6817('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x6817('0x4'),'integration',_0x6817('0x5'),_0x6817('0x6'),_0x6817('0x7'),_0x6817('0x8'),_0x6817('0x9'),_0x6817('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x6817('0xb')](0x1000),'comment':_0x6817('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x6817('0xd')},'data3':{'type':Sequelize[_0x6817('0xb')](0x1000),'comment':_0x6817('0xe')},'data4':{'type':Sequelize[_0x6817('0xb')](0x1000)},'data5':{'type':Sequelize[_0x6817('0xb')](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 fb0201f..d4fd953 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 _0xd991=['ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','set','Content-Range','json','save','update','destroy','then','error','stack','name','send','body','Action','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x10bae6,_0x41d85f){var _0x251123=function(_0x548886){while(--_0x548886){_0x10bae6['push'](_0x10bae6['shift']());}};_0x251123(++_0x41d85f);}(_0xd991,0x115));var _0x1d99=function(_0x993da8,_0xde6b51){_0x993da8=_0x993da8-0x0;var _0x4bd239=_0xd991[_0x993da8];return _0x4bd239;};'use strict';var pdf=require(_0x1d99('0x0'));var emlformat=require(_0x1d99('0x1'));var rimraf=require(_0x1d99('0x2'));var zipdir=require(_0x1d99('0x3'));var jsonpatch=require(_0x1d99('0x4'));var rp=require('request-promise');var moment=require(_0x1d99('0x5'));var BPromise=require(_0x1d99('0x6'));var Mustache=require(_0x1d99('0x7'));var util=require(_0x1d99('0x8'));var path=require(_0x1d99('0x9'));var sox=require(_0x1d99('0xa'));var csv=require('to-csv');var ejs=require(_0x1d99('0xb'));var fs=require('fs');var _=require(_0x1d99('0xc'));var squel=require('squel');var crypto=require(_0x1d99('0xd'));var jsforce=require(_0x1d99('0xe'));var deskjs=require(_0x1d99('0xf'));var toCsv=require(_0x1d99('0x10'));var querystring=require(_0x1d99('0x11'));var Papa=require(_0x1d99('0x12'));var Redis=require(_0x1d99('0x13'));var authService=require(_0x1d99('0x14'));var qs=require(_0x1d99('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d99('0x16'));var logger=require(_0x1d99('0x17'))('api');var utils=require(_0x1d99('0x18'));var config=require(_0x1d99('0x19'));var licenseUtil=require(_0x1d99('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x442843,_0xf7b799){_0xf7b799=_0xf7b799||0xcc;return function(_0x3c87e3){if(_0x3c87e3){return _0x442843[_0x1d99('0x1b')](_0xf7b799);}return _0x442843[_0x1d99('0x1c')](_0xf7b799)[_0x1d99('0x1d')]();};}function respondWithResult(_0x5f57a8,_0x35dd66){_0x35dd66=_0x35dd66||0xc8;return function(_0x5ad75d){if(_0x5ad75d){return _0x5f57a8[_0x1d99('0x1c')](_0x35dd66)['json'](_0x5ad75d);}};}function respondWithFilteredResult(_0x2f8738,_0x1b2c78){return function(_0x3ac89a){if(_0x3ac89a){var _0x8903f2=_0x3ac89a[_0x1d99('0x1e')],_0x17fb2a=_0x1b2c78['offset'],_0x1ebeda=_0x1b2c78[_0x1d99('0x1f')]+_0x1b2c78['limit'],_0x8cf8b8;if(_0x1ebeda>=_0x8903f2){_0x1ebeda=_0x8903f2;_0x8cf8b8=0xc8;}else{_0x8cf8b8=0xce;}_0x2f8738[_0x1d99('0x1c')](_0x8cf8b8);return _0x2f8738[_0x1d99('0x20')](_0x1d99('0x21'),_0x17fb2a+'-'+_0x1ebeda+'/'+_0x8903f2)[_0x1d99('0x22')](_0x3ac89a);}return null;};}function patchUpdates(_0x209af7){return function(_0x5044a7){try{jsonpatch['apply'](_0x5044a7,_0x209af7,!![]);}catch(_0x4a725c){return BPromise['reject'](_0x4a725c);}return _0x5044a7[_0x1d99('0x23')]();};}function saveUpdates(_0x20af77,_0x234b4b){return function(_0x374780){if(_0x374780){return _0x374780[_0x1d99('0x24')](_0x20af77)['then'](function(_0x4599c9){return _0x4599c9;});}return null;};}function removeEntity(_0x2e6c35,_0x4a72ac){return function(_0x25bd22){if(_0x25bd22){return _0x25bd22[_0x1d99('0x25')]()[_0x1d99('0x26')](function(){_0x2e6c35[_0x1d99('0x1c')](0xcc)[_0x1d99('0x1d')]();});}};}function handleEntityNotFound(_0x8273bb,_0x54a295){return function(_0x8318c3){if(!_0x8318c3){_0x8273bb[_0x1d99('0x1b')](0x194);}return _0x8318c3;};}function handleError(_0x489d3f,_0x18899c){_0x18899c=_0x18899c||0x1f4;return function(_0x31e70e){logger[_0x1d99('0x27')](_0x31e70e[_0x1d99('0x28')]);if(_0x31e70e['name']){delete _0x31e70e[_0x1d99('0x29')];}_0x489d3f['status'](_0x18899c)[_0x1d99('0x2a')](_0x31e70e);};}exports[_0x1d99('0x24')]=function(_0x38b8d9,_0x3f630a){if(_0x38b8d9['body']['id']){delete _0x38b8d9[_0x1d99('0x2b')]['id'];}return db[_0x1d99('0x2c')][_0x1d99('0x2d')]({'where':{'id':_0x38b8d9[_0x1d99('0x2e')]['id']}})[_0x1d99('0x26')](handleEntityNotFound(_0x3f630a,null))[_0x1d99('0x26')](saveUpdates(_0x38b8d9['body'],null))[_0x1d99('0x26')](respondWithResult(_0x3f630a,null))[_0x1d99('0x2f')](handleError(_0x3f630a,null));};exports[_0x1d99('0x25')]=function(_0x331e2b,_0x34308d){return db['Action'][_0x1d99('0x2d')]({'where':{'id':_0x331e2b[_0x1d99('0x2e')]['id']}})[_0x1d99('0x26')](handleEntityNotFound(_0x34308d,null))[_0x1d99('0x26')](removeEntity(_0x34308d,null))[_0x1d99('0x2f')](handleError(_0x34308d,null));}; \ No newline at end of file +var _0x2e65=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','body','find','params','catch','Action','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x2e65,0x193));var _0x52e6=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x2e65[_0x2601b4];return _0x3e3661;};'use strict';var pdf=require(_0x52e6('0x0'));var emlformat=require(_0x52e6('0x1'));var rimraf=require(_0x52e6('0x2'));var zipdir=require(_0x52e6('0x3'));var jsonpatch=require(_0x52e6('0x4'));var rp=require(_0x52e6('0x5'));var moment=require(_0x52e6('0x6'));var BPromise=require(_0x52e6('0x7'));var Mustache=require('mustache');var util=require(_0x52e6('0x8'));var path=require(_0x52e6('0x9'));var sox=require(_0x52e6('0xa'));var csv=require(_0x52e6('0xb'));var ejs=require(_0x52e6('0xc'));var fs=require('fs');var _=require(_0x52e6('0xd'));var squel=require(_0x52e6('0xe'));var crypto=require(_0x52e6('0xf'));var jsforce=require(_0x52e6('0x10'));var deskjs=require(_0x52e6('0x11'));var toCsv=require('to-csv');var querystring=require(_0x52e6('0x12'));var Papa=require(_0x52e6('0x13'));var Redis=require('ioredis');var authService=require(_0x52e6('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52e6('0x15'));var logger=require(_0x52e6('0x16'))(_0x52e6('0x17'));var utils=require(_0x52e6('0x18'));var config=require(_0x52e6('0x19'));var licenseUtil=require(_0x52e6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c2e3b,_0xca75f1){_0xca75f1=_0xca75f1||0xcc;return function(_0x7ddb07){if(_0x7ddb07){return _0x5c2e3b['sendStatus'](_0xca75f1);}return _0x5c2e3b[_0x52e6('0x1b')](_0xca75f1)[_0x52e6('0x1c')]();};}function respondWithResult(_0x4362e3,_0x32035b){_0x32035b=_0x32035b||0xc8;return function(_0x3c80c1){if(_0x3c80c1){return _0x4362e3[_0x52e6('0x1b')](_0x32035b)[_0x52e6('0x1d')](_0x3c80c1);}};}function respondWithFilteredResult(_0x215a30,_0x109057){return function(_0x38fd03){if(_0x38fd03){var _0x30ef30=_0x38fd03['count'],_0x338a34=_0x109057[_0x52e6('0x1e')],_0x44fc06=_0x109057['offset']+_0x109057['limit'],_0x5c275c;if(_0x44fc06>=_0x30ef30){_0x44fc06=_0x30ef30;_0x5c275c=0xc8;}else{_0x5c275c=0xce;}_0x215a30[_0x52e6('0x1b')](_0x5c275c);return _0x215a30[_0x52e6('0x1f')](_0x52e6('0x20'),_0x338a34+'-'+_0x44fc06+'/'+_0x30ef30)['json'](_0x38fd03);}return null;};}function patchUpdates(_0x2954ce){return function(_0x5aa4f6){try{jsonpatch[_0x52e6('0x21')](_0x5aa4f6,_0x2954ce,!![]);}catch(_0x2a07ea){return BPromise[_0x52e6('0x22')](_0x2a07ea);}return _0x5aa4f6['save']();};}function saveUpdates(_0xf2df3,_0x54ee91){return function(_0x2bac89){if(_0x2bac89){return _0x2bac89[_0x52e6('0x23')](_0xf2df3)[_0x52e6('0x24')](function(_0x5f5c22){return _0x5f5c22;});}return null;};}function removeEntity(_0x17a803,_0x994901){return function(_0x5f004e){if(_0x5f004e){return _0x5f004e['destroy']()['then'](function(){_0x17a803[_0x52e6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37a59c,_0x16bfe5){return function(_0x12fdb7){if(!_0x12fdb7){_0x37a59c[_0x52e6('0x25')](0x194);}return _0x12fdb7;};}function handleError(_0x73e1f9,_0x597060){_0x597060=_0x597060||0x1f4;return function(_0x2d5087){logger['error'](_0x2d5087[_0x52e6('0x26')]);if(_0x2d5087[_0x52e6('0x27')]){delete _0x2d5087[_0x52e6('0x27')];}_0x73e1f9[_0x52e6('0x1b')](_0x597060)[_0x52e6('0x28')](_0x2d5087);};}exports[_0x52e6('0x23')]=function(_0x408b8e,_0x2fbff0){if(_0x408b8e[_0x52e6('0x29')]['id']){delete _0x408b8e[_0x52e6('0x29')]['id'];}return db['Action'][_0x52e6('0x2a')]({'where':{'id':_0x408b8e[_0x52e6('0x2b')]['id']}})[_0x52e6('0x24')](handleEntityNotFound(_0x2fbff0,null))[_0x52e6('0x24')](saveUpdates(_0x408b8e[_0x52e6('0x29')],null))[_0x52e6('0x24')](respondWithResult(_0x2fbff0,null))[_0x52e6('0x2c')](handleError(_0x2fbff0,null));};exports['destroy']=function(_0x4a80ca,_0x241cf5){return db[_0x52e6('0x2d')][_0x52e6('0x2a')]({'where':{'id':_0x4a80ca[_0x52e6('0x2b')]['id']}})[_0x52e6('0x24')](handleEntityNotFound(_0x241cf5,null))['then'](removeEntity(_0x241cf5,null))['catch'](handleError(_0x241cf5,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 3e03978..6ed76be 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 _0xc4a8=['exports','define','Action','tools_actions','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x11f41f,_0x10a028){var _0xf84e69=function(_0x10d462){while(--_0x10d462){_0x11f41f['push'](_0x11f41f['shift']());}};_0xf84e69(++_0x10a028);}(_0xc4a8,0x7c));var _0x8c4a=function(_0x22de9a,_0x2046ba){_0x22de9a=_0x22de9a-0x0;var _0x4ac799=_0xc4a8[_0x22de9a];return _0x4ac799;};'use strict';var _=require('lodash');var util=require(_0x8c4a('0x0'));var logger=require(_0x8c4a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8c4a('0x2'));var rp=require(_0x8c4a('0x3'));var fs=require('fs');var path=require(_0x8c4a('0x4'));var rimraf=require(_0x8c4a('0x5'));var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0x8c4a('0x6')]=function(_0x2db85c,_0x5c681){return _0x2db85c[_0x8c4a('0x7')](_0x8c4a('0x8'),attributes,{'tableName':_0x8c4a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88fa=['path','rimraf','../../config/environment','exports','define','Action','tools_actions','util','../../config/logger','api','moment','bluebird'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0x88fa,0x16f));var _0xa88f=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0x88fa[_0x367336];return _0x3423a7;};'use strict';var _=require('lodash');var util=require(_0xa88f('0x0'));var logger=require(_0xa88f('0x1'))(_0xa88f('0x2'));var moment=require(_0xa88f('0x3'));var BPromise=require(_0xa88f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa88f('0x5'));var rimraf=require(_0xa88f('0x6'));var config=require(_0xa88f('0x7'));var attributes=require('./action.attributes');module[_0xa88f('0x8')]=function(_0x2541cc,_0x53a1bb){return _0x2541cc[_0xa88f('0x9')](_0xa88f('0xa'),attributes,{'tableName':_0xa88f('0xb'),'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 16dd160..fe23ed0 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 _0x70e0=['code','Action,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4d4df1,_0x3d5fa5){var _0x14a61d=function(_0x8928d4){while(--_0x8928d4){_0x4d4df1['push'](_0x4d4df1['shift']());}};_0x14a61d(++_0x3d5fa5);}(_0x70e0,0x17b));var _0x070e=function(_0x4a1f8d,_0x2ce6a3){_0x4a1f8d=_0x4a1f8d-0x0;var _0x51bb99=_0x70e0[_0x4a1f8d];return _0x51bb99;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Action,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Action,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x88b2af,_0x361f9c){var _0x53deb6=function(_0xe29bff){while(--_0xe29bff){_0x88b2af['push'](_0x88b2af['shift']());}};_0x53deb6(++_0x361f9c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xb7e7[_0x369151];return _0x4292d5;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index a909aa4..b1c5b1c 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 _0x54f2=['../../components/auth/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0xe0a439,_0x29f62a){var _0x262100=function(_0x84a8a8){while(--_0x84a8a8){_0xe0a439['push'](_0xe0a439['shift']());}};_0x262100(++_0x29f62a);}(_0x54f2,0xe9));var _0x254f=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x54f2[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0x254f('0x0'));var util=require(_0x254f('0x1'));var path=require(_0x254f('0x2'));var timeout=require(_0x254f('0x3'));var express=require('express');var router=express[_0x254f('0x4')]();var auth=require(_0x254f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x254f('0x6'));var controller=require(_0x254f('0x7'));router[_0x254f('0x8')]('/:id',auth[_0x254f('0x9')](),controller[_0x254f('0xa')]);router[_0x254f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x254f('0xc')]);module[_0x254f('0xd')]=router; \ No newline at end of file +var _0xe185=['isAuthenticated','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./action.controller','put','/:id','update','delete'];(function(_0x8a0401,_0x5cc60e){var _0x32f72a=function(_0x5d4017){while(--_0x5d4017){_0x8a0401['push'](_0x8a0401['shift']());}};_0x32f72a(++_0x5cc60e);}(_0xe185,0x179));var _0x5e18=function(_0x48eed6,_0x58a3d5){_0x48eed6=_0x48eed6-0x0;var _0x3d130d=_0xe185[_0x48eed6];return _0x3d130d;};'use strict';var multer=require(_0x5e18('0x0'));var util=require(_0x5e18('0x1'));var path=require(_0x5e18('0x2'));var timeout=require(_0x5e18('0x3'));var express=require(_0x5e18('0x4'));var router=express[_0x5e18('0x5')]();var auth=require(_0x5e18('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5e18('0x7'));var controller=require(_0x5e18('0x8'));router[_0x5e18('0x9')](_0x5e18('0xa'),auth['isAuthenticated'](),controller[_0x5e18('0xb')]);router[_0x5e18('0xc')](_0x5e18('0xa'),auth[_0x5e18('0xd')](),controller[_0x5e18('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 98a45d0..f7a34d9 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 _0x0114=['TEXT','exports','STRING'];(function(_0x144b2b,_0x2a0b0f){var _0x599c5a=function(_0x1da07a){while(--_0x1da07a){_0x144b2b['push'](_0x144b2b['shift']());}};_0x599c5a(++_0x2a0b0f);}(_0x0114,0x154));var _0x4011=function(_0x496f56,_0x7215b6){_0x496f56=_0x496f56-0x0;var _0x20b5b5=_0x0114[_0x496f56];return _0x20b5b5;};'use strict';var Sequelize=require('sequelize');module[_0x4011('0x0')]={'name':{'type':Sequelize[_0x4011('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4011('0x1')]},'parent':{'type':Sequelize[_0x4011('0x1')]},'table':{'type':Sequelize[_0x4011('0x1')]},'conditions':{'type':Sequelize[_0x4011('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5c17=['STRING','TEXT','exports'];(function(_0x456f45,_0x1c53a5){var _0x2ddc34=function(_0x5d42c5){while(--_0x5d42c5){_0x456f45['push'](_0x456f45['shift']());}};_0x2ddc34(++_0x1c53a5);}(_0x5c17,0x14c));var _0x75c1=function(_0xf6c707,_0x25c032){_0xf6c707=_0xf6c707-0x0;var _0x532bdc=_0x5c17[_0xf6c707];return _0x532bdc;};'use strict';var Sequelize=require('sequelize');module[_0x75c1('0x0')]={'name':{'type':Sequelize[_0x75c1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x75c1('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x75c1('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x75c1('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b8fac16..10b9e13 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 _0xfcbb=['fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','keys','fields','create','body','role','Reports','find','autoAssociation','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','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','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','cross_join','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','Sequelize','parentKey','%s.%s\x20=\x20%s.%s','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','savename','from','COUNT(*)','QueryTypes','run','params','runReport','metric','order','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','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/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xfcbb,0x10d));var _0xbfcb=function(_0xf9b2a5,_0x4987f7){_0xf9b2a5=_0xf9b2a5-0x0;var _0x2ec89d=_0xfcbb[_0xf9b2a5];return _0x2ec89d;};'use strict';var pdf=require(_0xbfcb('0x0'));var emlformat=require(_0xbfcb('0x1'));var rimraf=require(_0xbfcb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbfcb('0x3'));var moment=require(_0xbfcb('0x4'));var BPromise=require(_0xbfcb('0x5'));var Mustache=require(_0xbfcb('0x6'));var util=require(_0xbfcb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xbfcb('0x8'));var ejs=require(_0xbfcb('0x9'));var fs=require('fs');var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbfcb('0x18'));var db=require(_0xbfcb('0x19'))['db'];var dbH=require(_0xbfcb('0x19'))[_0xbfcb('0x1a')];function respondWithStatusCode(_0x4ba4f1,_0x3dc54a){_0x3dc54a=_0x3dc54a||0xcc;return function(_0x53eeaf){if(_0x53eeaf){return _0x4ba4f1[_0xbfcb('0x1b')](_0x3dc54a);}return _0x4ba4f1[_0xbfcb('0x1c')](_0x3dc54a)[_0xbfcb('0x1d')]();};}function respondWithResult(_0x1047c4,_0x2074d4){_0x2074d4=_0x2074d4||0xc8;return function(_0xe47707){if(_0xe47707){return _0x1047c4[_0xbfcb('0x1c')](_0x2074d4)[_0xbfcb('0x1e')](_0xe47707);}};}function respondWithFilteredResult(_0x90ed8c,_0x339347){return function(_0x2c4a85){if(_0x2c4a85){var _0x3f847f=_0x2c4a85[_0xbfcb('0x1f')],_0x26f335=_0x339347[_0xbfcb('0x20')],_0x41dc15=_0x339347[_0xbfcb('0x20')]+_0x339347[_0xbfcb('0x21')],_0x318d07;if(_0x41dc15>=_0x3f847f){_0x41dc15=_0x3f847f;_0x318d07=0xc8;}else{_0x318d07=0xce;}_0x90ed8c[_0xbfcb('0x1c')](_0x318d07);return _0x90ed8c[_0xbfcb('0x22')](_0xbfcb('0x23'),_0x26f335+'-'+_0x41dc15+'/'+_0x3f847f)['json'](_0x2c4a85);}return null;};}function patchUpdates(_0x26451d){return function(_0x37263b){try{jsonpatch['apply'](_0x37263b,_0x26451d,!![]);}catch(_0xa3c089){return BPromise[_0xbfcb('0x24')](_0xa3c089);}return _0x37263b['save']();};}function saveUpdates(_0x58f16b,_0x4199c5){return function(_0x45f0a0){if(_0x45f0a0){return _0x45f0a0[_0xbfcb('0x25')](_0x58f16b)[_0xbfcb('0x26')](function(_0x1c5924){return _0x1c5924;});}return null;};}function removeEntity(_0x56c158,_0x365d6c){return function(_0x423bba){if(_0x423bba){return _0x423bba[_0xbfcb('0x27')]()[_0xbfcb('0x26')](function(){var _0x1651e5=_0x423bba[_0xbfcb('0x28')]({'plain':!![]});var _0x69c8e9=_0xbfcb('0x29');return db[_0xbfcb('0x2a')][_0xbfcb('0x27')]({'where':{'type':_0x69c8e9,'resourceId':_0x1651e5['id']}})[_0xbfcb('0x26')](function(){return _0x423bba;});})[_0xbfcb('0x26')](function(){_0x56c158[_0xbfcb('0x1c')](0xcc)[_0xbfcb('0x1d')]();});}};}function handleEntityNotFound(_0x3e954d,_0x2a1272){return function(_0x5cd703){if(!_0x5cd703){_0x3e954d[_0xbfcb('0x1b')](0x194);}return _0x5cd703;};}function handleError(_0x2881f8,_0x4cf7ca){_0x4cf7ca=_0x4cf7ca||0x1f4;return function(_0x64a69){logger[_0xbfcb('0x2b')](_0x64a69[_0xbfcb('0x2c')]);if(_0x64a69[_0xbfcb('0x2d')]){delete _0x64a69[_0xbfcb('0x2d')];}_0x2881f8[_0xbfcb('0x1c')](_0x4cf7ca)[_0xbfcb('0x2e')](_0x64a69);};}exports[_0xbfcb('0x2f')]=function(_0x434764,_0x27606f){var _0x59719b={},_0x17cd0e={},_0x3aa3cd={'count':0x0,'rows':[]};var _0x43c3c3=_[_0xbfcb('0x30')](db[_0xbfcb('0x31')][_0xbfcb('0x32')],function(_0x286fb7){return{'name':_0x286fb7[_0xbfcb('0x33')],'type':_0x286fb7[_0xbfcb('0x34')]['key']};});_0x17cd0e[_0xbfcb('0x35')]=_[_0xbfcb('0x30')](_0x43c3c3,_0xbfcb('0x2d'));_0x17cd0e[_0xbfcb('0x36')]=_['keys'](_0x434764['query']);_0x17cd0e[_0xbfcb('0x37')]=_[_0xbfcb('0x38')](_0x17cd0e[_0xbfcb('0x35')],_0x17cd0e[_0xbfcb('0x36')]);_0x59719b[_0xbfcb('0x39')]=_[_0xbfcb('0x38')](_0x17cd0e[_0xbfcb('0x35')],qs['fields'](_0x434764['query']['fields']));_0x59719b[_0xbfcb('0x39')]=_0x59719b['attributes'][_0xbfcb('0x3a')]?_0x59719b[_0xbfcb('0x39')]:_0x17cd0e['model'];if(!_0x434764['query'][_0xbfcb('0x3b')](_0xbfcb('0x3c'))){_0x59719b[_0xbfcb('0x21')]=qs[_0xbfcb('0x21')](_0x434764['query'][_0xbfcb('0x21')]);_0x59719b[_0xbfcb('0x20')]=qs['offset'](_0x434764['query'][_0xbfcb('0x20')]);}_0x59719b['order']=qs['sort'](_0x434764[_0xbfcb('0x36')][_0xbfcb('0x3d')]);_0x59719b[_0xbfcb('0x3e')]=qs[_0xbfcb('0x37')](_['pick'](_0x434764[_0xbfcb('0x36')],_0x17cd0e[_0xbfcb('0x37')]),_0x43c3c3);if(_0x434764[_0xbfcb('0x36')][_0xbfcb('0x3f')]){_0x59719b[_0xbfcb('0x3e')]=_[_0xbfcb('0x40')](_0x59719b['where'],{'$or':_[_0xbfcb('0x30')](_0x43c3c3,function(_0x4d53fd){if(_0x4d53fd[_0xbfcb('0x34')]!=='VIRTUAL'){var _0x809fde={};_0x809fde[_0x4d53fd[_0xbfcb('0x2d')]]={'$like':'%'+_0x434764[_0xbfcb('0x36')][_0xbfcb('0x3f')]+'%'};return _0x809fde;}})});}_0x59719b=_[_0xbfcb('0x40')]({},_0x59719b,_0x434764[_0xbfcb('0x41')]);var _0x453714={'where':_0x59719b[_0xbfcb('0x3e')]};return db[_0xbfcb('0x31')][_0xbfcb('0x1f')](_0x453714)['then'](function(_0x2be840){_0x3aa3cd[_0xbfcb('0x1f')]=_0x2be840;if(_0x434764['query'][_0xbfcb('0x42')]){_0x59719b[_0xbfcb('0x43')]=[{'all':!![]}];}return db[_0xbfcb('0x31')][_0xbfcb('0x44')](_0x59719b);})[_0xbfcb('0x26')](function(_0x205ca3){_0x3aa3cd['rows']=_0x205ca3;return _0x3aa3cd;})[_0xbfcb('0x26')](respondWithFilteredResult(_0x27606f,_0x59719b))[_0xbfcb('0x45')](handleError(_0x27606f,null));};exports[_0xbfcb('0x46')]=function(_0x4a28f2,_0x26b3fd){var _0x21c73f={'raw':![],'where':{'id':_0x4a28f2['params']['id']}},_0xa37d7f={};_0xa37d7f[_0xbfcb('0x35')]=_[_0xbfcb('0x47')](db['AnalyticCustomReport']['rawAttributes']);_0xa37d7f[_0xbfcb('0x36')]=_[_0xbfcb('0x47')](_0x4a28f2['query']);_0xa37d7f[_0xbfcb('0x37')]=_[_0xbfcb('0x38')](_0xa37d7f['model'],_0xa37d7f[_0xbfcb('0x36')]);_0x21c73f[_0xbfcb('0x39')]=_[_0xbfcb('0x38')](_0xa37d7f[_0xbfcb('0x35')],qs[_0xbfcb('0x48')](_0x4a28f2[_0xbfcb('0x36')][_0xbfcb('0x48')]));_0x21c73f[_0xbfcb('0x39')]=_0x21c73f[_0xbfcb('0x39')][_0xbfcb('0x3a')]?_0x21c73f[_0xbfcb('0x39')]:_0xa37d7f[_0xbfcb('0x35')];if(_0x4a28f2['query'][_0xbfcb('0x42')]){_0x21c73f[_0xbfcb('0x43')]=[{'all':!![]}];}_0x21c73f=_[_0xbfcb('0x40')]({},_0x21c73f,_0x4a28f2['options']);return db[_0xbfcb('0x31')]['find'](_0x21c73f)['then'](handleEntityNotFound(_0x26b3fd,null))[_0xbfcb('0x26')](respondWithResult(_0x26b3fd,null))[_0xbfcb('0x45')](handleError(_0x26b3fd,null));};exports[_0xbfcb('0x49')]=function(_0x4d1de5,_0x40f9d9){return db['AnalyticCustomReport']['create'](_0x4d1de5[_0xbfcb('0x4a')],{})['then'](function(_0x3433ac){var _0x7afcba=_0x4d1de5['user'][_0xbfcb('0x28')]({'plain':!![]});if(!_0x7afcba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7afcba[_0xbfcb('0x4b')]==='user'){var _0x61b146=_0x3433ac['get']({'plain':!![]});var _0x238d74=_0xbfcb('0x4c');return db['UserProfileSection'][_0xbfcb('0x4d')]({'where':{'name':_0x238d74,'userProfileId':_0x7afcba['userProfileId']},'raw':!![]})['then'](function(_0x3b8683){if(_0x3b8683&&_0x3b8683[_0xbfcb('0x4e')]===0x0){return db[_0xbfcb('0x2a')]['create']({'name':_0x61b146['name'],'resourceId':_0x61b146['id'],'type':_0xbfcb('0x29'),'sectionId':_0x3b8683['id']},{})[_0xbfcb('0x26')](function(){return _0x3433ac;});}else{return _0x3433ac;}})[_0xbfcb('0x45')](function(_0x3d502e){logger[_0xbfcb('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d502e);throw _0x3d502e;});}return _0x3433ac;})[_0xbfcb('0x26')](respondWithResult(_0x40f9d9,0xc9))[_0xbfcb('0x45')](handleError(_0x40f9d9,null));};exports[_0xbfcb('0x25')]=function(_0x225c45,_0x4d1264){if(_0x225c45['body']['id']){delete _0x225c45[_0xbfcb('0x4a')]['id'];}return db['AnalyticCustomReport'][_0xbfcb('0x4d')]({'where':{'id':_0x225c45['params']['id']}})['then'](handleEntityNotFound(_0x4d1264,null))[_0xbfcb('0x26')](saveUpdates(_0x225c45['body'],null))['then'](respondWithResult(_0x4d1264,null))[_0xbfcb('0x45')](handleError(_0x4d1264,null));};exports['destroy']=function(_0x216a2a,_0x533b69){return db[_0xbfcb('0x31')][_0xbfcb('0x4d')]({'where':{'id':_0x216a2a['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x533b69,null))[_0xbfcb('0x26')](removeEntity(_0x533b69,null))[_0xbfcb('0x45')](handleError(_0x533b69,null));};exports['preview']=function(_0x3cd568,_0xc44640){var _0x2534fe=0xa;var _0x4311d9=[_0xbfcb('0x4f'),_0xbfcb('0x50'),_0xbfcb('0x51'),'cross_join'];var _0x9c9b13={'SUM':'SUM(%s)','COUNT':_0xbfcb('0x52'),'COUNT DISTINCT':_0xbfcb('0x53'),'MAX':_0xbfcb('0x54'),'MIN':_0xbfcb('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbfcb('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2c0cbe={'SEC_TO_TIME':_0xbfcb('0x57'),'DATE':_0xbfcb('0x58'),'HOUR':_0xbfcb('0x59'),'ROUND':_0xbfcb('0x5a'),'UNIX_TIMESTAMP':_0xbfcb('0x5b')};var _0x51f8a0=function(_0x153cce){return!_[_0xbfcb('0x5c')]([_0xbfcb('0x5d'),_0xbfcb('0x5e'),_0xbfcb('0x5f'),_0xbfcb('0x60')],_0x153cce);};var _0x417030=function(_0x5d847c){if(!_0x5d847c||!_0x5d847c['rules']['length']){return'';}for(var _0x2b9a96='(',_0x14014d=0x0;_0x14014d<_0x5d847c[_0xbfcb('0x61')]['length'];_0x14014d+=0x1){_0x14014d>0x0&&(_0x2b9a96+='\x20'+_0x5d847c[_0xbfcb('0x62')]+'\x20');_0x2b9a96+=_0x5d847c[_0xbfcb('0x61')][_0x14014d][_0xbfcb('0x63')]?_0x417030(_0x5d847c['rules'][_0x14014d]['group']):_0x5d847c['rules'][_0x14014d][_0xbfcb('0x64')]+'\x20'+_0x5d847c[_0xbfcb('0x61')][_0x14014d][_0xbfcb('0x65')]+(_0x51f8a0(_0x5d847c[_0xbfcb('0x61')][_0x14014d]['condition'])?'\x20'+_0x5d847c[_0xbfcb('0x61')][_0x14014d][_0xbfcb('0x66')]:'');}return _0x2b9a96+')';};var _0x39a3cf={'where':{'id':_0x3cd568['params']['id']}},_0x5c4036,_0x4bf71a,_0x107b1b,_0x2f6065,_0x5e011a;_0x39a3cf=_['merge']({},_0x39a3cf,_0x3cd568['options']);return db[_0xbfcb('0x31')][_0xbfcb('0x4d')](_0x39a3cf)[_0xbfcb('0x26')](function(_0x2d77f9){if(_0x2d77f9){_0x5c4036=_0x2d77f9;return _0x2d77f9[_0xbfcb('0x67')]();}return null;})[_0xbfcb('0x26')](function(_0x2ea974){if(_0x2ea974){if(!_0x2ea974[_0xbfcb('0x3a')]){throw new db['Sequelize'][(_0xbfcb('0x68'))](_0xbfcb('0x69'),0x193);}_0x4bf71a=_0x2ea974;return db[_0xbfcb('0x6a')][_0xbfcb('0x44')]({'raw':!![]});}return null;})[_0xbfcb('0x26')](function(_0x3e685c){if(_0x3e685c){_0x107b1b=_[_0xbfcb('0x6b')](_0x3e685c,'id');var _0x43f60b;var _0x582b60=squel[_0xbfcb('0x6c')]();_0x582b60['from'](_0x5c4036[_0xbfcb('0x6d')]);for(var _0x2a1368=0x0;_0x2a1368<_0x4bf71a[_0xbfcb('0x3a')];_0x2a1368+=0x1){_0x43f60b=_0x4bf71a[_0x2a1368][_0xbfcb('0x6e')]?_0x107b1b[_0x4bf71a[_0x2a1368][_0xbfcb('0x6e')]]['metric']:_0x4bf71a[_0x2a1368][_0xbfcb('0x64')];_0x43f60b=_0x4bf71a[_0x2a1368][_0xbfcb('0x6f')]?_[_0xbfcb('0x70')](_0x9c9b13[_0x4bf71a[_0x2a1368][_0xbfcb('0x6f')]],'%s',_0x43f60b):_0x43f60b;_0x43f60b=_0x4bf71a[_0x2a1368][_0xbfcb('0x71')]?_['replace'](_0x2c0cbe[_0x4bf71a[_0x2a1368][_0xbfcb('0x71')]],'%s',_0x43f60b):_0x43f60b;if(_0x4bf71a[_0x2a1368][_0xbfcb('0x72')]){_0x582b60[_0xbfcb('0x63')](_0x43f60b);}_0x4bf71a[_0x2a1368][_0xbfcb('0x73')]&&_0x582b60['order'](_0x43f60b,_0x4bf71a[_0x2a1368]['orderBy']===_0xbfcb('0x74')?![]:!![]);_0x582b60[_0xbfcb('0x64')](_0x43f60b,_0x4bf71a[_0x2a1368][_0xbfcb('0x75')]||_0x43f60b);}if(_0x5c4036[_0xbfcb('0x76')]){_0x5c4036[_0xbfcb('0x76')]=JSON[_0xbfcb('0x77')](_0x5c4036[_0xbfcb('0x76')]);for(var _0x169dc8=0x0;_0x169dc8<_0x5c4036[_0xbfcb('0x76')][_0xbfcb('0x3a')];_0x169dc8+=0x1){if(_0x5c4036[_0xbfcb('0x76')][_0x169dc8][_0xbfcb('0x34')]&&_[_0xbfcb('0x5c')](_0x4311d9,_0x5c4036[_0xbfcb('0x76')][_0x169dc8]['type'])&&_0x5c4036[_0xbfcb('0x76')][_0x169dc8]['parentKey']&&_0x5c4036[_0xbfcb('0x76')][_0x169dc8][_0xbfcb('0x78')]&&_0x5c4036['joins'][_0x169dc8][_0xbfcb('0x79')]){_0x582b60[_0x5c4036[_0xbfcb('0x76')][_0x169dc8][_0xbfcb('0x34')]](_0x5c4036[_0xbfcb('0x76')][_0x169dc8]['foreignTable'],null,util[_0xbfcb('0x71')]('%s.%s\x20=\x20%s.%s',_0x5c4036[_0xbfcb('0x6d')],_0x5c4036[_0xbfcb('0x76')][_0x169dc8]['parentKey'],_0x5c4036['joins'][_0x169dc8][_0xbfcb('0x78')],_0x5c4036[_0xbfcb('0x76')][_0x169dc8][_0xbfcb('0x79')]));}}}if(_0x5c4036[_0xbfcb('0x7a')]){_0x5c4036[_0xbfcb('0x7a')]=JSON['parse'](_0x5c4036['conditions']);_0x582b60[_0xbfcb('0x3e')](_0x417030(_0x5c4036['conditions']['group']));}_0x5e011a=_0x582b60[_0xbfcb('0x7b')]();_0x582b60[_0xbfcb('0x21')](_0x2534fe);_0x582b60['offset'](0x0);logger[_0xbfcb('0x7c')](_0xbfcb('0x7d'),_0x582b60['toString']());return dbH[_0xbfcb('0x7e')][_0xbfcb('0x36')](_0x582b60[_0xbfcb('0x7f')](),{'type':dbH[_0xbfcb('0x7e')]['QueryTypes'][_0xbfcb('0x80')]});}})[_0xbfcb('0x26')](respondWithResult(_0xc44640,null))[_0xbfcb('0x45')](handleError(_0xc44640,null));};function runReport(_0x4256c4,_0x456539,_0x31b5fc){var _0x5328da=_0x456539[_0xbfcb('0x2d')];var _0x19dd1f=0xa;var _0x3d677a=[_0xbfcb('0x4f'),_0xbfcb('0x50'),_0xbfcb('0x51'),_0xbfcb('0x81')];var _0x4f8cda={'SUM':_0xbfcb('0x82'),'COUNT':_0xbfcb('0x52'),'COUNT DISTINCT':_0xbfcb('0x53'),'MAX':_0xbfcb('0x54'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xbfcb('0x83'),'GROUP_CONCAT ASC':_0xbfcb('0x56'),'GROUP_CONCAT DESC':_0xbfcb('0x84')};var _0xec7c1f={'SEC_TO_TIME':_0xbfcb('0x57'),'DATE':_0xbfcb('0x58'),'HOUR':_0xbfcb('0x59'),'ROUND':_0xbfcb('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x258969=function(_0x20e222){return!_[_0xbfcb('0x5c')]([_0xbfcb('0x5d'),_0xbfcb('0x5e'),'IS\x20EMPTY',_0xbfcb('0x60')],_0x20e222);};var _0x5c9f24=function(_0x1799c){if(!_0x1799c||!_0x1799c[_0xbfcb('0x61')]['length']){return'';}for(var _0x591877='(',_0x1a5c5f=0x0;_0x1a5c5f<_0x1799c[_0xbfcb('0x61')][_0xbfcb('0x3a')];_0x1a5c5f+=0x1){_0x1a5c5f>0x0&&(_0x591877+='\x20'+_0x1799c[_0xbfcb('0x62')]+'\x20');_0x591877+=_0x1799c[_0xbfcb('0x61')][_0x1a5c5f][_0xbfcb('0x63')]?_0x5c9f24(_0x1799c['rules'][_0x1a5c5f][_0xbfcb('0x63')]):_0x1799c[_0xbfcb('0x61')][_0x1a5c5f][_0xbfcb('0x64')]+'\x20'+_0x1799c[_0xbfcb('0x61')][_0x1a5c5f][_0xbfcb('0x65')]+(_0x258969(_0x1799c[_0xbfcb('0x61')][_0x1a5c5f][_0xbfcb('0x65')])?'\x20'+_0x1799c[_0xbfcb('0x61')][_0x1a5c5f]['value']:'');}return _0x591877+')';};var _0x1157c5={'where':{'id':_0x4256c4['id']}},_0x125324,_0x5513ee,_0x5ec7d8,_0x21b6b6,_0x5d0c2f;_0x1157c5=_['merge']({},_0x1157c5,_0x31b5fc);return db[_0xbfcb('0x31')]['find'](_0x1157c5)[_0xbfcb('0x26')](function(_0x336ddc){if(_0x336ddc){_0x125324=_0x336ddc;return _0x336ddc[_0xbfcb('0x67')]();}return null;})['then'](function(_0x3edebe){if(_0x3edebe){if(!_0x3edebe[_0xbfcb('0x3a')]){throw new db[(_0xbfcb('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5513ee=_0x3edebe;return db[_0xbfcb('0x6a')][_0xbfcb('0x44')]({'raw':!![]});}return null;})[_0xbfcb('0x26')](function(_0x4fd470){if(_0x4fd470){_0x5ec7d8=_[_0xbfcb('0x6b')](_0x4fd470,'id');var _0x4dc753;var _0x33b34a=squel[_0xbfcb('0x6c')]();_0x33b34a['from'](_0x125324[_0xbfcb('0x6d')]);for(var _0x6e7287=0x0;_0x6e7287<_0x5513ee[_0xbfcb('0x3a')];_0x6e7287+=0x1){_0x4dc753=_0x5513ee[_0x6e7287]['MetricId']?_0x5ec7d8[_0x5513ee[_0x6e7287][_0xbfcb('0x6e')]]['metric']:_0x5513ee[_0x6e7287][_0xbfcb('0x64')];_0x4dc753=_0x5513ee[_0x6e7287][_0xbfcb('0x6f')]?_[_0xbfcb('0x70')](_0x4f8cda[_0x5513ee[_0x6e7287][_0xbfcb('0x6f')]],'%s',_0x4dc753):_0x4dc753;_0x4dc753=_0x5513ee[_0x6e7287][_0xbfcb('0x71')]?_['replace'](_0xec7c1f[_0x5513ee[_0x6e7287][_0xbfcb('0x71')]],'%s',_0x4dc753):_0x4dc753;if(_0x5513ee[_0x6e7287][_0xbfcb('0x72')]){_0x33b34a['group'](_0x4dc753);}_0x5513ee[_0x6e7287][_0xbfcb('0x73')]&&_0x33b34a['order'](_0x4dc753,_0x5513ee[_0x6e7287]['orderBy']===_0xbfcb('0x74')?![]:!![]);_0x33b34a[_0xbfcb('0x64')](_0x4dc753,_0x5513ee[_0x6e7287]['alias']||_0x4dc753);}if(_0x125324[_0xbfcb('0x76')]){_0x125324[_0xbfcb('0x76')]=JSON[_0xbfcb('0x77')](_0x125324[_0xbfcb('0x76')]);for(var _0x2c2a15=0x0;_0x2c2a15<_0x125324['joins'][_0xbfcb('0x3a')];_0x2c2a15+=0x1){if(_0x125324[_0xbfcb('0x76')][_0x2c2a15][_0xbfcb('0x34')]&&_[_0xbfcb('0x5c')](_0x3d677a,_0x125324[_0xbfcb('0x76')][_0x2c2a15][_0xbfcb('0x34')])&&_0x125324[_0xbfcb('0x76')][_0x2c2a15][_0xbfcb('0x86')]&&_0x125324[_0xbfcb('0x76')][_0x2c2a15][_0xbfcb('0x78')]&&_0x125324[_0xbfcb('0x76')][_0x2c2a15][_0xbfcb('0x79')]){_0x33b34a[_0x125324[_0xbfcb('0x76')][_0x2c2a15]['type']](_0x125324[_0xbfcb('0x76')][_0x2c2a15][_0xbfcb('0x78')],null,util[_0xbfcb('0x71')](_0xbfcb('0x87'),_0x125324[_0xbfcb('0x6d')],_0x125324[_0xbfcb('0x76')][_0x2c2a15][_0xbfcb('0x86')],_0x125324[_0xbfcb('0x76')][_0x2c2a15][_0xbfcb('0x78')],_0x125324['joins'][_0x2c2a15]['foreignKey']));}}}if(_0x125324[_0xbfcb('0x7a')]){_0x125324['conditions']=JSON[_0xbfcb('0x77')](_0x125324['conditions']);_0x33b34a['where'](_0x5c9f24(_0x125324[_0xbfcb('0x7a')]['group']));}_0x5d0c2f=_0x33b34a[_0xbfcb('0x7b')]();_0x33b34a['limit'](_0x19dd1f);_0x33b34a[_0xbfcb('0x20')](0x0);return;}})[_0xbfcb('0x26')](function(){if(_0x456539['output']===_0xbfcb('0x88')){return null;}var _0x3836c8=_[_0xbfcb('0x40')](_0x456539,{'name':_0x456539[_0xbfcb('0x89')]||_0x456539[_0xbfcb('0x2d')]||_0x125324[_0xbfcb('0x2d')],'basename':_0x5328da,'savename':util[_0xbfcb('0x71')](_0xbfcb('0x8a'),_0x456539[_0xbfcb('0x2d')]||_0x125324[_0xbfcb('0x2d')],require(_0xbfcb('0x8b'))[_0xbfcb('0x8c')](0x4),_0x456539[_0xbfcb('0x8d')]||_0xbfcb('0x8e')),'reportId':_0x125324['id'],'reportType':_0xbfcb('0x8f')});return db[_0xbfcb('0x90')][_0xbfcb('0x49')](_0x3836c8,{'raw':!![]});})[_0xbfcb('0x26')](function(_0x557d6d){if(_0x125324[_0xbfcb('0x6d')]==='cdr'){_0x5d0c2f[_0xbfcb('0x3e')](_0x125324[_0xbfcb('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x456539[_0xbfcb('0x91')],_0x456539[_0xbfcb('0x92')]);}else{_0x5d0c2f[_0xbfcb('0x3e')](_0x125324[_0xbfcb('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x456539[_0xbfcb('0x91')],_0x456539[_0xbfcb('0x92')]);}if(_0x557d6d){logger['info'](_0xbfcb('0x93'),_0x5d0c2f[_0xbfcb('0x7f')]());require(_0xbfcb('0x94'))[_0xbfcb('0x95')](path['join'](__dirname,_0xbfcb('0x96'),_0x557d6d['output']),[_0x557d6d['id'],_0x5d0c2f[_0xbfcb('0x7f')](),path[_0xbfcb('0x4f')](__dirname,'../../files/reports',_0x557d6d[_0xbfcb('0x97')]),_0x5328da]);return _0x557d6d;}else{var _0x14ca97=squel['select']();_0x14ca97[_0xbfcb('0x98')]('('+_0x5d0c2f['toString']()+')','countTable');_0x14ca97[_0xbfcb('0x64')](_0xbfcb('0x99'),_0xbfcb('0x1f'));_0x5d0c2f['limit'](_0x456539[_0xbfcb('0x21')]||_0x19dd1f);_0x5d0c2f[_0xbfcb('0x20')](_0x456539[_0xbfcb('0x20')]||0x0);return dbH[_0xbfcb('0x7e')]['query'](_0x14ca97['toString'](),{'type':dbH[_0xbfcb('0x7e')]['QueryTypes'][_0xbfcb('0x80')]})[_0xbfcb('0x26')](function(_0x157f24){if(!_0x157f24[_0xbfcb('0x3a')]){_0x21b6b6=0x0;}else{_0x21b6b6=_0x157f24[0x0]['count']||0x0;}return dbH[_0xbfcb('0x7e')]['query'](_0x5d0c2f[_0xbfcb('0x7f')](),{'type':dbH['sequelize'][_0xbfcb('0x9a')]['SELECT']});})[_0xbfcb('0x26')](function(_0x5dff66){return{'rows':_0x5dff66||[],'count':_0x21b6b6};});}});}exports[_0xbfcb('0x9b')]=function(_0x51a1db,_0x556993){return runReport(_0x51a1db[_0xbfcb('0x9c')],_0x51a1db[_0xbfcb('0x36')],_0x51a1db['options'])[_0xbfcb('0x26')](respondWithResult(_0x556993,null))[_0xbfcb('0x45')](handleError(_0x556993,null));};exports[_0xbfcb('0x9d')]=runReport;exports[_0xbfcb('0x36')]=function(_0x1f4f0a,_0x3e6d15){var _0x27fde4=0xa;var _0x454abf=[_0xbfcb('0x4f'),_0xbfcb('0x50'),_0xbfcb('0x51'),_0xbfcb('0x81')];var _0x4ed66b={'SUM':_0xbfcb('0x82'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbfcb('0x53'),'MAX':_0xbfcb('0x54'),'MIN':_0xbfcb('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xbfcb('0x83'),'GROUP_CONCAT ASC':_0xbfcb('0x56'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4db416={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xbfcb('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbfcb('0x5b')};var _0x16eebb=function(_0x12f9da){return!_[_0xbfcb('0x5c')]([_0xbfcb('0x5d'),_0xbfcb('0x5e'),_0xbfcb('0x5f'),_0xbfcb('0x60')],_0x12f9da);};var _0x476480=function(_0x372520){if(!_0x372520||!_0x372520['rules'][_0xbfcb('0x3a')]){return'';}for(var _0x25d2ac='(',_0x515253=0x0;_0x515253<_0x372520[_0xbfcb('0x61')][_0xbfcb('0x3a')];_0x515253+=0x1){_0x515253>0x0&&(_0x25d2ac+='\x20'+_0x372520[_0xbfcb('0x62')]+'\x20');_0x25d2ac+=_0x372520[_0xbfcb('0x61')][_0x515253][_0xbfcb('0x63')]?_0x476480(_0x372520['rules'][_0x515253][_0xbfcb('0x63')]):_0x372520[_0xbfcb('0x61')][_0x515253][_0xbfcb('0x64')]+'\x20'+_0x372520[_0xbfcb('0x61')][_0x515253]['condition']+(_0x16eebb(_0x372520[_0xbfcb('0x61')][_0x515253][_0xbfcb('0x65')])?'\x20'+_0x372520['rules'][_0x515253][_0xbfcb('0x66')]:'');}return _0x25d2ac+')';};var _0xa0c250={'where':{'id':_0x1f4f0a[_0xbfcb('0x9c')]['id']}},_0x25e250,_0x4de418,_0x49afb1,_0x12ce37,_0x2609ad;_0xa0c250=_[_0xbfcb('0x40')]({},_0xa0c250,_0x1f4f0a[_0xbfcb('0x41')]);return db[_0xbfcb('0x31')][_0xbfcb('0x4d')](_0xa0c250)[_0xbfcb('0x26')](function(_0x1791a2){if(_0x1791a2){_0x25e250=_0x1791a2;return _0x1791a2[_0xbfcb('0x67')]();}return null;})[_0xbfcb('0x26')](function(_0x13635b){if(_0x13635b){if(!_0x13635b[_0xbfcb('0x3a')]){throw new db[(_0xbfcb('0x85'))]['ValidationErrorItem'](_0xbfcb('0x69'),0x193);}_0x4de418=_0x13635b;return db[_0xbfcb('0x6a')][_0xbfcb('0x44')]({'raw':!![]});}return null;})[_0xbfcb('0x26')](function(_0x48efbd){if(_0x48efbd){_0x49afb1=_[_0xbfcb('0x6b')](_0x48efbd,'id');var _0x2dab93;var _0x23057b=squel['select']();_0x23057b[_0xbfcb('0x98')](_0x25e250['table']);for(var _0x1310f4=0x0;_0x1310f4<_0x4de418[_0xbfcb('0x3a')];_0x1310f4+=0x1){_0x2dab93=_0x4de418[_0x1310f4][_0xbfcb('0x6e')]?_0x49afb1[_0x4de418[_0x1310f4][_0xbfcb('0x6e')]][_0xbfcb('0x9e')]:_0x4de418[_0x1310f4][_0xbfcb('0x64')];_0x2dab93=_0x4de418[_0x1310f4][_0xbfcb('0x6f')]?_[_0xbfcb('0x70')](_0x4ed66b[_0x4de418[_0x1310f4][_0xbfcb('0x6f')]],'%s',_0x2dab93):_0x2dab93;_0x2dab93=_0x4de418[_0x1310f4]['format']?_[_0xbfcb('0x70')](_0x4db416[_0x4de418[_0x1310f4][_0xbfcb('0x71')]],'%s',_0x2dab93):_0x2dab93;if(_0x4de418[_0x1310f4][_0xbfcb('0x72')]){_0x23057b[_0xbfcb('0x63')](_0x2dab93);}_0x4de418[_0x1310f4][_0xbfcb('0x73')]&&_0x23057b[_0xbfcb('0x9f')](_0x2dab93,_0x4de418[_0x1310f4]['orderBy']==='DESC'?![]:!![]);_0x23057b[_0xbfcb('0x64')](_0x2dab93,_0x4de418[_0x1310f4][_0xbfcb('0x75')]||_0x2dab93);}if(_0x25e250[_0xbfcb('0x76')]){_0x25e250[_0xbfcb('0x76')]=JSON[_0xbfcb('0x77')](_0x25e250[_0xbfcb('0x76')]);for(var _0xd678b7=0x0;_0xd678b7<_0x25e250[_0xbfcb('0x76')]['length'];_0xd678b7+=0x1){if(_0x25e250['joins'][_0xd678b7][_0xbfcb('0x34')]&&_[_0xbfcb('0x5c')](_0x454abf,_0x25e250[_0xbfcb('0x76')][_0xd678b7][_0xbfcb('0x34')])&&_0x25e250[_0xbfcb('0x76')][_0xd678b7][_0xbfcb('0x86')]&&_0x25e250[_0xbfcb('0x76')][_0xd678b7][_0xbfcb('0x78')]&&_0x25e250['joins'][_0xd678b7][_0xbfcb('0x79')]){_0x23057b[_0x25e250[_0xbfcb('0x76')][_0xd678b7]['type']](_0x25e250[_0xbfcb('0x76')][_0xd678b7][_0xbfcb('0x78')],null,util[_0xbfcb('0x71')](_0xbfcb('0x87'),_0x25e250[_0xbfcb('0x6d')],_0x25e250[_0xbfcb('0x76')][_0xd678b7]['parentKey'],_0x25e250[_0xbfcb('0x76')][_0xd678b7][_0xbfcb('0x78')],_0x25e250[_0xbfcb('0x76')][_0xd678b7][_0xbfcb('0x79')]));}}}if(_0x25e250[_0xbfcb('0x7a')]){_0x25e250['conditions']=JSON[_0xbfcb('0x77')](_0x25e250[_0xbfcb('0x7a')]);_0x23057b[_0xbfcb('0x3e')](_0x476480(_0x25e250[_0xbfcb('0x7a')]['group']));}_0x2609ad=_0x23057b[_0xbfcb('0x7b')]();_0x23057b['limit'](_0x27fde4);_0x23057b[_0xbfcb('0x20')](0x0);logger[_0xbfcb('0x7c')]('Limited\x20Query:',_0x23057b[_0xbfcb('0x7f')]());return dbH[_0xbfcb('0x7e')]['query'](_0x23057b['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xbfcb('0x80')]});}})[_0xbfcb('0x26')](function(){return{'sql':_0x2609ad[_0xbfcb('0x7f')]()};})[_0xbfcb('0x26')](respondWithResult(_0x3e6d15,null))[_0xbfcb('0x45')](handleError(_0x3e6d15,null));}; \ No newline at end of file +var _0xbc72=['HOUR(%s)','ROUND(%s)','IS\x20NULL','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','debug','Limited\x20Query:','toString','sequelize','SELECT','join','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','Please\x20insert\x20at\x20least\x20one\x20field','order','%s.%s\x20=\x20%s.%s','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','MAX(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','get','CustomReports','then','error','name','send','index','AnalyticCustomReport','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','preview','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)'];(function(_0xaff290,_0x2ab600){var _0x476e68=function(_0x3351d6){while(--_0x3351d6){_0xaff290['push'](_0xaff290['shift']());}};_0x476e68(++_0x2ab600);}(_0xbc72,0x18e));var _0x2bc7=function(_0x1b6500,_0x57e48f){_0x1b6500=_0x1b6500-0x0;var _0x78a0e3=_0xbc72[_0x1b6500];return _0x78a0e3;};'use strict';var pdf=require(_0x2bc7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2bc7('0x1'));var zipdir=require(_0x2bc7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2bc7('0x3'));var moment=require(_0x2bc7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2bc7('0x5'));var util=require(_0x2bc7('0x6'));var path=require('path');var sox=require(_0x2bc7('0x7'));var csv=require(_0x2bc7('0x8'));var ejs=require(_0x2bc7('0x9'));var fs=require('fs');var _=require(_0x2bc7('0xa'));var squel=require(_0x2bc7('0xb'));var crypto=require(_0x2bc7('0xc'));var jsforce=require(_0x2bc7('0xd'));var deskjs=require(_0x2bc7('0xe'));var toCsv=require(_0x2bc7('0x8'));var querystring=require(_0x2bc7('0xf'));var Papa=require('papaparse');var Redis=require(_0x2bc7('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2bc7('0x11'));var hardwareService=require(_0x2bc7('0x12'));var logger=require(_0x2bc7('0x13'))('api');var utils=require(_0x2bc7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2bc7('0x15'));var db=require(_0x2bc7('0x16'))['db'];var dbH=require(_0x2bc7('0x16'))[_0x2bc7('0x17')];function respondWithStatusCode(_0x1e2141,_0xb9ec98){_0xb9ec98=_0xb9ec98||0xcc;return function(_0x16ac01){if(_0x16ac01){return _0x1e2141[_0x2bc7('0x18')](_0xb9ec98);}return _0x1e2141[_0x2bc7('0x19')](_0xb9ec98)[_0x2bc7('0x1a')]();};}function respondWithResult(_0x58ae98,_0x207bc6){_0x207bc6=_0x207bc6||0xc8;return function(_0x3d82be){if(_0x3d82be){return _0x58ae98['status'](_0x207bc6)[_0x2bc7('0x1b')](_0x3d82be);}};}function respondWithFilteredResult(_0x50e00c,_0x52a23d){return function(_0x3b0f5b){if(_0x3b0f5b){var _0x5b4b0b=_0x3b0f5b[_0x2bc7('0x1c')],_0x44e9d5=_0x52a23d['offset'],_0x44f3c3=_0x52a23d[_0x2bc7('0x1d')]+_0x52a23d[_0x2bc7('0x1e')],_0x1724ed;if(_0x44f3c3>=_0x5b4b0b){_0x44f3c3=_0x5b4b0b;_0x1724ed=0xc8;}else{_0x1724ed=0xce;}_0x50e00c['status'](_0x1724ed);return _0x50e00c[_0x2bc7('0x1f')](_0x2bc7('0x20'),_0x44e9d5+'-'+_0x44f3c3+'/'+_0x5b4b0b)[_0x2bc7('0x1b')](_0x3b0f5b);}return null;};}function patchUpdates(_0x3c8b26){return function(_0x4d6c4e){try{jsonpatch[_0x2bc7('0x21')](_0x4d6c4e,_0x3c8b26,!![]);}catch(_0x4b3626){return BPromise[_0x2bc7('0x22')](_0x4b3626);}return _0x4d6c4e['save']();};}function saveUpdates(_0x575a1f,_0xc0ad24){return function(_0x2095df){if(_0x2095df){return _0x2095df['update'](_0x575a1f)['then'](function(_0x80950a){return _0x80950a;});}return null;};}function removeEntity(_0x5edd4a,_0x7db41a){return function(_0x101d60){if(_0x101d60){return _0x101d60[_0x2bc7('0x23')]()['then'](function(){var _0x3e9ee6=_0x101d60[_0x2bc7('0x24')]({'plain':!![]});var _0x206633=_0x2bc7('0x25');return db['UserProfileResource'][_0x2bc7('0x23')]({'where':{'type':_0x206633,'resourceId':_0x3e9ee6['id']}})[_0x2bc7('0x26')](function(){return _0x101d60;});})[_0x2bc7('0x26')](function(){_0x5edd4a[_0x2bc7('0x19')](0xcc)[_0x2bc7('0x1a')]();});}};}function handleEntityNotFound(_0x199faa,_0x446342){return function(_0x54e2b7){if(!_0x54e2b7){_0x199faa[_0x2bc7('0x18')](0x194);}return _0x54e2b7;};}function handleError(_0x3f825d,_0x12bc9d){_0x12bc9d=_0x12bc9d||0x1f4;return function(_0x48374a){logger[_0x2bc7('0x27')](_0x48374a['stack']);if(_0x48374a[_0x2bc7('0x28')]){delete _0x48374a[_0x2bc7('0x28')];}_0x3f825d[_0x2bc7('0x19')](_0x12bc9d)[_0x2bc7('0x29')](_0x48374a);};}exports[_0x2bc7('0x2a')]=function(_0x53e7c5,_0x29e3d7){var _0x3188f6={},_0x58956a={},_0x177fed={'count':0x0,'rows':[]};var _0x58a382=_['map'](db[_0x2bc7('0x2b')]['rawAttributes'],function(_0x4fa0b8){return{'name':_0x4fa0b8['fieldName'],'type':_0x4fa0b8[_0x2bc7('0x2c')][_0x2bc7('0x2d')]};});_0x58956a[_0x2bc7('0x2e')]=_[_0x2bc7('0x2f')](_0x58a382,_0x2bc7('0x28'));_0x58956a[_0x2bc7('0x30')]=_[_0x2bc7('0x31')](_0x53e7c5[_0x2bc7('0x30')]);_0x58956a['filters']=_['intersection'](_0x58956a[_0x2bc7('0x2e')],_0x58956a[_0x2bc7('0x30')]);_0x3188f6[_0x2bc7('0x32')]=_[_0x2bc7('0x33')](_0x58956a['model'],qs[_0x2bc7('0x34')](_0x53e7c5[_0x2bc7('0x30')][_0x2bc7('0x34')]));_0x3188f6[_0x2bc7('0x32')]=_0x3188f6['attributes'][_0x2bc7('0x35')]?_0x3188f6[_0x2bc7('0x32')]:_0x58956a[_0x2bc7('0x2e')];if(!_0x53e7c5[_0x2bc7('0x30')][_0x2bc7('0x36')]('nolimit')){_0x3188f6['limit']=qs[_0x2bc7('0x1e')](_0x53e7c5[_0x2bc7('0x30')]['limit']);_0x3188f6[_0x2bc7('0x1d')]=qs[_0x2bc7('0x1d')](_0x53e7c5[_0x2bc7('0x30')][_0x2bc7('0x1d')]);}_0x3188f6['order']=qs[_0x2bc7('0x37')](_0x53e7c5['query']['sort']);_0x3188f6['where']=qs[_0x2bc7('0x38')](_[_0x2bc7('0x39')](_0x53e7c5[_0x2bc7('0x30')],_0x58956a[_0x2bc7('0x38')]),_0x58a382);if(_0x53e7c5[_0x2bc7('0x30')][_0x2bc7('0x3a')]){_0x3188f6[_0x2bc7('0x3b')]=_['merge'](_0x3188f6['where'],{'$or':_[_0x2bc7('0x2f')](_0x58a382,function(_0x188579){if(_0x188579[_0x2bc7('0x2c')]!==_0x2bc7('0x3c')){var _0x1a6822={};_0x1a6822[_0x188579[_0x2bc7('0x28')]]={'$like':'%'+_0x53e7c5['query'][_0x2bc7('0x3a')]+'%'};return _0x1a6822;}})});}_0x3188f6=_['merge']({},_0x3188f6,_0x53e7c5[_0x2bc7('0x3d')]);var _0x1338df={'where':_0x3188f6[_0x2bc7('0x3b')]};return db['AnalyticCustomReport']['count'](_0x1338df)[_0x2bc7('0x26')](function(_0x27baae){_0x177fed[_0x2bc7('0x1c')]=_0x27baae;if(_0x53e7c5[_0x2bc7('0x30')][_0x2bc7('0x3e')]){_0x3188f6[_0x2bc7('0x3f')]=[{'all':!![]}];}return db[_0x2bc7('0x2b')][_0x2bc7('0x40')](_0x3188f6);})[_0x2bc7('0x26')](function(_0x4fa1a2){_0x177fed[_0x2bc7('0x41')]=_0x4fa1a2;return _0x177fed;})[_0x2bc7('0x26')](respondWithFilteredResult(_0x29e3d7,_0x3188f6))[_0x2bc7('0x42')](handleError(_0x29e3d7,null));};exports[_0x2bc7('0x43')]=function(_0x37a1e7,_0x4f7fa0){var _0x3a1654={'raw':![],'where':{'id':_0x37a1e7[_0x2bc7('0x44')]['id']}},_0xc8b49={};_0xc8b49[_0x2bc7('0x2e')]=_[_0x2bc7('0x31')](db['AnalyticCustomReport'][_0x2bc7('0x45')]);_0xc8b49[_0x2bc7('0x30')]=_[_0x2bc7('0x31')](_0x37a1e7['query']);_0xc8b49[_0x2bc7('0x38')]=_['intersection'](_0xc8b49[_0x2bc7('0x2e')],_0xc8b49[_0x2bc7('0x30')]);_0x3a1654['attributes']=_[_0x2bc7('0x33')](_0xc8b49[_0x2bc7('0x2e')],qs[_0x2bc7('0x34')](_0x37a1e7[_0x2bc7('0x30')][_0x2bc7('0x34')]));_0x3a1654[_0x2bc7('0x32')]=_0x3a1654[_0x2bc7('0x32')][_0x2bc7('0x35')]?_0x3a1654['attributes']:_0xc8b49[_0x2bc7('0x2e')];if(_0x37a1e7[_0x2bc7('0x30')][_0x2bc7('0x3e')]){_0x3a1654[_0x2bc7('0x3f')]=[{'all':!![]}];}_0x3a1654=_[_0x2bc7('0x46')]({},_0x3a1654,_0x37a1e7[_0x2bc7('0x3d')]);return db[_0x2bc7('0x2b')][_0x2bc7('0x47')](_0x3a1654)[_0x2bc7('0x26')](handleEntityNotFound(_0x4f7fa0,null))[_0x2bc7('0x26')](respondWithResult(_0x4f7fa0,null))[_0x2bc7('0x42')](handleError(_0x4f7fa0,null));};exports[_0x2bc7('0x48')]=function(_0x139488,_0x2ab70f){return db['AnalyticCustomReport'][_0x2bc7('0x48')](_0x139488[_0x2bc7('0x49')],{})[_0x2bc7('0x26')](function(_0x6c5e80){var _0x227630=_0x139488['user']['get']({'plain':!![]});if(!_0x227630)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x227630['role']===_0x2bc7('0x4a')){var _0x48d695=_0x6c5e80[_0x2bc7('0x24')]({'plain':!![]});var _0x1f18aa=_0x2bc7('0x4b');return db[_0x2bc7('0x4c')][_0x2bc7('0x47')]({'where':{'name':_0x1f18aa,'userProfileId':_0x227630[_0x2bc7('0x4d')]},'raw':!![]})[_0x2bc7('0x26')](function(_0x9ec897){if(_0x9ec897&&_0x9ec897[_0x2bc7('0x4e')]===0x0){return db[_0x2bc7('0x4f')]['create']({'name':_0x48d695[_0x2bc7('0x28')],'resourceId':_0x48d695['id'],'type':_0x2bc7('0x25'),'sectionId':_0x9ec897['id']},{})['then'](function(){return _0x6c5e80;});}else{return _0x6c5e80;}})[_0x2bc7('0x42')](function(_0xde721a){logger[_0x2bc7('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xde721a);throw _0xde721a;});}return _0x6c5e80;})[_0x2bc7('0x26')](respondWithResult(_0x2ab70f,0xc9))[_0x2bc7('0x42')](handleError(_0x2ab70f,null));};exports[_0x2bc7('0x50')]=function(_0x5558f5,_0x533a88){if(_0x5558f5[_0x2bc7('0x49')]['id']){delete _0x5558f5[_0x2bc7('0x49')]['id'];}return db[_0x2bc7('0x2b')][_0x2bc7('0x47')]({'where':{'id':_0x5558f5[_0x2bc7('0x44')]['id']}})[_0x2bc7('0x26')](handleEntityNotFound(_0x533a88,null))[_0x2bc7('0x26')](saveUpdates(_0x5558f5[_0x2bc7('0x49')],null))[_0x2bc7('0x26')](respondWithResult(_0x533a88,null))[_0x2bc7('0x42')](handleError(_0x533a88,null));};exports['destroy']=function(_0x4b1740,_0x8c6492){return db[_0x2bc7('0x2b')]['find']({'where':{'id':_0x4b1740[_0x2bc7('0x44')]['id']}})[_0x2bc7('0x26')](handleEntityNotFound(_0x8c6492,null))['then'](removeEntity(_0x8c6492,null))[_0x2bc7('0x42')](handleError(_0x8c6492,null));};exports[_0x2bc7('0x51')]=function(_0x2e3931,_0x2b16a7){var _0xef8555=0xa;var _0x35c52a=['join','left_join',_0x2bc7('0x52'),_0x2bc7('0x53')];var _0x269cc7={'SUM':'SUM(%s)','COUNT':_0x2bc7('0x54'),'COUNT DISTINCT':_0x2bc7('0x55'),'MAX':'MAX(%s)','MIN':_0x2bc7('0x56'),'AVG':_0x2bc7('0x57'),'GROUP_CONCAT':_0x2bc7('0x58'),'GROUP_CONCAT ASC':_0x2bc7('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5798de={'SEC_TO_TIME':_0x2bc7('0x5a'),'DATE':'DATE(%s)','HOUR':_0x2bc7('0x5b'),'ROUND':_0x2bc7('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4bbea0=function(_0x2ac870){return!_['includes']([_0x2bc7('0x5d'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2ac870);};var _0x8eda22=function(_0x5d8dbf){if(!_0x5d8dbf||!_0x5d8dbf[_0x2bc7('0x5e')]['length']){return'';}for(var _0x39e9af='(',_0x40d6ba=0x0;_0x40d6ba<_0x5d8dbf[_0x2bc7('0x5e')][_0x2bc7('0x35')];_0x40d6ba+=0x1){_0x40d6ba>0x0&&(_0x39e9af+='\x20'+_0x5d8dbf[_0x2bc7('0x5f')]+'\x20');_0x39e9af+=_0x5d8dbf[_0x2bc7('0x5e')][_0x40d6ba][_0x2bc7('0x60')]?_0x8eda22(_0x5d8dbf['rules'][_0x40d6ba][_0x2bc7('0x60')]):_0x5d8dbf[_0x2bc7('0x5e')][_0x40d6ba][_0x2bc7('0x61')]+'\x20'+_0x5d8dbf[_0x2bc7('0x5e')][_0x40d6ba][_0x2bc7('0x62')]+(_0x4bbea0(_0x5d8dbf[_0x2bc7('0x5e')][_0x40d6ba]['condition'])?'\x20'+_0x5d8dbf['rules'][_0x40d6ba][_0x2bc7('0x63')]:'');}return _0x39e9af+')';};var _0xef201c={'where':{'id':_0x2e3931[_0x2bc7('0x44')]['id']}},_0x44a939,_0x296c70,_0x579dd4,_0x18685a,_0x868914;_0xef201c=_[_0x2bc7('0x46')]({},_0xef201c,_0x2e3931[_0x2bc7('0x3d')]);return db['AnalyticCustomReport'][_0x2bc7('0x47')](_0xef201c)[_0x2bc7('0x26')](function(_0x2d8036){if(_0x2d8036){_0x44a939=_0x2d8036;return _0x2d8036[_0x2bc7('0x64')]();}return null;})[_0x2bc7('0x26')](function(_0x1c6120){if(_0x1c6120){if(!_0x1c6120[_0x2bc7('0x35')]){throw new db[(_0x2bc7('0x65'))][(_0x2bc7('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x296c70=_0x1c6120;return db[_0x2bc7('0x67')]['findAll']({'raw':!![]});}return null;})[_0x2bc7('0x26')](function(_0x535ccd){if(_0x535ccd){_0x579dd4=_[_0x2bc7('0x68')](_0x535ccd,'id');var _0x188bf1;var _0x965271=squel[_0x2bc7('0x69')]();_0x965271[_0x2bc7('0x6a')](_0x44a939[_0x2bc7('0x6b')]);for(var _0x58a55e=0x0;_0x58a55e<_0x296c70[_0x2bc7('0x35')];_0x58a55e+=0x1){_0x188bf1=_0x296c70[_0x58a55e][_0x2bc7('0x6c')]?_0x579dd4[_0x296c70[_0x58a55e][_0x2bc7('0x6c')]][_0x2bc7('0x6d')]:_0x296c70[_0x58a55e][_0x2bc7('0x61')];_0x188bf1=_0x296c70[_0x58a55e][_0x2bc7('0x6e')]?_[_0x2bc7('0x6f')](_0x269cc7[_0x296c70[_0x58a55e][_0x2bc7('0x6e')]],'%s',_0x188bf1):_0x188bf1;_0x188bf1=_0x296c70[_0x58a55e][_0x2bc7('0x70')]?_[_0x2bc7('0x6f')](_0x5798de[_0x296c70[_0x58a55e]['format']],'%s',_0x188bf1):_0x188bf1;if(_0x296c70[_0x58a55e][_0x2bc7('0x71')]){_0x965271[_0x2bc7('0x60')](_0x188bf1);}_0x296c70[_0x58a55e]['orderBy']&&_0x965271['order'](_0x188bf1,_0x296c70[_0x58a55e][_0x2bc7('0x72')]===_0x2bc7('0x73')?![]:!![]);_0x965271[_0x2bc7('0x61')](_0x188bf1,_0x296c70[_0x58a55e][_0x2bc7('0x74')]||_0x188bf1);}if(_0x44a939[_0x2bc7('0x75')]){_0x44a939['joins']=JSON['parse'](_0x44a939['joins']);for(var _0x1ccbe6=0x0;_0x1ccbe6<_0x44a939[_0x2bc7('0x75')][_0x2bc7('0x35')];_0x1ccbe6+=0x1){if(_0x44a939[_0x2bc7('0x75')][_0x1ccbe6][_0x2bc7('0x2c')]&&_['includes'](_0x35c52a,_0x44a939[_0x2bc7('0x75')][_0x1ccbe6][_0x2bc7('0x2c')])&&_0x44a939[_0x2bc7('0x75')][_0x1ccbe6][_0x2bc7('0x76')]&&_0x44a939[_0x2bc7('0x75')][_0x1ccbe6][_0x2bc7('0x77')]&&_0x44a939[_0x2bc7('0x75')][_0x1ccbe6][_0x2bc7('0x78')]){_0x965271[_0x44a939['joins'][_0x1ccbe6][_0x2bc7('0x2c')]](_0x44a939[_0x2bc7('0x75')][_0x1ccbe6][_0x2bc7('0x77')],null,util[_0x2bc7('0x70')]('%s.%s\x20=\x20%s.%s',_0x44a939[_0x2bc7('0x6b')],_0x44a939[_0x2bc7('0x75')][_0x1ccbe6][_0x2bc7('0x76')],_0x44a939[_0x2bc7('0x75')][_0x1ccbe6]['foreignTable'],_0x44a939[_0x2bc7('0x75')][_0x1ccbe6][_0x2bc7('0x78')]));}}}if(_0x44a939[_0x2bc7('0x79')]){_0x44a939[_0x2bc7('0x79')]=JSON[_0x2bc7('0x7a')](_0x44a939[_0x2bc7('0x79')]);_0x965271[_0x2bc7('0x3b')](_0x8eda22(_0x44a939[_0x2bc7('0x79')][_0x2bc7('0x60')]));}_0x868914=_0x965271['clone']();_0x965271['limit'](_0xef8555);_0x965271[_0x2bc7('0x1d')](0x0);logger[_0x2bc7('0x7b')](_0x2bc7('0x7c'),_0x965271[_0x2bc7('0x7d')]());return dbH[_0x2bc7('0x7e')]['query'](_0x965271[_0x2bc7('0x7d')](),{'type':dbH[_0x2bc7('0x7e')]['QueryTypes'][_0x2bc7('0x7f')]});}})['then'](respondWithResult(_0x2b16a7,null))[_0x2bc7('0x42')](handleError(_0x2b16a7,null));};function runReport(_0x526486,_0x22d2b4,_0x3cecbe){var _0x306f19=_0x22d2b4[_0x2bc7('0x28')];var _0x5104f9=0xa;var _0x2a311c=[_0x2bc7('0x80'),_0x2bc7('0x81'),_0x2bc7('0x52'),_0x2bc7('0x53')];var _0x47b12f={'SUM':'SUM(%s)','COUNT':_0x2bc7('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x2bc7('0x58'),'GROUP_CONCAT ASC':_0x2bc7('0x59'),'GROUP_CONCAT DESC':_0x2bc7('0x82')};var _0x5a5670={'SEC_TO_TIME':_0x2bc7('0x5a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x2bc7('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x41e9f4=function(_0x2b8a6c){return!_[_0x2bc7('0x83')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x2bc7('0x84'),_0x2bc7('0x85')],_0x2b8a6c);};var _0x53ca6c=function(_0x131b36){if(!_0x131b36||!_0x131b36[_0x2bc7('0x5e')][_0x2bc7('0x35')]){return'';}for(var _0x3d0789='(',_0x4ac63a=0x0;_0x4ac63a<_0x131b36[_0x2bc7('0x5e')][_0x2bc7('0x35')];_0x4ac63a+=0x1){_0x4ac63a>0x0&&(_0x3d0789+='\x20'+_0x131b36[_0x2bc7('0x5f')]+'\x20');_0x3d0789+=_0x131b36['rules'][_0x4ac63a][_0x2bc7('0x60')]?_0x53ca6c(_0x131b36[_0x2bc7('0x5e')][_0x4ac63a][_0x2bc7('0x60')]):_0x131b36[_0x2bc7('0x5e')][_0x4ac63a][_0x2bc7('0x61')]+'\x20'+_0x131b36[_0x2bc7('0x5e')][_0x4ac63a]['condition']+(_0x41e9f4(_0x131b36[_0x2bc7('0x5e')][_0x4ac63a][_0x2bc7('0x62')])?'\x20'+_0x131b36['rules'][_0x4ac63a]['value']:'');}return _0x3d0789+')';};var _0x3199a8={'where':{'id':_0x526486['id']}},_0x3a1136,_0x5135d8,_0xff7f8d,_0x48b60a,_0x2bec90;_0x3199a8=_[_0x2bc7('0x46')]({},_0x3199a8,_0x3cecbe);return db[_0x2bc7('0x2b')][_0x2bc7('0x47')](_0x3199a8)[_0x2bc7('0x26')](function(_0x7dab56){if(_0x7dab56){_0x3a1136=_0x7dab56;return _0x7dab56[_0x2bc7('0x64')]();}return null;})[_0x2bc7('0x26')](function(_0x3f4b8c){if(_0x3f4b8c){if(!_0x3f4b8c[_0x2bc7('0x35')]){throw new db[(_0x2bc7('0x65'))][(_0x2bc7('0x66'))](_0x2bc7('0x86'),0x193);}_0x5135d8=_0x3f4b8c;return db[_0x2bc7('0x67')][_0x2bc7('0x40')]({'raw':!![]});}return null;})[_0x2bc7('0x26')](function(_0x4d8ba6){if(_0x4d8ba6){_0xff7f8d=_[_0x2bc7('0x68')](_0x4d8ba6,'id');var _0x3b894d;var _0x31e65d=squel[_0x2bc7('0x69')]();_0x31e65d[_0x2bc7('0x6a')](_0x3a1136['table']);for(var _0x27dfcb=0x0;_0x27dfcb<_0x5135d8[_0x2bc7('0x35')];_0x27dfcb+=0x1){_0x3b894d=_0x5135d8[_0x27dfcb]['MetricId']?_0xff7f8d[_0x5135d8[_0x27dfcb][_0x2bc7('0x6c')]][_0x2bc7('0x6d')]:_0x5135d8[_0x27dfcb]['field'];_0x3b894d=_0x5135d8[_0x27dfcb][_0x2bc7('0x6e')]?_[_0x2bc7('0x6f')](_0x47b12f[_0x5135d8[_0x27dfcb][_0x2bc7('0x6e')]],'%s',_0x3b894d):_0x3b894d;_0x3b894d=_0x5135d8[_0x27dfcb][_0x2bc7('0x70')]?_[_0x2bc7('0x6f')](_0x5a5670[_0x5135d8[_0x27dfcb][_0x2bc7('0x70')]],'%s',_0x3b894d):_0x3b894d;if(_0x5135d8[_0x27dfcb][_0x2bc7('0x71')]){_0x31e65d[_0x2bc7('0x60')](_0x3b894d);}_0x5135d8[_0x27dfcb]['orderBy']&&_0x31e65d[_0x2bc7('0x87')](_0x3b894d,_0x5135d8[_0x27dfcb]['orderBy']===_0x2bc7('0x73')?![]:!![]);_0x31e65d[_0x2bc7('0x61')](_0x3b894d,_0x5135d8[_0x27dfcb]['alias']||_0x3b894d);}if(_0x3a1136[_0x2bc7('0x75')]){_0x3a1136[_0x2bc7('0x75')]=JSON[_0x2bc7('0x7a')](_0x3a1136[_0x2bc7('0x75')]);for(var _0x831820=0x0;_0x831820<_0x3a1136['joins'][_0x2bc7('0x35')];_0x831820+=0x1){if(_0x3a1136['joins'][_0x831820][_0x2bc7('0x2c')]&&_[_0x2bc7('0x83')](_0x2a311c,_0x3a1136[_0x2bc7('0x75')][_0x831820][_0x2bc7('0x2c')])&&_0x3a1136[_0x2bc7('0x75')][_0x831820][_0x2bc7('0x76')]&&_0x3a1136['joins'][_0x831820]['foreignTable']&&_0x3a1136[_0x2bc7('0x75')][_0x831820][_0x2bc7('0x78')]){_0x31e65d[_0x3a1136['joins'][_0x831820][_0x2bc7('0x2c')]](_0x3a1136[_0x2bc7('0x75')][_0x831820][_0x2bc7('0x77')],null,util[_0x2bc7('0x70')](_0x2bc7('0x88'),_0x3a1136['table'],_0x3a1136['joins'][_0x831820][_0x2bc7('0x76')],_0x3a1136[_0x2bc7('0x75')][_0x831820][_0x2bc7('0x77')],_0x3a1136[_0x2bc7('0x75')][_0x831820][_0x2bc7('0x78')]));}}}if(_0x3a1136['conditions']){_0x3a1136['conditions']=JSON[_0x2bc7('0x7a')](_0x3a1136[_0x2bc7('0x79')]);_0x31e65d[_0x2bc7('0x3b')](_0x53ca6c(_0x3a1136['conditions']['group']));}_0x2bec90=_0x31e65d[_0x2bc7('0x89')]();_0x31e65d[_0x2bc7('0x1e')](_0x5104f9);_0x31e65d[_0x2bc7('0x1d')](0x0);return;}})[_0x2bc7('0x26')](function(){if(_0x22d2b4[_0x2bc7('0x8a')]===_0x2bc7('0x8b')){return null;}var _0x443a1f=_['merge'](_0x22d2b4,{'name':_0x22d2b4[_0x2bc7('0x8c')]||_0x22d2b4[_0x2bc7('0x28')]||_0x3a1136['name'],'basename':_0x306f19,'savename':util[_0x2bc7('0x70')](_0x2bc7('0x8d'),_0x22d2b4[_0x2bc7('0x28')]||_0x3a1136[_0x2bc7('0x28')],require(_0x2bc7('0x8e'))[_0x2bc7('0x8f')](0x4),_0x22d2b4[_0x2bc7('0x8a')]||_0x2bc7('0x90')),'reportId':_0x3a1136['id'],'reportType':_0x2bc7('0x91')});return db[_0x2bc7('0x92')][_0x2bc7('0x48')](_0x443a1f,{'raw':!![]});})[_0x2bc7('0x26')](function(_0x5552c4){if(_0x3a1136[_0x2bc7('0x6b')]===_0x2bc7('0x93')){_0x2bec90[_0x2bc7('0x3b')](_0x3a1136[_0x2bc7('0x6b')]+_0x2bc7('0x94'),_0x22d2b4[_0x2bc7('0x95')],_0x22d2b4['endDate']);}else{_0x2bec90[_0x2bc7('0x3b')](_0x3a1136[_0x2bc7('0x6b')]+_0x2bc7('0x96'),_0x22d2b4[_0x2bc7('0x95')],_0x22d2b4[_0x2bc7('0x97')]);}if(_0x5552c4){logger['info']('Run\x20Query:',_0x2bec90[_0x2bc7('0x7d')]());require('child_process')['fork'](path['join'](__dirname,_0x2bc7('0x98'),_0x5552c4[_0x2bc7('0x8a')]),[_0x5552c4['id'],_0x2bec90[_0x2bc7('0x7d')](),path[_0x2bc7('0x80')](__dirname,_0x2bc7('0x99'),_0x5552c4[_0x2bc7('0x9a')]),_0x306f19]);return _0x5552c4;}else{var _0x4eb581=squel['select']();_0x4eb581['from']('('+_0x2bec90['toString']()+')',_0x2bc7('0x9b'));_0x4eb581[_0x2bc7('0x61')](_0x2bc7('0x9c'),_0x2bc7('0x1c'));_0x2bec90['limit'](_0x22d2b4[_0x2bc7('0x1e')]||_0x5104f9);_0x2bec90['offset'](_0x22d2b4[_0x2bc7('0x1d')]||0x0);return dbH[_0x2bc7('0x7e')][_0x2bc7('0x30')](_0x4eb581[_0x2bc7('0x7d')](),{'type':dbH[_0x2bc7('0x7e')][_0x2bc7('0x9d')][_0x2bc7('0x7f')]})[_0x2bc7('0x26')](function(_0x510e99){if(!_0x510e99[_0x2bc7('0x35')]){_0x48b60a=0x0;}else{_0x48b60a=_0x510e99[0x0][_0x2bc7('0x1c')]||0x0;}return dbH[_0x2bc7('0x7e')]['query'](_0x2bec90[_0x2bc7('0x7d')](),{'type':dbH[_0x2bc7('0x7e')][_0x2bc7('0x9d')][_0x2bc7('0x7f')]});})[_0x2bc7('0x26')](function(_0x5e41a7){return{'rows':_0x5e41a7||[],'count':_0x48b60a};});}});}exports[_0x2bc7('0x9e')]=function(_0x1d51b2,_0x2c8cd8){return runReport(_0x1d51b2[_0x2bc7('0x44')],_0x1d51b2[_0x2bc7('0x30')],_0x1d51b2['options'])['then'](respondWithResult(_0x2c8cd8,null))[_0x2bc7('0x42')](handleError(_0x2c8cd8,null));};exports[_0x2bc7('0x9f')]=runReport;exports[_0x2bc7('0x30')]=function(_0x5f03f0,_0x44c6b1){var _0x3668cc=0xa;var _0x1a7c2b=[_0x2bc7('0x80'),_0x2bc7('0x81'),_0x2bc7('0x52'),'cross_join'];var _0x132922={'SUM':'SUM(%s)','COUNT':_0x2bc7('0x54'),'COUNT DISTINCT':_0x2bc7('0x55'),'MAX':_0x2bc7('0xa0'),'MIN':_0x2bc7('0x56'),'AVG':_0x2bc7('0x57'),'GROUP_CONCAT':_0x2bc7('0x58'),'GROUP_CONCAT ASC':_0x2bc7('0x59'),'GROUP_CONCAT DESC':_0x2bc7('0x82')};var _0x3e382e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2bc7('0xa1'),'HOUR':_0x2bc7('0x5b'),'ROUND':_0x2bc7('0x5c'),'UNIX_TIMESTAMP':_0x2bc7('0xa2')};var _0x25bc03=function(_0x47e150){return!_[_0x2bc7('0x83')]([_0x2bc7('0x5d'),'IS\x20NOT\x20NULL',_0x2bc7('0x84'),_0x2bc7('0x85')],_0x47e150);};var _0x6cba5d=function(_0x522f87){if(!_0x522f87||!_0x522f87[_0x2bc7('0x5e')][_0x2bc7('0x35')]){return'';}for(var _0x5c8677='(',_0x52191e=0x0;_0x52191e<_0x522f87[_0x2bc7('0x5e')][_0x2bc7('0x35')];_0x52191e+=0x1){_0x52191e>0x0&&(_0x5c8677+='\x20'+_0x522f87[_0x2bc7('0x5f')]+'\x20');_0x5c8677+=_0x522f87[_0x2bc7('0x5e')][_0x52191e][_0x2bc7('0x60')]?_0x6cba5d(_0x522f87['rules'][_0x52191e][_0x2bc7('0x60')]):_0x522f87[_0x2bc7('0x5e')][_0x52191e][_0x2bc7('0x61')]+'\x20'+_0x522f87['rules'][_0x52191e][_0x2bc7('0x62')]+(_0x25bc03(_0x522f87[_0x2bc7('0x5e')][_0x52191e]['condition'])?'\x20'+_0x522f87['rules'][_0x52191e][_0x2bc7('0x63')]:'');}return _0x5c8677+')';};var _0x143182={'where':{'id':_0x5f03f0[_0x2bc7('0x44')]['id']}},_0x69f9ac,_0x2c6857,_0x567633,_0x26982c,_0x30806a;_0x143182=_[_0x2bc7('0x46')]({},_0x143182,_0x5f03f0[_0x2bc7('0x3d')]);return db[_0x2bc7('0x2b')]['find'](_0x143182)['then'](function(_0x51721b){if(_0x51721b){_0x69f9ac=_0x51721b;return _0x51721b[_0x2bc7('0x64')]();}return null;})[_0x2bc7('0x26')](function(_0x105c35){if(_0x105c35){if(!_0x105c35[_0x2bc7('0x35')]){throw new db[(_0x2bc7('0x65'))][(_0x2bc7('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2c6857=_0x105c35;return db[_0x2bc7('0x67')][_0x2bc7('0x40')]({'raw':!![]});}return null;})[_0x2bc7('0x26')](function(_0x34e9ca){if(_0x34e9ca){_0x567633=_[_0x2bc7('0x68')](_0x34e9ca,'id');var _0x2e2173;var _0x1df853=squel[_0x2bc7('0x69')]();_0x1df853[_0x2bc7('0x6a')](_0x69f9ac['table']);for(var _0x18e8ed=0x0;_0x18e8ed<_0x2c6857[_0x2bc7('0x35')];_0x18e8ed+=0x1){_0x2e2173=_0x2c6857[_0x18e8ed][_0x2bc7('0x6c')]?_0x567633[_0x2c6857[_0x18e8ed][_0x2bc7('0x6c')]]['metric']:_0x2c6857[_0x18e8ed][_0x2bc7('0x61')];_0x2e2173=_0x2c6857[_0x18e8ed][_0x2bc7('0x6e')]?_[_0x2bc7('0x6f')](_0x132922[_0x2c6857[_0x18e8ed]['function']],'%s',_0x2e2173):_0x2e2173;_0x2e2173=_0x2c6857[_0x18e8ed]['format']?_[_0x2bc7('0x6f')](_0x3e382e[_0x2c6857[_0x18e8ed]['format']],'%s',_0x2e2173):_0x2e2173;if(_0x2c6857[_0x18e8ed][_0x2bc7('0x71')]){_0x1df853['group'](_0x2e2173);}_0x2c6857[_0x18e8ed][_0x2bc7('0x72')]&&_0x1df853[_0x2bc7('0x87')](_0x2e2173,_0x2c6857[_0x18e8ed][_0x2bc7('0x72')]===_0x2bc7('0x73')?![]:!![]);_0x1df853[_0x2bc7('0x61')](_0x2e2173,_0x2c6857[_0x18e8ed][_0x2bc7('0x74')]||_0x2e2173);}if(_0x69f9ac['joins']){_0x69f9ac[_0x2bc7('0x75')]=JSON[_0x2bc7('0x7a')](_0x69f9ac[_0x2bc7('0x75')]);for(var _0x41eb6b=0x0;_0x41eb6b<_0x69f9ac[_0x2bc7('0x75')][_0x2bc7('0x35')];_0x41eb6b+=0x1){if(_0x69f9ac['joins'][_0x41eb6b]['type']&&_['includes'](_0x1a7c2b,_0x69f9ac['joins'][_0x41eb6b][_0x2bc7('0x2c')])&&_0x69f9ac[_0x2bc7('0x75')][_0x41eb6b][_0x2bc7('0x76')]&&_0x69f9ac[_0x2bc7('0x75')][_0x41eb6b][_0x2bc7('0x77')]&&_0x69f9ac[_0x2bc7('0x75')][_0x41eb6b][_0x2bc7('0x78')]){_0x1df853[_0x69f9ac[_0x2bc7('0x75')][_0x41eb6b][_0x2bc7('0x2c')]](_0x69f9ac[_0x2bc7('0x75')][_0x41eb6b][_0x2bc7('0x77')],null,util['format'](_0x2bc7('0x88'),_0x69f9ac[_0x2bc7('0x6b')],_0x69f9ac[_0x2bc7('0x75')][_0x41eb6b][_0x2bc7('0x76')],_0x69f9ac[_0x2bc7('0x75')][_0x41eb6b]['foreignTable'],_0x69f9ac['joins'][_0x41eb6b]['foreignKey']));}}}if(_0x69f9ac['conditions']){_0x69f9ac[_0x2bc7('0x79')]=JSON[_0x2bc7('0x7a')](_0x69f9ac[_0x2bc7('0x79')]);_0x1df853[_0x2bc7('0x3b')](_0x6cba5d(_0x69f9ac[_0x2bc7('0x79')]['group']));}_0x30806a=_0x1df853['clone']();_0x1df853['limit'](_0x3668cc);_0x1df853['offset'](0x0);logger[_0x2bc7('0x7b')](_0x2bc7('0x7c'),_0x1df853[_0x2bc7('0x7d')]());return dbH['sequelize'][_0x2bc7('0x30')](_0x1df853[_0x2bc7('0x7d')](),{'type':dbH['sequelize'][_0x2bc7('0x9d')][_0x2bc7('0x7f')]});}})[_0x2bc7('0x26')](function(){return{'sql':_0x30806a[_0x2bc7('0x7d')]()};})[_0x2bc7('0x26')](respondWithResult(_0x44c6b1,null))[_0x2bc7('0x42')](handleError(_0x44c6b1,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index bd97ff5..dfd4133 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 _0xd332=['api','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x308533,_0x148224){var _0xcc1de5=function(_0x5dfb67){while(--_0x5dfb67){_0x308533['push'](_0x308533['shift']());}};_0xcc1de5(++_0x148224);}(_0xd332,0xdb));var _0x2d33=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xd332[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x2d33('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d33('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d33('0x2'));var fs=require('fs');var path=require(_0x2d33('0x3'));var rimraf=require(_0x2d33('0x4'));var config=require(_0x2d33('0x5'));var attributes=require(_0x2d33('0x6'));module['exports']=function(_0x7f2007,_0xaf40e){return _0x7f2007[_0x2d33('0x7')](_0x2d33('0x8'),attributes,{'tableName':_0x2d33('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe249=['../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','lodash','util'];(function(_0x55a460,_0x9bb1e0){var _0x52a8e5=function(_0x194eb5){while(--_0x194eb5){_0x55a460['push'](_0x55a460['shift']());}};_0x52a8e5(++_0x9bb1e0);}(_0xe249,0x8d));var _0x9e24=function(_0x16b28b,_0x4129fc){_0x16b28b=_0x16b28b-0x0;var _0x14f609=_0xe249[_0x16b28b];return _0x14f609;};'use strict';var _=require(_0x9e24('0x0'));var util=require(_0x9e24('0x1'));var logger=require(_0x9e24('0x2'))(_0x9e24('0x3'));var moment=require(_0x9e24('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e24('0x5'));var rimraf=require(_0x9e24('0x6'));var config=require(_0x9e24('0x7'));var attributes=require(_0x9e24('0x8'));module['exports']=function(_0x5757e9,_0x3ccefa){return _0x5757e9[_0x9e24('0x9')](_0x9e24('0xa'),attributes,{'tableName':'analytics_custom_reports','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 624a81b..3f825a7 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 _0x05a8=['info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x59eb67,_0x556537){var _0x1f95f6=function(_0x2139ac){while(--_0x2139ac){_0x59eb67['push'](_0x59eb67['shift']());}};_0x1f95f6(++_0x556537);}(_0x05a8,0x1d6));var _0x805a=function(_0x43a6df,_0xd9baf8){_0x43a6df=_0x43a6df-0x0;var _0x390f81=_0x05a8[_0x43a6df];return _0x390f81;};'use strict';var _=require(_0x805a('0x0'));var util=require(_0x805a('0x1'));var moment=require(_0x805a('0x2'));var BPromise=require(_0x805a('0x3'));var rs=require(_0x805a('0x4'));var fs=require('fs');var Redis=require(_0x805a('0x5'));var db=require(_0x805a('0x6'))['db'];var utils=require(_0x805a('0x7'));var logger=require('../../config/logger')(_0x805a('0x8'));var config=require('../../config/environment');var jayson=require(_0x805a('0x9'));var client=jayson[_0x805a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3758d6,_0x40f61e,_0x4e9cae){return new BPromise(function(_0x28964e,_0x2d7dcc){return client[_0x805a('0xb')](_0x3758d6,_0x4e9cae)[_0x805a('0xc')](function(_0x4d05a6){logger[_0x805a('0xd')](_0x805a('0xe'),_0x40f61e,'request\x20sent');logger[_0x805a('0xf')](_0x805a('0x10'),_0x40f61e,_0x805a('0x11'),JSON['stringify'](_0x4d05a6));if(_0x4d05a6[_0x805a('0x12')]){if(_0x4d05a6[_0x805a('0x12')][_0x805a('0x13')]===0x1f4){logger[_0x805a('0x12')](_0x805a('0xe'),_0x40f61e,_0x4d05a6['error'][_0x805a('0x14')]);return _0x2d7dcc(_0x4d05a6['error'][_0x805a('0x14')]);}logger[_0x805a('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x40f61e,_0x4d05a6[_0x805a('0x12')]['message']);return _0x28964e(_0x4d05a6[_0x805a('0x12')][_0x805a('0x14')]);}else{logger[_0x805a('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x40f61e,_0x805a('0x11'));_0x28964e(_0x4d05a6[_0x805a('0x15')][_0x805a('0x14')]);}})[_0x805a('0x16')](function(_0xb56dd){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x40f61e,_0xb56dd);_0x2d7dcc(_0xb56dd);});});} \ No newline at end of file +var _0xb124=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb124,0x15b));var _0x4b12=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb124[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x4b12('0x0'));var moment=require(_0x4b12('0x1'));var BPromise=require(_0x4b12('0x2'));var rs=require(_0x4b12('0x3'));var fs=require('fs');var Redis=require(_0x4b12('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4b12('0x5'))(_0x4b12('0x6'));var config=require(_0x4b12('0x7'));var jayson=require(_0x4b12('0x8'));var client=jayson[_0x4b12('0x9')][_0x4b12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17e026,_0x33c314,_0x1b50e4){return new BPromise(function(_0x4cb14a,_0x2ac0ad){return client[_0x4b12('0xb')](_0x17e026,_0x1b50e4)[_0x4b12('0xc')](function(_0x50bff0){logger[_0x4b12('0xd')](_0x4b12('0xe'),_0x33c314,_0x4b12('0xf'));logger[_0x4b12('0x10')](_0x4b12('0x11'),_0x33c314,_0x4b12('0xf'),JSON['stringify'](_0x50bff0));if(_0x50bff0[_0x4b12('0x12')]){if(_0x50bff0[_0x4b12('0x12')][_0x4b12('0x13')]===0x1f4){logger[_0x4b12('0x12')](_0x4b12('0xe'),_0x33c314,_0x50bff0[_0x4b12('0x12')]['message']);return _0x2ac0ad(_0x50bff0[_0x4b12('0x12')][_0x4b12('0x14')]);}logger[_0x4b12('0x12')](_0x4b12('0xe'),_0x33c314,_0x50bff0[_0x4b12('0x12')][_0x4b12('0x14')]);return _0x4cb14a(_0x50bff0['error'][_0x4b12('0x14')]);}else{logger[_0x4b12('0xd')](_0x4b12('0xe'),_0x33c314,_0x4b12('0xf'));_0x4cb14a(_0x50bff0[_0x4b12('0x15')][_0x4b12('0x14')]);}})[_0x4b12('0x16')](function(_0x2bca2a){logger[_0x4b12('0x12')](_0x4b12('0xe'),_0x33c314,_0x2bca2a);_0x2ac0ad(_0x2bca2a);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 6ed279c..9fddc69 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 _0x14bc=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','create','put'];(function(_0x2c3514,_0x5604d4){var _0x22ab07=function(_0x21acce){while(--_0x21acce){_0x2c3514['push'](_0x2c3514['shift']());}};_0x22ab07(++_0x5604d4);}(_0x14bc,0x18b));var _0xc14b=function(_0xa59a57,_0xb02496){_0xa59a57=_0xa59a57-0x0;var _0x2b8cf2=_0x14bc[_0xa59a57];return _0x2b8cf2;};'use strict';var multer=require(_0xc14b('0x0'));var util=require('util');var path=require(_0xc14b('0x1'));var timeout=require(_0xc14b('0x2'));var express=require(_0xc14b('0x3'));var router=express[_0xc14b('0x4')]();var auth=require(_0xc14b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc14b('0x6'));var controller=require('./analyticCustomReport.controller');router[_0xc14b('0x7')]('/',auth[_0xc14b('0x8')](),controller[_0xc14b('0x9')]);router[_0xc14b('0x7')](_0xc14b('0xa'),auth[_0xc14b('0x8')](),controller[_0xc14b('0xb')]);router[_0xc14b('0x7')](_0xc14b('0xc'),auth[_0xc14b('0x8')](),controller[_0xc14b('0xd')]);router[_0xc14b('0x7')](_0xc14b('0xe'),auth[_0xc14b('0x8')](),controller['run']);router[_0xc14b('0x7')](_0xc14b('0xf'),auth[_0xc14b('0x8')](),controller[_0xc14b('0x10')]);router['post']('/',auth[_0xc14b('0x8')](),controller[_0xc14b('0x11')]);router[_0xc14b('0x12')]('/:id',auth[_0xc14b('0x8')](),controller[_0xc14b('0x13')]);router[_0xc14b('0x14')](_0xc14b('0xa'),auth['isAuthenticated'](),controller[_0xc14b('0x15')]);module[_0xc14b('0x16')]=router; \ No newline at end of file +var _0x00d0=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','delete','destroy','exports','multer','util'];(function(_0xf70b25,_0x235532){var _0x5f0a55=function(_0x1588c8){while(--_0x1588c8){_0xf70b25['push'](_0xf70b25['shift']());}};_0x5f0a55(++_0x235532);}(_0x00d0,0x16a));var _0x000d=function(_0x25dfc0,_0x1478d2){_0x25dfc0=_0x25dfc0-0x0;var _0x387d60=_0x00d0[_0x25dfc0];return _0x387d60;};'use strict';var multer=require(_0x000d('0x0'));var util=require(_0x000d('0x1'));var path=require(_0x000d('0x2'));var timeout=require('connect-timeout');var express=require(_0x000d('0x3'));var router=express[_0x000d('0x4')]();var auth=require(_0x000d('0x5'));var interaction=require(_0x000d('0x6'));var config=require(_0x000d('0x7'));var controller=require(_0x000d('0x8'));router[_0x000d('0x9')]('/',auth[_0x000d('0xa')](),controller[_0x000d('0xb')]);router[_0x000d('0x9')](_0x000d('0xc'),auth[_0x000d('0xa')](),controller[_0x000d('0xd')]);router['get'](_0x000d('0xe'),auth[_0x000d('0xa')](),controller[_0x000d('0xf')]);router[_0x000d('0x9')](_0x000d('0x10'),auth[_0x000d('0xa')](),controller[_0x000d('0x11')]);router['get'](_0x000d('0x12'),auth[_0x000d('0xa')](),controller[_0x000d('0x13')]);router[_0x000d('0x14')]('/',auth[_0x000d('0xa')](),controller[_0x000d('0x15')]);router[_0x000d('0x16')](_0x000d('0xc'),auth[_0x000d('0xa')](),controller['update']);router[_0x000d('0x17')]('/:id',auth[_0x000d('0xa')](),controller[_0x000d('0x18')]);module[_0x000d('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 660dc5f..32e3eba 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 _0xbb74=['sequelize','exports','STRING','TEXT'];(function(_0x3cf05b,_0x5c4891){var _0x13f90f=function(_0x30dd5b){while(--_0x30dd5b){_0x3cf05b['push'](_0x3cf05b['shift']());}};_0x13f90f(++_0x5c4891);}(_0xbb74,0x198));var _0x4bb7=function(_0x25e1c5,_0x215b3a){_0x25e1c5=_0x25e1c5-0x0;var _0xa4a9d5=_0xbb74[_0x25e1c5];return _0xa4a9d5;};'use strict';var Sequelize=require(_0x4bb7('0x0'));module[_0x4bb7('0x1')]={'name':{'type':Sequelize[_0x4bb7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4bb7('0x2')]},'parent':{'type':Sequelize[_0x4bb7('0x2')]},'table':{'type':Sequelize[_0x4bb7('0x2')]},'conditions':{'type':Sequelize[_0x4bb7('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8e71=['sequelize','exports','STRING','TEXT'];(function(_0x593381,_0x1a620b){var _0x5ea5ba=function(_0x49d044){while(--_0x49d044){_0x593381['push'](_0x593381['shift']());}};_0x5ea5ba(++_0x1a620b);}(_0x8e71,0xec));var _0x18e7=function(_0x3bf3f1,_0x5b8238){_0x3bf3f1=_0x3bf3f1-0x0;var _0x5a0c0c=_0x8e71[_0x3bf3f1];return _0x5a0c0c;};'use strict';var Sequelize=require(_0x18e7('0x0'));module[_0x18e7('0x1')]={'name':{'type':Sequelize[_0x18e7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x18e7('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x18e7('0x2')]},'conditions':{'type':Sequelize[_0x18e7('0x3')]},'joins':{'type':Sequelize[_0x18e7('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 8fbeb93..12d105e 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 _0xf19e=['joins','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','getFields','orderBy','alias','output','web','%s-%s.%s','randomstring','generate','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','HOUR(%s)','debug','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','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','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','params','includeAll','find','catch','body','user','get','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','replace','format','groupBy','order','DESC'];(function(_0x515a1a,_0xd494d9){var _0x5a73ad=function(_0x45585a){while(--_0x45585a){_0x515a1a['push'](_0x515a1a['shift']());}};_0x5a73ad(++_0xd494d9);}(_0xf19e,0xd4));var _0xef19=function(_0x53cf37,_0x58e04c){_0x53cf37=_0x53cf37-0x0;var _0x302357=_0xf19e[_0x53cf37];return _0x302357;};'use strict';var pdf=require(_0xef19('0x0'));var emlformat=require(_0xef19('0x1'));var rimraf=require(_0xef19('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xef19('0x3'));var BPromise=require(_0xef19('0x4'));var Mustache=require(_0xef19('0x5'));var util=require(_0xef19('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xef19('0x7'));var ejs=require(_0xef19('0x8'));var fs=require('fs');var _=require(_0xef19('0x9'));var squel=require(_0xef19('0xa'));var crypto=require('crypto');var jsforce=require(_0xef19('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xef19('0xc'));var Papa=require(_0xef19('0xd'));var Redis=require(_0xef19('0xe'));var authService=require(_0xef19('0xf'));var qs=require(_0xef19('0x10'));var as=require(_0xef19('0x11'));var hardwareService=require(_0xef19('0x12'));var logger=require(_0xef19('0x13'))(_0xef19('0x14'));var utils=require(_0xef19('0x15'));var config=require(_0xef19('0x16'));var licenseUtil=require(_0xef19('0x17'));var db=require(_0xef19('0x18'))['db'];var dbH=require(_0xef19('0x18'))['dbH'];function respondWithStatusCode(_0x158744,_0xadc261){_0xadc261=_0xadc261||0xcc;return function(_0x9ad479){if(_0x9ad479){return _0x158744[_0xef19('0x19')](_0xadc261);}return _0x158744[_0xef19('0x1a')](_0xadc261)[_0xef19('0x1b')]();};}function respondWithResult(_0x59b336,_0x2a905c){_0x2a905c=_0x2a905c||0xc8;return function(_0x443c17){if(_0x443c17){return _0x59b336[_0xef19('0x1a')](_0x2a905c)[_0xef19('0x1c')](_0x443c17);}};}function respondWithFilteredResult(_0x38cca9,_0x1f638d){return function(_0x278ac0){if(_0x278ac0){var _0x3195c6=_0x278ac0[_0xef19('0x1d')],_0x38ad31=_0x1f638d[_0xef19('0x1e')],_0x3de07=_0x1f638d[_0xef19('0x1e')]+_0x1f638d['limit'],_0x4a562f;if(_0x3de07>=_0x3195c6){_0x3de07=_0x3195c6;_0x4a562f=0xc8;}else{_0x4a562f=0xce;}_0x38cca9[_0xef19('0x1a')](_0x4a562f);return _0x38cca9[_0xef19('0x1f')](_0xef19('0x20'),_0x38ad31+'-'+_0x3de07+'/'+_0x3195c6)['json'](_0x278ac0);}return null;};}function patchUpdates(_0x46e5d1){return function(_0x2970cf){try{jsonpatch[_0xef19('0x21')](_0x2970cf,_0x46e5d1,!![]);}catch(_0x5e7e2e){return BPromise[_0xef19('0x22')](_0x5e7e2e);}return _0x2970cf[_0xef19('0x23')]();};}function saveUpdates(_0x13da51,_0x3556c8){return function(_0x7352cd){if(_0x7352cd){return _0x7352cd[_0xef19('0x24')](_0x13da51)[_0xef19('0x25')](function(_0x4a3b85){return _0x4a3b85;});}return null;};}function removeEntity(_0x32ceca,_0x39c30d){return function(_0x5ab62c){if(_0x5ab62c){return _0x5ab62c[_0xef19('0x26')]()[_0xef19('0x25')](function(){var _0x415e7a=_0x5ab62c['get']({'plain':!![]});var _0x13b890='DefaultReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x13b890,'resourceId':_0x415e7a['id']}})[_0xef19('0x25')](function(){return _0x5ab62c;});})[_0xef19('0x25')](function(){_0x32ceca[_0xef19('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x442d78,_0x51a75b){return function(_0x1a67d8){if(!_0x1a67d8){_0x442d78[_0xef19('0x19')](0x194);}return _0x1a67d8;};}function handleError(_0x10148b,_0x22090a){_0x22090a=_0x22090a||0x1f4;return function(_0x23deeb){logger['error'](_0x23deeb[_0xef19('0x27')]);if(_0x23deeb['name']){delete _0x23deeb['name'];}_0x10148b['status'](_0x22090a)[_0xef19('0x28')](_0x23deeb);};}exports[_0xef19('0x29')]=function(_0x2f8bbd,_0x417ac4){var _0x108115={},_0x38a964={},_0x14523d={'count':0x0,'rows':[]};var _0x12da8d=_[_0xef19('0x2a')](db[_0xef19('0x2b')][_0xef19('0x2c')],function(_0x1a4137){return{'name':_0x1a4137[_0xef19('0x2d')],'type':_0x1a4137[_0xef19('0x2e')][_0xef19('0x2f')]};});_0x38a964[_0xef19('0x30')]=_['map'](_0x12da8d,_0xef19('0x31'));_0x38a964['query']=_[_0xef19('0x32')](_0x2f8bbd['query']);_0x38a964[_0xef19('0x33')]=_[_0xef19('0x34')](_0x38a964[_0xef19('0x30')],_0x38a964['query']);_0x108115[_0xef19('0x35')]=_[_0xef19('0x34')](_0x38a964['model'],qs[_0xef19('0x36')](_0x2f8bbd[_0xef19('0x37')][_0xef19('0x36')]));_0x108115['attributes']=_0x108115[_0xef19('0x35')][_0xef19('0x38')]?_0x108115[_0xef19('0x35')]:_0x38a964[_0xef19('0x30')];if(!_0x2f8bbd[_0xef19('0x37')][_0xef19('0x39')]('nolimit')){_0x108115[_0xef19('0x3a')]=qs[_0xef19('0x3a')](_0x2f8bbd[_0xef19('0x37')][_0xef19('0x3a')]);_0x108115[_0xef19('0x1e')]=qs['offset'](_0x2f8bbd[_0xef19('0x37')][_0xef19('0x1e')]);}_0x108115['order']=qs['sort'](_0x2f8bbd[_0xef19('0x37')][_0xef19('0x3b')]);_0x108115[_0xef19('0x3c')]=qs[_0xef19('0x33')](_[_0xef19('0x3d')](_0x2f8bbd[_0xef19('0x37')],_0x38a964[_0xef19('0x33')]),_0x12da8d);if(_0x2f8bbd[_0xef19('0x37')]['filter']){_0x108115[_0xef19('0x3c')]=_[_0xef19('0x3e')](_0x108115[_0xef19('0x3c')],{'$or':_[_0xef19('0x2a')](_0x12da8d,function(_0x14a1eb){if(_0x14a1eb['type']!==_0xef19('0x3f')){var _0x3ed1db={};_0x3ed1db[_0x14a1eb[_0xef19('0x31')]]={'$like':'%'+_0x2f8bbd[_0xef19('0x37')][_0xef19('0x40')]+'%'};return _0x3ed1db;}})});}_0x108115=_['merge']({},_0x108115,_0x2f8bbd[_0xef19('0x41')]);var _0x2a8fb5={'where':_0x108115[_0xef19('0x3c')]};return db[_0xef19('0x2b')][_0xef19('0x1d')](_0x2a8fb5)[_0xef19('0x25')](function(_0x1c2b28){_0x14523d[_0xef19('0x1d')]=_0x1c2b28;if(_0x2f8bbd[_0xef19('0x37')]['includeAll']){_0x108115[_0xef19('0x42')]=[{'all':!![]}];}return db[_0xef19('0x2b')][_0xef19('0x43')](_0x108115);})[_0xef19('0x25')](function(_0x5d9db2){_0x14523d['rows']=_0x5d9db2;return _0x14523d;})[_0xef19('0x25')](respondWithFilteredResult(_0x417ac4,_0x108115))['catch'](handleError(_0x417ac4,null));};exports['show']=function(_0x51e89f,_0x5e9798){var _0xab922={'raw':!![],'where':{'id':_0x51e89f[_0xef19('0x44')]['id']}},_0x51067a={};_0x51067a[_0xef19('0x30')]=_['keys'](db[_0xef19('0x2b')][_0xef19('0x2c')]);_0x51067a[_0xef19('0x37')]=_['keys'](_0x51e89f[_0xef19('0x37')]);_0x51067a[_0xef19('0x33')]=_[_0xef19('0x34')](_0x51067a[_0xef19('0x30')],_0x51067a[_0xef19('0x37')]);_0xab922[_0xef19('0x35')]=_[_0xef19('0x34')](_0x51067a[_0xef19('0x30')],qs['fields'](_0x51e89f[_0xef19('0x37')][_0xef19('0x36')]));_0xab922[_0xef19('0x35')]=_0xab922[_0xef19('0x35')][_0xef19('0x38')]?_0xab922[_0xef19('0x35')]:_0x51067a[_0xef19('0x30')];if(_0x51e89f[_0xef19('0x37')][_0xef19('0x45')]){_0xab922[_0xef19('0x42')]=[{'all':!![]}];}_0xab922=_[_0xef19('0x3e')]({},_0xab922,_0x51e89f['options']);return db[_0xef19('0x2b')][_0xef19('0x46')](_0xab922)[_0xef19('0x25')](handleEntityNotFound(_0x5e9798,null))[_0xef19('0x25')](respondWithResult(_0x5e9798,null))[_0xef19('0x47')](handleError(_0x5e9798,null));};exports['create']=function(_0xdccf66,_0x4d1d96){return db[_0xef19('0x2b')]['create'](_0xdccf66[_0xef19('0x48')],{})['then'](function(_0x9c0d57){var _0x5dce57=_0xdccf66[_0xef19('0x49')][_0xef19('0x4a')]({'plain':!![]});if(!_0x5dce57)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5dce57[_0xef19('0x4b')]==='user'){var _0x5b50aa=_0x9c0d57[_0xef19('0x4a')]({'plain':!![]});var _0x2dc29f=_0xef19('0x4c');return db[_0xef19('0x4d')]['find']({'where':{'name':_0x2dc29f,'userProfileId':_0x5dce57[_0xef19('0x4e')]},'raw':!![]})['then'](function(_0x108578){if(_0x108578&&_0x108578[_0xef19('0x4f')]===0x0){return db[_0xef19('0x50')][_0xef19('0x51')]({'name':_0x5b50aa['name'],'resourceId':_0x5b50aa['id'],'type':'DefaultReports','sectionId':_0x108578['id']},{})[_0xef19('0x25')](function(){return _0x9c0d57;});}else{return _0x9c0d57;}})[_0xef19('0x47')](function(_0x4ae6f3){logger[_0xef19('0x52')](_0xef19('0x53'),_0x4ae6f3);throw _0x4ae6f3;});}return _0x9c0d57;})[_0xef19('0x25')](respondWithResult(_0x4d1d96,0xc9))[_0xef19('0x47')](handleError(_0x4d1d96,null));};exports['update']=function(_0x57a347,_0x38a9f7){if(_0x57a347['body']['id']){delete _0x57a347[_0xef19('0x48')]['id'];}return db[_0xef19('0x2b')][_0xef19('0x46')]({'where':{'id':_0x57a347[_0xef19('0x44')]['id']}})[_0xef19('0x25')](handleEntityNotFound(_0x38a9f7,null))[_0xef19('0x25')](saveUpdates(_0x57a347[_0xef19('0x48')],null))['then'](respondWithResult(_0x38a9f7,null))['catch'](handleError(_0x38a9f7,null));};exports[_0xef19('0x26')]=function(_0x43b711,_0x728e1f){return db[_0xef19('0x2b')][_0xef19('0x46')]({'where':{'id':_0x43b711[_0xef19('0x44')]['id']}})[_0xef19('0x25')](handleEntityNotFound(_0x728e1f,null))[_0xef19('0x25')](removeEntity(_0x728e1f,null))['catch'](handleError(_0x728e1f,null));};exports[_0xef19('0x54')]=function(_0x5a3055,_0x27681c){var _0x42b681=0xa;var _0xa5c142=[_0xef19('0x55'),_0xef19('0x56'),'right_join','cross_join'];var _0x4613f9={'SUM':_0xef19('0x57'),'COUNT':_0xef19('0x58'),'COUNT DISTINCT':_0xef19('0x59'),'MAX':_0xef19('0x5a'),'MIN':_0xef19('0x5b'),'AVG':_0xef19('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xef19('0x5d')};var _0x3c6240={'SEC_TO_TIME':_0xef19('0x5e'),'DATE':_0xef19('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xef19('0x60'),'UNIX_TIMESTAMP':_0xef19('0x61')};var _0x1442bb=function(_0x3d5cac){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xef19('0x62')],_0x3d5cac);};var _0x2f227c=function(_0x9b93b){if(!_0x9b93b||!_0x9b93b[_0xef19('0x63')][_0xef19('0x38')]){return'';}for(var _0x4a2355='(',_0x101a9f=0x0;_0x101a9f<_0x9b93b[_0xef19('0x63')][_0xef19('0x38')];_0x101a9f+=0x1){_0x101a9f>0x0&&(_0x4a2355+='\x20'+_0x9b93b[_0xef19('0x64')]+'\x20');_0x4a2355+=_0x9b93b[_0xef19('0x63')][_0x101a9f]['group']?_0x2f227c(_0x9b93b['rules'][_0x101a9f][_0xef19('0x65')]):_0x9b93b[_0xef19('0x63')][_0x101a9f]['field']+'\x20'+_0x9b93b[_0xef19('0x63')][_0x101a9f][_0xef19('0x66')]+(_0x1442bb(_0x9b93b[_0xef19('0x63')][_0x101a9f][_0xef19('0x66')])?'\x20'+_0x9b93b[_0xef19('0x63')][_0x101a9f][_0xef19('0x67')]:'');}return _0x4a2355+')';};var _0x434c8f={'where':{'id':_0x5a3055[_0xef19('0x44')]['id']}},_0x4ec226,_0x15e1ac,_0x14fbae,_0x586fda,_0x4a960f;_0x434c8f=_['merge']({},_0x434c8f,_0x5a3055[_0xef19('0x41')]);return db[_0xef19('0x2b')][_0xef19('0x46')](_0x434c8f)[_0xef19('0x25')](function(_0x552435){if(_0x552435){_0x4ec226=_0x552435;return _0x552435['getFields']();}return null;})[_0xef19('0x25')](function(_0x28215c){if(_0x28215c){if(!_0x28215c[_0xef19('0x38')]){throw new db['Sequelize'][(_0xef19('0x68'))](_0xef19('0x69'),0x193);}_0x15e1ac=_0x28215c;return db[_0xef19('0x6a')][_0xef19('0x43')]({'raw':!![]});}return null;})['then'](function(_0x5cc429){if(_0x5cc429){_0x14fbae=_[_0xef19('0x6b')](_0x5cc429,'id');var _0x3ce6ad;var _0x1e1092=squel[_0xef19('0x6c')]();_0x1e1092[_0xef19('0x6d')](_0x4ec226[_0xef19('0x6e')]);for(var _0x35ad97=0x0;_0x35ad97<_0x15e1ac[_0xef19('0x38')];_0x35ad97+=0x1){_0x3ce6ad=_0x15e1ac[_0x35ad97][_0xef19('0x6f')]?_0x14fbae[_0x15e1ac[_0x35ad97]['MetricId']][_0xef19('0x70')]:_0x15e1ac[_0x35ad97][_0xef19('0x71')];_0x3ce6ad=_0x15e1ac[_0x35ad97][_0xef19('0x72')]?_[_0xef19('0x73')](_0x4613f9[_0x15e1ac[_0x35ad97]['function']],'%s',_0x3ce6ad):_0x3ce6ad;_0x3ce6ad=_0x15e1ac[_0x35ad97][_0xef19('0x74')]?_['replace'](_0x3c6240[_0x15e1ac[_0x35ad97][_0xef19('0x74')]],'%s',_0x3ce6ad):_0x3ce6ad;if(_0x15e1ac[_0x35ad97][_0xef19('0x75')]){_0x1e1092[_0xef19('0x65')](_0x3ce6ad);}_0x15e1ac[_0x35ad97]['orderBy']&&_0x1e1092[_0xef19('0x76')](_0x3ce6ad,_0x15e1ac[_0x35ad97]['orderBy']===_0xef19('0x77')?![]:!![]);_0x1e1092[_0xef19('0x71')](_0x3ce6ad,_0x15e1ac[_0x35ad97]['alias']||_0x3ce6ad);}if(_0x4ec226['joins']){_0x4ec226['joins']=JSON['parse'](_0x4ec226[_0xef19('0x78')]);for(var _0x56bf6c=0x0;_0x56bf6c<_0x4ec226['joins'][_0xef19('0x38')];_0x56bf6c+=0x1){if(_0x4ec226[_0xef19('0x78')][_0x56bf6c]['type']&&_[_0xef19('0x79')](_0xa5c142,_0x4ec226[_0xef19('0x78')][_0x56bf6c][_0xef19('0x2e')])&&_0x4ec226[_0xef19('0x78')][_0x56bf6c][_0xef19('0x7a')]&&_0x4ec226[_0xef19('0x78')][_0x56bf6c][_0xef19('0x7b')]&&_0x4ec226['joins'][_0x56bf6c][_0xef19('0x7c')]){_0x1e1092[_0x4ec226['joins'][_0x56bf6c][_0xef19('0x2e')]](_0x4ec226[_0xef19('0x78')][_0x56bf6c][_0xef19('0x7b')],null,util[_0xef19('0x74')](_0xef19('0x7d'),_0x4ec226[_0xef19('0x6e')],_0x4ec226[_0xef19('0x78')][_0x56bf6c][_0xef19('0x7a')],_0x4ec226[_0xef19('0x78')][_0x56bf6c][_0xef19('0x7b')],_0x4ec226['joins'][_0x56bf6c][_0xef19('0x7c')]));}}}if(_0x4ec226['conditions']){_0x4ec226[_0xef19('0x7e')]=JSON[_0xef19('0x7f')](_0x4ec226['conditions']);_0x1e1092[_0xef19('0x3c')](_0x2f227c(_0x4ec226[_0xef19('0x7e')][_0xef19('0x65')]));}_0x4a960f=_0x1e1092[_0xef19('0x80')]();_0x1e1092[_0xef19('0x3a')](_0x42b681);_0x1e1092[_0xef19('0x1e')](0x0);logger['debug'](_0xef19('0x81'),_0x1e1092[_0xef19('0x82')]());return dbH[_0xef19('0x83')][_0xef19('0x37')](_0x1e1092[_0xef19('0x82')](),{'type':dbH[_0xef19('0x83')][_0xef19('0x84')][_0xef19('0x85')]});}})['then'](respondWithResult(_0x27681c,null))[_0xef19('0x47')](handleError(_0x27681c,null));};function runReport(_0x431fd3,_0xdf60c1,_0x563acc){var _0x343b10=_0xdf60c1[_0xef19('0x31')];var _0x54070e=0xa;var _0x51fc3b=['join',_0xef19('0x56'),_0xef19('0x86'),'cross_join'];var _0x2bdff3={'SUM':'SUM(%s)','COUNT':_0xef19('0x58'),'COUNT DISTINCT':_0xef19('0x59'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xef19('0x87'),'GROUP_CONCAT ASC':_0xef19('0x88'),'GROUP_CONCAT DESC':_0xef19('0x5d')};var _0x26f6cd={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xef19('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xef19('0x60'),'UNIX_TIMESTAMP':_0xef19('0x61')};var _0xdb0c0=function(_0x25a70e){return!_['includes']([_0xef19('0x89'),_0xef19('0x8a'),_0xef19('0x8b'),_0xef19('0x62')],_0x25a70e);};var _0x294c78=function(_0x1dca4f){if(!_0x1dca4f||!_0x1dca4f['rules'][_0xef19('0x38')]){return'';}for(var _0x150980='(',_0x317eeb=0x0;_0x317eeb<_0x1dca4f['rules'][_0xef19('0x38')];_0x317eeb+=0x1){_0x317eeb>0x0&&(_0x150980+='\x20'+_0x1dca4f[_0xef19('0x64')]+'\x20');_0x150980+=_0x1dca4f[_0xef19('0x63')][_0x317eeb][_0xef19('0x65')]?_0x294c78(_0x1dca4f['rules'][_0x317eeb][_0xef19('0x65')]):_0x1dca4f[_0xef19('0x63')][_0x317eeb][_0xef19('0x71')]+'\x20'+_0x1dca4f['rules'][_0x317eeb]['condition']+(_0xdb0c0(_0x1dca4f[_0xef19('0x63')][_0x317eeb][_0xef19('0x66')])?'\x20'+_0x1dca4f[_0xef19('0x63')][_0x317eeb][_0xef19('0x67')]:'');}return _0x150980+')';};var _0x495a73={'where':{'id':_0x431fd3['id']}},_0x54f89b,_0x5c5df8,_0x56e934,_0x2d73ce,_0x1fedc5;_0x495a73=_['merge']({},_0x495a73,_0x563acc);return db[_0xef19('0x2b')][_0xef19('0x46')](_0x495a73)[_0xef19('0x25')](function(_0x4a9f18){if(_0x4a9f18){_0x54f89b=_0x4a9f18;return _0x4a9f18[_0xef19('0x8c')]();}return null;})[_0xef19('0x25')](function(_0x230117){if(_0x230117){if(!_0x230117[_0xef19('0x38')]){throw new db['Sequelize'][(_0xef19('0x68'))](_0xef19('0x69'),0x193);}_0x5c5df8=_0x230117;return db[_0xef19('0x6a')][_0xef19('0x43')]({'raw':!![]});}return null;})[_0xef19('0x25')](function(_0x38305a){if(_0x38305a){_0x56e934=_[_0xef19('0x6b')](_0x38305a,'id');var _0x21d322;var _0xde7930=squel[_0xef19('0x6c')]();_0xde7930[_0xef19('0x6d')](_0x54f89b[_0xef19('0x6e')]);for(var _0x320462=0x0;_0x320462<_0x5c5df8[_0xef19('0x38')];_0x320462+=0x1){_0x21d322=_0x5c5df8[_0x320462][_0xef19('0x6f')]?_0x56e934[_0x5c5df8[_0x320462]['MetricId']]['metric']:_0x5c5df8[_0x320462][_0xef19('0x71')];_0x21d322=_0x5c5df8[_0x320462]['function']?_[_0xef19('0x73')](_0x2bdff3[_0x5c5df8[_0x320462][_0xef19('0x72')]],'%s',_0x21d322):_0x21d322;_0x21d322=_0x5c5df8[_0x320462]['format']?_['replace'](_0x26f6cd[_0x5c5df8[_0x320462][_0xef19('0x74')]],'%s',_0x21d322):_0x21d322;if(_0x5c5df8[_0x320462]['groupBy']){_0xde7930[_0xef19('0x65')](_0x21d322);}_0x5c5df8[_0x320462]['orderBy']&&_0xde7930[_0xef19('0x76')](_0x21d322,_0x5c5df8[_0x320462][_0xef19('0x8d')]===_0xef19('0x77')?![]:!![]);_0xde7930[_0xef19('0x71')](_0x21d322,_0x5c5df8[_0x320462][_0xef19('0x8e')]||_0x21d322);}if(_0x54f89b[_0xef19('0x78')]){_0x54f89b[_0xef19('0x78')]=JSON[_0xef19('0x7f')](_0x54f89b['joins']);for(var _0x3976d4=0x0;_0x3976d4<_0x54f89b[_0xef19('0x78')][_0xef19('0x38')];_0x3976d4+=0x1){if(_0x54f89b['joins'][_0x3976d4][_0xef19('0x2e')]&&_[_0xef19('0x79')](_0x51fc3b,_0x54f89b[_0xef19('0x78')][_0x3976d4][_0xef19('0x2e')])&&_0x54f89b[_0xef19('0x78')][_0x3976d4][_0xef19('0x7a')]&&_0x54f89b[_0xef19('0x78')][_0x3976d4][_0xef19('0x7b')]&&_0x54f89b[_0xef19('0x78')][_0x3976d4][_0xef19('0x7c')]){_0xde7930[_0x54f89b[_0xef19('0x78')][_0x3976d4]['type']](_0x54f89b[_0xef19('0x78')][_0x3976d4]['foreignTable'],null,util[_0xef19('0x74')](_0xef19('0x7d'),_0x54f89b['table'],_0x54f89b[_0xef19('0x78')][_0x3976d4][_0xef19('0x7a')],_0x54f89b[_0xef19('0x78')][_0x3976d4][_0xef19('0x7b')],_0x54f89b[_0xef19('0x78')][_0x3976d4][_0xef19('0x7c')]));}}}if(_0x54f89b[_0xef19('0x7e')]){_0x54f89b[_0xef19('0x7e')]=JSON['parse'](_0x54f89b['conditions']);_0xde7930[_0xef19('0x3c')](_0x294c78(_0x54f89b[_0xef19('0x7e')][_0xef19('0x65')]));}_0x1fedc5=_0xde7930[_0xef19('0x80')]();_0xde7930[_0xef19('0x3a')](_0x54070e);_0xde7930[_0xef19('0x1e')](0x0);return;}})[_0xef19('0x25')](function(){if(_0xdf60c1[_0xef19('0x8f')]===_0xef19('0x90')){return null;}var _0x27c431=_[_0xef19('0x3e')](_0xdf60c1,{'name':_0xdf60c1['fullPath']||_0xdf60c1[_0xef19('0x31')]||_0x54f89b[_0xef19('0x31')],'basename':_0x343b10,'savename':util[_0xef19('0x74')](_0xef19('0x91'),_0xdf60c1[_0xef19('0x31')]||_0x54f89b[_0xef19('0x31')],require(_0xef19('0x92'))[_0xef19('0x93')](0x4),_0xdf60c1[_0xef19('0x8f')]||'csv'),'reportId':_0x54f89b['id'],'reportType':'default'});return db[_0xef19('0x94')]['create'](_0x27c431,{'raw':!![]});})['then'](function(_0x3dd6af){if(_0x54f89b['table']===_0xef19('0x95')){_0x1fedc5[_0xef19('0x3c')](_0x54f89b['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xdf60c1[_0xef19('0x96')],_0xdf60c1[_0xef19('0x97')]);}else{_0x1fedc5[_0xef19('0x3c')](_0x54f89b['table']+_0xef19('0x98'),_0xdf60c1[_0xef19('0x96')],_0xdf60c1[_0xef19('0x97')]);}if(_0x3dd6af){logger[_0xef19('0x99')](_0xef19('0x9a'),_0x1fedc5[_0xef19('0x82')]());require(_0xef19('0x9b'))['fork'](path['join'](__dirname,_0xef19('0x9c'),_0x3dd6af['output']),[_0x3dd6af['id'],_0x1fedc5[_0xef19('0x82')](),path[_0xef19('0x55')](__dirname,_0xef19('0x9d'),_0x3dd6af[_0xef19('0x9e')]),_0x343b10]);return _0x3dd6af;}else{var _0xc3987=squel[_0xef19('0x6c')]();_0xc3987[_0xef19('0x6d')]('('+_0x1fedc5['toString']()+')',_0xef19('0x9f'));_0xc3987[_0xef19('0x71')](_0xef19('0xa0'),'count');_0x1fedc5[_0xef19('0x3a')](_0xdf60c1[_0xef19('0x3a')]||_0x54070e);_0x1fedc5[_0xef19('0x1e')](_0xdf60c1[_0xef19('0x1e')]||0x0);return dbH[_0xef19('0x83')][_0xef19('0x37')](_0xc3987[_0xef19('0x82')](),{'type':dbH[_0xef19('0x83')][_0xef19('0x84')][_0xef19('0x85')]})[_0xef19('0x25')](function(_0x37d298){if(!_0x37d298[_0xef19('0x38')]){_0x2d73ce=0x0;}else{_0x2d73ce=_0x37d298[0x0][_0xef19('0x1d')]||0x0;}return dbH[_0xef19('0x83')][_0xef19('0x37')](_0x1fedc5[_0xef19('0x82')](),{'type':dbH[_0xef19('0x83')][_0xef19('0x84')][_0xef19('0x85')]});})['then'](function(_0x3ed49b){return{'rows':_0x3ed49b||[],'count':_0x2d73ce};});}});}exports[_0xef19('0xa1')]=function(_0x45e4e5,_0x507b85){return runReport(_0x45e4e5[_0xef19('0x44')],_0x45e4e5[_0xef19('0x37')],_0x45e4e5['options'])[_0xef19('0x25')](respondWithResult(_0x507b85,null))[_0xef19('0x47')](handleError(_0x507b85,null));};exports[_0xef19('0xa2')]=runReport;exports[_0xef19('0x37')]=function(_0x42c417,_0x36011a){var _0x2fdb4c=0xa;var _0xc356b9=[_0xef19('0x55'),_0xef19('0x56'),'right_join',_0xef19('0xa3')];var _0xbd61a1={'SUM':_0xef19('0x57'),'COUNT':_0xef19('0x58'),'COUNT DISTINCT':_0xef19('0x59'),'MAX':'MAX(%s)','MIN':_0xef19('0x5b'),'AVG':_0xef19('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xef19('0x88'),'GROUP_CONCAT DESC':_0xef19('0x5d')};var _0x35182f={'SEC_TO_TIME':_0xef19('0x5e'),'DATE':'DATE(%s)','HOUR':_0xef19('0xa4'),'ROUND':_0xef19('0x60'),'UNIX_TIMESTAMP':_0xef19('0x61')};var _0xc06235=function(_0x132b2c){return!_[_0xef19('0x79')](['IS\x20NULL',_0xef19('0x8a'),_0xef19('0x8b'),_0xef19('0x62')],_0x132b2c);};var _0x4e2dae=function(_0x2a0ca5){if(!_0x2a0ca5||!_0x2a0ca5['rules'][_0xef19('0x38')]){return'';}for(var _0x4dcec5='(',_0x591047=0x0;_0x591047<_0x2a0ca5[_0xef19('0x63')][_0xef19('0x38')];_0x591047+=0x1){_0x591047>0x0&&(_0x4dcec5+='\x20'+_0x2a0ca5[_0xef19('0x64')]+'\x20');_0x4dcec5+=_0x2a0ca5[_0xef19('0x63')][_0x591047][_0xef19('0x65')]?_0x4e2dae(_0x2a0ca5[_0xef19('0x63')][_0x591047]['group']):_0x2a0ca5['rules'][_0x591047]['field']+'\x20'+_0x2a0ca5[_0xef19('0x63')][_0x591047]['condition']+(_0xc06235(_0x2a0ca5[_0xef19('0x63')][_0x591047]['condition'])?'\x20'+_0x2a0ca5[_0xef19('0x63')][_0x591047]['value']:'');}return _0x4dcec5+')';};var _0x333be0={'where':{'id':_0x42c417['params']['id']}},_0x13a722,_0x242005,_0x22969f,_0x3fe77e,_0x70a513;_0x333be0=_[_0xef19('0x3e')]({},_0x333be0,_0x42c417[_0xef19('0x41')]);return db[_0xef19('0x2b')]['find'](_0x333be0)[_0xef19('0x25')](function(_0x131eb9){if(_0x131eb9){_0x13a722=_0x131eb9;return _0x131eb9[_0xef19('0x8c')]();}return null;})['then'](function(_0x32ba4a){if(_0x32ba4a){if(!_0x32ba4a[_0xef19('0x38')]){throw new db['Sequelize'][(_0xef19('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x242005=_0x32ba4a;return db[_0xef19('0x6a')]['findAll']({'raw':!![]});}return null;})[_0xef19('0x25')](function(_0x35becc){if(_0x35becc){_0x22969f=_[_0xef19('0x6b')](_0x35becc,'id');var _0x4609e2;var _0x1fbc15=squel[_0xef19('0x6c')]();_0x1fbc15['from'](_0x13a722['table']);for(var _0x319a69=0x0;_0x319a69<_0x242005['length'];_0x319a69+=0x1){_0x4609e2=_0x242005[_0x319a69][_0xef19('0x6f')]?_0x22969f[_0x242005[_0x319a69][_0xef19('0x6f')]]['metric']:_0x242005[_0x319a69][_0xef19('0x71')];_0x4609e2=_0x242005[_0x319a69]['function']?_['replace'](_0xbd61a1[_0x242005[_0x319a69][_0xef19('0x72')]],'%s',_0x4609e2):_0x4609e2;_0x4609e2=_0x242005[_0x319a69][_0xef19('0x74')]?_[_0xef19('0x73')](_0x35182f[_0x242005[_0x319a69][_0xef19('0x74')]],'%s',_0x4609e2):_0x4609e2;if(_0x242005[_0x319a69]['groupBy']){_0x1fbc15[_0xef19('0x65')](_0x4609e2);}_0x242005[_0x319a69][_0xef19('0x8d')]&&_0x1fbc15[_0xef19('0x76')](_0x4609e2,_0x242005[_0x319a69][_0xef19('0x8d')]===_0xef19('0x77')?![]:!![]);_0x1fbc15['field'](_0x4609e2,_0x242005[_0x319a69]['alias']||_0x4609e2);}if(_0x13a722['joins']){_0x13a722[_0xef19('0x78')]=JSON[_0xef19('0x7f')](_0x13a722[_0xef19('0x78')]);for(var _0xc5b32c=0x0;_0xc5b32c<_0x13a722[_0xef19('0x78')][_0xef19('0x38')];_0xc5b32c+=0x1){if(_0x13a722['joins'][_0xc5b32c]['type']&&_['includes'](_0xc356b9,_0x13a722['joins'][_0xc5b32c][_0xef19('0x2e')])&&_0x13a722[_0xef19('0x78')][_0xc5b32c]['parentKey']&&_0x13a722['joins'][_0xc5b32c][_0xef19('0x7b')]&&_0x13a722[_0xef19('0x78')][_0xc5b32c]['foreignKey']){_0x1fbc15[_0x13a722[_0xef19('0x78')][_0xc5b32c][_0xef19('0x2e')]](_0x13a722[_0xef19('0x78')][_0xc5b32c]['foreignTable'],null,util[_0xef19('0x74')](_0xef19('0x7d'),_0x13a722[_0xef19('0x6e')],_0x13a722[_0xef19('0x78')][_0xc5b32c]['parentKey'],_0x13a722[_0xef19('0x78')][_0xc5b32c][_0xef19('0x7b')],_0x13a722[_0xef19('0x78')][_0xc5b32c][_0xef19('0x7c')]));}}}if(_0x13a722[_0xef19('0x7e')]){_0x13a722['conditions']=JSON[_0xef19('0x7f')](_0x13a722[_0xef19('0x7e')]);_0x1fbc15[_0xef19('0x3c')](_0x4e2dae(_0x13a722[_0xef19('0x7e')][_0xef19('0x65')]));}_0x70a513=_0x1fbc15[_0xef19('0x80')]();_0x1fbc15[_0xef19('0x3a')](_0x2fdb4c);_0x1fbc15['offset'](0x0);logger[_0xef19('0xa5')](_0xef19('0x81'),_0x1fbc15[_0xef19('0x82')]());return dbH['sequelize'][_0xef19('0x37')](_0x1fbc15['toString'](),{'type':dbH[_0xef19('0x83')][_0xef19('0x84')][_0xef19('0x85')]});}})[_0xef19('0x25')](function(){return{'sql':_0x70a513[_0xef19('0x82')]()};})['then'](respondWithResult(_0x36011a,null))['catch'](handleError(_0x36011a,null));}; \ No newline at end of file +var _0x12d7=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','count','offset','limit','set','json','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','AnalyticDefaultReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','rows','catch','show','params','rawAttributes','length','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','preview','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','Limited\x20Query:','toString','sequelize','QueryTypes','join','right_join','SUM(%s)','ROUND(%s)','ValidationErrorItem','output','fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','info','child_process','fork','../../files/reports','savename','countTable','run','options','keyBy','clone','debug','SELECT','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x12d7,0x1d7));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x712d('0x0'));var emlformat=require(_0x712d('0x1'));var rimraf=require(_0x712d('0x2'));var zipdir=require(_0x712d('0x3'));var jsonpatch=require(_0x712d('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x712d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x712d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x712d('0x7'));var squel=require(_0x712d('0x8'));var crypto=require(_0x712d('0x9'));var jsforce=require(_0x712d('0xa'));var deskjs=require(_0x712d('0xb'));var toCsv=require(_0x712d('0xc'));var querystring=require(_0x712d('0xd'));var Papa=require(_0x712d('0xe'));var Redis=require(_0x712d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x712d('0x10'));var as=require(_0x712d('0x11'));var hardwareService=require(_0x712d('0x12'));var logger=require(_0x712d('0x13'))(_0x712d('0x14'));var utils=require(_0x712d('0x15'));var config=require(_0x712d('0x16'));var licenseUtil=require(_0x712d('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x712d('0x18'))[_0x712d('0x19')];function respondWithStatusCode(_0x4fb6c6,_0x31406e){_0x31406e=_0x31406e||0xcc;return function(_0x57f59d){if(_0x57f59d){return _0x4fb6c6[_0x712d('0x1a')](_0x31406e);}return _0x4fb6c6['status'](_0x31406e)[_0x712d('0x1b')]();};}function respondWithResult(_0xc0cf83,_0x15186d){_0x15186d=_0x15186d||0xc8;return function(_0x3c46ed){if(_0x3c46ed){return _0xc0cf83[_0x712d('0x1c')](_0x15186d)['json'](_0x3c46ed);}};}function respondWithFilteredResult(_0x19bfbb,_0x1eac9f){return function(_0x4a0d7a){if(_0x4a0d7a){var _0x25128c=_0x4a0d7a[_0x712d('0x1d')],_0x53c297=_0x1eac9f['offset'],_0x257bb3=_0x1eac9f[_0x712d('0x1e')]+_0x1eac9f[_0x712d('0x1f')],_0x12ebda;if(_0x257bb3>=_0x25128c){_0x257bb3=_0x25128c;_0x12ebda=0xc8;}else{_0x12ebda=0xce;}_0x19bfbb['status'](_0x12ebda);return _0x19bfbb[_0x712d('0x20')]('Content-Range',_0x53c297+'-'+_0x257bb3+'/'+_0x25128c)[_0x712d('0x21')](_0x4a0d7a);}return null;};}function patchUpdates(_0x154df0){return function(_0x47c142){try{jsonpatch['apply'](_0x47c142,_0x154df0,!![]);}catch(_0x25275f){return BPromise[_0x712d('0x22')](_0x25275f);}return _0x47c142[_0x712d('0x23')]();};}function saveUpdates(_0xedd120,_0xf1e337){return function(_0x3cc92e){if(_0x3cc92e){return _0x3cc92e[_0x712d('0x24')](_0xedd120)[_0x712d('0x25')](function(_0x20d564){return _0x20d564;});}return null;};}function removeEntity(_0x14cc11,_0x16f2aa){return function(_0xeee14a){if(_0xeee14a){return _0xeee14a[_0x712d('0x26')]()['then'](function(){var _0x2574b5=_0xeee14a[_0x712d('0x27')]({'plain':!![]});var _0x309a28=_0x712d('0x28');return db[_0x712d('0x29')][_0x712d('0x26')]({'where':{'type':_0x309a28,'resourceId':_0x2574b5['id']}})[_0x712d('0x25')](function(){return _0xeee14a;});})[_0x712d('0x25')](function(){_0x14cc11['status'](0xcc)[_0x712d('0x1b')]();});}};}function handleEntityNotFound(_0x81948b,_0x24a57a){return function(_0x5ba8c2){if(!_0x5ba8c2){_0x81948b[_0x712d('0x1a')](0x194);}return _0x5ba8c2;};}function handleError(_0x3e47b9,_0x584b2d){_0x584b2d=_0x584b2d||0x1f4;return function(_0x3413c9){logger[_0x712d('0x2a')](_0x3413c9[_0x712d('0x2b')]);if(_0x3413c9[_0x712d('0x2c')]){delete _0x3413c9['name'];}_0x3e47b9[_0x712d('0x1c')](_0x584b2d)[_0x712d('0x2d')](_0x3413c9);};}exports[_0x712d('0x2e')]=function(_0x4eff82,_0x571808){var _0x603472={},_0x316818={},_0x373d41={'count':0x0,'rows':[]};var _0x256881=_[_0x712d('0x2f')](db[_0x712d('0x30')]['rawAttributes'],function(_0x505064){return{'name':_0x505064[_0x712d('0x31')],'type':_0x505064[_0x712d('0x32')][_0x712d('0x33')]};});_0x316818[_0x712d('0x34')]=_[_0x712d('0x2f')](_0x256881,_0x712d('0x2c'));_0x316818[_0x712d('0x35')]=_[_0x712d('0x36')](_0x4eff82[_0x712d('0x35')]);_0x316818[_0x712d('0x37')]=_[_0x712d('0x38')](_0x316818[_0x712d('0x34')],_0x316818[_0x712d('0x35')]);_0x603472[_0x712d('0x39')]=_[_0x712d('0x38')](_0x316818['model'],qs[_0x712d('0x3a')](_0x4eff82[_0x712d('0x35')]['fields']));_0x603472[_0x712d('0x39')]=_0x603472[_0x712d('0x39')]['length']?_0x603472['attributes']:_0x316818[_0x712d('0x34')];if(!_0x4eff82[_0x712d('0x35')]['hasOwnProperty'](_0x712d('0x3b'))){_0x603472[_0x712d('0x1f')]=qs['limit'](_0x4eff82['query'][_0x712d('0x1f')]);_0x603472[_0x712d('0x1e')]=qs['offset'](_0x4eff82['query'][_0x712d('0x1e')]);}_0x603472[_0x712d('0x3c')]=qs[_0x712d('0x3d')](_0x4eff82[_0x712d('0x35')][_0x712d('0x3d')]);_0x603472[_0x712d('0x3e')]=qs[_0x712d('0x37')](_[_0x712d('0x3f')](_0x4eff82['query'],_0x316818[_0x712d('0x37')]),_0x256881);if(_0x4eff82[_0x712d('0x35')]['filter']){_0x603472[_0x712d('0x3e')]=_[_0x712d('0x40')](_0x603472[_0x712d('0x3e')],{'$or':_[_0x712d('0x2f')](_0x256881,function(_0x20138b){if(_0x20138b[_0x712d('0x32')]!==_0x712d('0x41')){var _0x2cbbbc={};_0x2cbbbc[_0x20138b[_0x712d('0x2c')]]={'$like':'%'+_0x4eff82[_0x712d('0x35')]['filter']+'%'};return _0x2cbbbc;}})});}_0x603472=_[_0x712d('0x40')]({},_0x603472,_0x4eff82['options']);var _0x362383={'where':_0x603472[_0x712d('0x3e')]};return db[_0x712d('0x30')][_0x712d('0x1d')](_0x362383)['then'](function(_0x1d0ca2){_0x373d41[_0x712d('0x1d')]=_0x1d0ca2;if(_0x4eff82[_0x712d('0x35')][_0x712d('0x42')]){_0x603472['include']=[{'all':!![]}];}return db[_0x712d('0x30')]['findAll'](_0x603472);})[_0x712d('0x25')](function(_0x388efa){_0x373d41[_0x712d('0x43')]=_0x388efa;return _0x373d41;})[_0x712d('0x25')](respondWithFilteredResult(_0x571808,_0x603472))[_0x712d('0x44')](handleError(_0x571808,null));};exports[_0x712d('0x45')]=function(_0x4dec7a,_0x1de976){var _0x2ea794={'raw':!![],'where':{'id':_0x4dec7a[_0x712d('0x46')]['id']}},_0x2b4fb9={};_0x2b4fb9[_0x712d('0x34')]=_['keys'](db[_0x712d('0x30')][_0x712d('0x47')]);_0x2b4fb9[_0x712d('0x35')]=_['keys'](_0x4dec7a[_0x712d('0x35')]);_0x2b4fb9['filters']=_[_0x712d('0x38')](_0x2b4fb9[_0x712d('0x34')],_0x2b4fb9['query']);_0x2ea794['attributes']=_[_0x712d('0x38')](_0x2b4fb9[_0x712d('0x34')],qs[_0x712d('0x3a')](_0x4dec7a[_0x712d('0x35')][_0x712d('0x3a')]));_0x2ea794[_0x712d('0x39')]=_0x2ea794[_0x712d('0x39')][_0x712d('0x48')]?_0x2ea794[_0x712d('0x39')]:_0x2b4fb9['model'];if(_0x4dec7a[_0x712d('0x35')][_0x712d('0x42')]){_0x2ea794[_0x712d('0x49')]=[{'all':!![]}];}_0x2ea794=_[_0x712d('0x40')]({},_0x2ea794,_0x4dec7a['options']);return db[_0x712d('0x30')]['find'](_0x2ea794)['then'](handleEntityNotFound(_0x1de976,null))['then'](respondWithResult(_0x1de976,null))[_0x712d('0x44')](handleError(_0x1de976,null));};exports[_0x712d('0x4a')]=function(_0x5e08e6,_0x934c87){return db[_0x712d('0x30')][_0x712d('0x4a')](_0x5e08e6[_0x712d('0x4b')],{})[_0x712d('0x25')](function(_0x23d1eb){var _0x3a9d96=_0x5e08e6['user'][_0x712d('0x27')]({'plain':!![]});if(!_0x3a9d96)throw new Error(_0x712d('0x4c'));if(_0x3a9d96['role']===_0x712d('0x4d')){var _0x3a4aef=_0x23d1eb[_0x712d('0x27')]({'plain':!![]});var _0x4570cd=_0x712d('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x4570cd,'userProfileId':_0x3a9d96['userProfileId']},'raw':!![]})[_0x712d('0x25')](function(_0x137880){if(_0x137880&&_0x137880[_0x712d('0x4f')]===0x0){return db[_0x712d('0x29')][_0x712d('0x4a')]({'name':_0x3a4aef[_0x712d('0x2c')],'resourceId':_0x3a4aef['id'],'type':_0x712d('0x28'),'sectionId':_0x137880['id']},{})['then'](function(){return _0x23d1eb;});}else{return _0x23d1eb;}})['catch'](function(_0x2c34f9){logger['error'](_0x712d('0x50'),_0x2c34f9);throw _0x2c34f9;});}return _0x23d1eb;})['then'](respondWithResult(_0x934c87,0xc9))[_0x712d('0x44')](handleError(_0x934c87,null));};exports[_0x712d('0x24')]=function(_0x21f779,_0x1624e8){if(_0x21f779[_0x712d('0x4b')]['id']){delete _0x21f779['body']['id'];}return db[_0x712d('0x30')][_0x712d('0x51')]({'where':{'id':_0x21f779[_0x712d('0x46')]['id']}})[_0x712d('0x25')](handleEntityNotFound(_0x1624e8,null))[_0x712d('0x25')](saveUpdates(_0x21f779[_0x712d('0x4b')],null))['then'](respondWithResult(_0x1624e8,null))['catch'](handleError(_0x1624e8,null));};exports['destroy']=function(_0x3a557b,_0x2d2d1c){return db[_0x712d('0x30')][_0x712d('0x51')]({'where':{'id':_0x3a557b[_0x712d('0x46')]['id']}})[_0x712d('0x25')](handleEntityNotFound(_0x2d2d1c,null))[_0x712d('0x25')](removeEntity(_0x2d2d1c,null))[_0x712d('0x44')](handleError(_0x2d2d1c,null));};exports[_0x712d('0x52')]=function(_0x3eab6c,_0x3bf3aa){var _0x274424=0xa;var _0x3e5ca2=['join',_0x712d('0x53'),'right_join',_0x712d('0x54')];var _0x10a9d8={'SUM':'SUM(%s)','COUNT':_0x712d('0x55'),'COUNT DISTINCT':_0x712d('0x56'),'MAX':_0x712d('0x57'),'MIN':_0x712d('0x58'),'AVG':_0x712d('0x59'),'GROUP_CONCAT':_0x712d('0x5a'),'GROUP_CONCAT ASC':_0x712d('0x5b'),'GROUP_CONCAT DESC':_0x712d('0x5c')};var _0x40f3d8={'SEC_TO_TIME':_0x712d('0x5d'),'DATE':_0x712d('0x5e'),'HOUR':_0x712d('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x712d('0x60')};var _0x3bd94d=function(_0x29d615){return!_[_0x712d('0x61')]([_0x712d('0x62'),_0x712d('0x63'),_0x712d('0x64'),_0x712d('0x65')],_0x29d615);};var _0x247592=function(_0x5b0af8){if(!_0x5b0af8||!_0x5b0af8[_0x712d('0x66')][_0x712d('0x48')]){return'';}for(var _0x1db001='(',_0x111237=0x0;_0x111237<_0x5b0af8[_0x712d('0x66')][_0x712d('0x48')];_0x111237+=0x1){_0x111237>0x0&&(_0x1db001+='\x20'+_0x5b0af8[_0x712d('0x67')]+'\x20');_0x1db001+=_0x5b0af8['rules'][_0x111237]['group']?_0x247592(_0x5b0af8[_0x712d('0x66')][_0x111237][_0x712d('0x68')]):_0x5b0af8[_0x712d('0x66')][_0x111237]['field']+'\x20'+_0x5b0af8[_0x712d('0x66')][_0x111237]['condition']+(_0x3bd94d(_0x5b0af8[_0x712d('0x66')][_0x111237][_0x712d('0x69')])?'\x20'+_0x5b0af8[_0x712d('0x66')][_0x111237][_0x712d('0x6a')]:'');}return _0x1db001+')';};var _0x183994={'where':{'id':_0x3eab6c[_0x712d('0x46')]['id']}},_0x350285,_0x98a947,_0x40a33c,_0x39428e,_0xdc8c26;_0x183994=_['merge']({},_0x183994,_0x3eab6c['options']);return db['AnalyticDefaultReport'][_0x712d('0x51')](_0x183994)[_0x712d('0x25')](function(_0x506b4f){if(_0x506b4f){_0x350285=_0x506b4f;return _0x506b4f[_0x712d('0x6b')]();}return null;})['then'](function(_0x468598){if(_0x468598){if(!_0x468598[_0x712d('0x48')]){throw new db[(_0x712d('0x6c'))]['ValidationErrorItem'](_0x712d('0x6d'),0x193);}_0x98a947=_0x468598;return db[_0x712d('0x6e')][_0x712d('0x6f')]({'raw':!![]});}return null;})[_0x712d('0x25')](function(_0xd1e460){if(_0xd1e460){_0x40a33c=_['keyBy'](_0xd1e460,'id');var _0x626455;var _0x4af801=squel[_0x712d('0x70')]();_0x4af801[_0x712d('0x71')](_0x350285[_0x712d('0x72')]);for(var _0x1679d7=0x0;_0x1679d7<_0x98a947[_0x712d('0x48')];_0x1679d7+=0x1){_0x626455=_0x98a947[_0x1679d7][_0x712d('0x73')]?_0x40a33c[_0x98a947[_0x1679d7][_0x712d('0x73')]][_0x712d('0x74')]:_0x98a947[_0x1679d7][_0x712d('0x75')];_0x626455=_0x98a947[_0x1679d7][_0x712d('0x76')]?_[_0x712d('0x77')](_0x10a9d8[_0x98a947[_0x1679d7]['function']],'%s',_0x626455):_0x626455;_0x626455=_0x98a947[_0x1679d7][_0x712d('0x78')]?_[_0x712d('0x77')](_0x40f3d8[_0x98a947[_0x1679d7][_0x712d('0x78')]],'%s',_0x626455):_0x626455;if(_0x98a947[_0x1679d7][_0x712d('0x79')]){_0x4af801['group'](_0x626455);}_0x98a947[_0x1679d7][_0x712d('0x7a')]&&_0x4af801[_0x712d('0x3c')](_0x626455,_0x98a947[_0x1679d7]['orderBy']===_0x712d('0x7b')?![]:!![]);_0x4af801[_0x712d('0x75')](_0x626455,_0x98a947[_0x1679d7][_0x712d('0x7c')]||_0x626455);}if(_0x350285[_0x712d('0x7d')]){_0x350285[_0x712d('0x7d')]=JSON[_0x712d('0x7e')](_0x350285['joins']);for(var _0x44fbe9=0x0;_0x44fbe9<_0x350285['joins'][_0x712d('0x48')];_0x44fbe9+=0x1){if(_0x350285['joins'][_0x44fbe9]['type']&&_['includes'](_0x3e5ca2,_0x350285[_0x712d('0x7d')][_0x44fbe9][_0x712d('0x32')])&&_0x350285[_0x712d('0x7d')][_0x44fbe9]['parentKey']&&_0x350285[_0x712d('0x7d')][_0x44fbe9][_0x712d('0x7f')]&&_0x350285[_0x712d('0x7d')][_0x44fbe9][_0x712d('0x80')]){_0x4af801[_0x350285[_0x712d('0x7d')][_0x44fbe9][_0x712d('0x32')]](_0x350285['joins'][_0x44fbe9]['foreignTable'],null,util['format'](_0x712d('0x81'),_0x350285[_0x712d('0x72')],_0x350285[_0x712d('0x7d')][_0x44fbe9][_0x712d('0x82')],_0x350285['joins'][_0x44fbe9][_0x712d('0x7f')],_0x350285[_0x712d('0x7d')][_0x44fbe9]['foreignKey']));}}}if(_0x350285[_0x712d('0x83')]){_0x350285[_0x712d('0x83')]=JSON[_0x712d('0x7e')](_0x350285['conditions']);_0x4af801[_0x712d('0x3e')](_0x247592(_0x350285['conditions'][_0x712d('0x68')]));}_0xdc8c26=_0x4af801['clone']();_0x4af801[_0x712d('0x1f')](_0x274424);_0x4af801[_0x712d('0x1e')](0x0);logger['debug'](_0x712d('0x84'),_0x4af801[_0x712d('0x85')]());return dbH[_0x712d('0x86')][_0x712d('0x35')](_0x4af801[_0x712d('0x85')](),{'type':dbH[_0x712d('0x86')][_0x712d('0x87')]['SELECT']});}})[_0x712d('0x25')](respondWithResult(_0x3bf3aa,null))[_0x712d('0x44')](handleError(_0x3bf3aa,null));};function runReport(_0x4a0c58,_0x40644a,_0x1b2993){var _0x411e75=_0x40644a['name'];var _0x2b5855=0xa;var _0x137118=[_0x712d('0x88'),_0x712d('0x53'),_0x712d('0x89'),_0x712d('0x54')];var _0x4c19b9={'SUM':_0x712d('0x8a'),'COUNT':_0x712d('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x712d('0x58'),'AVG':_0x712d('0x59'),'GROUP_CONCAT':_0x712d('0x5a'),'GROUP_CONCAT ASC':_0x712d('0x5b'),'GROUP_CONCAT DESC':_0x712d('0x5c')};var _0x7b7e4e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x712d('0x8b'),'UNIX_TIMESTAMP':_0x712d('0x60')};var _0x531134=function(_0x8b2f32){return!_[_0x712d('0x61')]([_0x712d('0x62'),_0x712d('0x63'),_0x712d('0x64'),_0x712d('0x65')],_0x8b2f32);};var _0x72a904=function(_0x4cd961){if(!_0x4cd961||!_0x4cd961[_0x712d('0x66')]['length']){return'';}for(var _0x3ee240='(',_0x3e4041=0x0;_0x3e4041<_0x4cd961[_0x712d('0x66')][_0x712d('0x48')];_0x3e4041+=0x1){_0x3e4041>0x0&&(_0x3ee240+='\x20'+_0x4cd961[_0x712d('0x67')]+'\x20');_0x3ee240+=_0x4cd961['rules'][_0x3e4041][_0x712d('0x68')]?_0x72a904(_0x4cd961['rules'][_0x3e4041][_0x712d('0x68')]):_0x4cd961[_0x712d('0x66')][_0x3e4041][_0x712d('0x75')]+'\x20'+_0x4cd961[_0x712d('0x66')][_0x3e4041]['condition']+(_0x531134(_0x4cd961[_0x712d('0x66')][_0x3e4041][_0x712d('0x69')])?'\x20'+_0x4cd961[_0x712d('0x66')][_0x3e4041][_0x712d('0x6a')]:'');}return _0x3ee240+')';};var _0x5a3d7b={'where':{'id':_0x4a0c58['id']}},_0x3ef9de,_0xb1d783,_0x11acfd,_0xb4170,_0x3aacae;_0x5a3d7b=_[_0x712d('0x40')]({},_0x5a3d7b,_0x1b2993);return db[_0x712d('0x30')][_0x712d('0x51')](_0x5a3d7b)[_0x712d('0x25')](function(_0x79f29a){if(_0x79f29a){_0x3ef9de=_0x79f29a;return _0x79f29a['getFields']();}return null;})[_0x712d('0x25')](function(_0x45ae9a){if(_0x45ae9a){if(!_0x45ae9a[_0x712d('0x48')]){throw new db[(_0x712d('0x6c'))][(_0x712d('0x8c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xb1d783=_0x45ae9a;return db[_0x712d('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x712d('0x25')](function(_0x123f83){if(_0x123f83){_0x11acfd=_['keyBy'](_0x123f83,'id');var _0x31c089;var _0x89104f=squel['select']();_0x89104f[_0x712d('0x71')](_0x3ef9de['table']);for(var _0x3dac52=0x0;_0x3dac52<_0xb1d783[_0x712d('0x48')];_0x3dac52+=0x1){_0x31c089=_0xb1d783[_0x3dac52]['MetricId']?_0x11acfd[_0xb1d783[_0x3dac52][_0x712d('0x73')]][_0x712d('0x74')]:_0xb1d783[_0x3dac52][_0x712d('0x75')];_0x31c089=_0xb1d783[_0x3dac52][_0x712d('0x76')]?_[_0x712d('0x77')](_0x4c19b9[_0xb1d783[_0x3dac52]['function']],'%s',_0x31c089):_0x31c089;_0x31c089=_0xb1d783[_0x3dac52]['format']?_[_0x712d('0x77')](_0x7b7e4e[_0xb1d783[_0x3dac52][_0x712d('0x78')]],'%s',_0x31c089):_0x31c089;if(_0xb1d783[_0x3dac52][_0x712d('0x79')]){_0x89104f[_0x712d('0x68')](_0x31c089);}_0xb1d783[_0x3dac52][_0x712d('0x7a')]&&_0x89104f['order'](_0x31c089,_0xb1d783[_0x3dac52][_0x712d('0x7a')]===_0x712d('0x7b')?![]:!![]);_0x89104f[_0x712d('0x75')](_0x31c089,_0xb1d783[_0x3dac52][_0x712d('0x7c')]||_0x31c089);}if(_0x3ef9de[_0x712d('0x7d')]){_0x3ef9de[_0x712d('0x7d')]=JSON[_0x712d('0x7e')](_0x3ef9de[_0x712d('0x7d')]);for(var _0x13468c=0x0;_0x13468c<_0x3ef9de[_0x712d('0x7d')]['length'];_0x13468c+=0x1){if(_0x3ef9de[_0x712d('0x7d')][_0x13468c]['type']&&_[_0x712d('0x61')](_0x137118,_0x3ef9de[_0x712d('0x7d')][_0x13468c]['type'])&&_0x3ef9de[_0x712d('0x7d')][_0x13468c][_0x712d('0x82')]&&_0x3ef9de[_0x712d('0x7d')][_0x13468c][_0x712d('0x7f')]&&_0x3ef9de[_0x712d('0x7d')][_0x13468c][_0x712d('0x80')]){_0x89104f[_0x3ef9de[_0x712d('0x7d')][_0x13468c][_0x712d('0x32')]](_0x3ef9de['joins'][_0x13468c][_0x712d('0x7f')],null,util['format'](_0x712d('0x81'),_0x3ef9de['table'],_0x3ef9de['joins'][_0x13468c]['parentKey'],_0x3ef9de['joins'][_0x13468c][_0x712d('0x7f')],_0x3ef9de['joins'][_0x13468c][_0x712d('0x80')]));}}}if(_0x3ef9de[_0x712d('0x83')]){_0x3ef9de[_0x712d('0x83')]=JSON[_0x712d('0x7e')](_0x3ef9de[_0x712d('0x83')]);_0x89104f[_0x712d('0x3e')](_0x72a904(_0x3ef9de[_0x712d('0x83')][_0x712d('0x68')]));}_0x3aacae=_0x89104f['clone']();_0x89104f[_0x712d('0x1f')](_0x2b5855);_0x89104f['offset'](0x0);return;}})[_0x712d('0x25')](function(){if(_0x40644a[_0x712d('0x8d')]==='web'){return null;}var _0x17e07a=_[_0x712d('0x40')](_0x40644a,{'name':_0x40644a[_0x712d('0x8e')]||_0x40644a[_0x712d('0x2c')]||_0x3ef9de[_0x712d('0x2c')],'basename':_0x411e75,'savename':util[_0x712d('0x78')](_0x712d('0x8f'),_0x40644a[_0x712d('0x2c')]||_0x3ef9de[_0x712d('0x2c')],require(_0x712d('0x90'))[_0x712d('0x91')](0x4),_0x40644a['output']||'csv'),'reportId':_0x3ef9de['id'],'reportType':_0x712d('0x92')});return db['AnalyticExtractedReport'][_0x712d('0x4a')](_0x17e07a,{'raw':!![]});})[_0x712d('0x25')](function(_0x511449){if(_0x3ef9de[_0x712d('0x72')]===_0x712d('0x93')){_0x3aacae[_0x712d('0x3e')](_0x3ef9de[_0x712d('0x72')]+_0x712d('0x94'),_0x40644a['startDate'],_0x40644a[_0x712d('0x95')]);}else{_0x3aacae[_0x712d('0x3e')](_0x3ef9de[_0x712d('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x40644a['startDate'],_0x40644a[_0x712d('0x95')]);}if(_0x511449){logger[_0x712d('0x96')]('Run\x20Query:',_0x3aacae[_0x712d('0x85')]());require(_0x712d('0x97'))[_0x712d('0x98')](path['join'](__dirname,'../../components/export/',_0x511449[_0x712d('0x8d')]),[_0x511449['id'],_0x3aacae[_0x712d('0x85')](),path['join'](__dirname,_0x712d('0x99'),_0x511449[_0x712d('0x9a')]),_0x411e75]);return _0x511449;}else{var _0x95667d=squel['select']();_0x95667d[_0x712d('0x71')]('('+_0x3aacae['toString']()+')',_0x712d('0x9b'));_0x95667d[_0x712d('0x75')]('COUNT(*)','count');_0x3aacae['limit'](_0x40644a[_0x712d('0x1f')]||_0x2b5855);_0x3aacae[_0x712d('0x1e')](_0x40644a[_0x712d('0x1e')]||0x0);return dbH[_0x712d('0x86')][_0x712d('0x35')](_0x95667d[_0x712d('0x85')](),{'type':dbH[_0x712d('0x86')][_0x712d('0x87')]['SELECT']})[_0x712d('0x25')](function(_0x33d3fd){if(!_0x33d3fd[_0x712d('0x48')]){_0xb4170=0x0;}else{_0xb4170=_0x33d3fd[0x0][_0x712d('0x1d')]||0x0;}return dbH['sequelize'][_0x712d('0x35')](_0x3aacae[_0x712d('0x85')](),{'type':dbH[_0x712d('0x86')][_0x712d('0x87')]['SELECT']});})[_0x712d('0x25')](function(_0x760279){return{'rows':_0x760279||[],'count':_0xb4170};});}});}exports[_0x712d('0x9c')]=function(_0x2d3e55,_0x162e59){return runReport(_0x2d3e55[_0x712d('0x46')],_0x2d3e55[_0x712d('0x35')],_0x2d3e55[_0x712d('0x9d')])[_0x712d('0x25')](respondWithResult(_0x162e59,null))[_0x712d('0x44')](handleError(_0x162e59,null));};exports['runReport']=runReport;exports['query']=function(_0x1ed723,_0x34d624){var _0x5a6c91=0xa;var _0x5e18cb=[_0x712d('0x88'),_0x712d('0x53'),_0x712d('0x89'),_0x712d('0x54')];var _0x269f7e={'SUM':_0x712d('0x8a'),'COUNT':_0x712d('0x55'),'COUNT DISTINCT':_0x712d('0x56'),'MAX':_0x712d('0x57'),'MIN':_0x712d('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x712d('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x712d('0x5c')};var _0x846231={'SEC_TO_TIME':_0x712d('0x5d'),'DATE':_0x712d('0x5e'),'HOUR':_0x712d('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x712d('0x60')};var _0x1a0d08=function(_0x1eb849){return!_[_0x712d('0x61')]([_0x712d('0x62'),_0x712d('0x63'),'IS\x20EMPTY',_0x712d('0x65')],_0x1eb849);};var _0x58f32d=function(_0x1d6ad6){if(!_0x1d6ad6||!_0x1d6ad6[_0x712d('0x66')][_0x712d('0x48')]){return'';}for(var _0x2a6824='(',_0x19b394=0x0;_0x19b394<_0x1d6ad6[_0x712d('0x66')][_0x712d('0x48')];_0x19b394+=0x1){_0x19b394>0x0&&(_0x2a6824+='\x20'+_0x1d6ad6[_0x712d('0x67')]+'\x20');_0x2a6824+=_0x1d6ad6[_0x712d('0x66')][_0x19b394][_0x712d('0x68')]?_0x58f32d(_0x1d6ad6[_0x712d('0x66')][_0x19b394][_0x712d('0x68')]):_0x1d6ad6['rules'][_0x19b394]['field']+'\x20'+_0x1d6ad6[_0x712d('0x66')][_0x19b394][_0x712d('0x69')]+(_0x1a0d08(_0x1d6ad6[_0x712d('0x66')][_0x19b394][_0x712d('0x69')])?'\x20'+_0x1d6ad6['rules'][_0x19b394]['value']:'');}return _0x2a6824+')';};var _0x7d568a={'where':{'id':_0x1ed723['params']['id']}},_0x268875,_0x1c02f8,_0x45597e,_0x1acd0a,_0x5b5138;_0x7d568a=_['merge']({},_0x7d568a,_0x1ed723[_0x712d('0x9d')]);return db[_0x712d('0x30')][_0x712d('0x51')](_0x7d568a)[_0x712d('0x25')](function(_0x2ac2fd){if(_0x2ac2fd){_0x268875=_0x2ac2fd;return _0x2ac2fd['getFields']();}return null;})[_0x712d('0x25')](function(_0x38e6e1){if(_0x38e6e1){if(!_0x38e6e1[_0x712d('0x48')]){throw new db[(_0x712d('0x6c'))][(_0x712d('0x8c'))](_0x712d('0x6d'),0x193);}_0x1c02f8=_0x38e6e1;return db['AnalyticMetric'][_0x712d('0x6f')]({'raw':!![]});}return null;})['then'](function(_0x5ea048){if(_0x5ea048){_0x45597e=_[_0x712d('0x9e')](_0x5ea048,'id');var _0x59f234;var _0x236b7a=squel['select']();_0x236b7a[_0x712d('0x71')](_0x268875[_0x712d('0x72')]);for(var _0x2e827c=0x0;_0x2e827c<_0x1c02f8['length'];_0x2e827c+=0x1){_0x59f234=_0x1c02f8[_0x2e827c]['MetricId']?_0x45597e[_0x1c02f8[_0x2e827c][_0x712d('0x73')]][_0x712d('0x74')]:_0x1c02f8[_0x2e827c][_0x712d('0x75')];_0x59f234=_0x1c02f8[_0x2e827c][_0x712d('0x76')]?_[_0x712d('0x77')](_0x269f7e[_0x1c02f8[_0x2e827c]['function']],'%s',_0x59f234):_0x59f234;_0x59f234=_0x1c02f8[_0x2e827c]['format']?_['replace'](_0x846231[_0x1c02f8[_0x2e827c]['format']],'%s',_0x59f234):_0x59f234;if(_0x1c02f8[_0x2e827c][_0x712d('0x79')]){_0x236b7a[_0x712d('0x68')](_0x59f234);}_0x1c02f8[_0x2e827c]['orderBy']&&_0x236b7a['order'](_0x59f234,_0x1c02f8[_0x2e827c]['orderBy']===_0x712d('0x7b')?![]:!![]);_0x236b7a[_0x712d('0x75')](_0x59f234,_0x1c02f8[_0x2e827c]['alias']||_0x59f234);}if(_0x268875[_0x712d('0x7d')]){_0x268875['joins']=JSON[_0x712d('0x7e')](_0x268875[_0x712d('0x7d')]);for(var _0x54c3cb=0x0;_0x54c3cb<_0x268875['joins'][_0x712d('0x48')];_0x54c3cb+=0x1){if(_0x268875[_0x712d('0x7d')][_0x54c3cb][_0x712d('0x32')]&&_[_0x712d('0x61')](_0x5e18cb,_0x268875[_0x712d('0x7d')][_0x54c3cb][_0x712d('0x32')])&&_0x268875[_0x712d('0x7d')][_0x54c3cb][_0x712d('0x82')]&&_0x268875['joins'][_0x54c3cb][_0x712d('0x7f')]&&_0x268875[_0x712d('0x7d')][_0x54c3cb][_0x712d('0x80')]){_0x236b7a[_0x268875['joins'][_0x54c3cb]['type']](_0x268875[_0x712d('0x7d')][_0x54c3cb][_0x712d('0x7f')],null,util[_0x712d('0x78')](_0x712d('0x81'),_0x268875[_0x712d('0x72')],_0x268875[_0x712d('0x7d')][_0x54c3cb][_0x712d('0x82')],_0x268875[_0x712d('0x7d')][_0x54c3cb][_0x712d('0x7f')],_0x268875[_0x712d('0x7d')][_0x54c3cb][_0x712d('0x80')]));}}}if(_0x268875[_0x712d('0x83')]){_0x268875['conditions']=JSON['parse'](_0x268875['conditions']);_0x236b7a['where'](_0x58f32d(_0x268875['conditions'][_0x712d('0x68')]));}_0x5b5138=_0x236b7a[_0x712d('0x9f')]();_0x236b7a[_0x712d('0x1f')](_0x5a6c91);_0x236b7a['offset'](0x0);logger[_0x712d('0xa0')](_0x712d('0x84'),_0x236b7a[_0x712d('0x85')]());return dbH['sequelize'][_0x712d('0x35')](_0x236b7a[_0x712d('0x85')](),{'type':dbH[_0x712d('0x86')][_0x712d('0x87')][_0x712d('0xa1')]});}})['then'](function(){return{'sql':_0x5b5138[_0x712d('0x85')]()};})['then'](respondWithResult(_0x34d624,null))[_0x712d('0x44')](handleError(_0x34d624,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 99891a7..965e795 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 _0x67f8=['api','bluebird','request-promise','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x296552,_0x19a077){var _0x415b90=function(_0x5211d5){while(--_0x5211d5){_0x296552['push'](_0x296552['shift']());}};_0x415b90(++_0x19a077);}(_0x67f8,0x105));var _0x867f=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x67f8[_0x45f951];return _0x24756c;};'use strict';var _=require(_0x867f('0x0'));var util=require(_0x867f('0x1'));var logger=require(_0x867f('0x2'))(_0x867f('0x3'));var moment=require('moment');var BPromise=require(_0x867f('0x4'));var rp=require(_0x867f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x867f('0x6'));var config=require('../../config/environment');var attributes=require(_0x867f('0x7'));module[_0x867f('0x8')]=function(_0x508bdc,_0x547c7d){return _0x508bdc[_0x867f('0x9')](_0x867f('0xa'),attributes,{'tableName':_0x867f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84fe=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x350f0b,_0x3f0281){var _0x8400b=function(_0x1f0098){while(--_0x1f0098){_0x350f0b['push'](_0x350f0b['shift']());}};_0x8400b(++_0x3f0281);}(_0x84fe,0xdb));var _0xe84f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x84fe[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe84f('0x0'));var util=require(_0xe84f('0x1'));var logger=require(_0xe84f('0x2'))(_0xe84f('0x3'));var moment=require(_0xe84f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe84f('0x5'));var rimraf=require(_0xe84f('0x6'));var config=require(_0xe84f('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0xe84f('0x8')]=function(_0x33ac1a,_0x6d5bd0){return _0x33ac1a['define'](_0xe84f('0x9'),attributes,{'tableName':_0xe84f('0xa'),'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 296f26d..ca38016 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 _0x9755=['client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2804f9,_0x186de6){var _0x231137=function(_0x166897){while(--_0x166897){_0x2804f9['push'](_0x2804f9['shift']());}};_0x231137(++_0x186de6);}(_0x9755,0x1c6));var _0x5975=function(_0x440917,_0x20ea7b){_0x440917=_0x440917-0x0;var _0x5e906b=_0x9755[_0x440917];return _0x5e906b;};'use strict';var _=require(_0x5975('0x0'));var util=require('util');var moment=require(_0x5975('0x1'));var BPromise=require(_0x5975('0x2'));var rs=require(_0x5975('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5975('0x4'))(_0x5975('0x5'));var config=require(_0x5975('0x6'));var jayson=require(_0x5975('0x7'));var client=jayson[_0x5975('0x8')][_0x5975('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x365ac3,_0x56fc2e,_0x48d8b5){return new BPromise(function(_0x2209f1,_0x55e597){return client[_0x5975('0xa')](_0x365ac3,_0x48d8b5)[_0x5975('0xb')](function(_0x15ebfd){logger['info'](_0x5975('0xc'),_0x56fc2e,'request\x20sent');logger['debug'](_0x5975('0xd'),_0x56fc2e,_0x5975('0xe'),JSON[_0x5975('0xf')](_0x15ebfd));if(_0x15ebfd['error']){if(_0x15ebfd[_0x5975('0x10')][_0x5975('0x11')]===0x1f4){logger[_0x5975('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x56fc2e,_0x15ebfd[_0x5975('0x10')][_0x5975('0x12')]);return _0x55e597(_0x15ebfd[_0x5975('0x10')][_0x5975('0x12')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x56fc2e,_0x15ebfd[_0x5975('0x10')][_0x5975('0x12')]);return _0x2209f1(_0x15ebfd[_0x5975('0x10')]['message']);}else{logger[_0x5975('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x56fc2e,_0x5975('0xe'));_0x2209f1(_0x15ebfd['result'][_0x5975('0x12')]);}})[_0x5975('0x14')](function(_0x16706c){logger[_0x5975('0x10')](_0x5975('0xc'),_0x56fc2e,_0x16706c);_0x55e597(_0x16706c);});});} \ No newline at end of file +var _0x2cbd=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x5bba00,_0x11eed2){var _0x417945=function(_0x5b3054){while(--_0x5b3054){_0x5bba00['push'](_0x5bba00['shift']());}};_0x417945(++_0x11eed2);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x485f53,_0x104081){_0x485f53=_0x485f53-0x0;var _0x480f1e=_0x2cbd[_0x485f53];return _0x480f1e;};'use strict';var _=require(_0xd2cb('0x0'));var util=require(_0xd2cb('0x1'));var moment=require('moment');var BPromise=require(_0xd2cb('0x2'));var rs=require(_0xd2cb('0x3'));var fs=require('fs');var Redis=require(_0xd2cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd2cb('0x5'));var logger=require(_0xd2cb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd2cb('0x7'));var client=jayson[_0xd2cb('0x8')][_0xd2cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ae725,_0x4c3593,_0x2c1ead){return new BPromise(function(_0x5ef97c,_0x173a87){return client['request'](_0x1ae725,_0x2c1ead)[_0xd2cb('0xa')](function(_0xd591f7){logger['info'](_0xd2cb('0xb'),_0x4c3593,_0xd2cb('0xc'));logger['debug'](_0xd2cb('0xd'),_0x4c3593,_0xd2cb('0xc'),JSON[_0xd2cb('0xe')](_0xd591f7));if(_0xd591f7[_0xd2cb('0xf')]){if(_0xd591f7[_0xd2cb('0xf')]['code']===0x1f4){logger[_0xd2cb('0xf')](_0xd2cb('0xb'),_0x4c3593,_0xd591f7[_0xd2cb('0xf')][_0xd2cb('0x10')]);return _0x173a87(_0xd591f7[_0xd2cb('0xf')]['message']);}logger[_0xd2cb('0xf')](_0xd2cb('0xb'),_0x4c3593,_0xd591f7[_0xd2cb('0xf')]['message']);return _0x5ef97c(_0xd591f7[_0xd2cb('0xf')][_0xd2cb('0x10')]);}else{logger['info'](_0xd2cb('0xb'),_0x4c3593,'request\x20sent');_0x5ef97c(_0xd591f7['result'][_0xd2cb('0x10')]);}})[_0xd2cb('0x11')](function(_0x1a24ac){logger[_0xd2cb('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4c3593,_0x1a24ac);_0x173a87(_0x1a24ac);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 8e8e1c2..17d0161 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 _0x3e3a=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','update','delete','destroy','multer','util','path'];(function(_0x2a2537,_0x17d717){var _0x549cb5=function(_0x2330bc){while(--_0x2330bc){_0x2a2537['push'](_0x2a2537['shift']());}};_0x549cb5(++_0x17d717);}(_0x3e3a,0x1cb));var _0xa3e3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3e3a[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xa3e3('0x0'));var util=require(_0xa3e3('0x1'));var path=require(_0xa3e3('0x2'));var timeout=require(_0xa3e3('0x3'));var express=require('express');var router=express[_0xa3e3('0x4')]();var auth=require(_0xa3e3('0x5'));var interaction=require(_0xa3e3('0x6'));var config=require('../../config/environment');var controller=require(_0xa3e3('0x7'));router[_0xa3e3('0x8')]('/',auth[_0xa3e3('0x9')](),controller['index']);router[_0xa3e3('0x8')](_0xa3e3('0xa'),auth[_0xa3e3('0x9')](),controller[_0xa3e3('0xb')]);router[_0xa3e3('0x8')](_0xa3e3('0xc'),auth[_0xa3e3('0x9')](),controller[_0xa3e3('0xd')]);router[_0xa3e3('0x8')](_0xa3e3('0xe'),auth[_0xa3e3('0x9')](),controller[_0xa3e3('0xf')]);router[_0xa3e3('0x8')](_0xa3e3('0x10'),auth[_0xa3e3('0x9')](),controller[_0xa3e3('0x11')]);router['post']('/',auth[_0xa3e3('0x9')](),controller[_0xa3e3('0x12')]);router['put'](_0xa3e3('0xa'),auth[_0xa3e3('0x9')](),controller[_0xa3e3('0x13')]);router[_0xa3e3('0x14')](_0xa3e3('0xa'),auth[_0xa3e3('0x9')](),controller[_0xa3e3('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5325=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5325,0xb0));var _0x5532=function(_0x5352ae,_0x4e7e3b){_0x5352ae=_0x5352ae-0x0;var _0x272d73=_0x5325[_0x5352ae];return _0x272d73;};'use strict';var multer=require('multer');var util=require(_0x5532('0x0'));var path=require(_0x5532('0x1'));var timeout=require(_0x5532('0x2'));var express=require(_0x5532('0x3'));var router=express[_0x5532('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5532('0x5'));var config=require(_0x5532('0x6'));var controller=require(_0x5532('0x7'));router[_0x5532('0x8')]('/',auth['isAuthenticated'](),controller[_0x5532('0x9')]);router[_0x5532('0x8')](_0x5532('0xa'),auth[_0x5532('0xb')](),controller[_0x5532('0xc')]);router['get'](_0x5532('0xd'),auth['isAuthenticated'](),controller[_0x5532('0xe')]);router[_0x5532('0x8')](_0x5532('0xf'),auth[_0x5532('0xb')](),controller[_0x5532('0x10')]);router['get'](_0x5532('0x11'),auth[_0x5532('0xb')](),controller['query']);router[_0x5532('0x12')]('/',auth[_0x5532('0xb')](),controller[_0x5532('0x13')]);router[_0x5532('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x5532('0x15')]);router[_0x5532('0x16')](_0x5532('0xa'),auth[_0x5532('0xb')](),controller[_0x5532('0x17')]);module[_0x5532('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 6db0767..01fcf0e 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 _0x551f=['sequelize','moment','exports','STRING','ENUM','csv','xlsx','manual','scheduled','INTEGER','UNSIGNED'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0x551f,0x18c));var _0xf551=function(_0x25e483,_0x2eedd8){_0x25e483=_0x25e483-0x0;var _0x117af9=_0x551f[_0x25e483];return _0x117af9;};'use strict';var Sequelize=require(_0xf551('0x0'));var moment=require(_0xf551('0x1'));module[_0xf551('0x2')]={'name':{'type':Sequelize[_0xf551('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xf551('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xf551('0x4')](_0xf551('0x5'),'pdf',_0xf551('0x6')),'allowNull':![],'defaultValue':_0xf551('0x5')},'savename':{'type':Sequelize[_0xf551('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xf551('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xf551('0x4')](_0xf551('0x7'),_0xf551('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xf551('0x9')](0xb)[_0xf551('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdbe8=['STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled','INTEGER','sequelize','moment','exports'];(function(_0x27e67f,_0x2370ad){var _0x278774=function(_0x18c0ea){while(--_0x18c0ea){_0x27e67f['push'](_0x27e67f['shift']());}};_0x278774(++_0x2370ad);}(_0xdbe8,0x81));var _0x8dbe=function(_0x1c46fa,_0x1ab712){_0x1c46fa=_0x1c46fa-0x0;var _0x295c44=_0xdbe8[_0x1c46fa];return _0x295c44;};'use strict';var Sequelize=require(_0x8dbe('0x0'));var moment=require(_0x8dbe('0x1'));module[_0x8dbe('0x2')]={'name':{'type':Sequelize[_0x8dbe('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x8dbe('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x8dbe('0x4')](_0x8dbe('0x5'),_0x8dbe('0x6'),_0x8dbe('0x7')),'allowNull':![],'defaultValue':_0x8dbe('0x5')},'savename':{'type':Sequelize[_0x8dbe('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8dbe('0x8')]},'endDate':{'type':Sequelize[_0x8dbe('0x8')]},'status':{'type':Sequelize[_0x8dbe('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x8dbe('0x4')](_0x8dbe('0x9'),_0x8dbe('0xa')),'allowNull':![],'defaultValue':_0x8dbe('0x9')},'reportId':{'type':Sequelize[_0x8dbe('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x8dbe('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 9164f8c..4b83f42 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 _0x9ff0=['ExtractedReports','end','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','keys','length','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','update','then','destroy','get'];(function(_0x48e3b8,_0x553b94){var _0x18d8df=function(_0x302aa2){while(--_0x302aa2){_0x48e3b8['push'](_0x48e3b8['shift']());}};_0x18d8df(++_0x553b94);}(_0x9ff0,0x143));var _0x09ff=function(_0x19c68a,_0x23c133){_0x19c68a=_0x19c68a-0x0;var _0x59ed4d=_0x9ff0[_0x19c68a];return _0x59ed4d;};'use strict';var pdf=require(_0x09ff('0x0'));var emlformat=require(_0x09ff('0x1'));var rimraf=require(_0x09ff('0x2'));var zipdir=require(_0x09ff('0x3'));var jsonpatch=require(_0x09ff('0x4'));var rp=require(_0x09ff('0x5'));var moment=require(_0x09ff('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x09ff('0x7'));var util=require('util');var path=require(_0x09ff('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x09ff('0x9'));var squel=require('squel');var crypto=require(_0x09ff('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x09ff('0xb'));var toCsv=require('to-csv');var querystring=require(_0x09ff('0xc'));var Papa=require(_0x09ff('0xd'));var Redis=require(_0x09ff('0xe'));var authService=require(_0x09ff('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x09ff('0x10'));var hardwareService=require(_0x09ff('0x11'));var logger=require(_0x09ff('0x12'))(_0x09ff('0x13'));var utils=require(_0x09ff('0x14'));var config=require(_0x09ff('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4780b3,_0x26c8f9){_0x26c8f9=_0x26c8f9||0xcc;return function(_0x2bab46){if(_0x2bab46){return _0x4780b3[_0x09ff('0x16')](_0x26c8f9);}return _0x4780b3[_0x09ff('0x17')](_0x26c8f9)['end']();};}function respondWithResult(_0x204388,_0x15ad65){_0x15ad65=_0x15ad65||0xc8;return function(_0x5a96be){if(_0x5a96be){return _0x204388[_0x09ff('0x17')](_0x15ad65)[_0x09ff('0x18')](_0x5a96be);}};}function respondWithFilteredResult(_0xa88252,_0x3089e6){return function(_0x25e2d3){if(_0x25e2d3){var _0x551d8a=_0x25e2d3[_0x09ff('0x19')],_0x47f528=_0x3089e6[_0x09ff('0x1a')],_0x447226=_0x3089e6[_0x09ff('0x1a')]+_0x3089e6[_0x09ff('0x1b')],_0x10af37;if(_0x447226>=_0x551d8a){_0x447226=_0x551d8a;_0x10af37=0xc8;}else{_0x10af37=0xce;}_0xa88252[_0x09ff('0x17')](_0x10af37);return _0xa88252[_0x09ff('0x1c')]('Content-Range',_0x47f528+'-'+_0x447226+'/'+_0x551d8a)[_0x09ff('0x18')](_0x25e2d3);}return null;};}function patchUpdates(_0x56898a){return function(_0x3885ed){try{jsonpatch['apply'](_0x3885ed,_0x56898a,!![]);}catch(_0x3eb050){return BPromise['reject'](_0x3eb050);}return _0x3885ed['save']();};}function saveUpdates(_0xf695fc,_0x577a55){return function(_0x4e5d67){if(_0x4e5d67){return _0x4e5d67[_0x09ff('0x1d')](_0xf695fc)[_0x09ff('0x1e')](function(_0x4baf58){return _0x4baf58;});}return null;};}function removeEntity(_0x4a1a4a,_0x103cbb){return function(_0x4b8f57){if(_0x4b8f57){return _0x4b8f57[_0x09ff('0x1f')]()[_0x09ff('0x1e')](function(){var _0x3e4b41=_0x4b8f57[_0x09ff('0x20')]({'plain':!![]});var _0x2d830c=_0x09ff('0x21');return db['UserProfileResource'][_0x09ff('0x1f')]({'where':{'type':_0x2d830c,'resourceId':_0x3e4b41['id']}})[_0x09ff('0x1e')](function(){return _0x4b8f57;});})[_0x09ff('0x1e')](function(){_0x4a1a4a['status'](0xcc)[_0x09ff('0x22')]();});}};}function handleEntityNotFound(_0x2f7a86,_0x2e446c){return function(_0x537b81){if(!_0x537b81){_0x2f7a86[_0x09ff('0x16')](0x194);}return _0x537b81;};}function handleError(_0x4eef4a,_0x167d95){_0x167d95=_0x167d95||0x1f4;return function(_0x25896e){logger[_0x09ff('0x23')](_0x25896e[_0x09ff('0x24')]);if(_0x25896e[_0x09ff('0x25')]){delete _0x25896e[_0x09ff('0x25')];}_0x4eef4a[_0x09ff('0x17')](_0x167d95)[_0x09ff('0x26')](_0x25896e);};}exports[_0x09ff('0x27')]=function(_0x5392c2,_0x113d9a){var _0x4f2d6a={},_0x3720ab={},_0x169e16={'count':0x0,'rows':[]};var _0x46bc10=_[_0x09ff('0x28')](db[_0x09ff('0x29')][_0x09ff('0x2a')],function(_0x2d8fcf){return{'name':_0x2d8fcf[_0x09ff('0x2b')],'type':_0x2d8fcf[_0x09ff('0x2c')][_0x09ff('0x2d')]};});_0x3720ab['model']=_['map'](_0x46bc10,_0x09ff('0x25'));_0x3720ab[_0x09ff('0x2e')]=_['keys'](_0x5392c2[_0x09ff('0x2e')]);_0x3720ab[_0x09ff('0x2f')]=_[_0x09ff('0x30')](_0x3720ab[_0x09ff('0x31')],_0x3720ab[_0x09ff('0x2e')]);_0x4f2d6a[_0x09ff('0x32')]=_['intersection'](_0x3720ab[_0x09ff('0x31')],qs['fields'](_0x5392c2['query'][_0x09ff('0x33')]));_0x4f2d6a['attributes']=_0x4f2d6a[_0x09ff('0x32')]['length']?_0x4f2d6a[_0x09ff('0x32')]:_0x3720ab['model'];if(!_0x5392c2['query']['hasOwnProperty']('nolimit')){_0x4f2d6a['limit']=qs[_0x09ff('0x1b')](_0x5392c2[_0x09ff('0x2e')][_0x09ff('0x1b')]);_0x4f2d6a[_0x09ff('0x1a')]=qs[_0x09ff('0x1a')](_0x5392c2[_0x09ff('0x2e')][_0x09ff('0x1a')]);}_0x4f2d6a['order']=qs[_0x09ff('0x34')](_0x5392c2[_0x09ff('0x2e')][_0x09ff('0x34')]);_0x4f2d6a[_0x09ff('0x35')]=qs[_0x09ff('0x2f')](_[_0x09ff('0x36')](_0x5392c2[_0x09ff('0x2e')],_0x3720ab['filters']),_0x46bc10);if(_0x5392c2[_0x09ff('0x2e')][_0x09ff('0x37')]){_0x4f2d6a[_0x09ff('0x35')]=_[_0x09ff('0x38')](_0x4f2d6a['where'],{'$or':_[_0x09ff('0x28')](_0x46bc10,function(_0xaa42b3){if(_0xaa42b3[_0x09ff('0x2c')]!=='VIRTUAL'){var _0x343c34={};_0x343c34[_0xaa42b3[_0x09ff('0x25')]]={'$like':'%'+_0x5392c2['query'][_0x09ff('0x37')]+'%'};return _0x343c34;}})});}_0x4f2d6a=_[_0x09ff('0x38')]({},_0x4f2d6a,_0x5392c2['options']);var _0x3d4397={'where':_0x4f2d6a[_0x09ff('0x35')]};return db['AnalyticExtractedReport'][_0x09ff('0x19')](_0x3d4397)[_0x09ff('0x1e')](function(_0x7e5078){_0x169e16[_0x09ff('0x19')]=_0x7e5078;if(_0x5392c2[_0x09ff('0x2e')][_0x09ff('0x39')]){_0x4f2d6a['include']=[{'all':!![]}];}return db[_0x09ff('0x29')][_0x09ff('0x3a')](_0x4f2d6a);})[_0x09ff('0x1e')](function(_0x485d10){_0x169e16[_0x09ff('0x3b')]=_0x485d10;return _0x169e16;})[_0x09ff('0x1e')](respondWithFilteredResult(_0x113d9a,_0x4f2d6a))[_0x09ff('0x3c')](handleError(_0x113d9a,null));};exports[_0x09ff('0x3d')]=function(_0x4a5f3b,_0x190c95){var _0x283020={'raw':!![],'where':{'id':_0x4a5f3b[_0x09ff('0x3e')]['id']}},_0x1925d1={};_0x1925d1[_0x09ff('0x31')]=_[_0x09ff('0x3f')](db['AnalyticExtractedReport'][_0x09ff('0x2a')]);_0x1925d1['query']=_[_0x09ff('0x3f')](_0x4a5f3b[_0x09ff('0x2e')]);_0x1925d1[_0x09ff('0x2f')]=_[_0x09ff('0x30')](_0x1925d1['model'],_0x1925d1['query']);_0x283020[_0x09ff('0x32')]=_[_0x09ff('0x30')](_0x1925d1[_0x09ff('0x31')],qs['fields'](_0x4a5f3b[_0x09ff('0x2e')]['fields']));_0x283020[_0x09ff('0x32')]=_0x283020['attributes'][_0x09ff('0x40')]?_0x283020[_0x09ff('0x32')]:_0x1925d1['model'];if(_0x4a5f3b[_0x09ff('0x2e')][_0x09ff('0x39')]){_0x283020[_0x09ff('0x41')]=[{'all':!![]}];}_0x283020=_['merge']({},_0x283020,_0x4a5f3b[_0x09ff('0x42')]);return db[_0x09ff('0x29')]['find'](_0x283020)['then'](handleEntityNotFound(_0x190c95,null))['then'](respondWithResult(_0x190c95,null))['catch'](handleError(_0x190c95,null));};exports[_0x09ff('0x43')]=function(_0x571d98,_0x201ff8){return db[_0x09ff('0x29')][_0x09ff('0x43')](_0x571d98[_0x09ff('0x44')],{})[_0x09ff('0x1e')](function(_0x496d92){var _0xb8ea00=_0x571d98[_0x09ff('0x45')][_0x09ff('0x20')]({'plain':!![]});if(!_0xb8ea00)throw new Error(_0x09ff('0x46'));if(_0xb8ea00[_0x09ff('0x47')]===_0x09ff('0x45')){var _0x520cc4=_0x496d92[_0x09ff('0x20')]({'plain':!![]});var _0x455e27=_0x09ff('0x21');return db['UserProfileSection'][_0x09ff('0x48')]({'where':{'name':_0x455e27,'userProfileId':_0xb8ea00[_0x09ff('0x49')]},'raw':!![]})['then'](function(_0x2148dd){if(_0x2148dd&&_0x2148dd['autoAssociation']===0x0){return db[_0x09ff('0x4a')]['create']({'name':_0x520cc4[_0x09ff('0x25')],'resourceId':_0x520cc4['id'],'type':_0x2148dd[_0x09ff('0x25')],'sectionId':_0x2148dd['id']},{})[_0x09ff('0x1e')](function(){return _0x496d92;});}else{return _0x496d92;}})[_0x09ff('0x3c')](function(_0x16ed5d){logger['error'](_0x09ff('0x4b'),_0x16ed5d);throw _0x16ed5d;});}return _0x496d92;})[_0x09ff('0x1e')](respondWithResult(_0x201ff8,0xc9))[_0x09ff('0x3c')](handleError(_0x201ff8,null));};exports[_0x09ff('0x1d')]=function(_0x22d624,_0x7d3299){if(_0x22d624[_0x09ff('0x44')]['id']){delete _0x22d624[_0x09ff('0x44')]['id'];}return db['AnalyticExtractedReport'][_0x09ff('0x48')]({'where':{'id':_0x22d624[_0x09ff('0x3e')]['id']}})[_0x09ff('0x1e')](handleEntityNotFound(_0x7d3299,null))[_0x09ff('0x1e')](saveUpdates(_0x22d624[_0x09ff('0x44')],null))[_0x09ff('0x1e')](respondWithResult(_0x7d3299,null))[_0x09ff('0x3c')](handleError(_0x7d3299,null));};exports[_0x09ff('0x1f')]=function(_0x5e0162,_0x1cf57f){return db[_0x09ff('0x29')]['find']({'where':{'id':_0x5e0162['params']['id']}})[_0x09ff('0x1e')](handleEntityNotFound(_0x1cf57f,null))['then'](removeEntity(_0x1cf57f,null))[_0x09ff('0x3c')](handleError(_0x1cf57f,null));};exports['download']=function(_0x564b44,_0xc35fe,_0x10c74c){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x564b44[_0x09ff('0x3e')]['id']},'attributes':[_0x09ff('0x25'),_0x09ff('0x4c'),_0x09ff('0x4d'),_0x09ff('0x4e')],'raw':!![]})[_0x09ff('0x1e')](handleEntityNotFound(_0xc35fe,null))[_0x09ff('0x1e')](function(_0x2d3cd5){if(_0x2d3cd5){if(!fs[_0x09ff('0x4f')](path[_0x09ff('0x50')](config[_0x09ff('0x51')],'server/files/reports',_0x2d3cd5[_0x09ff('0x4d')]))){throw new db[(_0x09ff('0x52'))][(_0x09ff('0x53'))](_0x09ff('0x54'));}if(_0x564b44[_0x09ff('0x2e')][_0x09ff('0x55')]){return _0xc35fe[_0x09ff('0x16')](0xc8);}return _0xc35fe[_0x09ff('0x56')](path[_0x09ff('0x50')](config['root'],'server/files/reports',_0x2d3cd5[_0x09ff('0x4d')]),util['format'](_0x09ff('0x57'),_0x2d3cd5[_0x09ff('0x4c')]||_0x2d3cd5['name'],_0x2d3cd5[_0x09ff('0x4e')][_0x09ff('0x58')]()));}})[_0x09ff('0x3c')](handleError(_0xc35fe,null));}; \ No newline at end of file +var _0xdd47=['then','destroy','get','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','savename','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','format','%s.%s','output','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','set','apply','reject','save'];(function(_0x3a7407,_0x381e8e){var _0x3b62d8=function(_0x3e3d97){while(--_0x3e3d97){_0x3a7407['push'](_0x3a7407['shift']());}};_0x3b62d8(++_0x381e8e);}(_0xdd47,0x15e));var _0x7dd4=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0xdd47[_0x2aee2f];return _0x19337f;};'use strict';var pdf=require(_0x7dd4('0x0'));var emlformat=require(_0x7dd4('0x1'));var rimraf=require(_0x7dd4('0x2'));var zipdir=require(_0x7dd4('0x3'));var jsonpatch=require(_0x7dd4('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7dd4('0x5'));var Mustache=require('mustache');var util=require(_0x7dd4('0x6'));var path=require(_0x7dd4('0x7'));var sox=require(_0x7dd4('0x8'));var csv=require(_0x7dd4('0x9'));var ejs=require(_0x7dd4('0xa'));var fs=require('fs');var _=require(_0x7dd4('0xb'));var squel=require(_0x7dd4('0xc'));var crypto=require(_0x7dd4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7dd4('0xe'));var toCsv=require(_0x7dd4('0x9'));var querystring=require(_0x7dd4('0xf'));var Papa=require(_0x7dd4('0x10'));var Redis=require(_0x7dd4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7dd4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7dd4('0x13'));var logger=require(_0x7dd4('0x14'))(_0x7dd4('0x15'));var utils=require(_0x7dd4('0x16'));var config=require(_0x7dd4('0x17'));var licenseUtil=require(_0x7dd4('0x18'));var db=require(_0x7dd4('0x19'))['db'];function respondWithStatusCode(_0x14a3c3,_0x5aa890){_0x5aa890=_0x5aa890||0xcc;return function(_0x118256){if(_0x118256){return _0x14a3c3['sendStatus'](_0x5aa890);}return _0x14a3c3[_0x7dd4('0x1a')](_0x5aa890)['end']();};}function respondWithResult(_0x1bc7ff,_0x54fea4){_0x54fea4=_0x54fea4||0xc8;return function(_0x4e91ca){if(_0x4e91ca){return _0x1bc7ff[_0x7dd4('0x1a')](_0x54fea4)[_0x7dd4('0x1b')](_0x4e91ca);}};}function respondWithFilteredResult(_0x5b3a4a,_0x3eaa58){return function(_0x5cbf35){if(_0x5cbf35){var _0x3da883=_0x5cbf35['count'],_0x3ef4b8=_0x3eaa58[_0x7dd4('0x1c')],_0x51efd7=_0x3eaa58[_0x7dd4('0x1c')]+_0x3eaa58[_0x7dd4('0x1d')],_0x40d3b7;if(_0x51efd7>=_0x3da883){_0x51efd7=_0x3da883;_0x40d3b7=0xc8;}else{_0x40d3b7=0xce;}_0x5b3a4a[_0x7dd4('0x1a')](_0x40d3b7);return _0x5b3a4a[_0x7dd4('0x1e')]('Content-Range',_0x3ef4b8+'-'+_0x51efd7+'/'+_0x3da883)[_0x7dd4('0x1b')](_0x5cbf35);}return null;};}function patchUpdates(_0x382851){return function(_0xbed6a){try{jsonpatch[_0x7dd4('0x1f')](_0xbed6a,_0x382851,!![]);}catch(_0x435116){return BPromise[_0x7dd4('0x20')](_0x435116);}return _0xbed6a[_0x7dd4('0x21')]();};}function saveUpdates(_0x12e495,_0x20eb18){return function(_0x1eeab8){if(_0x1eeab8){return _0x1eeab8['update'](_0x12e495)[_0x7dd4('0x22')](function(_0x311c82){return _0x311c82;});}return null;};}function removeEntity(_0x377168,_0x659cad){return function(_0x2db338){if(_0x2db338){return _0x2db338[_0x7dd4('0x23')]()['then'](function(){var _0xd756ea=_0x2db338[_0x7dd4('0x24')]({'plain':!![]});var _0x2738a2='ExtractedReports';return db['UserProfileResource'][_0x7dd4('0x23')]({'where':{'type':_0x2738a2,'resourceId':_0xd756ea['id']}})[_0x7dd4('0x22')](function(){return _0x2db338;});})[_0x7dd4('0x22')](function(){_0x377168[_0x7dd4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc31e88,_0x3846d2){return function(_0x23ba70){if(!_0x23ba70){_0xc31e88['sendStatus'](0x194);}return _0x23ba70;};}function handleError(_0x2574a1,_0x4e92ab){_0x4e92ab=_0x4e92ab||0x1f4;return function(_0x59d937){logger['error'](_0x59d937[_0x7dd4('0x25')]);if(_0x59d937[_0x7dd4('0x26')]){delete _0x59d937[_0x7dd4('0x26')];}_0x2574a1['status'](_0x4e92ab)[_0x7dd4('0x27')](_0x59d937);};}exports['index']=function(_0x319483,_0xafdfc1){var _0x899282={},_0x3a6ced={},_0x19dcf4={'count':0x0,'rows':[]};var _0x106100=_[_0x7dd4('0x28')](db[_0x7dd4('0x29')][_0x7dd4('0x2a')],function(_0x22635b){return{'name':_0x22635b[_0x7dd4('0x2b')],'type':_0x22635b[_0x7dd4('0x2c')][_0x7dd4('0x2d')]};});_0x3a6ced[_0x7dd4('0x2e')]=_[_0x7dd4('0x28')](_0x106100,_0x7dd4('0x26'));_0x3a6ced[_0x7dd4('0x2f')]=_[_0x7dd4('0x30')](_0x319483[_0x7dd4('0x2f')]);_0x3a6ced[_0x7dd4('0x31')]=_[_0x7dd4('0x32')](_0x3a6ced[_0x7dd4('0x2e')],_0x3a6ced['query']);_0x899282[_0x7dd4('0x33')]=_[_0x7dd4('0x32')](_0x3a6ced[_0x7dd4('0x2e')],qs[_0x7dd4('0x34')](_0x319483[_0x7dd4('0x2f')][_0x7dd4('0x34')]));_0x899282['attributes']=_0x899282[_0x7dd4('0x33')][_0x7dd4('0x35')]?_0x899282[_0x7dd4('0x33')]:_0x3a6ced[_0x7dd4('0x2e')];if(!_0x319483[_0x7dd4('0x2f')]['hasOwnProperty'](_0x7dd4('0x36'))){_0x899282[_0x7dd4('0x1d')]=qs['limit'](_0x319483['query'][_0x7dd4('0x1d')]);_0x899282[_0x7dd4('0x1c')]=qs['offset'](_0x319483[_0x7dd4('0x2f')][_0x7dd4('0x1c')]);}_0x899282[_0x7dd4('0x37')]=qs['sort'](_0x319483['query'][_0x7dd4('0x38')]);_0x899282[_0x7dd4('0x39')]=qs[_0x7dd4('0x31')](_[_0x7dd4('0x3a')](_0x319483['query'],_0x3a6ced[_0x7dd4('0x31')]),_0x106100);if(_0x319483['query'][_0x7dd4('0x3b')]){_0x899282[_0x7dd4('0x39')]=_[_0x7dd4('0x3c')](_0x899282['where'],{'$or':_[_0x7dd4('0x28')](_0x106100,function(_0x1b2d47){if(_0x1b2d47[_0x7dd4('0x2c')]!==_0x7dd4('0x3d')){var _0x6e0c8f={};_0x6e0c8f[_0x1b2d47[_0x7dd4('0x26')]]={'$like':'%'+_0x319483[_0x7dd4('0x2f')]['filter']+'%'};return _0x6e0c8f;}})});}_0x899282=_[_0x7dd4('0x3c')]({},_0x899282,_0x319483['options']);var _0x47d493={'where':_0x899282[_0x7dd4('0x39')]};return db[_0x7dd4('0x29')]['count'](_0x47d493)[_0x7dd4('0x22')](function(_0xfaaaef){_0x19dcf4[_0x7dd4('0x3e')]=_0xfaaaef;if(_0x319483['query'][_0x7dd4('0x3f')]){_0x899282[_0x7dd4('0x40')]=[{'all':!![]}];}return db[_0x7dd4('0x29')][_0x7dd4('0x41')](_0x899282);})[_0x7dd4('0x22')](function(_0x48706f){_0x19dcf4[_0x7dd4('0x42')]=_0x48706f;return _0x19dcf4;})[_0x7dd4('0x22')](respondWithFilteredResult(_0xafdfc1,_0x899282))[_0x7dd4('0x43')](handleError(_0xafdfc1,null));};exports[_0x7dd4('0x44')]=function(_0x84083f,_0x4203f7){var _0x2f3871={'raw':!![],'where':{'id':_0x84083f[_0x7dd4('0x45')]['id']}},_0x27ffed={};_0x27ffed[_0x7dd4('0x2e')]=_[_0x7dd4('0x30')](db['AnalyticExtractedReport']['rawAttributes']);_0x27ffed[_0x7dd4('0x2f')]=_[_0x7dd4('0x30')](_0x84083f['query']);_0x27ffed[_0x7dd4('0x31')]=_['intersection'](_0x27ffed[_0x7dd4('0x2e')],_0x27ffed[_0x7dd4('0x2f')]);_0x2f3871[_0x7dd4('0x33')]=_[_0x7dd4('0x32')](_0x27ffed[_0x7dd4('0x2e')],qs['fields'](_0x84083f['query'][_0x7dd4('0x34')]));_0x2f3871['attributes']=_0x2f3871[_0x7dd4('0x33')]['length']?_0x2f3871[_0x7dd4('0x33')]:_0x27ffed[_0x7dd4('0x2e')];if(_0x84083f[_0x7dd4('0x2f')][_0x7dd4('0x3f')]){_0x2f3871['include']=[{'all':!![]}];}_0x2f3871=_[_0x7dd4('0x3c')]({},_0x2f3871,_0x84083f['options']);return db['AnalyticExtractedReport'][_0x7dd4('0x46')](_0x2f3871)[_0x7dd4('0x22')](handleEntityNotFound(_0x4203f7,null))['then'](respondWithResult(_0x4203f7,null))[_0x7dd4('0x43')](handleError(_0x4203f7,null));};exports[_0x7dd4('0x47')]=function(_0x2aa273,_0x2d8514){return db['AnalyticExtractedReport'][_0x7dd4('0x47')](_0x2aa273[_0x7dd4('0x48')],{})['then'](function(_0x141202){var _0x329c5f=_0x2aa273[_0x7dd4('0x49')][_0x7dd4('0x24')]({'plain':!![]});if(!_0x329c5f)throw new Error(_0x7dd4('0x4a'));if(_0x329c5f['role']===_0x7dd4('0x49')){var _0xec1b55=_0x141202[_0x7dd4('0x24')]({'plain':!![]});var _0xdc9b3d=_0x7dd4('0x4b');return db[_0x7dd4('0x4c')][_0x7dd4('0x46')]({'where':{'name':_0xdc9b3d,'userProfileId':_0x329c5f[_0x7dd4('0x4d')]},'raw':!![]})[_0x7dd4('0x22')](function(_0x253d14){if(_0x253d14&&_0x253d14[_0x7dd4('0x4e')]===0x0){return db[_0x7dd4('0x4f')][_0x7dd4('0x47')]({'name':_0xec1b55[_0x7dd4('0x26')],'resourceId':_0xec1b55['id'],'type':_0x253d14[_0x7dd4('0x26')],'sectionId':_0x253d14['id']},{})[_0x7dd4('0x22')](function(){return _0x141202;});}else{return _0x141202;}})[_0x7dd4('0x43')](function(_0x1a831f){logger['error'](_0x7dd4('0x50'),_0x1a831f);throw _0x1a831f;});}return _0x141202;})[_0x7dd4('0x22')](respondWithResult(_0x2d8514,0xc9))[_0x7dd4('0x43')](handleError(_0x2d8514,null));};exports[_0x7dd4('0x51')]=function(_0x17644f,_0x35e7da){if(_0x17644f[_0x7dd4('0x48')]['id']){delete _0x17644f[_0x7dd4('0x48')]['id'];}return db[_0x7dd4('0x29')][_0x7dd4('0x46')]({'where':{'id':_0x17644f[_0x7dd4('0x45')]['id']}})[_0x7dd4('0x22')](handleEntityNotFound(_0x35e7da,null))[_0x7dd4('0x22')](saveUpdates(_0x17644f['body'],null))[_0x7dd4('0x22')](respondWithResult(_0x35e7da,null))[_0x7dd4('0x43')](handleError(_0x35e7da,null));};exports[_0x7dd4('0x23')]=function(_0x15f83f,_0x321309){return db['AnalyticExtractedReport'][_0x7dd4('0x46')]({'where':{'id':_0x15f83f[_0x7dd4('0x45')]['id']}})[_0x7dd4('0x22')](handleEntityNotFound(_0x321309,null))[_0x7dd4('0x22')](removeEntity(_0x321309,null))[_0x7dd4('0x43')](handleError(_0x321309,null));};exports[_0x7dd4('0x52')]=function(_0x25a6b6,_0xc3b3a2,_0x1b81fe){return db['AnalyticExtractedReport'][_0x7dd4('0x46')]({'where':{'id':_0x25a6b6['params']['id']},'attributes':[_0x7dd4('0x26'),_0x7dd4('0x53'),_0x7dd4('0x54'),'output'],'raw':!![]})[_0x7dd4('0x22')](handleEntityNotFound(_0xc3b3a2,null))[_0x7dd4('0x22')](function(_0x3802f0){if(_0x3802f0){if(!fs['existsSync'](path[_0x7dd4('0x55')](config[_0x7dd4('0x56')],_0x7dd4('0x57'),_0x3802f0['savename']))){throw new db[(_0x7dd4('0x58'))][(_0x7dd4('0x59'))](_0x7dd4('0x5a'));}if(_0x25a6b6[_0x7dd4('0x2f')][_0x7dd4('0x5b')]){return _0xc3b3a2[_0x7dd4('0x5c')](0xc8);}return _0xc3b3a2[_0x7dd4('0x52')](path['join'](config[_0x7dd4('0x56')],'server/files/reports',_0x3802f0[_0x7dd4('0x54')]),util[_0x7dd4('0x5d')](_0x7dd4('0x5e'),_0x3802f0[_0x7dd4('0x53')]||_0x3802f0[_0x7dd4('0x26')],_0x3802f0[_0x7dd4('0x5f')]['toLowerCase']()));}})[_0x7dd4('0x43')](handleError(_0xc3b3a2,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 03506a4..5a2339c 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 _0xc4be=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport'];(function(_0x24e2c2,_0x25ffc6){var _0xe8282a=function(_0x12556d){while(--_0x12556d){_0x24e2c2['push'](_0x24e2c2['shift']());}};_0xe8282a(++_0x25ffc6);}(_0xc4be,0x140));var _0xec4b=function(_0x51af80,_0x5206c7){_0x51af80=_0x51af80-0x0;var _0x481bdb=_0xc4be[_0x51af80];return _0x481bdb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xec4b('0x0'))('api');var moment=require(_0xec4b('0x1'));var BPromise=require(_0xec4b('0x2'));var rp=require(_0xec4b('0x3'));var fs=require('fs');var path=require(_0xec4b('0x4'));var rimraf=require('rimraf');var config=require(_0xec4b('0x5'));var attributes=require(_0xec4b('0x6'));module[_0xec4b('0x7')]=function(_0x16bef4,_0x2c71fb){return _0x16bef4[_0xec4b('0x8')](_0xec4b('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1d1=['moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x228903,_0x5c9b83){var _0x41c9b8=function(_0x522259){while(--_0x522259){_0x228903['push'](_0x228903['shift']());}};_0x41c9b8(++_0x5c9b83);}(_0xe1d1,0x6a));var _0x1e1d=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xe1d1[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x1e1d('0x0'));var util=require(_0x1e1d('0x1'));var logger=require(_0x1e1d('0x2'))(_0x1e1d('0x3'));var moment=require(_0x1e1d('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e1d('0x5'));var fs=require('fs');var path=require(_0x1e1d('0x6'));var rimraf=require(_0x1e1d('0x7'));var config=require(_0x1e1d('0x8'));var attributes=require(_0x1e1d('0x9'));module[_0x1e1d('0xa')]=function(_0x49cc1c,_0x3137d3){return _0x49cc1c['define']('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','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 e4cb85e..0da6bc0 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 _0xcf19=['code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5122cf,_0x139296){var _0x3662a2=function(_0x224e69){while(--_0x224e69){_0x5122cf['push'](_0x5122cf['shift']());}};_0x3662a2(++_0x139296);}(_0xcf19,0x17d));var _0x9cf1=function(_0x33ab79,_0x4f7c50){_0x33ab79=_0x33ab79-0x0;var _0x10ac00=_0xcf19[_0x33ab79];return _0x10ac00;};'use strict';var _=require('lodash');var util=require(_0x9cf1('0x0'));var moment=require(_0x9cf1('0x1'));var BPromise=require(_0x9cf1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cf1('0x3'));var db=require(_0x9cf1('0x4'))['db'];var utils=require(_0x9cf1('0x5'));var logger=require(_0x9cf1('0x6'))(_0x9cf1('0x7'));var config=require(_0x9cf1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9cf1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd4129,_0xcb830d,_0xeb008e){return new BPromise(function(_0x4b2dfe,_0x1cf5b2){return client[_0x9cf1('0xa')](_0xd4129,_0xeb008e)[_0x9cf1('0xb')](function(_0x431e09){logger[_0x9cf1('0xc')](_0x9cf1('0xd'),_0xcb830d,_0x9cf1('0xe'));logger['debug'](_0x9cf1('0xf'),_0xcb830d,_0x9cf1('0xe'),JSON[_0x9cf1('0x10')](_0x431e09));if(_0x431e09[_0x9cf1('0x11')]){if(_0x431e09['error'][_0x9cf1('0x12')]===0x1f4){logger[_0x9cf1('0x11')](_0x9cf1('0xd'),_0xcb830d,_0x431e09['error'][_0x9cf1('0x13')]);return _0x1cf5b2(_0x431e09[_0x9cf1('0x11')][_0x9cf1('0x13')]);}logger[_0x9cf1('0x11')](_0x9cf1('0xd'),_0xcb830d,_0x431e09[_0x9cf1('0x11')][_0x9cf1('0x13')]);return _0x4b2dfe(_0x431e09[_0x9cf1('0x11')][_0x9cf1('0x13')]);}else{logger[_0x9cf1('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xcb830d,'request\x20sent');_0x4b2dfe(_0x431e09[_0x9cf1('0x14')][_0x9cf1('0x13')]);}})['catch'](function(_0x14bea1){logger[_0x9cf1('0x11')](_0x9cf1('0xd'),_0xcb830d,_0x14bea1);_0x1cf5b2(_0x14bea1);});});} \ No newline at end of file +var _0xdb58=['error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1ba4b4,_0x39664d){var _0x1fd293=function(_0x3df504){while(--_0x3df504){_0x1ba4b4['push'](_0x1ba4b4['shift']());}};_0x1fd293(++_0x39664d);}(_0xdb58,0x1e8));var _0x8db5=function(_0x5ec36e,_0x397bb0){_0x5ec36e=_0x5ec36e-0x0;var _0x3df592=_0xdb58[_0x5ec36e];return _0x3df592;};'use strict';var _=require(_0x8db5('0x0'));var util=require(_0x8db5('0x1'));var moment=require(_0x8db5('0x2'));var BPromise=require(_0x8db5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8db5('0x5'));var logger=require(_0x8db5('0x6'))(_0x8db5('0x7'));var config=require(_0x8db5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8db5('0x9')][_0x8db5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c88c6,_0x5905b6,_0x28cd97){return new BPromise(function(_0x150298,_0x73cef2){return client['request'](_0x1c88c6,_0x28cd97)[_0x8db5('0xb')](function(_0x589517){logger[_0x8db5('0xc')](_0x8db5('0xd'),_0x5905b6,_0x8db5('0xe'));logger[_0x8db5('0xf')](_0x8db5('0x10'),_0x5905b6,_0x8db5('0xe'),JSON[_0x8db5('0x11')](_0x589517));if(_0x589517[_0x8db5('0x12')]){if(_0x589517[_0x8db5('0x12')]['code']===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5905b6,_0x589517['error'][_0x8db5('0x13')]);return _0x73cef2(_0x589517[_0x8db5('0x12')][_0x8db5('0x13')]);}logger[_0x8db5('0x12')](_0x8db5('0xd'),_0x5905b6,_0x589517[_0x8db5('0x12')][_0x8db5('0x13')]);return _0x150298(_0x589517[_0x8db5('0x12')][_0x8db5('0x13')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5905b6,'request\x20sent');_0x150298(_0x589517[_0x8db5('0x14')][_0x8db5('0x13')]);}})[_0x8db5('0x15')](function(_0x29fa23){logger[_0x8db5('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5905b6,_0x29fa23);_0x73cef2(_0x29fa23);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index ff65e57..95b3020 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 _0xef17=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','get','/:id','/:id/download','post','put','delete','destroy','exports','multer','util','path','express'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0xef17,0x1be));var _0x7ef1=function(_0x4bc204,_0x36f8da){_0x4bc204=_0x4bc204-0x0;var _0x2b6c9d=_0xef17[_0x4bc204];return _0x2b6c9d;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ef1('0x3'));var router=express[_0x7ef1('0x4')]();var auth=require(_0x7ef1('0x5'));var interaction=require(_0x7ef1('0x6'));var config=require(_0x7ef1('0x7'));var controller=require(_0x7ef1('0x8'));router['get']('/',auth[_0x7ef1('0x9')](),controller['index']);router[_0x7ef1('0xa')](_0x7ef1('0xb'),auth[_0x7ef1('0x9')](),controller['show']);router[_0x7ef1('0xa')](_0x7ef1('0xc'),auth[_0x7ef1('0x9')](),controller['download']);router[_0x7ef1('0xd')]('/',auth[_0x7ef1('0x9')](),controller['create']);router[_0x7ef1('0xe')](_0x7ef1('0xb'),auth[_0x7ef1('0x9')](),controller['update']);router[_0x7ef1('0xf')](_0x7ef1('0xb'),auth[_0x7ef1('0x9')](),controller[_0x7ef1('0x10')]);module[_0x7ef1('0x11')]=router; \ No newline at end of file +var _0xb945=['show','download','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated'];(function(_0x31004c,_0x503c2e){var _0x399a98=function(_0x402a98){while(--_0x402a98){_0x31004c['push'](_0x31004c['shift']());}};_0x399a98(++_0x503c2e);}(_0xb945,0x120));var _0x5b94=function(_0x48ced3,_0x28d7d7){_0x48ced3=_0x48ced3-0x0;var _0x17d50a=_0xb945[_0x48ced3];return _0x17d50a;};'use strict';var multer=require(_0x5b94('0x0'));var util=require('util');var path=require(_0x5b94('0x1'));var timeout=require(_0x5b94('0x2'));var express=require('express');var router=express[_0x5b94('0x3')]();var auth=require(_0x5b94('0x4'));var interaction=require(_0x5b94('0x5'));var config=require(_0x5b94('0x6'));var controller=require(_0x5b94('0x7'));router[_0x5b94('0x8')]('/',auth['isAuthenticated'](),controller[_0x5b94('0x9')]);router[_0x5b94('0x8')](_0x5b94('0xa'),auth[_0x5b94('0xb')](),controller[_0x5b94('0xc')]);router[_0x5b94('0x8')]('/:id/download',auth[_0x5b94('0xb')](),controller[_0x5b94('0xd')]);router[_0x5b94('0xe')]('/',auth[_0x5b94('0xb')](),controller['create']);router[_0x5b94('0xf')]('/:id',auth[_0x5b94('0xb')](),controller[_0x5b94('0x10')]);router[_0x5b94('0x11')](_0x5b94('0xa'),auth['isAuthenticated'](),controller[_0x5b94('0x12')]);module[_0x5b94('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 3ac0d83..3cbd17c 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 _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x14c31b,_0x584039){var _0x55bdd1=function(_0x2cdc45){while(--_0x2cdc45){_0x14c31b['push'](_0x14c31b['shift']());}};_0x55bdd1(++_0x584039);}(_0x5fc3,0xa8));var _0x35fc=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0x5fc3[_0x382c73];return _0x1dd0bf;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x315993,_0x5ea3a4){var _0x5f1766=function(_0x353297){while(--_0x353297){_0x315993['push'](_0x315993['shift']());}};_0x5f1766(++_0x5ea3a4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'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 3b1b761..d22c86c 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 _0xef9e=['update','destroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel','jsforce','to-csv','querystring','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','offset','set','Content-Range','reject','save','then','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','limit','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','bulkCreate'];(function(_0x3034ce,_0x1421b6){var _0x4bc0e3=function(_0x49a5ca){while(--_0x49a5ca){_0x3034ce['push'](_0x3034ce['shift']());}};_0x4bc0e3(++_0x1421b6);}(_0xef9e,0x1ef));var _0xeef9=function(_0xc85513,_0x49e852){_0xc85513=_0xc85513-0x0;var _0x3e70be=_0xef9e[_0xc85513];return _0x3e70be;};'use strict';var pdf=require(_0xeef9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeef9('0x1'));var zipdir=require(_0xeef9('0x2'));var jsonpatch=require(_0xeef9('0x3'));var rp=require(_0xeef9('0x4'));var moment=require(_0xeef9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeef9('0x6'));var path=require(_0xeef9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeef9('0x8'));var fs=require('fs');var _=require(_0xeef9('0x9'));var squel=require(_0xeef9('0xa'));var crypto=require('crypto');var jsforce=require(_0xeef9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xeef9('0xc'));var querystring=require(_0xeef9('0xd'));var Papa=require(_0xeef9('0xe'));var Redis=require(_0xeef9('0xf'));var authService=require(_0xeef9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeef9('0x11'));var hardwareService=require(_0xeef9('0x12'));var logger=require(_0xeef9('0x13'))(_0xeef9('0x14'));var utils=require(_0xeef9('0x15'));var config=require(_0xeef9('0x16'));var licenseUtil=require(_0xeef9('0x17'));var db=require(_0xeef9('0x18'))['db'];function respondWithStatusCode(_0x5aceb1,_0x4a2e48){_0x4a2e48=_0x4a2e48||0xcc;return function(_0x1fbd25){if(_0x1fbd25){return _0x5aceb1[_0xeef9('0x19')](_0x4a2e48);}return _0x5aceb1[_0xeef9('0x1a')](_0x4a2e48)[_0xeef9('0x1b')]();};}function respondWithResult(_0x511899,_0x3ea6ab){_0x3ea6ab=_0x3ea6ab||0xc8;return function(_0x43c208){if(_0x43c208){return _0x511899[_0xeef9('0x1a')](_0x3ea6ab)[_0xeef9('0x1c')](_0x43c208);}};}function respondWithFilteredResult(_0x2c1ad5,_0x191c11){return function(_0x5492f5){if(_0x5492f5){var _0x112657=_0x5492f5['count'],_0x3b8b21=_0x191c11[_0xeef9('0x1d')],_0x14cb2a=_0x191c11[_0xeef9('0x1d')]+_0x191c11['limit'],_0xe2d73;if(_0x14cb2a>=_0x112657){_0x14cb2a=_0x112657;_0xe2d73=0xc8;}else{_0xe2d73=0xce;}_0x2c1ad5['status'](_0xe2d73);return _0x2c1ad5[_0xeef9('0x1e')](_0xeef9('0x1f'),_0x3b8b21+'-'+_0x14cb2a+'/'+_0x112657)[_0xeef9('0x1c')](_0x5492f5);}return null;};}function patchUpdates(_0x5e2249){return function(_0x385f37){try{jsonpatch['apply'](_0x385f37,_0x5e2249,!![]);}catch(_0x2225c9){return BPromise[_0xeef9('0x20')](_0x2225c9);}return _0x385f37[_0xeef9('0x21')]();};}function saveUpdates(_0x4b1085,_0x546fe5){return function(_0x5a5226){if(_0x5a5226){return _0x5a5226['update'](_0x4b1085)['then'](function(_0x45775f){return _0x45775f;});}return null;};}function removeEntity(_0x44c935,_0x2ac7e0){return function(_0x3e93a2){if(_0x3e93a2){return _0x3e93a2['destroy']()[_0xeef9('0x22')](function(){_0x44c935[_0xeef9('0x1a')](0xcc)[_0xeef9('0x1b')]();});}};}function handleEntityNotFound(_0x31190f,_0x365466){return function(_0x5e8c74){if(!_0x5e8c74){_0x31190f[_0xeef9('0x19')](0x194);}return _0x5e8c74;};}function handleError(_0x4bb01a,_0x52179e){_0x52179e=_0x52179e||0x1f4;return function(_0x59cbc0){logger[_0xeef9('0x23')](_0x59cbc0[_0xeef9('0x24')]);if(_0x59cbc0[_0xeef9('0x25')]){delete _0x59cbc0[_0xeef9('0x25')];}_0x4bb01a[_0xeef9('0x1a')](_0x52179e)['send'](_0x59cbc0);};}exports[_0xeef9('0x26')]=function(_0x2a9a37,_0x186286){var _0x3d164c={},_0x24422c={},_0x4a611c={'count':0x0,'rows':[]};var _0x2b9774=_[_0xeef9('0x27')](db[_0xeef9('0x28')][_0xeef9('0x29')],function(_0x4b4e61){return{'name':_0x4b4e61[_0xeef9('0x2a')],'type':_0x4b4e61['type'][_0xeef9('0x2b')]};});_0x24422c['model']=_[_0xeef9('0x27')](_0x2b9774,_0xeef9('0x25'));_0x24422c[_0xeef9('0x2c')]=_[_0xeef9('0x2d')](_0x2a9a37[_0xeef9('0x2c')]);_0x24422c[_0xeef9('0x2e')]=_[_0xeef9('0x2f')](_0x24422c['model'],_0x24422c[_0xeef9('0x2c')]);_0x3d164c[_0xeef9('0x30')]=_[_0xeef9('0x2f')](_0x24422c['model'],qs[_0xeef9('0x31')](_0x2a9a37[_0xeef9('0x2c')][_0xeef9('0x31')]));_0x3d164c['attributes']=_0x3d164c['attributes'][_0xeef9('0x32')]?_0x3d164c[_0xeef9('0x30')]:_0x24422c[_0xeef9('0x33')];if(!_0x2a9a37[_0xeef9('0x2c')][_0xeef9('0x34')]('nolimit')){_0x3d164c[_0xeef9('0x35')]=qs['limit'](_0x2a9a37['query']['limit']);_0x3d164c['offset']=qs['offset'](_0x2a9a37[_0xeef9('0x2c')][_0xeef9('0x1d')]);}_0x3d164c['order']=qs['sort'](_0x2a9a37[_0xeef9('0x2c')]['sort']);_0x3d164c[_0xeef9('0x36')]=qs[_0xeef9('0x2e')](_['pick'](_0x2a9a37[_0xeef9('0x2c')],_0x24422c[_0xeef9('0x2e')]),_0x2b9774);if(_0x2a9a37[_0xeef9('0x2c')][_0xeef9('0x37')]){_0x3d164c[_0xeef9('0x36')]=_[_0xeef9('0x38')](_0x3d164c[_0xeef9('0x36')],{'$or':_['map'](_0x2b9774,function(_0x217670){if(_0x217670[_0xeef9('0x39')]!==_0xeef9('0x3a')){var _0x1917a2={};_0x1917a2[_0x217670[_0xeef9('0x25')]]={'$like':'%'+_0x2a9a37['query'][_0xeef9('0x37')]+'%'};return _0x1917a2;}})});}_0x3d164c=_[_0xeef9('0x38')]({},_0x3d164c,_0x2a9a37[_0xeef9('0x3b')]);var _0x188c40={'where':_0x3d164c[_0xeef9('0x36')]};return db[_0xeef9('0x28')][_0xeef9('0x3c')](_0x188c40)[_0xeef9('0x22')](function(_0x54ba58){_0x4a611c['count']=_0x54ba58;if(_0x2a9a37[_0xeef9('0x2c')][_0xeef9('0x3d')]){_0x3d164c[_0xeef9('0x3e')]=[{'all':!![]}];}return db[_0xeef9('0x28')][_0xeef9('0x3f')](_0x3d164c);})[_0xeef9('0x22')](function(_0x26a0a6){_0x4a611c[_0xeef9('0x40')]=_0x26a0a6;return _0x4a611c;})[_0xeef9('0x22')](respondWithFilteredResult(_0x186286,_0x3d164c))['catch'](handleError(_0x186286,null));};exports[_0xeef9('0x41')]=function(_0x535095,_0x5c512f){var _0x9dad9d={'raw':![],'where':{'id':_0x535095[_0xeef9('0x42')]['id']}},_0x405fe2={};_0x405fe2[_0xeef9('0x33')]=_['keys'](db['AnalyticFieldReport'][_0xeef9('0x29')]);_0x405fe2[_0xeef9('0x2c')]=_[_0xeef9('0x2d')](_0x535095[_0xeef9('0x2c')]);_0x405fe2['filters']=_[_0xeef9('0x2f')](_0x405fe2[_0xeef9('0x33')],_0x405fe2['query']);_0x9dad9d[_0xeef9('0x30')]=_['intersection'](_0x405fe2[_0xeef9('0x33')],qs['fields'](_0x535095['query'][_0xeef9('0x31')]));_0x9dad9d[_0xeef9('0x30')]=_0x9dad9d[_0xeef9('0x30')][_0xeef9('0x32')]?_0x9dad9d[_0xeef9('0x30')]:_0x405fe2[_0xeef9('0x33')];if(_0x535095[_0xeef9('0x2c')]['includeAll']){_0x9dad9d[_0xeef9('0x3e')]=[{'all':!![]}];}_0x9dad9d=_[_0xeef9('0x38')]({},_0x9dad9d,_0x535095['options']);return db[_0xeef9('0x28')][_0xeef9('0x43')](_0x9dad9d)['then'](handleEntityNotFound(_0x5c512f,null))['then'](respondWithResult(_0x5c512f,null))[_0xeef9('0x44')](handleError(_0x5c512f,null));};exports[_0xeef9('0x45')]=function(_0x23af29,_0x201ee5){return db[_0xeef9('0x28')][_0xeef9('0x45')](_0x23af29[_0xeef9('0x46')],{})['then'](respondWithResult(_0x201ee5,0xc9))[_0xeef9('0x44')](handleError(_0x201ee5,null));};exports[_0xeef9('0x47')]=function(_0x57714a,_0xc750c3){return db[_0xeef9('0x28')][_0xeef9('0x47')](_0x57714a[_0xeef9('0x46')],{'raw':![],'individualHooks':!![]})[_0xeef9('0x22')](respondWithResult(_0xc750c3,0xc9))[_0xeef9('0x44')](handleError(_0xc750c3,null));};exports[_0xeef9('0x48')]=function(_0x499539,_0x12dbff){if(_0x499539[_0xeef9('0x46')]['id']){delete _0x499539['body']['id'];}return db[_0xeef9('0x28')][_0xeef9('0x43')]({'where':{'id':_0x499539[_0xeef9('0x42')]['id']}})[_0xeef9('0x22')](handleEntityNotFound(_0x12dbff,null))[_0xeef9('0x22')](saveUpdates(_0x499539[_0xeef9('0x46')],null))[_0xeef9('0x22')](respondWithResult(_0x12dbff,null))['catch'](handleError(_0x12dbff,null));};exports[_0xeef9('0x49')]=function(_0x5b6589,_0x470eec){return db[_0xeef9('0x28')][_0xeef9('0x43')]({'where':{'id':_0x5b6589[_0xeef9('0x42')]['id']}})[_0xeef9('0x22')](handleEntityNotFound(_0x470eec,null))['then'](removeEntity(_0x470eec,null))['catch'](handleError(_0x470eec,null));};exports['bulkDestroy']=function(_0x3b584c,_0xac37c8){return db[_0xeef9('0x28')][_0xeef9('0x49')]({'where':{'id':_0x3b584c[_0xeef9('0x2c')][_0xeef9('0x4a')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xac37c8,0xcc))[_0xeef9('0x44')](handleError(_0xac37c8,null));};exports[_0xeef9('0x4b')]=function(_0x28f303,_0x220ba2,_0x387ddb){return db[_0xeef9('0x4c')][_0xeef9('0x4d')]({'where':{'id':_0x28f303[_0xeef9('0x42')]['id']}})[_0xeef9('0x22')](handleEntityNotFound(_0x220ba2,null))[_0xeef9('0x22')](function(_0xee85f){if(_0xee85f){return db[_0xeef9('0x4e')][_0xeef9('0x4f')](function(_0x5eac01){return db[_0xeef9('0x28')][_0xeef9('0x49')]({'where':{'CustomReportId':_0x28f303[_0xeef9('0x42')]['id']},'transaction':_0x5eac01})[_0xeef9('0x22')](function(_0x19c1dd){var _0x15edd5=_[_0xeef9('0x27')](_0x28f303[_0xeef9('0x46')],function(_0x16d6b5){delete _0x16d6b5['id'];_0x16d6b5[_0xeef9('0x50')]=_0x28f303[_0xeef9('0x42')]['id'];return _0x16d6b5;});return db[_0xeef9('0x28')][_0xeef9('0x47')](_0x15edd5,{'transaction':_0x5eac01});});})[_0xeef9('0x22')](function(){return db[_0xeef9('0x28')][_0xeef9('0x3f')]({'where':{'CustomReportId':_0x28f303['params']['id']}});});}})[_0xeef9('0x22')](respondWithResult(_0x220ba2,null))[_0xeef9('0x44')](handleError(_0x220ba2,null));}; \ No newline at end of file +var _0xa9aa=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','json','count','offset','limit','set','Content-Range','apply','save','then','end','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','filter','AnalyticFieldReport','includeAll','include','rows','catch','params','keys','options','create','body','update','find','destroy','ids','addFields','AnalyticCustomReport','findOne','CustomReportId','bulkCreate','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x411b68,_0x52e768){var _0x41ff90=function(_0x2ab602){while(--_0x2ab602){_0x411b68['push'](_0x411b68['shift']());}};_0x41ff90(++_0x52e768);}(_0xa9aa,0x8f));var _0xaa9a=function(_0x1ff5f4,_0x390e75){_0x1ff5f4=_0x1ff5f4-0x0;var _0x335ecc=_0xa9aa[_0x1ff5f4];return _0x335ecc;};'use strict';var pdf=require(_0xaa9a('0x0'));var emlformat=require(_0xaa9a('0x1'));var rimraf=require(_0xaa9a('0x2'));var zipdir=require(_0xaa9a('0x3'));var jsonpatch=require(_0xaa9a('0x4'));var rp=require(_0xaa9a('0x5'));var moment=require(_0xaa9a('0x6'));var BPromise=require(_0xaa9a('0x7'));var Mustache=require(_0xaa9a('0x8'));var util=require(_0xaa9a('0x9'));var path=require(_0xaa9a('0xa'));var sox=require(_0xaa9a('0xb'));var csv=require(_0xaa9a('0xc'));var ejs=require(_0xaa9a('0xd'));var fs=require('fs');var _=require(_0xaa9a('0xe'));var squel=require(_0xaa9a('0xf'));var crypto=require(_0xaa9a('0x10'));var jsforce=require(_0xaa9a('0x11'));var deskjs=require(_0xaa9a('0x12'));var toCsv=require(_0xaa9a('0xc'));var querystring=require(_0xaa9a('0x13'));var Papa=require('papaparse');var Redis=require(_0xaa9a('0x14'));var authService=require(_0xaa9a('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xaa9a('0x16'));var hardwareService=require(_0xaa9a('0x17'));var logger=require(_0xaa9a('0x18'))('api');var utils=require(_0xaa9a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xaa9a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5982be,_0xf57552){_0xf57552=_0xf57552||0xcc;return function(_0x5bc5e5){if(_0x5bc5e5){return _0x5982be['sendStatus'](_0xf57552);}return _0x5982be[_0xaa9a('0x1b')](_0xf57552)['end']();};}function respondWithResult(_0x110452,_0x53881c){_0x53881c=_0x53881c||0xc8;return function(_0x47fb8e){if(_0x47fb8e){return _0x110452[_0xaa9a('0x1b')](_0x53881c)[_0xaa9a('0x1c')](_0x47fb8e);}};}function respondWithFilteredResult(_0x15c1f8,_0x548125){return function(_0x5ea5ce){if(_0x5ea5ce){var _0x5886e9=_0x5ea5ce[_0xaa9a('0x1d')],_0x7c627b=_0x548125[_0xaa9a('0x1e')],_0x4f4c92=_0x548125[_0xaa9a('0x1e')]+_0x548125[_0xaa9a('0x1f')],_0x1b2a2c;if(_0x4f4c92>=_0x5886e9){_0x4f4c92=_0x5886e9;_0x1b2a2c=0xc8;}else{_0x1b2a2c=0xce;}_0x15c1f8[_0xaa9a('0x1b')](_0x1b2a2c);return _0x15c1f8[_0xaa9a('0x20')](_0xaa9a('0x21'),_0x7c627b+'-'+_0x4f4c92+'/'+_0x5886e9)[_0xaa9a('0x1c')](_0x5ea5ce);}return null;};}function patchUpdates(_0x5b794d){return function(_0x10b869){try{jsonpatch[_0xaa9a('0x22')](_0x10b869,_0x5b794d,!![]);}catch(_0x51f005){return BPromise['reject'](_0x51f005);}return _0x10b869[_0xaa9a('0x23')]();};}function saveUpdates(_0x15fcb1,_0x37567d){return function(_0x42fe58){if(_0x42fe58){return _0x42fe58['update'](_0x15fcb1)[_0xaa9a('0x24')](function(_0x24b077){return _0x24b077;});}return null;};}function removeEntity(_0x2caf78,_0x233b7f){return function(_0x465343){if(_0x465343){return _0x465343['destroy']()['then'](function(){_0x2caf78[_0xaa9a('0x1b')](0xcc)[_0xaa9a('0x25')]();});}};}function handleEntityNotFound(_0x1025c4,_0x582231){return function(_0x312832){if(!_0x312832){_0x1025c4['sendStatus'](0x194);}return _0x312832;};}function handleError(_0x6146c4,_0x3144bd){_0x3144bd=_0x3144bd||0x1f4;return function(_0x294b82){logger[_0xaa9a('0x26')](_0x294b82[_0xaa9a('0x27')]);if(_0x294b82[_0xaa9a('0x28')]){delete _0x294b82[_0xaa9a('0x28')];}_0x6146c4['status'](_0x3144bd)[_0xaa9a('0x29')](_0x294b82);};}exports[_0xaa9a('0x2a')]=function(_0x4fb766,_0x2d8d68){var _0x1e7d69={},_0x2b77b9={},_0x16b93e={'count':0x0,'rows':[]};var _0x9ae522=_[_0xaa9a('0x2b')](db['AnalyticFieldReport']['rawAttributes'],function(_0x3c35c0){return{'name':_0x3c35c0[_0xaa9a('0x2c')],'type':_0x3c35c0[_0xaa9a('0x2d')][_0xaa9a('0x2e')]};});_0x2b77b9[_0xaa9a('0x2f')]=_[_0xaa9a('0x2b')](_0x9ae522,_0xaa9a('0x28'));_0x2b77b9[_0xaa9a('0x30')]=_['keys'](_0x4fb766[_0xaa9a('0x30')]);_0x2b77b9[_0xaa9a('0x31')]=_[_0xaa9a('0x32')](_0x2b77b9[_0xaa9a('0x2f')],_0x2b77b9[_0xaa9a('0x30')]);_0x1e7d69['attributes']=_[_0xaa9a('0x32')](_0x2b77b9[_0xaa9a('0x2f')],qs['fields'](_0x4fb766[_0xaa9a('0x30')][_0xaa9a('0x33')]));_0x1e7d69[_0xaa9a('0x34')]=_0x1e7d69[_0xaa9a('0x34')][_0xaa9a('0x35')]?_0x1e7d69[_0xaa9a('0x34')]:_0x2b77b9[_0xaa9a('0x2f')];if(!_0x4fb766[_0xaa9a('0x30')][_0xaa9a('0x36')]('nolimit')){_0x1e7d69[_0xaa9a('0x1f')]=qs[_0xaa9a('0x1f')](_0x4fb766['query']['limit']);_0x1e7d69[_0xaa9a('0x1e')]=qs[_0xaa9a('0x1e')](_0x4fb766['query']['offset']);}_0x1e7d69[_0xaa9a('0x37')]=qs[_0xaa9a('0x38')](_0x4fb766[_0xaa9a('0x30')][_0xaa9a('0x38')]);_0x1e7d69['where']=qs['filters'](_['pick'](_0x4fb766[_0xaa9a('0x30')],_0x2b77b9[_0xaa9a('0x31')]),_0x9ae522);if(_0x4fb766[_0xaa9a('0x30')]['filter']){_0x1e7d69[_0xaa9a('0x39')]=_[_0xaa9a('0x3a')](_0x1e7d69[_0xaa9a('0x39')],{'$or':_[_0xaa9a('0x2b')](_0x9ae522,function(_0x287a3c){if(_0x287a3c[_0xaa9a('0x2d')]!=='VIRTUAL'){var _0x43e490={};_0x43e490[_0x287a3c[_0xaa9a('0x28')]]={'$like':'%'+_0x4fb766[_0xaa9a('0x30')][_0xaa9a('0x3b')]+'%'};return _0x43e490;}})});}_0x1e7d69=_['merge']({},_0x1e7d69,_0x4fb766['options']);var _0x5cb7cc={'where':_0x1e7d69[_0xaa9a('0x39')]};return db[_0xaa9a('0x3c')][_0xaa9a('0x1d')](_0x5cb7cc)[_0xaa9a('0x24')](function(_0x3fe6f1){_0x16b93e[_0xaa9a('0x1d')]=_0x3fe6f1;if(_0x4fb766[_0xaa9a('0x30')][_0xaa9a('0x3d')]){_0x1e7d69[_0xaa9a('0x3e')]=[{'all':!![]}];}return db[_0xaa9a('0x3c')]['findAll'](_0x1e7d69);})[_0xaa9a('0x24')](function(_0x576ebc){_0x16b93e[_0xaa9a('0x3f')]=_0x576ebc;return _0x16b93e;})[_0xaa9a('0x24')](respondWithFilteredResult(_0x2d8d68,_0x1e7d69))[_0xaa9a('0x40')](handleError(_0x2d8d68,null));};exports['show']=function(_0x48f5e0,_0x25778a){var _0x5b4d38={'raw':![],'where':{'id':_0x48f5e0[_0xaa9a('0x41')]['id']}},_0x378ee6={};_0x378ee6[_0xaa9a('0x2f')]=_[_0xaa9a('0x42')](db[_0xaa9a('0x3c')]['rawAttributes']);_0x378ee6[_0xaa9a('0x30')]=_[_0xaa9a('0x42')](_0x48f5e0[_0xaa9a('0x30')]);_0x378ee6[_0xaa9a('0x31')]=_[_0xaa9a('0x32')](_0x378ee6[_0xaa9a('0x2f')],_0x378ee6[_0xaa9a('0x30')]);_0x5b4d38['attributes']=_[_0xaa9a('0x32')](_0x378ee6[_0xaa9a('0x2f')],qs[_0xaa9a('0x33')](_0x48f5e0[_0xaa9a('0x30')][_0xaa9a('0x33')]));_0x5b4d38['attributes']=_0x5b4d38['attributes']['length']?_0x5b4d38[_0xaa9a('0x34')]:_0x378ee6[_0xaa9a('0x2f')];if(_0x48f5e0['query'][_0xaa9a('0x3d')]){_0x5b4d38[_0xaa9a('0x3e')]=[{'all':!![]}];}_0x5b4d38=_[_0xaa9a('0x3a')]({},_0x5b4d38,_0x48f5e0[_0xaa9a('0x43')]);return db[_0xaa9a('0x3c')]['find'](_0x5b4d38)[_0xaa9a('0x24')](handleEntityNotFound(_0x25778a,null))['then'](respondWithResult(_0x25778a,null))[_0xaa9a('0x40')](handleError(_0x25778a,null));};exports[_0xaa9a('0x44')]=function(_0x30f1d5,_0x4c29ca){return db[_0xaa9a('0x3c')][_0xaa9a('0x44')](_0x30f1d5[_0xaa9a('0x45')],{})['then'](respondWithResult(_0x4c29ca,0xc9))[_0xaa9a('0x40')](handleError(_0x4c29ca,null));};exports['bulkCreate']=function(_0x1c99c6,_0x2dc776){return db[_0xaa9a('0x3c')]['bulkCreate'](_0x1c99c6[_0xaa9a('0x45')],{'raw':![],'individualHooks':!![]})[_0xaa9a('0x24')](respondWithResult(_0x2dc776,0xc9))[_0xaa9a('0x40')](handleError(_0x2dc776,null));};exports[_0xaa9a('0x46')]=function(_0x4b94c7,_0x30d50c){if(_0x4b94c7[_0xaa9a('0x45')]['id']){delete _0x4b94c7['body']['id'];}return db['AnalyticFieldReport'][_0xaa9a('0x47')]({'where':{'id':_0x4b94c7[_0xaa9a('0x41')]['id']}})[_0xaa9a('0x24')](handleEntityNotFound(_0x30d50c,null))[_0xaa9a('0x24')](saveUpdates(_0x4b94c7[_0xaa9a('0x45')],null))['then'](respondWithResult(_0x30d50c,null))[_0xaa9a('0x40')](handleError(_0x30d50c,null));};exports[_0xaa9a('0x48')]=function(_0x54a050,_0x9abb92){return db[_0xaa9a('0x3c')][_0xaa9a('0x47')]({'where':{'id':_0x54a050[_0xaa9a('0x41')]['id']}})[_0xaa9a('0x24')](handleEntityNotFound(_0x9abb92,null))[_0xaa9a('0x24')](removeEntity(_0x9abb92,null))[_0xaa9a('0x40')](handleError(_0x9abb92,null));};exports['bulkDestroy']=function(_0x5d910f,_0x5c268a){return db[_0xaa9a('0x3c')][_0xaa9a('0x48')]({'where':{'id':_0x5d910f[_0xaa9a('0x30')][_0xaa9a('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xaa9a('0x24')](respondWithResult(_0x5c268a,0xcc))[_0xaa9a('0x40')](handleError(_0x5c268a,null));};exports[_0xaa9a('0x4a')]=function(_0x16a9b9,_0x321c2e,_0x49b1ae){return db[_0xaa9a('0x4b')][_0xaa9a('0x4c')]({'where':{'id':_0x16a9b9['params']['id']}})['then'](handleEntityNotFound(_0x321c2e,null))[_0xaa9a('0x24')](function(_0x1a8652){if(_0x1a8652){return db['sequelize']['transaction'](function(_0x4af2fa){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x16a9b9[_0xaa9a('0x41')]['id']},'transaction':_0x4af2fa})[_0xaa9a('0x24')](function(_0x1b8213){var _0x26be4a=_[_0xaa9a('0x2b')](_0x16a9b9[_0xaa9a('0x45')],function(_0x1e6dab){delete _0x1e6dab['id'];_0x1e6dab[_0xaa9a('0x4d')]=_0x16a9b9[_0xaa9a('0x41')]['id'];return _0x1e6dab;});return db[_0xaa9a('0x3c')][_0xaa9a('0x4e')](_0x26be4a,{'transaction':_0x4af2fa});});})[_0xaa9a('0x24')](function(){return db[_0xaa9a('0x3c')][_0xaa9a('0x4f')]({'where':{'CustomReportId':_0x16a9b9[_0xaa9a('0x41')]['id']}});});}})[_0xaa9a('0x24')](respondWithResult(_0x321c2e,null))[_0xaa9a('0x40')](handleError(_0x321c2e,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index c504cd4..3a1f697 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 _0xb88f=['path','rimraf','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1b64e8,_0x911121){var _0x233fa2=function(_0x3146b4){while(--_0x3146b4){_0x1b64e8['push'](_0x1b64e8['shift']());}};_0x233fa2(++_0x911121);}(_0xb88f,0xb6));var _0xfb88=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0xb88f[_0x58a4fe];return _0x697de2;};'use strict';var _=require(_0xfb88('0x0'));var util=require(_0xfb88('0x1'));var logger=require(_0xfb88('0x2'))('api');var moment=require(_0xfb88('0x3'));var BPromise=require(_0xfb88('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb88('0x5'));var rimraf=require(_0xfb88('0x6'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0xfb88('0x7')]=function(_0x5b8b33,_0x1953ca){return _0x5b8b33[_0xfb88('0x8')](_0xfb88('0x9'),attributes,{'tableName':_0xfb88('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf33=['analytics_report_fields','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport'];(function(_0x4875c3,_0x5e5c1c){var _0x5cfd30=function(_0x15b80d){while(--_0x15b80d){_0x4875c3['push'](_0x4875c3['shift']());}};_0x5cfd30(++_0x5e5c1c);}(_0xaf33,0x1b9));var _0x3af3=function(_0x1417b5,_0x514dac){_0x1417b5=_0x1417b5-0x0;var _0xc4b9b=_0xaf33[_0x1417b5];return _0xc4b9b;};'use strict';var _=require('lodash');var util=require(_0x3af3('0x0'));var logger=require(_0x3af3('0x1'))(_0x3af3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3af3('0x3'));var fs=require('fs');var path=require(_0x3af3('0x4'));var rimraf=require(_0x3af3('0x5'));var config=require(_0x3af3('0x6'));var attributes=require(_0x3af3('0x7'));module['exports']=function(_0x4e3311,_0x1c94b1){return _0x4e3311[_0x3af3('0x8')](_0x3af3('0x9'),attributes,{'tableName':_0x3af3('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 eb0adcd..587f474 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 _0x578e=['message','result','catch','lodash','util','bluebird','randomstring','../../config/environment','jayson/promise','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x28f028,_0x20fa16){var _0x1f1460=function(_0xbe185d){while(--_0xbe185d){_0x28f028['push'](_0x28f028['shift']());}};_0x1f1460(++_0x20fa16);}(_0x578e,0x1e9));var _0xe578=function(_0x549b66,_0xc28cbe){_0x549b66=_0x549b66-0x0;var _0x525642=_0x578e[_0x549b66];return _0x525642;};'use strict';var _=require(_0xe578('0x0'));var util=require(_0xe578('0x1'));var moment=require('moment');var BPromise=require(_0xe578('0x2'));var rs=require(_0xe578('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe578('0x4'));var jayson=require(_0xe578('0x5'));var client=jayson['client'][_0xe578('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xbcf959,_0x1fda86,_0x541468){return new BPromise(function(_0x3e1630,_0x10953c){return client[_0xe578('0x7')](_0xbcf959,_0x541468)['then'](function(_0x413bd7){logger[_0xe578('0x8')](_0xe578('0x9'),_0x1fda86,_0xe578('0xa'));logger['debug'](_0xe578('0xb'),_0x1fda86,_0xe578('0xa'),JSON[_0xe578('0xc')](_0x413bd7));if(_0x413bd7['error']){if(_0x413bd7['error'][_0xe578('0xd')]===0x1f4){logger[_0xe578('0xe')](_0xe578('0x9'),_0x1fda86,_0x413bd7[_0xe578('0xe')][_0xe578('0xf')]);return _0x10953c(_0x413bd7[_0xe578('0xe')][_0xe578('0xf')]);}logger[_0xe578('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1fda86,_0x413bd7[_0xe578('0xe')]['message']);return _0x3e1630(_0x413bd7[_0xe578('0xe')][_0xe578('0xf')]);}else{logger[_0xe578('0x8')](_0xe578('0x9'),_0x1fda86,_0xe578('0xa'));_0x3e1630(_0x413bd7[_0xe578('0x10')][_0xe578('0xf')]);}})[_0xe578('0x11')](function(_0x5c52ce){logger['error'](_0xe578('0x9'),_0x1fda86,_0x5c52ce);_0x10953c(_0x5c52ce);});});} \ No newline at end of file +var _0x45a8=['../../mysqldb','rpc','jayson/promise','client','http','request','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xe34b7,_0x3dfd43){var _0x3d4b55=function(_0x366aa5){while(--_0x366aa5){_0xe34b7['push'](_0xe34b7['shift']());}};_0x3d4b55(++_0x3dfd43);}(_0x45a8,0xae));var _0x845a=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0x45a8[_0x4ed32d];return _0xf624df;};'use strict';var _=require(_0x845a('0x0'));var util=require(_0x845a('0x1'));var moment=require(_0x845a('0x2'));var BPromise=require(_0x845a('0x3'));var rs=require(_0x845a('0x4'));var fs=require('fs');var Redis=require(_0x845a('0x5'));var db=require(_0x845a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x845a('0x7'));var config=require('../../config/environment');var jayson=require(_0x845a('0x8'));var client=jayson[_0x845a('0x9')][_0x845a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42da64,_0x5ebbb2,_0x13609c){return new BPromise(function(_0x5bf2f4,_0x25641a){return client[_0x845a('0xb')](_0x42da64,_0x13609c)['then'](function(_0x15def4){logger['info'](_0x845a('0xc'),_0x5ebbb2,_0x845a('0xd'));logger['debug'](_0x845a('0xe'),_0x5ebbb2,_0x845a('0xd'),JSON['stringify'](_0x15def4));if(_0x15def4[_0x845a('0xf')]){if(_0x15def4[_0x845a('0xf')]['code']===0x1f4){logger[_0x845a('0xf')](_0x845a('0xc'),_0x5ebbb2,_0x15def4[_0x845a('0xf')][_0x845a('0x10')]);return _0x25641a(_0x15def4[_0x845a('0xf')][_0x845a('0x10')]);}logger[_0x845a('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5ebbb2,_0x15def4[_0x845a('0xf')][_0x845a('0x10')]);return _0x5bf2f4(_0x15def4['error']['message']);}else{logger['info'](_0x845a('0xc'),_0x5ebbb2,_0x845a('0xd'));_0x5bf2f4(_0x15def4[_0x845a('0x11')]['message']);}})['catch'](function(_0x4198fe){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x5ebbb2,_0x4198fe);_0x25641a(_0x4198fe);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 4359c16..2d40ea4 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 _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(_0x46c9a5,_0x1cb9e7){var _0x5e3eec=function(_0x24105a){while(--_0x24105a){_0x46c9a5['push'](_0x46c9a5['shift']());}};_0x5e3eec(++_0x1cb9e7);}(_0x3e74,0x175));var _0x43e7=function(_0x225ff6,_0x1261a5){_0x225ff6=_0x225ff6-0x0;var _0x2c0f2f=_0x3e74[_0x225ff6];return _0x2c0f2f;};'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 +var _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x5a3d49,_0x24b21a){var _0x4d5c23=function(_0x4f62b0){while(--_0x4f62b0){_0x5a3d49['push'](_0x5a3d49['shift']());}};_0x4d5c23(++_0x24b21a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x5fc3[_0x1ae4a9];return _0x54d0b0;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index c883140..8547f4c 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 _0xdc91=['STRING','sequelize','exports'];(function(_0x5b0ebd,_0x4fa66d){var _0x6fd033=function(_0x20f069){while(--_0x20f069){_0x5b0ebd['push'](_0x5b0ebd['shift']());}};_0x6fd033(++_0x4fa66d);}(_0xdc91,0x8b));var _0x1dc9=function(_0x1c619b,_0x1e367f){_0x1c619b=_0x1c619b-0x0;var _0x111f0c=_0xdc91[_0x1c619b];return _0x111f0c;};'use strict';var Sequelize=require(_0x1dc9('0x0'));module[_0x1dc9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x1dc9('0x2')]}}; \ No newline at end of file +var _0x9bc3=['exports','STRING','TEXT','sequelize'];(function(_0x125fb5,_0x2bfd88){var _0x422dbe=function(_0xd6dc84){while(--_0xd6dc84){_0x125fb5['push'](_0x125fb5['shift']());}};_0x422dbe(++_0x2bfd88);}(_0x9bc3,0x137));var _0x39bc=function(_0x320f0b,_0x53fadd){_0x320f0b=_0x320f0b-0x0;var _0x42ee31=_0x9bc3[_0x320f0b];return _0x42ee31;};'use strict';var Sequelize=require(_0x39bc('0x0'));module[_0x39bc('0x1')]={'name':{'type':Sequelize[_0x39bc('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x39bc('0x2')]},'metric':{'type':Sequelize[_0x39bc('0x3')]},'description':{'type':Sequelize[_0x39bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 467fa75..37aa401 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 _0xa6a0=['reject','save','update','then','destroy','get','Metrics','UserProfileResource','end','error','stack','name','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','limit','set','Content-Range','json'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xa6a0,0x85));var _0x0a6a=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa6a0[_0x56482c];return _0x5aae7a;};'use strict';var pdf=require(_0x0a6a('0x0'));var emlformat=require(_0x0a6a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a6a('0x2'));var moment=require(_0x0a6a('0x3'));var BPromise=require(_0x0a6a('0x4'));var Mustache=require(_0x0a6a('0x5'));var util=require(_0x0a6a('0x6'));var path=require(_0x0a6a('0x7'));var sox=require(_0x0a6a('0x8'));var csv=require(_0x0a6a('0x9'));var ejs=require(_0x0a6a('0xa'));var fs=require('fs');var _=require(_0x0a6a('0xb'));var squel=require('squel');var crypto=require(_0x0a6a('0xc'));var jsforce=require(_0x0a6a('0xd'));var deskjs=require(_0x0a6a('0xe'));var toCsv=require(_0x0a6a('0x9'));var querystring=require(_0x0a6a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0a6a('0x10'));var as=require(_0x0a6a('0x11'));var hardwareService=require(_0x0a6a('0x12'));var logger=require(_0x0a6a('0x13'))(_0x0a6a('0x14'));var utils=require(_0x0a6a('0x15'));var config=require(_0x0a6a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a6a('0x17'))['db'];function respondWithStatusCode(_0x6d95ff,_0x266549){_0x266549=_0x266549||0xcc;return function(_0x233138){if(_0x233138){return _0x6d95ff[_0x0a6a('0x18')](_0x266549);}return _0x6d95ff[_0x0a6a('0x19')](_0x266549)['end']();};}function respondWithResult(_0x43108b,_0x5ca5e1){_0x5ca5e1=_0x5ca5e1||0xc8;return function(_0x1728b7){if(_0x1728b7){return _0x43108b[_0x0a6a('0x19')](_0x5ca5e1)['json'](_0x1728b7);}};}function respondWithFilteredResult(_0x149cc6,_0x457e10){return function(_0x1a49e7){if(_0x1a49e7){var _0x548e5f=_0x1a49e7[_0x0a6a('0x1a')],_0x131828=_0x457e10['offset'],_0x21909c=_0x457e10['offset']+_0x457e10[_0x0a6a('0x1b')],_0x521be3;if(_0x21909c>=_0x548e5f){_0x21909c=_0x548e5f;_0x521be3=0xc8;}else{_0x521be3=0xce;}_0x149cc6[_0x0a6a('0x19')](_0x521be3);return _0x149cc6[_0x0a6a('0x1c')](_0x0a6a('0x1d'),_0x131828+'-'+_0x21909c+'/'+_0x548e5f)[_0x0a6a('0x1e')](_0x1a49e7);}return null;};}function patchUpdates(_0x187adb){return function(_0x1ae6ba){try{jsonpatch['apply'](_0x1ae6ba,_0x187adb,!![]);}catch(_0x37f666){return BPromise[_0x0a6a('0x1f')](_0x37f666);}return _0x1ae6ba[_0x0a6a('0x20')]();};}function saveUpdates(_0x389f8f,_0x3d487f){return function(_0x4d14d9){if(_0x4d14d9){return _0x4d14d9[_0x0a6a('0x21')](_0x389f8f)[_0x0a6a('0x22')](function(_0x2efa3f){return _0x2efa3f;});}return null;};}function removeEntity(_0x2f15cc,_0x27e015){return function(_0x201f6c){if(_0x201f6c){return _0x201f6c[_0x0a6a('0x23')]()[_0x0a6a('0x22')](function(){var _0x53e8d9=_0x201f6c[_0x0a6a('0x24')]({'plain':!![]});var _0xdea4ad=_0x0a6a('0x25');return db[_0x0a6a('0x26')][_0x0a6a('0x23')]({'where':{'type':_0xdea4ad,'resourceId':_0x53e8d9['id']}})['then'](function(){return _0x201f6c;});})[_0x0a6a('0x22')](function(){_0x2f15cc[_0x0a6a('0x19')](0xcc)[_0x0a6a('0x27')]();});}};}function handleEntityNotFound(_0x1696e6,_0x5d8b63){return function(_0xcaa500){if(!_0xcaa500){_0x1696e6['sendStatus'](0x194);}return _0xcaa500;};}function handleError(_0x4d39b9,_0x2d5034){_0x2d5034=_0x2d5034||0x1f4;return function(_0x9ae350){logger[_0x0a6a('0x28')](_0x9ae350[_0x0a6a('0x29')]);if(_0x9ae350[_0x0a6a('0x2a')]){delete _0x9ae350[_0x0a6a('0x2a')];}_0x4d39b9[_0x0a6a('0x19')](_0x2d5034)['send'](_0x9ae350);};}exports[_0x0a6a('0x2b')]=function(_0x4c9c06,_0x1e86c1){var _0x2d683f={},_0x4483be={},_0x7a5318={'count':0x0,'rows':[]};var _0x592a0c=_[_0x0a6a('0x2c')](db[_0x0a6a('0x2d')][_0x0a6a('0x2e')],function(_0x1339c5){return{'name':_0x1339c5[_0x0a6a('0x2f')],'type':_0x1339c5[_0x0a6a('0x30')][_0x0a6a('0x31')]};});_0x4483be[_0x0a6a('0x32')]=_[_0x0a6a('0x2c')](_0x592a0c,_0x0a6a('0x2a'));_0x4483be[_0x0a6a('0x33')]=_[_0x0a6a('0x34')](_0x4c9c06[_0x0a6a('0x33')]);_0x4483be[_0x0a6a('0x35')]=_[_0x0a6a('0x36')](_0x4483be[_0x0a6a('0x32')],_0x4483be[_0x0a6a('0x33')]);_0x2d683f[_0x0a6a('0x37')]=_[_0x0a6a('0x36')](_0x4483be['model'],qs[_0x0a6a('0x38')](_0x4c9c06['query'][_0x0a6a('0x38')]));_0x2d683f[_0x0a6a('0x37')]=_0x2d683f[_0x0a6a('0x37')][_0x0a6a('0x39')]?_0x2d683f[_0x0a6a('0x37')]:_0x4483be[_0x0a6a('0x32')];if(!_0x4c9c06['query'][_0x0a6a('0x3a')](_0x0a6a('0x3b'))){_0x2d683f[_0x0a6a('0x1b')]=qs[_0x0a6a('0x1b')](_0x4c9c06['query'][_0x0a6a('0x1b')]);_0x2d683f[_0x0a6a('0x3c')]=qs[_0x0a6a('0x3c')](_0x4c9c06[_0x0a6a('0x33')][_0x0a6a('0x3c')]);}_0x2d683f['order']=qs[_0x0a6a('0x3d')](_0x4c9c06[_0x0a6a('0x33')][_0x0a6a('0x3d')]);_0x2d683f[_0x0a6a('0x3e')]=qs[_0x0a6a('0x35')](_[_0x0a6a('0x3f')](_0x4c9c06[_0x0a6a('0x33')],_0x4483be[_0x0a6a('0x35')]),_0x592a0c);if(_0x4c9c06[_0x0a6a('0x33')][_0x0a6a('0x40')]){_0x2d683f[_0x0a6a('0x3e')]=_[_0x0a6a('0x41')](_0x2d683f['where'],{'$or':_['map'](_0x592a0c,function(_0x20a2ea){if(_0x20a2ea['type']!==_0x0a6a('0x42')){var _0x5a5383={};_0x5a5383[_0x20a2ea[_0x0a6a('0x2a')]]={'$like':'%'+_0x4c9c06[_0x0a6a('0x33')]['filter']+'%'};return _0x5a5383;}})});}_0x2d683f=_[_0x0a6a('0x41')]({},_0x2d683f,_0x4c9c06['options']);var _0xc2af43={'where':_0x2d683f[_0x0a6a('0x3e')]};return db[_0x0a6a('0x2d')][_0x0a6a('0x1a')](_0xc2af43)[_0x0a6a('0x22')](function(_0x54b00e){_0x7a5318[_0x0a6a('0x1a')]=_0x54b00e;if(_0x4c9c06[_0x0a6a('0x33')][_0x0a6a('0x43')]){_0x2d683f[_0x0a6a('0x44')]=[{'all':!![]}];}return db[_0x0a6a('0x2d')][_0x0a6a('0x45')](_0x2d683f);})[_0x0a6a('0x22')](function(_0x33bec5){_0x7a5318[_0x0a6a('0x46')]=_0x33bec5;return _0x7a5318;})[_0x0a6a('0x22')](respondWithFilteredResult(_0x1e86c1,_0x2d683f))[_0x0a6a('0x47')](handleError(_0x1e86c1,null));};exports[_0x0a6a('0x48')]=function(_0x10cdc3,_0x59947a){var _0x4065a5={'raw':!![],'where':{'id':_0x10cdc3[_0x0a6a('0x49')]['id']}},_0x118119={};_0x118119[_0x0a6a('0x32')]=_[_0x0a6a('0x34')](db[_0x0a6a('0x2d')][_0x0a6a('0x2e')]);_0x118119[_0x0a6a('0x33')]=_[_0x0a6a('0x34')](_0x10cdc3[_0x0a6a('0x33')]);_0x118119[_0x0a6a('0x35')]=_[_0x0a6a('0x36')](_0x118119[_0x0a6a('0x32')],_0x118119[_0x0a6a('0x33')]);_0x4065a5[_0x0a6a('0x37')]=_[_0x0a6a('0x36')](_0x118119[_0x0a6a('0x32')],qs[_0x0a6a('0x38')](_0x10cdc3['query'][_0x0a6a('0x38')]));_0x4065a5[_0x0a6a('0x37')]=_0x4065a5[_0x0a6a('0x37')][_0x0a6a('0x39')]?_0x4065a5[_0x0a6a('0x37')]:_0x118119[_0x0a6a('0x32')];if(_0x10cdc3['query'][_0x0a6a('0x43')]){_0x4065a5[_0x0a6a('0x44')]=[{'all':!![]}];}_0x4065a5=_[_0x0a6a('0x41')]({},_0x4065a5,_0x10cdc3[_0x0a6a('0x4a')]);return db[_0x0a6a('0x2d')]['find'](_0x4065a5)['then'](handleEntityNotFound(_0x59947a,null))[_0x0a6a('0x22')](respondWithResult(_0x59947a,null))[_0x0a6a('0x47')](handleError(_0x59947a,null));};exports['create']=function(_0x30fa6d,_0x4d5360){return db[_0x0a6a('0x2d')][_0x0a6a('0x4b')](_0x30fa6d[_0x0a6a('0x4c')],{})[_0x0a6a('0x22')](function(_0x120107){var _0x28e3ae=_0x30fa6d['user'][_0x0a6a('0x24')]({'plain':!![]});if(!_0x28e3ae)throw new Error(_0x0a6a('0x4d'));if(_0x28e3ae[_0x0a6a('0x4e')]===_0x0a6a('0x4f')){var _0x53832c=_0x120107[_0x0a6a('0x24')]({'plain':!![]});var _0x29912a='Metrics';return db[_0x0a6a('0x50')][_0x0a6a('0x51')]({'where':{'name':_0x29912a,'userProfileId':_0x28e3ae['userProfileId']},'raw':!![]})[_0x0a6a('0x22')](function(_0x14e905){if(_0x14e905&&_0x14e905['autoAssociation']===0x0){return db[_0x0a6a('0x26')][_0x0a6a('0x4b')]({'name':_0x53832c[_0x0a6a('0x2a')],'resourceId':_0x53832c['id'],'type':_0x14e905[_0x0a6a('0x2a')],'sectionId':_0x14e905['id']},{})[_0x0a6a('0x22')](function(){return _0x120107;});}else{return _0x120107;}})['catch'](function(_0x2a1749){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a1749);throw _0x2a1749;});}return _0x120107;})[_0x0a6a('0x22')](respondWithResult(_0x4d5360,0xc9))[_0x0a6a('0x47')](handleError(_0x4d5360,null));};exports[_0x0a6a('0x21')]=function(_0x68f090,_0x37b711){if(_0x68f090[_0x0a6a('0x4c')]['id']){delete _0x68f090[_0x0a6a('0x4c')]['id'];}return db[_0x0a6a('0x2d')][_0x0a6a('0x51')]({'where':{'id':_0x68f090['params']['id']}})[_0x0a6a('0x22')](handleEntityNotFound(_0x37b711,null))[_0x0a6a('0x22')](saveUpdates(_0x68f090[_0x0a6a('0x4c')],null))['then'](respondWithResult(_0x37b711,null))[_0x0a6a('0x47')](handleError(_0x37b711,null));};exports['destroy']=function(_0x1a3b12,_0x577af1){return db[_0x0a6a('0x2d')][_0x0a6a('0x51')]({'where':{'id':_0x1a3b12[_0x0a6a('0x49')]['id']}})[_0x0a6a('0x22')](handleEntityNotFound(_0x577af1,null))[_0x0a6a('0x22')](removeEntity(_0x577af1,null))[_0x0a6a('0x47')](handleError(_0x577af1,null));}; \ No newline at end of file +var _0x5643=['fieldName','type','key','map','name','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','offset','sort','pick','where','merge','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','limit','set','Content-Range','apply','save','update','then','destroy','Metrics','UserProfileResource','error','stack','index','rawAttributes'];(function(_0x2cb7ee,_0x215b0d){var _0x2db13f=function(_0x49e035){while(--_0x49e035){_0x2cb7ee['push'](_0x2cb7ee['shift']());}};_0x2db13f(++_0x215b0d);}(_0x5643,0x11a));var _0x3564=function(_0xc8a141,_0x3305df){_0xc8a141=_0xc8a141-0x0;var _0x53b957=_0x5643[_0xc8a141];return _0x53b957;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3564('0x0'));var zipdir=require(_0x3564('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3564('0x2'));var moment=require(_0x3564('0x3'));var BPromise=require(_0x3564('0x4'));var Mustache=require(_0x3564('0x5'));var util=require(_0x3564('0x6'));var path=require(_0x3564('0x7'));var sox=require(_0x3564('0x8'));var csv=require(_0x3564('0x9'));var ejs=require(_0x3564('0xa'));var fs=require('fs');var _=require(_0x3564('0xb'));var squel=require('squel');var crypto=require(_0x3564('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3564('0xd'));var toCsv=require(_0x3564('0x9'));var querystring=require('querystring');var Papa=require(_0x3564('0xe'));var Redis=require(_0x3564('0xf'));var authService=require(_0x3564('0x10'));var qs=require(_0x3564('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3564('0x12'));var logger=require('../../config/logger')(_0x3564('0x13'));var utils=require(_0x3564('0x14'));var config=require(_0x3564('0x15'));var licenseUtil=require(_0x3564('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5412df,_0x4a2d45){_0x4a2d45=_0x4a2d45||0xcc;return function(_0x55d06d){if(_0x55d06d){return _0x5412df[_0x3564('0x17')](_0x4a2d45);}return _0x5412df['status'](_0x4a2d45)[_0x3564('0x18')]();};}function respondWithResult(_0x186fec,_0x31b134){_0x31b134=_0x31b134||0xc8;return function(_0x1a640a){if(_0x1a640a){return _0x186fec[_0x3564('0x19')](_0x31b134)[_0x3564('0x1a')](_0x1a640a);}};}function respondWithFilteredResult(_0x5ea06a,_0x1b7833){return function(_0x36f9dc){if(_0x36f9dc){var _0x2a87a4=_0x36f9dc[_0x3564('0x1b')],_0x32060f=_0x1b7833['offset'],_0x1af737=_0x1b7833['offset']+_0x1b7833[_0x3564('0x1c')],_0xfbcdcf;if(_0x1af737>=_0x2a87a4){_0x1af737=_0x2a87a4;_0xfbcdcf=0xc8;}else{_0xfbcdcf=0xce;}_0x5ea06a[_0x3564('0x19')](_0xfbcdcf);return _0x5ea06a[_0x3564('0x1d')](_0x3564('0x1e'),_0x32060f+'-'+_0x1af737+'/'+_0x2a87a4)[_0x3564('0x1a')](_0x36f9dc);}return null;};}function patchUpdates(_0x221520){return function(_0x2d6155){try{jsonpatch[_0x3564('0x1f')](_0x2d6155,_0x221520,!![]);}catch(_0x4f1fb3){return BPromise['reject'](_0x4f1fb3);}return _0x2d6155[_0x3564('0x20')]();};}function saveUpdates(_0x52bb60,_0x1a014c){return function(_0x51252c){if(_0x51252c){return _0x51252c[_0x3564('0x21')](_0x52bb60)[_0x3564('0x22')](function(_0x26e74e){return _0x26e74e;});}return null;};}function removeEntity(_0x161b08,_0x4acf59){return function(_0x81a809){if(_0x81a809){return _0x81a809[_0x3564('0x23')]()[_0x3564('0x22')](function(){var _0x49280b=_0x81a809['get']({'plain':!![]});var _0x17526e=_0x3564('0x24');return db[_0x3564('0x25')][_0x3564('0x23')]({'where':{'type':_0x17526e,'resourceId':_0x49280b['id']}})[_0x3564('0x22')](function(){return _0x81a809;});})[_0x3564('0x22')](function(){_0x161b08['status'](0xcc)[_0x3564('0x18')]();});}};}function handleEntityNotFound(_0x5cc6ec,_0x2cef7d){return function(_0x157817){if(!_0x157817){_0x5cc6ec['sendStatus'](0x194);}return _0x157817;};}function handleError(_0x2c6224,_0x27b4cd){_0x27b4cd=_0x27b4cd||0x1f4;return function(_0x14d4c8){logger[_0x3564('0x26')](_0x14d4c8[_0x3564('0x27')]);if(_0x14d4c8['name']){delete _0x14d4c8['name'];}_0x2c6224[_0x3564('0x19')](_0x27b4cd)['send'](_0x14d4c8);};}exports[_0x3564('0x28')]=function(_0xb828d2,_0xbf8f08){var _0x149877={},_0x138a61={},_0x5f578d={'count':0x0,'rows':[]};var _0xf62f8c=_['map'](db['AnalyticMetric'][_0x3564('0x29')],function(_0x3f717b){return{'name':_0x3f717b[_0x3564('0x2a')],'type':_0x3f717b[_0x3564('0x2b')][_0x3564('0x2c')]};});_0x138a61['model']=_[_0x3564('0x2d')](_0xf62f8c,_0x3564('0x2e'));_0x138a61[_0x3564('0x2f')]=_[_0x3564('0x30')](_0xb828d2[_0x3564('0x2f')]);_0x138a61['filters']=_['intersection'](_0x138a61['model'],_0x138a61[_0x3564('0x2f')]);_0x149877[_0x3564('0x31')]=_[_0x3564('0x32')](_0x138a61[_0x3564('0x33')],qs['fields'](_0xb828d2['query'][_0x3564('0x34')]));_0x149877['attributes']=_0x149877[_0x3564('0x31')][_0x3564('0x35')]?_0x149877[_0x3564('0x31')]:_0x138a61[_0x3564('0x33')];if(!_0xb828d2[_0x3564('0x2f')][_0x3564('0x36')](_0x3564('0x37'))){_0x149877[_0x3564('0x1c')]=qs['limit'](_0xb828d2[_0x3564('0x2f')][_0x3564('0x1c')]);_0x149877[_0x3564('0x38')]=qs[_0x3564('0x38')](_0xb828d2[_0x3564('0x2f')][_0x3564('0x38')]);}_0x149877['order']=qs[_0x3564('0x39')](_0xb828d2['query'][_0x3564('0x39')]);_0x149877['where']=qs['filters'](_[_0x3564('0x3a')](_0xb828d2['query'],_0x138a61['filters']),_0xf62f8c);if(_0xb828d2[_0x3564('0x2f')]['filter']){_0x149877[_0x3564('0x3b')]=_[_0x3564('0x3c')](_0x149877[_0x3564('0x3b')],{'$or':_[_0x3564('0x2d')](_0xf62f8c,function(_0x2b01de){if(_0x2b01de[_0x3564('0x2b')]!==_0x3564('0x3d')){var _0x3a6622={};_0x3a6622[_0x2b01de[_0x3564('0x2e')]]={'$like':'%'+_0xb828d2['query'][_0x3564('0x3e')]+'%'};return _0x3a6622;}})});}_0x149877=_['merge']({},_0x149877,_0xb828d2[_0x3564('0x3f')]);var _0x5d0c88={'where':_0x149877[_0x3564('0x3b')]};return db[_0x3564('0x40')][_0x3564('0x1b')](_0x5d0c88)[_0x3564('0x22')](function(_0x5071b8){_0x5f578d[_0x3564('0x1b')]=_0x5071b8;if(_0xb828d2[_0x3564('0x2f')][_0x3564('0x41')]){_0x149877[_0x3564('0x42')]=[{'all':!![]}];}return db[_0x3564('0x40')][_0x3564('0x43')](_0x149877);})[_0x3564('0x22')](function(_0x1e7259){_0x5f578d[_0x3564('0x44')]=_0x1e7259;return _0x5f578d;})[_0x3564('0x22')](respondWithFilteredResult(_0xbf8f08,_0x149877))['catch'](handleError(_0xbf8f08,null));};exports[_0x3564('0x45')]=function(_0x59c1dc,_0x534752){var _0x31a15c={'raw':!![],'where':{'id':_0x59c1dc[_0x3564('0x46')]['id']}},_0x31bad1={};_0x31bad1[_0x3564('0x33')]=_[_0x3564('0x30')](db[_0x3564('0x40')]['rawAttributes']);_0x31bad1[_0x3564('0x2f')]=_[_0x3564('0x30')](_0x59c1dc[_0x3564('0x2f')]);_0x31bad1['filters']=_['intersection'](_0x31bad1['model'],_0x31bad1['query']);_0x31a15c[_0x3564('0x31')]=_[_0x3564('0x32')](_0x31bad1[_0x3564('0x33')],qs['fields'](_0x59c1dc['query'][_0x3564('0x34')]));_0x31a15c['attributes']=_0x31a15c[_0x3564('0x31')][_0x3564('0x35')]?_0x31a15c[_0x3564('0x31')]:_0x31bad1['model'];if(_0x59c1dc[_0x3564('0x2f')][_0x3564('0x41')]){_0x31a15c[_0x3564('0x42')]=[{'all':!![]}];}_0x31a15c=_[_0x3564('0x3c')]({},_0x31a15c,_0x59c1dc['options']);return db[_0x3564('0x40')][_0x3564('0x47')](_0x31a15c)[_0x3564('0x22')](handleEntityNotFound(_0x534752,null))['then'](respondWithResult(_0x534752,null))['catch'](handleError(_0x534752,null));};exports[_0x3564('0x48')]=function(_0x16e1d4,_0x52a617){return db['AnalyticMetric']['create'](_0x16e1d4[_0x3564('0x49')],{})[_0x3564('0x22')](function(_0x1324e1){var _0x11e20a=_0x16e1d4[_0x3564('0x4a')][_0x3564('0x4b')]({'plain':!![]});if(!_0x11e20a)throw new Error(_0x3564('0x4c'));if(_0x11e20a[_0x3564('0x4d')]===_0x3564('0x4a')){var _0x466b22=_0x1324e1[_0x3564('0x4b')]({'plain':!![]});var _0x3606c1=_0x3564('0x24');return db[_0x3564('0x4e')]['find']({'where':{'name':_0x3606c1,'userProfileId':_0x11e20a[_0x3564('0x4f')]},'raw':!![]})[_0x3564('0x22')](function(_0x49d5e8){if(_0x49d5e8&&_0x49d5e8['autoAssociation']===0x0){return db['UserProfileResource'][_0x3564('0x48')]({'name':_0x466b22[_0x3564('0x2e')],'resourceId':_0x466b22['id'],'type':_0x49d5e8[_0x3564('0x2e')],'sectionId':_0x49d5e8['id']},{})[_0x3564('0x22')](function(){return _0x1324e1;});}else{return _0x1324e1;}})[_0x3564('0x50')](function(_0x12c00e){logger[_0x3564('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12c00e);throw _0x12c00e;});}return _0x1324e1;})[_0x3564('0x22')](respondWithResult(_0x52a617,0xc9))[_0x3564('0x50')](handleError(_0x52a617,null));};exports[_0x3564('0x21')]=function(_0x5f1f4b,_0x46f83f){if(_0x5f1f4b[_0x3564('0x49')]['id']){delete _0x5f1f4b['body']['id'];}return db['AnalyticMetric'][_0x3564('0x47')]({'where':{'id':_0x5f1f4b[_0x3564('0x46')]['id']}})[_0x3564('0x22')](handleEntityNotFound(_0x46f83f,null))[_0x3564('0x22')](saveUpdates(_0x5f1f4b[_0x3564('0x49')],null))['then'](respondWithResult(_0x46f83f,null))[_0x3564('0x50')](handleError(_0x46f83f,null));};exports[_0x3564('0x23')]=function(_0x161d44,_0x3cd321){return db[_0x3564('0x40')][_0x3564('0x47')]({'where':{'id':_0x161d44[_0x3564('0x46')]['id']}})[_0x3564('0x22')](handleEntityNotFound(_0x3cd321,null))[_0x3564('0x22')](removeEntity(_0x3cd321,null))[_0x3564('0x50')](handleError(_0x3cd321,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 2468864..f934732 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 _0x755c=['../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','api','request-promise','path','rimraf'];(function(_0x6817d7,_0x41cd40){var _0x1c8ee8=function(_0x1754a5){while(--_0x1754a5){_0x6817d7['push'](_0x6817d7['shift']());}};_0x1c8ee8(++_0x41cd40);}(_0x755c,0xff));var _0xc755=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x755c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc755('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc755('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc755('0x2'));var fs=require('fs');var path=require(_0xc755('0x3'));var rimraf=require(_0xc755('0x4'));var config=require(_0xc755('0x5'));var attributes=require(_0xc755('0x6'));module[_0xc755('0x7')]=function(_0x403b3c,_0x517d6a){return _0x403b3c[_0xc755('0x8')]('AnalyticMetric',attributes,{'tableName':_0xc755('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72fd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','util','../../config/logger'];(function(_0x14806a,_0x14d122){var _0x12e125=function(_0x7e370e){while(--_0x7e370e){_0x14806a['push'](_0x14806a['shift']());}};_0x12e125(++_0x14d122);}(_0x72fd,0x17e));var _0xd72f=function(_0x5cfa59,_0x56f6a1){_0x5cfa59=_0x5cfa59-0x0;var _0x4adafc=_0x72fd[_0x5cfa59];return _0x4adafc;};'use strict';var _=require('lodash');var util=require(_0xd72f('0x0'));var logger=require(_0xd72f('0x1'))('api');var moment=require(_0xd72f('0x2'));var BPromise=require(_0xd72f('0x3'));var rp=require(_0xd72f('0x4'));var fs=require('fs');var path=require(_0xd72f('0x5'));var rimraf=require(_0xd72f('0x6'));var config=require(_0xd72f('0x7'));var attributes=require(_0xd72f('0x8'));module[_0xd72f('0x9')]=function(_0x11018f,_0x3dfad3){return _0x11018f['define'](_0xd72f('0xa'),attributes,{'tableName':_0xd72f('0xb'),'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 f4108e0..efddade 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 _0xeeb3=['info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x23db81,_0x49099b){var _0x5b0c14=function(_0x314976){while(--_0x314976){_0x23db81['push'](_0x23db81['shift']());}};_0x5b0c14(++_0x49099b);}(_0xeeb3,0x135));var _0x3eeb=function(_0xc09c66,_0x304cc6){_0xc09c66=_0xc09c66-0x0;var _0x49aa13=_0xeeb3[_0xc09c66];return _0x49aa13;};'use strict';var _=require(_0x3eeb('0x0'));var util=require(_0x3eeb('0x1'));var moment=require(_0x3eeb('0x2'));var BPromise=require('bluebird');var rs=require(_0x3eeb('0x3'));var fs=require('fs');var Redis=require(_0x3eeb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3eeb('0x5'));var logger=require('../../config/logger')(_0x3eeb('0x6'));var config=require(_0x3eeb('0x7'));var jayson=require(_0x3eeb('0x8'));var client=jayson[_0x3eeb('0x9')][_0x3eeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cbde8,_0x52bdcb,_0x1b4578){return new BPromise(function(_0x1feb7b,_0x1d0172){return client[_0x3eeb('0xb')](_0x4cbde8,_0x1b4578)[_0x3eeb('0xc')](function(_0xc25c16){logger[_0x3eeb('0xd')](_0x3eeb('0xe'),_0x52bdcb,_0x3eeb('0xf'));logger[_0x3eeb('0x10')](_0x3eeb('0x11'),_0x52bdcb,'request\x20sent',JSON['stringify'](_0xc25c16));if(_0xc25c16[_0x3eeb('0x12')]){if(_0xc25c16[_0x3eeb('0x12')][_0x3eeb('0x13')]===0x1f4){logger[_0x3eeb('0x12')](_0x3eeb('0xe'),_0x52bdcb,_0xc25c16[_0x3eeb('0x12')][_0x3eeb('0x14')]);return _0x1d0172(_0xc25c16['error'][_0x3eeb('0x14')]);}logger[_0x3eeb('0x12')](_0x3eeb('0xe'),_0x52bdcb,_0xc25c16['error'][_0x3eeb('0x14')]);return _0x1feb7b(_0xc25c16[_0x3eeb('0x12')][_0x3eeb('0x14')]);}else{logger[_0x3eeb('0xd')](_0x3eeb('0xe'),_0x52bdcb,_0x3eeb('0xf'));_0x1feb7b(_0xc25c16[_0x3eeb('0x15')][_0x3eeb('0x14')]);}})[_0x3eeb('0x16')](function(_0x519eef){logger['error'](_0x3eeb('0xe'),_0x52bdcb,_0x519eef);_0x1d0172(_0x519eef);});});} \ No newline at end of file +var _0xfa3d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','randomstring'];(function(_0x3e8628,_0x556717){var _0x4f9472=function(_0x4c6032){while(--_0x4c6032){_0x3e8628['push'](_0x3e8628['shift']());}};_0x4f9472(++_0x556717);}(_0xfa3d,0x1b5));var _0xdfa3=function(_0x12452f,_0x231318){_0x12452f=_0x12452f-0x0;var _0x5a5f7d=_0xfa3d[_0x12452f];return _0x5a5f7d;};'use strict';var _=require(_0xdfa3('0x0'));var util=require('util');var moment=require(_0xdfa3('0x1'));var BPromise=require('bluebird');var rs=require(_0xdfa3('0x2'));var fs=require('fs');var Redis=require(_0xdfa3('0x3'));var db=require(_0xdfa3('0x4'))['db'];var utils=require(_0xdfa3('0x5'));var logger=require(_0xdfa3('0x6'))('rpc');var config=require(_0xdfa3('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdfa3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22534b,_0x3469ee,_0x34b811){return new BPromise(function(_0x10328c,_0x2bb693){return client[_0xdfa3('0x9')](_0x22534b,_0x34b811)[_0xdfa3('0xa')](function(_0x5f5549){logger[_0xdfa3('0xb')](_0xdfa3('0xc'),_0x3469ee,'request\x20sent');logger[_0xdfa3('0xd')](_0xdfa3('0xe'),_0x3469ee,_0xdfa3('0xf'),JSON['stringify'](_0x5f5549));if(_0x5f5549[_0xdfa3('0x10')]){if(_0x5f5549[_0xdfa3('0x10')][_0xdfa3('0x11')]===0x1f4){logger[_0xdfa3('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x3469ee,_0x5f5549[_0xdfa3('0x10')][_0xdfa3('0x12')]);return _0x2bb693(_0x5f5549['error']['message']);}logger['error'](_0xdfa3('0xc'),_0x3469ee,_0x5f5549['error'][_0xdfa3('0x12')]);return _0x10328c(_0x5f5549[_0xdfa3('0x10')][_0xdfa3('0x12')]);}else{logger[_0xdfa3('0xb')](_0xdfa3('0xc'),_0x3469ee,_0xdfa3('0xf'));_0x10328c(_0x5f5549['result'][_0xdfa3('0x12')]);}})[_0xdfa3('0x13')](function(_0x5d75ff){logger[_0xdfa3('0x10')](_0xdfa3('0xc'),_0x3469ee,_0x5d75ff);_0x2bb693(_0x5d75ff);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c4a2782..84d4a30 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 _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x2d8636,_0x12f8cc){var _0x237951=function(_0x3ca0a1){while(--_0x3ca0a1){_0x2d8636['push'](_0x2d8636['shift']());}};_0x237951(++_0x12f8cc);}(_0x524e,0x15e));var _0xe524=function(_0x14dbe7,_0x21e092){_0x14dbe7=_0x14dbe7-0x0;var _0x32e97c=_0x524e[_0x14dbe7];return _0x32e97c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file +var _0x3f8a=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x3103e4,_0x202431){var _0x360a19=function(_0x24f2d4){while(--_0x24f2d4){_0x3103e4['push'](_0x3103e4['shift']());}};_0x360a19(++_0x202431);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x25c524,_0x590cd6){_0x25c524=_0x25c524-0x0;var _0x496c5b=_0x3f8a[_0x25c524];return _0x496c5b;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xc'),auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['destroy']);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f41b056..f5b48f3 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 _0x98b3=['sequelize','exports','TEXT'];(function(_0x14592c,_0x1245a7){var _0x5c893b=function(_0x3332ab){while(--_0x3332ab){_0x14592c['push'](_0x14592c['shift']());}};_0x5c893b(++_0x1245a7);}(_0x98b3,0x1b0));var _0x398b=function(_0x46da44,_0x16ca7e){_0x46da44=_0x46da44-0x0;var _0x5efd58=_0x98b3[_0x46da44];return _0x5efd58;};'use strict';var Sequelize=require(_0x398b('0x0'));module[_0x398b('0x1')]={'tree':{'type':Sequelize[_0x398b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7f39=['exports','sequelize'];(function(_0x24170b,_0x55205d){var _0x3fb2a5=function(_0x5cc373){while(--_0x5cc373){_0x24170b['push'](_0x24170b['shift']());}};_0x3fb2a5(++_0x55205d);}(_0x7f39,0x10f));var _0x97f3=function(_0x27e029,_0x17e305){_0x27e029=_0x27e029-0x0;var _0x29bf95=_0x7f39[_0x27e029];return _0x29bf95;};'use strict';var Sequelize=require(_0x97f3('0x0'));module[_0x97f3('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index c71d3fe..132ab1c 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 _0x8153=['fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','rows','catch','params','includeAll','include','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x1949f7,_0xfdc8d5){var _0x323f37=function(_0x42a2ff){while(--_0x42a2ff){_0x1949f7['push'](_0x1949f7['shift']());}};_0x323f37(++_0xfdc8d5);}(_0x8153,0xd4));var _0x3815=function(_0x1a768c,_0x8b3182){_0x1a768c=_0x1a768c-0x0;var _0x37b3db=_0x8153[_0x1a768c];return _0x37b3db;};'use strict';var pdf=require(_0x3815('0x0'));var emlformat=require(_0x3815('0x1'));var rimraf=require(_0x3815('0x2'));var zipdir=require(_0x3815('0x3'));var jsonpatch=require(_0x3815('0x4'));var rp=require(_0x3815('0x5'));var moment=require(_0x3815('0x6'));var BPromise=require(_0x3815('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3815('0x8'));var csv=require(_0x3815('0x9'));var ejs=require(_0x3815('0xa'));var fs=require('fs');var _=require(_0x3815('0xb'));var squel=require('squel');var crypto=require(_0x3815('0xc'));var jsforce=require(_0x3815('0xd'));var deskjs=require(_0x3815('0xe'));var toCsv=require(_0x3815('0x9'));var querystring=require(_0x3815('0xf'));var Papa=require('papaparse');var Redis=require(_0x3815('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3815('0x11'));var as=require(_0x3815('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3815('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3815('0x14'));var db=require(_0x3815('0x15'))['db'];function respondWithStatusCode(_0x582da0,_0x5f03d7){_0x5f03d7=_0x5f03d7||0xcc;return function(_0x24001c){if(_0x24001c){return _0x582da0['sendStatus'](_0x5f03d7);}return _0x582da0[_0x3815('0x16')](_0x5f03d7)['end']();};}function respondWithResult(_0x3021be,_0x4c83fc){_0x4c83fc=_0x4c83fc||0xc8;return function(_0x4b911b){if(_0x4b911b){return _0x3021be[_0x3815('0x16')](_0x4c83fc)['json'](_0x4b911b);}};}function respondWithFilteredResult(_0x10c125,_0x438693){return function(_0x5996f4){if(_0x5996f4){var _0x460710=_0x5996f4[_0x3815('0x17')],_0x11704e=_0x438693['offset'],_0x45905d=_0x438693[_0x3815('0x18')]+_0x438693['limit'],_0xc88a68;if(_0x45905d>=_0x460710){_0x45905d=_0x460710;_0xc88a68=0xc8;}else{_0xc88a68=0xce;}_0x10c125[_0x3815('0x16')](_0xc88a68);return _0x10c125[_0x3815('0x19')](_0x3815('0x1a'),_0x11704e+'-'+_0x45905d+'/'+_0x460710)[_0x3815('0x1b')](_0x5996f4);}return null;};}function patchUpdates(_0x19593f){return function(_0x3069ee){try{jsonpatch[_0x3815('0x1c')](_0x3069ee,_0x19593f,!![]);}catch(_0x1dd497){return BPromise[_0x3815('0x1d')](_0x1dd497);}return _0x3069ee[_0x3815('0x1e')]();};}function saveUpdates(_0x100c5d,_0x2cf9cb){return function(_0x103b75){if(_0x103b75){return _0x103b75[_0x3815('0x1f')](_0x100c5d)[_0x3815('0x20')](function(_0x4b79e3){return _0x4b79e3;});}return null;};}function removeEntity(_0x581bad,_0x468dfd){return function(_0x3bc0f0){if(_0x3bc0f0){return _0x3bc0f0['destroy']()['then'](function(){_0x581bad[_0x3815('0x16')](0xcc)[_0x3815('0x21')]();});}};}function handleEntityNotFound(_0x14f06a,_0x12fd96){return function(_0x7ba8ed){if(!_0x7ba8ed){_0x14f06a[_0x3815('0x22')](0x194);}return _0x7ba8ed;};}function handleError(_0x39bec7,_0x182ad7){_0x182ad7=_0x182ad7||0x1f4;return function(_0x5bfbf6){logger[_0x3815('0x23')](_0x5bfbf6[_0x3815('0x24')]);if(_0x5bfbf6[_0x3815('0x25')]){delete _0x5bfbf6['name'];}_0x39bec7['status'](_0x182ad7)[_0x3815('0x26')](_0x5bfbf6);};}exports[_0x3815('0x27')]=function(_0x574381,_0x8074a5){var _0x342b73={},_0x3c3880={},_0x52301c={'count':0x0,'rows':[]};var _0x50c25a=_[_0x3815('0x28')](db[_0x3815('0x29')][_0x3815('0x2a')],function(_0x2d2fe8){return{'name':_0x2d2fe8['fieldName'],'type':_0x2d2fe8[_0x3815('0x2b')][_0x3815('0x2c')]};});_0x3c3880[_0x3815('0x2d')]=_['map'](_0x50c25a,_0x3815('0x25'));_0x3c3880['query']=_[_0x3815('0x2e')](_0x574381[_0x3815('0x2f')]);_0x3c3880[_0x3815('0x30')]=_[_0x3815('0x31')](_0x3c3880['model'],_0x3c3880[_0x3815('0x2f')]);_0x342b73[_0x3815('0x32')]=_[_0x3815('0x31')](_0x3c3880[_0x3815('0x2d')],qs[_0x3815('0x33')](_0x574381[_0x3815('0x2f')]['fields']));_0x342b73[_0x3815('0x32')]=_0x342b73['attributes'][_0x3815('0x34')]?_0x342b73['attributes']:_0x3c3880[_0x3815('0x2d')];if(!_0x574381['query'][_0x3815('0x35')](_0x3815('0x36'))){_0x342b73[_0x3815('0x37')]=qs['limit'](_0x574381['query'][_0x3815('0x37')]);_0x342b73[_0x3815('0x18')]=qs[_0x3815('0x18')](_0x574381[_0x3815('0x2f')]['offset']);}_0x342b73[_0x3815('0x38')]=qs[_0x3815('0x39')](_0x574381['query'][_0x3815('0x39')]);_0x342b73['where']=qs[_0x3815('0x30')](_[_0x3815('0x3a')](_0x574381[_0x3815('0x2f')],_0x3c3880['filters']),_0x50c25a);if(_0x574381[_0x3815('0x2f')][_0x3815('0x3b')]){_0x342b73[_0x3815('0x3c')]=_[_0x3815('0x3d')](_0x342b73[_0x3815('0x3c')],{'$or':_[_0x3815('0x28')](_0x50c25a,function(_0x4b8252){if(_0x4b8252['type']!=='VIRTUAL'){var _0x5823e9={};_0x5823e9[_0x4b8252['name']]={'$like':'%'+_0x574381[_0x3815('0x2f')][_0x3815('0x3b')]+'%'};return _0x5823e9;}})});}_0x342b73=_[_0x3815('0x3d')]({},_0x342b73,_0x574381[_0x3815('0x3e')]);var _0x1fa85a={'where':_0x342b73[_0x3815('0x3c')]};return db[_0x3815('0x29')]['count'](_0x1fa85a)[_0x3815('0x20')](function(_0x14ff04){_0x52301c[_0x3815('0x17')]=_0x14ff04;if(_0x574381[_0x3815('0x2f')]['includeAll']){_0x342b73['include']=[{'all':!![]}];}return db[_0x3815('0x29')]['findAll'](_0x342b73);})['then'](function(_0x288d53){_0x52301c[_0x3815('0x3f')]=_0x288d53;return _0x52301c;})['then'](respondWithFilteredResult(_0x8074a5,_0x342b73))[_0x3815('0x40')](handleError(_0x8074a5,null));};exports['show']=function(_0x4f3ff9,_0x4d190e){var _0x20caf5={'raw':!![],'where':{'id':_0x4f3ff9[_0x3815('0x41')]['id']}},_0x42b8e3={};_0x42b8e3['model']=_[_0x3815('0x2e')](db[_0x3815('0x29')][_0x3815('0x2a')]);_0x42b8e3[_0x3815('0x2f')]=_[_0x3815('0x2e')](_0x4f3ff9[_0x3815('0x2f')]);_0x42b8e3[_0x3815('0x30')]=_[_0x3815('0x31')](_0x42b8e3[_0x3815('0x2d')],_0x42b8e3[_0x3815('0x2f')]);_0x20caf5[_0x3815('0x32')]=_[_0x3815('0x31')](_0x42b8e3[_0x3815('0x2d')],qs['fields'](_0x4f3ff9[_0x3815('0x2f')][_0x3815('0x33')]));_0x20caf5[_0x3815('0x32')]=_0x20caf5[_0x3815('0x32')][_0x3815('0x34')]?_0x20caf5['attributes']:_0x42b8e3['model'];if(_0x4f3ff9['query'][_0x3815('0x42')]){_0x20caf5[_0x3815('0x43')]=[{'all':!![]}];}_0x20caf5=_[_0x3815('0x3d')]({},_0x20caf5,_0x4f3ff9[_0x3815('0x3e')]);return db[_0x3815('0x29')][_0x3815('0x44')](_0x20caf5)['then'](handleEntityNotFound(_0x4d190e,null))['then'](respondWithResult(_0x4d190e,null))[_0x3815('0x40')](handleError(_0x4d190e,null));};exports[_0x3815('0x45')]=function(_0x28b0dd,_0x90351a){return db[_0x3815('0x29')][_0x3815('0x45')](_0x28b0dd[_0x3815('0x46')],{})[_0x3815('0x20')](respondWithResult(_0x90351a,0xc9))[_0x3815('0x40')](handleError(_0x90351a,null));};exports[_0x3815('0x1f')]=function(_0x3deadd,_0x10539b){if(_0x3deadd[_0x3815('0x46')]['id']){delete _0x3deadd[_0x3815('0x46')]['id'];}return db[_0x3815('0x29')][_0x3815('0x44')]({'where':{'id':_0x3deadd['params']['id']}})[_0x3815('0x20')](handleEntityNotFound(_0x10539b,null))[_0x3815('0x20')](saveUpdates(_0x3deadd[_0x3815('0x46')],null))[_0x3815('0x20')](respondWithResult(_0x10539b,null))[_0x3815('0x40')](handleError(_0x10539b,null));};exports[_0x3815('0x47')]=function(_0x220d27,_0x539794){return db[_0x3815('0x29')][_0x3815('0x44')]({'where':{'id':_0x220d27[_0x3815('0x41')]['id']}})['then'](handleEntityNotFound(_0x539794,null))[_0x3815('0x20')](removeEntity(_0x539794,null))[_0x3815('0x40')](handleError(_0x539794,null));}; \ No newline at end of file +var _0xfc59=['then','destroy','stack','send','index','rawAttributes','type','key','model','map','name','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','merge','VIRTUAL','AnalyticTreeReport','includeAll','include','catch','show','keys','find','create','body','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc59,0x185));var _0x9fc5=function(_0x5b6ed0,_0x35c545){_0x5b6ed0=_0x5b6ed0-0x0;var _0x8f3aed=_0xfc59[_0x5b6ed0];return _0x8f3aed;};'use strict';var pdf=require(_0x9fc5('0x0'));var emlformat=require(_0x9fc5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9fc5('0x2'));var rp=require(_0x9fc5('0x3'));var moment=require(_0x9fc5('0x4'));var BPromise=require(_0x9fc5('0x5'));var Mustache=require(_0x9fc5('0x6'));var util=require(_0x9fc5('0x7'));var path=require(_0x9fc5('0x8'));var sox=require(_0x9fc5('0x9'));var csv=require(_0x9fc5('0xa'));var ejs=require(_0x9fc5('0xb'));var fs=require('fs');var _=require(_0x9fc5('0xc'));var squel=require(_0x9fc5('0xd'));var crypto=require(_0x9fc5('0xe'));var jsforce=require(_0x9fc5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9fc5('0xa'));var querystring=require(_0x9fc5('0x10'));var Papa=require('papaparse');var Redis=require(_0x9fc5('0x11'));var authService=require(_0x9fc5('0x12'));var qs=require(_0x9fc5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fc5('0x14'))(_0x9fc5('0x15'));var utils=require(_0x9fc5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9fc5('0x17'));var db=require(_0x9fc5('0x18'))['db'];function respondWithStatusCode(_0x4cd013,_0x11d220){_0x11d220=_0x11d220||0xcc;return function(_0x53830d){if(_0x53830d){return _0x4cd013[_0x9fc5('0x19')](_0x11d220);}return _0x4cd013[_0x9fc5('0x1a')](_0x11d220)['end']();};}function respondWithResult(_0x46c174,_0x5e0b28){_0x5e0b28=_0x5e0b28||0xc8;return function(_0x1765b2){if(_0x1765b2){return _0x46c174['status'](_0x5e0b28)[_0x9fc5('0x1b')](_0x1765b2);}};}function respondWithFilteredResult(_0x242418,_0x3f72f9){return function(_0x532b02){if(_0x532b02){var _0x7e2ca0=_0x532b02[_0x9fc5('0x1c')],_0x58032c=_0x3f72f9[_0x9fc5('0x1d')],_0x7ffaa1=_0x3f72f9[_0x9fc5('0x1d')]+_0x3f72f9[_0x9fc5('0x1e')],_0x24b14a;if(_0x7ffaa1>=_0x7e2ca0){_0x7ffaa1=_0x7e2ca0;_0x24b14a=0xc8;}else{_0x24b14a=0xce;}_0x242418[_0x9fc5('0x1a')](_0x24b14a);return _0x242418[_0x9fc5('0x1f')](_0x9fc5('0x20'),_0x58032c+'-'+_0x7ffaa1+'/'+_0x7e2ca0)[_0x9fc5('0x1b')](_0x532b02);}return null;};}function patchUpdates(_0x38cad0){return function(_0x53e0f7){try{jsonpatch[_0x9fc5('0x21')](_0x53e0f7,_0x38cad0,!![]);}catch(_0x2a0bfc){return BPromise[_0x9fc5('0x22')](_0x2a0bfc);}return _0x53e0f7[_0x9fc5('0x23')]();};}function saveUpdates(_0x1065ef,_0x26dfdd){return function(_0x1ca2a6){if(_0x1ca2a6){return _0x1ca2a6[_0x9fc5('0x24')](_0x1065ef)[_0x9fc5('0x25')](function(_0x32ce66){return _0x32ce66;});}return null;};}function removeEntity(_0x5596d8,_0x4baba4){return function(_0x3a049c){if(_0x3a049c){return _0x3a049c[_0x9fc5('0x26')]()[_0x9fc5('0x25')](function(){_0x5596d8[_0x9fc5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454945,_0x186ed7){return function(_0x35d554){if(!_0x35d554){_0x454945[_0x9fc5('0x19')](0x194);}return _0x35d554;};}function handleError(_0x2332cf,_0x3a04e3){_0x3a04e3=_0x3a04e3||0x1f4;return function(_0x5336a1){logger['error'](_0x5336a1[_0x9fc5('0x27')]);if(_0x5336a1['name']){delete _0x5336a1['name'];}_0x2332cf['status'](_0x3a04e3)[_0x9fc5('0x28')](_0x5336a1);};}exports[_0x9fc5('0x29')]=function(_0x8cd2c2,_0x510cef){var _0x49241d={},_0x1330b9={},_0x1f36a8={'count':0x0,'rows':[]};var _0x355785=_['map'](db['AnalyticTreeReport'][_0x9fc5('0x2a')],function(_0x457843){return{'name':_0x457843['fieldName'],'type':_0x457843[_0x9fc5('0x2b')][_0x9fc5('0x2c')]};});_0x1330b9[_0x9fc5('0x2d')]=_[_0x9fc5('0x2e')](_0x355785,_0x9fc5('0x2f'));_0x1330b9[_0x9fc5('0x30')]=_['keys'](_0x8cd2c2[_0x9fc5('0x30')]);_0x1330b9['filters']=_[_0x9fc5('0x31')](_0x1330b9[_0x9fc5('0x2d')],_0x1330b9[_0x9fc5('0x30')]);_0x49241d[_0x9fc5('0x32')]=_['intersection'](_0x1330b9['model'],qs[_0x9fc5('0x33')](_0x8cd2c2['query'][_0x9fc5('0x33')]));_0x49241d[_0x9fc5('0x32')]=_0x49241d[_0x9fc5('0x32')][_0x9fc5('0x34')]?_0x49241d[_0x9fc5('0x32')]:_0x1330b9[_0x9fc5('0x2d')];if(!_0x8cd2c2[_0x9fc5('0x30')][_0x9fc5('0x35')]('nolimit')){_0x49241d['limit']=qs['limit'](_0x8cd2c2[_0x9fc5('0x30')]['limit']);_0x49241d[_0x9fc5('0x1d')]=qs[_0x9fc5('0x1d')](_0x8cd2c2[_0x9fc5('0x30')][_0x9fc5('0x1d')]);}_0x49241d['order']=qs[_0x9fc5('0x36')](_0x8cd2c2[_0x9fc5('0x30')][_0x9fc5('0x36')]);_0x49241d['where']=qs[_0x9fc5('0x37')](_[_0x9fc5('0x38')](_0x8cd2c2['query'],_0x1330b9[_0x9fc5('0x37')]),_0x355785);if(_0x8cd2c2[_0x9fc5('0x30')][_0x9fc5('0x39')]){_0x49241d[_0x9fc5('0x3a')]=_[_0x9fc5('0x3b')](_0x49241d[_0x9fc5('0x3a')],{'$or':_[_0x9fc5('0x2e')](_0x355785,function(_0x381512){if(_0x381512[_0x9fc5('0x2b')]!==_0x9fc5('0x3c')){var _0x2b263b={};_0x2b263b[_0x381512[_0x9fc5('0x2f')]]={'$like':'%'+_0x8cd2c2[_0x9fc5('0x30')][_0x9fc5('0x39')]+'%'};return _0x2b263b;}})});}_0x49241d=_[_0x9fc5('0x3b')]({},_0x49241d,_0x8cd2c2['options']);var _0x50511f={'where':_0x49241d['where']};return db[_0x9fc5('0x3d')]['count'](_0x50511f)['then'](function(_0x184739){_0x1f36a8[_0x9fc5('0x1c')]=_0x184739;if(_0x8cd2c2[_0x9fc5('0x30')][_0x9fc5('0x3e')]){_0x49241d[_0x9fc5('0x3f')]=[{'all':!![]}];}return db[_0x9fc5('0x3d')]['findAll'](_0x49241d);})[_0x9fc5('0x25')](function(_0x539e71){_0x1f36a8['rows']=_0x539e71;return _0x1f36a8;})[_0x9fc5('0x25')](respondWithFilteredResult(_0x510cef,_0x49241d))[_0x9fc5('0x40')](handleError(_0x510cef,null));};exports[_0x9fc5('0x41')]=function(_0xbcf4d5,_0x3581d){var _0xbf2f6c={'raw':!![],'where':{'id':_0xbcf4d5['params']['id']}},_0x4ac627={};_0x4ac627['model']=_['keys'](db[_0x9fc5('0x3d')]['rawAttributes']);_0x4ac627['query']=_[_0x9fc5('0x42')](_0xbcf4d5[_0x9fc5('0x30')]);_0x4ac627[_0x9fc5('0x37')]=_[_0x9fc5('0x31')](_0x4ac627['model'],_0x4ac627[_0x9fc5('0x30')]);_0xbf2f6c['attributes']=_[_0x9fc5('0x31')](_0x4ac627[_0x9fc5('0x2d')],qs[_0x9fc5('0x33')](_0xbcf4d5[_0x9fc5('0x30')][_0x9fc5('0x33')]));_0xbf2f6c[_0x9fc5('0x32')]=_0xbf2f6c[_0x9fc5('0x32')]['length']?_0xbf2f6c[_0x9fc5('0x32')]:_0x4ac627[_0x9fc5('0x2d')];if(_0xbcf4d5[_0x9fc5('0x30')][_0x9fc5('0x3e')]){_0xbf2f6c[_0x9fc5('0x3f')]=[{'all':!![]}];}_0xbf2f6c=_[_0x9fc5('0x3b')]({},_0xbf2f6c,_0xbcf4d5['options']);return db[_0x9fc5('0x3d')][_0x9fc5('0x43')](_0xbf2f6c)[_0x9fc5('0x25')](handleEntityNotFound(_0x3581d,null))[_0x9fc5('0x25')](respondWithResult(_0x3581d,null))[_0x9fc5('0x40')](handleError(_0x3581d,null));};exports[_0x9fc5('0x44')]=function(_0x18dfe7,_0xc4b593){return db[_0x9fc5('0x3d')][_0x9fc5('0x44')](_0x18dfe7[_0x9fc5('0x45')],{})['then'](respondWithResult(_0xc4b593,0xc9))[_0x9fc5('0x40')](handleError(_0xc4b593,null));};exports[_0x9fc5('0x24')]=function(_0x5cacc5,_0x3f1530){if(_0x5cacc5['body']['id']){delete _0x5cacc5[_0x9fc5('0x45')]['id'];}return db[_0x9fc5('0x3d')][_0x9fc5('0x43')]({'where':{'id':_0x5cacc5[_0x9fc5('0x46')]['id']}})[_0x9fc5('0x25')](handleEntityNotFound(_0x3f1530,null))[_0x9fc5('0x25')](saveUpdates(_0x5cacc5['body'],null))['then'](respondWithResult(_0x3f1530,null))[_0x9fc5('0x40')](handleError(_0x3f1530,null));};exports[_0x9fc5('0x26')]=function(_0x5cd78f,_0x282896){return db['AnalyticTreeReport']['find']({'where':{'id':_0x5cd78f[_0x9fc5('0x46')]['id']}})[_0x9fc5('0x25')](handleEntityNotFound(_0x282896,null))[_0x9fc5('0x25')](removeEntity(_0x282896,null))[_0x9fc5('0x40')](handleError(_0x282896,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 9231357..dfe7d4d 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 _0xd481=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xd481,0x1e4));var _0x1d48=function(_0x9b2fb1,_0x2841d5){_0x9b2fb1=_0x9b2fb1-0x0;var _0x596238=_0xd481[_0x9b2fb1];return _0x596238;};'use strict';var _=require(_0x1d48('0x0'));var util=require('util');var logger=require(_0x1d48('0x1'))(_0x1d48('0x2'));var moment=require('moment');var BPromise=require(_0x1d48('0x3'));var rp=require(_0x1d48('0x4'));var fs=require('fs');var path=require(_0x1d48('0x5'));var rimraf=require('rimraf');var config=require(_0x1d48('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0x1d48('0x7')]=function(_0x2a4830,_0x5a0c28){return _0x2a4830[_0x1d48('0x8')](_0x1d48('0x9'),attributes,{'tableName':_0x1d48('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3ed=['moment','bluebird','request-promise','path','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api'];(function(_0x198b58,_0x5c4199){var _0x2719f7=function(_0x1dac8a){while(--_0x1dac8a){_0x198b58['push'](_0x198b58['shift']());}};_0x2719f7(++_0x5c4199);}(_0xc3ed,0x111));var _0xdc3e=function(_0x148697,_0x4a9edd){_0x148697=_0x148697-0x0;var _0x32ed7e=_0xc3ed[_0x148697];return _0x32ed7e;};'use strict';var _=require(_0xdc3e('0x0'));var util=require(_0xdc3e('0x1'));var logger=require('../../config/logger')(_0xdc3e('0x2'));var moment=require(_0xdc3e('0x3'));var BPromise=require(_0xdc3e('0x4'));var rp=require(_0xdc3e('0x5'));var fs=require('fs');var path=require(_0xdc3e('0x6'));var rimraf=require('rimraf');var config=require(_0xdc3e('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xdc3e('0x8')]=function(_0x27b691,_0x3f6e1c){return _0x27b691[_0xdc3e('0x9')](_0xdc3e('0xa'),attributes,{'tableName':_0xdc3e('0xb'),'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 2600d2b..0432e43 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 _0xbe4a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x41bf52,_0x37f4b8){var _0x512fbc=function(_0x2fe33f){while(--_0x2fe33f){_0x41bf52['push'](_0x41bf52['shift']());}};_0x512fbc(++_0x37f4b8);}(_0xbe4a,0x132));var _0xabe4=function(_0x171d07,_0x59c974){_0x171d07=_0x171d07-0x0;var _0x135563=_0xbe4a[_0x171d07];return _0x135563;};'use strict';var _=require('lodash');var util=require(_0xabe4('0x0'));var moment=require(_0xabe4('0x1'));var BPromise=require('bluebird');var rs=require(_0xabe4('0x2'));var fs=require('fs');var Redis=require(_0xabe4('0x3'));var db=require(_0xabe4('0x4'))['db'];var utils=require(_0xabe4('0x5'));var logger=require(_0xabe4('0x6'))(_0xabe4('0x7'));var config=require(_0xabe4('0x8'));var jayson=require(_0xabe4('0x9'));var client=jayson[_0xabe4('0xa')][_0xabe4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x417c2d,_0x438e4a,_0x392666){return new BPromise(function(_0x5eec9a,_0x300ce0){return client['request'](_0x417c2d,_0x392666)[_0xabe4('0xc')](function(_0x24defc){logger[_0xabe4('0xd')](_0xabe4('0xe'),_0x438e4a,_0xabe4('0xf'));logger[_0xabe4('0x10')](_0xabe4('0x11'),_0x438e4a,_0xabe4('0xf'),JSON[_0xabe4('0x12')](_0x24defc));if(_0x24defc[_0xabe4('0x13')]){if(_0x24defc[_0xabe4('0x13')][_0xabe4('0x14')]===0x1f4){logger[_0xabe4('0x13')](_0xabe4('0xe'),_0x438e4a,_0x24defc[_0xabe4('0x13')][_0xabe4('0x15')]);return _0x300ce0(_0x24defc[_0xabe4('0x13')][_0xabe4('0x15')]);}logger[_0xabe4('0x13')](_0xabe4('0xe'),_0x438e4a,_0x24defc[_0xabe4('0x13')][_0xabe4('0x15')]);return _0x5eec9a(_0x24defc['error'][_0xabe4('0x15')]);}else{logger[_0xabe4('0xd')](_0xabe4('0xe'),_0x438e4a,'request\x20sent');_0x5eec9a(_0x24defc[_0xabe4('0x16')][_0xabe4('0x15')]);}})[_0xabe4('0x17')](function(_0x3ad964){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x438e4a,_0x3ad964);_0x300ce0(_0x3ad964);});});} \ No newline at end of file +var _0x557d=['../../config/environment','jayson/promise','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1fa160,_0x16ecd8){var _0x44aef7=function(_0x27c3b0){while(--_0x27c3b0){_0x1fa160['push'](_0x1fa160['shift']());}};_0x44aef7(++_0x16ecd8);}(_0x557d,0x171));var _0xd557=function(_0x31169c,_0xc36bd3){_0x31169c=_0x31169c-0x0;var _0x3a7b4f=_0x557d[_0x31169c];return _0x3a7b4f;};'use strict';var _=require(_0xd557('0x0'));var util=require(_0xd557('0x1'));var moment=require(_0xd557('0x2'));var BPromise=require(_0xd557('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd557('0x4'));var db=require(_0xd557('0x5'))['db'];var utils=require(_0xd557('0x6'));var logger=require(_0xd557('0x7'))(_0xd557('0x8'));var config=require(_0xd557('0x9'));var jayson=require(_0xd557('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5202c9,_0x5408df,_0x5c9a72){return new BPromise(function(_0x14f7ca,_0x4fd0cf){return client[_0xd557('0xb')](_0x5202c9,_0x5c9a72)[_0xd557('0xc')](function(_0x44876b){logger['info'](_0xd557('0xd'),_0x5408df,_0xd557('0xe'));logger['debug'](_0xd557('0xf'),_0x5408df,_0xd557('0xe'),JSON[_0xd557('0x10')](_0x44876b));if(_0x44876b[_0xd557('0x11')]){if(_0x44876b[_0xd557('0x11')]['code']===0x1f4){logger[_0xd557('0x11')](_0xd557('0xd'),_0x5408df,_0x44876b['error'][_0xd557('0x12')]);return _0x4fd0cf(_0x44876b[_0xd557('0x11')][_0xd557('0x12')]);}logger[_0xd557('0x11')](_0xd557('0xd'),_0x5408df,_0x44876b[_0xd557('0x11')]['message']);return _0x14f7ca(_0x44876b[_0xd557('0x11')]['message']);}else{logger['info'](_0xd557('0xd'),_0x5408df,'request\x20sent');_0x14f7ca(_0x44876b[_0xd557('0x13')][_0xd557('0x12')]);}})[_0xd557('0x14')](function(_0x13b24c){logger[_0xd557('0x11')]('AnalyticTreeReport,\x20%s,\x20%s',_0x5408df,_0x13b24c);_0x4fd0cf(_0x13b24c);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 98b3510..00c5b9d 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 _0x2759=['post','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./analyticTreeReport.controller','get','index','isAuthenticated','show'];(function(_0x3a2079,_0x8ef767){var _0x84e28d=function(_0x2425b3){while(--_0x2425b3){_0x3a2079['push'](_0x3a2079['shift']());}};_0x84e28d(++_0x8ef767);}(_0x2759,0xcd));var _0x9275=function(_0x309e57,_0xe1c277){_0x309e57=_0x309e57-0x0;var _0x313c98=_0x2759[_0x309e57];return _0x313c98;};'use strict';var multer=require(_0x9275('0x0'));var util=require(_0x9275('0x1'));var path=require('path');var timeout=require(_0x9275('0x2'));var express=require(_0x9275('0x3'));var router=express[_0x9275('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9275('0x5'));var controller=require(_0x9275('0x6'));router[_0x9275('0x7')]('/',auth['isAuthenticated'](),controller[_0x9275('0x8')]);router['get']('/:id',auth[_0x9275('0x9')](),controller[_0x9275('0xa')]);router[_0x9275('0xb')]('/',auth[_0x9275('0x9')](),controller['create']);router[_0x9275('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x9275('0xd')]);router[_0x9275('0xe')](_0x9275('0xf'),auth[_0x9275('0x9')](),controller[_0x9275('0x10')]);module[_0x9275('0x11')]=router; \ No newline at end of file +var _0x89c5=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','index','/:id','isAuthenticated'];(function(_0x57fa12,_0x4b82fe){var _0x5dae05=function(_0xb88f94){while(--_0xb88f94){_0x57fa12['push'](_0x57fa12['shift']());}};_0x5dae05(++_0x4b82fe);}(_0x89c5,0x126));var _0x589c=function(_0x2bd6c2,_0x554bde){_0x2bd6c2=_0x2bd6c2-0x0;var _0xb6a53=_0x89c5[_0x2bd6c2];return _0xb6a53;};'use strict';var multer=require(_0x589c('0x0'));var util=require('util');var path=require(_0x589c('0x1'));var timeout=require(_0x589c('0x2'));var express=require(_0x589c('0x3'));var router=express[_0x589c('0x4')]();var auth=require(_0x589c('0x5'));var interaction=require(_0x589c('0x6'));var config=require('../../config/environment');var controller=require(_0x589c('0x7'));router[_0x589c('0x8')]('/',auth['isAuthenticated'](),controller[_0x589c('0x9')]);router[_0x589c('0x8')](_0x589c('0xa'),auth[_0x589c('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x589c('0xc')](_0x589c('0xa'),auth[_0x589c('0xb')](),controller[_0x589c('0xd')]);router[_0x589c('0xe')](_0x589c('0xa'),auth['isAuthenticated'](),controller[_0x589c('0xf')]);module[_0x589c('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index a659cf1..dc64406 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 _0xb1ce=['sequelize','exports','STRING'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xb1ce,0x17a));var _0xeb1c=function(_0x5cca9f,_0x154684){_0x5cca9f=_0x5cca9f-0x0;var _0x55edda=_0xb1ce[_0x5cca9f];return _0x55edda;};'use strict';var Sequelize=require(_0xeb1c('0x0'));module[_0xeb1c('0x1')]={'name':{'type':Sequelize[_0xeb1c('0x2')]},'basename':{'type':Sequelize[_0xeb1c('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0607=['STRING','exports'];(function(_0x189daa,_0x310091){var _0x4b0549=function(_0x8ebf51){while(--_0x8ebf51){_0x189daa['push'](_0x189daa['shift']());}};_0x4b0549(++_0x310091);}(_0x0607,0x16b));var _0x7060=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0607[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0x7060('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x7060('0x1')]},'type':{'type':Sequelize[_0x7060('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index d9376f3..5bde69c 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 _0xf0a8=['squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','Attachment','count','include','findAll','rows','catch','show','params','find','includeAll','omit','updatedAt','body','createdAt','create','file','basename','mimetype','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x5dcdec,_0xb9dab9){var _0xc9e5c7=function(_0x31d13d){while(--_0x31d13d){_0x5dcdec['push'](_0x5dcdec['shift']());}};_0xc9e5c7(++_0xb9dab9);}(_0xf0a8,0x1a6));var _0x8f0a=function(_0x14346f,_0x49aa75){_0x14346f=_0x14346f-0x0;var _0x58cd1e=_0xf0a8[_0x14346f];return _0x58cd1e;};'use strict';var pdf=require(_0x8f0a('0x0'));var emlformat=require(_0x8f0a('0x1'));var rimraf=require(_0x8f0a('0x2'));var zipdir=require(_0x8f0a('0x3'));var jsonpatch=require(_0x8f0a('0x4'));var rp=require('request-promise');var moment=require(_0x8f0a('0x5'));var BPromise=require(_0x8f0a('0x6'));var Mustache=require(_0x8f0a('0x7'));var util=require(_0x8f0a('0x8'));var path=require(_0x8f0a('0x9'));var sox=require(_0x8f0a('0xa'));var csv=require(_0x8f0a('0xb'));var ejs=require(_0x8f0a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8f0a('0xd'));var crypto=require(_0x8f0a('0xe'));var jsforce=require(_0x8f0a('0xf'));var deskjs=require(_0x8f0a('0x10'));var toCsv=require(_0x8f0a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8f0a('0x11'));var authService=require(_0x8f0a('0x12'));var qs=require(_0x8f0a('0x13'));var as=require(_0x8f0a('0x14'));var hardwareService=require(_0x8f0a('0x15'));var logger=require(_0x8f0a('0x16'))('api');var utils=require(_0x8f0a('0x17'));var config=require(_0x8f0a('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47c760,_0x1bc73d){_0x1bc73d=_0x1bc73d||0xcc;return function(_0x15329c){if(_0x15329c){return _0x47c760[_0x8f0a('0x19')](_0x1bc73d);}return _0x47c760[_0x8f0a('0x1a')](_0x1bc73d)[_0x8f0a('0x1b')]();};}function respondWithResult(_0x27d93e,_0x7ccccb){_0x7ccccb=_0x7ccccb||0xc8;return function(_0x77b9c8){if(_0x77b9c8){return _0x27d93e['status'](_0x7ccccb)[_0x8f0a('0x1c')](_0x77b9c8);}};}function respondWithFilteredResult(_0x4744ea,_0x2e4c20){return function(_0x50936f){if(_0x50936f){var _0x5dae82=_0x50936f['count'],_0x474842=_0x2e4c20['offset'],_0x399a67=_0x2e4c20['offset']+_0x2e4c20[_0x8f0a('0x1d')],_0x4dd244;if(_0x399a67>=_0x5dae82){_0x399a67=_0x5dae82;_0x4dd244=0xc8;}else{_0x4dd244=0xce;}_0x4744ea['status'](_0x4dd244);return _0x4744ea[_0x8f0a('0x1e')](_0x8f0a('0x1f'),_0x474842+'-'+_0x399a67+'/'+_0x5dae82)['json'](_0x50936f);}return null;};}function patchUpdates(_0x34ec79){return function(_0x3cdff4){try{jsonpatch[_0x8f0a('0x20')](_0x3cdff4,_0x34ec79,!![]);}catch(_0x527c3e){return BPromise['reject'](_0x527c3e);}return _0x3cdff4[_0x8f0a('0x21')]();};}function saveUpdates(_0x26da70,_0x2366be){return function(_0x35c526){if(_0x35c526){return _0x35c526[_0x8f0a('0x22')](_0x26da70)['then'](function(_0x2e353e){return _0x2e353e;});}return null;};}function removeEntity(_0xb39e40,_0x4e6740){return function(_0x3badf4){if(_0x3badf4){return _0x3badf4[_0x8f0a('0x23')]()[_0x8f0a('0x24')](function(){_0xb39e40[_0x8f0a('0x1a')](0xcc)[_0x8f0a('0x1b')]();});}};}function handleEntityNotFound(_0x49e3a0,_0x206a96){return function(_0x5a4550){if(!_0x5a4550){_0x49e3a0[_0x8f0a('0x19')](0x194);}return _0x5a4550;};}function handleError(_0x4530c8,_0x2e7e9f){_0x2e7e9f=_0x2e7e9f||0x1f4;return function(_0x4d7ca9){logger[_0x8f0a('0x25')](_0x4d7ca9[_0x8f0a('0x26')]);if(_0x4d7ca9[_0x8f0a('0x27')]){delete _0x4d7ca9[_0x8f0a('0x27')];}_0x4530c8[_0x8f0a('0x1a')](_0x2e7e9f)[_0x8f0a('0x28')](_0x4d7ca9);};}exports[_0x8f0a('0x29')]=function(_0x31a257,_0x453811){var _0x4c2b92={},_0x456c4c={},_0x3c58c0={'count':0x0,'rows':[]};var _0x572d95=_[_0x8f0a('0x2a')](db['Attachment'][_0x8f0a('0x2b')],function(_0x2107a0){return{'name':_0x2107a0['fieldName'],'type':_0x2107a0[_0x8f0a('0x2c')][_0x8f0a('0x2d')]};});_0x456c4c[_0x8f0a('0x2e')]=_['map'](_0x572d95,_0x8f0a('0x27'));_0x456c4c[_0x8f0a('0x2f')]=_[_0x8f0a('0x30')](_0x31a257[_0x8f0a('0x2f')]);_0x456c4c['filters']=_['intersection'](_0x456c4c[_0x8f0a('0x2e')],_0x456c4c['query']);_0x4c2b92[_0x8f0a('0x31')]=_[_0x8f0a('0x32')](_0x456c4c[_0x8f0a('0x2e')],qs[_0x8f0a('0x33')](_0x31a257[_0x8f0a('0x2f')][_0x8f0a('0x33')]));_0x4c2b92[_0x8f0a('0x31')]=_0x4c2b92[_0x8f0a('0x31')][_0x8f0a('0x34')]?_0x4c2b92[_0x8f0a('0x31')]:_0x456c4c[_0x8f0a('0x2e')];if(!_0x31a257[_0x8f0a('0x2f')][_0x8f0a('0x35')]('nolimit')){_0x4c2b92[_0x8f0a('0x1d')]=qs[_0x8f0a('0x1d')](_0x31a257[_0x8f0a('0x2f')]['limit']);_0x4c2b92[_0x8f0a('0x36')]=qs[_0x8f0a('0x36')](_0x31a257[_0x8f0a('0x2f')][_0x8f0a('0x36')]);}_0x4c2b92[_0x8f0a('0x37')]=qs[_0x8f0a('0x38')](_0x31a257[_0x8f0a('0x2f')][_0x8f0a('0x38')]);_0x4c2b92[_0x8f0a('0x39')]=qs['filters'](_[_0x8f0a('0x3a')](_0x31a257['query'],_0x456c4c[_0x8f0a('0x3b')]),_0x572d95);if(_0x31a257['query'][_0x8f0a('0x3c')]){_0x4c2b92[_0x8f0a('0x39')]=_[_0x8f0a('0x3d')](_0x4c2b92['where'],{'$or':_[_0x8f0a('0x2a')](_0x572d95,function(_0x34ab2c){if(_0x34ab2c['type']!==_0x8f0a('0x3e')){var _0x3d00ff={};_0x3d00ff[_0x34ab2c['name']]={'$like':'%'+_0x31a257['query'][_0x8f0a('0x3c')]+'%'};return _0x3d00ff;}})});}_0x4c2b92=_[_0x8f0a('0x3d')]({},_0x4c2b92,_0x31a257[_0x8f0a('0x3f')]);var _0x1830f9={'where':_0x4c2b92[_0x8f0a('0x39')]};return db[_0x8f0a('0x40')]['count'](_0x1830f9)['then'](function(_0xfb85c7){_0x3c58c0[_0x8f0a('0x41')]=_0xfb85c7;if(_0x31a257[_0x8f0a('0x2f')]['includeAll']){_0x4c2b92[_0x8f0a('0x42')]=[{'all':!![]}];}return db[_0x8f0a('0x40')][_0x8f0a('0x43')](_0x4c2b92);})[_0x8f0a('0x24')](function(_0x2736e3){_0x3c58c0[_0x8f0a('0x44')]=_0x2736e3;return _0x3c58c0;})[_0x8f0a('0x24')](respondWithFilteredResult(_0x453811,_0x4c2b92))[_0x8f0a('0x45')](handleError(_0x453811,null));};exports[_0x8f0a('0x46')]=function(_0x3ae132,_0x32a624){var _0xbdf59={'raw':!![],'where':{'id':_0x3ae132[_0x8f0a('0x47')]['id']}},_0x11a472={};_0x11a472[_0x8f0a('0x2e')]=_[_0x8f0a('0x30')](db['Attachment'][_0x8f0a('0x2b')]);_0x11a472['query']=_['keys'](_0x3ae132[_0x8f0a('0x2f')]);_0x11a472['filters']=_['intersection'](_0x11a472[_0x8f0a('0x2e')],_0x11a472[_0x8f0a('0x2f')]);_0xbdf59[_0x8f0a('0x31')]=_['intersection'](_0x11a472[_0x8f0a('0x2e')],qs[_0x8f0a('0x33')](_0x3ae132[_0x8f0a('0x2f')][_0x8f0a('0x33')]));_0xbdf59[_0x8f0a('0x31')]=_0xbdf59['attributes'][_0x8f0a('0x34')]?_0xbdf59[_0x8f0a('0x31')]:_0x11a472[_0x8f0a('0x2e')];if(_0x3ae132[_0x8f0a('0x2f')]['includeAll']){_0xbdf59[_0x8f0a('0x42')]=[{'all':!![]}];}_0xbdf59=_['merge']({},_0xbdf59,_0x3ae132[_0x8f0a('0x3f')]);return db[_0x8f0a('0x40')][_0x8f0a('0x48')](_0xbdf59)[_0x8f0a('0x24')](handleEntityNotFound(_0x32a624,null))[_0x8f0a('0x24')](respondWithResult(_0x32a624,null))[_0x8f0a('0x45')](handleError(_0x32a624,null));};exports['clone']=function(_0x38290f,_0x1d96c7){var _0x2616b1={'where':{'id':_0x38290f[_0x8f0a('0x47')]['id']}},_0x18fbdd={};_0x18fbdd[_0x8f0a('0x2e')]=_[_0x8f0a('0x30')](db['Attachment'][_0x8f0a('0x2b')]);_0x2616b1[_0x8f0a('0x31')]=_[_0x8f0a('0x32')](_0x18fbdd[_0x8f0a('0x2e')],qs[_0x8f0a('0x33')](_0x38290f[_0x8f0a('0x2f')][_0x8f0a('0x33')]));_0x2616b1[_0x8f0a('0x31')]=_0x2616b1[_0x8f0a('0x31')][_0x8f0a('0x34')]?_0x2616b1[_0x8f0a('0x31')]:_0x18fbdd[_0x8f0a('0x2e')];if(_0x38290f['query'][_0x8f0a('0x49')]){_0x2616b1['include']=[{'all':!![]}];}_0x2616b1=_[_0x8f0a('0x3d')]({},_0x2616b1,_0x38290f[_0x8f0a('0x3f')]);return db[_0x8f0a('0x40')][_0x8f0a('0x48')](_0x2616b1)[_0x8f0a('0x24')](handleEntityNotFound(_0x1d96c7,null))[_0x8f0a('0x24')](function(_0x3459ef){if(_0x3459ef){var _0x93654d=_0x3459ef['get']({'plain':!![]});_0x93654d=qs[_0x8f0a('0x4a')](_0x93654d,['id','createdAt',_0x8f0a('0x4b')]);_0x38290f[_0x8f0a('0x4c')]=_[_0x8f0a('0x4a')](_0x38290f[_0x8f0a('0x4c')],['id',_0x8f0a('0x4d'),_0x8f0a('0x4b')]);return db[_0x8f0a('0x40')]['create'](_[_0x8f0a('0x3d')](_0x93654d,_0x38290f['body']),{'include':_0x38290f[_0x8f0a('0x2f')][_0x8f0a('0x49')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x1d96c7,0xc9))[_0x8f0a('0x45')](handleError(_0x1d96c7,null));};exports[_0x8f0a('0x22')]=function(_0x3a9e6a,_0x4a932f){if(_0x3a9e6a[_0x8f0a('0x4c')]['id']){delete _0x3a9e6a[_0x8f0a('0x4c')]['id'];}return db[_0x8f0a('0x40')][_0x8f0a('0x48')]({'where':{'id':_0x3a9e6a[_0x8f0a('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a932f,null))['then'](saveUpdates(_0x3a9e6a[_0x8f0a('0x4c')],null))['then'](respondWithResult(_0x4a932f,null))['catch'](handleError(_0x4a932f,null));};exports[_0x8f0a('0x23')]=function(_0xe2a799,_0x3c7b64){return db[_0x8f0a('0x40')][_0x8f0a('0x48')]({'where':{'id':_0xe2a799[_0x8f0a('0x47')]['id']}})[_0x8f0a('0x24')](handleEntityNotFound(_0x3c7b64,null))[_0x8f0a('0x24')](removeEntity(_0x3c7b64,null))[_0x8f0a('0x45')](handleError(_0x3c7b64,null));};exports[_0x8f0a('0x4e')]=function(_0x3f1a4c,_0x332240,_0x147618){_0x3f1a4c['body'][_0x8f0a('0x27')]=_0x3f1a4c[_0x8f0a('0x4f')]['originalname'];_0x3f1a4c[_0x8f0a('0x4c')][_0x8f0a('0x50')]=_0x3f1a4c[_0x8f0a('0x4f')]['filename'];_0x3f1a4c[_0x8f0a('0x4c')][_0x8f0a('0x2c')]=_0x3f1a4c[_0x8f0a('0x4f')][_0x8f0a('0x51')];return db[_0x8f0a('0x40')][_0x8f0a('0x4e')](_0x3f1a4c[_0x8f0a('0x4c')])[_0x8f0a('0x24')](respondWithResult(_0x332240,0xc9))['catch'](handleError(_0x332240,null));};exports[_0x8f0a('0x52')]=function(_0x525e00,_0x118726,_0x34e859){return db[_0x8f0a('0x40')][_0x8f0a('0x53')]({'where':{'id':_0x525e00[_0x8f0a('0x47')]['id']},'raw':!![]})[_0x8f0a('0x24')](handleEntityNotFound(_0x118726,null))['then'](function(_0x6e5381){if(_0x6e5381){return _0x118726['download'](path[_0x8f0a('0x54')](config[_0x8f0a('0x55')],_0x8f0a('0x56'),_0x6e5381[_0x8f0a('0x50')]));}})[_0x8f0a('0x45')](handleError(_0x118726,null));}; \ No newline at end of file +var _0xdc38=['error','stack','name','index','map','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','Attachment','count','include','rows','catch','show','params','includeAll','clone','get','omit','createdAt','updatedAt','body','find','create','originalname','basename','file','filename','mimetype','download','findOne','root','server/files/attachments/','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','apply','reject','save','update','then','destroy','end'];(function(_0x687ddc,_0x2092fa){var _0x441991=function(_0x49c6a6){while(--_0x49c6a6){_0x687ddc['push'](_0x687ddc['shift']());}};_0x441991(++_0x2092fa);}(_0xdc38,0x80));var _0x8dc3=function(_0x47a60d,_0x4dabc1){_0x47a60d=_0x47a60d-0x0;var _0x1736ee=_0xdc38[_0x47a60d];return _0x1736ee;};'use strict';var pdf=require(_0x8dc3('0x0'));var emlformat=require(_0x8dc3('0x1'));var rimraf=require(_0x8dc3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8dc3('0x3'));var rp=require('request-promise');var moment=require(_0x8dc3('0x4'));var BPromise=require(_0x8dc3('0x5'));var Mustache=require(_0x8dc3('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8dc3('0x7'));var csv=require(_0x8dc3('0x8'));var ejs=require(_0x8dc3('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8dc3('0xa'));var crypto=require('crypto');var jsforce=require(_0x8dc3('0xb'));var deskjs=require(_0x8dc3('0xc'));var toCsv=require(_0x8dc3('0x8'));var querystring=require(_0x8dc3('0xd'));var Papa=require(_0x8dc3('0xe'));var Redis=require(_0x8dc3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8dc3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dc3('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8dc3('0x12'));var db=require(_0x8dc3('0x13'))['db'];function respondWithStatusCode(_0x140f1e,_0x1a7ce8){_0x1a7ce8=_0x1a7ce8||0xcc;return function(_0x29d0b7){if(_0x29d0b7){return _0x140f1e[_0x8dc3('0x14')](_0x1a7ce8);}return _0x140f1e[_0x8dc3('0x15')](_0x1a7ce8)['end']();};}function respondWithResult(_0x4c78c4,_0x3dc994){_0x3dc994=_0x3dc994||0xc8;return function(_0x5186fd){if(_0x5186fd){return _0x4c78c4[_0x8dc3('0x15')](_0x3dc994)[_0x8dc3('0x16')](_0x5186fd);}};}function respondWithFilteredResult(_0x549c11,_0x3849e3){return function(_0x1d44aa){if(_0x1d44aa){var _0x340ce2=_0x1d44aa['count'],_0x1400a7=_0x3849e3['offset'],_0x4d09e9=_0x3849e3[_0x8dc3('0x17')]+_0x3849e3[_0x8dc3('0x18')],_0x3e020e;if(_0x4d09e9>=_0x340ce2){_0x4d09e9=_0x340ce2;_0x3e020e=0xc8;}else{_0x3e020e=0xce;}_0x549c11[_0x8dc3('0x15')](_0x3e020e);return _0x549c11['set']('Content-Range',_0x1400a7+'-'+_0x4d09e9+'/'+_0x340ce2)['json'](_0x1d44aa);}return null;};}function patchUpdates(_0x5609d4){return function(_0x117345){try{jsonpatch[_0x8dc3('0x19')](_0x117345,_0x5609d4,!![]);}catch(_0x3f9850){return BPromise[_0x8dc3('0x1a')](_0x3f9850);}return _0x117345[_0x8dc3('0x1b')]();};}function saveUpdates(_0x8aa071,_0x4eb740){return function(_0x29ca48){if(_0x29ca48){return _0x29ca48[_0x8dc3('0x1c')](_0x8aa071)[_0x8dc3('0x1d')](function(_0x41aabc){return _0x41aabc;});}return null;};}function removeEntity(_0x251261,_0x1fcd73){return function(_0x417e12){if(_0x417e12){return _0x417e12[_0x8dc3('0x1e')]()['then'](function(){_0x251261[_0x8dc3('0x15')](0xcc)[_0x8dc3('0x1f')]();});}};}function handleEntityNotFound(_0x225340,_0x52178b){return function(_0x1c6436){if(!_0x1c6436){_0x225340[_0x8dc3('0x14')](0x194);}return _0x1c6436;};}function handleError(_0x2e9a90,_0x54c963){_0x54c963=_0x54c963||0x1f4;return function(_0xbda823){logger[_0x8dc3('0x20')](_0xbda823[_0x8dc3('0x21')]);if(_0xbda823[_0x8dc3('0x22')]){delete _0xbda823[_0x8dc3('0x22')];}_0x2e9a90[_0x8dc3('0x15')](_0x54c963)['send'](_0xbda823);};}exports[_0x8dc3('0x23')]=function(_0x59df26,_0x1f1fa9){var _0x330230={},_0x540558={},_0x11d2a3={'count':0x0,'rows':[]};var _0xa72e29=_[_0x8dc3('0x24')](db['Attachment'][_0x8dc3('0x25')],function(_0x1f77a3){return{'name':_0x1f77a3['fieldName'],'type':_0x1f77a3[_0x8dc3('0x26')]['key']};});_0x540558[_0x8dc3('0x27')]=_[_0x8dc3('0x24')](_0xa72e29,'name');_0x540558['query']=_[_0x8dc3('0x28')](_0x59df26[_0x8dc3('0x29')]);_0x540558['filters']=_[_0x8dc3('0x2a')](_0x540558[_0x8dc3('0x27')],_0x540558[_0x8dc3('0x29')]);_0x330230[_0x8dc3('0x2b')]=_['intersection'](_0x540558['model'],qs[_0x8dc3('0x2c')](_0x59df26[_0x8dc3('0x29')][_0x8dc3('0x2c')]));_0x330230[_0x8dc3('0x2b')]=_0x330230[_0x8dc3('0x2b')][_0x8dc3('0x2d')]?_0x330230[_0x8dc3('0x2b')]:_0x540558['model'];if(!_0x59df26[_0x8dc3('0x29')]['hasOwnProperty'](_0x8dc3('0x2e'))){_0x330230[_0x8dc3('0x18')]=qs[_0x8dc3('0x18')](_0x59df26['query'][_0x8dc3('0x18')]);_0x330230[_0x8dc3('0x17')]=qs[_0x8dc3('0x17')](_0x59df26['query']['offset']);}_0x330230['order']=qs['sort'](_0x59df26[_0x8dc3('0x29')][_0x8dc3('0x2f')]);_0x330230[_0x8dc3('0x30')]=qs[_0x8dc3('0x31')](_[_0x8dc3('0x32')](_0x59df26[_0x8dc3('0x29')],_0x540558[_0x8dc3('0x31')]),_0xa72e29);if(_0x59df26[_0x8dc3('0x29')][_0x8dc3('0x33')]){_0x330230[_0x8dc3('0x30')]=_[_0x8dc3('0x34')](_0x330230[_0x8dc3('0x30')],{'$or':_[_0x8dc3('0x24')](_0xa72e29,function(_0x100127){if(_0x100127[_0x8dc3('0x26')]!==_0x8dc3('0x35')){var _0x59ccd4={};_0x59ccd4[_0x100127['name']]={'$like':'%'+_0x59df26[_0x8dc3('0x29')][_0x8dc3('0x33')]+'%'};return _0x59ccd4;}})});}_0x330230=_[_0x8dc3('0x34')]({},_0x330230,_0x59df26[_0x8dc3('0x36')]);var _0x225410={'where':_0x330230[_0x8dc3('0x30')]};return db[_0x8dc3('0x37')][_0x8dc3('0x38')](_0x225410)[_0x8dc3('0x1d')](function(_0x6949f1){_0x11d2a3[_0x8dc3('0x38')]=_0x6949f1;if(_0x59df26[_0x8dc3('0x29')]['includeAll']){_0x330230[_0x8dc3('0x39')]=[{'all':!![]}];}return db[_0x8dc3('0x37')]['findAll'](_0x330230);})[_0x8dc3('0x1d')](function(_0x33d558){_0x11d2a3[_0x8dc3('0x3a')]=_0x33d558;return _0x11d2a3;})[_0x8dc3('0x1d')](respondWithFilteredResult(_0x1f1fa9,_0x330230))[_0x8dc3('0x3b')](handleError(_0x1f1fa9,null));};exports[_0x8dc3('0x3c')]=function(_0xc6d622,_0x74db9f){var _0x1e6414={'raw':!![],'where':{'id':_0xc6d622[_0x8dc3('0x3d')]['id']}},_0x2f1488={};_0x2f1488[_0x8dc3('0x27')]=_[_0x8dc3('0x28')](db[_0x8dc3('0x37')]['rawAttributes']);_0x2f1488[_0x8dc3('0x29')]=_[_0x8dc3('0x28')](_0xc6d622[_0x8dc3('0x29')]);_0x2f1488[_0x8dc3('0x31')]=_[_0x8dc3('0x2a')](_0x2f1488['model'],_0x2f1488['query']);_0x1e6414[_0x8dc3('0x2b')]=_[_0x8dc3('0x2a')](_0x2f1488[_0x8dc3('0x27')],qs[_0x8dc3('0x2c')](_0xc6d622[_0x8dc3('0x29')][_0x8dc3('0x2c')]));_0x1e6414[_0x8dc3('0x2b')]=_0x1e6414['attributes'][_0x8dc3('0x2d')]?_0x1e6414['attributes']:_0x2f1488[_0x8dc3('0x27')];if(_0xc6d622[_0x8dc3('0x29')][_0x8dc3('0x3e')]){_0x1e6414[_0x8dc3('0x39')]=[{'all':!![]}];}_0x1e6414=_['merge']({},_0x1e6414,_0xc6d622[_0x8dc3('0x36')]);return db['Attachment']['find'](_0x1e6414)[_0x8dc3('0x1d')](handleEntityNotFound(_0x74db9f,null))['then'](respondWithResult(_0x74db9f,null))[_0x8dc3('0x3b')](handleError(_0x74db9f,null));};exports[_0x8dc3('0x3f')]=function(_0x346119,_0x5c2d5f){var _0x56f861={'where':{'id':_0x346119['params']['id']}},_0x427246={};_0x427246['model']=_[_0x8dc3('0x28')](db[_0x8dc3('0x37')][_0x8dc3('0x25')]);_0x56f861[_0x8dc3('0x2b')]=_[_0x8dc3('0x2a')](_0x427246[_0x8dc3('0x27')],qs[_0x8dc3('0x2c')](_0x346119[_0x8dc3('0x29')]['fields']));_0x56f861['attributes']=_0x56f861[_0x8dc3('0x2b')][_0x8dc3('0x2d')]?_0x56f861['attributes']:_0x427246['model'];if(_0x346119[_0x8dc3('0x29')][_0x8dc3('0x3e')]){_0x56f861[_0x8dc3('0x39')]=[{'all':!![]}];}_0x56f861=_[_0x8dc3('0x34')]({},_0x56f861,_0x346119['options']);return db[_0x8dc3('0x37')]['find'](_0x56f861)[_0x8dc3('0x1d')](handleEntityNotFound(_0x5c2d5f,null))[_0x8dc3('0x1d')](function(_0x487206){if(_0x487206){var _0x316ed5=_0x487206[_0x8dc3('0x40')]({'plain':!![]});_0x316ed5=qs[_0x8dc3('0x41')](_0x316ed5,['id',_0x8dc3('0x42'),_0x8dc3('0x43')]);_0x346119[_0x8dc3('0x44')]=_[_0x8dc3('0x41')](_0x346119[_0x8dc3('0x44')],['id',_0x8dc3('0x42'),'updatedAt']);return db[_0x8dc3('0x37')]['create'](_[_0x8dc3('0x34')](_0x316ed5,_0x346119['body']),{'include':_0x346119[_0x8dc3('0x29')][_0x8dc3('0x3e')]?[{'all':!![]}]:undefined});}})[_0x8dc3('0x1d')](respondWithResult(_0x5c2d5f,0xc9))['catch'](handleError(_0x5c2d5f,null));};exports[_0x8dc3('0x1c')]=function(_0x4f5434,_0x47424f){if(_0x4f5434[_0x8dc3('0x44')]['id']){delete _0x4f5434['body']['id'];}return db[_0x8dc3('0x37')][_0x8dc3('0x45')]({'where':{'id':_0x4f5434[_0x8dc3('0x3d')]['id']}})[_0x8dc3('0x1d')](handleEntityNotFound(_0x47424f,null))[_0x8dc3('0x1d')](saveUpdates(_0x4f5434[_0x8dc3('0x44')],null))['then'](respondWithResult(_0x47424f,null))[_0x8dc3('0x3b')](handleError(_0x47424f,null));};exports[_0x8dc3('0x1e')]=function(_0x2240e3,_0x3e54c4){return db[_0x8dc3('0x37')]['find']({'where':{'id':_0x2240e3[_0x8dc3('0x3d')]['id']}})[_0x8dc3('0x1d')](handleEntityNotFound(_0x3e54c4,null))[_0x8dc3('0x1d')](removeEntity(_0x3e54c4,null))[_0x8dc3('0x3b')](handleError(_0x3e54c4,null));};exports[_0x8dc3('0x46')]=function(_0x4b6431,_0x436d4d,_0x2fc1f0){_0x4b6431[_0x8dc3('0x44')][_0x8dc3('0x22')]=_0x4b6431['file'][_0x8dc3('0x47')];_0x4b6431[_0x8dc3('0x44')][_0x8dc3('0x48')]=_0x4b6431[_0x8dc3('0x49')][_0x8dc3('0x4a')];_0x4b6431[_0x8dc3('0x44')]['type']=_0x4b6431[_0x8dc3('0x49')][_0x8dc3('0x4b')];return db['Attachment'][_0x8dc3('0x46')](_0x4b6431[_0x8dc3('0x44')])[_0x8dc3('0x1d')](respondWithResult(_0x436d4d,0xc9))[_0x8dc3('0x3b')](handleError(_0x436d4d,null));};exports[_0x8dc3('0x4c')]=function(_0x41af55,_0xebc6e0,_0x3b29b1){return db['Attachment'][_0x8dc3('0x4d')]({'where':{'id':_0x41af55[_0x8dc3('0x3d')]['id']},'raw':!![]})[_0x8dc3('0x1d')](handleEntityNotFound(_0xebc6e0,null))['then'](function(_0x50cd39){if(_0x50cd39){return _0xebc6e0[_0x8dc3('0x4c')](path['join'](config[_0x8dc3('0x4e')],_0x8dc3('0x4f'),_0x50cd39[_0x8dc3('0x48')]));}})[_0x8dc3('0x3b')](handleError(_0xebc6e0,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index f6ac28b..c81c28d 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 _0x4808=['exports','Attachment','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./attachment.attributes'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4808,0x160));var _0x8480=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x4808[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x8480('0x0'));var util=require(_0x8480('0x1'));var logger=require(_0x8480('0x2'))('api');var moment=require(_0x8480('0x3'));var BPromise=require('bluebird');var rp=require(_0x8480('0x4'));var fs=require('fs');var path=require(_0x8480('0x5'));var rimraf=require(_0x8480('0x6'));var config=require('../../config/environment');var attributes=require(_0x8480('0x7'));module[_0x8480('0x8')]=function(_0x59f549,_0x211def){return _0x59f549['define'](_0x8480('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc648=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','attachments','util'];(function(_0x749a29,_0x3882da){var _0x523dde=function(_0x54f8cd){while(--_0x54f8cd){_0x749a29['push'](_0x749a29['shift']());}};_0x523dde(++_0x3882da);}(_0xc648,0x171));var _0x8c64=function(_0xaf7da6,_0xa27552){_0xaf7da6=_0xaf7da6-0x0;var _0x68e4c=_0xc648[_0xaf7da6];return _0x68e4c;};'use strict';var _=require('lodash');var util=require(_0x8c64('0x0'));var logger=require(_0x8c64('0x1'))(_0x8c64('0x2'));var moment=require(_0x8c64('0x3'));var BPromise=require(_0x8c64('0x4'));var rp=require(_0x8c64('0x5'));var fs=require('fs');var path=require(_0x8c64('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x8c64('0x7')]=function(_0x449786,_0xb31493){return _0x449786[_0x8c64('0x8')]('Attachment',attributes,{'tableName':_0x8c64('0x9'),'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 13b1d88..b4d4385 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 _0xdb96=['moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateAttachment','Attachment','create','raw'];(function(_0x100848,_0x5918b5){var _0x31dc25=function(_0x2adf8e){while(--_0x2adf8e){_0x100848['push'](_0x100848['shift']());}};_0x31dc25(++_0x5918b5);}(_0xdb96,0x1e0));var _0x6db9=function(_0x2ad665,_0x228972){_0x2ad665=_0x2ad665-0x0;var _0x561be0=_0xdb96[_0x2ad665];return _0x561be0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6db9('0x0'));var BPromise=require('bluebird');var rs=require(_0x6db9('0x1'));var fs=require('fs');var Redis=require(_0x6db9('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6db9('0x3'))(_0x6db9('0x4'));var config=require(_0x6db9('0x5'));var jayson=require(_0x6db9('0x6'));var client=jayson[_0x6db9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x575295,_0x3c8c72,_0x26c747){return new BPromise(function(_0x136853,_0x469bed){return client[_0x6db9('0x8')](_0x575295,_0x26c747)[_0x6db9('0x9')](function(_0x3b5cc8){logger['info'](_0x6db9('0xa'),_0x3c8c72,'request\x20sent');logger[_0x6db9('0xb')](_0x6db9('0xc'),_0x3c8c72,_0x6db9('0xd'),JSON[_0x6db9('0xe')](_0x3b5cc8));if(_0x3b5cc8[_0x6db9('0xf')]){if(_0x3b5cc8[_0x6db9('0xf')][_0x6db9('0x10')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x3c8c72,_0x3b5cc8[_0x6db9('0xf')]['message']);return _0x469bed(_0x3b5cc8['error'][_0x6db9('0x11')]);}logger[_0x6db9('0xf')](_0x6db9('0xa'),_0x3c8c72,_0x3b5cc8[_0x6db9('0xf')][_0x6db9('0x11')]);return _0x136853(_0x3b5cc8[_0x6db9('0xf')][_0x6db9('0x11')]);}else{logger[_0x6db9('0x12')](_0x6db9('0xa'),_0x3c8c72,_0x6db9('0xd'));_0x136853(_0x3b5cc8['result'][_0x6db9('0x11')]);}})[_0x6db9('0x13')](function(_0x29aab6){logger[_0x6db9('0xf')](_0x6db9('0xa'),_0x3c8c72,_0x29aab6);_0x469bed(_0x29aab6);});});}exports[_0x6db9('0x14')]=function(_0x3038dd){var _0x377313=this;return new Promise(function(_0x43d704,_0x131152){return db[_0x6db9('0x15')][_0x6db9('0x16')](_0x3038dd['body'],{'raw':_0x3038dd['options']?_0x3038dd['options'][_0x6db9('0x17')]===undefined?!![]:![]:!![]})[_0x6db9('0x9')](function(_0x5eda86){logger['info']('CreateAttachment',_0x3038dd);logger[_0x6db9('0xb')]('CreateAttachment',_0x3038dd,JSON[_0x6db9('0xe')](_0x5eda86));_0x43d704(_0x5eda86);})[_0x6db9('0x13')](function(_0x2858ea){logger['error'](_0x6db9('0x14'),_0x2858ea[_0x6db9('0x11')],_0x3038dd);_0x131152(_0x377313[_0x6db9('0xf')](0x1f4,_0x2858ea[_0x6db9('0x11')]));});});}; \ No newline at end of file +var _0xf177=['client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Attachment','create','body','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xf177,0x1b5));var _0x7f17=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf177[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x7f17('0x0'));var util=require(_0x7f17('0x1'));var moment=require(_0x7f17('0x2'));var BPromise=require(_0x7f17('0x3'));var rs=require(_0x7f17('0x4'));var fs=require('fs');var Redis=require(_0x7f17('0x5'));var db=require(_0x7f17('0x6'))['db'];var utils=require(_0x7f17('0x7'));var logger=require(_0x7f17('0x8'))(_0x7f17('0x9'));var config=require('../../config/environment');var jayson=require(_0x7f17('0xa'));var client=jayson[_0x7f17('0xb')][_0x7f17('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c09a7,_0x52093f,_0x4acda5){return new BPromise(function(_0x56fbe4,_0x3712c9){return client[_0x7f17('0xd')](_0x5c09a7,_0x4acda5)[_0x7f17('0xe')](function(_0x215ce7){logger[_0x7f17('0xf')](_0x7f17('0x10'),_0x52093f,_0x7f17('0x11'));logger[_0x7f17('0x12')](_0x7f17('0x13'),_0x52093f,_0x7f17('0x11'),JSON[_0x7f17('0x14')](_0x215ce7));if(_0x215ce7[_0x7f17('0x15')]){if(_0x215ce7[_0x7f17('0x15')][_0x7f17('0x16')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x52093f,_0x215ce7['error'][_0x7f17('0x17')]);return _0x3712c9(_0x215ce7['error']['message']);}logger[_0x7f17('0x15')]('Attachment,\x20%s,\x20%s',_0x52093f,_0x215ce7[_0x7f17('0x15')][_0x7f17('0x17')]);return _0x56fbe4(_0x215ce7[_0x7f17('0x15')][_0x7f17('0x17')]);}else{logger[_0x7f17('0xf')]('Attachment,\x20%s,\x20%s',_0x52093f,_0x7f17('0x11'));_0x56fbe4(_0x215ce7[_0x7f17('0x18')][_0x7f17('0x17')]);}})[_0x7f17('0x19')](function(_0x275aa2){logger[_0x7f17('0x15')]('Attachment,\x20%s,\x20%s',_0x52093f,_0x275aa2);_0x3712c9(_0x275aa2);});});}exports['CreateAttachment']=function(_0x403e30){var _0xb5227e=this;return new Promise(function(_0x475295,_0x385f48){return db[_0x7f17('0x1a')][_0x7f17('0x1b')](_0x403e30[_0x7f17('0x1c')],{'raw':_0x403e30['options']?_0x403e30[_0x7f17('0x1d')][_0x7f17('0x1e')]===undefined?!![]:![]:!![]})[_0x7f17('0xe')](function(_0x134baa){logger[_0x7f17('0xf')](_0x7f17('0x1f'),_0x403e30);logger[_0x7f17('0x12')](_0x7f17('0x1f'),_0x403e30,JSON[_0x7f17('0x14')](_0x134baa));_0x475295(_0x134baa);})[_0x7f17('0x19')](function(_0x33ee7e){logger[_0x7f17('0x15')]('CreateAttachment',_0x33ee7e[_0x7f17('0x17')],_0x403e30);_0x385f48(_0xb5227e[_0x7f17('0x15')](0x1f4,_0x33ee7e[_0x7f17('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 438b3c8..8168e37 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 _0xea63=['/:id/download','download','post','/:id/clone','diskStorage','join','root','format','now','single','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x4923ae,_0x5ad93e){var _0x3fce36=function(_0x4d3962){while(--_0x4d3962){_0x4923ae['push'](_0x4923ae['shift']());}};_0x3fce36(++_0x5ad93e);}(_0xea63,0x138));var _0x3ea6=function(_0x3e9600,_0x24b891){_0x3e9600=_0x3e9600-0x0;var _0x332cfd=_0xea63[_0x3e9600];return _0x332cfd;};'use strict';var multer=require(_0x3ea6('0x0'));var util=require(_0x3ea6('0x1'));var path=require('path');var timeout=require(_0x3ea6('0x2'));var express=require(_0x3ea6('0x3'));var router=express[_0x3ea6('0x4')]();var auth=require(_0x3ea6('0x5'));var interaction=require(_0x3ea6('0x6'));var config=require(_0x3ea6('0x7'));var controller=require('./attachment.controller');router[_0x3ea6('0x8')]('/',auth[_0x3ea6('0x9')](),controller[_0x3ea6('0xa')]);router[_0x3ea6('0x8')](_0x3ea6('0xb'),auth[_0x3ea6('0x9')](),controller['show']);router['get'](_0x3ea6('0xc'),auth[_0x3ea6('0x9')](),controller[_0x3ea6('0xd')]);router[_0x3ea6('0xe')](_0x3ea6('0xf'),auth[_0x3ea6('0x9')](),controller['clone']);var upload=multer({'storage':multer[_0x3ea6('0x10')]({'destination':function(_0x1dd45d,_0x2c91ed,_0x22afe1){_0x22afe1(null,path[_0x3ea6('0x11')](config[_0x3ea6('0x12')],'server/files/attachments/'));},'filename':function(_0x4b96d1,_0x168af2,_0x457968){_0x457968(null,util[_0x3ea6('0x13')]('%s-%s',Date[_0x3ea6('0x14')](),_0x168af2['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x3ea6('0x15')]('file'),controller[_0x3ea6('0x16')]);router[_0x3ea6('0x17')]('/:id',auth[_0x3ea6('0x9')](),controller['update']);router[_0x3ea6('0x18')]('/:id',auth[_0x3ea6('0x9')](),controller[_0x3ea6('0x19')]);module[_0x3ea6('0x1a')]=router; \ No newline at end of file +var _0x26b2=['server/files/attachments/','format','now','originalname','replace','file','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','/:id/clone','clone','diskStorage','root'];(function(_0x2841ce,_0x565ec5){var _0x2b7eb8=function(_0x4b69bc){while(--_0x4b69bc){_0x2841ce['push'](_0x2841ce['shift']());}};_0x2b7eb8(++_0x565ec5);}(_0x26b2,0xc5));var _0x226b=function(_0x1b2e47,_0x17f19b){_0x1b2e47=_0x1b2e47-0x0;var _0x55d14d=_0x26b2[_0x1b2e47];return _0x55d14d;};'use strict';var multer=require(_0x226b('0x0'));var util=require(_0x226b('0x1'));var path=require(_0x226b('0x2'));var timeout=require('connect-timeout');var express=require(_0x226b('0x3'));var router=express[_0x226b('0x4')]();var auth=require(_0x226b('0x5'));var interaction=require(_0x226b('0x6'));var config=require(_0x226b('0x7'));var controller=require(_0x226b('0x8'));router[_0x226b('0x9')]('/',auth[_0x226b('0xa')](),controller[_0x226b('0xb')]);router['get'](_0x226b('0xc'),auth['isAuthenticated'](),controller[_0x226b('0xd')]);router[_0x226b('0x9')](_0x226b('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x226b('0xf')](_0x226b('0x10'),auth[_0x226b('0xa')](),controller[_0x226b('0x11')]);var upload=multer({'storage':multer[_0x226b('0x12')]({'destination':function(_0x346b25,_0x534a58,_0x3927c2){_0x3927c2(null,path['join'](config[_0x226b('0x13')],_0x226b('0x14')));},'filename':function(_0x150a38,_0x13e225,_0x21b041){_0x21b041(null,util[_0x226b('0x15')]('%s-%s',Date[_0x226b('0x16')](),_0x13e225[_0x226b('0x17')][_0x226b('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x226b('0xf')]('/',upload['single'](_0x226b('0x19')),controller[_0x226b('0x1a')]);router[_0x226b('0x1b')](_0x226b('0xc'),auth[_0x226b('0xa')](),controller[_0x226b('0x1c')]);router['delete'](_0x226b('0xc'),auth[_0x226b('0xa')](),controller[_0x226b('0x1d')]);module[_0x226b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index bea689d..82827e8 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 _0x0fd6=['callbackURL','Setting','allowedLoginAttempts','then','User','find','map','emails','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','clearBlockUser','getLicense','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','authenticate','google','/login','email','callback','use','clientSecret','secret'];(function(_0x30ff71,_0x494152){var _0x51ade9=function(_0x3f718f){while(--_0x3f718f){_0x30ff71['push'](_0x30ff71['shift']());}};_0x51ade9(++_0x494152);}(_0x0fd6,0xec));var _0x60fd=function(_0x2028c7,_0xf0d96f){_0x2028c7=_0x2028c7-0x0;var _0x164981=_0x0fd6[_0x2028c7];return _0x164981;};'use strict';var _=require('lodash');var passport=require(_0x60fd('0x0'));var GoogleStrategy=require(_0x60fd('0x1'))[_0x60fd('0x2')];var moment=require('moment');var db=require(_0x60fd('0x3'))['db'];var config=require(_0x60fd('0x4'));var signToken=require(_0x60fd('0x5'))['signToken'];var utils=require(_0x60fd('0x6'));exports[_0x60fd('0x7')]=passport[_0x60fd('0x8')](_0x60fd('0x9'),{'failureRedirect':_0x60fd('0xa'),'scope':['profile',_0x60fd('0xb')],'session':![]});exports[_0x60fd('0xc')]=passport[_0x60fd('0x8')](_0x60fd('0x9'),{'failureRedirect':'/login','session':![]});passport[_0x60fd('0xd')](new GoogleStrategy({'clientID':config[_0x60fd('0x9')]?config[_0x60fd('0x9')]['clientID']:'id','clientSecret':config[_0x60fd('0x9')]?config[_0x60fd('0x9')][_0x60fd('0xe')]:_0x60fd('0xf'),'callbackURL':config[_0x60fd('0x9')]?config[_0x60fd('0x9')][_0x60fd('0x10')]:''},function(_0xfbeefb,_0x6db2f0,_0x114ecb,_0x1a60a0){var _0x3fd653,_0x1abc19;return db[_0x60fd('0x11')]['findOne']({'where':{'id':0x1},'attributes':[_0x60fd('0x12'),'blockDuration'],'raw':!![]})[_0x60fd('0x13')](function(_0x161f7a){_0x3fd653=_0x161f7a;return db[_0x60fd('0x14')][_0x60fd('0x15')]({'where':{'email':_[_0x60fd('0x16')](_0x114ecb[_0x60fd('0x17')],_0x60fd('0x18')),'role':{'$or':[_0x60fd('0x19'),_0x60fd('0x1a'),_0x60fd('0x1b')]}}});})[_0x60fd('0x13')](function(_0x321198){_0x1abc19=_0x321198;if(_0x1abc19){if(_0x1abc19[_0x60fd('0x1c')]){return _0x1a60a0(_0x60fd('0x1d'));}else if(_0x3fd653[_0x60fd('0x1e')]>0x0){if(_0x1abc19[_0x60fd('0x1f')]){if(moment(_0x1abc19[_0x60fd('0x20')])[_0x60fd('0x21')](_0x3fd653[_0x60fd('0x1e')],'minutes')>moment()){return _0x1a60a0(_0x60fd('0x1d'));}else{return utils[_0x60fd('0x22')](_0x1abc19,0x0,![],null)[_0x60fd('0x13')](function(){return utils[_0x60fd('0x23')](_0x1abc19);})[_0x60fd('0x13')](function(){return _0x1a60a0(null,_0x1abc19);});}}else{return utils[_0x60fd('0x23')](_0x1abc19)['then'](function(){return _0x1a60a0(null,_0x1abc19);});}}else{return utils[_0x60fd('0x23')](_0x1abc19)[_0x60fd('0x13')](function(){return _0x1a60a0(null,_0x1abc19);});}}return _0x1a60a0(_0x60fd('0x1d'));})['catch'](function(_0x2bef35){_0x1a60a0(_0x2bef35);});})); \ No newline at end of file +var _0x8685=['secret','callbackURL','Setting','findOne','blockDuration','then','map','emails','admin','user','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','signToken','login','authenticate','google','callback','/login','clientSecret'];(function(_0x562914,_0x5d1db2){var _0x5306ec=function(_0x3a7e87){while(--_0x3a7e87){_0x562914['push'](_0x562914['shift']());}};_0x5306ec(++_0x5d1db2);}(_0x8685,0x8d));var _0x5868=function(_0x2f04b3,_0x2abf19){_0x2f04b3=_0x2f04b3-0x0;var _0x391a02=_0x8685[_0x2f04b3];return _0x391a02;};'use strict';var _=require(_0x5868('0x0'));var passport=require(_0x5868('0x1'));var GoogleStrategy=require(_0x5868('0x2'))[_0x5868('0x3')];var moment=require(_0x5868('0x4'));var db=require(_0x5868('0x5'))['db'];var config=require(_0x5868('0x6'));var signToken=require('../../components/auth/service')[_0x5868('0x7')];var utils=require('../../config/utils');exports[_0x5868('0x8')]=passport[_0x5868('0x9')](_0x5868('0xa'),{'failureRedirect':'/login','scope':['profile','email'],'session':![]});exports[_0x5868('0xb')]=passport['authenticate'](_0x5868('0xa'),{'failureRedirect':_0x5868('0xc'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x5868('0xa')]?config[_0x5868('0xa')]['clientID']:'id','clientSecret':config[_0x5868('0xa')]?config['google'][_0x5868('0xd')]:_0x5868('0xe'),'callbackURL':config[_0x5868('0xa')]?config['google'][_0x5868('0xf')]:''},function(_0x54bdc7,_0x260c05,_0x2b7493,_0x4b490e){var _0x5bf3a5,_0x3683d6;return db[_0x5868('0x10')][_0x5868('0x11')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x5868('0x12')],'raw':!![]})[_0x5868('0x13')](function(_0x3adc55){_0x5bf3a5=_0x3adc55;return db['User']['find']({'where':{'email':_[_0x5868('0x14')](_0x2b7493[_0x5868('0x15')],'value'),'role':{'$or':[_0x5868('0x16'),_0x5868('0x17'),'agent']}}});})['then'](function(_0x2d9b9d){_0x3683d6=_0x2d9b9d;if(_0x3683d6){if(_0x3683d6[_0x5868('0x18')]){return _0x4b490e(_0x5868('0x19'));}else if(_0x5bf3a5[_0x5868('0x12')]>0x0){if(_0x3683d6['blocked']){if(moment(_0x3683d6['blockedAt'])[_0x5868('0x1a')](_0x5bf3a5[_0x5868('0x12')],_0x5868('0x1b'))>moment()){return _0x4b490e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x5868('0x1c')](_0x3683d6,0x0,![],null)[_0x5868('0x13')](function(){return utils[_0x5868('0x1d')](_0x3683d6);})['then'](function(){return _0x4b490e(null,_0x3683d6);});}}else{return utils['getLicense'](_0x3683d6)[_0x5868('0x13')](function(){return _0x4b490e(null,_0x3683d6);});}}else{return utils[_0x5868('0x1d')](_0x3683d6)[_0x5868('0x13')](function(){return _0x4b490e(null,_0x3683d6);});}}return _0x4b490e(_0x5868('0x19'));})[_0x5868('0x1e')](function(_0x3d9914){_0x4b490e(_0x3d9914);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 2de9f1b..ddd8f08 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 _0xaced=['../user/user.controller.js','get','login','/callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller'];(function(_0xdb6161,_0x1f29e0){var _0x4e91a0=function(_0x3f9cc3){while(--_0x3f9cc3){_0xdb6161['push'](_0xdb6161['shift']());}};_0x4e91a0(++_0x1f29e0);}(_0xaced,0x18c));var _0xdace=function(_0x11ba48,_0x9fcdfc){_0x11ba48=_0x11ba48-0x0;var _0x35ccab=_0xaced[_0x11ba48];return _0x35ccab;};'use strict';var express=require(_0xdace('0x0'));var passport=require(_0xdace('0x1'));var router=express[_0xdace('0x2')]();var controller=require(_0xdace('0x3'));var userController=require(_0xdace('0x4'));var authService=require('../../components/auth/service');router[_0xdace('0x5')]('/',controller[_0xdace('0x6')]);router[_0xdace('0x5')](_0xdace('0x7'),controller['callback'],authService[_0xdace('0x8')],userController['login'],authService['setTokenCookie']);module[_0xdace('0x9')]=router; \ No newline at end of file +var _0x2bdb=['../../components/auth/service','get','/callback','callback','isMiddleware','login','setTokenCookie','exports','express','Router','../user/user.controller.js'];(function(_0x1bbcd4,_0x3ed594){var _0x5a3f32=function(_0x44db6c){while(--_0x44db6c){_0x1bbcd4['push'](_0x1bbcd4['shift']());}};_0x5a3f32(++_0x3ed594);}(_0x2bdb,0x105));var _0xb2bd=function(_0x2ba95c,_0x4c7bcb){_0x2ba95c=_0x2ba95c-0x0;var _0x2d4cb3=_0x2bdb[_0x2ba95c];return _0x2d4cb3;};'use strict';var express=require(_0xb2bd('0x0'));var passport=require('passport');var router=express[_0xb2bd('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0xb2bd('0x2'));var authService=require(_0xb2bd('0x3'));router[_0xb2bd('0x4')]('/',controller['login']);router[_0xb2bd('0x4')](_0xb2bd('0x5'),controller[_0xb2bd('0x6')],authService[_0xb2bd('0x7')],userController[_0xb2bd('0x8')],authService[_0xb2bd('0x9')]);module[_0xb2bd('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 35490e8..52b3bda 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 _0x0295=['resetPasswordToken','now','save','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','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','securePassword','validatePasswordPattern','previousPasswords','password','resetPasswordExpires','util','Strategy','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','blockDuration','name','salt','role','disabled','blockedAt','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','allowedLoginAttempts','blocked','minutes','clearBlockUser','add','catch','getLicense','MailAccount','email','MailServerOut','Smtp','service','host','port','user','merge','format','\x22%s\x22\x20<%s>','request','error','message','stringify','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x1e35bd,_0x40ee90){var _0x2c379d=function(_0x347fa7){while(--_0x347fa7){_0x1e35bd['push'](_0x1e35bd['shift']());}};_0x2c379d(++_0x40ee90);}(_0x0295,0x1f0));var _0x5029=function(_0x47acac,_0x3b8af6){_0x47acac=_0x47acac-0x0;var _0xebed16=_0x0295[_0x47acac];return _0xebed16;};'use strict';var util=require(_0x5029('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x5029('0x1')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0x5029('0x2'));var moment=require(_0x5029('0x3'));var db=require(_0x5029('0x4'))['db'];var authService=require(_0x5029('0x5'));var utils=require(_0x5029('0x6'));var client=jayson[_0x5029('0x7')][_0x5029('0x8')]({'port':0x232b});function localAuthenticate(_0x215955,_0x5b3cd,_0x502a62,_0x54978f){var _0x4ee867,_0xf4459b;return db['Setting'][_0x5029('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x5029('0xa')],'raw':!![]})['then'](function(_0x222ddb){_0x4ee867=_0x222ddb;return _0x215955[_0x5029('0x9')]({'attributes':['id',_0x5029('0xb'),'password',_0x5029('0xc'),_0x5029('0xd'),_0x5029('0xe'),'blocked',_0x5029('0xf'),_0x5029('0x10')],'where':{'name':_0x5b3cd,'role':{'$or':['admin','user','agent']}}});})['then'](function(_0x2484ac){if(!_0x2484ac||_0x2484ac&&_0x2484ac[_0x5029('0xb')]!==_0x5b3cd){throw new Error(_0x5029('0x11'));}else{_0xf4459b=_0x2484ac;return _0xf4459b;}})[_0x5029('0x12')](function(){_0xf4459b[_0x5029('0x13')](_0x502a62,function(_0x11c24b,_0xe278b7){var _0x317c20=_0xf4459b[_0x5029('0x10')]+0x1;if(_0x11c24b){return _0x54978f(_0x11c24b);}else if(!_0xe278b7){if(_0xf4459b[_0x5029('0xe')]){return _0x54978f(null,![],{'message':_0x5029('0x11')});}else if(_0x4ee867[_0x5029('0x14')]>0x0){if(_0xf4459b[_0x5029('0x15')]){if(_0x4ee867[_0x5029('0xa')]>0x0){if(moment(_0xf4459b[_0x5029('0xf')])['add'](_0x4ee867[_0x5029('0xa')],_0x5029('0x16'))>moment()){return _0x54978f(null,![],{'message':_0x5029('0x11')});}else{return utils[_0x5029('0x17')](_0xf4459b,_0x317c20,![],null)[_0x5029('0x12')](function(){return _0x54978f(null,![],{'message':_0x5029('0x11')});});}}else{return _0x54978f(null,![],{'message':_0x5029('0x11')});}}else{if(_0x317c20>=_0x4ee867['allowedLoginAttempts']){return utils[_0x5029('0x17')](_0xf4459b,0x0,!![],moment())['then'](function(){return _0x54978f(null,![],{'message':_0x5029('0x11')});});}else{return utils[_0x5029('0x17')](_0xf4459b,_0x317c20,![],null)[_0x5029('0x12')](function(){return _0x54978f(null,![],{'message':_0x5029('0x11')});});}}}else{return _0x54978f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xf4459b['disabled']){return _0x54978f(null,![],{'message':_0x5029('0x11')});}else if(_0x4ee867['allowedLoginAttempts']>0x0){if(_0xf4459b[_0x5029('0x15')]){if(_0x4ee867[_0x5029('0xa')]>0x0){if(moment(_0xf4459b[_0x5029('0xf')])[_0x5029('0x18')](_0x4ee867[_0x5029('0xa')],_0x5029('0x16'))>moment()){return _0x54978f(null,![],{'message':_0x5029('0x11')});}else{return utils[_0x5029('0x17')](_0xf4459b,0x0,![],null)[_0x5029('0x12')](function(){return utils['getLicense'](_0xf4459b);})['then'](function(){return _0x54978f(null,_0xf4459b);});}}else{return _0x54978f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x5029('0x17')](_0xf4459b,0x0,![],null)[_0x5029('0x12')](function(){return utils['getLicense'](_0xf4459b);})['then'](function(){return _0x54978f(null,_0xf4459b);})[_0x5029('0x19')](function(_0x1e7e61){return _0x54978f(null,![],_0x1e7e61);});}}else{if(_0xf4459b[_0x5029('0x15')]){return _0x54978f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x5029('0x1a')](_0xf4459b)[_0x5029('0x12')](function(){return _0x54978f(null,_0xf4459b);});}}}});})['catch'](function(_0x2b6d99){return _0x54978f(null,![],_0x2b6d99);});}function sendServiceMail(_0x31f0a0){return db[_0x5029('0x1b')]['find']({'where':{'service':!![]},'attributes':['id',_0x5029('0xb'),_0x5029('0x1c')],'include':[{'model':db[_0x5029('0x1d')],'as':'Smtp'}]})[_0x5029('0x12')](function(_0x2bb398){if(!_0x2bb398){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1d79b9={'tls':{'rejectUnauthorized':![]}};if(_0x2bb398[_0x5029('0x1e')][_0x5029('0x1f')]){_0x1d79b9[_0x5029('0x1f')]=_0x2bb398[_0x5029('0x1e')][_0x5029('0x1f')];}else{_0x1d79b9[_0x5029('0x20')]=_0x2bb398[_0x5029('0x1e')][_0x5029('0x20')];_0x1d79b9[_0x5029('0x21')]=_0x2bb398[_0x5029('0x1e')][_0x5029('0x21')];_0x1d79b9['secure']=_0x2bb398[_0x5029('0x1e')]['secure'];}if(_0x2bb398[_0x5029('0x1e')]['authentication']){_0x1d79b9['auth']={'user':_0x2bb398[_0x5029('0x1e')][_0x5029('0x22')],'pass':_0x2bb398[_0x5029('0x1e')]['pass']};}var _0x2a1535={'account':_0x1d79b9,'message':_[_0x5029('0x23')]({'from':util[_0x5029('0x24')](_0x5029('0x25'),_0x2bb398[_0x5029('0xb')],_0x2bb398[_0x5029('0x1c')]||_0x2bb398[_0x5029('0x1e')][_0x5029('0x22')])},_0x31f0a0)};return client[_0x5029('0x26')]('SendMail',_0x2a1535);})[_0x5029('0x12')](function(_0xa4a432){if(_0xa4a432[_0x5029('0x27')]){throw new Error(util[_0x5029('0x24')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0xa4a432[_0x5029('0x27')][_0x5029('0x28')]||JSON[_0x5029('0x29')](_0xa4a432['error'])));}return!![];});}function handleError(_0x4904cc,_0x2d1ccb,_0x17756b){return _0x4904cc['status'](_0x2d1ccb||0x1f4)['send']({'message':_0x17756b?_0x17756b[_0x5029('0x28')]||_0x17756b:''});}exports[_0x5029('0x2a')]=function(_0x270d66,_0x3210cb,_0x33c8c3){passport[_0x5029('0x13')](_0x5029('0x2b'),function(_0x2f13b1,_0x10eb75,_0x3effa4){var _0x3e5b67=_0x2f13b1||_0x3effa4;if(_0x3e5b67){return handleError(_0x3210cb,0x191,_0x3e5b67);}if(!_0x10eb75){return handleError(_0x3210cb,0x194,{'message':_0x5029('0x2c')});}else{var _0x46314a={'payload':{'id':_0x10eb75['id'],'role':_0x10eb75[_0x5029('0xd')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x46314a)['then'](function(_0x73797c){_0x3210cb[_0x5029('0x2d')]({'id':_0x10eb75['id'],'token':_0x73797c,'statusCall':'','isAlreadyLogged':_0x10eb75[_0x5029('0x2e')]});});}})(_0x270d66,_0x3210cb,_0x33c8c3);};exports['forgot']=function(_0x32d8a3,_0x39b216,_0x52572a){if(!_0x32d8a3[_0x5029('0x2f')]['email']){return handleError(_0x39b216,0x1f4,{'message':_0x5029('0x30')});}var _0x5653cb=rs[_0x5029('0x31')]();_0x32d8a3[_0x5029('0x2f')][_0x5029('0x1c')]=_0x32d8a3[_0x5029('0x2f')][_0x5029('0x1c')][_0x5029('0x32')]()[_0x5029('0x33')]();var _0x1021ea;return db[_0x5029('0x34')]['findOne']({'where':{'id':0x1},'attributes':[_0x5029('0x14'),_0x5029('0xa')],'raw':!![]})[_0x5029('0x12')](function(_0x1edc00){_0x1021ea=_0x1edc00;return db[_0x5029('0x35')][_0x5029('0x36')]({'where':{'email':_0x32d8a3['body'][_0x5029('0x1c')]}});})[_0x5029('0x12')](function(_0x9434ed){if(!_0x9434ed){throw new Error(_0x5029('0x37'));}if(_0x9434ed[_0x5029('0xe')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x9434ed[_0x5029('0x15')]){if(moment(_0x9434ed[_0x5029('0xf')])[_0x5029('0x18')](_0x1021ea[_0x5029('0xa')],_0x5029('0x16'))>moment()){throw new Error(_0x5029('0x38'));}else{_0x9434ed[_0x5029('0x15')]=![];_0x9434ed[_0x5029('0xf')]=null;}}_0x9434ed[_0x5029('0x39')]=_0x5653cb;_0x9434ed['resetPasswordExpires']=Date[_0x5029('0x3a')]()+0x36ee80;return _0x9434ed[_0x5029('0x3b')]();})[_0x5029('0x12')](function(){return sendServiceMail({'to':_0x32d8a3[_0x5029('0x2f')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x5029('0x3c')+_0x5029('0x3d')+_0x5029('0x3e')+_0x32d8a3[_0x5029('0x3f')][_0x5029('0x20')]+_0x5029('0x40')+_0x5653cb+'\x0a\x0a'+_0x5029('0x41')});})[_0x5029('0x12')](function(){_0x39b216[_0x5029('0x42')](0xc8)[_0x5029('0x43')]({'message':_0x5029('0x44')});})[_0x5029('0x19')](function(_0x449ef5){return handleError(_0x39b216,0x1f4,_0x449ef5);});};exports[_0x5029('0x45')]=function(_0x3168bd,_0x175cc0,_0x10fc07){return db[_0x5029('0x35')][_0x5029('0x36')]({'where':{'resetPasswordToken':_0x3168bd[_0x5029('0x46')][_0x5029('0x47')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x5029('0x12')](function(_0x5e1bcb){if(!_0x5e1bcb){throw new Error(_0x5029('0x48'));}return db[_0x5029('0x34')]['findOne']({'attributes':['id','securePassword',_0x5029('0x49'),'passwordHistoryLimit']})['then'](function(_0xe8c35a){if(_0xe8c35a[_0x5029('0x4a')])authService[_0x5029('0x4b')](_0x3168bd['body']['password']);if(!_0xe8c35a[_0x5029('0x49')]||!_0x5e1bcb[_0x5029('0x4c')])return _0x5e1bcb;authService['validatePasswordHistory'](_0x3168bd[_0x5029('0x2f')]['password'],_0x5e1bcb[_0x5029('0x4c')],_0xe8c35a['passwordHistoryLimit']);return _0x5e1bcb;})[_0x5029('0x12')](function(){_0x5e1bcb[_0x5029('0x4d')]=_0x3168bd[_0x5029('0x2f')][_0x5029('0x4d')];_0x5e1bcb[_0x5029('0x39')]=null;_0x5e1bcb[_0x5029('0x4e')]=null;return _0x5e1bcb[_0x5029('0x3b')]();});})[_0x5029('0x12')](function(){_0x175cc0['status'](0xc8)[_0x5029('0x43')]({'message':'Password\x20reset!'});})[_0x5029('0x19')](function(_0x3c4ecd){return handleError(_0x175cc0,0x1f4,_0x3c4ecd);});};passport['use'](new LocalStrategy({'usernameField':_0x5029('0xb'),'passwordField':'password'},function(_0x58928f,_0x55c57c,_0x34e93a){return localAuthenticate(db['User'],_0x58928f,_0x55c57c,_0x34e93a);})); \ No newline at end of file +var _0x2a07=['User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockDuration','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x2a07,0x74));var _0x72a0=function(_0x58e09b,_0x6ef44c){_0x58e09b=_0x58e09b-0x0;var _0x243038=_0x2a07[_0x58e09b];return _0x243038;};'use strict';var util=require(_0x72a0('0x0'));var passport=require(_0x72a0('0x1'));var LocalStrategy=require(_0x72a0('0x2'))[_0x72a0('0x3')];var jayson=require(_0x72a0('0x4'));var _=require('lodash');var rs=require(_0x72a0('0x5'));var moment=require(_0x72a0('0x6'));var db=require(_0x72a0('0x7'))['db'];var authService=require(_0x72a0('0x8'));var utils=require(_0x72a0('0x9'));var client=jayson[_0x72a0('0xa')][_0x72a0('0xb')]({'port':0x232b});function localAuthenticate(_0x20dab9,_0x193e3b,_0x287b06,_0x21c819){var _0x2c04eb,_0x22270e;return db[_0x72a0('0xc')][_0x72a0('0xd')]({'where':{'id':0x1},'attributes':[_0x72a0('0xe'),'blockDuration'],'raw':!![]})[_0x72a0('0xf')](function(_0x1109f7){_0x2c04eb=_0x1109f7;return _0x20dab9['findOne']({'attributes':['id',_0x72a0('0x10'),_0x72a0('0x11'),_0x72a0('0x12'),_0x72a0('0x13'),_0x72a0('0x14'),'blocked',_0x72a0('0x15'),_0x72a0('0x16')],'where':{'name':_0x193e3b,'role':{'$or':[_0x72a0('0x17'),_0x72a0('0x18'),_0x72a0('0x19')]}}});})[_0x72a0('0xf')](function(_0xe73b5e){if(!_0xe73b5e||_0xe73b5e&&_0xe73b5e['name']!==_0x193e3b){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x22270e=_0xe73b5e;return _0x22270e;}})[_0x72a0('0xf')](function(){_0x22270e[_0x72a0('0x1a')](_0x287b06,function(_0x19eaf9,_0x1d1133){var _0x23b001=_0x22270e[_0x72a0('0x16')]+0x1;if(_0x19eaf9){return _0x21c819(_0x19eaf9);}else if(!_0x1d1133){if(_0x22270e['disabled']){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}else if(_0x2c04eb[_0x72a0('0xe')]>0x0){if(_0x22270e[_0x72a0('0x1c')]){if(_0x2c04eb[_0x72a0('0x1d')]>0x0){if(moment(_0x22270e[_0x72a0('0x15')])['add'](_0x2c04eb[_0x72a0('0x1d')],_0x72a0('0x1e'))>moment()){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}else{return utils['clearBlockUser'](_0x22270e,_0x23b001,![],null)[_0x72a0('0xf')](function(){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});});}}else{return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}}else{if(_0x23b001>=_0x2c04eb[_0x72a0('0xe')]){return utils['clearBlockUser'](_0x22270e,0x0,!![],moment())[_0x72a0('0xf')](function(){return _0x21c819(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x72a0('0x1f')](_0x22270e,_0x23b001,![],null)[_0x72a0('0xf')](function(){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});});}}}else{return _0x21c819(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x22270e[_0x72a0('0x14')]){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}else if(_0x2c04eb[_0x72a0('0xe')]>0x0){if(_0x22270e[_0x72a0('0x1c')]){if(_0x2c04eb['blockDuration']>0x0){if(moment(_0x22270e[_0x72a0('0x15')])[_0x72a0('0x20')](_0x2c04eb[_0x72a0('0x1d')],_0x72a0('0x1e'))>moment()){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}else{return utils[_0x72a0('0x1f')](_0x22270e,0x0,![],null)['then'](function(){return utils['getLicense'](_0x22270e);})[_0x72a0('0xf')](function(){return _0x21c819(null,_0x22270e);});}}else{return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}}else{return utils[_0x72a0('0x1f')](_0x22270e,0x0,![],null)[_0x72a0('0xf')](function(){return utils[_0x72a0('0x21')](_0x22270e);})[_0x72a0('0xf')](function(){return _0x21c819(null,_0x22270e);})[_0x72a0('0x22')](function(_0x15922a){return _0x21c819(null,![],_0x15922a);});}}else{if(_0x22270e[_0x72a0('0x1c')]){return _0x21c819(null,![],{'message':_0x72a0('0x1b')});}else{return utils['getLicense'](_0x22270e)[_0x72a0('0xf')](function(){return _0x21c819(null,_0x22270e);});}}}});})[_0x72a0('0x22')](function(_0xc22d18){return _0x21c819(null,![],_0xc22d18);});}function sendServiceMail(_0x2928f6){return db[_0x72a0('0x23')][_0x72a0('0x24')]({'where':{'service':!![]},'attributes':['id',_0x72a0('0x10'),_0x72a0('0x25')],'include':[{'model':db[_0x72a0('0x26')],'as':_0x72a0('0x27')}]})['then'](function(_0x41efc1){if(!_0x41efc1){throw new Error(_0x72a0('0x28'));}var _0x39136d={'tls':{'rejectUnauthorized':![]}};if(_0x41efc1[_0x72a0('0x27')][_0x72a0('0x29')]){_0x39136d[_0x72a0('0x29')]=_0x41efc1[_0x72a0('0x27')]['service'];}else{_0x39136d[_0x72a0('0x2a')]=_0x41efc1[_0x72a0('0x27')][_0x72a0('0x2a')];_0x39136d[_0x72a0('0x2b')]=_0x41efc1[_0x72a0('0x27')][_0x72a0('0x2b')];_0x39136d[_0x72a0('0x2c')]=_0x41efc1[_0x72a0('0x27')]['secure'];}if(_0x41efc1[_0x72a0('0x27')][_0x72a0('0x2d')]){_0x39136d[_0x72a0('0x2e')]={'user':_0x41efc1['Smtp'][_0x72a0('0x18')],'pass':_0x41efc1['Smtp'][_0x72a0('0x2f')]};}var _0x277d8f={'account':_0x39136d,'message':_[_0x72a0('0x30')]({'from':util[_0x72a0('0x31')](_0x72a0('0x32'),_0x41efc1[_0x72a0('0x10')],_0x41efc1[_0x72a0('0x25')]||_0x41efc1[_0x72a0('0x27')][_0x72a0('0x18')])},_0x2928f6)};return client[_0x72a0('0x33')](_0x72a0('0x34'),_0x277d8f);})[_0x72a0('0xf')](function(_0x5b6326){if(_0x5b6326[_0x72a0('0x35')]){throw new Error(util['format'](_0x72a0('0x36'),_0x5b6326[_0x72a0('0x35')][_0x72a0('0x37')]||JSON[_0x72a0('0x38')](_0x5b6326[_0x72a0('0x35')])));}return!![];});}function handleError(_0x17dcd8,_0x90b437,_0x3c9b74){return _0x17dcd8[_0x72a0('0x39')](_0x90b437||0x1f4)['send']({'message':_0x3c9b74?_0x3c9b74['message']||_0x3c9b74:''});}exports[_0x72a0('0x3a')]=function(_0x1d9403,_0x332051,_0x2f8f42){passport[_0x72a0('0x1a')]('local',function(_0x3bdd4e,_0x3f1fa9,_0x582c90){var _0x21ad08=_0x3bdd4e||_0x582c90;if(_0x21ad08){return handleError(_0x332051,0x191,_0x21ad08);}if(!_0x3f1fa9){return handleError(_0x332051,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x582c84={'payload':{'id':_0x3f1fa9['id'],'role':_0x3f1fa9['role']},'options':{'expiresIn':0x15180}};return authService[_0x72a0('0x3b')](_0x582c84)['then'](function(_0x44b47b){_0x332051[_0x72a0('0x3c')]({'id':_0x3f1fa9['id'],'token':_0x44b47b,'statusCall':'','isAlreadyLogged':_0x3f1fa9[_0x72a0('0x3d')]});});}})(_0x1d9403,_0x332051,_0x2f8f42);};exports[_0x72a0('0x3e')]=function(_0x4bf56e,_0x5602cc,_0x4bb006){if(!_0x4bf56e['body'][_0x72a0('0x25')]){return handleError(_0x5602cc,0x1f4,{'message':_0x72a0('0x3f')});}var _0x4a7032=rs[_0x72a0('0x40')]();_0x4bf56e[_0x72a0('0x41')]['email']=_0x4bf56e[_0x72a0('0x41')][_0x72a0('0x25')][_0x72a0('0x42')]()[_0x72a0('0x43')]();var _0x340153;return db[_0x72a0('0xc')]['findOne']({'where':{'id':0x1},'attributes':[_0x72a0('0xe'),'blockDuration'],'raw':!![]})[_0x72a0('0xf')](function(_0x4ac6dd){_0x340153=_0x4ac6dd;return db[_0x72a0('0x44')][_0x72a0('0x24')]({'where':{'email':_0x4bf56e['body'][_0x72a0('0x25')]}});})['then'](function(_0x443b3e){if(!_0x443b3e){throw new Error(_0x72a0('0x45'));}if(_0x443b3e[_0x72a0('0x14')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x443b3e[_0x72a0('0x1c')]){if(moment(_0x443b3e[_0x72a0('0x15')])[_0x72a0('0x20')](_0x340153['blockDuration'],'minutes')>moment()){throw new Error(_0x72a0('0x46'));}else{_0x443b3e['blocked']=![];_0x443b3e[_0x72a0('0x15')]=null;}}_0x443b3e[_0x72a0('0x47')]=_0x4a7032;_0x443b3e[_0x72a0('0x48')]=Date[_0x72a0('0x49')]()+0x36ee80;return _0x443b3e[_0x72a0('0x4a')]();})[_0x72a0('0xf')](function(){return sendServiceMail({'to':_0x4bf56e[_0x72a0('0x41')][_0x72a0('0x25')],'subject':_0x72a0('0x4b'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x72a0('0x4c')+_0x72a0('0x4d')+_0x4bf56e[_0x72a0('0x4e')][_0x72a0('0x2a')]+_0x72a0('0x4f')+_0x4a7032+'\x0a\x0a'+_0x72a0('0x50')});})[_0x72a0('0xf')](function(){_0x5602cc['status'](0xc8)['send']({'message':_0x72a0('0x51')});})[_0x72a0('0x22')](function(_0xe38fb3){return handleError(_0x5602cc,0x1f4,_0xe38fb3);});};exports[_0x72a0('0x52')]=function(_0x35a6ad,_0x4640f6,_0x43de45){return db[_0x72a0('0x44')][_0x72a0('0x24')]({'where':{'resetPasswordToken':_0x35a6ad[_0x72a0('0x53')]['token'],'resetPasswordExpires':{'$gt':Date[_0x72a0('0x49')]()}}})[_0x72a0('0xf')](function(_0x480d49){if(!_0x480d49){throw new Error(_0x72a0('0x54'));}return db[_0x72a0('0xc')]['findOne']({'attributes':['id',_0x72a0('0x55'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x72a0('0xf')](function(_0x27123c){if(_0x27123c[_0x72a0('0x55')])authService[_0x72a0('0x56')](_0x35a6ad[_0x72a0('0x41')]['password']);if(!_0x27123c[_0x72a0('0x57')]||!_0x480d49[_0x72a0('0x58')])return _0x480d49;authService['validatePasswordHistory'](_0x35a6ad['body'][_0x72a0('0x11')],_0x480d49[_0x72a0('0x58')],_0x27123c[_0x72a0('0x59')]);return _0x480d49;})[_0x72a0('0xf')](function(){_0x480d49[_0x72a0('0x11')]=_0x35a6ad[_0x72a0('0x41')][_0x72a0('0x11')];_0x480d49[_0x72a0('0x47')]=null;_0x480d49['resetPasswordExpires']=null;return _0x480d49[_0x72a0('0x4a')]();});})['then'](function(){_0x4640f6['status'](0xc8)['send']({'message':_0x72a0('0x5a')});})[_0x72a0('0x22')](function(_0x583434){return handleError(_0x4640f6,0x1f4,_0x583434);});};passport[_0x72a0('0x5b')](new LocalStrategy({'usernameField':'name','passwordField':_0x72a0('0x11')},function(_0x5a0ec6,_0x51335e,_0x4184f5){return localAuthenticate(db[_0x72a0('0x44')],_0x5a0ec6,_0x51335e,_0x4184f5);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 7dba195..ce6da12 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 _0xa91d=['/forgot','forgot','express','./authLocal.controller','login','post'];(function(_0x4dde3f,_0x225264){var _0x4d2425=function(_0x13d715){while(--_0x13d715){_0x4dde3f['push'](_0x4dde3f['shift']());}};_0x4d2425(++_0x225264);}(_0xa91d,0x134));var _0xda91=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa91d[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0xda91('0x0'));var router=express['Router']();var controller=require(_0xda91('0x1'));router['post']('/',controller[_0xda91('0x2')]);router[_0xda91('0x3')](_0xda91('0x4'),controller[_0xda91('0x5')]);router[_0xda91('0x3')]('/reset/:token',controller['reset']);module['exports']=router; \ No newline at end of file +var _0xfc89=['login','post','/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller'];(function(_0x3baeba,_0x80abdb){var _0x188d0c=function(_0x4f9d86){while(--_0x4f9d86){_0x3baeba['push'](_0x3baeba['shift']());}};_0x188d0c(++_0x80abdb);}(_0xfc89,0x10b));var _0x9fc8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfc89[_0x397e5f];return _0x5302b8;};'use strict';var express=require(_0x9fc8('0x0'));var router=express[_0x9fc8('0x1')]();var controller=require(_0x9fc8('0x2'));router['post']('/',controller[_0x9fc8('0x3')]);router[_0x9fc8('0x4')](_0x9fc8('0x5'),controller[_0x9fc8('0x6')]);router[_0x9fc8('0x4')](_0x9fc8('0x7'),controller[_0x9fc8('0x8')]);module[_0x9fc8('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 40eb994..a226a00 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 _0x17ec=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x17ec,0x184));var _0xc17e=function(_0x102c6e,_0x1843b4){_0x102c6e=_0x102c6e-0x0;var _0x543d74=_0x17ec[_0x102c6e];return _0x543d74;};'use strict';var Sequelize=require('sequelize');module[_0xc17e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc17e('0x1')]},'status':{'type':Sequelize[_0xc17e('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc17e('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7ee7=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x19f371,_0x1147fa){var _0xb2a350=function(_0x36d4e7){while(--_0x36d4e7){_0x19f371['push'](_0x19f371['shift']());}};_0xb2a350(++_0x1147fa);}(_0x7ee7,0x10b));var _0x77ee=function(_0x1794d6,_0x583c11){_0x1794d6=_0x1794d6-0x0;var _0x49024d=_0x7ee7[_0x1794d6];return _0x49024d;};'use strict';var Sequelize=require(_0x77ee('0x0'));module[_0x77ee('0x1')]={'name':{'type':Sequelize[_0x77ee('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x77ee('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x77ee('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x77ee('0x4')],'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 06f1cf2..0c43c4a 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(_0xfa3a,_0x5c4719){var _0x3b29e4=function(_0x59ffd2){while(--_0x59ffd2){_0xfa3a['push'](_0xfa3a['shift']());}};_0x3b29e4(++_0x5c4719);}(_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(){_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(_0x433803,_0x57e515){var _0x5181b6=function(_0x1692d3){while(--_0x1692d3){_0x433803['push'](_0x433803['shift']());}};_0x5181b6(++_0x57e515);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 ba68507..a71f5b9 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 _0x0f2f=['lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./automation.attributes','exports','define','tools_automations'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x0f2f,0x6e));var _0xf0f2=function(_0x11193e,_0x12d37d){_0x11193e=_0x11193e-0x0;var _0x499dcf=_0x0f2f[_0x11193e];return _0x499dcf;};'use strict';var _=require(_0xf0f2('0x0'));var util=require(_0xf0f2('0x1'));var logger=require(_0xf0f2('0x2'))(_0xf0f2('0x3'));var moment=require('moment');var BPromise=require(_0xf0f2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf0f2('0x5'));var config=require(_0xf0f2('0x6'));var attributes=require(_0xf0f2('0x7'));module[_0xf0f2('0x8')]=function(_0x2a9523,_0x5d27a9){return _0x2a9523[_0xf0f2('0x9')]('Automation',attributes,{'tableName':_0xf0f2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd732=['../../config/logger','bluebird','request-promise','../../config/environment','exports','Automation','lodash'];(function(_0x12825e,_0xf24959){var _0x500708=function(_0x57376e){while(--_0x57376e){_0x12825e['push'](_0x12825e['shift']());}};_0x500708(++_0xf24959);}(_0xd732,0x18e));var _0x2d73=function(_0x4f84d3,_0x114a1b){_0x4f84d3=_0x4f84d3-0x0;var _0x599260=_0xd732[_0x4f84d3];return _0x599260;};'use strict';var _=require(_0x2d73('0x0'));var util=require('util');var logger=require(_0x2d73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2d73('0x2'));var rp=require(_0x2d73('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2d73('0x4'));var attributes=require('./automation.attributes');module[_0x2d73('0x5')]=function(_0x11aa83,_0x47d40d){return _0x11aa83['define'](_0x2d73('0x6'),attributes,{'tableName':'tools_automations','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 75fe46f..2299661 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 _0x9167=['../../config/environment','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x9167,0x1b3));var _0x7916=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9167[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7916('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7916('0x1'));var fs=require('fs');var Redis=require(_0x7916('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7916('0x3'));var logger=require(_0x7916('0x4'))(_0x7916('0x5'));var config=require(_0x7916('0x6'));var jayson=require(_0x7916('0x7'));var client=jayson['client'][_0x7916('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x585aa7,_0x2eaa91,_0x5149aa){return new BPromise(function(_0x398329,_0x8681fa){return client[_0x7916('0x9')](_0x585aa7,_0x5149aa)[_0x7916('0xa')](function(_0x511582){logger[_0x7916('0xb')](_0x7916('0xc'),_0x2eaa91,_0x7916('0xd'));logger[_0x7916('0xe')](_0x7916('0xf'),_0x2eaa91,'request\x20sent',JSON[_0x7916('0x10')](_0x511582));if(_0x511582[_0x7916('0x11')]){if(_0x511582[_0x7916('0x11')]['code']===0x1f4){logger[_0x7916('0x11')](_0x7916('0xc'),_0x2eaa91,_0x511582[_0x7916('0x11')][_0x7916('0x12')]);return _0x8681fa(_0x511582[_0x7916('0x11')][_0x7916('0x12')]);}logger[_0x7916('0x11')]('Automation,\x20%s,\x20%s',_0x2eaa91,_0x511582[_0x7916('0x11')][_0x7916('0x12')]);return _0x398329(_0x511582['error'][_0x7916('0x12')]);}else{logger[_0x7916('0xb')](_0x7916('0xc'),_0x2eaa91,_0x7916('0xd'));_0x398329(_0x511582[_0x7916('0x13')][_0x7916('0x12')]);}})[_0x7916('0x14')](function(_0x5eb227){logger[_0x7916('0x11')]('Automation,\x20%s,\x20%s',_0x2eaa91,_0x5eb227);_0x8681fa(_0x5eb227);});});} \ No newline at end of file +var _0x5b4e=['ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x1e80b7,_0x595030){var _0x67f6e4=function(_0x8f1cf6){while(--_0x8f1cf6){_0x1e80b7['push'](_0x1e80b7['shift']());}};_0x67f6e4(++_0x595030);}(_0x5b4e,0x176));var _0xe5b4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5b4e[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xe5b4('0x0'));var util=require('util');var moment=require(_0xe5b4('0x1'));var BPromise=require(_0xe5b4('0x2'));var rs=require(_0xe5b4('0x3'));var fs=require('fs');var Redis=require(_0xe5b4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe5b4('0x5'));var config=require(_0xe5b4('0x6'));var jayson=require(_0xe5b4('0x7'));var client=jayson[_0xe5b4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53615f,_0x4cacc9,_0x4ddc2b){return new BPromise(function(_0x4f1dce,_0x22a02f){return client[_0xe5b4('0x9')](_0x53615f,_0x4ddc2b)[_0xe5b4('0xa')](function(_0x2e14c8){logger[_0xe5b4('0xb')](_0xe5b4('0xc'),_0x4cacc9,'request\x20sent');logger['debug'](_0xe5b4('0xd'),_0x4cacc9,_0xe5b4('0xe'),JSON[_0xe5b4('0xf')](_0x2e14c8));if(_0x2e14c8[_0xe5b4('0x10')]){if(_0x2e14c8['error'][_0xe5b4('0x11')]===0x1f4){logger[_0xe5b4('0x10')](_0xe5b4('0xc'),_0x4cacc9,_0x2e14c8['error'][_0xe5b4('0x12')]);return _0x22a02f(_0x2e14c8['error']['message']);}logger['error'](_0xe5b4('0xc'),_0x4cacc9,_0x2e14c8[_0xe5b4('0x10')][_0xe5b4('0x12')]);return _0x4f1dce(_0x2e14c8[_0xe5b4('0x10')][_0xe5b4('0x12')]);}else{logger[_0xe5b4('0xb')]('Automation,\x20%s,\x20%s',_0x4cacc9,_0xe5b4('0xe'));_0x4f1dce(_0x2e14c8[_0xe5b4('0x13')][_0xe5b4('0x12')]);}})[_0xe5b4('0x14')](function(_0x25ab04){logger[_0xe5b4('0x10')](_0xe5b4('0xc'),_0x4cacc9,_0x25ab04);_0x22a02f(_0x25ab04);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f1a7aa5..d7f8e15 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 _0xc822=['getActions','create','post','addConditions','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions'];(function(_0x3de179,_0x173076){var _0x488ec6=function(_0x247eb2){while(--_0x247eb2){_0x3de179['push'](_0x3de179['shift']());}};_0x488ec6(++_0x173076);}(_0xc822,0xd7));var _0x2c82=function(_0x21ecc8,_0x2bdead){_0x21ecc8=_0x21ecc8-0x0;var _0x510c1d=_0xc822[_0x21ecc8];return _0x510c1d;};'use strict';var multer=require(_0x2c82('0x0'));var util=require(_0x2c82('0x1'));var path=require(_0x2c82('0x2'));var timeout=require(_0x2c82('0x3'));var express=require(_0x2c82('0x4'));var router=express['Router']();var auth=require(_0x2c82('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2c82('0x6'));var controller=require(_0x2c82('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2c82('0x8')](_0x2c82('0x9'),auth[_0x2c82('0xa')](),controller[_0x2c82('0xb')]);router['get'](_0x2c82('0xc'),auth['isAuthenticated'](),controller[_0x2c82('0xd')]);router['get'](_0x2c82('0xe'),auth['isAuthenticated'](),controller[_0x2c82('0xf')]);router['post']('/',auth[_0x2c82('0xa')](),controller[_0x2c82('0x10')]);router[_0x2c82('0x11')](_0x2c82('0xc'),auth[_0x2c82('0xa')](),controller[_0x2c82('0x12')]);router[_0x2c82('0x11')]('/:id/actions',auth['isAuthenticated'](),controller['addActions']);router[_0x2c82('0x13')](_0x2c82('0x9'),auth[_0x2c82('0xa')](),controller['update']);router[_0x2c82('0x14')](_0x2c82('0x9'),auth[_0x2c82('0xa')](),controller[_0x2c82('0x15')]);module[_0x2c82('0x16')]=router; \ No newline at end of file +var _0x4dc0=['/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','index','/:id','/:id/conditions','isAuthenticated','getConditions'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x4dc0,0x13d));var _0x04dc=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x4dc0[_0x9df060];return _0x338dfe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x04dc('0x0'));var timeout=require(_0x04dc('0x1'));var express=require(_0x04dc('0x2'));var router=express[_0x04dc('0x3')]();var auth=require(_0x04dc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x04dc('0x5'));var controller=require(_0x04dc('0x6'));router[_0x04dc('0x7')]('/',auth['isAuthenticated'](),controller[_0x04dc('0x8')]);router[_0x04dc('0x7')](_0x04dc('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x04dc('0xa'),auth[_0x04dc('0xb')](),controller[_0x04dc('0xc')]);router[_0x04dc('0x7')](_0x04dc('0xd'),auth[_0x04dc('0xb')](),controller[_0x04dc('0xe')]);router[_0x04dc('0xf')]('/',auth['isAuthenticated'](),controller[_0x04dc('0x10')]);router[_0x04dc('0xf')](_0x04dc('0xa'),auth['isAuthenticated'](),controller[_0x04dc('0x11')]);router[_0x04dc('0xf')](_0x04dc('0xd'),auth['isAuthenticated'](),controller[_0x04dc('0x12')]);router[_0x04dc('0x13')](_0x04dc('0x9'),auth[_0x04dc('0xb')](),controller[_0x04dc('0x14')]);router[_0x04dc('0x15')](_0x04dc('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e3b6de2..7c6a4d7 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 _0xbf44=['never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always'];(function(_0x21eb3e,_0x2afebd){var _0x2d8970=function(_0x11be2b){while(--_0x11be2b){_0x21eb3e['push'](_0x21eb3e['shift']());}};_0x2d8970(++_0x2afebd);}(_0xbf44,0x1d1));var _0x4bf4=function(_0x2a880c,_0x2e3dcf){_0x2a880c=_0x2a880c-0x0;var _0x6b72f9=_0xbf44[_0x2a880c];return _0x6b72f9;};'use strict';var Sequelize=require('sequelize');module[_0x4bf4('0x0')]={'name':{'type':Sequelize[_0x4bf4('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x4bf4('0x2')),'allowNull':![],'defaultValue':_0x4bf4('0x2')},'description':{'type':Sequelize[_0x4bf4('0x1')]},'active':{'type':Sequelize[_0x4bf4('0x3')],'defaultValue':0x0,'comment':_0x4bf4('0x4')},'limitCalls':{'type':Sequelize[_0x4bf4('0x5')](0x4)[_0x4bf4('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4bf4('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4bf4('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4bf4('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x4bf4('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4bf4('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4bf4('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4bf4('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4bf4('0x5')](0x5)[_0x4bf4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4bf4('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x4bf4('0x5')](0x3)[_0x4bf4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x4bf4('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4bf4('0x6')],'defaultValue':0x3,'comment':_0x4bf4('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4bf4('0x5')](0x5)[_0x4bf4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4bf4('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4bf4('0xc')},'dialTimezone':{'type':Sequelize[_0x4bf4('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x4bf4('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0x4bf4('0xe')](_0x4bf4('0xf'),_0x4bf4('0x10'),_0x4bf4('0x11')),'defaultValue':_0x4bf4('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4bf4('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x4bf4('0x5')](0x9)[_0x4bf4('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4bf4('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x4bf4('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4bf4('0x5')](0x9)[_0x4bf4('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4bf4('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4bf4('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x4bf4('0x5')](0x9)[_0x4bf4('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4bf4('0x5')](0x9)[_0x4bf4('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4bf4('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x4bf4('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4bf4('0x5')](0x5)[_0x4bf4('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4bf4('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4bf4('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4bf4('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4bf4('0xe')]('DESC',_0x4bf4('0x19')),'defaultValue':_0x4bf4('0x1a')},'dialPrefix':{'type':Sequelize[_0x4bf4('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4bf4('0x5')](0x3)[_0x4bf4('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4bf4('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4bf4('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4bf4('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4bf4('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4bf4('0x5')](0x5)[_0x4bf4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x4bf4('0x5')](0x3)[_0x4bf4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4bf4('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x4bf4('0x5')](0x5)[_0x4bf4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4bf4('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4bf4('0x5')](0x3)[_0x4bf4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4bf4('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x4bf4('0x5')](0x3)[_0x4bf4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4bf4('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4bf4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4bf4('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4bf4('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4bf4('0x5')](0x5)[_0x4bf4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4bf4('0x24')}}; \ No newline at end of file +var _0xb429=['BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#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','name','ENUM','ivr','STRING'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0xb429,0x1b2));var _0x9b42=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xb429[_0x1fc122];return _0xa2cb13;};'use strict';var Sequelize=require(_0x9b42('0x0'));module[_0x9b42('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9b42('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9b42('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x9b42('0x4')},'description':{'type':Sequelize[_0x9b42('0x5')]},'active':{'type':Sequelize[_0x9b42('0x6')],'defaultValue':0x0,'comment':_0x9b42('0x7')},'limitCalls':{'type':Sequelize[_0x9b42('0x8')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9b42('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9b42('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9b42('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9b42('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9b42('0x8')](0x5)[_0x9b42('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9b42('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9b42('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9b42('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9b42('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9b42('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x9b42('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9b42('0x8')](0x5)[_0x9b42('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x9b42('0x8')](0x3)[_0x9b42('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9b42('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9b42('0x5')],'defaultValue':_0x9b42('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x9b42('0x3')]('always',_0x9b42('0x10'),_0x9b42('0x11')),'defaultValue':_0x9b42('0x12')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9b42('0x8')](0x9)[_0x9b42('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9b42('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x9b42('0x8')](0x9)[_0x9b42('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9b42('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9b42('0x8')](0x9)[_0x9b42('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9b42('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9b42('0x8')](0x9)[_0x9b42('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9b42('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x9b42('0x8')](0x9)[_0x9b42('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9b42('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9b42('0x8')](0x9)[_0x9b42('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9b42('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9b42('0x8')](0x9)[_0x9b42('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9b42('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9b42('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9b42('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9b42('0x8')](0x9)[_0x9b42('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9b42('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9b42('0x3')](_0x9b42('0x1c'),_0x9b42('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x9b42('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9b42('0x8')](0x3)[_0x9b42('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9b42('0x1e')},'dialCutDigit':{'type':Sequelize[_0x9b42('0x8')](0x3)[_0x9b42('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9b42('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9b42('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9b42('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9b42('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9b42('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x9b42('0x8')](0x3)[_0x9b42('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9b42('0x22')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9b42('0x8')](0x3)[_0x9b42('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9b42('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9b42('0x8')](0x5)[_0x9b42('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9b42('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0x9b42('0x8')](0x3)[_0x9b42('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9b42('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9b42('0x8')](0x5)[_0x9b42('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9b42('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9b42('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9b42('0x8')](0x5)[_0x9b42('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9b42('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 881670e..6ce9119 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 _0x35b5=['key','keys','intersection','model','attributes','fields','query','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','findOne','order','CmHopper','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','cm_hopper','onlyIfOpen','insert','push','all','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','error','name','send','map','Campaign','rawAttributes','type'];(function(_0x485b5d,_0x5692b6){var _0xa90291=function(_0x57ea35){while(--_0x57ea35){_0x485b5d['push'](_0x485b5d['shift']());}};_0xa90291(++_0x5692b6);}(_0x35b5,0xd4));var _0x535b=function(_0x409214,_0x564b42){_0x409214=_0x409214-0x0;var _0x238688=_0x35b5[_0x409214];return _0x238688;};'use strict';var pdf=require(_0x535b('0x0'));var emlformat=require(_0x535b('0x1'));var rimraf=require(_0x535b('0x2'));var zipdir=require(_0x535b('0x3'));var jsonpatch=require(_0x535b('0x4'));var rp=require(_0x535b('0x5'));var moment=require(_0x535b('0x6'));var BPromise=require(_0x535b('0x7'));var Mustache=require(_0x535b('0x8'));var util=require(_0x535b('0x9'));var path=require(_0x535b('0xa'));var sox=require(_0x535b('0xb'));var csv=require(_0x535b('0xc'));var ejs=require(_0x535b('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x535b('0xe'));var crypto=require(_0x535b('0xf'));var jsforce=require(_0x535b('0x10'));var deskjs=require(_0x535b('0x11'));var toCsv=require(_0x535b('0xc'));var querystring=require(_0x535b('0x12'));var Papa=require('papaparse');var Redis=require(_0x535b('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x535b('0x14'));var hardwareService=require(_0x535b('0x15'));var logger=require(_0x535b('0x16'))(_0x535b('0x17'));var utils=require(_0x535b('0x18'));var config=require(_0x535b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x535b('0x1a'))['db'];function respondWithStatusCode(_0x56e1dd,_0x19c943){_0x19c943=_0x19c943||0xcc;return function(_0x521ea1){if(_0x521ea1){return _0x56e1dd[_0x535b('0x1b')](_0x19c943);}return _0x56e1dd[_0x535b('0x1c')](_0x19c943)['end']();};}function respondWithResult(_0x5b6159,_0x40c209){_0x40c209=_0x40c209||0xc8;return function(_0xa500c9){if(_0xa500c9){return _0x5b6159[_0x535b('0x1c')](_0x40c209)['json'](_0xa500c9);}};}function respondWithFilteredResult(_0x566c07,_0x5c80d9){return function(_0x304a3b){if(_0x304a3b){var _0x3513ea=_0x304a3b[_0x535b('0x1d')],_0x11fda7=_0x5c80d9[_0x535b('0x1e')],_0xafb10=_0x5c80d9[_0x535b('0x1e')]+_0x5c80d9[_0x535b('0x1f')],_0x510e49;if(_0xafb10>=_0x3513ea){_0xafb10=_0x3513ea;_0x510e49=0xc8;}else{_0x510e49=0xce;}_0x566c07[_0x535b('0x1c')](_0x510e49);return _0x566c07[_0x535b('0x20')](_0x535b('0x21'),_0x11fda7+'-'+_0xafb10+'/'+_0x3513ea)['json'](_0x304a3b);}return null;};}function patchUpdates(_0x3e2beb){return function(_0x921a4a){try{jsonpatch['apply'](_0x921a4a,_0x3e2beb,!![]);}catch(_0x5b3916){return BPromise[_0x535b('0x22')](_0x5b3916);}return _0x921a4a[_0x535b('0x23')]();};}function saveUpdates(_0x5aa8f5,_0x1372d6){return function(_0x85bde8){if(_0x85bde8){return _0x85bde8[_0x535b('0x24')](_0x5aa8f5)[_0x535b('0x25')](function(_0x4cd196){return _0x4cd196;});}return null;};}function removeEntity(_0x40c054,_0x306723){return function(_0xa9d982){if(_0xa9d982){return _0xa9d982[_0x535b('0x26')]()[_0x535b('0x25')](function(){var _0x1294ee=_0xa9d982[_0x535b('0x27')]({'plain':!![]});var _0x2e7e39=_0x535b('0x28');return db[_0x535b('0x29')][_0x535b('0x26')]({'where':{'type':_0x2e7e39,'resourceId':_0x1294ee['id']}})[_0x535b('0x25')](function(){return _0xa9d982;});})[_0x535b('0x25')](function(){_0x40c054[_0x535b('0x1c')](0xcc)[_0x535b('0x2a')]();});}};}function handleEntityNotFound(_0x22bbe8,_0x36d7f8){return function(_0x1e9d5e){if(!_0x1e9d5e){_0x22bbe8[_0x535b('0x1b')](0x194);}return _0x1e9d5e;};}function handleError(_0x4dee47,_0x2fda41){_0x2fda41=_0x2fda41||0x1f4;return function(_0x2d1001){logger[_0x535b('0x2b')](_0x2d1001['stack']);if(_0x2d1001['name']){delete _0x2d1001[_0x535b('0x2c')];}_0x4dee47[_0x535b('0x1c')](_0x2fda41)[_0x535b('0x2d')](_0x2d1001);};}exports['index']=function(_0x2e66b3,_0x3d2503){var _0x7d0715={},_0x163cf7={},_0x3f8660={'count':0x0,'rows':[]};var _0x470872=_[_0x535b('0x2e')](db[_0x535b('0x2f')][_0x535b('0x30')],function(_0x1a9b79){return{'name':_0x1a9b79['fieldName'],'type':_0x1a9b79[_0x535b('0x31')][_0x535b('0x32')]};});_0x163cf7['model']=_[_0x535b('0x2e')](_0x470872,_0x535b('0x2c'));_0x163cf7['query']=_[_0x535b('0x33')](_0x2e66b3['query']);_0x163cf7['filters']=_[_0x535b('0x34')](_0x163cf7[_0x535b('0x35')],_0x163cf7['query']);_0x7d0715[_0x535b('0x36')]=_[_0x535b('0x34')](_0x163cf7[_0x535b('0x35')],qs[_0x535b('0x37')](_0x2e66b3[_0x535b('0x38')][_0x535b('0x37')]));_0x7d0715[_0x535b('0x36')]=_0x7d0715[_0x535b('0x36')]['length']?_0x7d0715[_0x535b('0x36')]:_0x163cf7[_0x535b('0x35')];if(!_0x2e66b3[_0x535b('0x38')][_0x535b('0x39')](_0x535b('0x3a'))){_0x7d0715[_0x535b('0x1f')]=qs['limit'](_0x2e66b3[_0x535b('0x38')][_0x535b('0x1f')]);_0x7d0715[_0x535b('0x1e')]=qs[_0x535b('0x1e')](_0x2e66b3['query'][_0x535b('0x1e')]);}_0x7d0715['order']=qs[_0x535b('0x3b')](_0x2e66b3[_0x535b('0x38')][_0x535b('0x3b')]);_0x7d0715[_0x535b('0x3c')]=qs[_0x535b('0x3d')](_[_0x535b('0x3e')](_0x2e66b3[_0x535b('0x38')],_0x163cf7['filters']),_0x470872);if(_0x2e66b3[_0x535b('0x38')][_0x535b('0x3f')]){_0x7d0715[_0x535b('0x3c')]=_[_0x535b('0x40')](_0x7d0715[_0x535b('0x3c')],{'$or':_[_0x535b('0x2e')](_0x470872,function(_0x59e1d2){if(_0x59e1d2[_0x535b('0x31')]!==_0x535b('0x41')){var _0x1fbe9e={};_0x1fbe9e[_0x59e1d2[_0x535b('0x2c')]]={'$like':'%'+_0x2e66b3[_0x535b('0x38')]['filter']+'%'};return _0x1fbe9e;}})});}_0x7d0715=_[_0x535b('0x40')]({},_0x7d0715,_0x2e66b3[_0x535b('0x42')]);var _0x2af0f1={'where':_0x7d0715[_0x535b('0x3c')]};return db['Campaign']['count'](_0x2af0f1)[_0x535b('0x25')](function(_0x42e22f){_0x3f8660[_0x535b('0x1d')]=_0x42e22f;if(_0x2e66b3[_0x535b('0x38')][_0x535b('0x43')]){_0x7d0715[_0x535b('0x44')]=[{'all':!![]}];}return db[_0x535b('0x2f')][_0x535b('0x45')](_0x7d0715);})[_0x535b('0x25')](function(_0x45c237){_0x3f8660[_0x535b('0x46')]=_0x45c237;return _0x3f8660;})[_0x535b('0x25')](respondWithFilteredResult(_0x3d2503,_0x7d0715))[_0x535b('0x47')](handleError(_0x3d2503,null));};exports['show']=function(_0x2e3d8f,_0x118e55){var _0x41482c={'raw':![],'where':{'id':_0x2e3d8f[_0x535b('0x48')]['id']}},_0xa35d86={};_0xa35d86[_0x535b('0x35')]=_[_0x535b('0x33')](db[_0x535b('0x2f')][_0x535b('0x30')]);_0xa35d86[_0x535b('0x38')]=_['keys'](_0x2e3d8f[_0x535b('0x38')]);_0xa35d86[_0x535b('0x3d')]=_[_0x535b('0x34')](_0xa35d86[_0x535b('0x35')],_0xa35d86['query']);_0x41482c[_0x535b('0x36')]=_[_0x535b('0x34')](_0xa35d86[_0x535b('0x35')],qs[_0x535b('0x37')](_0x2e3d8f[_0x535b('0x38')]['fields']));_0x41482c[_0x535b('0x36')]=_0x41482c[_0x535b('0x36')][_0x535b('0x49')]?_0x41482c[_0x535b('0x36')]:_0xa35d86[_0x535b('0x35')];if(_0x2e3d8f[_0x535b('0x38')]['includeAll']){_0x41482c[_0x535b('0x44')]=[{'all':!![]}];}_0x41482c=_[_0x535b('0x40')]({},_0x41482c,_0x2e3d8f[_0x535b('0x42')]);return db[_0x535b('0x2f')][_0x535b('0x4a')](_0x41482c)[_0x535b('0x25')](handleEntityNotFound(_0x118e55,null))[_0x535b('0x25')](respondWithResult(_0x118e55,null))[_0x535b('0x47')](handleError(_0x118e55,null));};exports[_0x535b('0x4b')]=function(_0x35e733,_0x57385b){return db[_0x535b('0x2f')][_0x535b('0x4b')](_0x35e733[_0x535b('0x4c')],{})[_0x535b('0x25')](function(_0xb64c55){var _0x5d2249=_0x35e733[_0x535b('0x4d')][_0x535b('0x27')]({'plain':!![]});if(!_0x5d2249)throw new Error(_0x535b('0x4e'));if(_0x5d2249[_0x535b('0x4f')]==='user'){var _0x43730b=_0xb64c55[_0x535b('0x27')]({'plain':!![]});var _0x27d821=_0x535b('0x28');return db[_0x535b('0x50')][_0x535b('0x4a')]({'where':{'name':_0x27d821,'userProfileId':_0x5d2249[_0x535b('0x51')]},'raw':!![]})[_0x535b('0x25')](function(_0x1962d2){if(_0x1962d2&&_0x1962d2[_0x535b('0x52')]===0x0){return db[_0x535b('0x29')][_0x535b('0x4b')]({'name':_0x43730b[_0x535b('0x2c')],'resourceId':_0x43730b['id'],'type':_0x1962d2[_0x535b('0x2c')],'sectionId':_0x1962d2['id']},{})[_0x535b('0x25')](function(){return _0xb64c55;});}else{return _0xb64c55;}})[_0x535b('0x47')](function(_0x566911){logger['error'](_0x535b('0x53'),_0x566911);throw _0x566911;});}return _0xb64c55;})[_0x535b('0x25')](respondWithResult(_0x57385b,0xc9))['catch'](handleError(_0x57385b,null));};exports[_0x535b('0x54')]=function(_0x4a5772,_0x18b154){var _0x13820a={'where':{'id':_0x4a5772[_0x535b('0x48')]['id']}},_0x4ee52d={};_0x4ee52d[_0x535b('0x35')]=_[_0x535b('0x33')](db['Campaign'][_0x535b('0x30')]);_0x13820a[_0x535b('0x36')]=_[_0x535b('0x34')](_0x4ee52d[_0x535b('0x35')],qs[_0x535b('0x37')](_0x4a5772[_0x535b('0x38')][_0x535b('0x37')]));_0x13820a['attributes']=_0x13820a['attributes'][_0x535b('0x49')]?_0x13820a[_0x535b('0x36')]:_0x4ee52d[_0x535b('0x35')];if(_0x4a5772[_0x535b('0x38')][_0x535b('0x43')]){_0x13820a[_0x535b('0x44')]=[{'all':!![]}];}_0x13820a=_[_0x535b('0x40')]({},_0x13820a,_0x4a5772[_0x535b('0x42')]);return db[_0x535b('0x2f')][_0x535b('0x4a')](_0x13820a)['then'](handleEntityNotFound(_0x18b154,null))['then'](function(_0x5e04d1){if(_0x5e04d1){var _0x34d420=_0x5e04d1['get']({'plain':!![]});_0x34d420=qs[_0x535b('0x55')](_0x34d420,['id',_0x535b('0x56'),_0x535b('0x57')]);_0x4a5772[_0x535b('0x4c')]=_['omit'](_0x4a5772[_0x535b('0x4c')],['id','createdAt','updatedAt']);return db[_0x535b('0x2f')][_0x535b('0x4b')](_[_0x535b('0x40')](_0x34d420,_0x4a5772['body']),{'include':_0x4a5772['query'][_0x535b('0x43')]?[{'all':!![]}]:undefined})[_0x535b('0x25')](function(_0x3a1b48){var _0x121e58=_0x4a5772[_0x535b('0x4d')][_0x535b('0x27')]({'plain':!![]});if(!_0x121e58)throw new Error(_0x535b('0x4e'));if(_0x121e58[_0x535b('0x4f')]===_0x535b('0x4d')){var _0xb91e35=_0x3a1b48[_0x535b('0x27')]({'plain':!![]});var _0x2a77c9=_0x535b('0x28');return db[_0x535b('0x50')]['find']({'where':{'name':_0x2a77c9,'userProfileId':_0x121e58[_0x535b('0x51')]},'raw':!![]})['then'](function(_0x3d875e){if(_0x3d875e&&_0x3d875e[_0x535b('0x52')]===0x0){return db[_0x535b('0x29')]['create']({'name':_0xb91e35[_0x535b('0x2c')],'resourceId':_0xb91e35['id'],'type':_0x3d875e[_0x535b('0x2c')],'sectionId':_0x3d875e['id']},{})[_0x535b('0x25')](function(){return _0x3a1b48;});}else{return _0x3a1b48;}})['catch'](function(_0x13291c){logger[_0x535b('0x2b')](_0x535b('0x53'),_0x13291c);throw _0x13291c;});}return _0x3a1b48;});}})[_0x535b('0x25')](respondWithResult(_0x18b154,0xc9))['catch'](handleError(_0x18b154,null));};exports[_0x535b('0x24')]=function(_0x5545ca,_0x3058d4){if(_0x5545ca[_0x535b('0x4c')]['id']){delete _0x5545ca['body']['id'];}return db[_0x535b('0x2f')][_0x535b('0x4a')]({'where':{'id':_0x5545ca['params']['id']}})[_0x535b('0x25')](handleEntityNotFound(_0x3058d4,null))[_0x535b('0x25')](saveUpdates(_0x5545ca[_0x535b('0x4c')],null))[_0x535b('0x25')](respondWithResult(_0x3058d4,null))[_0x535b('0x47')](handleError(_0x3058d4,null));};exports[_0x535b('0x26')]=function(_0x586d75,_0x4803cd){return db[_0x535b('0x2f')][_0x535b('0x4a')]({'where':{'id':_0x586d75[_0x535b('0x48')]['id']}})[_0x535b('0x25')](handleEntityNotFound(_0x4803cd,null))['then'](removeEntity(_0x4803cd,null))[_0x535b('0x47')](handleError(_0x4803cd,null));};exports['getHoppers']=function(_0x3562ac,_0x3e5b50,_0x182e53){var _0x753604={'raw':!![],'where':{}};var _0x437e60={};var _0x380865={'count':0x0,'rows':[]};return db[_0x535b('0x2f')][_0x535b('0x58')]({'where':{'id':_0x3562ac[_0x535b('0x48')]['id']}})[_0x535b('0x25')](handleEntityNotFound(_0x3e5b50,null))[_0x535b('0x25')](function(_0x1cf7ba){if(_0x1cf7ba){_0x437e60['model']=_[_0x535b('0x33')](db['CmHopper'][_0x535b('0x30')]);_0x437e60[_0x535b('0x38')]=_[_0x535b('0x33')](_0x3562ac[_0x535b('0x38')]);_0x437e60[_0x535b('0x3d')]=_[_0x535b('0x34')](_0x437e60[_0x535b('0x35')],_0x437e60[_0x535b('0x38')]);_0x753604[_0x535b('0x36')]=_[_0x535b('0x34')](_0x437e60[_0x535b('0x35')],qs[_0x535b('0x37')](_0x3562ac[_0x535b('0x38')][_0x535b('0x37')]));_0x753604[_0x535b('0x36')]=_0x753604['attributes'][_0x535b('0x49')]?_0x753604['attributes']:_0x437e60['model'];if(!_0x3562ac[_0x535b('0x38')]['hasOwnProperty'](_0x535b('0x3a'))){_0x753604[_0x535b('0x1f')]=qs[_0x535b('0x1f')](_0x3562ac['query'][_0x535b('0x1f')]);_0x753604[_0x535b('0x1e')]=qs[_0x535b('0x1e')](_0x3562ac[_0x535b('0x38')][_0x535b('0x1e')]);}_0x753604[_0x535b('0x59')]=qs[_0x535b('0x3b')](_0x3562ac[_0x535b('0x38')][_0x535b('0x3b')]);_0x753604['where']=qs['filters'](_[_0x535b('0x3e')](_0x3562ac[_0x535b('0x38')],_0x437e60['filters']));_0x753604[_0x535b('0x3c')]['CampaignId']=_0x1cf7ba['id'];if(_0x3562ac[_0x535b('0x38')]['filter']){_0x753604[_0x535b('0x3c')]=_[_0x535b('0x40')](_0x753604['where'],{'$or':_[_0x535b('0x2e')](_0x753604['attributes'],function(_0x4d40ff){var _0x597587={};_0x597587[_0x4d40ff]={'$like':'%'+_0x3562ac[_0x535b('0x38')][_0x535b('0x3f')]+'%'};return _0x597587;})});}_0x753604=_['merge']({},_0x753604,_0x3562ac[_0x535b('0x42')]);return db[_0x535b('0x5a')]['count']({'where':_0x753604[_0x535b('0x3c')]})[_0x535b('0x25')](function(_0x11c5d7){_0x380865[_0x535b('0x1d')]=_0x11c5d7;if(_0x3562ac[_0x535b('0x38')][_0x535b('0x43')]){_0x753604['include']=[{'all':!![]}];}return db[_0x535b('0x5a')]['findAll'](_0x753604);})[_0x535b('0x25')](function(_0x38bc1e){_0x380865[_0x535b('0x46')]=_0x38bc1e;return _0x380865;});}})['then'](respondWithFilteredResult(_0x3e5b50,_0x753604))[_0x535b('0x47')](handleError(_0x3e5b50,null));};exports[_0x535b('0x5b')]=function(_0x52b5c7,_0x4bfb58,_0x476cef){var _0x3f653a={'raw':!![],'where':{}};var _0x1ae177={};var _0x130b60={'count':0x0,'rows':[]};return db['Campaign'][_0x535b('0x58')]({'where':{'id':_0x52b5c7[_0x535b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4bfb58,null))['then'](function(_0x2666be){if(_0x2666be){_0x1ae177['model']=_['keys'](db[_0x535b('0x5c')][_0x535b('0x30')]);_0x1ae177['query']=_['keys'](_0x52b5c7[_0x535b('0x38')]);_0x1ae177[_0x535b('0x3d')]=_[_0x535b('0x34')](_0x1ae177[_0x535b('0x35')],_0x1ae177[_0x535b('0x38')]);_0x3f653a['attributes']=_['intersection'](_0x1ae177['model'],qs[_0x535b('0x37')](_0x52b5c7[_0x535b('0x38')][_0x535b('0x37')]));_0x3f653a[_0x535b('0x36')]=_0x3f653a[_0x535b('0x36')][_0x535b('0x49')]?_0x3f653a[_0x535b('0x36')]:_0x1ae177[_0x535b('0x35')];if(!_0x52b5c7[_0x535b('0x38')][_0x535b('0x39')](_0x535b('0x3a'))){_0x3f653a[_0x535b('0x1f')]=qs[_0x535b('0x1f')](_0x52b5c7[_0x535b('0x38')][_0x535b('0x1f')]);_0x3f653a[_0x535b('0x1e')]=qs[_0x535b('0x1e')](_0x52b5c7[_0x535b('0x38')][_0x535b('0x1e')]);}_0x3f653a[_0x535b('0x59')]=qs[_0x535b('0x3b')](_0x52b5c7[_0x535b('0x38')]['sort']);_0x3f653a[_0x535b('0x3c')]=qs[_0x535b('0x3d')](_[_0x535b('0x3e')](_0x52b5c7[_0x535b('0x38')],_0x1ae177[_0x535b('0x3d')]));_0x3f653a[_0x535b('0x3c')][_0x535b('0x5d')]=_0x2666be['id'];if(_0x52b5c7[_0x535b('0x38')]['filter']){_0x3f653a[_0x535b('0x3c')]=_[_0x535b('0x40')](_0x3f653a[_0x535b('0x3c')],{'$or':_['map'](_0x3f653a['attributes'],function(_0x561d17){var _0x5377d0={};_0x5377d0[_0x561d17]={'$like':'%'+_0x52b5c7[_0x535b('0x38')][_0x535b('0x3f')]+'%'};return _0x5377d0;})});}_0x3f653a=_[_0x535b('0x40')]({},_0x3f653a,_0x52b5c7[_0x535b('0x42')]);return db[_0x535b('0x5c')][_0x535b('0x1d')]({'where':_0x3f653a['where']})[_0x535b('0x25')](function(_0x3122db){_0x130b60[_0x535b('0x1d')]=_0x3122db;if(_0x52b5c7[_0x535b('0x38')][_0x535b('0x43')]){_0x3f653a[_0x535b('0x44')]=[{'all':!![]}];}return db[_0x535b('0x5c')][_0x535b('0x45')](_0x3f653a);})['then'](function(_0x1be315){_0x130b60[_0x535b('0x46')]=_0x1be315;return _0x130b60;});}})[_0x535b('0x25')](respondWithFilteredResult(_0x4bfb58,_0x3f653a))[_0x535b('0x47')](handleError(_0x4bfb58,null));};exports[_0x535b('0x5e')]=function(_0x3e304a,_0x40ff90,_0x46c83f){var _0x536c6d={'raw':!![],'where':{}};var _0x20cecb={};var _0x4fde30={'count':0x0,'rows':[]};return db[_0x535b('0x2f')][_0x535b('0x58')]({'where':{'id':_0x3e304a[_0x535b('0x48')]['id']}})[_0x535b('0x25')](handleEntityNotFound(_0x40ff90,null))['then'](function(_0x49001e){if(_0x49001e){_0x20cecb[_0x535b('0x35')]=_['keys'](db[_0x535b('0x5f')][_0x535b('0x30')]);_0x20cecb['query']=_[_0x535b('0x33')](_0x3e304a[_0x535b('0x38')]);_0x20cecb[_0x535b('0x3d')]=_['intersection'](_0x20cecb[_0x535b('0x35')],_0x20cecb[_0x535b('0x38')]);_0x536c6d[_0x535b('0x36')]=_[_0x535b('0x34')](_0x20cecb[_0x535b('0x35')],qs[_0x535b('0x37')](_0x3e304a[_0x535b('0x38')]['fields']));_0x536c6d[_0x535b('0x36')]=_0x536c6d['attributes'][_0x535b('0x49')]?_0x536c6d[_0x535b('0x36')]:_0x20cecb[_0x535b('0x35')];if(!_0x3e304a['query'][_0x535b('0x39')](_0x535b('0x3a'))){_0x536c6d['limit']=qs[_0x535b('0x1f')](_0x3e304a[_0x535b('0x38')][_0x535b('0x1f')]);_0x536c6d['offset']=qs[_0x535b('0x1e')](_0x3e304a[_0x535b('0x38')][_0x535b('0x1e')]);}_0x536c6d[_0x535b('0x59')]=qs[_0x535b('0x3b')](_0x3e304a[_0x535b('0x38')][_0x535b('0x3b')]);_0x536c6d[_0x535b('0x3c')]=qs[_0x535b('0x3d')](_[_0x535b('0x3e')](_0x3e304a[_0x535b('0x38')],_0x20cecb[_0x535b('0x3d')]));_0x536c6d[_0x535b('0x3c')][_0x535b('0x5d')]=_0x49001e['id'];if(_0x3e304a['query'][_0x535b('0x3f')]){_0x536c6d[_0x535b('0x3c')]=_[_0x535b('0x40')](_0x536c6d[_0x535b('0x3c')],{'$or':_[_0x535b('0x2e')](_0x536c6d[_0x535b('0x36')],function(_0x6287f4){var _0x3ea6d3={};_0x3ea6d3[_0x6287f4]={'$like':'%'+_0x3e304a[_0x535b('0x38')][_0x535b('0x3f')]+'%'};return _0x3ea6d3;})});}_0x536c6d=_['merge']({},_0x536c6d,_0x3e304a[_0x535b('0x42')]);return db[_0x535b('0x5f')][_0x535b('0x1d')]({'where':_0x536c6d[_0x535b('0x3c')]})[_0x535b('0x25')](function(_0x20e67a){_0x4fde30[_0x535b('0x1d')]=_0x20e67a;if(_0x3e304a[_0x535b('0x38')][_0x535b('0x43')]){_0x536c6d[_0x535b('0x44')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x535b('0x45')](_0x536c6d);})[_0x535b('0x25')](function(_0x17f07e){_0x4fde30[_0x535b('0x46')]=_0x17f07e;return _0x4fde30;});}})[_0x535b('0x25')](respondWithFilteredResult(_0x40ff90,_0x536c6d))[_0x535b('0x47')](handleError(_0x40ff90,null));};exports[_0x535b('0x60')]=function(_0x358785,_0x520a17,_0x55ad61){var _0x1dbd04={'raw':!![],'where':{}};var _0x40683b={};var _0x3afb82={'count':0x0,'rows':[]};return db[_0x535b('0x2f')]['findOne']({'where':{'id':_0x358785[_0x535b('0x48')]['id']}})[_0x535b('0x25')](handleEntityNotFound(_0x520a17,null))['then'](function(_0x22297c){if(_0x22297c){_0x40683b['model']=_['keys'](db[_0x535b('0x61')][_0x535b('0x30')]);_0x40683b[_0x535b('0x38')]=_['keys'](_0x358785[_0x535b('0x38')]);_0x40683b['filters']=_[_0x535b('0x34')](_0x40683b[_0x535b('0x35')],_0x40683b[_0x535b('0x38')]);_0x1dbd04['attributes']=_[_0x535b('0x34')](_0x40683b['model'],qs[_0x535b('0x37')](_0x358785[_0x535b('0x38')][_0x535b('0x37')]));_0x1dbd04[_0x535b('0x36')]=_0x1dbd04[_0x535b('0x36')][_0x535b('0x49')]?_0x1dbd04[_0x535b('0x36')]:_0x40683b[_0x535b('0x35')];if(!_0x358785[_0x535b('0x38')][_0x535b('0x39')]('nolimit')){_0x1dbd04[_0x535b('0x1f')]=qs[_0x535b('0x1f')](_0x358785[_0x535b('0x38')][_0x535b('0x1f')]);_0x1dbd04[_0x535b('0x1e')]=qs[_0x535b('0x1e')](_0x358785['query'][_0x535b('0x1e')]);}_0x1dbd04[_0x535b('0x59')]=qs[_0x535b('0x3b')](_0x358785[_0x535b('0x38')][_0x535b('0x3b')]);_0x1dbd04[_0x535b('0x3c')]=qs[_0x535b('0x3d')](_['pick'](_0x358785[_0x535b('0x38')],_0x40683b[_0x535b('0x3d')]));_0x1dbd04[_0x535b('0x3c')][_0x535b('0x5d')]=_0x22297c['id'];if(_0x358785[_0x535b('0x38')][_0x535b('0x3f')]){_0x1dbd04[_0x535b('0x3c')]=_[_0x535b('0x40')](_0x1dbd04[_0x535b('0x3c')],{'$or':_[_0x535b('0x2e')](_0x1dbd04['attributes'],function(_0x4f9731){var _0x45c82e={};_0x45c82e[_0x4f9731]={'$like':'%'+_0x358785['query']['filter']+'%'};return _0x45c82e;})});}_0x1dbd04=_[_0x535b('0x40')]({},_0x1dbd04,_0x358785[_0x535b('0x42')]);return db['CmHopperBlack'][_0x535b('0x1d')]({'where':_0x1dbd04['where']})[_0x535b('0x25')](function(_0x5096a7){_0x3afb82[_0x535b('0x1d')]=_0x5096a7;if(_0x358785[_0x535b('0x38')][_0x535b('0x43')]){_0x1dbd04[_0x535b('0x44')]=[{'all':!![]}];}return db[_0x535b('0x61')][_0x535b('0x45')](_0x1dbd04);})[_0x535b('0x25')](function(_0x447653){_0x3afb82[_0x535b('0x46')]=_0x447653;return _0x3afb82;});}})[_0x535b('0x25')](respondWithFilteredResult(_0x520a17,_0x1dbd04))[_0x535b('0x47')](handleError(_0x520a17,null));};exports[_0x535b('0x62')]=function(_0x30a395,_0x418968,_0x5dcf0d){var _0x2752d8={};var _0x82b0b0={};var _0x5d3c10;var _0x9be1f3;return db[_0x535b('0x2f')][_0x535b('0x58')]({'where':{'id':_0x30a395[_0x535b('0x48')]['id']}})[_0x535b('0x25')](handleEntityNotFound(_0x418968,null))[_0x535b('0x25')](function(_0x2c8ce2){if(_0x2c8ce2){_0x5d3c10=_0x2c8ce2;_0x82b0b0[_0x535b('0x35')]=_[_0x535b('0x33')](db[_0x535b('0x63')][_0x535b('0x30')]);_0x82b0b0[_0x535b('0x38')]=_[_0x535b('0x33')](_0x30a395[_0x535b('0x38')]);_0x82b0b0['filters']=_[_0x535b('0x34')](_0x82b0b0['model'],_0x82b0b0[_0x535b('0x38')]);_0x2752d8[_0x535b('0x36')]=_['intersection'](_0x82b0b0[_0x535b('0x35')],qs[_0x535b('0x37')](_0x30a395[_0x535b('0x38')][_0x535b('0x37')]));_0x2752d8[_0x535b('0x36')]=_0x2752d8[_0x535b('0x36')][_0x535b('0x49')]?_0x2752d8[_0x535b('0x36')]:_0x82b0b0['model'];_0x2752d8['order']=qs['sort'](_0x30a395[_0x535b('0x38')][_0x535b('0x3b')]);_0x2752d8[_0x535b('0x3c')]=qs[_0x535b('0x3d')](_[_0x535b('0x3e')](_0x30a395[_0x535b('0x38')],_0x82b0b0[_0x535b('0x3d')]));if(_0x30a395[_0x535b('0x38')][_0x535b('0x3f')]){_0x2752d8['where']=_[_0x535b('0x40')](_0x2752d8[_0x535b('0x3c')],{'$or':_[_0x535b('0x2e')](_0x2752d8[_0x535b('0x36')],function(_0x8842ee){var _0x3a3e07={};_0x3a3e07[_0x8842ee]={'$like':'%'+_0x30a395[_0x535b('0x38')][_0x535b('0x3f')]+'%'};return _0x3a3e07;})});}_0x2752d8=_[_0x535b('0x40')]({},_0x2752d8,_0x30a395[_0x535b('0x42')]);return _0x5d3c10[_0x535b('0x62')](_0x2752d8);}})['then'](function(_0x385aab){if(_0x385aab){_0x9be1f3=_0x385aab[_0x535b('0x49')];if(!_0x30a395[_0x535b('0x38')][_0x535b('0x39')]('nolimit')){_0x2752d8[_0x535b('0x1f')]=qs['limit'](_0x30a395['query'][_0x535b('0x1f')]);_0x2752d8['offset']=qs[_0x535b('0x1e')](_0x30a395['query']['offset']);}return _0x5d3c10[_0x535b('0x62')](_0x2752d8);}})[_0x535b('0x25')](function(_0x254fc7){if(_0x254fc7){return _0x254fc7?{'count':_0x9be1f3,'rows':_0x254fc7}:null;}})['then'](respondWithResult(_0x418968,null))[_0x535b('0x47')](handleError(_0x418968,null));};exports[_0x535b('0x64')]=function(_0x398efa,_0x19c050,_0x8daeaf){var _0x2db342,_0x5834a9;return db[_0x535b('0x2f')]['find']({'where':{'id':_0x398efa[_0x535b('0x48')]['id']}})[_0x535b('0x25')](handleEntityNotFound(_0x19c050,null))[_0x535b('0x25')](function(_0x33c42a){if(_0x33c42a){_0x5834a9=_0x33c42a;return _0x33c42a[_0x535b('0x64')](_0x398efa['body'][_0x535b('0x65')],_[_0x535b('0x55')](_0x398efa[_0x535b('0x4c')],[_0x535b('0x65'),'id'])||{});}return null;})[_0x535b('0x66')](function(_0x2809cc){var _0x57f02d;_0x2db342=_0x2809cc||[];var _0x3ea9a5=[];if(_0x2809cc){for(var _0x12142f=0x0;_0x12142f<_0x2809cc[_0x535b('0x49')];_0x12142f+=0x1){var _0x31380a=_0x2809cc[_0x12142f][_0x535b('0x27')]({'plain':!![]});_0x5834a9[_0x535b('0x67')]=_0x398efa[_0x535b('0x4c')][_0x535b('0x67')]?_0x398efa[_0x535b('0x4c')][_0x535b('0x67')]:_0x5834a9[_0x535b('0x67')];switch(_0x5834a9['dialCheckDuplicateType']){case _0x535b('0x68'):_0x57f02d=squel['insert']()[_0x535b('0x69')]('cm_hopper')[_0x535b('0x6a')]([_0x535b('0x6b'),_0x535b('0x6c'),_0x535b('0x6d'),_0x535b('0x6e'),_0x535b('0x5d'),_0x535b('0x56'),'updatedAt'],squel[_0x535b('0x6f')]()[_0x535b('0x70')](_0x535b('0x6b'),_0x535b('0x6b'))[_0x535b('0x70')]('NOW()',_0x535b('0x6c'))[_0x535b('0x70')]('id',_0x535b('0x6d'))['field'](_0x31380a[_0x535b('0x71')][_0x535b('0x72')](),_0x535b('0x6e'))[_0x535b('0x70')](_0x398efa[_0x535b('0x48')]['id'][_0x535b('0x72')](),_0x535b('0x5d'))[_0x535b('0x70')](_0x535b('0x73'),_0x535b('0x56'))['field']('NOW()',_0x535b('0x57'))[_0x535b('0x74')](_0x535b('0x75'))[_0x535b('0x3c')](_0x535b('0x76'))[_0x535b('0x3c')](_0x535b('0x77'),_0x31380a['CmListId']['toString']())[_0x535b('0x3c')](_0x535b('0x78'))[_0x535b('0x3c')](_0x535b('0x79'),squel[_0x535b('0x6f')]()[_0x535b('0x70')]('COALESCE(calleridnum,\x27\x27)')[_0x535b('0x74')]('cm_hopper_final')['where'](_0x535b('0x7a'),_0x398efa['params']['id'][_0x535b('0x72')]()))[_0x535b('0x3c')](_0x535b('0x79'),squel[_0x535b('0x6f')]()['field']('COALESCE(phone,\x27\x27)')[_0x535b('0x74')](_0x535b('0x7b'))[_0x535b('0x3c')](_0x535b('0x7a'),_0x398efa['params']['id']['toString']())))['toString']();break;case _0x535b('0x7c'):_0x57f02d=squel[_0x535b('0x7d')]()[_0x535b('0x69')](_0x535b('0x7b'))[_0x535b('0x6a')]([_0x535b('0x6b'),_0x535b('0x6c'),'ContactId',_0x535b('0x6e'),_0x535b('0x5d'),_0x535b('0x56'),_0x535b('0x57')],squel[_0x535b('0x6f')]()[_0x535b('0x70')](_0x535b('0x6b'),_0x535b('0x6b'))[_0x535b('0x70')](_0x535b('0x73'),_0x535b('0x6c'))[_0x535b('0x70')]('id',_0x535b('0x6d'))[_0x535b('0x70')](_0x31380a['CmListId'][_0x535b('0x72')](),'ListId')[_0x535b('0x70')](_0x398efa[_0x535b('0x48')]['id'][_0x535b('0x72')](),'CampaignId')[_0x535b('0x70')](_0x535b('0x73'),_0x535b('0x56'))[_0x535b('0x70')](_0x535b('0x73'),_0x535b('0x57'))['from'](_0x535b('0x75'))['where'](_0x535b('0x76'))[_0x535b('0x3c')](_0x535b('0x77'),_0x31380a[_0x535b('0x71')][_0x535b('0x72')]())[_0x535b('0x3c')](_0x535b('0x78'))[_0x535b('0x3c')](_0x535b('0x79'),squel[_0x535b('0x6f')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x535b('0x7b'))[_0x535b('0x3c')](_0x535b('0x7a'),_0x398efa[_0x535b('0x48')]['id'][_0x535b('0x72')]())))[_0x535b('0x72')]();break;default:_0x57f02d=squel[_0x535b('0x7d')]()[_0x535b('0x69')](_0x535b('0x7b'))[_0x535b('0x6a')]([_0x535b('0x6b'),_0x535b('0x6c'),_0x535b('0x6d'),_0x535b('0x6e'),'CampaignId','createdAt',_0x535b('0x57')],squel[_0x535b('0x6f')]()[_0x535b('0x70')](_0x535b('0x6b'),_0x535b('0x6b'))[_0x535b('0x70')](_0x535b('0x73'),_0x535b('0x6c'))['field']('id',_0x535b('0x6d'))[_0x535b('0x70')](_0x31380a[_0x535b('0x71')][_0x535b('0x72')](),_0x535b('0x6e'))[_0x535b('0x70')](_0x398efa[_0x535b('0x48')]['id'][_0x535b('0x72')](),_0x535b('0x5d'))[_0x535b('0x70')](_0x535b('0x73'),'createdAt')['field'](_0x535b('0x73'),'updatedAt')[_0x535b('0x74')]('cm_contacts')['where'](_0x535b('0x76'))['where'](_0x535b('0x77'),_0x31380a['CmListId'][_0x535b('0x72')]())['where'](_0x535b('0x78')))[_0x535b('0x72')]();}_0x3ea9a5[_0x535b('0x7e')](db['sequelize'][_0x535b('0x38')](_0x57f02d));}return BPromise[_0x535b('0x7f')](_0x3ea9a5);}})[_0x535b('0x25')](function(){return _0x2db342;})[_0x535b('0x25')](respondWithResult(_0x19c050,null))['catch'](handleError(_0x19c050,null));};exports['removeLists']=function(_0x2dd75d,_0x4d1bb5,_0x218833){return db[_0x535b('0x2f')]['find']({'where':{'id':_0x2dd75d[_0x535b('0x48')]['id']}})[_0x535b('0x25')](handleEntityNotFound(_0x4d1bb5,null))[_0x535b('0x25')](function(_0x2a5410){if(_0x2a5410){return _0x2a5410['removeLists'](_0x2dd75d['query'][_0x535b('0x65')]);}})[_0x535b('0x25')](function(_0x52885a){if(_0x52885a){return db[_0x535b('0x5a')][_0x535b('0x26')]({'where':{'ListId':_0x2dd75d['query'][_0x535b('0x65')],'CampaignId':_0x2dd75d[_0x535b('0x48')]['id']}})[_0x535b('0x25')](function(){return _0x52885a;});}})[_0x535b('0x25')](respondWithStatusCode(_0x4d1bb5,null))[_0x535b('0x47')](handleError(_0x4d1bb5,null));};exports[_0x535b('0x80')]=function(_0x14c9ae,_0x2908fb,_0x413d86){var _0x6494de={};var _0x4d18d3={};var _0x258485;var _0x2ac2e9;return db['Campaign'][_0x535b('0x58')]({'where':{'id':_0x14c9ae[_0x535b('0x48')]['id']}})[_0x535b('0x25')](handleEntityNotFound(_0x2908fb,null))[_0x535b('0x25')](function(_0x3a7566){if(_0x3a7566){_0x258485=_0x3a7566;_0x4d18d3['model']=_[_0x535b('0x33')](db[_0x535b('0x63')][_0x535b('0x30')]);_0x4d18d3['query']=_[_0x535b('0x33')](_0x14c9ae[_0x535b('0x38')]);_0x4d18d3['filters']=_[_0x535b('0x34')](_0x4d18d3[_0x535b('0x35')],_0x4d18d3[_0x535b('0x38')]);_0x6494de[_0x535b('0x36')]=_['intersection'](_0x4d18d3[_0x535b('0x35')],qs['fields'](_0x14c9ae['query'][_0x535b('0x37')]));_0x6494de['attributes']=_0x6494de[_0x535b('0x36')][_0x535b('0x49')]?_0x6494de['attributes']:_0x4d18d3[_0x535b('0x35')];_0x6494de[_0x535b('0x59')]=qs[_0x535b('0x3b')](_0x14c9ae[_0x535b('0x38')][_0x535b('0x3b')]);_0x6494de['where']=qs[_0x535b('0x3d')](_[_0x535b('0x3e')](_0x14c9ae[_0x535b('0x38')],_0x4d18d3['filters']));if(_0x14c9ae[_0x535b('0x38')][_0x535b('0x3f')]){_0x6494de[_0x535b('0x3c')]=_[_0x535b('0x40')](_0x6494de[_0x535b('0x3c')],{'$or':_['map'](_0x6494de[_0x535b('0x36')],function(_0x3def9f){var _0x3107cb={};_0x3107cb[_0x3def9f]={'$like':'%'+_0x14c9ae['query'][_0x535b('0x3f')]+'%'};return _0x3107cb;})});}_0x6494de=_[_0x535b('0x40')]({},_0x6494de,_0x14c9ae['options']);return _0x258485[_0x535b('0x80')](_0x6494de);}})[_0x535b('0x25')](function(_0x206edf){if(_0x206edf){_0x2ac2e9=_0x206edf[_0x535b('0x49')];if(!_0x14c9ae[_0x535b('0x38')][_0x535b('0x39')](_0x535b('0x3a'))){_0x6494de[_0x535b('0x1f')]=qs[_0x535b('0x1f')](_0x14c9ae[_0x535b('0x38')][_0x535b('0x1f')]);_0x6494de[_0x535b('0x1e')]=qs['offset'](_0x14c9ae['query'][_0x535b('0x1e')]);}return _0x258485[_0x535b('0x80')](_0x6494de);}})[_0x535b('0x25')](function(_0x38e8e7){if(_0x38e8e7){return _0x38e8e7?{'count':_0x2ac2e9,'rows':_0x38e8e7}:null;}})[_0x535b('0x25')](respondWithResult(_0x2908fb,null))[_0x535b('0x47')](handleError(_0x2908fb,null));};exports[_0x535b('0x81')]=function(_0x4960da,_0x20d795,_0x596b0c){var _0x116b43,_0x74cc52;return db[_0x535b('0x2f')]['find']({'where':{'id':_0x4960da[_0x535b('0x48')]['id']}})[_0x535b('0x25')](handleEntityNotFound(_0x20d795,null))[_0x535b('0x25')](function(_0x566721){if(_0x566721){_0x74cc52=_0x566721;return _0x566721[_0x535b('0x81')](_0x4960da['body'][_0x535b('0x65')],_[_0x535b('0x55')](_0x4960da['body'],[_0x535b('0x65'),'id'])||{});}return null;})['spread'](function(_0x56edd0){var _0x227835;_0x116b43=_0x56edd0||[];var _0x1e9813=[];if(_0x56edd0){for(var _0x131ae2=0x0;_0x131ae2<_0x56edd0[_0x535b('0x49')];_0x131ae2+=0x1){var _0x451b66=_0x56edd0[_0x131ae2][_0x535b('0x27')]({'plain':!![]});_0x227835=squel[_0x535b('0x7d')]()[_0x535b('0x69')]('cm_hopper_black')[_0x535b('0x6a')]([_0x535b('0x6b'),_0x535b('0x6d'),_0x535b('0x6e'),_0x535b('0x5d'),_0x535b('0x56'),'updatedAt'],squel[_0x535b('0x6f')]()[_0x535b('0x70')](_0x535b('0x6b'),'phone')[_0x535b('0x70')]('id',_0x535b('0x6d'))[_0x535b('0x70')](_0x451b66[_0x535b('0x71')][_0x535b('0x72')](),_0x535b('0x6e'))[_0x535b('0x70')](_0x4960da[_0x535b('0x48')]['id'][_0x535b('0x72')](),_0x535b('0x5d'))['field'](_0x535b('0x73'),_0x535b('0x56'))[_0x535b('0x70')](_0x535b('0x73'),_0x535b('0x57'))[_0x535b('0x74')](_0x535b('0x75'))['where']('deletedAt\x20IS\x20NULL')[_0x535b('0x3c')](_0x535b('0x77'),_0x451b66[_0x535b('0x71')][_0x535b('0x72')]())['where'](_0x535b('0x78')))['toString']();_0x1e9813[_0x535b('0x7e')](db['sequelize']['query'](_0x227835));}return BPromise[_0x535b('0x7f')](_0x1e9813);}})[_0x535b('0x25')](function(){return _0x116b43;})[_0x535b('0x25')](respondWithResult(_0x20d795,null))[_0x535b('0x47')](handleError(_0x20d795,null));};exports['removeBlackLists']=function(_0x1dece4,_0x1c8c19,_0x1d2541){return db[_0x535b('0x2f')][_0x535b('0x4a')]({'where':{'id':_0x1dece4[_0x535b('0x48')]['id']}})[_0x535b('0x25')](handleEntityNotFound(_0x1c8c19,null))[_0x535b('0x25')](function(_0x30107d){if(_0x30107d){return _0x30107d[_0x535b('0x82')](_0x1dece4['query'][_0x535b('0x65')]);}})[_0x535b('0x25')](function(_0x4e70f3){if(_0x4e70f3){return db['CmHopperBlack'][_0x535b('0x26')]({'where':{'ListId':_0x1dece4[_0x535b('0x38')][_0x535b('0x65')],'CampaignId':_0x1dece4[_0x535b('0x48')]['id']}})[_0x535b('0x25')](function(){return _0x4e70f3;});}})[_0x535b('0x25')](respondWithStatusCode(_0x1c8c19,null))[_0x535b('0x47')](handleError(_0x1c8c19,null));}; \ No newline at end of file +var _0x2b3b=['sequelize','removeBlackLists','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','Campaign','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','userProfileId','getHoppers','findOne','CmHopper','map','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','CampaignId','select','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','push','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black'];(function(_0x2086cd,_0x293b65){var _0x4cd671=function(_0x23d153){while(--_0x23d153){_0x2086cd['push'](_0x2086cd['shift']());}};_0x4cd671(++_0x293b65);}(_0x2b3b,0x83));var _0xb2b3=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x2b3b[_0x1b2ff7];return _0x31656a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb2b3('0x0'));var jsonpatch=require(_0xb2b3('0x1'));var rp=require('request-promise');var moment=require(_0xb2b3('0x2'));var BPromise=require(_0xb2b3('0x3'));var Mustache=require(_0xb2b3('0x4'));var util=require(_0xb2b3('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb2b3('0x6'));var ejs=require(_0xb2b3('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb2b3('0x8'));var crypto=require('crypto');var jsforce=require(_0xb2b3('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xb2b3('0x6'));var querystring=require(_0xb2b3('0xa'));var Papa=require(_0xb2b3('0xb'));var Redis=require('ioredis');var authService=require(_0xb2b3('0xc'));var qs=require(_0xb2b3('0xd'));var as=require(_0xb2b3('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2b3('0xf'))('api');var utils=require(_0xb2b3('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xb2b3('0x11'));var db=require(_0xb2b3('0x12'))['db'];function respondWithStatusCode(_0xb3218d,_0x55eefa){_0x55eefa=_0x55eefa||0xcc;return function(_0x58cfbc){if(_0x58cfbc){return _0xb3218d[_0xb2b3('0x13')](_0x55eefa);}return _0xb3218d['status'](_0x55eefa)[_0xb2b3('0x14')]();};}function respondWithResult(_0x5b75b4,_0x4e05e7){_0x4e05e7=_0x4e05e7||0xc8;return function(_0x3f62c1){if(_0x3f62c1){return _0x5b75b4['status'](_0x4e05e7)[_0xb2b3('0x15')](_0x3f62c1);}};}function respondWithFilteredResult(_0x39f515,_0x378db1){return function(_0x54972d){if(_0x54972d){var _0x2065ef=_0x54972d[_0xb2b3('0x16')],_0x49509f=_0x378db1[_0xb2b3('0x17')],_0x2711a7=_0x378db1[_0xb2b3('0x17')]+_0x378db1['limit'],_0x19c88f;if(_0x2711a7>=_0x2065ef){_0x2711a7=_0x2065ef;_0x19c88f=0xc8;}else{_0x19c88f=0xce;}_0x39f515[_0xb2b3('0x18')](_0x19c88f);return _0x39f515['set'](_0xb2b3('0x19'),_0x49509f+'-'+_0x2711a7+'/'+_0x2065ef)[_0xb2b3('0x15')](_0x54972d);}return null;};}function patchUpdates(_0x5c9b48){return function(_0x46c760){try{jsonpatch[_0xb2b3('0x1a')](_0x46c760,_0x5c9b48,!![]);}catch(_0x25b44a){return BPromise[_0xb2b3('0x1b')](_0x25b44a);}return _0x46c760[_0xb2b3('0x1c')]();};}function saveUpdates(_0x2aa255,_0x304e20){return function(_0x3b73e9){if(_0x3b73e9){return _0x3b73e9['update'](_0x2aa255)[_0xb2b3('0x1d')](function(_0x4d088a){return _0x4d088a;});}return null;};}function removeEntity(_0x473078,_0x30e338){return function(_0x55e905){if(_0x55e905){return _0x55e905[_0xb2b3('0x1e')]()[_0xb2b3('0x1d')](function(){var _0x1526e2=_0x55e905[_0xb2b3('0x1f')]({'plain':!![]});var _0xf4ef8e=_0xb2b3('0x20');return db[_0xb2b3('0x21')]['destroy']({'where':{'type':_0xf4ef8e,'resourceId':_0x1526e2['id']}})[_0xb2b3('0x1d')](function(){return _0x55e905;});})[_0xb2b3('0x1d')](function(){_0x473078[_0xb2b3('0x18')](0xcc)[_0xb2b3('0x14')]();});}};}function handleEntityNotFound(_0x5b9c6a,_0x39ec0a){return function(_0x54a678){if(!_0x54a678){_0x5b9c6a[_0xb2b3('0x13')](0x194);}return _0x54a678;};}function handleError(_0x5e4de6,_0x14d58f){_0x14d58f=_0x14d58f||0x1f4;return function(_0x1f7b69){logger[_0xb2b3('0x22')](_0x1f7b69[_0xb2b3('0x23')]);if(_0x1f7b69['name']){delete _0x1f7b69[_0xb2b3('0x24')];}_0x5e4de6[_0xb2b3('0x18')](_0x14d58f)[_0xb2b3('0x25')](_0x1f7b69);};}exports[_0xb2b3('0x26')]=function(_0x98caae,_0x41d5c7){var _0x493c75={},_0x4d0a50={},_0x3f63b1={'count':0x0,'rows':[]};var _0x39ad1e=_['map'](db['Campaign'][_0xb2b3('0x27')],function(_0x17c472){return{'name':_0x17c472[_0xb2b3('0x28')],'type':_0x17c472[_0xb2b3('0x29')]['key']};});_0x4d0a50[_0xb2b3('0x2a')]=_['map'](_0x39ad1e,_0xb2b3('0x24'));_0x4d0a50['query']=_['keys'](_0x98caae[_0xb2b3('0x2b')]);_0x4d0a50[_0xb2b3('0x2c')]=_[_0xb2b3('0x2d')](_0x4d0a50[_0xb2b3('0x2a')],_0x4d0a50[_0xb2b3('0x2b')]);_0x493c75['attributes']=_[_0xb2b3('0x2d')](_0x4d0a50[_0xb2b3('0x2a')],qs['fields'](_0x98caae['query'][_0xb2b3('0x2e')]));_0x493c75[_0xb2b3('0x2f')]=_0x493c75[_0xb2b3('0x2f')][_0xb2b3('0x30')]?_0x493c75[_0xb2b3('0x2f')]:_0x4d0a50['model'];if(!_0x98caae[_0xb2b3('0x2b')][_0xb2b3('0x31')](_0xb2b3('0x32'))){_0x493c75[_0xb2b3('0x33')]=qs['limit'](_0x98caae[_0xb2b3('0x2b')]['limit']);_0x493c75[_0xb2b3('0x17')]=qs['offset'](_0x98caae['query'][_0xb2b3('0x17')]);}_0x493c75[_0xb2b3('0x34')]=qs[_0xb2b3('0x35')](_0x98caae[_0xb2b3('0x2b')][_0xb2b3('0x35')]);_0x493c75[_0xb2b3('0x36')]=qs[_0xb2b3('0x2c')](_[_0xb2b3('0x37')](_0x98caae['query'],_0x4d0a50[_0xb2b3('0x2c')]),_0x39ad1e);if(_0x98caae['query']['filter']){_0x493c75[_0xb2b3('0x36')]=_[_0xb2b3('0x38')](_0x493c75[_0xb2b3('0x36')],{'$or':_['map'](_0x39ad1e,function(_0x30dbff){if(_0x30dbff[_0xb2b3('0x29')]!==_0xb2b3('0x39')){var _0x2cdd22={};_0x2cdd22[_0x30dbff[_0xb2b3('0x24')]]={'$like':'%'+_0x98caae[_0xb2b3('0x2b')][_0xb2b3('0x3a')]+'%'};return _0x2cdd22;}})});}_0x493c75=_[_0xb2b3('0x38')]({},_0x493c75,_0x98caae[_0xb2b3('0x3b')]);var _0x36236f={'where':_0x493c75[_0xb2b3('0x36')]};return db[_0xb2b3('0x3c')]['count'](_0x36236f)[_0xb2b3('0x1d')](function(_0x180929){_0x3f63b1[_0xb2b3('0x16')]=_0x180929;if(_0x98caae[_0xb2b3('0x2b')]['includeAll']){_0x493c75[_0xb2b3('0x3d')]=[{'all':!![]}];}return db[_0xb2b3('0x3c')][_0xb2b3('0x3e')](_0x493c75);})[_0xb2b3('0x1d')](function(_0x35b230){_0x3f63b1[_0xb2b3('0x3f')]=_0x35b230;return _0x3f63b1;})[_0xb2b3('0x1d')](respondWithFilteredResult(_0x41d5c7,_0x493c75))[_0xb2b3('0x40')](handleError(_0x41d5c7,null));};exports[_0xb2b3('0x41')]=function(_0x1db3ed,_0x1a2a1c){var _0x13f753={'raw':![],'where':{'id':_0x1db3ed[_0xb2b3('0x42')]['id']}},_0x6ecb50={};_0x6ecb50[_0xb2b3('0x2a')]=_[_0xb2b3('0x43')](db[_0xb2b3('0x3c')][_0xb2b3('0x27')]);_0x6ecb50[_0xb2b3('0x2b')]=_[_0xb2b3('0x43')](_0x1db3ed[_0xb2b3('0x2b')]);_0x6ecb50[_0xb2b3('0x2c')]=_[_0xb2b3('0x2d')](_0x6ecb50[_0xb2b3('0x2a')],_0x6ecb50[_0xb2b3('0x2b')]);_0x13f753[_0xb2b3('0x2f')]=_[_0xb2b3('0x2d')](_0x6ecb50[_0xb2b3('0x2a')],qs[_0xb2b3('0x2e')](_0x1db3ed[_0xb2b3('0x2b')][_0xb2b3('0x2e')]));_0x13f753[_0xb2b3('0x2f')]=_0x13f753[_0xb2b3('0x2f')]['length']?_0x13f753['attributes']:_0x6ecb50[_0xb2b3('0x2a')];if(_0x1db3ed[_0xb2b3('0x2b')][_0xb2b3('0x44')]){_0x13f753[_0xb2b3('0x3d')]=[{'all':!![]}];}_0x13f753=_['merge']({},_0x13f753,_0x1db3ed[_0xb2b3('0x3b')]);return db['Campaign'][_0xb2b3('0x45')](_0x13f753)[_0xb2b3('0x1d')](handleEntityNotFound(_0x1a2a1c,null))[_0xb2b3('0x1d')](respondWithResult(_0x1a2a1c,null))[_0xb2b3('0x40')](handleError(_0x1a2a1c,null));};exports[_0xb2b3('0x46')]=function(_0xc73e9f,_0x2bf854){return db[_0xb2b3('0x3c')][_0xb2b3('0x46')](_0xc73e9f[_0xb2b3('0x47')],{})['then'](function(_0x2561fb){var _0x26ccd9=_0xc73e9f['user'][_0xb2b3('0x1f')]({'plain':!![]});if(!_0x26ccd9)throw new Error(_0xb2b3('0x48'));if(_0x26ccd9[_0xb2b3('0x49')]===_0xb2b3('0x4a')){var _0x33e7c2=_0x2561fb[_0xb2b3('0x1f')]({'plain':!![]});var _0x155df6=_0xb2b3('0x20');return db[_0xb2b3('0x4b')]['find']({'where':{'name':_0x155df6,'userProfileId':_0x26ccd9['userProfileId']},'raw':!![]})[_0xb2b3('0x1d')](function(_0x41fdea){if(_0x41fdea&&_0x41fdea['autoAssociation']===0x0){return db[_0xb2b3('0x21')][_0xb2b3('0x46')]({'name':_0x33e7c2[_0xb2b3('0x24')],'resourceId':_0x33e7c2['id'],'type':_0x41fdea[_0xb2b3('0x24')],'sectionId':_0x41fdea['id']},{})['then'](function(){return _0x2561fb;});}else{return _0x2561fb;}})[_0xb2b3('0x40')](function(_0x7ca631){logger[_0xb2b3('0x22')](_0xb2b3('0x4c'),_0x7ca631);throw _0x7ca631;});}return _0x2561fb;})['then'](respondWithResult(_0x2bf854,0xc9))[_0xb2b3('0x40')](handleError(_0x2bf854,null));};exports['clone']=function(_0xde09c3,_0xe52b57){var _0x104b24={'where':{'id':_0xde09c3['params']['id']}},_0xa549fe={};_0xa549fe['model']=_[_0xb2b3('0x43')](db[_0xb2b3('0x3c')][_0xb2b3('0x27')]);_0x104b24[_0xb2b3('0x2f')]=_[_0xb2b3('0x2d')](_0xa549fe[_0xb2b3('0x2a')],qs[_0xb2b3('0x2e')](_0xde09c3[_0xb2b3('0x2b')][_0xb2b3('0x2e')]));_0x104b24[_0xb2b3('0x2f')]=_0x104b24[_0xb2b3('0x2f')][_0xb2b3('0x30')]?_0x104b24['attributes']:_0xa549fe[_0xb2b3('0x2a')];if(_0xde09c3['query'][_0xb2b3('0x44')]){_0x104b24[_0xb2b3('0x3d')]=[{'all':!![]}];}_0x104b24=_['merge']({},_0x104b24,_0xde09c3[_0xb2b3('0x3b')]);return db['Campaign'][_0xb2b3('0x45')](_0x104b24)[_0xb2b3('0x1d')](handleEntityNotFound(_0xe52b57,null))['then'](function(_0x17934c){if(_0x17934c){var _0x1da6ef=_0x17934c[_0xb2b3('0x1f')]({'plain':!![]});_0x1da6ef=qs[_0xb2b3('0x4d')](_0x1da6ef,['id','createdAt',_0xb2b3('0x4e')]);_0xde09c3[_0xb2b3('0x47')]=_[_0xb2b3('0x4d')](_0xde09c3[_0xb2b3('0x47')],['id',_0xb2b3('0x4f'),_0xb2b3('0x4e')]);return db[_0xb2b3('0x3c')][_0xb2b3('0x46')](_['merge'](_0x1da6ef,_0xde09c3[_0xb2b3('0x47')]),{'include':_0xde09c3[_0xb2b3('0x2b')][_0xb2b3('0x44')]?[{'all':!![]}]:undefined})[_0xb2b3('0x1d')](function(_0xe99ecd){var _0x2a545f=_0xde09c3['user']['get']({'plain':!![]});if(!_0x2a545f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a545f[_0xb2b3('0x49')]===_0xb2b3('0x4a')){var _0x499606=_0xe99ecd[_0xb2b3('0x1f')]({'plain':!![]});var _0x18bd82=_0xb2b3('0x20');return db['UserProfileSection'][_0xb2b3('0x45')]({'where':{'name':_0x18bd82,'userProfileId':_0x2a545f[_0xb2b3('0x50')]},'raw':!![]})[_0xb2b3('0x1d')](function(_0x1d87f2){if(_0x1d87f2&&_0x1d87f2['autoAssociation']===0x0){return db[_0xb2b3('0x21')]['create']({'name':_0x499606[_0xb2b3('0x24')],'resourceId':_0x499606['id'],'type':_0x1d87f2['name'],'sectionId':_0x1d87f2['id']},{})['then'](function(){return _0xe99ecd;});}else{return _0xe99ecd;}})[_0xb2b3('0x40')](function(_0x34349f){logger[_0xb2b3('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34349f);throw _0x34349f;});}return _0xe99ecd;});}})[_0xb2b3('0x1d')](respondWithResult(_0xe52b57,0xc9))['catch'](handleError(_0xe52b57,null));};exports['update']=function(_0x384761,_0x16103a){if(_0x384761[_0xb2b3('0x47')]['id']){delete _0x384761[_0xb2b3('0x47')]['id'];}return db[_0xb2b3('0x3c')][_0xb2b3('0x45')]({'where':{'id':_0x384761[_0xb2b3('0x42')]['id']}})[_0xb2b3('0x1d')](handleEntityNotFound(_0x16103a,null))[_0xb2b3('0x1d')](saveUpdates(_0x384761[_0xb2b3('0x47')],null))[_0xb2b3('0x1d')](respondWithResult(_0x16103a,null))[_0xb2b3('0x40')](handleError(_0x16103a,null));};exports[_0xb2b3('0x1e')]=function(_0x5cf879,_0x2d8c03){return db[_0xb2b3('0x3c')][_0xb2b3('0x45')]({'where':{'id':_0x5cf879[_0xb2b3('0x42')]['id']}})[_0xb2b3('0x1d')](handleEntityNotFound(_0x2d8c03,null))['then'](removeEntity(_0x2d8c03,null))[_0xb2b3('0x40')](handleError(_0x2d8c03,null));};exports[_0xb2b3('0x51')]=function(_0x43d183,_0x49b9e9,_0x592341){var _0x21b2bd={'raw':!![],'where':{}};var _0xab90e1={};var _0x592b60={'count':0x0,'rows':[]};return db[_0xb2b3('0x3c')][_0xb2b3('0x52')]({'where':{'id':_0x43d183[_0xb2b3('0x42')]['id']}})[_0xb2b3('0x1d')](handleEntityNotFound(_0x49b9e9,null))[_0xb2b3('0x1d')](function(_0xaeafed){if(_0xaeafed){_0xab90e1[_0xb2b3('0x2a')]=_[_0xb2b3('0x43')](db[_0xb2b3('0x53')][_0xb2b3('0x27')]);_0xab90e1[_0xb2b3('0x2b')]=_[_0xb2b3('0x43')](_0x43d183[_0xb2b3('0x2b')]);_0xab90e1[_0xb2b3('0x2c')]=_[_0xb2b3('0x2d')](_0xab90e1[_0xb2b3('0x2a')],_0xab90e1['query']);_0x21b2bd['attributes']=_[_0xb2b3('0x2d')](_0xab90e1['model'],qs[_0xb2b3('0x2e')](_0x43d183[_0xb2b3('0x2b')]['fields']));_0x21b2bd[_0xb2b3('0x2f')]=_0x21b2bd['attributes'][_0xb2b3('0x30')]?_0x21b2bd[_0xb2b3('0x2f')]:_0xab90e1['model'];if(!_0x43d183[_0xb2b3('0x2b')][_0xb2b3('0x31')](_0xb2b3('0x32'))){_0x21b2bd[_0xb2b3('0x33')]=qs[_0xb2b3('0x33')](_0x43d183[_0xb2b3('0x2b')][_0xb2b3('0x33')]);_0x21b2bd[_0xb2b3('0x17')]=qs[_0xb2b3('0x17')](_0x43d183[_0xb2b3('0x2b')][_0xb2b3('0x17')]);}_0x21b2bd[_0xb2b3('0x34')]=qs[_0xb2b3('0x35')](_0x43d183[_0xb2b3('0x2b')]['sort']);_0x21b2bd[_0xb2b3('0x36')]=qs[_0xb2b3('0x2c')](_['pick'](_0x43d183['query'],_0xab90e1[_0xb2b3('0x2c')]));_0x21b2bd[_0xb2b3('0x36')]['CampaignId']=_0xaeafed['id'];if(_0x43d183[_0xb2b3('0x2b')][_0xb2b3('0x3a')]){_0x21b2bd['where']=_[_0xb2b3('0x38')](_0x21b2bd[_0xb2b3('0x36')],{'$or':_[_0xb2b3('0x54')](_0x21b2bd[_0xb2b3('0x2f')],function(_0x72698b){var _0x4385cb={};_0x4385cb[_0x72698b]={'$like':'%'+_0x43d183[_0xb2b3('0x2b')][_0xb2b3('0x3a')]+'%'};return _0x4385cb;})});}_0x21b2bd=_[_0xb2b3('0x38')]({},_0x21b2bd,_0x43d183[_0xb2b3('0x3b')]);return db[_0xb2b3('0x53')][_0xb2b3('0x16')]({'where':_0x21b2bd[_0xb2b3('0x36')]})[_0xb2b3('0x1d')](function(_0xeabd67){_0x592b60[_0xb2b3('0x16')]=_0xeabd67;if(_0x43d183[_0xb2b3('0x2b')]['includeAll']){_0x21b2bd[_0xb2b3('0x3d')]=[{'all':!![]}];}return db[_0xb2b3('0x53')][_0xb2b3('0x3e')](_0x21b2bd);})[_0xb2b3('0x1d')](function(_0x32997e){_0x592b60[_0xb2b3('0x3f')]=_0x32997e;return _0x592b60;});}})[_0xb2b3('0x1d')](respondWithFilteredResult(_0x49b9e9,_0x21b2bd))[_0xb2b3('0x40')](handleError(_0x49b9e9,null));};exports[_0xb2b3('0x55')]=function(_0x5eb5aa,_0x26462c,_0x5b2a55){var _0x49fcc4={'raw':!![],'where':{}};var _0x5f1142={};var _0x3ec158={'count':0x0,'rows':[]};return db[_0xb2b3('0x3c')][_0xb2b3('0x52')]({'where':{'id':_0x5eb5aa[_0xb2b3('0x42')]['id']}})[_0xb2b3('0x1d')](handleEntityNotFound(_0x26462c,null))['then'](function(_0x559584){if(_0x559584){_0x5f1142[_0xb2b3('0x2a')]=_[_0xb2b3('0x43')](db[_0xb2b3('0x56')][_0xb2b3('0x27')]);_0x5f1142['query']=_[_0xb2b3('0x43')](_0x5eb5aa[_0xb2b3('0x2b')]);_0x5f1142[_0xb2b3('0x2c')]=_[_0xb2b3('0x2d')](_0x5f1142['model'],_0x5f1142['query']);_0x49fcc4[_0xb2b3('0x2f')]=_['intersection'](_0x5f1142[_0xb2b3('0x2a')],qs[_0xb2b3('0x2e')](_0x5eb5aa['query'][_0xb2b3('0x2e')]));_0x49fcc4[_0xb2b3('0x2f')]=_0x49fcc4[_0xb2b3('0x2f')][_0xb2b3('0x30')]?_0x49fcc4['attributes']:_0x5f1142[_0xb2b3('0x2a')];if(!_0x5eb5aa[_0xb2b3('0x2b')][_0xb2b3('0x31')](_0xb2b3('0x32'))){_0x49fcc4[_0xb2b3('0x33')]=qs[_0xb2b3('0x33')](_0x5eb5aa[_0xb2b3('0x2b')][_0xb2b3('0x33')]);_0x49fcc4['offset']=qs['offset'](_0x5eb5aa['query'][_0xb2b3('0x17')]);}_0x49fcc4[_0xb2b3('0x34')]=qs[_0xb2b3('0x35')](_0x5eb5aa['query']['sort']);_0x49fcc4[_0xb2b3('0x36')]=qs['filters'](_[_0xb2b3('0x37')](_0x5eb5aa['query'],_0x5f1142['filters']));_0x49fcc4[_0xb2b3('0x36')]['CampaignId']=_0x559584['id'];if(_0x5eb5aa[_0xb2b3('0x2b')][_0xb2b3('0x3a')]){_0x49fcc4['where']=_[_0xb2b3('0x38')](_0x49fcc4[_0xb2b3('0x36')],{'$or':_[_0xb2b3('0x54')](_0x49fcc4[_0xb2b3('0x2f')],function(_0x1ad8b0){var _0x3201b1={};_0x3201b1[_0x1ad8b0]={'$like':'%'+_0x5eb5aa[_0xb2b3('0x2b')][_0xb2b3('0x3a')]+'%'};return _0x3201b1;})});}_0x49fcc4=_[_0xb2b3('0x38')]({},_0x49fcc4,_0x5eb5aa['options']);return db['CmHopperHistory'][_0xb2b3('0x16')]({'where':_0x49fcc4[_0xb2b3('0x36')]})[_0xb2b3('0x1d')](function(_0x4da641){_0x3ec158['count']=_0x4da641;if(_0x5eb5aa['query']['includeAll']){_0x49fcc4[_0xb2b3('0x3d')]=[{'all':!![]}];}return db[_0xb2b3('0x56')]['findAll'](_0x49fcc4);})[_0xb2b3('0x1d')](function(_0x1c910c){_0x3ec158[_0xb2b3('0x3f')]=_0x1c910c;return _0x3ec158;});}})['then'](respondWithFilteredResult(_0x26462c,_0x49fcc4))[_0xb2b3('0x40')](handleError(_0x26462c,null));};exports[_0xb2b3('0x57')]=function(_0x1f9282,_0x33e367,_0x26ac80){var _0xe5e832={'raw':!![],'where':{}};var _0x203f9b={};var _0x582097={'count':0x0,'rows':[]};return db[_0xb2b3('0x3c')][_0xb2b3('0x52')]({'where':{'id':_0x1f9282[_0xb2b3('0x42')]['id']}})[_0xb2b3('0x1d')](handleEntityNotFound(_0x33e367,null))[_0xb2b3('0x1d')](function(_0x4a6096){if(_0x4a6096){_0x203f9b[_0xb2b3('0x2a')]=_['keys'](db[_0xb2b3('0x58')][_0xb2b3('0x27')]);_0x203f9b[_0xb2b3('0x2b')]=_['keys'](_0x1f9282[_0xb2b3('0x2b')]);_0x203f9b['filters']=_['intersection'](_0x203f9b['model'],_0x203f9b[_0xb2b3('0x2b')]);_0xe5e832[_0xb2b3('0x2f')]=_[_0xb2b3('0x2d')](_0x203f9b[_0xb2b3('0x2a')],qs['fields'](_0x1f9282[_0xb2b3('0x2b')][_0xb2b3('0x2e')]));_0xe5e832[_0xb2b3('0x2f')]=_0xe5e832[_0xb2b3('0x2f')][_0xb2b3('0x30')]?_0xe5e832['attributes']:_0x203f9b[_0xb2b3('0x2a')];if(!_0x1f9282[_0xb2b3('0x2b')]['hasOwnProperty'](_0xb2b3('0x32'))){_0xe5e832[_0xb2b3('0x33')]=qs[_0xb2b3('0x33')](_0x1f9282[_0xb2b3('0x2b')][_0xb2b3('0x33')]);_0xe5e832[_0xb2b3('0x17')]=qs[_0xb2b3('0x17')](_0x1f9282['query'][_0xb2b3('0x17')]);}_0xe5e832[_0xb2b3('0x34')]=qs[_0xb2b3('0x35')](_0x1f9282['query'][_0xb2b3('0x35')]);_0xe5e832[_0xb2b3('0x36')]=qs[_0xb2b3('0x2c')](_[_0xb2b3('0x37')](_0x1f9282[_0xb2b3('0x2b')],_0x203f9b[_0xb2b3('0x2c')]));_0xe5e832['where']['CampaignId']=_0x4a6096['id'];if(_0x1f9282[_0xb2b3('0x2b')]['filter']){_0xe5e832['where']=_['merge'](_0xe5e832[_0xb2b3('0x36')],{'$or':_['map'](_0xe5e832[_0xb2b3('0x2f')],function(_0x669d29){var _0x3b217e={};_0x3b217e[_0x669d29]={'$like':'%'+_0x1f9282['query'][_0xb2b3('0x3a')]+'%'};return _0x3b217e;})});}_0xe5e832=_[_0xb2b3('0x38')]({},_0xe5e832,_0x1f9282['options']);return db[_0xb2b3('0x58')][_0xb2b3('0x16')]({'where':_0xe5e832['where']})[_0xb2b3('0x1d')](function(_0x7a89b8){_0x582097[_0xb2b3('0x16')]=_0x7a89b8;if(_0x1f9282[_0xb2b3('0x2b')]['includeAll']){_0xe5e832['include']=[{'all':!![]}];}return db[_0xb2b3('0x58')][_0xb2b3('0x3e')](_0xe5e832);})[_0xb2b3('0x1d')](function(_0x32fecd){_0x582097[_0xb2b3('0x3f')]=_0x32fecd;return _0x582097;});}})['then'](respondWithFilteredResult(_0x33e367,_0xe5e832))['catch'](handleError(_0x33e367,null));};exports[_0xb2b3('0x59')]=function(_0x243ce0,_0x3248ba,_0x34762d){var _0x4441ed={'raw':!![],'where':{}};var _0x237fb5={};var _0x49ba75={'count':0x0,'rows':[]};return db['Campaign'][_0xb2b3('0x52')]({'where':{'id':_0x243ce0[_0xb2b3('0x42')]['id']}})['then'](handleEntityNotFound(_0x3248ba,null))[_0xb2b3('0x1d')](function(_0x55992c){if(_0x55992c){_0x237fb5[_0xb2b3('0x2a')]=_[_0xb2b3('0x43')](db[_0xb2b3('0x5a')][_0xb2b3('0x27')]);_0x237fb5[_0xb2b3('0x2b')]=_[_0xb2b3('0x43')](_0x243ce0['query']);_0x237fb5[_0xb2b3('0x2c')]=_[_0xb2b3('0x2d')](_0x237fb5[_0xb2b3('0x2a')],_0x237fb5[_0xb2b3('0x2b')]);_0x4441ed[_0xb2b3('0x2f')]=_['intersection'](_0x237fb5[_0xb2b3('0x2a')],qs[_0xb2b3('0x2e')](_0x243ce0[_0xb2b3('0x2b')][_0xb2b3('0x2e')]));_0x4441ed[_0xb2b3('0x2f')]=_0x4441ed['attributes']['length']?_0x4441ed[_0xb2b3('0x2f')]:_0x237fb5[_0xb2b3('0x2a')];if(!_0x243ce0['query'][_0xb2b3('0x31')]('nolimit')){_0x4441ed[_0xb2b3('0x33')]=qs[_0xb2b3('0x33')](_0x243ce0['query'][_0xb2b3('0x33')]);_0x4441ed[_0xb2b3('0x17')]=qs[_0xb2b3('0x17')](_0x243ce0[_0xb2b3('0x2b')][_0xb2b3('0x17')]);}_0x4441ed[_0xb2b3('0x34')]=qs[_0xb2b3('0x35')](_0x243ce0[_0xb2b3('0x2b')][_0xb2b3('0x35')]);_0x4441ed[_0xb2b3('0x36')]=qs['filters'](_[_0xb2b3('0x37')](_0x243ce0[_0xb2b3('0x2b')],_0x237fb5[_0xb2b3('0x2c')]));_0x4441ed[_0xb2b3('0x36')]['CampaignId']=_0x55992c['id'];if(_0x243ce0[_0xb2b3('0x2b')][_0xb2b3('0x3a')]){_0x4441ed[_0xb2b3('0x36')]=_['merge'](_0x4441ed[_0xb2b3('0x36')],{'$or':_[_0xb2b3('0x54')](_0x4441ed[_0xb2b3('0x2f')],function(_0x28565e){var _0x4f7cb2={};_0x4f7cb2[_0x28565e]={'$like':'%'+_0x243ce0[_0xb2b3('0x2b')][_0xb2b3('0x3a')]+'%'};return _0x4f7cb2;})});}_0x4441ed=_[_0xb2b3('0x38')]({},_0x4441ed,_0x243ce0[_0xb2b3('0x3b')]);return db[_0xb2b3('0x5a')]['count']({'where':_0x4441ed[_0xb2b3('0x36')]})[_0xb2b3('0x1d')](function(_0xc0e2e8){_0x49ba75[_0xb2b3('0x16')]=_0xc0e2e8;if(_0x243ce0['query'][_0xb2b3('0x44')]){_0x4441ed['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x4441ed);})['then'](function(_0x5626b5){_0x49ba75[_0xb2b3('0x3f')]=_0x5626b5;return _0x49ba75;});}})[_0xb2b3('0x1d')](respondWithFilteredResult(_0x3248ba,_0x4441ed))[_0xb2b3('0x40')](handleError(_0x3248ba,null));};exports[_0xb2b3('0x5b')]=function(_0x1b1875,_0x229a5b,_0x24fbf4){var _0x16f7cd={};var _0xfd5ce8={};var _0xeca2cb;var _0x1514c9;return db[_0xb2b3('0x3c')][_0xb2b3('0x52')]({'where':{'id':_0x1b1875[_0xb2b3('0x42')]['id']}})[_0xb2b3('0x1d')](handleEntityNotFound(_0x229a5b,null))[_0xb2b3('0x1d')](function(_0x1ffa64){if(_0x1ffa64){_0xeca2cb=_0x1ffa64;_0xfd5ce8[_0xb2b3('0x2a')]=_[_0xb2b3('0x43')](db['CmList'][_0xb2b3('0x27')]);_0xfd5ce8[_0xb2b3('0x2b')]=_[_0xb2b3('0x43')](_0x1b1875[_0xb2b3('0x2b')]);_0xfd5ce8[_0xb2b3('0x2c')]=_[_0xb2b3('0x2d')](_0xfd5ce8[_0xb2b3('0x2a')],_0xfd5ce8[_0xb2b3('0x2b')]);_0x16f7cd[_0xb2b3('0x2f')]=_[_0xb2b3('0x2d')](_0xfd5ce8[_0xb2b3('0x2a')],qs[_0xb2b3('0x2e')](_0x1b1875[_0xb2b3('0x2b')][_0xb2b3('0x2e')]));_0x16f7cd[_0xb2b3('0x2f')]=_0x16f7cd[_0xb2b3('0x2f')][_0xb2b3('0x30')]?_0x16f7cd[_0xb2b3('0x2f')]:_0xfd5ce8[_0xb2b3('0x2a')];_0x16f7cd[_0xb2b3('0x34')]=qs[_0xb2b3('0x35')](_0x1b1875[_0xb2b3('0x2b')]['sort']);_0x16f7cd[_0xb2b3('0x36')]=qs[_0xb2b3('0x2c')](_['pick'](_0x1b1875[_0xb2b3('0x2b')],_0xfd5ce8[_0xb2b3('0x2c')]));if(_0x1b1875[_0xb2b3('0x2b')][_0xb2b3('0x3a')]){_0x16f7cd[_0xb2b3('0x36')]=_[_0xb2b3('0x38')](_0x16f7cd[_0xb2b3('0x36')],{'$or':_[_0xb2b3('0x54')](_0x16f7cd[_0xb2b3('0x2f')],function(_0x4452dd){var _0x24c5b0={};_0x24c5b0[_0x4452dd]={'$like':'%'+_0x1b1875[_0xb2b3('0x2b')][_0xb2b3('0x3a')]+'%'};return _0x24c5b0;})});}_0x16f7cd=_[_0xb2b3('0x38')]({},_0x16f7cd,_0x1b1875[_0xb2b3('0x3b')]);return _0xeca2cb[_0xb2b3('0x5b')](_0x16f7cd);}})[_0xb2b3('0x1d')](function(_0x1b676b){if(_0x1b676b){_0x1514c9=_0x1b676b['length'];if(!_0x1b1875[_0xb2b3('0x2b')]['hasOwnProperty'](_0xb2b3('0x32'))){_0x16f7cd[_0xb2b3('0x33')]=qs[_0xb2b3('0x33')](_0x1b1875[_0xb2b3('0x2b')]['limit']);_0x16f7cd[_0xb2b3('0x17')]=qs['offset'](_0x1b1875[_0xb2b3('0x2b')][_0xb2b3('0x17')]);}return _0xeca2cb['getLists'](_0x16f7cd);}})[_0xb2b3('0x1d')](function(_0x131a41){if(_0x131a41){return _0x131a41?{'count':_0x1514c9,'rows':_0x131a41}:null;}})[_0xb2b3('0x1d')](respondWithResult(_0x229a5b,null))[_0xb2b3('0x40')](handleError(_0x229a5b,null));};exports['addLists']=function(_0x45a369,_0x4d90ca,_0x58a61f){var _0x395d69,_0x9ae6d;return db[_0xb2b3('0x3c')][_0xb2b3('0x45')]({'where':{'id':_0x45a369['params']['id']}})[_0xb2b3('0x1d')](handleEntityNotFound(_0x4d90ca,null))[_0xb2b3('0x1d')](function(_0x44f32b){if(_0x44f32b){_0x9ae6d=_0x44f32b;return _0x44f32b[_0xb2b3('0x5c')](_0x45a369[_0xb2b3('0x47')][_0xb2b3('0x5d')],_[_0xb2b3('0x4d')](_0x45a369[_0xb2b3('0x47')],[_0xb2b3('0x5d'),'id'])||{});}return null;})[_0xb2b3('0x5e')](function(_0x16fd8f){var _0x1e4760;_0x395d69=_0x16fd8f||[];var _0x3058cf=[];if(_0x16fd8f){for(var _0x234eee=0x0;_0x234eee<_0x16fd8f[_0xb2b3('0x30')];_0x234eee+=0x1){var _0x4ba275=_0x16fd8f[_0x234eee][_0xb2b3('0x1f')]({'plain':!![]});_0x9ae6d[_0xb2b3('0x5f')]=_0x45a369[_0xb2b3('0x47')][_0xb2b3('0x5f')]?_0x45a369['body'][_0xb2b3('0x5f')]:_0x9ae6d['dialCheckDuplicateType'];switch(_0x9ae6d[_0xb2b3('0x5f')]){case'always':_0x1e4760=squel[_0xb2b3('0x60')]()[_0xb2b3('0x61')](_0xb2b3('0x62'))[_0xb2b3('0x63')]([_0xb2b3('0x64'),_0xb2b3('0x65'),'ContactId',_0xb2b3('0x66'),_0xb2b3('0x67'),_0xb2b3('0x4f'),_0xb2b3('0x4e')],squel[_0xb2b3('0x68')]()[_0xb2b3('0x69')](_0xb2b3('0x64'),_0xb2b3('0x64'))['field'](_0xb2b3('0x6a'),'scheduledAt')[_0xb2b3('0x69')]('id',_0xb2b3('0x6b'))['field'](_0x4ba275[_0xb2b3('0x6c')]['toString'](),'ListId')[_0xb2b3('0x69')](_0x45a369[_0xb2b3('0x42')]['id'][_0xb2b3('0x6d')](),_0xb2b3('0x67'))[_0xb2b3('0x69')](_0xb2b3('0x6a'),_0xb2b3('0x4f'))[_0xb2b3('0x69')](_0xb2b3('0x6a'),_0xb2b3('0x4e'))[_0xb2b3('0x6e')](_0xb2b3('0x6f'))['where'](_0xb2b3('0x70'))[_0xb2b3('0x36')](_0xb2b3('0x71'),_0x4ba275['CmListId']['toString']())['where']('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xb2b3('0x68')]()['field'](_0xb2b3('0x72'))['from'](_0xb2b3('0x73'))['where'](_0xb2b3('0x74'),_0x45a369[_0xb2b3('0x42')]['id'][_0xb2b3('0x6d')]()))['where'](_0xb2b3('0x75'),squel[_0xb2b3('0x68')]()[_0xb2b3('0x69')](_0xb2b3('0x76'))[_0xb2b3('0x6e')](_0xb2b3('0x62'))[_0xb2b3('0x36')]('CampaignId\x20=\x20?',_0x45a369[_0xb2b3('0x42')]['id'][_0xb2b3('0x6d')]())))[_0xb2b3('0x6d')]();break;case'onlyIfOpen':_0x1e4760=squel[_0xb2b3('0x60')]()[_0xb2b3('0x61')](_0xb2b3('0x62'))[_0xb2b3('0x63')]([_0xb2b3('0x64'),_0xb2b3('0x65'),'ContactId','ListId',_0xb2b3('0x67'),_0xb2b3('0x4f'),_0xb2b3('0x4e')],squel[_0xb2b3('0x68')]()[_0xb2b3('0x69')]('phone',_0xb2b3('0x64'))['field']('NOW()',_0xb2b3('0x65'))[_0xb2b3('0x69')]('id',_0xb2b3('0x6b'))[_0xb2b3('0x69')](_0x4ba275[_0xb2b3('0x6c')][_0xb2b3('0x6d')](),_0xb2b3('0x66'))[_0xb2b3('0x69')](_0x45a369[_0xb2b3('0x42')]['id'][_0xb2b3('0x6d')](),_0xb2b3('0x67'))[_0xb2b3('0x69')](_0xb2b3('0x6a'),_0xb2b3('0x4f'))[_0xb2b3('0x69')](_0xb2b3('0x6a'),_0xb2b3('0x4e'))[_0xb2b3('0x6e')](_0xb2b3('0x6f'))[_0xb2b3('0x36')](_0xb2b3('0x70'))[_0xb2b3('0x36')](_0xb2b3('0x71'),_0x4ba275[_0xb2b3('0x6c')]['toString']())[_0xb2b3('0x36')](_0xb2b3('0x77'))[_0xb2b3('0x36')](_0xb2b3('0x75'),squel[_0xb2b3('0x68')]()[_0xb2b3('0x69')](_0xb2b3('0x76'))['from'](_0xb2b3('0x62'))['where'](_0xb2b3('0x74'),_0x45a369['params']['id']['toString']())))['toString']();break;default:_0x1e4760=squel['insert']()['into']('cm_hopper')['fromQuery'](['phone',_0xb2b3('0x65'),'ContactId',_0xb2b3('0x66'),'CampaignId','createdAt',_0xb2b3('0x4e')],squel[_0xb2b3('0x68')]()['field'](_0xb2b3('0x64'),_0xb2b3('0x64'))['field']('NOW()',_0xb2b3('0x65'))[_0xb2b3('0x69')]('id',_0xb2b3('0x6b'))[_0xb2b3('0x69')](_0x4ba275[_0xb2b3('0x6c')][_0xb2b3('0x6d')](),'ListId')[_0xb2b3('0x69')](_0x45a369[_0xb2b3('0x42')]['id'][_0xb2b3('0x6d')](),_0xb2b3('0x67'))[_0xb2b3('0x69')](_0xb2b3('0x6a'),_0xb2b3('0x4f'))['field'](_0xb2b3('0x6a'),_0xb2b3('0x4e'))[_0xb2b3('0x6e')](_0xb2b3('0x6f'))[_0xb2b3('0x36')](_0xb2b3('0x70'))[_0xb2b3('0x36')](_0xb2b3('0x71'),_0x4ba275['CmListId'][_0xb2b3('0x6d')]())[_0xb2b3('0x36')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x3058cf[_0xb2b3('0x78')](db['sequelize']['query'](_0x1e4760));}return BPromise[_0xb2b3('0x79')](_0x3058cf);}})[_0xb2b3('0x1d')](function(){return _0x395d69;})[_0xb2b3('0x1d')](respondWithResult(_0x4d90ca,null))[_0xb2b3('0x40')](handleError(_0x4d90ca,null));};exports[_0xb2b3('0x7a')]=function(_0x4046a2,_0x217840,_0x505775){return db['Campaign']['find']({'where':{'id':_0x4046a2[_0xb2b3('0x42')]['id']}})['then'](handleEntityNotFound(_0x217840,null))[_0xb2b3('0x1d')](function(_0x2fdae7){if(_0x2fdae7){return _0x2fdae7[_0xb2b3('0x7a')](_0x4046a2[_0xb2b3('0x2b')][_0xb2b3('0x5d')]);}})[_0xb2b3('0x1d')](function(_0xf25959){if(_0xf25959){return db[_0xb2b3('0x53')][_0xb2b3('0x1e')]({'where':{'ListId':_0x4046a2[_0xb2b3('0x2b')][_0xb2b3('0x5d')],'CampaignId':_0x4046a2[_0xb2b3('0x42')]['id']}})[_0xb2b3('0x1d')](function(){return _0xf25959;});}})[_0xb2b3('0x1d')](respondWithStatusCode(_0x217840,null))['catch'](handleError(_0x217840,null));};exports[_0xb2b3('0x7b')]=function(_0x22b8cb,_0x1aa76a,_0x59e3a4){var _0x3c8b58={};var _0x36d1a0={};var _0x1a364a;var _0x31ca86;return db[_0xb2b3('0x3c')][_0xb2b3('0x52')]({'where':{'id':_0x22b8cb['params']['id']}})[_0xb2b3('0x1d')](handleEntityNotFound(_0x1aa76a,null))[_0xb2b3('0x1d')](function(_0x1790ef){if(_0x1790ef){_0x1a364a=_0x1790ef;_0x36d1a0[_0xb2b3('0x2a')]=_[_0xb2b3('0x43')](db[_0xb2b3('0x7c')][_0xb2b3('0x27')]);_0x36d1a0[_0xb2b3('0x2b')]=_[_0xb2b3('0x43')](_0x22b8cb[_0xb2b3('0x2b')]);_0x36d1a0[_0xb2b3('0x2c')]=_[_0xb2b3('0x2d')](_0x36d1a0['model'],_0x36d1a0['query']);_0x3c8b58['attributes']=_[_0xb2b3('0x2d')](_0x36d1a0['model'],qs[_0xb2b3('0x2e')](_0x22b8cb[_0xb2b3('0x2b')][_0xb2b3('0x2e')]));_0x3c8b58[_0xb2b3('0x2f')]=_0x3c8b58['attributes'][_0xb2b3('0x30')]?_0x3c8b58[_0xb2b3('0x2f')]:_0x36d1a0[_0xb2b3('0x2a')];_0x3c8b58[_0xb2b3('0x34')]=qs[_0xb2b3('0x35')](_0x22b8cb[_0xb2b3('0x2b')][_0xb2b3('0x35')]);_0x3c8b58[_0xb2b3('0x36')]=qs[_0xb2b3('0x2c')](_[_0xb2b3('0x37')](_0x22b8cb[_0xb2b3('0x2b')],_0x36d1a0[_0xb2b3('0x2c')]));if(_0x22b8cb[_0xb2b3('0x2b')]['filter']){_0x3c8b58[_0xb2b3('0x36')]=_[_0xb2b3('0x38')](_0x3c8b58[_0xb2b3('0x36')],{'$or':_[_0xb2b3('0x54')](_0x3c8b58[_0xb2b3('0x2f')],function(_0x44723d){var _0x5a69c7={};_0x5a69c7[_0x44723d]={'$like':'%'+_0x22b8cb['query'][_0xb2b3('0x3a')]+'%'};return _0x5a69c7;})});}_0x3c8b58=_[_0xb2b3('0x38')]({},_0x3c8b58,_0x22b8cb[_0xb2b3('0x3b')]);return _0x1a364a[_0xb2b3('0x7b')](_0x3c8b58);}})[_0xb2b3('0x1d')](function(_0x16552c){if(_0x16552c){_0x31ca86=_0x16552c[_0xb2b3('0x30')];if(!_0x22b8cb[_0xb2b3('0x2b')][_0xb2b3('0x31')](_0xb2b3('0x32'))){_0x3c8b58['limit']=qs['limit'](_0x22b8cb[_0xb2b3('0x2b')]['limit']);_0x3c8b58[_0xb2b3('0x17')]=qs[_0xb2b3('0x17')](_0x22b8cb['query'][_0xb2b3('0x17')]);}return _0x1a364a[_0xb2b3('0x7b')](_0x3c8b58);}})[_0xb2b3('0x1d')](function(_0x47668a){if(_0x47668a){return _0x47668a?{'count':_0x31ca86,'rows':_0x47668a}:null;}})[_0xb2b3('0x1d')](respondWithResult(_0x1aa76a,null))['catch'](handleError(_0x1aa76a,null));};exports[_0xb2b3('0x7d')]=function(_0x46eb48,_0x4ee5a0,_0x3908de){var _0x1e5d78,_0x1852a2;return db[_0xb2b3('0x3c')][_0xb2b3('0x45')]({'where':{'id':_0x46eb48['params']['id']}})[_0xb2b3('0x1d')](handleEntityNotFound(_0x4ee5a0,null))['then'](function(_0x1846a1){if(_0x1846a1){_0x1852a2=_0x1846a1;return _0x1846a1['addBlackLists'](_0x46eb48[_0xb2b3('0x47')][_0xb2b3('0x5d')],_[_0xb2b3('0x4d')](_0x46eb48['body'],['ids','id'])||{});}return null;})['spread'](function(_0x3b0999){var _0x409a33;_0x1e5d78=_0x3b0999||[];var _0x2137c8=[];if(_0x3b0999){for(var _0x12b615=0x0;_0x12b615<_0x3b0999[_0xb2b3('0x30')];_0x12b615+=0x1){var _0x3a663c=_0x3b0999[_0x12b615][_0xb2b3('0x1f')]({'plain':!![]});_0x409a33=squel[_0xb2b3('0x60')]()['into'](_0xb2b3('0x7e'))[_0xb2b3('0x63')]([_0xb2b3('0x64'),_0xb2b3('0x6b'),_0xb2b3('0x66'),_0xb2b3('0x67'),_0xb2b3('0x4f'),_0xb2b3('0x4e')],squel[_0xb2b3('0x68')]()[_0xb2b3('0x69')](_0xb2b3('0x64'),_0xb2b3('0x64'))[_0xb2b3('0x69')]('id',_0xb2b3('0x6b'))[_0xb2b3('0x69')](_0x3a663c['CmListId']['toString'](),_0xb2b3('0x66'))[_0xb2b3('0x69')](_0x46eb48[_0xb2b3('0x42')]['id'][_0xb2b3('0x6d')](),'CampaignId')[_0xb2b3('0x69')]('NOW()',_0xb2b3('0x4f'))['field'](_0xb2b3('0x6a'),'updatedAt')[_0xb2b3('0x6e')](_0xb2b3('0x6f'))[_0xb2b3('0x36')]('deletedAt\x20IS\x20NULL')[_0xb2b3('0x36')](_0xb2b3('0x71'),_0x3a663c[_0xb2b3('0x6c')][_0xb2b3('0x6d')]())[_0xb2b3('0x36')](_0xb2b3('0x77')))[_0xb2b3('0x6d')]();_0x2137c8[_0xb2b3('0x78')](db[_0xb2b3('0x7f')][_0xb2b3('0x2b')](_0x409a33));}return BPromise['all'](_0x2137c8);}})['then'](function(){return _0x1e5d78;})['then'](respondWithResult(_0x4ee5a0,null))[_0xb2b3('0x40')](handleError(_0x4ee5a0,null));};exports[_0xb2b3('0x80')]=function(_0x179f9b,_0x156295,_0x11e878){return db['Campaign'][_0xb2b3('0x45')]({'where':{'id':_0x179f9b[_0xb2b3('0x42')]['id']}})['then'](handleEntityNotFound(_0x156295,null))[_0xb2b3('0x1d')](function(_0x45dd04){if(_0x45dd04){return _0x45dd04['removeBlackLists'](_0x179f9b['query']['ids']);}})[_0xb2b3('0x1d')](function(_0x37ba50){if(_0x37ba50){return db[_0xb2b3('0x5a')][_0xb2b3('0x1e')]({'where':{'ListId':_0x179f9b['query'][_0xb2b3('0x5d')],'CampaignId':_0x179f9b[_0xb2b3('0x42')]['id']}})['then'](function(){return _0x37ba50;});}})[_0xb2b3('0x1d')](respondWithStatusCode(_0x156295,null))[_0xb2b3('0x40')](handleError(_0x156295,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 2e570b0..29d8f66 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 _0xff8b=['bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','api','moment'];(function(_0xfd55d5,_0x18e3df){var _0x31eb24=function(_0x403a07){while(--_0x403a07){_0xfd55d5['push'](_0xfd55d5['shift']());}};_0x31eb24(++_0x18e3df);}(_0xff8b,0x105));var _0xbff8=function(_0x213f03,_0x413c66){_0x213f03=_0x213f03-0x0;var _0x120fa4=_0xff8b[_0x213f03];return _0x120fa4;};'use strict';var _=require(_0xbff8('0x0'));var util=require(_0xbff8('0x1'));var logger=require(_0xbff8('0x2'))(_0xbff8('0x3'));var moment=require(_0xbff8('0x4'));var BPromise=require(_0xbff8('0x5'));var rp=require(_0xbff8('0x6'));var fs=require('fs');var path=require(_0xbff8('0x7'));var rimraf=require(_0xbff8('0x8'));var config=require(_0xbff8('0x9'));var attributes=require(_0xbff8('0xa'));module[_0xbff8('0xb')]=function(_0x1e7bed,_0x164092){return _0x1e7bed[_0xbff8('0xc')](_0xbff8('0xd'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81e7=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','Campaign','campaigns'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x81e7,0x13f));var _0x781e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x81e7[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0x781e('0x0'));var logger=require(_0x781e('0x1'))(_0x781e('0x2'));var moment=require('moment');var BPromise=require(_0x781e('0x3'));var rp=require(_0x781e('0x4'));var fs=require('fs');var path=require(_0x781e('0x5'));var rimraf=require(_0x781e('0x6'));var config=require(_0x781e('0x7'));var attributes=require(_0x781e('0x8'));module['exports']=function(_0xa21ab,_0x270d09){return _0xa21ab['define'](_0x781e('0x9'),attributes,{'tableName':_0x781e('0xa'),'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 1c7665a..513e1c7 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 _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(_0x3d6135,_0x256136){var _0x16f3c1=function(_0x5e7576){while(--_0x5e7576){_0x3d6135['push'](_0x3d6135['shift']());}};_0x16f3c1(++_0x256136);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 +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(_0x3eb73f,_0x11b949){var _0x545e8d=function(_0x380e20){while(--_0x380e20){_0x3eb73f['push'](_0x3eb73f['shift']());}};_0x545e8d(++_0x11b949);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 2e07983..ff83502 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 _0x6ce7=['addLists','addBlackLists','put','update','delete','removeBlackLists','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists'];(function(_0x50325b,_0x4bcfdc){var _0xe63bc1=function(_0x193976){while(--_0x193976){_0x50325b['push'](_0x50325b['shift']());}};_0xe63bc1(++_0x4bcfdc);}(_0x6ce7,0x116));var _0x76ce=function(_0xf8dff0,_0x350282){_0xf8dff0=_0xf8dff0-0x0;var _0x31380a=_0x6ce7[_0xf8dff0];return _0x31380a;};'use strict';var multer=require(_0x76ce('0x0'));var util=require(_0x76ce('0x1'));var path=require(_0x76ce('0x2'));var timeout=require(_0x76ce('0x3'));var express=require(_0x76ce('0x4'));var router=express[_0x76ce('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x76ce('0x6'));var config=require(_0x76ce('0x7'));var controller=require('./campaign.controller');router[_0x76ce('0x8')]('/',auth[_0x76ce('0x9')](),controller[_0x76ce('0xa')]);router[_0x76ce('0x8')](_0x76ce('0xb'),auth[_0x76ce('0x9')](),controller[_0x76ce('0xc')]);router[_0x76ce('0x8')](_0x76ce('0xd'),auth[_0x76ce('0x9')](),controller[_0x76ce('0xe')]);router[_0x76ce('0x8')](_0x76ce('0xf'),auth['isAuthenticated'](),controller[_0x76ce('0x10')]);router[_0x76ce('0x8')](_0x76ce('0x11'),auth[_0x76ce('0x9')](),controller[_0x76ce('0x12')]);router[_0x76ce('0x8')](_0x76ce('0x13'),auth['isAuthenticated'](),controller[_0x76ce('0x14')]);router[_0x76ce('0x8')]('/:id/lists',auth[_0x76ce('0x9')](),controller['getLists']);router[_0x76ce('0x8')](_0x76ce('0x15'),auth[_0x76ce('0x9')](),controller[_0x76ce('0x16')]);router[_0x76ce('0x17')]('/',auth[_0x76ce('0x9')](),controller[_0x76ce('0x18')]);router[_0x76ce('0x17')](_0x76ce('0x19'),auth[_0x76ce('0x9')](),controller[_0x76ce('0x1a')]);router[_0x76ce('0x17')](_0x76ce('0x1b'),auth[_0x76ce('0x9')](),controller[_0x76ce('0x1c')]);router[_0x76ce('0x17')](_0x76ce('0x15'),auth['isAuthenticated'](),controller[_0x76ce('0x1d')]);router[_0x76ce('0x1e')](_0x76ce('0xb'),auth[_0x76ce('0x9')](),controller[_0x76ce('0x1f')]);router[_0x76ce('0x20')](_0x76ce('0xb'),auth[_0x76ce('0x9')](),controller['destroy']);router['delete'](_0x76ce('0x1b'),auth[_0x76ce('0x9')](),controller['removeLists']);router[_0x76ce('0x20')](_0x76ce('0x15'),auth[_0x76ce('0x9')](),controller[_0x76ce('0x21')]);module['exports']=router; \ No newline at end of file +var _0x8b5d=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','delete','destroy','removeLists','removeBlackLists','exports','multer','util'];(function(_0x2db553,_0x4af341){var _0x38893a=function(_0x3da77e){while(--_0x3da77e){_0x2db553['push'](_0x2db553['shift']());}};_0x38893a(++_0x4af341);}(_0x8b5d,0x127));var _0xd8b5=function(_0x3662b4,_0x503b4d){_0x3662b4=_0x3662b4-0x0;var _0x50928c=_0x8b5d[_0x3662b4];return _0x50928c;};'use strict';var multer=require(_0xd8b5('0x0'));var util=require(_0xd8b5('0x1'));var path=require('path');var timeout=require(_0xd8b5('0x2'));var express=require(_0xd8b5('0x3'));var router=express['Router']();var auth=require(_0xd8b5('0x4'));var interaction=require(_0xd8b5('0x5'));var config=require(_0xd8b5('0x6'));var controller=require('./campaign.controller');router[_0xd8b5('0x7')]('/',auth['isAuthenticated'](),controller[_0xd8b5('0x8')]);router[_0xd8b5('0x7')](_0xd8b5('0x9'),auth[_0xd8b5('0xa')](),controller[_0xd8b5('0xb')]);router[_0xd8b5('0x7')](_0xd8b5('0xc'),auth[_0xd8b5('0xa')](),controller['getHoppers']);router['get'](_0xd8b5('0xd'),auth[_0xd8b5('0xa')](),controller['getHopperHistories']);router[_0xd8b5('0x7')](_0xd8b5('0xe'),auth[_0xd8b5('0xa')](),controller[_0xd8b5('0xf')]);router[_0xd8b5('0x7')](_0xd8b5('0x10'),auth['isAuthenticated'](),controller[_0xd8b5('0x11')]);router['get'](_0xd8b5('0x12'),auth[_0xd8b5('0xa')](),controller[_0xd8b5('0x13')]);router[_0xd8b5('0x7')](_0xd8b5('0x14'),auth['isAuthenticated'](),controller[_0xd8b5('0x15')]);router[_0xd8b5('0x16')]('/',auth[_0xd8b5('0xa')](),controller[_0xd8b5('0x17')]);router['post'](_0xd8b5('0x18'),auth[_0xd8b5('0xa')](),controller[_0xd8b5('0x19')]);router['post'](_0xd8b5('0x12'),auth[_0xd8b5('0xa')](),controller[_0xd8b5('0x1a')]);router[_0xd8b5('0x16')](_0xd8b5('0x14'),auth['isAuthenticated'](),controller[_0xd8b5('0x1b')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd8b5('0x1c')]('/:id',auth[_0xd8b5('0xa')](),controller[_0xd8b5('0x1d')]);router[_0xd8b5('0x1c')]('/:id/lists',auth[_0xd8b5('0xa')](),controller[_0xd8b5('0x1e')]);router[_0xd8b5('0x1c')]('/:id/blacklists',auth[_0xd8b5('0xa')](),controller[_0xd8b5('0x1f')]);module[_0xd8b5('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index e3abca1..c7b71c7 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 _0x3e4a=['sequelize','exports','STRING','VIRTUAL','getDataValue','key'];(function(_0x208d47,_0xa4c52f){var _0x5d537f=function(_0x1554f1){while(--_0x1554f1){_0x208d47['push'](_0x208d47['shift']());}};_0x5d537f(++_0xa4c52f);}(_0x3e4a,0x6c));var _0xa3e4=function(_0x3e1efa,_0x1aafdf){_0x3e1efa=_0x3e1efa-0x0;var _0x5b9adb=_0x3e4a[_0x3e1efa];return _0x5b9adb;};'use strict';var Sequelize=require(_0xa3e4('0x0'));module[_0xa3e4('0x1')]={'key':{'type':Sequelize[_0xa3e4('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xa3e4('0x2')]},'name':{'type':Sequelize[_0xa3e4('0x3')],'get':function(){return this[_0xa3e4('0x4')](_0xa3e4('0x5'));}}}; \ No newline at end of file +var _0x8c96=['sequelize','exports','TEXT','STRING','VIRTUAL','getDataValue'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0x8c96,0x1f2));var _0x68c9=function(_0x393868,_0x491e3c){_0x393868=_0x393868-0x0;var _0x42bc61=_0x8c96[_0x393868];return _0x42bc61;};'use strict';var Sequelize=require(_0x68c9('0x0'));module[_0x68c9('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x68c9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68c9('0x3')]},'name':{'type':Sequelize[_0x68c9('0x4')],'get':function(){return this[_0x68c9('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 7c0cff9..56ea1e8 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 _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','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','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x1a9bc2,_0x5c2e82){var _0x387349=function(_0x117361){while(--_0x117361){_0x1a9bc2['push'](_0x1a9bc2['shift']());}};_0x387349(++_0x5c2e82);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['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('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,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(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_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 965803b..18f2acd 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 _0xf6fb=['bluebird','request-promise','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','../../config/logger','api'];(function(_0x2c1a22,_0x39ee8e){var _0x219ff4=function(_0x4c7cf8){while(--_0x4c7cf8){_0x2c1a22['push'](_0x2c1a22['shift']());}};_0x219ff4(++_0x39ee8e);}(_0xf6fb,0x111));var _0xbf6f=function(_0x3495b5,_0x1c0aa3){_0x3495b5=_0x3495b5-0x0;var _0x12e39f=_0xf6fb[_0x3495b5];return _0x12e39f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf6f('0x0'))(_0xbf6f('0x1'));var moment=require('moment');var BPromise=require(_0xbf6f('0x2'));var rp=require(_0xbf6f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf6f('0x4'));var config=require('../../config/environment');var attributes=require(_0xbf6f('0x5'));module[_0xbf6f('0x6')]=function(_0x2d8ffb,_0x370983){return _0x2d8ffb[_0xbf6f('0x7')](_0xbf6f('0x8'),attributes,{'tableName':_0xbf6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbf6f('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9e7c=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x11ec6a,_0x1ca08e){var _0x453290=function(_0x269a5b){while(--_0x269a5b){_0x11ec6a['push'](_0x11ec6a['shift']());}};_0x453290(++_0x1ca08e);}(_0x9e7c,0xc6));var _0xc9e7=function(_0x8974aa,_0x5d179c){_0x8974aa=_0x8974aa-0x0;var _0x2993e7=_0x9e7c[_0x8974aa];return _0x2993e7;};'use strict';var _=require(_0xc9e7('0x0'));var util=require(_0xc9e7('0x1'));var logger=require(_0xc9e7('0x2'))(_0xc9e7('0x3'));var moment=require(_0xc9e7('0x4'));var BPromise=require(_0xc9e7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9e7('0x6'));var rimraf=require(_0xc9e7('0x7'));var config=require(_0xc9e7('0x8'));var attributes=require(_0xc9e7('0x9'));module[_0xc9e7('0xa')]=function(_0x1e0d6c,_0xf54995){return _0x1e0d6c[_0xc9e7('0xb')]('CannedAnswer',attributes,{'tableName':_0xc9e7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc9e7('0xd'),'collate':_0xc9e7('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 196eadf..124ae4f 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 _0xbecf=['jayson/promise','client','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1b8077,_0x2c1e02){var _0x5b003d=function(_0x3715b0){while(--_0x3715b0){_0x1b8077['push'](_0x1b8077['shift']());}};_0x5b003d(++_0x2c1e02);}(_0xbecf,0x149));var _0xfbec=function(_0x43c16f,_0x1ccc87){_0x43c16f=_0x43c16f-0x0;var _0x294b0a=_0xbecf[_0x43c16f];return _0x294b0a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfbec('0x0'));var BPromise=require(_0xfbec('0x1'));var rs=require(_0xfbec('0x2'));var fs=require('fs');var Redis=require(_0xfbec('0x3'));var db=require(_0xfbec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbec('0x5'))(_0xfbec('0x6'));var config=require('../../config/environment');var jayson=require(_0xfbec('0x7'));var client=jayson[_0xfbec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cb1d7,_0x591f83,_0x5619e1){return new BPromise(function(_0x510599,_0x14f707){return client[_0xfbec('0x9')](_0x2cb1d7,_0x5619e1)[_0xfbec('0xa')](function(_0x449c55){logger[_0xfbec('0xb')](_0xfbec('0xc'),_0x591f83,_0xfbec('0xd'));logger[_0xfbec('0xe')](_0xfbec('0xf'),_0x591f83,_0xfbec('0xd'),JSON['stringify'](_0x449c55));if(_0x449c55[_0xfbec('0x10')]){if(_0x449c55[_0xfbec('0x10')][_0xfbec('0x11')]===0x1f4){logger[_0xfbec('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x591f83,_0x449c55[_0xfbec('0x10')][_0xfbec('0x12')]);return _0x14f707(_0x449c55[_0xfbec('0x10')][_0xfbec('0x12')]);}logger[_0xfbec('0x10')](_0xfbec('0xc'),_0x591f83,_0x449c55[_0xfbec('0x10')][_0xfbec('0x12')]);return _0x510599(_0x449c55['error'][_0xfbec('0x12')]);}else{logger[_0xfbec('0xb')](_0xfbec('0xc'),_0x591f83,_0xfbec('0xd'));_0x510599(_0x449c55[_0xfbec('0x13')]['message']);}})[_0xfbec('0x14')](function(_0x1922db){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x591f83,_0x1922db);_0x14f707(_0x1922db);});});} \ No newline at end of file +var _0xfc63=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','CannedAnswer,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x33c07b,_0x536bd8){var _0x276184=function(_0x3f0d72){while(--_0x3f0d72){_0x33c07b['push'](_0x33c07b['shift']());}};_0x276184(++_0x536bd8);}(_0xfc63,0xec));var _0x3fc6=function(_0x49b957,_0x503728){_0x49b957=_0x49b957-0x0;var _0x19238d=_0xfc63[_0x49b957];return _0x19238d;};'use strict';var _=require(_0x3fc6('0x0'));var util=require(_0x3fc6('0x1'));var moment=require(_0x3fc6('0x2'));var BPromise=require(_0x3fc6('0x3'));var rs=require(_0x3fc6('0x4'));var fs=require('fs');var Redis=require(_0x3fc6('0x5'));var db=require(_0x3fc6('0x6'))['db'];var utils=require(_0x3fc6('0x7'));var logger=require('../../config/logger')(_0x3fc6('0x8'));var config=require('../../config/environment');var jayson=require(_0x3fc6('0x9'));var client=jayson['client'][_0x3fc6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5705ad,_0x24db68,_0x23740e){return new BPromise(function(_0x3796e4,_0x1753f5){return client[_0x3fc6('0xb')](_0x5705ad,_0x23740e)['then'](function(_0x13e80d){logger[_0x3fc6('0xc')]('CannedAnswer,\x20%s,\x20%s',_0x24db68,_0x3fc6('0xd'));logger[_0x3fc6('0xe')](_0x3fc6('0xf'),_0x24db68,'request\x20sent',JSON['stringify'](_0x13e80d));if(_0x13e80d['error']){if(_0x13e80d[_0x3fc6('0x10')]['code']===0x1f4){logger['error'](_0x3fc6('0x11'),_0x24db68,_0x13e80d['error'][_0x3fc6('0x12')]);return _0x1753f5(_0x13e80d['error'][_0x3fc6('0x12')]);}logger[_0x3fc6('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x24db68,_0x13e80d[_0x3fc6('0x10')][_0x3fc6('0x12')]);return _0x3796e4(_0x13e80d[_0x3fc6('0x10')]['message']);}else{logger[_0x3fc6('0xc')](_0x3fc6('0x11'),_0x24db68,'request\x20sent');_0x3796e4(_0x13e80d['result'][_0x3fc6('0x12')]);}})[_0x3fc6('0x13')](function(_0x347339){logger[_0x3fc6('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x24db68,_0x347339);_0x1753f5(_0x347339);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index dc86e78..33523da 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 _0x70e8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2ea654,_0xac6ea3){var _0xfea024=function(_0x283003){while(--_0x283003){_0x2ea654['push'](_0x2ea654['shift']());}};_0xfea024(++_0xac6ea3);}(_0x70e8,0x106));var _0x870e=function(_0x1b7df9,_0x37e1a4){_0x1b7df9=_0x1b7df9-0x0;var _0x5f0b7c=_0x70e8[_0x1b7df9];return _0x5f0b7c;};'use strict';var multer=require(_0x870e('0x0'));var util=require(_0x870e('0x1'));var path=require(_0x870e('0x2'));var timeout=require(_0x870e('0x3'));var express=require('express');var router=express[_0x870e('0x4')]();var auth=require(_0x870e('0x5'));var interaction=require(_0x870e('0x6'));var config=require(_0x870e('0x7'));var controller=require(_0x870e('0x8'));router[_0x870e('0x9')]('/',auth[_0x870e('0xa')](),controller[_0x870e('0xb')]);router[_0x870e('0x9')](_0x870e('0xc'),auth[_0x870e('0xa')](),controller[_0x870e('0xd')]);router['post']('/',auth[_0x870e('0xa')](),controller[_0x870e('0xe')]);router['put'](_0x870e('0xc'),auth['isAuthenticated'](),controller[_0x870e('0xf')]);router[_0x870e('0x10')](_0x870e('0xc'),auth[_0x870e('0xa')](),controller[_0x870e('0x11')]);module[_0x870e('0x12')]=router; \ No newline at end of file +var _0xa9a1=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x59dd9b,_0x575658){var _0x585384=function(_0xba538c){while(--_0xba538c){_0x59dd9b['push'](_0x59dd9b['shift']());}};_0x585384(++_0x575658);}(_0xa9a1,0x1dd));var _0x1a9a=function(_0x1ce8e4,_0x3dec24){_0x1ce8e4=_0x1ce8e4-0x0;var _0x5e7a71=_0xa9a1[_0x1ce8e4];return _0x5e7a71;};'use strict';var multer=require(_0x1a9a('0x0'));var util=require(_0x1a9a('0x1'));var path=require(_0x1a9a('0x2'));var timeout=require(_0x1a9a('0x3'));var express=require('express');var router=express[_0x1a9a('0x4')]();var auth=require(_0x1a9a('0x5'));var interaction=require(_0x1a9a('0x6'));var config=require(_0x1a9a('0x7'));var controller=require(_0x1a9a('0x8'));router['get']('/',auth[_0x1a9a('0x9')](),controller[_0x1a9a('0xa')]);router[_0x1a9a('0xb')](_0x1a9a('0xc'),auth[_0x1a9a('0x9')](),controller[_0x1a9a('0xd')]);router['post']('/',auth[_0x1a9a('0x9')](),controller[_0x1a9a('0xe')]);router[_0x1a9a('0xf')](_0x1a9a('0xc'),auth[_0x1a9a('0x9')](),controller[_0x1a9a('0x10')]);router[_0x1a9a('0x11')](_0x1a9a('0xc'),auth[_0x1a9a('0x9')](),controller[_0x1a9a('0x12')]);module[_0x1a9a('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index e384bb4..1e68d5e 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 _0x08d8=['STRING','INTEGER','sequelize','DATE','1970-01-01\x2000:00:01'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x08d8,0x147));var _0x808d=function(_0x2d3582,_0x198bfa){_0x2d3582=_0x2d3582-0x0;var _0x506230=_0x08d8[_0x2d3582];return _0x506230;};'use strict';var Sequelize=require(_0x808d('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x808d('0x1')],'allowNull':![],'defaultValue':_0x808d('0x2')},'clid':{'type':Sequelize[_0x808d('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x808d('0x3')]},'dcontext':{'type':Sequelize[_0x808d('0x3')]},'channel':{'type':Sequelize[_0x808d('0x3')]},'dstchannel':{'type':Sequelize[_0x808d('0x3')]},'lastapp':{'type':Sequelize[_0x808d('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x808d('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x808d('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x808d('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x808d('0x3')]},'userfield':{'type':Sequelize[_0x808d('0x3')]},'uniqueid':{'type':Sequelize[_0x808d('0x3')]},'linkedid':{'type':Sequelize[_0x808d('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x808d('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x808d('0x3')]}}; \ No newline at end of file +var _0x3aad=['sequelize','exports','DATE','STRING','INTEGER'];(function(_0x17d894,_0x3e533a){var _0x4d66d6=function(_0xc72bcd){while(--_0xc72bcd){_0x17d894['push'](_0x17d894['shift']());}};_0x4d66d6(++_0x3e533a);}(_0x3aad,0x13b));var _0xd3aa=function(_0x12ac5b,_0x23aed9){_0x12ac5b=_0x12ac5b-0x0;var _0x47ec60=_0x3aad[_0x12ac5b];return _0x47ec60;};'use strict';var Sequelize=require(_0xd3aa('0x0'));module[_0xd3aa('0x1')]={'calldate':{'type':Sequelize[_0xd3aa('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xd3aa('0x3')]},'src':{'type':Sequelize[_0xd3aa('0x3')]},'dst':{'type':Sequelize[_0xd3aa('0x3')]},'dcontext':{'type':Sequelize[_0xd3aa('0x3')]},'channel':{'type':Sequelize[_0xd3aa('0x3')]},'dstchannel':{'type':Sequelize[_0xd3aa('0x3')]},'lastapp':{'type':Sequelize[_0xd3aa('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xd3aa('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd3aa('0x3')]},'userfield':{'type':Sequelize[_0xd3aa('0x3')]},'uniqueid':{'type':Sequelize[_0xd3aa('0x3')]},'linkedid':{'type':Sequelize[_0xd3aa('0x3')]},'sequence':{'type':Sequelize[_0xd3aa('0x3')]},'peeraccount':{'type':Sequelize[_0xd3aa('0x3')]},'type':{'type':Sequelize[_0xd3aa('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 5dbaa60..9fb897b 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 _0xaf1a=['json','offset','limit','status','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Cdr','count','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0xaf1a,0x1ec));var _0xaaf1=function(_0x41a6ce,_0xff89d4){_0x41a6ce=_0x41a6ce-0x0;var _0x1815f1=_0xaf1a[_0x41a6ce];return _0x1815f1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaaf1('0x0'));var rimraf=require(_0xaaf1('0x1'));var zipdir=require(_0xaaf1('0x2'));var jsonpatch=require(_0xaaf1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaaf1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaaf1('0x5'));var sox=require(_0xaaf1('0x6'));var csv=require(_0xaaf1('0x7'));var ejs=require(_0xaaf1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaaf1('0x9'));var crypto=require('crypto');var jsforce=require(_0xaaf1('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xaaf1('0x7'));var querystring=require(_0xaaf1('0xb'));var Papa=require(_0xaaf1('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaaf1('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaaf1('0xe'))('api');var utils=require(_0xaaf1('0xf'));var config=require(_0xaaf1('0x10'));var licenseUtil=require(_0xaaf1('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec9582,_0x1c6779){_0x1c6779=_0x1c6779||0xcc;return function(_0x17813f){if(_0x17813f){return _0xec9582[_0xaaf1('0x12')](_0x1c6779);}return _0xec9582['status'](_0x1c6779)['end']();};}function respondWithResult(_0x5324ec,_0x55b987){_0x55b987=_0x55b987||0xc8;return function(_0x708c3e){if(_0x708c3e){return _0x5324ec['status'](_0x55b987)[_0xaaf1('0x13')](_0x708c3e);}};}function respondWithFilteredResult(_0x452757,_0x2aeb74){return function(_0x21770c){if(_0x21770c){var _0x364cda=_0x21770c['count'],_0x5b1108=_0x2aeb74['offset'],_0x5487b5=_0x2aeb74[_0xaaf1('0x14')]+_0x2aeb74[_0xaaf1('0x15')],_0x1109d0;if(_0x5487b5>=_0x364cda){_0x5487b5=_0x364cda;_0x1109d0=0xc8;}else{_0x1109d0=0xce;}_0x452757[_0xaaf1('0x16')](_0x1109d0);return _0x452757[_0xaaf1('0x17')](_0xaaf1('0x18'),_0x5b1108+'-'+_0x5487b5+'/'+_0x364cda)[_0xaaf1('0x13')](_0x21770c);}return null;};}function patchUpdates(_0x1af94b){return function(_0x59335f){try{jsonpatch[_0xaaf1('0x19')](_0x59335f,_0x1af94b,!![]);}catch(_0x4b5595){return BPromise[_0xaaf1('0x1a')](_0x4b5595);}return _0x59335f[_0xaaf1('0x1b')]();};}function saveUpdates(_0xaa8d01,_0x5b2401){return function(_0x4fdcc8){if(_0x4fdcc8){return _0x4fdcc8['update'](_0xaa8d01)['then'](function(_0xf22c6){return _0xf22c6;});}return null;};}function removeEntity(_0x2e1f37,_0x1a87a4){return function(_0x44f71d){if(_0x44f71d){return _0x44f71d[_0xaaf1('0x1c')]()[_0xaaf1('0x1d')](function(){_0x2e1f37[_0xaaf1('0x16')](0xcc)[_0xaaf1('0x1e')]();});}};}function handleEntityNotFound(_0x1be2f5,_0x120e28){return function(_0x5ddf93){if(!_0x5ddf93){_0x1be2f5['sendStatus'](0x194);}return _0x5ddf93;};}function handleError(_0x4ec445,_0x5c0042){_0x5c0042=_0x5c0042||0x1f4;return function(_0x5a27b5){logger[_0xaaf1('0x1f')](_0x5a27b5[_0xaaf1('0x20')]);if(_0x5a27b5[_0xaaf1('0x21')]){delete _0x5a27b5['name'];}_0x4ec445[_0xaaf1('0x16')](_0x5c0042)[_0xaaf1('0x22')](_0x5a27b5);};}exports[_0xaaf1('0x23')]=function(_0x521d76,_0x3de669){var _0x12008f={},_0x56d8eb={},_0x23d9f4={'count':0x0,'rows':[]};var _0x499e4d=_[_0xaaf1('0x24')](db['Cdr'][_0xaaf1('0x25')],function(_0x1c3389){return{'name':_0x1c3389[_0xaaf1('0x26')],'type':_0x1c3389[_0xaaf1('0x27')][_0xaaf1('0x28')]};});_0x56d8eb[_0xaaf1('0x29')]=_[_0xaaf1('0x24')](_0x499e4d,_0xaaf1('0x21'));_0x56d8eb[_0xaaf1('0x2a')]=_[_0xaaf1('0x2b')](_0x521d76['query']);_0x56d8eb['filters']=_[_0xaaf1('0x2c')](_0x56d8eb[_0xaaf1('0x29')],_0x56d8eb[_0xaaf1('0x2a')]);_0x12008f[_0xaaf1('0x2d')]=_[_0xaaf1('0x2c')](_0x56d8eb['model'],qs[_0xaaf1('0x2e')](_0x521d76['query'][_0xaaf1('0x2e')]));_0x12008f[_0xaaf1('0x2d')]=_0x12008f['attributes'][_0xaaf1('0x2f')]?_0x12008f['attributes']:_0x56d8eb[_0xaaf1('0x29')];if(!_0x521d76[_0xaaf1('0x2a')][_0xaaf1('0x30')](_0xaaf1('0x31'))){_0x12008f[_0xaaf1('0x15')]=qs[_0xaaf1('0x15')](_0x521d76[_0xaaf1('0x2a')][_0xaaf1('0x15')]);_0x12008f[_0xaaf1('0x14')]=qs['offset'](_0x521d76[_0xaaf1('0x2a')]['offset']);}_0x12008f[_0xaaf1('0x32')]=qs[_0xaaf1('0x33')](_0x521d76[_0xaaf1('0x2a')]['sort']);_0x12008f[_0xaaf1('0x34')]=qs[_0xaaf1('0x35')](_[_0xaaf1('0x36')](_0x521d76[_0xaaf1('0x2a')],_0x56d8eb['filters']),_0x499e4d);if(_0x521d76[_0xaaf1('0x2a')][_0xaaf1('0x37')]){_0x12008f['where']=_[_0xaaf1('0x38')](_0x12008f[_0xaaf1('0x34')],{'$or':_[_0xaaf1('0x24')](_0x499e4d,function(_0x549b2c){if(_0x549b2c[_0xaaf1('0x27')]!==_0xaaf1('0x39')){var _0x4ee8fa={};_0x4ee8fa[_0x549b2c[_0xaaf1('0x21')]]={'$like':'%'+_0x521d76[_0xaaf1('0x2a')]['filter']+'%'};return _0x4ee8fa;}})});}_0x12008f=_['merge']({},_0x12008f,_0x521d76[_0xaaf1('0x3a')]);var _0x86fd83={'where':_0x12008f[_0xaaf1('0x34')]};return db[_0xaaf1('0x3b')]['count'](_0x86fd83)[_0xaaf1('0x1d')](function(_0x43d1a8){_0x23d9f4[_0xaaf1('0x3c')]=_0x43d1a8;if(_0x521d76[_0xaaf1('0x2a')][_0xaaf1('0x3d')]){_0x12008f[_0xaaf1('0x3e')]=[{'all':!![]}];}return db[_0xaaf1('0x3b')][_0xaaf1('0x3f')](_0x12008f);})[_0xaaf1('0x1d')](function(_0x250cba){_0x23d9f4[_0xaaf1('0x40')]=_0x250cba;return _0x23d9f4;})[_0xaaf1('0x1d')](respondWithFilteredResult(_0x3de669,_0x12008f))[_0xaaf1('0x41')](handleError(_0x3de669,null));};exports[_0xaaf1('0x42')]=function(_0x49d42f,_0x586037){var _0x41c0f1={'raw':!![],'where':{'id':_0x49d42f['params']['id']}},_0x33500c={};_0x33500c[_0xaaf1('0x29')]=_[_0xaaf1('0x2b')](db[_0xaaf1('0x3b')][_0xaaf1('0x25')]);_0x33500c['query']=_[_0xaaf1('0x2b')](_0x49d42f[_0xaaf1('0x2a')]);_0x33500c[_0xaaf1('0x35')]=_[_0xaaf1('0x2c')](_0x33500c[_0xaaf1('0x29')],_0x33500c[_0xaaf1('0x2a')]);_0x41c0f1[_0xaaf1('0x2d')]=_[_0xaaf1('0x2c')](_0x33500c[_0xaaf1('0x29')],qs[_0xaaf1('0x2e')](_0x49d42f[_0xaaf1('0x2a')][_0xaaf1('0x2e')]));_0x41c0f1[_0xaaf1('0x2d')]=_0x41c0f1[_0xaaf1('0x2d')][_0xaaf1('0x2f')]?_0x41c0f1['attributes']:_0x33500c['model'];if(_0x49d42f[_0xaaf1('0x2a')][_0xaaf1('0x3d')]){_0x41c0f1[_0xaaf1('0x3e')]=[{'all':!![]}];}_0x41c0f1=_[_0xaaf1('0x38')]({},_0x41c0f1,_0x49d42f[_0xaaf1('0x3a')]);return db[_0xaaf1('0x3b')][_0xaaf1('0x43')](_0x41c0f1)[_0xaaf1('0x1d')](handleEntityNotFound(_0x586037,null))[_0xaaf1('0x1d')](respondWithResult(_0x586037,null))[_0xaaf1('0x41')](handleError(_0x586037,null));};exports[_0xaaf1('0x44')]=function(_0x50020d,_0x1bed55){return db['Cdr'][_0xaaf1('0x44')](_0x50020d[_0xaaf1('0x45')],{})[_0xaaf1('0x1d')](respondWithResult(_0x1bed55,0xc9))[_0xaaf1('0x41')](handleError(_0x1bed55,null));};exports[_0xaaf1('0x46')]=function(_0x3fe2e9,_0x59ff05){if(_0x3fe2e9[_0xaaf1('0x45')]['id']){delete _0x3fe2e9[_0xaaf1('0x45')]['id'];}return db['Cdr'][_0xaaf1('0x43')]({'where':{'id':_0x3fe2e9['params']['id']}})[_0xaaf1('0x1d')](handleEntityNotFound(_0x59ff05,null))[_0xaaf1('0x1d')](saveUpdates(_0x3fe2e9['body'],null))[_0xaaf1('0x1d')](respondWithResult(_0x59ff05,null))[_0xaaf1('0x41')](handleError(_0x59ff05,null));};exports[_0xaaf1('0x1c')]=function(_0x193abc,_0x2e5819){return db['Cdr'][_0xaaf1('0x43')]({'where':{'id':_0x193abc[_0xaaf1('0x47')]['id']}})[_0xaaf1('0x1d')](handleEntityNotFound(_0x2e5819,null))[_0xaaf1('0x1d')](removeEntity(_0x2e5819,null))[_0xaaf1('0x41')](handleError(_0x2e5819,null));};exports[_0xaaf1('0x48')]=function(_0x24bb32,_0x103b24){return db[_0xaaf1('0x3b')][_0xaaf1('0x48')]()[_0xaaf1('0x1d')](respondWithResult(_0x103b24,null))[_0xaaf1('0x41')](handleError(_0x103b24,null));}; \ No newline at end of file +var _0x6cc5=['length','include','find','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','error','name','send','map','Cdr','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','rawAttributes'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x6cc5,0x11d));var _0x56cc=function(_0x457ddf,_0x51a24a){_0x457ddf=_0x457ddf-0x0;var _0x1e0a96=_0x6cc5[_0x457ddf];return _0x1e0a96;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x56cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x56cc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x56cc('0x2'));var moment=require(_0x56cc('0x3'));var BPromise=require(_0x56cc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x56cc('0x5'));var csv=require('to-csv');var ejs=require(_0x56cc('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x56cc('0x7'));var crypto=require(_0x56cc('0x8'));var jsforce=require(_0x56cc('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x56cc('0xa'));var querystring=require(_0x56cc('0xb'));var Papa=require(_0x56cc('0xc'));var Redis=require('ioredis');var authService=require(_0x56cc('0xd'));var qs=require(_0x56cc('0xe'));var as=require(_0x56cc('0xf'));var hardwareService=require(_0x56cc('0x10'));var logger=require('../../config/logger')(_0x56cc('0x11'));var utils=require(_0x56cc('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x56cc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22682b,_0x3efacb){_0x3efacb=_0x3efacb||0xcc;return function(_0x5827fc){if(_0x5827fc){return _0x22682b[_0x56cc('0x14')](_0x3efacb);}return _0x22682b[_0x56cc('0x15')](_0x3efacb)['end']();};}function respondWithResult(_0x3d673b,_0x25c0dc){_0x25c0dc=_0x25c0dc||0xc8;return function(_0x4cf856){if(_0x4cf856){return _0x3d673b[_0x56cc('0x15')](_0x25c0dc)[_0x56cc('0x16')](_0x4cf856);}};}function respondWithFilteredResult(_0x435827,_0x2627f1){return function(_0x148ab3){if(_0x148ab3){var _0x477b97=_0x148ab3[_0x56cc('0x17')],_0xcdaed4=_0x2627f1[_0x56cc('0x18')],_0x53c870=_0x2627f1[_0x56cc('0x18')]+_0x2627f1[_0x56cc('0x19')],_0x54c03c;if(_0x53c870>=_0x477b97){_0x53c870=_0x477b97;_0x54c03c=0xc8;}else{_0x54c03c=0xce;}_0x435827['status'](_0x54c03c);return _0x435827['set'](_0x56cc('0x1a'),_0xcdaed4+'-'+_0x53c870+'/'+_0x477b97)['json'](_0x148ab3);}return null;};}function patchUpdates(_0x4e3cdb){return function(_0x403456){try{jsonpatch[_0x56cc('0x1b')](_0x403456,_0x4e3cdb,!![]);}catch(_0x1e9987){return BPromise[_0x56cc('0x1c')](_0x1e9987);}return _0x403456[_0x56cc('0x1d')]();};}function saveUpdates(_0x46ccf5,_0x1b4200){return function(_0x517efa){if(_0x517efa){return _0x517efa[_0x56cc('0x1e')](_0x46ccf5)['then'](function(_0x5988f4){return _0x5988f4;});}return null;};}function removeEntity(_0x108dfd,_0x3e78f0){return function(_0x318095){if(_0x318095){return _0x318095[_0x56cc('0x1f')]()['then'](function(){_0x108dfd[_0x56cc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a57a,_0x538deb){return function(_0x2cd264){if(!_0x2cd264){_0x45a57a['sendStatus'](0x194);}return _0x2cd264;};}function handleError(_0x55d62c,_0x249741){_0x249741=_0x249741||0x1f4;return function(_0x5baabf){logger[_0x56cc('0x20')](_0x5baabf['stack']);if(_0x5baabf['name']){delete _0x5baabf[_0x56cc('0x21')];}_0x55d62c['status'](_0x249741)[_0x56cc('0x22')](_0x5baabf);};}exports['index']=function(_0x561a46,_0xe13dca){var _0x229d1d={},_0x50170c={},_0x4538f1={'count':0x0,'rows':[]};var _0x59fab9=_[_0x56cc('0x23')](db[_0x56cc('0x24')]['rawAttributes'],function(_0x1afd6d){return{'name':_0x1afd6d[_0x56cc('0x25')],'type':_0x1afd6d[_0x56cc('0x26')][_0x56cc('0x27')]};});_0x50170c['model']=_['map'](_0x59fab9,_0x56cc('0x21'));_0x50170c[_0x56cc('0x28')]=_[_0x56cc('0x29')](_0x561a46[_0x56cc('0x28')]);_0x50170c[_0x56cc('0x2a')]=_[_0x56cc('0x2b')](_0x50170c[_0x56cc('0x2c')],_0x50170c['query']);_0x229d1d['attributes']=_[_0x56cc('0x2b')](_0x50170c['model'],qs[_0x56cc('0x2d')](_0x561a46[_0x56cc('0x28')]['fields']));_0x229d1d['attributes']=_0x229d1d[_0x56cc('0x2e')]['length']?_0x229d1d[_0x56cc('0x2e')]:_0x50170c['model'];if(!_0x561a46['query'][_0x56cc('0x2f')](_0x56cc('0x30'))){_0x229d1d['limit']=qs[_0x56cc('0x19')](_0x561a46[_0x56cc('0x28')]['limit']);_0x229d1d[_0x56cc('0x18')]=qs[_0x56cc('0x18')](_0x561a46[_0x56cc('0x28')]['offset']);}_0x229d1d[_0x56cc('0x31')]=qs[_0x56cc('0x32')](_0x561a46[_0x56cc('0x28')][_0x56cc('0x32')]);_0x229d1d[_0x56cc('0x33')]=qs[_0x56cc('0x2a')](_[_0x56cc('0x34')](_0x561a46[_0x56cc('0x28')],_0x50170c[_0x56cc('0x2a')]),_0x59fab9);if(_0x561a46[_0x56cc('0x28')][_0x56cc('0x35')]){_0x229d1d[_0x56cc('0x33')]=_[_0x56cc('0x36')](_0x229d1d[_0x56cc('0x33')],{'$or':_[_0x56cc('0x23')](_0x59fab9,function(_0x3520c9){if(_0x3520c9[_0x56cc('0x26')]!==_0x56cc('0x37')){var _0x5afea4={};_0x5afea4[_0x3520c9[_0x56cc('0x21')]]={'$like':'%'+_0x561a46[_0x56cc('0x28')][_0x56cc('0x35')]+'%'};return _0x5afea4;}})});}_0x229d1d=_['merge']({},_0x229d1d,_0x561a46[_0x56cc('0x38')]);var _0x829042={'where':_0x229d1d[_0x56cc('0x33')]};return db[_0x56cc('0x24')][_0x56cc('0x17')](_0x829042)[_0x56cc('0x39')](function(_0x2a8e25){_0x4538f1[_0x56cc('0x17')]=_0x2a8e25;if(_0x561a46['query'][_0x56cc('0x3a')]){_0x229d1d['include']=[{'all':!![]}];}return db['Cdr'][_0x56cc('0x3b')](_0x229d1d);})[_0x56cc('0x39')](function(_0x260d5c){_0x4538f1[_0x56cc('0x3c')]=_0x260d5c;return _0x4538f1;})[_0x56cc('0x39')](respondWithFilteredResult(_0xe13dca,_0x229d1d))[_0x56cc('0x3d')](handleError(_0xe13dca,null));};exports[_0x56cc('0x3e')]=function(_0x78a86c,_0x44633f){var _0x1cb807={'raw':!![],'where':{'id':_0x78a86c[_0x56cc('0x3f')]['id']}},_0xf37835={};_0xf37835[_0x56cc('0x2c')]=_[_0x56cc('0x29')](db[_0x56cc('0x24')][_0x56cc('0x40')]);_0xf37835[_0x56cc('0x28')]=_[_0x56cc('0x29')](_0x78a86c[_0x56cc('0x28')]);_0xf37835[_0x56cc('0x2a')]=_['intersection'](_0xf37835[_0x56cc('0x2c')],_0xf37835[_0x56cc('0x28')]);_0x1cb807[_0x56cc('0x2e')]=_['intersection'](_0xf37835[_0x56cc('0x2c')],qs[_0x56cc('0x2d')](_0x78a86c['query']['fields']));_0x1cb807[_0x56cc('0x2e')]=_0x1cb807['attributes'][_0x56cc('0x41')]?_0x1cb807[_0x56cc('0x2e')]:_0xf37835['model'];if(_0x78a86c[_0x56cc('0x28')][_0x56cc('0x3a')]){_0x1cb807[_0x56cc('0x42')]=[{'all':!![]}];}_0x1cb807=_[_0x56cc('0x36')]({},_0x1cb807,_0x78a86c[_0x56cc('0x38')]);return db[_0x56cc('0x24')][_0x56cc('0x43')](_0x1cb807)[_0x56cc('0x39')](handleEntityNotFound(_0x44633f,null))[_0x56cc('0x39')](respondWithResult(_0x44633f,null))[_0x56cc('0x3d')](handleError(_0x44633f,null));};exports['create']=function(_0x1553b6,_0xf7b2c6){return db[_0x56cc('0x24')]['create'](_0x1553b6[_0x56cc('0x44')],{})[_0x56cc('0x39')](respondWithResult(_0xf7b2c6,0xc9))[_0x56cc('0x3d')](handleError(_0xf7b2c6,null));};exports[_0x56cc('0x1e')]=function(_0x5c994,_0x4d9025){if(_0x5c994[_0x56cc('0x44')]['id']){delete _0x5c994['body']['id'];}return db['Cdr'][_0x56cc('0x43')]({'where':{'id':_0x5c994[_0x56cc('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4d9025,null))[_0x56cc('0x39')](saveUpdates(_0x5c994[_0x56cc('0x44')],null))[_0x56cc('0x39')](respondWithResult(_0x4d9025,null))['catch'](handleError(_0x4d9025,null));};exports[_0x56cc('0x1f')]=function(_0x512cf6,_0x2dfecc){return db['Cdr'][_0x56cc('0x43')]({'where':{'id':_0x512cf6[_0x56cc('0x3f')]['id']}})[_0x56cc('0x39')](handleEntityNotFound(_0x2dfecc,null))[_0x56cc('0x39')](removeEntity(_0x2dfecc,null))[_0x56cc('0x3d')](handleError(_0x2dfecc,null));};exports['describe']=function(_0x2dbc6d,_0x362d3b){return db[_0x56cc('0x24')][_0x56cc('0x45')]()[_0x56cc('0x39')](respondWithResult(_0x362d3b,null))['catch'](handleError(_0x362d3b,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 002923c..877d334 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 _0x4888=['./cdr.attributes','exports','define','calldate','disposition','dst','src','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5c87b1,_0x368b4b){var _0x4b973c=function(_0x3135b4){while(--_0x3135b4){_0x5c87b1['push'](_0x5c87b1['shift']());}};_0x4b973c(++_0x368b4b);}(_0x4888,0x198));var _0x8488=function(_0x7472aa,_0x3971a1){_0x7472aa=_0x7472aa-0x0;var _0x12e552=_0x4888[_0x7472aa];return _0x12e552;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var logger=require(_0x8488('0x1'))(_0x8488('0x2'));var moment=require(_0x8488('0x3'));var BPromise=require(_0x8488('0x4'));var rp=require(_0x8488('0x5'));var fs=require('fs');var path=require(_0x8488('0x6'));var rimraf=require('rimraf');var config=require(_0x8488('0x7'));var attributes=require(_0x8488('0x8'));module[_0x8488('0x9')]=function(_0x421292,_0x326887){return _0x421292[_0x8488('0xa')]('Cdr',attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':'accountcode','fields':['accountcode']},{'name':_0x8488('0xb'),'fields':[_0x8488('0xb')]},{'name':'disposition','fields':[_0x8488('0xc')]},{'name':_0x8488('0xd'),'fields':[_0x8488('0xd')]},{'name':_0x8488('0xe'),'fields':['src']},{'name':_0x8488('0xf'),'fields':[_0x8488('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7c09=['accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','define','Cdr','cdr'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c09,0x102));var _0x97c0=function(_0x249d22,_0x3d2667){_0x249d22=_0x249d22-0x0;var _0x583ff8=_0x7c09[_0x249d22];return _0x583ff8;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[{'name':_0x97c0('0xc'),'fields':[_0x97c0('0xc')]},{'name':'calldate','fields':[_0x97c0('0xd')]},{'name':'disposition','fields':[_0x97c0('0xe')]},{'name':_0x97c0('0xf'),'fields':['dst']},{'name':'src','fields':[_0x97c0('0x10')]},{'name':_0x97c0('0x11'),'fields':[_0x97c0('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 1c0691c..c4218ab 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 _0xa359=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Cdr,\x20%s,\x20%s','result','catch','lodash'];(function(_0x2ef252,_0x1993fe){var _0x1139ca=function(_0x31f949){while(--_0x31f949){_0x2ef252['push'](_0x2ef252['shift']());}};_0x1139ca(++_0x1993fe);}(_0xa359,0xa7));var _0x9a35=function(_0x236c88,_0x1cd631){_0x236c88=_0x236c88-0x0;var _0x6174b6=_0xa359[_0x236c88];return _0x6174b6;};'use strict';var _=require(_0x9a35('0x0'));var util=require(_0x9a35('0x1'));var moment=require(_0x9a35('0x2'));var BPromise=require(_0x9a35('0x3'));var rs=require(_0x9a35('0x4'));var fs=require('fs');var Redis=require(_0x9a35('0x5'));var db=require(_0x9a35('0x6'))['db'];var utils=require(_0x9a35('0x7'));var logger=require(_0x9a35('0x8'))(_0x9a35('0x9'));var config=require(_0x9a35('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9a35('0xb')][_0x9a35('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x555ef3,_0x6b6063,_0x5a88d9){return new BPromise(function(_0x2c8f68,_0x935c32){return client[_0x9a35('0xd')](_0x555ef3,_0x5a88d9)[_0x9a35('0xe')](function(_0x3cdcbe){logger['info']('Cdr,\x20%s,\x20%s',_0x6b6063,'request\x20sent');logger[_0x9a35('0xf')](_0x9a35('0x10'),_0x6b6063,_0x9a35('0x11'),JSON['stringify'](_0x3cdcbe));if(_0x3cdcbe[_0x9a35('0x12')]){if(_0x3cdcbe[_0x9a35('0x12')][_0x9a35('0x13')]===0x1f4){logger[_0x9a35('0x12')]('Cdr,\x20%s,\x20%s',_0x6b6063,_0x3cdcbe[_0x9a35('0x12')][_0x9a35('0x14')]);return _0x935c32(_0x3cdcbe['error']['message']);}logger[_0x9a35('0x12')]('Cdr,\x20%s,\x20%s',_0x6b6063,_0x3cdcbe['error'][_0x9a35('0x14')]);return _0x2c8f68(_0x3cdcbe[_0x9a35('0x12')][_0x9a35('0x14')]);}else{logger['info'](_0x9a35('0x15'),_0x6b6063,'request\x20sent');_0x2c8f68(_0x3cdcbe[_0x9a35('0x16')][_0x9a35('0x14')]);}})[_0x9a35('0x17')](function(_0x4af0e2){logger[_0x9a35('0x12')](_0x9a35('0x15'),_0x6b6063,_0x4af0e2);_0x935c32(_0x4af0e2);});});} \ No newline at end of file +var _0x3f97=['request','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0xdd1887,_0x236590){var _0x35a9e3=function(_0x5cb24d){while(--_0x5cb24d){_0xdd1887['push'](_0xdd1887['shift']());}};_0x35a9e3(++_0x236590);}(_0x3f97,0x172));var _0x73f9=function(_0x5b3bf0,_0x26b4a2){_0x5b3bf0=_0x5b3bf0-0x0;var _0x57ecdd=_0x3f97[_0x5b3bf0];return _0x57ecdd;};'use strict';var _=require(_0x73f9('0x0'));var util=require(_0x73f9('0x1'));var moment=require(_0x73f9('0x2'));var BPromise=require('bluebird');var rs=require(_0x73f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73f9('0x4'))['db'];var utils=require(_0x73f9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x73f9('0x6'));var jayson=require(_0x73f9('0x7'));var client=jayson[_0x73f9('0x8')][_0x73f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ee0eb,_0x15f235,_0x5e16c5){return new BPromise(function(_0x574a66,_0x564726){return client[_0x73f9('0xa')](_0x3ee0eb,_0x5e16c5)['then'](function(_0xc7bda0){logger[_0x73f9('0xb')](_0x73f9('0xc'),_0x15f235,_0x73f9('0xd'));logger['debug'](_0x73f9('0xe'),_0x15f235,_0x73f9('0xd'),JSON[_0x73f9('0xf')](_0xc7bda0));if(_0xc7bda0[_0x73f9('0x10')]){if(_0xc7bda0['error'][_0x73f9('0x11')]===0x1f4){logger[_0x73f9('0x10')]('Cdr,\x20%s,\x20%s',_0x15f235,_0xc7bda0[_0x73f9('0x10')][_0x73f9('0x12')]);return _0x564726(_0xc7bda0[_0x73f9('0x10')]['message']);}logger[_0x73f9('0x10')](_0x73f9('0xc'),_0x15f235,_0xc7bda0[_0x73f9('0x10')][_0x73f9('0x12')]);return _0x574a66(_0xc7bda0[_0x73f9('0x10')][_0x73f9('0x12')]);}else{logger['info'](_0x73f9('0xc'),_0x15f235,_0x73f9('0xd'));_0x574a66(_0xc7bda0['result'][_0x73f9('0x12')]);}})[_0x73f9('0x13')](function(_0x203b5a){logger[_0x73f9('0x10')]('Cdr,\x20%s,\x20%s',_0x15f235,_0x203b5a);_0x564726(_0x203b5a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 78a8296..2c99ea6 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 _0xc87f=['get','index','/describe','isAuthenticated','describe','/:id','show','post','create','delete','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./cdr.controller'];(function(_0x256a78,_0x5ae808){var _0x458a1e=function(_0x3b110a){while(--_0x3b110a){_0x256a78['push'](_0x256a78['shift']());}};_0x458a1e(++_0x5ae808);}(_0xc87f,0x12b));var _0xfc87=function(_0x4cc297,_0x516a34){_0x4cc297=_0x4cc297-0x0;var _0x130efa=_0xc87f[_0x4cc297];return _0x130efa;};'use strict';var multer=require('multer');var util=require(_0xfc87('0x0'));var path=require(_0xfc87('0x1'));var timeout=require('connect-timeout');var express=require(_0xfc87('0x2'));var router=express[_0xfc87('0x3')]();var auth=require(_0xfc87('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfc87('0x5'));var controller=require(_0xfc87('0x6'));router[_0xfc87('0x7')]('/',auth['isAuthenticated'](),controller[_0xfc87('0x8')]);router['get'](_0xfc87('0x9'),auth[_0xfc87('0xa')](),controller[_0xfc87('0xb')]);router[_0xfc87('0x7')](_0xfc87('0xc'),auth[_0xfc87('0xa')](),controller[_0xfc87('0xd')]);router[_0xfc87('0xe')]('/',auth[_0xfc87('0xa')](),controller[_0xfc87('0xf')]);router['put'](_0xfc87('0xc'),auth[_0xfc87('0xa')](),controller['update']);router[_0xfc87('0x10')]('/:id',auth[_0xfc87('0xa')](),controller['destroy']);module[_0xfc87('0x11')]=router; \ No newline at end of file +var _0x546d=['../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','/:id','post','create','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x522899,_0x51fc5f){var _0x26101c=function(_0x26f2a3){while(--_0x26f2a3){_0x522899['push'](_0x522899['shift']());}};_0x26101c(++_0x51fc5f);}(_0x546d,0xda));var _0xd546=function(_0x1b41a4,_0x225541){_0x1b41a4=_0x1b41a4-0x0;var _0x4a34d9=_0x546d[_0x1b41a4];return _0x4a34d9;};'use strict';var multer=require(_0xd546('0x0'));var util=require(_0xd546('0x1'));var path=require(_0xd546('0x2'));var timeout=require(_0xd546('0x3'));var express=require('express');var router=express[_0xd546('0x4')]();var auth=require(_0xd546('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd546('0x6'));var controller=require(_0xd546('0x7'));router[_0xd546('0x8')]('/',auth[_0xd546('0x9')](),controller[_0xd546('0xa')]);router['get'](_0xd546('0xb'),auth[_0xd546('0x9')](),controller['describe']);router[_0xd546('0x8')](_0xd546('0xc'),auth[_0xd546('0x9')](),controller['show']);router[_0xd546('0xd')]('/',auth[_0xd546('0x9')](),controller[_0xd546('0xe')]);router['put'](_0xd546('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd546('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xd546('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 882e106..e6fba89 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 _0x945d=['STRING','*,*,*,*','sequelize','exports'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x945d,0xe2));var _0xd945=function(_0x1d3101,_0x46c294){_0x1d3101=_0x1d3101-0x0;var _0x14c426=_0x945d[_0x1d3101];return _0x14c426;};'use strict';var Sequelize=require(_0xd945('0x0'));module[_0xd945('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd945('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd945('0x2')],'defaultValue':_0xd945('0x3')}}; \ No newline at end of file +var _0x19d1=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x10cc4a,_0x273c34){var _0xb55da0=function(_0x56962f){while(--_0x56962f){_0x10cc4a['push'](_0x10cc4a['shift']());}};_0xb55da0(++_0x273c34);}(_0x19d1,0x1c7));var _0x119d=function(_0x530f04,_0x342842){_0x530f04=_0x530f04-0x0;var _0x252d5e=_0x19d1[_0x530f04];return _0x252d5e;};'use strict';var Sequelize=require('sequelize');module[_0x119d('0x0')]={'priority':{'type':Sequelize[_0x119d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x119d('0x2')],'allowNull':![],'defaultValue':_0x119d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x119d('0x2')]},'interval':{'type':Sequelize[_0x119d('0x2')],'defaultValue':_0x119d('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index e49040a..a348a40 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 _0x11a1=['update','destroy','then','error','stack','show','model','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','ChatApplication','body','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','save'];(function(_0x4358a2,_0x17b048){var _0x1164b2=function(_0x3e12ca){while(--_0x3e12ca){_0x4358a2['push'](_0x4358a2['shift']());}};_0x1164b2(++_0x17b048);}(_0x11a1,0x16c));var _0x111a=function(_0x530b69,_0x1a43c1){_0x530b69=_0x530b69-0x0;var _0x5e58fe=_0x11a1[_0x530b69];return _0x5e58fe;};'use strict';var pdf=require(_0x111a('0x0'));var emlformat=require(_0x111a('0x1'));var rimraf=require(_0x111a('0x2'));var zipdir=require(_0x111a('0x3'));var jsonpatch=require(_0x111a('0x4'));var rp=require(_0x111a('0x5'));var moment=require(_0x111a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x111a('0x7'));var util=require(_0x111a('0x8'));var path=require(_0x111a('0x9'));var sox=require(_0x111a('0xa'));var csv=require(_0x111a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x111a('0xc'));var squel=require(_0x111a('0xd'));var crypto=require('crypto');var jsforce=require(_0x111a('0xe'));var deskjs=require(_0x111a('0xf'));var toCsv=require(_0x111a('0xb'));var querystring=require('querystring');var Papa=require(_0x111a('0x10'));var Redis=require(_0x111a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x111a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x111a('0x13'));var logger=require(_0x111a('0x14'))(_0x111a('0x15'));var utils=require(_0x111a('0x16'));var config=require(_0x111a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x111a('0x18'))['db'];function respondWithStatusCode(_0xe63973,_0x6f3879){_0x6f3879=_0x6f3879||0xcc;return function(_0x1c6a3f){if(_0x1c6a3f){return _0xe63973[_0x111a('0x19')](_0x6f3879);}return _0xe63973[_0x111a('0x1a')](_0x6f3879)[_0x111a('0x1b')]();};}function respondWithResult(_0x105014,_0x1fcf07){_0x1fcf07=_0x1fcf07||0xc8;return function(_0x4af412){if(_0x4af412){return _0x105014[_0x111a('0x1a')](_0x1fcf07)['json'](_0x4af412);}};}function respondWithFilteredResult(_0x348ae9,_0x17f7aa){return function(_0xf97afa){if(_0xf97afa){var _0x27262b=_0xf97afa[_0x111a('0x1c')],_0x3e5dc5=_0x17f7aa[_0x111a('0x1d')],_0x5bb985=_0x17f7aa['offset']+_0x17f7aa['limit'],_0x1c948e;if(_0x5bb985>=_0x27262b){_0x5bb985=_0x27262b;_0x1c948e=0xc8;}else{_0x1c948e=0xce;}_0x348ae9['status'](_0x1c948e);return _0x348ae9[_0x111a('0x1e')]('Content-Range',_0x3e5dc5+'-'+_0x5bb985+'/'+_0x27262b)[_0x111a('0x1f')](_0xf97afa);}return null;};}function patchUpdates(_0x44c2d3){return function(_0x4396d6){try{jsonpatch[_0x111a('0x20')](_0x4396d6,_0x44c2d3,!![]);}catch(_0x555b01){return BPromise[_0x111a('0x21')](_0x555b01);}return _0x4396d6[_0x111a('0x22')]();};}function saveUpdates(_0x1470af,_0x409645){return function(_0x470880){if(_0x470880){return _0x470880[_0x111a('0x23')](_0x1470af)['then'](function(_0x1f6403){return _0x1f6403;});}return null;};}function removeEntity(_0x3e26e8,_0x707443){return function(_0x3c8bf5){if(_0x3c8bf5){return _0x3c8bf5[_0x111a('0x24')]()[_0x111a('0x25')](function(){_0x3e26e8[_0x111a('0x1a')](0xcc)[_0x111a('0x1b')]();});}};}function handleEntityNotFound(_0x48d15c,_0x235aea){return function(_0x5f0c93){if(!_0x5f0c93){_0x48d15c[_0x111a('0x19')](0x194);}return _0x5f0c93;};}function handleError(_0x3a11f5,_0x32e7c7){_0x32e7c7=_0x32e7c7||0x1f4;return function(_0x5f42c9){logger[_0x111a('0x26')](_0x5f42c9[_0x111a('0x27')]);if(_0x5f42c9['name']){delete _0x5f42c9['name'];}_0x3a11f5[_0x111a('0x1a')](_0x32e7c7)['send'](_0x5f42c9);};}exports[_0x111a('0x28')]=function(_0x354105,_0xe1cba5){var _0x278459={'raw':!![],'where':{'id':_0x354105['params']['id']}},_0x59468f={};_0x59468f[_0x111a('0x29')]=_['keys'](db['ChatApplication'][_0x111a('0x2a')]);_0x59468f[_0x111a('0x2b')]=_['keys'](_0x354105['query']);_0x59468f[_0x111a('0x2c')]=_[_0x111a('0x2d')](_0x59468f[_0x111a('0x29')],_0x59468f[_0x111a('0x2b')]);_0x278459[_0x111a('0x2e')]=_['intersection'](_0x59468f[_0x111a('0x29')],qs[_0x111a('0x2f')](_0x354105[_0x111a('0x2b')][_0x111a('0x2f')]));_0x278459[_0x111a('0x2e')]=_0x278459['attributes'][_0x111a('0x30')]?_0x278459[_0x111a('0x2e')]:_0x59468f['model'];if(_0x354105[_0x111a('0x2b')][_0x111a('0x31')]){_0x278459[_0x111a('0x32')]=[{'all':!![]}];}_0x278459=_[_0x111a('0x33')]({},_0x278459,_0x354105[_0x111a('0x34')]);return db[_0x111a('0x35')]['find'](_0x278459)[_0x111a('0x25')](handleEntityNotFound(_0xe1cba5,null))['then'](respondWithResult(_0xe1cba5,null))['catch'](handleError(_0xe1cba5,null));};exports['update']=function(_0x40e707,_0x468461){if(_0x40e707[_0x111a('0x36')]['id']){delete _0x40e707[_0x111a('0x36')]['id'];}return db[_0x111a('0x35')]['find']({'where':{'id':_0x40e707['params']['id']}})[_0x111a('0x25')](handleEntityNotFound(_0x468461,null))[_0x111a('0x25')](saveUpdates(_0x40e707[_0x111a('0x36')],null))['then'](respondWithResult(_0x468461,null))['catch'](handleError(_0x468461,null));};exports[_0x111a('0x24')]=function(_0x546fce,_0x31e55a){return db[_0x111a('0x35')]['find']({'where':{'id':_0x546fce[_0x111a('0x37')]['id']}})[_0x111a('0x25')](handleEntityNotFound(_0x31e55a,null))[_0x111a('0x25')](removeEntity(_0x31e55a,null))[_0x111a('0x38')](handleError(_0x31e55a,null));}; \ No newline at end of file +var _0x30ac=['set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','show','params','model','keys','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','ChatApplication','find','catch','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','status','limit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x30ac,0x11b));var _0xc30a=function(_0x46a658,_0x5d68d7){_0x46a658=_0x46a658-0x0;var _0x55119f=_0x30ac[_0x46a658];return _0x55119f;};'use strict';var pdf=require(_0xc30a('0x0'));var emlformat=require(_0xc30a('0x1'));var rimraf=require(_0xc30a('0x2'));var zipdir=require(_0xc30a('0x3'));var jsonpatch=require(_0xc30a('0x4'));var rp=require('request-promise');var moment=require(_0xc30a('0x5'));var BPromise=require(_0xc30a('0x6'));var Mustache=require('mustache');var util=require(_0xc30a('0x7'));var path=require(_0xc30a('0x8'));var sox=require('sox');var csv=require(_0xc30a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc30a('0xa'));var squel=require(_0xc30a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc30a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc30a('0xd'));var Redis=require(_0xc30a('0xe'));var authService=require(_0xc30a('0xf'));var qs=require(_0xc30a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc30a('0x11'))(_0xc30a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc30a('0x13'));var db=require(_0xc30a('0x14'))['db'];function respondWithStatusCode(_0x35ad47,_0x4f8c5d){_0x4f8c5d=_0x4f8c5d||0xcc;return function(_0x1c995c){if(_0x1c995c){return _0x35ad47['sendStatus'](_0x4f8c5d);}return _0x35ad47['status'](_0x4f8c5d)['end']();};}function respondWithResult(_0x329534,_0x46df70){_0x46df70=_0x46df70||0xc8;return function(_0xcf829b){if(_0xcf829b){return _0x329534[_0xc30a('0x15')](_0x46df70)['json'](_0xcf829b);}};}function respondWithFilteredResult(_0x11fa1f,_0x2d72fb){return function(_0x1d2ae1){if(_0x1d2ae1){var _0xb8e47d=_0x1d2ae1['count'],_0x2444e=_0x2d72fb['offset'],_0x2a5f0f=_0x2d72fb['offset']+_0x2d72fb[_0xc30a('0x16')],_0x52a1eb;if(_0x2a5f0f>=_0xb8e47d){_0x2a5f0f=_0xb8e47d;_0x52a1eb=0xc8;}else{_0x52a1eb=0xce;}_0x11fa1f[_0xc30a('0x15')](_0x52a1eb);return _0x11fa1f[_0xc30a('0x17')](_0xc30a('0x18'),_0x2444e+'-'+_0x2a5f0f+'/'+_0xb8e47d)['json'](_0x1d2ae1);}return null;};}function patchUpdates(_0x49940a){return function(_0x54fc83){try{jsonpatch[_0xc30a('0x19')](_0x54fc83,_0x49940a,!![]);}catch(_0x3682ac){return BPromise[_0xc30a('0x1a')](_0x3682ac);}return _0x54fc83[_0xc30a('0x1b')]();};}function saveUpdates(_0x4d6a68,_0x4ec1f5){return function(_0x1488cf){if(_0x1488cf){return _0x1488cf[_0xc30a('0x1c')](_0x4d6a68)[_0xc30a('0x1d')](function(_0x580b53){return _0x580b53;});}return null;};}function removeEntity(_0xec636c,_0x596ca7){return function(_0x29080f){if(_0x29080f){return _0x29080f['destroy']()[_0xc30a('0x1d')](function(){_0xec636c[_0xc30a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x354e44,_0x4e03c6){return function(_0x21d4d0){if(!_0x21d4d0){_0x354e44[_0xc30a('0x1e')](0x194);}return _0x21d4d0;};}function handleError(_0x2bc5d0,_0x447953){_0x447953=_0x447953||0x1f4;return function(_0x27a471){logger['error'](_0x27a471[_0xc30a('0x1f')]);if(_0x27a471[_0xc30a('0x20')]){delete _0x27a471['name'];}_0x2bc5d0[_0xc30a('0x15')](_0x447953)['send'](_0x27a471);};}exports[_0xc30a('0x21')]=function(_0x4d9cd6,_0x961310){var _0x5b52aa={'raw':!![],'where':{'id':_0x4d9cd6[_0xc30a('0x22')]['id']}},_0x23f3e2={};_0x23f3e2[_0xc30a('0x23')]=_[_0xc30a('0x24')](db['ChatApplication'][_0xc30a('0x25')]);_0x23f3e2[_0xc30a('0x26')]=_[_0xc30a('0x24')](_0x4d9cd6[_0xc30a('0x26')]);_0x23f3e2['filters']=_['intersection'](_0x23f3e2[_0xc30a('0x23')],_0x23f3e2[_0xc30a('0x26')]);_0x5b52aa[_0xc30a('0x27')]=_[_0xc30a('0x28')](_0x23f3e2[_0xc30a('0x23')],qs[_0xc30a('0x29')](_0x4d9cd6['query'][_0xc30a('0x29')]));_0x5b52aa[_0xc30a('0x27')]=_0x5b52aa[_0xc30a('0x27')][_0xc30a('0x2a')]?_0x5b52aa[_0xc30a('0x27')]:_0x23f3e2[_0xc30a('0x23')];if(_0x4d9cd6[_0xc30a('0x26')][_0xc30a('0x2b')]){_0x5b52aa[_0xc30a('0x2c')]=[{'all':!![]}];}_0x5b52aa=_[_0xc30a('0x2d')]({},_0x5b52aa,_0x4d9cd6['options']);return db[_0xc30a('0x2e')][_0xc30a('0x2f')](_0x5b52aa)[_0xc30a('0x1d')](handleEntityNotFound(_0x961310,null))[_0xc30a('0x1d')](respondWithResult(_0x961310,null))[_0xc30a('0x30')](handleError(_0x961310,null));};exports[_0xc30a('0x1c')]=function(_0x5a46e9,_0x7f7fc0){if(_0x5a46e9[_0xc30a('0x31')]['id']){delete _0x5a46e9[_0xc30a('0x31')]['id'];}return db[_0xc30a('0x2e')][_0xc30a('0x2f')]({'where':{'id':_0x5a46e9[_0xc30a('0x22')]['id']}})[_0xc30a('0x1d')](handleEntityNotFound(_0x7f7fc0,null))[_0xc30a('0x1d')](saveUpdates(_0x5a46e9['body'],null))['then'](respondWithResult(_0x7f7fc0,null))[_0xc30a('0x30')](handleError(_0x7f7fc0,null));};exports[_0xc30a('0x32')]=function(_0xa61c5e,_0x6aecbf){return db[_0xc30a('0x2e')][_0xc30a('0x2f')]({'where':{'id':_0xa61c5e[_0xc30a('0x22')]['id']}})['then'](handleEntityNotFound(_0x6aecbf,null))['then'](removeEntity(_0x6aecbf,null))[_0xc30a('0x30')](handleError(_0x6aecbf,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index c71c07f..7f93a33 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 a74e3d4..4844729 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 _0x12ba=['result','ChatApplication,\x20%s,\x20%s','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x12ba,0x92));var _0xa12b=function(_0xf071ef,_0x504d59){_0xf071ef=_0xf071ef-0x0;var _0x3b0060=_0x12ba[_0xf071ef];return _0x3b0060;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa12b('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa12b('0x1'));var db=require(_0xa12b('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa12b('0x3'));var config=require(_0xa12b('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xa12b('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3464d4,_0x456aa7,_0x1163fd){return new BPromise(function(_0x28987d,_0x19bdba){return client[_0xa12b('0x6')](_0x3464d4,_0x1163fd)[_0xa12b('0x7')](function(_0x2f64e9){logger[_0xa12b('0x8')]('ChatApplication,\x20%s,\x20%s',_0x456aa7,_0xa12b('0x9'));logger['debug'](_0xa12b('0xa'),_0x456aa7,'request\x20sent',JSON[_0xa12b('0xb')](_0x2f64e9));if(_0x2f64e9[_0xa12b('0xc')]){if(_0x2f64e9[_0xa12b('0xc')]['code']===0x1f4){logger[_0xa12b('0xc')]('ChatApplication,\x20%s,\x20%s',_0x456aa7,_0x2f64e9[_0xa12b('0xc')]['message']);return _0x19bdba(_0x2f64e9[_0xa12b('0xc')]['message']);}logger[_0xa12b('0xc')]('ChatApplication,\x20%s,\x20%s',_0x456aa7,_0x2f64e9[_0xa12b('0xc')][_0xa12b('0xd')]);return _0x28987d(_0x2f64e9[_0xa12b('0xc')][_0xa12b('0xd')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x456aa7,_0xa12b('0x9'));_0x28987d(_0x2f64e9[_0xa12b('0xe')]['message']);}})['catch'](function(_0x164585){logger[_0xa12b('0xc')](_0xa12b('0xf'),_0x456aa7,_0x164585);_0x19bdba(_0x164585);});});} \ No newline at end of file +var _0xac87=['ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xac87,0x137));var _0x7ac8=function(_0x20804a,_0x145e41){_0x20804a=_0x20804a-0x0;var _0x6f9cd0=_0xac87[_0x20804a];return _0x6f9cd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7ac8('0x0'));var fs=require('fs');var Redis=require(_0x7ac8('0x1'));var db=require(_0x7ac8('0x2'))['db'];var utils=require(_0x7ac8('0x3'));var logger=require(_0x7ac8('0x4'))(_0x7ac8('0x5'));var config=require(_0x7ac8('0x6'));var jayson=require(_0x7ac8('0x7'));var client=jayson[_0x7ac8('0x8')][_0x7ac8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x526feb,_0x55b2c7,_0xcaa61a){return new BPromise(function(_0x4800e5,_0x45fbe9){return client['request'](_0x526feb,_0xcaa61a)[_0x7ac8('0xa')](function(_0x1dd48e){logger[_0x7ac8('0xb')](_0x7ac8('0xc'),_0x55b2c7,_0x7ac8('0xd'));logger['debug'](_0x7ac8('0xe'),_0x55b2c7,_0x7ac8('0xd'),JSON[_0x7ac8('0xf')](_0x1dd48e));if(_0x1dd48e[_0x7ac8('0x10')]){if(_0x1dd48e[_0x7ac8('0x10')][_0x7ac8('0x11')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x55b2c7,_0x1dd48e['error'][_0x7ac8('0x12')]);return _0x45fbe9(_0x1dd48e['error'][_0x7ac8('0x12')]);}logger[_0x7ac8('0x10')](_0x7ac8('0xc'),_0x55b2c7,_0x1dd48e['error']['message']);return _0x4800e5(_0x1dd48e[_0x7ac8('0x10')][_0x7ac8('0x12')]);}else{logger[_0x7ac8('0xb')](_0x7ac8('0xc'),_0x55b2c7,_0x7ac8('0xd'));_0x4800e5(_0x1dd48e['result'][_0x7ac8('0x12')]);}})['catch'](function(_0x223dc9){logger[_0x7ac8('0x10')](_0x7ac8('0xc'),_0x55b2c7,_0x223dc9);_0x45fbe9(_0x223dc9);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index c836502..f5056e0 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 _0x7cff=['get','/:id','isAuthenticated','show','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0x4e1bc0,_0x2fd996){var _0x151f70=function(_0x236460){while(--_0x236460){_0x4e1bc0['push'](_0x4e1bc0['shift']());}};_0x151f70(++_0x2fd996);}(_0x7cff,0xf8));var _0xf7cf=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x7cff[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require('multer');var util=require(_0xf7cf('0x0'));var path=require(_0xf7cf('0x1'));var timeout=require(_0xf7cf('0x2'));var express=require('express');var router=express[_0xf7cf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf7cf('0x4'));var config=require(_0xf7cf('0x5'));var controller=require(_0xf7cf('0x6'));router[_0xf7cf('0x7')](_0xf7cf('0x8'),auth[_0xf7cf('0x9')](),controller[_0xf7cf('0xa')]);router[_0xf7cf('0xb')](_0xf7cf('0x8'),auth[_0xf7cf('0x9')](),controller['update']);router[_0xf7cf('0xc')]('/:id',auth[_0xf7cf('0x9')](),controller[_0xf7cf('0xd')]);module[_0xf7cf('0xe')]=router; \ No newline at end of file +var _0x287e=['../../config/environment','get','/:id','isAuthenticated','show','put','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xe779,_0x1a1b29){var _0x5201de=function(_0x26044f){while(--_0x26044f){_0xe779['push'](_0xe779['shift']());}};_0x5201de(++_0x1a1b29);}(_0x287e,0x80));var _0xe287=function(_0x5d80fe,_0x408944){_0x5d80fe=_0x5d80fe-0x0;var _0x119f5a=_0x287e[_0x5d80fe];return _0x119f5a;};'use strict';var multer=require(_0xe287('0x0'));var util=require(_0xe287('0x1'));var path=require(_0xe287('0x2'));var timeout=require('connect-timeout');var express=require(_0xe287('0x3'));var router=express[_0xe287('0x4')]();var auth=require(_0xe287('0x5'));var interaction=require(_0xe287('0x6'));var config=require(_0xe287('0x7'));var controller=require('./chatApplication.controller');router[_0xe287('0x8')](_0xe287('0x9'),auth[_0xe287('0xa')](),controller[_0xe287('0xb')]);router[_0xe287('0xc')](_0xe287('0x9'),auth[_0xe287('0xa')](),controller['update']);router['delete'](_0xe287('0x9'),auth[_0xe287('0xa')](),controller[_0xe287('0xd')]);module[_0xe287('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 e2ea287..6d34284 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 _0x5836=['exports'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x5836,0x1b3));var _0x6583=function(_0x4fdd16,_0x3174cb){_0x4fdd16=_0x4fdd16-0x0;var _0x553370=_0x5836[_0x4fdd16];return _0x553370;};'use strict';var Sequelize=require('sequelize');module[_0x6583('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x0d00=['STRING','BOOLEAN'];(function(_0x41a3ab,_0x4bb061){var _0x3c9da9=function(_0x37c124){while(--_0x37c124){_0x41a3ab['push'](_0x41a3ab['shift']());}};_0x3c9da9(++_0x4bb061);}(_0x0d00,0x198));var _0x00d0=function(_0x867b0a,_0x587ccf){_0x867b0a=_0x867b0a-0x0;var _0x137438=_0x0d00[_0x867b0a];return _0x137438;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x00d0('0x0')]},'write':{'type':Sequelize[_0x00d0('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index c12c862..a8a746f 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 _0x6d38=['squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','jayson/promise','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','sort','pick','where','VIRTUAL','filter','options','ChatGroup','include','findAll','show','params','includeAll','find','create','body','describe','getUnread','user','toInteger','addMembers','omit','ids','getMembers','findOne','User','order','merge','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','format','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','lodash'];(function(_0x18c72d,_0x3dfec4){var _0x45170b=function(_0x16ea6a){while(--_0x16ea6a){_0x18c72d['push'](_0x18c72d['shift']());}};_0x45170b(++_0x3dfec4);}(_0x6d38,0x1ef));var _0x86d3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6d38[_0x36eaaa];return _0x461349;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x86d3('0x0'));var rimraf=require(_0x86d3('0x1'));var zipdir=require(_0x86d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x86d3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x86d3('0x4'));var util=require(_0x86d3('0x5'));var path=require(_0x86d3('0x6'));var sox=require('sox');var csv=require(_0x86d3('0x7'));var ejs=require(_0x86d3('0x8'));var fs=require('fs');var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0x7'));var querystring=require(_0x86d3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xd'));var qs=require(_0x86d3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0xf'))(_0x86d3('0x10'));var utils=require('../../config/utils');var config=require(_0x86d3('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x12'))['db'];config[_0x86d3('0x13')]=_[_0x86d3('0x14')](config[_0x86d3('0x13')],{'host':_0x86d3('0x15'),'port':0x18eb});var socket=require(_0x86d3('0x16'))(new Redis(config[_0x86d3('0x13')]));require(_0x86d3('0x17'))['register'](socket);var jayson=require(_0x86d3('0x18'));var client=jayson[_0x86d3('0x19')][_0x86d3('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x207f6f,_0x1ea535,_0x34fb3b,_0x1ff008){return new BPromise(function(_0x44436d,_0x53b437){var _0x2d5ba9=_0x1ff008||client;return _0x2d5ba9[_0x86d3('0x1b')](_0x207f6f,_0x34fb3b)[_0x86d3('0x1c')](function(_0xa26ea2){logger[_0x86d3('0x1d')](_0x86d3('0x1e'),_0x1ea535,_0x86d3('0x1f'));logger[_0x86d3('0x20')](_0x86d3('0x21'),_0x1ea535,'request\x20sent',JSON[_0x86d3('0x22')](_0xa26ea2));if(_0xa26ea2['error']){if(_0xa26ea2[_0x86d3('0x23')]['code']===0x1f4){logger['error'](_0x86d3('0x1e'),_0x1ea535,_0xa26ea2[_0x86d3('0x23')][_0x86d3('0x24')]);return _0x53b437(_0xa26ea2[_0x86d3('0x23')]['message']);}logger[_0x86d3('0x23')]('ChatGroup,\x20%s,\x20%s',_0x1ea535,_0xa26ea2[_0x86d3('0x23')][_0x86d3('0x24')]);return _0x44436d(_0xa26ea2[_0x86d3('0x23')]['message']);}else{logger[_0x86d3('0x1d')](_0x86d3('0x1e'),_0x1ea535,_0x86d3('0x1f'));_0x44436d(_0xa26ea2['result']['message']);}})[_0x86d3('0x25')](function(_0x4d5668){logger[_0x86d3('0x23')](_0x86d3('0x1e'),_0x1ea535,_0x4d5668);_0x53b437(_0x4d5668);});});}function respondWithStatusCode(_0x3dfecd,_0x3c5fe4){_0x3c5fe4=_0x3c5fe4||0xcc;return function(_0x48b3ff){if(_0x48b3ff){return _0x3dfecd['sendStatus'](_0x3c5fe4);}return _0x3dfecd[_0x86d3('0x26')](_0x3c5fe4)[_0x86d3('0x27')]();};}function respondWithResult(_0x50291c,_0x14e325){_0x14e325=_0x14e325||0xc8;return function(_0x5b126e){if(_0x5b126e){return _0x50291c[_0x86d3('0x26')](_0x14e325)[_0x86d3('0x28')](_0x5b126e);}};}function respondWithFilteredResult(_0x287b96,_0x763bdb){return function(_0x11a6fd){if(_0x11a6fd){var _0x14c9ff=_0x11a6fd[_0x86d3('0x29')],_0x1f203e=_0x763bdb[_0x86d3('0x2a')],_0x35d708=_0x763bdb[_0x86d3('0x2a')]+_0x763bdb[_0x86d3('0x2b')],_0x303f13;if(_0x35d708>=_0x14c9ff){_0x35d708=_0x14c9ff;_0x303f13=0xc8;}else{_0x303f13=0xce;}_0x287b96[_0x86d3('0x26')](_0x303f13);return _0x287b96['set'](_0x86d3('0x2c'),_0x1f203e+'-'+_0x35d708+'/'+_0x14c9ff)[_0x86d3('0x28')](_0x11a6fd);}return null;};}function patchUpdates(_0x2bda35){return function(_0x31cefe){try{jsonpatch[_0x86d3('0x2d')](_0x31cefe,_0x2bda35,!![]);}catch(_0x245e39){return BPromise['reject'](_0x245e39);}return _0x31cefe[_0x86d3('0x2e')]();};}function saveUpdates(_0x5c71df,_0x5b61b2){return function(_0x20fa21){if(_0x20fa21){return _0x20fa21[_0x86d3('0x2f')](_0x5c71df)[_0x86d3('0x1c')](function(_0x4ca4fc){return _0x4ca4fc;});}return null;};}function removeEntity(_0x3866b8,_0x458802){return function(_0x5b8fdd){if(_0x5b8fdd){return _0x5b8fdd[_0x86d3('0x30')]()[_0x86d3('0x1c')](function(){_0x3866b8[_0x86d3('0x26')](0xcc)[_0x86d3('0x27')]();});}};}function handleEntityNotFound(_0x1196b6,_0x2fdad0){return function(_0x2c5ecf){if(!_0x2c5ecf){_0x1196b6[_0x86d3('0x31')](0x194);}return _0x2c5ecf;};}function handleError(_0x541309,_0x4cdf45){_0x4cdf45=_0x4cdf45||0x1f4;return function(_0x536b98){logger[_0x86d3('0x23')](_0x536b98['stack']);if(_0x536b98[_0x86d3('0x32')]){delete _0x536b98['name'];}_0x541309[_0x86d3('0x26')](_0x4cdf45)[_0x86d3('0x33')](_0x536b98);};}exports[_0x86d3('0x34')]=function(_0x15e52c,_0x1e22c2){var _0x40a4ec={},_0x2d15b9={},_0x4f5875={'count':0x0,'rows':[]};var _0x11acc1=_[_0x86d3('0x35')](db['ChatGroup'][_0x86d3('0x36')],function(_0x3e115d){return{'name':_0x3e115d[_0x86d3('0x37')],'type':_0x3e115d[_0x86d3('0x38')]['key']};});_0x2d15b9[_0x86d3('0x39')]=_[_0x86d3('0x35')](_0x11acc1,_0x86d3('0x32'));_0x2d15b9['query']=_[_0x86d3('0x3a')](_0x15e52c[_0x86d3('0x3b')]);_0x2d15b9[_0x86d3('0x3c')]=_[_0x86d3('0x3d')](_0x2d15b9[_0x86d3('0x39')],_0x2d15b9[_0x86d3('0x3b')]);_0x40a4ec[_0x86d3('0x3e')]=_[_0x86d3('0x3d')](_0x2d15b9['model'],qs[_0x86d3('0x3f')](_0x15e52c[_0x86d3('0x3b')][_0x86d3('0x3f')]));_0x40a4ec[_0x86d3('0x3e')]=_0x40a4ec['attributes'][_0x86d3('0x40')]?_0x40a4ec[_0x86d3('0x3e')]:_0x2d15b9[_0x86d3('0x39')];if(!_0x15e52c[_0x86d3('0x3b')]['hasOwnProperty']('nolimit')){_0x40a4ec[_0x86d3('0x2b')]=qs['limit'](_0x15e52c['query'][_0x86d3('0x2b')]);_0x40a4ec[_0x86d3('0x2a')]=qs[_0x86d3('0x2a')](_0x15e52c[_0x86d3('0x3b')][_0x86d3('0x2a')]);}_0x40a4ec['order']=qs[_0x86d3('0x41')](_0x15e52c[_0x86d3('0x3b')][_0x86d3('0x41')]);_0x40a4ec['where']=qs[_0x86d3('0x3c')](_[_0x86d3('0x42')](_0x15e52c['query'],_0x2d15b9[_0x86d3('0x3c')]),_0x11acc1);if(_0x15e52c[_0x86d3('0x3b')]['filter']){_0x40a4ec['where']=_['merge'](_0x40a4ec[_0x86d3('0x43')],{'$or':_[_0x86d3('0x35')](_0x11acc1,function(_0x82bbcd){if(_0x82bbcd[_0x86d3('0x38')]!==_0x86d3('0x44')){var _0x447bf2={};_0x447bf2[_0x82bbcd['name']]={'$like':'%'+_0x15e52c[_0x86d3('0x3b')][_0x86d3('0x45')]+'%'};return _0x447bf2;}})});}_0x40a4ec=_['merge']({},_0x40a4ec,_0x15e52c[_0x86d3('0x46')]);var _0x432133={'where':_0x40a4ec[_0x86d3('0x43')]};return db[_0x86d3('0x47')][_0x86d3('0x29')](_0x432133)[_0x86d3('0x1c')](function(_0x4e2cf6){_0x4f5875[_0x86d3('0x29')]=_0x4e2cf6;if(_0x15e52c[_0x86d3('0x3b')]['includeAll']){_0x40a4ec[_0x86d3('0x48')]=[{'all':!![]}];}return db[_0x86d3('0x47')][_0x86d3('0x49')](_0x40a4ec);})[_0x86d3('0x1c')](function(_0x375bba){_0x4f5875['rows']=_0x375bba;return _0x4f5875;})[_0x86d3('0x1c')](respondWithFilteredResult(_0x1e22c2,_0x40a4ec))[_0x86d3('0x25')](handleError(_0x1e22c2,null));};exports[_0x86d3('0x4a')]=function(_0x14fa58,_0x369b75){var _0x7af7b3={'raw':!![],'where':{'id':_0x14fa58[_0x86d3('0x4b')]['id']}},_0x1a4345={};_0x1a4345[_0x86d3('0x39')]=_[_0x86d3('0x3a')](db[_0x86d3('0x47')][_0x86d3('0x36')]);_0x1a4345['query']=_[_0x86d3('0x3a')](_0x14fa58[_0x86d3('0x3b')]);_0x1a4345['filters']=_[_0x86d3('0x3d')](_0x1a4345[_0x86d3('0x39')],_0x1a4345[_0x86d3('0x3b')]);_0x7af7b3[_0x86d3('0x3e')]=_[_0x86d3('0x3d')](_0x1a4345[_0x86d3('0x39')],qs['fields'](_0x14fa58['query']['fields']));_0x7af7b3['attributes']=_0x7af7b3[_0x86d3('0x3e')][_0x86d3('0x40')]?_0x7af7b3[_0x86d3('0x3e')]:_0x1a4345[_0x86d3('0x39')];if(_0x14fa58[_0x86d3('0x3b')][_0x86d3('0x4c')]){_0x7af7b3[_0x86d3('0x48')]=[{'all':!![]}];}_0x7af7b3=_['merge']({},_0x7af7b3,_0x14fa58[_0x86d3('0x46')]);return db[_0x86d3('0x47')][_0x86d3('0x4d')](_0x7af7b3)[_0x86d3('0x1c')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x1c')](respondWithResult(_0x369b75,null))[_0x86d3('0x25')](handleError(_0x369b75,null));};exports[_0x86d3('0x4e')]=function(_0x4c8828,_0x258eed){return db['ChatGroup'][_0x86d3('0x4e')](_0x4c8828[_0x86d3('0x4f')],{})[_0x86d3('0x1c')](respondWithResult(_0x258eed,0xc9))[_0x86d3('0x25')](handleError(_0x258eed,null));};exports[_0x86d3('0x2f')]=function(_0x55e345,_0x1ba0bd){if(_0x55e345[_0x86d3('0x4f')]['id']){delete _0x55e345[_0x86d3('0x4f')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x55e345['params']['id']}})[_0x86d3('0x1c')](handleEntityNotFound(_0x1ba0bd,null))['then'](saveUpdates(_0x55e345[_0x86d3('0x4f')],null))[_0x86d3('0x1c')](respondWithResult(_0x1ba0bd,null))[_0x86d3('0x25')](handleError(_0x1ba0bd,null));};exports[_0x86d3('0x30')]=function(_0x5963bb,_0x4cd835){return db['ChatGroup'][_0x86d3('0x4d')]({'where':{'id':_0x5963bb[_0x86d3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4cd835,null))[_0x86d3('0x1c')](removeEntity(_0x4cd835,null))[_0x86d3('0x25')](handleError(_0x4cd835,null));};exports[_0x86d3('0x50')]=function(_0x4584e5,_0x3fdce3){return db['ChatGroup'][_0x86d3('0x50')]()[_0x86d3('0x1c')](respondWithResult(_0x3fdce3,null))[_0x86d3('0x25')](handleError(_0x3fdce3,null));};exports[_0x86d3('0x51')]=function(_0x49a277,_0x50c142,_0x41fad7){return db['ChatInternalMessage'][_0x86d3('0x29')]({'where':{'ChatGroupId':_0x49a277[_0x86d3('0x4b')]['id'],'ToId':_0x49a277[_0x86d3('0x52')]['id'],'read':![]}})[_0x86d3('0x1c')](function(_0x4598d4){return{'id':_[_0x86d3('0x53')](_0x49a277[_0x86d3('0x4b')]['id']),'count':_0x4598d4};})['then'](respondWithResult(_0x50c142,null))['catch'](handleError(_0x50c142,null));};exports[_0x86d3('0x54')]=function(_0x51a9da,_0x528ca8,_0x58e4b6){return db[_0x86d3('0x47')]['find']({'where':{'id':_0x51a9da[_0x86d3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x528ca8,null))[_0x86d3('0x1c')](function(_0x1c2e06){if(_0x1c2e06){return _0x1c2e06[_0x86d3('0x54')](_0x51a9da['body']['ids'],_[_0x86d3('0x55')](_0x51a9da[_0x86d3('0x4f')],[_0x86d3('0x56'),'id'])||{});}})[_0x86d3('0x1c')](respondWithResult(_0x528ca8,null))[_0x86d3('0x25')](handleError(_0x528ca8,null));};exports[_0x86d3('0x57')]=function(_0x24daf3,_0x27b8f6,_0x115607){var _0x1285a4={};var _0x1e3479={};var _0x265beb;var _0xfaf168;return db[_0x86d3('0x47')][_0x86d3('0x58')]({'where':{'id':_0x24daf3[_0x86d3('0x4b')]['id']}})[_0x86d3('0x1c')](handleEntityNotFound(_0x27b8f6,null))[_0x86d3('0x1c')](function(_0x5b99f9){if(_0x5b99f9){_0x265beb=_0x5b99f9;_0x1e3479[_0x86d3('0x39')]=_[_0x86d3('0x3a')](db[_0x86d3('0x59')]['rawAttributes']);_0x1e3479[_0x86d3('0x3b')]=_[_0x86d3('0x3a')](_0x24daf3[_0x86d3('0x3b')]);_0x1e3479[_0x86d3('0x3c')]=_['intersection'](_0x1e3479[_0x86d3('0x39')],_0x1e3479['query']);_0x1285a4[_0x86d3('0x3e')]=_[_0x86d3('0x3d')](_0x1e3479[_0x86d3('0x39')],qs[_0x86d3('0x3f')](_0x24daf3[_0x86d3('0x3b')]['fields']));_0x1285a4[_0x86d3('0x3e')]=_0x1285a4['attributes'][_0x86d3('0x40')]?_0x1285a4[_0x86d3('0x3e')]:_0x1e3479['model'];_0x1285a4[_0x86d3('0x5a')]=qs[_0x86d3('0x41')](_0x24daf3[_0x86d3('0x3b')][_0x86d3('0x41')]);_0x1285a4[_0x86d3('0x43')]=qs[_0x86d3('0x3c')](_[_0x86d3('0x42')](_0x24daf3['query'],_0x1e3479[_0x86d3('0x3c')]));if(_0x24daf3[_0x86d3('0x3b')][_0x86d3('0x45')]){_0x1285a4[_0x86d3('0x43')]=_[_0x86d3('0x5b')](_0x1285a4['where'],{'$or':_[_0x86d3('0x35')](_0x1285a4[_0x86d3('0x3e')],function(_0x4f99ca){var _0x3d8965={};_0x3d8965[_0x4f99ca]={'$like':'%'+_0x24daf3[_0x86d3('0x3b')][_0x86d3('0x45')]+'%'};return _0x3d8965;})});}_0x1285a4=_[_0x86d3('0x5b')]({},_0x1285a4,_0x24daf3[_0x86d3('0x46')]);return _0x265beb[_0x86d3('0x57')](_0x1285a4);}})[_0x86d3('0x1c')](function(_0x447ae6){if(_0x447ae6){_0xfaf168=_0x447ae6[_0x86d3('0x40')];if(!_0x24daf3[_0x86d3('0x3b')][_0x86d3('0x5c')](_0x86d3('0x5d'))){_0x1285a4[_0x86d3('0x2b')]=qs[_0x86d3('0x2b')](_0x24daf3['query'][_0x86d3('0x2b')]);_0x1285a4[_0x86d3('0x2a')]=qs[_0x86d3('0x2a')](_0x24daf3[_0x86d3('0x3b')]['offset']);}return _0x265beb[_0x86d3('0x57')](_0x1285a4);}})[_0x86d3('0x1c')](function(_0x1a97f3){if(_0x1a97f3){return _0x1a97f3?{'count':_0xfaf168,'rows':_0x1a97f3}:null;}})[_0x86d3('0x1c')](respondWithResult(_0x27b8f6,null))['catch'](handleError(_0x27b8f6,null));};exports['removeMembers']=function(_0x234497,_0x5d09a2,_0x1869c5){return db['ChatGroup']['find']({'where':{'id':_0x234497[_0x86d3('0x4b')]['id']}})[_0x86d3('0x1c')](handleEntityNotFound(_0x5d09a2,null))[_0x86d3('0x1c')](function(_0x357398){if(_0x357398){return _0x357398[_0x86d3('0x5e')](_0x234497['query'][_0x86d3('0x56')]);}})[_0x86d3('0x1c')](respondWithStatusCode(_0x5d09a2,null))['catch'](handleError(_0x5d09a2,null));};exports[_0x86d3('0x5f')]=function(_0x33872f,_0x585ce3,_0x21ea5a){if(_0x33872f['body']['id']){delete _0x33872f[_0x86d3('0x4f')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x33872f[_0x86d3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x585ce3,null))[_0x86d3('0x1c')](function(_0x18ac89){if(_0x18ac89){_0x33872f[_0x86d3('0x4f')][_0x86d3('0x60')]=_0x18ac89['id'];return db[_0x86d3('0x61')][_0x86d3('0x4e')](_0x33872f[_0x86d3('0x4f')]);}})[_0x86d3('0x1c')](respondWithResult(_0x585ce3,null))['catch'](handleError(_0x585ce3,null));};exports[_0x86d3('0x62')]=function(_0x158f56,_0xe0aa13,_0x14847d){var _0x43853b={};var _0x5ec2ec={};var _0x3d8b35;var _0x20f60a;return db[_0x86d3('0x47')][_0x86d3('0x58')]({'where':{'id':_0x158f56[_0x86d3('0x4b')]['id']}})[_0x86d3('0x1c')](handleEntityNotFound(_0xe0aa13,null))[_0x86d3('0x1c')](function(_0x4b459b){if(_0x4b459b){_0x3d8b35=_0x4b459b;_0x5ec2ec[_0x86d3('0x39')]=_['keys'](db[_0x86d3('0x61')]['rawAttributes']);_0x5ec2ec['query']=_[_0x86d3('0x3a')](_0x158f56[_0x86d3('0x3b')]);_0x5ec2ec['filters']=_[_0x86d3('0x3d')](_0x5ec2ec[_0x86d3('0x39')],_0x5ec2ec[_0x86d3('0x3b')]);_0x43853b[_0x86d3('0x3e')]=_[_0x86d3('0x3d')](_0x5ec2ec[_0x86d3('0x39')],qs[_0x86d3('0x3f')](_0x158f56['query']['fields']));_0x43853b[_0x86d3('0x3e')]=_0x43853b[_0x86d3('0x3e')][_0x86d3('0x40')]?_0x43853b[_0x86d3('0x3e')]:_0x5ec2ec[_0x86d3('0x39')];_0x43853b[_0x86d3('0x5a')]=qs['sort'](_0x158f56[_0x86d3('0x3b')][_0x86d3('0x41')]);_0x43853b[_0x86d3('0x43')]=qs[_0x86d3('0x3c')](_[_0x86d3('0x42')](_0x158f56[_0x86d3('0x3b')],_0x5ec2ec[_0x86d3('0x3c')]));if(_0x158f56[_0x86d3('0x3b')][_0x86d3('0x45')]){_0x43853b['where']=_[_0x86d3('0x5b')](_0x43853b[_0x86d3('0x43')],{'$or':_['map'](_0x43853b['attributes'],function(_0x36ee46){var _0x1cbc3a={};_0x1cbc3a[_0x36ee46]={'$like':'%'+_0x158f56[_0x86d3('0x3b')]['filter']+'%'};return _0x1cbc3a;})});}if(_0x158f56[_0x86d3('0x3b')][_0x86d3('0x63')]){var _0xdca95d=_0x158f56[_0x86d3('0x3b')][_0x86d3('0x63')]['split'](',');var _0x432d1c={};_0x432d1c[_0xdca95d[0x0]]={'$gte':moment(_0xdca95d[0x1])[_0x86d3('0x64')]('YYYY-MM-DD\x20HH:mm:ss')};_0x43853b[_0x86d3('0x43')]=_[_0x86d3('0x5b')](_0x43853b[_0x86d3('0x43')],_0x432d1c);}_0x43853b=_[_0x86d3('0x5b')]({},_0x43853b,_0x158f56['options']);return _0x3d8b35[_0x86d3('0x62')](_0x43853b);}})[_0x86d3('0x1c')](function(_0x3c7621){if(_0x3c7621){_0x20f60a=_0x3c7621[_0x86d3('0x40')];if(!_0x158f56[_0x86d3('0x3b')]['hasOwnProperty'](_0x86d3('0x5d'))){_0x43853b[_0x86d3('0x2b')]=qs[_0x86d3('0x2b')](_0x158f56[_0x86d3('0x3b')][_0x86d3('0x2b')]);_0x43853b[_0x86d3('0x2a')]=qs[_0x86d3('0x2a')](_0x158f56[_0x86d3('0x3b')][_0x86d3('0x2a')]);}return _0x3d8b35[_0x86d3('0x62')](_0x43853b);}})['then'](function(_0x5908ab){if(_0x5908ab){return _0x5908ab?{'count':_0x20f60a,'rows':_0x5908ab}:null;}})[_0x86d3('0x1c')](respondWithResult(_0xe0aa13,null))[_0x86d3('0x25')](handleError(_0xe0aa13,null));}; \ No newline at end of file +var _0xba34=['limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','filter','where','merge','VIRTUAL','options','count','findAll','rows','params','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','findOne','User','order','sort','pick','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','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','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','offset'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0xba34,0x119));var _0x4ba3=function(_0x1265be,_0x52013b){_0x1265be=_0x1265be-0x0;var _0x4f09ae=_0xba34[_0x1265be];return _0x4f09ae;};'use strict';var pdf=require(_0x4ba3('0x0'));var emlformat=require(_0x4ba3('0x1'));var rimraf=require(_0x4ba3('0x2'));var zipdir=require(_0x4ba3('0x3'));var jsonpatch=require(_0x4ba3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ba3('0x5'));var util=require(_0x4ba3('0x6'));var path=require(_0x4ba3('0x7'));var sox=require(_0x4ba3('0x8'));var csv=require(_0x4ba3('0x9'));var ejs=require(_0x4ba3('0xa'));var fs=require('fs');var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x9'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];config[_0x4ba3('0x19')]=_['defaults'](config[_0x4ba3('0x19')],{'host':_0x4ba3('0x1a'),'port':0x18eb});var socket=require(_0x4ba3('0x1b'))(new Redis(config[_0x4ba3('0x19')]));require(_0x4ba3('0x1c'))[_0x4ba3('0x1d')](socket);var jayson=require(_0x4ba3('0x1e'));var client=jayson[_0x4ba3('0x1f')][_0x4ba3('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x401366,_0x36638b,_0x301359,_0x29a9d1){return new BPromise(function(_0x25f584,_0x40e75b){var _0x1b7776=_0x29a9d1||client;return _0x1b7776['request'](_0x401366,_0x301359)[_0x4ba3('0x21')](function(_0x788277){logger[_0x4ba3('0x22')](_0x4ba3('0x23'),_0x36638b,'request\x20sent');logger[_0x4ba3('0x24')](_0x4ba3('0x25'),_0x36638b,_0x4ba3('0x26'),JSON[_0x4ba3('0x27')](_0x788277));if(_0x788277[_0x4ba3('0x28')]){if(_0x788277[_0x4ba3('0x28')]['code']===0x1f4){logger['error'](_0x4ba3('0x23'),_0x36638b,_0x788277['error'][_0x4ba3('0x29')]);return _0x40e75b(_0x788277[_0x4ba3('0x28')][_0x4ba3('0x29')]);}logger[_0x4ba3('0x28')](_0x4ba3('0x23'),_0x36638b,_0x788277[_0x4ba3('0x28')]['message']);return _0x25f584(_0x788277[_0x4ba3('0x28')][_0x4ba3('0x29')]);}else{logger['info'](_0x4ba3('0x23'),_0x36638b,'request\x20sent');_0x25f584(_0x788277[_0x4ba3('0x2a')][_0x4ba3('0x29')]);}})[_0x4ba3('0x2b')](function(_0x37e6f3){logger[_0x4ba3('0x28')](_0x4ba3('0x23'),_0x36638b,_0x37e6f3);_0x40e75b(_0x37e6f3);});});}function respondWithStatusCode(_0x159596,_0xe1f7d2){_0xe1f7d2=_0xe1f7d2||0xcc;return function(_0x6cecf3){if(_0x6cecf3){return _0x159596[_0x4ba3('0x2c')](_0xe1f7d2);}return _0x159596['status'](_0xe1f7d2)[_0x4ba3('0x2d')]();};}function respondWithResult(_0x13c353,_0x2311ed){_0x2311ed=_0x2311ed||0xc8;return function(_0x5adaab){if(_0x5adaab){return _0x13c353[_0x4ba3('0x2e')](_0x2311ed)[_0x4ba3('0x2f')](_0x5adaab);}};}function respondWithFilteredResult(_0x44d78c,_0x5a3588){return function(_0x10cae6){if(_0x10cae6){var _0x843276=_0x10cae6['count'],_0x34ecb4=_0x5a3588[_0x4ba3('0x30')],_0x22394d=_0x5a3588[_0x4ba3('0x30')]+_0x5a3588[_0x4ba3('0x31')],_0x4a339e;if(_0x22394d>=_0x843276){_0x22394d=_0x843276;_0x4a339e=0xc8;}else{_0x4a339e=0xce;}_0x44d78c[_0x4ba3('0x2e')](_0x4a339e);return _0x44d78c[_0x4ba3('0x32')](_0x4ba3('0x33'),_0x34ecb4+'-'+_0x22394d+'/'+_0x843276)['json'](_0x10cae6);}return null;};}function patchUpdates(_0x27444b){return function(_0x28f36c){try{jsonpatch[_0x4ba3('0x34')](_0x28f36c,_0x27444b,!![]);}catch(_0xbf95b3){return BPromise[_0x4ba3('0x35')](_0xbf95b3);}return _0x28f36c[_0x4ba3('0x36')]();};}function saveUpdates(_0x457236,_0x272a49){return function(_0x133e76){if(_0x133e76){return _0x133e76[_0x4ba3('0x37')](_0x457236)['then'](function(_0x5a453f){return _0x5a453f;});}return null;};}function removeEntity(_0x4e2af0,_0x2d226a){return function(_0xd033d7){if(_0xd033d7){return _0xd033d7[_0x4ba3('0x38')]()[_0x4ba3('0x21')](function(){_0x4e2af0[_0x4ba3('0x2e')](0xcc)[_0x4ba3('0x2d')]();});}};}function handleEntityNotFound(_0x137551,_0xe1abe8){return function(_0x2f3495){if(!_0x2f3495){_0x137551[_0x4ba3('0x2c')](0x194);}return _0x2f3495;};}function handleError(_0x437a20,_0x3439cb){_0x3439cb=_0x3439cb||0x1f4;return function(_0x54535c){logger[_0x4ba3('0x28')](_0x54535c[_0x4ba3('0x39')]);if(_0x54535c[_0x4ba3('0x3a')]){delete _0x54535c['name'];}_0x437a20[_0x4ba3('0x2e')](_0x3439cb)['send'](_0x54535c);};}exports[_0x4ba3('0x3b')]=function(_0x1cc70e,_0x426e11){var _0x2b213b={},_0xf892e1={},_0x3d977c={'count':0x0,'rows':[]};var _0x53e39a=_[_0x4ba3('0x3c')](db[_0x4ba3('0x3d')][_0x4ba3('0x3e')],function(_0x4b702b){return{'name':_0x4b702b[_0x4ba3('0x3f')],'type':_0x4b702b[_0x4ba3('0x40')]['key']};});_0xf892e1[_0x4ba3('0x41')]=_['map'](_0x53e39a,'name');_0xf892e1[_0x4ba3('0x42')]=_[_0x4ba3('0x43')](_0x1cc70e[_0x4ba3('0x42')]);_0xf892e1[_0x4ba3('0x44')]=_[_0x4ba3('0x45')](_0xf892e1['model'],_0xf892e1[_0x4ba3('0x42')]);_0x2b213b[_0x4ba3('0x46')]=_[_0x4ba3('0x45')](_0xf892e1[_0x4ba3('0x41')],qs[_0x4ba3('0x47')](_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x47')]));_0x2b213b[_0x4ba3('0x46')]=_0x2b213b['attributes'][_0x4ba3('0x48')]?_0x2b213b[_0x4ba3('0x46')]:_0xf892e1[_0x4ba3('0x41')];if(!_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x49')](_0x4ba3('0x4a'))){_0x2b213b[_0x4ba3('0x31')]=qs[_0x4ba3('0x31')](_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x31')]);_0x2b213b[_0x4ba3('0x30')]=qs[_0x4ba3('0x30')](_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x30')]);}_0x2b213b['order']=qs['sort'](_0x1cc70e['query']['sort']);_0x2b213b['where']=qs[_0x4ba3('0x44')](_['pick'](_0x1cc70e[_0x4ba3('0x42')],_0xf892e1['filters']),_0x53e39a);if(_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x4b')]){_0x2b213b[_0x4ba3('0x4c')]=_[_0x4ba3('0x4d')](_0x2b213b[_0x4ba3('0x4c')],{'$or':_['map'](_0x53e39a,function(_0x138467){if(_0x138467['type']!==_0x4ba3('0x4e')){var _0x50f27a={};_0x50f27a[_0x138467[_0x4ba3('0x3a')]]={'$like':'%'+_0x1cc70e[_0x4ba3('0x42')][_0x4ba3('0x4b')]+'%'};return _0x50f27a;}})});}_0x2b213b=_[_0x4ba3('0x4d')]({},_0x2b213b,_0x1cc70e[_0x4ba3('0x4f')]);var _0xb5b940={'where':_0x2b213b[_0x4ba3('0x4c')]};return db['ChatGroup'][_0x4ba3('0x50')](_0xb5b940)[_0x4ba3('0x21')](function(_0x1e418c){_0x3d977c[_0x4ba3('0x50')]=_0x1e418c;if(_0x1cc70e[_0x4ba3('0x42')]['includeAll']){_0x2b213b['include']=[{'all':!![]}];}return db[_0x4ba3('0x3d')][_0x4ba3('0x51')](_0x2b213b);})[_0x4ba3('0x21')](function(_0x4b4de9){_0x3d977c[_0x4ba3('0x52')]=_0x4b4de9;return _0x3d977c;})[_0x4ba3('0x21')](respondWithFilteredResult(_0x426e11,_0x2b213b))[_0x4ba3('0x2b')](handleError(_0x426e11,null));};exports['show']=function(_0x47f588,_0x34dc04){var _0x482a83={'raw':!![],'where':{'id':_0x47f588[_0x4ba3('0x53')]['id']}},_0x439acf={};_0x439acf[_0x4ba3('0x41')]=_[_0x4ba3('0x43')](db[_0x4ba3('0x3d')][_0x4ba3('0x3e')]);_0x439acf['query']=_[_0x4ba3('0x43')](_0x47f588[_0x4ba3('0x42')]);_0x439acf['filters']=_[_0x4ba3('0x45')](_0x439acf[_0x4ba3('0x41')],_0x439acf[_0x4ba3('0x42')]);_0x482a83[_0x4ba3('0x46')]=_[_0x4ba3('0x45')](_0x439acf['model'],qs[_0x4ba3('0x47')](_0x47f588[_0x4ba3('0x42')]['fields']));_0x482a83[_0x4ba3('0x46')]=_0x482a83[_0x4ba3('0x46')][_0x4ba3('0x48')]?_0x482a83[_0x4ba3('0x46')]:_0x439acf[_0x4ba3('0x41')];if(_0x47f588[_0x4ba3('0x42')][_0x4ba3('0x54')]){_0x482a83[_0x4ba3('0x55')]=[{'all':!![]}];}_0x482a83=_[_0x4ba3('0x4d')]({},_0x482a83,_0x47f588[_0x4ba3('0x4f')]);return db[_0x4ba3('0x3d')][_0x4ba3('0x56')](_0x482a83)[_0x4ba3('0x21')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x21')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x2b')](handleError(_0x34dc04,null));};exports['create']=function(_0x5e7ed5,_0x589d82){return db[_0x4ba3('0x3d')][_0x4ba3('0x57')](_0x5e7ed5[_0x4ba3('0x58')],{})[_0x4ba3('0x21')](respondWithResult(_0x589d82,0xc9))[_0x4ba3('0x2b')](handleError(_0x589d82,null));};exports['update']=function(_0x3920c0,_0x4620ae){if(_0x3920c0[_0x4ba3('0x58')]['id']){delete _0x3920c0[_0x4ba3('0x58')]['id'];}return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x3920c0[_0x4ba3('0x53')]['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x4620ae,null))[_0x4ba3('0x21')](saveUpdates(_0x3920c0[_0x4ba3('0x58')],null))[_0x4ba3('0x21')](respondWithResult(_0x4620ae,null))[_0x4ba3('0x2b')](handleError(_0x4620ae,null));};exports[_0x4ba3('0x38')]=function(_0x328314,_0x4fa64d){return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x328314[_0x4ba3('0x53')]['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x4fa64d,null))[_0x4ba3('0x21')](removeEntity(_0x4fa64d,null))[_0x4ba3('0x2b')](handleError(_0x4fa64d,null));};exports[_0x4ba3('0x59')]=function(_0x3f6174,_0x581512){return db[_0x4ba3('0x3d')][_0x4ba3('0x59')]()[_0x4ba3('0x21')](respondWithResult(_0x581512,null))['catch'](handleError(_0x581512,null));};exports[_0x4ba3('0x5a')]=function(_0x4b072c,_0x1b7c4e,_0x4cc10a){return db[_0x4ba3('0x5b')][_0x4ba3('0x50')]({'where':{'ChatGroupId':_0x4b072c[_0x4ba3('0x53')]['id'],'ToId':_0x4b072c['user']['id'],'read':![]}})[_0x4ba3('0x21')](function(_0xaef1b){return{'id':_[_0x4ba3('0x5c')](_0x4b072c[_0x4ba3('0x53')]['id']),'count':_0xaef1b};})[_0x4ba3('0x21')](respondWithResult(_0x1b7c4e,null))['catch'](handleError(_0x1b7c4e,null));};exports[_0x4ba3('0x5d')]=function(_0x252195,_0x34cc21,_0x469ef0){return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x252195[_0x4ba3('0x53')]['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x34cc21,null))[_0x4ba3('0x21')](function(_0x6b3329){if(_0x6b3329){return _0x6b3329[_0x4ba3('0x5d')](_0x252195['body'][_0x4ba3('0x5e')],_[_0x4ba3('0x5f')](_0x252195['body'],['ids','id'])||{});}})[_0x4ba3('0x21')](respondWithResult(_0x34cc21,null))[_0x4ba3('0x2b')](handleError(_0x34cc21,null));};exports['getMembers']=function(_0x220c83,_0x30bb71,_0x1fb2aa){var _0x589214={};var _0x1f5815={};var _0x46224;var _0x1af489;return db[_0x4ba3('0x3d')][_0x4ba3('0x60')]({'where':{'id':_0x220c83[_0x4ba3('0x53')]['id']}})['then'](handleEntityNotFound(_0x30bb71,null))[_0x4ba3('0x21')](function(_0x2c0408){if(_0x2c0408){_0x46224=_0x2c0408;_0x1f5815[_0x4ba3('0x41')]=_['keys'](db[_0x4ba3('0x61')][_0x4ba3('0x3e')]);_0x1f5815[_0x4ba3('0x42')]=_[_0x4ba3('0x43')](_0x220c83[_0x4ba3('0x42')]);_0x1f5815[_0x4ba3('0x44')]=_[_0x4ba3('0x45')](_0x1f5815[_0x4ba3('0x41')],_0x1f5815['query']);_0x589214['attributes']=_[_0x4ba3('0x45')](_0x1f5815['model'],qs[_0x4ba3('0x47')](_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x47')]));_0x589214['attributes']=_0x589214[_0x4ba3('0x46')][_0x4ba3('0x48')]?_0x589214[_0x4ba3('0x46')]:_0x1f5815['model'];_0x589214[_0x4ba3('0x62')]=qs['sort'](_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x63')]);_0x589214['where']=qs[_0x4ba3('0x44')](_[_0x4ba3('0x64')](_0x220c83[_0x4ba3('0x42')],_0x1f5815[_0x4ba3('0x44')]));if(_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x4b')]){_0x589214[_0x4ba3('0x4c')]=_[_0x4ba3('0x4d')](_0x589214[_0x4ba3('0x4c')],{'$or':_['map'](_0x589214[_0x4ba3('0x46')],function(_0x306e2f){var _0x3853e1={};_0x3853e1[_0x306e2f]={'$like':'%'+_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x4b')]+'%'};return _0x3853e1;})});}_0x589214=_[_0x4ba3('0x4d')]({},_0x589214,_0x220c83[_0x4ba3('0x4f')]);return _0x46224[_0x4ba3('0x65')](_0x589214);}})[_0x4ba3('0x21')](function(_0x1a3180){if(_0x1a3180){_0x1af489=_0x1a3180[_0x4ba3('0x48')];if(!_0x220c83[_0x4ba3('0x42')]['hasOwnProperty'](_0x4ba3('0x4a'))){_0x589214[_0x4ba3('0x31')]=qs['limit'](_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x31')]);_0x589214['offset']=qs['offset'](_0x220c83[_0x4ba3('0x42')][_0x4ba3('0x30')]);}return _0x46224[_0x4ba3('0x65')](_0x589214);}})[_0x4ba3('0x21')](function(_0x37b966){if(_0x37b966){return _0x37b966?{'count':_0x1af489,'rows':_0x37b966}:null;}})[_0x4ba3('0x21')](respondWithResult(_0x30bb71,null))[_0x4ba3('0x2b')](handleError(_0x30bb71,null));};exports[_0x4ba3('0x66')]=function(_0x516c41,_0x272480,_0x5bab62){return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x516c41[_0x4ba3('0x53')]['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x272480,null))[_0x4ba3('0x21')](function(_0x254f91){if(_0x254f91){return _0x254f91[_0x4ba3('0x66')](_0x516c41[_0x4ba3('0x42')]['ids']);}})[_0x4ba3('0x21')](respondWithStatusCode(_0x272480,null))[_0x4ba3('0x2b')](handleError(_0x272480,null));};exports[_0x4ba3('0x67')]=function(_0x5a1872,_0x9bd44d,_0xdab676){if(_0x5a1872[_0x4ba3('0x58')]['id']){delete _0x5a1872[_0x4ba3('0x58')]['id'];}return db[_0x4ba3('0x3d')][_0x4ba3('0x56')]({'where':{'id':_0x5a1872[_0x4ba3('0x53')]['id']}})['then'](handleEntityNotFound(_0x9bd44d,null))['then'](function(_0x42ce25){if(_0x42ce25){_0x5a1872['body'][_0x4ba3('0x68')]=_0x42ce25['id'];return db[_0x4ba3('0x5b')][_0x4ba3('0x57')](_0x5a1872[_0x4ba3('0x58')]);}})['then'](respondWithResult(_0x9bd44d,null))['catch'](handleError(_0x9bd44d,null));};exports[_0x4ba3('0x69')]=function(_0x2b2132,_0x4e856e,_0x62f9cf){var _0x39fb64={};var _0x6a2d81={};var _0x1e8232;var _0x329609;return db[_0x4ba3('0x3d')][_0x4ba3('0x60')]({'where':{'id':_0x2b2132['params']['id']}})[_0x4ba3('0x21')](handleEntityNotFound(_0x4e856e,null))[_0x4ba3('0x21')](function(_0x211d2b){if(_0x211d2b){_0x1e8232=_0x211d2b;_0x6a2d81['model']=_[_0x4ba3('0x43')](db[_0x4ba3('0x5b')]['rawAttributes']);_0x6a2d81[_0x4ba3('0x42')]=_[_0x4ba3('0x43')](_0x2b2132['query']);_0x6a2d81['filters']=_['intersection'](_0x6a2d81['model'],_0x6a2d81[_0x4ba3('0x42')]);_0x39fb64[_0x4ba3('0x46')]=_[_0x4ba3('0x45')](_0x6a2d81[_0x4ba3('0x41')],qs[_0x4ba3('0x47')](_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x47')]));_0x39fb64['attributes']=_0x39fb64[_0x4ba3('0x46')]['length']?_0x39fb64[_0x4ba3('0x46')]:_0x6a2d81['model'];_0x39fb64[_0x4ba3('0x62')]=qs[_0x4ba3('0x63')](_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x63')]);_0x39fb64[_0x4ba3('0x4c')]=qs['filters'](_['pick'](_0x2b2132[_0x4ba3('0x42')],_0x6a2d81[_0x4ba3('0x44')]));if(_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x4b')]){_0x39fb64[_0x4ba3('0x4c')]=_[_0x4ba3('0x4d')](_0x39fb64[_0x4ba3('0x4c')],{'$or':_[_0x4ba3('0x3c')](_0x39fb64[_0x4ba3('0x46')],function(_0x35441e){var _0x217ea4={};_0x217ea4[_0x35441e]={'$like':'%'+_0x2b2132[_0x4ba3('0x42')]['filter']+'%'};return _0x217ea4;})});}if(_0x2b2132[_0x4ba3('0x42')]['$gte']){var _0x3f5309=_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x6a')][_0x4ba3('0x6b')](',');var _0x48cd14={};_0x48cd14[_0x3f5309[0x0]]={'$gte':moment(_0x3f5309[0x1])[_0x4ba3('0x6c')](_0x4ba3('0x6d'))};_0x39fb64[_0x4ba3('0x4c')]=_[_0x4ba3('0x4d')](_0x39fb64['where'],_0x48cd14);}_0x39fb64=_['merge']({},_0x39fb64,_0x2b2132[_0x4ba3('0x4f')]);return _0x1e8232[_0x4ba3('0x69')](_0x39fb64);}})[_0x4ba3('0x21')](function(_0x5db456){if(_0x5db456){_0x329609=_0x5db456[_0x4ba3('0x48')];if(!_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x49')](_0x4ba3('0x4a'))){_0x39fb64[_0x4ba3('0x31')]=qs[_0x4ba3('0x31')](_0x2b2132['query'][_0x4ba3('0x31')]);_0x39fb64['offset']=qs[_0x4ba3('0x30')](_0x2b2132[_0x4ba3('0x42')][_0x4ba3('0x30')]);}return _0x1e8232[_0x4ba3('0x69')](_0x39fb64);}})['then'](function(_0x11be49){if(_0x11be49){return _0x11be49?{'count':_0x329609,'rows':_0x11be49}:null;}})[_0x4ba3('0x21')](respondWithResult(_0x4e856e,null))['catch'](handleError(_0x4e856e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 19cac92..c9946f2 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(_0x58f245,_0x3e4f31){var _0x1f0cfb=function(_0x515942){while(--_0x515942){_0x58f245['push'](_0x58f245['shift']());}};_0x1f0cfb(++_0x3e4f31);}(_0xadb5,0xad));var _0x5adb=function(_0x3c0b29,_0x4f42c2){_0x3c0b29=_0x3c0b29-0x0;var _0x1a75dc=_0xadb5[_0x3c0b29];return _0x1a75dc;};'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 _0x0b0e=['ChatGroup','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4e43ae,_0x28576a){var _0x58af8b=function(_0x54a036){while(--_0x54a036){_0x4e43ae['push'](_0x4e43ae['shift']());}};_0x58af8b(++_0x28576a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2d0b84,_0x34682d){_0x2d0b84=_0x2d0b84-0x0;var _0x8d0088=_0x0b0e[_0x2d0b84];return _0x8d0088;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatGroupEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatGroupEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatGroup[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 4143b07..c90df6c 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 _0x5d55=['ChatGroup','chat_groups','util','api','moment','request-promise','path','rimraf','./chatGroup.attributes','exports','define'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x5d55,0x1a4));var _0x55d5=function(_0x2e3e45,_0x2ece46){_0x2e3e45=_0x2e3e45-0x0;var _0x9d3921=_0x5d55[_0x2e3e45];return _0x9d3921;};'use strict';var _=require('lodash');var util=require(_0x55d5('0x0'));var logger=require('../../config/logger')(_0x55d5('0x1'));var moment=require(_0x55d5('0x2'));var BPromise=require('bluebird');var rp=require(_0x55d5('0x3'));var fs=require('fs');var path=require(_0x55d5('0x4'));var rimraf=require(_0x55d5('0x5'));var config=require('../../config/environment');var attributes=require(_0x55d5('0x6'));module[_0x55d5('0x7')]=function(_0x33e5c5,_0x35fe43){return _0x33e5c5[_0x55d5('0x8')](_0x55d5('0x9'),attributes,{'tableName':_0x55d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe93b=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','bluebird','request-promise'];(function(_0x296690,_0x217a1a){var _0x39cf1d=function(_0x3649bf){while(--_0x3649bf){_0x296690['push'](_0x296690['shift']());}};_0x39cf1d(++_0x217a1a);}(_0xe93b,0x1c2));var _0xbe93=function(_0x5c8fbe,_0x1d091f){_0x5c8fbe=_0x5c8fbe-0x0;var _0x17536b=_0xe93b[_0x5c8fbe];return _0x17536b;};'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':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 851d9a4..bff3d69 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 _0x4306=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x246f92,_0xcf7bd4){var _0x2b8e7d=function(_0x9e8650){while(--_0x9e8650){_0x246f92['push'](_0x246f92['shift']());}};_0x2b8e7d(++_0xcf7bd4);}(_0x4306,0x1bc));var _0x6430=function(_0x1d6e6b,_0x1e3ace){_0x1d6e6b=_0x1d6e6b-0x0;var _0x50b255=_0x4306[_0x1d6e6b];return _0x50b255;};'use strict';var _=require(_0x6430('0x0'));var util=require(_0x6430('0x1'));var moment=require(_0x6430('0x2'));var BPromise=require(_0x6430('0x3'));var rs=require(_0x6430('0x4'));var fs=require('fs');var Redis=require(_0x6430('0x5'));var db=require(_0x6430('0x6'))['db'];var utils=require(_0x6430('0x7'));var logger=require(_0x6430('0x8'))(_0x6430('0x9'));var config=require(_0x6430('0xa'));var jayson=require(_0x6430('0xb'));var client=jayson[_0x6430('0xc')][_0x6430('0xd')]({'port':0x232a});config[_0x6430('0xe')]=_['defaults'](config['redis'],{'host':_0x6430('0xf'),'port':0x18eb});var socket=require(_0x6430('0x10'))(new Redis(config[_0x6430('0xe')]));require(_0x6430('0x11'))[_0x6430('0x12')](socket);function respondWithRpcPromise(_0x18ee99,_0x75428c,_0x537c2f){return new BPromise(function(_0x5657b3,_0x37ab25){return client[_0x6430('0x13')](_0x18ee99,_0x537c2f)[_0x6430('0x14')](function(_0x342faa){logger[_0x6430('0x15')](_0x6430('0x16'),_0x75428c,_0x6430('0x17'));logger[_0x6430('0x18')](_0x6430('0x19'),_0x75428c,'request\x20sent',JSON['stringify'](_0x342faa));if(_0x342faa[_0x6430('0x1a')]){if(_0x342faa[_0x6430('0x1a')]['code']===0x1f4){logger[_0x6430('0x1a')](_0x6430('0x16'),_0x75428c,_0x342faa[_0x6430('0x1a')][_0x6430('0x1b')]);return _0x37ab25(_0x342faa[_0x6430('0x1a')][_0x6430('0x1b')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x75428c,_0x342faa[_0x6430('0x1a')][_0x6430('0x1b')]);return _0x5657b3(_0x342faa[_0x6430('0x1a')][_0x6430('0x1b')]);}else{logger[_0x6430('0x15')]('ChatGroup,\x20%s,\x20%s',_0x75428c,_0x6430('0x17'));_0x5657b3(_0x342faa[_0x6430('0x1c')][_0x6430('0x1b')]);}})[_0x6430('0x1d')](function(_0x2855fe){logger['error'](_0x6430('0x16'),_0x75428c,_0x2855fe);_0x37ab25(_0x2855fe);});});} \ No newline at end of file +var _0x80f9=['request\x20sent','stringify','error','code','message','info','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatGroup.socket','request','then','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x13cab2,_0x148058){var _0x292c90=function(_0x495f78){while(--_0x495f78){_0x13cab2['push'](_0x13cab2['shift']());}};_0x292c90(++_0x148058);}(_0x80f9,0x1c1));var _0x980f=function(_0x772a37,_0x4e4fa5){_0x772a37=_0x772a37-0x0;var _0x285bd6=_0x80f9[_0x772a37];return _0x285bd6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x980f('0x0'));var BPromise=require(_0x980f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x980f('0x2'));var db=require(_0x980f('0x3'))['db'];var utils=require(_0x980f('0x4'));var logger=require(_0x980f('0x5'))(_0x980f('0x6'));var config=require(_0x980f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x980f('0x8')][_0x980f('0x9')]({'port':0x232a});config[_0x980f('0xa')]=_[_0x980f('0xb')](config[_0x980f('0xa')],{'host':_0x980f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x980f('0xa')]));require(_0x980f('0xd'))['register'](socket);function respondWithRpcPromise(_0x4596c3,_0x577dc1,_0x56bd38){return new BPromise(function(_0x4536ac,_0x4854bf){return client[_0x980f('0xe')](_0x4596c3,_0x56bd38)[_0x980f('0xf')](function(_0xdf44e){logger['info'](_0x980f('0x10'),_0x577dc1,'request\x20sent');logger[_0x980f('0x11')](_0x980f('0x12'),_0x577dc1,_0x980f('0x13'),JSON[_0x980f('0x14')](_0xdf44e));if(_0xdf44e[_0x980f('0x15')]){if(_0xdf44e['error'][_0x980f('0x16')]===0x1f4){logger[_0x980f('0x15')](_0x980f('0x10'),_0x577dc1,_0xdf44e[_0x980f('0x15')]['message']);return _0x4854bf(_0xdf44e[_0x980f('0x15')]['message']);}logger['error'](_0x980f('0x10'),_0x577dc1,_0xdf44e[_0x980f('0x15')][_0x980f('0x17')]);return _0x4536ac(_0xdf44e[_0x980f('0x15')]['message']);}else{logger[_0x980f('0x18')](_0x980f('0x10'),_0x577dc1,'request\x20sent');_0x4536ac(_0xdf44e[_0x980f('0x19')][_0x980f('0x17')]);}})['catch'](function(_0x281dfe){logger[_0x980f('0x15')]('ChatGroup,\x20%s,\x20%s',_0x577dc1,_0x281dfe);_0x4854bf(_0x281dfe);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index ef65698..751abce 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 _0xb1fe=['register','length','chatGroup:','save','remove','update','removeListener'];(function(_0x4c7d23,_0x1eed42){var _0x4bd04c=function(_0x3409cf){while(--_0x3409cf){_0x4c7d23['push'](_0x4c7d23['shift']());}};_0x4bd04c(++_0x1eed42);}(_0xb1fe,0x10d));var _0xeb1f=function(_0x8721c0,_0x591a37){_0x8721c0=_0x8721c0-0x0;var _0x1c53f7=_0xb1fe[_0x8721c0];return _0x1c53f7;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xeb1f('0x0'),_0xeb1f('0x1'),_0xeb1f('0x2')];function createListener(_0x3d2a52,_0x4176ef){return function(_0x4c2105){_0x4176ef['emit'](_0x3d2a52,_0x4c2105);};}function removeListener(_0x2f6985,_0xef860f){return function(){ChatGroupEvents[_0xeb1f('0x3')](_0x2f6985,_0xef860f);};}exports[_0xeb1f('0x4')]=function(_0x4fefdf){for(var _0x13ab15=0x0,_0x14207e=events[_0xeb1f('0x5')];_0x13ab15<_0x14207e;_0x13ab15++){var _0x4c88f9=events[_0x13ab15];var _0x4e2ff6=createListener(_0xeb1f('0x6')+_0x4c88f9,_0x4fefdf);ChatGroupEvents['on'](_0x4c88f9,_0x4e2ff6);}}; \ No newline at end of file +var _0x4a5c=['removeListener','register','chatGroup:','./chatGroup.events','remove','update','emit'];(function(_0x3c3dbc,_0x238d32){var _0x1056c4=function(_0x5e4425){while(--_0x5e4425){_0x3c3dbc['push'](_0x3c3dbc['shift']());}};_0x1056c4(++_0x238d32);}(_0x4a5c,0x145));var _0xc4a5=function(_0x259a42,_0x2b4483){_0x259a42=_0x259a42-0x0;var _0x548d68=_0x4a5c[_0x259a42];return _0x548d68;};'use strict';var ChatGroupEvents=require(_0xc4a5('0x0'));var events=['save',_0xc4a5('0x1'),_0xc4a5('0x2')];function createListener(_0x8e2a6,_0x513736){return function(_0x3f730e){_0x513736[_0xc4a5('0x3')](_0x8e2a6,_0x3f730e);};}function removeListener(_0x44ea43,_0x34377b){return function(){ChatGroupEvents[_0xc4a5('0x4')](_0x44ea43,_0x34377b);};}exports[_0xc4a5('0x5')]=function(_0x2b143c){for(var _0x1dec7d=0x0,_0x3b5642=events['length'];_0x1dec7d<_0x3b5642;_0x1dec7d++){var _0x27b314=events[_0x1dec7d];var _0x226e50=createListener(_0xc4a5('0x6')+_0x27b314,_0x2b143c);ChatGroupEvents['on'](_0x27b314,_0x226e50);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e4a2f1c..5cc406e 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 _0xbd8e=['destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','/:id/members','addMembers','addMessage','put','update','delete'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xbd8e,0x7b));var _0xebd8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbd8e[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var path=require(_0xebd8('0x2'));var timeout=require(_0xebd8('0x3'));var express=require(_0xebd8('0x4'));var router=express[_0xebd8('0x5')]();var auth=require(_0xebd8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xebd8('0x7'));var controller=require('./chatGroup.controller');router[_0xebd8('0x8')]('/',auth[_0xebd8('0x9')](),controller[_0xebd8('0xa')]);router[_0xebd8('0x8')](_0xebd8('0xb'),auth['isAuthenticated'](),controller[_0xebd8('0xc')]);router[_0xebd8('0x8')](_0xebd8('0xd'),auth[_0xebd8('0x9')](),controller[_0xebd8('0xe')]);router[_0xebd8('0x8')](_0xebd8('0xf'),auth[_0xebd8('0x9')](),controller[_0xebd8('0x10')]);router[_0xebd8('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xebd8('0x11')]);router[_0xebd8('0x8')](_0xebd8('0x12'),auth[_0xebd8('0x9')](),controller[_0xebd8('0x13')]);router[_0xebd8('0x14')]('/',auth[_0xebd8('0x9')](),controller['create']);router[_0xebd8('0x14')](_0xebd8('0x15'),auth[_0xebd8('0x9')](),controller[_0xebd8('0x16')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xebd8('0x17')]);router[_0xebd8('0x18')](_0xebd8('0xd'),auth[_0xebd8('0x9')](),controller[_0xebd8('0x19')]);router[_0xebd8('0x1a')](_0xebd8('0xd'),auth['isAuthenticated'](),controller[_0xebd8('0x1b')]);router['delete'](_0xebd8('0x15'),auth[_0xebd8('0x9')](),controller[_0xebd8('0x1c')]);module[_0xebd8('0x1d')]=router; \ No newline at end of file +var _0x3892=['getMembers','/:id/messages','post','addMessage','put','update','delete','/:id','destroy','/:id/members','removeMembers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','show','/:id/unread','getUnread'];(function(_0x1afaa9,_0x5e43bb){var _0x2017b9=function(_0x11e810){while(--_0x11e810){_0x1afaa9['push'](_0x1afaa9['shift']());}};_0x2017b9(++_0x5e43bb);}(_0x3892,0xf4));var _0x2389=function(_0x1b0ca5,_0x100eee){_0x1b0ca5=_0x1b0ca5-0x0;var _0x418fb7=_0x3892[_0x1b0ca5];return _0x418fb7;};'use strict';var multer=require(_0x2389('0x0'));var util=require(_0x2389('0x1'));var path=require(_0x2389('0x2'));var timeout=require(_0x2389('0x3'));var express=require(_0x2389('0x4'));var router=express[_0x2389('0x5')]();var auth=require(_0x2389('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2389('0x7'));var controller=require(_0x2389('0x8'));router[_0x2389('0x9')]('/',auth[_0x2389('0xa')](),controller[_0x2389('0xb')]);router['get'](_0x2389('0xc'),auth['isAuthenticated'](),controller[_0x2389('0xd')]);router[_0x2389('0x9')]('/:id',auth[_0x2389('0xa')](),controller[_0x2389('0xe')]);router[_0x2389('0x9')](_0x2389('0xf'),auth[_0x2389('0xa')](),controller[_0x2389('0x10')]);router[_0x2389('0x9')]('/:id/members',auth[_0x2389('0xa')](),controller[_0x2389('0x11')]);router[_0x2389('0x9')](_0x2389('0x12'),auth['isAuthenticated'](),controller['getMessages']);router[_0x2389('0x13')]('/',auth[_0x2389('0xa')](),controller['create']);router['post']('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0x2389('0x13')](_0x2389('0x12'),auth[_0x2389('0xa')](),controller[_0x2389('0x14')]);router[_0x2389('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2389('0x16')]);router[_0x2389('0x17')](_0x2389('0x18'),auth[_0x2389('0xa')](),controller[_0x2389('0x19')]);router[_0x2389('0x17')](_0x2389('0x1a'),auth[_0x2389('0xa')](),controller[_0x2389('0x1b')]);module[_0x2389('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 0bceeb8..c7c11a5 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 _0x827a=['INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','sequelize'];(function(_0x5a89e7,_0xb9c029){var _0x2d7767=function(_0x57d7b9){while(--_0x57d7b9){_0x5a89e7['push'](_0x5a89e7['shift']());}};_0x2d7767(++_0xb9c029);}(_0x827a,0x167));var _0xa827=function(_0x131b29,_0x2cae9d){_0x131b29=_0x131b29-0x0;var _0xc7531e=_0x827a[_0x131b29];return _0xc7531e;};'use strict';var Sequelize=require(_0xa827('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa827('0x1')]},'ratingType':{'type':Sequelize[_0xa827('0x2')](_0xa827('0x3'),_0xa827('0x4')),'defaultValue':_0xa827('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xa827('0x5')]},'mailTranscript':{'type':Sequelize[_0xa827('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa827('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa827('0x6')]},'thirdDisposition':{'type':Sequelize[_0xa827('0x6')]},'note':{'type':Sequelize[_0xa827('0x6')]},'browserName':{'type':Sequelize[_0xa827('0x6')]},'browserVersion':{'type':Sequelize[_0xa827('0x6')]},'osName':{'type':Sequelize[_0xa827('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xa827('0x6')]},'deviceVendor':{'type':Sequelize[_0xa827('0x6')]},'deviceType':{'type':Sequelize[_0xa827('0x6')]},'referer':{'type':Sequelize[_0xa827('0x5')]},'customerIp':{'type':Sequelize[_0xa827('0x6')]},'formData':{'type':Sequelize[_0xa827('0x5')](_0xa827('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xa827('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa827('0x6')]},'customerPort':{'type':Sequelize[_0xa827('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf631=['sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','DATE','STRING','long','out'];(function(_0x1cb61c,_0x51a358){var _0x4c82d5=function(_0x519ebc){while(--_0x519ebc){_0x1cb61c['push'](_0x1cb61c['shift']());}};_0x4c82d5(++_0x51a358);}(_0xf631,0x6c));var _0x1f63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf631[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1f63('0x0'));module[_0x1f63('0x1')]={'closed':{'type':Sequelize[_0x1f63('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1f63('0x3')]},'ratingType':{'type':Sequelize[_0x1f63('0x4')](_0x1f63('0x5'),_0x1f63('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x1f63('0x7')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1f63('0x8')]},'disposition':{'type':Sequelize[_0x1f63('0x9')]},'secondDisposition':{'type':Sequelize[_0x1f63('0x9')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1f63('0x9')]},'browserName':{'type':Sequelize[_0x1f63('0x9')]},'browserVersion':{'type':Sequelize[_0x1f63('0x9')]},'osName':{'type':Sequelize[_0x1f63('0x9')]},'osVersion':{'type':Sequelize[_0x1f63('0x9')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x1f63('0x9')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x1f63('0x9')]},'formData':{'type':Sequelize[_0x1f63('0x7')](_0x1f63('0xa'))},'read1stAt':{'type':Sequelize[_0x1f63('0x8')]},'lastMsgAt':{'type':Sequelize[_0x1f63('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x1f63('0x4')]('in',_0x1f63('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x1f63('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 1a4f4a3..97da402 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 _0xbe4d=['log','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','select','field','color','u.fullname','ui.ChatInteractionId','from','user_has_chat_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','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','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','length','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','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','text','start','body','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','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','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','create','params','describe','findOne','ChatWebsite','vidaooEscalation','vidaooApiKey','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','download','server/files/attachments/','close','mailTranscript','join','root','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','addMessage','ids','getMessages','nolimit','ChatInteractionId','filter','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','getMyMessages','includeAgent','alias','includeAll','setTags','spread','emit','chatInteractionTags:save','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','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','\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','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','N.A.','tail','createReadStream','pipe','createWriteStream','renderFile','downloadInteraction.html','toFile','transcript-','.pdf'];(function(_0x304bd5,_0xea943d){var _0x2bcd87=function(_0x53d3c5){while(--_0x53d3c5){_0x304bd5['push'](_0x304bd5['shift']());}};_0x2bcd87(++_0xea943d);}(_0xbe4d,0x13b));var _0xdbe4=function(_0x1059bc,_0x316ce8){_0x1059bc=_0x1059bc-0x0;var _0x4d90ca=_0xbe4d[_0x1059bc];return _0x4d90ca;};'use strict';var pdf=require(_0xdbe4('0x0'));var emlformat=require(_0xdbe4('0x1'));var rimraf=require(_0xdbe4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbe4('0x3'));var rp=require(_0xdbe4('0x4'));var moment=require('moment');var BPromise=require(_0xdbe4('0x5'));var Mustache=require('mustache');var util=require(_0xdbe4('0x6'));var path=require(_0xdbe4('0x7'));var sox=require('sox');var csv=require(_0xdbe4('0x8'));var ejs=require(_0xdbe4('0x9'));var fs=require('fs');var _=require(_0xdbe4('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdbe4('0xb'));var toCsv=require(_0xdbe4('0x8'));var querystring=require(_0xdbe4('0xc'));var Papa=require(_0xdbe4('0xd'));var Redis=require(_0xdbe4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdbe4('0xf'));var hardwareService=require(_0xdbe4('0x10'));var logger=require(_0xdbe4('0x11'))(_0xdbe4('0x12'));var utils=require(_0xdbe4('0x13'));var config=require(_0xdbe4('0x14'));var licenseUtil=require(_0xdbe4('0x15'));var db=require(_0xdbe4('0x16'))['db'];config[_0xdbe4('0x17')]=_[_0xdbe4('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdbe4('0x19'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0xdbe4('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdbe4('0x1b')]['http']({'port':0x232b});var client9004=jayson[_0xdbe4('0x1b')][_0xdbe4('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x2df1e9,_0x515c59,_0x2ef11a,_0x311207){return new BPromise(function(_0x2d428e,_0x376319){var _0x122508=_0x311207||client;return _0x122508[_0xdbe4('0x1d')](_0x2df1e9,_0x2ef11a)['then'](function(_0x4de93){logger[_0xdbe4('0x1e')](_0xdbe4('0x1f'),_0x515c59,_0xdbe4('0x20'));logger[_0xdbe4('0x21')](_0xdbe4('0x22'),_0x515c59,_0xdbe4('0x20'),JSON[_0xdbe4('0x23')](_0x4de93));if(_0x4de93[_0xdbe4('0x24')]){if(_0x4de93['error']['code']===0x1f4){logger[_0xdbe4('0x24')](_0xdbe4('0x1f'),_0x515c59,_0x4de93[_0xdbe4('0x24')][_0xdbe4('0x25')]);return _0x376319(_0x4de93[_0xdbe4('0x24')]['message']);}logger[_0xdbe4('0x24')](_0xdbe4('0x1f'),_0x515c59,_0x4de93[_0xdbe4('0x24')]['message']);return _0x2d428e(_0x4de93['error'][_0xdbe4('0x25')]);}else{logger['info'](_0xdbe4('0x1f'),_0x515c59,_0xdbe4('0x20'));_0x2d428e(_0x4de93[_0xdbe4('0x26')][_0xdbe4('0x25')]);}})[_0xdbe4('0x27')](function(_0x53c03b){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x515c59,_0x53c03b);_0x376319(_0x53c03b);});});}function respondWithStatusCode(_0x502597,_0x2752c5){_0x2752c5=_0x2752c5||0xcc;return function(_0xc85eec){if(_0xc85eec){return _0x502597[_0xdbe4('0x28')](_0x2752c5);}return _0x502597['status'](_0x2752c5)[_0xdbe4('0x29')]();};}function respondWithResult(_0x23cefd,_0x5e4988){_0x5e4988=_0x5e4988||0xc8;return function(_0x538273){if(_0x538273){return _0x23cefd[_0xdbe4('0x2a')](_0x5e4988)[_0xdbe4('0x2b')](_0x538273);}};}function respondWithFilteredResult(_0x1125b2,_0x2fb988){return function(_0x19df93){if(_0x19df93){var _0xbccd09=_0x19df93[_0xdbe4('0x2c')],_0x33db1c=_0x2fb988['offset'],_0x4ba08b=_0x2fb988[_0xdbe4('0x2d')]+_0x2fb988[_0xdbe4('0x2e')],_0x33d4ff;if(_0x4ba08b>=_0xbccd09){_0x4ba08b=_0xbccd09;_0x33d4ff=0xc8;}else{_0x33d4ff=0xce;}_0x1125b2['status'](_0x33d4ff);return _0x1125b2['set'](_0xdbe4('0x2f'),_0x33db1c+'-'+_0x4ba08b+'/'+_0xbccd09)[_0xdbe4('0x2b')](_0x19df93);}return null;};}function patchUpdates(_0x38248c){return function(_0x2345e8){try{jsonpatch[_0xdbe4('0x30')](_0x2345e8,_0x38248c,!![]);}catch(_0x9553d4){return BPromise[_0xdbe4('0x31')](_0x9553d4);}return _0x2345e8[_0xdbe4('0x32')]();};}function saveUpdates(_0x1fa2e7,_0x4e4ada){return function(_0x406db0){if(_0x406db0){return _0x406db0[_0xdbe4('0x33')](_0x1fa2e7)[_0xdbe4('0x34')](function(_0x2137f4){return _0x2137f4;});}return null;};}function removeEntity(_0x2663be,_0x13f2af){return function(_0x5899a9){if(_0x5899a9){return _0x5899a9[_0xdbe4('0x35')]()['then'](function(){_0x2663be['status'](0xcc)[_0xdbe4('0x29')]();});}};}function handleEntityNotFound(_0x58d8d7,_0x2b4c28){return function(_0x3aa5d0){if(!_0x3aa5d0){_0x58d8d7[_0xdbe4('0x28')](0x194);}return _0x3aa5d0;};}function handleError(_0x1208e5,_0x4ab897){_0x4ab897=_0x4ab897||0x1f4;return function(_0x42905b){logger[_0xdbe4('0x24')](_0x42905b[_0xdbe4('0x36')]);if(_0x42905b[_0xdbe4('0x37')]){delete _0x42905b[_0xdbe4('0x37')];}_0x1208e5[_0xdbe4('0x2a')](_0x4ab897)[_0xdbe4('0x38')](_0x42905b);};}function getInteractionUsers(_0x2aba99,_0x3fc056){return new BPromise(function(_0xb80209,_0x3d7897){try{if(_0x3fc056[_0x2aba99['id']]){_0x2aba99['Users']=_[_0xdbe4('0x39')](_0x3fc056[_0x2aba99['id']],function(_0x39ee49){return{'id':_0x39ee49['id'],'fullname':_0x39ee49[_0xdbe4('0x3a')]};});}}catch(_0x51e357){_0x3d7897(_0x51e357);}_0xb80209(_0x2aba99);});}function getInteractionTags(_0x17ff81,_0x307029){return new BPromise(function(_0x339a17,_0x1882f3){try{if(_0x17ff81[_0xdbe4('0x3b')]){_0x17ff81[_0xdbe4('0x3c')]=[];_0x17ff81[_0xdbe4('0x3b')][_0xdbe4('0x3d')](',')[_0xdbe4('0x3e')](function(_0x47544d){_0x17ff81['Tags'][_0xdbe4('0x3f')](_0x307029[_0x47544d]);});}delete _0x17ff81['TagIds'];}catch(_0x25647f){_0x1882f3(_0x25647f);}_0x339a17(_0x17ff81);});}function updateChatInteraction(_0x8cce93,_0x29562d,_0x3ee863){return new BPromise(function(_0x205a92,_0x1f946f){return getInteractionUsers(_0x8cce93,_0x3ee863)[_0xdbe4('0x34')](function(_0x5bc65d){return getInteractionTags(_0x5bc65d,_0x29562d);})[_0xdbe4('0x34')](function(_0x41c979){_0x205a92(_0x41c979);})['catch'](function(_0x207c78){_0x1f946f(_0x207c78);});});}exports[_0xdbe4('0x40')]=function(_0x1f3cff,_0x519e5d){var _0x5c1b7f={},_0x4fbff4={},_0x4268af={'count':0x0,'rows':[]};var _0x72310f=_[_0xdbe4('0x39')](db[_0xdbe4('0x41')][_0xdbe4('0x42')],function(_0x4aa5cf){return{'name':_0x4aa5cf[_0xdbe4('0x43')],'type':_0x4aa5cf[_0xdbe4('0x44')][_0xdbe4('0x45')]};});_0x4fbff4['model']=_[_0xdbe4('0x39')](_0x72310f,_0xdbe4('0x37'));_0x4fbff4[_0xdbe4('0x46')]=_[_0xdbe4('0x47')](_0x1f3cff[_0xdbe4('0x46')]);_0x4fbff4[_0xdbe4('0x48')]=_[_0xdbe4('0x49')](_0x4fbff4[_0xdbe4('0x4a')],_0x4fbff4[_0xdbe4('0x46')]);_0x5c1b7f[_0xdbe4('0x4b')]=_['intersection'](_0x4fbff4['model'],qs[_0xdbe4('0x4c')](_0x1f3cff[_0xdbe4('0x46')][_0xdbe4('0x4c')]));_0x5c1b7f['attributes']=_0x5c1b7f[_0xdbe4('0x4b')]['length']?_0x5c1b7f['attributes']:_0x4fbff4[_0xdbe4('0x4a')];if(!_0x1f3cff[_0xdbe4('0x46')][_0xdbe4('0x4d')]('nolimit')){_0x5c1b7f[_0xdbe4('0x2e')]=qs['limit'](_0x1f3cff[_0xdbe4('0x46')][_0xdbe4('0x2e')]);_0x5c1b7f[_0xdbe4('0x2d')]=qs['offset'](_0x1f3cff[_0xdbe4('0x46')]['offset']);}_0x5c1b7f['order']=qs[_0xdbe4('0x4e')](_0x1f3cff[_0xdbe4('0x46')][_0xdbe4('0x4e')]);_0x5c1b7f[_0xdbe4('0x4f')]=qs[_0xdbe4('0x48')](_[_0xdbe4('0x50')](_0x1f3cff['query'],_0x4fbff4['filters']),_0x72310f);var _0x3ae181=[];var _0x1469db=squel[_0xdbe4('0x51')]()[_0xdbe4('0x52')]('id')[_0xdbe4('0x52')](_0xdbe4('0x37'))[_0xdbe4('0x52')](_0xdbe4('0x53'))['from']('tools_tags');var _0x440291=squel[_0xdbe4('0x51')]()[_0xdbe4('0x52')]('u.id')[_0xdbe4('0x52')](_0xdbe4('0x54'))[_0xdbe4('0x52')](_0xdbe4('0x55'))[_0xdbe4('0x56')](_0xdbe4('0x57'),'ui')[_0xdbe4('0x58')](_0xdbe4('0x59'),'u',_0xdbe4('0x5a'));var _0x57382e=squel['select']()[_0xdbe4('0x56')]('chat_interactions','i')[_0xdbe4('0x58')](_0xdbe4('0x5b'),'c',_0xdbe4('0x5c'))[_0xdbe4('0x58')]('users','o',_0xdbe4('0x5d'))[_0xdbe4('0x58')](_0xdbe4('0x5e'),'a',_0xdbe4('0x5f'))[_0xdbe4('0x58')](_0xdbe4('0x60'),'me',_0xdbe4('0x61'))['left_join'](_0xdbe4('0x62'),'it',_0xdbe4('0x63'))['left_join'](_0xdbe4('0x64'),'t',_0xdbe4('0x65'));var _0x1b815e=squel[_0xdbe4('0x66')]();var _0xf39db0=[];var _0x23da3b=squel[_0xdbe4('0x66')]();var _0x54f072;if(_0x1f3cff[_0xdbe4('0x46')][_0xdbe4('0x67')]){_0x54f072=as[_0xdbe4('0x68')](_0x1f3cff[_0xdbe4('0x46')][_0xdbe4('0x67')]);var _0x4cf654=_0x54f072[_0xdbe4('0x69')];for(var _0x1dfc52=0x0;_0x1dfc52<_0x54f072[_0xdbe4('0x6a')][_0xdbe4('0x6b')];_0x1dfc52++){var _0x5861c0=_0x54f072[_0xdbe4('0x6a')][_0x1dfc52];var _0x5c2c6b='i';var _0x56ae70=_['find'](_0x72310f,[_0xdbe4('0x37'),_0x5861c0['field']]);if(!_0x56ae70){switch(_0x5861c0['field']){case'unreadMessages':if(_0x5861c0[_0xdbe4('0x6c')]==0x1){_0x57382e[_0xdbe4('0x6d')]('`'+_0x5861c0[_0xdbe4('0x52')]+'`\x20=\x200');}else{_0x57382e[_0xdbe4('0x6d')]('`'+_0x5861c0[_0xdbe4('0x52')]+_0xdbe4('0x6e'));}break;case _0xdbe4('0x6f'):if(_0x5861c0[_0xdbe4('0x70')]===_0xdbe4('0x71')){if(_0x5861c0[_0xdbe4('0x6c')][_0xdbe4('0x3d')]('\x20')[_0xdbe4('0x6b')]>0x1){_0x1b815e[_0x4cf654](_0xdbe4('0x72'),qs[_0xdbe4('0x73')](_0x5861c0[_0xdbe4('0x6c')]),null);}else{var _0x2f7399='%'+_0x5861c0[_0xdbe4('0x6c')]+'%';_0x1b815e[_0x4cf654]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2f7399,_0x2f7399,_0x2f7399);}}else{_0x56ae70=_['find'](_0x72310f,[_0xdbe4('0x37'),_0xdbe4('0x74')]);_0x5861c0[_0xdbe4('0x52')]='ContactId';_0x51321c=as[_0xdbe4('0x75')](_0x5c2c6b,_0x56ae70['type'],_0x5861c0);_0x1b815e[_0x4cf654](_0x51321c['text'],_0x51321c[_0xdbe4('0x6c')]['start'],_0x51321c['value'][_0xdbe4('0x29')]);}break;case _0xdbe4('0x76'):var _0x231d52=_0x5861c0[_0xdbe4('0x6c')][_0xdbe4('0x3d')](',')[_0xdbe4('0x39')](function(_0x26b365){return Number(_0x26b365);});_0x231d52['forEach'](function(_0x5aa0d7){_0x23da3b['or'](_0xdbe4('0x77'),'%,'+_0x5aa0d7+',%');});_0xf39db0=_[_0xdbe4('0x78')](_0xf39db0,_0x231d52);break;case _0xdbe4('0x79'):if(_0x5861c0['operator']===_0xdbe4('0x71')){_0x1b815e[_0x4cf654](_0xdbe4('0x7a'),'%'+_0x5861c0[_0xdbe4('0x6c')]+'%',null);}else{_0x56ae70=_[_0xdbe4('0x7b')](_0x72310f,[_0xdbe4('0x37'),'UserId']);_0x5861c0[_0xdbe4('0x52')]=_0xdbe4('0x7c');_0x51321c=as[_0xdbe4('0x75')](_0x5c2c6b,_0x56ae70[_0xdbe4('0x44')],_0x5861c0);_0x1b815e[_0x4cf654](_0x51321c[_0xdbe4('0x7d')],_0x51321c[_0xdbe4('0x6c')][_0xdbe4('0x7e')],_0x51321c[_0xdbe4('0x6c')][_0xdbe4('0x29')]);}break;case _0xdbe4('0x7f'):_0x51321c=as[_0xdbe4('0x75')]('me',null,_0x5861c0);_0x1b815e[_0x4cf654](_0x51321c['text'],_0x51321c[_0xdbe4('0x6c')][_0xdbe4('0x7e')],_0x51321c[_0xdbe4('0x6c')][_0xdbe4('0x29')]);break;}}else{var _0x51321c=as[_0xdbe4('0x75')](_0x5c2c6b,_0x56ae70[_0xdbe4('0x44')],_0x5861c0);_0x1b815e[_0x4cf654](_0x51321c[_0xdbe4('0x7d')],_0x51321c[_0xdbe4('0x6c')][_0xdbe4('0x7e')],_0x51321c['value'][_0xdbe4('0x29')]);}}}else{var _0x2aef00=_(_0x1f3cff[_0xdbe4('0x46')])[_0xdbe4('0x47')]()['map'](function(_0x264a02){return _[_0xdbe4('0x80')](_0x72310f,['name',_0x264a02])?_0x264a02:undefined;})[_0xdbe4('0x81')]()[_0xdbe4('0x6c')]();if(!_['isEmpty'](_0x2aef00)){_0x2aef00[_0xdbe4('0x3e')](function(_0x4b6c92){if(_0x4b6c92===_0xdbe4('0x82')){_0x57382e[_0xdbe4('0x4f')](_0xdbe4('0x83'),[][_0xdbe4('0x84')](_0x1f3cff['query'][_0x4b6c92]));}else if(_0x4b6c92===_0xdbe4('0x85')){var _0x4caabd=JSON[_0xdbe4('0x86')](_0x1f3cff['query'][_0x4b6c92])[_0xdbe4('0x87')];var _0x11792a=JSON[_0xdbe4('0x86')](_0x1f3cff['query'][_0x4b6c92])[_0xdbe4('0x88')];_0x57382e[_0xdbe4('0x4f')](_0xdbe4('0x89'),_0x4caabd,_0x11792a);}else{if(_0x1f3cff['query'][_0x4b6c92]===_0xdbe4('0x8a')){_0x57382e[_0xdbe4('0x4f')]('i.'+_0x4b6c92+_0xdbe4('0x8b'));}else{_0x57382e[_0xdbe4('0x4f')]('i.'+_0x4b6c92+'\x20=\x20?',_0x1f3cff[_0xdbe4('0x46')][_0x4b6c92]);}}});}if(_0x1f3cff[_0xdbe4('0x46')]['read']){if(_0x1f3cff[_0xdbe4('0x46')][_0xdbe4('0x8c')]==0x1){_0x57382e[_0xdbe4('0x6d')](_0xdbe4('0x8d'));}else{_0x57382e[_0xdbe4('0x6d')](_0xdbe4('0x8e'));}}if(_0x1f3cff['query']['tag']){_0xf39db0=_['isArray'](_0x1f3cff[_0xdbe4('0x46')][_0xdbe4('0x8f')])?_0x1f3cff[_0xdbe4('0x46')][_0xdbe4('0x8f')]:new Array(_0x1f3cff[_0xdbe4('0x46')][_0xdbe4('0x8f')]);_0xf39db0[_0xdbe4('0x3e')](function(_0x4d88b2){_0x23da3b['or'](_0xdbe4('0x77'),'%,'+_0x4d88b2+',%');});}if(_0x1f3cff['query']['filter']){var _0x106dd8=_0x1f3cff[_0xdbe4('0x46')]['filter'][_0xdbe4('0x90')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xdbe4('0x91')](_0x106dd8)){_0x1b815e['or'](_0xdbe4('0x92'),_0x106dd8+'%');}else{_0x1b815e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xdbe4('0x73')](_0x106dd8))['or'](_0xdbe4('0x93'),_0x106dd8+'%');}}}_0x57382e[_0xdbe4('0x4f')](_0x1b815e);_0x57382e[_0xdbe4('0x94')](_0xdbe4('0x95'));var _0x597c86={'type':db[_0xdbe4('0x96')][_0xdbe4('0x97')][_0xdbe4('0x98')],'raw':!![]};var _0x4a2b28=_0x57382e[_0xdbe4('0x99')]();_0x4a2b28[_0xdbe4('0x52')](_0xdbe4('0x95'));_0x4a2b28[_0xdbe4('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x5c1b7f['order']){_0x5c1b7f['order'][_0xdbe4('0x3e')](function(_0x40b1f9){var _0x4af920=_0x40b1f9[0x0]===_0xdbe4('0x9a')?_0x40b1f9[0x0]:'i.'+_0x40b1f9[0x0];_0x57382e[_0xdbe4('0x9b')](_0x4af920,_0x40b1f9[0x1]===_0xdbe4('0x9c')?![]:!![]);});}if(!_[_0xdbe4('0x9d')](_0xf39db0)){_0x57382e[_0xdbe4('0x6d')](_0x23da3b);_0x4a2b28[_0xdbe4('0x4f')](_0xdbe4('0x9e'),_0xf39db0);}BPromise[_0xdbe4('0x9f')]()['then'](function(){if(!_0x54f072){if(_0x1f3cff[_0xdbe4('0x46')]['ChatWebsiteId'])return;_0x4a2b28[_0xdbe4('0x4f')](_0xdbe4('0xa0'));_0x57382e[_0xdbe4('0x4f')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x1f3cff['user'][_0xdbe4('0xa1')]!==_0xdbe4('0xa2'))return;return _0x1f3cff[_0xdbe4('0xa3')][_0xdbe4('0xa4')]({'attributes':['id'],'raw':!![]})[_0xdbe4('0x34')](function(_0x20329f){if(_[_0xdbe4('0x9d')](_0x20329f)){_0x4a2b28['where'](_0xdbe4('0xa5'));_0x57382e[_0xdbe4('0x4f')](_0xdbe4('0xa5'));}else{_0x4a2b28['where'](_0xdbe4('0x83'),_[_0xdbe4('0x39')](_0x20329f,'id'));_0x57382e[_0xdbe4('0x4f')](_0xdbe4('0x83'),_[_0xdbe4('0x39')](_0x20329f,'id'));}});})[_0xdbe4('0x34')](function(){if(_0x1f3cff['user'][_0xdbe4('0xa1')]===_0xdbe4('0xa2')&&!_0x54f072&&!_0x1f3cff[_0xdbe4('0x46')]['ChatWebsiteId'])return[];return db[_0xdbe4('0xa6')][_0xdbe4('0x46')](_0x4a2b28[_0xdbe4('0xa7')](),_0x597c86);})[_0xdbe4('0x34')](function(_0x446f09){_0x4268af['count']=_0x446f09['length'];if(_0x4268af[_0xdbe4('0x2c')]===0x0)return[];return db[_0xdbe4('0xa6')][_0xdbe4('0x46')](_0x1469db[_0xdbe4('0xa7')](),_0x597c86)['then'](function(_0x1fac91){_0x3ae181=_[_0xdbe4('0xa8')](_0x1fac91,'id');_0x597c86=_[_0xdbe4('0xa9')](_0x597c86,{'model':db[_0xdbe4('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f3cff[_0xdbe4('0x46')]['fields']){_0x5c1b7f['attributes'][_0xdbe4('0x3e')](function(_0x43e4d6){_0x57382e[_0xdbe4('0x52')]('i.'+_0x43e4d6);});}else{_0x57382e[_0xdbe4('0x52')](_0xdbe4('0xaa'),_0xdbe4('0xab'));_0x57382e[_0xdbe4('0x52')](_0xdbe4('0xac'),'Account.key');_0x57382e[_0xdbe4('0x52')]('a.mandatoryDisposition',_0xdbe4('0xad'));_0x57382e['field'](_0xdbe4('0xae'),_0xdbe4('0x9a'));_0x57382e[_0xdbe4('0x52')](_0xdbe4('0xaf'));_0x57382e[_0xdbe4('0x52')](_0xdbe4('0xb0'),_0xdbe4('0xb1'));_0x57382e['field'](_0xdbe4('0xb2'),'Contact.lastName');_0x57382e[_0xdbe4('0x52')](_0xdbe4('0xb3'),_0xdbe4('0xb4'));_0x57382e[_0xdbe4('0x52')](_0xdbe4('0xb5'),_0xdbe4('0xb6'));_0x57382e[_0xdbe4('0x52')](_0xdbe4('0xb7'),_0xdbe4('0xb8'));_0x57382e['field'](_0xdbe4('0xb9'),_0xdbe4('0xba'));_0x57382e[_0xdbe4('0x52')](_0xdbe4('0xbb'),'Owner.fullname');_0x57382e[_0xdbe4('0x52')](_0xdbe4('0xbc'),_0xdbe4('0xbd'));_0x57382e['field'](_0xdbe4('0xbe'),'TagIds');}if(_0x5c1b7f[_0xdbe4('0x2e')])_0x57382e[_0xdbe4('0x2e')](_0x5c1b7f[_0xdbe4('0x2e')]);if(_0x5c1b7f[_0xdbe4('0x2d')])_0x57382e[_0xdbe4('0x2d')](_0x5c1b7f[_0xdbe4('0x2d')]);return db[_0xdbe4('0xa6')]['query'](_0x57382e[_0xdbe4('0xa7')](),_0x597c86);})['then'](function(_0x2fd03e){_0x440291[_0xdbe4('0x4f')](_0xdbe4('0xbf'),_[_0xdbe4('0x39')](_0x2fd03e,'id'));return db[_0xdbe4('0xa6')][_0xdbe4('0x46')](_0x440291['toString'](),_0x597c86)[_0xdbe4('0x34')](function(_0x204027){var _0x21b591=_[_0xdbe4('0xc0')](_0x204027,'ChatInteractionId');var _0x4b06a5=[];_0x2fd03e['forEach'](function(_0x38ef3b){_0x4b06a5[_0xdbe4('0x3f')](updateChatInteraction(_0x38ef3b,_0x3ae181,_0x21b591));});return BPromise[_0xdbe4('0xc1')](_0x4b06a5);});});})['then'](function(_0x296e58){_0x4268af[_0xdbe4('0xc2')]=_0x296e58;return _0x4268af;})[_0xdbe4('0x34')](respondWithFilteredResult(_0x519e5d,_0x5c1b7f))[_0xdbe4('0x27')](handleError(_0x519e5d,null));};exports[_0xdbe4('0xc3')]=function(_0x2583d4,_0x59fc91){var _0xaee508={'raw':![],'where':{'id':_0x2583d4['params']['id']}},_0xf1bbb9={};_0xf1bbb9[_0xdbe4('0x4a')]=_['keys'](db[_0xdbe4('0x41')][_0xdbe4('0x42')]);_0xf1bbb9[_0xdbe4('0x46')]=_[_0xdbe4('0x47')](_0x2583d4[_0xdbe4('0x46')]);_0xf1bbb9[_0xdbe4('0x48')]=_[_0xdbe4('0x49')](_0xf1bbb9['model'],_0xf1bbb9[_0xdbe4('0x46')]);_0xaee508[_0xdbe4('0x4b')]=_['intersection'](_0xf1bbb9[_0xdbe4('0x4a')],qs[_0xdbe4('0x4c')](_0x2583d4[_0xdbe4('0x46')]['fields']));_0xaee508[_0xdbe4('0x4b')]=_0xaee508[_0xdbe4('0x4b')]['length']?_0xaee508[_0xdbe4('0x4b')]:_0xf1bbb9['model'];if(_0x2583d4[_0xdbe4('0x46')]['includeAll']){_0xaee508['include']=[{'all':!![]}];}_0xaee508=_[_0xdbe4('0xa9')]({},_0xaee508,_0x2583d4['options']);return db['ChatInteraction'][_0xdbe4('0x7b')](_0xaee508)[_0xdbe4('0x34')](handleEntityNotFound(_0x59fc91,null))[_0xdbe4('0x34')](respondWithResult(_0x59fc91,null))[_0xdbe4('0x27')](handleError(_0x59fc91,null));};exports[_0xdbe4('0xc4')]=function(_0x2d1016,_0xcd3737){return db[_0xdbe4('0x41')][_0xdbe4('0xc4')](_0x2d1016[_0xdbe4('0x7f')],{})[_0xdbe4('0x34')](respondWithResult(_0xcd3737,0xc9))[_0xdbe4('0x27')](handleError(_0xcd3737,null));};exports[_0xdbe4('0x33')]=function(_0x12437e,_0x5475f6){if(_0x12437e[_0xdbe4('0x7f')]['id']){delete _0x12437e['body']['id'];}return db['ChatInteraction'][_0xdbe4('0x7b')]({'where':{'id':_0x12437e[_0xdbe4('0xc5')]['id']}})[_0xdbe4('0x34')](handleEntityNotFound(_0x5475f6,null))[_0xdbe4('0x34')](saveUpdates(_0x12437e[_0xdbe4('0x7f')],null))['then'](respondWithResult(_0x5475f6,null))[_0xdbe4('0x27')](handleError(_0x5475f6,null));};exports[_0xdbe4('0x35')]=function(_0x4d540e,_0x4b43c6){return db[_0xdbe4('0x41')][_0xdbe4('0x7b')]({'where':{'id':_0x4d540e[_0xdbe4('0xc5')]['id']}})[_0xdbe4('0x34')](handleEntityNotFound(_0x4b43c6,null))['then'](removeEntity(_0x4b43c6,null))[_0xdbe4('0x27')](handleError(_0x4b43c6,null));};exports[_0xdbe4('0xc6')]=function(_0x309856,_0x16c9a3){return db[_0xdbe4('0x41')][_0xdbe4('0xc6')]()[_0xdbe4('0x34')](respondWithResult(_0x16c9a3,null))['catch'](handleError(_0x16c9a3,null));};exports['createVidaooSession']=function(_0x215e60,_0x5d1983){var _0x1e230d=_0x215e60[_0xdbe4('0xc5')]['id'];var _0x2c69f1;var _0x475dbc;var _0x3b5566;return db[_0xdbe4('0x41')][_0xdbe4('0xc7')]({'where':{'id':_0x1e230d}})[_0xdbe4('0x34')](function(_0x1d4af0){_0x2c69f1=_0x1d4af0;return db[_0xdbe4('0xc8')][_0xdbe4('0xc7')]({'where':{'id':_0x1d4af0[_0xdbe4('0x82')]},'attributes':['id','vidaooApiKey',_0xdbe4('0xc9')],'raw':!![]});})[_0xdbe4('0x34')](function(_0x190a54){if(_0x190a54&&_0x190a54[_0xdbe4('0xca')]&&_0x190a54['vidaooEscalation']){_0x475dbc=_0x190a54;var _0x3e6d0={'rejectUnauthorized':![],'method':_0xdbe4('0xcb'),'uri':_0xdbe4('0xcc'),'headers':{'X-APIKEY':_0x190a54[_0xdbe4('0xca')]},'body':{'name':_0xdbe4('0xcd')+_0x1e230d},'redirect':'follow','json':!![]};return rp(_0x3e6d0);}else{throw new db[(_0xdbe4('0x96'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0xdbe4('0x34')](function(_0x471068){_0x3b5566=_0x471068;if(_0x3b5566['id']){var _0x1d9178={'body':_0x3b5566['join_url'],'ChatWebsiteId':_0x475dbc['id'],'ChatInteractionId':_0x2c69f1['id'],'direction':_0xdbe4('0xce'),'UserId':_0x215e60[_0xdbe4('0xa3')]['id']};return db[_0xdbe4('0xcf')]['create'](_0x1d9178,{});}else{throw new db[(_0xdbe4('0x96'))][(_0xdbe4('0xd0'))](_0xdbe4('0xd1'));}})[_0xdbe4('0x34')](function(){return _0x2c69f1[_0xdbe4('0xd2')]({'vidaooSessionId':_0x3b5566['id']});})['then'](respondWithResult(_0x5d1983,null))['catch'](handleError(_0x5d1983,null));};exports['customUpdate']=function(_0x35682f,_0x47293f){if(_0x35682f['body']['id']){delete _0x35682f[_0xdbe4('0x7f')]['id'];}return db['ChatInteraction'][_0xdbe4('0x7b')]({'where':{'id':_0x35682f[_0xdbe4('0xc5')]['id']}})[_0xdbe4('0x34')](handleEntityNotFound(_0x47293f,null))['then'](saveUpdates(_0x35682f['body'],null))[_0xdbe4('0x34')](respondWithResult(_0x47293f,null))[_0xdbe4('0x27')](handleError(_0x47293f,null));};exports['abandon']=function(_0x527e43,_0x2b28c9,_0x3b9b3e){if(_0x527e43['body']['id']){delete _0x527e43[_0xdbe4('0x7f')]['id'];}return db[_0xdbe4('0x41')][_0xdbe4('0x7b')]({'where':{'id':_0x527e43[_0xdbe4('0xc5')]['id']}})[_0xdbe4('0x34')](function(_0x5da720){if(!_0x5da720){logger[_0xdbe4('0x24')](_0xdbe4('0xd3'),'abandon',0x194,_0xdbe4('0xd4'));_0x2b28c9['sendStatus'](0x194);}else{if(_0x5da720['UserId']){throw new db['Sequelize'][(_0xdbe4('0xd0'))](_0xdbe4('0xd5'));}}return _0x5da720;})['then'](function(_0x48eb3a){if(_0x48eb3a){return _0x48eb3a[_0xdbe4('0x33')]({'closed':_0x527e43[_0xdbe4('0x7f')][_0xdbe4('0xd6')],'disposition':_0x527e43[_0xdbe4('0x7f')]['disposition']})[_0xdbe4('0x34')](function(_0x372466){return _0x372466;});}})['then'](function(_0x14a754){return respondWithRpcPromise(_0xdbe4('0xd7'),'abandon',_0x527e43[_0xdbe4('0x7f')],client9004);})[_0xdbe4('0x34')](respondWithResult(_0x2b28c9,null))['catch'](handleError(_0x2b28c9,null));};exports['attachmentUpload']=function(_0x414573,_0x2e85f8,_0x52bd5d){_0x414573[_0xdbe4('0x7f')][_0xdbe4('0x37')]=_0x414573['file'][_0xdbe4('0xd8')];_0x414573[_0xdbe4('0x7f')][_0xdbe4('0xd9')]=_0x414573[_0xdbe4('0xda')][_0xdbe4('0xdb')];_0x414573['body']['type']=_0x414573[_0xdbe4('0xda')][_0xdbe4('0xdc')];return db[_0xdbe4('0xdd')][_0xdbe4('0xc4')](_0x414573[_0xdbe4('0x7f')])['then'](respondWithResult(_0x2e85f8,0xc9))[_0xdbe4('0x27')](handleError(_0x2e85f8,null));};exports[_0xdbe4('0xde')]=function(_0x4735ae,_0x270ec4,_0x4fe744){return db['ChatInteraction'][_0xdbe4('0xc7')]({'where':{'id':_0x4735ae[_0xdbe4('0xc5')]['id']},'raw':!![]})[_0xdbe4('0x34')](handleEntityNotFound(_0x270ec4,null))[_0xdbe4('0x34')](function(_0x540877){if(_0x540877){if(_0x540877[_0xdbe4('0xd6')]){return _0x270ec4[_0xdbe4('0x2a')](0x193)[_0xdbe4('0x2b')]({'status':0x193,'message':_0xdbe4('0xdf')});}return db[_0xdbe4('0xdd')][_0xdbe4('0xc7')]({'where':{'id':_0x4735ae[_0xdbe4('0x46')]['attachId']},'raw':!![]})[_0xdbe4('0x34')](handleEntityNotFound(_0x270ec4,null));}})['then'](function(_0x1e905d){if(_0x1e905d){return _0x270ec4[_0xdbe4('0xe0')](path['join'](config['root'],_0xdbe4('0xe1'),_0x1e905d[_0xdbe4('0xd9')]));}})[_0xdbe4('0x27')](handleError(_0x270ec4,null));};exports[_0xdbe4('0xe2')]=function(_0x47392d,_0x38c56b){var _0x10da22=null;var _0x5677ab=null;var _0x50d7d7=null;var _0x19fce3=null;if(_0x47392d[_0xdbe4('0x7f')]['id']){delete _0x47392d['body']['id'];}if(_0x47392d[_0xdbe4('0x7f')][_0xdbe4('0xe3')]){_0x19fce3=path[_0xdbe4('0xe4')](config[_0xdbe4('0xe5')],_0xdbe4('0xe6'),util[_0xdbe4('0xe7')](_0xdbe4('0xe8'),Date[_0xdbe4('0xe9')]()));_0x47392d[_0xdbe4('0x7f')]['pathTranscript']=_0x19fce3;}return db[_0xdbe4('0x41')][_0xdbe4('0x7b')]({'where':{'id':_0x47392d[_0xdbe4('0xc5')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xdbe4('0xea'),'include':[{'model':db[_0xdbe4('0x79')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x38c56b,null))[_0xdbe4('0x34')](saveUpdates(_0x47392d[_0xdbe4('0x7f')],null))[_0xdbe4('0x34')](function(_0x24212f){if(_0x24212f){_0x10da22=_0x24212f;return db['ChatWebsite'][_0xdbe4('0x7b')]({'where':{'id':_0x10da22['ChatWebsiteId']}});}})[_0xdbe4('0x34')](function(_0xce2f9b){if(_0xce2f9b){_0x50d7d7=_0xce2f9b;return db['CmContact']['find']({'where':{'id':_0x10da22['ContactId']}});}})['then'](function(_0xf0deab){if(_0xf0deab){_0x5677ab=_0xf0deab;if(_0x19fce3){var _0x15b602=null;for(var _0x43da64=0x1;_0x43da64<_0x10da22['Messages'][_0xdbe4('0x6b')];++_0x43da64){_0x15b602=_0x10da22['Messages'][_0x43da64];var _0x2b4f86=_0x15b602['UserId']?util[_0xdbe4('0xe7')](_0xdbe4('0xeb'),_0x50d7d7[_0xdbe4('0xec')],_0x15b602['UserId']):_0xdbe4('0xed');var _0x39e118=_0x47392d[_0xdbe4('0x7f')][_0xdbe4('0xee')]||util[_0xdbe4('0xe7')]('%s%d','Visitor',_0x15b602[_0xdbe4('0x74')]);switch(_0x50d7d7[_0xdbe4('0xef')]){case _0xdbe4('0xf0'):_0x2b4f86=_0x15b602[_0xdbe4('0x7c')]?util['format'](_0xdbe4('0xeb'),_0x50d7d7['agentAlias'],_0x15b602[_0xdbe4('0x7c')]):_0xdbe4('0xed');break;case _0xdbe4('0xf1'):_0x2b4f86=_0x15b602[_0xdbe4('0x7c')]?_0x15b602[_0xdbe4('0x79')]['alias']||_0x15b602[_0xdbe4('0x79')]['fullname']:_0xdbe4('0xed');break;case'agent_fullname':_0x2b4f86=_0x15b602['UserId']?_0x15b602[_0xdbe4('0x79')]['fullname']:_0xdbe4('0xed');break;default:_0x2b4f86=_0x15b602[_0xdbe4('0x7c')]?util[_0xdbe4('0xe7')](_0xdbe4('0xeb'),_0x50d7d7['agentAlias'],_0x15b602[_0xdbe4('0x7c')]):_0xdbe4('0xed');}var _0x732b66=util[_0xdbe4('0xe7')](_0xdbe4('0xf2'),moment(_0x15b602['createdAt'])[_0xdbe4('0xe7')]('MM/DD/YYYY\x20HH:mm:ss'),_0x15b602[_0xdbe4('0xf3')]==='in'?_0x39e118:_0x2b4f86,_0x15b602[_0xdbe4('0x7f')]);if(!_0x15b602[_0xdbe4('0xf4')]){fs[_0xdbe4('0xf5')](_0x19fce3,_0x732b66);}}return db['MailAccount'][_0xdbe4('0xc7')]({'where':{'service':!![]},'include':[{'model':db[_0xdbe4('0xf6')],'as':_0xdbe4('0xf7'),'raw':!![]}]});}}})[_0xdbe4('0x34')](function(_0x1298ab){if(_0x1298ab&&_0x1298ab[_0xdbe4('0xf7')]&&_0x47392d[_0xdbe4('0x7f')]){var _0x588316={'tls':{'rejectUnauthorized':![]}};if(_0x1298ab[_0xdbe4('0xf7')][_0xdbe4('0xf8')]){_0x588316[_0xdbe4('0xf8')]=_0x1298ab[_0xdbe4('0xf7')][_0xdbe4('0xf8')];}else{_0x588316[_0xdbe4('0xf9')]=_0x1298ab[_0xdbe4('0xf7')][_0xdbe4('0xf9')];_0x588316[_0xdbe4('0xfa')]=_0x1298ab[_0xdbe4('0xf7')][_0xdbe4('0xfa')];_0x588316[_0xdbe4('0xfb')]=_0x1298ab[_0xdbe4('0xf7')][_0xdbe4('0xfb')];}if(_0x1298ab[_0xdbe4('0xf7')][_0xdbe4('0xfc')]){_0x588316['auth']={'user':_0x1298ab['Smtp'][_0xdbe4('0xa3')],'pass':_0x1298ab[_0xdbe4('0xf7')]['pass']};}return respondWithRpcPromise(_0xdbe4('0xfd'),_0xdbe4('0xfe'),{'account':_0x588316,'message':{'from':util[_0xdbe4('0xe7')](_0xdbe4('0xff'),_0x1298ab[_0xdbe4('0x37')],_0x1298ab[_0xdbe4('0x100')]||_0x1298ab[_0xdbe4('0xf7')][_0xdbe4('0xa3')]),'to':_0x47392d[_0xdbe4('0x7f')][_0xdbe4('0xe3')],'subject':_0xdbe4('0x101'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x47392d[_0xdbe4('0x7f')][_0xdbe4('0xe3')]),'attachments':[{'path':_0x19fce3}]}})['then'](function(){return _0x10da22;})['catch'](function(_0x5ce174){console[_0xdbe4('0x24')](_0x5ce174);});}else{return _0x10da22;}})[_0xdbe4('0x34')](respondWithStatusCode(_0x38c56b,0xc8))[_0xdbe4('0x27')](handleError(_0x38c56b,null));};exports[_0xdbe4('0x102')]=function(_0x4fe7c7,_0x33372c,_0x544b0f){return db['ChatMessage'][_0xdbe4('0x7b')]({'where':{'id':_0x4fe7c7[_0xdbe4('0xc5')]['id']}})['then'](handleEntityNotFound(_0x33372c,null))[_0xdbe4('0x34')](function(_0x307407){if(_0x307407){return _0x307407[_0xdbe4('0x102')](_0x4fe7c7[_0xdbe4('0x7f')][_0xdbe4('0x103')],_['omit'](_0x4fe7c7['body'],['ids','id'])||{});}})[_0xdbe4('0x34')](respondWithResult(_0x33372c,null))[_0xdbe4('0x27')](handleError(_0x33372c,null));};exports[_0xdbe4('0x104')]=function(_0x38b352,_0xf001a0,_0x1074d9){var _0x3229e4={'raw':![],'where':{}};var _0x1e7ab3={};var _0x58d82b={'count':0x0,'rows':[]};return db[_0xdbe4('0x41')][_0xdbe4('0xc7')]({'where':{'id':_0x38b352[_0xdbe4('0xc5')]['id']}})['then'](handleEntityNotFound(_0xf001a0,null))[_0xdbe4('0x34')](function(_0x4ee92b){if(_0x4ee92b){_0x1e7ab3[_0xdbe4('0x4a')]=_[_0xdbe4('0x47')](db[_0xdbe4('0xcf')][_0xdbe4('0x42')]);_0x1e7ab3[_0xdbe4('0x46')]=_[_0xdbe4('0x47')](_0x38b352[_0xdbe4('0x46')]);_0x1e7ab3['filters']=_[_0xdbe4('0x49')](_0x1e7ab3['model'],_0x1e7ab3[_0xdbe4('0x46')]);_0x3229e4[_0xdbe4('0x4b')]=_['intersection'](_0x1e7ab3[_0xdbe4('0x4a')],qs[_0xdbe4('0x4c')](_0x38b352[_0xdbe4('0x46')][_0xdbe4('0x4c')]));_0x3229e4['attributes']=_0x3229e4[_0xdbe4('0x4b')][_0xdbe4('0x6b')]?_0x3229e4[_0xdbe4('0x4b')]:_0x1e7ab3[_0xdbe4('0x4a')];if(!_0x38b352[_0xdbe4('0x46')][_0xdbe4('0x4d')](_0xdbe4('0x105'))){_0x3229e4[_0xdbe4('0x2e')]=qs[_0xdbe4('0x2e')](_0x38b352[_0xdbe4('0x46')][_0xdbe4('0x2e')]);_0x3229e4[_0xdbe4('0x2d')]=qs[_0xdbe4('0x2d')](_0x38b352[_0xdbe4('0x46')][_0xdbe4('0x2d')]);}_0x3229e4[_0xdbe4('0x9b')]=qs['sort'](_0x38b352[_0xdbe4('0x46')][_0xdbe4('0x4e')]);_0x3229e4[_0xdbe4('0x4f')]=qs[_0xdbe4('0x48')](_['pick'](_0x38b352['query'],_0x1e7ab3[_0xdbe4('0x48')]));_0x3229e4[_0xdbe4('0x4f')][_0xdbe4('0x106')]=_0x4ee92b['id'];if(_0x38b352[_0xdbe4('0x46')][_0xdbe4('0x107')]){_0x3229e4[_0xdbe4('0x4f')]=_[_0xdbe4('0xa9')](_0x3229e4[_0xdbe4('0x4f')],{'$or':_[_0xdbe4('0x39')](_0x3229e4[_0xdbe4('0x4b')],function(_0x1244cb){var _0x358e27={};_0x358e27[_0x1244cb]={'$like':'%'+_0x38b352[_0xdbe4('0x46')][_0xdbe4('0x107')]+'%'};return _0x358e27;})});}if(_0x38b352['query']['$gte']){var _0xbfa3d9=_0x38b352[_0xdbe4('0x46')][_0xdbe4('0x87')]['split'](',');var _0x5ca81d={};_0x5ca81d[_0xbfa3d9[0x0]]={'$gte':moment(_0xbfa3d9[0x1])[_0xdbe4('0xe7')](_0xdbe4('0x108'))};_0x3229e4[_0xdbe4('0x4f')]=_['merge'](_0x3229e4[_0xdbe4('0x4f')],_0x5ca81d);}_0x3229e4=_[_0xdbe4('0xa9')]({},_0x3229e4,_0x38b352[_0xdbe4('0x109')]);return db[_0xdbe4('0xcf')]['count']({'where':_0x3229e4['where']})[_0xdbe4('0x34')](function(_0x306045){_0x58d82b[_0xdbe4('0x2c')]=_0x306045;if(_0x38b352[_0xdbe4('0x46')]['includeAll']){_0x3229e4[_0xdbe4('0x10a')]=[{'all':!![]}];}return db[_0xdbe4('0xcf')][_0xdbe4('0x10b')](_0x3229e4);})[_0xdbe4('0x34')](function(_0x5285d9){_0x58d82b[_0xdbe4('0xc2')]=_0x5285d9;return _0x58d82b;});}})['then'](respondWithFilteredResult(_0xf001a0,_0x3229e4))[_0xdbe4('0x27')](handleError(_0xf001a0,null));};exports[_0xdbe4('0x10c')]=function(_0x205143,_0x24f12d,_0x8408b8){var _0x42f29b={'where':{}},_0x105c57={},_0x353801={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xdbe4('0xc7')]({'where':{'id':_0x205143[_0xdbe4('0xc5')]['id']}})[_0xdbe4('0x34')](handleEntityNotFound(_0x24f12d,null))['then'](function(_0x2c6f94){if(_0x2c6f94){_0x105c57[_0xdbe4('0x4a')]=_[_0xdbe4('0x47')](db[_0xdbe4('0xcf')][_0xdbe4('0x42')]);_0x105c57[_0xdbe4('0x46')]=_['keys'](_0x205143['query']);_0x105c57['filters']=_[_0xdbe4('0x49')](_0x105c57['model'],_0x105c57[_0xdbe4('0x46')]);_0x42f29b[_0xdbe4('0x4b')]=_['intersection'](_0x105c57[_0xdbe4('0x4a')],qs[_0xdbe4('0x4c')](_0x205143[_0xdbe4('0x46')][_0xdbe4('0x4c')]));_0x42f29b[_0xdbe4('0x4b')]=_0x42f29b[_0xdbe4('0x4b')][_0xdbe4('0x6b')]?_0x42f29b[_0xdbe4('0x4b')]:_0x105c57[_0xdbe4('0x4a')];if(!_0x205143[_0xdbe4('0x46')][_0xdbe4('0x4d')](_0xdbe4('0x105'))){_0x42f29b[_0xdbe4('0x2e')]=qs[_0xdbe4('0x2e')](_0x205143[_0xdbe4('0x46')][_0xdbe4('0x2e')]);_0x42f29b[_0xdbe4('0x2d')]=qs['offset'](_0x205143[_0xdbe4('0x46')][_0xdbe4('0x2d')]);}_0x42f29b['order']=qs['sort'](_0x205143[_0xdbe4('0x46')][_0xdbe4('0x4e')]);_0x42f29b[_0xdbe4('0x4f')]=qs[_0xdbe4('0x48')](_[_0xdbe4('0x50')](_0x205143[_0xdbe4('0x46')],_0x105c57['filters']));_0x42f29b[_0xdbe4('0x4f')][_0xdbe4('0x106')]=_0x2c6f94['id'];if(_0x205143['query'][_0xdbe4('0x107')]){_0x42f29b[_0xdbe4('0x4f')]=_[_0xdbe4('0xa9')](_0x42f29b[_0xdbe4('0x4f')],{'$or':_['map'](_0x42f29b[_0xdbe4('0x4b')],function(_0x48cff8){var _0x3bc8d0={};_0x3bc8d0[_0x48cff8]={'$like':'%'+_0x205143[_0xdbe4('0x46')]['filter']+'%'};return _0x3bc8d0;})});}_0x42f29b[_0xdbe4('0x4f')]['secret']=![];if(_0x205143[_0xdbe4('0x46')]['id']){_0x42f29b['where']['id']={'$gt':_0x205143[_0xdbe4('0x46')]['id']};}_0x42f29b=_[_0xdbe4('0xa9')]({},_0x42f29b,_0x205143[_0xdbe4('0x109')]);return db[_0xdbe4('0xcf')][_0xdbe4('0x2c')]({'where':_0x42f29b[_0xdbe4('0x4f')]})[_0xdbe4('0x34')](function(_0x3b4607){_0x353801[_0xdbe4('0x2c')]=_0x3b4607;_0x42f29b[_0xdbe4('0x10a')]=[];if(_0x205143['query'][_0xdbe4('0x10d')]){_0x42f29b[_0xdbe4('0x10a')][_0xdbe4('0x3f')]({'model':db['User'],'as':_0xdbe4('0x79'),'attributes':['id',_0xdbe4('0x3a'),_0xdbe4('0x10e')]});}if(_0x205143[_0xdbe4('0x46')][_0xdbe4('0x10f')]){_0x42f29b[_0xdbe4('0x10a')]=[{'all':!![]}];}return db[_0xdbe4('0xcf')][_0xdbe4('0x10b')](_0x42f29b);})['then'](function(_0x231f13){_0x353801[_0xdbe4('0xc2')]=_0x231f13;return _0x353801;});}})[_0xdbe4('0x34')](respondWithFilteredResult(_0x24f12d,_0x42f29b))[_0xdbe4('0x27')](handleError(_0x24f12d,null));};exports['addTags']=function(_0x467c92,_0x55ace1,_0x3244bf){return db[_0xdbe4('0x41')][_0xdbe4('0x7b')]({'where':{'id':_0x467c92['params']['id']}})[_0xdbe4('0x34')](handleEntityNotFound(_0x55ace1,null))['then'](function(_0x22c95a){if(_0x22c95a){return _0x22c95a[_0xdbe4('0x110')](_0x467c92[_0xdbe4('0x7f')]['ids'],_['omit'](_0x467c92[_0xdbe4('0x7f')],[_0xdbe4('0x103'),'id'])||{})[_0xdbe4('0x111')](function(){return db[_0xdbe4('0x76')]['findAll']({'attributes':['id',_0xdbe4('0x37'),_0xdbe4('0x53')],'where':{'id':_0x467c92[_0xdbe4('0x7f')]['ids']}});})[_0xdbe4('0x34')](function(_0x2f2874){socket[_0xdbe4('0x112')](_0xdbe4('0x113'),{'id':Number(_0x467c92[_0xdbe4('0xc5')]['id']),'tags':_0x2f2874||[]});return{'id':Number(_0x467c92['params']['id']),'tags':_0x2f2874||[]};});}})['then'](respondWithResult(_0x55ace1,null))[_0xdbe4('0x27')](handleError(_0x55ace1,null));};exports['removeTags']=function(_0x1bad78,_0x4bb394,_0x5c544a){return db[_0xdbe4('0x41')][_0xdbe4('0x7b')]({'where':{'id':_0x1bad78[_0xdbe4('0xc5')]['id']}})['then'](handleEntityNotFound(_0x4bb394,null))[_0xdbe4('0x34')](function(_0x353b1b){if(_0x353b1b){return _0x353b1b['removeTags'](_0x1bad78[_0xdbe4('0x46')][_0xdbe4('0x103')]);}})[_0xdbe4('0x34')](respondWithStatusCode(_0x4bb394,null))[_0xdbe4('0x27')](handleError(_0x4bb394,null));};exports[_0xdbe4('0xe0')]=function(_0x3a03e5,_0x2dd5ac){var _0x58fde9=moment()[_0xdbe4('0x114')]()[_0xdbe4('0xa7')]();var _0xdb848=path[_0xdbe4('0xe4')](config[_0xdbe4('0xe5')],_0xdbe4('0x115'),_0xdbe4('0x116'),_0xdbe4('0x117'));var _0x273371=path[_0xdbe4('0xe4')](config[_0xdbe4('0xe5')],_0xdbe4('0x115'),'files',_0xdbe4('0x118'));var _0x3a889a=path[_0xdbe4('0xe4')](_0xdb848,_0x58fde9);var _0x1d2d2f=util[_0xdbe4('0xe7')](_0xdbe4('0x119'),_0x3a03e5[_0xdbe4('0xc5')]['id'],_0x58fde9);var _0x31d3c5=path[_0xdbe4('0xe4')](_0xdb848,_0x1d2d2f);var _0x26ba35=[];_0x26ba35[_0xdbe4('0x3f')]({'model':db[_0xdbe4('0x79')],'as':'User','attributes':['id',_0xdbe4('0x3a')],'raw':!![]});_0x26ba35[_0xdbe4('0x3f')]({'model':db['CmContact'],'as':_0xdbe4('0x6f'),'attributes':['id',_0xdbe4('0x11a'),_0xdbe4('0x11b')],'raw':!![]});if(_0x3a03e5[_0xdbe4('0x46')]['attachments']){_0x26ba35[_0xdbe4('0x3f')]({'model':db[_0xdbe4('0xdd')],'as':_0xdbe4('0xdd'),'raw':!![]});}var _0x56266c=[{'model':db[_0xdbe4('0xcf')],'as':_0xdbe4('0xea'),'attributes':['id','body','createdAt',_0xdbe4('0xf3'),'secret',_0xdbe4('0x8c')],'include':_0x26ba35}];_0x56266c[_0xdbe4('0x3f')]({'model':db[_0xdbe4('0xc8')],'as':_0xdbe4('0x11c'),'attributes':['id',_0xdbe4('0x37')]});_0x56266c[_0xdbe4('0x3f')]({'model':db[_0xdbe4('0x79')],'as':_0xdbe4('0x11d'),'attributes':['id',_0xdbe4('0x3a')]});return db[_0xdbe4('0x41')]['find']({'where':{'id':_0x3a03e5[_0xdbe4('0xc5')]['id']},'include':_0x56266c})[_0xdbe4('0x34')](handleEntityNotFound(_0x2dd5ac,null))['then'](function(_0x178895){if(_0x178895){var _0x4676f8=_0x178895[_0xdbe4('0x11e')]({'plain':!![]});fs[_0xdbe4('0x11f')](_0x3a889a);var _0x57e390={'format':'A4','border':_0xdbe4('0x120'),'header':{'height':'40px','contents':{'first':_0xdbe4('0x121')}},'footer':{'height':_0xdbe4('0x122'),'contents':{'default':util[_0xdbe4('0xe7')](_0xdbe4('0x123'),util[_0xdbe4('0xe7')](_0xdbe4('0x124'),_0xdbe4('0x125'),_0x4676f8['id']),moment()['format']('YYYY-MM-DD')[_0xdbe4('0xa7')]())}}};var _0x3271ae={'channel':_0xdbe4('0x125'),'account':_0x4676f8[_0xdbe4('0x11c')][_0xdbe4('0x37')],'agent':_0x4676f8['Owner']?_0x4676f8[_0xdbe4('0x11d')][_0xdbe4('0x3a')]:'N.A.','createdAt':moment(_0x4676f8[_0xdbe4('0x85')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xdbe4('0xa7')](),'closedAt':_0x4676f8[_0xdbe4('0xd6')]?moment(_0x4676f8[_0xdbe4('0x126')])[_0xdbe4('0xe7')](_0xdbe4('0x108'))[_0xdbe4('0xa7')]():'','disposition':_0x4676f8[_0xdbe4('0x127')],'chatInfo':{'browser':_0x4676f8[_0xdbe4('0x128')],'os':_0x4676f8[_0xdbe4('0x129')],'referer':_0x4676f8[_0xdbe4('0x12a')],'customerIp':_0x4676f8[_0xdbe4('0x12b')],'customerPort':_0x4676f8[_0xdbe4('0x12c')]?_0x4676f8[_0xdbe4('0x12c')]:_0xdbe4('0x12d')},'messages':_(_0x4676f8['Messages'])[_0xdbe4('0x12e')]()[_0xdbe4('0x107')]({'secret':![]})['map'](function(_0x32b41f){if(_0x32b41f[_0xdbe4('0xdd')]){var _0x58b05a=path[_0xdbe4('0xe4')](_0x273371,_0x32b41f[_0xdbe4('0xdd')][_0xdbe4('0xd9')]);if(fs['existsSync'](_0x58b05a)){fs[_0xdbe4('0x12f')](_0x58b05a)[_0xdbe4('0x130')](fs[_0xdbe4('0x131')](path[_0xdbe4('0xe4')](_0x3a889a,_0x32b41f['Attachment'][_0xdbe4('0xd9')])));}}return{'date':moment(_0x32b41f[_0xdbe4('0x85')])[_0xdbe4('0xe7')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdbe4('0xa7')](),'sender':_0x32b41f[_0xdbe4('0xf3')]===_0xdbe4('0xce')?_0x32b41f[_0xdbe4('0x79')]?_0x32b41f['User'][_0xdbe4('0x3a')]:_0xdbe4('0xed'):_0x32b41f[_0xdbe4('0x6f')][_0xdbe4('0x11a')]+(_0x32b41f[_0xdbe4('0x6f')][_0xdbe4('0x11b')]?'\x20'+_0x32b41f['Contact'][_0xdbe4('0x11b')]:''),'body':_0x32b41f[_0xdbe4('0xdd')]?_0x32b41f[_0xdbe4('0xdd')][_0xdbe4('0xd9')]:_0x32b41f[_0xdbe4('0x7f')],'direction':_0x32b41f[_0xdbe4('0xf3')]===_0xdbe4('0xce')?'A':'C','secret':_0x32b41f[_0xdbe4('0xf4')],'read':_0x32b41f[_0xdbe4('0x8c')],'attachment':_0x32b41f['Attachment']};})[_0xdbe4('0x6c')]()};return ejs[_0xdbe4('0x132')](path[_0xdbe4('0xe4')](config['root'],_0xdbe4('0x115'),'views',_0xdbe4('0x133')),{'interaction':_0x3271ae})[_0xdbe4('0x34')](function(_0x291b42){return new BPromise(function(_0x162928,_0x33885a){pdf['create'](_0x291b42,_0x57e390)[_0xdbe4('0x134')](path[_0xdbe4('0xe4')](_0x3a889a,_0xdbe4('0x135')+_0x4676f8['id']+'-'+_0x58fde9+_0xdbe4('0x136')),function(_0x93fee3,_0x5ea342){if(_0x93fee3)return _0x33885a(_0x93fee3);_0x162928(_0x5ea342);});});})[_0xdbe4('0x34')](function(){return new BPromise(function(_0x19e8d9,_0x57099c){zipdir(_0x3a889a,{'saveTo':_0x31d3c5},function(_0x26548e,_0x52696f){if(_0x26548e)return _0x57099c(_0x26548e);return _0x19e8d9(_0x52696f);});})['then'](function(){return new BPromise(function(_0x303147,_0xb53f72){rimraf(_0x3a889a,function(_0x511fb1){if(_0x511fb1)_0xb53f72(_0x511fb1);return _0x303147();});});})['then'](function(){return _0x2dd5ac[_0xdbe4('0xe0')](_0x31d3c5,_0x1d2d2f,function(_0x28f171){if(_0x28f171){console[_0xdbe4('0x137')]('err',_0x28f171);}else{fs[_0xdbe4('0x138')](_0x31d3c5);}});});});}else{return _0x2dd5ac[_0xdbe4('0x28')](0xc8);}})[_0xdbe4('0x27')](handleError(_0x2dd5ac,null));}; \ No newline at end of file +var _0xb4f7=['MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','basename','file','filename','mimetype','attachmentDownload','closed','Attachment','attachId','download','join','server/files/attachments/','mailTranscript','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','CmContact','agentAlias','customer','%s%d','Visitor','agentIdentifier','System','agent_alias','fullname','agent_fullname','format','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','authentication','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','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','alias','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','firstName','lastName','Owner','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','Chat','Account','N.A.','closedAt','browserName','osName','referer','customerPort','existsSync','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','name','Users','map','forEach','Tags','TagIds','catch','ChatInteraction','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','left_join','users','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','split','length','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','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','ChatWebsiteId','where','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`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?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','agent','user','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','sequelize','toString','merge','a.key','Account.key','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','Contact.firstName','c.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','push','all','rows','show','params','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions'];(function(_0x1367f5,_0x2d4da4){var _0x575d14=function(_0x9a5f22){while(--_0x9a5f22){_0x1367f5['push'](_0x1367f5['shift']());}};_0x575d14(++_0x2d4da4);}(_0xb4f7,0x19b));var _0x7b4f=function(_0x17e74a,_0x3a7834){_0x17e74a=_0x17e74a-0x0;var _0x36131e=_0xb4f7[_0x17e74a];return _0x36131e;};'use strict';var pdf=require(_0x7b4f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b4f('0x1'));var zipdir=require(_0x7b4f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b4f('0x3'));var moment=require(_0x7b4f('0x4'));var BPromise=require(_0x7b4f('0x5'));var Mustache=require(_0x7b4f('0x6'));var util=require(_0x7b4f('0x7'));var path=require(_0x7b4f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b4f('0x9'));var fs=require('fs');var _=require(_0x7b4f('0xa'));var squel=require(_0x7b4f('0xb'));var crypto=require(_0x7b4f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7b4f('0xd'));var toCsv=require(_0x7b4f('0xe'));var querystring=require(_0x7b4f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7b4f('0x10'));var as=require(_0x7b4f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b4f('0x12'))(_0x7b4f('0x13'));var utils=require('../../config/utils');var config=require(_0x7b4f('0x14'));var licenseUtil=require(_0x7b4f('0x15'));var db=require('../../mysqldb')['db'];config[_0x7b4f('0x16')]=_[_0x7b4f('0x17')](config[_0x7b4f('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b4f('0x18'))(new Redis(config['redis']));require(_0x7b4f('0x19'))[_0x7b4f('0x1a')](socket);var jayson=require(_0x7b4f('0x1b'));var client=jayson[_0x7b4f('0x1c')][_0x7b4f('0x1d')]({'port':0x232b});var client9004=jayson[_0x7b4f('0x1c')][_0x7b4f('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x181fad,_0x41b3ed,_0x296eb3,_0x60ba1c){return new BPromise(function(_0xf09bd6,_0x3724a8){var _0x1c7621=_0x60ba1c||client;return _0x1c7621[_0x7b4f('0x1e')](_0x181fad,_0x296eb3)['then'](function(_0x325c1d){logger[_0x7b4f('0x1f')](_0x7b4f('0x20'),_0x41b3ed,_0x7b4f('0x21'));logger[_0x7b4f('0x22')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x41b3ed,_0x7b4f('0x21'),JSON[_0x7b4f('0x23')](_0x325c1d));if(_0x325c1d[_0x7b4f('0x24')]){if(_0x325c1d[_0x7b4f('0x24')][_0x7b4f('0x25')]===0x1f4){logger[_0x7b4f('0x24')](_0x7b4f('0x20'),_0x41b3ed,_0x325c1d[_0x7b4f('0x24')][_0x7b4f('0x26')]);return _0x3724a8(_0x325c1d[_0x7b4f('0x24')][_0x7b4f('0x26')]);}logger[_0x7b4f('0x24')](_0x7b4f('0x20'),_0x41b3ed,_0x325c1d[_0x7b4f('0x24')][_0x7b4f('0x26')]);return _0xf09bd6(_0x325c1d['error']['message']);}else{logger['info'](_0x7b4f('0x20'),_0x41b3ed,_0x7b4f('0x21'));_0xf09bd6(_0x325c1d[_0x7b4f('0x27')][_0x7b4f('0x26')]);}})['catch'](function(_0x226fe0){logger[_0x7b4f('0x24')](_0x7b4f('0x20'),_0x41b3ed,_0x226fe0);_0x3724a8(_0x226fe0);});});}function respondWithStatusCode(_0x2ccaf0,_0x143c92){_0x143c92=_0x143c92||0xcc;return function(_0x3d6c16){if(_0x3d6c16){return _0x2ccaf0['sendStatus'](_0x143c92);}return _0x2ccaf0[_0x7b4f('0x28')](_0x143c92)['end']();};}function respondWithResult(_0x3d298,_0xa9da94){_0xa9da94=_0xa9da94||0xc8;return function(_0x288943){if(_0x288943){return _0x3d298['status'](_0xa9da94)[_0x7b4f('0x29')](_0x288943);}};}function respondWithFilteredResult(_0x471e2e,_0x1ff16c){return function(_0x3266e5){if(_0x3266e5){var _0x278e96=_0x3266e5[_0x7b4f('0x2a')],_0x398fa3=_0x1ff16c[_0x7b4f('0x2b')],_0x1af783=_0x1ff16c['offset']+_0x1ff16c[_0x7b4f('0x2c')],_0x395f22;if(_0x1af783>=_0x278e96){_0x1af783=_0x278e96;_0x395f22=0xc8;}else{_0x395f22=0xce;}_0x471e2e[_0x7b4f('0x28')](_0x395f22);return _0x471e2e[_0x7b4f('0x2d')](_0x7b4f('0x2e'),_0x398fa3+'-'+_0x1af783+'/'+_0x278e96)[_0x7b4f('0x29')](_0x3266e5);}return null;};}function patchUpdates(_0xf2ce26){return function(_0x4a474b){try{jsonpatch[_0x7b4f('0x2f')](_0x4a474b,_0xf2ce26,!![]);}catch(_0x13d31d){return BPromise[_0x7b4f('0x30')](_0x13d31d);}return _0x4a474b[_0x7b4f('0x31')]();};}function saveUpdates(_0x34bfd4,_0x31d3c6){return function(_0x594cd5){if(_0x594cd5){return _0x594cd5[_0x7b4f('0x32')](_0x34bfd4)[_0x7b4f('0x33')](function(_0x195e16){return _0x195e16;});}return null;};}function removeEntity(_0xab2093,_0x58d8d9){return function(_0x12d6cf){if(_0x12d6cf){return _0x12d6cf[_0x7b4f('0x34')]()['then'](function(){_0xab2093['status'](0xcc)[_0x7b4f('0x35')]();});}};}function handleEntityNotFound(_0x1baec2,_0x21fe8b){return function(_0x5d1b33){if(!_0x5d1b33){_0x1baec2[_0x7b4f('0x36')](0x194);}return _0x5d1b33;};}function handleError(_0x4c6001,_0x23e072){_0x23e072=_0x23e072||0x1f4;return function(_0x15485a){logger['error'](_0x15485a['stack']);if(_0x15485a[_0x7b4f('0x37')]){delete _0x15485a[_0x7b4f('0x37')];}_0x4c6001[_0x7b4f('0x28')](_0x23e072)['send'](_0x15485a);};}function getInteractionUsers(_0x347b8b,_0x3dbc64){return new BPromise(function(_0x21b15b,_0x4be850){try{if(_0x3dbc64[_0x347b8b['id']]){_0x347b8b[_0x7b4f('0x38')]=_[_0x7b4f('0x39')](_0x3dbc64[_0x347b8b['id']],function(_0x53f310){return{'id':_0x53f310['id'],'fullname':_0x53f310['fullname']};});}}catch(_0x333098){_0x4be850(_0x333098);}_0x21b15b(_0x347b8b);});}function getInteractionTags(_0x44ac12,_0x47849d){return new BPromise(function(_0x1cb950,_0x4490c3){try{if(_0x44ac12['TagIds']){_0x44ac12['Tags']=[];_0x44ac12['TagIds']['split'](',')[_0x7b4f('0x3a')](function(_0x15f822){_0x44ac12[_0x7b4f('0x3b')]['push'](_0x47849d[_0x15f822]);});}delete _0x44ac12[_0x7b4f('0x3c')];}catch(_0xef523f){_0x4490c3(_0xef523f);}_0x1cb950(_0x44ac12);});}function updateChatInteraction(_0x2f98f8,_0xf5bcea,_0x1220ce){return new BPromise(function(_0x52e46a,_0x5de4f5){return getInteractionUsers(_0x2f98f8,_0x1220ce)['then'](function(_0x18f085){return getInteractionTags(_0x18f085,_0xf5bcea);})[_0x7b4f('0x33')](function(_0x4b5195){_0x52e46a(_0x4b5195);})[_0x7b4f('0x3d')](function(_0x2569b9){_0x5de4f5(_0x2569b9);});});}exports['index']=function(_0x18e00f,_0xf78c66){var _0x2fdb69={},_0x3871c1={},_0x492ade={'count':0x0,'rows':[]};var _0x1907fc=_[_0x7b4f('0x39')](db[_0x7b4f('0x3e')][_0x7b4f('0x3f')],function(_0x372e21){return{'name':_0x372e21['fieldName'],'type':_0x372e21[_0x7b4f('0x40')]['key']};});_0x3871c1[_0x7b4f('0x41')]=_[_0x7b4f('0x39')](_0x1907fc,_0x7b4f('0x37'));_0x3871c1[_0x7b4f('0x42')]=_[_0x7b4f('0x43')](_0x18e00f[_0x7b4f('0x42')]);_0x3871c1[_0x7b4f('0x44')]=_[_0x7b4f('0x45')](_0x3871c1[_0x7b4f('0x41')],_0x3871c1[_0x7b4f('0x42')]);_0x2fdb69['attributes']=_[_0x7b4f('0x45')](_0x3871c1[_0x7b4f('0x41')],qs[_0x7b4f('0x46')](_0x18e00f['query']['fields']));_0x2fdb69[_0x7b4f('0x47')]=_0x2fdb69[_0x7b4f('0x47')]['length']?_0x2fdb69[_0x7b4f('0x47')]:_0x3871c1['model'];if(!_0x18e00f[_0x7b4f('0x42')][_0x7b4f('0x48')](_0x7b4f('0x49'))){_0x2fdb69[_0x7b4f('0x2c')]=qs[_0x7b4f('0x2c')](_0x18e00f[_0x7b4f('0x42')]['limit']);_0x2fdb69[_0x7b4f('0x2b')]=qs[_0x7b4f('0x2b')](_0x18e00f[_0x7b4f('0x42')][_0x7b4f('0x2b')]);}_0x2fdb69['order']=qs['sort'](_0x18e00f['query'][_0x7b4f('0x4a')]);_0x2fdb69['where']=qs[_0x7b4f('0x44')](_[_0x7b4f('0x4b')](_0x18e00f[_0x7b4f('0x42')],_0x3871c1[_0x7b4f('0x44')]),_0x1907fc);var _0x34aa17=[];var _0x1e7afe=squel[_0x7b4f('0x4c')]()[_0x7b4f('0x4d')]('id')['field']('name')[_0x7b4f('0x4d')](_0x7b4f('0x4e'))[_0x7b4f('0x4f')](_0x7b4f('0x50'));var _0x1764cd=squel[_0x7b4f('0x4c')]()[_0x7b4f('0x4d')](_0x7b4f('0x51'))[_0x7b4f('0x4d')](_0x7b4f('0x52'))[_0x7b4f('0x4d')]('ui.ChatInteractionId')[_0x7b4f('0x4f')]('user_has_chat_interactions','ui')[_0x7b4f('0x53')](_0x7b4f('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x260966=squel[_0x7b4f('0x4c')]()[_0x7b4f('0x4f')](_0x7b4f('0x55'),'i')[_0x7b4f('0x53')](_0x7b4f('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x7b4f('0x54'),'o',_0x7b4f('0x57'))['left_join'](_0x7b4f('0x58'),'a',_0x7b4f('0x59'))[_0x7b4f('0x53')](_0x7b4f('0x5a'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x7b4f('0x53')](_0x7b4f('0x5b'),'it',_0x7b4f('0x5c'))['left_join'](_0x7b4f('0x50'),'t',_0x7b4f('0x5d'));var _0x4a564c=squel[_0x7b4f('0x5e')]();var _0x4f65d0=[];var _0x47bbe9=squel[_0x7b4f('0x5e')]();var _0x4d437e;if(_0x18e00f[_0x7b4f('0x42')][_0x7b4f('0x5f')]){_0x4d437e=as[_0x7b4f('0x60')](_0x18e00f[_0x7b4f('0x42')]['search']);var _0x45add9=_0x4d437e[_0x7b4f('0x61')];for(var _0x2476e8=0x0;_0x2476e8<_0x4d437e['conditions']['length'];_0x2476e8++){var _0x486efe=_0x4d437e[_0x7b4f('0x62')][_0x2476e8];var _0x3c14c2='i';var _0x28cb1a=_[_0x7b4f('0x63')](_0x1907fc,[_0x7b4f('0x37'),_0x486efe[_0x7b4f('0x4d')]]);if(!_0x28cb1a){switch(_0x486efe['field']){case _0x7b4f('0x64'):if(_0x486efe[_0x7b4f('0x65')]==0x1){_0x260966[_0x7b4f('0x66')]('`'+_0x486efe[_0x7b4f('0x4d')]+_0x7b4f('0x67'));}else{_0x260966[_0x7b4f('0x66')]('`'+_0x486efe[_0x7b4f('0x4d')]+_0x7b4f('0x68'));}break;case _0x7b4f('0x69'):if(_0x486efe['operator']===_0x7b4f('0x6a')){if(_0x486efe['value'][_0x7b4f('0x6b')]('\x20')[_0x7b4f('0x6c')]>0x1){_0x4a564c[_0x45add9]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7b4f('0x6d')](_0x486efe[_0x7b4f('0x65')]),null);}else{var _0x2a4b5b='%'+_0x486efe['value']+'%';_0x4a564c[_0x45add9](_0x7b4f('0x6e'),_0x2a4b5b,_0x2a4b5b,_0x2a4b5b);}}else{_0x28cb1a=_[_0x7b4f('0x63')](_0x1907fc,['name','ContactId']);_0x486efe[_0x7b4f('0x4d')]=_0x7b4f('0x6f');_0xce4078=as[_0x7b4f('0x70')](_0x3c14c2,_0x28cb1a[_0x7b4f('0x40')],_0x486efe);_0x4a564c[_0x45add9](_0xce4078[_0x7b4f('0x71')],_0xce4078['value'][_0x7b4f('0x72')],_0xce4078['value'][_0x7b4f('0x35')]);}break;case _0x7b4f('0x73'):var _0x1c90b9=_0x486efe[_0x7b4f('0x65')][_0x7b4f('0x6b')](',')['map'](function(_0x3013c7){return Number(_0x3013c7);});_0x1c90b9['forEach'](function(_0x4799c3){_0x47bbe9['or'](_0x7b4f('0x74'),'%,'+_0x4799c3+',%');});_0x4f65d0=_[_0x7b4f('0x75')](_0x4f65d0,_0x1c90b9);break;case _0x7b4f('0x76'):if(_0x486efe[_0x7b4f('0x77')]==='$substring'){_0x4a564c[_0x45add9](_0x7b4f('0x78'),'%'+_0x486efe[_0x7b4f('0x65')]+'%',null);}else{_0x28cb1a=_[_0x7b4f('0x63')](_0x1907fc,[_0x7b4f('0x37'),_0x7b4f('0x79')]);_0x486efe['field']=_0x7b4f('0x79');_0xce4078=as['buildExpression'](_0x3c14c2,_0x28cb1a['type'],_0x486efe);_0x4a564c[_0x45add9](_0xce4078[_0x7b4f('0x71')],_0xce4078['value'][_0x7b4f('0x72')],_0xce4078[_0x7b4f('0x65')][_0x7b4f('0x35')]);}break;case _0x7b4f('0x7a'):_0xce4078=as['buildExpression']('me',null,_0x486efe);_0x4a564c[_0x45add9](_0xce4078[_0x7b4f('0x71')],_0xce4078[_0x7b4f('0x65')]['start'],_0xce4078[_0x7b4f('0x65')]['end']);break;}}else{var _0xce4078=as[_0x7b4f('0x70')](_0x3c14c2,_0x28cb1a['type'],_0x486efe);_0x4a564c[_0x45add9](_0xce4078[_0x7b4f('0x71')],_0xce4078[_0x7b4f('0x65')][_0x7b4f('0x72')],_0xce4078[_0x7b4f('0x65')][_0x7b4f('0x35')]);}}}else{var _0x5baa7b=_(_0x18e00f[_0x7b4f('0x42')])[_0x7b4f('0x43')]()[_0x7b4f('0x39')](function(_0x56c3b5){return _[_0x7b4f('0x7b')](_0x1907fc,[_0x7b4f('0x37'),_0x56c3b5])?_0x56c3b5:undefined;})['compact']()[_0x7b4f('0x65')]();if(!_[_0x7b4f('0x7c')](_0x5baa7b)){_0x5baa7b[_0x7b4f('0x3a')](function(_0x5cc4e1){if(_0x5cc4e1===_0x7b4f('0x7d')){_0x260966[_0x7b4f('0x7e')]('i.ChatWebsiteId\x20IN\x20?',[]['concat'](_0x18e00f[_0x7b4f('0x42')][_0x5cc4e1]));}else if(_0x5cc4e1===_0x7b4f('0x7f')){var _0x701839=JSON['parse'](_0x18e00f['query'][_0x5cc4e1])[_0x7b4f('0x80')];var _0x49e412=JSON[_0x7b4f('0x81')](_0x18e00f[_0x7b4f('0x42')][_0x5cc4e1])[_0x7b4f('0x82')];_0x260966[_0x7b4f('0x7e')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x701839,_0x49e412);}else{if(_0x18e00f[_0x7b4f('0x42')][_0x5cc4e1]===_0x7b4f('0x83')){_0x260966[_0x7b4f('0x7e')]('i.'+_0x5cc4e1+_0x7b4f('0x84'));}else{_0x260966['where']('i.'+_0x5cc4e1+'\x20=\x20?',_0x18e00f['query'][_0x5cc4e1]);}}});}if(_0x18e00f[_0x7b4f('0x42')][_0x7b4f('0x85')]){if(_0x18e00f['query'][_0x7b4f('0x85')]==0x1){_0x260966['having'](_0x7b4f('0x86'));}else{_0x260966[_0x7b4f('0x66')](_0x7b4f('0x87'));}}if(_0x18e00f['query'][_0x7b4f('0x88')]){_0x4f65d0=_[_0x7b4f('0x89')](_0x18e00f['query'][_0x7b4f('0x88')])?_0x18e00f['query'][_0x7b4f('0x88')]:new Array(_0x18e00f[_0x7b4f('0x42')][_0x7b4f('0x88')]);_0x4f65d0['forEach'](function(_0x1ae549){_0x47bbe9['or'](_0x7b4f('0x74'),'%,'+_0x1ae549+',%');});}if(_0x18e00f['query']['filter']){var _0x198e2c=_0x18e00f[_0x7b4f('0x42')][_0x7b4f('0x8a')][_0x7b4f('0x8b')]('\x5c','\x5c\x5c')[_0x7b4f('0x8b')](/'/g,'\x27\x27');if(qs[_0x7b4f('0x8c')](_0x198e2c)){_0x4a564c['or'](_0x7b4f('0x8d'),_0x198e2c+'%');}else{_0x4a564c['or'](_0x7b4f('0x8e'),qs[_0x7b4f('0x6d')](_0x198e2c))['or'](_0x7b4f('0x8f'),_0x198e2c+'%');}}}_0x260966[_0x7b4f('0x7e')](_0x4a564c);_0x260966['group'](_0x7b4f('0x90'));var _0x506e1f={'type':db[_0x7b4f('0x91')][_0x7b4f('0x92')][_0x7b4f('0x93')],'raw':!![]};var _0x577b6a=_0x260966[_0x7b4f('0x94')]();_0x577b6a[_0x7b4f('0x4d')](_0x7b4f('0x90'));_0x577b6a[_0x7b4f('0x4d')](_0x7b4f('0x95'),_0x7b4f('0x64'));if(_0x2fdb69[_0x7b4f('0x96')]){_0x2fdb69[_0x7b4f('0x96')][_0x7b4f('0x3a')](function(_0x3eaa15){var _0x3b9041=_0x3eaa15[0x0]===_0x7b4f('0x97')?_0x3eaa15[0x0]:'i.'+_0x3eaa15[0x0];_0x260966[_0x7b4f('0x96')](_0x3b9041,_0x3eaa15[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7b4f('0x7c')](_0x4f65d0)){_0x260966['having'](_0x47bbe9);_0x577b6a['where'](_0x7b4f('0x98'),_0x4f65d0);}BPromise[_0x7b4f('0x99')]()[_0x7b4f('0x33')](function(){if(!_0x4d437e){if(_0x18e00f[_0x7b4f('0x42')]['ChatWebsiteId'])return;_0x577b6a['where'](_0x7b4f('0x9a'));_0x260966[_0x7b4f('0x7e')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x18e00f['user']['role']!==_0x7b4f('0x9b'))return;return _0x18e00f[_0x7b4f('0x9c')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x7b4f('0x33')](function(_0x464605){if(_['isEmpty'](_0x464605)){_0x577b6a[_0x7b4f('0x7e')]('i.ChatWebsiteId\x20IS\x20NULL');_0x260966['where'](_0x7b4f('0x9d'));}else{_0x577b6a['where'](_0x7b4f('0x9e'),_[_0x7b4f('0x39')](_0x464605,'id'));_0x260966['where'](_0x7b4f('0x9e'),_[_0x7b4f('0x39')](_0x464605,'id'));}});})[_0x7b4f('0x33')](function(){if(_0x18e00f['user'][_0x7b4f('0x9f')]===_0x7b4f('0x9b')&&!_0x4d437e&&!_0x18e00f[_0x7b4f('0x42')][_0x7b4f('0x7d')])return[];return db[_0x7b4f('0xa0')][_0x7b4f('0x42')](_0x577b6a[_0x7b4f('0xa1')](),_0x506e1f);})[_0x7b4f('0x33')](function(_0x398800){_0x492ade['count']=_0x398800[_0x7b4f('0x6c')];if(_0x492ade['count']===0x0)return[];return db[_0x7b4f('0xa0')][_0x7b4f('0x42')](_0x1e7afe['toString'](),_0x506e1f)[_0x7b4f('0x33')](function(_0x12174c){_0x34aa17=_['keyBy'](_0x12174c,'id');_0x506e1f=_[_0x7b4f('0xa2')](_0x506e1f,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x18e00f[_0x7b4f('0x42')][_0x7b4f('0x46')]){_0x2fdb69['attributes'][_0x7b4f('0x3a')](function(_0x30cddb){_0x260966[_0x7b4f('0x4d')]('i.'+_0x30cddb);});}else{_0x260966['field'](_0x7b4f('0x95'),_0x7b4f('0x64'));_0x260966[_0x7b4f('0x4d')](_0x7b4f('0xa3'),_0x7b4f('0xa4'));_0x260966[_0x7b4f('0x4d')]('a.mandatoryDisposition',_0x7b4f('0xa5'));_0x260966[_0x7b4f('0x4d')](_0x7b4f('0xa6'),_0x7b4f('0x97'));_0x260966[_0x7b4f('0x4d')]('i.*');_0x260966['field']('c.firstName',_0x7b4f('0xa7'));_0x260966[_0x7b4f('0x4d')](_0x7b4f('0xa8'),'Contact.lastName');_0x260966['field']('c.email',_0x7b4f('0xa9'));_0x260966[_0x7b4f('0x4d')]('c.phone',_0x7b4f('0xaa'));_0x260966[_0x7b4f('0x4d')](_0x7b4f('0xab'),_0x7b4f('0xac'));_0x260966[_0x7b4f('0x4d')]('c.fax','Contact.fax');_0x260966[_0x7b4f('0x4d')](_0x7b4f('0xad'),_0x7b4f('0xae'));_0x260966[_0x7b4f('0x4d')](_0x7b4f('0xaf'),'Owner.internal');_0x260966[_0x7b4f('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x2fdb69[_0x7b4f('0x2c')])_0x260966['limit'](_0x2fdb69['limit']);if(_0x2fdb69[_0x7b4f('0x2b')])_0x260966['offset'](_0x2fdb69[_0x7b4f('0x2b')]);return db['sequelize'][_0x7b4f('0x42')](_0x260966['toString'](),_0x506e1f);})[_0x7b4f('0x33')](function(_0x415f57){_0x1764cd['where'](_0x7b4f('0xb0'),_['map'](_0x415f57,'id'));return db[_0x7b4f('0xa0')][_0x7b4f('0x42')](_0x1764cd[_0x7b4f('0xa1')](),_0x506e1f)[_0x7b4f('0x33')](function(_0x4e8e8d){var _0x4f3248=_[_0x7b4f('0xb1')](_0x4e8e8d,'ChatInteractionId');var _0x7a64ec=[];_0x415f57['forEach'](function(_0x22115c){_0x7a64ec[_0x7b4f('0xb2')](updateChatInteraction(_0x22115c,_0x34aa17,_0x4f3248));});return BPromise[_0x7b4f('0xb3')](_0x7a64ec);});});})['then'](function(_0x374fb7){_0x492ade[_0x7b4f('0xb4')]=_0x374fb7;return _0x492ade;})[_0x7b4f('0x33')](respondWithFilteredResult(_0xf78c66,_0x2fdb69))['catch'](handleError(_0xf78c66,null));};exports[_0x7b4f('0xb5')]=function(_0x546571,_0x581338){var _0x1289e7={'raw':![],'where':{'id':_0x546571[_0x7b4f('0xb6')]['id']}},_0x59ad11={};_0x59ad11[_0x7b4f('0x41')]=_[_0x7b4f('0x43')](db[_0x7b4f('0x3e')]['rawAttributes']);_0x59ad11[_0x7b4f('0x42')]=_[_0x7b4f('0x43')](_0x546571[_0x7b4f('0x42')]);_0x59ad11[_0x7b4f('0x44')]=_[_0x7b4f('0x45')](_0x59ad11['model'],_0x59ad11[_0x7b4f('0x42')]);_0x1289e7[_0x7b4f('0x47')]=_[_0x7b4f('0x45')](_0x59ad11[_0x7b4f('0x41')],qs['fields'](_0x546571[_0x7b4f('0x42')][_0x7b4f('0x46')]));_0x1289e7['attributes']=_0x1289e7[_0x7b4f('0x47')][_0x7b4f('0x6c')]?_0x1289e7[_0x7b4f('0x47')]:_0x59ad11[_0x7b4f('0x41')];if(_0x546571[_0x7b4f('0x42')][_0x7b4f('0xb7')]){_0x1289e7[_0x7b4f('0xb8')]=[{'all':!![]}];}_0x1289e7=_[_0x7b4f('0xa2')]({},_0x1289e7,_0x546571[_0x7b4f('0xb9')]);return db[_0x7b4f('0x3e')][_0x7b4f('0x63')](_0x1289e7)[_0x7b4f('0x33')](handleEntityNotFound(_0x581338,null))['then'](respondWithResult(_0x581338,null))[_0x7b4f('0x3d')](handleError(_0x581338,null));};exports[_0x7b4f('0xba')]=function(_0x923363,_0x2591b8){return db[_0x7b4f('0x3e')]['create'](_0x923363[_0x7b4f('0x7a')],{})['then'](respondWithResult(_0x2591b8,0xc9))[_0x7b4f('0x3d')](handleError(_0x2591b8,null));};exports['update']=function(_0x2db955,_0x480ce7){if(_0x2db955[_0x7b4f('0x7a')]['id']){delete _0x2db955[_0x7b4f('0x7a')]['id'];}return db[_0x7b4f('0x3e')][_0x7b4f('0x63')]({'where':{'id':_0x2db955[_0x7b4f('0xb6')]['id']}})['then'](handleEntityNotFound(_0x480ce7,null))[_0x7b4f('0x33')](saveUpdates(_0x2db955[_0x7b4f('0x7a')],null))[_0x7b4f('0x33')](respondWithResult(_0x480ce7,null))[_0x7b4f('0x3d')](handleError(_0x480ce7,null));};exports[_0x7b4f('0x34')]=function(_0x448ae9,_0x18283c){return db[_0x7b4f('0x3e')]['find']({'where':{'id':_0x448ae9['params']['id']}})[_0x7b4f('0x33')](handleEntityNotFound(_0x18283c,null))[_0x7b4f('0x33')](removeEntity(_0x18283c,null))[_0x7b4f('0x3d')](handleError(_0x18283c,null));};exports[_0x7b4f('0xbb')]=function(_0x475105,_0x5a77ca){return db[_0x7b4f('0x3e')]['describe']()[_0x7b4f('0x33')](respondWithResult(_0x5a77ca,null))[_0x7b4f('0x3d')](handleError(_0x5a77ca,null));};exports[_0x7b4f('0xbc')]=function(_0x56bfe7,_0x2720f7){var _0x2ea60c=_0x56bfe7[_0x7b4f('0xb6')]['id'];var _0x376631;var _0x7c9ce6;var _0x512d20;return db[_0x7b4f('0x3e')][_0x7b4f('0xbd')]({'where':{'id':_0x2ea60c}})[_0x7b4f('0x33')](function(_0x393fc2){_0x376631=_0x393fc2;return db[_0x7b4f('0xbe')][_0x7b4f('0xbd')]({'where':{'id':_0x393fc2[_0x7b4f('0x7d')]},'attributes':['id',_0x7b4f('0xbf'),_0x7b4f('0xc0')],'raw':!![]});})[_0x7b4f('0x33')](function(_0x3d77cd){if(_0x3d77cd&&_0x3d77cd['vidaooApiKey']&&_0x3d77cd[_0x7b4f('0xc0')]){_0x7c9ce6=_0x3d77cd;var _0x5ecd68={'rejectUnauthorized':![],'method':_0x7b4f('0xc1'),'uri':_0x7b4f('0xc2'),'headers':{'X-APIKEY':_0x3d77cd[_0x7b4f('0xbf')]},'body':{'name':_0x7b4f('0xc3')+_0x2ea60c},'redirect':_0x7b4f('0xc4'),'json':!![]};return rp(_0x5ecd68);}else{throw new db['Sequelize'][(_0x7b4f('0xc5'))](_0x7b4f('0xc6'));}})['then'](function(_0x192349){_0x512d20=_0x192349;if(_0x512d20['id']){var _0x150cdc={'body':_0x512d20['join_url'],'ChatWebsiteId':_0x7c9ce6['id'],'ChatInteractionId':_0x376631['id'],'direction':_0x7b4f('0xc7'),'UserId':_0x56bfe7[_0x7b4f('0x9c')]['id']};return db[_0x7b4f('0xc8')][_0x7b4f('0xba')](_0x150cdc,{});}else{throw new db['Sequelize'][(_0x7b4f('0xc5'))](_0x7b4f('0xc9'));}})[_0x7b4f('0x33')](function(){return _0x376631[_0x7b4f('0xca')]({'vidaooSessionId':_0x512d20['id']});})[_0x7b4f('0x33')](respondWithResult(_0x2720f7,null))[_0x7b4f('0x3d')](handleError(_0x2720f7,null));};exports[_0x7b4f('0xcb')]=function(_0x4287fb,_0x436e19){if(_0x4287fb[_0x7b4f('0x7a')]['id']){delete _0x4287fb[_0x7b4f('0x7a')]['id'];}return db['ChatInteraction'][_0x7b4f('0x63')]({'where':{'id':_0x4287fb['params']['id']}})[_0x7b4f('0x33')](handleEntityNotFound(_0x436e19,null))[_0x7b4f('0x33')](saveUpdates(_0x4287fb[_0x7b4f('0x7a')],null))['then'](respondWithResult(_0x436e19,null))['catch'](handleError(_0x436e19,null));};exports['abandon']=function(_0x5dd5f8,_0x281ff2,_0x285c98){if(_0x5dd5f8[_0x7b4f('0x7a')]['id']){delete _0x5dd5f8[_0x7b4f('0x7a')]['id'];}return db[_0x7b4f('0x3e')]['find']({'where':{'id':_0x5dd5f8['params']['id']}})[_0x7b4f('0x33')](function(_0x225f89){if(!_0x225f89){logger[_0x7b4f('0x24')](_0x7b4f('0xcc'),_0x7b4f('0xcd'),0x194,'entity\x20not\x20found');_0x281ff2[_0x7b4f('0x36')](0x194);}else{if(_0x225f89[_0x7b4f('0x79')]){throw new db[(_0x7b4f('0x91'))][(_0x7b4f('0xc5'))](_0x7b4f('0xce'));}}return _0x225f89;})['then'](function(_0x5e45d3){if(_0x5e45d3){return _0x5e45d3[_0x7b4f('0x32')]({'closed':_0x5dd5f8[_0x7b4f('0x7a')]['closed'],'disposition':_0x5dd5f8[_0x7b4f('0x7a')][_0x7b4f('0xcf')]})[_0x7b4f('0x33')](function(_0x37dabf){return _0x37dabf;});}})['then'](function(_0x268c17){return respondWithRpcPromise(_0x7b4f('0xd0'),_0x7b4f('0xcd'),_0x5dd5f8[_0x7b4f('0x7a')],client9004);})[_0x7b4f('0x33')](respondWithResult(_0x281ff2,null))[_0x7b4f('0x3d')](handleError(_0x281ff2,null));};exports[_0x7b4f('0xd1')]=function(_0x392637,_0x15206b,_0x178b98){_0x392637['body'][_0x7b4f('0x37')]=_0x392637['file']['originalname'];_0x392637[_0x7b4f('0x7a')][_0x7b4f('0xd2')]=_0x392637[_0x7b4f('0xd3')][_0x7b4f('0xd4')];_0x392637[_0x7b4f('0x7a')][_0x7b4f('0x40')]=_0x392637[_0x7b4f('0xd3')][_0x7b4f('0xd5')];return db['Attachment'][_0x7b4f('0xba')](_0x392637[_0x7b4f('0x7a')])[_0x7b4f('0x33')](respondWithResult(_0x15206b,0xc9))[_0x7b4f('0x3d')](handleError(_0x15206b,null));};exports[_0x7b4f('0xd6')]=function(_0x5820d1,_0x16df3a,_0x3cf7b3){return db[_0x7b4f('0x3e')][_0x7b4f('0xbd')]({'where':{'id':_0x5820d1[_0x7b4f('0xb6')]['id']},'raw':!![]})[_0x7b4f('0x33')](handleEntityNotFound(_0x16df3a,null))[_0x7b4f('0x33')](function(_0x27aca9){if(_0x27aca9){if(_0x27aca9[_0x7b4f('0xd7')]){return _0x16df3a['status'](0x193)[_0x7b4f('0x29')]({'status':0x193,'message':'Unauthorized'});}return db[_0x7b4f('0xd8')][_0x7b4f('0xbd')]({'where':{'id':_0x5820d1[_0x7b4f('0x42')][_0x7b4f('0xd9')]},'raw':!![]})[_0x7b4f('0x33')](handleEntityNotFound(_0x16df3a,null));}})['then'](function(_0x34836f){if(_0x34836f){return _0x16df3a[_0x7b4f('0xda')](path[_0x7b4f('0xdb')](config['root'],_0x7b4f('0xdc'),_0x34836f[_0x7b4f('0xd2')]));}})[_0x7b4f('0x3d')](handleError(_0x16df3a,null));};exports['close']=function(_0x2b1805,_0x1fbc3b){var _0x3b29b2=null;var _0x2fff60=null;var _0xdd2bc4=null;var _0x4a0de4=null;if(_0x2b1805['body']['id']){delete _0x2b1805['body']['id'];}if(_0x2b1805[_0x7b4f('0x7a')][_0x7b4f('0xdd')]){_0x4a0de4=path[_0x7b4f('0xdb')](config[_0x7b4f('0xde')],_0x7b4f('0xdf'),util['format'](_0x7b4f('0xe0'),Date[_0x7b4f('0xe1')]()));_0x2b1805[_0x7b4f('0x7a')][_0x7b4f('0xe2')]=_0x4a0de4;}return db[_0x7b4f('0x3e')][_0x7b4f('0x63')]({'where':{'id':_0x2b1805[_0x7b4f('0xb6')]['id']},'include':[{'model':db[_0x7b4f('0xc8')],'as':_0x7b4f('0xe3'),'include':[{'model':db[_0x7b4f('0x76')],'as':'User'}]}]})[_0x7b4f('0x33')](handleEntityNotFound(_0x1fbc3b,null))[_0x7b4f('0x33')](saveUpdates(_0x2b1805[_0x7b4f('0x7a')],null))[_0x7b4f('0x33')](function(_0x2fe7a4){if(_0x2fe7a4){_0x3b29b2=_0x2fe7a4;return db[_0x7b4f('0xbe')][_0x7b4f('0x63')]({'where':{'id':_0x3b29b2[_0x7b4f('0x7d')]}});}})[_0x7b4f('0x33')](function(_0x44d2ec){if(_0x44d2ec){_0xdd2bc4=_0x44d2ec;return db[_0x7b4f('0xe4')][_0x7b4f('0x63')]({'where':{'id':_0x3b29b2[_0x7b4f('0x6f')]}});}})[_0x7b4f('0x33')](function(_0x5cf20d){if(_0x5cf20d){_0x2fff60=_0x5cf20d;if(_0x4a0de4){var _0xac9aca=null;for(var _0xb9a23b=0x1;_0xb9a23b<_0x3b29b2['Messages'][_0x7b4f('0x6c')];++_0xb9a23b){_0xac9aca=_0x3b29b2['Messages'][_0xb9a23b];var _0x4f1db4=_0xac9aca[_0x7b4f('0x79')]?util['format']('%s%d',_0xdd2bc4[_0x7b4f('0xe5')],_0xac9aca[_0x7b4f('0x79')]):'System';var _0x4de034=_0x2b1805[_0x7b4f('0x7a')][_0x7b4f('0xe6')]||util['format'](_0x7b4f('0xe7'),_0x7b4f('0xe8'),_0xac9aca[_0x7b4f('0x6f')]);switch(_0xdd2bc4[_0x7b4f('0xe9')]){case'website_alias':_0x4f1db4=_0xac9aca['UserId']?util['format'](_0x7b4f('0xe7'),_0xdd2bc4[_0x7b4f('0xe5')],_0xac9aca['UserId']):_0x7b4f('0xea');break;case _0x7b4f('0xeb'):_0x4f1db4=_0xac9aca['UserId']?_0xac9aca['User']['alias']||_0xac9aca[_0x7b4f('0x76')][_0x7b4f('0xec')]:_0x7b4f('0xea');break;case _0x7b4f('0xed'):_0x4f1db4=_0xac9aca[_0x7b4f('0x79')]?_0xac9aca[_0x7b4f('0x76')][_0x7b4f('0xec')]:_0x7b4f('0xea');break;default:_0x4f1db4=_0xac9aca[_0x7b4f('0x79')]?util[_0x7b4f('0xee')](_0x7b4f('0xe7'),_0xdd2bc4[_0x7b4f('0xe5')],_0xac9aca[_0x7b4f('0x79')]):_0x7b4f('0xea');}var _0x177f75=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0xac9aca[_0x7b4f('0x7f')])['format'](_0x7b4f('0xef')),_0xac9aca[_0x7b4f('0xf0')]==='in'?_0x4de034:_0x4f1db4,_0xac9aca[_0x7b4f('0x7a')]);if(!_0xac9aca[_0x7b4f('0xf1')]){fs[_0x7b4f('0xf2')](_0x4a0de4,_0x177f75);}}return db[_0x7b4f('0xf3')][_0x7b4f('0xbd')]({'where':{'service':!![]},'include':[{'model':db[_0x7b4f('0xf4')],'as':_0x7b4f('0xf5'),'raw':!![]}]});}}})['then'](function(_0x1b2265){if(_0x1b2265&&_0x1b2265[_0x7b4f('0xf5')]&&_0x2b1805[_0x7b4f('0x7a')]){var _0x308001={'tls':{'rejectUnauthorized':![]}};if(_0x1b2265[_0x7b4f('0xf5')]['service']){_0x308001[_0x7b4f('0xf6')]=_0x1b2265[_0x7b4f('0xf5')][_0x7b4f('0xf6')];}else{_0x308001[_0x7b4f('0xf7')]=_0x1b2265[_0x7b4f('0xf5')]['host'];_0x308001['port']=_0x1b2265[_0x7b4f('0xf5')][_0x7b4f('0xf8')];_0x308001['secure']=_0x1b2265[_0x7b4f('0xf5')]['secure'];}if(_0x1b2265[_0x7b4f('0xf5')][_0x7b4f('0xf9')]){_0x308001[_0x7b4f('0xfa')]={'user':_0x1b2265[_0x7b4f('0xf5')][_0x7b4f('0x9c')],'pass':_0x1b2265[_0x7b4f('0xf5')][_0x7b4f('0xfb')]};}return respondWithRpcPromise(_0x7b4f('0xfc'),'sendMail',{'account':_0x308001,'message':{'from':util['format'](_0x7b4f('0xfd'),_0x1b2265[_0x7b4f('0x37')],_0x1b2265[_0x7b4f('0xfe')]||_0x1b2265[_0x7b4f('0xf5')][_0x7b4f('0x9c')]),'to':_0x2b1805[_0x7b4f('0x7a')][_0x7b4f('0xdd')],'subject':_0x7b4f('0xff'),'text':util[_0x7b4f('0xee')](_0x7b4f('0x100'),_0x2b1805[_0x7b4f('0x7a')]['mailTranscript']),'attachments':[{'path':_0x4a0de4}]}})[_0x7b4f('0x33')](function(){return _0x3b29b2;})[_0x7b4f('0x3d')](function(_0x16138e){console[_0x7b4f('0x24')](_0x16138e);});}else{return _0x3b29b2;}})[_0x7b4f('0x33')](respondWithStatusCode(_0x1fbc3b,0xc8))[_0x7b4f('0x3d')](handleError(_0x1fbc3b,null));};exports[_0x7b4f('0x101')]=function(_0x375663,_0xf1a9fc,_0x56e5ac){return db[_0x7b4f('0xc8')][_0x7b4f('0x63')]({'where':{'id':_0x375663[_0x7b4f('0xb6')]['id']}})['then'](handleEntityNotFound(_0xf1a9fc,null))[_0x7b4f('0x33')](function(_0x233583){if(_0x233583){return _0x233583[_0x7b4f('0x101')](_0x375663[_0x7b4f('0x7a')][_0x7b4f('0x102')],_[_0x7b4f('0x103')](_0x375663[_0x7b4f('0x7a')],[_0x7b4f('0x102'),'id'])||{});}})[_0x7b4f('0x33')](respondWithResult(_0xf1a9fc,null))[_0x7b4f('0x3d')](handleError(_0xf1a9fc,null));};exports[_0x7b4f('0x104')]=function(_0x2472a4,_0xe49e94,_0x5524db){var _0x236287={'raw':![],'where':{}};var _0x4f577b={};var _0x4f9306={'count':0x0,'rows':[]};return db[_0x7b4f('0x3e')][_0x7b4f('0xbd')]({'where':{'id':_0x2472a4[_0x7b4f('0xb6')]['id']}})[_0x7b4f('0x33')](handleEntityNotFound(_0xe49e94,null))['then'](function(_0xf374e8){if(_0xf374e8){_0x4f577b[_0x7b4f('0x41')]=_['keys'](db[_0x7b4f('0xc8')][_0x7b4f('0x3f')]);_0x4f577b[_0x7b4f('0x42')]=_['keys'](_0x2472a4[_0x7b4f('0x42')]);_0x4f577b[_0x7b4f('0x44')]=_['intersection'](_0x4f577b[_0x7b4f('0x41')],_0x4f577b[_0x7b4f('0x42')]);_0x236287['attributes']=_[_0x7b4f('0x45')](_0x4f577b[_0x7b4f('0x41')],qs[_0x7b4f('0x46')](_0x2472a4[_0x7b4f('0x42')]['fields']));_0x236287[_0x7b4f('0x47')]=_0x236287['attributes'][_0x7b4f('0x6c')]?_0x236287[_0x7b4f('0x47')]:_0x4f577b[_0x7b4f('0x41')];if(!_0x2472a4['query'][_0x7b4f('0x48')](_0x7b4f('0x49'))){_0x236287[_0x7b4f('0x2c')]=qs[_0x7b4f('0x2c')](_0x2472a4[_0x7b4f('0x42')][_0x7b4f('0x2c')]);_0x236287[_0x7b4f('0x2b')]=qs[_0x7b4f('0x2b')](_0x2472a4[_0x7b4f('0x42')][_0x7b4f('0x2b')]);}_0x236287['order']=qs['sort'](_0x2472a4[_0x7b4f('0x42')][_0x7b4f('0x4a')]);_0x236287['where']=qs[_0x7b4f('0x44')](_[_0x7b4f('0x4b')](_0x2472a4[_0x7b4f('0x42')],_0x4f577b[_0x7b4f('0x44')]));_0x236287[_0x7b4f('0x7e')][_0x7b4f('0x105')]=_0xf374e8['id'];if(_0x2472a4[_0x7b4f('0x42')]['filter']){_0x236287[_0x7b4f('0x7e')]=_[_0x7b4f('0xa2')](_0x236287[_0x7b4f('0x7e')],{'$or':_['map'](_0x236287[_0x7b4f('0x47')],function(_0x20d775){var _0x92aa08={};_0x92aa08[_0x20d775]={'$like':'%'+_0x2472a4[_0x7b4f('0x42')][_0x7b4f('0x8a')]+'%'};return _0x92aa08;})});}if(_0x2472a4[_0x7b4f('0x42')][_0x7b4f('0x80')]){var _0x309f91=_0x2472a4[_0x7b4f('0x42')][_0x7b4f('0x80')][_0x7b4f('0x6b')](',');var _0x83d860={};_0x83d860[_0x309f91[0x0]]={'$gte':moment(_0x309f91[0x1])[_0x7b4f('0xee')](_0x7b4f('0x106'))};_0x236287['where']=_[_0x7b4f('0xa2')](_0x236287[_0x7b4f('0x7e')],_0x83d860);}_0x236287=_['merge']({},_0x236287,_0x2472a4[_0x7b4f('0xb9')]);return db['ChatMessage'][_0x7b4f('0x2a')]({'where':_0x236287[_0x7b4f('0x7e')]})['then'](function(_0x3bf807){_0x4f9306[_0x7b4f('0x2a')]=_0x3bf807;if(_0x2472a4[_0x7b4f('0x42')][_0x7b4f('0xb7')]){_0x236287['include']=[{'all':!![]}];}return db[_0x7b4f('0xc8')][_0x7b4f('0x107')](_0x236287);})[_0x7b4f('0x33')](function(_0x1db903){_0x4f9306[_0x7b4f('0xb4')]=_0x1db903;return _0x4f9306;});}})['then'](respondWithFilteredResult(_0xe49e94,_0x236287))[_0x7b4f('0x3d')](handleError(_0xe49e94,null));};exports[_0x7b4f('0x108')]=function(_0x27057f,_0x5ca4b8,_0x152cbe){var _0x2f5d14={'where':{}},_0x34a3bf={},_0x7e7b78={'count':0x0,'rows':[]};return db[_0x7b4f('0x3e')]['findOne']({'where':{'id':_0x27057f[_0x7b4f('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5ca4b8,null))[_0x7b4f('0x33')](function(_0x35190b){if(_0x35190b){_0x34a3bf[_0x7b4f('0x41')]=_[_0x7b4f('0x43')](db[_0x7b4f('0xc8')]['rawAttributes']);_0x34a3bf[_0x7b4f('0x42')]=_['keys'](_0x27057f[_0x7b4f('0x42')]);_0x34a3bf[_0x7b4f('0x44')]=_[_0x7b4f('0x45')](_0x34a3bf['model'],_0x34a3bf[_0x7b4f('0x42')]);_0x2f5d14[_0x7b4f('0x47')]=_[_0x7b4f('0x45')](_0x34a3bf[_0x7b4f('0x41')],qs[_0x7b4f('0x46')](_0x27057f['query'][_0x7b4f('0x46')]));_0x2f5d14['attributes']=_0x2f5d14[_0x7b4f('0x47')][_0x7b4f('0x6c')]?_0x2f5d14[_0x7b4f('0x47')]:_0x34a3bf['model'];if(!_0x27057f[_0x7b4f('0x42')][_0x7b4f('0x48')](_0x7b4f('0x49'))){_0x2f5d14['limit']=qs[_0x7b4f('0x2c')](_0x27057f[_0x7b4f('0x42')][_0x7b4f('0x2c')]);_0x2f5d14[_0x7b4f('0x2b')]=qs['offset'](_0x27057f[_0x7b4f('0x42')][_0x7b4f('0x2b')]);}_0x2f5d14[_0x7b4f('0x96')]=qs[_0x7b4f('0x4a')](_0x27057f[_0x7b4f('0x42')][_0x7b4f('0x4a')]);_0x2f5d14['where']=qs[_0x7b4f('0x44')](_[_0x7b4f('0x4b')](_0x27057f[_0x7b4f('0x42')],_0x34a3bf[_0x7b4f('0x44')]));_0x2f5d14['where'][_0x7b4f('0x105')]=_0x35190b['id'];if(_0x27057f[_0x7b4f('0x42')][_0x7b4f('0x8a')]){_0x2f5d14[_0x7b4f('0x7e')]=_['merge'](_0x2f5d14[_0x7b4f('0x7e')],{'$or':_[_0x7b4f('0x39')](_0x2f5d14[_0x7b4f('0x47')],function(_0x4e6f41){var _0x53201d={};_0x53201d[_0x4e6f41]={'$like':'%'+_0x27057f[_0x7b4f('0x42')][_0x7b4f('0x8a')]+'%'};return _0x53201d;})});}_0x2f5d14[_0x7b4f('0x7e')][_0x7b4f('0xf1')]=![];if(_0x27057f[_0x7b4f('0x42')]['id']){_0x2f5d14[_0x7b4f('0x7e')]['id']={'$gt':_0x27057f['query']['id']};}_0x2f5d14=_['merge']({},_0x2f5d14,_0x27057f[_0x7b4f('0xb9')]);return db['ChatMessage'][_0x7b4f('0x2a')]({'where':_0x2f5d14[_0x7b4f('0x7e')]})[_0x7b4f('0x33')](function(_0x1d0395){_0x7e7b78[_0x7b4f('0x2a')]=_0x1d0395;_0x2f5d14[_0x7b4f('0xb8')]=[];if(_0x27057f[_0x7b4f('0x42')]['includeAgent']){_0x2f5d14['include'][_0x7b4f('0xb2')]({'model':db[_0x7b4f('0x76')],'as':_0x7b4f('0x76'),'attributes':['id',_0x7b4f('0xec'),_0x7b4f('0x109')]});}if(_0x27057f[_0x7b4f('0x42')][_0x7b4f('0xb7')]){_0x2f5d14['include']=[{'all':!![]}];}return db[_0x7b4f('0xc8')][_0x7b4f('0x107')](_0x2f5d14);})[_0x7b4f('0x33')](function(_0x1634e5){_0x7e7b78['rows']=_0x1634e5;return _0x7e7b78;});}})[_0x7b4f('0x33')](respondWithFilteredResult(_0x5ca4b8,_0x2f5d14))['catch'](handleError(_0x5ca4b8,null));};exports[_0x7b4f('0x10a')]=function(_0x377b7a,_0x24080c,_0x4729b5){return db['ChatInteraction'][_0x7b4f('0x63')]({'where':{'id':_0x377b7a['params']['id']}})[_0x7b4f('0x33')](handleEntityNotFound(_0x24080c,null))[_0x7b4f('0x33')](function(_0x161edd){if(_0x161edd){return _0x161edd[_0x7b4f('0x10b')](_0x377b7a[_0x7b4f('0x7a')][_0x7b4f('0x102')],_[_0x7b4f('0x103')](_0x377b7a[_0x7b4f('0x7a')],[_0x7b4f('0x102'),'id'])||{})[_0x7b4f('0x10c')](function(){return db[_0x7b4f('0x73')]['findAll']({'attributes':['id',_0x7b4f('0x37'),_0x7b4f('0x4e')],'where':{'id':_0x377b7a[_0x7b4f('0x7a')][_0x7b4f('0x102')]}});})[_0x7b4f('0x33')](function(_0x45f291){socket[_0x7b4f('0x10d')](_0x7b4f('0x10e'),{'id':Number(_0x377b7a['params']['id']),'tags':_0x45f291||[]});return{'id':Number(_0x377b7a['params']['id']),'tags':_0x45f291||[]};});}})[_0x7b4f('0x33')](respondWithResult(_0x24080c,null))[_0x7b4f('0x3d')](handleError(_0x24080c,null));};exports[_0x7b4f('0x10f')]=function(_0x23af31,_0x354b40,_0xe28f3){return db[_0x7b4f('0x3e')]['find']({'where':{'id':_0x23af31['params']['id']}})[_0x7b4f('0x33')](handleEntityNotFound(_0x354b40,null))['then'](function(_0x196ef8){if(_0x196ef8){return _0x196ef8[_0x7b4f('0x10f')](_0x23af31[_0x7b4f('0x42')]['ids']);}})[_0x7b4f('0x33')](respondWithStatusCode(_0x354b40,null))[_0x7b4f('0x3d')](handleError(_0x354b40,null));};exports[_0x7b4f('0xda')]=function(_0x4ab4ab,_0x345d70){var _0x51f1f7=moment()[_0x7b4f('0x110')]()[_0x7b4f('0xa1')]();var _0x47f164=path['join'](config[_0x7b4f('0xde')],_0x7b4f('0x111'),_0x7b4f('0x112'),_0x7b4f('0x113'));var _0x1b1ddc=path['join'](config[_0x7b4f('0xde')],_0x7b4f('0x111'),_0x7b4f('0x112'),_0x7b4f('0x114'));var _0x38faae=path['join'](_0x47f164,_0x51f1f7);var _0x1fe7bd=util[_0x7b4f('0xee')]('transcript-%d-%s.zip',_0x4ab4ab[_0x7b4f('0xb6')]['id'],_0x51f1f7);var _0x28e0fe=path[_0x7b4f('0xdb')](_0x47f164,_0x1fe7bd);var _0x32cc70=[];_0x32cc70['push']({'model':db[_0x7b4f('0x76')],'as':'User','attributes':['id',_0x7b4f('0xec')],'raw':!![]});_0x32cc70[_0x7b4f('0xb2')]({'model':db[_0x7b4f('0xe4')],'as':_0x7b4f('0x69'),'attributes':['id',_0x7b4f('0x115'),_0x7b4f('0x116')],'raw':!![]});if(_0x4ab4ab[_0x7b4f('0x42')]['attachments']){_0x32cc70[_0x7b4f('0xb2')]({'model':db[_0x7b4f('0xd8')],'as':'Attachment','raw':!![]});}var _0x23ee1b=[{'model':db[_0x7b4f('0xc8')],'as':_0x7b4f('0xe3'),'attributes':['id',_0x7b4f('0x7a'),_0x7b4f('0x7f'),_0x7b4f('0xf0'),_0x7b4f('0xf1'),'read'],'include':_0x32cc70}];_0x23ee1b[_0x7b4f('0xb2')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id','name']});_0x23ee1b['push']({'model':db[_0x7b4f('0x76')],'as':_0x7b4f('0x117'),'attributes':['id',_0x7b4f('0xec')]});return db[_0x7b4f('0x3e')][_0x7b4f('0x63')]({'where':{'id':_0x4ab4ab[_0x7b4f('0xb6')]['id']},'include':_0x23ee1b})[_0x7b4f('0x33')](handleEntityNotFound(_0x345d70,null))[_0x7b4f('0x33')](function(_0x421e51){if(_0x421e51){var _0x2c6d0e=_0x421e51['get']({'plain':!![]});fs['mkdirSync'](_0x38faae);var _0x5ab74d={'format':'A4','border':_0x7b4f('0x118'),'header':{'height':_0x7b4f('0x119'),'contents':{'first':_0x7b4f('0x11a')}},'footer':{'height':_0x7b4f('0x11b'),'contents':{'default':util[_0x7b4f('0xee')](_0x7b4f('0x11c'),util[_0x7b4f('0xee')](_0x7b4f('0x11d'),_0x7b4f('0x11e'),_0x2c6d0e['id']),moment()[_0x7b4f('0xee')]('YYYY-MM-DD')[_0x7b4f('0xa1')]())}}};var _0x5c5245={'channel':'Chat','account':_0x2c6d0e[_0x7b4f('0x11f')][_0x7b4f('0x37')],'agent':_0x2c6d0e[_0x7b4f('0x117')]?_0x2c6d0e[_0x7b4f('0x117')][_0x7b4f('0xec')]:_0x7b4f('0x120'),'createdAt':moment(_0x2c6d0e[_0x7b4f('0x7f')])['format'](_0x7b4f('0x106'))[_0x7b4f('0xa1')](),'closedAt':_0x2c6d0e[_0x7b4f('0xd7')]?moment(_0x2c6d0e[_0x7b4f('0x121')])[_0x7b4f('0xee')](_0x7b4f('0x106'))['toString']():'','disposition':_0x2c6d0e[_0x7b4f('0xcf')],'chatInfo':{'browser':_0x2c6d0e[_0x7b4f('0x122')],'os':_0x2c6d0e[_0x7b4f('0x123')],'referer':_0x2c6d0e[_0x7b4f('0x124')],'customerIp':_0x2c6d0e['customerIp'],'customerPort':_0x2c6d0e[_0x7b4f('0x125')]?_0x2c6d0e[_0x7b4f('0x125')]:'N.A.'},'messages':_(_0x2c6d0e['Messages'])['tail']()[_0x7b4f('0x8a')]({'secret':![]})[_0x7b4f('0x39')](function(_0x1b28cb){if(_0x1b28cb[_0x7b4f('0xd8')]){var _0x30cfca=path[_0x7b4f('0xdb')](_0x1b1ddc,_0x1b28cb[_0x7b4f('0xd8')][_0x7b4f('0xd2')]);if(fs[_0x7b4f('0x126')](_0x30cfca)){fs['createReadStream'](_0x30cfca)['pipe'](fs['createWriteStream'](path[_0x7b4f('0xdb')](_0x38faae,_0x1b28cb[_0x7b4f('0xd8')][_0x7b4f('0xd2')])));}}return{'date':moment(_0x1b28cb['createdAt'])[_0x7b4f('0xee')](_0x7b4f('0x106'))['toString'](),'sender':_0x1b28cb['direction']===_0x7b4f('0xc7')?_0x1b28cb[_0x7b4f('0x76')]?_0x1b28cb[_0x7b4f('0x76')][_0x7b4f('0xec')]:_0x7b4f('0xea'):_0x1b28cb[_0x7b4f('0x69')]['firstName']+(_0x1b28cb['Contact']['lastName']?'\x20'+_0x1b28cb[_0x7b4f('0x69')][_0x7b4f('0x116')]:''),'body':_0x1b28cb[_0x7b4f('0xd8')]?_0x1b28cb['Attachment']['basename']:_0x1b28cb[_0x7b4f('0x7a')],'direction':_0x1b28cb[_0x7b4f('0xf0')]==='out'?'A':'C','secret':_0x1b28cb[_0x7b4f('0xf1')],'read':_0x1b28cb[_0x7b4f('0x85')],'attachment':_0x1b28cb['Attachment']};})[_0x7b4f('0x65')]()};return ejs[_0x7b4f('0x127')](path[_0x7b4f('0xdb')](config[_0x7b4f('0xde')],'server',_0x7b4f('0x128'),_0x7b4f('0x129')),{'interaction':_0x5c5245})['then'](function(_0x2d3976){return new BPromise(function(_0x17f930,_0x5ea204){pdf[_0x7b4f('0xba')](_0x2d3976,_0x5ab74d)['toFile'](path['join'](_0x38faae,_0x7b4f('0x12a')+_0x2c6d0e['id']+'-'+_0x51f1f7+_0x7b4f('0x12b')),function(_0x2164d9,_0x44c9ad){if(_0x2164d9)return _0x5ea204(_0x2164d9);_0x17f930(_0x44c9ad);});});})[_0x7b4f('0x33')](function(){return new BPromise(function(_0x2622a8,_0x4ea98b){zipdir(_0x38faae,{'saveTo':_0x28e0fe},function(_0x2b10b6,_0x1c3d25){if(_0x2b10b6)return _0x4ea98b(_0x2b10b6);return _0x2622a8(_0x1c3d25);});})[_0x7b4f('0x33')](function(){return new BPromise(function(_0x4b570b,_0x4310bb){rimraf(_0x38faae,function(_0x102cd9){if(_0x102cd9)_0x4310bb(_0x102cd9);return _0x4b570b();});});})[_0x7b4f('0x33')](function(){return _0x345d70[_0x7b4f('0xda')](_0x28e0fe,_0x1fe7bd,function(_0x306d66){if(_0x306d66){console[_0x7b4f('0x12c')](_0x7b4f('0x12d'),_0x306d66);}else{fs[_0x7b4f('0x12e')](_0x28e0fe);}});});});}else{return _0x345d70[_0x7b4f('0x36')](0xc8);}})[_0x7b4f('0x3d')](handleError(_0x345d70,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a225467..24e07f9 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 _0xc6df=['emit','catch','hasOwnProperty','hook','exports','ChatInteraction','../../mysqldb','save','update','remove','getUsers','setDataValue','Users','findAll','then','length'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0xc6df,0x115));var _0xfc6d=function(_0x2aafad,_0x55ca9a){_0x2aafad=_0x2aafad-0x0;var _0x40cf4a=_0xc6df[_0x2aafad];return _0x40cf4a;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0xfc6d('0x0')];var ChatMessage=require(_0xfc6d('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfc6d('0x2'),'afterUpdate':_0xfc6d('0x3'),'afterDestroy':_0xfc6d('0x4')};function emitEvent(_0x1e23a6){return function(_0x3f5725,_0x4539df,_0x3ac0ce){_0x3f5725[_0xfc6d('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x33714f){_0x3f5725[_0xfc6d('0x6')](_0xfc6d('0x7'),_0x33714f['map'](function(_0x51ccc3){return{'id':_0x51ccc3['id']};}));return ChatMessage[_0xfc6d('0x8')]({'where':{'ChatInteractionId':_0x3f5725['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfc6d('0x9')](function(_0x48a3d2){_0x3f5725[_0xfc6d('0x6')]('unreadMessages',_0x48a3d2[_0xfc6d('0xa')]);ChatInteractionEvents['emit'](_0x1e23a6+':'+_0x3f5725['id'],_0x3f5725);ChatInteractionEvents[_0xfc6d('0xb')](_0x1e23a6,_0x3f5725);_0x3ac0ce(null);})[_0xfc6d('0xc')](_0x3ac0ce(null));};}for(var e in events){if(events[_0xfc6d('0xd')](e)){var event=events[e];ChatInteraction[_0xfc6d('0xe')](e,emitEvent(event));}}module[_0xfc6d('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xe353=['emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length'];(function(_0x44bb70,_0x28d7e1){var _0x171198=function(_0x4f218e){while(--_0x4f218e){_0x44bb70['push'](_0x44bb70['shift']());}};_0x171198(++_0x28d7e1);}(_0xe353,0xdc));var _0x3e35=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xe353[_0x4c12ec];return _0x3ae42c;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x3e35('0x0'))['db'][_0x3e35('0x1')];var ChatMessage=require(_0x3e35('0x0'))['db'][_0x3e35('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3e35('0x3')](0x0);var events={'afterCreate':_0x3e35('0x4'),'afterUpdate':_0x3e35('0x5'),'afterDestroy':_0x3e35('0x6')};function emitEvent(_0x619170){return function(_0x1f0e46,_0xfd42d2,_0x487d81){_0x1f0e46[_0x3e35('0x7')]({'attributes':['id'],'raw':!![]})[_0x3e35('0x8')](function(_0x119946){_0x1f0e46['setDataValue'](_0x3e35('0x9'),_0x119946['map'](function(_0xe156a){return{'id':_0xe156a['id']};}));return ChatMessage[_0x3e35('0xa')]({'where':{'ChatInteractionId':_0x1f0e46['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3e35('0x8')](function(_0x260262){_0x1f0e46[_0x3e35('0xb')](_0x3e35('0xc'),_0x260262[_0x3e35('0xd')]);ChatInteractionEvents[_0x3e35('0xe')](_0x619170+':'+_0x1f0e46['id'],_0x1f0e46);ChatInteractionEvents[_0x3e35('0xe')](_0x619170,_0x1f0e46);_0x487d81(null);})['catch'](_0x487d81(null));};}for(var e in events){if(events[_0x3e35('0xf')](e)){var event=events[e];ChatInteraction[_0x3e35('0x10')](e,emitEvent(event));}}module[_0x3e35('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 a78050d..4339764 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 _0x871c=['../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf'];(function(_0x5d90b8,_0x528b3a){var _0x5712b3=function(_0x478049){while(--_0x478049){_0x5d90b8['push'](_0x5d90b8['shift']());}};_0x5712b3(++_0x528b3a);}(_0x871c,0x108));var _0xc871=function(_0x3ed469,_0x52de95){_0x3ed469=_0x3ed469-0x0;var _0x4aa933=_0x871c[_0x3ed469];return _0x4aa933;};'use strict';var _=require(_0xc871('0x0'));var util=require(_0xc871('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc871('0x2'));var BPromise=require(_0xc871('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc871('0x4'));var rimraf=require(_0xc871('0x5'));var config=require(_0xc871('0x6'));var attributes=require(_0xc871('0x7'));module['exports']=function(_0x53897a,_0x433a84){return _0x53897a[_0xc871('0x8')](_0xc871('0x9'),attributes,{'tableName':_0xc871('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5548d2,_0x109276,_0x425bb6){if(_0x5548d2['changed']('closed')){_0x5548d2[_0xc871('0xb')]=moment()[_0xc871('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x425bb6(null,_0x5548d2);}},'charset':_0xc871('0xd'),'collate':_0xc871('0xe')});}; \ No newline at end of file +var _0x1994=['utf8mb4_unicode_ci','lodash','api','path','exports','define','ChatInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x1994,0x85));var _0x4199=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1994[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4199('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4199('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4199('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x4199('0x3')]=function(_0x556dad,_0x54cb50){return _0x556dad[_0x4199('0x4')](_0x4199('0x5'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14f863,_0x52deb5,_0x11fb0b){if(_0x14f863[_0x4199('0x6')]('closed')){_0x14f863[_0x4199('0x7')]=moment()[_0x4199('0x8')](_0x4199('0x9'));}_0x11fb0b(null,_0x14f863);}},'charset':'utf8mb4','collate':_0x4199('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 1471f45..d887217 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 _0x70e2=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateChatInteraction','update','body','options','raw','where','limit','info','AddTagsToChatInteraction','ChatInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x508986,_0x43d040){var _0x25d13a=function(_0x514412){while(--_0x514412){_0x508986['push'](_0x508986['shift']());}};_0x25d13a(++_0x43d040);}(_0x70e2,0x1f2));var _0x270e=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x70e2[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x270e('0x0'));var util=require(_0x270e('0x1'));var moment=require(_0x270e('0x2'));var BPromise=require('bluebird');var rs=require(_0x270e('0x3'));var fs=require('fs');var Redis=require(_0x270e('0x4'));var db=require(_0x270e('0x5'))['db'];var utils=require(_0x270e('0x6'));var logger=require(_0x270e('0x7'))(_0x270e('0x8'));var config=require(_0x270e('0x9'));var jayson=require(_0x270e('0xa'));var client=jayson['client'][_0x270e('0xb')]({'port':0x232a});config['redis']=_[_0x270e('0xc')](config[_0x270e('0xd')],{'host':_0x270e('0xe'),'port':0x18eb});var socket=require(_0x270e('0xf'))(new Redis(config[_0x270e('0xd')]));require('./chatInteraction.socket')[_0x270e('0x10')](socket);function respondWithRpcPromise(_0x42ba7e,_0x4b4075,_0x4a5626){return new BPromise(function(_0x223921,_0x1c64fc){return client[_0x270e('0x11')](_0x42ba7e,_0x4a5626)[_0x270e('0x12')](function(_0x45ae79){logger['info'](_0x270e('0x13'),_0x4b4075,_0x270e('0x14'));logger[_0x270e('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4b4075,_0x270e('0x14'),JSON[_0x270e('0x16')](_0x45ae79));if(_0x45ae79[_0x270e('0x17')]){if(_0x45ae79[_0x270e('0x17')][_0x270e('0x18')]===0x1f4){logger[_0x270e('0x17')](_0x270e('0x13'),_0x4b4075,_0x45ae79['error']['message']);return _0x1c64fc(_0x45ae79['error']['message']);}logger['error'](_0x270e('0x13'),_0x4b4075,_0x45ae79['error'][_0x270e('0x19')]);return _0x223921(_0x45ae79['error'][_0x270e('0x19')]);}else{logger['info'](_0x270e('0x13'),_0x4b4075,_0x270e('0x14'));_0x223921(_0x45ae79['result']['message']);}})[_0x270e('0x1a')](function(_0x5f2fb3){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x4b4075,_0x5f2fb3);_0x1c64fc(_0x5f2fb3);});});}exports[_0x270e('0x1b')]=function(_0x3942ff){var _0x489739=this;return new Promise(function(_0x508d39,_0x243e11){return db['ChatInteraction'][_0x270e('0x1c')](_0x3942ff[_0x270e('0x1d')],{'raw':_0x3942ff[_0x270e('0x1e')]?_0x3942ff[_0x270e('0x1e')][_0x270e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3942ff['options']?_0x3942ff[_0x270e('0x1e')][_0x270e('0x20')]||null:null,'attributes':_0x3942ff[_0x270e('0x1e')]?_0x3942ff[_0x270e('0x1e')]['attributes']||null:null,'limit':_0x3942ff[_0x270e('0x1e')]?_0x3942ff['options'][_0x270e('0x21')]||null:null})[_0x270e('0x12')](function(_0x3dfcd0){logger[_0x270e('0x22')](_0x270e('0x1b'),_0x3942ff);logger[_0x270e('0x15')](_0x270e('0x1b'),_0x3942ff,JSON['stringify'](_0x3dfcd0));_0x508d39(_0x3dfcd0);})[_0x270e('0x1a')](function(_0x22409c){logger['error'](_0x270e('0x1b'),_0x22409c[_0x270e('0x19')],_0x3942ff);_0x243e11(_0x489739['error'](0x1f4,_0x22409c[_0x270e('0x19')]));});});};exports[_0x270e('0x23')]=function(_0x324268){return new Promise(function(_0xc39338,_0xdbd4a4){return db[_0x270e('0x24')]['find']({'where':_0x324268[_0x270e('0x1e')]?_0x324268[_0x270e('0x1e')][_0x270e('0x20')]||null:null})[_0x270e('0x12')](function(_0x2f325c){if(_0x2f325c){return _0x2f325c[_0x270e('0x25')](_0x324268['body'][_0x270e('0x26')],_[_0x270e('0x27')](_0x324268['body'],[_0x270e('0x26'),'id'])||{});}})[_0x270e('0x28')](function(_0x31b5e6){logger[_0x270e('0x22')](_0x270e('0x29'),_0x324268);logger[_0x270e('0x15')](_0x270e('0x29'),_0x324268,JSON['stringify'](_0x31b5e6));_0xc39338(_0x31b5e6);})['catch'](function(_0xc9ee63){logger[_0x270e('0x17')](_0x270e('0x29'),_0xc9ee63[_0x270e('0x19')],_0x324268);_0xdbd4a4(_this[_0x270e('0x17')](0x1f4,_0xc9ee63[_0x270e('0x19')]));});});}; \ No newline at end of file +var _0x927f=['catch','UpdateChatInteraction','update','body','options','where','attributes','limit','AddTagsToChatInteraction','ChatInteraction','find','addTags','ids','spread','AddTags','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0xa9d0c9,_0x5b7bff){var _0x36d4d5=function(_0x54411f){while(--_0x54411f){_0xa9d0c9['push'](_0xa9d0c9['shift']());}};_0x36d4d5(++_0x5b7bff);}(_0x927f,0x8b));var _0xf927=function(_0x4e192c,_0x52db7f){_0x4e192c=_0x4e192c-0x0;var _0x427f9d=_0x927f[_0x4e192c];return _0x427f9d;};'use strict';var _=require(_0xf927('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf927('0x1'));var rs=require(_0xf927('0x2'));var fs=require('fs');var Redis=require(_0xf927('0x3'));var db=require(_0xf927('0x4'))['db'];var utils=require(_0xf927('0x5'));var logger=require('../../config/logger')(_0xf927('0x6'));var config=require(_0xf927('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf927('0x8')]['http']({'port':0x232a});config[_0xf927('0x9')]=_[_0xf927('0xa')](config[_0xf927('0x9')],{'host':_0xf927('0xb'),'port':0x18eb});var socket=require(_0xf927('0xc'))(new Redis(config[_0xf927('0x9')]));require(_0xf927('0xd'))['register'](socket);function respondWithRpcPromise(_0x51efb4,_0x10fc06,_0x4978e3){return new BPromise(function(_0x4a4665,_0x627401){return client[_0xf927('0xe')](_0x51efb4,_0x4978e3)[_0xf927('0xf')](function(_0x1a02f4){logger[_0xf927('0x10')](_0xf927('0x11'),_0x10fc06,_0xf927('0x12'));logger[_0xf927('0x13')](_0xf927('0x14'),_0x10fc06,_0xf927('0x12'),JSON['stringify'](_0x1a02f4));if(_0x1a02f4[_0xf927('0x15')]){if(_0x1a02f4[_0xf927('0x15')][_0xf927('0x16')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x10fc06,_0x1a02f4[_0xf927('0x15')]['message']);return _0x627401(_0x1a02f4['error']['message']);}logger[_0xf927('0x15')](_0xf927('0x11'),_0x10fc06,_0x1a02f4['error'][_0xf927('0x17')]);return _0x4a4665(_0x1a02f4[_0xf927('0x15')][_0xf927('0x17')]);}else{logger[_0xf927('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x10fc06,_0xf927('0x12'));_0x4a4665(_0x1a02f4[_0xf927('0x18')][_0xf927('0x17')]);}})[_0xf927('0x19')](function(_0x5e154c){logger[_0xf927('0x15')](_0xf927('0x11'),_0x10fc06,_0x5e154c);_0x627401(_0x5e154c);});});}exports[_0xf927('0x1a')]=function(_0x569acb){var _0x3577f1=this;return new Promise(function(_0x3380ed,_0x3df6c3){return db['ChatInteraction'][_0xf927('0x1b')](_0x569acb[_0xf927('0x1c')],{'raw':_0x569acb['options']?_0x569acb[_0xf927('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x569acb[_0xf927('0x1d')]?_0x569acb[_0xf927('0x1d')][_0xf927('0x1e')]||null:null,'attributes':_0x569acb[_0xf927('0x1d')]?_0x569acb[_0xf927('0x1d')][_0xf927('0x1f')]||null:null,'limit':_0x569acb[_0xf927('0x1d')]?_0x569acb[_0xf927('0x1d')][_0xf927('0x20')]||null:null})[_0xf927('0xf')](function(_0x2f2f93){logger[_0xf927('0x10')](_0xf927('0x1a'),_0x569acb);logger[_0xf927('0x13')](_0xf927('0x1a'),_0x569acb,JSON['stringify'](_0x2f2f93));_0x3380ed(_0x2f2f93);})[_0xf927('0x19')](function(_0x5da887){logger[_0xf927('0x15')](_0xf927('0x1a'),_0x5da887[_0xf927('0x17')],_0x569acb);_0x3df6c3(_0x3577f1['error'](0x1f4,_0x5da887[_0xf927('0x17')]));});});};exports[_0xf927('0x21')]=function(_0x459be3){return new Promise(function(_0xeb3ff8,_0x312c6d){return db[_0xf927('0x22')][_0xf927('0x23')]({'where':_0x459be3[_0xf927('0x1d')]?_0x459be3['options'][_0xf927('0x1e')]||null:null})[_0xf927('0xf')](function(_0x161c98){if(_0x161c98){return _0x161c98[_0xf927('0x24')](_0x459be3[_0xf927('0x1c')][_0xf927('0x25')],_['omit'](_0x459be3[_0xf927('0x1c')],[_0xf927('0x25'),'id'])||{});}})[_0xf927('0x26')](function(_0x549c03){logger['info']('AddTags',_0x459be3);logger[_0xf927('0x13')](_0xf927('0x27'),_0x459be3,JSON[_0xf927('0x28')](_0x549c03));_0xeb3ff8(_0x549c03);})['catch'](function(_0x24e93b){logger['error'](_0xf927('0x27'),_0x24e93b[_0xf927('0x17')],_0x459be3);_0x312c6d(_this[_0xf927('0x15')](0x1f4,_0x24e93b[_0xf927('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 2f4ba19..f94064c 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 _0xf4db=['chatInteraction:','./chatInteraction.events','save','update','removeListener','register'];(function(_0x28cd8d,_0x2b6483){var _0x234c51=function(_0x2ed09b){while(--_0x2ed09b){_0x28cd8d['push'](_0x28cd8d['shift']());}};_0x234c51(++_0x2b6483);}(_0xf4db,0xa3));var _0xbf4d=function(_0x22d7bb,_0x4c158e){_0x22d7bb=_0x22d7bb-0x0;var _0x40a737=_0xf4db[_0x22d7bb];return _0x40a737;};'use strict';var ChatInteractionEvents=require(_0xbf4d('0x0'));var events=[_0xbf4d('0x1'),'remove',_0xbf4d('0x2')];function createListener(_0x326b03,_0x48266f){return function(_0x3f3eca){_0x48266f['emit'](_0x326b03,_0x3f3eca);};}function removeListener(_0x354223,_0x3875c6){return function(){ChatInteractionEvents[_0xbf4d('0x3')](_0x354223,_0x3875c6);};}exports[_0xbf4d('0x4')]=function(_0x346654){for(var _0x2f4989=0x0,_0x135fbc=events['length'];_0x2f4989<_0x135fbc;_0x2f4989++){var _0x588244=events[_0x2f4989];var _0x2c6ef1=createListener(_0xbf4d('0x5')+_0x588244,_0x346654);ChatInteractionEvents['on'](_0x588244,_0x2c6ef1);}}; \ No newline at end of file +var _0xd55e=['save','remove','removeListener','length','chatInteraction:','./chatInteraction.events'];(function(_0x14dacd,_0x5ca30c){var _0x18406b=function(_0x59f4d8){while(--_0x59f4d8){_0x14dacd['push'](_0x14dacd['shift']());}};_0x18406b(++_0x5ca30c);}(_0xd55e,0x113));var _0xed55=function(_0x3ae738,_0x282255){_0x3ae738=_0x3ae738-0x0;var _0x35e1fa=_0xd55e[_0x3ae738];return _0x35e1fa;};'use strict';var ChatInteractionEvents=require(_0xed55('0x0'));var events=[_0xed55('0x1'),_0xed55('0x2'),'update'];function createListener(_0xfb5e4d,_0x5d7497){return function(_0x260ee2){_0x5d7497['emit'](_0xfb5e4d,_0x260ee2);};}function removeListener(_0x3589eb,_0x1f0360){return function(){ChatInteractionEvents[_0xed55('0x3')](_0x3589eb,_0x1f0360);};}exports['register']=function(_0x54672f){for(var _0x305445=0x0,_0x223761=events[_0xed55('0x4')];_0x305445<_0x223761;_0x305445++){var _0x221e7e=events[_0x305445];var _0x529aab=createListener(_0xed55('0x5')+_0x221e7e,_0x54672f);ChatInteractionEvents['on'](_0x221e7e,_0x529aab);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 824905d..f252f04 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 _0xcf91=['chatinteraction:update','update','/:id/custom_update','/:id/abandon','abandon','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put'];(function(_0x1bb298,_0x2ad943){var _0x3cb8ed=function(_0x124c1e){while(--_0x124c1e){_0x1bb298['push'](_0x1bb298['shift']());}};_0x3cb8ed(++_0x2ad943);}(_0xcf91,0xcf));var _0x1cf9=function(_0x139881,_0x568e66){_0x139881=_0x139881-0x0;var _0x531576=_0xcf91[_0x139881];return _0x531576;};'use strict';var multer=require(_0x1cf9('0x0'));var util=require(_0x1cf9('0x1'));var path=require(_0x1cf9('0x2'));var timeout=require(_0x1cf9('0x3'));var express=require(_0x1cf9('0x4'));var router=express[_0x1cf9('0x5')]();var auth=require(_0x1cf9('0x6'));var interaction=require(_0x1cf9('0x7'));var config=require(_0x1cf9('0x8'));var controller=require(_0x1cf9('0x9'));router[_0x1cf9('0xa')]('/',auth[_0x1cf9('0xb')](),controller['index']);router[_0x1cf9('0xa')]('/describe',auth[_0x1cf9('0xb')](),controller['describe']);router[_0x1cf9('0xa')](_0x1cf9('0xc'),auth[_0x1cf9('0xd')](),controller[_0x1cf9('0xe')]);router['get'](_0x1cf9('0xf'),auth[_0x1cf9('0xd')](),controller['attachmentDownload']);router[_0x1cf9('0xa')]('/:id/messages',auth[_0x1cf9('0xb')](),controller[_0x1cf9('0x10')]);router[_0x1cf9('0xa')](_0x1cf9('0x11'),auth[_0x1cf9('0xd')](),controller[_0x1cf9('0x12')]);router[_0x1cf9('0xa')](_0x1cf9('0x13'),auth[_0x1cf9('0xb')](),controller[_0x1cf9('0x14')]);router[_0x1cf9('0x15')]('/',auth[_0x1cf9('0xb')](),controller[_0x1cf9('0x16')]);router[_0x1cf9('0x15')](_0x1cf9('0x17'),auth['isAuthenticated'](),controller[_0x1cf9('0x18')]);var upload=multer({'storage':multer[_0x1cf9('0x19')]({'destination':function(_0x4ca617,_0x4adcef,_0x4c7845){_0x4c7845(null,path['join'](config[_0x1cf9('0x1a')],_0x1cf9('0x1b')));},'filename':function(_0x554585,_0x15f682,_0x1baa09){_0x1baa09(null,util['format'](_0x1cf9('0x1c'),Date[_0x1cf9('0x1d')](),_0x15f682[_0x1cf9('0x1e')][_0x1cf9('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1cf9('0x15')](_0x1cf9('0x20'),upload[_0x1cf9('0x21')](_0x1cf9('0x22')),controller['attachmentUpload']);router[_0x1cf9('0x15')](_0x1cf9('0x23'),auth[_0x1cf9('0xd')](),controller[_0x1cf9('0x24')]);router[_0x1cf9('0x15')](_0x1cf9('0x25'),auth['isAuthenticated'](),interaction[_0x1cf9('0x26')](_0x1cf9('0x27'),_0x1cf9('0x28')),controller[_0x1cf9('0x29')]);router[_0x1cf9('0x2a')]('/:id',auth[_0x1cf9('0xb')](),interaction[_0x1cf9('0x26')](_0x1cf9('0x27'),_0x1cf9('0x2b')),controller[_0x1cf9('0x2c')]);router[_0x1cf9('0x2a')](_0x1cf9('0x2d'),controller['customUpdate']);router[_0x1cf9('0x2a')](_0x1cf9('0x2e'),auth['isChatInteractionAuthorized'](),controller[_0x1cf9('0x2f')]);router[_0x1cf9('0x2a')]('/:id/close',controller['close']);router[_0x1cf9('0x30')]('/:id',auth[_0x1cf9('0xb')](),interaction['tracked'](_0x1cf9('0x27'),'chatinteraction:destroy'),controller[_0x1cf9('0x31')]);router[_0x1cf9('0x30')](_0x1cf9('0x25'),auth[_0x1cf9('0xb')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x5a99=['/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','file','attachmentUpload','/:id/tags','tracked','chat','addTags','put','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create'];(function(_0x5da6f5,_0xa4caa7){var _0x8c7372=function(_0x1c1618){while(--_0x1c1618){_0x5da6f5['push'](_0x5da6f5['shift']());}};_0x8c7372(++_0xa4caa7);}(_0x5a99,0x1ef));var _0x95a9=function(_0x4f9a92,_0x45abdd){_0x4f9a92=_0x4f9a92-0x0;var _0x24da33=_0x5a99[_0x4f9a92];return _0x24da33;};'use strict';var multer=require('multer');var util=require(_0x95a9('0x0'));var path=require(_0x95a9('0x1'));var timeout=require(_0x95a9('0x2'));var express=require(_0x95a9('0x3'));var router=express[_0x95a9('0x4')]();var auth=require(_0x95a9('0x5'));var interaction=require(_0x95a9('0x6'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x95a9('0x7')]('/',auth[_0x95a9('0x8')](),controller[_0x95a9('0x9')]);router[_0x95a9('0x7')]('/describe',auth[_0x95a9('0x8')](),controller[_0x95a9('0xa')]);router[_0x95a9('0x7')](_0x95a9('0xb'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x95a9('0x7')](_0x95a9('0xc'),auth[_0x95a9('0xd')](),controller[_0x95a9('0xe')]);router['get'](_0x95a9('0xf'),auth[_0x95a9('0x8')](),controller[_0x95a9('0x10')]);router[_0x95a9('0x7')](_0x95a9('0x11'),auth[_0x95a9('0xd')](),controller[_0x95a9('0x12')]);router[_0x95a9('0x7')]('/:id/download',auth[_0x95a9('0x8')](),controller[_0x95a9('0x13')]);router[_0x95a9('0x14')]('/',auth[_0x95a9('0x8')](),controller[_0x95a9('0x15')]);router[_0x95a9('0x14')](_0x95a9('0x16'),auth[_0x95a9('0x8')](),controller[_0x95a9('0x17')]);var upload=multer({'storage':multer[_0x95a9('0x18')]({'destination':function(_0x20519f,_0xa93037,_0x11a559){_0x11a559(null,path[_0x95a9('0x19')](config[_0x95a9('0x1a')],_0x95a9('0x1b')));},'filename':function(_0x2509f6,_0x2cc986,_0x255a92){_0x255a92(null,util[_0x95a9('0x1c')](_0x95a9('0x1d'),Date['now'](),_0x2cc986[_0x95a9('0x1e')][_0x95a9('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x95a9('0x14')](_0x95a9('0x20'),upload['single'](_0x95a9('0x21')),controller[_0x95a9('0x22')]);router['post']('/:id/messages',auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x95a9('0x14')](_0x95a9('0x23'),auth[_0x95a9('0x8')](),interaction[_0x95a9('0x24')](_0x95a9('0x25'),'chatinteraction:addtags'),controller[_0x95a9('0x26')]);router[_0x95a9('0x27')](_0x95a9('0xb'),auth['isAuthenticated'](),interaction[_0x95a9('0x24')]('chat','chatinteraction:update'),controller['update']);router[_0x95a9('0x27')]('/:id/custom_update',controller['customUpdate']);router[_0x95a9('0x27')](_0x95a9('0x28'),auth[_0x95a9('0xd')](),controller[_0x95a9('0x29')]);router[_0x95a9('0x27')]('/:id/close',controller[_0x95a9('0x2a')]);router[_0x95a9('0x2b')](_0x95a9('0xb'),auth['isAuthenticated'](),interaction[_0x95a9('0x24')]('chat',_0x95a9('0x2c')),controller[_0x95a9('0x2d')]);router[_0x95a9('0x2b')]('/:id/tags',auth[_0x95a9('0x8')](),controller[_0x95a9('0x2e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 0911e0d..6291766 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 _0x1a85=['BOOLEAN','TEXT','medium'];(function(_0xe51596,_0x314d5b){var _0x22c705=function(_0x4c6f94){while(--_0x4c6f94){_0xe51596['push'](_0xe51596['shift']());}};_0x22c705(++_0x314d5b);}(_0x1a85,0x178));var _0x51a8=function(_0x347ffb,_0x156d2b){_0x347ffb=_0x347ffb-0x0;var _0x330474=_0x1a85[_0x347ffb];return _0x330474;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x51a8('0x0')](_0x51a8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7a54=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0x7a54,0x106));var _0x47a5=function(_0xdfc63a,_0x36498a){_0xdfc63a=_0xdfc63a-0x0;var _0x9fac8f=_0x7a54[_0xdfc63a];return _0x9fac8f;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'body':{'type':Sequelize[_0x47a5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 9c981bf..6d39b2f 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 _0x8fab=['attributes','length','nolimit','order','sort','pick','filter','map','VIRTUAL','merge','options','include','findAll','then','rows','catch','show','params','keys','includeAll','find','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','get','user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','ToId','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','destroy','stack','name','ChatInternalMessage','rawAttributes','fieldName','type','model','query','filters','intersection','fields'];(function(_0x462f0e,_0x1d1cfd){var _0x5d8632=function(_0x1dcda6){while(--_0x1dcda6){_0x462f0e['push'](_0x462f0e['shift']());}};_0x5d8632(++_0x1d1cfd);}(_0x8fab,0x112));var _0xb8fa=function(_0x3c47ce,_0x4e53b0){_0x3c47ce=_0x3c47ce-0x0;var _0x4528a9=_0x8fab[_0x3c47ce];return _0x4528a9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb8fa('0x0'));var rimraf=require(_0xb8fa('0x1'));var zipdir=require(_0xb8fa('0x2'));var jsonpatch=require(_0xb8fa('0x3'));var rp=require(_0xb8fa('0x4'));var moment=require(_0xb8fa('0x5'));var BPromise=require(_0xb8fa('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb8fa('0x7'));var sox=require(_0xb8fa('0x8'));var csv=require(_0xb8fa('0x9'));var ejs=require(_0xb8fa('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb8fa('0xb'));var crypto=require(_0xb8fa('0xc'));var jsforce=require(_0xb8fa('0xd'));var deskjs=require(_0xb8fa('0xe'));var toCsv=require(_0xb8fa('0x9'));var querystring=require(_0xb8fa('0xf'));var Papa=require(_0xb8fa('0x10'));var Redis=require(_0xb8fa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb8fa('0x12'));var as=require(_0xb8fa('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8fa('0x14'))(_0xb8fa('0x15'));var utils=require(_0xb8fa('0x16'));var config=require(_0xb8fa('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb8fa('0x18'))['db'];config[_0xb8fa('0x19')]=_[_0xb8fa('0x1a')](config[_0xb8fa('0x19')],{'host':_0xb8fa('0x1b'),'port':0x18eb});var socket=require(_0xb8fa('0x1c'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xb8fa('0x1d')](socket);function respondWithStatusCode(_0x3f62db,_0x4548a0){_0x4548a0=_0x4548a0||0xcc;return function(_0x1f00fb){if(_0x1f00fb){return _0x3f62db[_0xb8fa('0x1e')](_0x4548a0);}return _0x3f62db['status'](_0x4548a0)[_0xb8fa('0x1f')]();};}function respondWithResult(_0x10568d,_0x213b0d){_0x213b0d=_0x213b0d||0xc8;return function(_0x41e0eb){if(_0x41e0eb){return _0x10568d[_0xb8fa('0x20')](_0x213b0d)[_0xb8fa('0x21')](_0x41e0eb);}};}function respondWithFilteredResult(_0x3406a5,_0x41babe){return function(_0x2f8c25){if(_0x2f8c25){var _0x486e01=_0x2f8c25[_0xb8fa('0x22')],_0x1ceb9d=_0x41babe[_0xb8fa('0x23')],_0x55ba9e=_0x41babe[_0xb8fa('0x23')]+_0x41babe[_0xb8fa('0x24')],_0x4983ae;if(_0x55ba9e>=_0x486e01){_0x55ba9e=_0x486e01;_0x4983ae=0xc8;}else{_0x4983ae=0xce;}_0x3406a5[_0xb8fa('0x20')](_0x4983ae);return _0x3406a5[_0xb8fa('0x25')](_0xb8fa('0x26'),_0x1ceb9d+'-'+_0x55ba9e+'/'+_0x486e01)[_0xb8fa('0x21')](_0x2f8c25);}return null;};}function patchUpdates(_0xa873fb){return function(_0x183ba3){try{jsonpatch['apply'](_0x183ba3,_0xa873fb,!![]);}catch(_0x59b6fd){return BPromise['reject'](_0x59b6fd);}return _0x183ba3[_0xb8fa('0x27')]();};}function saveUpdates(_0x22377a,_0x5ed8bd){return function(_0x263407){if(_0x263407){return _0x263407[_0xb8fa('0x28')](_0x22377a)['then'](function(_0x108ab7){return _0x108ab7;});}return null;};}function removeEntity(_0x29e1eb,_0x5e1d28){return function(_0x38f327){if(_0x38f327){return _0x38f327[_0xb8fa('0x29')]()['then'](function(){_0x29e1eb[_0xb8fa('0x20')](0xcc)[_0xb8fa('0x1f')]();});}};}function handleEntityNotFound(_0x116118,_0x26ae14){return function(_0x3074af){if(!_0x3074af){_0x116118[_0xb8fa('0x1e')](0x194);}return _0x3074af;};}function handleError(_0x4b8514,_0x46369d){_0x46369d=_0x46369d||0x1f4;return function(_0x11cee2){logger['error'](_0x11cee2[_0xb8fa('0x2a')]);if(_0x11cee2[_0xb8fa('0x2b')]){delete _0x11cee2[_0xb8fa('0x2b')];}_0x4b8514[_0xb8fa('0x20')](_0x46369d)['send'](_0x11cee2);};}exports['index']=function(_0x24c639,_0x42cbcf){var _0x53cb0c={},_0x4a3817={},_0x5f505b={'count':0x0,'rows':[]};var _0x15c5f2=_['map'](db[_0xb8fa('0x2c')][_0xb8fa('0x2d')],function(_0x464072){return{'name':_0x464072[_0xb8fa('0x2e')],'type':_0x464072[_0xb8fa('0x2f')]['key']};});_0x4a3817[_0xb8fa('0x30')]=_['map'](_0x15c5f2,'name');_0x4a3817[_0xb8fa('0x31')]=_['keys'](_0x24c639[_0xb8fa('0x31')]);_0x4a3817[_0xb8fa('0x32')]=_[_0xb8fa('0x33')](_0x4a3817[_0xb8fa('0x30')],_0x4a3817[_0xb8fa('0x31')]);_0x53cb0c['attributes']=_[_0xb8fa('0x33')](_0x4a3817[_0xb8fa('0x30')],qs['fields'](_0x24c639[_0xb8fa('0x31')][_0xb8fa('0x34')]));_0x53cb0c[_0xb8fa('0x35')]=_0x53cb0c['attributes'][_0xb8fa('0x36')]?_0x53cb0c[_0xb8fa('0x35')]:_0x4a3817[_0xb8fa('0x30')];if(!_0x24c639[_0xb8fa('0x31')]['hasOwnProperty'](_0xb8fa('0x37'))){_0x53cb0c[_0xb8fa('0x24')]=qs[_0xb8fa('0x24')](_0x24c639['query'][_0xb8fa('0x24')]);_0x53cb0c[_0xb8fa('0x23')]=qs[_0xb8fa('0x23')](_0x24c639[_0xb8fa('0x31')][_0xb8fa('0x23')]);}_0x53cb0c[_0xb8fa('0x38')]=qs[_0xb8fa('0x39')](_0x24c639['query'][_0xb8fa('0x39')]);_0x53cb0c['where']=qs[_0xb8fa('0x32')](_[_0xb8fa('0x3a')](_0x24c639[_0xb8fa('0x31')],_0x4a3817[_0xb8fa('0x32')]),_0x15c5f2);if(_0x24c639[_0xb8fa('0x31')][_0xb8fa('0x3b')]){_0x53cb0c['where']=_['merge'](_0x53cb0c['where'],{'$or':_[_0xb8fa('0x3c')](_0x15c5f2,function(_0x18215d){if(_0x18215d[_0xb8fa('0x2f')]!==_0xb8fa('0x3d')){var _0x242f08={};_0x242f08[_0x18215d[_0xb8fa('0x2b')]]={'$like':'%'+_0x24c639['query'][_0xb8fa('0x3b')]+'%'};return _0x242f08;}})});}_0x53cb0c=_[_0xb8fa('0x3e')]({},_0x53cb0c,_0x24c639[_0xb8fa('0x3f')]);var _0x17a9ac={'where':_0x53cb0c['where']};return db[_0xb8fa('0x2c')][_0xb8fa('0x22')](_0x17a9ac)['then'](function(_0x197fa5){_0x5f505b['count']=_0x197fa5;if(_0x24c639[_0xb8fa('0x31')]['includeAll']){_0x53cb0c[_0xb8fa('0x40')]=[{'all':!![]}];}return db[_0xb8fa('0x2c')][_0xb8fa('0x41')](_0x53cb0c);})[_0xb8fa('0x42')](function(_0x40bf48){_0x5f505b[_0xb8fa('0x43')]=_0x40bf48;return _0x5f505b;})[_0xb8fa('0x42')](respondWithFilteredResult(_0x42cbcf,_0x53cb0c))[_0xb8fa('0x44')](handleError(_0x42cbcf,null));};exports[_0xb8fa('0x45')]=function(_0x604b16,_0x1f652a){var _0x3af31e={'raw':!![],'where':{'id':_0x604b16[_0xb8fa('0x46')]['id']}},_0x51388f={};_0x51388f['model']=_[_0xb8fa('0x47')](db['ChatInternalMessage'][_0xb8fa('0x2d')]);_0x51388f[_0xb8fa('0x31')]=_[_0xb8fa('0x47')](_0x604b16[_0xb8fa('0x31')]);_0x51388f[_0xb8fa('0x32')]=_[_0xb8fa('0x33')](_0x51388f[_0xb8fa('0x30')],_0x51388f[_0xb8fa('0x31')]);_0x3af31e[_0xb8fa('0x35')]=_[_0xb8fa('0x33')](_0x51388f['model'],qs[_0xb8fa('0x34')](_0x604b16[_0xb8fa('0x31')]['fields']));_0x3af31e['attributes']=_0x3af31e[_0xb8fa('0x35')][_0xb8fa('0x36')]?_0x3af31e[_0xb8fa('0x35')]:_0x51388f['model'];if(_0x604b16[_0xb8fa('0x31')][_0xb8fa('0x48')]){_0x3af31e[_0xb8fa('0x40')]=[{'all':!![]}];}_0x3af31e=_['merge']({},_0x3af31e,_0x604b16[_0xb8fa('0x3f')]);return db[_0xb8fa('0x2c')][_0xb8fa('0x49')](_0x3af31e)[_0xb8fa('0x42')](handleEntityNotFound(_0x1f652a,null))[_0xb8fa('0x42')](respondWithResult(_0x1f652a,null))[_0xb8fa('0x44')](handleError(_0x1f652a,null));};exports['create']=function(_0x5e2549,_0x4b4e73){return db[_0xb8fa('0x2c')][_0xb8fa('0x4a')](_0x5e2549[_0xb8fa('0x4b')],{})[_0xb8fa('0x42')](respondWithResult(_0x4b4e73,0xc9))[_0xb8fa('0x44')](handleError(_0x4b4e73,null));};exports[_0xb8fa('0x28')]=function(_0x46766a,_0x4050f7){if(_0x46766a[_0xb8fa('0x4b')]['id']){delete _0x46766a[_0xb8fa('0x4b')]['id'];}return db[_0xb8fa('0x2c')][_0xb8fa('0x49')]({'where':{'id':_0x46766a[_0xb8fa('0x46')]['id']}})[_0xb8fa('0x42')](handleEntityNotFound(_0x4050f7,null))['then'](saveUpdates(_0x46766a[_0xb8fa('0x4b')],null))[_0xb8fa('0x42')](respondWithResult(_0x4050f7,null))[_0xb8fa('0x44')](handleError(_0x4050f7,null));};exports[_0xb8fa('0x29')]=function(_0x39eace,_0x13bc9c){return db[_0xb8fa('0x2c')][_0xb8fa('0x49')]({'where':{'id':_0x39eace[_0xb8fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x13bc9c,null))[_0xb8fa('0x42')](removeEntity(_0x13bc9c,null))[_0xb8fa('0x44')](handleError(_0x13bc9c,null));};exports[_0xb8fa('0x4c')]=function(_0x56e6da,_0x2a88cc){return db[_0xb8fa('0x2c')][_0xb8fa('0x4c')]()[_0xb8fa('0x42')](respondWithResult(_0x2a88cc,null))[_0xb8fa('0x44')](handleError(_0x2a88cc,null));};function wrapUser(_0x17c66c){return function(_0x2220c5){var _0x535404=_0x17c66c['get']({'plain':!![]});_0x535404[_0xb8fa('0x4d')]=[];if(_0x2220c5){_0x535404[_0xb8fa('0x4e')]=_0x2220c5[_0xb8fa('0x4f')];_0x535404[_0xb8fa('0x50')]=_0x2220c5;}else{_0x535404[_0xb8fa('0x4e')]=moment(0x0)[_0xb8fa('0x51')](_0xb8fa('0x52'));_0x535404[_0xb8fa('0x50')]={};}return _0x535404;};}exports[_0xb8fa('0x53')]=function(_0x3be035,_0x44e096,_0x1ba588){var _0x29b5ba=[];return db[_0xb8fa('0x54')][_0xb8fa('0x41')]({'where':{'role':[_0xb8fa('0x55'),_0xb8fa('0x56'),'user']},'attributes':['id',_0xb8fa('0x57'),_0xb8fa('0x2b'),_0xb8fa('0x58'),'userpic',_0xb8fa('0x59'),_0xb8fa('0x5a'),_0xb8fa('0x5b'),_0xb8fa('0x5c'),_0xb8fa('0x5d')],'order':qs[_0xb8fa('0x39')](_0xb8fa('0x5e')),'include':[{'model':db[_0xb8fa('0x5f')],'as':_0xb8fa('0x60'),'attributes':['id',_0xb8fa('0x2b'),_0xb8fa('0x2f')],'through':{'attributes':[]}}]})[_0xb8fa('0x42')](function(_0x54b55a){if(_0x54b55a){var _0x55e268=_0x3be035['user'][_0xb8fa('0x61')]({'plain':!![]});if(!_0x55e268)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55e268[_0xb8fa('0x58')]===_0xb8fa('0x62')){return db[_0xb8fa('0x63')]['find']({'where':{'name':_0xb8fa('0x64'),'userProfileId':_0x55e268[_0xb8fa('0x65')]},'raw':!![]})[_0xb8fa('0x42')](function(_0x4754bd){if(_0x4754bd){if(_0x4754bd[_0xb8fa('0x66')]===0x0){return db[_0xb8fa('0x67')][_0xb8fa('0x41')]({'where':{'sectionId':_0x4754bd['id']},'raw':!![]})['then'](function(_0x5c2ebf){var _0x2a5502=[];if(_[_0xb8fa('0x68')](_0x5c2ebf)){_0x2a5502=_[_0xb8fa('0x3b')](_0x54b55a,function(_0xe5c16e){if(_0xe5c16e[_0xb8fa('0x58')]!=='agent'){return _0xe5c16e;}});return _0x2a5502;}else{for(var _0x51d825=0x0;_0x51d825<_0x54b55a['length'];_0x51d825++){var _0x7183c3=_0x54b55a[_0x51d825];if(_0x7183c3[_0xb8fa('0x58')]===_0xb8fa('0x55')){var _0x1bac61=_[_0xb8fa('0x49')](_0x5c2ebf,function(_0x3c0878){return _0x3c0878['resourceId']===_0x7183c3['id'];});if(_0x1bac61)_0x2a5502[_0xb8fa('0x69')](_0x7183c3);}else{_0x2a5502[_0xb8fa('0x69')](_0x7183c3);}}return _0x2a5502;}});}else{return _0x54b55a;}}else{var _0x1c41f0=_['filter'](_0x54b55a,function(_0x638921){if(_0x638921[_0xb8fa('0x58')]!==_0xb8fa('0x55')){return _0x638921;}});return _0x1c41f0;}});}else{return _0x54b55a;}}})['then'](function(_0x2487b4){var _0x58364c=[];if(_0x2487b4){_0x29b5ba=_0x2487b4;for(var _0xe71332=0x0;_0xe71332<_0x2487b4[_0xb8fa('0x36')];_0xe71332+=0x1){_0x29b5ba[_0xe71332]['messages']=[];_0x58364c[_0xb8fa('0x69')](db[_0xb8fa('0x2c')][_0xb8fa('0x49')]({'where':{'FromId':[_0x3be035[_0xb8fa('0x62')]['id'],_0x2487b4[_0xe71332]['id']],'ToId':[_0x3be035['user']['id'],_0x2487b4[_0xe71332]['id']],'ChatGroupId':null},'attributes':['id',_0xb8fa('0x4f'),_0xb8fa('0x6a'),_0xb8fa('0x6b'),'read','body'],'order':qs[_0xb8fa('0x39')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb8fa('0x42')](wrapUser(_0x2487b4[_0xe71332])));}return BPromise[_0xb8fa('0x6c')](_0x58364c);}return[];})[_0xb8fa('0x42')](function(_0x3b009b){return{'rows':_0x3b009b,'count':_0x3b009b[_0xb8fa('0x36')]};})[_0xb8fa('0x42')](respondWithResult(_0x44e096,null))[_0xb8fa('0x44')](handleError(_0x44e096,null));}; \ No newline at end of file +var _0x134e=['UserProfileResource','isEmpty','resourceId','push','FromId','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','name','ChatInternalMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','find','create','body','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','getUsers','User','agent','admin','user','fullname','role','internal','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x134e,0x1bf));var _0xe134=function(_0x3e3daa,_0xe55cdd){_0x3e3daa=_0x3e3daa-0x0;var _0x82c276=_0x134e[_0x3e3daa];return _0x82c276;};'use strict';var pdf=require(_0xe134('0x0'));var emlformat=require(_0xe134('0x1'));var rimraf=require(_0xe134('0x2'));var zipdir=require(_0xe134('0x3'));var jsonpatch=require(_0xe134('0x4'));var rp=require(_0xe134('0x5'));var moment=require(_0xe134('0x6'));var BPromise=require(_0xe134('0x7'));var Mustache=require(_0xe134('0x8'));var util=require(_0xe134('0x9'));var path=require(_0xe134('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe134('0xb'));var fs=require('fs');var _=require(_0xe134('0xc'));var squel=require(_0xe134('0xd'));var crypto=require(_0xe134('0xe'));var jsforce=require(_0xe134('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe134('0x10'));var Papa=require(_0xe134('0x11'));var Redis=require(_0xe134('0x12'));var authService=require(_0xe134('0x13'));var qs=require(_0xe134('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe134('0x15'));var logger=require(_0xe134('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xe134('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe134('0x18'))['db'];config['redis']=_[_0xe134('0x19')](config[_0xe134('0x1a')],{'host':_0xe134('0x1b'),'port':0x18eb});var socket=require(_0xe134('0x1c'))(new Redis(config[_0xe134('0x1a')]));require(_0xe134('0x1d'))['register'](socket);function respondWithStatusCode(_0x12a2f2,_0x3bd64b){_0x3bd64b=_0x3bd64b||0xcc;return function(_0x32427e){if(_0x32427e){return _0x12a2f2[_0xe134('0x1e')](_0x3bd64b);}return _0x12a2f2[_0xe134('0x1f')](_0x3bd64b)[_0xe134('0x20')]();};}function respondWithResult(_0x35a588,_0x4dea6e){_0x4dea6e=_0x4dea6e||0xc8;return function(_0x39bd7b){if(_0x39bd7b){return _0x35a588[_0xe134('0x1f')](_0x4dea6e)[_0xe134('0x21')](_0x39bd7b);}};}function respondWithFilteredResult(_0x152e18,_0x2841c3){return function(_0x51cf89){if(_0x51cf89){var _0x4542e3=_0x51cf89[_0xe134('0x22')],_0xddbf22=_0x2841c3[_0xe134('0x23')],_0x62d048=_0x2841c3[_0xe134('0x23')]+_0x2841c3[_0xe134('0x24')],_0x1042c4;if(_0x62d048>=_0x4542e3){_0x62d048=_0x4542e3;_0x1042c4=0xc8;}else{_0x1042c4=0xce;}_0x152e18[_0xe134('0x1f')](_0x1042c4);return _0x152e18[_0xe134('0x25')](_0xe134('0x26'),_0xddbf22+'-'+_0x62d048+'/'+_0x4542e3)[_0xe134('0x21')](_0x51cf89);}return null;};}function patchUpdates(_0x1c6aa8){return function(_0x4c1c79){try{jsonpatch[_0xe134('0x27')](_0x4c1c79,_0x1c6aa8,!![]);}catch(_0x5908d7){return BPromise[_0xe134('0x28')](_0x5908d7);}return _0x4c1c79[_0xe134('0x29')]();};}function saveUpdates(_0x130b04,_0x192599){return function(_0x3abffc){if(_0x3abffc){return _0x3abffc[_0xe134('0x2a')](_0x130b04)['then'](function(_0x382e96){return _0x382e96;});}return null;};}function removeEntity(_0x270e7b,_0x13a399){return function(_0x36634b){if(_0x36634b){return _0x36634b[_0xe134('0x2b')]()['then'](function(){_0x270e7b[_0xe134('0x1f')](0xcc)[_0xe134('0x20')]();});}};}function handleEntityNotFound(_0x35a7ba,_0x37ca56){return function(_0x117447){if(!_0x117447){_0x35a7ba['sendStatus'](0x194);}return _0x117447;};}function handleError(_0x2514e9,_0x545749){_0x545749=_0x545749||0x1f4;return function(_0x23adc0){logger[_0xe134('0x2c')](_0x23adc0['stack']);if(_0x23adc0[_0xe134('0x2d')]){delete _0x23adc0[_0xe134('0x2d')];}_0x2514e9[_0xe134('0x1f')](_0x545749)['send'](_0x23adc0);};}exports['index']=function(_0x49a46d,_0x43d924){var _0x237aed={},_0x21dfdb={},_0x34d650={'count':0x0,'rows':[]};var _0x263967=_['map'](db[_0xe134('0x2e')][_0xe134('0x2f')],function(_0x43c168){return{'name':_0x43c168[_0xe134('0x30')],'type':_0x43c168['type'][_0xe134('0x31')]};});_0x21dfdb[_0xe134('0x32')]=_[_0xe134('0x33')](_0x263967,_0xe134('0x2d'));_0x21dfdb[_0xe134('0x34')]=_[_0xe134('0x35')](_0x49a46d[_0xe134('0x34')]);_0x21dfdb[_0xe134('0x36')]=_[_0xe134('0x37')](_0x21dfdb[_0xe134('0x32')],_0x21dfdb[_0xe134('0x34')]);_0x237aed['attributes']=_[_0xe134('0x37')](_0x21dfdb[_0xe134('0x32')],qs[_0xe134('0x38')](_0x49a46d[_0xe134('0x34')]['fields']));_0x237aed[_0xe134('0x39')]=_0x237aed[_0xe134('0x39')][_0xe134('0x3a')]?_0x237aed[_0xe134('0x39')]:_0x21dfdb[_0xe134('0x32')];if(!_0x49a46d[_0xe134('0x34')][_0xe134('0x3b')](_0xe134('0x3c'))){_0x237aed[_0xe134('0x24')]=qs[_0xe134('0x24')](_0x49a46d[_0xe134('0x34')][_0xe134('0x24')]);_0x237aed[_0xe134('0x23')]=qs[_0xe134('0x23')](_0x49a46d[_0xe134('0x34')]['offset']);}_0x237aed['order']=qs[_0xe134('0x3d')](_0x49a46d[_0xe134('0x34')][_0xe134('0x3d')]);_0x237aed[_0xe134('0x3e')]=qs[_0xe134('0x36')](_[_0xe134('0x3f')](_0x49a46d[_0xe134('0x34')],_0x21dfdb['filters']),_0x263967);if(_0x49a46d['query'][_0xe134('0x40')]){_0x237aed[_0xe134('0x3e')]=_[_0xe134('0x41')](_0x237aed['where'],{'$or':_['map'](_0x263967,function(_0x43614b){if(_0x43614b['type']!==_0xe134('0x42')){var _0x295c2a={};_0x295c2a[_0x43614b[_0xe134('0x2d')]]={'$like':'%'+_0x49a46d[_0xe134('0x34')][_0xe134('0x40')]+'%'};return _0x295c2a;}})});}_0x237aed=_[_0xe134('0x41')]({},_0x237aed,_0x49a46d[_0xe134('0x43')]);var _0x36ec58={'where':_0x237aed[_0xe134('0x3e')]};return db[_0xe134('0x2e')][_0xe134('0x22')](_0x36ec58)[_0xe134('0x44')](function(_0x13180a){_0x34d650['count']=_0x13180a;if(_0x49a46d[_0xe134('0x34')][_0xe134('0x45')]){_0x237aed[_0xe134('0x46')]=[{'all':!![]}];}return db[_0xe134('0x2e')][_0xe134('0x47')](_0x237aed);})[_0xe134('0x44')](function(_0x4ef8b0){_0x34d650['rows']=_0x4ef8b0;return _0x34d650;})[_0xe134('0x44')](respondWithFilteredResult(_0x43d924,_0x237aed))[_0xe134('0x48')](handleError(_0x43d924,null));};exports[_0xe134('0x49')]=function(_0x124c22,_0x58f6ed){var _0x144f4e={'raw':!![],'where':{'id':_0x124c22[_0xe134('0x4a')]['id']}},_0x7f4bf5={};_0x7f4bf5[_0xe134('0x32')]=_[_0xe134('0x35')](db[_0xe134('0x2e')][_0xe134('0x2f')]);_0x7f4bf5['query']=_[_0xe134('0x35')](_0x124c22[_0xe134('0x34')]);_0x7f4bf5[_0xe134('0x36')]=_[_0xe134('0x37')](_0x7f4bf5[_0xe134('0x32')],_0x7f4bf5[_0xe134('0x34')]);_0x144f4e[_0xe134('0x39')]=_['intersection'](_0x7f4bf5[_0xe134('0x32')],qs[_0xe134('0x38')](_0x124c22['query'][_0xe134('0x38')]));_0x144f4e[_0xe134('0x39')]=_0x144f4e['attributes'][_0xe134('0x3a')]?_0x144f4e['attributes']:_0x7f4bf5[_0xe134('0x32')];if(_0x124c22['query']['includeAll']){_0x144f4e[_0xe134('0x46')]=[{'all':!![]}];}_0x144f4e=_[_0xe134('0x41')]({},_0x144f4e,_0x124c22[_0xe134('0x43')]);return db['ChatInternalMessage'][_0xe134('0x4b')](_0x144f4e)[_0xe134('0x44')](handleEntityNotFound(_0x58f6ed,null))['then'](respondWithResult(_0x58f6ed,null))[_0xe134('0x48')](handleError(_0x58f6ed,null));};exports[_0xe134('0x4c')]=function(_0x5796fc,_0x586245){return db[_0xe134('0x2e')][_0xe134('0x4c')](_0x5796fc[_0xe134('0x4d')],{})[_0xe134('0x44')](respondWithResult(_0x586245,0xc9))[_0xe134('0x48')](handleError(_0x586245,null));};exports['update']=function(_0x12cd50,_0x51b1b6){if(_0x12cd50[_0xe134('0x4d')]['id']){delete _0x12cd50[_0xe134('0x4d')]['id'];}return db[_0xe134('0x2e')][_0xe134('0x4b')]({'where':{'id':_0x12cd50['params']['id']}})['then'](handleEntityNotFound(_0x51b1b6,null))[_0xe134('0x44')](saveUpdates(_0x12cd50['body'],null))[_0xe134('0x44')](respondWithResult(_0x51b1b6,null))[_0xe134('0x48')](handleError(_0x51b1b6,null));};exports[_0xe134('0x2b')]=function(_0x107c70,_0x38cd6a){return db['ChatInternalMessage'][_0xe134('0x4b')]({'where':{'id':_0x107c70['params']['id']}})[_0xe134('0x44')](handleEntityNotFound(_0x38cd6a,null))['then'](removeEntity(_0x38cd6a,null))['catch'](handleError(_0x38cd6a,null));};exports[_0xe134('0x4e')]=function(_0x2300cc,_0x673720){return db['ChatInternalMessage'][_0xe134('0x4e')]()[_0xe134('0x44')](respondWithResult(_0x673720,null))[_0xe134('0x48')](handleError(_0x673720,null));};function wrapUser(_0x3630d8){return function(_0x317948){var _0x5d03c0=_0x3630d8[_0xe134('0x4f')]({'plain':!![]});_0x5d03c0[_0xe134('0x50')]=[];if(_0x317948){_0x5d03c0['lastMessageAt']=_0x317948[_0xe134('0x51')];_0x5d03c0[_0xe134('0x52')]=_0x317948;}else{_0x5d03c0[_0xe134('0x53')]=moment(0x0)[_0xe134('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d03c0[_0xe134('0x52')]={};}return _0x5d03c0;};}exports[_0xe134('0x55')]=function(_0x9d4edb,_0x4b1b8a,_0x2b62ae){var _0x37d500=[];return db[_0xe134('0x56')][_0xe134('0x47')]({'where':{'role':[_0xe134('0x57'),_0xe134('0x58'),_0xe134('0x59')]},'attributes':['id',_0xe134('0x5a'),_0xe134('0x2d'),_0xe134('0x5b'),'userpic',_0xe134('0x5c'),'online',_0xe134('0x5d'),_0xe134('0x5e'),'showWebBar'],'order':qs[_0xe134('0x3d')](_0xe134('0x5f')),'include':[{'model':db[_0xe134('0x60')],'as':_0xe134('0x61'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})['then'](function(_0x20ab73){if(_0x20ab73){var _0xa46d2e=_0x9d4edb[_0xe134('0x59')][_0xe134('0x4f')]({'plain':!![]});if(!_0xa46d2e)throw new Error(_0xe134('0x62'));if(_0xa46d2e['role']===_0xe134('0x59')){return db[_0xe134('0x63')][_0xe134('0x4b')]({'where':{'name':_0xe134('0x64'),'userProfileId':_0xa46d2e[_0xe134('0x65')]},'raw':!![]})['then'](function(_0x13c7fb){if(_0x13c7fb){if(_0x13c7fb[_0xe134('0x66')]===0x0){return db[_0xe134('0x67')][_0xe134('0x47')]({'where':{'sectionId':_0x13c7fb['id']},'raw':!![]})[_0xe134('0x44')](function(_0x443767){var _0x164f97=[];if(_[_0xe134('0x68')](_0x443767)){_0x164f97=_[_0xe134('0x40')](_0x20ab73,function(_0x46359d){if(_0x46359d[_0xe134('0x5b')]!=='agent'){return _0x46359d;}});return _0x164f97;}else{for(var _0x56926=0x0;_0x56926<_0x20ab73[_0xe134('0x3a')];_0x56926++){var _0x32b9e7=_0x20ab73[_0x56926];if(_0x32b9e7['role']===_0xe134('0x57')){var _0x56c51f=_[_0xe134('0x4b')](_0x443767,function(_0x34ae61){return _0x34ae61[_0xe134('0x69')]===_0x32b9e7['id'];});if(_0x56c51f)_0x164f97[_0xe134('0x6a')](_0x32b9e7);}else{_0x164f97['push'](_0x32b9e7);}}return _0x164f97;}});}else{return _0x20ab73;}}else{var _0x1ee226=_['filter'](_0x20ab73,function(_0x124589){if(_0x124589[_0xe134('0x5b')]!=='agent'){return _0x124589;}});return _0x1ee226;}});}else{return _0x20ab73;}}})[_0xe134('0x44')](function(_0x4accfb){var _0x24d478=[];if(_0x4accfb){_0x37d500=_0x4accfb;for(var _0x16d635=0x0;_0x16d635<_0x4accfb[_0xe134('0x3a')];_0x16d635+=0x1){_0x37d500[_0x16d635][_0xe134('0x50')]=[];_0x24d478[_0xe134('0x6a')](db[_0xe134('0x2e')][_0xe134('0x4b')]({'where':{'FromId':[_0x9d4edb[_0xe134('0x59')]['id'],_0x4accfb[_0x16d635]['id']],'ToId':[_0x9d4edb[_0xe134('0x59')]['id'],_0x4accfb[_0x16d635]['id']],'ChatGroupId':null},'attributes':['id',_0xe134('0x51'),_0xe134('0x6b'),'ToId','read','body'],'order':qs[_0xe134('0x3d')](_0xe134('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe134('0x44')](wrapUser(_0x4accfb[_0x16d635])));}return BPromise[_0xe134('0x6d')](_0x24d478);}return[];})[_0xe134('0x44')](function(_0x204da4){return{'rows':_0x204da4,'count':_0x204da4['length']};})[_0xe134('0x44')](respondWithResult(_0x4b1b8a,null))[_0xe134('0x48')](handleError(_0x4b1b8a,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index ad961d9..64a7cbc 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 _0x7531=['exports','events','../../mysqldb','ChatInternalMessage','remove','emit','hasOwnProperty','hook'];(function(_0x287f60,_0x31a525){var _0x36b70a=function(_0x435047){while(--_0x435047){_0x287f60['push'](_0x287f60['shift']());}};_0x36b70a(++_0x31a525);}(_0x7531,0x69));var _0x1753=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7531[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x1753('0x0'));var ChatInternalMessage=require(_0x1753('0x1'))['db'][_0x1753('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1753('0x3')};function emitEvent(_0x1ecba8){return function(_0x5595df,_0x22192f,_0x24b503){ChatInternalMessageEvents['emit'](_0x1ecba8+':'+_0x5595df['id'],_0x5595df);ChatInternalMessageEvents[_0x1753('0x4')](_0x1ecba8,_0x5595df);_0x24b503(null);};}for(var e in events){if(events[_0x1753('0x5')](e)){var event=events[e];ChatInternalMessage[_0x1753('0x6')](e,emitEvent(event));}}module[_0x1753('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xd84b=['remove','emit','hasOwnProperty','hook','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x32ef14,_0x370a06){var _0x484707=function(_0x38f5eb){while(--_0x38f5eb){_0x32ef14['push'](_0x32ef14['shift']());}};_0x484707(++_0x370a06);}(_0xd84b,0x177));var _0xbd84=function(_0x5460a4,_0x45dba2){_0x5460a4=_0x5460a4-0x0;var _0x178111=_0xd84b[_0x5460a4];return _0x178111;};'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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b9f77ec..095391b 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 _0x0713=['../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3071('0xc'),'collate':_0x3071('0xd')});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','../../config/logger','api','moment','bluebird'];(function(_0x4c2240,_0x42fe61){var _0x3c8a98=function(_0x46b2e2){while(--_0x46b2e2){_0x4c2240['push'](_0x4c2240['shift']());}};_0x3c8a98(++_0x42fe61);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0xcb91[_0x3dea7d];return _0x53919a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1cb9('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 02d4f99..b62e893 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 _0xdaff=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x526c57,_0x27f0ad){var _0x3479ed=function(_0x37914d){while(--_0x37914d){_0x526c57['push'](_0x526c57['shift']());}};_0x3479ed(++_0x27f0ad);}(_0xdaff,0x8a));var _0xfdaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdaff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfdaf('0x0'));var util=require(_0xfdaf('0x1'));var moment=require(_0xfdaf('0x2'));var BPromise=require('bluebird');var rs=require(_0xfdaf('0x3'));var fs=require('fs');var Redis=require(_0xfdaf('0x4'));var db=require(_0xfdaf('0x5'))['db'];var utils=require(_0xfdaf('0x6'));var logger=require(_0xfdaf('0x7'))(_0xfdaf('0x8'));var config=require(_0xfdaf('0x9'));var jayson=require(_0xfdaf('0xa'));var client=jayson[_0xfdaf('0xb')][_0xfdaf('0xc')]({'port':0x232a});config[_0xfdaf('0xd')]=_[_0xfdaf('0xe')](config[_0xfdaf('0xd')],{'host':_0xfdaf('0xf'),'port':0x18eb});var socket=require(_0xfdaf('0x10'))(new Redis(config[_0xfdaf('0xd')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3090f9,_0x584b54,_0x308bee){return new BPromise(function(_0x4a9587,_0x5af5bf){return client[_0xfdaf('0x11')](_0x3090f9,_0x308bee)[_0xfdaf('0x12')](function(_0x1817d8){logger[_0xfdaf('0x13')](_0xfdaf('0x14'),_0x584b54,_0xfdaf('0x15'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x584b54,'request\x20sent',JSON[_0xfdaf('0x16')](_0x1817d8));if(_0x1817d8[_0xfdaf('0x17')]){if(_0x1817d8[_0xfdaf('0x17')][_0xfdaf('0x18')]===0x1f4){logger[_0xfdaf('0x17')](_0xfdaf('0x14'),_0x584b54,_0x1817d8[_0xfdaf('0x17')][_0xfdaf('0x19')]);return _0x5af5bf(_0x1817d8[_0xfdaf('0x17')][_0xfdaf('0x19')]);}logger[_0xfdaf('0x17')](_0xfdaf('0x14'),_0x584b54,_0x1817d8[_0xfdaf('0x17')]['message']);return _0x4a9587(_0x1817d8[_0xfdaf('0x17')][_0xfdaf('0x19')]);}else{logger['info'](_0xfdaf('0x14'),_0x584b54,_0xfdaf('0x15'));_0x4a9587(_0x1817d8[_0xfdaf('0x1a')]['message']);}})[_0xfdaf('0x1b')](function(_0x3afe4a){logger[_0xfdaf('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x584b54,_0x3afe4a);_0x5af5bf(_0x3afe4a);});});} \ No newline at end of file +var _0xd863=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd863,0xb8));var _0x3d86=function(_0x4696a8,_0x8703eb){_0x4696a8=_0x4696a8-0x0;var _0x72a7a4=_0xd863[_0x4696a8];return _0x72a7a4;};'use strict';var _=require(_0x3d86('0x0'));var util=require('util');var moment=require(_0x3d86('0x1'));var BPromise=require(_0x3d86('0x2'));var rs=require(_0x3d86('0x3'));var fs=require('fs');var Redis=require(_0x3d86('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d86('0x5'));var logger=require(_0x3d86('0x6'))(_0x3d86('0x7'));var config=require(_0x3d86('0x8'));var jayson=require(_0x3d86('0x9'));var client=jayson[_0x3d86('0xa')][_0x3d86('0xb')]({'port':0x232a});config[_0x3d86('0xc')]=_[_0x3d86('0xd')](config[_0x3d86('0xc')],{'host':_0x3d86('0xe'),'port':0x18eb});var socket=require(_0x3d86('0xf'))(new Redis(config[_0x3d86('0xc')]));require('./chatInternalMessage.socket')[_0x3d86('0x10')](socket);function respondWithRpcPromise(_0x11471e,_0x51239c,_0x23b8b0){return new BPromise(function(_0x15528a,_0x472a44){return client[_0x3d86('0x11')](_0x11471e,_0x23b8b0)[_0x3d86('0x12')](function(_0x353e08){logger['info'](_0x3d86('0x13'),_0x51239c,_0x3d86('0x14'));logger[_0x3d86('0x15')](_0x3d86('0x16'),_0x51239c,_0x3d86('0x14'),JSON[_0x3d86('0x17')](_0x353e08));if(_0x353e08[_0x3d86('0x18')]){if(_0x353e08[_0x3d86('0x18')]['code']===0x1f4){logger['error'](_0x3d86('0x13'),_0x51239c,_0x353e08[_0x3d86('0x18')][_0x3d86('0x19')]);return _0x472a44(_0x353e08['error'][_0x3d86('0x19')]);}logger[_0x3d86('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x51239c,_0x353e08[_0x3d86('0x18')]['message']);return _0x15528a(_0x353e08[_0x3d86('0x18')]['message']);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x51239c,_0x3d86('0x14'));_0x15528a(_0x353e08[_0x3d86('0x1a')][_0x3d86('0x19')]);}})['catch'](function(_0x57fd73){logger['error'](_0x3d86('0x13'),_0x51239c,_0x57fd73);_0x472a44(_0x57fd73);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index a417c75..f96f45a 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 _0x34e5=['update','emit','removeListener','register','length','chatInternalMessage:','save'];(function(_0x2b504e,_0x3a65b7){var _0x185dc0=function(_0x4dade6){while(--_0x4dade6){_0x2b504e['push'](_0x2b504e['shift']());}};_0x185dc0(++_0x3a65b7);}(_0x34e5,0x172));var _0x534e=function(_0x1ba97d,_0x1adf12){_0x1ba97d=_0x1ba97d-0x0;var _0xe510c0=_0x34e5[_0x1ba97d];return _0xe510c0;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x534e('0x0'),'remove',_0x534e('0x1')];function createListener(_0x467e3e,_0x425ae8){return function(_0x246650){_0x425ae8[_0x534e('0x2')](_0x467e3e,_0x246650);};}function removeListener(_0x50b790,_0x11a158){return function(){ChatInternalMessageEvents[_0x534e('0x3')](_0x50b790,_0x11a158);};}exports[_0x534e('0x4')]=function(_0x117f0c){for(var _0x436a92=0x0,_0x2d0370=events[_0x534e('0x5')];_0x436a92<_0x2d0370;_0x436a92++){var _0x5620d4=events[_0x436a92];var _0x24d562=createListener(_0x534e('0x6')+_0x5620d4,_0x117f0c);ChatInternalMessageEvents['on'](_0x5620d4,_0x24d562);}}; \ No newline at end of file +var _0x225c=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','emit','removeListener'];(function(_0x5f0ff8,_0x4d6017){var _0x4da2d0=function(_0x28a53f){while(--_0x28a53f){_0x5f0ff8['push'](_0x5f0ff8['shift']());}};_0x4da2d0(++_0x4d6017);}(_0x225c,0x106));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var ChatInternalMessageEvents=require(_0xc225('0x0'));var events=[_0xc225('0x1'),'remove','update'];function createListener(_0x258ead,_0x4f2fa0){return function(_0xa2ac1d){_0x4f2fa0[_0xc225('0x2')](_0x258ead,_0xa2ac1d);};}function removeListener(_0x4778ea,_0x41eccd){return function(){ChatInternalMessageEvents[_0xc225('0x3')](_0x4778ea,_0x41eccd);};}exports[_0xc225('0x4')]=function(_0x22d294){for(var _0x54be3a=0x0,_0x143eab=events[_0xc225('0x5')];_0x54be3a<_0x143eab;_0x54be3a++){var _0x409c9f=events[_0x54be3a];var _0x2451fd=createListener(_0xc225('0x6')+_0x409c9f,_0x22d294);ChatInternalMessageEvents['on'](_0x409c9f,_0x2451fd);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 68a9d01..7a3d596 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 _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x44e083,_0x43dc23){var _0x1d6f28=function(_0x284d35){while(--_0x284d35){_0x44e083['push'](_0x44e083['shift']());}};_0x1d6f28(++_0x43dc23);}(_0x70e0,0x17b));var _0x070e=function(_0x347d1e,_0x443064){_0x347d1e=_0x347d1e-0x0;var _0x2d61f1=_0x70e0[_0x347d1e];return _0x2d61f1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file +var _0xd8b0=['put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','describe','isAuthenticated','getUsers','/:id','show','post'];(function(_0x5f05a3,_0x293e95){var _0x20037f=function(_0x5b40aa){while(--_0x5b40aa){_0x5f05a3['push'](_0x5f05a3['shift']());}};_0x20037f(++_0x293e95);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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')]('/users',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0xb')](),controller['create']);router[_0x0d8b('0x10')]('/:id',controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);module[_0x0d8b('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 1db8f8d..9bc5d8f 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 _0x9da8=['ENUM','out','DATE','TEXT','sequelize','BOOLEAN'];(function(_0xcd88ef,_0x386711){var _0x7ccd8d=function(_0x37f413){while(--_0x37f413){_0xcd88ef['push'](_0xcd88ef['shift']());}};_0x7ccd8d(++_0x386711);}(_0x9da8,0x10c));var _0x89da=function(_0x9e3c47,_0x27fe68){_0x9e3c47=_0x9e3c47-0x0;var _0x1f1856=_0x9da8[_0x9e3c47];return _0x1f1856;};'use strict';var Sequelize=require(_0x89da('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x89da('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0x89da('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x89da('0x2')]('in',_0x89da('0x3')),'defaultValue':_0x89da('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x89da('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x89da('0x5')]}}; \ No newline at end of file +var _0x8948=['out','DATE','STRING','TEXT','sequelize','exports','medium','BOOLEAN'];(function(_0x39d1ca,_0x1eaf3f){var _0x478980=function(_0x50be8b){while(--_0x50be8b){_0x39d1ca['push'](_0x39d1ca['shift']());}};_0x478980(++_0x1eaf3f);}(_0x8948,0x1a4));var _0x8894=function(_0x395c7c,_0x47c532){_0x395c7c=_0x395c7c-0x0;var _0x9bdd26=_0x8948[_0x395c7c];return _0x9bdd26;};'use strict';var Sequelize=require(_0x8894('0x0'));module[_0x8894('0x1')]={'body':{'type':Sequelize['TEXT'](_0x8894('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8894('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8894('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8894('0x4')),'defaultValue':_0x8894('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8894('0x5')]},'providerName':{'type':Sequelize[_0x8894('0x6')]},'providerResponse':{'type':Sequelize[_0x8894('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index c6b9e68..ba8cb3f 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 _0x4133=['acceptmessage','parse','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','event','rejectmessage','html-pdf','zip-dir','fast-json-patch','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','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','./chatMessage.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','name','send','index','map','ChatMessage','fieldName','type','keys','query','filters','model','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','show','params','rawAttributes','fields','options','find','create','body','update','destroy','describe','../../config/logger','chat-interactions','accept','chat','read','readAt','UserId','agent','CmContact','get','ChatInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','manual','interface','channel','EventManager'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4133,0x17a));var _0x3413=function(_0x5cd1e0,_0x18f7a4){_0x5cd1e0=_0x5cd1e0-0x0;var _0x1cbaab=_0x4133[_0x5cd1e0];return _0x1cbaab;};'use strict';var pdf=require(_0x3413('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3413('0x1'));var jsonpatch=require(_0x3413('0x2'));var rp=require(_0x3413('0x3'));var moment=require('moment');var BPromise=require(_0x3413('0x4'));var Mustache=require(_0x3413('0x5'));var util=require(_0x3413('0x6'));var path=require(_0x3413('0x7'));var sox=require(_0x3413('0x8'));var csv=require(_0x3413('0x9'));var ejs=require(_0x3413('0xa'));var fs=require('fs');var _=require(_0x3413('0xb'));var squel=require(_0x3413('0xc'));var crypto=require(_0x3413('0xd'));var jsforce=require(_0x3413('0xe'));var deskjs=require(_0x3413('0xf'));var toCsv=require(_0x3413('0x9'));var querystring=require(_0x3413('0x10'));var Papa=require(_0x3413('0x11'));var Redis=require(_0x3413('0x12'));var authService=require(_0x3413('0x13'));var qs=require(_0x3413('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3413('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3413('0x16'));var licenseUtil=require(_0x3413('0x17'));var db=require(_0x3413('0x18'))['db'];config[_0x3413('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3413('0x19')]));require(_0x3413('0x1a'))[_0x3413('0x1b')](socket);var jayson=require(_0x3413('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x3413('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101e4e,_0x58d4c8,_0x5250aa,_0x271269){return new BPromise(function(_0x8c988d,_0x336f6e){var _0x1f917a=_0x271269||client;return _0x1f917a[_0x3413('0x1e')](_0x101e4e,_0x5250aa)[_0x3413('0x1f')](function(_0x1bb9a7){logger[_0x3413('0x20')]('ChatMessage,\x20%s,\x20%s',_0x58d4c8,_0x3413('0x21'));logger[_0x3413('0x22')](_0x3413('0x23'),_0x58d4c8,_0x3413('0x21'),JSON['stringify'](_0x1bb9a7));if(_0x1bb9a7['error']){if(_0x1bb9a7[_0x3413('0x24')][_0x3413('0x25')]===0x1f4){logger['error'](_0x3413('0x26'),_0x58d4c8,_0x1bb9a7['error']['message']);return _0x336f6e(_0x1bb9a7[_0x3413('0x24')][_0x3413('0x27')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x58d4c8,_0x1bb9a7['error'][_0x3413('0x27')]);return _0x8c988d(_0x1bb9a7['error'][_0x3413('0x27')]);}else{logger[_0x3413('0x20')](_0x3413('0x26'),_0x58d4c8,_0x3413('0x21'));_0x8c988d(_0x1bb9a7['result'][_0x3413('0x27')]);}})[_0x3413('0x28')](function(_0x299d05){logger[_0x3413('0x24')](_0x3413('0x26'),_0x58d4c8,_0x299d05);_0x336f6e(_0x299d05);});});}function respondWithStatusCode(_0x439812,_0x24fa1e){_0x24fa1e=_0x24fa1e||0xcc;return function(_0x4c40f2){if(_0x4c40f2){return _0x439812[_0x3413('0x29')](_0x24fa1e);}return _0x439812['status'](_0x24fa1e)[_0x3413('0x2a')]();};}function respondWithResult(_0x1f902a,_0x4cb8c7){_0x4cb8c7=_0x4cb8c7||0xc8;return function(_0xc9e022){if(_0xc9e022){return _0x1f902a[_0x3413('0x2b')](_0x4cb8c7)[_0x3413('0x2c')](_0xc9e022);}};}function respondWithFilteredResult(_0x1cab54,_0x3085fc){return function(_0x307532){if(_0x307532){var _0x2485b4=_0x307532[_0x3413('0x2d')],_0x4b7a02=_0x3085fc[_0x3413('0x2e')],_0x4039aa=_0x3085fc[_0x3413('0x2e')]+_0x3085fc[_0x3413('0x2f')],_0x43d978;if(_0x4039aa>=_0x2485b4){_0x4039aa=_0x2485b4;_0x43d978=0xc8;}else{_0x43d978=0xce;}_0x1cab54[_0x3413('0x2b')](_0x43d978);return _0x1cab54[_0x3413('0x30')](_0x3413('0x31'),_0x4b7a02+'-'+_0x4039aa+'/'+_0x2485b4)[_0x3413('0x2c')](_0x307532);}return null;};}function patchUpdates(_0x7cee43){return function(_0x519504){try{jsonpatch[_0x3413('0x32')](_0x519504,_0x7cee43,!![]);}catch(_0x331151){return BPromise[_0x3413('0x33')](_0x331151);}return _0x519504[_0x3413('0x34')]();};}function saveUpdates(_0x405b10,_0x1a5ece){return function(_0x9bedc7){if(_0x9bedc7){return _0x9bedc7['update'](_0x405b10)[_0x3413('0x1f')](function(_0x5a5193){return _0x5a5193;});}return null;};}function removeEntity(_0x4a099c,_0x4d2a4e){return function(_0x26c911){if(_0x26c911){return _0x26c911['destroy']()[_0x3413('0x1f')](function(){_0x4a099c[_0x3413('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf89c9c,_0x5ba33e){return function(_0x1c3ee9){if(!_0x1c3ee9){_0xf89c9c['sendStatus'](0x194);}return _0x1c3ee9;};}function handleError(_0x6046d0,_0x170581){_0x170581=_0x170581||0x1f4;return function(_0x3dc8f6){logger['error'](_0x3dc8f6['stack']);if(_0x3dc8f6[_0x3413('0x35')]){delete _0x3dc8f6[_0x3413('0x35')];}_0x6046d0['status'](_0x170581)[_0x3413('0x36')](_0x3dc8f6);};}exports[_0x3413('0x37')]=function(_0x1dcfc2,_0x418797){var _0x2364c9={},_0x2174dc={},_0x184cab={'count':0x0,'rows':[]};var _0x3a07e3=_[_0x3413('0x38')](db[_0x3413('0x39')]['rawAttributes'],function(_0x54f5e9){return{'name':_0x54f5e9[_0x3413('0x3a')],'type':_0x54f5e9[_0x3413('0x3b')]['key']};});_0x2174dc['model']=_[_0x3413('0x38')](_0x3a07e3,'name');_0x2174dc['query']=_[_0x3413('0x3c')](_0x1dcfc2[_0x3413('0x3d')]);_0x2174dc[_0x3413('0x3e')]=_['intersection'](_0x2174dc[_0x3413('0x3f')],_0x2174dc[_0x3413('0x3d')]);_0x2364c9['attributes']=_[_0x3413('0x40')](_0x2174dc[_0x3413('0x3f')],qs['fields'](_0x1dcfc2[_0x3413('0x3d')]['fields']));_0x2364c9[_0x3413('0x41')]=_0x2364c9[_0x3413('0x41')][_0x3413('0x42')]?_0x2364c9[_0x3413('0x41')]:_0x2174dc['model'];if(!_0x1dcfc2[_0x3413('0x3d')][_0x3413('0x43')](_0x3413('0x44'))){_0x2364c9[_0x3413('0x2f')]=qs[_0x3413('0x2f')](_0x1dcfc2[_0x3413('0x3d')][_0x3413('0x2f')]);_0x2364c9[_0x3413('0x2e')]=qs[_0x3413('0x2e')](_0x1dcfc2[_0x3413('0x3d')][_0x3413('0x2e')]);}_0x2364c9[_0x3413('0x45')]=qs[_0x3413('0x46')](_0x1dcfc2[_0x3413('0x3d')][_0x3413('0x46')]);_0x2364c9[_0x3413('0x47')]=qs[_0x3413('0x3e')](_[_0x3413('0x48')](_0x1dcfc2[_0x3413('0x3d')],_0x2174dc['filters']),_0x3a07e3);if(_0x1dcfc2[_0x3413('0x3d')][_0x3413('0x49')]){_0x2364c9[_0x3413('0x47')]=_['merge'](_0x2364c9[_0x3413('0x47')],{'$or':_[_0x3413('0x38')](_0x3a07e3,function(_0x592778){if(_0x592778[_0x3413('0x3b')]!=='VIRTUAL'){var _0x381864={};_0x381864[_0x592778[_0x3413('0x35')]]={'$like':'%'+_0x1dcfc2['query'][_0x3413('0x49')]+'%'};return _0x381864;}})});}_0x2364c9=_[_0x3413('0x4a')]({},_0x2364c9,_0x1dcfc2['options']);var _0x1956c7={'where':_0x2364c9[_0x3413('0x47')]};return db['ChatMessage'][_0x3413('0x2d')](_0x1956c7)['then'](function(_0x4c6d6b){_0x184cab[_0x3413('0x2d')]=_0x4c6d6b;if(_0x1dcfc2[_0x3413('0x3d')][_0x3413('0x4b')]){_0x2364c9[_0x3413('0x4c')]=[{'all':!![]}];}return db[_0x3413('0x39')]['findAll'](_0x2364c9);})[_0x3413('0x1f')](function(_0x2724b4){_0x184cab[_0x3413('0x4d')]=_0x2724b4;return _0x184cab;})[_0x3413('0x1f')](respondWithFilteredResult(_0x418797,_0x2364c9))['catch'](handleError(_0x418797,null));};exports[_0x3413('0x4e')]=function(_0x75ec40,_0x24a008){var _0x32b942={'raw':!![],'where':{'id':_0x75ec40[_0x3413('0x4f')]['id']}},_0x59807c={};_0x59807c[_0x3413('0x3f')]=_[_0x3413('0x3c')](db[_0x3413('0x39')][_0x3413('0x50')]);_0x59807c[_0x3413('0x3d')]=_['keys'](_0x75ec40['query']);_0x59807c['filters']=_[_0x3413('0x40')](_0x59807c['model'],_0x59807c[_0x3413('0x3d')]);_0x32b942[_0x3413('0x41')]=_['intersection'](_0x59807c[_0x3413('0x3f')],qs['fields'](_0x75ec40['query'][_0x3413('0x51')]));_0x32b942[_0x3413('0x41')]=_0x32b942[_0x3413('0x41')][_0x3413('0x42')]?_0x32b942[_0x3413('0x41')]:_0x59807c[_0x3413('0x3f')];if(_0x75ec40[_0x3413('0x3d')]['includeAll']){_0x32b942['include']=[{'all':!![]}];}_0x32b942=_[_0x3413('0x4a')]({},_0x32b942,_0x75ec40[_0x3413('0x52')]);return db[_0x3413('0x39')][_0x3413('0x53')](_0x32b942)[_0x3413('0x1f')](handleEntityNotFound(_0x24a008,null))[_0x3413('0x1f')](respondWithResult(_0x24a008,null))['catch'](handleError(_0x24a008,null));};exports[_0x3413('0x54')]=function(_0x118070,_0x105541){return db[_0x3413('0x39')]['create'](_0x118070[_0x3413('0x55')],{})[_0x3413('0x1f')](respondWithResult(_0x105541,0xc9))[_0x3413('0x28')](handleError(_0x105541,null));};exports[_0x3413('0x56')]=function(_0x39943a,_0x197298){if(_0x39943a[_0x3413('0x55')]['id']){delete _0x39943a[_0x3413('0x55')]['id'];}return db[_0x3413('0x39')][_0x3413('0x53')]({'where':{'id':_0x39943a[_0x3413('0x4f')]['id']}})[_0x3413('0x1f')](handleEntityNotFound(_0x197298,null))[_0x3413('0x1f')](saveUpdates(_0x39943a[_0x3413('0x55')],null))[_0x3413('0x1f')](respondWithResult(_0x197298,null))[_0x3413('0x28')](handleError(_0x197298,null));};exports[_0x3413('0x57')]=function(_0x3c0dcc,_0xf32e4a){return db[_0x3413('0x39')][_0x3413('0x53')]({'where':{'id':_0x3c0dcc[_0x3413('0x4f')]['id']}})[_0x3413('0x1f')](handleEntityNotFound(_0xf32e4a,null))[_0x3413('0x1f')](removeEntity(_0xf32e4a,null))[_0x3413('0x28')](handleError(_0xf32e4a,null));};exports[_0x3413('0x58')]=function(_0x37934f,_0x5f11b0){return db[_0x3413('0x39')]['describe']()[_0x3413('0x1f')](respondWithResult(_0x5f11b0,null))['catch'](handleError(_0x5f11b0,null));};var interaction_log=require(_0x3413('0x59'))(_0x3413('0x5a'));exports[_0x3413('0x5b')]=function(_0x1c58ea,_0x3a7ecf,_0x3050da){var _0x42f84f={'agent':{},'channel':_0x3413('0x5c')};if(_0x1c58ea[_0x3413('0x55')]['id']){delete _0x1c58ea[_0x3413('0x55')]['id'];}_0x1c58ea[_0x3413('0x55')][_0x3413('0x5d')]=!![];_0x1c58ea['body'][_0x3413('0x5e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1c58ea[_0x3413('0x55')][_0x3413('0x5f')]=_0x1c58ea[_0x3413('0x55')][_0x3413('0x5f')]||_0x1c58ea['user']['id'];_0x42f84f[_0x3413('0x60')]['id']=_0x1c58ea[_0x3413('0x55')][_0x3413('0x5f')];return db['ChatMessage']['find']({'where':{'id':_0x1c58ea['params']['id'],'UserId':null},'include':[{'model':db[_0x3413('0x61')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x3a7ecf,null))['then'](saveUpdates(_0x1c58ea[_0x3413('0x55')],null))[_0x3413('0x1f')](function(_0x2b108a){if(_0x2b108a){_0x42f84f[_0x3413('0x27')]=_0x2b108a[_0x3413('0x62')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x2b108a[_0x3413('0x63')]}});}return null;})[_0x3413('0x1f')](handleEntityNotFound(_0x3a7ecf,null))['then'](function(_0xef5e22){if(_0xef5e22){return _0xef5e22[_0x3413('0x56')]({'UserId':_0x1c58ea[_0x3413('0x55')][_0x3413('0x5f')],'read1stAt':_['isNil'](_0xef5e22[_0x3413('0x64')])?moment()[_0x3413('0x65')](_0x3413('0x66')):undefined});}return null;})[_0x3413('0x1f')](function(_0x56a765){if(_0x56a765){_0x42f84f[_0x3413('0x67')]=_0x56a765[_0x3413('0x62')]({'plain':!![]});interaction_log[_0x3413('0x20')](_0x3413('0x68'),_0x1c58ea['user']['id'],_0x1c58ea[_0x3413('0x69')]['name'],_0x1c58ea['user'][_0x3413('0x6a')],_0x42f84f[_0x3413('0x67')]['id'],_0x1c58ea[_0x3413('0x55')]?JSON['stringify'](_0x1c58ea[_0x3413('0x55')]):_0x3413('0x6b'));return respondWithRpcPromise(_0x3413('0x6c'),_0x3413('0x6d'),_0x42f84f);}return null;})[_0x3413('0x1f')](function(_0x46379f){if(_0x46379f){if(_0x1c58ea[_0x3413('0x55')][_0x3413('0x6e')]){_0x42f84f[_0x3413('0x27')][_0x3413('0x6f')]=util[_0x3413('0x65')]('SIP/%s',_0x1c58ea[_0x3413('0x69')][_0x3413('0x35')]);_0x42f84f[_0x3413('0x27')]['channel']=_0x42f84f[_0x3413('0x70')];_0x42f84f[_0x3413('0x27')]['event']=_0x3413('0x5b');return respondWithRpcPromise(_0x3413('0x71'),_0x3413('0x71'),{'event':_0x3413('0x72'),'message':_[_0x3413('0x4a')](_0x42f84f[_0x3413('0x27')],JSON[_0x3413('0x73')](_0x42f84f[_0x3413('0x67')][_0x3413('0x74')]))},client9002)[_0x3413('0x1f')](function(){return _0x42f84f;});}return _0x42f84f;}return null;})[_0x3413('0x1f')](respondWithResult(_0x3a7ecf,null))[_0x3413('0x28')](handleError(_0x3a7ecf,null));};var interaction_log=require('../../config/logger')(_0x3413('0x5a'));exports['reject']=function(_0x3d28a5,_0x2492ec,_0x35d954){var _0x1b0a92={'agent':{},'channel':_0x3413('0x5c')};if(_0x3d28a5[_0x3413('0x55')]['id']){delete _0x3d28a5[_0x3413('0x55')]['id'];}_0x3d28a5['body']['UserId']=_0x3d28a5[_0x3413('0x55')][_0x3413('0x5f')]||_0x3d28a5[_0x3413('0x69')]['id'];_0x1b0a92[_0x3413('0x60')]['id']=_0x3d28a5['body']['UserId'];return db[_0x3413('0x39')]['find']({'where':{'id':_0x3d28a5[_0x3413('0x4f')]['id'],'UserId':null}})[_0x3413('0x1f')](handleEntityNotFound(_0x2492ec,null))['then'](function(_0x3a42d6){if(_0x3a42d6){_0x1b0a92[_0x3413('0x27')]=_0x3a42d6['get']({'plain':!![]});return db[_0x3413('0x75')]['find']({'where':{'id':_0x3a42d6[_0x3413('0x63')]}});}return null;})[_0x3413('0x1f')](handleEntityNotFound(_0x2492ec,null))[_0x3413('0x1f')](function(_0x4b5626){if(_0x4b5626){_0x1b0a92[_0x3413('0x67')]=_0x4b5626[_0x3413('0x62')]({'plain':!![]});interaction_log[_0x3413('0x20')](_0x3413('0x76'),_0x3d28a5['user']['id'],_0x3d28a5[_0x3413('0x69')]['name'],_0x3d28a5[_0x3413('0x69')][_0x3413('0x6a')],_0x1b0a92[_0x3413('0x67')]['id'],_0x3d28a5[_0x3413('0x55')]?JSON[_0x3413('0x77')](_0x3d28a5[_0x3413('0x55')]):_0x3413('0x6b'));return respondWithRpcPromise(_0x3413('0x78'),'rejectMessage',_0x1b0a92);}return null;})[_0x3413('0x1f')](function(_0x3c7140){if(_0x3c7140){_0x3c7140[_0x3413('0x27')][_0x3413('0x6f')]=util[_0x3413('0x65')]('SIP/%s',_0x3d28a5[_0x3413('0x69')]['name']);_0x3c7140[_0x3413('0x27')][_0x3413('0x70')]=_0x1b0a92[_0x3413('0x70')];_0x3c7140[_0x3413('0x27')][_0x3413('0x79')]=_0x3413('0x33');respondWithRpcPromise('EventManager',_0x3413('0x71'),{'event':_0x3413('0x7a'),'message':_0x3c7140[_0x3413('0x27')]},client9002);return _0x1b0a92;}return null;})[_0x3413('0x1f')](respondWithResult(_0x2492ec,null))[_0x3413('0x28')](handleError(_0x2492ec,null));}; \ No newline at end of file +var _0xe017=['YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','chat-interactions','accept','chat','read','readAt'];(function(_0x11e627,_0x38faa1){var _0x585e7d=function(_0x52c98f){while(--_0x52c98f){_0x11e627['push'](_0x11e627['shift']());}};_0x585e7d(++_0x38faa1);}(_0xe017,0x19d));var _0x7e01=function(_0xfebe97,_0x47faa3){_0xfebe97=_0xfebe97-0x0;var _0x5d7767=_0xe017[_0xfebe97];return _0x5d7767;};'use strict';var pdf=require(_0x7e01('0x0'));var emlformat=require(_0x7e01('0x1'));var rimraf=require(_0x7e01('0x2'));var zipdir=require(_0x7e01('0x3'));var jsonpatch=require(_0x7e01('0x4'));var rp=require(_0x7e01('0x5'));var moment=require(_0x7e01('0x6'));var BPromise=require(_0x7e01('0x7'));var Mustache=require(_0x7e01('0x8'));var util=require(_0x7e01('0x9'));var path=require('path');var sox=require(_0x7e01('0xa'));var csv=require(_0x7e01('0xb'));var ejs=require(_0x7e01('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7e01('0xd'));var jsforce=require(_0x7e01('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7e01('0xb'));var querystring=require(_0x7e01('0xf'));var Papa=require('papaparse');var Redis=require(_0x7e01('0x10'));var authService=require(_0x7e01('0x11'));var qs=require(_0x7e01('0x12'));var as=require(_0x7e01('0x13'));var hardwareService=require(_0x7e01('0x14'));var logger=require(_0x7e01('0x15'))(_0x7e01('0x16'));var utils=require(_0x7e01('0x17'));var config=require(_0x7e01('0x18'));var licenseUtil=require(_0x7e01('0x19'));var db=require('../../mysqldb')['db'];config[_0x7e01('0x1a')]=_[_0x7e01('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7e01('0x1c'))(new Redis(config[_0x7e01('0x1a')]));require(_0x7e01('0x1d'))[_0x7e01('0x1e')](socket);var jayson=require(_0x7e01('0x1f'));var client=jayson[_0x7e01('0x20')][_0x7e01('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x7e01('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2ec84b,_0xa7fd60,_0x59c614,_0xb79a8c){return new BPromise(function(_0x3ab9cc,_0xccf00c){var _0x15fd8f=_0xb79a8c||client;return _0x15fd8f[_0x7e01('0x22')](_0x2ec84b,_0x59c614)[_0x7e01('0x23')](function(_0x46823e){logger['info'](_0x7e01('0x24'),_0xa7fd60,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0xa7fd60,_0x7e01('0x25'),JSON[_0x7e01('0x26')](_0x46823e));if(_0x46823e[_0x7e01('0x27')]){if(_0x46823e['error'][_0x7e01('0x28')]===0x1f4){logger[_0x7e01('0x27')](_0x7e01('0x24'),_0xa7fd60,_0x46823e[_0x7e01('0x27')]['message']);return _0xccf00c(_0x46823e[_0x7e01('0x27')]['message']);}logger['error'](_0x7e01('0x24'),_0xa7fd60,_0x46823e['error']['message']);return _0x3ab9cc(_0x46823e[_0x7e01('0x27')][_0x7e01('0x29')]);}else{logger[_0x7e01('0x2a')](_0x7e01('0x24'),_0xa7fd60,_0x7e01('0x25'));_0x3ab9cc(_0x46823e[_0x7e01('0x2b')][_0x7e01('0x29')]);}})['catch'](function(_0x2cbddb){logger['error'](_0x7e01('0x24'),_0xa7fd60,_0x2cbddb);_0xccf00c(_0x2cbddb);});});}function respondWithStatusCode(_0x557ce1,_0x22ef77){_0x22ef77=_0x22ef77||0xcc;return function(_0x5dfa2e){if(_0x5dfa2e){return _0x557ce1[_0x7e01('0x2c')](_0x22ef77);}return _0x557ce1[_0x7e01('0x2d')](_0x22ef77)[_0x7e01('0x2e')]();};}function respondWithResult(_0x3498c5,_0x3c7f48){_0x3c7f48=_0x3c7f48||0xc8;return function(_0x54e858){if(_0x54e858){return _0x3498c5[_0x7e01('0x2d')](_0x3c7f48)[_0x7e01('0x2f')](_0x54e858);}};}function respondWithFilteredResult(_0x3fe020,_0x16d24a){return function(_0xe5aad4){if(_0xe5aad4){var _0x28a674=_0xe5aad4[_0x7e01('0x30')],_0x33d9f1=_0x16d24a[_0x7e01('0x31')],_0x3ce179=_0x16d24a[_0x7e01('0x31')]+_0x16d24a['limit'],_0x3d3f93;if(_0x3ce179>=_0x28a674){_0x3ce179=_0x28a674;_0x3d3f93=0xc8;}else{_0x3d3f93=0xce;}_0x3fe020[_0x7e01('0x2d')](_0x3d3f93);return _0x3fe020[_0x7e01('0x32')](_0x7e01('0x33'),_0x33d9f1+'-'+_0x3ce179+'/'+_0x28a674)[_0x7e01('0x2f')](_0xe5aad4);}return null;};}function patchUpdates(_0x5c8496){return function(_0x481934){try{jsonpatch[_0x7e01('0x34')](_0x481934,_0x5c8496,!![]);}catch(_0x3656ed){return BPromise[_0x7e01('0x35')](_0x3656ed);}return _0x481934['save']();};}function saveUpdates(_0xab483b,_0x462f46){return function(_0x5eba44){if(_0x5eba44){return _0x5eba44[_0x7e01('0x36')](_0xab483b)[_0x7e01('0x23')](function(_0x253300){return _0x253300;});}return null;};}function removeEntity(_0x376797,_0x166e37){return function(_0x4abc4a){if(_0x4abc4a){return _0x4abc4a[_0x7e01('0x37')]()['then'](function(){_0x376797[_0x7e01('0x2d')](0xcc)[_0x7e01('0x2e')]();});}};}function handleEntityNotFound(_0x14cf5d,_0x1d986b){return function(_0x4d9953){if(!_0x4d9953){_0x14cf5d['sendStatus'](0x194);}return _0x4d9953;};}function handleError(_0x5abde5,_0x1c7dbd){_0x1c7dbd=_0x1c7dbd||0x1f4;return function(_0xac7c9b){logger[_0x7e01('0x27')](_0xac7c9b['stack']);if(_0xac7c9b[_0x7e01('0x38')]){delete _0xac7c9b[_0x7e01('0x38')];}_0x5abde5[_0x7e01('0x2d')](_0x1c7dbd)[_0x7e01('0x39')](_0xac7c9b);};}exports[_0x7e01('0x3a')]=function(_0x3a05bf,_0x2a1d85){var _0xb3f405={},_0x3da6dc={},_0x2123bb={'count':0x0,'rows':[]};var _0x44b1b9=_[_0x7e01('0x3b')](db[_0x7e01('0x3c')][_0x7e01('0x3d')],function(_0x3f08d6){return{'name':_0x3f08d6[_0x7e01('0x3e')],'type':_0x3f08d6[_0x7e01('0x3f')][_0x7e01('0x40')]};});_0x3da6dc[_0x7e01('0x41')]=_[_0x7e01('0x3b')](_0x44b1b9,'name');_0x3da6dc[_0x7e01('0x42')]=_['keys'](_0x3a05bf[_0x7e01('0x42')]);_0x3da6dc[_0x7e01('0x43')]=_[_0x7e01('0x44')](_0x3da6dc['model'],_0x3da6dc['query']);_0xb3f405[_0x7e01('0x45')]=_[_0x7e01('0x44')](_0x3da6dc[_0x7e01('0x41')],qs['fields'](_0x3a05bf[_0x7e01('0x42')][_0x7e01('0x46')]));_0xb3f405[_0x7e01('0x45')]=_0xb3f405[_0x7e01('0x45')][_0x7e01('0x47')]?_0xb3f405[_0x7e01('0x45')]:_0x3da6dc[_0x7e01('0x41')];if(!_0x3a05bf[_0x7e01('0x42')][_0x7e01('0x48')](_0x7e01('0x49'))){_0xb3f405['limit']=qs['limit'](_0x3a05bf[_0x7e01('0x42')][_0x7e01('0x4a')]);_0xb3f405[_0x7e01('0x31')]=qs[_0x7e01('0x31')](_0x3a05bf[_0x7e01('0x42')][_0x7e01('0x31')]);}_0xb3f405[_0x7e01('0x4b')]=qs[_0x7e01('0x4c')](_0x3a05bf[_0x7e01('0x42')][_0x7e01('0x4c')]);_0xb3f405['where']=qs['filters'](_[_0x7e01('0x4d')](_0x3a05bf[_0x7e01('0x42')],_0x3da6dc[_0x7e01('0x43')]),_0x44b1b9);if(_0x3a05bf['query'][_0x7e01('0x4e')]){_0xb3f405['where']=_[_0x7e01('0x4f')](_0xb3f405[_0x7e01('0x50')],{'$or':_[_0x7e01('0x3b')](_0x44b1b9,function(_0x41937e){if(_0x41937e[_0x7e01('0x3f')]!==_0x7e01('0x51')){var _0x1c9f23={};_0x1c9f23[_0x41937e[_0x7e01('0x38')]]={'$like':'%'+_0x3a05bf['query']['filter']+'%'};return _0x1c9f23;}})});}_0xb3f405=_['merge']({},_0xb3f405,_0x3a05bf[_0x7e01('0x52')]);var _0x27017d={'where':_0xb3f405['where']};return db['ChatMessage'][_0x7e01('0x30')](_0x27017d)['then'](function(_0x5115e8){_0x2123bb[_0x7e01('0x30')]=_0x5115e8;if(_0x3a05bf[_0x7e01('0x42')][_0x7e01('0x53')]){_0xb3f405[_0x7e01('0x54')]=[{'all':!![]}];}return db[_0x7e01('0x3c')][_0x7e01('0x55')](_0xb3f405);})[_0x7e01('0x23')](function(_0x124556){_0x2123bb[_0x7e01('0x56')]=_0x124556;return _0x2123bb;})[_0x7e01('0x23')](respondWithFilteredResult(_0x2a1d85,_0xb3f405))[_0x7e01('0x57')](handleError(_0x2a1d85,null));};exports['show']=function(_0x262dc9,_0xe09d9d){var _0x611a24={'raw':!![],'where':{'id':_0x262dc9[_0x7e01('0x58')]['id']}},_0x41b964={};_0x41b964[_0x7e01('0x41')]=_[_0x7e01('0x59')](db[_0x7e01('0x3c')][_0x7e01('0x3d')]);_0x41b964[_0x7e01('0x42')]=_[_0x7e01('0x59')](_0x262dc9['query']);_0x41b964['filters']=_[_0x7e01('0x44')](_0x41b964[_0x7e01('0x41')],_0x41b964[_0x7e01('0x42')]);_0x611a24['attributes']=_[_0x7e01('0x44')](_0x41b964[_0x7e01('0x41')],qs[_0x7e01('0x46')](_0x262dc9[_0x7e01('0x42')]['fields']));_0x611a24[_0x7e01('0x45')]=_0x611a24[_0x7e01('0x45')][_0x7e01('0x47')]?_0x611a24[_0x7e01('0x45')]:_0x41b964[_0x7e01('0x41')];if(_0x262dc9[_0x7e01('0x42')]['includeAll']){_0x611a24[_0x7e01('0x54')]=[{'all':!![]}];}_0x611a24=_['merge']({},_0x611a24,_0x262dc9[_0x7e01('0x52')]);return db[_0x7e01('0x3c')][_0x7e01('0x5a')](_0x611a24)[_0x7e01('0x23')](handleEntityNotFound(_0xe09d9d,null))['then'](respondWithResult(_0xe09d9d,null))[_0x7e01('0x57')](handleError(_0xe09d9d,null));};exports[_0x7e01('0x5b')]=function(_0x14d155,_0x45b76e){return db[_0x7e01('0x3c')][_0x7e01('0x5b')](_0x14d155[_0x7e01('0x5c')],{})[_0x7e01('0x23')](respondWithResult(_0x45b76e,0xc9))[_0x7e01('0x57')](handleError(_0x45b76e,null));};exports[_0x7e01('0x36')]=function(_0x5ab0e9,_0x58bd2c){if(_0x5ab0e9[_0x7e01('0x5c')]['id']){delete _0x5ab0e9[_0x7e01('0x5c')]['id'];}return db[_0x7e01('0x3c')]['find']({'where':{'id':_0x5ab0e9['params']['id']}})[_0x7e01('0x23')](handleEntityNotFound(_0x58bd2c,null))[_0x7e01('0x23')](saveUpdates(_0x5ab0e9[_0x7e01('0x5c')],null))[_0x7e01('0x23')](respondWithResult(_0x58bd2c,null))[_0x7e01('0x57')](handleError(_0x58bd2c,null));};exports[_0x7e01('0x37')]=function(_0x14e4c7,_0x399726){return db['ChatMessage'][_0x7e01('0x5a')]({'where':{'id':_0x14e4c7['params']['id']}})['then'](handleEntityNotFound(_0x399726,null))[_0x7e01('0x23')](removeEntity(_0x399726,null))[_0x7e01('0x57')](handleError(_0x399726,null));};exports[_0x7e01('0x5d')]=function(_0x2a50df,_0x597b87){return db['ChatMessage'][_0x7e01('0x5d')]()['then'](respondWithResult(_0x597b87,null))[_0x7e01('0x57')](handleError(_0x597b87,null));};var interaction_log=require(_0x7e01('0x15'))(_0x7e01('0x5e'));exports[_0x7e01('0x5f')]=function(_0x179005,_0x356719,_0x1b1972){var _0x395a74={'agent':{},'channel':_0x7e01('0x60')};if(_0x179005['body']['id']){delete _0x179005['body']['id'];}_0x179005['body'][_0x7e01('0x61')]=!![];_0x179005[_0x7e01('0x5c')][_0x7e01('0x62')]=moment()['format'](_0x7e01('0x63'));_0x179005[_0x7e01('0x5c')][_0x7e01('0x64')]=_0x179005[_0x7e01('0x5c')]['UserId']||_0x179005[_0x7e01('0x65')]['id'];_0x395a74[_0x7e01('0x66')]['id']=_0x179005[_0x7e01('0x5c')]['UserId'];return db[_0x7e01('0x3c')][_0x7e01('0x5a')]({'where':{'id':_0x179005[_0x7e01('0x58')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x7e01('0x67')}]})[_0x7e01('0x23')](handleEntityNotFound(_0x356719,null))[_0x7e01('0x23')](saveUpdates(_0x179005['body'],null))[_0x7e01('0x23')](function(_0x3718ae){if(_0x3718ae){_0x395a74['message']=_0x3718ae[_0x7e01('0x68')]({'plain':!![]});return db[_0x7e01('0x69')][_0x7e01('0x5a')]({'where':{'id':_0x3718ae[_0x7e01('0x6a')]}});}return null;})[_0x7e01('0x23')](handleEntityNotFound(_0x356719,null))[_0x7e01('0x23')](function(_0x5c7056){if(_0x5c7056){return _0x5c7056[_0x7e01('0x36')]({'UserId':_0x179005[_0x7e01('0x5c')][_0x7e01('0x64')],'read1stAt':_[_0x7e01('0x6b')](_0x5c7056[_0x7e01('0x6c')])?moment()[_0x7e01('0x6d')](_0x7e01('0x63')):undefined});}return null;})['then'](function(_0xc315e6){if(_0xc315e6){_0x395a74[_0x7e01('0x6e')]=_0xc315e6[_0x7e01('0x68')]({'plain':!![]});interaction_log['info'](_0x7e01('0x6f'),_0x179005['user']['id'],_0x179005[_0x7e01('0x65')][_0x7e01('0x38')],_0x179005['user'][_0x7e01('0x70')],_0x395a74['interaction']['id'],_0x179005[_0x7e01('0x5c')]?JSON['stringify'](_0x179005[_0x7e01('0x5c')]):_0x7e01('0x71'));return respondWithRpcPromise(_0x7e01('0x72'),'acceptMessage',_0x395a74);}return null;})[_0x7e01('0x23')](function(_0x36ba0d){if(_0x36ba0d){if(_0x179005[_0x7e01('0x5c')][_0x7e01('0x73')]){_0x395a74['message'][_0x7e01('0x74')]=util['format']('SIP/%s',_0x179005['user'][_0x7e01('0x38')]);_0x395a74[_0x7e01('0x29')][_0x7e01('0x75')]=_0x395a74[_0x7e01('0x75')];_0x395a74[_0x7e01('0x29')][_0x7e01('0x76')]='accept';return respondWithRpcPromise('EventManager',_0x7e01('0x77'),{'event':_0x7e01('0x78'),'message':_['merge'](_0x395a74[_0x7e01('0x29')],JSON[_0x7e01('0x79')](_0x395a74[_0x7e01('0x6e')][_0x7e01('0x7a')]))},client9002)['then'](function(){return _0x395a74;});}return _0x395a74;}return null;})[_0x7e01('0x23')](respondWithResult(_0x356719,null))[_0x7e01('0x57')](handleError(_0x356719,null));};var interaction_log=require(_0x7e01('0x15'))('chat-interactions');exports[_0x7e01('0x35')]=function(_0x523279,_0x4c650a,_0x3b3e03){var _0x5bbea5={'agent':{},'channel':_0x7e01('0x60')};if(_0x523279[_0x7e01('0x5c')]['id']){delete _0x523279[_0x7e01('0x5c')]['id'];}_0x523279[_0x7e01('0x5c')][_0x7e01('0x64')]=_0x523279[_0x7e01('0x5c')][_0x7e01('0x64')]||_0x523279[_0x7e01('0x65')]['id'];_0x5bbea5['agent']['id']=_0x523279['body'][_0x7e01('0x64')];return db[_0x7e01('0x3c')][_0x7e01('0x5a')]({'where':{'id':_0x523279['params']['id'],'UserId':null}})[_0x7e01('0x23')](handleEntityNotFound(_0x4c650a,null))[_0x7e01('0x23')](function(_0xd57023){if(_0xd57023){_0x5bbea5[_0x7e01('0x29')]=_0xd57023['get']({'plain':!![]});return db['ChatInteraction'][_0x7e01('0x5a')]({'where':{'id':_0xd57023[_0x7e01('0x6a')]}});}return null;})[_0x7e01('0x23')](handleEntityNotFound(_0x4c650a,null))[_0x7e01('0x23')](function(_0x452cc3){if(_0x452cc3){_0x5bbea5[_0x7e01('0x6e')]=_0x452cc3[_0x7e01('0x68')]({'plain':!![]});interaction_log[_0x7e01('0x2a')](_0x7e01('0x7b'),_0x523279[_0x7e01('0x65')]['id'],_0x523279[_0x7e01('0x65')]['name'],_0x523279['user'][_0x7e01('0x70')],_0x5bbea5[_0x7e01('0x6e')]['id'],_0x523279['body']?JSON[_0x7e01('0x26')](_0x523279[_0x7e01('0x5c')]):_0x7e01('0x71'));return respondWithRpcPromise(_0x7e01('0x7c'),_0x7e01('0x7d'),_0x5bbea5);}return null;})[_0x7e01('0x23')](function(_0x4552db){if(_0x4552db){_0x4552db['message'][_0x7e01('0x74')]=util[_0x7e01('0x6d')](_0x7e01('0x7e'),_0x523279[_0x7e01('0x65')][_0x7e01('0x38')]);_0x4552db[_0x7e01('0x29')][_0x7e01('0x75')]=_0x5bbea5[_0x7e01('0x75')];_0x4552db[_0x7e01('0x29')][_0x7e01('0x76')]=_0x7e01('0x35');respondWithRpcPromise(_0x7e01('0x77'),_0x7e01('0x77'),{'event':_0x7e01('0x7f'),'message':_0x4552db[_0x7e01('0x29')]},client9002);return _0x5bbea5;}return null;})[_0x7e01('0x23')](respondWithResult(_0x4c650a,null))[_0x7e01('0x57')](handleError(_0x4c650a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 180043d..220bb37 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 _0x163e=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x163e,0xbd));var _0xe163=function(_0x1ff527,_0x54b6d2){_0x1ff527=_0x1ff527-0x0;var _0x51cc75=_0x163e[_0x1ff527];return _0x51cc75;};'use strict';var EventEmitter=require(_0xe163('0x0'));var ChatMessage=require(_0xe163('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xe163('0x2')](0x0);var events={'afterCreate':_0xe163('0x3'),'afterUpdate':_0xe163('0x4'),'afterDestroy':_0xe163('0x5')};function emitEvent(_0xd73f7f){return function(_0x3a89ec,_0x51f6d0,_0x4d58a9){ChatMessageEvents[_0xe163('0x6')](_0xd73f7f+':'+_0x3a89ec['id'],_0x3a89ec);ChatMessageEvents[_0xe163('0x6')](_0xd73f7f,_0x3a89ec);_0x4d58a9(null);};}for(var e in events){if(events[_0xe163('0x7')](e)){var event=events[e];ChatMessage[_0xe163('0x8')](e,emitEvent(event));}}module[_0xe163('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xad60=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','save','update'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0xad60,0x12d));var _0x0ad6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xad60[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x0ad6('0x0'));var ChatMessage=require(_0x0ad6('0x1'))['db'][_0x0ad6('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0ad6('0x3'),'afterUpdate':_0x0ad6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2c3902){return function(_0x4d38a0,_0x582a40,_0x2bfbdd){ChatMessageEvents['emit'](_0x2c3902+':'+_0x4d38a0['id'],_0x4d38a0);ChatMessageEvents[_0x0ad6('0x5')](_0x2c3902,_0x4d38a0);_0x2bfbdd(null);};}for(var e in events){if(events[_0x0ad6('0x6')](e)){var event=events[e];ChatMessage[_0x0ad6('0x7')](e,emitEvent(event));}}module[_0x0ad6('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index bb1d8c1..fd2ce5f 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 _0xff2b=['isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./chatMessage.attributes','exports','define','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x109e16,_0xf9aec4){var _0x5c238a=function(_0x4d3ee2){while(--_0x4d3ee2){_0x109e16['push'](_0x109e16['shift']());}};_0x5c238a(++_0xf9aec4);}(_0xff2b,0x15b));var _0xbff2=function(_0x547219,_0x3aa120){_0x547219=_0x547219-0x0;var _0x371245=_0xff2b[_0x547219];return _0x371245;};'use strict';var _=require(_0xbff2('0x0'));var util=require('util');var logger=require(_0xbff2('0x1'))(_0xbff2('0x2'));var moment=require(_0xbff2('0x3'));var BPromise=require(_0xbff2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbff2('0x5'));var rimraf=require(_0xbff2('0x6'));var config=require('../../config/environment');var attributes=require(_0xbff2('0x7'));module[_0xbff2('0x8')]=function(_0x1dafb8,_0x5b1a81){return _0x1dafb8[_0xbff2('0x9')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xbff2('0xa')],'type':_0xbff2('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2106ee,_0x20fbf5,_0x435b5d){var _0x4cf8c1=_0x1dafb8[_0xbff2('0xc')];var _0x823875=_0x2106ee[_0xbff2('0xd')]({'plain':!![]});if(_0x823875[_0xbff2('0xe')][_0xbff2('0xf')]()==='in'||_0x823875[_0xbff2('0xe')]['toLowerCase']()===_0xbff2('0x10')&&!_0x823875['secret']&&!_[_0xbff2('0x11')](_0x823875[_0xbff2('0x12')])){_0x4cf8c1[_0xbff2('0x13')][_0xbff2('0x14')]({'where':{'id':_0x823875[_0xbff2('0x15')]}})[_0xbff2('0x16')](function(_0x3ca982){if(_0x3ca982){_0x3ca982[_0xbff2('0x17')]({'lastMsgAt':_0x823875[_0xbff2('0x18')],'lastMsgDirection':_0x823875[_0xbff2('0xe')][_0xbff2('0xf')]()});}})[_0xbff2('0x19')](function(_0x113684){console[_0xbff2('0x1a')](_0x113684);});}_0x435b5d();}},'charset':_0xbff2('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd467=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','define','ChatMessage','fti_chat_messages','body','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt'];(function(_0x1670c6,_0x23305d){var _0x505d8f=function(_0x51c792){while(--_0x51c792){_0x1670c6['push'](_0x1670c6['shift']());}};_0x505d8f(++_0x23305d);}(_0xd467,0xc0));var _0x7d46=function(_0x52f7b5,_0x5153dd){_0x52f7b5=_0x52f7b5-0x0;var _0x52aa66=_0xd467[_0x52f7b5];return _0x52aa66;};'use strict';var _=require(_0x7d46('0x0'));var util=require(_0x7d46('0x1'));var logger=require(_0x7d46('0x2'))('api');var moment=require(_0x7d46('0x3'));var BPromise=require(_0x7d46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d46('0x5'));var rimraf=require('rimraf');var config=require(_0x7d46('0x6'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x2cd116,_0x5bf611){return _0x2cd116[_0x7d46('0x7')](_0x7d46('0x8'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x7d46('0x9'),'fields':[_0x7d46('0xa')],'type':_0x7d46('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6c4cc6,_0x90ba33,_0x42a28a){var _0x2935d3=_0x2cd116['models'];var _0x4aca36=_0x6c4cc6[_0x7d46('0xc')]({'plain':!![]});if(_0x4aca36['direction'][_0x7d46('0xd')]()==='in'||_0x4aca36[_0x7d46('0xe')][_0x7d46('0xd')]()===_0x7d46('0xf')&&!_0x4aca36[_0x7d46('0x10')]&&!_[_0x7d46('0x11')](_0x4aca36['UserId'])){_0x2935d3[_0x7d46('0x12')][_0x7d46('0x13')]({'where':{'id':_0x4aca36[_0x7d46('0x14')]}})[_0x7d46('0x15')](function(_0x4add22){if(_0x4add22){_0x4add22[_0x7d46('0x16')]({'lastMsgAt':_0x4aca36[_0x7d46('0x17')],'lastMsgDirection':_0x4aca36[_0x7d46('0xe')][_0x7d46('0xd')]()});}})['catch'](function(_0x1bdc67){console[_0x7d46('0x18')](_0x1bdc67);});}_0x42a28a();}},'charset':_0x7d46('0x19'),'collate':_0x7d46('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 265531f..d86be03 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 _0x8d23=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x5bf090,_0x516767){var _0x20a6ff=function(_0x260f1a){while(--_0x260f1a){_0x5bf090['push'](_0x5bf090['shift']());}};_0x20a6ff(++_0x516767);}(_0x8d23,0xc7));var _0x38d2=function(_0x82338c,_0x2fefc0){_0x82338c=_0x82338c-0x0;var _0x57b335=_0x8d23[_0x82338c];return _0x57b335;};'use strict';var _=require(_0x38d2('0x0'));var util=require('util');var moment=require(_0x38d2('0x1'));var BPromise=require(_0x38d2('0x2'));var rs=require(_0x38d2('0x3'));var fs=require('fs');var Redis=require(_0x38d2('0x4'));var db=require(_0x38d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x38d2('0x6'))(_0x38d2('0x7'));var config=require(_0x38d2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x38d2('0x9')][_0x38d2('0xa')]({'port':0x232a});config[_0x38d2('0xb')]=_[_0x38d2('0xc')](config[_0x38d2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x38d2('0xd'))(new Redis(config[_0x38d2('0xb')]));require(_0x38d2('0xe'))[_0x38d2('0xf')](socket);function respondWithRpcPromise(_0x3a5f62,_0x3e2f69,_0x5955b9){return new BPromise(function(_0x4171e0,_0x25541e){return client[_0x38d2('0x10')](_0x3a5f62,_0x5955b9)[_0x38d2('0x11')](function(_0x3e4150){logger[_0x38d2('0x12')]('ChatMessage,\x20%s,\x20%s',_0x3e2f69,_0x38d2('0x13'));logger[_0x38d2('0x14')](_0x38d2('0x15'),_0x3e2f69,'request\x20sent',JSON[_0x38d2('0x16')](_0x3e4150));if(_0x3e4150[_0x38d2('0x17')]){if(_0x3e4150[_0x38d2('0x17')][_0x38d2('0x18')]===0x1f4){logger[_0x38d2('0x17')](_0x38d2('0x19'),_0x3e2f69,_0x3e4150[_0x38d2('0x17')][_0x38d2('0x1a')]);return _0x25541e(_0x3e4150[_0x38d2('0x17')][_0x38d2('0x1a')]);}logger[_0x38d2('0x17')](_0x38d2('0x19'),_0x3e2f69,_0x3e4150[_0x38d2('0x17')][_0x38d2('0x1a')]);return _0x4171e0(_0x3e4150[_0x38d2('0x17')][_0x38d2('0x1a')]);}else{logger[_0x38d2('0x12')](_0x38d2('0x19'),_0x3e2f69,'request\x20sent');_0x4171e0(_0x3e4150['result'][_0x38d2('0x1a')]);}})[_0x38d2('0x1b')](function(_0x51a92d){logger[_0x38d2('0x17')]('ChatMessage,\x20%s,\x20%s',_0x3e2f69,_0x51a92d);_0x25541e(_0x51a92d);});});}exports[_0x38d2('0x1c')]=function(_0x5349c1){var _0x1f7ca7=this;return new Promise(function(_0x2fa374,_0x19c258){return db[_0x38d2('0x1d')][_0x38d2('0x1e')](_0x5349c1[_0x38d2('0x1f')],{'raw':_0x5349c1[_0x38d2('0x20')]?_0x5349c1[_0x38d2('0x20')][_0x38d2('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x3207f2){logger[_0x38d2('0x12')](_0x38d2('0x1c'),_0x5349c1);logger[_0x38d2('0x14')](_0x38d2('0x1c'),_0x5349c1,JSON['stringify'](_0x3207f2));_0x2fa374(_0x3207f2);})[_0x38d2('0x1b')](function(_0x2340ee){logger['error'](_0x38d2('0x1c'),_0x2340ee[_0x38d2('0x1a')],_0x5349c1);_0x19c258(_0x1f7ca7[_0x38d2('0x17')](0x1f4,_0x2340ee['message']));});});}; \ No newline at end of file +var _0x7326=['debug','stringify','error','code','message','info','catch','CreateChatMessage','ChatMessage','create','body','options','raw','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','ChatMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x44e068,_0x156947){var _0x114923=function(_0xc90d47){while(--_0xc90d47){_0x44e068['push'](_0x44e068['shift']());}};_0x114923(++_0x156947);}(_0x7326,0xc7));var _0x6732=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x7326[_0x92c450];return _0x2a9599;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6732('0x0'));var BPromise=require('bluebird');var rs=require(_0x6732('0x1'));var fs=require('fs');var Redis=require(_0x6732('0x2'));var db=require(_0x6732('0x3'))['db'];var utils=require(_0x6732('0x4'));var logger=require(_0x6732('0x5'))(_0x6732('0x6'));var config=require(_0x6732('0x7'));var jayson=require(_0x6732('0x8'));var client=jayson[_0x6732('0x9')][_0x6732('0xa')]({'port':0x232a});config['redis']=_[_0x6732('0xb')](config[_0x6732('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6732('0xd'))(new Redis(config[_0x6732('0xc')]));require('./chatMessage.socket')[_0x6732('0xe')](socket);function respondWithRpcPromise(_0x1015ed,_0x82c63d,_0x31e964){return new BPromise(function(_0x40d4fc,_0x33a929){return client[_0x6732('0xf')](_0x1015ed,_0x31e964)['then'](function(_0x2e6165){logger['info'](_0x6732('0x10'),_0x82c63d,_0x6732('0x11'));logger[_0x6732('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x82c63d,_0x6732('0x11'),JSON[_0x6732('0x13')](_0x2e6165));if(_0x2e6165[_0x6732('0x14')]){if(_0x2e6165[_0x6732('0x14')][_0x6732('0x15')]===0x1f4){logger[_0x6732('0x14')](_0x6732('0x10'),_0x82c63d,_0x2e6165[_0x6732('0x14')][_0x6732('0x16')]);return _0x33a929(_0x2e6165[_0x6732('0x14')]['message']);}logger[_0x6732('0x14')]('ChatMessage,\x20%s,\x20%s',_0x82c63d,_0x2e6165[_0x6732('0x14')][_0x6732('0x16')]);return _0x40d4fc(_0x2e6165[_0x6732('0x14')]['message']);}else{logger[_0x6732('0x17')](_0x6732('0x10'),_0x82c63d,_0x6732('0x11'));_0x40d4fc(_0x2e6165['result'][_0x6732('0x16')]);}})[_0x6732('0x18')](function(_0x526857){logger[_0x6732('0x14')](_0x6732('0x10'),_0x82c63d,_0x526857);_0x33a929(_0x526857);});});}exports[_0x6732('0x19')]=function(_0x10921f){var _0x143c8b=this;return new Promise(function(_0x3c52c1,_0x2870dc){return db[_0x6732('0x1a')][_0x6732('0x1b')](_0x10921f[_0x6732('0x1c')],{'raw':_0x10921f[_0x6732('0x1d')]?_0x10921f[_0x6732('0x1d')][_0x6732('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x592a99){logger[_0x6732('0x17')](_0x6732('0x19'),_0x10921f);logger['debug']('CreateChatMessage',_0x10921f,JSON['stringify'](_0x592a99));_0x3c52c1(_0x592a99);})[_0x6732('0x18')](function(_0x2d55a2){logger[_0x6732('0x14')](_0x6732('0x19'),_0x2d55a2['message'],_0x10921f);_0x2870dc(_0x143c8b[_0x6732('0x14')](0x1f4,_0x2d55a2[_0x6732('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d186984..9346fff 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 _0xeda8=['chatMessage:','./chatMessage.events','save','update','emit','removeListener','register'];(function(_0x59ab65,_0x410a52){var _0x57db9b=function(_0x19dc31){while(--_0x19dc31){_0x59ab65['push'](_0x59ab65['shift']());}};_0x57db9b(++_0x410a52);}(_0xeda8,0x104));var _0x8eda=function(_0x1c3fb2,_0x47a8c3){_0x1c3fb2=_0x1c3fb2-0x0;var _0x559d0d=_0xeda8[_0x1c3fb2];return _0x559d0d;};'use strict';var ChatMessageEvents=require(_0x8eda('0x0'));var events=[_0x8eda('0x1'),'remove',_0x8eda('0x2')];function createListener(_0xd8b5d5,_0x2090a2){return function(_0xc01211){_0x2090a2[_0x8eda('0x3')](_0xd8b5d5,_0xc01211);};}function removeListener(_0x94b83f,_0x25b19a){return function(){ChatMessageEvents[_0x8eda('0x4')](_0x94b83f,_0x25b19a);};}exports[_0x8eda('0x5')]=function(_0x1f3556){for(var _0x349361=0x0,_0x32abe8=events['length'];_0x349361<_0x32abe8;_0x349361++){var _0x28b721=events[_0x349361];var _0x1b6a1d=createListener(_0x8eda('0x6')+_0x28b721,_0x1f3556);ChatMessageEvents['on'](_0x28b721,_0x1b6a1d);}}; \ No newline at end of file +var _0x57ca=['save','remove','emit','removeListener','register','length'];(function(_0xdafbe8,_0x3eccb3){var _0x1fb80a=function(_0x4ce59c){while(--_0x4ce59c){_0xdafbe8['push'](_0xdafbe8['shift']());}};_0x1fb80a(++_0x3eccb3);}(_0x57ca,0x108));var _0xa57c=function(_0x432668,_0x356f30){_0x432668=_0x432668-0x0;var _0x43fe50=_0x57ca[_0x432668];return _0x43fe50;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xa57c('0x0'),_0xa57c('0x1'),'update'];function createListener(_0x3a7394,_0x396613){return function(_0x1d38e7){_0x396613[_0xa57c('0x2')](_0x3a7394,_0x1d38e7);};}function removeListener(_0x1da469,_0x48be2d){return function(){ChatMessageEvents[_0xa57c('0x3')](_0x1da469,_0x48be2d);};}exports[_0xa57c('0x4')]=function(_0x113dcf){for(var _0x19473f=0x0,_0xbdfffb=events[_0xa57c('0x5')];_0x19473f<_0xbdfffb;_0x19473f++){var _0x19e28e=events[_0x19473f];var _0x271ccc=createListener('chatMessage:'+_0x19e28e,_0x113dcf);ChatMessageEvents['on'](_0x19e28e,_0x271ccc);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index f730e3b..92a80ea 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 _0x4824=['exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','chatmessage:create','put','/:id/accept','accept','delete'];(function(_0x514451,_0x350f4e){var _0x588103=function(_0x42ebe1){while(--_0x42ebe1){_0x514451['push'](_0x514451['shift']());}};_0x588103(++_0x350f4e);}(_0x4824,0x1e7));var _0x4482=function(_0x301442,_0x2126c7){_0x301442=_0x301442-0x0;var _0x25c407=_0x4824[_0x301442];return _0x25c407;};'use strict';var multer=require(_0x4482('0x0'));var util=require(_0x4482('0x1'));var path=require(_0x4482('0x2'));var timeout=require('connect-timeout');var express=require(_0x4482('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4482('0x4'));var config=require(_0x4482('0x5'));var controller=require(_0x4482('0x6'));router[_0x4482('0x7')]('/',auth[_0x4482('0x8')](),controller['index']);router[_0x4482('0x7')](_0x4482('0x9'),auth[_0x4482('0x8')](),controller[_0x4482('0xa')]);router['get'](_0x4482('0xb'),auth[_0x4482('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('chat',_0x4482('0xc')),controller['create']);router[_0x4482('0xd')](_0x4482('0xb'),controller['update']);router[_0x4482('0xd')](_0x4482('0xe'),auth[_0x4482('0x8')](),controller[_0x4482('0xf')]);router[_0x4482('0xd')]('/:id/reject',auth[_0x4482('0x8')](),controller['reject']);router[_0x4482('0x10')](_0x4482('0xb'),auth[_0x4482('0x8')](),controller['destroy']);module[_0x4482('0x11')]=router; \ No newline at end of file +var _0x49af=['../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','tracked','chatmessage:create','create','update','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xf276da,_0x3ad100){var _0x18a20c=function(_0x5bca3c){while(--_0x5bca3c){_0xf276da['push'](_0xf276da['shift']());}};_0x18a20c(++_0x3ad100);}(_0x49af,0x14a));var _0xf49a=function(_0x39edc8,_0x24af0c){_0x39edc8=_0x39edc8-0x0;var _0x31b146=_0x49af[_0x39edc8];return _0x31b146;};'use strict';var multer=require(_0xf49a('0x0'));var util=require(_0xf49a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf49a('0x2'));var router=express[_0xf49a('0x3')]();var auth=require(_0xf49a('0x4'));var interaction=require(_0xf49a('0x5'));var config=require(_0xf49a('0x6'));var controller=require(_0xf49a('0x7'));router[_0xf49a('0x8')]('/',auth[_0xf49a('0x9')](),controller[_0xf49a('0xa')]);router[_0xf49a('0x8')](_0xf49a('0xb'),auth[_0xf49a('0x9')](),controller['describe']);router[_0xf49a('0x8')](_0xf49a('0xc'),auth[_0xf49a('0x9')](),controller['show']);router['post']('/',auth[_0xf49a('0x9')](),interaction[_0xf49a('0xd')]('chat',_0xf49a('0xe')),controller[_0xf49a('0xf')]);router['put'](_0xf49a('0xc'),controller[_0xf49a('0x10')]);router[_0xf49a('0x11')](_0xf49a('0x12'),auth[_0xf49a('0x9')](),controller[_0xf49a('0x13')]);router[_0xf49a('0x11')]('/:id/reject',auth[_0xf49a('0x9')](),controller[_0xf49a('0x14')]);router[_0xf49a('0x15')](_0xf49a('0xc'),auth[_0xf49a('0x9')](),controller[_0xf49a('0x16')]);module[_0xf49a('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 a780027..2f4001d 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 _0x491f=['medium','exports'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x491f,0x1e3));var _0xf491=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x491f[_0x5e9876];return _0x576c48;};'use strict';var Sequelize=require('sequelize');module[_0xf491('0x0')]={'body':{'type':Sequelize['TEXT'](_0xf491('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x4d49=['TEXT','medium','sequelize','exports'];(function(_0x569d0f,_0x224a07){var _0x26d516=function(_0x231619){while(--_0x231619){_0x569d0f['push'](_0x569d0f['shift']());}};_0x26d516(++_0x224a07);}(_0x4d49,0x152));var _0x94d4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4d49[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x94d4('0x0'));module[_0x94d4('0x1')]={'body':{'type':Sequelize[_0x94d4('0x2')](_0x94d4('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 2dbb2dc..5cd4cc3 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 _0x404d=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','reject','save','update','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','options','ChatOfflineMessage','count','then','include','rows','show','includeAll','find','catch','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x4bf9c8,_0x13b0fb){var _0x34bfc2=function(_0x3c8822){while(--_0x3c8822){_0x4bf9c8['push'](_0x4bf9c8['shift']());}};_0x34bfc2(++_0x13b0fb);}(_0x404d,0x1e9));var _0xd404=function(_0x376f4c,_0x3b3e1b){_0x376f4c=_0x376f4c-0x0;var _0x12ebbf=_0x404d[_0x376f4c];return _0x12ebbf;};'use strict';var pdf=require(_0xd404('0x0'));var emlformat=require(_0xd404('0x1'));var rimraf=require(_0xd404('0x2'));var zipdir=require(_0xd404('0x3'));var jsonpatch=require(_0xd404('0x4'));var rp=require(_0xd404('0x5'));var moment=require(_0xd404('0x6'));var BPromise=require(_0xd404('0x7'));var Mustache=require(_0xd404('0x8'));var util=require('util');var path=require(_0xd404('0x9'));var sox=require(_0xd404('0xa'));var csv=require('to-csv');var ejs=require(_0xd404('0xb'));var fs=require('fs');var _=require(_0xd404('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd404('0xd'));var deskjs=require(_0xd404('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd404('0xf'));var Redis=require(_0xd404('0x10'));var authService=require(_0xd404('0x11'));var qs=require(_0xd404('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd404('0x13'))(_0xd404('0x14'));var utils=require('../../config/utils');var config=require(_0xd404('0x15'));var licenseUtil=require(_0xd404('0x16'));var db=require(_0xd404('0x17'))['db'];function respondWithStatusCode(_0x2cc1ec,_0x1d6071){_0x1d6071=_0x1d6071||0xcc;return function(_0x9f7667){if(_0x9f7667){return _0x2cc1ec[_0xd404('0x18')](_0x1d6071);}return _0x2cc1ec[_0xd404('0x19')](_0x1d6071)[_0xd404('0x1a')]();};}function respondWithResult(_0x31c8f8,_0x2516c2){_0x2516c2=_0x2516c2||0xc8;return function(_0x2ff703){if(_0x2ff703){return _0x31c8f8[_0xd404('0x19')](_0x2516c2)[_0xd404('0x1b')](_0x2ff703);}};}function respondWithFilteredResult(_0xaf965f,_0x424467){return function(_0x2051e8){if(_0x2051e8){var _0xa4d1b2=_0x2051e8['count'],_0xc5fe91=_0x424467[_0xd404('0x1c')],_0x122813=_0x424467[_0xd404('0x1c')]+_0x424467['limit'],_0x155186;if(_0x122813>=_0xa4d1b2){_0x122813=_0xa4d1b2;_0x155186=0xc8;}else{_0x155186=0xce;}_0xaf965f[_0xd404('0x19')](_0x155186);return _0xaf965f[_0xd404('0x1d')]('Content-Range',_0xc5fe91+'-'+_0x122813+'/'+_0xa4d1b2)[_0xd404('0x1b')](_0x2051e8);}return null;};}function patchUpdates(_0x233160){return function(_0x387d0b){try{jsonpatch['apply'](_0x387d0b,_0x233160,!![]);}catch(_0x2fd888){return BPromise[_0xd404('0x1e')](_0x2fd888);}return _0x387d0b[_0xd404('0x1f')]();};}function saveUpdates(_0x3e8183,_0x1d89e0){return function(_0x3b67d4){if(_0x3b67d4){return _0x3b67d4[_0xd404('0x20')](_0x3e8183)['then'](function(_0x2a88f6){return _0x2a88f6;});}return null;};}function removeEntity(_0xcc7bf1,_0x50c0e2){return function(_0x17d0e6){if(_0x17d0e6){return _0x17d0e6['destroy']()['then'](function(){_0xcc7bf1[_0xd404('0x19')](0xcc)[_0xd404('0x1a')]();});}};}function handleEntityNotFound(_0x133232,_0x32b5f8){return function(_0x4c00de){if(!_0x4c00de){_0x133232[_0xd404('0x18')](0x194);}return _0x4c00de;};}function handleError(_0x2a5d84,_0x13af69){_0x13af69=_0x13af69||0x1f4;return function(_0x55cfde){logger['error'](_0x55cfde[_0xd404('0x21')]);if(_0x55cfde[_0xd404('0x22')]){delete _0x55cfde[_0xd404('0x22')];}_0x2a5d84[_0xd404('0x19')](_0x13af69)[_0xd404('0x23')](_0x55cfde);};}exports[_0xd404('0x24')]=function(_0x256277,_0x418a3c){var _0x586b97={},_0x47d0b4={},_0x2fa5a3={'count':0x0,'rows':[]};var _0x4a7dfc=_[_0xd404('0x25')](db['ChatOfflineMessage'][_0xd404('0x26')],function(_0x1e6341){return{'name':_0x1e6341[_0xd404('0x27')],'type':_0x1e6341[_0xd404('0x28')][_0xd404('0x29')]};});_0x47d0b4[_0xd404('0x2a')]=_[_0xd404('0x25')](_0x4a7dfc,'name');_0x47d0b4['query']=_[_0xd404('0x2b')](_0x256277['query']);_0x47d0b4['filters']=_[_0xd404('0x2c')](_0x47d0b4[_0xd404('0x2a')],_0x47d0b4[_0xd404('0x2d')]);_0x586b97['attributes']=_[_0xd404('0x2c')](_0x47d0b4['model'],qs[_0xd404('0x2e')](_0x256277[_0xd404('0x2d')]['fields']));_0x586b97[_0xd404('0x2f')]=_0x586b97[_0xd404('0x2f')][_0xd404('0x30')]?_0x586b97[_0xd404('0x2f')]:_0x47d0b4[_0xd404('0x2a')];if(!_0x256277['query'][_0xd404('0x31')](_0xd404('0x32'))){_0x586b97[_0xd404('0x33')]=qs['limit'](_0x256277[_0xd404('0x2d')][_0xd404('0x33')]);_0x586b97[_0xd404('0x1c')]=qs[_0xd404('0x1c')](_0x256277['query']['offset']);}_0x586b97[_0xd404('0x34')]=qs[_0xd404('0x35')](_0x256277[_0xd404('0x2d')][_0xd404('0x35')]);_0x586b97[_0xd404('0x36')]=qs[_0xd404('0x37')](_['pick'](_0x256277[_0xd404('0x2d')],_0x47d0b4[_0xd404('0x37')]),_0x4a7dfc);if(_0x256277[_0xd404('0x2d')]['filter']){_0x586b97[_0xd404('0x36')]=_[_0xd404('0x38')](_0x586b97[_0xd404('0x36')],{'$or':_['map'](_0x4a7dfc,function(_0x32d376){if(_0x32d376[_0xd404('0x28')]!==_0xd404('0x39')){var _0x520914={};_0x520914[_0x32d376[_0xd404('0x22')]]={'$like':'%'+_0x256277[_0xd404('0x2d')]['filter']+'%'};return _0x520914;}})});}_0x586b97=_[_0xd404('0x38')]({},_0x586b97,_0x256277[_0xd404('0x3a')]);var _0x237592={'where':_0x586b97[_0xd404('0x36')]};return db[_0xd404('0x3b')][_0xd404('0x3c')](_0x237592)[_0xd404('0x3d')](function(_0xf7a78f){_0x2fa5a3['count']=_0xf7a78f;if(_0x256277[_0xd404('0x2d')]['includeAll']){_0x586b97[_0xd404('0x3e')]=[{'all':!![]}];}return db[_0xd404('0x3b')]['findAll'](_0x586b97);})[_0xd404('0x3d')](function(_0x539f0f){_0x2fa5a3[_0xd404('0x3f')]=_0x539f0f;return _0x2fa5a3;})['then'](respondWithFilteredResult(_0x418a3c,_0x586b97))['catch'](handleError(_0x418a3c,null));};exports[_0xd404('0x40')]=function(_0x35b67c,_0x397f30){var _0x392afa={'raw':!![],'where':{'id':_0x35b67c['params']['id']}},_0x486898={};_0x486898[_0xd404('0x2a')]=_[_0xd404('0x2b')](db[_0xd404('0x3b')][_0xd404('0x26')]);_0x486898[_0xd404('0x2d')]=_[_0xd404('0x2b')](_0x35b67c[_0xd404('0x2d')]);_0x486898['filters']=_[_0xd404('0x2c')](_0x486898['model'],_0x486898[_0xd404('0x2d')]);_0x392afa['attributes']=_[_0xd404('0x2c')](_0x486898[_0xd404('0x2a')],qs[_0xd404('0x2e')](_0x35b67c['query'][_0xd404('0x2e')]));_0x392afa[_0xd404('0x2f')]=_0x392afa[_0xd404('0x2f')][_0xd404('0x30')]?_0x392afa['attributes']:_0x486898[_0xd404('0x2a')];if(_0x35b67c[_0xd404('0x2d')][_0xd404('0x41')]){_0x392afa[_0xd404('0x3e')]=[{'all':!![]}];}_0x392afa=_[_0xd404('0x38')]({},_0x392afa,_0x35b67c[_0xd404('0x3a')]);return db[_0xd404('0x3b')][_0xd404('0x42')](_0x392afa)[_0xd404('0x3d')](handleEntityNotFound(_0x397f30,null))[_0xd404('0x3d')](respondWithResult(_0x397f30,null))[_0xd404('0x43')](handleError(_0x397f30,null));};exports['create']=function(_0xebeae4,_0x202bd6){return db[_0xd404('0x3b')][_0xd404('0x44')](_0xebeae4[_0xd404('0x45')],{})['then'](respondWithResult(_0x202bd6,0xc9))[_0xd404('0x43')](handleError(_0x202bd6,null));};exports[_0xd404('0x20')]=function(_0x5017e0,_0x30026c){if(_0x5017e0[_0xd404('0x45')]['id']){delete _0x5017e0[_0xd404('0x45')]['id'];}return db[_0xd404('0x3b')][_0xd404('0x42')]({'where':{'id':_0x5017e0[_0xd404('0x46')]['id']}})[_0xd404('0x3d')](handleEntityNotFound(_0x30026c,null))[_0xd404('0x3d')](saveUpdates(_0x5017e0[_0xd404('0x45')],null))['then'](respondWithResult(_0x30026c,null))[_0xd404('0x43')](handleError(_0x30026c,null));};exports[_0xd404('0x47')]=function(_0x5c7c68,_0x3353fd){return db[_0xd404('0x3b')][_0xd404('0x42')]({'where':{'id':_0x5c7c68['params']['id']}})[_0xd404('0x3d')](handleEntityNotFound(_0x3353fd,null))[_0xd404('0x3d')](removeEntity(_0x3353fd,null))[_0xd404('0x43')](handleError(_0x3353fd,null));};exports[_0xd404('0x48')]=function(_0x2cc30c,_0x25163c){return db[_0xd404('0x3b')]['describe']()['then'](respondWithResult(_0x25163c,null))[_0xd404('0x43')](handleError(_0x25163c,null));}; \ No newline at end of file +var _0x5216=['squel','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','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','ChatOfflineMessage','rawAttributes','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','catch','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','ejs'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5216,0x165));var _0x6521=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5216[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6521('0x0'));var rimraf=require(_0x6521('0x1'));var zipdir=require(_0x6521('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6521('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6521('0x4'));var util=require('util');var path=require(_0x6521('0x5'));var sox=require(_0x6521('0x6'));var csv=require('to-csv');var ejs=require(_0x6521('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6521('0x8'));var crypto=require('crypto');var jsforce=require(_0x6521('0x9'));var deskjs=require(_0x6521('0xa'));var toCsv=require(_0x6521('0xb'));var querystring=require(_0x6521('0xc'));var Papa=require(_0x6521('0xd'));var Redis=require(_0x6521('0xe'));var authService=require(_0x6521('0xf'));var qs=require(_0x6521('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6521('0x11'))(_0x6521('0x12'));var utils=require(_0x6521('0x13'));var config=require(_0x6521('0x14'));var licenseUtil=require(_0x6521('0x15'));var db=require(_0x6521('0x16'))['db'];function respondWithStatusCode(_0x202ca6,_0x1fd0ba){_0x1fd0ba=_0x1fd0ba||0xcc;return function(_0x40abac){if(_0x40abac){return _0x202ca6[_0x6521('0x17')](_0x1fd0ba);}return _0x202ca6[_0x6521('0x18')](_0x1fd0ba)[_0x6521('0x19')]();};}function respondWithResult(_0x20d850,_0x562474){_0x562474=_0x562474||0xc8;return function(_0x26c746){if(_0x26c746){return _0x20d850[_0x6521('0x18')](_0x562474)[_0x6521('0x1a')](_0x26c746);}};}function respondWithFilteredResult(_0x3b5cb0,_0x1036ef){return function(_0x28711d){if(_0x28711d){var _0x1142bf=_0x28711d[_0x6521('0x1b')],_0x4266b4=_0x1036ef[_0x6521('0x1c')],_0x42f95e=_0x1036ef[_0x6521('0x1c')]+_0x1036ef[_0x6521('0x1d')],_0x42faab;if(_0x42f95e>=_0x1142bf){_0x42f95e=_0x1142bf;_0x42faab=0xc8;}else{_0x42faab=0xce;}_0x3b5cb0[_0x6521('0x18')](_0x42faab);return _0x3b5cb0[_0x6521('0x1e')]('Content-Range',_0x4266b4+'-'+_0x42f95e+'/'+_0x1142bf)[_0x6521('0x1a')](_0x28711d);}return null;};}function patchUpdates(_0x34af04){return function(_0x1a6b47){try{jsonpatch[_0x6521('0x1f')](_0x1a6b47,_0x34af04,!![]);}catch(_0x1be069){return BPromise[_0x6521('0x20')](_0x1be069);}return _0x1a6b47[_0x6521('0x21')]();};}function saveUpdates(_0xbeb1cf,_0x4507d9){return function(_0x2d9e32){if(_0x2d9e32){return _0x2d9e32[_0x6521('0x22')](_0xbeb1cf)[_0x6521('0x23')](function(_0x441cae){return _0x441cae;});}return null;};}function removeEntity(_0x51036e,_0x56aaa0){return function(_0x21076d){if(_0x21076d){return _0x21076d[_0x6521('0x24')]()[_0x6521('0x23')](function(){_0x51036e['status'](0xcc)[_0x6521('0x19')]();});}};}function handleEntityNotFound(_0x4c1366,_0x554a37){return function(_0x5d3deb){if(!_0x5d3deb){_0x4c1366[_0x6521('0x17')](0x194);}return _0x5d3deb;};}function handleError(_0x1b1fe6,_0x57cbae){_0x57cbae=_0x57cbae||0x1f4;return function(_0x149be2){logger['error'](_0x149be2[_0x6521('0x25')]);if(_0x149be2[_0x6521('0x26')]){delete _0x149be2[_0x6521('0x26')];}_0x1b1fe6[_0x6521('0x18')](_0x57cbae)[_0x6521('0x27')](_0x149be2);};}exports[_0x6521('0x28')]=function(_0x3d0a62,_0x53194b){var _0x35b838={},_0x310bd9={},_0x28fbd5={'count':0x0,'rows':[]};var _0x365980=_['map'](db[_0x6521('0x29')][_0x6521('0x2a')],function(_0x42c360){return{'name':_0x42c360['fieldName'],'type':_0x42c360['type'][_0x6521('0x2b')]};});_0x310bd9[_0x6521('0x2c')]=_[_0x6521('0x2d')](_0x365980,_0x6521('0x26'));_0x310bd9['query']=_[_0x6521('0x2e')](_0x3d0a62['query']);_0x310bd9['filters']=_['intersection'](_0x310bd9[_0x6521('0x2c')],_0x310bd9[_0x6521('0x2f')]);_0x35b838[_0x6521('0x30')]=_[_0x6521('0x31')](_0x310bd9[_0x6521('0x2c')],qs[_0x6521('0x32')](_0x3d0a62[_0x6521('0x2f')][_0x6521('0x32')]));_0x35b838[_0x6521('0x30')]=_0x35b838[_0x6521('0x30')][_0x6521('0x33')]?_0x35b838[_0x6521('0x30')]:_0x310bd9['model'];if(!_0x3d0a62[_0x6521('0x2f')][_0x6521('0x34')](_0x6521('0x35'))){_0x35b838['limit']=qs[_0x6521('0x1d')](_0x3d0a62[_0x6521('0x2f')][_0x6521('0x1d')]);_0x35b838[_0x6521('0x1c')]=qs[_0x6521('0x1c')](_0x3d0a62['query']['offset']);}_0x35b838[_0x6521('0x36')]=qs[_0x6521('0x37')](_0x3d0a62['query'][_0x6521('0x37')]);_0x35b838['where']=qs[_0x6521('0x38')](_[_0x6521('0x39')](_0x3d0a62['query'],_0x310bd9[_0x6521('0x38')]),_0x365980);if(_0x3d0a62[_0x6521('0x2f')][_0x6521('0x3a')]){_0x35b838[_0x6521('0x3b')]=_[_0x6521('0x3c')](_0x35b838[_0x6521('0x3b')],{'$or':_[_0x6521('0x2d')](_0x365980,function(_0x3cee7e){if(_0x3cee7e[_0x6521('0x3d')]!==_0x6521('0x3e')){var _0x1e968d={};_0x1e968d[_0x3cee7e['name']]={'$like':'%'+_0x3d0a62['query']['filter']+'%'};return _0x1e968d;}})});}_0x35b838=_[_0x6521('0x3c')]({},_0x35b838,_0x3d0a62['options']);var _0x264642={'where':_0x35b838[_0x6521('0x3b')]};return db['ChatOfflineMessage'][_0x6521('0x1b')](_0x264642)[_0x6521('0x23')](function(_0x5325ef){_0x28fbd5['count']=_0x5325ef;if(_0x3d0a62[_0x6521('0x2f')][_0x6521('0x3f')]){_0x35b838[_0x6521('0x40')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x6521('0x41')](_0x35b838);})[_0x6521('0x23')](function(_0x5e54d0){_0x28fbd5['rows']=_0x5e54d0;return _0x28fbd5;})[_0x6521('0x23')](respondWithFilteredResult(_0x53194b,_0x35b838))[_0x6521('0x42')](handleError(_0x53194b,null));};exports['show']=function(_0x54443a,_0x735c63){var _0x542611={'raw':!![],'where':{'id':_0x54443a[_0x6521('0x43')]['id']}},_0x164235={};_0x164235[_0x6521('0x2c')]=_[_0x6521('0x2e')](db[_0x6521('0x29')][_0x6521('0x2a')]);_0x164235[_0x6521('0x2f')]=_[_0x6521('0x2e')](_0x54443a['query']);_0x164235[_0x6521('0x38')]=_['intersection'](_0x164235[_0x6521('0x2c')],_0x164235[_0x6521('0x2f')]);_0x542611[_0x6521('0x30')]=_[_0x6521('0x31')](_0x164235[_0x6521('0x2c')],qs[_0x6521('0x32')](_0x54443a[_0x6521('0x2f')][_0x6521('0x32')]));_0x542611['attributes']=_0x542611[_0x6521('0x30')][_0x6521('0x33')]?_0x542611[_0x6521('0x30')]:_0x164235[_0x6521('0x2c')];if(_0x54443a[_0x6521('0x2f')][_0x6521('0x3f')]){_0x542611[_0x6521('0x40')]=[{'all':!![]}];}_0x542611=_[_0x6521('0x3c')]({},_0x542611,_0x54443a[_0x6521('0x44')]);return db['ChatOfflineMessage']['find'](_0x542611)[_0x6521('0x23')](handleEntityNotFound(_0x735c63,null))[_0x6521('0x23')](respondWithResult(_0x735c63,null))[_0x6521('0x42')](handleError(_0x735c63,null));};exports[_0x6521('0x45')]=function(_0x1e7e36,_0x1a4fc3){return db[_0x6521('0x29')][_0x6521('0x45')](_0x1e7e36['body'],{})[_0x6521('0x23')](respondWithResult(_0x1a4fc3,0xc9))[_0x6521('0x42')](handleError(_0x1a4fc3,null));};exports[_0x6521('0x22')]=function(_0x1e8049,_0x520ebd){if(_0x1e8049[_0x6521('0x46')]['id']){delete _0x1e8049[_0x6521('0x46')]['id'];}return db[_0x6521('0x29')][_0x6521('0x47')]({'where':{'id':_0x1e8049['params']['id']}})['then'](handleEntityNotFound(_0x520ebd,null))[_0x6521('0x23')](saveUpdates(_0x1e8049[_0x6521('0x46')],null))[_0x6521('0x23')](respondWithResult(_0x520ebd,null))[_0x6521('0x42')](handleError(_0x520ebd,null));};exports[_0x6521('0x24')]=function(_0x293269,_0x1a4ad0){return db[_0x6521('0x29')]['find']({'where':{'id':_0x293269[_0x6521('0x43')]['id']}})[_0x6521('0x23')](handleEntityNotFound(_0x1a4ad0,null))['then'](removeEntity(_0x1a4ad0,null))[_0x6521('0x42')](handleError(_0x1a4ad0,null));};exports[_0x6521('0x48')]=function(_0x5ccee6,_0x3ceb49){return db[_0x6521('0x29')]['describe']()[_0x6521('0x23')](respondWithResult(_0x3ceb49,null))[_0x6521('0x42')](handleError(_0x3ceb49,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 7c85592..eba9be5 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 _0xb66c=['rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xb66c,0x175));var _0xcb66=function(_0x3b015a,_0x44e8af){_0x3b015a=_0x3b015a-0x0;var _0x669382=_0xb66c[_0x3b015a];return _0x669382;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var logger=require(_0xcb66('0x1'))('api');var moment=require(_0xcb66('0x2'));var BPromise=require(_0xcb66('0x3'));var rp=require(_0xcb66('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));var attributes=require(_0xcb66('0x7'));module[_0xcb66('0x8')]=function(_0x5d766d,_0x518163){return _0x5d766d[_0xcb66('0x9')](_0xcb66('0xa'),attributes,{'tableName':_0xcb66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcb66('0xc'),'collate':_0xcb66('0xd')});}; \ No newline at end of file +var _0x4b19=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./chatOfflineMessage.attributes','exports','define','chat_offline_messages'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x4b19,0x195));var _0x94b1=function(_0x5c4ce2,_0x4a219b){_0x5c4ce2=_0x5c4ce2-0x0;var _0x34e6fa=_0x4b19[_0x5c4ce2];return _0x34e6fa;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x94b1('0x4'));var fs=require('fs');var path=require(_0x94b1('0x5'));var rimraf=require(_0x94b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x94b1('0x7'));module[_0x94b1('0x8')]=function(_0x52d6c1,_0x24df76){return _0x52d6c1[_0x94b1('0x9')]('ChatOfflineMessage',attributes,{'tableName':_0x94b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x94b1('0xb'),'collate':_0x94b1('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index b56a22f..25073da 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 _0x58f5=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3ec940,_0x4fa2af){var _0x49c7ac=function(_0x3f109e){while(--_0x3f109e){_0x3ec940['push'](_0x3ec940['shift']());}};_0x49c7ac(++_0x4fa2af);}(_0x58f5,0x186));var _0x558f=function(_0x556704,_0x502510){_0x556704=_0x556704-0x0;var _0xac9e5d=_0x58f5[_0x556704];return _0xac9e5d;};'use strict';var _=require(_0x558f('0x0'));var util=require('util');var moment=require(_0x558f('0x1'));var BPromise=require(_0x558f('0x2'));var rs=require(_0x558f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x558f('0x4'))['db'];var utils=require(_0x558f('0x5'));var logger=require(_0x558f('0x6'))(_0x558f('0x7'));var config=require(_0x558f('0x8'));var jayson=require(_0x558f('0x9'));var client=jayson[_0x558f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11b1d0,_0x1f83c0,_0x928768){return new BPromise(function(_0x5673a4,_0x51caa2){return client[_0x558f('0xb')](_0x11b1d0,_0x928768)['then'](function(_0x48bd1b){logger[_0x558f('0xc')](_0x558f('0xd'),_0x1f83c0,_0x558f('0xe'));logger[_0x558f('0xf')](_0x558f('0x10'),_0x1f83c0,'request\x20sent',JSON['stringify'](_0x48bd1b));if(_0x48bd1b[_0x558f('0x11')]){if(_0x48bd1b[_0x558f('0x11')][_0x558f('0x12')]===0x1f4){logger[_0x558f('0x11')](_0x558f('0xd'),_0x1f83c0,_0x48bd1b['error'][_0x558f('0x13')]);return _0x51caa2(_0x48bd1b[_0x558f('0x11')]['message']);}logger[_0x558f('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1f83c0,_0x48bd1b[_0x558f('0x11')][_0x558f('0x13')]);return _0x5673a4(_0x48bd1b[_0x558f('0x11')]['message']);}else{logger[_0x558f('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1f83c0,_0x558f('0xe'));_0x5673a4(_0x48bd1b[_0x558f('0x14')]['message']);}})[_0x558f('0x15')](function(_0x11cce7){logger['error'](_0x558f('0xd'),_0x1f83c0,_0x11cce7);_0x51caa2(_0x11cce7);});});} \ No newline at end of file +var _0x25c5=['client','http','request','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2eb14d,_0x2cbf32){var _0x2d3cd3=function(_0x4ca3e9){while(--_0x4ca3e9){_0x2eb14d['push'](_0x2eb14d['shift']());}};_0x2d3cd3(++_0x2cbf32);}(_0x25c5,0xcf));var _0x525c=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x25c5[_0x1663ae];return _0x30ffb8;};'use strict';var _=require(_0x525c('0x0'));var util=require(_0x525c('0x1'));var moment=require(_0x525c('0x2'));var BPromise=require(_0x525c('0x3'));var rs=require(_0x525c('0x4'));var fs=require('fs');var Redis=require(_0x525c('0x5'));var db=require(_0x525c('0x6'))['db'];var utils=require(_0x525c('0x7'));var logger=require(_0x525c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x525c('0x9')][_0x525c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cb950,_0x58c5d5,_0x5e73ea){return new BPromise(function(_0x39cfbf,_0x55a237){return client[_0x525c('0xb')](_0x5cb950,_0x5e73ea)[_0x525c('0xc')](function(_0x39a8b8){logger[_0x525c('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x58c5d5,_0x525c('0xe'));logger[_0x525c('0xf')](_0x525c('0x10'),_0x58c5d5,'request\x20sent',JSON[_0x525c('0x11')](_0x39a8b8));if(_0x39a8b8[_0x525c('0x12')]){if(_0x39a8b8[_0x525c('0x12')][_0x525c('0x13')]===0x1f4){logger[_0x525c('0x12')](_0x525c('0x14'),_0x58c5d5,_0x39a8b8[_0x525c('0x12')][_0x525c('0x15')]);return _0x55a237(_0x39a8b8[_0x525c('0x12')][_0x525c('0x15')]);}logger[_0x525c('0x12')](_0x525c('0x14'),_0x58c5d5,_0x39a8b8[_0x525c('0x12')][_0x525c('0x15')]);return _0x39cfbf(_0x39a8b8[_0x525c('0x12')]['message']);}else{logger[_0x525c('0xd')](_0x525c('0x14'),_0x58c5d5,'request\x20sent');_0x39cfbf(_0x39a8b8[_0x525c('0x16')][_0x525c('0x15')]);}})[_0x525c('0x17')](function(_0xbdeb2d){logger[_0x525c('0x12')](_0x525c('0x14'),_0x58c5d5,_0xbdeb2d);_0x55a237(_0xbdeb2d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index ada581e..4793be8 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 _0xdcbf=['post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show'];(function(_0x4d5ce6,_0x1f44cb){var _0x59a176=function(_0x3c4d0b){while(--_0x3c4d0b){_0x4d5ce6['push'](_0x4d5ce6['shift']());}};_0x59a176(++_0x1f44cb);}(_0xdcbf,0xbc));var _0xfdcb=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xdcbf[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xfdcb('0x0'));var util=require(_0xfdcb('0x1'));var path=require('path');var timeout=require(_0xfdcb('0x2'));var express=require(_0xfdcb('0x3'));var router=express[_0xfdcb('0x4')]();var auth=require(_0xfdcb('0x5'));var interaction=require(_0xfdcb('0x6'));var config=require(_0xfdcb('0x7'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0xfdcb('0x8')](),controller[_0xfdcb('0x9')]);router['get']('/describe',auth[_0xfdcb('0x8')](),controller['describe']);router[_0xfdcb('0xa')]('/:id',auth[_0xfdcb('0x8')](),controller[_0xfdcb('0xb')]);router[_0xfdcb('0xc')]('/',auth[_0xfdcb('0x8')](),controller[_0xfdcb('0xd')]);router[_0xfdcb('0xe')](_0xfdcb('0xf'),auth[_0xfdcb('0x8')](),controller[_0xfdcb('0x10')]);router[_0xfdcb('0x11')](_0xfdcb('0xf'),auth['isAuthenticated'](),controller[_0xfdcb('0x12')]);module[_0xfdcb('0x13')]=router; \ No newline at end of file +var _0xf642=['Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','post','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0xf642,0x151));var _0x2f64=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0xf642[_0x53e3de];return _0x7b905b;};'use strict';var multer=require(_0x2f64('0x0'));var util=require(_0x2f64('0x1'));var path=require(_0x2f64('0x2'));var timeout=require(_0x2f64('0x3'));var express=require(_0x2f64('0x4'));var router=express[_0x2f64('0x5')]();var auth=require(_0x2f64('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2f64('0x7'));var controller=require(_0x2f64('0x8'));router[_0x2f64('0x9')]('/',auth['isAuthenticated'](),controller[_0x2f64('0xa')]);router[_0x2f64('0x9')](_0x2f64('0xb'),auth['isAuthenticated'](),controller[_0x2f64('0xc')]);router[_0x2f64('0x9')](_0x2f64('0xd'),auth[_0x2f64('0xe')](),controller['show']);router[_0x2f64('0xf')]('/',auth[_0x2f64('0xe')](),controller['create']);router[_0x2f64('0x10')]('/:id',auth[_0x2f64('0xe')](),controller[_0x2f64('0x11')]);router['delete'](_0x2f64('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x2f64('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 500bf79..2d0d905 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 _0x5c56=['sequelize','STRING','mouseOver','INTEGER'];(function(_0x18a296,_0x1cb37b){var _0x55c3a9=function(_0x1b63f2){while(--_0x1b63f2){_0x18a296['push'](_0x18a296['shift']());}};_0x55c3a9(++_0x1cb37b);}(_0x5c56,0xf8));var _0x65c5=function(_0x2e5184,_0x3d9825){_0x2e5184=_0x2e5184-0x0;var _0x298144=_0x5c56[_0x2e5184];return _0x298144;};'use strict';var Sequelize=require(_0x65c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x65c5('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x65c5('0x2'),'timeout'),'defaultValue':_0x65c5('0x2')},'selector':{'type':Sequelize[_0x65c5('0x1')]},'timeout':{'type':Sequelize[_0x65c5('0x3')]}}; \ No newline at end of file +var _0x1b75=['mouseOver','timeout','STRING','INTEGER','sequelize','exports'];(function(_0x4e84de,_0x23f60b){var _0x11bf82=function(_0x540d2f){while(--_0x540d2f){_0x4e84de['push'](_0x4e84de['shift']());}};_0x11bf82(++_0x23f60b);}(_0x1b75,0xa6));var _0x51b7=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x1b75[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0x51b7('0x0'));module[_0x51b7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x51b7('0x2'),_0x51b7('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x51b7('0x4')]},'timeout':{'type':Sequelize[_0x51b7('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index b4a6c66..9d7d1b7 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 _0xb1d7=['attributes','fields','length','includeAll','include','merge','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','show','ChatProactiveAction','rawAttributes','query','keys','intersection','model'];(function(_0x85564b,_0x2bf273){var _0x1bb2d6=function(_0x524e27){while(--_0x524e27){_0x85564b['push'](_0x85564b['shift']());}};_0x1bb2d6(++_0x2bf273);}(_0xb1d7,0xbc));var _0x7b1d=function(_0xfbd652,_0x516b2b){_0xfbd652=_0xfbd652-0x0;var _0x53850d=_0xb1d7[_0xfbd652];return _0x53850d;};'use strict';var pdf=require(_0x7b1d('0x0'));var emlformat=require(_0x7b1d('0x1'));var rimraf=require(_0x7b1d('0x2'));var zipdir=require(_0x7b1d('0x3'));var jsonpatch=require(_0x7b1d('0x4'));var rp=require('request-promise');var moment=require(_0x7b1d('0x5'));var BPromise=require(_0x7b1d('0x6'));var Mustache=require(_0x7b1d('0x7'));var util=require('util');var path=require(_0x7b1d('0x8'));var sox=require('sox');var csv=require(_0x7b1d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7b1d('0xa'));var squel=require(_0x7b1d('0xb'));var crypto=require(_0x7b1d('0xc'));var jsforce=require(_0x7b1d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7b1d('0x9'));var querystring=require(_0x7b1d('0xe'));var Papa=require(_0x7b1d('0xf'));var Redis=require(_0x7b1d('0x10'));var authService=require(_0x7b1d('0x11'));var qs=require(_0x7b1d('0x12'));var as=require(_0x7b1d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7b1d('0x14'));var config=require(_0x7b1d('0x15'));var licenseUtil=require(_0x7b1d('0x16'));var db=require(_0x7b1d('0x17'))['db'];function respondWithStatusCode(_0x572cf5,_0x26c5eb){_0x26c5eb=_0x26c5eb||0xcc;return function(_0x16550f){if(_0x16550f){return _0x572cf5[_0x7b1d('0x18')](_0x26c5eb);}return _0x572cf5['status'](_0x26c5eb)[_0x7b1d('0x19')]();};}function respondWithResult(_0x5a7894,_0x3f3430){_0x3f3430=_0x3f3430||0xc8;return function(_0x2f359a){if(_0x2f359a){return _0x5a7894[_0x7b1d('0x1a')](_0x3f3430)[_0x7b1d('0x1b')](_0x2f359a);}};}function respondWithFilteredResult(_0x2bc223,_0x58a175){return function(_0xf1e7a7){if(_0xf1e7a7){var _0x3364a1=_0xf1e7a7[_0x7b1d('0x1c')],_0x28f8c1=_0x58a175[_0x7b1d('0x1d')],_0x258c34=_0x58a175[_0x7b1d('0x1d')]+_0x58a175['limit'],_0xf34b8d;if(_0x258c34>=_0x3364a1){_0x258c34=_0x3364a1;_0xf34b8d=0xc8;}else{_0xf34b8d=0xce;}_0x2bc223['status'](_0xf34b8d);return _0x2bc223[_0x7b1d('0x1e')](_0x7b1d('0x1f'),_0x28f8c1+'-'+_0x258c34+'/'+_0x3364a1)[_0x7b1d('0x1b')](_0xf1e7a7);}return null;};}function patchUpdates(_0x5ca666){return function(_0xb0cddd){try{jsonpatch[_0x7b1d('0x20')](_0xb0cddd,_0x5ca666,!![]);}catch(_0x4240d1){return BPromise[_0x7b1d('0x21')](_0x4240d1);}return _0xb0cddd['save']();};}function saveUpdates(_0x212b0c,_0x50ff36){return function(_0x3265a1){if(_0x3265a1){return _0x3265a1[_0x7b1d('0x22')](_0x212b0c)['then'](function(_0x23949f){return _0x23949f;});}return null;};}function removeEntity(_0x316e18,_0x109a7c){return function(_0x19d278){if(_0x19d278){return _0x19d278[_0x7b1d('0x23')]()[_0x7b1d('0x24')](function(){_0x316e18[_0x7b1d('0x1a')](0xcc)[_0x7b1d('0x19')]();});}};}function handleEntityNotFound(_0x1e8195,_0x41d6f1){return function(_0x27e1f8){if(!_0x27e1f8){_0x1e8195[_0x7b1d('0x18')](0x194);}return _0x27e1f8;};}function handleError(_0x41ebf6,_0x56e5ad){_0x56e5ad=_0x56e5ad||0x1f4;return function(_0x3596e3){logger[_0x7b1d('0x25')](_0x3596e3[_0x7b1d('0x26')]);if(_0x3596e3['name']){delete _0x3596e3[_0x7b1d('0x27')];}_0x41ebf6['status'](_0x56e5ad)[_0x7b1d('0x28')](_0x3596e3);};}exports[_0x7b1d('0x29')]=function(_0x5c7a98,_0x34fdd0){var _0x1c01d7={'raw':!![],'where':{'id':_0x5c7a98['params']['id']}},_0x3b59c4={};_0x3b59c4['model']=_['keys'](db[_0x7b1d('0x2a')][_0x7b1d('0x2b')]);_0x3b59c4[_0x7b1d('0x2c')]=_[_0x7b1d('0x2d')](_0x5c7a98['query']);_0x3b59c4['filters']=_[_0x7b1d('0x2e')](_0x3b59c4[_0x7b1d('0x2f')],_0x3b59c4[_0x7b1d('0x2c')]);_0x1c01d7[_0x7b1d('0x30')]=_[_0x7b1d('0x2e')](_0x3b59c4['model'],qs[_0x7b1d('0x31')](_0x5c7a98[_0x7b1d('0x2c')]['fields']));_0x1c01d7[_0x7b1d('0x30')]=_0x1c01d7[_0x7b1d('0x30')][_0x7b1d('0x32')]?_0x1c01d7[_0x7b1d('0x30')]:_0x3b59c4['model'];if(_0x5c7a98[_0x7b1d('0x2c')][_0x7b1d('0x33')]){_0x1c01d7[_0x7b1d('0x34')]=[{'all':!![]}];}_0x1c01d7=_[_0x7b1d('0x35')]({},_0x1c01d7,_0x5c7a98['options']);return db[_0x7b1d('0x2a')][_0x7b1d('0x36')](_0x1c01d7)[_0x7b1d('0x24')](handleEntityNotFound(_0x34fdd0,null))[_0x7b1d('0x24')](respondWithResult(_0x34fdd0,null))[_0x7b1d('0x37')](handleError(_0x34fdd0,null));};exports[_0x7b1d('0x38')]=function(_0x2469f7,_0x1d9869){return db['ChatProactiveAction'][_0x7b1d('0x38')](_0x2469f7[_0x7b1d('0x39')],{})[_0x7b1d('0x24')](respondWithResult(_0x1d9869,0xc9))[_0x7b1d('0x37')](handleError(_0x1d9869,null));};exports[_0x7b1d('0x22')]=function(_0x2e5ca5,_0x1ffc10){if(_0x2e5ca5[_0x7b1d('0x39')]['id']){delete _0x2e5ca5[_0x7b1d('0x39')]['id'];}return db[_0x7b1d('0x2a')]['find']({'where':{'id':_0x2e5ca5['params']['id']}})[_0x7b1d('0x24')](handleEntityNotFound(_0x1ffc10,null))[_0x7b1d('0x24')](saveUpdates(_0x2e5ca5[_0x7b1d('0x39')],null))['then'](respondWithResult(_0x1ffc10,null))[_0x7b1d('0x37')](handleError(_0x1ffc10,null));};exports[_0x7b1d('0x23')]=function(_0x463a4a,_0x181b0c){return db[_0x7b1d('0x2a')][_0x7b1d('0x36')]({'where':{'id':_0x463a4a[_0x7b1d('0x3a')]['id']}})[_0x7b1d('0x24')](handleEntityNotFound(_0x181b0c,null))[_0x7b1d('0x24')](removeEntity(_0x181b0c,null))[_0x7b1d('0x37')](handleError(_0x181b0c,null));}; \ No newline at end of file +var _0xaee6=['update','destroy','html-pdf','rimraf','zip-dir','request-promise','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/license/util','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','error','name','send','show','params','model','keys','ChatProactiveAction','query','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','create','body'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xaee6,0xbc));var _0x6aee=function(_0x3926be,_0x52a1a0){_0x3926be=_0x3926be-0x0;var _0x2fa46b=_0xaee6[_0x3926be];return _0x2fa46b;};'use strict';var pdf=require(_0x6aee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6aee('0x1'));var zipdir=require(_0x6aee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6aee('0x3'));var moment=require(_0x6aee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6aee('0x5'));var util=require(_0x6aee('0x6'));var path=require(_0x6aee('0x7'));var sox=require(_0x6aee('0x8'));var csv=require(_0x6aee('0x9'));var ejs=require(_0x6aee('0xa'));var fs=require('fs');var _=require(_0x6aee('0xb'));var squel=require(_0x6aee('0xc'));var crypto=require(_0x6aee('0xd'));var jsforce=require(_0x6aee('0xe'));var deskjs=require(_0x6aee('0xf'));var toCsv=require(_0x6aee('0x9'));var querystring=require(_0x6aee('0x10'));var Papa=require(_0x6aee('0x11'));var Redis=require(_0x6aee('0x12'));var authService=require(_0x6aee('0x13'));var qs=require(_0x6aee('0x14'));var as=require(_0x6aee('0x15'));var hardwareService=require(_0x6aee('0x16'));var logger=require(_0x6aee('0x17'))(_0x6aee('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6aee('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5326b5,_0x46d317){_0x46d317=_0x46d317||0xcc;return function(_0x19aa89){if(_0x19aa89){return _0x5326b5[_0x6aee('0x1a')](_0x46d317);}return _0x5326b5['status'](_0x46d317)[_0x6aee('0x1b')]();};}function respondWithResult(_0x2d7dca,_0x572e23){_0x572e23=_0x572e23||0xc8;return function(_0x383080){if(_0x383080){return _0x2d7dca[_0x6aee('0x1c')](_0x572e23)['json'](_0x383080);}};}function respondWithFilteredResult(_0x32ca20,_0x378160){return function(_0x3f0a3d){if(_0x3f0a3d){var _0x53c798=_0x3f0a3d[_0x6aee('0x1d')],_0x238ac2=_0x378160['offset'],_0x56e023=_0x378160[_0x6aee('0x1e')]+_0x378160[_0x6aee('0x1f')],_0x23b8bc;if(_0x56e023>=_0x53c798){_0x56e023=_0x53c798;_0x23b8bc=0xc8;}else{_0x23b8bc=0xce;}_0x32ca20['status'](_0x23b8bc);return _0x32ca20[_0x6aee('0x20')](_0x6aee('0x21'),_0x238ac2+'-'+_0x56e023+'/'+_0x53c798)[_0x6aee('0x22')](_0x3f0a3d);}return null;};}function patchUpdates(_0x3596cc){return function(_0x5b030d){try{jsonpatch[_0x6aee('0x23')](_0x5b030d,_0x3596cc,!![]);}catch(_0x453ac6){return BPromise[_0x6aee('0x24')](_0x453ac6);}return _0x5b030d[_0x6aee('0x25')]();};}function saveUpdates(_0x18539d,_0x3450e9){return function(_0x335bd2){if(_0x335bd2){return _0x335bd2['update'](_0x18539d)[_0x6aee('0x26')](function(_0x22a5f2){return _0x22a5f2;});}return null;};}function removeEntity(_0x1ba8a3,_0x5f4584){return function(_0x4dc45d){if(_0x4dc45d){return _0x4dc45d['destroy']()['then'](function(){_0x1ba8a3['status'](0xcc)[_0x6aee('0x1b')]();});}};}function handleEntityNotFound(_0x25f88a,_0x2578f6){return function(_0x586c3d){if(!_0x586c3d){_0x25f88a[_0x6aee('0x1a')](0x194);}return _0x586c3d;};}function handleError(_0x22aec7,_0x17ed17){_0x17ed17=_0x17ed17||0x1f4;return function(_0x4a4b4b){logger[_0x6aee('0x27')](_0x4a4b4b['stack']);if(_0x4a4b4b['name']){delete _0x4a4b4b[_0x6aee('0x28')];}_0x22aec7[_0x6aee('0x1c')](_0x17ed17)[_0x6aee('0x29')](_0x4a4b4b);};}exports[_0x6aee('0x2a')]=function(_0x402cae,_0x4831af){var _0x340ecb={'raw':!![],'where':{'id':_0x402cae[_0x6aee('0x2b')]['id']}},_0x44262b={};_0x44262b[_0x6aee('0x2c')]=_[_0x6aee('0x2d')](db[_0x6aee('0x2e')]['rawAttributes']);_0x44262b[_0x6aee('0x2f')]=_[_0x6aee('0x2d')](_0x402cae[_0x6aee('0x2f')]);_0x44262b['filters']=_[_0x6aee('0x30')](_0x44262b[_0x6aee('0x2c')],_0x44262b['query']);_0x340ecb['attributes']=_[_0x6aee('0x30')](_0x44262b['model'],qs[_0x6aee('0x31')](_0x402cae[_0x6aee('0x2f')]['fields']));_0x340ecb[_0x6aee('0x32')]=_0x340ecb[_0x6aee('0x32')][_0x6aee('0x33')]?_0x340ecb['attributes']:_0x44262b[_0x6aee('0x2c')];if(_0x402cae[_0x6aee('0x2f')][_0x6aee('0x34')]){_0x340ecb[_0x6aee('0x35')]=[{'all':!![]}];}_0x340ecb=_[_0x6aee('0x36')]({},_0x340ecb,_0x402cae[_0x6aee('0x37')]);return db[_0x6aee('0x2e')][_0x6aee('0x38')](_0x340ecb)['then'](handleEntityNotFound(_0x4831af,null))['then'](respondWithResult(_0x4831af,null))[_0x6aee('0x39')](handleError(_0x4831af,null));};exports[_0x6aee('0x3a')]=function(_0x41e515,_0x29e9c8){return db[_0x6aee('0x2e')]['create'](_0x41e515[_0x6aee('0x3b')],{})[_0x6aee('0x26')](respondWithResult(_0x29e9c8,0xc9))[_0x6aee('0x39')](handleError(_0x29e9c8,null));};exports[_0x6aee('0x3c')]=function(_0x344d47,_0x2348fe){if(_0x344d47[_0x6aee('0x3b')]['id']){delete _0x344d47[_0x6aee('0x3b')]['id'];}return db[_0x6aee('0x2e')]['find']({'where':{'id':_0x344d47[_0x6aee('0x2b')]['id']}})[_0x6aee('0x26')](handleEntityNotFound(_0x2348fe,null))['then'](saveUpdates(_0x344d47['body'],null))[_0x6aee('0x26')](respondWithResult(_0x2348fe,null))['catch'](handleError(_0x2348fe,null));};exports[_0x6aee('0x3d')]=function(_0x4cca5b,_0x535678){return db[_0x6aee('0x2e')][_0x6aee('0x38')]({'where':{'id':_0x4cca5b['params']['id']}})[_0x6aee('0x26')](handleEntityNotFound(_0x535678,null))['then'](removeEntity(_0x535678,null))[_0x6aee('0x39')](handleError(_0x535678,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 82e1b8b..3461ccb 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 _0x5362=['ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x145fc2,_0x180a29){var _0x2bddea=function(_0x20368f){while(--_0x20368f){_0x145fc2['push'](_0x145fc2['shift']());}};_0x2bddea(++_0x180a29);}(_0x5362,0x17b));var _0x2536=function(_0x6d884f,_0x55f534){_0x6d884f=_0x6d884f-0x0;var _0x533cdc=_0x5362[_0x6d884f];return _0x533cdc;};'use strict';var _=require(_0x2536('0x0'));var util=require(_0x2536('0x1'));var logger=require(_0x2536('0x2'))('api');var moment=require(_0x2536('0x3'));var BPromise=require(_0x2536('0x4'));var rp=require(_0x2536('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2536('0x6'));var config=require(_0x2536('0x7'));var attributes=require(_0x2536('0x8'));module[_0x2536('0x9')]=function(_0x3ea80c,_0x47b4b3){return _0x3ea80c[_0x2536('0xa')](_0x2536('0xb'),attributes,{'tableName':_0x2536('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b5d=['bluebird','../../config/environment','exports','define','chat_proactive_actions','util','api','moment'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x7b5d,0x1e5));var _0xd7b5=function(_0x42d175,_0x562c67){_0x42d175=_0x42d175-0x0;var _0x355437=_0x7b5d[_0x42d175];return _0x355437;};'use strict';var _=require('lodash');var util=require(_0xd7b5('0x0'));var logger=require('../../config/logger')(_0xd7b5('0x1'));var moment=require(_0xd7b5('0x2'));var BPromise=require(_0xd7b5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd7b5('0x4'));var attributes=require('./chatProactiveAction.attributes');module[_0xd7b5('0x5')]=function(_0x4bb9d2,_0x15a34c){return _0x4bb9d2[_0xd7b5('0x6')]('ChatProactiveAction',attributes,{'tableName':_0xd7b5('0x7'),'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 954733e..31699af 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 _0x3807=['info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x3807,0x14b));var _0x7380=function(_0x3f8ac5,_0x42fa33){_0x3f8ac5=_0x3f8ac5-0x0;var _0x5d7982=_0x3807[_0x3f8ac5];return _0x5d7982;};'use strict';var _=require('lodash');var util=require(_0x7380('0x0'));var moment=require(_0x7380('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7380('0x2'));var db=require(_0x7380('0x3'))['db'];var utils=require(_0x7380('0x4'));var logger=require(_0x7380('0x5'))(_0x7380('0x6'));var config=require(_0x7380('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7380('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33809e,_0x2c8598,_0x10ba6a){return new BPromise(function(_0x546808,_0x510f7d){return client[_0x7380('0x9')](_0x33809e,_0x10ba6a)[_0x7380('0xa')](function(_0x4667e6){logger[_0x7380('0xb')](_0x7380('0xc'),_0x2c8598,_0x7380('0xd'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2c8598,_0x7380('0xd'),JSON[_0x7380('0xe')](_0x4667e6));if(_0x4667e6[_0x7380('0xf')]){if(_0x4667e6[_0x7380('0xf')]['code']===0x1f4){logger[_0x7380('0xf')](_0x7380('0xc'),_0x2c8598,_0x4667e6[_0x7380('0xf')][_0x7380('0x10')]);return _0x510f7d(_0x4667e6['error'][_0x7380('0x10')]);}logger[_0x7380('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2c8598,_0x4667e6[_0x7380('0xf')][_0x7380('0x10')]);return _0x546808(_0x4667e6[_0x7380('0xf')]['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x2c8598,_0x7380('0xd'));_0x546808(_0x4667e6['result']['message']);}})[_0x7380('0x11')](function(_0x4e726d){logger[_0x7380('0xf')](_0x7380('0xc'),_0x2c8598,_0x4e726d);_0x510f7d(_0x4e726d);});});} \ No newline at end of file +var _0xfbc2=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfbc2,0x10a));var _0x2fbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfbc2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fbc('0x0'));var util=require(_0x2fbc('0x1'));var moment=require(_0x2fbc('0x2'));var BPromise=require(_0x2fbc('0x3'));var rs=require(_0x2fbc('0x4'));var fs=require('fs');var Redis=require(_0x2fbc('0x5'));var db=require(_0x2fbc('0x6'))['db'];var utils=require(_0x2fbc('0x7'));var logger=require(_0x2fbc('0x8'))(_0x2fbc('0x9'));var config=require(_0x2fbc('0xa'));var jayson=require(_0x2fbc('0xb'));var client=jayson[_0x2fbc('0xc')][_0x2fbc('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1fc094,_0x3cfb96,_0x23a3f2){return new BPromise(function(_0x3d9de5,_0x8dad03){return client[_0x2fbc('0xe')](_0x1fc094,_0x23a3f2)['then'](function(_0x354f7b){logger[_0x2fbc('0xf')](_0x2fbc('0x10'),_0x3cfb96,_0x2fbc('0x11'));logger['debug'](_0x2fbc('0x12'),_0x3cfb96,_0x2fbc('0x11'),JSON[_0x2fbc('0x13')](_0x354f7b));if(_0x354f7b[_0x2fbc('0x14')]){if(_0x354f7b['error'][_0x2fbc('0x15')]===0x1f4){logger[_0x2fbc('0x14')](_0x2fbc('0x10'),_0x3cfb96,_0x354f7b[_0x2fbc('0x14')][_0x2fbc('0x16')]);return _0x8dad03(_0x354f7b['error'][_0x2fbc('0x16')]);}logger[_0x2fbc('0x14')](_0x2fbc('0x10'),_0x3cfb96,_0x354f7b[_0x2fbc('0x14')][_0x2fbc('0x16')]);return _0x3d9de5(_0x354f7b[_0x2fbc('0x14')][_0x2fbc('0x16')]);}else{logger[_0x2fbc('0xf')](_0x2fbc('0x10'),_0x3cfb96,_0x2fbc('0x11'));_0x3d9de5(_0x354f7b[_0x2fbc('0x17')][_0x2fbc('0x16')]);}})['catch'](function(_0x9246bc){logger[_0x2fbc('0x14')](_0x2fbc('0x10'),_0x3cfb96,_0x9246bc);_0x8dad03(_0x9246bc);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 9550b3d..3807e0c 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 _0x0896=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','post','isAuthenticated','create','put','update','destroy','exports','multer','util','path','express'];(function(_0x58b84a,_0x389b47){var _0x4c5dae=function(_0x27494b){while(--_0x27494b){_0x58b84a['push'](_0x58b84a['shift']());}};_0x4c5dae(++_0x389b47);}(_0x0896,0xfb));var _0x6089=function(_0x11508b,_0x909e1d){_0x11508b=_0x11508b-0x0;var _0x482a40=_0x0896[_0x11508b];return _0x482a40;};'use strict';var multer=require(_0x6089('0x0'));var util=require(_0x6089('0x1'));var path=require(_0x6089('0x2'));var timeout=require('connect-timeout');var express=require(_0x6089('0x3'));var router=express[_0x6089('0x4')]();var auth=require(_0x6089('0x5'));var interaction=require(_0x6089('0x6'));var config=require(_0x6089('0x7'));var controller=require(_0x6089('0x8'));router['get'](_0x6089('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x6089('0xa')]('/',auth[_0x6089('0xb')](),controller[_0x6089('0xc')]);router[_0x6089('0xd')](_0x6089('0x9'),auth[_0x6089('0xb')](),controller[_0x6089('0xe')]);router['delete'](_0x6089('0x9'),auth[_0x6089('0xb')](),controller[_0x6089('0xf')]);module[_0x6089('0x10')]=router; \ No newline at end of file +var _0x8d6f=['isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d6f,0x1bb));var _0xf8d6=function(_0x2cd02c,_0x3ad4c2){_0x2cd02c=_0x2cd02c-0x0;var _0x2be4d0=_0x8d6f[_0x2cd02c];return _0x2be4d0;};'use strict';var multer=require(_0xf8d6('0x0'));var util=require(_0xf8d6('0x1'));var path=require(_0xf8d6('0x2'));var timeout=require(_0xf8d6('0x3'));var express=require(_0xf8d6('0x4'));var router=express[_0xf8d6('0x5')]();var auth=require(_0xf8d6('0x6'));var interaction=require(_0xf8d6('0x7'));var config=require(_0xf8d6('0x8'));var controller=require(_0xf8d6('0x9'));router[_0xf8d6('0xa')](_0xf8d6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xf8d6('0xc')]('/',auth['isAuthenticated'](),controller[_0xf8d6('0xd')]);router[_0xf8d6('0xe')](_0xf8d6('0xb'),auth['isAuthenticated'](),controller[_0xf8d6('0xf')]);router[_0xf8d6('0x10')](_0xf8d6('0xb'),auth[_0xf8d6('0x11')](),controller[_0xf8d6('0x12')]);module[_0xf8d6('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index a6744f2..29f2d21 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 _0x1233=['roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x2d34fb,_0x314bfc){var _0x5b97d0=function(_0x11f515){while(--_0x11f515){_0x2d34fb['push'](_0x2d34fb['shift']());}};_0x5b97d0(++_0x314bfc);}(_0x1233,0x115));var _0x3123=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x1233[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require(_0x3123('0x0'));module[_0x3123('0x1')]={'name':{'type':Sequelize[_0x3123('0x2')],'unique':_0x3123('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3123('0x4')]('rrmemory','beepall',_0x3123('0x5'))}}; \ No newline at end of file +var _0x2efd=['roundrobin','sequelize','exports','name','STRING','INTEGER','beepall'];(function(_0x388928,_0x3012a0){var _0x5ce53d=function(_0x99d425){while(--_0x99d425){_0x388928['push'](_0x388928['shift']());}};_0x5ce53d(++_0x3012a0);}(_0x2efd,0x189));var _0xd2ef=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2efd[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd2ef('0x0'));module[_0xd2ef('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd2ef('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd2ef('0x3')]},'timeout':{'type':Sequelize[_0xd2ef('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xd2ef('0x5'),_0xd2ef('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 95786be..9336f74 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 _0x48c5=['every','TeamId','includes','all','union','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','client','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','ChatQueues','end','stack','name','send','index','ChatQueue','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','include','rows','params','rawAttributes','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','create','body','describe','getMembers','findOne','UserChatQueue','ChatQueueId','options','findAll','findAndCountAll','UserId','agent','chatPause','updatedAt','%s/%s','SIP','Team','length','addTeams','ids','User','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','SELECT'];(function(_0x343174,_0x5c79d4){var _0x53fa0d=function(_0x2039e9){while(--_0x2039e9){_0x343174['push'](_0x343174['shift']());}};_0x53fa0d(++_0x5c79d4);}(_0x48c5,0xa1));var _0x548c=function(_0x474bd9,_0x424e62){_0x474bd9=_0x474bd9-0x0;var _0x52413e=_0x48c5[_0x474bd9];return _0x52413e;};'use strict';var pdf=require(_0x548c('0x0'));var emlformat=require(_0x548c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x548c('0x2'));var jsonpatch=require(_0x548c('0x3'));var rp=require('request-promise');var moment=require(_0x548c('0x4'));var BPromise=require(_0x548c('0x5'));var Mustache=require('mustache');var util=require(_0x548c('0x6'));var path=require(_0x548c('0x7'));var sox=require(_0x548c('0x8'));var csv=require(_0x548c('0x9'));var ejs=require(_0x548c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x548c('0xb'));var crypto=require('crypto');var jsforce=require(_0x548c('0xc'));var deskjs=require(_0x548c('0xd'));var toCsv=require(_0x548c('0x9'));var querystring=require('querystring');var Papa=require(_0x548c('0xe'));var Redis=require(_0x548c('0xf'));var authService=require(_0x548c('0x10'));var qs=require(_0x548c('0x11'));var as=require(_0x548c('0x12'));var hardwareService=require(_0x548c('0x13'));var logger=require(_0x548c('0x14'))(_0x548c('0x15'));var utils=require('../../config/utils');var config=require(_0x548c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x548c('0x17'))['db'];config[_0x548c('0x18')]=_['defaults'](config[_0x548c('0x18')],{'host':_0x548c('0x19'),'port':0x18eb});var socket=require(_0x548c('0x1a'))(new Redis(config['redis']));require(_0x548c('0x1b'))[_0x548c('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x548c('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a688f,_0x18841c,_0x2f6b87,_0x31d989){return new BPromise(function(_0x444279,_0x1c2d9e){var _0x38df4b=_0x31d989||client;return _0x38df4b[_0x548c('0x1e')](_0x1a688f,_0x2f6b87)['then'](function(_0xf6ab41){logger['info'](_0x548c('0x1f'),_0x18841c,_0x548c('0x20'));logger[_0x548c('0x21')](_0x548c('0x22'),_0x18841c,'request\x20sent',JSON['stringify'](_0xf6ab41));if(_0xf6ab41[_0x548c('0x23')]){if(_0xf6ab41[_0x548c('0x23')]['code']===0x1f4){logger[_0x548c('0x23')](_0x548c('0x1f'),_0x18841c,_0xf6ab41['error'][_0x548c('0x24')]);return _0x1c2d9e(_0xf6ab41['error'][_0x548c('0x24')]);}logger[_0x548c('0x23')](_0x548c('0x1f'),_0x18841c,_0xf6ab41[_0x548c('0x23')][_0x548c('0x24')]);return _0x444279(_0xf6ab41[_0x548c('0x23')]['message']);}else{logger[_0x548c('0x25')]('ChatQueue,\x20%s,\x20%s',_0x18841c,_0x548c('0x20'));_0x444279(_0xf6ab41[_0x548c('0x26')][_0x548c('0x24')]);}})[_0x548c('0x27')](function(_0x7c73cc){logger[_0x548c('0x23')]('ChatQueue,\x20%s,\x20%s',_0x18841c,_0x7c73cc);_0x1c2d9e(_0x7c73cc);});});}function respondWithStatusCode(_0x4f1537,_0x48f64f){_0x48f64f=_0x48f64f||0xcc;return function(_0x4a2d59){if(_0x4a2d59){return _0x4f1537[_0x548c('0x28')](_0x48f64f);}return _0x4f1537[_0x548c('0x29')](_0x48f64f)['end']();};}function respondWithResult(_0x3102a8,_0x206893){_0x206893=_0x206893||0xc8;return function(_0x565043){if(_0x565043){return _0x3102a8[_0x548c('0x29')](_0x206893)[_0x548c('0x2a')](_0x565043);}};}function respondWithFilteredResult(_0x341b27,_0x22bf91){return function(_0x5520bf){if(_0x5520bf){var _0x52c7fa=_0x5520bf['count'],_0x11930a=_0x22bf91['offset'],_0xbb01bc=_0x22bf91[_0x548c('0x2b')]+_0x22bf91[_0x548c('0x2c')],_0xc981b1;if(_0xbb01bc>=_0x52c7fa){_0xbb01bc=_0x52c7fa;_0xc981b1=0xc8;}else{_0xc981b1=0xce;}_0x341b27[_0x548c('0x29')](_0xc981b1);return _0x341b27['set'](_0x548c('0x2d'),_0x11930a+'-'+_0xbb01bc+'/'+_0x52c7fa)[_0x548c('0x2a')](_0x5520bf);}return null;};}function patchUpdates(_0x3420ea){return function(_0x42201c){try{jsonpatch[_0x548c('0x2e')](_0x42201c,_0x3420ea,!![]);}catch(_0x46b219){return BPromise[_0x548c('0x2f')](_0x46b219);}return _0x42201c[_0x548c('0x30')]();};}function saveUpdates(_0x2a3ed7,_0x4dfdec){return function(_0x42a1a6){if(_0x42a1a6){return _0x42a1a6[_0x548c('0x31')](_0x2a3ed7)[_0x548c('0x32')](function(_0x2ca3c4){return _0x2ca3c4;});}return null;};}function removeEntity(_0x5de789,_0x495458){return function(_0x538fbe){if(_0x538fbe){return _0x538fbe[_0x548c('0x33')]()['then'](function(){var _0x210c2e=_0x538fbe['get']({'plain':!![]});var _0x656721=_0x548c('0x34');return db['UserProfileResource'][_0x548c('0x33')]({'where':{'type':_0x656721,'resourceId':_0x210c2e['id']}})[_0x548c('0x32')](function(){return _0x538fbe;});})[_0x548c('0x32')](function(){_0x5de789[_0x548c('0x29')](0xcc)[_0x548c('0x35')]();});}};}function handleEntityNotFound(_0x1b22dc,_0x112b63){return function(_0x1a23c7){if(!_0x1a23c7){_0x1b22dc[_0x548c('0x28')](0x194);}return _0x1a23c7;};}function handleError(_0x37f044,_0x3d43d7){_0x3d43d7=_0x3d43d7||0x1f4;return function(_0x1d54c6){logger[_0x548c('0x23')](_0x1d54c6[_0x548c('0x36')]);if(_0x1d54c6[_0x548c('0x37')]){delete _0x1d54c6[_0x548c('0x37')];}_0x37f044[_0x548c('0x29')](_0x3d43d7)[_0x548c('0x38')](_0x1d54c6);};}exports[_0x548c('0x39')]=function(_0x3a5877,_0x4e271f){var _0xe69410={},_0x5e9cd2={},_0x5783bd={'count':0x0,'rows':[]};var _0x929f32=_['map'](db[_0x548c('0x3a')]['rawAttributes'],function(_0x22c7a2){return{'name':_0x22c7a2[_0x548c('0x3b')],'type':_0x22c7a2[_0x548c('0x3c')][_0x548c('0x3d')]};});_0x5e9cd2[_0x548c('0x3e')]=_[_0x548c('0x3f')](_0x929f32,_0x548c('0x37'));_0x5e9cd2['query']=_[_0x548c('0x40')](_0x3a5877[_0x548c('0x41')]);_0x5e9cd2[_0x548c('0x42')]=_[_0x548c('0x43')](_0x5e9cd2['model'],_0x5e9cd2[_0x548c('0x41')]);_0xe69410[_0x548c('0x44')]=_[_0x548c('0x43')](_0x5e9cd2[_0x548c('0x3e')],qs['fields'](_0x3a5877['query'][_0x548c('0x45')]));_0xe69410['attributes']=_0xe69410[_0x548c('0x44')]['length']?_0xe69410[_0x548c('0x44')]:_0x5e9cd2[_0x548c('0x3e')];if(!_0x3a5877[_0x548c('0x41')][_0x548c('0x46')](_0x548c('0x47'))){_0xe69410[_0x548c('0x2c')]=qs[_0x548c('0x2c')](_0x3a5877[_0x548c('0x41')][_0x548c('0x2c')]);_0xe69410[_0x548c('0x2b')]=qs[_0x548c('0x2b')](_0x3a5877[_0x548c('0x41')]['offset']);}_0xe69410[_0x548c('0x48')]=qs[_0x548c('0x49')](_0x3a5877[_0x548c('0x41')][_0x548c('0x49')]);_0xe69410[_0x548c('0x4a')]=qs[_0x548c('0x42')](_[_0x548c('0x4b')](_0x3a5877[_0x548c('0x41')],_0x5e9cd2[_0x548c('0x42')]),_0x929f32);if(_0x3a5877[_0x548c('0x41')]['filter']){_0xe69410['where']=_[_0x548c('0x4c')](_0xe69410[_0x548c('0x4a')],{'$or':_[_0x548c('0x3f')](_0x929f32,function(_0x16ed99){if(_0x16ed99[_0x548c('0x3c')]!==_0x548c('0x4d')){var _0x2d6d6d={};_0x2d6d6d[_0x16ed99[_0x548c('0x37')]]={'$like':'%'+_0x3a5877[_0x548c('0x41')][_0x548c('0x4e')]+'%'};return _0x2d6d6d;}})});}_0xe69410=_[_0x548c('0x4c')]({},_0xe69410,_0x3a5877['options']);var _0x414072={'where':_0xe69410[_0x548c('0x4a')]};return db[_0x548c('0x3a')][_0x548c('0x4f')](_0x414072)['then'](function(_0x176f6a){_0x5783bd[_0x548c('0x4f')]=_0x176f6a;if(_0x3a5877[_0x548c('0x41')]['includeAll']){_0xe69410[_0x548c('0x50')]=[{'all':!![]}];}return db[_0x548c('0x3a')]['findAll'](_0xe69410);})['then'](function(_0x3c382e){_0x5783bd[_0x548c('0x51')]=_0x3c382e;return _0x5783bd;})[_0x548c('0x32')](respondWithFilteredResult(_0x4e271f,_0xe69410))[_0x548c('0x27')](handleError(_0x4e271f,null));};exports['show']=function(_0x3e5db2,_0x54f5eb){var _0x14aff8={'raw':!![],'where':{'id':_0x3e5db2[_0x548c('0x52')]['id']}},_0x82f5db={};_0x82f5db[_0x548c('0x3e')]=_['keys'](db[_0x548c('0x3a')][_0x548c('0x53')]);_0x82f5db[_0x548c('0x41')]=_[_0x548c('0x40')](_0x3e5db2[_0x548c('0x41')]);_0x82f5db[_0x548c('0x42')]=_[_0x548c('0x43')](_0x82f5db[_0x548c('0x3e')],_0x82f5db[_0x548c('0x41')]);_0x14aff8['attributes']=_['intersection'](_0x82f5db['model'],qs[_0x548c('0x45')](_0x3e5db2[_0x548c('0x41')][_0x548c('0x45')]));_0x14aff8['attributes']=_0x14aff8[_0x548c('0x44')]['length']?_0x14aff8[_0x548c('0x44')]:_0x82f5db[_0x548c('0x3e')];if(_0x3e5db2[_0x548c('0x41')]['includeAll']){_0x14aff8[_0x548c('0x50')]=[{'all':!![]}];}_0x14aff8=_[_0x548c('0x4c')]({},_0x14aff8,_0x3e5db2['options']);return db['ChatQueue'][_0x548c('0x54')](_0x14aff8)[_0x548c('0x32')](handleEntityNotFound(_0x54f5eb,null))['then'](respondWithResult(_0x54f5eb,null))['catch'](handleError(_0x54f5eb,null));};exports['create']=function(_0x1d7ebe,_0xf2d45d){return db[_0x548c('0x3a')]['create'](_0x1d7ebe['body'],{})['then'](function(_0x518a42){var _0x4066cd=_0x1d7ebe[_0x548c('0x55')]['get']({'plain':!![]});if(!_0x4066cd)throw new Error(_0x548c('0x56'));if(_0x4066cd['role']==='user'){var _0x3f6e6c=_0x518a42[_0x548c('0x57')]({'plain':!![]});var _0x5e54e3=_0x548c('0x34');return db['UserProfileSection'][_0x548c('0x54')]({'where':{'name':_0x5e54e3,'userProfileId':_0x4066cd[_0x548c('0x58')]},'raw':!![]})[_0x548c('0x32')](function(_0x14a93d){if(_0x14a93d&&_0x14a93d[_0x548c('0x59')]===0x0){return db['UserProfileResource'][_0x548c('0x5a')]({'name':_0x3f6e6c[_0x548c('0x37')],'resourceId':_0x3f6e6c['id'],'type':_0x14a93d[_0x548c('0x37')],'sectionId':_0x14a93d['id']},{})[_0x548c('0x32')](function(){return _0x518a42;});}else{return _0x518a42;}})[_0x548c('0x27')](function(_0x17ab79){logger[_0x548c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17ab79);throw _0x17ab79;});}return _0x518a42;})['then'](respondWithResult(_0xf2d45d,0xc9))[_0x548c('0x27')](handleError(_0xf2d45d,null));};exports['update']=function(_0x3b3be0,_0x1ccd20){if(_0x3b3be0['body']['id']){delete _0x3b3be0[_0x548c('0x5b')]['id'];}return db[_0x548c('0x3a')]['find']({'where':{'id':_0x3b3be0[_0x548c('0x52')]['id']}})[_0x548c('0x32')](handleEntityNotFound(_0x1ccd20,null))['then'](saveUpdates(_0x3b3be0[_0x548c('0x5b')],null))[_0x548c('0x32')](respondWithResult(_0x1ccd20,null))[_0x548c('0x27')](handleError(_0x1ccd20,null));};exports[_0x548c('0x33')]=function(_0x66d5bf,_0x1d5948){return db[_0x548c('0x3a')][_0x548c('0x54')]({'where':{'id':_0x66d5bf[_0x548c('0x52')]['id']}})[_0x548c('0x32')](handleEntityNotFound(_0x1d5948,null))[_0x548c('0x32')](removeEntity(_0x1d5948,null))[_0x548c('0x27')](handleError(_0x1d5948,null));};exports['describe']=function(_0x3c864d,_0x2209e1){return db[_0x548c('0x3a')][_0x548c('0x5c')]()[_0x548c('0x32')](respondWithResult(_0x2209e1,null))[_0x548c('0x27')](handleError(_0x2209e1,null));};exports[_0x548c('0x5d')]=function(_0x249bfa,_0x53e174,_0x3a95cc){var _0xff1196={'raw':!![],'where':{}},_0x566c69={},_0x582fe2;return db[_0x548c('0x3a')][_0x548c('0x5e')]({'where':{'id':_0x249bfa[_0x548c('0x52')]['id']}})[_0x548c('0x32')](handleEntityNotFound(_0x53e174,null))[_0x548c('0x32')](function(_0x598ceb){if(_0x598ceb){_0x582fe2=_0x598ceb[_0x548c('0x57')]({'plain':!![]});_0x566c69[_0x548c('0x3e')]=_[_0x548c('0x40')](db[_0x548c('0x5f')][_0x548c('0x53')]);_0x566c69[_0x548c('0x41')]=_[_0x548c('0x40')](_0x249bfa['query']);_0x566c69[_0x548c('0x42')]=_[_0x548c('0x43')](_0x566c69['model'],_0x566c69['query']);_0xff1196['attributes']=_[_0x548c('0x43')](_0x566c69[_0x548c('0x3e')],qs[_0x548c('0x45')](_0x249bfa['query'][_0x548c('0x45')]));_0xff1196[_0x548c('0x44')]=_0xff1196['attributes']['length']?_0xff1196[_0x548c('0x44')]:_0x566c69[_0x548c('0x3e')];if(!_0x249bfa[_0x548c('0x41')][_0x548c('0x46')]('nolimit')){_0xff1196['limit']=qs[_0x548c('0x2c')](_0x249bfa[_0x548c('0x41')][_0x548c('0x2c')]);_0xff1196[_0x548c('0x2b')]=qs[_0x548c('0x2b')](_0x249bfa[_0x548c('0x41')][_0x548c('0x2b')]);}_0xff1196[_0x548c('0x48')]=qs[_0x548c('0x49')](_0x249bfa['query']['sort']);_0xff1196[_0x548c('0x4a')]=qs['filters'](_[_0x548c('0x4b')](_0x249bfa['query'],_0x566c69[_0x548c('0x42')]));_0xff1196[_0x548c('0x4a')][_0x548c('0x60')]=_0x598ceb['id'];if(_0x249bfa[_0x548c('0x41')][_0x548c('0x4e')]){_0xff1196[_0x548c('0x4a')]=_[_0x548c('0x4c')](_0xff1196['where'],{'$or':_[_0x548c('0x3f')](_0xff1196[_0x548c('0x44')],function(_0x4853d7){var _0x559c36={};_0x559c36[_0x4853d7]={'$like':'%'+_0x249bfa['query'][_0x548c('0x4e')]+'%'};return _0x559c36;})});}_0xff1196=_[_0x548c('0x4c')]({},_0xff1196,_0x249bfa[_0x548c('0x61')]);return db[_0x548c('0x5f')][_0x548c('0x62')](_0xff1196);}})[_0x548c('0x32')](function(_0x229ebc){if(_0x229ebc){return db['User'][_0x548c('0x63')]({'where':{'id':_[_0x548c('0x3f')](_0x229ebc,_0x548c('0x64')),'role':_0x548c('0x65')},'attributes':['id',_0x548c('0x37'),_0x548c('0x66'),_0x548c('0x67'),'createdAt']});}})[_0x548c('0x32')](function(_0x236ebb){if(_0x236ebb){return{'count':_0x236ebb[_0x548c('0x4f')],'rows':_[_0x548c('0x3f')](_0x236ebb['rows'],function(_0x4200e4){return{'membername':_0x4200e4['name'],'UserId':_0x4200e4['id'],'queue_name':_0x582fe2['name'],'ChatQueueId':_0x582fe2['id'],'interface':util['format'](_0x548c('0x68'),_0x548c('0x69'),_0x4200e4[_0x548c('0x37')]),'penalty':0x0,'paused':_0x4200e4['chatPause'],'createdAt':_0x4200e4['createdAt'],'updatedAt':_0x4200e4[_0x548c('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x548c('0x32')](respondWithFilteredResult(_0x53e174,_0xff1196))[_0x548c('0x27')](handleError(_0x53e174,null));};exports['getTeams']=function(_0x32c44f,_0x2c61df,_0x1c12ab){var _0x3d5895={};var _0x36de79={};var _0x4d47af;var _0x68191c;return db[_0x548c('0x3a')]['findOne']({'where':{'id':_0x32c44f[_0x548c('0x52')]['id']}})[_0x548c('0x32')](handleEntityNotFound(_0x2c61df,null))[_0x548c('0x32')](function(_0xd54b51){if(_0xd54b51){_0x4d47af=_0xd54b51;_0x36de79[_0x548c('0x3e')]=_['keys'](db[_0x548c('0x6a')][_0x548c('0x53')]);_0x36de79[_0x548c('0x41')]=_[_0x548c('0x40')](_0x32c44f[_0x548c('0x41')]);_0x36de79[_0x548c('0x42')]=_[_0x548c('0x43')](_0x36de79[_0x548c('0x3e')],_0x36de79[_0x548c('0x41')]);_0x3d5895[_0x548c('0x44')]=_['intersection'](_0x36de79[_0x548c('0x3e')],qs['fields'](_0x32c44f[_0x548c('0x41')][_0x548c('0x45')]));_0x3d5895[_0x548c('0x44')]=_0x3d5895[_0x548c('0x44')][_0x548c('0x6b')]?_0x3d5895[_0x548c('0x44')]:_0x36de79[_0x548c('0x3e')];_0x3d5895[_0x548c('0x48')]=qs['sort'](_0x32c44f[_0x548c('0x41')][_0x548c('0x49')]);_0x3d5895[_0x548c('0x4a')]=qs[_0x548c('0x42')](_[_0x548c('0x4b')](_0x32c44f['query'],_0x36de79[_0x548c('0x42')]));if(_0x32c44f[_0x548c('0x41')][_0x548c('0x4e')]){_0x3d5895[_0x548c('0x4a')]=_['merge'](_0x3d5895[_0x548c('0x4a')],{'$or':_['map'](_0x3d5895['attributes'],function(_0x37f1a7){var _0x399724={};_0x399724[_0x37f1a7]={'$like':'%'+_0x32c44f[_0x548c('0x41')]['filter']+'%'};return _0x399724;})});}_0x3d5895=_['merge']({},_0x3d5895,_0x32c44f[_0x548c('0x61')]);return _0x4d47af['getTeams'](_0x3d5895);}})[_0x548c('0x32')](function(_0x53693f){if(_0x53693f){_0x68191c=_0x53693f[_0x548c('0x6b')];if(!_0x32c44f['query']['hasOwnProperty']('nolimit')){_0x3d5895[_0x548c('0x2c')]=qs['limit'](_0x32c44f[_0x548c('0x41')][_0x548c('0x2c')]);_0x3d5895[_0x548c('0x2b')]=qs[_0x548c('0x2b')](_0x32c44f[_0x548c('0x41')]['offset']);}return _0x4d47af['getTeams'](_0x3d5895);}})[_0x548c('0x32')](function(_0x2b5bb6){if(_0x2b5bb6){return _0x2b5bb6?{'count':_0x68191c,'rows':_0x2b5bb6}:null;}})[_0x548c('0x32')](respondWithResult(_0x2c61df,null))['catch'](handleError(_0x2c61df,null));};exports[_0x548c('0x6c')]=function(_0x551b47,_0xd3f19c,_0x4cee98){var _0x333e09=_0x551b47[_0x548c('0x5b')][_0x548c('0x6d')];return db[_0x548c('0x6a')][_0x548c('0x62')]({'where':{'id':_0x333e09},'attributes':['id'],'include':[{'model':db[_0x548c('0x6e')],'as':_0x548c('0x6f'),'attributes':['id',_0x548c('0x37'),_0x548c('0x70'),_0x548c('0x71'),_0x548c('0x72')],'raw':!![]}]})[_0x548c('0x32')](function(_0xebac37){if(_0xebac37){var _0x28d580=_['flatMap'](_0xebac37,function(_0x4d3d62){var _0x304f32=_0x4d3d62['get']({'plain':!![]});return _0x304f32[_0x548c('0x6f')];});return db['ChatQueue'][_0x548c('0x54')]({'where':{'id':_0x551b47[_0x548c('0x52')]['id']}})['then'](function(_0x40e267){return db[_0x548c('0x73')][_0x548c('0x74')](function(_0x391827){return _0x40e267['addTeams'](_0x333e09,{'transaction':_0x391827})['then'](function(){return BPromise[_0x548c('0x75')](_0x28d580,function(_0x3ae29b){return db[_0x548c('0x5f')][_0x548c('0x76')]({'where':{'UserId':_0x3ae29b['id'],'ChatQueueId':_0x551b47['params']['id']},'transaction':_0x391827});});})['then'](function(){_0x28d580[_0x548c('0x77')](function(_0x17f4fb){socket['emit']('userChatQueue:save',{'UserId':_0x17f4fb['id'],'ChatQueueId':_0x40e267['id']});});});});});}})[_0x548c('0x32')](respondWithStatusCode(_0xd3f19c,null))['catch'](handleError(_0xd3f19c,null));};exports[_0x548c('0x78')]=function(_0x1eac33,_0x5f23ed,_0x392a90){return db['Team'][_0x548c('0x62')]({'where':{'id':_0x1eac33['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x548c('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x548c('0x32')](handleEntityNotFound(_0x5f23ed,null))['then'](function(_0x22ca57){var _0x34290f=_['map'](_0x22ca57,'id');var _0x2deae4=[];var _0x5ea808=[];var _0x526157=squel[_0x548c('0x79')]();_0x526157['field'](_0x548c('0x7a'))[_0x548c('0x7b')](_0x548c('0x7c'),'tq')[_0x548c('0x7d')]('user_has_teams','ut',_0x548c('0x7e'))[_0x548c('0x4a')]('ChatQueueId\x20=\x20?',_0x1eac33[_0x548c('0x52')]['id']);for(var _0x69efd2=0x0;_0x69efd2<_0x22ca57[_0x548c('0x6b')];_0x69efd2+=0x1){let _0x431a2a=_0x22ca57[_0x69efd2];for(var _0x16afe2=0x0;_0x16afe2<_0x431a2a[_0x548c('0x6f')][_0x548c('0x6b')];_0x16afe2+=0x1){let _0x2cd1aa=_0x431a2a['Agents'][_0x16afe2];var _0x4053e6=_0x526157[_0x548c('0x7f')]();_0x4053e6['where'](_0x548c('0x80'),_0x2cd1aa['id']);_0x5ea808[_0x548c('0x81')](db[_0x548c('0x73')]['query'](_0x4053e6['toString'](),{'type':db[_0x548c('0x73')]['QueryTypes'][_0x548c('0x82')]})['then'](function(_0x3bfa8c){if(_0x3bfa8c[_0x548c('0x6b')]===0x1){return _0x2cd1aa['id'];}else{var _0x299d08=_[_0x548c('0x83')](_['map'](_0x3bfa8c,_0x548c('0x84')),function(_0x3c3f06){return _[_0x548c('0x85')](_0x34290f,_0x3c3f06);});if(_0x299d08){return _0x2cd1aa['id'];}}}));}}return BPromise[_0x548c('0x86')](_0x5ea808)[_0x548c('0x32')](function(_0x238f34){_0x2deae4=_(_0x2deae4)[_0x548c('0x87')](_0x238f34)['compact']()[_0x548c('0x88')]();return db[_0x548c('0x3a')][_0x548c('0x54')]({'where':{'id':_0x1eac33[_0x548c('0x52')]['id']}})[_0x548c('0x32')](function(_0x2cf39b){return db['sequelize'][_0x548c('0x74')](function(_0x383d1a){return _0x2cf39b[_0x548c('0x78')](_0x1eac33[_0x548c('0x41')][_0x548c('0x6d')],{'transaction':_0x383d1a})['then'](function(){if(!_[_0x548c('0x89')](_0x2deae4)){return _0x2cf39b[_0x548c('0x8a')](_0x2deae4,{'transaction':_0x383d1a});}})['then'](function(){_0x2deae4[_0x548c('0x77')](function(_0x4492de){socket[_0x548c('0x8b')](_0x548c('0x8c'),{'UserId':_0x4492de,'ChatQueueId':_0x2cf39b['id']});});});});});});})[_0x548c('0x32')](respondWithStatusCode(_0x5f23ed,null))[_0x548c('0x27')](handleError(_0x5f23ed,null));};exports[_0x548c('0x8d')]=function(_0x40335d,_0x37455c,_0x6c94b7){return db[_0x548c('0x3a')]['find']({'where':{'id':_0x40335d[_0x548c('0x52')]['id']}})[_0x548c('0x32')](handleEntityNotFound(_0x37455c,null))[_0x548c('0x32')](function(_0x3f7926){if(_0x3f7926){return _0x3f7926[_0x548c('0x8d')](_0x40335d[_0x548c('0x5b')][_0x548c('0x6d')],_[_0x548c('0x8e')](_0x40335d[_0x548c('0x5b')],['ids','id'])||{})[_0x548c('0x8f')](function(_0x5e3594){for(var _0x739468=0x0;_0x739468<_0x40335d[_0x548c('0x5b')]['ids'][_0x548c('0x6b')];_0x739468+=0x1){socket[_0x548c('0x8b')]('userChatQueue:save',{'UserId':_0x40335d[_0x548c('0x5b')]['ids'][_0x739468],'ChatQueueId':_0x40335d[_0x548c('0x52')]['id']});}return _0x5e3594;});}})['then'](respondWithResult(_0x37455c,null))[_0x548c('0x27')](handleError(_0x37455c,null));};exports['removeAgents']=function(_0x113564,_0x5d4e31,_0x4bf0c5){return db[_0x548c('0x3a')][_0x548c('0x54')]({'where':{'id':_0x113564['params']['id']}})[_0x548c('0x32')](handleEntityNotFound(_0x5d4e31,null))[_0x548c('0x32')](function(_0x3acac4){if(_0x3acac4){return _0x3acac4[_0x548c('0x8a')](_0x113564['query'][_0x548c('0x6d')])[_0x548c('0x32')](function(){if(_[_0x548c('0x90')](_0x113564['query'][_0x548c('0x6d')])){for(var _0x153ec1=0x0;_0x153ec1<_0x113564[_0x548c('0x41')][_0x548c('0x6d')][_0x548c('0x6b')];_0x153ec1+=0x1){socket[_0x548c('0x8b')]('userChatQueue:remove',{'UserId':Number(_0x113564['query'][_0x548c('0x6d')][_0x153ec1]),'ChatQueueId':Number(_0x113564[_0x548c('0x52')]['id'])});}}else{socket['emit'](_0x548c('0x8c'),{'UserId':Number(_0x113564[_0x548c('0x41')][_0x548c('0x6d')]),'ChatQueueId':Number(_0x113564['params']['id'])});}});}})[_0x548c('0x32')](respondWithStatusCode(_0x5d4e31,null))[_0x548c('0x27')](handleError(_0x5d4e31,null));};exports['getAgents']=function(_0x5bb77b,_0x2d865e,_0x7db1bb){var _0x22d1fd={};var _0x5e4641={};var _0x31e3d1;var _0x5deb83;return db[_0x548c('0x3a')]['findOne']({'where':{'id':_0x5bb77b[_0x548c('0x52')]['id']}})[_0x548c('0x32')](handleEntityNotFound(_0x2d865e,null))[_0x548c('0x32')](function(_0x48ac5f){if(_0x48ac5f){_0x31e3d1=_0x48ac5f;_0x5e4641[_0x548c('0x3e')]=_['keys'](db[_0x548c('0x6e')][_0x548c('0x53')]);_0x5e4641[_0x548c('0x41')]=_[_0x548c('0x40')](_0x5bb77b[_0x548c('0x41')]);_0x5e4641[_0x548c('0x42')]=_[_0x548c('0x43')](_0x5e4641['model'],_0x5e4641[_0x548c('0x41')]);_0x22d1fd[_0x548c('0x44')]=_[_0x548c('0x43')](_0x5e4641[_0x548c('0x3e')],qs[_0x548c('0x45')](_0x5bb77b['query'][_0x548c('0x45')]));_0x22d1fd[_0x548c('0x44')]=_0x22d1fd[_0x548c('0x44')]['length']?_0x22d1fd['attributes']:_0x5e4641['model'];_0x22d1fd['order']=qs[_0x548c('0x49')](_0x5bb77b[_0x548c('0x41')][_0x548c('0x49')]);_0x22d1fd[_0x548c('0x4a')]=qs['filters'](_[_0x548c('0x4b')](_0x5bb77b[_0x548c('0x41')],_0x5e4641[_0x548c('0x42')]));if(_0x5bb77b[_0x548c('0x41')]['filter']){_0x22d1fd[_0x548c('0x4a')]=_[_0x548c('0x4c')](_0x22d1fd[_0x548c('0x4a')],{'$or':_[_0x548c('0x3f')](_0x22d1fd[_0x548c('0x44')],function(_0x2ae2e0){var _0x22bea0={};_0x22bea0[_0x2ae2e0]={'$like':'%'+_0x5bb77b[_0x548c('0x41')][_0x548c('0x4e')]+'%'};return _0x22bea0;})});}_0x22d1fd=_[_0x548c('0x4c')]({},_0x22d1fd,_0x5bb77b[_0x548c('0x61')]);return _0x31e3d1[_0x548c('0x91')](_0x22d1fd);}})[_0x548c('0x32')](function(_0xcb7192){if(_0xcb7192){_0x5deb83=_0xcb7192['length'];if(!_0x5bb77b[_0x548c('0x41')][_0x548c('0x46')](_0x548c('0x47'))){_0x22d1fd[_0x548c('0x2c')]=qs['limit'](_0x5bb77b[_0x548c('0x41')][_0x548c('0x2c')]);_0x22d1fd[_0x548c('0x2b')]=qs[_0x548c('0x2b')](_0x5bb77b['query'][_0x548c('0x2b')]);}return _0x31e3d1['getAgents'](_0x22d1fd);}})[_0x548c('0x32')](function(_0x154842){if(_0x154842){return _0x154842?{'count':_0x5deb83,'rows':_0x154842}:null;}})['then'](respondWithResult(_0x2d865e,null))[_0x548c('0x27')](handleError(_0x2d865e,null));}; \ No newline at end of file +var _0x466b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','http','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','send','map','ChatQueue','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','order','ChatQueueId','filter','User','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','rawAttributes','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','every','all','union','compact','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x5b5edd,_0x10e5d9){var _0xe57864=function(_0x2ab717){while(--_0x2ab717){_0x5b5edd['push'](_0x5b5edd['shift']());}};_0xe57864(++_0x10e5d9);}(_0x466b,0x115));var _0xb466=function(_0x526543,_0x13f8ec){_0x526543=_0x526543-0x0;var _0x221109=_0x466b[_0x526543];return _0x221109;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb466('0x0'));var rimraf=require(_0xb466('0x1'));var zipdir=require(_0xb466('0x2'));var jsonpatch=require(_0xb466('0x3'));var rp=require(_0xb466('0x4'));var moment=require('moment');var BPromise=require(_0xb466('0x5'));var Mustache=require(_0xb466('0x6'));var util=require(_0xb466('0x7'));var path=require('path');var sox=require(_0xb466('0x8'));var csv=require(_0xb466('0x9'));var ejs=require(_0xb466('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb466('0xb'));var crypto=require(_0xb466('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb466('0xd'));var toCsv=require(_0xb466('0x9'));var querystring=require(_0xb466('0xe'));var Papa=require(_0xb466('0xf'));var Redis=require(_0xb466('0x10'));var authService=require(_0xb466('0x11'));var qs=require(_0xb466('0x12'));var as=require(_0xb466('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb466('0x14'))(_0xb466('0x15'));var utils=require(_0xb466('0x16'));var config=require(_0xb466('0x17'));var licenseUtil=require(_0xb466('0x18'));var db=require(_0xb466('0x19'))['db'];config[_0xb466('0x1a')]=_[_0xb466('0x1b')](config[_0xb466('0x1a')],{'host':_0xb466('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb466('0x1a')]));require(_0xb466('0x1d'))[_0xb466('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb466('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x19f164,_0xfad4f7,_0x40cfb8,_0x80e462){return new BPromise(function(_0x5d2e00,_0x57914f){var _0x3d03db=_0x80e462||client;return _0x3d03db[_0xb466('0x20')](_0x19f164,_0x40cfb8)['then'](function(_0x5dbdd3){logger['info'](_0xb466('0x21'),_0xfad4f7,_0xb466('0x22'));logger[_0xb466('0x23')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0xfad4f7,_0xb466('0x22'),JSON[_0xb466('0x24')](_0x5dbdd3));if(_0x5dbdd3[_0xb466('0x25')]){if(_0x5dbdd3[_0xb466('0x25')][_0xb466('0x26')]===0x1f4){logger['error'](_0xb466('0x21'),_0xfad4f7,_0x5dbdd3[_0xb466('0x25')]['message']);return _0x57914f(_0x5dbdd3['error'][_0xb466('0x27')]);}logger[_0xb466('0x25')]('ChatQueue,\x20%s,\x20%s',_0xfad4f7,_0x5dbdd3[_0xb466('0x25')][_0xb466('0x27')]);return _0x5d2e00(_0x5dbdd3[_0xb466('0x25')][_0xb466('0x27')]);}else{logger[_0xb466('0x28')](_0xb466('0x21'),_0xfad4f7,'request\x20sent');_0x5d2e00(_0x5dbdd3['result']['message']);}})['catch'](function(_0x4937ae){logger[_0xb466('0x25')]('ChatQueue,\x20%s,\x20%s',_0xfad4f7,_0x4937ae);_0x57914f(_0x4937ae);});});}function respondWithStatusCode(_0x4d06a2,_0x56f7f7){_0x56f7f7=_0x56f7f7||0xcc;return function(_0x149eeb){if(_0x149eeb){return _0x4d06a2[_0xb466('0x29')](_0x56f7f7);}return _0x4d06a2[_0xb466('0x2a')](_0x56f7f7)[_0xb466('0x2b')]();};}function respondWithResult(_0x21f403,_0x1542a0){_0x1542a0=_0x1542a0||0xc8;return function(_0x15a87a){if(_0x15a87a){return _0x21f403['status'](_0x1542a0)[_0xb466('0x2c')](_0x15a87a);}};}function respondWithFilteredResult(_0xbd5a0f,_0x35127e){return function(_0x1397ea){if(_0x1397ea){var _0x20402e=_0x1397ea[_0xb466('0x2d')],_0x1af719=_0x35127e[_0xb466('0x2e')],_0x4cbc3c=_0x35127e[_0xb466('0x2e')]+_0x35127e['limit'],_0x8ad1b3;if(_0x4cbc3c>=_0x20402e){_0x4cbc3c=_0x20402e;_0x8ad1b3=0xc8;}else{_0x8ad1b3=0xce;}_0xbd5a0f[_0xb466('0x2a')](_0x8ad1b3);return _0xbd5a0f[_0xb466('0x2f')](_0xb466('0x30'),_0x1af719+'-'+_0x4cbc3c+'/'+_0x20402e)['json'](_0x1397ea);}return null;};}function patchUpdates(_0x59dd39){return function(_0x4070de){try{jsonpatch['apply'](_0x4070de,_0x59dd39,!![]);}catch(_0x508358){return BPromise[_0xb466('0x31')](_0x508358);}return _0x4070de[_0xb466('0x32')]();};}function saveUpdates(_0x2b310f,_0x5c9dfe){return function(_0x1e57b7){if(_0x1e57b7){return _0x1e57b7[_0xb466('0x33')](_0x2b310f)[_0xb466('0x34')](function(_0x371e37){return _0x371e37;});}return null;};}function removeEntity(_0x426784,_0x158904){return function(_0x1c695c){if(_0x1c695c){return _0x1c695c[_0xb466('0x35')]()[_0xb466('0x34')](function(){var _0x26091f=_0x1c695c[_0xb466('0x36')]({'plain':!![]});var _0x4825cc=_0xb466('0x37');return db[_0xb466('0x38')][_0xb466('0x35')]({'where':{'type':_0x4825cc,'resourceId':_0x26091f['id']}})['then'](function(){return _0x1c695c;});})[_0xb466('0x34')](function(){_0x426784['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e0a11,_0x428289){return function(_0x490760){if(!_0x490760){_0x3e0a11['sendStatus'](0x194);}return _0x490760;};}function handleError(_0x549707,_0x34720c){_0x34720c=_0x34720c||0x1f4;return function(_0xd31800){logger[_0xb466('0x25')](_0xd31800['stack']);if(_0xd31800['name']){delete _0xd31800['name'];}_0x549707['status'](_0x34720c)[_0xb466('0x39')](_0xd31800);};}exports['index']=function(_0x244a85,_0x1ae2c2){var _0x5b566a={},_0x12c362={},_0x102cde={'count':0x0,'rows':[]};var _0x424bce=_[_0xb466('0x3a')](db[_0xb466('0x3b')]['rawAttributes'],function(_0x3c48a3){return{'name':_0x3c48a3[_0xb466('0x3c')],'type':_0x3c48a3[_0xb466('0x3d')][_0xb466('0x3e')]};});_0x12c362[_0xb466('0x3f')]=_[_0xb466('0x3a')](_0x424bce,_0xb466('0x40'));_0x12c362[_0xb466('0x41')]=_[_0xb466('0x42')](_0x244a85[_0xb466('0x41')]);_0x12c362[_0xb466('0x43')]=_[_0xb466('0x44')](_0x12c362[_0xb466('0x3f')],_0x12c362[_0xb466('0x41')]);_0x5b566a[_0xb466('0x45')]=_['intersection'](_0x12c362[_0xb466('0x3f')],qs[_0xb466('0x46')](_0x244a85[_0xb466('0x41')][_0xb466('0x46')]));_0x5b566a[_0xb466('0x45')]=_0x5b566a['attributes']['length']?_0x5b566a[_0xb466('0x45')]:_0x12c362[_0xb466('0x3f')];if(!_0x244a85[_0xb466('0x41')][_0xb466('0x47')](_0xb466('0x48'))){_0x5b566a['limit']=qs[_0xb466('0x49')](_0x244a85[_0xb466('0x41')]['limit']);_0x5b566a['offset']=qs[_0xb466('0x2e')](_0x244a85['query'][_0xb466('0x2e')]);}_0x5b566a['order']=qs['sort'](_0x244a85[_0xb466('0x41')][_0xb466('0x4a')]);_0x5b566a[_0xb466('0x4b')]=qs['filters'](_[_0xb466('0x4c')](_0x244a85['query'],_0x12c362['filters']),_0x424bce);if(_0x244a85['query']['filter']){_0x5b566a[_0xb466('0x4b')]=_[_0xb466('0x4d')](_0x5b566a['where'],{'$or':_[_0xb466('0x3a')](_0x424bce,function(_0x46faa4){if(_0x46faa4['type']!==_0xb466('0x4e')){var _0x9ce157={};_0x9ce157[_0x46faa4[_0xb466('0x40')]]={'$like':'%'+_0x244a85[_0xb466('0x41')]['filter']+'%'};return _0x9ce157;}})});}_0x5b566a=_[_0xb466('0x4d')]({},_0x5b566a,_0x244a85[_0xb466('0x4f')]);var _0x2d809e={'where':_0x5b566a[_0xb466('0x4b')]};return db[_0xb466('0x3b')][_0xb466('0x2d')](_0x2d809e)['then'](function(_0x3cff88){_0x102cde[_0xb466('0x2d')]=_0x3cff88;if(_0x244a85['query'][_0xb466('0x50')]){_0x5b566a[_0xb466('0x51')]=[{'all':!![]}];}return db['ChatQueue'][_0xb466('0x52')](_0x5b566a);})[_0xb466('0x34')](function(_0x3f2fb3){_0x102cde['rows']=_0x3f2fb3;return _0x102cde;})[_0xb466('0x34')](respondWithFilteredResult(_0x1ae2c2,_0x5b566a))[_0xb466('0x53')](handleError(_0x1ae2c2,null));};exports['show']=function(_0x2e5aad,_0x129f04){var _0x2eb648={'raw':!![],'where':{'id':_0x2e5aad[_0xb466('0x54')]['id']}},_0x209f2d={};_0x209f2d[_0xb466('0x3f')]=_[_0xb466('0x42')](db[_0xb466('0x3b')]['rawAttributes']);_0x209f2d[_0xb466('0x41')]=_[_0xb466('0x42')](_0x2e5aad[_0xb466('0x41')]);_0x209f2d[_0xb466('0x43')]=_[_0xb466('0x44')](_0x209f2d['model'],_0x209f2d[_0xb466('0x41')]);_0x2eb648[_0xb466('0x45')]=_[_0xb466('0x44')](_0x209f2d['model'],qs['fields'](_0x2e5aad[_0xb466('0x41')]['fields']));_0x2eb648[_0xb466('0x45')]=_0x2eb648[_0xb466('0x45')][_0xb466('0x55')]?_0x2eb648[_0xb466('0x45')]:_0x209f2d[_0xb466('0x3f')];if(_0x2e5aad['query'][_0xb466('0x50')]){_0x2eb648[_0xb466('0x51')]=[{'all':!![]}];}_0x2eb648=_[_0xb466('0x4d')]({},_0x2eb648,_0x2e5aad['options']);return db[_0xb466('0x3b')][_0xb466('0x56')](_0x2eb648)['then'](handleEntityNotFound(_0x129f04,null))[_0xb466('0x34')](respondWithResult(_0x129f04,null))[_0xb466('0x53')](handleError(_0x129f04,null));};exports['create']=function(_0x1ae6dc,_0x11c075){return db['ChatQueue']['create'](_0x1ae6dc[_0xb466('0x57')],{})[_0xb466('0x34')](function(_0x43770a){var _0x20ec51=_0x1ae6dc[_0xb466('0x58')][_0xb466('0x36')]({'plain':!![]});if(!_0x20ec51)throw new Error(_0xb466('0x59'));if(_0x20ec51['role']===_0xb466('0x58')){var _0x26fe55=_0x43770a[_0xb466('0x36')]({'plain':!![]});var _0x25b7b1=_0xb466('0x37');return db[_0xb466('0x5a')][_0xb466('0x56')]({'where':{'name':_0x25b7b1,'userProfileId':_0x20ec51[_0xb466('0x5b')]},'raw':!![]})['then'](function(_0x4716b8){if(_0x4716b8&&_0x4716b8[_0xb466('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x26fe55[_0xb466('0x40')],'resourceId':_0x26fe55['id'],'type':_0x4716b8[_0xb466('0x40')],'sectionId':_0x4716b8['id']},{})[_0xb466('0x34')](function(){return _0x43770a;});}else{return _0x43770a;}})[_0xb466('0x53')](function(_0x504874){logger['error'](_0xb466('0x5d'),_0x504874);throw _0x504874;});}return _0x43770a;})['then'](respondWithResult(_0x11c075,0xc9))['catch'](handleError(_0x11c075,null));};exports['update']=function(_0x46723b,_0x254a5d){if(_0x46723b['body']['id']){delete _0x46723b[_0xb466('0x57')]['id'];}return db['ChatQueue'][_0xb466('0x56')]({'where':{'id':_0x46723b[_0xb466('0x54')]['id']}})[_0xb466('0x34')](handleEntityNotFound(_0x254a5d,null))[_0xb466('0x34')](saveUpdates(_0x46723b[_0xb466('0x57')],null))[_0xb466('0x34')](respondWithResult(_0x254a5d,null))['catch'](handleError(_0x254a5d,null));};exports[_0xb466('0x35')]=function(_0x415d0e,_0x503951){return db['ChatQueue'][_0xb466('0x56')]({'where':{'id':_0x415d0e[_0xb466('0x54')]['id']}})[_0xb466('0x34')](handleEntityNotFound(_0x503951,null))[_0xb466('0x34')](removeEntity(_0x503951,null))['catch'](handleError(_0x503951,null));};exports[_0xb466('0x5e')]=function(_0xa3ba6d,_0x5f468f){return db[_0xb466('0x3b')][_0xb466('0x5e')]()[_0xb466('0x34')](respondWithResult(_0x5f468f,null))[_0xb466('0x53')](handleError(_0x5f468f,null));};exports[_0xb466('0x5f')]=function(_0x591e4d,_0x130f14,_0x2ce953){var _0x16b5bf={'raw':!![],'where':{}},_0x3d5fd1={},_0xe3801a;return db[_0xb466('0x3b')][_0xb466('0x60')]({'where':{'id':_0x591e4d['params']['id']}})['then'](handleEntityNotFound(_0x130f14,null))[_0xb466('0x34')](function(_0x2b2e84){if(_0x2b2e84){_0xe3801a=_0x2b2e84[_0xb466('0x36')]({'plain':!![]});_0x3d5fd1[_0xb466('0x3f')]=_[_0xb466('0x42')](db[_0xb466('0x61')]['rawAttributes']);_0x3d5fd1[_0xb466('0x41')]=_[_0xb466('0x42')](_0x591e4d[_0xb466('0x41')]);_0x3d5fd1[_0xb466('0x43')]=_[_0xb466('0x44')](_0x3d5fd1['model'],_0x3d5fd1[_0xb466('0x41')]);_0x16b5bf['attributes']=_[_0xb466('0x44')](_0x3d5fd1[_0xb466('0x3f')],qs['fields'](_0x591e4d[_0xb466('0x41')][_0xb466('0x46')]));_0x16b5bf['attributes']=_0x16b5bf[_0xb466('0x45')]['length']?_0x16b5bf[_0xb466('0x45')]:_0x3d5fd1['model'];if(!_0x591e4d[_0xb466('0x41')][_0xb466('0x47')](_0xb466('0x48'))){_0x16b5bf['limit']=qs[_0xb466('0x49')](_0x591e4d[_0xb466('0x41')][_0xb466('0x49')]);_0x16b5bf[_0xb466('0x2e')]=qs['offset'](_0x591e4d[_0xb466('0x41')][_0xb466('0x2e')]);}_0x16b5bf[_0xb466('0x62')]=qs[_0xb466('0x4a')](_0x591e4d['query']['sort']);_0x16b5bf[_0xb466('0x4b')]=qs['filters'](_['pick'](_0x591e4d['query'],_0x3d5fd1[_0xb466('0x43')]));_0x16b5bf[_0xb466('0x4b')][_0xb466('0x63')]=_0x2b2e84['id'];if(_0x591e4d[_0xb466('0x41')][_0xb466('0x64')]){_0x16b5bf[_0xb466('0x4b')]=_[_0xb466('0x4d')](_0x16b5bf[_0xb466('0x4b')],{'$or':_[_0xb466('0x3a')](_0x16b5bf[_0xb466('0x45')],function(_0x1bf03e){var _0xa919ad={};_0xa919ad[_0x1bf03e]={'$like':'%'+_0x591e4d['query']['filter']+'%'};return _0xa919ad;})});}_0x16b5bf=_['merge']({},_0x16b5bf,_0x591e4d[_0xb466('0x4f')]);return db[_0xb466('0x61')][_0xb466('0x52')](_0x16b5bf);}})[_0xb466('0x34')](function(_0x29efb8){if(_0x29efb8){return db[_0xb466('0x65')]['findAndCountAll']({'where':{'id':_[_0xb466('0x3a')](_0x29efb8,'UserId'),'role':_0xb466('0x66')},'attributes':['id',_0xb466('0x40'),_0xb466('0x67'),_0xb466('0x68'),_0xb466('0x69')]});}})[_0xb466('0x34')](function(_0x346f87){if(_0x346f87){return{'count':_0x346f87[_0xb466('0x2d')],'rows':_['map'](_0x346f87[_0xb466('0x6a')],function(_0xdb3b6f){return{'membername':_0xdb3b6f['name'],'UserId':_0xdb3b6f['id'],'queue_name':_0xe3801a[_0xb466('0x40')],'ChatQueueId':_0xe3801a['id'],'interface':util[_0xb466('0x6b')](_0xb466('0x6c'),'SIP',_0xdb3b6f['name']),'penalty':0x0,'paused':_0xdb3b6f[_0xb466('0x67')],'createdAt':_0xdb3b6f['createdAt'],'updatedAt':_0xdb3b6f[_0xb466('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb466('0x34')](respondWithFilteredResult(_0x130f14,_0x16b5bf))[_0xb466('0x53')](handleError(_0x130f14,null));};exports[_0xb466('0x6d')]=function(_0x370308,_0x174087,_0x149f56){var _0x2ba027={};var _0x2bb821={};var _0x39419c;var _0x42957c;return db[_0xb466('0x3b')][_0xb466('0x60')]({'where':{'id':_0x370308[_0xb466('0x54')]['id']}})[_0xb466('0x34')](handleEntityNotFound(_0x174087,null))[_0xb466('0x34')](function(_0x7f7009){if(_0x7f7009){_0x39419c=_0x7f7009;_0x2bb821['model']=_[_0xb466('0x42')](db[_0xb466('0x6e')][_0xb466('0x6f')]);_0x2bb821[_0xb466('0x41')]=_[_0xb466('0x42')](_0x370308['query']);_0x2bb821[_0xb466('0x43')]=_['intersection'](_0x2bb821[_0xb466('0x3f')],_0x2bb821[_0xb466('0x41')]);_0x2ba027[_0xb466('0x45')]=_[_0xb466('0x44')](_0x2bb821['model'],qs[_0xb466('0x46')](_0x370308[_0xb466('0x41')][_0xb466('0x46')]));_0x2ba027[_0xb466('0x45')]=_0x2ba027['attributes'][_0xb466('0x55')]?_0x2ba027[_0xb466('0x45')]:_0x2bb821[_0xb466('0x3f')];_0x2ba027['order']=qs[_0xb466('0x4a')](_0x370308['query'][_0xb466('0x4a')]);_0x2ba027[_0xb466('0x4b')]=qs[_0xb466('0x43')](_['pick'](_0x370308['query'],_0x2bb821[_0xb466('0x43')]));if(_0x370308[_0xb466('0x41')][_0xb466('0x64')]){_0x2ba027['where']=_[_0xb466('0x4d')](_0x2ba027['where'],{'$or':_['map'](_0x2ba027[_0xb466('0x45')],function(_0x27c5fa){var _0x2617bb={};_0x2617bb[_0x27c5fa]={'$like':'%'+_0x370308[_0xb466('0x41')][_0xb466('0x64')]+'%'};return _0x2617bb;})});}_0x2ba027=_[_0xb466('0x4d')]({},_0x2ba027,_0x370308['options']);return _0x39419c['getTeams'](_0x2ba027);}})[_0xb466('0x34')](function(_0x22f2da){if(_0x22f2da){_0x42957c=_0x22f2da['length'];if(!_0x370308['query'][_0xb466('0x47')](_0xb466('0x48'))){_0x2ba027[_0xb466('0x49')]=qs[_0xb466('0x49')](_0x370308[_0xb466('0x41')][_0xb466('0x49')]);_0x2ba027[_0xb466('0x2e')]=qs[_0xb466('0x2e')](_0x370308[_0xb466('0x41')][_0xb466('0x2e')]);}return _0x39419c[_0xb466('0x6d')](_0x2ba027);}})[_0xb466('0x34')](function(_0x132953){if(_0x132953){return _0x132953?{'count':_0x42957c,'rows':_0x132953}:null;}})['then'](respondWithResult(_0x174087,null))[_0xb466('0x53')](handleError(_0x174087,null));};exports[_0xb466('0x70')]=function(_0x50baa1,_0x469505,_0x1658bf){var _0x5adc49=_0x50baa1[_0xb466('0x57')][_0xb466('0x71')];return db[_0xb466('0x6e')]['findAll']({'where':{'id':_0x5adc49},'attributes':['id'],'include':[{'model':db[_0xb466('0x65')],'as':_0xb466('0x72'),'attributes':['id','name',_0xb466('0x73'),'voicePause',_0xb466('0x74')],'raw':!![]}]})[_0xb466('0x34')](function(_0x55b973){if(_0x55b973){var _0x40e6ae=_[_0xb466('0x75')](_0x55b973,function(_0x51037a){var _0x4dc361=_0x51037a[_0xb466('0x36')]({'plain':!![]});return _0x4dc361[_0xb466('0x72')];});return db[_0xb466('0x3b')][_0xb466('0x56')]({'where':{'id':_0x50baa1[_0xb466('0x54')]['id']}})[_0xb466('0x34')](function(_0x1dc0a0){return db[_0xb466('0x76')][_0xb466('0x77')](function(_0x8f6d6b){return _0x1dc0a0[_0xb466('0x70')](_0x5adc49,{'transaction':_0x8f6d6b})[_0xb466('0x34')](function(){return BPromise['each'](_0x40e6ae,function(_0x3e7d64){return db[_0xb466('0x61')][_0xb466('0x78')]({'where':{'UserId':_0x3e7d64['id'],'ChatQueueId':_0x50baa1['params']['id']},'transaction':_0x8f6d6b});});})[_0xb466('0x34')](function(){_0x40e6ae[_0xb466('0x79')](function(_0x432483){socket[_0xb466('0x7a')](_0xb466('0x7b'),{'UserId':_0x432483['id'],'ChatQueueId':_0x1dc0a0['id']});});});});});}})[_0xb466('0x34')](respondWithStatusCode(_0x469505,null))[_0xb466('0x53')](handleError(_0x469505,null));};exports[_0xb466('0x7c')]=function(_0x9449a,_0x3cb313,_0x5a22da){return db[_0xb466('0x6e')][_0xb466('0x52')]({'where':{'id':_0x9449a['query'][_0xb466('0x71')]},'attributes':['id'],'include':[{'model':db[_0xb466('0x65')],'as':_0xb466('0x72'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3cb313,null))[_0xb466('0x34')](function(_0x51cee7){var _0x4a2ca3=_[_0xb466('0x3a')](_0x51cee7,'id');var _0xd9b1e4=[];var _0x607229=[];var _0x509d28=squel[_0xb466('0x7d')]();_0x509d28[_0xb466('0x7e')](_0xb466('0x7f'))[_0xb466('0x80')](_0xb466('0x81'),'tq')[_0xb466('0x82')](_0xb466('0x83'),'ut',_0xb466('0x84'))[_0xb466('0x4b')]('ChatQueueId\x20=\x20?',_0x9449a[_0xb466('0x54')]['id']);for(var _0x3a7d22=0x0;_0x3a7d22<_0x51cee7['length'];_0x3a7d22+=0x1){let _0xe21fba=_0x51cee7[_0x3a7d22];for(var _0x515195=0x0;_0x515195<_0xe21fba[_0xb466('0x72')][_0xb466('0x55')];_0x515195+=0x1){let _0x4b6059=_0xe21fba[_0xb466('0x72')][_0x515195];var _0xd87c38=_0x509d28['clone']();_0xd87c38[_0xb466('0x4b')]('ut.UserId\x20=\x20?',_0x4b6059['id']);_0x607229[_0xb466('0x85')](db[_0xb466('0x76')]['query'](_0xd87c38[_0xb466('0x86')](),{'type':db['sequelize'][_0xb466('0x87')]['SELECT']})[_0xb466('0x34')](function(_0x66568a){if(_0x66568a[_0xb466('0x55')]===0x1){return _0x4b6059['id'];}else{var _0x211cd4=_[_0xb466('0x88')](_[_0xb466('0x3a')](_0x66568a,'TeamId'),function(_0x3fb927){return _['includes'](_0x4a2ca3,_0x3fb927);});if(_0x211cd4){return _0x4b6059['id'];}}}));}}return BPromise[_0xb466('0x89')](_0x607229)[_0xb466('0x34')](function(_0xd2de54){_0xd9b1e4=_(_0xd9b1e4)[_0xb466('0x8a')](_0xd2de54)[_0xb466('0x8b')]()['value']();return db['ChatQueue']['find']({'where':{'id':_0x9449a[_0xb466('0x54')]['id']}})[_0xb466('0x34')](function(_0xc90334){return db[_0xb466('0x76')]['transaction'](function(_0x1d0f72){return _0xc90334[_0xb466('0x7c')](_0x9449a['query']['ids'],{'transaction':_0x1d0f72})[_0xb466('0x34')](function(){if(!_['isEmpty'](_0xd9b1e4)){return _0xc90334['removeAgents'](_0xd9b1e4,{'transaction':_0x1d0f72});}})['then'](function(){_0xd9b1e4['forEach'](function(_0x37a81c){socket[_0xb466('0x7a')](_0xb466('0x8c'),{'UserId':_0x37a81c,'ChatQueueId':_0xc90334['id']});});});});});});})['then'](respondWithStatusCode(_0x3cb313,null))['catch'](handleError(_0x3cb313,null));};exports[_0xb466('0x8d')]=function(_0x154909,_0x411aff,_0x3e5723){return db[_0xb466('0x3b')]['find']({'where':{'id':_0x154909['params']['id']}})[_0xb466('0x34')](handleEntityNotFound(_0x411aff,null))[_0xb466('0x34')](function(_0x14e81d){if(_0x14e81d){return _0x14e81d[_0xb466('0x8d')](_0x154909[_0xb466('0x57')][_0xb466('0x71')],_[_0xb466('0x8e')](_0x154909['body'],[_0xb466('0x71'),'id'])||{})[_0xb466('0x8f')](function(_0x2e621d){for(var _0xebd760=0x0;_0xebd760<_0x154909[_0xb466('0x57')][_0xb466('0x71')]['length'];_0xebd760+=0x1){socket[_0xb466('0x7a')](_0xb466('0x7b'),{'UserId':_0x154909['body']['ids'][_0xebd760],'ChatQueueId':_0x154909[_0xb466('0x54')]['id']});}return _0x2e621d;});}})[_0xb466('0x34')](respondWithResult(_0x411aff,null))[_0xb466('0x53')](handleError(_0x411aff,null));};exports['removeAgents']=function(_0xaa0f36,_0x4a459a,_0x44280f){return db['ChatQueue'][_0xb466('0x56')]({'where':{'id':_0xaa0f36[_0xb466('0x54')]['id']}})[_0xb466('0x34')](handleEntityNotFound(_0x4a459a,null))['then'](function(_0x259c84){if(_0x259c84){return _0x259c84[_0xb466('0x90')](_0xaa0f36[_0xb466('0x41')][_0xb466('0x71')])[_0xb466('0x34')](function(){if(_[_0xb466('0x91')](_0xaa0f36[_0xb466('0x41')][_0xb466('0x71')])){for(var _0x2df402=0x0;_0x2df402<_0xaa0f36['query']['ids']['length'];_0x2df402+=0x1){socket[_0xb466('0x7a')]('userChatQueue:remove',{'UserId':Number(_0xaa0f36[_0xb466('0x41')]['ids'][_0x2df402]),'ChatQueueId':Number(_0xaa0f36[_0xb466('0x54')]['id'])});}}else{socket[_0xb466('0x7a')]('userChatQueue:remove',{'UserId':Number(_0xaa0f36[_0xb466('0x41')]['ids']),'ChatQueueId':Number(_0xaa0f36['params']['id'])});}});}})[_0xb466('0x34')](respondWithStatusCode(_0x4a459a,null))[_0xb466('0x53')](handleError(_0x4a459a,null));};exports[_0xb466('0x92')]=function(_0x109431,_0xe9342d,_0x5a58e6){var _0xac771b={};var _0x246b6a={};var _0x55c1a4;var _0x3c559f;return db['ChatQueue'][_0xb466('0x60')]({'where':{'id':_0x109431[_0xb466('0x54')]['id']}})[_0xb466('0x34')](handleEntityNotFound(_0xe9342d,null))['then'](function(_0x29aeee){if(_0x29aeee){_0x55c1a4=_0x29aeee;_0x246b6a['model']=_[_0xb466('0x42')](db[_0xb466('0x65')][_0xb466('0x6f')]);_0x246b6a[_0xb466('0x41')]=_[_0xb466('0x42')](_0x109431[_0xb466('0x41')]);_0x246b6a[_0xb466('0x43')]=_[_0xb466('0x44')](_0x246b6a[_0xb466('0x3f')],_0x246b6a[_0xb466('0x41')]);_0xac771b[_0xb466('0x45')]=_[_0xb466('0x44')](_0x246b6a[_0xb466('0x3f')],qs[_0xb466('0x46')](_0x109431[_0xb466('0x41')][_0xb466('0x46')]));_0xac771b[_0xb466('0x45')]=_0xac771b[_0xb466('0x45')][_0xb466('0x55')]?_0xac771b[_0xb466('0x45')]:_0x246b6a[_0xb466('0x3f')];_0xac771b['order']=qs[_0xb466('0x4a')](_0x109431[_0xb466('0x41')][_0xb466('0x4a')]);_0xac771b[_0xb466('0x4b')]=qs['filters'](_[_0xb466('0x4c')](_0x109431['query'],_0x246b6a['filters']));if(_0x109431[_0xb466('0x41')][_0xb466('0x64')]){_0xac771b[_0xb466('0x4b')]=_[_0xb466('0x4d')](_0xac771b[_0xb466('0x4b')],{'$or':_[_0xb466('0x3a')](_0xac771b[_0xb466('0x45')],function(_0x27af42){var _0x1805e4={};_0x1805e4[_0x27af42]={'$like':'%'+_0x109431['query'][_0xb466('0x64')]+'%'};return _0x1805e4;})});}_0xac771b=_[_0xb466('0x4d')]({},_0xac771b,_0x109431[_0xb466('0x4f')]);return _0x55c1a4[_0xb466('0x92')](_0xac771b);}})[_0xb466('0x34')](function(_0x19a04e){if(_0x19a04e){_0x3c559f=_0x19a04e[_0xb466('0x55')];if(!_0x109431['query'][_0xb466('0x47')]('nolimit')){_0xac771b[_0xb466('0x49')]=qs[_0xb466('0x49')](_0x109431[_0xb466('0x41')][_0xb466('0x49')]);_0xac771b[_0xb466('0x2e')]=qs[_0xb466('0x2e')](_0x109431[_0xb466('0x41')][_0xb466('0x2e')]);}return _0x55c1a4[_0xb466('0x92')](_0xac771b);}})['then'](function(_0x22ae27){if(_0x22ae27){return _0x22ae27?{'count':_0x3c559f,'rows':_0x22ae27}:null;}})[_0xb466('0x34')](respondWithResult(_0xe9342d,null))[_0xb466('0x53')](handleError(_0xe9342d,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index d60a920..3b747e2 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x35b437,_0xe0447d){var _0x3b787c=function(_0x19f33e){while(--_0x19f33e){_0x35b437['push'](_0x35b437['shift']());}};_0x3b787c(++_0xe0447d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c9673,_0x296ba0){_0x2c9673=_0x2c9673-0x0;var _0x49c8b0=_0x5f2f[_0x2c9673];return _0x49c8b0;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0xadb5,0xad));var _0x5adb=function(_0x503181,_0xdb6c1d){_0x503181=_0x503181-0x0;var _0x2ed6fe=_0xadb5[_0x503181];return _0x2ed6fe;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x5adb('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatQueueEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatQueueEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatQueue[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 2439965..c766e36 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 _0x9aed=['util','api','moment','bluebird','rimraf','../../config/environment','./chatQueue.attributes','define'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0x9aed,0x158));var _0xd9ae=function(_0x578853,_0x3f71a4){_0x578853=_0x578853-0x0;var _0x41f932=_0x9aed[_0x578853];return _0x41f932;};'use strict';var _=require('lodash');var util=require(_0xd9ae('0x0'));var logger=require('../../config/logger')(_0xd9ae('0x1'));var moment=require(_0xd9ae('0x2'));var BPromise=require(_0xd9ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd9ae('0x4'));var config=require(_0xd9ae('0x5'));var attributes=require(_0xd9ae('0x6'));module['exports']=function(_0x561128,_0x2c3492){return _0x561128[_0xd9ae('0x7')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c2a=['define','ChatQueue','chat_queues','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8c2a,0x1b0));var _0xa8c2=function(_0x1c7586,_0x16efa7){_0x1c7586=_0x1c7586-0x0;var _0x4b4429=_0x8c2a[_0x1c7586];return _0x4b4429;};'use strict';var _=require(_0xa8c2('0x0'));var util=require('util');var logger=require(_0xa8c2('0x1'))(_0xa8c2('0x2'));var moment=require('moment');var BPromise=require(_0xa8c2('0x3'));var rp=require(_0xa8c2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8c2('0x5'));var config=require(_0xa8c2('0x6'));var attributes=require(_0xa8c2('0x7'));module['exports']=function(_0x1aa8e4,_0x549780){return _0x1aa8e4[_0xa8c2('0x8')](_0xa8c2('0x9'),attributes,{'tableName':_0xa8c2('0xa'),'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 2e56638..bee9c2d 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 _0xd4dc=['GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','stringify','ShowChatQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch'];(function(_0x32ace6,_0x2606ea){var _0x325308=function(_0x589fa3){while(--_0x589fa3){_0x32ace6['push'](_0x32ace6['shift']());}};_0x325308(++_0x2606ea);}(_0xd4dc,0xff));var _0xcd4d=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd4dc[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xcd4d('0x0'));var util=require('util');var moment=require(_0xcd4d('0x1'));var BPromise=require(_0xcd4d('0x2'));var rs=require(_0xcd4d('0x3'));var fs=require('fs');var Redis=require(_0xcd4d('0x4'));var db=require(_0xcd4d('0x5'))['db'];var utils=require(_0xcd4d('0x6'));var logger=require(_0xcd4d('0x7'))('rpc');var config=require(_0xcd4d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcd4d('0x9')]({'port':0x232a});config['redis']=_[_0xcd4d('0xa')](config[_0xcd4d('0xb')],{'host':_0xcd4d('0xc'),'port':0x18eb});var socket=require(_0xcd4d('0xd'))(new Redis(config[_0xcd4d('0xb')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x1ca579,_0xb0b7d,_0x56f2fd){return new BPromise(function(_0x279607,_0x46e10f){return client[_0xcd4d('0xe')](_0x1ca579,_0x56f2fd)['then'](function(_0x1a8437){logger['info'](_0xcd4d('0xf'),_0xb0b7d,_0xcd4d('0x10'));logger[_0xcd4d('0x11')](_0xcd4d('0x12'),_0xb0b7d,_0xcd4d('0x10'),JSON['stringify'](_0x1a8437));if(_0x1a8437['error']){if(_0x1a8437['error'][_0xcd4d('0x13')]===0x1f4){logger[_0xcd4d('0x14')](_0xcd4d('0xf'),_0xb0b7d,_0x1a8437[_0xcd4d('0x14')][_0xcd4d('0x15')]);return _0x46e10f(_0x1a8437[_0xcd4d('0x14')][_0xcd4d('0x15')]);}logger[_0xcd4d('0x14')](_0xcd4d('0xf'),_0xb0b7d,_0x1a8437[_0xcd4d('0x14')]['message']);return _0x279607(_0x1a8437[_0xcd4d('0x14')][_0xcd4d('0x15')]);}else{logger[_0xcd4d('0x16')](_0xcd4d('0xf'),_0xb0b7d,_0xcd4d('0x10'));_0x279607(_0x1a8437[_0xcd4d('0x17')][_0xcd4d('0x15')]);}})[_0xcd4d('0x18')](function(_0x138d00){logger[_0xcd4d('0x14')](_0xcd4d('0xf'),_0xb0b7d,_0x138d00);_0x46e10f(_0x138d00);});});}exports[_0xcd4d('0x19')]=function(_0x346bd3){var _0x4b0eae=this;return new Promise(function(_0x6a6da1,_0x1d7cdf){return db[_0xcd4d('0x1a')][_0xcd4d('0x1b')]({'raw':_0x346bd3[_0xcd4d('0x1c')]?_0x346bd3[_0xcd4d('0x1c')][_0xcd4d('0x1d')]===undefined?!![]:![]:!![],'where':_0x346bd3[_0xcd4d('0x1c')]?_0x346bd3[_0xcd4d('0x1c')][_0xcd4d('0x1e')]||null:null,'attributes':_0x346bd3[_0xcd4d('0x1c')]?_0x346bd3['options'][_0xcd4d('0x1f')]||null:null,'limit':_0x346bd3['options']?_0x346bd3[_0xcd4d('0x1c')][_0xcd4d('0x20')]||null:null,'include':_0x346bd3['options']?_0x346bd3[_0xcd4d('0x1c')]['include']?_[_0xcd4d('0x21')](_0x346bd3[_0xcd4d('0x1c')][_0xcd4d('0x22')],function(_0x512774){return{'model':db[_0x512774['model']],'as':_0x512774['as'],'attributes':_0x512774['attributes'],'include':_0x512774[_0xcd4d('0x22')]?_[_0xcd4d('0x21')](_0x512774[_0xcd4d('0x22')],function(_0xf9e37e){return{'model':db[_0xf9e37e[_0xcd4d('0x23')]],'as':_0xf9e37e['as'],'attributes':_0xf9e37e['attributes'],'include':_0xf9e37e['include']?_[_0xcd4d('0x21')](_0xf9e37e[_0xcd4d('0x22')],function(_0x4adcb5){return{'model':db[_0x4adcb5[_0xcd4d('0x23')]],'as':_0x4adcb5['as'],'attributes':_0x4adcb5[_0xcd4d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcd4d('0x24')](function(_0x310523){logger[_0xcd4d('0x16')](_0xcd4d('0x19'),_0x346bd3);logger[_0xcd4d('0x11')]('GetChatQueue',_0x346bd3,JSON[_0xcd4d('0x25')](_0x310523));_0x6a6da1(_0x310523);})[_0xcd4d('0x18')](function(_0x4a2cf4){logger[_0xcd4d('0x14')]('GetChatQueue',_0x4a2cf4['message'],_0x346bd3);_0x1d7cdf(_0x4b0eae[_0xcd4d('0x14')](0x1f4,_0x4a2cf4['message']));});});};exports[_0xcd4d('0x26')]=function(_0x86c7a4){var _0x9eae4b=this;return new Promise(function(_0x293d0e,_0xa68356){return db[_0xcd4d('0x1a')][_0xcd4d('0x27')]({'raw':_0x86c7a4[_0xcd4d('0x1c')]?_0x86c7a4[_0xcd4d('0x1c')][_0xcd4d('0x1d')]===undefined?!![]:![]:!![],'where':_0x86c7a4[_0xcd4d('0x1c')]?_0x86c7a4[_0xcd4d('0x1c')][_0xcd4d('0x1e')]||null:null,'attributes':_0x86c7a4[_0xcd4d('0x1c')]?_0x86c7a4[_0xcd4d('0x1c')][_0xcd4d('0x1f')]||null:null,'include':_0x86c7a4[_0xcd4d('0x1c')]?_0x86c7a4[_0xcd4d('0x1c')]['include']?_[_0xcd4d('0x21')](_0x86c7a4['options'][_0xcd4d('0x22')],function(_0x24d010){return{'model':db[_0x24d010[_0xcd4d('0x23')]],'as':_0x24d010['as'],'attributes':_0x24d010['attributes'],'include':_0x24d010['include']?_[_0xcd4d('0x21')](_0x24d010['include'],function(_0x340de1){return{'model':db[_0x340de1[_0xcd4d('0x23')]],'as':_0x340de1['as'],'attributes':_0x340de1[_0xcd4d('0x1f')],'include':_0x340de1[_0xcd4d('0x22')]?_[_0xcd4d('0x21')](_0x340de1[_0xcd4d('0x22')],function(_0x549cb2){return{'model':db[_0x549cb2[_0xcd4d('0x23')]],'as':_0x549cb2['as'],'attributes':_0x549cb2[_0xcd4d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcd4d('0x24')](function(_0x51026c){logger[_0xcd4d('0x16')](_0xcd4d('0x26'),_0x86c7a4);logger[_0xcd4d('0x11')](_0xcd4d('0x26'),_0x86c7a4,JSON['stringify'](_0x51026c));_0x293d0e(_0x51026c);})[_0xcd4d('0x18')](function(_0x606c21){logger['error'](_0xcd4d('0x26'),_0x606c21[_0xcd4d('0x15')],_0x86c7a4);_0xa68356(_0x9eae4b['error'](0x1f4,_0x606c21['message']));});});}; \ No newline at end of file +var _0x8101=['request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','findAll','options','raw','attributes','limit','include','map','model','then','info','GetChatQueue','ShowChatQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request'];(function(_0x5cf0e9,_0x6e80ba){var _0x27091d=function(_0x4b0fd0){while(--_0x4b0fd0){_0x5cf0e9['push'](_0x5cf0e9['shift']());}};_0x27091d(++_0x6e80ba);}(_0x8101,0xc0));var _0x1810=function(_0x426076,_0xfdf5d2){_0x426076=_0x426076-0x0;var _0x1e9565=_0x8101[_0x426076];return _0x1e9565;};'use strict';var _=require(_0x1810('0x0'));var util=require(_0x1810('0x1'));var moment=require(_0x1810('0x2'));var BPromise=require(_0x1810('0x3'));var rs=require(_0x1810('0x4'));var fs=require('fs');var Redis=require(_0x1810('0x5'));var db=require(_0x1810('0x6'))['db'];var utils=require(_0x1810('0x7'));var logger=require(_0x1810('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1810('0x9'));var client=jayson[_0x1810('0xa')]['http']({'port':0x232a});config[_0x1810('0xb')]=_[_0x1810('0xc')](config[_0x1810('0xb')],{'host':_0x1810('0xd'),'port':0x18eb});var socket=require(_0x1810('0xe'))(new Redis(config[_0x1810('0xb')]));require(_0x1810('0xf'))[_0x1810('0x10')](socket);function respondWithRpcPromise(_0xaa4b05,_0x1e732c,_0x419324){return new BPromise(function(_0x5126d2,_0x3a664b){return client[_0x1810('0x11')](_0xaa4b05,_0x419324)['then'](function(_0xb75b94){logger['info']('ChatQueue,\x20%s,\x20%s',_0x1e732c,_0x1810('0x12'));logger[_0x1810('0x13')](_0x1810('0x14'),_0x1e732c,_0x1810('0x12'),JSON[_0x1810('0x15')](_0xb75b94));if(_0xb75b94[_0x1810('0x16')]){if(_0xb75b94['error'][_0x1810('0x17')]===0x1f4){logger[_0x1810('0x16')]('ChatQueue,\x20%s,\x20%s',_0x1e732c,_0xb75b94['error'][_0x1810('0x18')]);return _0x3a664b(_0xb75b94['error'][_0x1810('0x18')]);}logger[_0x1810('0x16')](_0x1810('0x19'),_0x1e732c,_0xb75b94[_0x1810('0x16')][_0x1810('0x18')]);return _0x5126d2(_0xb75b94[_0x1810('0x16')][_0x1810('0x18')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x1e732c,'request\x20sent');_0x5126d2(_0xb75b94[_0x1810('0x1a')]['message']);}})[_0x1810('0x1b')](function(_0x423612){logger[_0x1810('0x16')](_0x1810('0x19'),_0x1e732c,_0x423612);_0x3a664b(_0x423612);});});}exports['GetChatQueue']=function(_0x1490c3){var _0x5c8c36=this;return new Promise(function(_0x9a295c,_0x116ea0){return db['ChatQueue'][_0x1810('0x1c')]({'raw':_0x1490c3[_0x1810('0x1d')]?_0x1490c3[_0x1810('0x1d')][_0x1810('0x1e')]===undefined?!![]:![]:!![],'where':_0x1490c3[_0x1810('0x1d')]?_0x1490c3[_0x1810('0x1d')]['where']||null:null,'attributes':_0x1490c3[_0x1810('0x1d')]?_0x1490c3[_0x1810('0x1d')][_0x1810('0x1f')]||null:null,'limit':_0x1490c3[_0x1810('0x1d')]?_0x1490c3['options'][_0x1810('0x20')]||null:null,'include':_0x1490c3['options']?_0x1490c3['options'][_0x1810('0x21')]?_[_0x1810('0x22')](_0x1490c3[_0x1810('0x1d')][_0x1810('0x21')],function(_0x2b6da6){return{'model':db[_0x2b6da6['model']],'as':_0x2b6da6['as'],'attributes':_0x2b6da6[_0x1810('0x1f')],'include':_0x2b6da6[_0x1810('0x21')]?_[_0x1810('0x22')](_0x2b6da6[_0x1810('0x21')],function(_0x523bb2){return{'model':db[_0x523bb2['model']],'as':_0x523bb2['as'],'attributes':_0x523bb2[_0x1810('0x1f')],'include':_0x523bb2[_0x1810('0x21')]?_[_0x1810('0x22')](_0x523bb2[_0x1810('0x21')],function(_0x2d387a){return{'model':db[_0x2d387a[_0x1810('0x23')]],'as':_0x2d387a['as'],'attributes':_0x2d387a[_0x1810('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1810('0x24')](function(_0xfbc80c){logger[_0x1810('0x25')](_0x1810('0x26'),_0x1490c3);logger[_0x1810('0x13')](_0x1810('0x26'),_0x1490c3,JSON['stringify'](_0xfbc80c));_0x9a295c(_0xfbc80c);})[_0x1810('0x1b')](function(_0x271a45){logger[_0x1810('0x16')](_0x1810('0x26'),_0x271a45[_0x1810('0x18')],_0x1490c3);_0x116ea0(_0x5c8c36[_0x1810('0x16')](0x1f4,_0x271a45['message']));});});};exports[_0x1810('0x27')]=function(_0x309e83){var _0xb30cab=this;return new Promise(function(_0x2958c0,_0x38d192){return db['ChatQueue'][_0x1810('0x28')]({'raw':_0x309e83[_0x1810('0x1d')]?_0x309e83[_0x1810('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x309e83[_0x1810('0x1d')]?_0x309e83[_0x1810('0x1d')][_0x1810('0x29')]||null:null,'attributes':_0x309e83[_0x1810('0x1d')]?_0x309e83[_0x1810('0x1d')][_0x1810('0x1f')]||null:null,'include':_0x309e83[_0x1810('0x1d')]?_0x309e83[_0x1810('0x1d')][_0x1810('0x21')]?_[_0x1810('0x22')](_0x309e83[_0x1810('0x1d')][_0x1810('0x21')],function(_0x149948){return{'model':db[_0x149948[_0x1810('0x23')]],'as':_0x149948['as'],'attributes':_0x149948[_0x1810('0x1f')],'include':_0x149948['include']?_[_0x1810('0x22')](_0x149948['include'],function(_0x535fcc){return{'model':db[_0x535fcc[_0x1810('0x23')]],'as':_0x535fcc['as'],'attributes':_0x535fcc[_0x1810('0x1f')],'include':_0x535fcc['include']?_[_0x1810('0x22')](_0x535fcc[_0x1810('0x21')],function(_0x3f5e4c){return{'model':db[_0x3f5e4c[_0x1810('0x23')]],'as':_0x3f5e4c['as'],'attributes':_0x3f5e4c[_0x1810('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1810('0x24')](function(_0x2eafd8){logger['info'](_0x1810('0x27'),_0x309e83);logger[_0x1810('0x13')]('ShowChatQueue',_0x309e83,JSON['stringify'](_0x2eafd8));_0x2958c0(_0x2eafd8);})[_0x1810('0x1b')](function(_0x569d55){logger[_0x1810('0x16')](_0x1810('0x27'),_0x569d55[_0x1810('0x18')],_0x309e83);_0x38d192(_0xb30cab[_0x1810('0x16')](0x1f4,_0x569d55[_0x1810('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index f118d77..17db9c6 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0xdb357c,_0x3786b6){var _0x5c8735=function(_0x2e179c){while(--_0x2e179c){_0xdb357c['push'](_0xdb357c['shift']());}};_0x5c8735(++_0x3786b6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29a30d,_0x5d0800){_0x29a30d=_0x29a30d-0x0;var _0x102801=_0x5f2f[_0x29a30d];return _0x102801;};'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 +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x6c59fc,_0x5fe88d){var _0x17c96f=function(_0x5a6c82){while(--_0x5a6c82){_0x6c59fc['push'](_0x6c59fc['shift']());}};_0x17c96f(++_0x5fe88d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2250d9,_0x30e8f2){_0x2250d9=_0x2250d9-0x0;var _0x2a0cb3=_0x5f2f[_0x2250d9];return _0x2a0cb3;};'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 9f2c52c..ee3b742 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 _0x4753=['index','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','/:id/users','post','addAgents','put','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','get'];(function(_0xc7679b,_0x2511a2){var _0x4e8f0b=function(_0x166401){while(--_0x166401){_0xc7679b['push'](_0xc7679b['shift']());}};_0x4e8f0b(++_0x2511a2);}(_0x4753,0x10a));var _0x3475=function(_0x286f69,_0x481dd4){_0x286f69=_0x286f69-0x0;var _0xa8aba0=_0x4753[_0x286f69];return _0xa8aba0;};'use strict';var multer=require(_0x3475('0x0'));var util=require(_0x3475('0x1'));var path=require(_0x3475('0x2'));var timeout=require(_0x3475('0x3'));var express=require('express');var router=express[_0x3475('0x4')]();var auth=require(_0x3475('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3475('0x6'));var controller=require(_0x3475('0x7'));router[_0x3475('0x8')]('/',auth['isAuthenticated'](),controller[_0x3475('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3475('0xa')]);router[_0x3475('0x8')](_0x3475('0xb'),auth[_0x3475('0xc')](),controller[_0x3475('0xd')]);router['get'](_0x3475('0xe'),auth[_0x3475('0xc')](),controller[_0x3475('0xf')]);router[_0x3475('0x8')](_0x3475('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3475('0x8')](_0x3475('0x11'),auth[_0x3475('0xc')](),controller['getAgents']);router[_0x3475('0x12')]('/',auth[_0x3475('0xc')](),controller['create']);router[_0x3475('0x12')](_0x3475('0x10'),auth[_0x3475('0xc')](),controller['addTeams']);router[_0x3475('0x12')](_0x3475('0x11'),auth[_0x3475('0xc')](),controller[_0x3475('0x13')]);router[_0x3475('0x14')](_0x3475('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x3475('0x15')]('/:id',auth[_0x3475('0xc')](),controller[_0x3475('0x16')]);router[_0x3475('0x15')](_0x3475('0x10'),auth[_0x3475('0xc')](),controller[_0x3475('0x17')]);router[_0x3475('0x15')]('/:id/users',auth[_0x3475('0xc')](),controller['removeAgents']);module[_0x3475('0x18')]=router; \ No newline at end of file +var _0x4af1=['getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','addAgents','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members'];(function(_0x4e8bf7,_0x51dadc){var _0x42f457=function(_0x4e030f){while(--_0x4e030f){_0x4e8bf7['push'](_0x4e8bf7['shift']());}};_0x42f457(++_0x51dadc);}(_0x4af1,0x7c));var _0x14af=function(_0x45c603,_0x5901a9){_0x45c603=_0x45c603-0x0;var _0x4c2bb6=_0x4af1[_0x45c603];return _0x4c2bb6;};'use strict';var multer=require(_0x14af('0x0'));var util=require(_0x14af('0x1'));var path=require(_0x14af('0x2'));var timeout=require(_0x14af('0x3'));var express=require(_0x14af('0x4'));var router=express[_0x14af('0x5')]();var auth=require(_0x14af('0x6'));var interaction=require(_0x14af('0x7'));var config=require('../../config/environment');var controller=require(_0x14af('0x8'));router[_0x14af('0x9')]('/',auth[_0x14af('0xa')](),controller[_0x14af('0xb')]);router[_0x14af('0x9')](_0x14af('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x14af('0x9')](_0x14af('0xd'),auth[_0x14af('0xa')](),controller[_0x14af('0xe')]);router[_0x14af('0x9')](_0x14af('0xf'),auth['isAuthenticated'](),controller[_0x14af('0x10')]);router[_0x14af('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x14af('0x11')]);router[_0x14af('0x9')](_0x14af('0x12'),auth[_0x14af('0xa')](),controller[_0x14af('0x13')]);router['post']('/',auth[_0x14af('0xa')](),controller[_0x14af('0x14')]);router[_0x14af('0x15')](_0x14af('0x16'),auth[_0x14af('0xa')](),controller['addTeams']);router[_0x14af('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x14af('0x17')]);router[_0x14af('0x18')](_0x14af('0xd'),auth[_0x14af('0xa')](),controller[_0x14af('0x19')]);router[_0x14af('0x1a')](_0x14af('0xd'),auth[_0x14af('0xa')](),controller['destroy']);router['delete'](_0x14af('0x16'),auth[_0x14af('0xa')](),controller['removeTeams']);router[_0x14af('0x1a')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x14af('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 02b075d..a3a56cf 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 _0xcd54=['STRING','DATE','moment','exports'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xcd54,0x1a2));var _0x4cd5=function(_0x26d0d2,_0x1824ba){_0x26d0d2=_0x26d0d2-0x0;var _0x16ccd9=_0xcd54[_0x26d0d2];return _0x16ccd9;};'use strict';var moment=require(_0x4cd5('0x0'));var Sequelize=require('sequelize');module[_0x4cd5('0x1')]={'uniqueid':{'type':Sequelize[_0x4cd5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4cd5('0x3')]},'acceptAt':{'type':Sequelize[_0x4cd5('0x3')]},'exitAt':{'type':Sequelize[_0x4cd5('0x3')]},'reason':{'type':Sequelize[_0x4cd5('0x2')]}}; \ No newline at end of file +var _0xc06f=['exports','STRING','DATE','moment','sequelize'];(function(_0x14612f,_0x1c3389){var _0x3c41ad=function(_0x41043c){while(--_0x41043c){_0x14612f['push'](_0x14612f['shift']());}};_0x3c41ad(++_0x1c3389);}(_0xc06f,0xd5));var _0xfc06=function(_0x484fb1,_0x3fcccb){_0x484fb1=_0x484fb1-0x0;var _0x5dc4c1=_0xc06f[_0x484fb1];return _0x5dc4c1;};'use strict';var moment=require(_0xfc06('0x0'));var Sequelize=require(_0xfc06('0x1'));module[_0xfc06('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xfc06('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfc06('0x4')]},'acceptAt':{'type':Sequelize[_0xfc06('0x4')]},'exitAt':{'type':Sequelize[_0xfc06('0x4')]},'reason':{'type':Sequelize[_0xfc06('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index a36d626..601973d 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 _0xbd2b=['params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','sendStatus','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd2b,0x92));var _0xbbd2=function(_0x12c2c9,_0x6f2f51){_0x12c2c9=_0x12c2c9-0x0;var _0x21f841=_0xbd2b[_0x12c2c9];return _0x21f841;};'use strict';var pdf=require(_0xbbd2('0x0'));var emlformat=require(_0xbbd2('0x1'));var rimraf=require(_0xbbd2('0x2'));var zipdir=require(_0xbbd2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbbd2('0x4'));var util=require(_0xbbd2('0x5'));var path=require(_0xbbd2('0x6'));var sox=require(_0xbbd2('0x7'));var csv=require(_0xbbd2('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbbd2('0x9'));var crypto=require('crypto');var jsforce=require(_0xbbd2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbbd2('0x8'));var querystring=require('querystring');var Papa=require(_0xbbd2('0xb'));var Redis=require(_0xbbd2('0xc'));var authService=require(_0xbbd2('0xd'));var qs=require(_0xbbd2('0xe'));var as=require(_0xbbd2('0xf'));var hardwareService=require(_0xbbd2('0x10'));var logger=require(_0xbbd2('0x11'))(_0xbbd2('0x12'));var utils=require(_0xbbd2('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbbd2('0x14'))['db'];function respondWithStatusCode(_0x49f477,_0x28e6af){_0x28e6af=_0x28e6af||0xcc;return function(_0x29d350){if(_0x29d350){return _0x49f477['sendStatus'](_0x28e6af);}return _0x49f477[_0xbbd2('0x15')](_0x28e6af)[_0xbbd2('0x16')]();};}function respondWithResult(_0xe6b855,_0x5b4d60){_0x5b4d60=_0x5b4d60||0xc8;return function(_0x1df6ca){if(_0x1df6ca){return _0xe6b855[_0xbbd2('0x15')](_0x5b4d60)[_0xbbd2('0x17')](_0x1df6ca);}};}function respondWithFilteredResult(_0x8e7337,_0x2482ac){return function(_0xf7afd6){if(_0xf7afd6){var _0x28ac36=_0xf7afd6[_0xbbd2('0x18')],_0x10a3e8=_0x2482ac[_0xbbd2('0x19')],_0x42c0ab=_0x2482ac[_0xbbd2('0x19')]+_0x2482ac[_0xbbd2('0x1a')],_0x881676;if(_0x42c0ab>=_0x28ac36){_0x42c0ab=_0x28ac36;_0x881676=0xc8;}else{_0x881676=0xce;}_0x8e7337[_0xbbd2('0x15')](_0x881676);return _0x8e7337['set'](_0xbbd2('0x1b'),_0x10a3e8+'-'+_0x42c0ab+'/'+_0x28ac36)[_0xbbd2('0x17')](_0xf7afd6);}return null;};}function patchUpdates(_0x4816eb){return function(_0x154f74){try{jsonpatch['apply'](_0x154f74,_0x4816eb,!![]);}catch(_0x39d1bc){return BPromise[_0xbbd2('0x1c')](_0x39d1bc);}return _0x154f74['save']();};}function saveUpdates(_0x3b14c5,_0x2dea4e){return function(_0x47d3ba){if(_0x47d3ba){return _0x47d3ba[_0xbbd2('0x1d')](_0x3b14c5)[_0xbbd2('0x1e')](function(_0x592af7){return _0x592af7;});}return null;};}function removeEntity(_0x113cc1,_0x311bb6){return function(_0x24be77){if(_0x24be77){return _0x24be77[_0xbbd2('0x1f')]()[_0xbbd2('0x1e')](function(){_0x113cc1['status'](0xcc)[_0xbbd2('0x16')]();});}};}function handleEntityNotFound(_0x4d0fb0,_0x4ea39b){return function(_0x208f05){if(!_0x208f05){_0x4d0fb0[_0xbbd2('0x20')](0x194);}return _0x208f05;};}function handleError(_0x3ac400,_0x5b65a2){_0x5b65a2=_0x5b65a2||0x1f4;return function(_0x3cf778){logger['error'](_0x3cf778['stack']);if(_0x3cf778['name']){delete _0x3cf778[_0xbbd2('0x21')];}_0x3ac400[_0xbbd2('0x15')](_0x5b65a2)[_0xbbd2('0x22')](_0x3cf778);};}exports[_0xbbd2('0x23')]=function(_0x35fb5f,_0x3accba){var _0x55fa47={},_0x1f0d44={},_0x107303={'count':0x0,'rows':[]};var _0x41b59b=_[_0xbbd2('0x24')](db[_0xbbd2('0x25')][_0xbbd2('0x26')],function(_0x5d562b){return{'name':_0x5d562b[_0xbbd2('0x27')],'type':_0x5d562b[_0xbbd2('0x28')][_0xbbd2('0x29')]};});_0x1f0d44[_0xbbd2('0x2a')]=_[_0xbbd2('0x24')](_0x41b59b,'name');_0x1f0d44[_0xbbd2('0x2b')]=_[_0xbbd2('0x2c')](_0x35fb5f[_0xbbd2('0x2b')]);_0x1f0d44['filters']=_[_0xbbd2('0x2d')](_0x1f0d44[_0xbbd2('0x2a')],_0x1f0d44[_0xbbd2('0x2b')]);_0x55fa47[_0xbbd2('0x2e')]=_[_0xbbd2('0x2d')](_0x1f0d44[_0xbbd2('0x2a')],qs['fields'](_0x35fb5f['query'][_0xbbd2('0x2f')]));_0x55fa47[_0xbbd2('0x2e')]=_0x55fa47['attributes'][_0xbbd2('0x30')]?_0x55fa47[_0xbbd2('0x2e')]:_0x1f0d44[_0xbbd2('0x2a')];if(!_0x35fb5f[_0xbbd2('0x2b')][_0xbbd2('0x31')]('nolimit')){_0x55fa47['limit']=qs[_0xbbd2('0x1a')](_0x35fb5f[_0xbbd2('0x2b')]['limit']);_0x55fa47[_0xbbd2('0x19')]=qs['offset'](_0x35fb5f[_0xbbd2('0x2b')]['offset']);}_0x55fa47[_0xbbd2('0x32')]=qs[_0xbbd2('0x33')](_0x35fb5f[_0xbbd2('0x2b')][_0xbbd2('0x33')]);_0x55fa47[_0xbbd2('0x34')]=qs[_0xbbd2('0x35')](_[_0xbbd2('0x36')](_0x35fb5f['query'],_0x1f0d44['filters']),_0x41b59b);if(_0x35fb5f[_0xbbd2('0x2b')][_0xbbd2('0x37')]){_0x55fa47[_0xbbd2('0x34')]=_[_0xbbd2('0x38')](_0x55fa47['where'],{'$or':_[_0xbbd2('0x24')](_0x41b59b,function(_0x5bc88f){if(_0x5bc88f[_0xbbd2('0x28')]!==_0xbbd2('0x39')){var _0x477542={};_0x477542[_0x5bc88f['name']]={'$like':'%'+_0x35fb5f[_0xbbd2('0x2b')]['filter']+'%'};return _0x477542;}})});}_0x55fa47=_[_0xbbd2('0x38')]({},_0x55fa47,_0x35fb5f[_0xbbd2('0x3a')]);var _0x2a89c3={'where':_0x55fa47[_0xbbd2('0x34')]};return db[_0xbbd2('0x25')][_0xbbd2('0x18')](_0x2a89c3)[_0xbbd2('0x1e')](function(_0x126520){_0x107303[_0xbbd2('0x18')]=_0x126520;if(_0x35fb5f[_0xbbd2('0x2b')][_0xbbd2('0x3b')]){_0x55fa47[_0xbbd2('0x3c')]=[{'all':!![]}];}return db[_0xbbd2('0x25')][_0xbbd2('0x3d')](_0x55fa47);})[_0xbbd2('0x1e')](function(_0x28e67b){_0x107303[_0xbbd2('0x3e')]=_0x28e67b;return _0x107303;})[_0xbbd2('0x1e')](respondWithFilteredResult(_0x3accba,_0x55fa47))['catch'](handleError(_0x3accba,null));};exports[_0xbbd2('0x3f')]=function(_0x538dd1,_0x828560){var _0x25650d={'raw':!![],'where':{'id':_0x538dd1[_0xbbd2('0x40')]['id']}},_0x21061c={};_0x21061c[_0xbbd2('0x2a')]=_[_0xbbd2('0x2c')](db['ChatQueueReport']['rawAttributes']);_0x21061c['query']=_[_0xbbd2('0x2c')](_0x538dd1[_0xbbd2('0x2b')]);_0x21061c[_0xbbd2('0x35')]=_[_0xbbd2('0x2d')](_0x21061c['model'],_0x21061c[_0xbbd2('0x2b')]);_0x25650d[_0xbbd2('0x2e')]=_[_0xbbd2('0x2d')](_0x21061c[_0xbbd2('0x2a')],qs[_0xbbd2('0x2f')](_0x538dd1['query'][_0xbbd2('0x2f')]));_0x25650d[_0xbbd2('0x2e')]=_0x25650d[_0xbbd2('0x2e')][_0xbbd2('0x30')]?_0x25650d[_0xbbd2('0x2e')]:_0x21061c[_0xbbd2('0x2a')];if(_0x538dd1[_0xbbd2('0x2b')]['includeAll']){_0x25650d[_0xbbd2('0x3c')]=[{'all':!![]}];}_0x25650d=_['merge']({},_0x25650d,_0x538dd1['options']);return db[_0xbbd2('0x25')][_0xbbd2('0x41')](_0x25650d)[_0xbbd2('0x1e')](handleEntityNotFound(_0x828560,null))[_0xbbd2('0x1e')](respondWithResult(_0x828560,null))[_0xbbd2('0x42')](handleError(_0x828560,null));};exports[_0xbbd2('0x43')]=function(_0x31796e,_0x2f801b){return db[_0xbbd2('0x25')]['create'](_0x31796e[_0xbbd2('0x44')],{})[_0xbbd2('0x1e')](respondWithResult(_0x2f801b,0xc9))[_0xbbd2('0x42')](handleError(_0x2f801b,null));};exports['update']=function(_0x514d93,_0x4c3a04){if(_0x514d93[_0xbbd2('0x44')]['id']){delete _0x514d93[_0xbbd2('0x44')]['id'];}return db[_0xbbd2('0x25')][_0xbbd2('0x41')]({'where':{'id':_0x514d93[_0xbbd2('0x40')]['id']}})[_0xbbd2('0x1e')](handleEntityNotFound(_0x4c3a04,null))['then'](saveUpdates(_0x514d93[_0xbbd2('0x44')],null))['then'](respondWithResult(_0x4c3a04,null))[_0xbbd2('0x42')](handleError(_0x4c3a04,null));};exports['destroy']=function(_0x59beb9,_0x50a192){return db['ChatQueueReport']['find']({'where':{'id':_0x59beb9[_0xbbd2('0x40')]['id']}})['then'](handleEntityNotFound(_0x50a192,null))[_0xbbd2('0x1e')](removeEntity(_0x50a192,null))[_0xbbd2('0x42')](handleError(_0x50a192,null));};exports[_0xbbd2('0x45')]=function(_0x3a45b4,_0x27d581){return db['ChatQueueReport']['describe']()['then'](respondWithResult(_0x27d581,null))['catch'](handleError(_0x27d581,null));}; \ No newline at end of file +var _0x2ceb=['apply','reject','update','then','destroy','status','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','ChatQueueReport','count','include','findAll','rows','catch','params','length','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','limit','set','Content-Range'];(function(_0x486293,_0x32a3f9){var _0xf4f77=function(_0x3acce6){while(--_0x3acce6){_0x486293['push'](_0x486293['shift']());}};_0xf4f77(++_0x32a3f9);}(_0x2ceb,0x76));var _0xb2ce=function(_0x1d039a,_0x1ea5bb){_0x1d039a=_0x1d039a-0x0;var _0x71e4dd=_0x2ceb[_0x1d039a];return _0x71e4dd;};'use strict';var pdf=require(_0xb2ce('0x0'));var emlformat=require(_0xb2ce('0x1'));var rimraf=require(_0xb2ce('0x2'));var zipdir=require(_0xb2ce('0x3'));var jsonpatch=require(_0xb2ce('0x4'));var rp=require(_0xb2ce('0x5'));var moment=require(_0xb2ce('0x6'));var BPromise=require(_0xb2ce('0x7'));var Mustache=require(_0xb2ce('0x8'));var util=require(_0xb2ce('0x9'));var path=require(_0xb2ce('0xa'));var sox=require('sox');var csv=require(_0xb2ce('0xb'));var ejs=require(_0xb2ce('0xc'));var fs=require('fs');var _=require(_0xb2ce('0xd'));var squel=require(_0xb2ce('0xe'));var crypto=require(_0xb2ce('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xb2ce('0x10'));var toCsv=require(_0xb2ce('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb2ce('0x11'));var authService=require(_0xb2ce('0x12'));var qs=require(_0xb2ce('0x13'));var as=require(_0xb2ce('0x14'));var hardwareService=require(_0xb2ce('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xb2ce('0x16'));var config=require(_0xb2ce('0x17'));var licenseUtil=require(_0xb2ce('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34345d,_0x275d12){_0x275d12=_0x275d12||0xcc;return function(_0x1e1d18){if(_0x1e1d18){return _0x34345d[_0xb2ce('0x19')](_0x275d12);}return _0x34345d['status'](_0x275d12)[_0xb2ce('0x1a')]();};}function respondWithResult(_0x2f78c0,_0x2ea1bc){_0x2ea1bc=_0x2ea1bc||0xc8;return function(_0x4d6794){if(_0x4d6794){return _0x2f78c0['status'](_0x2ea1bc)[_0xb2ce('0x1b')](_0x4d6794);}};}function respondWithFilteredResult(_0x5927dd,_0x4a4cd1){return function(_0x29faa6){if(_0x29faa6){var _0x2f2560=_0x29faa6['count'],_0xbfff09=_0x4a4cd1[_0xb2ce('0x1c')],_0x1228ab=_0x4a4cd1[_0xb2ce('0x1c')]+_0x4a4cd1[_0xb2ce('0x1d')],_0x18db4e;if(_0x1228ab>=_0x2f2560){_0x1228ab=_0x2f2560;_0x18db4e=0xc8;}else{_0x18db4e=0xce;}_0x5927dd['status'](_0x18db4e);return _0x5927dd[_0xb2ce('0x1e')](_0xb2ce('0x1f'),_0xbfff09+'-'+_0x1228ab+'/'+_0x2f2560)[_0xb2ce('0x1b')](_0x29faa6);}return null;};}function patchUpdates(_0x4d3b8a){return function(_0x96d1c){try{jsonpatch[_0xb2ce('0x20')](_0x96d1c,_0x4d3b8a,!![]);}catch(_0x400009){return BPromise[_0xb2ce('0x21')](_0x400009);}return _0x96d1c['save']();};}function saveUpdates(_0x3402d3,_0xeaa7a7){return function(_0x1fabd2){if(_0x1fabd2){return _0x1fabd2[_0xb2ce('0x22')](_0x3402d3)[_0xb2ce('0x23')](function(_0x19c7af){return _0x19c7af;});}return null;};}function removeEntity(_0x118ad5,_0x2e5d34){return function(_0x5c14ef){if(_0x5c14ef){return _0x5c14ef[_0xb2ce('0x24')]()[_0xb2ce('0x23')](function(){_0x118ad5[_0xb2ce('0x25')](0xcc)[_0xb2ce('0x1a')]();});}};}function handleEntityNotFound(_0x4d86d4,_0x1dd7aa){return function(_0x50d4b9){if(!_0x50d4b9){_0x4d86d4[_0xb2ce('0x19')](0x194);}return _0x50d4b9;};}function handleError(_0x354ca8,_0x34247a){_0x34247a=_0x34247a||0x1f4;return function(_0x1ec500){logger[_0xb2ce('0x26')](_0x1ec500['stack']);if(_0x1ec500[_0xb2ce('0x27')]){delete _0x1ec500['name'];}_0x354ca8['status'](_0x34247a)[_0xb2ce('0x28')](_0x1ec500);};}exports['index']=function(_0x21e9e5,_0x1fa5f7){var _0x35e002={},_0x44fcfc={},_0x4b4e89={'count':0x0,'rows':[]};var _0x191ead=_[_0xb2ce('0x29')](db['ChatQueueReport'][_0xb2ce('0x2a')],function(_0x1392c9){return{'name':_0x1392c9[_0xb2ce('0x2b')],'type':_0x1392c9['type'][_0xb2ce('0x2c')]};});_0x44fcfc[_0xb2ce('0x2d')]=_[_0xb2ce('0x29')](_0x191ead,'name');_0x44fcfc[_0xb2ce('0x2e')]=_[_0xb2ce('0x2f')](_0x21e9e5['query']);_0x44fcfc[_0xb2ce('0x30')]=_[_0xb2ce('0x31')](_0x44fcfc['model'],_0x44fcfc[_0xb2ce('0x2e')]);_0x35e002[_0xb2ce('0x32')]=_[_0xb2ce('0x31')](_0x44fcfc[_0xb2ce('0x2d')],qs['fields'](_0x21e9e5[_0xb2ce('0x2e')][_0xb2ce('0x33')]));_0x35e002[_0xb2ce('0x32')]=_0x35e002[_0xb2ce('0x32')]['length']?_0x35e002[_0xb2ce('0x32')]:_0x44fcfc[_0xb2ce('0x2d')];if(!_0x21e9e5[_0xb2ce('0x2e')][_0xb2ce('0x34')](_0xb2ce('0x35'))){_0x35e002[_0xb2ce('0x1d')]=qs[_0xb2ce('0x1d')](_0x21e9e5[_0xb2ce('0x2e')][_0xb2ce('0x1d')]);_0x35e002[_0xb2ce('0x1c')]=qs[_0xb2ce('0x1c')](_0x21e9e5[_0xb2ce('0x2e')][_0xb2ce('0x1c')]);}_0x35e002[_0xb2ce('0x36')]=qs['sort'](_0x21e9e5[_0xb2ce('0x2e')][_0xb2ce('0x37')]);_0x35e002[_0xb2ce('0x38')]=qs['filters'](_[_0xb2ce('0x39')](_0x21e9e5[_0xb2ce('0x2e')],_0x44fcfc[_0xb2ce('0x30')]),_0x191ead);if(_0x21e9e5[_0xb2ce('0x2e')][_0xb2ce('0x3a')]){_0x35e002[_0xb2ce('0x38')]=_['merge'](_0x35e002[_0xb2ce('0x38')],{'$or':_[_0xb2ce('0x29')](_0x191ead,function(_0x2f8243){if(_0x2f8243[_0xb2ce('0x3b')]!=='VIRTUAL'){var _0x12b487={};_0x12b487[_0x2f8243[_0xb2ce('0x27')]]={'$like':'%'+_0x21e9e5[_0xb2ce('0x2e')]['filter']+'%'};return _0x12b487;}})});}_0x35e002=_[_0xb2ce('0x3c')]({},_0x35e002,_0x21e9e5[_0xb2ce('0x3d')]);var _0x57eef1={'where':_0x35e002['where']};return db[_0xb2ce('0x3e')][_0xb2ce('0x3f')](_0x57eef1)[_0xb2ce('0x23')](function(_0x3093e2){_0x4b4e89['count']=_0x3093e2;if(_0x21e9e5['query']['includeAll']){_0x35e002[_0xb2ce('0x40')]=[{'all':!![]}];}return db[_0xb2ce('0x3e')][_0xb2ce('0x41')](_0x35e002);})[_0xb2ce('0x23')](function(_0xdeb0bd){_0x4b4e89[_0xb2ce('0x42')]=_0xdeb0bd;return _0x4b4e89;})[_0xb2ce('0x23')](respondWithFilteredResult(_0x1fa5f7,_0x35e002))[_0xb2ce('0x43')](handleError(_0x1fa5f7,null));};exports['show']=function(_0x40f317,_0x38c053){var _0x4d7c86={'raw':!![],'where':{'id':_0x40f317[_0xb2ce('0x44')]['id']}},_0x5346b1={};_0x5346b1[_0xb2ce('0x2d')]=_[_0xb2ce('0x2f')](db[_0xb2ce('0x3e')][_0xb2ce('0x2a')]);_0x5346b1['query']=_[_0xb2ce('0x2f')](_0x40f317['query']);_0x5346b1[_0xb2ce('0x30')]=_['intersection'](_0x5346b1[_0xb2ce('0x2d')],_0x5346b1[_0xb2ce('0x2e')]);_0x4d7c86[_0xb2ce('0x32')]=_[_0xb2ce('0x31')](_0x5346b1[_0xb2ce('0x2d')],qs[_0xb2ce('0x33')](_0x40f317['query'][_0xb2ce('0x33')]));_0x4d7c86[_0xb2ce('0x32')]=_0x4d7c86[_0xb2ce('0x32')][_0xb2ce('0x45')]?_0x4d7c86[_0xb2ce('0x32')]:_0x5346b1[_0xb2ce('0x2d')];if(_0x40f317[_0xb2ce('0x2e')][_0xb2ce('0x46')]){_0x4d7c86[_0xb2ce('0x40')]=[{'all':!![]}];}_0x4d7c86=_[_0xb2ce('0x3c')]({},_0x4d7c86,_0x40f317['options']);return db[_0xb2ce('0x3e')][_0xb2ce('0x47')](_0x4d7c86)[_0xb2ce('0x23')](handleEntityNotFound(_0x38c053,null))[_0xb2ce('0x23')](respondWithResult(_0x38c053,null))[_0xb2ce('0x43')](handleError(_0x38c053,null));};exports[_0xb2ce('0x48')]=function(_0x3d20c7,_0x2dd17e){return db['ChatQueueReport'][_0xb2ce('0x48')](_0x3d20c7[_0xb2ce('0x49')],{})['then'](respondWithResult(_0x2dd17e,0xc9))[_0xb2ce('0x43')](handleError(_0x2dd17e,null));};exports['update']=function(_0x266e24,_0x1262c){if(_0x266e24['body']['id']){delete _0x266e24[_0xb2ce('0x49')]['id'];}return db[_0xb2ce('0x3e')][_0xb2ce('0x47')]({'where':{'id':_0x266e24[_0xb2ce('0x44')]['id']}})['then'](handleEntityNotFound(_0x1262c,null))['then'](saveUpdates(_0x266e24[_0xb2ce('0x49')],null))[_0xb2ce('0x23')](respondWithResult(_0x1262c,null))[_0xb2ce('0x43')](handleError(_0x1262c,null));};exports[_0xb2ce('0x24')]=function(_0x32f1e9,_0x33e585){return db['ChatQueueReport']['find']({'where':{'id':_0x32f1e9['params']['id']}})[_0xb2ce('0x23')](handleEntityNotFound(_0x33e585,null))[_0xb2ce('0x23')](removeEntity(_0x33e585,null))[_0xb2ce('0x43')](handleError(_0x33e585,null));};exports[_0xb2ce('0x4a')]=function(_0x1498d7,_0x18f161){return db[_0xb2ce('0x3e')][_0xb2ce('0x4a')]()['then'](respondWithResult(_0x18f161,null))[_0xb2ce('0x43')](handleError(_0x18f161,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index cb7f552..2a4c5e3 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 _0x0824=['rimraf','../../config/environment','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2cb742,_0x16184d){var _0x4e9847=function(_0x16ce9d){while(--_0x16ce9d){_0x2cb742['push'](_0x2cb742['shift']());}};_0x4e9847(++_0x16184d);}(_0x0824,0x173));var _0x4082=function(_0x291c85,_0x53b35a){_0x291c85=_0x291c85-0x0;var _0x42ad71=_0x0824[_0x291c85];return _0x42ad71;};'use strict';var _=require(_0x4082('0x0'));var util=require(_0x4082('0x1'));var logger=require(_0x4082('0x2'))(_0x4082('0x3'));var moment=require(_0x4082('0x4'));var BPromise=require('bluebird');var rp=require(_0x4082('0x5'));var fs=require('fs');var path=require(_0x4082('0x6'));var rimraf=require(_0x4082('0x7'));var config=require(_0x4082('0x8'));var attributes=require('./chatQueueReport.attributes');module[_0x4082('0x9')]=function(_0x17fd10,_0x303e12){return _0x17fd10[_0x4082('0xa')](_0x4082('0xb'),attributes,{'tableName':_0x4082('0xc'),'paranoid':![],'indexes':[{'name':_0x4082('0xd'),'fields':[_0x4082('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c11=['../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x46e723,_0x1abeee){var _0x2ce383=function(_0x34d3d3){while(--_0x34d3d3){_0x46e723['push'](_0x46e723['shift']());}};_0x2ce383(++_0x1abeee);}(_0x2c11,0x157));var _0x12c1=function(_0x463376,_0x13871c){_0x463376=_0x463376-0x0;var _0x336ccd=_0x2c11[_0x463376];return _0x336ccd;};'use strict';var _=require(_0x12c1('0x0'));var util=require(_0x12c1('0x1'));var logger=require(_0x12c1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x12c1('0x3'));var rp=require(_0x12c1('0x4'));var fs=require('fs');var path=require(_0x12c1('0x5'));var rimraf=require(_0x12c1('0x6'));var config=require(_0x12c1('0x7'));var attributes=require(_0x12c1('0x8'));module[_0x12c1('0x9')]=function(_0x31fd8a,_0x3d04f6){return _0x31fd8a[_0x12c1('0xa')](_0x12c1('0xb'),attributes,{'tableName':_0x12c1('0xc'),'paranoid':![],'indexes':[{'name':_0x12c1('0xd'),'fields':[_0x12c1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index dd3c210..57638da 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 _0xcd3b=['jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueueReport','create','options','raw','CreateChatQueueReport','UpdateChatQueueReport','update','body','where','attributes','limit','moment','../../mysqldb','../../config/logger','rpc'];(function(_0xaf304f,_0x2c988b){var _0x1971e5=function(_0x591c1e){while(--_0x591c1e){_0xaf304f['push'](_0xaf304f['shift']());}};_0x1971e5(++_0x2c988b);}(_0xcd3b,0x182));var _0xbcd3=function(_0x1c7e25,_0x56b06d){_0x1c7e25=_0x1c7e25-0x0;var _0x3a6482=_0xcd3b[_0x1c7e25];return _0x3a6482;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbcd3('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcd3('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcd3('0x2'))(_0xbcd3('0x3'));var config=require('../../config/environment');var jayson=require(_0xbcd3('0x4'));var client=jayson['client'][_0xbcd3('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x137c79,_0x204f9a,_0x5a818b){return new BPromise(function(_0x305485,_0x145189){return client[_0xbcd3('0x6')](_0x137c79,_0x5a818b)[_0xbcd3('0x7')](function(_0x472396){logger[_0xbcd3('0x8')](_0xbcd3('0x9'),_0x204f9a,_0xbcd3('0xa'));logger[_0xbcd3('0xb')](_0xbcd3('0xc'),_0x204f9a,_0xbcd3('0xa'),JSON[_0xbcd3('0xd')](_0x472396));if(_0x472396[_0xbcd3('0xe')]){if(_0x472396[_0xbcd3('0xe')][_0xbcd3('0xf')]===0x1f4){logger[_0xbcd3('0xe')](_0xbcd3('0x9'),_0x204f9a,_0x472396['error']['message']);return _0x145189(_0x472396[_0xbcd3('0xe')][_0xbcd3('0x10')]);}logger[_0xbcd3('0xe')](_0xbcd3('0x9'),_0x204f9a,_0x472396[_0xbcd3('0xe')]['message']);return _0x305485(_0x472396['error'][_0xbcd3('0x10')]);}else{logger[_0xbcd3('0x8')](_0xbcd3('0x9'),_0x204f9a,'request\x20sent');_0x305485(_0x472396[_0xbcd3('0x11')][_0xbcd3('0x10')]);}})[_0xbcd3('0x12')](function(_0x51089d){logger[_0xbcd3('0xe')](_0xbcd3('0x9'),_0x204f9a,_0x51089d);_0x145189(_0x51089d);});});}exports['CreateChatQueueReport']=function(_0x67241){var _0x57b05a=this;return new Promise(function(_0x24589d,_0x3e1407){return db[_0xbcd3('0x13')][_0xbcd3('0x14')](_0x67241['body'],{'raw':_0x67241[_0xbcd3('0x15')]?_0x67241['options'][_0xbcd3('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x41f995){logger[_0xbcd3('0x8')]('CreateChatQueueReport',_0x67241);logger[_0xbcd3('0xb')](_0xbcd3('0x17'),_0x67241,JSON[_0xbcd3('0xd')](_0x41f995));_0x24589d(_0x41f995);})[_0xbcd3('0x12')](function(_0x59016c){logger[_0xbcd3('0xe')](_0xbcd3('0x17'),_0x59016c['message'],_0x67241);_0x3e1407(_0x57b05a[_0xbcd3('0xe')](0x1f4,_0x59016c[_0xbcd3('0x10')]));});});};exports[_0xbcd3('0x18')]=function(_0x234605){var _0x51b761=this;return new Promise(function(_0x22df51,_0x554bea){return db[_0xbcd3('0x13')][_0xbcd3('0x19')](_0x234605[_0xbcd3('0x1a')],{'raw':_0x234605[_0xbcd3('0x15')]?_0x234605[_0xbcd3('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x234605[_0xbcd3('0x15')]?_0x234605['options'][_0xbcd3('0x1b')]||null:null,'attributes':_0x234605[_0xbcd3('0x15')]?_0x234605[_0xbcd3('0x15')][_0xbcd3('0x1c')]||null:null,'limit':_0x234605['options']?_0x234605['options'][_0xbcd3('0x1d')]||null:null})['then'](function(_0x512397){logger[_0xbcd3('0x8')](_0xbcd3('0x18'),_0x234605);logger[_0xbcd3('0xb')](_0xbcd3('0x18'),_0x234605,JSON['stringify'](_0x512397));_0x22df51(_0x512397);})[_0xbcd3('0x12')](function(_0x6ab71){logger[_0xbcd3('0xe')](_0xbcd3('0x18'),_0x6ab71[_0xbcd3('0x10')],_0x234605);_0x554bea(_0x51b761['error'](0x1f4,_0x6ab71[_0xbcd3('0x10')]));});});}; \ No newline at end of file +var _0x03fd=['message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1c2ead,_0x158636){var _0x2d9372=function(_0x40edcd){while(--_0x40edcd){_0x1c2ead['push'](_0x1c2ead['shift']());}};_0x2d9372(++_0x158636);}(_0x03fd,0x125));var _0xd03f=function(_0xd96766,_0x36b960){_0xd96766=_0xd96766-0x0;var _0x217bb3=_0x03fd[_0xd96766];return _0x217bb3;};'use strict';var _=require(_0xd03f('0x0'));var util=require(_0xd03f('0x1'));var moment=require(_0xd03f('0x2'));var BPromise=require(_0xd03f('0x3'));var rs=require(_0xd03f('0x4'));var fs=require('fs');var Redis=require(_0xd03f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd03f('0x6'));var logger=require(_0xd03f('0x7'))(_0xd03f('0x8'));var config=require(_0xd03f('0x9'));var jayson=require(_0xd03f('0xa'));var client=jayson[_0xd03f('0xb')][_0xd03f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d68bb,_0x8116c3,_0x4fc625){return new BPromise(function(_0x2e07a7,_0x570fdb){return client['request'](_0x1d68bb,_0x4fc625)[_0xd03f('0xd')](function(_0x1c5d41){logger[_0xd03f('0xe')](_0xd03f('0xf'),_0x8116c3,_0xd03f('0x10'));logger[_0xd03f('0x11')](_0xd03f('0x12'),_0x8116c3,'request\x20sent',JSON[_0xd03f('0x13')](_0x1c5d41));if(_0x1c5d41['error']){if(_0x1c5d41[_0xd03f('0x14')][_0xd03f('0x15')]===0x1f4){logger[_0xd03f('0x14')](_0xd03f('0xf'),_0x8116c3,_0x1c5d41['error'][_0xd03f('0x16')]);return _0x570fdb(_0x1c5d41[_0xd03f('0x14')][_0xd03f('0x16')]);}logger['error'](_0xd03f('0xf'),_0x8116c3,_0x1c5d41['error'][_0xd03f('0x16')]);return _0x2e07a7(_0x1c5d41[_0xd03f('0x14')][_0xd03f('0x16')]);}else{logger[_0xd03f('0xe')](_0xd03f('0xf'),_0x8116c3,'request\x20sent');_0x2e07a7(_0x1c5d41[_0xd03f('0x17')][_0xd03f('0x16')]);}})[_0xd03f('0x18')](function(_0x58d045){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x8116c3,_0x58d045);_0x570fdb(_0x58d045);});});}exports[_0xd03f('0x19')]=function(_0xc4334d){var _0x4dfbac=this;return new Promise(function(_0x5cae97,_0x4267a7){return db[_0xd03f('0x1a')][_0xd03f('0x1b')](_0xc4334d[_0xd03f('0x1c')],{'raw':_0xc4334d[_0xd03f('0x1d')]?_0xc4334d['options'][_0xd03f('0x1e')]===undefined?!![]:![]:!![]})[_0xd03f('0xd')](function(_0x450e6c){logger[_0xd03f('0xe')](_0xd03f('0x19'),_0xc4334d);logger[_0xd03f('0x11')](_0xd03f('0x19'),_0xc4334d,JSON[_0xd03f('0x13')](_0x450e6c));_0x5cae97(_0x450e6c);})[_0xd03f('0x18')](function(_0x5c8e95){logger[_0xd03f('0x14')](_0xd03f('0x19'),_0x5c8e95['message'],_0xc4334d);_0x4267a7(_0x4dfbac[_0xd03f('0x14')](0x1f4,_0x5c8e95[_0xd03f('0x16')]));});});};exports[_0xd03f('0x1f')]=function(_0x15ac63){var _0x5c1b8b=this;return new Promise(function(_0x3acae2,_0x1615b5){return db[_0xd03f('0x1a')][_0xd03f('0x20')](_0x15ac63['body'],{'raw':_0x15ac63['options']?_0x15ac63[_0xd03f('0x1d')][_0xd03f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15ac63[_0xd03f('0x1d')]?_0x15ac63[_0xd03f('0x1d')]['where']||null:null,'attributes':_0x15ac63['options']?_0x15ac63[_0xd03f('0x1d')][_0xd03f('0x21')]||null:null,'limit':_0x15ac63[_0xd03f('0x1d')]?_0x15ac63[_0xd03f('0x1d')][_0xd03f('0x22')]||null:null})['then'](function(_0x475eed){logger[_0xd03f('0xe')](_0xd03f('0x1f'),_0x15ac63);logger['debug'](_0xd03f('0x1f'),_0x15ac63,JSON[_0xd03f('0x13')](_0x475eed));_0x3acae2(_0x475eed);})[_0xd03f('0x18')](function(_0xa83708){logger[_0xd03f('0x14')]('UpdateChatQueueReport',_0xa83708['message'],_0x15ac63);_0x1615b5(_0x5c1b8b[_0xd03f('0x14')](0x1f4,_0xa83708[_0xd03f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 90c3832..a594046 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 _0x75a0=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x75a0,0xba));var _0x075a=function(_0x199bc4,_0x338105){_0x199bc4=_0x199bc4-0x0;var _0x136ffb=_0x75a0[_0x199bc4];return _0x136ffb;};'use strict';var multer=require(_0x075a('0x0'));var util=require(_0x075a('0x1'));var path=require(_0x075a('0x2'));var timeout=require(_0x075a('0x3'));var express=require(_0x075a('0x4'));var router=express[_0x075a('0x5')]();var auth=require(_0x075a('0x6'));var interaction=require(_0x075a('0x7'));var config=require(_0x075a('0x8'));var controller=require('./chatQueueReport.controller');router[_0x075a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x075a('0x9')](_0x075a('0xa'),auth['isAuthenticated'](),controller[_0x075a('0xb')]);router[_0x075a('0x9')](_0x075a('0xc'),auth['isAuthenticated'](),controller[_0x075a('0xd')]);router[_0x075a('0xe')]('/',auth[_0x075a('0xf')](),controller[_0x075a('0x10')]);router[_0x075a('0x11')](_0x075a('0xc'),auth['isAuthenticated'](),controller[_0x075a('0x12')]);router[_0x075a('0x13')]('/:id',auth[_0x075a('0xf')](),controller[_0x075a('0x14')]);module[_0x075a('0x15')]=router; \ No newline at end of file +var _0xdacc=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','create','update','delete'];(function(_0x47bb69,_0x1def0e){var _0x573182=function(_0x195689){while(--_0x195689){_0x47bb69['push'](_0x47bb69['shift']());}};_0x573182(++_0x1def0e);}(_0xdacc,0x17b));var _0xcdac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdacc[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xcdac('0x0'));var util=require('util');var path=require(_0xcdac('0x1'));var timeout=require('connect-timeout');var express=require(_0xcdac('0x2'));var router=express[_0xcdac('0x3')]();var auth=require(_0xcdac('0x4'));var interaction=require(_0xcdac('0x5'));var config=require(_0xcdac('0x6'));var controller=require(_0xcdac('0x7'));router[_0xcdac('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcdac('0x8')](_0xcdac('0x9'),auth[_0xcdac('0xa')](),controller[_0xcdac('0xb')]);router[_0xcdac('0x8')](_0xcdac('0xc'),auth['isAuthenticated'](),controller[_0xcdac('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcdac('0xe')]);router['put'](_0xcdac('0xc'),auth[_0xcdac('0xa')](),controller[_0xcdac('0xf')]);router[_0xcdac('0x10')](_0xcdac('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xcdac('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 92a1da3..7b64079 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 _0x9133=['ENUM','account','agent','queue','DATE','NOW','moment','exports','STRING'];(function(_0x577768,_0x30a3cb){var _0x21e47c=function(_0x19df86){while(--_0x19df86){_0x577768['push'](_0x577768['shift']());}};_0x21e47c(++_0x30a3cb);}(_0x9133,0x192));var _0x3913=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0x9133[_0x31a37b];return _0x49ae16;};'use strict';var moment=require(_0x3913('0x0'));var Sequelize=require('sequelize');module[_0x3913('0x1')]={'uniqueid':{'type':Sequelize[_0x3913('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3913('0x3')](_0x3913('0x4'),_0x3913('0x5'),'queue'),'allowNull':![],'defaultValue':_0x3913('0x6')},'transferredAt':{'type':Sequelize[_0x3913('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x3913('0x8')]}}; \ No newline at end of file +var _0xd75d=['queue','DATE','NOW','moment','exports','ENUM','account','agent'];(function(_0x5a636f,_0x3fec2b){var _0x6a8cfb=function(_0x20e6ca){while(--_0x20e6ca){_0x5a636f['push'](_0x5a636f['shift']());}};_0x6a8cfb(++_0x3fec2b);}(_0xd75d,0x123));var _0xdd75=function(_0x584b5f,_0x1b5f00){_0x584b5f=_0x584b5f-0x0;var _0x1c29c1=_0xd75d[_0x584b5f];return _0x1c29c1;};'use strict';var moment=require(_0xdd75('0x0'));var Sequelize=require('sequelize');module[_0xdd75('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xdd75('0x2')](_0xdd75('0x3'),_0xdd75('0x4'),_0xdd75('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xdd75('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xdd75('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 87e4bfe..4c8f73b 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 _0x15fa=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','catch','show','length','include','find','create','body','destroy','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x202ad6,_0x780e10){var _0x462eef=function(_0x396c97){while(--_0x396c97){_0x202ad6['push'](_0x202ad6['shift']());}};_0x462eef(++_0x780e10);}(_0x15fa,0xda));var _0xa15f=function(_0x5789e2,_0x225c4a){_0x5789e2=_0x5789e2-0x0;var _0x1bbeb8=_0x15fa[_0x5789e2];return _0x1bbeb8;};'use strict';var pdf=require(_0xa15f('0x0'));var emlformat=require(_0xa15f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa15f('0x2'));var jsonpatch=require(_0xa15f('0x3'));var rp=require(_0xa15f('0x4'));var moment=require('moment');var BPromise=require(_0xa15f('0x5'));var Mustache=require(_0xa15f('0x6'));var util=require(_0xa15f('0x7'));var path=require(_0xa15f('0x8'));var sox=require(_0xa15f('0x9'));var csv=require('to-csv');var ejs=require(_0xa15f('0xa'));var fs=require('fs');var _=require(_0xa15f('0xb'));var squel=require(_0xa15f('0xc'));var crypto=require(_0xa15f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa15f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa15f('0xf'));var Papa=require(_0xa15f('0x10'));var Redis=require(_0xa15f('0x11'));var authService=require(_0xa15f('0x12'));var qs=require(_0xa15f('0x13'));var as=require(_0xa15f('0x14'));var hardwareService=require(_0xa15f('0x15'));var logger=require(_0xa15f('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xa15f('0x17'));var licenseUtil=require(_0xa15f('0x18'));var db=require(_0xa15f('0x19'))['db'];function respondWithStatusCode(_0x37a422,_0x51832d){_0x51832d=_0x51832d||0xcc;return function(_0x24dd85){if(_0x24dd85){return _0x37a422[_0xa15f('0x1a')](_0x51832d);}return _0x37a422[_0xa15f('0x1b')](_0x51832d)['end']();};}function respondWithResult(_0xbb4fb0,_0x465550){_0x465550=_0x465550||0xc8;return function(_0x2081e3){if(_0x2081e3){return _0xbb4fb0[_0xa15f('0x1b')](_0x465550)[_0xa15f('0x1c')](_0x2081e3);}};}function respondWithFilteredResult(_0x4fac84,_0x290a02){return function(_0x5149f4){if(_0x5149f4){var _0x25930d=_0x5149f4[_0xa15f('0x1d')],_0x3c51b7=_0x290a02['offset'],_0x4b11a7=_0x290a02[_0xa15f('0x1e')]+_0x290a02[_0xa15f('0x1f')],_0x11d13f;if(_0x4b11a7>=_0x25930d){_0x4b11a7=_0x25930d;_0x11d13f=0xc8;}else{_0x11d13f=0xce;}_0x4fac84['status'](_0x11d13f);return _0x4fac84[_0xa15f('0x20')](_0xa15f('0x21'),_0x3c51b7+'-'+_0x4b11a7+'/'+_0x25930d)[_0xa15f('0x1c')](_0x5149f4);}return null;};}function patchUpdates(_0x369da6){return function(_0x5d0b55){try{jsonpatch[_0xa15f('0x22')](_0x5d0b55,_0x369da6,!![]);}catch(_0x9c309a){return BPromise[_0xa15f('0x23')](_0x9c309a);}return _0x5d0b55[_0xa15f('0x24')]();};}function saveUpdates(_0x1d0a14,_0x1863e3){return function(_0x38996c){if(_0x38996c){return _0x38996c[_0xa15f('0x25')](_0x1d0a14)[_0xa15f('0x26')](function(_0x269bbe){return _0x269bbe;});}return null;};}function removeEntity(_0xa5e868,_0xd079a4){return function(_0x54cef5){if(_0x54cef5){return _0x54cef5['destroy']()[_0xa15f('0x26')](function(){_0xa5e868['status'](0xcc)[_0xa15f('0x27')]();});}};}function handleEntityNotFound(_0xfb46c0,_0x18ba63){return function(_0x2d6ffa){if(!_0x2d6ffa){_0xfb46c0['sendStatus'](0x194);}return _0x2d6ffa;};}function handleError(_0x321616,_0x5e3480){_0x5e3480=_0x5e3480||0x1f4;return function(_0x5ad993){logger[_0xa15f('0x28')](_0x5ad993[_0xa15f('0x29')]);if(_0x5ad993[_0xa15f('0x2a')]){delete _0x5ad993[_0xa15f('0x2a')];}_0x321616[_0xa15f('0x1b')](_0x5e3480)[_0xa15f('0x2b')](_0x5ad993);};}exports['index']=function(_0x34ecf8,_0x10c259){var _0x4d6403={},_0x411089={},_0x3b270f={'count':0x0,'rows':[]};var _0x578987=_[_0xa15f('0x2c')](db[_0xa15f('0x2d')][_0xa15f('0x2e')],function(_0x333701){return{'name':_0x333701[_0xa15f('0x2f')],'type':_0x333701['type'][_0xa15f('0x30')]};});_0x411089[_0xa15f('0x31')]=_['map'](_0x578987,_0xa15f('0x2a'));_0x411089[_0xa15f('0x32')]=_[_0xa15f('0x33')](_0x34ecf8[_0xa15f('0x32')]);_0x411089[_0xa15f('0x34')]=_[_0xa15f('0x35')](_0x411089[_0xa15f('0x31')],_0x411089['query']);_0x4d6403[_0xa15f('0x36')]=_[_0xa15f('0x35')](_0x411089[_0xa15f('0x31')],qs[_0xa15f('0x37')](_0x34ecf8[_0xa15f('0x32')][_0xa15f('0x37')]));_0x4d6403['attributes']=_0x4d6403[_0xa15f('0x36')]['length']?_0x4d6403[_0xa15f('0x36')]:_0x411089['model'];if(!_0x34ecf8[_0xa15f('0x32')][_0xa15f('0x38')](_0xa15f('0x39'))){_0x4d6403[_0xa15f('0x1f')]=qs[_0xa15f('0x1f')](_0x34ecf8[_0xa15f('0x32')][_0xa15f('0x1f')]);_0x4d6403['offset']=qs[_0xa15f('0x1e')](_0x34ecf8['query']['offset']);}_0x4d6403[_0xa15f('0x3a')]=qs[_0xa15f('0x3b')](_0x34ecf8[_0xa15f('0x32')][_0xa15f('0x3b')]);_0x4d6403['where']=qs[_0xa15f('0x34')](_[_0xa15f('0x3c')](_0x34ecf8[_0xa15f('0x32')],_0x411089['filters']),_0x578987);if(_0x34ecf8[_0xa15f('0x32')][_0xa15f('0x3d')]){_0x4d6403[_0xa15f('0x3e')]=_['merge'](_0x4d6403[_0xa15f('0x3e')],{'$or':_['map'](_0x578987,function(_0xcf1303){if(_0xcf1303[_0xa15f('0x3f')]!==_0xa15f('0x40')){var _0x2e7339={};_0x2e7339[_0xcf1303['name']]={'$like':'%'+_0x34ecf8[_0xa15f('0x32')][_0xa15f('0x3d')]+'%'};return _0x2e7339;}})});}_0x4d6403=_[_0xa15f('0x41')]({},_0x4d6403,_0x34ecf8[_0xa15f('0x42')]);var _0x42309c={'where':_0x4d6403['where']};return db[_0xa15f('0x2d')][_0xa15f('0x1d')](_0x42309c)[_0xa15f('0x26')](function(_0x5075e9){_0x3b270f[_0xa15f('0x1d')]=_0x5075e9;if(_0x34ecf8[_0xa15f('0x32')][_0xa15f('0x43')]){_0x4d6403['include']=[{'all':!![]}];}return db[_0xa15f('0x2d')][_0xa15f('0x44')](_0x4d6403);})[_0xa15f('0x26')](function(_0x2ede41){_0x3b270f['rows']=_0x2ede41;return _0x3b270f;})[_0xa15f('0x26')](respondWithFilteredResult(_0x10c259,_0x4d6403))[_0xa15f('0x45')](handleError(_0x10c259,null));};exports[_0xa15f('0x46')]=function(_0x35ae3d,_0x7ef417){var _0x2dcf3f={'raw':!![],'where':{'id':_0x35ae3d['params']['id']}},_0x298a62={};_0x298a62[_0xa15f('0x31')]=_[_0xa15f('0x33')](db[_0xa15f('0x2d')][_0xa15f('0x2e')]);_0x298a62[_0xa15f('0x32')]=_['keys'](_0x35ae3d['query']);_0x298a62[_0xa15f('0x34')]=_[_0xa15f('0x35')](_0x298a62[_0xa15f('0x31')],_0x298a62[_0xa15f('0x32')]);_0x2dcf3f[_0xa15f('0x36')]=_[_0xa15f('0x35')](_0x298a62[_0xa15f('0x31')],qs[_0xa15f('0x37')](_0x35ae3d[_0xa15f('0x32')]['fields']));_0x2dcf3f[_0xa15f('0x36')]=_0x2dcf3f['attributes'][_0xa15f('0x47')]?_0x2dcf3f['attributes']:_0x298a62[_0xa15f('0x31')];if(_0x35ae3d['query'][_0xa15f('0x43')]){_0x2dcf3f[_0xa15f('0x48')]=[{'all':!![]}];}_0x2dcf3f=_['merge']({},_0x2dcf3f,_0x35ae3d[_0xa15f('0x42')]);return db['ChatTransferReport'][_0xa15f('0x49')](_0x2dcf3f)['then'](handleEntityNotFound(_0x7ef417,null))['then'](respondWithResult(_0x7ef417,null))[_0xa15f('0x45')](handleError(_0x7ef417,null));};exports['create']=function(_0xe59967,_0xd75cb0){return db[_0xa15f('0x2d')][_0xa15f('0x4a')](_0xe59967[_0xa15f('0x4b')],{})[_0xa15f('0x26')](respondWithResult(_0xd75cb0,0xc9))[_0xa15f('0x45')](handleError(_0xd75cb0,null));};exports[_0xa15f('0x25')]=function(_0x55821d,_0x46be92){if(_0x55821d['body']['id']){delete _0x55821d['body']['id'];}return db[_0xa15f('0x2d')]['find']({'where':{'id':_0x55821d['params']['id']}})[_0xa15f('0x26')](handleEntityNotFound(_0x46be92,null))[_0xa15f('0x26')](saveUpdates(_0x55821d[_0xa15f('0x4b')],null))[_0xa15f('0x26')](respondWithResult(_0x46be92,null))[_0xa15f('0x45')](handleError(_0x46be92,null));};exports[_0xa15f('0x4c')]=function(_0x39df4a,_0x19237c){return db[_0xa15f('0x2d')]['find']({'where':{'id':_0x39df4a[_0xa15f('0x4d')]['id']}})[_0xa15f('0x26')](handleEntityNotFound(_0x19237c,null))[_0xa15f('0x26')](removeEntity(_0x19237c,null))[_0xa15f('0x45')](handleError(_0x19237c,null));};exports[_0xa15f('0x4e')]=function(_0x5a9193,_0x3f6cfb){return db[_0xa15f('0x2d')][_0xa15f('0x4e')]()[_0xa15f('0x26')](respondWithResult(_0x3f6cfb,null))[_0xa15f('0x45')](handleError(_0x3f6cfb,null));}; \ No newline at end of file +var _0xcffa=['save','update','then','stack','name','send','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject'];(function(_0x263e6d,_0x585ebb){var _0xc8d72=function(_0x54afe4){while(--_0x54afe4){_0x263e6d['push'](_0x263e6d['shift']());}};_0xc8d72(++_0x585ebb);}(_0xcffa,0x1cd));var _0xacff=function(_0x4c5c1a,_0xf9d809){_0x4c5c1a=_0x4c5c1a-0x0;var _0xb7390b=_0xcffa[_0x4c5c1a];return _0xb7390b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xacff('0x0'));var zipdir=require(_0xacff('0x1'));var jsonpatch=require(_0xacff('0x2'));var rp=require('request-promise');var moment=require(_0xacff('0x3'));var BPromise=require(_0xacff('0x4'));var Mustache=require(_0xacff('0x5'));var util=require(_0xacff('0x6'));var path=require(_0xacff('0x7'));var sox=require('sox');var csv=require(_0xacff('0x8'));var ejs=require(_0xacff('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xacff('0xa'));var jsforce=require(_0xacff('0xb'));var deskjs=require(_0xacff('0xc'));var toCsv=require(_0xacff('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xacff('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacff('0xe'));var logger=require('../../config/logger')(_0xacff('0xf'));var utils=require(_0xacff('0x10'));var config=require(_0xacff('0x11'));var licenseUtil=require(_0xacff('0x12'));var db=require(_0xacff('0x13'))['db'];function respondWithStatusCode(_0x116f7c,_0x5ec858){_0x5ec858=_0x5ec858||0xcc;return function(_0x271c36){if(_0x271c36){return _0x116f7c[_0xacff('0x14')](_0x5ec858);}return _0x116f7c[_0xacff('0x15')](_0x5ec858)[_0xacff('0x16')]();};}function respondWithResult(_0x4c3f60,_0x292771){_0x292771=_0x292771||0xc8;return function(_0x31a95f){if(_0x31a95f){return _0x4c3f60[_0xacff('0x15')](_0x292771)['json'](_0x31a95f);}};}function respondWithFilteredResult(_0x42ff44,_0x29e1f9){return function(_0x5464a5){if(_0x5464a5){var _0x3a82ce=_0x5464a5[_0xacff('0x17')],_0xdd892d=_0x29e1f9['offset'],_0x11c73f=_0x29e1f9[_0xacff('0x18')]+_0x29e1f9[_0xacff('0x19')],_0x3b674d;if(_0x11c73f>=_0x3a82ce){_0x11c73f=_0x3a82ce;_0x3b674d=0xc8;}else{_0x3b674d=0xce;}_0x42ff44['status'](_0x3b674d);return _0x42ff44[_0xacff('0x1a')]('Content-Range',_0xdd892d+'-'+_0x11c73f+'/'+_0x3a82ce)[_0xacff('0x1b')](_0x5464a5);}return null;};}function patchUpdates(_0x10d619){return function(_0x3e84ce){try{jsonpatch['apply'](_0x3e84ce,_0x10d619,!![]);}catch(_0x21c854){return BPromise[_0xacff('0x1c')](_0x21c854);}return _0x3e84ce[_0xacff('0x1d')]();};}function saveUpdates(_0x358835,_0xabc927){return function(_0x5843a5){if(_0x5843a5){return _0x5843a5[_0xacff('0x1e')](_0x358835)[_0xacff('0x1f')](function(_0xc5208c){return _0xc5208c;});}return null;};}function removeEntity(_0x3811df,_0x2fbf07){return function(_0x43b0f3){if(_0x43b0f3){return _0x43b0f3['destroy']()[_0xacff('0x1f')](function(){_0x3811df[_0xacff('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15fe71,_0x255c76){return function(_0x23938d){if(!_0x23938d){_0x15fe71['sendStatus'](0x194);}return _0x23938d;};}function handleError(_0x28f2d0,_0x7c4c49){_0x7c4c49=_0x7c4c49||0x1f4;return function(_0x5d1f07){logger['error'](_0x5d1f07[_0xacff('0x20')]);if(_0x5d1f07[_0xacff('0x21')]){delete _0x5d1f07['name'];}_0x28f2d0[_0xacff('0x15')](_0x7c4c49)[_0xacff('0x22')](_0x5d1f07);};}exports['index']=function(_0x3620e2,_0x6808d0){var _0x240539={},_0x5f0fee={},_0x2e0e6b={'count':0x0,'rows':[]};var _0x526500=_['map'](db[_0xacff('0x23')][_0xacff('0x24')],function(_0x50149c){return{'name':_0x50149c[_0xacff('0x25')],'type':_0x50149c['type'][_0xacff('0x26')]};});_0x5f0fee[_0xacff('0x27')]=_['map'](_0x526500,_0xacff('0x21'));_0x5f0fee[_0xacff('0x28')]=_[_0xacff('0x29')](_0x3620e2[_0xacff('0x28')]);_0x5f0fee[_0xacff('0x2a')]=_['intersection'](_0x5f0fee[_0xacff('0x27')],_0x5f0fee[_0xacff('0x28')]);_0x240539[_0xacff('0x2b')]=_['intersection'](_0x5f0fee['model'],qs[_0xacff('0x2c')](_0x3620e2['query'][_0xacff('0x2c')]));_0x240539[_0xacff('0x2b')]=_0x240539[_0xacff('0x2b')][_0xacff('0x2d')]?_0x240539[_0xacff('0x2b')]:_0x5f0fee[_0xacff('0x27')];if(!_0x3620e2['query'][_0xacff('0x2e')](_0xacff('0x2f'))){_0x240539[_0xacff('0x19')]=qs[_0xacff('0x19')](_0x3620e2[_0xacff('0x28')]['limit']);_0x240539[_0xacff('0x18')]=qs[_0xacff('0x18')](_0x3620e2[_0xacff('0x28')][_0xacff('0x18')]);}_0x240539[_0xacff('0x30')]=qs[_0xacff('0x31')](_0x3620e2[_0xacff('0x28')][_0xacff('0x31')]);_0x240539['where']=qs[_0xacff('0x2a')](_[_0xacff('0x32')](_0x3620e2['query'],_0x5f0fee[_0xacff('0x2a')]),_0x526500);if(_0x3620e2[_0xacff('0x28')][_0xacff('0x33')]){_0x240539[_0xacff('0x34')]=_[_0xacff('0x35')](_0x240539[_0xacff('0x34')],{'$or':_[_0xacff('0x36')](_0x526500,function(_0x1e671d){if(_0x1e671d[_0xacff('0x37')]!=='VIRTUAL'){var _0x1a658f={};_0x1a658f[_0x1e671d[_0xacff('0x21')]]={'$like':'%'+_0x3620e2[_0xacff('0x28')][_0xacff('0x33')]+'%'};return _0x1a658f;}})});}_0x240539=_[_0xacff('0x35')]({},_0x240539,_0x3620e2[_0xacff('0x38')]);var _0x4f1547={'where':_0x240539[_0xacff('0x34')]};return db[_0xacff('0x23')][_0xacff('0x17')](_0x4f1547)[_0xacff('0x1f')](function(_0x42311e){_0x2e0e6b[_0xacff('0x17')]=_0x42311e;if(_0x3620e2[_0xacff('0x28')][_0xacff('0x39')]){_0x240539[_0xacff('0x3a')]=[{'all':!![]}];}return db[_0xacff('0x23')][_0xacff('0x3b')](_0x240539);})[_0xacff('0x1f')](function(_0x17ed5c){_0x2e0e6b[_0xacff('0x3c')]=_0x17ed5c;return _0x2e0e6b;})[_0xacff('0x1f')](respondWithFilteredResult(_0x6808d0,_0x240539))[_0xacff('0x3d')](handleError(_0x6808d0,null));};exports[_0xacff('0x3e')]=function(_0x4ed453,_0x395cee){var _0x560a73={'raw':!![],'where':{'id':_0x4ed453[_0xacff('0x3f')]['id']}},_0x33b971={};_0x33b971[_0xacff('0x27')]=_[_0xacff('0x29')](db[_0xacff('0x23')][_0xacff('0x24')]);_0x33b971['query']=_[_0xacff('0x29')](_0x4ed453[_0xacff('0x28')]);_0x33b971[_0xacff('0x2a')]=_[_0xacff('0x40')](_0x33b971['model'],_0x33b971[_0xacff('0x28')]);_0x560a73['attributes']=_['intersection'](_0x33b971[_0xacff('0x27')],qs[_0xacff('0x2c')](_0x4ed453[_0xacff('0x28')][_0xacff('0x2c')]));_0x560a73[_0xacff('0x2b')]=_0x560a73[_0xacff('0x2b')][_0xacff('0x2d')]?_0x560a73['attributes']:_0x33b971[_0xacff('0x27')];if(_0x4ed453[_0xacff('0x28')][_0xacff('0x39')]){_0x560a73['include']=[{'all':!![]}];}_0x560a73=_['merge']({},_0x560a73,_0x4ed453[_0xacff('0x38')]);return db[_0xacff('0x23')][_0xacff('0x41')](_0x560a73)[_0xacff('0x1f')](handleEntityNotFound(_0x395cee,null))[_0xacff('0x1f')](respondWithResult(_0x395cee,null))['catch'](handleError(_0x395cee,null));};exports[_0xacff('0x42')]=function(_0x1ce6ba,_0x358d31){return db[_0xacff('0x23')][_0xacff('0x42')](_0x1ce6ba[_0xacff('0x43')],{})['then'](respondWithResult(_0x358d31,0xc9))['catch'](handleError(_0x358d31,null));};exports[_0xacff('0x1e')]=function(_0x3f9b27,_0x3cc411){if(_0x3f9b27[_0xacff('0x43')]['id']){delete _0x3f9b27[_0xacff('0x43')]['id'];}return db['ChatTransferReport'][_0xacff('0x41')]({'where':{'id':_0x3f9b27[_0xacff('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3cc411,null))[_0xacff('0x1f')](saveUpdates(_0x3f9b27[_0xacff('0x43')],null))[_0xacff('0x1f')](respondWithResult(_0x3cc411,null))[_0xacff('0x3d')](handleError(_0x3cc411,null));};exports[_0xacff('0x44')]=function(_0x25b31a,_0x3dc67e){return db['ChatTransferReport'][_0xacff('0x41')]({'where':{'id':_0x25b31a[_0xacff('0x3f')]['id']}})[_0xacff('0x1f')](handleEntityNotFound(_0x3dc67e,null))[_0xacff('0x1f')](removeEntity(_0x3dc67e,null))[_0xacff('0x3d')](handleError(_0x3dc67e,null));};exports['describe']=function(_0x2bfae7,_0x480e79){return db['ChatTransferReport'][_0xacff('0x45')]()[_0xacff('0x1f')](respondWithResult(_0x480e79,null))[_0xacff('0x3d')](handleError(_0x480e79,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index fc00710..5c965d0 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 _0x78f1=['ChatTransferReport','report_chat_transfer','uniqueid','api','moment','bluebird','request-promise','path','exports'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x78f1,0xa5));var _0x178f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x78f1[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x178f('0x0'));var moment=require(_0x178f('0x1'));var BPromise=require(_0x178f('0x2'));var rp=require(_0x178f('0x3'));var fs=require('fs');var path=require(_0x178f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0x178f('0x5')]=function(_0x1672c9,_0x40401f){return _0x1672c9['define'](_0x178f('0x6'),attributes,{'tableName':_0x178f('0x7'),'paranoid':![],'indexes':[{'name':_0x178f('0x8'),'fields':[_0x178f('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3686=['ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./chatTransferReport.attributes','exports','define'];(function(_0x173f04,_0x219684){var _0x3888bf=function(_0x19bb45){while(--_0x19bb45){_0x173f04['push'](_0x173f04['shift']());}};_0x3888bf(++_0x219684);}(_0x3686,0xdf));var _0x6368=function(_0x264455,_0x38abaf){_0x264455=_0x264455-0x0;var _0x1cdded=_0x3686[_0x264455];return _0x1cdded;};'use strict';var _=require(_0x6368('0x0'));var util=require(_0x6368('0x1'));var logger=require(_0x6368('0x2'))(_0x6368('0x3'));var moment=require(_0x6368('0x4'));var BPromise=require(_0x6368('0x5'));var rp=require(_0x6368('0x6'));var fs=require('fs');var path=require(_0x6368('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6368('0x8'));module[_0x6368('0x9')]=function(_0x964655,_0xde4d67){return _0x964655[_0x6368('0xa')](_0x6368('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x6368('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e6ae41e..f7ee37f 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 _0xf189=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x2acfa9,_0x223bcc){var _0x399e0c=function(_0x5af8d5){while(--_0x5af8d5){_0x2acfa9['push'](_0x2acfa9['shift']());}};_0x399e0c(++_0x223bcc);}(_0xf189,0x10e));var _0x9f18=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf189[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x9f18('0x0'));var util=require(_0x9f18('0x1'));var moment=require('moment');var BPromise=require(_0x9f18('0x2'));var rs=require(_0x9f18('0x3'));var fs=require('fs');var Redis=require(_0x9f18('0x4'));var db=require(_0x9f18('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f18('0x6'))(_0x9f18('0x7'));var config=require(_0x9f18('0x8'));var jayson=require(_0x9f18('0x9'));var client=jayson['client'][_0x9f18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x263850,_0x52eab7,_0x4edb0f){return new BPromise(function(_0x5d52db,_0x3f1ac2){return client['request'](_0x263850,_0x4edb0f)[_0x9f18('0xb')](function(_0x10fa6c){logger[_0x9f18('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x52eab7,_0x9f18('0xd'));logger[_0x9f18('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x52eab7,'request\x20sent',JSON[_0x9f18('0xf')](_0x10fa6c));if(_0x10fa6c[_0x9f18('0x10')]){if(_0x10fa6c['error'][_0x9f18('0x11')]===0x1f4){logger[_0x9f18('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x52eab7,_0x10fa6c[_0x9f18('0x10')][_0x9f18('0x12')]);return _0x3f1ac2(_0x10fa6c[_0x9f18('0x10')][_0x9f18('0x12')]);}logger[_0x9f18('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x52eab7,_0x10fa6c[_0x9f18('0x10')]['message']);return _0x5d52db(_0x10fa6c[_0x9f18('0x10')]['message']);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x52eab7,_0x9f18('0xd'));_0x5d52db(_0x10fa6c[_0x9f18('0x13')][_0x9f18('0x12')]);}})[_0x9f18('0x14')](function(_0x337881){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x52eab7,_0x337881);_0x3f1ac2(_0x337881);});});} \ No newline at end of file +var _0x346c=['ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','ChatTransferReport,\x20%s,\x20%s','debug'];(function(_0x2782cc,_0x2425d6){var _0x491a26=function(_0x1c4e9e){while(--_0x1c4e9e){_0x2782cc['push'](_0x2782cc['shift']());}};_0x491a26(++_0x2425d6);}(_0x346c,0xaa));var _0xc346=function(_0x2dc646,_0x1b648f){_0x2dc646=_0x2dc646-0x0;var _0xab752d=_0x346c[_0x2dc646];return _0xab752d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc346('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc346('0x1'));var db=require(_0xc346('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc346('0x3'));var config=require('../../config/environment');var jayson=require(_0xc346('0x4'));var client=jayson[_0xc346('0x5')][_0xc346('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x51df69,_0x5c374d,_0x4250ca){return new BPromise(function(_0x540489,_0x1134ab){return client[_0xc346('0x7')](_0x51df69,_0x4250ca)['then'](function(_0x52bcb9){logger['info'](_0xc346('0x8'),_0x5c374d,'request\x20sent');logger[_0xc346('0x9')](_0xc346('0xa'),_0x5c374d,_0xc346('0xb'),JSON[_0xc346('0xc')](_0x52bcb9));if(_0x52bcb9[_0xc346('0xd')]){if(_0x52bcb9['error'][_0xc346('0xe')]===0x1f4){logger[_0xc346('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x5c374d,_0x52bcb9[_0xc346('0xd')]['message']);return _0x1134ab(_0x52bcb9[_0xc346('0xd')][_0xc346('0xf')]);}logger['error'](_0xc346('0x8'),_0x5c374d,_0x52bcb9['error'][_0xc346('0xf')]);return _0x540489(_0x52bcb9[_0xc346('0xd')][_0xc346('0xf')]);}else{logger['info'](_0xc346('0x8'),_0x5c374d,_0xc346('0xb'));_0x540489(_0x52bcb9[_0xc346('0x10')][_0xc346('0xf')]);}})[_0xc346('0x11')](function(_0x29a2bb){logger[_0xc346('0xd')](_0xc346('0x8'),_0x5c374d,_0x29a2bb);_0x1134ab(_0x29a2bb);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index c62d732..3eb6c10 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 _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x366e75,_0x533d1d){var _0x3b167b=function(_0x3e9f1d){while(--_0x3e9f1d){_0x366e75['push'](_0x366e75['shift']());}};_0x3b167b(++_0x533d1d);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f202e,_0x5ed293){_0x2f202e=_0x2f202e-0x0;var _0x398ac6=_0xb10b[_0x2f202e];return _0x398ac6;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f66[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 7d6d5a5..7014a84 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 _0x7676=['email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Feedback','star','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','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:','Skip','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x375e53,_0x344190){var _0x4f5484=function(_0x2e5348){while(--_0x2e5348){_0x375e53['push'](_0x375e53['shift']());}};_0x4f5484(++_0x344190);}(_0x7676,0xb8));var _0x6767=function(_0x28a4b3,_0x2399db){_0x28a4b3=_0x28a4b3-0x0;var _0x44f2d8=_0x7676[_0x28a4b3];return _0x44f2d8;};'use strict';var Sequelize=require(_0x6767('0x0'));var rs=require(_0x6767('0x1'));module[_0x6767('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x6767('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x6767('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0x4')},'key':{'type':Sequelize[_0x6767('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6767('0x5')},'customerAlias':{'type':Sequelize[_0x6767('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6767('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6767('0x3')],'allowNull':![],'defaultValue':_0x6767('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6767('0x3')],'allowNull':![],'defaultValue':_0x6767('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6767('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6767('0x3')]},'animation':{'type':Sequelize[_0x6767('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6767('0xa')](_0x6767('0xb'),_0x6767('0xc')),'defaultValue':_0x6767('0xb')},'header_online':{'type':Sequelize[_0x6767('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0xd')},'offline_chat_button':{'type':Sequelize[_0x6767('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x6767('0xe')},'download_transcript':{'type':Sequelize[_0x6767('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6767('0x10')]},'closingQuestion':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6767('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x6767('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0x12')},'placeholderMessage':{'type':Sequelize[_0x6767('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x6767('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x6767('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x6767('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0x13')},'ratingType':{'type':Sequelize['ENUM'](_0x6767('0x14'),'thumb'),'defaultValue':_0x6767('0x14')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x6767('0x15')]({'items':[{'type':_0x6767('0x16'),'variable':null,'config':{'placeholder':_0x6767('0x17'),'type':'text','required':!![]},'props':{'title':_0x6767('0x17'),'helpText':''}},{'type':_0x6767('0x16'),'props':{'title':_0x6767('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x6767('0x4'),'type':_0x6767('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6767('0x18')](_0x6767('0x19'))?JSON[_0x6767('0x1a')](this[_0x6767('0x18')](_0x6767('0x19'))):{};},'set':function(_0x2a0116){return this[_0x6767('0x1b')]('onlineForm',JSON[_0x6767('0x15')](_0x2a0116));}},'offlineForm':{'type':Sequelize[_0x6767('0x10')],'defaultValue':function(){return JSON[_0x6767('0x15')]({'items':[{'type':'input','props':{'title':_0x6767('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x6767('0x4'),'type':'email'},'variable':null},{'type':_0x6767('0x1c'),'config':{'placeholder':_0x6767('0x1d')},'props':{'title':_0x6767('0x1d'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x6767('0x18')](_0x6767('0x1e'))?JSON[_0x6767('0x1a')](this[_0x6767('0x18')]('offlineForm')):{};},'set':function(_0x6457af){return this[_0x6767('0x1b')](_0x6767('0x1e'),JSON['stringify'](_0x6457af));}},'token':{'type':Sequelize[_0x6767('0x3')],'defaultValue':function(){return rs[_0x6767('0x1f')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6767('0x3')]},'forwardOffline':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6767('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6767('0x20')},'waitingMessage':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0x21')},'offlineMessageSubject':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0x22')},'offlineMessageBody':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0x6767('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6767('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0x24')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x6767('0x25')},'enableCustomerAttachment':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6767('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6767('0x26');}},'notificationSound':{'type':Sequelize[_0x6767('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0x27')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0x28')},'verticalAlignment':{'type':Sequelize[_0x6767('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0x29')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x6767('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6767('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6767('0x3')],'allowNull':![],'defaultValue':_0x6767('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6767('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6767('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6767('0x3')],'defaultValue':_0x6767('0x2b')},'systemAvatar':{'type':Sequelize[_0x6767('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6767('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6767('0x2c'),'set':function(_0x519ca9){if(!_0x519ca9)this[_0x6767('0x1b')](_0x6767('0x2d'),null);this[_0x6767('0x1b')](_0x6767('0x2e'),_0x519ca9);}},'vidaooEscalation':{'type':Sequelize[_0x6767('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6767('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5e17=['onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','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}}','website_alias','bottom_right','alternate','#fafafa','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','email','Agent','#011F6A','#ffffff','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Feedback','ENUM','star','thumb','INTEGER','stringify','input','name','getDataValue'];(function(_0x2c3cbe,_0x38d521){var _0x27cd26=function(_0xdf5d14){while(--_0xdf5d14){_0x2c3cbe['push'](_0x2c3cbe['shift']());}};_0x27cd26(++_0x38d521);}(_0x5e17,0x17a));var _0x75e1=function(_0x8a9c26,_0x18bfe9){_0x8a9c26=_0x8a9c26-0x0;var _0x3f8a0e=_0x5e17[_0x8a9c26];return _0x3f8a0e;};'use strict';var Sequelize=require(_0x75e1('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x75e1('0x1')]},'mapKey':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x2')},'mapKeyOffline':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x2')},'key':{'type':Sequelize[_0x75e1('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x3')},'customerAlias':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x75e1('0x1')],'allowNull':![],'defaultValue':_0x75e1('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x75e1('0x1')],'allowNull':![],'defaultValue':_0x75e1('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x75e1('0x1')],'allowNull':![],'defaultValue':_0x75e1('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x75e1('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x75e1('0x6'),_0x75e1('0x7')),'defaultValue':_0x75e1('0x6')},'header_online':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x8')},'start_chat_button':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x9')},'offline_chat_button':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0xa')},'download_transcript':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0xc')},'defaultWhiteLabel':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x75e1('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x75e1('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x10')},'noteTitle':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x75e1('0x12')},'closingMessage':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x75e1('0x14')},'skipMessageButton':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x15')},'ratingType':{'type':Sequelize[_0x75e1('0x16')](_0x75e1('0x17'),_0x75e1('0x18')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x75e1('0x19')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x75e1('0x1a')]({'items':[{'type':_0x75e1('0x1b'),'variable':null,'config':{'placeholder':_0x75e1('0x1c'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x75e1('0x1b'),'props':{'title':_0x75e1('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x75e1('0x2'),'type':_0x75e1('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x75e1('0x1d')](_0x75e1('0x1e'))?JSON[_0x75e1('0x1f')](this['getDataValue'](_0x75e1('0x1e'))):{};},'set':function(_0x23c9d0){return this[_0x75e1('0x20')](_0x75e1('0x1e'),JSON[_0x75e1('0x1a')](_0x23c9d0));}},'offlineForm':{'type':Sequelize[_0x75e1('0xd')],'defaultValue':function(){return JSON[_0x75e1('0x1a')]({'items':[{'type':_0x75e1('0x1b'),'props':{'title':_0x75e1('0x2'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x75e1('0x2')},'variable':null},{'type':_0x75e1('0x21'),'config':{'placeholder':_0x75e1('0x22')},'props':{'title':'Comments','helpText':_0x75e1('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x75e1('0x1f')](this[_0x75e1('0x1d')](_0x75e1('0x24'))):{};},'set':function(_0x366ae8){return this[_0x75e1('0x20')]('offlineForm',JSON[_0x75e1('0x1a')](_0x366ae8));}},'token':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':function(){return rs[_0x75e1('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x75e1('0x1')]},'waitingTitle':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x26')},'waitingMessage':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x75e1('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x29')},'skipUnmanaged':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x2a')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x75e1('0x14')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x75e1('0xd')]},'showAgentAvatar':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x75e1('0x1')]},'notificationTemplate':{'type':Sequelize[_0x75e1('0xd')],'defaultValue':function(){return _0x75e1('0x2b');}},'notificationSound':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x75e1('0x19')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x2d')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':_0x75e1('0x2e')},'defaultTitle':{'type':Sequelize[_0x75e1('0x1')]},'customerAvatar':{'type':Sequelize[_0x75e1('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x75e1('0x19')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x75e1('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x75e1('0x19')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x75e1('0x19')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x75e1('0xd')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x75e1('0x19')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![],'comment':_0x75e1('0x30'),'set':function(_0x5dcb7b){if(!_0x5dcb7b)this[_0x75e1('0x20')](_0x75e1('0x31'),null);this[_0x75e1('0x20')](_0x75e1('0x32'),_0x5dcb7b);}},'vidaooEscalation':{'type':Sequelize[_0x75e1('0xb')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x75e1('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 18ae59d..3286e5b 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 _0x98ab=['device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','UserId','User','agent','forcedOwnership','startRouting','Start','offline','send','from\x20is\x20mandatory','mapKeyOffline','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','getInteractions','Contact','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','virtual','custom','License','increment','chatLicenseExceeded','some','readFileSync','server/files/chat/iframe.js','remote','remoteAddress','alignment','textColor','addApplications','transaction','ChatApplication','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','redis','localhost','socket.io-emitter','client','http','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','status','end','offset','limit','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','stack','name','index','Pause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','join','server/files/images/logos/default_logo.svg','getLicense','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','account','applications','Applications','list','orderBy','asc','Contacts','defaults','ListId','contact','cf-connecting-ip','first','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown'];(function(_0x4a422f,_0x153c3c){var _0x46c27d=function(_0x406604){while(--_0x406604){_0x4a422f['push'](_0x4a422f['shift']());}};_0x46c27d(++_0x153c3c);}(_0x98ab,0x188));var _0xb98a=function(_0x456582,_0x16ced0){_0x456582=_0x456582-0x0;var _0x4aad5e=_0x98ab[_0x456582];return _0x4aad5e;};'use strict';var pdf=require(_0xb98a('0x0'));var emlformat=require(_0xb98a('0x1'));var rimraf=require(_0xb98a('0x2'));var zipdir=require(_0xb98a('0x3'));var jsonpatch=require(_0xb98a('0x4'));var rp=require(_0xb98a('0x5'));var moment=require(_0xb98a('0x6'));var BPromise=require(_0xb98a('0x7'));var Mustache=require(_0xb98a('0x8'));var util=require('util');var path=require(_0xb98a('0x9'));var sox=require(_0xb98a('0xa'));var csv=require(_0xb98a('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb98a('0xc'));var squel=require(_0xb98a('0xd'));var crypto=require(_0xb98a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb98a('0xf'));var toCsv=require(_0xb98a('0xb'));var querystring=require(_0xb98a('0x10'));var Papa=require(_0xb98a('0x11'));var Redis=require(_0xb98a('0x12'));var authService=require(_0xb98a('0x13'));var qs=require(_0xb98a('0x14'));var as=require(_0xb98a('0x15'));var hardwareService=require(_0xb98a('0x16'));var logger=require(_0xb98a('0x17'))(_0xb98a('0x18'));var utils=require(_0xb98a('0x19'));var config=require(_0xb98a('0x1a'));var licenseUtil=require(_0xb98a('0x1b'));var db=require(_0xb98a('0x1c'))['db'];config[_0xb98a('0x1d')]=_['defaults'](config['redis'],{'host':_0xb98a('0x1e'),'port':0x18eb});var socket=require(_0xb98a('0x1f'))(new Redis(config[_0xb98a('0x1d')]));require('./chatWebsite.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xb98a('0x20')][_0xb98a('0x21')]({'port':0x232c});var client9002=jayson[_0xb98a('0x20')][_0xb98a('0x21')]({'port':0x232a});var client9003=jayson[_0xb98a('0x20')][_0xb98a('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x3a6c44,_0x36f67f,_0xfde292,_0x1d1223){return new BPromise(function(_0x33e56,_0xf379e4){var _0x483447=_0x1d1223||client;return _0x483447[_0xb98a('0x22')](_0x3a6c44,_0xfde292)[_0xb98a('0x23')](function(_0x105275){logger['info'](_0xb98a('0x24'),_0x36f67f,'request\x20sent');logger[_0xb98a('0x25')](_0xb98a('0x26'),_0x36f67f,_0xb98a('0x27'),JSON[_0xb98a('0x28')](_0x105275));if(_0x105275[_0xb98a('0x29')]){if(_0x105275['error'][_0xb98a('0x2a')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x36f67f,_0x105275[_0xb98a('0x29')][_0xb98a('0x2b')]);return _0xf379e4(_0x105275[_0xb98a('0x29')]['message']);}logger[_0xb98a('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x36f67f,_0x105275['error']['message']);return _0x33e56(_0x105275[_0xb98a('0x29')]['message']);}else{logger[_0xb98a('0x2c')](_0xb98a('0x24'),_0x36f67f,_0xb98a('0x27'));_0x33e56(_0x105275[_0xb98a('0x2d')][_0xb98a('0x2b')]);}})[_0xb98a('0x2e')](function(_0xf44303){logger[_0xb98a('0x29')](_0xb98a('0x24'),_0x36f67f,_0xf44303);_0xf379e4(_0xf44303);});});}function respondWithStatusCode(_0x1cdce5,_0x49618c){_0x49618c=_0x49618c||0xcc;return function(_0x428437){if(_0x428437){return _0x1cdce5['sendStatus'](_0x49618c);}return _0x1cdce5[_0xb98a('0x2f')](_0x49618c)[_0xb98a('0x30')]();};}function respondWithResult(_0x10ebea,_0x1d03e0){_0x1d03e0=_0x1d03e0||0xc8;return function(_0x1663d4){if(_0x1663d4){return _0x10ebea[_0xb98a('0x2f')](_0x1d03e0)['json'](_0x1663d4);}};}function respondWithFilteredResult(_0x2a88d3,_0x3e8200){return function(_0x475276){if(_0x475276){var _0x418f9e=_0x475276['count'],_0x3a705a=_0x3e8200[_0xb98a('0x31')],_0x447f5d=_0x3e8200[_0xb98a('0x31')]+_0x3e8200[_0xb98a('0x32')],_0x5695c2;if(_0x447f5d>=_0x418f9e){_0x447f5d=_0x418f9e;_0x5695c2=0xc8;}else{_0x5695c2=0xce;}_0x2a88d3[_0xb98a('0x2f')](_0x5695c2);return _0x2a88d3[_0xb98a('0x33')](_0xb98a('0x34'),_0x3a705a+'-'+_0x447f5d+'/'+_0x418f9e)['json'](_0x475276);}return null;};}function patchUpdates(_0xe8aa2e){return function(_0x159ce5){try{jsonpatch[_0xb98a('0x35')](_0x159ce5,_0xe8aa2e,!![]);}catch(_0x2cad84){return BPromise[_0xb98a('0x36')](_0x2cad84);}return _0x159ce5['save']();};}function saveUpdates(_0x2e1de1,_0x54241f){return function(_0x400535){if(_0x400535){return _0x400535[_0xb98a('0x37')](_0x2e1de1)[_0xb98a('0x23')](function(_0x1e6979){return _0x1e6979;});}return null;};}function removeEntity(_0x5f51aa,_0x47e985){return function(_0x5c3003){if(_0x5c3003){return _0x5c3003[_0xb98a('0x38')]()['then'](function(){var _0xb8ff52=_0x5c3003[_0xb98a('0x39')]({'plain':!![]});var _0xadd2ac='ChatWebsites';return db[_0xb98a('0x3a')]['destroy']({'where':{'type':_0xadd2ac,'resourceId':_0xb8ff52['id']}})[_0xb98a('0x23')](function(){return _0x5c3003;});})[_0xb98a('0x23')](function(){_0x5f51aa[_0xb98a('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x154fe3,_0x57da69){return function(_0x479b86){if(!_0x479b86){_0x154fe3['sendStatus'](0x194);}return _0x479b86;};}function handleError(_0x44beb6,_0x194c56){_0x194c56=_0x194c56||0x1f4;return function(_0x3e90f6){logger[_0xb98a('0x29')](_0x3e90f6[_0xb98a('0x3b')]);if(_0x3e90f6[_0xb98a('0x3c')]){delete _0x3e90f6[_0xb98a('0x3c')];}_0x44beb6[_0xb98a('0x2f')](_0x194c56)['send'](_0x3e90f6);};}exports[_0xb98a('0x3d')]=function(_0x16ab21,_0x295232){var _0x37becb={'include':[{'model':db[_0xb98a('0x3e')],'as':'mandatoryDispositionPause'}]},_0x54eb3c={},_0x37ff90={'count':0x0,'rows':[]};var _0x3d1e3e=_[_0xb98a('0x3f')](db[_0xb98a('0x40')][_0xb98a('0x41')],function(_0x28c60c){return{'name':_0x28c60c[_0xb98a('0x42')],'type':_0x28c60c['type'][_0xb98a('0x43')]};});_0x54eb3c[_0xb98a('0x44')]=_[_0xb98a('0x3f')](_0x3d1e3e,_0xb98a('0x3c'));_0x54eb3c[_0xb98a('0x45')]=_[_0xb98a('0x46')](_0x16ab21[_0xb98a('0x45')]);_0x54eb3c[_0xb98a('0x47')]=_[_0xb98a('0x48')](_0x54eb3c['model'],_0x54eb3c['query']);_0x37becb[_0xb98a('0x49')]=_[_0xb98a('0x48')](_0x54eb3c['model'],qs[_0xb98a('0x4a')](_0x16ab21[_0xb98a('0x45')]['fields']));_0x37becb[_0xb98a('0x49')]=_0x37becb['attributes'][_0xb98a('0x4b')]?_0x37becb['attributes']:_0x54eb3c[_0xb98a('0x44')];if(!_0x16ab21[_0xb98a('0x45')]['hasOwnProperty']('nolimit')){_0x37becb[_0xb98a('0x32')]=qs[_0xb98a('0x32')](_0x16ab21['query']['limit']);_0x37becb[_0xb98a('0x31')]=qs[_0xb98a('0x31')](_0x16ab21[_0xb98a('0x45')]['offset']);}_0x37becb[_0xb98a('0x4c')]=qs[_0xb98a('0x4d')](_0x16ab21[_0xb98a('0x45')][_0xb98a('0x4d')]);_0x37becb[_0xb98a('0x4e')]=qs[_0xb98a('0x47')](_[_0xb98a('0x4f')](_0x16ab21[_0xb98a('0x45')],_0x54eb3c['filters']),_0x3d1e3e);if(_0x16ab21['query'][_0xb98a('0x50')]){_0x37becb[_0xb98a('0x4e')]=_[_0xb98a('0x51')](_0x37becb[_0xb98a('0x4e')],{'$or':_[_0xb98a('0x3f')](_0x3d1e3e,function(_0x3ca81a){if(_0x3ca81a[_0xb98a('0x52')]!==_0xb98a('0x53')){var _0x288c1c={};_0x288c1c[_0x3ca81a[_0xb98a('0x3c')]]={'$like':'%'+_0x16ab21['query'][_0xb98a('0x50')]+'%'};return _0x288c1c;}})});}_0x37becb=_[_0xb98a('0x51')]({},_0x37becb,_0x16ab21[_0xb98a('0x54')]);var _0x340fd6={'where':_0x37becb['where']};return db['ChatWebsite'][_0xb98a('0x55')](_0x340fd6)['then'](function(_0x33ff5b){_0x37ff90[_0xb98a('0x55')]=_0x33ff5b;if(_0x16ab21[_0xb98a('0x45')][_0xb98a('0x56')]){_0x37becb[_0xb98a('0x57')]=[{'all':!![]}];}return db[_0xb98a('0x40')][_0xb98a('0x58')](_0x37becb);})[_0xb98a('0x23')](function(_0x3ac0ba){_0x37ff90[_0xb98a('0x59')]=_0x3ac0ba;return _0x37ff90;})[_0xb98a('0x23')](respondWithFilteredResult(_0x295232,_0x37becb))['catch'](handleError(_0x295232,null));};exports[_0xb98a('0x5a')]=function(_0x48ed83,_0x162287){var _0x39d8ae={'raw':![],'where':{'id':_0x48ed83[_0xb98a('0x5b')]['id']},'include':[{'model':db[_0xb98a('0x3e')],'as':'mandatoryDispositionPause'}]},_0x2e2060={};_0x2e2060[_0xb98a('0x44')]=_[_0xb98a('0x46')](db[_0xb98a('0x40')][_0xb98a('0x41')]);_0x2e2060[_0xb98a('0x45')]=_['keys'](_0x48ed83[_0xb98a('0x45')]);_0x2e2060[_0xb98a('0x47')]=_[_0xb98a('0x48')](_0x2e2060[_0xb98a('0x44')],_0x2e2060[_0xb98a('0x45')]);_0x39d8ae[_0xb98a('0x49')]=_[_0xb98a('0x48')](_0x2e2060[_0xb98a('0x44')],qs[_0xb98a('0x4a')](_0x48ed83['query'][_0xb98a('0x4a')]));_0x39d8ae[_0xb98a('0x49')]=_0x39d8ae[_0xb98a('0x49')]['length']?_0x39d8ae[_0xb98a('0x49')]:_0x2e2060[_0xb98a('0x44')];if(_0x48ed83[_0xb98a('0x45')][_0xb98a('0x56')]){_0x39d8ae['include']=[{'all':!![]}];}_0x39d8ae=_[_0xb98a('0x51')]({},_0x39d8ae,_0x48ed83[_0xb98a('0x54')]);return db[_0xb98a('0x40')][_0xb98a('0x5c')](_0x39d8ae)[_0xb98a('0x23')](handleEntityNotFound(_0x162287,null))[_0xb98a('0x23')](respondWithResult(_0x162287,null))[_0xb98a('0x2e')](handleError(_0x162287,null));};exports[_0xb98a('0x5d')]=function(_0x18e05e,_0x263bf7){return db[_0xb98a('0x40')][_0xb98a('0x5d')](_0x18e05e['body'],{})[_0xb98a('0x23')](function(_0x410690){var _0x52ea28=_0x18e05e[_0xb98a('0x5e')]['get']({'plain':!![]});if(!_0x52ea28)throw new Error(_0xb98a('0x5f'));if(_0x52ea28['role']===_0xb98a('0x5e')){var _0x36285b=_0x410690[_0xb98a('0x39')]({'plain':!![]});var _0x19ebca=_0xb98a('0x60');return db[_0xb98a('0x61')][_0xb98a('0x5c')]({'where':{'name':_0x19ebca,'userProfileId':_0x52ea28[_0xb98a('0x62')]},'raw':!![]})[_0xb98a('0x23')](function(_0xbd7320){if(_0xbd7320&&_0xbd7320[_0xb98a('0x63')]===0x0){return db['UserProfileResource'][_0xb98a('0x5d')]({'name':_0x36285b[_0xb98a('0x3c')],'resourceId':_0x36285b['id'],'type':_0xbd7320['name'],'sectionId':_0xbd7320['id']},{})[_0xb98a('0x23')](function(){return _0x410690;});}else{return _0x410690;}})['catch'](function(_0x4212ea){logger[_0xb98a('0x29')](_0xb98a('0x64'),_0x4212ea);throw _0x4212ea;});}return _0x410690;})[_0xb98a('0x23')](respondWithResult(_0x263bf7,0xc9))['catch'](handleError(_0x263bf7,null));};exports[_0xb98a('0x37')]=function(_0x2010ea,_0x5ea97e){if(_0x2010ea[_0xb98a('0x65')]['id']){delete _0x2010ea[_0xb98a('0x65')]['id'];}return db[_0xb98a('0x40')]['find']({'where':{'id':_0x2010ea[_0xb98a('0x5b')]['id']},'include':[{'model':db[_0xb98a('0x3e')],'as':_0xb98a('0x66')}]})[_0xb98a('0x23')](handleEntityNotFound(_0x5ea97e,null))[_0xb98a('0x23')](saveUpdates(_0x2010ea[_0xb98a('0x65')],null))[_0xb98a('0x23')](respondWithResult(_0x5ea97e,null))[_0xb98a('0x2e')](handleError(_0x5ea97e,null));};exports['destroy']=function(_0x22331e,_0x497c74){return db[_0xb98a('0x40')][_0xb98a('0x5c')]({'where':{'id':_0x22331e[_0xb98a('0x5b')]['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x497c74,null))[_0xb98a('0x23')](removeEntity(_0x497c74,null))[_0xb98a('0x2e')](handleError(_0x497c74,null));};exports[_0xb98a('0x67')]=function(_0xf590ed,_0x55d618){return db[_0xb98a('0x40')][_0xb98a('0x67')]()[_0xb98a('0x23')](respondWithResult(_0x55d618,null))[_0xb98a('0x2e')](handleError(_0x55d618,null));};exports[_0xb98a('0x68')]=function(_0x191122,_0x3d0897,_0x43769d){if(_0x191122[_0xb98a('0x65')]['id']){delete _0x191122[_0xb98a('0x65')]['id'];}return db[_0xb98a('0x40')][_0xb98a('0x5c')]({'where':{'id':_0x191122[_0xb98a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3d0897,null))[_0xb98a('0x23')](function(_0x560d32){if(_0x560d32){_0x191122['body'][_0xb98a('0x69')]=_0x560d32['id'];return db[_0xb98a('0x6a')]['create'](_0x191122[_0xb98a('0x65')]);}})[_0xb98a('0x23')](respondWithResult(_0x3d0897,null))[_0xb98a('0x2e')](handleError(_0x3d0897,null));};exports[_0xb98a('0x6b')]=function(_0x51d242,_0x27e140,_0x5e3500){var _0x1f313a={'raw':![],'where':{}};var _0x31e90b={};var _0x8784dd={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb98a('0x6c')]({'where':{'id':_0x51d242[_0xb98a('0x5b')]['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x27e140,null))[_0xb98a('0x23')](function(_0x785b1f){if(_0x785b1f){_0x31e90b[_0xb98a('0x44')]=_[_0xb98a('0x46')](db[_0xb98a('0x6a')]['rawAttributes']);_0x31e90b[_0xb98a('0x45')]=_[_0xb98a('0x46')](_0x51d242['query']);_0x31e90b[_0xb98a('0x47')]=_[_0xb98a('0x48')](_0x31e90b[_0xb98a('0x44')],_0x31e90b[_0xb98a('0x45')]);_0x1f313a['attributes']=_[_0xb98a('0x48')](_0x31e90b[_0xb98a('0x44')],qs['fields'](_0x51d242[_0xb98a('0x45')]['fields']));_0x1f313a[_0xb98a('0x49')]=_0x1f313a[_0xb98a('0x49')][_0xb98a('0x4b')]?_0x1f313a['attributes']:_0x31e90b[_0xb98a('0x44')];if(!_0x51d242[_0xb98a('0x45')][_0xb98a('0x6d')](_0xb98a('0x6e'))){_0x1f313a[_0xb98a('0x32')]=qs[_0xb98a('0x32')](_0x51d242['query']['limit']);_0x1f313a[_0xb98a('0x31')]=qs[_0xb98a('0x31')](_0x51d242['query']['offset']);}_0x1f313a[_0xb98a('0x4c')]=qs[_0xb98a('0x4d')](_0x51d242[_0xb98a('0x45')]['sort']);_0x1f313a[_0xb98a('0x4e')]=qs[_0xb98a('0x47')](_[_0xb98a('0x4f')](_0x51d242['query'],_0x31e90b['filters']));_0x1f313a[_0xb98a('0x4e')][_0xb98a('0x69')]=_0x785b1f['id'];if(_0x51d242['query']['filter']){_0x1f313a['where']=_[_0xb98a('0x51')](_0x1f313a['where'],{'$or':_[_0xb98a('0x3f')](_0x1f313a[_0xb98a('0x49')],function(_0xaddd6a){var _0xad605a={};_0xad605a[_0xaddd6a]={'$like':'%'+_0x51d242[_0xb98a('0x45')][_0xb98a('0x50')]+'%'};return _0xad605a;})});}_0x1f313a=_[_0xb98a('0x51')]({},_0x1f313a,_0x51d242[_0xb98a('0x54')]);return db[_0xb98a('0x6a')][_0xb98a('0x55')]({'where':_0x1f313a['where']})[_0xb98a('0x23')](function(_0x1d261f){_0x8784dd[_0xb98a('0x55')]=_0x1d261f;if(_0x51d242['query'][_0xb98a('0x56')]){_0x1f313a[_0xb98a('0x57')]=[{'all':!![]}];}return db['Disposition'][_0xb98a('0x58')](_0x1f313a);})[_0xb98a('0x23')](function(_0x317e14){_0x8784dd[_0xb98a('0x59')]=_0x317e14;return _0x8784dd;});}})[_0xb98a('0x23')](respondWithFilteredResult(_0x27e140,_0x1f313a))[_0xb98a('0x2e')](handleError(_0x27e140,null));};exports[_0xb98a('0x6f')]=function(_0x25d75a,_0x4b3937,_0x1de5f4){return db[_0xb98a('0x40')][_0xb98a('0x5c')]({'where':{'id':_0x25d75a[_0xb98a('0x5b')]['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x4b3937,null))[_0xb98a('0x23')](function(_0xe4cbb6){if(_0xe4cbb6){return _0xe4cbb6[_0xb98a('0x6f')](_0x25d75a[_0xb98a('0x45')][_0xb98a('0x70')]);}})[_0xb98a('0x23')](respondWithStatusCode(_0x4b3937,null))[_0xb98a('0x2e')](handleError(_0x4b3937,null));};exports[_0xb98a('0x71')]=function(_0x4d8537,_0x54f6d3,_0x518762){if(_0x4d8537[_0xb98a('0x65')]['id']){delete _0x4d8537[_0xb98a('0x65')]['id'];}return db['ChatWebsite'][_0xb98a('0x5c')]({'where':{'id':_0x4d8537[_0xb98a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x54f6d3,null))[_0xb98a('0x23')](function(_0x524fc2){if(_0x524fc2){_0x4d8537[_0xb98a('0x65')]['ChatWebsiteId']=_0x524fc2['id'];return db[_0xb98a('0x72')][_0xb98a('0x5d')](_0x4d8537[_0xb98a('0x65')]);}})[_0xb98a('0x23')](respondWithResult(_0x54f6d3,null))[_0xb98a('0x2e')](handleError(_0x54f6d3,null));};exports[_0xb98a('0x73')]=function(_0x668e3e,_0x164ff0,_0x12d282){var _0x35829f={'raw':![],'where':{}};var _0x543e4e={};var _0x227f8d={'count':0x0,'rows':[]};return db[_0xb98a('0x40')]['findOne']({'where':{'id':_0x668e3e[_0xb98a('0x5b')]['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x164ff0,null))[_0xb98a('0x23')](function(_0x1d8c39){if(_0x1d8c39){_0x543e4e[_0xb98a('0x44')]=_['keys'](db[_0xb98a('0x72')][_0xb98a('0x41')]);_0x543e4e[_0xb98a('0x45')]=_[_0xb98a('0x46')](_0x668e3e[_0xb98a('0x45')]);_0x543e4e[_0xb98a('0x47')]=_[_0xb98a('0x48')](_0x543e4e[_0xb98a('0x44')],_0x543e4e['query']);_0x35829f['attributes']=_[_0xb98a('0x48')](_0x543e4e[_0xb98a('0x44')],qs[_0xb98a('0x4a')](_0x668e3e[_0xb98a('0x45')][_0xb98a('0x4a')]));_0x35829f[_0xb98a('0x49')]=_0x35829f[_0xb98a('0x49')][_0xb98a('0x4b')]?_0x35829f[_0xb98a('0x49')]:_0x543e4e[_0xb98a('0x44')];if(!_0x668e3e[_0xb98a('0x45')][_0xb98a('0x6d')]('nolimit')){_0x35829f['limit']=qs[_0xb98a('0x32')](_0x668e3e['query'][_0xb98a('0x32')]);_0x35829f[_0xb98a('0x31')]=qs[_0xb98a('0x31')](_0x668e3e[_0xb98a('0x45')][_0xb98a('0x31')]);}_0x35829f[_0xb98a('0x4c')]=qs[_0xb98a('0x4d')](_0x668e3e[_0xb98a('0x45')][_0xb98a('0x4d')]);_0x35829f['where']=qs[_0xb98a('0x47')](_['pick'](_0x668e3e[_0xb98a('0x45')],_0x543e4e['filters']));_0x35829f['where'][_0xb98a('0x69')]=_0x1d8c39['id'];if(_0x668e3e['query'][_0xb98a('0x50')]){_0x35829f[_0xb98a('0x4e')]=_[_0xb98a('0x51')](_0x35829f[_0xb98a('0x4e')],{'$or':_[_0xb98a('0x3f')](_0x35829f[_0xb98a('0x49')],function(_0x2941b6){var _0x2c4446={};_0x2c4446[_0x2941b6]={'$like':'%'+_0x668e3e[_0xb98a('0x45')]['filter']+'%'};return _0x2c4446;})});}_0x35829f=_[_0xb98a('0x51')]({},_0x35829f,_0x668e3e[_0xb98a('0x54')]);return db[_0xb98a('0x72')][_0xb98a('0x55')]({'where':_0x35829f[_0xb98a('0x4e')]})[_0xb98a('0x23')](function(_0x346139){_0x227f8d['count']=_0x346139;if(_0x668e3e['query'][_0xb98a('0x56')]){_0x35829f[_0xb98a('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb98a('0x58')](_0x35829f);})[_0xb98a('0x23')](function(_0x5a3a8e){_0x227f8d[_0xb98a('0x59')]=_0x5a3a8e;return _0x227f8d;});}})[_0xb98a('0x23')](respondWithFilteredResult(_0x164ff0,_0x35829f))[_0xb98a('0x2e')](handleError(_0x164ff0,null));};exports['removeAnswers']=function(_0x4a7100,_0xbe9ce4,_0x55b64b){return db[_0xb98a('0x40')]['find']({'where':{'id':_0x4a7100['params']['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0xbe9ce4,null))[_0xb98a('0x23')](function(_0x59883a){if(_0x59883a){return _0x59883a['removeAnswers'](_0x4a7100[_0xb98a('0x45')][_0xb98a('0x70')]);}})[_0xb98a('0x23')](respondWithStatusCode(_0xbe9ce4,null))[_0xb98a('0x2e')](handleError(_0xbe9ce4,null));};exports[_0xb98a('0x74')]=function(_0x2b890d,_0x3909b3,_0xc83df){_0x2b890d[_0xb98a('0x65')][_0xb98a('0x75')]=_0x2b890d[_0xb98a('0x76')][_0xb98a('0x77')];return db[_0xb98a('0x40')][_0xb98a('0x5c')]({'where':{'id':_0x2b890d[_0xb98a('0x5b')]['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x3909b3,null))[_0xb98a('0x23')](saveUpdates(_0x2b890d[_0xb98a('0x65')],null))[_0xb98a('0x23')](respondWithResult(_0x3909b3,null))[_0xb98a('0x2e')](handleError(_0x3909b3,null));};exports[_0xb98a('0x78')]=function(_0x375f0d,_0x51d109,_0x34c87a){_0x375f0d[_0xb98a('0x65')][_0xb98a('0x79')]=_0x375f0d[_0xb98a('0x76')]['filename'];return db[_0xb98a('0x40')][_0xb98a('0x5c')]({'where':{'id':_0x375f0d[_0xb98a('0x5b')]['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x51d109,null))['then'](saveUpdates(_0x375f0d[_0xb98a('0x65')],null))[_0xb98a('0x23')](respondWithResult(_0x51d109,null))['catch'](handleError(_0x51d109,null));};exports['addCustomerAvatar']=function(_0x1cbf8b,_0x52c6a7,_0x5ac26d){_0x1cbf8b[_0xb98a('0x65')][_0xb98a('0x7a')]=_0x1cbf8b[_0xb98a('0x76')][_0xb98a('0x77')];return db['ChatWebsite'][_0xb98a('0x5c')]({'where':{'id':_0x1cbf8b[_0xb98a('0x5b')]['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x52c6a7,null))[_0xb98a('0x23')](saveUpdates(_0x1cbf8b[_0xb98a('0x65')],null))[_0xb98a('0x23')](respondWithResult(_0x52c6a7,null))[_0xb98a('0x2e')](handleError(_0x52c6a7,null));};exports[_0xb98a('0x7b')]=function(_0x5a68e7,_0x36d542,_0x4d2705){_0x5a68e7[_0xb98a('0x65')]['systemAvatar']=_0x5a68e7[_0xb98a('0x76')]['filename'];return db[_0xb98a('0x40')]['find']({'where':{'id':_0x5a68e7['params']['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x36d542,null))[_0xb98a('0x23')](saveUpdates(_0x5a68e7[_0xb98a('0x65')],null))[_0xb98a('0x23')](respondWithResult(_0x36d542,null))[_0xb98a('0x2e')](handleError(_0x36d542,null));};exports['getLogo']=function(_0x2e6085,_0x3b207e,_0x21652d){var _0x5e68b3=path[_0xb98a('0x7c')](config['root'],_0xb98a('0x7d'));var _0x151551={'where':{'id':_0x2e6085[_0xb98a('0x5b')]['id']},'attributes':['id',_0xb98a('0x75')],'raw':!![]};var _0x36d227=![];return require(_0xb98a('0x1b'))[_0xb98a('0x7e')]()[_0xb98a('0x23')](function(_0x54045f){if(_0x54045f){_0x36d227=_0x54045f['custom'];}})[_0xb98a('0x23')](function(){return db[_0xb98a('0x40')][_0xb98a('0x5c')](_0x151551);})[_0xb98a('0x23')](handleEntityNotFound(_0x3b207e,null))[_0xb98a('0x23')](function(_0x2ea739){if(_0x2ea739){if(!_[_0xb98a('0x7f')](_0x2ea739['sitepic'])){if(fs[_0xb98a('0x80')](path[_0xb98a('0x7c')](config[_0xb98a('0x81')],_0xb98a('0x82'),_0x2ea739[_0xb98a('0x75')]))&&_0x36d227){_0x5e68b3=path[_0xb98a('0x7c')](config[_0xb98a('0x81')],_0xb98a('0x82'),_0x2ea739[_0xb98a('0x75')]);}}return _0x3b207e[_0xb98a('0x83')](_0x5e68b3);}})['catch'](handleError(_0x3b207e,null));};exports[_0xb98a('0x84')]=function(_0x58e1ed,_0x1e0d4e,_0xe9c774){var _0x568256=path[_0xb98a('0x7c')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x2deed0={'where':{'id':_0x58e1ed[_0xb98a('0x5b')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xb98a('0x40')][_0xb98a('0x5c')](_0x2deed0)[_0xb98a('0x23')](handleEntityNotFound(_0x1e0d4e,null))[_0xb98a('0x23')](function(_0x3d8d1a){if(_0x3d8d1a){if(!_[_0xb98a('0x7f')](_0x3d8d1a[_0xb98a('0x79')])){if(fs[_0xb98a('0x80')](path[_0xb98a('0x7c')](config[_0xb98a('0x81')],_0xb98a('0x85'),_0x3d8d1a['agentAvatar']))){_0x568256=path[_0xb98a('0x7c')](config[_0xb98a('0x81')],_0xb98a('0x85'),_0x3d8d1a[_0xb98a('0x79')]);}}return _0x1e0d4e[_0xb98a('0x83')](_0x568256);}})[_0xb98a('0x2e')](handleError(_0x1e0d4e,null));};exports[_0xb98a('0x86')]=function(_0x54ff79,_0x48ed71,_0x2ccf30){var _0x187e36=path[_0xb98a('0x7c')](config['root'],_0xb98a('0x87'));var _0x529250={'where':{'id':_0x54ff79['params']['id']},'attributes':['id',_0xb98a('0x7a'),'showCustomerAvatar'],'raw':!![]};return db[_0xb98a('0x40')]['find'](_0x529250)[_0xb98a('0x23')](handleEntityNotFound(_0x48ed71,null))[_0xb98a('0x23')](function(_0x2c6401){if(_0x2c6401){if(!_[_0xb98a('0x7f')](_0x2c6401[_0xb98a('0x7a')])){if(fs[_0xb98a('0x80')](path[_0xb98a('0x7c')](config['root'],_0xb98a('0x85'),_0x2c6401[_0xb98a('0x7a')]))&&_0x2c6401[_0xb98a('0x88')]){_0x187e36=path['join'](config[_0xb98a('0x81')],_0xb98a('0x85'),_0x2c6401[_0xb98a('0x7a')]);}}return _0x48ed71[_0xb98a('0x83')](_0x187e36);}})['catch'](handleError(_0x48ed71,null));};exports[_0xb98a('0x89')]=function(_0x3930db,_0x1e66d5,_0x2698e9){var _0x44c96d=path[_0xb98a('0x7c')](config[_0xb98a('0x81')],_0xb98a('0x8a'));var _0x1a6943={'where':{'id':_0x3930db[_0xb98a('0x5b')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xb98a('0x40')][_0xb98a('0x5c')](_0x1a6943)[_0xb98a('0x23')](handleEntityNotFound(_0x1e66d5,null))['then'](function(_0x1be9d0){if(_0x1be9d0){if(!_[_0xb98a('0x7f')](_0x1be9d0[_0xb98a('0x8b')])){if(fs[_0xb98a('0x80')](path['join'](config[_0xb98a('0x81')],'server/files/images/avatars/',_0x1be9d0[_0xb98a('0x8b')]))){_0x44c96d=path['join'](config[_0xb98a('0x81')],_0xb98a('0x85'),_0x1be9d0[_0xb98a('0x8b')]);}}return _0x1e66d5[_0xb98a('0x83')](_0x44c96d);}})[_0xb98a('0x2e')](handleError(_0x1e66d5,null));};exports[_0xb98a('0x8c')]=function(_0x28f251,_0x2635fc,_0x3a6ec3){var _0x9212d8=require(_0xb98a('0x8d'));var _0x3a2a84=new _0x9212d8();var _0xfe48ba=_0x3a2a84[_0xb98a('0x8e')](_0x28f251[_0xb98a('0x8f')]['user-agent'])[_0xb98a('0x90')]();var _0x32db15={'body':_0x28f251[_0xb98a('0x65')],'channel':'chat'};var _0x4235b2=[];var _0x434fe4=[];var _0x881b0d={};var _0x161af5=![];return db[_0xb98a('0x91')][_0xb98a('0x67')]()[_0xb98a('0x23')](function(_0x409f66){if(!_0x409f66){throw new db[(_0xb98a('0x92'))][(_0xb98a('0x93'))](_0xb98a('0x94'));}_0x4235b2=_[_0xb98a('0x95')](_['keys'](_0x409f66),[_0xb98a('0x96'),'updatedAt']);_0x434fe4=_[_0xb98a('0x95')](_[_0xb98a('0x46')](_0x409f66),[_0xb98a('0x96'),_0xb98a('0x97'),_0xb98a('0x98'),'ListId']);if(_0x28f251[_0xb98a('0x65')]['id']){delete _0x28f251['body']['id'];}if(_[_0xb98a('0x7f')](_0x28f251['body'][_0xb98a('0x99')])){throw new db[(_0xb98a('0x92'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xb98a('0x7f')](_0x28f251[_0xb98a('0x65')][_0xb98a('0x65')])||_0x28f251[_0xb98a('0x65')][_0xb98a('0x65')]===''){throw new db[(_0xb98a('0x92'))][(_0xb98a('0x93'))](_0xb98a('0x9a'));}if(_[_0xb98a('0x7f')](_0x28f251[_0xb98a('0x65')][_0xb98a('0x9b')])){throw new db[(_0xb98a('0x92'))][(_0xb98a('0x93'))](_0xb98a('0x9c')+_0x434fe4);}if(!_['includes'](_0x434fe4,_0x28f251['body'][_0xb98a('0x9b')])){throw new db[(_0xb98a('0x92'))]['ValidationError'](_0xb98a('0x9d')+_0x434fe4);}_0x881b0d[_0x28f251['body'][_0xb98a('0x9b')]]=_0x28f251[_0xb98a('0x65')][_0xb98a('0x99')];})[_0xb98a('0x23')](function(){return db[_0xb98a('0x40')][_0xb98a('0x5c')]({'where':{'id':_0x28f251[_0xb98a('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xb98a('0x9e'),'include':[{'model':db[_0xb98a('0x91')],'as':'Contacts','where':_0x881b0d,'limit':0x1,'order':[['updatedAt',_0xb98a('0x9f')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0xb98a('0x23')](handleEntityNotFound(_0x2635fc,null))[_0xb98a('0x23')](function(_0x20d42a){if(_0x20d42a&&_0x20d42a[_0xb98a('0x9e')]){_0x32db15[_0xb98a('0xa0')]=_0x20d42a;_0x32db15[_0xb98a('0xa1')]=_0x20d42a[_0xb98a('0xa2')];_0x32db15[_0xb98a('0xa3')]=_0x20d42a[_0xb98a('0x9e')];_0x32db15[_0xb98a('0xa1')]=_[_0xb98a('0xa4')](_0x32db15['applications'],['priority'],[_0xb98a('0xa5')]);if(_0x32db15[_0xb98a('0xa0')][_0xb98a('0xa2')]){delete _0x32db15['account'][_0xb98a('0xa2')];}if(_0x32db15['account'][_0xb98a('0x9e')]&&_0x32db15[_0xb98a('0xa0')][_0xb98a('0x9e')][_0xb98a('0xa6')][_0xb98a('0x4b')]){return _0x32db15['account'][_0xb98a('0x9e')][_0xb98a('0xa6')][0x0];}var _0x5e4e1a=_[_0xb98a('0xa7')](_0x28f251[_0xb98a('0x65')],{'firstName':_0x28f251['body'][_0xb98a('0x99')],'ListId':_0x20d42a[_0xb98a('0xa8')]});_0x5e4e1a[_0x28f251[_0xb98a('0x65')][_0xb98a('0x9b')]]=_0x28f251[_0xb98a('0x65')][_0xb98a('0x99')];return db[_0xb98a('0x91')][_0xb98a('0x5d')](_0x5e4e1a,{'fields':_0x4235b2,'raw':!![]});}})[_0xb98a('0x23')](handleEntityNotFound(_0x2635fc,null))['then'](function(_0x52728e){_0x32db15[_0xb98a('0xa9')]=_0x52728e;var _0x3aabd0=_0x28f251['body']['customerIp'];if(_0x28f251['headers'][_0xb98a('0xaa')]){_0x3aabd0=_0x28f251['headers'][_0xb98a('0xaa')];}else if(_0x28f251['headers']['x-forwarded-for']){_0x3aabd0=_[_0xb98a('0xab')](_0x28f251['headers'][_0xb98a('0xac')]['split'](','));}if(_0x52728e){var _0x4ea519={'ContactId':_0x52728e['id'],'ChatWebsiteId':_0x28f251['params']['id'],'from':(_0x52728e[_0xb98a('0xad')]||'')+'\x20'+(_0x52728e[_0xb98a('0xae')]||''),'customerIp':_0x3aabd0,'customerPort':_0x28f251[_0xb98a('0x8f')][_0xb98a('0xaf')]?_0x28f251[_0xb98a('0x8f')][_0xb98a('0xaf')]:null,'referer':_0x28f251[_0xb98a('0x65')][_0xb98a('0xb0')],'browserName':_0xfe48ba[_0xb98a('0xb1')]['name']&&_0xfe48ba[_0xb98a('0xb1')][_0xb98a('0xb2')]?util[_0xb98a('0xb3')](_0xb98a('0xb4'),_0xfe48ba['browser']['name'],_0xfe48ba[_0xb98a('0xb1')][_0xb98a('0xb2')]):_0xb98a('0xb5'),'browserVersion':_0xfe48ba[_0xb98a('0xb1')][_0xb98a('0xb2')]||_0xb98a('0xb5'),'osName':util['format'](_0xb98a('0xb4'),_0xfe48ba['os']['name'],_0xfe48ba['os'][_0xb98a('0xb2')]),'osVersion':_0xfe48ba['os']['version'],'deviceModel':_0xfe48ba[_0xb98a('0xb6')][_0xb98a('0x44')]&&_0xfe48ba['device']['vendor']?util['format']('%s\x20%s\x20%s',_0xfe48ba[_0xb98a('0xb6')][_0xb98a('0x44')],_0xfe48ba[_0xb98a('0xb6')]['vendor'],_0xfe48ba[_0xb98a('0xb6')]['type']):null,'deviceVendor':_0xfe48ba[_0xb98a('0xb6')][_0xb98a('0xb7')],'deviceType':_0xfe48ba[_0xb98a('0xb6')][_0xb98a('0x52')],'formData':JSON[_0xb98a('0x28')](_0x28f251['body'])};var _0x5e82f6={'ChatWebsiteId':_0x28f251[_0xb98a('0x5b')]['id'],'closed':![]};if(_0x28f251[_0xb98a('0x65')][_0xb98a('0xb8')]){_0x5e82f6[_0xb98a('0xb8')]=_0x28f251['body']['threadId'];return db[_0xb98a('0xb9')]['find']({'where':_0x5e82f6})[_0xb98a('0x23')](function(_0x5d7d1d){if(_0x5d7d1d){return[_0x5d7d1d,![]];}_0x4ea519[_0xb98a('0xb8')]=_0x28f251[_0xb98a('0x65')][_0xb98a('0xb8')];_0x4ea519['externalUrl']=_0x28f251[_0xb98a('0x65')][_0xb98a('0xba')];return db[_0xb98a('0xb9')]['create'](_0x4ea519)[_0xb98a('0x23')](function(_0x1954a7){return[_0x1954a7,!![]];});});}_0x5e82f6[_0xb98a('0xbb')]=_0x52728e['id'];if(_0x28f251['body'][_0xb98a('0xbc')]&&_0x28f251[_0xb98a('0x65')][_0xb98a('0xbc')]['id']){_0x5e82f6['id']=_0x28f251[_0xb98a('0x65')][_0xb98a('0xbc')]['id'];return db[_0xb98a('0xb9')][_0xb98a('0x5c')]({'where':_0x5e82f6})[_0xb98a('0x23')](function(_0x424122){if(_0x424122){return[_0x424122,![]];}return db['ChatInteraction'][_0xb98a('0x5d')](_0x4ea519)[_0xb98a('0x23')](function(_0x15b90c){return[_0x15b90c,!![]];});});}return db['ChatInteraction']['create'](_0x4ea519)[_0xb98a('0x23')](function(_0x5bb4b1){return[_0x5bb4b1,!![]];});}})[_0xb98a('0xbd')](function(_0x59c8d4,_0xffd37d){if(_0x59c8d4){_0x161af5=_0xffd37d;if(!_0xffd37d){var _0x35ae89={'from':(_0x32db15[_0xb98a('0xa9')]['firstName']||'')+'\x20'+(_0x32db15[_0xb98a('0xa9')]['lastName']||'')};if(_0x28f251[_0xb98a('0x65')][_0xb98a('0xb8')]&&_0x28f251[_0xb98a('0x65')][_0xb98a('0xbe')]&&_0x28f251[_0xb98a('0x65')][_0xb98a('0xb8')]!=_0x28f251[_0xb98a('0x65')]['messageId']){_0x35ae89[_0xb98a('0xb8')]=_0x28f251['body'][_0xb98a('0xbe')];}return _0x59c8d4['update'](_0x35ae89);}else{return _0x59c8d4;}}})[_0xb98a('0x23')](function(_0x5463d2){_0x32db15['interaction']=_0x5463d2['get']({'plain':!![]});_0x32db15[_0xb98a('0xbc')][_0xb98a('0xbf')]=_0x161af5;if(_0x32db15[_0xb98a('0xbc')][_0xb98a('0xbf')]){if(_0x32db15[_0xb98a('0xa0')][_0xb98a('0xc0')]){_0x32db15[_0xb98a('0xa1')][_0xb98a('0xc1')]({'id':0x0,'priority':_0x32db15[_0xb98a('0xa1')][_0xb98a('0x4b')]+0x1,'app':'close','appdata':_0xb98a('0xc2'),'interval':_0xb98a('0xc3')});}}return db[_0xb98a('0xc4')][_0xb98a('0x5d')]({'body':_0x28f251[_0xb98a('0x65')][_0xb98a('0x65')],'ChatWebsiteId':_0x28f251['params']['id'],'ChatInteractionId':_0x5463d2['id'],'direction':'in','ContactId':_0x32db15['contact']['id'],'AttachmentId':_0x28f251[_0xb98a('0x65')]['AttachmentId']});})[_0xb98a('0x23')](function(_0xd6e4ac){_0x32db15[_0xb98a('0x2b')]=_0xd6e4ac;if(_0x32db15[_0xb98a('0xbc')][_0xb98a('0xc5')]){return db[_0xb98a('0xc6')][_0xb98a('0x5c')]({'attributes':['id',_0xb98a('0x3c')],'where':{'id':_0x32db15[_0xb98a('0xbc')][_0xb98a('0xc5')]}})[_0xb98a('0x23')](function(_0x4d3b9a){if(_0x4d3b9a){_0x32db15[_0xb98a('0xa1')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb98a('0xc7'),'appdata':_0x4d3b9a['name']+','+(_0x32db15[_0xb98a('0xa0')]['waitForTheAssignedAgent']||0xa),'interval':_0xb98a('0xc3')});_0x32db15[_0xb98a('0xc8')]=!![];}return respondWithRpcPromise('Start',_0xb98a('0xc9'),_0x32db15);});}return respondWithRpcPromise(_0xb98a('0xca'),_0xb98a('0xc9'),_0x32db15);})['then'](function(_0x107da5){respondWithRpcPromise('EventManager','EventManager',{'event':_0xb98a('0x8c'),'message':_0x107da5},client9002);return _0x107da5;})['then'](respondWithResult(_0x2635fc,null))[_0xb98a('0x2e')](handleError(_0x2635fc,null));};exports[_0xb98a('0xcb')]=function(_0x3a6e82,_0x1f16d7,_0x14de40){var _0x20ccf5,_0x521fd8,_0x191150;var _0xba2b88=[];var _0x370254=[];var _0x1d154f={};return db[_0xb98a('0x91')][_0xb98a('0x67')]()[_0xb98a('0x23')](function(_0x12e5c7){if(!_0x12e5c7){throw new db[(_0xb98a('0x92'))]['ValidationError'](_0xb98a('0x94'));}_0x370254=_[_0xb98a('0x95')](_[_0xb98a('0x46')](_0x12e5c7),[_0xb98a('0x96'),_0xb98a('0x97')]);_0xba2b88=_[_0xb98a('0x95')](_['keys'](_0x12e5c7),[_0xb98a('0x96'),_0xb98a('0x97'),_0xb98a('0x98'),'ListId']);if(_0x3a6e82[_0xb98a('0x65')]['id']){delete _0x3a6e82[_0xb98a('0x65')]['id'];}if(_[_0xb98a('0x7f')](_0x3a6e82[_0xb98a('0x65')]['from'])){throw _0x1f16d7[_0xb98a('0x2f')](0x1f4)[_0xb98a('0xcc')](new db[(_0xb98a('0x92'))][(_0xb98a('0x93'))](_0xb98a('0xcd')));}if(_[_0xb98a('0x7f')](_0x3a6e82[_0xb98a('0x65')][_0xb98a('0x65')])||_0x3a6e82[_0xb98a('0x65')][_0xb98a('0x65')]===''){throw _0x1f16d7[_0xb98a('0x2f')](0x1f4)[_0xb98a('0xcc')](new db[(_0xb98a('0x92'))][(_0xb98a('0x93'))](_0xb98a('0x9a')));}if(_[_0xb98a('0x7f')](_0x3a6e82[_0xb98a('0x65')][_0xb98a('0xce')])){throw _0x1f16d7[_0xb98a('0x2f')](0x1f4)[_0xb98a('0xcc')](new db[(_0xb98a('0x92'))][(_0xb98a('0x93'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xba2b88));}if(!_[_0xb98a('0xcf')](_0xba2b88,_0x3a6e82[_0xb98a('0x65')][_0xb98a('0xce')])){throw _0x1f16d7[_0xb98a('0x2f')](0x1f4)[_0xb98a('0xcc')](new db[(_0xb98a('0x92'))]['ValidationError'](_0xb98a('0xd0')+_0xba2b88));}_0x1d154f[_0x3a6e82[_0xb98a('0x65')][_0xb98a('0xce')]]=_0x3a6e82[_0xb98a('0x65')][_0xb98a('0x99')];})[_0xb98a('0x23')](function(){return db[_0xb98a('0x40')][_0xb98a('0x5c')]({'where':{'id':_0x3a6e82[_0xb98a('0x5b')]['id']},'include':[{'model':db[_0xb98a('0xd1')],'as':_0xb98a('0x9e')}]});})[_0xb98a('0x23')](handleEntityNotFound(_0x1f16d7,null))[_0xb98a('0x23')](function(_0x1fcab1){if(_0x1fcab1&&_0x1fcab1['List']){_0x521fd8=_0x1fcab1;var _0x1a798c=_[_0xb98a('0xa7')](_0x3a6e82[_0xb98a('0x65')],{'firstName':_0x3a6e82[_0xb98a('0x65')][_0xb98a('0x99')],'phone':_0x3a6e82[_0xb98a('0x65')]['from'],'ListId':_0x1fcab1[_0xb98a('0xa8')]});_0x1a798c[_0x3a6e82['body'][_0xb98a('0xce')]]=_0x3a6e82[_0xb98a('0x65')]['from'];return db['CmContact'][_0xb98a('0xd2')]({'where':_0x1d154f,'defaults':_0x1a798c});}})[_0xb98a('0xbd')](function(_0x1e2ded){if(_0x1e2ded){_0x191150=_0x1e2ded;var _0xce867b=fs['readFileSync'](path[_0xb98a('0x7c')](config[_0xb98a('0x81')],_0xb98a('0xd3')),_0xb98a('0xd4'));var _0x388c61=ejs[_0xb98a('0xd5')](_0xce867b,{'body':_['toPairs'](_0x3a6e82[_0xb98a('0x65')][_0xb98a('0x65')]),'bodyTitle':_0x521fd8[_0xb98a('0xd6')]});return db['ChatOfflineMessage'][_0xb98a('0x5d')]({'body':_0x388c61,'ContactId':_0x1e2ded['id'],'ChatWebsiteId':_0x521fd8['id']});}})['then'](function(_0x37a3ea){if(_0x37a3ea){_0x20ccf5=_0x37a3ea;return db[_0xb98a('0xd7')][_0xb98a('0x6c')]({'where':{'service':!![]},'include':[{'model':db[_0xb98a('0xd8')],'as':_0xb98a('0xd9'),'raw':!![]}]});}})[_0xb98a('0x23')](function(_0x514d08){if(_0x514d08&&_0x514d08['Smtp']&&_0x521fd8[_0xb98a('0xda')]){var _0x17b068={'tls':{'rejectUnauthorized':![]}};if(_0x514d08[_0xb98a('0xd9')]['service']){_0x17b068[_0xb98a('0xdb')]=_0x514d08[_0xb98a('0xd9')][_0xb98a('0xdb')];}else{_0x17b068['host']=_0x514d08[_0xb98a('0xd9')][_0xb98a('0xdc')];_0x17b068[_0xb98a('0xdd')]=_0x514d08[_0xb98a('0xd9')][_0xb98a('0xdd')];_0x17b068[_0xb98a('0xde')]=_0x514d08[_0xb98a('0xd9')]['secure'];}if(_0x514d08[_0xb98a('0xd9')][_0xb98a('0xdf')]){_0x17b068[_0xb98a('0xe0')]={'user':_0x514d08[_0xb98a('0xd9')][_0xb98a('0x5e')],'pass':_0x514d08[_0xb98a('0xd9')][_0xb98a('0xe1')]};}return respondWithRpcPromise(_0xb98a('0xe2'),_0xb98a('0xe3'),{'account':_0x17b068,'message':{'from':util[_0xb98a('0xb3')](_0xb98a('0xe4'),_0x514d08[_0xb98a('0x3c')],_0x514d08[_0xb98a('0xe5')]||_0x514d08['Smtp'][_0xb98a('0x5e')]),'to':_0x521fd8[_0xb98a('0xda')],'subject':_0x521fd8['offlineMessageSubject'],'text':_0x20ccf5[_0xb98a('0x65')]}},client9003)[_0xb98a('0x23')](function(){return _0x20ccf5;})[_0xb98a('0x2e')](function(_0x23eb90){console[_0xb98a('0x29')](_0x23eb90);});}})[_0xb98a('0x23')](function(){if(_0x20ccf5){return _0x20ccf5;}})[_0xb98a('0x23')](respondWithResult(_0x1f16d7,null))[_0xb98a('0x2e')](handleError(_0x1f16d7,null));};exports[_0xb98a('0xe6')]=function(_0x5be1fc,_0x20461b,_0x35d5f4){return db[_0xb98a('0xb9')]['find']({'where':{'id':_0x5be1fc[_0xb98a('0x5b')]['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x20461b,null))[_0xb98a('0x23')](function(_0x23ef20){if(_0x23ef20){return _0x23ef20['addInteraction'](_0x5be1fc[_0xb98a('0x65')][_0xb98a('0x70')],_[_0xb98a('0xe7')](_0x5be1fc[_0xb98a('0x65')],[_0xb98a('0x70'),'id'])||{});}})[_0xb98a('0x23')](respondWithResult(_0x20461b,null))[_0xb98a('0x2e')](handleError(_0x20461b,null));};exports[_0xb98a('0xe8')]=function(_0x5f05c6,_0x37ec50,_0x1dc393){var _0x34701d={'raw':![],'where':{}};var _0x5dd597={};var _0xeebfa2={'count':0x0,'rows':[]};return db[_0xb98a('0x40')][_0xb98a('0x6c')]({'where':{'id':_0x5f05c6[_0xb98a('0x5b')]['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x37ec50,null))['then'](function(_0xc3d9d3){if(_0xc3d9d3){_0x5dd597[_0xb98a('0x44')]=_[_0xb98a('0x46')](db[_0xb98a('0xb9')][_0xb98a('0x41')]);_0x5dd597['query']=_[_0xb98a('0x46')](_0x5f05c6['query']);_0x5dd597[_0xb98a('0x47')]=_[_0xb98a('0x48')](_0x5dd597[_0xb98a('0x44')],_0x5dd597['query']);_0x34701d[_0xb98a('0x49')]=_[_0xb98a('0x48')](_0x5dd597[_0xb98a('0x44')],qs['fields'](_0x5f05c6[_0xb98a('0x45')][_0xb98a('0x4a')]));_0x34701d[_0xb98a('0x49')]=_0x34701d['attributes'][_0xb98a('0x4b')]?_0x34701d['attributes']:_0x5dd597['model'];if(!_0x5f05c6['query'][_0xb98a('0x6d')](_0xb98a('0x6e'))){_0x34701d[_0xb98a('0x32')]=qs[_0xb98a('0x32')](_0x5f05c6['query'][_0xb98a('0x32')]);_0x34701d[_0xb98a('0x31')]=qs['offset'](_0x5f05c6[_0xb98a('0x45')][_0xb98a('0x31')]);}_0x34701d[_0xb98a('0x4c')]=qs[_0xb98a('0x4d')](_0x5f05c6[_0xb98a('0x45')][_0xb98a('0x4d')]);_0x34701d['where']=qs[_0xb98a('0x47')](_[_0xb98a('0x4f')](_0x5f05c6[_0xb98a('0x45')],_0x5dd597[_0xb98a('0x47')]));_0x34701d[_0xb98a('0x4e')][_0xb98a('0x69')]=_0xc3d9d3['id'];if(_0x5f05c6[_0xb98a('0x45')][_0xb98a('0x50')]){_0x34701d[_0xb98a('0x4e')]=_['merge'](_0x34701d[_0xb98a('0x4e')],{'$or':_[_0xb98a('0x3f')](_0x34701d[_0xb98a('0x49')],function(_0x14dd41){var _0x24557f={};_0x24557f[_0x14dd41]={'$like':'%'+_0x5f05c6[_0xb98a('0x45')][_0xb98a('0x50')]+'%'};return _0x24557f;})});}_0x34701d=_[_0xb98a('0x51')]({},_0x34701d,_0x5f05c6['options']);return db[_0xb98a('0xb9')][_0xb98a('0x55')]({'where':_0x34701d['where']})[_0xb98a('0x23')](function(_0x36cbc7){_0xeebfa2[_0xb98a('0x55')]=_0x36cbc7;if(_0x5f05c6[_0xb98a('0x45')][_0xb98a('0x56')]){_0x34701d[_0xb98a('0x57')]=[{'model':db[_0xb98a('0x91')],'as':_0xb98a('0xe9'),'required':![]},{'model':db[_0xb98a('0xc6')],'as':'Owner','attributes':['name',_0xb98a('0xea'),'internal'],'required':![]},{'model':db[_0xb98a('0xeb')],'as':_0xb98a('0xec'),'attributes':['id',_0xb98a('0x3c'),_0xb98a('0xed')],'where':_0x5f05c6[_0xb98a('0x45')][_0xb98a('0xee')]?{'id':_0x5f05c6[_0xb98a('0x45')]['tag']}:undefined,'required':_0x5f05c6['query'][_0xb98a('0xee')]?!![]:![]}];}return db[_0xb98a('0xb9')]['findAll'](_0x34701d);})['then'](function(_0x2c6a0f){_0xeebfa2['rows']=_0x2c6a0f;return _0xeebfa2;});}})[_0xb98a('0x23')](respondWithFilteredResult(_0x37ec50,_0x34701d))[_0xb98a('0x2e')](handleError(_0x37ec50,null));};function iftimePromise(_0x517c1b,_0x7ea230){return respondWithRpcPromise(_0xb98a('0xef'),_0xb98a('0xf0'),{'command':_0x7ea230[_0xb98a('0xf1')]?util[_0xb98a('0xb3')](_0xb98a('0xf2'),_0x517c1b[_0xb98a('0xf3')],_0x7ea230[_0xb98a('0xf1')]):util[_0xb98a('0xb3')](_0xb98a('0xf4'),_0x517c1b['interval'])},client9002)[_0xb98a('0x23')](function(_0x4d1c8e){var _0xeedf69=_0x4d1c8e&&_0x4d1c8e[_0xb98a('0xf5')](_0xb98a('0xf6'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x7ea230['id'],_0x517c1b['id'],_0x517c1b[_0xb98a('0xf3')],_0xeedf69?_0xb98a('0xf7'):_0xb98a('0xf8'),_0x7ea230['timezone']?_0x7ea230[_0xb98a('0xf1')]:_0xb98a('0xf9'));return _0xeedf69;})[_0xb98a('0x2e')](function(_0x697fe7){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x7ea230['id'],_0x517c1b['id'],_0x517c1b['interval'],util[_0xb98a('0xfa')](_0x697fe7,{'showHidden':![],'depth':null}),_0x7ea230[_0xb98a('0xf1')]?_0x7ea230[_0xb98a('0xf1')]:_0xb98a('0xf9'));return![];});}exports[_0xb98a('0xf0')]=function(_0x2bf919,_0x4ceaca,_0x2b0e2b){var _0xfa478=0x0;var _0x528b77=0x0;var _0x54f269=![];var _0x48dcb0;var _0x277884;return db['ChatWebsite'][_0xb98a('0x5c')]({'where':{'id':_0x2bf919['params']['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0xb98a('0xfb')],'as':_0xb98a('0xfc'),'attributes':['id',_0xb98a('0xf3')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4ceaca,null))[_0xb98a('0x23')](function(_0x3f2969){if(_0x3f2969){_0x48dcb0=_0x3f2969;return _0x3f2969['getProactiveActions']({'raw':!![]});}})[_0xb98a('0x23')](function(_0x454940){if(_0x48dcb0){if(_0x454940){_0x277884=_0x454940;}}return require(_0xb98a('0x1b'))[_0xb98a('0x7e')]();})[_0xb98a('0x23')](function(_0x43a035){if(_0x43a035){_0x528b77=_0x43a035[_0xb98a('0xfd')];_0x54f269=_0x43a035[_0xb98a('0xfe')];}})[_0xb98a('0x23')](function(){return db[_0xb98a('0xb9')]['count']({'where':{'closed':![]}});})[_0xb98a('0x23')](function(_0xb54413){_0xfa478=_0xb54413;if(_0x528b77&&_0xb54413>_0x528b77){return db[_0xb98a('0xff')][_0xb98a('0x6c')]({'where':{'id':0x1}})[_0xb98a('0x23')](function(_0x5c367e){if(_0x5c367e){_0x5c367e[_0xb98a('0x100')](_0xb98a('0x101'));}});}})[_0xb98a('0x23')](function(){if(_0x48dcb0[_0xb98a('0xfb')]&&_0x48dcb0[_0xb98a('0xfb')][_0xb98a('0xfc')]){var _0x1625ca=[];for(var _0x7e235b=0x0;_0x7e235b<_0x48dcb0[_0xb98a('0xfb')][_0xb98a('0xfc')][_0xb98a('0x4b')];_0x7e235b++){var _0xd65d51=_0x48dcb0[_0xb98a('0xfb')][_0xb98a('0xfc')][_0x7e235b][_0xb98a('0x39')]({'plain':!![]});_0x1625ca[_0xb98a('0xc1')](iftimePromise(_0xd65d51,_0x48dcb0));}return BPromise['all'](_0x1625ca)[_0xb98a('0x23')](function(_0x342d08){return _[_0xb98a('0x102')](_0x342d08);});}else{return!![];}})['then'](function(_0x43b3ad){var _0x9b48d6=fs[_0xb98a('0x103')](path['join'](config['root'],_0xb98a('0x104')),_0xb98a('0xd4'));var _0x865f70={'remote':_0x48dcb0[_0xb98a('0x105')],'query':querystring[_0xb98a('0x28')](_[_0xb98a('0x51')](_0x48dcb0['get']({'plain':!![]}),{'customerIp':_0x2bf919[_0xb98a('0x8f')][_0xb98a('0xac')]||_0x2bf919[_0xb98a('0x8f')]['x-real-ip']||_0x2bf919['connection'][_0xb98a('0x106')]||_0x2bf919['ip'],'referer':_0x2bf919[_0xb98a('0x8f')][_0xb98a('0xb0')],'openedInteractions':_0xfa478,'maxInteractions':_0x528b77,'virtual':_0x54f269[_0xb98a('0xfd')],'online':_0x43b3ad,'custom':_0x54f269}))['replace'](/'/g,'\x5c\x27')};_0x4ceaca[_0xb98a('0xcc')](ejs[_0xb98a('0xd5')](Mustache[_0xb98a('0xd5')](_0x9b48d6,_0x865f70),{'proactiveActions':_0x277884,'alignment':_0x48dcb0[_0xb98a('0x107')],'verticalAlignment':_0x48dcb0['verticalAlignment'],'div_color':_0x48dcb0[_0xb98a('0xed')],'text_color':_0x48dcb0[_0xb98a('0x108')]}));})['catch'](handleError(_0x4ceaca,null));};exports[_0xb98a('0x109')]=function(_0x4d924a,_0xd51daf,_0x1d5e08){return db[_0xb98a('0x40')][_0xb98a('0x6c')]({'where':{'id':_0x4d924a[_0xb98a('0x5b')]['id']}})['then'](handleEntityNotFound(_0xd51daf,null))['then'](function(_0x3b4b1a){if(_0x3b4b1a){return db['sequelize'][_0xb98a('0x10a')](function(_0x13d50b){return db['ChatApplication'][_0xb98a('0x38')]({'where':{'ChatWebsiteId':_0x4d924a['params']['id']},'transaction':_0x13d50b})['then'](function(_0x5281a8){var _0x41ebef=_[_0xb98a('0x3f')](_0x4d924a[_0xb98a('0x65')],function(_0x5c31de){_0x5c31de[_0xb98a('0x69')]=_0x4d924a[_0xb98a('0x5b')]['id'];return _0x5c31de;});return db[_0xb98a('0x10b')][_0xb98a('0x10c')](_0x41ebef,{'transaction':_0x13d50b});});})[_0xb98a('0x23')](function(){return db[_0xb98a('0x10b')][_0xb98a('0x10d')]({'where':{'ChatWebsiteId':_0x4d924a[_0xb98a('0x5b')]['id']},'order':_0xb98a('0x10e')});});}})[_0xb98a('0x23')](respondWithResult(_0xd51daf,null))[_0xb98a('0x2e')](handleError(_0xd51daf,null));};exports[_0xb98a('0x10f')]=function(_0x549e40,_0x1ce9af,_0x221307){var _0x376a07={};var _0x5541f0={};var _0x223a51;var _0x361122;return db[_0xb98a('0x40')][_0xb98a('0x6c')]({'where':{'id':_0x549e40[_0xb98a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1ce9af,null))[_0xb98a('0x23')](function(_0x355950){if(_0x355950){_0x223a51=_0x355950;_0x5541f0[_0xb98a('0x44')]=_['keys'](db['ChatApplication'][_0xb98a('0x41')]);_0x5541f0['query']=_[_0xb98a('0x46')](_0x549e40[_0xb98a('0x45')]);_0x5541f0[_0xb98a('0x47')]=_['intersection'](_0x5541f0['model'],_0x5541f0['query']);_0x376a07['attributes']=_[_0xb98a('0x48')](_0x5541f0[_0xb98a('0x44')],qs['fields'](_0x549e40[_0xb98a('0x45')][_0xb98a('0x4a')]));_0x376a07['attributes']=_0x376a07['attributes'][_0xb98a('0x4b')]?_0x376a07[_0xb98a('0x49')]:_0x5541f0[_0xb98a('0x44')];_0x376a07[_0xb98a('0x4c')]=qs[_0xb98a('0x4d')](_0x549e40[_0xb98a('0x45')][_0xb98a('0x4d')]);_0x376a07[_0xb98a('0x4e')]=qs[_0xb98a('0x47')](_[_0xb98a('0x4f')](_0x549e40[_0xb98a('0x45')],_0x5541f0[_0xb98a('0x47')]));if(_0x549e40[_0xb98a('0x45')][_0xb98a('0x50')]){_0x376a07[_0xb98a('0x4e')]=_[_0xb98a('0x51')](_0x376a07[_0xb98a('0x4e')],{'$or':_[_0xb98a('0x3f')](_0x376a07[_0xb98a('0x49')],function(_0xb9a6f5){var _0x565db={};_0x565db[_0xb9a6f5]={'$like':'%'+_0x549e40['query'][_0xb98a('0x50')]+'%'};return _0x565db;})});}_0x376a07=_[_0xb98a('0x51')]({},_0x376a07,_0x549e40['options']);return _0x223a51[_0xb98a('0x10f')](_0x376a07);}})[_0xb98a('0x23')](function(_0x3e2a40){if(_0x3e2a40){_0x361122=_0x3e2a40[_0xb98a('0x4b')];if(!_0x549e40['query'][_0xb98a('0x6d')]('nolimit')){_0x376a07[_0xb98a('0x32')]=qs['limit'](_0x549e40[_0xb98a('0x45')][_0xb98a('0x32')]);_0x376a07[_0xb98a('0x31')]=qs[_0xb98a('0x31')](_0x549e40['query']['offset']);}return _0x223a51['getApplications'](_0x376a07);}})[_0xb98a('0x23')](function(_0x434b8b){if(_0x434b8b){return _0x434b8b?{'count':_0x361122,'rows':_0x434b8b}:null;}})[_0xb98a('0x23')](respondWithResult(_0x1ce9af,null))[_0xb98a('0x2e')](handleError(_0x1ce9af,null));};exports['addProactiveActions']=function(_0x2c2921,_0x3c97b1,_0x5507f0){return db['chatProactiveAction'][_0xb98a('0x5c')]({'where':{'id':_0x2c2921['params']['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x3c97b1,null))[_0xb98a('0x23')](function(_0x5d76fc){if(_0x5d76fc){return _0x5d76fc[_0xb98a('0x110')](_0x2c2921[_0xb98a('0x65')][_0xb98a('0x70')],_[_0xb98a('0xe7')](_0x2c2921[_0xb98a('0x65')],[_0xb98a('0x70'),'id'])||{});}})[_0xb98a('0x23')](respondWithResult(_0x3c97b1,null))[_0xb98a('0x2e')](handleError(_0x3c97b1,null));};exports['getProactiveActions']=function(_0x3612c6,_0x3d4eb9,_0x5427b5){var _0x1266d2={};var _0x41eccb={};var _0x217401;var _0x152760;return db[_0xb98a('0x40')][_0xb98a('0x6c')]({'where':{'id':_0x3612c6[_0xb98a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3d4eb9,null))['then'](function(_0x6b1c4c){if(_0x6b1c4c){_0x217401=_0x6b1c4c;_0x41eccb[_0xb98a('0x44')]=_[_0xb98a('0x46')](db[_0xb98a('0x111')][_0xb98a('0x41')]);_0x41eccb[_0xb98a('0x45')]=_[_0xb98a('0x46')](_0x3612c6[_0xb98a('0x45')]);_0x41eccb['filters']=_[_0xb98a('0x48')](_0x41eccb[_0xb98a('0x44')],_0x41eccb[_0xb98a('0x45')]);_0x1266d2['attributes']=_[_0xb98a('0x48')](_0x41eccb[_0xb98a('0x44')],qs[_0xb98a('0x4a')](_0x3612c6[_0xb98a('0x45')][_0xb98a('0x4a')]));_0x1266d2[_0xb98a('0x49')]=_0x1266d2[_0xb98a('0x49')][_0xb98a('0x4b')]?_0x1266d2[_0xb98a('0x49')]:_0x41eccb[_0xb98a('0x44')];_0x1266d2[_0xb98a('0x4c')]=qs[_0xb98a('0x4d')](_0x3612c6[_0xb98a('0x45')]['sort']);_0x1266d2['where']=qs[_0xb98a('0x47')](_['pick'](_0x3612c6[_0xb98a('0x45')],_0x41eccb['filters']));if(_0x3612c6[_0xb98a('0x45')][_0xb98a('0x50')]){_0x1266d2[_0xb98a('0x4e')]=_[_0xb98a('0x51')](_0x1266d2[_0xb98a('0x4e')],{'$or':_[_0xb98a('0x3f')](_0x1266d2['attributes'],function(_0x524438){var _0x582853={};_0x582853[_0x524438]={'$like':'%'+_0x3612c6['query'][_0xb98a('0x50')]+'%'};return _0x582853;})});}_0x1266d2=_[_0xb98a('0x51')]({},_0x1266d2,_0x3612c6['options']);return _0x217401['getProactiveActions'](_0x1266d2);}})[_0xb98a('0x23')](function(_0x21af77){if(_0x21af77){_0x152760=_0x21af77['length'];if(!_0x3612c6[_0xb98a('0x45')][_0xb98a('0x6d')](_0xb98a('0x6e'))){_0x1266d2[_0xb98a('0x32')]=qs[_0xb98a('0x32')](_0x3612c6[_0xb98a('0x45')][_0xb98a('0x32')]);_0x1266d2[_0xb98a('0x31')]=qs[_0xb98a('0x31')](_0x3612c6[_0xb98a('0x45')][_0xb98a('0x31')]);}return _0x217401['getProactiveActions'](_0x1266d2);}})[_0xb98a('0x23')](function(_0x2a2750){if(_0x2a2750){return _0x2a2750?{'count':_0x152760,'rows':_0x2a2750}:null;}})[_0xb98a('0x23')](respondWithResult(_0x3d4eb9,null))[_0xb98a('0x2e')](handleError(_0x3d4eb9,null));};exports[_0xb98a('0x112')]=function(_0x68d83b,_0x5d34ce,_0x4215d0){var _0x4ad58e=_0x68d83b[_0xb98a('0x45')][_0xb98a('0x113')]===_0xb98a('0x114')?'offlineForm':'onlineForm';return db['ChatWebsite']['find']({'attributes':['id',_0x4ad58e],'where':{'id':_0x68d83b[_0xb98a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5d34ce,null))[_0xb98a('0x23')](function(_0x3ce798){if(_0x3ce798){var _0x15e10c=_0x3ce798[_0x4ad58e];var _0x1cae7c=_0x15e10c&&_0x15e10c['items']?_0x15e10c[_0xb98a('0x115')]:[];_0x5d34ce[_0xb98a('0xcc')]({'fromKey':_[_0xb98a('0x7f')](_0x15e10c[_0xb98a('0x116')])?undefined:_0x15e10c[_0xb98a('0x116')],'count':_0x1cae7c[_0xb98a('0x4b')],'rows':_0x1cae7c});}})[_0xb98a('0x2e')](handleError(_0x5d34ce,null));};exports[_0xb98a('0x117')]=function(_0x1c8bc3,_0x592994,_0xe7e64b){var _0x100400={'raw':![],'where':{}};var _0x393324={};var _0x30886e={'count':0x0,'rows':[]};return db[_0xb98a('0x40')][_0xb98a('0x6c')]({'where':{'id':_0x1c8bc3[_0xb98a('0x5b')]['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x592994,null))[_0xb98a('0x23')](function(_0x2181fe){if(_0x2181fe){_0x393324['model']=_['keys'](db[_0xb98a('0x118')]['rawAttributes']);_0x393324['query']=_[_0xb98a('0x46')](_0x1c8bc3[_0xb98a('0x45')]);_0x393324[_0xb98a('0x47')]=_[_0xb98a('0x48')](_0x393324[_0xb98a('0x44')],_0x393324[_0xb98a('0x45')]);_0x100400['attributes']=_[_0xb98a('0x48')](_0x393324[_0xb98a('0x44')],qs[_0xb98a('0x4a')](_0x1c8bc3[_0xb98a('0x45')][_0xb98a('0x4a')]));_0x100400[_0xb98a('0x49')]=_0x100400['attributes']['length']?_0x100400['attributes']:_0x393324[_0xb98a('0x44')];if(!_0x1c8bc3[_0xb98a('0x45')]['hasOwnProperty'](_0xb98a('0x6e'))){_0x100400[_0xb98a('0x32')]=qs[_0xb98a('0x32')](_0x1c8bc3[_0xb98a('0x45')][_0xb98a('0x32')]);_0x100400['offset']=qs[_0xb98a('0x31')](_0x1c8bc3[_0xb98a('0x45')][_0xb98a('0x31')]);}_0x100400[_0xb98a('0x4c')]=qs[_0xb98a('0x4d')](_0x1c8bc3['query']['sort']);_0x100400[_0xb98a('0x4e')]=qs[_0xb98a('0x47')](_[_0xb98a('0x4f')](_0x1c8bc3['query'],_0x393324[_0xb98a('0x47')]));_0x100400[_0xb98a('0x4e')][_0xb98a('0x69')]=_0x2181fe['id'];if(_0x1c8bc3['query'][_0xb98a('0x50')]){_0x100400[_0xb98a('0x4e')]=_[_0xb98a('0x51')](_0x100400[_0xb98a('0x4e')],{'$or':_[_0xb98a('0x3f')](_0x100400[_0xb98a('0x49')],function(_0x2fc57b){var _0x19a3ee={};_0x19a3ee[_0x2fc57b]={'$like':'%'+_0x1c8bc3[_0xb98a('0x45')][_0xb98a('0x50')]+'%'};return _0x19a3ee;})});}_0x100400=_['merge']({},_0x100400,_0x1c8bc3[_0xb98a('0x54')]);return db['ChatOfflineMessage'][_0xb98a('0x55')]({'where':_0x100400[_0xb98a('0x4e')]})[_0xb98a('0x23')](function(_0x25e2ba){_0x30886e[_0xb98a('0x55')]=_0x25e2ba;if(_0x1c8bc3[_0xb98a('0x45')][_0xb98a('0x56')]){_0x100400[_0xb98a('0x57')]=[{'all':!![]}];}else{_0x100400['include']=[{'model':db[_0xb98a('0x91')],'as':_0xb98a('0xe9'),'required':![]}];}return db[_0xb98a('0x118')][_0xb98a('0x58')](_0x100400);})[_0xb98a('0x23')](function(_0x263ab3){_0x30886e['rows']=_0x263ab3;return _0x30886e;});}})[_0xb98a('0x23')](respondWithFilteredResult(_0x592994,_0x100400))[_0xb98a('0x2e')](handleError(_0x592994,null));};exports[_0xb98a('0x119')]=function(_0x57ff94,_0x3c803d,_0x2cffbd){return db['ChatWebsite']['find']({'where':{'id':_0x57ff94[_0xb98a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3c803d,null))[_0xb98a('0x23')](function(_0x14d74c){if(_0x14d74c){return _0x14d74c[_0xb98a('0x119')](_0x57ff94[_0xb98a('0x65')][_0xb98a('0x70')],_[_0xb98a('0xe7')](_0x57ff94['body'],[_0xb98a('0x70'),'id'])||{})[_0xb98a('0xbd')](function(_0x438967){for(var _0xcc31c4=0x0;_0xcc31c4<_0x57ff94[_0xb98a('0x65')][_0xb98a('0x70')]['length'];_0xcc31c4+=0x1){socket['emit'](_0xb98a('0x11a'),{'UserId':_0x57ff94[_0xb98a('0x65')][_0xb98a('0x70')][_0xcc31c4],'ChatWebsiteId':_0x57ff94[_0xb98a('0x5b')]['id']});}return _0x438967;});}})[_0xb98a('0x23')](respondWithResult(_0x3c803d,null))[_0xb98a('0x2e')](handleError(_0x3c803d,null));};exports[_0xb98a('0x11b')]=function(_0x3da10b,_0x36ff52,_0x2d7502){return db['ChatWebsite'][_0xb98a('0x5c')]({'where':{'id':_0x3da10b[_0xb98a('0x5b')]['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x36ff52,null))[_0xb98a('0x23')](function(_0x57cc56){if(_0x57cc56){return _0x57cc56[_0xb98a('0x11b')](_0x3da10b[_0xb98a('0x45')][_0xb98a('0x70')])['then'](function(){if(_['isArray'](_0x3da10b[_0xb98a('0x45')][_0xb98a('0x70')])){for(var _0x5217b0=0x0;_0x5217b0<_0x3da10b[_0xb98a('0x45')]['ids']['length'];_0x5217b0+=0x1){socket[_0xb98a('0x11c')](_0xb98a('0x11d'),{'UserId':Number(_0x3da10b['query']['ids'][_0x5217b0]),'ChatWebsiteId':Number(_0x3da10b['params']['id'])});}}else{socket[_0xb98a('0x11c')](_0xb98a('0x11d'),{'UserId':Number(_0x3da10b[_0xb98a('0x45')][_0xb98a('0x70')]),'ChatWebsiteId':Number(_0x3da10b[_0xb98a('0x5b')]['id'])});}});}})[_0xb98a('0x23')](respondWithStatusCode(_0x36ff52,null))[_0xb98a('0x2e')](handleError(_0x36ff52,null));};exports[_0xb98a('0x11e')]=function(_0x469af5,_0x15c987,_0x45c3c7){var _0x362cb4={};var _0x204083={};var _0x403df9;var _0x3959ee;return db[_0xb98a('0x40')][_0xb98a('0x6c')]({'where':{'id':_0x469af5[_0xb98a('0x5b')]['id']}})[_0xb98a('0x23')](handleEntityNotFound(_0x15c987,null))['then'](function(_0x28aedb){if(_0x28aedb){_0x403df9=_0x28aedb;_0x204083['model']=_[_0xb98a('0x46')](db[_0xb98a('0xc6')]['rawAttributes']);_0x204083[_0xb98a('0x45')]=_['keys'](_0x469af5[_0xb98a('0x45')]);_0x204083['filters']=_['intersection'](_0x204083[_0xb98a('0x44')],_0x204083[_0xb98a('0x45')]);_0x362cb4[_0xb98a('0x49')]=_[_0xb98a('0x48')](_0x204083[_0xb98a('0x44')],qs[_0xb98a('0x4a')](_0x469af5[_0xb98a('0x45')]['fields']));_0x362cb4[_0xb98a('0x49')]=_0x362cb4[_0xb98a('0x49')][_0xb98a('0x4b')]?_0x362cb4[_0xb98a('0x49')]:_0x204083[_0xb98a('0x44')];_0x362cb4['order']=qs['sort'](_0x469af5['query'][_0xb98a('0x4d')]);_0x362cb4['where']=qs[_0xb98a('0x47')](_[_0xb98a('0x4f')](_0x469af5[_0xb98a('0x45')],_0x204083['filters']));if(_0x469af5[_0xb98a('0x45')]['filter']){_0x362cb4[_0xb98a('0x4e')]=_[_0xb98a('0x51')](_0x362cb4[_0xb98a('0x4e')],{'$or':_['map'](_0x362cb4[_0xb98a('0x49')],function(_0x114beb){var _0x236451={};_0x236451[_0x114beb]={'$like':'%'+_0x469af5[_0xb98a('0x45')]['filter']+'%'};return _0x236451;})});}_0x362cb4=_[_0xb98a('0x51')]({},_0x362cb4,_0x469af5[_0xb98a('0x54')]);return _0x403df9[_0xb98a('0x11e')](_0x362cb4);}})[_0xb98a('0x23')](function(_0x1eae87){if(_0x1eae87){_0x3959ee=_0x1eae87[_0xb98a('0x4b')];if(!_0x469af5[_0xb98a('0x45')][_0xb98a('0x6d')](_0xb98a('0x6e'))){_0x362cb4[_0xb98a('0x32')]=qs['limit'](_0x469af5[_0xb98a('0x45')][_0xb98a('0x32')]);_0x362cb4[_0xb98a('0x31')]=qs[_0xb98a('0x31')](_0x469af5[_0xb98a('0x45')]['offset']);}return _0x403df9[_0xb98a('0x11e')](_0x362cb4);}})[_0xb98a('0x23')](function(_0xc3d84e){if(_0xc3d84e){return _0xc3d84e?{'count':_0x3959ee,'rows':_0xc3d84e}:null;}})[_0xb98a('0x23')](respondWithResult(_0x15c987,null))[_0xb98a('0x2e')](handleError(_0x15c987,null));}; \ No newline at end of file +var _0x45dc=['textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','catch','params','describe','addDisposition','ChatWebsiteId','findOne','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','addAvatar','agentAvatar','filename','addCustomerAvatar','systemAvatar','file','join','root','server/files/images/logos/default_logo.svg','sitepic','custom','isNil','server/files/images/logos/','download','getAvatar','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','List','Contacts','DESC','ChatApplication','Applications','applications','priority','asc','account','from','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','%s\x20%s','version','unknown','format','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','interaction','messageId','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','Tag','Tags','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','License','increment','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','replace','verticalAlignment'];(function(_0x154f39,_0x2ae186){var _0x592a9d=function(_0x34e254){while(--_0x34e254){_0x154f39['push'](_0x154f39['shift']());}};_0x592a9d(++_0x2ae186);}(_0x45dc,0x137));var _0xc45d=function(_0x4cbdc4,_0x8be7a8){_0x4cbdc4=_0x4cbdc4-0x0;var _0x413c70=_0x45dc[_0x4cbdc4];return _0x413c70;};'use strict';var pdf=require(_0xc45d('0x0'));var emlformat=require(_0xc45d('0x1'));var rimraf=require(_0xc45d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc45d('0x3'));var rp=require('request-promise');var moment=require(_0xc45d('0x4'));var BPromise=require(_0xc45d('0x5'));var Mustache=require(_0xc45d('0x6'));var util=require(_0xc45d('0x7'));var path=require(_0xc45d('0x8'));var sox=require(_0xc45d('0x9'));var csv=require(_0xc45d('0xa'));var ejs=require(_0xc45d('0xb'));var fs=require('fs');var _=require(_0xc45d('0xc'));var squel=require(_0xc45d('0xd'));var crypto=require(_0xc45d('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc45d('0xa'));var querystring=require(_0xc45d('0xf'));var Papa=require(_0xc45d('0x10'));var Redis=require('ioredis');var authService=require(_0xc45d('0x11'));var qs=require(_0xc45d('0x12'));var as=require(_0xc45d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc45d('0x14'))('api');var utils=require(_0xc45d('0x15'));var config=require(_0xc45d('0x16'));var licenseUtil=require(_0xc45d('0x17'));var db=require(_0xc45d('0x18'))['db'];config['redis']=_[_0xc45d('0x19')](config[_0xc45d('0x1a')],{'host':_0xc45d('0x1b'),'port':0x18eb});var socket=require(_0xc45d('0x1c'))(new Redis(config[_0xc45d('0x1a')]));require(_0xc45d('0x1d'))['register'](socket);var jayson=require(_0xc45d('0x1e'));var client=jayson[_0xc45d('0x1f')][_0xc45d('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0xc45d('0x1f')][_0xc45d('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x464010,_0x5901f5,_0x37b80b,_0x1355d1){return new BPromise(function(_0x27777e,_0x40c5b2){var _0x44ca5f=_0x1355d1||client;return _0x44ca5f[_0xc45d('0x21')](_0x464010,_0x37b80b)['then'](function(_0xb840a6){logger[_0xc45d('0x22')](_0xc45d('0x23'),_0x5901f5,_0xc45d('0x24'));logger[_0xc45d('0x25')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5901f5,_0xc45d('0x24'),JSON[_0xc45d('0x26')](_0xb840a6));if(_0xb840a6[_0xc45d('0x27')]){if(_0xb840a6[_0xc45d('0x27')][_0xc45d('0x28')]===0x1f4){logger[_0xc45d('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x5901f5,_0xb840a6['error']['message']);return _0x40c5b2(_0xb840a6['error'][_0xc45d('0x29')]);}logger[_0xc45d('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x5901f5,_0xb840a6['error'][_0xc45d('0x29')]);return _0x27777e(_0xb840a6[_0xc45d('0x27')][_0xc45d('0x29')]);}else{logger[_0xc45d('0x22')](_0xc45d('0x23'),_0x5901f5,_0xc45d('0x24'));_0x27777e(_0xb840a6[_0xc45d('0x2a')][_0xc45d('0x29')]);}})['catch'](function(_0x4d78b1){logger[_0xc45d('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x5901f5,_0x4d78b1);_0x40c5b2(_0x4d78b1);});});}function respondWithStatusCode(_0x5b8495,_0x4e168a){_0x4e168a=_0x4e168a||0xcc;return function(_0x4edb31){if(_0x4edb31){return _0x5b8495[_0xc45d('0x2b')](_0x4e168a);}return _0x5b8495[_0xc45d('0x2c')](_0x4e168a)[_0xc45d('0x2d')]();};}function respondWithResult(_0x3ca96e,_0xb1b21d){_0xb1b21d=_0xb1b21d||0xc8;return function(_0x1a19cc){if(_0x1a19cc){return _0x3ca96e['status'](_0xb1b21d)[_0xc45d('0x2e')](_0x1a19cc);}};}function respondWithFilteredResult(_0x24f292,_0x3928bc){return function(_0x27ac82){if(_0x27ac82){var _0x426b9d=_0x27ac82[_0xc45d('0x2f')],_0x2ff516=_0x3928bc[_0xc45d('0x30')],_0x1c50ec=_0x3928bc[_0xc45d('0x30')]+_0x3928bc[_0xc45d('0x31')],_0x5aeb7e;if(_0x1c50ec>=_0x426b9d){_0x1c50ec=_0x426b9d;_0x5aeb7e=0xc8;}else{_0x5aeb7e=0xce;}_0x24f292[_0xc45d('0x2c')](_0x5aeb7e);return _0x24f292[_0xc45d('0x32')]('Content-Range',_0x2ff516+'-'+_0x1c50ec+'/'+_0x426b9d)['json'](_0x27ac82);}return null;};}function patchUpdates(_0x25f08d){return function(_0x4aa1ae){try{jsonpatch['apply'](_0x4aa1ae,_0x25f08d,!![]);}catch(_0x4c572c){return BPromise[_0xc45d('0x33')](_0x4c572c);}return _0x4aa1ae[_0xc45d('0x34')]();};}function saveUpdates(_0xa83de1,_0x1f6c2f){return function(_0x42bed0){if(_0x42bed0){return _0x42bed0[_0xc45d('0x35')](_0xa83de1)[_0xc45d('0x36')](function(_0x125ec1){return _0x125ec1;});}return null;};}function removeEntity(_0x4bbb7f,_0x1715f7){return function(_0x748a41){if(_0x748a41){return _0x748a41[_0xc45d('0x37')]()['then'](function(){var _0x3f1d64=_0x748a41[_0xc45d('0x38')]({'plain':!![]});var _0x1953b7=_0xc45d('0x39');return db[_0xc45d('0x3a')][_0xc45d('0x37')]({'where':{'type':_0x1953b7,'resourceId':_0x3f1d64['id']}})[_0xc45d('0x36')](function(){return _0x748a41;});})[_0xc45d('0x36')](function(){_0x4bbb7f[_0xc45d('0x2c')](0xcc)[_0xc45d('0x2d')]();});}};}function handleEntityNotFound(_0x3f12dc,_0x27f34f){return function(_0x279189){if(!_0x279189){_0x3f12dc[_0xc45d('0x2b')](0x194);}return _0x279189;};}function handleError(_0x567cff,_0xd766d1){_0xd766d1=_0xd766d1||0x1f4;return function(_0x2eb453){logger[_0xc45d('0x27')](_0x2eb453[_0xc45d('0x3b')]);if(_0x2eb453[_0xc45d('0x3c')]){delete _0x2eb453['name'];}_0x567cff[_0xc45d('0x2c')](_0xd766d1)['send'](_0x2eb453);};}exports[_0xc45d('0x3d')]=function(_0x30fb03,_0x4136aa){var _0x26584a={'include':[{'model':db[_0xc45d('0x3e')],'as':_0xc45d('0x3f')}]},_0x22b4be={},_0x32211b={'count':0x0,'rows':[]};var _0x418ff0=_['map'](db[_0xc45d('0x40')][_0xc45d('0x41')],function(_0x5d2f02){return{'name':_0x5d2f02[_0xc45d('0x42')],'type':_0x5d2f02[_0xc45d('0x43')][_0xc45d('0x44')]};});_0x22b4be[_0xc45d('0x45')]=_[_0xc45d('0x46')](_0x418ff0,_0xc45d('0x3c'));_0x22b4be[_0xc45d('0x47')]=_[_0xc45d('0x48')](_0x30fb03[_0xc45d('0x47')]);_0x22b4be[_0xc45d('0x49')]=_['intersection'](_0x22b4be[_0xc45d('0x45')],_0x22b4be[_0xc45d('0x47')]);_0x26584a[_0xc45d('0x4a')]=_[_0xc45d('0x4b')](_0x22b4be[_0xc45d('0x45')],qs['fields'](_0x30fb03[_0xc45d('0x47')]['fields']));_0x26584a[_0xc45d('0x4a')]=_0x26584a[_0xc45d('0x4a')][_0xc45d('0x4c')]?_0x26584a[_0xc45d('0x4a')]:_0x22b4be[_0xc45d('0x45')];if(!_0x30fb03[_0xc45d('0x47')][_0xc45d('0x4d')](_0xc45d('0x4e'))){_0x26584a[_0xc45d('0x31')]=qs[_0xc45d('0x31')](_0x30fb03[_0xc45d('0x47')][_0xc45d('0x31')]);_0x26584a[_0xc45d('0x30')]=qs['offset'](_0x30fb03[_0xc45d('0x47')]['offset']);}_0x26584a[_0xc45d('0x4f')]=qs[_0xc45d('0x50')](_0x30fb03[_0xc45d('0x47')][_0xc45d('0x50')]);_0x26584a['where']=qs[_0xc45d('0x49')](_[_0xc45d('0x51')](_0x30fb03[_0xc45d('0x47')],_0x22b4be[_0xc45d('0x49')]),_0x418ff0);if(_0x30fb03[_0xc45d('0x47')][_0xc45d('0x52')]){_0x26584a['where']=_['merge'](_0x26584a[_0xc45d('0x53')],{'$or':_[_0xc45d('0x46')](_0x418ff0,function(_0x317951){if(_0x317951[_0xc45d('0x43')]!==_0xc45d('0x54')){var _0x299ccb={};_0x299ccb[_0x317951[_0xc45d('0x3c')]]={'$like':'%'+_0x30fb03[_0xc45d('0x47')]['filter']+'%'};return _0x299ccb;}})});}_0x26584a=_[_0xc45d('0x55')]({},_0x26584a,_0x30fb03[_0xc45d('0x56')]);var _0x2d7dac={'where':_0x26584a[_0xc45d('0x53')]};return db[_0xc45d('0x40')]['count'](_0x2d7dac)[_0xc45d('0x36')](function(_0x52257b){_0x32211b[_0xc45d('0x2f')]=_0x52257b;if(_0x30fb03[_0xc45d('0x47')][_0xc45d('0x57')]){_0x26584a[_0xc45d('0x58')]=[{'all':!![]}];}return db[_0xc45d('0x40')][_0xc45d('0x59')](_0x26584a);})[_0xc45d('0x36')](function(_0x141254){_0x32211b[_0xc45d('0x5a')]=_0x141254;return _0x32211b;})['then'](respondWithFilteredResult(_0x4136aa,_0x26584a))['catch'](handleError(_0x4136aa,null));};exports[_0xc45d('0x5b')]=function(_0x259558,_0x5e0308){var _0x522ad9={'raw':![],'where':{'id':_0x259558['params']['id']},'include':[{'model':db[_0xc45d('0x3e')],'as':_0xc45d('0x3f')}]},_0xaf30f1={};_0xaf30f1['model']=_[_0xc45d('0x48')](db[_0xc45d('0x40')][_0xc45d('0x41')]);_0xaf30f1[_0xc45d('0x47')]=_[_0xc45d('0x48')](_0x259558[_0xc45d('0x47')]);_0xaf30f1[_0xc45d('0x49')]=_[_0xc45d('0x4b')](_0xaf30f1['model'],_0xaf30f1['query']);_0x522ad9[_0xc45d('0x4a')]=_[_0xc45d('0x4b')](_0xaf30f1[_0xc45d('0x45')],qs[_0xc45d('0x5c')](_0x259558['query'][_0xc45d('0x5c')]));_0x522ad9[_0xc45d('0x4a')]=_0x522ad9['attributes'][_0xc45d('0x4c')]?_0x522ad9[_0xc45d('0x4a')]:_0xaf30f1[_0xc45d('0x45')];if(_0x259558[_0xc45d('0x47')]['includeAll']){_0x522ad9[_0xc45d('0x58')]=[{'all':!![]}];}_0x522ad9=_[_0xc45d('0x55')]({},_0x522ad9,_0x259558[_0xc45d('0x56')]);return db[_0xc45d('0x40')][_0xc45d('0x5d')](_0x522ad9)[_0xc45d('0x36')](handleEntityNotFound(_0x5e0308,null))[_0xc45d('0x36')](respondWithResult(_0x5e0308,null))['catch'](handleError(_0x5e0308,null));};exports[_0xc45d('0x5e')]=function(_0x5d9034,_0x4007d2){return db['ChatWebsite'][_0xc45d('0x5e')](_0x5d9034[_0xc45d('0x5f')],{})[_0xc45d('0x36')](function(_0x2a8d03){var _0x12cd11=_0x5d9034['user'][_0xc45d('0x38')]({'plain':!![]});if(!_0x12cd11)throw new Error(_0xc45d('0x60'));if(_0x12cd11[_0xc45d('0x61')]===_0xc45d('0x62')){var _0x508c87=_0x2a8d03[_0xc45d('0x38')]({'plain':!![]});var _0x9b4112=_0xc45d('0x39');return db['UserProfileSection'][_0xc45d('0x5d')]({'where':{'name':_0x9b4112,'userProfileId':_0x12cd11[_0xc45d('0x63')]},'raw':!![]})['then'](function(_0x4d7917){if(_0x4d7917&&_0x4d7917['autoAssociation']===0x0){return db[_0xc45d('0x3a')][_0xc45d('0x5e')]({'name':_0x508c87[_0xc45d('0x3c')],'resourceId':_0x508c87['id'],'type':_0x4d7917[_0xc45d('0x3c')],'sectionId':_0x4d7917['id']},{})[_0xc45d('0x36')](function(){return _0x2a8d03;});}else{return _0x2a8d03;}})[_0xc45d('0x64')](function(_0x3065a4){logger[_0xc45d('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3065a4);throw _0x3065a4;});}return _0x2a8d03;})[_0xc45d('0x36')](respondWithResult(_0x4007d2,0xc9))[_0xc45d('0x64')](handleError(_0x4007d2,null));};exports['update']=function(_0x299da6,_0x44a049){if(_0x299da6['body']['id']){delete _0x299da6[_0xc45d('0x5f')]['id'];}return db[_0xc45d('0x40')][_0xc45d('0x5d')]({'where':{'id':_0x299da6[_0xc45d('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0xc45d('0x3f')}]})[_0xc45d('0x36')](handleEntityNotFound(_0x44a049,null))['then'](saveUpdates(_0x299da6[_0xc45d('0x5f')],null))[_0xc45d('0x36')](respondWithResult(_0x44a049,null))[_0xc45d('0x64')](handleError(_0x44a049,null));};exports[_0xc45d('0x37')]=function(_0x1f17d8,_0xfeb180){return db['ChatWebsite'][_0xc45d('0x5d')]({'where':{'id':_0x1f17d8[_0xc45d('0x65')]['id']}})['then'](handleEntityNotFound(_0xfeb180,null))[_0xc45d('0x36')](removeEntity(_0xfeb180,null))[_0xc45d('0x64')](handleError(_0xfeb180,null));};exports[_0xc45d('0x66')]=function(_0xac2438,_0xf24cde){return db[_0xc45d('0x40')][_0xc45d('0x66')]()[_0xc45d('0x36')](respondWithResult(_0xf24cde,null))[_0xc45d('0x64')](handleError(_0xf24cde,null));};exports[_0xc45d('0x67')]=function(_0x2c6445,_0x4e0ee8,_0x5d6fd1){if(_0x2c6445[_0xc45d('0x5f')]['id']){delete _0x2c6445[_0xc45d('0x5f')]['id'];}return db[_0xc45d('0x40')]['find']({'where':{'id':_0x2c6445['params']['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x4e0ee8,null))[_0xc45d('0x36')](function(_0x53c7c0){if(_0x53c7c0){_0x2c6445[_0xc45d('0x5f')][_0xc45d('0x68')]=_0x53c7c0['id'];return db['Disposition'][_0xc45d('0x5e')](_0x2c6445[_0xc45d('0x5f')]);}})['then'](respondWithResult(_0x4e0ee8,null))['catch'](handleError(_0x4e0ee8,null));};exports['getDispositions']=function(_0x2ec304,_0x841f7f,_0x32457f){var _0x33601f={'raw':![],'where':{}};var _0x24a3dc={};var _0x5b162b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc45d('0x69')]({'where':{'id':_0x2ec304[_0xc45d('0x65')]['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x841f7f,null))[_0xc45d('0x36')](function(_0x237494){if(_0x237494){_0x24a3dc[_0xc45d('0x45')]=_['keys'](db[_0xc45d('0x6a')]['rawAttributes']);_0x24a3dc[_0xc45d('0x47')]=_[_0xc45d('0x48')](_0x2ec304['query']);_0x24a3dc[_0xc45d('0x49')]=_[_0xc45d('0x4b')](_0x24a3dc[_0xc45d('0x45')],_0x24a3dc['query']);_0x33601f[_0xc45d('0x4a')]=_[_0xc45d('0x4b')](_0x24a3dc[_0xc45d('0x45')],qs['fields'](_0x2ec304[_0xc45d('0x47')]['fields']));_0x33601f[_0xc45d('0x4a')]=_0x33601f[_0xc45d('0x4a')]['length']?_0x33601f[_0xc45d('0x4a')]:_0x24a3dc[_0xc45d('0x45')];if(!_0x2ec304['query'][_0xc45d('0x4d')]('nolimit')){_0x33601f[_0xc45d('0x31')]=qs['limit'](_0x2ec304[_0xc45d('0x47')][_0xc45d('0x31')]);_0x33601f[_0xc45d('0x30')]=qs[_0xc45d('0x30')](_0x2ec304[_0xc45d('0x47')][_0xc45d('0x30')]);}_0x33601f[_0xc45d('0x4f')]=qs[_0xc45d('0x50')](_0x2ec304[_0xc45d('0x47')]['sort']);_0x33601f[_0xc45d('0x53')]=qs[_0xc45d('0x49')](_[_0xc45d('0x51')](_0x2ec304[_0xc45d('0x47')],_0x24a3dc[_0xc45d('0x49')]));_0x33601f[_0xc45d('0x53')][_0xc45d('0x68')]=_0x237494['id'];if(_0x2ec304['query']['filter']){_0x33601f[_0xc45d('0x53')]=_[_0xc45d('0x55')](_0x33601f[_0xc45d('0x53')],{'$or':_[_0xc45d('0x46')](_0x33601f[_0xc45d('0x4a')],function(_0x10af35){var _0xa8c701={};_0xa8c701[_0x10af35]={'$like':'%'+_0x2ec304[_0xc45d('0x47')]['filter']+'%'};return _0xa8c701;})});}_0x33601f=_[_0xc45d('0x55')]({},_0x33601f,_0x2ec304[_0xc45d('0x56')]);return db[_0xc45d('0x6a')][_0xc45d('0x2f')]({'where':_0x33601f['where']})[_0xc45d('0x36')](function(_0x250463){_0x5b162b['count']=_0x250463;if(_0x2ec304[_0xc45d('0x47')][_0xc45d('0x57')]){_0x33601f[_0xc45d('0x58')]=[{'all':!![]}];}return db[_0xc45d('0x6a')][_0xc45d('0x59')](_0x33601f);})[_0xc45d('0x36')](function(_0x20ae6e){_0x5b162b['rows']=_0x20ae6e;return _0x5b162b;});}})[_0xc45d('0x36')](respondWithFilteredResult(_0x841f7f,_0x33601f))[_0xc45d('0x64')](handleError(_0x841f7f,null));};exports[_0xc45d('0x6b')]=function(_0x211270,_0x36541a,_0x1d8e5e){return db['ChatWebsite']['find']({'where':{'id':_0x211270['params']['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x36541a,null))[_0xc45d('0x36')](function(_0x28b3f4){if(_0x28b3f4){return _0x28b3f4[_0xc45d('0x6b')](_0x211270[_0xc45d('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x36541a,null))[_0xc45d('0x64')](handleError(_0x36541a,null));};exports[_0xc45d('0x6c')]=function(_0x12693d,_0x121105,_0x24c257){if(_0x12693d[_0xc45d('0x5f')]['id']){delete _0x12693d[_0xc45d('0x5f')]['id'];}return db[_0xc45d('0x40')][_0xc45d('0x5d')]({'where':{'id':_0x12693d[_0xc45d('0x65')]['id']}})['then'](handleEntityNotFound(_0x121105,null))['then'](function(_0x33786d){if(_0x33786d){_0x12693d[_0xc45d('0x5f')][_0xc45d('0x68')]=_0x33786d['id'];return db[_0xc45d('0x6d')][_0xc45d('0x5e')](_0x12693d['body']);}})['then'](respondWithResult(_0x121105,null))['catch'](handleError(_0x121105,null));};exports[_0xc45d('0x6e')]=function(_0x54a041,_0x3b1d43,_0xe1ef66){var _0x2aa7e0={'raw':![],'where':{}};var _0x4a49f0={};var _0x356fa9={'count':0x0,'rows':[]};return db[_0xc45d('0x40')]['findOne']({'where':{'id':_0x54a041['params']['id']}})['then'](handleEntityNotFound(_0x3b1d43,null))['then'](function(_0x1ee87b){if(_0x1ee87b){_0x4a49f0[_0xc45d('0x45')]=_['keys'](db[_0xc45d('0x6d')]['rawAttributes']);_0x4a49f0['query']=_[_0xc45d('0x48')](_0x54a041[_0xc45d('0x47')]);_0x4a49f0[_0xc45d('0x49')]=_[_0xc45d('0x4b')](_0x4a49f0[_0xc45d('0x45')],_0x4a49f0[_0xc45d('0x47')]);_0x2aa7e0['attributes']=_['intersection'](_0x4a49f0[_0xc45d('0x45')],qs[_0xc45d('0x5c')](_0x54a041[_0xc45d('0x47')][_0xc45d('0x5c')]));_0x2aa7e0[_0xc45d('0x4a')]=_0x2aa7e0[_0xc45d('0x4a')][_0xc45d('0x4c')]?_0x2aa7e0[_0xc45d('0x4a')]:_0x4a49f0[_0xc45d('0x45')];if(!_0x54a041[_0xc45d('0x47')][_0xc45d('0x4d')](_0xc45d('0x4e'))){_0x2aa7e0[_0xc45d('0x31')]=qs[_0xc45d('0x31')](_0x54a041[_0xc45d('0x47')][_0xc45d('0x31')]);_0x2aa7e0[_0xc45d('0x30')]=qs[_0xc45d('0x30')](_0x54a041[_0xc45d('0x47')][_0xc45d('0x30')]);}_0x2aa7e0[_0xc45d('0x4f')]=qs[_0xc45d('0x50')](_0x54a041[_0xc45d('0x47')][_0xc45d('0x50')]);_0x2aa7e0[_0xc45d('0x53')]=qs[_0xc45d('0x49')](_[_0xc45d('0x51')](_0x54a041[_0xc45d('0x47')],_0x4a49f0[_0xc45d('0x49')]));_0x2aa7e0[_0xc45d('0x53')][_0xc45d('0x68')]=_0x1ee87b['id'];if(_0x54a041['query'][_0xc45d('0x52')]){_0x2aa7e0['where']=_['merge'](_0x2aa7e0[_0xc45d('0x53')],{'$or':_[_0xc45d('0x46')](_0x2aa7e0[_0xc45d('0x4a')],function(_0x3a2137){var _0x376e83={};_0x376e83[_0x3a2137]={'$like':'%'+_0x54a041[_0xc45d('0x47')]['filter']+'%'};return _0x376e83;})});}_0x2aa7e0=_[_0xc45d('0x55')]({},_0x2aa7e0,_0x54a041[_0xc45d('0x56')]);return db[_0xc45d('0x6d')][_0xc45d('0x2f')]({'where':_0x2aa7e0[_0xc45d('0x53')]})[_0xc45d('0x36')](function(_0x1516e4){_0x356fa9[_0xc45d('0x2f')]=_0x1516e4;if(_0x54a041[_0xc45d('0x47')][_0xc45d('0x57')]){_0x2aa7e0[_0xc45d('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc45d('0x59')](_0x2aa7e0);})[_0xc45d('0x36')](function(_0x36ac63){_0x356fa9[_0xc45d('0x5a')]=_0x36ac63;return _0x356fa9;});}})[_0xc45d('0x36')](respondWithFilteredResult(_0x3b1d43,_0x2aa7e0))[_0xc45d('0x64')](handleError(_0x3b1d43,null));};exports[_0xc45d('0x6f')]=function(_0x418d57,_0x40ce00,_0x311005){return db[_0xc45d('0x40')]['find']({'where':{'id':_0x418d57[_0xc45d('0x65')]['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x40ce00,null))[_0xc45d('0x36')](function(_0x52ac58){if(_0x52ac58){return _0x52ac58[_0xc45d('0x6f')](_0x418d57['query'][_0xc45d('0x70')]);}})[_0xc45d('0x36')](respondWithStatusCode(_0x40ce00,null))['catch'](handleError(_0x40ce00,null));};exports[_0xc45d('0x71')]=function(_0x4c803f,_0x39d001,_0x58f8a5){_0x4c803f['body']['sitepic']=_0x4c803f['file']['filename'];return db['ChatWebsite'][_0xc45d('0x5d')]({'where':{'id':_0x4c803f[_0xc45d('0x65')]['id']}})['then'](handleEntityNotFound(_0x39d001,null))[_0xc45d('0x36')](saveUpdates(_0x4c803f[_0xc45d('0x5f')],null))[_0xc45d('0x36')](respondWithResult(_0x39d001,null))[_0xc45d('0x64')](handleError(_0x39d001,null));};exports[_0xc45d('0x72')]=function(_0x2517a3,_0x21dc98,_0x67c35a){_0x2517a3[_0xc45d('0x5f')][_0xc45d('0x73')]=_0x2517a3['file'][_0xc45d('0x74')];return db[_0xc45d('0x40')][_0xc45d('0x5d')]({'where':{'id':_0x2517a3['params']['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x21dc98,null))[_0xc45d('0x36')](saveUpdates(_0x2517a3['body'],null))[_0xc45d('0x36')](respondWithResult(_0x21dc98,null))[_0xc45d('0x64')](handleError(_0x21dc98,null));};exports[_0xc45d('0x75')]=function(_0x165b31,_0x1fe4b0,_0x440428){_0x165b31['body']['customerAvatar']=_0x165b31['file']['filename'];return db[_0xc45d('0x40')][_0xc45d('0x5d')]({'where':{'id':_0x165b31[_0xc45d('0x65')]['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x1fe4b0,null))[_0xc45d('0x36')](saveUpdates(_0x165b31[_0xc45d('0x5f')],null))['then'](respondWithResult(_0x1fe4b0,null))[_0xc45d('0x64')](handleError(_0x1fe4b0,null));};exports['addSystemAvatar']=function(_0x5852da,_0x3d563c,_0x4e42d7){_0x5852da[_0xc45d('0x5f')][_0xc45d('0x76')]=_0x5852da[_0xc45d('0x77')][_0xc45d('0x74')];return db['ChatWebsite'][_0xc45d('0x5d')]({'where':{'id':_0x5852da['params']['id']}})['then'](handleEntityNotFound(_0x3d563c,null))[_0xc45d('0x36')](saveUpdates(_0x5852da['body'],null))[_0xc45d('0x36')](respondWithResult(_0x3d563c,null))['catch'](handleError(_0x3d563c,null));};exports['getLogo']=function(_0x26aee8,_0x34db00,_0x1c9a3c){var _0x33c15a=path[_0xc45d('0x78')](config[_0xc45d('0x79')],_0xc45d('0x7a'));var _0x86e36f={'where':{'id':_0x26aee8[_0xc45d('0x65')]['id']},'attributes':['id',_0xc45d('0x7b')],'raw':!![]};var _0x4d7c0d=![];return require(_0xc45d('0x17'))['getLicense']()[_0xc45d('0x36')](function(_0x30f04a){if(_0x30f04a){_0x4d7c0d=_0x30f04a[_0xc45d('0x7c')];}})[_0xc45d('0x36')](function(){return db[_0xc45d('0x40')][_0xc45d('0x5d')](_0x86e36f);})[_0xc45d('0x36')](handleEntityNotFound(_0x34db00,null))[_0xc45d('0x36')](function(_0x9ac5a1){if(_0x9ac5a1){if(!_[_0xc45d('0x7d')](_0x9ac5a1[_0xc45d('0x7b')])){if(fs['existsSync'](path[_0xc45d('0x78')](config['root'],_0xc45d('0x7e'),_0x9ac5a1[_0xc45d('0x7b')]))&&_0x4d7c0d){_0x33c15a=path[_0xc45d('0x78')](config['root'],'server/files/images/logos/',_0x9ac5a1[_0xc45d('0x7b')]);}}return _0x34db00[_0xc45d('0x7f')](_0x33c15a);}})['catch'](handleError(_0x34db00,null));};exports[_0xc45d('0x80')]=function(_0x1fd76e,_0x15af40,_0x34eb5d){var _0x298f96=path[_0xc45d('0x78')](config[_0xc45d('0x79')],'server/files/images/avatars/default_avatar.png');var _0x58e438={'where':{'id':_0x1fd76e[_0xc45d('0x65')]['id']},'attributes':['id',_0xc45d('0x73')],'raw':!![]};return db[_0xc45d('0x40')][_0xc45d('0x5d')](_0x58e438)[_0xc45d('0x36')](handleEntityNotFound(_0x15af40,null))[_0xc45d('0x36')](function(_0x260788){if(_0x260788){if(!_[_0xc45d('0x7d')](_0x260788['agentAvatar'])){if(fs[_0xc45d('0x81')](path[_0xc45d('0x78')](config[_0xc45d('0x79')],_0xc45d('0x82'),_0x260788[_0xc45d('0x73')]))){_0x298f96=path[_0xc45d('0x78')](config[_0xc45d('0x79')],'server/files/images/avatars/',_0x260788[_0xc45d('0x73')]);}}return _0x15af40[_0xc45d('0x7f')](_0x298f96);}})[_0xc45d('0x64')](handleError(_0x15af40,null));};exports['getCustomerAvatar']=function(_0x195ca3,_0x43f029,_0x2844af){var _0x1c9a3e=path[_0xc45d('0x78')](config[_0xc45d('0x79')],_0xc45d('0x83'));var _0x4cbbd7={'where':{'id':_0x195ca3[_0xc45d('0x65')]['id']},'attributes':['id',_0xc45d('0x84'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0xc45d('0x5d')](_0x4cbbd7)['then'](handleEntityNotFound(_0x43f029,null))[_0xc45d('0x36')](function(_0x6a70c5){if(_0x6a70c5){if(!_['isNil'](_0x6a70c5[_0xc45d('0x84')])){if(fs[_0xc45d('0x81')](path[_0xc45d('0x78')](config['root'],_0xc45d('0x82'),_0x6a70c5[_0xc45d('0x84')]))&&_0x6a70c5[_0xc45d('0x85')]){_0x1c9a3e=path[_0xc45d('0x78')](config[_0xc45d('0x79')],'server/files/images/avatars/',_0x6a70c5[_0xc45d('0x84')]);}}return _0x43f029[_0xc45d('0x7f')](_0x1c9a3e);}})['catch'](handleError(_0x43f029,null));};exports['getSystemAvatar']=function(_0x2ef40d,_0x78ec8,_0x35990d){var _0x211deb=path['join'](config[_0xc45d('0x79')],_0xc45d('0x86'));var _0x2bb618={'where':{'id':_0x2ef40d[_0xc45d('0x65')]['id']},'attributes':['id',_0xc45d('0x76')],'raw':!![]};return db[_0xc45d('0x40')][_0xc45d('0x5d')](_0x2bb618)[_0xc45d('0x36')](handleEntityNotFound(_0x78ec8,null))['then'](function(_0x4650c1){if(_0x4650c1){if(!_[_0xc45d('0x7d')](_0x4650c1[_0xc45d('0x76')])){if(fs[_0xc45d('0x81')](path[_0xc45d('0x78')](config[_0xc45d('0x79')],'server/files/images/avatars/',_0x4650c1['systemAvatar']))){_0x211deb=path[_0xc45d('0x78')](config[_0xc45d('0x79')],_0xc45d('0x82'),_0x4650c1['systemAvatar']);}}return _0x78ec8['download'](_0x211deb);}})[_0xc45d('0x64')](handleError(_0x78ec8,null));};exports[_0xc45d('0x87')]=function(_0x1127f0,_0x1a9ee0,_0x3fee45){var _0x10c2cf=require(_0xc45d('0x88'));var _0x38d082=new _0x10c2cf();var _0x1831a7=_0x38d082['setUA'](_0x1127f0[_0xc45d('0x89')][_0xc45d('0x8a')])[_0xc45d('0x8b')]();var _0x43d052={'body':_0x1127f0[_0xc45d('0x5f')],'channel':_0xc45d('0x8c')};var _0x551030=[];var _0x12589c=[];var _0x1a46bf={};var _0x283c5e=![];return db[_0xc45d('0x8d')]['describe']()[_0xc45d('0x36')](function(_0x46cf51){if(!_0x46cf51){throw new db[(_0xc45d('0x8e'))][(_0xc45d('0x8f'))](_0xc45d('0x90'));}_0x551030=_[_0xc45d('0x91')](_[_0xc45d('0x48')](_0x46cf51),[_0xc45d('0x92'),_0xc45d('0x93')]);_0x12589c=_[_0xc45d('0x91')](_[_0xc45d('0x48')](_0x46cf51),[_0xc45d('0x92'),_0xc45d('0x93'),_0xc45d('0x94'),_0xc45d('0x95')]);if(_0x1127f0[_0xc45d('0x5f')]['id']){delete _0x1127f0[_0xc45d('0x5f')]['id'];}if(_[_0xc45d('0x7d')](_0x1127f0['body']['from'])){throw new db[(_0xc45d('0x8e'))][(_0xc45d('0x8f'))](_0xc45d('0x96'));}if(_[_0xc45d('0x7d')](_0x1127f0['body'][_0xc45d('0x5f')])||_0x1127f0[_0xc45d('0x5f')]['body']===''){throw new db[(_0xc45d('0x8e'))][(_0xc45d('0x8f'))](_0xc45d('0x97'));}if(_[_0xc45d('0x7d')](_0x1127f0[_0xc45d('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0xc45d('0x8f'))](_0xc45d('0x98')+_0x12589c);}if(!_[_0xc45d('0x99')](_0x12589c,_0x1127f0[_0xc45d('0x5f')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x12589c);}_0x1a46bf[_0x1127f0[_0xc45d('0x5f')][_0xc45d('0x9a')]]=_0x1127f0['body']['from'];})[_0xc45d('0x36')](function(){return db[_0xc45d('0x40')][_0xc45d('0x5d')]({'where':{'id':_0x1127f0[_0xc45d('0x65')]['id']},'include':[{'model':db[_0xc45d('0x9b')],'as':_0xc45d('0x9c'),'include':[{'model':db[_0xc45d('0x8d')],'as':_0xc45d('0x9d'),'where':_0x1a46bf,'limit':0x1,'order':[['updatedAt',_0xc45d('0x9e')]]}]},{'model':db[_0xc45d('0x9f')],'as':'Applications'}]});})[_0xc45d('0x36')](handleEntityNotFound(_0x1a9ee0,null))[_0xc45d('0x36')](function(_0x2b12f4){if(_0x2b12f4&&_0x2b12f4[_0xc45d('0x9c')]){_0x43d052['account']=_0x2b12f4;_0x43d052['applications']=_0x2b12f4[_0xc45d('0xa0')];_0x43d052['list']=_0x2b12f4[_0xc45d('0x9c')];_0x43d052[_0xc45d('0xa1')]=_['orderBy'](_0x43d052[_0xc45d('0xa1')],[_0xc45d('0xa2')],[_0xc45d('0xa3')]);if(_0x43d052[_0xc45d('0xa4')][_0xc45d('0xa0')]){delete _0x43d052[_0xc45d('0xa4')]['Applications'];}if(_0x43d052[_0xc45d('0xa4')][_0xc45d('0x9c')]&&_0x43d052[_0xc45d('0xa4')]['List'][_0xc45d('0x9d')][_0xc45d('0x4c')]){return _0x43d052[_0xc45d('0xa4')][_0xc45d('0x9c')][_0xc45d('0x9d')][0x0];}var _0x466426=_[_0xc45d('0x19')](_0x1127f0[_0xc45d('0x5f')],{'firstName':_0x1127f0['body']['from'],'ListId':_0x2b12f4[_0xc45d('0x95')]});_0x466426[_0x1127f0['body'][_0xc45d('0x9a')]]=_0x1127f0['body'][_0xc45d('0xa5')];return db[_0xc45d('0x8d')][_0xc45d('0x5e')](_0x466426,{'fields':_0x551030,'raw':!![]});}})[_0xc45d('0x36')](handleEntityNotFound(_0x1a9ee0,null))[_0xc45d('0x36')](function(_0x4d7f91){_0x43d052[_0xc45d('0xa6')]=_0x4d7f91;var _0x25f6ca=_0x1127f0[_0xc45d('0x5f')][_0xc45d('0xa7')];if(_0x1127f0[_0xc45d('0x89')][_0xc45d('0xa8')]){_0x25f6ca=_0x1127f0[_0xc45d('0x89')][_0xc45d('0xa8')];}else if(_0x1127f0['headers'][_0xc45d('0xa9')]){_0x25f6ca=_[_0xc45d('0xaa')](_0x1127f0[_0xc45d('0x89')][_0xc45d('0xa9')]['split'](','));}if(_0x4d7f91){var _0x234df7={'ContactId':_0x4d7f91['id'],'ChatWebsiteId':_0x1127f0[_0xc45d('0x65')]['id'],'from':(_0x4d7f91[_0xc45d('0xab')]||'')+'\x20'+(_0x4d7f91[_0xc45d('0xac')]||''),'customerIp':_0x25f6ca,'customerPort':_0x1127f0[_0xc45d('0x89')][_0xc45d('0xad')]?_0x1127f0[_0xc45d('0x89')][_0xc45d('0xad')]:null,'referer':_0x1127f0[_0xc45d('0x5f')][_0xc45d('0xae')],'browserName':_0x1831a7[_0xc45d('0xaf')]['name']&&_0x1831a7[_0xc45d('0xaf')]['version']?util['format'](_0xc45d('0xb0'),_0x1831a7['browser'][_0xc45d('0x3c')],_0x1831a7[_0xc45d('0xaf')][_0xc45d('0xb1')]):_0xc45d('0xb2'),'browserVersion':_0x1831a7[_0xc45d('0xaf')]['version']||_0xc45d('0xb2'),'osName':util[_0xc45d('0xb3')](_0xc45d('0xb0'),_0x1831a7['os']['name'],_0x1831a7['os']['version']),'osVersion':_0x1831a7['os'][_0xc45d('0xb1')],'deviceModel':_0x1831a7[_0xc45d('0xb4')][_0xc45d('0x45')]&&_0x1831a7[_0xc45d('0xb4')]['vendor']?util[_0xc45d('0xb3')](_0xc45d('0xb5'),_0x1831a7['device']['model'],_0x1831a7[_0xc45d('0xb4')][_0xc45d('0xb6')],_0x1831a7[_0xc45d('0xb4')][_0xc45d('0x43')]):null,'deviceVendor':_0x1831a7[_0xc45d('0xb4')]['vendor'],'deviceType':_0x1831a7[_0xc45d('0xb4')][_0xc45d('0x43')],'formData':JSON[_0xc45d('0x26')](_0x1127f0[_0xc45d('0x5f')])};var _0x38cbfb={'ChatWebsiteId':_0x1127f0['params']['id'],'closed':![]};if(_0x1127f0[_0xc45d('0x5f')][_0xc45d('0xb7')]){_0x38cbfb[_0xc45d('0xb7')]=_0x1127f0[_0xc45d('0x5f')]['threadId'];return db[_0xc45d('0xb8')][_0xc45d('0x5d')]({'where':_0x38cbfb})[_0xc45d('0x36')](function(_0x57da66){if(_0x57da66){return[_0x57da66,![]];}_0x234df7[_0xc45d('0xb7')]=_0x1127f0[_0xc45d('0x5f')]['threadId'];_0x234df7[_0xc45d('0xb9')]=_0x1127f0[_0xc45d('0x5f')]['externalUrl'];return db[_0xc45d('0xb8')][_0xc45d('0x5e')](_0x234df7)[_0xc45d('0x36')](function(_0x2c9d38){return[_0x2c9d38,!![]];});});}_0x38cbfb['ContactId']=_0x4d7f91['id'];if(_0x1127f0[_0xc45d('0x5f')][_0xc45d('0xba')]&&_0x1127f0[_0xc45d('0x5f')][_0xc45d('0xba')]['id']){_0x38cbfb['id']=_0x1127f0[_0xc45d('0x5f')][_0xc45d('0xba')]['id'];return db[_0xc45d('0xb8')]['find']({'where':_0x38cbfb})[_0xc45d('0x36')](function(_0x3d51e1){if(_0x3d51e1){return[_0x3d51e1,![]];}return db[_0xc45d('0xb8')][_0xc45d('0x5e')](_0x234df7)[_0xc45d('0x36')](function(_0x2e1ab9){return[_0x2e1ab9,!![]];});});}return db[_0xc45d('0xb8')][_0xc45d('0x5e')](_0x234df7)[_0xc45d('0x36')](function(_0x507862){return[_0x507862,!![]];});}})['spread'](function(_0x4410e4,_0x34e444){if(_0x4410e4){_0x283c5e=_0x34e444;if(!_0x34e444){var _0x1c9190={'from':(_0x43d052[_0xc45d('0xa6')]['firstName']||'')+'\x20'+(_0x43d052[_0xc45d('0xa6')][_0xc45d('0xac')]||'')};if(_0x1127f0[_0xc45d('0x5f')][_0xc45d('0xb7')]&&_0x1127f0[_0xc45d('0x5f')][_0xc45d('0xbb')]&&_0x1127f0['body'][_0xc45d('0xb7')]!=_0x1127f0['body'][_0xc45d('0xbb')]){_0x1c9190['threadId']=_0x1127f0[_0xc45d('0x5f')]['messageId'];}return _0x4410e4[_0xc45d('0x35')](_0x1c9190);}else{return _0x4410e4;}}})[_0xc45d('0x36')](function(_0x194ef2){_0x43d052['interaction']=_0x194ef2[_0xc45d('0x38')]({'plain':!![]});_0x43d052[_0xc45d('0xba')][_0xc45d('0xbc')]=_0x283c5e;if(_0x43d052[_0xc45d('0xba')][_0xc45d('0xbc')]){if(_0x43d052[_0xc45d('0xa4')][_0xc45d('0xbd')]){_0x43d052[_0xc45d('0xa1')][_0xc45d('0xbe')]({'id':0x0,'priority':_0x43d052[_0xc45d('0xa1')][_0xc45d('0x4c')]+0x1,'app':_0xc45d('0xbf'),'appdata':'unmanaged','interval':_0xc45d('0xc0')});}}return db['ChatMessage'][_0xc45d('0x5e')]({'body':_0x1127f0[_0xc45d('0x5f')][_0xc45d('0x5f')],'ChatWebsiteId':_0x1127f0[_0xc45d('0x65')]['id'],'ChatInteractionId':_0x194ef2['id'],'direction':'in','ContactId':_0x43d052[_0xc45d('0xa6')]['id'],'AttachmentId':_0x1127f0[_0xc45d('0x5f')][_0xc45d('0xc1')]});})[_0xc45d('0x36')](function(_0x2d5c14){_0x43d052[_0xc45d('0x29')]=_0x2d5c14;if(_0x43d052[_0xc45d('0xba')][_0xc45d('0xc2')]){return db[_0xc45d('0xc3')][_0xc45d('0x5d')]({'attributes':['id',_0xc45d('0x3c')],'where':{'id':_0x43d052[_0xc45d('0xba')][_0xc45d('0xc2')]}})[_0xc45d('0x36')](function(_0x3ab742){if(_0x3ab742){_0x43d052[_0xc45d('0xa1')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc45d('0xc4'),'appdata':_0x3ab742[_0xc45d('0x3c')]+','+(_0x43d052['account'][_0xc45d('0xc5')]||0xa),'interval':_0xc45d('0xc0')});_0x43d052[_0xc45d('0xc6')]=!![];}return respondWithRpcPromise('Start',_0xc45d('0xc7'),_0x43d052);});}return respondWithRpcPromise(_0xc45d('0xc8'),_0xc45d('0xc7'),_0x43d052);})['then'](function(_0x580684){respondWithRpcPromise(_0xc45d('0xc9'),_0xc45d('0xc9'),{'event':_0xc45d('0x87'),'message':_0x580684},client9002);return _0x580684;})['then'](respondWithResult(_0x1a9ee0,null))['catch'](handleError(_0x1a9ee0,null));};exports['offline']=function(_0x1e7067,_0x19af24,_0x8dcda6){var _0x54fa,_0x128758,_0x5f2bb3;var _0x270f4e=[];var _0x2d211d=[];var _0xdfab5c={};return db['CmContact'][_0xc45d('0x66')]()['then'](function(_0xd061be){if(!_0xd061be){throw new db['Sequelize'][(_0xc45d('0x8f'))](_0xc45d('0x90'));}_0x2d211d=_[_0xc45d('0x91')](_[_0xc45d('0x48')](_0xd061be),[_0xc45d('0x92'),'updatedAt']);_0x270f4e=_['difference'](_[_0xc45d('0x48')](_0xd061be),['createdAt',_0xc45d('0x93'),_0xc45d('0x94'),_0xc45d('0x95')]);if(_0x1e7067[_0xc45d('0x5f')]['id']){delete _0x1e7067['body']['id'];}if(_['isNil'](_0x1e7067[_0xc45d('0x5f')][_0xc45d('0xa5')])){throw _0x19af24['status'](0x1f4)[_0xc45d('0xca')](new db[(_0xc45d('0x8e'))][(_0xc45d('0x8f'))](_0xc45d('0x96')));}if(_[_0xc45d('0x7d')](_0x1e7067[_0xc45d('0x5f')][_0xc45d('0x5f')])||_0x1e7067[_0xc45d('0x5f')][_0xc45d('0x5f')]===''){throw _0x19af24[_0xc45d('0x2c')](0x1f4)['send'](new db['Sequelize'][(_0xc45d('0x8f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xc45d('0x7d')](_0x1e7067[_0xc45d('0x5f')][_0xc45d('0xcb')])){throw _0x19af24[_0xc45d('0x2c')](0x1f4)['send'](new db['Sequelize'][(_0xc45d('0x8f'))](_0xc45d('0xcc')+_0x270f4e));}if(!_[_0xc45d('0x99')](_0x270f4e,_0x1e7067['body'][_0xc45d('0xcb')])){throw _0x19af24[_0xc45d('0x2c')](0x1f4)[_0xc45d('0xca')](new db[(_0xc45d('0x8e'))][(_0xc45d('0x8f'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x270f4e));}_0xdfab5c[_0x1e7067[_0xc45d('0x5f')][_0xc45d('0xcb')]]=_0x1e7067[_0xc45d('0x5f')]['from'];})[_0xc45d('0x36')](function(){return db[_0xc45d('0x40')][_0xc45d('0x5d')]({'where':{'id':_0x1e7067[_0xc45d('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0xc45d('0x9c')}]});})['then'](handleEntityNotFound(_0x19af24,null))[_0xc45d('0x36')](function(_0x310e3f){if(_0x310e3f&&_0x310e3f[_0xc45d('0x9c')]){_0x128758=_0x310e3f;var _0x16f007=_[_0xc45d('0x19')](_0x1e7067[_0xc45d('0x5f')],{'firstName':_0x1e7067[_0xc45d('0x5f')][_0xc45d('0xa5')],'phone':_0x1e7067[_0xc45d('0x5f')][_0xc45d('0xa5')],'ListId':_0x310e3f[_0xc45d('0x95')]});_0x16f007[_0x1e7067['body'][_0xc45d('0xcb')]]=_0x1e7067[_0xc45d('0x5f')]['from'];return db[_0xc45d('0x8d')][_0xc45d('0xcd')]({'where':_0xdfab5c,'defaults':_0x16f007});}})[_0xc45d('0xce')](function(_0x2433e1){if(_0x2433e1){_0x5f2bb3=_0x2433e1;var _0x1a44a3=fs['readFileSync'](path[_0xc45d('0x78')](config[_0xc45d('0x79')],_0xc45d('0xcf')),_0xc45d('0xd0'));var _0x20031f=ejs[_0xc45d('0xd1')](_0x1a44a3,{'body':_[_0xc45d('0xd2')](_0x1e7067[_0xc45d('0x5f')][_0xc45d('0x5f')]),'bodyTitle':_0x128758[_0xc45d('0xd3')]});return db[_0xc45d('0xd4')]['create']({'body':_0x20031f,'ContactId':_0x2433e1['id'],'ChatWebsiteId':_0x128758['id']});}})[_0xc45d('0x36')](function(_0x5f086a){if(_0x5f086a){_0x54fa=_0x5f086a;return db[_0xc45d('0xd5')][_0xc45d('0x69')]({'where':{'service':!![]},'include':[{'model':db[_0xc45d('0xd6')],'as':_0xc45d('0xd7'),'raw':!![]}]});}})['then'](function(_0x299725){if(_0x299725&&_0x299725[_0xc45d('0xd7')]&&_0x128758['forwardOfflineAddress']){var _0x5c6d50={'tls':{'rejectUnauthorized':![]}};if(_0x299725['Smtp'][_0xc45d('0xd8')]){_0x5c6d50['service']=_0x299725['Smtp'][_0xc45d('0xd8')];}else{_0x5c6d50[_0xc45d('0xd9')]=_0x299725[_0xc45d('0xd7')]['host'];_0x5c6d50['port']=_0x299725[_0xc45d('0xd7')][_0xc45d('0xda')];_0x5c6d50[_0xc45d('0xdb')]=_0x299725[_0xc45d('0xd7')][_0xc45d('0xdb')];}if(_0x299725[_0xc45d('0xd7')][_0xc45d('0xdc')]){_0x5c6d50[_0xc45d('0xdd')]={'user':_0x299725[_0xc45d('0xd7')]['user'],'pass':_0x299725[_0xc45d('0xd7')][_0xc45d('0xde')]};}return respondWithRpcPromise('SendMail',_0xc45d('0xdf'),{'account':_0x5c6d50,'message':{'from':util[_0xc45d('0xb3')](_0xc45d('0xe0'),_0x299725[_0xc45d('0x3c')],_0x299725[_0xc45d('0xe1')]||_0x299725[_0xc45d('0xd7')]['user']),'to':_0x128758[_0xc45d('0xe2')],'subject':_0x128758[_0xc45d('0xe3')],'text':_0x54fa[_0xc45d('0x5f')]}},client9003)[_0xc45d('0x36')](function(){return _0x54fa;})[_0xc45d('0x64')](function(_0x5db8fc){console[_0xc45d('0x27')](_0x5db8fc);});}})[_0xc45d('0x36')](function(){if(_0x54fa){return _0x54fa;}})[_0xc45d('0x36')](respondWithResult(_0x19af24,null))[_0xc45d('0x64')](handleError(_0x19af24,null));};exports[_0xc45d('0xe4')]=function(_0x18290c,_0x30f332,_0xc71983){return db['ChatInteraction'][_0xc45d('0x5d')]({'where':{'id':_0x18290c[_0xc45d('0x65')]['id']}})['then'](handleEntityNotFound(_0x30f332,null))['then'](function(_0x5c126e){if(_0x5c126e){return _0x5c126e['addInteraction'](_0x18290c[_0xc45d('0x5f')][_0xc45d('0x70')],_[_0xc45d('0xe5')](_0x18290c[_0xc45d('0x5f')],[_0xc45d('0x70'),'id'])||{});}})[_0xc45d('0x36')](respondWithResult(_0x30f332,null))[_0xc45d('0x64')](handleError(_0x30f332,null));};exports[_0xc45d('0xe6')]=function(_0x342f84,_0x5eb362,_0x212fab){var _0x4a7126={'raw':![],'where':{}};var _0x4f1df2={};var _0x55d0ee={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc45d('0x69')]({'where':{'id':_0x342f84[_0xc45d('0x65')]['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x5eb362,null))[_0xc45d('0x36')](function(_0x3e023f){if(_0x3e023f){_0x4f1df2[_0xc45d('0x45')]=_[_0xc45d('0x48')](db[_0xc45d('0xb8')][_0xc45d('0x41')]);_0x4f1df2[_0xc45d('0x47')]=_[_0xc45d('0x48')](_0x342f84[_0xc45d('0x47')]);_0x4f1df2[_0xc45d('0x49')]=_[_0xc45d('0x4b')](_0x4f1df2['model'],_0x4f1df2['query']);_0x4a7126['attributes']=_['intersection'](_0x4f1df2[_0xc45d('0x45')],qs['fields'](_0x342f84[_0xc45d('0x47')]['fields']));_0x4a7126[_0xc45d('0x4a')]=_0x4a7126[_0xc45d('0x4a')][_0xc45d('0x4c')]?_0x4a7126[_0xc45d('0x4a')]:_0x4f1df2[_0xc45d('0x45')];if(!_0x342f84['query'][_0xc45d('0x4d')](_0xc45d('0x4e'))){_0x4a7126['limit']=qs['limit'](_0x342f84[_0xc45d('0x47')][_0xc45d('0x31')]);_0x4a7126[_0xc45d('0x30')]=qs['offset'](_0x342f84[_0xc45d('0x47')]['offset']);}_0x4a7126[_0xc45d('0x4f')]=qs['sort'](_0x342f84[_0xc45d('0x47')][_0xc45d('0x50')]);_0x4a7126[_0xc45d('0x53')]=qs['filters'](_[_0xc45d('0x51')](_0x342f84[_0xc45d('0x47')],_0x4f1df2['filters']));_0x4a7126[_0xc45d('0x53')][_0xc45d('0x68')]=_0x3e023f['id'];if(_0x342f84[_0xc45d('0x47')][_0xc45d('0x52')]){_0x4a7126[_0xc45d('0x53')]=_[_0xc45d('0x55')](_0x4a7126[_0xc45d('0x53')],{'$or':_[_0xc45d('0x46')](_0x4a7126['attributes'],function(_0x72c3c0){var _0x834b29={};_0x834b29[_0x72c3c0]={'$like':'%'+_0x342f84[_0xc45d('0x47')]['filter']+'%'};return _0x834b29;})});}_0x4a7126=_[_0xc45d('0x55')]({},_0x4a7126,_0x342f84[_0xc45d('0x56')]);return db[_0xc45d('0xb8')]['count']({'where':_0x4a7126[_0xc45d('0x53')]})['then'](function(_0x254773){_0x55d0ee['count']=_0x254773;if(_0x342f84[_0xc45d('0x47')][_0xc45d('0x57')]){_0x4a7126[_0xc45d('0x58')]=[{'model':db[_0xc45d('0x8d')],'as':_0xc45d('0xe7'),'required':![]},{'model':db['User'],'as':_0xc45d('0xe8'),'attributes':[_0xc45d('0x3c'),'fullname','internal'],'required':![]},{'model':db[_0xc45d('0xe9')],'as':_0xc45d('0xea'),'attributes':['id',_0xc45d('0x3c'),'color'],'where':_0x342f84[_0xc45d('0x47')][_0xc45d('0xeb')]?{'id':_0x342f84['query'][_0xc45d('0xeb')]}:undefined,'required':_0x342f84['query']['tag']?!![]:![]}];}return db['ChatInteraction'][_0xc45d('0x59')](_0x4a7126);})[_0xc45d('0x36')](function(_0x4721e7){_0x55d0ee['rows']=_0x4721e7;return _0x55d0ee;});}})[_0xc45d('0x36')](respondWithFilteredResult(_0x5eb362,_0x4a7126))[_0xc45d('0x64')](handleError(_0x5eb362,null));};function iftimePromise(_0x15c2b3,_0x3f6b64){return respondWithRpcPromise(_0xc45d('0xec'),_0xc45d('0xed'),{'command':_0x3f6b64['timezone']?util[_0xc45d('0xb3')](_0xc45d('0xee'),_0x15c2b3[_0xc45d('0xef')],_0x3f6b64[_0xc45d('0xf0')]):util[_0xc45d('0xb3')](_0xc45d('0xf1'),_0x15c2b3[_0xc45d('0xef')])},client9002)[_0xc45d('0x36')](function(_0x1e4afa){var _0x5552cd=_0x1e4afa&&_0x1e4afa[_0xc45d('0xf2')](_0xc45d('0xf3'))>=0x0?!![]:![];logger[_0xc45d('0x22')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3f6b64['id'],_0x15c2b3['id'],_0x15c2b3[_0xc45d('0xef')],_0x5552cd?_0xc45d('0xf4'):_0xc45d('0xf5'),_0x3f6b64[_0xc45d('0xf0')]?_0x3f6b64[_0xc45d('0xf0')]:_0xc45d('0xf6'));return _0x5552cd;})[_0xc45d('0x64')](function(_0x52b8b0){logger[_0xc45d('0x27')](_0xc45d('0xf7'),_0x3f6b64['id'],_0x15c2b3['id'],_0x15c2b3[_0xc45d('0xef')],util[_0xc45d('0xf8')](_0x52b8b0,{'showHidden':![],'depth':null}),_0x3f6b64[_0xc45d('0xf0')]?_0x3f6b64['timezone']:_0xc45d('0xf6'));return![];});}exports[_0xc45d('0xed')]=function(_0x4506d5,_0x13c96e,_0x592c01){var _0x5e5bde=0x0;var _0x33d12c=0x0;var _0x5b9c1c=![];var _0x28a593;var _0x2ec877;return db['ChatWebsite'][_0xc45d('0x5d')]({'where':{'id':_0x4506d5[_0xc45d('0x65')]['id']},'include':[{'model':db['Interval'],'as':_0xc45d('0xf9'),'include':[{'model':db[_0xc45d('0xf9')],'as':_0xc45d('0xfa'),'attributes':['id',_0xc45d('0xef')],'raw':!![]}]}]})[_0xc45d('0x36')](handleEntityNotFound(_0x13c96e,null))[_0xc45d('0x36')](function(_0x2c8166){if(_0x2c8166){_0x28a593=_0x2c8166;return _0x2c8166[_0xc45d('0xfb')]({'raw':!![]});}})[_0xc45d('0x36')](function(_0x2f1ad4){if(_0x28a593){if(_0x2f1ad4){_0x2ec877=_0x2f1ad4;}}return require(_0xc45d('0x17'))[_0xc45d('0xfc')]();})[_0xc45d('0x36')](function(_0x1d319f){if(_0x1d319f){_0x33d12c=_0x1d319f[_0xc45d('0xfd')];_0x5b9c1c=_0x1d319f[_0xc45d('0x7c')];}})[_0xc45d('0x36')](function(){return db[_0xc45d('0xb8')][_0xc45d('0x2f')]({'where':{'closed':![]}});})[_0xc45d('0x36')](function(_0x103fa1){_0x5e5bde=_0x103fa1;if(_0x33d12c&&_0x103fa1>_0x33d12c){return db[_0xc45d('0xfe')][_0xc45d('0x69')]({'where':{'id':0x1}})['then'](function(_0x20897e){if(_0x20897e){_0x20897e[_0xc45d('0xff')](_0xc45d('0x100'));}});}})[_0xc45d('0x36')](function(){if(_0x28a593['Interval']&&_0x28a593[_0xc45d('0xf9')]['Intervals']){var _0x714648=[];for(var _0xfdd5d4=0x0;_0xfdd5d4<_0x28a593[_0xc45d('0xf9')]['Intervals']['length'];_0xfdd5d4++){var _0x428702=_0x28a593[_0xc45d('0xf9')][_0xc45d('0xfa')][_0xfdd5d4]['get']({'plain':!![]});_0x714648[_0xc45d('0xbe')](iftimePromise(_0x428702,_0x28a593));}return BPromise[_0xc45d('0x101')](_0x714648)[_0xc45d('0x36')](function(_0x3988bc){return _[_0xc45d('0x102')](_0x3988bc);});}else{return!![];}})['then'](function(_0xf86645){var _0x5a1c99=fs[_0xc45d('0x103')](path['join'](config[_0xc45d('0x79')],_0xc45d('0x104')),_0xc45d('0xd0'));var _0x3495f7={'remote':_0x28a593[_0xc45d('0x105')],'query':querystring[_0xc45d('0x26')](_[_0xc45d('0x55')](_0x28a593[_0xc45d('0x38')]({'plain':!![]}),{'customerIp':_0x4506d5[_0xc45d('0x89')][_0xc45d('0xa9')]||_0x4506d5[_0xc45d('0x89')][_0xc45d('0x106')]||_0x4506d5[_0xc45d('0x107')][_0xc45d('0x108')]||_0x4506d5['ip'],'referer':_0x4506d5['headers'][_0xc45d('0xae')],'openedInteractions':_0x5e5bde,'maxInteractions':_0x33d12c,'virtual':_0x5b9c1c[_0xc45d('0xfd')],'online':_0xf86645,'custom':_0x5b9c1c}))[_0xc45d('0x109')](/'/g,'\x5c\x27')};_0x13c96e['send'](ejs[_0xc45d('0xd1')](Mustache[_0xc45d('0xd1')](_0x5a1c99,_0x3495f7),{'proactiveActions':_0x2ec877,'alignment':_0x28a593['alignment'],'verticalAlignment':_0x28a593[_0xc45d('0x10a')],'div_color':_0x28a593['color'],'text_color':_0x28a593[_0xc45d('0x10b')]}));})[_0xc45d('0x64')](handleError(_0x13c96e,null));};exports[_0xc45d('0x10c')]=function(_0x5d1ccc,_0x156105,_0x1b2d99){return db['ChatWebsite'][_0xc45d('0x69')]({'where':{'id':_0x5d1ccc['params']['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x156105,null))[_0xc45d('0x36')](function(_0x3b00ae){if(_0x3b00ae){return db[_0xc45d('0x10d')][_0xc45d('0x10e')](function(_0x76d62f){return db[_0xc45d('0x9f')]['destroy']({'where':{'ChatWebsiteId':_0x5d1ccc[_0xc45d('0x65')]['id']},'transaction':_0x76d62f})[_0xc45d('0x36')](function(_0x313b70){var _0x23ddfe=_[_0xc45d('0x46')](_0x5d1ccc[_0xc45d('0x5f')],function(_0x2d65f3){_0x2d65f3[_0xc45d('0x68')]=_0x5d1ccc[_0xc45d('0x65')]['id'];return _0x2d65f3;});return db[_0xc45d('0x9f')][_0xc45d('0x10f')](_0x23ddfe,{'transaction':_0x76d62f});});})[_0xc45d('0x36')](function(){return db[_0xc45d('0x9f')][_0xc45d('0x110')]({'where':{'ChatWebsiteId':_0x5d1ccc['params']['id']},'order':_0xc45d('0xa2')});});}})[_0xc45d('0x36')](respondWithResult(_0x156105,null))['catch'](handleError(_0x156105,null));};exports[_0xc45d('0x111')]=function(_0x5441de,_0x386919,_0x5ab9b8){var _0x2c6bcc={};var _0x3672b3={};var _0x41f7bc;var _0x394013;return db[_0xc45d('0x40')][_0xc45d('0x69')]({'where':{'id':_0x5441de[_0xc45d('0x65')]['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x386919,null))[_0xc45d('0x36')](function(_0x293586){if(_0x293586){_0x41f7bc=_0x293586;_0x3672b3[_0xc45d('0x45')]=_[_0xc45d('0x48')](db['ChatApplication'][_0xc45d('0x41')]);_0x3672b3[_0xc45d('0x47')]=_[_0xc45d('0x48')](_0x5441de[_0xc45d('0x47')]);_0x3672b3[_0xc45d('0x49')]=_[_0xc45d('0x4b')](_0x3672b3[_0xc45d('0x45')],_0x3672b3[_0xc45d('0x47')]);_0x2c6bcc[_0xc45d('0x4a')]=_['intersection'](_0x3672b3[_0xc45d('0x45')],qs[_0xc45d('0x5c')](_0x5441de[_0xc45d('0x47')]['fields']));_0x2c6bcc[_0xc45d('0x4a')]=_0x2c6bcc['attributes'][_0xc45d('0x4c')]?_0x2c6bcc['attributes']:_0x3672b3[_0xc45d('0x45')];_0x2c6bcc[_0xc45d('0x4f')]=qs['sort'](_0x5441de['query']['sort']);_0x2c6bcc[_0xc45d('0x53')]=qs[_0xc45d('0x49')](_[_0xc45d('0x51')](_0x5441de[_0xc45d('0x47')],_0x3672b3['filters']));if(_0x5441de[_0xc45d('0x47')][_0xc45d('0x52')]){_0x2c6bcc[_0xc45d('0x53')]=_[_0xc45d('0x55')](_0x2c6bcc[_0xc45d('0x53')],{'$or':_[_0xc45d('0x46')](_0x2c6bcc['attributes'],function(_0x371d91){var _0x572868={};_0x572868[_0x371d91]={'$like':'%'+_0x5441de[_0xc45d('0x47')][_0xc45d('0x52')]+'%'};return _0x572868;})});}_0x2c6bcc=_[_0xc45d('0x55')]({},_0x2c6bcc,_0x5441de[_0xc45d('0x56')]);return _0x41f7bc['getApplications'](_0x2c6bcc);}})[_0xc45d('0x36')](function(_0x368310){if(_0x368310){_0x394013=_0x368310['length'];if(!_0x5441de['query'][_0xc45d('0x4d')]('nolimit')){_0x2c6bcc[_0xc45d('0x31')]=qs['limit'](_0x5441de[_0xc45d('0x47')][_0xc45d('0x31')]);_0x2c6bcc['offset']=qs[_0xc45d('0x30')](_0x5441de[_0xc45d('0x47')]['offset']);}return _0x41f7bc['getApplications'](_0x2c6bcc);}})[_0xc45d('0x36')](function(_0x105e1a){if(_0x105e1a){return _0x105e1a?{'count':_0x394013,'rows':_0x105e1a}:null;}})[_0xc45d('0x36')](respondWithResult(_0x386919,null))['catch'](handleError(_0x386919,null));};exports[_0xc45d('0x112')]=function(_0x472006,_0x28edc7,_0x3179d9){return db[_0xc45d('0x113')][_0xc45d('0x5d')]({'where':{'id':_0x472006['params']['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x28edc7,null))[_0xc45d('0x36')](function(_0x24f81c){if(_0x24f81c){return _0x24f81c[_0xc45d('0x112')](_0x472006[_0xc45d('0x5f')][_0xc45d('0x70')],_[_0xc45d('0xe5')](_0x472006[_0xc45d('0x5f')],['ids','id'])||{});}})[_0xc45d('0x36')](respondWithResult(_0x28edc7,null))[_0xc45d('0x64')](handleError(_0x28edc7,null));};exports[_0xc45d('0xfb')]=function(_0x3da7a3,_0x56955d,_0x120201){var _0x5dc0b6={};var _0x57a0b2={};var _0x47c311;var _0x227a0d;return db['ChatWebsite'][_0xc45d('0x69')]({'where':{'id':_0x3da7a3[_0xc45d('0x65')]['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x56955d,null))[_0xc45d('0x36')](function(_0x10fc34){if(_0x10fc34){_0x47c311=_0x10fc34;_0x57a0b2[_0xc45d('0x45')]=_[_0xc45d('0x48')](db[_0xc45d('0x114')]['rawAttributes']);_0x57a0b2[_0xc45d('0x47')]=_[_0xc45d('0x48')](_0x3da7a3[_0xc45d('0x47')]);_0x57a0b2['filters']=_[_0xc45d('0x4b')](_0x57a0b2['model'],_0x57a0b2[_0xc45d('0x47')]);_0x5dc0b6[_0xc45d('0x4a')]=_[_0xc45d('0x4b')](_0x57a0b2[_0xc45d('0x45')],qs[_0xc45d('0x5c')](_0x3da7a3[_0xc45d('0x47')][_0xc45d('0x5c')]));_0x5dc0b6[_0xc45d('0x4a')]=_0x5dc0b6[_0xc45d('0x4a')]['length']?_0x5dc0b6[_0xc45d('0x4a')]:_0x57a0b2[_0xc45d('0x45')];_0x5dc0b6[_0xc45d('0x4f')]=qs[_0xc45d('0x50')](_0x3da7a3[_0xc45d('0x47')]['sort']);_0x5dc0b6[_0xc45d('0x53')]=qs[_0xc45d('0x49')](_[_0xc45d('0x51')](_0x3da7a3[_0xc45d('0x47')],_0x57a0b2[_0xc45d('0x49')]));if(_0x3da7a3[_0xc45d('0x47')]['filter']){_0x5dc0b6[_0xc45d('0x53')]=_[_0xc45d('0x55')](_0x5dc0b6['where'],{'$or':_[_0xc45d('0x46')](_0x5dc0b6[_0xc45d('0x4a')],function(_0x1745f3){var _0x3dec4f={};_0x3dec4f[_0x1745f3]={'$like':'%'+_0x3da7a3[_0xc45d('0x47')][_0xc45d('0x52')]+'%'};return _0x3dec4f;})});}_0x5dc0b6=_['merge']({},_0x5dc0b6,_0x3da7a3[_0xc45d('0x56')]);return _0x47c311[_0xc45d('0xfb')](_0x5dc0b6);}})[_0xc45d('0x36')](function(_0x54c9d4){if(_0x54c9d4){_0x227a0d=_0x54c9d4['length'];if(!_0x3da7a3[_0xc45d('0x47')][_0xc45d('0x4d')]('nolimit')){_0x5dc0b6[_0xc45d('0x31')]=qs[_0xc45d('0x31')](_0x3da7a3[_0xc45d('0x47')][_0xc45d('0x31')]);_0x5dc0b6[_0xc45d('0x30')]=qs[_0xc45d('0x30')](_0x3da7a3[_0xc45d('0x47')]['offset']);}return _0x47c311[_0xc45d('0xfb')](_0x5dc0b6);}})['then'](function(_0x48d827){if(_0x48d827){return _0x48d827?{'count':_0x227a0d,'rows':_0x48d827}:null;}})[_0xc45d('0x36')](respondWithResult(_0x56955d,null))['catch'](handleError(_0x56955d,null));};exports[_0xc45d('0x115')]=function(_0x5abe9e,_0x3c1d6a,_0x52c912){var _0x2e011a=_0x5abe9e[_0xc45d('0x47')][_0xc45d('0x116')]==='false'?_0xc45d('0x117'):_0xc45d('0x118');return db[_0xc45d('0x40')][_0xc45d('0x5d')]({'attributes':['id',_0x2e011a],'where':{'id':_0x5abe9e[_0xc45d('0x65')]['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x3c1d6a,null))[_0xc45d('0x36')](function(_0x1bc4f4){if(_0x1bc4f4){var _0x491a2b=_0x1bc4f4[_0x2e011a];var _0x3b10aa=_0x491a2b&&_0x491a2b[_0xc45d('0x119')]?_0x491a2b[_0xc45d('0x119')]:[];_0x3c1d6a['send']({'fromKey':_[_0xc45d('0x7d')](_0x491a2b[_0xc45d('0x11a')])?undefined:_0x491a2b[_0xc45d('0x11a')],'count':_0x3b10aa[_0xc45d('0x4c')],'rows':_0x3b10aa});}})[_0xc45d('0x64')](handleError(_0x3c1d6a,null));};exports['getOfflineMessages']=function(_0x48c97c,_0x3bb61c,_0x2876f5){var _0x40743a={'raw':![],'where':{}};var _0x40055e={};var _0x45b971={'count':0x0,'rows':[]};return db[_0xc45d('0x40')][_0xc45d('0x69')]({'where':{'id':_0x48c97c[_0xc45d('0x65')]['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x3bb61c,null))[_0xc45d('0x36')](function(_0x4a1e37){if(_0x4a1e37){_0x40055e[_0xc45d('0x45')]=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x40055e[_0xc45d('0x47')]=_[_0xc45d('0x48')](_0x48c97c[_0xc45d('0x47')]);_0x40055e[_0xc45d('0x49')]=_[_0xc45d('0x4b')](_0x40055e[_0xc45d('0x45')],_0x40055e['query']);_0x40743a['attributes']=_['intersection'](_0x40055e[_0xc45d('0x45')],qs[_0xc45d('0x5c')](_0x48c97c[_0xc45d('0x47')]['fields']));_0x40743a[_0xc45d('0x4a')]=_0x40743a['attributes'][_0xc45d('0x4c')]?_0x40743a[_0xc45d('0x4a')]:_0x40055e[_0xc45d('0x45')];if(!_0x48c97c[_0xc45d('0x47')]['hasOwnProperty'](_0xc45d('0x4e'))){_0x40743a[_0xc45d('0x31')]=qs[_0xc45d('0x31')](_0x48c97c['query'][_0xc45d('0x31')]);_0x40743a[_0xc45d('0x30')]=qs[_0xc45d('0x30')](_0x48c97c[_0xc45d('0x47')][_0xc45d('0x30')]);}_0x40743a[_0xc45d('0x4f')]=qs['sort'](_0x48c97c[_0xc45d('0x47')]['sort']);_0x40743a[_0xc45d('0x53')]=qs[_0xc45d('0x49')](_[_0xc45d('0x51')](_0x48c97c[_0xc45d('0x47')],_0x40055e[_0xc45d('0x49')]));_0x40743a[_0xc45d('0x53')][_0xc45d('0x68')]=_0x4a1e37['id'];if(_0x48c97c[_0xc45d('0x47')][_0xc45d('0x52')]){_0x40743a['where']=_['merge'](_0x40743a[_0xc45d('0x53')],{'$or':_[_0xc45d('0x46')](_0x40743a[_0xc45d('0x4a')],function(_0x537db4){var _0x103e4b={};_0x103e4b[_0x537db4]={'$like':'%'+_0x48c97c[_0xc45d('0x47')][_0xc45d('0x52')]+'%'};return _0x103e4b;})});}_0x40743a=_[_0xc45d('0x55')]({},_0x40743a,_0x48c97c[_0xc45d('0x56')]);return db['ChatOfflineMessage'][_0xc45d('0x2f')]({'where':_0x40743a[_0xc45d('0x53')]})[_0xc45d('0x36')](function(_0x412625){_0x45b971[_0xc45d('0x2f')]=_0x412625;if(_0x48c97c[_0xc45d('0x47')][_0xc45d('0x57')]){_0x40743a[_0xc45d('0x58')]=[{'all':!![]}];}else{_0x40743a[_0xc45d('0x58')]=[{'model':db[_0xc45d('0x8d')],'as':'Contact','required':![]}];}return db[_0xc45d('0xd4')]['findAll'](_0x40743a);})[_0xc45d('0x36')](function(_0x197fa7){_0x45b971[_0xc45d('0x5a')]=_0x197fa7;return _0x45b971;});}})[_0xc45d('0x36')](respondWithFilteredResult(_0x3bb61c,_0x40743a))['catch'](handleError(_0x3bb61c,null));};exports['addAgents']=function(_0x58b763,_0x1ad799,_0x49e657){return db[_0xc45d('0x40')][_0xc45d('0x5d')]({'where':{'id':_0x58b763[_0xc45d('0x65')]['id']}})['then'](handleEntityNotFound(_0x1ad799,null))['then'](function(_0x1d1149){if(_0x1d1149){return _0x1d1149[_0xc45d('0x11b')](_0x58b763['body']['ids'],_[_0xc45d('0xe5')](_0x58b763[_0xc45d('0x5f')],[_0xc45d('0x70'),'id'])||{})[_0xc45d('0xce')](function(_0x5cb838){for(var _0x3287c9=0x0;_0x3287c9<_0x58b763[_0xc45d('0x5f')][_0xc45d('0x70')][_0xc45d('0x4c')];_0x3287c9+=0x1){socket[_0xc45d('0x11c')]('userChatWebsite:save',{'UserId':_0x58b763['body'][_0xc45d('0x70')][_0x3287c9],'ChatWebsiteId':_0x58b763['params']['id']});}return _0x5cb838;});}})[_0xc45d('0x36')](respondWithResult(_0x1ad799,null))['catch'](handleError(_0x1ad799,null));};exports[_0xc45d('0x11d')]=function(_0x2607b0,_0x3e0ff5,_0x4b80bc){return db[_0xc45d('0x40')]['find']({'where':{'id':_0x2607b0['params']['id']}})[_0xc45d('0x36')](handleEntityNotFound(_0x3e0ff5,null))['then'](function(_0x485ee3){if(_0x485ee3){return _0x485ee3[_0xc45d('0x11d')](_0x2607b0[_0xc45d('0x47')]['ids'])['then'](function(){if(_[_0xc45d('0x11e')](_0x2607b0[_0xc45d('0x47')][_0xc45d('0x70')])){for(var _0x4c5490=0x0;_0x4c5490<_0x2607b0[_0xc45d('0x47')][_0xc45d('0x70')][_0xc45d('0x4c')];_0x4c5490+=0x1){socket[_0xc45d('0x11c')](_0xc45d('0x11f'),{'UserId':Number(_0x2607b0[_0xc45d('0x47')][_0xc45d('0x70')][_0x4c5490]),'ChatWebsiteId':Number(_0x2607b0[_0xc45d('0x65')]['id'])});}}else{socket[_0xc45d('0x11c')]('userChatWebsite:remove',{'UserId':Number(_0x2607b0['query'][_0xc45d('0x70')]),'ChatWebsiteId':Number(_0x2607b0['params']['id'])});}});}})[_0xc45d('0x36')](respondWithStatusCode(_0x3e0ff5,null))['catch'](handleError(_0x3e0ff5,null));};exports[_0xc45d('0x120')]=function(_0x3c470c,_0x468acb,_0x3f7aa6){var _0x394996={};var _0x187bf4={};var _0x4a9b8e;var _0x439f09;return db[_0xc45d('0x40')][_0xc45d('0x69')]({'where':{'id':_0x3c470c[_0xc45d('0x65')]['id']}})['then'](handleEntityNotFound(_0x468acb,null))[_0xc45d('0x36')](function(_0x2e979){if(_0x2e979){_0x4a9b8e=_0x2e979;_0x187bf4[_0xc45d('0x45')]=_[_0xc45d('0x48')](db[_0xc45d('0xc3')][_0xc45d('0x41')]);_0x187bf4[_0xc45d('0x47')]=_[_0xc45d('0x48')](_0x3c470c['query']);_0x187bf4[_0xc45d('0x49')]=_[_0xc45d('0x4b')](_0x187bf4[_0xc45d('0x45')],_0x187bf4[_0xc45d('0x47')]);_0x394996[_0xc45d('0x4a')]=_[_0xc45d('0x4b')](_0x187bf4[_0xc45d('0x45')],qs[_0xc45d('0x5c')](_0x3c470c['query']['fields']));_0x394996['attributes']=_0x394996['attributes'][_0xc45d('0x4c')]?_0x394996['attributes']:_0x187bf4[_0xc45d('0x45')];_0x394996['order']=qs[_0xc45d('0x50')](_0x3c470c[_0xc45d('0x47')][_0xc45d('0x50')]);_0x394996['where']=qs['filters'](_[_0xc45d('0x51')](_0x3c470c[_0xc45d('0x47')],_0x187bf4['filters']));if(_0x3c470c[_0xc45d('0x47')]['filter']){_0x394996[_0xc45d('0x53')]=_['merge'](_0x394996[_0xc45d('0x53')],{'$or':_[_0xc45d('0x46')](_0x394996['attributes'],function(_0x545871){var _0x4c4ba6={};_0x4c4ba6[_0x545871]={'$like':'%'+_0x3c470c[_0xc45d('0x47')]['filter']+'%'};return _0x4c4ba6;})});}_0x394996=_[_0xc45d('0x55')]({},_0x394996,_0x3c470c[_0xc45d('0x56')]);return _0x4a9b8e[_0xc45d('0x120')](_0x394996);}})[_0xc45d('0x36')](function(_0x1b76f5){if(_0x1b76f5){_0x439f09=_0x1b76f5[_0xc45d('0x4c')];if(!_0x3c470c[_0xc45d('0x47')][_0xc45d('0x4d')](_0xc45d('0x4e'))){_0x394996[_0xc45d('0x31')]=qs[_0xc45d('0x31')](_0x3c470c['query'][_0xc45d('0x31')]);_0x394996['offset']=qs[_0xc45d('0x30')](_0x3c470c['query']['offset']);}return _0x4a9b8e[_0xc45d('0x120')](_0x394996);}})['then'](function(_0x52384f){if(_0x52384f){return _0x52384f?{'count':_0x439f09,'rows':_0x52384f}:null;}})[_0xc45d('0x36')](respondWithResult(_0x468acb,null))[_0xc45d('0x64')](handleError(_0x468acb,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index fac74ee..e45b9b1 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 _0x1159=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4fc798,_0x7b8de7){var _0x144f08=function(_0x1bcf21){while(--_0x1bcf21){_0x4fc798['push'](_0x4fc798['shift']());}};_0x144f08(++_0x7b8de7);}(_0x1159,0xf3));var _0x9115=function(_0x530efc,_0x4c6605){_0x530efc=_0x530efc-0x0;var _0x31c0c9=_0x1159[_0x530efc];return _0x31c0c9;};'use strict';var EventEmitter=require(_0x9115('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9115('0x1')](0x0);var events={'afterCreate':_0x9115('0x2'),'afterUpdate':_0x9115('0x3'),'afterDestroy':_0x9115('0x4')};function emitEvent(_0x4554f6){return function(_0x4661fc,_0xe754b3,_0x45234e){ChatWebsiteEvents['emit'](_0x4554f6+':'+_0x4661fc['id'],_0x4661fc);ChatWebsiteEvents[_0x9115('0x5')](_0x4554f6,_0x4661fc);_0x45234e(null);};}for(var e in events){if(events[_0x9115('0x6')](e)){var event=events[e];ChatWebsite[_0x9115('0x7')](e,emitEvent(event));}}module[_0x9115('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x83d3=['hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','remove','emit'];(function(_0x587963,_0x193e71){var _0x23541b=function(_0x1e64c1){while(--_0x1e64c1){_0x587963['push'](_0x587963['shift']());}};_0x23541b(++_0x193e71);}(_0x83d3,0x17c));var _0x383d=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0x83d3[_0x1034ca];return _0x1a023a;};'use strict';var EventEmitter=require(_0x383d('0x0'));var ChatWebsite=require(_0x383d('0x1'))['db'][_0x383d('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x383d('0x3')](0x0);var events={'afterCreate':_0x383d('0x4'),'afterUpdate':'update','afterDestroy':_0x383d('0x5')};function emitEvent(_0x1184a6){return function(_0x31cbfc,_0x202ffc,_0x52adf4){ChatWebsiteEvents[_0x383d('0x6')](_0x1184a6+':'+_0x31cbfc['id'],_0x31cbfc);ChatWebsiteEvents['emit'](_0x1184a6,_0x31cbfc);_0x52adf4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x383d('0x7')](e,emitEvent(event));}}module[_0x383d('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 2ec5312..abbf953 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 _0xeffd=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0xeffd,0x6b));var _0xdeff=function(_0x205a85,_0x5ddd32){_0x205a85=_0x205a85-0x0;var _0x3fece4=_0xeffd[_0x205a85];return _0x3fece4;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var logger=require(_0xdeff('0x1'))(_0xdeff('0x2'));var moment=require(_0xdeff('0x3'));var BPromise=require(_0xdeff('0x4'));var rp=require(_0xdeff('0x5'));var fs=require('fs');var path=require(_0xdeff('0x6'));var rimraf=require(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var attributes=require(_0xdeff('0x9'));module[_0xdeff('0xa')]=function(_0x1ed641,_0x132631){return _0x1ed641[_0xdeff('0xb')](_0xdeff('0xc'),attributes,{'tableName':_0xdeff('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f3a=['api','moment','bluebird','request-promise','path','rimraf','./chatWebsite.attributes','chat_websites','lodash'];(function(_0x5533b1,_0x7f4a9a){var _0x1009f3=function(_0x41d1ad){while(--_0x41d1ad){_0x5533b1['push'](_0x5533b1['shift']());}};_0x1009f3(++_0x7f4a9a);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x5abc2a,_0x3e7b39){_0x5abc2a=_0x5abc2a-0x0;var _0x22ff10=_0x2f3a[_0x5abc2a];return _0x22ff10;};'use strict';var _=require(_0xa2f3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa2f3('0x1'));var moment=require(_0xa2f3('0x2'));var BPromise=require(_0xa2f3('0x3'));var rp=require(_0xa2f3('0x4'));var fs=require('fs');var path=require(_0xa2f3('0x5'));var rimraf=require(_0xa2f3('0x6'));var config=require('../../config/environment');var attributes=require(_0xa2f3('0x7'));module['exports']=function(_0xfe0b09,_0x1ddec0){return _0xfe0b09['define']('ChatWebsite',attributes,{'tableName':_0xa2f3('0x8'),'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 739345a..3142c8a 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 _0x6d38=['catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result'];(function(_0x233bb2,_0x1e6f8e){var _0x4012c4=function(_0x1bd307){while(--_0x1bd307){_0x233bb2['push'](_0x233bb2['shift']());}};_0x4012c4(++_0x1e6f8e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});config[_0x86d3('0x9')]=_[_0x86d3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x86d3('0xb'))(new Redis(config[_0x86d3('0x9')]));require(_0x86d3('0xc'))['register'](socket);function respondWithRpcPromise(_0x4a277e,_0x3ed317,_0x555e6d){return new BPromise(function(_0x49b436,_0x5606eb){return client[_0x86d3('0xd')](_0x4a277e,_0x555e6d)[_0x86d3('0xe')](function(_0x4f216c){logger[_0x86d3('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x3ed317,_0x86d3('0x10'));logger[_0x86d3('0x11')](_0x86d3('0x12'),_0x3ed317,_0x86d3('0x10'),JSON[_0x86d3('0x13')](_0x4f216c));if(_0x4f216c[_0x86d3('0x14')]){if(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x15')]===0x1f4){logger['error'](_0x86d3('0x16'),_0x3ed317,_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);return _0x5606eb(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);}logger[_0x86d3('0x14')](_0x86d3('0x16'),_0x3ed317,_0x4f216c[_0x86d3('0x14')]['message']);return _0x49b436(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);}else{logger[_0x86d3('0xf')](_0x86d3('0x16'),_0x3ed317,_0x86d3('0x10'));_0x49b436(_0x4f216c[_0x86d3('0x18')][_0x86d3('0x17')]);}})[_0x86d3('0x19')](function(_0x9b76f2){logger['error'](_0x86d3('0x16'),_0x3ed317,_0x9b76f2);_0x5606eb(_0x9b76f2);});});} \ No newline at end of file +var _0xacf4=['stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','request','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4d2552,_0x560684){var _0x56761b=function(_0x33805f){while(--_0x33805f){_0x4d2552['push'](_0x4d2552['shift']());}};_0x56761b(++_0x560684);}(_0xacf4,0xe7));var _0x4acf=function(_0x129253,_0x5d92e9){_0x129253=_0x129253-0x0;var _0x167486=_0xacf4[_0x129253];return _0x167486;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});config[_0x4acf('0xa')]=_[_0x4acf('0xb')](config[_0x4acf('0xa')],{'host':_0x4acf('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4acf('0xd'))['register'](socket);function respondWithRpcPromise(_0x425c8d,_0x2c2cb4,_0x3e9ddd){return new BPromise(function(_0x4ff233,_0x290ca7){return client[_0x4acf('0xe')](_0x425c8d,_0x3e9ddd)['then'](function(_0x5f22d9){logger[_0x4acf('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x2c2cb4,'request\x20sent');logger[_0x4acf('0x10')](_0x4acf('0x11'),_0x2c2cb4,_0x4acf('0x12'),JSON[_0x4acf('0x13')](_0x5f22d9));if(_0x5f22d9[_0x4acf('0x14')]){if(_0x5f22d9[_0x4acf('0x14')][_0x4acf('0x15')]===0x1f4){logger[_0x4acf('0x14')](_0x4acf('0x16'),_0x2c2cb4,_0x5f22d9[_0x4acf('0x14')][_0x4acf('0x17')]);return _0x290ca7(_0x5f22d9['error'][_0x4acf('0x17')]);}logger['error'](_0x4acf('0x16'),_0x2c2cb4,_0x5f22d9[_0x4acf('0x14')][_0x4acf('0x17')]);return _0x4ff233(_0x5f22d9['error']['message']);}else{logger[_0x4acf('0xf')](_0x4acf('0x16'),_0x2c2cb4,_0x4acf('0x12'));_0x4ff233(_0x5f22d9['result'][_0x4acf('0x17')]);}})[_0x4acf('0x18')](function(_0x30d289){logger[_0x4acf('0x14')](_0x4acf('0x16'),_0x2c2cb4,_0x30d289);_0x290ca7(_0x30d289);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index fc79fab..892ea51 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(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1cbc64,_0x5ee41e){_0x1cbc64=_0x1cbc64-0x0;var _0x36c4e8=_0x5f2f[_0x1cbc64];return _0x36c4e8;};'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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x40e5d9,_0x36f0ce){var _0x4c395d=function(_0x113725){while(--_0x113725){_0x40e5d9['push'](_0x40e5d9['shift']());}};_0x4c395d(++_0x36f0ce);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5d6eaf,_0x5e8c49){_0x5d6eaf=_0x5d6eaf-0x0;var _0x8ab44b=_0x5f2f[_0x5d6eaf];return _0x8ab44b;};'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 diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index a6726e5..0068dd7 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 _0x763b=['single','file','server/files/images/avatars/','%s-%s','addAvatar','addCustomerAvatar','addSystemAvatar','notify','/:id/offline','offline','addInteraction','addApplications','/:id/proactive_actions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','root','format','now','originalname'];(function(_0x399ea5,_0x2aab75){var _0x4181e3=function(_0xe592e0){while(--_0xe592e0){_0x399ea5['push'](_0x399ea5['shift']());}};_0x4181e3(++_0x2aab75);}(_0x763b,0xd9));var _0xb763=function(_0x30f2d3,_0x3c0448){_0x30f2d3=_0x30f2d3-0x0;var _0x17f342=_0x763b[_0x30f2d3];return _0x17f342;};'use strict';var multer=require('multer');var util=require(_0xb763('0x0'));var path=require(_0xb763('0x1'));var timeout=require(_0xb763('0x2'));var express=require(_0xb763('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb763('0x4'));router[_0xb763('0x5')]('/',auth[_0xb763('0x6')](),controller[_0xb763('0x7')]);router[_0xb763('0x5')](_0xb763('0x8'),auth[_0xb763('0x6')](),controller[_0xb763('0x9')]);router[_0xb763('0x5')](_0xb763('0xa'),auth[_0xb763('0x6')](),controller[_0xb763('0xb')]);router[_0xb763('0x5')](_0xb763('0xc'),auth[_0xb763('0x6')](),controller[_0xb763('0xd')]);router['get'](_0xb763('0xe'),auth[_0xb763('0x6')](),controller[_0xb763('0xf')]);router[_0xb763('0x5')](_0xb763('0x10'),controller[_0xb763('0x11')]);router[_0xb763('0x5')](_0xb763('0x12'),controller['getAvatar']);router[_0xb763('0x5')](_0xb763('0x13'),controller[_0xb763('0x14')]);router[_0xb763('0x5')](_0xb763('0x15'),controller[_0xb763('0x16')]);router['get'](_0xb763('0x17'),auth[_0xb763('0x6')](),controller['getInteractions']);router['get']('/:id/snippet',controller[_0xb763('0x18')]);router[_0xb763('0x5')](_0xb763('0x19'),auth['isAuthenticated'](),controller[_0xb763('0x1a')]);router[_0xb763('0x5')]('/:id/proactive_actions',auth[_0xb763('0x6')](),controller[_0xb763('0x1b')]);router[_0xb763('0x5')](_0xb763('0x1c'),controller[_0xb763('0x1d')]);router[_0xb763('0x5')](_0xb763('0x1e'),auth[_0xb763('0x6')](),controller[_0xb763('0x1f')]);router[_0xb763('0x5')](_0xb763('0x20'),auth['isAuthenticated'](),controller['getAgents']);router[_0xb763('0x21')]('/',auth['isAuthenticated'](),controller[_0xb763('0x22')]);router['post'](_0xb763('0xc'),auth[_0xb763('0x6')](),controller[_0xb763('0x23')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb763('0x24')]);var upload=multer({'storage':multer[_0xb763('0x25')]({'destination':function(_0x32e834,_0x37f514,_0xbba402){_0xbba402(null,path[_0xb763('0x26')](config[_0xb763('0x27')],'server/files/images/logos/'));},'filename':function(_0x125608,_0xa64edb,_0x2f0cd2){_0x2f0cd2(null,util[_0xb763('0x28')]('%s-%s',Date[_0xb763('0x29')](),_0xa64edb[_0xb763('0x2a')]));}})});router['post']('/:id/logo',upload[_0xb763('0x2b')](_0xb763('0x2c')),controller['addLogo']);var upload=multer({'storage':multer[_0xb763('0x25')]({'destination':function(_0x5a9dc4,_0x174734,_0x5c24b4){_0x5c24b4(null,path[_0xb763('0x26')](config[_0xb763('0x27')],_0xb763('0x2d')));},'filename':function(_0x5ce670,_0x47427a,_0x328a36){_0x328a36(null,util[_0xb763('0x28')](_0xb763('0x2e'),Date[_0xb763('0x29')](),_0x47427a[_0xb763('0x2a')]));}})});router[_0xb763('0x21')]('/:id/avatar',upload[_0xb763('0x2b')](_0xb763('0x2c')),controller[_0xb763('0x2f')]);var upload=multer({'storage':multer[_0xb763('0x25')]({'destination':function(_0x2812d4,_0x174d54,_0x10bcc4){_0x10bcc4(null,path[_0xb763('0x26')](config['root'],_0xb763('0x2d')));},'filename':function(_0x56cfd0,_0x5a6d65,_0x8d3c94){_0x8d3c94(null,util[_0xb763('0x28')](_0xb763('0x2e'),Date['now'](),_0x5a6d65[_0xb763('0x2a')]));}})});router[_0xb763('0x21')](_0xb763('0x13'),upload['single'](_0xb763('0x2c')),controller[_0xb763('0x30')]);var upload=multer({'storage':multer[_0xb763('0x25')]({'destination':function(_0x27115d,_0x11b631,_0x3fad54){_0x3fad54(null,path[_0xb763('0x26')](config[_0xb763('0x27')],_0xb763('0x2d')));},'filename':function(_0x378b73,_0x3a429c,_0x2969a8){_0x2969a8(null,util[_0xb763('0x28')]('%s-%s',Date['now'](),_0x3a429c['originalname']));}})});router['post'](_0xb763('0x15'),upload[_0xb763('0x2b')](_0xb763('0x2c')),controller[_0xb763('0x31')]);router[_0xb763('0x21')]('/:id/notify',controller[_0xb763('0x32')]);router[_0xb763('0x21')](_0xb763('0x33'),controller[_0xb763('0x34')]);router['post'](_0xb763('0x17'),auth[_0xb763('0x6')](),controller[_0xb763('0x35')]);router[_0xb763('0x21')](_0xb763('0x19'),auth[_0xb763('0x6')](),controller[_0xb763('0x36')]);router[_0xb763('0x21')](_0xb763('0x37'),auth[_0xb763('0x6')](),controller['addProactiveActions']);router[_0xb763('0x21')](_0xb763('0x20'),auth[_0xb763('0x6')](),controller[_0xb763('0x38')]);router[_0xb763('0x39')](_0xb763('0xa'),auth['isAuthenticated'](),controller[_0xb763('0x3a')]);router['delete']('/:id',auth[_0xb763('0x6')](),controller[_0xb763('0x3b')]);router[_0xb763('0x3c')](_0xb763('0xc'),auth[_0xb763('0x6')](),controller[_0xb763('0x3d')]);router[_0xb763('0x3c')](_0xb763('0xe'),auth['isAuthenticated'](),controller[_0xb763('0x3e')]);router[_0xb763('0x3c')](_0xb763('0x20'),auth['isAuthenticated'](),controller[_0xb763('0x3f')]);module[_0xb763('0x40')]=router; \ No newline at end of file +var _0xcbd2=['addLogo','join','server/files/images/avatars/','/:id/avatar','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','/:id/interactions','addInteraction','addApplications','addAgents','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','multer','util','express','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/canned_answers','getAnswers','getLogo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','file'];(function(_0x45d9bb,_0x2c0350){var _0x1a36e9=function(_0x643803){while(--_0x643803){_0x45d9bb['push'](_0x45d9bb['shift']());}};_0x1a36e9(++_0x2c0350);}(_0xcbd2,0x1d7));var _0x2cbd=function(_0x85d5a8,_0x1977be){_0x85d5a8=_0x85d5a8-0x0;var _0x20479b=_0xcbd2[_0x85d5a8];return _0x20479b;};'use strict';var multer=require(_0x2cbd('0x0'));var util=require(_0x2cbd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2cbd('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2cbd('0x3'));var config=require(_0x2cbd('0x4'));var controller=require(_0x2cbd('0x5'));router[_0x2cbd('0x6')]('/',auth['isAuthenticated'](),controller[_0x2cbd('0x7')]);router[_0x2cbd('0x6')](_0x2cbd('0x8'),auth[_0x2cbd('0x9')](),controller['describe']);router[_0x2cbd('0x6')](_0x2cbd('0xa'),auth['isAuthenticated'](),controller[_0x2cbd('0xb')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x2cbd('0x6')](_0x2cbd('0xc'),auth[_0x2cbd('0x9')](),controller[_0x2cbd('0xd')]);router[_0x2cbd('0x6')]('/:id/logo',controller[_0x2cbd('0xe')]);router[_0x2cbd('0x6')]('/:id/avatar',controller[_0x2cbd('0xf')]);router['get'](_0x2cbd('0x10'),controller['getCustomerAvatar']);router['get'](_0x2cbd('0x11'),controller[_0x2cbd('0x12')]);router['get']('/:id/interactions',auth[_0x2cbd('0x9')](),controller[_0x2cbd('0x13')]);router[_0x2cbd('0x6')](_0x2cbd('0x14'),controller['getSnippet']);router[_0x2cbd('0x6')](_0x2cbd('0x15'),auth[_0x2cbd('0x9')](),controller[_0x2cbd('0x16')]);router[_0x2cbd('0x6')](_0x2cbd('0x17'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0x2cbd('0x6')]('/:id/fields',controller[_0x2cbd('0x18')]);router['get']('/:id/offline_messages',auth[_0x2cbd('0x9')](),controller[_0x2cbd('0x19')]);router[_0x2cbd('0x6')](_0x2cbd('0x1a'),auth[_0x2cbd('0x9')](),controller[_0x2cbd('0x1b')]);router[_0x2cbd('0x1c')]('/',auth[_0x2cbd('0x9')](),controller[_0x2cbd('0x1d')]);router['post']('/:id/dispositions',auth[_0x2cbd('0x9')](),controller[_0x2cbd('0x1e')]);router[_0x2cbd('0x1c')](_0x2cbd('0xc'),auth['isAuthenticated'](),controller[_0x2cbd('0x1f')]);var upload=multer({'storage':multer[_0x2cbd('0x20')]({'destination':function(_0x4c73f3,_0x31ef70,_0x289cf0){_0x289cf0(null,path['join'](config[_0x2cbd('0x21')],_0x2cbd('0x22')));},'filename':function(_0x40dd99,_0x58c12c,_0x3645df){_0x3645df(null,util[_0x2cbd('0x23')](_0x2cbd('0x24'),Date[_0x2cbd('0x25')](),_0x58c12c[_0x2cbd('0x26')]));}})});router[_0x2cbd('0x1c')](_0x2cbd('0x27'),upload['single'](_0x2cbd('0x28')),controller[_0x2cbd('0x29')]);var upload=multer({'storage':multer[_0x2cbd('0x20')]({'destination':function(_0x4f521a,_0x1ba599,_0x16b965){_0x16b965(null,path[_0x2cbd('0x2a')](config[_0x2cbd('0x21')],_0x2cbd('0x2b')));},'filename':function(_0x90b493,_0xacea2a,_0x2f9fc6){_0x2f9fc6(null,util[_0x2cbd('0x23')](_0x2cbd('0x24'),Date[_0x2cbd('0x25')](),_0xacea2a['originalname']));}})});router[_0x2cbd('0x1c')](_0x2cbd('0x2c'),upload[_0x2cbd('0x2d')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0x2cbd('0x20')]({'destination':function(_0x10d5e7,_0x26cbd8,_0x4a0fff){_0x4a0fff(null,path['join'](config[_0x2cbd('0x21')],_0x2cbd('0x2b')));},'filename':function(_0x144021,_0x94f39c,_0x270d93){_0x270d93(null,util[_0x2cbd('0x23')](_0x2cbd('0x24'),Date['now'](),_0x94f39c[_0x2cbd('0x26')]));}})});router[_0x2cbd('0x1c')](_0x2cbd('0x10'),upload[_0x2cbd('0x2d')](_0x2cbd('0x28')),controller[_0x2cbd('0x2e')]);var upload=multer({'storage':multer[_0x2cbd('0x20')]({'destination':function(_0x38e9d3,_0x43268e,_0x4c8293){_0x4c8293(null,path[_0x2cbd('0x2a')](config[_0x2cbd('0x21')],_0x2cbd('0x2b')));},'filename':function(_0x23dfe0,_0x2c4cae,_0x59ed22){_0x59ed22(null,util[_0x2cbd('0x23')](_0x2cbd('0x24'),Date[_0x2cbd('0x25')](),_0x2c4cae['originalname']));}})});router[_0x2cbd('0x1c')]('/:id/system_avatar',upload[_0x2cbd('0x2d')](_0x2cbd('0x28')),controller[_0x2cbd('0x2f')]);router['post'](_0x2cbd('0x30'),controller[_0x2cbd('0x31')]);router['post'](_0x2cbd('0x32'),controller[_0x2cbd('0x33')]);router[_0x2cbd('0x1c')](_0x2cbd('0x34'),auth['isAuthenticated'](),controller[_0x2cbd('0x35')]);router[_0x2cbd('0x1c')](_0x2cbd('0x15'),auth[_0x2cbd('0x9')](),controller[_0x2cbd('0x36')]);router[_0x2cbd('0x1c')](_0x2cbd('0x17'),auth[_0x2cbd('0x9')](),controller['addProactiveActions']);router[_0x2cbd('0x1c')](_0x2cbd('0x1a'),auth[_0x2cbd('0x9')](),controller[_0x2cbd('0x37')]);router[_0x2cbd('0x38')](_0x2cbd('0xa'),auth[_0x2cbd('0x9')](),controller[_0x2cbd('0x39')]);router[_0x2cbd('0x3a')](_0x2cbd('0xa'),auth['isAuthenticated'](),controller[_0x2cbd('0x3b')]);router[_0x2cbd('0x3a')](_0x2cbd('0x3c'),auth[_0x2cbd('0x9')](),controller[_0x2cbd('0x3d')]);router['delete'](_0x2cbd('0xc'),auth[_0x2cbd('0x9')](),controller[_0x2cbd('0x3e')]);router['delete']('/:id/users',auth[_0x2cbd('0x9')](),controller[_0x2cbd('0x3f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 7e88340..411c504 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 _0x8c8b=['Google','STRING','sequelize','ENUM','AmazonAWS'];(function(_0x112e07,_0x3605ca){var _0x505787=function(_0x2f5c14){while(--_0x2f5c14){_0x112e07['push'](_0x112e07['shift']());}};_0x505787(++_0x3605ca);}(_0x8c8b,0x106));var _0xb8c8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c8b[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xb8c8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb8c8('0x1')](_0xb8c8('0x2'),_0xb8c8('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xb8c8('0x4')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x446c=['ENUM','Google','sequelize','exports','STRING'];(function(_0x1e1720,_0x1ccfa4){var _0x4d6b1e=function(_0x2fd888){while(--_0x2fd888){_0x1e1720['push'](_0x1e1720['shift']());}};_0x4d6b1e(++_0x1ccfa4);}(_0x446c,0x156));var _0xc446=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0x446c[_0x44c974];return _0x5214c6;};'use strict';var Sequelize=require(_0xc446('0x0'));module[_0xc446('0x1')]={'name':{'type':Sequelize[_0xc446('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc446('0x3')]('AmazonAWS',_0xc446('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xc446('0x2')]},'data2':{'type':Sequelize[_0xc446('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a030b7f..8ac671b 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 _0x0573=['order','sort','where','pick','VIRTUAL','filter','merge','options','rows','params','rawAttributes','includeAll','include','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CloudProvider','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset'];(function(_0x4420ba,_0x58a22d){var _0xdf33f3=function(_0x11409d){while(--_0x11409d){_0x4420ba['push'](_0x4420ba['shift']());}};_0xdf33f3(++_0x58a22d);}(_0x0573,0xa8));var _0x3057=function(_0x1d8630,_0x490a5b){_0x1d8630=_0x1d8630-0x0;var _0x2fb0d7=_0x0573[_0x1d8630];return _0x2fb0d7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3057('0x0'));var rimraf=require(_0x3057('0x1'));var zipdir=require(_0x3057('0x2'));var jsonpatch=require(_0x3057('0x3'));var rp=require(_0x3057('0x4'));var moment=require(_0x3057('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3057('0x6'));var util=require(_0x3057('0x7'));var path=require(_0x3057('0x8'));var sox=require(_0x3057('0x9'));var csv=require(_0x3057('0xa'));var ejs=require(_0x3057('0xb'));var fs=require('fs');var _=require(_0x3057('0xc'));var squel=require(_0x3057('0xd'));var crypto=require(_0x3057('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3057('0xf'));var toCsv=require(_0x3057('0xa'));var querystring=require(_0x3057('0x10'));var Papa=require(_0x3057('0x11'));var Redis=require(_0x3057('0x12'));var authService=require(_0x3057('0x13'));var qs=require(_0x3057('0x14'));var as=require(_0x3057('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3057('0x16'))(_0x3057('0x17'));var utils=require(_0x3057('0x18'));var config=require(_0x3057('0x19'));var licenseUtil=require(_0x3057('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13cfd6,_0x9c39c8){_0x9c39c8=_0x9c39c8||0xcc;return function(_0x5b152e){if(_0x5b152e){return _0x13cfd6[_0x3057('0x1b')](_0x9c39c8);}return _0x13cfd6['status'](_0x9c39c8)[_0x3057('0x1c')]();};}function respondWithResult(_0x4e7007,_0x5d5b05){_0x5d5b05=_0x5d5b05||0xc8;return function(_0xb0bd71){if(_0xb0bd71){return _0x4e7007[_0x3057('0x1d')](_0x5d5b05)[_0x3057('0x1e')](_0xb0bd71);}};}function respondWithFilteredResult(_0x5deff0,_0x3fc48e){return function(_0x28fcd1){if(_0x28fcd1){var _0x2ee2c2=_0x28fcd1[_0x3057('0x1f')],_0x260f98=_0x3fc48e['offset'],_0x5c3439=_0x3fc48e['offset']+_0x3fc48e[_0x3057('0x20')],_0x598040;if(_0x5c3439>=_0x2ee2c2){_0x5c3439=_0x2ee2c2;_0x598040=0xc8;}else{_0x598040=0xce;}_0x5deff0['status'](_0x598040);return _0x5deff0[_0x3057('0x21')]('Content-Range',_0x260f98+'-'+_0x5c3439+'/'+_0x2ee2c2)[_0x3057('0x1e')](_0x28fcd1);}return null;};}function patchUpdates(_0x47f7b7){return function(_0x1f67ec){try{jsonpatch[_0x3057('0x22')](_0x1f67ec,_0x47f7b7,!![]);}catch(_0x5d2f71){return BPromise[_0x3057('0x23')](_0x5d2f71);}return _0x1f67ec[_0x3057('0x24')]();};}function saveUpdates(_0x5e695a,_0x5c75e9){return function(_0x1596c3){if(_0x1596c3){return _0x1596c3[_0x3057('0x25')](_0x5e695a)[_0x3057('0x26')](function(_0x2e26e4){return _0x2e26e4;});}return null;};}function removeEntity(_0x4818d3,_0x58b09c){return function(_0x40e573){if(_0x40e573){return _0x40e573[_0x3057('0x27')]()[_0x3057('0x26')](function(){_0x4818d3[_0x3057('0x1d')](0xcc)[_0x3057('0x1c')]();});}};}function handleEntityNotFound(_0x28acb1,_0x4050e4){return function(_0xe65901){if(!_0xe65901){_0x28acb1[_0x3057('0x1b')](0x194);}return _0xe65901;};}function handleError(_0x19cc82,_0x4304b0){_0x4304b0=_0x4304b0||0x1f4;return function(_0x1a20bb){logger[_0x3057('0x28')](_0x1a20bb[_0x3057('0x29')]);if(_0x1a20bb['name']){delete _0x1a20bb[_0x3057('0x2a')];}_0x19cc82['status'](_0x4304b0)[_0x3057('0x2b')](_0x1a20bb);};}exports[_0x3057('0x2c')]=function(_0x234147,_0x38ae49){var _0x39306f={},_0x4144d3={},_0x274ff1={'count':0x0,'rows':[]};var _0x2a4de1=_[_0x3057('0x2d')](db[_0x3057('0x2e')]['rawAttributes'],function(_0x585189){return{'name':_0x585189[_0x3057('0x2f')],'type':_0x585189[_0x3057('0x30')][_0x3057('0x31')]};});_0x4144d3[_0x3057('0x32')]=_['map'](_0x2a4de1,'name');_0x4144d3[_0x3057('0x33')]=_[_0x3057('0x34')](_0x234147[_0x3057('0x33')]);_0x4144d3[_0x3057('0x35')]=_[_0x3057('0x36')](_0x4144d3[_0x3057('0x32')],_0x4144d3[_0x3057('0x33')]);_0x39306f[_0x3057('0x37')]=_[_0x3057('0x36')](_0x4144d3[_0x3057('0x32')],qs['fields'](_0x234147['query'][_0x3057('0x38')]));_0x39306f['attributes']=_0x39306f['attributes'][_0x3057('0x39')]?_0x39306f['attributes']:_0x4144d3[_0x3057('0x32')];if(!_0x234147[_0x3057('0x33')][_0x3057('0x3a')]('nolimit')){_0x39306f[_0x3057('0x20')]=qs['limit'](_0x234147[_0x3057('0x33')][_0x3057('0x20')]);_0x39306f[_0x3057('0x3b')]=qs[_0x3057('0x3b')](_0x234147[_0x3057('0x33')][_0x3057('0x3b')]);}_0x39306f[_0x3057('0x3c')]=qs[_0x3057('0x3d')](_0x234147[_0x3057('0x33')][_0x3057('0x3d')]);_0x39306f[_0x3057('0x3e')]=qs['filters'](_[_0x3057('0x3f')](_0x234147[_0x3057('0x33')],_0x4144d3[_0x3057('0x35')]),_0x2a4de1);if(_0x234147[_0x3057('0x33')]['filter']){_0x39306f[_0x3057('0x3e')]=_['merge'](_0x39306f['where'],{'$or':_[_0x3057('0x2d')](_0x2a4de1,function(_0x3653e3){if(_0x3653e3[_0x3057('0x30')]!==_0x3057('0x40')){var _0x2473b8={};_0x2473b8[_0x3653e3[_0x3057('0x2a')]]={'$like':'%'+_0x234147[_0x3057('0x33')][_0x3057('0x41')]+'%'};return _0x2473b8;}})});}_0x39306f=_[_0x3057('0x42')]({},_0x39306f,_0x234147[_0x3057('0x43')]);var _0x27c7f6={'where':_0x39306f[_0x3057('0x3e')]};return db[_0x3057('0x2e')][_0x3057('0x1f')](_0x27c7f6)[_0x3057('0x26')](function(_0x369de1){_0x274ff1['count']=_0x369de1;if(_0x234147['query']['includeAll']){_0x39306f['include']=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x39306f);})[_0x3057('0x26')](function(_0x362222){_0x274ff1[_0x3057('0x44')]=_0x362222;return _0x274ff1;})[_0x3057('0x26')](respondWithFilteredResult(_0x38ae49,_0x39306f))['catch'](handleError(_0x38ae49,null));};exports['show']=function(_0x4e0daa,_0x2caf1a){var _0x5ac4d7={'raw':!![],'where':{'id':_0x4e0daa[_0x3057('0x45')]['id']}},_0x317915={};_0x317915[_0x3057('0x32')]=_[_0x3057('0x34')](db['CloudProvider'][_0x3057('0x46')]);_0x317915[_0x3057('0x33')]=_[_0x3057('0x34')](_0x4e0daa[_0x3057('0x33')]);_0x317915['filters']=_['intersection'](_0x317915[_0x3057('0x32')],_0x317915[_0x3057('0x33')]);_0x5ac4d7['attributes']=_[_0x3057('0x36')](_0x317915[_0x3057('0x32')],qs[_0x3057('0x38')](_0x4e0daa[_0x3057('0x33')][_0x3057('0x38')]));_0x5ac4d7[_0x3057('0x37')]=_0x5ac4d7[_0x3057('0x37')][_0x3057('0x39')]?_0x5ac4d7[_0x3057('0x37')]:_0x317915[_0x3057('0x32')];if(_0x4e0daa[_0x3057('0x33')][_0x3057('0x47')]){_0x5ac4d7[_0x3057('0x48')]=[{'all':!![]}];}_0x5ac4d7=_[_0x3057('0x42')]({},_0x5ac4d7,_0x4e0daa['options']);return db[_0x3057('0x2e')][_0x3057('0x49')](_0x5ac4d7)['then'](handleEntityNotFound(_0x2caf1a,null))[_0x3057('0x26')](respondWithResult(_0x2caf1a,null))[_0x3057('0x4a')](handleError(_0x2caf1a,null));};exports['create']=function(_0x509410,_0x44e223){return db[_0x3057('0x2e')]['create'](_0x509410['body'],{})[_0x3057('0x26')](respondWithResult(_0x44e223,0xc9))[_0x3057('0x4a')](handleError(_0x44e223,null));};exports[_0x3057('0x25')]=function(_0x3fe718,_0x5307cb){if(_0x3fe718[_0x3057('0x4b')]['id']){delete _0x3fe718[_0x3057('0x4b')]['id'];}return db[_0x3057('0x2e')][_0x3057('0x49')]({'where':{'id':_0x3fe718[_0x3057('0x45')]['id']}})['then'](handleEntityNotFound(_0x5307cb,null))[_0x3057('0x26')](saveUpdates(_0x3fe718[_0x3057('0x4b')],null))[_0x3057('0x26')](respondWithResult(_0x5307cb,null))[_0x3057('0x4a')](handleError(_0x5307cb,null));};exports[_0x3057('0x27')]=function(_0x1551ac,_0xc2a991){return db[_0x3057('0x2e')][_0x3057('0x49')]({'where':{'id':_0x1551ac[_0x3057('0x45')]['id']}})[_0x3057('0x26')](handleEntityNotFound(_0xc2a991,null))['then'](removeEntity(_0xc2a991,null))[_0x3057('0x4a')](handleError(_0xc2a991,null));}; \ No newline at end of file +var _0xb5c5=['map','CloudProvider','rawAttributes','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','sendStatus','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','status','send','index'];(function(_0x420587,_0x32b37c){var _0x2c8866=function(_0x38d00b){while(--_0x38d00b){_0x420587['push'](_0x420587['shift']());}};_0x2c8866(++_0x32b37c);}(_0xb5c5,0xc3));var _0x5b5c=function(_0x58eb40,_0x279f1c){_0x58eb40=_0x58eb40-0x0;var _0x56f14e=_0xb5c5[_0x58eb40];return _0x56f14e;};'use strict';var pdf=require(_0x5b5c('0x0'));var emlformat=require(_0x5b5c('0x1'));var rimraf=require(_0x5b5c('0x2'));var zipdir=require(_0x5b5c('0x3'));var jsonpatch=require(_0x5b5c('0x4'));var rp=require(_0x5b5c('0x5'));var moment=require(_0x5b5c('0x6'));var BPromise=require(_0x5b5c('0x7'));var Mustache=require(_0x5b5c('0x8'));var util=require('util');var path=require(_0x5b5c('0x9'));var sox=require(_0x5b5c('0xa'));var csv=require('to-csv');var ejs=require(_0x5b5c('0xb'));var fs=require('fs');var _=require(_0x5b5c('0xc'));var squel=require(_0x5b5c('0xd'));var crypto=require(_0x5b5c('0xe'));var jsforce=require(_0x5b5c('0xf'));var deskjs=require(_0x5b5c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5b5c('0x11'));var Papa=require(_0x5b5c('0x12'));var Redis=require(_0x5b5c('0x13'));var authService=require(_0x5b5c('0x14'));var qs=require(_0x5b5c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b5c('0x16'));var logger=require(_0x5b5c('0x17'))('api');var utils=require(_0x5b5c('0x18'));var config=require(_0x5b5c('0x19'));var licenseUtil=require(_0x5b5c('0x1a'));var db=require(_0x5b5c('0x1b'))['db'];function respondWithStatusCode(_0x22d33b,_0x3e996b){_0x3e996b=_0x3e996b||0xcc;return function(_0x4b4bd0){if(_0x4b4bd0){return _0x22d33b[_0x5b5c('0x1c')](_0x3e996b);}return _0x22d33b['status'](_0x3e996b)[_0x5b5c('0x1d')]();};}function respondWithResult(_0x3444a9,_0xe423ee){_0xe423ee=_0xe423ee||0xc8;return function(_0x43b7b1){if(_0x43b7b1){return _0x3444a9['status'](_0xe423ee)[_0x5b5c('0x1e')](_0x43b7b1);}};}function respondWithFilteredResult(_0x198ae4,_0x7d93fb){return function(_0x4f09d8){if(_0x4f09d8){var _0x4b20cc=_0x4f09d8[_0x5b5c('0x1f')],_0x1e009d=_0x7d93fb[_0x5b5c('0x20')],_0x5e2719=_0x7d93fb['offset']+_0x7d93fb['limit'],_0x2f1400;if(_0x5e2719>=_0x4b20cc){_0x5e2719=_0x4b20cc;_0x2f1400=0xc8;}else{_0x2f1400=0xce;}_0x198ae4['status'](_0x2f1400);return _0x198ae4[_0x5b5c('0x21')](_0x5b5c('0x22'),_0x1e009d+'-'+_0x5e2719+'/'+_0x4b20cc)[_0x5b5c('0x1e')](_0x4f09d8);}return null;};}function patchUpdates(_0xe9ef20){return function(_0x46deaf){try{jsonpatch[_0x5b5c('0x23')](_0x46deaf,_0xe9ef20,!![]);}catch(_0x251513){return BPromise[_0x5b5c('0x24')](_0x251513);}return _0x46deaf[_0x5b5c('0x25')]();};}function saveUpdates(_0xdf6a9b,_0x39e549){return function(_0x4c3d0e){if(_0x4c3d0e){return _0x4c3d0e[_0x5b5c('0x26')](_0xdf6a9b)[_0x5b5c('0x27')](function(_0x1fb3b7){return _0x1fb3b7;});}return null;};}function removeEntity(_0xa809d0,_0x3c16da){return function(_0x30bbf4){if(_0x30bbf4){return _0x30bbf4['destroy']()[_0x5b5c('0x27')](function(){_0xa809d0['status'](0xcc)[_0x5b5c('0x1d')]();});}};}function handleEntityNotFound(_0x4eee16,_0x2b6586){return function(_0x1b1674){if(!_0x1b1674){_0x4eee16[_0x5b5c('0x1c')](0x194);}return _0x1b1674;};}function handleError(_0xe26b6a,_0x59162f){_0x59162f=_0x59162f||0x1f4;return function(_0x51a4f1){logger[_0x5b5c('0x28')](_0x51a4f1['stack']);if(_0x51a4f1[_0x5b5c('0x29')]){delete _0x51a4f1['name'];}_0xe26b6a[_0x5b5c('0x2a')](_0x59162f)[_0x5b5c('0x2b')](_0x51a4f1);};}exports[_0x5b5c('0x2c')]=function(_0x431a6a,_0x24fc6f){var _0x58e03b={},_0x29b6cd={},_0x6febd9={'count':0x0,'rows':[]};var _0x21ab79=_[_0x5b5c('0x2d')](db[_0x5b5c('0x2e')][_0x5b5c('0x2f')],function(_0x120e96){return{'name':_0x120e96['fieldName'],'type':_0x120e96['type'][_0x5b5c('0x30')]};});_0x29b6cd['model']=_[_0x5b5c('0x2d')](_0x21ab79,_0x5b5c('0x29'));_0x29b6cd[_0x5b5c('0x31')]=_[_0x5b5c('0x32')](_0x431a6a[_0x5b5c('0x31')]);_0x29b6cd[_0x5b5c('0x33')]=_['intersection'](_0x29b6cd['model'],_0x29b6cd[_0x5b5c('0x31')]);_0x58e03b[_0x5b5c('0x34')]=_[_0x5b5c('0x35')](_0x29b6cd['model'],qs[_0x5b5c('0x36')](_0x431a6a[_0x5b5c('0x31')][_0x5b5c('0x36')]));_0x58e03b[_0x5b5c('0x34')]=_0x58e03b['attributes'][_0x5b5c('0x37')]?_0x58e03b[_0x5b5c('0x34')]:_0x29b6cd[_0x5b5c('0x38')];if(!_0x431a6a[_0x5b5c('0x31')][_0x5b5c('0x39')](_0x5b5c('0x3a'))){_0x58e03b[_0x5b5c('0x3b')]=qs[_0x5b5c('0x3b')](_0x431a6a[_0x5b5c('0x31')][_0x5b5c('0x3b')]);_0x58e03b['offset']=qs[_0x5b5c('0x20')](_0x431a6a['query'][_0x5b5c('0x20')]);}_0x58e03b[_0x5b5c('0x3c')]=qs[_0x5b5c('0x3d')](_0x431a6a['query'][_0x5b5c('0x3d')]);_0x58e03b[_0x5b5c('0x3e')]=qs[_0x5b5c('0x33')](_[_0x5b5c('0x3f')](_0x431a6a['query'],_0x29b6cd['filters']),_0x21ab79);if(_0x431a6a['query'][_0x5b5c('0x40')]){_0x58e03b[_0x5b5c('0x3e')]=_[_0x5b5c('0x41')](_0x58e03b['where'],{'$or':_[_0x5b5c('0x2d')](_0x21ab79,function(_0x148469){if(_0x148469[_0x5b5c('0x42')]!==_0x5b5c('0x43')){var _0x3a0e0d={};_0x3a0e0d[_0x148469[_0x5b5c('0x29')]]={'$like':'%'+_0x431a6a['query'][_0x5b5c('0x40')]+'%'};return _0x3a0e0d;}})});}_0x58e03b=_[_0x5b5c('0x41')]({},_0x58e03b,_0x431a6a[_0x5b5c('0x44')]);var _0x16f124={'where':_0x58e03b[_0x5b5c('0x3e')]};return db['CloudProvider']['count'](_0x16f124)['then'](function(_0x486752){_0x6febd9[_0x5b5c('0x1f')]=_0x486752;if(_0x431a6a['query'][_0x5b5c('0x45')]){_0x58e03b[_0x5b5c('0x46')]=[{'all':!![]}];}return db[_0x5b5c('0x2e')][_0x5b5c('0x47')](_0x58e03b);})[_0x5b5c('0x27')](function(_0x505473){_0x6febd9[_0x5b5c('0x48')]=_0x505473;return _0x6febd9;})[_0x5b5c('0x27')](respondWithFilteredResult(_0x24fc6f,_0x58e03b))[_0x5b5c('0x49')](handleError(_0x24fc6f,null));};exports[_0x5b5c('0x4a')]=function(_0x30b750,_0x24f87e){var _0xcf3c6e={'raw':!![],'where':{'id':_0x30b750[_0x5b5c('0x4b')]['id']}},_0x81423c={};_0x81423c[_0x5b5c('0x38')]=_['keys'](db[_0x5b5c('0x2e')][_0x5b5c('0x2f')]);_0x81423c[_0x5b5c('0x31')]=_[_0x5b5c('0x32')](_0x30b750['query']);_0x81423c[_0x5b5c('0x33')]=_[_0x5b5c('0x35')](_0x81423c[_0x5b5c('0x38')],_0x81423c[_0x5b5c('0x31')]);_0xcf3c6e[_0x5b5c('0x34')]=_[_0x5b5c('0x35')](_0x81423c[_0x5b5c('0x38')],qs[_0x5b5c('0x36')](_0x30b750['query'][_0x5b5c('0x36')]));_0xcf3c6e[_0x5b5c('0x34')]=_0xcf3c6e['attributes']['length']?_0xcf3c6e[_0x5b5c('0x34')]:_0x81423c[_0x5b5c('0x38')];if(_0x30b750['query']['includeAll']){_0xcf3c6e['include']=[{'all':!![]}];}_0xcf3c6e=_['merge']({},_0xcf3c6e,_0x30b750[_0x5b5c('0x44')]);return db[_0x5b5c('0x2e')][_0x5b5c('0x4c')](_0xcf3c6e)['then'](handleEntityNotFound(_0x24f87e,null))[_0x5b5c('0x27')](respondWithResult(_0x24f87e,null))[_0x5b5c('0x49')](handleError(_0x24f87e,null));};exports[_0x5b5c('0x4d')]=function(_0x465cbe,_0x2ee6c6){return db[_0x5b5c('0x2e')]['create'](_0x465cbe['body'],{})[_0x5b5c('0x27')](respondWithResult(_0x2ee6c6,0xc9))['catch'](handleError(_0x2ee6c6,null));};exports[_0x5b5c('0x26')]=function(_0xea7c3f,_0x3f427c){if(_0xea7c3f['body']['id']){delete _0xea7c3f[_0x5b5c('0x4e')]['id'];}return db['CloudProvider'][_0x5b5c('0x4c')]({'where':{'id':_0xea7c3f[_0x5b5c('0x4b')]['id']}})[_0x5b5c('0x27')](handleEntityNotFound(_0x3f427c,null))[_0x5b5c('0x27')](saveUpdates(_0xea7c3f[_0x5b5c('0x4e')],null))[_0x5b5c('0x27')](respondWithResult(_0x3f427c,null))[_0x5b5c('0x49')](handleError(_0x3f427c,null));};exports[_0x5b5c('0x4f')]=function(_0x33bb37,_0x84a353){return db['CloudProvider'][_0x5b5c('0x4c')]({'where':{'id':_0x33bb37[_0x5b5c('0x4b')]['id']}})[_0x5b5c('0x27')](handleEntityNotFound(_0x84a353,null))['then'](removeEntity(_0x84a353,null))[_0x5b5c('0x49')](handleError(_0x84a353,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index c99fd29..5d52456 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 _0x5a03=['path','rimraf','../../config/environment','./cloudProvider.attributes','cloud_providers','../../config/logger','moment','bluebird','request-promise'];(function(_0x14e733,_0x6b50ee){var _0x539e5e=function(_0x4e8f92){while(--_0x4e8f92){_0x14e733['push'](_0x14e733['shift']());}};_0x539e5e(++_0x6b50ee);}(_0x5a03,0x95));var _0x35a0=function(_0x3759f0,_0x5d76d7){_0x3759f0=_0x3759f0-0x0;var _0xecfe82=_0x5a03[_0x3759f0];return _0xecfe82;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x35a0('0x0'))('api');var moment=require(_0x35a0('0x1'));var BPromise=require(_0x35a0('0x2'));var rp=require(_0x35a0('0x3'));var fs=require('fs');var path=require(_0x35a0('0x4'));var rimraf=require(_0x35a0('0x5'));var config=require(_0x35a0('0x6'));var attributes=require(_0x35a0('0x7'));module['exports']=function(_0x582deb,_0x52f663){return _0x582deb['define']('CloudProvider',attributes,{'tableName':_0x35a0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x671f=['request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','api','moment','bluebird'];(function(_0x11c551,_0x1028d2){var _0x14756e=function(_0x5e2b3f){while(--_0x5e2b3f){_0x11c551['push'](_0x11c551['shift']());}};_0x14756e(++_0x1028d2);}(_0x671f,0x11b));var _0xf671=function(_0xc203f9,_0x735ad3){_0xc203f9=_0xc203f9-0x0;var _0x215170=_0x671f[_0xc203f9];return _0x215170;};'use strict';var _=require(_0xf671('0x0'));var util=require(_0xf671('0x1'));var logger=require('../../config/logger')(_0xf671('0x2'));var moment=require(_0xf671('0x3'));var BPromise=require(_0xf671('0x4'));var rp=require(_0xf671('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf671('0x6'));var config=require(_0xf671('0x7'));var attributes=require(_0xf671('0x8'));module[_0xf671('0x9')]=function(_0x592d22,_0x2d75f4){return _0x592d22[_0xf671('0xa')](_0xf671('0xb'),attributes,{'tableName':'cloud_providers','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 9c72c16..418c24b 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 _0x93c0=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','CloudProvider,\x20%s,\x20%s','message','result'];(function(_0x27dd07,_0xc0d7b4){var _0x35f5de=function(_0x3e1e3a){while(--_0x3e1e3a){_0x27dd07['push'](_0x27dd07['shift']());}};_0x35f5de(++_0xc0d7b4);}(_0x93c0,0xbf));var _0x093c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x93c0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x093c('0x0'));var util=require(_0x093c('0x1'));var moment=require(_0x093c('0x2'));var BPromise=require('bluebird');var rs=require(_0x093c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x093c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x093c('0x5'))(_0x093c('0x6'));var config=require(_0x093c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x093c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x83247a,_0x6f573e,_0x29243d){return new BPromise(function(_0x4c80d,_0x22c461){return client['request'](_0x83247a,_0x29243d)[_0x093c('0x9')](function(_0x137c17){logger[_0x093c('0xa')]('CloudProvider,\x20%s,\x20%s',_0x6f573e,_0x093c('0xb'));logger[_0x093c('0xc')](_0x093c('0xd'),_0x6f573e,_0x093c('0xb'),JSON['stringify'](_0x137c17));if(_0x137c17[_0x093c('0xe')]){if(_0x137c17[_0x093c('0xe')]['code']===0x1f4){logger[_0x093c('0xe')](_0x093c('0xf'),_0x6f573e,_0x137c17[_0x093c('0xe')][_0x093c('0x10')]);return _0x22c461(_0x137c17[_0x093c('0xe')][_0x093c('0x10')]);}logger[_0x093c('0xe')]('CloudProvider,\x20%s,\x20%s',_0x6f573e,_0x137c17['error'][_0x093c('0x10')]);return _0x4c80d(_0x137c17[_0x093c('0xe')][_0x093c('0x10')]);}else{logger['info'](_0x093c('0xf'),_0x6f573e,_0x093c('0xb'));_0x4c80d(_0x137c17[_0x093c('0x11')][_0x093c('0x10')]);}})[_0x093c('0x12')](function(_0x30a518){logger[_0x093c('0xe')](_0x093c('0xf'),_0x6f573e,_0x30a518);_0x22c461(_0x30a518);});});} \ No newline at end of file +var _0x38aa=['CloudProvider,\x20%s,\x20%s,\x20%s','error','code','CloudProvider,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug'];(function(_0x22290e,_0x2b9d11){var _0x2fd25a=function(_0x324efb){while(--_0x324efb){_0x22290e['push'](_0x22290e['shift']());}};_0x2fd25a(++_0x2b9d11);}(_0x38aa,0x133));var _0xa38a=function(_0x1befd8,_0x49274a){_0x1befd8=_0x1befd8-0x0;var _0x14af8c=_0x38aa[_0x1befd8];return _0x14af8c;};'use strict';var _=require(_0xa38a('0x0'));var util=require('util');var moment=require(_0xa38a('0x1'));var BPromise=require(_0xa38a('0x2'));var rs=require(_0xa38a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa38a('0x4'))['db'];var utils=require(_0xa38a('0x5'));var logger=require(_0xa38a('0x6'))(_0xa38a('0x7'));var config=require(_0xa38a('0x8'));var jayson=require(_0xa38a('0x9'));var client=jayson[_0xa38a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x443bea,_0x20029d,_0x39922b){return new BPromise(function(_0x2f010c,_0x50d8a8){return client[_0xa38a('0xb')](_0x443bea,_0x39922b)[_0xa38a('0xc')](function(_0x341018){logger['info']('CloudProvider,\x20%s,\x20%s',_0x20029d,_0xa38a('0xd'));logger[_0xa38a('0xe')](_0xa38a('0xf'),_0x20029d,_0xa38a('0xd'),JSON['stringify'](_0x341018));if(_0x341018[_0xa38a('0x10')]){if(_0x341018[_0xa38a('0x10')][_0xa38a('0x11')]===0x1f4){logger[_0xa38a('0x10')](_0xa38a('0x12'),_0x20029d,_0x341018[_0xa38a('0x10')]['message']);return _0x50d8a8(_0x341018[_0xa38a('0x10')][_0xa38a('0x13')]);}logger[_0xa38a('0x10')](_0xa38a('0x12'),_0x20029d,_0x341018['error'][_0xa38a('0x13')]);return _0x2f010c(_0x341018['error'][_0xa38a('0x13')]);}else{logger[_0xa38a('0x14')](_0xa38a('0x12'),_0x20029d,'request\x20sent');_0x2f010c(_0x341018[_0xa38a('0x15')][_0xa38a('0x13')]);}})[_0xa38a('0x16')](function(_0x1bb89e){logger['error'](_0xa38a('0x12'),_0x20029d,_0x1bb89e);_0x50d8a8(_0x1bb89e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5444152..5b05928 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 _0x0991=['index','/:id','isAuthenticated','create','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get'];(function(_0x2f74fa,_0x156cd5){var _0xd590e1=function(_0x36fec2){while(--_0x36fec2){_0x2f74fa['push'](_0x2f74fa['shift']());}};_0xd590e1(++_0x156cd5);}(_0x0991,0x16c));var _0x1099=function(_0x46317e,_0x5716ec){_0x46317e=_0x46317e-0x0;var _0x4fb302=_0x0991[_0x46317e];return _0x4fb302;};'use strict';var multer=require(_0x1099('0x0'));var util=require(_0x1099('0x1'));var path=require(_0x1099('0x2'));var timeout=require(_0x1099('0x3'));var express=require('express');var router=express[_0x1099('0x4')]();var auth=require(_0x1099('0x5'));var interaction=require(_0x1099('0x6'));var config=require(_0x1099('0x7'));var controller=require(_0x1099('0x8'));router[_0x1099('0x9')]('/',auth['isAuthenticated'](),controller[_0x1099('0xa')]);router['get'](_0x1099('0xb'),auth[_0x1099('0xc')](),controller['show']);router['post']('/',auth[_0x1099('0xc')](),controller[_0x1099('0xd')]);router[_0x1099('0xe')](_0x1099('0xb'),auth[_0x1099('0xc')](),controller[_0x1099('0xf')]);router['delete'](_0x1099('0xb'),auth[_0x1099('0xc')](),controller['destroy']);module[_0x1099('0x10')]=router; \ No newline at end of file +var _0x2abb=['create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x2abb,0xc5));var _0xb2ab=function(_0x5687e7,_0x10cf94){_0x5687e7=_0x5687e7-0x0;var _0x54c75e=_0x2abb[_0x5687e7];return _0x54c75e;};'use strict';var multer=require(_0xb2ab('0x0'));var util=require(_0xb2ab('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb2ab('0x2'));var router=express[_0xb2ab('0x3')]();var auth=require(_0xb2ab('0x4'));var interaction=require(_0xb2ab('0x5'));var config=require(_0xb2ab('0x6'));var controller=require('./cloudProvider.controller');router[_0xb2ab('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb2ab('0x7')](_0xb2ab('0x8'),auth[_0xb2ab('0x9')](),controller['show']);router[_0xb2ab('0xa')]('/',auth[_0xb2ab('0x9')](),controller[_0xb2ab('0xb')]);router[_0xb2ab('0xc')](_0xb2ab('0x8'),auth[_0xb2ab('0x9')](),controller[_0xb2ab('0xd')]);router[_0xb2ab('0xe')]('/:id',auth[_0xb2ab('0x9')](),controller['destroy']);module[_0xb2ab('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 2991421..24ec00c 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 _0x2ec2=['STRING','name','exports'];(function(_0x42225b,_0x1f8819){var _0x29071e=function(_0x51bc0d){while(--_0x51bc0d){_0x42225b['push'](_0x42225b['shift']());}};_0x29071e(++_0x1f8819);}(_0x2ec2,0xe3));var _0x22ec=function(_0x31659b,_0x3f07a1){_0x31659b=_0x31659b-0x0;var _0x48b140=_0x2ec2[_0x31659b];return _0x48b140;};'use strict';var Sequelize=require('sequelize');module[_0x22ec('0x0')]={'name':{'type':Sequelize[_0x22ec('0x1')],'unique':_0x22ec('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x22ec('0x1')]},'companyId':{'type':Sequelize[_0x22ec('0x1')]},'website':{'type':Sequelize[_0x22ec('0x1')]},'phone':{'type':Sequelize[_0x22ec('0x1')]},'fax':{'type':Sequelize[_0x22ec('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x22ec('0x1')]},'country':{'type':Sequelize[_0x22ec('0x1')]},'email':{'type':Sequelize[_0x22ec('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x22ec('0x1')]},'sStreet':{'type':Sequelize[_0x22ec('0x1')]},'sPostalCode':{'type':Sequelize[_0x22ec('0x1')]},'sCity':{'type':Sequelize[_0x22ec('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xde7a=['STRING','name','exports'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0xde7a,0xc2));var _0xade7=function(_0x42cf3e,_0x50abbe){_0x42cf3e=_0x42cf3e-0x0;var _0x184386=_0xde7a[_0x42cf3e];return _0x184386;};'use strict';var Sequelize=require('sequelize');module[_0xade7('0x0')]={'name':{'type':Sequelize[_0xade7('0x1')],'unique':_0xade7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xade7('0x1')]},'companyId':{'type':Sequelize[_0xade7('0x1')]},'website':{'type':Sequelize[_0xade7('0x1')]},'phone':{'type':Sequelize[_0xade7('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xade7('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xade7('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xade7('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xade7('0x1')]},'sStreet':{'type':Sequelize[_0xade7('0x1')]},'sPostalCode':{'type':Sequelize[_0xade7('0x1')]},'sCity':{'type':Sequelize[_0xade7('0x1')]},'sCountry':{'type':Sequelize[_0xade7('0x1')]},'description':{'type':Sequelize[_0xade7('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 24f6ebe..e2b6b99 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 _0xd2e5=['set','Content-Range','reject','update','then','destroy','UserProfileResource','error','stack','index','model','keys','query','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filters','filter','merge','map','options','CmCompany','includeAll','include','findAll','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','autoAssociation','name','body','describe','addContacts','CmContact','ids','omit','getContacts','rawAttributes','order','hasOwnProperty','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x532b3d,_0x2628f3){var _0x29e01f=function(_0x20a7a5){while(--_0x20a7a5){_0x532b3d['push'](_0x532b3d['shift']());}};_0x29e01f(++_0x2628f3);}(_0xd2e5,0x128));var _0x5d2e=function(_0x3722d2,_0x206336){_0x3722d2=_0x3722d2-0x0;var _0x15ae66=_0xd2e5[_0x3722d2];return _0x15ae66;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5d2e('0x0'));var zipdir=require(_0x5d2e('0x1'));var jsonpatch=require(_0x5d2e('0x2'));var rp=require('request-promise');var moment=require(_0x5d2e('0x3'));var BPromise=require(_0x5d2e('0x4'));var Mustache=require(_0x5d2e('0x5'));var util=require(_0x5d2e('0x6'));var path=require(_0x5d2e('0x7'));var sox=require(_0x5d2e('0x8'));var csv=require(_0x5d2e('0x9'));var ejs=require(_0x5d2e('0xa'));var fs=require('fs');var _=require(_0x5d2e('0xb'));var squel=require(_0x5d2e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5d2e('0xd'));var toCsv=require(_0x5d2e('0x9'));var querystring=require(_0x5d2e('0xe'));var Papa=require(_0x5d2e('0xf'));var Redis=require('ioredis');var authService=require(_0x5d2e('0x10'));var qs=require(_0x5d2e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d2e('0x12'))(_0x5d2e('0x13'));var utils=require('../../config/utils');var config=require(_0x5d2e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d2e('0x15'))['db'];function respondWithStatusCode(_0x21b5e4,_0x56e1f7){_0x56e1f7=_0x56e1f7||0xcc;return function(_0x5da42e){if(_0x5da42e){return _0x21b5e4[_0x5d2e('0x16')](_0x56e1f7);}return _0x21b5e4[_0x5d2e('0x17')](_0x56e1f7)[_0x5d2e('0x18')]();};}function respondWithResult(_0x2dadc4,_0x512dfb){_0x512dfb=_0x512dfb||0xc8;return function(_0x50a75f){if(_0x50a75f){return _0x2dadc4['status'](_0x512dfb)[_0x5d2e('0x19')](_0x50a75f);}};}function respondWithFilteredResult(_0x3536d2,_0x12f790){return function(_0x2b6a4e){if(_0x2b6a4e){var _0x1790ae=_0x2b6a4e[_0x5d2e('0x1a')],_0x337a70=_0x12f790[_0x5d2e('0x1b')],_0x42b949=_0x12f790[_0x5d2e('0x1b')]+_0x12f790['limit'],_0x1fc76c;if(_0x42b949>=_0x1790ae){_0x42b949=_0x1790ae;_0x1fc76c=0xc8;}else{_0x1fc76c=0xce;}_0x3536d2[_0x5d2e('0x17')](_0x1fc76c);return _0x3536d2[_0x5d2e('0x1c')](_0x5d2e('0x1d'),_0x337a70+'-'+_0x42b949+'/'+_0x1790ae)['json'](_0x2b6a4e);}return null;};}function patchUpdates(_0x50d1d1){return function(_0x141b0f){try{jsonpatch['apply'](_0x141b0f,_0x50d1d1,!![]);}catch(_0x1c5ef4){return BPromise[_0x5d2e('0x1e')](_0x1c5ef4);}return _0x141b0f['save']();};}function saveUpdates(_0x2a91fa,_0x239998){return function(_0x5c6815){if(_0x5c6815){return _0x5c6815[_0x5d2e('0x1f')](_0x2a91fa)[_0x5d2e('0x20')](function(_0x520724){return _0x520724;});}return null;};}function removeEntity(_0x3461db,_0x5e6a15){return function(_0x18d9ae){if(_0x18d9ae){return _0x18d9ae[_0x5d2e('0x21')]()[_0x5d2e('0x20')](function(){var _0x1449ab=_0x18d9ae['get']({'plain':!![]});var _0xf692c4='Companies';return db[_0x5d2e('0x22')][_0x5d2e('0x21')]({'where':{'type':_0xf692c4,'resourceId':_0x1449ab['id']}})['then'](function(){return _0x18d9ae;});})[_0x5d2e('0x20')](function(){_0x3461db[_0x5d2e('0x17')](0xcc)[_0x5d2e('0x18')]();});}};}function handleEntityNotFound(_0x415f09,_0x3f4c22){return function(_0x35be11){if(!_0x35be11){_0x415f09[_0x5d2e('0x16')](0x194);}return _0x35be11;};}function handleError(_0x5ca084,_0x5a2fad){_0x5a2fad=_0x5a2fad||0x1f4;return function(_0x31332a){logger[_0x5d2e('0x23')](_0x31332a[_0x5d2e('0x24')]);if(_0x31332a['name']){delete _0x31332a['name'];}_0x5ca084['status'](_0x5a2fad)['send'](_0x31332a);};}exports[_0x5d2e('0x25')]=function(_0x3b3869,_0x3855f9){var _0x122491={},_0x5700fa={},_0x10a9a4={'count':0x0,'rows':[]};return db['CmCompany']['describe']()['then'](function(_0xe5ffba){_0x5700fa[_0x5d2e('0x26')]=_[_0x5d2e('0x27')](_0xe5ffba);_0x5700fa[_0x5d2e('0x28')]=_[_0x5d2e('0x27')](_0x3b3869[_0x5d2e('0x28')]);_0x5700fa['filters']=_[_0x5d2e('0x29')](_0x5700fa[_0x5d2e('0x26')],_0x5700fa['query']);_0x122491[_0x5d2e('0x2a')]=_[_0x5d2e('0x29')](_0x5700fa[_0x5d2e('0x26')],qs[_0x5d2e('0x2b')](_0x3b3869[_0x5d2e('0x28')][_0x5d2e('0x2b')]));_0x122491[_0x5d2e('0x2a')]=_0x122491['attributes'][_0x5d2e('0x2c')]?_0x122491['attributes']:_0x5700fa['model'];if(!_0x3b3869[_0x5d2e('0x28')]['hasOwnProperty'](_0x5d2e('0x2d'))){_0x122491[_0x5d2e('0x2e')]=qs[_0x5d2e('0x2e')](_0x3b3869[_0x5d2e('0x28')]['limit']);_0x122491[_0x5d2e('0x1b')]=qs[_0x5d2e('0x1b')](_0x3b3869[_0x5d2e('0x28')]['offset']);}_0x122491['order']=qs['sort'](_0x3b3869[_0x5d2e('0x28')][_0x5d2e('0x2f')]);_0x122491[_0x5d2e('0x30')]=qs['filters'](_[_0x5d2e('0x31')](_0x3b3869['query'],_0x5700fa[_0x5d2e('0x32')]),_0xe5ffba);if(_0x3b3869[_0x5d2e('0x28')][_0x5d2e('0x33')]){_0x122491['where']=_[_0x5d2e('0x34')](_0x122491['where'],{'$or':_[_0x5d2e('0x35')](_0x122491['attributes'],function(_0x228534){var _0x48ed1e={};_0x48ed1e[_0x228534]={'$like':'%'+_0x3b3869[_0x5d2e('0x28')][_0x5d2e('0x33')]+'%'};return _0x48ed1e;})});}_0x122491=_[_0x5d2e('0x34')]({},_0x122491,_0x3b3869[_0x5d2e('0x36')]);var _0xf144d2={'where':_0x122491['where']};return db[_0x5d2e('0x37')][_0x5d2e('0x1a')](_0xf144d2)[_0x5d2e('0x20')](function(_0xfde3d2){_0x10a9a4['count']=_0xfde3d2;if(_0x3b3869[_0x5d2e('0x28')][_0x5d2e('0x38')]){_0x122491[_0x5d2e('0x39')]=[{'all':!![]}];}return db[_0x5d2e('0x37')][_0x5d2e('0x3a')](_0x122491);})[_0x5d2e('0x20')](function(_0x290d54){_0x10a9a4['rows']=_0x290d54;return _0x10a9a4;})[_0x5d2e('0x20')](respondWithFilteredResult(_0x3855f9,_0x122491))[_0x5d2e('0x3b')](handleError(_0x3855f9,null));})[_0x5d2e('0x3b')](handleError(_0x3855f9,null));};exports[_0x5d2e('0x3c')]=function(_0x5ebf66,_0x1c6d4b){var _0x120b7e={'raw':![],'where':{'id':_0x5ebf66[_0x5d2e('0x3d')]['id']}},_0x3da8f4={};_0x3da8f4['model']=_[_0x5d2e('0x27')](db[_0x5d2e('0x37')]['rawAttributes']);_0x3da8f4[_0x5d2e('0x28')]=_[_0x5d2e('0x27')](_0x5ebf66[_0x5d2e('0x28')]);_0x3da8f4[_0x5d2e('0x32')]=_[_0x5d2e('0x29')](_0x3da8f4[_0x5d2e('0x26')],_0x3da8f4[_0x5d2e('0x28')]);_0x120b7e[_0x5d2e('0x2a')]=_['intersection'](_0x3da8f4[_0x5d2e('0x26')],qs[_0x5d2e('0x2b')](_0x5ebf66['query']['fields']));_0x120b7e[_0x5d2e('0x2a')]=_0x120b7e['attributes']['length']?_0x120b7e['attributes']:_0x3da8f4['model'];if(_0x5ebf66[_0x5d2e('0x28')][_0x5d2e('0x38')]){_0x120b7e[_0x5d2e('0x39')]=[{'all':!![]}];}_0x120b7e=_[_0x5d2e('0x34')]({},_0x120b7e,_0x5ebf66[_0x5d2e('0x36')]);return db[_0x5d2e('0x37')][_0x5d2e('0x3e')](_0x120b7e)['then'](handleEntityNotFound(_0x1c6d4b,null))[_0x5d2e('0x20')](respondWithResult(_0x1c6d4b,null))['catch'](handleError(_0x1c6d4b,null));};exports[_0x5d2e('0x3f')]=function(_0x4f64ff,_0x26cfdc){return db[_0x5d2e('0x37')][_0x5d2e('0x3f')](_0x4f64ff['body'],{})[_0x5d2e('0x20')](function(_0xc54c21){var _0x3a37bb=_0x4f64ff[_0x5d2e('0x40')][_0x5d2e('0x41')]({'plain':!![]});if(!_0x3a37bb)throw new Error(_0x5d2e('0x42'));if(_0x3a37bb['role']===_0x5d2e('0x40')){var _0x6f5f22=_0xc54c21[_0x5d2e('0x41')]({'plain':!![]});var _0x47849f=_0x5d2e('0x43');return db[_0x5d2e('0x44')][_0x5d2e('0x3e')]({'where':{'name':_0x47849f,'userProfileId':_0x3a37bb['userProfileId']},'raw':!![]})[_0x5d2e('0x20')](function(_0x2c3ab6){if(_0x2c3ab6&&_0x2c3ab6[_0x5d2e('0x45')]===0x0){return db['UserProfileResource'][_0x5d2e('0x3f')]({'name':_0x6f5f22[_0x5d2e('0x46')],'resourceId':_0x6f5f22['id'],'type':_0x2c3ab6[_0x5d2e('0x46')],'sectionId':_0x2c3ab6['id']},{})[_0x5d2e('0x20')](function(){return _0xc54c21;});}else{return _0xc54c21;}})[_0x5d2e('0x3b')](function(_0x5adc61){logger[_0x5d2e('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5adc61);throw _0x5adc61;});}return _0xc54c21;})[_0x5d2e('0x20')](respondWithResult(_0x26cfdc,0xc9))['catch'](handleError(_0x26cfdc,null));};exports['update']=function(_0x4ebf35,_0x4dbf2e){if(_0x4ebf35[_0x5d2e('0x47')]['id']){delete _0x4ebf35[_0x5d2e('0x47')]['id'];}return db[_0x5d2e('0x37')][_0x5d2e('0x3e')]({'where':{'id':_0x4ebf35[_0x5d2e('0x3d')]['id']}})[_0x5d2e('0x20')](handleEntityNotFound(_0x4dbf2e,null))[_0x5d2e('0x20')](saveUpdates(_0x4ebf35[_0x5d2e('0x47')],null))[_0x5d2e('0x20')](respondWithResult(_0x4dbf2e,null))['catch'](handleError(_0x4dbf2e,null));};exports[_0x5d2e('0x21')]=function(_0x4b612c,_0x4b0436){return db[_0x5d2e('0x37')][_0x5d2e('0x3e')]({'where':{'id':_0x4b612c['params']['id']}})['then'](handleEntityNotFound(_0x4b0436,null))[_0x5d2e('0x20')](removeEntity(_0x4b0436,null))[_0x5d2e('0x3b')](handleError(_0x4b0436,null));};exports[_0x5d2e('0x48')]=function(_0x4db1ab,_0x60e5c8){return db['CmCompany']['describe']()[_0x5d2e('0x20')](respondWithResult(_0x60e5c8,null))[_0x5d2e('0x3b')](handleError(_0x60e5c8,null));};exports[_0x5d2e('0x49')]=function(_0x340bbe,_0x161be0,_0x222a42){return db[_0x5d2e('0x4a')]['find']({'where':{'id':_0x340bbe[_0x5d2e('0x3d')]['id']}})['then'](handleEntityNotFound(_0x161be0,null))[_0x5d2e('0x20')](function(_0x563e47){if(_0x563e47){return _0x563e47[_0x5d2e('0x49')](_0x340bbe['body'][_0x5d2e('0x4b')],_[_0x5d2e('0x4c')](_0x340bbe[_0x5d2e('0x47')],[_0x5d2e('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x161be0,null))['catch'](handleError(_0x161be0,null));};exports[_0x5d2e('0x4d')]=function(_0x346bc8,_0x46aa11,_0x18c8bf){var _0x232b2b={};var _0x8e72b={};var _0x46aefe;var _0x1f02cc;return db[_0x5d2e('0x37')]['findOne']({'where':{'id':_0x346bc8['params']['id']}})[_0x5d2e('0x20')](handleEntityNotFound(_0x46aa11,null))[_0x5d2e('0x20')](function(_0x527134){if(_0x527134){_0x46aefe=_0x527134;_0x8e72b[_0x5d2e('0x26')]=_[_0x5d2e('0x27')](db[_0x5d2e('0x4a')][_0x5d2e('0x4e')]);_0x8e72b[_0x5d2e('0x28')]=_[_0x5d2e('0x27')](_0x346bc8[_0x5d2e('0x28')]);_0x8e72b[_0x5d2e('0x32')]=_[_0x5d2e('0x29')](_0x8e72b[_0x5d2e('0x26')],_0x8e72b['query']);_0x232b2b[_0x5d2e('0x2a')]=_['intersection'](_0x8e72b[_0x5d2e('0x26')],qs['fields'](_0x346bc8[_0x5d2e('0x28')]['fields']));_0x232b2b[_0x5d2e('0x2a')]=_0x232b2b[_0x5d2e('0x2a')][_0x5d2e('0x2c')]?_0x232b2b[_0x5d2e('0x2a')]:_0x8e72b[_0x5d2e('0x26')];_0x232b2b[_0x5d2e('0x4f')]=qs['sort'](_0x346bc8[_0x5d2e('0x28')]['sort']);_0x232b2b[_0x5d2e('0x30')]=qs['filters'](_['pick'](_0x346bc8[_0x5d2e('0x28')],_0x8e72b[_0x5d2e('0x32')]));if(_0x346bc8[_0x5d2e('0x28')][_0x5d2e('0x33')]){_0x232b2b[_0x5d2e('0x30')]=_[_0x5d2e('0x34')](_0x232b2b[_0x5d2e('0x30')],{'$or':_[_0x5d2e('0x35')](_0x232b2b[_0x5d2e('0x2a')],function(_0x55a203){var _0x3e3939={};_0x3e3939[_0x55a203]={'$like':'%'+_0x346bc8[_0x5d2e('0x28')][_0x5d2e('0x33')]+'%'};return _0x3e3939;})});}_0x232b2b=_[_0x5d2e('0x34')]({},_0x232b2b,_0x346bc8[_0x5d2e('0x36')]);return _0x46aefe[_0x5d2e('0x4d')](_0x232b2b);}})[_0x5d2e('0x20')](function(_0x3333a){if(_0x3333a){_0x1f02cc=_0x3333a['length'];if(!_0x346bc8['query'][_0x5d2e('0x50')](_0x5d2e('0x2d'))){_0x232b2b['limit']=qs[_0x5d2e('0x2e')](_0x346bc8[_0x5d2e('0x28')][_0x5d2e('0x2e')]);_0x232b2b[_0x5d2e('0x1b')]=qs[_0x5d2e('0x1b')](_0x346bc8[_0x5d2e('0x28')][_0x5d2e('0x1b')]);}return _0x46aefe[_0x5d2e('0x4d')](_0x232b2b);}})['then'](function(_0x4d94c9){if(_0x4d94c9){return _0x4d94c9?{'count':_0x1f02cc,'rows':_0x4d94c9}:null;}})['then'](respondWithResult(_0x46aa11,null))['catch'](handleError(_0x46aa11,null));}; \ No newline at end of file +var _0x22cb=['hasOwnProperty','nolimit','sort','where','map','filter','CmCompany','includeAll','include','findAll','catch','show','rawAttributes','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','params','describe','addContacts','ids','omit','getContacts','findOne','CmContact','order','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','update','then','destroy','get','Companies','UserProfileResource','error','name','send','index','keys','query','filters','intersection','model','attributes','fields'];(function(_0x315b7c,_0x19ff8e){var _0x3a99eb=function(_0x21afc2){while(--_0x21afc2){_0x315b7c['push'](_0x315b7c['shift']());}};_0x3a99eb(++_0x19ff8e);}(_0x22cb,0x7a));var _0xb22c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x22cb[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb22c('0x0'));var rimraf=require(_0xb22c('0x1'));var zipdir=require(_0xb22c('0x2'));var jsonpatch=require(_0xb22c('0x3'));var rp=require(_0xb22c('0x4'));var moment=require(_0xb22c('0x5'));var BPromise=require(_0xb22c('0x6'));var Mustache=require(_0xb22c('0x7'));var util=require(_0xb22c('0x8'));var path=require(_0xb22c('0x9'));var sox=require(_0xb22c('0xa'));var csv=require('to-csv');var ejs=require(_0xb22c('0xb'));var fs=require('fs');var _=require(_0xb22c('0xc'));var squel=require(_0xb22c('0xd'));var crypto=require(_0xb22c('0xe'));var jsforce=require(_0xb22c('0xf'));var deskjs=require(_0xb22c('0x10'));var toCsv=require(_0xb22c('0x11'));var querystring=require('querystring');var Papa=require(_0xb22c('0x12'));var Redis=require(_0xb22c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb22c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb22c('0x15'));var logger=require(_0xb22c('0x16'))(_0xb22c('0x17'));var utils=require(_0xb22c('0x18'));var config=require(_0xb22c('0x19'));var licenseUtil=require(_0xb22c('0x1a'));var db=require(_0xb22c('0x1b'))['db'];function respondWithStatusCode(_0x2dcdda,_0x5c79df){_0x5c79df=_0x5c79df||0xcc;return function(_0x2d2e61){if(_0x2d2e61){return _0x2dcdda[_0xb22c('0x1c')](_0x5c79df);}return _0x2dcdda[_0xb22c('0x1d')](_0x5c79df)[_0xb22c('0x1e')]();};}function respondWithResult(_0x104bb0,_0x46bc5c){_0x46bc5c=_0x46bc5c||0xc8;return function(_0x28a05a){if(_0x28a05a){return _0x104bb0[_0xb22c('0x1d')](_0x46bc5c)[_0xb22c('0x1f')](_0x28a05a);}};}function respondWithFilteredResult(_0xf54432,_0x548e19){return function(_0x33e31a){if(_0x33e31a){var _0x20dd30=_0x33e31a[_0xb22c('0x20')],_0x26434b=_0x548e19[_0xb22c('0x21')],_0x2d03dc=_0x548e19['offset']+_0x548e19[_0xb22c('0x22')],_0x147779;if(_0x2d03dc>=_0x20dd30){_0x2d03dc=_0x20dd30;_0x147779=0xc8;}else{_0x147779=0xce;}_0xf54432[_0xb22c('0x1d')](_0x147779);return _0xf54432['set']('Content-Range',_0x26434b+'-'+_0x2d03dc+'/'+_0x20dd30)['json'](_0x33e31a);}return null;};}function patchUpdates(_0xecf542){return function(_0x215811){try{jsonpatch[_0xb22c('0x23')](_0x215811,_0xecf542,!![]);}catch(_0x2196ed){return BPromise[_0xb22c('0x24')](_0x2196ed);}return _0x215811['save']();};}function saveUpdates(_0x466607,_0x5e3a6c){return function(_0x11bbea){if(_0x11bbea){return _0x11bbea[_0xb22c('0x25')](_0x466607)[_0xb22c('0x26')](function(_0x3ba01){return _0x3ba01;});}return null;};}function removeEntity(_0x307e27,_0x5e97c0){return function(_0x53f474){if(_0x53f474){return _0x53f474[_0xb22c('0x27')]()[_0xb22c('0x26')](function(){var _0x211727=_0x53f474[_0xb22c('0x28')]({'plain':!![]});var _0x120d19=_0xb22c('0x29');return db[_0xb22c('0x2a')][_0xb22c('0x27')]({'where':{'type':_0x120d19,'resourceId':_0x211727['id']}})[_0xb22c('0x26')](function(){return _0x53f474;});})[_0xb22c('0x26')](function(){_0x307e27[_0xb22c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1390dc,_0x58f4b1){return function(_0x252123){if(!_0x252123){_0x1390dc['sendStatus'](0x194);}return _0x252123;};}function handleError(_0x22af26,_0x4cb0a6){_0x4cb0a6=_0x4cb0a6||0x1f4;return function(_0x19d18a){logger[_0xb22c('0x2b')](_0x19d18a['stack']);if(_0x19d18a['name']){delete _0x19d18a[_0xb22c('0x2c')];}_0x22af26['status'](_0x4cb0a6)[_0xb22c('0x2d')](_0x19d18a);};}exports[_0xb22c('0x2e')]=function(_0x1ec0ae,_0x111852){var _0x598703={},_0x37564a={},_0x3848e3={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0xb22c('0x26')](function(_0x46858c){_0x37564a['model']=_[_0xb22c('0x2f')](_0x46858c);_0x37564a[_0xb22c('0x30')]=_[_0xb22c('0x2f')](_0x1ec0ae[_0xb22c('0x30')]);_0x37564a[_0xb22c('0x31')]=_[_0xb22c('0x32')](_0x37564a[_0xb22c('0x33')],_0x37564a['query']);_0x598703[_0xb22c('0x34')]=_[_0xb22c('0x32')](_0x37564a[_0xb22c('0x33')],qs[_0xb22c('0x35')](_0x1ec0ae['query']['fields']));_0x598703['attributes']=_0x598703[_0xb22c('0x34')]['length']?_0x598703['attributes']:_0x37564a['model'];if(!_0x1ec0ae[_0xb22c('0x30')][_0xb22c('0x36')](_0xb22c('0x37'))){_0x598703[_0xb22c('0x22')]=qs[_0xb22c('0x22')](_0x1ec0ae[_0xb22c('0x30')][_0xb22c('0x22')]);_0x598703[_0xb22c('0x21')]=qs[_0xb22c('0x21')](_0x1ec0ae[_0xb22c('0x30')][_0xb22c('0x21')]);}_0x598703['order']=qs[_0xb22c('0x38')](_0x1ec0ae['query']['sort']);_0x598703[_0xb22c('0x39')]=qs[_0xb22c('0x31')](_['pick'](_0x1ec0ae['query'],_0x37564a[_0xb22c('0x31')]),_0x46858c);if(_0x1ec0ae[_0xb22c('0x30')]['filter']){_0x598703[_0xb22c('0x39')]=_['merge'](_0x598703[_0xb22c('0x39')],{'$or':_[_0xb22c('0x3a')](_0x598703[_0xb22c('0x34')],function(_0x83bebd){var _0x1d5298={};_0x1d5298[_0x83bebd]={'$like':'%'+_0x1ec0ae['query'][_0xb22c('0x3b')]+'%'};return _0x1d5298;})});}_0x598703=_['merge']({},_0x598703,_0x1ec0ae['options']);var _0x212de7={'where':_0x598703['where']};return db[_0xb22c('0x3c')]['count'](_0x212de7)[_0xb22c('0x26')](function(_0x2e38e2){_0x3848e3[_0xb22c('0x20')]=_0x2e38e2;if(_0x1ec0ae[_0xb22c('0x30')][_0xb22c('0x3d')]){_0x598703[_0xb22c('0x3e')]=[{'all':!![]}];}return db[_0xb22c('0x3c')][_0xb22c('0x3f')](_0x598703);})[_0xb22c('0x26')](function(_0x35c758){_0x3848e3['rows']=_0x35c758;return _0x3848e3;})[_0xb22c('0x26')](respondWithFilteredResult(_0x111852,_0x598703))['catch'](handleError(_0x111852,null));})[_0xb22c('0x40')](handleError(_0x111852,null));};exports[_0xb22c('0x41')]=function(_0x2feea4,_0xd20161){var _0x4a0113={'raw':![],'where':{'id':_0x2feea4['params']['id']}},_0xc849f9={};_0xc849f9['model']=_['keys'](db[_0xb22c('0x3c')][_0xb22c('0x42')]);_0xc849f9['query']=_[_0xb22c('0x2f')](_0x2feea4['query']);_0xc849f9[_0xb22c('0x31')]=_[_0xb22c('0x32')](_0xc849f9[_0xb22c('0x33')],_0xc849f9[_0xb22c('0x30')]);_0x4a0113[_0xb22c('0x34')]=_[_0xb22c('0x32')](_0xc849f9[_0xb22c('0x33')],qs[_0xb22c('0x35')](_0x2feea4[_0xb22c('0x30')][_0xb22c('0x35')]));_0x4a0113[_0xb22c('0x34')]=_0x4a0113[_0xb22c('0x34')][_0xb22c('0x43')]?_0x4a0113['attributes']:_0xc849f9[_0xb22c('0x33')];if(_0x2feea4[_0xb22c('0x30')]['includeAll']){_0x4a0113[_0xb22c('0x3e')]=[{'all':!![]}];}_0x4a0113=_[_0xb22c('0x44')]({},_0x4a0113,_0x2feea4[_0xb22c('0x45')]);return db[_0xb22c('0x3c')]['find'](_0x4a0113)[_0xb22c('0x26')](handleEntityNotFound(_0xd20161,null))[_0xb22c('0x26')](respondWithResult(_0xd20161,null))[_0xb22c('0x40')](handleError(_0xd20161,null));};exports[_0xb22c('0x46')]=function(_0x57f9c4,_0xa43179){return db[_0xb22c('0x3c')]['create'](_0x57f9c4[_0xb22c('0x47')],{})['then'](function(_0xb0a030){var _0x52e87c=_0x57f9c4[_0xb22c('0x48')][_0xb22c('0x28')]({'plain':!![]});if(!_0x52e87c)throw new Error(_0xb22c('0x49'));if(_0x52e87c['role']===_0xb22c('0x48')){var _0x2fea81=_0xb0a030[_0xb22c('0x28')]({'plain':!![]});var _0x2692db=_0xb22c('0x29');return db[_0xb22c('0x4a')][_0xb22c('0x4b')]({'where':{'name':_0x2692db,'userProfileId':_0x52e87c[_0xb22c('0x4c')]},'raw':!![]})[_0xb22c('0x26')](function(_0x4dc5ab){if(_0x4dc5ab&&_0x4dc5ab[_0xb22c('0x4d')]===0x0){return db[_0xb22c('0x2a')][_0xb22c('0x46')]({'name':_0x2fea81['name'],'resourceId':_0x2fea81['id'],'type':_0x4dc5ab[_0xb22c('0x2c')],'sectionId':_0x4dc5ab['id']},{})[_0xb22c('0x26')](function(){return _0xb0a030;});}else{return _0xb0a030;}})[_0xb22c('0x40')](function(_0x508f37){logger[_0xb22c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x508f37);throw _0x508f37;});}return _0xb0a030;})[_0xb22c('0x26')](respondWithResult(_0xa43179,0xc9))[_0xb22c('0x40')](handleError(_0xa43179,null));};exports[_0xb22c('0x25')]=function(_0x162988,_0x2c578c){if(_0x162988[_0xb22c('0x47')]['id']){delete _0x162988[_0xb22c('0x47')]['id'];}return db[_0xb22c('0x3c')][_0xb22c('0x4b')]({'where':{'id':_0x162988[_0xb22c('0x4e')]['id']}})[_0xb22c('0x26')](handleEntityNotFound(_0x2c578c,null))[_0xb22c('0x26')](saveUpdates(_0x162988[_0xb22c('0x47')],null))[_0xb22c('0x26')](respondWithResult(_0x2c578c,null))[_0xb22c('0x40')](handleError(_0x2c578c,null));};exports['destroy']=function(_0x272dea,_0xac0568){return db[_0xb22c('0x3c')][_0xb22c('0x4b')]({'where':{'id':_0x272dea[_0xb22c('0x4e')]['id']}})[_0xb22c('0x26')](handleEntityNotFound(_0xac0568,null))['then'](removeEntity(_0xac0568,null))[_0xb22c('0x40')](handleError(_0xac0568,null));};exports[_0xb22c('0x4f')]=function(_0x4f2ffc,_0x232316){return db[_0xb22c('0x3c')][_0xb22c('0x4f')]()[_0xb22c('0x26')](respondWithResult(_0x232316,null))['catch'](handleError(_0x232316,null));};exports['addContacts']=function(_0x4214a4,_0x71071,_0x201c48){return db['CmContact'][_0xb22c('0x4b')]({'where':{'id':_0x4214a4['params']['id']}})[_0xb22c('0x26')](handleEntityNotFound(_0x71071,null))['then'](function(_0x24fd17){if(_0x24fd17){return _0x24fd17[_0xb22c('0x50')](_0x4214a4[_0xb22c('0x47')][_0xb22c('0x51')],_[_0xb22c('0x52')](_0x4214a4[_0xb22c('0x47')],[_0xb22c('0x51'),'id'])||{});}})[_0xb22c('0x26')](respondWithResult(_0x71071,null))[_0xb22c('0x40')](handleError(_0x71071,null));};exports[_0xb22c('0x53')]=function(_0x5e5181,_0x3277c1,_0x4f6238){var _0x3aa7a0={};var _0x4f0224={};var _0x388db8;var _0x5ea1d4;return db[_0xb22c('0x3c')][_0xb22c('0x54')]({'where':{'id':_0x5e5181['params']['id']}})[_0xb22c('0x26')](handleEntityNotFound(_0x3277c1,null))[_0xb22c('0x26')](function(_0x36e281){if(_0x36e281){_0x388db8=_0x36e281;_0x4f0224[_0xb22c('0x33')]=_['keys'](db[_0xb22c('0x55')]['rawAttributes']);_0x4f0224[_0xb22c('0x30')]=_['keys'](_0x5e5181['query']);_0x4f0224[_0xb22c('0x31')]=_[_0xb22c('0x32')](_0x4f0224[_0xb22c('0x33')],_0x4f0224[_0xb22c('0x30')]);_0x3aa7a0[_0xb22c('0x34')]=_['intersection'](_0x4f0224[_0xb22c('0x33')],qs[_0xb22c('0x35')](_0x5e5181['query'][_0xb22c('0x35')]));_0x3aa7a0[_0xb22c('0x34')]=_0x3aa7a0[_0xb22c('0x34')][_0xb22c('0x43')]?_0x3aa7a0[_0xb22c('0x34')]:_0x4f0224[_0xb22c('0x33')];_0x3aa7a0[_0xb22c('0x56')]=qs[_0xb22c('0x38')](_0x5e5181[_0xb22c('0x30')][_0xb22c('0x38')]);_0x3aa7a0[_0xb22c('0x39')]=qs[_0xb22c('0x31')](_[_0xb22c('0x57')](_0x5e5181['query'],_0x4f0224['filters']));if(_0x5e5181[_0xb22c('0x30')][_0xb22c('0x3b')]){_0x3aa7a0[_0xb22c('0x39')]=_[_0xb22c('0x44')](_0x3aa7a0[_0xb22c('0x39')],{'$or':_[_0xb22c('0x3a')](_0x3aa7a0[_0xb22c('0x34')],function(_0x3933b7){var _0x399290={};_0x399290[_0x3933b7]={'$like':'%'+_0x5e5181[_0xb22c('0x30')][_0xb22c('0x3b')]+'%'};return _0x399290;})});}_0x3aa7a0=_['merge']({},_0x3aa7a0,_0x5e5181[_0xb22c('0x45')]);return _0x388db8['getContacts'](_0x3aa7a0);}})[_0xb22c('0x26')](function(_0x582610){if(_0x582610){_0x5ea1d4=_0x582610[_0xb22c('0x43')];if(!_0x5e5181[_0xb22c('0x30')]['hasOwnProperty']('nolimit')){_0x3aa7a0[_0xb22c('0x22')]=qs['limit'](_0x5e5181[_0xb22c('0x30')][_0xb22c('0x22')]);_0x3aa7a0['offset']=qs[_0xb22c('0x21')](_0x5e5181[_0xb22c('0x30')][_0xb22c('0x21')]);}return _0x388db8[_0xb22c('0x53')](_0x3aa7a0);}})['then'](function(_0x2bb367){if(_0x2bb367){return _0x2bb367?{'count':_0x5ea1d4,'rows':_0x2bb367}:null;}})[_0xb22c('0x26')](respondWithResult(_0x3277c1,null))[_0xb22c('0x40')](handleError(_0x3277c1,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 0980e6c..508d3e3 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 _0xdad2=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','util'];(function(_0x12fe87,_0x4690f7){var _0xb5492e=function(_0x4adb9c){while(--_0x4adb9c){_0x12fe87['push'](_0x12fe87['shift']());}};_0xb5492e(++_0x4690f7);}(_0xdad2,0x14c));var _0x2dad=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdad2[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x2dad('0x0'));var logger=require(_0x2dad('0x1'))('api');var moment=require(_0x2dad('0x2'));var BPromise=require(_0x2dad('0x3'));var rp=require(_0x2dad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dad('0x5'));var config=require(_0x2dad('0x6'));var attributes=require('./cmCompany.attributes');module[_0x2dad('0x7')]=function(_0x36a054,_0x27ca04){return _0x36a054[_0x2dad('0x8')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1e1=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x4f9f9b,_0x842ec2){var _0x40cee4=function(_0x270a54){while(--_0x270a54){_0x4f9f9b['push'](_0x4f9f9b['shift']());}};_0x40cee4(++_0x842ec2);}(_0xf1e1,0x102));var _0x1f1e=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0xf1e1[_0x31172e];return _0x414ada;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var logger=require(_0x1f1e('0x1'))('api');var moment=require(_0x1f1e('0x2'));var BPromise=require('bluebird');var rp=require(_0x1f1e('0x3'));var fs=require('fs');var path=require(_0x1f1e('0x4'));var rimraf=require(_0x1f1e('0x5'));var config=require(_0x1f1e('0x6'));var attributes=require(_0x1f1e('0x7'));module[_0x1f1e('0x8')]=function(_0x1bdcee,_0x3242af){return _0x1bdcee[_0x1f1e('0x9')](_0x1f1e('0xa'),attributes,{'tableName':_0x1f1e('0xb'),'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 066042d..99a27b6 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 _0xf99b=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash'];(function(_0x37027e,_0x2fc927){var _0x344823=function(_0x12889d){while(--_0x12889d){_0x37027e['push'](_0x37027e['shift']());}};_0x344823(++_0x2fc927);}(_0xf99b,0xe6));var _0xbf99=function(_0x56c613,_0x51f0e3){_0x56c613=_0x56c613-0x0;var _0x47688b=_0xf99b[_0x56c613];return _0x47688b;};'use strict';var _=require(_0xbf99('0x0'));var util=require(_0xbf99('0x1'));var moment=require(_0xbf99('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf99('0x3'));var fs=require('fs');var Redis=require(_0xbf99('0x4'));var db=require(_0xbf99('0x5'))['db'];var utils=require(_0xbf99('0x6'));var logger=require(_0xbf99('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbf99('0x8')][_0xbf99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8620,_0x3f6123,_0x49f046){return new BPromise(function(_0x2d64d6,_0x47a519){return client[_0xbf99('0xa')](_0x1d8620,_0x49f046)[_0xbf99('0xb')](function(_0x3f55c8){logger['info'](_0xbf99('0xc'),_0x3f6123,_0xbf99('0xd'));logger['debug'](_0xbf99('0xe'),_0x3f6123,'request\x20sent',JSON[_0xbf99('0xf')](_0x3f55c8));if(_0x3f55c8[_0xbf99('0x10')]){if(_0x3f55c8[_0xbf99('0x10')][_0xbf99('0x11')]===0x1f4){logger['error'](_0xbf99('0xc'),_0x3f6123,_0x3f55c8[_0xbf99('0x10')][_0xbf99('0x12')]);return _0x47a519(_0x3f55c8[_0xbf99('0x10')][_0xbf99('0x12')]);}logger['error'](_0xbf99('0xc'),_0x3f6123,_0x3f55c8['error'][_0xbf99('0x12')]);return _0x2d64d6(_0x3f55c8[_0xbf99('0x10')]['message']);}else{logger[_0xbf99('0x13')](_0xbf99('0xc'),_0x3f6123,_0xbf99('0xd'));_0x2d64d6(_0x3f55c8['result'][_0xbf99('0x12')]);}})[_0xbf99('0x14')](function(_0x28cfdf){logger[_0xbf99('0x10')](_0xbf99('0xc'),_0x3f6123,_0x28cfdf);_0x47a519(_0x28cfdf);});});} \ No newline at end of file +var _0xe245=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x27003a,_0xfb9de0){var _0x6c1065=function(_0x3d750e){while(--_0x3d750e){_0x27003a['push'](_0x27003a['shift']());}};_0x6c1065(++_0xfb9de0);}(_0xe245,0xb1));var _0x5e24=function(_0x55b92a,_0x57244f){_0x55b92a=_0x55b92a-0x0;var _0x233a0e=_0xe245[_0x55b92a];return _0x233a0e;};'use strict';var _=require(_0x5e24('0x0'));var util=require(_0x5e24('0x1'));var moment=require(_0x5e24('0x2'));var BPromise=require(_0x5e24('0x3'));var rs=require(_0x5e24('0x4'));var fs=require('fs');var Redis=require(_0x5e24('0x5'));var db=require(_0x5e24('0x6'))['db'];var utils=require(_0x5e24('0x7'));var logger=require(_0x5e24('0x8'))(_0x5e24('0x9'));var config=require(_0x5e24('0xa'));var jayson=require(_0x5e24('0xb'));var client=jayson['client'][_0x5e24('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a1223,_0x1ed32e,_0x37566d){return new BPromise(function(_0x1c2ec5,_0x4e4201){return client[_0x5e24('0xd')](_0x5a1223,_0x37566d)[_0x5e24('0xe')](function(_0x404ef6){logger[_0x5e24('0xf')](_0x5e24('0x10'),_0x1ed32e,_0x5e24('0x11'));logger[_0x5e24('0x12')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1ed32e,_0x5e24('0x11'),JSON[_0x5e24('0x13')](_0x404ef6));if(_0x404ef6[_0x5e24('0x14')]){if(_0x404ef6[_0x5e24('0x14')][_0x5e24('0x15')]===0x1f4){logger['error'](_0x5e24('0x10'),_0x1ed32e,_0x404ef6[_0x5e24('0x14')][_0x5e24('0x16')]);return _0x4e4201(_0x404ef6[_0x5e24('0x14')][_0x5e24('0x16')]);}logger[_0x5e24('0x14')](_0x5e24('0x10'),_0x1ed32e,_0x404ef6[_0x5e24('0x14')][_0x5e24('0x16')]);return _0x1c2ec5(_0x404ef6[_0x5e24('0x14')][_0x5e24('0x16')]);}else{logger[_0x5e24('0xf')]('CmCompany,\x20%s,\x20%s',_0x1ed32e,'request\x20sent');_0x1c2ec5(_0x404ef6[_0x5e24('0x17')]['message']);}})[_0x5e24('0x18')](function(_0x9a86c5){logger[_0x5e24('0x14')]('CmCompany,\x20%s,\x20%s',_0x1ed32e,_0x9a86c5);_0x4e4201(_0x9a86c5);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 28b1554..d0e0047 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 _0xd046=['create','post','/:id/contacts','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../config/environment','get','/describe','/:id','isAuthenticated'];(function(_0x4f7588,_0x399e6b){var _0x535c70=function(_0x5c2bbb){while(--_0x5c2bbb){_0x4f7588['push'](_0x4f7588['shift']());}};_0x535c70(++_0x399e6b);}(_0xd046,0x129));var _0x6d04=function(_0x556fc7,_0x4d60d0){_0x556fc7=_0x556fc7-0x0;var _0x5c18c1=_0xd046[_0x556fc7];return _0x5c18c1;};'use strict';var multer=require('multer');var util=require(_0x6d04('0x0'));var path=require(_0x6d04('0x1'));var timeout=require(_0x6d04('0x2'));var express=require('express');var router=express[_0x6d04('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6d04('0x4'));var controller=require('./cmCompany.controller');router[_0x6d04('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6d04('0x5')](_0x6d04('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x6d04('0x5')](_0x6d04('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x6d04('0x5')]('/:id/contacts',auth[_0x6d04('0x8')](),controller['getContacts']);router['post']('/',auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router[_0x6d04('0xa')](_0x6d04('0xb'),auth[_0x6d04('0x8')](),controller['addContacts']);router[_0x6d04('0xc')](_0x6d04('0x7'),auth[_0x6d04('0x8')](),controller[_0x6d04('0xd')]);router[_0x6d04('0xe')](_0x6d04('0x7'),auth[_0x6d04('0x8')](),controller[_0x6d04('0xf')]);module[_0x6d04('0x10')]=router; \ No newline at end of file +var _0x6455=['post','addContacts','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','/:id/contacts','getContacts','create'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0x6455,0x97));var _0x5645=function(_0x223b29,_0x347ae9){_0x223b29=_0x223b29-0x0;var _0x1d8f19=_0x6455[_0x223b29];return _0x1d8f19;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var auth=require(_0x5645('0x5'));var interaction=require(_0x5645('0x6'));var config=require('../../config/environment');var controller=require(_0x5645('0x7'));router[_0x5645('0x8')]('/',auth[_0x5645('0x9')](),controller[_0x5645('0xa')]);router[_0x5645('0x8')](_0x5645('0xb'),auth[_0x5645('0x9')](),controller[_0x5645('0xc')]);router['get']('/:id',auth[_0x5645('0x9')](),controller[_0x5645('0xd')]);router[_0x5645('0x8')](_0x5645('0xe'),auth[_0x5645('0x9')](),controller[_0x5645('0xf')]);router['post']('/',auth[_0x5645('0x9')](),controller[_0x5645('0x10')]);router[_0x5645('0x11')](_0x5645('0xe'),auth['isAuthenticated'](),controller[_0x5645('0x12')]);router['put'](_0x5645('0x13'),auth[_0x5645('0x9')](),controller[_0x5645('0x14')]);router[_0x5645('0x15')](_0x5645('0x13'),auth[_0x5645('0x9')](),controller[_0x5645('0x16')]);module[_0x5645('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index c491fb2..131d81a 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 _0x3619=['exports','STRING','TEXT','INTEGER','DATE','lodash'];(function(_0x5a2e95,_0x249e3c){var _0x297cb3=function(_0x16497b){while(--_0x16497b){_0x5a2e95['push'](_0x5a2e95['shift']());}};_0x297cb3(++_0x249e3c);}(_0x3619,0x1c1));var _0x9361=function(_0x47537f,_0x224ad8){_0x47537f=_0x47537f-0x0;var _0xd58cd4=_0x3619[_0x47537f];return _0xd58cd4;};'use strict';var _=require(_0x9361('0x0'));var Sequelize=require('sequelize');module[_0x9361('0x1')]={'firstName':{'type':Sequelize[_0x9361('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x9361('0x2')]},'street':{'type':Sequelize[_0x9361('0x2')]},'postalCode':{'type':Sequelize[_0x9361('0x2')]},'city':{'type':Sequelize[_0x9361('0x2')]},'country':{'type':Sequelize[_0x9361('0x2')]},'dateOfBirth':{'type':Sequelize[_0x9361('0x2')]},'description':{'type':Sequelize[_0x9361('0x3')]},'phone':{'type':Sequelize[_0x9361('0x2')]},'mobile':{'type':Sequelize[_0x9361('0x2')]},'fax':{'type':Sequelize[_0x9361('0x2')]},'email':{'type':Sequelize[_0x9361('0x2')]},'url':{'type':Sequelize[_0x9361('0x2')]},'facebook':{'type':Sequelize[_0x9361('0x2')]},'fb_data':{'type':Sequelize[_0x9361('0x2')]},'twitter':{'type':Sequelize[_0x9361('0x2')]},'skype':{'type':Sequelize[_0x9361('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x9361('0x2')]},'wechat':{'type':Sequelize[_0x9361('0x2')]},'telegram':{'type':Sequelize[_0x9361('0x2')]},'UserId':{'type':Sequelize[_0x9361('0x4')]},'priority':{'type':Sequelize[_0x9361('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9361('0x5')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x41c6=['STRING','TEXT','INTEGER','DATE','NOW','exports'];(function(_0x50a6be,_0x466f1d){var _0x2ebd2f=function(_0x3f3428){while(--_0x3f3428){_0x50a6be['push'](_0x50a6be['shift']());}};_0x2ebd2f(++_0x466f1d);}(_0x41c6,0x1eb));var _0x641c=function(_0x704e0,_0x2b31b3){_0x704e0=_0x704e0-0x0;var _0xbbe3ea=_0x41c6[_0x704e0];return _0xbbe3ea;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x641c('0x0')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x641c('0x1')]},'street':{'type':Sequelize[_0x641c('0x1')]},'postalCode':{'type':Sequelize[_0x641c('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x641c('0x1')]},'dateOfBirth':{'type':Sequelize[_0x641c('0x1')]},'description':{'type':Sequelize[_0x641c('0x2')]},'phone':{'type':Sequelize[_0x641c('0x1')]},'mobile':{'type':Sequelize[_0x641c('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x641c('0x1')]},'facebook':{'type':Sequelize[_0x641c('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x641c('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x641c('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x641c('0x1')]},'telegram':{'type':Sequelize[_0x641c('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x641c('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x641c('0x4')],'defaultValue':Sequelize[_0x641c('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 092d094..adbae87 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 _0x984b=['push','CmCustomField','findOne','trimStart','all','fieldType','type','model','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','cm_contacts','left_join','cm_user_has_contacts','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','text','start','filter','isNil','isEmpty','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','Sequelize','c.id','DESC','having','t.id\x20IN\x20?','resolve','user','agent','some','getLists','c.ListId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','fields','c.mobile','c.fax','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','CmContact','describe','tags','cf_','columnName','displayName','findAll','custom','values','body','get','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','destroy','bulkCreate','each','duplicates','ListId','findOrCreate','spread','show','params','Tag','$and','format','cf_%d','omit','pickBy','startsWith','table','toParam','phone','rawAttributes','getTags','setTags','ContactId','options','includeAll','include','getHopperHistories','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','0777','File\x20uploaded\x20correctly!','upload','createReadStream','file','path','parse','import','User','binding','child_process','fork','../../components/import/cm/csv2','message','start\x20child\x20process\x20correctly!','pid','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','starttime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','fullname','alias','createdAt','findAndCountAll','closed','closedAt','disposition','thirdDisposition','UserId','Account','key','Owner','browserName','customerIp','deviceModel','osName','ratingMessage','substatus','externalUrl','threadId','startCase','sortBy','slice','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','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','redis','localhost','./cmContact.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','keys','length'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x984b,0xee));var _0xb984=function(_0x28382e,_0x92fc02){_0x28382e=_0x28382e-0x0;var _0x49a909=_0x984b[_0x28382e];return _0x49a909;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb984('0x0'));var jsonpatch=require(_0xb984('0x1'));var rp=require(_0xb984('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb984('0x3'));var util=require(_0xb984('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb984('0x5'));var ejs=require(_0xb984('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb984('0x7'));var crypto=require(_0xb984('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xb984('0x9'));var toCsv=require('to-csv');var querystring=require(_0xb984('0xa'));var Papa=require(_0xb984('0xb'));var Redis=require(_0xb984('0xc'));var authService=require(_0xb984('0xd'));var qs=require(_0xb984('0xe'));var as=require(_0xb984('0xf'));var hardwareService=require(_0xb984('0x10'));var logger=require(_0xb984('0x11'))(_0xb984('0x12'));var utils=require(_0xb984('0x13'));var config=require(_0xb984('0x14'));var licenseUtil=require(_0xb984('0x15'));var db=require('../../mysqldb')['db'];config[_0xb984('0x16')]=_['defaults'](config[_0xb984('0x16')],{'host':_0xb984('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb984('0x16')]));require(_0xb984('0x18'))['register'](socket);function respondWithStatusCode(_0x203dba,_0x7a1b60){_0x7a1b60=_0x7a1b60||0xcc;return function(_0x549791){if(_0x549791){return _0x203dba[_0xb984('0x19')](_0x7a1b60);}return _0x203dba[_0xb984('0x1a')](_0x7a1b60)['end']();};}function respondWithResult(_0x6fae41,_0x5cd1aa){_0x5cd1aa=_0x5cd1aa||0xc8;return function(_0x3b8241){if(_0x3b8241){return _0x6fae41[_0xb984('0x1a')](_0x5cd1aa)[_0xb984('0x1b')](_0x3b8241);}};}function respondWithFilteredResult(_0x3f7cff,_0x59dcb7){return function(_0x396c36){if(_0x396c36){var _0x35bd75=_0x396c36[_0xb984('0x1c')],_0x3a5c96=_0x59dcb7['offset'],_0x9afbee=_0x59dcb7[_0xb984('0x1d')]+_0x59dcb7[_0xb984('0x1e')],_0x229a40;if(_0x9afbee>=_0x35bd75){_0x9afbee=_0x35bd75;_0x229a40=0xc8;}else{_0x229a40=0xce;}_0x3f7cff[_0xb984('0x1a')](_0x229a40);return _0x3f7cff[_0xb984('0x1f')](_0xb984('0x20'),_0x3a5c96+'-'+_0x9afbee+'/'+_0x35bd75)[_0xb984('0x1b')](_0x396c36);}return null;};}function patchUpdates(_0x54dd81){return function(_0x39d16f){try{jsonpatch[_0xb984('0x21')](_0x39d16f,_0x54dd81,!![]);}catch(_0x551ad4){return BPromise[_0xb984('0x22')](_0x551ad4);}return _0x39d16f[_0xb984('0x23')]();};}function saveUpdates(_0x14734a,_0x932579){return function(_0x3ad8d7){if(_0x3ad8d7){return _0x3ad8d7[_0xb984('0x24')](_0x14734a)[_0xb984('0x25')](function(_0x52c581){return _0x52c581;});}return null;};}function removeEntity(_0x391a1e,_0x25de23){return function(_0x1b6be3){if(_0x1b6be3){return _0x1b6be3['destroy']()[_0xb984('0x25')](function(){_0x391a1e[_0xb984('0x1a')](0xcc)[_0xb984('0x26')]();});}};}function handleEntityNotFound(_0x2d0450,_0x1f7b62){return function(_0x24b278){if(!_0x24b278){_0x2d0450[_0xb984('0x19')](0x194);}return _0x24b278;};}function handleError(_0x4b3da0,_0x5d93d9){_0x5d93d9=_0x5d93d9||0x1f4;return function(_0x249d47){logger[_0xb984('0x27')](_0x249d47[_0xb984('0x28')]);if(_0x249d47[_0xb984('0x29')]){delete _0x249d47['name'];}_0x4b3da0[_0xb984('0x1a')](_0x5d93d9)[_0xb984('0x2a')](_0x249d47);};}exports[_0xb984('0x2b')]=function(_0x482a9f,_0x363e33){var _0x311e22={},_0x2012ca={},_0x3d2757={'count':0x0,'rows':[]};return db['CmContact']['describe']()['then'](function(_0x10b9ac){var _0x23ecf6=[];for(var _0x58a98c=0x0;_0x58a98c0x1){_0x3c8401['or'](_0xb984('0x69'),qs[_0xb984('0x6a')](_0x3bdadc),null);}else{if(qs['isNumeric'](_0x3bdadc)){_0x3c8401['or']('c.id\x20LIKE\x20?',_0x3bdadc+'%');_0x3c8401['or']('c.phone\x20LIKE\x20?',_0x3bdadc+'%');_0x3c8401['or'](_0xb984('0x6b'),_0x3bdadc+'%');_0x3c8401['or'](_0xb984('0x6c'),_0x3bdadc+'%');}else if(qs[_0xb984('0x6d')](_0x3bdadc)){_0x3c8401['or'](_0xb984('0x6e'),_0x3bdadc+'%');}else{_0x3c8401['or'](_0xb984('0x6f'),'%'+_0x3bdadc+'%');_0x3c8401['or']('c.lastName\x20LIKE\x20?','%'+_0x3bdadc+'%');_0x3c8401['or'](_0xb984('0x6e'),'%'+_0x3bdadc+'%');}}}}_0x1037fd[_0xb984('0x3d')](_0x3c8401);_0x1037fd[_0xb984('0x70')]('c.id');var _0x935abe={'type':db[_0xb984('0x71')]['QueryTypes']['SELECT'],'raw':!![]};var _0xaa9894=_0x1037fd['clone']()['field'](_0xb984('0x72'));if(_0x311e22['order']){_0x311e22[_0xb984('0x3b')][_0xb984('0x53')](function(_0x3a2d1a){_0x1037fd[_0xb984('0x3b')]('c.'+_0x3a2d1a[0x0],_0x3a2d1a[0x1]===_0xb984('0x73')?![]:!![]);});}if(!_[_0xb984('0x61')](_0x587c19)){_0x1037fd[_0xb984('0x74')](_0xbca7cd);_0xaa9894[_0xb984('0x3d')](_0xb984('0x75'),_0x587c19);}BPromise[_0xb984('0x76')]()[_0xb984('0x25')](function(){if(!_0x4f6f2b)return;if(_0x482a9f[_0xb984('0x77')]['role']!==_0xb984('0x78'))return;if(!_[_0xb984('0x79')](_0x4f6f2b[_0xb984('0x4e')],['field','User'])){return _0x482a9f[_0xb984('0x77')][_0xb984('0x7a')]({'attributes':['id'],'raw':!![]})[_0xb984('0x25')](function(_0x531c9f){if(_[_0xb984('0x61')](_0x531c9f)){_0xaa9894[_0xb984('0x3d')](_0xb984('0x7b'));_0x1037fd[_0xb984('0x3d')](_0xb984('0x7b'));}else{_0xaa9894[_0xb984('0x3d')](_0xb984('0x62'),_[_0xb984('0x52')](_0x531c9f,'id'));_0x1037fd[_0xb984('0x3d')](_0xb984('0x62'),_[_0xb984('0x52')](_0x531c9f,'id'));}});}})[_0xb984('0x25')](function(){if(_0x482a9f[_0xb984('0x77')][_0xb984('0x7c')]==='agent'&&!_0x4f6f2b&&!_0x482a9f[_0xb984('0x36')]['ListId'])return[];return db[_0xb984('0x7d')]['query'](_0xaa9894[_0xb984('0x7e')](),_0x935abe);})[_0xb984('0x25')](function(_0x278a0d){_0x3d2757[_0xb984('0x1c')]=_0x278a0d[_0xb984('0x2d')];if(_0x3d2757[_0xb984('0x1c')]===0x0)return[];return db[_0xb984('0x7d')][_0xb984('0x36')](_0xd10521[_0xb984('0x7e')](),_0x935abe)[_0xb984('0x25')](function(_0x2976f1){_0x134ba5=_[_0xb984('0x7f')](_0x2976f1,'id');_0x935abe=_[_0xb984('0x80')](_0x935abe,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x482a9f['query'][_0xb984('0x81')]){_0x311e22[_0xb984('0x38')][_0xb984('0x53')](function(_0x48f52d){_0x1037fd[_0xb984('0x41')]('c.'+_0x48f52d);});}else{_0x1037fd[_0xb984('0x41')]('c.id');_0x1037fd['field']('c.firstName');_0x1037fd[_0xb984('0x41')]('c.lastName');_0x1037fd['field']('c.phone');_0x1037fd[_0xb984('0x41')](_0xb984('0x82'));_0x1037fd[_0xb984('0x41')](_0xb984('0x83'));_0x1037fd['field']('c.email');_0x1037fd[_0xb984('0x41')](_0xb984('0x84'));_0x1037fd[_0xb984('0x41')](_0xb984('0x85'));_0x1037fd[_0xb984('0x41')]('c.deletedAt');_0x1037fd[_0xb984('0x41')](_0xb984('0x86'));_0x1037fd[_0xb984('0x41')](_0xb984('0x87'),_0xb984('0x88'));}if(_0x311e22[_0xb984('0x1e')])_0x1037fd['limit'](_0x311e22[_0xb984('0x1e')]);if(_0x311e22['offset'])_0x1037fd[_0xb984('0x1d')](_0x311e22[_0xb984('0x1d')]);return db[_0xb984('0x7d')][_0xb984('0x36')](_0x1037fd[_0xb984('0x7e')](),_0x935abe);});})['then'](function(_0x218f6f){_0x218f6f[_0xb984('0x53')](function(_0x1f0e09){if(_0x1f0e09['TagIds']){_0x1f0e09[_0xb984('0x89')]=[];_0x1f0e09[_0xb984('0x88')][_0xb984('0x51')](',')[_0xb984('0x53')](function(_0x20c803){_0x1f0e09['Tags']['push'](_0x134ba5[_0x20c803]);});}delete _0x1f0e09[_0xb984('0x88')];});_0x3d2757[_0xb984('0x8a')]=_0x218f6f;return _0x3d2757;})[_0xb984('0x25')](respondWithFilteredResult(_0x363e33,_0x311e22));})[_0xb984('0x8b')](handleError(_0x363e33,null));};exports['destroy']=function(_0x24f309,_0x34ce92){return db[_0xb984('0x8c')][_0xb984('0x4f')]({'where':{'id':_0x24f309['params']['id']}})[_0xb984('0x25')](handleEntityNotFound(_0x34ce92,null))[_0xb984('0x25')](removeEntity(_0x34ce92,null))[_0xb984('0x8b')](handleError(_0x34ce92,null));};exports[_0xb984('0x8d')]=function(_0x484a35,_0x14cd2c){return db[_0xb984('0x8c')][_0xb984('0x8d')]()[_0xb984('0x25')](function(_0x46e5c7){delete _0x46e5c7[_0xb984('0x8e')];for(var _0x540ce=0x0;_0x540ce=_0x4796ec){_0x431ed4=_0x4796ec;_0x4b06f5=0xc8;}else{_0x4b06f5=0xce;}_0x174065[_0x50bb('0x1e')](_0x4b06f5);return _0x174065['set'](_0x50bb('0x23'),_0x301f61+'-'+_0x431ed4+'/'+_0x4796ec)[_0x50bb('0x20')](_0x24ba19);}return null;};}function patchUpdates(_0x4020a0){return function(_0x597e95){try{jsonpatch[_0x50bb('0x24')](_0x597e95,_0x4020a0,!![]);}catch(_0x879fea){return BPromise[_0x50bb('0x25')](_0x879fea);}return _0x597e95['save']();};}function saveUpdates(_0x1dbba2,_0x4cc7f9){return function(_0x1c81a1){if(_0x1c81a1){return _0x1c81a1[_0x50bb('0x26')](_0x1dbba2)[_0x50bb('0x27')](function(_0x2ee87a){return _0x2ee87a;});}return null;};}function removeEntity(_0x846311,_0x342078){return function(_0x4f7f73){if(_0x4f7f73){return _0x4f7f73[_0x50bb('0x28')]()[_0x50bb('0x27')](function(){_0x846311[_0x50bb('0x1e')](0xcc)[_0x50bb('0x1f')]();});}};}function handleEntityNotFound(_0x5234d7,_0x75fea6){return function(_0x4d38f7){if(!_0x4d38f7){_0x5234d7['sendStatus'](0x194);}return _0x4d38f7;};}function handleError(_0x2befd9,_0x491632){_0x491632=_0x491632||0x1f4;return function(_0x5cfe4b){logger[_0x50bb('0x29')](_0x5cfe4b[_0x50bb('0x2a')]);if(_0x5cfe4b[_0x50bb('0x2b')]){delete _0x5cfe4b[_0x50bb('0x2b')];}_0x2befd9[_0x50bb('0x1e')](_0x491632)[_0x50bb('0x2c')](_0x5cfe4b);};}exports[_0x50bb('0x2d')]=function(_0x41d479,_0x4f7514){var _0x44ce86={},_0x461cf3={},_0x15ee2e={'count':0x0,'rows':[]};return db[_0x50bb('0x2e')]['describe']()[_0x50bb('0x27')](function(_0x1a62fb){var _0xc38da5=[];for(var _0xb3c3ba=0x0;_0xb3c3ba0x1){_0x2a17e1['or'](_0x50bb('0x6b'),qs[_0x50bb('0x6c')](_0x1da5cd),null);}else{if(qs[_0x50bb('0x6d')](_0x1da5cd)){_0x2a17e1['or'](_0x50bb('0x6e'),_0x1da5cd+'%');_0x2a17e1['or'](_0x50bb('0x6f'),_0x1da5cd+'%');_0x2a17e1['or'](_0x50bb('0x70'),_0x1da5cd+'%');_0x2a17e1['or'](_0x50bb('0x71'),_0x1da5cd+'%');}else if(qs[_0x50bb('0x72')](_0x1da5cd)){_0x2a17e1['or'](_0x50bb('0x73'),_0x1da5cd+'%');}else{_0x2a17e1['or'](_0x50bb('0x74'),'%'+_0x1da5cd+'%');_0x2a17e1['or'](_0x50bb('0x75'),'%'+_0x1da5cd+'%');_0x2a17e1['or']('c.email\x20LIKE\x20?','%'+_0x1da5cd+'%');}}}}_0x8a0b28[_0x50bb('0x41')](_0x2a17e1);_0x8a0b28['group'](_0x50bb('0x76'));var _0x2b9deb={'type':db['Sequelize'][_0x50bb('0x77')][_0x50bb('0x78')],'raw':!![]};var _0xafa1b7=_0x8a0b28[_0x50bb('0x79')]()[_0x50bb('0x44')](_0x50bb('0x76'));if(_0x44ce86[_0x50bb('0x3f')]){_0x44ce86[_0x50bb('0x3f')]['forEach'](function(_0x342644){_0x8a0b28[_0x50bb('0x3f')]('c.'+_0x342644[0x0],_0x342644[0x1]===_0x50bb('0x7a')?![]:!![]);});}if(!_['isEmpty'](_0x3ab814)){_0x8a0b28[_0x50bb('0x7b')](_0x57c335);_0xafa1b7[_0x50bb('0x41')](_0x50bb('0x7c'),_0x3ab814);}BPromise[_0x50bb('0x7d')]()[_0x50bb('0x27')](function(){if(!_0xc88ad2)return;if(_0x41d479[_0x50bb('0x7e')]['role']!==_0x50bb('0x7f'))return;if(!_[_0x50bb('0x80')](_0xc88ad2[_0x50bb('0x54')],[_0x50bb('0x44'),_0x50bb('0x5b')])){return _0x41d479[_0x50bb('0x7e')]['getLists']({'attributes':['id'],'raw':!![]})[_0x50bb('0x27')](function(_0xa85833){if(_[_0x50bb('0x81')](_0xa85833)){_0xafa1b7[_0x50bb('0x41')](_0x50bb('0x82'));_0x8a0b28[_0x50bb('0x41')](_0x50bb('0x82'));}else{_0xafa1b7[_0x50bb('0x41')](_0x50bb('0x64'),_['map'](_0xa85833,'id'));_0x8a0b28[_0x50bb('0x41')](_0x50bb('0x64'),_[_0x50bb('0x58')](_0xa85833,'id'));}});}})[_0x50bb('0x27')](function(){if(_0x41d479[_0x50bb('0x7e')][_0x50bb('0x83')]===_0x50bb('0x7f')&&!_0xc88ad2&&!_0x41d479[_0x50bb('0x39')][_0x50bb('0x84')])return[];return db['sequelize']['query'](_0xafa1b7['toString'](),_0x2b9deb);})[_0x50bb('0x27')](function(_0x5ba597){_0x15ee2e['count']=_0x5ba597[_0x50bb('0x30')];if(_0x15ee2e[_0x50bb('0x85')]===0x0)return[];return db[_0x50bb('0x86')][_0x50bb('0x39')](_0x594f16['toString'](),_0x2b9deb)[_0x50bb('0x27')](function(_0x16a500){_0x718128=_['keyBy'](_0x16a500,'id');_0x2b9deb=_[_0x50bb('0x87')](_0x2b9deb,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x41d479[_0x50bb('0x39')][_0x50bb('0x3c')]){_0x44ce86['attributes'][_0x50bb('0x59')](function(_0x52c882){_0x8a0b28[_0x50bb('0x44')]('c.'+_0x52c882);});}else{_0x8a0b28[_0x50bb('0x44')]('c.id');_0x8a0b28[_0x50bb('0x44')](_0x50bb('0x88'));_0x8a0b28[_0x50bb('0x44')]('c.lastName');_0x8a0b28[_0x50bb('0x44')](_0x50bb('0x89'));_0x8a0b28[_0x50bb('0x44')](_0x50bb('0x8a'));_0x8a0b28['field'](_0x50bb('0x8b'));_0x8a0b28[_0x50bb('0x44')]('c.email');_0x8a0b28['field'](_0x50bb('0x8c'));_0x8a0b28[_0x50bb('0x44')]('c.createdAt');_0x8a0b28[_0x50bb('0x44')](_0x50bb('0x8d'));_0x8a0b28[_0x50bb('0x44')](_0x50bb('0x8e'));_0x8a0b28[_0x50bb('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x44ce86[_0x50bb('0x22')])_0x8a0b28[_0x50bb('0x22')](_0x44ce86[_0x50bb('0x22')]);if(_0x44ce86[_0x50bb('0x21')])_0x8a0b28['offset'](_0x44ce86[_0x50bb('0x21')]);return db['sequelize'][_0x50bb('0x39')](_0x8a0b28[_0x50bb('0x8f')](),_0x2b9deb);});})[_0x50bb('0x27')](function(_0xbcfdba){_0xbcfdba[_0x50bb('0x59')](function(_0x217170){if(_0x217170[_0x50bb('0x90')]){_0x217170['Tags']=[];_0x217170[_0x50bb('0x90')][_0x50bb('0x91')](',')[_0x50bb('0x59')](function(_0x170923){_0x217170[_0x50bb('0x92')][_0x50bb('0x33')](_0x718128[_0x170923]);});}delete _0x217170[_0x50bb('0x90')];});_0x15ee2e['rows']=_0xbcfdba;return _0x15ee2e;})[_0x50bb('0x27')](respondWithFilteredResult(_0x4f7514,_0x44ce86));})[_0x50bb('0x93')](handleError(_0x4f7514,null));};exports[_0x50bb('0x28')]=function(_0x3bd57a,_0x469435){return db['CmContact']['find']({'where':{'id':_0x3bd57a[_0x50bb('0x94')]['id']}})['then'](handleEntityNotFound(_0x469435,null))[_0x50bb('0x27')](removeEntity(_0x469435,null))[_0x50bb('0x93')](handleError(_0x469435,null));};exports['describe']=function(_0x498b88,_0x5e6545){return db[_0x50bb('0x2e')][_0x50bb('0x95')]()['then'](function(_0x75dc05){delete _0x75dc05[_0x50bb('0x96')];for(var _0x1b88f5=0x0;_0x1b88f5{}\s\\|]/g,'-');_0x28cb83(null,util[_0x9360('0x1f')](_0x9360('0x20'),path['basename'](_0x112bd8['originalname'],path['extname'](_0x112bd8['originalname'])),Date['now'](),path['extname'](_0x112bd8['originalname'])));}})});router[_0x9360('0x17')]('/csv',upload[_0x9360('0x21')](_0x9360('0x22')),controller[_0x9360('0x23')]);var upload=multer({'storage':multer[_0x9360('0x1b')]({'destination':function(_0x42d9c2,_0x13417d,_0x2d9627){_0x2d9627(null,path[_0x9360('0x1c')](config[_0x9360('0x24')],_0x9360('0x25')));},'filename':function(_0x3b398b,_0xdae2f5,_0x4cc86e){_0xdae2f5[_0x9360('0x1d')]=_0xdae2f5['originalname'][_0x9360('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4cc86e(null,util['format'](_0x9360('0x20'),path[_0x9360('0x26')](_0xdae2f5[_0x9360('0x1d')],path[_0x9360('0x27')](_0xdae2f5['originalname'])),Date[_0x9360('0x28')](),path[_0x9360('0x27')](_0xdae2f5[_0x9360('0x1d')])));}})});router[_0x9360('0x17')](_0x9360('0x29'),upload[_0x9360('0x21')]('file'),controller['upload']);router['post'](_0x9360('0x2a'),auth[_0x9360('0xb')](),controller[_0x9360('0x2b')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9360('0x2c')]);router['delete'](_0x9360('0xc'),auth[_0x9360('0xb')](),controller[_0x9360('0x2d')]);module[_0x9360('0x2e')]=router; \ No newline at end of file +var _0xae2b=['/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','/merge','merge','post','create','bulkCreate','join','server/files/tmp','originalname','replace','format','%s-%s%s','extname','/csv','file','diskStorage','basename','now','/upload','single','upload','/upload/:id','import','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','/:id/tags','getTags','getHopperHistories','getHopperFinals'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xae2b,0xb3));var _0xbae2=function(_0x5105ea,_0x414452){_0x5105ea=_0x5105ea-0x0;var _0x342454=_0xae2b[_0x5105ea];return _0x342454;};'use strict';var multer=require(_0xbae2('0x0'));var util=require(_0xbae2('0x1'));var path=require('path');var timeout=require(_0xbae2('0x2'));var express=require(_0xbae2('0x3'));var router=express[_0xbae2('0x4')]();var auth=require(_0xbae2('0x5'));var interaction=require(_0xbae2('0x6'));var config=require(_0xbae2('0x7'));var controller=require('./cmContact.controller');router[_0xbae2('0x8')]('/',auth['isAuthenticated'](),controller[_0xbae2('0x9')]);router[_0xbae2('0x8')](_0xbae2('0xa'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbae2('0xb')](),controller[_0xbae2('0xc')]);router[_0xbae2('0x8')](_0xbae2('0xd'),auth[_0xbae2('0xb')](),controller[_0xbae2('0xe')]);router[_0xbae2('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router[_0xbae2('0x8')]('/:id/hopper_histories',auth[_0xbae2('0xb')](),controller[_0xbae2('0xf')]);router[_0xbae2('0x8')]('/:id/hopper_finals',auth[_0xbae2('0xb')](),controller[_0xbae2('0x10')]);router['get'](_0xbae2('0x11'),auth[_0xbae2('0xb')](),controller[_0xbae2('0x12')]);router[_0xbae2('0x8')](_0xbae2('0x13'),auth[_0xbae2('0xb')](),controller[_0xbae2('0x14')]);router['post'](_0xbae2('0x15'),auth['isAuthenticated'](),controller[_0xbae2('0x16')]);router[_0xbae2('0x17')]('/',auth['isAuthenticated'](),controller[_0xbae2('0x18')]);router[_0xbae2('0x17')]('/create_many',auth[_0xbae2('0xb')](),controller[_0xbae2('0x19')]);router[_0xbae2('0x17')]('/:id/tags',auth[_0xbae2('0xb')](),controller['setTags']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb9d11c,_0x2c40ea,_0x114fbe){_0x114fbe(null,path[_0xbae2('0x1a')](config['root'],_0xbae2('0x1b')));},'filename':function(_0x3f2d99,_0x4a42be,_0x5ba648){_0x4a42be[_0xbae2('0x1c')]=_0x4a42be[_0xbae2('0x1c')][_0xbae2('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ba648(null,util[_0xbae2('0x1e')](_0xbae2('0x1f'),path['basename'](_0x4a42be['originalname'],path[_0xbae2('0x20')](_0x4a42be[_0xbae2('0x1c')])),Date['now'](),path[_0xbae2('0x20')](_0x4a42be[_0xbae2('0x1c')])));}})});router[_0xbae2('0x17')](_0xbae2('0x21'),upload['single'](_0xbae2('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xbae2('0x23')]({'destination':function(_0x90a9a8,_0x245a74,_0x352fd2){_0x352fd2(null,path[_0xbae2('0x1a')](config['root'],_0xbae2('0x1b')));},'filename':function(_0x2513c1,_0x51ca54,_0x1361e7){_0x51ca54[_0xbae2('0x1c')]=_0x51ca54[_0xbae2('0x1c')][_0xbae2('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1361e7(null,util[_0xbae2('0x1e')]('%s-%s%s',path[_0xbae2('0x24')](_0x51ca54['originalname'],path[_0xbae2('0x20')](_0x51ca54[_0xbae2('0x1c')])),Date[_0xbae2('0x25')](),path[_0xbae2('0x20')](_0x51ca54[_0xbae2('0x1c')])));}})});router[_0xbae2('0x17')](_0xbae2('0x26'),upload[_0xbae2('0x27')](_0xbae2('0x22')),controller[_0xbae2('0x28')]);router[_0xbae2('0x17')](_0xbae2('0x29'),auth[_0xbae2('0xb')](),controller[_0xbae2('0x2a')]);router[_0xbae2('0x2b')](_0xbae2('0x2c'),auth['isAuthenticated'](),controller[_0xbae2('0x2d')]);router[_0xbae2('0x2e')]('/:id',auth['isAuthenticated'](),controller[_0xbae2('0x2f')]);module[_0xbae2('0x30')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 818022a..fab7625 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 _0x294b=['STRING','PHONE','sequelize','INTEGER'];(function(_0x1bf4d4,_0x5213a8){var _0x150f5d=function(_0x4dcd21){while(--_0x4dcd21){_0x1bf4d4['push'](_0x1bf4d4['shift']());}};_0x150f5d(++_0x5213a8);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb294('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xb294('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xb294('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xb294('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xb294('0x2')],'defaultValue':_0xb294('0x3')},'OrderBy':{'type':Sequelize[_0xb294('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x77f7=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x4cfd95,_0x2e7581){var _0x1e96eb=function(_0x5ddd9a){while(--_0x5ddd9a){_0x4cfd95['push'](_0x4cfd95['shift']());}};_0x1e96eb(++_0x2e7581);}(_0x77f7,0xbd));var _0x777f=function(_0x46af35,_0x387df1){_0x46af35=_0x46af35-0x0;var _0x15c08f=_0x77f7[_0x46af35];return _0x15c08f;};'use strict';var Sequelize=require(_0x777f('0x0'));module[_0x777f('0x1')]={'CmContactId':{'type':Sequelize[_0x777f('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x777f('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x777f('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x777f('0x3')],'defaultValue':_0x777f('0x4')},'OrderBy':{'type':Sequelize[_0x777f('0x2')],'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 c8feef6..03e30fb 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 _0xcb22=['get','CmContactHasItems','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','CmContactHasItem','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','user','find','userProfileId','autoAssociation','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','end','count','offset','limit','apply','save','update','then'];(function(_0x3145e2,_0x1287c3){var _0x3e7853=function(_0x991088){while(--_0x991088){_0x3145e2['push'](_0x3145e2['shift']());}};_0x3e7853(++_0x1287c3);}(_0xcb22,0xc8));var _0x2cb2=function(_0x1850e0,_0x3a0b51){_0x1850e0=_0x1850e0-0x0;var _0x3f8171=_0xcb22[_0x1850e0];return _0x3f8171;};'use strict';var pdf=require(_0x2cb2('0x0'));var emlformat=require(_0x2cb2('0x1'));var rimraf=require(_0x2cb2('0x2'));var zipdir=require(_0x2cb2('0x3'));var jsonpatch=require(_0x2cb2('0x4'));var rp=require(_0x2cb2('0x5'));var moment=require(_0x2cb2('0x6'));var BPromise=require(_0x2cb2('0x7'));var Mustache=require(_0x2cb2('0x8'));var util=require(_0x2cb2('0x9'));var path=require(_0x2cb2('0xa'));var sox=require('sox');var csv=require(_0x2cb2('0xb'));var ejs=require(_0x2cb2('0xc'));var fs=require('fs');var _=require(_0x2cb2('0xd'));var squel=require(_0x2cb2('0xe'));var crypto=require(_0x2cb2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2cb2('0x10'));var toCsv=require(_0x2cb2('0xb'));var querystring=require('querystring');var Papa=require(_0x2cb2('0x11'));var Redis=require(_0x2cb2('0x12'));var authService=require(_0x2cb2('0x13'));var qs=require(_0x2cb2('0x14'));var as=require(_0x2cb2('0x15'));var hardwareService=require(_0x2cb2('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2cb2('0x17'));var config=require(_0x2cb2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9311fa,_0x50253a){_0x50253a=_0x50253a||0xcc;return function(_0x1fcb05){if(_0x1fcb05){return _0x9311fa['sendStatus'](_0x50253a);}return _0x9311fa[_0x2cb2('0x19')](_0x50253a)[_0x2cb2('0x1a')]();};}function respondWithResult(_0x529c51,_0x3b423a){_0x3b423a=_0x3b423a||0xc8;return function(_0x1be548){if(_0x1be548){return _0x529c51[_0x2cb2('0x19')](_0x3b423a)['json'](_0x1be548);}};}function respondWithFilteredResult(_0xeed9cf,_0x62121){return function(_0x58d9b4){if(_0x58d9b4){var _0x181ef1=_0x58d9b4[_0x2cb2('0x1b')],_0x4aa895=_0x62121[_0x2cb2('0x1c')],_0xac72c4=_0x62121[_0x2cb2('0x1c')]+_0x62121[_0x2cb2('0x1d')],_0x26045d;if(_0xac72c4>=_0x181ef1){_0xac72c4=_0x181ef1;_0x26045d=0xc8;}else{_0x26045d=0xce;}_0xeed9cf['status'](_0x26045d);return _0xeed9cf['set']('Content-Range',_0x4aa895+'-'+_0xac72c4+'/'+_0x181ef1)['json'](_0x58d9b4);}return null;};}function patchUpdates(_0x15708b){return function(_0x46ba55){try{jsonpatch[_0x2cb2('0x1e')](_0x46ba55,_0x15708b,!![]);}catch(_0x64d13e){return BPromise['reject'](_0x64d13e);}return _0x46ba55[_0x2cb2('0x1f')]();};}function saveUpdates(_0x10bd4a,_0x195de5){return function(_0x582890){if(_0x582890){return _0x582890[_0x2cb2('0x20')](_0x10bd4a)[_0x2cb2('0x21')](function(_0x3203fb){return _0x3203fb;});}return null;};}function removeEntity(_0x2c1831,_0x161cdf){return function(_0x142a7c){if(_0x142a7c){return _0x142a7c['destroy']()[_0x2cb2('0x21')](function(){var _0x312bab=_0x142a7c[_0x2cb2('0x22')]({'plain':!![]});var _0x3f43bd=_0x2cb2('0x23');return db[_0x2cb2('0x24')][_0x2cb2('0x25')]({'where':{'type':_0x3f43bd,'resourceId':_0x312bab['id']}})[_0x2cb2('0x21')](function(){return _0x142a7c;});})['then'](function(){_0x2c1831[_0x2cb2('0x19')](0xcc)[_0x2cb2('0x1a')]();});}};}function handleEntityNotFound(_0x14c68b,_0x3d9488){return function(_0x121f18){if(!_0x121f18){_0x14c68b[_0x2cb2('0x26')](0x194);}return _0x121f18;};}function handleError(_0x18b507,_0x4673dd){_0x4673dd=_0x4673dd||0x1f4;return function(_0x779ae3){logger[_0x2cb2('0x27')](_0x779ae3[_0x2cb2('0x28')]);if(_0x779ae3['name']){delete _0x779ae3[_0x2cb2('0x29')];}_0x18b507[_0x2cb2('0x19')](_0x4673dd)[_0x2cb2('0x2a')](_0x779ae3);};}exports[_0x2cb2('0x2b')]=function(_0x1dd178,_0x200067){var _0xb33189={},_0x54d708={},_0x2173b4={'count':0x0,'rows':[]};var _0x4cb0ff=_['map'](db[_0x2cb2('0x2c')]['rawAttributes'],function(_0xcb5dc9){return{'name':_0xcb5dc9['fieldName'],'type':_0xcb5dc9['type'][_0x2cb2('0x2d')]};});_0x54d708[_0x2cb2('0x2e')]=_[_0x2cb2('0x2f')](_0x4cb0ff,_0x2cb2('0x29'));_0x54d708[_0x2cb2('0x30')]=_[_0x2cb2('0x31')](_0x1dd178[_0x2cb2('0x30')]);_0x54d708[_0x2cb2('0x32')]=_[_0x2cb2('0x33')](_0x54d708['model'],_0x54d708[_0x2cb2('0x30')]);_0xb33189[_0x2cb2('0x34')]=_['intersection'](_0x54d708[_0x2cb2('0x2e')],qs[_0x2cb2('0x35')](_0x1dd178[_0x2cb2('0x30')]['fields']));_0xb33189['attributes']=_0xb33189[_0x2cb2('0x34')][_0x2cb2('0x36')]?_0xb33189[_0x2cb2('0x34')]:_0x54d708['model'];if(!_0x1dd178[_0x2cb2('0x30')][_0x2cb2('0x37')]('nolimit')){_0xb33189['limit']=qs[_0x2cb2('0x1d')](_0x1dd178[_0x2cb2('0x30')][_0x2cb2('0x1d')]);_0xb33189['offset']=qs['offset'](_0x1dd178[_0x2cb2('0x30')][_0x2cb2('0x1c')]);}_0xb33189[_0x2cb2('0x38')]=qs[_0x2cb2('0x39')](_0x1dd178[_0x2cb2('0x30')]['sort']);_0xb33189[_0x2cb2('0x3a')]=qs[_0x2cb2('0x32')](_[_0x2cb2('0x3b')](_0x1dd178['query'],_0x54d708['filters']),_0x4cb0ff);if(_0x1dd178[_0x2cb2('0x30')][_0x2cb2('0x3c')]){_0xb33189[_0x2cb2('0x3a')]=_[_0x2cb2('0x3d')](_0xb33189[_0x2cb2('0x3a')],{'$or':_[_0x2cb2('0x2f')](_0x4cb0ff,function(_0x56baa2){if(_0x56baa2[_0x2cb2('0x3e')]!==_0x2cb2('0x3f')){var _0x3ef70a={};_0x3ef70a[_0x56baa2[_0x2cb2('0x29')]]={'$like':'%'+_0x1dd178[_0x2cb2('0x30')][_0x2cb2('0x3c')]+'%'};return _0x3ef70a;}})});}_0xb33189=_[_0x2cb2('0x3d')]({},_0xb33189,_0x1dd178[_0x2cb2('0x40')]);var _0x42bca6={'where':_0xb33189['where']};return db[_0x2cb2('0x2c')]['count'](_0x42bca6)[_0x2cb2('0x21')](function(_0x48b59f){_0x2173b4[_0x2cb2('0x1b')]=_0x48b59f;if(_0x1dd178[_0x2cb2('0x30')][_0x2cb2('0x41')]){_0xb33189['include']=[{'all':!![]}];}return db[_0x2cb2('0x2c')][_0x2cb2('0x42')](_0xb33189);})[_0x2cb2('0x21')](function(_0x44e3aa){_0x2173b4[_0x2cb2('0x43')]=_0x44e3aa;return _0x2173b4;})[_0x2cb2('0x21')](respondWithFilteredResult(_0x200067,_0xb33189))[_0x2cb2('0x44')](handleError(_0x200067,null));};exports[_0x2cb2('0x45')]=function(_0x38a566,_0x5c02be){var _0x44bd32={'raw':!![],'where':{'id':_0x38a566['params']['id']}},_0x1271dd={};_0x1271dd['model']=_[_0x2cb2('0x31')](db[_0x2cb2('0x2c')]['rawAttributes']);_0x1271dd[_0x2cb2('0x30')]=_[_0x2cb2('0x31')](_0x38a566['query']);_0x1271dd['filters']=_[_0x2cb2('0x33')](_0x1271dd[_0x2cb2('0x2e')],_0x1271dd['query']);_0x44bd32[_0x2cb2('0x34')]=_[_0x2cb2('0x33')](_0x1271dd['model'],qs['fields'](_0x38a566['query']['fields']));_0x44bd32[_0x2cb2('0x34')]=_0x44bd32[_0x2cb2('0x34')]['length']?_0x44bd32[_0x2cb2('0x34')]:_0x1271dd[_0x2cb2('0x2e')];if(_0x38a566[_0x2cb2('0x30')][_0x2cb2('0x41')]){_0x44bd32[_0x2cb2('0x46')]=[{'all':!![]}];}_0x44bd32=_['merge']({},_0x44bd32,_0x38a566[_0x2cb2('0x40')]);return db['CmContactHasItem']['find'](_0x44bd32)['then'](handleEntityNotFound(_0x5c02be,null))['then'](respondWithResult(_0x5c02be,null))[_0x2cb2('0x44')](handleError(_0x5c02be,null));};exports[_0x2cb2('0x47')]=function(_0x71d263,_0x2a49d8){return db['CmContactHasItem'][_0x2cb2('0x47')](_0x71d263[_0x2cb2('0x48')],{})[_0x2cb2('0x21')](function(_0x2f2000){var _0x485cca=_0x71d263[_0x2cb2('0x49')][_0x2cb2('0x22')]({'plain':!![]});if(!_0x485cca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x485cca['role']===_0x2cb2('0x49')){var _0x1f050c=_0x2f2000[_0x2cb2('0x22')]({'plain':!![]});var _0x16b6eb='CmContactHasItems';return db['UserProfileSection'][_0x2cb2('0x4a')]({'where':{'name':_0x16b6eb,'userProfileId':_0x485cca[_0x2cb2('0x4b')]},'raw':!![]})[_0x2cb2('0x21')](function(_0x252f6a){if(_0x252f6a&&_0x252f6a[_0x2cb2('0x4c')]===0x0){return db[_0x2cb2('0x24')][_0x2cb2('0x47')]({'name':_0x1f050c[_0x2cb2('0x29')],'resourceId':_0x1f050c['id'],'type':_0x252f6a[_0x2cb2('0x29')],'sectionId':_0x252f6a['id']},{})[_0x2cb2('0x21')](function(){return _0x2f2000;});}else{return _0x2f2000;}})[_0x2cb2('0x44')](function(_0x1fd5e7){logger[_0x2cb2('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fd5e7);throw _0x1fd5e7;});}return _0x2f2000;})[_0x2cb2('0x21')](respondWithResult(_0x2a49d8,0xc9))['catch'](handleError(_0x2a49d8,null));};exports[_0x2cb2('0x20')]=function(_0x2cab9d,_0x2ceb83){if(_0x2cab9d['body']['id']){delete _0x2cab9d[_0x2cb2('0x48')]['id'];}return db[_0x2cb2('0x2c')][_0x2cb2('0x4a')]({'where':{'id':_0x2cab9d[_0x2cb2('0x4d')]['id']}})[_0x2cb2('0x21')](handleEntityNotFound(_0x2ceb83,null))[_0x2cb2('0x21')](saveUpdates(_0x2cab9d[_0x2cb2('0x48')],null))['then'](respondWithResult(_0x2ceb83,null))[_0x2cb2('0x44')](handleError(_0x2ceb83,null));};exports[_0x2cb2('0x25')]=function(_0x4c78a2,_0xec11ba){return db[_0x2cb2('0x2c')]['find']({'where':{'id':_0x4c78a2[_0x2cb2('0x4d')]['id']}})[_0x2cb2('0x21')](handleEntityNotFound(_0xec11ba,null))[_0x2cb2('0x21')](removeEntity(_0xec11ba,null))[_0x2cb2('0x44')](handleError(_0xec11ba,null));}; \ No newline at end of file +var _0x3feb=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','reject','then','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0x3feb,0x1ce));var _0xb3fe=function(_0xcd213d,_0x2e61d6){_0xcd213d=_0xcd213d-0x0;var _0x302341=_0x3feb[_0xcd213d];return _0x302341;};'use strict';var pdf=require(_0xb3fe('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb3fe('0x1'));var jsonpatch=require(_0xb3fe('0x2'));var rp=require(_0xb3fe('0x3'));var moment=require('moment');var BPromise=require(_0xb3fe('0x4'));var Mustache=require('mustache');var util=require(_0xb3fe('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb3fe('0x6'));var ejs=require(_0xb3fe('0x7'));var fs=require('fs');var _=require(_0xb3fe('0x8'));var squel=require(_0xb3fe('0x9'));var crypto=require('crypto');var jsforce=require(_0xb3fe('0xa'));var deskjs=require(_0xb3fe('0xb'));var toCsv=require(_0xb3fe('0x6'));var querystring=require(_0xb3fe('0xc'));var Papa=require(_0xb3fe('0xd'));var Redis=require(_0xb3fe('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb3fe('0xf'));var as=require(_0xb3fe('0x10'));var hardwareService=require(_0xb3fe('0x11'));var logger=require(_0xb3fe('0x12'))(_0xb3fe('0x13'));var utils=require(_0xb3fe('0x14'));var config=require(_0xb3fe('0x15'));var licenseUtil=require(_0xb3fe('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x104d13,_0x5d7841){_0x5d7841=_0x5d7841||0xcc;return function(_0x46a042){if(_0x46a042){return _0x104d13[_0xb3fe('0x17')](_0x5d7841);}return _0x104d13[_0xb3fe('0x18')](_0x5d7841)[_0xb3fe('0x19')]();};}function respondWithResult(_0x48c197,_0x169522){_0x169522=_0x169522||0xc8;return function(_0x4318c3){if(_0x4318c3){return _0x48c197[_0xb3fe('0x18')](_0x169522)['json'](_0x4318c3);}};}function respondWithFilteredResult(_0x3a1287,_0x59d44d){return function(_0x2218fd){if(_0x2218fd){var _0x3ad9d8=_0x2218fd[_0xb3fe('0x1a')],_0x54ce6d=_0x59d44d[_0xb3fe('0x1b')],_0xa2418d=_0x59d44d['offset']+_0x59d44d[_0xb3fe('0x1c')],_0x122287;if(_0xa2418d>=_0x3ad9d8){_0xa2418d=_0x3ad9d8;_0x122287=0xc8;}else{_0x122287=0xce;}_0x3a1287[_0xb3fe('0x18')](_0x122287);return _0x3a1287[_0xb3fe('0x1d')]('Content-Range',_0x54ce6d+'-'+_0xa2418d+'/'+_0x3ad9d8)['json'](_0x2218fd);}return null;};}function patchUpdates(_0x2a1a2f){return function(_0x371ec3){try{jsonpatch['apply'](_0x371ec3,_0x2a1a2f,!![]);}catch(_0x33034f){return BPromise[_0xb3fe('0x1e')](_0x33034f);}return _0x371ec3['save']();};}function saveUpdates(_0x4b2337,_0x5f2bc5){return function(_0x3cf3bd){if(_0x3cf3bd){return _0x3cf3bd['update'](_0x4b2337)[_0xb3fe('0x1f')](function(_0x3ef29f){return _0x3ef29f;});}return null;};}function removeEntity(_0xd7b5e7,_0x75c164){return function(_0x262116){if(_0x262116){return _0x262116['destroy']()[_0xb3fe('0x1f')](function(){var _0xeb4403=_0x262116[_0xb3fe('0x20')]({'plain':!![]});var _0x6995be=_0xb3fe('0x21');return db[_0xb3fe('0x22')]['destroy']({'where':{'type':_0x6995be,'resourceId':_0xeb4403['id']}})[_0xb3fe('0x1f')](function(){return _0x262116;});})[_0xb3fe('0x1f')](function(){_0xd7b5e7[_0xb3fe('0x18')](0xcc)[_0xb3fe('0x19')]();});}};}function handleEntityNotFound(_0x3b5f48,_0xeaf6b6){return function(_0x48f9cc){if(!_0x48f9cc){_0x3b5f48[_0xb3fe('0x17')](0x194);}return _0x48f9cc;};}function handleError(_0x2eac6b,_0x184c25){_0x184c25=_0x184c25||0x1f4;return function(_0x8c9858){logger[_0xb3fe('0x23')](_0x8c9858[_0xb3fe('0x24')]);if(_0x8c9858[_0xb3fe('0x25')]){delete _0x8c9858['name'];}_0x2eac6b['status'](_0x184c25)[_0xb3fe('0x26')](_0x8c9858);};}exports[_0xb3fe('0x27')]=function(_0x5573f0,_0x10ab91){var _0x4eb55f={},_0x5474e5={},_0x21e5d6={'count':0x0,'rows':[]};var _0x84ea8e=_['map'](db[_0xb3fe('0x28')][_0xb3fe('0x29')],function(_0x34e078){return{'name':_0x34e078[_0xb3fe('0x2a')],'type':_0x34e078[_0xb3fe('0x2b')][_0xb3fe('0x2c')]};});_0x5474e5[_0xb3fe('0x2d')]=_['map'](_0x84ea8e,_0xb3fe('0x25'));_0x5474e5['query']=_[_0xb3fe('0x2e')](_0x5573f0['query']);_0x5474e5['filters']=_[_0xb3fe('0x2f')](_0x5474e5[_0xb3fe('0x2d')],_0x5474e5[_0xb3fe('0x30')]);_0x4eb55f['attributes']=_[_0xb3fe('0x2f')](_0x5474e5[_0xb3fe('0x2d')],qs['fields'](_0x5573f0[_0xb3fe('0x30')][_0xb3fe('0x31')]));_0x4eb55f[_0xb3fe('0x32')]=_0x4eb55f[_0xb3fe('0x32')][_0xb3fe('0x33')]?_0x4eb55f['attributes']:_0x5474e5['model'];if(!_0x5573f0['query'][_0xb3fe('0x34')]('nolimit')){_0x4eb55f[_0xb3fe('0x1c')]=qs[_0xb3fe('0x1c')](_0x5573f0[_0xb3fe('0x30')][_0xb3fe('0x1c')]);_0x4eb55f[_0xb3fe('0x1b')]=qs[_0xb3fe('0x1b')](_0x5573f0[_0xb3fe('0x30')][_0xb3fe('0x1b')]);}_0x4eb55f[_0xb3fe('0x35')]=qs[_0xb3fe('0x36')](_0x5573f0['query'][_0xb3fe('0x36')]);_0x4eb55f[_0xb3fe('0x37')]=qs[_0xb3fe('0x38')](_[_0xb3fe('0x39')](_0x5573f0[_0xb3fe('0x30')],_0x5474e5[_0xb3fe('0x38')]),_0x84ea8e);if(_0x5573f0['query'][_0xb3fe('0x3a')]){_0x4eb55f[_0xb3fe('0x37')]=_[_0xb3fe('0x3b')](_0x4eb55f[_0xb3fe('0x37')],{'$or':_['map'](_0x84ea8e,function(_0x2e00af){if(_0x2e00af['type']!==_0xb3fe('0x3c')){var _0x1855e6={};_0x1855e6[_0x2e00af[_0xb3fe('0x25')]]={'$like':'%'+_0x5573f0['query']['filter']+'%'};return _0x1855e6;}})});}_0x4eb55f=_[_0xb3fe('0x3b')]({},_0x4eb55f,_0x5573f0[_0xb3fe('0x3d')]);var _0x4a61b2={'where':_0x4eb55f[_0xb3fe('0x37')]};return db['CmContactHasItem']['count'](_0x4a61b2)['then'](function(_0x29e1b6){_0x21e5d6[_0xb3fe('0x1a')]=_0x29e1b6;if(_0x5573f0['query'][_0xb3fe('0x3e')]){_0x4eb55f['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0xb3fe('0x3f')](_0x4eb55f);})[_0xb3fe('0x1f')](function(_0x8fadb6){_0x21e5d6[_0xb3fe('0x40')]=_0x8fadb6;return _0x21e5d6;})[_0xb3fe('0x1f')](respondWithFilteredResult(_0x10ab91,_0x4eb55f))[_0xb3fe('0x41')](handleError(_0x10ab91,null));};exports[_0xb3fe('0x42')]=function(_0xb227a5,_0x55e5a3){var _0x2b8931={'raw':!![],'where':{'id':_0xb227a5[_0xb3fe('0x43')]['id']}},_0x5e84be={};_0x5e84be['model']=_[_0xb3fe('0x2e')](db[_0xb3fe('0x28')][_0xb3fe('0x29')]);_0x5e84be[_0xb3fe('0x30')]=_[_0xb3fe('0x2e')](_0xb227a5['query']);_0x5e84be[_0xb3fe('0x38')]=_[_0xb3fe('0x2f')](_0x5e84be[_0xb3fe('0x2d')],_0x5e84be[_0xb3fe('0x30')]);_0x2b8931[_0xb3fe('0x32')]=_[_0xb3fe('0x2f')](_0x5e84be[_0xb3fe('0x2d')],qs[_0xb3fe('0x31')](_0xb227a5[_0xb3fe('0x30')][_0xb3fe('0x31')]));_0x2b8931[_0xb3fe('0x32')]=_0x2b8931[_0xb3fe('0x32')][_0xb3fe('0x33')]?_0x2b8931[_0xb3fe('0x32')]:_0x5e84be['model'];if(_0xb227a5[_0xb3fe('0x30')][_0xb3fe('0x3e')]){_0x2b8931[_0xb3fe('0x44')]=[{'all':!![]}];}_0x2b8931=_[_0xb3fe('0x3b')]({},_0x2b8931,_0xb227a5[_0xb3fe('0x3d')]);return db[_0xb3fe('0x28')][_0xb3fe('0x45')](_0x2b8931)['then'](handleEntityNotFound(_0x55e5a3,null))[_0xb3fe('0x1f')](respondWithResult(_0x55e5a3,null))[_0xb3fe('0x41')](handleError(_0x55e5a3,null));};exports['create']=function(_0x2612e8,_0x4b8979){return db[_0xb3fe('0x28')][_0xb3fe('0x46')](_0x2612e8[_0xb3fe('0x47')],{})[_0xb3fe('0x1f')](function(_0x5f3fac){var _0x20d46b=_0x2612e8[_0xb3fe('0x48')][_0xb3fe('0x20')]({'plain':!![]});if(!_0x20d46b)throw new Error(_0xb3fe('0x49'));if(_0x20d46b[_0xb3fe('0x4a')]===_0xb3fe('0x48')){var _0x5e9872=_0x5f3fac[_0xb3fe('0x20')]({'plain':!![]});var _0x2f29d4='CmContactHasItems';return db[_0xb3fe('0x4b')]['find']({'where':{'name':_0x2f29d4,'userProfileId':_0x20d46b[_0xb3fe('0x4c')]},'raw':!![]})[_0xb3fe('0x1f')](function(_0x1ee374){if(_0x1ee374&&_0x1ee374[_0xb3fe('0x4d')]===0x0){return db[_0xb3fe('0x22')][_0xb3fe('0x46')]({'name':_0x5e9872['name'],'resourceId':_0x5e9872['id'],'type':_0x1ee374[_0xb3fe('0x25')],'sectionId':_0x1ee374['id']},{})['then'](function(){return _0x5f3fac;});}else{return _0x5f3fac;}})[_0xb3fe('0x41')](function(_0x14d95c){logger['error'](_0xb3fe('0x4e'),_0x14d95c);throw _0x14d95c;});}return _0x5f3fac;})[_0xb3fe('0x1f')](respondWithResult(_0x4b8979,0xc9))[_0xb3fe('0x41')](handleError(_0x4b8979,null));};exports[_0xb3fe('0x4f')]=function(_0x1193f9,_0x24b0a5){if(_0x1193f9[_0xb3fe('0x47')]['id']){delete _0x1193f9[_0xb3fe('0x47')]['id'];}return db[_0xb3fe('0x28')][_0xb3fe('0x45')]({'where':{'id':_0x1193f9[_0xb3fe('0x43')]['id']}})['then'](handleEntityNotFound(_0x24b0a5,null))['then'](saveUpdates(_0x1193f9[_0xb3fe('0x47')],null))[_0xb3fe('0x1f')](respondWithResult(_0x24b0a5,null))[_0xb3fe('0x41')](handleError(_0x24b0a5,null));};exports['destroy']=function(_0x58465a,_0x878a48){return db['CmContactHasItem'][_0xb3fe('0x45')]({'where':{'id':_0x58465a[_0xb3fe('0x43')]['id']}})[_0xb3fe('0x1f')](handleEntityNotFound(_0x878a48,null))[_0xb3fe('0x1f')](removeEntity(_0x878a48,null))['catch'](handleError(_0x878a48,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 59401df..2a26d45 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 _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x885a,0x180));var _0xa885=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x885a[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('0xb'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb65=['moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','util','../../config/logger'];(function(_0x1d1312,_0x3c4a64){var _0xf96ae8=function(_0x20b49d){while(--_0x20b49d){_0x1d1312['push'](_0x1d1312['shift']());}};_0xf96ae8(++_0x3c4a64);}(_0xfb65,0x82));var _0x5fb6=function(_0x2436ed,_0x33b3fd){_0x2436ed=_0x2436ed-0x0;var _0x53042b=_0xfb65[_0x2436ed];return _0x53042b;};'use strict';var _=require('lodash');var util=require(_0x5fb6('0x0'));var logger=require(_0x5fb6('0x1'))('api');var moment=require(_0x5fb6('0x2'));var BPromise=require('bluebird');var rp=require(_0x5fb6('0x3'));var fs=require('fs');var path=require(_0x5fb6('0x4'));var rimraf=require(_0x5fb6('0x5'));var config=require(_0x5fb6('0x6'));var attributes=require(_0x5fb6('0x7'));module[_0x5fb6('0x8')]=function(_0x4dec8f,_0x50782b){return _0x4dec8f[_0x5fb6('0x9')](_0x5fb6('0xa'),attributes,{'tableName':_0x5fb6('0xb'),'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 445933a..df51179 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 _0x02a6=['rpc','../../config/environment','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x54b561,_0x581fef){var _0x2f00c4=function(_0x2ddf4b){while(--_0x2ddf4b){_0x54b561['push'](_0x54b561['shift']());}};_0x2f00c4(++_0x581fef);}(_0x02a6,0x72));var _0x602a=function(_0x4da514,_0x3a3223){_0x4da514=_0x4da514-0x0;var _0x2141bb=_0x02a6[_0x4da514];return _0x2141bb;};'use strict';var _=require(_0x602a('0x0'));var util=require(_0x602a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x602a('0x2'));var fs=require('fs');var Redis=require(_0x602a('0x3'));var db=require(_0x602a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x602a('0x5'))(_0x602a('0x6'));var config=require(_0x602a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x602a('0x8')][_0x602a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfdc782,_0x2cf7ad,_0x1d70dc){return new BPromise(function(_0x191c10,_0x56534c){return client[_0x602a('0xa')](_0xfdc782,_0x1d70dc)['then'](function(_0x1a8864){logger[_0x602a('0xb')](_0x602a('0xc'),_0x2cf7ad,_0x602a('0xd'));logger['debug'](_0x602a('0xe'),_0x2cf7ad,'request\x20sent',JSON[_0x602a('0xf')](_0x1a8864));if(_0x1a8864[_0x602a('0x10')]){if(_0x1a8864[_0x602a('0x10')][_0x602a('0x11')]===0x1f4){logger[_0x602a('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x2cf7ad,_0x1a8864[_0x602a('0x10')]['message']);return _0x56534c(_0x1a8864[_0x602a('0x10')][_0x602a('0x12')]);}logger['error'](_0x602a('0xc'),_0x2cf7ad,_0x1a8864[_0x602a('0x10')][_0x602a('0x12')]);return _0x191c10(_0x1a8864[_0x602a('0x10')]['message']);}else{logger['info'](_0x602a('0xc'),_0x2cf7ad,'request\x20sent');_0x191c10(_0x1a8864[_0x602a('0x13')]['message']);}})['catch'](function(_0x38fcc2){logger[_0x602a('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x2cf7ad,_0x38fcc2);_0x56534c(_0x38fcc2);});});} \ No newline at end of file +var _0xe2af=['error','code','message','CmContactHasItem,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x15f968,_0xc17341){var _0x290861=function(_0x2275e7){while(--_0x2275e7){_0x15f968['push'](_0x15f968['shift']());}};_0x290861(++_0xc17341);}(_0xe2af,0x6a));var _0xfe2a=function(_0x37feef,_0x10d63c){_0x37feef=_0x37feef-0x0;var _0x15af85=_0xe2af[_0x37feef];return _0x15af85;};'use strict';var _=require('lodash');var util=require(_0xfe2a('0x0'));var moment=require(_0xfe2a('0x1'));var BPromise=require(_0xfe2a('0x2'));var rs=require(_0xfe2a('0x3'));var fs=require('fs');var Redis=require(_0xfe2a('0x4'));var db=require(_0xfe2a('0x5'))['db'];var utils=require(_0xfe2a('0x6'));var logger=require('../../config/logger')(_0xfe2a('0x7'));var config=require(_0xfe2a('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22acb4,_0x12bfa5,_0x4dbd94){return new BPromise(function(_0x39e007,_0x2f912f){return client[_0xfe2a('0x9')](_0x22acb4,_0x4dbd94)['then'](function(_0x164443){logger[_0xfe2a('0xa')]('CmContactHasItem,\x20%s,\x20%s',_0x12bfa5,_0xfe2a('0xb'));logger['debug'](_0xfe2a('0xc'),_0x12bfa5,_0xfe2a('0xb'),JSON[_0xfe2a('0xd')](_0x164443));if(_0x164443[_0xfe2a('0xe')]){if(_0x164443[_0xfe2a('0xe')][_0xfe2a('0xf')]===0x1f4){logger[_0xfe2a('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x12bfa5,_0x164443[_0xfe2a('0xe')][_0xfe2a('0x10')]);return _0x2f912f(_0x164443[_0xfe2a('0xe')][_0xfe2a('0x10')]);}logger[_0xfe2a('0xe')](_0xfe2a('0x11'),_0x12bfa5,_0x164443[_0xfe2a('0xe')]['message']);return _0x39e007(_0x164443['error'][_0xfe2a('0x10')]);}else{logger[_0xfe2a('0xa')](_0xfe2a('0x11'),_0x12bfa5,_0xfe2a('0xb'));_0x39e007(_0x164443[_0xfe2a('0x12')][_0xfe2a('0x10')]);}})[_0xfe2a('0x13')](function(_0x4e14c3){logger[_0xfe2a('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x12bfa5,_0x4e14c3);_0x2f912f(_0x4e14c3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index d9e7257..479d2d3 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 _0xeca4=['destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','delete'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xeca4,0x112));var _0x4eca=function(_0x23eb9b,_0x353833){_0x23eb9b=_0x23eb9b-0x0;var _0x5add1e=_0xeca4[_0x23eb9b];return _0x5add1e;};'use strict';var multer=require(_0x4eca('0x0'));var util=require(_0x4eca('0x1'));var path=require(_0x4eca('0x2'));var timeout=require(_0x4eca('0x3'));var express=require(_0x4eca('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4eca('0x5'));var config=require(_0x4eca('0x6'));var controller=require('./cmContactHasItem.controller');router[_0x4eca('0x7')]('/',auth[_0x4eca('0x8')](),controller['index']);router['get'](_0x4eca('0x9'),auth[_0x4eca('0x8')](),controller[_0x4eca('0xa')]);router[_0x4eca('0xb')]('/',auth[_0x4eca('0x8')](),controller['create']);router[_0x4eca('0xc')]('/:id',auth[_0x4eca('0x8')](),controller['update']);router[_0x4eca('0xd')](_0x4eca('0x9'),auth['isAuthenticated'](),controller[_0x4eca('0xe')]);module[_0x4eca('0xf')]=router; \ No newline at end of file +var _0x8c1c=['multer','util','path','get','isAuthenticated','/:id','show','post','create','exports'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0x8c1c,0x8c));var _0xc8c1=function(_0x2ba0c2,_0x410a86){_0x2ba0c2=_0x2ba0c2-0x0;var _0x45e2bb=_0x8c1c[_0x2ba0c2];return _0x45e2bb;};'use strict';var multer=require(_0xc8c1('0x0'));var util=require(_0xc8c1('0x1'));var path=require(_0xc8c1('0x2'));var timeout=require('connect-timeout');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('./cmContactHasItem.controller');router[_0xc8c1('0x3')]('/',auth[_0xc8c1('0x4')](),controller['index']);router['get'](_0xc8c1('0x5'),auth['isAuthenticated'](),controller[_0xc8c1('0x6')]);router[_0xc8c1('0x7')]('/',auth[_0xc8c1('0x4')](),controller[_0xc8c1('0x8')]);router['put'](_0xc8c1('0x5'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc8c1('0x5'),auth[_0xc8c1('0x4')](),controller['destroy']);module[_0xc8c1('0x9')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index cd5d485..b064ffe 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 _0x12b3=['STRING','sequelize','exports','INTEGER'];(function(_0x178830,_0x5985fc){var _0x444ef9=function(_0x1a2c67){while(--_0x1a2c67){_0x178830['push'](_0x178830['shift']());}};_0x444ef9(++_0x5985fc);}(_0x12b3,0x145));var _0x312b=function(_0xf33805,_0x409457){_0xf33805=_0xf33805-0x0;var _0x45448c=_0x12b3[_0xf33805];return _0x45448c;};'use strict';var Sequelize=require(_0x312b('0x0'));module[_0x312b('0x1')]={'CmContactId':{'type':Sequelize[_0x312b('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x312b('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x5431=['INTEGER','STRING','sequelize','exports'];(function(_0x22c95d,_0x200586){var _0x6bda98=function(_0x2122ba){while(--_0x2122ba){_0x22c95d['push'](_0x22c95d['shift']());}};_0x6bda98(++_0x200586);}(_0x5431,0xb2));var _0x1543=function(_0x1be39f,_0x3d8a44){_0x1be39f=_0x1be39f-0x0;var _0x3aa6b7=_0x5431[_0x1be39f];return _0x3aa6b7;};'use strict';var Sequelize=require(_0x1543('0x0'));module[_0x1543('0x1')]={'CmContactId':{'type':Sequelize[_0x1543('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x1543('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 786592a..8ad628d 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 _0x49f1=['findAll','catch','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','destroy','then','get','CmContactHasPhones','UserProfileResource','error','stack','name','send','index','CmContactHasPhone','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include'];(function(_0xad5c51,_0x6c7293){var _0x140053=function(_0x44b43b){while(--_0x44b43b){_0xad5c51['push'](_0xad5c51['shift']());}};_0x140053(++_0x6c7293);}(_0x49f1,0xb4));var _0x149f=function(_0x27276d,_0x339778){_0x27276d=_0x27276d-0x0;var _0x4263f7=_0x49f1[_0x27276d];return _0x4263f7;};'use strict';var pdf=require(_0x149f('0x0'));var emlformat=require(_0x149f('0x1'));var rimraf=require(_0x149f('0x2'));var zipdir=require(_0x149f('0x3'));var jsonpatch=require(_0x149f('0x4'));var rp=require(_0x149f('0x5'));var moment=require(_0x149f('0x6'));var BPromise=require(_0x149f('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x149f('0x8'));var sox=require(_0x149f('0x9'));var csv=require(_0x149f('0xa'));var ejs=require(_0x149f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x149f('0xc'));var crypto=require('crypto');var jsforce=require(_0x149f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x149f('0xa'));var querystring=require(_0x149f('0xe'));var Papa=require('papaparse');var Redis=require(_0x149f('0xf'));var authService=require(_0x149f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x149f('0x11'));var hardwareService=require(_0x149f('0x12'));var logger=require('../../config/logger')(_0x149f('0x13'));var utils=require(_0x149f('0x14'));var config=require(_0x149f('0x15'));var licenseUtil=require(_0x149f('0x16'));var db=require(_0x149f('0x17'))['db'];function respondWithStatusCode(_0x241a2c,_0x25a18d){_0x25a18d=_0x25a18d||0xcc;return function(_0x34ab1c){if(_0x34ab1c){return _0x241a2c[_0x149f('0x18')](_0x25a18d);}return _0x241a2c[_0x149f('0x19')](_0x25a18d)[_0x149f('0x1a')]();};}function respondWithResult(_0x141aa4,_0x8c8766){_0x8c8766=_0x8c8766||0xc8;return function(_0x548e94){if(_0x548e94){return _0x141aa4[_0x149f('0x19')](_0x8c8766)[_0x149f('0x1b')](_0x548e94);}};}function respondWithFilteredResult(_0x5d303c,_0x6763eb){return function(_0x3df688){if(_0x3df688){var _0x1071da=_0x3df688[_0x149f('0x1c')],_0x2a3358=_0x6763eb[_0x149f('0x1d')],_0x28d0d9=_0x6763eb[_0x149f('0x1d')]+_0x6763eb[_0x149f('0x1e')],_0x4e98ae;if(_0x28d0d9>=_0x1071da){_0x28d0d9=_0x1071da;_0x4e98ae=0xc8;}else{_0x4e98ae=0xce;}_0x5d303c[_0x149f('0x19')](_0x4e98ae);return _0x5d303c[_0x149f('0x1f')]('Content-Range',_0x2a3358+'-'+_0x28d0d9+'/'+_0x1071da)[_0x149f('0x1b')](_0x3df688);}return null;};}function patchUpdates(_0x355c30){return function(_0x29bbb7){try{jsonpatch[_0x149f('0x20')](_0x29bbb7,_0x355c30,!![]);}catch(_0x56153e){return BPromise['reject'](_0x56153e);}return _0x29bbb7[_0x149f('0x21')]();};}function saveUpdates(_0x5b7ef9,_0x29036e){return function(_0x1acd3f){if(_0x1acd3f){return _0x1acd3f['update'](_0x5b7ef9)['then'](function(_0x578c95){return _0x578c95;});}return null;};}function removeEntity(_0x1fdc05,_0x3d102f){return function(_0x311a7d){if(_0x311a7d){return _0x311a7d[_0x149f('0x22')]()[_0x149f('0x23')](function(){var _0x36db9a=_0x311a7d[_0x149f('0x24')]({'plain':!![]});var _0x4e0ad3=_0x149f('0x25');return db[_0x149f('0x26')][_0x149f('0x22')]({'where':{'type':_0x4e0ad3,'resourceId':_0x36db9a['id']}})[_0x149f('0x23')](function(){return _0x311a7d;});})[_0x149f('0x23')](function(){_0x1fdc05['status'](0xcc)[_0x149f('0x1a')]();});}};}function handleEntityNotFound(_0x177455,_0x2c4f09){return function(_0x2a8541){if(!_0x2a8541){_0x177455['sendStatus'](0x194);}return _0x2a8541;};}function handleError(_0x239cc7,_0x16e193){_0x16e193=_0x16e193||0x1f4;return function(_0x55552c){logger[_0x149f('0x27')](_0x55552c[_0x149f('0x28')]);if(_0x55552c[_0x149f('0x29')]){delete _0x55552c['name'];}_0x239cc7[_0x149f('0x19')](_0x16e193)[_0x149f('0x2a')](_0x55552c);};}exports[_0x149f('0x2b')]=function(_0x1f07f7,_0xaacb1){var _0x5e0a6b={},_0x2768f3={},_0x1bbc84={'count':0x0,'rows':[]};var _0x5be2e1=_['map'](db[_0x149f('0x2c')][_0x149f('0x2d')],function(_0x2fb92a){return{'name':_0x2fb92a[_0x149f('0x2e')],'type':_0x2fb92a['type'][_0x149f('0x2f')]};});_0x2768f3[_0x149f('0x30')]=_[_0x149f('0x31')](_0x5be2e1,_0x149f('0x29'));_0x2768f3[_0x149f('0x32')]=_[_0x149f('0x33')](_0x1f07f7['query']);_0x2768f3[_0x149f('0x34')]=_[_0x149f('0x35')](_0x2768f3[_0x149f('0x30')],_0x2768f3[_0x149f('0x32')]);_0x5e0a6b[_0x149f('0x36')]=_[_0x149f('0x35')](_0x2768f3[_0x149f('0x30')],qs[_0x149f('0x37')](_0x1f07f7['query'][_0x149f('0x37')]));_0x5e0a6b['attributes']=_0x5e0a6b[_0x149f('0x36')][_0x149f('0x38')]?_0x5e0a6b[_0x149f('0x36')]:_0x2768f3['model'];if(!_0x1f07f7[_0x149f('0x32')][_0x149f('0x39')](_0x149f('0x3a'))){_0x5e0a6b[_0x149f('0x1e')]=qs[_0x149f('0x1e')](_0x1f07f7[_0x149f('0x32')]['limit']);_0x5e0a6b[_0x149f('0x1d')]=qs['offset'](_0x1f07f7[_0x149f('0x32')][_0x149f('0x1d')]);}_0x5e0a6b[_0x149f('0x3b')]=qs[_0x149f('0x3c')](_0x1f07f7[_0x149f('0x32')][_0x149f('0x3c')]);_0x5e0a6b['where']=qs[_0x149f('0x34')](_[_0x149f('0x3d')](_0x1f07f7[_0x149f('0x32')],_0x2768f3[_0x149f('0x34')]),_0x5be2e1);if(_0x1f07f7[_0x149f('0x32')][_0x149f('0x3e')]){_0x5e0a6b[_0x149f('0x3f')]=_[_0x149f('0x40')](_0x5e0a6b[_0x149f('0x3f')],{'$or':_['map'](_0x5be2e1,function(_0x41a1d3){if(_0x41a1d3[_0x149f('0x41')]!==_0x149f('0x42')){var _0x1701d2={};_0x1701d2[_0x41a1d3['name']]={'$like':'%'+_0x1f07f7['query'][_0x149f('0x3e')]+'%'};return _0x1701d2;}})});}_0x5e0a6b=_[_0x149f('0x40')]({},_0x5e0a6b,_0x1f07f7['options']);var _0x365b08={'where':_0x5e0a6b[_0x149f('0x3f')]};return db[_0x149f('0x2c')]['count'](_0x365b08)[_0x149f('0x23')](function(_0x56b30e){_0x1bbc84[_0x149f('0x1c')]=_0x56b30e;if(_0x1f07f7[_0x149f('0x32')][_0x149f('0x43')]){_0x5e0a6b[_0x149f('0x44')]=[{'all':!![]}];}return db[_0x149f('0x2c')][_0x149f('0x45')](_0x5e0a6b);})['then'](function(_0x2fab27){_0x1bbc84['rows']=_0x2fab27;return _0x1bbc84;})['then'](respondWithFilteredResult(_0xaacb1,_0x5e0a6b))[_0x149f('0x46')](handleError(_0xaacb1,null));};exports['show']=function(_0x2a82ff,_0x556aae){var _0x2e6976={'raw':!![],'where':{'id':_0x2a82ff[_0x149f('0x47')]['id']}},_0x5b677c={};_0x5b677c['model']=_[_0x149f('0x33')](db['CmContactHasPhone']['rawAttributes']);_0x5b677c[_0x149f('0x32')]=_['keys'](_0x2a82ff['query']);_0x5b677c[_0x149f('0x34')]=_[_0x149f('0x35')](_0x5b677c[_0x149f('0x30')],_0x5b677c[_0x149f('0x32')]);_0x2e6976[_0x149f('0x36')]=_['intersection'](_0x5b677c['model'],qs[_0x149f('0x37')](_0x2a82ff[_0x149f('0x32')]['fields']));_0x2e6976[_0x149f('0x36')]=_0x2e6976['attributes']['length']?_0x2e6976[_0x149f('0x36')]:_0x5b677c[_0x149f('0x30')];if(_0x2a82ff[_0x149f('0x32')]['includeAll']){_0x2e6976['include']=[{'all':!![]}];}_0x2e6976=_[_0x149f('0x40')]({},_0x2e6976,_0x2a82ff[_0x149f('0x48')]);return db[_0x149f('0x2c')][_0x149f('0x49')](_0x2e6976)[_0x149f('0x23')](handleEntityNotFound(_0x556aae,null))[_0x149f('0x23')](respondWithResult(_0x556aae,null))['catch'](handleError(_0x556aae,null));};exports[_0x149f('0x4a')]=function(_0x2c885d,_0x10136c){return db[_0x149f('0x2c')][_0x149f('0x4a')](_0x2c885d['body'],{})[_0x149f('0x23')](function(_0x345c3e){var _0x1cc724=_0x2c885d[_0x149f('0x4b')][_0x149f('0x24')]({'plain':!![]});if(!_0x1cc724)throw new Error(_0x149f('0x4c'));if(_0x1cc724['role']===_0x149f('0x4b')){var _0x1d9d96=_0x345c3e[_0x149f('0x24')]({'plain':!![]});var _0x241dac=_0x149f('0x25');return db[_0x149f('0x4d')][_0x149f('0x49')]({'where':{'name':_0x241dac,'userProfileId':_0x1cc724[_0x149f('0x4e')]},'raw':!![]})[_0x149f('0x23')](function(_0x52ade0){if(_0x52ade0&&_0x52ade0[_0x149f('0x4f')]===0x0){return db[_0x149f('0x26')][_0x149f('0x4a')]({'name':_0x1d9d96[_0x149f('0x29')],'resourceId':_0x1d9d96['id'],'type':_0x52ade0[_0x149f('0x29')],'sectionId':_0x52ade0['id']},{})['then'](function(){return _0x345c3e;});}else{return _0x345c3e;}})[_0x149f('0x46')](function(_0x17be69){logger[_0x149f('0x27')](_0x149f('0x50'),_0x17be69);throw _0x17be69;});}return _0x345c3e;})['then'](respondWithResult(_0x10136c,0xc9))[_0x149f('0x46')](handleError(_0x10136c,null));};exports[_0x149f('0x51')]=function(_0x3bc931,_0x3a80dd){if(_0x3bc931['body']['id']){delete _0x3bc931['body']['id'];}return db[_0x149f('0x2c')][_0x149f('0x49')]({'where':{'id':_0x3bc931['params']['id']}})[_0x149f('0x23')](handleEntityNotFound(_0x3a80dd,null))['then'](saveUpdates(_0x3bc931[_0x149f('0x52')],null))['then'](respondWithResult(_0x3a80dd,null))[_0x149f('0x46')](handleError(_0x3a80dd,null));};exports[_0x149f('0x22')]=function(_0x5e3d5c,_0x5c614c){return db[_0x149f('0x2c')][_0x149f('0x49')]({'where':{'id':_0x5e3d5c[_0x149f('0x47')]['id']}})[_0x149f('0x23')](handleEntityNotFound(_0x5c614c,null))[_0x149f('0x23')](removeEntity(_0x5c614c,null))[_0x149f('0x46')](handleError(_0x5c614c,null));}; \ No newline at end of file +var _0xb1b3=['options','includeAll','include','findAll','rows','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasPhones','UserProfileSection','userProfileId','autoAssociation','error','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','limit','set','apply','reject','then','get','UserProfileResource','destroy','end','stack','name','send','CmContactHasPhone','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','map'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xb1b3,0x15f));var _0x3b1b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb1b3[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x3b1b('0x0'));var emlformat=require(_0x3b1b('0x1'));var rimraf=require(_0x3b1b('0x2'));var zipdir=require(_0x3b1b('0x3'));var jsonpatch=require(_0x3b1b('0x4'));var rp=require(_0x3b1b('0x5'));var moment=require(_0x3b1b('0x6'));var BPromise=require(_0x3b1b('0x7'));var Mustache=require(_0x3b1b('0x8'));var util=require(_0x3b1b('0x9'));var path=require(_0x3b1b('0xa'));var sox=require(_0x3b1b('0xb'));var csv=require(_0x3b1b('0xc'));var ejs=require(_0x3b1b('0xd'));var fs=require('fs');var _=require(_0x3b1b('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3b1b('0xf'));var toCsv=require(_0x3b1b('0xc'));var querystring=require(_0x3b1b('0x10'));var Papa=require('papaparse');var Redis=require(_0x3b1b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3b1b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b1b('0x13'));var logger=require(_0x3b1b('0x14'))(_0x3b1b('0x15'));var utils=require(_0x3b1b('0x16'));var config=require(_0x3b1b('0x17'));var licenseUtil=require(_0x3b1b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3599ea,_0x441ebc){_0x441ebc=_0x441ebc||0xcc;return function(_0x380088){if(_0x380088){return _0x3599ea[_0x3b1b('0x19')](_0x441ebc);}return _0x3599ea[_0x3b1b('0x1a')](_0x441ebc)['end']();};}function respondWithResult(_0x33ace2,_0x515344){_0x515344=_0x515344||0xc8;return function(_0x352225){if(_0x352225){return _0x33ace2[_0x3b1b('0x1a')](_0x515344)[_0x3b1b('0x1b')](_0x352225);}};}function respondWithFilteredResult(_0x4094f4,_0x503ec7){return function(_0x438614){if(_0x438614){var _0x17bcd5=_0x438614[_0x3b1b('0x1c')],_0x3ce394=_0x503ec7['offset'],_0x50d954=_0x503ec7['offset']+_0x503ec7[_0x3b1b('0x1d')],_0x58041f;if(_0x50d954>=_0x17bcd5){_0x50d954=_0x17bcd5;_0x58041f=0xc8;}else{_0x58041f=0xce;}_0x4094f4['status'](_0x58041f);return _0x4094f4[_0x3b1b('0x1e')]('Content-Range',_0x3ce394+'-'+_0x50d954+'/'+_0x17bcd5)[_0x3b1b('0x1b')](_0x438614);}return null;};}function patchUpdates(_0x1649ad){return function(_0x33dd33){try{jsonpatch[_0x3b1b('0x1f')](_0x33dd33,_0x1649ad,!![]);}catch(_0x417692){return BPromise[_0x3b1b('0x20')](_0x417692);}return _0x33dd33['save']();};}function saveUpdates(_0x583e9e,_0x1c39c2){return function(_0xeef4da){if(_0xeef4da){return _0xeef4da['update'](_0x583e9e)[_0x3b1b('0x21')](function(_0x570240){return _0x570240;});}return null;};}function removeEntity(_0x19692d,_0x2824da){return function(_0x3a3aac){if(_0x3a3aac){return _0x3a3aac['destroy']()['then'](function(){var _0x53d65e=_0x3a3aac[_0x3b1b('0x22')]({'plain':!![]});var _0x43289a='CmContactHasPhones';return db[_0x3b1b('0x23')][_0x3b1b('0x24')]({'where':{'type':_0x43289a,'resourceId':_0x53d65e['id']}})[_0x3b1b('0x21')](function(){return _0x3a3aac;});})[_0x3b1b('0x21')](function(){_0x19692d[_0x3b1b('0x1a')](0xcc)[_0x3b1b('0x25')]();});}};}function handleEntityNotFound(_0x54067e,_0x330ab3){return function(_0x10472c){if(!_0x10472c){_0x54067e[_0x3b1b('0x19')](0x194);}return _0x10472c;};}function handleError(_0x25ae17,_0x3b7131){_0x3b7131=_0x3b7131||0x1f4;return function(_0xa5d4c2){logger['error'](_0xa5d4c2[_0x3b1b('0x26')]);if(_0xa5d4c2['name']){delete _0xa5d4c2[_0x3b1b('0x27')];}_0x25ae17[_0x3b1b('0x1a')](_0x3b7131)[_0x3b1b('0x28')](_0xa5d4c2);};}exports['index']=function(_0x2b1073,_0x9898f4){var _0x5d8150={},_0x53e9c4={},_0x469fc5={'count':0x0,'rows':[]};var _0x245c11=_['map'](db[_0x3b1b('0x29')][_0x3b1b('0x2a')],function(_0x25289f){return{'name':_0x25289f[_0x3b1b('0x2b')],'type':_0x25289f[_0x3b1b('0x2c')][_0x3b1b('0x2d')]};});_0x53e9c4[_0x3b1b('0x2e')]=_['map'](_0x245c11,_0x3b1b('0x27'));_0x53e9c4['query']=_[_0x3b1b('0x2f')](_0x2b1073[_0x3b1b('0x30')]);_0x53e9c4['filters']=_[_0x3b1b('0x31')](_0x53e9c4[_0x3b1b('0x2e')],_0x53e9c4[_0x3b1b('0x30')]);_0x5d8150[_0x3b1b('0x32')]=_[_0x3b1b('0x31')](_0x53e9c4[_0x3b1b('0x2e')],qs[_0x3b1b('0x33')](_0x2b1073[_0x3b1b('0x30')][_0x3b1b('0x33')]));_0x5d8150[_0x3b1b('0x32')]=_0x5d8150[_0x3b1b('0x32')][_0x3b1b('0x34')]?_0x5d8150[_0x3b1b('0x32')]:_0x53e9c4['model'];if(!_0x2b1073['query'][_0x3b1b('0x35')](_0x3b1b('0x36'))){_0x5d8150[_0x3b1b('0x1d')]=qs[_0x3b1b('0x1d')](_0x2b1073['query']['limit']);_0x5d8150[_0x3b1b('0x37')]=qs[_0x3b1b('0x37')](_0x2b1073[_0x3b1b('0x30')]['offset']);}_0x5d8150[_0x3b1b('0x38')]=qs[_0x3b1b('0x39')](_0x2b1073[_0x3b1b('0x30')][_0x3b1b('0x39')]);_0x5d8150[_0x3b1b('0x3a')]=qs[_0x3b1b('0x3b')](_[_0x3b1b('0x3c')](_0x2b1073[_0x3b1b('0x30')],_0x53e9c4[_0x3b1b('0x3b')]),_0x245c11);if(_0x2b1073[_0x3b1b('0x30')][_0x3b1b('0x3d')]){_0x5d8150[_0x3b1b('0x3a')]=_[_0x3b1b('0x3e')](_0x5d8150[_0x3b1b('0x3a')],{'$or':_[_0x3b1b('0x3f')](_0x245c11,function(_0x25b06a){if(_0x25b06a[_0x3b1b('0x2c')]!=='VIRTUAL'){var _0xf51fac={};_0xf51fac[_0x25b06a[_0x3b1b('0x27')]]={'$like':'%'+_0x2b1073[_0x3b1b('0x30')][_0x3b1b('0x3d')]+'%'};return _0xf51fac;}})});}_0x5d8150=_[_0x3b1b('0x3e')]({},_0x5d8150,_0x2b1073[_0x3b1b('0x40')]);var _0x48ce2d={'where':_0x5d8150[_0x3b1b('0x3a')]};return db['CmContactHasPhone'][_0x3b1b('0x1c')](_0x48ce2d)['then'](function(_0x36dbe8){_0x469fc5[_0x3b1b('0x1c')]=_0x36dbe8;if(_0x2b1073[_0x3b1b('0x30')][_0x3b1b('0x41')]){_0x5d8150[_0x3b1b('0x42')]=[{'all':!![]}];}return db[_0x3b1b('0x29')][_0x3b1b('0x43')](_0x5d8150);})[_0x3b1b('0x21')](function(_0x14a702){_0x469fc5[_0x3b1b('0x44')]=_0x14a702;return _0x469fc5;})[_0x3b1b('0x21')](respondWithFilteredResult(_0x9898f4,_0x5d8150))['catch'](handleError(_0x9898f4,null));};exports[_0x3b1b('0x45')]=function(_0x1c5c75,_0xdd1d24){var _0x18fb1e={'raw':!![],'where':{'id':_0x1c5c75['params']['id']}},_0x3b3ee6={};_0x3b3ee6[_0x3b1b('0x2e')]=_[_0x3b1b('0x2f')](db[_0x3b1b('0x29')]['rawAttributes']);_0x3b3ee6[_0x3b1b('0x30')]=_[_0x3b1b('0x2f')](_0x1c5c75[_0x3b1b('0x30')]);_0x3b3ee6[_0x3b1b('0x3b')]=_[_0x3b1b('0x31')](_0x3b3ee6[_0x3b1b('0x2e')],_0x3b3ee6[_0x3b1b('0x30')]);_0x18fb1e[_0x3b1b('0x32')]=_[_0x3b1b('0x31')](_0x3b3ee6[_0x3b1b('0x2e')],qs[_0x3b1b('0x33')](_0x1c5c75[_0x3b1b('0x30')][_0x3b1b('0x33')]));_0x18fb1e[_0x3b1b('0x32')]=_0x18fb1e['attributes'][_0x3b1b('0x34')]?_0x18fb1e[_0x3b1b('0x32')]:_0x3b3ee6[_0x3b1b('0x2e')];if(_0x1c5c75[_0x3b1b('0x30')][_0x3b1b('0x41')]){_0x18fb1e[_0x3b1b('0x42')]=[{'all':!![]}];}_0x18fb1e=_[_0x3b1b('0x3e')]({},_0x18fb1e,_0x1c5c75[_0x3b1b('0x40')]);return db[_0x3b1b('0x29')][_0x3b1b('0x46')](_0x18fb1e)['then'](handleEntityNotFound(_0xdd1d24,null))[_0x3b1b('0x21')](respondWithResult(_0xdd1d24,null))[_0x3b1b('0x47')](handleError(_0xdd1d24,null));};exports[_0x3b1b('0x48')]=function(_0x5e52a3,_0x3df2d0){return db['CmContactHasPhone'][_0x3b1b('0x48')](_0x5e52a3[_0x3b1b('0x49')],{})['then'](function(_0x5276c0){var _0x57b221=_0x5e52a3[_0x3b1b('0x4a')][_0x3b1b('0x22')]({'plain':!![]});if(!_0x57b221)throw new Error(_0x3b1b('0x4b'));if(_0x57b221['role']==='user'){var _0x121cad=_0x5276c0['get']({'plain':!![]});var _0xbf3fd5=_0x3b1b('0x4c');return db[_0x3b1b('0x4d')][_0x3b1b('0x46')]({'where':{'name':_0xbf3fd5,'userProfileId':_0x57b221[_0x3b1b('0x4e')]},'raw':!![]})[_0x3b1b('0x21')](function(_0x49439e){if(_0x49439e&&_0x49439e[_0x3b1b('0x4f')]===0x0){return db['UserProfileResource'][_0x3b1b('0x48')]({'name':_0x121cad[_0x3b1b('0x27')],'resourceId':_0x121cad['id'],'type':_0x49439e[_0x3b1b('0x27')],'sectionId':_0x49439e['id']},{})[_0x3b1b('0x21')](function(){return _0x5276c0;});}else{return _0x5276c0;}})['catch'](function(_0x11fe44){logger[_0x3b1b('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11fe44);throw _0x11fe44;});}return _0x5276c0;})['then'](respondWithResult(_0x3df2d0,0xc9))[_0x3b1b('0x47')](handleError(_0x3df2d0,null));};exports[_0x3b1b('0x51')]=function(_0x1f44b4,_0x76392f){if(_0x1f44b4[_0x3b1b('0x49')]['id']){delete _0x1f44b4[_0x3b1b('0x49')]['id'];}return db['CmContactHasPhone']['find']({'where':{'id':_0x1f44b4['params']['id']}})[_0x3b1b('0x21')](handleEntityNotFound(_0x76392f,null))[_0x3b1b('0x21')](saveUpdates(_0x1f44b4[_0x3b1b('0x49')],null))[_0x3b1b('0x21')](respondWithResult(_0x76392f,null))['catch'](handleError(_0x76392f,null));};exports['destroy']=function(_0xbe1f56,_0xdabee3){return db[_0x3b1b('0x29')]['find']({'where':{'id':_0xbe1f56[_0x3b1b('0x52')]['id']}})[_0x3b1b('0x21')](handleEntityNotFound(_0xdabee3,null))['then'](removeEntity(_0xdabee3,null))[_0x3b1b('0x47')](handleError(_0xdabee3,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index fab6ad4..28d7638 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 _0xa87e=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash'];(function(_0x34ae43,_0x3457dd){var _0x34bffa=function(_0x16dc97){while(--_0x16dc97){_0x34ae43['push'](_0x34ae43['shift']());}};_0x34bffa(++_0x3457dd);}(_0xa87e,0x185));var _0xea87=function(_0x29cf64,_0x517ed7){_0x29cf64=_0x29cf64-0x0;var _0x5c4cd3=_0xa87e[_0x29cf64];return _0x5c4cd3;};'use strict';var _=require(_0xea87('0x0'));var util=require(_0xea87('0x1'));var logger=require(_0xea87('0x2'))('api');var moment=require(_0xea87('0x3'));var BPromise=require(_0xea87('0x4'));var rp=require(_0xea87('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea87('0x6'));var config=require(_0xea87('0x7'));var attributes=require(_0xea87('0x8'));module[_0xea87('0x9')]=function(_0x1f8b35,_0x4dcd28){return _0x1f8b35[_0xea87('0xa')](_0xea87('0xb'),attributes,{'tableName':_0xea87('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc665=['moment','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','define','cm_contact_has_phones','util','../../config/logger'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0xc665,0x1ac));var _0x5c66=function(_0x136365,_0x206b1d){_0x136365=_0x136365-0x0;var _0x2d2152=_0xc665[_0x136365];return _0x2d2152;};'use strict';var _=require('lodash');var util=require(_0x5c66('0x0'));var logger=require(_0x5c66('0x1'))('api');var moment=require(_0x5c66('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c66('0x3'));var rimraf=require(_0x5c66('0x4'));var config=require(_0x5c66('0x5'));var attributes=require(_0x5c66('0x6'));module[_0x5c66('0x7')]=function(_0x21b5ed,_0x4b3fd6){return _0x21b5ed[_0x5c66('0x8')]('CmContactHasPhone',attributes,{'tableName':_0x5c66('0x9'),'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 9a80bbb..ab3605b 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 _0xe398=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','CmContactHasPhone,\x20%s,\x20%s'];(function(_0x64de5f,_0x581672){var _0x30e076=function(_0x42f727){while(--_0x42f727){_0x64de5f['push'](_0x64de5f['shift']());}};_0x30e076(++_0x581672);}(_0xe398,0x1eb));var _0x8e39=function(_0x2b2f0a,_0x3279e2){_0x2b2f0a=_0x2b2f0a-0x0;var _0x405abb=_0xe398[_0x2b2f0a];return _0x405abb;};'use strict';var _=require(_0x8e39('0x0'));var util=require(_0x8e39('0x1'));var moment=require(_0x8e39('0x2'));var BPromise=require(_0x8e39('0x3'));var rs=require(_0x8e39('0x4'));var fs=require('fs');var Redis=require(_0x8e39('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e39('0x6'));var logger=require('../../config/logger')(_0x8e39('0x7'));var config=require(_0x8e39('0x8'));var jayson=require(_0x8e39('0x9'));var client=jayson[_0x8e39('0xa')][_0x8e39('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b7153,_0x3bd2e5,_0x30be28){return new BPromise(function(_0x417165,_0x4031b7){return client['request'](_0x4b7153,_0x30be28)[_0x8e39('0xc')](function(_0x22c499){logger[_0x8e39('0xd')](_0x8e39('0xe'),_0x3bd2e5,_0x8e39('0xf'));logger[_0x8e39('0x10')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x3bd2e5,'request\x20sent',JSON[_0x8e39('0x11')](_0x22c499));if(_0x22c499[_0x8e39('0x12')]){if(_0x22c499[_0x8e39('0x12')]['code']===0x1f4){logger[_0x8e39('0x12')](_0x8e39('0xe'),_0x3bd2e5,_0x22c499[_0x8e39('0x12')][_0x8e39('0x13')]);return _0x4031b7(_0x22c499[_0x8e39('0x12')][_0x8e39('0x13')]);}logger[_0x8e39('0x12')]('CmContactHasPhone,\x20%s,\x20%s',_0x3bd2e5,_0x22c499[_0x8e39('0x12')][_0x8e39('0x13')]);return _0x417165(_0x22c499['error'][_0x8e39('0x13')]);}else{logger[_0x8e39('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x3bd2e5,_0x8e39('0xf'));_0x417165(_0x22c499[_0x8e39('0x14')]['message']);}})[_0x8e39('0x15')](function(_0x51066b){logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x3bd2e5,_0x51066b);_0x4031b7(_0x51066b);});});} \ No newline at end of file +var _0x951c=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasPhone,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2c046a,_0x1f04a8){var _0x10e137=function(_0x1b0be6){while(--_0x1b0be6){_0x2c046a['push'](_0x2c046a['shift']());}};_0x10e137(++_0x1f04a8);}(_0x951c,0x192));var _0xc951=function(_0x520945,_0x30210b){_0x520945=_0x520945-0x0;var _0x231d6d=_0x951c[_0x520945];return _0x231d6d;};'use strict';var _=require('lodash');var util=require(_0xc951('0x0'));var moment=require(_0xc951('0x1'));var BPromise=require(_0xc951('0x2'));var rs=require(_0xc951('0x3'));var fs=require('fs');var Redis=require(_0xc951('0x4'));var db=require(_0xc951('0x5'))['db'];var utils=require(_0xc951('0x6'));var logger=require(_0xc951('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc951('0x8'));var client=jayson[_0xc951('0x9')][_0xc951('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7687ca,_0x1c0cb5,_0x101ff1){return new BPromise(function(_0x20aee2,_0x169557){return client[_0xc951('0xb')](_0x7687ca,_0x101ff1)[_0xc951('0xc')](function(_0x2c6231){logger[_0xc951('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x1c0cb5,_0xc951('0xe'));logger[_0xc951('0xf')](_0xc951('0x10'),_0x1c0cb5,'request\x20sent',JSON[_0xc951('0x11')](_0x2c6231));if(_0x2c6231[_0xc951('0x12')]){if(_0x2c6231[_0xc951('0x12')][_0xc951('0x13')]===0x1f4){logger[_0xc951('0x12')](_0xc951('0x14'),_0x1c0cb5,_0x2c6231[_0xc951('0x12')][_0xc951('0x15')]);return _0x169557(_0x2c6231[_0xc951('0x12')]['message']);}logger[_0xc951('0x12')](_0xc951('0x14'),_0x1c0cb5,_0x2c6231[_0xc951('0x12')]['message']);return _0x20aee2(_0x2c6231['error'][_0xc951('0x15')]);}else{logger[_0xc951('0xd')](_0xc951('0x14'),_0x1c0cb5,'request\x20sent');_0x20aee2(_0x2c6231[_0xc951('0x16')][_0xc951('0x15')]);}})[_0xc951('0x17')](function(_0x247892){logger[_0xc951('0x12')](_0xc951('0x14'),_0x1c0cb5,_0x247892);_0x169557(_0x247892);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index a166d18..19f6837 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 _0xac65=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xac65,0x149));var _0x5ac6=function(_0x14b495,_0x5d1d61){_0x14b495=_0x14b495-0x0;var _0x317dde=_0xac65[_0x14b495];return _0x317dde;};'use strict';var multer=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var path=require(_0x5ac6('0x2'));var timeout=require(_0x5ac6('0x3'));var express=require(_0x5ac6('0x4'));var router=express['Router']();var auth=require(_0x5ac6('0x5'));var interaction=require(_0x5ac6('0x6'));var config=require(_0x5ac6('0x7'));var controller=require(_0x5ac6('0x8'));router[_0x5ac6('0x9')]('/',auth[_0x5ac6('0xa')](),controller[_0x5ac6('0xb')]);router['get'](_0x5ac6('0xc'),auth[_0x5ac6('0xa')](),controller['show']);router[_0x5ac6('0xd')]('/',auth[_0x5ac6('0xa')](),controller[_0x5ac6('0xe')]);router[_0x5ac6('0xf')](_0x5ac6('0xc'),auth[_0x5ac6('0xa')](),controller[_0x5ac6('0x10')]);router[_0x5ac6('0x11')](_0x5ac6('0xc'),auth[_0x5ac6('0xa')](),controller['destroy']);module[_0x5ac6('0x12')]=router; \ No newline at end of file +var _0xc1c7=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','post','put','/:id','delete'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc1c7,0x1e0));var _0x7c1c=function(_0x34c45b,_0x457b7f){_0x34c45b=_0x34c45b-0x0;var _0x1ef1b4=_0xc1c7[_0x34c45b];return _0x1ef1b4;};'use strict';var multer=require('multer');var util=require(_0x7c1c('0x0'));var path=require(_0x7c1c('0x1'));var timeout=require(_0x7c1c('0x2'));var express=require(_0x7c1c('0x3'));var router=express[_0x7c1c('0x4')]();var auth=require(_0x7c1c('0x5'));var interaction=require(_0x7c1c('0x6'));var config=require(_0x7c1c('0x7'));var controller=require(_0x7c1c('0x8'));router[_0x7c1c('0x9')]('/',auth[_0x7c1c('0xa')](),controller[_0x7c1c('0xb')]);router[_0x7c1c('0x9')]('/:id',auth[_0x7c1c('0xa')](),controller['show']);router[_0x7c1c('0xc')]('/',auth[_0x7c1c('0xa')](),controller['create']);router[_0x7c1c('0xd')](_0x7c1c('0xe'),auth[_0x7c1c('0xa')](),controller['update']);router[_0x7c1c('0xf')](_0x7c1c('0xe'),auth['isAuthenticated'](),controller['destroy']);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 4abb225..c5e9c9d 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 _0xb717=['voice','sequelize','exports','getDataValue','alias','setDataValue','name','TEXT','long','type','select','values','isArray','BOOLEAN','ENUM'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb717,0x1b4));var _0x7b71=function(_0x43b7bf,_0x1c3b3e){_0x43b7bf=_0x43b7bf-0x0;var _0x378c79=_0xb717[_0x43b7bf];return _0x378c79;};'use strict';var Sequelize=require(_0x7b71('0x0'));var _=require('lodash');module[_0x7b71('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x42a694){return this[_0x7b71('0x2')](_0x7b71('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x238319){this[_0x7b71('0x4')](_0x7b71('0x3'),_0x238319?_0x238319:this[_0x7b71('0x2')](_0x7b71('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x7b71('0x6')](_0x7b71('0x7')),'get':function(){if(this[_0x7b71('0x2')](_0x7b71('0x8'))===_0x7b71('0x9')){return JSON['parse'](this[_0x7b71('0x2')](_0x7b71('0xa')));}else{return this['getDataValue'](_0x7b71('0xa'));}},'set':function(_0x45bbcd){if(Array[_0x7b71('0xb')](_0x45bbcd)){this['setDataValue'](_0x7b71('0xa'),JSON['stringify'](_0x45bbcd));}else{this[_0x7b71('0x4')]('values',_0x45bbcd);}}},'required':{'type':Sequelize[_0x7b71('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7b71('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7b71('0xd')](_0x7b71('0xe'))}}; \ No newline at end of file +var _0x4f17=['stringify','values','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','type','select','isArray'];(function(_0x52b655,_0x5132ac){var _0x4185fc=function(_0x19b9e2){while(--_0x19b9e2){_0x52b655['push'](_0x52b655['shift']());}};_0x4185fc(++_0x5132ac);}(_0x4f17,0x9e));var _0x74f1=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x4f17[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x74f1('0x0'));var _=require('lodash');module[_0x74f1('0x1')]={'name':{'type':Sequelize[_0x74f1('0x2')],'get':function(_0x589695){return this[_0x74f1('0x3')](_0x74f1('0x4'));}},'alias':{'type':Sequelize[_0x74f1('0x5')],'allowNull':![],'set':function(_0x62251d){this[_0x74f1('0x6')]('alias',_0x62251d?_0x62251d:this['getDataValue'](_0x74f1('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x74f1('0x8')]('long'),'get':function(){if(this[_0x74f1('0x3')](_0x74f1('0x9'))===_0x74f1('0xa')){return JSON['parse'](this[_0x74f1('0x3')]('values'));}else{return this[_0x74f1('0x3')]('values');}},'set':function(_0x1b116c){if(Array[_0x74f1('0xb')](_0x1b116c)){this['setDataValue']('values',JSON[_0x74f1('0xc')](_0x1b116c));}else{this[_0x74f1('0x6')](_0x74f1('0xd'),_0x1b116c);}}},'required':{'type':Sequelize[_0x74f1('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x74f1('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x74f1('0xf')](_0x74f1('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index da7b934..c35f1bc 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 _0x8758=['sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','destroy','then','error','name','index','map','CmCustomField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','update','body','find','create','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','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','../../config/license/util','../../mysqldb'];(function(_0x4ae6ec,_0x45f01c){var _0x1fdad0=function(_0x4972ed){while(--_0x4972ed){_0x4ae6ec['push'](_0x4ae6ec['shift']());}};_0x1fdad0(++_0x45f01c);}(_0x8758,0x19b));var _0x8875=function(_0x39c9a7,_0x4ef8b5){_0x39c9a7=_0x39c9a7-0x0;var _0x199a9e=_0x8758[_0x39c9a7];return _0x199a9e;};'use strict';var pdf=require(_0x8875('0x0'));var emlformat=require(_0x8875('0x1'));var rimraf=require(_0x8875('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8875('0x3'));var rp=require(_0x8875('0x4'));var moment=require(_0x8875('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8875('0x6'));var util=require(_0x8875('0x7'));var path=require(_0x8875('0x8'));var sox=require(_0x8875('0x9'));var csv=require(_0x8875('0xa'));var ejs=require(_0x8875('0xb'));var fs=require('fs');var _=require(_0x8875('0xc'));var squel=require(_0x8875('0xd'));var crypto=require(_0x8875('0xe'));var jsforce=require(_0x8875('0xf'));var deskjs=require(_0x8875('0x10'));var toCsv=require(_0x8875('0xa'));var querystring=require(_0x8875('0x11'));var Papa=require(_0x8875('0x12'));var Redis=require(_0x8875('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8875('0x14'));var as=require(_0x8875('0x15'));var hardwareService=require(_0x8875('0x16'));var logger=require(_0x8875('0x17'))(_0x8875('0x18'));var utils=require(_0x8875('0x19'));var config=require(_0x8875('0x1a'));var licenseUtil=require(_0x8875('0x1b'));var db=require(_0x8875('0x1c'))['db'];function respondWithStatusCode(_0x2f04b6,_0x51e725){_0x51e725=_0x51e725||0xcc;return function(_0x1aa0c2){if(_0x1aa0c2){return _0x2f04b6[_0x8875('0x1d')](_0x51e725);}return _0x2f04b6[_0x8875('0x1e')](_0x51e725)[_0x8875('0x1f')]();};}function respondWithResult(_0x171c45,_0x19e04d){_0x19e04d=_0x19e04d||0xc8;return function(_0x40dcbf){if(_0x40dcbf){return _0x171c45[_0x8875('0x1e')](_0x19e04d)[_0x8875('0x20')](_0x40dcbf);}};}function respondWithFilteredResult(_0x1bf956,_0x41008d){return function(_0x2d196e){if(_0x2d196e){var _0x523027=_0x2d196e[_0x8875('0x21')],_0x48136c=_0x41008d[_0x8875('0x22')],_0x238982=_0x41008d[_0x8875('0x22')]+_0x41008d[_0x8875('0x23')],_0xd0e1e3;if(_0x238982>=_0x523027){_0x238982=_0x523027;_0xd0e1e3=0xc8;}else{_0xd0e1e3=0xce;}_0x1bf956[_0x8875('0x1e')](_0xd0e1e3);return _0x1bf956['set'](_0x8875('0x24'),_0x48136c+'-'+_0x238982+'/'+_0x523027)['json'](_0x2d196e);}return null;};}function patchUpdates(_0x2dc486){return function(_0x4ee213){try{jsonpatch['apply'](_0x4ee213,_0x2dc486,!![]);}catch(_0x1cc764){return BPromise[_0x8875('0x25')](_0x1cc764);}return _0x4ee213[_0x8875('0x26')]();};}function saveUpdates(_0x33be41,_0x1972ff){return function(_0x54741b){if(_0x54741b){return _0x54741b['update'](_0x33be41)['then'](function(_0x6e4110){return _0x6e4110;});}return null;};}function removeEntity(_0x56f6cf,_0x3b1f44){return function(_0x42da2d){if(_0x42da2d){return _0x42da2d[_0x8875('0x27')]()[_0x8875('0x28')](function(){_0x56f6cf['status'](0xcc)[_0x8875('0x1f')]();});}};}function handleEntityNotFound(_0x5f2e62,_0x29d3e4){return function(_0xc9a2dd){if(!_0xc9a2dd){_0x5f2e62[_0x8875('0x1d')](0x194);}return _0xc9a2dd;};}function handleError(_0x83c468,_0x553880){_0x553880=_0x553880||0x1f4;return function(_0x25d40d){logger[_0x8875('0x29')](_0x25d40d['stack']);if(_0x25d40d[_0x8875('0x2a')]){delete _0x25d40d[_0x8875('0x2a')];}_0x83c468[_0x8875('0x1e')](_0x553880)['send'](_0x25d40d);};}exports[_0x8875('0x2b')]=function(_0x4721c0,_0xca1906){var _0x1030c9={},_0x26d7ea={},_0x207c02={'count':0x0,'rows':[]};var _0x1ba956=_[_0x8875('0x2c')](db[_0x8875('0x2d')][_0x8875('0x2e')],function(_0x539ba8){return{'name':_0x539ba8['fieldName'],'type':_0x539ba8[_0x8875('0x2f')][_0x8875('0x30')]};});_0x26d7ea[_0x8875('0x31')]=_['differenceBy'](_['map'](_0x1ba956,_0x8875('0x2a')),['name']);_0x26d7ea[_0x8875('0x32')]=_[_0x8875('0x33')](_0x4721c0[_0x8875('0x32')]);_0x26d7ea[_0x8875('0x34')]=_[_0x8875('0x35')](_0x26d7ea[_0x8875('0x31')],_0x26d7ea[_0x8875('0x32')]);_0x1030c9['attributes']=_[_0x8875('0x35')](_0x26d7ea[_0x8875('0x31')],qs[_0x8875('0x36')](_0x4721c0['query']['fields']));_0x1030c9[_0x8875('0x37')]=_0x1030c9[_0x8875('0x37')][_0x8875('0x38')]?_0x1030c9[_0x8875('0x37')]:_0x26d7ea[_0x8875('0x31')];if(!_0x4721c0[_0x8875('0x32')][_0x8875('0x39')]('nolimit')){_0x1030c9[_0x8875('0x23')]=qs[_0x8875('0x23')](_0x4721c0[_0x8875('0x32')][_0x8875('0x23')]);_0x1030c9[_0x8875('0x22')]=qs[_0x8875('0x22')](_0x4721c0[_0x8875('0x32')][_0x8875('0x22')]);}_0x1030c9[_0x8875('0x3a')]=qs[_0x8875('0x3b')](_0x4721c0[_0x8875('0x32')][_0x8875('0x3b')]);_0x1030c9['where']=qs[_0x8875('0x34')](_[_0x8875('0x3c')](_0x4721c0[_0x8875('0x32')],_0x26d7ea['filters']),_0x1ba956);if(_0x4721c0[_0x8875('0x32')]['filter']){_0x1030c9[_0x8875('0x3d')]=_[_0x8875('0x3e')](_0x1030c9[_0x8875('0x3d')],{'$or':_[_0x8875('0x2c')](_0x1ba956,function(_0x519e0c){if(_0x519e0c[_0x8875('0x2f')]!==_0x8875('0x3f')){var _0x7b20fc={};_0x7b20fc[_0x519e0c[_0x8875('0x2a')]]={'$like':'%'+_0x4721c0['query']['filter']+'%'};return _0x7b20fc;}})});}_0x1030c9=_[_0x8875('0x3e')]({},_0x1030c9,_0x4721c0[_0x8875('0x40')]);var _0x2c78ed={'where':_0x1030c9[_0x8875('0x3d')]};return db[_0x8875('0x2d')]['count'](_0x2c78ed)['then'](function(_0x365ad9){_0x207c02[_0x8875('0x21')]=_0x365ad9;if(_0x4721c0['query']['includeAll']){_0x1030c9[_0x8875('0x41')]=[{'all':!![]}];}return db[_0x8875('0x2d')][_0x8875('0x42')](_0x1030c9);})[_0x8875('0x28')](function(_0x4d15f5){_0x207c02[_0x8875('0x43')]=_0x4d15f5;return _0x207c02;})['then'](respondWithFilteredResult(_0xca1906,_0x1030c9))[_0x8875('0x44')](handleError(_0xca1906,null));};exports[_0x8875('0x45')]=function(_0x8d1f21,_0x494b86){var _0x4445fb={'raw':!![],'where':{'id':_0x8d1f21[_0x8875('0x46')]['id']}},_0x3bb0f1={};_0x3bb0f1[_0x8875('0x31')]=_[_0x8875('0x33')](db[_0x8875('0x2d')][_0x8875('0x2e')]);_0x3bb0f1[_0x8875('0x32')]=_['keys'](_0x8d1f21[_0x8875('0x32')]);_0x3bb0f1['filters']=_[_0x8875('0x35')](_0x3bb0f1[_0x8875('0x31')],_0x3bb0f1['query']);_0x4445fb[_0x8875('0x37')]=_[_0x8875('0x35')](_0x3bb0f1['model'],qs['fields'](_0x8d1f21['query'][_0x8875('0x36')]));_0x4445fb[_0x8875('0x37')]=_0x4445fb[_0x8875('0x37')][_0x8875('0x38')]?_0x4445fb[_0x8875('0x37')]:_0x3bb0f1['model'];if(_0x8d1f21[_0x8875('0x32')][_0x8875('0x47')]){_0x4445fb[_0x8875('0x41')]=[{'all':!![]}];}_0x4445fb=_[_0x8875('0x3e')]({},_0x4445fb,_0x8d1f21[_0x8875('0x40')]);return db[_0x8875('0x2d')]['find'](_0x4445fb)[_0x8875('0x28')](handleEntityNotFound(_0x494b86,null))[_0x8875('0x28')](respondWithResult(_0x494b86,null))[_0x8875('0x44')](handleError(_0x494b86,null));};exports[_0x8875('0x48')]=function(_0x45cb5d,_0x8d42e){if(_0x45cb5d[_0x8875('0x49')]['id']){delete _0x45cb5d[_0x8875('0x49')]['id'];}return db[_0x8875('0x2d')][_0x8875('0x4a')]({'where':{'id':_0x45cb5d[_0x8875('0x46')]['id']}})[_0x8875('0x28')](handleEntityNotFound(_0x8d42e,null))[_0x8875('0x28')](saveUpdates(_0x45cb5d[_0x8875('0x49')],null))[_0x8875('0x28')](respondWithResult(_0x8d42e,null))[_0x8875('0x44')](handleError(_0x8d42e,null));};exports[_0x8875('0x27')]=function(_0x3757a1,_0x1c8745){return db[_0x8875('0x2d')][_0x8875('0x4a')]({'where':{'id':_0x3757a1[_0x8875('0x46')]['id']}})[_0x8875('0x28')](handleEntityNotFound(_0x1c8745,null))[_0x8875('0x28')](removeEntity(_0x1c8745,null))[_0x8875('0x44')](handleError(_0x1c8745,null));};exports[_0x8875('0x4b')]=function(_0x35cb0d,_0x8a0fd6){var _0x53eadb;return db['sequelize']['transaction'](function(_0x401924){return db['CmCustomField'][_0x8875('0x4b')](_0x35cb0d[_0x8875('0x49')],{'transaction':_0x401924})['then'](function(_0x8ea362){_0x53eadb=_0x8ea362;var _0x31cf96={'type':db[_0x8875('0x4c')][_0x8875('0x4d')],'transaction':_0x401924};switch(_0x35cb0d['body']['type']){case'text':_0x31cf96[_0x8875('0x2f')]=db[_0x8875('0x4c')]['TEXT'];break;case _0x8875('0x4e'):_0x31cf96[_0x8875('0x2f')]=db[_0x8875('0x4c')][_0x8875('0x4f')];break;case _0x8875('0x50'):_0x31cf96[_0x8875('0x2f')]=db[_0x8875('0x4c')][_0x8875('0x51')];_0x31cf96[_0x8875('0x52')]=![];break;default:}return db[_0x8875('0x53')][_0x8875('0x54')][_0x8875('0x55')](_0x8875('0x56'),util['format'](_0x8875('0x57'),_0x53eadb['id']),_0x31cf96);})[_0x8875('0x28')](function(){return _0x53eadb;});})[_0x8875('0x28')](respondWithResult(_0x8a0fd6,0xc9))[_0x8875('0x44')](handleError(_0x8a0fd6,null));}; \ No newline at end of file +var _0x7ad9=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','find','body','params','create','sequelize','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','cm_contacts','cf_%d','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../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','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x1852df,_0x29f56d){var _0x132275=function(_0x4f59e8){while(--_0x4f59e8){_0x1852df['push'](_0x1852df['shift']());}};_0x132275(++_0x29f56d);}(_0x7ad9,0x16f));var _0x97ad=function(_0x20bef8,_0x534296){_0x20bef8=_0x20bef8-0x0;var _0x1e6a10=_0x7ad9[_0x20bef8];return _0x1e6a10;};'use strict';var pdf=require(_0x97ad('0x0'));var emlformat=require(_0x97ad('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x97ad('0x2'));var jsonpatch=require(_0x97ad('0x3'));var rp=require(_0x97ad('0x4'));var moment=require(_0x97ad('0x5'));var BPromise=require(_0x97ad('0x6'));var Mustache=require('mustache');var util=require(_0x97ad('0x7'));var path=require(_0x97ad('0x8'));var sox=require('sox');var csv=require(_0x97ad('0x9'));var ejs=require(_0x97ad('0xa'));var fs=require('fs');var _=require(_0x97ad('0xb'));var squel=require(_0x97ad('0xc'));var crypto=require('crypto');var jsforce=require(_0x97ad('0xd'));var deskjs=require(_0x97ad('0xe'));var toCsv=require(_0x97ad('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x97ad('0xf'));var authService=require(_0x97ad('0x10'));var qs=require(_0x97ad('0x11'));var as=require(_0x97ad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97ad('0x13'))(_0x97ad('0x14'));var utils=require(_0x97ad('0x15'));var config=require(_0x97ad('0x16'));var licenseUtil=require(_0x97ad('0x17'));var db=require(_0x97ad('0x18'))['db'];function respondWithStatusCode(_0x107bdc,_0x2686a9){_0x2686a9=_0x2686a9||0xcc;return function(_0x5a1717){if(_0x5a1717){return _0x107bdc[_0x97ad('0x19')](_0x2686a9);}return _0x107bdc[_0x97ad('0x1a')](_0x2686a9)[_0x97ad('0x1b')]();};}function respondWithResult(_0x87f037,_0x2c3ec0){_0x2c3ec0=_0x2c3ec0||0xc8;return function(_0x216806){if(_0x216806){return _0x87f037[_0x97ad('0x1a')](_0x2c3ec0)[_0x97ad('0x1c')](_0x216806);}};}function respondWithFilteredResult(_0x34847d,_0x247c9e){return function(_0x464c12){if(_0x464c12){var _0x18dc12=_0x464c12[_0x97ad('0x1d')],_0x5c0d37=_0x247c9e[_0x97ad('0x1e')],_0x15f836=_0x247c9e[_0x97ad('0x1e')]+_0x247c9e[_0x97ad('0x1f')],_0x5e3b36;if(_0x15f836>=_0x18dc12){_0x15f836=_0x18dc12;_0x5e3b36=0xc8;}else{_0x5e3b36=0xce;}_0x34847d[_0x97ad('0x1a')](_0x5e3b36);return _0x34847d[_0x97ad('0x20')](_0x97ad('0x21'),_0x5c0d37+'-'+_0x15f836+'/'+_0x18dc12)[_0x97ad('0x1c')](_0x464c12);}return null;};}function patchUpdates(_0x123a02){return function(_0x4023a8){try{jsonpatch['apply'](_0x4023a8,_0x123a02,!![]);}catch(_0x12f32f){return BPromise[_0x97ad('0x22')](_0x12f32f);}return _0x4023a8[_0x97ad('0x23')]();};}function saveUpdates(_0x8aefae,_0x56fcf5){return function(_0xa6d8c1){if(_0xa6d8c1){return _0xa6d8c1[_0x97ad('0x24')](_0x8aefae)[_0x97ad('0x25')](function(_0x50bf85){return _0x50bf85;});}return null;};}function removeEntity(_0x404cc3,_0xbad85e){return function(_0x2b05c7){if(_0x2b05c7){return _0x2b05c7[_0x97ad('0x26')]()[_0x97ad('0x25')](function(){_0x404cc3['status'](0xcc)[_0x97ad('0x1b')]();});}};}function handleEntityNotFound(_0x2e7549,_0xb77139){return function(_0x10f4ed){if(!_0x10f4ed){_0x2e7549[_0x97ad('0x19')](0x194);}return _0x10f4ed;};}function handleError(_0x2ba0d7,_0x55f661){_0x55f661=_0x55f661||0x1f4;return function(_0x211016){logger['error'](_0x211016[_0x97ad('0x27')]);if(_0x211016[_0x97ad('0x28')]){delete _0x211016[_0x97ad('0x28')];}_0x2ba0d7[_0x97ad('0x1a')](_0x55f661)[_0x97ad('0x29')](_0x211016);};}exports[_0x97ad('0x2a')]=function(_0x121601,_0x149524){var _0x1c7cbc={},_0xae45b={},_0x4b8d52={'count':0x0,'rows':[]};var _0x4a61a7=_['map'](db[_0x97ad('0x2b')][_0x97ad('0x2c')],function(_0x19b3dd){return{'name':_0x19b3dd[_0x97ad('0x2d')],'type':_0x19b3dd[_0x97ad('0x2e')][_0x97ad('0x2f')]};});_0xae45b[_0x97ad('0x30')]=_['differenceBy'](_[_0x97ad('0x31')](_0x4a61a7,'name'),[_0x97ad('0x28')]);_0xae45b[_0x97ad('0x32')]=_[_0x97ad('0x33')](_0x121601[_0x97ad('0x32')]);_0xae45b['filters']=_[_0x97ad('0x34')](_0xae45b[_0x97ad('0x30')],_0xae45b[_0x97ad('0x32')]);_0x1c7cbc[_0x97ad('0x35')]=_[_0x97ad('0x34')](_0xae45b[_0x97ad('0x30')],qs[_0x97ad('0x36')](_0x121601[_0x97ad('0x32')][_0x97ad('0x36')]));_0x1c7cbc[_0x97ad('0x35')]=_0x1c7cbc['attributes'][_0x97ad('0x37')]?_0x1c7cbc[_0x97ad('0x35')]:_0xae45b['model'];if(!_0x121601[_0x97ad('0x32')][_0x97ad('0x38')](_0x97ad('0x39'))){_0x1c7cbc[_0x97ad('0x1f')]=qs['limit'](_0x121601[_0x97ad('0x32')][_0x97ad('0x1f')]);_0x1c7cbc[_0x97ad('0x1e')]=qs['offset'](_0x121601[_0x97ad('0x32')][_0x97ad('0x1e')]);}_0x1c7cbc[_0x97ad('0x3a')]=qs[_0x97ad('0x3b')](_0x121601['query'][_0x97ad('0x3b')]);_0x1c7cbc[_0x97ad('0x3c')]=qs[_0x97ad('0x3d')](_[_0x97ad('0x3e')](_0x121601[_0x97ad('0x32')],_0xae45b['filters']),_0x4a61a7);if(_0x121601[_0x97ad('0x32')][_0x97ad('0x3f')]){_0x1c7cbc[_0x97ad('0x3c')]=_[_0x97ad('0x40')](_0x1c7cbc[_0x97ad('0x3c')],{'$or':_[_0x97ad('0x31')](_0x4a61a7,function(_0x1f0b8e){if(_0x1f0b8e[_0x97ad('0x2e')]!==_0x97ad('0x41')){var _0x279a50={};_0x279a50[_0x1f0b8e['name']]={'$like':'%'+_0x121601[_0x97ad('0x32')]['filter']+'%'};return _0x279a50;}})});}_0x1c7cbc=_[_0x97ad('0x40')]({},_0x1c7cbc,_0x121601[_0x97ad('0x42')]);var _0x366e2e={'where':_0x1c7cbc['where']};return db[_0x97ad('0x2b')][_0x97ad('0x1d')](_0x366e2e)[_0x97ad('0x25')](function(_0x10348c){_0x4b8d52[_0x97ad('0x1d')]=_0x10348c;if(_0x121601[_0x97ad('0x32')][_0x97ad('0x43')]){_0x1c7cbc[_0x97ad('0x44')]=[{'all':!![]}];}return db[_0x97ad('0x2b')][_0x97ad('0x45')](_0x1c7cbc);})[_0x97ad('0x25')](function(_0x547c86){_0x4b8d52['rows']=_0x547c86;return _0x4b8d52;})[_0x97ad('0x25')](respondWithFilteredResult(_0x149524,_0x1c7cbc))[_0x97ad('0x46')](handleError(_0x149524,null));};exports['show']=function(_0x39f531,_0xdd71d8){var _0x1952b6={'raw':!![],'where':{'id':_0x39f531['params']['id']}},_0x416d17={};_0x416d17[_0x97ad('0x30')]=_[_0x97ad('0x33')](db['CmCustomField']['rawAttributes']);_0x416d17['query']=_['keys'](_0x39f531[_0x97ad('0x32')]);_0x416d17[_0x97ad('0x3d')]=_[_0x97ad('0x34')](_0x416d17['model'],_0x416d17[_0x97ad('0x32')]);_0x1952b6[_0x97ad('0x35')]=_[_0x97ad('0x34')](_0x416d17[_0x97ad('0x30')],qs[_0x97ad('0x36')](_0x39f531[_0x97ad('0x32')][_0x97ad('0x36')]));_0x1952b6[_0x97ad('0x35')]=_0x1952b6[_0x97ad('0x35')][_0x97ad('0x37')]?_0x1952b6[_0x97ad('0x35')]:_0x416d17[_0x97ad('0x30')];if(_0x39f531[_0x97ad('0x32')][_0x97ad('0x43')]){_0x1952b6[_0x97ad('0x44')]=[{'all':!![]}];}_0x1952b6=_[_0x97ad('0x40')]({},_0x1952b6,_0x39f531[_0x97ad('0x42')]);return db[_0x97ad('0x2b')][_0x97ad('0x47')](_0x1952b6)['then'](handleEntityNotFound(_0xdd71d8,null))[_0x97ad('0x25')](respondWithResult(_0xdd71d8,null))[_0x97ad('0x46')](handleError(_0xdd71d8,null));};exports['update']=function(_0x1c132b,_0x376539){if(_0x1c132b[_0x97ad('0x48')]['id']){delete _0x1c132b[_0x97ad('0x48')]['id'];}return db[_0x97ad('0x2b')][_0x97ad('0x47')]({'where':{'id':_0x1c132b[_0x97ad('0x49')]['id']}})[_0x97ad('0x25')](handleEntityNotFound(_0x376539,null))['then'](saveUpdates(_0x1c132b[_0x97ad('0x48')],null))[_0x97ad('0x25')](respondWithResult(_0x376539,null))[_0x97ad('0x46')](handleError(_0x376539,null));};exports[_0x97ad('0x26')]=function(_0x51982c,_0x188dec){return db[_0x97ad('0x2b')][_0x97ad('0x47')]({'where':{'id':_0x51982c[_0x97ad('0x49')]['id']}})['then'](handleEntityNotFound(_0x188dec,null))['then'](removeEntity(_0x188dec,null))[_0x97ad('0x46')](handleError(_0x188dec,null));};exports[_0x97ad('0x4a')]=function(_0x5f41c4,_0x2958ec){var _0x2aeec1;return db[_0x97ad('0x4b')]['transaction'](function(_0x37705b){return db[_0x97ad('0x2b')][_0x97ad('0x4a')](_0x5f41c4[_0x97ad('0x48')],{'transaction':_0x37705b})['then'](function(_0x451353){_0x2aeec1=_0x451353;var _0xd40eaf={'type':db[_0x97ad('0x4c')][_0x97ad('0x4d')],'transaction':_0x37705b};switch(_0x5f41c4[_0x97ad('0x48')][_0x97ad('0x2e')]){case _0x97ad('0x4e'):_0xd40eaf['type']=db[_0x97ad('0x4c')][_0x97ad('0x4d')];break;case'number':_0xd40eaf[_0x97ad('0x2e')]=db[_0x97ad('0x4c')][_0x97ad('0x4f')];break;case _0x97ad('0x50'):_0xd40eaf[_0x97ad('0x2e')]=db[_0x97ad('0x4c')][_0x97ad('0x51')];_0xd40eaf['defaultValue']=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0x97ad('0x52'),util['format'](_0x97ad('0x53'),_0x2aeec1['id']),_0xd40eaf);})[_0x97ad('0x25')](function(){return _0x2aeec1;});})['then'](respondWithResult(_0x2958ec,0xc9))[_0x97ad('0x46')](handleError(_0x2958ec,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f4d2fd9..3f6f0a1 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 _0x7f0a=['api','moment','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','../../config/logger'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x7f0a,0x82));var _0xa7f0=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7f0a[_0x411add];return _0x238242;};'use strict';var _=require(_0xa7f0('0x0'));var util=require('util');var logger=require(_0xa7f0('0x1'))(_0xa7f0('0x2'));var moment=require(_0xa7f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xa7f0('0x4'));var fs=require('fs');var path=require(_0xa7f0('0x5'));var rimraf=require(_0xa7f0('0x6'));var config=require(_0xa7f0('0x7'));var attributes=require(_0xa7f0('0x8'));module['exports']=function(_0x596aaa,_0x10a3a8){return _0x596aaa[_0xa7f0('0x9')](_0xa7f0('0xa'),attributes,{'tableName':_0xa7f0('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a6d=['util','../../config/logger','api','moment','request-promise','path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields'];(function(_0x5a54f7,_0x465450){var _0x26236a=function(_0x4cf41b){while(--_0x4cf41b){_0x5a54f7['push'](_0x5a54f7['shift']());}};_0x26236a(++_0x465450);}(_0x8a6d,0xe4));var _0xd8a6=function(_0x1884ec,_0x5ca9d7){_0x1884ec=_0x1884ec-0x0;var _0x457941=_0x8a6d[_0x1884ec];return _0x457941;};'use strict';var _=require('lodash');var util=require(_0xd8a6('0x0'));var logger=require(_0xd8a6('0x1'))(_0xd8a6('0x2'));var moment=require(_0xd8a6('0x3'));var BPromise=require('bluebird');var rp=require(_0xd8a6('0x4'));var fs=require('fs');var path=require(_0xd8a6('0x5'));var rimraf=require(_0xd8a6('0x6'));var config=require('../../config/environment');var attributes=require(_0xd8a6('0x7'));module[_0xd8a6('0x8')]=function(_0x3bf946,_0x2f784d){return _0x3bf946[_0xd8a6('0x9')](_0xd8a6('0xa'),attributes,{'tableName':_0xd8a6('0xb'),'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 84be40a..4dff1d7 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 _0x22fb=['CmCustomField,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x54c745,_0x792fe8){var _0x4f4a95=function(_0x38d878){while(--_0x38d878){_0x54c745['push'](_0x54c745['shift']());}};_0x4f4a95(++_0x792fe8);}(_0x22fb,0x192));var _0xb22f=function(_0xc7a868,_0x384966){_0xc7a868=_0xc7a868-0x0;var _0x3dd669=_0x22fb[_0xc7a868];return _0x3dd669;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('CmCustomField,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});} \ No newline at end of file +var _0x9bde=['code','message','CmCustomField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3cd147,_0x27783d){var _0x116e19=function(_0x182d95){while(--_0x182d95){_0x3cd147['push'](_0x3cd147['shift']());}};_0x116e19(++_0x27783d);}(_0x9bde,0xe1));var _0xe9bd=function(_0x97582c,_0x1a6fb7){_0x97582c=_0x97582c-0x0;var _0x240036=_0x9bde[_0x97582c];return _0x240036;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('CmCustomField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('CmCustomField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('CmCustomField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('CmCustomField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e007876..637e8d5 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 _0x5dcd=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5dcd,0xbb));var _0xd5dc=function(_0x5be640,_0x3a5dcd){_0x5be640=_0x5be640-0x0;var _0xfc3961=_0x5dcd[_0x5be640];return _0xfc3961;};'use strict';var multer=require(_0xd5dc('0x0'));var util=require(_0xd5dc('0x1'));var path=require(_0xd5dc('0x2'));var timeout=require(_0xd5dc('0x3'));var express=require(_0xd5dc('0x4'));var router=express[_0xd5dc('0x5')]();var auth=require(_0xd5dc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0xd5dc('0x7')]('/',auth[_0xd5dc('0x8')](),controller[_0xd5dc('0x9')]);router['get'](_0xd5dc('0xa'),auth[_0xd5dc('0x8')](),controller[_0xd5dc('0xb')]);router[_0xd5dc('0xc')]('/',auth[_0xd5dc('0x8')](),controller[_0xd5dc('0xd')]);router['put'](_0xd5dc('0xa'),auth[_0xd5dc('0x8')](),controller[_0xd5dc('0xe')]);router[_0xd5dc('0xf')](_0xd5dc('0xa'),auth[_0xd5dc('0x8')](),controller[_0xd5dc('0x10')]);module['exports']=router; \ No newline at end of file +var _0x0655=['isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util','express','Router','../../config/environment','./cmCustomField.controller','get'];(function(_0x15a569,_0x4ad6a1){var _0x536d3b=function(_0x1228fd){while(--_0x1228fd){_0x15a569['push'](_0x15a569['shift']());}};_0x536d3b(++_0x4ad6a1);}(_0x0655,0x81));var _0x5065=function(_0xb4ec3a,_0x2bace0){_0xb4ec3a=_0xb4ec3a-0x0;var _0x1b83db=_0x0655[_0xb4ec3a];return _0x1b83db;};'use strict';var multer=require(_0x5065('0x0'));var util=require(_0x5065('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5065('0x2'));var router=express[_0x5065('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5065('0x4'));var controller=require(_0x5065('0x5'));router[_0x5065('0x6')]('/',auth[_0x5065('0x7')](),controller[_0x5065('0x8')]);router[_0x5065('0x6')]('/:id',auth[_0x5065('0x7')](),controller[_0x5065('0x9')]);router[_0x5065('0xa')]('/',auth[_0x5065('0x7')](),controller[_0x5065('0xb')]);router[_0x5065('0xc')](_0x5065('0xd'),auth[_0x5065('0x7')](),controller[_0x5065('0xe')]);router['delete'](_0x5065('0xd'),auth[_0x5065('0x7')](),controller[_0x5065('0xf')]);module[_0x5065('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index f946d2b..5023265 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 _0x2d17=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','contactListQueue','moment','sequelize','STRING','BOOLEAN','format'];(function(_0x24ebe5,_0x2acf88){var _0x416743=function(_0xd734b2){while(--_0xd734b2){_0x24ebe5['push'](_0x24ebe5['shift']());}};_0x416743(++_0x2acf88);}(_0x2d17,0x17e));var _0x72d1=function(_0xee79d0,_0x2040c2){_0xee79d0=_0xee79d0-0x0;var _0x342d21=_0x2d17[_0xee79d0];return _0x342d21;};'use strict';var moment=require(_0x72d1('0x0'));var Sequelize=require(_0x72d1('0x1'));module['exports']={'phone':{'type':Sequelize[_0x72d1('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x72d1('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x72d1('0x4')](_0x72d1('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x72d1('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x72d1('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x72d1('0x7')]},'priority':{'type':Sequelize[_0x72d1('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x72d1('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x72d1('0x6')],'unique':_0x72d1('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x72d1('0x8')},'UserId':{'type':Sequelize[_0x72d1('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x72d1('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x72d1('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x72d1('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x72d1('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x72d1('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x72d1('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x72d1('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc978=['DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x64f59a,_0x549247){var _0x54ff1d=function(_0x20217d){while(--_0x20217d){_0x64f59a['push'](_0x64f59a['shift']());}};_0x54ff1d(++_0x549247);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x8c97('0x0'));var Sequelize=require(_0x8c97('0x1'));module[_0x8c97('0x2')]={'phone':{'type':Sequelize[_0x8c97('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x8c97('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8c97('0x5')],'defaultValue':moment()['format'](_0x8c97('0x6'))},'countbusyretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8c97('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8c97('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8c97('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8c97('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8c97('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8c97('0x7')],'unique':_0x8c97('0x9')},'ListId':{'type':Sequelize[_0x8c97('0x7')],'unique':_0x8c97('0x9')},'UserId':{'type':Sequelize[_0x8c97('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x8c97('0x9')},'CampaignId':{'type':Sequelize[_0x8c97('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8c97('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8c97('0x7')],'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 f25cba7..2ab718f 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 _0x0c6b=['CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','VoiceQueueId','VoiceQueue','CampaignId','omit','dataValues','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','calleridname','isNil','finally','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','transaction','direction','prev','isEmpty','hopperIds','scheduledAt','ASC','DESC','literal','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','isNumber'];(function(_0x5a9a68,_0x593abf){var _0xef63e3=function(_0x291790){while(--_0x291790){_0x5a9a68['push'](_0x5a9a68['shift']());}};_0xef63e3(++_0x593abf);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0xde246,_0x3af97d){_0xde246=_0xde246-0x0;var _0x219ca3=_0x0c6b[_0xde246];return _0x219ca3;};'use strict';var pdf=require(_0xb0c6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb0c6('0x1'));var zipdir=require(_0xb0c6('0x2'));var jsonpatch=require(_0xb0c6('0x3'));var rp=require(_0xb0c6('0x4'));var moment=require(_0xb0c6('0x5'));var BPromise=require(_0xb0c6('0x6'));var Mustache=require(_0xb0c6('0x7'));var util=require(_0xb0c6('0x8'));var path=require(_0xb0c6('0x9'));var sox=require(_0xb0c6('0xa'));var csv=require(_0xb0c6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb0c6('0xc'));var deskjs=require(_0xb0c6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb0c6('0xe'));var Redis=require(_0xb0c6('0xf'));var authService=require(_0xb0c6('0x10'));var qs=require(_0xb0c6('0x11'));var as=require(_0xb0c6('0x12'));var hardwareService=require(_0xb0c6('0x13'));var logger=require(_0xb0c6('0x14'))(_0xb0c6('0x15'));var utils=require('../../config/utils');var config=require(_0xb0c6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb0c6('0x17'))['db'];function respondWithStatusCode(_0x153a6c,_0x132eae){_0x132eae=_0x132eae||0xcc;return function(_0x54801b){if(_0x54801b){return _0x153a6c[_0xb0c6('0x18')](_0x132eae);}return _0x153a6c[_0xb0c6('0x19')](_0x132eae)[_0xb0c6('0x1a')]();};}function respondWithResult(_0x2b73ac,_0x11ecea){_0x11ecea=_0x11ecea||0xc8;return function(_0x1e3c8a){if(_0x1e3c8a){return _0x2b73ac[_0xb0c6('0x19')](_0x11ecea)[_0xb0c6('0x1b')](_0x1e3c8a);}};}function respondWithFilteredResult(_0x527b2c,_0x46e2be){return function(_0x1704f7){if(_0x1704f7){var _0x3194ab=_0x1704f7[_0xb0c6('0x1c')],_0xb6e21b=_0x46e2be[_0xb0c6('0x1d')],_0x4e4642=_0x46e2be['offset']+_0x46e2be[_0xb0c6('0x1e')],_0x19a09e;if(_0x4e4642>=_0x3194ab){_0x4e4642=_0x3194ab;_0x19a09e=0xc8;}else{_0x19a09e=0xce;}_0x527b2c[_0xb0c6('0x19')](_0x19a09e);return _0x527b2c[_0xb0c6('0x1f')](_0xb0c6('0x20'),_0xb6e21b+'-'+_0x4e4642+'/'+_0x3194ab)[_0xb0c6('0x1b')](_0x1704f7);}return null;};}function patchUpdates(_0x3f9caf){return function(_0x55844d){try{jsonpatch['apply'](_0x55844d,_0x3f9caf,!![]);}catch(_0x279ab1){return BPromise[_0xb0c6('0x21')](_0x279ab1);}return _0x55844d['save']();};}function saveUpdates(_0x50091c,_0x187d8b){return function(_0xa2a293){if(_0xa2a293){return _0xa2a293[_0xb0c6('0x22')](_0x50091c)['then'](function(_0x5b558f){return _0x5b558f;});}return null;};}function removeEntity(_0x133dd,_0x5c5466){return function(_0x6fcfca){if(_0x6fcfca){return _0x6fcfca[_0xb0c6('0x23')]()[_0xb0c6('0x24')](function(){_0x133dd['status'](0xcc)[_0xb0c6('0x1a')]();});}};}function handleEntityNotFound(_0x1c613b,_0x14f7f7){return function(_0x340150){if(!_0x340150){_0x1c613b[_0xb0c6('0x18')](0x194);}return _0x340150;};}function handleError(_0x38b714,_0xa43a92){_0xa43a92=_0xa43a92||0x1f4;return function(_0x16e214){logger[_0xb0c6('0x25')](_0x16e214[_0xb0c6('0x26')]);if(_0x16e214['name']){delete _0x16e214[_0xb0c6('0x27')];}_0x38b714[_0xb0c6('0x19')](_0xa43a92)[_0xb0c6('0x28')](_0x16e214);};}exports[_0xb0c6('0x29')]=function(_0x55190e,_0x5e922e){var _0x14f3d0={},_0x4ed574={},_0x48f3b6={'count':0x0,'rows':[]};var _0xe49839=_[_0xb0c6('0x2a')](db[_0xb0c6('0x2b')][_0xb0c6('0x2c')],function(_0x2f10eb){return{'name':_0x2f10eb[_0xb0c6('0x2d')],'type':_0x2f10eb[_0xb0c6('0x2e')][_0xb0c6('0x2f')]};});_0x4ed574[_0xb0c6('0x30')]=_[_0xb0c6('0x2a')](_0xe49839,'name');_0x4ed574[_0xb0c6('0x31')]=_[_0xb0c6('0x32')](_0x55190e[_0xb0c6('0x31')]);_0x4ed574[_0xb0c6('0x33')]=_[_0xb0c6('0x34')](_0x4ed574[_0xb0c6('0x30')],_0x4ed574[_0xb0c6('0x31')]);_0x4ed574[_0xb0c6('0x33')]=_[_0xb0c6('0x35')](_0x4ed574[_0xb0c6('0x33')],[_0xb0c6('0x36'),'$or',_0xb0c6('0x37'),_0xb0c6('0x38'),_0xb0c6('0x39'),_0xb0c6('0x3a'),_0xb0c6('0x3b'),_0xb0c6('0x3c'),'$not',_0xb0c6('0x3d'),_0xb0c6('0x3e'),_0xb0c6('0x3f'),_0xb0c6('0x40'),_0xb0c6('0x41'),_0xb0c6('0x42'),_0xb0c6('0x43'),_0xb0c6('0x44'),_0xb0c6('0x41'),_0xb0c6('0x45'),_0xb0c6('0x46'),'$contained',_0xb0c6('0x47')]);_0x14f3d0[_0xb0c6('0x48')]=_['intersection'](_0x4ed574['model'],qs[_0xb0c6('0x49')](_0x55190e[_0xb0c6('0x31')][_0xb0c6('0x49')]));_0x14f3d0[_0xb0c6('0x48')]=_0x14f3d0['attributes'][_0xb0c6('0x4a')]?_0x14f3d0[_0xb0c6('0x48')]:_0x4ed574[_0xb0c6('0x30')];if(!_0x55190e[_0xb0c6('0x31')]['hasOwnProperty'](_0xb0c6('0x4b'))){_0x14f3d0['limit']=qs[_0xb0c6('0x1e')](_0x55190e[_0xb0c6('0x31')][_0xb0c6('0x1e')]);_0x14f3d0['offset']=qs[_0xb0c6('0x1d')](_0x55190e[_0xb0c6('0x31')]['offset']);}_0x14f3d0['order']=qs[_0xb0c6('0x4c')](_0x55190e[_0xb0c6('0x31')][_0xb0c6('0x4c')]);_0x14f3d0[_0xb0c6('0x4d')]=qs[_0xb0c6('0x33')](_[_0xb0c6('0x4e')](_0x55190e[_0xb0c6('0x31')],_0x4ed574['filters']),_0xe49839);if(_0x55190e[_0xb0c6('0x31')][_0xb0c6('0x4f')]){_0x14f3d0[_0xb0c6('0x4d')]=_[_0xb0c6('0x50')](_0x14f3d0['where'],{'$or':_[_0xb0c6('0x2a')](_0xe49839,function(_0x96e04e){if(_0x96e04e['type']!=='VIRTUAL'){var _0x20465c={};_0x20465c[_0x96e04e[_0xb0c6('0x27')]]={'$like':'%'+_0x55190e[_0xb0c6('0x31')][_0xb0c6('0x4f')]+'%'};return _0x20465c;}})});}_0x14f3d0=_['merge']({},_0x14f3d0,_0x55190e[_0xb0c6('0x51')]);var _0x3389cb={'where':_0x14f3d0[_0xb0c6('0x4d')]};return db[_0xb0c6('0x2b')][_0xb0c6('0x1c')](_0x3389cb)[_0xb0c6('0x24')](function(_0x4de8b5){_0x48f3b6['count']=_0x4de8b5;if(_0x55190e[_0xb0c6('0x31')][_0xb0c6('0x52')]){_0x14f3d0[_0xb0c6('0x53')]=[{'all':!![]}];}return db['CmHopper'][_0xb0c6('0x54')](_0x14f3d0);})[_0xb0c6('0x24')](function(_0x59079a){_0x48f3b6[_0xb0c6('0x55')]=_0x59079a;return _0x48f3b6;})[_0xb0c6('0x24')](respondWithFilteredResult(_0x5e922e,_0x14f3d0))[_0xb0c6('0x56')](handleError(_0x5e922e,null));};exports[_0xb0c6('0x57')]=function(_0x4d49d6,_0x4cb99f){var _0x514220={'raw':!![],'where':{'id':_0x4d49d6[_0xb0c6('0x58')]['id']}},_0x547449={};_0x547449['model']=_[_0xb0c6('0x32')](db[_0xb0c6('0x2b')][_0xb0c6('0x2c')]);_0x547449[_0xb0c6('0x31')]=_[_0xb0c6('0x32')](_0x4d49d6[_0xb0c6('0x31')]);_0x547449[_0xb0c6('0x33')]=_[_0xb0c6('0x34')](_0x547449['model'],_0x547449['query']);_0x514220[_0xb0c6('0x48')]=_[_0xb0c6('0x34')](_0x547449['model'],qs[_0xb0c6('0x49')](_0x4d49d6[_0xb0c6('0x31')][_0xb0c6('0x49')]));_0x514220['attributes']=_0x514220[_0xb0c6('0x48')][_0xb0c6('0x4a')]?_0x514220['attributes']:_0x547449[_0xb0c6('0x30')];if(_0x4d49d6[_0xb0c6('0x31')][_0xb0c6('0x52')]){_0x514220[_0xb0c6('0x53')]=[{'all':!![]}];}_0x514220=_[_0xb0c6('0x50')]({},_0x514220,_0x4d49d6[_0xb0c6('0x51')]);return db['CmHopper'][_0xb0c6('0x59')](_0x514220)[_0xb0c6('0x24')](handleEntityNotFound(_0x4cb99f,null))[_0xb0c6('0x24')](respondWithResult(_0x4cb99f,null))['catch'](handleError(_0x4cb99f,null));};exports[_0xb0c6('0x5a')]=function(_0x49fcdf,_0x3e15ec){return db[_0xb0c6('0x2b')][_0xb0c6('0x5a')](_0x49fcdf[_0xb0c6('0x5b')],{})['then'](respondWithResult(_0x3e15ec,0xc9))[_0xb0c6('0x56')](handleError(_0x3e15ec,null));};exports[_0xb0c6('0x22')]=function(_0x4f9849,_0x178ca4){if(_0x4f9849[_0xb0c6('0x5b')]['id']){delete _0x4f9849[_0xb0c6('0x5b')]['id'];}return db[_0xb0c6('0x2b')][_0xb0c6('0x59')]({'where':{'id':_0x4f9849[_0xb0c6('0x58')]['id']}})['then'](handleEntityNotFound(_0x178ca4,null))[_0xb0c6('0x24')](saveUpdates(_0x4f9849['body'],null))[_0xb0c6('0x24')](respondWithResult(_0x178ca4,null))['catch'](handleError(_0x178ca4,null));};exports['describe']=function(_0x527a11,_0x534382){return db['CmHopper'][_0xb0c6('0x5c')]()[_0xb0c6('0x24')](respondWithResult(_0x534382,null))['catch'](handleError(_0x534382,null));};exports[_0xb0c6('0x23')]=function(_0x158d5a,_0x1c0115){var _0x268224;return db[_0xb0c6('0x2b')]['find']({'where':{'id':_0x158d5a[_0xb0c6('0x58')]['id']}})['then'](handleEntityNotFound(_0x1c0115,null))[_0xb0c6('0x24')](function(_0x5409ea){if(_0x5409ea){return _0x5409ea[_0xb0c6('0x23')]()[_0xb0c6('0x24')](function(_0x3fa007){return _0x3fa007;});}})[_0xb0c6('0x24')](function(_0x38a883){_0x268224=_0x38a883;if(_0x38a883){if(_0x38a883[_0xb0c6('0x5d')]||_0x38a883['CampaignId']){return db[_0x38a883[_0xb0c6('0x5d')]?_0xb0c6('0x5e'):'Campaign'][_0xb0c6('0x59')]({'where':{'id':_0x38a883[_0xb0c6('0x5d')]?_0x38a883[_0xb0c6('0x5d')]:_0x38a883[_0xb0c6('0x5f')]},'attributes':['id',_0xb0c6('0x27')],'raw':!![]});}}})[_0xb0c6('0x24')](function(_0x5462e5){var _0x1cb610={};if(_0x5462e5){_[_0xb0c6('0x50')](_0x1cb610,_[_0xb0c6('0x60')](_0x268224[_0xb0c6('0x61')],['createdAt','updatedAt','id']));_0x1cb610['state']=0x15;_0x1cb610['statedesc']=_0xb0c6('0x62');_0x1cb610[_0xb0c6('0x63')]=_0x5462e5['name'];_0x1cb610[_0xb0c6('0x64')]=_0x158d5a[_0xb0c6('0x65')][_0xb0c6('0x27')];_0x1cb610[_0xb0c6('0x66')]=_0x158d5a[_0xb0c6('0x65')]['id'];_0x1cb610[_0xb0c6('0x62')]=!![];_0x1cb610['deletedat']=moment()[_0xb0c6('0x67')](_0xb0c6('0x68'));_0x1cb610[_0xb0c6('0x69')]=_0x268224[_0xb0c6('0x6a')];_0x1cb610[_0xb0c6('0x6b')]=_0x268224['VoiceQueueId']?_0xb0c6('0x6c'):_0xb0c6('0x6d');return db[_0xb0c6('0x6e')][_0xb0c6('0x59')]({'where':{'id':_0x1cb610[_0xb0c6('0x6f')]},'attributes':[_0xb0c6('0x70'),_0xb0c6('0x71')]})[_0xb0c6('0x24')](function(_0x282fa5){if(!_['isNil'](_0x1c0115)&&!_['isNil'](_0x282fa5[_0xb0c6('0x70')])){_0x1cb610[_0xb0c6('0x72')]=_0x282fa5['firstName'];if(!_[_0xb0c6('0x73')](_0x282fa5['lastName'])){_0x1cb610[_0xb0c6('0x72')]+='\x20'+_0x282fa5[_0xb0c6('0x71')];}}})[_0xb0c6('0x74')](function(){return db['CmHopperFinal']['create'](_0x1cb610);});}})[_0xb0c6('0x24')](function(){return _0x1c0115[_0xb0c6('0x19')](0xcc)[_0xb0c6('0x1a')]();})[_0xb0c6('0x56')](handleError(_0x1c0115,null));};exports[_0xb0c6('0x75')]=function(_0x34f486,_0x45aae6,_0x480e2b){var _0x19a981=[];return db[_0xb0c6('0x6e')][_0xb0c6('0x5c')]()[_0xb0c6('0x24')](function(_0xefefca){_0x19a981=_[_0xb0c6('0x32')](_0xefefca);return _0x34f486[_0xb0c6('0x65')][_0xb0c6('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xb0c6('0x77')},'attributes':['id',_0xb0c6('0x78')],'raw':!![]});})[_0xb0c6('0x24')](function(_0x415b02){if(_0x415b02&&_0x415b02[_0xb0c6('0x4a')]){return db['sequelize'][_0xb0c6('0x79')](function(_0x4453e5){var _0x55dcd4={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xb0c6('0x68'))},'VoiceQueueId':{'$in':_[_0xb0c6('0x2a')](_0x415b02,'id')},'$or':[{'UserId':null},{'UserId':_0x34f486[_0xb0c6('0x65')]['id']}]};var _0x454b89=[];if(_0x34f486[_0xb0c6('0x5b')][_0xb0c6('0x7a')]&&_0x34f486[_0xb0c6('0x5b')]['direction']===_0xb0c6('0x7b')){if(!_[_0xb0c6('0x7c')](_0x34f486[_0xb0c6('0x5b')][_0xb0c6('0x7d')])){_0x55dcd4['id']={'$in':_0x34f486[_0xb0c6('0x5b')][_0xb0c6('0x7d')]};}_0x454b89=[['priority','ASC'],[_0xb0c6('0x7e'),_0x415b02[0x0][_0xb0c6('0x78')]===_0xb0c6('0x7f')?_0xb0c6('0x80'):_0xb0c6('0x7f')],db['sequelize'][_0xb0c6('0x81')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xb0c6('0x80')]];}else{if(!_[_0xb0c6('0x7c')](_0x34f486[_0xb0c6('0x5b')][_0xb0c6('0x7d')])){_0x55dcd4['id']={'$notIn':_0x34f486['body'][_0xb0c6('0x7d')]};}_0x454b89=[['priority',_0xb0c6('0x80')],['scheduledAt',_0x415b02[0x0][_0xb0c6('0x78')]],db[_0xb0c6('0x82')]['literal'](_0xb0c6('0x83')),['id','ASC']];}return db[_0xb0c6('0x2b')][_0xb0c6('0x84')]({'attributes':['id',_0xb0c6('0x85')],'where':_0x55dcd4,'order':_0x454b89,'transaction':_0x4453e5,'lock':_0x4453e5[_0xb0c6('0x86')][_0xb0c6('0x87')],'include':[{'model':db['CmContact'],'as':_0xb0c6('0x88'),'attributes':_0x19a981,'include':[{'model':db[_0xb0c6('0x89')],'as':_0xb0c6('0x8a'),'attributes':['id',_0xb0c6('0x27')]}]},{'model':db[_0xb0c6('0x8b')],'as':_0xb0c6('0x8c'),'attributes':['id',_0xb0c6('0x27')]},{'model':db['VoiceQueue'],'as':_0xb0c6('0x8d'),'attributes':['id',_0xb0c6('0x27'),_0xb0c6('0x8e')]}]})[_0xb0c6('0x24')](function(_0xc1b6a8){if(_0xc1b6a8){return _0xc1b6a8[_0xb0c6('0x22')]({'UserId':_0x34f486[_0xb0c6('0x65')]['id']},{'transaction':_0x4453e5});}});});}})['then'](handleEntityNotFound(_0x45aae6,null))[_0xb0c6('0x24')](respondWithResult(_0x45aae6,null))['catch'](handleError(_0x45aae6,null));};exports['getOpenContacts']=function(_0xeafbd1,_0x55e4dd,_0x172918){return _0xeafbd1['user'][_0xb0c6('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xb0c6('0x77')},'attributes':['id'],'raw':!![]})[_0xb0c6('0x24')](function(_0x312532){if(_0x312532&&_0x312532['length']){return db[_0xb0c6('0x2b')][_0xb0c6('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xb0c6('0x68'))},'VoiceQueueId':{'$in':_['map'](_0x312532,'id')},'$or':[{'UserId':null},{'UserId':_0xeafbd1[_0xb0c6('0x65')]['id']}]}});}return 0x0;})[_0xb0c6('0x24')](function(_0x4abbb0){if(!_[_0xb0c6('0x73')](_0x4abbb0)&&_[_0xb0c6('0x8f')](_0x4abbb0)){return _0x55e4dd['status'](0xc8)[_0xb0c6('0x1b')]({'contacts':_0x4abbb0});}else{logger[_0xb0c6('0x25')](_0xb0c6('0x90'),_0xb0c6('0x91'),0x194,_0xb0c6('0x92'));_0x55e4dd[_0xb0c6('0x18')](0x194);}})[_0xb0c6('0x56')](handleError(_0x55e4dd,null));}; \ No newline at end of file +var _0x07a2=['dialActive','getOpenContacts','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','json','apply','save','update','then','destroy','stack','name','map','CmHopper','fieldName','type','key','model','query','filters','intersection','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','keys','rawAttributes','length','find','catch','create','body','describe','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','preview','sequelize','transaction','direction','isEmpty','hopperIds','scheduledAt','dialOrderByScheduledAt','DESC','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','scheduledat','LOCK','UPDATE','Company','CmList','List','Queue'];(function(_0x4ddc7e,_0xcb9b8){var _0xfbf0ec=function(_0x32b673){while(--_0x32b673){_0x4ddc7e['push'](_0x4ddc7e['shift']());}};_0xfbf0ec(++_0xcb9b8);}(_0x07a2,0x12c));var _0x207a=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x07a2[_0x2f2360];return _0x1cc8d3;};'use strict';var pdf=require(_0x207a('0x0'));var emlformat=require(_0x207a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x207a('0x2'));var jsonpatch=require(_0x207a('0x3'));var rp=require(_0x207a('0x4'));var moment=require(_0x207a('0x5'));var BPromise=require(_0x207a('0x6'));var Mustache=require(_0x207a('0x7'));var util=require(_0x207a('0x8'));var path=require(_0x207a('0x9'));var sox=require(_0x207a('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x207a('0xb'));var squel=require(_0x207a('0xc'));var crypto=require(_0x207a('0xd'));var jsforce=require(_0x207a('0xe'));var deskjs=require(_0x207a('0xf'));var toCsv=require(_0x207a('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x207a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x207a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x207a('0x13'));var utils=require(_0x207a('0x14'));var config=require(_0x207a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x207a('0x16'))['db'];function respondWithStatusCode(_0x20ce67,_0x39e886){_0x39e886=_0x39e886||0xcc;return function(_0x5ccee7){if(_0x5ccee7){return _0x20ce67[_0x207a('0x17')](_0x39e886);}return _0x20ce67[_0x207a('0x18')](_0x39e886)[_0x207a('0x19')]();};}function respondWithResult(_0x3f161f,_0x2865cd){_0x2865cd=_0x2865cd||0xc8;return function(_0x4d753c){if(_0x4d753c){return _0x3f161f[_0x207a('0x18')](_0x2865cd)['json'](_0x4d753c);}};}function respondWithFilteredResult(_0x201f87,_0x2fbafd){return function(_0x2edadb){if(_0x2edadb){var _0x2ab68=_0x2edadb[_0x207a('0x1a')],_0x4cfe8c=_0x2fbafd[_0x207a('0x1b')],_0x3e8db5=_0x2fbafd[_0x207a('0x1b')]+_0x2fbafd['limit'],_0xd60aa3;if(_0x3e8db5>=_0x2ab68){_0x3e8db5=_0x2ab68;_0xd60aa3=0xc8;}else{_0xd60aa3=0xce;}_0x201f87[_0x207a('0x18')](_0xd60aa3);return _0x201f87['set'](_0x207a('0x1c'),_0x4cfe8c+'-'+_0x3e8db5+'/'+_0x2ab68)[_0x207a('0x1d')](_0x2edadb);}return null;};}function patchUpdates(_0x108c0c){return function(_0x2aece0){try{jsonpatch[_0x207a('0x1e')](_0x2aece0,_0x108c0c,!![]);}catch(_0x1afb14){return BPromise['reject'](_0x1afb14);}return _0x2aece0[_0x207a('0x1f')]();};}function saveUpdates(_0x30ff20,_0x4ab87d){return function(_0xb1171c){if(_0xb1171c){return _0xb1171c[_0x207a('0x20')](_0x30ff20)[_0x207a('0x21')](function(_0x30fe52){return _0x30fe52;});}return null;};}function removeEntity(_0x215467,_0x2d904a){return function(_0x3ed54a){if(_0x3ed54a){return _0x3ed54a[_0x207a('0x22')]()[_0x207a('0x21')](function(){_0x215467[_0x207a('0x18')](0xcc)[_0x207a('0x19')]();});}};}function handleEntityNotFound(_0x3d793d,_0x8ffe88){return function(_0x5804a3){if(!_0x5804a3){_0x3d793d[_0x207a('0x17')](0x194);}return _0x5804a3;};}function handleError(_0x1ac358,_0x85233e){_0x85233e=_0x85233e||0x1f4;return function(_0x22aa5a){logger['error'](_0x22aa5a[_0x207a('0x23')]);if(_0x22aa5a[_0x207a('0x24')]){delete _0x22aa5a['name'];}_0x1ac358[_0x207a('0x18')](_0x85233e)['send'](_0x22aa5a);};}exports['index']=function(_0x3c81bd,_0x5a378e){var _0x29b4cc={},_0x2df192={},_0x5e540f={'count':0x0,'rows':[]};var _0x5435ce=_[_0x207a('0x25')](db[_0x207a('0x26')]['rawAttributes'],function(_0x56468b){return{'name':_0x56468b[_0x207a('0x27')],'type':_0x56468b[_0x207a('0x28')][_0x207a('0x29')]};});_0x2df192[_0x207a('0x2a')]=_[_0x207a('0x25')](_0x5435ce,_0x207a('0x24'));_0x2df192[_0x207a('0x2b')]=_['keys'](_0x3c81bd[_0x207a('0x2b')]);_0x2df192[_0x207a('0x2c')]=_[_0x207a('0x2d')](_0x2df192['model'],_0x2df192['query']);_0x2df192['filters']=_['concat'](_0x2df192[_0x207a('0x2c')],[_0x207a('0x2e'),_0x207a('0x2f'),_0x207a('0x30'),_0x207a('0x31'),_0x207a('0x32'),_0x207a('0x33'),_0x207a('0x34'),_0x207a('0x35'),_0x207a('0x36'),'$between',_0x207a('0x37'),_0x207a('0x38'),_0x207a('0x39'),'$like','$notLike',_0x207a('0x3a'),_0x207a('0x3b'),'$like',_0x207a('0x3c'),_0x207a('0x3d'),'$contained',_0x207a('0x3e')]);_0x29b4cc[_0x207a('0x3f')]=_[_0x207a('0x2d')](_0x2df192['model'],qs[_0x207a('0x40')](_0x3c81bd['query']['fields']));_0x29b4cc[_0x207a('0x3f')]=_0x29b4cc[_0x207a('0x3f')]['length']?_0x29b4cc[_0x207a('0x3f')]:_0x2df192[_0x207a('0x2a')];if(!_0x3c81bd['query'][_0x207a('0x41')](_0x207a('0x42'))){_0x29b4cc[_0x207a('0x43')]=qs[_0x207a('0x43')](_0x3c81bd[_0x207a('0x2b')]['limit']);_0x29b4cc[_0x207a('0x1b')]=qs[_0x207a('0x1b')](_0x3c81bd[_0x207a('0x2b')][_0x207a('0x1b')]);}_0x29b4cc[_0x207a('0x44')]=qs[_0x207a('0x45')](_0x3c81bd[_0x207a('0x2b')]['sort']);_0x29b4cc[_0x207a('0x46')]=qs['filters'](_[_0x207a('0x47')](_0x3c81bd[_0x207a('0x2b')],_0x2df192['filters']),_0x5435ce);if(_0x3c81bd[_0x207a('0x2b')]['filter']){_0x29b4cc[_0x207a('0x46')]=_[_0x207a('0x48')](_0x29b4cc[_0x207a('0x46')],{'$or':_[_0x207a('0x25')](_0x5435ce,function(_0x4c4196){if(_0x4c4196[_0x207a('0x28')]!==_0x207a('0x49')){var _0x3287e2={};_0x3287e2[_0x4c4196[_0x207a('0x24')]]={'$like':'%'+_0x3c81bd[_0x207a('0x2b')][_0x207a('0x4a')]+'%'};return _0x3287e2;}})});}_0x29b4cc=_['merge']({},_0x29b4cc,_0x3c81bd[_0x207a('0x4b')]);var _0x5be0ae={'where':_0x29b4cc['where']};return db[_0x207a('0x26')]['count'](_0x5be0ae)['then'](function(_0x441cbe){_0x5e540f['count']=_0x441cbe;if(_0x3c81bd[_0x207a('0x2b')][_0x207a('0x4c')]){_0x29b4cc[_0x207a('0x4d')]=[{'all':!![]}];}return db[_0x207a('0x26')][_0x207a('0x4e')](_0x29b4cc);})[_0x207a('0x21')](function(_0x2bbe3d){_0x5e540f[_0x207a('0x4f')]=_0x2bbe3d;return _0x5e540f;})[_0x207a('0x21')](respondWithFilteredResult(_0x5a378e,_0x29b4cc))['catch'](handleError(_0x5a378e,null));};exports['show']=function(_0x11b11c,_0x38b82e){var _0x154205={'raw':!![],'where':{'id':_0x11b11c[_0x207a('0x50')]['id']}},_0x2f6dc0={};_0x2f6dc0[_0x207a('0x2a')]=_[_0x207a('0x51')](db[_0x207a('0x26')][_0x207a('0x52')]);_0x2f6dc0[_0x207a('0x2b')]=_[_0x207a('0x51')](_0x11b11c[_0x207a('0x2b')]);_0x2f6dc0[_0x207a('0x2c')]=_[_0x207a('0x2d')](_0x2f6dc0[_0x207a('0x2a')],_0x2f6dc0[_0x207a('0x2b')]);_0x154205[_0x207a('0x3f')]=_[_0x207a('0x2d')](_0x2f6dc0[_0x207a('0x2a')],qs[_0x207a('0x40')](_0x11b11c[_0x207a('0x2b')][_0x207a('0x40')]));_0x154205[_0x207a('0x3f')]=_0x154205['attributes'][_0x207a('0x53')]?_0x154205[_0x207a('0x3f')]:_0x2f6dc0['model'];if(_0x11b11c['query']['includeAll']){_0x154205['include']=[{'all':!![]}];}_0x154205=_['merge']({},_0x154205,_0x11b11c[_0x207a('0x4b')]);return db['CmHopper'][_0x207a('0x54')](_0x154205)[_0x207a('0x21')](handleEntityNotFound(_0x38b82e,null))[_0x207a('0x21')](respondWithResult(_0x38b82e,null))[_0x207a('0x55')](handleError(_0x38b82e,null));};exports[_0x207a('0x56')]=function(_0x4daa0c,_0x50738e){return db['CmHopper'][_0x207a('0x56')](_0x4daa0c[_0x207a('0x57')],{})[_0x207a('0x21')](respondWithResult(_0x50738e,0xc9))[_0x207a('0x55')](handleError(_0x50738e,null));};exports['update']=function(_0x33291d,_0x1b754c){if(_0x33291d['body']['id']){delete _0x33291d['body']['id'];}return db['CmHopper'][_0x207a('0x54')]({'where':{'id':_0x33291d[_0x207a('0x50')]['id']}})['then'](handleEntityNotFound(_0x1b754c,null))[_0x207a('0x21')](saveUpdates(_0x33291d[_0x207a('0x57')],null))['then'](respondWithResult(_0x1b754c,null))[_0x207a('0x55')](handleError(_0x1b754c,null));};exports[_0x207a('0x58')]=function(_0x1d6be7,_0x1d93b4){return db[_0x207a('0x26')][_0x207a('0x58')]()[_0x207a('0x21')](respondWithResult(_0x1d93b4,null))[_0x207a('0x55')](handleError(_0x1d93b4,null));};exports[_0x207a('0x22')]=function(_0x1118e4,_0x205ac5){var _0x99208;return db['CmHopper'][_0x207a('0x54')]({'where':{'id':_0x1118e4[_0x207a('0x50')]['id']}})[_0x207a('0x21')](handleEntityNotFound(_0x205ac5,null))[_0x207a('0x21')](function(_0x5db675){if(_0x5db675){return _0x5db675[_0x207a('0x22')]()[_0x207a('0x21')](function(_0x220a76){return _0x220a76;});}})['then'](function(_0x1eac4f){_0x99208=_0x1eac4f;if(_0x1eac4f){if(_0x1eac4f['VoiceQueueId']||_0x1eac4f[_0x207a('0x59')]){return db[_0x1eac4f['VoiceQueueId']?_0x207a('0x5a'):_0x207a('0x5b')]['find']({'where':{'id':_0x1eac4f[_0x207a('0x5c')]?_0x1eac4f[_0x207a('0x5c')]:_0x1eac4f[_0x207a('0x59')]},'attributes':['id',_0x207a('0x24')],'raw':!![]});}}})[_0x207a('0x21')](function(_0x29b63a){var _0x5332ce={};if(_0x29b63a){_[_0x207a('0x48')](_0x5332ce,_[_0x207a('0x5d')](_0x99208[_0x207a('0x5e')],[_0x207a('0x5f'),_0x207a('0x60'),'id']));_0x5332ce[_0x207a('0x61')]=0x15;_0x5332ce[_0x207a('0x62')]=_0x207a('0x63');_0x5332ce[_0x207a('0x64')]=_0x29b63a[_0x207a('0x24')];_0x5332ce[_0x207a('0x65')]=_0x1118e4[_0x207a('0x66')][_0x207a('0x24')];_0x5332ce['UserId']=_0x1118e4[_0x207a('0x66')]['id'];_0x5332ce[_0x207a('0x63')]=!![];_0x5332ce[_0x207a('0x67')]=moment()[_0x207a('0x68')](_0x207a('0x69'));_0x5332ce[_0x207a('0x6a')]=_0x99208[_0x207a('0x6b')];_0x5332ce[_0x207a('0x6c')]=_0x99208[_0x207a('0x5c')]?_0x207a('0x6d'):_0x207a('0x6e');return db[_0x207a('0x6f')][_0x207a('0x54')]({'where':{'id':_0x5332ce[_0x207a('0x70')]},'attributes':[_0x207a('0x71'),_0x207a('0x72')]})['then'](function(_0x4ee727){if(!_[_0x207a('0x73')](_0x205ac5)&&!_['isNil'](_0x4ee727[_0x207a('0x71')])){_0x5332ce[_0x207a('0x74')]=_0x4ee727[_0x207a('0x71')];if(!_[_0x207a('0x73')](_0x4ee727[_0x207a('0x72')])){_0x5332ce['calleridname']+='\x20'+_0x4ee727['lastName'];}}})[_0x207a('0x75')](function(){return db[_0x207a('0x76')][_0x207a('0x56')](_0x5332ce);});}})['then'](function(){return _0x205ac5[_0x207a('0x18')](0xcc)[_0x207a('0x19')]();})[_0x207a('0x55')](handleError(_0x205ac5,null));};exports[_0x207a('0x77')]=function(_0x4fcab9,_0x56502c,_0x22b366){var _0x13ee67=[];return db[_0x207a('0x6f')][_0x207a('0x58')]()[_0x207a('0x21')](function(_0x38c5ef){_0x13ee67=_[_0x207a('0x51')](_0x38c5ef);return _0x4fcab9[_0x207a('0x66')][_0x207a('0x78')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x207a('0x79')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x207a('0x21')](function(_0x5206b4){if(_0x5206b4&&_0x5206b4[_0x207a('0x53')]){return db[_0x207a('0x7a')][_0x207a('0x7b')](function(_0x30bdab){var _0x3991ea={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x207a('0x69'))},'VoiceQueueId':{'$in':_['map'](_0x5206b4,'id')},'$or':[{'UserId':null},{'UserId':_0x4fcab9[_0x207a('0x66')]['id']}]};var _0x2bbcd3=[];if(_0x4fcab9[_0x207a('0x57')][_0x207a('0x7c')]&&_0x4fcab9[_0x207a('0x57')][_0x207a('0x7c')]==='prev'){if(!_[_0x207a('0x7d')](_0x4fcab9[_0x207a('0x57')]['hopperIds'])){_0x3991ea['id']={'$in':_0x4fcab9[_0x207a('0x57')][_0x207a('0x7e')]};}_0x2bbcd3=[['priority','ASC'],[_0x207a('0x7f'),_0x5206b4[0x0][_0x207a('0x80')]==='ASC'?_0x207a('0x81'):_0x207a('0x82')],db['sequelize'][_0x207a('0x83')](_0x207a('0x84')),['id','DESC']];}else{if(!_[_0x207a('0x7d')](_0x4fcab9['body'][_0x207a('0x7e')])){_0x3991ea['id']={'$notIn':_0x4fcab9['body'][_0x207a('0x7e')]};}_0x2bbcd3=[[_0x207a('0x85'),_0x207a('0x81')],[_0x207a('0x7f'),_0x5206b4[0x0][_0x207a('0x80')]],db[_0x207a('0x7a')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x207a('0x82')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x207a('0x86')],'where':_0x3991ea,'order':_0x2bbcd3,'transaction':_0x30bdab,'lock':_0x30bdab[_0x207a('0x87')][_0x207a('0x88')],'include':[{'model':db[_0x207a('0x6f')],'as':'Contact','attributes':_0x13ee67,'include':[{'model':db['CmCompany'],'as':_0x207a('0x89'),'attributes':['id',_0x207a('0x24')]}]},{'model':db[_0x207a('0x8a')],'as':_0x207a('0x8b'),'attributes':['id',_0x207a('0x24')]},{'model':db[_0x207a('0x5a')],'as':_0x207a('0x8c'),'attributes':['id','name',_0x207a('0x8d')]}]})[_0x207a('0x21')](function(_0x369759){if(_0x369759){return _0x369759['update']({'UserId':_0x4fcab9[_0x207a('0x66')]['id']},{'transaction':_0x30bdab});}});});}})['then'](handleEntityNotFound(_0x56502c,null))['then'](respondWithResult(_0x56502c,null))[_0x207a('0x55')](handleError(_0x56502c,null));};exports[_0x207a('0x8e')]=function(_0x1fab7e,_0x5c7f26,_0x55ffd5){return _0x1fab7e['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x207a('0x79')},'attributes':['id'],'raw':!![]})[_0x207a('0x21')](function(_0x7b649a){if(_0x7b649a&&_0x7b649a[_0x207a('0x53')]){return db[_0x207a('0x26')][_0x207a('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x207a('0x68')](_0x207a('0x69'))},'VoiceQueueId':{'$in':_[_0x207a('0x25')](_0x7b649a,'id')},'$or':[{'UserId':null},{'UserId':_0x1fab7e[_0x207a('0x66')]['id']}]}});}return 0x0;})[_0x207a('0x21')](function(_0x46bcc0){if(!_[_0x207a('0x73')](_0x46bcc0)&&_[_0x207a('0x8f')](_0x46bcc0)){return _0x5c7f26['status'](0xc8)[_0x207a('0x1d')]({'contacts':_0x46bcc0});}else{logger[_0x207a('0x90')](_0x207a('0x91'),_0x207a('0x8e'),0x194,_0x207a('0x92'));_0x5c7f26[_0x207a('0x17')](0x194);}})[_0x207a('0x55')](handleError(_0x5c7f26,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index e8e020a..336dc0d 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 _0x5e14=['cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmHopper.attributes','exports','define'];(function(_0x2cd1fb,_0x291f55){var _0x48fd2b=function(_0x18e23e){while(--_0x18e23e){_0x2cd1fb['push'](_0x2cd1fb['shift']());}};_0x48fd2b(++_0x291f55);}(_0x5e14,0x130));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var util=require(_0x45e1('0x1'));var logger=require(_0x45e1('0x2'))(_0x45e1('0x3'));var moment=require(_0x45e1('0x4'));var BPromise=require(_0x45e1('0x5'));var rp=require(_0x45e1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x45e1('0x7'));var attributes=require(_0x45e1('0x8'));module[_0x45e1('0x9')]=function(_0x266bfd,_0x3b2448){return _0x266bfd[_0x45e1('0xa')]('CmHopper',attributes,{'tableName':_0x45e1('0xb'),'paranoid':![],'indexes':[{'name':_0x45e1('0xc'),'fields':[_0x45e1('0xc')]},{'name':_0x45e1('0xd'),'fields':[_0x45e1('0xd')]},{'name':_0x45e1('0xe'),'fields':[_0x45e1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x24e2=['exports','CmHopper','cm_hopper','scheduledat','phone','priority','util','../../config/logger','moment','bluebird','path','./cmHopper.attributes'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x24e2,0xde));var _0x224e=function(_0x758e29,_0x2a4e50){_0x758e29=_0x758e29-0x0;var _0x59132e=_0x24e2[_0x758e29];return _0x59132e;};'use strict';var _=require('lodash');var util=require(_0x224e('0x0'));var logger=require(_0x224e('0x1'))('api');var moment=require(_0x224e('0x2'));var BPromise=require(_0x224e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x224e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x224e('0x5'));module[_0x224e('0x6')]=function(_0x198b6a,_0x52fa52){return _0x198b6a['define'](_0x224e('0x7'),attributes,{'tableName':_0x224e('0x8'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x224e('0x9')]},{'name':_0x224e('0xa'),'fields':[_0x224e('0xa')]},{'name':_0x224e('0xb'),'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 6ba3c0a..95a1326 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 _0x946b=['CmHopper,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CmHopper','findAll','options','attributes','limit','include','map','model','GetCmHopper','stringify','ShowCmHopper','raw','CreateCmHopper','create','UpdateCmHopper','update','body','where','destroy','DestroyCmHopper','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','all','GetContactDialer','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x946b,0x1d0));var _0xb946=function(_0x1d12cc,_0x45a9c7){_0x1d12cc=_0x1d12cc-0x0;var _0x38b284=_0x946b[_0x1d12cc];return _0x38b284;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb946('0x0'));var BPromise=require(_0xb946('0x1'));var rs=require(_0xb946('0x2'));var fs=require('fs');var Redis=require(_0xb946('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb946('0x4'));var logger=require(_0xb946('0x5'))(_0xb946('0x6'));var config=require(_0xb946('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb946('0x8')][_0xb946('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c124f,_0x4fc4bd,_0xb7c79f){return new BPromise(function(_0x124508,_0x366463){return client[_0xb946('0xa')](_0x3c124f,_0xb7c79f)[_0xb946('0xb')](function(_0x487dee){logger['info'](_0xb946('0xc'),_0x4fc4bd,_0xb946('0xd'));logger[_0xb946('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x4fc4bd,_0xb946('0xd'),JSON['stringify'](_0x487dee));if(_0x487dee[_0xb946('0xf')]){if(_0x487dee[_0xb946('0xf')][_0xb946('0x10')]===0x1f4){logger[_0xb946('0xf')](_0xb946('0xc'),_0x4fc4bd,_0x487dee['error']['message']);return _0x366463(_0x487dee[_0xb946('0xf')][_0xb946('0x11')]);}logger[_0xb946('0xf')](_0xb946('0xc'),_0x4fc4bd,_0x487dee['error'][_0xb946('0x11')]);return _0x124508(_0x487dee[_0xb946('0xf')][_0xb946('0x11')]);}else{logger[_0xb946('0x12')](_0xb946('0xc'),_0x4fc4bd,_0xb946('0xd'));_0x124508(_0x487dee[_0xb946('0x13')][_0xb946('0x11')]);}})[_0xb946('0x14')](function(_0x277c09){logger['error'](_0xb946('0xc'),_0x4fc4bd,_0x277c09);_0x366463(_0x277c09);});});}exports['GetCmHopper']=function(_0x28e854){var _0x2fe89a=this;return new Promise(function(_0x3deca2,_0x18c22){return db[_0xb946('0x15')][_0xb946('0x16')]({'raw':_0x28e854[_0xb946('0x17')]?_0x28e854['options']['raw']===undefined?!![]:![]:!![],'where':_0x28e854['options']?_0x28e854['options']['where']||null:null,'attributes':_0x28e854[_0xb946('0x17')]?_0x28e854['options'][_0xb946('0x18')]||null:null,'limit':_0x28e854[_0xb946('0x17')]?_0x28e854[_0xb946('0x17')][_0xb946('0x19')]||null:null,'include':_0x28e854[_0xb946('0x17')]?_0x28e854['options'][_0xb946('0x1a')]?_[_0xb946('0x1b')](_0x28e854[_0xb946('0x17')]['include'],function(_0x2e13e3){return{'model':db[_0x2e13e3[_0xb946('0x1c')]],'as':_0x2e13e3['as'],'attributes':_0x2e13e3[_0xb946('0x18')],'include':_0x2e13e3[_0xb946('0x1a')]?_[_0xb946('0x1b')](_0x2e13e3[_0xb946('0x1a')],function(_0x318cf4){return{'model':db[_0x318cf4[_0xb946('0x1c')]],'as':_0x318cf4['as'],'attributes':_0x318cf4[_0xb946('0x18')],'include':_0x318cf4[_0xb946('0x1a')]?_[_0xb946('0x1b')](_0x318cf4[_0xb946('0x1a')],function(_0x3e709c){return{'model':db[_0x3e709c[_0xb946('0x1c')]],'as':_0x3e709c['as'],'attributes':_0x3e709c[_0xb946('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb946('0xb')](function(_0x2ac473){logger['info']('GetCmHopper',_0x28e854);logger[_0xb946('0xe')](_0xb946('0x1d'),_0x28e854,JSON[_0xb946('0x1e')](_0x2ac473));_0x3deca2(_0x2ac473);})['catch'](function(_0x4398c5){logger[_0xb946('0xf')](_0xb946('0x1d'),_0x4398c5[_0xb946('0x11')],_0x28e854);_0x18c22(_0x2fe89a[_0xb946('0xf')](0x1f4,_0x4398c5[_0xb946('0x11')]));});});};exports[_0xb946('0x1f')]=function(_0x56dd3c){var _0x4d376d=this;return new Promise(function(_0x48d9dd,_0x41b2f2){return db[_0xb946('0x15')]['find']({'raw':_0x56dd3c['options']?_0x56dd3c[_0xb946('0x17')][_0xb946('0x20')]===undefined?!![]:![]:!![],'where':_0x56dd3c[_0xb946('0x17')]?_0x56dd3c[_0xb946('0x17')]['where']||null:null,'attributes':_0x56dd3c[_0xb946('0x17')]?_0x56dd3c[_0xb946('0x17')][_0xb946('0x18')]||null:null,'include':_0x56dd3c[_0xb946('0x17')]?_0x56dd3c[_0xb946('0x17')][_0xb946('0x1a')]?_[_0xb946('0x1b')](_0x56dd3c[_0xb946('0x17')]['include'],function(_0x40f6aa){return{'model':db[_0x40f6aa[_0xb946('0x1c')]],'as':_0x40f6aa['as'],'attributes':_0x40f6aa[_0xb946('0x18')],'include':_0x40f6aa[_0xb946('0x1a')]?_[_0xb946('0x1b')](_0x40f6aa['include'],function(_0x247471){return{'model':db[_0x247471[_0xb946('0x1c')]],'as':_0x247471['as'],'attributes':_0x247471[_0xb946('0x18')],'include':_0x247471[_0xb946('0x1a')]?_[_0xb946('0x1b')](_0x247471[_0xb946('0x1a')],function(_0x1f18a8){return{'model':db[_0x1f18a8[_0xb946('0x1c')]],'as':_0x1f18a8['as'],'attributes':_0x1f18a8[_0xb946('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb946('0xb')](function(_0x2573ce){logger[_0xb946('0x12')](_0xb946('0x1f'),_0x56dd3c);logger[_0xb946('0xe')]('ShowCmHopper',_0x56dd3c,JSON[_0xb946('0x1e')](_0x2573ce));_0x48d9dd(_0x2573ce);})[_0xb946('0x14')](function(_0x416591){logger[_0xb946('0xf')](_0xb946('0x1f'),_0x416591[_0xb946('0x11')],_0x56dd3c);_0x41b2f2(_0x4d376d[_0xb946('0xf')](0x1f4,_0x416591['message']));});});};exports[_0xb946('0x21')]=function(_0x1beda2){var _0x40710d=this;return new Promise(function(_0x4b00fd,_0x199eab){return db[_0xb946('0x15')][_0xb946('0x22')](_0x1beda2['body'],{'raw':_0x1beda2[_0xb946('0x17')]?_0x1beda2[_0xb946('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xb946('0xb')](function(_0x1f883f){logger[_0xb946('0x12')](_0xb946('0x21'),_0x1beda2);logger[_0xb946('0xe')](_0xb946('0x21'),_0x1beda2,JSON[_0xb946('0x1e')](_0x1f883f));_0x4b00fd(_0x1f883f);})[_0xb946('0x14')](function(_0x5963ec){logger[_0xb946('0xf')](_0xb946('0x21'),_0x5963ec[_0xb946('0x11')],_0x1beda2);_0x199eab(_0x40710d[_0xb946('0xf')](0x1f4,_0x5963ec[_0xb946('0x11')]));});});};exports[_0xb946('0x23')]=function(_0x18c4d5){var _0x4388e6=this;return new Promise(function(_0x397183,_0x167c1a){return db[_0xb946('0x15')][_0xb946('0x24')](_0x18c4d5[_0xb946('0x25')],{'raw':_0x18c4d5['options']?_0x18c4d5[_0xb946('0x17')][_0xb946('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18c4d5[_0xb946('0x17')]?_0x18c4d5[_0xb946('0x17')][_0xb946('0x26')]||null:null,'attributes':_0x18c4d5['options']?_0x18c4d5[_0xb946('0x17')]['attributes']||null:null,'limit':_0x18c4d5[_0xb946('0x17')]?_0x18c4d5[_0xb946('0x17')][_0xb946('0x19')]||null:null})['then'](function(_0xccbd41){logger[_0xb946('0x12')](_0xb946('0x23'),_0x18c4d5);logger[_0xb946('0xe')]('UpdateCmHopper',_0x18c4d5,JSON[_0xb946('0x1e')](_0xccbd41));_0x397183(_0xccbd41);})['catch'](function(_0x53e541){logger[_0xb946('0xf')](_0xb946('0x23'),_0x53e541[_0xb946('0x11')],_0x18c4d5);_0x167c1a(_0x4388e6[_0xb946('0xf')](0x1f4,_0x53e541['message']));});});};exports['DestroyCmHopper']=function(_0x478b6b){var _0x285eb7=this;return new Promise(function(_0x4f18fc,_0x190306){return db[_0xb946('0x15')][_0xb946('0x27')]({'where':_0x478b6b[_0xb946('0x17')]?_0x478b6b[_0xb946('0x17')][_0xb946('0x26')]||null:null})[_0xb946('0xb')](function(_0x2f2a0d){logger[_0xb946('0x12')](_0xb946('0x28'),_0x478b6b);logger['debug'](_0xb946('0x28'),_0x478b6b,JSON[_0xb946('0x1e')](_0x2f2a0d));_0x4f18fc(_0x2f2a0d);})[_0xb946('0x14')](function(_0x9afd56){logger[_0xb946('0xf')]('DestroyCmHopper',_0x9afd56['message'],_0x478b6b);_0x190306(_0x285eb7[_0xb946('0xf')](0x1f4,_0x9afd56[_0xb946('0x11')]));});});};exports['GetContactDialer']=function(_0x24afd2){var _0x396030=this;return new Promise(function(_0xbebbf5,_0xf29a7c){return db[_0xb946('0x29')][_0xb946('0x2a')]()[_0xb946('0xb')](function(_0x40263d){return db[_0xb946('0x2b')][_0xb946('0x2c')](function(_0x5ad77a){return db[_0xb946('0x15')][_0xb946('0x16')]({'where':_0x24afd2[_0xb946('0x17')]?_0x24afd2[_0xb946('0x17')][_0xb946('0x26')]||null:null,'attributes':_0x24afd2[_0xb946('0x17')]?_0x24afd2['options'][_0xb946('0x18')]||null:null,'limit':_0x24afd2[_0xb946('0x17')]?_0x24afd2['options'][_0xb946('0x19')]||null:null,'order':_0x24afd2[_0xb946('0x17')]?_0x24afd2[_0xb946('0x17')][_0xb946('0x2d')]||null:null,'transaction':_0x5ad77a,'lock':_0x5ad77a[_0xb946('0x2e')][_0xb946('0x2f')],'include':[{'model':db[_0xb946('0x29')],'as':_0xb946('0x30'),'attributes':_[_0xb946('0x31')](_0x40263d)},{'model':db[_0xb946('0x32')],'as':_0xb946('0x33'),'attributes':['id',_0xb946('0x34'),_0xb946('0x35')]}]})[_0xb946('0xb')](function(_0x56c3ed){var _0xf3f16a=[];var _0x572fcc=[];for(var _0x267349=0x0;_0x267349<_0x56c3ed[_0xb946('0x36')];_0x267349+=0x1){if(!_0x572fcc['includes'](_0x56c3ed[_0x267349][_0xb946('0x37')])){_0x572fcc[_0xb946('0x38')](_0x56c3ed[_0x267349][_0xb946('0x37')]);_0xf3f16a[_0xb946('0x38')](_0x56c3ed[_0x267349][_0xb946('0x24')](_0x24afd2[_0xb946('0x25')],{'transaction':_0x5ad77a}));}}return BPromise[_0xb946('0x39')](_0xf3f16a);});})['then'](function(_0x175d38){logger['info'](_0xb946('0x3a'),_0x24afd2);logger[_0xb946('0xe')]('GetContactDialer',_0x24afd2,JSON[_0xb946('0x1e')](_0x175d38));_0xbebbf5(_0x175d38);})[_0xb946('0x14')](function(_0x5a2b24){logger['error'](_0xb946('0x3a'),_0x5a2b24[_0xb946('0x11')],_0x24afd2);_0xf29a7c(_0x396030[_0xb946('0xf')](0x1f4,_0x5a2b24[_0xb946('0x11')]));});});});};exports[_0xb946('0x3b')]=function(_0x2202fa){var _0x50b43a=this;return new Promise(function(_0x3ed088,_0xd016ce){return db[_0xb946('0x2b')][_0xb946('0x2c')](function(_0x44532c){return db['CmHopperFinal'][_0xb946('0x22')](_0x2202fa[_0xb946('0x25')],{'raw':_0x2202fa[_0xb946('0x17')]?_0x2202fa[_0xb946('0x17')][_0xb946('0x20')]===undefined?!![]:![]:!![],'transaction':_0x44532c})[_0xb946('0xb')](function(){return db[_0xb946('0x15')][_0xb946('0x27')]({'where':_0x2202fa[_0xb946('0x17')]?_0x2202fa[_0xb946('0x17')][_0xb946('0x26')]||null:null,'transaction':_0x44532c});});})[_0xb946('0xb')](function(_0x4af805){logger[_0xb946('0x12')](_0xb946('0x3b'),_0x2202fa);logger[_0xb946('0xe')](_0xb946('0x3b'),_0x2202fa,JSON['stringify'](_0x4af805));_0x3ed088(_0x4af805);})['catch'](function(_0x44c7c4){logger[_0xb946('0xf')](_0xb946('0x3b'),_0x44c7c4['message'],_0x2202fa);_0xd016ce(_0x50b43a[_0xb946('0xf')](0x1f4,_0x44c7c4[_0xb946('0x11')]));});});};exports['CountReScheduled']=function(_0x19272e){var _0x2428a0=this;return new Promise(function(_0x213f3c,_0x3e98ae){return db[_0xb946('0x15')]['findAll']({'raw':_0x19272e[_0xb946('0x17')]?_0x19272e[_0xb946('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x19272e['options']?_0x19272e[_0xb946('0x17')]['where']||null:null,'attributes':[[db[_0xb946('0x2b')]['fn'](_0xb946('0x3c'),db[_0xb946('0x2b')]['fn']('IF',db[_0xb946('0x2b')][_0xb946('0x3d')](_0xb946('0x3e')+util['format'](_0xb946('0x3f'),moment()[_0xb946('0x40')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0x2d1756){logger[_0xb946('0x12')]('CountReScheduled',_0x19272e);logger[_0xb946('0xe')](_0xb946('0x41'),_0x19272e,JSON[_0xb946('0x1e')](_0x2d1756));_0x213f3c(_0x2d1756);})[_0xb946('0x14')](function(_0x4fd82c){logger[_0xb946('0xf')](_0xb946('0x41'),_0x4fd82c[_0xb946('0x11')],_0x19272e);_0x3e98ae(_0x2428a0[_0xb946('0xf')](0x1f4,_0x4fd82c[_0xb946('0x11')]));});});};exports[_0xb946('0x42')]=function(_0x333340){var _0x25de7b=this;return new Promise(function(_0x5cded4,_0x2b3e0c){return db[_0xb946('0x29')]['describe']()[_0xb946('0xb')](function(_0x39804b){return db[_0xb946('0x2b')]['transaction'](function(_0xeb9d47){return db['CmHopper'][_0xb946('0x16')]({'where':_0x333340[_0xb946('0x17')]?_0x333340[_0xb946('0x17')]['where']||null:null,'attributes':_0x333340[_0xb946('0x17')]?_0x333340[_0xb946('0x17')][_0xb946('0x18')]||null:null,'limit':0x1,'order':_0x333340[_0xb946('0x17')]?_0x333340['options']['order']||null:null,'group':db[_0xb946('0x15')][_0xb946('0x37')],'transaction':_0xeb9d47,'lock':_0xeb9d47[_0xb946('0x2e')][_0xb946('0x2f')],'include':_0x333340[_0xb946('0x17')]?_0x333340[_0xb946('0x17')][_0xb946('0x1a')]?_[_0xb946('0x1b')](_0x333340[_0xb946('0x17')]['include'],function(_0x47c25b){return{'model':db[_0x47c25b[_0xb946('0x1c')]],'as':_0x47c25b['as'],'attributes':_0x47c25b[_0xb946('0x18')],'include':_0x47c25b['include']?_[_0xb946('0x1b')](_0x47c25b[_0xb946('0x1a')],function(_0x57fa7c){return{'model':db[_0x57fa7c[_0xb946('0x1c')]],'as':_0x57fa7c['as'],'attributes':_0x57fa7c[_0xb946('0x18')],'include':_0x57fa7c[_0xb946('0x1a')]?_['map'](_0x57fa7c[_0xb946('0x1a')],function(_0x42be7e){return{'model':db[_0x42be7e[_0xb946('0x1c')]],'as':_0x42be7e['as'],'attributes':_0x42be7e[_0xb946('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x140b25){var _0x7a43b8=[];for(var _0x3950b8=0x0;_0x3950b8<_0x140b25['length'];_0x3950b8+=0x1){_0x7a43b8[_0xb946('0x38')](_0x140b25[_0x3950b8][_0xb946('0x24')](_0x333340[_0xb946('0x25')],{'transaction':_0xeb9d47}));}return BPromise[_0xb946('0x39')](_0x7a43b8);});})[_0xb946('0xb')](function(_0x875154){logger[_0xb946('0x12')]('GetContactRecallMe',_0x333340);logger[_0xb946('0xe')](_0xb946('0x42'),_0x333340,JSON[_0xb946('0x1e')](_0x875154));_0x5cded4(_0x875154);})[_0xb946('0x14')](function(_0x306828){logger[_0xb946('0xf')](_0xb946('0x42'),_0x306828['message'],_0x333340);_0x2b3e0c(_0x25de7b[_0xb946('0xf')](0x1f4,_0x306828['message']));});});});};exports[_0xb946('0x43')]=function(_0x262d7d){var _0x1febd6=this;return new Promise(function(_0x23f71e,_0x234a5f){db['CmContact'][_0xb946('0x2a')]()[_0xb946('0xb')](function(_0x43592c){return db[_0xb946('0x15')][_0xb946('0x16')]({'raw':_0x262d7d['options']?_0x262d7d[_0xb946('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x262d7d['options']?_0x262d7d[_0xb946('0x17')][_0xb946('0x26')]||null:null,'attributes':_0x262d7d[_0xb946('0x17')]?_0x262d7d['options'][_0xb946('0x18')]||null:null,'limit':_0x262d7d[_0xb946('0x17')]?_0x262d7d[_0xb946('0x17')][_0xb946('0x19')]||null:null,'include':_0x262d7d[_0xb946('0x17')]?_0x262d7d[_0xb946('0x17')][_0xb946('0x1a')]?_[_0xb946('0x1b')](_0x262d7d[_0xb946('0x17')][_0xb946('0x1a')],function(_0x3bf875){return{'model':db[_0x3bf875[_0xb946('0x1c')]],'as':_0x3bf875['as'],'attributes':_0x3bf875['as']===_0xb946('0x30')?_['keys'](_0x43592c):_0x3bf875[_0xb946('0x18')],'include':_0x3bf875[_0xb946('0x1a')]?_[_0xb946('0x1b')](_0x3bf875[_0xb946('0x1a')],function(_0x1127ca){return{'model':db[_0x1127ca['model']],'as':_0x1127ca['as'],'attributes':_0x1127ca[_0xb946('0x18')],'include':_0x1127ca['include']?_[_0xb946('0x1b')](_0x1127ca[_0xb946('0x1a')],function(_0x4a3e7f){return{'model':db[_0x4a3e7f[_0xb946('0x1c')]],'as':_0x4a3e7f['as'],'attributes':_0x4a3e7f[_0xb946('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb946('0xb')](function(_0x43382f){logger[_0xb946('0x12')]('GetCmHopper',_0x262d7d);logger[_0xb946('0xe')](_0xb946('0x1d'),_0x262d7d,JSON[_0xb946('0x1e')](_0x43382f));_0x23f71e(_0x43382f);})['catch'](function(_0xafbd2a){logger['error'](_0xb946('0x1d'),_0xafbd2a[_0xb946('0x11')],_0x262d7d);_0x234a5f(_0x1febd6[_0xb946('0xf')](0x1f4,_0xafbd2a['message']));});});});}; \ No newline at end of file +var _0x774d=['`scheduledat`\x20>=\x20','format','contactsRescheduled','GetContactRecallMe','CmContact','GetCmHopperPreview','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowCmHopper','CreateCmHopper','create','UpdateCmHopper','DestroyCmHopper','destroy','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','UserId','update','body','all','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0x774d,0xdb));var _0xd774=function(_0x13c13e,_0x5acdef){_0x13c13e=_0x13c13e-0x0;var _0x4622a8=_0x774d[_0x13c13e];return _0x4622a8;};'use strict';var _=require(_0xd774('0x0'));var util=require('util');var moment=require(_0xd774('0x1'));var BPromise=require(_0xd774('0x2'));var rs=require(_0xd774('0x3'));var fs=require('fs');var Redis=require(_0xd774('0x4'));var db=require(_0xd774('0x5'))['db'];var utils=require(_0xd774('0x6'));var logger=require('../../config/logger')(_0xd774('0x7'));var config=require(_0xd774('0x8'));var jayson=require(_0xd774('0x9'));var client=jayson[_0xd774('0xa')][_0xd774('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aab7,_0xa3568b,_0x329e1d){return new BPromise(function(_0x19efc5,_0x4839f9){return client[_0xd774('0xc')](_0x28aab7,_0x329e1d)[_0xd774('0xd')](function(_0x3cf260){logger[_0xd774('0xe')]('CmHopper,\x20%s,\x20%s',_0xa3568b,_0xd774('0xf'));logger[_0xd774('0x10')](_0xd774('0x11'),_0xa3568b,_0xd774('0xf'),JSON[_0xd774('0x12')](_0x3cf260));if(_0x3cf260['error']){if(_0x3cf260[_0xd774('0x13')][_0xd774('0x14')]===0x1f4){logger[_0xd774('0x13')](_0xd774('0x15'),_0xa3568b,_0x3cf260[_0xd774('0x13')]['message']);return _0x4839f9(_0x3cf260[_0xd774('0x13')][_0xd774('0x16')]);}logger[_0xd774('0x13')]('CmHopper,\x20%s,\x20%s',_0xa3568b,_0x3cf260[_0xd774('0x13')]['message']);return _0x19efc5(_0x3cf260[_0xd774('0x13')][_0xd774('0x16')]);}else{logger[_0xd774('0xe')]('CmHopper,\x20%s,\x20%s',_0xa3568b,_0xd774('0xf'));_0x19efc5(_0x3cf260['result'][_0xd774('0x16')]);}})['catch'](function(_0x2dbb0c){logger[_0xd774('0x13')](_0xd774('0x15'),_0xa3568b,_0x2dbb0c);_0x4839f9(_0x2dbb0c);});});}exports[_0xd774('0x17')]=function(_0x460af2){var _0x49831e=this;return new Promise(function(_0x1a9810,_0x24518e){return db[_0xd774('0x18')][_0xd774('0x19')]({'raw':_0x460af2[_0xd774('0x1a')]?_0x460af2['options'][_0xd774('0x1b')]===undefined?!![]:![]:!![],'where':_0x460af2[_0xd774('0x1a')]?_0x460af2[_0xd774('0x1a')][_0xd774('0x1c')]||null:null,'attributes':_0x460af2[_0xd774('0x1a')]?_0x460af2[_0xd774('0x1a')][_0xd774('0x1d')]||null:null,'limit':_0x460af2[_0xd774('0x1a')]?_0x460af2[_0xd774('0x1a')][_0xd774('0x1e')]||null:null,'include':_0x460af2[_0xd774('0x1a')]?_0x460af2[_0xd774('0x1a')][_0xd774('0x1f')]?_['map'](_0x460af2[_0xd774('0x1a')][_0xd774('0x1f')],function(_0x3465e6){return{'model':db[_0x3465e6[_0xd774('0x20')]],'as':_0x3465e6['as'],'attributes':_0x3465e6[_0xd774('0x1d')],'include':_0x3465e6[_0xd774('0x1f')]?_[_0xd774('0x21')](_0x3465e6[_0xd774('0x1f')],function(_0x3048e3){return{'model':db[_0x3048e3[_0xd774('0x20')]],'as':_0x3048e3['as'],'attributes':_0x3048e3[_0xd774('0x1d')],'include':_0x3048e3['include']?_[_0xd774('0x21')](_0x3048e3[_0xd774('0x1f')],function(_0x15b953){return{'model':db[_0x15b953[_0xd774('0x20')]],'as':_0x15b953['as'],'attributes':_0x15b953['attributes']};}):[]};}):[]};}):[]:[]})[_0xd774('0xd')](function(_0x422e06){logger[_0xd774('0xe')](_0xd774('0x17'),_0x460af2);logger['debug'](_0xd774('0x17'),_0x460af2,JSON[_0xd774('0x12')](_0x422e06));_0x1a9810(_0x422e06);})[_0xd774('0x22')](function(_0x3e748a){logger[_0xd774('0x13')]('GetCmHopper',_0x3e748a[_0xd774('0x16')],_0x460af2);_0x24518e(_0x49831e[_0xd774('0x13')](0x1f4,_0x3e748a[_0xd774('0x16')]));});});};exports[_0xd774('0x23')]=function(_0x528a08){var _0x599738=this;return new Promise(function(_0x2030ef,_0x4365ce){return db[_0xd774('0x18')]['find']({'raw':_0x528a08[_0xd774('0x1a')]?_0x528a08['options']['raw']===undefined?!![]:![]:!![],'where':_0x528a08[_0xd774('0x1a')]?_0x528a08[_0xd774('0x1a')][_0xd774('0x1c')]||null:null,'attributes':_0x528a08[_0xd774('0x1a')]?_0x528a08[_0xd774('0x1a')]['attributes']||null:null,'include':_0x528a08[_0xd774('0x1a')]?_0x528a08[_0xd774('0x1a')][_0xd774('0x1f')]?_[_0xd774('0x21')](_0x528a08[_0xd774('0x1a')]['include'],function(_0x27eecf){return{'model':db[_0x27eecf[_0xd774('0x20')]],'as':_0x27eecf['as'],'attributes':_0x27eecf[_0xd774('0x1d')],'include':_0x27eecf[_0xd774('0x1f')]?_[_0xd774('0x21')](_0x27eecf[_0xd774('0x1f')],function(_0xc1c4e9){return{'model':db[_0xc1c4e9['model']],'as':_0xc1c4e9['as'],'attributes':_0xc1c4e9['attributes'],'include':_0xc1c4e9[_0xd774('0x1f')]?_[_0xd774('0x21')](_0xc1c4e9['include'],function(_0x6ba02b){return{'model':db[_0x6ba02b[_0xd774('0x20')]],'as':_0x6ba02b['as'],'attributes':_0x6ba02b['attributes']};}):[]};}):[]};}):[]:[]})[_0xd774('0xd')](function(_0x54db82){logger[_0xd774('0xe')](_0xd774('0x23'),_0x528a08);logger[_0xd774('0x10')]('ShowCmHopper',_0x528a08,JSON[_0xd774('0x12')](_0x54db82));_0x2030ef(_0x54db82);})[_0xd774('0x22')](function(_0x3f5eb8){logger[_0xd774('0x13')](_0xd774('0x23'),_0x3f5eb8[_0xd774('0x16')],_0x528a08);_0x4365ce(_0x599738[_0xd774('0x13')](0x1f4,_0x3f5eb8[_0xd774('0x16')]));});});};exports[_0xd774('0x24')]=function(_0x35d17f){var _0x128bd8=this;return new Promise(function(_0x956940,_0x944961){return db[_0xd774('0x18')][_0xd774('0x25')](_0x35d17f['body'],{'raw':_0x35d17f['options']?_0x35d17f[_0xd774('0x1a')][_0xd774('0x1b')]===undefined?!![]:![]:!![]})[_0xd774('0xd')](function(_0x32f791){logger['info'](_0xd774('0x24'),_0x35d17f);logger[_0xd774('0x10')](_0xd774('0x24'),_0x35d17f,JSON['stringify'](_0x32f791));_0x956940(_0x32f791);})[_0xd774('0x22')](function(_0x2465c8){logger[_0xd774('0x13')](_0xd774('0x24'),_0x2465c8['message'],_0x35d17f);_0x944961(_0x128bd8[_0xd774('0x13')](0x1f4,_0x2465c8['message']));});});};exports[_0xd774('0x26')]=function(_0x3cadbd){var _0x428632=this;return new Promise(function(_0x4edf9b,_0x24b951){return db[_0xd774('0x18')]['update'](_0x3cadbd['body'],{'raw':_0x3cadbd[_0xd774('0x1a')]?_0x3cadbd['options'][_0xd774('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cadbd[_0xd774('0x1a')]?_0x3cadbd['options'][_0xd774('0x1c')]||null:null,'attributes':_0x3cadbd[_0xd774('0x1a')]?_0x3cadbd['options'][_0xd774('0x1d')]||null:null,'limit':_0x3cadbd[_0xd774('0x1a')]?_0x3cadbd[_0xd774('0x1a')][_0xd774('0x1e')]||null:null})[_0xd774('0xd')](function(_0x5745f3){logger[_0xd774('0xe')](_0xd774('0x26'),_0x3cadbd);logger[_0xd774('0x10')](_0xd774('0x26'),_0x3cadbd,JSON[_0xd774('0x12')](_0x5745f3));_0x4edf9b(_0x5745f3);})[_0xd774('0x22')](function(_0x2016bd){logger[_0xd774('0x13')](_0xd774('0x26'),_0x2016bd[_0xd774('0x16')],_0x3cadbd);_0x24b951(_0x428632[_0xd774('0x13')](0x1f4,_0x2016bd[_0xd774('0x16')]));});});};exports[_0xd774('0x27')]=function(_0x51c141){var _0x1acd91=this;return new Promise(function(_0x287309,_0x1d2945){return db[_0xd774('0x18')][_0xd774('0x28')]({'where':_0x51c141[_0xd774('0x1a')]?_0x51c141[_0xd774('0x1a')][_0xd774('0x1c')]||null:null})[_0xd774('0xd')](function(_0xb5f4c4){logger['info']('DestroyCmHopper',_0x51c141);logger[_0xd774('0x10')](_0xd774('0x27'),_0x51c141,JSON[_0xd774('0x12')](_0xb5f4c4));_0x287309(_0xb5f4c4);})[_0xd774('0x22')](function(_0x33fac6){logger[_0xd774('0x13')](_0xd774('0x27'),_0x33fac6[_0xd774('0x16')],_0x51c141);_0x1d2945(_0x1acd91[_0xd774('0x13')](0x1f4,_0x33fac6[_0xd774('0x16')]));});});};exports['GetContactDialer']=function(_0x11b35c){var _0x345913=this;return new Promise(function(_0x2894fa,_0x19b6f8){return db['CmContact'][_0xd774('0x29')]()[_0xd774('0xd')](function(_0x20096a){return db[_0xd774('0x2a')][_0xd774('0x2b')](function(_0x372781){return db[_0xd774('0x18')]['findAll']({'where':_0x11b35c['options']?_0x11b35c[_0xd774('0x1a')]['where']||null:null,'attributes':_0x11b35c[_0xd774('0x1a')]?_0x11b35c[_0xd774('0x1a')]['attributes']||null:null,'limit':_0x11b35c[_0xd774('0x1a')]?_0x11b35c[_0xd774('0x1a')][_0xd774('0x1e')]||null:null,'order':_0x11b35c[_0xd774('0x1a')]?_0x11b35c[_0xd774('0x1a')][_0xd774('0x2c')]||null:null,'transaction':_0x372781,'lock':_0x372781[_0xd774('0x2d')][_0xd774('0x2e')],'include':[{'model':db['CmContact'],'as':_0xd774('0x2f'),'attributes':_[_0xd774('0x30')](_0x20096a)},{'model':db[_0xd774('0x31')],'as':_0xd774('0x32'),'attributes':['id',_0xd774('0x33'),_0xd774('0x34')]}]})[_0xd774('0xd')](function(_0x144906){var _0x35d4d0=[];var _0x24642c=[];for(var _0x443bb6=0x0;_0x443bb6<_0x144906[_0xd774('0x35')];_0x443bb6+=0x1){if(!_0x24642c['includes'](_0x144906[_0x443bb6]['UserId'])){_0x24642c[_0xd774('0x36')](_0x144906[_0x443bb6][_0xd774('0x37')]);_0x35d4d0[_0xd774('0x36')](_0x144906[_0x443bb6][_0xd774('0x38')](_0x11b35c[_0xd774('0x39')],{'transaction':_0x372781}));}}return BPromise[_0xd774('0x3a')](_0x35d4d0);});})['then'](function(_0x8af07b){logger['info']('GetContactDialer',_0x11b35c);logger[_0xd774('0x10')](_0xd774('0x3b'),_0x11b35c,JSON[_0xd774('0x12')](_0x8af07b));_0x2894fa(_0x8af07b);})[_0xd774('0x22')](function(_0x48a35c){logger[_0xd774('0x13')](_0xd774('0x3b'),_0x48a35c[_0xd774('0x16')],_0x11b35c);_0x19b6f8(_0x345913[_0xd774('0x13')](0x1f4,_0x48a35c[_0xd774('0x16')]));});});});};exports[_0xd774('0x3c')]=function(_0x3bdf50){var _0x3578f3=this;return new Promise(function(_0x5025ad,_0x2f8d43){return db['sequelize'][_0xd774('0x2b')](function(_0x4307ed){return db[_0xd774('0x3d')][_0xd774('0x25')](_0x3bdf50[_0xd774('0x39')],{'raw':_0x3bdf50[_0xd774('0x1a')]?_0x3bdf50[_0xd774('0x1a')]['raw']===undefined?!![]:![]:!![],'transaction':_0x4307ed})[_0xd774('0xd')](function(){return db['CmHopper'][_0xd774('0x28')]({'where':_0x3bdf50[_0xd774('0x1a')]?_0x3bdf50[_0xd774('0x1a')][_0xd774('0x1c')]||null:null,'transaction':_0x4307ed});});})[_0xd774('0xd')](function(_0x3e4390){logger[_0xd774('0xe')](_0xd774('0x3c'),_0x3bdf50);logger[_0xd774('0x10')](_0xd774('0x3c'),_0x3bdf50,JSON[_0xd774('0x12')](_0x3e4390));_0x5025ad(_0x3e4390);})[_0xd774('0x22')](function(_0x305a81){logger[_0xd774('0x13')](_0xd774('0x3c'),_0x305a81['message'],_0x3bdf50);_0x2f8d43(_0x3578f3[_0xd774('0x13')](0x1f4,_0x305a81['message']));});});};exports[_0xd774('0x3e')]=function(_0x5e9d00){var _0xcce153=this;return new Promise(function(_0x41275b,_0x227fa1){return db[_0xd774('0x18')][_0xd774('0x19')]({'raw':_0x5e9d00[_0xd774('0x1a')]?_0x5e9d00['options'][_0xd774('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e9d00[_0xd774('0x1a')]?_0x5e9d00[_0xd774('0x1a')][_0xd774('0x1c')]||null:null,'attributes':[[db[_0xd774('0x2a')]['fn'](_0xd774('0x3f'),db[_0xd774('0x2a')]['fn']('IF',db[_0xd774('0x2a')][_0xd774('0x40')](_0xd774('0x41')+util[_0xd774('0x42')]('\x22%s\x22',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0xd774('0x43')]]})['then'](function(_0x11ef37){logger[_0xd774('0xe')]('CountReScheduled',_0x5e9d00);logger['debug']('CountReScheduled',_0x5e9d00,JSON[_0xd774('0x12')](_0x11ef37));_0x41275b(_0x11ef37);})[_0xd774('0x22')](function(_0x26ce06){logger[_0xd774('0x13')](_0xd774('0x3e'),_0x26ce06[_0xd774('0x16')],_0x5e9d00);_0x227fa1(_0xcce153[_0xd774('0x13')](0x1f4,_0x26ce06[_0xd774('0x16')]));});});};exports[_0xd774('0x44')]=function(_0x596fa1){var _0x712bb4=this;return new Promise(function(_0xed6a7d,_0x5606c9){return db[_0xd774('0x45')][_0xd774('0x29')]()[_0xd774('0xd')](function(_0x6ad96b){return db[_0xd774('0x2a')]['transaction'](function(_0x26bf99){return db[_0xd774('0x18')][_0xd774('0x19')]({'where':_0x596fa1[_0xd774('0x1a')]?_0x596fa1[_0xd774('0x1a')]['where']||null:null,'attributes':_0x596fa1[_0xd774('0x1a')]?_0x596fa1[_0xd774('0x1a')][_0xd774('0x1d')]||null:null,'limit':0x1,'order':_0x596fa1[_0xd774('0x1a')]?_0x596fa1[_0xd774('0x1a')]['order']||null:null,'group':db[_0xd774('0x18')][_0xd774('0x37')],'transaction':_0x26bf99,'lock':_0x26bf99[_0xd774('0x2d')]['UPDATE'],'include':_0x596fa1[_0xd774('0x1a')]?_0x596fa1[_0xd774('0x1a')][_0xd774('0x1f')]?_[_0xd774('0x21')](_0x596fa1[_0xd774('0x1a')][_0xd774('0x1f')],function(_0x47b37e){return{'model':db[_0x47b37e[_0xd774('0x20')]],'as':_0x47b37e['as'],'attributes':_0x47b37e['attributes'],'include':_0x47b37e[_0xd774('0x1f')]?_[_0xd774('0x21')](_0x47b37e[_0xd774('0x1f')],function(_0x3d89e8){return{'model':db[_0x3d89e8[_0xd774('0x20')]],'as':_0x3d89e8['as'],'attributes':_0x3d89e8['attributes'],'include':_0x3d89e8[_0xd774('0x1f')]?_[_0xd774('0x21')](_0x3d89e8['include'],function(_0x78c8e0){return{'model':db[_0x78c8e0[_0xd774('0x20')]],'as':_0x78c8e0['as'],'attributes':_0x78c8e0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd774('0xd')](function(_0x58d316){var _0x11f064=[];for(var _0x3f71bc=0x0;_0x3f71bc<_0x58d316[_0xd774('0x35')];_0x3f71bc+=0x1){_0x11f064[_0xd774('0x36')](_0x58d316[_0x3f71bc]['update'](_0x596fa1[_0xd774('0x39')],{'transaction':_0x26bf99}));}return BPromise[_0xd774('0x3a')](_0x11f064);});})[_0xd774('0xd')](function(_0x370831){logger[_0xd774('0xe')](_0xd774('0x44'),_0x596fa1);logger[_0xd774('0x10')]('GetContactRecallMe',_0x596fa1,JSON[_0xd774('0x12')](_0x370831));_0xed6a7d(_0x370831);})['catch'](function(_0xcd42c2){logger[_0xd774('0x13')](_0xd774('0x44'),_0xcd42c2[_0xd774('0x16')],_0x596fa1);_0x5606c9(_0x712bb4[_0xd774('0x13')](0x1f4,_0xcd42c2[_0xd774('0x16')]));});});});};exports[_0xd774('0x46')]=function(_0x53b2a2){var _0x1f92be=this;return new Promise(function(_0x56fadd,_0x5e2097){db[_0xd774('0x45')][_0xd774('0x29')]()[_0xd774('0xd')](function(_0x9b51ce){return db['CmHopper'][_0xd774('0x19')]({'raw':_0x53b2a2[_0xd774('0x1a')]?_0x53b2a2[_0xd774('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x53b2a2[_0xd774('0x1a')]?_0x53b2a2[_0xd774('0x1a')][_0xd774('0x1c')]||null:null,'attributes':_0x53b2a2[_0xd774('0x1a')]?_0x53b2a2[_0xd774('0x1a')][_0xd774('0x1d')]||null:null,'limit':_0x53b2a2[_0xd774('0x1a')]?_0x53b2a2[_0xd774('0x1a')][_0xd774('0x1e')]||null:null,'include':_0x53b2a2[_0xd774('0x1a')]?_0x53b2a2[_0xd774('0x1a')][_0xd774('0x1f')]?_[_0xd774('0x21')](_0x53b2a2['options'][_0xd774('0x1f')],function(_0x2dc382){return{'model':db[_0x2dc382['model']],'as':_0x2dc382['as'],'attributes':_0x2dc382['as']===_0xd774('0x2f')?_[_0xd774('0x30')](_0x9b51ce):_0x2dc382[_0xd774('0x1d')],'include':_0x2dc382[_0xd774('0x1f')]?_[_0xd774('0x21')](_0x2dc382[_0xd774('0x1f')],function(_0x46b0c4){return{'model':db[_0x46b0c4['model']],'as':_0x46b0c4['as'],'attributes':_0x46b0c4['attributes'],'include':_0x46b0c4[_0xd774('0x1f')]?_[_0xd774('0x21')](_0x46b0c4[_0xd774('0x1f')],function(_0x4fa801){return{'model':db[_0x4fa801[_0xd774('0x20')]],'as':_0x4fa801['as'],'attributes':_0x4fa801['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x15cf7a){logger['info'](_0xd774('0x17'),_0x53b2a2);logger[_0xd774('0x10')]('GetCmHopper',_0x53b2a2,JSON[_0xd774('0x12')](_0x15cf7a));_0x56fadd(_0x15cf7a);})[_0xd774('0x22')](function(_0x5578ea){logger[_0xd774('0x13')]('GetCmHopper',_0x5578ea[_0xd774('0x16')],_0x53b2a2);_0x5e2097(_0x1f92be[_0xd774('0x13')](0x1f4,_0x5578ea[_0xd774('0x16')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 1f0c10e..34db2c5 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 _0x2cc4=['index','/describe','describe','/opencontacts','/:id','show','post','create','/preview','getPreview','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x22dc67,_0x50989f){var _0x5390d1=function(_0x4bccbf){while(--_0x4bccbf){_0x22dc67['push'](_0x22dc67['shift']());}};_0x5390d1(++_0x50989f);}(_0x2cc4,0x1f0));var _0x42cc=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0x2cc4[_0x443494];return _0x4a6794;};'use strict';var multer=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var path=require(_0x42cc('0x2'));var timeout=require(_0x42cc('0x3'));var express=require('express');var router=express[_0x42cc('0x4')]();var auth=require(_0x42cc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopper.controller');router[_0x42cc('0x6')]('/',auth[_0x42cc('0x7')](),controller[_0x42cc('0x8')]);router[_0x42cc('0x6')](_0x42cc('0x9'),auth['isAuthenticated'](),controller[_0x42cc('0xa')]);router[_0x42cc('0x6')](_0x42cc('0xb'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x42cc('0x6')](_0x42cc('0xc'),auth[_0x42cc('0x7')](),controller[_0x42cc('0xd')]);router[_0x42cc('0xe')]('/',auth[_0x42cc('0x7')](),controller[_0x42cc('0xf')]);router[_0x42cc('0xe')](_0x42cc('0x10'),auth[_0x42cc('0x7')](),controller[_0x42cc('0x11')]);router[_0x42cc('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x42cc('0x13')](_0x42cc('0xc'),auth[_0x42cc('0x7')](),controller['destroy']);module[_0x42cc('0x14')]=router; \ No newline at end of file +var _0x4f7b=['../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/:id','show','create','post','/preview','getPreview','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x1de5e8,_0x453d36){_0x1de5e8=_0x1de5e8-0x0;var _0x397bf0=_0x4f7b[_0x1de5e8];return _0x397bf0;};'use strict';var multer=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var path=require(_0xb4f7('0x2'));var timeout=require(_0xb4f7('0x3'));var express=require('express');var router=express[_0xb4f7('0x4')]();var auth=require(_0xb4f7('0x5'));var interaction=require(_0xb4f7('0x6'));var config=require(_0xb4f7('0x7'));var controller=require(_0xb4f7('0x8'));router[_0xb4f7('0x9')]('/',auth[_0xb4f7('0xa')](),controller[_0xb4f7('0xb')]);router['get'](_0xb4f7('0xc'),auth['isAuthenticated'](),controller[_0xb4f7('0xd')]);router[_0xb4f7('0x9')](_0xb4f7('0xe'),auth['isAuthenticated'](),controller[_0xb4f7('0xf')]);router['get'](_0xb4f7('0x10'),auth[_0xb4f7('0xa')](),controller[_0xb4f7('0x11')]);router['post']('/',auth[_0xb4f7('0xa')](),controller[_0xb4f7('0x12')]);router[_0xb4f7('0x13')](_0xb4f7('0x14'),auth[_0xb4f7('0xa')](),controller[_0xb4f7('0x15')]);router[_0xb4f7('0x16')](_0xb4f7('0x10'),auth['isAuthenticated'](),controller[_0xb4f7('0x17')]);router[_0xb4f7('0x18')](_0xb4f7('0x10'),auth[_0xb4f7('0xa')](),controller[_0xb4f7('0x19')]);module[_0xb4f7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 33141a1..7828773 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 _0x8bb9=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING','DATE','format'];(function(_0x2d7836,_0x5a5412){var _0x491179=function(_0xaafd3){while(--_0xaafd3){_0x2d7836['push'](_0x2d7836['shift']());}};_0x491179(++_0x5a5412);}(_0x8bb9,0x121));var _0x98bb=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x8bb9[_0x4099ee];return _0x1b7bfc;};'use strict';var moment=require(_0x98bb('0x0'));var Sequelize=require(_0x98bb('0x1'));module[_0x98bb('0x2')]={'CmHopperId':{'type':Sequelize[_0x98bb('0x3')]},'phone':{'type':Sequelize[_0x98bb('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x98bb('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x98bb('0x5')],'defaultValue':moment()[_0x98bb('0x6')](_0x98bb('0x7'))},'countbusyretry':{'type':Sequelize[_0x98bb('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x98bb('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x98bb('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x98bb('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x98bb('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x98bb('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x98bb('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x98bb('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x64e7=['INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','exports'];(function(_0x329073,_0x1ceca5){var _0x2182f9=function(_0x589062){while(--_0x589062){_0x329073['push'](_0x329073['shift']());}};_0x2182f9(++_0x1ceca5);}(_0x64e7,0x185));var _0x764e=function(_0x22db59,_0x1abba5){_0x22db59=_0x22db59-0x0;var _0x2b8b79=_0x64e7[_0x22db59];return _0x2b8b79;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x764e('0x0')]={'CmHopperId':{'type':Sequelize[_0x764e('0x1')]},'phone':{'type':Sequelize[_0x764e('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x764e('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x764e('0x3')],'defaultValue':moment()['format'](_0x764e('0x4'))},'countbusyretry':{'type':Sequelize[_0x764e('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x764e('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x764e('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x764e('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x764e('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x764e('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x764e('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 2da12df..72d527c 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 _0xd43e=['end','count','offset','set','apply','reject','save','update','destroy','then','CmHopperAdditionalPhones','UserProfileResource','stack','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','type','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x14eb20,_0xe6df4b){var _0x1ea59e=function(_0x30fa15){while(--_0x30fa15){_0x14eb20['push'](_0x14eb20['shift']());}};_0x1ea59e(++_0xe6df4b);}(_0xd43e,0x88));var _0xed43=function(_0x420adf,_0x46c245){_0x420adf=_0x420adf-0x0;var _0x229e07=_0xd43e[_0x420adf];return _0x229e07;};'use strict';var pdf=require(_0xed43('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed43('0x1'));var zipdir=require(_0xed43('0x2'));var jsonpatch=require(_0xed43('0x3'));var rp=require(_0xed43('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xed43('0x5'));var util=require(_0xed43('0x6'));var path=require(_0xed43('0x7'));var sox=require(_0xed43('0x8'));var csv=require('to-csv');var ejs=require(_0xed43('0x9'));var fs=require('fs');var _=require(_0xed43('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xed43('0xb'));var toCsv=require(_0xed43('0xc'));var querystring=require(_0xed43('0xd'));var Papa=require(_0xed43('0xe'));var Redis=require(_0xed43('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xed43('0x10'));var as=require(_0xed43('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed43('0x12'))(_0xed43('0x13'));var utils=require(_0xed43('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xed43('0x15'))['db'];function respondWithStatusCode(_0x34027b,_0x4eed04){_0x4eed04=_0x4eed04||0xcc;return function(_0x1519aa){if(_0x1519aa){return _0x34027b[_0xed43('0x16')](_0x4eed04);}return _0x34027b[_0xed43('0x17')](_0x4eed04)[_0xed43('0x18')]();};}function respondWithResult(_0x2adbc5,_0x403a89){_0x403a89=_0x403a89||0xc8;return function(_0x597544){if(_0x597544){return _0x2adbc5[_0xed43('0x17')](_0x403a89)['json'](_0x597544);}};}function respondWithFilteredResult(_0x2ec9c3,_0x4a9621){return function(_0x2d457a){if(_0x2d457a){var _0x4caa03=_0x2d457a[_0xed43('0x19')],_0x54ba66=_0x4a9621[_0xed43('0x1a')],_0xbee228=_0x4a9621[_0xed43('0x1a')]+_0x4a9621['limit'],_0x572df2;if(_0xbee228>=_0x4caa03){_0xbee228=_0x4caa03;_0x572df2=0xc8;}else{_0x572df2=0xce;}_0x2ec9c3[_0xed43('0x17')](_0x572df2);return _0x2ec9c3[_0xed43('0x1b')]('Content-Range',_0x54ba66+'-'+_0xbee228+'/'+_0x4caa03)['json'](_0x2d457a);}return null;};}function patchUpdates(_0x18f31c){return function(_0x46a875){try{jsonpatch[_0xed43('0x1c')](_0x46a875,_0x18f31c,!![]);}catch(_0x54426e){return BPromise[_0xed43('0x1d')](_0x54426e);}return _0x46a875[_0xed43('0x1e')]();};}function saveUpdates(_0x5bbd5c,_0x3570ef){return function(_0x470029){if(_0x470029){return _0x470029[_0xed43('0x1f')](_0x5bbd5c)['then'](function(_0x55fa3c){return _0x55fa3c;});}return null;};}function removeEntity(_0x2a6329,_0x42fb48){return function(_0x7f4c4c){if(_0x7f4c4c){return _0x7f4c4c[_0xed43('0x20')]()[_0xed43('0x21')](function(){var _0x45a24a=_0x7f4c4c['get']({'plain':!![]});var _0x414c7a=_0xed43('0x22');return db[_0xed43('0x23')]['destroy']({'where':{'type':_0x414c7a,'resourceId':_0x45a24a['id']}})[_0xed43('0x21')](function(){return _0x7f4c4c;});})[_0xed43('0x21')](function(){_0x2a6329[_0xed43('0x17')](0xcc)[_0xed43('0x18')]();});}};}function handleEntityNotFound(_0x549f91,_0x43e5a0){return function(_0x53f575){if(!_0x53f575){_0x549f91[_0xed43('0x16')](0x194);}return _0x53f575;};}function handleError(_0xed8706,_0x1d9172){_0x1d9172=_0x1d9172||0x1f4;return function(_0x104860){logger['error'](_0x104860[_0xed43('0x24')]);if(_0x104860['name']){delete _0x104860['name'];}_0xed8706[_0xed43('0x17')](_0x1d9172)['send'](_0x104860);};}exports['index']=function(_0x1b2f66,_0x139750){var _0x325ab5={},_0x1f1207={},_0x3c8316={'count':0x0,'rows':[]};var _0x59aa6e=_[_0xed43('0x25')](db[_0xed43('0x26')][_0xed43('0x27')],function(_0x313b8e){return{'name':_0x313b8e[_0xed43('0x28')],'type':_0x313b8e['type'][_0xed43('0x29')]};});_0x1f1207[_0xed43('0x2a')]=_[_0xed43('0x25')](_0x59aa6e,'name');_0x1f1207[_0xed43('0x2b')]=_[_0xed43('0x2c')](_0x1b2f66[_0xed43('0x2b')]);_0x1f1207[_0xed43('0x2d')]=_[_0xed43('0x2e')](_0x1f1207[_0xed43('0x2a')],_0x1f1207[_0xed43('0x2b')]);_0x325ab5[_0xed43('0x2f')]=_['intersection'](_0x1f1207['model'],qs[_0xed43('0x30')](_0x1b2f66['query'][_0xed43('0x30')]));_0x325ab5[_0xed43('0x2f')]=_0x325ab5['attributes'][_0xed43('0x31')]?_0x325ab5[_0xed43('0x2f')]:_0x1f1207[_0xed43('0x2a')];if(!_0x1b2f66[_0xed43('0x2b')][_0xed43('0x32')](_0xed43('0x33'))){_0x325ab5[_0xed43('0x34')]=qs[_0xed43('0x34')](_0x1b2f66['query']['limit']);_0x325ab5[_0xed43('0x1a')]=qs[_0xed43('0x1a')](_0x1b2f66[_0xed43('0x2b')][_0xed43('0x1a')]);}_0x325ab5[_0xed43('0x35')]=qs['sort'](_0x1b2f66[_0xed43('0x2b')]['sort']);_0x325ab5[_0xed43('0x36')]=qs[_0xed43('0x2d')](_[_0xed43('0x37')](_0x1b2f66['query'],_0x1f1207[_0xed43('0x2d')]),_0x59aa6e);if(_0x1b2f66[_0xed43('0x2b')]['filter']){_0x325ab5[_0xed43('0x36')]=_[_0xed43('0x38')](_0x325ab5['where'],{'$or':_[_0xed43('0x25')](_0x59aa6e,function(_0x4e0693){if(_0x4e0693[_0xed43('0x39')]!==_0xed43('0x3a')){var _0x54b9ee={};_0x54b9ee[_0x4e0693[_0xed43('0x3b')]]={'$like':'%'+_0x1b2f66[_0xed43('0x2b')][_0xed43('0x3c')]+'%'};return _0x54b9ee;}})});}_0x325ab5=_['merge']({},_0x325ab5,_0x1b2f66[_0xed43('0x3d')]);var _0x2308ef={'where':_0x325ab5[_0xed43('0x36')]};return db[_0xed43('0x26')][_0xed43('0x19')](_0x2308ef)[_0xed43('0x21')](function(_0x5979f8){_0x3c8316[_0xed43('0x19')]=_0x5979f8;if(_0x1b2f66['query'][_0xed43('0x3e')]){_0x325ab5[_0xed43('0x3f')]=[{'all':!![]}];}return db[_0xed43('0x26')][_0xed43('0x40')](_0x325ab5);})[_0xed43('0x21')](function(_0x3ae865){_0x3c8316[_0xed43('0x41')]=_0x3ae865;return _0x3c8316;})[_0xed43('0x21')](respondWithFilteredResult(_0x139750,_0x325ab5))[_0xed43('0x42')](handleError(_0x139750,null));};exports[_0xed43('0x43')]=function(_0x3ec9c0,_0x57ac6b){var _0x2c2663={'raw':!![],'where':{'id':_0x3ec9c0[_0xed43('0x44')]['id']}},_0x338852={};_0x338852['model']=_[_0xed43('0x2c')](db[_0xed43('0x26')][_0xed43('0x27')]);_0x338852['query']=_[_0xed43('0x2c')](_0x3ec9c0['query']);_0x338852['filters']=_[_0xed43('0x2e')](_0x338852[_0xed43('0x2a')],_0x338852[_0xed43('0x2b')]);_0x2c2663[_0xed43('0x2f')]=_['intersection'](_0x338852[_0xed43('0x2a')],qs[_0xed43('0x30')](_0x3ec9c0['query']['fields']));_0x2c2663[_0xed43('0x2f')]=_0x2c2663['attributes'][_0xed43('0x31')]?_0x2c2663['attributes']:_0x338852[_0xed43('0x2a')];if(_0x3ec9c0[_0xed43('0x2b')][_0xed43('0x3e')]){_0x2c2663[_0xed43('0x3f')]=[{'all':!![]}];}_0x2c2663=_[_0xed43('0x38')]({},_0x2c2663,_0x3ec9c0[_0xed43('0x3d')]);return db['CmHopperAdditionalPhone'][_0xed43('0x45')](_0x2c2663)[_0xed43('0x21')](handleEntityNotFound(_0x57ac6b,null))[_0xed43('0x21')](respondWithResult(_0x57ac6b,null))[_0xed43('0x42')](handleError(_0x57ac6b,null));};exports[_0xed43('0x46')]=function(_0x2a5af6,_0x47e883){return db[_0xed43('0x26')][_0xed43('0x46')](_0x2a5af6[_0xed43('0x47')],{})[_0xed43('0x21')](function(_0x567327){var _0xeda46e=_0x2a5af6[_0xed43('0x48')]['get']({'plain':!![]});if(!_0xeda46e)throw new Error(_0xed43('0x49'));if(_0xeda46e[_0xed43('0x4a')]===_0xed43('0x48')){var _0x3a304b=_0x567327[_0xed43('0x4b')]({'plain':!![]});var _0x2dcb18=_0xed43('0x22');return db[_0xed43('0x4c')][_0xed43('0x45')]({'where':{'name':_0x2dcb18,'userProfileId':_0xeda46e['userProfileId']},'raw':!![]})[_0xed43('0x21')](function(_0x1f66b0){if(_0x1f66b0&&_0x1f66b0[_0xed43('0x4d')]===0x0){return db[_0xed43('0x23')]['create']({'name':_0x3a304b['name'],'resourceId':_0x3a304b['id'],'type':_0x1f66b0[_0xed43('0x3b')],'sectionId':_0x1f66b0['id']},{})[_0xed43('0x21')](function(){return _0x567327;});}else{return _0x567327;}})[_0xed43('0x42')](function(_0x31846d){logger[_0xed43('0x4e')](_0xed43('0x4f'),_0x31846d);throw _0x31846d;});}return _0x567327;})[_0xed43('0x21')](respondWithResult(_0x47e883,0xc9))[_0xed43('0x42')](handleError(_0x47e883,null));};exports['update']=function(_0x25c077,_0x1bce63){if(_0x25c077['body']['id']){delete _0x25c077[_0xed43('0x47')]['id'];}return db[_0xed43('0x26')][_0xed43('0x45')]({'where':{'id':_0x25c077[_0xed43('0x44')]['id']}})[_0xed43('0x21')](handleEntityNotFound(_0x1bce63,null))[_0xed43('0x21')](saveUpdates(_0x25c077[_0xed43('0x47')],null))[_0xed43('0x21')](respondWithResult(_0x1bce63,null))[_0xed43('0x42')](handleError(_0x1bce63,null));};exports[_0xed43('0x20')]=function(_0xc268b7,_0xfdebd4){return db[_0xed43('0x26')]['find']({'where':{'id':_0xc268b7[_0xed43('0x44')]['id']}})['then'](handleEntityNotFound(_0xfdebd4,null))['then'](removeEntity(_0xfdebd4,null))[_0xed43('0x42')](handleError(_0xfdebd4,null));}; \ No newline at end of file +var _0x2dc3=['../../config/license/util','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','CmHopperAdditionalPhone','count','includeAll','include','findAll','rows','catch','show','params','options','create','user','role','CmHopperAdditionalPhones','find','autoAssociation','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','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x9cc1d7,_0x126bd4){var _0x294e87=function(_0x272bd3){while(--_0x272bd3){_0x9cc1d7['push'](_0x9cc1d7['shift']());}};_0x294e87(++_0x126bd4);}(_0x2dc3,0x127));var _0x32dc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2dc3[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x32dc('0x0'));var rimraf=require(_0x32dc('0x1'));var zipdir=require(_0x32dc('0x2'));var jsonpatch=require(_0x32dc('0x3'));var rp=require(_0x32dc('0x4'));var moment=require(_0x32dc('0x5'));var BPromise=require(_0x32dc('0x6'));var Mustache=require(_0x32dc('0x7'));var util=require('util');var path=require('path');var sox=require(_0x32dc('0x8'));var csv=require('to-csv');var ejs=require(_0x32dc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x32dc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32dc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x32dc('0xc'));var Papa=require(_0x32dc('0xd'));var Redis=require(_0x32dc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x32dc('0xf'));var hardwareService=require(_0x32dc('0x10'));var logger=require(_0x32dc('0x11'))(_0x32dc('0x12'));var utils=require(_0x32dc('0x13'));var config=require(_0x32dc('0x14'));var licenseUtil=require(_0x32dc('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36ab9f,_0x480027){_0x480027=_0x480027||0xcc;return function(_0x3b163b){if(_0x3b163b){return _0x36ab9f[_0x32dc('0x16')](_0x480027);}return _0x36ab9f[_0x32dc('0x17')](_0x480027)['end']();};}function respondWithResult(_0x355d98,_0x10f169){_0x10f169=_0x10f169||0xc8;return function(_0x5e373a){if(_0x5e373a){return _0x355d98[_0x32dc('0x17')](_0x10f169)['json'](_0x5e373a);}};}function respondWithFilteredResult(_0x2dee08,_0x5954f3){return function(_0x47fe19){if(_0x47fe19){var _0x497b11=_0x47fe19['count'],_0x2e1a9d=_0x5954f3[_0x32dc('0x18')],_0x328940=_0x5954f3[_0x32dc('0x18')]+_0x5954f3[_0x32dc('0x19')],_0x391c13;if(_0x328940>=_0x497b11){_0x328940=_0x497b11;_0x391c13=0xc8;}else{_0x391c13=0xce;}_0x2dee08['status'](_0x391c13);return _0x2dee08[_0x32dc('0x1a')](_0x32dc('0x1b'),_0x2e1a9d+'-'+_0x328940+'/'+_0x497b11)[_0x32dc('0x1c')](_0x47fe19);}return null;};}function patchUpdates(_0x1710a5){return function(_0x5bbd7c){try{jsonpatch[_0x32dc('0x1d')](_0x5bbd7c,_0x1710a5,!![]);}catch(_0x46249a){return BPromise[_0x32dc('0x1e')](_0x46249a);}return _0x5bbd7c[_0x32dc('0x1f')]();};}function saveUpdates(_0x43b4a3,_0x445c79){return function(_0x43b18c){if(_0x43b18c){return _0x43b18c[_0x32dc('0x20')](_0x43b4a3)['then'](function(_0x227563){return _0x227563;});}return null;};}function removeEntity(_0x37e2d1,_0xd8dd68){return function(_0x2a4bf9){if(_0x2a4bf9){return _0x2a4bf9['destroy']()[_0x32dc('0x21')](function(){var _0x3582af=_0x2a4bf9[_0x32dc('0x22')]({'plain':!![]});var _0x39182b='CmHopperAdditionalPhones';return db[_0x32dc('0x23')][_0x32dc('0x24')]({'where':{'type':_0x39182b,'resourceId':_0x3582af['id']}})[_0x32dc('0x21')](function(){return _0x2a4bf9;});})['then'](function(){_0x37e2d1['status'](0xcc)[_0x32dc('0x25')]();});}};}function handleEntityNotFound(_0x4a0e6e,_0x2e04ea){return function(_0x582651){if(!_0x582651){_0x4a0e6e['sendStatus'](0x194);}return _0x582651;};}function handleError(_0x50ccf4,_0x2664db){_0x2664db=_0x2664db||0x1f4;return function(_0x4a1e63){logger[_0x32dc('0x26')](_0x4a1e63[_0x32dc('0x27')]);if(_0x4a1e63['name']){delete _0x4a1e63[_0x32dc('0x28')];}_0x50ccf4[_0x32dc('0x17')](_0x2664db)[_0x32dc('0x29')](_0x4a1e63);};}exports[_0x32dc('0x2a')]=function(_0x287bb2,_0x41d845){var _0x84c29d={},_0x53dd9e={},_0x1beb46={'count':0x0,'rows':[]};var _0x38c113=_['map'](db['CmHopperAdditionalPhone'][_0x32dc('0x2b')],function(_0x51e50c){return{'name':_0x51e50c[_0x32dc('0x2c')],'type':_0x51e50c['type'][_0x32dc('0x2d')]};});_0x53dd9e[_0x32dc('0x2e')]=_['map'](_0x38c113,_0x32dc('0x28'));_0x53dd9e[_0x32dc('0x2f')]=_[_0x32dc('0x30')](_0x287bb2['query']);_0x53dd9e[_0x32dc('0x31')]=_[_0x32dc('0x32')](_0x53dd9e[_0x32dc('0x2e')],_0x53dd9e[_0x32dc('0x2f')]);_0x84c29d[_0x32dc('0x33')]=_[_0x32dc('0x32')](_0x53dd9e[_0x32dc('0x2e')],qs[_0x32dc('0x34')](_0x287bb2[_0x32dc('0x2f')][_0x32dc('0x34')]));_0x84c29d['attributes']=_0x84c29d[_0x32dc('0x33')][_0x32dc('0x35')]?_0x84c29d[_0x32dc('0x33')]:_0x53dd9e[_0x32dc('0x2e')];if(!_0x287bb2[_0x32dc('0x2f')]['hasOwnProperty'](_0x32dc('0x36'))){_0x84c29d['limit']=qs[_0x32dc('0x19')](_0x287bb2['query'][_0x32dc('0x19')]);_0x84c29d['offset']=qs['offset'](_0x287bb2[_0x32dc('0x2f')][_0x32dc('0x18')]);}_0x84c29d[_0x32dc('0x37')]=qs[_0x32dc('0x38')](_0x287bb2['query'][_0x32dc('0x38')]);_0x84c29d[_0x32dc('0x39')]=qs[_0x32dc('0x31')](_[_0x32dc('0x3a')](_0x287bb2['query'],_0x53dd9e[_0x32dc('0x31')]),_0x38c113);if(_0x287bb2[_0x32dc('0x2f')][_0x32dc('0x3b')]){_0x84c29d[_0x32dc('0x39')]=_[_0x32dc('0x3c')](_0x84c29d['where'],{'$or':_['map'](_0x38c113,function(_0x5c1ccb){if(_0x5c1ccb['type']!=='VIRTUAL'){var _0x10ce28={};_0x10ce28[_0x5c1ccb[_0x32dc('0x28')]]={'$like':'%'+_0x287bb2['query'][_0x32dc('0x3b')]+'%'};return _0x10ce28;}})});}_0x84c29d=_[_0x32dc('0x3c')]({},_0x84c29d,_0x287bb2['options']);var _0x2c7d3b={'where':_0x84c29d[_0x32dc('0x39')]};return db[_0x32dc('0x3d')]['count'](_0x2c7d3b)['then'](function(_0x63b083){_0x1beb46[_0x32dc('0x3e')]=_0x63b083;if(_0x287bb2[_0x32dc('0x2f')][_0x32dc('0x3f')]){_0x84c29d[_0x32dc('0x40')]=[{'all':!![]}];}return db[_0x32dc('0x3d')][_0x32dc('0x41')](_0x84c29d);})[_0x32dc('0x21')](function(_0x12c093){_0x1beb46[_0x32dc('0x42')]=_0x12c093;return _0x1beb46;})[_0x32dc('0x21')](respondWithFilteredResult(_0x41d845,_0x84c29d))[_0x32dc('0x43')](handleError(_0x41d845,null));};exports[_0x32dc('0x44')]=function(_0x4d53f1,_0x5705fe){var _0x431d3a={'raw':!![],'where':{'id':_0x4d53f1[_0x32dc('0x45')]['id']}},_0x2bf523={};_0x2bf523[_0x32dc('0x2e')]=_['keys'](db[_0x32dc('0x3d')][_0x32dc('0x2b')]);_0x2bf523[_0x32dc('0x2f')]=_['keys'](_0x4d53f1[_0x32dc('0x2f')]);_0x2bf523['filters']=_[_0x32dc('0x32')](_0x2bf523[_0x32dc('0x2e')],_0x2bf523[_0x32dc('0x2f')]);_0x431d3a[_0x32dc('0x33')]=_['intersection'](_0x2bf523[_0x32dc('0x2e')],qs['fields'](_0x4d53f1[_0x32dc('0x2f')]['fields']));_0x431d3a[_0x32dc('0x33')]=_0x431d3a[_0x32dc('0x33')][_0x32dc('0x35')]?_0x431d3a[_0x32dc('0x33')]:_0x2bf523[_0x32dc('0x2e')];if(_0x4d53f1[_0x32dc('0x2f')][_0x32dc('0x3f')]){_0x431d3a[_0x32dc('0x40')]=[{'all':!![]}];}_0x431d3a=_[_0x32dc('0x3c')]({},_0x431d3a,_0x4d53f1[_0x32dc('0x46')]);return db[_0x32dc('0x3d')]['find'](_0x431d3a)[_0x32dc('0x21')](handleEntityNotFound(_0x5705fe,null))[_0x32dc('0x21')](respondWithResult(_0x5705fe,null))[_0x32dc('0x43')](handleError(_0x5705fe,null));};exports[_0x32dc('0x47')]=function(_0x5d3bd5,_0x2b9755){return db['CmHopperAdditionalPhone'][_0x32dc('0x47')](_0x5d3bd5['body'],{})['then'](function(_0x79a5b6){var _0xdb438c=_0x5d3bd5[_0x32dc('0x48')][_0x32dc('0x22')]({'plain':!![]});if(!_0xdb438c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xdb438c[_0x32dc('0x49')]===_0x32dc('0x48')){var _0x5f8c53=_0x79a5b6['get']({'plain':!![]});var _0x55daaf=_0x32dc('0x4a');return db['UserProfileSection'][_0x32dc('0x4b')]({'where':{'name':_0x55daaf,'userProfileId':_0xdb438c['userProfileId']},'raw':!![]})['then'](function(_0x35e794){if(_0x35e794&&_0x35e794[_0x32dc('0x4c')]===0x0){return db[_0x32dc('0x23')][_0x32dc('0x47')]({'name':_0x5f8c53['name'],'resourceId':_0x5f8c53['id'],'type':_0x35e794[_0x32dc('0x28')],'sectionId':_0x35e794['id']},{})['then'](function(){return _0x79a5b6;});}else{return _0x79a5b6;}})[_0x32dc('0x43')](function(_0x2056c2){logger[_0x32dc('0x26')](_0x32dc('0x4d'),_0x2056c2);throw _0x2056c2;});}return _0x79a5b6;})[_0x32dc('0x21')](respondWithResult(_0x2b9755,0xc9))['catch'](handleError(_0x2b9755,null));};exports['update']=function(_0x3d479b,_0x4e81b2){if(_0x3d479b[_0x32dc('0x4e')]['id']){delete _0x3d479b[_0x32dc('0x4e')]['id'];}return db[_0x32dc('0x3d')][_0x32dc('0x4b')]({'where':{'id':_0x3d479b[_0x32dc('0x45')]['id']}})[_0x32dc('0x21')](handleEntityNotFound(_0x4e81b2,null))[_0x32dc('0x21')](saveUpdates(_0x3d479b[_0x32dc('0x4e')],null))[_0x32dc('0x21')](respondWithResult(_0x4e81b2,null))[_0x32dc('0x43')](handleError(_0x4e81b2,null));};exports[_0x32dc('0x24')]=function(_0x29944c,_0x37f7be){return db[_0x32dc('0x3d')]['find']({'where':{'id':_0x29944c[_0x32dc('0x45')]['id']}})['then'](handleEntityNotFound(_0x37f7be,null))[_0x32dc('0x21')](removeEntity(_0x37f7be,null))[_0x32dc('0x43')](handleError(_0x37f7be,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index ceec9ca..494c748 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 _0x108c=['exports','cm_hopper_additional_phones','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0x5a26db,_0x2c5ccd){var _0x4619dd=function(_0x21e28f){while(--_0x21e28f){_0x5a26db['push'](_0x5a26db['shift']());}};_0x4619dd(++_0x2c5ccd);}(_0x108c,0x1ec));var _0xc108=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x108c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xc108('0x0'));var util=require('util');var logger=require(_0xc108('0x1'))(_0xc108('0x2'));var moment=require(_0xc108('0x3'));var BPromise=require(_0xc108('0x4'));var rp=require(_0xc108('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc108('0x6'));var attributes=require(_0xc108('0x7'));module[_0xc108('0x8')]=function(_0x1d1eca,_0x837a03){return _0x1d1eca['define']('CmHopperAdditionalPhone',attributes,{'tableName':_0xc108('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf43f=['rimraf','./cmHopperAdditionalPhone.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x21774b,_0x4a6d2b){var _0x4675b2=function(_0xca7eb3){while(--_0xca7eb3){_0x21774b['push'](_0x21774b['shift']());}};_0x4675b2(++_0x4a6d2b);}(_0xf43f,0xf4));var _0xff43=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf43f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xff43('0x0'));var util=require(_0xff43('0x1'));var logger=require(_0xff43('0x2'))(_0xff43('0x3'));var moment=require(_0xff43('0x4'));var BPromise=require(_0xff43('0x5'));var rp=require(_0xff43('0x6'));var fs=require('fs');var path=require(_0xff43('0x7'));var rimraf=require(_0xff43('0x8'));var config=require('../../config/environment');var attributes=require(_0xff43('0x9'));module[_0xff43('0xa')]=function(_0x4367ac,_0x59cd2d){return _0x4367ac[_0xff43('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','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 d766627..ebf64f1 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 _0x5e02=['updatedAt','hopperToAdd','additionalToHop','sequelize','update','IncrementPreviewCounters','field','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','add','minutes','scheduledat','phone','isNil','countabandonedretry','createdAt'];(function(_0x401f3e,_0x345b5d){var _0x1ceec2=function(_0x352481){while(--_0x352481){_0x401f3e['push'](_0x401f3e['shift']());}};_0x1ceec2(++_0x345b5d);}(_0x5e02,0xb5));var _0x25e0=function(_0x3b11b8,_0x59eb5e){_0x3b11b8=_0x3b11b8-0x0;var _0x9fa3a4=_0x5e02[_0x3b11b8];return _0x9fa3a4;};'use strict';var _=require('lodash');var util=require(_0x25e0('0x0'));var moment=require(_0x25e0('0x1'));var BPromise=require(_0x25e0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25e0('0x3'));var db=require(_0x25e0('0x4'))['db'];var utils=require(_0x25e0('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x25e0('0x6'));var client=jayson[_0x25e0('0x7')][_0x25e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fe93f,_0x53abc9,_0x5c8fc1){return new BPromise(function(_0x51e3cf,_0x9bc051){return client[_0x25e0('0x9')](_0x2fe93f,_0x5c8fc1)[_0x25e0('0xa')](function(_0x56be98){logger[_0x25e0('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x53abc9,_0x25e0('0xc'));logger[_0x25e0('0xd')](_0x25e0('0xe'),_0x53abc9,_0x25e0('0xc'),JSON[_0x25e0('0xf')](_0x56be98));if(_0x56be98[_0x25e0('0x10')]){if(_0x56be98[_0x25e0('0x10')]['code']===0x1f4){logger[_0x25e0('0x10')](_0x25e0('0x11'),_0x53abc9,_0x56be98[_0x25e0('0x10')]['message']);return _0x9bc051(_0x56be98['error'][_0x25e0('0x12')]);}logger['error'](_0x25e0('0x11'),_0x53abc9,_0x56be98[_0x25e0('0x10')][_0x25e0('0x12')]);return _0x51e3cf(_0x56be98[_0x25e0('0x10')][_0x25e0('0x12')]);}else{logger['info'](_0x25e0('0x11'),_0x53abc9,_0x25e0('0xc'));_0x51e3cf(_0x56be98[_0x25e0('0x13')]['message']);}})[_0x25e0('0x14')](function(_0x39d572){logger[_0x25e0('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x53abc9,_0x39d572);_0x9bc051(_0x39d572);});});}exports[_0x25e0('0x15')]=function(_0x4768ba){var _0x3154b6=this;return new Promise(function(_0x1693d1,_0x15c616){return db[_0x25e0('0x16')][_0x25e0('0x17')]({'raw':!![],'where':{'ContactId':_0x4768ba[_0x25e0('0x18')][_0x25e0('0x19')],'ListId':_0x4768ba['body'][_0x25e0('0x1a')],'VoiceQueueId':_0x4768ba['body']['VoiceQueueId']===undefined?null:_0x4768ba[_0x25e0('0x18')][_0x25e0('0x1b')],'CampaignId':_0x4768ba[_0x25e0('0x18')][_0x25e0('0x1c')]===undefined?null:_0x4768ba[_0x25e0('0x18')][_0x25e0('0x1c')]}})[_0x25e0('0xa')](function(_0x34ff5c){if(_0x34ff5c!=null){return db[_0x25e0('0x1d')][_0x25e0('0x17')]({'raw':!![],'where':{'CmHopperId':_0x34ff5c['id'],'OrderBy':{'$gt':_0x34ff5c[_0x25e0('0x1e')]}},'order':[['OrderBy',_0x25e0('0x1f')]]})[_0x25e0('0xa')](function(_0x31f19e){var _0x21af04=0x0;if(_0x31f19e){if(_0x31f19e[_0x25e0('0x20')]+_0x31f19e[_0x25e0('0x21')]+_0x31f19e[_0x25e0('0x22')]+_0x31f19e[_0x25e0('0x23')]+_0x31f19e[_0x25e0('0x24')]+_0x31f19e['countabandonedretry']+_0x31f19e[_0x25e0('0x25')]+_0x31f19e[_0x25e0('0x26')]<_0x4768ba[_0x25e0('0x27')][_0x25e0('0x28')])_0x21af04=0x1;_0x1693d1({'additional':_0x21af04});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x34ff5c['id']},'order':[[_0x25e0('0x1e'),_0x25e0('0x1f')]]})['then'](function(_0x9566cd){var _0x579a21=0x0;if(_0x9566cd){if(_0x9566cd[_0x25e0('0x20')]+_0x9566cd[_0x25e0('0x21')]+_0x9566cd[_0x25e0('0x22')]+_0x9566cd[_0x25e0('0x23')]+_0x9566cd[_0x25e0('0x24')]+_0x9566cd['countabandonedretry']+_0x9566cd[_0x25e0('0x25')]+_0x9566cd[_0x25e0('0x26')]<_0x4768ba[_0x25e0('0x27')][_0x25e0('0x28')])_0x579a21=0x1;_0x1693d1({'additional':_0x579a21});}else{_0x1693d1({'additional':0x0});}})[_0x25e0('0x14')](function(_0x3d1146){logger[_0x25e0('0x10')](_0x25e0('0x15'),_0x3d1146[_0x25e0('0x12')],_0x4768ba);_0x15c616(_0x3154b6[_0x25e0('0x10')](0x1f4,_0x3d1146['message']));});}})['catch'](function(_0x40d52d){logger[_0x25e0('0x10')](_0x25e0('0x15'),_0x40d52d[_0x25e0('0x12')],_0x4768ba);_0x15c616(_0x3154b6[_0x25e0('0x10')](0x1f4,_0x40d52d['message']));});}else _0x1693d1({'additional':0x0});});});};exports[_0x25e0('0x29')]=function(_0x2638cb){var _0x57b904=this;return new Promise(function(_0x5e8c1b,_0x5ce4e5){return db[_0x25e0('0x16')][_0x25e0('0x17')]({'raw':!![],'where':{'ContactId':_0x2638cb[_0x25e0('0x18')]['ContactId'],'ListId':_0x2638cb[_0x25e0('0x18')][_0x25e0('0x1a')],'VoiceQueueId':_0x2638cb[_0x25e0('0x18')][_0x25e0('0x1b')]===undefined?null:_0x2638cb[_0x25e0('0x18')][_0x25e0('0x1b')],'CampaignId':_0x2638cb[_0x25e0('0x18')][_0x25e0('0x1c')]===undefined?null:_0x2638cb[_0x25e0('0x18')][_0x25e0('0x1c')]}})[_0x25e0('0xa')](function(_0x41fa35){if(_0x41fa35!=null){return db[_0x25e0('0x1d')][_0x25e0('0x17')]({'raw':!![],'where':{'CmHopperId':_0x41fa35['id'],'OrderBy':{'$gt':_0x41fa35['OrderBy']}},'order':[[_0x25e0('0x1e'),'ASC']]})[_0x25e0('0xa')](function(_0x6e4ebc){if(_0x6e4ebc)return activateAdditionalPhone(_0x41fa35,_0x2638cb['body'],_0x6e4ebc,_0x2638cb[_0x25e0('0x2a')],_0x2638cb['waitTime'])[_0x25e0('0xa')](function(_0x296f37){_0x5e8c1b(_0x296f37);});else{return db[_0x25e0('0x1d')][_0x25e0('0x17')]({'raw':!![],'where':{'CmHopperId':_0x41fa35['id']},'order':[['OrderBy','ASC']]})[_0x25e0('0xa')](function(_0x582d49){if(_0x582d49)return activateAdditionalPhone(_0x41fa35,_0x2638cb['body'],_0x582d49,_0x2638cb['duration'],_0x2638cb[_0x25e0('0x2b')])[_0x25e0('0xa')](function(_0x34a2c1){_0x5e8c1b(_0x34a2c1);});else{_0x5e8c1b({'id':_0x41fa35['id'],'phone':''});}})[_0x25e0('0x14')](function(_0x1cabd0){logger[_0x25e0('0x10')]('VerifyAdditionalPhones',_0x1cabd0['message'],_0x2638cb);_0x5ce4e5(_0x57b904[_0x25e0('0x10')](0x1f4,_0x1cabd0[_0x25e0('0x12')]));});}})[_0x25e0('0x14')](function(_0x2147c4){logger[_0x25e0('0x10')](_0x25e0('0x15'),_0x2147c4['message'],_0x2638cb);_0x5ce4e5(_0x57b904[_0x25e0('0x10')](0x1f4,_0x2147c4[_0x25e0('0x12')]));});}else _0x5e8c1b(0x1);});});};function activateAdditionalPhone(_0x323628,_0xfa6ed5,_0x5e5814,_0x355e13,_0x92c0fa){return new Promise(function(_0x1e7985,_0xc9133b){logger[_0x25e0('0xb')](_0x25e0('0x15'),_0x5e5814);var _0x11ec8e;if(moment()>moment(_0x5e5814['scheduledat'])){_0x11ec8e=moment()[_0x25e0('0x2c')](_0x92c0fa||0x3,_0x25e0('0x2d'));}else{if(_0x5e5814[_0x25e0('0x1e')]==0x0){_0x11ec8e=moment(_0x5e5814[_0x25e0('0x2e')]);}else{_0x11ec8e=moment()['add'](_0x92c0fa||0x3,'minutes');}}var _0x4a5cdd={'phone':_0x323628[_0x25e0('0x2f')],'active':0x0,'OrderBy':_[_0x25e0('0x30')](_0x323628[_0x25e0('0x1e')])?0x0:_0x323628[_0x25e0('0x1e')],'scheduledat':moment()[_0x25e0('0x2c')](_0x355e13||0x1,'minutes'),'countbusyretry':_0xfa6ed5['countbusyretry'],'countcongestionretry':_0xfa6ed5['countcongestionretry'],'countnoanswerretry':_0xfa6ed5[_0x25e0('0x22')],'countnosuchnumberretry':_0xfa6ed5['countnosuchnumberretry'],'countdropretry':_0xfa6ed5[_0x25e0('0x24')],'countabandonedretry':_0xfa6ed5[_0x25e0('0x31')],'countmachineretry':_0xfa6ed5[_0x25e0('0x25')],'countagentrejectretry':_0xfa6ed5[_0x25e0('0x26')],'createdAt':_0xfa6ed5[_0x25e0('0x32')],'updatedAt':_0xfa6ed5[_0x25e0('0x33')]};var _0x24b2b2={'CmHopperId':_0x323628['id'],'phone':_0x5e5814['phone'],'active':0x0,'OrderBy':_[_0x25e0('0x30')](_0x5e5814['OrderBy'])?0x0:_0x5e5814[_0x25e0('0x1e')],'scheduledat':_0x11ec8e,'countbusyretry':_0x5e5814['countbusyretry'],'countcongestionretry':_0x5e5814[_0x25e0('0x21')],'countnoanswerretry':_0x5e5814['countnoanswerretry'],'countnosuchnumberretry':_0xfa6ed5['countnosuchnumberretry'],'countdropretry':_0xfa6ed5[_0x25e0('0x24')],'countabandonedretry':_0xfa6ed5[_0x25e0('0x31')],'countmachineretry':_0xfa6ed5[_0x25e0('0x25')],'countagentrejectretry':_0xfa6ed5[_0x25e0('0x26')],'createdAt':_0x5e5814[_0x25e0('0x32')],'updatedAt':_0x5e5814[_0x25e0('0x33')]};logger[_0x25e0('0xb')](_0x25e0('0x34'),_0x4a5cdd);logger[_0x25e0('0xb')](_0x25e0('0x35'),_0x24b2b2);return db[_0x25e0('0x36')]['transaction'](function(_0x21c588){return db[_0x25e0('0x1d')][_0x25e0('0x37')](_0x4a5cdd,{'where':{'id':_0x5e5814['id']}},{'transaction':_0x21c588})[_0x25e0('0xa')](function(){return db[_0x25e0('0x16')][_0x25e0('0x37')](_0x24b2b2,{'where':{'id':_0x323628['id']}},{'transaction':_0x21c588});});})[_0x25e0('0xa')](function(_0x1e44a7){_0x1e7985({'id':_0x323628['id'],'phone':_0x5e5814['phone']});})[_0x25e0('0x14')](function(_0x89a4bf){logger[_0x25e0('0x10')](_0x25e0('0x15'),_0x89a4bf['message'],req);_0xc9133b(_this[_0x25e0('0x10')](0x1f4,_0x89a4bf[_0x25e0('0x12')]));});});}exports[_0x25e0('0x38')]=function(_0x1c436b){var _0x28fae6=this;return new Promise(function(_0x5260a0,_0x64096c){return db[_0x25e0('0x16')][_0x25e0('0x37')](_0x1c436b['body'][_0x25e0('0x39')],{'where':{'id':_0x1c436b[_0x25e0('0x18')]['id']}})['then'](function(_0x4433fb){_0x5260a0(_0x4433fb);})[_0x25e0('0x14')](function(_0x5c05da){logger[_0x25e0('0x10')](_0x25e0('0x38'),_0x5c05da[_0x25e0('0x12')],_0x1c436b);_0x64096c(_0x28fae6[_0x25e0('0x10')](0x1f4,_0x5c05da[_0x25e0('0x12')]));});});}; \ No newline at end of file +var _0x60b2=['debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VerifyAdditionalPhones','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','duration','waitTime','scheduledat','add','phone','isNil','minutes','createdAt','updatedAt','countdropretry','hopperToAdd','sequelize','transaction','CmHopper','update','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent'];(function(_0x1f22fd,_0x26542f){var _0x5e185c=function(_0x31a04b){while(--_0x31a04b){_0x1f22fd['push'](_0x1f22fd['shift']());}};_0x5e185c(++_0x26542f);}(_0x60b2,0xdf));var _0x260b=function(_0x3b80d6,_0x18a56a){_0x3b80d6=_0x3b80d6-0x0;var _0x4e08f1=_0x60b2[_0x3b80d6];return _0x4e08f1;};'use strict';var _=require(_0x260b('0x0'));var util=require(_0x260b('0x1'));var moment=require(_0x260b('0x2'));var BPromise=require(_0x260b('0x3'));var rs=require(_0x260b('0x4'));var fs=require('fs');var Redis=require(_0x260b('0x5'));var db=require(_0x260b('0x6'))['db'];var utils=require(_0x260b('0x7'));var logger=require(_0x260b('0x8'))(_0x260b('0x9'));var config=require('../../config/environment');var jayson=require(_0x260b('0xa'));var client=jayson[_0x260b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22cff2,_0x20fac1,_0x215a12){return new BPromise(function(_0x5a28bc,_0x35de22){return client[_0x260b('0xc')](_0x22cff2,_0x215a12)[_0x260b('0xd')](function(_0x71ac5f){logger[_0x260b('0xe')](_0x260b('0xf'),_0x20fac1,_0x260b('0x10'));logger[_0x260b('0x11')](_0x260b('0x12'),_0x20fac1,'request\x20sent',JSON[_0x260b('0x13')](_0x71ac5f));if(_0x71ac5f[_0x260b('0x14')]){if(_0x71ac5f[_0x260b('0x14')]['code']===0x1f4){logger[_0x260b('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x20fac1,_0x71ac5f[_0x260b('0x14')][_0x260b('0x15')]);return _0x35de22(_0x71ac5f[_0x260b('0x14')][_0x260b('0x15')]);}logger['error'](_0x260b('0xf'),_0x20fac1,_0x71ac5f['error'][_0x260b('0x15')]);return _0x5a28bc(_0x71ac5f[_0x260b('0x14')][_0x260b('0x15')]);}else{logger['info'](_0x260b('0xf'),_0x20fac1,_0x260b('0x10'));_0x5a28bc(_0x71ac5f[_0x260b('0x16')][_0x260b('0x15')]);}})[_0x260b('0x17')](function(_0x3f3b3f){logger[_0x260b('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x20fac1,_0x3f3b3f);_0x35de22(_0x3f3b3f);});});}exports[_0x260b('0x18')]=function(_0x2e3a57){var _0x522e1c=this;return new Promise(function(_0x2042d2,_0x556e8a){return db['CmHopper'][_0x260b('0x19')]({'raw':!![],'where':{'ContactId':_0x2e3a57['body'][_0x260b('0x1a')],'ListId':_0x2e3a57[_0x260b('0x1b')][_0x260b('0x1c')],'VoiceQueueId':_0x2e3a57[_0x260b('0x1b')][_0x260b('0x1d')]===undefined?null:_0x2e3a57[_0x260b('0x1b')][_0x260b('0x1d')],'CampaignId':_0x2e3a57[_0x260b('0x1b')][_0x260b('0x1e')]===undefined?null:_0x2e3a57['body']['CampaignId']}})['then'](function(_0x2e7f8c){if(_0x2e7f8c!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x2e7f8c['id'],'OrderBy':{'$gt':_0x2e7f8c[_0x260b('0x1f')]}},'order':[[_0x260b('0x1f'),_0x260b('0x20')]]})[_0x260b('0xd')](function(_0xce1b66){var _0x36c312=0x0;if(_0xce1b66){if(_0xce1b66[_0x260b('0x21')]+_0xce1b66[_0x260b('0x22')]+_0xce1b66[_0x260b('0x23')]+_0xce1b66[_0x260b('0x24')]+_0xce1b66['countdropretry']+_0xce1b66[_0x260b('0x25')]+_0xce1b66[_0x260b('0x26')]+_0xce1b66[_0x260b('0x27')]<_0x2e3a57[_0x260b('0x28')][_0x260b('0x29')])_0x36c312=0x1;_0x2042d2({'additional':_0x36c312});}else{return db['CmHopperAdditionalPhone'][_0x260b('0x19')]({'raw':!![],'where':{'CmHopperId':_0x2e7f8c['id']},'order':[['OrderBy',_0x260b('0x20')]]})[_0x260b('0xd')](function(_0x39a394){var _0x388133=0x0;if(_0x39a394){if(_0x39a394['countbusyretry']+_0x39a394['countcongestionretry']+_0x39a394['countnoanswerretry']+_0x39a394[_0x260b('0x24')]+_0x39a394['countdropretry']+_0x39a394[_0x260b('0x25')]+_0x39a394[_0x260b('0x26')]+_0x39a394[_0x260b('0x27')]<_0x2e3a57['entity']['dialGlobalMaxRetry'])_0x388133=0x1;_0x2042d2({'additional':_0x388133});}else{_0x2042d2({'additional':0x0});}})[_0x260b('0x17')](function(_0x4716a2){logger[_0x260b('0x14')]('VerifyAdditionalPhones',_0x4716a2[_0x260b('0x15')],_0x2e3a57);_0x556e8a(_0x522e1c[_0x260b('0x14')](0x1f4,_0x4716a2[_0x260b('0x15')]));});}})[_0x260b('0x17')](function(_0xe80467){logger[_0x260b('0x14')](_0x260b('0x18'),_0xe80467['message'],_0x2e3a57);_0x556e8a(_0x522e1c[_0x260b('0x14')](0x1f4,_0xe80467['message']));});}else _0x2042d2({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x3f467e){var _0x1013ed=this;return new Promise(function(_0x222689,_0x45eeeb){return db['CmHopper'][_0x260b('0x19')]({'raw':!![],'where':{'ContactId':_0x3f467e['body'][_0x260b('0x1a')],'ListId':_0x3f467e['body'][_0x260b('0x1c')],'VoiceQueueId':_0x3f467e[_0x260b('0x1b')][_0x260b('0x1d')]===undefined?null:_0x3f467e[_0x260b('0x1b')][_0x260b('0x1d')],'CampaignId':_0x3f467e['body'][_0x260b('0x1e')]===undefined?null:_0x3f467e[_0x260b('0x1b')][_0x260b('0x1e')]}})['then'](function(_0x18ef6a){if(_0x18ef6a!=null){return db[_0x260b('0x2a')][_0x260b('0x19')]({'raw':!![],'where':{'CmHopperId':_0x18ef6a['id'],'OrderBy':{'$gt':_0x18ef6a[_0x260b('0x1f')]}},'order':[[_0x260b('0x1f'),_0x260b('0x20')]]})[_0x260b('0xd')](function(_0x2bfdbb){if(_0x2bfdbb)return activateAdditionalPhone(_0x18ef6a,_0x3f467e[_0x260b('0x1b')],_0x2bfdbb,_0x3f467e[_0x260b('0x2b')],_0x3f467e[_0x260b('0x2c')])[_0x260b('0xd')](function(_0x6770d4){_0x222689(_0x6770d4);});else{return db[_0x260b('0x2a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x18ef6a['id']},'order':[[_0x260b('0x1f'),_0x260b('0x20')]]})[_0x260b('0xd')](function(_0x39ec81){if(_0x39ec81)return activateAdditionalPhone(_0x18ef6a,_0x3f467e[_0x260b('0x1b')],_0x39ec81,_0x3f467e[_0x260b('0x2b')],_0x3f467e[_0x260b('0x2c')])[_0x260b('0xd')](function(_0x497da1){_0x222689(_0x497da1);});else{_0x222689({'id':_0x18ef6a['id'],'phone':''});}})[_0x260b('0x17')](function(_0x2a8522){logger[_0x260b('0x14')](_0x260b('0x18'),_0x2a8522[_0x260b('0x15')],_0x3f467e);_0x45eeeb(_0x1013ed[_0x260b('0x14')](0x1f4,_0x2a8522['message']));});}})['catch'](function(_0x57e1cd){logger[_0x260b('0x14')](_0x260b('0x18'),_0x57e1cd['message'],_0x3f467e);_0x45eeeb(_0x1013ed['error'](0x1f4,_0x57e1cd[_0x260b('0x15')]));});}else _0x222689(0x1);});});};function activateAdditionalPhone(_0xa14c40,_0x5b2ce3,_0x2aa421,_0x223241,_0x231850){return new Promise(function(_0x3b0b7b,_0x3008ed){logger[_0x260b('0xe')]('VerifyAdditionalPhones',_0x2aa421);var _0x2385d9;if(moment()>moment(_0x2aa421[_0x260b('0x2d')])){_0x2385d9=moment()['add'](_0x231850||0x3,'minutes');}else{if(_0x2aa421[_0x260b('0x1f')]==0x0){_0x2385d9=moment(_0x2aa421[_0x260b('0x2d')]);}else{_0x2385d9=moment()[_0x260b('0x2e')](_0x231850||0x3,'minutes');}}var _0x49eb6b={'phone':_0xa14c40[_0x260b('0x2f')],'active':0x0,'OrderBy':_[_0x260b('0x30')](_0xa14c40[_0x260b('0x1f')])?0x0:_0xa14c40[_0x260b('0x1f')],'scheduledat':moment()['add'](_0x223241||0x1,_0x260b('0x31')),'countbusyretry':_0x5b2ce3['countbusyretry'],'countcongestionretry':_0x5b2ce3[_0x260b('0x22')],'countnoanswerretry':_0x5b2ce3[_0x260b('0x23')],'countnosuchnumberretry':_0x5b2ce3[_0x260b('0x24')],'countdropretry':_0x5b2ce3['countdropretry'],'countabandonedretry':_0x5b2ce3[_0x260b('0x25')],'countmachineretry':_0x5b2ce3[_0x260b('0x26')],'countagentrejectretry':_0x5b2ce3[_0x260b('0x27')],'createdAt':_0x5b2ce3[_0x260b('0x32')],'updatedAt':_0x5b2ce3[_0x260b('0x33')]};var _0x5c3a73={'CmHopperId':_0xa14c40['id'],'phone':_0x2aa421[_0x260b('0x2f')],'active':0x0,'OrderBy':_[_0x260b('0x30')](_0x2aa421[_0x260b('0x1f')])?0x0:_0x2aa421['OrderBy'],'scheduledat':_0x2385d9,'countbusyretry':_0x2aa421['countbusyretry'],'countcongestionretry':_0x2aa421[_0x260b('0x22')],'countnoanswerretry':_0x2aa421[_0x260b('0x23')],'countnosuchnumberretry':_0x5b2ce3[_0x260b('0x24')],'countdropretry':_0x5b2ce3[_0x260b('0x34')],'countabandonedretry':_0x5b2ce3[_0x260b('0x25')],'countmachineretry':_0x5b2ce3[_0x260b('0x26')],'countagentrejectretry':_0x5b2ce3[_0x260b('0x27')],'createdAt':_0x2aa421[_0x260b('0x32')],'updatedAt':_0x2aa421[_0x260b('0x33')]};logger[_0x260b('0xe')](_0x260b('0x35'),_0x49eb6b);logger['info']('additionalToHop',_0x5c3a73);return db[_0x260b('0x36')][_0x260b('0x37')](function(_0x5a0106){return db['CmHopperAdditionalPhone']['update'](_0x49eb6b,{'where':{'id':_0x2aa421['id']}},{'transaction':_0x5a0106})[_0x260b('0xd')](function(){return db[_0x260b('0x38')][_0x260b('0x39')](_0x5c3a73,{'where':{'id':_0xa14c40['id']}},{'transaction':_0x5a0106});});})[_0x260b('0xd')](function(_0x41fd17){_0x3b0b7b({'id':_0xa14c40['id'],'phone':_0x2aa421[_0x260b('0x2f')]});})[_0x260b('0x17')](function(_0x4f60b5){logger[_0x260b('0x14')](_0x260b('0x18'),_0x4f60b5['message'],req);_0x3008ed(_this['error'](0x1f4,_0x4f60b5[_0x260b('0x15')]));});});}exports['IncrementPreviewCounters']=function(_0x29e538){var _0x5db957=this;return new Promise(function(_0x2bb0be,_0x112ffb){return db[_0x260b('0x38')][_0x260b('0x39')](_0x29e538[_0x260b('0x1b')][_0x260b('0x3a')],{'where':{'id':_0x29e538['body']['id']}})[_0x260b('0xd')](function(_0x461bc5){_0x2bb0be(_0x461bc5);})[_0x260b('0x17')](function(_0x3d0855){logger['error'](_0x260b('0x3b'),_0x3d0855['message'],_0x29e538);_0x112ffb(_0x5db957[_0x260b('0x14')](0x1f4,_0x3d0855[_0x260b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index b70ab72..1a60a81 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 _0x8b72=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0xefa40e,_0x5516dd){var _0x15428b=function(_0x5287a6){while(--_0x5287a6){_0xefa40e['push'](_0xefa40e['shift']());}};_0x15428b(++_0x5516dd);}(_0x8b72,0x11a));var _0x28b7=function(_0x23839a,_0x48a677){_0x23839a=_0x23839a-0x0;var _0x27c76b=_0x8b72[_0x23839a];return _0x27c76b;};'use strict';var multer=require(_0x28b7('0x0'));var util=require(_0x28b7('0x1'));var path=require(_0x28b7('0x2'));var timeout=require(_0x28b7('0x3'));var express=require('express');var router=express[_0x28b7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x28b7('0x5'));var config=require(_0x28b7('0x6'));var controller=require(_0x28b7('0x7'));router[_0x28b7('0x8')]('/',auth[_0x28b7('0x9')](),controller[_0x28b7('0xa')]);router[_0x28b7('0x8')](_0x28b7('0xb'),auth['isAuthenticated'](),controller[_0x28b7('0xc')]);router[_0x28b7('0xd')]('/',auth['isAuthenticated'](),controller[_0x28b7('0xe')]);router[_0x28b7('0xf')](_0x28b7('0xb'),auth[_0x28b7('0x9')](),controller[_0x28b7('0x10')]);router[_0x28b7('0x11')](_0x28b7('0xb'),auth['isAuthenticated'](),controller[_0x28b7('0x12')]);module[_0x28b7('0x13')]=router; \ No newline at end of file +var _0xdec3=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x1da718,_0x2f6dd5){var _0x49b662=function(_0x38446a){while(--_0x38446a){_0x1da718['push'](_0x1da718['shift']());}};_0x49b662(++_0x2f6dd5);}(_0xdec3,0x89));var _0x3dec=function(_0x2f6d5a,_0xa62cc4){_0x2f6d5a=_0x2f6d5a-0x0;var _0x1301ad=_0xdec3[_0x2f6d5a];return _0x1301ad;};'use strict';var multer=require(_0x3dec('0x0'));var util=require('util');var path=require(_0x3dec('0x1'));var timeout=require(_0x3dec('0x2'));var express=require(_0x3dec('0x3'));var router=express['Router']();var auth=require(_0x3dec('0x4'));var interaction=require(_0x3dec('0x5'));var config=require(_0x3dec('0x6'));var controller=require(_0x3dec('0x7'));router['get']('/',auth[_0x3dec('0x8')](),controller[_0x3dec('0x9')]);router[_0x3dec('0xa')](_0x3dec('0xb'),auth[_0x3dec('0x8')](),controller[_0x3dec('0xc')]);router[_0x3dec('0xd')]('/',auth['isAuthenticated'](),controller[_0x3dec('0xe')]);router[_0x3dec('0xf')]('/:id',auth[_0x3dec('0x8')](),controller['update']);router['delete'](_0x3dec('0xb'),auth[_0x3dec('0x8')](),controller['destroy']);module[_0x3dec('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 68d0bb1..741d4e2 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 _0x2187=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x940009,_0x32b94b){var _0x1529d2=function(_0x20de13){while(--_0x20de13){_0x940009['push'](_0x940009['shift']());}};_0x1529d2(++_0x32b94b);}(_0x2187,0xc1));var _0x7218=function(_0x215bba,_0x3cddfe){_0x215bba=_0x215bba-0x0;var _0x4047a5=_0x2187[_0x215bba];return _0x4047a5;};'use strict';var moment=require('moment');var Sequelize=require(_0x7218('0x0'));module[_0x7218('0x1')]={'phone':{'type':Sequelize[_0x7218('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7218('0x3')],'unique':_0x7218('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x7218('0x4')},'VoiceQueueId':{'type':Sequelize[_0x7218('0x3')],'unique':_0x7218('0x4')}}; \ No newline at end of file +var _0x0ef1=['moment','exports','STRING','contactListQueue','INTEGER'];(function(_0x170d6d,_0x1d729d){var _0x3d2714=function(_0x36e6f5){while(--_0x36e6f5){_0x170d6d['push'](_0x170d6d['shift']());}};_0x3d2714(++_0x1d729d);}(_0x0ef1,0x14a));var _0x10ef=function(_0x256d19,_0x36751e){_0x256d19=_0x256d19-0x0;var _0x44df29=_0x0ef1[_0x256d19];return _0x44df29;};'use strict';var moment=require(_0x10ef('0x0'));var Sequelize=require('sequelize');module[_0x10ef('0x1')]={'phone':{'type':Sequelize[_0x10ef('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x10ef('0x3')},'VoiceQueueId':{'type':Sequelize[_0x10ef('0x4')],'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 7b44f42..c9b0c28 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 _0x4bff=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','end','stack','name','send','index','CmHopperBlack','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','params','keys','rawAttributes','find','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x48fbb5,_0x30c032){var _0x2c38c1=function(_0x3604cc){while(--_0x3604cc){_0x48fbb5['push'](_0x48fbb5['shift']());}};_0x2c38c1(++_0x30c032);}(_0x4bff,0x1a8));var _0xf4bf=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x4bff[_0x1265ed];return _0x5ac459;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf4bf('0x0'));var rp=require(_0xf4bf('0x1'));var moment=require(_0xf4bf('0x2'));var BPromise=require(_0xf4bf('0x3'));var Mustache=require(_0xf4bf('0x4'));var util=require(_0xf4bf('0x5'));var path=require(_0xf4bf('0x6'));var sox=require(_0xf4bf('0x7'));var csv=require(_0xf4bf('0x8'));var ejs=require(_0xf4bf('0x9'));var fs=require('fs');var _=require(_0xf4bf('0xa'));var squel=require(_0xf4bf('0xb'));var crypto=require(_0xf4bf('0xc'));var jsforce=require(_0xf4bf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf4bf('0x8'));var querystring=require(_0xf4bf('0xe'));var Papa=require(_0xf4bf('0xf'));var Redis=require(_0xf4bf('0x10'));var authService=require(_0xf4bf('0x11'));var qs=require(_0xf4bf('0x12'));var as=require(_0xf4bf('0x13'));var hardwareService=require(_0xf4bf('0x14'));var logger=require(_0xf4bf('0x15'))(_0xf4bf('0x16'));var utils=require(_0xf4bf('0x17'));var config=require(_0xf4bf('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4bf('0x19'))['db'];function respondWithStatusCode(_0x4f93f9,_0x919a76){_0x919a76=_0x919a76||0xcc;return function(_0x4f82ec){if(_0x4f82ec){return _0x4f93f9[_0xf4bf('0x1a')](_0x919a76);}return _0x4f93f9[_0xf4bf('0x1b')](_0x919a76)['end']();};}function respondWithResult(_0x422423,_0x45319c){_0x45319c=_0x45319c||0xc8;return function(_0x47e51c){if(_0x47e51c){return _0x422423[_0xf4bf('0x1b')](_0x45319c)['json'](_0x47e51c);}};}function respondWithFilteredResult(_0x4b3011,_0x5d2046){return function(_0x38d6ee){if(_0x38d6ee){var _0x995f74=_0x38d6ee[_0xf4bf('0x1c')],_0x1d17d0=_0x5d2046[_0xf4bf('0x1d')],_0x3555db=_0x5d2046[_0xf4bf('0x1d')]+_0x5d2046['limit'],_0x311b5b;if(_0x3555db>=_0x995f74){_0x3555db=_0x995f74;_0x311b5b=0xc8;}else{_0x311b5b=0xce;}_0x4b3011[_0xf4bf('0x1b')](_0x311b5b);return _0x4b3011['set'](_0xf4bf('0x1e'),_0x1d17d0+'-'+_0x3555db+'/'+_0x995f74)[_0xf4bf('0x1f')](_0x38d6ee);}return null;};}function patchUpdates(_0x1559ba){return function(_0x412a86){try{jsonpatch[_0xf4bf('0x20')](_0x412a86,_0x1559ba,!![]);}catch(_0x245116){return BPromise[_0xf4bf('0x21')](_0x245116);}return _0x412a86[_0xf4bf('0x22')]();};}function saveUpdates(_0xfee470,_0x23bf0e){return function(_0xb1b9e2){if(_0xb1b9e2){return _0xb1b9e2[_0xf4bf('0x23')](_0xfee470)['then'](function(_0x328ca8){return _0x328ca8;});}return null;};}function removeEntity(_0xfa357,_0x197415){return function(_0x39d467){if(_0x39d467){return _0x39d467[_0xf4bf('0x24')]()[_0xf4bf('0x25')](function(){_0xfa357[_0xf4bf('0x1b')](0xcc)[_0xf4bf('0x26')]();});}};}function handleEntityNotFound(_0x4b9d04,_0x2da330){return function(_0x373f10){if(!_0x373f10){_0x4b9d04['sendStatus'](0x194);}return _0x373f10;};}function handleError(_0xa9285a,_0x57c768){_0x57c768=_0x57c768||0x1f4;return function(_0xc318bf){logger['error'](_0xc318bf[_0xf4bf('0x27')]);if(_0xc318bf['name']){delete _0xc318bf[_0xf4bf('0x28')];}_0xa9285a[_0xf4bf('0x1b')](_0x57c768)[_0xf4bf('0x29')](_0xc318bf);};}exports[_0xf4bf('0x2a')]=function(_0x520f97,_0x502216){var _0x1bf074={},_0x351b47={},_0x562215={'count':0x0,'rows':[]};var _0x2b4027=_['map'](db[_0xf4bf('0x2b')]['rawAttributes'],function(_0x27ee10){return{'name':_0x27ee10[_0xf4bf('0x2c')],'type':_0x27ee10[_0xf4bf('0x2d')]['key']};});_0x351b47[_0xf4bf('0x2e')]=_[_0xf4bf('0x2f')](_0x2b4027,_0xf4bf('0x28'));_0x351b47[_0xf4bf('0x30')]=_['keys'](_0x520f97['query']);_0x351b47[_0xf4bf('0x31')]=_['intersection'](_0x351b47[_0xf4bf('0x2e')],_0x351b47[_0xf4bf('0x30')]);_0x1bf074[_0xf4bf('0x32')]=_[_0xf4bf('0x33')](_0x351b47[_0xf4bf('0x2e')],qs['fields'](_0x520f97[_0xf4bf('0x30')][_0xf4bf('0x34')]));_0x1bf074[_0xf4bf('0x32')]=_0x1bf074[_0xf4bf('0x32')][_0xf4bf('0x35')]?_0x1bf074[_0xf4bf('0x32')]:_0x351b47[_0xf4bf('0x2e')];if(!_0x520f97[_0xf4bf('0x30')][_0xf4bf('0x36')](_0xf4bf('0x37'))){_0x1bf074[_0xf4bf('0x38')]=qs[_0xf4bf('0x38')](_0x520f97[_0xf4bf('0x30')][_0xf4bf('0x38')]);_0x1bf074[_0xf4bf('0x1d')]=qs['offset'](_0x520f97[_0xf4bf('0x30')][_0xf4bf('0x1d')]);}_0x1bf074[_0xf4bf('0x39')]=qs[_0xf4bf('0x3a')](_0x520f97[_0xf4bf('0x30')][_0xf4bf('0x3a')]);_0x1bf074[_0xf4bf('0x3b')]=qs[_0xf4bf('0x31')](_[_0xf4bf('0x3c')](_0x520f97[_0xf4bf('0x30')],_0x351b47[_0xf4bf('0x31')]),_0x2b4027);if(_0x520f97[_0xf4bf('0x30')][_0xf4bf('0x3d')]){_0x1bf074['where']=_[_0xf4bf('0x3e')](_0x1bf074['where'],{'$or':_[_0xf4bf('0x2f')](_0x2b4027,function(_0x2e7d6d){if(_0x2e7d6d['type']!=='VIRTUAL'){var _0x2f2864={};_0x2f2864[_0x2e7d6d[_0xf4bf('0x28')]]={'$like':'%'+_0x520f97[_0xf4bf('0x30')][_0xf4bf('0x3d')]+'%'};return _0x2f2864;}})});}_0x1bf074=_[_0xf4bf('0x3e')]({},_0x1bf074,_0x520f97[_0xf4bf('0x3f')]);var _0x3b0f9={'where':_0x1bf074[_0xf4bf('0x3b')]};return db[_0xf4bf('0x2b')][_0xf4bf('0x1c')](_0x3b0f9)[_0xf4bf('0x25')](function(_0x36d9b0){_0x562215['count']=_0x36d9b0;if(_0x520f97[_0xf4bf('0x30')][_0xf4bf('0x40')]){_0x1bf074[_0xf4bf('0x41')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x1bf074);})[_0xf4bf('0x25')](function(_0x2c9a83){_0x562215[_0xf4bf('0x42')]=_0x2c9a83;return _0x562215;})[_0xf4bf('0x25')](respondWithFilteredResult(_0x502216,_0x1bf074))[_0xf4bf('0x43')](handleError(_0x502216,null));};exports['show']=function(_0x3bb76a,_0x383a26){var _0x3afac9={'raw':!![],'where':{'id':_0x3bb76a[_0xf4bf('0x44')]['id']}},_0xbdb0d4={};_0xbdb0d4[_0xf4bf('0x2e')]=_[_0xf4bf('0x45')](db[_0xf4bf('0x2b')][_0xf4bf('0x46')]);_0xbdb0d4[_0xf4bf('0x30')]=_[_0xf4bf('0x45')](_0x3bb76a[_0xf4bf('0x30')]);_0xbdb0d4[_0xf4bf('0x31')]=_[_0xf4bf('0x33')](_0xbdb0d4['model'],_0xbdb0d4[_0xf4bf('0x30')]);_0x3afac9[_0xf4bf('0x32')]=_[_0xf4bf('0x33')](_0xbdb0d4[_0xf4bf('0x2e')],qs['fields'](_0x3bb76a[_0xf4bf('0x30')]['fields']));_0x3afac9[_0xf4bf('0x32')]=_0x3afac9['attributes'][_0xf4bf('0x35')]?_0x3afac9['attributes']:_0xbdb0d4[_0xf4bf('0x2e')];if(_0x3bb76a[_0xf4bf('0x30')][_0xf4bf('0x40')]){_0x3afac9[_0xf4bf('0x41')]=[{'all':!![]}];}_0x3afac9=_['merge']({},_0x3afac9,_0x3bb76a[_0xf4bf('0x3f')]);return db['CmHopperBlack'][_0xf4bf('0x47')](_0x3afac9)[_0xf4bf('0x25')](handleEntityNotFound(_0x383a26,null))['then'](respondWithResult(_0x383a26,null))[_0xf4bf('0x43')](handleError(_0x383a26,null));};exports['update']=function(_0x33f752,_0x3176e8){if(_0x33f752[_0xf4bf('0x48')]['id']){delete _0x33f752['body']['id'];}return db[_0xf4bf('0x2b')][_0xf4bf('0x47')]({'where':{'id':_0x33f752[_0xf4bf('0x44')]['id']}})[_0xf4bf('0x25')](handleEntityNotFound(_0x3176e8,null))[_0xf4bf('0x25')](saveUpdates(_0x33f752[_0xf4bf('0x48')],null))[_0xf4bf('0x25')](respondWithResult(_0x3176e8,null))['catch'](handleError(_0x3176e8,null));};exports[_0xf4bf('0x24')]=function(_0x5147f8,_0x50bffe){return db[_0xf4bf('0x2b')][_0xf4bf('0x47')]({'where':{'id':_0x5147f8[_0xf4bf('0x44')]['id']}})[_0xf4bf('0x25')](handleEntityNotFound(_0x50bffe,null))[_0xf4bf('0x25')](removeEntity(_0x50bffe,null))[_0xf4bf('0x43')](handleError(_0x50bffe,null));};exports['describe']=function(_0x1db937,_0x3a5ad2){return db[_0xf4bf('0x2b')][_0xf4bf('0x49')]()[_0xf4bf('0x25')](respondWithResult(_0x3a5ad2,null))['catch'](handleError(_0x3a5ad2,null));}; \ No newline at end of file +var _0x80fd=['pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','params','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','end','status','json','count','offset','set','Content-Range','save','update','destroy','then','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x4f9de7,_0x3d96f1){var _0x3a1918=function(_0x28ac7e){while(--_0x28ac7e){_0x4f9de7['push'](_0x4f9de7['shift']());}};_0x3a1918(++_0x3d96f1);}(_0x80fd,0x130));var _0xd80f=function(_0x380006,_0x5b79aa){_0x380006=_0x380006-0x0;var _0x4a5c54=_0x80fd[_0x380006];return _0x4a5c54;};'use strict';var pdf=require(_0xd80f('0x0'));var emlformat=require(_0xd80f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd80f('0x2'));var jsonpatch=require(_0xd80f('0x3'));var rp=require(_0xd80f('0x4'));var moment=require(_0xd80f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd80f('0x6'));var util=require(_0xd80f('0x7'));var path=require(_0xd80f('0x8'));var sox=require('sox');var csv=require(_0xd80f('0x9'));var ejs=require(_0xd80f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd80f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd80f('0xc'));var toCsv=require(_0xd80f('0x9'));var querystring=require(_0xd80f('0xd'));var Papa=require(_0xd80f('0xe'));var Redis=require(_0xd80f('0xf'));var authService=require(_0xd80f('0x10'));var qs=require(_0xd80f('0x11'));var as=require(_0xd80f('0x12'));var hardwareService=require(_0xd80f('0x13'));var logger=require(_0xd80f('0x14'))('api');var utils=require(_0xd80f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b013b,_0x24518f){_0x24518f=_0x24518f||0xcc;return function(_0x146f27){if(_0x146f27){return _0x2b013b[_0xd80f('0x16')](_0x24518f);}return _0x2b013b['status'](_0x24518f)[_0xd80f('0x17')]();};}function respondWithResult(_0x130022,_0x191e95){_0x191e95=_0x191e95||0xc8;return function(_0x530552){if(_0x530552){return _0x130022[_0xd80f('0x18')](_0x191e95)[_0xd80f('0x19')](_0x530552);}};}function respondWithFilteredResult(_0x4d5aba,_0x21bb24){return function(_0x520518){if(_0x520518){var _0x5d2565=_0x520518[_0xd80f('0x1a')],_0x488033=_0x21bb24[_0xd80f('0x1b')],_0x46ce1e=_0x21bb24['offset']+_0x21bb24['limit'],_0x5b3ca3;if(_0x46ce1e>=_0x5d2565){_0x46ce1e=_0x5d2565;_0x5b3ca3=0xc8;}else{_0x5b3ca3=0xce;}_0x4d5aba['status'](_0x5b3ca3);return _0x4d5aba[_0xd80f('0x1c')](_0xd80f('0x1d'),_0x488033+'-'+_0x46ce1e+'/'+_0x5d2565)[_0xd80f('0x19')](_0x520518);}return null;};}function patchUpdates(_0x31293e){return function(_0x14b5bf){try{jsonpatch['apply'](_0x14b5bf,_0x31293e,!![]);}catch(_0x481be7){return BPromise['reject'](_0x481be7);}return _0x14b5bf[_0xd80f('0x1e')]();};}function saveUpdates(_0x54761d,_0x58e857){return function(_0x1887ad){if(_0x1887ad){return _0x1887ad[_0xd80f('0x1f')](_0x54761d)['then'](function(_0x13c8b8){return _0x13c8b8;});}return null;};}function removeEntity(_0x377c76,_0x2c782a){return function(_0x1e50e2){if(_0x1e50e2){return _0x1e50e2[_0xd80f('0x20')]()[_0xd80f('0x21')](function(){_0x377c76[_0xd80f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x545bc4,_0x12f20f){return function(_0x4d34aa){if(!_0x4d34aa){_0x545bc4[_0xd80f('0x16')](0x194);}return _0x4d34aa;};}function handleError(_0x291382,_0x4480b6){_0x4480b6=_0x4480b6||0x1f4;return function(_0x555ed0){logger[_0xd80f('0x22')](_0x555ed0[_0xd80f('0x23')]);if(_0x555ed0[_0xd80f('0x24')]){delete _0x555ed0[_0xd80f('0x24')];}_0x291382[_0xd80f('0x18')](_0x4480b6)[_0xd80f('0x25')](_0x555ed0);};}exports['index']=function(_0x3884bd,_0x65a55b){var _0x42c513={},_0x256ca0={},_0x876f52={'count':0x0,'rows':[]};var _0x1dc6a3=_[_0xd80f('0x26')](db[_0xd80f('0x27')][_0xd80f('0x28')],function(_0x3ae297){return{'name':_0x3ae297[_0xd80f('0x29')],'type':_0x3ae297['type'][_0xd80f('0x2a')]};});_0x256ca0[_0xd80f('0x2b')]=_[_0xd80f('0x26')](_0x1dc6a3,_0xd80f('0x24'));_0x256ca0[_0xd80f('0x2c')]=_[_0xd80f('0x2d')](_0x3884bd[_0xd80f('0x2c')]);_0x256ca0[_0xd80f('0x2e')]=_[_0xd80f('0x2f')](_0x256ca0['model'],_0x256ca0[_0xd80f('0x2c')]);_0x42c513[_0xd80f('0x30')]=_[_0xd80f('0x2f')](_0x256ca0[_0xd80f('0x2b')],qs[_0xd80f('0x31')](_0x3884bd[_0xd80f('0x2c')][_0xd80f('0x31')]));_0x42c513[_0xd80f('0x30')]=_0x42c513[_0xd80f('0x30')][_0xd80f('0x32')]?_0x42c513['attributes']:_0x256ca0[_0xd80f('0x2b')];if(!_0x3884bd[_0xd80f('0x2c')][_0xd80f('0x33')](_0xd80f('0x34'))){_0x42c513['limit']=qs[_0xd80f('0x35')](_0x3884bd[_0xd80f('0x2c')]['limit']);_0x42c513[_0xd80f('0x1b')]=qs[_0xd80f('0x1b')](_0x3884bd[_0xd80f('0x2c')][_0xd80f('0x1b')]);}_0x42c513['order']=qs[_0xd80f('0x36')](_0x3884bd[_0xd80f('0x2c')]['sort']);_0x42c513[_0xd80f('0x37')]=qs['filters'](_[_0xd80f('0x38')](_0x3884bd[_0xd80f('0x2c')],_0x256ca0['filters']),_0x1dc6a3);if(_0x3884bd[_0xd80f('0x2c')]['filter']){_0x42c513['where']=_[_0xd80f('0x39')](_0x42c513[_0xd80f('0x37')],{'$or':_[_0xd80f('0x26')](_0x1dc6a3,function(_0x32dd9f){if(_0x32dd9f[_0xd80f('0x3a')]!==_0xd80f('0x3b')){var _0x2d6675={};_0x2d6675[_0x32dd9f[_0xd80f('0x24')]]={'$like':'%'+_0x3884bd[_0xd80f('0x2c')][_0xd80f('0x3c')]+'%'};return _0x2d6675;}})});}_0x42c513=_[_0xd80f('0x39')]({},_0x42c513,_0x3884bd[_0xd80f('0x3d')]);var _0x974969={'where':_0x42c513[_0xd80f('0x37')]};return db['CmHopperBlack'][_0xd80f('0x1a')](_0x974969)[_0xd80f('0x21')](function(_0x44e822){_0x876f52[_0xd80f('0x1a')]=_0x44e822;if(_0x3884bd[_0xd80f('0x2c')][_0xd80f('0x3e')]){_0x42c513[_0xd80f('0x3f')]=[{'all':!![]}];}return db[_0xd80f('0x27')][_0xd80f('0x40')](_0x42c513);})['then'](function(_0x4430b9){_0x876f52[_0xd80f('0x41')]=_0x4430b9;return _0x876f52;})[_0xd80f('0x21')](respondWithFilteredResult(_0x65a55b,_0x42c513))[_0xd80f('0x42')](handleError(_0x65a55b,null));};exports[_0xd80f('0x43')]=function(_0x300366,_0x26ce95){var _0xca73ab={'raw':!![],'where':{'id':_0x300366['params']['id']}},_0x1c7ad9={};_0x1c7ad9[_0xd80f('0x2b')]=_[_0xd80f('0x2d')](db[_0xd80f('0x27')][_0xd80f('0x28')]);_0x1c7ad9[_0xd80f('0x2c')]=_[_0xd80f('0x2d')](_0x300366['query']);_0x1c7ad9[_0xd80f('0x2e')]=_[_0xd80f('0x2f')](_0x1c7ad9[_0xd80f('0x2b')],_0x1c7ad9['query']);_0xca73ab[_0xd80f('0x30')]=_[_0xd80f('0x2f')](_0x1c7ad9[_0xd80f('0x2b')],qs[_0xd80f('0x31')](_0x300366[_0xd80f('0x2c')][_0xd80f('0x31')]));_0xca73ab[_0xd80f('0x30')]=_0xca73ab['attributes'][_0xd80f('0x32')]?_0xca73ab[_0xd80f('0x30')]:_0x1c7ad9[_0xd80f('0x2b')];if(_0x300366['query'][_0xd80f('0x3e')]){_0xca73ab[_0xd80f('0x3f')]=[{'all':!![]}];}_0xca73ab=_[_0xd80f('0x39')]({},_0xca73ab,_0x300366[_0xd80f('0x3d')]);return db[_0xd80f('0x27')]['find'](_0xca73ab)[_0xd80f('0x21')](handleEntityNotFound(_0x26ce95,null))[_0xd80f('0x21')](respondWithResult(_0x26ce95,null))[_0xd80f('0x42')](handleError(_0x26ce95,null));};exports[_0xd80f('0x1f')]=function(_0x598d4d,_0x593ba4){if(_0x598d4d['body']['id']){delete _0x598d4d['body']['id'];}return db['CmHopperBlack'][_0xd80f('0x44')]({'where':{'id':_0x598d4d[_0xd80f('0x45')]['id']}})['then'](handleEntityNotFound(_0x593ba4,null))[_0xd80f('0x21')](saveUpdates(_0x598d4d[_0xd80f('0x46')],null))['then'](respondWithResult(_0x593ba4,null))['catch'](handleError(_0x593ba4,null));};exports[_0xd80f('0x20')]=function(_0x36fbe7,_0x47d2e9){return db[_0xd80f('0x27')]['find']({'where':{'id':_0x36fbe7['params']['id']}})[_0xd80f('0x21')](handleEntityNotFound(_0x47d2e9,null))['then'](removeEntity(_0x47d2e9,null))['catch'](handleError(_0x47d2e9,null));};exports[_0xd80f('0x47')]=function(_0x2e0699,_0x3fd3da){return db[_0xd80f('0x27')][_0xd80f('0x47')]()['then'](respondWithResult(_0x3fd3da,null))[_0xd80f('0x42')](handleError(_0x3fd3da,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 5286e73..155dd67 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 _0x95dc=['moment','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black'];(function(_0x358b49,_0x5f36f1){var _0xe508f1=function(_0x5ba04e){while(--_0x5ba04e){_0x358b49['push'](_0x358b49['shift']());}};_0xe508f1(++_0x5f36f1);}(_0x95dc,0x7e));var _0xc95d=function(_0xd272eb,_0x18e404){_0xd272eb=_0xd272eb-0x0;var _0x37a5ab=_0x95dc[_0xd272eb];return _0x37a5ab;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc95d('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc95d('0x1'));var config=require(_0xc95d('0x2'));var attributes=require(_0xc95d('0x3'));module[_0xc95d('0x4')]=function(_0x2666f2,_0x5ab8e1){return _0x2666f2['define'](_0xc95d('0x5'),attributes,{'tableName':_0xc95d('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x643b=['./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x643b,0x1a9));var _0xb643=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x643b[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xb643('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb643('0x1'));var moment=require('moment');var BPromise=require(_0xb643('0x2'));var rp=require(_0xb643('0x3'));var fs=require('fs');var path=require(_0xb643('0x4'));var rimraf=require(_0xb643('0x5'));var config=require(_0xb643('0x6'));var attributes=require(_0xb643('0x7'));module[_0xb643('0x8')]=function(_0x12681b,_0x33c645){return _0x12681b[_0xb643('0x9')](_0xb643('0xa'),attributes,{'tableName':_0xb643('0xb'),'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 d10cab2..5550109 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 _0x6f48=['body','raw','destroy','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','options','where','attributes','limit','map','include','model','then','GetCmHopperBlack','UpdateCmHopperBlack','CmHopperBlack','update'];(function(_0xee0297,_0x3530e7){var _0x25be61=function(_0x31916d){while(--_0x31916d){_0xee0297['push'](_0xee0297['shift']());}};_0x25be61(++_0x3530e7);}(_0x6f48,0xc2));var _0x86f4=function(_0x4ca331,_0x428631){_0x4ca331=_0x4ca331-0x0;var _0x1d536d=_0x6f48[_0x4ca331];return _0x1d536d;};'use strict';var _=require(_0x86f4('0x0'));var util=require('util');var moment=require(_0x86f4('0x1'));var BPromise=require(_0x86f4('0x2'));var rs=require(_0x86f4('0x3'));var fs=require('fs');var Redis=require(_0x86f4('0x4'));var db=require(_0x86f4('0x5'))['db'];var utils=require(_0x86f4('0x6'));var logger=require(_0x86f4('0x7'))('rpc');var config=require(_0x86f4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x86f4('0x9')][_0x86f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42784f,_0x343bd3,_0x3e8ebc){return new BPromise(function(_0x29d36f,_0x301c88){return client[_0x86f4('0xb')](_0x42784f,_0x3e8ebc)['then'](function(_0x1422c0){logger[_0x86f4('0xc')](_0x86f4('0xd'),_0x343bd3,_0x86f4('0xe'));logger[_0x86f4('0xf')](_0x86f4('0x10'),_0x343bd3,_0x86f4('0xe'),JSON[_0x86f4('0x11')](_0x1422c0));if(_0x1422c0[_0x86f4('0x12')]){if(_0x1422c0[_0x86f4('0x12')][_0x86f4('0x13')]===0x1f4){logger[_0x86f4('0x12')](_0x86f4('0xd'),_0x343bd3,_0x1422c0['error'][_0x86f4('0x14')]);return _0x301c88(_0x1422c0['error'][_0x86f4('0x14')]);}logger[_0x86f4('0x12')](_0x86f4('0xd'),_0x343bd3,_0x1422c0['error']['message']);return _0x29d36f(_0x1422c0['error'][_0x86f4('0x14')]);}else{logger[_0x86f4('0xc')](_0x86f4('0xd'),_0x343bd3,_0x86f4('0xe'));_0x29d36f(_0x1422c0['result'][_0x86f4('0x14')]);}})[_0x86f4('0x15')](function(_0x5e5139){logger[_0x86f4('0x12')](_0x86f4('0xd'),_0x343bd3,_0x5e5139);_0x301c88(_0x5e5139);});});}exports['GetCmHopperBlack']=function(_0x2463b8){var _0x3d76bd=this;return new Promise(function(_0x234480,_0x403409){return db['CmHopperBlack']['findAll']({'raw':_0x2463b8[_0x86f4('0x16')]?_0x2463b8[_0x86f4('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2463b8['options']?_0x2463b8[_0x86f4('0x16')][_0x86f4('0x17')]||null:null,'attributes':_0x2463b8[_0x86f4('0x16')]?_0x2463b8[_0x86f4('0x16')][_0x86f4('0x18')]||null:null,'limit':_0x2463b8[_0x86f4('0x16')]?_0x2463b8['options'][_0x86f4('0x19')]||null:null,'include':_0x2463b8[_0x86f4('0x16')]?_0x2463b8[_0x86f4('0x16')]['include']?_[_0x86f4('0x1a')](_0x2463b8['options'][_0x86f4('0x1b')],function(_0x263c7e){return{'model':db[_0x263c7e[_0x86f4('0x1c')]],'as':_0x263c7e['as'],'attributes':_0x263c7e['attributes'],'include':_0x263c7e[_0x86f4('0x1b')]?_[_0x86f4('0x1a')](_0x263c7e['include'],function(_0x14ec3e){return{'model':db[_0x14ec3e[_0x86f4('0x1c')]],'as':_0x14ec3e['as'],'attributes':_0x14ec3e[_0x86f4('0x18')],'include':_0x14ec3e[_0x86f4('0x1b')]?_[_0x86f4('0x1a')](_0x14ec3e[_0x86f4('0x1b')],function(_0x3af884){return{'model':db[_0x3af884['model']],'as':_0x3af884['as'],'attributes':_0x3af884['attributes']};}):[]};}):[]};}):[]:[]})[_0x86f4('0x1d')](function(_0x5ac3e5){logger[_0x86f4('0xc')](_0x86f4('0x1e'),_0x2463b8);logger[_0x86f4('0xf')](_0x86f4('0x1e'),_0x2463b8,JSON[_0x86f4('0x11')](_0x5ac3e5));_0x234480(_0x5ac3e5);})[_0x86f4('0x15')](function(_0x3a0906){logger[_0x86f4('0x12')](_0x86f4('0x1e'),_0x3a0906[_0x86f4('0x14')],_0x2463b8);_0x403409(_0x3d76bd[_0x86f4('0x12')](0x1f4,_0x3a0906[_0x86f4('0x14')]));});});};exports[_0x86f4('0x1f')]=function(_0x1b7d5e){var _0x5bec55=this;return new Promise(function(_0xf18b87,_0x1079fc){return db[_0x86f4('0x20')][_0x86f4('0x21')](_0x1b7d5e[_0x86f4('0x22')],{'raw':_0x1b7d5e[_0x86f4('0x16')]?_0x1b7d5e[_0x86f4('0x16')][_0x86f4('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7d5e[_0x86f4('0x16')]?_0x1b7d5e['options'][_0x86f4('0x17')]||null:null,'attributes':_0x1b7d5e[_0x86f4('0x16')]?_0x1b7d5e['options'][_0x86f4('0x18')]||null:null,'limit':_0x1b7d5e[_0x86f4('0x16')]?_0x1b7d5e[_0x86f4('0x16')][_0x86f4('0x19')]||null:null})[_0x86f4('0x1d')](function(_0x2a2bf1){logger[_0x86f4('0xc')](_0x86f4('0x1f'),_0x1b7d5e);logger[_0x86f4('0xf')](_0x86f4('0x1f'),_0x1b7d5e,JSON[_0x86f4('0x11')](_0x2a2bf1));_0xf18b87(_0x2a2bf1);})[_0x86f4('0x15')](function(_0x57b6cc){logger[_0x86f4('0x12')](_0x86f4('0x1f'),_0x57b6cc[_0x86f4('0x14')],_0x1b7d5e);_0x1079fc(_0x5bec55['error'](0x1f4,_0x57b6cc[_0x86f4('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x5c0530){var _0xa049a7=this;return new Promise(function(_0x13429e,_0x3c8546){return db[_0x86f4('0x20')][_0x86f4('0x24')]({'where':_0x5c0530['options']?_0x5c0530['options'][_0x86f4('0x17')]||null:null})[_0x86f4('0x1d')](function(_0x5dc38d){logger[_0x86f4('0xc')](_0x86f4('0x25'),_0x5c0530);logger[_0x86f4('0xf')](_0x86f4('0x25'),_0x5c0530,JSON[_0x86f4('0x11')](_0x5dc38d));_0x13429e(_0x5dc38d);})[_0x86f4('0x15')](function(_0x9aef42){logger[_0x86f4('0x12')]('DestroyCmHopperBlack',_0x9aef42[_0x86f4('0x14')],_0x5c0530);_0x3c8546(_0xa049a7[_0x86f4('0x12')](0x1f4,_0x9aef42[_0x86f4('0x14')]));});});}; \ No newline at end of file +var _0x6145=['jayson/promise','client','http','request','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','stringify','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x33947f,_0x18473e){var _0x4d0a3e=function(_0x359484){while(--_0x359484){_0x33947f['push'](_0x33947f['shift']());}};_0x4d0a3e(++_0x18473e);}(_0x6145,0x1d7));var _0x5614=function(_0x1785a2,_0x15d901){_0x1785a2=_0x1785a2-0x0;var _0x58380c=_0x6145[_0x1785a2];return _0x58380c;};'use strict';var _=require(_0x5614('0x0'));var util=require(_0x5614('0x1'));var moment=require(_0x5614('0x2'));var BPromise=require(_0x5614('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5614('0x4'));var db=require(_0x5614('0x5'))['db'];var utils=require(_0x5614('0x6'));var logger=require(_0x5614('0x7'))(_0x5614('0x8'));var config=require('../../config/environment');var jayson=require(_0x5614('0x9'));var client=jayson[_0x5614('0xa')][_0x5614('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dd0a3,_0x3b6ce7,_0x3d4707){return new BPromise(function(_0xb7adb0,_0x353e68){return client[_0x5614('0xc')](_0x4dd0a3,_0x3d4707)['then'](function(_0x5843c0){logger[_0x5614('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x3b6ce7,_0x5614('0xe'));logger['debug'](_0x5614('0xf'),_0x3b6ce7,_0x5614('0xe'),JSON['stringify'](_0x5843c0));if(_0x5843c0['error']){if(_0x5843c0[_0x5614('0x10')]['code']===0x1f4){logger[_0x5614('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x3b6ce7,_0x5843c0[_0x5614('0x10')][_0x5614('0x11')]);return _0x353e68(_0x5843c0[_0x5614('0x10')][_0x5614('0x11')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x3b6ce7,_0x5843c0[_0x5614('0x10')][_0x5614('0x11')]);return _0xb7adb0(_0x5843c0[_0x5614('0x10')][_0x5614('0x11')]);}else{logger[_0x5614('0xd')](_0x5614('0x12'),_0x3b6ce7,_0x5614('0xe'));_0xb7adb0(_0x5843c0[_0x5614('0x13')][_0x5614('0x11')]);}})[_0x5614('0x14')](function(_0x10ac4f){logger[_0x5614('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x3b6ce7,_0x10ac4f);_0x353e68(_0x10ac4f);});});}exports[_0x5614('0x15')]=function(_0x1f26e5){var _0x2e1a0b=this;return new Promise(function(_0x2f16f2,_0x5c51ee){return db[_0x5614('0x16')][_0x5614('0x17')]({'raw':_0x1f26e5['options']?_0x1f26e5[_0x5614('0x18')][_0x5614('0x19')]===undefined?!![]:![]:!![],'where':_0x1f26e5['options']?_0x1f26e5[_0x5614('0x18')][_0x5614('0x1a')]||null:null,'attributes':_0x1f26e5[_0x5614('0x18')]?_0x1f26e5[_0x5614('0x18')][_0x5614('0x1b')]||null:null,'limit':_0x1f26e5[_0x5614('0x18')]?_0x1f26e5[_0x5614('0x18')][_0x5614('0x1c')]||null:null,'include':_0x1f26e5[_0x5614('0x18')]?_0x1f26e5[_0x5614('0x18')][_0x5614('0x1d')]?_['map'](_0x1f26e5[_0x5614('0x18')][_0x5614('0x1d')],function(_0x36a034){return{'model':db[_0x36a034[_0x5614('0x1e')]],'as':_0x36a034['as'],'attributes':_0x36a034[_0x5614('0x1b')],'include':_0x36a034[_0x5614('0x1d')]?_[_0x5614('0x1f')](_0x36a034[_0x5614('0x1d')],function(_0x4ee9dd){return{'model':db[_0x4ee9dd[_0x5614('0x1e')]],'as':_0x4ee9dd['as'],'attributes':_0x4ee9dd['attributes'],'include':_0x4ee9dd['include']?_['map'](_0x4ee9dd['include'],function(_0x549593){return{'model':db[_0x549593[_0x5614('0x1e')]],'as':_0x549593['as'],'attributes':_0x549593[_0x5614('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5614('0x20')](function(_0x290af5){logger['info'](_0x5614('0x15'),_0x1f26e5);logger[_0x5614('0x21')](_0x5614('0x15'),_0x1f26e5,JSON[_0x5614('0x22')](_0x290af5));_0x2f16f2(_0x290af5);})['catch'](function(_0x9a8d13){logger[_0x5614('0x10')](_0x5614('0x15'),_0x9a8d13[_0x5614('0x11')],_0x1f26e5);_0x5c51ee(_0x2e1a0b['error'](0x1f4,_0x9a8d13[_0x5614('0x11')]));});});};exports[_0x5614('0x23')]=function(_0x89e457){var _0x1492df=this;return new Promise(function(_0x4df3bb,_0x52fe6e){return db[_0x5614('0x16')][_0x5614('0x24')](_0x89e457[_0x5614('0x25')],{'raw':_0x89e457['options']?_0x89e457[_0x5614('0x18')][_0x5614('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x89e457[_0x5614('0x18')]?_0x89e457[_0x5614('0x18')][_0x5614('0x1a')]||null:null,'attributes':_0x89e457[_0x5614('0x18')]?_0x89e457[_0x5614('0x18')][_0x5614('0x1b')]||null:null,'limit':_0x89e457[_0x5614('0x18')]?_0x89e457[_0x5614('0x18')][_0x5614('0x1c')]||null:null})['then'](function(_0x25cabf){logger['info'](_0x5614('0x23'),_0x89e457);logger[_0x5614('0x21')]('UpdateCmHopperBlack',_0x89e457,JSON[_0x5614('0x22')](_0x25cabf));_0x4df3bb(_0x25cabf);})[_0x5614('0x14')](function(_0x69520f){logger[_0x5614('0x10')](_0x5614('0x23'),_0x69520f[_0x5614('0x11')],_0x89e457);_0x52fe6e(_0x1492df[_0x5614('0x10')](0x1f4,_0x69520f[_0x5614('0x11')]));});});};exports[_0x5614('0x26')]=function(_0x226aae){var _0x1eb4d3=this;return new Promise(function(_0x3d3409,_0x1c2d16){return db['CmHopperBlack'][_0x5614('0x27')]({'where':_0x226aae['options']?_0x226aae['options'][_0x5614('0x1a')]||null:null})[_0x5614('0x20')](function(_0x2efc98){logger['info']('DestroyCmHopperBlack',_0x226aae);logger[_0x5614('0x21')](_0x5614('0x26'),_0x226aae,JSON['stringify'](_0x2efc98));_0x3d3409(_0x2efc98);})[_0x5614('0x14')](function(_0x1e1a1d){logger[_0x5614('0x10')]('DestroyCmHopperBlack',_0x1e1a1d[_0x5614('0x11')],_0x226aae);_0x1c2d16(_0x1eb4d3[_0x5614('0x10')](0x1f4,_0x1e1a1d[_0x5614('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 05f818a..dc2fe0f 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 _0x6aa7=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6aa7,0x178));var _0x76aa=function(_0x4159c1,_0x229861){_0x4159c1=_0x4159c1-0x0;var _0x3b0146=_0x6aa7[_0x4159c1];return _0x3b0146;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76aa('0x5'));var config=require(_0x76aa('0x6'));var controller=require(_0x76aa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x76aa('0x8')]);router['get'](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xb')]);router['get'](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xd')]);router['put'](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xe')]);router[_0x76aa('0xf')](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x10')]);module[_0x76aa('0x11')]=router; \ No newline at end of file +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(_0x219bca,_0xe5a6e5){var _0x5e3451=function(_0x29a891){while(--_0x29a891){_0x219bca['push'](_0x219bca['shift']());}};_0x5e3451(++_0xe5a6e5);}(_0x81bd,0x7c));var _0xd81b=function(_0x1b892b,_0x4efe48){_0x1b892b=_0x1b892b-0x0;var _0xa99e57=_0x81bd[_0x1b892b];return _0xa99e57;};'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 diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 18196f6..56acb12 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 _0x5351=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','diff','seconds','dispositionat'];(function(_0x1b78f2,_0x48eb8b){var _0x20e4d5=function(_0x56664e){while(--_0x56664e){_0x1b78f2['push'](_0x1b78f2['shift']());}};_0x20e4d5(++_0x48eb8b);}(_0x5351,0x109));var _0x1535=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5351[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x1535('0x0'));var moment=require(_0x1535('0x1'));module[_0x1535('0x2')]={'state':{'type':Sequelize[_0x1535('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x1535('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1535('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1535('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1535('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1535('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1535('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x1535('0x5')]},'responsetime':{'type':Sequelize[_0x1535('0x5')]},'answertime':{'type':Sequelize[_0x1535('0x5')]},'droptime':{'type':Sequelize[_0x1535('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1535('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1535('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x1535('0x4')]},'membername':{'type':Sequelize[_0x1535('0x4')]},'reason':{'type':Sequelize[_0x1535('0x4')]},'disposition':{'type':Sequelize[_0x1535('0x4')]},'secondDisposition':{'type':Sequelize[_0x1535('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1535('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x585bf6){var _0x4ef35b=this[_0x1535('0x6')]('endtime');if(_0x4ef35b&&_0x585bf6){this[_0x1535('0x7')]('followuptime',moment(_0x585bf6)[_0x1535('0x8')](moment(_0x4ef35b),_0x1535('0x9')));}return this[_0x1535('0x7')](_0x1535('0xa'),_0x585bf6);}},'amd':{'type':Sequelize[_0x1535('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1535('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1535('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x1535('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1535('0x5')]},'callback':{'type':Sequelize[_0x1535('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1535('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x1535('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1535('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x1535('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1535('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1535('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1535('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1535('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xae56=['diff','seconds','setDataValue','dispositionat','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','followuptime'];(function(_0x110704,_0x3c853b){var _0x15805e=function(_0x331483){while(--_0x331483){_0x110704['push'](_0x110704['shift']());}};_0x15805e(++_0x3c853b);}(_0xae56,0xae));var _0x6ae5=function(_0x56261b,_0x1a71d0){_0x56261b=_0x56261b-0x0;var _0x3b6d6e=_0xae56[_0x56261b];return _0x3b6d6e;};'use strict';var Sequelize=require(_0x6ae5('0x0'));var moment=require('moment');module[_0x6ae5('0x1')]={'state':{'type':Sequelize[_0x6ae5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6ae5('0x3')]},'scheduledat':{'type':Sequelize[_0x6ae5('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6ae5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6ae5('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x6ae5('0x3')]},'originatecalleridname':{'type':Sequelize[_0x6ae5('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6ae5('0x4')]},'responsetime':{'type':Sequelize[_0x6ae5('0x4')]},'answertime':{'type':Sequelize[_0x6ae5('0x4')]},'droptime':{'type':Sequelize[_0x6ae5('0x4')]},'endtime':{'type':Sequelize[_0x6ae5('0x4')]},'ringtime':{'type':Sequelize[_0x6ae5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6ae5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6ae5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6ae5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6ae5('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x6ae5('0x3')]},'disposition':{'type':Sequelize[_0x6ae5('0x3')]},'secondDisposition':{'type':Sequelize[_0x6ae5('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6ae5('0x3')]},'dispositionat':{'type':Sequelize[_0x6ae5('0x4')],'set':function(_0x137c33){var _0x966bbc=this[_0x6ae5('0x5')](_0x6ae5('0x6'));if(_0x966bbc&&_0x137c33){this['setDataValue'](_0x6ae5('0x7'),moment(_0x137c33)[_0x6ae5('0x8')](moment(_0x966bbc),_0x6ae5('0x9')));}return this[_0x6ae5('0xa')](_0x6ae5('0xb'),_0x137c33);}},'amd':{'type':Sequelize[_0x6ae5('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6ae5('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6ae5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6ae5('0x4')]},'deleted':{'type':Sequelize[_0x6ae5('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6ae5('0x4')]},'recallme':{'type':Sequelize[_0x6ae5('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6ae5('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x6ae5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6ae5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6ae5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6ae5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6ae5('0x2')],'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 130a8b7..3ff510f 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 _0xf403=['update','then','destroy','name','send','index','CmHopperFinal','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\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','answeringMachine','noAnswerContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','calleridnum','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xf403,0x1d3));var _0x3f40=function(_0x2ea2b4,_0x5ea227){_0x2ea2b4=_0x2ea2b4-0x0;var _0x18e02c=_0xf403[_0x2ea2b4];return _0x18e02c;};'use strict';var pdf=require(_0x3f40('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3f40('0x1'));var zipdir=require(_0x3f40('0x2'));var jsonpatch=require(_0x3f40('0x3'));var rp=require(_0x3f40('0x4'));var moment=require(_0x3f40('0x5'));var BPromise=require(_0x3f40('0x6'));var Mustache=require(_0x3f40('0x7'));var util=require(_0x3f40('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3f40('0x9'));var ejs=require(_0x3f40('0xa'));var fs=require('fs');var _=require(_0x3f40('0xb'));var squel=require(_0x3f40('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f40('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3f40('0xe'));var Papa=require(_0x3f40('0xf'));var Redis=require(_0x3f40('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3f40('0x11'));var hardwareService=require(_0x3f40('0x12'));var logger=require(_0x3f40('0x13'))('api');var utils=require(_0x3f40('0x14'));var config=require(_0x3f40('0x15'));var licenseUtil=require(_0x3f40('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x332635,_0x509c02){_0x509c02=_0x509c02||0xcc;return function(_0x116460){if(_0x116460){return _0x332635[_0x3f40('0x17')](_0x509c02);}return _0x332635[_0x3f40('0x18')](_0x509c02)[_0x3f40('0x19')]();};}function respondWithResult(_0x569c6e,_0x2b2bfe){_0x2b2bfe=_0x2b2bfe||0xc8;return function(_0x308e97){if(_0x308e97){return _0x569c6e[_0x3f40('0x18')](_0x2b2bfe)[_0x3f40('0x1a')](_0x308e97);}};}function respondWithFilteredResult(_0x232241,_0x4e28b9){return function(_0x2e51ed){if(_0x2e51ed){var _0x3d11c9=_0x2e51ed[_0x3f40('0x1b')],_0x535f85=_0x4e28b9[_0x3f40('0x1c')],_0x4ef80e=_0x4e28b9[_0x3f40('0x1c')]+_0x4e28b9[_0x3f40('0x1d')],_0x54f596;if(_0x4ef80e>=_0x3d11c9){_0x4ef80e=_0x3d11c9;_0x54f596=0xc8;}else{_0x54f596=0xce;}_0x232241[_0x3f40('0x18')](_0x54f596);return _0x232241['set'](_0x3f40('0x1e'),_0x535f85+'-'+_0x4ef80e+'/'+_0x3d11c9)[_0x3f40('0x1a')](_0x2e51ed);}return null;};}function patchUpdates(_0x464b26){return function(_0x29405a){try{jsonpatch[_0x3f40('0x1f')](_0x29405a,_0x464b26,!![]);}catch(_0x55337f){return BPromise[_0x3f40('0x20')](_0x55337f);}return _0x29405a['save']();};}function saveUpdates(_0x12aabf,_0x32b945){return function(_0x3f4a93){if(_0x3f4a93){return _0x3f4a93[_0x3f40('0x21')](_0x12aabf)[_0x3f40('0x22')](function(_0x4aa559){return _0x4aa559;});}return null;};}function removeEntity(_0x27f5a5,_0x379b4e){return function(_0x117823){if(_0x117823){return _0x117823[_0x3f40('0x23')]()[_0x3f40('0x22')](function(){_0x27f5a5[_0x3f40('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31fc91,_0x59eb32){return function(_0x5d9e35){if(!_0x5d9e35){_0x31fc91['sendStatus'](0x194);}return _0x5d9e35;};}function handleError(_0x2bc437,_0x487b51){_0x487b51=_0x487b51||0x1f4;return function(_0x37b47e){logger['error'](_0x37b47e['stack']);if(_0x37b47e['name']){delete _0x37b47e[_0x3f40('0x24')];}_0x2bc437[_0x3f40('0x18')](_0x487b51)[_0x3f40('0x25')](_0x37b47e);};}exports[_0x3f40('0x26')]=function(_0x5b1079,_0x300665){var _0x47ec1c={},_0x319997={},_0xbaf5d4={'count':0x0,'rows':[]};var _0xbd4333=_['map'](db[_0x3f40('0x27')]['rawAttributes'],function(_0x1cab5c){return{'name':_0x1cab5c['fieldName'],'type':_0x1cab5c['type'][_0x3f40('0x28')]};});_0x319997[_0x3f40('0x29')]=_[_0x3f40('0x2a')](_0xbd4333,_0x3f40('0x24'));_0x319997[_0x3f40('0x2b')]=_[_0x3f40('0x2c')](_0x5b1079[_0x3f40('0x2b')]);_0x319997[_0x3f40('0x2d')]=_['intersection'](_0x319997[_0x3f40('0x29')],_0x319997[_0x3f40('0x2b')]);_0x47ec1c[_0x3f40('0x2e')]=_[_0x3f40('0x2f')](_0x319997[_0x3f40('0x29')],qs['fields'](_0x5b1079[_0x3f40('0x2b')][_0x3f40('0x30')]));_0x47ec1c[_0x3f40('0x2e')]=_0x47ec1c['attributes'][_0x3f40('0x31')]?_0x47ec1c[_0x3f40('0x2e')]:_0x319997[_0x3f40('0x29')];if(!_0x5b1079[_0x3f40('0x2b')][_0x3f40('0x32')](_0x3f40('0x33'))){_0x47ec1c[_0x3f40('0x1d')]=qs[_0x3f40('0x1d')](_0x5b1079[_0x3f40('0x2b')][_0x3f40('0x1d')]);_0x47ec1c[_0x3f40('0x1c')]=qs[_0x3f40('0x1c')](_0x5b1079[_0x3f40('0x2b')][_0x3f40('0x1c')]);}_0x47ec1c[_0x3f40('0x34')]=qs[_0x3f40('0x35')](_0x5b1079[_0x3f40('0x2b')][_0x3f40('0x35')]);_0x47ec1c[_0x3f40('0x36')]=qs[_0x3f40('0x2d')](_[_0x3f40('0x37')](_0x5b1079[_0x3f40('0x2b')],_0x319997[_0x3f40('0x2d')]),_0xbd4333);if(_0x5b1079[_0x3f40('0x2b')][_0x3f40('0x38')]){_0x47ec1c[_0x3f40('0x36')]=_[_0x3f40('0x39')](_0x47ec1c[_0x3f40('0x36')],{'$or':_[_0x3f40('0x2a')](_0xbd4333,function(_0x2df15b){if(_0x2df15b['type']!=='VIRTUAL'){var _0x1b5d96={};_0x1b5d96[_0x2df15b[_0x3f40('0x24')]]={'$like':'%'+_0x5b1079[_0x3f40('0x2b')][_0x3f40('0x38')]+'%'};return _0x1b5d96;}})});}_0x47ec1c=_[_0x3f40('0x39')]({},_0x47ec1c,_0x5b1079[_0x3f40('0x3a')]);var _0x1ffa33={'where':_0x47ec1c['where']};return db[_0x3f40('0x27')]['count'](_0x1ffa33)[_0x3f40('0x22')](function(_0x3bec11){_0xbaf5d4[_0x3f40('0x1b')]=_0x3bec11;if(_0x5b1079['query'][_0x3f40('0x3b')]){_0x47ec1c[_0x3f40('0x3c')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3f40('0x3d')](_0x47ec1c);})[_0x3f40('0x22')](function(_0x4b1a66){_0xbaf5d4[_0x3f40('0x3e')]=_0x4b1a66;return _0xbaf5d4;})['then'](respondWithFilteredResult(_0x300665,_0x47ec1c))[_0x3f40('0x3f')](handleError(_0x300665,null));};exports['show']=function(_0x557f27,_0x8e89a){var _0x4bf783={'raw':!![],'where':{'id':_0x557f27[_0x3f40('0x40')]['id']}},_0x2210bc={};_0x2210bc[_0x3f40('0x29')]=_[_0x3f40('0x2c')](db['CmHopperFinal'][_0x3f40('0x41')]);_0x2210bc['query']=_[_0x3f40('0x2c')](_0x557f27[_0x3f40('0x2b')]);_0x2210bc[_0x3f40('0x2d')]=_['intersection'](_0x2210bc['model'],_0x2210bc[_0x3f40('0x2b')]);_0x4bf783[_0x3f40('0x2e')]=_[_0x3f40('0x2f')](_0x2210bc[_0x3f40('0x29')],qs[_0x3f40('0x30')](_0x557f27[_0x3f40('0x2b')][_0x3f40('0x30')]));_0x4bf783[_0x3f40('0x2e')]=_0x4bf783['attributes'][_0x3f40('0x31')]?_0x4bf783['attributes']:_0x2210bc['model'];if(_0x557f27[_0x3f40('0x2b')][_0x3f40('0x3b')]){_0x4bf783[_0x3f40('0x3c')]=[{'all':!![]}];}_0x4bf783=_[_0x3f40('0x39')]({},_0x4bf783,_0x557f27[_0x3f40('0x3a')]);return db[_0x3f40('0x27')][_0x3f40('0x42')](_0x4bf783)[_0x3f40('0x22')](handleEntityNotFound(_0x8e89a,null))[_0x3f40('0x22')](respondWithResult(_0x8e89a,null))[_0x3f40('0x3f')](handleError(_0x8e89a,null));};exports[_0x3f40('0x43')]=function(_0x10678b,_0x2068ab){return db[_0x3f40('0x27')]['describe']()[_0x3f40('0x22')](respondWithResult(_0x2068ab,null))['catch'](handleError(_0x2068ab,null));};exports[_0x3f40('0x21')]=function(_0x2f16d6,_0x50b268){if(_0x2f16d6[_0x3f40('0x44')][_0x3f40('0x45')]){delete _0x2f16d6[_0x3f40('0x44')][_0x3f40('0x45')];}return db[_0x3f40('0x27')][_0x3f40('0x42')]({'where':{'uniqueid':_0x2f16d6[_0x3f40('0x40')]['id']}})[_0x3f40('0x22')](handleEntityNotFound(_0x50b268,null))[_0x3f40('0x22')](saveUpdates(_0x2f16d6[_0x3f40('0x44')],null))[_0x3f40('0x22')](respondWithResult(_0x50b268,null))[_0x3f40('0x3f')](handleError(_0x50b268,null));};exports[_0x3f40('0x46')]=function(_0x421670,_0x171c13,_0x3cbcd3){return db[_0x3f40('0x27')][_0x3f40('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x421670[_0x3f40('0x40')]['id']},'attributes':[[db[_0x3f40('0x47')]['fn'](_0x3f40('0x48'),db['sequelize']['fn']('IF',db[_0x3f40('0x47')][_0x3f40('0x49')](_0x3f40('0x4a')))),_0x3f40('0x4b')],[db[_0x3f40('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3f40('0x49')](_0x3f40('0x4c')))),'noAnswerContacts'],[db[_0x3f40('0x47')]['fn'](_0x3f40('0x48'),db['sequelize']['fn']('IF',db[_0x3f40('0x47')]['literal'](_0x3f40('0x4d')))),_0x3f40('0x4e')],[db[_0x3f40('0x47')]['fn'](_0x3f40('0x48'),db[_0x3f40('0x47')]['fn']('IF',db[_0x3f40('0x47')][_0x3f40('0x49')](_0x3f40('0x4f')))),_0x3f40('0x50')],[db[_0x3f40('0x47')]['fn'](_0x3f40('0x48'),db[_0x3f40('0x47')]['fn']('IF',db[_0x3f40('0x47')]['literal'](_0x3f40('0x51')))),_0x3f40('0x52')],[db[_0x3f40('0x47')]['fn'](_0x3f40('0x48'),db[_0x3f40('0x47')]['fn']('IF',db['sequelize'][_0x3f40('0x49')](_0x3f40('0x53')))),_0x3f40('0x54')],[db[_0x3f40('0x47')]['fn'](_0x3f40('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x3f40('0x49')](_0x3f40('0x55')))),'reCallContacts'],[db[_0x3f40('0x47')]['fn']('COUNT',db[_0x3f40('0x47')]['fn']('IF',db['sequelize'][_0x3f40('0x49')]('`state`\x20=\x2019,\x201,\x20null'))),_0x3f40('0x56')]]})[_0x3f40('0x22')](handleEntityNotFound(_0x171c13,null))[_0x3f40('0x22')](respondWithResult(_0x171c13,null))['catch'](handleError(_0x171c13,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4b4d14,_0x56e654,_0x273739){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x4b4d14[_0x3f40('0x40')]['id']},'attributes':[[db[_0x3f40('0x47')]['fn'](_0x3f40('0x48'),db[_0x3f40('0x47')]['fn']('IF',db['sequelize'][_0x3f40('0x49')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x3f40('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x3f40('0x49')](_0x3f40('0x4c')))),_0x3f40('0x57')],[db[_0x3f40('0x47')]['fn'](_0x3f40('0x48'),db['sequelize']['fn']('IF',db[_0x3f40('0x47')]['literal'](_0x3f40('0x4d')))),_0x3f40('0x4e')],[db[_0x3f40('0x47')]['fn']('COUNT',db[_0x3f40('0x47')]['fn']('IF',db[_0x3f40('0x47')][_0x3f40('0x49')](_0x3f40('0x4f')))),_0x3f40('0x50')],[db['sequelize']['fn'](_0x3f40('0x48'),db[_0x3f40('0x47')]['fn']('IF',db[_0x3f40('0x47')][_0x3f40('0x49')](_0x3f40('0x51')))),_0x3f40('0x52')],[db[_0x3f40('0x47')]['fn'](_0x3f40('0x48'),db[_0x3f40('0x47')]['fn']('IF',db[_0x3f40('0x47')][_0x3f40('0x49')](_0x3f40('0x53')))),'abandonedContacts'],[db['sequelize']['fn']('COUNT',db[_0x3f40('0x47')]['fn']('IF',db[_0x3f40('0x47')][_0x3f40('0x49')](_0x3f40('0x55')))),_0x3f40('0x58')],[db[_0x3f40('0x47')]['fn']('COUNT',db[_0x3f40('0x47')]['fn']('IF',db['sequelize'][_0x3f40('0x49')](_0x3f40('0x59')))),_0x3f40('0x56')]]})[_0x3f40('0x22')](handleEntityNotFound(_0x56e654,null))[_0x3f40('0x22')](respondWithResult(_0x56e654,null))['catch'](handleError(_0x56e654,null));};exports[_0x3f40('0x5a')]=function(_0x54667a,_0x4a333a,_0xba4554){return db['VoiceQueue'][_0x3f40('0x42')]({'where':{'id':_0x54667a[_0x3f40('0x40')]['id']}})[_0x3f40('0x22')](handleEntityNotFound(_0x4a333a,null))[_0x3f40('0x22')](function(_0xad9005){var _0x391997;if(_0xad9005){_0x391997=squel[_0x3f40('0x5b')]()['into'](_0x3f40('0x5c'))[_0x3f40('0x5d')]([_0x3f40('0x5e'),_0x3f40('0x5f'),_0x3f40('0x60'),'ListId',_0x3f40('0x61'),_0x3f40('0x62'),_0x3f40('0x63')],squel[_0x3f40('0x64')]()[_0x3f40('0x65')](_0x3f40('0x66'),'phone')[_0x3f40('0x65')](_0x3f40('0x67'),_0x3f40('0x5f'))[_0x3f40('0x65')](_0x3f40('0x68'),'ContactId')['field']('ANY_VALUE(ListId)',_0x3f40('0x69'))[_0x3f40('0x65')](_0x3f40('0x6a'),_0x3f40('0x61'))[_0x3f40('0x65')](_0x3f40('0x67'),_0x3f40('0x62'))[_0x3f40('0x65')](_0x3f40('0x67'),_0x3f40('0x63'))[_0x3f40('0x6b')](_0x3f40('0x6c'))[_0x3f40('0x36')]('VoiceQueueId\x20=\x20?',_0x54667a[_0x3f40('0x40')]['id'][_0x3f40('0x6d')]())[_0x3f40('0x36')]('state\x20=\x20?',_0x54667a['body'][_0x3f40('0x6e')][_0x3f40('0x6d')]())[_0x3f40('0x36')](_0x3f40('0x6f'))['where'](_0x3f40('0x70'),squel[_0x3f40('0x64')]()[_0x3f40('0x65')](_0x3f40('0x5e'))[_0x3f40('0x6b')](_0x3f40('0x5c'))[_0x3f40('0x36')](_0x3f40('0x71'),_0x54667a[_0x3f40('0x40')]['id'][_0x3f40('0x6d')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3f40('0x64')]()[_0x3f40('0x65')](_0x3f40('0x72'))[_0x3f40('0x6b')]('cm_hopper_final')[_0x3f40('0x36')](_0x3f40('0x71'),_0x54667a[_0x3f40('0x40')]['id'][_0x3f40('0x6d')]())[_0x3f40('0x36')]('state\x20=\x204'))['group'](_0x3f40('0x60')))[_0x3f40('0x6d')]();return db[_0x3f40('0x47')]['query'](_0x391997);}return[];})[_0x3f40('0x22')](respondWithResult(_0x4a333a,null))[_0x3f40('0x3f')](handleError(_0x4a333a,null));};exports[_0x3f40('0x73')]=function(_0x53eade,_0x4cbc7b,_0xd842ca){return db[_0x3f40('0x74')][_0x3f40('0x42')]({'where':{'id':_0x53eade[_0x3f40('0x40')]['id']}})[_0x3f40('0x22')](handleEntityNotFound(_0x4cbc7b,null))[_0x3f40('0x22')](function(_0x330d5a){var _0x59c918;if(_0x330d5a){_0x59c918=squel[_0x3f40('0x5b')]()['into'](_0x3f40('0x5c'))['fromQuery'](['phone',_0x3f40('0x5f'),'ContactId','ListId',_0x3f40('0x75'),_0x3f40('0x62'),_0x3f40('0x63')],squel[_0x3f40('0x64')]()[_0x3f40('0x65')](_0x3f40('0x66'),_0x3f40('0x5e'))['field'](_0x3f40('0x67'),'scheduledAt')['field'](_0x3f40('0x68'),_0x3f40('0x60'))[_0x3f40('0x65')]('ANY_VALUE(ListId)',_0x3f40('0x69'))['field']('ANY_VALUE(CampaignId)','CampaignId')['field']('NOW()','createdAt')[_0x3f40('0x65')](_0x3f40('0x67'),_0x3f40('0x63'))[_0x3f40('0x6b')](_0x3f40('0x6c'))[_0x3f40('0x36')](_0x3f40('0x76'),_0x53eade[_0x3f40('0x40')]['id']['toString']())[_0x3f40('0x36')](_0x3f40('0x77'),_0x53eade[_0x3f40('0x44')][_0x3f40('0x6e')][_0x3f40('0x6d')]())[_0x3f40('0x36')](_0x3f40('0x6f'))[_0x3f40('0x36')](_0x3f40('0x70'),squel[_0x3f40('0x64')]()['field'](_0x3f40('0x5e'))[_0x3f40('0x6b')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x53eade[_0x3f40('0x40')]['id']['toString']()))[_0x3f40('0x36')](_0x3f40('0x70'),squel['select']()[_0x3f40('0x65')](_0x3f40('0x72'))[_0x3f40('0x6b')](_0x3f40('0x6c'))[_0x3f40('0x36')](_0x3f40('0x76'),_0x53eade[_0x3f40('0x40')]['id'][_0x3f40('0x6d')]())[_0x3f40('0x36')](_0x3f40('0x78')))[_0x3f40('0x79')](_0x3f40('0x60')))[_0x3f40('0x6d')]();return db[_0x3f40('0x47')][_0x3f40('0x2b')](_0x59c918);}return[];})['then'](respondWithResult(_0x4cbc7b,null))[_0x3f40('0x3f')](handleError(_0x4cbc7b,null));};exports[_0x3f40('0x7a')]=function(_0x3df1f4,_0x1926d3,_0xec63eb){return db[_0x3f40('0x7b')][_0x3f40('0x7c')]({'where':{'VoiceQueueId':_0x3df1f4['body'][_0x3f40('0x61')],'CampaignId':_0x3df1f4['body'][_0x3f40('0x75')],'ContactId':_0x3df1f4['body']['ContactId']}})[_0x3f40('0x22')](handleEntityNotFound(_0x1926d3,null))[_0x3f40('0x22')](function(_0x5420b1){if(_0x5420b1){return _0x5420b1;}return null;})[_0x3f40('0x22')](respondWithResult(_0x1926d3,null))['catch'](handleError(_0x1926d3,null));}; \ No newline at end of file +var _0x41bb=['VIRTUAL','options','catch','show','rawAttributes','includeAll','describe','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','findAll','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`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=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','phone','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','NOW()','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','CampaignId','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','update','then','destroy','stack','name','send','map','CmHopperFinal','fieldName','key','keys','filters','intersection','query','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','type'];(function(_0x4ea728,_0x3ba8a8){var _0x290764=function(_0x35f0e0){while(--_0x35f0e0){_0x4ea728['push'](_0x4ea728['shift']());}};_0x290764(++_0x3ba8a8);}(_0x41bb,0xc5));var _0xb41b=function(_0x1a6da5,_0x350982){_0x1a6da5=_0x1a6da5-0x0;var _0xc79889=_0x41bb[_0x1a6da5];return _0xc79889;};'use strict';var pdf=require(_0xb41b('0x0'));var emlformat=require(_0xb41b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb41b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb41b('0x3'));var moment=require(_0xb41b('0x4'));var BPromise=require(_0xb41b('0x5'));var Mustache=require(_0xb41b('0x6'));var util=require('util');var path=require(_0xb41b('0x7'));var sox=require(_0xb41b('0x8'));var csv=require(_0xb41b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb41b('0xa'));var jsforce=require(_0xb41b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb41b('0x9'));var querystring=require(_0xb41b('0xc'));var Papa=require(_0xb41b('0xd'));var Redis=require(_0xb41b('0xe'));var authService=require(_0xb41b('0xf'));var qs=require(_0xb41b('0x10'));var as=require(_0xb41b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb41b('0x12'))('api');var utils=require(_0xb41b('0x13'));var config=require(_0xb41b('0x14'));var licenseUtil=require(_0xb41b('0x15'));var db=require(_0xb41b('0x16'))['db'];function respondWithStatusCode(_0x2066d5,_0x5f1ea4){_0x5f1ea4=_0x5f1ea4||0xcc;return function(_0x353ba3){if(_0x353ba3){return _0x2066d5[_0xb41b('0x17')](_0x5f1ea4);}return _0x2066d5[_0xb41b('0x18')](_0x5f1ea4)[_0xb41b('0x19')]();};}function respondWithResult(_0x3be1ec,_0x4e8603){_0x4e8603=_0x4e8603||0xc8;return function(_0x4e7f11){if(_0x4e7f11){return _0x3be1ec['status'](_0x4e8603)[_0xb41b('0x1a')](_0x4e7f11);}};}function respondWithFilteredResult(_0xdc5fb0,_0x143a81){return function(_0x338920){if(_0x338920){var _0x29ea51=_0x338920[_0xb41b('0x1b')],_0x54591e=_0x143a81[_0xb41b('0x1c')],_0x2f3673=_0x143a81[_0xb41b('0x1c')]+_0x143a81[_0xb41b('0x1d')],_0xd0b6b5;if(_0x2f3673>=_0x29ea51){_0x2f3673=_0x29ea51;_0xd0b6b5=0xc8;}else{_0xd0b6b5=0xce;}_0xdc5fb0[_0xb41b('0x18')](_0xd0b6b5);return _0xdc5fb0['set']('Content-Range',_0x54591e+'-'+_0x2f3673+'/'+_0x29ea51)['json'](_0x338920);}return null;};}function patchUpdates(_0xf109f8){return function(_0x503e86){try{jsonpatch[_0xb41b('0x1e')](_0x503e86,_0xf109f8,!![]);}catch(_0x1de9ea){return BPromise[_0xb41b('0x1f')](_0x1de9ea);}return _0x503e86['save']();};}function saveUpdates(_0x53bc44,_0x1a1386){return function(_0x3b6ffb){if(_0x3b6ffb){return _0x3b6ffb[_0xb41b('0x20')](_0x53bc44)[_0xb41b('0x21')](function(_0x232ff1){return _0x232ff1;});}return null;};}function removeEntity(_0x42dccb,_0x4c73da){return function(_0x58f149){if(_0x58f149){return _0x58f149[_0xb41b('0x22')]()[_0xb41b('0x21')](function(){_0x42dccb[_0xb41b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14e9c8,_0x2441d6){return function(_0x546101){if(!_0x546101){_0x14e9c8[_0xb41b('0x17')](0x194);}return _0x546101;};}function handleError(_0x34f908,_0x5253ed){_0x5253ed=_0x5253ed||0x1f4;return function(_0xed3c7e){logger['error'](_0xed3c7e[_0xb41b('0x23')]);if(_0xed3c7e[_0xb41b('0x24')]){delete _0xed3c7e['name'];}_0x34f908[_0xb41b('0x18')](_0x5253ed)[_0xb41b('0x25')](_0xed3c7e);};}exports['index']=function(_0x4c2e41,_0x2a5286){var _0x46aecf={},_0x6b98aa={},_0x36dda8={'count':0x0,'rows':[]};var _0x2c7e1f=_[_0xb41b('0x26')](db[_0xb41b('0x27')]['rawAttributes'],function(_0x26ef96){return{'name':_0x26ef96[_0xb41b('0x28')],'type':_0x26ef96['type'][_0xb41b('0x29')]};});_0x6b98aa['model']=_[_0xb41b('0x26')](_0x2c7e1f,_0xb41b('0x24'));_0x6b98aa['query']=_[_0xb41b('0x2a')](_0x4c2e41['query']);_0x6b98aa[_0xb41b('0x2b')]=_[_0xb41b('0x2c')](_0x6b98aa['model'],_0x6b98aa[_0xb41b('0x2d')]);_0x46aecf[_0xb41b('0x2e')]=_[_0xb41b('0x2c')](_0x6b98aa[_0xb41b('0x2f')],qs[_0xb41b('0x30')](_0x4c2e41[_0xb41b('0x2d')][_0xb41b('0x30')]));_0x46aecf[_0xb41b('0x2e')]=_0x46aecf[_0xb41b('0x2e')][_0xb41b('0x31')]?_0x46aecf['attributes']:_0x6b98aa[_0xb41b('0x2f')];if(!_0x4c2e41['query']['hasOwnProperty'](_0xb41b('0x32'))){_0x46aecf[_0xb41b('0x1d')]=qs[_0xb41b('0x1d')](_0x4c2e41[_0xb41b('0x2d')][_0xb41b('0x1d')]);_0x46aecf[_0xb41b('0x1c')]=qs[_0xb41b('0x1c')](_0x4c2e41[_0xb41b('0x2d')][_0xb41b('0x1c')]);}_0x46aecf[_0xb41b('0x33')]=qs[_0xb41b('0x34')](_0x4c2e41['query'][_0xb41b('0x34')]);_0x46aecf[_0xb41b('0x35')]=qs[_0xb41b('0x2b')](_[_0xb41b('0x36')](_0x4c2e41[_0xb41b('0x2d')],_0x6b98aa[_0xb41b('0x2b')]),_0x2c7e1f);if(_0x4c2e41['query']['filter']){_0x46aecf[_0xb41b('0x35')]=_[_0xb41b('0x37')](_0x46aecf['where'],{'$or':_[_0xb41b('0x26')](_0x2c7e1f,function(_0x47363e){if(_0x47363e[_0xb41b('0x38')]!==_0xb41b('0x39')){var _0x3a3b3b={};_0x3a3b3b[_0x47363e['name']]={'$like':'%'+_0x4c2e41[_0xb41b('0x2d')]['filter']+'%'};return _0x3a3b3b;}})});}_0x46aecf=_[_0xb41b('0x37')]({},_0x46aecf,_0x4c2e41[_0xb41b('0x3a')]);var _0x799d6={'where':_0x46aecf[_0xb41b('0x35')]};return db[_0xb41b('0x27')][_0xb41b('0x1b')](_0x799d6)[_0xb41b('0x21')](function(_0x321f1b){_0x36dda8[_0xb41b('0x1b')]=_0x321f1b;if(_0x4c2e41['query']['includeAll']){_0x46aecf['include']=[{'all':!![]}];}return db[_0xb41b('0x27')]['findAll'](_0x46aecf);})['then'](function(_0x781302){_0x36dda8['rows']=_0x781302;return _0x36dda8;})[_0xb41b('0x21')](respondWithFilteredResult(_0x2a5286,_0x46aecf))[_0xb41b('0x3b')](handleError(_0x2a5286,null));};exports[_0xb41b('0x3c')]=function(_0x249ffc,_0x4fa390){var _0x25c5b7={'raw':!![],'where':{'id':_0x249ffc['params']['id']}},_0xddb59c={};_0xddb59c[_0xb41b('0x2f')]=_[_0xb41b('0x2a')](db[_0xb41b('0x27')][_0xb41b('0x3d')]);_0xddb59c['query']=_[_0xb41b('0x2a')](_0x249ffc['query']);_0xddb59c[_0xb41b('0x2b')]=_[_0xb41b('0x2c')](_0xddb59c[_0xb41b('0x2f')],_0xddb59c['query']);_0x25c5b7['attributes']=_[_0xb41b('0x2c')](_0xddb59c[_0xb41b('0x2f')],qs[_0xb41b('0x30')](_0x249ffc[_0xb41b('0x2d')][_0xb41b('0x30')]));_0x25c5b7[_0xb41b('0x2e')]=_0x25c5b7[_0xb41b('0x2e')]['length']?_0x25c5b7['attributes']:_0xddb59c[_0xb41b('0x2f')];if(_0x249ffc['query'][_0xb41b('0x3e')]){_0x25c5b7['include']=[{'all':!![]}];}_0x25c5b7=_[_0xb41b('0x37')]({},_0x25c5b7,_0x249ffc['options']);return db[_0xb41b('0x27')]['find'](_0x25c5b7)[_0xb41b('0x21')](handleEntityNotFound(_0x4fa390,null))[_0xb41b('0x21')](respondWithResult(_0x4fa390,null))[_0xb41b('0x3b')](handleError(_0x4fa390,null));};exports[_0xb41b('0x3f')]=function(_0x54454f,_0x2f8442){return db[_0xb41b('0x27')]['describe']()[_0xb41b('0x21')](respondWithResult(_0x2f8442,null))['catch'](handleError(_0x2f8442,null));};exports['update']=function(_0x5733d0,_0x5bea5e){if(_0x5733d0[_0xb41b('0x40')][_0xb41b('0x41')]){delete _0x5733d0[_0xb41b('0x40')][_0xb41b('0x41')];}return db[_0xb41b('0x27')][_0xb41b('0x42')]({'where':{'uniqueid':_0x5733d0[_0xb41b('0x43')]['id']}})[_0xb41b('0x21')](handleEntityNotFound(_0x5bea5e,null))[_0xb41b('0x21')](saveUpdates(_0x5733d0[_0xb41b('0x40')],null))[_0xb41b('0x21')](respondWithResult(_0x5bea5e,null))[_0xb41b('0x3b')](handleError(_0x5bea5e,null));};exports[_0xb41b('0x44')]=function(_0x360856,_0x1b1f81,_0x19893d){return db['CmHopperFinal'][_0xb41b('0x45')]({'raw':![],'where':{'VoiceQueueId':_0x360856['params']['id']},'attributes':[[db['sequelize']['fn'](_0xb41b('0x46'),db[_0xb41b('0x47')]['fn']('IF',db[_0xb41b('0x47')][_0xb41b('0x48')](_0xb41b('0x49')))),_0xb41b('0x4a')],[db[_0xb41b('0x47')]['fn'](_0xb41b('0x46'),db[_0xb41b('0x47')]['fn']('IF',db[_0xb41b('0x47')][_0xb41b('0x48')](_0xb41b('0x4b')))),_0xb41b('0x4c')],[db[_0xb41b('0x47')]['fn'](_0xb41b('0x46'),db[_0xb41b('0x47')]['fn']('IF',db[_0xb41b('0x47')][_0xb41b('0x48')](_0xb41b('0x4d')))),_0xb41b('0x4e')],[db[_0xb41b('0x47')]['fn']('COUNT',db[_0xb41b('0x47')]['fn']('IF',db['sequelize'][_0xb41b('0x48')](_0xb41b('0x4f')))),_0xb41b('0x50')],[db[_0xb41b('0x47')]['fn'](_0xb41b('0x46'),db[_0xb41b('0x47')]['fn']('IF',db[_0xb41b('0x47')]['literal'](_0xb41b('0x51')))),_0xb41b('0x52')],[db[_0xb41b('0x47')]['fn']('COUNT',db[_0xb41b('0x47')]['fn']('IF',db[_0xb41b('0x47')][_0xb41b('0x48')](_0xb41b('0x53')))),_0xb41b('0x54')],[db[_0xb41b('0x47')]['fn'](_0xb41b('0x46'),db['sequelize']['fn']('IF',db['sequelize'][_0xb41b('0x48')](_0xb41b('0x55')))),'reCallContacts'],[db[_0xb41b('0x47')]['fn'](_0xb41b('0x46'),db['sequelize']['fn']('IF',db[_0xb41b('0x47')][_0xb41b('0x48')](_0xb41b('0x56')))),_0xb41b('0x57')]]})[_0xb41b('0x21')](handleEntityNotFound(_0x1b1f81,null))[_0xb41b('0x21')](respondWithResult(_0x1b1f81,null))[_0xb41b('0x3b')](handleError(_0x1b1f81,null));};exports[_0xb41b('0x58')]=function(_0x182b8a,_0x331e98,_0x5c5e0d){return db[_0xb41b('0x27')][_0xb41b('0x45')]({'raw':![],'where':{'CampaignId':_0x182b8a['params']['id']},'attributes':[[db['sequelize']['fn'](_0xb41b('0x46'),db[_0xb41b('0x47')]['fn']('IF',db[_0xb41b('0x47')]['literal'](_0xb41b('0x49')))),_0xb41b('0x4a')],[db[_0xb41b('0x47')]['fn'](_0xb41b('0x46'),db[_0xb41b('0x47')]['fn']('IF',db[_0xb41b('0x47')][_0xb41b('0x48')](_0xb41b('0x4b')))),_0xb41b('0x4c')],[db[_0xb41b('0x47')]['fn']('COUNT',db[_0xb41b('0x47')]['fn']('IF',db[_0xb41b('0x47')]['literal'](_0xb41b('0x4d')))),_0xb41b('0x4e')],[db[_0xb41b('0x47')]['fn']('COUNT',db[_0xb41b('0x47')]['fn']('IF',db[_0xb41b('0x47')][_0xb41b('0x48')](_0xb41b('0x4f')))),_0xb41b('0x50')],[db[_0xb41b('0x47')]['fn'](_0xb41b('0x46'),db[_0xb41b('0x47')]['fn']('IF',db[_0xb41b('0x47')][_0xb41b('0x48')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0xb41b('0x47')]['fn']('IF',db[_0xb41b('0x47')][_0xb41b('0x48')](_0xb41b('0x53')))),_0xb41b('0x54')],[db[_0xb41b('0x47')]['fn']('COUNT',db[_0xb41b('0x47')]['fn']('IF',db['sequelize'][_0xb41b('0x48')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb41b('0x59')],[db['sequelize']['fn'](_0xb41b('0x46'),db[_0xb41b('0x47')]['fn']('IF',db['sequelize'][_0xb41b('0x48')](_0xb41b('0x56')))),_0xb41b('0x57')]]})[_0xb41b('0x21')](handleEntityNotFound(_0x331e98,null))[_0xb41b('0x21')](respondWithResult(_0x331e98,null))[_0xb41b('0x3b')](handleError(_0x331e98,null));};exports[_0xb41b('0x5a')]=function(_0x523c72,_0xf3c1bb,_0x5b4d87){return db[_0xb41b('0x5b')][_0xb41b('0x42')]({'where':{'id':_0x523c72[_0xb41b('0x43')]['id']}})['then'](handleEntityNotFound(_0xf3c1bb,null))['then'](function(_0x4d8c97){var _0x571e41;if(_0x4d8c97){_0x571e41=squel[_0xb41b('0x5c')]()[_0xb41b('0x5d')](_0xb41b('0x5e'))['fromQuery'](['phone',_0xb41b('0x5f'),_0xb41b('0x60'),_0xb41b('0x61'),_0xb41b('0x62'),_0xb41b('0x63'),_0xb41b('0x64')],squel[_0xb41b('0x65')]()['field']('ANY_VALUE(calleridnum)',_0xb41b('0x66'))[_0xb41b('0x67')]('NOW()',_0xb41b('0x5f'))['field'](_0xb41b('0x68'),_0xb41b('0x60'))['field'](_0xb41b('0x69'),_0xb41b('0x61'))['field']('ANY_VALUE(VoiceQueueId)',_0xb41b('0x62'))[_0xb41b('0x67')]('NOW()',_0xb41b('0x63'))['field'](_0xb41b('0x6a'),_0xb41b('0x64'))['from']('cm_hopper_final')[_0xb41b('0x35')](_0xb41b('0x6b'),_0x523c72['params']['id'][_0xb41b('0x6c')]())[_0xb41b('0x35')](_0xb41b('0x6d'),_0x523c72['body'][_0xb41b('0x6e')]['toString']())['where'](_0xb41b('0x6f'))[_0xb41b('0x35')](_0xb41b('0x70'),squel[_0xb41b('0x65')]()[_0xb41b('0x67')](_0xb41b('0x66'))[_0xb41b('0x71')](_0xb41b('0x5e'))[_0xb41b('0x35')](_0xb41b('0x6b'),_0x523c72[_0xb41b('0x43')]['id'][_0xb41b('0x6c')]()))[_0xb41b('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb41b('0x65')]()[_0xb41b('0x67')](_0xb41b('0x72'))[_0xb41b('0x71')](_0xb41b('0x73'))[_0xb41b('0x35')](_0xb41b('0x6b'),_0x523c72[_0xb41b('0x43')]['id']['toString']())['where'](_0xb41b('0x74')))[_0xb41b('0x75')](_0xb41b('0x60')))['toString']();return db[_0xb41b('0x47')][_0xb41b('0x2d')](_0x571e41);}return[];})['then'](respondWithResult(_0xf3c1bb,null))[_0xb41b('0x3b')](handleError(_0xf3c1bb,null));};exports[_0xb41b('0x76')]=function(_0x5b17da,_0x2ead5e,_0x3874d9){return db[_0xb41b('0x77')][_0xb41b('0x42')]({'where':{'id':_0x5b17da[_0xb41b('0x43')]['id']}})[_0xb41b('0x21')](handleEntityNotFound(_0x2ead5e,null))[_0xb41b('0x21')](function(_0x24b99d){var _0x214372;if(_0x24b99d){_0x214372=squel['insert']()['into'](_0xb41b('0x5e'))[_0xb41b('0x78')]([_0xb41b('0x66'),_0xb41b('0x5f'),_0xb41b('0x60'),_0xb41b('0x61'),'CampaignId',_0xb41b('0x63'),_0xb41b('0x64')],squel[_0xb41b('0x65')]()[_0xb41b('0x67')](_0xb41b('0x79'),_0xb41b('0x66'))[_0xb41b('0x67')](_0xb41b('0x6a'),_0xb41b('0x5f'))[_0xb41b('0x67')](_0xb41b('0x68'),_0xb41b('0x60'))[_0xb41b('0x67')](_0xb41b('0x69'),_0xb41b('0x61'))[_0xb41b('0x67')]('ANY_VALUE(CampaignId)','CampaignId')['field'](_0xb41b('0x6a'),'createdAt')[_0xb41b('0x67')](_0xb41b('0x6a'),'updatedAt')[_0xb41b('0x71')](_0xb41b('0x73'))[_0xb41b('0x35')](_0xb41b('0x7a'),_0x5b17da[_0xb41b('0x43')]['id']['toString']())[_0xb41b('0x35')](_0xb41b('0x6d'),_0x5b17da['body']['state'][_0xb41b('0x6c')]())[_0xb41b('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xb41b('0x35')](_0xb41b('0x70'),squel[_0xb41b('0x65')]()['field']('phone')[_0xb41b('0x71')](_0xb41b('0x5e'))['where'](_0xb41b('0x7a'),_0x5b17da[_0xb41b('0x43')]['id'][_0xb41b('0x6c')]()))['where'](_0xb41b('0x70'),squel[_0xb41b('0x65')]()[_0xb41b('0x67')](_0xb41b('0x72'))[_0xb41b('0x71')](_0xb41b('0x73'))[_0xb41b('0x35')](_0xb41b('0x7a'),_0x5b17da[_0xb41b('0x43')]['id']['toString']())[_0xb41b('0x35')](_0xb41b('0x74')))['group'](_0xb41b('0x60')))['toString']();return db[_0xb41b('0x47')]['query'](_0x214372);}return[];})[_0xb41b('0x21')](respondWithResult(_0x2ead5e,null))[_0xb41b('0x3b')](handleError(_0x2ead5e,null));};exports[_0xb41b('0x7b')]=function(_0x24d478,_0x1be1f4,_0x274e97){return db[_0xb41b('0x7c')][_0xb41b('0x7d')]({'where':{'VoiceQueueId':_0x24d478[_0xb41b('0x40')]['VoiceQueueId'],'CampaignId':_0x24d478[_0xb41b('0x40')][_0xb41b('0x7e')],'ContactId':_0x24d478[_0xb41b('0x40')][_0xb41b('0x60')]}})['then'](handleEntityNotFound(_0x1be1f4,null))[_0xb41b('0x21')](function(_0x5e50ca){if(_0x5e50ca){return _0x5e50ca;}return null;})['then'](respondWithResult(_0x1be1f4,null))[_0xb41b('0x3b')](handleError(_0x1be1f4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2b3b963..10b3fa6 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 _0x1491=['./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x1491,0x1b9));var _0x1149=function(_0x41ceb4,_0x3fbbf5){_0x41ceb4=_0x41ceb4-0x0;var _0x2d57ad=_0x1491[_0x41ceb4];return _0x2d57ad;};'use strict';var _=require(_0x1149('0x0'));var util=require('util');var logger=require(_0x1149('0x1'))('api');var moment=require(_0x1149('0x2'));var BPromise=require(_0x1149('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1149('0x4'));var rimraf=require(_0x1149('0x5'));var config=require(_0x1149('0x6'));var attributes=require(_0x1149('0x7'));module[_0x1149('0x8')]=function(_0x669383,_0x357f2e){return _0x669383[_0x1149('0x9')](_0x1149('0xa'),attributes,{'tableName':_0x1149('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x1149('0xc')]},{'name':_0x1149('0xd'),'fields':[_0x1149('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdeb3=['define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x94cbfd,_0x24ed3c){var _0x15c0c7=function(_0x5de7fc){while(--_0x5de7fc){_0x94cbfd['push'](_0x94cbfd['shift']());}};_0x15c0c7(++_0x24ed3c);}(_0xdeb3,0x19a));var _0x3deb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdeb3[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x3deb('0x0'));var util=require(_0x3deb('0x1'));var logger=require(_0x3deb('0x2'))(_0x3deb('0x3'));var moment=require(_0x3deb('0x4'));var BPromise=require(_0x3deb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3deb('0x6'));var config=require(_0x3deb('0x7'));var attributes=require(_0x3deb('0x8'));module[_0x3deb('0x9')]=function(_0x3f36c3,_0x3ca685){return _0x3f36c3[_0x3deb('0xa')]('CmHopperFinal',attributes,{'tableName':_0x3deb('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x3deb('0xc')]},{'name':_0x3deb('0xd'),'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 e2abaa0..4cc1bed 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 _0xc819=['rpc','../../config/environment','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperFinal','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x52502a,_0x1acb41){var _0x37a38b=function(_0x49cdac){while(--_0x49cdac){_0x52502a['push'](_0x52502a['shift']());}};_0x37a38b(++_0x1acb41);}(_0xc819,0x119));var _0x9c81=function(_0x5e3ffa,_0x355d78){_0x5e3ffa=_0x5e3ffa-0x0;var _0x2b82aa=_0xc819[_0x5e3ffa];return _0x2b82aa;};'use strict';var _=require(_0x9c81('0x0'));var util=require(_0x9c81('0x1'));var moment=require(_0x9c81('0x2'));var BPromise=require(_0x9c81('0x3'));var rs=require(_0x9c81('0x4'));var fs=require('fs');var Redis=require(_0x9c81('0x5'));var db=require(_0x9c81('0x6'))['db'];var utils=require(_0x9c81('0x7'));var logger=require(_0x9c81('0x8'))(_0x9c81('0x9'));var config=require(_0x9c81('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9c81('0xb')][_0x9c81('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3391b3,_0x3ca0f1,_0x28f76a){return new BPromise(function(_0x1f3ead,_0x3e141f){return client[_0x9c81('0xd')](_0x3391b3,_0x28f76a)[_0x9c81('0xe')](function(_0x1eceb7){logger[_0x9c81('0xf')](_0x9c81('0x10'),_0x3ca0f1,_0x9c81('0x11'));logger[_0x9c81('0x12')](_0x9c81('0x13'),_0x3ca0f1,_0x9c81('0x11'),JSON[_0x9c81('0x14')](_0x1eceb7));if(_0x1eceb7[_0x9c81('0x15')]){if(_0x1eceb7[_0x9c81('0x15')][_0x9c81('0x16')]===0x1f4){logger[_0x9c81('0x15')]('CmHopperFinal,\x20%s,\x20%s',_0x3ca0f1,_0x1eceb7['error'][_0x9c81('0x17')]);return _0x3e141f(_0x1eceb7[_0x9c81('0x15')][_0x9c81('0x17')]);}logger[_0x9c81('0x15')]('CmHopperFinal,\x20%s,\x20%s',_0x3ca0f1,_0x1eceb7[_0x9c81('0x15')]['message']);return _0x1f3ead(_0x1eceb7[_0x9c81('0x15')][_0x9c81('0x17')]);}else{logger['info'](_0x9c81('0x10'),_0x3ca0f1,_0x9c81('0x11'));_0x1f3ead(_0x1eceb7['result'][_0x9c81('0x17')]);}})[_0x9c81('0x18')](function(_0x299611){logger[_0x9c81('0x15')]('CmHopperFinal,\x20%s,\x20%s',_0x3ca0f1,_0x299611);_0x3e141f(_0x299611);});});}exports[_0x9c81('0x19')]=function(_0x1e8e9a){var _0x4ef503=this;return new Promise(function(_0x350c33,_0x154697){return db['CmHopperFinal']['create'](_0x1e8e9a[_0x9c81('0x1a')],{'raw':_0x1e8e9a[_0x9c81('0x1b')]?_0x1e8e9a['options'][_0x9c81('0x1c')]===undefined?!![]:![]:!![]})[_0x9c81('0xe')](function(_0x39365f){logger[_0x9c81('0xf')](_0x9c81('0x19'),_0x1e8e9a);logger['debug'](_0x9c81('0x19'),_0x1e8e9a,JSON[_0x9c81('0x14')](_0x39365f));_0x350c33(_0x39365f);})['catch'](function(_0x3c500e){logger[_0x9c81('0x15')](_0x9c81('0x19'),_0x3c500e[_0x9c81('0x17')],_0x1e8e9a);_0x154697(_0x4ef503[_0x9c81('0x15')](0x1f4,_0x3c500e[_0x9c81('0x17')]));});});}; \ No newline at end of file +var _0x440c=['then','stringify','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw'];(function(_0x41a3f2,_0x4deabe){var _0x5a5de7=function(_0x2fabe4){while(--_0x2fabe4){_0x41a3f2['push'](_0x41a3f2['shift']());}};_0x5a5de7(++_0x4deabe);}(_0x440c,0xfe));var _0xc440=function(_0x2b14b4,_0x3ec7d5){_0x2b14b4=_0x2b14b4-0x0;var _0x46836b=_0x440c[_0x2b14b4];return _0x46836b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc440('0x0'));var BPromise=require('bluebird');var rs=require(_0xc440('0x1'));var fs=require('fs');var Redis=require(_0xc440('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc440('0x3'))(_0xc440('0x4'));var config=require(_0xc440('0x5'));var jayson=require(_0xc440('0x6'));var client=jayson[_0xc440('0x7')][_0xc440('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb4b4f1,_0x56e0af,_0x163085){return new BPromise(function(_0x5830d6,_0x16402c){return client[_0xc440('0x9')](_0xb4b4f1,_0x163085)['then'](function(_0x2d5d9e){logger['info'](_0xc440('0xa'),_0x56e0af,_0xc440('0xb'));logger[_0xc440('0xc')](_0xc440('0xd'),_0x56e0af,_0xc440('0xb'),JSON['stringify'](_0x2d5d9e));if(_0x2d5d9e[_0xc440('0xe')]){if(_0x2d5d9e[_0xc440('0xe')][_0xc440('0xf')]===0x1f4){logger[_0xc440('0xe')](_0xc440('0xa'),_0x56e0af,_0x2d5d9e[_0xc440('0xe')][_0xc440('0x10')]);return _0x16402c(_0x2d5d9e[_0xc440('0xe')][_0xc440('0x10')]);}logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x56e0af,_0x2d5d9e[_0xc440('0xe')][_0xc440('0x10')]);return _0x5830d6(_0x2d5d9e[_0xc440('0xe')][_0xc440('0x10')]);}else{logger[_0xc440('0x11')](_0xc440('0xa'),_0x56e0af,_0xc440('0xb'));_0x5830d6(_0x2d5d9e[_0xc440('0x12')]['message']);}})[_0xc440('0x13')](function(_0x46ce53){logger[_0xc440('0xe')](_0xc440('0xa'),_0x56e0af,_0x46ce53);_0x16402c(_0x46ce53);});});}exports[_0xc440('0x14')]=function(_0x3d15f1){var _0x18c04e=this;return new Promise(function(_0x2a4f4d,_0x24cbdb){return db[_0xc440('0x15')][_0xc440('0x16')](_0x3d15f1[_0xc440('0x17')],{'raw':_0x3d15f1[_0xc440('0x18')]?_0x3d15f1[_0xc440('0x18')][_0xc440('0x19')]===undefined?!![]:![]:!![]})[_0xc440('0x1a')](function(_0x2c9436){logger[_0xc440('0x11')]('CreateCmHopperFinal',_0x3d15f1);logger[_0xc440('0xc')](_0xc440('0x14'),_0x3d15f1,JSON[_0xc440('0x1b')](_0x2c9436));_0x2a4f4d(_0x2c9436);})['catch'](function(_0x265e5b){logger['error'](_0xc440('0x14'),_0x265e5b['message'],_0x3d15f1);_0x24cbdb(_0x18c04e[_0xc440('0xe')](0x1f4,_0x265e5b[_0xc440('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 6dff688..5cae4e1 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 _0x840a=['isAuthenticated','get','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','./cmHopperFinal.controller'];(function(_0x124fbe,_0x5a9dfe){var _0x4700d5=function(_0x1829cb){while(--_0x1829cb){_0x124fbe['push'](_0x124fbe['shift']());}};_0x4700d5(++_0x5a9dfe);}(_0x840a,0x1b5));var _0xa840=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x840a[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xa840('0x0'));var util=require(_0xa840('0x1'));var path=require(_0xa840('0x2'));var timeout=require('connect-timeout');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(_0xa840('0x3'));router['get']('/',auth[_0xa840('0x4')](),controller['index']);router[_0xa840('0x5')]('/describe',auth[_0xa840('0x4')](),controller[_0xa840('0x6')]);router[_0xa840('0x5')](_0xa840('0x7'),auth['isAuthenticated'](),controller[_0xa840('0x8')]);router[_0xa840('0x5')](_0xa840('0x9'),auth[_0xa840('0x4')](),controller[_0xa840('0xa')]);router[_0xa840('0x5')](_0xa840('0xb'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xa840('0xc')](_0xa840('0xd'),auth[_0xa840('0x4')](),controller[_0xa840('0xe')]);router[_0xa840('0xc')](_0xa840('0xf'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0xa840('0x10'),auth[_0xa840('0x4')](),controller[_0xa840('0x11')]);router[_0xa840('0x12')](_0xa840('0x7'),auth[_0xa840('0x4')](),controller[_0xa840('0x13')]);module[_0xa840('0x14')]=router; \ No newline at end of file +var _0x9783=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','checkContactHopper','update','util','path','connect-timeout'];(function(_0x179edf,_0x3c67e5){var _0x4b89a8=function(_0x4ddb08){while(--_0x4ddb08){_0x179edf['push'](_0x179edf['shift']());}};_0x4b89a8(++_0x3c67e5);}(_0x9783,0xd9));var _0x3978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9783[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x3978('0x0'));var path=require(_0x3978('0x1'));var timeout=require(_0x3978('0x2'));var express=require('express');var router=express[_0x3978('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3978('0x4'));var config=require(_0x3978('0x5'));var controller=require('./cmHopperFinal.controller');router[_0x3978('0x6')]('/',auth[_0x3978('0x7')](),controller['index']);router[_0x3978('0x6')](_0x3978('0x8'),auth[_0x3978('0x7')](),controller['describe']);router[_0x3978('0x6')](_0x3978('0x9'),auth[_0x3978('0x7')](),controller[_0x3978('0xa')]);router[_0x3978('0x6')]('/voice/queue/countAttributes/:id',auth[_0x3978('0x7')](),controller[_0x3978('0xb')]);router[_0x3978('0x6')](_0x3978('0xc'),auth[_0x3978('0x7')](),controller[_0x3978('0xd')]);router[_0x3978('0xe')](_0x3978('0xf'),auth[_0x3978('0x7')](),controller[_0x3978('0x10')]);router[_0x3978('0xe')]('/voice/campaign/moveContacts/:id',auth[_0x3978('0x7')](),controller[_0x3978('0x11')]);router[_0x3978('0xe')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x3978('0x12')]);router['put']('/:id',auth[_0x3978('0x7')](),controller[_0x3978('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index a6df058..b816c3a 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 _0x9bcf=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x1ff7c4,_0x1d5bcd){var _0x6e1ab=function(_0xa71c95){while(--_0xa71c95){_0x1ff7c4['push'](_0x1ff7c4['shift']());}};_0x6e1ab(++_0x1d5bcd);}(_0x9bcf,0x178));var _0xf9bc=function(_0x1164b8,_0x152116){_0x1164b8=_0x1164b8-0x0;var _0x28cd01=_0x9bcf[_0x1164b8];return _0x28cd01;};'use strict';var Sequelize=require(_0xf9bc('0x0'));module[_0xf9bc('0x1')]={'state':{'type':Sequelize[_0xf9bc('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf9bc('0x3')]},'scheduledat':{'type':Sequelize[_0xf9bc('0x4')]},'countbusyretry':{'type':Sequelize[_0xf9bc('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf9bc('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf9bc('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xf9bc('0x3')]},'originatecalleridname':{'type':Sequelize[_0xf9bc('0x3')]},'calleridnum':{'type':Sequelize[_0xf9bc('0x3')]},'calleridname':{'type':Sequelize[_0xf9bc('0x3')]},'starttime':{'type':Sequelize[_0xf9bc('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xf9bc('0x4')]},'endtime':{'type':Sequelize[_0xf9bc('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf9bc('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xf9bc('0x3')]},'campaigntype':{'type':Sequelize[_0xf9bc('0x3')]},'membername':{'type':Sequelize[_0xf9bc('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xf9bc('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf9bc('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xf9bc('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf9bc('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf9bc('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf9bc('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf9bc('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf9bc('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf9bc('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xceab=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x4a1ec0,_0x26287b){var _0x49ab91=function(_0x206584){while(--_0x206584){_0x4a1ec0['push'](_0x4a1ec0['shift']());}};_0x49ab91(++_0x26287b);}(_0xceab,0xbc));var _0xbcea=function(_0x1c8c85,_0xea2136){_0x1c8c85=_0x1c8c85-0x0;var _0x2c61c6=_0xceab[_0x1c8c85];return _0x2c61c6;};'use strict';var Sequelize=require(_0xbcea('0x0'));module['exports']={'state':{'type':Sequelize[_0xbcea('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xbcea('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xbcea('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbcea('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbcea('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbcea('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xbcea('0x2')]},'originatecalleridname':{'type':Sequelize[_0xbcea('0x2')]},'calleridnum':{'type':Sequelize[_0xbcea('0x2')]},'calleridname':{'type':Sequelize[_0xbcea('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xbcea('0x3')]},'answertime':{'type':Sequelize[_0xbcea('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xbcea('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbcea('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbcea('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbcea('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbcea('0x2')]},'campaign':{'type':Sequelize[_0xbcea('0x2')]},'campaigntype':{'type':Sequelize[_0xbcea('0x2')]},'membername':{'type':Sequelize[_0xbcea('0x2')]},'reason':{'type':Sequelize[_0xbcea('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbcea('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xbcea('0x3')]},'edited':{'type':Sequelize[_0xbcea('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xbcea('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbcea('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbcea('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbcea('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 31f6f53..e6fe002 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 _0x99bf=['show','params','rawAttributes','intersection','length','includeAll','find','catch','create','describe','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','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','sendStatus','status','end','json','count','limit','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','CmHopperHistory','fieldName','type','query','keys','model','attributes','fields','nolimit','offset','sort','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll'];(function(_0x5e9f76,_0x2c585a){var _0x2c4635=function(_0xc26ee2){while(--_0xc26ee2){_0x5e9f76['push'](_0x5e9f76['shift']());}};_0x2c4635(++_0x2c585a);}(_0x99bf,0x1cd));var _0xf99b=function(_0x241c21,_0x11b64b){_0x241c21=_0x241c21-0x0;var _0x1ffb9e=_0x99bf[_0x241c21];return _0x1ffb9e;};'use strict';var pdf=require(_0xf99b('0x0'));var emlformat=require(_0xf99b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf99b('0x2'));var jsonpatch=require(_0xf99b('0x3'));var rp=require(_0xf99b('0x4'));var moment=require(_0xf99b('0x5'));var BPromise=require(_0xf99b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf99b('0x7'));var sox=require(_0xf99b('0x8'));var csv=require('to-csv');var ejs=require(_0xf99b('0x9'));var fs=require('fs');var _=require(_0xf99b('0xa'));var squel=require(_0xf99b('0xb'));var crypto=require(_0xf99b('0xc'));var jsforce=require(_0xf99b('0xd'));var deskjs=require(_0xf99b('0xe'));var toCsv=require(_0xf99b('0xf'));var querystring=require(_0xf99b('0x10'));var Papa=require(_0xf99b('0x11'));var Redis=require(_0xf99b('0x12'));var authService=require(_0xf99b('0x13'));var qs=require(_0xf99b('0x14'));var as=require(_0xf99b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf99b('0x16'))(_0xf99b('0x17'));var utils=require(_0xf99b('0x18'));var config=require(_0xf99b('0x19'));var licenseUtil=require(_0xf99b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe1a9ca,_0xb601bb){_0xb601bb=_0xb601bb||0xcc;return function(_0x3463f7){if(_0x3463f7){return _0xe1a9ca[_0xf99b('0x1b')](_0xb601bb);}return _0xe1a9ca[_0xf99b('0x1c')](_0xb601bb)[_0xf99b('0x1d')]();};}function respondWithResult(_0x588ebb,_0x176828){_0x176828=_0x176828||0xc8;return function(_0x4d4b0a){if(_0x4d4b0a){return _0x588ebb['status'](_0x176828)[_0xf99b('0x1e')](_0x4d4b0a);}};}function respondWithFilteredResult(_0x2c0816,_0x972e72){return function(_0x18c286){if(_0x18c286){var _0x1ff45e=_0x18c286[_0xf99b('0x1f')],_0x2574ed=_0x972e72['offset'],_0x49771e=_0x972e72['offset']+_0x972e72[_0xf99b('0x20')],_0x353905;if(_0x49771e>=_0x1ff45e){_0x49771e=_0x1ff45e;_0x353905=0xc8;}else{_0x353905=0xce;}_0x2c0816['status'](_0x353905);return _0x2c0816[_0xf99b('0x21')](_0xf99b('0x22'),_0x2574ed+'-'+_0x49771e+'/'+_0x1ff45e)[_0xf99b('0x1e')](_0x18c286);}return null;};}function patchUpdates(_0x27c38e){return function(_0x116f5b){try{jsonpatch['apply'](_0x116f5b,_0x27c38e,!![]);}catch(_0xd954de){return BPromise['reject'](_0xd954de);}return _0x116f5b[_0xf99b('0x23')]();};}function saveUpdates(_0x57952f,_0x20781a){return function(_0x46531f){if(_0x46531f){return _0x46531f[_0xf99b('0x24')](_0x57952f)[_0xf99b('0x25')](function(_0x9e4f8e){return _0x9e4f8e;});}return null;};}function removeEntity(_0x5c4f09,_0x17d035){return function(_0x120eaf){if(_0x120eaf){return _0x120eaf[_0xf99b('0x26')]()['then'](function(){_0x5c4f09['status'](0xcc)[_0xf99b('0x1d')]();});}};}function handleEntityNotFound(_0x36aa47,_0x4ba90f){return function(_0x1988e0){if(!_0x1988e0){_0x36aa47[_0xf99b('0x1b')](0x194);}return _0x1988e0;};}function handleError(_0x49d9a5,_0x377ad8){_0x377ad8=_0x377ad8||0x1f4;return function(_0x42dc14){logger['error'](_0x42dc14[_0xf99b('0x27')]);if(_0x42dc14[_0xf99b('0x28')]){delete _0x42dc14['name'];}_0x49d9a5['status'](_0x377ad8)[_0xf99b('0x29')](_0x42dc14);};}exports[_0xf99b('0x2a')]=function(_0x5b628d,_0x50ba67){var _0x341e82={},_0x5ae19c={},_0x383b45={'count':0x0,'rows':[]};var _0x29768a=_[_0xf99b('0x2b')](db[_0xf99b('0x2c')]['rawAttributes'],function(_0x266777){return{'name':_0x266777[_0xf99b('0x2d')],'type':_0x266777[_0xf99b('0x2e')]['key']};});_0x5ae19c['model']=_[_0xf99b('0x2b')](_0x29768a,_0xf99b('0x28'));_0x5ae19c[_0xf99b('0x2f')]=_[_0xf99b('0x30')](_0x5b628d[_0xf99b('0x2f')]);_0x5ae19c['filters']=_['intersection'](_0x5ae19c[_0xf99b('0x31')],_0x5ae19c[_0xf99b('0x2f')]);_0x341e82[_0xf99b('0x32')]=_['intersection'](_0x5ae19c['model'],qs[_0xf99b('0x33')](_0x5b628d[_0xf99b('0x2f')][_0xf99b('0x33')]));_0x341e82['attributes']=_0x341e82['attributes']['length']?_0x341e82[_0xf99b('0x32')]:_0x5ae19c['model'];if(!_0x5b628d[_0xf99b('0x2f')]['hasOwnProperty'](_0xf99b('0x34'))){_0x341e82[_0xf99b('0x20')]=qs[_0xf99b('0x20')](_0x5b628d[_0xf99b('0x2f')]['limit']);_0x341e82[_0xf99b('0x35')]=qs[_0xf99b('0x35')](_0x5b628d[_0xf99b('0x2f')]['offset']);}_0x341e82['order']=qs[_0xf99b('0x36')](_0x5b628d[_0xf99b('0x2f')][_0xf99b('0x36')]);_0x341e82[_0xf99b('0x37')]=qs['filters'](_[_0xf99b('0x38')](_0x5b628d['query'],_0x5ae19c[_0xf99b('0x39')]),_0x29768a);if(_0x5b628d[_0xf99b('0x2f')][_0xf99b('0x3a')]){_0x341e82[_0xf99b('0x37')]=_['merge'](_0x341e82[_0xf99b('0x37')],{'$or':_[_0xf99b('0x2b')](_0x29768a,function(_0x33f855){if(_0x33f855['type']!==_0xf99b('0x3b')){var _0x1d8f17={};_0x1d8f17[_0x33f855[_0xf99b('0x28')]]={'$like':'%'+_0x5b628d[_0xf99b('0x2f')][_0xf99b('0x3a')]+'%'};return _0x1d8f17;}})});}_0x341e82=_[_0xf99b('0x3c')]({},_0x341e82,_0x5b628d[_0xf99b('0x3d')]);var _0x16f5e0={'where':_0x341e82['where']};return db['CmHopperHistory'][_0xf99b('0x1f')](_0x16f5e0)['then'](function(_0x14c7e0){_0x383b45['count']=_0x14c7e0;if(_0x5b628d[_0xf99b('0x2f')]['includeAll']){_0x341e82[_0xf99b('0x3e')]=[{'all':!![]}];}return db[_0xf99b('0x2c')][_0xf99b('0x3f')](_0x341e82);})[_0xf99b('0x25')](function(_0x5a67e9){_0x383b45['rows']=_0x5a67e9;return _0x383b45;})['then'](respondWithFilteredResult(_0x50ba67,_0x341e82))['catch'](handleError(_0x50ba67,null));};exports[_0xf99b('0x40')]=function(_0xd2e15b,_0x45f2c2){var _0x128308={'raw':!![],'where':{'id':_0xd2e15b[_0xf99b('0x41')]['id']}},_0x583e7d={};_0x583e7d[_0xf99b('0x31')]=_[_0xf99b('0x30')](db[_0xf99b('0x2c')][_0xf99b('0x42')]);_0x583e7d[_0xf99b('0x2f')]=_[_0xf99b('0x30')](_0xd2e15b[_0xf99b('0x2f')]);_0x583e7d['filters']=_[_0xf99b('0x43')](_0x583e7d[_0xf99b('0x31')],_0x583e7d[_0xf99b('0x2f')]);_0x128308[_0xf99b('0x32')]=_['intersection'](_0x583e7d[_0xf99b('0x31')],qs[_0xf99b('0x33')](_0xd2e15b['query'][_0xf99b('0x33')]));_0x128308['attributes']=_0x128308['attributes'][_0xf99b('0x44')]?_0x128308[_0xf99b('0x32')]:_0x583e7d[_0xf99b('0x31')];if(_0xd2e15b[_0xf99b('0x2f')][_0xf99b('0x45')]){_0x128308['include']=[{'all':!![]}];}_0x128308=_[_0xf99b('0x3c')]({},_0x128308,_0xd2e15b['options']);return db[_0xf99b('0x2c')][_0xf99b('0x46')](_0x128308)[_0xf99b('0x25')](handleEntityNotFound(_0x45f2c2,null))[_0xf99b('0x25')](respondWithResult(_0x45f2c2,null))[_0xf99b('0x47')](handleError(_0x45f2c2,null));};exports[_0xf99b('0x48')]=function(_0x38494c,_0x1c2866){return db['CmHopperHistory'][_0xf99b('0x48')](_0x38494c['body'],{})['then'](respondWithResult(_0x1c2866,0xc9))['catch'](handleError(_0x1c2866,null));};exports[_0xf99b('0x49')]=function(_0x5d5de4,_0x2026ae){return db[_0xf99b('0x2c')][_0xf99b('0x49')]()[_0xf99b('0x25')](respondWithResult(_0x2026ae,null))['catch'](handleError(_0x2026ae,null));};exports[_0xf99b('0x24')]=function(_0x3048d8,_0x2a84c2){if(_0x3048d8[_0xf99b('0x4a')]['uniqueid']){delete _0x3048d8['body']['uniqueid'];}return db['CmHopperHistory'][_0xf99b('0x46')]({'where':{'uniqueid':_0x3048d8[_0xf99b('0x41')]['id']}})[_0xf99b('0x25')](handleEntityNotFound(_0x2a84c2,null))['then'](saveUpdates(_0x3048d8[_0xf99b('0x4a')],null))[_0xf99b('0x25')](respondWithResult(_0x2a84c2,null))['catch'](handleError(_0x2a84c2,null));}; \ No newline at end of file +var _0x3d98=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','status','json','count','offset','limit','set','save','update','then','destroy','end','sendStatus','stack','name','CmHopperHistory','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','fields','create','body','describe','uniqueid','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','squel','crypto','jsforce','to-csv','querystring'];(function(_0x2c86cb,_0x391181){var _0x13910f=function(_0x36fe72){while(--_0x36fe72){_0x2c86cb['push'](_0x2c86cb['shift']());}};_0x13910f(++_0x391181);}(_0x3d98,0x109));var _0x83d9=function(_0x337179,_0x1907c5){_0x337179=_0x337179-0x0;var _0x173152=_0x3d98[_0x337179];return _0x173152;};'use strict';var pdf=require(_0x83d9('0x0'));var emlformat=require(_0x83d9('0x1'));var rimraf=require(_0x83d9('0x2'));var zipdir=require(_0x83d9('0x3'));var jsonpatch=require(_0x83d9('0x4'));var rp=require(_0x83d9('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x83d9('0x6'));var util=require(_0x83d9('0x7'));var path=require(_0x83d9('0x8'));var sox=require(_0x83d9('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x83d9('0xa'));var crypto=require(_0x83d9('0xb'));var jsforce=require(_0x83d9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x83d9('0xd'));var querystring=require(_0x83d9('0xe'));var Papa=require(_0x83d9('0xf'));var Redis=require(_0x83d9('0x10'));var authService=require(_0x83d9('0x11'));var qs=require(_0x83d9('0x12'));var as=require(_0x83d9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x83d9('0x14'))('api');var utils=require(_0x83d9('0x15'));var config=require(_0x83d9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d9990,_0x419028){_0x419028=_0x419028||0xcc;return function(_0x2fd4f9){if(_0x2fd4f9){return _0x5d9990['sendStatus'](_0x419028);}return _0x5d9990['status'](_0x419028)['end']();};}function respondWithResult(_0x391359,_0x986b1b){_0x986b1b=_0x986b1b||0xc8;return function(_0x5765c4){if(_0x5765c4){return _0x391359[_0x83d9('0x17')](_0x986b1b)[_0x83d9('0x18')](_0x5765c4);}};}function respondWithFilteredResult(_0xd19aba,_0x53fb06){return function(_0x1bf814){if(_0x1bf814){var _0x452165=_0x1bf814[_0x83d9('0x19')],_0x3b1cc1=_0x53fb06[_0x83d9('0x1a')],_0x2b1fd5=_0x53fb06[_0x83d9('0x1a')]+_0x53fb06[_0x83d9('0x1b')],_0x55a119;if(_0x2b1fd5>=_0x452165){_0x2b1fd5=_0x452165;_0x55a119=0xc8;}else{_0x55a119=0xce;}_0xd19aba[_0x83d9('0x17')](_0x55a119);return _0xd19aba[_0x83d9('0x1c')]('Content-Range',_0x3b1cc1+'-'+_0x2b1fd5+'/'+_0x452165)[_0x83d9('0x18')](_0x1bf814);}return null;};}function patchUpdates(_0x59933a){return function(_0x4b24f8){try{jsonpatch['apply'](_0x4b24f8,_0x59933a,!![]);}catch(_0x578026){return BPromise['reject'](_0x578026);}return _0x4b24f8[_0x83d9('0x1d')]();};}function saveUpdates(_0x1cbf6b,_0x304e39){return function(_0x56fe04){if(_0x56fe04){return _0x56fe04[_0x83d9('0x1e')](_0x1cbf6b)[_0x83d9('0x1f')](function(_0x23920c){return _0x23920c;});}return null;};}function removeEntity(_0x3657ce,_0x32ddcb){return function(_0x510556){if(_0x510556){return _0x510556[_0x83d9('0x20')]()[_0x83d9('0x1f')](function(){_0x3657ce['status'](0xcc)[_0x83d9('0x21')]();});}};}function handleEntityNotFound(_0x5552fe,_0x418936){return function(_0x264de6){if(!_0x264de6){_0x5552fe[_0x83d9('0x22')](0x194);}return _0x264de6;};}function handleError(_0x5b88ff,_0x39862c){_0x39862c=_0x39862c||0x1f4;return function(_0x1ec3a3){logger['error'](_0x1ec3a3[_0x83d9('0x23')]);if(_0x1ec3a3[_0x83d9('0x24')]){delete _0x1ec3a3[_0x83d9('0x24')];}_0x5b88ff[_0x83d9('0x17')](_0x39862c)['send'](_0x1ec3a3);};}exports['index']=function(_0x4d2a7d,_0x4e13a6){var _0x4b5443={},_0x243ad2={},_0x1f4768={'count':0x0,'rows':[]};var _0x77fef0=_['map'](db[_0x83d9('0x25')][_0x83d9('0x26')],function(_0x2341e7){return{'name':_0x2341e7[_0x83d9('0x27')],'type':_0x2341e7['type'][_0x83d9('0x28')]};});_0x243ad2['model']=_['map'](_0x77fef0,_0x83d9('0x24'));_0x243ad2[_0x83d9('0x29')]=_[_0x83d9('0x2a')](_0x4d2a7d[_0x83d9('0x29')]);_0x243ad2[_0x83d9('0x2b')]=_[_0x83d9('0x2c')](_0x243ad2[_0x83d9('0x2d')],_0x243ad2['query']);_0x4b5443[_0x83d9('0x2e')]=_[_0x83d9('0x2c')](_0x243ad2[_0x83d9('0x2d')],qs['fields'](_0x4d2a7d['query']['fields']));_0x4b5443[_0x83d9('0x2e')]=_0x4b5443['attributes'][_0x83d9('0x2f')]?_0x4b5443[_0x83d9('0x2e')]:_0x243ad2[_0x83d9('0x2d')];if(!_0x4d2a7d['query']['hasOwnProperty'](_0x83d9('0x30'))){_0x4b5443[_0x83d9('0x1b')]=qs[_0x83d9('0x1b')](_0x4d2a7d[_0x83d9('0x29')]['limit']);_0x4b5443[_0x83d9('0x1a')]=qs[_0x83d9('0x1a')](_0x4d2a7d[_0x83d9('0x29')][_0x83d9('0x1a')]);}_0x4b5443[_0x83d9('0x31')]=qs[_0x83d9('0x32')](_0x4d2a7d[_0x83d9('0x29')]['sort']);_0x4b5443[_0x83d9('0x33')]=qs[_0x83d9('0x2b')](_[_0x83d9('0x34')](_0x4d2a7d[_0x83d9('0x29')],_0x243ad2[_0x83d9('0x2b')]),_0x77fef0);if(_0x4d2a7d['query'][_0x83d9('0x35')]){_0x4b5443[_0x83d9('0x33')]=_['merge'](_0x4b5443[_0x83d9('0x33')],{'$or':_[_0x83d9('0x36')](_0x77fef0,function(_0x368f8a){if(_0x368f8a['type']!==_0x83d9('0x37')){var _0x3a19a7={};_0x3a19a7[_0x368f8a[_0x83d9('0x24')]]={'$like':'%'+_0x4d2a7d[_0x83d9('0x29')][_0x83d9('0x35')]+'%'};return _0x3a19a7;}})});}_0x4b5443=_[_0x83d9('0x38')]({},_0x4b5443,_0x4d2a7d[_0x83d9('0x39')]);var _0x2dc55e={'where':_0x4b5443[_0x83d9('0x33')]};return db['CmHopperHistory'][_0x83d9('0x19')](_0x2dc55e)[_0x83d9('0x1f')](function(_0x5caa45){_0x1f4768[_0x83d9('0x19')]=_0x5caa45;if(_0x4d2a7d[_0x83d9('0x29')][_0x83d9('0x3a')]){_0x4b5443[_0x83d9('0x3b')]=[{'all':!![]}];}return db[_0x83d9('0x25')][_0x83d9('0x3c')](_0x4b5443);})[_0x83d9('0x1f')](function(_0x1dfbf2){_0x1f4768[_0x83d9('0x3d')]=_0x1dfbf2;return _0x1f4768;})['then'](respondWithFilteredResult(_0x4e13a6,_0x4b5443))[_0x83d9('0x3e')](handleError(_0x4e13a6,null));};exports['show']=function(_0x5830db,_0x4797f9){var _0x476ec9={'raw':!![],'where':{'id':_0x5830db[_0x83d9('0x3f')]['id']}},_0x22ddda={};_0x22ddda[_0x83d9('0x2d')]=_[_0x83d9('0x2a')](db['CmHopperHistory']['rawAttributes']);_0x22ddda[_0x83d9('0x29')]=_[_0x83d9('0x2a')](_0x5830db[_0x83d9('0x29')]);_0x22ddda[_0x83d9('0x2b')]=_['intersection'](_0x22ddda['model'],_0x22ddda[_0x83d9('0x29')]);_0x476ec9[_0x83d9('0x2e')]=_[_0x83d9('0x2c')](_0x22ddda[_0x83d9('0x2d')],qs[_0x83d9('0x40')](_0x5830db[_0x83d9('0x29')][_0x83d9('0x40')]));_0x476ec9[_0x83d9('0x2e')]=_0x476ec9[_0x83d9('0x2e')][_0x83d9('0x2f')]?_0x476ec9['attributes']:_0x22ddda[_0x83d9('0x2d')];if(_0x5830db['query'][_0x83d9('0x3a')]){_0x476ec9[_0x83d9('0x3b')]=[{'all':!![]}];}_0x476ec9=_[_0x83d9('0x38')]({},_0x476ec9,_0x5830db['options']);return db['CmHopperHistory']['find'](_0x476ec9)[_0x83d9('0x1f')](handleEntityNotFound(_0x4797f9,null))[_0x83d9('0x1f')](respondWithResult(_0x4797f9,null))['catch'](handleError(_0x4797f9,null));};exports[_0x83d9('0x41')]=function(_0x39ea2e,_0x402e9f){return db[_0x83d9('0x25')]['create'](_0x39ea2e[_0x83d9('0x42')],{})[_0x83d9('0x1f')](respondWithResult(_0x402e9f,0xc9))[_0x83d9('0x3e')](handleError(_0x402e9f,null));};exports[_0x83d9('0x43')]=function(_0x2bf813,_0x3ac783){return db[_0x83d9('0x25')][_0x83d9('0x43')]()[_0x83d9('0x1f')](respondWithResult(_0x3ac783,null))[_0x83d9('0x3e')](handleError(_0x3ac783,null));};exports['update']=function(_0x592c8e,_0x380856){if(_0x592c8e[_0x83d9('0x42')][_0x83d9('0x44')]){delete _0x592c8e[_0x83d9('0x42')][_0x83d9('0x44')];}return db['CmHopperHistory'][_0x83d9('0x45')]({'where':{'uniqueid':_0x592c8e[_0x83d9('0x3f')]['id']}})[_0x83d9('0x1f')](handleEntityNotFound(_0x380856,null))[_0x83d9('0x1f')](saveUpdates(_0x592c8e[_0x83d9('0x42')],null))[_0x83d9('0x1f')](respondWithResult(_0x380856,null))[_0x83d9('0x3e')](handleError(_0x380856,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 526a377..79db9e0 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 _0xb9e8=['../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4db3be,_0x310ef6){var _0x52f144=function(_0x2bf4e3){while(--_0x2bf4e3){_0x4db3be['push'](_0x4db3be['shift']());}};_0x52f144(++_0x310ef6);}(_0xb9e8,0x7f));var _0x8b9e=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0xb9e8[_0x3cbe1c];return _0x5ee08b;};'use strict';var _=require('lodash');var util=require(_0x8b9e('0x0'));var logger=require(_0x8b9e('0x1'))(_0x8b9e('0x2'));var moment=require(_0x8b9e('0x3'));var BPromise=require(_0x8b9e('0x4'));var rp=require(_0x8b9e('0x5'));var fs=require('fs');var path=require(_0x8b9e('0x6'));var rimraf=require(_0x8b9e('0x7'));var config=require(_0x8b9e('0x8'));var attributes=require(_0x8b9e('0x9'));module[_0x8b9e('0xa')]=function(_0x489186,_0x1e05ab){return _0x489186[_0x8b9e('0xb')]('CmHopperHistory',attributes,{'tableName':_0x8b9e('0xc'),'paranoid':![],'indexes':[{'name':_0x8b9e('0xd'),'fields':[_0x8b9e('0xd')]},{'name':_0x8b9e('0xe'),'fields':[_0x8b9e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ad2=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','uniqueid','lodash','util'];(function(_0x5e6ddf,_0x1e1ecc){var _0x3021e4=function(_0xd87c4f){while(--_0xd87c4f){_0x5e6ddf['push'](_0x5e6ddf['shift']());}};_0x3021e4(++_0x1e1ecc);}(_0x8ad2,0x157));var _0x28ad=function(_0x196156,_0x5de154){_0x196156=_0x196156-0x0;var _0x3cc396=_0x8ad2[_0x196156];return _0x3cc396;};'use strict';var _=require(_0x28ad('0x0'));var util=require(_0x28ad('0x1'));var logger=require(_0x28ad('0x2'))(_0x28ad('0x3'));var moment=require(_0x28ad('0x4'));var BPromise=require(_0x28ad('0x5'));var rp=require(_0x28ad('0x6'));var fs=require('fs');var path=require(_0x28ad('0x7'));var rimraf=require(_0x28ad('0x8'));var config=require(_0x28ad('0x9'));var attributes=require(_0x28ad('0xa'));module[_0x28ad('0xb')]=function(_0x53b16c,_0xf57751){return _0x53b16c[_0x28ad('0xc')]('CmHopperHistory',attributes,{'tableName':_0x28ad('0xd'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x28ad('0xe'),'fields':[_0x28ad('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 0e106b1..fb320f1 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 _0xf963=['`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','info','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay'];(function(_0x1123bb,_0x54472a){var _0xdeb602=function(_0x529467){while(--_0x529467){_0x1123bb['push'](_0x1123bb['shift']());}};_0xdeb602(++_0x54472a);}(_0xf963,0x1c9));var _0x3f96=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xf963[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x3f96('0x0'));var util=require(_0x3f96('0x1'));var moment=require(_0x3f96('0x2'));var BPromise=require(_0x3f96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f96('0x4'));var db=require(_0x3f96('0x5'))['db'];var utils=require(_0x3f96('0x6'));var logger=require(_0x3f96('0x7'))('rpc');var config=require(_0x3f96('0x8'));var jayson=require(_0x3f96('0x9'));var client=jayson['client'][_0x3f96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c3526,_0x29bcd1,_0x57979d){return new BPromise(function(_0xcffb13,_0x1fa391){return client[_0x3f96('0xb')](_0x4c3526,_0x57979d)[_0x3f96('0xc')](function(_0x34263b){logger['info'](_0x3f96('0xd'),_0x29bcd1,_0x3f96('0xe'));logger[_0x3f96('0xf')](_0x3f96('0x10'),_0x29bcd1,_0x3f96('0xe'),JSON[_0x3f96('0x11')](_0x34263b));if(_0x34263b[_0x3f96('0x12')]){if(_0x34263b[_0x3f96('0x12')][_0x3f96('0x13')]===0x1f4){logger[_0x3f96('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x29bcd1,_0x34263b[_0x3f96('0x12')]['message']);return _0x1fa391(_0x34263b[_0x3f96('0x12')][_0x3f96('0x14')]);}logger['error'](_0x3f96('0xd'),_0x29bcd1,_0x34263b[_0x3f96('0x12')][_0x3f96('0x14')]);return _0xcffb13(_0x34263b[_0x3f96('0x12')][_0x3f96('0x14')]);}else{logger['info'](_0x3f96('0xd'),_0x29bcd1,_0x3f96('0xe'));_0xcffb13(_0x34263b[_0x3f96('0x15')][_0x3f96('0x14')]);}})[_0x3f96('0x16')](function(_0x139cd3){logger['error'](_0x3f96('0xd'),_0x29bcd1,_0x139cd3);_0x1fa391(_0x139cd3);});});}exports[_0x3f96('0x17')]=function(_0x2c2ab2){var _0x3e8379=this;return new Promise(function(_0x42babb,_0x4c17a0){return db[_0x3f96('0x18')][_0x3f96('0x19')](_0x2c2ab2[_0x3f96('0x1a')],{'raw':_0x2c2ab2[_0x3f96('0x1b')]?_0x2c2ab2['options'][_0x3f96('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2284bc){logger[_0x3f96('0x1d')]('CreateCmHopperHistory',_0x2c2ab2);logger[_0x3f96('0xf')](_0x3f96('0x17'),_0x2c2ab2,JSON[_0x3f96('0x11')](_0x2284bc));_0x42babb(_0x2284bc);})[_0x3f96('0x16')](function(_0x157741){logger['error']('CreateCmHopperHistory',_0x157741[_0x3f96('0x14')],_0x2c2ab2);_0x4c17a0(_0x3e8379['error'](0x1f4,_0x157741['message']));});});};exports[_0x3f96('0x1e')]=function(_0x5e2e7a){var _0x5779da=this;return new Promise(function(_0x31f03b,_0xc40ab6){return db[_0x3f96('0x18')][_0x3f96('0x1f')]({'raw':_0x5e2e7a[_0x3f96('0x1b')]?_0x5e2e7a['options'][_0x3f96('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e2e7a[_0x3f96('0x1b')]?_0x5e2e7a[_0x3f96('0x1b')][_0x3f96('0x20')]||null:null,'attributes':[[db[_0x3f96('0x21')]['fn'](_0x3f96('0x22'),db['sequelize']['col']('id')),_0x3f96('0x23')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3f96('0x21')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x3f96('0x24')],[db[_0x3f96('0x21')]['fn']('COUNT',db[_0x3f96('0x21')]['fn']('IF',db[_0x3f96('0x21')][_0x3f96('0x25')](_0x3f96('0x26')))),_0x3f96('0x27')],[db[_0x3f96('0x21')]['fn'](_0x3f96('0x22'),db[_0x3f96('0x21')]['fn']('IF',db['sequelize']['literal'](_0x3f96('0x28')))),_0x3f96('0x29')],[db['sequelize']['fn'](_0x3f96('0x2a'),db['sequelize']['fn']('IF',db[_0x3f96('0x21')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x3f96('0x2b')],[db[_0x3f96('0x21')]['fn'](_0x3f96('0x2a'),db['sequelize']['fn']('IF',db[_0x3f96('0x21')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x3f96('0x2c')]]})[_0x3f96('0xc')](function(_0x5bc1e0){logger[_0x3f96('0x1d')](_0x3f96('0x1e'),_0x5e2e7a);logger[_0x3f96('0xf')](_0x3f96('0x1e'),_0x5e2e7a,JSON['stringify'](_0x5bc1e0));_0x31f03b(_0x5bc1e0);})['catch'](function(_0x50f4f5){logger[_0x3f96('0x12')](_0x3f96('0x1e'),_0x50f4f5[_0x3f96('0x14')],_0x5e2e7a);_0xc40ab6(_0x5779da['error'](0x1f4,_0x50f4f5[_0x3f96('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x42d051){var _0x36583a=this;return new Promise(function(_0x460578,_0x4bcb3d){return db[_0x3f96('0x18')][_0x3f96('0x1f')]({'raw':_0x42d051[_0x3f96('0x1b')]?_0x42d051[_0x3f96('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x42d051[_0x3f96('0x1b')]?_0x42d051[_0x3f96('0x1b')][_0x3f96('0x20')]||null:null,'attributes':[[_0x3f96('0x2d'),_0x3f96('0x2e')],[db[_0x3f96('0x21')]['fn'](_0x3f96('0x22'),db[_0x3f96('0x21')]['fn']('IF',db[_0x3f96('0x21')][_0x3f96('0x25')](_0x3f96('0x2f')))),_0x3f96('0x30')],[db[_0x3f96('0x21')]['fn'](_0x3f96('0x22'),db[_0x3f96('0x21')]['fn']('IF',db['sequelize'][_0x3f96('0x25')]('`state`\x20=\x203,\x201,\x20null'))),_0x3f96('0x31')],[db[_0x3f96('0x21')]['fn'](_0x3f96('0x22'),db[_0x3f96('0x21')]['fn']('IF',db['sequelize'][_0x3f96('0x25')](_0x3f96('0x32')))),_0x3f96('0x33')],[db[_0x3f96('0x21')]['fn'](_0x3f96('0x22'),db['sequelize']['fn']('IF',db[_0x3f96('0x21')][_0x3f96('0x25')](_0x3f96('0x34')))),_0x3f96('0x35')],[db[_0x3f96('0x21')]['fn'](_0x3f96('0x22'),db[_0x3f96('0x21')]['fn']('IF',db['sequelize']['literal'](_0x3f96('0x36')))),_0x3f96('0x37')],[db[_0x3f96('0x21')]['fn'](_0x3f96('0x22'),db[_0x3f96('0x21')]['fn']('IF',db[_0x3f96('0x21')][_0x3f96('0x25')](_0x3f96('0x38')))),_0x3f96('0x39')],[db['sequelize']['fn']('COUNT',db[_0x3f96('0x21')]['fn']('IF',db['sequelize']['literal'](_0x3f96('0x3a')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0x3f96('0x22'),db[_0x3f96('0x21')]['fn']('IF',db[_0x3f96('0x21')]['literal'](_0x3f96('0x3b')))),_0x3f96('0x3c')],[db[_0x3f96('0x21')]['fn']('COUNT',db[_0x3f96('0x21')]['fn']('IF',db[_0x3f96('0x21')][_0x3f96('0x25')]('`state`\x20=\x2013,\x201,\x20null'))),_0x3f96('0x3d')],[db[_0x3f96('0x21')]['fn'](_0x3f96('0x22'),db[_0x3f96('0x21')]['fn']('IF',db[_0x3f96('0x21')][_0x3f96('0x25')](_0x3f96('0x3e')))),_0x3f96('0x3f')],[db['sequelize']['fn'](_0x3f96('0x22'),db['sequelize']['fn']('IF',db[_0x3f96('0x21')][_0x3f96('0x25')](_0x3f96('0x40')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x3f96('0x22'),db['sequelize']['fn']('IF',db[_0x3f96('0x21')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x3f96('0x41')],[db[_0x3f96('0x21')]['fn']('COUNT',db[_0x3f96('0x21')]['fn']('IF',db['sequelize'][_0x3f96('0x25')](_0x3f96('0x42')))),_0x3f96('0x43')],[db['sequelize']['fn'](_0x3f96('0x22'),db['sequelize']['fn']('IF',db[_0x3f96('0x21')][_0x3f96('0x25')](_0x3f96('0x44')))),'outboundReCallsDay']],'group':[_0x3f96('0x2d')]})[_0x3f96('0xc')](function(_0x193996){logger[_0x3f96('0x1d')](_0x3f96('0x45'),_0x42d051);logger[_0x3f96('0xf')]('GetVoiceQueueHopperHistory',_0x42d051,JSON[_0x3f96('0x11')](_0x193996));_0x460578(_0x193996);})[_0x3f96('0x16')](function(_0x847351){logger[_0x3f96('0x12')]('GetVoiceQueueHopperHistory',_0x847351['message'],_0x42d051);_0x4bcb3d(_0x36583a[_0x3f96('0x12')](0x1f4,_0x847351[_0x3f96('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x356997){var _0x34016e=this;return new Promise(function(_0xd2d411,_0x48b33e){return db['CmHopperHistory']['findAll']({'raw':_0x356997[_0x3f96('0x1b')]?_0x356997['options'][_0x3f96('0x1c')]===undefined?!![]:![]:!![],'where':_0x356997[_0x3f96('0x1b')]?_0x356997[_0x3f96('0x1b')]['where']||null:null,'attributes':[[_0x3f96('0x2d'),'name'],[db[_0x3f96('0x21')]['fn']('COUNT',db[_0x3f96('0x21')]['col']('id')),_0x3f96('0x46')],[db[_0x3f96('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3f96('0x21')]['literal'](_0x3f96('0x32')))),_0x3f96('0x47')]],'group':[_0x3f96('0x2d')]})['then'](function(_0x257f47){logger[_0x3f96('0x1d')](_0x3f96('0x48'),_0x356997);logger[_0x3f96('0xf')]('GetCampaignHopperHistory',_0x356997,JSON[_0x3f96('0x11')](_0x257f47));_0xd2d411(_0x257f47);})['catch'](function(_0x500dcf){logger[_0x3f96('0x12')]('GetCampaignHopperHistory',_0x500dcf[_0x3f96('0x14')],_0x356997);_0x48b33e(_0x34016e['error'](0x1f4,_0x500dcf[_0x3f96('0x14')]));});});}; \ No newline at end of file +var _0xb05e=['outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','AvgHandleTime','findAll','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null'];(function(_0x542c11,_0x35d5df){var _0xd5ba30=function(_0x352bff){while(--_0x352bff){_0x542c11['push'](_0x542c11['shift']());}};_0xd5ba30(++_0x35d5df);}(_0xb05e,0x1b0));var _0xeb05=function(_0x5cf8e3,_0x56c53f){_0x5cf8e3=_0x5cf8e3-0x0;var _0x4abb2e=_0xb05e[_0x5cf8e3];return _0x4abb2e;};'use strict';var _=require(_0xeb05('0x0'));var util=require('util');var moment=require(_0xeb05('0x1'));var BPromise=require(_0xeb05('0x2'));var rs=require(_0xeb05('0x3'));var fs=require('fs');var Redis=require(_0xeb05('0x4'));var db=require(_0xeb05('0x5'))['db'];var utils=require(_0xeb05('0x6'));var logger=require(_0xeb05('0x7'))(_0xeb05('0x8'));var config=require('../../config/environment');var jayson=require(_0xeb05('0x9'));var client=jayson[_0xeb05('0xa')][_0xeb05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x395127,_0x526008,_0x278371){return new BPromise(function(_0x1f730,_0x19c433){return client['request'](_0x395127,_0x278371)[_0xeb05('0xc')](function(_0xbd567a){logger[_0xeb05('0xd')](_0xeb05('0xe'),_0x526008,_0xeb05('0xf'));logger[_0xeb05('0x10')](_0xeb05('0x11'),_0x526008,_0xeb05('0xf'),JSON[_0xeb05('0x12')](_0xbd567a));if(_0xbd567a[_0xeb05('0x13')]){if(_0xbd567a[_0xeb05('0x13')][_0xeb05('0x14')]===0x1f4){logger[_0xeb05('0x13')](_0xeb05('0xe'),_0x526008,_0xbd567a['error'][_0xeb05('0x15')]);return _0x19c433(_0xbd567a['error'][_0xeb05('0x15')]);}logger[_0xeb05('0x13')](_0xeb05('0xe'),_0x526008,_0xbd567a[_0xeb05('0x13')][_0xeb05('0x15')]);return _0x1f730(_0xbd567a[_0xeb05('0x13')][_0xeb05('0x15')]);}else{logger[_0xeb05('0xd')](_0xeb05('0xe'),_0x526008,_0xeb05('0xf'));_0x1f730(_0xbd567a[_0xeb05('0x16')][_0xeb05('0x15')]);}})[_0xeb05('0x17')](function(_0x320d4f){logger[_0xeb05('0x13')](_0xeb05('0xe'),_0x526008,_0x320d4f);_0x19c433(_0x320d4f);});});}exports[_0xeb05('0x18')]=function(_0x57cb9a){var _0x257097=this;return new Promise(function(_0x340359,_0xae70db){return db[_0xeb05('0x19')][_0xeb05('0x1a')](_0x57cb9a['body'],{'raw':_0x57cb9a[_0xeb05('0x1b')]?_0x57cb9a[_0xeb05('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xeb05('0xc')](function(_0x14064a){logger[_0xeb05('0xd')](_0xeb05('0x18'),_0x57cb9a);logger['debug'](_0xeb05('0x18'),_0x57cb9a,JSON['stringify'](_0x14064a));_0x340359(_0x14064a);})[_0xeb05('0x17')](function(_0x4a6760){logger[_0xeb05('0x13')]('CreateCmHopperHistory',_0x4a6760[_0xeb05('0x15')],_0x57cb9a);_0xae70db(_0x257097[_0xeb05('0x13')](0x1f4,_0x4a6760[_0xeb05('0x15')]));});});};exports[_0xeb05('0x1c')]=function(_0x12f129){var _0x2b6142=this;return new Promise(function(_0xd3ea2f,_0x37906c){return db[_0xeb05('0x19')][_0xeb05('0x1d')]({'raw':_0x12f129[_0xeb05('0x1b')]?_0x12f129[_0xeb05('0x1b')][_0xeb05('0x1e')]===undefined?!![]:![]:!![],'where':_0x12f129[_0xeb05('0x1b')]?_0x12f129[_0xeb05('0x1b')][_0xeb05('0x1f')]||null:null,'attributes':[[db[_0xeb05('0x20')]['fn'](_0xeb05('0x21'),db['sequelize'][_0xeb05('0x22')]('id')),_0xeb05('0x23')],[db[_0xeb05('0x20')]['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db['sequelize'][_0xeb05('0x24')](_0xeb05('0x25')))),_0xeb05('0x26')],[db[_0xeb05('0x20')]['fn'](_0xeb05('0x21'),db['sequelize']['fn']('IF',db[_0xeb05('0x20')][_0xeb05('0x24')](_0xeb05('0x27')))),_0xeb05('0x28')],[db[_0xeb05('0x20')]['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db[_0xeb05('0x20')][_0xeb05('0x24')](_0xeb05('0x29')))),_0xeb05('0x2a')],[db[_0xeb05('0x20')]['fn'](_0xeb05('0x2b'),db[_0xeb05('0x20')]['fn']('IF',db[_0xeb05('0x20')][_0xeb05('0x24')](_0xeb05('0x2c')))),_0xeb05('0x2d')],[db[_0xeb05('0x20')]['fn']('AVG',db[_0xeb05('0x20')]['fn']('IF',db['sequelize'][_0xeb05('0x24')](_0xeb05('0x2e')))),_0xeb05('0x2f')]]})['then'](function(_0x2ab0f5){logger[_0xeb05('0xd')](_0xeb05('0x1c'),_0x12f129);logger['debug'](_0xeb05('0x1c'),_0x12f129,JSON[_0xeb05('0x12')](_0x2ab0f5));_0xd3ea2f(_0x2ab0f5);})['catch'](function(_0x4e8bb3){logger[_0xeb05('0x13')](_0xeb05('0x1c'),_0x4e8bb3[_0xeb05('0x15')],_0x12f129);_0x37906c(_0x2b6142[_0xeb05('0x13')](0x1f4,_0x4e8bb3[_0xeb05('0x15')]));});});};exports[_0xeb05('0x30')]=function(_0x5d065b){var _0x9a8c59=this;return new Promise(function(_0x447cef,_0x4a19f1){return db['CmHopperHistory'][_0xeb05('0x1d')]({'raw':_0x5d065b[_0xeb05('0x1b')]?_0x5d065b[_0xeb05('0x1b')][_0xeb05('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d065b['options']?_0x5d065b[_0xeb05('0x1b')]['where']||null:null,'attributes':[[_0xeb05('0x31'),_0xeb05('0x32')],[db[_0xeb05('0x20')]['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db[_0xeb05('0x20')][_0xeb05('0x24')](_0xeb05('0x33')))),_0xeb05('0x34')],[db[_0xeb05('0x20')]['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db[_0xeb05('0x20')][_0xeb05('0x24')]('`state`\x20=\x203,\x201,\x20null'))),_0xeb05('0x35')],[db[_0xeb05('0x20')]['fn']('COUNT',db[_0xeb05('0x20')]['fn']('IF',db[_0xeb05('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xeb05('0x36')],[db[_0xeb05('0x20')]['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db[_0xeb05('0x20')][_0xeb05('0x24')](_0xeb05('0x37')))),_0xeb05('0x38')],[db['sequelize']['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db[_0xeb05('0x20')][_0xeb05('0x24')](_0xeb05('0x39')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xeb05('0x3a')],[db['sequelize']['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db[_0xeb05('0x20')][_0xeb05('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xeb05('0x3b')],[db[_0xeb05('0x20')]['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db['sequelize'][_0xeb05('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),_0xeb05('0x3c')],[db['sequelize']['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db['sequelize'][_0xeb05('0x24')](_0xeb05('0x3d')))),_0xeb05('0x3e')],[db[_0xeb05('0x20')]['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db[_0xeb05('0x20')][_0xeb05('0x24')](_0xeb05('0x3f')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0xeb05('0x21'),db['sequelize']['fn']('IF',db[_0xeb05('0x20')][_0xeb05('0x24')](_0xeb05('0x40')))),_0xeb05('0x41')],[db[_0xeb05('0x20')]['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db[_0xeb05('0x20')][_0xeb05('0x24')](_0xeb05('0x42')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db['sequelize'][_0xeb05('0x24')](_0xeb05('0x43')))),_0xeb05('0x41')],[db[_0xeb05('0x20')]['fn'](_0xeb05('0x21'),db[_0xeb05('0x20')]['fn']('IF',db[_0xeb05('0x20')][_0xeb05('0x24')](_0xeb05('0x44')))),'outboundReCallsDay']],'group':[_0xeb05('0x31')]})['then'](function(_0x4275e1){logger[_0xeb05('0xd')](_0xeb05('0x30'),_0x5d065b);logger[_0xeb05('0x10')]('GetVoiceQueueHopperHistory',_0x5d065b,JSON[_0xeb05('0x12')](_0x4275e1));_0x447cef(_0x4275e1);})[_0xeb05('0x17')](function(_0x7289a3){logger[_0xeb05('0x13')]('GetVoiceQueueHopperHistory',_0x7289a3[_0xeb05('0x15')],_0x5d065b);_0x4a19f1(_0x9a8c59[_0xeb05('0x13')](0x1f4,_0x7289a3[_0xeb05('0x15')]));});});};exports[_0xeb05('0x45')]=function(_0x502604){var _0x9a9165=this;return new Promise(function(_0x4e1c48,_0x34267a){return db['CmHopperHistory']['findAll']({'raw':_0x502604['options']?_0x502604[_0xeb05('0x1b')][_0xeb05('0x1e')]===undefined?!![]:![]:!![],'where':_0x502604[_0xeb05('0x1b')]?_0x502604[_0xeb05('0x1b')][_0xeb05('0x1f')]||null:null,'attributes':[['campaign',_0xeb05('0x32')],[db[_0xeb05('0x20')]['fn']('COUNT',db[_0xeb05('0x20')][_0xeb05('0x22')]('id')),'ivrTotalCallsDays'],[db[_0xeb05('0x20')]['fn']('COUNT',db[_0xeb05('0x20')]['fn']('IF',db[_0xeb05('0x20')]['literal'](_0xeb05('0x25')))),_0xeb05('0x46')]],'group':[_0xeb05('0x31')]})[_0xeb05('0xc')](function(_0x5a3989){logger[_0xeb05('0xd')](_0xeb05('0x45'),_0x502604);logger[_0xeb05('0x10')](_0xeb05('0x45'),_0x502604,JSON[_0xeb05('0x12')](_0x5a3989));_0x4e1c48(_0x5a3989);})[_0xeb05('0x17')](function(_0x53537f){logger[_0xeb05('0x13')](_0xeb05('0x45'),_0x53537f[_0xeb05('0x15')],_0x502604);_0x34267a(_0x9a9165[_0xeb05('0x13')](0x1f4,_0x53537f[_0xeb05('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index bac3688..3639663 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 _0x228b=['put','update','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','describe','/:id','post','create'];(function(_0x41fcd1,_0x266928){var _0x596923=function(_0x16f300){while(--_0x16f300){_0x41fcd1['push'](_0x41fcd1['shift']());}};_0x596923(++_0x266928);}(_0x228b,0x1f3));var _0xb228=function(_0x6999bc,_0x395beb){_0x6999bc=_0x6999bc-0x0;var _0x88b853=_0x228b[_0x6999bc];return _0x88b853;};'use strict';var multer=require('multer');var util=require(_0xb228('0x0'));var path=require('path');var timeout=require(_0xb228('0x1'));var express=require(_0xb228('0x2'));var router=express[_0xb228('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb228('0x4'));var config=require(_0xb228('0x5'));var controller=require(_0xb228('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb228('0x7')]('/describe',auth[_0xb228('0x8')](),controller[_0xb228('0x9')]);router['get'](_0xb228('0xa'),auth[_0xb228('0x8')](),controller['show']);router[_0xb228('0xb')]('/',auth['isAuthenticated'](),controller[_0xb228('0xc')]);router[_0xb228('0xd')](_0xb228('0xa'),auth['isAuthenticated'](),controller[_0xb228('0xe')]);module[_0xb228('0xf')]=router; \ No newline at end of file +var _0xd603=['describe','get','/:id','show','create','put','update','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','index','/describe'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd603,0x103));var _0x3d60=function(_0x304b67,_0x31cb39){_0x304b67=_0x304b67-0x0;var _0x493afb=_0xd603[_0x304b67];return _0x493afb;};'use strict';var multer=require(_0x3d60('0x0'));var util=require('util');var path=require(_0x3d60('0x1'));var timeout=require(_0x3d60('0x2'));var express=require(_0x3d60('0x3'));var router=express[_0x3d60('0x4')]();var auth=require(_0x3d60('0x5'));var interaction=require(_0x3d60('0x6'));var config=require('../../config/environment');var controller=require(_0x3d60('0x7'));router['get']('/',auth[_0x3d60('0x8')](),controller[_0x3d60('0x9')]);router['get'](_0x3d60('0xa'),auth[_0x3d60('0x8')](),controller[_0x3d60('0xb')]);router[_0x3d60('0xc')](_0x3d60('0xd'),auth[_0x3d60('0x8')](),controller[_0x3d60('0xe')]);router['post']('/',auth[_0x3d60('0x8')](),controller[_0x3d60('0xf')]);router[_0x3d60('0x10')]('/:id',auth[_0x3d60('0x8')](),controller[_0x3d60('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 004547b..4dc7706 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 _0xbb50=['name','sequelize','exports','STRING'];(function(_0x2c41ea,_0x187b8f){var _0x21f045=function(_0x2e92a4){while(--_0x2e92a4){_0x2c41ea['push'](_0x2c41ea['shift']());}};_0x21f045(++_0x187b8f);}(_0xbb50,0xb9));var _0x0bb5=function(_0x44a317,_0x1eefd6){_0x44a317=_0x44a317-0x0;var _0x184ec3=_0xbb50[_0x44a317];return _0x184ec3;};'use strict';var Sequelize=require(_0x0bb5('0x0'));module[_0x0bb5('0x1')]={'name':{'type':Sequelize[_0x0bb5('0x2')],'unique':_0x0bb5('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0bb5('0x2')]},'dialPrefix':{'type':Sequelize[_0x0bb5('0x2')]}}; \ No newline at end of file +var _0xe9bb=['STRING','name','sequelize'];(function(_0x1b72ae,_0x5475f7){var _0x5cad70=function(_0x37d413){while(--_0x37d413){_0x1b72ae['push'](_0x1b72ae['shift']());}};_0x5cad70(++_0x5475f7);}(_0xe9bb,0x15e));var _0xbe9b=function(_0x2bf166,_0x535e34){_0x2bf166=_0x2bf166-0x0;var _0xe94bb2=_0xe9bb[_0x2bf166];return _0xe94bb2;};'use strict';var Sequelize=require(_0xbe9b('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe9b('0x1')],'unique':_0xbe9b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbe9b('0x1')]},'dialPrefix':{'type':Sequelize[_0xbe9b('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 18556d5..eab4d9f 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 _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','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','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x2892d9,_0x4ca615){var _0x15218d=function(_0xfc5d4c){while(--_0xfc5d4c){_0x2892d9['push'](_0x2892d9['shift']());}};_0x15218d(++_0x4ca615);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file +var _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','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','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x105411,_0x59d1bc){var _0x38eab7=function(_0x2ececf){while(--_0x2ececf){_0x105411['push'](_0x105411['shift']());}};_0x38eab7(++_0x59d1bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 325044c..f9df8fb 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 _0xba3e=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','CmList'];(function(_0x58930d,_0x3484c0){var _0x338d5b=function(_0x3b494c){while(--_0x3b494c){_0x58930d['push'](_0x58930d['shift']());}};_0x338d5b(++_0x3484c0);}(_0xba3e,0x11d));var _0xeba3=function(_0xb183fb,_0x3dcef2){_0xb183fb=_0xb183fb-0x0;var _0x52f4f4=_0xba3e[_0xb183fb];return _0x52f4f4;};'use strict';var EventEmitter=require(_0xeba3('0x0'));var CmList=require(_0xeba3('0x1'))['db'][_0xeba3('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xeba3('0x3')](0x0);var events={'afterCreate':_0xeba3('0x4'),'afterUpdate':_0xeba3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x49b8b0){return function(_0x166abe,_0x449976,_0x4c43f5){CmListEvents[_0xeba3('0x6')](_0x49b8b0+':'+_0x166abe['id'],_0x166abe);CmListEvents[_0xeba3('0x6')](_0x49b8b0,_0x166abe);_0x4c43f5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xeba3('0x7')](e,emitEvent(event));}}module[_0xeba3('0x8')]=CmListEvents; \ No newline at end of file +var _0x5157=['setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5157,0x7f));var _0x7515=function(_0xd8bbd3,_0x3dfeb1){_0xd8bbd3=_0xd8bbd3-0x0;var _0x312f62=_0x5157[_0xd8bbd3];return _0x312f62;};'use strict';var EventEmitter=require(_0x7515('0x0'));var CmList=require(_0x7515('0x1'))['db'][_0x7515('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7515('0x3')](0x0);var events={'afterCreate':_0x7515('0x4'),'afterUpdate':_0x7515('0x5'),'afterDestroy':_0x7515('0x6')};function emitEvent(_0x46a745){return function(_0x4176d3,_0xdbff88,_0x422acf){CmListEvents['emit'](_0x46a745+':'+_0x4176d3['id'],_0x4176d3);CmListEvents['emit'](_0x46a745,_0x4176d3);_0x422acf(null);};}for(var e in events){if(events[_0x7515('0x7')](e)){var event=events[e];CmList[_0x7515('0x8')](e,emitEvent(event));}}module[_0x7515('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 021f580..97f3e91 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 _0x0bd3=['request-promise','path','rimraf','./cmList.attributes','define','lodash','util','moment','bluebird'];(function(_0xbc63fa,_0x641286){var _0x48e180=function(_0x2506e7){while(--_0x2506e7){_0xbc63fa['push'](_0xbc63fa['shift']());}};_0x48e180(++_0x641286);}(_0x0bd3,0x191));var _0x30bd=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x0bd3[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x30bd('0x0'));var util=require(_0x30bd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x30bd('0x2'));var BPromise=require(_0x30bd('0x3'));var rp=require(_0x30bd('0x4'));var fs=require('fs');var path=require(_0x30bd('0x5'));var rimraf=require(_0x30bd('0x6'));var config=require('../../config/environment');var attributes=require(_0x30bd('0x7'));module['exports']=function(_0x23d251,_0x527950){return _0x23d251[_0x30bd('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb196=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','cm_lists','lodash','util','../../config/logger'];(function(_0x47899b,_0x3a9171){var _0x3cf890=function(_0x1a4574){while(--_0x1a4574){_0x47899b['push'](_0x47899b['shift']());}};_0x3cf890(++_0x3a9171);}(_0xb196,0x1c5));var _0x6b19=function(_0x577006,_0x10100a){_0x577006=_0x577006-0x0;var _0x244947=_0xb196[_0x577006];return _0x244947;};'use strict';var _=require(_0x6b19('0x0'));var util=require(_0x6b19('0x1'));var logger=require(_0x6b19('0x2'))(_0x6b19('0x3'));var moment=require(_0x6b19('0x4'));var BPromise=require(_0x6b19('0x5'));var rp=require(_0x6b19('0x6'));var fs=require('fs');var path=require(_0x6b19('0x7'));var rimraf=require(_0x6b19('0x8'));var config=require(_0x6b19('0x9'));var attributes=require(_0x6b19('0xa'));module['exports']=function(_0xc52216,_0x865afa){return _0xc52216['define']('CmList',attributes,{'tableName':_0x6b19('0xb'),'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 184e8c8..1240ed9 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 _0x54d0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis'];(function(_0x493ed6,_0x442693){var _0x27311c=function(_0x225ce4){while(--_0x225ce4){_0x493ed6['push'](_0x493ed6['shift']());}};_0x27311c(++_0x442693);}(_0x54d0,0x1a0));var _0x054d=function(_0x19c5dd,_0x2a35f5){_0x19c5dd=_0x19c5dd-0x0;var _0x40218d=_0x54d0[_0x19c5dd];return _0x40218d;};'use strict';var _=require('lodash');var util=require(_0x054d('0x0'));var moment=require(_0x054d('0x1'));var BPromise=require('bluebird');var rs=require(_0x054d('0x2'));var fs=require('fs');var Redis=require(_0x054d('0x3'));var db=require(_0x054d('0x4'))['db'];var utils=require(_0x054d('0x5'));var logger=require(_0x054d('0x6'))(_0x054d('0x7'));var config=require(_0x054d('0x8'));var jayson=require(_0x054d('0x9'));var client=jayson['client'][_0x054d('0xa')]({'port':0x232a});config[_0x054d('0xb')]=_['defaults'](config[_0x054d('0xb')],{'host':_0x054d('0xc'),'port':0x18eb});var socket=require(_0x054d('0xd'))(new Redis(config['redis']));require(_0x054d('0xe'))[_0x054d('0xf')](socket);function respondWithRpcPromise(_0x4401e6,_0xaf76e1,_0x1a467b){return new BPromise(function(_0x3fdf98,_0x6ebf5a){return client[_0x054d('0x10')](_0x4401e6,_0x1a467b)['then'](function(_0x32fe8e){logger[_0x054d('0x11')](_0x054d('0x12'),_0xaf76e1,_0x054d('0x13'));logger[_0x054d('0x14')](_0x054d('0x15'),_0xaf76e1,'request\x20sent',JSON[_0x054d('0x16')](_0x32fe8e));if(_0x32fe8e[_0x054d('0x17')]){if(_0x32fe8e['error'][_0x054d('0x18')]===0x1f4){logger[_0x054d('0x17')]('CmList,\x20%s,\x20%s',_0xaf76e1,_0x32fe8e[_0x054d('0x17')][_0x054d('0x19')]);return _0x6ebf5a(_0x32fe8e[_0x054d('0x17')]['message']);}logger[_0x054d('0x17')](_0x054d('0x12'),_0xaf76e1,_0x32fe8e['error'][_0x054d('0x19')]);return _0x3fdf98(_0x32fe8e[_0x054d('0x17')][_0x054d('0x19')]);}else{logger[_0x054d('0x11')](_0x054d('0x12'),_0xaf76e1,'request\x20sent');_0x3fdf98(_0x32fe8e[_0x054d('0x1a')][_0x054d('0x19')]);}})[_0x054d('0x1b')](function(_0x1054a0){logger[_0x054d('0x17')]('CmList,\x20%s,\x20%s',_0xaf76e1,_0x1054a0);_0x6ebf5a(_0x1054a0);});});} \ No newline at end of file +var _0x7307=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1923d8,_0x2fd8e3){var _0x467171=function(_0x295279){while(--_0x295279){_0x1923d8['push'](_0x1923d8['shift']());}};_0x467171(++_0x2fd8e3);}(_0x7307,0x121));var _0x7730=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x7307[_0x179b53];return _0x38a146;};'use strict';var _=require(_0x7730('0x0'));var util=require(_0x7730('0x1'));var moment=require(_0x7730('0x2'));var BPromise=require(_0x7730('0x3'));var rs=require(_0x7730('0x4'));var fs=require('fs');var Redis=require(_0x7730('0x5'));var db=require(_0x7730('0x6'))['db'];var utils=require(_0x7730('0x7'));var logger=require(_0x7730('0x8'))('rpc');var config=require(_0x7730('0x9'));var jayson=require(_0x7730('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x7730('0xb')]=_[_0x7730('0xc')](config[_0x7730('0xb')],{'host':_0x7730('0xd'),'port':0x18eb});var socket=require(_0x7730('0xe'))(new Redis(config[_0x7730('0xb')]));require('./cmList.socket')[_0x7730('0xf')](socket);function respondWithRpcPromise(_0xeca728,_0x29dc03,_0xc15d27){return new BPromise(function(_0x8ddc73,_0x508a78){return client[_0x7730('0x10')](_0xeca728,_0xc15d27)[_0x7730('0x11')](function(_0x22d572){logger[_0x7730('0x12')](_0x7730('0x13'),_0x29dc03,_0x7730('0x14'));logger[_0x7730('0x15')](_0x7730('0x16'),_0x29dc03,_0x7730('0x14'),JSON[_0x7730('0x17')](_0x22d572));if(_0x22d572['error']){if(_0x22d572[_0x7730('0x18')][_0x7730('0x19')]===0x1f4){logger[_0x7730('0x18')](_0x7730('0x13'),_0x29dc03,_0x22d572[_0x7730('0x18')][_0x7730('0x1a')]);return _0x508a78(_0x22d572[_0x7730('0x18')][_0x7730('0x1a')]);}logger[_0x7730('0x18')]('CmList,\x20%s,\x20%s',_0x29dc03,_0x22d572['error']['message']);return _0x8ddc73(_0x22d572[_0x7730('0x18')][_0x7730('0x1a')]);}else{logger[_0x7730('0x12')](_0x7730('0x13'),_0x29dc03,_0x7730('0x14'));_0x8ddc73(_0x22d572[_0x7730('0x1b')][_0x7730('0x1a')]);}})[_0x7730('0x1c')](function(_0x3fce66){logger[_0x7730('0x18')](_0x7730('0x13'),_0x29dc03,_0x3fce66);_0x508a78(_0x3fce66);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 0d06ce6..e72d188 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 _0x6dc0=['./cmList.events','remove','update','removeListener','length','cmList:'];(function(_0x1ec7b0,_0x2eb52a){var _0x5aff54=function(_0x1af5e6){while(--_0x1af5e6){_0x1ec7b0['push'](_0x1ec7b0['shift']());}};_0x5aff54(++_0x2eb52a);}(_0x6dc0,0x18c));var _0x06dc=function(_0x55c4a3,_0x31e015){_0x55c4a3=_0x55c4a3-0x0;var _0xedb4a3=_0x6dc0[_0x55c4a3];return _0xedb4a3;};'use strict';var CmListEvents=require(_0x06dc('0x0'));var events=['save',_0x06dc('0x1'),_0x06dc('0x2')];function createListener(_0x4434e2,_0xc40894){return function(_0x414760){_0xc40894['emit'](_0x4434e2,_0x414760);};}function removeListener(_0x4effcf,_0x2cad0f){return function(){CmListEvents[_0x06dc('0x3')](_0x4effcf,_0x2cad0f);};}exports['register']=function(_0x45a093){for(var _0x26b287=0x0,_0x4ac3b4=events[_0x06dc('0x4')];_0x26b287<_0x4ac3b4;_0x26b287++){var _0x523fb5=events[_0x26b287];var _0xeac52b=createListener(_0x06dc('0x5')+_0x523fb5,_0x45a093);CmListEvents['on'](_0x523fb5,_0xeac52b);}}; \ No newline at end of file +var _0xceae=['./cmList.events','save','removeListener','register','length'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xceae,0x122));var _0xecea=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xceae[_0x57add2];return _0x4e3670;};'use strict';var CmListEvents=require(_0xecea('0x0'));var events=[_0xecea('0x1'),'remove','update'];function createListener(_0x5f37e7,_0x6e4afb){return function(_0x5cecf4){_0x6e4afb['emit'](_0x5f37e7,_0x5cecf4);};}function removeListener(_0x28b2cf,_0x457d37){return function(){CmListEvents[_0xecea('0x2')](_0x28b2cf,_0x457d37);};}exports[_0xecea('0x3')]=function(_0x1588bf){for(var _0x1b1b68=0x0,_0x2a3f5b=events[_0xecea('0x4')];_0x1b1b68<_0x2a3f5b;_0x1b1b68++){var _0x1663e2=events[_0x1b1b68];var _0x46bb33=createListener('cmList:'+_0x1663e2,_0x1588bf);CmListEvents['on'](_0x1663e2,_0x46bb33);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index d1b5b66..1db3f10 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 9aab5b1..7ba839b 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(_0x348dea,_0x17afb1){var _0x23d676=function(_0xce3017){while(--_0xce3017){_0x348dea['push'](_0x348dea['shift']());}};_0x23d676(++_0x17afb1);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0xb24a4,_0x4eb72e){var _0x482fb9=function(_0x2d1fba){while(--_0x2d1fba){_0xb24a4['push'](_0xb24a4['shift']());}};_0x482fb9(++_0x4eb72e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('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 a82d1ae..098774c 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 _0x7242=['util','path','sox','to-csv','ejs','squel','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','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','body','Condition','find','params','catch','destroy','html-pdf','eml-format','rimraf','zip-dir','bluebird'];(function(_0x56c7ae,_0x347b2e){var _0x4171fd=function(_0xa3f0ed){while(--_0xa3f0ed){_0x56c7ae['push'](_0x56c7ae['shift']());}};_0x4171fd(++_0x347b2e);}(_0x7242,0x1a2));var _0x2724=function(_0x5b2709,_0x1e2616){_0x5b2709=_0x5b2709-0x0;var _0x15b0be=_0x7242[_0x5b2709];return _0x15b0be;};'use strict';var pdf=require(_0x2724('0x0'));var emlformat=require(_0x2724('0x1'));var rimraf=require(_0x2724('0x2'));var zipdir=require(_0x2724('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2724('0x4'));var Mustache=require('mustache');var util=require(_0x2724('0x5'));var path=require(_0x2724('0x6'));var sox=require(_0x2724('0x7'));var csv=require(_0x2724('0x8'));var ejs=require(_0x2724('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2724('0xa'));var crypto=require('crypto');var jsforce=require(_0x2724('0xb'));var deskjs=require(_0x2724('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2724('0xd'));var Papa=require(_0x2724('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2724('0xf'));var as=require(_0x2724('0x10'));var hardwareService=require(_0x2724('0x11'));var logger=require(_0x2724('0x12'))(_0x2724('0x13'));var utils=require(_0x2724('0x14'));var config=require(_0x2724('0x15'));var licenseUtil=require(_0x2724('0x16'));var db=require(_0x2724('0x17'))['db'];function respondWithStatusCode(_0x3fe8d9,_0x4a411b){_0x4a411b=_0x4a411b||0xcc;return function(_0x3845f7){if(_0x3845f7){return _0x3fe8d9[_0x2724('0x18')](_0x4a411b);}return _0x3fe8d9[_0x2724('0x19')](_0x4a411b)[_0x2724('0x1a')]();};}function respondWithResult(_0x16a5e4,_0xc1bd95){_0xc1bd95=_0xc1bd95||0xc8;return function(_0xe073d3){if(_0xe073d3){return _0x16a5e4['status'](_0xc1bd95)[_0x2724('0x1b')](_0xe073d3);}};}function respondWithFilteredResult(_0x2d17ed,_0x2621f6){return function(_0x70a36){if(_0x70a36){var _0x15f71d=_0x70a36[_0x2724('0x1c')],_0x30ecac=_0x2621f6[_0x2724('0x1d')],_0x599086=_0x2621f6[_0x2724('0x1d')]+_0x2621f6[_0x2724('0x1e')],_0x490680;if(_0x599086>=_0x15f71d){_0x599086=_0x15f71d;_0x490680=0xc8;}else{_0x490680=0xce;}_0x2d17ed[_0x2724('0x19')](_0x490680);return _0x2d17ed[_0x2724('0x1f')]('Content-Range',_0x30ecac+'-'+_0x599086+'/'+_0x15f71d)['json'](_0x70a36);}return null;};}function patchUpdates(_0x1b879c){return function(_0x5ee0dc){try{jsonpatch[_0x2724('0x20')](_0x5ee0dc,_0x1b879c,!![]);}catch(_0x4da009){return BPromise[_0x2724('0x21')](_0x4da009);}return _0x5ee0dc[_0x2724('0x22')]();};}function saveUpdates(_0x28c0e0,_0x2ffb20){return function(_0x24edc3){if(_0x24edc3){return _0x24edc3[_0x2724('0x23')](_0x28c0e0)[_0x2724('0x24')](function(_0x521a6f){return _0x521a6f;});}return null;};}function removeEntity(_0x5b24df,_0x51de52){return function(_0x2932d4){if(_0x2932d4){return _0x2932d4['destroy']()[_0x2724('0x24')](function(){_0x5b24df[_0x2724('0x19')](0xcc)[_0x2724('0x1a')]();});}};}function handleEntityNotFound(_0x17fa68,_0x79adc5){return function(_0x478b47){if(!_0x478b47){_0x17fa68['sendStatus'](0x194);}return _0x478b47;};}function handleError(_0x1f1cbf,_0x4d73dc){_0x4d73dc=_0x4d73dc||0x1f4;return function(_0xd5d321){logger[_0x2724('0x25')](_0xd5d321[_0x2724('0x26')]);if(_0xd5d321[_0x2724('0x27')]){delete _0xd5d321[_0x2724('0x27')];}_0x1f1cbf[_0x2724('0x19')](_0x4d73dc)[_0x2724('0x28')](_0xd5d321);};}exports[_0x2724('0x23')]=function(_0x513472,_0x478e2b){if(_0x513472[_0x2724('0x29')]['id']){delete _0x513472[_0x2724('0x29')]['id'];}return db[_0x2724('0x2a')][_0x2724('0x2b')]({'where':{'id':_0x513472[_0x2724('0x2c')]['id']}})[_0x2724('0x24')](handleEntityNotFound(_0x478e2b,null))[_0x2724('0x24')](saveUpdates(_0x513472[_0x2724('0x29')],null))['then'](respondWithResult(_0x478e2b,null))[_0x2724('0x2d')](handleError(_0x478e2b,null));};exports[_0x2724('0x2e')]=function(_0x1faf8f,_0x3dff1f){return db['Condition'][_0x2724('0x2b')]({'where':{'id':_0x1faf8f['params']['id']}})[_0x2724('0x24')](handleEntityNotFound(_0x3dff1f,null))[_0x2724('0x24')](removeEntity(_0x3dff1f,null))[_0x2724('0x2d')](handleError(_0x3dff1f,null));}; \ No newline at end of file +var _0x9f63=['Condition','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','body','find','params','catch'];(function(_0x48fc40,_0x2d9944){var _0x32054b=function(_0x3b7d0f){while(--_0x3b7d0f){_0x48fc40['push'](_0x48fc40['shift']());}};_0x32054b(++_0x2d9944);}(_0x9f63,0x196));var _0x39f6=function(_0x548865,_0x4f67cf){_0x548865=_0x548865-0x0;var _0x3d9247=_0x9f63[_0x548865];return _0x3d9247;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x39f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x39f6('0x1'));var jsonpatch=require(_0x39f6('0x2'));var rp=require('request-promise');var moment=require(_0x39f6('0x3'));var BPromise=require(_0x39f6('0x4'));var Mustache=require(_0x39f6('0x5'));var util=require(_0x39f6('0x6'));var path=require(_0x39f6('0x7'));var sox=require('sox');var csv=require(_0x39f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x39f6('0x9'));var squel=require('squel');var crypto=require(_0x39f6('0xa'));var jsforce=require(_0x39f6('0xb'));var deskjs=require(_0x39f6('0xc'));var toCsv=require(_0x39f6('0x8'));var querystring=require(_0x39f6('0xd'));var Papa=require('papaparse');var Redis=require(_0x39f6('0xe'));var authService=require(_0x39f6('0xf'));var qs=require(_0x39f6('0x10'));var as=require(_0x39f6('0x11'));var hardwareService=require(_0x39f6('0x12'));var logger=require('../../config/logger')(_0x39f6('0x13'));var utils=require(_0x39f6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x39f6('0x15'));var db=require(_0x39f6('0x16'))['db'];function respondWithStatusCode(_0xdd4ba8,_0x2d1d6d){_0x2d1d6d=_0x2d1d6d||0xcc;return function(_0x8c7cdc){if(_0x8c7cdc){return _0xdd4ba8['sendStatus'](_0x2d1d6d);}return _0xdd4ba8[_0x39f6('0x17')](_0x2d1d6d)[_0x39f6('0x18')]();};}function respondWithResult(_0x494ed8,_0x20fff9){_0x20fff9=_0x20fff9||0xc8;return function(_0x1dc8d7){if(_0x1dc8d7){return _0x494ed8[_0x39f6('0x17')](_0x20fff9)[_0x39f6('0x19')](_0x1dc8d7);}};}function respondWithFilteredResult(_0x29cdfd,_0x1b78ac){return function(_0x54ed20){if(_0x54ed20){var _0x1151d1=_0x54ed20[_0x39f6('0x1a')],_0x2ad2d3=_0x1b78ac['offset'],_0x4cf8fa=_0x1b78ac['offset']+_0x1b78ac[_0x39f6('0x1b')],_0x2a7887;if(_0x4cf8fa>=_0x1151d1){_0x4cf8fa=_0x1151d1;_0x2a7887=0xc8;}else{_0x2a7887=0xce;}_0x29cdfd[_0x39f6('0x17')](_0x2a7887);return _0x29cdfd[_0x39f6('0x1c')](_0x39f6('0x1d'),_0x2ad2d3+'-'+_0x4cf8fa+'/'+_0x1151d1)[_0x39f6('0x19')](_0x54ed20);}return null;};}function patchUpdates(_0x32dd85){return function(_0x32bd31){try{jsonpatch[_0x39f6('0x1e')](_0x32bd31,_0x32dd85,!![]);}catch(_0x489ef7){return BPromise[_0x39f6('0x1f')](_0x489ef7);}return _0x32bd31[_0x39f6('0x20')]();};}function saveUpdates(_0x3c2644,_0x240d0c){return function(_0x128481){if(_0x128481){return _0x128481[_0x39f6('0x21')](_0x3c2644)['then'](function(_0x41460d){return _0x41460d;});}return null;};}function removeEntity(_0xba4984,_0x204e38){return function(_0x13e41a){if(_0x13e41a){return _0x13e41a[_0x39f6('0x22')]()[_0x39f6('0x23')](function(){_0xba4984[_0x39f6('0x17')](0xcc)[_0x39f6('0x18')]();});}};}function handleEntityNotFound(_0x416c9d,_0x14262e){return function(_0x2bd5cd){if(!_0x2bd5cd){_0x416c9d['sendStatus'](0x194);}return _0x2bd5cd;};}function handleError(_0x200f25,_0x11d47a){_0x11d47a=_0x11d47a||0x1f4;return function(_0x32bdd4){logger[_0x39f6('0x24')](_0x32bdd4[_0x39f6('0x25')]);if(_0x32bdd4[_0x39f6('0x26')]){delete _0x32bdd4[_0x39f6('0x26')];}_0x200f25[_0x39f6('0x17')](_0x11d47a)[_0x39f6('0x27')](_0x32bdd4);};}exports['update']=function(_0x3d7934,_0x565941){if(_0x3d7934[_0x39f6('0x28')]['id']){delete _0x3d7934[_0x39f6('0x28')]['id'];}return db['Condition'][_0x39f6('0x29')]({'where':{'id':_0x3d7934[_0x39f6('0x2a')]['id']}})['then'](handleEntityNotFound(_0x565941,null))['then'](saveUpdates(_0x3d7934[_0x39f6('0x28')],null))[_0x39f6('0x23')](respondWithResult(_0x565941,null))[_0x39f6('0x2b')](handleError(_0x565941,null));};exports[_0x39f6('0x22')]=function(_0x4bdb8f,_0x9d12d5){return db[_0x39f6('0x2c')][_0x39f6('0x29')]({'where':{'id':_0x4bdb8f[_0x39f6('0x2a')]['id']}})['then'](handleEntityNotFound(_0x9d12d5,null))[_0x39f6('0x23')](removeEntity(_0x9d12d5,null))[_0x39f6('0x2b')](handleError(_0x9d12d5,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index ffb0fda..6a5d22d 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 _0xdff3=['tools_conditions','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./condition.attributes','define','Condition'];(function(_0x35baca,_0x53a4a5){var _0x5139fb=function(_0x10f5ea){while(--_0x10f5ea){_0x35baca['push'](_0x35baca['shift']());}};_0x5139fb(++_0x53a4a5);}(_0xdff3,0x1a3));var _0x3dff=function(_0x2ce50e,_0x46b800){_0x2ce50e=_0x2ce50e-0x0;var _0x2141c5=_0xdff3[_0x2ce50e];return _0x2141c5;};'use strict';var _=require(_0x3dff('0x0'));var util=require(_0x3dff('0x1'));var logger=require(_0x3dff('0x2'))('api');var moment=require(_0x3dff('0x3'));var BPromise=require('bluebird');var rp=require(_0x3dff('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3dff('0x5'));var config=require(_0x3dff('0x6'));var attributes=require(_0x3dff('0x7'));module['exports']=function(_0x1ca33e,_0x2c516d){return _0x1ca33e[_0x3dff('0x8')](_0x3dff('0x9'),attributes,{'tableName':_0x3dff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9cb=['path','./condition.attributes','Condition','tools_conditions','lodash','util','../../config/logger','api','request-promise'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe9cb,0x11b));var _0xbe9c=function(_0x1c977f,_0x20954e){_0x1c977f=_0x1c977f-0x0;var _0x5d57ef=_0xe9cb[_0x1c977f];return _0x5d57ef;};'use strict';var _=require(_0xbe9c('0x0'));var util=require(_0xbe9c('0x1'));var logger=require(_0xbe9c('0x2'))(_0xbe9c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbe9c('0x4'));var fs=require('fs');var path=require(_0xbe9c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe9c('0x6'));module['exports']=function(_0x3dddb6,_0x4d957d){return _0x3dddb6['define'](_0xbe9c('0x7'),attributes,{'tableName':_0xbe9c('0x8'),'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 a9bd5e2..4c3cb15 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 _0x57b8=['message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0xa35868,_0x437b44){var _0x8cb952=function(_0x4de3d8){while(--_0x4de3d8){_0xa35868['push'](_0xa35868['shift']());}};_0x8cb952(++_0x437b44);}(_0x57b8,0x16a));var _0x857b=function(_0x257397,_0x3b49c7){_0x257397=_0x257397-0x0;var _0x4f8dea=_0x57b8[_0x257397];return _0x4f8dea;};'use strict';var _=require(_0x857b('0x0'));var util=require(_0x857b('0x1'));var moment=require(_0x857b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x857b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x857b('0x4'));var logger=require(_0x857b('0x5'))(_0x857b('0x6'));var config=require(_0x857b('0x7'));var jayson=require(_0x857b('0x8'));var client=jayson['client'][_0x857b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54c70a,_0x1feeca,_0x3bdcb1){return new BPromise(function(_0x5ddac7,_0x2e88c0){return client['request'](_0x54c70a,_0x3bdcb1)[_0x857b('0xa')](function(_0x5cecc2){logger[_0x857b('0xb')](_0x857b('0xc'),_0x1feeca,'request\x20sent');logger[_0x857b('0xd')](_0x857b('0xe'),_0x1feeca,_0x857b('0xf'),JSON['stringify'](_0x5cecc2));if(_0x5cecc2['error']){if(_0x5cecc2[_0x857b('0x10')][_0x857b('0x11')]===0x1f4){logger[_0x857b('0x10')](_0x857b('0xc'),_0x1feeca,_0x5cecc2[_0x857b('0x10')][_0x857b('0x12')]);return _0x2e88c0(_0x5cecc2[_0x857b('0x10')]['message']);}logger[_0x857b('0x10')]('Condition,\x20%s,\x20%s',_0x1feeca,_0x5cecc2['error']['message']);return _0x5ddac7(_0x5cecc2[_0x857b('0x10')][_0x857b('0x12')]);}else{logger[_0x857b('0xb')](_0x857b('0xc'),_0x1feeca,_0x857b('0xf'));_0x5ddac7(_0x5cecc2['result']['message']);}})[_0x857b('0x13')](function(_0x45bd2b){logger['error'](_0x857b('0xc'),_0x1feeca,_0x45bd2b);_0x2e88c0(_0x45bd2b);});});} \ No newline at end of file +var _0x9318=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','request\x20sent','debug','error','code','Condition,\x20%s,\x20%s','message'];(function(_0x39423a,_0x3def9c){var _0x593ce7=function(_0x1ebb0f){while(--_0x1ebb0f){_0x39423a['push'](_0x39423a['shift']());}};_0x593ce7(++_0x3def9c);}(_0x9318,0x17e));var _0x8931=function(_0x1067b2,_0x443692){_0x1067b2=_0x1067b2-0x0;var _0x37ac06=_0x9318[_0x1067b2];return _0x37ac06;};'use strict';var _=require(_0x8931('0x0'));var util=require(_0x8931('0x1'));var moment=require('moment');var BPromise=require(_0x8931('0x2'));var rs=require(_0x8931('0x3'));var fs=require('fs');var Redis=require(_0x8931('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8931('0x5'));var logger=require(_0x8931('0x6'))(_0x8931('0x7'));var config=require(_0x8931('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33a671,_0xda9cf5,_0x25d12b){return new BPromise(function(_0x42f20d,_0x1995fd){return client['request'](_0x33a671,_0x25d12b)[_0x8931('0x9')](function(_0x5dee6b){logger[_0x8931('0xa')]('Condition,\x20%s,\x20%s',_0xda9cf5,_0x8931('0xb'));logger[_0x8931('0xc')]('Condition,\x20%s,\x20%s,\x20%s',_0xda9cf5,'request\x20sent',JSON['stringify'](_0x5dee6b));if(_0x5dee6b['error']){if(_0x5dee6b[_0x8931('0xd')][_0x8931('0xe')]===0x1f4){logger[_0x8931('0xd')](_0x8931('0xf'),_0xda9cf5,_0x5dee6b[_0x8931('0xd')][_0x8931('0x10')]);return _0x1995fd(_0x5dee6b[_0x8931('0xd')]['message']);}logger[_0x8931('0xd')](_0x8931('0xf'),_0xda9cf5,_0x5dee6b['error'][_0x8931('0x10')]);return _0x42f20d(_0x5dee6b[_0x8931('0xd')]['message']);}else{logger[_0x8931('0xa')](_0x8931('0xf'),_0xda9cf5,'request\x20sent');_0x42f20d(_0x5dee6b[_0x8931('0x11')][_0x8931('0x10')]);}})[_0x8931('0x12')](function(_0x5f2dc3){logger[_0x8931('0xd')](_0x8931('0xf'),_0xda9cf5,_0x5f2dc3);_0x1995fd(_0x5f2dc3);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 3307b9f..02d2112 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 _0x6b77=['multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','destroy','exports'];(function(_0x25d1f6,_0x48e719){var _0x239cbd=function(_0x5ae3c5){while(--_0x5ae3c5){_0x25d1f6['push'](_0x25d1f6['shift']());}};_0x239cbd(++_0x48e719);}(_0x6b77,0x1e0));var _0x76b7=function(_0x412077,_0x1261c3){_0x412077=_0x412077-0x0;var _0x7f2998=_0x6b77[_0x412077];return _0x7f2998;};'use strict';var multer=require(_0x76b7('0x0'));var util=require(_0x76b7('0x1'));var path=require(_0x76b7('0x2'));var timeout=require(_0x76b7('0x3'));var express=require(_0x76b7('0x4'));var router=express['Router']();var auth=require(_0x76b7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x76b7('0x6'));var controller=require(_0x76b7('0x7'));router[_0x76b7('0x8')](_0x76b7('0x9'),auth['isAuthenticated'](),controller[_0x76b7('0xa')]);router[_0x76b7('0xb')](_0x76b7('0x9'),auth[_0x76b7('0xc')](),controller[_0x76b7('0xd')]);module[_0x76b7('0xe')]=router; \ No newline at end of file +var _0xbba0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path'];(function(_0x344638,_0x51b81f){var _0xc19de5=function(_0x1db8c4){while(--_0x1db8c4){_0x344638['push'](_0x344638['shift']());}};_0xc19de5(++_0x51b81f);}(_0xbba0,0xee));var _0x0bba=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xbba0[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0x0bba('0x0'));var util=require('util');var path=require(_0x0bba('0x1'));var timeout=require(_0x0bba('0x2'));var express=require(_0x0bba('0x3'));var router=express[_0x0bba('0x4')]();var auth=require(_0x0bba('0x5'));var interaction=require(_0x0bba('0x6'));var config=require(_0x0bba('0x7'));var controller=require(_0x0bba('0x8'));router[_0x0bba('0x9')](_0x0bba('0xa'),auth[_0x0bba('0xb')](),controller[_0x0bba('0xc')]);router[_0x0bba('0xd')](_0x0bba('0xa'),auth[_0x0bba('0xb')](),controller[_0x0bba('0xe')]);module[_0x0bba('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index c901ed9..b1c5075 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 _0xd58c=['STRING','INTEGER','sequelize','exports'];(function(_0x224f64,_0x46f158){var _0x5293c3=function(_0x5aef39){while(--_0x5aef39){_0x224f64['push'](_0x224f64['shift']());}};_0x5293c3(++_0x46f158);}(_0xd58c,0xb6));var _0xcd58=function(_0x5b104e,_0x255cfb){_0x5b104e=_0x5b104e-0x0;var _0x41186a=_0xd58c[_0x5b104e];return _0x41186a;};'use strict';var Sequelize=require(_0xcd58('0x0'));module[_0xcd58('0x1')]={'name':{'type':Sequelize[_0xcd58('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xcd58('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x04de=['STRING','name','INTEGER','sequelize','exports'];(function(_0x2fcb0a,_0x1615ce){var _0x1ce0bb=function(_0x50eb44){while(--_0x50eb44){_0x2fcb0a['push'](_0x2fcb0a['shift']());}};_0x1ce0bb(++_0x1615ce);}(_0x04de,0x107));var _0xe04d=function(_0x440cae,_0x43adc7){_0x440cae=_0x440cae-0x0;var _0x3755d3=_0x04de[_0x440cae];return _0x3755d3;};'use strict';var Sequelize=require(_0xe04d('0x0'));module[_0xe04d('0x1')]={'name':{'type':Sequelize[_0xe04d('0x2')],'allowNull':![],'unique':_0xe04d('0x3')},'OrderBy':{'type':Sequelize[_0xe04d('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xe04d('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 3594848..92def0b 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 _0xb073=['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','sendStatus','end','status','json','offset','limit','apply','reject','save','update','then','destroy','ContactItemTypes','UserProfileResource','stack','name','send','index','map','ContactItemType','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','rows','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','error','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xb073,0x187));var _0x3b07=function(_0x584222,_0x2373e8){_0x584222=_0x584222-0x0;var _0x14d65a=_0xb073[_0x584222];return _0x14d65a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b07('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b07('0x1'));var jsonpatch=require(_0x3b07('0x2'));var rp=require(_0x3b07('0x3'));var moment=require('moment');var BPromise=require(_0x3b07('0x4'));var Mustache=require(_0x3b07('0x5'));var util=require(_0x3b07('0x6'));var path=require('path');var sox=require(_0x3b07('0x7'));var csv=require(_0x3b07('0x8'));var ejs=require(_0x3b07('0x9'));var fs=require('fs');var _=require(_0x3b07('0xa'));var squel=require(_0x3b07('0xb'));var crypto=require(_0x3b07('0xc'));var jsforce=require(_0x3b07('0xd'));var deskjs=require(_0x3b07('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b07('0xf'));var Redis=require(_0x3b07('0x10'));var authService=require(_0x3b07('0x11'));var qs=require(_0x3b07('0x12'));var as=require(_0x3b07('0x13'));var hardwareService=require(_0x3b07('0x14'));var logger=require(_0x3b07('0x15'))(_0x3b07('0x16'));var utils=require(_0x3b07('0x17'));var config=require(_0x3b07('0x18'));var licenseUtil=require(_0x3b07('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ed704,_0x25d3c5){_0x25d3c5=_0x25d3c5||0xcc;return function(_0x3f7091){if(_0x3f7091){return _0x4ed704[_0x3b07('0x1a')](_0x25d3c5);}return _0x4ed704['status'](_0x25d3c5)[_0x3b07('0x1b')]();};}function respondWithResult(_0x480593,_0x16c296){_0x16c296=_0x16c296||0xc8;return function(_0x589d65){if(_0x589d65){return _0x480593[_0x3b07('0x1c')](_0x16c296)[_0x3b07('0x1d')](_0x589d65);}};}function respondWithFilteredResult(_0x3da493,_0x33275d){return function(_0x2e1f12){if(_0x2e1f12){var _0x33d648=_0x2e1f12['count'],_0x4560db=_0x33275d['offset'],_0x268f0b=_0x33275d[_0x3b07('0x1e')]+_0x33275d[_0x3b07('0x1f')],_0x4f38b2;if(_0x268f0b>=_0x33d648){_0x268f0b=_0x33d648;_0x4f38b2=0xc8;}else{_0x4f38b2=0xce;}_0x3da493['status'](_0x4f38b2);return _0x3da493['set']('Content-Range',_0x4560db+'-'+_0x268f0b+'/'+_0x33d648)[_0x3b07('0x1d')](_0x2e1f12);}return null;};}function patchUpdates(_0x5847aa){return function(_0x5bd380){try{jsonpatch[_0x3b07('0x20')](_0x5bd380,_0x5847aa,!![]);}catch(_0x3b66ff){return BPromise[_0x3b07('0x21')](_0x3b66ff);}return _0x5bd380[_0x3b07('0x22')]();};}function saveUpdates(_0x21bef9,_0x1cf3f1){return function(_0x152553){if(_0x152553){return _0x152553[_0x3b07('0x23')](_0x21bef9)[_0x3b07('0x24')](function(_0x89d8){return _0x89d8;});}return null;};}function removeEntity(_0x4e4866,_0x31bd0f){return function(_0x4c7117){if(_0x4c7117){return _0x4c7117[_0x3b07('0x25')]()['then'](function(){var _0x20969e=_0x4c7117['get']({'plain':!![]});var _0x39dd6d=_0x3b07('0x26');return db[_0x3b07('0x27')]['destroy']({'where':{'type':_0x39dd6d,'resourceId':_0x20969e['id']}})[_0x3b07('0x24')](function(){return _0x4c7117;});})['then'](function(){_0x4e4866[_0x3b07('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbb8016,_0x33e124){return function(_0x1779ba){if(!_0x1779ba){_0xbb8016[_0x3b07('0x1a')](0x194);}return _0x1779ba;};}function handleError(_0x10e691,_0x106557){_0x106557=_0x106557||0x1f4;return function(_0x43d50f){logger['error'](_0x43d50f[_0x3b07('0x28')]);if(_0x43d50f[_0x3b07('0x29')]){delete _0x43d50f[_0x3b07('0x29')];}_0x10e691[_0x3b07('0x1c')](_0x106557)[_0x3b07('0x2a')](_0x43d50f);};}exports[_0x3b07('0x2b')]=function(_0x47e70a,_0x583a23){var _0x4acc7d={},_0x527ac9={},_0x194e81={'count':0x0,'rows':[]};var _0x129b5f=_[_0x3b07('0x2c')](db[_0x3b07('0x2d')][_0x3b07('0x2e')],function(_0x4491f2){return{'name':_0x4491f2['fieldName'],'type':_0x4491f2['type'][_0x3b07('0x2f')]};});_0x527ac9[_0x3b07('0x30')]=_[_0x3b07('0x2c')](_0x129b5f,'name');_0x527ac9[_0x3b07('0x31')]=_[_0x3b07('0x32')](_0x47e70a[_0x3b07('0x31')]);_0x527ac9[_0x3b07('0x33')]=_['intersection'](_0x527ac9[_0x3b07('0x30')],_0x527ac9[_0x3b07('0x31')]);_0x4acc7d[_0x3b07('0x34')]=_[_0x3b07('0x35')](_0x527ac9['model'],qs[_0x3b07('0x36')](_0x47e70a[_0x3b07('0x31')][_0x3b07('0x36')]));_0x4acc7d[_0x3b07('0x34')]=_0x4acc7d[_0x3b07('0x34')][_0x3b07('0x37')]?_0x4acc7d[_0x3b07('0x34')]:_0x527ac9[_0x3b07('0x30')];if(!_0x47e70a[_0x3b07('0x31')]['hasOwnProperty'](_0x3b07('0x38'))){_0x4acc7d[_0x3b07('0x1f')]=qs[_0x3b07('0x1f')](_0x47e70a['query']['limit']);_0x4acc7d[_0x3b07('0x1e')]=qs[_0x3b07('0x1e')](_0x47e70a[_0x3b07('0x31')][_0x3b07('0x1e')]);}_0x4acc7d['order']=qs[_0x3b07('0x39')](_0x47e70a[_0x3b07('0x31')][_0x3b07('0x39')]);_0x4acc7d['where']=qs[_0x3b07('0x33')](_['pick'](_0x47e70a[_0x3b07('0x31')],_0x527ac9[_0x3b07('0x33')]),_0x129b5f);if(_0x47e70a[_0x3b07('0x31')][_0x3b07('0x3a')]){_0x4acc7d[_0x3b07('0x3b')]=_[_0x3b07('0x3c')](_0x4acc7d[_0x3b07('0x3b')],{'$or':_[_0x3b07('0x2c')](_0x129b5f,function(_0x4f59ec){if(_0x4f59ec[_0x3b07('0x3d')]!==_0x3b07('0x3e')){var _0x52fb94={};_0x52fb94[_0x4f59ec[_0x3b07('0x29')]]={'$like':'%'+_0x47e70a['query']['filter']+'%'};return _0x52fb94;}})});}_0x4acc7d=_[_0x3b07('0x3c')]({},_0x4acc7d,_0x47e70a[_0x3b07('0x3f')]);var _0x5afc57={'where':_0x4acc7d[_0x3b07('0x3b')]};return db[_0x3b07('0x2d')][_0x3b07('0x40')](_0x5afc57)[_0x3b07('0x24')](function(_0x29dfdb){_0x194e81[_0x3b07('0x40')]=_0x29dfdb;if(_0x47e70a[_0x3b07('0x31')][_0x3b07('0x41')]){_0x4acc7d[_0x3b07('0x42')]=[{'all':!![]}];}return db[_0x3b07('0x2d')]['findAll'](_0x4acc7d);})['then'](function(_0x40bae5){_0x194e81[_0x3b07('0x43')]=_0x40bae5;return _0x194e81;})[_0x3b07('0x24')](respondWithFilteredResult(_0x583a23,_0x4acc7d))['catch'](handleError(_0x583a23,null));};exports[_0x3b07('0x44')]=function(_0x1f2c2f,_0x36be47){var _0x5ec356={'raw':!![],'where':{'id':_0x1f2c2f['params']['id']}},_0x4d7ff8={};_0x4d7ff8[_0x3b07('0x30')]=_[_0x3b07('0x32')](db[_0x3b07('0x2d')][_0x3b07('0x2e')]);_0x4d7ff8[_0x3b07('0x31')]=_[_0x3b07('0x32')](_0x1f2c2f[_0x3b07('0x31')]);_0x4d7ff8[_0x3b07('0x33')]=_[_0x3b07('0x35')](_0x4d7ff8['model'],_0x4d7ff8[_0x3b07('0x31')]);_0x5ec356[_0x3b07('0x34')]=_[_0x3b07('0x35')](_0x4d7ff8[_0x3b07('0x30')],qs['fields'](_0x1f2c2f[_0x3b07('0x31')][_0x3b07('0x36')]));_0x5ec356[_0x3b07('0x34')]=_0x5ec356['attributes'][_0x3b07('0x37')]?_0x5ec356['attributes']:_0x4d7ff8[_0x3b07('0x30')];if(_0x1f2c2f[_0x3b07('0x31')]['includeAll']){_0x5ec356[_0x3b07('0x42')]=[{'all':!![]}];}_0x5ec356=_[_0x3b07('0x3c')]({},_0x5ec356,_0x1f2c2f['options']);return db[_0x3b07('0x2d')][_0x3b07('0x45')](_0x5ec356)[_0x3b07('0x24')](handleEntityNotFound(_0x36be47,null))[_0x3b07('0x24')](respondWithResult(_0x36be47,null))[_0x3b07('0x46')](handleError(_0x36be47,null));};exports['create']=function(_0x3655cd,_0x5149a7){return db[_0x3b07('0x2d')][_0x3b07('0x47')](_0x3655cd[_0x3b07('0x48')],{})[_0x3b07('0x24')](function(_0x4e5bac){var _0x5c6254=_0x3655cd[_0x3b07('0x49')]['get']({'plain':!![]});if(!_0x5c6254)throw new Error(_0x3b07('0x4a'));if(_0x5c6254['role']===_0x3b07('0x49')){var _0x1033e2=_0x4e5bac[_0x3b07('0x4b')]({'plain':!![]});var _0x24375a='ContactItemTypes';return db[_0x3b07('0x4c')][_0x3b07('0x45')]({'where':{'name':_0x24375a,'userProfileId':_0x5c6254[_0x3b07('0x4d')]},'raw':!![]})[_0x3b07('0x24')](function(_0x2c17a4){if(_0x2c17a4&&_0x2c17a4[_0x3b07('0x4e')]===0x0){return db[_0x3b07('0x27')][_0x3b07('0x47')]({'name':_0x1033e2['name'],'resourceId':_0x1033e2['id'],'type':_0x2c17a4[_0x3b07('0x29')],'sectionId':_0x2c17a4['id']},{})[_0x3b07('0x24')](function(){return _0x4e5bac;});}else{return _0x4e5bac;}})[_0x3b07('0x46')](function(_0x239aff){logger[_0x3b07('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x239aff);throw _0x239aff;});}return _0x4e5bac;})['then'](respondWithResult(_0x5149a7,0xc9))[_0x3b07('0x46')](handleError(_0x5149a7,null));};exports[_0x3b07('0x23')]=function(_0x8b0335,_0x340a64){if(_0x8b0335['body']['id']){delete _0x8b0335[_0x3b07('0x48')]['id'];}return db[_0x3b07('0x2d')][_0x3b07('0x45')]({'where':{'id':_0x8b0335[_0x3b07('0x50')]['id']}})[_0x3b07('0x24')](handleEntityNotFound(_0x340a64,null))[_0x3b07('0x24')](saveUpdates(_0x8b0335[_0x3b07('0x48')],null))[_0x3b07('0x24')](respondWithResult(_0x340a64,null))['catch'](handleError(_0x340a64,null));};exports[_0x3b07('0x25')]=function(_0x40c5b8,_0x12860b){return db[_0x3b07('0x2d')][_0x3b07('0x45')]({'where':{'id':_0x40c5b8['params']['id']}})[_0x3b07('0x24')](handleEntityNotFound(_0x12860b,null))['then'](removeEntity(_0x12860b,null))[_0x3b07('0x46')](handleError(_0x12860b,null));}; \ No newline at end of file +var _0xed1c=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','end','error','stack','name','send','map','ContactItemType','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','merge','where','type','VIRTUAL','include','rows','show','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','html-pdf','eml-format','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x4a4563,_0x2771c3){var _0x201be1=function(_0x32505c){while(--_0x32505c){_0x4a4563['push'](_0x4a4563['shift']());}};_0x201be1(++_0x2771c3);}(_0xed1c,0xe4));var _0xced1=function(_0x28d885,_0x22d916){_0x28d885=_0x28d885-0x0;var _0x54e080=_0xed1c[_0x28d885];return _0x54e080;};'use strict';var pdf=require(_0xced1('0x0'));var emlformat=require(_0xced1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xced1('0x2'));var BPromise=require(_0xced1('0x3'));var Mustache=require(_0xced1('0x4'));var util=require('util');var path=require(_0xced1('0x5'));var sox=require(_0xced1('0x6'));var csv=require(_0xced1('0x7'));var ejs=require(_0xced1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xced1('0x9'));var crypto=require(_0xced1('0xa'));var jsforce=require(_0xced1('0xb'));var deskjs=require(_0xced1('0xc'));var toCsv=require(_0xced1('0x7'));var querystring=require(_0xced1('0xd'));var Papa=require(_0xced1('0xe'));var Redis=require(_0xced1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xced1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xced1('0x11'));var logger=require(_0xced1('0x12'))(_0xced1('0x13'));var utils=require(_0xced1('0x14'));var config=require(_0xced1('0x15'));var licenseUtil=require(_0xced1('0x16'));var db=require(_0xced1('0x17'))['db'];function respondWithStatusCode(_0x5e5637,_0x118f69){_0x118f69=_0x118f69||0xcc;return function(_0x2a5cd6){if(_0x2a5cd6){return _0x5e5637[_0xced1('0x18')](_0x118f69);}return _0x5e5637[_0xced1('0x19')](_0x118f69)['end']();};}function respondWithResult(_0xdaaea7,_0x31a32c){_0x31a32c=_0x31a32c||0xc8;return function(_0x54cba9){if(_0x54cba9){return _0xdaaea7[_0xced1('0x19')](_0x31a32c)[_0xced1('0x1a')](_0x54cba9);}};}function respondWithFilteredResult(_0x3708b1,_0x32100b){return function(_0x47baec){if(_0x47baec){var _0x5560af=_0x47baec[_0xced1('0x1b')],_0x3eb3ac=_0x32100b[_0xced1('0x1c')],_0x4178d8=_0x32100b[_0xced1('0x1c')]+_0x32100b['limit'],_0x236473;if(_0x4178d8>=_0x5560af){_0x4178d8=_0x5560af;_0x236473=0xc8;}else{_0x236473=0xce;}_0x3708b1['status'](_0x236473);return _0x3708b1[_0xced1('0x1d')](_0xced1('0x1e'),_0x3eb3ac+'-'+_0x4178d8+'/'+_0x5560af)[_0xced1('0x1a')](_0x47baec);}return null;};}function patchUpdates(_0x5257e7){return function(_0x1eac14){try{jsonpatch[_0xced1('0x1f')](_0x1eac14,_0x5257e7,!![]);}catch(_0x3e51e4){return BPromise['reject'](_0x3e51e4);}return _0x1eac14[_0xced1('0x20')]();};}function saveUpdates(_0x42b146,_0x23ded4){return function(_0x4819fd){if(_0x4819fd){return _0x4819fd[_0xced1('0x21')](_0x42b146)[_0xced1('0x22')](function(_0xc1bd39){return _0xc1bd39;});}return null;};}function removeEntity(_0x5f1474,_0x4dab56){return function(_0x1d3884){if(_0x1d3884){return _0x1d3884[_0xced1('0x23')]()[_0xced1('0x22')](function(){var _0x20dcb4=_0x1d3884[_0xced1('0x24')]({'plain':!![]});var _0x49c8b9=_0xced1('0x25');return db[_0xced1('0x26')]['destroy']({'where':{'type':_0x49c8b9,'resourceId':_0x20dcb4['id']}})['then'](function(){return _0x1d3884;});})[_0xced1('0x22')](function(){_0x5f1474[_0xced1('0x19')](0xcc)[_0xced1('0x27')]();});}};}function handleEntityNotFound(_0x3912fe,_0x1c2ba7){return function(_0x25b6e7){if(!_0x25b6e7){_0x3912fe['sendStatus'](0x194);}return _0x25b6e7;};}function handleError(_0x181f6e,_0xf51411){_0xf51411=_0xf51411||0x1f4;return function(_0x43cdec){logger[_0xced1('0x28')](_0x43cdec[_0xced1('0x29')]);if(_0x43cdec[_0xced1('0x2a')]){delete _0x43cdec[_0xced1('0x2a')];}_0x181f6e['status'](_0xf51411)[_0xced1('0x2b')](_0x43cdec);};}exports['index']=function(_0x45cb03,_0x2c2269){var _0x6dc558={},_0x176215={},_0x5f03cc={'count':0x0,'rows':[]};var _0x59361e=_[_0xced1('0x2c')](db[_0xced1('0x2d')][_0xced1('0x2e')],function(_0x4ea07e){return{'name':_0x4ea07e['fieldName'],'type':_0x4ea07e['type'][_0xced1('0x2f')]};});_0x176215[_0xced1('0x30')]=_[_0xced1('0x2c')](_0x59361e,_0xced1('0x2a'));_0x176215['query']=_[_0xced1('0x31')](_0x45cb03[_0xced1('0x32')]);_0x176215[_0xced1('0x33')]=_[_0xced1('0x34')](_0x176215[_0xced1('0x30')],_0x176215[_0xced1('0x32')]);_0x6dc558[_0xced1('0x35')]=_['intersection'](_0x176215['model'],qs[_0xced1('0x36')](_0x45cb03[_0xced1('0x32')][_0xced1('0x36')]));_0x6dc558[_0xced1('0x35')]=_0x6dc558[_0xced1('0x35')][_0xced1('0x37')]?_0x6dc558['attributes']:_0x176215['model'];if(!_0x45cb03['query']['hasOwnProperty'](_0xced1('0x38'))){_0x6dc558[_0xced1('0x39')]=qs[_0xced1('0x39')](_0x45cb03[_0xced1('0x32')][_0xced1('0x39')]);_0x6dc558[_0xced1('0x1c')]=qs[_0xced1('0x1c')](_0x45cb03[_0xced1('0x32')][_0xced1('0x1c')]);}_0x6dc558[_0xced1('0x3a')]=qs[_0xced1('0x3b')](_0x45cb03[_0xced1('0x32')][_0xced1('0x3b')]);_0x6dc558['where']=qs[_0xced1('0x33')](_[_0xced1('0x3c')](_0x45cb03[_0xced1('0x32')],_0x176215[_0xced1('0x33')]),_0x59361e);if(_0x45cb03[_0xced1('0x32')][_0xced1('0x3d')]){_0x6dc558['where']=_[_0xced1('0x3e')](_0x6dc558[_0xced1('0x3f')],{'$or':_[_0xced1('0x2c')](_0x59361e,function(_0x2970a6){if(_0x2970a6[_0xced1('0x40')]!==_0xced1('0x41')){var _0x46db93={};_0x46db93[_0x2970a6[_0xced1('0x2a')]]={'$like':'%'+_0x45cb03[_0xced1('0x32')][_0xced1('0x3d')]+'%'};return _0x46db93;}})});}_0x6dc558=_[_0xced1('0x3e')]({},_0x6dc558,_0x45cb03['options']);var _0x549a58={'where':_0x6dc558[_0xced1('0x3f')]};return db[_0xced1('0x2d')][_0xced1('0x1b')](_0x549a58)['then'](function(_0x393a3a){_0x5f03cc[_0xced1('0x1b')]=_0x393a3a;if(_0x45cb03[_0xced1('0x32')]['includeAll']){_0x6dc558[_0xced1('0x42')]=[{'all':!![]}];}return db[_0xced1('0x2d')]['findAll'](_0x6dc558);})[_0xced1('0x22')](function(_0x550276){_0x5f03cc[_0xced1('0x43')]=_0x550276;return _0x5f03cc;})[_0xced1('0x22')](respondWithFilteredResult(_0x2c2269,_0x6dc558))['catch'](handleError(_0x2c2269,null));};exports[_0xced1('0x44')]=function(_0x172a7e,_0xdb8e8e){var _0x569993={'raw':!![],'where':{'id':_0x172a7e[_0xced1('0x45')]['id']}},_0x39e46b={};_0x39e46b['model']=_[_0xced1('0x31')](db['ContactItemType']['rawAttributes']);_0x39e46b[_0xced1('0x32')]=_['keys'](_0x172a7e[_0xced1('0x32')]);_0x39e46b[_0xced1('0x33')]=_[_0xced1('0x34')](_0x39e46b['model'],_0x39e46b[_0xced1('0x32')]);_0x569993['attributes']=_[_0xced1('0x34')](_0x39e46b[_0xced1('0x30')],qs[_0xced1('0x36')](_0x172a7e[_0xced1('0x32')]['fields']));_0x569993[_0xced1('0x35')]=_0x569993[_0xced1('0x35')]['length']?_0x569993[_0xced1('0x35')]:_0x39e46b[_0xced1('0x30')];if(_0x172a7e['query'][_0xced1('0x46')]){_0x569993[_0xced1('0x42')]=[{'all':!![]}];}_0x569993=_[_0xced1('0x3e')]({},_0x569993,_0x172a7e['options']);return db[_0xced1('0x2d')][_0xced1('0x47')](_0x569993)[_0xced1('0x22')](handleEntityNotFound(_0xdb8e8e,null))[_0xced1('0x22')](respondWithResult(_0xdb8e8e,null))[_0xced1('0x48')](handleError(_0xdb8e8e,null));};exports['create']=function(_0x1482cc,_0x5e6669){return db[_0xced1('0x2d')][_0xced1('0x49')](_0x1482cc[_0xced1('0x4a')],{})[_0xced1('0x22')](function(_0x412693){var _0x38aa3b=_0x1482cc['user'][_0xced1('0x24')]({'plain':!![]});if(!_0x38aa3b)throw new Error(_0xced1('0x4b'));if(_0x38aa3b['role']===_0xced1('0x4c')){var _0x5a717a=_0x412693['get']({'plain':!![]});var _0x296d62=_0xced1('0x25');return db[_0xced1('0x4d')][_0xced1('0x47')]({'where':{'name':_0x296d62,'userProfileId':_0x38aa3b['userProfileId']},'raw':!![]})[_0xced1('0x22')](function(_0x33a8a6){if(_0x33a8a6&&_0x33a8a6[_0xced1('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a717a[_0xced1('0x2a')],'resourceId':_0x5a717a['id'],'type':_0x33a8a6[_0xced1('0x2a')],'sectionId':_0x33a8a6['id']},{})[_0xced1('0x22')](function(){return _0x412693;});}else{return _0x412693;}})[_0xced1('0x48')](function(_0x4b460e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b460e);throw _0x4b460e;});}return _0x412693;})[_0xced1('0x22')](respondWithResult(_0x5e6669,0xc9))[_0xced1('0x48')](handleError(_0x5e6669,null));};exports[_0xced1('0x21')]=function(_0x1b1631,_0x252160){if(_0x1b1631[_0xced1('0x4a')]['id']){delete _0x1b1631[_0xced1('0x4a')]['id'];}return db[_0xced1('0x2d')][_0xced1('0x47')]({'where':{'id':_0x1b1631['params']['id']}})[_0xced1('0x22')](handleEntityNotFound(_0x252160,null))[_0xced1('0x22')](saveUpdates(_0x1b1631[_0xced1('0x4a')],null))['then'](respondWithResult(_0x252160,null))[_0xced1('0x48')](handleError(_0x252160,null));};exports[_0xced1('0x23')]=function(_0x18be2b,_0x2acfd3){return db['ContactItemType'][_0xced1('0x47')]({'where':{'id':_0x18be2b['params']['id']}})['then'](handleEntityNotFound(_0x2acfd3,null))[_0xced1('0x22')](removeEntity(_0x2acfd3,null))[_0xced1('0x48')](handleError(_0x2acfd3,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 1c66b00..a93144b 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 _0x979e=['ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5c86e5,_0x4bc4e5){var _0x55d8b5=function(_0x1d6143){while(--_0x1d6143){_0x5c86e5['push'](_0x5c86e5['shift']());}};_0x55d8b5(++_0x4bc4e5);}(_0x979e,0x195));var _0xe979=function(_0x172e6b,_0x4328c1){_0x172e6b=_0x172e6b-0x0;var _0x5ace94=_0x979e[_0x172e6b];return _0x5ace94;};'use strict';var _=require(_0xe979('0x0'));var util=require(_0xe979('0x1'));var logger=require(_0xe979('0x2'))(_0xe979('0x3'));var moment=require('moment');var BPromise=require(_0xe979('0x4'));var rp=require(_0xe979('0x5'));var fs=require('fs');var path=require(_0xe979('0x6'));var rimraf=require(_0xe979('0x7'));var config=require(_0xe979('0x8'));var attributes=require('./contactItemType.attributes');module[_0xe979('0x9')]=function(_0x580e20,_0x1a0d35){return _0x580e20[_0xe979('0xa')](_0xe979('0xb'),attributes,{'tableName':_0xe979('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9303=['api','bluebird','rimraf','../../config/environment','./contactItemType.attributes','exports','tools_contact_item_types','lodash'];(function(_0x45855e,_0x1e9462){var _0x35e73b=function(_0x426f85){while(--_0x426f85){_0x45855e['push'](_0x45855e['shift']());}};_0x35e73b(++_0x1e9462);}(_0x9303,0xd7));var _0x3930=function(_0x361a28,_0x4da70e){_0x361a28=_0x361a28-0x0;var _0x2f8f23=_0x9303[_0x361a28];return _0x2f8f23;};'use strict';var _=require(_0x3930('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3930('0x1'));var moment=require('moment');var BPromise=require(_0x3930('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3930('0x3'));var config=require(_0x3930('0x4'));var attributes=require(_0x3930('0x5'));module[_0x3930('0x6')]=function(_0x57e19d,_0x44949e){return _0x57e19d['define']('ContactItemType',attributes,{'tableName':_0x3930('0x7'),'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 614fb31..e9ab327 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 _0xb18e=['debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent'];(function(_0x366589,_0x64f1a1){var _0x1cb727=function(_0x2c6e19){while(--_0x2c6e19){_0x366589['push'](_0x366589['shift']());}};_0x1cb727(++_0x64f1a1);}(_0xb18e,0x181));var _0xeb18=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0xb18e[_0x38fb0d];return _0x30a5d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeb18('0x0'));var BPromise=require('bluebird');var rs=require(_0xeb18('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb18('0x2'))['db'];var utils=require(_0xeb18('0x3'));var logger=require('../../config/logger')(_0xeb18('0x4'));var config=require(_0xeb18('0x5'));var jayson=require(_0xeb18('0x6'));var client=jayson[_0xeb18('0x7')][_0xeb18('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x183bdf,_0x4a9ddd,_0x1bc3ee){return new BPromise(function(_0x131389,_0x534358){return client[_0xeb18('0x9')](_0x183bdf,_0x1bc3ee)[_0xeb18('0xa')](function(_0x942945){logger[_0xeb18('0xb')](_0xeb18('0xc'),_0x4a9ddd,_0xeb18('0xd'));logger[_0xeb18('0xe')](_0xeb18('0xf'),_0x4a9ddd,_0xeb18('0xd'),JSON[_0xeb18('0x10')](_0x942945));if(_0x942945['error']){if(_0x942945[_0xeb18('0x11')][_0xeb18('0x12')]===0x1f4){logger['error'](_0xeb18('0xc'),_0x4a9ddd,_0x942945['error']['message']);return _0x534358(_0x942945[_0xeb18('0x11')][_0xeb18('0x13')]);}logger[_0xeb18('0x11')]('ContactItemType,\x20%s,\x20%s',_0x4a9ddd,_0x942945['error'][_0xeb18('0x13')]);return _0x131389(_0x942945[_0xeb18('0x11')]['message']);}else{logger[_0xeb18('0xb')](_0xeb18('0xc'),_0x4a9ddd,_0xeb18('0xd'));_0x131389(_0x942945['result'][_0xeb18('0x13')]);}})[_0xeb18('0x14')](function(_0x318043){logger[_0xeb18('0x11')](_0xeb18('0xc'),_0x4a9ddd,_0x318043);_0x534358(_0x318043);});});} \ No newline at end of file +var _0xb43b=['debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent'];(function(_0x196995,_0x2575dd){var _0x1ff73a=function(_0x4b6aeb){while(--_0x4b6aeb){_0x196995['push'](_0x196995['shift']());}};_0x1ff73a(++_0x2575dd);}(_0xb43b,0xbf));var _0xbb43=function(_0x480b24,_0x380114){_0x480b24=_0x480b24-0x0;var _0x2d6d0b=_0xb43b[_0x480b24];return _0x2d6d0b;};'use strict';var _=require(_0xbb43('0x0'));var util=require('util');var moment=require(_0xbb43('0x1'));var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require(_0xbb43('0x5'))['db'];var utils=require(_0xbb43('0x6'));var logger=require(_0xbb43('0x7'))(_0xbb43('0x8'));var config=require(_0xbb43('0x9'));var jayson=require(_0xbb43('0xa'));var client=jayson[_0xbb43('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16fc1c,_0x4a070c,_0x54806a){return new BPromise(function(_0x33f9a8,_0x120d67){return client[_0xbb43('0xc')](_0x16fc1c,_0x54806a)[_0xbb43('0xd')](function(_0x117f4d){logger['info'](_0xbb43('0xe'),_0x4a070c,_0xbb43('0xf'));logger[_0xbb43('0x10')](_0xbb43('0x11'),_0x4a070c,'request\x20sent',JSON[_0xbb43('0x12')](_0x117f4d));if(_0x117f4d[_0xbb43('0x13')]){if(_0x117f4d['error']['code']===0x1f4){logger['error'](_0xbb43('0xe'),_0x4a070c,_0x117f4d['error'][_0xbb43('0x14')]);return _0x120d67(_0x117f4d['error'][_0xbb43('0x14')]);}logger[_0xbb43('0x13')](_0xbb43('0xe'),_0x4a070c,_0x117f4d[_0xbb43('0x13')][_0xbb43('0x14')]);return _0x33f9a8(_0x117f4d['error'][_0xbb43('0x14')]);}else{logger['info'](_0xbb43('0xe'),_0x4a070c,_0xbb43('0xf'));_0x33f9a8(_0x117f4d[_0xbb43('0x15')][_0xbb43('0x14')]);}})[_0xbb43('0x16')](function(_0x126f61){logger[_0xbb43('0x13')](_0xbb43('0xe'),_0x4a070c,_0x126f61);_0x120d67(_0x126f61);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 9e5ef73..360d57b 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 _0x600f=['Router','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','index','get','/:id','show','post','put','destroy','util','path','connect-timeout','express'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x600f,0xdc));var _0xf600=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x600f[_0x533110];return _0xc3c866;};'use strict';var multer=require('multer');var util=require(_0xf600('0x0'));var path=require(_0xf600('0x1'));var timeout=require(_0xf600('0x2'));var express=require(_0xf600('0x3'));var router=express[_0xf600('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf600('0x5'));var config=require(_0xf600('0x6'));var controller=require(_0xf600('0x7'));router['get']('/',auth[_0xf600('0x8')](),controller[_0xf600('0x9')]);router[_0xf600('0xa')](_0xf600('0xb'),auth[_0xf600('0x8')](),controller[_0xf600('0xc')]);router[_0xf600('0xd')]('/',auth[_0xf600('0x8')](),controller['create']);router[_0xf600('0xe')]('/:id',auth[_0xf600('0x8')](),controller['update']);router['delete'](_0xf600('0xb'),auth[_0xf600('0x8')](),controller[_0xf600('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe2d7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','util','path','connect-timeout','express','Router'];(function(_0x401f12,_0x407544){var _0x2ccc87=function(_0x15c2b3){while(--_0x15c2b3){_0x401f12['push'](_0x401f12['shift']());}};_0x2ccc87(++_0x407544);}(_0xe2d7,0xc1));var _0x7e2d=function(_0x1b879e,_0x39079d){_0x1b879e=_0x1b879e-0x0;var _0x168e00=_0xe2d7[_0x1b879e];return _0x168e00;};'use strict';var multer=require('multer');var util=require(_0x7e2d('0x0'));var path=require(_0x7e2d('0x1'));var timeout=require(_0x7e2d('0x2'));var express=require(_0x7e2d('0x3'));var router=express[_0x7e2d('0x4')]();var auth=require(_0x7e2d('0x5'));var interaction=require(_0x7e2d('0x6'));var config=require(_0x7e2d('0x7'));var controller=require(_0x7e2d('0x8'));router[_0x7e2d('0x9')]('/',auth[_0x7e2d('0xa')](),controller[_0x7e2d('0xb')]);router[_0x7e2d('0x9')](_0x7e2d('0xc'),auth[_0x7e2d('0xa')](),controller[_0x7e2d('0xd')]);router[_0x7e2d('0xe')]('/',auth[_0x7e2d('0xa')](),controller[_0x7e2d('0xf')]);router[_0x7e2d('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7e2d('0x11')](_0x7e2d('0xc'),auth[_0x7e2d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index a89bb04..bd358fb 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 _0x0683=['exports','name','STRING'];(function(_0x3e76aa,_0x3a00be){var _0x11afa5=function(_0x1ca9f8){while(--_0x1ca9f8){_0x3e76aa['push'](_0x3e76aa['shift']());}};_0x11afa5(++_0x3a00be);}(_0x0683,0xe1));var _0x3068=function(_0x347a87,_0x28ff05){_0x347a87=_0x347a87-0x0;var _0x425ad6=_0x0683[_0x347a87];return _0x425ad6;};'use strict';var Sequelize=require('sequelize');module[_0x3068('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3068('0x1')},'description':{'type':Sequelize[_0x3068('0x2')]}}; \ No newline at end of file +var _0xf23b=['exports','STRING','name','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf23b,0x133));var _0xbf23=function(_0x5e7703,_0x2085fa){_0x5e7703=_0x5e7703-0x0;var _0x8764cc=_0xf23b[_0x5e7703];return _0x8764cc;};'use strict';var Sequelize=require(_0xbf23('0x0'));module[_0xbf23('0x1')]={'name':{'type':Sequelize[_0xbf23('0x2')],'allowNull':![],'unique':_0xbf23('0x3')},'description':{'type':Sequelize[_0xbf23('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 56d4acd..8876ee3 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 _0xd616=['attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','end','status','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','error','name','send','map','Dashboard','rawAttributes','fieldName','type','key','model','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','omit','createdAt','updatedAt','update','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize'];(function(_0x4f7681,_0x4458ba){var _0x361b9a=function(_0x59c936){while(--_0x59c936){_0x4f7681['push'](_0x4f7681['shift']());}};_0x361b9a(++_0x4458ba);}(_0xd616,0x1f1));var _0x6d61=function(_0x21ae22,_0x54911f){_0x21ae22=_0x21ae22-0x0;var _0x1e610a=_0xd616[_0x21ae22];return _0x1e610a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6d61('0x0'));var rimraf=require(_0x6d61('0x1'));var zipdir=require(_0x6d61('0x2'));var jsonpatch=require(_0x6d61('0x3'));var rp=require(_0x6d61('0x4'));var moment=require(_0x6d61('0x5'));var BPromise=require(_0x6d61('0x6'));var Mustache=require(_0x6d61('0x7'));var util=require(_0x6d61('0x8'));var path=require('path');var sox=require(_0x6d61('0x9'));var csv=require(_0x6d61('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6d61('0xb'));var squel=require(_0x6d61('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d61('0xd'));var toCsv=require(_0x6d61('0xa'));var querystring=require(_0x6d61('0xe'));var Papa=require(_0x6d61('0xf'));var Redis=require(_0x6d61('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6d61('0x11'));var as=require(_0x6d61('0x12'));var hardwareService=require(_0x6d61('0x13'));var logger=require(_0x6d61('0x14'))(_0x6d61('0x15'));var utils=require('../../config/utils');var config=require(_0x6d61('0x16'));var licenseUtil=require(_0x6d61('0x17'));var db=require(_0x6d61('0x18'))['db'];config[_0x6d61('0x19')]=_[_0x6d61('0x1a')](config[_0x6d61('0x19')],{'host':_0x6d61('0x1b'),'port':0x18eb});var socket=require(_0x6d61('0x1c'))(new Redis(config[_0x6d61('0x19')]));require(_0x6d61('0x1d'))['register'](socket);function respondWithStatusCode(_0x2d5d2,_0x5dcdf3){_0x5dcdf3=_0x5dcdf3||0xcc;return function(_0x1627bd){if(_0x1627bd){return _0x2d5d2['sendStatus'](_0x5dcdf3);}return _0x2d5d2['status'](_0x5dcdf3)[_0x6d61('0x1e')]();};}function respondWithResult(_0x431b49,_0x20b655){_0x20b655=_0x20b655||0xc8;return function(_0x54e861){if(_0x54e861){return _0x431b49[_0x6d61('0x1f')](_0x20b655)['json'](_0x54e861);}};}function respondWithFilteredResult(_0x4e14be,_0x107ca5){return function(_0x3a5cd3){if(_0x3a5cd3){var _0x37d2b1=_0x3a5cd3[_0x6d61('0x20')],_0x471998=_0x107ca5[_0x6d61('0x21')],_0x7204b8=_0x107ca5[_0x6d61('0x21')]+_0x107ca5[_0x6d61('0x22')],_0x148df3;if(_0x7204b8>=_0x37d2b1){_0x7204b8=_0x37d2b1;_0x148df3=0xc8;}else{_0x148df3=0xce;}_0x4e14be[_0x6d61('0x1f')](_0x148df3);return _0x4e14be['set'](_0x6d61('0x23'),_0x471998+'-'+_0x7204b8+'/'+_0x37d2b1)['json'](_0x3a5cd3);}return null;};}function patchUpdates(_0x256c06){return function(_0x424231){try{jsonpatch[_0x6d61('0x24')](_0x424231,_0x256c06,!![]);}catch(_0x5e6d4c){return BPromise[_0x6d61('0x25')](_0x5e6d4c);}return _0x424231[_0x6d61('0x26')]();};}function saveUpdates(_0x438b66,_0x5d57da){return function(_0x58e3f0){if(_0x58e3f0){return _0x58e3f0['update'](_0x438b66)[_0x6d61('0x27')](function(_0x4e1a48){return _0x4e1a48;});}return null;};}function removeEntity(_0x42701d,_0x2513f4){return function(_0xd5bb74){if(_0xd5bb74){return _0xd5bb74[_0x6d61('0x28')]()[_0x6d61('0x27')](function(){var _0x3f39a9=_0xd5bb74[_0x6d61('0x29')]({'plain':!![]});var _0x3f21e6=_0x6d61('0x2a');return db[_0x6d61('0x2b')][_0x6d61('0x28')]({'where':{'type':_0x3f21e6,'resourceId':_0x3f39a9['id']}})[_0x6d61('0x27')](function(){return _0xd5bb74;});})[_0x6d61('0x27')](function(){_0x42701d[_0x6d61('0x1f')](0xcc)[_0x6d61('0x1e')]();});}};}function handleEntityNotFound(_0x32c5c6,_0x310d2e){return function(_0x1c89fc){if(!_0x1c89fc){_0x32c5c6[_0x6d61('0x2c')](0x194);}return _0x1c89fc;};}function handleError(_0x2ce360,_0x5972d4){_0x5972d4=_0x5972d4||0x1f4;return function(_0x219a9b){logger[_0x6d61('0x2d')](_0x219a9b['stack']);if(_0x219a9b[_0x6d61('0x2e')]){delete _0x219a9b[_0x6d61('0x2e')];}_0x2ce360[_0x6d61('0x1f')](_0x5972d4)[_0x6d61('0x2f')](_0x219a9b);};}exports['index']=function(_0x4af844,_0x5aa2f8){var _0x229442={},_0x35f977={},_0x4de3fa={'count':0x0,'rows':[]};var _0x318187=_[_0x6d61('0x30')](db[_0x6d61('0x31')][_0x6d61('0x32')],function(_0x4bb82b){return{'name':_0x4bb82b[_0x6d61('0x33')],'type':_0x4bb82b[_0x6d61('0x34')][_0x6d61('0x35')]};});_0x35f977[_0x6d61('0x36')]=_[_0x6d61('0x30')](_0x318187,_0x6d61('0x2e'));_0x35f977[_0x6d61('0x37')]=_['keys'](_0x4af844[_0x6d61('0x37')]);_0x35f977['filters']=_['intersection'](_0x35f977['model'],_0x35f977[_0x6d61('0x37')]);_0x229442['attributes']=_[_0x6d61('0x38')](_0x35f977[_0x6d61('0x36')],qs['fields'](_0x4af844[_0x6d61('0x37')][_0x6d61('0x39')]));_0x229442['attributes']=_0x229442['attributes'][_0x6d61('0x3a')]?_0x229442[_0x6d61('0x3b')]:_0x35f977[_0x6d61('0x36')];if(!_0x4af844[_0x6d61('0x37')][_0x6d61('0x3c')](_0x6d61('0x3d'))){_0x229442[_0x6d61('0x22')]=qs['limit'](_0x4af844['query'][_0x6d61('0x22')]);_0x229442[_0x6d61('0x21')]=qs[_0x6d61('0x21')](_0x4af844['query'][_0x6d61('0x21')]);}_0x229442[_0x6d61('0x3e')]=qs['sort'](_0x4af844[_0x6d61('0x37')]['sort']);_0x229442['where']=qs[_0x6d61('0x3f')](_[_0x6d61('0x40')](_0x4af844[_0x6d61('0x37')],_0x35f977[_0x6d61('0x3f')]),_0x318187);if(_0x4af844['query'][_0x6d61('0x41')]){_0x229442[_0x6d61('0x42')]=_[_0x6d61('0x43')](_0x229442[_0x6d61('0x42')],{'$or':_['map'](_0x318187,function(_0x5b910a){if(_0x5b910a['type']!==_0x6d61('0x44')){var _0x47531c={};_0x47531c[_0x5b910a[_0x6d61('0x2e')]]={'$like':'%'+_0x4af844['query']['filter']+'%'};return _0x47531c;}})});}_0x229442=_[_0x6d61('0x43')]({},_0x229442,_0x4af844[_0x6d61('0x45')]);var _0x310218={'where':_0x229442[_0x6d61('0x42')]};return db[_0x6d61('0x31')][_0x6d61('0x20')](_0x310218)[_0x6d61('0x27')](function(_0x13aa71){_0x4de3fa[_0x6d61('0x20')]=_0x13aa71;if(_0x4af844[_0x6d61('0x37')][_0x6d61('0x46')]){_0x229442[_0x6d61('0x47')]=[{'all':!![]}];}return db['Dashboard'][_0x6d61('0x48')](_0x229442);})[_0x6d61('0x27')](function(_0x2b23fc){_0x4de3fa[_0x6d61('0x49')]=_0x2b23fc;return _0x4de3fa;})[_0x6d61('0x27')](respondWithFilteredResult(_0x5aa2f8,_0x229442))['catch'](handleError(_0x5aa2f8,null));};exports[_0x6d61('0x4a')]=function(_0x17bd24,_0x58e4a5){var _0x44e35e={'raw':![],'where':{'id':_0x17bd24['params']['id']}},_0x24edce={};_0x24edce[_0x6d61('0x36')]=_['keys'](db[_0x6d61('0x31')]['rawAttributes']);_0x24edce[_0x6d61('0x37')]=_[_0x6d61('0x4b')](_0x17bd24['query']);_0x24edce[_0x6d61('0x3f')]=_[_0x6d61('0x38')](_0x24edce[_0x6d61('0x36')],_0x24edce['query']);_0x44e35e[_0x6d61('0x3b')]=_['intersection'](_0x24edce[_0x6d61('0x36')],qs[_0x6d61('0x39')](_0x17bd24[_0x6d61('0x37')]['fields']));_0x44e35e[_0x6d61('0x3b')]=_0x44e35e[_0x6d61('0x3b')]['length']?_0x44e35e[_0x6d61('0x3b')]:_0x24edce[_0x6d61('0x36')];if(_0x17bd24[_0x6d61('0x37')]['includeAll']){_0x44e35e[_0x6d61('0x47')]=[{'all':!![]}];}_0x44e35e=_[_0x6d61('0x43')]({},_0x44e35e,_0x17bd24['options']);return db[_0x6d61('0x31')][_0x6d61('0x4c')](_0x44e35e)[_0x6d61('0x27')](handleEntityNotFound(_0x58e4a5,null))['then'](respondWithResult(_0x58e4a5,null))['catch'](handleError(_0x58e4a5,null));};exports[_0x6d61('0x4d')]=function(_0x8c0753,_0x16912d){return db[_0x6d61('0x31')]['create'](_0x8c0753[_0x6d61('0x4e')],{})['then'](function(_0x29eec1){var _0x479fb7=_0x8c0753['user']['get']({'plain':!![]});if(!_0x479fb7)throw new Error(_0x6d61('0x4f'));if(_0x479fb7[_0x6d61('0x50')]===_0x6d61('0x51')){var _0x1ce36d=_0x29eec1['get']({'plain':!![]});var _0x9fca4f='CustomDashboards';return db[_0x6d61('0x52')][_0x6d61('0x4c')]({'where':{'name':_0x9fca4f,'userProfileId':_0x479fb7[_0x6d61('0x53')]},'raw':!![]})[_0x6d61('0x27')](function(_0x1f8db7){if(_0x1f8db7&&_0x1f8db7[_0x6d61('0x54')]===0x0){return db[_0x6d61('0x2b')][_0x6d61('0x4d')]({'name':_0x1ce36d['name'],'resourceId':_0x1ce36d['id'],'type':_0x1f8db7[_0x6d61('0x2e')],'sectionId':_0x1f8db7['id']},{})[_0x6d61('0x27')](function(){return _0x29eec1;});}else{return _0x29eec1;}})['catch'](function(_0x105649){logger[_0x6d61('0x2d')](_0x6d61('0x55'),_0x105649);throw _0x105649;});}return _0x29eec1;})[_0x6d61('0x27')](respondWithResult(_0x16912d,0xc9))[_0x6d61('0x56')](handleError(_0x16912d,null));};exports['clone']=function(_0x9cdef8,_0x12fd65){var _0x489e9e={'where':{'id':_0x9cdef8[_0x6d61('0x57')]['id']}},_0x284a9e={};_0x284a9e[_0x6d61('0x36')]=_[_0x6d61('0x4b')](db[_0x6d61('0x31')][_0x6d61('0x32')]);_0x489e9e['attributes']=_[_0x6d61('0x38')](_0x284a9e[_0x6d61('0x36')],qs[_0x6d61('0x39')](_0x9cdef8[_0x6d61('0x37')]['fields']));_0x489e9e[_0x6d61('0x3b')]=_0x489e9e[_0x6d61('0x3b')][_0x6d61('0x3a')]?_0x489e9e[_0x6d61('0x3b')]:_0x284a9e[_0x6d61('0x36')];if(_0x9cdef8[_0x6d61('0x37')][_0x6d61('0x46')]){_0x489e9e[_0x6d61('0x47')]=[{'all':!![]}];}_0x489e9e=_[_0x6d61('0x43')]({},_0x489e9e,_0x9cdef8[_0x6d61('0x45')]);return db['Dashboard'][_0x6d61('0x4c')](_0x489e9e)[_0x6d61('0x27')](handleEntityNotFound(_0x12fd65,null))['then'](function(_0x14f3c9){if(_0x14f3c9){var _0x1a1615=_0x14f3c9[_0x6d61('0x29')]({'plain':!![]});_0x1a1615=qs[_0x6d61('0x58')](_0x1a1615,['id',_0x6d61('0x59'),_0x6d61('0x5a')]);_0x9cdef8[_0x6d61('0x4e')]=_[_0x6d61('0x58')](_0x9cdef8['body'],['id',_0x6d61('0x59'),_0x6d61('0x5a')]);return db['Dashboard'][_0x6d61('0x4d')](_[_0x6d61('0x43')](_0x1a1615,_0x9cdef8[_0x6d61('0x4e')]),{'include':_0x9cdef8[_0x6d61('0x37')][_0x6d61('0x46')]?[{'all':!![]}]:undefined})[_0x6d61('0x27')](function(_0x3502ca){var _0x371475=_0x9cdef8[_0x6d61('0x51')]['get']({'plain':!![]});if(!_0x371475)throw new Error(_0x6d61('0x4f'));if(_0x371475[_0x6d61('0x50')]===_0x6d61('0x51')){var _0x2bd5ed=_0x3502ca[_0x6d61('0x29')]({'plain':!![]});var _0x495236=_0x6d61('0x2a');return db[_0x6d61('0x52')]['find']({'where':{'name':_0x495236,'userProfileId':_0x371475[_0x6d61('0x53')]},'raw':!![]})[_0x6d61('0x27')](function(_0x405dad){if(_0x405dad&&_0x405dad[_0x6d61('0x54')]===0x0){return db[_0x6d61('0x2b')][_0x6d61('0x4d')]({'name':_0x2bd5ed[_0x6d61('0x2e')],'resourceId':_0x2bd5ed['id'],'type':_0x405dad['name'],'sectionId':_0x405dad['id']},{})[_0x6d61('0x27')](function(){return _0x3502ca;});}else{return _0x3502ca;}})['catch'](function(_0x5a3148){logger['error'](_0x6d61('0x55'),_0x5a3148);throw _0x5a3148;});}return _0x3502ca;});}})['then'](respondWithResult(_0x12fd65,0xc9))[_0x6d61('0x56')](handleError(_0x12fd65,null));};exports[_0x6d61('0x5b')]=function(_0x582708,_0x5b7302){if(_0x582708[_0x6d61('0x4e')]['id']){delete _0x582708[_0x6d61('0x4e')]['id'];}return db['Dashboard'][_0x6d61('0x4c')]({'where':{'id':_0x582708['params']['id']}})[_0x6d61('0x27')](handleEntityNotFound(_0x5b7302,null))['then'](saveUpdates(_0x582708[_0x6d61('0x4e')],null))['then'](respondWithResult(_0x5b7302,null))[_0x6d61('0x56')](handleError(_0x5b7302,null));};exports[_0x6d61('0x28')]=function(_0x40df77,_0xa808a6){return db[_0x6d61('0x31')][_0x6d61('0x4c')]({'where':{'id':_0x40df77[_0x6d61('0x57')]['id']}})[_0x6d61('0x27')](handleEntityNotFound(_0xa808a6,null))[_0x6d61('0x27')](removeEntity(_0xa808a6,null))['catch'](handleError(_0xa808a6,null));};function widgetAttributes(_0x54f615){try{switch(_0x54f615['type']){case _0x6d61('0x5c'):return[{'name':_0x6d61('0x5d'),'value':_0x54f615[_0x6d61('0x5d')]||(_0x54f615[_0x6d61('0x5e')]&&_0x54f615[_0x6d61('0x5e')][0x0]?_0x54f615[_0x6d61('0x5e')][0x0][_0x6d61('0x5f')]:undefined)||'https://'}];case _0x6d61('0x60'):return[{'name':_0x6d61('0x61'),'value':_0x54f615[_0x6d61('0x61')]||(_0x54f615['attrs']&&_0x54f615[_0x6d61('0x5e')][0x0]?_0x54f615[_0x6d61('0x5e')][0x0][_0x6d61('0x5f')]:undefined)||''}];case _0x6d61('0x62'):return[{'name':_0x6d61('0x63'),'value':_0x54f615[_0x6d61('0x63')]||(_0x54f615[_0x6d61('0x5e')]&&_0x54f615[_0x6d61('0x5e')][0x0]?_0x54f615['attrs'][0x0][_0x6d61('0x5f')]:undefined)||_0x6d61('0x64')},{'name':'attrTimezone','value':_0x54f615[_0x6d61('0x65')]||(_0x54f615[_0x6d61('0x5e')]&&_0x54f615['attrs'][0x1]?_0x54f615[_0x6d61('0x5e')][0x1]['value']:undefined)||'0.00'},{'name':_0x6d61('0x66'),'value':_0x54f615[_0x6d61('0x66')]||(_0x54f615['attrs']&&_0x54f615[_0x6d61('0x5e')][0x2]?_0x54f615[_0x6d61('0x5e')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x6d61('0x67'),'value':_0x54f615[_0x6d61('0x67')]||(_0x54f615['attrs']&&_0x54f615['attrs'][0x0]?_0x54f615[_0x6d61('0x5e')][0x0][_0x6d61('0x5f')]:undefined)||_0x6d61('0x68')},{'name':_0x6d61('0x69'),'value':_0x54f615[_0x6d61('0x69')]||(_0x54f615[_0x6d61('0x5e')]&&_0x54f615['attrs'][0x1]?_0x54f615[_0x6d61('0x5e')][0x1][_0x6d61('0x5f')]:undefined)||[]},{'name':_0x6d61('0x66'),'value':_0x54f615['attrFontSize']||(_0x54f615[_0x6d61('0x5e')]&&_0x54f615[_0x6d61('0x5e')][0x2]?_0x54f615[_0x6d61('0x5e')][0x2][_0x6d61('0x5f')]:undefined)||0x14}];case _0x6d61('0x6a'):case'pie-chart':return[{'name':'attrSerie1','value':_0x54f615['attrSerie1']||(_0x54f615[_0x6d61('0x5e')]&&_0x54f615[_0x6d61('0x5e')][0x0]?_0x54f615['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x6d61('0x6b'),'value':_0x54f615['attrSerie2']||(_0x54f615[_0x6d61('0x5e')]&&_0x54f615['attrs'][0x1]?_0x54f615['attrs'][0x1][_0x6d61('0x5f')]:undefined)||null},{'name':_0x6d61('0x6c'),'value':_0x54f615['attrSerie3']||(_0x54f615['attrs']&&_0x54f615[_0x6d61('0x5e')][0x2]?_0x54f615[_0x6d61('0x5e')][0x2]['value']:undefined)||null},{'name':_0x6d61('0x69'),'value':_0x54f615[_0x6d61('0x69')]||(_0x54f615[_0x6d61('0x5e')]&&_0x54f615[_0x6d61('0x5e')][0x3]?_0x54f615[_0x6d61('0x5e')][0x3][_0x6d61('0x5f')]:undefined)||[]}];case _0x6d61('0x6d'):return[{'name':_0x6d61('0x6e'),'type':_0x54f615[_0x6d61('0x6f')]||(_0x54f615[_0x6d61('0x5e')]&&_0x54f615['attrs'][0x0]?_0x54f615[_0x6d61('0x5e')][0x0][_0x6d61('0x34')]:undefined)||null,'value':_0x54f615[_0x6d61('0x6e')]||(_0x54f615[_0x6d61('0x5e')]&&_0x54f615[_0x6d61('0x5e')][0x0]?_0x54f615['attrs'][0x0]['value']:undefined)||null},{'name':_0x6d61('0x70'),'value':_0x54f615['attrRefresh']||(_0x54f615['attrs']&&_0x54f615[_0x6d61('0x5e')][0x1]?_0x54f615[_0x6d61('0x5e')][0x1][_0x6d61('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x5f5028){logger[_0x6d61('0x2d')](_0x6d61('0x71'),JSON['stringify'](_0x5f5028));return[];}}exports[_0x6d61('0x72')]=function(_0xcc3450,_0x31cd7e,_0x194c18){if(_0xcc3450[_0x6d61('0x4e')]['id']){delete _0xcc3450['body']['id'];}return db['Dashboard'][_0x6d61('0x4c')]({'where':{'id':_0xcc3450[_0x6d61('0x57')]['id']}})[_0x6d61('0x27')](handleEntityNotFound(_0x31cd7e,null))['then'](function(_0x25792){if(_0x25792){_0xcc3450[_0x6d61('0x4e')][_0x6d61('0x73')]=_0x25792['id'];_0xcc3450['body'][_0x6d61('0x5e')]=widgetAttributes(_0xcc3450['body']);return db[_0x6d61('0x74')][_0x6d61('0x4d')](_0xcc3450[_0x6d61('0x4e')]);}})[_0x6d61('0x27')](respondWithResult(_0x31cd7e,null))[_0x6d61('0x56')](handleError(_0x31cd7e,null));};exports[_0x6d61('0x75')]=function(_0x336348,_0x317a18,_0x428ede){var _0x205b13={};var _0x49cc3d={};var _0x910fd2;var _0x3d9984;return db[_0x6d61('0x31')][_0x6d61('0x76')]({'where':{'id':_0x336348['params']['id']}})[_0x6d61('0x27')](handleEntityNotFound(_0x317a18,null))[_0x6d61('0x27')](function(_0x18fdd5){if(_0x18fdd5){_0x910fd2=_0x18fdd5;_0x49cc3d[_0x6d61('0x36')]=_['keys'](db[_0x6d61('0x74')][_0x6d61('0x32')]);_0x49cc3d[_0x6d61('0x37')]=_[_0x6d61('0x4b')](_0x336348[_0x6d61('0x37')]);_0x49cc3d[_0x6d61('0x3f')]=_[_0x6d61('0x38')](_0x49cc3d[_0x6d61('0x36')],_0x49cc3d[_0x6d61('0x37')]);_0x205b13[_0x6d61('0x3b')]=_['intersection'](_0x49cc3d[_0x6d61('0x36')],qs[_0x6d61('0x39')](_0x336348[_0x6d61('0x37')]['fields']));_0x205b13[_0x6d61('0x3b')]=_0x205b13['attributes']['length']?_0x205b13[_0x6d61('0x3b')]:_0x49cc3d[_0x6d61('0x36')];_0x205b13[_0x6d61('0x3e')]=qs[_0x6d61('0x77')](_0x336348[_0x6d61('0x37')][_0x6d61('0x77')]);_0x205b13[_0x6d61('0x42')]=qs['filters'](_[_0x6d61('0x40')](_0x336348['query'],_0x49cc3d['filters']));if(_0x336348['query'][_0x6d61('0x41')]){_0x205b13[_0x6d61('0x42')]=_[_0x6d61('0x43')](_0x205b13[_0x6d61('0x42')],{'$or':_['map'](_0x205b13[_0x6d61('0x3b')],function(_0x2cc0c7){var _0x39db4d={};_0x39db4d[_0x2cc0c7]={'$like':'%'+_0x336348[_0x6d61('0x37')][_0x6d61('0x41')]+'%'};return _0x39db4d;})});}_0x205b13=_[_0x6d61('0x43')]({},_0x205b13,_0x336348[_0x6d61('0x45')]);return _0x910fd2[_0x6d61('0x75')](_0x205b13);}})[_0x6d61('0x27')](function(_0x4e54d0){if(_0x4e54d0){_0x3d9984=_0x4e54d0['length'];if(!_0x336348['query'][_0x6d61('0x3c')](_0x6d61('0x3d'))){_0x205b13[_0x6d61('0x22')]=qs[_0x6d61('0x22')](_0x336348[_0x6d61('0x37')][_0x6d61('0x22')]);_0x205b13[_0x6d61('0x21')]=qs[_0x6d61('0x21')](_0x336348['query'][_0x6d61('0x21')]);}return _0x910fd2['getItems'](_0x205b13);}})['then'](function(_0x4a892e){if(_0x4a892e){return _0x4a892e?{'count':_0x3d9984,'rows':_0x4a892e}:null;}})[_0x6d61('0x27')](respondWithResult(_0x317a18,null))[_0x6d61('0x56')](handleError(_0x317a18,null));}; \ No newline at end of file +var _0x8205=['then','destroy','UserProfileResource','error','stack','name','map','Dashboard','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','CustomDashboards','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','user','role','autoAssociation','update','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie3','web-report','reportType','attrReport','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','html-pdf','eml-format','fast-json-patch','request-promise','util','path','sox','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x25df15,_0x20a44c){var _0x22ea4b=function(_0x121f14){while(--_0x121f14){_0x25df15['push'](_0x25df15['shift']());}};_0x22ea4b(++_0x20a44c);}(_0x8205,0xc4));var _0x5820=function(_0x4e03f8,_0x336d12){_0x4e03f8=_0x4e03f8-0x0;var _0x1ea68c=_0x8205[_0x4e03f8];return _0x1ea68c;};'use strict';var pdf=require(_0x5820('0x0'));var emlformat=require(_0x5820('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5820('0x2'));var rp=require(_0x5820('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5820('0x4'));var path=require(_0x5820('0x5'));var sox=require(_0x5820('0x6'));var csv=require(_0x5820('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5820('0x7'));var querystring=require(_0x5820('0x8'));var Papa=require(_0x5820('0x9'));var Redis=require(_0x5820('0xa'));var authService=require(_0x5820('0xb'));var qs=require(_0x5820('0xc'));var as=require(_0x5820('0xd'));var hardwareService=require(_0x5820('0xe'));var logger=require(_0x5820('0xf'))(_0x5820('0x10'));var utils=require(_0x5820('0x11'));var config=require(_0x5820('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x5820('0x13')](config[_0x5820('0x14')],{'host':_0x5820('0x15'),'port':0x18eb});var socket=require(_0x5820('0x16'))(new Redis(config[_0x5820('0x14')]));require(_0x5820('0x17'))[_0x5820('0x18')](socket);function respondWithStatusCode(_0x8cf14d,_0x226ef4){_0x226ef4=_0x226ef4||0xcc;return function(_0x209b26){if(_0x209b26){return _0x8cf14d[_0x5820('0x19')](_0x226ef4);}return _0x8cf14d['status'](_0x226ef4)[_0x5820('0x1a')]();};}function respondWithResult(_0x25193e,_0x569572){_0x569572=_0x569572||0xc8;return function(_0x110869){if(_0x110869){return _0x25193e[_0x5820('0x1b')](_0x569572)[_0x5820('0x1c')](_0x110869);}};}function respondWithFilteredResult(_0x2db01a,_0x444fa4){return function(_0x247f23){if(_0x247f23){var _0x51e027=_0x247f23[_0x5820('0x1d')],_0x2aa884=_0x444fa4[_0x5820('0x1e')],_0x387833=_0x444fa4['offset']+_0x444fa4[_0x5820('0x1f')],_0x3dc4f5;if(_0x387833>=_0x51e027){_0x387833=_0x51e027;_0x3dc4f5=0xc8;}else{_0x3dc4f5=0xce;}_0x2db01a['status'](_0x3dc4f5);return _0x2db01a['set'](_0x5820('0x20'),_0x2aa884+'-'+_0x387833+'/'+_0x51e027)[_0x5820('0x1c')](_0x247f23);}return null;};}function patchUpdates(_0x45207a){return function(_0x3fa082){try{jsonpatch[_0x5820('0x21')](_0x3fa082,_0x45207a,!![]);}catch(_0x464a02){return BPromise[_0x5820('0x22')](_0x464a02);}return _0x3fa082[_0x5820('0x23')]();};}function saveUpdates(_0x45fed6,_0xdb4e3a){return function(_0x78f2df){if(_0x78f2df){return _0x78f2df['update'](_0x45fed6)[_0x5820('0x24')](function(_0x37f18c){return _0x37f18c;});}return null;};}function removeEntity(_0x53d87e,_0xcfc213){return function(_0x4d7d20){if(_0x4d7d20){return _0x4d7d20[_0x5820('0x25')]()['then'](function(){var _0x39a0e0=_0x4d7d20['get']({'plain':!![]});var _0x5650e4='CustomDashboards';return db[_0x5820('0x26')][_0x5820('0x25')]({'where':{'type':_0x5650e4,'resourceId':_0x39a0e0['id']}})['then'](function(){return _0x4d7d20;});})[_0x5820('0x24')](function(){_0x53d87e[_0x5820('0x1b')](0xcc)[_0x5820('0x1a')]();});}};}function handleEntityNotFound(_0x11f343,_0xfd2408){return function(_0x33a992){if(!_0x33a992){_0x11f343[_0x5820('0x19')](0x194);}return _0x33a992;};}function handleError(_0x69f62f,_0x2338dd){_0x2338dd=_0x2338dd||0x1f4;return function(_0x5ab03c){logger[_0x5820('0x27')](_0x5ab03c[_0x5820('0x28')]);if(_0x5ab03c[_0x5820('0x29')]){delete _0x5ab03c[_0x5820('0x29')];}_0x69f62f['status'](_0x2338dd)['send'](_0x5ab03c);};}exports['index']=function(_0x330b25,_0x506514){var _0x427afe={},_0x2dc462={},_0x393d23={'count':0x0,'rows':[]};var _0x23a466=_[_0x5820('0x2a')](db[_0x5820('0x2b')][_0x5820('0x2c')],function(_0x274d31){return{'name':_0x274d31[_0x5820('0x2d')],'type':_0x274d31[_0x5820('0x2e')]['key']};});_0x2dc462[_0x5820('0x2f')]=_[_0x5820('0x2a')](_0x23a466,_0x5820('0x29'));_0x2dc462[_0x5820('0x30')]=_[_0x5820('0x31')](_0x330b25['query']);_0x2dc462[_0x5820('0x32')]=_[_0x5820('0x33')](_0x2dc462['model'],_0x2dc462[_0x5820('0x30')]);_0x427afe[_0x5820('0x34')]=_[_0x5820('0x33')](_0x2dc462[_0x5820('0x2f')],qs[_0x5820('0x35')](_0x330b25[_0x5820('0x30')][_0x5820('0x35')]));_0x427afe['attributes']=_0x427afe[_0x5820('0x34')][_0x5820('0x36')]?_0x427afe[_0x5820('0x34')]:_0x2dc462['model'];if(!_0x330b25['query'][_0x5820('0x37')](_0x5820('0x38'))){_0x427afe[_0x5820('0x1f')]=qs[_0x5820('0x1f')](_0x330b25[_0x5820('0x30')][_0x5820('0x1f')]);_0x427afe[_0x5820('0x1e')]=qs[_0x5820('0x1e')](_0x330b25[_0x5820('0x30')]['offset']);}_0x427afe[_0x5820('0x39')]=qs[_0x5820('0x3a')](_0x330b25[_0x5820('0x30')][_0x5820('0x3a')]);_0x427afe[_0x5820('0x3b')]=qs[_0x5820('0x32')](_[_0x5820('0x3c')](_0x330b25[_0x5820('0x30')],_0x2dc462['filters']),_0x23a466);if(_0x330b25[_0x5820('0x30')][_0x5820('0x3d')]){_0x427afe[_0x5820('0x3b')]=_[_0x5820('0x3e')](_0x427afe[_0x5820('0x3b')],{'$or':_[_0x5820('0x2a')](_0x23a466,function(_0x109095){if(_0x109095[_0x5820('0x2e')]!==_0x5820('0x3f')){var _0xbb473e={};_0xbb473e[_0x109095[_0x5820('0x29')]]={'$like':'%'+_0x330b25[_0x5820('0x30')]['filter']+'%'};return _0xbb473e;}})});}_0x427afe=_[_0x5820('0x3e')]({},_0x427afe,_0x330b25[_0x5820('0x40')]);var _0x2d5910={'where':_0x427afe[_0x5820('0x3b')]};return db[_0x5820('0x2b')][_0x5820('0x1d')](_0x2d5910)[_0x5820('0x24')](function(_0xc893f9){_0x393d23[_0x5820('0x1d')]=_0xc893f9;if(_0x330b25['query']['includeAll']){_0x427afe[_0x5820('0x41')]=[{'all':!![]}];}return db[_0x5820('0x2b')][_0x5820('0x42')](_0x427afe);})[_0x5820('0x24')](function(_0x17ac2c){_0x393d23[_0x5820('0x43')]=_0x17ac2c;return _0x393d23;})[_0x5820('0x24')](respondWithFilteredResult(_0x506514,_0x427afe))[_0x5820('0x44')](handleError(_0x506514,null));};exports[_0x5820('0x45')]=function(_0x2eeb9f,_0x7387da){var _0x15da82={'raw':![],'where':{'id':_0x2eeb9f[_0x5820('0x46')]['id']}},_0x5573a8={};_0x5573a8['model']=_[_0x5820('0x31')](db['Dashboard'][_0x5820('0x2c')]);_0x5573a8[_0x5820('0x30')]=_[_0x5820('0x31')](_0x2eeb9f[_0x5820('0x30')]);_0x5573a8[_0x5820('0x32')]=_['intersection'](_0x5573a8[_0x5820('0x2f')],_0x5573a8['query']);_0x15da82[_0x5820('0x34')]=_[_0x5820('0x33')](_0x5573a8[_0x5820('0x2f')],qs[_0x5820('0x35')](_0x2eeb9f[_0x5820('0x30')][_0x5820('0x35')]));_0x15da82[_0x5820('0x34')]=_0x15da82[_0x5820('0x34')][_0x5820('0x36')]?_0x15da82[_0x5820('0x34')]:_0x5573a8[_0x5820('0x2f')];if(_0x2eeb9f[_0x5820('0x30')][_0x5820('0x47')]){_0x15da82[_0x5820('0x41')]=[{'all':!![]}];}_0x15da82=_[_0x5820('0x3e')]({},_0x15da82,_0x2eeb9f[_0x5820('0x40')]);return db[_0x5820('0x2b')][_0x5820('0x48')](_0x15da82)['then'](handleEntityNotFound(_0x7387da,null))[_0x5820('0x24')](respondWithResult(_0x7387da,null))[_0x5820('0x44')](handleError(_0x7387da,null));};exports['create']=function(_0xefbcce,_0x9163e7){return db[_0x5820('0x2b')][_0x5820('0x49')](_0xefbcce[_0x5820('0x4a')],{})[_0x5820('0x24')](function(_0x238d41){var _0xdb8835=_0xefbcce['user']['get']({'plain':!![]});if(!_0xdb8835)throw new Error(_0x5820('0x4b'));if(_0xdb8835['role']==='user'){var _0x4923c2=_0x238d41[_0x5820('0x4c')]({'plain':!![]});var _0xfa3717=_0x5820('0x4d');return db[_0x5820('0x4e')]['find']({'where':{'name':_0xfa3717,'userProfileId':_0xdb8835[_0x5820('0x4f')]},'raw':!![]})['then'](function(_0x624b55){if(_0x624b55&&_0x624b55['autoAssociation']===0x0){return db[_0x5820('0x26')][_0x5820('0x49')]({'name':_0x4923c2[_0x5820('0x29')],'resourceId':_0x4923c2['id'],'type':_0x624b55[_0x5820('0x29')],'sectionId':_0x624b55['id']},{})[_0x5820('0x24')](function(){return _0x238d41;});}else{return _0x238d41;}})[_0x5820('0x44')](function(_0x247fc5){logger[_0x5820('0x27')](_0x5820('0x50'),_0x247fc5);throw _0x247fc5;});}return _0x238d41;})[_0x5820('0x24')](respondWithResult(_0x9163e7,0xc9))[_0x5820('0x44')](handleError(_0x9163e7,null));};exports[_0x5820('0x51')]=function(_0x69a2c6,_0x8b03fd){var _0x333db5={'where':{'id':_0x69a2c6['params']['id']}},_0x3b6268={};_0x3b6268['model']=_['keys'](db[_0x5820('0x2b')][_0x5820('0x2c')]);_0x333db5[_0x5820('0x34')]=_['intersection'](_0x3b6268[_0x5820('0x2f')],qs['fields'](_0x69a2c6[_0x5820('0x30')]['fields']));_0x333db5[_0x5820('0x34')]=_0x333db5[_0x5820('0x34')][_0x5820('0x36')]?_0x333db5['attributes']:_0x3b6268['model'];if(_0x69a2c6[_0x5820('0x30')][_0x5820('0x47')]){_0x333db5[_0x5820('0x41')]=[{'all':!![]}];}_0x333db5=_[_0x5820('0x3e')]({},_0x333db5,_0x69a2c6[_0x5820('0x40')]);return db[_0x5820('0x2b')]['find'](_0x333db5)[_0x5820('0x24')](handleEntityNotFound(_0x8b03fd,null))[_0x5820('0x24')](function(_0x18d9db){if(_0x18d9db){var _0xbf2124=_0x18d9db[_0x5820('0x4c')]({'plain':!![]});_0xbf2124=qs['omit'](_0xbf2124,['id',_0x5820('0x52'),_0x5820('0x53')]);_0x69a2c6[_0x5820('0x4a')]=_[_0x5820('0x54')](_0x69a2c6[_0x5820('0x4a')],['id',_0x5820('0x52'),_0x5820('0x53')]);return db['Dashboard'][_0x5820('0x49')](_['merge'](_0xbf2124,_0x69a2c6[_0x5820('0x4a')]),{'include':_0x69a2c6['query'][_0x5820('0x47')]?[{'all':!![]}]:undefined})[_0x5820('0x24')](function(_0x1e235e){var _0x3a5c1c=_0x69a2c6[_0x5820('0x55')][_0x5820('0x4c')]({'plain':!![]});if(!_0x3a5c1c)throw new Error(_0x5820('0x4b'));if(_0x3a5c1c[_0x5820('0x56')]===_0x5820('0x55')){var _0x3a11f7=_0x1e235e[_0x5820('0x4c')]({'plain':!![]});var _0x78b5a1='CustomDashboards';return db[_0x5820('0x4e')][_0x5820('0x48')]({'where':{'name':_0x78b5a1,'userProfileId':_0x3a5c1c['userProfileId']},'raw':!![]})[_0x5820('0x24')](function(_0x276a4f){if(_0x276a4f&&_0x276a4f[_0x5820('0x57')]===0x0){return db[_0x5820('0x26')][_0x5820('0x49')]({'name':_0x3a11f7['name'],'resourceId':_0x3a11f7['id'],'type':_0x276a4f['name'],'sectionId':_0x276a4f['id']},{})[_0x5820('0x24')](function(){return _0x1e235e;});}else{return _0x1e235e;}})[_0x5820('0x44')](function(_0x10d544){logger[_0x5820('0x27')](_0x5820('0x50'),_0x10d544);throw _0x10d544;});}return _0x1e235e;});}})[_0x5820('0x24')](respondWithResult(_0x8b03fd,0xc9))[_0x5820('0x44')](handleError(_0x8b03fd,null));};exports[_0x5820('0x58')]=function(_0x57e5bf,_0xa65332){if(_0x57e5bf[_0x5820('0x4a')]['id']){delete _0x57e5bf['body']['id'];}return db[_0x5820('0x2b')][_0x5820('0x48')]({'where':{'id':_0x57e5bf['params']['id']}})['then'](handleEntityNotFound(_0xa65332,null))[_0x5820('0x24')](saveUpdates(_0x57e5bf[_0x5820('0x4a')],null))[_0x5820('0x24')](respondWithResult(_0xa65332,null))['catch'](handleError(_0xa65332,null));};exports[_0x5820('0x25')]=function(_0x34983d,_0x25709e){return db[_0x5820('0x2b')][_0x5820('0x48')]({'where':{'id':_0x34983d[_0x5820('0x46')]['id']}})[_0x5820('0x24')](handleEntityNotFound(_0x25709e,null))[_0x5820('0x24')](removeEntity(_0x25709e,null))[_0x5820('0x44')](handleError(_0x25709e,null));};function widgetAttributes(_0x41b5d1){try{switch(_0x41b5d1[_0x5820('0x2e')]){case'iframe':return[{'name':_0x5820('0x59'),'value':_0x41b5d1[_0x5820('0x59')]||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1[_0x5820('0x5a')][0x0]?_0x41b5d1[_0x5820('0x5a')][0x0][_0x5820('0x5b')]:undefined)||_0x5820('0x5c')}];case'custom':return[{'name':'attrPath','value':_0x41b5d1[_0x5820('0x5d')]||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1[_0x5820('0x5a')][0x0]?_0x41b5d1[_0x5820('0x5a')][0x0]['value']:undefined)||''}];case _0x5820('0x5e'):return[{'name':_0x5820('0x5f'),'value':_0x41b5d1[_0x5820('0x5f')]||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1[_0x5820('0x5a')][0x0]?_0x41b5d1['attrs'][0x0]['value']:undefined)||_0x5820('0x60')},{'name':_0x5820('0x61'),'value':_0x41b5d1['attrTimezone']||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1[_0x5820('0x5a')][0x1]?_0x41b5d1[_0x5820('0x5a')][0x1][_0x5820('0x5b')]:undefined)||_0x5820('0x62')},{'name':'attrFontSize','value':_0x41b5d1[_0x5820('0x63')]||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1[_0x5820('0x5a')][0x2]?_0x41b5d1['attrs'][0x2]['value']:undefined)||0xc}];case _0x5820('0x64'):return[{'name':_0x5820('0x65'),'value':_0x41b5d1['attrMetric']||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1['attrs'][0x0]?_0x41b5d1[_0x5820('0x5a')][0x0][_0x5820('0x5b')]:undefined)||_0x5820('0x66')},{'name':_0x5820('0x67'),'value':_0x41b5d1[_0x5820('0x67')]||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1['attrs'][0x1]?_0x41b5d1[_0x5820('0x5a')][0x1][_0x5820('0x5b')]:undefined)||[]},{'name':_0x5820('0x63'),'value':_0x41b5d1[_0x5820('0x63')]||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1[_0x5820('0x5a')][0x2]?_0x41b5d1[_0x5820('0x5a')][0x2][_0x5820('0x5b')]:undefined)||0x14}];case'multibar-chart':case _0x5820('0x68'):return[{'name':_0x5820('0x69'),'value':_0x41b5d1[_0x5820('0x69')]||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1['attrs'][0x0]?_0x41b5d1['attrs'][0x0][_0x5820('0x5b')]:undefined)||'total'},{'name':'attrSerie2','value':_0x41b5d1['attrSerie2']||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1[_0x5820('0x5a')][0x1]?_0x41b5d1[_0x5820('0x5a')][0x1][_0x5820('0x5b')]:undefined)||null},{'name':_0x5820('0x6a'),'value':_0x41b5d1[_0x5820('0x6a')]||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1['attrs'][0x2]?_0x41b5d1[_0x5820('0x5a')][0x2]['value']:undefined)||null},{'name':_0x5820('0x67'),'value':_0x41b5d1[_0x5820('0x67')]||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1['attrs'][0x3]?_0x41b5d1[_0x5820('0x5a')][0x3][_0x5820('0x5b')]:undefined)||[]}];case _0x5820('0x6b'):return[{'name':'attrReport','type':_0x41b5d1[_0x5820('0x6c')]||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1['attrs'][0x0]?_0x41b5d1[_0x5820('0x5a')][0x0][_0x5820('0x2e')]:undefined)||null,'value':_0x41b5d1[_0x5820('0x6d')]||(_0x41b5d1[_0x5820('0x5a')]&&_0x41b5d1['attrs'][0x0]?_0x41b5d1['attrs'][0x0][_0x5820('0x5b')]:undefined)||null},{'name':'attrRefresh','value':_0x41b5d1['attrRefresh']||(_0x41b5d1['attrs']&&_0x41b5d1[_0x5820('0x5a')][0x1]?_0x41b5d1[_0x5820('0x5a')][0x1][_0x5820('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0xae2982){logger[_0x5820('0x27')](_0x5820('0x6e'),JSON[_0x5820('0x6f')](_0xae2982));return[];}}exports[_0x5820('0x70')]=function(_0x53d66e,_0x44d36e,_0x24963c){if(_0x53d66e[_0x5820('0x4a')]['id']){delete _0x53d66e[_0x5820('0x4a')]['id'];}return db['Dashboard'][_0x5820('0x48')]({'where':{'id':_0x53d66e[_0x5820('0x46')]['id']}})['then'](handleEntityNotFound(_0x44d36e,null))[_0x5820('0x24')](function(_0x489d64){if(_0x489d64){_0x53d66e['body'][_0x5820('0x71')]=_0x489d64['id'];_0x53d66e[_0x5820('0x4a')][_0x5820('0x5a')]=widgetAttributes(_0x53d66e[_0x5820('0x4a')]);return db['DashboardItem']['create'](_0x53d66e[_0x5820('0x4a')]);}})['then'](respondWithResult(_0x44d36e,null))[_0x5820('0x44')](handleError(_0x44d36e,null));};exports[_0x5820('0x72')]=function(_0x5bdb28,_0x41ce49,_0x496612){var _0x129a7f={};var _0x2f060f={};var _0x2c580b;var _0xe318c;return db[_0x5820('0x2b')][_0x5820('0x73')]({'where':{'id':_0x5bdb28['params']['id']}})[_0x5820('0x24')](handleEntityNotFound(_0x41ce49,null))['then'](function(_0x371b67){if(_0x371b67){_0x2c580b=_0x371b67;_0x2f060f['model']=_[_0x5820('0x31')](db['DashboardItem'][_0x5820('0x2c')]);_0x2f060f['query']=_[_0x5820('0x31')](_0x5bdb28[_0x5820('0x30')]);_0x2f060f[_0x5820('0x32')]=_[_0x5820('0x33')](_0x2f060f['model'],_0x2f060f[_0x5820('0x30')]);_0x129a7f['attributes']=_['intersection'](_0x2f060f[_0x5820('0x2f')],qs[_0x5820('0x35')](_0x5bdb28[_0x5820('0x30')][_0x5820('0x35')]));_0x129a7f[_0x5820('0x34')]=_0x129a7f[_0x5820('0x34')]['length']?_0x129a7f[_0x5820('0x34')]:_0x2f060f['model'];_0x129a7f[_0x5820('0x39')]=qs[_0x5820('0x3a')](_0x5bdb28['query']['sort']);_0x129a7f[_0x5820('0x3b')]=qs[_0x5820('0x32')](_[_0x5820('0x3c')](_0x5bdb28[_0x5820('0x30')],_0x2f060f['filters']));if(_0x5bdb28[_0x5820('0x30')][_0x5820('0x3d')]){_0x129a7f['where']=_[_0x5820('0x3e')](_0x129a7f[_0x5820('0x3b')],{'$or':_[_0x5820('0x2a')](_0x129a7f[_0x5820('0x34')],function(_0xa13cf){var _0x1636aa={};_0x1636aa[_0xa13cf]={'$like':'%'+_0x5bdb28[_0x5820('0x30')]['filter']+'%'};return _0x1636aa;})});}_0x129a7f=_[_0x5820('0x3e')]({},_0x129a7f,_0x5bdb28[_0x5820('0x40')]);return _0x2c580b[_0x5820('0x72')](_0x129a7f);}})[_0x5820('0x24')](function(_0x5a2041){if(_0x5a2041){_0xe318c=_0x5a2041[_0x5820('0x36')];if(!_0x5bdb28[_0x5820('0x30')][_0x5820('0x37')](_0x5820('0x38'))){_0x129a7f[_0x5820('0x1f')]=qs[_0x5820('0x1f')](_0x5bdb28['query'][_0x5820('0x1f')]);_0x129a7f[_0x5820('0x1e')]=qs['offset'](_0x5bdb28['query']['offset']);}return _0x2c580b[_0x5820('0x72')](_0x129a7f);}})[_0x5820('0x24')](function(_0x2055fd){if(_0x2055fd){return _0x2055fd?{'count':_0xe318c,'rows':_0x2055fd}:null;}})['then'](respondWithResult(_0x41ce49,null))[_0x5820('0x44')](handleError(_0x41ce49,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index fe22522..d70920e 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 _0x98ff=['Dashboard','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x16b3d7,_0x5d77f9){var _0x1abeaa=function(_0x10b18e){while(--_0x10b18e){_0x16b3d7['push'](_0x16b3d7['shift']());}};_0x1abeaa(++_0x5d77f9);}(_0x98ff,0x1b6));var _0xf98f=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x98ff[_0x311c35];return _0x5cc50c;};'use strict';var EventEmitter=require(_0xf98f('0x0'));var Dashboard=require(_0xf98f('0x1'))['db'][_0xf98f('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf98f('0x3')](0x0);var events={'afterCreate':_0xf98f('0x4'),'afterUpdate':_0xf98f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3227e4){return function(_0x4f1747,_0x4973fb,_0x5db134){DashboardEvents[_0xf98f('0x6')](_0x3227e4+':'+_0x4f1747['id'],_0x4f1747);DashboardEvents[_0xf98f('0x6')](_0x3227e4,_0x4f1747);_0x5db134(null);};}for(var e in events){if(events[_0xf98f('0x7')](e)){var event=events[e];Dashboard[_0xf98f('0x8')](e,emitEvent(event));}}module[_0xf98f('0x9')]=DashboardEvents; \ No newline at end of file +var _0x4d50=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x20a49e,_0x3de9bf){var _0x319d53=function(_0x336deb){while(--_0x336deb){_0x20a49e['push'](_0x20a49e['shift']());}};_0x319d53(++_0x3de9bf);}(_0x4d50,0x82));var _0x04d5=function(_0x1f2e2f,_0x4ffa9e){_0x1f2e2f=_0x1f2e2f-0x0;var _0x48fe03=_0x4d50[_0x1f2e2f];return _0x48fe03;};'use strict';var EventEmitter=require(_0x04d5('0x0'));var Dashboard=require(_0x04d5('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x04d5('0x2')](0x0);var events={'afterCreate':_0x04d5('0x3'),'afterUpdate':_0x04d5('0x4'),'afterDestroy':_0x04d5('0x5')};function emitEvent(_0x1bbe88){return function(_0x15596d,_0x5a9d1d,_0x1cbbbe){DashboardEvents['emit'](_0x1bbe88+':'+_0x15596d['id'],_0x15596d);DashboardEvents[_0x04d5('0x6')](_0x1bbe88,_0x15596d);_0x1cbbbe(null);};}for(var e in events){if(events[_0x04d5('0x7')](e)){var event=events[e];Dashboard[_0x04d5('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index d8e671d..e4d2799 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 _0x73b1=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','lodash','util'];(function(_0x1ec8f9,_0x22f5e7){var _0x17cd3d=function(_0x156ad2){while(--_0x156ad2){_0x1ec8f9['push'](_0x1ec8f9['shift']());}};_0x17cd3d(++_0x22f5e7);}(_0x73b1,0x1ed));var _0x173b=function(_0x54320f,_0x5aa30d){_0x54320f=_0x54320f-0x0;var _0x102858=_0x73b1[_0x54320f];return _0x102858;};'use strict';var _=require(_0x173b('0x0'));var util=require(_0x173b('0x1'));var logger=require('../../config/logger')(_0x173b('0x2'));var moment=require(_0x173b('0x3'));var BPromise=require(_0x173b('0x4'));var rp=require(_0x173b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x173b('0x6'));var config=require(_0x173b('0x7'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x1480b7,_0x5c6673){return _0x1480b7[_0x173b('0x8')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75d1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x75d1,0xb6));var _0x175d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x75d1[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x175d('0x0'));var util=require(_0x175d('0x1'));var logger=require(_0x175d('0x2'))(_0x175d('0x3'));var moment=require(_0x175d('0x4'));var BPromise=require(_0x175d('0x5'));var rp=require(_0x175d('0x6'));var fs=require('fs');var path=require(_0x175d('0x7'));var rimraf=require(_0x175d('0x8'));var config=require(_0x175d('0x9'));var attributes=require(_0x175d('0xa'));module[_0x175d('0xb')]=function(_0x569a05,_0x5e7407){return _0x569a05[_0x175d('0xc')](_0x175d('0xd'),attributes,{'tableName':'dashboards','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 18c4faa..ba75e80 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 _0xb41d=['../../config/environment','client','http','redis','./dashboard.socket','request','then','info','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','request\x20sent','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4be9e1,_0x21054a){var _0x2e7b12=function(_0x76caf6){while(--_0x76caf6){_0x4be9e1['push'](_0x4be9e1['shift']());}};_0x2e7b12(++_0x21054a);}(_0xb41d,0xb8));var _0xdb41=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xb41d[_0x4ae625];return _0x31accf;};'use strict';var _=require('lodash');var util=require(_0xdb41('0x0'));var moment=require(_0xdb41('0x1'));var BPromise=require(_0xdb41('0x2'));var rs=require(_0xdb41('0x3'));var fs=require('fs');var Redis=require(_0xdb41('0x4'));var db=require(_0xdb41('0x5'))['db'];var utils=require(_0xdb41('0x6'));var logger=require(_0xdb41('0x7'))('rpc');var config=require(_0xdb41('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdb41('0x9')][_0xdb41('0xa')]({'port':0x232a});config[_0xdb41('0xb')]=_['defaults'](config[_0xdb41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb41('0xb')]));require(_0xdb41('0xc'))['register'](socket);function respondWithRpcPromise(_0x33bb47,_0x5df981,_0x58643a){return new BPromise(function(_0xc9dde2,_0xface9a){return client[_0xdb41('0xd')](_0x33bb47,_0x58643a)[_0xdb41('0xe')](function(_0x7c7be0){logger[_0xdb41('0xf')]('Dashboard,\x20%s,\x20%s',_0x5df981,'request\x20sent');logger[_0xdb41('0x10')](_0xdb41('0x11'),_0x5df981,'request\x20sent',JSON[_0xdb41('0x12')](_0x7c7be0));if(_0x7c7be0[_0xdb41('0x13')]){if(_0x7c7be0[_0xdb41('0x13')][_0xdb41('0x14')]===0x1f4){logger[_0xdb41('0x13')](_0xdb41('0x15'),_0x5df981,_0x7c7be0[_0xdb41('0x13')][_0xdb41('0x16')]);return _0xface9a(_0x7c7be0[_0xdb41('0x13')]['message']);}logger[_0xdb41('0x13')](_0xdb41('0x15'),_0x5df981,_0x7c7be0[_0xdb41('0x13')][_0xdb41('0x16')]);return _0xc9dde2(_0x7c7be0['error']['message']);}else{logger[_0xdb41('0xf')]('Dashboard,\x20%s,\x20%s',_0x5df981,_0xdb41('0x17'));_0xc9dde2(_0x7c7be0['result'][_0xdb41('0x16')]);}})['catch'](function(_0x434ff1){logger['error'](_0xdb41('0x15'),_0x5df981,_0x434ff1);_0xface9a(_0x434ff1);});});} \ No newline at end of file +var _0x3651=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','code','error','message'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x3651,0x1cd));var _0x1365=function(_0x3c45aa,_0x20892b){_0x3c45aa=_0x3c45aa-0x0;var _0x560bbe=_0x3651[_0x3c45aa];return _0x560bbe;};'use strict';var _=require(_0x1365('0x0'));var util=require(_0x1365('0x1'));var moment=require(_0x1365('0x2'));var BPromise=require(_0x1365('0x3'));var rs=require('randomstring');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(_0x1365('0x8'));var client=jayson[_0x1365('0x9')][_0x1365('0xa')]({'port':0x232a});config[_0x1365('0xb')]=_[_0x1365('0xc')](config[_0x1365('0xb')],{'host':_0x1365('0xd'),'port':0x18eb});var socket=require(_0x1365('0xe'))(new Redis(config['redis']));require(_0x1365('0xf'))[_0x1365('0x10')](socket);function respondWithRpcPromise(_0x2a8434,_0x314501,_0x412024){return new BPromise(function(_0x5173cc,_0x557f02){return client['request'](_0x2a8434,_0x412024)[_0x1365('0x11')](function(_0x484fd5){logger[_0x1365('0x12')](_0x1365('0x13'),_0x314501,_0x1365('0x14'));logger[_0x1365('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x314501,'request\x20sent',JSON['stringify'](_0x484fd5));if(_0x484fd5['error']){if(_0x484fd5['error'][_0x1365('0x16')]===0x1f4){logger[_0x1365('0x17')]('Dashboard,\x20%s,\x20%s',_0x314501,_0x484fd5[_0x1365('0x17')][_0x1365('0x18')]);return _0x557f02(_0x484fd5['error'][_0x1365('0x18')]);}logger['error'](_0x1365('0x13'),_0x314501,_0x484fd5['error'][_0x1365('0x18')]);return _0x5173cc(_0x484fd5[_0x1365('0x17')][_0x1365('0x18')]);}else{logger[_0x1365('0x12')](_0x1365('0x13'),_0x314501,_0x1365('0x14'));_0x5173cc(_0x484fd5[_0x1365('0x19')]['message']);}})[_0x1365('0x1a')](function(_0x5b7d73){logger[_0x1365('0x17')](_0x1365('0x13'),_0x314501,_0x5b7d73);_0x557f02(_0x5b7d73);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 0d4f6d6..541ad23 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 _0xe688=['register','dashboard:','./dashboard.events','remove','update','emit','removeListener'];(function(_0x1dd712,_0x5064a6){var _0x1af645=function(_0x1667ef){while(--_0x1667ef){_0x1dd712['push'](_0x1dd712['shift']());}};_0x1af645(++_0x5064a6);}(_0xe688,0x152));var _0x8e68=function(_0x24d711,_0x3cdb28){_0x24d711=_0x24d711-0x0;var _0x3491b4=_0xe688[_0x24d711];return _0x3491b4;};'use strict';var DashboardEvents=require(_0x8e68('0x0'));var events=['save',_0x8e68('0x1'),_0x8e68('0x2')];function createListener(_0x1a5bc6,_0x5f52e9){return function(_0x15a0df){_0x5f52e9[_0x8e68('0x3')](_0x1a5bc6,_0x15a0df);};}function removeListener(_0x10bea6,_0x5904d1){return function(){DashboardEvents[_0x8e68('0x4')](_0x10bea6,_0x5904d1);};}exports[_0x8e68('0x5')]=function(_0x1dbb80){for(var _0x2f1e67=0x0,_0x1f1e4f=events['length'];_0x2f1e67<_0x1f1e4f;_0x2f1e67++){var _0x42c4e3=events[_0x2f1e67];var _0x59e953=createListener(_0x8e68('0x6')+_0x42c4e3,_0x1dbb80);DashboardEvents['on'](_0x42c4e3,_0x59e953);}}; \ No newline at end of file +var _0x7df5=['emit','removeListener','register','length','dashboard:','save','remove','update'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7df5,0x13d));var _0x57df=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x7df5[_0x166d93];return _0xba708;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x57df('0x0'),_0x57df('0x1'),_0x57df('0x2')];function createListener(_0x1315b5,_0x52647c){return function(_0x344012){_0x52647c[_0x57df('0x3')](_0x1315b5,_0x344012);};}function removeListener(_0x9a6b7a,_0x27ecda){return function(){DashboardEvents[_0x57df('0x4')](_0x9a6b7a,_0x27ecda);};}exports[_0x57df('0x5')]=function(_0x3e8a03){for(var _0x58bf3b=0x0,_0x327e30=events[_0x57df('0x6')];_0x58bf3b<_0x327e30;_0x58bf3b++){var _0x1683c8=events[_0x58bf3b];var _0x1da586=createListener(_0x57df('0x7')+_0x1683c8,_0x3e8a03);DashboardEvents['on'](_0x1683c8,_0x1da586);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 6365e46..3bdaf7c 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(_0x380a6b,_0x2614e1){var _0x5a992a=function(_0x5a1058){while(--_0x5a1058){_0x380a6b['push'](_0x380a6b['shift']());}};_0x5a992a(++_0x2614e1);}(_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(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 1b44804..6f06b81 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 _0xe8cd=['long','parse','setDataValue','stringify','attrs','INTEGER','#ffffff','#2196f3','lodash','exports','STRING'];(function(_0x7dbaa0,_0x1ed977){var _0x54022e=function(_0x4f5752){while(--_0x4f5752){_0x7dbaa0['push'](_0x7dbaa0['shift']());}};_0x54022e(++_0x1ed977);}(_0xe8cd,0x152));var _0xde8c=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0xe8cd[_0x11e05d];return _0x335588;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0xde8c('0x0'));module[_0xde8c('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xde8c('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xde8c('0x3')),'get':function(){try{return JSON[_0xde8c('0x4')](this['getDataValue']('attrs'));}catch(_0x4b64e8){return[];}},'set':function(_0x4e97cc){try{this[_0xde8c('0x5')]('attrs',JSON[_0xde8c('0x6')](_0x4e97cc));}catch(_0x57725e){this[_0xde8c('0x5')](_0xde8c('0x7'),JSON[_0xde8c('0x6')]([]));}}},'sizeX':{'type':Sequelize[_0xde8c('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xde8c('0x8')]},'col':{'type':Sequelize[_0xde8c('0x8')]},'background':{'type':Sequelize[_0xde8c('0x2')],'allowNull':![],'defaultValue':_0xde8c('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xde8c('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xde8c('0x2')]},'titleFontSize':{'type':Sequelize[_0xde8c('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0x4903=['sequelize','lodash','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x11f6b8,_0x4c776b){var _0x2bcec6=function(_0x80fc03){while(--_0x80fc03){_0x11f6b8['push'](_0x11f6b8['shift']());}};_0x2bcec6(++_0x4c776b);}(_0x4903,0x1a0));var _0x3490=function(_0x110db5,_0x105413){_0x110db5=_0x110db5-0x0;var _0x1607fa=_0x4903[_0x110db5];return _0x1607fa;};'use strict';var Sequelize=require(_0x3490('0x0'));var squel=require('squel');var _=require(_0x3490('0x1'));module[_0x3490('0x2')]={'title':{'type':Sequelize[_0x3490('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x3490('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3490('0x4')]('long'),'get':function(){try{return JSON[_0x3490('0x5')](this[_0x3490('0x6')](_0x3490('0x7')));}catch(_0x4d05d4){return[];}},'set':function(_0x2a8969){try{this[_0x3490('0x8')](_0x3490('0x7'),JSON[_0x3490('0x9')](_0x2a8969));}catch(_0x421d60){this[_0x3490('0x8')](_0x3490('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x3490('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3490('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x3490('0xa')]},'col':{'type':Sequelize[_0x3490('0xa')]},'background':{'type':Sequelize[_0x3490('0x3')],'allowNull':![],'defaultValue':_0x3490('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3490('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3490('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 0cb5f39..c794cf0 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 _0x6535=['destroy','sendStatus','error','stack','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','include','merge','options','then','catch','attrUrl','attrs','value','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','stringify','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','count','offset','limit','set','json','apply','reject','save'];(function(_0x416eae,_0x1a6af8){var _0x58fc88=function(_0x4518c3){while(--_0x4518c3){_0x416eae['push'](_0x416eae['shift']());}};_0x58fc88(++_0x1a6af8);}(_0x6535,0xe7));var _0x5653=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6535[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5653('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5653('0x1'));var jsonpatch=require(_0x5653('0x2'));var rp=require(_0x5653('0x3'));var moment=require(_0x5653('0x4'));var BPromise=require(_0x5653('0x5'));var Mustache=require(_0x5653('0x6'));var util=require(_0x5653('0x7'));var path=require(_0x5653('0x8'));var sox=require(_0x5653('0x9'));var csv=require(_0x5653('0xa'));var ejs=require(_0x5653('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5653('0xc'));var crypto=require(_0x5653('0xd'));var jsforce=require(_0x5653('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5653('0xa'));var querystring=require(_0x5653('0xf'));var Papa=require(_0x5653('0x10'));var Redis=require('ioredis');var authService=require(_0x5653('0x11'));var qs=require(_0x5653('0x12'));var as=require(_0x5653('0x13'));var hardwareService=require(_0x5653('0x14'));var logger=require(_0x5653('0x15'))(_0x5653('0x16'));var utils=require(_0x5653('0x17'));var config=require(_0x5653('0x18'));var licenseUtil=require(_0x5653('0x19'));var db=require(_0x5653('0x1a'))['db'];config[_0x5653('0x1b')]=_['defaults'](config[_0x5653('0x1b')],{'host':_0x5653('0x1c'),'port':0x18eb});var socket=require(_0x5653('0x1d'))(new Redis(config[_0x5653('0x1b')]));require(_0x5653('0x1e'))[_0x5653('0x1f')](socket);function respondWithStatusCode(_0x1812c3,_0xdb27ac){_0xdb27ac=_0xdb27ac||0xcc;return function(_0xa1759d){if(_0xa1759d){return _0x1812c3['sendStatus'](_0xdb27ac);}return _0x1812c3[_0x5653('0x20')](_0xdb27ac)[_0x5653('0x21')]();};}function respondWithResult(_0x2b9ddd,_0x3047c1){_0x3047c1=_0x3047c1||0xc8;return function(_0x5203ab){if(_0x5203ab){return _0x2b9ddd[_0x5653('0x20')](_0x3047c1)['json'](_0x5203ab);}};}function respondWithFilteredResult(_0x11f97a,_0x2222cb){return function(_0x236298){if(_0x236298){var _0x1f9292=_0x236298[_0x5653('0x22')],_0xe2e02c=_0x2222cb[_0x5653('0x23')],_0x4af87d=_0x2222cb[_0x5653('0x23')]+_0x2222cb[_0x5653('0x24')],_0x2cf1b3;if(_0x4af87d>=_0x1f9292){_0x4af87d=_0x1f9292;_0x2cf1b3=0xc8;}else{_0x2cf1b3=0xce;}_0x11f97a[_0x5653('0x20')](_0x2cf1b3);return _0x11f97a[_0x5653('0x25')]('Content-Range',_0xe2e02c+'-'+_0x4af87d+'/'+_0x1f9292)[_0x5653('0x26')](_0x236298);}return null;};}function patchUpdates(_0x2af623){return function(_0x5094f6){try{jsonpatch[_0x5653('0x27')](_0x5094f6,_0x2af623,!![]);}catch(_0x33bc8e){return BPromise[_0x5653('0x28')](_0x33bc8e);}return _0x5094f6[_0x5653('0x29')]();};}function saveUpdates(_0x5dc842,_0x4d6f64){return function(_0x48a66c){if(_0x48a66c){return _0x48a66c['update'](_0x5dc842)['then'](function(_0x51a547){return _0x51a547;});}return null;};}function removeEntity(_0x4aacf3,_0x2ab0de){return function(_0x2d1b6d){if(_0x2d1b6d){return _0x2d1b6d[_0x5653('0x2a')]()['then'](function(){_0x4aacf3[_0x5653('0x20')](0xcc)[_0x5653('0x21')]();});}};}function handleEntityNotFound(_0xe7b18a,_0x5aa805){return function(_0x4dcaee){if(!_0x4dcaee){_0xe7b18a[_0x5653('0x2b')](0x194);}return _0x4dcaee;};}function handleError(_0x2c31bc,_0x2c0633){_0x2c0633=_0x2c0633||0x1f4;return function(_0x3437f3){logger[_0x5653('0x2c')](_0x3437f3[_0x5653('0x2d')]);if(_0x3437f3['name']){delete _0x3437f3['name'];}_0x2c31bc[_0x5653('0x20')](_0x2c0633)[_0x5653('0x2e')](_0x3437f3);};}exports[_0x5653('0x2f')]=function(_0x39e635,_0x726f28){var _0x5c655b={'raw':![],'where':{'id':_0x39e635[_0x5653('0x30')]['id']}},_0xd36c3d={};_0xd36c3d[_0x5653('0x31')]=_[_0x5653('0x32')](db[_0x5653('0x33')][_0x5653('0x34')]);_0xd36c3d[_0x5653('0x35')]=_['keys'](_0x39e635[_0x5653('0x35')]);_0xd36c3d[_0x5653('0x36')]=_[_0x5653('0x37')](_0xd36c3d[_0x5653('0x31')],_0xd36c3d[_0x5653('0x35')]);_0x5c655b['attributes']=_[_0x5653('0x37')](_0xd36c3d['model'],qs['fields'](_0x39e635[_0x5653('0x35')][_0x5653('0x38')]));_0x5c655b[_0x5653('0x39')]=_0x5c655b[_0x5653('0x39')]['length']?_0x5c655b[_0x5653('0x39')]:_0xd36c3d[_0x5653('0x31')];if(_0x39e635[_0x5653('0x35')]['includeAll']){_0x5c655b[_0x5653('0x3a')]=[{'all':!![]}];}_0x5c655b=_[_0x5653('0x3b')]({},_0x5c655b,_0x39e635[_0x5653('0x3c')]);return db[_0x5653('0x33')]['find'](_0x5c655b)[_0x5653('0x3d')](handleEntityNotFound(_0x726f28,null))['then'](respondWithResult(_0x726f28,null))[_0x5653('0x3e')](handleError(_0x726f28,null));};exports['destroy']=function(_0x2cf199,_0x53207e){return db[_0x5653('0x33')]['find']({'where':{'id':_0x2cf199[_0x5653('0x30')]['id']}})['then'](handleEntityNotFound(_0x53207e,null))[_0x5653('0x3d')](removeEntity(_0x53207e,null))[_0x5653('0x3e')](handleError(_0x53207e,null));};function widgetAttributes(_0x4ad8e6){try{switch(_0x4ad8e6['type']){case'iframe':return[{'name':_0x5653('0x3f'),'value':_0x4ad8e6[_0x5653('0x3f')]||(_0x4ad8e6['attrs']&&_0x4ad8e6[_0x5653('0x40')][0x0]?_0x4ad8e6['attrs'][0x0][_0x5653('0x41')]:undefined)||'https://'}];case _0x5653('0x42'):return[{'name':_0x5653('0x43'),'value':_0x4ad8e6[_0x5653('0x43')]||(_0x4ad8e6['attrs']&&_0x4ad8e6['attrs'][0x0]?_0x4ad8e6[_0x5653('0x40')][0x0][_0x5653('0x41')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x4ad8e6[_0x5653('0x44')]||(_0x4ad8e6[_0x5653('0x40')]&&_0x4ad8e6[_0x5653('0x40')][0x0]?_0x4ad8e6['attrs'][0x0][_0x5653('0x41')]:undefined)||'HH:mm:ss'},{'name':_0x5653('0x45'),'value':_0x4ad8e6['attrTimezone']||(_0x4ad8e6[_0x5653('0x40')]&&_0x4ad8e6[_0x5653('0x40')][0x1]?_0x4ad8e6[_0x5653('0x40')][0x1][_0x5653('0x41')]:undefined)||_0x5653('0x46')},{'name':_0x5653('0x47'),'value':_0x4ad8e6[_0x5653('0x47')]||(_0x4ad8e6[_0x5653('0x40')]&&_0x4ad8e6[_0x5653('0x40')][0x2]?_0x4ad8e6[_0x5653('0x40')][0x2]['value']:undefined)||0xc}];case _0x5653('0x48'):return[{'name':'attrMetric','value':_0x4ad8e6[_0x5653('0x49')]||(_0x4ad8e6[_0x5653('0x40')]&&_0x4ad8e6['attrs'][0x0]?_0x4ad8e6[_0x5653('0x40')][0x0][_0x5653('0x41')]:undefined)||_0x5653('0x4a')},{'name':_0x5653('0x4b'),'value':_0x4ad8e6[_0x5653('0x4b')]||(_0x4ad8e6[_0x5653('0x40')]&&_0x4ad8e6['attrs'][0x1]?_0x4ad8e6['attrs'][0x1][_0x5653('0x41')]:undefined)||[]},{'name':'attrFontSize','value':_0x4ad8e6[_0x5653('0x47')]||(_0x4ad8e6[_0x5653('0x40')]&&_0x4ad8e6[_0x5653('0x40')][0x2]?_0x4ad8e6['attrs'][0x2][_0x5653('0x41')]:undefined)||0x14}];case _0x5653('0x4c'):case _0x5653('0x4d'):return[{'name':_0x5653('0x4e'),'value':_0x4ad8e6[_0x5653('0x4e')]||(_0x4ad8e6[_0x5653('0x40')]&&_0x4ad8e6[_0x5653('0x40')][0x0]?_0x4ad8e6[_0x5653('0x40')][0x0][_0x5653('0x41')]:undefined)||_0x5653('0x4a')},{'name':'attrSerie2','value':_0x4ad8e6[_0x5653('0x4f')]||(_0x4ad8e6['attrs']&&_0x4ad8e6[_0x5653('0x40')][0x1]?_0x4ad8e6[_0x5653('0x40')][0x1][_0x5653('0x41')]:undefined)||null},{'name':_0x5653('0x50'),'value':_0x4ad8e6[_0x5653('0x50')]||(_0x4ad8e6[_0x5653('0x40')]&&_0x4ad8e6[_0x5653('0x40')][0x2]?_0x4ad8e6[_0x5653('0x40')][0x2][_0x5653('0x41')]:undefined)||null},{'name':_0x5653('0x4b'),'value':_0x4ad8e6[_0x5653('0x4b')]||(_0x4ad8e6[_0x5653('0x40')]&&_0x4ad8e6['attrs'][0x3]?_0x4ad8e6[_0x5653('0x40')][0x3][_0x5653('0x41')]:undefined)||[]}];case _0x5653('0x51'):return[{'name':_0x5653('0x52'),'type':_0x4ad8e6[_0x5653('0x53')]||(_0x4ad8e6[_0x5653('0x40')]&&_0x4ad8e6[_0x5653('0x40')][0x0]?_0x4ad8e6[_0x5653('0x40')][0x0][_0x5653('0x54')]:undefined)||null,'value':_0x4ad8e6[_0x5653('0x52')]||(_0x4ad8e6[_0x5653('0x40')]&&_0x4ad8e6[_0x5653('0x40')][0x0]?_0x4ad8e6['attrs'][0x0][_0x5653('0x41')]:undefined)||null},{'name':_0x5653('0x55'),'value':_0x4ad8e6[_0x5653('0x55')]||(_0x4ad8e6[_0x5653('0x40')]&&_0x4ad8e6[_0x5653('0x40')][0x1]?_0x4ad8e6[_0x5653('0x40')][0x1][_0x5653('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x4cc0af){logger['error']('widgetAttributes:\x20%s',JSON[_0x5653('0x56')](_0x4cc0af));return[];}}exports[_0x5653('0x57')]=function(_0x510a39,_0x5d6d87){if(_0x510a39['body']){_0x510a39['body']['attrs']=widgetAttributes(_0x510a39[_0x5653('0x58')]);}return db[_0x5653('0x33')]['create'](_0x510a39[_0x5653('0x58')],{})['then'](respondWithResult(_0x5d6d87,0xc9))['catch'](handleError(_0x5d6d87,null));};exports[_0x5653('0x59')]=function(_0x924af2,_0x53e8ff){if(_0x924af2[_0x5653('0x58')]['id']){delete _0x924af2['body']['id'];}_0x924af2[_0x5653('0x58')][_0x5653('0x40')]=widgetAttributes(_0x924af2['body']);return db[_0x5653('0x33')][_0x5653('0x5a')]({'where':{'id':_0x924af2['params']['id']}})[_0x5653('0x3d')](handleEntityNotFound(_0x53e8ff,null))['then'](saveUpdates(_0x924af2[_0x5653('0x58')],null))[_0x5653('0x3d')](respondWithResult(_0x53e8ff,null))[_0x5653('0x3e')](handleError(_0x53e8ff,null));}; \ No newline at end of file +var _0x43fa=['pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','filters','intersection','query','attributes','fields','includeAll','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart'];(function(_0x55939f,_0x4c827f){var _0x335367=function(_0x343e80){while(--_0x343e80){_0x55939f['push'](_0x55939f['shift']());}};_0x335367(++_0x4c827f);}(_0x43fa,0xbb));var _0xa43f=function(_0x543242,_0xeac9fd){_0x543242=_0x543242-0x0;var _0x4c99b6=_0x43fa[_0x543242];return _0x4c99b6;};'use strict';var pdf=require(_0xa43f('0x0'));var emlformat=require(_0xa43f('0x1'));var rimraf=require(_0xa43f('0x2'));var zipdir=require(_0xa43f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa43f('0x4'));var moment=require(_0xa43f('0x5'));var BPromise=require(_0xa43f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa43f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa43f('0x8'));var squel=require('squel');var crypto=require(_0xa43f('0x9'));var jsforce=require(_0xa43f('0xa'));var deskjs=require(_0xa43f('0xb'));var toCsv=require(_0xa43f('0xc'));var querystring=require(_0xa43f('0xd'));var Papa=require(_0xa43f('0xe'));var Redis=require('ioredis');var authService=require(_0xa43f('0xf'));var qs=require(_0xa43f('0x10'));var as=require(_0xa43f('0x11'));var hardwareService=require(_0xa43f('0x12'));var logger=require(_0xa43f('0x13'))('api');var utils=require(_0xa43f('0x14'));var config=require(_0xa43f('0x15'));var licenseUtil=require(_0xa43f('0x16'));var db=require(_0xa43f('0x17'))['db'];config['redis']=_[_0xa43f('0x18')](config[_0xa43f('0x19')],{'host':_0xa43f('0x1a'),'port':0x18eb});var socket=require(_0xa43f('0x1b'))(new Redis(config[_0xa43f('0x19')]));require(_0xa43f('0x1c'))[_0xa43f('0x1d')](socket);function respondWithStatusCode(_0x11d86e,_0x5b73eb){_0x5b73eb=_0x5b73eb||0xcc;return function(_0x32b2e1){if(_0x32b2e1){return _0x11d86e[_0xa43f('0x1e')](_0x5b73eb);}return _0x11d86e[_0xa43f('0x1f')](_0x5b73eb)['end']();};}function respondWithResult(_0x3b7183,_0x58b859){_0x58b859=_0x58b859||0xc8;return function(_0x1f4e8c){if(_0x1f4e8c){return _0x3b7183[_0xa43f('0x1f')](_0x58b859)[_0xa43f('0x20')](_0x1f4e8c);}};}function respondWithFilteredResult(_0x3dff60,_0x30f88f){return function(_0x3e4557){if(_0x3e4557){var _0x1365b7=_0x3e4557[_0xa43f('0x21')],_0x37cb1c=_0x30f88f['offset'],_0x56f4d8=_0x30f88f[_0xa43f('0x22')]+_0x30f88f[_0xa43f('0x23')],_0x7a025e;if(_0x56f4d8>=_0x1365b7){_0x56f4d8=_0x1365b7;_0x7a025e=0xc8;}else{_0x7a025e=0xce;}_0x3dff60[_0xa43f('0x1f')](_0x7a025e);return _0x3dff60[_0xa43f('0x24')](_0xa43f('0x25'),_0x37cb1c+'-'+_0x56f4d8+'/'+_0x1365b7)[_0xa43f('0x20')](_0x3e4557);}return null;};}function patchUpdates(_0x2f2994){return function(_0x3359e0){try{jsonpatch[_0xa43f('0x26')](_0x3359e0,_0x2f2994,!![]);}catch(_0x1c7d9c){return BPromise[_0xa43f('0x27')](_0x1c7d9c);}return _0x3359e0['save']();};}function saveUpdates(_0xc4fd61,_0x435a82){return function(_0x1440f7){if(_0x1440f7){return _0x1440f7[_0xa43f('0x28')](_0xc4fd61)[_0xa43f('0x29')](function(_0x3feab4){return _0x3feab4;});}return null;};}function removeEntity(_0xe6b9df,_0x1baeaf){return function(_0x26a061){if(_0x26a061){return _0x26a061['destroy']()[_0xa43f('0x29')](function(){_0xe6b9df[_0xa43f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x111515,_0x58f324){return function(_0x14e5e6){if(!_0x14e5e6){_0x111515['sendStatus'](0x194);}return _0x14e5e6;};}function handleError(_0x48cbb2,_0x339859){_0x339859=_0x339859||0x1f4;return function(_0x1b792e){logger[_0xa43f('0x2a')](_0x1b792e['stack']);if(_0x1b792e[_0xa43f('0x2b')]){delete _0x1b792e['name'];}_0x48cbb2['status'](_0x339859)[_0xa43f('0x2c')](_0x1b792e);};}exports[_0xa43f('0x2d')]=function(_0x41ad35,_0x16dcd9){var _0x5e68a4={'raw':![],'where':{'id':_0x41ad35[_0xa43f('0x2e')]['id']}},_0x5e06fb={};_0x5e06fb[_0xa43f('0x2f')]=_[_0xa43f('0x30')](db[_0xa43f('0x31')][_0xa43f('0x32')]);_0x5e06fb['query']=_['keys'](_0x41ad35['query']);_0x5e06fb[_0xa43f('0x33')]=_[_0xa43f('0x34')](_0x5e06fb[_0xa43f('0x2f')],_0x5e06fb[_0xa43f('0x35')]);_0x5e68a4[_0xa43f('0x36')]=_['intersection'](_0x5e06fb[_0xa43f('0x2f')],qs[_0xa43f('0x37')](_0x41ad35[_0xa43f('0x35')][_0xa43f('0x37')]));_0x5e68a4[_0xa43f('0x36')]=_0x5e68a4['attributes']['length']?_0x5e68a4[_0xa43f('0x36')]:_0x5e06fb[_0xa43f('0x2f')];if(_0x41ad35['query'][_0xa43f('0x38')]){_0x5e68a4['include']=[{'all':!![]}];}_0x5e68a4=_[_0xa43f('0x39')]({},_0x5e68a4,_0x41ad35[_0xa43f('0x3a')]);return db[_0xa43f('0x31')][_0xa43f('0x3b')](_0x5e68a4)[_0xa43f('0x29')](handleEntityNotFound(_0x16dcd9,null))[_0xa43f('0x29')](respondWithResult(_0x16dcd9,null))[_0xa43f('0x3c')](handleError(_0x16dcd9,null));};exports['destroy']=function(_0x513fe7,_0x8f265c){return db[_0xa43f('0x31')]['find']({'where':{'id':_0x513fe7[_0xa43f('0x2e')]['id']}})[_0xa43f('0x29')](handleEntityNotFound(_0x8f265c,null))[_0xa43f('0x29')](removeEntity(_0x8f265c,null))[_0xa43f('0x3c')](handleError(_0x8f265c,null));};function widgetAttributes(_0x5b7299){try{switch(_0x5b7299[_0xa43f('0x3d')]){case _0xa43f('0x3e'):return[{'name':_0xa43f('0x3f'),'value':_0x5b7299[_0xa43f('0x3f')]||(_0x5b7299[_0xa43f('0x40')]&&_0x5b7299['attrs'][0x0]?_0x5b7299[_0xa43f('0x40')][0x0][_0xa43f('0x41')]:undefined)||_0xa43f('0x42')}];case _0xa43f('0x43'):return[{'name':_0xa43f('0x44'),'value':_0x5b7299[_0xa43f('0x44')]||(_0x5b7299[_0xa43f('0x40')]&&_0x5b7299[_0xa43f('0x40')][0x0]?_0x5b7299[_0xa43f('0x40')][0x0][_0xa43f('0x41')]:undefined)||''}];case'clock':return[{'name':_0xa43f('0x45'),'value':_0x5b7299['attrHourFormat']||(_0x5b7299[_0xa43f('0x40')]&&_0x5b7299['attrs'][0x0]?_0x5b7299['attrs'][0x0][_0xa43f('0x41')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x5b7299[_0xa43f('0x46')]||(_0x5b7299[_0xa43f('0x40')]&&_0x5b7299[_0xa43f('0x40')][0x1]?_0x5b7299[_0xa43f('0x40')][0x1][_0xa43f('0x41')]:undefined)||_0xa43f('0x47')},{'name':_0xa43f('0x48'),'value':_0x5b7299[_0xa43f('0x48')]||(_0x5b7299[_0xa43f('0x40')]&&_0x5b7299['attrs'][0x2]?_0x5b7299[_0xa43f('0x40')][0x2][_0xa43f('0x41')]:undefined)||0xc}];case'counter':return[{'name':_0xa43f('0x49'),'value':_0x5b7299[_0xa43f('0x49')]||(_0x5b7299['attrs']&&_0x5b7299[_0xa43f('0x40')][0x0]?_0x5b7299[_0xa43f('0x40')][0x0][_0xa43f('0x41')]:undefined)||_0xa43f('0x4a')},{'name':_0xa43f('0x4b'),'value':_0x5b7299[_0xa43f('0x4b')]||(_0x5b7299['attrs']&&_0x5b7299[_0xa43f('0x40')][0x1]?_0x5b7299[_0xa43f('0x40')][0x1]['value']:undefined)||[]},{'name':_0xa43f('0x48'),'value':_0x5b7299[_0xa43f('0x48')]||(_0x5b7299['attrs']&&_0x5b7299[_0xa43f('0x40')][0x2]?_0x5b7299[_0xa43f('0x40')][0x2][_0xa43f('0x41')]:undefined)||0x14}];case _0xa43f('0x4c'):case _0xa43f('0x4d'):return[{'name':_0xa43f('0x4e'),'value':_0x5b7299[_0xa43f('0x4e')]||(_0x5b7299[_0xa43f('0x40')]&&_0x5b7299['attrs'][0x0]?_0x5b7299[_0xa43f('0x40')][0x0][_0xa43f('0x41')]:undefined)||'total'},{'name':_0xa43f('0x4f'),'value':_0x5b7299[_0xa43f('0x4f')]||(_0x5b7299[_0xa43f('0x40')]&&_0x5b7299['attrs'][0x1]?_0x5b7299[_0xa43f('0x40')][0x1]['value']:undefined)||null},{'name':_0xa43f('0x50'),'value':_0x5b7299[_0xa43f('0x50')]||(_0x5b7299[_0xa43f('0x40')]&&_0x5b7299['attrs'][0x2]?_0x5b7299[_0xa43f('0x40')][0x2][_0xa43f('0x41')]:undefined)||null},{'name':_0xa43f('0x4b'),'value':_0x5b7299[_0xa43f('0x4b')]||(_0x5b7299[_0xa43f('0x40')]&&_0x5b7299[_0xa43f('0x40')][0x3]?_0x5b7299[_0xa43f('0x40')][0x3][_0xa43f('0x41')]:undefined)||[]}];case _0xa43f('0x51'):return[{'name':_0xa43f('0x52'),'type':_0x5b7299['reportType']||(_0x5b7299['attrs']&&_0x5b7299[_0xa43f('0x40')][0x0]?_0x5b7299[_0xa43f('0x40')][0x0]['type']:undefined)||null,'value':_0x5b7299[_0xa43f('0x52')]||(_0x5b7299[_0xa43f('0x40')]&&_0x5b7299[_0xa43f('0x40')][0x0]?_0x5b7299[_0xa43f('0x40')][0x0]['value']:undefined)||null},{'name':_0xa43f('0x53'),'value':_0x5b7299[_0xa43f('0x53')]||(_0x5b7299['attrs']&&_0x5b7299['attrs'][0x1]?_0x5b7299[_0xa43f('0x40')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3eb2d1){logger[_0xa43f('0x2a')](_0xa43f('0x54'),JSON[_0xa43f('0x55')](_0x3eb2d1));return[];}}exports[_0xa43f('0x56')]=function(_0xa42fe4,_0x2a4538){if(_0xa42fe4['body']){_0xa42fe4[_0xa43f('0x57')]['attrs']=widgetAttributes(_0xa42fe4[_0xa43f('0x57')]);}return db[_0xa43f('0x31')][_0xa43f('0x56')](_0xa42fe4[_0xa43f('0x57')],{})[_0xa43f('0x29')](respondWithResult(_0x2a4538,0xc9))[_0xa43f('0x3c')](handleError(_0x2a4538,null));};exports[_0xa43f('0x28')]=function(_0x43fdb3,_0x26df1f){if(_0x43fdb3[_0xa43f('0x57')]['id']){delete _0x43fdb3['body']['id'];}_0x43fdb3[_0xa43f('0x57')][_0xa43f('0x40')]=widgetAttributes(_0x43fdb3[_0xa43f('0x57')]);return db[_0xa43f('0x31')][_0xa43f('0x3b')]({'where':{'id':_0x43fdb3[_0xa43f('0x2e')]['id']}})[_0xa43f('0x29')](handleEntityNotFound(_0x26df1f,null))['then'](saveUpdates(_0x43fdb3[_0xa43f('0x57')],null))[_0xa43f('0x29')](respondWithResult(_0x26df1f,null))[_0xa43f('0x3c')](handleError(_0x26df1f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 482e191..9ad6555 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 _0x191d=['remove','emit','hook','events','../../mysqldb','DashboardItem','save','update'];(function(_0x2c7c8c,_0x1986d4){var _0x8fbc17=function(_0x3da9bd){while(--_0x3da9bd){_0x2c7c8c['push'](_0x2c7c8c['shift']());}};_0x8fbc17(++_0x1986d4);}(_0x191d,0x173));var _0xd191=function(_0x3edc68,_0x772f75){_0x3edc68=_0x3edc68-0x0;var _0x372658=_0x191d[_0x3edc68];return _0x372658;};'use strict';var EventEmitter=require(_0xd191('0x0'));var DashboardItem=require(_0xd191('0x1'))['db'][_0xd191('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd191('0x3'),'afterUpdate':_0xd191('0x4'),'afterDestroy':_0xd191('0x5')};function emitEvent(_0x33f206){return function(_0x41bacf,_0x163605,_0x46b1e7){DashboardItemEvents[_0xd191('0x6')](_0x33f206+':'+_0x41bacf['id'],_0x41bacf);DashboardItemEvents[_0xd191('0x6')](_0x33f206,_0x41bacf);_0x46b1e7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xd191('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x9f9c=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x9f9c,0x18c));var _0xc9f9=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9f9c[_0x27af45];return _0x18df21;};'use strict';var EventEmitter=require(_0xc9f9('0x0'));var DashboardItem=require(_0xc9f9('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc9f9('0x2'),'afterUpdate':_0xc9f9('0x3'),'afterDestroy':_0xc9f9('0x4')};function emitEvent(_0x5d7527){return function(_0x232a36,_0x4a6620,_0x43ac44){DashboardItemEvents[_0xc9f9('0x5')](_0x5d7527+':'+_0x232a36['id'],_0x232a36);DashboardItemEvents[_0xc9f9('0x5')](_0x5d7527,_0x232a36);_0x43ac44(null);};}for(var e in events){if(events[_0xc9f9('0x6')](e)){var event=events[e];DashboardItem[_0xc9f9('0x7')](e,emitEvent(event));}}module[_0xc9f9('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 4f688d7..729dbff 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 _0x1cc3=['rimraf','../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','api','moment','bluebird','request-promise'];(function(_0x5219e4,_0x50cdef){var _0x390418=function(_0x589678){while(--_0x589678){_0x5219e4['push'](_0x5219e4['shift']());}};_0x390418(++_0x50cdef);}(_0x1cc3,0x103));var _0x31cc=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1cc3[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x31cc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x31cc('0x1'));var moment=require(_0x31cc('0x2'));var BPromise=require(_0x31cc('0x3'));var rp=require(_0x31cc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31cc('0x5'));var config=require(_0x31cc('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x31cc('0x7')]=function(_0x47cef4,_0x33a052){return _0x47cef4[_0x31cc('0x8')](_0x31cc('0x9'),attributes,{'tableName':_0x31cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bb1=['exports','define','DashboardItem','dashboard_items','lodash','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x373175,_0xc5a817){var _0xd3c3c4=function(_0x555eb5){while(--_0x555eb5){_0x373175['push'](_0x373175['shift']());}};_0xd3c3c4(++_0xc5a817);}(_0x2bb1,0x9e));var _0x12bb=function(_0x3af8e1,_0x2f72ae){_0x3af8e1=_0x3af8e1-0x0;var _0x327632=_0x2bb1[_0x3af8e1];return _0x327632;};'use strict';var _=require(_0x12bb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x12bb('0x1'));var moment=require(_0x12bb('0x2'));var BPromise=require('bluebird');var rp=require(_0x12bb('0x3'));var fs=require('fs');var path=require(_0x12bb('0x4'));var rimraf=require(_0x12bb('0x5'));var config=require(_0x12bb('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x12bb('0x7')]=function(_0x31398d,_0x3b6e16){return _0x31398d[_0x12bb('0x8')](_0x12bb('0x9'),attributes,{'tableName':_0x12bb('0xa'),'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 2ed364a..75b8018 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 _0x31cd=['rpc','jayson/promise','client','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x31cd,0x8a));var _0xd31c=function(_0x25cd28,_0x1aec52){_0x25cd28=_0x25cd28-0x0;var _0x399568=_0x31cd[_0x25cd28];return _0x399568;};'use strict';var _=require(_0xd31c('0x0'));var util=require('util');var moment=require(_0xd31c('0x1'));var BPromise=require(_0xd31c('0x2'));var rs=require(_0xd31c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd31c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd31c('0x5'))(_0xd31c('0x6'));var config=require('../../config/environment');var jayson=require(_0xd31c('0x7'));var client=jayson[_0xd31c('0x8')]['http']({'port':0x232a});config['redis']=_[_0xd31c('0x9')](config[_0xd31c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd31c('0xb'))(new Redis(config['redis']));require(_0xd31c('0xc'))[_0xd31c('0xd')](socket);function respondWithRpcPromise(_0x108cef,_0x57e7db,_0x598607){return new BPromise(function(_0x27d523,_0x36d6bc){return client[_0xd31c('0xe')](_0x108cef,_0x598607)['then'](function(_0x55b231){logger[_0xd31c('0xf')](_0xd31c('0x10'),_0x57e7db,_0xd31c('0x11'));logger[_0xd31c('0x12')](_0xd31c('0x13'),_0x57e7db,_0xd31c('0x11'),JSON['stringify'](_0x55b231));if(_0x55b231[_0xd31c('0x14')]){if(_0x55b231['error'][_0xd31c('0x15')]===0x1f4){logger[_0xd31c('0x14')]('DashboardItem,\x20%s,\x20%s',_0x57e7db,_0x55b231[_0xd31c('0x14')][_0xd31c('0x16')]);return _0x36d6bc(_0x55b231[_0xd31c('0x14')][_0xd31c('0x16')]);}logger[_0xd31c('0x14')](_0xd31c('0x10'),_0x57e7db,_0x55b231[_0xd31c('0x14')][_0xd31c('0x16')]);return _0x27d523(_0x55b231[_0xd31c('0x14')][_0xd31c('0x16')]);}else{logger[_0xd31c('0xf')]('DashboardItem,\x20%s,\x20%s',_0x57e7db,_0xd31c('0x11'));_0x27d523(_0x55b231['result'][_0xd31c('0x16')]);}})[_0xd31c('0x17')](function(_0x1f26ae){logger[_0xd31c('0x14')](_0xd31c('0x10'),_0x57e7db,_0x1f26ae);_0x36d6bc(_0x1f26ae);});});} \ No newline at end of file +var _0xa5dc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x1514fc,_0x130a60){var _0x3d2fe2=function(_0xadfc60){while(--_0xadfc60){_0x1514fc['push'](_0x1514fc['shift']());}};_0x3d2fe2(++_0x130a60);}(_0xa5dc,0x128));var _0xca5d=function(_0x25acfe,_0x3797bc){_0x25acfe=_0x25acfe-0x0;var _0x547928=_0xa5dc[_0x25acfe];return _0x547928;};'use strict';var _=require(_0xca5d('0x0'));var util=require(_0xca5d('0x1'));var moment=require('moment');var BPromise=require(_0xca5d('0x2'));var rs=require(_0xca5d('0x3'));var fs=require('fs');var Redis=require(_0xca5d('0x4'));var db=require(_0xca5d('0x5'))['db'];var utils=require(_0xca5d('0x6'));var logger=require(_0xca5d('0x7'))(_0xca5d('0x8'));var config=require(_0xca5d('0x9'));var jayson=require(_0xca5d('0xa'));var client=jayson[_0xca5d('0xb')][_0xca5d('0xc')]({'port':0x232a});config[_0xca5d('0xd')]=_[_0xca5d('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xca5d('0xf'))(new Redis(config[_0xca5d('0xd')]));require('./dashboardItem.socket')[_0xca5d('0x10')](socket);function respondWithRpcPromise(_0x1292a4,_0x3d4b01,_0x3fe3d0){return new BPromise(function(_0x184354,_0x52f76c){return client[_0xca5d('0x11')](_0x1292a4,_0x3fe3d0)[_0xca5d('0x12')](function(_0x9471e2){logger[_0xca5d('0x13')](_0xca5d('0x14'),_0x3d4b01,_0xca5d('0x15'));logger[_0xca5d('0x16')](_0xca5d('0x17'),_0x3d4b01,_0xca5d('0x15'),JSON[_0xca5d('0x18')](_0x9471e2));if(_0x9471e2[_0xca5d('0x19')]){if(_0x9471e2[_0xca5d('0x19')][_0xca5d('0x1a')]===0x1f4){logger[_0xca5d('0x19')](_0xca5d('0x14'),_0x3d4b01,_0x9471e2['error']['message']);return _0x52f76c(_0x9471e2['error'][_0xca5d('0x1b')]);}logger[_0xca5d('0x19')]('DashboardItem,\x20%s,\x20%s',_0x3d4b01,_0x9471e2[_0xca5d('0x19')][_0xca5d('0x1b')]);return _0x184354(_0x9471e2[_0xca5d('0x19')]['message']);}else{logger[_0xca5d('0x13')]('DashboardItem,\x20%s,\x20%s',_0x3d4b01,_0xca5d('0x15'));_0x184354(_0x9471e2[_0xca5d('0x1c')][_0xca5d('0x1b')]);}})[_0xca5d('0x1d')](function(_0x27d5bf){logger[_0xca5d('0x19')](_0xca5d('0x14'),_0x3d4b01,_0x27d5bf);_0x52f76c(_0x27d5bf);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index f5fe28b..f795fa4 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 _0x823d=['update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x5c6445,_0x103943){var _0x42cb45=function(_0x24662c){while(--_0x24662c){_0x5c6445['push'](_0x5c6445['shift']());}};_0x42cb45(++_0x103943);}(_0x823d,0x15e));var _0xd823=function(_0x3b81eb,_0x175f32){_0x3b81eb=_0x3b81eb-0x0;var _0x149491=_0x823d[_0x3b81eb];return _0x149491;};'use strict';var DashboardItemEvents=require(_0xd823('0x0'));var events=[_0xd823('0x1'),'remove',_0xd823('0x2')];function createListener(_0x4e296a,_0x3c870d){return function(_0x1e5470){_0x3c870d[_0xd823('0x3')](_0x4e296a,_0x1e5470);};}function removeListener(_0x12510a,_0x5429cb){return function(){DashboardItemEvents[_0xd823('0x4')](_0x12510a,_0x5429cb);};}exports[_0xd823('0x5')]=function(_0x1a7cab){for(var _0xa5a57=0x0,_0x2d0297=events[_0xd823('0x6')];_0xa5a57<_0x2d0297;_0xa5a57++){var _0x146568=events[_0xa5a57];var _0x30ee6a=createListener(_0xd823('0x7')+_0x146568,_0x1a7cab);DashboardItemEvents['on'](_0x146568,_0x30ee6a);}}; \ No newline at end of file +var _0x2521=['register','length','dashboardItem:','update','emit','removeListener'];(function(_0x29d57d,_0x2b0111){var _0x18c79f=function(_0x2bdfcd){while(--_0x2bdfcd){_0x29d57d['push'](_0x29d57d['shift']());}};_0x18c79f(++_0x2b0111);}(_0x2521,0x18f));var _0x1252=function(_0xd93b26,_0x12bbf2){_0xd93b26=_0xd93b26-0x0;var _0x25f668=_0x2521[_0xd93b26];return _0x25f668;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove',_0x1252('0x0')];function createListener(_0x27239c,_0x5a0e64){return function(_0x3ef0a1){_0x5a0e64[_0x1252('0x1')](_0x27239c,_0x3ef0a1);};}function removeListener(_0x4882cc,_0x3c9292){return function(){DashboardItemEvents[_0x1252('0x2')](_0x4882cc,_0x3c9292);};}exports[_0x1252('0x3')]=function(_0x390ecd){for(var _0x1e0544=0x0,_0x192e69=events[_0x1252('0x4')];_0x1e0544<_0x192e69;_0x1e0544++){var _0x4fd560=events[_0x1e0544];var _0xe1d07a=createListener(_0x1252('0x5')+_0x4fd560,_0x390ecd);DashboardItemEvents['on'](_0x4fd560,_0xe1d07a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index eb128af..fa712b0 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 _0x9c5a=['delete','isAuthenticated','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','show','post','put','update'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0xc8f2c3,_0x3c38cc){_0xc8f2c3=_0xc8f2c3-0x0;var _0x406b72=_0x9c5a[_0xc8f2c3];return _0x406b72;};'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'](_0xa9c5('0x8'),auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa9c5('0xb')](_0xa9c5('0x8'),auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0xd')]('/:id',auth[_0xa9c5('0xe')](),controller[_0xa9c5('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf2ca=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1840b1,_0x2d021e){_0x1840b1=_0x1840b1-0x0;var _0x54ee73=_0xf2ca[_0x1840b1];return _0x54ee73;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get'](_0xaf2c('0x9'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0xa')](),controller['update']);router[_0xaf2c('0xf')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x10')]);module[_0xaf2c('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 13799e8..cb443ed 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 _0xf0e0=['sequelize','exports','ENUM','first','second','third','STRING'];(function(_0x5655d9,_0x2efed0){var _0x47bf07=function(_0x1d8e2b){while(--_0x1d8e2b){_0x5655d9['push'](_0x5655d9['shift']());}};_0x47bf07(++_0x2efed0);}(_0xf0e0,0x12d));var _0x0f0e=function(_0x15ff8c,_0x101228){_0x15ff8c=_0x15ff8c-0x0;var _0x35b73d=_0xf0e0[_0x15ff8c];return _0x35b73d;};'use strict';var Sequelize=require(_0x0f0e('0x0'));module[_0x0f0e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x0f0e('0x2')](_0x0f0e('0x3'),_0x0f0e('0x4'),_0x0f0e('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x0f0e('0x6')]}}; \ No newline at end of file +var _0xe646=['exports','first','third'];(function(_0x3d3ad8,_0x32e427){var _0x3ed58f=function(_0x249760){while(--_0x249760){_0x3d3ad8['push'](_0x3d3ad8['shift']());}};_0x3ed58f(++_0x32e427);}(_0xe646,0x99));var _0x6e64=function(_0x3d0a9d,_0xd3e6e2){_0x3d0a9d=_0x3d0a9d-0x0;var _0x21c397=_0xe646[_0x3d0a9d];return _0x21c397;};'use strict';var Sequelize=require('sequelize');module[_0x6e64('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x6e64('0x1'),'second',_0x6e64('0x2')),'allowNull':![],'defaultValue':_0x6e64('0x1')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 10bf4bc..3f84605 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 _0x8c44=['filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Dispositions','UserProfileResource','error','stack','name','send','map','Disposition','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick'];(function(_0x4e8b6f,_0x2a40eb){var _0x2d5e9c=function(_0x4a6f14){while(--_0x4a6f14){_0x4e8b6f['push'](_0x4e8b6f['shift']());}};_0x2d5e9c(++_0x2a40eb);}(_0x8c44,0x1b5));var _0x48c4=function(_0x558a01,_0x5239e3){_0x558a01=_0x558a01-0x0;var _0x319bb8=_0x8c44[_0x558a01];return _0x319bb8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x48c4('0x0'));var rimraf=require(_0x48c4('0x1'));var zipdir=require(_0x48c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48c4('0x3'));var moment=require(_0x48c4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x48c4('0x5'));var path=require(_0x48c4('0x6'));var sox=require(_0x48c4('0x7'));var csv=require(_0x48c4('0x8'));var ejs=require(_0x48c4('0x9'));var fs=require('fs');var _=require(_0x48c4('0xa'));var squel=require(_0x48c4('0xb'));var crypto=require(_0x48c4('0xc'));var jsforce=require(_0x48c4('0xd'));var deskjs=require(_0x48c4('0xe'));var toCsv=require(_0x48c4('0x8'));var querystring=require(_0x48c4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x48c4('0x10'));var as=require(_0x48c4('0x11'));var hardwareService=require(_0x48c4('0x12'));var logger=require(_0x48c4('0x13'))(_0x48c4('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x48c4('0x15'));var db=require(_0x48c4('0x16'))['db'];function respondWithStatusCode(_0x142e26,_0x2f2627){_0x2f2627=_0x2f2627||0xcc;return function(_0x2273f6){if(_0x2273f6){return _0x142e26[_0x48c4('0x17')](_0x2f2627);}return _0x142e26[_0x48c4('0x18')](_0x2f2627)[_0x48c4('0x19')]();};}function respondWithResult(_0x13e6ba,_0x2329bd){_0x2329bd=_0x2329bd||0xc8;return function(_0x3e4999){if(_0x3e4999){return _0x13e6ba[_0x48c4('0x18')](_0x2329bd)[_0x48c4('0x1a')](_0x3e4999);}};}function respondWithFilteredResult(_0x12dd91,_0x3c2837){return function(_0x2980e4){if(_0x2980e4){var _0x4dd819=_0x2980e4['count'],_0x3d9481=_0x3c2837[_0x48c4('0x1b')],_0x45f5bf=_0x3c2837[_0x48c4('0x1b')]+_0x3c2837[_0x48c4('0x1c')],_0x51be62;if(_0x45f5bf>=_0x4dd819){_0x45f5bf=_0x4dd819;_0x51be62=0xc8;}else{_0x51be62=0xce;}_0x12dd91['status'](_0x51be62);return _0x12dd91[_0x48c4('0x1d')](_0x48c4('0x1e'),_0x3d9481+'-'+_0x45f5bf+'/'+_0x4dd819)[_0x48c4('0x1a')](_0x2980e4);}return null;};}function patchUpdates(_0x310d0e){return function(_0x4f267b){try{jsonpatch[_0x48c4('0x1f')](_0x4f267b,_0x310d0e,!![]);}catch(_0x398a1c){return BPromise[_0x48c4('0x20')](_0x398a1c);}return _0x4f267b[_0x48c4('0x21')]();};}function saveUpdates(_0x54e087,_0x478043){return function(_0x2cf19f){if(_0x2cf19f){return _0x2cf19f[_0x48c4('0x22')](_0x54e087)['then'](function(_0xa36302){return _0xa36302;});}return null;};}function removeEntity(_0x568ddb,_0x118acd){return function(_0x151faa){if(_0x151faa){return _0x151faa[_0x48c4('0x23')]()[_0x48c4('0x24')](function(){var _0x55c4bd=_0x151faa[_0x48c4('0x25')]({'plain':!![]});var _0x3a7ad7=_0x48c4('0x26');return db[_0x48c4('0x27')][_0x48c4('0x23')]({'where':{'type':_0x3a7ad7,'resourceId':_0x55c4bd['id']}})['then'](function(){return _0x151faa;});})[_0x48c4('0x24')](function(){_0x568ddb[_0x48c4('0x18')](0xcc)[_0x48c4('0x19')]();});}};}function handleEntityNotFound(_0x2c4eb3,_0x1a2785){return function(_0x497a9f){if(!_0x497a9f){_0x2c4eb3[_0x48c4('0x17')](0x194);}return _0x497a9f;};}function handleError(_0x449bbe,_0x1c25d9){_0x1c25d9=_0x1c25d9||0x1f4;return function(_0x58e0e5){logger[_0x48c4('0x28')](_0x58e0e5[_0x48c4('0x29')]);if(_0x58e0e5[_0x48c4('0x2a')]){delete _0x58e0e5[_0x48c4('0x2a')];}_0x449bbe[_0x48c4('0x18')](_0x1c25d9)[_0x48c4('0x2b')](_0x58e0e5);};}exports['index']=function(_0x399917,_0x6ffd){var _0x3ae6cd={},_0x2a380c={},_0x5a4607={'count':0x0,'rows':[]};var _0x371674=_[_0x48c4('0x2c')](db[_0x48c4('0x2d')]['rawAttributes'],function(_0x2c3e7c){return{'name':_0x2c3e7c[_0x48c4('0x2e')],'type':_0x2c3e7c[_0x48c4('0x2f')]['key']};});_0x2a380c[_0x48c4('0x30')]=_[_0x48c4('0x2c')](_0x371674,_0x48c4('0x2a'));_0x2a380c[_0x48c4('0x31')]=_[_0x48c4('0x32')](_0x399917['query']);_0x2a380c['filters']=_[_0x48c4('0x33')](_0x2a380c[_0x48c4('0x30')],_0x2a380c[_0x48c4('0x31')]);_0x3ae6cd[_0x48c4('0x34')]=_['intersection'](_0x2a380c[_0x48c4('0x30')],qs[_0x48c4('0x35')](_0x399917['query']['fields']));_0x3ae6cd['attributes']=_0x3ae6cd[_0x48c4('0x34')][_0x48c4('0x36')]?_0x3ae6cd[_0x48c4('0x34')]:_0x2a380c[_0x48c4('0x30')];if(!_0x399917[_0x48c4('0x31')][_0x48c4('0x37')]('nolimit')){_0x3ae6cd[_0x48c4('0x1c')]=qs['limit'](_0x399917['query'][_0x48c4('0x1c')]);_0x3ae6cd[_0x48c4('0x1b')]=qs[_0x48c4('0x1b')](_0x399917['query'][_0x48c4('0x1b')]);}_0x3ae6cd[_0x48c4('0x38')]=qs[_0x48c4('0x39')](_0x399917[_0x48c4('0x31')][_0x48c4('0x39')]);_0x3ae6cd[_0x48c4('0x3a')]=qs[_0x48c4('0x3b')](_[_0x48c4('0x3c')](_0x399917[_0x48c4('0x31')],_0x2a380c['filters']),_0x371674);if(_0x399917[_0x48c4('0x31')][_0x48c4('0x3d')]){_0x3ae6cd[_0x48c4('0x3a')]=_[_0x48c4('0x3e')](_0x3ae6cd[_0x48c4('0x3a')],{'$or':_[_0x48c4('0x2c')](_0x371674,function(_0x44af46){if(_0x44af46[_0x48c4('0x2f')]!==_0x48c4('0x3f')){var _0x1ed057={};_0x1ed057[_0x44af46[_0x48c4('0x2a')]]={'$like':'%'+_0x399917[_0x48c4('0x31')]['filter']+'%'};return _0x1ed057;}})});}_0x3ae6cd=_['merge']({},_0x3ae6cd,_0x399917[_0x48c4('0x40')]);var _0x9e5cf1={'where':_0x3ae6cd[_0x48c4('0x3a')]};return db[_0x48c4('0x2d')][_0x48c4('0x41')](_0x9e5cf1)[_0x48c4('0x24')](function(_0x25d3c4){_0x5a4607['count']=_0x25d3c4;if(_0x399917[_0x48c4('0x31')][_0x48c4('0x42')]){_0x3ae6cd[_0x48c4('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x48c4('0x44')](_0x3ae6cd);})[_0x48c4('0x24')](function(_0x5c42af){_0x5a4607[_0x48c4('0x45')]=_0x5c42af;return _0x5a4607;})['then'](respondWithFilteredResult(_0x6ffd,_0x3ae6cd))['catch'](handleError(_0x6ffd,null));};exports[_0x48c4('0x46')]=function(_0x36d855,_0x53cd5b){var _0x30a183={'raw':!![],'where':{'id':_0x36d855[_0x48c4('0x47')]['id']}},_0x28bbdb={};_0x28bbdb['model']=_[_0x48c4('0x32')](db['Disposition']['rawAttributes']);_0x28bbdb[_0x48c4('0x31')]=_[_0x48c4('0x32')](_0x36d855[_0x48c4('0x31')]);_0x28bbdb[_0x48c4('0x3b')]=_[_0x48c4('0x33')](_0x28bbdb[_0x48c4('0x30')],_0x28bbdb[_0x48c4('0x31')]);_0x30a183[_0x48c4('0x34')]=_[_0x48c4('0x33')](_0x28bbdb[_0x48c4('0x30')],qs[_0x48c4('0x35')](_0x36d855['query'][_0x48c4('0x35')]));_0x30a183[_0x48c4('0x34')]=_0x30a183[_0x48c4('0x34')][_0x48c4('0x36')]?_0x30a183['attributes']:_0x28bbdb[_0x48c4('0x30')];if(_0x36d855[_0x48c4('0x31')][_0x48c4('0x42')]){_0x30a183[_0x48c4('0x43')]=[{'all':!![]}];}_0x30a183=_['merge']({},_0x30a183,_0x36d855['options']);return db['Disposition']['find'](_0x30a183)[_0x48c4('0x24')](handleEntityNotFound(_0x53cd5b,null))[_0x48c4('0x24')](respondWithResult(_0x53cd5b,null))[_0x48c4('0x48')](handleError(_0x53cd5b,null));};exports['create']=function(_0x15d8e9,_0x2d557f){return db[_0x48c4('0x2d')][_0x48c4('0x49')](_0x15d8e9['body'],{})[_0x48c4('0x24')](function(_0x5616c1){var _0x48c3b8=_0x15d8e9[_0x48c4('0x4a')][_0x48c4('0x25')]({'plain':!![]});if(!_0x48c3b8)throw new Error(_0x48c4('0x4b'));if(_0x48c3b8[_0x48c4('0x4c')]===_0x48c4('0x4a')){var _0x5a1038=_0x5616c1['get']({'plain':!![]});var _0x36e596=_0x48c4('0x26');return db[_0x48c4('0x4d')][_0x48c4('0x4e')]({'where':{'name':_0x36e596,'userProfileId':_0x48c3b8[_0x48c4('0x4f')]},'raw':!![]})[_0x48c4('0x24')](function(_0x3c4a67){if(_0x3c4a67&&_0x3c4a67[_0x48c4('0x50')]===0x0){return db[_0x48c4('0x27')][_0x48c4('0x49')]({'name':_0x5a1038[_0x48c4('0x2a')],'resourceId':_0x5a1038['id'],'type':_0x3c4a67[_0x48c4('0x2a')],'sectionId':_0x3c4a67['id']},{})[_0x48c4('0x24')](function(){return _0x5616c1;});}else{return _0x5616c1;}})[_0x48c4('0x48')](function(_0x20fe9c){logger[_0x48c4('0x28')](_0x48c4('0x51'),_0x20fe9c);throw _0x20fe9c;});}return _0x5616c1;})[_0x48c4('0x24')](respondWithResult(_0x2d557f,0xc9))[_0x48c4('0x48')](handleError(_0x2d557f,null));};exports['update']=function(_0x3f6a1e,_0x2524db){if(_0x3f6a1e[_0x48c4('0x52')]['id']){delete _0x3f6a1e['body']['id'];}return db['Disposition'][_0x48c4('0x4e')]({'where':{'id':_0x3f6a1e[_0x48c4('0x47')]['id']}})[_0x48c4('0x24')](handleEntityNotFound(_0x2524db,null))[_0x48c4('0x24')](saveUpdates(_0x3f6a1e[_0x48c4('0x52')],null))[_0x48c4('0x24')](respondWithResult(_0x2524db,null))[_0x48c4('0x48')](handleError(_0x2524db,null));};exports['destroy']=function(_0x2e629c,_0x52fdeb){return db[_0x48c4('0x2d')][_0x48c4('0x4e')]({'where':{'id':_0x2e629c[_0x48c4('0x47')]['id']}})[_0x48c4('0x24')](handleEntityNotFound(_0x52fdeb,null))[_0x48c4('0x24')](removeEntity(_0x52fdeb,null))['catch'](handleError(_0x52fdeb,null));}; \ No newline at end of file +var _0x8849=['map','Disposition','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','then','get','Dispositions','destroy','error','name','send','index'];(function(_0x38d9db,_0x1e9619){var _0x5ca842=function(_0x36cd38){while(--_0x36cd38){_0x38d9db['push'](_0x38d9db['shift']());}};_0x5ca842(++_0x1e9619);}(_0x8849,0xc7));var _0x9884=function(_0x91b45c,_0x22e5a6){_0x91b45c=_0x91b45c-0x0;var _0x1ca745=_0x8849[_0x91b45c];return _0x1ca745;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9884('0x0'));var zipdir=require(_0x9884('0x1'));var jsonpatch=require(_0x9884('0x2'));var rp=require(_0x9884('0x3'));var moment=require('moment');var BPromise=require(_0x9884('0x4'));var Mustache=require(_0x9884('0x5'));var util=require('util');var path=require(_0x9884('0x6'));var sox=require(_0x9884('0x7'));var csv=require(_0x9884('0x8'));var ejs=require(_0x9884('0x9'));var fs=require('fs');var _=require(_0x9884('0xa'));var squel=require(_0x9884('0xb'));var crypto=require(_0x9884('0xc'));var jsforce=require(_0x9884('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9884('0x8'));var querystring=require(_0x9884('0xe'));var Papa=require(_0x9884('0xf'));var Redis=require(_0x9884('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9884('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9884('0x12'));var logger=require(_0x9884('0x13'))(_0x9884('0x14'));var utils=require(_0x9884('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9884('0x16'));var db=require(_0x9884('0x17'))['db'];function respondWithStatusCode(_0x44755a,_0x34f67a){_0x34f67a=_0x34f67a||0xcc;return function(_0x57a822){if(_0x57a822){return _0x44755a[_0x9884('0x18')](_0x34f67a);}return _0x44755a[_0x9884('0x19')](_0x34f67a)[_0x9884('0x1a')]();};}function respondWithResult(_0x3edbff,_0x5096f0){_0x5096f0=_0x5096f0||0xc8;return function(_0x3fd7b7){if(_0x3fd7b7){return _0x3edbff[_0x9884('0x19')](_0x5096f0)[_0x9884('0x1b')](_0x3fd7b7);}};}function respondWithFilteredResult(_0xc056a8,_0x3d5473){return function(_0x4eb535){if(_0x4eb535){var _0x44ff38=_0x4eb535[_0x9884('0x1c')],_0x4fed26=_0x3d5473[_0x9884('0x1d')],_0x106f88=_0x3d5473[_0x9884('0x1d')]+_0x3d5473[_0x9884('0x1e')],_0x29ee06;if(_0x106f88>=_0x44ff38){_0x106f88=_0x44ff38;_0x29ee06=0xc8;}else{_0x29ee06=0xce;}_0xc056a8[_0x9884('0x19')](_0x29ee06);return _0xc056a8[_0x9884('0x1f')]('Content-Range',_0x4fed26+'-'+_0x106f88+'/'+_0x44ff38)['json'](_0x4eb535);}return null;};}function patchUpdates(_0x18bbd5){return function(_0x388462){try{jsonpatch['apply'](_0x388462,_0x18bbd5,!![]);}catch(_0x25aa20){return BPromise['reject'](_0x25aa20);}return _0x388462[_0x9884('0x20')]();};}function saveUpdates(_0x2ac54e,_0x4a56c6){return function(_0x6f723f){if(_0x6f723f){return _0x6f723f['update'](_0x2ac54e)['then'](function(_0x2f49cf){return _0x2f49cf;});}return null;};}function removeEntity(_0x2d8cb2,_0x793c19){return function(_0x2887bd){if(_0x2887bd){return _0x2887bd['destroy']()[_0x9884('0x21')](function(){var _0x100029=_0x2887bd[_0x9884('0x22')]({'plain':!![]});var _0x487159=_0x9884('0x23');return db['UserProfileResource'][_0x9884('0x24')]({'where':{'type':_0x487159,'resourceId':_0x100029['id']}})[_0x9884('0x21')](function(){return _0x2887bd;});})[_0x9884('0x21')](function(){_0x2d8cb2[_0x9884('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cd720,_0x1fa474){return function(_0x313621){if(!_0x313621){_0x2cd720['sendStatus'](0x194);}return _0x313621;};}function handleError(_0x1557ea,_0x12ebb8){_0x12ebb8=_0x12ebb8||0x1f4;return function(_0x3f39ad){logger[_0x9884('0x25')](_0x3f39ad['stack']);if(_0x3f39ad[_0x9884('0x26')]){delete _0x3f39ad[_0x9884('0x26')];}_0x1557ea[_0x9884('0x19')](_0x12ebb8)[_0x9884('0x27')](_0x3f39ad);};}exports[_0x9884('0x28')]=function(_0x49f9be,_0x5ce3db){var _0x420144={},_0x268859={},_0xe5bfde={'count':0x0,'rows':[]};var _0x9de65c=_[_0x9884('0x29')](db[_0x9884('0x2a')]['rawAttributes'],function(_0x4fe556){return{'name':_0x4fe556['fieldName'],'type':_0x4fe556['type'][_0x9884('0x2b')]};});_0x268859[_0x9884('0x2c')]=_['map'](_0x9de65c,_0x9884('0x26'));_0x268859['query']=_['keys'](_0x49f9be[_0x9884('0x2d')]);_0x268859[_0x9884('0x2e')]=_[_0x9884('0x2f')](_0x268859[_0x9884('0x2c')],_0x268859[_0x9884('0x2d')]);_0x420144[_0x9884('0x30')]=_['intersection'](_0x268859[_0x9884('0x2c')],qs[_0x9884('0x31')](_0x49f9be[_0x9884('0x2d')][_0x9884('0x31')]));_0x420144[_0x9884('0x30')]=_0x420144[_0x9884('0x30')][_0x9884('0x32')]?_0x420144[_0x9884('0x30')]:_0x268859[_0x9884('0x2c')];if(!_0x49f9be[_0x9884('0x2d')][_0x9884('0x33')](_0x9884('0x34'))){_0x420144['limit']=qs[_0x9884('0x1e')](_0x49f9be[_0x9884('0x2d')][_0x9884('0x1e')]);_0x420144[_0x9884('0x1d')]=qs[_0x9884('0x1d')](_0x49f9be[_0x9884('0x2d')][_0x9884('0x1d')]);}_0x420144[_0x9884('0x35')]=qs[_0x9884('0x36')](_0x49f9be['query']['sort']);_0x420144['where']=qs[_0x9884('0x2e')](_[_0x9884('0x37')](_0x49f9be[_0x9884('0x2d')],_0x268859['filters']),_0x9de65c);if(_0x49f9be[_0x9884('0x2d')][_0x9884('0x38')]){_0x420144[_0x9884('0x39')]=_[_0x9884('0x3a')](_0x420144[_0x9884('0x39')],{'$or':_[_0x9884('0x29')](_0x9de65c,function(_0x2fb3d0){if(_0x2fb3d0[_0x9884('0x3b')]!==_0x9884('0x3c')){var _0x28efd6={};_0x28efd6[_0x2fb3d0[_0x9884('0x26')]]={'$like':'%'+_0x49f9be['query'][_0x9884('0x38')]+'%'};return _0x28efd6;}})});}_0x420144=_[_0x9884('0x3a')]({},_0x420144,_0x49f9be[_0x9884('0x3d')]);var _0x18a2db={'where':_0x420144[_0x9884('0x39')]};return db[_0x9884('0x2a')]['count'](_0x18a2db)[_0x9884('0x21')](function(_0x11cd84){_0xe5bfde[_0x9884('0x1c')]=_0x11cd84;if(_0x49f9be[_0x9884('0x2d')][_0x9884('0x3e')]){_0x420144[_0x9884('0x3f')]=[{'all':!![]}];}return db['Disposition'][_0x9884('0x40')](_0x420144);})[_0x9884('0x21')](function(_0x4c5093){_0xe5bfde[_0x9884('0x41')]=_0x4c5093;return _0xe5bfde;})[_0x9884('0x21')](respondWithFilteredResult(_0x5ce3db,_0x420144))[_0x9884('0x42')](handleError(_0x5ce3db,null));};exports['show']=function(_0x5b7230,_0x1f446c){var _0x3829a2={'raw':!![],'where':{'id':_0x5b7230[_0x9884('0x43')]['id']}},_0x196e64={};_0x196e64[_0x9884('0x2c')]=_[_0x9884('0x44')](db['Disposition'][_0x9884('0x45')]);_0x196e64['query']=_['keys'](_0x5b7230[_0x9884('0x2d')]);_0x196e64['filters']=_[_0x9884('0x2f')](_0x196e64[_0x9884('0x2c')],_0x196e64['query']);_0x3829a2[_0x9884('0x30')]=_[_0x9884('0x2f')](_0x196e64[_0x9884('0x2c')],qs[_0x9884('0x31')](_0x5b7230[_0x9884('0x2d')][_0x9884('0x31')]));_0x3829a2['attributes']=_0x3829a2[_0x9884('0x30')][_0x9884('0x32')]?_0x3829a2['attributes']:_0x196e64[_0x9884('0x2c')];if(_0x5b7230[_0x9884('0x2d')][_0x9884('0x3e')]){_0x3829a2[_0x9884('0x3f')]=[{'all':!![]}];}_0x3829a2=_['merge']({},_0x3829a2,_0x5b7230['options']);return db[_0x9884('0x2a')][_0x9884('0x46')](_0x3829a2)[_0x9884('0x21')](handleEntityNotFound(_0x1f446c,null))[_0x9884('0x21')](respondWithResult(_0x1f446c,null))[_0x9884('0x42')](handleError(_0x1f446c,null));};exports['create']=function(_0x43a3cf,_0x4453e0){return db[_0x9884('0x2a')][_0x9884('0x47')](_0x43a3cf[_0x9884('0x48')],{})['then'](function(_0x2356b0){var _0x3f5744=_0x43a3cf['user']['get']({'plain':!![]});if(!_0x3f5744)throw new Error(_0x9884('0x49'));if(_0x3f5744[_0x9884('0x4a')]==='user'){var _0x4d5f6c=_0x2356b0[_0x9884('0x22')]({'plain':!![]});var _0x2f9c77=_0x9884('0x23');return db[_0x9884('0x4b')][_0x9884('0x46')]({'where':{'name':_0x2f9c77,'userProfileId':_0x3f5744[_0x9884('0x4c')]},'raw':!![]})[_0x9884('0x21')](function(_0x3a87b9){if(_0x3a87b9&&_0x3a87b9['autoAssociation']===0x0){return db[_0x9884('0x4d')]['create']({'name':_0x4d5f6c[_0x9884('0x26')],'resourceId':_0x4d5f6c['id'],'type':_0x3a87b9[_0x9884('0x26')],'sectionId':_0x3a87b9['id']},{})[_0x9884('0x21')](function(){return _0x2356b0;});}else{return _0x2356b0;}})[_0x9884('0x42')](function(_0x56fec3){logger[_0x9884('0x25')](_0x9884('0x4e'),_0x56fec3);throw _0x56fec3;});}return _0x2356b0;})[_0x9884('0x21')](respondWithResult(_0x4453e0,0xc9))[_0x9884('0x42')](handleError(_0x4453e0,null));};exports[_0x9884('0x4f')]=function(_0x37ee8,_0x517182){if(_0x37ee8[_0x9884('0x48')]['id']){delete _0x37ee8['body']['id'];}return db['Disposition'][_0x9884('0x46')]({'where':{'id':_0x37ee8[_0x9884('0x43')]['id']}})['then'](handleEntityNotFound(_0x517182,null))[_0x9884('0x21')](saveUpdates(_0x37ee8[_0x9884('0x48')],null))[_0x9884('0x21')](respondWithResult(_0x517182,null))['catch'](handleError(_0x517182,null));};exports[_0x9884('0x24')]=function(_0x357688,_0x1b6c5c){return db['Disposition'][_0x9884('0x46')]({'where':{'id':_0x357688['params']['id']}})['then'](handleEntityNotFound(_0x1b6c5c,null))[_0x9884('0x21')](removeEntity(_0x1b6c5c,null))[_0x9884('0x42')](handleError(_0x1b6c5c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 86fb8d3..2427ca8 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 _0x36c3=['define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x36c3,0x1a6));var _0x336c=function(_0x34a4fd,_0x5c07f2){_0x34a4fd=_0x34a4fd-0x0;var _0xf89bcb=_0x36c3[_0x34a4fd];return _0xf89bcb;};'use strict';var _=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var logger=require('../../config/logger')(_0x336c('0x2'));var moment=require(_0x336c('0x3'));var BPromise=require(_0x336c('0x4'));var rp=require(_0x336c('0x5'));var fs=require('fs');var path=require(_0x336c('0x6'));var rimraf=require(_0x336c('0x7'));var config=require(_0x336c('0x8'));var attributes=require('./disposition.attributes');module[_0x336c('0x9')]=function(_0x2e0016,_0x2097a8){return _0x2e0016[_0x336c('0xa')](_0x336c('0xb'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x336c('0xc'),'fields':[_0x336c('0xd'),_0x336c('0xe')]},{'unique':!![],'name':_0x336c('0xf'),'fields':[_0x336c('0xd'),_0x336c('0x10')]},{'unique':!![],'name':_0x336c('0x11'),'fields':[_0x336c('0xd'),_0x336c('0x12')]},{'unique':!![],'name':_0x336c('0x13'),'fields':[_0x336c('0xd'),_0x336c('0x14')]},{'unique':!![],'name':_0x336c('0x15'),'fields':[_0x336c('0xd'),_0x336c('0x16')]},{'unique':!![],'name':_0x336c('0x17'),'fields':[_0x336c('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x336c('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f9f=['name_chat','ChatWebsiteId','name_mail','name','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','Disposition','tools_dispositions','name_voice','ListId'];(function(_0x3b6a5a,_0x31e12c){var _0x20381a=function(_0x39a504){while(--_0x39a504){_0x3b6a5a['push'](_0x3b6a5a['shift']());}};_0x20381a(++_0x31e12c);}(_0x0f9f,0xae));var _0xf0f9=function(_0x2c73c6,_0x28332b){_0x2c73c6=_0x2c73c6-0x0;var _0x2e203c=_0x0f9f[_0x2c73c6];return _0x2e203c;};'use strict';var _=require(_0xf0f9('0x0'));var util=require(_0xf0f9('0x1'));var logger=require(_0xf0f9('0x2'))(_0xf0f9('0x3'));var moment=require(_0xf0f9('0x4'));var BPromise=require(_0xf0f9('0x5'));var rp=require(_0xf0f9('0x6'));var fs=require('fs');var path=require(_0xf0f9('0x7'));var rimraf=require(_0xf0f9('0x8'));var config=require(_0xf0f9('0x9'));var attributes=require(_0xf0f9('0xa'));module['exports']=function(_0xcc39d6,_0x4540a2){return _0xcc39d6['define'](_0xf0f9('0xb'),attributes,{'tableName':_0xf0f9('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xf0f9('0xd'),'fields':['name',_0xf0f9('0xe')]},{'unique':!![],'name':_0xf0f9('0xf'),'fields':['name',_0xf0f9('0x10')]},{'unique':!![],'name':_0xf0f9('0x11'),'fields':[_0xf0f9('0x12'),_0xf0f9('0x13')]},{'unique':!![],'name':_0xf0f9('0x14'),'fields':[_0xf0f9('0x12'),_0xf0f9('0x15')]},{'unique':!![],'name':_0xf0f9('0x16'),'fields':['name',_0xf0f9('0x17')]},{'unique':!![],'name':_0xf0f9('0x18'),'fields':[_0xf0f9('0x12'),_0xf0f9('0x19')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xf0f9('0x12'),_0xf0f9('0x1a')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index aa35ee8..898edf1 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 _0x77c8=['request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77c8,0xb2));var _0x877c=function(_0x5dee2a,_0x47d02a){_0x5dee2a=_0x5dee2a-0x0;var _0x31e98e=_0x77c8[_0x5dee2a];return _0x31e98e;};'use strict';var _=require(_0x877c('0x0'));var util=require(_0x877c('0x1'));var moment=require('moment');var BPromise=require(_0x877c('0x2'));var rs=require(_0x877c('0x3'));var fs=require('fs');var Redis=require(_0x877c('0x4'));var db=require(_0x877c('0x5'))['db'];var utils=require(_0x877c('0x6'));var logger=require(_0x877c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x877c('0x8'));var client=jayson[_0x877c('0x9')][_0x877c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8157b7,_0x191334,_0xcfbce8){return new BPromise(function(_0x840f95,_0x17e95d){return client['request'](_0x8157b7,_0xcfbce8)[_0x877c('0xb')](function(_0x545b63){logger[_0x877c('0xc')](_0x877c('0xd'),_0x191334,'request\x20sent');logger[_0x877c('0xe')](_0x877c('0xf'),_0x191334,'request\x20sent',JSON[_0x877c('0x10')](_0x545b63));if(_0x545b63[_0x877c('0x11')]){if(_0x545b63[_0x877c('0x11')][_0x877c('0x12')]===0x1f4){logger[_0x877c('0x11')]('Disposition,\x20%s,\x20%s',_0x191334,_0x545b63['error'][_0x877c('0x13')]);return _0x17e95d(_0x545b63['error'][_0x877c('0x13')]);}logger['error'](_0x877c('0xd'),_0x191334,_0x545b63[_0x877c('0x11')][_0x877c('0x13')]);return _0x840f95(_0x545b63[_0x877c('0x11')][_0x877c('0x13')]);}else{logger[_0x877c('0xc')](_0x877c('0xd'),_0x191334,_0x877c('0x14'));_0x840f95(_0x545b63['result'][_0x877c('0x13')]);}})[_0x877c('0x15')](function(_0x5f31c1){logger[_0x877c('0x11')](_0x877c('0xd'),_0x191334,_0x5f31c1);_0x17e95d(_0x5f31c1);});});} \ No newline at end of file +var _0xa573=['info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x15f308,_0x3299da){var _0x552e29=function(_0x271f1c){while(--_0x271f1c){_0x15f308['push'](_0x15f308['shift']());}};_0x552e29(++_0x3299da);}(_0xa573,0x191));var _0x3a57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3a57('0x0'));var moment=require(_0x3a57('0x1'));var BPromise=require(_0x3a57('0x2'));var rs=require(_0x3a57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a57('0x4'))['db'];var utils=require(_0x3a57('0x5'));var logger=require(_0x3a57('0x6'))(_0x3a57('0x7'));var config=require('../../config/environment');var jayson=require(_0x3a57('0x8'));var client=jayson[_0x3a57('0x9')][_0x3a57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x216d1e,_0x59f2a8,_0xc04d1a){return new BPromise(function(_0x3af4a8,_0x17514c){return client[_0x3a57('0xb')](_0x216d1e,_0xc04d1a)[_0x3a57('0xc')](function(_0x44d0c9){logger[_0x3a57('0xd')](_0x3a57('0xe'),_0x59f2a8,_0x3a57('0xf'));logger[_0x3a57('0x10')](_0x3a57('0x11'),_0x59f2a8,_0x3a57('0xf'),JSON[_0x3a57('0x12')](_0x44d0c9));if(_0x44d0c9[_0x3a57('0x13')]){if(_0x44d0c9[_0x3a57('0x13')][_0x3a57('0x14')]===0x1f4){logger['error'](_0x3a57('0xe'),_0x59f2a8,_0x44d0c9[_0x3a57('0x13')][_0x3a57('0x15')]);return _0x17514c(_0x44d0c9[_0x3a57('0x13')][_0x3a57('0x15')]);}logger[_0x3a57('0x13')](_0x3a57('0xe'),_0x59f2a8,_0x44d0c9[_0x3a57('0x13')][_0x3a57('0x15')]);return _0x3af4a8(_0x44d0c9[_0x3a57('0x13')]['message']);}else{logger[_0x3a57('0xd')]('Disposition,\x20%s,\x20%s',_0x59f2a8,_0x3a57('0xf'));_0x3af4a8(_0x44d0c9['result'][_0x3a57('0x15')]);}})[_0x3a57('0x16')](function(_0x3cfab1){logger['error'](_0x3a57('0xe'),_0x59f2a8,_0x3cfab1);_0x17514c(_0x3cfab1);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 289221d..d456b4c 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 _0x2a75=['../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2a75,0x1f2));var _0x52a7=function(_0x102e61,_0xff5f62){_0x102e61=_0x102e61-0x0;var _0x2fe8bc=_0x2a75[_0x102e61];return _0x2fe8bc;};'use strict';var multer=require(_0x52a7('0x0'));var util=require(_0x52a7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x52a7('0x2'));var router=express[_0x52a7('0x3')]();var auth=require(_0x52a7('0x4'));var interaction=require(_0x52a7('0x5'));var config=require(_0x52a7('0x6'));var controller=require(_0x52a7('0x7'));router[_0x52a7('0x8')]('/',auth[_0x52a7('0x9')](),controller[_0x52a7('0xa')]);router[_0x52a7('0x8')](_0x52a7('0xb'),auth[_0x52a7('0x9')](),controller[_0x52a7('0xc')]);router[_0x52a7('0xd')]('/',auth['isAuthenticated'](),controller[_0x52a7('0xe')]);router[_0x52a7('0xf')](_0x52a7('0xb'),auth[_0x52a7('0x9')](),controller[_0x52a7('0x10')]);router[_0x52a7('0x11')](_0x52a7('0xb'),auth[_0x52a7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3b9d=['/:id','show','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0xe704ea,_0xc73e4b){var _0x1e7480=function(_0x2fc09a){while(--_0x2fc09a){_0xe704ea['push'](_0xe704ea['shift']());}};_0x1e7480(++_0xc73e4b);}(_0x3b9d,0x9e));var _0xd3b9=function(_0x270f49,_0x76bc58){_0x270f49=_0x270f49-0x0;var _0x4eebba=_0x3b9d[_0x270f49];return _0x4eebba;};'use strict';var multer=require(_0xd3b9('0x0'));var util=require(_0xd3b9('0x1'));var path=require(_0xd3b9('0x2'));var timeout=require(_0xd3b9('0x3'));var express=require(_0xd3b9('0x4'));var router=express[_0xd3b9('0x5')]();var auth=require(_0xd3b9('0x6'));var interaction=require(_0xd3b9('0x7'));var config=require(_0xd3b9('0x8'));var controller=require('./disposition.controller');router[_0xd3b9('0x9')]('/',auth[_0xd3b9('0xa')](),controller[_0xd3b9('0xb')]);router[_0xd3b9('0x9')](_0xd3b9('0xc'),auth[_0xd3b9('0xa')](),controller[_0xd3b9('0xd')]);router['post']('/',auth[_0xd3b9('0xa')](),controller['create']);router['put'](_0xd3b9('0xc'),auth[_0xd3b9('0xa')](),controller[_0xd3b9('0xe')]);router['delete']('/:id',auth[_0xd3b9('0xa')](),controller[_0xd3b9('0xf')]);module[_0xd3b9('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 1ba6fcd..8270a93 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 _0xa85c=['v17,v27,v29','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa85c,0x79));var _0xca85=function(_0x533132,_0xf5b6fa){_0x533132=_0x533132-0x0;var _0x1a7447=_0xa85c[_0x533132];return _0x1a7447;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xca85('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xca85('0x0')]},'ecm':{'type':Sequelize[_0xca85('0x1')](_0xca85('0x2'),'no'),'defaultValue':_0xca85('0x2')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xca85('0x3')},'localstationid':{'type':Sequelize[_0xca85('0x0')],'unique':_0xca85('0x4')},'minrate':{'type':Sequelize[_0xca85('0x1')](_0xca85('0x5'),_0xca85('0x6'),_0xca85('0x7'),_0xca85('0x8'),_0xca85('0x9'),_0xca85('0xa')),'defaultValue':_0xca85('0x6')},'maxrate':{'type':Sequelize[_0xca85('0x1')](_0xca85('0x5'),_0xca85('0x6'),_0xca85('0x7'),_0xca85('0x8'),_0xca85('0x9'),_0xca85('0xa')),'defaultValue':_0xca85('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xca85('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xca85('0x1')](_0xca85('0xc'),_0xca85('0xd'),'DADHI',_0xca85('0xe')),'defaultValue':_0xca85('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xca85('0xf')],'defaultValue':function(){return _0xca85('0x10');}},'notificationSound':{'type':Sequelize[_0xca85('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xca85('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xca85('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xca85('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xca85('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xca85('0x12')],'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[_0xca85('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x24b319){if(!_0x24b319)this[_0xca85('0x13')](_0xca85('0x14'),null);this[_0xca85('0x13')](_0xca85('0x15'),_0x24b319);}}}; \ No newline at end of file +var _0x6fcf=['sequelize','STRING','ENUM','yes','localstationid','2400','12000','14400','4800','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','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','mandatoryDispositionPauseId','setDataValue'];(function(_0x4ab4e2,_0x4dba4d){var _0x13e529=function(_0x5359ba){while(--_0x5359ba){_0x4ab4e2['push'](_0x4ab4e2['shift']());}};_0x13e529(++_0x4dba4d);}(_0x6fcf,0x6e));var _0xf6fc=function(_0x1d7599,_0x49929f){_0x1d7599=_0x1d7599-0x0;var _0x55da12=_0x6fcf[_0x1d7599];return _0x55da12;};'use strict';var Sequelize=require(_0xf6fc('0x0'));module['exports']={'name':{'type':Sequelize[_0xf6fc('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xf6fc('0x2')]('yes','no'),'defaultValue':_0xf6fc('0x3')},'headerinfo':{'type':Sequelize[_0xf6fc('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xf6fc('0x1')],'unique':_0xf6fc('0x4')},'minrate':{'type':Sequelize[_0xf6fc('0x2')](_0xf6fc('0x5'),'4800','7200','9600',_0xf6fc('0x6'),_0xf6fc('0x7')),'defaultValue':_0xf6fc('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0xf6fc('0x5'),_0xf6fc('0x8'),_0xf6fc('0x9'),'9600',_0xf6fc('0x6'),_0xf6fc('0x7')),'defaultValue':_0xf6fc('0x7')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xf6fc('0xa')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf6fc('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf6fc('0x2')](_0xf6fc('0xc'),_0xf6fc('0xd'),_0xf6fc('0xe'),_0xf6fc('0xf')),'defaultValue':_0xf6fc('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf6fc('0x10');}},'notificationSound':{'type':Sequelize[_0xf6fc('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf6fc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf6fc('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf6fc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf6fc('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf6fc('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0xf6fc('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf6fc('0x13'),'set':function(_0x15ebf8){if(!_0x15ebf8)this['setDataValue'](_0xf6fc('0x14'),null);this[_0xf6fc('0x15')]('mandatoryDisposition',_0x15ebf8);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 189e413..2bfdb14 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 _0xe107=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','get','FaxAccounts','destroy','name','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','merge','where','type','filter','options','includeAll','include','findAll','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','appdata','Answer','CDR(type)=inbound-fax','Set','gateway','maxrate','minrate','modem','t38timeout','push','FAXOPT(','Wait','/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','updateAccountApplications','VoiceExtension','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','send','CmContact','Contacts','updatedAt','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','List','defaults','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','lodash','squel','crypto','jsforce','querystring'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe107,0xb3));var _0x7e10=function(_0x2c7f30,_0x442bf2){_0x2c7f30=_0x2c7f30-0x0;var _0x383861=_0xe107[_0x2c7f30];return _0x383861;};'use strict';var pdf=require(_0x7e10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7e10('0x1'));var zipdir=require(_0x7e10('0x2'));var jsonpatch=require(_0x7e10('0x3'));var rp=require('request-promise');var moment=require(_0x7e10('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7e10('0x5'));var path=require(_0x7e10('0x6'));var sox=require(_0x7e10('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e10('0x8'));var squel=require(_0x7e10('0x9'));var crypto=require(_0x7e10('0xa'));var jsforce=require(_0x7e10('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7e10('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7e10('0xd'));var qs=require(_0x7e10('0xe'));var as=require(_0x7e10('0xf'));var hardwareService=require(_0x7e10('0x10'));var logger=require(_0x7e10('0x11'))('api');var utils=require(_0x7e10('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7e10('0x13'));var db=require(_0x7e10('0x14'))['db'];config[_0x7e10('0x15')]=_['defaults'](config[_0x7e10('0x15')],{'host':_0x7e10('0x16'),'port':0x18eb});var socket=require(_0x7e10('0x17'))(new Redis(config[_0x7e10('0x15')]));require(_0x7e10('0x18'))[_0x7e10('0x19')](socket);var jayson=require(_0x7e10('0x1a'));var client=jayson[_0x7e10('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x7e10('0x1b')][_0x7e10('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4bd78a,_0x48339f,_0x4f5666,_0x4b717e){return new BPromise(function(_0xe1abd2,_0x9a5619){var _0xdbda1a=_0x4b717e||client;return _0xdbda1a[_0x7e10('0x1d')](_0x4bd78a,_0x4f5666)['then'](function(_0x3208c6){logger[_0x7e10('0x1e')](_0x7e10('0x1f'),_0x48339f,'request\x20sent');logger[_0x7e10('0x20')](_0x7e10('0x21'),_0x48339f,_0x7e10('0x22'),JSON[_0x7e10('0x23')](_0x3208c6));if(_0x3208c6[_0x7e10('0x24')]){if(_0x3208c6['error'][_0x7e10('0x25')]===0x1f4){logger[_0x7e10('0x24')]('FaxAccount,\x20%s,\x20%s',_0x48339f,_0x3208c6[_0x7e10('0x24')][_0x7e10('0x26')]);return _0x9a5619(_0x3208c6[_0x7e10('0x24')][_0x7e10('0x26')]);}logger['error'](_0x7e10('0x1f'),_0x48339f,_0x3208c6[_0x7e10('0x24')][_0x7e10('0x26')]);return _0xe1abd2(_0x3208c6[_0x7e10('0x24')][_0x7e10('0x26')]);}else{logger[_0x7e10('0x1e')](_0x7e10('0x1f'),_0x48339f,_0x7e10('0x22'));_0xe1abd2(_0x3208c6['result']['message']);}})[_0x7e10('0x27')](function(_0xe34c1e){logger[_0x7e10('0x24')](_0x7e10('0x1f'),_0x48339f,_0xe34c1e);_0x9a5619(_0xe34c1e);});});}function respondWithStatusCode(_0x5d72a2,_0x537365){_0x537365=_0x537365||0xcc;return function(_0x116446){if(_0x116446){return _0x5d72a2[_0x7e10('0x28')](_0x537365);}return _0x5d72a2[_0x7e10('0x29')](_0x537365)[_0x7e10('0x2a')]();};}function respondWithResult(_0x10f93d,_0xfd3e87){_0xfd3e87=_0xfd3e87||0xc8;return function(_0x330103){if(_0x330103){return _0x10f93d[_0x7e10('0x29')](_0xfd3e87)[_0x7e10('0x2b')](_0x330103);}};}function respondWithFilteredResult(_0x3b020c,_0x5691f8){return function(_0x4e225d){if(_0x4e225d){var _0xbc509=_0x4e225d[_0x7e10('0x2c')],_0x884343=_0x5691f8[_0x7e10('0x2d')],_0x560460=_0x5691f8['offset']+_0x5691f8[_0x7e10('0x2e')],_0x5a794d;if(_0x560460>=_0xbc509){_0x560460=_0xbc509;_0x5a794d=0xc8;}else{_0x5a794d=0xce;}_0x3b020c['status'](_0x5a794d);return _0x3b020c[_0x7e10('0x2f')](_0x7e10('0x30'),_0x884343+'-'+_0x560460+'/'+_0xbc509)[_0x7e10('0x2b')](_0x4e225d);}return null;};}function patchUpdates(_0x22b1de){return function(_0x3a1239){try{jsonpatch[_0x7e10('0x31')](_0x3a1239,_0x22b1de,!![]);}catch(_0x5bba9c){return BPromise[_0x7e10('0x32')](_0x5bba9c);}return _0x3a1239['save']();};}function saveUpdates(_0xc770e4,_0x417cef){return function(_0x446b23){if(_0x446b23){return _0x446b23[_0x7e10('0x33')](_0xc770e4)[_0x7e10('0x34')](function(_0x241452){return _0x241452;});}return null;};}function removeEntity(_0x1529ae,_0x3ec4d8){return function(_0x308b0e){if(_0x308b0e){return _0x308b0e['destroy']()[_0x7e10('0x34')](function(){var _0x1b2b24=_0x308b0e[_0x7e10('0x35')]({'plain':!![]});var _0x3ca0d2=_0x7e10('0x36');return db['UserProfileResource'][_0x7e10('0x37')]({'where':{'type':_0x3ca0d2,'resourceId':_0x1b2b24['id']}})[_0x7e10('0x34')](function(){return _0x308b0e;});})[_0x7e10('0x34')](function(){_0x1529ae[_0x7e10('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498e97,_0x1238dc){return function(_0x455c1a){if(!_0x455c1a){_0x498e97[_0x7e10('0x28')](0x194);}return _0x455c1a;};}function handleError(_0x165b95,_0x5a4376){_0x5a4376=_0x5a4376||0x1f4;return function(_0x9ab8fd){logger[_0x7e10('0x24')](_0x9ab8fd['stack']);if(_0x9ab8fd[_0x7e10('0x38')]){delete _0x9ab8fd[_0x7e10('0x38')];}_0x165b95['status'](_0x5a4376)['send'](_0x9ab8fd);};}exports['index']=function(_0x2ab00b,_0x1d29ed){var _0x299c76={'include':[{'model':db[_0x7e10('0x39')],'as':_0x7e10('0x3a')}]},_0x400215={},_0xd696d2={'count':0x0,'rows':[]};var _0x419085=_['map'](db[_0x7e10('0x3b')][_0x7e10('0x3c')],function(_0x1aa13f){return{'name':_0x1aa13f[_0x7e10('0x3d')],'type':_0x1aa13f['type'][_0x7e10('0x3e')]};});_0x400215[_0x7e10('0x3f')]=_[_0x7e10('0x40')](_0x419085,_0x7e10('0x38'));_0x400215[_0x7e10('0x41')]=_[_0x7e10('0x42')](_0x2ab00b[_0x7e10('0x41')]);_0x400215['filters']=_[_0x7e10('0x43')](_0x400215[_0x7e10('0x3f')],_0x400215['query']);_0x299c76[_0x7e10('0x44')]=_[_0x7e10('0x43')](_0x400215[_0x7e10('0x3f')],qs['fields'](_0x2ab00b[_0x7e10('0x41')][_0x7e10('0x45')]));_0x299c76[_0x7e10('0x44')]=_0x299c76[_0x7e10('0x44')][_0x7e10('0x46')]?_0x299c76['attributes']:_0x400215[_0x7e10('0x3f')];if(!_0x2ab00b[_0x7e10('0x41')][_0x7e10('0x47')](_0x7e10('0x48'))){_0x299c76[_0x7e10('0x2e')]=qs['limit'](_0x2ab00b[_0x7e10('0x41')][_0x7e10('0x2e')]);_0x299c76['offset']=qs['offset'](_0x2ab00b[_0x7e10('0x41')][_0x7e10('0x2d')]);}_0x299c76['order']=qs[_0x7e10('0x49')](_0x2ab00b['query'][_0x7e10('0x49')]);_0x299c76['where']=qs[_0x7e10('0x4a')](_[_0x7e10('0x4b')](_0x2ab00b['query'],_0x400215['filters']),_0x419085);if(_0x2ab00b['query']['filter']){_0x299c76['where']=_[_0x7e10('0x4c')](_0x299c76[_0x7e10('0x4d')],{'$or':_[_0x7e10('0x40')](_0x419085,function(_0x1cb9e2){if(_0x1cb9e2[_0x7e10('0x4e')]!=='VIRTUAL'){var _0x7d6206={};_0x7d6206[_0x1cb9e2['name']]={'$like':'%'+_0x2ab00b[_0x7e10('0x41')][_0x7e10('0x4f')]+'%'};return _0x7d6206;}})});}_0x299c76=_[_0x7e10('0x4c')]({},_0x299c76,_0x2ab00b[_0x7e10('0x50')]);var _0x5be0b5={'where':_0x299c76['where']};return db[_0x7e10('0x3b')][_0x7e10('0x2c')](_0x5be0b5)['then'](function(_0x5ba2c3){_0xd696d2[_0x7e10('0x2c')]=_0x5ba2c3;if(_0x2ab00b[_0x7e10('0x41')][_0x7e10('0x51')]){_0x299c76[_0x7e10('0x52')]=[{'all':!![]}];}return db[_0x7e10('0x3b')][_0x7e10('0x53')](_0x299c76);})[_0x7e10('0x34')](function(_0x773ab8){_0xd696d2['rows']=_0x773ab8;return _0xd696d2;})[_0x7e10('0x34')](respondWithFilteredResult(_0x1d29ed,_0x299c76))['catch'](handleError(_0x1d29ed,null));};exports[_0x7e10('0x54')]=function(_0x1c39a2,_0x29bd0d){var _0x4fec7f={'raw':![],'where':{'id':_0x1c39a2[_0x7e10('0x55')]['id']},'include':[{'model':db[_0x7e10('0x39')],'as':_0x7e10('0x3a')}]},_0x4dbc37={};_0x4dbc37[_0x7e10('0x3f')]=_[_0x7e10('0x42')](db['FaxAccount'][_0x7e10('0x3c')]);_0x4dbc37['query']=_['keys'](_0x1c39a2[_0x7e10('0x41')]);_0x4dbc37[_0x7e10('0x4a')]=_['intersection'](_0x4dbc37[_0x7e10('0x3f')],_0x4dbc37[_0x7e10('0x41')]);_0x4fec7f[_0x7e10('0x44')]=_[_0x7e10('0x43')](_0x4dbc37[_0x7e10('0x3f')],qs[_0x7e10('0x45')](_0x1c39a2['query'][_0x7e10('0x45')]));_0x4fec7f[_0x7e10('0x44')]=_0x4fec7f[_0x7e10('0x44')][_0x7e10('0x46')]?_0x4fec7f[_0x7e10('0x44')]:_0x4dbc37[_0x7e10('0x3f')];if(_0x1c39a2[_0x7e10('0x41')]['includeAll']){_0x4fec7f[_0x7e10('0x52')]=[{'all':!![]}];}_0x4fec7f=_[_0x7e10('0x4c')]({},_0x4fec7f,_0x1c39a2[_0x7e10('0x50')]);return db['FaxAccount']['find'](_0x4fec7f)[_0x7e10('0x34')](handleEntityNotFound(_0x29bd0d,null))[_0x7e10('0x34')](respondWithResult(_0x29bd0d,null))[_0x7e10('0x27')](handleError(_0x29bd0d,null));};exports[_0x7e10('0x56')]=function(_0x13a8a5,_0x5987a7){return db[_0x7e10('0x3b')][_0x7e10('0x56')](_0x13a8a5[_0x7e10('0x57')],{})[_0x7e10('0x34')](function(_0x4e30cb){var _0x201cbc=_0x13a8a5['user'][_0x7e10('0x35')]({'plain':!![]});if(!_0x201cbc)throw new Error(_0x7e10('0x58'));if(_0x201cbc[_0x7e10('0x59')]===_0x7e10('0x5a')){var _0x2ede43=_0x4e30cb['get']({'plain':!![]});var _0x29ec6f='FaxAccounts';return db['UserProfileSection'][_0x7e10('0x5b')]({'where':{'name':_0x29ec6f,'userProfileId':_0x201cbc['userProfileId']},'raw':!![]})[_0x7e10('0x34')](function(_0x5f2080){if(_0x5f2080&&_0x5f2080[_0x7e10('0x5c')]===0x0){return db[_0x7e10('0x5d')][_0x7e10('0x56')]({'name':_0x2ede43[_0x7e10('0x38')],'resourceId':_0x2ede43['id'],'type':_0x5f2080[_0x7e10('0x38')],'sectionId':_0x5f2080['id']},{})[_0x7e10('0x34')](function(){return _0x4e30cb;});}else{return _0x4e30cb;}})[_0x7e10('0x27')](function(_0xf75dff){logger[_0x7e10('0x24')](_0x7e10('0x5e'),_0xf75dff);throw _0xf75dff;});}return _0x4e30cb;})['then'](respondWithResult(_0x5987a7,0xc9))[_0x7e10('0x27')](handleError(_0x5987a7,null));};exports[_0x7e10('0x33')]=function(_0x57fffe,_0xa13945){if(_0x57fffe[_0x7e10('0x57')]['id']){delete _0x57fffe[_0x7e10('0x57')]['id'];}return db['FaxAccount'][_0x7e10('0x5b')]({'where':{'id':_0x57fffe['params']['id']},'include':[{'model':db[_0x7e10('0x39')],'as':_0x7e10('0x3a')}]})[_0x7e10('0x34')](handleEntityNotFound(_0xa13945,null))[_0x7e10('0x34')](saveUpdates(_0x57fffe[_0x7e10('0x57')],null))[_0x7e10('0x34')](respondWithResult(_0xa13945,null))['catch'](handleError(_0xa13945,null));};exports[_0x7e10('0x37')]=function(_0x5d3154,_0x3bb9ce){return db['FaxAccount']['find']({'where':{'id':_0x5d3154[_0x7e10('0x55')]['id']}})[_0x7e10('0x34')](handleEntityNotFound(_0x3bb9ce,null))[_0x7e10('0x34')](removeEntity(_0x3bb9ce,null))['catch'](handleError(_0x3bb9ce,null));};exports[_0x7e10('0x5f')]=function(_0x5d094d,_0x2e0194){return db[_0x7e10('0x3b')][_0x7e10('0x5f')]()[_0x7e10('0x34')](respondWithResult(_0x2e0194,null))['catch'](handleError(_0x2e0194,null));};exports[_0x7e10('0x60')]=function(_0x9f9e79,_0x1f3638,_0x416cb5){if(_0x9f9e79[_0x7e10('0x57')]['id']){delete _0x9f9e79[_0x7e10('0x57')]['id'];}return db['FaxAccount'][_0x7e10('0x5b')]({'where':{'id':_0x9f9e79[_0x7e10('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f3638,null))[_0x7e10('0x34')](function(_0x2f2480){if(_0x2f2480){_0x9f9e79[_0x7e10('0x57')][_0x7e10('0x61')]=_0x2f2480['id'];return db[_0x7e10('0x62')]['create'](_0x9f9e79[_0x7e10('0x57')]);}})['then'](respondWithResult(_0x1f3638,null))['catch'](handleError(_0x1f3638,null));};exports[_0x7e10('0x63')]=function(_0x116e08,_0x2cb9eb,_0x49e265){var _0x418b7e={'raw':![],'where':{}};var _0x8fa63d={};var _0x17a24b={'count':0x0,'rows':[]};return db[_0x7e10('0x3b')][_0x7e10('0x64')]({'where':{'id':_0x116e08[_0x7e10('0x55')]['id']}})[_0x7e10('0x34')](handleEntityNotFound(_0x2cb9eb,null))[_0x7e10('0x34')](function(_0x5c9bca){if(_0x5c9bca){_0x8fa63d[_0x7e10('0x3f')]=_[_0x7e10('0x42')](db[_0x7e10('0x62')]['rawAttributes']);_0x8fa63d[_0x7e10('0x41')]=_['keys'](_0x116e08['query']);_0x8fa63d[_0x7e10('0x4a')]=_['intersection'](_0x8fa63d['model'],_0x8fa63d[_0x7e10('0x41')]);_0x418b7e[_0x7e10('0x44')]=_[_0x7e10('0x43')](_0x8fa63d[_0x7e10('0x3f')],qs[_0x7e10('0x45')](_0x116e08[_0x7e10('0x41')][_0x7e10('0x45')]));_0x418b7e[_0x7e10('0x44')]=_0x418b7e[_0x7e10('0x44')]['length']?_0x418b7e[_0x7e10('0x44')]:_0x8fa63d[_0x7e10('0x3f')];if(!_0x116e08['query'][_0x7e10('0x47')](_0x7e10('0x48'))){_0x418b7e[_0x7e10('0x2e')]=qs[_0x7e10('0x2e')](_0x116e08[_0x7e10('0x41')][_0x7e10('0x2e')]);_0x418b7e[_0x7e10('0x2d')]=qs['offset'](_0x116e08[_0x7e10('0x41')][_0x7e10('0x2d')]);}_0x418b7e[_0x7e10('0x65')]=qs[_0x7e10('0x49')](_0x116e08[_0x7e10('0x41')][_0x7e10('0x49')]);_0x418b7e[_0x7e10('0x4d')]=qs['filters'](_[_0x7e10('0x4b')](_0x116e08[_0x7e10('0x41')],_0x8fa63d['filters']));_0x418b7e[_0x7e10('0x4d')][_0x7e10('0x61')]=_0x5c9bca['id'];if(_0x116e08[_0x7e10('0x41')][_0x7e10('0x4f')]){_0x418b7e[_0x7e10('0x4d')]=_[_0x7e10('0x4c')](_0x418b7e[_0x7e10('0x4d')],{'$or':_[_0x7e10('0x40')](_0x418b7e['attributes'],function(_0x1a53c9){var _0x19ccc5={};_0x19ccc5[_0x1a53c9]={'$like':'%'+_0x116e08['query'][_0x7e10('0x4f')]+'%'};return _0x19ccc5;})});}_0x418b7e=_[_0x7e10('0x4c')]({},_0x418b7e,_0x116e08[_0x7e10('0x50')]);return db[_0x7e10('0x62')][_0x7e10('0x2c')]({'where':_0x418b7e['where']})[_0x7e10('0x34')](function(_0x5d65e4){_0x17a24b[_0x7e10('0x2c')]=_0x5d65e4;if(_0x116e08[_0x7e10('0x41')][_0x7e10('0x51')]){_0x418b7e[_0x7e10('0x52')]=[{'all':!![]}];}return db[_0x7e10('0x62')][_0x7e10('0x53')](_0x418b7e);})['then'](function(_0x15f499){_0x17a24b[_0x7e10('0x66')]=_0x15f499;return _0x17a24b;});}})[_0x7e10('0x34')](respondWithFilteredResult(_0x2cb9eb,_0x418b7e))[_0x7e10('0x27')](handleError(_0x2cb9eb,null));};exports[_0x7e10('0x67')]=function(_0x16eed2,_0x1f7970,_0x132dad){return db['FaxAccount'][_0x7e10('0x5b')]({'where':{'id':_0x16eed2[_0x7e10('0x55')]['id']}})[_0x7e10('0x34')](handleEntityNotFound(_0x1f7970,null))[_0x7e10('0x34')](function(_0x10187b){if(_0x10187b){return _0x10187b[_0x7e10('0x67')](_0x16eed2['query'][_0x7e10('0x68')]);}})[_0x7e10('0x34')](respondWithStatusCode(_0x1f7970,null))[_0x7e10('0x27')](handleError(_0x1f7970,null));};exports[_0x7e10('0x69')]=function(_0x553538,_0xe36fd3,_0x1d73c8){if(_0x553538[_0x7e10('0x57')]['id']){delete _0x553538[_0x7e10('0x57')]['id'];}return db[_0x7e10('0x3b')][_0x7e10('0x5b')]({'where':{'id':_0x553538[_0x7e10('0x55')]['id']}})[_0x7e10('0x34')](handleEntityNotFound(_0xe36fd3,null))[_0x7e10('0x34')](function(_0x474191){if(_0x474191){_0x553538[_0x7e10('0x57')][_0x7e10('0x61')]=_0x474191['id'];return db[_0x7e10('0x6a')][_0x7e10('0x56')](_0x553538['body']);}})['then'](respondWithResult(_0xe36fd3,null))['catch'](handleError(_0xe36fd3,null));};exports['getAnswers']=function(_0xad04d,_0x5e5284,_0x19a216){var _0x4cd9e8={'raw':![],'where':{}};var _0x232913={};var _0x182b0a={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7e10('0x64')]({'where':{'id':_0xad04d[_0x7e10('0x55')]['id']}})[_0x7e10('0x34')](handleEntityNotFound(_0x5e5284,null))['then'](function(_0x237381){if(_0x237381){_0x232913[_0x7e10('0x3f')]=_[_0x7e10('0x42')](db['CannedAnswer']['rawAttributes']);_0x232913[_0x7e10('0x41')]=_['keys'](_0xad04d[_0x7e10('0x41')]);_0x232913[_0x7e10('0x4a')]=_[_0x7e10('0x43')](_0x232913['model'],_0x232913[_0x7e10('0x41')]);_0x4cd9e8[_0x7e10('0x44')]=_['intersection'](_0x232913['model'],qs[_0x7e10('0x45')](_0xad04d['query'][_0x7e10('0x45')]));_0x4cd9e8['attributes']=_0x4cd9e8[_0x7e10('0x44')]['length']?_0x4cd9e8[_0x7e10('0x44')]:_0x232913['model'];if(!_0xad04d[_0x7e10('0x41')][_0x7e10('0x47')](_0x7e10('0x48'))){_0x4cd9e8[_0x7e10('0x2e')]=qs[_0x7e10('0x2e')](_0xad04d[_0x7e10('0x41')][_0x7e10('0x2e')]);_0x4cd9e8[_0x7e10('0x2d')]=qs[_0x7e10('0x2d')](_0xad04d[_0x7e10('0x41')][_0x7e10('0x2d')]);}_0x4cd9e8[_0x7e10('0x65')]=qs[_0x7e10('0x49')](_0xad04d['query']['sort']);_0x4cd9e8[_0x7e10('0x4d')]=qs[_0x7e10('0x4a')](_[_0x7e10('0x4b')](_0xad04d[_0x7e10('0x41')],_0x232913['filters']));_0x4cd9e8[_0x7e10('0x4d')][_0x7e10('0x61')]=_0x237381['id'];if(_0xad04d['query'][_0x7e10('0x4f')]){_0x4cd9e8[_0x7e10('0x4d')]=_[_0x7e10('0x4c')](_0x4cd9e8[_0x7e10('0x4d')],{'$or':_[_0x7e10('0x40')](_0x4cd9e8[_0x7e10('0x44')],function(_0x31ac35){var _0x4b3aaa={};_0x4b3aaa[_0x31ac35]={'$like':'%'+_0xad04d['query']['filter']+'%'};return _0x4b3aaa;})});}_0x4cd9e8=_[_0x7e10('0x4c')]({},_0x4cd9e8,_0xad04d[_0x7e10('0x50')]);return db['CannedAnswer'][_0x7e10('0x2c')]({'where':_0x4cd9e8['where']})[_0x7e10('0x34')](function(_0x4fa436){_0x182b0a[_0x7e10('0x2c')]=_0x4fa436;if(_0xad04d[_0x7e10('0x41')][_0x7e10('0x51')]){_0x4cd9e8['include']=[{'all':!![]}];}return db[_0x7e10('0x6a')][_0x7e10('0x53')](_0x4cd9e8);})[_0x7e10('0x34')](function(_0x185da9){_0x182b0a[_0x7e10('0x66')]=_0x185da9;return _0x182b0a;});}})[_0x7e10('0x34')](respondWithFilteredResult(_0x5e5284,_0x4cd9e8))['catch'](handleError(_0x5e5284,null));};exports[_0x7e10('0x6b')]=function(_0x1561ad,_0x4d95e3,_0x50b988){return db[_0x7e10('0x3b')][_0x7e10('0x5b')]({'where':{'id':_0x1561ad['params']['id']}})[_0x7e10('0x34')](handleEntityNotFound(_0x4d95e3,null))['then'](function(_0x44d757){if(_0x44d757){return _0x44d757[_0x7e10('0x6b')](_0x1561ad[_0x7e10('0x41')][_0x7e10('0x68')]);}})['then'](respondWithStatusCode(_0x4d95e3,null))[_0x7e10('0x27')](handleError(_0x4d95e3,null));};exports[_0x7e10('0x6c')]=function(_0x42fd78,_0x3f5523,_0x49b382){return db[_0x7e10('0x6d')][_0x7e10('0x5b')]({'where':{'id':_0x42fd78[_0x7e10('0x55')]['id']}})[_0x7e10('0x34')](handleEntityNotFound(_0x3f5523,null))[_0x7e10('0x34')](function(_0x1c7b62){if(_0x1c7b62){return _0x1c7b62['addInteraction'](_0x42fd78[_0x7e10('0x57')][_0x7e10('0x68')],_[_0x7e10('0x6e')](_0x42fd78[_0x7e10('0x57')],[_0x7e10('0x68'),'id'])||{});}})[_0x7e10('0x34')](respondWithResult(_0x3f5523,null))[_0x7e10('0x27')](handleError(_0x3f5523,null));};exports[_0x7e10('0x6f')]=function(_0x4b2edd,_0x509f7b,_0x4dbb8c){var _0x2b4e73={'raw':![],'where':{}};var _0x320834={};var _0x512f0f={'count':0x0,'rows':[]};return db[_0x7e10('0x3b')][_0x7e10('0x64')]({'where':{'id':_0x4b2edd[_0x7e10('0x55')]['id']}})[_0x7e10('0x34')](handleEntityNotFound(_0x509f7b,null))[_0x7e10('0x34')](function(_0x24c404){if(_0x24c404){_0x320834[_0x7e10('0x3f')]=_[_0x7e10('0x42')](db[_0x7e10('0x6d')]['rawAttributes']);_0x320834[_0x7e10('0x41')]=_[_0x7e10('0x42')](_0x4b2edd[_0x7e10('0x41')]);_0x320834[_0x7e10('0x4a')]=_['intersection'](_0x320834['model'],_0x320834[_0x7e10('0x41')]);_0x2b4e73[_0x7e10('0x44')]=_['intersection'](_0x320834['model'],qs[_0x7e10('0x45')](_0x4b2edd['query'][_0x7e10('0x45')]));_0x2b4e73['attributes']=_0x2b4e73[_0x7e10('0x44')][_0x7e10('0x46')]?_0x2b4e73[_0x7e10('0x44')]:_0x320834[_0x7e10('0x3f')];if(!_0x4b2edd[_0x7e10('0x41')][_0x7e10('0x47')](_0x7e10('0x48'))){_0x2b4e73[_0x7e10('0x2e')]=qs[_0x7e10('0x2e')](_0x4b2edd[_0x7e10('0x41')][_0x7e10('0x2e')]);_0x2b4e73[_0x7e10('0x2d')]=qs[_0x7e10('0x2d')](_0x4b2edd[_0x7e10('0x41')][_0x7e10('0x2d')]);}_0x2b4e73[_0x7e10('0x65')]=qs[_0x7e10('0x49')](_0x4b2edd[_0x7e10('0x41')][_0x7e10('0x49')]);_0x2b4e73[_0x7e10('0x4d')]=qs[_0x7e10('0x4a')](_['pick'](_0x4b2edd[_0x7e10('0x41')],_0x320834[_0x7e10('0x4a')]));_0x2b4e73[_0x7e10('0x4d')]['FaxAccountId']=_0x24c404['id'];if(_0x4b2edd[_0x7e10('0x41')][_0x7e10('0x4f')]){_0x2b4e73[_0x7e10('0x4d')]=_[_0x7e10('0x4c')](_0x2b4e73[_0x7e10('0x4d')],{'$or':_[_0x7e10('0x40')](_0x2b4e73[_0x7e10('0x44')],function(_0x3ae949){var _0x3ae723={};_0x3ae723[_0x3ae949]={'$like':'%'+_0x4b2edd[_0x7e10('0x41')][_0x7e10('0x4f')]+'%'};return _0x3ae723;})});}_0x2b4e73=_[_0x7e10('0x4c')]({},_0x2b4e73,_0x4b2edd[_0x7e10('0x50')]);return db['FaxInteraction'][_0x7e10('0x2c')]({'where':_0x2b4e73[_0x7e10('0x4d')]})['then'](function(_0x5a5709){_0x512f0f[_0x7e10('0x2c')]=_0x5a5709;if(_0x4b2edd['query']['includeAll']){_0x2b4e73[_0x7e10('0x52')]=[{'model':db['CmContact'],'as':_0x7e10('0x70'),'required':![]},{'model':db[_0x7e10('0x71')],'as':'Owner','attributes':[_0x7e10('0x38'),_0x7e10('0x72'),_0x7e10('0x73')],'required':![]},{'model':db[_0x7e10('0x74')],'as':_0x7e10('0x75'),'attributes':['id',_0x7e10('0x38'),_0x7e10('0x76')],'where':_0x4b2edd[_0x7e10('0x41')]['tag']?{'id':_0x4b2edd[_0x7e10('0x41')][_0x7e10('0x77')]}:undefined,'required':_0x4b2edd['query'][_0x7e10('0x77')]?!![]:![]}];}return db['FaxInteraction'][_0x7e10('0x53')](_0x2b4e73);})[_0x7e10('0x34')](function(_0x28409f){_0x512f0f[_0x7e10('0x66')]=_0x28409f;return _0x512f0f;});}})[_0x7e10('0x34')](respondWithFilteredResult(_0x509f7b,_0x2b4e73))[_0x7e10('0x27')](handleError(_0x509f7b,null));};exports[_0x7e10('0x78')]=function(_0x3144bb,_0x221c0e,_0x34b9b5){return db['FaxAccount'][_0x7e10('0x64')]({'where':{'id':_0x3144bb[_0x7e10('0x55')]['id']}})[_0x7e10('0x34')](handleEntityNotFound(_0x221c0e,null))[_0x7e10('0x34')](function(_0x344689){if(_0x344689){return db[_0x7e10('0x79')][_0x7e10('0x7a')](function(_0x3370f8){return db['FaxApplication'][_0x7e10('0x37')]({'where':{'FaxAccountId':_0x3144bb[_0x7e10('0x55')]['id']},'transaction':_0x3370f8})['then'](function(_0x3c48bb){var _0xb22166=_[_0x7e10('0x40')](_0x3144bb[_0x7e10('0x57')],function(_0x5c8392){_0x5c8392[_0x7e10('0x61')]=_0x3144bb[_0x7e10('0x55')]['id'];return _0x5c8392;});return db[_0x7e10('0x7b')][_0x7e10('0x7c')](_0xb22166,{'transaction':_0x3370f8});});})[_0x7e10('0x34')](function(){return db['FaxApplication'][_0x7e10('0x7d')]({'where':{'FaxAccountId':_0x3144bb[_0x7e10('0x55')]['id']},'order':_0x7e10('0x7e')});});}})[_0x7e10('0x34')](respondWithResult(_0x221c0e,null))['catch'](handleError(_0x221c0e,null));};exports['getApplications']=function(_0x1ee49c,_0x2296cb,_0x8c8d58){var _0x528542={};var _0x288a93={};var _0x1cc4b6;var _0x528ec5;return db[_0x7e10('0x3b')][_0x7e10('0x64')]({'where':{'id':_0x1ee49c[_0x7e10('0x55')]['id']}})['then'](handleEntityNotFound(_0x2296cb,null))[_0x7e10('0x34')](function(_0x5c1b46){if(_0x5c1b46){_0x1cc4b6=_0x5c1b46;_0x288a93[_0x7e10('0x3f')]=_[_0x7e10('0x42')](db[_0x7e10('0x7b')]['rawAttributes']);_0x288a93['query']=_[_0x7e10('0x42')](_0x1ee49c['query']);_0x288a93[_0x7e10('0x4a')]=_[_0x7e10('0x43')](_0x288a93['model'],_0x288a93[_0x7e10('0x41')]);_0x528542[_0x7e10('0x44')]=_[_0x7e10('0x43')](_0x288a93[_0x7e10('0x3f')],qs[_0x7e10('0x45')](_0x1ee49c[_0x7e10('0x41')]['fields']));_0x528542[_0x7e10('0x44')]=_0x528542['attributes'][_0x7e10('0x46')]?_0x528542[_0x7e10('0x44')]:_0x288a93[_0x7e10('0x3f')];_0x528542['order']=qs[_0x7e10('0x49')](_0x1ee49c[_0x7e10('0x41')][_0x7e10('0x49')]);_0x528542['where']=qs[_0x7e10('0x4a')](_[_0x7e10('0x4b')](_0x1ee49c['query'],_0x288a93[_0x7e10('0x4a')]));if(_0x1ee49c[_0x7e10('0x41')]['filter']){_0x528542[_0x7e10('0x4d')]=_[_0x7e10('0x4c')](_0x528542[_0x7e10('0x4d')],{'$or':_[_0x7e10('0x40')](_0x528542[_0x7e10('0x44')],function(_0x28280c){var _0x3fac72={};_0x3fac72[_0x28280c]={'$like':'%'+_0x1ee49c[_0x7e10('0x41')][_0x7e10('0x4f')]+'%'};return _0x3fac72;})});}_0x528542=_[_0x7e10('0x4c')]({},_0x528542,_0x1ee49c[_0x7e10('0x50')]);return _0x1cc4b6['getApplications'](_0x528542);}})[_0x7e10('0x34')](function(_0x4fac56){if(_0x4fac56){_0x528ec5=_0x4fac56[_0x7e10('0x46')];if(!_0x1ee49c['query'][_0x7e10('0x47')](_0x7e10('0x48'))){_0x528542[_0x7e10('0x2e')]=qs[_0x7e10('0x2e')](_0x1ee49c[_0x7e10('0x41')][_0x7e10('0x2e')]);_0x528542[_0x7e10('0x2d')]=qs[_0x7e10('0x2d')](_0x1ee49c[_0x7e10('0x41')]['offset']);}return _0x1cc4b6['getApplications'](_0x528542);}})[_0x7e10('0x34')](function(_0x143a94){if(_0x143a94){return _0x143a94?{'count':_0x528ec5,'rows':_0x143a94}:null;}})['then'](respondWithResult(_0x2296cb,null))['catch'](handleError(_0x2296cb,null));};function Extension(_0x23afe8,_0x423480,_0x4ce8c8,_0x34d4f6){this['context']=_0x7e10('0x7f');this[_0x7e10('0x80')]=_0x23afe8[_0x7e10('0x81')];this[_0x7e10('0x82')]=_0x34d4f6;this['type']='system';this[_0x7e10('0x83')]=_0x7e10('0x84');this[_0x7e10('0x61')]=_0x23afe8['id'];this[_0x7e10('0x7e')]=_0x423480;this[_0x7e10('0x85')]=_0x4ce8c8;}function createExtensionsReciveFax(_0x3d2001){var _0x2865e6=0x1;var _0x2e0fc9=[];_0x2e0fc9['push'](new Extension(_0x3d2001,_0x2865e6,'',_0x7e10('0x86')));_0x2865e6+=0x1;_0x2e0fc9['push'](new Extension(_0x3d2001,_0x2865e6,_0x7e10('0x87'),_0x7e10('0x88')));_0x2865e6+=0x1;for(var _0x199da8 in _0x3d2001){if(_0x3d2001['hasOwnProperty'](_0x199da8)&&(_0x199da8==='ecm'||_0x199da8===_0x7e10('0x81')||_0x199da8===_0x7e10('0x89')||_0x199da8==='faxdetect'||_0x199da8==='headerinfo'||_0x199da8===_0x7e10('0x8a')||_0x199da8===_0x7e10('0x8b')||_0x199da8===_0x7e10('0x8c')||_0x199da8===_0x7e10('0x8d'))){_0x2e0fc9[_0x7e10('0x8e')](new Extension(_0x3d2001,_0x2865e6,_0x7e10('0x8f')+_0x199da8+')='+_0x3d2001[_0x199da8],'Set'));_0x2865e6+=0x1;}}_0x2e0fc9['push'](new Extension(_0x3d2001,_0x2865e6,'6',_0x7e10('0x90')));_0x2865e6+=0x1;_0x2e0fc9[_0x7e10('0x8e')](new Extension(_0x3d2001,_0x2865e6,_0x7e10('0x91'),_0x7e10('0x92')));_0x2865e6=0x0;return _0x2e0fc9;}exports[_0x7e10('0x93')]=function(_0x336ee7,_0xebd94,_0x571585){var _0x2bdd6f;return db[_0x7e10('0x79')][_0x7e10('0x7a')](function(_0x192ba9){return db[_0x7e10('0x3b')][_0x7e10('0x56')](_0x336ee7[_0x7e10('0x57')],{'transaction':_0x192ba9})[_0x7e10('0x34')](function(_0x18bea3){_0x2bdd6f=_0x18bea3[_0x7e10('0x35')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x2bdd6f),{'transaction':_0x192ba9});});})[_0x7e10('0x34')](function(){return _0x2bdd6f;})[_0x7e10('0x34')](respondWithResult(_0xebd94,null))[_0x7e10('0x27')](handleError(_0xebd94,null));};exports[_0x7e10('0x94')]=function(_0x44d9a4,_0x59fb69,_0x309e02){var _0x3fd649;return db[_0x7e10('0x79')][_0x7e10('0x7a')](function(_0xbafb6d){return db[_0x7e10('0x3b')][_0x7e10('0x33')](_0x44d9a4['body'],{'where':{'id':_0x44d9a4[_0x7e10('0x57')]['id']},'transaction':_0xbafb6d})[_0x7e10('0x34')](function(_0x2cd82d){return db[_0x7e10('0x95')][_0x7e10('0x37')]({'where':{'FaxAccountId':_0x44d9a4['body']['id']},'transaction':_0xbafb6d})['then'](function(_0x33c483){return db[_0x7e10('0x95')][_0x7e10('0x7c')](createExtensionsReciveFax(_[_0x7e10('0x6e')](_0x44d9a4[_0x7e10('0x57')],['tech','key',_0x7e10('0x96'),'updatedAt',_0x7e10('0x97'),_0x7e10('0x98')])),{'transaction':_0xbafb6d});});});})[_0x7e10('0x34')](function(){return db[_0x7e10('0x3b')][_0x7e10('0x99')](_0x44d9a4[_0x7e10('0x57')]['id']);})['then'](respondWithResult(_0x59fb69,null))[_0x7e10('0x27')](handleError(_0x59fb69,null));};exports[_0x7e10('0x9a')]=function(_0x45703d,_0x20707e,_0x5e324b){var _0x597ad1={'raw':!![],'where':{}};var _0x3fda24={};var _0x2388ae={'count':0x0,'rows':[]};return db[_0x7e10('0x3b')][_0x7e10('0x64')]({'where':{'id':_0x45703d[_0x7e10('0x55')]['id']}})[_0x7e10('0x34')](handleEntityNotFound(_0x20707e,null))[_0x7e10('0x34')](function(_0x3abbd2){if(_0x3abbd2){_0x3fda24[_0x7e10('0x3f')]=_['keys'](db[_0x7e10('0x9b')]['rawAttributes']);_0x3fda24[_0x7e10('0x41')]=_[_0x7e10('0x42')](_0x45703d[_0x7e10('0x41')]);_0x3fda24[_0x7e10('0x4a')]=_[_0x7e10('0x43')](_0x3fda24[_0x7e10('0x3f')],_0x3fda24[_0x7e10('0x41')]);_0x597ad1[_0x7e10('0x44')]=_[_0x7e10('0x43')](_0x3fda24[_0x7e10('0x3f')],qs[_0x7e10('0x45')](_0x45703d[_0x7e10('0x41')][_0x7e10('0x45')]));_0x597ad1[_0x7e10('0x44')]=_0x597ad1[_0x7e10('0x44')][_0x7e10('0x46')]?_0x597ad1['attributes']:_0x3fda24[_0x7e10('0x3f')];if(!_0x45703d[_0x7e10('0x41')][_0x7e10('0x47')](_0x7e10('0x48'))){_0x597ad1[_0x7e10('0x2e')]=qs[_0x7e10('0x2e')](_0x45703d[_0x7e10('0x41')][_0x7e10('0x2e')]);_0x597ad1[_0x7e10('0x2d')]=qs[_0x7e10('0x2d')](_0x45703d[_0x7e10('0x41')][_0x7e10('0x2d')]);}_0x597ad1['order']=qs['sort'](_0x45703d[_0x7e10('0x41')][_0x7e10('0x49')]);_0x597ad1[_0x7e10('0x4d')]=qs[_0x7e10('0x4a')](_['pick'](_0x45703d['query'],_0x3fda24[_0x7e10('0x4a')]));_0x597ad1[_0x7e10('0x4d')]['FaxAccountId']=_0x3abbd2['id'];if(_0x45703d['query'][_0x7e10('0x4f')]){_0x597ad1[_0x7e10('0x4d')]=_[_0x7e10('0x4c')](_0x597ad1[_0x7e10('0x4d')],{'$or':_[_0x7e10('0x40')](_0x597ad1[_0x7e10('0x44')],function(_0x41470a){var _0x47b59c={};_0x47b59c[_0x41470a]={'$like':'%'+_0x45703d['query'][_0x7e10('0x4f')]+'%'};return _0x47b59c;})});}if(_0x45703d['query'][_0x7e10('0x9c')]){var _0x39cb8e=_0x45703d['query'][_0x7e10('0x9c')][_0x7e10('0x9d')](',');var _0x1dd2ac={};_0x1dd2ac[_0x39cb8e[0x0]]={'$gte':moment(_0x39cb8e[0x1])['format'](_0x7e10('0x9e'))};_0x597ad1['where']=_['merge'](_0x597ad1[_0x7e10('0x4d')],_0x1dd2ac);}_0x597ad1=_[_0x7e10('0x4c')]({},_0x597ad1,_0x45703d[_0x7e10('0x50')]);return db[_0x7e10('0x9b')][_0x7e10('0x2c')]({'where':_0x597ad1[_0x7e10('0x4d')]})[_0x7e10('0x34')](function(_0x32c57f){_0x2388ae[_0x7e10('0x2c')]=_0x32c57f;if(_0x45703d[_0x7e10('0x41')]['includeAll']){_0x597ad1[_0x7e10('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0x7e10('0x53')](_0x597ad1);})[_0x7e10('0x34')](function(_0x58207b){_0x2388ae[_0x7e10('0x66')]=_0x58207b;return _0x2388ae;});}})[_0x7e10('0x34')](respondWithFilteredResult(_0x20707e,_0x597ad1))[_0x7e10('0x27')](handleError(_0x20707e,null));};exports[_0x7e10('0x9f')]=function(_0x1141d2,_0x4dc420,_0x1d371e){var _0x494cdd,_0x1b4498={},_0x3c7c8d;if(_0x1141d2[_0x7e10('0x57')]['to']){_0x3c7c8d=_0x1141d2[_0x7e10('0x57')]['to'][0x0];}return db[_0x7e10('0x3b')][_0x7e10('0x5b')]({'where':{'id':_0x1141d2[_0x7e10('0x55')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7e10('0xa0')],'as':_0x7e10('0xa1'),'where':{'fax':_0x3c7c8d},'limit':0x1,'order':[[_0x7e10('0xa2'),_0x7e10('0xa3')]]}]}]})[_0x7e10('0x34')](handleEntityNotFound(_0x4dc420,null))[_0x7e10('0x34')](function(_0x2a2f3e){_0x494cdd=_0x2a2f3e;if(_0x1141d2[_0x7e10('0x57')][_0x7e10('0xa4')]&&_0x1141d2['body'][_0x7e10('0xa4')]['length']){for(var _0x4dfee3=0x0;_0x4dfee3<_0x1141d2[_0x7e10('0x57')][_0x7e10('0xa4')][_0x7e10('0x46')];_0x4dfee3+=0x1){_0x1141d2[_0x7e10('0x57')]['attachments'][_0x4dfee3]={'filename':_0x1141d2['body'][_0x7e10('0xa4')][_0x4dfee3][_0x7e10('0x38')],'id':_0x1141d2['body'][_0x7e10('0xa4')][_0x4dfee3]['id'],'path':path[_0x7e10('0xa5')](config['root'],_0x7e10('0xa6'),_0x1141d2[_0x7e10('0x57')][_0x7e10('0xa4')][_0x4dfee3][_0x7e10('0xa7')])};}}return respondWithRpcPromise('CheckAfterSend',_0x7e10('0xa8'),{'FaxAccountId':_[_0x7e10('0xa9')](_0x1141d2[_0x7e10('0x55')]['id'])?undefined:_0x1141d2[_0x7e10('0x55')]['id'],'path':_['isNil'](_0x1141d2[_0x7e10('0x57')][_0x7e10('0xa4')][0x0][_0x7e10('0x6')])?undefined:_0x1141d2[_0x7e10('0x57')][_0x7e10('0xa4')][0x0][_0x7e10('0x6')],'fax':_['isNil'](_0x1141d2[_0x7e10('0x57')]['to'][0x0])?undefined:_0x1141d2[_0x7e10('0x57')]['to'][0x0]},client9002);})[_0x7e10('0x34')](function(){if(_0x494cdd){if(_[_0x7e10('0xa9')](_0x1141d2[_0x7e10('0x57')][_0x7e10('0xaa')])){_0x1141d2['body'][_0x7e10('0xaa')]=util[_0x7e10('0xab')](_0x7e10('0xac'),_0x494cdd[_0x7e10('0x38')],_0x494cdd['fax']);}if(_0x494cdd[_0x7e10('0xad')]){if(_0x494cdd[_0x7e10('0xad')][_0x7e10('0xa1')][_0x7e10('0x46')]){return _0x494cdd[_0x7e10('0xad')][_0x7e10('0xa1')][0x0];}else{return db['CmContact']['create'](_[_0x7e10('0xae')](_0x1141d2[_0x7e10('0x57')],{'firstName':_0x1141d2[_0x7e10('0x57')]['to'][0x0],'phone':_0x1141d2[_0x7e10('0x57')]['to'][0x0],'fax':_0x1141d2[_0x7e10('0x57')]['to'][0x0],'ListId':_0x494cdd[_0x7e10('0x98')]}));}}else{throw new Error(_0x7e10('0xaf'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x7e10('0x34')](function(_0x3a7972){if(_0x3a7972){return db[_0x7e10('0x6d')][_0x7e10('0x5b')]({'where':{'ContactId':_0x3a7972['id'],'closed':![],'FaxAccountId':_0x494cdd['id']}})[_0x7e10('0x34')](function(_0x24512d){if(_0x24512d){return[_0x24512d,![]];}return db['FaxInteraction'][_0x7e10('0x56')]({'UserId':_0x1141d2['user']['id'],'ContactId':_0x3a7972['id'],'FaxAccountId':_0x494cdd['id'],'fax':_0x1141d2[_0x7e10('0x57')]['to'][0x0],'firstMsgDirection':_0x7e10('0xb0'),'Messages':[_['merge'](_0x1141d2[_0x7e10('0x57')],{'read':![],'body':_0x1141d2[_0x7e10('0x57')][_0x7e10('0xa4')][0x0]['filename'],'FaxAccountId':_0x494cdd['id'],'UserId':_0x1141d2['user']['id'],'ContactId':_0x3a7972['id'],'AttachmentId':_0x1141d2[_0x7e10('0x57')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x7e10('0x9b')],'as':_0x7e10('0xb1')}]})[_0x7e10('0x34')](function(_0x59f318){return[_0x59f318,!![]];});});}else{throw new Error(_0x7e10('0xb2'));}})[_0x7e10('0xb3')](function(_0x33c402,_0xd4a6cc){if(_0xd4a6cc){return _0x33c402;}return db[_0x7e10('0x9b')][_0x7e10('0x56')]({'direction':_0x7e10('0xb0'),'read':![],'body':_0x1141d2['body'][_0x7e10('0xa4')][0x0][_0x7e10('0xb4')],'FaxAccountId':_0x494cdd['id'],'FaxInteractionId':_0x33c402['id'],'UserId':_0x1141d2[_0x7e10('0x5a')]['id'],'ContactId':_0x33c402[_0x7e10('0xb5')],'AttachmentId':_0x1141d2[_0x7e10('0x57')][_0x7e10('0xa4')][0x0]['id']})[_0x7e10('0x34')](function(_0x1d6c63){_0x33c402[_0x7e10('0xb6')][_0x7e10('0xb1')]=[];_0x33c402[_0x7e10('0xb6')][_0x7e10('0xb1')]['push'](_0x1d6c63[_0x7e10('0xb6')]);return _0x33c402;});})[_0x7e10('0x34')](function(_0x2dad3f){respondWithRpcPromise(_0x7e10('0xb7'),_0x7e10('0xb7'),{'FaxAccountId':_[_0x7e10('0xa9')](_0x1141d2[_0x7e10('0x55')]['id'])?undefined:_0x1141d2['params']['id'],'path':_['isNil'](_0x1141d2[_0x7e10('0x57')][_0x7e10('0xa4')][0x0]['path'])?undefined:_0x1141d2[_0x7e10('0x57')][_0x7e10('0xa4')][0x0]['path'],'fax':_[_0x7e10('0xa9')](_0x1141d2['body']['to'][0x0])?undefined:_0x1141d2['body']['to'][0x0],'AttachmentId':_0x1141d2[_0x7e10('0x57')][_0x7e10('0xa4')][0x0]['id']},client9002)[_0x7e10('0x34')](function(_0x236c0f){logger[_0x7e10('0x1e')](_0x7e10('0xb8'),_0x236c0f);})[_0x7e10('0x27')](function(_0x11fb6d){logger[_0x7e10('0x1e')](_0x7e10('0xb8'),_0x11fb6d);});return _0x2dad3f;})[_0x7e10('0x34')](respondWithResult(_0x4dc420,null))['catch'](handleError(_0x4dc420,null));};exports[_0x7e10('0xb9')]=function(_0x2866fb,_0x14ab53,_0x5eb1cd){return db[_0x7e10('0x3b')]['find']({'where':{'id':_0x2866fb[_0x7e10('0x55')]['id']}})[_0x7e10('0x34')](handleEntityNotFound(_0x14ab53,null))[_0x7e10('0x34')](function(_0x322254){if(_0x322254){return _0x322254[_0x7e10('0xb9')](_0x2866fb[_0x7e10('0x57')][_0x7e10('0x68')],_['omit'](_0x2866fb[_0x7e10('0x57')],['ids','id'])||{})[_0x7e10('0xb3')](function(_0xe82c0e){for(var _0x1dc1b0=0x0;_0x1dc1b0<_0x2866fb['body'][_0x7e10('0x68')]['length'];_0x1dc1b0+=0x1){socket[_0x7e10('0xba')](_0x7e10('0xbb'),{'UserId':_0x2866fb['body'][_0x7e10('0x68')][_0x1dc1b0],'FaxAccountId':_0x2866fb[_0x7e10('0x55')]['id']});}return _0xe82c0e;});}})[_0x7e10('0x34')](respondWithResult(_0x14ab53,null))[_0x7e10('0x27')](handleError(_0x14ab53,null));};exports[_0x7e10('0xbc')]=function(_0x4dc3f0,_0x5ce622,_0x590ab3){return db['FaxAccount'][_0x7e10('0x5b')]({'where':{'id':_0x4dc3f0[_0x7e10('0x55')]['id']}})['then'](handleEntityNotFound(_0x5ce622,null))[_0x7e10('0x34')](function(_0xeedd9a){if(_0xeedd9a){return _0xeedd9a['removeAgents'](_0x4dc3f0['query'][_0x7e10('0x68')])['then'](function(){if(_[_0x7e10('0xbd')](_0x4dc3f0[_0x7e10('0x41')][_0x7e10('0x68')])){for(var _0x29ac51=0x0;_0x29ac51<_0x4dc3f0[_0x7e10('0x41')]['ids']['length'];_0x29ac51+=0x1){socket[_0x7e10('0xba')](_0x7e10('0xbe'),{'UserId':Number(_0x4dc3f0[_0x7e10('0x41')][_0x7e10('0x68')][_0x29ac51]),'FaxAccountId':Number(_0x4dc3f0[_0x7e10('0x55')]['id'])});}}else{socket[_0x7e10('0xba')](_0x7e10('0xbe'),{'UserId':Number(_0x4dc3f0['query'][_0x7e10('0x68')]),'FaxAccountId':Number(_0x4dc3f0[_0x7e10('0x55')]['id'])});}});}})[_0x7e10('0x34')](respondWithStatusCode(_0x5ce622,null))[_0x7e10('0x27')](handleError(_0x5ce622,null));};exports[_0x7e10('0xbf')]=function(_0x565d16,_0x27e25a,_0xbaf3a7){var _0x3bf59b={};var _0x3b45d7={};var _0x1ad392;var _0x74339f;return db[_0x7e10('0x3b')]['findOne']({'where':{'id':_0x565d16[_0x7e10('0x55')]['id']}})[_0x7e10('0x34')](handleEntityNotFound(_0x27e25a,null))[_0x7e10('0x34')](function(_0x42812a){if(_0x42812a){_0x1ad392=_0x42812a;_0x3b45d7[_0x7e10('0x3f')]=_['keys'](db['User']['rawAttributes']);_0x3b45d7[_0x7e10('0x41')]=_[_0x7e10('0x42')](_0x565d16[_0x7e10('0x41')]);_0x3b45d7[_0x7e10('0x4a')]=_[_0x7e10('0x43')](_0x3b45d7[_0x7e10('0x3f')],_0x3b45d7[_0x7e10('0x41')]);_0x3bf59b[_0x7e10('0x44')]=_[_0x7e10('0x43')](_0x3b45d7['model'],qs['fields'](_0x565d16[_0x7e10('0x41')][_0x7e10('0x45')]));_0x3bf59b[_0x7e10('0x44')]=_0x3bf59b[_0x7e10('0x44')][_0x7e10('0x46')]?_0x3bf59b[_0x7e10('0x44')]:_0x3b45d7[_0x7e10('0x3f')];_0x3bf59b[_0x7e10('0x65')]=qs[_0x7e10('0x49')](_0x565d16['query'][_0x7e10('0x49')]);_0x3bf59b[_0x7e10('0x4d')]=qs[_0x7e10('0x4a')](_[_0x7e10('0x4b')](_0x565d16[_0x7e10('0x41')],_0x3b45d7[_0x7e10('0x4a')]));if(_0x565d16[_0x7e10('0x41')]['filter']){_0x3bf59b['where']=_[_0x7e10('0x4c')](_0x3bf59b['where'],{'$or':_[_0x7e10('0x40')](_0x3bf59b[_0x7e10('0x44')],function(_0x2f851f){var _0xa88a26={};_0xa88a26[_0x2f851f]={'$like':'%'+_0x565d16[_0x7e10('0x41')][_0x7e10('0x4f')]+'%'};return _0xa88a26;})});}_0x3bf59b=_['merge']({},_0x3bf59b,_0x565d16[_0x7e10('0x50')]);return _0x1ad392[_0x7e10('0xbf')](_0x3bf59b);}})[_0x7e10('0x34')](function(_0x534e74){if(_0x534e74){_0x74339f=_0x534e74[_0x7e10('0x46')];if(!_0x565d16[_0x7e10('0x41')][_0x7e10('0x47')]('nolimit')){_0x3bf59b[_0x7e10('0x2e')]=qs[_0x7e10('0x2e')](_0x565d16[_0x7e10('0x41')]['limit']);_0x3bf59b[_0x7e10('0x2d')]=qs[_0x7e10('0x2d')](_0x565d16[_0x7e10('0x41')][_0x7e10('0x2d')]);}return _0x1ad392[_0x7e10('0xbf')](_0x3bf59b);}})[_0x7e10('0x34')](function(_0x2dfee2){if(_0x2dfee2){return _0x2dfee2?{'count':_0x74339f,'rows':_0x2dfee2}:null;}})['then'](respondWithResult(_0x27e25a,null))['catch'](handleError(_0x27e25a,null));}; \ No newline at end of file +var _0xa41a=['catch','params','includeAll','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','rawAttributes','order','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','localstationid','app','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','Wait','/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','transaction','VoiceExtension','tech','updatedAt','ListId','findById','FaxMessage','$gte','split','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','set','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','send','index','Pause','mandatoryDispositionPause','map','fieldName','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','type','VIRTUAL','options','FaxAccount','count','findAll','rows'];(function(_0x1097d3,_0x93fb05){var _0x40143d=function(_0x1e0cf5){while(--_0x1e0cf5){_0x1097d3['push'](_0x1097d3['shift']());}};_0x40143d(++_0x93fb05);}(_0xa41a,0x6b));var _0xaa41=function(_0x2d62ee,_0x5dea37){_0x2d62ee=_0x2d62ee-0x0;var _0x338ddf=_0xa41a[_0x2d62ee];return _0x338ddf;};'use strict';var pdf=require(_0xaa41('0x0'));var emlformat=require(_0xaa41('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaa41('0x2'));var jsonpatch=require(_0xaa41('0x3'));var rp=require(_0xaa41('0x4'));var moment=require(_0xaa41('0x5'));var BPromise=require(_0xaa41('0x6'));var Mustache=require(_0xaa41('0x7'));var util=require(_0xaa41('0x8'));var path=require(_0xaa41('0x9'));var sox=require('sox');var csv=require(_0xaa41('0xa'));var ejs=require(_0xaa41('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xa'));var querystring=require(_0xaa41('0xe'));var Papa=require(_0xaa41('0xf'));var Redis=require(_0xaa41('0x10'));var authService=require(_0xaa41('0x11'));var qs=require(_0xaa41('0x12'));var as=require(_0xaa41('0x13'));var hardwareService=require(_0xaa41('0x14'));var logger=require(_0xaa41('0x15'))('api');var utils=require(_0xaa41('0x16'));var config=require(_0xaa41('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xaa41('0x18')]=_['defaults'](config[_0xaa41('0x18')],{'host':_0xaa41('0x19'),'port':0x18eb});var socket=require(_0xaa41('0x1a'))(new Redis(config[_0xaa41('0x18')]));require(_0xaa41('0x1b'))['register'](socket);var jayson=require(_0xaa41('0x1c'));var client=jayson[_0xaa41('0x1d')][_0xaa41('0x1e')]({'port':0x232c});var client9002=jayson[_0xaa41('0x1d')][_0xaa41('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2005ae,_0x1e1e02,_0x550ad5,_0x2d868a){return new BPromise(function(_0x16b930,_0x4210fa){var _0x391b01=_0x2d868a||client;return _0x391b01[_0xaa41('0x1f')](_0x2005ae,_0x550ad5)[_0xaa41('0x20')](function(_0x29efe5){logger[_0xaa41('0x21')](_0xaa41('0x22'),_0x1e1e02,'request\x20sent');logger['debug'](_0xaa41('0x23'),_0x1e1e02,_0xaa41('0x24'),JSON[_0xaa41('0x25')](_0x29efe5));if(_0x29efe5['error']){if(_0x29efe5[_0xaa41('0x26')][_0xaa41('0x27')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x1e1e02,_0x29efe5[_0xaa41('0x26')]['message']);return _0x4210fa(_0x29efe5[_0xaa41('0x26')][_0xaa41('0x28')]);}logger[_0xaa41('0x26')](_0xaa41('0x22'),_0x1e1e02,_0x29efe5[_0xaa41('0x26')]['message']);return _0x16b930(_0x29efe5[_0xaa41('0x26')][_0xaa41('0x28')]);}else{logger[_0xaa41('0x21')](_0xaa41('0x22'),_0x1e1e02,_0xaa41('0x24'));_0x16b930(_0x29efe5[_0xaa41('0x29')]['message']);}})['catch'](function(_0x16aec5){logger['error']('FaxAccount,\x20%s,\x20%s',_0x1e1e02,_0x16aec5);_0x4210fa(_0x16aec5);});});}function respondWithStatusCode(_0x12e362,_0x59707f){_0x59707f=_0x59707f||0xcc;return function(_0x536bed){if(_0x536bed){return _0x12e362[_0xaa41('0x2a')](_0x59707f);}return _0x12e362[_0xaa41('0x2b')](_0x59707f)[_0xaa41('0x2c')]();};}function respondWithResult(_0x632fd2,_0x3f5272){_0x3f5272=_0x3f5272||0xc8;return function(_0xa7269f){if(_0xa7269f){return _0x632fd2['status'](_0x3f5272)[_0xaa41('0x2d')](_0xa7269f);}};}function respondWithFilteredResult(_0x1f0275,_0x63c18c){return function(_0x9a16e3){if(_0x9a16e3){var _0x1d8c2b=_0x9a16e3['count'],_0x4466a3=_0x63c18c[_0xaa41('0x2e')],_0x30f88e=_0x63c18c['offset']+_0x63c18c['limit'],_0x104a95;if(_0x30f88e>=_0x1d8c2b){_0x30f88e=_0x1d8c2b;_0x104a95=0xc8;}else{_0x104a95=0xce;}_0x1f0275[_0xaa41('0x2b')](_0x104a95);return _0x1f0275[_0xaa41('0x2f')]('Content-Range',_0x4466a3+'-'+_0x30f88e+'/'+_0x1d8c2b)[_0xaa41('0x2d')](_0x9a16e3);}return null;};}function patchUpdates(_0x38f9fb){return function(_0x4e3b44){try{jsonpatch['apply'](_0x4e3b44,_0x38f9fb,!![]);}catch(_0x5c25fb){return BPromise[_0xaa41('0x30')](_0x5c25fb);}return _0x4e3b44[_0xaa41('0x31')]();};}function saveUpdates(_0x2a186e,_0x38afc4){return function(_0x58f203){if(_0x58f203){return _0x58f203[_0xaa41('0x32')](_0x2a186e)[_0xaa41('0x20')](function(_0x3e0204){return _0x3e0204;});}return null;};}function removeEntity(_0x4de770,_0x387c55){return function(_0xd8cd56){if(_0xd8cd56){return _0xd8cd56[_0xaa41('0x33')]()['then'](function(){var _0x252c62=_0xd8cd56[_0xaa41('0x34')]({'plain':!![]});var _0x57fe1d=_0xaa41('0x35');return db[_0xaa41('0x36')][_0xaa41('0x33')]({'where':{'type':_0x57fe1d,'resourceId':_0x252c62['id']}})['then'](function(){return _0xd8cd56;});})[_0xaa41('0x20')](function(){_0x4de770['status'](0xcc)[_0xaa41('0x2c')]();});}};}function handleEntityNotFound(_0x199b24,_0xf13742){return function(_0x49b77a){if(!_0x49b77a){_0x199b24['sendStatus'](0x194);}return _0x49b77a;};}function handleError(_0x4cdd42,_0x2dc05a){_0x2dc05a=_0x2dc05a||0x1f4;return function(_0x2e785f){logger[_0xaa41('0x26')](_0x2e785f[_0xaa41('0x37')]);if(_0x2e785f['name']){delete _0x2e785f['name'];}_0x4cdd42[_0xaa41('0x2b')](_0x2dc05a)[_0xaa41('0x38')](_0x2e785f);};}exports[_0xaa41('0x39')]=function(_0x4e8d2e,_0xba115a){var _0x203d83={'include':[{'model':db[_0xaa41('0x3a')],'as':_0xaa41('0x3b')}]},_0x44a4fc={},_0x5e9879={'count':0x0,'rows':[]};var _0x5caf76=_[_0xaa41('0x3c')](db['FaxAccount']['rawAttributes'],function(_0x42b759){return{'name':_0x42b759[_0xaa41('0x3d')],'type':_0x42b759['type'][_0xaa41('0x3e')]};});_0x44a4fc['model']=_[_0xaa41('0x3c')](_0x5caf76,_0xaa41('0x3f'));_0x44a4fc[_0xaa41('0x40')]=_[_0xaa41('0x41')](_0x4e8d2e[_0xaa41('0x40')]);_0x44a4fc[_0xaa41('0x42')]=_[_0xaa41('0x43')](_0x44a4fc[_0xaa41('0x44')],_0x44a4fc['query']);_0x203d83[_0xaa41('0x45')]=_[_0xaa41('0x43')](_0x44a4fc[_0xaa41('0x44')],qs[_0xaa41('0x46')](_0x4e8d2e[_0xaa41('0x40')][_0xaa41('0x46')]));_0x203d83['attributes']=_0x203d83['attributes'][_0xaa41('0x47')]?_0x203d83['attributes']:_0x44a4fc[_0xaa41('0x44')];if(!_0x4e8d2e[_0xaa41('0x40')][_0xaa41('0x48')](_0xaa41('0x49'))){_0x203d83[_0xaa41('0x4a')]=qs[_0xaa41('0x4a')](_0x4e8d2e[_0xaa41('0x40')]['limit']);_0x203d83[_0xaa41('0x2e')]=qs['offset'](_0x4e8d2e['query'][_0xaa41('0x2e')]);}_0x203d83['order']=qs['sort'](_0x4e8d2e['query'][_0xaa41('0x4b')]);_0x203d83['where']=qs[_0xaa41('0x42')](_[_0xaa41('0x4c')](_0x4e8d2e['query'],_0x44a4fc['filters']),_0x5caf76);if(_0x4e8d2e[_0xaa41('0x40')][_0xaa41('0x4d')]){_0x203d83[_0xaa41('0x4e')]=_[_0xaa41('0x4f')](_0x203d83[_0xaa41('0x4e')],{'$or':_[_0xaa41('0x3c')](_0x5caf76,function(_0x258096){if(_0x258096[_0xaa41('0x50')]!==_0xaa41('0x51')){var _0x4e1ac4={};_0x4e1ac4[_0x258096[_0xaa41('0x3f')]]={'$like':'%'+_0x4e8d2e[_0xaa41('0x40')][_0xaa41('0x4d')]+'%'};return _0x4e1ac4;}})});}_0x203d83=_[_0xaa41('0x4f')]({},_0x203d83,_0x4e8d2e[_0xaa41('0x52')]);var _0x1d6112={'where':_0x203d83['where']};return db[_0xaa41('0x53')][_0xaa41('0x54')](_0x1d6112)[_0xaa41('0x20')](function(_0x2288f8){_0x5e9879['count']=_0x2288f8;if(_0x4e8d2e[_0xaa41('0x40')]['includeAll']){_0x203d83['include']=[{'all':!![]}];}return db[_0xaa41('0x53')][_0xaa41('0x55')](_0x203d83);})[_0xaa41('0x20')](function(_0x4ca114){_0x5e9879[_0xaa41('0x56')]=_0x4ca114;return _0x5e9879;})[_0xaa41('0x20')](respondWithFilteredResult(_0xba115a,_0x203d83))[_0xaa41('0x57')](handleError(_0xba115a,null));};exports['show']=function(_0x321cc3,_0x3c4f24){var _0x2c68b3={'raw':![],'where':{'id':_0x321cc3[_0xaa41('0x58')]['id']},'include':[{'model':db[_0xaa41('0x3a')],'as':_0xaa41('0x3b')}]},_0x1378f9={};_0x1378f9[_0xaa41('0x44')]=_['keys'](db[_0xaa41('0x53')]['rawAttributes']);_0x1378f9['query']=_[_0xaa41('0x41')](_0x321cc3[_0xaa41('0x40')]);_0x1378f9[_0xaa41('0x42')]=_[_0xaa41('0x43')](_0x1378f9[_0xaa41('0x44')],_0x1378f9[_0xaa41('0x40')]);_0x2c68b3[_0xaa41('0x45')]=_[_0xaa41('0x43')](_0x1378f9['model'],qs[_0xaa41('0x46')](_0x321cc3[_0xaa41('0x40')][_0xaa41('0x46')]));_0x2c68b3['attributes']=_0x2c68b3[_0xaa41('0x45')][_0xaa41('0x47')]?_0x2c68b3['attributes']:_0x1378f9[_0xaa41('0x44')];if(_0x321cc3[_0xaa41('0x40')][_0xaa41('0x59')]){_0x2c68b3['include']=[{'all':!![]}];}_0x2c68b3=_[_0xaa41('0x4f')]({},_0x2c68b3,_0x321cc3[_0xaa41('0x52')]);return db['FaxAccount']['find'](_0x2c68b3)[_0xaa41('0x20')](handleEntityNotFound(_0x3c4f24,null))[_0xaa41('0x20')](respondWithResult(_0x3c4f24,null))[_0xaa41('0x57')](handleError(_0x3c4f24,null));};exports['create']=function(_0x5a76b9,_0x137f3f){return db[_0xaa41('0x53')][_0xaa41('0x5a')](_0x5a76b9[_0xaa41('0x5b')],{})['then'](function(_0x2ae70c){var _0x57cb70=_0x5a76b9['user'][_0xaa41('0x34')]({'plain':!![]});if(!_0x57cb70)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57cb70[_0xaa41('0x5c')]===_0xaa41('0x5d')){var _0x169ddf=_0x2ae70c['get']({'plain':!![]});var _0x12ba1b=_0xaa41('0x35');return db[_0xaa41('0x5e')][_0xaa41('0x5f')]({'where':{'name':_0x12ba1b,'userProfileId':_0x57cb70[_0xaa41('0x60')]},'raw':!![]})[_0xaa41('0x20')](function(_0xc56018){if(_0xc56018&&_0xc56018[_0xaa41('0x61')]===0x0){return db[_0xaa41('0x36')]['create']({'name':_0x169ddf[_0xaa41('0x3f')],'resourceId':_0x169ddf['id'],'type':_0xc56018[_0xaa41('0x3f')],'sectionId':_0xc56018['id']},{})[_0xaa41('0x20')](function(){return _0x2ae70c;});}else{return _0x2ae70c;}})['catch'](function(_0x3fe47a){logger[_0xaa41('0x26')](_0xaa41('0x62'),_0x3fe47a);throw _0x3fe47a;});}return _0x2ae70c;})[_0xaa41('0x20')](respondWithResult(_0x137f3f,0xc9))[_0xaa41('0x57')](handleError(_0x137f3f,null));};exports[_0xaa41('0x32')]=function(_0x320ce7,_0x5ea056){if(_0x320ce7['body']['id']){delete _0x320ce7['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x320ce7['params']['id']},'include':[{'model':db[_0xaa41('0x3a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x5ea056,null))[_0xaa41('0x20')](saveUpdates(_0x320ce7[_0xaa41('0x5b')],null))[_0xaa41('0x20')](respondWithResult(_0x5ea056,null))[_0xaa41('0x57')](handleError(_0x5ea056,null));};exports['destroy']=function(_0x244d41,_0x2a8313){return db[_0xaa41('0x53')][_0xaa41('0x5f')]({'where':{'id':_0x244d41[_0xaa41('0x58')]['id']}})[_0xaa41('0x20')](handleEntityNotFound(_0x2a8313,null))[_0xaa41('0x20')](removeEntity(_0x2a8313,null))[_0xaa41('0x57')](handleError(_0x2a8313,null));};exports[_0xaa41('0x63')]=function(_0x54344c,_0x185600){return db[_0xaa41('0x53')]['describe']()['then'](respondWithResult(_0x185600,null))['catch'](handleError(_0x185600,null));};exports[_0xaa41('0x64')]=function(_0x5e71e5,_0x1eac4a,_0x5c8028){if(_0x5e71e5[_0xaa41('0x5b')]['id']){delete _0x5e71e5[_0xaa41('0x5b')]['id'];}return db['FaxAccount'][_0xaa41('0x5f')]({'where':{'id':_0x5e71e5[_0xaa41('0x58')]['id']}})[_0xaa41('0x20')](handleEntityNotFound(_0x1eac4a,null))[_0xaa41('0x20')](function(_0x5a2683){if(_0x5a2683){_0x5e71e5['body'][_0xaa41('0x65')]=_0x5a2683['id'];return db[_0xaa41('0x66')]['create'](_0x5e71e5['body']);}})[_0xaa41('0x20')](respondWithResult(_0x1eac4a,null))[_0xaa41('0x57')](handleError(_0x1eac4a,null));};exports[_0xaa41('0x67')]=function(_0xbeafb5,_0x3dbe37,_0x5a385e){var _0x475ceb={'raw':![],'where':{}};var _0x4c61d0={};var _0x5062db={'count':0x0,'rows':[]};return db['FaxAccount'][_0xaa41('0x68')]({'where':{'id':_0xbeafb5[_0xaa41('0x58')]['id']}})[_0xaa41('0x20')](handleEntityNotFound(_0x3dbe37,null))['then'](function(_0x229297){if(_0x229297){_0x4c61d0[_0xaa41('0x44')]=_[_0xaa41('0x41')](db[_0xaa41('0x66')][_0xaa41('0x69')]);_0x4c61d0[_0xaa41('0x40')]=_[_0xaa41('0x41')](_0xbeafb5['query']);_0x4c61d0[_0xaa41('0x42')]=_[_0xaa41('0x43')](_0x4c61d0[_0xaa41('0x44')],_0x4c61d0[_0xaa41('0x40')]);_0x475ceb['attributes']=_[_0xaa41('0x43')](_0x4c61d0['model'],qs[_0xaa41('0x46')](_0xbeafb5[_0xaa41('0x40')][_0xaa41('0x46')]));_0x475ceb[_0xaa41('0x45')]=_0x475ceb['attributes'][_0xaa41('0x47')]?_0x475ceb[_0xaa41('0x45')]:_0x4c61d0[_0xaa41('0x44')];if(!_0xbeafb5[_0xaa41('0x40')]['hasOwnProperty'](_0xaa41('0x49'))){_0x475ceb['limit']=qs[_0xaa41('0x4a')](_0xbeafb5[_0xaa41('0x40')]['limit']);_0x475ceb[_0xaa41('0x2e')]=qs[_0xaa41('0x2e')](_0xbeafb5[_0xaa41('0x40')][_0xaa41('0x2e')]);}_0x475ceb[_0xaa41('0x6a')]=qs[_0xaa41('0x4b')](_0xbeafb5[_0xaa41('0x40')][_0xaa41('0x4b')]);_0x475ceb[_0xaa41('0x4e')]=qs[_0xaa41('0x42')](_[_0xaa41('0x4c')](_0xbeafb5['query'],_0x4c61d0[_0xaa41('0x42')]));_0x475ceb[_0xaa41('0x4e')][_0xaa41('0x65')]=_0x229297['id'];if(_0xbeafb5['query']['filter']){_0x475ceb[_0xaa41('0x4e')]=_[_0xaa41('0x4f')](_0x475ceb['where'],{'$or':_[_0xaa41('0x3c')](_0x475ceb[_0xaa41('0x45')],function(_0x550b09){var _0x305050={};_0x305050[_0x550b09]={'$like':'%'+_0xbeafb5[_0xaa41('0x40')][_0xaa41('0x4d')]+'%'};return _0x305050;})});}_0x475ceb=_[_0xaa41('0x4f')]({},_0x475ceb,_0xbeafb5[_0xaa41('0x52')]);return db[_0xaa41('0x66')][_0xaa41('0x54')]({'where':_0x475ceb[_0xaa41('0x4e')]})['then'](function(_0x4d0390){_0x5062db[_0xaa41('0x54')]=_0x4d0390;if(_0xbeafb5['query'][_0xaa41('0x59')]){_0x475ceb[_0xaa41('0x6b')]=[{'all':!![]}];}return db[_0xaa41('0x66')]['findAll'](_0x475ceb);})[_0xaa41('0x20')](function(_0x404c38){_0x5062db[_0xaa41('0x56')]=_0x404c38;return _0x5062db;});}})['then'](respondWithFilteredResult(_0x3dbe37,_0x475ceb))[_0xaa41('0x57')](handleError(_0x3dbe37,null));};exports[_0xaa41('0x6c')]=function(_0x5bd574,_0x3a93bc,_0x4de25c){return db['FaxAccount'][_0xaa41('0x5f')]({'where':{'id':_0x5bd574[_0xaa41('0x58')]['id']}})['then'](handleEntityNotFound(_0x3a93bc,null))['then'](function(_0x241e1a){if(_0x241e1a){return _0x241e1a[_0xaa41('0x6c')](_0x5bd574[_0xaa41('0x40')][_0xaa41('0x6d')]);}})['then'](respondWithStatusCode(_0x3a93bc,null))[_0xaa41('0x57')](handleError(_0x3a93bc,null));};exports[_0xaa41('0x6e')]=function(_0x473486,_0x5e6c0b,_0x1ad3aa){if(_0x473486[_0xaa41('0x5b')]['id']){delete _0x473486[_0xaa41('0x5b')]['id'];}return db['FaxAccount'][_0xaa41('0x5f')]({'where':{'id':_0x473486['params']['id']}})['then'](handleEntityNotFound(_0x5e6c0b,null))[_0xaa41('0x20')](function(_0x25c4d0){if(_0x25c4d0){_0x473486['body'][_0xaa41('0x65')]=_0x25c4d0['id'];return db[_0xaa41('0x6f')][_0xaa41('0x5a')](_0x473486['body']);}})[_0xaa41('0x20')](respondWithResult(_0x5e6c0b,null))[_0xaa41('0x57')](handleError(_0x5e6c0b,null));};exports[_0xaa41('0x70')]=function(_0x16dcac,_0x38f5d0,_0x4e087d){var _0x24eb2e={'raw':![],'where':{}};var _0x5c4e73={};var _0x452143={'count':0x0,'rows':[]};return db[_0xaa41('0x53')][_0xaa41('0x68')]({'where':{'id':_0x16dcac[_0xaa41('0x58')]['id']}})[_0xaa41('0x20')](handleEntityNotFound(_0x38f5d0,null))[_0xaa41('0x20')](function(_0x404180){if(_0x404180){_0x5c4e73[_0xaa41('0x44')]=_[_0xaa41('0x41')](db[_0xaa41('0x6f')][_0xaa41('0x69')]);_0x5c4e73['query']=_[_0xaa41('0x41')](_0x16dcac[_0xaa41('0x40')]);_0x5c4e73['filters']=_[_0xaa41('0x43')](_0x5c4e73['model'],_0x5c4e73[_0xaa41('0x40')]);_0x24eb2e[_0xaa41('0x45')]=_[_0xaa41('0x43')](_0x5c4e73[_0xaa41('0x44')],qs[_0xaa41('0x46')](_0x16dcac[_0xaa41('0x40')][_0xaa41('0x46')]));_0x24eb2e['attributes']=_0x24eb2e[_0xaa41('0x45')][_0xaa41('0x47')]?_0x24eb2e[_0xaa41('0x45')]:_0x5c4e73[_0xaa41('0x44')];if(!_0x16dcac['query'][_0xaa41('0x48')]('nolimit')){_0x24eb2e[_0xaa41('0x4a')]=qs[_0xaa41('0x4a')](_0x16dcac[_0xaa41('0x40')][_0xaa41('0x4a')]);_0x24eb2e[_0xaa41('0x2e')]=qs['offset'](_0x16dcac[_0xaa41('0x40')][_0xaa41('0x2e')]);}_0x24eb2e['order']=qs[_0xaa41('0x4b')](_0x16dcac[_0xaa41('0x40')][_0xaa41('0x4b')]);_0x24eb2e[_0xaa41('0x4e')]=qs[_0xaa41('0x42')](_[_0xaa41('0x4c')](_0x16dcac[_0xaa41('0x40')],_0x5c4e73[_0xaa41('0x42')]));_0x24eb2e['where'][_0xaa41('0x65')]=_0x404180['id'];if(_0x16dcac[_0xaa41('0x40')][_0xaa41('0x4d')]){_0x24eb2e[_0xaa41('0x4e')]=_[_0xaa41('0x4f')](_0x24eb2e[_0xaa41('0x4e')],{'$or':_['map'](_0x24eb2e['attributes'],function(_0x4c2790){var _0x455c94={};_0x455c94[_0x4c2790]={'$like':'%'+_0x16dcac[_0xaa41('0x40')]['filter']+'%'};return _0x455c94;})});}_0x24eb2e=_[_0xaa41('0x4f')]({},_0x24eb2e,_0x16dcac[_0xaa41('0x52')]);return db['CannedAnswer'][_0xaa41('0x54')]({'where':_0x24eb2e[_0xaa41('0x4e')]})[_0xaa41('0x20')](function(_0x57f67){_0x452143['count']=_0x57f67;if(_0x16dcac[_0xaa41('0x40')]['includeAll']){_0x24eb2e[_0xaa41('0x6b')]=[{'all':!![]}];}return db[_0xaa41('0x6f')][_0xaa41('0x55')](_0x24eb2e);})[_0xaa41('0x20')](function(_0x16a8f9){_0x452143[_0xaa41('0x56')]=_0x16a8f9;return _0x452143;});}})[_0xaa41('0x20')](respondWithFilteredResult(_0x38f5d0,_0x24eb2e))[_0xaa41('0x57')](handleError(_0x38f5d0,null));};exports[_0xaa41('0x71')]=function(_0x5381d5,_0x276013,_0x3135c3){return db[_0xaa41('0x53')]['find']({'where':{'id':_0x5381d5[_0xaa41('0x58')]['id']}})[_0xaa41('0x20')](handleEntityNotFound(_0x276013,null))[_0xaa41('0x20')](function(_0x408d95){if(_0x408d95){return _0x408d95[_0xaa41('0x71')](_0x5381d5[_0xaa41('0x40')][_0xaa41('0x6d')]);}})[_0xaa41('0x20')](respondWithStatusCode(_0x276013,null))[_0xaa41('0x57')](handleError(_0x276013,null));};exports[_0xaa41('0x72')]=function(_0x169845,_0x4f7483,_0x30f2a8){return db[_0xaa41('0x73')][_0xaa41('0x5f')]({'where':{'id':_0x169845[_0xaa41('0x58')]['id']}})[_0xaa41('0x20')](handleEntityNotFound(_0x4f7483,null))['then'](function(_0x4ba5d2){if(_0x4ba5d2){return _0x4ba5d2[_0xaa41('0x72')](_0x169845[_0xaa41('0x5b')]['ids'],_[_0xaa41('0x74')](_0x169845[_0xaa41('0x5b')],['ids','id'])||{});}})['then'](respondWithResult(_0x4f7483,null))['catch'](handleError(_0x4f7483,null));};exports[_0xaa41('0x75')]=function(_0x3c9bd8,_0x20c126,_0x382740){var _0x29880f={'raw':![],'where':{}};var _0xedd5d1={};var _0x3d4322={'count':0x0,'rows':[]};return db[_0xaa41('0x53')][_0xaa41('0x68')]({'where':{'id':_0x3c9bd8[_0xaa41('0x58')]['id']}})[_0xaa41('0x20')](handleEntityNotFound(_0x20c126,null))['then'](function(_0x5efa2e){if(_0x5efa2e){_0xedd5d1[_0xaa41('0x44')]=_[_0xaa41('0x41')](db['FaxInteraction'][_0xaa41('0x69')]);_0xedd5d1['query']=_[_0xaa41('0x41')](_0x3c9bd8[_0xaa41('0x40')]);_0xedd5d1[_0xaa41('0x42')]=_[_0xaa41('0x43')](_0xedd5d1[_0xaa41('0x44')],_0xedd5d1[_0xaa41('0x40')]);_0x29880f[_0xaa41('0x45')]=_[_0xaa41('0x43')](_0xedd5d1[_0xaa41('0x44')],qs['fields'](_0x3c9bd8['query']['fields']));_0x29880f[_0xaa41('0x45')]=_0x29880f[_0xaa41('0x45')]['length']?_0x29880f['attributes']:_0xedd5d1[_0xaa41('0x44')];if(!_0x3c9bd8[_0xaa41('0x40')]['hasOwnProperty']('nolimit')){_0x29880f[_0xaa41('0x4a')]=qs['limit'](_0x3c9bd8[_0xaa41('0x40')][_0xaa41('0x4a')]);_0x29880f[_0xaa41('0x2e')]=qs[_0xaa41('0x2e')](_0x3c9bd8[_0xaa41('0x40')][_0xaa41('0x2e')]);}_0x29880f[_0xaa41('0x6a')]=qs[_0xaa41('0x4b')](_0x3c9bd8[_0xaa41('0x40')]['sort']);_0x29880f['where']=qs[_0xaa41('0x42')](_[_0xaa41('0x4c')](_0x3c9bd8[_0xaa41('0x40')],_0xedd5d1[_0xaa41('0x42')]));_0x29880f[_0xaa41('0x4e')][_0xaa41('0x65')]=_0x5efa2e['id'];if(_0x3c9bd8[_0xaa41('0x40')][_0xaa41('0x4d')]){_0x29880f[_0xaa41('0x4e')]=_[_0xaa41('0x4f')](_0x29880f[_0xaa41('0x4e')],{'$or':_[_0xaa41('0x3c')](_0x29880f[_0xaa41('0x45')],function(_0x34c865){var _0x1804e4={};_0x1804e4[_0x34c865]={'$like':'%'+_0x3c9bd8['query'][_0xaa41('0x4d')]+'%'};return _0x1804e4;})});}_0x29880f=_['merge']({},_0x29880f,_0x3c9bd8[_0xaa41('0x52')]);return db[_0xaa41('0x73')][_0xaa41('0x54')]({'where':_0x29880f[_0xaa41('0x4e')]})[_0xaa41('0x20')](function(_0x2516da){_0x3d4322[_0xaa41('0x54')]=_0x2516da;if(_0x3c9bd8[_0xaa41('0x40')]['includeAll']){_0x29880f[_0xaa41('0x6b')]=[{'model':db[_0xaa41('0x76')],'as':_0xaa41('0x77'),'required':![]},{'model':db[_0xaa41('0x78')],'as':_0xaa41('0x79'),'attributes':[_0xaa41('0x3f'),_0xaa41('0x7a'),_0xaa41('0x7b')],'required':![]},{'model':db[_0xaa41('0x7c')],'as':_0xaa41('0x7d'),'attributes':['id','name','color'],'where':_0x3c9bd8[_0xaa41('0x40')][_0xaa41('0x7e')]?{'id':_0x3c9bd8[_0xaa41('0x40')][_0xaa41('0x7e')]}:undefined,'required':_0x3c9bd8[_0xaa41('0x40')][_0xaa41('0x7e')]?!![]:![]}];}return db[_0xaa41('0x73')][_0xaa41('0x55')](_0x29880f);})[_0xaa41('0x20')](function(_0x87485a){_0x3d4322['rows']=_0x87485a;return _0x3d4322;});}})['then'](respondWithFilteredResult(_0x20c126,_0x29880f))[_0xaa41('0x57')](handleError(_0x20c126,null));};exports[_0xaa41('0x7f')]=function(_0x541d00,_0x148ab5,_0x56f91e){return db[_0xaa41('0x53')][_0xaa41('0x68')]({'where':{'id':_0x541d00['params']['id']}})['then'](handleEntityNotFound(_0x148ab5,null))[_0xaa41('0x20')](function(_0x3d7b64){if(_0x3d7b64){return db[_0xaa41('0x80')]['transaction'](function(_0x5151f9){return db[_0xaa41('0x81')]['destroy']({'where':{'FaxAccountId':_0x541d00[_0xaa41('0x58')]['id']},'transaction':_0x5151f9})['then'](function(_0x37dc6f){var _0x17a97b=_[_0xaa41('0x3c')](_0x541d00[_0xaa41('0x5b')],function(_0x182b0b){_0x182b0b[_0xaa41('0x65')]=_0x541d00[_0xaa41('0x58')]['id'];return _0x182b0b;});return db['FaxApplication'][_0xaa41('0x82')](_0x17a97b,{'transaction':_0x5151f9});});})[_0xaa41('0x20')](function(){return db['FaxApplication'][_0xaa41('0x83')]({'where':{'FaxAccountId':_0x541d00[_0xaa41('0x58')]['id']},'order':_0xaa41('0x84')});});}})[_0xaa41('0x20')](respondWithResult(_0x148ab5,null))['catch'](handleError(_0x148ab5,null));};exports[_0xaa41('0x85')]=function(_0x364dc2,_0x43554a,_0x297df5){var _0x89b020={};var _0x186a52={};var _0x1e5116;var _0xa61116;return db[_0xaa41('0x53')]['findOne']({'where':{'id':_0x364dc2['params']['id']}})[_0xaa41('0x20')](handleEntityNotFound(_0x43554a,null))[_0xaa41('0x20')](function(_0x21b92f){if(_0x21b92f){_0x1e5116=_0x21b92f;_0x186a52[_0xaa41('0x44')]=_[_0xaa41('0x41')](db[_0xaa41('0x81')]['rawAttributes']);_0x186a52[_0xaa41('0x40')]=_[_0xaa41('0x41')](_0x364dc2[_0xaa41('0x40')]);_0x186a52[_0xaa41('0x42')]=_[_0xaa41('0x43')](_0x186a52[_0xaa41('0x44')],_0x186a52['query']);_0x89b020[_0xaa41('0x45')]=_[_0xaa41('0x43')](_0x186a52[_0xaa41('0x44')],qs['fields'](_0x364dc2[_0xaa41('0x40')][_0xaa41('0x46')]));_0x89b020[_0xaa41('0x45')]=_0x89b020[_0xaa41('0x45')][_0xaa41('0x47')]?_0x89b020[_0xaa41('0x45')]:_0x186a52[_0xaa41('0x44')];_0x89b020[_0xaa41('0x6a')]=qs[_0xaa41('0x4b')](_0x364dc2[_0xaa41('0x40')][_0xaa41('0x4b')]);_0x89b020[_0xaa41('0x4e')]=qs[_0xaa41('0x42')](_['pick'](_0x364dc2['query'],_0x186a52[_0xaa41('0x42')]));if(_0x364dc2[_0xaa41('0x40')][_0xaa41('0x4d')]){_0x89b020[_0xaa41('0x4e')]=_[_0xaa41('0x4f')](_0x89b020[_0xaa41('0x4e')],{'$or':_[_0xaa41('0x3c')](_0x89b020['attributes'],function(_0x32938f){var _0x19cba1={};_0x19cba1[_0x32938f]={'$like':'%'+_0x364dc2[_0xaa41('0x40')][_0xaa41('0x4d')]+'%'};return _0x19cba1;})});}_0x89b020=_[_0xaa41('0x4f')]({},_0x89b020,_0x364dc2[_0xaa41('0x52')]);return _0x1e5116[_0xaa41('0x85')](_0x89b020);}})[_0xaa41('0x20')](function(_0x1aac0c){if(_0x1aac0c){_0xa61116=_0x1aac0c[_0xaa41('0x47')];if(!_0x364dc2[_0xaa41('0x40')][_0xaa41('0x48')]('nolimit')){_0x89b020[_0xaa41('0x4a')]=qs[_0xaa41('0x4a')](_0x364dc2['query'][_0xaa41('0x4a')]);_0x89b020[_0xaa41('0x2e')]=qs[_0xaa41('0x2e')](_0x364dc2[_0xaa41('0x40')]['offset']);}return _0x1e5116[_0xaa41('0x85')](_0x89b020);}})[_0xaa41('0x20')](function(_0xdc64b0){if(_0xdc64b0){return _0xdc64b0?{'count':_0xa61116,'rows':_0xdc64b0}:null;}})[_0xaa41('0x20')](respondWithResult(_0x43554a,null))[_0xaa41('0x57')](handleError(_0x43554a,null));};function Extension(_0x4baae3,_0xc59a12,_0x59aa7a,_0x50a526){this[_0xaa41('0x86')]='from-voip-provider';this['exten']=_0x4baae3[_0xaa41('0x87')];this[_0xaa41('0x88')]=_0x50a526;this[_0xaa41('0x50')]='system';this[_0xaa41('0x89')]=_0xaa41('0x8a');this[_0xaa41('0x65')]=_0x4baae3['id'];this[_0xaa41('0x84')]=_0xc59a12;this[_0xaa41('0x8b')]=_0x59aa7a;}function createExtensionsReciveFax(_0x178401){var _0x29d34a=0x1;var _0x3efa92=[];_0x3efa92['push'](new Extension(_0x178401,_0x29d34a,'',_0xaa41('0x8c')));_0x29d34a+=0x1;_0x3efa92[_0xaa41('0x8d')](new Extension(_0x178401,_0x29d34a,_0xaa41('0x8e'),_0xaa41('0x8f')));_0x29d34a+=0x1;for(var _0x284fee in _0x178401){if(_0x178401['hasOwnProperty'](_0x284fee)&&(_0x284fee==='ecm'||_0x284fee===_0xaa41('0x87')||_0x284fee===_0xaa41('0x90')||_0x284fee===_0xaa41('0x91')||_0x284fee===_0xaa41('0x92')||_0x284fee===_0xaa41('0x93')||_0x284fee===_0xaa41('0x94')||_0x284fee==='modem'||_0x284fee===_0xaa41('0x95'))){_0x3efa92[_0xaa41('0x8d')](new Extension(_0x178401,_0x29d34a,'FAXOPT('+_0x284fee+')='+_0x178401[_0x284fee],_0xaa41('0x8f')));_0x29d34a+=0x1;}}_0x3efa92[_0xaa41('0x8d')](new Extension(_0x178401,_0x29d34a,'6',_0xaa41('0x96')));_0x29d34a+=0x1;_0x3efa92[_0xaa41('0x8d')](new Extension(_0x178401,_0x29d34a,_0xaa41('0x97'),_0xaa41('0x98')));_0x29d34a=0x0;return _0x3efa92;}exports[_0xaa41('0x99')]=function(_0x5c8325,_0x3fc075,_0x28cd20){var _0x5404cd;return db[_0xaa41('0x80')][_0xaa41('0x9a')](function(_0x18de40){return db[_0xaa41('0x53')]['create'](_0x5c8325[_0xaa41('0x5b')],{'transaction':_0x18de40})[_0xaa41('0x20')](function(_0x339537){_0x5404cd=_0x339537[_0xaa41('0x34')]({'plain':!![]});return db[_0xaa41('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x5404cd),{'transaction':_0x18de40});});})[_0xaa41('0x20')](function(){return _0x5404cd;})[_0xaa41('0x20')](respondWithResult(_0x3fc075,null))['catch'](handleError(_0x3fc075,null));};exports['updateAccountApplications']=function(_0x456c57,_0x3125df,_0x296f9d){var _0x1df848;return db[_0xaa41('0x80')][_0xaa41('0x9a')](function(_0x5ad0e5){return db['FaxAccount'][_0xaa41('0x32')](_0x456c57[_0xaa41('0x5b')],{'where':{'id':_0x456c57['body']['id']},'transaction':_0x5ad0e5})['then'](function(_0x38f4fc){return db[_0xaa41('0x9b')][_0xaa41('0x33')]({'where':{'FaxAccountId':_0x456c57['body']['id']},'transaction':_0x5ad0e5})['then'](function(_0x1d609e){return db[_0xaa41('0x9b')][_0xaa41('0x82')](createExtensionsReciveFax(_['omit'](_0x456c57[_0xaa41('0x5b')],[_0xaa41('0x9c'),'key','createdAt',_0xaa41('0x9d'),'TrunkId',_0xaa41('0x9e')])),{'transaction':_0x5ad0e5});});});})[_0xaa41('0x20')](function(){return db[_0xaa41('0x53')][_0xaa41('0x9f')](_0x456c57[_0xaa41('0x5b')]['id']);})[_0xaa41('0x20')](respondWithResult(_0x3125df,null))[_0xaa41('0x57')](handleError(_0x3125df,null));};exports['getMessages']=function(_0x3847ea,_0x17623e,_0x5534ef){var _0x44f1f2={'raw':!![],'where':{}};var _0x3e3e7c={};var _0x2062fe={'count':0x0,'rows':[]};return db[_0xaa41('0x53')][_0xaa41('0x68')]({'where':{'id':_0x3847ea[_0xaa41('0x58')]['id']}})['then'](handleEntityNotFound(_0x17623e,null))[_0xaa41('0x20')](function(_0x10ba7b){if(_0x10ba7b){_0x3e3e7c[_0xaa41('0x44')]=_[_0xaa41('0x41')](db[_0xaa41('0xa0')][_0xaa41('0x69')]);_0x3e3e7c[_0xaa41('0x40')]=_['keys'](_0x3847ea[_0xaa41('0x40')]);_0x3e3e7c[_0xaa41('0x42')]=_[_0xaa41('0x43')](_0x3e3e7c['model'],_0x3e3e7c['query']);_0x44f1f2['attributes']=_[_0xaa41('0x43')](_0x3e3e7c[_0xaa41('0x44')],qs[_0xaa41('0x46')](_0x3847ea[_0xaa41('0x40')][_0xaa41('0x46')]));_0x44f1f2['attributes']=_0x44f1f2[_0xaa41('0x45')][_0xaa41('0x47')]?_0x44f1f2[_0xaa41('0x45')]:_0x3e3e7c[_0xaa41('0x44')];if(!_0x3847ea[_0xaa41('0x40')][_0xaa41('0x48')](_0xaa41('0x49'))){_0x44f1f2['limit']=qs[_0xaa41('0x4a')](_0x3847ea[_0xaa41('0x40')][_0xaa41('0x4a')]);_0x44f1f2['offset']=qs[_0xaa41('0x2e')](_0x3847ea['query']['offset']);}_0x44f1f2[_0xaa41('0x6a')]=qs['sort'](_0x3847ea[_0xaa41('0x40')][_0xaa41('0x4b')]);_0x44f1f2[_0xaa41('0x4e')]=qs[_0xaa41('0x42')](_[_0xaa41('0x4c')](_0x3847ea[_0xaa41('0x40')],_0x3e3e7c[_0xaa41('0x42')]));_0x44f1f2['where'][_0xaa41('0x65')]=_0x10ba7b['id'];if(_0x3847ea[_0xaa41('0x40')][_0xaa41('0x4d')]){_0x44f1f2[_0xaa41('0x4e')]=_[_0xaa41('0x4f')](_0x44f1f2[_0xaa41('0x4e')],{'$or':_[_0xaa41('0x3c')](_0x44f1f2[_0xaa41('0x45')],function(_0x339387){var _0x3bfdee={};_0x3bfdee[_0x339387]={'$like':'%'+_0x3847ea[_0xaa41('0x40')][_0xaa41('0x4d')]+'%'};return _0x3bfdee;})});}if(_0x3847ea[_0xaa41('0x40')][_0xaa41('0xa1')]){var _0xc0c546=_0x3847ea[_0xaa41('0x40')]['$gte'][_0xaa41('0xa2')](',');var _0x4d26a0={};_0x4d26a0[_0xc0c546[0x0]]={'$gte':moment(_0xc0c546[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x44f1f2[_0xaa41('0x4e')]=_[_0xaa41('0x4f')](_0x44f1f2['where'],_0x4d26a0);}_0x44f1f2=_[_0xaa41('0x4f')]({},_0x44f1f2,_0x3847ea[_0xaa41('0x52')]);return db[_0xaa41('0xa0')][_0xaa41('0x54')]({'where':_0x44f1f2[_0xaa41('0x4e')]})[_0xaa41('0x20')](function(_0x239f1b){_0x2062fe[_0xaa41('0x54')]=_0x239f1b;if(_0x3847ea[_0xaa41('0x40')][_0xaa41('0x59')]){_0x44f1f2[_0xaa41('0x6b')]=[{'all':!![]}];}return db[_0xaa41('0xa0')][_0xaa41('0x55')](_0x44f1f2);})[_0xaa41('0x20')](function(_0x7bae82){_0x2062fe[_0xaa41('0x56')]=_0x7bae82;return _0x2062fe;});}})[_0xaa41('0x20')](respondWithFilteredResult(_0x17623e,_0x44f1f2))['catch'](handleError(_0x17623e,null));};exports[_0xaa41('0x38')]=function(_0x427b99,_0x154828,_0x2c3dd2){var _0x4973f5,_0x58a097={},_0x304c3e;if(_0x427b99['body']['to']){_0x304c3e=_0x427b99[_0xaa41('0x5b')]['to'][0x0];}return db[_0xaa41('0x53')][_0xaa41('0x5f')]({'where':{'id':_0x427b99[_0xaa41('0x58')]['id']},'include':[{'model':db[_0xaa41('0xa3')],'as':_0xaa41('0xa4'),'include':[{'model':db[_0xaa41('0x76')],'as':_0xaa41('0xa5'),'where':{'fax':_0x304c3e},'limit':0x1,'order':[[_0xaa41('0x9d'),_0xaa41('0xa6')]]}]}]})['then'](handleEntityNotFound(_0x154828,null))[_0xaa41('0x20')](function(_0x10fac1){_0x4973f5=_0x10fac1;if(_0x427b99[_0xaa41('0x5b')][_0xaa41('0xa7')]&&_0x427b99[_0xaa41('0x5b')][_0xaa41('0xa7')]['length']){for(var _0x3730c2=0x0;_0x3730c2<_0x427b99['body'][_0xaa41('0xa7')][_0xaa41('0x47')];_0x3730c2+=0x1){_0x427b99[_0xaa41('0x5b')][_0xaa41('0xa7')][_0x3730c2]={'filename':_0x427b99[_0xaa41('0x5b')]['attachments'][_0x3730c2][_0xaa41('0x3f')],'id':_0x427b99[_0xaa41('0x5b')]['attachments'][_0x3730c2]['id'],'path':path[_0xaa41('0xa8')](config[_0xaa41('0xa9')],_0xaa41('0xaa'),_0x427b99[_0xaa41('0x5b')][_0xaa41('0xa7')][_0x3730c2][_0xaa41('0xab')])};}}return respondWithRpcPromise(_0xaa41('0xac'),_0xaa41('0xac'),{'FaxAccountId':_[_0xaa41('0xad')](_0x427b99[_0xaa41('0x58')]['id'])?undefined:_0x427b99['params']['id'],'path':_[_0xaa41('0xad')](_0x427b99[_0xaa41('0x5b')][_0xaa41('0xa7')][0x0]['path'])?undefined:_0x427b99['body'][_0xaa41('0xa7')][0x0]['path'],'fax':_['isNil'](_0x427b99[_0xaa41('0x5b')]['to'][0x0])?undefined:_0x427b99[_0xaa41('0x5b')]['to'][0x0]},client9002);})[_0xaa41('0x20')](function(){if(_0x4973f5){if(_[_0xaa41('0xad')](_0x427b99['body']['from'])){_0x427b99[_0xaa41('0x5b')][_0xaa41('0xae')]=util[_0xaa41('0xaf')](_0xaa41('0xb0'),_0x4973f5[_0xaa41('0x3f')],_0x4973f5['fax']);}if(_0x4973f5[_0xaa41('0xa4')]){if(_0x4973f5[_0xaa41('0xa4')]['Contacts'][_0xaa41('0x47')]){return _0x4973f5[_0xaa41('0xa4')]['Contacts'][0x0];}else{return db[_0xaa41('0x76')][_0xaa41('0x5a')](_['defaults'](_0x427b99[_0xaa41('0x5b')],{'firstName':_0x427b99[_0xaa41('0x5b')]['to'][0x0],'phone':_0x427b99['body']['to'][0x0],'fax':_0x427b99[_0xaa41('0x5b')]['to'][0x0],'ListId':_0x4973f5['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xaa41('0xb1'));}})[_0xaa41('0x20')](function(_0x88809d){if(_0x88809d){return db[_0xaa41('0x73')][_0xaa41('0x5f')]({'where':{'ContactId':_0x88809d['id'],'closed':![],'FaxAccountId':_0x4973f5['id']}})['then'](function(_0x14902e){if(_0x14902e){return[_0x14902e,![]];}return db['FaxInteraction']['create']({'UserId':_0x427b99[_0xaa41('0x5d')]['id'],'ContactId':_0x88809d['id'],'FaxAccountId':_0x4973f5['id'],'fax':_0x427b99[_0xaa41('0x5b')]['to'][0x0],'firstMsgDirection':_0xaa41('0xb2'),'Messages':[_[_0xaa41('0x4f')](_0x427b99[_0xaa41('0x5b')],{'read':![],'body':_0x427b99[_0xaa41('0x5b')][_0xaa41('0xa7')][0x0]['filename'],'FaxAccountId':_0x4973f5['id'],'UserId':_0x427b99[_0xaa41('0x5d')]['id'],'ContactId':_0x88809d['id'],'AttachmentId':_0x427b99[_0xaa41('0x5b')][_0xaa41('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0xaa41('0xa0')],'as':_0xaa41('0xb3')}]})[_0xaa41('0x20')](function(_0x3aafe6){return[_0x3aafe6,!![]];});});}else{throw new Error(_0xaa41('0xb4'));}})[_0xaa41('0xb5')](function(_0x36e6ff,_0x473d1c){if(_0x473d1c){return _0x36e6ff;}return db[_0xaa41('0xa0')]['create']({'direction':'out','read':![],'body':_0x427b99[_0xaa41('0x5b')][_0xaa41('0xa7')][0x0][_0xaa41('0xb6')],'FaxAccountId':_0x4973f5['id'],'FaxInteractionId':_0x36e6ff['id'],'UserId':_0x427b99['user']['id'],'ContactId':_0x36e6ff[_0xaa41('0xb7')],'AttachmentId':_0x427b99[_0xaa41('0x5b')][_0xaa41('0xa7')][0x0]['id']})[_0xaa41('0x20')](function(_0x401304){_0x36e6ff[_0xaa41('0xb8')][_0xaa41('0xb3')]=[];_0x36e6ff[_0xaa41('0xb8')][_0xaa41('0xb3')][_0xaa41('0x8d')](_0x401304[_0xaa41('0xb8')]);return _0x36e6ff;});})[_0xaa41('0x20')](function(_0x384f44){respondWithRpcPromise(_0xaa41('0xb9'),_0xaa41('0xb9'),{'FaxAccountId':_['isNil'](_0x427b99[_0xaa41('0x58')]['id'])?undefined:_0x427b99[_0xaa41('0x58')]['id'],'path':_[_0xaa41('0xad')](_0x427b99['body'][_0xaa41('0xa7')][0x0][_0xaa41('0x9')])?undefined:_0x427b99[_0xaa41('0x5b')][_0xaa41('0xa7')][0x0][_0xaa41('0x9')],'fax':_[_0xaa41('0xad')](_0x427b99[_0xaa41('0x5b')]['to'][0x0])?undefined:_0x427b99[_0xaa41('0x5b')]['to'][0x0],'AttachmentId':_0x427b99['body'][_0xaa41('0xa7')][0x0]['id']},client9002)[_0xaa41('0x20')](function(_0xe68cd6){logger[_0xaa41('0x21')](_0xaa41('0xba'),_0xe68cd6);})['catch'](function(_0x17da97){logger['info'](_0xaa41('0xba'),_0x17da97);});return _0x384f44;})[_0xaa41('0x20')](respondWithResult(_0x154828,null))[_0xaa41('0x57')](handleError(_0x154828,null));};exports[_0xaa41('0xbb')]=function(_0x138ef0,_0xd84ef2,_0x32a017){return db[_0xaa41('0x53')][_0xaa41('0x5f')]({'where':{'id':_0x138ef0[_0xaa41('0x58')]['id']}})[_0xaa41('0x20')](handleEntityNotFound(_0xd84ef2,null))[_0xaa41('0x20')](function(_0x59c711){if(_0x59c711){return _0x59c711['addAgents'](_0x138ef0[_0xaa41('0x5b')][_0xaa41('0x6d')],_[_0xaa41('0x74')](_0x138ef0[_0xaa41('0x5b')],[_0xaa41('0x6d'),'id'])||{})[_0xaa41('0xb5')](function(_0x538e17){for(var _0x411192=0x0;_0x411192<_0x138ef0['body'][_0xaa41('0x6d')][_0xaa41('0x47')];_0x411192+=0x1){socket[_0xaa41('0xbc')](_0xaa41('0xbd'),{'UserId':_0x138ef0[_0xaa41('0x5b')][_0xaa41('0x6d')][_0x411192],'FaxAccountId':_0x138ef0['params']['id']});}return _0x538e17;});}})['then'](respondWithResult(_0xd84ef2,null))[_0xaa41('0x57')](handleError(_0xd84ef2,null));};exports['removeAgents']=function(_0xd9f01b,_0x3f8296,_0x438fcf){return db[_0xaa41('0x53')][_0xaa41('0x5f')]({'where':{'id':_0xd9f01b[_0xaa41('0x58')]['id']}})[_0xaa41('0x20')](handleEntityNotFound(_0x3f8296,null))[_0xaa41('0x20')](function(_0x12b5b0){if(_0x12b5b0){return _0x12b5b0[_0xaa41('0xbe')](_0xd9f01b[_0xaa41('0x40')][_0xaa41('0x6d')])[_0xaa41('0x20')](function(){if(_[_0xaa41('0xbf')](_0xd9f01b['query'][_0xaa41('0x6d')])){for(var _0x5b8d62=0x0;_0x5b8d62<_0xd9f01b[_0xaa41('0x40')]['ids'][_0xaa41('0x47')];_0x5b8d62+=0x1){socket[_0xaa41('0xbc')](_0xaa41('0xc0'),{'UserId':Number(_0xd9f01b[_0xaa41('0x40')][_0xaa41('0x6d')][_0x5b8d62]),'FaxAccountId':Number(_0xd9f01b[_0xaa41('0x58')]['id'])});}}else{socket[_0xaa41('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0xd9f01b[_0xaa41('0x40')]['ids']),'FaxAccountId':Number(_0xd9f01b['params']['id'])});}});}})[_0xaa41('0x20')](respondWithStatusCode(_0x3f8296,null))[_0xaa41('0x57')](handleError(_0x3f8296,null));};exports['getAgents']=function(_0x2c4930,_0x1285ed,_0x57b75c){var _0x2039de={};var _0x1b888e={};var _0x3f5b34;var _0x580b8e;return db[_0xaa41('0x53')]['findOne']({'where':{'id':_0x2c4930[_0xaa41('0x58')]['id']}})[_0xaa41('0x20')](handleEntityNotFound(_0x1285ed,null))[_0xaa41('0x20')](function(_0xf120a){if(_0xf120a){_0x3f5b34=_0xf120a;_0x1b888e['model']=_[_0xaa41('0x41')](db[_0xaa41('0x78')][_0xaa41('0x69')]);_0x1b888e['query']=_[_0xaa41('0x41')](_0x2c4930[_0xaa41('0x40')]);_0x1b888e[_0xaa41('0x42')]=_[_0xaa41('0x43')](_0x1b888e[_0xaa41('0x44')],_0x1b888e[_0xaa41('0x40')]);_0x2039de[_0xaa41('0x45')]=_[_0xaa41('0x43')](_0x1b888e['model'],qs[_0xaa41('0x46')](_0x2c4930['query'][_0xaa41('0x46')]));_0x2039de[_0xaa41('0x45')]=_0x2039de[_0xaa41('0x45')][_0xaa41('0x47')]?_0x2039de[_0xaa41('0x45')]:_0x1b888e[_0xaa41('0x44')];_0x2039de[_0xaa41('0x6a')]=qs[_0xaa41('0x4b')](_0x2c4930[_0xaa41('0x40')][_0xaa41('0x4b')]);_0x2039de[_0xaa41('0x4e')]=qs[_0xaa41('0x42')](_[_0xaa41('0x4c')](_0x2c4930['query'],_0x1b888e[_0xaa41('0x42')]));if(_0x2c4930[_0xaa41('0x40')][_0xaa41('0x4d')]){_0x2039de[_0xaa41('0x4e')]=_[_0xaa41('0x4f')](_0x2039de[_0xaa41('0x4e')],{'$or':_[_0xaa41('0x3c')](_0x2039de[_0xaa41('0x45')],function(_0x1c650e){var _0x4b12cf={};_0x4b12cf[_0x1c650e]={'$like':'%'+_0x2c4930[_0xaa41('0x40')][_0xaa41('0x4d')]+'%'};return _0x4b12cf;})});}_0x2039de=_[_0xaa41('0x4f')]({},_0x2039de,_0x2c4930[_0xaa41('0x52')]);return _0x3f5b34[_0xaa41('0xc1')](_0x2039de);}})[_0xaa41('0x20')](function(_0xea2495){if(_0xea2495){_0x580b8e=_0xea2495[_0xaa41('0x47')];if(!_0x2c4930[_0xaa41('0x40')][_0xaa41('0x48')]('nolimit')){_0x2039de['limit']=qs['limit'](_0x2c4930[_0xaa41('0x40')][_0xaa41('0x4a')]);_0x2039de['offset']=qs[_0xaa41('0x2e')](_0x2c4930[_0xaa41('0x40')]['offset']);}return _0x3f5b34[_0xaa41('0xc1')](_0x2039de);}})['then'](function(_0x1fa7d0){if(_0x1fa7d0){return _0x1fa7d0?{'count':_0x580b8e,'rows':_0x1fa7d0}:null;}})[_0xaa41('0x20')](respondWithResult(_0x1285ed,null))[_0xaa41('0x57')](handleError(_0x1285ed,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b083f95..5bf6618 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 _0x5433=['FaxAccount','setMaxListeners','save','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4333c0,_0x1b8b7d){var _0x1ea60b=function(_0x36a1ea){while(--_0x36a1ea){_0x4333c0['push'](_0x4333c0['shift']());}};_0x1ea60b(++_0x1b8b7d);}(_0x5433,0xcd));var _0x3543=function(_0x3103ae,_0x1e658d){_0x3103ae=_0x3103ae-0x0;var _0x3c0c05=_0x5433[_0x3103ae];return _0x3c0c05;};'use strict';var EventEmitter=require(_0x3543('0x0'));var FaxAccount=require(_0x3543('0x1'))['db'][_0x3543('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3543('0x3')](0x0);var events={'afterCreate':_0x3543('0x4'),'afterUpdate':'update','afterDestroy':_0x3543('0x5')};function emitEvent(_0x30cacf){return function(_0x4976ee,_0x5dc6c2,_0x3d6705){FaxAccountEvents['emit'](_0x30cacf+':'+_0x4976ee['id'],_0x4976ee);FaxAccountEvents['emit'](_0x30cacf,_0x4976ee);_0x3d6705(null);};}for(var e in events){if(events[_0x3543('0x6')](e)){var event=events[e];FaxAccount[_0x3543('0x7')](e,emitEvent(event));}}module[_0x3543('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x2fe6=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','update','remove'];(function(_0x36d8f9,_0x49bc0e){var _0x1b0dbc=function(_0x229513){while(--_0x229513){_0x36d8f9['push'](_0x36d8f9['shift']());}};_0x1b0dbc(++_0x49bc0e);}(_0x2fe6,0x1e4));var _0x62fe=function(_0x2a9552,_0x35975a){_0x2a9552=_0x2a9552-0x0;var _0x5daad7=_0x2fe6[_0x2a9552];return _0x5daad7;};'use strict';var EventEmitter=require(_0x62fe('0x0'));var FaxAccount=require(_0x62fe('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x62fe('0x2'),'afterDestroy':_0x62fe('0x3')};function emitEvent(_0x570e9f){return function(_0x340710,_0x1f6022,_0x3e660b){FaxAccountEvents[_0x62fe('0x4')](_0x570e9f+':'+_0x340710['id'],_0x340710);FaxAccountEvents[_0x62fe('0x4')](_0x570e9f,_0x340710);_0x3e660b(null);};}for(var e in events){if(events[_0x62fe('0x5')](e)){var event=events[e];FaxAccount[_0x62fe('0x6')](e,emitEvent(event));}}module[_0x62fe('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 1d01a5b..835fae6 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 _0x9593=['request-promise','../../config/environment','FaxAccount','fax_accounts','lodash','api','bluebird'];(function(_0x372ee1,_0x45c637){var _0x31ea06=function(_0x3aba6a){while(--_0x3aba6a){_0x372ee1['push'](_0x372ee1['shift']());}};_0x31ea06(++_0x45c637);}(_0x9593,0x1a8));var _0x3959=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0x9593[_0x2bbc07];return _0x6879e4;};'use strict';var _=require(_0x3959('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3959('0x1'));var moment=require('moment');var BPromise=require(_0x3959('0x2'));var rp=require(_0x3959('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3959('0x4'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x167d51,_0x38a969){return _0x167d51['define'](_0x3959('0x5'),attributes,{'tableName':_0x3959('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc525=['../../config/logger','api','request-promise','../../config/environment','exports','define','FaxAccount','lodash','util'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0xc525,0x97));var _0x5c52=function(_0x262e12,_0x40f49b){_0x262e12=_0x262e12-0x0;var _0x1e3e9b=_0xc525[_0x262e12];return _0x1e3e9b;};'use strict';var _=require(_0x5c52('0x0'));var util=require(_0x5c52('0x1'));var logger=require(_0x5c52('0x2'))(_0x5c52('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5c52('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5c52('0x5'));var attributes=require('./faxAccount.attributes');module[_0x5c52('0x6')]=function(_0x12943b,_0x331df0){return _0x12943b[_0x5c52('0x7')](_0x5c52('0x8'),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 b1ee9c1..58db0da 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 _0xbfec=['./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','findAll','options','raw','limit','include','model','map','attributes','GetFaxAccount','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','FaxAccount','find','account','CmList','List','Contacts','FaxApplication','Applications','applications','list','orderBy','priority','asc','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x2177b9,_0x193740){var _0x2818c9=function(_0x20a94f){while(--_0x20a94f){_0x2177b9['push'](_0x2177b9['shift']());}};_0x2818c9(++_0x193740);}(_0xbfec,0x1b2));var _0xcbfe=function(_0x251b16,_0x22e163){_0x251b16=_0x251b16-0x0;var _0x5d81ba=_0xbfec[_0x251b16];return _0x5d81ba;};'use strict';var _=require(_0xcbfe('0x0'));var util=require(_0xcbfe('0x1'));var moment=require(_0xcbfe('0x2'));var BPromise=require(_0xcbfe('0x3'));var rs=require(_0xcbfe('0x4'));var fs=require('fs');var Redis=require(_0xcbfe('0x5'));var db=require(_0xcbfe('0x6'))['db'];var utils=require(_0xcbfe('0x7'));var logger=require(_0xcbfe('0x8'))(_0xcbfe('0x9'));var config=require(_0xcbfe('0xa'));var jayson=require(_0xcbfe('0xb'));var client=jayson[_0xcbfe('0xc')]['http']({'port':0x232c});config[_0xcbfe('0xd')]=_[_0xcbfe('0xe')](config[_0xcbfe('0xd')],{'host':_0xcbfe('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcbfe('0x10'))[_0xcbfe('0x11')](socket);function respondWithRpcPromise(_0x2238b0,_0x156ff4,_0x209d2e){return new BPromise(function(_0x14e1ab,_0x1062b5){return client[_0xcbfe('0x12')](_0x2238b0,_0x209d2e)[_0xcbfe('0x13')](function(_0x4ac2cb){logger[_0xcbfe('0x14')](_0xcbfe('0x15'),_0x156ff4,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x156ff4,_0xcbfe('0x16'),JSON[_0xcbfe('0x17')](_0x4ac2cb));if(_0x4ac2cb[_0xcbfe('0x18')]){if(_0x4ac2cb[_0xcbfe('0x18')]['code']===0x1f4){logger[_0xcbfe('0x18')](_0xcbfe('0x15'),_0x156ff4,_0x4ac2cb[_0xcbfe('0x18')][_0xcbfe('0x19')]);return _0x1062b5(_0x4ac2cb['error']['message']);}logger[_0xcbfe('0x18')](_0xcbfe('0x15'),_0x156ff4,_0x4ac2cb['error'][_0xcbfe('0x19')]);return _0x14e1ab(_0x4ac2cb[_0xcbfe('0x18')]['message']);}else{logger[_0xcbfe('0x14')]('FaxAccount,\x20%s,\x20%s',_0x156ff4,_0xcbfe('0x16'));_0x14e1ab(_0x4ac2cb['result']['message']);}})['catch'](function(_0x492252){logger[_0xcbfe('0x18')](_0xcbfe('0x15'),_0x156ff4,_0x492252);_0x1062b5(_0x492252);});});}exports['GetFaxAccount']=function(_0x1860ce){var _0x238159=this;return new Promise(function(_0x2d2758,_0x348374){return db['FaxAccount'][_0xcbfe('0x1a')]({'raw':_0x1860ce[_0xcbfe('0x1b')]?_0x1860ce['options'][_0xcbfe('0x1c')]===undefined?!![]:![]:!![],'where':_0x1860ce[_0xcbfe('0x1b')]?_0x1860ce[_0xcbfe('0x1b')]['where']||null:null,'attributes':_0x1860ce[_0xcbfe('0x1b')]?_0x1860ce['options']['attributes']||null:null,'limit':_0x1860ce['options']?_0x1860ce['options'][_0xcbfe('0x1d')]||null:null,'include':_0x1860ce[_0xcbfe('0x1b')]?_0x1860ce[_0xcbfe('0x1b')][_0xcbfe('0x1e')]?_['map'](_0x1860ce['options'][_0xcbfe('0x1e')],function(_0x186a0f){return{'model':db[_0x186a0f[_0xcbfe('0x1f')]],'as':_0x186a0f['as'],'attributes':_0x186a0f['attributes'],'include':_0x186a0f[_0xcbfe('0x1e')]?_[_0xcbfe('0x20')](_0x186a0f[_0xcbfe('0x1e')],function(_0x4ab964){return{'model':db[_0x4ab964[_0xcbfe('0x1f')]],'as':_0x4ab964['as'],'attributes':_0x4ab964[_0xcbfe('0x21')],'include':_0x4ab964[_0xcbfe('0x1e')]?_['map'](_0x4ab964[_0xcbfe('0x1e')],function(_0x219dc7){return{'model':db[_0x219dc7['model']],'as':_0x219dc7['as'],'attributes':_0x219dc7[_0xcbfe('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcbfe('0x13')](function(_0x383fdd){logger[_0xcbfe('0x14')](_0xcbfe('0x22'),_0x1860ce);logger['debug'](_0xcbfe('0x22'),_0x1860ce,JSON[_0xcbfe('0x17')](_0x383fdd));_0x2d2758(_0x383fdd);})[_0xcbfe('0x23')](function(_0x28e43e){logger[_0xcbfe('0x18')](_0xcbfe('0x22'),_0x28e43e[_0xcbfe('0x19')],_0x1860ce);_0x348374(_0x238159[_0xcbfe('0x18')](0x1f4,_0x28e43e[_0xcbfe('0x19')]));});});};exports[_0xcbfe('0x24')]=function(_0x37005b,_0x6e66f1,_0xd777c5){var _0x366310=this;return new Promise(function(_0x34ea32,_0xef8675){var _0x5974d5={'body':_0x37005b[_0xcbfe('0x25')],'channel':_0xcbfe('0x26')};var _0xb0989b=[];var _0xbef764=[];var _0xc4a10a={};return db[_0xcbfe('0x27')][_0xcbfe('0x28')]()[_0xcbfe('0x13')](function(_0x17812e){if(!_0x17812e){throw new db[(_0xcbfe('0x29'))][(_0xcbfe('0x2a'))](_0xcbfe('0x2b'));}_0xb0989b=_['difference'](_[_0xcbfe('0x2c')](_0x17812e),[_0xcbfe('0x2d'),_0xcbfe('0x2e')]);_0xbef764=_['difference'](_['keys'](_0x17812e),['createdAt','updatedAt',_0xcbfe('0x2f'),'ListId']);if(_0x37005b[_0xcbfe('0x25')]['id']){delete _0x37005b['body']['id'];}if(_[_0xcbfe('0x30')](_0x37005b[_0xcbfe('0x25')][_0xcbfe('0x31')])){throw new db[(_0xcbfe('0x29'))][(_0xcbfe('0x2a'))](_0xcbfe('0x32'));}if(_[_0xcbfe('0x30')](_0x37005b[_0xcbfe('0x25')][_0xcbfe('0x25')])||_0x37005b[_0xcbfe('0x25')][_0xcbfe('0x25')]===''){throw new db[(_0xcbfe('0x29'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xcbfe('0x30')](_0x37005b[_0xcbfe('0x25')][_0xcbfe('0x33')])){throw new db[(_0xcbfe('0x29'))]['ValidationError'](_0xcbfe('0x34')+_0xbef764);}if(!_[_0xcbfe('0x35')](_0xbef764,_0x37005b['body']['mapKey'])){throw new db[(_0xcbfe('0x29'))][(_0xcbfe('0x2a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xbef764);}_0xc4a10a[_0x37005b[_0xcbfe('0x25')][_0xcbfe('0x33')]]=_0x37005b[_0xcbfe('0x25')][_0xcbfe('0x31')];})[_0xcbfe('0x13')](function(){return db[_0xcbfe('0x36')][_0xcbfe('0x37')]({'where':{'id':_0x37005b[_0xcbfe('0x38')]['id']},'include':[{'model':db[_0xcbfe('0x39')],'as':_0xcbfe('0x3a'),'include':[{'model':db[_0xcbfe('0x27')],'as':_0xcbfe('0x3b'),'where':_0xc4a10a,'limit':0x1,'order':[[_0xcbfe('0x2e'),'DESC']]}]},{'model':db[_0xcbfe('0x3c')],'as':_0xcbfe('0x3d')}]});})[_0xcbfe('0x13')](function(_0x3c2cfa){if(_0x3c2cfa&&_0x3c2cfa[_0xcbfe('0x3a')]){var _0x1f28b6=_0x3c2cfa['get']({'plain':!![]});_0x5974d5[_0xcbfe('0x38')]=_0x1f28b6;_0x5974d5[_0xcbfe('0x3e')]=_0x1f28b6[_0xcbfe('0x3d')];_0x5974d5[_0xcbfe('0x3f')]=_0x1f28b6['List'];_0x5974d5['applications']=_[_0xcbfe('0x40')](_0x5974d5[_0xcbfe('0x3e')],[_0xcbfe('0x41')],[_0xcbfe('0x42')]);if(_0x5974d5[_0xcbfe('0x38')][_0xcbfe('0x3d')]){delete _0x5974d5['account']['Applications'];}if(_0x5974d5['account'][_0xcbfe('0x3a')]&&_0x5974d5[_0xcbfe('0x38')]['List'][_0xcbfe('0x3b')][_0xcbfe('0x43')]){return _0x5974d5[_0xcbfe('0x38')][_0xcbfe('0x3a')][_0xcbfe('0x3b')][0x0];}var _0x234030=_[_0xcbfe('0xe')](_0x37005b[_0xcbfe('0x25')],{'firstName':_0x37005b[_0xcbfe('0x25')][_0xcbfe('0x31')],'ListId':_0x1f28b6[_0xcbfe('0x44')]});_0x234030[_0x37005b[_0xcbfe('0x25')][_0xcbfe('0x33')]]=_0x37005b['body']['from'];return db[_0xcbfe('0x27')][_0xcbfe('0x45')](_0x234030,{'fields':_0xb0989b,'raw':!![]});}})[_0xcbfe('0x13')](function(_0x4451f2){_0x5974d5[_0xcbfe('0x46')]=_0x4451f2;if(_0x4451f2){var _0x142175={'ContactId':_0x4451f2['id'],'FaxAccountId':_0x37005b[_0xcbfe('0x38')]['id'],'fax':_0x4451f2[_0xcbfe('0x26')]};return db[_0xcbfe('0x47')]['find']({'where':{'ContactId':_0x4451f2['id'],'closed':![],'FaxAccountId':_0x37005b[_0xcbfe('0x38')]['id']}})[_0xcbfe('0x13')](function(_0x49bbe1){if(_0x49bbe1){return[_0x49bbe1,![]];}return db[_0xcbfe('0x47')][_0xcbfe('0x45')](_0x142175)[_0xcbfe('0x13')](function(_0x45bf4e){return[_0x45bf4e,!![]];});});}else{throw new Error(_0xcbfe('0x48'));}})[_0xcbfe('0x49')](function(_0x45626d,_0x18b2dd){var _0x127865=_0x45626d[_0xcbfe('0x4a')]({'plain':!![]});if(_0x18b2dd){if(_0x5974d5[_0xcbfe('0x38')][_0xcbfe('0x4b')]){_0x5974d5[_0xcbfe('0x3e')]['push']({'id':0x0,'priority':_0x5974d5[_0xcbfe('0x3e')][_0xcbfe('0x43')]+0x1,'app':_0xcbfe('0x4c'),'appdata':'unmanaged','interval':_0xcbfe('0x4d')});}_0x127865['created']=!![];}else{_0x127865[_0xcbfe('0x4e')]=![];}_0x5974d5[_0xcbfe('0x4f')]=_0x127865;return db[_0xcbfe('0x50')][_0xcbfe('0x45')]({'body':_0x37005b[_0xcbfe('0x25')]['body'],'FaxAccountId':_0x37005b[_0xcbfe('0x38')]['id'],'FaxInteractionId':_0x45626d['id'],'direction':'in','ContactId':_0x45626d[_0xcbfe('0x51')],'AttachmentId':_0x37005b['body'][_0xcbfe('0x52')]});})[_0xcbfe('0x13')](function(_0x279085){_0x5974d5[_0xcbfe('0x19')]=_0x279085;if(_0x5974d5[_0xcbfe('0x4f')]['UserId']){return db[_0xcbfe('0x53')][_0xcbfe('0x37')]({'attributes':['id',_0xcbfe('0x54')],'where':{'id':_0x5974d5[_0xcbfe('0x4f')]['UserId']}})['then'](function(_0x2ecddf){if(_0x2ecddf){_0x5974d5[_0xcbfe('0x3e')][_0xcbfe('0x55')]({'id':0x0,'priority':0x0,'app':_0xcbfe('0x56'),'appdata':_0x2ecddf[_0xcbfe('0x54')]+','+(_0x5974d5[_0xcbfe('0x38')][_0xcbfe('0x57')]||0xa),'interval':_0xcbfe('0x4d')});}return respondWithRpcPromise(_0xcbfe('0x58'),_0xcbfe('0x59'),_0x5974d5);});}return respondWithRpcPromise(_0xcbfe('0x58'),'startRouting',_0x5974d5);})['then'](function(_0x1d1931){_0x34ea32(_0x1d1931);})[_0xcbfe('0x23')](function(_0x221a19){_0xef8675(_0x366310[_0xcbfe('0x18')](0x1f4,_0x221a19[_0xcbfe('0x19')]));});});}; \ No newline at end of file +var _0xa101=['from','Sequelize','ValidationError','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','find','CmList','List','DESC','FaxApplication','get','account','applications','Applications','list','priority','Contacts','length','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','unshift','name','startRouting','catch','lodash','util','bluebird','ioredis','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','describe','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa101,0x179));var _0x1a10=function(_0xffd8b0,_0x12c51f){_0xffd8b0=_0xffd8b0-0x0;var _0x301ba0=_0xa101[_0xffd8b0];return _0x301ba0;};'use strict';var _=require(_0x1a10('0x0'));var util=require(_0x1a10('0x1'));var moment=require('moment');var BPromise=require(_0x1a10('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a10('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1a10('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1a10('0x5')][_0x1a10('0x6')]({'port':0x232c});config[_0x1a10('0x7')]=_[_0x1a10('0x8')](config[_0x1a10('0x7')],{'host':_0x1a10('0x9'),'port':0x18eb});var socket=require(_0x1a10('0xa'))(new Redis(config[_0x1a10('0x7')]));require(_0x1a10('0xb'))['register'](socket);function respondWithRpcPromise(_0x3ac583,_0x6c1157,_0x2d52c7){return new BPromise(function(_0x2c5ae9,_0x209b06){return client['request'](_0x3ac583,_0x2d52c7)[_0x1a10('0xc')](function(_0x7a54b4){logger[_0x1a10('0xd')](_0x1a10('0xe'),_0x6c1157,'request\x20sent');logger[_0x1a10('0xf')](_0x1a10('0x10'),_0x6c1157,_0x1a10('0x11'),JSON[_0x1a10('0x12')](_0x7a54b4));if(_0x7a54b4[_0x1a10('0x13')]){if(_0x7a54b4[_0x1a10('0x13')][_0x1a10('0x14')]===0x1f4){logger[_0x1a10('0x13')](_0x1a10('0xe'),_0x6c1157,_0x7a54b4[_0x1a10('0x13')][_0x1a10('0x15')]);return _0x209b06(_0x7a54b4[_0x1a10('0x13')][_0x1a10('0x15')]);}logger[_0x1a10('0x13')](_0x1a10('0xe'),_0x6c1157,_0x7a54b4['error'][_0x1a10('0x15')]);return _0x2c5ae9(_0x7a54b4[_0x1a10('0x13')][_0x1a10('0x15')]);}else{logger[_0x1a10('0xd')](_0x1a10('0xe'),_0x6c1157,_0x1a10('0x11'));_0x2c5ae9(_0x7a54b4['result'][_0x1a10('0x15')]);}})['catch'](function(_0x139520){logger[_0x1a10('0x13')]('FaxAccount,\x20%s,\x20%s',_0x6c1157,_0x139520);_0x209b06(_0x139520);});});}exports[_0x1a10('0x16')]=function(_0x546a99){var _0x36f9ff=this;return new Promise(function(_0x5e1f0e,_0x4322f7){return db[_0x1a10('0x17')]['findAll']({'raw':_0x546a99[_0x1a10('0x18')]?_0x546a99['options'][_0x1a10('0x19')]===undefined?!![]:![]:!![],'where':_0x546a99[_0x1a10('0x18')]?_0x546a99[_0x1a10('0x18')][_0x1a10('0x1a')]||null:null,'attributes':_0x546a99['options']?_0x546a99['options'][_0x1a10('0x1b')]||null:null,'limit':_0x546a99[_0x1a10('0x18')]?_0x546a99[_0x1a10('0x18')][_0x1a10('0x1c')]||null:null,'include':_0x546a99[_0x1a10('0x18')]?_0x546a99[_0x1a10('0x18')][_0x1a10('0x1d')]?_[_0x1a10('0x1e')](_0x546a99[_0x1a10('0x18')]['include'],function(_0x525974){return{'model':db[_0x525974['model']],'as':_0x525974['as'],'attributes':_0x525974[_0x1a10('0x1b')],'include':_0x525974[_0x1a10('0x1d')]?_[_0x1a10('0x1e')](_0x525974[_0x1a10('0x1d')],function(_0x2eb76d){return{'model':db[_0x2eb76d[_0x1a10('0x1f')]],'as':_0x2eb76d['as'],'attributes':_0x2eb76d[_0x1a10('0x1b')],'include':_0x2eb76d[_0x1a10('0x1d')]?_[_0x1a10('0x1e')](_0x2eb76d[_0x1a10('0x1d')],function(_0x2ce1fd){return{'model':db[_0x2ce1fd[_0x1a10('0x1f')]],'as':_0x2ce1fd['as'],'attributes':_0x2ce1fd['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a10('0xc')](function(_0x46b161){logger[_0x1a10('0xd')](_0x1a10('0x16'),_0x546a99);logger[_0x1a10('0xf')](_0x1a10('0x16'),_0x546a99,JSON[_0x1a10('0x12')](_0x46b161));_0x5e1f0e(_0x46b161);})['catch'](function(_0x3c2ab4){logger[_0x1a10('0x13')](_0x1a10('0x16'),_0x3c2ab4['message'],_0x546a99);_0x4322f7(_0x36f9ff[_0x1a10('0x13')](0x1f4,_0x3c2ab4[_0x1a10('0x15')]));});});};exports[_0x1a10('0x20')]=function(_0x4385a,_0x563875,_0x8816da){var _0x4adbf1=this;return new Promise(function(_0x5946ea,_0x2e6f49){var _0x27be9e={'body':_0x4385a[_0x1a10('0x21')],'channel':_0x1a10('0x22')};var _0x12d383=[];var _0x258c15=[];var _0x44c884={};return db['CmContact'][_0x1a10('0x23')]()[_0x1a10('0xc')](function(_0xd97a83){if(!_0xd97a83){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x12d383=_[_0x1a10('0x24')](_[_0x1a10('0x25')](_0xd97a83),[_0x1a10('0x26'),_0x1a10('0x27')]);_0x258c15=_[_0x1a10('0x24')](_[_0x1a10('0x25')](_0xd97a83),[_0x1a10('0x26'),_0x1a10('0x27'),_0x1a10('0x28'),_0x1a10('0x29')]);if(_0x4385a[_0x1a10('0x21')]['id']){delete _0x4385a['body']['id'];}if(_[_0x1a10('0x2a')](_0x4385a[_0x1a10('0x21')][_0x1a10('0x2b')])){throw new db[(_0x1a10('0x2c'))][(_0x1a10('0x2d'))](_0x1a10('0x2e'));}if(_[_0x1a10('0x2a')](_0x4385a[_0x1a10('0x21')][_0x1a10('0x21')])||_0x4385a['body'][_0x1a10('0x21')]===''){throw new db[(_0x1a10('0x2c'))][(_0x1a10('0x2d'))](_0x1a10('0x2f'));}if(_['isNil'](_0x4385a['body'][_0x1a10('0x30')])){throw new db[(_0x1a10('0x2c'))]['ValidationError'](_0x1a10('0x31')+_0x258c15);}if(!_['includes'](_0x258c15,_0x4385a[_0x1a10('0x21')]['mapKey'])){throw new db[(_0x1a10('0x2c'))]['ValidationError'](_0x1a10('0x32')+_0x258c15);}_0x44c884[_0x4385a[_0x1a10('0x21')][_0x1a10('0x30')]]=_0x4385a[_0x1a10('0x21')][_0x1a10('0x2b')];})[_0x1a10('0xc')](function(){return db['FaxAccount'][_0x1a10('0x33')]({'where':{'id':_0x4385a['account']['id']},'include':[{'model':db[_0x1a10('0x34')],'as':_0x1a10('0x35'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x44c884,'limit':0x1,'order':[['updatedAt',_0x1a10('0x36')]]}]},{'model':db[_0x1a10('0x37')],'as':'Applications'}]});})[_0x1a10('0xc')](function(_0x11bdc4){if(_0x11bdc4&&_0x11bdc4[_0x1a10('0x35')]){var _0x1bfdb0=_0x11bdc4[_0x1a10('0x38')]({'plain':!![]});_0x27be9e[_0x1a10('0x39')]=_0x1bfdb0;_0x27be9e[_0x1a10('0x3a')]=_0x1bfdb0[_0x1a10('0x3b')];_0x27be9e[_0x1a10('0x3c')]=_0x1bfdb0[_0x1a10('0x35')];_0x27be9e[_0x1a10('0x3a')]=_['orderBy'](_0x27be9e[_0x1a10('0x3a')],[_0x1a10('0x3d')],['asc']);if(_0x27be9e[_0x1a10('0x39')][_0x1a10('0x3b')]){delete _0x27be9e[_0x1a10('0x39')][_0x1a10('0x3b')];}if(_0x27be9e[_0x1a10('0x39')][_0x1a10('0x35')]&&_0x27be9e[_0x1a10('0x39')][_0x1a10('0x35')][_0x1a10('0x3e')][_0x1a10('0x3f')]){return _0x27be9e[_0x1a10('0x39')]['List'][_0x1a10('0x3e')][0x0];}var _0x39f5b5=_[_0x1a10('0x8')](_0x4385a['body'],{'firstName':_0x4385a['body']['from'],'ListId':_0x1bfdb0[_0x1a10('0x29')]});_0x39f5b5[_0x4385a['body']['mapKey']]=_0x4385a['body'][_0x1a10('0x2b')];return db['CmContact'][_0x1a10('0x40')](_0x39f5b5,{'fields':_0x12d383,'raw':!![]});}})[_0x1a10('0xc')](function(_0x232fde){_0x27be9e[_0x1a10('0x41')]=_0x232fde;if(_0x232fde){var _0xf90216={'ContactId':_0x232fde['id'],'FaxAccountId':_0x4385a[_0x1a10('0x39')]['id'],'fax':_0x232fde[_0x1a10('0x22')]};return db[_0x1a10('0x42')]['find']({'where':{'ContactId':_0x232fde['id'],'closed':![],'FaxAccountId':_0x4385a[_0x1a10('0x39')]['id']}})[_0x1a10('0xc')](function(_0xedfdc6){if(_0xedfdc6){return[_0xedfdc6,![]];}return db[_0x1a10('0x42')][_0x1a10('0x40')](_0xf90216)[_0x1a10('0xc')](function(_0x5e6398){return[_0x5e6398,!![]];});});}else{throw new Error(_0x1a10('0x43'));}})['spread'](function(_0x20fcde,_0x334c02){var _0x4c3fbb=_0x20fcde['get']({'plain':!![]});if(_0x334c02){if(_0x27be9e[_0x1a10('0x39')][_0x1a10('0x44')]){_0x27be9e['applications'][_0x1a10('0x45')]({'id':0x0,'priority':_0x27be9e[_0x1a10('0x3a')][_0x1a10('0x3f')]+0x1,'app':_0x1a10('0x46'),'appdata':_0x1a10('0x47'),'interval':_0x1a10('0x48')});}_0x4c3fbb['created']=!![];}else{_0x4c3fbb[_0x1a10('0x49')]=![];}_0x27be9e['interaction']=_0x4c3fbb;return db[_0x1a10('0x4a')]['create']({'body':_0x4385a['body'][_0x1a10('0x21')],'FaxAccountId':_0x4385a[_0x1a10('0x39')]['id'],'FaxInteractionId':_0x20fcde['id'],'direction':'in','ContactId':_0x20fcde[_0x1a10('0x4b')],'AttachmentId':_0x4385a[_0x1a10('0x21')][_0x1a10('0x4c')]});})['then'](function(_0x3809b0){_0x27be9e[_0x1a10('0x15')]=_0x3809b0;if(_0x27be9e[_0x1a10('0x4d')][_0x1a10('0x4e')]){return db[_0x1a10('0x4f')][_0x1a10('0x33')]({'attributes':['id','name'],'where':{'id':_0x27be9e[_0x1a10('0x4d')][_0x1a10('0x4e')]}})['then'](function(_0x5733e5){if(_0x5733e5){_0x27be9e[_0x1a10('0x3a')][_0x1a10('0x50')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5733e5[_0x1a10('0x51')]+','+(_0x27be9e[_0x1a10('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0x1a10('0x48')});}return respondWithRpcPromise('Start',_0x1a10('0x52'),_0x27be9e);});}return respondWithRpcPromise('Start',_0x1a10('0x52'),_0x27be9e);})[_0x1a10('0xc')](function(_0x1ec2e8){_0x5946ea(_0x1ec2e8);})[_0x1a10('0x53')](function(_0x679579){_0x2e6f49(_0x4adbf1[_0x1a10('0x13')](0x1f4,_0x679579[_0x1a10('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f103fd8..fc9f6e2 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 _0x5f2f=['remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x5d1c0a,_0x39b381){var _0x6ba1b=function(_0x2fcf00){while(--_0x2fcf00){_0x5d1c0a['push'](_0x5d1c0a['shift']());}};_0x6ba1b(++_0x39b381);}(_0x5f2f,0x73));var _0xf5f2=function(_0x36142c,_0x245097){_0x36142c=_0x36142c-0x0;var _0x1af53a=_0x5f2f[_0x36142c];return _0x1af53a;};'use strict';var FaxAccountEvents=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(){FaxAccountEvents[_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);FaxAccountEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x2da6=['./faxAccount.events','save','remove','update','emit','removeListener','register','length','faxAccount:'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x2da6,0x1dd));var _0x62da=function(_0x384ed5,_0x46f63f){_0x384ed5=_0x384ed5-0x0;var _0x383900=_0x2da6[_0x384ed5];return _0x383900;};'use strict';var FaxAccountEvents=require(_0x62da('0x0'));var events=[_0x62da('0x1'),_0x62da('0x2'),_0x62da('0x3')];function createListener(_0xd62c5c,_0x12b8ad){return function(_0x19081e){_0x12b8ad[_0x62da('0x4')](_0xd62c5c,_0x19081e);};}function removeListener(_0x4c079d,_0x4a8428){return function(){FaxAccountEvents[_0x62da('0x5')](_0x4c079d,_0x4a8428);};}exports[_0x62da('0x6')]=function(_0x3a59f8){for(var _0x30437f=0x0,_0x100e73=events[_0x62da('0x7')];_0x30437f<_0x100e73;_0x30437f++){var _0x310c15=events[_0x30437f];var _0x16f919=createListener(_0x62da('0x8')+_0x310c15,_0x3a59f8);FaxAccountEvents['on'](_0x310c15,_0x16f919);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 4d0dba0..407e918 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 _0x1a02=['getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addAnswer','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions'];(function(_0x1a03ef,_0x121a40){var _0x175533=function(_0x58dbba){while(--_0x58dbba){_0x1a03ef['push'](_0x1a03ef['shift']());}};_0x175533(++_0x121a40);}(_0x1a02,0xba));var _0x21a0=function(_0x132b7b,_0x531b70){_0x132b7b=_0x132b7b-0x0;var _0x1c03af=_0x1a02[_0x132b7b];return _0x1c03af;};'use strict';var multer=require(_0x21a0('0x0'));var util=require(_0x21a0('0x1'));var path=require(_0x21a0('0x2'));var timeout=require(_0x21a0('0x3'));var express=require(_0x21a0('0x4'));var router=express['Router']();var auth=require(_0x21a0('0x5'));var interaction=require(_0x21a0('0x6'));var config=require(_0x21a0('0x7'));var controller=require(_0x21a0('0x8'));router[_0x21a0('0x9')]('/',auth[_0x21a0('0xa')](),controller[_0x21a0('0xb')]);router['get']('/describe',auth[_0x21a0('0xa')](),controller[_0x21a0('0xc')]);router[_0x21a0('0x9')](_0x21a0('0xd'),auth[_0x21a0('0xa')](),controller[_0x21a0('0xe')]);router[_0x21a0('0x9')](_0x21a0('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x21a0('0x9')](_0x21a0('0x10'),auth['isAuthenticated'](),controller[_0x21a0('0x11')]);router[_0x21a0('0x9')](_0x21a0('0x12'),auth['isAuthenticated'](),controller[_0x21a0('0x13')]);router[_0x21a0('0x9')](_0x21a0('0x14'),auth[_0x21a0('0xa')](),controller['getApplications']);router[_0x21a0('0x9')](_0x21a0('0x15'),auth[_0x21a0('0xa')](),controller[_0x21a0('0x16')]);router[_0x21a0('0x9')](_0x21a0('0x17'),auth[_0x21a0('0xa')](),controller[_0x21a0('0x18')]);router[_0x21a0('0x19')]('/',auth[_0x21a0('0xa')](),controller[_0x21a0('0x1a')]);router[_0x21a0('0x19')]('/:id/dispositions',auth[_0x21a0('0xa')](),controller['addDisposition']);router[_0x21a0('0x19')](_0x21a0('0x10'),auth[_0x21a0('0xa')](),controller[_0x21a0('0x1b')]);router[_0x21a0('0x19')](_0x21a0('0x12'),auth[_0x21a0('0xa')](),controller['addInteraction']);router[_0x21a0('0x19')](_0x21a0('0x14'),auth[_0x21a0('0xa')](),controller['addApplications']);router[_0x21a0('0x19')](_0x21a0('0x1c'),auth[_0x21a0('0xa')](),controller[_0x21a0('0x1d')]);router['post'](_0x21a0('0x1e'),auth[_0x21a0('0xa')](),controller[_0x21a0('0x1f')]);router['post'](_0x21a0('0x20'),auth[_0x21a0('0xa')](),controller[_0x21a0('0x21')]);router['post'](_0x21a0('0x17'),auth[_0x21a0('0xa')](),controller[_0x21a0('0x22')]);router[_0x21a0('0x23')](_0x21a0('0xd'),auth[_0x21a0('0xa')](),controller['update']);router[_0x21a0('0x24')](_0x21a0('0xd'),auth['isAuthenticated'](),controller[_0x21a0('0x25')]);router['delete'](_0x21a0('0xf'),auth[_0x21a0('0xa')](),controller[_0x21a0('0x26')]);router[_0x21a0('0x24')](_0x21a0('0x10'),auth[_0x21a0('0xa')](),controller['removeAnswers']);router[_0x21a0('0x24')]('/:id/users',auth[_0x21a0('0xa')](),controller[_0x21a0('0x27')]);module[_0x21a0('0x28')]=router; \ No newline at end of file +var _0x17a5=['/:id/users','getAgents','create','post','addDisposition','addAnswer','addInteraction','addApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','path','connect-timeout','express','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages'];(function(_0x300c38,_0x14d032){var _0x159f2f=function(_0x4839a5){while(--_0x4839a5){_0x300c38['push'](_0x300c38['shift']());}};_0x159f2f(++_0x14d032);}(_0x17a5,0xbd));var _0x517a=function(_0x2bcc66,_0x504e8b){_0x2bcc66=_0x2bcc66-0x0;var _0x3e18d6=_0x17a5[_0x2bcc66];return _0x3e18d6;};'use strict';var multer=require(_0x517a('0x0'));var util=require('util');var path=require(_0x517a('0x1'));var timeout=require(_0x517a('0x2'));var express=require(_0x517a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x517a('0x4'));var controller=require(_0x517a('0x5'));router[_0x517a('0x6')]('/',auth[_0x517a('0x7')](),controller[_0x517a('0x8')]);router['get'](_0x517a('0x9'),auth['isAuthenticated'](),controller[_0x517a('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x517a('0xb')]);router[_0x517a('0x6')](_0x517a('0xc'),auth[_0x517a('0x7')](),controller[_0x517a('0xd')]);router[_0x517a('0x6')](_0x517a('0xe'),auth[_0x517a('0x7')](),controller[_0x517a('0xf')]);router[_0x517a('0x6')](_0x517a('0x10'),auth[_0x517a('0x7')](),controller[_0x517a('0x11')]);router['get'](_0x517a('0x12'),auth[_0x517a('0x7')](),controller[_0x517a('0x13')]);router[_0x517a('0x6')]('/:id/messages',auth[_0x517a('0x7')](),controller[_0x517a('0x14')]);router[_0x517a('0x6')](_0x517a('0x15'),auth[_0x517a('0x7')](),controller[_0x517a('0x16')]);router['post']('/',auth[_0x517a('0x7')](),controller[_0x517a('0x17')]);router[_0x517a('0x18')](_0x517a('0xc'),auth[_0x517a('0x7')](),controller[_0x517a('0x19')]);router[_0x517a('0x18')](_0x517a('0xe'),auth[_0x517a('0x7')](),controller[_0x517a('0x1a')]);router[_0x517a('0x18')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x517a('0x1b')]);router['post'](_0x517a('0x12'),auth[_0x517a('0x7')](),controller[_0x517a('0x1c')]);router[_0x517a('0x18')]('/addaccountapplications',auth['isAuthenticated'](),controller['addAccountApplications']);router[_0x517a('0x18')](_0x517a('0x1d'),auth[_0x517a('0x7')](),controller[_0x517a('0x1e')]);router['post'](_0x517a('0x1f'),auth[_0x517a('0x7')](),controller[_0x517a('0x20')]);router[_0x517a('0x18')](_0x517a('0x15'),auth[_0x517a('0x7')](),controller[_0x517a('0x21')]);router[_0x517a('0x22')](_0x517a('0x23'),auth[_0x517a('0x7')](),controller[_0x517a('0x24')]);router[_0x517a('0x25')](_0x517a('0x23'),auth['isAuthenticated'](),controller[_0x517a('0x26')]);router[_0x517a('0x25')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x517a('0x27')]);router[_0x517a('0x25')](_0x517a('0xe'),auth[_0x517a('0x7')](),controller[_0x517a('0x28')]);router[_0x517a('0x25')](_0x517a('0x15'),auth[_0x517a('0x7')](),controller['removeAgents']);module[_0x517a('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 8a81726..86f8573 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 _0x6eec=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x36fdc8,_0x198145){var _0x24d970=function(_0x15cd64){while(--_0x15cd64){_0x36fdc8['push'](_0x36fdc8['shift']());}};_0x24d970(++_0x198145);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc6ee('0x0'));module[_0xc6ee('0x1')]={'priority':{'type':Sequelize[_0xc6ee('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc6ee('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc6ee('0x4')]()},'description':{'type':Sequelize[_0xc6ee('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc6ee('0x5')}}; \ No newline at end of file +var _0xc7b3=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x123a52,_0x129266){var _0x4bb9ca=function(_0x3beaa3){while(--_0x3beaa3){_0x123a52['push'](_0x123a52['shift']());}};_0x4bb9ca(++_0x129266);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc7b3[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0x3c7b('0x0'));module[_0x3c7b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3c7b('0x2')],'allowNull':![],'defaultValue':_0x3c7b('0x3')},'appdata':{'type':Sequelize[_0x3c7b('0x4')]()},'description':{'type':Sequelize[_0x3c7b('0x2')]},'interval':{'type':Sequelize[_0x3c7b('0x2')],'defaultValue':_0x3c7b('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 1ba26fd..990d3fe 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 _0x08d3=['status','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','params','keys','includeAll','find','create','body','html-pdf','zip-dir','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x08d3,0x105));var _0x308d=function(_0x226605,_0x41d53f){_0x226605=_0x226605-0x0;var _0x1acb24=_0x08d3[_0x226605];return _0x1acb24;};'use strict';var pdf=require(_0x308d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x308d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x308d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x308d('0x3'));var path=require(_0x308d('0x4'));var sox=require(_0x308d('0x5'));var csv=require(_0x308d('0x6'));var ejs=require(_0x308d('0x7'));var fs=require('fs');var _=require(_0x308d('0x8'));var squel=require(_0x308d('0x9'));var crypto=require(_0x308d('0xa'));var jsforce=require(_0x308d('0xb'));var deskjs=require(_0x308d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x308d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x308d('0xe'));var as=require(_0x308d('0xf'));var hardwareService=require(_0x308d('0x10'));var logger=require('../../config/logger')(_0x308d('0x11'));var utils=require(_0x308d('0x12'));var config=require(_0x308d('0x13'));var licenseUtil=require(_0x308d('0x14'));var db=require(_0x308d('0x15'))['db'];function respondWithStatusCode(_0x1a6288,_0x594700){_0x594700=_0x594700||0xcc;return function(_0x10030f){if(_0x10030f){return _0x1a6288[_0x308d('0x16')](_0x594700);}return _0x1a6288[_0x308d('0x17')](_0x594700)['end']();};}function respondWithResult(_0x364215,_0x472b93){_0x472b93=_0x472b93||0xc8;return function(_0x36e302){if(_0x36e302){return _0x364215[_0x308d('0x17')](_0x472b93)['json'](_0x36e302);}};}function respondWithFilteredResult(_0x46dc7f,_0x3098ff){return function(_0x5e1687){if(_0x5e1687){var _0x235824=_0x5e1687['count'],_0x418544=_0x3098ff[_0x308d('0x18')],_0x1845f9=_0x3098ff['offset']+_0x3098ff[_0x308d('0x19')],_0x39236c;if(_0x1845f9>=_0x235824){_0x1845f9=_0x235824;_0x39236c=0xc8;}else{_0x39236c=0xce;}_0x46dc7f[_0x308d('0x17')](_0x39236c);return _0x46dc7f[_0x308d('0x1a')](_0x308d('0x1b'),_0x418544+'-'+_0x1845f9+'/'+_0x235824)['json'](_0x5e1687);}return null;};}function patchUpdates(_0x5d9fa6){return function(_0x861d4b){try{jsonpatch[_0x308d('0x1c')](_0x861d4b,_0x5d9fa6,!![]);}catch(_0x2cb982){return BPromise[_0x308d('0x1d')](_0x2cb982);}return _0x861d4b[_0x308d('0x1e')]();};}function saveUpdates(_0x11a855,_0x3b4aa2){return function(_0x46e076){if(_0x46e076){return _0x46e076[_0x308d('0x1f')](_0x11a855)[_0x308d('0x20')](function(_0x45965f){return _0x45965f;});}return null;};}function removeEntity(_0x207343,_0x1ce375){return function(_0x3e14a2){if(_0x3e14a2){return _0x3e14a2[_0x308d('0x21')]()[_0x308d('0x20')](function(){_0x207343[_0x308d('0x17')](0xcc)[_0x308d('0x22')]();});}};}function handleEntityNotFound(_0x10f5e8,_0x52f4c0){return function(_0x4266a1){if(!_0x4266a1){_0x10f5e8[_0x308d('0x16')](0x194);}return _0x4266a1;};}function handleError(_0x46b759,_0x17ea88){_0x17ea88=_0x17ea88||0x1f4;return function(_0x5a59ec){logger[_0x308d('0x23')](_0x5a59ec[_0x308d('0x24')]);if(_0x5a59ec[_0x308d('0x25')]){delete _0x5a59ec[_0x308d('0x25')];}_0x46b759[_0x308d('0x17')](_0x17ea88)[_0x308d('0x26')](_0x5a59ec);};}exports[_0x308d('0x27')]=function(_0x3ea8b1,_0xb6b18e){var _0x196ad6={},_0x811672={},_0x4d07e7={'count':0x0,'rows':[]};var _0xc3700a=_[_0x308d('0x28')](db[_0x308d('0x29')][_0x308d('0x2a')],function(_0x551628){return{'name':_0x551628[_0x308d('0x2b')],'type':_0x551628[_0x308d('0x2c')]['key']};});_0x811672[_0x308d('0x2d')]=_['map'](_0xc3700a,_0x308d('0x25'));_0x811672[_0x308d('0x2e')]=_['keys'](_0x3ea8b1[_0x308d('0x2e')]);_0x811672[_0x308d('0x2f')]=_[_0x308d('0x30')](_0x811672[_0x308d('0x2d')],_0x811672['query']);_0x196ad6[_0x308d('0x31')]=_[_0x308d('0x30')](_0x811672[_0x308d('0x2d')],qs[_0x308d('0x32')](_0x3ea8b1[_0x308d('0x2e')][_0x308d('0x32')]));_0x196ad6[_0x308d('0x31')]=_0x196ad6[_0x308d('0x31')][_0x308d('0x33')]?_0x196ad6[_0x308d('0x31')]:_0x811672[_0x308d('0x2d')];if(!_0x3ea8b1[_0x308d('0x2e')][_0x308d('0x34')](_0x308d('0x35'))){_0x196ad6[_0x308d('0x19')]=qs[_0x308d('0x19')](_0x3ea8b1['query'][_0x308d('0x19')]);_0x196ad6[_0x308d('0x18')]=qs['offset'](_0x3ea8b1[_0x308d('0x2e')][_0x308d('0x18')]);}_0x196ad6[_0x308d('0x36')]=qs[_0x308d('0x37')](_0x3ea8b1['query'][_0x308d('0x37')]);_0x196ad6[_0x308d('0x38')]=qs['filters'](_[_0x308d('0x39')](_0x3ea8b1[_0x308d('0x2e')],_0x811672[_0x308d('0x2f')]),_0xc3700a);if(_0x3ea8b1[_0x308d('0x2e')][_0x308d('0x3a')]){_0x196ad6[_0x308d('0x38')]=_[_0x308d('0x3b')](_0x196ad6[_0x308d('0x38')],{'$or':_[_0x308d('0x28')](_0xc3700a,function(_0x601ca7){if(_0x601ca7['type']!==_0x308d('0x3c')){var _0x133934={};_0x133934[_0x601ca7[_0x308d('0x25')]]={'$like':'%'+_0x3ea8b1[_0x308d('0x2e')][_0x308d('0x3a')]+'%'};return _0x133934;}})});}_0x196ad6=_['merge']({},_0x196ad6,_0x3ea8b1[_0x308d('0x3d')]);var _0x299af6={'where':_0x196ad6[_0x308d('0x38')]};return db['FaxApplication'][_0x308d('0x3e')](_0x299af6)[_0x308d('0x20')](function(_0x1f0e74){_0x4d07e7[_0x308d('0x3e')]=_0x1f0e74;if(_0x3ea8b1[_0x308d('0x2e')]['includeAll']){_0x196ad6[_0x308d('0x3f')]=[{'all':!![]}];}return db[_0x308d('0x29')]['findAll'](_0x196ad6);})[_0x308d('0x20')](function(_0x5dcf4e){_0x4d07e7['rows']=_0x5dcf4e;return _0x4d07e7;})['then'](respondWithFilteredResult(_0xb6b18e,_0x196ad6))[_0x308d('0x40')](handleError(_0xb6b18e,null));};exports['show']=function(_0x511c04,_0x5d06d7){var _0x31fab0={'raw':!![],'where':{'id':_0x511c04[_0x308d('0x41')]['id']}},_0x54c229={};_0x54c229[_0x308d('0x2d')]=_['keys'](db['FaxApplication'][_0x308d('0x2a')]);_0x54c229[_0x308d('0x2e')]=_[_0x308d('0x42')](_0x511c04[_0x308d('0x2e')]);_0x54c229[_0x308d('0x2f')]=_[_0x308d('0x30')](_0x54c229['model'],_0x54c229[_0x308d('0x2e')]);_0x31fab0[_0x308d('0x31')]=_[_0x308d('0x30')](_0x54c229[_0x308d('0x2d')],qs[_0x308d('0x32')](_0x511c04[_0x308d('0x2e')]['fields']));_0x31fab0[_0x308d('0x31')]=_0x31fab0[_0x308d('0x31')][_0x308d('0x33')]?_0x31fab0[_0x308d('0x31')]:_0x54c229[_0x308d('0x2d')];if(_0x511c04['query'][_0x308d('0x43')]){_0x31fab0[_0x308d('0x3f')]=[{'all':!![]}];}_0x31fab0=_['merge']({},_0x31fab0,_0x511c04['options']);return db['FaxApplication'][_0x308d('0x44')](_0x31fab0)['then'](handleEntityNotFound(_0x5d06d7,null))[_0x308d('0x20')](respondWithResult(_0x5d06d7,null))['catch'](handleError(_0x5d06d7,null));};exports[_0x308d('0x45')]=function(_0x5bbae3,_0x38726d){return db[_0x308d('0x29')][_0x308d('0x45')](_0x5bbae3['body'],{})[_0x308d('0x20')](respondWithResult(_0x38726d,0xc9))[_0x308d('0x40')](handleError(_0x38726d,null));};exports[_0x308d('0x1f')]=function(_0x2f928c,_0x936624){if(_0x2f928c[_0x308d('0x46')]['id']){delete _0x2f928c[_0x308d('0x46')]['id'];}return db['FaxApplication'][_0x308d('0x44')]({'where':{'id':_0x2f928c[_0x308d('0x41')]['id']}})['then'](handleEntityNotFound(_0x936624,null))[_0x308d('0x20')](saveUpdates(_0x2f928c[_0x308d('0x46')],null))[_0x308d('0x20')](respondWithResult(_0x936624,null))['catch'](handleError(_0x936624,null));};exports[_0x308d('0x21')]=function(_0x2a78db,_0x10be92){return db[_0x308d('0x29')][_0x308d('0x44')]({'where':{'id':_0x2a78db[_0x308d('0x41')]['id']}})['then'](handleEntityNotFound(_0x10be92,null))['then'](removeEntity(_0x10be92,null))[_0x308d('0x40')](handleError(_0x10be92,null));}; \ No newline at end of file +var _0xf8d8=['rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','sort','pick','merge','VIRTUAL','filter','options','where','include','findAll','rows','catch','show','includeAll','find','body','params','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','map','FaxApplication'];(function(_0x586998,_0xc9fd34){var _0x1c882d=function(_0x48b3e8){while(--_0x48b3e8){_0x586998['push'](_0x586998['shift']());}};_0x1c882d(++_0xc9fd34);}(_0xf8d8,0xeb));var _0x8f8d=function(_0x12f35c,_0x23fe06){_0x12f35c=_0x12f35c-0x0;var _0xe7442a=_0xf8d8[_0x12f35c];return _0xe7442a;};'use strict';var pdf=require(_0x8f8d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8f8d('0x1'));var zipdir=require(_0x8f8d('0x2'));var jsonpatch=require(_0x8f8d('0x3'));var rp=require(_0x8f8d('0x4'));var moment=require(_0x8f8d('0x5'));var BPromise=require(_0x8f8d('0x6'));var Mustache=require(_0x8f8d('0x7'));var util=require('util');var path=require(_0x8f8d('0x8'));var sox=require(_0x8f8d('0x9'));var csv=require(_0x8f8d('0xa'));var ejs=require(_0x8f8d('0xb'));var fs=require('fs');var _=require(_0x8f8d('0xc'));var squel=require('squel');var crypto=require(_0x8f8d('0xd'));var jsforce=require(_0x8f8d('0xe'));var deskjs=require(_0x8f8d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8f8d('0x10'));var Papa=require('papaparse');var Redis=require(_0x8f8d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8f8d('0x12'));var as=require(_0x8f8d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f8d('0x14'))('api');var utils=require(_0x8f8d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8f8d('0x16'))['db'];function respondWithStatusCode(_0x2ba78b,_0x2a6286){_0x2a6286=_0x2a6286||0xcc;return function(_0x4ebe15){if(_0x4ebe15){return _0x2ba78b[_0x8f8d('0x17')](_0x2a6286);}return _0x2ba78b[_0x8f8d('0x18')](_0x2a6286)[_0x8f8d('0x19')]();};}function respondWithResult(_0x588759,_0x2bd6e4){_0x2bd6e4=_0x2bd6e4||0xc8;return function(_0x10e6e7){if(_0x10e6e7){return _0x588759['status'](_0x2bd6e4)[_0x8f8d('0x1a')](_0x10e6e7);}};}function respondWithFilteredResult(_0x59ae85,_0x3e1ed4){return function(_0x22e9cc){if(_0x22e9cc){var _0x385abd=_0x22e9cc[_0x8f8d('0x1b')],_0x5473f7=_0x3e1ed4[_0x8f8d('0x1c')],_0x1cd8a1=_0x3e1ed4[_0x8f8d('0x1c')]+_0x3e1ed4[_0x8f8d('0x1d')],_0x5bee92;if(_0x1cd8a1>=_0x385abd){_0x1cd8a1=_0x385abd;_0x5bee92=0xc8;}else{_0x5bee92=0xce;}_0x59ae85[_0x8f8d('0x18')](_0x5bee92);return _0x59ae85[_0x8f8d('0x1e')](_0x8f8d('0x1f'),_0x5473f7+'-'+_0x1cd8a1+'/'+_0x385abd)[_0x8f8d('0x1a')](_0x22e9cc);}return null;};}function patchUpdates(_0x98e188){return function(_0x23f014){try{jsonpatch[_0x8f8d('0x20')](_0x23f014,_0x98e188,!![]);}catch(_0x4ee5e0){return BPromise[_0x8f8d('0x21')](_0x4ee5e0);}return _0x23f014[_0x8f8d('0x22')]();};}function saveUpdates(_0x3cea7c,_0x49cbe4){return function(_0x4028b6){if(_0x4028b6){return _0x4028b6[_0x8f8d('0x23')](_0x3cea7c)[_0x8f8d('0x24')](function(_0xc7e245){return _0xc7e245;});}return null;};}function removeEntity(_0x18336d,_0x3d31c6){return function(_0x3f0a92){if(_0x3f0a92){return _0x3f0a92['destroy']()[_0x8f8d('0x24')](function(){_0x18336d['status'](0xcc)[_0x8f8d('0x19')]();});}};}function handleEntityNotFound(_0x59cbad,_0x45d01e){return function(_0x2d9dda){if(!_0x2d9dda){_0x59cbad[_0x8f8d('0x17')](0x194);}return _0x2d9dda;};}function handleError(_0x13f36f,_0x292474){_0x292474=_0x292474||0x1f4;return function(_0x595adc){logger['error'](_0x595adc['stack']);if(_0x595adc[_0x8f8d('0x25')]){delete _0x595adc[_0x8f8d('0x25')];}_0x13f36f[_0x8f8d('0x18')](_0x292474)[_0x8f8d('0x26')](_0x595adc);};}exports['index']=function(_0x517260,_0x5b7b83){var _0x35fcb8={},_0x2810bc={},_0x487171={'count':0x0,'rows':[]};var _0x339de0=_[_0x8f8d('0x27')](db[_0x8f8d('0x28')][_0x8f8d('0x29')],function(_0x2a516f){return{'name':_0x2a516f['fieldName'],'type':_0x2a516f[_0x8f8d('0x2a')][_0x8f8d('0x2b')]};});_0x2810bc[_0x8f8d('0x2c')]=_[_0x8f8d('0x27')](_0x339de0,_0x8f8d('0x25'));_0x2810bc['query']=_[_0x8f8d('0x2d')](_0x517260[_0x8f8d('0x2e')]);_0x2810bc[_0x8f8d('0x2f')]=_[_0x8f8d('0x30')](_0x2810bc[_0x8f8d('0x2c')],_0x2810bc[_0x8f8d('0x2e')]);_0x35fcb8[_0x8f8d('0x31')]=_['intersection'](_0x2810bc['model'],qs[_0x8f8d('0x32')](_0x517260[_0x8f8d('0x2e')][_0x8f8d('0x32')]));_0x35fcb8[_0x8f8d('0x31')]=_0x35fcb8['attributes'][_0x8f8d('0x33')]?_0x35fcb8[_0x8f8d('0x31')]:_0x2810bc[_0x8f8d('0x2c')];if(!_0x517260[_0x8f8d('0x2e')]['hasOwnProperty']('nolimit')){_0x35fcb8[_0x8f8d('0x1d')]=qs[_0x8f8d('0x1d')](_0x517260[_0x8f8d('0x2e')][_0x8f8d('0x1d')]);_0x35fcb8[_0x8f8d('0x1c')]=qs[_0x8f8d('0x1c')](_0x517260[_0x8f8d('0x2e')]['offset']);}_0x35fcb8['order']=qs[_0x8f8d('0x34')](_0x517260[_0x8f8d('0x2e')][_0x8f8d('0x34')]);_0x35fcb8['where']=qs[_0x8f8d('0x2f')](_[_0x8f8d('0x35')](_0x517260[_0x8f8d('0x2e')],_0x2810bc[_0x8f8d('0x2f')]),_0x339de0);if(_0x517260['query']['filter']){_0x35fcb8['where']=_[_0x8f8d('0x36')](_0x35fcb8['where'],{'$or':_[_0x8f8d('0x27')](_0x339de0,function(_0x5d8b04){if(_0x5d8b04[_0x8f8d('0x2a')]!==_0x8f8d('0x37')){var _0x483f5e={};_0x483f5e[_0x5d8b04[_0x8f8d('0x25')]]={'$like':'%'+_0x517260[_0x8f8d('0x2e')][_0x8f8d('0x38')]+'%'};return _0x483f5e;}})});}_0x35fcb8=_[_0x8f8d('0x36')]({},_0x35fcb8,_0x517260[_0x8f8d('0x39')]);var _0x3326ae={'where':_0x35fcb8[_0x8f8d('0x3a')]};return db[_0x8f8d('0x28')][_0x8f8d('0x1b')](_0x3326ae)['then'](function(_0x5602d4){_0x487171[_0x8f8d('0x1b')]=_0x5602d4;if(_0x517260['query']['includeAll']){_0x35fcb8[_0x8f8d('0x3b')]=[{'all':!![]}];}return db[_0x8f8d('0x28')][_0x8f8d('0x3c')](_0x35fcb8);})[_0x8f8d('0x24')](function(_0x1db69a){_0x487171[_0x8f8d('0x3d')]=_0x1db69a;return _0x487171;})[_0x8f8d('0x24')](respondWithFilteredResult(_0x5b7b83,_0x35fcb8))[_0x8f8d('0x3e')](handleError(_0x5b7b83,null));};exports[_0x8f8d('0x3f')]=function(_0x3dd9c0,_0x3ecb87){var _0x4ae2be={'raw':!![],'where':{'id':_0x3dd9c0['params']['id']}},_0x2c8ccb={};_0x2c8ccb['model']=_[_0x8f8d('0x2d')](db['FaxApplication']['rawAttributes']);_0x2c8ccb['query']=_[_0x8f8d('0x2d')](_0x3dd9c0[_0x8f8d('0x2e')]);_0x2c8ccb[_0x8f8d('0x2f')]=_['intersection'](_0x2c8ccb[_0x8f8d('0x2c')],_0x2c8ccb['query']);_0x4ae2be[_0x8f8d('0x31')]=_['intersection'](_0x2c8ccb['model'],qs[_0x8f8d('0x32')](_0x3dd9c0['query']['fields']));_0x4ae2be[_0x8f8d('0x31')]=_0x4ae2be[_0x8f8d('0x31')][_0x8f8d('0x33')]?_0x4ae2be[_0x8f8d('0x31')]:_0x2c8ccb[_0x8f8d('0x2c')];if(_0x3dd9c0[_0x8f8d('0x2e')][_0x8f8d('0x40')]){_0x4ae2be[_0x8f8d('0x3b')]=[{'all':!![]}];}_0x4ae2be=_[_0x8f8d('0x36')]({},_0x4ae2be,_0x3dd9c0['options']);return db[_0x8f8d('0x28')][_0x8f8d('0x41')](_0x4ae2be)[_0x8f8d('0x24')](handleEntityNotFound(_0x3ecb87,null))[_0x8f8d('0x24')](respondWithResult(_0x3ecb87,null))[_0x8f8d('0x3e')](handleError(_0x3ecb87,null));};exports['create']=function(_0x6ec132,_0x219adf){return db[_0x8f8d('0x28')]['create'](_0x6ec132[_0x8f8d('0x42')],{})['then'](respondWithResult(_0x219adf,0xc9))[_0x8f8d('0x3e')](handleError(_0x219adf,null));};exports[_0x8f8d('0x23')]=function(_0x1afcd8,_0x4a71e2){if(_0x1afcd8['body']['id']){delete _0x1afcd8[_0x8f8d('0x42')]['id'];}return db['FaxApplication'][_0x8f8d('0x41')]({'where':{'id':_0x1afcd8[_0x8f8d('0x43')]['id']}})[_0x8f8d('0x24')](handleEntityNotFound(_0x4a71e2,null))[_0x8f8d('0x24')](saveUpdates(_0x1afcd8[_0x8f8d('0x42')],null))[_0x8f8d('0x24')](respondWithResult(_0x4a71e2,null))['catch'](handleError(_0x4a71e2,null));};exports[_0x8f8d('0x44')]=function(_0x3d8876,_0x331365){return db[_0x8f8d('0x28')]['find']({'where':{'id':_0x3d8876[_0x8f8d('0x43')]['id']}})[_0x8f8d('0x24')](handleEntityNotFound(_0x331365,null))[_0x8f8d('0x24')](removeEntity(_0x331365,null))[_0x8f8d('0x3e')](handleError(_0x331365,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index fda88aa..e11ce37 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 _0x5e1e=['rimraf','../../config/environment','./faxApplication.attributes','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x3475e0,_0x3636b0){var _0x52d18e=function(_0x3800ad){while(--_0x3800ad){_0x3475e0['push'](_0x3475e0['shift']());}};_0x52d18e(++_0x3636b0);}(_0x5e1e,0x17a));var _0xe5e1=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5e1e[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0xe5e1('0x0'));var util=require(_0xe5e1('0x1'));var logger=require(_0xe5e1('0x2'))('api');var moment=require(_0xe5e1('0x3'));var BPromise=require(_0xe5e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5e1('0x5'));var rimraf=require(_0xe5e1('0x6'));var config=require(_0xe5e1('0x7'));var attributes=require(_0xe5e1('0x8'));module['exports']=function(_0x3c9682,_0x2d2306){return _0x3c9682['define'](_0xe5e1('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe5e1('0xa'),'collate':_0xe5e1('0xb')});}; \ No newline at end of file +var _0x525d=['lodash','util','moment','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x525d,0xb4));var _0xd525=function(_0x170a03,_0x817bad){_0x170a03=_0x170a03-0x0;var _0x56da06=_0x525d[_0x170a03];return _0x56da06;};'use strict';var _=require(_0xd525('0x0'));var util=require(_0xd525('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd525('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd525('0x3'));var rimraf=require('rimraf');var config=require(_0xd525('0x4'));var attributes=require(_0xd525('0x5'));module[_0xd525('0x6')]=function(_0x2179c4,_0x44a1e6){return _0x2179c4[_0xd525('0x7')](_0xd525('0x8'),attributes,{'tableName':_0xd525('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd525('0xa'),'collate':_0xd525('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 28ae432..4941847 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 _0xc873=['info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','FaxApplication','update','options','raw','attributes','limit','UpdateFaxApplication','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc873,0x7b));var _0x3c87=function(_0x5c7cdc,_0x59ab78){_0x5c7cdc=_0x5c7cdc-0x0;var _0x409e4e=_0xc873[_0x5c7cdc];return _0x409e4e;};'use strict';var _=require(_0x3c87('0x0'));var util=require(_0x3c87('0x1'));var moment=require(_0x3c87('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c87('0x3'));var db=require(_0x3c87('0x4'))['db'];var utils=require(_0x3c87('0x5'));var logger=require(_0x3c87('0x6'))(_0x3c87('0x7'));var config=require('../../config/environment');var jayson=require(_0x3c87('0x8'));var client=jayson['client'][_0x3c87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x530f8c,_0x45902d,_0x47363d){return new BPromise(function(_0x47a499,_0x2155b7){return client[_0x3c87('0xa')](_0x530f8c,_0x47363d)[_0x3c87('0xb')](function(_0x6a912d){logger[_0x3c87('0xc')](_0x3c87('0xd'),_0x45902d,'request\x20sent');logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x45902d,_0x3c87('0xe'),JSON[_0x3c87('0xf')](_0x6a912d));if(_0x6a912d[_0x3c87('0x10')]){if(_0x6a912d[_0x3c87('0x10')]['code']===0x1f4){logger[_0x3c87('0x10')](_0x3c87('0xd'),_0x45902d,_0x6a912d[_0x3c87('0x10')][_0x3c87('0x11')]);return _0x2155b7(_0x6a912d['error'][_0x3c87('0x11')]);}logger[_0x3c87('0x10')](_0x3c87('0xd'),_0x45902d,_0x6a912d[_0x3c87('0x10')]['message']);return _0x47a499(_0x6a912d[_0x3c87('0x10')]['message']);}else{logger[_0x3c87('0xc')]('FaxApplication,\x20%s,\x20%s',_0x45902d,_0x3c87('0xe'));_0x47a499(_0x6a912d[_0x3c87('0x12')][_0x3c87('0x11')]);}})[_0x3c87('0x13')](function(_0x2445c0){logger[_0x3c87('0x10')](_0x3c87('0xd'),_0x45902d,_0x2445c0);_0x2155b7(_0x2445c0);});});}exports['UpdateFaxApplication']=function(_0x52001f){var _0x5f21b4=this;return new Promise(function(_0x200e4d,_0x298c9d){return db[_0x3c87('0x14')][_0x3c87('0x15')](_0x52001f['body'],{'raw':_0x52001f[_0x3c87('0x16')]?_0x52001f[_0x3c87('0x16')][_0x3c87('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52001f['options']?_0x52001f[_0x3c87('0x16')]['where']||null:null,'attributes':_0x52001f['options']?_0x52001f[_0x3c87('0x16')][_0x3c87('0x18')]||null:null,'limit':_0x52001f[_0x3c87('0x16')]?_0x52001f[_0x3c87('0x16')][_0x3c87('0x19')]||null:null})['then'](function(_0x532742){logger['info'](_0x3c87('0x1a'),_0x52001f);logger['debug'](_0x3c87('0x1a'),_0x52001f,JSON[_0x3c87('0xf')](_0x532742));_0x200e4d(_0x532742);})[_0x3c87('0x13')](function(_0x15b3c7){logger['error'](_0x3c87('0x1a'),_0x15b3c7[_0x3c87('0x11')],_0x52001f);_0x298c9d(_0x5f21b4[_0x3c87('0x10')](0x1f4,_0x15b3c7[_0x3c87('0x11')]));});});}; \ No newline at end of file +var _0x6150=['ioredis','../../config/logger','../../config/environment','client','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','limit','util','moment','bluebird','randomstring'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x6150,0xf8));var _0x0615=function(_0x5f2bcd,_0x22fa78){_0x5f2bcd=_0x5f2bcd-0x0;var _0x3ba3c1=_0x6150[_0x5f2bcd];return _0x3ba3c1;};'use strict';var _=require('lodash');var util=require(_0x0615('0x0'));var moment=require(_0x0615('0x1'));var BPromise=require(_0x0615('0x2'));var rs=require(_0x0615('0x3'));var fs=require('fs');var Redis=require(_0x0615('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0615('0x5'))('rpc');var config=require(_0x0615('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0615('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x100c28,_0x35667b,_0x515093){return new BPromise(function(_0x1b8a11,_0x4bea79){return client[_0x0615('0x8')](_0x100c28,_0x515093)[_0x0615('0x9')](function(_0x530c1e){logger['info'](_0x0615('0xa'),_0x35667b,_0x0615('0xb'));logger[_0x0615('0xc')](_0x0615('0xd'),_0x35667b,_0x0615('0xb'),JSON[_0x0615('0xe')](_0x530c1e));if(_0x530c1e[_0x0615('0xf')]){if(_0x530c1e[_0x0615('0xf')][_0x0615('0x10')]===0x1f4){logger[_0x0615('0xf')](_0x0615('0xa'),_0x35667b,_0x530c1e[_0x0615('0xf')][_0x0615('0x11')]);return _0x4bea79(_0x530c1e[_0x0615('0xf')]['message']);}logger[_0x0615('0xf')](_0x0615('0xa'),_0x35667b,_0x530c1e['error'][_0x0615('0x11')]);return _0x1b8a11(_0x530c1e['error'][_0x0615('0x11')]);}else{logger[_0x0615('0x12')](_0x0615('0xa'),_0x35667b,_0x0615('0xb'));_0x1b8a11(_0x530c1e[_0x0615('0x13')]['message']);}})[_0x0615('0x14')](function(_0x4f7eba){logger[_0x0615('0xf')](_0x0615('0xa'),_0x35667b,_0x4f7eba);_0x4bea79(_0x4f7eba);});});}exports[_0x0615('0x15')]=function(_0x469bed){var _0x56d8e5=this;return new Promise(function(_0x54bd1a,_0x4c8239){return db[_0x0615('0x16')]['update'](_0x469bed[_0x0615('0x17')],{'raw':_0x469bed[_0x0615('0x18')]?_0x469bed['options'][_0x0615('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x469bed[_0x0615('0x18')]?_0x469bed[_0x0615('0x18')][_0x0615('0x1a')]||null:null,'attributes':_0x469bed[_0x0615('0x18')]?_0x469bed[_0x0615('0x18')]['attributes']||null:null,'limit':_0x469bed[_0x0615('0x18')]?_0x469bed[_0x0615('0x18')][_0x0615('0x1b')]||null:null})[_0x0615('0x9')](function(_0x259e81){logger[_0x0615('0x12')]('UpdateFaxApplication',_0x469bed);logger['debug'](_0x0615('0x15'),_0x469bed,JSON['stringify'](_0x259e81));_0x54bd1a(_0x259e81);})['catch'](function(_0x10db7d){logger[_0x0615('0xf')](_0x0615('0x15'),_0x10db7d['message'],_0x469bed);_0x4c8239(_0x56d8e5[_0x0615('0xf')](0x1f4,_0x10db7d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 62b5f05..3478986 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 _0xbd51=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show','post'];(function(_0x282551,_0x1e1cfb){var _0x8d3c06=function(_0x36fd4a){while(--_0x36fd4a){_0x282551['push'](_0x282551['shift']());}};_0x8d3c06(++_0x1e1cfb);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x2b9c88,_0x55f3db){_0x2b9c88=_0x2b9c88-0x0;var _0x3ff618=_0xbd51[_0x2b9c88];return _0x3ff618;};'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('./faxApplication.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 +var _0x207c=['./faxApplication.controller','get','/:id','isAuthenticated','post','create','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x96a742,_0x5dfcf9){var _0x2ed181=function(_0x539206){while(--_0x539206){_0x96a742['push'](_0x96a742['shift']());}};_0x2ed181(++_0x5dfcf9);}(_0x207c,0x1e8));var _0xc207=function(_0x2a12c1,_0x20dd3d){_0x2a12c1=_0x2a12c1-0x0;var _0xd296c4=_0x207c[_0x2a12c1];return _0xd296c4;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var auth=require(_0xc207('0x5'));var interaction=require(_0xc207('0x6'));var config=require('../../config/environment');var controller=require(_0xc207('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc207('0x8')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['show']);router[_0xc207('0xb')]('/',auth[_0xc207('0xa')](),controller[_0xc207('0xc')]);router['put'](_0xc207('0x9'),auth[_0xc207('0xa')](),controller[_0xc207('0xd')]);router[_0xc207('0xe')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['destroy']);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 457f756..dd19730 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 _0xcf95=['exports','STRING','DATE','ENUM','out','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5cf9('0x0'));module[_0x5cf9('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5cf9('0x2')]},'thirdDisposition':{'type':Sequelize[_0x5cf9('0x2')]},'note':{'type':Sequelize[_0x5cf9('0x2')]},'read1stAt':{'type':Sequelize[_0x5cf9('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x5cf9('0x4')]('in',_0x5cf9('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5cf9('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xc92f=['DATE','STRING','out','sequelize','exports'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xc92f,0xf3));var _0xfc92=function(_0x481ef1,_0x327a8a){_0x481ef1=_0x481ef1-0x0;var _0x357515=_0xc92f[_0x481ef1];return _0x357515;};'use strict';var Sequelize=require(_0xfc92('0x0'));module[_0xfc92('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfc92('0x2')]},'disposition':{'type':Sequelize[_0xfc92('0x3')]},'secondDisposition':{'type':Sequelize[_0xfc92('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfc92('0x3')]},'read1stAt':{'type':Sequelize[_0xfc92('0x2')]},'fax':{'type':Sequelize[_0xfc92('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfc92('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfc92('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 6d02e3f..324fd35 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 _0xa18b=['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','buildExpression','text','Tag','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','start','body','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','role','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','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','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','push','all','rows','catch','show','params','include','options','create','describe','omit','ids','getMessages','findOne','FaxMessage','merge','format','findAll','spread','emit','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','resolve','log','err','unlinkSync','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','Users','map','fullname','TagIds','Tags','index','FaxInteraction','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact'];(function(_0xa16c69,_0x1fdf49){var _0x426faf=function(_0x2bc966){while(--_0x2bc966){_0xa16c69['push'](_0xa16c69['shift']());}};_0x426faf(++_0x1fdf49);}(_0xa18b,0x14e));var _0xba18=function(_0x16ee48,_0x4e660d){_0x16ee48=_0x16ee48-0x0;var _0x23f7bf=_0xa18b[_0x16ee48];return _0x23f7bf;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xba18('0x0'));var zipdir=require(_0xba18('0x1'));var jsonpatch=require(_0xba18('0x2'));var rp=require(_0xba18('0x3'));var moment=require(_0xba18('0x4'));var BPromise=require(_0xba18('0x5'));var Mustache=require(_0xba18('0x6'));var util=require(_0xba18('0x7'));var path=require('path');var sox=require(_0xba18('0x8'));var csv=require(_0xba18('0x9'));var ejs=require(_0xba18('0xa'));var fs=require('fs');var _=require(_0xba18('0xb'));var squel=require(_0xba18('0xc'));var crypto=require(_0xba18('0xd'));var jsforce=require(_0xba18('0xe'));var deskjs=require(_0xba18('0xf'));var toCsv=require(_0xba18('0x9'));var querystring=require(_0xba18('0x10'));var Papa=require(_0xba18('0x11'));var Redis=require(_0xba18('0x12'));var authService=require(_0xba18('0x13'));var qs=require(_0xba18('0x14'));var as=require(_0xba18('0x15'));var hardwareService=require(_0xba18('0x16'));var logger=require(_0xba18('0x17'))('api');var utils=require(_0xba18('0x18'));var config=require(_0xba18('0x19'));var licenseUtil=require(_0xba18('0x1a'));var db=require(_0xba18('0x1b'))['db'];config[_0xba18('0x1c')]=_['defaults'](config[_0xba18('0x1c')],{'host':_0xba18('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba18('0x1c')]));require(_0xba18('0x1e'))[_0xba18('0x1f')](socket);function respondWithStatusCode(_0x204f76,_0x30c4f8){_0x30c4f8=_0x30c4f8||0xcc;return function(_0x169e98){if(_0x169e98){return _0x204f76[_0xba18('0x20')](_0x30c4f8);}return _0x204f76[_0xba18('0x21')](_0x30c4f8)[_0xba18('0x22')]();};}function respondWithResult(_0x372938,_0x684867){_0x684867=_0x684867||0xc8;return function(_0x561f88){if(_0x561f88){return _0x372938[_0xba18('0x21')](_0x684867)[_0xba18('0x23')](_0x561f88);}};}function respondWithFilteredResult(_0x748694,_0x55c101){return function(_0x12d4dc){if(_0x12d4dc){var _0x592208=_0x12d4dc[_0xba18('0x24')],_0x42655a=_0x55c101[_0xba18('0x25')],_0x428642=_0x55c101[_0xba18('0x25')]+_0x55c101[_0xba18('0x26')],_0x59a06c;if(_0x428642>=_0x592208){_0x428642=_0x592208;_0x59a06c=0xc8;}else{_0x59a06c=0xce;}_0x748694['status'](_0x59a06c);return _0x748694[_0xba18('0x27')](_0xba18('0x28'),_0x42655a+'-'+_0x428642+'/'+_0x592208)[_0xba18('0x23')](_0x12d4dc);}return null;};}function patchUpdates(_0x51efed){return function(_0x39a9a0){try{jsonpatch[_0xba18('0x29')](_0x39a9a0,_0x51efed,!![]);}catch(_0x3fad2e){return BPromise['reject'](_0x3fad2e);}return _0x39a9a0[_0xba18('0x2a')]();};}function saveUpdates(_0xed6cf6,_0x6a74d2){return function(_0x48313d){if(_0x48313d){return _0x48313d[_0xba18('0x2b')](_0xed6cf6)[_0xba18('0x2c')](function(_0x4143dc){return _0x4143dc;});}return null;};}function removeEntity(_0x167dcd,_0x14e64d){return function(_0x21bbbf){if(_0x21bbbf){return _0x21bbbf[_0xba18('0x2d')]()[_0xba18('0x2c')](function(){_0x167dcd[_0xba18('0x21')](0xcc)[_0xba18('0x22')]();});}};}function handleEntityNotFound(_0x437e0c,_0x3a9ef1){return function(_0x44237c){if(!_0x44237c){_0x437e0c[_0xba18('0x20')](0x194);}return _0x44237c;};}function handleError(_0x805529,_0x2277e7){_0x2277e7=_0x2277e7||0x1f4;return function(_0x535fe8){logger['error'](_0x535fe8[_0xba18('0x2e')]);if(_0x535fe8[_0xba18('0x2f')]){delete _0x535fe8[_0xba18('0x2f')];}_0x805529[_0xba18('0x21')](_0x2277e7)['send'](_0x535fe8);};}function getInteractionUsers(_0x28ce16,_0x12a3eb){return new BPromise(function(_0x1cef94,_0xa69fe9){try{if(_0x12a3eb[_0x28ce16['id']]){_0x28ce16[_0xba18('0x30')]=_[_0xba18('0x31')](_0x12a3eb[_0x28ce16['id']],function(_0x452da5){return{'id':_0x452da5['id'],'fullname':_0x452da5[_0xba18('0x32')]};});}}catch(_0x137860){_0xa69fe9(_0x137860);}_0x1cef94(_0x28ce16);});}function getInteractionTags(_0x9b6759,_0x3bb281){return new BPromise(function(_0xb05e86,_0x4294d5){try{if(_0x9b6759[_0xba18('0x33')]){_0x9b6759[_0xba18('0x34')]=[];_0x9b6759[_0xba18('0x33')]['split'](',')['forEach'](function(_0x3bee25){_0x9b6759['Tags']['push'](_0x3bb281[_0x3bee25]);});}delete _0x9b6759[_0xba18('0x33')];}catch(_0x19e266){_0x4294d5(_0x19e266);}_0xb05e86(_0x9b6759);});}function updateFaxInteraction(_0x526a21,_0xbce903,_0x1a7266){return new BPromise(function(_0x43535b,_0x1ddaa6){return getInteractionUsers(_0x526a21,_0x1a7266)['then'](function(_0x171b13){return getInteractionTags(_0x171b13,_0xbce903);})[_0xba18('0x2c')](function(_0x99722c){_0x43535b(_0x99722c);})['catch'](function(_0x6e307e){_0x1ddaa6(_0x6e307e);});});}exports[_0xba18('0x35')]=function(_0x4e13dc,_0x54e651){var _0x165470={},_0x3f8001={},_0x55cc08={'count':0x0,'rows':[]};var _0x13e6ad=_[_0xba18('0x31')](db[_0xba18('0x36')][_0xba18('0x37')],function(_0x23ea8c){return{'name':_0x23ea8c[_0xba18('0x38')],'type':_0x23ea8c[_0xba18('0x39')]['key']};});_0x3f8001[_0xba18('0x3a')]=_['map'](_0x13e6ad,_0xba18('0x2f'));_0x3f8001[_0xba18('0x3b')]=_[_0xba18('0x3c')](_0x4e13dc[_0xba18('0x3b')]);_0x3f8001['filters']=_['intersection'](_0x3f8001[_0xba18('0x3a')],_0x3f8001[_0xba18('0x3b')]);_0x165470[_0xba18('0x3d')]=_[_0xba18('0x3e')](_0x3f8001[_0xba18('0x3a')],qs['fields'](_0x4e13dc['query'][_0xba18('0x3f')]));_0x165470[_0xba18('0x3d')]=_0x165470[_0xba18('0x3d')][_0xba18('0x40')]?_0x165470[_0xba18('0x3d')]:_0x3f8001[_0xba18('0x3a')];if(!_0x4e13dc[_0xba18('0x3b')][_0xba18('0x41')](_0xba18('0x42'))){_0x165470[_0xba18('0x26')]=qs[_0xba18('0x26')](_0x4e13dc[_0xba18('0x3b')][_0xba18('0x26')]);_0x165470[_0xba18('0x25')]=qs['offset'](_0x4e13dc[_0xba18('0x3b')][_0xba18('0x25')]);}_0x165470[_0xba18('0x43')]=qs[_0xba18('0x44')](_0x4e13dc[_0xba18('0x3b')]['sort']);_0x165470[_0xba18('0x45')]=qs[_0xba18('0x46')](_[_0xba18('0x47')](_0x4e13dc['query'],_0x3f8001['filters']),_0x13e6ad);var _0x2482c6=[];var _0x50f6e0=squel[_0xba18('0x48')]()['field']('id')['field'](_0xba18('0x2f'))[_0xba18('0x49')](_0xba18('0x4a'))[_0xba18('0x4b')](_0xba18('0x4c'));var _0x75ec8c=squel['select']()['field'](_0xba18('0x4d'))[_0xba18('0x49')](_0xba18('0x4e'))[_0xba18('0x49')](_0xba18('0x4f'))[_0xba18('0x4b')](_0xba18('0x50'),'ui')[_0xba18('0x51')](_0xba18('0x52'),'u',_0xba18('0x53'));var _0x2739a8=squel[_0xba18('0x48')]()[_0xba18('0x4b')](_0xba18('0x54'),'i')['left_join'](_0xba18('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xba18('0x56'))[_0xba18('0x51')](_0xba18('0x57'),'a',_0xba18('0x58'))[_0xba18('0x51')](_0xba18('0x59'),'me',_0xba18('0x5a'))[_0xba18('0x51')]('fax_interaction_has_tags','it',_0xba18('0x5b'))[_0xba18('0x51')](_0xba18('0x4c'),'t',_0xba18('0x5c'));var _0x22fdd4=squel[_0xba18('0x5d')]();var _0xd0d750=[];var _0x3e3a0e=squel[_0xba18('0x5d')]();var _0x12ebc3;if(_0x4e13dc[_0xba18('0x3b')][_0xba18('0x5e')]){_0x12ebc3=as[_0xba18('0x5f')](_0x4e13dc[_0xba18('0x3b')]['search']);var _0x47768e=_0x12ebc3['sqlOperator'];for(var _0x12fa30=0x0;_0x12fa30<_0x12ebc3[_0xba18('0x60')][_0xba18('0x40')];_0x12fa30++){var _0x26b8e1=_0x12ebc3[_0xba18('0x60')][_0x12fa30];var _0x2b9d74='i';var _0x3a14d5=_[_0xba18('0x61')](_0x13e6ad,[_0xba18('0x2f'),_0x26b8e1['field']]);if(!_0x3a14d5){switch(_0x26b8e1[_0xba18('0x49')]){case _0xba18('0x62'):if(_0x26b8e1[_0xba18('0x63')]==0x1){_0x2739a8[_0xba18('0x64')]('`'+_0x26b8e1[_0xba18('0x49')]+_0xba18('0x65'));}else{_0x2739a8[_0xba18('0x64')]('`'+_0x26b8e1['field']+_0xba18('0x66'));}break;case _0xba18('0x67'):if(_0x26b8e1[_0xba18('0x68')]===_0xba18('0x69')){if(_0x26b8e1[_0xba18('0x63')]['split']('\x20')[_0xba18('0x40')]>0x1){_0x22fdd4[_0x47768e](_0xba18('0x6a'),qs[_0xba18('0x6b')](_0x26b8e1['value']),null);}else{var _0x162b1c='%'+_0x26b8e1['value']+'%';_0x22fdd4[_0x47768e](_0xba18('0x6c'),_0x162b1c,_0x162b1c,_0x162b1c);}}else{_0x3a14d5=_[_0xba18('0x61')](_0x13e6ad,[_0xba18('0x2f'),_0xba18('0x6d')]);_0x26b8e1[_0xba18('0x49')]=_0xba18('0x6d');_0x45c609=as[_0xba18('0x6e')](_0x2b9d74,_0x3a14d5[_0xba18('0x39')],_0x26b8e1);_0x22fdd4[_0x47768e](_0x45c609[_0xba18('0x6f')],_0x45c609[_0xba18('0x63')]['start'],_0x45c609['value'][_0xba18('0x22')]);}break;case _0xba18('0x70'):var _0x3acfb1=_0x26b8e1['value'][_0xba18('0x71')](',')[_0xba18('0x31')](function(_0x43de03){return Number(_0x43de03);});_0x3acfb1[_0xba18('0x72')](function(_0xbb1482){_0x3e3a0e['or'](_0xba18('0x73'),'%,'+_0xbb1482+',%');});_0xd0d750=_[_0xba18('0x74')](_0xd0d750,_0x3acfb1);break;case'User':if(_0x26b8e1['operator']===_0xba18('0x69')){_0x22fdd4[_0x47768e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x26b8e1[_0xba18('0x63')]+'%',null);}else{_0x3a14d5=_[_0xba18('0x61')](_0x13e6ad,[_0xba18('0x2f'),'UserId']);_0x26b8e1[_0xba18('0x49')]=_0xba18('0x75');_0x45c609=as[_0xba18('0x6e')](_0x2b9d74,_0x3a14d5[_0xba18('0x39')],_0x26b8e1);_0x22fdd4[_0x47768e](_0x45c609[_0xba18('0x6f')],_0x45c609[_0xba18('0x63')][_0xba18('0x76')],_0x45c609[_0xba18('0x63')]['end']);}break;case _0xba18('0x77'):_0x45c609=as[_0xba18('0x6e')]('me',null,_0x26b8e1);_0x22fdd4[_0x47768e](_0x45c609[_0xba18('0x6f')],_0x45c609[_0xba18('0x63')][_0xba18('0x76')],_0x45c609[_0xba18('0x63')][_0xba18('0x22')]);break;}}else{var _0x45c609=as[_0xba18('0x6e')](_0x2b9d74,_0x3a14d5[_0xba18('0x39')],_0x26b8e1);_0x22fdd4[_0x47768e](_0x45c609[_0xba18('0x6f')],_0x45c609[_0xba18('0x63')][_0xba18('0x76')],_0x45c609['value']['end']);}}}else{var _0x4af7fc=_(_0x4e13dc['query'])[_0xba18('0x3c')]()[_0xba18('0x31')](function(_0x78c1c4){return _[_0xba18('0x78')](_0x13e6ad,[_0xba18('0x2f'),_0x78c1c4])?_0x78c1c4:undefined;})[_0xba18('0x79')]()['value']();if(!_[_0xba18('0x7a')](_0x4af7fc)){_0x4af7fc['forEach'](function(_0x5edc15){if(_0x5edc15==='FaxAccountId'){_0x2739a8[_0xba18('0x45')](_0xba18('0x7b'),[][_0xba18('0x7c')](_0x4e13dc['query'][_0x5edc15]));}else if(_0x5edc15===_0xba18('0x7d')){var _0x3de66a=JSON['parse'](_0x4e13dc[_0xba18('0x3b')][_0x5edc15])[_0xba18('0x7e')];var _0x3de476=JSON['parse'](_0x4e13dc[_0xba18('0x3b')][_0x5edc15])['$lte'];_0x2739a8[_0xba18('0x45')](_0xba18('0x7f'),_0x3de66a,_0x3de476);}else{if(_0x4e13dc[_0xba18('0x3b')][_0x5edc15]===_0xba18('0x80')){_0x2739a8['where']('i.'+_0x5edc15+_0xba18('0x81'));}else{_0x2739a8['where']('i.'+_0x5edc15+_0xba18('0x82'),_0x4e13dc[_0xba18('0x3b')][_0x5edc15]);}}});}if(_0x4e13dc[_0xba18('0x3b')][_0xba18('0x83')]){if(_0x4e13dc['query'][_0xba18('0x83')]==0x1){_0x2739a8[_0xba18('0x64')]('`unreadMessages`\x20=\x200');}else{_0x2739a8[_0xba18('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x4e13dc['query'][_0xba18('0x84')]){_0xd0d750=_[_0xba18('0x85')](_0x4e13dc[_0xba18('0x3b')][_0xba18('0x84')])?_0x4e13dc[_0xba18('0x3b')]['tag']:new Array(_0x4e13dc[_0xba18('0x3b')][_0xba18('0x84')]);_0xd0d750[_0xba18('0x72')](function(_0x5159e7){_0x3e3a0e['or'](_0xba18('0x73'),'%,'+_0x5159e7+',%');});}if(_0x4e13dc[_0xba18('0x3b')][_0xba18('0x86')]){var _0x52b056=_0x4e13dc[_0xba18('0x3b')]['filter'][_0xba18('0x87')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xba18('0x88')](_0x52b056)){_0x22fdd4['or'](_0xba18('0x89'),_0x52b056+'%')['or']('i.fax\x20LIKE\x20?',_0x52b056+'%');}_0x22fdd4['or'](_0xba18('0x8a'),_0x52b056+'%');}}_0x2739a8['where'](_0x22fdd4);_0x2739a8[_0xba18('0x8b')](_0xba18('0x8c'));var _0x53c7e0={'type':db[_0xba18('0x8d')][_0xba18('0x8e')][_0xba18('0x8f')],'raw':!![]};var _0x1f1881=_0x2739a8[_0xba18('0x90')]();_0x1f1881[_0xba18('0x49')]('i.id');_0x1f1881['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xba18('0x62'));if(_0x165470[_0xba18('0x43')]){_0x165470[_0xba18('0x43')][_0xba18('0x72')](function(_0x1a88ac){var _0x257dc3=_0x1a88ac[0x0]===_0xba18('0x91')?_0x1a88ac[0x0]:'i.'+_0x1a88ac[0x0];_0x2739a8['order'](_0x257dc3,_0x1a88ac[0x1]===_0xba18('0x92')?![]:!![]);});}if(!_['isEmpty'](_0xd0d750)){_0x2739a8[_0xba18('0x64')](_0x3e3a0e);_0x1f1881[_0xba18('0x45')](_0xba18('0x93'),_0xd0d750);}BPromise['resolve']()[_0xba18('0x2c')](function(){if(!_0x12ebc3){if(_0x4e13dc['query'][_0xba18('0x94')])return;_0x1f1881[_0xba18('0x45')](_0xba18('0x95'));_0x2739a8['where'](_0xba18('0x95'));return;}if(_0x4e13dc[_0xba18('0x96')]['role']!==_0xba18('0x97'))return;return _0x4e13dc[_0xba18('0x96')][_0xba18('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x39a69b){if(_[_0xba18('0x7a')](_0x39a69b)){_0x1f1881[_0xba18('0x45')]('i.FaxAccountId\x20IS\x20NULL');_0x2739a8[_0xba18('0x45')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x1f1881['where'](_0xba18('0x7b'),_[_0xba18('0x31')](_0x39a69b,'id'));_0x2739a8[_0xba18('0x45')]('i.FaxAccountId\x20IN\x20?',_[_0xba18('0x31')](_0x39a69b,'id'));}});})['then'](function(){if(_0x4e13dc[_0xba18('0x96')][_0xba18('0x99')]==='agent'&&!_0x12ebc3&&!_0x4e13dc[_0xba18('0x3b')][_0xba18('0x94')])return[];return db[_0xba18('0x9a')]['query'](_0x1f1881['toString'](),_0x53c7e0);})[_0xba18('0x2c')](function(_0x437c8f){_0x55cc08[_0xba18('0x24')]=_0x437c8f['length'];if(_0x55cc08['count']===0x0)return[];return db[_0xba18('0x9a')]['query'](_0x50f6e0[_0xba18('0x9b')](),_0x53c7e0)[_0xba18('0x2c')](function(_0x4eea28){_0x2482c6=_['keyBy'](_0x4eea28,'id');_0x53c7e0=_['merge'](_0x53c7e0,{'model':db[_0xba18('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4e13dc[_0xba18('0x3b')][_0xba18('0x3f')]){_0x165470[_0xba18('0x3d')][_0xba18('0x72')](function(_0x308be6){_0x2739a8[_0xba18('0x49')]('i.'+_0x308be6);});}else{_0x2739a8[_0xba18('0x49')](_0xba18('0x9c'),'unreadMessages');_0x2739a8[_0xba18('0x49')](_0xba18('0x9d'),_0xba18('0x9e'));_0x2739a8[_0xba18('0x49')]('a.mandatoryDisposition',_0xba18('0x9f'));_0x2739a8['field'](_0xba18('0xa0'),_0xba18('0x91'));_0x2739a8[_0xba18('0x49')](_0xba18('0xa1'));_0x2739a8[_0xba18('0x49')](_0xba18('0xa2'),_0xba18('0xa3'));_0x2739a8['field'](_0xba18('0xa4'),_0xba18('0xa5'));_0x2739a8['field'](_0xba18('0xa6'),_0xba18('0xa7'));_0x2739a8['field']('c.phone',_0xba18('0xa8'));_0x2739a8['field'](_0xba18('0xa9'),_0xba18('0xaa'));_0x2739a8[_0xba18('0x49')](_0xba18('0xab'),'Contact.fax');_0x2739a8['field'](_0xba18('0xac'),'Owner.fullname');_0x2739a8['field'](_0xba18('0xad'),_0xba18('0xae'));_0x2739a8['field'](_0xba18('0xaf'),_0xba18('0x33'));}if(_0x165470[_0xba18('0x26')])_0x2739a8[_0xba18('0x26')](_0x165470[_0xba18('0x26')]);if(_0x165470['offset'])_0x2739a8[_0xba18('0x25')](_0x165470[_0xba18('0x25')]);return db['sequelize'][_0xba18('0x3b')](_0x2739a8[_0xba18('0x9b')](),_0x53c7e0);})[_0xba18('0x2c')](function(_0x552034){_0x75ec8c[_0xba18('0x45')](_0xba18('0xb0'),_[_0xba18('0x31')](_0x552034,'id'));return db[_0xba18('0x9a')][_0xba18('0x3b')](_0x75ec8c[_0xba18('0x9b')](),_0x53c7e0)[_0xba18('0x2c')](function(_0x21e737){var _0x143549=_[_0xba18('0xb1')](_0x21e737,_0xba18('0xb2'));var _0x27f44d=[];_0x552034[_0xba18('0x72')](function(_0x481cce){_0x27f44d[_0xba18('0xb3')](updateFaxInteraction(_0x481cce,_0x2482c6,_0x143549));});return BPromise[_0xba18('0xb4')](_0x27f44d);});});})[_0xba18('0x2c')](function(_0x441262){_0x55cc08[_0xba18('0xb5')]=_0x441262;return _0x55cc08;})[_0xba18('0x2c')](respondWithFilteredResult(_0x54e651,_0x165470))[_0xba18('0xb6')](handleError(_0x54e651,null));};exports[_0xba18('0xb7')]=function(_0x5b7c43,_0x5de95c){var _0x3c1313={'raw':![],'where':{'id':_0x5b7c43[_0xba18('0xb8')]['id']}},_0x694caf={};_0x694caf['model']=_[_0xba18('0x3c')](db[_0xba18('0x36')][_0xba18('0x37')]);_0x694caf[_0xba18('0x3b')]=_[_0xba18('0x3c')](_0x5b7c43[_0xba18('0x3b')]);_0x694caf[_0xba18('0x46')]=_['intersection'](_0x694caf[_0xba18('0x3a')],_0x694caf['query']);_0x3c1313[_0xba18('0x3d')]=_[_0xba18('0x3e')](_0x694caf[_0xba18('0x3a')],qs[_0xba18('0x3f')](_0x5b7c43[_0xba18('0x3b')][_0xba18('0x3f')]));_0x3c1313[_0xba18('0x3d')]=_0x3c1313[_0xba18('0x3d')][_0xba18('0x40')]?_0x3c1313[_0xba18('0x3d')]:_0x694caf[_0xba18('0x3a')];if(_0x5b7c43[_0xba18('0x3b')]['includeAll']){_0x3c1313[_0xba18('0xb9')]=[{'all':!![]}];}_0x3c1313=_['merge']({},_0x3c1313,_0x5b7c43[_0xba18('0xba')]);return db['FaxInteraction'][_0xba18('0x61')](_0x3c1313)[_0xba18('0x2c')](handleEntityNotFound(_0x5de95c,null))[_0xba18('0x2c')](respondWithResult(_0x5de95c,null))['catch'](handleError(_0x5de95c,null));};exports[_0xba18('0xbb')]=function(_0x2fe573,_0x345dc3){return db[_0xba18('0x36')][_0xba18('0xbb')](_0x2fe573[_0xba18('0x77')],{})['then'](respondWithResult(_0x345dc3,0xc9))['catch'](handleError(_0x345dc3,null));};exports[_0xba18('0x2b')]=function(_0x4fed34,_0x4c0788){if(_0x4fed34['body']['id']){delete _0x4fed34[_0xba18('0x77')]['id'];}return db[_0xba18('0x36')][_0xba18('0x61')]({'where':{'id':_0x4fed34[_0xba18('0xb8')]['id']}})[_0xba18('0x2c')](handleEntityNotFound(_0x4c0788,null))[_0xba18('0x2c')](saveUpdates(_0x4fed34['body'],null))[_0xba18('0x2c')](respondWithResult(_0x4c0788,null))[_0xba18('0xb6')](handleError(_0x4c0788,null));};exports[_0xba18('0x2d')]=function(_0x426b26,_0x2b01e2){return db[_0xba18('0x36')][_0xba18('0x61')]({'where':{'id':_0x426b26[_0xba18('0xb8')]['id']}})[_0xba18('0x2c')](handleEntityNotFound(_0x2b01e2,null))[_0xba18('0x2c')](removeEntity(_0x2b01e2,null))[_0xba18('0xb6')](handleError(_0x2b01e2,null));};exports[_0xba18('0xbc')]=function(_0xf3ca05,_0x416479){return db[_0xba18('0x36')][_0xba18('0xbc')]()[_0xba18('0x2c')](respondWithResult(_0x416479,null))[_0xba18('0xb6')](handleError(_0x416479,null));};exports['addMessage']=function(_0x216ce0,_0x44ce4c,_0x41af25){return db['FaxMessage'][_0xba18('0x61')]({'where':{'id':_0x216ce0[_0xba18('0xb8')]['id']}})[_0xba18('0x2c')](handleEntityNotFound(_0x44ce4c,null))['then'](function(_0x39d994){if(_0x39d994){return _0x39d994['addMessage'](_0x216ce0[_0xba18('0x77')]['ids'],_[_0xba18('0xbd')](_0x216ce0[_0xba18('0x77')],[_0xba18('0xbe'),'id'])||{});}})['then'](respondWithResult(_0x44ce4c,null))['catch'](handleError(_0x44ce4c,null));};exports[_0xba18('0xbf')]=function(_0x6dcebe,_0x257204,_0x1c8066){var _0x5b14da={'raw':![],'where':{}};var _0x161cac={};var _0x2d0298={'count':0x0,'rows':[]};return db[_0xba18('0x36')][_0xba18('0xc0')]({'where':{'id':_0x6dcebe[_0xba18('0xb8')]['id']}})[_0xba18('0x2c')](handleEntityNotFound(_0x257204,null))[_0xba18('0x2c')](function(_0x499aa5){if(_0x499aa5){_0x161cac[_0xba18('0x3a')]=_[_0xba18('0x3c')](db[_0xba18('0xc1')][_0xba18('0x37')]);_0x161cac[_0xba18('0x3b')]=_['keys'](_0x6dcebe[_0xba18('0x3b')]);_0x161cac[_0xba18('0x46')]=_[_0xba18('0x3e')](_0x161cac[_0xba18('0x3a')],_0x161cac[_0xba18('0x3b')]);_0x5b14da[_0xba18('0x3d')]=_[_0xba18('0x3e')](_0x161cac[_0xba18('0x3a')],qs[_0xba18('0x3f')](_0x6dcebe[_0xba18('0x3b')][_0xba18('0x3f')]));_0x5b14da[_0xba18('0x3d')]=_0x5b14da[_0xba18('0x3d')][_0xba18('0x40')]?_0x5b14da[_0xba18('0x3d')]:_0x161cac['model'];if(!_0x6dcebe[_0xba18('0x3b')]['hasOwnProperty']('nolimit')){_0x5b14da[_0xba18('0x26')]=qs[_0xba18('0x26')](_0x6dcebe[_0xba18('0x3b')][_0xba18('0x26')]);_0x5b14da[_0xba18('0x25')]=qs[_0xba18('0x25')](_0x6dcebe[_0xba18('0x3b')][_0xba18('0x25')]);}_0x5b14da[_0xba18('0x43')]=qs[_0xba18('0x44')](_0x6dcebe[_0xba18('0x3b')][_0xba18('0x44')]);_0x5b14da[_0xba18('0x45')]=qs[_0xba18('0x46')](_['pick'](_0x6dcebe[_0xba18('0x3b')],_0x161cac[_0xba18('0x46')]));_0x5b14da[_0xba18('0x45')][_0xba18('0xb2')]=_0x499aa5['id'];if(_0x6dcebe[_0xba18('0x3b')]['filter']){_0x5b14da[_0xba18('0x45')]=_[_0xba18('0xc2')](_0x5b14da[_0xba18('0x45')],{'$or':_['map'](_0x5b14da['attributes'],function(_0x4f8ddf){var _0x49a225={};_0x49a225[_0x4f8ddf]={'$like':'%'+_0x6dcebe[_0xba18('0x3b')][_0xba18('0x86')]+'%'};return _0x49a225;})});}if(_0x6dcebe['query'][_0xba18('0x7e')]){var _0x4f582d=_0x6dcebe['query']['$gte'][_0xba18('0x71')](',');var _0x5675ea={};_0x5675ea[_0x4f582d[0x0]]={'$gte':moment(_0x4f582d[0x1])[_0xba18('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5b14da[_0xba18('0x45')]=_[_0xba18('0xc2')](_0x5b14da['where'],_0x5675ea);}_0x5b14da=_[_0xba18('0xc2')]({},_0x5b14da,_0x6dcebe[_0xba18('0xba')]);return db[_0xba18('0xc1')][_0xba18('0x24')]({'where':_0x5b14da['where']})[_0xba18('0x2c')](function(_0xb452c2){_0x2d0298['count']=_0xb452c2;if(_0x6dcebe[_0xba18('0x3b')]['includeAll']){_0x5b14da['include']=[{'all':!![]}];}return db[_0xba18('0xc1')][_0xba18('0xc4')](_0x5b14da);})['then'](function(_0x31400e){_0x2d0298[_0xba18('0xb5')]=_0x31400e;return _0x2d0298;});}})[_0xba18('0x2c')](respondWithFilteredResult(_0x257204,_0x5b14da))[_0xba18('0xb6')](handleError(_0x257204,null));};exports['addTags']=function(_0x5b8c53,_0x5c95f0,_0x2cce23){return db[_0xba18('0x36')]['find']({'where':{'id':_0x5b8c53[_0xba18('0xb8')]['id']}})[_0xba18('0x2c')](handleEntityNotFound(_0x5c95f0,null))['then'](function(_0x4c03b8){if(_0x4c03b8){return _0x4c03b8['setTags'](_0x5b8c53[_0xba18('0x77')]['ids'],_[_0xba18('0xbd')](_0x5b8c53['body'],[_0xba18('0xbe'),'id'])||{})[_0xba18('0xc5')](function(){return db[_0xba18('0x70')][_0xba18('0xc4')]({'attributes':['id',_0xba18('0x2f'),'color'],'where':{'id':_0x5b8c53['body']['ids']}});})[_0xba18('0x2c')](function(_0x3d318e){socket[_0xba18('0xc6')]('faxInteractionTags:save',{'id':Number(_0x5b8c53[_0xba18('0xb8')]['id']),'tags':_0x3d318e||[]});return{'id':Number(_0x5b8c53[_0xba18('0xb8')]['id']),'tags':_0x3d318e||[]};});}})[_0xba18('0x2c')](respondWithResult(_0x5c95f0,null))['catch'](handleError(_0x5c95f0,null));};exports[_0xba18('0xc7')]=function(_0x51071a,_0xe4738,_0x4e2174){return db[_0xba18('0x36')]['find']({'where':{'id':_0x51071a['params']['id']}})[_0xba18('0x2c')](handleEntityNotFound(_0xe4738,null))[_0xba18('0x2c')](function(_0x101945){if(_0x101945){return _0x101945[_0xba18('0xc7')](_0x51071a[_0xba18('0x3b')][_0xba18('0xbe')]);}})['then'](respondWithStatusCode(_0xe4738,null))[_0xba18('0xb6')](handleError(_0xe4738,null));};exports['download']=function(_0x3e71db,_0x42a7d6){var _0x564173=moment()[_0xba18('0xc8')]()['toString']();var _0x4a7ec3=path[_0xba18('0xc9')](config[_0xba18('0xca')],_0xba18('0xcb'),_0xba18('0xcc'),_0xba18('0xcd'));var _0x1477d2=path[_0xba18('0xc9')](config[_0xba18('0xca')],_0xba18('0xcb'),_0xba18('0xcc'),_0xba18('0xce'));var _0x1c08e0=path[_0xba18('0xc9')](_0x4a7ec3,_0x564173);var _0x201a41=util[_0xba18('0xc3')](_0xba18('0xcf'),_0x3e71db[_0xba18('0xb8')]['id'],_0x564173);var _0x5cd6dd=path[_0xba18('0xc9')](_0x4a7ec3,_0x201a41);var _0x11eca3=[];_0x11eca3['push']({'model':db['Attachment'],'as':_0xba18('0xd0'),'raw':!![]});var _0x36b853=[{'model':db[_0xba18('0xc1')],'as':_0xba18('0xd1'),'attributes':['id',_0xba18('0x77'),_0xba18('0x7d')],'include':_0x11eca3}];return db[_0xba18('0x36')][_0xba18('0x61')]({'where':{'id':_0x3e71db[_0xba18('0xb8')]['id']},'include':_0x36b853})[_0xba18('0x2c')](handleEntityNotFound(_0x42a7d6,null))[_0xba18('0x2c')](function(_0x46e584){if(_0x46e584&&_0x46e584[_0xba18('0xd1')]){var _0x5a1f61=_0x46e584[_0xba18('0xd2')]({'plain':!![]});fs[_0xba18('0xd3')](_0x1c08e0);for(var _0x3a4aa4=0x0;_0x3a4aa4<_0x5a1f61[_0xba18('0xd1')][_0xba18('0x40')];_0x3a4aa4++){var _0x5505de=_0x5a1f61[_0xba18('0xd1')][_0x3a4aa4][_0xba18('0xd0')];if(_0x5505de){var _0x3c44d6=path[_0xba18('0xc9')](_0x1477d2,_0x5505de[_0xba18('0xd4')]);if(fs[_0xba18('0xd5')](_0x3c44d6)){fs[_0xba18('0xd6')](_0x3c44d6)['pipe'](fs['createWriteStream'](path[_0xba18('0xc9')](_0x1c08e0,_0x5505de[_0xba18('0xd4')])));}}}return BPromise[_0xba18('0xd7')]()[_0xba18('0x2c')](function(){return new BPromise(function(_0x38a0cb,_0x291973){zipdir(_0x1c08e0,{'saveTo':_0x5cd6dd},function(_0x308eb0,_0x7f42d4){if(_0x308eb0)return _0x291973(_0x308eb0);return _0x38a0cb(_0x7f42d4);});})[_0xba18('0x2c')](function(){return new BPromise(function(_0x56b225,_0x287f16){rimraf(_0x1c08e0,function(_0x2677a8){if(_0x2677a8)_0x287f16(_0x2677a8);return _0x56b225();});});})['then'](function(){return _0x42a7d6['download'](_0x5cd6dd,_0x201a41,function(_0x2457f1){if(_0x2457f1){console[_0xba18('0xd8')](_0xba18('0xd9'),_0x2457f1);}else{fs[_0xba18('0xda')](_0x5cd6dd);}});});});}else{return _0x42a7d6[_0xba18('0x20')](0xc8);}})['catch'](handleError(_0x42a7d6,null));}; \ No newline at end of file +var _0x7937=['resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','FaxAccountId','sequelize','toString','count','keyBy','merge','Account.key','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','c.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','push','all','rows','show','params','includeAll','find','create','update','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','rawAttributes','format','options','include','setTags','spread','faxInteractionTags:save','removeTags','unix','join','root','files','server','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','download','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','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','sendStatus','end','status','json','offset','limit','set','Content-Range','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','catch','FaxInteraction','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','color','from','tools_tags','field','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.FaxAccountId','fax_messages','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','ContactId','buildExpression','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7937,0x1e5));var _0x7793=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0x7937[_0x514c15];return _0x16283e;};'use strict';var pdf=require(_0x7793('0x0'));var emlformat=require(_0x7793('0x1'));var rimraf=require(_0x7793('0x2'));var zipdir=require(_0x7793('0x3'));var jsonpatch=require(_0x7793('0x4'));var rp=require('request-promise');var moment=require(_0x7793('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7793('0x6'));var util=require(_0x7793('0x7'));var path=require(_0x7793('0x8'));var sox=require(_0x7793('0x9'));var csv=require(_0x7793('0xa'));var ejs=require(_0x7793('0xb'));var fs=require('fs');var _=require(_0x7793('0xc'));var squel=require('squel');var crypto=require(_0x7793('0xd'));var jsforce=require(_0x7793('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7793('0xa'));var querystring=require(_0x7793('0xf'));var Papa=require(_0x7793('0x10'));var Redis=require('ioredis');var authService=require(_0x7793('0x11'));var qs=require(_0x7793('0x12'));var as=require(_0x7793('0x13'));var hardwareService=require(_0x7793('0x14'));var logger=require(_0x7793('0x15'))(_0x7793('0x16'));var utils=require(_0x7793('0x17'));var config=require(_0x7793('0x18'));var licenseUtil=require(_0x7793('0x19'));var db=require(_0x7793('0x1a'))['db'];config[_0x7793('0x1b')]=_[_0x7793('0x1c')](config[_0x7793('0x1b')],{'host':_0x7793('0x1d'),'port':0x18eb});var socket=require(_0x7793('0x1e'))(new Redis(config['redis']));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x580517,_0x3fa2bf){_0x3fa2bf=_0x3fa2bf||0xcc;return function(_0x10a532){if(_0x10a532){return _0x580517[_0x7793('0x1f')](_0x3fa2bf);}return _0x580517['status'](_0x3fa2bf)[_0x7793('0x20')]();};}function respondWithResult(_0x31f80f,_0x774a5b){_0x774a5b=_0x774a5b||0xc8;return function(_0x364642){if(_0x364642){return _0x31f80f[_0x7793('0x21')](_0x774a5b)[_0x7793('0x22')](_0x364642);}};}function respondWithFilteredResult(_0xb81afb,_0x38a18d){return function(_0x286fba){if(_0x286fba){var _0x42f04d=_0x286fba['count'],_0x4332b9=_0x38a18d[_0x7793('0x23')],_0xacdacf=_0x38a18d[_0x7793('0x23')]+_0x38a18d[_0x7793('0x24')],_0x342c34;if(_0xacdacf>=_0x42f04d){_0xacdacf=_0x42f04d;_0x342c34=0xc8;}else{_0x342c34=0xce;}_0xb81afb[_0x7793('0x21')](_0x342c34);return _0xb81afb[_0x7793('0x25')](_0x7793('0x26'),_0x4332b9+'-'+_0xacdacf+'/'+_0x42f04d)['json'](_0x286fba);}return null;};}function patchUpdates(_0x1d5add){return function(_0x347a8b){try{jsonpatch['apply'](_0x347a8b,_0x1d5add,!![]);}catch(_0x5b2bc0){return BPromise['reject'](_0x5b2bc0);}return _0x347a8b[_0x7793('0x27')]();};}function saveUpdates(_0xee53ff,_0x153e12){return function(_0x5db993){if(_0x5db993){return _0x5db993['update'](_0xee53ff)[_0x7793('0x28')](function(_0x29675d){return _0x29675d;});}return null;};}function removeEntity(_0x407168,_0x24ce4d){return function(_0x32842e){if(_0x32842e){return _0x32842e[_0x7793('0x29')]()['then'](function(){_0x407168[_0x7793('0x21')](0xcc)[_0x7793('0x20')]();});}};}function handleEntityNotFound(_0x3f1a5b,_0x52939e){return function(_0x566e3f){if(!_0x566e3f){_0x3f1a5b[_0x7793('0x1f')](0x194);}return _0x566e3f;};}function handleError(_0x79efa0,_0x342337){_0x342337=_0x342337||0x1f4;return function(_0x4aebb1){logger[_0x7793('0x2a')](_0x4aebb1[_0x7793('0x2b')]);if(_0x4aebb1[_0x7793('0x2c')]){delete _0x4aebb1[_0x7793('0x2c')];}_0x79efa0[_0x7793('0x21')](_0x342337)[_0x7793('0x2d')](_0x4aebb1);};}function getInteractionUsers(_0x5508a3,_0x264c23){return new BPromise(function(_0x50a128,_0x36afaa){try{if(_0x264c23[_0x5508a3['id']]){_0x5508a3[_0x7793('0x2e')]=_[_0x7793('0x2f')](_0x264c23[_0x5508a3['id']],function(_0x245be6){return{'id':_0x245be6['id'],'fullname':_0x245be6[_0x7793('0x30')]};});}}catch(_0x3ad194){_0x36afaa(_0x3ad194);}_0x50a128(_0x5508a3);});}function getInteractionTags(_0x4e23c3,_0x4a9c97){return new BPromise(function(_0x38c1be,_0x2fc5a7){try{if(_0x4e23c3[_0x7793('0x31')]){_0x4e23c3['Tags']=[];_0x4e23c3['TagIds']['split'](',')[_0x7793('0x32')](function(_0x55447d){_0x4e23c3[_0x7793('0x33')]['push'](_0x4a9c97[_0x55447d]);});}delete _0x4e23c3[_0x7793('0x31')];}catch(_0x3ef3d8){_0x2fc5a7(_0x3ef3d8);}_0x38c1be(_0x4e23c3);});}function updateFaxInteraction(_0x2ea8a4,_0x22083c,_0x5f3ade){return new BPromise(function(_0x1be2b1,_0x101ed8){return getInteractionUsers(_0x2ea8a4,_0x5f3ade)[_0x7793('0x28')](function(_0x649715){return getInteractionTags(_0x649715,_0x22083c);})['then'](function(_0x224799){_0x1be2b1(_0x224799);})[_0x7793('0x34')](function(_0x4d3f0){_0x101ed8(_0x4d3f0);});});}exports['index']=function(_0x3a5bc6,_0x15652d){var _0x5ce7b4={},_0x4bc327={},_0x348342={'count':0x0,'rows':[]};var _0x31dab3=_[_0x7793('0x2f')](db[_0x7793('0x35')]['rawAttributes'],function(_0x2f3625){return{'name':_0x2f3625[_0x7793('0x36')],'type':_0x2f3625[_0x7793('0x37')][_0x7793('0x38')]};});_0x4bc327[_0x7793('0x39')]=_[_0x7793('0x2f')](_0x31dab3,_0x7793('0x2c'));_0x4bc327[_0x7793('0x3a')]=_[_0x7793('0x3b')](_0x3a5bc6[_0x7793('0x3a')]);_0x4bc327[_0x7793('0x3c')]=_[_0x7793('0x3d')](_0x4bc327[_0x7793('0x39')],_0x4bc327[_0x7793('0x3a')]);_0x5ce7b4['attributes']=_[_0x7793('0x3d')](_0x4bc327[_0x7793('0x39')],qs[_0x7793('0x3e')](_0x3a5bc6['query'][_0x7793('0x3e')]));_0x5ce7b4[_0x7793('0x3f')]=_0x5ce7b4[_0x7793('0x3f')][_0x7793('0x40')]?_0x5ce7b4[_0x7793('0x3f')]:_0x4bc327['model'];if(!_0x3a5bc6[_0x7793('0x3a')][_0x7793('0x41')](_0x7793('0x42'))){_0x5ce7b4['limit']=qs[_0x7793('0x24')](_0x3a5bc6[_0x7793('0x3a')][_0x7793('0x24')]);_0x5ce7b4['offset']=qs[_0x7793('0x23')](_0x3a5bc6['query'][_0x7793('0x23')]);}_0x5ce7b4[_0x7793('0x43')]=qs['sort'](_0x3a5bc6['query'][_0x7793('0x44')]);_0x5ce7b4[_0x7793('0x45')]=qs[_0x7793('0x3c')](_[_0x7793('0x46')](_0x3a5bc6[_0x7793('0x3a')],_0x4bc327[_0x7793('0x3c')]),_0x31dab3);var _0x48a1c7=[];var _0xb5359a=squel[_0x7793('0x47')]()['field']('id')['field'](_0x7793('0x2c'))['field'](_0x7793('0x48'))[_0x7793('0x49')](_0x7793('0x4a'));var _0x231c02=squel[_0x7793('0x47')]()[_0x7793('0x4b')](_0x7793('0x4c'))[_0x7793('0x4b')](_0x7793('0x4d'))['field'](_0x7793('0x4e'))[_0x7793('0x49')](_0x7793('0x4f'),'ui')[_0x7793('0x50')]('users','u',_0x7793('0x51'));var _0x2aba88=squel['select']()[_0x7793('0x49')](_0x7793('0x52'),'i')[_0x7793('0x50')](_0x7793('0x53'),'c',_0x7793('0x54'))[_0x7793('0x50')]('users','o','o.id\x20=\x20i.UserId')[_0x7793('0x50')]('fax_accounts','a',_0x7793('0x55'))[_0x7793('0x50')](_0x7793('0x56'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x7793('0x50')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0x7793('0x50')](_0x7793('0x4a'),'t',_0x7793('0x57'));var _0x1d44d6=squel[_0x7793('0x58')]();var _0xd1458b=[];var _0x196bfc=squel[_0x7793('0x58')]();var _0x494500;if(_0x3a5bc6[_0x7793('0x3a')][_0x7793('0x59')]){_0x494500=as[_0x7793('0x5a')](_0x3a5bc6[_0x7793('0x3a')]['search']);var _0x1f5655=_0x494500[_0x7793('0x5b')];for(var _0x40336f=0x0;_0x40336f<_0x494500[_0x7793('0x5c')][_0x7793('0x40')];_0x40336f++){var _0x1a4a62=_0x494500[_0x7793('0x5c')][_0x40336f];var _0x2ec851='i';var _0x225a9b=_['find'](_0x31dab3,[_0x7793('0x2c'),_0x1a4a62[_0x7793('0x4b')]]);if(!_0x225a9b){switch(_0x1a4a62['field']){case _0x7793('0x5d'):if(_0x1a4a62[_0x7793('0x5e')]==0x1){_0x2aba88[_0x7793('0x5f')]('`'+_0x1a4a62[_0x7793('0x4b')]+_0x7793('0x60'));}else{_0x2aba88[_0x7793('0x5f')]('`'+_0x1a4a62[_0x7793('0x4b')]+_0x7793('0x61'));}break;case _0x7793('0x62'):if(_0x1a4a62[_0x7793('0x63')]===_0x7793('0x64')){if(_0x1a4a62[_0x7793('0x5e')]['split']('\x20')[_0x7793('0x40')]>0x1){_0x1d44d6[_0x1f5655]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7793('0x65')](_0x1a4a62[_0x7793('0x5e')]),null);}else{var _0x3a8017='%'+_0x1a4a62[_0x7793('0x5e')]+'%';_0x1d44d6[_0x1f5655]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3a8017,_0x3a8017,_0x3a8017);}}else{_0x225a9b=_['find'](_0x31dab3,[_0x7793('0x2c'),_0x7793('0x66')]);_0x1a4a62[_0x7793('0x4b')]='ContactId';_0x163551=as[_0x7793('0x67')](_0x2ec851,_0x225a9b[_0x7793('0x37')],_0x1a4a62);_0x1d44d6[_0x1f5655](_0x163551[_0x7793('0x68')],_0x163551['value'][_0x7793('0x69')],_0x163551[_0x7793('0x5e')][_0x7793('0x20')]);}break;case _0x7793('0x6a'):var _0x563073=_0x1a4a62[_0x7793('0x5e')][_0x7793('0x6b')](',')[_0x7793('0x2f')](function(_0x2b280b){return Number(_0x2b280b);});_0x563073['forEach'](function(_0x46e739){_0x196bfc['or'](_0x7793('0x6c'),'%,'+_0x46e739+',%');});_0xd1458b=_['union'](_0xd1458b,_0x563073);break;case _0x7793('0x6d'):if(_0x1a4a62[_0x7793('0x63')]===_0x7793('0x64')){_0x1d44d6[_0x1f5655](_0x7793('0x6e'),'%'+_0x1a4a62[_0x7793('0x5e')]+'%',null);}else{_0x225a9b=_['find'](_0x31dab3,[_0x7793('0x2c'),_0x7793('0x6f')]);_0x1a4a62['field']=_0x7793('0x6f');_0x163551=as[_0x7793('0x67')](_0x2ec851,_0x225a9b[_0x7793('0x37')],_0x1a4a62);_0x1d44d6[_0x1f5655](_0x163551['text'],_0x163551[_0x7793('0x5e')][_0x7793('0x69')],_0x163551[_0x7793('0x5e')][_0x7793('0x20')]);}break;case _0x7793('0x70'):_0x163551=as[_0x7793('0x67')]('me',null,_0x1a4a62);_0x1d44d6[_0x1f5655](_0x163551[_0x7793('0x68')],_0x163551[_0x7793('0x5e')]['start'],_0x163551['value']['end']);break;}}else{var _0x163551=as[_0x7793('0x67')](_0x2ec851,_0x225a9b['type'],_0x1a4a62);_0x1d44d6[_0x1f5655](_0x163551[_0x7793('0x68')],_0x163551[_0x7793('0x5e')][_0x7793('0x69')],_0x163551[_0x7793('0x5e')]['end']);}}}else{var _0x55ae5b=_(_0x3a5bc6[_0x7793('0x3a')])[_0x7793('0x3b')]()[_0x7793('0x2f')](function(_0xc2c9ad){return _[_0x7793('0x71')](_0x31dab3,[_0x7793('0x2c'),_0xc2c9ad])?_0xc2c9ad:undefined;})[_0x7793('0x72')]()[_0x7793('0x5e')]();if(!_[_0x7793('0x73')](_0x55ae5b)){_0x55ae5b[_0x7793('0x32')](function(_0x41cd86){if(_0x41cd86==='FaxAccountId'){_0x2aba88[_0x7793('0x45')](_0x7793('0x74'),[][_0x7793('0x75')](_0x3a5bc6['query'][_0x41cd86]));}else if(_0x41cd86===_0x7793('0x76')){var _0x469bbd=JSON[_0x7793('0x77')](_0x3a5bc6[_0x7793('0x3a')][_0x41cd86])[_0x7793('0x78')];var _0x37d3c0=JSON['parse'](_0x3a5bc6[_0x7793('0x3a')][_0x41cd86])[_0x7793('0x79')];_0x2aba88[_0x7793('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x469bbd,_0x37d3c0);}else{if(_0x3a5bc6['query'][_0x41cd86]===_0x7793('0x7a')){_0x2aba88['where']('i.'+_0x41cd86+_0x7793('0x7b'));}else{_0x2aba88['where']('i.'+_0x41cd86+_0x7793('0x7c'),_0x3a5bc6[_0x7793('0x3a')][_0x41cd86]);}}});}if(_0x3a5bc6[_0x7793('0x3a')]['read']){if(_0x3a5bc6[_0x7793('0x3a')][_0x7793('0x7d')]==0x1){_0x2aba88[_0x7793('0x5f')](_0x7793('0x7e'));}else{_0x2aba88[_0x7793('0x5f')](_0x7793('0x7f'));}}if(_0x3a5bc6[_0x7793('0x3a')]['tag']){_0xd1458b=_[_0x7793('0x80')](_0x3a5bc6[_0x7793('0x3a')][_0x7793('0x81')])?_0x3a5bc6[_0x7793('0x3a')][_0x7793('0x81')]:new Array(_0x3a5bc6[_0x7793('0x3a')][_0x7793('0x81')]);_0xd1458b[_0x7793('0x32')](function(_0x3d9d32){_0x196bfc['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3d9d32+',%');});}if(_0x3a5bc6[_0x7793('0x3a')]['filter']){var _0x49f642=_0x3a5bc6[_0x7793('0x3a')][_0x7793('0x82')][_0x7793('0x83')]('\x5c','\x5c\x5c')[_0x7793('0x83')](/'/g,'\x27\x27');if(qs[_0x7793('0x84')](_0x49f642)){_0x1d44d6['or'](_0x7793('0x85'),_0x49f642+'%')['or'](_0x7793('0x86'),_0x49f642+'%');}_0x1d44d6['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x49f642+'%');}}_0x2aba88['where'](_0x1d44d6);_0x2aba88[_0x7793('0x87')](_0x7793('0x88'));var _0x31ae1d={'type':db['Sequelize'][_0x7793('0x89')][_0x7793('0x8a')],'raw':!![]};var _0x18109e=_0x2aba88['clone']();_0x18109e['field']('i.id');_0x18109e[_0x7793('0x4b')](_0x7793('0x8b'),_0x7793('0x5d'));if(_0x5ce7b4[_0x7793('0x43')]){_0x5ce7b4[_0x7793('0x43')][_0x7793('0x32')](function(_0x3216c2){var _0x223402=_0x3216c2[0x0]===_0x7793('0x8c')?_0x3216c2[0x0]:'i.'+_0x3216c2[0x0];_0x2aba88[_0x7793('0x43')](_0x223402,_0x3216c2[0x1]===_0x7793('0x8d')?![]:!![]);});}if(!_[_0x7793('0x73')](_0xd1458b)){_0x2aba88[_0x7793('0x5f')](_0x196bfc);_0x18109e[_0x7793('0x45')]('t.id\x20IN\x20?',_0xd1458b);}BPromise[_0x7793('0x8e')]()[_0x7793('0x28')](function(){if(!_0x494500){if(_0x3a5bc6['query']['FaxAccountId'])return;_0x18109e[_0x7793('0x45')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x2aba88[_0x7793('0x45')](_0x7793('0x8f'));return;}if(_0x3a5bc6['user'][_0x7793('0x90')]!==_0x7793('0x91'))return;return _0x3a5bc6[_0x7793('0x92')][_0x7793('0x93')]({'attributes':['id'],'raw':!![]})[_0x7793('0x28')](function(_0x2eef88){if(_[_0x7793('0x73')](_0x2eef88)){_0x18109e[_0x7793('0x45')](_0x7793('0x94'));_0x2aba88[_0x7793('0x45')](_0x7793('0x94'));}else{_0x18109e[_0x7793('0x45')](_0x7793('0x74'),_['map'](_0x2eef88,'id'));_0x2aba88['where'](_0x7793('0x74'),_[_0x7793('0x2f')](_0x2eef88,'id'));}});})[_0x7793('0x28')](function(){if(_0x3a5bc6[_0x7793('0x92')]['role']===_0x7793('0x91')&&!_0x494500&&!_0x3a5bc6['query'][_0x7793('0x95')])return[];return db[_0x7793('0x96')][_0x7793('0x3a')](_0x18109e[_0x7793('0x97')](),_0x31ae1d);})[_0x7793('0x28')](function(_0x5787de){_0x348342[_0x7793('0x98')]=_0x5787de['length'];if(_0x348342[_0x7793('0x98')]===0x0)return[];return db[_0x7793('0x96')][_0x7793('0x3a')](_0xb5359a[_0x7793('0x97')](),_0x31ae1d)['then'](function(_0xb8d1ea){_0x48a1c7=_[_0x7793('0x99')](_0xb8d1ea,'id');_0x31ae1d=_[_0x7793('0x9a')](_0x31ae1d,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a5bc6[_0x7793('0x3a')][_0x7793('0x3e')]){_0x5ce7b4[_0x7793('0x3f')]['forEach'](function(_0x4532e5){_0x2aba88['field']('i.'+_0x4532e5);});}else{_0x2aba88[_0x7793('0x4b')](_0x7793('0x8b'),_0x7793('0x5d'));_0x2aba88[_0x7793('0x4b')]('a.key',_0x7793('0x9b'));_0x2aba88['field']('a.mandatoryDisposition',_0x7793('0x9c'));_0x2aba88[_0x7793('0x4b')](_0x7793('0x9d'),_0x7793('0x8c'));_0x2aba88[_0x7793('0x4b')]('i.*');_0x2aba88[_0x7793('0x4b')]('c.firstName','Contact.firstName');_0x2aba88[_0x7793('0x4b')](_0x7793('0x9e'),'Contact.lastName');_0x2aba88[_0x7793('0x4b')](_0x7793('0x9f'),'Contact.email');_0x2aba88[_0x7793('0x4b')](_0x7793('0xa0'),_0x7793('0xa1'));_0x2aba88[_0x7793('0x4b')]('c.mobile',_0x7793('0xa2'));_0x2aba88[_0x7793('0x4b')](_0x7793('0xa3'),'Contact.fax');_0x2aba88[_0x7793('0x4b')](_0x7793('0xa4'),'Owner.fullname');_0x2aba88[_0x7793('0x4b')](_0x7793('0xa5'),_0x7793('0xa6'));_0x2aba88[_0x7793('0x4b')](_0x7793('0xa7'),_0x7793('0x31'));}if(_0x5ce7b4[_0x7793('0x24')])_0x2aba88[_0x7793('0x24')](_0x5ce7b4[_0x7793('0x24')]);if(_0x5ce7b4[_0x7793('0x23')])_0x2aba88[_0x7793('0x23')](_0x5ce7b4[_0x7793('0x23')]);return db[_0x7793('0x96')][_0x7793('0x3a')](_0x2aba88[_0x7793('0x97')](),_0x31ae1d);})[_0x7793('0x28')](function(_0x50df79){_0x231c02['where']('ui.FaxInteractionId\x20IN\x20?',_[_0x7793('0x2f')](_0x50df79,'id'));return db['sequelize'][_0x7793('0x3a')](_0x231c02[_0x7793('0x97')](),_0x31ae1d)['then'](function(_0x1e8914){var _0x16c916=_[_0x7793('0xa8')](_0x1e8914,_0x7793('0xa9'));var _0xd03203=[];_0x50df79['forEach'](function(_0x40601c){_0xd03203[_0x7793('0xaa')](updateFaxInteraction(_0x40601c,_0x48a1c7,_0x16c916));});return BPromise[_0x7793('0xab')](_0xd03203);});});})[_0x7793('0x28')](function(_0x5bbc1a){_0x348342[_0x7793('0xac')]=_0x5bbc1a;return _0x348342;})[_0x7793('0x28')](respondWithFilteredResult(_0x15652d,_0x5ce7b4))[_0x7793('0x34')](handleError(_0x15652d,null));};exports[_0x7793('0xad')]=function(_0x210d77,_0x54499b){var _0x5ad7a5={'raw':![],'where':{'id':_0x210d77[_0x7793('0xae')]['id']}},_0x343848={};_0x343848[_0x7793('0x39')]=_['keys'](db[_0x7793('0x35')]['rawAttributes']);_0x343848[_0x7793('0x3a')]=_[_0x7793('0x3b')](_0x210d77[_0x7793('0x3a')]);_0x343848[_0x7793('0x3c')]=_[_0x7793('0x3d')](_0x343848[_0x7793('0x39')],_0x343848['query']);_0x5ad7a5[_0x7793('0x3f')]=_['intersection'](_0x343848[_0x7793('0x39')],qs[_0x7793('0x3e')](_0x210d77[_0x7793('0x3a')][_0x7793('0x3e')]));_0x5ad7a5[_0x7793('0x3f')]=_0x5ad7a5['attributes'][_0x7793('0x40')]?_0x5ad7a5[_0x7793('0x3f')]:_0x343848[_0x7793('0x39')];if(_0x210d77['query'][_0x7793('0xaf')]){_0x5ad7a5['include']=[{'all':!![]}];}_0x5ad7a5=_[_0x7793('0x9a')]({},_0x5ad7a5,_0x210d77['options']);return db[_0x7793('0x35')][_0x7793('0xb0')](_0x5ad7a5)[_0x7793('0x28')](handleEntityNotFound(_0x54499b,null))[_0x7793('0x28')](respondWithResult(_0x54499b,null))['catch'](handleError(_0x54499b,null));};exports[_0x7793('0xb1')]=function(_0x9152ba,_0x42ddda){return db[_0x7793('0x35')][_0x7793('0xb1')](_0x9152ba['body'],{})[_0x7793('0x28')](respondWithResult(_0x42ddda,0xc9))[_0x7793('0x34')](handleError(_0x42ddda,null));};exports[_0x7793('0xb2')]=function(_0xbd8e7a,_0x1fd878){if(_0xbd8e7a['body']['id']){delete _0xbd8e7a[_0x7793('0x70')]['id'];}return db[_0x7793('0x35')][_0x7793('0xb0')]({'where':{'id':_0xbd8e7a[_0x7793('0xae')]['id']}})[_0x7793('0x28')](handleEntityNotFound(_0x1fd878,null))[_0x7793('0x28')](saveUpdates(_0xbd8e7a[_0x7793('0x70')],null))[_0x7793('0x28')](respondWithResult(_0x1fd878,null))[_0x7793('0x34')](handleError(_0x1fd878,null));};exports['destroy']=function(_0x45818e,_0xce7d8a){return db[_0x7793('0x35')][_0x7793('0xb0')]({'where':{'id':_0x45818e[_0x7793('0xae')]['id']}})[_0x7793('0x28')](handleEntityNotFound(_0xce7d8a,null))[_0x7793('0x28')](removeEntity(_0xce7d8a,null))[_0x7793('0x34')](handleError(_0xce7d8a,null));};exports['describe']=function(_0x1e8948,_0x3a4926){return db[_0x7793('0x35')][_0x7793('0xb3')]()['then'](respondWithResult(_0x3a4926,null))[_0x7793('0x34')](handleError(_0x3a4926,null));};exports[_0x7793('0xb4')]=function(_0x23ab91,_0x1d57e5,_0x23485e){return db[_0x7793('0xb5')]['find']({'where':{'id':_0x23ab91[_0x7793('0xae')]['id']}})[_0x7793('0x28')](handleEntityNotFound(_0x1d57e5,null))[_0x7793('0x28')](function(_0x796dc9){if(_0x796dc9){return _0x796dc9['addMessage'](_0x23ab91[_0x7793('0x70')][_0x7793('0xb6')],_[_0x7793('0xb7')](_0x23ab91[_0x7793('0x70')],['ids','id'])||{});}})[_0x7793('0x28')](respondWithResult(_0x1d57e5,null))[_0x7793('0x34')](handleError(_0x1d57e5,null));};exports[_0x7793('0xb8')]=function(_0x2d62ae,_0x813da9,_0x263f95){var _0xf962e9={'raw':![],'where':{}};var _0x48a7e5={};var _0x7276db={'count':0x0,'rows':[]};return db[_0x7793('0x35')][_0x7793('0xb9')]({'where':{'id':_0x2d62ae[_0x7793('0xae')]['id']}})[_0x7793('0x28')](handleEntityNotFound(_0x813da9,null))[_0x7793('0x28')](function(_0x516669){if(_0x516669){_0x48a7e5[_0x7793('0x39')]=_[_0x7793('0x3b')](db['FaxMessage'][_0x7793('0xba')]);_0x48a7e5[_0x7793('0x3a')]=_[_0x7793('0x3b')](_0x2d62ae[_0x7793('0x3a')]);_0x48a7e5['filters']=_[_0x7793('0x3d')](_0x48a7e5[_0x7793('0x39')],_0x48a7e5[_0x7793('0x3a')]);_0xf962e9[_0x7793('0x3f')]=_[_0x7793('0x3d')](_0x48a7e5[_0x7793('0x39')],qs[_0x7793('0x3e')](_0x2d62ae[_0x7793('0x3a')][_0x7793('0x3e')]));_0xf962e9[_0x7793('0x3f')]=_0xf962e9[_0x7793('0x3f')][_0x7793('0x40')]?_0xf962e9[_0x7793('0x3f')]:_0x48a7e5['model'];if(!_0x2d62ae['query'][_0x7793('0x41')](_0x7793('0x42'))){_0xf962e9[_0x7793('0x24')]=qs['limit'](_0x2d62ae[_0x7793('0x3a')][_0x7793('0x24')]);_0xf962e9[_0x7793('0x23')]=qs[_0x7793('0x23')](_0x2d62ae['query'][_0x7793('0x23')]);}_0xf962e9['order']=qs[_0x7793('0x44')](_0x2d62ae[_0x7793('0x3a')][_0x7793('0x44')]);_0xf962e9[_0x7793('0x45')]=qs[_0x7793('0x3c')](_['pick'](_0x2d62ae['query'],_0x48a7e5[_0x7793('0x3c')]));_0xf962e9['where'][_0x7793('0xa9')]=_0x516669['id'];if(_0x2d62ae[_0x7793('0x3a')][_0x7793('0x82')]){_0xf962e9[_0x7793('0x45')]=_[_0x7793('0x9a')](_0xf962e9['where'],{'$or':_[_0x7793('0x2f')](_0xf962e9[_0x7793('0x3f')],function(_0x1e05b6){var _0x40656c={};_0x40656c[_0x1e05b6]={'$like':'%'+_0x2d62ae[_0x7793('0x3a')][_0x7793('0x82')]+'%'};return _0x40656c;})});}if(_0x2d62ae[_0x7793('0x3a')][_0x7793('0x78')]){var _0xf9ec6f=_0x2d62ae[_0x7793('0x3a')][_0x7793('0x78')]['split'](',');var _0x5beeec={};_0x5beeec[_0xf9ec6f[0x0]]={'$gte':moment(_0xf9ec6f[0x1])[_0x7793('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0xf962e9[_0x7793('0x45')]=_[_0x7793('0x9a')](_0xf962e9[_0x7793('0x45')],_0x5beeec);}_0xf962e9=_[_0x7793('0x9a')]({},_0xf962e9,_0x2d62ae[_0x7793('0xbc')]);return db[_0x7793('0xb5')][_0x7793('0x98')]({'where':_0xf962e9[_0x7793('0x45')]})[_0x7793('0x28')](function(_0x427838){_0x7276db['count']=_0x427838;if(_0x2d62ae['query']['includeAll']){_0xf962e9[_0x7793('0xbd')]=[{'all':!![]}];}return db[_0x7793('0xb5')]['findAll'](_0xf962e9);})[_0x7793('0x28')](function(_0x150f21){_0x7276db[_0x7793('0xac')]=_0x150f21;return _0x7276db;});}})[_0x7793('0x28')](respondWithFilteredResult(_0x813da9,_0xf962e9))[_0x7793('0x34')](handleError(_0x813da9,null));};exports['addTags']=function(_0x511600,_0x3970d8,_0x24ff6d){return db[_0x7793('0x35')][_0x7793('0xb0')]({'where':{'id':_0x511600['params']['id']}})[_0x7793('0x28')](handleEntityNotFound(_0x3970d8,null))[_0x7793('0x28')](function(_0x1888de){if(_0x1888de){return _0x1888de[_0x7793('0xbe')](_0x511600[_0x7793('0x70')][_0x7793('0xb6')],_[_0x7793('0xb7')](_0x511600[_0x7793('0x70')],['ids','id'])||{})[_0x7793('0xbf')](function(){return db[_0x7793('0x6a')]['findAll']({'attributes':['id',_0x7793('0x2c'),_0x7793('0x48')],'where':{'id':_0x511600['body'][_0x7793('0xb6')]}});})['then'](function(_0x324526){socket['emit'](_0x7793('0xc0'),{'id':Number(_0x511600[_0x7793('0xae')]['id']),'tags':_0x324526||[]});return{'id':Number(_0x511600['params']['id']),'tags':_0x324526||[]};});}})[_0x7793('0x28')](respondWithResult(_0x3970d8,null))[_0x7793('0x34')](handleError(_0x3970d8,null));};exports[_0x7793('0xc1')]=function(_0x267e07,_0x15a6cc,_0x340baf){return db[_0x7793('0x35')]['find']({'where':{'id':_0x267e07['params']['id']}})[_0x7793('0x28')](handleEntityNotFound(_0x15a6cc,null))[_0x7793('0x28')](function(_0xc03f30){if(_0xc03f30){return _0xc03f30[_0x7793('0xc1')](_0x267e07['query'][_0x7793('0xb6')]);}})[_0x7793('0x28')](respondWithStatusCode(_0x15a6cc,null))[_0x7793('0x34')](handleError(_0x15a6cc,null));};exports['download']=function(_0x235ac6,_0x1573df){var _0x223611=moment()[_0x7793('0xc2')]()[_0x7793('0x97')]();var _0x19c180=path[_0x7793('0xc3')](config[_0x7793('0xc4')],'server',_0x7793('0xc5'),'tmp');var _0x4c2eac=path[_0x7793('0xc3')](config[_0x7793('0xc4')],_0x7793('0xc6'),_0x7793('0xc5'),'attachments');var _0x1140ae=path[_0x7793('0xc3')](_0x19c180,_0x223611);var _0x31ac6d=util[_0x7793('0xbb')](_0x7793('0xc7'),_0x235ac6[_0x7793('0xae')]['id'],_0x223611);var _0x2c91b1=path[_0x7793('0xc3')](_0x19c180,_0x31ac6d);var _0x505dc5=[];_0x505dc5['push']({'model':db[_0x7793('0xc8')],'as':'Attachment','raw':!![]});var _0x5340de=[{'model':db[_0x7793('0xb5')],'as':_0x7793('0xc9'),'attributes':['id',_0x7793('0x70'),'createdAt'],'include':_0x505dc5}];return db['FaxInteraction'][_0x7793('0xb0')]({'where':{'id':_0x235ac6[_0x7793('0xae')]['id']},'include':_0x5340de})[_0x7793('0x28')](handleEntityNotFound(_0x1573df,null))['then'](function(_0x100abb){if(_0x100abb&&_0x100abb[_0x7793('0xc9')]){var _0x1504c5=_0x100abb['get']({'plain':!![]});fs[_0x7793('0xca')](_0x1140ae);for(var _0x288d3c=0x0;_0x288d3c<_0x1504c5['Messages']['length'];_0x288d3c++){var _0x4b8c3f=_0x1504c5[_0x7793('0xc9')][_0x288d3c][_0x7793('0xc8')];if(_0x4b8c3f){var _0x1e0f9d=path[_0x7793('0xc3')](_0x4c2eac,_0x4b8c3f[_0x7793('0xcb')]);if(fs[_0x7793('0xcc')](_0x1e0f9d)){fs[_0x7793('0xcd')](_0x1e0f9d)['pipe'](fs['createWriteStream'](path['join'](_0x1140ae,_0x4b8c3f[_0x7793('0xcb')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x157959,_0x1d4885){zipdir(_0x1140ae,{'saveTo':_0x2c91b1},function(_0x31a2b6,_0x23e561){if(_0x31a2b6)return _0x1d4885(_0x31a2b6);return _0x157959(_0x23e561);});})[_0x7793('0x28')](function(){return new BPromise(function(_0x54ed61,_0x100774){rimraf(_0x1140ae,function(_0x300e03){if(_0x300e03)_0x100774(_0x300e03);return _0x54ed61();});});})['then'](function(){return _0x1573df[_0x7793('0xce')](_0x2c91b1,_0x31ac6d,function(_0x337d2c){if(_0x337d2c){console[_0x7793('0xcf')](_0x7793('0xd0'),_0x337d2c);}else{fs['unlinkSync'](_0x2c91b1);}});});});}else{return _0x1573df[_0x7793('0x1f')](0xc8);}})[_0x7793('0x34')](handleError(_0x1573df,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 4c10303..7a459c9 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 _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x1c8439,_0x4b5e7e){var _0x321fad=function(_0x42a338){while(--_0x42a338){_0x1c8439['push'](_0x1c8439['shift']());}};_0x321fad(++_0x4b5e7e);}(_0x1261,0x144));var _0x1126=function(_0x3d5351,_0x27bc80){_0x3d5351=_0x3d5351-0x0;var _0x1db4db=_0x1261[_0x3d5351];return _0x1db4db;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0xee84e,_0x4d9819){var _0x535c2e=function(_0x31e63e){while(--_0x31e63e){_0xee84e['push'](_0xee84e['shift']());}};_0x535c2e(++_0x4d9819);}(_0x1261,0x144));var _0x1126=function(_0x484cb9,_0x103489){_0x484cb9=_0x484cb9-0x0;var _0x59517e=_0x1261[_0x484cb9];return _0x59517e;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 612d204..51670a1 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 _0x5afe=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','closedAt','format','util','../../config/logger','moment'];(function(_0x4b342e,_0x425550){var _0x42e1cd=function(_0x3df952){while(--_0x3df952){_0x4b342e['push'](_0x4b342e['shift']());}};_0x42e1cd(++_0x425550);}(_0x5afe,0x129));var _0xe5af=function(_0xca268,_0x1cc126){_0xca268=_0xca268-0x0;var _0x1e5699=_0x5afe[_0xca268];return _0x1e5699;};'use strict';var _=require('lodash');var util=require(_0xe5af('0x0'));var logger=require(_0xe5af('0x1'))('api');var moment=require(_0xe5af('0x2'));var BPromise=require(_0xe5af('0x3'));var rp=require(_0xe5af('0x4'));var fs=require('fs');var path=require(_0xe5af('0x5'));var rimraf=require(_0xe5af('0x6'));var config=require(_0xe5af('0x7'));var attributes=require('./faxInteraction.attributes');module[_0xe5af('0x8')]=function(_0x1e7f85,_0x44e017){return _0x1e7f85[_0xe5af('0x9')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51b425,_0x537ef0,_0x5ae627){if(_0x51b425['changed']('closed')){_0x51b425[_0xe5af('0xa')]=moment()[_0xe5af('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5ae627(null,_0x51b425);}}});}; \ No newline at end of file +var _0x9cc7=['changed','closed','closedAt','api','moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x5d983c,_0x57b322){var _0x45d2f8=function(_0x4fb48d){while(--_0x4fb48d){_0x5d983c['push'](_0x5d983c['shift']());}};_0x45d2f8(++_0x57b322);}(_0x9cc7,0x9f));var _0x79cc=function(_0x19aee6,_0xcb2918){_0x19aee6=_0x19aee6-0x0;var _0x511975=_0x9cc7[_0x19aee6];return _0x511975;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x79cc('0x0'));var moment=require(_0x79cc('0x1'));var BPromise=require('bluebird');var rp=require(_0x79cc('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79cc('0x3'));var config=require(_0x79cc('0x4'));var attributes=require(_0x79cc('0x5'));module[_0x79cc('0x6')]=function(_0x3d7ab7,_0x33dbd5){return _0x3d7ab7[_0x79cc('0x7')](_0x79cc('0x8'),attributes,{'tableName':_0x79cc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14c8d7,_0x40688c,_0x61cfe0){if(_0x14c8d7[_0x79cc('0xa')](_0x79cc('0xb'))){_0x14c8d7[_0x79cc('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x61cfe0(null,_0x14c8d7);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 4696639..fee9f77 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 _0x027f=['http','redis','localhost','socket.io-emitter','./faxInteraction.socket','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','body','options','raw','where','attributes','limit','then','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x255128,_0x1b7aa3){var _0x473b75=function(_0x4c1e95){while(--_0x4c1e95){_0x255128['push'](_0x255128['shift']());}};_0x473b75(++_0x1b7aa3);}(_0x027f,0x1cc));var _0xf027=function(_0x45d8e6,_0x25ec93){_0x45d8e6=_0x45d8e6-0x0;var _0x542273=_0x027f[_0x45d8e6];return _0x542273;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf027('0x0'));var BPromise=require(_0xf027('0x1'));var rs=require(_0xf027('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf027('0x3'))['db'];var utils=require(_0xf027('0x4'));var logger=require('../../config/logger')(_0xf027('0x5'));var config=require(_0xf027('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf027('0x7')][_0xf027('0x8')]({'port':0x232a});config[_0xf027('0x9')]=_['defaults'](config[_0xf027('0x9')],{'host':_0xf027('0xa'),'port':0x18eb});var socket=require(_0xf027('0xb'))(new Redis(config['redis']));require(_0xf027('0xc'))['register'](socket);function respondWithRpcPromise(_0x25d537,_0x3ba2db,_0x106c7e){return new BPromise(function(_0x33d82b,_0x29889f){return client['request'](_0x25d537,_0x106c7e)['then'](function(_0x344bd1){logger[_0xf027('0xd')]('FaxInteraction,\x20%s,\x20%s',_0x3ba2db,_0xf027('0xe'));logger[_0xf027('0xf')](_0xf027('0x10'),_0x3ba2db,_0xf027('0xe'),JSON[_0xf027('0x11')](_0x344bd1));if(_0x344bd1[_0xf027('0x12')]){if(_0x344bd1[_0xf027('0x12')][_0xf027('0x13')]===0x1f4){logger[_0xf027('0x12')](_0xf027('0x14'),_0x3ba2db,_0x344bd1[_0xf027('0x12')][_0xf027('0x15')]);return _0x29889f(_0x344bd1[_0xf027('0x12')][_0xf027('0x15')]);}logger[_0xf027('0x12')](_0xf027('0x14'),_0x3ba2db,_0x344bd1[_0xf027('0x12')][_0xf027('0x15')]);return _0x33d82b(_0x344bd1[_0xf027('0x12')]['message']);}else{logger[_0xf027('0xd')](_0xf027('0x14'),_0x3ba2db,'request\x20sent');_0x33d82b(_0x344bd1[_0xf027('0x16')][_0xf027('0x15')]);}})[_0xf027('0x17')](function(_0x2dfcca){logger[_0xf027('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x3ba2db,_0x2dfcca);_0x29889f(_0x2dfcca);});});}exports[_0xf027('0x18')]=function(_0x410889){var _0x774558=this;return new Promise(function(_0x5c119b,_0x11d37c){return db['FaxInteraction']['update'](_0x410889[_0xf027('0x19')],{'raw':_0x410889[_0xf027('0x1a')]?_0x410889[_0xf027('0x1a')][_0xf027('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x410889['options']?_0x410889['options'][_0xf027('0x1c')]||null:null,'attributes':_0x410889['options']?_0x410889[_0xf027('0x1a')][_0xf027('0x1d')]||null:null,'limit':_0x410889[_0xf027('0x1a')]?_0x410889['options'][_0xf027('0x1e')]||null:null})[_0xf027('0x1f')](function(_0x3c5bd4){logger['info'](_0xf027('0x18'),_0x410889);logger[_0xf027('0xf')](_0xf027('0x18'),_0x410889,JSON[_0xf027('0x11')](_0x3c5bd4));_0x5c119b(_0x3c5bd4);})['catch'](function(_0x5e7f9d){logger[_0xf027('0x12')]('UpdateFaxInteraction',_0x5e7f9d[_0xf027('0x15')],_0x410889);_0x11d37c(_0x774558['error'](0x1f4,_0x5e7f9d[_0xf027('0x15')]));});});};exports[_0xf027('0x20')]=function(_0x1f2362){return new Promise(function(_0x3e3459,_0x2c1044){return db[_0xf027('0x21')]['find']({'where':_0x1f2362[_0xf027('0x1a')]?_0x1f2362[_0xf027('0x1a')][_0xf027('0x1c')]||null:null})[_0xf027('0x1f')](function(_0x44b25d){if(_0x44b25d){return _0x44b25d[_0xf027('0x22')](_0x1f2362['body'][_0xf027('0x23')],_[_0xf027('0x24')](_0x1f2362[_0xf027('0x19')],[_0xf027('0x23'),'id'])||{});}})[_0xf027('0x25')](function(_0x5bf94d){logger['info'](_0xf027('0x26'),_0x1f2362);logger['debug'](_0xf027('0x26'),_0x1f2362,JSON[_0xf027('0x11')](_0x5bf94d));_0x3e3459(_0x5bf94d);})['catch'](function(_0x182aaa){logger['error'](_0xf027('0x26'),_0x182aaa[_0xf027('0x15')],_0x1f2362);_0x2c1044(_this[_0xf027('0x12')](0x1f4,_0x182aaa[_0xf027('0x15')]));});});}; \ No newline at end of file +var _0xe3fc=['stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit','debug','AddTagsToFaxInteraction','find','addTags','ids','omit','body','spread','AddTags','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4367a6,_0x4a2a29){var _0x2fc24b=function(_0x1d6398){while(--_0x1d6398){_0x4367a6['push'](_0x4367a6['shift']());}};_0x2fc24b(++_0x4a2a29);}(_0xe3fc,0xe3));var _0xce3f=function(_0x48168a,_0xf9dfe5){_0x48168a=_0x48168a-0x0;var _0x346d98=_0xe3fc[_0x48168a];return _0x346d98;};'use strict';var _=require(_0xce3f('0x0'));var util=require('util');var moment=require(_0xce3f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce3f('0x2'));var db=require(_0xce3f('0x3'))['db'];var utils=require(_0xce3f('0x4'));var logger=require(_0xce3f('0x5'))('rpc');var config=require(_0xce3f('0x6'));var jayson=require(_0xce3f('0x7'));var client=jayson[_0xce3f('0x8')][_0xce3f('0x9')]({'port':0x232a});config[_0xce3f('0xa')]=_[_0xce3f('0xb')](config[_0xce3f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xce3f('0xc'))(new Redis(config[_0xce3f('0xa')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x572d1b,_0x38bca4,_0x48781f){return new BPromise(function(_0x354382,_0x42a4c9){return client[_0xce3f('0xd')](_0x572d1b,_0x48781f)[_0xce3f('0xe')](function(_0x31a75a){logger[_0xce3f('0xf')](_0xce3f('0x10'),_0x38bca4,'request\x20sent');logger['debug'](_0xce3f('0x11'),_0x38bca4,_0xce3f('0x12'),JSON[_0xce3f('0x13')](_0x31a75a));if(_0x31a75a['error']){if(_0x31a75a[_0xce3f('0x14')][_0xce3f('0x15')]===0x1f4){logger[_0xce3f('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x38bca4,_0x31a75a[_0xce3f('0x14')]['message']);return _0x42a4c9(_0x31a75a[_0xce3f('0x14')][_0xce3f('0x16')]);}logger['error'](_0xce3f('0x10'),_0x38bca4,_0x31a75a['error']['message']);return _0x354382(_0x31a75a[_0xce3f('0x14')][_0xce3f('0x16')]);}else{logger[_0xce3f('0xf')](_0xce3f('0x10'),_0x38bca4,_0xce3f('0x12'));_0x354382(_0x31a75a['result'][_0xce3f('0x16')]);}})[_0xce3f('0x17')](function(_0x520562){logger[_0xce3f('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x38bca4,_0x520562);_0x42a4c9(_0x520562);});});}exports[_0xce3f('0x18')]=function(_0x51ae2d){var _0x493f58=this;return new Promise(function(_0x8ba2a6,_0x2fff1e){return db[_0xce3f('0x19')][_0xce3f('0x1a')](_0x51ae2d['body'],{'raw':_0x51ae2d['options']?_0x51ae2d[_0xce3f('0x1b')][_0xce3f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51ae2d[_0xce3f('0x1b')]?_0x51ae2d[_0xce3f('0x1b')][_0xce3f('0x1d')]||null:null,'attributes':_0x51ae2d['options']?_0x51ae2d[_0xce3f('0x1b')][_0xce3f('0x1e')]||null:null,'limit':_0x51ae2d[_0xce3f('0x1b')]?_0x51ae2d[_0xce3f('0x1b')][_0xce3f('0x1f')]||null:null})[_0xce3f('0xe')](function(_0x1bda79){logger[_0xce3f('0xf')](_0xce3f('0x18'),_0x51ae2d);logger[_0xce3f('0x20')](_0xce3f('0x18'),_0x51ae2d,JSON[_0xce3f('0x13')](_0x1bda79));_0x8ba2a6(_0x1bda79);})[_0xce3f('0x17')](function(_0x341ddf){logger[_0xce3f('0x14')](_0xce3f('0x18'),_0x341ddf[_0xce3f('0x16')],_0x51ae2d);_0x2fff1e(_0x493f58['error'](0x1f4,_0x341ddf['message']));});});};exports[_0xce3f('0x21')]=function(_0x56a87c){return new Promise(function(_0x46c4ae,_0x3db5d0){return db[_0xce3f('0x19')][_0xce3f('0x22')]({'where':_0x56a87c[_0xce3f('0x1b')]?_0x56a87c[_0xce3f('0x1b')]['where']||null:null})['then'](function(_0x445796){if(_0x445796){return _0x445796[_0xce3f('0x23')](_0x56a87c['body'][_0xce3f('0x24')],_[_0xce3f('0x25')](_0x56a87c[_0xce3f('0x26')],[_0xce3f('0x24'),'id'])||{});}})[_0xce3f('0x27')](function(_0x139f36){logger[_0xce3f('0xf')](_0xce3f('0x28'),_0x56a87c);logger[_0xce3f('0x20')]('AddTags',_0x56a87c,JSON[_0xce3f('0x13')](_0x139f36));_0x46c4ae(_0x139f36);})[_0xce3f('0x17')](function(_0x3f66df){logger[_0xce3f('0x14')](_0xce3f('0x28'),_0x3f66df['message'],_0x56a87c);_0x3db5d0(_this[_0xce3f('0x14')](0x1f4,_0x3f66df[_0xce3f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 442971f..9de8d83 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 _0x102c=['register','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0xe23e31,_0x220b83){var _0x57703e=function(_0x942e73){while(--_0x942e73){_0xe23e31['push'](_0xe23e31['shift']());}};_0x57703e(++_0x220b83);}(_0x102c,0xf9));var _0xc102=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x102c[_0x167cc1];return _0x10bc4b;};'use strict';var FaxInteractionEvents=require(_0xc102('0x0'));var events=[_0xc102('0x1'),_0xc102('0x2'),'update'];function createListener(_0x2f7fa1,_0x5c7276){return function(_0x14257d){_0x5c7276['emit'](_0x2f7fa1,_0x14257d);};}function removeListener(_0x28fb49,_0x2a1d08){return function(){FaxInteractionEvents['removeListener'](_0x28fb49,_0x2a1d08);};}exports[_0xc102('0x3')]=function(_0x28ba41){for(var _0x106f49=0x0,_0x11edc0=events[_0xc102('0x4')];_0x106f49<_0x11edc0;_0x106f49++){var _0x305eff=events[_0x106f49];var _0x176f3f=createListener(_0xc102('0x5')+_0x305eff,_0x28ba41);FaxInteractionEvents['on'](_0x305eff,_0x176f3f);}}; \ No newline at end of file +var _0x81aa=['register','faxInteraction:','save','remove','update','removeListener'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x81aa,0x86));var _0xa81a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x81aa[_0x167cc1];return _0x10bc4b;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xa81a('0x0'),_0xa81a('0x1'),_0xa81a('0x2')];function createListener(_0x59c799,_0x4fb33d){return function(_0x4e2a0a){_0x4fb33d['emit'](_0x59c799,_0x4e2a0a);};}function removeListener(_0x3f0166,_0x4f02c6){return function(){FaxInteractionEvents[_0xa81a('0x3')](_0x3f0166,_0x4f02c6);};}exports[_0xa81a('0x4')]=function(_0x3b6b69){for(var _0x33cabb=0x0,_0x2504c8=events['length'];_0x33cabb<_0x2504c8;_0x33cabb++){var _0x339a45=events[_0x33cabb];var _0x50bdf7=createListener(_0xa81a('0x5')+_0x339a45,_0x3b6b69);FaxInteractionEvents['on'](_0x339a45,_0x50bdf7);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index c95231d..b684b8f 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 _0xbdb7=['post','addMessage','tracked','put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','/:id/messages','isAuthenticated','getMessages','/:id/download','download'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x44d6b8,_0xe7e065){_0x44d6b8=_0x44d6b8-0x0;var _0x18cbfa=_0xbdb7[_0x44d6b8];return _0x18cbfa;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var auth=require(_0x7bdb('0x6'));var interaction=require(_0x7bdb('0x7'));var config=require(_0x7bdb('0x8'));var controller=require('./faxInteraction.controller');router[_0x7bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bdb('0x9')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7bdb('0x9')](_0x7bdb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7bdb('0x9')](_0x7bdb('0xc'),auth[_0x7bdb('0xd')](),controller[_0x7bdb('0xe')]);router[_0x7bdb('0x9')](_0x7bdb('0xf'),auth[_0x7bdb('0xd')](),controller[_0x7bdb('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7bdb('0x11')](_0x7bdb('0xc'),auth['isAuthenticated'](),controller[_0x7bdb('0x12')]);router['post']('/:id/tags',auth[_0x7bdb('0xd')](),interaction[_0x7bdb('0x13')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x7bdb('0x14')](_0x7bdb('0xb'),auth[_0x7bdb('0xd')](),interaction[_0x7bdb('0x13')](_0x7bdb('0x15'),_0x7bdb('0x16')),controller[_0x7bdb('0x17')]);router[_0x7bdb('0x18')]('/:id',auth[_0x7bdb('0xd')](),interaction[_0x7bdb('0x13')](_0x7bdb('0x15'),_0x7bdb('0x19')),controller['destroy']);router[_0x7bdb('0x18')](_0x7bdb('0x1a'),auth['isAuthenticated'](),controller[_0x7bdb('0x1b')]);module[_0x7bdb('0x1c')]=router; \ No newline at end of file +var _0xa9e0=['exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','/:id','/:id/messages','getMessages','/:id/download','create','post','addMessage','tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags'];(function(_0xd1e854,_0x501b22){var _0x4da213=function(_0x92f56b){while(--_0x92f56b){_0xd1e854['push'](_0xd1e854['shift']());}};_0x4da213(++_0x501b22);}(_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['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['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')]('/:id/tags',auth[_0x0a9e('0x8')](),interaction[_0x0a9e('0x11')](_0x0a9e('0x12'),_0x0a9e('0x13')),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),interaction['tracked'](_0x0a9e('0x12'),'faxinteraction:update'),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x17')]('/:id',auth[_0x0a9e('0x8')](),interaction['tracked'](_0x0a9e('0x12'),_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x17')](_0x0a9e('0x1a'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1b')]);module[_0x0a9e('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 4f7d705..014c53c 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 _0x86f4=['medium','BOOLEAN','out','DATE','exports','TEXT'];(function(_0x1a007a,_0x5f3509){var _0x1b3ea8=function(_0x26e958){while(--_0x26e958){_0x1a007a['push'](_0x1a007a['shift']());}};_0x1b3ea8(++_0x5f3509);}(_0x86f4,0x118));var _0x486f=function(_0x4d3fcf,_0x3a5f62){_0x4d3fcf=_0x4d3fcf-0x0;var _0x2a321d=_0x86f4[_0x4d3fcf];return _0x2a321d;};'use strict';var Sequelize=require('sequelize');module[_0x486f('0x0')]={'body':{'type':Sequelize[_0x486f('0x1')](_0x486f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x486f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x486f('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x486f('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x486f('0x5')]}}; \ No newline at end of file +var _0x9ca2=['DATE','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0x26544f,_0x79f614){var _0x2fff64=function(_0x4d1a11){while(--_0x4d1a11){_0x26544f['push'](_0x26544f['shift']());}};_0x2fff64(++_0x79f614);}(_0x9ca2,0x91));var _0x29ca=function(_0x5b8223,_0x2ea481){_0x5b8223=_0x5b8223-0x0;var _0x5bec2a=_0x9ca2[_0x5b8223];return _0x5bec2a;};'use strict';var Sequelize=require(_0x29ca('0x0'));module['exports']={'body':{'type':Sequelize[_0x29ca('0x1')](_0x29ca('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x29ca('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x29ca('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x29ca('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x29ca('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 0fc1ea3..fc2d612 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 _0x58a4=['options','include','findAll','rows','show','params','includeAll','find','body','describe','../../config/logger','fax-interactions','fax','read','format','UserId','user','agent','Contact','get','FaxInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','CmContact','findOne','ContactId','Attachment','SendFax','isNil','/var/opt/motion2/server/files/attachments/%s','AttachmentId','download','join','files','attachments','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','count','limit','set','apply','reject','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x58a4,0xbf));var _0x458a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x58a4[_0x3511d3];return _0x5d6321;};'use strict';var pdf=require(_0x458a('0x0'));var emlformat=require(_0x458a('0x1'));var rimraf=require(_0x458a('0x2'));var zipdir=require(_0x458a('0x3'));var jsonpatch=require(_0x458a('0x4'));var rp=require(_0x458a('0x5'));var moment=require(_0x458a('0x6'));var BPromise=require(_0x458a('0x7'));var Mustache=require(_0x458a('0x8'));var util=require(_0x458a('0x9'));var path=require(_0x458a('0xa'));var sox=require(_0x458a('0xb'));var csv=require(_0x458a('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];config[_0x458a('0x1a')]=_[_0x458a('0x1b')](config[_0x458a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x458a('0x1a')]));require('./faxMessage.socket')[_0x458a('0x1c')](socket);var jayson=require(_0x458a('0x1d'));var client=jayson[_0x458a('0x1e')][_0x458a('0x1f')]({'port':0x232c});var client9002=jayson[_0x458a('0x1e')][_0x458a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x507b0f,_0x4b26be,_0x5c7993,_0x2faf6a){return new BPromise(function(_0x3fd6d4,_0x3558b9){var _0x5c5b41=_0x2faf6a||client;return _0x5c5b41[_0x458a('0x20')](_0x507b0f,_0x5c7993)[_0x458a('0x21')](function(_0x18504d){logger[_0x458a('0x22')](_0x458a('0x23'),_0x4b26be,'request\x20sent');logger['debug'](_0x458a('0x24'),_0x4b26be,'request\x20sent',JSON[_0x458a('0x25')](_0x18504d));if(_0x18504d[_0x458a('0x26')]){if(_0x18504d['error'][_0x458a('0x27')]===0x1f4){logger['error'](_0x458a('0x23'),_0x4b26be,_0x18504d[_0x458a('0x26')]['message']);return _0x3558b9(_0x18504d[_0x458a('0x26')][_0x458a('0x28')]);}logger['error'](_0x458a('0x23'),_0x4b26be,_0x18504d['error'][_0x458a('0x28')]);return _0x3fd6d4(_0x18504d['error'][_0x458a('0x28')]);}else{logger['info'](_0x458a('0x23'),_0x4b26be,_0x458a('0x29'));_0x3fd6d4(_0x18504d[_0x458a('0x2a')][_0x458a('0x28')]);}})[_0x458a('0x2b')](function(_0x19bd5){logger[_0x458a('0x26')](_0x458a('0x23'),_0x4b26be,_0x19bd5);_0x3558b9(_0x19bd5);});});}function respondWithStatusCode(_0x1f2d0,_0xfc6b24){_0xfc6b24=_0xfc6b24||0xcc;return function(_0x52efed){if(_0x52efed){return _0x1f2d0[_0x458a('0x2c')](_0xfc6b24);}return _0x1f2d0[_0x458a('0x2d')](_0xfc6b24)['end']();};}function respondWithResult(_0xb94bd9,_0x112fa6){_0x112fa6=_0x112fa6||0xc8;return function(_0x5f3ac0){if(_0x5f3ac0){return _0xb94bd9['status'](_0x112fa6)[_0x458a('0x2e')](_0x5f3ac0);}};}function respondWithFilteredResult(_0x596fe2,_0x33c5d8){return function(_0x29f9b5){if(_0x29f9b5){var _0x223f73=_0x29f9b5[_0x458a('0x2f')],_0x4a49e4=_0x33c5d8['offset'],_0xa6fdf=_0x33c5d8['offset']+_0x33c5d8[_0x458a('0x30')],_0x2531f7;if(_0xa6fdf>=_0x223f73){_0xa6fdf=_0x223f73;_0x2531f7=0xc8;}else{_0x2531f7=0xce;}_0x596fe2['status'](_0x2531f7);return _0x596fe2[_0x458a('0x31')]('Content-Range',_0x4a49e4+'-'+_0xa6fdf+'/'+_0x223f73)[_0x458a('0x2e')](_0x29f9b5);}return null;};}function patchUpdates(_0xb39224){return function(_0x492843){try{jsonpatch[_0x458a('0x32')](_0x492843,_0xb39224,!![]);}catch(_0x269f53){return BPromise[_0x458a('0x33')](_0x269f53);}return _0x492843['save']();};}function saveUpdates(_0x3371c3,_0x3412b8){return function(_0xaf233b){if(_0xaf233b){return _0xaf233b[_0x458a('0x34')](_0x3371c3)[_0x458a('0x21')](function(_0x4fd30f){return _0x4fd30f;});}return null;};}function removeEntity(_0x244ae0,_0x40c80c){return function(_0x41f449){if(_0x41f449){return _0x41f449[_0x458a('0x35')]()[_0x458a('0x21')](function(){_0x244ae0[_0x458a('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a6b9c,_0xa35017){return function(_0x19287f){if(!_0x19287f){_0x2a6b9c[_0x458a('0x2c')](0x194);}return _0x19287f;};}function handleError(_0x2e8867,_0x19d73a){_0x19d73a=_0x19d73a||0x1f4;return function(_0x262ad0){logger[_0x458a('0x26')](_0x262ad0[_0x458a('0x36')]);if(_0x262ad0['name']){delete _0x262ad0[_0x458a('0x37')];}_0x2e8867[_0x458a('0x2d')](_0x19d73a)[_0x458a('0x38')](_0x262ad0);};}exports[_0x458a('0x39')]=function(_0x42e092,_0x2ba6ca){var _0x271698={},_0x240cf8={},_0x44cf62={'count':0x0,'rows':[]};var _0x1ecf2f=_[_0x458a('0x3a')](db[_0x458a('0x3b')][_0x458a('0x3c')],function(_0x73e060){return{'name':_0x73e060[_0x458a('0x3d')],'type':_0x73e060['type'][_0x458a('0x3e')]};});_0x240cf8[_0x458a('0x3f')]=_[_0x458a('0x3a')](_0x1ecf2f,_0x458a('0x37'));_0x240cf8[_0x458a('0x40')]=_[_0x458a('0x41')](_0x42e092[_0x458a('0x40')]);_0x240cf8[_0x458a('0x42')]=_[_0x458a('0x43')](_0x240cf8[_0x458a('0x3f')],_0x240cf8[_0x458a('0x40')]);_0x271698['attributes']=_[_0x458a('0x43')](_0x240cf8[_0x458a('0x3f')],qs['fields'](_0x42e092[_0x458a('0x40')][_0x458a('0x44')]));_0x271698[_0x458a('0x45')]=_0x271698['attributes'][_0x458a('0x46')]?_0x271698[_0x458a('0x45')]:_0x240cf8[_0x458a('0x3f')];if(!_0x42e092[_0x458a('0x40')][_0x458a('0x47')](_0x458a('0x48'))){_0x271698[_0x458a('0x30')]=qs[_0x458a('0x30')](_0x42e092['query'][_0x458a('0x30')]);_0x271698[_0x458a('0x49')]=qs[_0x458a('0x49')](_0x42e092['query'][_0x458a('0x49')]);}_0x271698[_0x458a('0x4a')]=qs['sort'](_0x42e092[_0x458a('0x40')][_0x458a('0x4b')]);_0x271698[_0x458a('0x4c')]=qs[_0x458a('0x42')](_[_0x458a('0x4d')](_0x42e092['query'],_0x240cf8['filters']),_0x1ecf2f);if(_0x42e092[_0x458a('0x40')][_0x458a('0x4e')]){_0x271698[_0x458a('0x4c')]=_[_0x458a('0x4f')](_0x271698['where'],{'$or':_[_0x458a('0x3a')](_0x1ecf2f,function(_0xe1d6d7){if(_0xe1d6d7['type']!==_0x458a('0x50')){var _0x56ec56={};_0x56ec56[_0xe1d6d7[_0x458a('0x37')]]={'$like':'%'+_0x42e092[_0x458a('0x40')][_0x458a('0x4e')]+'%'};return _0x56ec56;}})});}_0x271698=_['merge']({},_0x271698,_0x42e092[_0x458a('0x51')]);var _0x336512={'where':_0x271698[_0x458a('0x4c')]};return db['FaxMessage']['count'](_0x336512)[_0x458a('0x21')](function(_0x28ae82){_0x44cf62[_0x458a('0x2f')]=_0x28ae82;if(_0x42e092['query']['includeAll']){_0x271698[_0x458a('0x52')]=[{'all':!![]}];}return db[_0x458a('0x3b')][_0x458a('0x53')](_0x271698);})[_0x458a('0x21')](function(_0x41ca6a){_0x44cf62[_0x458a('0x54')]=_0x41ca6a;return _0x44cf62;})[_0x458a('0x21')](respondWithFilteredResult(_0x2ba6ca,_0x271698))[_0x458a('0x2b')](handleError(_0x2ba6ca,null));};exports[_0x458a('0x55')]=function(_0x213f86,_0x294de5){var _0x39c41c={'raw':!![],'where':{'id':_0x213f86[_0x458a('0x56')]['id']}},_0x3c6056={};_0x3c6056[_0x458a('0x3f')]=_[_0x458a('0x41')](db['FaxMessage'][_0x458a('0x3c')]);_0x3c6056[_0x458a('0x40')]=_[_0x458a('0x41')](_0x213f86[_0x458a('0x40')]);_0x3c6056[_0x458a('0x42')]=_['intersection'](_0x3c6056['model'],_0x3c6056['query']);_0x39c41c[_0x458a('0x45')]=_['intersection'](_0x3c6056[_0x458a('0x3f')],qs[_0x458a('0x44')](_0x213f86[_0x458a('0x40')][_0x458a('0x44')]));_0x39c41c[_0x458a('0x45')]=_0x39c41c['attributes']['length']?_0x39c41c[_0x458a('0x45')]:_0x3c6056[_0x458a('0x3f')];if(_0x213f86[_0x458a('0x40')][_0x458a('0x57')]){_0x39c41c[_0x458a('0x52')]=[{'all':!![]}];}_0x39c41c=_['merge']({},_0x39c41c,_0x213f86[_0x458a('0x51')]);return db['FaxMessage'][_0x458a('0x58')](_0x39c41c)['then'](handleEntityNotFound(_0x294de5,null))[_0x458a('0x21')](respondWithResult(_0x294de5,null))['catch'](handleError(_0x294de5,null));};exports['update']=function(_0x4b9928,_0x117441){if(_0x4b9928[_0x458a('0x59')]['id']){delete _0x4b9928['body']['id'];}return db[_0x458a('0x3b')][_0x458a('0x58')]({'where':{'id':_0x4b9928[_0x458a('0x56')]['id']}})['then'](handleEntityNotFound(_0x117441,null))[_0x458a('0x21')](saveUpdates(_0x4b9928[_0x458a('0x59')],null))[_0x458a('0x21')](respondWithResult(_0x117441,null))[_0x458a('0x2b')](handleError(_0x117441,null));};exports[_0x458a('0x35')]=function(_0xd034e9,_0x597e74){return db[_0x458a('0x3b')][_0x458a('0x58')]({'where':{'id':_0xd034e9[_0x458a('0x56')]['id']}})[_0x458a('0x21')](handleEntityNotFound(_0x597e74,null))[_0x458a('0x21')](removeEntity(_0x597e74,null))[_0x458a('0x2b')](handleError(_0x597e74,null));};exports[_0x458a('0x5a')]=function(_0x3b6cf9,_0x50fdf4){return db[_0x458a('0x3b')]['describe']()[_0x458a('0x21')](respondWithResult(_0x50fdf4,null))[_0x458a('0x2b')](handleError(_0x50fdf4,null));};var interaction_log=require(_0x458a('0x5b'))(_0x458a('0x5c'));exports['accept']=function(_0x4e0d23,_0xe7dc86,_0x3167f4){var _0x2b9aac={'agent':{},'channel':_0x458a('0x5d')};if(_0x4e0d23[_0x458a('0x59')]['id']){delete _0x4e0d23[_0x458a('0x59')]['id'];}_0x4e0d23['body'][_0x458a('0x5e')]=!![];_0x4e0d23[_0x458a('0x59')]['readAt']=moment()[_0x458a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e0d23[_0x458a('0x59')][_0x458a('0x60')]=_0x4e0d23[_0x458a('0x59')][_0x458a('0x60')]||_0x4e0d23[_0x458a('0x61')]['id'];_0x2b9aac[_0x458a('0x62')]['id']=_0x4e0d23[_0x458a('0x59')][_0x458a('0x60')];return db['FaxMessage'][_0x458a('0x58')]({'where':{'id':_0x4e0d23[_0x458a('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x458a('0x63')}]})[_0x458a('0x21')](handleEntityNotFound(_0xe7dc86,null))['then'](saveUpdates(_0x4e0d23[_0x458a('0x59')],null))[_0x458a('0x21')](function(_0x47cbcf){if(_0x47cbcf){_0x2b9aac[_0x458a('0x28')]=_0x47cbcf[_0x458a('0x64')]({'plain':!![]});return db['FaxInteraction'][_0x458a('0x58')]({'where':{'id':_0x47cbcf[_0x458a('0x65')]}});}return null;})[_0x458a('0x21')](handleEntityNotFound(_0xe7dc86,null))[_0x458a('0x21')](function(_0x541375){if(_0x541375){return _0x541375[_0x458a('0x34')]({'UserId':_0x4e0d23[_0x458a('0x59')][_0x458a('0x60')],'read1stAt':_['isNil'](_0x541375[_0x458a('0x66')])?moment()[_0x458a('0x5f')](_0x458a('0x67')):undefined});}return null;})[_0x458a('0x21')](function(_0x250238){if(_0x250238){_0x2b9aac[_0x458a('0x68')]=_0x250238[_0x458a('0x64')]({'plain':!![]});interaction_log[_0x458a('0x22')](_0x458a('0x69'),_0x4e0d23[_0x458a('0x61')]['id'],_0x4e0d23['user'][_0x458a('0x37')],_0x4e0d23['user'][_0x458a('0x6a')],_0x2b9aac[_0x458a('0x68')]['id'],_0x4e0d23[_0x458a('0x59')]?JSON[_0x458a('0x25')](_0x4e0d23[_0x458a('0x59')]):_0x458a('0x6b'));return respondWithRpcPromise(_0x458a('0x6c'),_0x458a('0x6d'),_0x2b9aac);}return null;})[_0x458a('0x21')](function(_0x413d7c){if(_0x413d7c){if(_0x4e0d23[_0x458a('0x59')][_0x458a('0x6e')]){_0x2b9aac[_0x458a('0x28')][_0x458a('0x6f')]=util[_0x458a('0x5f')](_0x458a('0x70'),_0x4e0d23['user'][_0x458a('0x37')]);_0x2b9aac['message'][_0x458a('0x71')]=_0x2b9aac[_0x458a('0x71')];_0x2b9aac['message'][_0x458a('0x72')]=_0x458a('0x73');return respondWithRpcPromise(_0x458a('0x74'),'EventManager',{'event':_0x458a('0x75'),'message':_0x2b9aac[_0x458a('0x28')]},client9002)[_0x458a('0x21')](function(){return _0x2b9aac;});}return _0x2b9aac;}return null;})[_0x458a('0x21')](respondWithResult(_0xe7dc86,null))[_0x458a('0x2b')](handleError(_0xe7dc86,null));};var interaction_log=require(_0x458a('0x5b'))('fax-interactions');exports[_0x458a('0x33')]=function(_0x54abb1,_0x567b68,_0x247335){var _0x36ba6e={'agent':{},'channel':_0x458a('0x5d')};if(_0x54abb1[_0x458a('0x59')]['id']){delete _0x54abb1[_0x458a('0x59')]['id'];}_0x54abb1[_0x458a('0x59')][_0x458a('0x60')]=_0x54abb1[_0x458a('0x59')][_0x458a('0x60')]||_0x54abb1[_0x458a('0x61')]['id'];_0x36ba6e[_0x458a('0x62')]['id']=_0x54abb1[_0x458a('0x59')][_0x458a('0x60')];return db[_0x458a('0x3b')]['find']({'where':{'id':_0x54abb1['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x567b68,null))[_0x458a('0x21')](function(_0x5c6a8d){if(_0x5c6a8d){_0x36ba6e[_0x458a('0x28')]=_0x5c6a8d[_0x458a('0x64')]({'plain':!![]});return db[_0x458a('0x76')][_0x458a('0x58')]({'where':{'id':_0x5c6a8d[_0x458a('0x65')]}});}return null;})[_0x458a('0x21')](handleEntityNotFound(_0x567b68,null))[_0x458a('0x21')](function(_0x49f3ee){if(_0x49f3ee){_0x36ba6e[_0x458a('0x68')]=_0x49f3ee[_0x458a('0x64')]({'plain':!![]});interaction_log['info'](_0x458a('0x77'),_0x54abb1['user']['id'],_0x54abb1[_0x458a('0x61')]['name'],_0x54abb1[_0x458a('0x61')][_0x458a('0x6a')],_0x36ba6e[_0x458a('0x68')]['id'],_0x54abb1[_0x458a('0x59')]?JSON['stringify'](_0x54abb1[_0x458a('0x59')]):_0x458a('0x6b'));return respondWithRpcPromise(_0x458a('0x78'),_0x458a('0x79'),_0x36ba6e);}return null;})[_0x458a('0x21')](function(_0x2b4943){if(_0x2b4943){_0x2b4943[_0x458a('0x28')][_0x458a('0x6f')]=util['format'](_0x458a('0x70'),_0x54abb1[_0x458a('0x61')][_0x458a('0x37')]);_0x2b4943[_0x458a('0x28')]['channel']=_0x36ba6e[_0x458a('0x71')];_0x2b4943[_0x458a('0x28')]['event']=_0x458a('0x33');respondWithRpcPromise(_0x458a('0x74'),_0x458a('0x74'),{'event':_0x458a('0x7a'),'message':_0x2b4943[_0x458a('0x28')]},client9002);return _0x36ba6e;}return null;})['then'](respondWithResult(_0x567b68,null))[_0x458a('0x2b')](handleError(_0x567b68,null));};exports[_0x458a('0x7b')]=function(_0x2ba226,_0x1dbaa7){var _0x2006d7;return db[_0x458a('0x3b')][_0x458a('0x7b')](_0x2ba226['body'],{})[_0x458a('0x21')](function(_0x4d3790){_0x2006d7=_0x4d3790;return db[_0x458a('0x7c')][_0x458a('0x7d')]({'where':{'id':_0x2006d7[_0x458a('0x7e')]}});})['then'](function(_0x3471bb){if(_['isNil'](_0x3471bb)){return;}else{_0x2006d7['fax']=_0x3471bb[_0x458a('0x5d')];return db[_0x458a('0x7f')]['findOne']({'where':{'id':_0x2006d7['AttachmentId']}});}})[_0x458a('0x21')](function(_0x1d16c7){return respondWithRpcPromise(_0x458a('0x80'),_0x458a('0x80'),{'FaxAccountId':_[_0x458a('0x81')](_0x2ba226['body'])?undefined:_0x2ba226[_0x458a('0x59')]['FaxAccountId'],'path':_[_0x458a('0x81')](_0x1d16c7)?undefined:util[_0x458a('0x5f')](_0x458a('0x82'),_0x1d16c7['basename']),'fax':_[_0x458a('0x81')](_0x2006d7[_0x458a('0x5d')])?undefined:_0x2006d7['fax'],'AttachmentId':_0x2006d7[_0x458a('0x83')]},client9002);})['then'](respondWithResult(_0x1dbaa7,0xc9))[_0x458a('0x2b')](handleError(_0x1dbaa7,null));};exports[_0x458a('0x84')]=function(_0x470a3f,_0xcd3781){var _0x55a431=path[_0x458a('0x85')](config['root'],'server',_0x458a('0x86'),_0x458a('0x87'));return db[_0x458a('0x3b')][_0x458a('0x58')]({'where':{'id':_0x470a3f[_0x458a('0x56')]['id']},'include':[{'model':db[_0x458a('0x7f')],'as':'Attachment'}]})[_0x458a('0x21')](handleEntityNotFound(_0xcd3781,null))[_0x458a('0x21')](function(_0xe744f5){if(_0xe744f5){return _0xcd3781[_0x458a('0x84')](path[_0x458a('0x85')](_0x55a431,_0xe744f5[_0x458a('0x7f')]['basename']));}})[_0x458a('0x2b')](handleError(_0xcd3781,null));}; \ No newline at end of file +var _0x36ee=['error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','count','offset','set','Content-Range','json','reject','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','FaxMessage','find','body','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','CmContact','Contact','get','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','create','ContactId','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','attachments','Attachment','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x170682,_0x1fe7b7){var _0x2d9f0e=function(_0x1912d7){while(--_0x1912d7){_0x170682['push'](_0x170682['shift']());}};_0x2d9f0e(++_0x1fe7b7);}(_0x36ee,0xe8));var _0xe36e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x36ee[_0x3b380d];return _0x54502b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe36e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe36e('0x1'));var rp=require(_0xe36e('0x2'));var moment=require(_0xe36e('0x3'));var BPromise=require(_0xe36e('0x4'));var Mustache=require(_0xe36e('0x5'));var util=require(_0xe36e('0x6'));var path=require(_0xe36e('0x7'));var sox=require(_0xe36e('0x8'));var csv=require(_0xe36e('0x9'));var ejs=require(_0xe36e('0xa'));var fs=require('fs');var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x9'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];config['redis']=_[_0xe36e('0x19')](config[_0xe36e('0x1a')],{'host':_0xe36e('0x1b'),'port':0x18eb});var socket=require(_0xe36e('0x1c'))(new Redis(config['redis']));require(_0xe36e('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xe36e('0x1e')][_0xe36e('0x1f')]({'port':0x232c});var client9002=jayson[_0xe36e('0x1e')][_0xe36e('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xd6828e,_0x924cd5,_0x2096f6,_0x39bae8){return new BPromise(function(_0x387c37,_0x428d34){var _0x5792e8=_0x39bae8||client;return _0x5792e8[_0xe36e('0x20')](_0xd6828e,_0x2096f6)[_0xe36e('0x21')](function(_0x56c019){logger[_0xe36e('0x22')]('FaxMessage,\x20%s,\x20%s',_0x924cd5,_0xe36e('0x23'));logger[_0xe36e('0x24')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x924cd5,_0xe36e('0x23'),JSON[_0xe36e('0x25')](_0x56c019));if(_0x56c019[_0xe36e('0x26')]){if(_0x56c019['error'][_0xe36e('0x27')]===0x1f4){logger[_0xe36e('0x26')](_0xe36e('0x28'),_0x924cd5,_0x56c019[_0xe36e('0x26')][_0xe36e('0x29')]);return _0x428d34(_0x56c019[_0xe36e('0x26')]['message']);}logger[_0xe36e('0x26')](_0xe36e('0x28'),_0x924cd5,_0x56c019[_0xe36e('0x26')][_0xe36e('0x29')]);return _0x387c37(_0x56c019[_0xe36e('0x26')]['message']);}else{logger['info'](_0xe36e('0x28'),_0x924cd5,_0xe36e('0x23'));_0x387c37(_0x56c019[_0xe36e('0x2a')][_0xe36e('0x29')]);}})[_0xe36e('0x2b')](function(_0x1507f9){logger[_0xe36e('0x26')]('FaxMessage,\x20%s,\x20%s',_0x924cd5,_0x1507f9);_0x428d34(_0x1507f9);});});}function respondWithStatusCode(_0x3cafbf,_0x35f9e7){_0x35f9e7=_0x35f9e7||0xcc;return function(_0x10597f){if(_0x10597f){return _0x3cafbf[_0xe36e('0x2c')](_0x35f9e7);}return _0x3cafbf['status'](_0x35f9e7)[_0xe36e('0x2d')]();};}function respondWithResult(_0x5a3133,_0xf7b02e){_0xf7b02e=_0xf7b02e||0xc8;return function(_0x5993de){if(_0x5993de){return _0x5a3133[_0xe36e('0x2e')](_0xf7b02e)['json'](_0x5993de);}};}function respondWithFilteredResult(_0x410504,_0x4c5d98){return function(_0x3b1045){if(_0x3b1045){var _0x59548b=_0x3b1045[_0xe36e('0x2f')],_0x4bb75b=_0x4c5d98[_0xe36e('0x30')],_0x5d8fd8=_0x4c5d98['offset']+_0x4c5d98['limit'],_0x5b5d53;if(_0x5d8fd8>=_0x59548b){_0x5d8fd8=_0x59548b;_0x5b5d53=0xc8;}else{_0x5b5d53=0xce;}_0x410504[_0xe36e('0x2e')](_0x5b5d53);return _0x410504[_0xe36e('0x31')](_0xe36e('0x32'),_0x4bb75b+'-'+_0x5d8fd8+'/'+_0x59548b)[_0xe36e('0x33')](_0x3b1045);}return null;};}function patchUpdates(_0x3d826e){return function(_0x4759b4){try{jsonpatch['apply'](_0x4759b4,_0x3d826e,!![]);}catch(_0xb98e78){return BPromise[_0xe36e('0x34')](_0xb98e78);}return _0x4759b4['save']();};}function saveUpdates(_0x87e595,_0xa06f61){return function(_0xba4869){if(_0xba4869){return _0xba4869[_0xe36e('0x35')](_0x87e595)[_0xe36e('0x21')](function(_0x253cdc){return _0x253cdc;});}return null;};}function removeEntity(_0xfe4ee8,_0x127807){return function(_0x36cee2){if(_0x36cee2){return _0x36cee2[_0xe36e('0x36')]()[_0xe36e('0x21')](function(){_0xfe4ee8['status'](0xcc)[_0xe36e('0x2d')]();});}};}function handleEntityNotFound(_0x59231e,_0x4a717e){return function(_0x81cf9a){if(!_0x81cf9a){_0x59231e['sendStatus'](0x194);}return _0x81cf9a;};}function handleError(_0x3b1299,_0x248f39){_0x248f39=_0x248f39||0x1f4;return function(_0x38bdbc){logger[_0xe36e('0x26')](_0x38bdbc['stack']);if(_0x38bdbc['name']){delete _0x38bdbc[_0xe36e('0x37')];}_0x3b1299[_0xe36e('0x2e')](_0x248f39)[_0xe36e('0x38')](_0x38bdbc);};}exports[_0xe36e('0x39')]=function(_0x51894c,_0xb2046c){var _0x2f828e={},_0x14eefa={},_0x5b7a97={'count':0x0,'rows':[]};var _0x2c58d1=_[_0xe36e('0x3a')](db['FaxMessage'][_0xe36e('0x3b')],function(_0x3ec9e2){return{'name':_0x3ec9e2[_0xe36e('0x3c')],'type':_0x3ec9e2[_0xe36e('0x3d')][_0xe36e('0x3e')]};});_0x14eefa[_0xe36e('0x3f')]=_[_0xe36e('0x3a')](_0x2c58d1,_0xe36e('0x37'));_0x14eefa[_0xe36e('0x40')]=_[_0xe36e('0x41')](_0x51894c[_0xe36e('0x40')]);_0x14eefa[_0xe36e('0x42')]=_[_0xe36e('0x43')](_0x14eefa['model'],_0x14eefa[_0xe36e('0x40')]);_0x2f828e[_0xe36e('0x44')]=_[_0xe36e('0x43')](_0x14eefa[_0xe36e('0x3f')],qs[_0xe36e('0x45')](_0x51894c['query']['fields']));_0x2f828e[_0xe36e('0x44')]=_0x2f828e[_0xe36e('0x44')][_0xe36e('0x46')]?_0x2f828e[_0xe36e('0x44')]:_0x14eefa[_0xe36e('0x3f')];if(!_0x51894c[_0xe36e('0x40')][_0xe36e('0x47')](_0xe36e('0x48'))){_0x2f828e['limit']=qs[_0xe36e('0x49')](_0x51894c[_0xe36e('0x40')]['limit']);_0x2f828e[_0xe36e('0x30')]=qs['offset'](_0x51894c[_0xe36e('0x40')][_0xe36e('0x30')]);}_0x2f828e[_0xe36e('0x4a')]=qs[_0xe36e('0x4b')](_0x51894c[_0xe36e('0x40')]['sort']);_0x2f828e[_0xe36e('0x4c')]=qs[_0xe36e('0x42')](_[_0xe36e('0x4d')](_0x51894c[_0xe36e('0x40')],_0x14eefa[_0xe36e('0x42')]),_0x2c58d1);if(_0x51894c[_0xe36e('0x40')]['filter']){_0x2f828e[_0xe36e('0x4c')]=_[_0xe36e('0x4e')](_0x2f828e[_0xe36e('0x4c')],{'$or':_[_0xe36e('0x3a')](_0x2c58d1,function(_0x1cbb7d){if(_0x1cbb7d['type']!==_0xe36e('0x4f')){var _0x31e1ec={};_0x31e1ec[_0x1cbb7d[_0xe36e('0x37')]]={'$like':'%'+_0x51894c[_0xe36e('0x40')][_0xe36e('0x50')]+'%'};return _0x31e1ec;}})});}_0x2f828e=_[_0xe36e('0x4e')]({},_0x2f828e,_0x51894c[_0xe36e('0x51')]);var _0x455cf9={'where':_0x2f828e[_0xe36e('0x4c')]};return db['FaxMessage']['count'](_0x455cf9)[_0xe36e('0x21')](function(_0x5e75da){_0x5b7a97[_0xe36e('0x2f')]=_0x5e75da;if(_0x51894c[_0xe36e('0x40')][_0xe36e('0x52')]){_0x2f828e[_0xe36e('0x53')]=[{'all':!![]}];}return db['FaxMessage'][_0xe36e('0x54')](_0x2f828e);})[_0xe36e('0x21')](function(_0x5dc288){_0x5b7a97[_0xe36e('0x55')]=_0x5dc288;return _0x5b7a97;})[_0xe36e('0x21')](respondWithFilteredResult(_0xb2046c,_0x2f828e))[_0xe36e('0x2b')](handleError(_0xb2046c,null));};exports[_0xe36e('0x56')]=function(_0x15895d,_0x3bc458){var _0x436a12={'raw':!![],'where':{'id':_0x15895d[_0xe36e('0x57')]['id']}},_0xaf917c={};_0xaf917c[_0xe36e('0x3f')]=_[_0xe36e('0x41')](db[_0xe36e('0x58')][_0xe36e('0x3b')]);_0xaf917c[_0xe36e('0x40')]=_[_0xe36e('0x41')](_0x15895d['query']);_0xaf917c[_0xe36e('0x42')]=_['intersection'](_0xaf917c['model'],_0xaf917c[_0xe36e('0x40')]);_0x436a12[_0xe36e('0x44')]=_['intersection'](_0xaf917c[_0xe36e('0x3f')],qs[_0xe36e('0x45')](_0x15895d[_0xe36e('0x40')][_0xe36e('0x45')]));_0x436a12[_0xe36e('0x44')]=_0x436a12[_0xe36e('0x44')][_0xe36e('0x46')]?_0x436a12[_0xe36e('0x44')]:_0xaf917c[_0xe36e('0x3f')];if(_0x15895d['query'][_0xe36e('0x52')]){_0x436a12[_0xe36e('0x53')]=[{'all':!![]}];}_0x436a12=_['merge']({},_0x436a12,_0x15895d[_0xe36e('0x51')]);return db[_0xe36e('0x58')][_0xe36e('0x59')](_0x436a12)[_0xe36e('0x21')](handleEntityNotFound(_0x3bc458,null))[_0xe36e('0x21')](respondWithResult(_0x3bc458,null))['catch'](handleError(_0x3bc458,null));};exports['update']=function(_0x56f5b6,_0x509b3b){if(_0x56f5b6[_0xe36e('0x5a')]['id']){delete _0x56f5b6[_0xe36e('0x5a')]['id'];}return db[_0xe36e('0x58')][_0xe36e('0x59')]({'where':{'id':_0x56f5b6[_0xe36e('0x57')]['id']}})[_0xe36e('0x21')](handleEntityNotFound(_0x509b3b,null))[_0xe36e('0x21')](saveUpdates(_0x56f5b6[_0xe36e('0x5a')],null))[_0xe36e('0x21')](respondWithResult(_0x509b3b,null))['catch'](handleError(_0x509b3b,null));};exports[_0xe36e('0x36')]=function(_0x478138,_0x5a058b){return db[_0xe36e('0x58')][_0xe36e('0x59')]({'where':{'id':_0x478138[_0xe36e('0x57')]['id']}})[_0xe36e('0x21')](handleEntityNotFound(_0x5a058b,null))[_0xe36e('0x21')](removeEntity(_0x5a058b,null))[_0xe36e('0x2b')](handleError(_0x5a058b,null));};exports[_0xe36e('0x5b')]=function(_0x1a70d1,_0x1fe174){return db[_0xe36e('0x58')][_0xe36e('0x5b')]()[_0xe36e('0x21')](respondWithResult(_0x1fe174,null))[_0xe36e('0x2b')](handleError(_0x1fe174,null));};var interaction_log=require(_0xe36e('0x13'))(_0xe36e('0x5c'));exports[_0xe36e('0x5d')]=function(_0x3c78ea,_0x275142,_0x14738a){var _0x3e7d8d={'agent':{},'channel':_0xe36e('0x5e')};if(_0x3c78ea[_0xe36e('0x5a')]['id']){delete _0x3c78ea[_0xe36e('0x5a')]['id'];}_0x3c78ea[_0xe36e('0x5a')][_0xe36e('0x5f')]=!![];_0x3c78ea['body'][_0xe36e('0x60')]=moment()[_0xe36e('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c78ea[_0xe36e('0x5a')][_0xe36e('0x62')]=_0x3c78ea[_0xe36e('0x5a')][_0xe36e('0x62')]||_0x3c78ea[_0xe36e('0x63')]['id'];_0x3e7d8d[_0xe36e('0x64')]['id']=_0x3c78ea['body'][_0xe36e('0x62')];return db['FaxMessage'][_0xe36e('0x59')]({'where':{'id':_0x3c78ea[_0xe36e('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xe36e('0x65')],'as':_0xe36e('0x66')}]})[_0xe36e('0x21')](handleEntityNotFound(_0x275142,null))[_0xe36e('0x21')](saveUpdates(_0x3c78ea[_0xe36e('0x5a')],null))[_0xe36e('0x21')](function(_0x4c8d2b){if(_0x4c8d2b){_0x3e7d8d[_0xe36e('0x29')]=_0x4c8d2b[_0xe36e('0x67')]({'plain':!![]});return db['FaxInteraction'][_0xe36e('0x59')]({'where':{'id':_0x4c8d2b[_0xe36e('0x68')]}});}return null;})[_0xe36e('0x21')](handleEntityNotFound(_0x275142,null))[_0xe36e('0x21')](function(_0x30786a){if(_0x30786a){return _0x30786a[_0xe36e('0x35')]({'UserId':_0x3c78ea[_0xe36e('0x5a')]['UserId'],'read1stAt':_[_0xe36e('0x69')](_0x30786a[_0xe36e('0x6a')])?moment()[_0xe36e('0x61')](_0xe36e('0x6b')):undefined});}return null;})[_0xe36e('0x21')](function(_0x43d8c2){if(_0x43d8c2){_0x3e7d8d[_0xe36e('0x6c')]=_0x43d8c2[_0xe36e('0x67')]({'plain':!![]});interaction_log[_0xe36e('0x22')](_0xe36e('0x6d'),_0x3c78ea[_0xe36e('0x63')]['id'],_0x3c78ea['user'][_0xe36e('0x37')],_0x3c78ea[_0xe36e('0x63')][_0xe36e('0x6e')],_0x3e7d8d[_0xe36e('0x6c')]['id'],_0x3c78ea['body']?JSON['stringify'](_0x3c78ea[_0xe36e('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3e7d8d);}return null;})[_0xe36e('0x21')](function(_0x51041b){if(_0x51041b){if(_0x3c78ea[_0xe36e('0x5a')][_0xe36e('0x6f')]){_0x3e7d8d[_0xe36e('0x29')][_0xe36e('0x70')]=util[_0xe36e('0x61')](_0xe36e('0x71'),_0x3c78ea[_0xe36e('0x63')][_0xe36e('0x37')]);_0x3e7d8d[_0xe36e('0x29')]['channel']=_0x3e7d8d[_0xe36e('0x72')];_0x3e7d8d['message'][_0xe36e('0x73')]='accept';return respondWithRpcPromise(_0xe36e('0x74'),_0xe36e('0x74'),{'event':_0xe36e('0x75'),'message':_0x3e7d8d[_0xe36e('0x29')]},client9002)['then'](function(){return _0x3e7d8d;});}return _0x3e7d8d;}return null;})['then'](respondWithResult(_0x275142,null))[_0xe36e('0x2b')](handleError(_0x275142,null));};var interaction_log=require(_0xe36e('0x13'))(_0xe36e('0x5c'));exports[_0xe36e('0x34')]=function(_0x3be728,_0x300f3f,_0x57ae0d){var _0x241f89={'agent':{},'channel':_0xe36e('0x5e')};if(_0x3be728['body']['id']){delete _0x3be728[_0xe36e('0x5a')]['id'];}_0x3be728['body'][_0xe36e('0x62')]=_0x3be728[_0xe36e('0x5a')][_0xe36e('0x62')]||_0x3be728[_0xe36e('0x63')]['id'];_0x241f89['agent']['id']=_0x3be728[_0xe36e('0x5a')]['UserId'];return db['FaxMessage'][_0xe36e('0x59')]({'where':{'id':_0x3be728[_0xe36e('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x300f3f,null))['then'](function(_0x460cc9){if(_0x460cc9){_0x241f89['message']=_0x460cc9[_0xe36e('0x67')]({'plain':!![]});return db[_0xe36e('0x76')][_0xe36e('0x59')]({'where':{'id':_0x460cc9[_0xe36e('0x68')]}});}return null;})[_0xe36e('0x21')](handleEntityNotFound(_0x300f3f,null))[_0xe36e('0x21')](function(_0x590885){if(_0x590885){_0x241f89[_0xe36e('0x6c')]=_0x590885[_0xe36e('0x67')]({'plain':!![]});interaction_log[_0xe36e('0x22')](_0xe36e('0x77'),_0x3be728['user']['id'],_0x3be728[_0xe36e('0x63')][_0xe36e('0x37')],_0x3be728[_0xe36e('0x63')][_0xe36e('0x6e')],_0x241f89['interaction']['id'],_0x3be728[_0xe36e('0x5a')]?JSON['stringify'](_0x3be728[_0xe36e('0x5a')]):'null');return respondWithRpcPromise(_0xe36e('0x78'),'rejectMessage',_0x241f89);}return null;})['then'](function(_0x2c2ce0){if(_0x2c2ce0){_0x2c2ce0[_0xe36e('0x29')][_0xe36e('0x70')]=util['format'](_0xe36e('0x71'),_0x3be728[_0xe36e('0x63')]['name']);_0x2c2ce0[_0xe36e('0x29')][_0xe36e('0x72')]=_0x241f89[_0xe36e('0x72')];_0x2c2ce0['message']['event']=_0xe36e('0x34');respondWithRpcPromise(_0xe36e('0x74'),_0xe36e('0x74'),{'event':_0xe36e('0x79'),'message':_0x2c2ce0[_0xe36e('0x29')]},client9002);return _0x241f89;}return null;})['then'](respondWithResult(_0x300f3f,null))[_0xe36e('0x2b')](handleError(_0x300f3f,null));};exports[_0xe36e('0x7a')]=function(_0x15334c,_0x79882){var _0xdc59c5;return db['FaxMessage'][_0xe36e('0x7a')](_0x15334c[_0xe36e('0x5a')],{})[_0xe36e('0x21')](function(_0x493d0f){_0xdc59c5=_0x493d0f;return db[_0xe36e('0x65')]['findOne']({'where':{'id':_0xdc59c5[_0xe36e('0x7b')]}});})['then'](function(_0x198894){if(_[_0xe36e('0x69')](_0x198894)){return;}else{_0xdc59c5['fax']=_0x198894[_0xe36e('0x5e')];return db['Attachment'][_0xe36e('0x7c')]({'where':{'id':_0xdc59c5[_0xe36e('0x7d')]}});}})[_0xe36e('0x21')](function(_0x201212){return respondWithRpcPromise(_0xe36e('0x7e'),'SendFax',{'FaxAccountId':_[_0xe36e('0x69')](_0x15334c['body'])?undefined:_0x15334c[_0xe36e('0x5a')][_0xe36e('0x7f')],'path':_[_0xe36e('0x69')](_0x201212)?undefined:util[_0xe36e('0x61')](_0xe36e('0x80'),_0x201212[_0xe36e('0x81')]),'fax':_['isNil'](_0xdc59c5[_0xe36e('0x5e')])?undefined:_0xdc59c5[_0xe36e('0x5e')],'AttachmentId':_0xdc59c5[_0xe36e('0x7d')]},client9002);})['then'](respondWithResult(_0x79882,0xc9))[_0xe36e('0x2b')](handleError(_0x79882,null));};exports[_0xe36e('0x82')]=function(_0x352e4a,_0x3e9819){var _0x5e5796=path[_0xe36e('0x83')](config['root'],_0xe36e('0x84'),'files',_0xe36e('0x85'));return db[_0xe36e('0x58')][_0xe36e('0x59')]({'where':{'id':_0x352e4a['params']['id']},'include':[{'model':db[_0xe36e('0x86')],'as':_0xe36e('0x86')}]})['then'](handleEntityNotFound(_0x3e9819,null))[_0xe36e('0x21')](function(_0x46efb6){if(_0x46efb6){return _0x3e9819[_0xe36e('0x82')](path['join'](_0x5e5796,_0x46efb6['Attachment'][_0xe36e('0x81')]));}})[_0xe36e('0x2b')](handleError(_0x3e9819,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c23ab70..ee0bdc1 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(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x34e8,0x12c));var _0x834e=function(_0x205b5f,_0x2c2461){_0x205b5f=_0x205b5f-0x0;var _0xdd0dca=_0x34e8[_0x205b5f];return _0xdd0dca;};'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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x4c9661,_0x160725){var _0x3ea6b3=function(_0x1ea4c4){while(--_0x1ea4c4){_0x4c9661['push'](_0x4c9661['shift']());}};_0x3ea6b3(++_0x160725);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index a366322..837f27b 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 _0x7938=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','define','fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteractionId','then','createdAt','error'];(function(_0x55b79e,_0x3d76b1){var _0x3bddaa=function(_0x52f267){while(--_0x52f267){_0x55b79e['push'](_0x55b79e['shift']());}};_0x3bddaa(++_0x3d76b1);}(_0x7938,0x110));var _0x8793=function(_0x231879,_0x59e088){_0x231879=_0x231879-0x0;var _0x39d869=_0x7938[_0x231879];return _0x39d869;};'use strict';var _=require(_0x8793('0x0'));var util=require(_0x8793('0x1'));var logger=require(_0x8793('0x2'))(_0x8793('0x3'));var moment=require(_0x8793('0x4'));var BPromise=require(_0x8793('0x5'));var rp=require(_0x8793('0x6'));var fs=require('fs');var path=require(_0x8793('0x7'));var rimraf=require('rimraf');var config=require(_0x8793('0x8'));var attributes=require(_0x8793('0x9'));module['exports']=function(_0x57c068,_0x2b1fc9){return _0x57c068[_0x8793('0xa')]('FaxMessage',attributes,{'tableName':_0x8793('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x8793('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x188a1d,_0x20753d,_0x5c1097){var _0x15bfd4=_0x57c068[_0x8793('0xd')];var _0x1abd38=_0x188a1d[_0x8793('0xe')]({'plain':!![]});if(_0x1abd38[_0x8793('0xf')]['toLowerCase']()==='in'||_0x1abd38['direction'][_0x8793('0x10')]()===_0x8793('0x11')&&!_0x1abd38[_0x8793('0x12')]&&!_[_0x8793('0x13')](_0x1abd38[_0x8793('0x14')])){_0x15bfd4['FaxInteraction']['findOne']({'where':{'id':_0x1abd38[_0x8793('0x15')]}})[_0x8793('0x16')](function(_0x80e8b8){if(_0x80e8b8){_0x80e8b8['update']({'lastMsgAt':_0x1abd38[_0x8793('0x17')],'lastMsgDirection':_0x1abd38[_0x8793('0xf')]['toLowerCase']()});}})['catch'](function(_0x369389){console[_0x8793('0x18')](_0x369389);});}_0x5c1097();}},'charset':_0x8793('0x19'),'collate':_0x8793('0x1a')});}; \ No newline at end of file +var _0x2a8d=['UserId','findOne','FaxInteractionId','then','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fti_fax_messages','body','FULLTEXT','models','get','direction','out','secret','isNil'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x2a8d,0x158));var _0xd2a8=function(_0x4eef56,_0x3ad39b){_0x4eef56=_0x4eef56-0x0;var _0x349d4a=_0x2a8d[_0x4eef56];return _0x349d4a;};'use strict';var _=require(_0xd2a8('0x0'));var util=require(_0xd2a8('0x1'));var logger=require(_0xd2a8('0x2'))('api');var moment=require(_0xd2a8('0x3'));var BPromise=require('bluebird');var rp=require(_0xd2a8('0x4'));var fs=require('fs');var path=require(_0xd2a8('0x5'));var rimraf=require(_0xd2a8('0x6'));var config=require(_0xd2a8('0x7'));var attributes=require(_0xd2a8('0x8'));module[_0xd2a8('0x9')]=function(_0x4686cc,_0x3f03ee){return _0x4686cc[_0xd2a8('0xa')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xd2a8('0xb'),'fields':[_0xd2a8('0xc')],'type':_0xd2a8('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x8fb4bd,_0x1e44f2,_0x49e3ad){var _0x226685=_0x4686cc[_0xd2a8('0xe')];var _0x3a2ad1=_0x8fb4bd[_0xd2a8('0xf')]({'plain':!![]});if(_0x3a2ad1[_0xd2a8('0x10')]['toLowerCase']()==='in'||_0x3a2ad1['direction']['toLowerCase']()===_0xd2a8('0x11')&&!_0x3a2ad1[_0xd2a8('0x12')]&&!_[_0xd2a8('0x13')](_0x3a2ad1[_0xd2a8('0x14')])){_0x226685['FaxInteraction'][_0xd2a8('0x15')]({'where':{'id':_0x3a2ad1[_0xd2a8('0x16')]}})[_0xd2a8('0x17')](function(_0x311693){if(_0x311693){_0x311693[_0xd2a8('0x18')]({'lastMsgAt':_0x3a2ad1['createdAt'],'lastMsgDirection':_0x3a2ad1[_0xd2a8('0x10')]['toLowerCase']()});}})['catch'](function(_0x358db3){console[_0xd2a8('0x19')](_0x358db3);});}_0x49e3ad();}},'charset':_0xd2a8('0x1a'),'collate':_0xd2a8('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index bfcf4be..db4a2bd 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 _0xa5ef=['./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','where','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x8719db,_0x434d69){var _0x2a0f7a=function(_0x4ae84d){while(--_0x4ae84d){_0x8719db['push'](_0x8719db['shift']());}};_0x2a0f7a(++_0x434d69);}(_0xa5ef,0x19e));var _0xfa5e=function(_0xf35bd4,_0x51ff64){_0xf35bd4=_0xf35bd4-0x0;var _0x47912b=_0xa5ef[_0xf35bd4];return _0x47912b;};'use strict';var _=require(_0xfa5e('0x0'));var util=require('util');var moment=require(_0xfa5e('0x1'));var BPromise=require(_0xfa5e('0x2'));var rs=require(_0xfa5e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa5e('0x4'))['db'];var utils=require(_0xfa5e('0x5'));var logger=require(_0xfa5e('0x6'))(_0xfa5e('0x7'));var config=require(_0xfa5e('0x8'));var jayson=require(_0xfa5e('0x9'));var client=jayson['client'][_0xfa5e('0xa')]({'port':0x232a});config[_0xfa5e('0xb')]=_[_0xfa5e('0xc')](config['redis'],{'host':_0xfa5e('0xd'),'port':0x18eb});var socket=require(_0xfa5e('0xe'))(new Redis(config[_0xfa5e('0xb')]));require(_0xfa5e('0xf'))[_0xfa5e('0x10')](socket);function respondWithRpcPromise(_0x248485,_0x3bb153,_0x16b7ac){return new BPromise(function(_0x567b75,_0x1cb8ce){return client[_0xfa5e('0x11')](_0x248485,_0x16b7ac)[_0xfa5e('0x12')](function(_0x14d04a){logger['info'](_0xfa5e('0x13'),_0x3bb153,_0xfa5e('0x14'));logger[_0xfa5e('0x15')](_0xfa5e('0x16'),_0x3bb153,_0xfa5e('0x14'),JSON[_0xfa5e('0x17')](_0x14d04a));if(_0x14d04a[_0xfa5e('0x18')]){if(_0x14d04a[_0xfa5e('0x18')][_0xfa5e('0x19')]===0x1f4){logger[_0xfa5e('0x18')](_0xfa5e('0x13'),_0x3bb153,_0x14d04a[_0xfa5e('0x18')][_0xfa5e('0x1a')]);return _0x1cb8ce(_0x14d04a[_0xfa5e('0x18')][_0xfa5e('0x1a')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x3bb153,_0x14d04a['error'][_0xfa5e('0x1a')]);return _0x567b75(_0x14d04a[_0xfa5e('0x18')]['message']);}else{logger[_0xfa5e('0x1b')](_0xfa5e('0x13'),_0x3bb153,_0xfa5e('0x14'));_0x567b75(_0x14d04a[_0xfa5e('0x1c')][_0xfa5e('0x1a')]);}})[_0xfa5e('0x1d')](function(_0xd4f37e){logger['error'](_0xfa5e('0x13'),_0x3bb153,_0xd4f37e);_0x1cb8ce(_0xd4f37e);});});}exports[_0xfa5e('0x1e')]=function(_0x4f96ce){var _0x20b37a=this;return new Promise(function(_0x5283db,_0x41a063){return db[_0xfa5e('0x1f')]['create'](_0x4f96ce[_0xfa5e('0x20')],{'raw':_0x4f96ce[_0xfa5e('0x21')]?_0x4f96ce[_0xfa5e('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xfa5e('0x12')](function(_0x47f97f){logger[_0xfa5e('0x1b')](_0xfa5e('0x1e'),_0x4f96ce);logger[_0xfa5e('0x15')]('CreateFaxMessage',_0x4f96ce,JSON['stringify'](_0x47f97f));_0x5283db(_0x47f97f);})[_0xfa5e('0x1d')](function(_0x391945){logger[_0xfa5e('0x18')]('CreateFaxMessage',_0x391945['message'],_0x4f96ce);_0x41a063(_0x20b37a[_0xfa5e('0x18')](0x1f4,_0x391945[_0xfa5e('0x1a')]));});});};exports['UpdateFaxMessage']=function(_0xd9c4a9){var _0x5bae20=this;return new Promise(function(_0x25396a,_0x125d2c){return db[_0xfa5e('0x1f')]['update'](_0xd9c4a9['body'],{'raw':_0xd9c4a9['options']?_0xd9c4a9[_0xfa5e('0x21')][_0xfa5e('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd9c4a9['options']?_0xd9c4a9[_0xfa5e('0x21')][_0xfa5e('0x23')]||null:null,'attributes':_0xd9c4a9[_0xfa5e('0x21')]?_0xd9c4a9[_0xfa5e('0x21')][_0xfa5e('0x24')]||null:null,'limit':_0xd9c4a9[_0xfa5e('0x21')]?_0xd9c4a9['options'][_0xfa5e('0x25')]||null:null})[_0xfa5e('0x12')](function(_0x2316d6){logger[_0xfa5e('0x1b')]('UpdateFaxMessage',_0xd9c4a9);logger[_0xfa5e('0x15')](_0xfa5e('0x26'),_0xd9c4a9,JSON[_0xfa5e('0x17')](_0x2316d6));_0x25396a(_0x2316d6);})['catch'](function(_0x39b46b){logger[_0xfa5e('0x18')](_0xfa5e('0x26'),_0x39b46b[_0xfa5e('0x1a')],_0xd9c4a9);_0x125d2c(_0x5bae20[_0xfa5e('0x18')](0x1f4,_0x39b46b[_0xfa5e('0x1a')]));});});}; \ No newline at end of file +var _0xbff7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where','attributes','then','util','moment'];(function(_0x460fd9,_0x4b4b97){var _0x424e18=function(_0x4a4942){while(--_0x4a4942){_0x460fd9['push'](_0x460fd9['shift']());}};_0x424e18(++_0x4b4b97);}(_0xbff7,0x8a));var _0x7bff=function(_0x288e13,_0x47dd3a){_0x288e13=_0x288e13-0x0;var _0x225e86=_0xbff7[_0x288e13];return _0x225e86;};'use strict';var _=require('lodash');var util=require(_0x7bff('0x0'));var moment=require(_0x7bff('0x1'));var BPromise=require(_0x7bff('0x2'));var rs=require(_0x7bff('0x3'));var fs=require('fs');var Redis=require(_0x7bff('0x4'));var db=require(_0x7bff('0x5'))['db'];var utils=require(_0x7bff('0x6'));var logger=require(_0x7bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7bff('0x8'));var client=jayson[_0x7bff('0x9')][_0x7bff('0xa')]({'port':0x232a});config[_0x7bff('0xb')]=_[_0x7bff('0xc')](config[_0x7bff('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bff('0xb')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x224e96,_0xd4838b,_0x15d41b){return new BPromise(function(_0x56d72f,_0x36be66){return client[_0x7bff('0xd')](_0x224e96,_0x15d41b)['then'](function(_0x39c091){logger[_0x7bff('0xe')](_0x7bff('0xf'),_0xd4838b,_0x7bff('0x10'));logger[_0x7bff('0x11')](_0x7bff('0x12'),_0xd4838b,_0x7bff('0x10'),JSON[_0x7bff('0x13')](_0x39c091));if(_0x39c091[_0x7bff('0x14')]){if(_0x39c091[_0x7bff('0x14')][_0x7bff('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0xd4838b,_0x39c091['error'][_0x7bff('0x16')]);return _0x36be66(_0x39c091['error']['message']);}logger['error'](_0x7bff('0xf'),_0xd4838b,_0x39c091[_0x7bff('0x14')][_0x7bff('0x16')]);return _0x56d72f(_0x39c091[_0x7bff('0x14')][_0x7bff('0x16')]);}else{logger[_0x7bff('0xe')](_0x7bff('0xf'),_0xd4838b,_0x7bff('0x10'));_0x56d72f(_0x39c091['result'][_0x7bff('0x16')]);}})[_0x7bff('0x17')](function(_0x35b0c5){logger['error']('FaxMessage,\x20%s,\x20%s',_0xd4838b,_0x35b0c5);_0x36be66(_0x35b0c5);});});}exports[_0x7bff('0x18')]=function(_0x5393ea){var _0x2ea388=this;return new Promise(function(_0x2e5395,_0x22f700){return db[_0x7bff('0x19')][_0x7bff('0x1a')](_0x5393ea[_0x7bff('0x1b')],{'raw':_0x5393ea[_0x7bff('0x1c')]?_0x5393ea[_0x7bff('0x1c')][_0x7bff('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x26144c){logger[_0x7bff('0xe')](_0x7bff('0x18'),_0x5393ea);logger[_0x7bff('0x11')](_0x7bff('0x18'),_0x5393ea,JSON[_0x7bff('0x13')](_0x26144c));_0x2e5395(_0x26144c);})[_0x7bff('0x17')](function(_0x2df64f){logger[_0x7bff('0x14')]('CreateFaxMessage',_0x2df64f[_0x7bff('0x16')],_0x5393ea);_0x22f700(_0x2ea388[_0x7bff('0x14')](0x1f4,_0x2df64f[_0x7bff('0x16')]));});});};exports[_0x7bff('0x1e')]=function(_0x6a923b){var _0xba40ff=this;return new Promise(function(_0x416fb5,_0x5028fc){return db['FaxMessage'][_0x7bff('0x1f')](_0x6a923b['body'],{'raw':_0x6a923b['options']?_0x6a923b[_0x7bff('0x1c')][_0x7bff('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a923b[_0x7bff('0x1c')]?_0x6a923b[_0x7bff('0x1c')][_0x7bff('0x20')]||null:null,'attributes':_0x6a923b[_0x7bff('0x1c')]?_0x6a923b[_0x7bff('0x1c')][_0x7bff('0x21')]||null:null,'limit':_0x6a923b[_0x7bff('0x1c')]?_0x6a923b[_0x7bff('0x1c')]['limit']||null:null})[_0x7bff('0x22')](function(_0x59da60){logger[_0x7bff('0xe')](_0x7bff('0x1e'),_0x6a923b);logger[_0x7bff('0x11')](_0x7bff('0x1e'),_0x6a923b,JSON[_0x7bff('0x13')](_0x59da60));_0x416fb5(_0x59da60);})[_0x7bff('0x17')](function(_0x3fe76d){logger[_0x7bff('0x14')](_0x7bff('0x1e'),_0x3fe76d[_0x7bff('0x16')],_0x6a923b);_0x5028fc(_0xba40ff[_0x7bff('0x14')](0x1f4,_0x3fe76d[_0x7bff('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index f84afac..c919e05 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 393d222..439b4cf 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 _0x6be5=['post','tracked','fax','faxmessage:create','create','put','update','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/download'];(function(_0x1ae4c0,_0x2212ed){var _0xe6b31b=function(_0x4320a0){while(--_0x4320a0){_0x1ae4c0['push'](_0x1ae4c0['shift']());}};_0xe6b31b(++_0x2212ed);}(_0x6be5,0x144));var _0x56be=function(_0x566bfb,_0x5f171a){_0x566bfb=_0x566bfb-0x0;var _0x3edfcc=_0x6be5[_0x566bfb];return _0x3edfcc;};'use strict';var multer=require(_0x56be('0x0'));var util=require('util');var path=require(_0x56be('0x1'));var timeout=require(_0x56be('0x2'));var express=require(_0x56be('0x3'));var router=express['Router']();var auth=require(_0x56be('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0x56be('0x5')]('/',auth[_0x56be('0x6')](),controller[_0x56be('0x7')]);router['get'](_0x56be('0x8'),auth[_0x56be('0x6')](),controller[_0x56be('0x9')]);router[_0x56be('0x5')](_0x56be('0xa'),auth[_0x56be('0x6')](),controller['show']);router[_0x56be('0x5')](_0x56be('0xb'),auth[_0x56be('0x6')](),controller['download']);router[_0x56be('0xc')]('/',auth[_0x56be('0x6')](),interaction[_0x56be('0xd')](_0x56be('0xe'),_0x56be('0xf')),controller[_0x56be('0x10')]);router[_0x56be('0x11')]('/:id',auth[_0x56be('0x6')](),controller[_0x56be('0x12')]);router[_0x56be('0x11')]('/:id/accept',auth[_0x56be('0x6')](),controller['accept']);router[_0x56be('0x11')](_0x56be('0x13'),auth['isAuthenticated'](),controller[_0x56be('0x14')]);router[_0x56be('0x15')](_0x56be('0xa'),auth['isAuthenticated'](),controller[_0x56be('0x16')]);module[_0x56be('0x17')]=router; \ No newline at end of file +var _0xeb1d=['/:id/download','download','post','tracked','fax','faxmessage:create','create','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb1d,0x131));var _0xdeb1=function(_0x572c8b,_0x46855b){_0x572c8b=_0x572c8b-0x0;var _0x1d0d19=_0xeb1d[_0x572c8b];return _0x1d0d19;};'use strict';var multer=require(_0xdeb1('0x0'));var util=require('util');var path=require(_0xdeb1('0x1'));var timeout=require(_0xdeb1('0x2'));var express=require('express');var router=express[_0xdeb1('0x3')]();var auth=require(_0xdeb1('0x4'));var interaction=require(_0xdeb1('0x5'));var config=require(_0xdeb1('0x6'));var controller=require(_0xdeb1('0x7'));router[_0xdeb1('0x8')]('/',auth[_0xdeb1('0x9')](),controller[_0xdeb1('0xa')]);router['get'](_0xdeb1('0xb'),auth[_0xdeb1('0x9')](),controller['describe']);router[_0xdeb1('0x8')](_0xdeb1('0xc'),auth[_0xdeb1('0x9')](),controller[_0xdeb1('0xd')]);router[_0xdeb1('0x8')](_0xdeb1('0xe'),auth[_0xdeb1('0x9')](),controller[_0xdeb1('0xf')]);router[_0xdeb1('0x10')]('/',auth['isAuthenticated'](),interaction[_0xdeb1('0x11')](_0xdeb1('0x12'),_0xdeb1('0x13')),controller[_0xdeb1('0x14')]);router['put'](_0xdeb1('0xc'),auth['isAuthenticated'](),controller[_0xdeb1('0x15')]);router['put'](_0xdeb1('0x16'),auth[_0xdeb1('0x9')](),controller[_0xdeb1('0x17')]);router[_0xdeb1('0x18')](_0xdeb1('0x19'),auth['isAuthenticated'](),controller[_0xdeb1('0x1a')]);router[_0xdeb1('0x1b')]('/:id',auth[_0xdeb1('0x9')](),controller[_0xdeb1('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a9d5266..e2fe829 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 _0x6a24=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x4b2a2a,_0x3369ee){var _0x2e7587=function(_0x4d8128){while(--_0x4d8128){_0x4b2a2a['push'](_0x4b2a2a['shift']());}};_0x2e7587(++_0x3369ee);}(_0x6a24,0xd1));var _0x46a2=function(_0x24b19b,_0x5a3e50){_0x24b19b=_0x24b19b-0x0;var _0x53b3ad=_0x6a24[_0x24b19b];return _0x53b3ad;};'use strict';var Sequelize=require(_0x46a2('0x0'));module[_0x46a2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x46a2('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x46a2('0x3')]},'timeout':{'type':Sequelize[_0x46a2('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x46a2('0x5')](_0x46a2('0x6'),'beepall',_0x46a2('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x46a2('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x02e5=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x02e5,0x132));var _0x502e=function(_0x24d56d,_0x1a5b22){_0x24d56d=_0x24d56d-0x0;var _0x54cfe8=_0x02e5[_0x24d56d];return _0x54cfe8;};'use strict';var Sequelize=require(_0x502e('0x0'));module[_0x502e('0x1')]={'name':{'type':Sequelize[_0x502e('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x502e('0x2')]},'timeout':{'type':Sequelize[_0x502e('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x502e('0x4')](_0x502e('0x5'),_0x502e('0x6'),_0x502e('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x502e('0x3')],'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 7dfe96b..b2107f5 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 _0xd190=['fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','updatedAt','createdAt','rows','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','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?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','removeTeams','isEmpty','removeAgents','forEach','emit','userFaxQueue:remove','addAgents','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./faxQueue.socket','sendStatus','status','end','json','count','Content-Range','reject','save','then','destroy','FaxQueues','UserProfileResource','error','name','send','map','FaxQueue','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd190,0xde));var _0x0d19=function(_0xa7f58b,_0xf501d3){_0xa7f58b=_0xa7f58b-0x0;var _0x53b602=_0xd190[_0xa7f58b];return _0x53b602;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0d19('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d19('0x1'));var jsonpatch=require(_0x0d19('0x2'));var rp=require(_0x0d19('0x3'));var moment=require(_0x0d19('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d19('0x5'));var util=require(_0x0d19('0x6'));var path=require(_0x0d19('0x7'));var sox=require(_0x0d19('0x8'));var csv=require(_0x0d19('0x9'));var ejs=require(_0x0d19('0xa'));var fs=require('fs');var _=require(_0x0d19('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0d19('0xc'));var deskjs=require(_0x0d19('0xd'));var toCsv=require(_0x0d19('0x9'));var querystring=require(_0x0d19('0xe'));var Papa=require(_0x0d19('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0d19('0x10'));var as=require(_0x0d19('0x11'));var hardwareService=require(_0x0d19('0x12'));var logger=require(_0x0d19('0x13'))(_0x0d19('0x14'));var utils=require(_0x0d19('0x15'));var config=require(_0x0d19('0x16'));var licenseUtil=require(_0x0d19('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0d19('0x18')],{'host':_0x0d19('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0d19('0x1a'))['register'](socket);function respondWithStatusCode(_0xb2df94,_0x1c4ef1){_0x1c4ef1=_0x1c4ef1||0xcc;return function(_0x5cb5c3){if(_0x5cb5c3){return _0xb2df94[_0x0d19('0x1b')](_0x1c4ef1);}return _0xb2df94[_0x0d19('0x1c')](_0x1c4ef1)[_0x0d19('0x1d')]();};}function respondWithResult(_0x3fcbc5,_0x3a9d36){_0x3a9d36=_0x3a9d36||0xc8;return function(_0x24f6c8){if(_0x24f6c8){return _0x3fcbc5['status'](_0x3a9d36)[_0x0d19('0x1e')](_0x24f6c8);}};}function respondWithFilteredResult(_0x50df91,_0x578b80){return function(_0x2715b7){if(_0x2715b7){var _0x61b3a=_0x2715b7[_0x0d19('0x1f')],_0x4df430=_0x578b80['offset'],_0x4cae75=_0x578b80['offset']+_0x578b80['limit'],_0x3246b3;if(_0x4cae75>=_0x61b3a){_0x4cae75=_0x61b3a;_0x3246b3=0xc8;}else{_0x3246b3=0xce;}_0x50df91['status'](_0x3246b3);return _0x50df91['set'](_0x0d19('0x20'),_0x4df430+'-'+_0x4cae75+'/'+_0x61b3a)[_0x0d19('0x1e')](_0x2715b7);}return null;};}function patchUpdates(_0x52600e){return function(_0x4535d6){try{jsonpatch['apply'](_0x4535d6,_0x52600e,!![]);}catch(_0x8b5d56){return BPromise[_0x0d19('0x21')](_0x8b5d56);}return _0x4535d6[_0x0d19('0x22')]();};}function saveUpdates(_0x352046,_0x6cb100){return function(_0x27914f){if(_0x27914f){return _0x27914f['update'](_0x352046)[_0x0d19('0x23')](function(_0x45bdcf){return _0x45bdcf;});}return null;};}function removeEntity(_0x2a1df7,_0x4b3f7b){return function(_0x3fc8a1){if(_0x3fc8a1){return _0x3fc8a1[_0x0d19('0x24')]()['then'](function(){var _0x29a164=_0x3fc8a1['get']({'plain':!![]});var _0x315744=_0x0d19('0x25');return db[_0x0d19('0x26')][_0x0d19('0x24')]({'where':{'type':_0x315744,'resourceId':_0x29a164['id']}})[_0x0d19('0x23')](function(){return _0x3fc8a1;});})[_0x0d19('0x23')](function(){_0x2a1df7[_0x0d19('0x1c')](0xcc)[_0x0d19('0x1d')]();});}};}function handleEntityNotFound(_0x32109b,_0x1b81e1){return function(_0x5babc3){if(!_0x5babc3){_0x32109b[_0x0d19('0x1b')](0x194);}return _0x5babc3;};}function handleError(_0x2a7477,_0x5f29c5){_0x5f29c5=_0x5f29c5||0x1f4;return function(_0x42933b){logger[_0x0d19('0x27')](_0x42933b['stack']);if(_0x42933b[_0x0d19('0x28')]){delete _0x42933b['name'];}_0x2a7477[_0x0d19('0x1c')](_0x5f29c5)[_0x0d19('0x29')](_0x42933b);};}exports['index']=function(_0x17695c,_0x235851){var _0x2e6a7e={},_0x46a842={},_0x420834={'count':0x0,'rows':[]};var _0x5c0414=_[_0x0d19('0x2a')](db[_0x0d19('0x2b')][_0x0d19('0x2c')],function(_0x34e3f7){return{'name':_0x34e3f7['fieldName'],'type':_0x34e3f7[_0x0d19('0x2d')][_0x0d19('0x2e')]};});_0x46a842[_0x0d19('0x2f')]=_[_0x0d19('0x2a')](_0x5c0414,'name');_0x46a842[_0x0d19('0x30')]=_[_0x0d19('0x31')](_0x17695c[_0x0d19('0x30')]);_0x46a842[_0x0d19('0x32')]=_[_0x0d19('0x33')](_0x46a842['model'],_0x46a842[_0x0d19('0x30')]);_0x2e6a7e['attributes']=_[_0x0d19('0x33')](_0x46a842[_0x0d19('0x2f')],qs[_0x0d19('0x34')](_0x17695c[_0x0d19('0x30')][_0x0d19('0x34')]));_0x2e6a7e['attributes']=_0x2e6a7e[_0x0d19('0x35')][_0x0d19('0x36')]?_0x2e6a7e[_0x0d19('0x35')]:_0x46a842[_0x0d19('0x2f')];if(!_0x17695c[_0x0d19('0x30')][_0x0d19('0x37')](_0x0d19('0x38'))){_0x2e6a7e['limit']=qs[_0x0d19('0x39')](_0x17695c[_0x0d19('0x30')][_0x0d19('0x39')]);_0x2e6a7e['offset']=qs[_0x0d19('0x3a')](_0x17695c['query'][_0x0d19('0x3a')]);}_0x2e6a7e[_0x0d19('0x3b')]=qs[_0x0d19('0x3c')](_0x17695c[_0x0d19('0x30')][_0x0d19('0x3c')]);_0x2e6a7e[_0x0d19('0x3d')]=qs[_0x0d19('0x32')](_[_0x0d19('0x3e')](_0x17695c[_0x0d19('0x30')],_0x46a842['filters']),_0x5c0414);if(_0x17695c[_0x0d19('0x30')][_0x0d19('0x3f')]){_0x2e6a7e[_0x0d19('0x3d')]=_[_0x0d19('0x40')](_0x2e6a7e[_0x0d19('0x3d')],{'$or':_[_0x0d19('0x2a')](_0x5c0414,function(_0x354e1f){if(_0x354e1f[_0x0d19('0x2d')]!==_0x0d19('0x41')){var _0x6d2c5c={};_0x6d2c5c[_0x354e1f[_0x0d19('0x28')]]={'$like':'%'+_0x17695c['query']['filter']+'%'};return _0x6d2c5c;}})});}_0x2e6a7e=_[_0x0d19('0x40')]({},_0x2e6a7e,_0x17695c[_0x0d19('0x42')]);var _0x2a785a={'where':_0x2e6a7e[_0x0d19('0x3d')]};return db[_0x0d19('0x2b')][_0x0d19('0x1f')](_0x2a785a)['then'](function(_0x51f086){_0x420834[_0x0d19('0x1f')]=_0x51f086;if(_0x17695c[_0x0d19('0x30')]['includeAll']){_0x2e6a7e['include']=[{'all':!![]}];}return db['FaxQueue'][_0x0d19('0x43')](_0x2e6a7e);})[_0x0d19('0x23')](function(_0x386d9e){_0x420834['rows']=_0x386d9e;return _0x420834;})['then'](respondWithFilteredResult(_0x235851,_0x2e6a7e))[_0x0d19('0x44')](handleError(_0x235851,null));};exports[_0x0d19('0x45')]=function(_0x3174e0,_0x20e09b){var _0x38b4f9={'raw':!![],'where':{'id':_0x3174e0[_0x0d19('0x46')]['id']}},_0x276ed6={};_0x276ed6['model']=_[_0x0d19('0x31')](db[_0x0d19('0x2b')]['rawAttributes']);_0x276ed6[_0x0d19('0x30')]=_[_0x0d19('0x31')](_0x3174e0[_0x0d19('0x30')]);_0x276ed6[_0x0d19('0x32')]=_[_0x0d19('0x33')](_0x276ed6['model'],_0x276ed6[_0x0d19('0x30')]);_0x38b4f9[_0x0d19('0x35')]=_[_0x0d19('0x33')](_0x276ed6[_0x0d19('0x2f')],qs['fields'](_0x3174e0[_0x0d19('0x30')][_0x0d19('0x34')]));_0x38b4f9[_0x0d19('0x35')]=_0x38b4f9[_0x0d19('0x35')]['length']?_0x38b4f9[_0x0d19('0x35')]:_0x276ed6['model'];if(_0x3174e0[_0x0d19('0x30')][_0x0d19('0x47')]){_0x38b4f9[_0x0d19('0x48')]=[{'all':!![]}];}_0x38b4f9=_[_0x0d19('0x40')]({},_0x38b4f9,_0x3174e0[_0x0d19('0x42')]);return db['FaxQueue'][_0x0d19('0x49')](_0x38b4f9)['then'](handleEntityNotFound(_0x20e09b,null))['then'](respondWithResult(_0x20e09b,null))[_0x0d19('0x44')](handleError(_0x20e09b,null));};exports[_0x0d19('0x4a')]=function(_0x42bd38,_0x1083e1){return db[_0x0d19('0x2b')][_0x0d19('0x4a')](_0x42bd38['body'],{})[_0x0d19('0x23')](function(_0x4a5080){var _0x48eb9e=_0x42bd38[_0x0d19('0x4b')]['get']({'plain':!![]});if(!_0x48eb9e)throw new Error(_0x0d19('0x4c'));if(_0x48eb9e['role']===_0x0d19('0x4b')){var _0x210cb7=_0x4a5080[_0x0d19('0x4d')]({'plain':!![]});var _0x29b8d1=_0x0d19('0x25');return db[_0x0d19('0x4e')][_0x0d19('0x49')]({'where':{'name':_0x29b8d1,'userProfileId':_0x48eb9e[_0x0d19('0x4f')]},'raw':!![]})[_0x0d19('0x23')](function(_0x2fbccd){if(_0x2fbccd&&_0x2fbccd[_0x0d19('0x50')]===0x0){return db[_0x0d19('0x26')][_0x0d19('0x4a')]({'name':_0x210cb7[_0x0d19('0x28')],'resourceId':_0x210cb7['id'],'type':_0x2fbccd[_0x0d19('0x28')],'sectionId':_0x2fbccd['id']},{})[_0x0d19('0x23')](function(){return _0x4a5080;});}else{return _0x4a5080;}})['catch'](function(_0x27d8e4){logger[_0x0d19('0x27')](_0x0d19('0x51'),_0x27d8e4);throw _0x27d8e4;});}return _0x4a5080;})[_0x0d19('0x23')](respondWithResult(_0x1083e1,0xc9))['catch'](handleError(_0x1083e1,null));};exports[_0x0d19('0x52')]=function(_0x577c90,_0x340923){if(_0x577c90['body']['id']){delete _0x577c90[_0x0d19('0x53')]['id'];}return db[_0x0d19('0x2b')][_0x0d19('0x49')]({'where':{'id':_0x577c90['params']['id']}})[_0x0d19('0x23')](handleEntityNotFound(_0x340923,null))[_0x0d19('0x23')](saveUpdates(_0x577c90[_0x0d19('0x53')],null))['then'](respondWithResult(_0x340923,null))[_0x0d19('0x44')](handleError(_0x340923,null));};exports['destroy']=function(_0x5807ba,_0x274730){return db[_0x0d19('0x2b')]['find']({'where':{'id':_0x5807ba[_0x0d19('0x46')]['id']}})[_0x0d19('0x23')](handleEntityNotFound(_0x274730,null))[_0x0d19('0x23')](removeEntity(_0x274730,null))[_0x0d19('0x44')](handleError(_0x274730,null));};exports[_0x0d19('0x54')]=function(_0x4d0bbd,_0x18139b){return db[_0x0d19('0x2b')][_0x0d19('0x54')]()[_0x0d19('0x23')](respondWithResult(_0x18139b,null))[_0x0d19('0x44')](handleError(_0x18139b,null));};exports[_0x0d19('0x55')]=function(_0x1c430f,_0xf1711e,_0x8c61a9){var _0x5cacf7={'raw':!![],'where':{}},_0x4e546d={},_0x2fbce2;return db[_0x0d19('0x2b')][_0x0d19('0x56')]({'where':{'id':_0x1c430f[_0x0d19('0x46')]['id']}})['then'](handleEntityNotFound(_0xf1711e,null))[_0x0d19('0x23')](function(_0x5a9c42){if(_0x5a9c42){_0x2fbce2=_0x5a9c42['get']({'plain':!![]});_0x4e546d['model']=_[_0x0d19('0x31')](db[_0x0d19('0x57')][_0x0d19('0x2c')]);_0x4e546d['query']=_['keys'](_0x1c430f[_0x0d19('0x30')]);_0x4e546d['filters']=_[_0x0d19('0x33')](_0x4e546d[_0x0d19('0x2f')],_0x4e546d[_0x0d19('0x30')]);_0x5cacf7[_0x0d19('0x35')]=_['intersection'](_0x4e546d[_0x0d19('0x2f')],qs[_0x0d19('0x34')](_0x1c430f[_0x0d19('0x30')][_0x0d19('0x34')]));_0x5cacf7[_0x0d19('0x35')]=_0x5cacf7[_0x0d19('0x35')][_0x0d19('0x36')]?_0x5cacf7['attributes']:_0x4e546d[_0x0d19('0x2f')];if(!_0x1c430f['query'][_0x0d19('0x37')](_0x0d19('0x38'))){_0x5cacf7['limit']=qs[_0x0d19('0x39')](_0x1c430f[_0x0d19('0x30')][_0x0d19('0x39')]);_0x5cacf7[_0x0d19('0x3a')]=qs[_0x0d19('0x3a')](_0x1c430f['query'][_0x0d19('0x3a')]);}_0x5cacf7[_0x0d19('0x3b')]=qs['sort'](_0x1c430f['query']['sort']);_0x5cacf7['where']=qs[_0x0d19('0x32')](_[_0x0d19('0x3e')](_0x1c430f[_0x0d19('0x30')],_0x4e546d[_0x0d19('0x32')]));_0x5cacf7[_0x0d19('0x3d')][_0x0d19('0x58')]=_0x5a9c42['id'];if(_0x1c430f['query']['filter']){_0x5cacf7['where']=_[_0x0d19('0x40')](_0x5cacf7[_0x0d19('0x3d')],{'$or':_[_0x0d19('0x2a')](_0x5cacf7[_0x0d19('0x35')],function(_0x29e69f){var _0x33c4f9={};_0x33c4f9[_0x29e69f]={'$like':'%'+_0x1c430f[_0x0d19('0x30')][_0x0d19('0x3f')]+'%'};return _0x33c4f9;})});}_0x5cacf7=_[_0x0d19('0x40')]({},_0x5cacf7,_0x1c430f[_0x0d19('0x42')]);return db[_0x0d19('0x57')][_0x0d19('0x43')](_0x5cacf7);}})[_0x0d19('0x23')](function(_0x20cc06){if(_0x20cc06){return db[_0x0d19('0x59')][_0x0d19('0x5a')]({'where':{'id':_[_0x0d19('0x2a')](_0x20cc06,'UserId'),'role':'agent'},'attributes':['id',_0x0d19('0x28'),'faxPause',_0x0d19('0x5b'),_0x0d19('0x5c')]});}})['then'](function(_0x3b13ac){if(_0x3b13ac){return{'count':_0x3b13ac[_0x0d19('0x1f')],'rows':_[_0x0d19('0x2a')](_0x3b13ac[_0x0d19('0x5d')],function(_0xa78cf6){return{'membername':_0xa78cf6[_0x0d19('0x28')],'UserId':_0xa78cf6['id'],'queue_name':_0x2fbce2[_0x0d19('0x28')],'FaxQueueId':_0x2fbce2['id'],'interface':util[_0x0d19('0x5e')]('%s/%s',_0x0d19('0x5f'),_0xa78cf6['name']),'penalty':0x0,'paused':_0xa78cf6['faxPause'],'createdAt':_0xa78cf6[_0x0d19('0x5c')],'updatedAt':_0xa78cf6[_0x0d19('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0d19('0x23')](respondWithFilteredResult(_0xf1711e,_0x5cacf7))['catch'](handleError(_0xf1711e,null));};exports[_0x0d19('0x60')]=function(_0xaa7028,_0x441fe3,_0x354be1){var _0x45f276={};var _0x6ad727={};var _0x118c2b;var _0xf29ccc;return db[_0x0d19('0x2b')][_0x0d19('0x56')]({'where':{'id':_0xaa7028['params']['id']}})[_0x0d19('0x23')](handleEntityNotFound(_0x441fe3,null))[_0x0d19('0x23')](function(_0xc56721){if(_0xc56721){_0x118c2b=_0xc56721;_0x6ad727[_0x0d19('0x2f')]=_[_0x0d19('0x31')](db[_0x0d19('0x61')]['rawAttributes']);_0x6ad727[_0x0d19('0x30')]=_[_0x0d19('0x31')](_0xaa7028['query']);_0x6ad727[_0x0d19('0x32')]=_[_0x0d19('0x33')](_0x6ad727[_0x0d19('0x2f')],_0x6ad727['query']);_0x45f276['attributes']=_['intersection'](_0x6ad727[_0x0d19('0x2f')],qs[_0x0d19('0x34')](_0xaa7028[_0x0d19('0x30')][_0x0d19('0x34')]));_0x45f276[_0x0d19('0x35')]=_0x45f276['attributes']['length']?_0x45f276[_0x0d19('0x35')]:_0x6ad727[_0x0d19('0x2f')];_0x45f276[_0x0d19('0x3b')]=qs[_0x0d19('0x3c')](_0xaa7028[_0x0d19('0x30')][_0x0d19('0x3c')]);_0x45f276[_0x0d19('0x3d')]=qs[_0x0d19('0x32')](_['pick'](_0xaa7028[_0x0d19('0x30')],_0x6ad727['filters']));if(_0xaa7028[_0x0d19('0x30')][_0x0d19('0x3f')]){_0x45f276['where']=_['merge'](_0x45f276[_0x0d19('0x3d')],{'$or':_['map'](_0x45f276['attributes'],function(_0xda0979){var _0x54378e={};_0x54378e[_0xda0979]={'$like':'%'+_0xaa7028[_0x0d19('0x30')]['filter']+'%'};return _0x54378e;})});}_0x45f276=_[_0x0d19('0x40')]({},_0x45f276,_0xaa7028[_0x0d19('0x42')]);return _0x118c2b[_0x0d19('0x60')](_0x45f276);}})[_0x0d19('0x23')](function(_0x19f701){if(_0x19f701){_0xf29ccc=_0x19f701[_0x0d19('0x36')];if(!_0xaa7028[_0x0d19('0x30')][_0x0d19('0x37')]('nolimit')){_0x45f276['limit']=qs[_0x0d19('0x39')](_0xaa7028[_0x0d19('0x30')][_0x0d19('0x39')]);_0x45f276[_0x0d19('0x3a')]=qs[_0x0d19('0x3a')](_0xaa7028[_0x0d19('0x30')]['offset']);}return _0x118c2b[_0x0d19('0x60')](_0x45f276);}})[_0x0d19('0x23')](function(_0x2aa049){if(_0x2aa049){return _0x2aa049?{'count':_0xf29ccc,'rows':_0x2aa049}:null;}})[_0x0d19('0x23')](respondWithResult(_0x441fe3,null))[_0x0d19('0x44')](handleError(_0x441fe3,null));};exports[_0x0d19('0x62')]=function(_0x319a83,_0x15d2b4,_0x30b9fb){var _0x17e9df=_0x319a83['body'][_0x0d19('0x63')];return db['Team'][_0x0d19('0x43')]({'where':{'id':_0x17e9df},'attributes':['id'],'include':[{'model':db[_0x0d19('0x59')],'as':_0x0d19('0x64'),'attributes':['id',_0x0d19('0x28'),_0x0d19('0x65'),_0x0d19('0x66'),_0x0d19('0x67')],'raw':!![]}]})[_0x0d19('0x23')](function(_0xe93936){if(_0xe93936){var _0x519ea2=_[_0x0d19('0x68')](_0xe93936,function(_0x24250e){var _0x4cb85d=_0x24250e['get']({'plain':!![]});return _0x4cb85d[_0x0d19('0x64')];});return db['FaxQueue'][_0x0d19('0x49')]({'where':{'id':_0x319a83[_0x0d19('0x46')]['id']}})['then'](function(_0x1d6337){return db[_0x0d19('0x69')]['transaction'](function(_0x543b67){return _0x1d6337[_0x0d19('0x62')](_0x17e9df,{'transaction':_0x543b67})[_0x0d19('0x23')](function(){return BPromise[_0x0d19('0x6a')](_0x519ea2,function(_0x2be173){return db[_0x0d19('0x57')][_0x0d19('0x6b')]({'where':{'UserId':_0x2be173['id'],'FaxQueueId':_0x319a83[_0x0d19('0x46')]['id']},'transaction':_0x543b67});});})[_0x0d19('0x23')](function(){_0x519ea2['forEach'](function(_0x1921a0){socket['emit'](_0x0d19('0x6c'),{'UserId':_0x1921a0['id'],'FaxQueueId':_0x1d6337['id']});});});});});}})['then'](respondWithStatusCode(_0x15d2b4,null))[_0x0d19('0x44')](handleError(_0x15d2b4,null));};exports['removeTeams']=function(_0x2b0d52,_0x4e8d20,_0x5bac90){return db[_0x0d19('0x61')][_0x0d19('0x43')]({'where':{'id':_0x2b0d52[_0x0d19('0x30')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0d19('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4e8d20,null))[_0x0d19('0x23')](function(_0x464711){var _0x47bab9=_['map'](_0x464711,'id');var _0x4a4460=[];var _0x2574ef=[];var _0xcbd661=squel[_0x0d19('0x6d')]();_0xcbd661[_0x0d19('0x6e')]('tq.TeamId')[_0x0d19('0x6f')](_0x0d19('0x70'),'tq')[_0x0d19('0x71')](_0x0d19('0x72'),'ut',_0x0d19('0x73'))[_0x0d19('0x3d')](_0x0d19('0x74'),_0x2b0d52[_0x0d19('0x46')]['id']);for(var _0x244cfc=0x0;_0x244cfc<_0x464711[_0x0d19('0x36')];_0x244cfc+=0x1){let _0x2e82c0=_0x464711[_0x244cfc];for(var _0x1f6ffc=0x0;_0x1f6ffc<_0x2e82c0[_0x0d19('0x64')][_0x0d19('0x36')];_0x1f6ffc+=0x1){let _0x4968dd=_0x2e82c0['Agents'][_0x1f6ffc];var _0x52bae3=_0xcbd661[_0x0d19('0x75')]();_0x52bae3[_0x0d19('0x3d')](_0x0d19('0x76'),_0x4968dd['id']);_0x2574ef['push'](db[_0x0d19('0x69')][_0x0d19('0x30')](_0x52bae3[_0x0d19('0x77')](),{'type':db['sequelize'][_0x0d19('0x78')][_0x0d19('0x79')]})[_0x0d19('0x23')](function(_0xb8b2c){if(_0xb8b2c['length']===0x1){return _0x4968dd['id'];}else{var _0x2a64d6=_[_0x0d19('0x7a')](_[_0x0d19('0x2a')](_0xb8b2c,_0x0d19('0x7b')),function(_0x4d64ee){return _[_0x0d19('0x7c')](_0x47bab9,_0x4d64ee);});if(_0x2a64d6){return _0x4968dd['id'];}}}));}}return BPromise[_0x0d19('0x7d')](_0x2574ef)[_0x0d19('0x23')](function(_0x3a02a0){_0x4a4460=_(_0x4a4460)[_0x0d19('0x7e')](_0x3a02a0)['compact']()['value']();return db['FaxQueue']['find']({'where':{'id':_0x2b0d52['params']['id']}})[_0x0d19('0x23')](function(_0x31d2e9){return db['sequelize']['transaction'](function(_0x508eec){return _0x31d2e9[_0x0d19('0x7f')](_0x2b0d52['query'][_0x0d19('0x63')],{'transaction':_0x508eec})[_0x0d19('0x23')](function(){if(!_[_0x0d19('0x80')](_0x4a4460)){return _0x31d2e9[_0x0d19('0x81')](_0x4a4460,{'transaction':_0x508eec});}})[_0x0d19('0x23')](function(){_0x4a4460[_0x0d19('0x82')](function(_0x3430ba){socket[_0x0d19('0x83')](_0x0d19('0x84'),{'UserId':_0x3430ba,'FaxQueueId':_0x31d2e9['id']});});});});});});})[_0x0d19('0x23')](respondWithStatusCode(_0x4e8d20,null))[_0x0d19('0x44')](handleError(_0x4e8d20,null));};exports[_0x0d19('0x85')]=function(_0x529674,_0x60c689,_0x41fcf5){return db[_0x0d19('0x2b')]['find']({'where':{'id':_0x529674['params']['id']}})['then'](handleEntityNotFound(_0x60c689,null))['then'](function(_0x18006c){if(_0x18006c){return _0x18006c['addAgents'](_0x529674['body'][_0x0d19('0x63')],_['omit'](_0x529674[_0x0d19('0x53')],[_0x0d19('0x63'),'id'])||{})[_0x0d19('0x86')](function(_0x192788){for(var _0x2c0375=0x0;_0x2c0375<_0x529674['body']['ids']['length'];_0x2c0375+=0x1){socket[_0x0d19('0x83')](_0x0d19('0x6c'),{'UserId':_0x529674[_0x0d19('0x53')][_0x0d19('0x63')][_0x2c0375],'FaxQueueId':_0x529674['params']['id']});}return _0x192788;});}})[_0x0d19('0x23')](respondWithResult(_0x60c689,null))[_0x0d19('0x44')](handleError(_0x60c689,null));};exports[_0x0d19('0x81')]=function(_0xb060f0,_0x3354f9,_0x395e89){return db['FaxQueue'][_0x0d19('0x49')]({'where':{'id':_0xb060f0['params']['id']}})[_0x0d19('0x23')](handleEntityNotFound(_0x3354f9,null))[_0x0d19('0x23')](function(_0x1f279c){if(_0x1f279c){return _0x1f279c[_0x0d19('0x81')](_0xb060f0[_0x0d19('0x30')][_0x0d19('0x63')])[_0x0d19('0x23')](function(){if(_[_0x0d19('0x87')](_0xb060f0[_0x0d19('0x30')][_0x0d19('0x63')])){for(var _0x3a89fb=0x0;_0x3a89fb<_0xb060f0[_0x0d19('0x30')][_0x0d19('0x63')]['length'];_0x3a89fb+=0x1){socket[_0x0d19('0x83')](_0x0d19('0x84'),{'UserId':Number(_0xb060f0[_0x0d19('0x30')][_0x0d19('0x63')][_0x3a89fb]),'FaxQueueId':Number(_0xb060f0['params']['id'])});}}else{socket[_0x0d19('0x83')](_0x0d19('0x84'),{'UserId':Number(_0xb060f0[_0x0d19('0x30')][_0x0d19('0x63')]),'FaxQueueId':Number(_0xb060f0[_0x0d19('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x3354f9,null))[_0x0d19('0x44')](handleError(_0x3354f9,null));};exports['getAgents']=function(_0x3149ad,_0x23f061,_0x273899){var _0xc8e820={};var _0x43f520={};var _0x13cced;var _0x984a32;return db[_0x0d19('0x2b')]['findOne']({'where':{'id':_0x3149ad['params']['id']}})[_0x0d19('0x23')](handleEntityNotFound(_0x23f061,null))[_0x0d19('0x23')](function(_0x5eabc2){if(_0x5eabc2){_0x13cced=_0x5eabc2;_0x43f520[_0x0d19('0x2f')]=_[_0x0d19('0x31')](db[_0x0d19('0x59')][_0x0d19('0x2c')]);_0x43f520[_0x0d19('0x30')]=_['keys'](_0x3149ad[_0x0d19('0x30')]);_0x43f520[_0x0d19('0x32')]=_[_0x0d19('0x33')](_0x43f520[_0x0d19('0x2f')],_0x43f520[_0x0d19('0x30')]);_0xc8e820[_0x0d19('0x35')]=_[_0x0d19('0x33')](_0x43f520[_0x0d19('0x2f')],qs[_0x0d19('0x34')](_0x3149ad[_0x0d19('0x30')][_0x0d19('0x34')]));_0xc8e820[_0x0d19('0x35')]=_0xc8e820[_0x0d19('0x35')]['length']?_0xc8e820[_0x0d19('0x35')]:_0x43f520[_0x0d19('0x2f')];_0xc8e820[_0x0d19('0x3b')]=qs[_0x0d19('0x3c')](_0x3149ad[_0x0d19('0x30')][_0x0d19('0x3c')]);_0xc8e820[_0x0d19('0x3d')]=qs[_0x0d19('0x32')](_[_0x0d19('0x3e')](_0x3149ad[_0x0d19('0x30')],_0x43f520[_0x0d19('0x32')]));if(_0x3149ad[_0x0d19('0x30')][_0x0d19('0x3f')]){_0xc8e820[_0x0d19('0x3d')]=_[_0x0d19('0x40')](_0xc8e820[_0x0d19('0x3d')],{'$or':_['map'](_0xc8e820[_0x0d19('0x35')],function(_0x32b612){var _0x46439e={};_0x46439e[_0x32b612]={'$like':'%'+_0x3149ad[_0x0d19('0x30')][_0x0d19('0x3f')]+'%'};return _0x46439e;})});}_0xc8e820=_['merge']({},_0xc8e820,_0x3149ad[_0x0d19('0x42')]);return _0x13cced[_0x0d19('0x88')](_0xc8e820);}})['then'](function(_0x12c656){if(_0x12c656){_0x984a32=_0x12c656['length'];if(!_0x3149ad[_0x0d19('0x30')][_0x0d19('0x37')](_0x0d19('0x38'))){_0xc8e820['limit']=qs[_0x0d19('0x39')](_0x3149ad[_0x0d19('0x30')][_0x0d19('0x39')]);_0xc8e820[_0x0d19('0x3a')]=qs[_0x0d19('0x3a')](_0x3149ad[_0x0d19('0x30')][_0x0d19('0x3a')]);}return _0x13cced[_0x0d19('0x88')](_0xc8e820);}})[_0x0d19('0x23')](function(_0x436358){if(_0x436358){return _0x436358?{'count':_0x984a32,'rows':_0x436358}:null;}})[_0x0d19('0x23')](respondWithResult(_0x23f061,null))['catch'](handleError(_0x23f061,null));}; \ No newline at end of file +var _0x9d8c=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','FaxQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','getMembers','rawAttributes','nolimit','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','transaction','each','findOrCreate','emit','select','tq.TeamId','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','removeAgents','forEach','userFaxQueue:remove','addAgents','userFaxQueue:save','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','get','UserProfileResource','end','stack','name','index','map','FaxQueue','fieldName','type'];(function(_0x4c74d5,_0xd3546){var _0x4e91ef=function(_0x3a3099){while(--_0x3a3099){_0x4c74d5['push'](_0x4c74d5['shift']());}};_0x4e91ef(++_0xd3546);}(_0x9d8c,0x162));var _0xc9d8=function(_0xf06693,_0x2feb84){_0xf06693=_0xf06693-0x0;var _0x4af923=_0x9d8c[_0xf06693];return _0x4af923;};'use strict';var pdf=require(_0xc9d8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc9d8('0x1'));var zipdir=require(_0xc9d8('0x2'));var jsonpatch=require(_0xc9d8('0x3'));var rp=require('request-promise');var moment=require(_0xc9d8('0x4'));var BPromise=require(_0xc9d8('0x5'));var Mustache=require(_0xc9d8('0x6'));var util=require(_0xc9d8('0x7'));var path=require('path');var sox=require(_0xc9d8('0x8'));var csv=require(_0xc9d8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc9d8('0xa'));var squel=require(_0xc9d8('0xb'));var crypto=require(_0xc9d8('0xc'));var jsforce=require(_0xc9d8('0xd'));var deskjs=require(_0xc9d8('0xe'));var toCsv=require(_0xc9d8('0x9'));var querystring=require(_0xc9d8('0xf'));var Papa=require(_0xc9d8('0x10'));var Redis=require(_0xc9d8('0x11'));var authService=require(_0xc9d8('0x12'));var qs=require(_0xc9d8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9d8('0x14'));var logger=require('../../config/logger')(_0xc9d8('0x15'));var utils=require('../../config/utils');var config=require(_0xc9d8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9d8('0x17'))['db'];config[_0xc9d8('0x18')]=_['defaults'](config[_0xc9d8('0x18')],{'host':_0xc9d8('0x19'),'port':0x18eb});var socket=require(_0xc9d8('0x1a'))(new Redis(config[_0xc9d8('0x18')]));require(_0xc9d8('0x1b'))[_0xc9d8('0x1c')](socket);function respondWithStatusCode(_0xa6c244,_0x3edc6c){_0x3edc6c=_0x3edc6c||0xcc;return function(_0x1bd3f6){if(_0x1bd3f6){return _0xa6c244[_0xc9d8('0x1d')](_0x3edc6c);}return _0xa6c244[_0xc9d8('0x1e')](_0x3edc6c)['end']();};}function respondWithResult(_0xc6b652,_0x44613b){_0x44613b=_0x44613b||0xc8;return function(_0x3f6b2a){if(_0x3f6b2a){return _0xc6b652[_0xc9d8('0x1e')](_0x44613b)[_0xc9d8('0x1f')](_0x3f6b2a);}};}function respondWithFilteredResult(_0x1ca29c,_0x10e64c){return function(_0x1b5e8c){if(_0x1b5e8c){var _0x5458d8=_0x1b5e8c[_0xc9d8('0x20')],_0x1d1668=_0x10e64c[_0xc9d8('0x21')],_0x3b6a95=_0x10e64c[_0xc9d8('0x21')]+_0x10e64c[_0xc9d8('0x22')],_0x5c4172;if(_0x3b6a95>=_0x5458d8){_0x3b6a95=_0x5458d8;_0x5c4172=0xc8;}else{_0x5c4172=0xce;}_0x1ca29c[_0xc9d8('0x1e')](_0x5c4172);return _0x1ca29c[_0xc9d8('0x23')]('Content-Range',_0x1d1668+'-'+_0x3b6a95+'/'+_0x5458d8)[_0xc9d8('0x1f')](_0x1b5e8c);}return null;};}function patchUpdates(_0x3f1338){return function(_0x5e30c8){try{jsonpatch[_0xc9d8('0x24')](_0x5e30c8,_0x3f1338,!![]);}catch(_0x294b3d){return BPromise[_0xc9d8('0x25')](_0x294b3d);}return _0x5e30c8[_0xc9d8('0x26')]();};}function saveUpdates(_0x57f4d3,_0x468788){return function(_0x517a1b){if(_0x517a1b){return _0x517a1b[_0xc9d8('0x27')](_0x57f4d3)[_0xc9d8('0x28')](function(_0x56fafb){return _0x56fafb;});}return null;};}function removeEntity(_0x36dd96,_0x26bb4a){return function(_0x3f7282){if(_0x3f7282){return _0x3f7282['destroy']()[_0xc9d8('0x28')](function(){var _0x134988=_0x3f7282[_0xc9d8('0x29')]({'plain':!![]});var _0x2553a9='FaxQueues';return db[_0xc9d8('0x2a')]['destroy']({'where':{'type':_0x2553a9,'resourceId':_0x134988['id']}})[_0xc9d8('0x28')](function(){return _0x3f7282;});})[_0xc9d8('0x28')](function(){_0x36dd96[_0xc9d8('0x1e')](0xcc)[_0xc9d8('0x2b')]();});}};}function handleEntityNotFound(_0x4a737d,_0x483af1){return function(_0x151495){if(!_0x151495){_0x4a737d[_0xc9d8('0x1d')](0x194);}return _0x151495;};}function handleError(_0x3b2a5d,_0x4a564e){_0x4a564e=_0x4a564e||0x1f4;return function(_0x453cd3){logger['error'](_0x453cd3[_0xc9d8('0x2c')]);if(_0x453cd3[_0xc9d8('0x2d')]){delete _0x453cd3[_0xc9d8('0x2d')];}_0x3b2a5d[_0xc9d8('0x1e')](_0x4a564e)['send'](_0x453cd3);};}exports[_0xc9d8('0x2e')]=function(_0x3ac71c,_0x2b702b){var _0x211c58={},_0x3821af={},_0xf8e1d1={'count':0x0,'rows':[]};var _0x32a2f7=_[_0xc9d8('0x2f')](db[_0xc9d8('0x30')]['rawAttributes'],function(_0x42ccfb){return{'name':_0x42ccfb[_0xc9d8('0x31')],'type':_0x42ccfb[_0xc9d8('0x32')][_0xc9d8('0x33')]};});_0x3821af[_0xc9d8('0x34')]=_[_0xc9d8('0x2f')](_0x32a2f7,'name');_0x3821af['query']=_['keys'](_0x3ac71c[_0xc9d8('0x35')]);_0x3821af[_0xc9d8('0x36')]=_[_0xc9d8('0x37')](_0x3821af[_0xc9d8('0x34')],_0x3821af[_0xc9d8('0x35')]);_0x211c58[_0xc9d8('0x38')]=_[_0xc9d8('0x37')](_0x3821af[_0xc9d8('0x34')],qs[_0xc9d8('0x39')](_0x3ac71c[_0xc9d8('0x35')]['fields']));_0x211c58[_0xc9d8('0x38')]=_0x211c58[_0xc9d8('0x38')][_0xc9d8('0x3a')]?_0x211c58[_0xc9d8('0x38')]:_0x3821af['model'];if(!_0x3ac71c[_0xc9d8('0x35')][_0xc9d8('0x3b')]('nolimit')){_0x211c58[_0xc9d8('0x22')]=qs[_0xc9d8('0x22')](_0x3ac71c[_0xc9d8('0x35')]['limit']);_0x211c58[_0xc9d8('0x21')]=qs[_0xc9d8('0x21')](_0x3ac71c[_0xc9d8('0x35')][_0xc9d8('0x21')]);}_0x211c58[_0xc9d8('0x3c')]=qs[_0xc9d8('0x3d')](_0x3ac71c['query']['sort']);_0x211c58[_0xc9d8('0x3e')]=qs[_0xc9d8('0x36')](_[_0xc9d8('0x3f')](_0x3ac71c[_0xc9d8('0x35')],_0x3821af[_0xc9d8('0x36')]),_0x32a2f7);if(_0x3ac71c[_0xc9d8('0x35')][_0xc9d8('0x40')]){_0x211c58[_0xc9d8('0x3e')]=_[_0xc9d8('0x41')](_0x211c58[_0xc9d8('0x3e')],{'$or':_[_0xc9d8('0x2f')](_0x32a2f7,function(_0x49d49b){if(_0x49d49b[_0xc9d8('0x32')]!==_0xc9d8('0x42')){var _0x10b262={};_0x10b262[_0x49d49b[_0xc9d8('0x2d')]]={'$like':'%'+_0x3ac71c[_0xc9d8('0x35')][_0xc9d8('0x40')]+'%'};return _0x10b262;}})});}_0x211c58=_['merge']({},_0x211c58,_0x3ac71c[_0xc9d8('0x43')]);var _0x61b298={'where':_0x211c58[_0xc9d8('0x3e')]};return db[_0xc9d8('0x30')][_0xc9d8('0x20')](_0x61b298)[_0xc9d8('0x28')](function(_0x35a8e){_0xf8e1d1[_0xc9d8('0x20')]=_0x35a8e;if(_0x3ac71c[_0xc9d8('0x35')][_0xc9d8('0x44')]){_0x211c58[_0xc9d8('0x45')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x211c58);})[_0xc9d8('0x28')](function(_0x21a935){_0xf8e1d1[_0xc9d8('0x46')]=_0x21a935;return _0xf8e1d1;})['then'](respondWithFilteredResult(_0x2b702b,_0x211c58))[_0xc9d8('0x47')](handleError(_0x2b702b,null));};exports[_0xc9d8('0x48')]=function(_0x1993a3,_0x4e7290){var _0x158e25={'raw':!![],'where':{'id':_0x1993a3['params']['id']}},_0x344be7={};_0x344be7[_0xc9d8('0x34')]=_[_0xc9d8('0x49')](db[_0xc9d8('0x30')]['rawAttributes']);_0x344be7['query']=_['keys'](_0x1993a3[_0xc9d8('0x35')]);_0x344be7[_0xc9d8('0x36')]=_[_0xc9d8('0x37')](_0x344be7[_0xc9d8('0x34')],_0x344be7[_0xc9d8('0x35')]);_0x158e25[_0xc9d8('0x38')]=_[_0xc9d8('0x37')](_0x344be7[_0xc9d8('0x34')],qs[_0xc9d8('0x39')](_0x1993a3[_0xc9d8('0x35')]['fields']));_0x158e25[_0xc9d8('0x38')]=_0x158e25[_0xc9d8('0x38')][_0xc9d8('0x3a')]?_0x158e25[_0xc9d8('0x38')]:_0x344be7[_0xc9d8('0x34')];if(_0x1993a3[_0xc9d8('0x35')][_0xc9d8('0x44')]){_0x158e25[_0xc9d8('0x45')]=[{'all':!![]}];}_0x158e25=_[_0xc9d8('0x41')]({},_0x158e25,_0x1993a3[_0xc9d8('0x43')]);return db[_0xc9d8('0x30')][_0xc9d8('0x4a')](_0x158e25)['then'](handleEntityNotFound(_0x4e7290,null))[_0xc9d8('0x28')](respondWithResult(_0x4e7290,null))['catch'](handleError(_0x4e7290,null));};exports['create']=function(_0xe3af5c,_0x34d004){return db[_0xc9d8('0x30')][_0xc9d8('0x4b')](_0xe3af5c[_0xc9d8('0x4c')],{})[_0xc9d8('0x28')](function(_0x16777c){var _0x3a01a3=_0xe3af5c['user'][_0xc9d8('0x29')]({'plain':!![]});if(!_0x3a01a3)throw new Error(_0xc9d8('0x4d'));if(_0x3a01a3['role']===_0xc9d8('0x4e')){var _0x4f4dd1=_0x16777c['get']({'plain':!![]});var _0x1db555=_0xc9d8('0x4f');return db[_0xc9d8('0x50')][_0xc9d8('0x4a')]({'where':{'name':_0x1db555,'userProfileId':_0x3a01a3['userProfileId']},'raw':!![]})[_0xc9d8('0x28')](function(_0x28da75){if(_0x28da75&&_0x28da75[_0xc9d8('0x51')]===0x0){return db['UserProfileResource'][_0xc9d8('0x4b')]({'name':_0x4f4dd1['name'],'resourceId':_0x4f4dd1['id'],'type':_0x28da75[_0xc9d8('0x2d')],'sectionId':_0x28da75['id']},{})['then'](function(){return _0x16777c;});}else{return _0x16777c;}})['catch'](function(_0x49a00c){logger['error'](_0xc9d8('0x52'),_0x49a00c);throw _0x49a00c;});}return _0x16777c;})[_0xc9d8('0x28')](respondWithResult(_0x34d004,0xc9))[_0xc9d8('0x47')](handleError(_0x34d004,null));};exports['update']=function(_0x4124c8,_0x5f3ebb){if(_0x4124c8[_0xc9d8('0x4c')]['id']){delete _0x4124c8[_0xc9d8('0x4c')]['id'];}return db[_0xc9d8('0x30')][_0xc9d8('0x4a')]({'where':{'id':_0x4124c8[_0xc9d8('0x53')]['id']}})[_0xc9d8('0x28')](handleEntityNotFound(_0x5f3ebb,null))[_0xc9d8('0x28')](saveUpdates(_0x4124c8[_0xc9d8('0x4c')],null))[_0xc9d8('0x28')](respondWithResult(_0x5f3ebb,null))[_0xc9d8('0x47')](handleError(_0x5f3ebb,null));};exports[_0xc9d8('0x54')]=function(_0x4ea11f,_0x1abf54){return db[_0xc9d8('0x30')][_0xc9d8('0x4a')]({'where':{'id':_0x4ea11f['params']['id']}})[_0xc9d8('0x28')](handleEntityNotFound(_0x1abf54,null))[_0xc9d8('0x28')](removeEntity(_0x1abf54,null))[_0xc9d8('0x47')](handleError(_0x1abf54,null));};exports[_0xc9d8('0x55')]=function(_0x4248a4,_0x4a3b4f){return db['FaxQueue'][_0xc9d8('0x55')]()['then'](respondWithResult(_0x4a3b4f,null))[_0xc9d8('0x47')](handleError(_0x4a3b4f,null));};exports[_0xc9d8('0x56')]=function(_0x29a03c,_0xfe8abb,_0x51051d){var _0x4c6653={'raw':!![],'where':{}},_0x1bb359={},_0x388c15;return db[_0xc9d8('0x30')]['findOne']({'where':{'id':_0x29a03c[_0xc9d8('0x53')]['id']}})[_0xc9d8('0x28')](handleEntityNotFound(_0xfe8abb,null))[_0xc9d8('0x28')](function(_0x1cfa0e){if(_0x1cfa0e){_0x388c15=_0x1cfa0e[_0xc9d8('0x29')]({'plain':!![]});_0x1bb359[_0xc9d8('0x34')]=_[_0xc9d8('0x49')](db['UserFaxQueue'][_0xc9d8('0x57')]);_0x1bb359[_0xc9d8('0x35')]=_[_0xc9d8('0x49')](_0x29a03c[_0xc9d8('0x35')]);_0x1bb359['filters']=_[_0xc9d8('0x37')](_0x1bb359[_0xc9d8('0x34')],_0x1bb359[_0xc9d8('0x35')]);_0x4c6653[_0xc9d8('0x38')]=_[_0xc9d8('0x37')](_0x1bb359[_0xc9d8('0x34')],qs['fields'](_0x29a03c['query'][_0xc9d8('0x39')]));_0x4c6653[_0xc9d8('0x38')]=_0x4c6653['attributes'][_0xc9d8('0x3a')]?_0x4c6653[_0xc9d8('0x38')]:_0x1bb359['model'];if(!_0x29a03c[_0xc9d8('0x35')][_0xc9d8('0x3b')](_0xc9d8('0x58'))){_0x4c6653[_0xc9d8('0x22')]=qs['limit'](_0x29a03c['query']['limit']);_0x4c6653[_0xc9d8('0x21')]=qs[_0xc9d8('0x21')](_0x29a03c[_0xc9d8('0x35')][_0xc9d8('0x21')]);}_0x4c6653[_0xc9d8('0x3c')]=qs[_0xc9d8('0x3d')](_0x29a03c[_0xc9d8('0x35')][_0xc9d8('0x3d')]);_0x4c6653[_0xc9d8('0x3e')]=qs['filters'](_[_0xc9d8('0x3f')](_0x29a03c['query'],_0x1bb359[_0xc9d8('0x36')]));_0x4c6653['where']['FaxQueueId']=_0x1cfa0e['id'];if(_0x29a03c[_0xc9d8('0x35')][_0xc9d8('0x40')]){_0x4c6653[_0xc9d8('0x3e')]=_['merge'](_0x4c6653[_0xc9d8('0x3e')],{'$or':_[_0xc9d8('0x2f')](_0x4c6653['attributes'],function(_0x4bab00){var _0x557039={};_0x557039[_0x4bab00]={'$like':'%'+_0x29a03c['query'][_0xc9d8('0x40')]+'%'};return _0x557039;})});}_0x4c6653=_[_0xc9d8('0x41')]({},_0x4c6653,_0x29a03c['options']);return db['UserFaxQueue'][_0xc9d8('0x59')](_0x4c6653);}})['then'](function(_0x4b60d8){if(_0x4b60d8){return db[_0xc9d8('0x5a')][_0xc9d8('0x5b')]({'where':{'id':_[_0xc9d8('0x2f')](_0x4b60d8,_0xc9d8('0x5c')),'role':_0xc9d8('0x5d')},'attributes':['id',_0xc9d8('0x2d'),_0xc9d8('0x5e'),_0xc9d8('0x5f'),_0xc9d8('0x60')]});}})[_0xc9d8('0x28')](function(_0x23bef5){if(_0x23bef5){return{'count':_0x23bef5['count'],'rows':_[_0xc9d8('0x2f')](_0x23bef5['rows'],function(_0x3132e6){return{'membername':_0x3132e6['name'],'UserId':_0x3132e6['id'],'queue_name':_0x388c15[_0xc9d8('0x2d')],'FaxQueueId':_0x388c15['id'],'interface':util['format'](_0xc9d8('0x61'),_0xc9d8('0x62'),_0x3132e6[_0xc9d8('0x2d')]),'penalty':0x0,'paused':_0x3132e6[_0xc9d8('0x5e')],'createdAt':_0x3132e6['createdAt'],'updatedAt':_0x3132e6[_0xc9d8('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc9d8('0x28')](respondWithFilteredResult(_0xfe8abb,_0x4c6653))[_0xc9d8('0x47')](handleError(_0xfe8abb,null));};exports['getTeams']=function(_0x55249a,_0x4f03b4,_0x4b0eb4){var _0x50972d={};var _0x3a4b26={};var _0x172cbf;var _0x3c9cbb;return db[_0xc9d8('0x30')][_0xc9d8('0x63')]({'where':{'id':_0x55249a[_0xc9d8('0x53')]['id']}})[_0xc9d8('0x28')](handleEntityNotFound(_0x4f03b4,null))['then'](function(_0x1f0e6a){if(_0x1f0e6a){_0x172cbf=_0x1f0e6a;_0x3a4b26[_0xc9d8('0x34')]=_[_0xc9d8('0x49')](db[_0xc9d8('0x64')][_0xc9d8('0x57')]);_0x3a4b26[_0xc9d8('0x35')]=_[_0xc9d8('0x49')](_0x55249a[_0xc9d8('0x35')]);_0x3a4b26['filters']=_[_0xc9d8('0x37')](_0x3a4b26[_0xc9d8('0x34')],_0x3a4b26['query']);_0x50972d[_0xc9d8('0x38')]=_[_0xc9d8('0x37')](_0x3a4b26[_0xc9d8('0x34')],qs[_0xc9d8('0x39')](_0x55249a[_0xc9d8('0x35')][_0xc9d8('0x39')]));_0x50972d[_0xc9d8('0x38')]=_0x50972d[_0xc9d8('0x38')][_0xc9d8('0x3a')]?_0x50972d[_0xc9d8('0x38')]:_0x3a4b26[_0xc9d8('0x34')];_0x50972d[_0xc9d8('0x3c')]=qs['sort'](_0x55249a['query']['sort']);_0x50972d['where']=qs[_0xc9d8('0x36')](_['pick'](_0x55249a['query'],_0x3a4b26['filters']));if(_0x55249a['query'][_0xc9d8('0x40')]){_0x50972d[_0xc9d8('0x3e')]=_['merge'](_0x50972d['where'],{'$or':_[_0xc9d8('0x2f')](_0x50972d[_0xc9d8('0x38')],function(_0x301976){var _0x3683ab={};_0x3683ab[_0x301976]={'$like':'%'+_0x55249a['query']['filter']+'%'};return _0x3683ab;})});}_0x50972d=_[_0xc9d8('0x41')]({},_0x50972d,_0x55249a['options']);return _0x172cbf[_0xc9d8('0x65')](_0x50972d);}})[_0xc9d8('0x28')](function(_0x4133d4){if(_0x4133d4){_0x3c9cbb=_0x4133d4['length'];if(!_0x55249a['query']['hasOwnProperty']('nolimit')){_0x50972d['limit']=qs['limit'](_0x55249a[_0xc9d8('0x35')][_0xc9d8('0x22')]);_0x50972d[_0xc9d8('0x21')]=qs[_0xc9d8('0x21')](_0x55249a[_0xc9d8('0x35')][_0xc9d8('0x21')]);}return _0x172cbf[_0xc9d8('0x65')](_0x50972d);}})[_0xc9d8('0x28')](function(_0x3a6aa8){if(_0x3a6aa8){return _0x3a6aa8?{'count':_0x3c9cbb,'rows':_0x3a6aa8}:null;}})['then'](respondWithResult(_0x4f03b4,null))[_0xc9d8('0x47')](handleError(_0x4f03b4,null));};exports[_0xc9d8('0x66')]=function(_0x185fa6,_0x127bdd,_0xaa0537){var _0x3b49ab=_0x185fa6['body'][_0xc9d8('0x67')];return db['Team']['findAll']({'where':{'id':_0x3b49ab},'attributes':['id'],'include':[{'model':db[_0xc9d8('0x5a')],'as':_0xc9d8('0x68'),'attributes':['id',_0xc9d8('0x2d'),_0xc9d8('0x69'),_0xc9d8('0x6a'),_0xc9d8('0x6b')],'raw':!![]}]})['then'](function(_0xa4cf5e){if(_0xa4cf5e){var _0x570751=_['flatMap'](_0xa4cf5e,function(_0x312e71){var _0x3378ad=_0x312e71[_0xc9d8('0x29')]({'plain':!![]});return _0x3378ad[_0xc9d8('0x68')];});return db[_0xc9d8('0x30')][_0xc9d8('0x4a')]({'where':{'id':_0x185fa6[_0xc9d8('0x53')]['id']}})[_0xc9d8('0x28')](function(_0x7ee8ed){return db['sequelize'][_0xc9d8('0x6c')](function(_0x5a9ec7){return _0x7ee8ed['addTeams'](_0x3b49ab,{'transaction':_0x5a9ec7})['then'](function(){return BPromise[_0xc9d8('0x6d')](_0x570751,function(_0x4b9c14){return db['UserFaxQueue'][_0xc9d8('0x6e')]({'where':{'UserId':_0x4b9c14['id'],'FaxQueueId':_0x185fa6[_0xc9d8('0x53')]['id']},'transaction':_0x5a9ec7});});})['then'](function(){_0x570751['forEach'](function(_0x16c65e){socket[_0xc9d8('0x6f')]('userFaxQueue:save',{'UserId':_0x16c65e['id'],'FaxQueueId':_0x7ee8ed['id']});});});});});}})['then'](respondWithStatusCode(_0x127bdd,null))[_0xc9d8('0x47')](handleError(_0x127bdd,null));};exports['removeTeams']=function(_0x1f6279,_0xf61e86,_0x5a87eb){return db[_0xc9d8('0x64')][_0xc9d8('0x59')]({'where':{'id':_0x1f6279[_0xc9d8('0x35')][_0xc9d8('0x67')]},'attributes':['id'],'include':[{'model':db[_0xc9d8('0x5a')],'as':_0xc9d8('0x68'),'attributes':['id'],'raw':!![]}]})[_0xc9d8('0x28')](handleEntityNotFound(_0xf61e86,null))[_0xc9d8('0x28')](function(_0x38f41d){var _0xcb5ddd=_[_0xc9d8('0x2f')](_0x38f41d,'id');var _0x4b4085=[];var _0x492b46=[];var _0x1fb149=squel[_0xc9d8('0x70')]();_0x1fb149['field'](_0xc9d8('0x71'))[_0xc9d8('0x72')](_0xc9d8('0x73'),'tq')[_0xc9d8('0x74')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc9d8('0x3e')](_0xc9d8('0x75'),_0x1f6279[_0xc9d8('0x53')]['id']);for(var _0x595b4c=0x0;_0x595b4c<_0x38f41d[_0xc9d8('0x3a')];_0x595b4c+=0x1){let _0x543630=_0x38f41d[_0x595b4c];for(var _0x445702=0x0;_0x445702<_0x543630[_0xc9d8('0x68')][_0xc9d8('0x3a')];_0x445702+=0x1){let _0x554d5d=_0x543630[_0xc9d8('0x68')][_0x445702];var _0x30764a=_0x1fb149[_0xc9d8('0x76')]();_0x30764a[_0xc9d8('0x3e')](_0xc9d8('0x77'),_0x554d5d['id']);_0x492b46['push'](db[_0xc9d8('0x78')][_0xc9d8('0x35')](_0x30764a[_0xc9d8('0x79')](),{'type':db[_0xc9d8('0x78')][_0xc9d8('0x7a')][_0xc9d8('0x7b')]})['then'](function(_0x20bed4){if(_0x20bed4[_0xc9d8('0x3a')]===0x1){return _0x554d5d['id'];}else{var _0x29ff0b=_[_0xc9d8('0x7c')](_[_0xc9d8('0x2f')](_0x20bed4,_0xc9d8('0x7d')),function(_0xd33dde){return _[_0xc9d8('0x7e')](_0xcb5ddd,_0xd33dde);});if(_0x29ff0b){return _0x554d5d['id'];}}}));}}return BPromise[_0xc9d8('0x7f')](_0x492b46)[_0xc9d8('0x28')](function(_0xf4c3df){_0x4b4085=_(_0x4b4085)['union'](_0xf4c3df)['compact']()['value']();return db[_0xc9d8('0x30')][_0xc9d8('0x4a')]({'where':{'id':_0x1f6279[_0xc9d8('0x53')]['id']}})[_0xc9d8('0x28')](function(_0x1bd4ca){return db['sequelize']['transaction'](function(_0xacb76e){return _0x1bd4ca[_0xc9d8('0x80')](_0x1f6279['query']['ids'],{'transaction':_0xacb76e})['then'](function(){if(!_['isEmpty'](_0x4b4085)){return _0x1bd4ca[_0xc9d8('0x81')](_0x4b4085,{'transaction':_0xacb76e});}})['then'](function(){_0x4b4085[_0xc9d8('0x82')](function(_0x438456){socket[_0xc9d8('0x6f')](_0xc9d8('0x83'),{'UserId':_0x438456,'FaxQueueId':_0x1bd4ca['id']});});});});});});})[_0xc9d8('0x28')](respondWithStatusCode(_0xf61e86,null))[_0xc9d8('0x47')](handleError(_0xf61e86,null));};exports[_0xc9d8('0x84')]=function(_0x5636e1,_0x16da7d,_0x1b2ee4){return db[_0xc9d8('0x30')][_0xc9d8('0x4a')]({'where':{'id':_0x5636e1[_0xc9d8('0x53')]['id']}})[_0xc9d8('0x28')](handleEntityNotFound(_0x16da7d,null))['then'](function(_0x1c6d1f){if(_0x1c6d1f){return _0x1c6d1f[_0xc9d8('0x84')](_0x5636e1['body']['ids'],_['omit'](_0x5636e1[_0xc9d8('0x4c')],[_0xc9d8('0x67'),'id'])||{})['spread'](function(_0x2e3cc9){for(var _0x50fd27=0x0;_0x50fd27<_0x5636e1[_0xc9d8('0x4c')][_0xc9d8('0x67')][_0xc9d8('0x3a')];_0x50fd27+=0x1){socket[_0xc9d8('0x6f')](_0xc9d8('0x85'),{'UserId':_0x5636e1['body'][_0xc9d8('0x67')][_0x50fd27],'FaxQueueId':_0x5636e1['params']['id']});}return _0x2e3cc9;});}})[_0xc9d8('0x28')](respondWithResult(_0x16da7d,null))['catch'](handleError(_0x16da7d,null));};exports[_0xc9d8('0x81')]=function(_0x304372,_0x5cf5d3,_0x205ff7){return db[_0xc9d8('0x30')][_0xc9d8('0x4a')]({'where':{'id':_0x304372[_0xc9d8('0x53')]['id']}})[_0xc9d8('0x28')](handleEntityNotFound(_0x5cf5d3,null))[_0xc9d8('0x28')](function(_0x7bb89e){if(_0x7bb89e){return _0x7bb89e[_0xc9d8('0x81')](_0x304372['query'][_0xc9d8('0x67')])['then'](function(){if(_['isArray'](_0x304372[_0xc9d8('0x35')][_0xc9d8('0x67')])){for(var _0x1ef3c9=0x0;_0x1ef3c9<_0x304372[_0xc9d8('0x35')][_0xc9d8('0x67')][_0xc9d8('0x3a')];_0x1ef3c9+=0x1){socket[_0xc9d8('0x6f')](_0xc9d8('0x83'),{'UserId':Number(_0x304372[_0xc9d8('0x35')][_0xc9d8('0x67')][_0x1ef3c9]),'FaxQueueId':Number(_0x304372[_0xc9d8('0x53')]['id'])});}}else{socket['emit'](_0xc9d8('0x83'),{'UserId':Number(_0x304372[_0xc9d8('0x35')][_0xc9d8('0x67')]),'FaxQueueId':Number(_0x304372[_0xc9d8('0x53')]['id'])});}});}})[_0xc9d8('0x28')](respondWithStatusCode(_0x5cf5d3,null))[_0xc9d8('0x47')](handleError(_0x5cf5d3,null));};exports[_0xc9d8('0x86')]=function(_0x179810,_0x36a171,_0x45ae46){var _0xfa60f4={};var _0x3b3fc3={};var _0x2d9c6a;var _0x2819dd;return db[_0xc9d8('0x30')]['findOne']({'where':{'id':_0x179810[_0xc9d8('0x53')]['id']}})['then'](handleEntityNotFound(_0x36a171,null))[_0xc9d8('0x28')](function(_0x2aa3f2){if(_0x2aa3f2){_0x2d9c6a=_0x2aa3f2;_0x3b3fc3[_0xc9d8('0x34')]=_[_0xc9d8('0x49')](db['User'][_0xc9d8('0x57')]);_0x3b3fc3[_0xc9d8('0x35')]=_['keys'](_0x179810['query']);_0x3b3fc3[_0xc9d8('0x36')]=_['intersection'](_0x3b3fc3['model'],_0x3b3fc3[_0xc9d8('0x35')]);_0xfa60f4[_0xc9d8('0x38')]=_[_0xc9d8('0x37')](_0x3b3fc3['model'],qs[_0xc9d8('0x39')](_0x179810[_0xc9d8('0x35')]['fields']));_0xfa60f4[_0xc9d8('0x38')]=_0xfa60f4[_0xc9d8('0x38')]['length']?_0xfa60f4[_0xc9d8('0x38')]:_0x3b3fc3['model'];_0xfa60f4['order']=qs[_0xc9d8('0x3d')](_0x179810[_0xc9d8('0x35')][_0xc9d8('0x3d')]);_0xfa60f4[_0xc9d8('0x3e')]=qs[_0xc9d8('0x36')](_[_0xc9d8('0x3f')](_0x179810[_0xc9d8('0x35')],_0x3b3fc3[_0xc9d8('0x36')]));if(_0x179810[_0xc9d8('0x35')][_0xc9d8('0x40')]){_0xfa60f4[_0xc9d8('0x3e')]=_['merge'](_0xfa60f4['where'],{'$or':_[_0xc9d8('0x2f')](_0xfa60f4[_0xc9d8('0x38')],function(_0x34aa9f){var _0x222a3f={};_0x222a3f[_0x34aa9f]={'$like':'%'+_0x179810[_0xc9d8('0x35')][_0xc9d8('0x40')]+'%'};return _0x222a3f;})});}_0xfa60f4=_[_0xc9d8('0x41')]({},_0xfa60f4,_0x179810[_0xc9d8('0x43')]);return _0x2d9c6a[_0xc9d8('0x86')](_0xfa60f4);}})['then'](function(_0x5f3a3c){if(_0x5f3a3c){_0x2819dd=_0x5f3a3c['length'];if(!_0x179810[_0xc9d8('0x35')][_0xc9d8('0x3b')](_0xc9d8('0x58'))){_0xfa60f4[_0xc9d8('0x22')]=qs[_0xc9d8('0x22')](_0x179810['query'][_0xc9d8('0x22')]);_0xfa60f4[_0xc9d8('0x21')]=qs[_0xc9d8('0x21')](_0x179810[_0xc9d8('0x35')]['offset']);}return _0x2d9c6a[_0xc9d8('0x86')](_0xfa60f4);}})[_0xc9d8('0x28')](function(_0x3b31ff){if(_0x3b31ff){return _0x3b31ff?{'count':_0x2819dd,'rows':_0x3b31ff}:null;}})['then'](respondWithResult(_0x36a171,null))['catch'](handleError(_0x36a171,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 4f64d17..e7d3bfc 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 _0xada9=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x28c6c3,_0x54a4c9){var _0x40cc55=function(_0x69c11d){while(--_0x69c11d){_0x28c6c3['push'](_0x28c6c3['shift']());}};_0x40cc55(++_0x54a4c9);}(_0xada9,0x154));var _0x9ada=function(_0x21c637,_0x91cd3d){_0x21c637=_0x21c637-0x0;var _0x3fa42d=_0xada9[_0x21c637];return _0x3fa42d;};'use strict';var EventEmitter=require(_0x9ada('0x0'));var FaxQueue=require(_0x9ada('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9ada('0x2')](0x0);var events={'afterCreate':_0x9ada('0x3'),'afterUpdate':'update','afterDestroy':_0x9ada('0x4')};function emitEvent(_0xf44d33){return function(_0x2e4692,_0x178dac,_0x4919df){FaxQueueEvents[_0x9ada('0x5')](_0xf44d33+':'+_0x2e4692['id'],_0x2e4692);FaxQueueEvents[_0x9ada('0x5')](_0xf44d33,_0x2e4692);_0x4919df(null);};}for(var e in events){if(events[_0x9ada('0x6')](e)){var event=events[e];FaxQueue[_0x9ada('0x7')](e,emitEvent(event));}}module[_0x9ada('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x86a8=['events','../../mysqldb','FaxQueue','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1a0d3b,_0x47f7e0){var _0x31fca3=function(_0x4b6006){while(--_0x4b6006){_0x1a0d3b['push'](_0x1a0d3b['shift']());}};_0x31fca3(++_0x47f7e0);}(_0x86a8,0x1c2));var _0x886a=function(_0x3680b9,_0x268877){_0x3680b9=_0x3680b9-0x0;var _0x401f23=_0x86a8[_0x3680b9];return _0x401f23;};'use strict';var EventEmitter=require(_0x886a('0x0'));var FaxQueue=require(_0x886a('0x1'))['db'][_0x886a('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x886a('0x3'),'afterUpdate':_0x886a('0x4'),'afterDestroy':_0x886a('0x5')};function emitEvent(_0x2cadba){return function(_0x14821d,_0x534143,_0x316f69){FaxQueueEvents['emit'](_0x2cadba+':'+_0x14821d['id'],_0x14821d);FaxQueueEvents[_0x886a('0x6')](_0x2cadba,_0x14821d);_0x316f69(null);};}for(var e in events){if(events[_0x886a('0x7')](e)){var event=events[e];FaxQueue[_0x886a('0x8')](e,emitEvent(event));}}module[_0x886a('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 0445b02..b389613 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 _0xc389=['../../config/logger','api','request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xc389,0x18b));var _0x9c38=function(_0x18c9ab,_0x6ba7e7){_0x18c9ab=_0x18c9ab-0x0;var _0x17fc37=_0xc389[_0x18c9ab];return _0x17fc37;};'use strict';var _=require(_0x9c38('0x0'));var util=require('util');var logger=require(_0x9c38('0x1'))(_0x9c38('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9c38('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c38('0x4'));var config=require(_0x9c38('0x5'));var attributes=require(_0x9c38('0x6'));module[_0x9c38('0x7')]=function(_0x4a93ec,_0x1d27c3){return _0x4a93ec[_0x9c38('0x8')](_0x9c38('0x9'),attributes,{'tableName':_0x9c38('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8aa1=['exports','define','FaxQueue','fax_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes'];(function(_0xe25378,_0x4994da){var _0x37e91=function(_0x241a87){while(--_0x241a87){_0xe25378['push'](_0xe25378['shift']());}};_0x37e91(++_0x4994da);}(_0x8aa1,0x1b1));var _0x18aa=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x8aa1[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x18aa('0x0'));var util=require(_0x18aa('0x1'));var logger=require('../../config/logger')(_0x18aa('0x2'));var moment=require(_0x18aa('0x3'));var BPromise=require(_0x18aa('0x4'));var rp=require(_0x18aa('0x5'));var fs=require('fs');var path=require(_0x18aa('0x6'));var rimraf=require(_0x18aa('0x7'));var config=require('../../config/environment');var attributes=require(_0x18aa('0x8'));module[_0x18aa('0x9')]=function(_0x2b84cb,_0xba1adc){return _0x2b84cb[_0x18aa('0xa')](_0x18aa('0xb'),attributes,{'tableName':_0x18aa('0xc'),'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 15314e7..657668f 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 _0x9735=['include','find','map','ShowFaxQueue','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','model','attributes'];(function(_0x1b7b78,_0x2ae082){var _0x13f9e2=function(_0x571399){while(--_0x571399){_0x1b7b78['push'](_0x1b7b78['shift']());}};_0x13f9e2(++_0x2ae082);}(_0x9735,0x18a));var _0x5973=function(_0x29dfcb,_0x4775e7){_0x29dfcb=_0x29dfcb-0x0;var _0x301d44=_0x9735[_0x29dfcb];return _0x301d44;};'use strict';var _=require(_0x5973('0x0'));var util=require('util');var moment=require(_0x5973('0x1'));var BPromise=require(_0x5973('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5973('0x3'));var db=require(_0x5973('0x4'))['db'];var utils=require(_0x5973('0x5'));var logger=require(_0x5973('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5973('0x7'));var client=jayson[_0x5973('0x8')][_0x5973('0x9')]({'port':0x232a});config[_0x5973('0xa')]=_[_0x5973('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5973('0xc'))(new Redis(config[_0x5973('0xa')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x21a539,_0x13ea7a,_0x1c1920){return new BPromise(function(_0x42ba63,_0x5bce85){return client[_0x5973('0xd')](_0x21a539,_0x1c1920)[_0x5973('0xe')](function(_0x560b05){logger[_0x5973('0xf')](_0x5973('0x10'),_0x13ea7a,_0x5973('0x11'));logger[_0x5973('0x12')](_0x5973('0x13'),_0x13ea7a,'request\x20sent',JSON[_0x5973('0x14')](_0x560b05));if(_0x560b05['error']){if(_0x560b05[_0x5973('0x15')][_0x5973('0x16')]===0x1f4){logger[_0x5973('0x15')](_0x5973('0x10'),_0x13ea7a,_0x560b05['error'][_0x5973('0x17')]);return _0x5bce85(_0x560b05['error'][_0x5973('0x17')]);}logger[_0x5973('0x15')]('FaxQueue,\x20%s,\x20%s',_0x13ea7a,_0x560b05[_0x5973('0x15')][_0x5973('0x17')]);return _0x42ba63(_0x560b05[_0x5973('0x15')]['message']);}else{logger[_0x5973('0xf')]('FaxQueue,\x20%s,\x20%s',_0x13ea7a,'request\x20sent');_0x42ba63(_0x560b05[_0x5973('0x18')][_0x5973('0x17')]);}})[_0x5973('0x19')](function(_0x12fa8){logger['error'](_0x5973('0x10'),_0x13ea7a,_0x12fa8);_0x5bce85(_0x12fa8);});});}exports[_0x5973('0x1a')]=function(_0x2b0bf0){var _0x4f7509=this;return new Promise(function(_0x41fd16,_0x14daa5){return db[_0x5973('0x1b')][_0x5973('0x1c')]({'raw':_0x2b0bf0[_0x5973('0x1d')]?_0x2b0bf0[_0x5973('0x1d')][_0x5973('0x1e')]===undefined?!![]:![]:!![],'where':_0x2b0bf0[_0x5973('0x1d')]?_0x2b0bf0[_0x5973('0x1d')][_0x5973('0x1f')]||null:null,'attributes':_0x2b0bf0[_0x5973('0x1d')]?_0x2b0bf0[_0x5973('0x1d')]['attributes']||null:null,'limit':_0x2b0bf0['options']?_0x2b0bf0[_0x5973('0x1d')][_0x5973('0x20')]||null:null,'include':_0x2b0bf0[_0x5973('0x1d')]?_0x2b0bf0['options']['include']?_['map'](_0x2b0bf0[_0x5973('0x1d')]['include'],function(_0x2e69ba){return{'model':db[_0x2e69ba[_0x5973('0x21')]],'as':_0x2e69ba['as'],'attributes':_0x2e69ba[_0x5973('0x22')],'include':_0x2e69ba[_0x5973('0x23')]?_['map'](_0x2e69ba[_0x5973('0x23')],function(_0x10dfa){return{'model':db[_0x10dfa[_0x5973('0x21')]],'as':_0x10dfa['as'],'attributes':_0x10dfa[_0x5973('0x22')],'include':_0x10dfa[_0x5973('0x23')]?_['map'](_0x10dfa[_0x5973('0x23')],function(_0x599a9e){return{'model':db[_0x599a9e[_0x5973('0x21')]],'as':_0x599a9e['as'],'attributes':_0x599a9e[_0x5973('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5973('0xe')](function(_0x1ce454){logger[_0x5973('0xf')](_0x5973('0x1a'),_0x2b0bf0);logger['debug'](_0x5973('0x1a'),_0x2b0bf0,JSON['stringify'](_0x1ce454));_0x41fd16(_0x1ce454);})[_0x5973('0x19')](function(_0x1b3069){logger[_0x5973('0x15')](_0x5973('0x1a'),_0x1b3069[_0x5973('0x17')],_0x2b0bf0);_0x14daa5(_0x4f7509['error'](0x1f4,_0x1b3069[_0x5973('0x17')]));});});};exports['ShowFaxQueue']=function(_0x27e244){var _0x571988=this;return new Promise(function(_0x13d763,_0x382918){return db[_0x5973('0x1b')][_0x5973('0x24')]({'raw':_0x27e244['options']?_0x27e244[_0x5973('0x1d')][_0x5973('0x1e')]===undefined?!![]:![]:!![],'where':_0x27e244[_0x5973('0x1d')]?_0x27e244['options'][_0x5973('0x1f')]||null:null,'attributes':_0x27e244[_0x5973('0x1d')]?_0x27e244[_0x5973('0x1d')][_0x5973('0x22')]||null:null,'include':_0x27e244['options']?_0x27e244[_0x5973('0x1d')][_0x5973('0x23')]?_[_0x5973('0x25')](_0x27e244[_0x5973('0x1d')][_0x5973('0x23')],function(_0xb6ef1b){return{'model':db[_0xb6ef1b[_0x5973('0x21')]],'as':_0xb6ef1b['as'],'attributes':_0xb6ef1b[_0x5973('0x22')],'include':_0xb6ef1b[_0x5973('0x23')]?_[_0x5973('0x25')](_0xb6ef1b[_0x5973('0x23')],function(_0x2a7583){return{'model':db[_0x2a7583[_0x5973('0x21')]],'as':_0x2a7583['as'],'attributes':_0x2a7583[_0x5973('0x22')],'include':_0x2a7583['include']?_['map'](_0x2a7583[_0x5973('0x23')],function(_0x2238b4){return{'model':db[_0x2238b4[_0x5973('0x21')]],'as':_0x2238b4['as'],'attributes':_0x2238b4[_0x5973('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5973('0xe')](function(_0x3693e6){logger['info'](_0x5973('0x26'),_0x27e244);logger['debug'](_0x5973('0x26'),_0x27e244,JSON[_0x5973('0x14')](_0x3693e6));_0x13d763(_0x3693e6);})['catch'](function(_0x13fb69){logger[_0x5973('0x15')]('ShowFaxQueue',_0x13fb69[_0x5973('0x17')],_0x27e244);_0x382918(_0x571988[_0x5973('0x15')](0x1f4,_0x13fb69[_0x5973('0x17')]));});});}; \ No newline at end of file +var _0xcefd=['redis','defaults','localhost','socket.io-emitter','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','limit','include','map','model','attributes','then','find','ShowFaxQueue','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0x2478b6,_0x7c8ebd){var _0x23056a=function(_0x57deb3){while(--_0x57deb3){_0x2478b6['push'](_0x2478b6['shift']());}};_0x23056a(++_0x7c8ebd);}(_0xcefd,0xa4));var _0xdcef=function(_0x3d43ce,_0x433f16){_0x3d43ce=_0x3d43ce-0x0;var _0x5069e8=_0xcefd[_0x3d43ce];return _0x5069e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcef('0x0'));var db=require(_0xdcef('0x1'))['db'];var utils=require(_0xdcef('0x2'));var logger=require('../../config/logger')(_0xdcef('0x3'));var config=require(_0xdcef('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdcef('0x5')]({'port':0x232a});config[_0xdcef('0x6')]=_[_0xdcef('0x7')](config[_0xdcef('0x6')],{'host':_0xdcef('0x8'),'port':0x18eb});var socket=require(_0xdcef('0x9'))(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x38051e,_0x455750,_0x351bfb){return new BPromise(function(_0x97bf79,_0x56dbcd){return client[_0xdcef('0xa')](_0x38051e,_0x351bfb)['then'](function(_0x4d0175){logger[_0xdcef('0xb')](_0xdcef('0xc'),_0x455750,_0xdcef('0xd'));logger[_0xdcef('0xe')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x455750,_0xdcef('0xd'),JSON[_0xdcef('0xf')](_0x4d0175));if(_0x4d0175[_0xdcef('0x10')]){if(_0x4d0175['error'][_0xdcef('0x11')]===0x1f4){logger[_0xdcef('0x10')](_0xdcef('0xc'),_0x455750,_0x4d0175[_0xdcef('0x10')][_0xdcef('0x12')]);return _0x56dbcd(_0x4d0175[_0xdcef('0x10')][_0xdcef('0x12')]);}logger['error'](_0xdcef('0xc'),_0x455750,_0x4d0175['error'][_0xdcef('0x12')]);return _0x97bf79(_0x4d0175['error'][_0xdcef('0x12')]);}else{logger['info'](_0xdcef('0xc'),_0x455750,_0xdcef('0xd'));_0x97bf79(_0x4d0175[_0xdcef('0x13')][_0xdcef('0x12')]);}})[_0xdcef('0x14')](function(_0x351cf4){logger[_0xdcef('0x10')](_0xdcef('0xc'),_0x455750,_0x351cf4);_0x56dbcd(_0x351cf4);});});}exports[_0xdcef('0x15')]=function(_0x3aa4fa){var _0x54df19=this;return new Promise(function(_0x3f3ad3,_0x8d40e9){return db[_0xdcef('0x16')]['findAll']({'raw':_0x3aa4fa[_0xdcef('0x17')]?_0x3aa4fa[_0xdcef('0x17')][_0xdcef('0x18')]===undefined?!![]:![]:!![],'where':_0x3aa4fa[_0xdcef('0x17')]?_0x3aa4fa[_0xdcef('0x17')][_0xdcef('0x19')]||null:null,'attributes':_0x3aa4fa[_0xdcef('0x17')]?_0x3aa4fa[_0xdcef('0x17')]['attributes']||null:null,'limit':_0x3aa4fa['options']?_0x3aa4fa[_0xdcef('0x17')][_0xdcef('0x1a')]||null:null,'include':_0x3aa4fa['options']?_0x3aa4fa[_0xdcef('0x17')][_0xdcef('0x1b')]?_[_0xdcef('0x1c')](_0x3aa4fa[_0xdcef('0x17')][_0xdcef('0x1b')],function(_0x534883){return{'model':db[_0x534883[_0xdcef('0x1d')]],'as':_0x534883['as'],'attributes':_0x534883[_0xdcef('0x1e')],'include':_0x534883[_0xdcef('0x1b')]?_[_0xdcef('0x1c')](_0x534883[_0xdcef('0x1b')],function(_0x311829){return{'model':db[_0x311829[_0xdcef('0x1d')]],'as':_0x311829['as'],'attributes':_0x311829['attributes'],'include':_0x311829[_0xdcef('0x1b')]?_[_0xdcef('0x1c')](_0x311829[_0xdcef('0x1b')],function(_0x1f169c){return{'model':db[_0x1f169c[_0xdcef('0x1d')]],'as':_0x1f169c['as'],'attributes':_0x1f169c['attributes']};}):[]};}):[]};}):[]:[]})[_0xdcef('0x1f')](function(_0x2e3dbd){logger['info'](_0xdcef('0x15'),_0x3aa4fa);logger[_0xdcef('0xe')](_0xdcef('0x15'),_0x3aa4fa,JSON[_0xdcef('0xf')](_0x2e3dbd));_0x3f3ad3(_0x2e3dbd);})[_0xdcef('0x14')](function(_0x1ccb84){logger[_0xdcef('0x10')](_0xdcef('0x15'),_0x1ccb84[_0xdcef('0x12')],_0x3aa4fa);_0x8d40e9(_0x54df19[_0xdcef('0x10')](0x1f4,_0x1ccb84[_0xdcef('0x12')]));});});};exports['ShowFaxQueue']=function(_0x265f83){var _0x158a29=this;return new Promise(function(_0x253fd2,_0x555991){return db[_0xdcef('0x16')][_0xdcef('0x20')]({'raw':_0x265f83[_0xdcef('0x17')]?_0x265f83[_0xdcef('0x17')][_0xdcef('0x18')]===undefined?!![]:![]:!![],'where':_0x265f83['options']?_0x265f83[_0xdcef('0x17')][_0xdcef('0x19')]||null:null,'attributes':_0x265f83[_0xdcef('0x17')]?_0x265f83[_0xdcef('0x17')]['attributes']||null:null,'include':_0x265f83[_0xdcef('0x17')]?_0x265f83['options'][_0xdcef('0x1b')]?_['map'](_0x265f83[_0xdcef('0x17')][_0xdcef('0x1b')],function(_0x34d066){return{'model':db[_0x34d066[_0xdcef('0x1d')]],'as':_0x34d066['as'],'attributes':_0x34d066[_0xdcef('0x1e')],'include':_0x34d066['include']?_[_0xdcef('0x1c')](_0x34d066['include'],function(_0x3a888b){return{'model':db[_0x3a888b[_0xdcef('0x1d')]],'as':_0x3a888b['as'],'attributes':_0x3a888b['attributes'],'include':_0x3a888b[_0xdcef('0x1b')]?_[_0xdcef('0x1c')](_0x3a888b['include'],function(_0x17bacb){return{'model':db[_0x17bacb[_0xdcef('0x1d')]],'as':_0x17bacb['as'],'attributes':_0x17bacb[_0xdcef('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdcef('0x1f')](function(_0x567e33){logger[_0xdcef('0xb')](_0xdcef('0x21'),_0x265f83);logger[_0xdcef('0xe')]('ShowFaxQueue',_0x265f83,JSON['stringify'](_0x567e33));_0x253fd2(_0x567e33);})[_0xdcef('0x14')](function(_0x5e475a){logger[_0xdcef('0x10')](_0xdcef('0x21'),_0x5e475a[_0xdcef('0x12')],_0x265f83);_0x555991(_0x158a29['error'](0x1f4,_0x5e475a[_0xdcef('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d771683..08e21f1 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 _0xbbc5=['register','length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x334197,_0x591798){var _0x284809=function(_0x3567cc){while(--_0x3567cc){_0x334197['push'](_0x334197['shift']());}};_0x284809(++_0x591798);}(_0xbbc5,0x1b3));var _0x5bbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbc5[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0x5bbc('0x0'));var events=[_0x5bbc('0x1'),_0x5bbc('0x2'),_0x5bbc('0x3')];function createListener(_0x495a11,_0x147bdb){return function(_0x3d1e7b){_0x147bdb[_0x5bbc('0x4')](_0x495a11,_0x3d1e7b);};}function removeListener(_0x25e679,_0x1ab214){return function(){FaxQueueEvents[_0x5bbc('0x5')](_0x25e679,_0x1ab214);};}exports[_0x5bbc('0x6')]=function(_0x113f0f){for(var _0x4fe283=0x0,_0x189ce7=events[_0x5bbc('0x7')];_0x4fe283<_0x189ce7;_0x4fe283++){var _0xbd69bc=events[_0x4fe283];var _0x25c02d=createListener(_0x5bbc('0x8')+_0xbd69bc,_0x113f0f);FaxQueueEvents['on'](_0xbd69bc,_0x25c02d);}}; \ No newline at end of file +var _0x6358=['register','length','faxQueue:','./faxQueue.events','save','remove','emit'];(function(_0x37a4cc,_0x1531a8){var _0x4ffbbf=function(_0x5d7be5){while(--_0x5d7be5){_0x37a4cc['push'](_0x37a4cc['shift']());}};_0x4ffbbf(++_0x1531a8);}(_0x6358,0x184));var _0x8635=function(_0x4e4e44,_0x260a72){_0x4e4e44=_0x4e4e44-0x0;var _0x4287e8=_0x6358[_0x4e4e44];return _0x4287e8;};'use strict';var FaxQueueEvents=require(_0x8635('0x0'));var events=[_0x8635('0x1'),_0x8635('0x2'),'update'];function createListener(_0x2753fa,_0x308e9a){return function(_0x9e84d){_0x308e9a[_0x8635('0x3')](_0x2753fa,_0x9e84d);};}function removeListener(_0x53d511,_0x35f9fa){return function(){FaxQueueEvents['removeListener'](_0x53d511,_0x35f9fa);};}exports[_0x8635('0x4')]=function(_0x148e7d){for(var _0x109a53=0x0,_0x401e69=events[_0x8635('0x5')];_0x109a53<_0x401e69;_0x109a53++){var _0x139215=events[_0x109a53];var _0x5cfa55=createListener(_0x8635('0x6')+_0x139215,_0x148e7d);FaxQueueEvents['on'](_0x139215,_0x5cfa55);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1a337f7..97f707a 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 _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ccee3,_0x462810){_0x1ccee3=_0x1ccee3-0x0;var _0xd975d8=_0xb10b[_0x1ccee3];return _0xd975d8;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','/:id/members','getTeams','getAgents','post','create','addTeams','/:id/users','put','update','delete','destroy','/:id/teams'];(function(_0x50a077,_0x5d3197){var _0x48beb9=function(_0x4d54d0){while(--_0x4d54d0){_0x50a077['push'](_0x50a077['shift']());}};_0x48beb9(++_0x5d3197);}(_0x5f2f,0x73));var _0xf5f2=function(_0x41196a,_0x193f72){_0x41196a=_0x41196a-0x0;var _0x14b44b=_0x5f2f[_0x41196a];return _0x14b44b;};'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('./faxQueue.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('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getMembers']);router[_0xf5f2('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x8')]('/:id/users',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x10')]('/:id/teams',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x10')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller['addAgents']);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x16')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x16')](_0xf5f2('0x18'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x19')]);router[_0xf5f2('0x16')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1a')]);module[_0xf5f2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 10c32a7..51a7989 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 _0x2d69=['sequelize','DATE','STRING','moment'];(function(_0x277149,_0x912aaa){var _0x505372=function(_0x421034){while(--_0x421034){_0x277149['push'](_0x277149['shift']());}};_0x505372(++_0x912aaa);}(_0x2d69,0x9f));var _0x92d6=function(_0x5c6fc3,_0x155d3a){_0x5c6fc3=_0x5c6fc3-0x0;var _0x5d2d4f=_0x2d69[_0x5c6fc3];return _0x5d2d4f;};'use strict';var moment=require(_0x92d6('0x0'));var Sequelize=require(_0x92d6('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x92d6('0x2')]},'leaveAt':{'type':Sequelize[_0x92d6('0x2')]},'acceptAt':{'type':Sequelize[_0x92d6('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x92d6('0x3')]}}; \ No newline at end of file +var _0x6429=['exports','STRING','DATE','sequelize'];(function(_0x18ca4a,_0x30601e){var _0xf1d7a4=function(_0x2c1b08){while(--_0x2c1b08){_0x18ca4a['push'](_0x18ca4a['shift']());}};_0xf1d7a4(++_0x30601e);}(_0x6429,0x1af));var _0x9642=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x6429[_0x2300f2];return _0x6bd508;};'use strict';var moment=require('moment');var Sequelize=require(_0x9642('0x0'));module[_0x9642('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9642('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9642('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 7037ab8..8f96c6c 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 _0x7e31=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','then','destroy','end','error','name','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','FaxQueueReport','findAll','rows','catch','show','params','options','create','body','update','find','describe','eml-format','zip-dir'];(function(_0x21edd4,_0x51e6e7){var _0x2651c5=function(_0x4f7ec7){while(--_0x4f7ec7){_0x21edd4['push'](_0x21edd4['shift']());}};_0x2651c5(++_0x51e6e7);}(_0x7e31,0x148));var _0x17e3=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0x7e31[_0x3fad5a];return _0x4ca713;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x17e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17e3('0x1'));var jsonpatch=require(_0x17e3('0x2'));var rp=require(_0x17e3('0x3'));var moment=require(_0x17e3('0x4'));var BPromise=require(_0x17e3('0x5'));var Mustache=require('mustache');var util=require(_0x17e3('0x6'));var path=require(_0x17e3('0x7'));var sox=require(_0x17e3('0x8'));var csv=require(_0x17e3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x17e3('0xa'));var crypto=require(_0x17e3('0xb'));var jsforce=require(_0x17e3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x17e3('0xd'));var Papa=require(_0x17e3('0xe'));var Redis=require(_0x17e3('0xf'));var authService=require(_0x17e3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17e3('0x11'));var logger=require('../../config/logger')(_0x17e3('0x12'));var utils=require(_0x17e3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x17e3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14d2e4,_0x35ce1a){_0x35ce1a=_0x35ce1a||0xcc;return function(_0x38de8e){if(_0x38de8e){return _0x14d2e4[_0x17e3('0x15')](_0x35ce1a);}return _0x14d2e4[_0x17e3('0x16')](_0x35ce1a)['end']();};}function respondWithResult(_0x267885,_0x138591){_0x138591=_0x138591||0xc8;return function(_0x2291ed){if(_0x2291ed){return _0x267885[_0x17e3('0x16')](_0x138591)[_0x17e3('0x17')](_0x2291ed);}};}function respondWithFilteredResult(_0xf48905,_0x501538){return function(_0x2031d6){if(_0x2031d6){var _0x41d6e5=_0x2031d6[_0x17e3('0x18')],_0x12f177=_0x501538[_0x17e3('0x19')],_0x556e86=_0x501538[_0x17e3('0x19')]+_0x501538[_0x17e3('0x1a')],_0x2ab2e1;if(_0x556e86>=_0x41d6e5){_0x556e86=_0x41d6e5;_0x2ab2e1=0xc8;}else{_0x2ab2e1=0xce;}_0xf48905[_0x17e3('0x16')](_0x2ab2e1);return _0xf48905[_0x17e3('0x1b')](_0x17e3('0x1c'),_0x12f177+'-'+_0x556e86+'/'+_0x41d6e5)['json'](_0x2031d6);}return null;};}function patchUpdates(_0x4fbcde){return function(_0x57b3f2){try{jsonpatch['apply'](_0x57b3f2,_0x4fbcde,!![]);}catch(_0x5d8093){return BPromise['reject'](_0x5d8093);}return _0x57b3f2['save']();};}function saveUpdates(_0x3efd11,_0x168a41){return function(_0x5bfe9e){if(_0x5bfe9e){return _0x5bfe9e['update'](_0x3efd11)[_0x17e3('0x1d')](function(_0x3b4a12){return _0x3b4a12;});}return null;};}function removeEntity(_0x471f67,_0xe5f510){return function(_0x11d1d6){if(_0x11d1d6){return _0x11d1d6[_0x17e3('0x1e')]()[_0x17e3('0x1d')](function(){_0x471f67['status'](0xcc)[_0x17e3('0x1f')]();});}};}function handleEntityNotFound(_0x4568b5,_0x4705bb){return function(_0x2aac3f){if(!_0x2aac3f){_0x4568b5[_0x17e3('0x15')](0x194);}return _0x2aac3f;};}function handleError(_0x3b0e00,_0x2f3b33){_0x2f3b33=_0x2f3b33||0x1f4;return function(_0x581a56){logger[_0x17e3('0x20')](_0x581a56['stack']);if(_0x581a56[_0x17e3('0x21')]){delete _0x581a56[_0x17e3('0x21')];}_0x3b0e00['status'](_0x2f3b33)['send'](_0x581a56);};}exports[_0x17e3('0x22')]=function(_0x197f1a,_0x1e2b71){var _0x15c02={},_0x56699a={},_0xa5fa90={'count':0x0,'rows':[]};var _0x171399=_[_0x17e3('0x23')](db['FaxQueueReport'][_0x17e3('0x24')],function(_0xd83524){return{'name':_0xd83524['fieldName'],'type':_0xd83524[_0x17e3('0x25')][_0x17e3('0x26')]};});_0x56699a['model']=_['map'](_0x171399,_0x17e3('0x21'));_0x56699a[_0x17e3('0x27')]=_['keys'](_0x197f1a[_0x17e3('0x27')]);_0x56699a[_0x17e3('0x28')]=_[_0x17e3('0x29')](_0x56699a[_0x17e3('0x2a')],_0x56699a[_0x17e3('0x27')]);_0x15c02[_0x17e3('0x2b')]=_[_0x17e3('0x29')](_0x56699a[_0x17e3('0x2a')],qs[_0x17e3('0x2c')](_0x197f1a['query']['fields']));_0x15c02['attributes']=_0x15c02[_0x17e3('0x2b')][_0x17e3('0x2d')]?_0x15c02[_0x17e3('0x2b')]:_0x56699a[_0x17e3('0x2a')];if(!_0x197f1a['query'][_0x17e3('0x2e')]('nolimit')){_0x15c02['limit']=qs['limit'](_0x197f1a[_0x17e3('0x27')][_0x17e3('0x1a')]);_0x15c02[_0x17e3('0x19')]=qs[_0x17e3('0x19')](_0x197f1a[_0x17e3('0x27')][_0x17e3('0x19')]);}_0x15c02[_0x17e3('0x2f')]=qs[_0x17e3('0x30')](_0x197f1a['query']['sort']);_0x15c02[_0x17e3('0x31')]=qs[_0x17e3('0x28')](_['pick'](_0x197f1a[_0x17e3('0x27')],_0x56699a[_0x17e3('0x28')]),_0x171399);if(_0x197f1a[_0x17e3('0x27')][_0x17e3('0x32')]){_0x15c02[_0x17e3('0x31')]=_[_0x17e3('0x33')](_0x15c02[_0x17e3('0x31')],{'$or':_[_0x17e3('0x23')](_0x171399,function(_0x53575b){if(_0x53575b[_0x17e3('0x25')]!=='VIRTUAL'){var _0x30dd19={};_0x30dd19[_0x53575b[_0x17e3('0x21')]]={'$like':'%'+_0x197f1a['query'][_0x17e3('0x32')]+'%'};return _0x30dd19;}})});}_0x15c02=_['merge']({},_0x15c02,_0x197f1a['options']);var _0x3c3734={'where':_0x15c02['where']};return db['FaxQueueReport'][_0x17e3('0x18')](_0x3c3734)[_0x17e3('0x1d')](function(_0x385b48){_0xa5fa90['count']=_0x385b48;if(_0x197f1a[_0x17e3('0x27')][_0x17e3('0x34')]){_0x15c02[_0x17e3('0x35')]=[{'all':!![]}];}return db[_0x17e3('0x36')][_0x17e3('0x37')](_0x15c02);})['then'](function(_0x782bad){_0xa5fa90[_0x17e3('0x38')]=_0x782bad;return _0xa5fa90;})['then'](respondWithFilteredResult(_0x1e2b71,_0x15c02))[_0x17e3('0x39')](handleError(_0x1e2b71,null));};exports[_0x17e3('0x3a')]=function(_0x1ebb3d,_0x535908){var _0x50412a={'raw':!![],'where':{'id':_0x1ebb3d[_0x17e3('0x3b')]['id']}},_0x58a249={};_0x58a249[_0x17e3('0x2a')]=_['keys'](db[_0x17e3('0x36')][_0x17e3('0x24')]);_0x58a249[_0x17e3('0x27')]=_['keys'](_0x1ebb3d[_0x17e3('0x27')]);_0x58a249[_0x17e3('0x28')]=_['intersection'](_0x58a249['model'],_0x58a249[_0x17e3('0x27')]);_0x50412a[_0x17e3('0x2b')]=_[_0x17e3('0x29')](_0x58a249[_0x17e3('0x2a')],qs[_0x17e3('0x2c')](_0x1ebb3d['query'][_0x17e3('0x2c')]));_0x50412a[_0x17e3('0x2b')]=_0x50412a[_0x17e3('0x2b')][_0x17e3('0x2d')]?_0x50412a[_0x17e3('0x2b')]:_0x58a249[_0x17e3('0x2a')];if(_0x1ebb3d[_0x17e3('0x27')][_0x17e3('0x34')]){_0x50412a[_0x17e3('0x35')]=[{'all':!![]}];}_0x50412a=_[_0x17e3('0x33')]({},_0x50412a,_0x1ebb3d[_0x17e3('0x3c')]);return db['FaxQueueReport']['find'](_0x50412a)[_0x17e3('0x1d')](handleEntityNotFound(_0x535908,null))[_0x17e3('0x1d')](respondWithResult(_0x535908,null))[_0x17e3('0x39')](handleError(_0x535908,null));};exports[_0x17e3('0x3d')]=function(_0x5934cf,_0x4eeb64){return db[_0x17e3('0x36')][_0x17e3('0x3d')](_0x5934cf[_0x17e3('0x3e')],{})[_0x17e3('0x1d')](respondWithResult(_0x4eeb64,0xc9))[_0x17e3('0x39')](handleError(_0x4eeb64,null));};exports[_0x17e3('0x3f')]=function(_0x54a39c,_0x1f4460){if(_0x54a39c[_0x17e3('0x3e')]['id']){delete _0x54a39c['body']['id'];}return db['FaxQueueReport'][_0x17e3('0x40')]({'where':{'id':_0x54a39c[_0x17e3('0x3b')]['id']}})[_0x17e3('0x1d')](handleEntityNotFound(_0x1f4460,null))[_0x17e3('0x1d')](saveUpdates(_0x54a39c[_0x17e3('0x3e')],null))[_0x17e3('0x1d')](respondWithResult(_0x1f4460,null))[_0x17e3('0x39')](handleError(_0x1f4460,null));};exports[_0x17e3('0x1e')]=function(_0x312b9b,_0x1e487e){return db[_0x17e3('0x36')][_0x17e3('0x40')]({'where':{'id':_0x312b9b[_0x17e3('0x3b')]['id']}})[_0x17e3('0x1d')](handleEntityNotFound(_0x1e487e,null))[_0x17e3('0x1d')](removeEntity(_0x1e487e,null))[_0x17e3('0x39')](handleError(_0x1e487e,null));};exports[_0x17e3('0x41')]=function(_0x538fe3,_0x62386){return db['FaxQueueReport'][_0x17e3('0x41')]()[_0x17e3('0x1d')](respondWithResult(_0x62386,null))[_0x17e3('0x39')](handleError(_0x62386,null));}; \ No newline at end of file +var _0x5372=['Content-Range','json','apply','reject','update','destroy','then','error','stack','name','index','map','FaxQueueReport','fieldName','type','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','fields','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','count','limit','set'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5372,0x76));var _0x2537=function(_0x36123b,_0x11d60c){_0x36123b=_0x36123b-0x0;var _0x50677f=_0x5372[_0x36123b];return _0x50677f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2537('0x0'));var rimraf=require(_0x2537('0x1'));var zipdir=require(_0x2537('0x2'));var jsonpatch=require(_0x2537('0x3'));var rp=require(_0x2537('0x4'));var moment=require(_0x2537('0x5'));var BPromise=require(_0x2537('0x6'));var Mustache=require(_0x2537('0x7'));var util=require(_0x2537('0x8'));var path=require(_0x2537('0x9'));var sox=require('sox');var csv=require(_0x2537('0xa'));var ejs=require(_0x2537('0xb'));var fs=require('fs');var _=require(_0x2537('0xc'));var squel=require(_0x2537('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2537('0xa'));var querystring=require(_0x2537('0xe'));var Papa=require(_0x2537('0xf'));var Redis=require(_0x2537('0x10'));var authService=require(_0x2537('0x11'));var qs=require(_0x2537('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2537('0x13'));var logger=require(_0x2537('0x14'))(_0x2537('0x15'));var utils=require(_0x2537('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2537('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ab000,_0x3beef4){_0x3beef4=_0x3beef4||0xcc;return function(_0x458a24){if(_0x458a24){return _0x1ab000[_0x2537('0x18')](_0x3beef4);}return _0x1ab000[_0x2537('0x19')](_0x3beef4)[_0x2537('0x1a')]();};}function respondWithResult(_0x3b6457,_0x50d340){_0x50d340=_0x50d340||0xc8;return function(_0x2e324c){if(_0x2e324c){return _0x3b6457[_0x2537('0x19')](_0x50d340)['json'](_0x2e324c);}};}function respondWithFilteredResult(_0x5e7180,_0x55deee){return function(_0x2f5c3b){if(_0x2f5c3b){var _0x261232=_0x2f5c3b[_0x2537('0x1b')],_0x288b9f=_0x55deee['offset'],_0x336430=_0x55deee['offset']+_0x55deee[_0x2537('0x1c')],_0x2accb2;if(_0x336430>=_0x261232){_0x336430=_0x261232;_0x2accb2=0xc8;}else{_0x2accb2=0xce;}_0x5e7180[_0x2537('0x19')](_0x2accb2);return _0x5e7180[_0x2537('0x1d')](_0x2537('0x1e'),_0x288b9f+'-'+_0x336430+'/'+_0x261232)[_0x2537('0x1f')](_0x2f5c3b);}return null;};}function patchUpdates(_0x42f048){return function(_0x4b8b2e){try{jsonpatch[_0x2537('0x20')](_0x4b8b2e,_0x42f048,!![]);}catch(_0x49927b){return BPromise[_0x2537('0x21')](_0x49927b);}return _0x4b8b2e['save']();};}function saveUpdates(_0x1af5b9,_0xaccd4d){return function(_0x3a0398){if(_0x3a0398){return _0x3a0398[_0x2537('0x22')](_0x1af5b9)['then'](function(_0x16ddc1){return _0x16ddc1;});}return null;};}function removeEntity(_0x28e8fa,_0x4aa892){return function(_0x3abe52){if(_0x3abe52){return _0x3abe52[_0x2537('0x23')]()[_0x2537('0x24')](function(){_0x28e8fa[_0x2537('0x19')](0xcc)[_0x2537('0x1a')]();});}};}function handleEntityNotFound(_0x1a3ec4,_0x243432){return function(_0x1686f0){if(!_0x1686f0){_0x1a3ec4[_0x2537('0x18')](0x194);}return _0x1686f0;};}function handleError(_0x114c01,_0x24b928){_0x24b928=_0x24b928||0x1f4;return function(_0x2868e7){logger[_0x2537('0x25')](_0x2868e7[_0x2537('0x26')]);if(_0x2868e7[_0x2537('0x27')]){delete _0x2868e7['name'];}_0x114c01[_0x2537('0x19')](_0x24b928)['send'](_0x2868e7);};}exports[_0x2537('0x28')]=function(_0x2e03ba,_0x13875e){var _0x1b1540={},_0x24b1e1={},_0x495018={'count':0x0,'rows':[]};var _0x36fedd=_[_0x2537('0x29')](db[_0x2537('0x2a')]['rawAttributes'],function(_0x1e0ba9){return{'name':_0x1e0ba9[_0x2537('0x2b')],'type':_0x1e0ba9[_0x2537('0x2c')]['key']};});_0x24b1e1[_0x2537('0x2d')]=_[_0x2537('0x29')](_0x36fedd,_0x2537('0x27'));_0x24b1e1[_0x2537('0x2e')]=_[_0x2537('0x2f')](_0x2e03ba[_0x2537('0x2e')]);_0x24b1e1['filters']=_[_0x2537('0x30')](_0x24b1e1[_0x2537('0x2d')],_0x24b1e1[_0x2537('0x2e')]);_0x1b1540['attributes']=_['intersection'](_0x24b1e1[_0x2537('0x2d')],qs['fields'](_0x2e03ba[_0x2537('0x2e')]['fields']));_0x1b1540[_0x2537('0x31')]=_0x1b1540[_0x2537('0x31')]['length']?_0x1b1540[_0x2537('0x31')]:_0x24b1e1['model'];if(!_0x2e03ba['query'][_0x2537('0x32')](_0x2537('0x33'))){_0x1b1540[_0x2537('0x1c')]=qs[_0x2537('0x1c')](_0x2e03ba['query'][_0x2537('0x1c')]);_0x1b1540[_0x2537('0x34')]=qs[_0x2537('0x34')](_0x2e03ba['query'][_0x2537('0x34')]);}_0x1b1540[_0x2537('0x35')]=qs[_0x2537('0x36')](_0x2e03ba[_0x2537('0x2e')]['sort']);_0x1b1540[_0x2537('0x37')]=qs[_0x2537('0x38')](_[_0x2537('0x39')](_0x2e03ba['query'],_0x24b1e1[_0x2537('0x38')]),_0x36fedd);if(_0x2e03ba[_0x2537('0x2e')][_0x2537('0x3a')]){_0x1b1540[_0x2537('0x37')]=_[_0x2537('0x3b')](_0x1b1540['where'],{'$or':_[_0x2537('0x29')](_0x36fedd,function(_0x2bea11){if(_0x2bea11['type']!==_0x2537('0x3c')){var _0x28fd06={};_0x28fd06[_0x2bea11[_0x2537('0x27')]]={'$like':'%'+_0x2e03ba['query'][_0x2537('0x3a')]+'%'};return _0x28fd06;}})});}_0x1b1540=_[_0x2537('0x3b')]({},_0x1b1540,_0x2e03ba[_0x2537('0x3d')]);var _0x191965={'where':_0x1b1540[_0x2537('0x37')]};return db[_0x2537('0x2a')][_0x2537('0x1b')](_0x191965)['then'](function(_0x30614c){_0x495018[_0x2537('0x1b')]=_0x30614c;if(_0x2e03ba[_0x2537('0x2e')][_0x2537('0x3e')]){_0x1b1540[_0x2537('0x3f')]=[{'all':!![]}];}return db[_0x2537('0x2a')]['findAll'](_0x1b1540);})['then'](function(_0x38b159){_0x495018[_0x2537('0x40')]=_0x38b159;return _0x495018;})['then'](respondWithFilteredResult(_0x13875e,_0x1b1540))[_0x2537('0x41')](handleError(_0x13875e,null));};exports['show']=function(_0x13096f,_0x327f18){var _0x37701f={'raw':!![],'where':{'id':_0x13096f[_0x2537('0x42')]['id']}},_0x3ba005={};_0x3ba005[_0x2537('0x2d')]=_[_0x2537('0x2f')](db[_0x2537('0x2a')][_0x2537('0x43')]);_0x3ba005[_0x2537('0x2e')]=_[_0x2537('0x2f')](_0x13096f[_0x2537('0x2e')]);_0x3ba005['filters']=_[_0x2537('0x30')](_0x3ba005[_0x2537('0x2d')],_0x3ba005['query']);_0x37701f['attributes']=_['intersection'](_0x3ba005[_0x2537('0x2d')],qs['fields'](_0x13096f['query'][_0x2537('0x44')]));_0x37701f[_0x2537('0x31')]=_0x37701f[_0x2537('0x31')][_0x2537('0x45')]?_0x37701f[_0x2537('0x31')]:_0x3ba005[_0x2537('0x2d')];if(_0x13096f[_0x2537('0x2e')][_0x2537('0x3e')]){_0x37701f[_0x2537('0x3f')]=[{'all':!![]}];}_0x37701f=_[_0x2537('0x3b')]({},_0x37701f,_0x13096f[_0x2537('0x3d')]);return db[_0x2537('0x2a')][_0x2537('0x46')](_0x37701f)[_0x2537('0x24')](handleEntityNotFound(_0x327f18,null))[_0x2537('0x24')](respondWithResult(_0x327f18,null))[_0x2537('0x41')](handleError(_0x327f18,null));};exports['create']=function(_0x813423,_0x1a5af8){return db['FaxQueueReport'][_0x2537('0x47')](_0x813423['body'],{})['then'](respondWithResult(_0x1a5af8,0xc9))['catch'](handleError(_0x1a5af8,null));};exports[_0x2537('0x22')]=function(_0x276809,_0x54a286){if(_0x276809['body']['id']){delete _0x276809[_0x2537('0x48')]['id'];}return db[_0x2537('0x2a')][_0x2537('0x46')]({'where':{'id':_0x276809[_0x2537('0x42')]['id']}})[_0x2537('0x24')](handleEntityNotFound(_0x54a286,null))['then'](saveUpdates(_0x276809[_0x2537('0x48')],null))['then'](respondWithResult(_0x54a286,null))['catch'](handleError(_0x54a286,null));};exports[_0x2537('0x23')]=function(_0x2219f9,_0x485dc8){return db['FaxQueueReport']['find']({'where':{'id':_0x2219f9[_0x2537('0x42')]['id']}})[_0x2537('0x24')](handleEntityNotFound(_0x485dc8,null))[_0x2537('0x24')](removeEntity(_0x485dc8,null))[_0x2537('0x41')](handleError(_0x485dc8,null));};exports[_0x2537('0x49')]=function(_0x19362b,_0x491723){return db[_0x2537('0x2a')]['describe']()['then'](respondWithResult(_0x491723,null))[_0x2537('0x41')](handleError(_0x491723,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 6d963b2..1927b63 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 _0x5a4f=['rimraf','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2bcea0,_0x257c8c){var _0x4a6d4f=function(_0x177d4d){while(--_0x177d4d){_0x2bcea0['push'](_0x2bcea0['shift']());}};_0x4a6d4f(++_0x257c8c);}(_0x5a4f,0xd9));var _0xf5a4=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5a4f[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xf5a4('0x0'));var util=require(_0xf5a4('0x1'));var logger=require(_0xf5a4('0x2'))(_0xf5a4('0x3'));var moment=require(_0xf5a4('0x4'));var BPromise=require(_0xf5a4('0x5'));var rp=require(_0xf5a4('0x6'));var fs=require('fs');var path=require(_0xf5a4('0x7'));var rimraf=require(_0xf5a4('0x8'));var config=require(_0xf5a4('0x9'));var attributes=require(_0xf5a4('0xa'));module['exports']=function(_0x269543,_0x3057fb){return _0x269543[_0xf5a4('0xb')](_0xf5a4('0xc'),attributes,{'tableName':_0xf5a4('0xd'),'paranoid':![],'indexes':[{'name':_0xf5a4('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2796=['../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x368c1d,_0x4683cd){var _0xface06=function(_0x229fe9){while(--_0x229fe9){_0x368c1d['push'](_0x368c1d['shift']());}};_0xface06(++_0x4683cd);}(_0x2796,0xae));var _0x6279=function(_0xe7fe90,_0x517302){_0xe7fe90=_0xe7fe90-0x0;var _0x455547=_0x2796[_0xe7fe90];return _0x455547;};'use strict';var _=require(_0x6279('0x0'));var util=require('util');var logger=require(_0x6279('0x1'))(_0x6279('0x2'));var moment=require(_0x6279('0x3'));var BPromise=require(_0x6279('0x4'));var rp=require(_0x6279('0x5'));var fs=require('fs');var path=require(_0x6279('0x6'));var rimraf=require(_0x6279('0x7'));var config=require(_0x6279('0x8'));var attributes=require(_0x6279('0x9'));module['exports']=function(_0x2c954a,_0x428861){return _0x2c954a[_0x6279('0xa')](_0x6279('0xb'),attributes,{'tableName':_0x6279('0xc'),'paranoid':![],'indexes':[{'name':_0x6279('0xd'),'fields':[_0x6279('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 5dc45df..f7ae2c7 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 _0x7ea2=['util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','attributes','lodash'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0x7ea2,0xef));var _0x27ea=function(_0x1635fe,_0x5f1d9f){_0x1635fe=_0x1635fe-0x0;var _0x3c512a=_0x7ea2[_0x1635fe];return _0x3c512a;};'use strict';var _=require(_0x27ea('0x0'));var util=require(_0x27ea('0x1'));var moment=require('moment');var BPromise=require(_0x27ea('0x2'));var rs=require(_0x27ea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27ea('0x4'))['db'];var utils=require(_0x27ea('0x5'));var logger=require('../../config/logger')(_0x27ea('0x6'));var config=require(_0x27ea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x27ea('0x8')][_0x27ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x247d2d,_0x19ef9a,_0x35304c){return new BPromise(function(_0x1a22f8,_0xf1febb){return client['request'](_0x247d2d,_0x35304c)[_0x27ea('0xa')](function(_0x44b584){logger[_0x27ea('0xb')](_0x27ea('0xc'),_0x19ef9a,_0x27ea('0xd'));logger[_0x27ea('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x19ef9a,_0x27ea('0xd'),JSON[_0x27ea('0xf')](_0x44b584));if(_0x44b584[_0x27ea('0x10')]){if(_0x44b584['error'][_0x27ea('0x11')]===0x1f4){logger['error'](_0x27ea('0xc'),_0x19ef9a,_0x44b584[_0x27ea('0x10')][_0x27ea('0x12')]);return _0xf1febb(_0x44b584['error'][_0x27ea('0x12')]);}logger[_0x27ea('0x10')](_0x27ea('0xc'),_0x19ef9a,_0x44b584[_0x27ea('0x10')][_0x27ea('0x12')]);return _0x1a22f8(_0x44b584[_0x27ea('0x10')][_0x27ea('0x12')]);}else{logger['info'](_0x27ea('0xc'),_0x19ef9a,_0x27ea('0xd'));_0x1a22f8(_0x44b584['result']['message']);}})[_0x27ea('0x13')](function(_0x35bc57){logger['error'](_0x27ea('0xc'),_0x19ef9a,_0x35bc57);_0xf1febb(_0x35bc57);});});}exports[_0x27ea('0x14')]=function(_0xbcac2b){var _0x3f5250=this;return new Promise(function(_0x5282c5,_0x4314a6){return db[_0x27ea('0x15')][_0x27ea('0x16')](_0xbcac2b[_0x27ea('0x17')],{'raw':_0xbcac2b[_0x27ea('0x18')]?_0xbcac2b[_0x27ea('0x18')][_0x27ea('0x19')]===undefined?!![]:![]:!![]})[_0x27ea('0xa')](function(_0x404df7){logger[_0x27ea('0xb')]('CreateFaxQueueReport',_0xbcac2b);logger['debug'](_0x27ea('0x14'),_0xbcac2b,JSON[_0x27ea('0xf')](_0x404df7));_0x5282c5(_0x404df7);})['catch'](function(_0x3bf64a){logger[_0x27ea('0x10')](_0x27ea('0x14'),_0x3bf64a[_0x27ea('0x12')],_0xbcac2b);_0x4314a6(_0x3f5250['error'](0x1f4,_0x3bf64a[_0x27ea('0x12')]));});});};exports[_0x27ea('0x1a')]=function(_0x53476f){var _0x6f9c85=this;return new Promise(function(_0x4eae6a,_0x470df8){return db[_0x27ea('0x15')][_0x27ea('0x1b')](_0x53476f[_0x27ea('0x17')],{'raw':_0x53476f[_0x27ea('0x18')]?_0x53476f[_0x27ea('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53476f[_0x27ea('0x18')]?_0x53476f['options'][_0x27ea('0x1c')]||null:null,'attributes':_0x53476f['options']?_0x53476f['options'][_0x27ea('0x1d')]||null:null,'limit':_0x53476f[_0x27ea('0x18')]?_0x53476f[_0x27ea('0x18')]['limit']||null:null})[_0x27ea('0xa')](function(_0x2f4c52){logger[_0x27ea('0xb')](_0x27ea('0x1a'),_0x53476f);logger[_0x27ea('0xe')]('UpdateFaxQueueReport',_0x53476f,JSON['stringify'](_0x2f4c52));_0x4eae6a(_0x2f4c52);})[_0x27ea('0x13')](function(_0x28e5c3){logger[_0x27ea('0x10')](_0x27ea('0x1a'),_0x28e5c3[_0x27ea('0x12')],_0x53476f);_0x470df8(_0x6f9c85[_0x27ea('0x10')](0x1f4,_0x28e5c3[_0x27ea('0x12')]));});});}; \ No newline at end of file +var _0xe546=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','debug','update','where','attributes','UpdateFaxQueueReport','lodash'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xe546,0xbf));var _0x6e54=function(_0x5a6375,_0x4c9e9c){_0x5a6375=_0x5a6375-0x0;var _0x266fd6=_0xe546[_0x5a6375];return _0x266fd6;};'use strict';var _=require(_0x6e54('0x0'));var util=require('util');var moment=require(_0x6e54('0x1'));var BPromise=require(_0x6e54('0x2'));var rs=require(_0x6e54('0x3'));var fs=require('fs');var Redis=require(_0x6e54('0x4'));var db=require(_0x6e54('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e54('0x6'))(_0x6e54('0x7'));var config=require(_0x6e54('0x8'));var jayson=require(_0x6e54('0x9'));var client=jayson[_0x6e54('0xa')][_0x6e54('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bc629,_0x1a44c1,_0x3105f0){return new BPromise(function(_0x40e212,_0x2a70b1){return client['request'](_0x5bc629,_0x3105f0)[_0x6e54('0xc')](function(_0x36804b){logger[_0x6e54('0xd')](_0x6e54('0xe'),_0x1a44c1,'request\x20sent');logger['debug'](_0x6e54('0xf'),_0x1a44c1,_0x6e54('0x10'),JSON[_0x6e54('0x11')](_0x36804b));if(_0x36804b[_0x6e54('0x12')]){if(_0x36804b['error'][_0x6e54('0x13')]===0x1f4){logger['error'](_0x6e54('0xe'),_0x1a44c1,_0x36804b[_0x6e54('0x12')][_0x6e54('0x14')]);return _0x2a70b1(_0x36804b[_0x6e54('0x12')][_0x6e54('0x14')]);}logger[_0x6e54('0x12')](_0x6e54('0xe'),_0x1a44c1,_0x36804b[_0x6e54('0x12')][_0x6e54('0x14')]);return _0x40e212(_0x36804b[_0x6e54('0x12')][_0x6e54('0x14')]);}else{logger[_0x6e54('0xd')](_0x6e54('0xe'),_0x1a44c1,'request\x20sent');_0x40e212(_0x36804b['result'][_0x6e54('0x14')]);}})[_0x6e54('0x15')](function(_0x531798){logger[_0x6e54('0x12')](_0x6e54('0xe'),_0x1a44c1,_0x531798);_0x2a70b1(_0x531798);});});}exports[_0x6e54('0x16')]=function(_0x1d23e4){var _0x10c71a=this;return new Promise(function(_0xacceec,_0x4062cf){return db[_0x6e54('0x17')][_0x6e54('0x18')](_0x1d23e4['body'],{'raw':_0x1d23e4['options']?_0x1d23e4[_0x6e54('0x19')][_0x6e54('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x47f797){logger['info']('CreateFaxQueueReport',_0x1d23e4);logger[_0x6e54('0x1b')](_0x6e54('0x16'),_0x1d23e4,JSON['stringify'](_0x47f797));_0xacceec(_0x47f797);})[_0x6e54('0x15')](function(_0x253182){logger[_0x6e54('0x12')](_0x6e54('0x16'),_0x253182[_0x6e54('0x14')],_0x1d23e4);_0x4062cf(_0x10c71a[_0x6e54('0x12')](0x1f4,_0x253182[_0x6e54('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x2c9eda){var _0x5d4d17=this;return new Promise(function(_0xdfc388,_0x1cbbf4){return db[_0x6e54('0x17')][_0x6e54('0x1c')](_0x2c9eda['body'],{'raw':_0x2c9eda[_0x6e54('0x19')]?_0x2c9eda[_0x6e54('0x19')][_0x6e54('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c9eda[_0x6e54('0x19')]?_0x2c9eda[_0x6e54('0x19')][_0x6e54('0x1d')]||null:null,'attributes':_0x2c9eda['options']?_0x2c9eda['options'][_0x6e54('0x1e')]||null:null,'limit':_0x2c9eda['options']?_0x2c9eda[_0x6e54('0x19')]['limit']||null:null})[_0x6e54('0xc')](function(_0x1ea997){logger['info'](_0x6e54('0x1f'),_0x2c9eda);logger[_0x6e54('0x1b')](_0x6e54('0x1f'),_0x2c9eda,JSON[_0x6e54('0x11')](_0x1ea997));_0xdfc388(_0x1ea997);})[_0x6e54('0x15')](function(_0x279d1c){logger[_0x6e54('0x12')]('UpdateFaxQueueReport',_0x279d1c[_0x6e54('0x14')],_0x2c9eda);_0x1cbbf4(_0x5d4d17['error'](0x1f4,_0x279d1c[_0x6e54('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 4e1ca25..74881cb 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 _0x8d31=['update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','create','put','/:id'];(function(_0x5a9600,_0x46da77){var _0x20b0e6=function(_0x351865){while(--_0x351865){_0x5a9600['push'](_0x5a9600['shift']());}};_0x20b0e6(++_0x46da77);}(_0x8d31,0x1f1));var _0x18d3=function(_0x1d5fca,_0x43ebb7){_0x1d5fca=_0x1d5fca-0x0;var _0x44863b=_0x8d31[_0x1d5fca];return _0x44863b;};'use strict';var multer=require(_0x18d3('0x0'));var util=require(_0x18d3('0x1'));var path=require(_0x18d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x18d3('0x3'));var router=express['Router']();var auth=require(_0x18d3('0x4'));var interaction=require(_0x18d3('0x5'));var config=require(_0x18d3('0x6'));var controller=require('./faxQueueReport.controller');router[_0x18d3('0x7')]('/',auth[_0x18d3('0x8')](),controller[_0x18d3('0x9')]);router['get'](_0x18d3('0xa'),auth['isAuthenticated'](),controller[_0x18d3('0xb')]);router[_0x18d3('0x7')]('/:id',auth[_0x18d3('0x8')](),controller['show']);router[_0x18d3('0xc')]('/',auth[_0x18d3('0x8')](),controller[_0x18d3('0xd')]);router[_0x18d3('0xe')](_0x18d3('0xf'),auth[_0x18d3('0x8')](),controller[_0x18d3('0x10')]);router['delete']('/:id',auth[_0x18d3('0x8')](),controller[_0x18d3('0x11')]);module[_0x18d3('0x12')]=router; \ No newline at end of file +var _0x8446=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show'];(function(_0x37f18a,_0x109cde){var _0x4a381e=function(_0x286cfe){while(--_0x286cfe){_0x37f18a['push'](_0x37f18a['shift']());}};_0x4a381e(++_0x109cde);}(_0x8446,0x157));var _0x6844=function(_0x14efed,_0x1058fc){_0x14efed=_0x14efed-0x0;var _0xfdc268=_0x8446[_0x14efed];return _0xfdc268;};'use strict';var multer=require(_0x6844('0x0'));var util=require(_0x6844('0x1'));var path=require(_0x6844('0x2'));var timeout=require(_0x6844('0x3'));var express=require(_0x6844('0x4'));var router=express[_0x6844('0x5')]();var auth=require(_0x6844('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6844('0x7'));var controller=require('./faxQueueReport.controller');router[_0x6844('0x8')]('/',auth[_0x6844('0x9')](),controller[_0x6844('0xa')]);router[_0x6844('0x8')]('/describe',auth[_0x6844('0x9')](),controller[_0x6844('0xb')]);router[_0x6844('0x8')](_0x6844('0xc'),auth['isAuthenticated'](),controller[_0x6844('0xd')]);router[_0x6844('0xe')]('/',auth[_0x6844('0x9')](),controller[_0x6844('0xf')]);router[_0x6844('0x10')](_0x6844('0xc'),auth['isAuthenticated'](),controller[_0x6844('0x11')]);router[_0x6844('0x12')](_0x6844('0xc'),auth[_0x6844('0x9')](),controller[_0x6844('0x13')]);module[_0x6844('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 6d7f465..7cff3a9 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 _0x053a=['NOW','sequelize','STRING','ENUM','account','queue'];(function(_0xc81f13,_0x1c560d){var _0x38f26d=function(_0x26c7bf){while(--_0x26c7bf){_0xc81f13['push'](_0xc81f13['shift']());}};_0x38f26d(++_0x1c560d);}(_0x053a,0xa3));var _0xa053=function(_0x4994fd,_0x268455){_0x4994fd=_0x4994fd-0x0;var _0x5bb20e=_0x053a[_0x4994fd];return _0x5bb20e;};'use strict';var moment=require('moment');var Sequelize=require(_0xa053('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa053('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa053('0x2')](_0xa053('0x3'),'agent',_0xa053('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xa053('0x5')]}}; \ No newline at end of file +var _0xff0d=['queue','DATE','moment','sequelize','STRING','ENUM','account'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0xff0d,0xd4));var _0xdff0=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xff0d[_0x4fbfd9];return _0x31dc94;};'use strict';var moment=require(_0xdff0('0x0'));var Sequelize=require(_0xdff0('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xdff0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdff0('0x3')](_0xdff0('0x4'),'agent',_0xdff0('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xdff0('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 1ddf473..51c38bf 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 _0x4989=['count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','nolimit','order','sort','where','pick','merge','filter','options','findAll','rows','show','params','keys','length','includeAll','include','catch','create','body','find','destroy','html-pdf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0xe09b48,_0x14d774){var _0x16a14c=function(_0x260066){while(--_0x260066){_0xe09b48['push'](_0xe09b48['shift']());}};_0x16a14c(++_0x14d774);}(_0x4989,0x79));var _0x9498=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0x4989[_0x1a87b3];return _0x37e84d;};'use strict';var pdf=require(_0x9498('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9498('0x1'));var jsonpatch=require(_0x9498('0x2'));var rp=require(_0x9498('0x3'));var moment=require(_0x9498('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9498('0x5'));var path=require('path');var sox=require(_0x9498('0x6'));var csv=require(_0x9498('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9498('0x8'));var squel=require(_0x9498('0x9'));var crypto=require(_0x9498('0xa'));var jsforce=require(_0x9498('0xb'));var deskjs=require(_0x9498('0xc'));var toCsv=require(_0x9498('0x7'));var querystring=require(_0x9498('0xd'));var Papa=require(_0x9498('0xe'));var Redis=require(_0x9498('0xf'));var authService=require(_0x9498('0x10'));var qs=require(_0x9498('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9498('0x12'));var logger=require(_0x9498('0x13'))(_0x9498('0x14'));var utils=require('../../config/utils');var config=require(_0x9498('0x15'));var licenseUtil=require(_0x9498('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x495104,_0x4834bd){_0x4834bd=_0x4834bd||0xcc;return function(_0x1dd476){if(_0x1dd476){return _0x495104[_0x9498('0x17')](_0x4834bd);}return _0x495104[_0x9498('0x18')](_0x4834bd)[_0x9498('0x19')]();};}function respondWithResult(_0x1a1e49,_0xfab8b9){_0xfab8b9=_0xfab8b9||0xc8;return function(_0x4de27c){if(_0x4de27c){return _0x1a1e49[_0x9498('0x18')](_0xfab8b9)[_0x9498('0x1a')](_0x4de27c);}};}function respondWithFilteredResult(_0x3605dd,_0x2cc291){return function(_0x1c8549){if(_0x1c8549){var _0x36828b=_0x1c8549[_0x9498('0x1b')],_0xb8ad5=_0x2cc291[_0x9498('0x1c')],_0x1bf051=_0x2cc291[_0x9498('0x1c')]+_0x2cc291[_0x9498('0x1d')],_0x467578;if(_0x1bf051>=_0x36828b){_0x1bf051=_0x36828b;_0x467578=0xc8;}else{_0x467578=0xce;}_0x3605dd[_0x9498('0x18')](_0x467578);return _0x3605dd[_0x9498('0x1e')](_0x9498('0x1f'),_0xb8ad5+'-'+_0x1bf051+'/'+_0x36828b)['json'](_0x1c8549);}return null;};}function patchUpdates(_0x1cf763){return function(_0x46dfce){try{jsonpatch[_0x9498('0x20')](_0x46dfce,_0x1cf763,!![]);}catch(_0x192436){return BPromise['reject'](_0x192436);}return _0x46dfce[_0x9498('0x21')]();};}function saveUpdates(_0x58521c,_0x2cad3f){return function(_0x6abe27){if(_0x6abe27){return _0x6abe27[_0x9498('0x22')](_0x58521c)['then'](function(_0x58b9d4){return _0x58b9d4;});}return null;};}function removeEntity(_0x47b66d,_0x362830){return function(_0x10ee7d){if(_0x10ee7d){return _0x10ee7d['destroy']()[_0x9498('0x23')](function(){_0x47b66d[_0x9498('0x18')](0xcc)[_0x9498('0x19')]();});}};}function handleEntityNotFound(_0x53729b,_0x37f483){return function(_0x35a717){if(!_0x35a717){_0x53729b[_0x9498('0x17')](0x194);}return _0x35a717;};}function handleError(_0x447374,_0x2c4fec){_0x2c4fec=_0x2c4fec||0x1f4;return function(_0x5e6940){logger[_0x9498('0x24')](_0x5e6940[_0x9498('0x25')]);if(_0x5e6940[_0x9498('0x26')]){delete _0x5e6940['name'];}_0x447374[_0x9498('0x18')](_0x2c4fec)[_0x9498('0x27')](_0x5e6940);};}exports[_0x9498('0x28')]=function(_0x2f9262,_0x47078d){var _0x5cedd1={},_0x5f0e7e={},_0x5f53a0={'count':0x0,'rows':[]};var _0x43a387=_[_0x9498('0x29')](db[_0x9498('0x2a')][_0x9498('0x2b')],function(_0xee89a5){return{'name':_0xee89a5[_0x9498('0x2c')],'type':_0xee89a5[_0x9498('0x2d')][_0x9498('0x2e')]};});_0x5f0e7e['model']=_['map'](_0x43a387,_0x9498('0x26'));_0x5f0e7e['query']=_['keys'](_0x2f9262[_0x9498('0x2f')]);_0x5f0e7e[_0x9498('0x30')]=_['intersection'](_0x5f0e7e['model'],_0x5f0e7e[_0x9498('0x2f')]);_0x5cedd1[_0x9498('0x31')]=_[_0x9498('0x32')](_0x5f0e7e[_0x9498('0x33')],qs['fields'](_0x2f9262[_0x9498('0x2f')][_0x9498('0x34')]));_0x5cedd1[_0x9498('0x31')]=_0x5cedd1[_0x9498('0x31')]['length']?_0x5cedd1['attributes']:_0x5f0e7e[_0x9498('0x33')];if(!_0x2f9262[_0x9498('0x2f')]['hasOwnProperty'](_0x9498('0x35'))){_0x5cedd1[_0x9498('0x1d')]=qs[_0x9498('0x1d')](_0x2f9262[_0x9498('0x2f')][_0x9498('0x1d')]);_0x5cedd1['offset']=qs[_0x9498('0x1c')](_0x2f9262[_0x9498('0x2f')]['offset']);}_0x5cedd1[_0x9498('0x36')]=qs[_0x9498('0x37')](_0x2f9262[_0x9498('0x2f')][_0x9498('0x37')]);_0x5cedd1[_0x9498('0x38')]=qs['filters'](_[_0x9498('0x39')](_0x2f9262[_0x9498('0x2f')],_0x5f0e7e[_0x9498('0x30')]),_0x43a387);if(_0x2f9262[_0x9498('0x2f')]['filter']){_0x5cedd1['where']=_[_0x9498('0x3a')](_0x5cedd1[_0x9498('0x38')],{'$or':_[_0x9498('0x29')](_0x43a387,function(_0x2b657f){if(_0x2b657f['type']!=='VIRTUAL'){var _0x481184={};_0x481184[_0x2b657f['name']]={'$like':'%'+_0x2f9262[_0x9498('0x2f')][_0x9498('0x3b')]+'%'};return _0x481184;}})});}_0x5cedd1=_[_0x9498('0x3a')]({},_0x5cedd1,_0x2f9262[_0x9498('0x3c')]);var _0x513efa={'where':_0x5cedd1[_0x9498('0x38')]};return db[_0x9498('0x2a')]['count'](_0x513efa)[_0x9498('0x23')](function(_0x128bd1){_0x5f53a0[_0x9498('0x1b')]=_0x128bd1;if(_0x2f9262[_0x9498('0x2f')]['includeAll']){_0x5cedd1['include']=[{'all':!![]}];}return db[_0x9498('0x2a')][_0x9498('0x3d')](_0x5cedd1);})[_0x9498('0x23')](function(_0x5bfb93){_0x5f53a0[_0x9498('0x3e')]=_0x5bfb93;return _0x5f53a0;})['then'](respondWithFilteredResult(_0x47078d,_0x5cedd1))['catch'](handleError(_0x47078d,null));};exports[_0x9498('0x3f')]=function(_0x410363,_0x31b1dc){var _0x42b971={'raw':!![],'where':{'id':_0x410363[_0x9498('0x40')]['id']}},_0x284874={};_0x284874[_0x9498('0x33')]=_[_0x9498('0x41')](db[_0x9498('0x2a')][_0x9498('0x2b')]);_0x284874[_0x9498('0x2f')]=_[_0x9498('0x41')](_0x410363['query']);_0x284874['filters']=_[_0x9498('0x32')](_0x284874[_0x9498('0x33')],_0x284874[_0x9498('0x2f')]);_0x42b971['attributes']=_[_0x9498('0x32')](_0x284874[_0x9498('0x33')],qs[_0x9498('0x34')](_0x410363['query'][_0x9498('0x34')]));_0x42b971[_0x9498('0x31')]=_0x42b971[_0x9498('0x31')][_0x9498('0x42')]?_0x42b971[_0x9498('0x31')]:_0x284874[_0x9498('0x33')];if(_0x410363[_0x9498('0x2f')][_0x9498('0x43')]){_0x42b971[_0x9498('0x44')]=[{'all':!![]}];}_0x42b971=_[_0x9498('0x3a')]({},_0x42b971,_0x410363['options']);return db[_0x9498('0x2a')]['find'](_0x42b971)[_0x9498('0x23')](handleEntityNotFound(_0x31b1dc,null))[_0x9498('0x23')](respondWithResult(_0x31b1dc,null))[_0x9498('0x45')](handleError(_0x31b1dc,null));};exports[_0x9498('0x46')]=function(_0x43af6d,_0x45a240){return db[_0x9498('0x2a')]['create'](_0x43af6d[_0x9498('0x47')],{})['then'](respondWithResult(_0x45a240,0xc9))['catch'](handleError(_0x45a240,null));};exports['update']=function(_0x192cf3,_0x12510f){if(_0x192cf3[_0x9498('0x47')]['id']){delete _0x192cf3['body']['id'];}return db[_0x9498('0x2a')][_0x9498('0x48')]({'where':{'id':_0x192cf3[_0x9498('0x40')]['id']}})['then'](handleEntityNotFound(_0x12510f,null))[_0x9498('0x23')](saveUpdates(_0x192cf3[_0x9498('0x47')],null))[_0x9498('0x23')](respondWithResult(_0x12510f,null))[_0x9498('0x45')](handleError(_0x12510f,null));};exports[_0x9498('0x49')]=function(_0x317206,_0x4789cd){return db['FaxTransferReport'][_0x9498('0x48')]({'where':{'id':_0x317206['params']['id']}})['then'](handleEntityNotFound(_0x4789cd,null))['then'](removeEntity(_0x4789cd,null))['catch'](handleError(_0x4789cd,null));};exports['describe']=function(_0x3fe12d,_0x1adbb0){return db[_0x9498('0x2a')]['describe']()['then'](respondWithResult(_0x1adbb0,null))[_0x9498('0x45')](handleError(_0x1adbb0,null));}; \ No newline at end of file +var _0xd5da=['filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','count','set','apply','save','update','then','destroy','end','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick'];(function(_0x207c93,_0x5027fd){var _0xd927f0=function(_0x15d14a){while(--_0x15d14a){_0x207c93['push'](_0x207c93['shift']());}};_0xd927f0(++_0x5027fd);}(_0xd5da,0x9f));var _0xad5d=function(_0x2d2823,_0x2c1e2f){_0x2d2823=_0x2d2823-0x0;var _0x339a27=_0xd5da[_0x2d2823];return _0x339a27;};'use strict';var pdf=require(_0xad5d('0x0'));var emlformat=require(_0xad5d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xad5d('0x2'));var jsonpatch=require(_0xad5d('0x3'));var rp=require(_0xad5d('0x4'));var moment=require('moment');var BPromise=require(_0xad5d('0x5'));var Mustache=require('mustache');var util=require(_0xad5d('0x6'));var path=require(_0xad5d('0x7'));var sox=require(_0xad5d('0x8'));var csv=require(_0xad5d('0x9'));var ejs=require(_0xad5d('0xa'));var fs=require('fs');var _=require(_0xad5d('0xb'));var squel=require(_0xad5d('0xc'));var crypto=require(_0xad5d('0xd'));var jsforce=require(_0xad5d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xad5d('0x9'));var querystring=require(_0xad5d('0xf'));var Papa=require('papaparse');var Redis=require(_0xad5d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xad5d('0x11'));var as=require(_0xad5d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad5d('0x13'))(_0xad5d('0x14'));var utils=require('../../config/utils');var config=require(_0xad5d('0x15'));var licenseUtil=require(_0xad5d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2afe2e,_0x5aa39f){_0x5aa39f=_0x5aa39f||0xcc;return function(_0x2473bc){if(_0x2473bc){return _0x2afe2e['sendStatus'](_0x5aa39f);}return _0x2afe2e[_0xad5d('0x17')](_0x5aa39f)['end']();};}function respondWithResult(_0x2b04b2,_0x5091e0){_0x5091e0=_0x5091e0||0xc8;return function(_0x16ef55){if(_0x16ef55){return _0x2b04b2[_0xad5d('0x17')](_0x5091e0)['json'](_0x16ef55);}};}function respondWithFilteredResult(_0x4bb9e5,_0x164280){return function(_0x589daa){if(_0x589daa){var _0x5061c3=_0x589daa[_0xad5d('0x18')],_0x4a2959=_0x164280['offset'],_0x8dd67c=_0x164280['offset']+_0x164280['limit'],_0xd747c3;if(_0x8dd67c>=_0x5061c3){_0x8dd67c=_0x5061c3;_0xd747c3=0xc8;}else{_0xd747c3=0xce;}_0x4bb9e5[_0xad5d('0x17')](_0xd747c3);return _0x4bb9e5[_0xad5d('0x19')]('Content-Range',_0x4a2959+'-'+_0x8dd67c+'/'+_0x5061c3)['json'](_0x589daa);}return null;};}function patchUpdates(_0x335c4d){return function(_0x5eaca6){try{jsonpatch[_0xad5d('0x1a')](_0x5eaca6,_0x335c4d,!![]);}catch(_0xde9f26){return BPromise['reject'](_0xde9f26);}return _0x5eaca6[_0xad5d('0x1b')]();};}function saveUpdates(_0x2d9d47,_0x41061d){return function(_0x5d45cb){if(_0x5d45cb){return _0x5d45cb[_0xad5d('0x1c')](_0x2d9d47)[_0xad5d('0x1d')](function(_0x220609){return _0x220609;});}return null;};}function removeEntity(_0x807de1,_0xffc852){return function(_0x53baa9){if(_0x53baa9){return _0x53baa9[_0xad5d('0x1e')]()[_0xad5d('0x1d')](function(){_0x807de1[_0xad5d('0x17')](0xcc)[_0xad5d('0x1f')]();});}};}function handleEntityNotFound(_0x37d139,_0x35e1a0){return function(_0x4d9e78){if(!_0x4d9e78){_0x37d139['sendStatus'](0x194);}return _0x4d9e78;};}function handleError(_0xcf402c,_0x443a8e){_0x443a8e=_0x443a8e||0x1f4;return function(_0xa90fe){logger['error'](_0xa90fe[_0xad5d('0x20')]);if(_0xa90fe[_0xad5d('0x21')]){delete _0xa90fe[_0xad5d('0x21')];}_0xcf402c[_0xad5d('0x17')](_0x443a8e)[_0xad5d('0x22')](_0xa90fe);};}exports[_0xad5d('0x23')]=function(_0x5e7959,_0x4ecf47){var _0x305c82={},_0x1b2b89={},_0x423bb8={'count':0x0,'rows':[]};var _0x4ed07c=_[_0xad5d('0x24')](db[_0xad5d('0x25')][_0xad5d('0x26')],function(_0x704d74){return{'name':_0x704d74[_0xad5d('0x27')],'type':_0x704d74[_0xad5d('0x28')][_0xad5d('0x29')]};});_0x1b2b89[_0xad5d('0x2a')]=_[_0xad5d('0x24')](_0x4ed07c,_0xad5d('0x21'));_0x1b2b89['query']=_[_0xad5d('0x2b')](_0x5e7959[_0xad5d('0x2c')]);_0x1b2b89[_0xad5d('0x2d')]=_[_0xad5d('0x2e')](_0x1b2b89[_0xad5d('0x2a')],_0x1b2b89['query']);_0x305c82['attributes']=_['intersection'](_0x1b2b89[_0xad5d('0x2a')],qs[_0xad5d('0x2f')](_0x5e7959[_0xad5d('0x2c')][_0xad5d('0x2f')]));_0x305c82['attributes']=_0x305c82['attributes']['length']?_0x305c82[_0xad5d('0x30')]:_0x1b2b89[_0xad5d('0x2a')];if(!_0x5e7959[_0xad5d('0x2c')][_0xad5d('0x31')](_0xad5d('0x32'))){_0x305c82[_0xad5d('0x33')]=qs[_0xad5d('0x33')](_0x5e7959[_0xad5d('0x2c')][_0xad5d('0x33')]);_0x305c82[_0xad5d('0x34')]=qs[_0xad5d('0x34')](_0x5e7959['query']['offset']);}_0x305c82[_0xad5d('0x35')]=qs['sort'](_0x5e7959[_0xad5d('0x2c')][_0xad5d('0x36')]);_0x305c82[_0xad5d('0x37')]=qs[_0xad5d('0x2d')](_[_0xad5d('0x38')](_0x5e7959['query'],_0x1b2b89[_0xad5d('0x2d')]),_0x4ed07c);if(_0x5e7959[_0xad5d('0x2c')][_0xad5d('0x39')]){_0x305c82['where']=_[_0xad5d('0x3a')](_0x305c82[_0xad5d('0x37')],{'$or':_['map'](_0x4ed07c,function(_0x5c0916){if(_0x5c0916[_0xad5d('0x28')]!==_0xad5d('0x3b')){var _0x4935cc={};_0x4935cc[_0x5c0916['name']]={'$like':'%'+_0x5e7959['query'][_0xad5d('0x39')]+'%'};return _0x4935cc;}})});}_0x305c82=_['merge']({},_0x305c82,_0x5e7959['options']);var _0x494f50={'where':_0x305c82['where']};return db[_0xad5d('0x25')][_0xad5d('0x18')](_0x494f50)[_0xad5d('0x1d')](function(_0x39def6){_0x423bb8['count']=_0x39def6;if(_0x5e7959[_0xad5d('0x2c')][_0xad5d('0x3c')]){_0x305c82[_0xad5d('0x3d')]=[{'all':!![]}];}return db[_0xad5d('0x25')][_0xad5d('0x3e')](_0x305c82);})[_0xad5d('0x1d')](function(_0x2e7c9b){_0x423bb8[_0xad5d('0x3f')]=_0x2e7c9b;return _0x423bb8;})[_0xad5d('0x1d')](respondWithFilteredResult(_0x4ecf47,_0x305c82))[_0xad5d('0x40')](handleError(_0x4ecf47,null));};exports[_0xad5d('0x41')]=function(_0x23b066,_0x2cc648){var _0x15de45={'raw':!![],'where':{'id':_0x23b066[_0xad5d('0x42')]['id']}},_0x57d870={};_0x57d870[_0xad5d('0x2a')]=_['keys'](db[_0xad5d('0x25')][_0xad5d('0x26')]);_0x57d870[_0xad5d('0x2c')]=_[_0xad5d('0x2b')](_0x23b066[_0xad5d('0x2c')]);_0x57d870[_0xad5d('0x2d')]=_[_0xad5d('0x2e')](_0x57d870[_0xad5d('0x2a')],_0x57d870[_0xad5d('0x2c')]);_0x15de45[_0xad5d('0x30')]=_['intersection'](_0x57d870[_0xad5d('0x2a')],qs[_0xad5d('0x2f')](_0x23b066[_0xad5d('0x2c')][_0xad5d('0x2f')]));_0x15de45[_0xad5d('0x30')]=_0x15de45['attributes']['length']?_0x15de45[_0xad5d('0x30')]:_0x57d870[_0xad5d('0x2a')];if(_0x23b066[_0xad5d('0x2c')]['includeAll']){_0x15de45[_0xad5d('0x3d')]=[{'all':!![]}];}_0x15de45=_['merge']({},_0x15de45,_0x23b066[_0xad5d('0x43')]);return db[_0xad5d('0x25')][_0xad5d('0x44')](_0x15de45)[_0xad5d('0x1d')](handleEntityNotFound(_0x2cc648,null))[_0xad5d('0x1d')](respondWithResult(_0x2cc648,null))[_0xad5d('0x40')](handleError(_0x2cc648,null));};exports['create']=function(_0x1cac96,_0x45d62b){return db['FaxTransferReport'][_0xad5d('0x45')](_0x1cac96[_0xad5d('0x46')],{})['then'](respondWithResult(_0x45d62b,0xc9))['catch'](handleError(_0x45d62b,null));};exports[_0xad5d('0x1c')]=function(_0x18f171,_0x15aeff){if(_0x18f171[_0xad5d('0x46')]['id']){delete _0x18f171[_0xad5d('0x46')]['id'];}return db[_0xad5d('0x25')][_0xad5d('0x44')]({'where':{'id':_0x18f171[_0xad5d('0x42')]['id']}})[_0xad5d('0x1d')](handleEntityNotFound(_0x15aeff,null))[_0xad5d('0x1d')](saveUpdates(_0x18f171['body'],null))[_0xad5d('0x1d')](respondWithResult(_0x15aeff,null))[_0xad5d('0x40')](handleError(_0x15aeff,null));};exports['destroy']=function(_0x43b1fc,_0xb4bef3){return db[_0xad5d('0x25')][_0xad5d('0x44')]({'where':{'id':_0x43b1fc[_0xad5d('0x42')]['id']}})['then'](handleEntityNotFound(_0xb4bef3,null))[_0xad5d('0x1d')](removeEntity(_0xb4bef3,null))['catch'](handleError(_0xb4bef3,null));};exports[_0xad5d('0x47')]=function(_0xef2508,_0x44875d){return db['FaxTransferReport'][_0xad5d('0x47')]()[_0xad5d('0x1d')](respondWithResult(_0x44875d,null))[_0xad5d('0x40')](handleError(_0x44875d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 006d8b3..70be453 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 _0x0b24=['uniqueid','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','report_fax_transfer'];(function(_0x13ffc8,_0x390fd1){var _0x1b59bd=function(_0x440d8a){while(--_0x440d8a){_0x13ffc8['push'](_0x13ffc8['shift']());}};_0x1b59bd(++_0x390fd1);}(_0x0b24,0x19b));var _0x40b2=function(_0x1a8324,_0x28cf6a){_0x1a8324=_0x1a8324-0x0;var _0x1724d7=_0x0b24[_0x1a8324];return _0x1724d7;};'use strict';var _=require('lodash');var util=require(_0x40b2('0x0'));var logger=require('../../config/logger')(_0x40b2('0x1'));var moment=require(_0x40b2('0x2'));var BPromise=require('bluebird');var rp=require(_0x40b2('0x3'));var fs=require('fs');var path=require(_0x40b2('0x4'));var rimraf=require(_0x40b2('0x5'));var config=require(_0x40b2('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0x40b2('0x7')]=function(_0x90ece2,_0x367238){return _0x90ece2['define']('FaxTransferReport',attributes,{'tableName':_0x40b2('0x8'),'paranoid':![],'indexes':[{'name':_0x40b2('0x9'),'fields':[_0x40b2('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa07f=['path','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','lodash','util','moment','request-promise'];(function(_0x3111fe,_0xab1823){var _0x78bfb9=function(_0x1f0dab){while(--_0x1f0dab){_0x3111fe['push'](_0x3111fe['shift']());}};_0x78bfb9(++_0xab1823);}(_0xa07f,0x11e));var _0xfa07=function(_0x5b6aab,_0x3648e2){_0x5b6aab=_0x5b6aab-0x0;var _0x410ad9=_0xa07f[_0x5b6aab];return _0x410ad9;};'use strict';var _=require(_0xfa07('0x0'));var util=require(_0xfa07('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfa07('0x2'));var BPromise=require('bluebird');var rp=require(_0xfa07('0x3'));var fs=require('fs');var path=require(_0xfa07('0x4'));var rimraf=require('rimraf');var config=require(_0xfa07('0x5'));var attributes=require(_0xfa07('0x6'));module[_0xfa07('0x7')]=function(_0x4ebf04,_0x688880){return _0x4ebf04['define'](_0xfa07('0x8'),attributes,{'tableName':_0xfa07('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 52f625f..4445309 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 _0x150d=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0x150d,0x87));var _0xd150=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0x150d[_0x5c6022];return _0x4ab5af;};'use strict';var _=require(_0xd150('0x0'));var util=require(_0xd150('0x1'));var moment=require(_0xd150('0x2'));var BPromise=require('bluebird');var rs=require(_0xd150('0x3'));var fs=require('fs');var Redis=require(_0xd150('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd150('0x5'))(_0xd150('0x6'));var config=require(_0xd150('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd150('0x8')][_0xd150('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34adfc,_0x3296da,_0x359e6a){return new BPromise(function(_0x22f268,_0x507e1b){return client['request'](_0x34adfc,_0x359e6a)['then'](function(_0x3a8b0c){logger[_0xd150('0xa')](_0xd150('0xb'),_0x3296da,_0xd150('0xc'));logger['debug'](_0xd150('0xd'),_0x3296da,'request\x20sent',JSON[_0xd150('0xe')](_0x3a8b0c));if(_0x3a8b0c[_0xd150('0xf')]){if(_0x3a8b0c[_0xd150('0xf')]['code']===0x1f4){logger[_0xd150('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x3296da,_0x3a8b0c['error'][_0xd150('0x10')]);return _0x507e1b(_0x3a8b0c[_0xd150('0xf')][_0xd150('0x10')]);}logger['error'](_0xd150('0xb'),_0x3296da,_0x3a8b0c['error'][_0xd150('0x10')]);return _0x22f268(_0x3a8b0c['error'][_0xd150('0x10')]);}else{logger[_0xd150('0xa')]('FaxTransferReport,\x20%s,\x20%s',_0x3296da,'request\x20sent');_0x22f268(_0x3a8b0c[_0xd150('0x11')][_0xd150('0x10')]);}})[_0xd150('0x12')](function(_0x268d79){logger[_0xd150('0xf')](_0xd150('0xb'),_0x3296da,_0x268d79);_0x507e1b(_0x268d79);});});} \ No newline at end of file +var _0x5b58=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x10c239,_0xcab106){var _0x5a4ac4=function(_0x155c1f){while(--_0x155c1f){_0x10c239['push'](_0x10c239['shift']());}};_0x5a4ac4(++_0xcab106);}(_0x5b58,0x140));var _0x85b5=function(_0x3d2580,_0x5bcf59){_0x3d2580=_0x3d2580-0x0;var _0x1bed34=_0x5b58[_0x3d2580];return _0x1bed34;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x85b5('0x0'));var rs=require(_0x85b5('0x1'));var fs=require('fs');var Redis=require(_0x85b5('0x2'));var db=require(_0x85b5('0x3'))['db'];var utils=require(_0x85b5('0x4'));var logger=require(_0x85b5('0x5'))(_0x85b5('0x6'));var config=require(_0x85b5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x85b5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x747023,_0x137d4c,_0xb1752){return new BPromise(function(_0x4551b1,_0x471409){return client[_0x85b5('0x9')](_0x747023,_0xb1752)[_0x85b5('0xa')](function(_0x52ddae){logger['info'](_0x85b5('0xb'),_0x137d4c,_0x85b5('0xc'));logger[_0x85b5('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x137d4c,_0x85b5('0xc'),JSON[_0x85b5('0xe')](_0x52ddae));if(_0x52ddae[_0x85b5('0xf')]){if(_0x52ddae[_0x85b5('0xf')][_0x85b5('0x10')]===0x1f4){logger[_0x85b5('0xf')](_0x85b5('0xb'),_0x137d4c,_0x52ddae[_0x85b5('0xf')][_0x85b5('0x11')]);return _0x471409(_0x52ddae[_0x85b5('0xf')]['message']);}logger[_0x85b5('0xf')](_0x85b5('0xb'),_0x137d4c,_0x52ddae[_0x85b5('0xf')][_0x85b5('0x11')]);return _0x4551b1(_0x52ddae['error'][_0x85b5('0x11')]);}else{logger[_0x85b5('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x137d4c,_0x85b5('0xc'));_0x4551b1(_0x52ddae[_0x85b5('0x13')][_0x85b5('0x11')]);}})['catch'](function(_0xf8d823){logger[_0x85b5('0xf')](_0x85b5('0xb'),_0x137d4c,_0xf8d823);_0x471409(_0xf8d823);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 640db5e..619cce7 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 _0xf67a=['../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x24ba1b,_0x5a04b6){var _0x56ed27=function(_0x278406){while(--_0x278406){_0x24ba1b['push'](_0x24ba1b['shift']());}};_0x56ed27(++_0x5a04b6);}(_0xf67a,0xad));var _0xaf67=function(_0x366de1,_0x3092bd){_0x366de1=_0x366de1-0x0;var _0x482a4b=_0xf67a[_0x366de1];return _0x482a4b;};'use strict';var multer=require(_0xaf67('0x0'));var util=require(_0xaf67('0x1'));var path=require(_0xaf67('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf67('0x3'));var router=express[_0xaf67('0x4')]();var auth=require(_0xaf67('0x5'));var interaction=require(_0xaf67('0x6'));var config=require(_0xaf67('0x7'));var controller=require(_0xaf67('0x8'));router['get']('/',auth[_0xaf67('0x9')](),controller[_0xaf67('0xa')]);router[_0xaf67('0xb')](_0xaf67('0xc'),auth[_0xaf67('0x9')](),controller[_0xaf67('0xd')]);router['get'](_0xaf67('0xe'),auth[_0xaf67('0x9')](),controller['show']);router[_0xaf67('0xf')]('/',auth[_0xaf67('0x9')](),controller[_0xaf67('0x10')]);router[_0xaf67('0x11')](_0xaf67('0xe'),auth[_0xaf67('0x9')](),controller['update']);router[_0xaf67('0x12')](_0xaf67('0xe'),auth[_0xaf67('0x9')](),controller['destroy']);module[_0xaf67('0x13')]=router; \ No newline at end of file +var _0x9ada=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','util','path','connect-timeout','express','Router'];(function(_0x43162c,_0x2bb61d){var _0x5e4748=function(_0x320073){while(--_0x320073){_0x43162c['push'](_0x43162c['shift']());}};_0x5e4748(++_0x2bb61d);}(_0x9ada,0x12d));var _0xa9ad=function(_0x1dcf51,_0x1c8313){_0x1dcf51=_0x1dcf51-0x0;var _0x1d3d5c=_0x9ada[_0x1dcf51];return _0x1d3d5c;};'use strict';var multer=require('multer');var util=require(_0xa9ad('0x0'));var path=require(_0xa9ad('0x1'));var timeout=require(_0xa9ad('0x2'));var express=require(_0xa9ad('0x3'));var router=express[_0xa9ad('0x4')]();var auth=require(_0xa9ad('0x5'));var interaction=require(_0xa9ad('0x6'));var config=require(_0xa9ad('0x7'));var controller=require('./faxTransferReport.controller');router[_0xa9ad('0x8')]('/',auth[_0xa9ad('0x9')](),controller[_0xa9ad('0xa')]);router['get'](_0xa9ad('0xb'),auth[_0xa9ad('0x9')](),controller[_0xa9ad('0xc')]);router[_0xa9ad('0x8')](_0xa9ad('0xd'),auth[_0xa9ad('0x9')](),controller['show']);router['post']('/',auth[_0xa9ad('0x9')](),controller[_0xa9ad('0xe')]);router[_0xa9ad('0xf')](_0xa9ad('0xd'),auth[_0xa9ad('0x9')](),controller[_0xa9ad('0x10')]);router['delete']('/:id',auth[_0xa9ad('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index a4ff677..4c3a022 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 _0x9f7b=['exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','delete','destroy'];(function(_0x1c081d,_0x10b432){var _0x2deb0e=function(_0x43fcbd){while(--_0x43fcbd){_0x1c081d['push'](_0x1c081d['shift']());}};_0x2deb0e(++_0x10b432);}(_0x9f7b,0xbe));var _0xb9f7=function(_0x177058,_0x5ce4cc){_0x177058=_0x177058-0x0;var _0x394248=_0x9f7b[_0x177058];return _0x394248;};'use strict';var multer=require(_0xb9f7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9f7('0x1'));var router=express[_0xb9f7('0x2')]();var auth=require(_0xb9f7('0x3'));var interaction=require(_0xb9f7('0x4'));var config=require(_0xb9f7('0x5'));var controller=require(_0xb9f7('0x6'));router[_0xb9f7('0x7')]('/',auth['isAuthenticated'](),controller[_0xb9f7('0x8')]);router['get'](_0xb9f7('0x9'),auth[_0xb9f7('0xa')](),controller[_0xb9f7('0xb')]);router[_0xb9f7('0x7')](_0xb9f7('0xc'),auth[_0xb9f7('0xa')](),controller[_0xb9f7('0xd')]);router[_0xb9f7('0x7')](_0xb9f7('0xe'),auth[_0xb9f7('0xa')](),controller[_0xb9f7('0xf')]);router['post']('/',auth[_0xb9f7('0xa')](),controller[_0xb9f7('0x10')]);router[_0xb9f7('0x11')](_0xb9f7('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0xb9f7('0xa')](),controller['update']);router[_0xb9f7('0x12')](_0xb9f7('0x9'),auth[_0xb9f7('0xa')](),controller[_0xb9f7('0x13')]);module[_0xb9f7('0x14')]=router; \ No newline at end of file +var _0x6c53=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intDeskAccount.controller','index','isAuthenticated','show','/:id/configurations','getConfigurations','get','getFields','post','create','/:id','update','delete','destroy'];(function(_0x2c0a07,_0x56553b){var _0x515ba5=function(_0x384f1e){while(--_0x384f1e){_0x2c0a07['push'](_0x2c0a07['shift']());}};_0x515ba5(++_0x56553b);}(_0x6c53,0x177));var _0x36c5=function(_0x1b4e27,_0x1c8b2f){_0x1b4e27=_0x1b4e27-0x0;var _0x22fd1f=_0x6c53[_0x1b4e27];return _0x22fd1f;};'use strict';var multer=require(_0x36c5('0x0'));var util=require(_0x36c5('0x1'));var path=require(_0x36c5('0x2'));var timeout=require(_0x36c5('0x3'));var express=require(_0x36c5('0x4'));var router=express[_0x36c5('0x5')]();var auth=require(_0x36c5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x36c5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x36c5('0x8')]);router['get']('/:id',auth[_0x36c5('0x9')](),controller[_0x36c5('0xa')]);router['get'](_0x36c5('0xb'),auth['isAuthenticated'](),controller[_0x36c5('0xc')]);router[_0x36c5('0xd')]('/:id/fields',auth['isAuthenticated'](),controller[_0x36c5('0xe')]);router[_0x36c5('0xf')]('/',auth['isAuthenticated'](),controller[_0x36c5('0x10')]);router[_0x36c5('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x36c5('0x11'),auth['isAuthenticated'](),controller[_0x36c5('0x12')]);router[_0x36c5('0x13')]('/:id',auth[_0x36c5('0x9')](),controller[_0x36c5('0x14')]);module[_0x36c5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ca2293e..7746c8c 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 _0x7462=['sequelize','exports','STRING','basic','ENUM','integrationTab','newTab'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x7462,0x165));var _0x2746=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x7462[_0x1e3c16];return _0x47a0c9;};'use strict';var Sequelize=require(_0x2746('0x0'));module[_0x2746('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2746('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x2746('0x3')),'defaultValue':_0x2746('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x2746('0x2')]},'consumerSecret':{'type':Sequelize[_0x2746('0x2')]},'token':{'type':Sequelize[_0x2746('0x2')]},'tokenSecret':{'type':Sequelize[_0x2746('0x2')]},'serverUrl':{'type':Sequelize[_0x2746('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2746('0x4')](_0x2746('0x5'),_0x2746('0x6')),'defaultValue':_0x2746('0x5')}}; \ No newline at end of file +var _0xbd9f=['STRING','basic','ENUM','integrationTab'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbd9f,0x98));var _0xfbd9=function(_0x510be7,_0x2eba08){_0x510be7=_0x510be7-0x0;var _0x17af2d=_0xbd9f[_0x510be7];return _0x17af2d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfbd9('0x0')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfbd9('0x0')]},'authType':{'type':Sequelize['ENUM'](_0xfbd9('0x1')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xfbd9('0x0')]},'consumerKey':{'type':Sequelize[_0xfbd9('0x0')]},'consumerSecret':{'type':Sequelize[_0xfbd9('0x0')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xfbd9('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfbd9('0x2')](_0xfbd9('0x3'),'newTab'),'defaultValue':_0xfbd9('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 6dc175d..f662287 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 _0xacf3=['../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','save','destroy','sendStatus','name','index','map','DeskAccount','fieldName','type','key','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','rows','show','rawAttributes','create','update','body','find','params','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','getFields','priority','remoteUri','username','consumerKey','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','authType','basic','headers','format','Basic\x20%s','password','base64','concat','_embedded','entries','label','test','getFields,\x20%s,\x20%s,\x20%s','send','statusCode','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xacf3,0x152));var _0x3acf=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xacf3[_0x46e363];return _0x3fb059;};'use strict';var pdf=require(_0x3acf('0x0'));var emlformat=require(_0x3acf('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3acf('0x2'));var rp=require(_0x3acf('0x3'));var moment=require(_0x3acf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3acf('0x5'));var util=require(_0x3acf('0x6'));var path=require(_0x3acf('0x7'));var sox=require(_0x3acf('0x8'));var csv=require(_0x3acf('0x9'));var ejs=require(_0x3acf('0xa'));var fs=require('fs');var _=require(_0x3acf('0xb'));var squel=require(_0x3acf('0xc'));var crypto=require(_0x3acf('0xd'));var jsforce=require(_0x3acf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3acf('0x9'));var querystring=require('querystring');var Papa=require(_0x3acf('0xf'));var Redis=require(_0x3acf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3acf('0x11'));var as=require(_0x3acf('0x12'));var hardwareService=require(_0x3acf('0x13'));var logger=require('../../config/logger')(_0x3acf('0x14'));var utils=require('../../config/utils');var config=require(_0x3acf('0x15'));var licenseUtil=require(_0x3acf('0x16'));var db=require(_0x3acf('0x17'))['db'];var integrations=require(_0x3acf('0x18'));var jayson=require(_0x3acf('0x19'));var client=jayson['client'][_0x3acf('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3164fb,_0x58205b,_0x4fb41f,_0x154170){return new BPromise(function(_0xef65b9,_0x52f371){var _0x172814=_0x154170||client;return _0x172814[_0x3acf('0x1b')](_0x3164fb,_0x4fb41f)[_0x3acf('0x1c')](function(_0x2de7c6){logger[_0x3acf('0x1d')](_0x3acf('0x1e'),_0x58205b,_0x3acf('0x1f'));logger['debug'](_0x3acf('0x20'),_0x58205b,_0x3acf('0x1f'),JSON[_0x3acf('0x21')](_0x2de7c6));if(_0x2de7c6['error']){if(_0x2de7c6[_0x3acf('0x22')][_0x3acf('0x23')]===0x1f4){logger[_0x3acf('0x22')](_0x3acf('0x1e'),_0x58205b,_0x2de7c6[_0x3acf('0x22')][_0x3acf('0x24')]);return _0x52f371(_0x2de7c6['error']['message']);}logger[_0x3acf('0x22')](_0x3acf('0x1e'),_0x58205b,_0x2de7c6[_0x3acf('0x22')][_0x3acf('0x24')]);return _0xef65b9(_0x2de7c6[_0x3acf('0x22')][_0x3acf('0x24')]);}else{logger['info'](_0x3acf('0x1e'),_0x58205b,_0x3acf('0x1f'));_0xef65b9(_0x2de7c6[_0x3acf('0x25')][_0x3acf('0x24')]);}})[_0x3acf('0x26')](function(_0x182030){logger[_0x3acf('0x22')]('DeskAccount,\x20%s,\x20%s',_0x58205b,_0x182030);_0x52f371(_0x182030);});});}function respondWithStatusCode(_0x55076b,_0x1c8da3){_0x1c8da3=_0x1c8da3||0xcc;return function(_0x18a0b9){if(_0x18a0b9){return _0x55076b['sendStatus'](_0x1c8da3);}return _0x55076b['status'](_0x1c8da3)[_0x3acf('0x27')]();};}function respondWithResult(_0xeae2f8,_0x27ddd4){_0x27ddd4=_0x27ddd4||0xc8;return function(_0x4f8c01){if(_0x4f8c01){return _0xeae2f8[_0x3acf('0x28')](_0x27ddd4)[_0x3acf('0x29')](_0x4f8c01);}};}function respondWithFilteredResult(_0x1a7eb9,_0x33a645){return function(_0x22e921){if(_0x22e921){var _0x41050e=_0x22e921[_0x3acf('0x2a')],_0x1e2ad0=_0x33a645[_0x3acf('0x2b')],_0x5f3cc1=_0x33a645[_0x3acf('0x2b')]+_0x33a645[_0x3acf('0x2c')],_0x5118e9;if(_0x5f3cc1>=_0x41050e){_0x5f3cc1=_0x41050e;_0x5118e9=0xc8;}else{_0x5118e9=0xce;}_0x1a7eb9['status'](_0x5118e9);return _0x1a7eb9[_0x3acf('0x2d')](_0x3acf('0x2e'),_0x1e2ad0+'-'+_0x5f3cc1+'/'+_0x41050e)[_0x3acf('0x29')](_0x22e921);}return null;};}function patchUpdates(_0x378a75){return function(_0x3f2651){try{jsonpatch[_0x3acf('0x2f')](_0x3f2651,_0x378a75,!![]);}catch(_0x1fa344){return BPromise['reject'](_0x1fa344);}return _0x3f2651[_0x3acf('0x30')]();};}function saveUpdates(_0x555f6c,_0x170d0f){return function(_0xcb4a97){if(_0xcb4a97){return _0xcb4a97['update'](_0x555f6c)[_0x3acf('0x1c')](function(_0xb3e7c9){return _0xb3e7c9;});}return null;};}function removeEntity(_0x3e18d0,_0x504eb5){return function(_0x4d6781){if(_0x4d6781){return _0x4d6781[_0x3acf('0x31')]()[_0x3acf('0x1c')](function(){_0x3e18d0[_0x3acf('0x28')](0xcc)[_0x3acf('0x27')]();});}};}function handleEntityNotFound(_0xb906e7,_0x1f17a1){return function(_0x2502f8){if(!_0x2502f8){_0xb906e7[_0x3acf('0x32')](0x194);}return _0x2502f8;};}function handleError(_0x398d3f,_0x494732){_0x494732=_0x494732||0x1f4;return function(_0x43a015){logger[_0x3acf('0x22')](_0x43a015['stack']);if(_0x43a015[_0x3acf('0x33')]){delete _0x43a015[_0x3acf('0x33')];}_0x398d3f['status'](_0x494732)['send'](_0x43a015);};}exports[_0x3acf('0x34')]=function(_0x3cbc98,_0x5f2f26){var _0x4357f7={},_0x56e30e={},_0x564ff1={'count':0x0,'rows':[]};var _0x286af8=_[_0x3acf('0x35')](db[_0x3acf('0x36')]['rawAttributes'],function(_0x333acb){return{'name':_0x333acb[_0x3acf('0x37')],'type':_0x333acb[_0x3acf('0x38')][_0x3acf('0x39')]};});_0x56e30e['model']=_['map'](_0x286af8,_0x3acf('0x33'));_0x56e30e['query']=_[_0x3acf('0x3a')](_0x3cbc98['query']);_0x56e30e[_0x3acf('0x3b')]=_['intersection'](_0x56e30e[_0x3acf('0x3c')],_0x56e30e[_0x3acf('0x3d')]);_0x4357f7[_0x3acf('0x3e')]=_[_0x3acf('0x3f')](_0x56e30e[_0x3acf('0x3c')],qs[_0x3acf('0x40')](_0x3cbc98['query']['fields']));_0x4357f7[_0x3acf('0x3e')]=_0x4357f7[_0x3acf('0x3e')][_0x3acf('0x41')]?_0x4357f7[_0x3acf('0x3e')]:_0x56e30e[_0x3acf('0x3c')];if(!_0x3cbc98['query'][_0x3acf('0x42')](_0x3acf('0x43'))){_0x4357f7[_0x3acf('0x2c')]=qs[_0x3acf('0x2c')](_0x3cbc98[_0x3acf('0x3d')][_0x3acf('0x2c')]);_0x4357f7[_0x3acf('0x2b')]=qs[_0x3acf('0x2b')](_0x3cbc98['query'][_0x3acf('0x2b')]);}_0x4357f7[_0x3acf('0x44')]=qs[_0x3acf('0x45')](_0x3cbc98['query'][_0x3acf('0x45')]);_0x4357f7[_0x3acf('0x46')]=qs[_0x3acf('0x3b')](_['pick'](_0x3cbc98[_0x3acf('0x3d')],_0x56e30e[_0x3acf('0x3b')]),_0x286af8);if(_0x3cbc98['query'][_0x3acf('0x47')]){_0x4357f7[_0x3acf('0x46')]=_[_0x3acf('0x48')](_0x4357f7['where'],{'$or':_[_0x3acf('0x35')](_0x286af8,function(_0x63fb6d){if(_0x63fb6d['type']!=='VIRTUAL'){var _0x45c86b={};_0x45c86b[_0x63fb6d[_0x3acf('0x33')]]={'$like':'%'+_0x3cbc98[_0x3acf('0x3d')][_0x3acf('0x47')]+'%'};return _0x45c86b;}})});}_0x4357f7=_[_0x3acf('0x48')]({},_0x4357f7,_0x3cbc98[_0x3acf('0x49')]);var _0x117627={'where':_0x4357f7[_0x3acf('0x46')]};return db[_0x3acf('0x36')][_0x3acf('0x2a')](_0x117627)[_0x3acf('0x1c')](function(_0x3b5660){_0x564ff1['count']=_0x3b5660;if(_0x3cbc98[_0x3acf('0x3d')][_0x3acf('0x4a')]){_0x4357f7['include']=[{'all':!![]}];}return db[_0x3acf('0x36')]['findAll'](_0x4357f7);})[_0x3acf('0x1c')](function(_0x41d8b4){_0x564ff1[_0x3acf('0x4b')]=_0x41d8b4;return _0x564ff1;})[_0x3acf('0x1c')](respondWithFilteredResult(_0x5f2f26,_0x4357f7))[_0x3acf('0x26')](handleError(_0x5f2f26,null));};exports[_0x3acf('0x4c')]=function(_0x138801,_0x34f9ae){var _0x1d00ba={'raw':![],'where':{'id':_0x138801['params']['id']}},_0x321639={};_0x321639[_0x3acf('0x3c')]=_[_0x3acf('0x3a')](db[_0x3acf('0x36')][_0x3acf('0x4d')]);_0x321639[_0x3acf('0x3d')]=_[_0x3acf('0x3a')](_0x138801[_0x3acf('0x3d')]);_0x321639[_0x3acf('0x3b')]=_[_0x3acf('0x3f')](_0x321639[_0x3acf('0x3c')],_0x321639['query']);_0x1d00ba[_0x3acf('0x3e')]=_['intersection'](_0x321639[_0x3acf('0x3c')],qs[_0x3acf('0x40')](_0x138801['query'][_0x3acf('0x40')]));_0x1d00ba['attributes']=_0x1d00ba['attributes'][_0x3acf('0x41')]?_0x1d00ba['attributes']:_0x321639['model'];if(_0x138801['query'][_0x3acf('0x4a')]){_0x1d00ba['include']=[{'all':!![]}];}_0x1d00ba=_['merge']({},_0x1d00ba,_0x138801[_0x3acf('0x49')]);return db['DeskAccount']['find'](_0x1d00ba)[_0x3acf('0x1c')](handleEntityNotFound(_0x34f9ae,null))[_0x3acf('0x1c')](respondWithResult(_0x34f9ae,null))[_0x3acf('0x26')](handleError(_0x34f9ae,null));};exports[_0x3acf('0x4e')]=function(_0xcfe728,_0x41a3d9){return db[_0x3acf('0x36')]['create'](_0xcfe728['body'],{})[_0x3acf('0x1c')](respondWithResult(_0x41a3d9,0xc9))[_0x3acf('0x26')](handleError(_0x41a3d9,null));};exports[_0x3acf('0x4f')]=function(_0x53bd71,_0x2cb6b9){if(_0x53bd71[_0x3acf('0x50')]['id']){delete _0x53bd71[_0x3acf('0x50')]['id'];}return db['DeskAccount'][_0x3acf('0x51')]({'where':{'id':_0x53bd71[_0x3acf('0x52')]['id']}})[_0x3acf('0x1c')](handleEntityNotFound(_0x2cb6b9,null))['then'](saveUpdates(_0x53bd71[_0x3acf('0x50')],null))['then'](respondWithResult(_0x2cb6b9,null))[_0x3acf('0x26')](handleError(_0x2cb6b9,null));};exports[_0x3acf('0x31')]=function(_0x296386,_0x505b18){return db[_0x3acf('0x36')][_0x3acf('0x51')]({'where':{'id':_0x296386[_0x3acf('0x52')]['id']}})['then'](handleEntityNotFound(_0x505b18,null))[_0x3acf('0x1c')](removeEntity(_0x505b18,null))[_0x3acf('0x26')](handleError(_0x505b18,null));};exports[_0x3acf('0x53')]=function(_0x4d3a86,_0x46859c,_0x5f4a62){var _0x4fa401={};var _0x5cc1e7={};var _0x395944;var _0x4020fa;return db['DeskAccount'][_0x3acf('0x54')]({'where':{'id':_0x4d3a86[_0x3acf('0x52')]['id']}})['then'](handleEntityNotFound(_0x46859c,null))['then'](function(_0x37d2d3){if(_0x37d2d3){_0x395944=_0x37d2d3;_0x5cc1e7['model']=_[_0x3acf('0x3a')](db[_0x3acf('0x55')][_0x3acf('0x4d')]);_0x5cc1e7[_0x3acf('0x3d')]=_[_0x3acf('0x3a')](_0x4d3a86[_0x3acf('0x3d')]);_0x5cc1e7[_0x3acf('0x3b')]=_[_0x3acf('0x3f')](_0x5cc1e7[_0x3acf('0x3c')],_0x5cc1e7[_0x3acf('0x3d')]);_0x4fa401[_0x3acf('0x3e')]=_[_0x3acf('0x3f')](_0x5cc1e7[_0x3acf('0x3c')],qs[_0x3acf('0x40')](_0x4d3a86[_0x3acf('0x3d')][_0x3acf('0x40')]));_0x4fa401[_0x3acf('0x3e')]=_0x4fa401[_0x3acf('0x3e')]['length']?_0x4fa401[_0x3acf('0x3e')]:_0x5cc1e7[_0x3acf('0x3c')];_0x4fa401[_0x3acf('0x44')]=qs['sort'](_0x4d3a86[_0x3acf('0x3d')][_0x3acf('0x45')]);_0x4fa401['where']=qs[_0x3acf('0x3b')](_['pick'](_0x4d3a86['query'],_0x5cc1e7[_0x3acf('0x3b')]));if(_0x4d3a86[_0x3acf('0x3d')][_0x3acf('0x47')]){_0x4fa401[_0x3acf('0x46')]=_[_0x3acf('0x48')](_0x4fa401[_0x3acf('0x46')],{'$or':_[_0x3acf('0x35')](_0x4fa401[_0x3acf('0x3e')],function(_0x4e1ac8){var _0x494ee9={};_0x494ee9[_0x4e1ac8]={'$like':'%'+_0x4d3a86[_0x3acf('0x3d')][_0x3acf('0x47')]+'%'};return _0x494ee9;})});}_0x4fa401=_[_0x3acf('0x48')]({},_0x4fa401,_0x4d3a86[_0x3acf('0x49')]);return _0x395944['getConfigurations'](_0x4fa401);}})['then'](function(_0x1897c3){if(_0x1897c3){_0x4020fa=_0x1897c3[_0x3acf('0x41')];if(!_0x4d3a86[_0x3acf('0x3d')][_0x3acf('0x42')](_0x3acf('0x43'))){_0x4fa401['limit']=qs[_0x3acf('0x2c')](_0x4d3a86['query'][_0x3acf('0x2c')]);_0x4fa401['offset']=qs[_0x3acf('0x2b')](_0x4d3a86[_0x3acf('0x3d')][_0x3acf('0x2b')]);}return _0x395944[_0x3acf('0x53')](_0x4fa401);}})[_0x3acf('0x1c')](function(_0x55e82e){if(_0x55e82e){return _0x55e82e?{'count':_0x4020fa,'rows':_0x55e82e}:null;}})[_0x3acf('0x1c')](respondWithResult(_0x46859c,null))[_0x3acf('0x26')](handleError(_0x46859c,null));};exports['addConfiguration']=function(_0x208571,_0x1b8210,_0x505b6b){if(_0x208571['body']['id']){delete _0x208571[_0x3acf('0x50')]['id'];}return db[_0x3acf('0x36')][_0x3acf('0x54')]({'where':{'id':_0x208571[_0x3acf('0x52')]['id']}})['then'](handleEntityNotFound(_0x1b8210,null))['then'](function(_0x341911){if(_0x341911){_0x208571[_0x3acf('0x50')][_0x3acf('0x56')]=_0x341911['id'];_0x208571['body'][_0x3acf('0x57')]=integrations[_0x3acf('0x58')](_0x208571['body'][_0x3acf('0x59')],_0x208571['body'][_0x3acf('0x38')]);_0x208571[_0x3acf('0x50')]['Descriptions']=integrations[_0x3acf('0x5a')](_0x208571[_0x3acf('0x50')][_0x3acf('0x59')],_0x208571['body'][_0x3acf('0x38')]);return db[_0x3acf('0x55')]['create'](_0x208571[_0x3acf('0x50')],{'include':[{'model':db[_0x3acf('0x5b')],'as':_0x3acf('0x57')},{'model':db[_0x3acf('0x5b')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1b8210,null))['catch'](handleError(_0x1b8210,null));};exports[_0x3acf('0x5c')]=function(_0x3b3de7,_0x2a2d14,_0x118533){var _0x546719=[{'name':_0x3acf('0x5d'),'label':_0x3acf('0x5d'),'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 _0x5051b4='';return db[_0x3acf('0x36')]['findOne']({'where':{'id':_0x3b3de7[_0x3acf('0x52')]['id']},'attributes':['id',_0x3acf('0x5e'),'authType',_0x3acf('0x5f'),'password',_0x3acf('0x60'),'consumerSecret',_0x3acf('0x61'),_0x3acf('0x62')]})[_0x3acf('0x1c')](handleEntityNotFound(_0x2a2d14,null))[_0x3acf('0x1c')](function(_0x4b7dbf){if(_0x4b7dbf){_0x5051b4=_0x4b7dbf['remoteUri'];var _0x109d3f=_0x5051b4[_0x3acf('0x63')](-0x1);if(_0x109d3f==='/'){_0x5051b4=_0x5051b4[_0x3acf('0x64')](0x0,_0x5051b4[_0x3acf('0x65')](_0x109d3f));}var _0x348260={'method':_0x3acf('0x66'),'uri':util['format'](_0x3acf('0x67'),_0x5051b4),'headers':{'Content-Type':_0x3acf('0x68'),'Accept':_0x3acf('0x68')},'json':!![]};if(_0x4b7dbf[_0x3acf('0x69')]===_0x3acf('0x6a')){_0x348260[_0x3acf('0x6b')]['Authorization']=util[_0x3acf('0x6c')](_0x3acf('0x6d'),new Buffer(util[_0x3acf('0x6c')]('%s:%s',_0x4b7dbf[_0x3acf('0x5f')],_0x4b7dbf[_0x3acf('0x6e')]))['toString'](_0x3acf('0x6f')));}return rp(_0x348260)[_0x3acf('0x1c')](function(_0x144563){return _0x546719[_0x3acf('0x70')](_[_0x3acf('0x35')](_0x144563[_0x3acf('0x71')][_0x3acf('0x72')],function(_0x1dcb40){return{'id':_0x1dcb40['name'],'name':_0x1dcb40['name'],'type':_0x1dcb40['type'],'active':_0x1dcb40['active'],'label':_0x1dcb40[_0x3acf('0x73')],'custom':!![]};}));});}})[_0x3acf('0x1c')](function(_0x592dfe){return{'count':_0x592dfe[_0x3acf('0x41')],'rows':_0x592dfe};})[_0x3acf('0x1c')](respondWithResult(_0x2a2d14,null))[_0x3acf('0x26')](function(_0x331c2d){var _0xc23050=_0x3b3de7[_0x3acf('0x3d')][_0x3acf('0x74')]?0x1f4:_0x331c2d['statusCode']||0x1f4;logger['error'](_0x3acf('0x75'),_0x3acf('0x5c'),_0xc23050,JSON[_0x3acf('0x21')](_0x331c2d));delete _0x331c2d[_0x3acf('0x33')];if(_0xc23050===0x191){_0xc23050=0x190;}_0x2a2d14[_0x3acf('0x28')](_0xc23050)[_0x3acf('0x76')](_0x3b3de7['query'][_0x3acf('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x331c2d[_0x3acf('0x77')]}:_0x331c2d);});}; \ No newline at end of file +var _0xcac0=['index','map','DeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','params','length','find','create','body','getConfigurations','DeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','DeskField','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','slice','substring','GET','%s/custom_fields','application/json','basic','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','stack','name','send'];(function(_0x5eb545,_0x2b0213){var _0x566aa3=function(_0x296898){while(--_0x296898){_0x5eb545['push'](_0x5eb545['shift']());}};_0x566aa3(++_0x2b0213);}(_0xcac0,0x133));var _0x0cac=function(_0x8d24d9,_0x5dd3f2){_0x8d24d9=_0x8d24d9-0x0;var _0x20a517=_0xcac0[_0x8d24d9];return _0x20a517;};'use strict';var pdf=require(_0x0cac('0x0'));var emlformat=require(_0x0cac('0x1'));var rimraf=require(_0x0cac('0x2'));var zipdir=require(_0x0cac('0x3'));var jsonpatch=require(_0x0cac('0x4'));var rp=require('request-promise');var moment=require(_0x0cac('0x5'));var BPromise=require(_0x0cac('0x6'));var Mustache=require(_0x0cac('0x7'));var util=require('util');var path=require(_0x0cac('0x8'));var sox=require('sox');var csv=require(_0x0cac('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0cac('0xa'));var squel=require(_0x0cac('0xb'));var crypto=require('crypto');var jsforce=require(_0x0cac('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0cac('0xd'));var Redis=require('ioredis');var authService=require(_0x0cac('0xe'));var qs=require(_0x0cac('0xf'));var as=require(_0x0cac('0x10'));var hardwareService=require(_0x0cac('0x11'));var logger=require('../../config/logger')(_0x0cac('0x12'));var utils=require(_0x0cac('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0cac('0x14'))['db'];var integrations=require(_0x0cac('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x0cac('0x16')][_0x0cac('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2613ed,_0xa84f8,_0xda9a5,_0x25fd32){return new BPromise(function(_0x1655df,_0x169ac1){var _0x27ceb1=_0x25fd32||client;return _0x27ceb1[_0x0cac('0x18')](_0x2613ed,_0xda9a5)[_0x0cac('0x19')](function(_0x448c14){logger[_0x0cac('0x1a')](_0x0cac('0x1b'),_0xa84f8,'request\x20sent');logger[_0x0cac('0x1c')](_0x0cac('0x1d'),_0xa84f8,'request\x20sent',JSON[_0x0cac('0x1e')](_0x448c14));if(_0x448c14[_0x0cac('0x1f')]){if(_0x448c14[_0x0cac('0x1f')][_0x0cac('0x20')]===0x1f4){logger[_0x0cac('0x1f')](_0x0cac('0x1b'),_0xa84f8,_0x448c14['error'][_0x0cac('0x21')]);return _0x169ac1(_0x448c14[_0x0cac('0x1f')][_0x0cac('0x21')]);}logger['error'](_0x0cac('0x1b'),_0xa84f8,_0x448c14[_0x0cac('0x1f')][_0x0cac('0x21')]);return _0x1655df(_0x448c14[_0x0cac('0x1f')][_0x0cac('0x21')]);}else{logger['info'](_0x0cac('0x1b'),_0xa84f8,'request\x20sent');_0x1655df(_0x448c14['result'][_0x0cac('0x21')]);}})[_0x0cac('0x22')](function(_0x2810a7){logger['error']('DeskAccount,\x20%s,\x20%s',_0xa84f8,_0x2810a7);_0x169ac1(_0x2810a7);});});}function respondWithStatusCode(_0x48d881,_0x3c1e19){_0x3c1e19=_0x3c1e19||0xcc;return function(_0x308783){if(_0x308783){return _0x48d881['sendStatus'](_0x3c1e19);}return _0x48d881[_0x0cac('0x23')](_0x3c1e19)['end']();};}function respondWithResult(_0x3dc36b,_0x3029cf){_0x3029cf=_0x3029cf||0xc8;return function(_0x9d0e4c){if(_0x9d0e4c){return _0x3dc36b['status'](_0x3029cf)[_0x0cac('0x24')](_0x9d0e4c);}};}function respondWithFilteredResult(_0xbc8b4e,_0x1d2ab7){return function(_0x4a268d){if(_0x4a268d){var _0x18cda3=_0x4a268d[_0x0cac('0x25')],_0x3bf8fb=_0x1d2ab7[_0x0cac('0x26')],_0x67b118=_0x1d2ab7[_0x0cac('0x26')]+_0x1d2ab7[_0x0cac('0x27')],_0x55bc08;if(_0x67b118>=_0x18cda3){_0x67b118=_0x18cda3;_0x55bc08=0xc8;}else{_0x55bc08=0xce;}_0xbc8b4e[_0x0cac('0x23')](_0x55bc08);return _0xbc8b4e[_0x0cac('0x28')](_0x0cac('0x29'),_0x3bf8fb+'-'+_0x67b118+'/'+_0x18cda3)['json'](_0x4a268d);}return null;};}function patchUpdates(_0x3fa950){return function(_0x2071c8){try{jsonpatch['apply'](_0x2071c8,_0x3fa950,!![]);}catch(_0xb8b956){return BPromise[_0x0cac('0x2a')](_0xb8b956);}return _0x2071c8[_0x0cac('0x2b')]();};}function saveUpdates(_0x26a7bf,_0x45dbe3){return function(_0x53ce7d){if(_0x53ce7d){return _0x53ce7d[_0x0cac('0x2c')](_0x26a7bf)[_0x0cac('0x19')](function(_0x1209e4){return _0x1209e4;});}return null;};}function removeEntity(_0x1e63e2,_0x285c1b){return function(_0x3dc3e9){if(_0x3dc3e9){return _0x3dc3e9[_0x0cac('0x2d')]()['then'](function(){_0x1e63e2['status'](0xcc)[_0x0cac('0x2e')]();});}};}function handleEntityNotFound(_0x31af68,_0x25535d){return function(_0x565f07){if(!_0x565f07){_0x31af68['sendStatus'](0x194);}return _0x565f07;};}function handleError(_0x2d10f0,_0x5e11ee){_0x5e11ee=_0x5e11ee||0x1f4;return function(_0x3c3d81){logger[_0x0cac('0x1f')](_0x3c3d81[_0x0cac('0x2f')]);if(_0x3c3d81[_0x0cac('0x30')]){delete _0x3c3d81['name'];}_0x2d10f0['status'](_0x5e11ee)[_0x0cac('0x31')](_0x3c3d81);};}exports[_0x0cac('0x32')]=function(_0x166f31,_0x32a949){var _0x4245c0={},_0x302461={},_0x195d85={'count':0x0,'rows':[]};var _0x4951f9=_[_0x0cac('0x33')](db[_0x0cac('0x34')][_0x0cac('0x35')],function(_0x4eb62d){return{'name':_0x4eb62d[_0x0cac('0x36')],'type':_0x4eb62d['type'][_0x0cac('0x37')]};});_0x302461[_0x0cac('0x38')]=_[_0x0cac('0x33')](_0x4951f9,_0x0cac('0x30'));_0x302461[_0x0cac('0x39')]=_[_0x0cac('0x3a')](_0x166f31[_0x0cac('0x39')]);_0x302461[_0x0cac('0x3b')]=_[_0x0cac('0x3c')](_0x302461[_0x0cac('0x38')],_0x302461[_0x0cac('0x39')]);_0x4245c0['attributes']=_[_0x0cac('0x3c')](_0x302461['model'],qs[_0x0cac('0x3d')](_0x166f31[_0x0cac('0x39')][_0x0cac('0x3d')]));_0x4245c0[_0x0cac('0x3e')]=_0x4245c0[_0x0cac('0x3e')]['length']?_0x4245c0[_0x0cac('0x3e')]:_0x302461[_0x0cac('0x38')];if(!_0x166f31[_0x0cac('0x39')][_0x0cac('0x3f')](_0x0cac('0x40'))){_0x4245c0[_0x0cac('0x27')]=qs[_0x0cac('0x27')](_0x166f31[_0x0cac('0x39')][_0x0cac('0x27')]);_0x4245c0[_0x0cac('0x26')]=qs[_0x0cac('0x26')](_0x166f31[_0x0cac('0x39')]['offset']);}_0x4245c0[_0x0cac('0x41')]=qs[_0x0cac('0x42')](_0x166f31['query'][_0x0cac('0x42')]);_0x4245c0[_0x0cac('0x43')]=qs[_0x0cac('0x3b')](_[_0x0cac('0x44')](_0x166f31[_0x0cac('0x39')],_0x302461['filters']),_0x4951f9);if(_0x166f31['query'][_0x0cac('0x45')]){_0x4245c0[_0x0cac('0x43')]=_[_0x0cac('0x46')](_0x4245c0[_0x0cac('0x43')],{'$or':_[_0x0cac('0x33')](_0x4951f9,function(_0x4ba741){if(_0x4ba741[_0x0cac('0x47')]!==_0x0cac('0x48')){var _0x4ab8af={};_0x4ab8af[_0x4ba741[_0x0cac('0x30')]]={'$like':'%'+_0x166f31['query'][_0x0cac('0x45')]+'%'};return _0x4ab8af;}})});}_0x4245c0=_['merge']({},_0x4245c0,_0x166f31[_0x0cac('0x49')]);var _0x56cf90={'where':_0x4245c0['where']};return db[_0x0cac('0x34')]['count'](_0x56cf90)['then'](function(_0xbd9afa){_0x195d85[_0x0cac('0x25')]=_0xbd9afa;if(_0x166f31[_0x0cac('0x39')][_0x0cac('0x4a')]){_0x4245c0[_0x0cac('0x4b')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x4245c0);})['then'](function(_0x57273e){_0x195d85['rows']=_0x57273e;return _0x195d85;})['then'](respondWithFilteredResult(_0x32a949,_0x4245c0))[_0x0cac('0x22')](handleError(_0x32a949,null));};exports[_0x0cac('0x4c')]=function(_0x284882,_0x41f539){var _0x256308={'raw':![],'where':{'id':_0x284882[_0x0cac('0x4d')]['id']}},_0x3d7893={};_0x3d7893[_0x0cac('0x38')]=_[_0x0cac('0x3a')](db['DeskAccount'][_0x0cac('0x35')]);_0x3d7893[_0x0cac('0x39')]=_['keys'](_0x284882[_0x0cac('0x39')]);_0x3d7893['filters']=_[_0x0cac('0x3c')](_0x3d7893[_0x0cac('0x38')],_0x3d7893['query']);_0x256308[_0x0cac('0x3e')]=_[_0x0cac('0x3c')](_0x3d7893[_0x0cac('0x38')],qs[_0x0cac('0x3d')](_0x284882[_0x0cac('0x39')][_0x0cac('0x3d')]));_0x256308[_0x0cac('0x3e')]=_0x256308['attributes'][_0x0cac('0x4e')]?_0x256308[_0x0cac('0x3e')]:_0x3d7893['model'];if(_0x284882[_0x0cac('0x39')][_0x0cac('0x4a')]){_0x256308[_0x0cac('0x4b')]=[{'all':!![]}];}_0x256308=_[_0x0cac('0x46')]({},_0x256308,_0x284882[_0x0cac('0x49')]);return db[_0x0cac('0x34')][_0x0cac('0x4f')](_0x256308)[_0x0cac('0x19')](handleEntityNotFound(_0x41f539,null))[_0x0cac('0x19')](respondWithResult(_0x41f539,null))[_0x0cac('0x22')](handleError(_0x41f539,null));};exports['create']=function(_0x2b21ca,_0x24eff0){return db['DeskAccount'][_0x0cac('0x50')](_0x2b21ca[_0x0cac('0x51')],{})[_0x0cac('0x19')](respondWithResult(_0x24eff0,0xc9))[_0x0cac('0x22')](handleError(_0x24eff0,null));};exports[_0x0cac('0x2c')]=function(_0x27eab3,_0x154c73){if(_0x27eab3[_0x0cac('0x51')]['id']){delete _0x27eab3[_0x0cac('0x51')]['id'];}return db['DeskAccount'][_0x0cac('0x4f')]({'where':{'id':_0x27eab3[_0x0cac('0x4d')]['id']}})['then'](handleEntityNotFound(_0x154c73,null))[_0x0cac('0x19')](saveUpdates(_0x27eab3[_0x0cac('0x51')],null))[_0x0cac('0x19')](respondWithResult(_0x154c73,null))[_0x0cac('0x22')](handleError(_0x154c73,null));};exports[_0x0cac('0x2d')]=function(_0x36c69d,_0x28a9a4){return db[_0x0cac('0x34')][_0x0cac('0x4f')]({'where':{'id':_0x36c69d[_0x0cac('0x4d')]['id']}})[_0x0cac('0x19')](handleEntityNotFound(_0x28a9a4,null))['then'](removeEntity(_0x28a9a4,null))[_0x0cac('0x22')](handleError(_0x28a9a4,null));};exports[_0x0cac('0x52')]=function(_0x1e639a,_0x3a9a8a,_0x216a58){var _0x53ac91={};var _0x15de96={};var _0x27f071;var _0x5dccb7;return db['DeskAccount']['findOne']({'where':{'id':_0x1e639a[_0x0cac('0x4d')]['id']}})[_0x0cac('0x19')](handleEntityNotFound(_0x3a9a8a,null))['then'](function(_0x30fa44){if(_0x30fa44){_0x27f071=_0x30fa44;_0x15de96[_0x0cac('0x38')]=_[_0x0cac('0x3a')](db[_0x0cac('0x53')][_0x0cac('0x35')]);_0x15de96[_0x0cac('0x39')]=_[_0x0cac('0x3a')](_0x1e639a['query']);_0x15de96[_0x0cac('0x3b')]=_[_0x0cac('0x3c')](_0x15de96['model'],_0x15de96[_0x0cac('0x39')]);_0x53ac91['attributes']=_[_0x0cac('0x3c')](_0x15de96[_0x0cac('0x38')],qs[_0x0cac('0x3d')](_0x1e639a[_0x0cac('0x39')][_0x0cac('0x3d')]));_0x53ac91[_0x0cac('0x3e')]=_0x53ac91['attributes'][_0x0cac('0x4e')]?_0x53ac91[_0x0cac('0x3e')]:_0x15de96[_0x0cac('0x38')];_0x53ac91['order']=qs[_0x0cac('0x42')](_0x1e639a[_0x0cac('0x39')][_0x0cac('0x42')]);_0x53ac91['where']=qs[_0x0cac('0x3b')](_[_0x0cac('0x44')](_0x1e639a[_0x0cac('0x39')],_0x15de96[_0x0cac('0x3b')]));if(_0x1e639a[_0x0cac('0x39')][_0x0cac('0x45')]){_0x53ac91[_0x0cac('0x43')]=_[_0x0cac('0x46')](_0x53ac91[_0x0cac('0x43')],{'$or':_['map'](_0x53ac91['attributes'],function(_0x234a77){var _0x28c635={};_0x28c635[_0x234a77]={'$like':'%'+_0x1e639a[_0x0cac('0x39')][_0x0cac('0x45')]+'%'};return _0x28c635;})});}_0x53ac91=_['merge']({},_0x53ac91,_0x1e639a[_0x0cac('0x49')]);return _0x27f071['getConfigurations'](_0x53ac91);}})[_0x0cac('0x19')](function(_0x396b07){if(_0x396b07){_0x5dccb7=_0x396b07[_0x0cac('0x4e')];if(!_0x1e639a[_0x0cac('0x39')][_0x0cac('0x3f')]('nolimit')){_0x53ac91[_0x0cac('0x27')]=qs['limit'](_0x1e639a[_0x0cac('0x39')][_0x0cac('0x27')]);_0x53ac91['offset']=qs[_0x0cac('0x26')](_0x1e639a[_0x0cac('0x39')]['offset']);}return _0x27f071[_0x0cac('0x52')](_0x53ac91);}})[_0x0cac('0x19')](function(_0x4850cc){if(_0x4850cc){return _0x4850cc?{'count':_0x5dccb7,'rows':_0x4850cc}:null;}})[_0x0cac('0x19')](respondWithResult(_0x3a9a8a,null))[_0x0cac('0x22')](handleError(_0x3a9a8a,null));};exports[_0x0cac('0x54')]=function(_0x4ec4db,_0x3bc5b6,_0x23a37d){if(_0x4ec4db['body']['id']){delete _0x4ec4db[_0x0cac('0x51')]['id'];}return db[_0x0cac('0x34')]['findOne']({'where':{'id':_0x4ec4db[_0x0cac('0x4d')]['id']}})[_0x0cac('0x19')](handleEntityNotFound(_0x3bc5b6,null))[_0x0cac('0x19')](function(_0x1ff83f){if(_0x1ff83f){_0x4ec4db[_0x0cac('0x51')][_0x0cac('0x55')]=_0x1ff83f['id'];_0x4ec4db['body']['Subjects']=integrations[_0x0cac('0x56')](_0x4ec4db['body'][_0x0cac('0x57')],_0x4ec4db[_0x0cac('0x51')]['type']);_0x4ec4db[_0x0cac('0x51')][_0x0cac('0x58')]=integrations['getDescriptions'](_0x4ec4db[_0x0cac('0x51')][_0x0cac('0x57')],_0x4ec4db[_0x0cac('0x51')]['type']);return db['DeskConfiguration'][_0x0cac('0x50')](_0x4ec4db[_0x0cac('0x51')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x0cac('0x59')],'as':_0x0cac('0x58')}]});}return null;})[_0x0cac('0x19')](respondWithResult(_0x3bc5b6,null))['catch'](handleError(_0x3bc5b6,null));};exports['getFields']=function(_0x29e645,_0x3130b9,_0x7aa26){var _0x1c6f37=[{'name':_0x0cac('0x5a'),'label':_0x0cac('0x5a'),'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 _0x4410a7='';return db['DeskAccount']['findOne']({'where':{'id':_0x29e645[_0x0cac('0x4d')]['id']},'attributes':['id',_0x0cac('0x5b'),_0x0cac('0x5c'),_0x0cac('0x5d'),_0x0cac('0x5e'),_0x0cac('0x5f'),_0x0cac('0x60'),'token','tokenSecret']})[_0x0cac('0x19')](handleEntityNotFound(_0x3130b9,null))[_0x0cac('0x19')](function(_0x33e831){if(_0x33e831){_0x4410a7=_0x33e831[_0x0cac('0x5b')];var _0x43146=_0x4410a7[_0x0cac('0x61')](-0x1);if(_0x43146==='/'){_0x4410a7=_0x4410a7[_0x0cac('0x62')](0x0,_0x4410a7['lastIndexOf'](_0x43146));}var _0x39e53b={'method':_0x0cac('0x63'),'uri':util['format'](_0x0cac('0x64'),_0x4410a7),'headers':{'Content-Type':_0x0cac('0x65'),'Accept':_0x0cac('0x65')},'json':!![]};if(_0x33e831['authType']===_0x0cac('0x66')){_0x39e53b['headers'][_0x0cac('0x67')]=util[_0x0cac('0x68')](_0x0cac('0x69'),new Buffer(util[_0x0cac('0x68')](_0x0cac('0x6a'),_0x33e831[_0x0cac('0x5d')],_0x33e831[_0x0cac('0x5e')]))[_0x0cac('0x6b')](_0x0cac('0x6c')));}return rp(_0x39e53b)[_0x0cac('0x19')](function(_0x4d498f){return _0x1c6f37[_0x0cac('0x6d')](_['map'](_0x4d498f[_0x0cac('0x6e')][_0x0cac('0x6f')],function(_0x4772c5){return{'id':_0x4772c5[_0x0cac('0x30')],'name':_0x4772c5[_0x0cac('0x30')],'type':_0x4772c5[_0x0cac('0x47')],'active':_0x4772c5[_0x0cac('0x70')],'label':_0x4772c5[_0x0cac('0x71')],'custom':!![]};}));});}})[_0x0cac('0x19')](function(_0x436721){return{'count':_0x436721[_0x0cac('0x4e')],'rows':_0x436721};})['then'](respondWithResult(_0x3130b9,null))[_0x0cac('0x22')](function(_0x2bedb9){var _0x4e15de=_0x29e645[_0x0cac('0x39')][_0x0cac('0x72')]?0x1f4:_0x2bedb9['statusCode']||0x1f4;logger[_0x0cac('0x1f')](_0x0cac('0x73'),_0x0cac('0x74'),_0x4e15de,JSON['stringify'](_0x2bedb9));delete _0x2bedb9['name'];if(_0x4e15de===0x191){_0x4e15de=0x190;}_0x3130b9['status'](_0x4e15de)['send'](_0x29e645['query'][_0x0cac('0x72')]?{'message':_0x0cac('0x75'),'statusCode':_0x2bedb9[_0x0cac('0x76')]}:_0x2bedb9);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 33bb72b..cca4865 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 _0xb631=['DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x37a0d8,_0x5621fc){var _0x385dbe=function(_0x3bbdd){while(--_0x3bbdd){_0x37a0d8['push'](_0x37a0d8['shift']());}};_0x385dbe(++_0x5621fc);}(_0xb631,0x16a));var _0x1b63=function(_0x176e0f,_0x317bf2){_0x176e0f=_0x176e0f-0x0;var _0xa63087=_0xb631[_0x176e0f];return _0xa63087;};'use strict';var _=require(_0x1b63('0x0'));var util=require('util');var logger=require(_0x1b63('0x1'))(_0x1b63('0x2'));var moment=require(_0x1b63('0x3'));var BPromise=require(_0x1b63('0x4'));var rp=require(_0x1b63('0x5'));var fs=require('fs');var path=require(_0x1b63('0x6'));var rimraf=require(_0x1b63('0x7'));var config=require(_0x1b63('0x8'));var attributes=require(_0x1b63('0x9'));var integrations=require(_0x1b63('0xa'));module[_0x1b63('0xb')]=function(_0x4878e3,_0x28eaf2){return _0x4878e3[_0x1b63('0xc')](_0x1b63('0xd'),attributes,{'tableName':_0x1b63('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d83=['bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','util','../../config/logger'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0d83,0xe4));var _0x30d8=function(_0x28d0a1,_0x4ac1d3){_0x28d0a1=_0x28d0a1-0x0;var _0x5812aa=_0x0d83[_0x28d0a1];return _0x5812aa;};'use strict';var _=require('lodash');var util=require(_0x30d8('0x0'));var logger=require(_0x30d8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x30d8('0x2'));var rp=require(_0x30d8('0x3'));var fs=require('fs');var path=require(_0x30d8('0x4'));var rimraf=require(_0x30d8('0x5'));var config=require('../../config/environment');var attributes=require(_0x30d8('0x6'));var integrations=require(_0x30d8('0x7'));module[_0x30d8('0x8')]=function(_0x448319,_0x119374){return _0x448319[_0x30d8('0x9')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','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 de4b62a..e653912 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 _0x4cbe=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','attributes','limit','include','map','model','ShowDeskAccount','find','debug','lodash','util','bluebird'];(function(_0x16230e,_0x193e74){var _0x195f7e=function(_0x126a0c){while(--_0x126a0c){_0x16230e['push'](_0x16230e['shift']());}};_0x195f7e(++_0x193e74);}(_0x4cbe,0xcf));var _0xe4cb=function(_0x4cbf12,_0x10fb21){_0x4cbf12=_0x4cbf12-0x0;var _0x568b6d=_0x4cbe[_0x4cbf12];return _0x568b6d;};'use strict';var _=require(_0xe4cb('0x0'));var util=require(_0xe4cb('0x1'));var moment=require('moment');var BPromise=require(_0xe4cb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4cb('0x3'));var db=require(_0xe4cb('0x4'))['db'];var utils=require(_0xe4cb('0x5'));var logger=require('../../config/logger')(_0xe4cb('0x6'));var config=require(_0xe4cb('0x7'));var jayson=require(_0xe4cb('0x8'));var client=jayson[_0xe4cb('0x9')][_0xe4cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x456ab9,_0x3c7fa3,_0xeba16b){return new BPromise(function(_0x184eaa,_0xb0cd22){return client[_0xe4cb('0xb')](_0x456ab9,_0xeba16b)[_0xe4cb('0xc')](function(_0x3f3d20){logger[_0xe4cb('0xd')](_0xe4cb('0xe'),_0x3c7fa3,_0xe4cb('0xf'));logger['debug'](_0xe4cb('0x10'),_0x3c7fa3,'request\x20sent',JSON[_0xe4cb('0x11')](_0x3f3d20));if(_0x3f3d20[_0xe4cb('0x12')]){if(_0x3f3d20['error'][_0xe4cb('0x13')]===0x1f4){logger['error'](_0xe4cb('0xe'),_0x3c7fa3,_0x3f3d20['error'][_0xe4cb('0x14')]);return _0xb0cd22(_0x3f3d20['error']['message']);}logger[_0xe4cb('0x12')]('DeskAccount,\x20%s,\x20%s',_0x3c7fa3,_0x3f3d20[_0xe4cb('0x12')][_0xe4cb('0x14')]);return _0x184eaa(_0x3f3d20[_0xe4cb('0x12')][_0xe4cb('0x14')]);}else{logger[_0xe4cb('0xd')]('DeskAccount,\x20%s,\x20%s',_0x3c7fa3,_0xe4cb('0xf'));_0x184eaa(_0x3f3d20[_0xe4cb('0x15')]['message']);}})[_0xe4cb('0x16')](function(_0x38aa0f){logger[_0xe4cb('0x12')](_0xe4cb('0xe'),_0x3c7fa3,_0x38aa0f);_0xb0cd22(_0x38aa0f);});});}exports[_0xe4cb('0x17')]=function(_0x476339){var _0x24e88e=this;return new Promise(function(_0x154219,_0x586f1d){return db[_0xe4cb('0x18')]['findAll']({'raw':_0x476339[_0xe4cb('0x19')]?_0x476339[_0xe4cb('0x19')][_0xe4cb('0x1a')]===undefined?!![]:![]:!![],'where':_0x476339[_0xe4cb('0x19')]?_0x476339[_0xe4cb('0x19')]['where']||null:null,'attributes':_0x476339[_0xe4cb('0x19')]?_0x476339[_0xe4cb('0x19')][_0xe4cb('0x1b')]||null:null,'limit':_0x476339[_0xe4cb('0x19')]?_0x476339[_0xe4cb('0x19')][_0xe4cb('0x1c')]||null:null,'include':_0x476339[_0xe4cb('0x19')]?_0x476339[_0xe4cb('0x19')][_0xe4cb('0x1d')]?_[_0xe4cb('0x1e')](_0x476339[_0xe4cb('0x19')]['include'],function(_0x1e22aa){return{'model':db[_0x1e22aa[_0xe4cb('0x1f')]],'as':_0x1e22aa['as'],'attributes':_0x1e22aa['attributes'],'include':_0x1e22aa[_0xe4cb('0x1d')]?_[_0xe4cb('0x1e')](_0x1e22aa[_0xe4cb('0x1d')],function(_0x44af7e){return{'model':db[_0x44af7e['model']],'as':_0x44af7e['as'],'attributes':_0x44af7e[_0xe4cb('0x1b')],'include':_0x44af7e[_0xe4cb('0x1d')]?_[_0xe4cb('0x1e')](_0x44af7e[_0xe4cb('0x1d')],function(_0x10a526){return{'model':db[_0x10a526[_0xe4cb('0x1f')]],'as':_0x10a526['as'],'attributes':_0x10a526['attributes']};}):[]};}):[]};}):[]:[]})[_0xe4cb('0xc')](function(_0x2515f7){logger['info'](_0xe4cb('0x17'),_0x476339);logger['debug'](_0xe4cb('0x17'),_0x476339,JSON['stringify'](_0x2515f7));_0x154219(_0x2515f7);})[_0xe4cb('0x16')](function(_0x36fc90){logger[_0xe4cb('0x12')](_0xe4cb('0x17'),_0x36fc90[_0xe4cb('0x14')],_0x476339);_0x586f1d(_0x24e88e[_0xe4cb('0x12')](0x1f4,_0x36fc90[_0xe4cb('0x14')]));});});};exports[_0xe4cb('0x20')]=function(_0x2df36b){var _0x5cf8c9=this;return new Promise(function(_0x4de40a,_0x2c6d48){return db[_0xe4cb('0x18')][_0xe4cb('0x21')]({'raw':_0x2df36b['options']?_0x2df36b['options'][_0xe4cb('0x1a')]===undefined?!![]:![]:!![],'where':_0x2df36b[_0xe4cb('0x19')]?_0x2df36b['options']['where']||null:null,'attributes':_0x2df36b[_0xe4cb('0x19')]?_0x2df36b[_0xe4cb('0x19')][_0xe4cb('0x1b')]||null:null,'include':_0x2df36b[_0xe4cb('0x19')]?_0x2df36b['options'][_0xe4cb('0x1d')]?_[_0xe4cb('0x1e')](_0x2df36b[_0xe4cb('0x19')][_0xe4cb('0x1d')],function(_0x49bce1){return{'model':db[_0x49bce1[_0xe4cb('0x1f')]],'as':_0x49bce1['as'],'attributes':_0x49bce1[_0xe4cb('0x1b')],'include':_0x49bce1['include']?_[_0xe4cb('0x1e')](_0x49bce1['include'],function(_0x562293){return{'model':db[_0x562293[_0xe4cb('0x1f')]],'as':_0x562293['as'],'attributes':_0x562293[_0xe4cb('0x1b')],'include':_0x562293[_0xe4cb('0x1d')]?_[_0xe4cb('0x1e')](_0x562293[_0xe4cb('0x1d')],function(_0x44af52){return{'model':db[_0x44af52[_0xe4cb('0x1f')]],'as':_0x44af52['as'],'attributes':_0x44af52[_0xe4cb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe4cb('0xc')](function(_0x348f29){logger[_0xe4cb('0xd')]('ShowDeskAccount',_0x2df36b);logger[_0xe4cb('0x22')](_0xe4cb('0x20'),_0x2df36b,JSON[_0xe4cb('0x11')](_0x348f29));_0x4de40a(_0x348f29);})[_0xe4cb('0x16')](function(_0x3bc853){logger['error'](_0xe4cb('0x20'),_0x3bc853[_0xe4cb('0x14')],_0x2df36b);_0x2c6d48(_0x5cf8c9[_0xe4cb('0x12')](0x1f4,_0x3bc853[_0xe4cb('0x14')]));});});}; \ No newline at end of file +var _0x86ea=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','DeskAccount,\x20%s,\x20%s','message','result','GetDeskAccount','DeskAccount','options','raw','where','attributes','map','include','model','ShowDeskAccount','find','catch','lodash','randomstring','ioredis','../../config/utils'];(function(_0x8bcea4,_0x22d0be){var _0x2e1315=function(_0x20cb30){while(--_0x20cb30){_0x8bcea4['push'](_0x8bcea4['shift']());}};_0x2e1315(++_0x22d0be);}(_0x86ea,0x125));var _0xa86e=function(_0x325d79,_0x588b88){_0x325d79=_0x325d79-0x0;var _0x3f32ee=_0x86ea[_0x325d79];return _0x3f32ee;};'use strict';var _=require(_0xa86e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa86e('0x1'));var fs=require('fs');var Redis=require(_0xa86e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa86e('0x3'));var logger=require(_0xa86e('0x4'))(_0xa86e('0x5'));var config=require(_0xa86e('0x6'));var jayson=require(_0xa86e('0x7'));var client=jayson[_0xa86e('0x8')][_0xa86e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x588ac9,_0x502c2c,_0x217638){return new BPromise(function(_0x412e22,_0x5a41cc){return client[_0xa86e('0xa')](_0x588ac9,_0x217638)[_0xa86e('0xb')](function(_0x18173f){logger[_0xa86e('0xc')]('DeskAccount,\x20%s,\x20%s',_0x502c2c,_0xa86e('0xd'));logger[_0xa86e('0xe')](_0xa86e('0xf'),_0x502c2c,_0xa86e('0xd'),JSON[_0xa86e('0x10')](_0x18173f));if(_0x18173f['error']){if(_0x18173f['error']['code']===0x1f4){logger[_0xa86e('0x11')](_0xa86e('0x12'),_0x502c2c,_0x18173f['error'][_0xa86e('0x13')]);return _0x5a41cc(_0x18173f[_0xa86e('0x11')]['message']);}logger[_0xa86e('0x11')](_0xa86e('0x12'),_0x502c2c,_0x18173f[_0xa86e('0x11')][_0xa86e('0x13')]);return _0x412e22(_0x18173f[_0xa86e('0x11')][_0xa86e('0x13')]);}else{logger[_0xa86e('0xc')](_0xa86e('0x12'),_0x502c2c,_0xa86e('0xd'));_0x412e22(_0x18173f[_0xa86e('0x14')][_0xa86e('0x13')]);}})['catch'](function(_0xfd8252){logger[_0xa86e('0x11')](_0xa86e('0x12'),_0x502c2c,_0xfd8252);_0x5a41cc(_0xfd8252);});});}exports[_0xa86e('0x15')]=function(_0x39149b){var _0x28ad7d=this;return new Promise(function(_0x187677,_0x32211d){return db[_0xa86e('0x16')]['findAll']({'raw':_0x39149b[_0xa86e('0x17')]?_0x39149b[_0xa86e('0x17')][_0xa86e('0x18')]===undefined?!![]:![]:!![],'where':_0x39149b[_0xa86e('0x17')]?_0x39149b[_0xa86e('0x17')][_0xa86e('0x19')]||null:null,'attributes':_0x39149b['options']?_0x39149b[_0xa86e('0x17')][_0xa86e('0x1a')]||null:null,'limit':_0x39149b[_0xa86e('0x17')]?_0x39149b['options']['limit']||null:null,'include':_0x39149b[_0xa86e('0x17')]?_0x39149b[_0xa86e('0x17')]['include']?_[_0xa86e('0x1b')](_0x39149b[_0xa86e('0x17')][_0xa86e('0x1c')],function(_0x27d37f){return{'model':db[_0x27d37f['model']],'as':_0x27d37f['as'],'attributes':_0x27d37f[_0xa86e('0x1a')],'include':_0x27d37f[_0xa86e('0x1c')]?_[_0xa86e('0x1b')](_0x27d37f[_0xa86e('0x1c')],function(_0x16f021){return{'model':db[_0x16f021[_0xa86e('0x1d')]],'as':_0x16f021['as'],'attributes':_0x16f021[_0xa86e('0x1a')],'include':_0x16f021[_0xa86e('0x1c')]?_[_0xa86e('0x1b')](_0x16f021['include'],function(_0x6bc546){return{'model':db[_0x6bc546[_0xa86e('0x1d')]],'as':_0x6bc546['as'],'attributes':_0x6bc546[_0xa86e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa86e('0xb')](function(_0x356f55){logger[_0xa86e('0xc')]('GetDeskAccount',_0x39149b);logger[_0xa86e('0xe')]('GetDeskAccount',_0x39149b,JSON[_0xa86e('0x10')](_0x356f55));_0x187677(_0x356f55);})['catch'](function(_0x2af2c4){logger[_0xa86e('0x11')]('GetDeskAccount',_0x2af2c4[_0xa86e('0x13')],_0x39149b);_0x32211d(_0x28ad7d[_0xa86e('0x11')](0x1f4,_0x2af2c4[_0xa86e('0x13')]));});});};exports[_0xa86e('0x1e')]=function(_0x57cf29){var _0x5d2a07=this;return new Promise(function(_0x22b03f,_0x53a816){return db[_0xa86e('0x16')][_0xa86e('0x1f')]({'raw':_0x57cf29[_0xa86e('0x17')]?_0x57cf29[_0xa86e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x57cf29[_0xa86e('0x17')]?_0x57cf29[_0xa86e('0x17')][_0xa86e('0x19')]||null:null,'attributes':_0x57cf29[_0xa86e('0x17')]?_0x57cf29[_0xa86e('0x17')]['attributes']||null:null,'include':_0x57cf29[_0xa86e('0x17')]?_0x57cf29[_0xa86e('0x17')]['include']?_[_0xa86e('0x1b')](_0x57cf29[_0xa86e('0x17')]['include'],function(_0x396e6d){return{'model':db[_0x396e6d['model']],'as':_0x396e6d['as'],'attributes':_0x396e6d['attributes'],'include':_0x396e6d[_0xa86e('0x1c')]?_[_0xa86e('0x1b')](_0x396e6d[_0xa86e('0x1c')],function(_0x189b7d){return{'model':db[_0x189b7d[_0xa86e('0x1d')]],'as':_0x189b7d['as'],'attributes':_0x189b7d[_0xa86e('0x1a')],'include':_0x189b7d['include']?_['map'](_0x189b7d[_0xa86e('0x1c')],function(_0x51d958){return{'model':db[_0x51d958[_0xa86e('0x1d')]],'as':_0x51d958['as'],'attributes':_0x51d958[_0xa86e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa86e('0xb')](function(_0x466c85){logger[_0xa86e('0xc')](_0xa86e('0x1e'),_0x57cf29);logger['debug'](_0xa86e('0x1e'),_0x57cf29,JSON['stringify'](_0x466c85));_0x22b03f(_0x466c85);})[_0xa86e('0x20')](function(_0x14d3e8){logger[_0xa86e('0x11')](_0xa86e('0x1e'),_0x14d3e8[_0xa86e('0x13')],_0x57cf29);_0x53a816(_0x5d2a07[_0xa86e('0x11')](0x1f4,_0x14d3e8[_0xa86e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 408b904..f34a389 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 _0x073d=['getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x073d,0xd2));var _0xd073=function(_0x38a62f,_0x26b533){_0x38a62f=_0x38a62f-0x0;var _0x1f734b=_0x073d[_0x38a62f];return _0x1f734b;};'use strict';var multer=require('multer');var util=require(_0xd073('0x0'));var path=require(_0xd073('0x1'));var timeout=require(_0xd073('0x2'));var express=require('express');var router=express[_0xd073('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd073('0x4'));var config=require(_0xd073('0x5'));var controller=require('./intDeskConfiguration.controller');router[_0xd073('0x6')]('/',auth[_0xd073('0x7')](),controller[_0xd073('0x8')]);router[_0xd073('0x6')](_0xd073('0x9'),auth[_0xd073('0x7')](),controller[_0xd073('0xa')]);router[_0xd073('0x6')](_0xd073('0xb'),auth[_0xd073('0x7')](),controller[_0xd073('0xc')]);router[_0xd073('0x6')](_0xd073('0xd'),auth[_0xd073('0x7')](),controller['getSubjects']);router['get'](_0xd073('0xe'),auth['isAuthenticated'](),controller[_0xd073('0xf')]);router[_0xd073('0x6')](_0xd073('0x10'),auth[_0xd073('0x7')](),controller[_0xd073('0x11')]);router['post']('/',auth[_0xd073('0x7')](),controller[_0xd073('0x12')]);router[_0xd073('0x13')](_0xd073('0x10'),auth['isAuthenticated'](),controller[_0xd073('0x14')]);router[_0xd073('0x15')]('/:id',auth[_0xd073('0x7')](),controller[_0xd073('0x16')]);router[_0xd073('0x17')](_0xd073('0x9'),auth['isAuthenticated'](),controller[_0xd073('0x18')]);module['exports']=router; \ No newline at end of file +var _0xcd05=['put','update','destroy','multer','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0xcd05,0x163));var _0x5cd0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcd05[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x5cd0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5cd0('0x1'));var router=express[_0x5cd0('0x2')]();var auth=require(_0x5cd0('0x3'));var interaction=require(_0x5cd0('0x4'));var config=require('../../config/environment');var controller=require(_0x5cd0('0x5'));router[_0x5cd0('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5cd0('0x7'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x9')]);router[_0x5cd0('0x6')](_0x5cd0('0xa'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0xb')]);router['get'](_0x5cd0('0xc'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0xd')]);router[_0x5cd0('0x6')]('/:id/descriptions',auth[_0x5cd0('0x8')](),controller[_0x5cd0('0xe')]);router[_0x5cd0('0x6')](_0x5cd0('0xf'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x10')]);router[_0x5cd0('0x11')]('/',auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x12')]);router[_0x5cd0('0x11')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0x5cd0('0x13')](_0x5cd0('0x7'),auth['isAuthenticated'](),controller[_0x5cd0('0x14')]);router['delete'](_0x5cd0('0x7'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 2067b5f..d386418 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 _0xcd4e=['STRING','sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xcd4e,0x67));var _0xecd4=function(_0x21469f,_0x2379dd){_0x21469f=_0x21469f-0x0;var _0x450d2e=_0xcd4e[_0x21469f];return _0x450d2e;};'use strict';var Sequelize=require(_0xecd4('0x0'));module[_0xecd4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xecd4('0x2')]}}; \ No newline at end of file +var _0xa1c2=['sequelize','STRING'];(function(_0x4107bf,_0x4c1da0){var _0xcb4cf0=function(_0x324b8f){while(--_0x324b8f){_0x4107bf['push'](_0x4107bf['shift']());}};_0xcb4cf0(++_0x4c1da0);}(_0xa1c2,0x98));var _0x2a1c=function(_0x1d04b5,_0x30792c){_0x1d04b5=_0x1d04b5-0x0;var _0x161342=_0xa1c2[_0x1d04b5];return _0x161342;};'use strict';var Sequelize=require(_0x2a1c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2a1c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 7bf562b..fce01a1 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 _0xe15e=['update','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','findOne','getFields','getSubjects','DeskField','getDescriptions','Tag','getTags','setTags','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save'];(function(_0x37b234,_0x4bf425){var _0x42720b=function(_0x1519ee){while(--_0x1519ee){_0x37b234['push'](_0x37b234['shift']());}};_0x42720b(++_0x4bf425);}(_0xe15e,0x88));var _0xee15=function(_0x39ed50,_0x5df36b){_0x39ed50=_0x39ed50-0x0;var _0x578a23=_0xe15e[_0x39ed50];return _0x578a23;};'use strict';var pdf=require(_0xee15('0x0'));var emlformat=require(_0xee15('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee15('0x2'));var rp=require(_0xee15('0x3'));var moment=require('moment');var BPromise=require(_0xee15('0x4'));var Mustache=require(_0xee15('0x5'));var util=require('util');var path=require(_0xee15('0x6'));var sox=require(_0xee15('0x7'));var csv=require(_0xee15('0x8'));var ejs=require(_0xee15('0x9'));var fs=require('fs');var _=require(_0xee15('0xa'));var squel=require(_0xee15('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xee15('0xc'));var toCsv=require(_0xee15('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xee15('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xee15('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee15('0xf'));var logger=require(_0xee15('0x10'))(_0xee15('0x11'));var utils=require('../../config/utils');var config=require(_0xee15('0x12'));var licenseUtil=require(_0xee15('0x13'));var db=require(_0xee15('0x14'))['db'];var jayson=require(_0xee15('0x15'));var client=jayson[_0xee15('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d1292,_0x4b60d2,_0x5f301f,_0xc50dd8){return new BPromise(function(_0x3a702f,_0x12f15d){var _0x3547e6=_0xc50dd8||client;return _0x3547e6['request'](_0x1d1292,_0x5f301f)[_0xee15('0x17')](function(_0x826a4f){logger[_0xee15('0x18')]('DeskConfiguration,\x20%s,\x20%s',_0x4b60d2,_0xee15('0x19'));logger[_0xee15('0x1a')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4b60d2,_0xee15('0x19'),JSON[_0xee15('0x1b')](_0x826a4f));if(_0x826a4f[_0xee15('0x1c')]){if(_0x826a4f['error'][_0xee15('0x1d')]===0x1f4){logger['error'](_0xee15('0x1e'),_0x4b60d2,_0x826a4f[_0xee15('0x1c')]['message']);return _0x12f15d(_0x826a4f[_0xee15('0x1c')][_0xee15('0x1f')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4b60d2,_0x826a4f[_0xee15('0x1c')][_0xee15('0x1f')]);return _0x3a702f(_0x826a4f['error'][_0xee15('0x1f')]);}else{logger[_0xee15('0x18')](_0xee15('0x1e'),_0x4b60d2,_0xee15('0x19'));_0x3a702f(_0x826a4f[_0xee15('0x20')][_0xee15('0x1f')]);}})['catch'](function(_0xfebd97){logger['error'](_0xee15('0x1e'),_0x4b60d2,_0xfebd97);_0x12f15d(_0xfebd97);});});}function respondWithStatusCode(_0x55dbe4,_0xec6e0f){_0xec6e0f=_0xec6e0f||0xcc;return function(_0x28a0e6){if(_0x28a0e6){return _0x55dbe4[_0xee15('0x21')](_0xec6e0f);}return _0x55dbe4[_0xee15('0x22')](_0xec6e0f)[_0xee15('0x23')]();};}function respondWithResult(_0x4c2001,_0x2fb7d1){_0x2fb7d1=_0x2fb7d1||0xc8;return function(_0x114bdf){if(_0x114bdf){return _0x4c2001[_0xee15('0x22')](_0x2fb7d1)[_0xee15('0x24')](_0x114bdf);}};}function respondWithFilteredResult(_0x4a21fc,_0xf40c3a){return function(_0x3c6f7d){if(_0x3c6f7d){var _0x4d1689=_0x3c6f7d[_0xee15('0x25')],_0x22e5d5=_0xf40c3a['offset'],_0xe46dce=_0xf40c3a['offset']+_0xf40c3a[_0xee15('0x26')],_0x7fec17;if(_0xe46dce>=_0x4d1689){_0xe46dce=_0x4d1689;_0x7fec17=0xc8;}else{_0x7fec17=0xce;}_0x4a21fc[_0xee15('0x22')](_0x7fec17);return _0x4a21fc[_0xee15('0x27')](_0xee15('0x28'),_0x22e5d5+'-'+_0xe46dce+'/'+_0x4d1689)[_0xee15('0x24')](_0x3c6f7d);}return null;};}function patchUpdates(_0x1e3475){return function(_0x153caa){try{jsonpatch[_0xee15('0x29')](_0x153caa,_0x1e3475,!![]);}catch(_0x45ea46){return BPromise[_0xee15('0x2a')](_0x45ea46);}return _0x153caa[_0xee15('0x2b')]();};}function saveUpdates(_0x4f38a2,_0x8120b2){return function(_0x3cc609){if(_0x3cc609){return _0x3cc609[_0xee15('0x2c')](_0x4f38a2)[_0xee15('0x17')](function(_0x533692){return _0x533692;});}return null;};}function removeEntity(_0x2a51e5,_0x4cb68d){return function(_0xf82312){if(_0xf82312){return _0xf82312[_0xee15('0x2d')]()['then'](function(){_0x2a51e5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12fbed,_0x4cf52f){return function(_0x161745){if(!_0x161745){_0x12fbed[_0xee15('0x21')](0x194);}return _0x161745;};}function handleError(_0x367e2c,_0x303e52){_0x303e52=_0x303e52||0x1f4;return function(_0x38ebbb){logger[_0xee15('0x1c')](_0x38ebbb[_0xee15('0x2e')]);if(_0x38ebbb[_0xee15('0x2f')]){delete _0x38ebbb['name'];}_0x367e2c[_0xee15('0x22')](_0x303e52)[_0xee15('0x30')](_0x38ebbb);};}exports[_0xee15('0x31')]=function(_0x26908e,_0x54257b){var _0x539211={},_0x43e7fa={},_0x971b40={'count':0x0,'rows':[]};var _0x1e5aea=_[_0xee15('0x32')](db[_0xee15('0x33')][_0xee15('0x34')],function(_0x26b763){return{'name':_0x26b763['fieldName'],'type':_0x26b763[_0xee15('0x35')]['key']};});_0x43e7fa[_0xee15('0x36')]=_[_0xee15('0x32')](_0x1e5aea,_0xee15('0x2f'));_0x43e7fa[_0xee15('0x37')]=_['keys'](_0x26908e[_0xee15('0x37')]);_0x43e7fa['filters']=_[_0xee15('0x38')](_0x43e7fa[_0xee15('0x36')],_0x43e7fa['query']);_0x539211[_0xee15('0x39')]=_['intersection'](_0x43e7fa[_0xee15('0x36')],qs[_0xee15('0x3a')](_0x26908e[_0xee15('0x37')]['fields']));_0x539211[_0xee15('0x39')]=_0x539211[_0xee15('0x39')][_0xee15('0x3b')]?_0x539211[_0xee15('0x39')]:_0x43e7fa[_0xee15('0x36')];if(!_0x26908e[_0xee15('0x37')][_0xee15('0x3c')](_0xee15('0x3d'))){_0x539211[_0xee15('0x26')]=qs[_0xee15('0x26')](_0x26908e['query']['limit']);_0x539211[_0xee15('0x3e')]=qs['offset'](_0x26908e[_0xee15('0x37')][_0xee15('0x3e')]);}_0x539211[_0xee15('0x3f')]=qs[_0xee15('0x40')](_0x26908e[_0xee15('0x37')][_0xee15('0x40')]);_0x539211[_0xee15('0x41')]=qs['filters'](_[_0xee15('0x42')](_0x26908e[_0xee15('0x37')],_0x43e7fa[_0xee15('0x43')]),_0x1e5aea);if(_0x26908e[_0xee15('0x37')][_0xee15('0x44')]){_0x539211[_0xee15('0x41')]=_['merge'](_0x539211['where'],{'$or':_[_0xee15('0x32')](_0x1e5aea,function(_0x5bba79){if(_0x5bba79[_0xee15('0x35')]!==_0xee15('0x45')){var _0x2e802a={};_0x2e802a[_0x5bba79['name']]={'$like':'%'+_0x26908e[_0xee15('0x37')][_0xee15('0x44')]+'%'};return _0x2e802a;}})});}_0x539211=_[_0xee15('0x46')]({},_0x539211,_0x26908e[_0xee15('0x47')]);var _0x565774={'where':_0x539211[_0xee15('0x41')]};return db[_0xee15('0x33')][_0xee15('0x25')](_0x565774)[_0xee15('0x17')](function(_0x140e78){_0x971b40[_0xee15('0x25')]=_0x140e78;if(_0x26908e[_0xee15('0x37')][_0xee15('0x48')]){_0x539211[_0xee15('0x49')]=[{'all':!![]}];}return db[_0xee15('0x33')][_0xee15('0x4a')](_0x539211);})[_0xee15('0x17')](function(_0x15a65e){_0x971b40[_0xee15('0x4b')]=_0x15a65e;return _0x971b40;})['then'](respondWithFilteredResult(_0x54257b,_0x539211))[_0xee15('0x4c')](handleError(_0x54257b,null));};exports['show']=function(_0x34beb4,_0x2208eb){var _0x23d882={'raw':![],'where':{'id':_0x34beb4[_0xee15('0x4d')]['id']}},_0x392b2f={};_0x392b2f[_0xee15('0x36')]=_[_0xee15('0x4e')](db['DeskConfiguration'][_0xee15('0x34')]);_0x392b2f[_0xee15('0x37')]=_[_0xee15('0x4e')](_0x34beb4['query']);_0x392b2f['filters']=_[_0xee15('0x38')](_0x392b2f[_0xee15('0x36')],_0x392b2f[_0xee15('0x37')]);_0x23d882[_0xee15('0x39')]=_[_0xee15('0x38')](_0x392b2f[_0xee15('0x36')],qs[_0xee15('0x3a')](_0x34beb4['query'][_0xee15('0x3a')]));_0x23d882['attributes']=_0x23d882[_0xee15('0x39')][_0xee15('0x3b')]?_0x23d882[_0xee15('0x39')]:_0x392b2f[_0xee15('0x36')];if(_0x34beb4['query'][_0xee15('0x48')]){_0x23d882['include']=[{'all':!![]}];}_0x23d882=_[_0xee15('0x46')]({},_0x23d882,_0x34beb4[_0xee15('0x47')]);return db[_0xee15('0x33')][_0xee15('0x4f')](_0x23d882)[_0xee15('0x17')](handleEntityNotFound(_0x2208eb,null))[_0xee15('0x17')](respondWithResult(_0x2208eb,null))['catch'](handleError(_0x2208eb,null));};exports[_0xee15('0x50')]=function(_0x3bf70c,_0x3424cc){return db['DeskConfiguration'][_0xee15('0x50')](_0x3bf70c[_0xee15('0x51')],{})[_0xee15('0x17')](respondWithResult(_0x3424cc,0xc9))[_0xee15('0x4c')](handleError(_0x3424cc,null));};exports['update']=function(_0x457f27,_0x139bbc){if(_0x457f27[_0xee15('0x51')]['id']){delete _0x457f27[_0xee15('0x51')]['id'];}return db[_0xee15('0x33')][_0xee15('0x4f')]({'where':{'id':_0x457f27[_0xee15('0x4d')]['id']}})[_0xee15('0x17')](handleEntityNotFound(_0x139bbc,null))[_0xee15('0x17')](saveUpdates(_0x457f27[_0xee15('0x51')],null))[_0xee15('0x17')](respondWithResult(_0x139bbc,null))[_0xee15('0x4c')](handleError(_0x139bbc,null));};exports[_0xee15('0x2d')]=function(_0x1e4dbe,_0x402001){return db[_0xee15('0x33')]['find']({'where':{'id':_0x1e4dbe[_0xee15('0x4d')]['id']}})[_0xee15('0x17')](handleEntityNotFound(_0x402001,null))[_0xee15('0x17')](removeEntity(_0x402001,null))['catch'](handleError(_0x402001,null));};exports['getFields']=function(_0x20104b,_0xc76af4,_0x2e41ea){var _0x43a146={};var _0x3ac388={};var _0xa57d5d;var _0x218746;return db[_0xee15('0x33')][_0xee15('0x52')]({'where':{'id':_0x20104b['params']['id']}})[_0xee15('0x17')](handleEntityNotFound(_0xc76af4,null))[_0xee15('0x17')](function(_0x950a73){if(_0x950a73){_0xa57d5d=_0x950a73;_0x3ac388[_0xee15('0x36')]=_[_0xee15('0x4e')](db['DeskField'][_0xee15('0x34')]);_0x3ac388[_0xee15('0x37')]=_[_0xee15('0x4e')](_0x20104b[_0xee15('0x37')]);_0x3ac388[_0xee15('0x43')]=_[_0xee15('0x38')](_0x3ac388[_0xee15('0x36')],_0x3ac388['query']);_0x43a146[_0xee15('0x39')]=_['intersection'](_0x3ac388[_0xee15('0x36')],qs[_0xee15('0x3a')](_0x20104b['query'][_0xee15('0x3a')]));_0x43a146['attributes']=_0x43a146[_0xee15('0x39')][_0xee15('0x3b')]?_0x43a146['attributes']:_0x3ac388['model'];_0x43a146[_0xee15('0x3f')]=qs[_0xee15('0x40')](_0x20104b[_0xee15('0x37')][_0xee15('0x40')]);_0x43a146['where']=qs[_0xee15('0x43')](_[_0xee15('0x42')](_0x20104b[_0xee15('0x37')],_0x3ac388[_0xee15('0x43')]));if(_0x20104b[_0xee15('0x37')][_0xee15('0x44')]){_0x43a146['where']=_[_0xee15('0x46')](_0x43a146[_0xee15('0x41')],{'$or':_[_0xee15('0x32')](_0x43a146[_0xee15('0x39')],function(_0x1c56a5){var _0x486c30={};_0x486c30[_0x1c56a5]={'$like':'%'+_0x20104b[_0xee15('0x37')][_0xee15('0x44')]+'%'};return _0x486c30;})});}_0x43a146=_[_0xee15('0x46')]({},_0x43a146,_0x20104b[_0xee15('0x47')]);return _0xa57d5d[_0xee15('0x53')](_0x43a146);}})[_0xee15('0x17')](function(_0x3eeaba){if(_0x3eeaba){_0x218746=_0x3eeaba['length'];if(!_0x20104b[_0xee15('0x37')]['hasOwnProperty'](_0xee15('0x3d'))){_0x43a146[_0xee15('0x26')]=qs[_0xee15('0x26')](_0x20104b['query'][_0xee15('0x26')]);_0x43a146[_0xee15('0x3e')]=qs[_0xee15('0x3e')](_0x20104b['query']['offset']);}return _0xa57d5d['getFields'](_0x43a146);}})['then'](function(_0x110a28){if(_0x110a28){return _0x110a28?{'count':_0x218746,'rows':_0x110a28}:null;}})[_0xee15('0x17')](respondWithResult(_0xc76af4,null))[_0xee15('0x4c')](handleError(_0xc76af4,null));};exports[_0xee15('0x54')]=function(_0x255040,_0x36e224,_0x468a85){var _0x12ef10={};var _0x29824b={};var _0x14d38f;var _0x569469;return db[_0xee15('0x33')][_0xee15('0x52')]({'where':{'id':_0x255040['params']['id']}})[_0xee15('0x17')](handleEntityNotFound(_0x36e224,null))['then'](function(_0x393b98){if(_0x393b98){_0x14d38f=_0x393b98;_0x29824b[_0xee15('0x36')]=_[_0xee15('0x4e')](db[_0xee15('0x55')][_0xee15('0x34')]);_0x29824b[_0xee15('0x37')]=_['keys'](_0x255040[_0xee15('0x37')]);_0x29824b[_0xee15('0x43')]=_[_0xee15('0x38')](_0x29824b[_0xee15('0x36')],_0x29824b['query']);_0x12ef10['attributes']=_[_0xee15('0x38')](_0x29824b[_0xee15('0x36')],qs['fields'](_0x255040['query']['fields']));_0x12ef10[_0xee15('0x39')]=_0x12ef10['attributes'][_0xee15('0x3b')]?_0x12ef10[_0xee15('0x39')]:_0x29824b[_0xee15('0x36')];_0x12ef10[_0xee15('0x3f')]=qs[_0xee15('0x40')](_0x255040[_0xee15('0x37')][_0xee15('0x40')]);_0x12ef10['where']=qs[_0xee15('0x43')](_['pick'](_0x255040[_0xee15('0x37')],_0x29824b[_0xee15('0x43')]));if(_0x255040[_0xee15('0x37')][_0xee15('0x44')]){_0x12ef10[_0xee15('0x41')]=_[_0xee15('0x46')](_0x12ef10[_0xee15('0x41')],{'$or':_[_0xee15('0x32')](_0x12ef10[_0xee15('0x39')],function(_0x59dcc){var _0x638828={};_0x638828[_0x59dcc]={'$like':'%'+_0x255040['query'][_0xee15('0x44')]+'%'};return _0x638828;})});}_0x12ef10=_[_0xee15('0x46')]({},_0x12ef10,_0x255040['options']);return _0x14d38f[_0xee15('0x54')](_0x12ef10);}})['then'](function(_0x30f4f4){if(_0x30f4f4){_0x569469=_0x30f4f4[_0xee15('0x3b')];if(!_0x255040[_0xee15('0x37')][_0xee15('0x3c')](_0xee15('0x3d'))){_0x12ef10[_0xee15('0x26')]=qs['limit'](_0x255040[_0xee15('0x37')][_0xee15('0x26')]);_0x12ef10['offset']=qs['offset'](_0x255040[_0xee15('0x37')][_0xee15('0x3e')]);}return _0x14d38f[_0xee15('0x54')](_0x12ef10);}})[_0xee15('0x17')](function(_0x1163c6){if(_0x1163c6){return _0x1163c6?{'count':_0x569469,'rows':_0x1163c6}:null;}})[_0xee15('0x17')](respondWithResult(_0x36e224,null))[_0xee15('0x4c')](handleError(_0x36e224,null));};exports[_0xee15('0x56')]=function(_0x5b7a84,_0x4430b6,_0xd4c0d5){var _0x2bd81b={};var _0x37711d={};var _0x4fe2c7;var _0x1c017f;return db[_0xee15('0x33')]['findOne']({'where':{'id':_0x5b7a84[_0xee15('0x4d')]['id']}})[_0xee15('0x17')](handleEntityNotFound(_0x4430b6,null))['then'](function(_0x33ec28){if(_0x33ec28){_0x4fe2c7=_0x33ec28;_0x37711d[_0xee15('0x36')]=_[_0xee15('0x4e')](db[_0xee15('0x55')][_0xee15('0x34')]);_0x37711d[_0xee15('0x37')]=_['keys'](_0x5b7a84[_0xee15('0x37')]);_0x37711d[_0xee15('0x43')]=_[_0xee15('0x38')](_0x37711d[_0xee15('0x36')],_0x37711d[_0xee15('0x37')]);_0x2bd81b[_0xee15('0x39')]=_[_0xee15('0x38')](_0x37711d[_0xee15('0x36')],qs[_0xee15('0x3a')](_0x5b7a84[_0xee15('0x37')][_0xee15('0x3a')]));_0x2bd81b['attributes']=_0x2bd81b['attributes'][_0xee15('0x3b')]?_0x2bd81b[_0xee15('0x39')]:_0x37711d[_0xee15('0x36')];_0x2bd81b[_0xee15('0x3f')]=qs[_0xee15('0x40')](_0x5b7a84[_0xee15('0x37')][_0xee15('0x40')]);_0x2bd81b[_0xee15('0x41')]=qs[_0xee15('0x43')](_[_0xee15('0x42')](_0x5b7a84['query'],_0x37711d[_0xee15('0x43')]));if(_0x5b7a84[_0xee15('0x37')]['filter']){_0x2bd81b[_0xee15('0x41')]=_[_0xee15('0x46')](_0x2bd81b[_0xee15('0x41')],{'$or':_[_0xee15('0x32')](_0x2bd81b[_0xee15('0x39')],function(_0x38e544){var _0x224e8e={};_0x224e8e[_0x38e544]={'$like':'%'+_0x5b7a84['query'][_0xee15('0x44')]+'%'};return _0x224e8e;})});}_0x2bd81b=_[_0xee15('0x46')]({},_0x2bd81b,_0x5b7a84[_0xee15('0x47')]);return _0x4fe2c7[_0xee15('0x56')](_0x2bd81b);}})[_0xee15('0x17')](function(_0x41c242){if(_0x41c242){_0x1c017f=_0x41c242[_0xee15('0x3b')];if(!_0x5b7a84[_0xee15('0x37')][_0xee15('0x3c')](_0xee15('0x3d'))){_0x2bd81b['limit']=qs[_0xee15('0x26')](_0x5b7a84['query']['limit']);_0x2bd81b['offset']=qs[_0xee15('0x3e')](_0x5b7a84['query'][_0xee15('0x3e')]);}return _0x4fe2c7[_0xee15('0x56')](_0x2bd81b);}})[_0xee15('0x17')](function(_0x26dd4c){if(_0x26dd4c){return _0x26dd4c?{'count':_0x1c017f,'rows':_0x26dd4c}:null;}})['then'](respondWithResult(_0x4430b6,null))[_0xee15('0x4c')](handleError(_0x4430b6,null));};exports['getTags']=function(_0x2d9fe4,_0x479561,_0x554d2e){var _0x17ce22={};var _0x394c2a={};var _0xd3bf02;var _0x4f9c45;return db['DeskConfiguration'][_0xee15('0x52')]({'where':{'id':_0x2d9fe4['params']['id']}})[_0xee15('0x17')](handleEntityNotFound(_0x479561,null))[_0xee15('0x17')](function(_0x33452a){if(_0x33452a){_0xd3bf02=_0x33452a;_0x394c2a[_0xee15('0x36')]=_[_0xee15('0x4e')](db[_0xee15('0x57')][_0xee15('0x34')]);_0x394c2a[_0xee15('0x37')]=_[_0xee15('0x4e')](_0x2d9fe4[_0xee15('0x37')]);_0x394c2a[_0xee15('0x43')]=_[_0xee15('0x38')](_0x394c2a[_0xee15('0x36')],_0x394c2a[_0xee15('0x37')]);_0x17ce22[_0xee15('0x39')]=_['intersection'](_0x394c2a['model'],qs[_0xee15('0x3a')](_0x2d9fe4['query']['fields']));_0x17ce22[_0xee15('0x39')]=_0x17ce22[_0xee15('0x39')][_0xee15('0x3b')]?_0x17ce22[_0xee15('0x39')]:_0x394c2a['model'];_0x17ce22['order']=qs['sort'](_0x2d9fe4[_0xee15('0x37')][_0xee15('0x40')]);_0x17ce22[_0xee15('0x41')]=qs[_0xee15('0x43')](_[_0xee15('0x42')](_0x2d9fe4[_0xee15('0x37')],_0x394c2a[_0xee15('0x43')]));if(_0x2d9fe4[_0xee15('0x37')][_0xee15('0x44')]){_0x17ce22[_0xee15('0x41')]=_[_0xee15('0x46')](_0x17ce22[_0xee15('0x41')],{'$or':_[_0xee15('0x32')](_0x17ce22[_0xee15('0x39')],function(_0x4dee1c){var _0x267968={};_0x267968[_0x4dee1c]={'$like':'%'+_0x2d9fe4[_0xee15('0x37')][_0xee15('0x44')]+'%'};return _0x267968;})});}_0x17ce22=_[_0xee15('0x46')]({},_0x17ce22,_0x2d9fe4['options']);return _0xd3bf02[_0xee15('0x58')](_0x17ce22);}})[_0xee15('0x17')](function(_0xc8e579){if(_0xc8e579){_0x4f9c45=_0xc8e579[_0xee15('0x3b')];if(!_0x2d9fe4[_0xee15('0x37')][_0xee15('0x3c')](_0xee15('0x3d'))){_0x17ce22[_0xee15('0x26')]=qs[_0xee15('0x26')](_0x2d9fe4[_0xee15('0x37')][_0xee15('0x26')]);_0x17ce22[_0xee15('0x3e')]=qs[_0xee15('0x3e')](_0x2d9fe4[_0xee15('0x37')][_0xee15('0x3e')]);}return _0xd3bf02['getTags'](_0x17ce22);}})[_0xee15('0x17')](function(_0x3c7aeb){if(_0x3c7aeb){return _0x3c7aeb?{'count':_0x4f9c45,'rows':_0x3c7aeb}:null;}})[_0xee15('0x17')](respondWithResult(_0x479561,null))[_0xee15('0x4c')](handleError(_0x479561,null));};exports[_0xee15('0x59')]=function(_0x38d71e,_0x2814af,_0x43ed34){if(_0x38d71e[_0xee15('0x51')]['id']){delete _0x38d71e[_0xee15('0x51')]['id'];}return db['DeskConfiguration'][_0xee15('0x52')]({'where':{'id':_0x38d71e[_0xee15('0x4d')]['id']}})[_0xee15('0x17')](handleEntityNotFound(_0x2814af,null))[_0xee15('0x17')](function(_0xf4e6b8){if(_0xf4e6b8){return _0xf4e6b8[_0xee15('0x59')](_0x38d71e[_0xee15('0x51')]['ids']||[]);}return null;})[_0xee15('0x17')](respondWithResult(_0x2814af,null))[_0xee15('0x4c')](handleError(_0x2814af,null));}; \ No newline at end of file +var _0xca7e=['merge','VIRTUAL','options','count','include','findAll','rows','params','rawAttributes','model','create','body','find','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','client','request','then','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','set','apply','reject','save','update','destroy','end','name','index','map','DeskConfiguration','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0xca7e,0x133));var _0xeca7=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xca7e[_0x122096];return _0x3d1966;};'use strict';var pdf=require(_0xeca7('0x0'));var emlformat=require(_0xeca7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xeca7('0x2'));var rp=require(_0xeca7('0x3'));var moment=require(_0xeca7('0x4'));var BPromise=require(_0xeca7('0x5'));var Mustache=require(_0xeca7('0x6'));var util=require(_0xeca7('0x7'));var path=require(_0xeca7('0x8'));var sox=require(_0xeca7('0x9'));var csv=require('to-csv');var ejs=require(_0xeca7('0xa'));var fs=require('fs');var _=require(_0xeca7('0xb'));var squel=require(_0xeca7('0xc'));var crypto=require(_0xeca7('0xd'));var jsforce=require(_0xeca7('0xe'));var deskjs=require(_0xeca7('0xf'));var toCsv=require(_0xeca7('0x10'));var querystring=require('querystring');var Papa=require(_0xeca7('0x11'));var Redis=require(_0xeca7('0x12'));var authService=require(_0xeca7('0x13'));var qs=require(_0xeca7('0x14'));var as=require(_0xeca7('0x15'));var hardwareService=require(_0xeca7('0x16'));var logger=require(_0xeca7('0x17'))(_0xeca7('0x18'));var utils=require(_0xeca7('0x19'));var config=require(_0xeca7('0x1a'));var licenseUtil=require(_0xeca7('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xeca7('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eda54,_0x479bbe,_0x61acca,_0x1ba04d){return new BPromise(function(_0x134fb1,_0x41c206){var _0x1a75b3=_0x1ba04d||client;return _0x1a75b3[_0xeca7('0x1d')](_0x5eda54,_0x61acca)[_0xeca7('0x1e')](function(_0x5d274a){logger[_0xeca7('0x1f')]('DeskConfiguration,\x20%s,\x20%s',_0x479bbe,_0xeca7('0x20'));logger['debug'](_0xeca7('0x21'),_0x479bbe,_0xeca7('0x20'),JSON[_0xeca7('0x22')](_0x5d274a));if(_0x5d274a['error']){if(_0x5d274a[_0xeca7('0x23')][_0xeca7('0x24')]===0x1f4){logger[_0xeca7('0x23')](_0xeca7('0x25'),_0x479bbe,_0x5d274a[_0xeca7('0x23')]['message']);return _0x41c206(_0x5d274a[_0xeca7('0x23')][_0xeca7('0x26')]);}logger[_0xeca7('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x479bbe,_0x5d274a[_0xeca7('0x23')]['message']);return _0x134fb1(_0x5d274a[_0xeca7('0x23')][_0xeca7('0x26')]);}else{logger[_0xeca7('0x1f')](_0xeca7('0x25'),_0x479bbe,'request\x20sent');_0x134fb1(_0x5d274a[_0xeca7('0x27')][_0xeca7('0x26')]);}})[_0xeca7('0x28')](function(_0x6fa81){logger[_0xeca7('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x479bbe,_0x6fa81);_0x41c206(_0x6fa81);});});}function respondWithStatusCode(_0x2414c1,_0x5de823){_0x5de823=_0x5de823||0xcc;return function(_0x10417c){if(_0x10417c){return _0x2414c1[_0xeca7('0x29')](_0x5de823);}return _0x2414c1[_0xeca7('0x2a')](_0x5de823)['end']();};}function respondWithResult(_0x414237,_0x38f6d1){_0x38f6d1=_0x38f6d1||0xc8;return function(_0x4e5eb4){if(_0x4e5eb4){return _0x414237['status'](_0x38f6d1)[_0xeca7('0x2b')](_0x4e5eb4);}};}function respondWithFilteredResult(_0x4bf92e,_0x28f826){return function(_0x104166){if(_0x104166){var _0x52ef2e=_0x104166['count'],_0x480f28=_0x28f826['offset'],_0x1d1cb3=_0x28f826[_0xeca7('0x2c')]+_0x28f826[_0xeca7('0x2d')],_0x360bbe;if(_0x1d1cb3>=_0x52ef2e){_0x1d1cb3=_0x52ef2e;_0x360bbe=0xc8;}else{_0x360bbe=0xce;}_0x4bf92e['status'](_0x360bbe);return _0x4bf92e[_0xeca7('0x2e')]('Content-Range',_0x480f28+'-'+_0x1d1cb3+'/'+_0x52ef2e)['json'](_0x104166);}return null;};}function patchUpdates(_0x36c552){return function(_0x3d7cf7){try{jsonpatch[_0xeca7('0x2f')](_0x3d7cf7,_0x36c552,!![]);}catch(_0x2d3353){return BPromise[_0xeca7('0x30')](_0x2d3353);}return _0x3d7cf7[_0xeca7('0x31')]();};}function saveUpdates(_0x1f2c28,_0xcb42db){return function(_0x441e3b){if(_0x441e3b){return _0x441e3b[_0xeca7('0x32')](_0x1f2c28)[_0xeca7('0x1e')](function(_0x12f3ce){return _0x12f3ce;});}return null;};}function removeEntity(_0x36cfef,_0x1101a9){return function(_0x4b0a7f){if(_0x4b0a7f){return _0x4b0a7f[_0xeca7('0x33')]()[_0xeca7('0x1e')](function(){_0x36cfef[_0xeca7('0x2a')](0xcc)[_0xeca7('0x34')]();});}};}function handleEntityNotFound(_0xe45af5,_0x3ccd6f){return function(_0x4d1ee2){if(!_0x4d1ee2){_0xe45af5['sendStatus'](0x194);}return _0x4d1ee2;};}function handleError(_0x530f4f,_0x19398e){_0x19398e=_0x19398e||0x1f4;return function(_0x2f8035){logger[_0xeca7('0x23')](_0x2f8035['stack']);if(_0x2f8035[_0xeca7('0x35')]){delete _0x2f8035[_0xeca7('0x35')];}_0x530f4f[_0xeca7('0x2a')](_0x19398e)['send'](_0x2f8035);};}exports[_0xeca7('0x36')]=function(_0x332d53,_0x2f6c80){var _0x12c1fb={},_0x1e0f2f={},_0x56d64e={'count':0x0,'rows':[]};var _0x4af4ed=_[_0xeca7('0x37')](db[_0xeca7('0x38')]['rawAttributes'],function(_0x340fc6){return{'name':_0x340fc6[_0xeca7('0x39')],'type':_0x340fc6[_0xeca7('0x3a')][_0xeca7('0x3b')]};});_0x1e0f2f['model']=_[_0xeca7('0x37')](_0x4af4ed,_0xeca7('0x35'));_0x1e0f2f[_0xeca7('0x3c')]=_[_0xeca7('0x3d')](_0x332d53[_0xeca7('0x3c')]);_0x1e0f2f[_0xeca7('0x3e')]=_[_0xeca7('0x3f')](_0x1e0f2f['model'],_0x1e0f2f[_0xeca7('0x3c')]);_0x12c1fb[_0xeca7('0x40')]=_[_0xeca7('0x3f')](_0x1e0f2f['model'],qs['fields'](_0x332d53['query'][_0xeca7('0x41')]));_0x12c1fb['attributes']=_0x12c1fb[_0xeca7('0x40')][_0xeca7('0x42')]?_0x12c1fb[_0xeca7('0x40')]:_0x1e0f2f['model'];if(!_0x332d53['query'][_0xeca7('0x43')]('nolimit')){_0x12c1fb[_0xeca7('0x2d')]=qs[_0xeca7('0x2d')](_0x332d53[_0xeca7('0x3c')][_0xeca7('0x2d')]);_0x12c1fb['offset']=qs['offset'](_0x332d53['query'][_0xeca7('0x2c')]);}_0x12c1fb[_0xeca7('0x44')]=qs[_0xeca7('0x45')](_0x332d53[_0xeca7('0x3c')]['sort']);_0x12c1fb[_0xeca7('0x46')]=qs[_0xeca7('0x3e')](_[_0xeca7('0x47')](_0x332d53[_0xeca7('0x3c')],_0x1e0f2f['filters']),_0x4af4ed);if(_0x332d53[_0xeca7('0x3c')][_0xeca7('0x48')]){_0x12c1fb[_0xeca7('0x46')]=_[_0xeca7('0x49')](_0x12c1fb[_0xeca7('0x46')],{'$or':_[_0xeca7('0x37')](_0x4af4ed,function(_0x1dc7f5){if(_0x1dc7f5['type']!==_0xeca7('0x4a')){var _0x5ec492={};_0x5ec492[_0x1dc7f5[_0xeca7('0x35')]]={'$like':'%'+_0x332d53[_0xeca7('0x3c')]['filter']+'%'};return _0x5ec492;}})});}_0x12c1fb=_[_0xeca7('0x49')]({},_0x12c1fb,_0x332d53[_0xeca7('0x4b')]);var _0x1b9db0={'where':_0x12c1fb[_0xeca7('0x46')]};return db['DeskConfiguration'][_0xeca7('0x4c')](_0x1b9db0)['then'](function(_0x5a2b39){_0x56d64e[_0xeca7('0x4c')]=_0x5a2b39;if(_0x332d53['query']['includeAll']){_0x12c1fb[_0xeca7('0x4d')]=[{'all':!![]}];}return db[_0xeca7('0x38')][_0xeca7('0x4e')](_0x12c1fb);})[_0xeca7('0x1e')](function(_0x37cdf3){_0x56d64e[_0xeca7('0x4f')]=_0x37cdf3;return _0x56d64e;})[_0xeca7('0x1e')](respondWithFilteredResult(_0x2f6c80,_0x12c1fb))[_0xeca7('0x28')](handleError(_0x2f6c80,null));};exports['show']=function(_0x2ea89a,_0x291093){var _0x5d7182={'raw':![],'where':{'id':_0x2ea89a[_0xeca7('0x50')]['id']}},_0x50e5e3={};_0x50e5e3['model']=_[_0xeca7('0x3d')](db[_0xeca7('0x38')][_0xeca7('0x51')]);_0x50e5e3[_0xeca7('0x3c')]=_[_0xeca7('0x3d')](_0x2ea89a[_0xeca7('0x3c')]);_0x50e5e3[_0xeca7('0x3e')]=_[_0xeca7('0x3f')](_0x50e5e3[_0xeca7('0x52')],_0x50e5e3[_0xeca7('0x3c')]);_0x5d7182[_0xeca7('0x40')]=_['intersection'](_0x50e5e3[_0xeca7('0x52')],qs[_0xeca7('0x41')](_0x2ea89a[_0xeca7('0x3c')][_0xeca7('0x41')]));_0x5d7182[_0xeca7('0x40')]=_0x5d7182['attributes'][_0xeca7('0x42')]?_0x5d7182[_0xeca7('0x40')]:_0x50e5e3[_0xeca7('0x52')];if(_0x2ea89a[_0xeca7('0x3c')]['includeAll']){_0x5d7182[_0xeca7('0x4d')]=[{'all':!![]}];}_0x5d7182=_[_0xeca7('0x49')]({},_0x5d7182,_0x2ea89a[_0xeca7('0x4b')]);return db[_0xeca7('0x38')]['find'](_0x5d7182)[_0xeca7('0x1e')](handleEntityNotFound(_0x291093,null))[_0xeca7('0x1e')](respondWithResult(_0x291093,null))[_0xeca7('0x28')](handleError(_0x291093,null));};exports[_0xeca7('0x53')]=function(_0x18d4db,_0x40b241){return db[_0xeca7('0x38')][_0xeca7('0x53')](_0x18d4db['body'],{})[_0xeca7('0x1e')](respondWithResult(_0x40b241,0xc9))[_0xeca7('0x28')](handleError(_0x40b241,null));};exports[_0xeca7('0x32')]=function(_0x2264c4,_0x41f7fe){if(_0x2264c4[_0xeca7('0x54')]['id']){delete _0x2264c4[_0xeca7('0x54')]['id'];}return db[_0xeca7('0x38')][_0xeca7('0x55')]({'where':{'id':_0x2264c4[_0xeca7('0x50')]['id']}})['then'](handleEntityNotFound(_0x41f7fe,null))[_0xeca7('0x1e')](saveUpdates(_0x2264c4[_0xeca7('0x54')],null))['then'](respondWithResult(_0x41f7fe,null))[_0xeca7('0x28')](handleError(_0x41f7fe,null));};exports[_0xeca7('0x33')]=function(_0xc55670,_0x3f66c1){return db[_0xeca7('0x38')][_0xeca7('0x55')]({'where':{'id':_0xc55670[_0xeca7('0x50')]['id']}})[_0xeca7('0x1e')](handleEntityNotFound(_0x3f66c1,null))[_0xeca7('0x1e')](removeEntity(_0x3f66c1,null))[_0xeca7('0x28')](handleError(_0x3f66c1,null));};exports[_0xeca7('0x56')]=function(_0x2e41ae,_0x4e825f,_0x22423b){var _0x5887d6={};var _0x11b2a9={};var _0x54dd74;var _0x11baf9;return db[_0xeca7('0x38')][_0xeca7('0x57')]({'where':{'id':_0x2e41ae[_0xeca7('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e825f,null))[_0xeca7('0x1e')](function(_0x5b2ad8){if(_0x5b2ad8){_0x54dd74=_0x5b2ad8;_0x11b2a9['model']=_[_0xeca7('0x3d')](db[_0xeca7('0x58')][_0xeca7('0x51')]);_0x11b2a9[_0xeca7('0x3c')]=_['keys'](_0x2e41ae[_0xeca7('0x3c')]);_0x11b2a9[_0xeca7('0x3e')]=_['intersection'](_0x11b2a9[_0xeca7('0x52')],_0x11b2a9['query']);_0x5887d6[_0xeca7('0x40')]=_[_0xeca7('0x3f')](_0x11b2a9['model'],qs[_0xeca7('0x41')](_0x2e41ae['query']['fields']));_0x5887d6[_0xeca7('0x40')]=_0x5887d6[_0xeca7('0x40')][_0xeca7('0x42')]?_0x5887d6[_0xeca7('0x40')]:_0x11b2a9['model'];_0x5887d6['order']=qs['sort'](_0x2e41ae[_0xeca7('0x3c')][_0xeca7('0x45')]);_0x5887d6[_0xeca7('0x46')]=qs['filters'](_[_0xeca7('0x47')](_0x2e41ae[_0xeca7('0x3c')],_0x11b2a9[_0xeca7('0x3e')]));if(_0x2e41ae[_0xeca7('0x3c')]['filter']){_0x5887d6[_0xeca7('0x46')]=_[_0xeca7('0x49')](_0x5887d6[_0xeca7('0x46')],{'$or':_[_0xeca7('0x37')](_0x5887d6[_0xeca7('0x40')],function(_0x331539){var _0x532613={};_0x532613[_0x331539]={'$like':'%'+_0x2e41ae['query'][_0xeca7('0x48')]+'%'};return _0x532613;})});}_0x5887d6=_[_0xeca7('0x49')]({},_0x5887d6,_0x2e41ae[_0xeca7('0x4b')]);return _0x54dd74[_0xeca7('0x56')](_0x5887d6);}})[_0xeca7('0x1e')](function(_0x3e0b9f){if(_0x3e0b9f){_0x11baf9=_0x3e0b9f['length'];if(!_0x2e41ae[_0xeca7('0x3c')][_0xeca7('0x43')](_0xeca7('0x59'))){_0x5887d6[_0xeca7('0x2d')]=qs[_0xeca7('0x2d')](_0x2e41ae[_0xeca7('0x3c')][_0xeca7('0x2d')]);_0x5887d6['offset']=qs[_0xeca7('0x2c')](_0x2e41ae[_0xeca7('0x3c')][_0xeca7('0x2c')]);}return _0x54dd74[_0xeca7('0x56')](_0x5887d6);}})[_0xeca7('0x1e')](function(_0x4f5e5f){if(_0x4f5e5f){return _0x4f5e5f?{'count':_0x11baf9,'rows':_0x4f5e5f}:null;}})['then'](respondWithResult(_0x4e825f,null))[_0xeca7('0x28')](handleError(_0x4e825f,null));};exports['getSubjects']=function(_0x1e55d6,_0x3d35fe,_0x3150be){var _0x3f6e5a={};var _0x3ed0a7={};var _0x15a400;var _0xc8a402;return db[_0xeca7('0x38')]['findOne']({'where':{'id':_0x1e55d6[_0xeca7('0x50')]['id']}})[_0xeca7('0x1e')](handleEntityNotFound(_0x3d35fe,null))[_0xeca7('0x1e')](function(_0x826956){if(_0x826956){_0x15a400=_0x826956;_0x3ed0a7[_0xeca7('0x52')]=_[_0xeca7('0x3d')](db['DeskField'][_0xeca7('0x51')]);_0x3ed0a7[_0xeca7('0x3c')]=_[_0xeca7('0x3d')](_0x1e55d6[_0xeca7('0x3c')]);_0x3ed0a7[_0xeca7('0x3e')]=_[_0xeca7('0x3f')](_0x3ed0a7['model'],_0x3ed0a7[_0xeca7('0x3c')]);_0x3f6e5a[_0xeca7('0x40')]=_[_0xeca7('0x3f')](_0x3ed0a7[_0xeca7('0x52')],qs[_0xeca7('0x41')](_0x1e55d6[_0xeca7('0x3c')]['fields']));_0x3f6e5a[_0xeca7('0x40')]=_0x3f6e5a[_0xeca7('0x40')][_0xeca7('0x42')]?_0x3f6e5a[_0xeca7('0x40')]:_0x3ed0a7['model'];_0x3f6e5a[_0xeca7('0x44')]=qs[_0xeca7('0x45')](_0x1e55d6['query'][_0xeca7('0x45')]);_0x3f6e5a[_0xeca7('0x46')]=qs['filters'](_[_0xeca7('0x47')](_0x1e55d6[_0xeca7('0x3c')],_0x3ed0a7[_0xeca7('0x3e')]));if(_0x1e55d6[_0xeca7('0x3c')][_0xeca7('0x48')]){_0x3f6e5a[_0xeca7('0x46')]=_[_0xeca7('0x49')](_0x3f6e5a['where'],{'$or':_[_0xeca7('0x37')](_0x3f6e5a['attributes'],function(_0x123a10){var _0x4f0863={};_0x4f0863[_0x123a10]={'$like':'%'+_0x1e55d6['query']['filter']+'%'};return _0x4f0863;})});}_0x3f6e5a=_[_0xeca7('0x49')]({},_0x3f6e5a,_0x1e55d6['options']);return _0x15a400[_0xeca7('0x5a')](_0x3f6e5a);}})[_0xeca7('0x1e')](function(_0x3f8dbd){if(_0x3f8dbd){_0xc8a402=_0x3f8dbd[_0xeca7('0x42')];if(!_0x1e55d6[_0xeca7('0x3c')][_0xeca7('0x43')](_0xeca7('0x59'))){_0x3f6e5a[_0xeca7('0x2d')]=qs[_0xeca7('0x2d')](_0x1e55d6[_0xeca7('0x3c')][_0xeca7('0x2d')]);_0x3f6e5a[_0xeca7('0x2c')]=qs[_0xeca7('0x2c')](_0x1e55d6[_0xeca7('0x3c')][_0xeca7('0x2c')]);}return _0x15a400[_0xeca7('0x5a')](_0x3f6e5a);}})[_0xeca7('0x1e')](function(_0x3715b9){if(_0x3715b9){return _0x3715b9?{'count':_0xc8a402,'rows':_0x3715b9}:null;}})[_0xeca7('0x1e')](respondWithResult(_0x3d35fe,null))[_0xeca7('0x28')](handleError(_0x3d35fe,null));};exports[_0xeca7('0x5b')]=function(_0x48e5a1,_0x1f4b4b,_0x514bf5){var _0x4d0031={};var _0x3a8617={};var _0x3daeed;var _0x43b0bb;return db[_0xeca7('0x38')]['findOne']({'where':{'id':_0x48e5a1[_0xeca7('0x50')]['id']}})['then'](handleEntityNotFound(_0x1f4b4b,null))[_0xeca7('0x1e')](function(_0x419ef2){if(_0x419ef2){_0x3daeed=_0x419ef2;_0x3a8617[_0xeca7('0x52')]=_['keys'](db['DeskField'][_0xeca7('0x51')]);_0x3a8617['query']=_[_0xeca7('0x3d')](_0x48e5a1[_0xeca7('0x3c')]);_0x3a8617[_0xeca7('0x3e')]=_[_0xeca7('0x3f')](_0x3a8617[_0xeca7('0x52')],_0x3a8617[_0xeca7('0x3c')]);_0x4d0031[_0xeca7('0x40')]=_[_0xeca7('0x3f')](_0x3a8617['model'],qs[_0xeca7('0x41')](_0x48e5a1[_0xeca7('0x3c')][_0xeca7('0x41')]));_0x4d0031[_0xeca7('0x40')]=_0x4d0031[_0xeca7('0x40')]['length']?_0x4d0031['attributes']:_0x3a8617[_0xeca7('0x52')];_0x4d0031[_0xeca7('0x44')]=qs[_0xeca7('0x45')](_0x48e5a1[_0xeca7('0x3c')]['sort']);_0x4d0031[_0xeca7('0x46')]=qs['filters'](_['pick'](_0x48e5a1[_0xeca7('0x3c')],_0x3a8617[_0xeca7('0x3e')]));if(_0x48e5a1['query'][_0xeca7('0x48')]){_0x4d0031[_0xeca7('0x46')]=_['merge'](_0x4d0031['where'],{'$or':_['map'](_0x4d0031[_0xeca7('0x40')],function(_0xba8513){var _0x319b58={};_0x319b58[_0xba8513]={'$like':'%'+_0x48e5a1[_0xeca7('0x3c')][_0xeca7('0x48')]+'%'};return _0x319b58;})});}_0x4d0031=_[_0xeca7('0x49')]({},_0x4d0031,_0x48e5a1[_0xeca7('0x4b')]);return _0x3daeed[_0xeca7('0x5b')](_0x4d0031);}})[_0xeca7('0x1e')](function(_0x25dd05){if(_0x25dd05){_0x43b0bb=_0x25dd05[_0xeca7('0x42')];if(!_0x48e5a1['query'][_0xeca7('0x43')](_0xeca7('0x59'))){_0x4d0031[_0xeca7('0x2d')]=qs[_0xeca7('0x2d')](_0x48e5a1[_0xeca7('0x3c')]['limit']);_0x4d0031[_0xeca7('0x2c')]=qs[_0xeca7('0x2c')](_0x48e5a1[_0xeca7('0x3c')]['offset']);}return _0x3daeed['getDescriptions'](_0x4d0031);}})[_0xeca7('0x1e')](function(_0x8b4965){if(_0x8b4965){return _0x8b4965?{'count':_0x43b0bb,'rows':_0x8b4965}:null;}})[_0xeca7('0x1e')](respondWithResult(_0x1f4b4b,null))[_0xeca7('0x28')](handleError(_0x1f4b4b,null));};exports[_0xeca7('0x5c')]=function(_0x22225e,_0x154ab3,_0x24fcb3){var _0x30f40e={};var _0x1ca24e={};var _0x33fb35;var _0x48d685;return db[_0xeca7('0x38')][_0xeca7('0x57')]({'where':{'id':_0x22225e[_0xeca7('0x50')]['id']}})[_0xeca7('0x1e')](handleEntityNotFound(_0x154ab3,null))[_0xeca7('0x1e')](function(_0x25cbd0){if(_0x25cbd0){_0x33fb35=_0x25cbd0;_0x1ca24e[_0xeca7('0x52')]=_['keys'](db['Tag']['rawAttributes']);_0x1ca24e[_0xeca7('0x3c')]=_['keys'](_0x22225e['query']);_0x1ca24e[_0xeca7('0x3e')]=_['intersection'](_0x1ca24e['model'],_0x1ca24e[_0xeca7('0x3c')]);_0x30f40e['attributes']=_[_0xeca7('0x3f')](_0x1ca24e[_0xeca7('0x52')],qs['fields'](_0x22225e[_0xeca7('0x3c')]['fields']));_0x30f40e[_0xeca7('0x40')]=_0x30f40e['attributes']['length']?_0x30f40e[_0xeca7('0x40')]:_0x1ca24e[_0xeca7('0x52')];_0x30f40e[_0xeca7('0x44')]=qs['sort'](_0x22225e[_0xeca7('0x3c')]['sort']);_0x30f40e['where']=qs[_0xeca7('0x3e')](_['pick'](_0x22225e['query'],_0x1ca24e[_0xeca7('0x3e')]));if(_0x22225e['query'][_0xeca7('0x48')]){_0x30f40e[_0xeca7('0x46')]=_[_0xeca7('0x49')](_0x30f40e['where'],{'$or':_['map'](_0x30f40e[_0xeca7('0x40')],function(_0x6fe527){var _0x578bb1={};_0x578bb1[_0x6fe527]={'$like':'%'+_0x22225e[_0xeca7('0x3c')][_0xeca7('0x48')]+'%'};return _0x578bb1;})});}_0x30f40e=_['merge']({},_0x30f40e,_0x22225e[_0xeca7('0x4b')]);return _0x33fb35['getTags'](_0x30f40e);}})[_0xeca7('0x1e')](function(_0x18b580){if(_0x18b580){_0x48d685=_0x18b580[_0xeca7('0x42')];if(!_0x22225e['query']['hasOwnProperty'](_0xeca7('0x59'))){_0x30f40e[_0xeca7('0x2d')]=qs[_0xeca7('0x2d')](_0x22225e['query'][_0xeca7('0x2d')]);_0x30f40e[_0xeca7('0x2c')]=qs['offset'](_0x22225e['query'][_0xeca7('0x2c')]);}return _0x33fb35[_0xeca7('0x5c')](_0x30f40e);}})['then'](function(_0x4627e3){if(_0x4627e3){return _0x4627e3?{'count':_0x48d685,'rows':_0x4627e3}:null;}})[_0xeca7('0x1e')](respondWithResult(_0x154ab3,null))[_0xeca7('0x28')](handleError(_0x154ab3,null));};exports[_0xeca7('0x5d')]=function(_0x4e1cc4,_0x157be5,_0x106138){if(_0x4e1cc4['body']['id']){delete _0x4e1cc4['body']['id'];}return db[_0xeca7('0x38')]['findOne']({'where':{'id':_0x4e1cc4[_0xeca7('0x50')]['id']}})[_0xeca7('0x1e')](handleEntityNotFound(_0x157be5,null))['then'](function(_0x3bb547){if(_0x3bb547){return _0x3bb547[_0xeca7('0x5d')](_0x4e1cc4[_0xeca7('0x54')][_0xeca7('0x5e')]||[]);}return null;})[_0xeca7('0x1e')](respondWithResult(_0x157be5,null))[_0xeca7('0x28')](handleError(_0x157be5,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 4001633..543d9d3 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 _0x0a95=['./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4f41d0,_0x2c6827){var _0xded9f3=function(_0x2edb16){while(--_0x2edb16){_0x4f41d0['push'](_0x4f41d0['shift']());}};_0xded9f3(++_0x2c6827);}(_0x0a95,0x130));var _0x50a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a95[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x50a9('0x0'));var util=require(_0x50a9('0x1'));var logger=require('../../config/logger')(_0x50a9('0x2'));var moment=require(_0x50a9('0x3'));var BPromise=require(_0x50a9('0x4'));var rp=require(_0x50a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x50a9('0x6'));var config=require(_0x50a9('0x7'));var attributes=require(_0x50a9('0x8'));module[_0x50a9('0x9')]=function(_0x3199ae,_0x118ed0){return _0x3199ae[_0x50a9('0xa')]('DeskConfiguration',attributes,{'tableName':_0x50a9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fa3=['../../config/environment','./intDeskConfiguration.attributes','define','int_desk_configurations','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2cd216,_0x473b6c){var _0x12bf58=function(_0x49e570){while(--_0x49e570){_0x2cd216['push'](_0x2cd216['shift']());}};_0x12bf58(++_0x473b6c);}(_0x6fa3,0x9d));var _0x36fa=function(_0x524861,_0x242a0d){_0x524861=_0x524861-0x0;var _0x29872c=_0x6fa3[_0x524861];return _0x29872c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x36fa('0x0'))(_0x36fa('0x1'));var moment=require('moment');var BPromise=require(_0x36fa('0x2'));var rp=require(_0x36fa('0x3'));var fs=require('fs');var path=require(_0x36fa('0x4'));var rimraf=require('rimraf');var config=require(_0x36fa('0x5'));var attributes=require(_0x36fa('0x6'));module['exports']=function(_0x52585f,_0x2d3eb6){return _0x52585f[_0x36fa('0x7')]('DeskConfiguration',attributes,{'tableName':_0x36fa('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 0d822fe..c30b59e 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 _0x5db8=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5db8,0xbb));var _0x85db=function(_0x21cf80,_0x1fb0a1){_0x21cf80=_0x21cf80-0x0;var _0x5c6bed=_0x5db8[_0x21cf80];return _0x5c6bed;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var moment=require(_0x85db('0x2'));var BPromise=require('bluebird');var rs=require(_0x85db('0x3'));var fs=require('fs');var Redis=require(_0x85db('0x4'));var db=require(_0x85db('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x85db('0x6'));var config=require(_0x85db('0x7'));var jayson=require(_0x85db('0x8'));var client=jayson[_0x85db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x489b13,_0x2b9f25,_0x3a10dd){return new BPromise(function(_0xc6fd00,_0x308988){return client['request'](_0x489b13,_0x3a10dd)[_0x85db('0xa')](function(_0x54f0c1){logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));logger[_0x85db('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2b9f25,'request\x20sent',JSON['stringify'](_0x54f0c1));if(_0x54f0c1[_0x85db('0xf')]){if(_0x54f0c1[_0x85db('0xf')]['code']===0x1f4){logger[_0x85db('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0x308988(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);return _0xc6fd00(_0x54f0c1[_0x85db('0xf')][_0x85db('0x10')]);}else{logger[_0x85db('0xb')](_0x85db('0xc'),_0x2b9f25,_0x85db('0xd'));_0xc6fd00(_0x54f0c1['result'][_0x85db('0x10')]);}})[_0x85db('0x11')](function(_0x11e7da){logger[_0x85db('0xf')](_0x85db('0xc'),_0x2b9f25,_0x11e7da);_0x308988(_0x11e7da);});});} \ No newline at end of file +var _0x851d=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result'];(function(_0x213080,_0x55e85a){var _0x5675bd=function(_0xb1d836){while(--_0xb1d836){_0x213080['push'](_0x213080['shift']());}};_0x5675bd(++_0x55e85a);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd851('0x0'));var util=require('util');var moment=require(_0xd851('0x1'));var BPromise=require(_0xd851('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd851('0x3'));var db=require(_0xd851('0x4'))['db'];var utils=require(_0xd851('0x5'));var logger=require(_0xd851('0x6'))(_0xd851('0x7'));var config=require(_0xd851('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd851('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b63e4,_0x3d2383,_0x2f9540){return new BPromise(function(_0x60bef0,_0x4554d8){return client['request'](_0x2b63e4,_0x2f9540)[_0xd851('0xa')](function(_0x51bf16){logger[_0xd851('0xb')](_0xd851('0xc'),_0x3d2383,'request\x20sent');logger[_0xd851('0xd')](_0xd851('0xe'),_0x3d2383,_0xd851('0xf'),JSON[_0xd851('0x10')](_0x51bf16));if(_0x51bf16['error']){if(_0x51bf16['error'][_0xd851('0x11')]===0x1f4){logger[_0xd851('0x12')](_0xd851('0xc'),_0x3d2383,_0x51bf16[_0xd851('0x12')]['message']);return _0x4554d8(_0x51bf16[_0xd851('0x12')][_0xd851('0x13')]);}logger['error'](_0xd851('0xc'),_0x3d2383,_0x51bf16[_0xd851('0x12')][_0xd851('0x13')]);return _0x60bef0(_0x51bf16['error'][_0xd851('0x13')]);}else{logger[_0xd851('0xb')](_0xd851('0xc'),_0x3d2383,_0xd851('0xf'));_0x60bef0(_0x51bf16[_0xd851('0x14')][_0xd851('0x13')]);}})['catch'](function(_0x448e31){logger[_0xd851('0x12')](_0xd851('0xc'),_0x3d2383,_0x448e31);_0x4554d8(_0x448e31);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 886673b..a695790 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 _0xf483=['post','create','put','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','./intDeskField.controller','get','isAuthenticated','/:id','show'];(function(_0x10f3cb,_0x41ce88){var _0x39b6fb=function(_0xf4d9e5){while(--_0xf4d9e5){_0x10f3cb['push'](_0x10f3cb['shift']());}};_0x39b6fb(++_0x41ce88);}(_0xf483,0x140));var _0x3f48=function(_0x295e62,_0x4a0992){_0x295e62=_0x295e62-0x0;var _0x1b8099=_0xf483[_0x295e62];return _0x1b8099;};'use strict';var multer=require('multer');var util=require(_0x3f48('0x0'));var path=require(_0x3f48('0x1'));var timeout=require(_0x3f48('0x2'));var express=require(_0x3f48('0x3'));var router=express['Router']();var auth=require(_0x3f48('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3f48('0x5'));router[_0x3f48('0x6')]('/',auth[_0x3f48('0x7')](),controller['index']);router[_0x3f48('0x6')](_0x3f48('0x8'),auth['isAuthenticated'](),controller[_0x3f48('0x9')]);router[_0x3f48('0xa')]('/',auth[_0x3f48('0x7')](),controller[_0x3f48('0xb')]);router[_0x3f48('0xc')](_0x3f48('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x3f48('0xd')](_0x3f48('0x8'),auth[_0x3f48('0x7')](),controller[_0x3f48('0xe')]);module['exports']=router; \ No newline at end of file +var _0x3543=['../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util','Router'];(function(_0x106cd6,_0x24812b){var _0x4fe4f1=function(_0x34675c){while(--_0x34675c){_0x106cd6['push'](_0x106cd6['shift']());}};_0x4fe4f1(++_0x24812b);}(_0x3543,0xcd));var _0x3354=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3543[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x3354('0x0'));var util=require(_0x3354('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3354('0x2')]();var auth=require(_0x3354('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3354('0x4'));var controller=require(_0x3354('0x5'));router[_0x3354('0x6')]('/',auth[_0x3354('0x7')](),controller[_0x3354('0x8')]);router['get'](_0x3354('0x9'),auth[_0x3354('0x7')](),controller[_0x3354('0xa')]);router[_0x3354('0xb')]('/',auth[_0x3354('0x7')](),controller[_0x3354('0xc')]);router[_0x3354('0xd')](_0x3354('0x9'),auth[_0x3354('0x7')](),controller[_0x3354('0xe')]);router['delete']('/:id',auth[_0x3354('0x7')](),controller[_0x3354('0xf')]);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 9dfc7d3..ff24dad 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 _0x698d=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x698d,0xf7));var _0xd698=function(_0x21cefa,_0x23e39f){_0x21cefa=_0x21cefa-0x0;var _0x2dcc9c=_0x698d[_0x21cefa];return _0x2dcc9c;};'use strict';var Sequelize=require(_0xd698('0x0'));module['exports']={'type':{'type':Sequelize[_0xd698('0x1')](_0xd698('0x2'),_0xd698('0x3'),_0xd698('0x4'),_0xd698('0x5')),'defaultValue':_0xd698('0x2')},'content':{'type':Sequelize[_0xd698('0x6')]},'key':{'type':Sequelize[_0xd698('0x6')]},'keyType':{'type':Sequelize[_0xd698('0x1')](_0xd698('0x2'),_0xd698('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd698('0x6')]},'idField':{'type':Sequelize[_0xd698('0x6')]},'nameField':{'type':Sequelize[_0xd698('0x6')]},'customField':{'type':Sequelize[_0xd698('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5d2d=['keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x5d2d,0x1a8));var _0xd5d2=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0x5d2d[_0x1e381c];return _0x9b5ea9;};'use strict';var Sequelize=require(_0xd5d2('0x0'));module['exports']={'type':{'type':Sequelize[_0xd5d2('0x1')]('string',_0xd5d2('0x2'),'customVariable',_0xd5d2('0x3')),'defaultValue':_0xd5d2('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd5d2('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xd5d2('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xd5d2('0x5')]},'idField':{'type':Sequelize[_0xd5d2('0x5')]},'nameField':{'type':Sequelize[_0xd5d2('0x5')]},'customField':{'type':Sequelize[_0xd5d2('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd5d2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 274793a..eacc224 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 _0xbd4f=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','DeskField','count','includeAll','include','findAll','catch','show','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','index','rawAttributes','fieldName','type','key'];(function(_0x48a8d4,_0x327bc4){var _0x413a2b=function(_0x5b207c){while(--_0x5b207c){_0x48a8d4['push'](_0x48a8d4['shift']());}};_0x413a2b(++_0x327bc4);}(_0xbd4f,0x65));var _0xfbd4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xbd4f[_0x3ff085];return _0x2b68c3;};'use strict';var pdf=require(_0xfbd4('0x0'));var emlformat=require(_0xfbd4('0x1'));var rimraf=require(_0xfbd4('0x2'));var zipdir=require(_0xfbd4('0x3'));var jsonpatch=require(_0xfbd4('0x4'));var rp=require(_0xfbd4('0x5'));var moment=require('moment');var BPromise=require(_0xfbd4('0x6'));var Mustache=require('mustache');var util=require(_0xfbd4('0x7'));var path=require('path');var sox=require(_0xfbd4('0x8'));var csv=require(_0xfbd4('0x9'));var ejs=require(_0xfbd4('0xa'));var fs=require('fs');var _=require(_0xfbd4('0xb'));var squel=require(_0xfbd4('0xc'));var crypto=require(_0xfbd4('0xd'));var jsforce=require(_0xfbd4('0xe'));var deskjs=require(_0xfbd4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfbd4('0x10'));var Papa=require(_0xfbd4('0x11'));var Redis=require(_0xfbd4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfbd4('0x13'));var as=require(_0xfbd4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbd4('0x15'))('api');var utils=require(_0xfbd4('0x16'));var config=require(_0xfbd4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbd4('0x18'))['db'];function respondWithStatusCode(_0x282efd,_0x1307ff){_0x1307ff=_0x1307ff||0xcc;return function(_0x48cac8){if(_0x48cac8){return _0x282efd['sendStatus'](_0x1307ff);}return _0x282efd[_0xfbd4('0x19')](_0x1307ff)[_0xfbd4('0x1a')]();};}function respondWithResult(_0x9c1e7b,_0x199adb){_0x199adb=_0x199adb||0xc8;return function(_0x356342){if(_0x356342){return _0x9c1e7b[_0xfbd4('0x19')](_0x199adb)['json'](_0x356342);}};}function respondWithFilteredResult(_0x15120c,_0x17db47){return function(_0xeaa330){if(_0xeaa330){var _0x155274=_0xeaa330['count'],_0x7f1f03=_0x17db47[_0xfbd4('0x1b')],_0x4ba55d=_0x17db47['offset']+_0x17db47[_0xfbd4('0x1c')],_0x5eb1df;if(_0x4ba55d>=_0x155274){_0x4ba55d=_0x155274;_0x5eb1df=0xc8;}else{_0x5eb1df=0xce;}_0x15120c['status'](_0x5eb1df);return _0x15120c['set'](_0xfbd4('0x1d'),_0x7f1f03+'-'+_0x4ba55d+'/'+_0x155274)[_0xfbd4('0x1e')](_0xeaa330);}return null;};}function patchUpdates(_0x4f8d41){return function(_0x58aabe){try{jsonpatch[_0xfbd4('0x1f')](_0x58aabe,_0x4f8d41,!![]);}catch(_0x44b043){return BPromise[_0xfbd4('0x20')](_0x44b043);}return _0x58aabe[_0xfbd4('0x21')]();};}function saveUpdates(_0x549bb5,_0x50749d){return function(_0x201843){if(_0x201843){return _0x201843[_0xfbd4('0x22')](_0x549bb5)['then'](function(_0x18dfe6){return _0x18dfe6;});}return null;};}function removeEntity(_0x2698c4,_0x13212b){return function(_0x4b5e64){if(_0x4b5e64){return _0x4b5e64[_0xfbd4('0x23')]()[_0xfbd4('0x24')](function(){_0x2698c4[_0xfbd4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50ad98,_0x13ae0b){return function(_0x2aaef7){if(!_0x2aaef7){_0x50ad98[_0xfbd4('0x25')](0x194);}return _0x2aaef7;};}function handleError(_0x4b036b,_0x4d1019){_0x4d1019=_0x4d1019||0x1f4;return function(_0x4af6bf){logger['error'](_0x4af6bf[_0xfbd4('0x26')]);if(_0x4af6bf[_0xfbd4('0x27')]){delete _0x4af6bf[_0xfbd4('0x27')];}_0x4b036b[_0xfbd4('0x19')](_0x4d1019)['send'](_0x4af6bf);};}exports[_0xfbd4('0x28')]=function(_0x5a8eaf,_0x27ff9a){var _0x2022df={},_0x472bcd={},_0x3f27fb={'count':0x0,'rows':[]};var _0x20c600=_['map'](db['DeskField'][_0xfbd4('0x29')],function(_0x52f4b5){return{'name':_0x52f4b5[_0xfbd4('0x2a')],'type':_0x52f4b5[_0xfbd4('0x2b')][_0xfbd4('0x2c')]};});_0x472bcd[_0xfbd4('0x2d')]=_['map'](_0x20c600,'name');_0x472bcd[_0xfbd4('0x2e')]=_[_0xfbd4('0x2f')](_0x5a8eaf[_0xfbd4('0x2e')]);_0x472bcd[_0xfbd4('0x30')]=_[_0xfbd4('0x31')](_0x472bcd[_0xfbd4('0x2d')],_0x472bcd[_0xfbd4('0x2e')]);_0x2022df[_0xfbd4('0x32')]=_[_0xfbd4('0x31')](_0x472bcd[_0xfbd4('0x2d')],qs[_0xfbd4('0x33')](_0x5a8eaf[_0xfbd4('0x2e')][_0xfbd4('0x33')]));_0x2022df[_0xfbd4('0x32')]=_0x2022df[_0xfbd4('0x32')][_0xfbd4('0x34')]?_0x2022df[_0xfbd4('0x32')]:_0x472bcd['model'];if(!_0x5a8eaf[_0xfbd4('0x2e')][_0xfbd4('0x35')](_0xfbd4('0x36'))){_0x2022df[_0xfbd4('0x1c')]=qs[_0xfbd4('0x1c')](_0x5a8eaf[_0xfbd4('0x2e')][_0xfbd4('0x1c')]);_0x2022df['offset']=qs['offset'](_0x5a8eaf[_0xfbd4('0x2e')][_0xfbd4('0x1b')]);}_0x2022df[_0xfbd4('0x37')]=qs[_0xfbd4('0x38')](_0x5a8eaf[_0xfbd4('0x2e')][_0xfbd4('0x38')]);_0x2022df[_0xfbd4('0x39')]=qs[_0xfbd4('0x30')](_['pick'](_0x5a8eaf[_0xfbd4('0x2e')],_0x472bcd[_0xfbd4('0x30')]),_0x20c600);if(_0x5a8eaf[_0xfbd4('0x2e')][_0xfbd4('0x3a')]){_0x2022df[_0xfbd4('0x39')]=_[_0xfbd4('0x3b')](_0x2022df[_0xfbd4('0x39')],{'$or':_[_0xfbd4('0x3c')](_0x20c600,function(_0x46d922){if(_0x46d922['type']!==_0xfbd4('0x3d')){var _0x25ff95={};_0x25ff95[_0x46d922[_0xfbd4('0x27')]]={'$like':'%'+_0x5a8eaf[_0xfbd4('0x2e')][_0xfbd4('0x3a')]+'%'};return _0x25ff95;}})});}_0x2022df=_[_0xfbd4('0x3b')]({},_0x2022df,_0x5a8eaf[_0xfbd4('0x3e')]);var _0x41f22b={'where':_0x2022df[_0xfbd4('0x39')]};return db[_0xfbd4('0x3f')][_0xfbd4('0x40')](_0x41f22b)['then'](function(_0x56b67d){_0x3f27fb[_0xfbd4('0x40')]=_0x56b67d;if(_0x5a8eaf[_0xfbd4('0x2e')][_0xfbd4('0x41')]){_0x2022df[_0xfbd4('0x42')]=[{'all':!![]}];}return db[_0xfbd4('0x3f')][_0xfbd4('0x43')](_0x2022df);})[_0xfbd4('0x24')](function(_0x13a9f9){_0x3f27fb['rows']=_0x13a9f9;return _0x3f27fb;})[_0xfbd4('0x24')](respondWithFilteredResult(_0x27ff9a,_0x2022df))[_0xfbd4('0x44')](handleError(_0x27ff9a,null));};exports[_0xfbd4('0x45')]=function(_0x43d93a,_0xb69326){var _0x4739e8={'raw':!![],'where':{'id':_0x43d93a['params']['id']}},_0x35b2c7={};_0x35b2c7[_0xfbd4('0x2d')]=_[_0xfbd4('0x2f')](db[_0xfbd4('0x3f')][_0xfbd4('0x29')]);_0x35b2c7['query']=_[_0xfbd4('0x2f')](_0x43d93a[_0xfbd4('0x2e')]);_0x35b2c7[_0xfbd4('0x30')]=_[_0xfbd4('0x31')](_0x35b2c7[_0xfbd4('0x2d')],_0x35b2c7[_0xfbd4('0x2e')]);_0x4739e8[_0xfbd4('0x32')]=_[_0xfbd4('0x31')](_0x35b2c7['model'],qs[_0xfbd4('0x33')](_0x43d93a[_0xfbd4('0x2e')][_0xfbd4('0x33')]));_0x4739e8[_0xfbd4('0x32')]=_0x4739e8[_0xfbd4('0x32')][_0xfbd4('0x34')]?_0x4739e8['attributes']:_0x35b2c7[_0xfbd4('0x2d')];if(_0x43d93a[_0xfbd4('0x2e')][_0xfbd4('0x41')]){_0x4739e8[_0xfbd4('0x42')]=[{'all':!![]}];}_0x4739e8=_[_0xfbd4('0x3b')]({},_0x4739e8,_0x43d93a[_0xfbd4('0x3e')]);return db[_0xfbd4('0x3f')][_0xfbd4('0x46')](_0x4739e8)[_0xfbd4('0x24')](handleEntityNotFound(_0xb69326,null))[_0xfbd4('0x24')](respondWithResult(_0xb69326,null))[_0xfbd4('0x44')](handleError(_0xb69326,null));};exports[_0xfbd4('0x47')]=function(_0x461f54,_0x58eb45){return db[_0xfbd4('0x3f')][_0xfbd4('0x47')](_0x461f54[_0xfbd4('0x48')],{})[_0xfbd4('0x24')](respondWithResult(_0x58eb45,0xc9))[_0xfbd4('0x44')](handleError(_0x58eb45,null));};exports[_0xfbd4('0x22')]=function(_0x535a2f,_0x48cb32){if(_0x535a2f[_0xfbd4('0x48')]['id']){delete _0x535a2f[_0xfbd4('0x48')]['id'];}return db[_0xfbd4('0x3f')][_0xfbd4('0x46')]({'where':{'id':_0x535a2f['params']['id']}})[_0xfbd4('0x24')](handleEntityNotFound(_0x48cb32,null))[_0xfbd4('0x24')](saveUpdates(_0x535a2f[_0xfbd4('0x48')],null))[_0xfbd4('0x24')](respondWithResult(_0x48cb32,null))[_0xfbd4('0x44')](handleError(_0x48cb32,null));};exports[_0xfbd4('0x23')]=function(_0x3c2d6d,_0x4cac97){return db['DeskField']['find']({'where':{'id':_0x3c2d6d['params']['id']}})['then'](handleEntityNotFound(_0x4cac97,null))[_0xfbd4('0x24')](removeEntity(_0x4cac97,null))[_0xfbd4('0x44')](handleError(_0x4cac97,null));}; \ No newline at end of file +var _0x262c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','save','update','destroy','end','error','name','index','map','DeskField','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','type','merge','then','includeAll','include','findAll','catch','show','params','length','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs'];(function(_0x4cd203,_0x106bd6){var _0x2bd773=function(_0x2aad7c){while(--_0x2aad7c){_0x4cd203['push'](_0x4cd203['shift']());}};_0x2bd773(++_0x106bd6);}(_0x262c,0xb8));var _0xc262=function(_0x2dc7c9,_0x3a15f8){_0x2dc7c9=_0x2dc7c9-0x0;var _0x3e6536=_0x262c[_0x2dc7c9];return _0x3e6536;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc262('0x0'));var rimraf=require(_0xc262('0x1'));var zipdir=require(_0xc262('0x2'));var jsonpatch=require(_0xc262('0x3'));var rp=require(_0xc262('0x4'));var moment=require(_0xc262('0x5'));var BPromise=require(_0xc262('0x6'));var Mustache=require(_0xc262('0x7'));var util=require(_0xc262('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc262('0x9'));var ejs=require(_0xc262('0xa'));var fs=require('fs');var _=require(_0xc262('0xb'));var squel=require(_0xc262('0xc'));var crypto=require(_0xc262('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc262('0x9'));var querystring=require(_0xc262('0xe'));var Papa=require('papaparse');var Redis=require(_0xc262('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc262('0x10'));var as=require(_0xc262('0x11'));var hardwareService=require(_0xc262('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc262('0x13'));var licenseUtil=require(_0xc262('0x14'));var db=require(_0xc262('0x15'))['db'];function respondWithStatusCode(_0x202b8e,_0x13ddc8){_0x13ddc8=_0x13ddc8||0xcc;return function(_0xb92691){if(_0xb92691){return _0x202b8e[_0xc262('0x16')](_0x13ddc8);}return _0x202b8e[_0xc262('0x17')](_0x13ddc8)['end']();};}function respondWithResult(_0xd95495,_0x37aab3){_0x37aab3=_0x37aab3||0xc8;return function(_0x497778){if(_0x497778){return _0xd95495[_0xc262('0x17')](_0x37aab3)[_0xc262('0x18')](_0x497778);}};}function respondWithFilteredResult(_0x2745f7,_0x115118){return function(_0x16ffa){if(_0x16ffa){var _0x449633=_0x16ffa[_0xc262('0x19')],_0x4756dd=_0x115118[_0xc262('0x1a')],_0x231a34=_0x115118[_0xc262('0x1a')]+_0x115118[_0xc262('0x1b')],_0x9ab676;if(_0x231a34>=_0x449633){_0x231a34=_0x449633;_0x9ab676=0xc8;}else{_0x9ab676=0xce;}_0x2745f7[_0xc262('0x17')](_0x9ab676);return _0x2745f7['set']('Content-Range',_0x4756dd+'-'+_0x231a34+'/'+_0x449633)['json'](_0x16ffa);}return null;};}function patchUpdates(_0x496d1a){return function(_0x1bed77){try{jsonpatch[_0xc262('0x1c')](_0x1bed77,_0x496d1a,!![]);}catch(_0x254f09){return BPromise['reject'](_0x254f09);}return _0x1bed77[_0xc262('0x1d')]();};}function saveUpdates(_0x161372,_0x3148f4){return function(_0x36550e){if(_0x36550e){return _0x36550e[_0xc262('0x1e')](_0x161372)['then'](function(_0x1af06e){return _0x1af06e;});}return null;};}function removeEntity(_0x1a4757,_0x13a307){return function(_0x237fe1){if(_0x237fe1){return _0x237fe1[_0xc262('0x1f')]()['then'](function(){_0x1a4757[_0xc262('0x17')](0xcc)[_0xc262('0x20')]();});}};}function handleEntityNotFound(_0x38ba13,_0x5d0da0){return function(_0xdf1eaf){if(!_0xdf1eaf){_0x38ba13[_0xc262('0x16')](0x194);}return _0xdf1eaf;};}function handleError(_0x10e4e5,_0x433b73){_0x433b73=_0x433b73||0x1f4;return function(_0x24e279){logger[_0xc262('0x21')](_0x24e279['stack']);if(_0x24e279[_0xc262('0x22')]){delete _0x24e279[_0xc262('0x22')];}_0x10e4e5[_0xc262('0x17')](_0x433b73)['send'](_0x24e279);};}exports[_0xc262('0x23')]=function(_0x471471,_0x205687){var _0x4ff1e4={},_0x3dbd89={},_0x54a05e={'count':0x0,'rows':[]};var _0x74cda2=_[_0xc262('0x24')](db[_0xc262('0x25')][_0xc262('0x26')],function(_0x5583c4){return{'name':_0x5583c4[_0xc262('0x27')],'type':_0x5583c4['type']['key']};});_0x3dbd89[_0xc262('0x28')]=_[_0xc262('0x24')](_0x74cda2,_0xc262('0x22'));_0x3dbd89['query']=_[_0xc262('0x29')](_0x471471[_0xc262('0x2a')]);_0x3dbd89[_0xc262('0x2b')]=_[_0xc262('0x2c')](_0x3dbd89[_0xc262('0x28')],_0x3dbd89['query']);_0x4ff1e4['attributes']=_['intersection'](_0x3dbd89['model'],qs[_0xc262('0x2d')](_0x471471[_0xc262('0x2a')][_0xc262('0x2d')]));_0x4ff1e4['attributes']=_0x4ff1e4[_0xc262('0x2e')]['length']?_0x4ff1e4[_0xc262('0x2e')]:_0x3dbd89['model'];if(!_0x471471[_0xc262('0x2a')][_0xc262('0x2f')](_0xc262('0x30'))){_0x4ff1e4[_0xc262('0x1b')]=qs['limit'](_0x471471['query'][_0xc262('0x1b')]);_0x4ff1e4[_0xc262('0x1a')]=qs[_0xc262('0x1a')](_0x471471[_0xc262('0x2a')][_0xc262('0x1a')]);}_0x4ff1e4[_0xc262('0x31')]=qs['sort'](_0x471471[_0xc262('0x2a')]['sort']);_0x4ff1e4[_0xc262('0x32')]=qs[_0xc262('0x2b')](_[_0xc262('0x33')](_0x471471['query'],_0x3dbd89[_0xc262('0x2b')]),_0x74cda2);if(_0x471471['query'][_0xc262('0x34')]){_0x4ff1e4[_0xc262('0x32')]=_['merge'](_0x4ff1e4[_0xc262('0x32')],{'$or':_[_0xc262('0x24')](_0x74cda2,function(_0x559072){if(_0x559072[_0xc262('0x35')]!=='VIRTUAL'){var _0x4f2868={};_0x4f2868[_0x559072[_0xc262('0x22')]]={'$like':'%'+_0x471471[_0xc262('0x2a')][_0xc262('0x34')]+'%'};return _0x4f2868;}})});}_0x4ff1e4=_[_0xc262('0x36')]({},_0x4ff1e4,_0x471471['options']);var _0x57cf21={'where':_0x4ff1e4[_0xc262('0x32')]};return db[_0xc262('0x25')][_0xc262('0x19')](_0x57cf21)[_0xc262('0x37')](function(_0x4e4ace){_0x54a05e[_0xc262('0x19')]=_0x4e4ace;if(_0x471471[_0xc262('0x2a')][_0xc262('0x38')]){_0x4ff1e4[_0xc262('0x39')]=[{'all':!![]}];}return db[_0xc262('0x25')][_0xc262('0x3a')](_0x4ff1e4);})[_0xc262('0x37')](function(_0x42de07){_0x54a05e['rows']=_0x42de07;return _0x54a05e;})[_0xc262('0x37')](respondWithFilteredResult(_0x205687,_0x4ff1e4))[_0xc262('0x3b')](handleError(_0x205687,null));};exports[_0xc262('0x3c')]=function(_0x384589,_0x1de294){var _0x562a9f={'raw':!![],'where':{'id':_0x384589[_0xc262('0x3d')]['id']}},_0x2b2cc4={};_0x2b2cc4[_0xc262('0x28')]=_[_0xc262('0x29')](db[_0xc262('0x25')][_0xc262('0x26')]);_0x2b2cc4[_0xc262('0x2a')]=_['keys'](_0x384589[_0xc262('0x2a')]);_0x2b2cc4[_0xc262('0x2b')]=_[_0xc262('0x2c')](_0x2b2cc4[_0xc262('0x28')],_0x2b2cc4[_0xc262('0x2a')]);_0x562a9f['attributes']=_[_0xc262('0x2c')](_0x2b2cc4[_0xc262('0x28')],qs['fields'](_0x384589['query'][_0xc262('0x2d')]));_0x562a9f['attributes']=_0x562a9f[_0xc262('0x2e')][_0xc262('0x3e')]?_0x562a9f['attributes']:_0x2b2cc4[_0xc262('0x28')];if(_0x384589[_0xc262('0x2a')][_0xc262('0x38')]){_0x562a9f[_0xc262('0x39')]=[{'all':!![]}];}_0x562a9f=_[_0xc262('0x36')]({},_0x562a9f,_0x384589[_0xc262('0x3f')]);return db[_0xc262('0x25')][_0xc262('0x40')](_0x562a9f)[_0xc262('0x37')](handleEntityNotFound(_0x1de294,null))[_0xc262('0x37')](respondWithResult(_0x1de294,null))['catch'](handleError(_0x1de294,null));};exports[_0xc262('0x41')]=function(_0x591f5c,_0x2f2d4c){return db[_0xc262('0x25')]['create'](_0x591f5c[_0xc262('0x42')],{})['then'](respondWithResult(_0x2f2d4c,0xc9))[_0xc262('0x3b')](handleError(_0x2f2d4c,null));};exports[_0xc262('0x1e')]=function(_0x208814,_0x518db3){if(_0x208814[_0xc262('0x42')]['id']){delete _0x208814[_0xc262('0x42')]['id'];}return db[_0xc262('0x25')][_0xc262('0x40')]({'where':{'id':_0x208814['params']['id']}})['then'](handleEntityNotFound(_0x518db3,null))[_0xc262('0x37')](saveUpdates(_0x208814[_0xc262('0x42')],null))[_0xc262('0x37')](respondWithResult(_0x518db3,null))[_0xc262('0x3b')](handleError(_0x518db3,null));};exports[_0xc262('0x1f')]=function(_0x2d9155,_0x3f6778){return db[_0xc262('0x25')][_0xc262('0x40')]({'where':{'id':_0x2d9155[_0xc262('0x3d')]['id']}})[_0xc262('0x37')](handleEntityNotFound(_0x3f6778,null))[_0xc262('0x37')](removeEntity(_0x3f6778,null))['catch'](handleError(_0x3f6778,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index bd2cd4f..6a88ccc 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 _0x3297=['api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3297,0x8d));var _0x7329=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x3297[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x7329('0x0'));var util=require(_0x7329('0x1'));var logger=require(_0x7329('0x2'))(_0x7329('0x3'));var moment=require(_0x7329('0x4'));var BPromise=require(_0x7329('0x5'));var rp=require(_0x7329('0x6'));var fs=require('fs');var path=require(_0x7329('0x7'));var rimraf=require(_0x7329('0x8'));var config=require('../../config/environment');var attributes=require(_0x7329('0x9'));module[_0x7329('0xa')]=function(_0x422762,_0x326041){return _0x422762[_0x7329('0xb')]('DeskField',attributes,{'tableName':_0x7329('0xc'),'paranoid':![],'indexes':[{'name':_0x7329('0xd'),'fields':[_0x7329('0xe'),_0x7329('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x360a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x46ce59,_0x271405){var _0x566868=function(_0x205d45){while(--_0x205d45){_0x46ce59['push'](_0x46ce59['shift']());}};_0x566868(++_0x271405);}(_0x360a,0x15c));var _0xa360=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x360a[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xa360('0x0'));var util=require(_0xa360('0x1'));var logger=require(_0xa360('0x2'))(_0xa360('0x3'));var moment=require(_0xa360('0x4'));var BPromise=require(_0xa360('0x5'));var rp=require(_0xa360('0x6'));var fs=require('fs');var path=require(_0xa360('0x7'));var rimraf=require(_0xa360('0x8'));var config=require(_0xa360('0x9'));var attributes=require(_0xa360('0xa'));module[_0xa360('0xb')]=function(_0x43f096,_0x5cbadc){return _0x43f096[_0xa360('0xc')]('DeskField',attributes,{'tableName':_0xa360('0xd'),'paranoid':![],'indexes':[{'name':_0xa360('0xe'),'fields':[_0xa360('0xf'),'FieldId'],'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 3b2424c..62b1eb8 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 _0x6b19=['debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s'];(function(_0x294b7a,_0x51b167){var _0x30d2a3=function(_0x13a696){while(--_0x13a696){_0x294b7a['push'](_0x294b7a['shift']());}};_0x30d2a3(++_0x51b167);}(_0x6b19,0x104));var _0x96b1=function(_0x208a2c,_0xd7a63a){_0x208a2c=_0x208a2c-0x0;var _0x681bb1=_0x6b19[_0x208a2c];return _0x681bb1;};'use strict';var _=require(_0x96b1('0x0'));var util=require('util');var moment=require(_0x96b1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96b1('0x2'));var db=require(_0x96b1('0x3'))['db'];var utils=require(_0x96b1('0x4'));var logger=require('../../config/logger')(_0x96b1('0x5'));var config=require('../../config/environment');var jayson=require(_0x96b1('0x6'));var client=jayson[_0x96b1('0x7')][_0x96b1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x96a86c,_0x330261,_0x46a51e){return new BPromise(function(_0x2878b8,_0x64fd72){return client[_0x96b1('0x9')](_0x96a86c,_0x46a51e)[_0x96b1('0xa')](function(_0x27fce2){logger[_0x96b1('0xb')](_0x96b1('0xc'),_0x330261,'request\x20sent');logger[_0x96b1('0xd')](_0x96b1('0xe'),_0x330261,_0x96b1('0xf'),JSON[_0x96b1('0x10')](_0x27fce2));if(_0x27fce2[_0x96b1('0x11')]){if(_0x27fce2[_0x96b1('0x11')]['code']===0x1f4){logger[_0x96b1('0x11')](_0x96b1('0xc'),_0x330261,_0x27fce2[_0x96b1('0x11')][_0x96b1('0x12')]);return _0x64fd72(_0x27fce2[_0x96b1('0x11')]['message']);}logger[_0x96b1('0x11')](_0x96b1('0xc'),_0x330261,_0x27fce2['error'][_0x96b1('0x12')]);return _0x2878b8(_0x27fce2['error'][_0x96b1('0x12')]);}else{logger[_0x96b1('0xb')]('DeskField,\x20%s,\x20%s',_0x330261,_0x96b1('0xf'));_0x2878b8(_0x27fce2[_0x96b1('0x13')][_0x96b1('0x12')]);}})[_0x96b1('0x14')](function(_0x10a750){logger[_0x96b1('0x11')](_0x96b1('0xc'),_0x330261,_0x10a750);_0x64fd72(_0x10a750);});});} \ No newline at end of file +var _0x19e9=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info'];(function(_0x15f6f7,_0x305040){var _0x37c435=function(_0x51929b){while(--_0x51929b){_0x15f6f7['push'](_0x15f6f7['shift']());}};_0x37c435(++_0x305040);}(_0x19e9,0xdc));var _0x919e=function(_0x5e335a,_0x3de525){_0x5e335a=_0x5e335a-0x0;var _0x5a6224=_0x19e9[_0x5e335a];return _0x5a6224;};'use strict';var _=require('lodash');var util=require(_0x919e('0x0'));var moment=require(_0x919e('0x1'));var BPromise=require('bluebird');var rs=require(_0x919e('0x2'));var fs=require('fs');var Redis=require(_0x919e('0x3'));var db=require(_0x919e('0x4'))['db'];var utils=require(_0x919e('0x5'));var logger=require(_0x919e('0x6'))('rpc');var config=require(_0x919e('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x523a35,_0x2dcdfc,_0x129ced){return new BPromise(function(_0xf0a079,_0x100b4a){return client[_0x919e('0x8')](_0x523a35,_0x129ced)[_0x919e('0x9')](function(_0xe1f311){logger[_0x919e('0xa')]('DeskField,\x20%s,\x20%s',_0x2dcdfc,_0x919e('0xb'));logger[_0x919e('0xc')](_0x919e('0xd'),_0x2dcdfc,_0x919e('0xb'),JSON[_0x919e('0xe')](_0xe1f311));if(_0xe1f311[_0x919e('0xf')]){if(_0xe1f311['error'][_0x919e('0x10')]===0x1f4){logger[_0x919e('0xf')](_0x919e('0x11'),_0x2dcdfc,_0xe1f311[_0x919e('0xf')][_0x919e('0x12')]);return _0x100b4a(_0xe1f311[_0x919e('0xf')]['message']);}logger[_0x919e('0xf')]('DeskField,\x20%s,\x20%s',_0x2dcdfc,_0xe1f311[_0x919e('0xf')][_0x919e('0x12')]);return _0xf0a079(_0xe1f311[_0x919e('0xf')][_0x919e('0x12')]);}else{logger[_0x919e('0xa')]('DeskField,\x20%s,\x20%s',_0x2dcdfc,'request\x20sent');_0xf0a079(_0xe1f311[_0x919e('0x13')]['message']);}})[_0x919e('0x14')](function(_0x195030){logger[_0x919e('0xf')](_0x919e('0x11'),_0x2dcdfc,_0x195030);_0x100b4a(_0x195030);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 583dff5..c7cf1f2 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 _0x57ca=['index','/:id','show','/:id/fields','getFields','create','/:id/configurations','addConfiguration','put','update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4b72b8,_0xcf6841){var _0x2c4a6b=function(_0x4361cd){while(--_0x4361cd){_0x4b72b8['push'](_0x4b72b8['shift']());}};_0x2c4a6b(++_0xcf6841);}(_0x57ca,0x108));var _0xa57c=function(_0x56e030,_0x485153){_0x56e030=_0x56e030-0x0;var _0x26b769=_0x57ca[_0x56e030];return _0x26b769;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var auth=require(_0xa57c('0x4'));var interaction=require(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xa57c('0x7')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x7')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0x7')]('/:id/configurations',auth[_0xa57c('0x8')](),controller['getConfigurations']);router[_0xa57c('0x7')](_0xa57c('0xc'),auth['isAuthenticated'](),controller[_0xa57c('0xd')]);router['post']('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0xe')]);router['post'](_0xa57c('0xf'),auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router[_0xa57c('0x11')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0x12')]);router['delete'](_0xa57c('0xa'),auth['isAuthenticated'](),controller[_0xa57c('0x13')]);module[_0xa57c('0x14')]=router; \ No newline at end of file +var _0x2032=['put','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','create','addConfiguration'];(function(_0x286372,_0x3b6338){var _0x26ef47=function(_0x583f5a){while(--_0x583f5a){_0x286372['push'](_0x286372['shift']());}};_0x26ef47(++_0x3b6338);}(_0x2032,0xd9));var _0x2203=function(_0x3408cf,_0x2b1d9d){_0x3408cf=_0x3408cf-0x0;var _0x26e989=_0x2032[_0x3408cf];return _0x26e989;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x2203('0x7')]('/:id/fields',auth[_0x2203('0x8')](),controller[_0x2203('0xd')]);router[_0x2203('0xe')]('/',auth['isAuthenticated'](),controller[_0x2203('0xf')]);router['post'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router[_0x2203('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x2203('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index fd074a3..764aaa7 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 _0x8776=['STRING','sequelize','exports'];(function(_0x2abffd,_0x760487){var _0xe147d4=function(_0x39fa89){while(--_0x39fa89){_0x2abffd['push'](_0x2abffd['shift']());}};_0xe147d4(++_0x760487);}(_0x8776,0x17e));var _0x6877=function(_0x2418d4,_0x111578){_0x2418d4=_0x2418d4-0x0;var _0x1a9386=_0x8776[_0x2418d4];return _0x1a9386;};'use strict';var Sequelize=require(_0x6877('0x0'));module[_0x6877('0x1')]={'name':{'type':Sequelize[_0x6877('0x2')]},'username':{'type':Sequelize[_0x6877('0x2')]},'password':{'type':Sequelize[_0x6877('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6877('0x2')]},'clientSecret':{'type':Sequelize[_0x6877('0x2')]},'serverUrl':{'type':Sequelize[_0x6877('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6877('0x2')]}}; \ No newline at end of file +var _0x3ad2=['STRING','sequelize','exports'];(function(_0x507364,_0x160e3a){var _0x3b6ecd=function(_0x35b8f9){while(--_0x35b8f9){_0x507364['push'](_0x507364['shift']());}};_0x3b6ecd(++_0x160e3a);}(_0x3ad2,0xfa));var _0x23ad=function(_0x135573,_0x479526){_0x135573=_0x135573-0x0;var _0x13ea56=_0x3ad2[_0x135573];return _0x13ea56;};'use strict';var Sequelize=require(_0x23ad('0x0'));module[_0x23ad('0x1')]={'name':{'type':Sequelize[_0x23ad('0x2')]},'username':{'type':Sequelize[_0x23ad('0x2')]},'password':{'type':Sequelize[_0x23ad('0x2')]},'remoteUri':{'type':Sequelize[_0x23ad('0x2')]},'tenantId':{'type':Sequelize[_0x23ad('0x2')]},'clientId':{'type':Sequelize[_0x23ad('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x23ad('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x23ad('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 4afdf1d..442e45a 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 _0x5fc3=['json','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','Dynamics365Account','includeAll','include','findAll','rows','show','options','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','merge','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','password','remoteUri','tenantId','substring','lastIndexOf','POST','https://login.microsoftonline.com/','clientId','username','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','test','statusCode','stack',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','UserLocalizedLabel','true','FalseOption','DisplayName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range'];(function(_0x1d0253,_0x20a87a){var _0x5c8839=function(_0x2deffe){while(--_0x2deffe){_0x1d0253['push'](_0x1d0253['shift']());}};_0x5c8839(++_0x20a87a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2c69a1,_0x201903){_0x2c69a1=_0x2c69a1-0x0;var _0x24bb91=_0x5fc3[_0x2c69a1];return _0x24bb91;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var as=require(_0x35fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x14'))(_0x35fc('0x15'));var utils=require('../../config/utils');var config=require(_0x35fc('0x16'));var licenseUtil=require(_0x35fc('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x35fc('0x18'));var client=jayson['client'][_0x35fc('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x22055e,_0x2a6ad2,_0x29730f,_0x38d9f2){return new BPromise(function(_0x5cfe94,_0x59507a){var _0x5eac0f=_0x38d9f2||client;return _0x5eac0f['request'](_0x22055e,_0x29730f)[_0x35fc('0x1a')](function(_0x229d56){logger[_0x35fc('0x1b')](_0x35fc('0x1c'),_0x2a6ad2,_0x35fc('0x1d'));logger[_0x35fc('0x1e')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x2a6ad2,_0x35fc('0x1d'),JSON[_0x35fc('0x1f')](_0x229d56));if(_0x229d56['error']){if(_0x229d56[_0x35fc('0x20')][_0x35fc('0x21')]===0x1f4){logger[_0x35fc('0x20')]('Dynamics365Account,\x20%s,\x20%s',_0x2a6ad2,_0x229d56[_0x35fc('0x20')][_0x35fc('0x22')]);return _0x59507a(_0x229d56[_0x35fc('0x20')]['message']);}logger[_0x35fc('0x20')](_0x35fc('0x1c'),_0x2a6ad2,_0x229d56[_0x35fc('0x20')][_0x35fc('0x22')]);return _0x5cfe94(_0x229d56[_0x35fc('0x20')][_0x35fc('0x22')]);}else{logger[_0x35fc('0x1b')](_0x35fc('0x1c'),_0x2a6ad2,_0x35fc('0x1d'));_0x5cfe94(_0x229d56[_0x35fc('0x23')]['message']);}})[_0x35fc('0x24')](function(_0xd5399f){logger[_0x35fc('0x20')](_0x35fc('0x1c'),_0x2a6ad2,_0xd5399f);_0x59507a(_0xd5399f);});});}function respondWithStatusCode(_0x3b4743,_0x55e9e7){_0x55e9e7=_0x55e9e7||0xcc;return function(_0x33f5e8){if(_0x33f5e8){return _0x3b4743[_0x35fc('0x25')](_0x55e9e7);}return _0x3b4743['status'](_0x55e9e7)[_0x35fc('0x26')]();};}function respondWithResult(_0x5a93df,_0x3d4a98){_0x3d4a98=_0x3d4a98||0xc8;return function(_0x51cfec){if(_0x51cfec){return _0x5a93df[_0x35fc('0x27')](_0x3d4a98)['json'](_0x51cfec);}};}function respondWithFilteredResult(_0x1bf180,_0xdfab9f){return function(_0x5cb986){if(_0x5cb986){var _0x519264=_0x5cb986[_0x35fc('0x28')],_0x47774c=_0xdfab9f['offset'],_0x58edb6=_0xdfab9f[_0x35fc('0x29')]+_0xdfab9f[_0x35fc('0x2a')],_0x274208;if(_0x58edb6>=_0x519264){_0x58edb6=_0x519264;_0x274208=0xc8;}else{_0x274208=0xce;}_0x1bf180[_0x35fc('0x27')](_0x274208);return _0x1bf180[_0x35fc('0x2b')](_0x35fc('0x2c'),_0x47774c+'-'+_0x58edb6+'/'+_0x519264)[_0x35fc('0x2d')](_0x5cb986);}return null;};}function patchUpdates(_0x11ccdb){return function(_0x451f0c){try{jsonpatch['apply'](_0x451f0c,_0x11ccdb,!![]);}catch(_0x1cd1ae){return BPromise[_0x35fc('0x2e')](_0x1cd1ae);}return _0x451f0c[_0x35fc('0x2f')]();};}function saveUpdates(_0x52acc5,_0xe79f52){return function(_0x16f067){if(_0x16f067){return _0x16f067[_0x35fc('0x30')](_0x52acc5)[_0x35fc('0x1a')](function(_0xd8a4ca){return _0xd8a4ca;});}return null;};}function removeEntity(_0x103181,_0x222ddb){return function(_0x37b435){if(_0x37b435){return _0x37b435[_0x35fc('0x31')]()[_0x35fc('0x1a')](function(){_0x103181['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x114bc1,_0x4af5fe){return function(_0x37b394){if(!_0x37b394){_0x114bc1[_0x35fc('0x25')](0x194);}return _0x37b394;};}function handleError(_0x1c4b8b,_0x227471){_0x227471=_0x227471||0x1f4;return function(_0x271ba9){logger[_0x35fc('0x20')](_0x271ba9['stack']);if(_0x271ba9[_0x35fc('0x32')]){delete _0x271ba9[_0x35fc('0x32')];}_0x1c4b8b[_0x35fc('0x27')](_0x227471)[_0x35fc('0x33')](_0x271ba9);};}exports[_0x35fc('0x34')]=function(_0x2f823b,_0x553597){var _0x2483be={},_0x38193d={},_0x1fecdf={'count':0x0,'rows':[]};var _0x52f53d=_[_0x35fc('0x35')](db['Dynamics365Account'][_0x35fc('0x36')],function(_0x33a377){return{'name':_0x33a377[_0x35fc('0x37')],'type':_0x33a377[_0x35fc('0x38')]['key']};});_0x38193d['model']=_['map'](_0x52f53d,_0x35fc('0x32'));_0x38193d['query']=_[_0x35fc('0x39')](_0x2f823b['query']);_0x38193d[_0x35fc('0x3a')]=_[_0x35fc('0x3b')](_0x38193d[_0x35fc('0x3c')],_0x38193d[_0x35fc('0x3d')]);_0x2483be[_0x35fc('0x3e')]=_[_0x35fc('0x3b')](_0x38193d[_0x35fc('0x3c')],qs['fields'](_0x2f823b[_0x35fc('0x3d')][_0x35fc('0x3f')]));_0x2483be['attributes']=_0x2483be[_0x35fc('0x3e')][_0x35fc('0x40')]?_0x2483be[_0x35fc('0x3e')]:_0x38193d[_0x35fc('0x3c')];if(!_0x2f823b[_0x35fc('0x3d')][_0x35fc('0x41')]('nolimit')){_0x2483be[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x2f823b[_0x35fc('0x3d')]['limit']);_0x2483be[_0x35fc('0x29')]=qs[_0x35fc('0x29')](_0x2f823b['query'][_0x35fc('0x29')]);}_0x2483be[_0x35fc('0x42')]=qs[_0x35fc('0x43')](_0x2f823b[_0x35fc('0x3d')][_0x35fc('0x43')]);_0x2483be[_0x35fc('0x44')]=qs[_0x35fc('0x3a')](_[_0x35fc('0x45')](_0x2f823b['query'],_0x38193d['filters']),_0x52f53d);if(_0x2f823b[_0x35fc('0x3d')][_0x35fc('0x46')]){_0x2483be['where']=_['merge'](_0x2483be['where'],{'$or':_[_0x35fc('0x35')](_0x52f53d,function(_0x10f98b){if(_0x10f98b['type']!==_0x35fc('0x47')){var _0x15cb86={};_0x15cb86[_0x10f98b[_0x35fc('0x32')]]={'$like':'%'+_0x2f823b[_0x35fc('0x3d')]['filter']+'%'};return _0x15cb86;}})});}_0x2483be=_['merge']({},_0x2483be,_0x2f823b['options']);var _0x539157={'where':_0x2483be['where']};return db[_0x35fc('0x48')][_0x35fc('0x28')](_0x539157)['then'](function(_0x119925){_0x1fecdf['count']=_0x119925;if(_0x2f823b[_0x35fc('0x3d')][_0x35fc('0x49')]){_0x2483be[_0x35fc('0x4a')]=[{'all':!![]}];}return db[_0x35fc('0x48')][_0x35fc('0x4b')](_0x2483be);})['then'](function(_0x64d381){_0x1fecdf[_0x35fc('0x4c')]=_0x64d381;return _0x1fecdf;})['then'](respondWithFilteredResult(_0x553597,_0x2483be))[_0x35fc('0x24')](handleError(_0x553597,null));};exports[_0x35fc('0x4d')]=function(_0x2a8a09,_0x211746){var _0x5bc8c3={'raw':![],'where':{'id':_0x2a8a09['params']['id']}},_0x3666a5={};_0x3666a5['model']=_[_0x35fc('0x39')](db[_0x35fc('0x48')][_0x35fc('0x36')]);_0x3666a5[_0x35fc('0x3d')]=_[_0x35fc('0x39')](_0x2a8a09[_0x35fc('0x3d')]);_0x3666a5[_0x35fc('0x3a')]=_[_0x35fc('0x3b')](_0x3666a5['model'],_0x3666a5[_0x35fc('0x3d')]);_0x5bc8c3[_0x35fc('0x3e')]=_[_0x35fc('0x3b')](_0x3666a5[_0x35fc('0x3c')],qs[_0x35fc('0x3f')](_0x2a8a09[_0x35fc('0x3d')][_0x35fc('0x3f')]));_0x5bc8c3[_0x35fc('0x3e')]=_0x5bc8c3[_0x35fc('0x3e')][_0x35fc('0x40')]?_0x5bc8c3[_0x35fc('0x3e')]:_0x3666a5[_0x35fc('0x3c')];if(_0x2a8a09[_0x35fc('0x3d')][_0x35fc('0x49')]){_0x5bc8c3['include']=[{'all':!![]}];}_0x5bc8c3=_['merge']({},_0x5bc8c3,_0x2a8a09[_0x35fc('0x4e')]);return db[_0x35fc('0x48')][_0x35fc('0x4f')](_0x5bc8c3)[_0x35fc('0x1a')](handleEntityNotFound(_0x211746,null))[_0x35fc('0x1a')](respondWithResult(_0x211746,null))[_0x35fc('0x24')](handleError(_0x211746,null));};exports['create']=function(_0x4f024c,_0x388521){return db[_0x35fc('0x48')][_0x35fc('0x50')](_0x4f024c[_0x35fc('0x51')],{})['then'](respondWithResult(_0x388521,0xc9))[_0x35fc('0x24')](handleError(_0x388521,null));};exports[_0x35fc('0x30')]=function(_0x4965d2,_0x199a00){if(_0x4965d2[_0x35fc('0x51')]['id']){delete _0x4965d2['body']['id'];}return db[_0x35fc('0x48')][_0x35fc('0x4f')]({'where':{'id':_0x4965d2[_0x35fc('0x52')]['id']}})[_0x35fc('0x1a')](handleEntityNotFound(_0x199a00,null))['then'](saveUpdates(_0x4965d2['body'],null))['then'](respondWithResult(_0x199a00,null))[_0x35fc('0x24')](handleError(_0x199a00,null));};exports[_0x35fc('0x31')]=function(_0x5ce231,_0x444d7e){return db[_0x35fc('0x48')][_0x35fc('0x4f')]({'where':{'id':_0x5ce231[_0x35fc('0x52')]['id']}})[_0x35fc('0x1a')](handleEntityNotFound(_0x444d7e,null))['then'](removeEntity(_0x444d7e,null))[_0x35fc('0x24')](handleError(_0x444d7e,null));};exports[_0x35fc('0x53')]=function(_0x39d470,_0x509e77,_0x304dba){var _0x1dbf5a={};var _0x47fb1a={};var _0x35a676;var _0x164c7b;return db[_0x35fc('0x48')][_0x35fc('0x54')]({'where':{'id':_0x39d470[_0x35fc('0x52')]['id']}})[_0x35fc('0x1a')](handleEntityNotFound(_0x509e77,null))[_0x35fc('0x1a')](function(_0x998fd9){if(_0x998fd9){_0x35a676=_0x998fd9;_0x47fb1a['model']=_[_0x35fc('0x39')](db[_0x35fc('0x55')][_0x35fc('0x36')]);_0x47fb1a['query']=_[_0x35fc('0x39')](_0x39d470['query']);_0x47fb1a['filters']=_['intersection'](_0x47fb1a[_0x35fc('0x3c')],_0x47fb1a[_0x35fc('0x3d')]);_0x1dbf5a[_0x35fc('0x3e')]=_[_0x35fc('0x3b')](_0x47fb1a[_0x35fc('0x3c')],qs['fields'](_0x39d470['query']['fields']));_0x1dbf5a['attributes']=_0x1dbf5a['attributes'][_0x35fc('0x40')]?_0x1dbf5a[_0x35fc('0x3e')]:_0x47fb1a[_0x35fc('0x3c')];_0x1dbf5a[_0x35fc('0x42')]=qs['sort'](_0x39d470[_0x35fc('0x3d')][_0x35fc('0x43')]);_0x1dbf5a[_0x35fc('0x44')]=qs[_0x35fc('0x3a')](_[_0x35fc('0x45')](_0x39d470[_0x35fc('0x3d')],_0x47fb1a[_0x35fc('0x3a')]));if(_0x39d470[_0x35fc('0x3d')][_0x35fc('0x46')]){_0x1dbf5a['where']=_[_0x35fc('0x56')](_0x1dbf5a['where'],{'$or':_[_0x35fc('0x35')](_0x1dbf5a[_0x35fc('0x3e')],function(_0x2ac8e1){var _0x2bc76c={};_0x2bc76c[_0x2ac8e1]={'$like':'%'+_0x39d470['query'][_0x35fc('0x46')]+'%'};return _0x2bc76c;})});}_0x1dbf5a=_['merge']({},_0x1dbf5a,_0x39d470['options']);return _0x35a676['getConfigurations'](_0x1dbf5a);}})[_0x35fc('0x1a')](function(_0x5dfeb7){if(_0x5dfeb7){_0x164c7b=_0x5dfeb7[_0x35fc('0x40')];if(!_0x39d470['query'][_0x35fc('0x41')]('nolimit')){_0x1dbf5a[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x39d470[_0x35fc('0x3d')][_0x35fc('0x2a')]);_0x1dbf5a['offset']=qs[_0x35fc('0x29')](_0x39d470[_0x35fc('0x3d')][_0x35fc('0x29')]);}return _0x35a676['getConfigurations'](_0x1dbf5a);}})[_0x35fc('0x1a')](function(_0x8a4a13){if(_0x8a4a13){return _0x8a4a13?{'count':_0x164c7b,'rows':_0x8a4a13}:null;}})[_0x35fc('0x1a')](respondWithResult(_0x509e77,null))[_0x35fc('0x24')](handleError(_0x509e77,null));};exports[_0x35fc('0x57')]=function(_0x2c4309,_0x2ee98b,_0x4464d5){if(_0x2c4309['body']['id']){delete _0x2c4309[_0x35fc('0x51')]['id'];}return db[_0x35fc('0x48')][_0x35fc('0x54')]({'where':{'id':_0x2c4309['params']['id']}})[_0x35fc('0x1a')](handleEntityNotFound(_0x2ee98b,null))[_0x35fc('0x1a')](function(_0x586729){if(_0x586729){_0x2c4309['body'][_0x35fc('0x58')]=_0x586729['id'];_0x2c4309['body'][_0x35fc('0x59')]=integrations[_0x35fc('0x5a')](_0x2c4309[_0x35fc('0x51')][_0x35fc('0x5b')],_0x2c4309[_0x35fc('0x51')][_0x35fc('0x38')]);_0x2c4309[_0x35fc('0x51')][_0x35fc('0x5c')]=integrations[_0x35fc('0x5d')](_0x2c4309[_0x35fc('0x51')][_0x35fc('0x5b')],_0x2c4309[_0x35fc('0x51')][_0x35fc('0x38')]);return db[_0x35fc('0x55')][_0x35fc('0x50')](_0x2c4309[_0x35fc('0x51')],{'include':[{'model':db[_0x35fc('0x5e')],'as':_0x35fc('0x59')},{'model':db[_0x35fc('0x5e')],'as':_0x35fc('0x5c')}]});}return null;})['then'](respondWithResult(_0x2ee98b,null))[_0x35fc('0x24')](handleError(_0x2ee98b,null));};exports['getFields']=function(_0x88d681,_0x6c5ef,_0x2185ce){var _0x516b26=_0x88d681[_0x35fc('0x3d')][_0x35fc('0x5f')];var _0x2913ba=_0x516b26===_0x35fc('0x60')?_0x35fc('0x61'):_0x35fc('0x62');var _0x2ee880='';var _0x580062='';var _0x446e87='';var _0x4657de='';var _0x2c1bd2='';var _0x1ca01f='';var _0x3a973d='';var _0x41a6de='';var _0x5416cd=[_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x65'),_0x35fc('0x66'),_0x35fc('0x67'),_0x35fc('0x68'),_0x35fc('0x69'),_0x35fc('0x6a'),_0x35fc('0x6b'),'phonecall_activity_parties'];var _0x28f02b=['accountidname',_0x35fc('0x6c'),_0x35fc('0x6d'),'billedserviceunits',_0x35fc('0x6e'),_0x35fc('0x6f'),_0x35fc('0x70'),_0x35fc('0x71'),_0x35fc('0x72'),_0x35fc('0x73'),_0x35fc('0x74'),_0x35fc('0x75'),_0x35fc('0x76'),'createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype',_0x35fc('0x77'),_0x35fc('0x78'),_0x35fc('0x79'),_0x35fc('0x7a'),_0x35fc('0x7b'),'escalatedon',_0x35fc('0x7c'),_0x35fc('0x7d'),_0x35fc('0x7e'),_0x35fc('0x7f'),'influencescore',_0x35fc('0x80'),_0x35fc('0x81'),_0x35fc('0x82'),'modifiedbyexternalpartyname',_0x35fc('0x83'),_0x35fc('0x84'),_0x35fc('0x85'),_0x35fc('0x86'),_0x35fc('0x87'),_0x35fc('0x88'),_0x35fc('0x89'),_0x35fc('0x8a'),'numberofchildincidents',_0x35fc('0x8b'),_0x35fc('0x8c'),_0x35fc('0x8d'),_0x35fc('0x8e'),_0x35fc('0x8f'),_0x35fc('0x90'),'primarycontactidname',_0x35fc('0x91'),'prioritycodename','productidname',_0x35fc('0x92'),'resolveby',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'responsiblecontactidyominame',_0x35fc('0x96'),_0x35fc('0x97'),_0x35fc('0x98'),_0x35fc('0x99'),_0x35fc('0x9a'),'statuscode','subjectidname','ticketnumber',_0x35fc('0x9b'),'transactioncurrencyidname',_0x35fc('0x9c'),_0x35fc('0x9d'),_0x35fc('0x9e')];var _0xdce898=_0x5416cd['concat'](_0x28f02b);return db[_0x35fc('0x48')][_0x35fc('0x54')]({'where':{'id':_0x88d681[_0x35fc('0x52')]['id']},'attributes':['id','username',_0x35fc('0x9f'),_0x35fc('0xa0'),_0x35fc('0xa1'),'clientId','clientSecret']})['then'](handleEntityNotFound(_0x6c5ef,null))[_0x35fc('0x1a')](function(_0x2edb1b){if(_0x2edb1b){_0x41a6de=_0x2edb1b[_0x35fc('0xa0')];var _0x3858a9=_0x41a6de['slice'](-0x1);if(_0x3858a9==='/'){_0x41a6de=_0x41a6de[_0x35fc('0xa2')](0x0,_0x41a6de[_0x35fc('0xa3')](_0x3858a9));}_0x3a973d=util['format']('%s/api/data/v9.0/',_0x41a6de);var _0x143c94={'method':_0x35fc('0xa4'),'uri':_0x35fc('0xa5')+_0x2edb1b['tenantId']+'/oauth2/token','form':{'client_id':_0x2edb1b[_0x35fc('0xa6')],'resource':_0x41a6de,'username':_0x2edb1b[_0x35fc('0xa7')],'password':_0x2edb1b['password'],'grant_type':_0x35fc('0x9f'),'client_secret':_0x2edb1b[_0x35fc('0xa8')]},'json':!![]};return rp(_0x143c94);}})[_0x35fc('0x1a')](function(_0x4ef813){_0x1ca01f=_0x4ef813[_0x35fc('0xa9')];var _0x1e4af3={'method':_0x35fc('0xaa'),'uri':encodeURI(_0x3a973d+_0x35fc('0xab')+_0x2913ba+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1ca01f,'If-None-Match':null,'OData-Version':_0x35fc('0xac')},'json':!![]};return rp(_0x1e4af3);})[_0x35fc('0x1a')](function(_0x41483f){var _0x494a1d=_0x41483f[_0x35fc('0xad')][0x0];var _0x26d242=_0x494a1d[_0x35fc('0xae')];var _0x5c6c2b={'method':_0x35fc('0xaa'),'uri':_0x3a973d+_0x35fc('0xaf')+_0x26d242+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x35fc('0xb0')+_0x1ca01f,'If-None-Match':null,'OData-Version':_0x35fc('0xac')},'json':!![]};return rp(_0x5c6c2b);})[_0x35fc('0x1a')](function(_0x45eaae){_0x2ee880=_0x45eaae;_0x580062=_0x2ee880[_0x35fc('0xb1')];_0x580062=_[_0x35fc('0xb2')](_0x580062,function(_0x280573){return!_0xdce898[_0x35fc('0xb3')](_0x280573[_0x35fc('0xb4')]);});var _0x5d8f81=[];var _0x34474a=[];_0x580062[_0x35fc('0xb5')](function(_0xc6744c){if(_0xc6744c[_0x35fc('0xb6')]){var _0x53857f=_0xc6744c[_0x35fc('0xb6')][_0x35fc('0xa2')](_0xc6744c[_0x35fc('0xb6')][_0x35fc('0xa3')]('.')+0x1);if(_0x53857f===_0x35fc('0xb7')){_0x5d8f81[_0x35fc('0xb8')](getSelectList(_0x3a973d,_0x516b26,_0x34474a,_0x2ee880[_0x35fc('0xae')],_0xc6744c[_0x35fc('0xae')],_0x1ca01f));}}});return Promise['all'](_0x5d8f81);})['then'](function(_0x3ee301){_0x446e87=_0x3ee301[0x0];var _0xafa771=[];var _0x961ee9=[];_0x580062['forEach'](function(_0xda1432){if(!_[_0x35fc('0xb9')](_0xda1432[_0x35fc('0xb6')])){var _0xf1f222=_0xda1432['@odata.type']['substring'](_0xda1432[_0x35fc('0xb6')]['lastIndexOf']('.')+0x1);if(_0xf1f222===_0x35fc('0xba')){_0xafa771[_0x35fc('0xb8')](getBooleanList(_0x3a973d,_0x516b26,_0x961ee9,_0x2ee880['MetadataId'],_0xda1432['MetadataId'],_0x1ca01f));}}});return Promise[_0x35fc('0xbb')](_0xafa771);})[_0x35fc('0x1a')](function(_0xa4652b){_0x4657de=_0xa4652b[0x0];var _0x479e28=[];var _0x1bafe6=[];_0x580062[_0x35fc('0xb5')](function(_0x2f3571){if(_0x2f3571['@odata.type']){var _0xde26e7=_0x2f3571[_0x35fc('0xb6')][_0x35fc('0xa2')](_0x2f3571[_0x35fc('0xb6')]['lastIndexOf']('.')+0x1);if(_0xde26e7===_0x35fc('0xbc')||_0xde26e7===_0x35fc('0xbd')||_0xde26e7===_0x35fc('0xbe')||_0xde26e7===_0x35fc('0xbf')||_0xde26e7===_0x35fc('0xc0')||_0xde26e7===_0x35fc('0xc1')||_0xde26e7==='StatusAttributeMetadata'||_0xde26e7===_0x35fc('0xc2')||_0xde26e7===_0x35fc('0xc3')||_0xde26e7==='DecimalAttributeMetadata'){_0x479e28[_0x35fc('0xb8')](getInputList(_0x3a973d,_0x516b26,_0xde26e7,_0x1bafe6,_0x2ee880[_0x35fc('0xae')],_0x2f3571['MetadataId'],_0x1ca01f));}}});return Promise[_0x35fc('0xbb')](_0x479e28);})[_0x35fc('0x1a')](function(_0x72a17a){_0x2c1bd2=_0x72a17a[0x0];var _0x28a5e3=_0x446e87[_0x35fc('0xc4')](_0x4657de)['concat'](_0x2c1bd2);var _0x4405bb={'count':_0x28a5e3[_0x35fc('0x40')],'rows':_0x28a5e3};return _0x4405bb;})[_0x35fc('0x1a')](respondWithResult(_0x6c5ef,null))['catch'](function(_0x1224cd){var _0x5a8641=_0x88d681['query'][_0x35fc('0xc5')]?0x1f4:_0x1224cd[_0x35fc('0xc6')]||0x1f4;logger[_0x35fc('0x20')](_0x1224cd[_0x35fc('0xc7')]);delete _0x1224cd[_0x35fc('0x32')];if(_0x5a8641===0x191){_0x5a8641=0x190;}_0x6c5ef['status'](_0x5a8641)[_0x35fc('0x33')](_0x88d681[_0x35fc('0x3d')][_0x35fc('0xc5')]?{'message':'Wrong\x20credentials','statusCode':_0x1224cd[_0x35fc('0xc6')]}:_0x1224cd);});};function getSelectList(_0x32ef84,_0x116b2b,_0x448cd5,_0x169112,_0x4ec3ba,_0x1a2d73){var _0x1bd27f={'method':'GET','uri':_0x32ef84+'EntityDefinitions('+_0x169112+_0x35fc('0xc8')+_0x4ec3ba+_0x35fc('0xc9')+_0x35fc('0xca'),'headers':{'Authorization':_0x35fc('0xb0')+_0x1a2d73,'If-None-Match':null,'OData-Version':_0x35fc('0xac')},'json':!![]};return rp(_0x1bd27f)[_0x35fc('0x1a')](function(_0x8c80ca){var _0x5059a2=[];var _0x5dc286=_0x8c80ca[_0x35fc('0xcb')][_0x35fc('0xcc')];_0x5dc286[_0x35fc('0xb5')](function(_0x1a92fa){_0x5059a2[_0x35fc('0xb8')]({'name':_0x1a92fa['Label']['UserLocalizedLabel'][_0x35fc('0xcd')],'value':String(_0x1a92fa[_0x35fc('0xce')])});});var _0x3fff79={'id':_0x116b2b+'_'+_0x8c80ca[_0x35fc('0xb4')],'name':_0x8c80ca['DisplayName']['UserLocalizedLabel'][_0x35fc('0xcd')],'custom':![],'options':_0x5059a2};_0x448cd5[_0x35fc('0xb8')](_0x3fff79);return _0x448cd5;});}function getBooleanList(_0x316689,_0xd46d64,_0x51bd0c,_0x58a580,_0xa728fb,_0x41478c){var _0x4a1545={'method':_0x35fc('0xaa'),'uri':_0x316689+_0x35fc('0xaf')+_0x58a580+_0x35fc('0xc8')+_0xa728fb+_0x35fc('0xcf'),'headers':{'Authorization':_0x35fc('0xb0')+_0x41478c,'If-None-Match':null,'OData-Version':_0x35fc('0xac')},'json':!![]};return rp(_0x4a1545)[_0x35fc('0x1a')](function(_0x285fcb){var _0x42836b=[];_0x42836b[_0x35fc('0xb8')]({'name':_0x285fcb[_0x35fc('0xcb')][_0x35fc('0xd0')][_0x35fc('0xcd')][_0x35fc('0xd1')][_0x35fc('0xcd')],'value':_0x35fc('0xd2')},{'name':_0x285fcb['OptionSet'][_0x35fc('0xd3')]['Label'][_0x35fc('0xd1')]['Label'],'value':'false'});var _0x3c96ef={'id':_0xd46d64+'_'+_0x285fcb[_0x35fc('0xb4')],'name':_0x285fcb[_0x35fc('0xd4')]['UserLocalizedLabel'][_0x35fc('0xcd')],'custom':![],'options':_0x42836b};_0x51bd0c[_0x35fc('0xb8')](_0x3c96ef);return _0x51bd0c;});}function getInputList(_0xe9c7c2,_0x888f44,_0x5fc40d,_0x1f7090,_0x59f733,_0x4f3342,_0xae570b){var _0x4e8e52={'method':'GET','uri':_0xe9c7c2+_0x35fc('0xaf')+_0x59f733+')/Attributes('+_0x4f3342+')/Microsoft.Dynamics.CRM.'+_0x5fc40d+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x35fc('0xb0')+_0xae570b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4e8e52)[_0x35fc('0x1a')](function(_0x21d3a0){var _0x406847={'id':_0x888f44+'_'+_0x21d3a0[_0x35fc('0xb4')],'name':_0x21d3a0[_0x35fc('0xd4')][_0x35fc('0xd1')]?_0x21d3a0['DisplayName']['UserLocalizedLabel'][_0x35fc('0xcd')]:_0x21d3a0['LogicalName'],'custom':![],'options':[]};_0x1f7090[_0x35fc('0xb8')](_0x406847);return _0x1f7090;});} \ No newline at end of file +var _0x687b=['customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','concat','username','password','remoteUri','tenantId','clientId','clientSecret','lastIndexOf','POST','/oauth2/token','access_token','GET','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','@odata.type','substring','PicklistAttributeMetadata','push','MetadataId','all','forEach','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','UserLocalizedLabel','Value','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','FalseOption','false','DisplayName','html-pdf','eml-format','rimraf','zip-dir','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/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','Dynamics365Account','includeAll','include','findAll','show','params','fields','length','create','body','getConfigurations','findOne','Dynamics365Configuration','sort','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','getFields','ticketType','incident','title'];(function(_0x4d282d,_0x41514f){var _0x5a32f0=function(_0x42fc6d){while(--_0x42fc6d){_0x4d282d['push'](_0x4d282d['shift']());}};_0x5a32f0(++_0x41514f);}(_0x687b,0x14a));var _0xb687=function(_0x1b0899,_0x179c99){_0x1b0899=_0x1b0899-0x0;var _0x30273f=_0x687b[_0x1b0899];return _0x30273f;};'use strict';var pdf=require(_0xb687('0x0'));var emlformat=require(_0xb687('0x1'));var rimraf=require(_0xb687('0x2'));var zipdir=require(_0xb687('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb687('0x4'));var BPromise=require(_0xb687('0x5'));var Mustache=require(_0xb687('0x6'));var util=require(_0xb687('0x7'));var path=require(_0xb687('0x8'));var sox=require(_0xb687('0x9'));var csv=require(_0xb687('0xa'));var ejs=require(_0xb687('0xb'));var fs=require('fs');var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];var integrations=require(_0xb687('0x1c'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb687('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x155ebe,_0x49e233,_0x108fd0,_0x2f1ac0){return new BPromise(function(_0x1f1f35,_0x30d502){var _0x838dd4=_0x2f1ac0||client;return _0x838dd4[_0xb687('0x1e')](_0x155ebe,_0x108fd0)[_0xb687('0x1f')](function(_0x141375){logger[_0xb687('0x20')](_0xb687('0x21'),_0x49e233,_0xb687('0x22'));logger[_0xb687('0x23')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x49e233,_0xb687('0x22'),JSON[_0xb687('0x24')](_0x141375));if(_0x141375[_0xb687('0x25')]){if(_0x141375['error']['code']===0x1f4){logger[_0xb687('0x25')](_0xb687('0x21'),_0x49e233,_0x141375[_0xb687('0x25')]['message']);return _0x30d502(_0x141375[_0xb687('0x25')]['message']);}logger[_0xb687('0x25')](_0xb687('0x21'),_0x49e233,_0x141375[_0xb687('0x25')][_0xb687('0x26')]);return _0x1f1f35(_0x141375['error'][_0xb687('0x26')]);}else{logger['info'](_0xb687('0x21'),_0x49e233,_0xb687('0x22'));_0x1f1f35(_0x141375[_0xb687('0x27')]['message']);}})[_0xb687('0x28')](function(_0x491623){logger[_0xb687('0x25')](_0xb687('0x21'),_0x49e233,_0x491623);_0x30d502(_0x491623);});});}function respondWithStatusCode(_0xbf6c58,_0x38866c){_0x38866c=_0x38866c||0xcc;return function(_0xf48ba4){if(_0xf48ba4){return _0xbf6c58[_0xb687('0x29')](_0x38866c);}return _0xbf6c58['status'](_0x38866c)[_0xb687('0x2a')]();};}function respondWithResult(_0x129347,_0x1c1585){_0x1c1585=_0x1c1585||0xc8;return function(_0x1a0261){if(_0x1a0261){return _0x129347[_0xb687('0x2b')](_0x1c1585)[_0xb687('0x2c')](_0x1a0261);}};}function respondWithFilteredResult(_0x17ff2b,_0x3cb2f2){return function(_0x3ff9e1){if(_0x3ff9e1){var _0x2e6185=_0x3ff9e1[_0xb687('0x2d')],_0x4a61ec=_0x3cb2f2[_0xb687('0x2e')],_0x3712cf=_0x3cb2f2[_0xb687('0x2e')]+_0x3cb2f2[_0xb687('0x2f')],_0x192966;if(_0x3712cf>=_0x2e6185){_0x3712cf=_0x2e6185;_0x192966=0xc8;}else{_0x192966=0xce;}_0x17ff2b['status'](_0x192966);return _0x17ff2b[_0xb687('0x30')]('Content-Range',_0x4a61ec+'-'+_0x3712cf+'/'+_0x2e6185)[_0xb687('0x2c')](_0x3ff9e1);}return null;};}function patchUpdates(_0x40f35c){return function(_0x6df7a2){try{jsonpatch[_0xb687('0x31')](_0x6df7a2,_0x40f35c,!![]);}catch(_0x1ad3ef){return BPromise[_0xb687('0x32')](_0x1ad3ef);}return _0x6df7a2[_0xb687('0x33')]();};}function saveUpdates(_0x556815,_0x3da2be){return function(_0xe3428f){if(_0xe3428f){return _0xe3428f[_0xb687('0x34')](_0x556815)[_0xb687('0x1f')](function(_0xa18fec){return _0xa18fec;});}return null;};}function removeEntity(_0x263834,_0x44be88){return function(_0x164353){if(_0x164353){return _0x164353[_0xb687('0x35')]()[_0xb687('0x1f')](function(){_0x263834[_0xb687('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cb06d,_0x1807b3){return function(_0xe4456){if(!_0xe4456){_0x4cb06d[_0xb687('0x29')](0x194);}return _0xe4456;};}function handleError(_0x32abc4,_0x4fc44a){_0x4fc44a=_0x4fc44a||0x1f4;return function(_0x4f0b28){logger[_0xb687('0x25')](_0x4f0b28[_0xb687('0x36')]);if(_0x4f0b28['name']){delete _0x4f0b28[_0xb687('0x37')];}_0x32abc4[_0xb687('0x2b')](_0x4fc44a)['send'](_0x4f0b28);};}exports[_0xb687('0x38')]=function(_0x5c4964,_0x16e195){var _0x24f34e={},_0x2da038={},_0x3e146a={'count':0x0,'rows':[]};var _0x32d66c=_[_0xb687('0x39')](db['Dynamics365Account'][_0xb687('0x3a')],function(_0x16c37d){return{'name':_0x16c37d[_0xb687('0x3b')],'type':_0x16c37d[_0xb687('0x3c')]['key']};});_0x2da038[_0xb687('0x3d')]=_[_0xb687('0x39')](_0x32d66c,_0xb687('0x37'));_0x2da038[_0xb687('0x3e')]=_[_0xb687('0x3f')](_0x5c4964['query']);_0x2da038[_0xb687('0x40')]=_[_0xb687('0x41')](_0x2da038[_0xb687('0x3d')],_0x2da038[_0xb687('0x3e')]);_0x24f34e[_0xb687('0x42')]=_[_0xb687('0x41')](_0x2da038['model'],qs['fields'](_0x5c4964[_0xb687('0x3e')]['fields']));_0x24f34e[_0xb687('0x42')]=_0x24f34e[_0xb687('0x42')]['length']?_0x24f34e[_0xb687('0x42')]:_0x2da038[_0xb687('0x3d')];if(!_0x5c4964['query'][_0xb687('0x43')](_0xb687('0x44'))){_0x24f34e[_0xb687('0x2f')]=qs['limit'](_0x5c4964[_0xb687('0x3e')][_0xb687('0x2f')]);_0x24f34e[_0xb687('0x2e')]=qs[_0xb687('0x2e')](_0x5c4964[_0xb687('0x3e')][_0xb687('0x2e')]);}_0x24f34e[_0xb687('0x45')]=qs['sort'](_0x5c4964[_0xb687('0x3e')]['sort']);_0x24f34e['where']=qs[_0xb687('0x40')](_[_0xb687('0x46')](_0x5c4964['query'],_0x2da038[_0xb687('0x40')]),_0x32d66c);if(_0x5c4964['query'][_0xb687('0x47')]){_0x24f34e[_0xb687('0x48')]=_['merge'](_0x24f34e[_0xb687('0x48')],{'$or':_[_0xb687('0x39')](_0x32d66c,function(_0x5d9cb0){if(_0x5d9cb0[_0xb687('0x3c')]!==_0xb687('0x49')){var _0x2783c9={};_0x2783c9[_0x5d9cb0[_0xb687('0x37')]]={'$like':'%'+_0x5c4964[_0xb687('0x3e')][_0xb687('0x47')]+'%'};return _0x2783c9;}})});}_0x24f34e=_[_0xb687('0x4a')]({},_0x24f34e,_0x5c4964[_0xb687('0x4b')]);var _0x41b1b6={'where':_0x24f34e[_0xb687('0x48')]};return db[_0xb687('0x4c')][_0xb687('0x2d')](_0x41b1b6)['then'](function(_0x1ac373){_0x3e146a['count']=_0x1ac373;if(_0x5c4964[_0xb687('0x3e')][_0xb687('0x4d')]){_0x24f34e[_0xb687('0x4e')]=[{'all':!![]}];}return db[_0xb687('0x4c')][_0xb687('0x4f')](_0x24f34e);})[_0xb687('0x1f')](function(_0x49c2da){_0x3e146a['rows']=_0x49c2da;return _0x3e146a;})[_0xb687('0x1f')](respondWithFilteredResult(_0x16e195,_0x24f34e))[_0xb687('0x28')](handleError(_0x16e195,null));};exports[_0xb687('0x50')]=function(_0x4f3069,_0x4f5736){var _0x3b5f2d={'raw':![],'where':{'id':_0x4f3069[_0xb687('0x51')]['id']}},_0x302d6d={};_0x302d6d[_0xb687('0x3d')]=_['keys'](db[_0xb687('0x4c')][_0xb687('0x3a')]);_0x302d6d[_0xb687('0x3e')]=_[_0xb687('0x3f')](_0x4f3069['query']);_0x302d6d['filters']=_[_0xb687('0x41')](_0x302d6d[_0xb687('0x3d')],_0x302d6d[_0xb687('0x3e')]);_0x3b5f2d['attributes']=_['intersection'](_0x302d6d[_0xb687('0x3d')],qs[_0xb687('0x52')](_0x4f3069[_0xb687('0x3e')][_0xb687('0x52')]));_0x3b5f2d[_0xb687('0x42')]=_0x3b5f2d[_0xb687('0x42')][_0xb687('0x53')]?_0x3b5f2d[_0xb687('0x42')]:_0x302d6d['model'];if(_0x4f3069[_0xb687('0x3e')][_0xb687('0x4d')]){_0x3b5f2d[_0xb687('0x4e')]=[{'all':!![]}];}_0x3b5f2d=_['merge']({},_0x3b5f2d,_0x4f3069['options']);return db['Dynamics365Account']['find'](_0x3b5f2d)[_0xb687('0x1f')](handleEntityNotFound(_0x4f5736,null))[_0xb687('0x1f')](respondWithResult(_0x4f5736,null))[_0xb687('0x28')](handleError(_0x4f5736,null));};exports[_0xb687('0x54')]=function(_0x1ddfd4,_0x245d92){return db[_0xb687('0x4c')][_0xb687('0x54')](_0x1ddfd4[_0xb687('0x55')],{})[_0xb687('0x1f')](respondWithResult(_0x245d92,0xc9))[_0xb687('0x28')](handleError(_0x245d92,null));};exports[_0xb687('0x34')]=function(_0x22c4b4,_0xbffa37){if(_0x22c4b4[_0xb687('0x55')]['id']){delete _0x22c4b4[_0xb687('0x55')]['id'];}return db[_0xb687('0x4c')]['find']({'where':{'id':_0x22c4b4['params']['id']}})[_0xb687('0x1f')](handleEntityNotFound(_0xbffa37,null))[_0xb687('0x1f')](saveUpdates(_0x22c4b4[_0xb687('0x55')],null))[_0xb687('0x1f')](respondWithResult(_0xbffa37,null))['catch'](handleError(_0xbffa37,null));};exports[_0xb687('0x35')]=function(_0x37feb8,_0x586eae){return db[_0xb687('0x4c')]['find']({'where':{'id':_0x37feb8[_0xb687('0x51')]['id']}})[_0xb687('0x1f')](handleEntityNotFound(_0x586eae,null))['then'](removeEntity(_0x586eae,null))['catch'](handleError(_0x586eae,null));};exports[_0xb687('0x56')]=function(_0x4ab9c5,_0x5ea8fd,_0x1da4d1){var _0x318be6={};var _0x3cd364={};var _0x50c7e0;var _0x25e140;return db['Dynamics365Account'][_0xb687('0x57')]({'where':{'id':_0x4ab9c5[_0xb687('0x51')]['id']}})[_0xb687('0x1f')](handleEntityNotFound(_0x5ea8fd,null))[_0xb687('0x1f')](function(_0x819b63){if(_0x819b63){_0x50c7e0=_0x819b63;_0x3cd364['model']=_['keys'](db[_0xb687('0x58')]['rawAttributes']);_0x3cd364['query']=_['keys'](_0x4ab9c5['query']);_0x3cd364[_0xb687('0x40')]=_[_0xb687('0x41')](_0x3cd364[_0xb687('0x3d')],_0x3cd364[_0xb687('0x3e')]);_0x318be6[_0xb687('0x42')]=_[_0xb687('0x41')](_0x3cd364[_0xb687('0x3d')],qs[_0xb687('0x52')](_0x4ab9c5[_0xb687('0x3e')][_0xb687('0x52')]));_0x318be6[_0xb687('0x42')]=_0x318be6['attributes']['length']?_0x318be6[_0xb687('0x42')]:_0x3cd364['model'];_0x318be6[_0xb687('0x45')]=qs[_0xb687('0x59')](_0x4ab9c5[_0xb687('0x3e')][_0xb687('0x59')]);_0x318be6[_0xb687('0x48')]=qs['filters'](_[_0xb687('0x46')](_0x4ab9c5['query'],_0x3cd364[_0xb687('0x40')]));if(_0x4ab9c5[_0xb687('0x3e')][_0xb687('0x47')]){_0x318be6[_0xb687('0x48')]=_[_0xb687('0x4a')](_0x318be6[_0xb687('0x48')],{'$or':_[_0xb687('0x39')](_0x318be6['attributes'],function(_0x28a6aa){var _0x31ed20={};_0x31ed20[_0x28a6aa]={'$like':'%'+_0x4ab9c5[_0xb687('0x3e')][_0xb687('0x47')]+'%'};return _0x31ed20;})});}_0x318be6=_[_0xb687('0x4a')]({},_0x318be6,_0x4ab9c5['options']);return _0x50c7e0[_0xb687('0x56')](_0x318be6);}})[_0xb687('0x1f')](function(_0x1eb23c){if(_0x1eb23c){_0x25e140=_0x1eb23c[_0xb687('0x53')];if(!_0x4ab9c5[_0xb687('0x3e')][_0xb687('0x43')](_0xb687('0x44'))){_0x318be6[_0xb687('0x2f')]=qs[_0xb687('0x2f')](_0x4ab9c5[_0xb687('0x3e')][_0xb687('0x2f')]);_0x318be6['offset']=qs[_0xb687('0x2e')](_0x4ab9c5[_0xb687('0x3e')][_0xb687('0x2e')]);}return _0x50c7e0[_0xb687('0x56')](_0x318be6);}})['then'](function(_0x302751){if(_0x302751){return _0x302751?{'count':_0x25e140,'rows':_0x302751}:null;}})[_0xb687('0x1f')](respondWithResult(_0x5ea8fd,null))['catch'](handleError(_0x5ea8fd,null));};exports[_0xb687('0x5a')]=function(_0x1acfed,_0x24d3d1,_0x5eeb75){if(_0x1acfed[_0xb687('0x55')]['id']){delete _0x1acfed[_0xb687('0x55')]['id'];}return db['Dynamics365Account'][_0xb687('0x57')]({'where':{'id':_0x1acfed[_0xb687('0x51')]['id']}})[_0xb687('0x1f')](handleEntityNotFound(_0x24d3d1,null))[_0xb687('0x1f')](function(_0x554081){if(_0x554081){_0x1acfed[_0xb687('0x55')][_0xb687('0x5b')]=_0x554081['id'];_0x1acfed['body'][_0xb687('0x5c')]=integrations[_0xb687('0x5d')](_0x1acfed['body']['channel'],_0x1acfed[_0xb687('0x55')]['type']);_0x1acfed[_0xb687('0x55')][_0xb687('0x5e')]=integrations[_0xb687('0x5f')](_0x1acfed[_0xb687('0x55')][_0xb687('0x60')],_0x1acfed[_0xb687('0x55')][_0xb687('0x3c')]);return db[_0xb687('0x58')]['create'](_0x1acfed[_0xb687('0x55')],{'include':[{'model':db[_0xb687('0x61')],'as':_0xb687('0x5c')},{'model':db[_0xb687('0x61')],'as':_0xb687('0x5e')}]});}return null;})[_0xb687('0x1f')](respondWithResult(_0x24d3d1,null))['catch'](handleError(_0x24d3d1,null));};exports[_0xb687('0x62')]=function(_0x1906ee,_0x5a4b86,_0x26a9b6){var _0x144db6=_0x1906ee[_0xb687('0x3e')][_0xb687('0x63')];var _0x5333e3=_0x144db6===_0xb687('0x64')?'Incident':'PhoneCall';var _0x10f2a7='';var _0x54c739='';var _0x53f100='';var _0x3fb45a='';var _0x5d127a='';var _0x137631='';var _0x1ea8d3='';var _0x58fcb7='';var _0x1dfb43=[_0xb687('0x65'),'description',_0xb687('0x66'),_0xb687('0x67'),_0xb687('0x68'),_0xb687('0x69'),_0xb687('0x6a'),_0xb687('0x6b'),_0xb687('0x6c'),_0xb687('0x6d')];var _0xab8e7d=[_0xb687('0x6e'),_0xb687('0x6f'),'actualserviceunits',_0xb687('0x70'),'contactidname','contactidyominame',_0xb687('0x71'),_0xb687('0x72'),_0xb687('0x73'),_0xb687('0x74'),_0xb687('0x75'),'createdbyyominame','createdon',_0xb687('0x76'),_0xb687('0x77'),_0xb687('0x78'),_0xb687('0x79'),'customeridyominame',_0xb687('0x7a'),_0xb687('0x7b'),_0xb687('0x7c'),_0xb687('0x7d'),_0xb687('0x7e'),_0xb687('0x7f'),_0xb687('0x80'),_0xb687('0x81'),_0xb687('0x82'),'influencescore',_0xb687('0x83'),_0xb687('0x84'),_0xb687('0x85'),_0xb687('0x86'),_0xb687('0x87'),'modifiedbyname',_0xb687('0x88'),_0xb687('0x89'),'modifiedonbehalfbyname',_0xb687('0x8a'),'msdyn_incidenttypename',_0xb687('0x8b'),_0xb687('0x8c'),'onholdtime',_0xb687('0x8d'),_0xb687('0x8e'),'owneridtype',_0xb687('0x8f'),_0xb687('0x90'),_0xb687('0x91'),_0xb687('0x92'),_0xb687('0x93'),_0xb687('0x94'),'productserialnumber',_0xb687('0x95'),_0xb687('0x96'),_0xb687('0x97'),_0xb687('0x98'),_0xb687('0x99'),_0xb687('0x9a'),_0xb687('0x9b'),_0xb687('0x9c'),_0xb687('0x9d'),_0xb687('0x9e'),_0xb687('0x9f'),'subjectidname',_0xb687('0xa0'),'timezoneruleversionnumber',_0xb687('0xa1'),_0xb687('0xa2'),'utcconversiontimezonecode','versionnumber'];var _0x35811f=_0x1dfb43[_0xb687('0xa3')](_0xab8e7d);return db[_0xb687('0x4c')][_0xb687('0x57')]({'where':{'id':_0x1906ee[_0xb687('0x51')]['id']},'attributes':['id',_0xb687('0xa4'),_0xb687('0xa5'),_0xb687('0xa6'),_0xb687('0xa7'),_0xb687('0xa8'),_0xb687('0xa9')]})[_0xb687('0x1f')](handleEntityNotFound(_0x5a4b86,null))[_0xb687('0x1f')](function(_0x1ea6fd){if(_0x1ea6fd){_0x58fcb7=_0x1ea6fd[_0xb687('0xa6')];var _0x3f45b7=_0x58fcb7['slice'](-0x1);if(_0x3f45b7==='/'){_0x58fcb7=_0x58fcb7['substring'](0x0,_0x58fcb7[_0xb687('0xaa')](_0x3f45b7));}_0x1ea8d3=util['format']('%s/api/data/v9.0/',_0x58fcb7);var _0x3b8514={'method':_0xb687('0xab'),'uri':'https://login.microsoftonline.com/'+_0x1ea6fd[_0xb687('0xa7')]+_0xb687('0xac'),'form':{'client_id':_0x1ea6fd['clientId'],'resource':_0x58fcb7,'username':_0x1ea6fd[_0xb687('0xa4')],'password':_0x1ea6fd[_0xb687('0xa5')],'grant_type':_0xb687('0xa5'),'client_secret':_0x1ea6fd[_0xb687('0xa9')]},'json':!![]};return rp(_0x3b8514);}})[_0xb687('0x1f')](function(_0xecd124){_0x137631=_0xecd124[_0xb687('0xad')];var _0x4501f5={'method':_0xb687('0xae'),'uri':encodeURI(_0x1ea8d3+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x5333e3+'\x27'),'headers':{'Authorization':_0xb687('0xaf')+_0x137631,'If-None-Match':null,'OData-Version':_0xb687('0xb0')},'json':!![]};return rp(_0x4501f5);})['then'](function(_0x11cf86){var _0x553038=_0x11cf86[_0xb687('0xb1')][0x0];var _0x3eedb2=_0x553038['MetadataId'];var _0x2aff54={'method':_0xb687('0xae'),'uri':_0x1ea8d3+_0xb687('0xb2')+_0x3eedb2+_0xb687('0xb3'),'headers':{'Authorization':_0xb687('0xaf')+_0x137631,'If-None-Match':null,'OData-Version':_0xb687('0xb0')},'json':!![]};return rp(_0x2aff54);})[_0xb687('0x1f')](function(_0x580bb5){_0x10f2a7=_0x580bb5;_0x54c739=_0x10f2a7['Attributes'];_0x54c739=_[_0xb687('0xb4')](_0x54c739,function(_0x4a75f9){return!_0x35811f[_0xb687('0xb5')](_0x4a75f9[_0xb687('0xb6')]);});var _0x232aa8=[];var _0x312529=[];_0x54c739['forEach'](function(_0x3cd107){if(_0x3cd107[_0xb687('0xb7')]){var _0x5854d4=_0x3cd107[_0xb687('0xb7')][_0xb687('0xb8')](_0x3cd107[_0xb687('0xb7')][_0xb687('0xaa')]('.')+0x1);if(_0x5854d4===_0xb687('0xb9')){_0x232aa8[_0xb687('0xba')](getSelectList(_0x1ea8d3,_0x144db6,_0x312529,_0x10f2a7['MetadataId'],_0x3cd107[_0xb687('0xbb')],_0x137631));}}});return Promise[_0xb687('0xbc')](_0x232aa8);})[_0xb687('0x1f')](function(_0x1a8913){_0x53f100=_0x1a8913[0x0];var _0x1482d4=[];var _0x27a2cd=[];_0x54c739[_0xb687('0xbd')](function(_0x25c969){if(!_[_0xb687('0xbe')](_0x25c969[_0xb687('0xb7')])){var _0x4ff77d=_0x25c969['@odata.type'][_0xb687('0xb8')](_0x25c969[_0xb687('0xb7')][_0xb687('0xaa')]('.')+0x1);if(_0x4ff77d===_0xb687('0xbf')){_0x1482d4[_0xb687('0xba')](getBooleanList(_0x1ea8d3,_0x144db6,_0x27a2cd,_0x10f2a7[_0xb687('0xbb')],_0x25c969[_0xb687('0xbb')],_0x137631));}}});return Promise[_0xb687('0xbc')](_0x1482d4);})[_0xb687('0x1f')](function(_0x4eb75e){_0x3fb45a=_0x4eb75e[0x0];var _0x5bd572=[];var _0x5ca5cc=[];_0x54c739[_0xb687('0xbd')](function(_0x360fce){if(_0x360fce[_0xb687('0xb7')]){var _0x44152f=_0x360fce[_0xb687('0xb7')][_0xb687('0xb8')](_0x360fce[_0xb687('0xb7')][_0xb687('0xaa')]('.')+0x1);if(_0x44152f==='StringAttributeMetadata'||_0x44152f===_0xb687('0xc0')||_0x44152f===_0xb687('0xc1')||_0x44152f===_0xb687('0xc2')||_0x44152f===_0xb687('0xc3')||_0x44152f===_0xb687('0xc4')||_0x44152f===_0xb687('0xc5')||_0x44152f===_0xb687('0xc6')||_0x44152f===_0xb687('0xc7')||_0x44152f==='DecimalAttributeMetadata'){_0x5bd572[_0xb687('0xba')](getInputList(_0x1ea8d3,_0x144db6,_0x44152f,_0x5ca5cc,_0x10f2a7['MetadataId'],_0x360fce[_0xb687('0xbb')],_0x137631));}}});return Promise[_0xb687('0xbc')](_0x5bd572);})['then'](function(_0x7871aa){_0x5d127a=_0x7871aa[0x0];var _0x20cc8f=_0x53f100[_0xb687('0xa3')](_0x3fb45a)['concat'](_0x5d127a);var _0x3763ce={'count':_0x20cc8f[_0xb687('0x53')],'rows':_0x20cc8f};return _0x3763ce;})[_0xb687('0x1f')](respondWithResult(_0x5a4b86,null))[_0xb687('0x28')](function(_0x3d4596){var _0x1e37ce=_0x1906ee[_0xb687('0x3e')]['test']?0x1f4:_0x3d4596[_0xb687('0xc8')]||0x1f4;logger[_0xb687('0x25')](_0x3d4596[_0xb687('0x36')]);delete _0x3d4596[_0xb687('0x37')];if(_0x1e37ce===0x191){_0x1e37ce=0x190;}_0x5a4b86[_0xb687('0x2b')](_0x1e37ce)['send'](_0x1906ee[_0xb687('0x3e')][_0xb687('0xc9')]?{'message':_0xb687('0xca'),'statusCode':_0x3d4596['statusCode']}:_0x3d4596);});};function getSelectList(_0x1d18c1,_0x4aec2e,_0x41ff78,_0x143374,_0x50a060,_0x3dbbd6){var _0x25ff49={'method':_0xb687('0xae'),'uri':_0x1d18c1+'EntityDefinitions('+_0x143374+_0xb687('0xcb')+_0x50a060+_0xb687('0xcc')+_0xb687('0xcd'),'headers':{'Authorization':_0xb687('0xaf')+_0x3dbbd6,'If-None-Match':null,'OData-Version':_0xb687('0xb0')},'json':!![]};return rp(_0x25ff49)[_0xb687('0x1f')](function(_0x15e599){var _0x32e116=[];var _0x8f6ba0=_0x15e599['OptionSet'][_0xb687('0xce')];_0x8f6ba0[_0xb687('0xbd')](function(_0x12e7b4){_0x32e116['push']({'name':_0x12e7b4['Label'][_0xb687('0xcf')]['Label'],'value':String(_0x12e7b4[_0xb687('0xd0')])});});var _0x1d21ef={'id':_0x4aec2e+'_'+_0x15e599[_0xb687('0xb6')],'name':_0x15e599['DisplayName']['UserLocalizedLabel'][_0xb687('0xd1')],'custom':![],'options':_0x32e116};_0x41ff78[_0xb687('0xba')](_0x1d21ef);return _0x41ff78;});}function getBooleanList(_0x2b432d,_0x295795,_0xa71320,_0x5484cb,_0x25f3e5,_0x6abfcf){var _0x522304={'method':_0xb687('0xae'),'uri':_0x2b432d+_0xb687('0xb2')+_0x5484cb+')/Attributes('+_0x25f3e5+_0xb687('0xd2'),'headers':{'Authorization':_0xb687('0xaf')+_0x6abfcf,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x522304)[_0xb687('0x1f')](function(_0xa29cc){var _0x2cf972=[];_0x2cf972[_0xb687('0xba')]({'name':_0xa29cc[_0xb687('0xd3')][_0xb687('0xd4')][_0xb687('0xd1')]['UserLocalizedLabel'][_0xb687('0xd1')],'value':'true'},{'name':_0xa29cc[_0xb687('0xd3')][_0xb687('0xd5')][_0xb687('0xd1')][_0xb687('0xcf')]['Label'],'value':_0xb687('0xd6')});var _0x55a919={'id':_0x295795+'_'+_0xa29cc['LogicalName'],'name':_0xa29cc[_0xb687('0xd7')][_0xb687('0xcf')][_0xb687('0xd1')],'custom':![],'options':_0x2cf972};_0xa71320['push'](_0x55a919);return _0xa71320;});}function getInputList(_0x258497,_0x219b35,_0x514e7a,_0x36ff82,_0x4d6054,_0x22ec65,_0x389d22){var _0x4c965a={'method':_0xb687('0xae'),'uri':_0x258497+'EntityDefinitions('+_0x4d6054+_0xb687('0xcb')+_0x22ec65+')/Microsoft.Dynamics.CRM.'+_0x514e7a+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xb687('0xaf')+_0x389d22,'If-None-Match':null,'OData-Version':_0xb687('0xb0')},'json':!![]};return rp(_0x4c965a)['then'](function(_0x29965e){var _0x4f2ee9={'id':_0x219b35+'_'+_0x29965e[_0xb687('0xb6')],'name':_0x29965e[_0xb687('0xd7')][_0xb687('0xcf')]?_0x29965e['DisplayName'][_0xb687('0xcf')][_0xb687('0xd1')]:_0x29965e[_0xb687('0xb6')],'custom':![],'options':[]};_0x36ff82[_0xb687('0xba')](_0x4f2ee9);return _0x36ff82;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index a9060de..2b175e4 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 _0x9c00=['exports','Dynamics365Account','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x4c2c33,_0xef5944){var _0x4c3bff=function(_0x1e3887){while(--_0x1e3887){_0x4c2c33['push'](_0x4c2c33['shift']());}};_0x4c3bff(++_0xef5944);}(_0x9c00,0x188));var _0x09c0=function(_0x44ea1b,_0x36bbd3){_0x44ea1b=_0x44ea1b-0x0;var _0x239690=_0x9c00[_0x44ea1b];return _0x239690;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var logger=require(_0x09c0('0x2'))(_0x09c0('0x3'));var moment=require(_0x09c0('0x4'));var BPromise=require(_0x09c0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09c0('0x6'));var rimraf=require(_0x09c0('0x7'));var config=require(_0x09c0('0x8'));var attributes=require(_0x09c0('0x9'));var integrations=require(_0x09c0('0xa'));module[_0x09c0('0xb')]=function(_0x52dc81,_0x32fe51){return _0x52dc81['define'](_0x09c0('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf95a=['Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x1ce57d,_0x5a783e){var _0xc8f28f=function(_0x3b5c08){while(--_0x3b5c08){_0x1ce57d['push'](_0x1ce57d['shift']());}};_0xc8f28f(++_0x5a783e);}(_0xf95a,0xd2));var _0xaf95=function(_0x151740,_0xda714){_0x151740=_0x151740-0x0;var _0x4bd5e5=_0xf95a[_0x151740];return _0x4bd5e5;};'use strict';var _=require(_0xaf95('0x0'));var util=require(_0xaf95('0x1'));var logger=require(_0xaf95('0x2'))(_0xaf95('0x3'));var moment=require(_0xaf95('0x4'));var BPromise=require(_0xaf95('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaf95('0x6'));var config=require(_0xaf95('0x7'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xaf95('0x8'));module[_0xaf95('0x9')]=function(_0xb5a947,_0x38d5cc){return _0xb5a947[_0xaf95('0xa')](_0xaf95('0xb'),attributes,{'tableName':_0xaf95('0xc'),'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 9b17307..1fdc66b 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 _0x62f1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','GetDynamics365Account','findAll','options','raw','where','attributes','include','map','model','Dynamics365Account','find','ShowDynamics365Account','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x28636e,_0x226895){var _0x385a9b=function(_0x247868){while(--_0x247868){_0x28636e['push'](_0x28636e['shift']());}};_0x385a9b(++_0x226895);}(_0x62f1,0x112));var _0x162f=function(_0x1c0e91,_0xd8625e){_0x1c0e91=_0x1c0e91-0x0;var _0x34322c=_0x62f1[_0x1c0e91];return _0x34322c;};'use strict';var _=require(_0x162f('0x0'));var util=require('util');var moment=require(_0x162f('0x1'));var BPromise=require(_0x162f('0x2'));var rs=require(_0x162f('0x3'));var fs=require('fs');var Redis=require(_0x162f('0x4'));var db=require(_0x162f('0x5'))['db'];var utils=require(_0x162f('0x6'));var logger=require(_0x162f('0x7'))(_0x162f('0x8'));var config=require(_0x162f('0x9'));var jayson=require(_0x162f('0xa'));var client=jayson['client'][_0x162f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e763a,_0x593029,_0x2b0c29){return new BPromise(function(_0xbeb77d,_0xcb0ac4){return client['request'](_0x2e763a,_0x2b0c29)[_0x162f('0xc')](function(_0x3d795c){logger[_0x162f('0xd')](_0x162f('0xe'),_0x593029,'request\x20sent');logger[_0x162f('0xf')](_0x162f('0x10'),_0x593029,_0x162f('0x11'),JSON['stringify'](_0x3d795c));if(_0x3d795c['error']){if(_0x3d795c['error'][_0x162f('0x12')]===0x1f4){logger['error'](_0x162f('0xe'),_0x593029,_0x3d795c[_0x162f('0x13')][_0x162f('0x14')]);return _0xcb0ac4(_0x3d795c[_0x162f('0x13')]['message']);}logger[_0x162f('0x13')](_0x162f('0xe'),_0x593029,_0x3d795c[_0x162f('0x13')][_0x162f('0x14')]);return _0xbeb77d(_0x3d795c['error'][_0x162f('0x14')]);}else{logger['info'](_0x162f('0xe'),_0x593029,_0x162f('0x11'));_0xbeb77d(_0x3d795c[_0x162f('0x15')][_0x162f('0x14')]);}})['catch'](function(_0x59e11d){logger[_0x162f('0x13')](_0x162f('0xe'),_0x593029,_0x59e11d);_0xcb0ac4(_0x59e11d);});});}exports[_0x162f('0x16')]=function(_0x1ee433){var _0x45f7ef=this;return new Promise(function(_0x750506,_0x507641){return db['Dynamics365Account'][_0x162f('0x17')]({'raw':_0x1ee433['options']?_0x1ee433[_0x162f('0x18')][_0x162f('0x19')]===undefined?!![]:![]:!![],'where':_0x1ee433['options']?_0x1ee433[_0x162f('0x18')][_0x162f('0x1a')]||null:null,'attributes':_0x1ee433['options']?_0x1ee433[_0x162f('0x18')][_0x162f('0x1b')]||null:null,'limit':_0x1ee433[_0x162f('0x18')]?_0x1ee433[_0x162f('0x18')]['limit']||null:null,'include':_0x1ee433[_0x162f('0x18')]?_0x1ee433[_0x162f('0x18')][_0x162f('0x1c')]?_[_0x162f('0x1d')](_0x1ee433[_0x162f('0x18')][_0x162f('0x1c')],function(_0xbcbe11){return{'model':db[_0xbcbe11[_0x162f('0x1e')]],'as':_0xbcbe11['as'],'attributes':_0xbcbe11['attributes'],'include':_0xbcbe11[_0x162f('0x1c')]?_[_0x162f('0x1d')](_0xbcbe11[_0x162f('0x1c')],function(_0x16f5e2){return{'model':db[_0x16f5e2['model']],'as':_0x16f5e2['as'],'attributes':_0x16f5e2[_0x162f('0x1b')],'include':_0x16f5e2['include']?_[_0x162f('0x1d')](_0x16f5e2['include'],function(_0x2cd181){return{'model':db[_0x2cd181['model']],'as':_0x2cd181['as'],'attributes':_0x2cd181[_0x162f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e710d){logger[_0x162f('0xd')](_0x162f('0x16'),_0x1ee433);logger['debug']('GetDynamics365Account',_0x1ee433,JSON['stringify'](_0x3e710d));_0x750506(_0x3e710d);})['catch'](function(_0x3f9247){logger[_0x162f('0x13')]('GetDynamics365Account',_0x3f9247['message'],_0x1ee433);_0x507641(_0x45f7ef['error'](0x1f4,_0x3f9247[_0x162f('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x43bb9a){var _0x1f1c3b=this;return new Promise(function(_0x55b224,_0x51e616){return db[_0x162f('0x1f')][_0x162f('0x20')]({'raw':_0x43bb9a[_0x162f('0x18')]?_0x43bb9a['options'][_0x162f('0x19')]===undefined?!![]:![]:!![],'where':_0x43bb9a[_0x162f('0x18')]?_0x43bb9a[_0x162f('0x18')][_0x162f('0x1a')]||null:null,'attributes':_0x43bb9a['options']?_0x43bb9a['options'][_0x162f('0x1b')]||null:null,'include':_0x43bb9a['options']?_0x43bb9a[_0x162f('0x18')]['include']?_['map'](_0x43bb9a['options']['include'],function(_0x3853af){return{'model':db[_0x3853af[_0x162f('0x1e')]],'as':_0x3853af['as'],'attributes':_0x3853af[_0x162f('0x1b')],'include':_0x3853af['include']?_[_0x162f('0x1d')](_0x3853af[_0x162f('0x1c')],function(_0x4e482e){return{'model':db[_0x4e482e[_0x162f('0x1e')]],'as':_0x4e482e['as'],'attributes':_0x4e482e[_0x162f('0x1b')],'include':_0x4e482e[_0x162f('0x1c')]?_['map'](_0x4e482e[_0x162f('0x1c')],function(_0x5941bf){return{'model':db[_0x5941bf[_0x162f('0x1e')]],'as':_0x5941bf['as'],'attributes':_0x5941bf['attributes']};}):[]};}):[]};}):[]:[]})[_0x162f('0xc')](function(_0x510ea7){logger[_0x162f('0xd')](_0x162f('0x21'),_0x43bb9a);logger['debug'](_0x162f('0x21'),_0x43bb9a,JSON['stringify'](_0x510ea7));_0x55b224(_0x510ea7);})[_0x162f('0x22')](function(_0x32909c){logger['error'](_0x162f('0x21'),_0x32909c['message'],_0x43bb9a);_0x51e616(_0x1f1c3b[_0x162f('0x13')](0x1f4,_0x32909c['message']));});});}; \ No newline at end of file +var _0x82f8=['jayson/promise','request','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','GetDynamics365Account','options','raw','where','attributes','limit','include','model','map','then','debug','ShowDynamics365Account','Dynamics365Account','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x82f8,0x157));var _0x882f=function(_0x28b6e9,_0x303538){_0x28b6e9=_0x28b6e9-0x0;var _0x2c27a5=_0x82f8[_0x28b6e9];return _0x2c27a5;};'use strict';var _=require('lodash');var util=require(_0x882f('0x0'));var moment=require(_0x882f('0x1'));var BPromise=require('bluebird');var rs=require(_0x882f('0x2'));var fs=require('fs');var Redis=require(_0x882f('0x3'));var db=require(_0x882f('0x4'))['db'];var utils=require(_0x882f('0x5'));var logger=require(_0x882f('0x6'))(_0x882f('0x7'));var config=require(_0x882f('0x8'));var jayson=require(_0x882f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c414d,_0x2c7ade,_0x3efa94){return new BPromise(function(_0x2e6f92,_0x4f9dd6){return client[_0x882f('0xa')](_0x3c414d,_0x3efa94)['then'](function(_0x29c3e8){logger['info'](_0x882f('0xb'),_0x2c7ade,'request\x20sent');logger['debug'](_0x882f('0xc'),_0x2c7ade,_0x882f('0xd'),JSON[_0x882f('0xe')](_0x29c3e8));if(_0x29c3e8[_0x882f('0xf')]){if(_0x29c3e8[_0x882f('0xf')]['code']===0x1f4){logger['error'](_0x882f('0xb'),_0x2c7ade,_0x29c3e8[_0x882f('0xf')][_0x882f('0x10')]);return _0x4f9dd6(_0x29c3e8[_0x882f('0xf')][_0x882f('0x10')]);}logger[_0x882f('0xf')](_0x882f('0xb'),_0x2c7ade,_0x29c3e8['error'][_0x882f('0x10')]);return _0x2e6f92(_0x29c3e8[_0x882f('0xf')][_0x882f('0x10')]);}else{logger[_0x882f('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x2c7ade,'request\x20sent');_0x2e6f92(_0x29c3e8['result'][_0x882f('0x10')]);}})[_0x882f('0x12')](function(_0x3357ef){logger[_0x882f('0xf')](_0x882f('0xb'),_0x2c7ade,_0x3357ef);_0x4f9dd6(_0x3357ef);});});}exports[_0x882f('0x13')]=function(_0x3bd47c){var _0x67cc4b=this;return new Promise(function(_0x544fd5,_0x3e4847){return db['Dynamics365Account']['findAll']({'raw':_0x3bd47c[_0x882f('0x14')]?_0x3bd47c[_0x882f('0x14')][_0x882f('0x15')]===undefined?!![]:![]:!![],'where':_0x3bd47c[_0x882f('0x14')]?_0x3bd47c['options'][_0x882f('0x16')]||null:null,'attributes':_0x3bd47c[_0x882f('0x14')]?_0x3bd47c[_0x882f('0x14')][_0x882f('0x17')]||null:null,'limit':_0x3bd47c[_0x882f('0x14')]?_0x3bd47c[_0x882f('0x14')][_0x882f('0x18')]||null:null,'include':_0x3bd47c[_0x882f('0x14')]?_0x3bd47c[_0x882f('0x14')]['include']?_['map'](_0x3bd47c['options'][_0x882f('0x19')],function(_0x2c44e5){return{'model':db[_0x2c44e5[_0x882f('0x1a')]],'as':_0x2c44e5['as'],'attributes':_0x2c44e5[_0x882f('0x17')],'include':_0x2c44e5[_0x882f('0x19')]?_[_0x882f('0x1b')](_0x2c44e5[_0x882f('0x19')],function(_0x2d6f58){return{'model':db[_0x2d6f58[_0x882f('0x1a')]],'as':_0x2d6f58['as'],'attributes':_0x2d6f58['attributes'],'include':_0x2d6f58[_0x882f('0x19')]?_[_0x882f('0x1b')](_0x2d6f58['include'],function(_0x48c52b){return{'model':db[_0x48c52b[_0x882f('0x1a')]],'as':_0x48c52b['as'],'attributes':_0x48c52b[_0x882f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x882f('0x1c')](function(_0x4cf987){logger[_0x882f('0x11')](_0x882f('0x13'),_0x3bd47c);logger[_0x882f('0x1d')](_0x882f('0x13'),_0x3bd47c,JSON['stringify'](_0x4cf987));_0x544fd5(_0x4cf987);})[_0x882f('0x12')](function(_0x31d0b7){logger[_0x882f('0xf')](_0x882f('0x13'),_0x31d0b7[_0x882f('0x10')],_0x3bd47c);_0x3e4847(_0x67cc4b[_0x882f('0xf')](0x1f4,_0x31d0b7[_0x882f('0x10')]));});});};exports[_0x882f('0x1e')]=function(_0x299f62){var _0x46cb78=this;return new Promise(function(_0x97706f,_0x292532){return db[_0x882f('0x1f')]['find']({'raw':_0x299f62[_0x882f('0x14')]?_0x299f62['options'][_0x882f('0x15')]===undefined?!![]:![]:!![],'where':_0x299f62['options']?_0x299f62['options'][_0x882f('0x16')]||null:null,'attributes':_0x299f62[_0x882f('0x14')]?_0x299f62['options'][_0x882f('0x17')]||null:null,'include':_0x299f62[_0x882f('0x14')]?_0x299f62[_0x882f('0x14')][_0x882f('0x19')]?_[_0x882f('0x1b')](_0x299f62[_0x882f('0x14')]['include'],function(_0x5c3a99){return{'model':db[_0x5c3a99['model']],'as':_0x5c3a99['as'],'attributes':_0x5c3a99[_0x882f('0x17')],'include':_0x5c3a99['include']?_[_0x882f('0x1b')](_0x5c3a99[_0x882f('0x19')],function(_0x496804){return{'model':db[_0x496804['model']],'as':_0x496804['as'],'attributes':_0x496804[_0x882f('0x17')],'include':_0x496804[_0x882f('0x19')]?_['map'](_0x496804[_0x882f('0x19')],function(_0xb16c9b){return{'model':db[_0xb16c9b[_0x882f('0x1a')]],'as':_0xb16c9b['as'],'attributes':_0xb16c9b[_0x882f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x882f('0x1c')](function(_0x4d343d){logger[_0x882f('0x11')](_0x882f('0x1e'),_0x299f62);logger[_0x882f('0x1d')](_0x882f('0x1e'),_0x299f62,JSON[_0x882f('0xe')](_0x4d343d));_0x97706f(_0x4d343d);})[_0x882f('0x12')](function(_0x1a6210){logger[_0x882f('0xf')]('ShowDynamics365Account',_0x1a6210[_0x882f('0x10')],_0x299f62);_0x292532(_0x46cb78[_0x882f('0xf')](0x1f4,_0x1a6210[_0x882f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 160ce62..1cb9e68 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 _0xbfb6=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','path'];(function(_0x909bde,_0x12e64b){var _0x4ec6f5=function(_0x49e63e){while(--_0x49e63e){_0x909bde['push'](_0x909bde['shift']());}};_0x4ec6f5(++_0x12e64b);}(_0xbfb6,0x107));var _0x6bfb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbfb6[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6bfb('0x0'));var timeout=require(_0x6bfb('0x1'));var express=require(_0x6bfb('0x2'));var router=express[_0x6bfb('0x3')]();var auth=require(_0x6bfb('0x4'));var interaction=require(_0x6bfb('0x5'));var config=require(_0x6bfb('0x6'));var controller=require(_0x6bfb('0x7'));router[_0x6bfb('0x8')]('/',auth[_0x6bfb('0x9')](),controller[_0x6bfb('0xa')]);router['get'](_0x6bfb('0xb'),auth[_0x6bfb('0x9')](),controller[_0x6bfb('0xc')]);router[_0x6bfb('0x8')](_0x6bfb('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x6bfb('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x6bfb('0xe')]);router['get'](_0x6bfb('0xf'),auth['isAuthenticated'](),controller[_0x6bfb('0x10')]);router[_0x6bfb('0x11')]('/',auth[_0x6bfb('0x9')](),controller['create']);router[_0x6bfb('0x12')](_0x6bfb('0xb'),auth[_0x6bfb('0x9')](),controller[_0x6bfb('0x13')]);router['delete'](_0x6bfb('0xb'),auth['isAuthenticated'](),controller[_0x6bfb('0x14')]);module[_0x6bfb('0x15')]=router; \ No newline at end of file +var _0x9ffb=['./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x9ffb,0x19d));var _0xb9ff=function(_0x164e68,_0x48f6db){_0x164e68=_0x164e68-0x0;var _0x4897df=_0x9ffb[_0x164e68];return _0x4897df;};'use strict';var multer=require(_0xb9ff('0x0'));var util=require(_0xb9ff('0x1'));var path=require('path');var timeout=require(_0xb9ff('0x2'));var express=require('express');var router=express[_0xb9ff('0x3')]();var auth=require(_0xb9ff('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb9ff('0x5'));router[_0xb9ff('0x6')]('/',auth[_0xb9ff('0x7')](),controller[_0xb9ff('0x8')]);router[_0xb9ff('0x6')]('/:id',auth[_0xb9ff('0x7')](),controller[_0xb9ff('0x9')]);router[_0xb9ff('0x6')](_0xb9ff('0xa'),auth[_0xb9ff('0x7')](),controller[_0xb9ff('0xb')]);router[_0xb9ff('0x6')](_0xb9ff('0xc'),auth[_0xb9ff('0x7')](),controller['getSubjects']);router[_0xb9ff('0x6')](_0xb9ff('0xd'),auth[_0xb9ff('0x7')](),controller[_0xb9ff('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb9ff('0xf')]);router[_0xb9ff('0x10')](_0xb9ff('0x11'),auth[_0xb9ff('0x7')](),controller[_0xb9ff('0x12')]);router[_0xb9ff('0x13')]('/:id',auth[_0xb9ff('0x7')](),controller[_0xb9ff('0x14')]);module[_0xb9ff('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 0609958..5ad55af 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 _0x8307=['ENUM','STRING'];(function(_0x493030,_0x29ec7e){var _0x56f5e4=function(_0xb929a1){while(--_0xb929a1){_0x493030['push'](_0x493030['shift']());}};_0x56f5e4(++_0x29ec7e);}(_0x8307,0x18b));var _0x7830=function(_0x54417c,_0x155f01){_0x54417c=_0x54417c-0x0;var _0x1462c0=_0x8307[_0x54417c];return _0x1462c0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7830('0x0')]},'description':{'type':Sequelize[_0x7830('0x0')]},'ticketType':{'type':Sequelize[_0x7830('0x1')]('incident','phonecall'),'defaultValue':'incident'}}; \ No newline at end of file +var _0x03f0=['ENUM','incident','phonecall','sequelize','exports','STRING'];(function(_0x56f5d7,_0x2cbe10){var _0xb008d4=function(_0x308fd8){while(--_0x308fd8){_0x56f5d7['push'](_0x56f5d7['shift']());}};_0xb008d4(++_0x2cbe10);}(_0x03f0,0x11d));var _0x003f=function(_0x3d0db9,_0x342040){_0x3d0db9=_0x3d0db9-0x0;var _0x47023a=_0x03f0[_0x3d0db9];return _0x47023a;};'use strict';var Sequelize=require(_0x003f('0x0'));module[_0x003f('0x1')]={'name':{'type':Sequelize[_0x003f('0x2')]},'description':{'type':Sequelize[_0x003f('0x2')]},'ticketType':{'type':Sequelize[_0x003f('0x3')](_0x003f('0x4'),_0x003f('0x5')),'defaultValue':_0x003f('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index f085d17..b6f036c 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 _0x15e1=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','client','request','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','key','map','keys','query','model','attributes','intersection','fields','nolimit','order','sort','filters','filter','where','type','VIRTUAL','merge','options','findAll','show','params','includeAll','find','create','body','getFields','findOne','Dynamics365Field','length','hasOwnProperty','getSubjects','pick','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xb52a30,_0x9b4336){var _0x160875=function(_0xd23d7a){while(--_0xd23d7a){_0xb52a30['push'](_0xb52a30['shift']());}};_0x160875(++_0x9b4336);}(_0x15e1,0x10f));var _0x115e=function(_0x1f6e37,_0x560390){_0x1f6e37=_0x1f6e37-0x0;var _0x3d17ad=_0x15e1[_0x1f6e37];return _0x3d17ad;};'use strict';var pdf=require(_0x115e('0x0'));var emlformat=require(_0x115e('0x1'));var rimraf=require(_0x115e('0x2'));var zipdir=require(_0x115e('0x3'));var jsonpatch=require(_0x115e('0x4'));var rp=require(_0x115e('0x5'));var moment=require(_0x115e('0x6'));var BPromise=require(_0x115e('0x7'));var Mustache=require(_0x115e('0x8'));var util=require(_0x115e('0x9'));var path=require(_0x115e('0xa'));var sox=require(_0x115e('0xb'));var csv=require(_0x115e('0xc'));var ejs=require(_0x115e('0xd'));var fs=require('fs');var _=require(_0x115e('0xe'));var squel=require(_0x115e('0xf'));var crypto=require(_0x115e('0x10'));var jsforce=require(_0x115e('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x115e('0x12'));var Papa=require(_0x115e('0x13'));var Redis=require('ioredis');var authService=require(_0x115e('0x14'));var qs=require(_0x115e('0x15'));var as=require(_0x115e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x115e('0x17'))(_0x115e('0x18'));var utils=require(_0x115e('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x115e('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x115e('0x1b'));var client=jayson[_0x115e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cb0d1,_0x49aa55,_0xb94b00,_0x27a2e4){return new BPromise(function(_0x253a17,_0xabe4b9){var _0x3b1917=_0x27a2e4||client;return _0x3b1917[_0x115e('0x1d')](_0x4cb0d1,_0xb94b00)['then'](function(_0x28ea06){logger[_0x115e('0x1e')]('Dynamics365Configuration,\x20%s,\x20%s',_0x49aa55,_0x115e('0x1f'));logger['debug'](_0x115e('0x20'),_0x49aa55,'request\x20sent',JSON['stringify'](_0x28ea06));if(_0x28ea06[_0x115e('0x21')]){if(_0x28ea06[_0x115e('0x21')]['code']===0x1f4){logger[_0x115e('0x21')](_0x115e('0x22'),_0x49aa55,_0x28ea06['error'][_0x115e('0x23')]);return _0xabe4b9(_0x28ea06['error'][_0x115e('0x23')]);}logger[_0x115e('0x21')](_0x115e('0x22'),_0x49aa55,_0x28ea06['error'][_0x115e('0x23')]);return _0x253a17(_0x28ea06[_0x115e('0x21')][_0x115e('0x23')]);}else{logger[_0x115e('0x1e')](_0x115e('0x22'),_0x49aa55,_0x115e('0x1f'));_0x253a17(_0x28ea06[_0x115e('0x24')][_0x115e('0x23')]);}})[_0x115e('0x25')](function(_0x9aad29){logger[_0x115e('0x21')](_0x115e('0x22'),_0x49aa55,_0x9aad29);_0xabe4b9(_0x9aad29);});});}function respondWithStatusCode(_0xa0e459,_0x999123){_0x999123=_0x999123||0xcc;return function(_0x1105de){if(_0x1105de){return _0xa0e459[_0x115e('0x26')](_0x999123);}return _0xa0e459['status'](_0x999123)[_0x115e('0x27')]();};}function respondWithResult(_0x14c471,_0x5820d5){_0x5820d5=_0x5820d5||0xc8;return function(_0x5a689f){if(_0x5a689f){return _0x14c471[_0x115e('0x28')](_0x5820d5)[_0x115e('0x29')](_0x5a689f);}};}function respondWithFilteredResult(_0x2815de,_0x1d55e9){return function(_0x57dc4f){if(_0x57dc4f){var _0xa0be9=_0x57dc4f[_0x115e('0x2a')],_0x5988e6=_0x1d55e9[_0x115e('0x2b')],_0xad999e=_0x1d55e9['offset']+_0x1d55e9[_0x115e('0x2c')],_0x413a52;if(_0xad999e>=_0xa0be9){_0xad999e=_0xa0be9;_0x413a52=0xc8;}else{_0x413a52=0xce;}_0x2815de['status'](_0x413a52);return _0x2815de[_0x115e('0x2d')](_0x115e('0x2e'),_0x5988e6+'-'+_0xad999e+'/'+_0xa0be9)[_0x115e('0x29')](_0x57dc4f);}return null;};}function patchUpdates(_0x2e8143){return function(_0x469c72){try{jsonpatch[_0x115e('0x2f')](_0x469c72,_0x2e8143,!![]);}catch(_0x25db54){return BPromise[_0x115e('0x30')](_0x25db54);}return _0x469c72[_0x115e('0x31')]();};}function saveUpdates(_0x50fac2,_0x3f3d9b){return function(_0x3c9261){if(_0x3c9261){return _0x3c9261[_0x115e('0x32')](_0x50fac2)[_0x115e('0x33')](function(_0x30269e){return _0x30269e;});}return null;};}function removeEntity(_0x110187,_0x16c649){return function(_0x455fe2){if(_0x455fe2){return _0x455fe2[_0x115e('0x34')]()['then'](function(){_0x110187[_0x115e('0x28')](0xcc)[_0x115e('0x27')]();});}};}function handleEntityNotFound(_0x2c83db,_0x445912){return function(_0x4c8ef6){if(!_0x4c8ef6){_0x2c83db[_0x115e('0x26')](0x194);}return _0x4c8ef6;};}function handleError(_0x1e4366,_0x4c8867){_0x4c8867=_0x4c8867||0x1f4;return function(_0x259004){logger[_0x115e('0x21')](_0x259004[_0x115e('0x35')]);if(_0x259004['name']){delete _0x259004[_0x115e('0x36')];}_0x1e4366['status'](_0x4c8867)[_0x115e('0x37')](_0x259004);};}exports[_0x115e('0x38')]=function(_0x331294,_0x278434){var _0x49a4e7={},_0x3cf110={},_0x225042={'count':0x0,'rows':[]};var _0xa16a9a=_['map'](db[_0x115e('0x39')][_0x115e('0x3a')],function(_0x5b3841){return{'name':_0x5b3841[_0x115e('0x3b')],'type':_0x5b3841['type'][_0x115e('0x3c')]};});_0x3cf110['model']=_[_0x115e('0x3d')](_0xa16a9a,_0x115e('0x36'));_0x3cf110['query']=_[_0x115e('0x3e')](_0x331294[_0x115e('0x3f')]);_0x3cf110['filters']=_['intersection'](_0x3cf110[_0x115e('0x40')],_0x3cf110['query']);_0x49a4e7[_0x115e('0x41')]=_[_0x115e('0x42')](_0x3cf110[_0x115e('0x40')],qs[_0x115e('0x43')](_0x331294[_0x115e('0x3f')]['fields']));_0x49a4e7[_0x115e('0x41')]=_0x49a4e7[_0x115e('0x41')]['length']?_0x49a4e7['attributes']:_0x3cf110['model'];if(!_0x331294[_0x115e('0x3f')]['hasOwnProperty'](_0x115e('0x44'))){_0x49a4e7[_0x115e('0x2c')]=qs[_0x115e('0x2c')](_0x331294[_0x115e('0x3f')][_0x115e('0x2c')]);_0x49a4e7[_0x115e('0x2b')]=qs[_0x115e('0x2b')](_0x331294[_0x115e('0x3f')]['offset']);}_0x49a4e7[_0x115e('0x45')]=qs[_0x115e('0x46')](_0x331294['query'][_0x115e('0x46')]);_0x49a4e7['where']=qs[_0x115e('0x47')](_['pick'](_0x331294['query'],_0x3cf110[_0x115e('0x47')]),_0xa16a9a);if(_0x331294[_0x115e('0x3f')][_0x115e('0x48')]){_0x49a4e7[_0x115e('0x49')]=_['merge'](_0x49a4e7[_0x115e('0x49')],{'$or':_[_0x115e('0x3d')](_0xa16a9a,function(_0x49319a){if(_0x49319a[_0x115e('0x4a')]!==_0x115e('0x4b')){var _0x263167={};_0x263167[_0x49319a[_0x115e('0x36')]]={'$like':'%'+_0x331294[_0x115e('0x3f')][_0x115e('0x48')]+'%'};return _0x263167;}})});}_0x49a4e7=_[_0x115e('0x4c')]({},_0x49a4e7,_0x331294[_0x115e('0x4d')]);var _0x198b23={'where':_0x49a4e7[_0x115e('0x49')]};return db[_0x115e('0x39')]['count'](_0x198b23)[_0x115e('0x33')](function(_0x50f546){_0x225042['count']=_0x50f546;if(_0x331294['query']['includeAll']){_0x49a4e7['include']=[{'all':!![]}];}return db[_0x115e('0x39')][_0x115e('0x4e')](_0x49a4e7);})[_0x115e('0x33')](function(_0x2e30a6){_0x225042['rows']=_0x2e30a6;return _0x225042;})[_0x115e('0x33')](respondWithFilteredResult(_0x278434,_0x49a4e7))[_0x115e('0x25')](handleError(_0x278434,null));};exports[_0x115e('0x4f')]=function(_0x1efaf4,_0x919701){var _0x2e4050={'raw':![],'where':{'id':_0x1efaf4[_0x115e('0x50')]['id']}},_0x2c3029={};_0x2c3029['model']=_[_0x115e('0x3e')](db[_0x115e('0x39')]['rawAttributes']);_0x2c3029['query']=_[_0x115e('0x3e')](_0x1efaf4[_0x115e('0x3f')]);_0x2c3029['filters']=_[_0x115e('0x42')](_0x2c3029[_0x115e('0x40')],_0x2c3029['query']);_0x2e4050[_0x115e('0x41')]=_[_0x115e('0x42')](_0x2c3029[_0x115e('0x40')],qs[_0x115e('0x43')](_0x1efaf4[_0x115e('0x3f')][_0x115e('0x43')]));_0x2e4050[_0x115e('0x41')]=_0x2e4050[_0x115e('0x41')]['length']?_0x2e4050[_0x115e('0x41')]:_0x2c3029['model'];if(_0x1efaf4[_0x115e('0x3f')][_0x115e('0x51')]){_0x2e4050['include']=[{'all':!![]}];}_0x2e4050=_['merge']({},_0x2e4050,_0x1efaf4[_0x115e('0x4d')]);return db[_0x115e('0x39')][_0x115e('0x52')](_0x2e4050)['then'](handleEntityNotFound(_0x919701,null))[_0x115e('0x33')](respondWithResult(_0x919701,null))[_0x115e('0x25')](handleError(_0x919701,null));};exports[_0x115e('0x53')]=function(_0x12f69d,_0x37f4b3){return db[_0x115e('0x39')][_0x115e('0x53')](_0x12f69d['body'],{})['then'](respondWithResult(_0x37f4b3,0xc9))['catch'](handleError(_0x37f4b3,null));};exports['update']=function(_0x5d4904,_0x2e1998){if(_0x5d4904[_0x115e('0x54')]['id']){delete _0x5d4904[_0x115e('0x54')]['id'];}return db[_0x115e('0x39')][_0x115e('0x52')]({'where':{'id':_0x5d4904[_0x115e('0x50')]['id']}})[_0x115e('0x33')](handleEntityNotFound(_0x2e1998,null))[_0x115e('0x33')](saveUpdates(_0x5d4904[_0x115e('0x54')],null))[_0x115e('0x33')](respondWithResult(_0x2e1998,null))[_0x115e('0x25')](handleError(_0x2e1998,null));};exports[_0x115e('0x34')]=function(_0x4eadc6,_0x41f15c){return db[_0x115e('0x39')]['find']({'where':{'id':_0x4eadc6[_0x115e('0x50')]['id']}})[_0x115e('0x33')](handleEntityNotFound(_0x41f15c,null))[_0x115e('0x33')](removeEntity(_0x41f15c,null))[_0x115e('0x25')](handleError(_0x41f15c,null));};exports[_0x115e('0x55')]=function(_0x4649b0,_0x18893d,_0x43d485){var _0x4e3f66={};var _0x141637={};var _0x5d1d00;var _0x374477;return db[_0x115e('0x39')][_0x115e('0x56')]({'where':{'id':_0x4649b0[_0x115e('0x50')]['id']}})[_0x115e('0x33')](handleEntityNotFound(_0x18893d,null))[_0x115e('0x33')](function(_0x4db297){if(_0x4db297){_0x5d1d00=_0x4db297;_0x141637[_0x115e('0x40')]=_[_0x115e('0x3e')](db[_0x115e('0x57')]['rawAttributes']);_0x141637[_0x115e('0x3f')]=_[_0x115e('0x3e')](_0x4649b0[_0x115e('0x3f')]);_0x141637[_0x115e('0x47')]=_[_0x115e('0x42')](_0x141637['model'],_0x141637[_0x115e('0x3f')]);_0x4e3f66[_0x115e('0x41')]=_[_0x115e('0x42')](_0x141637[_0x115e('0x40')],qs['fields'](_0x4649b0[_0x115e('0x3f')][_0x115e('0x43')]));_0x4e3f66[_0x115e('0x41')]=_0x4e3f66[_0x115e('0x41')][_0x115e('0x58')]?_0x4e3f66[_0x115e('0x41')]:_0x141637[_0x115e('0x40')];_0x4e3f66[_0x115e('0x45')]=qs[_0x115e('0x46')](_0x4649b0[_0x115e('0x3f')][_0x115e('0x46')]);_0x4e3f66[_0x115e('0x49')]=qs[_0x115e('0x47')](_['pick'](_0x4649b0[_0x115e('0x3f')],_0x141637[_0x115e('0x47')]));if(_0x4649b0[_0x115e('0x3f')][_0x115e('0x48')]){_0x4e3f66['where']=_[_0x115e('0x4c')](_0x4e3f66['where'],{'$or':_[_0x115e('0x3d')](_0x4e3f66[_0x115e('0x41')],function(_0x44ff28){var _0x17b484={};_0x17b484[_0x44ff28]={'$like':'%'+_0x4649b0[_0x115e('0x3f')]['filter']+'%'};return _0x17b484;})});}_0x4e3f66=_[_0x115e('0x4c')]({},_0x4e3f66,_0x4649b0[_0x115e('0x4d')]);return _0x5d1d00['getFields'](_0x4e3f66);}})['then'](function(_0xa2c147){if(_0xa2c147){_0x374477=_0xa2c147[_0x115e('0x58')];if(!_0x4649b0['query'][_0x115e('0x59')](_0x115e('0x44'))){_0x4e3f66[_0x115e('0x2c')]=qs[_0x115e('0x2c')](_0x4649b0[_0x115e('0x3f')][_0x115e('0x2c')]);_0x4e3f66[_0x115e('0x2b')]=qs[_0x115e('0x2b')](_0x4649b0[_0x115e('0x3f')][_0x115e('0x2b')]);}return _0x5d1d00[_0x115e('0x55')](_0x4e3f66);}})['then'](function(_0x4fc4d9){if(_0x4fc4d9){return _0x4fc4d9?{'count':_0x374477,'rows':_0x4fc4d9}:null;}})[_0x115e('0x33')](respondWithResult(_0x18893d,null))[_0x115e('0x25')](handleError(_0x18893d,null));};exports[_0x115e('0x5a')]=function(_0x19ccdd,_0x287a19,_0x27f31c){var _0x551c3a={};var _0x3f7f50={};var _0x5db0ad;var _0x2133ba;return db[_0x115e('0x39')]['findOne']({'where':{'id':_0x19ccdd[_0x115e('0x50')]['id']}})[_0x115e('0x33')](handleEntityNotFound(_0x287a19,null))[_0x115e('0x33')](function(_0x451fe4){if(_0x451fe4){_0x5db0ad=_0x451fe4;_0x3f7f50[_0x115e('0x40')]=_['keys'](db[_0x115e('0x57')][_0x115e('0x3a')]);_0x3f7f50[_0x115e('0x3f')]=_[_0x115e('0x3e')](_0x19ccdd[_0x115e('0x3f')]);_0x3f7f50[_0x115e('0x47')]=_[_0x115e('0x42')](_0x3f7f50['model'],_0x3f7f50[_0x115e('0x3f')]);_0x551c3a[_0x115e('0x41')]=_[_0x115e('0x42')](_0x3f7f50[_0x115e('0x40')],qs[_0x115e('0x43')](_0x19ccdd['query'][_0x115e('0x43')]));_0x551c3a[_0x115e('0x41')]=_0x551c3a[_0x115e('0x41')][_0x115e('0x58')]?_0x551c3a['attributes']:_0x3f7f50[_0x115e('0x40')];_0x551c3a[_0x115e('0x45')]=qs[_0x115e('0x46')](_0x19ccdd['query'][_0x115e('0x46')]);_0x551c3a[_0x115e('0x49')]=qs['filters'](_[_0x115e('0x5b')](_0x19ccdd[_0x115e('0x3f')],_0x3f7f50['filters']));if(_0x19ccdd[_0x115e('0x3f')][_0x115e('0x48')]){_0x551c3a[_0x115e('0x49')]=_[_0x115e('0x4c')](_0x551c3a[_0x115e('0x49')],{'$or':_[_0x115e('0x3d')](_0x551c3a[_0x115e('0x41')],function(_0x1f6b22){var _0x1b8cb5={};_0x1b8cb5[_0x1f6b22]={'$like':'%'+_0x19ccdd['query'][_0x115e('0x48')]+'%'};return _0x1b8cb5;})});}_0x551c3a=_[_0x115e('0x4c')]({},_0x551c3a,_0x19ccdd['options']);return _0x5db0ad[_0x115e('0x5a')](_0x551c3a);}})[_0x115e('0x33')](function(_0x7d11d2){if(_0x7d11d2){_0x2133ba=_0x7d11d2[_0x115e('0x58')];if(!_0x19ccdd[_0x115e('0x3f')][_0x115e('0x59')]('nolimit')){_0x551c3a['limit']=qs[_0x115e('0x2c')](_0x19ccdd[_0x115e('0x3f')][_0x115e('0x2c')]);_0x551c3a['offset']=qs[_0x115e('0x2b')](_0x19ccdd[_0x115e('0x3f')][_0x115e('0x2b')]);}return _0x5db0ad['getSubjects'](_0x551c3a);}})['then'](function(_0x492c5e){if(_0x492c5e){return _0x492c5e?{'count':_0x2133ba,'rows':_0x492c5e}:null;}})[_0x115e('0x33')](respondWithResult(_0x287a19,null))[_0x115e('0x25')](handleError(_0x287a19,null));};exports[_0x115e('0x5c')]=function(_0x5838e2,_0x12338d,_0x2f4f74){var _0x461ec4={};var _0x276dd7={};var _0x3e779f;var _0x498b43;return db[_0x115e('0x39')]['findOne']({'where':{'id':_0x5838e2['params']['id']}})[_0x115e('0x33')](handleEntityNotFound(_0x12338d,null))[_0x115e('0x33')](function(_0xf419df){if(_0xf419df){_0x3e779f=_0xf419df;_0x276dd7['model']=_[_0x115e('0x3e')](db[_0x115e('0x57')]['rawAttributes']);_0x276dd7[_0x115e('0x3f')]=_[_0x115e('0x3e')](_0x5838e2['query']);_0x276dd7[_0x115e('0x47')]=_['intersection'](_0x276dd7[_0x115e('0x40')],_0x276dd7['query']);_0x461ec4[_0x115e('0x41')]=_['intersection'](_0x276dd7[_0x115e('0x40')],qs['fields'](_0x5838e2['query']['fields']));_0x461ec4[_0x115e('0x41')]=_0x461ec4[_0x115e('0x41')][_0x115e('0x58')]?_0x461ec4[_0x115e('0x41')]:_0x276dd7[_0x115e('0x40')];_0x461ec4[_0x115e('0x45')]=qs[_0x115e('0x46')](_0x5838e2[_0x115e('0x3f')][_0x115e('0x46')]);_0x461ec4[_0x115e('0x49')]=qs[_0x115e('0x47')](_[_0x115e('0x5b')](_0x5838e2['query'],_0x276dd7[_0x115e('0x47')]));if(_0x5838e2[_0x115e('0x3f')][_0x115e('0x48')]){_0x461ec4[_0x115e('0x49')]=_[_0x115e('0x4c')](_0x461ec4[_0x115e('0x49')],{'$or':_['map'](_0x461ec4[_0x115e('0x41')],function(_0x205179){var _0x4a23e3={};_0x4a23e3[_0x205179]={'$like':'%'+_0x5838e2[_0x115e('0x3f')]['filter']+'%'};return _0x4a23e3;})});}_0x461ec4=_['merge']({},_0x461ec4,_0x5838e2[_0x115e('0x4d')]);return _0x3e779f[_0x115e('0x5c')](_0x461ec4);}})[_0x115e('0x33')](function(_0x765a85){if(_0x765a85){_0x498b43=_0x765a85['length'];if(!_0x5838e2[_0x115e('0x3f')][_0x115e('0x59')]('nolimit')){_0x461ec4[_0x115e('0x2c')]=qs[_0x115e('0x2c')](_0x5838e2[_0x115e('0x3f')][_0x115e('0x2c')]);_0x461ec4[_0x115e('0x2b')]=qs['offset'](_0x5838e2[_0x115e('0x3f')][_0x115e('0x2b')]);}return _0x3e779f[_0x115e('0x5c')](_0x461ec4);}})[_0x115e('0x33')](function(_0x44384b){if(_0x44384b){return _0x44384b?{'count':_0x498b43,'rows':_0x44384b}:null;}})[_0x115e('0x33')](respondWithResult(_0x12338d,null))[_0x115e('0x25')](handleError(_0x12338d,null));}; \ No newline at end of file +var _0x4a58=['mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','Content-Range','apply','save','update','destroy','end','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','VIRTUAL','merge','options','include','Dynamics365Configuration','findAll','rows','show','params','includeAll','find','create','body','getFields','Dynamics365Field','pick','findOne','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x2d0c33,_0x2b22cf){var _0x50f706=function(_0x37b33a){while(--_0x37b33a){_0x2d0c33['push'](_0x2d0c33['shift']());}};_0x50f706(++_0x2b22cf);}(_0x4a58,0x1b1));var _0x84a5=function(_0xc9b988,_0x429150){_0xc9b988=_0xc9b988-0x0;var _0x5f14fe=_0x4a58[_0xc9b988];return _0x5f14fe;};'use strict';var pdf=require(_0x84a5('0x0'));var emlformat=require(_0x84a5('0x1'));var rimraf=require(_0x84a5('0x2'));var zipdir=require(_0x84a5('0x3'));var jsonpatch=require(_0x84a5('0x4'));var rp=require(_0x84a5('0x5'));var moment=require('moment');var BPromise=require(_0x84a5('0x6'));var Mustache=require(_0x84a5('0x7'));var util=require(_0x84a5('0x8'));var path=require(_0x84a5('0x9'));var sox=require('sox');var csv=require(_0x84a5('0xa'));var ejs=require(_0x84a5('0xb'));var fs=require('fs');var _=require(_0x84a5('0xc'));var squel=require('squel');var crypto=require(_0x84a5('0xd'));var jsforce=require(_0x84a5('0xe'));var deskjs=require(_0x84a5('0xf'));var toCsv=require(_0x84a5('0xa'));var querystring=require('querystring');var Papa=require(_0x84a5('0x10'));var Redis=require('ioredis');var authService=require(_0x84a5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x84a5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84a5('0x13'))(_0x84a5('0x14'));var utils=require('../../config/utils');var config=require(_0x84a5('0x15'));var licenseUtil=require(_0x84a5('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x84a5('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x130a28,_0x14dde7,_0x2f94e5,_0x1896fd){return new BPromise(function(_0x256d0b,_0x3f889d){var _0x303613=_0x1896fd||client;return _0x303613[_0x84a5('0x18')](_0x130a28,_0x2f94e5)[_0x84a5('0x19')](function(_0x24e2a0){logger['info'](_0x84a5('0x1a'),_0x14dde7,_0x84a5('0x1b'));logger['debug'](_0x84a5('0x1c'),_0x14dde7,_0x84a5('0x1b'),JSON[_0x84a5('0x1d')](_0x24e2a0));if(_0x24e2a0[_0x84a5('0x1e')]){if(_0x24e2a0[_0x84a5('0x1e')][_0x84a5('0x1f')]===0x1f4){logger[_0x84a5('0x1e')](_0x84a5('0x1a'),_0x14dde7,_0x24e2a0[_0x84a5('0x1e')]['message']);return _0x3f889d(_0x24e2a0['error'][_0x84a5('0x20')]);}logger[_0x84a5('0x1e')]('Dynamics365Configuration,\x20%s,\x20%s',_0x14dde7,_0x24e2a0[_0x84a5('0x1e')][_0x84a5('0x20')]);return _0x256d0b(_0x24e2a0[_0x84a5('0x1e')][_0x84a5('0x20')]);}else{logger[_0x84a5('0x21')](_0x84a5('0x1a'),_0x14dde7,_0x84a5('0x1b'));_0x256d0b(_0x24e2a0[_0x84a5('0x22')][_0x84a5('0x20')]);}})[_0x84a5('0x23')](function(_0x6337a9){logger['error'](_0x84a5('0x1a'),_0x14dde7,_0x6337a9);_0x3f889d(_0x6337a9);});});}function respondWithStatusCode(_0x45f226,_0x662cc9){_0x662cc9=_0x662cc9||0xcc;return function(_0x604750){if(_0x604750){return _0x45f226[_0x84a5('0x24')](_0x662cc9);}return _0x45f226[_0x84a5('0x25')](_0x662cc9)['end']();};}function respondWithResult(_0x5691ef,_0x4d48c1){_0x4d48c1=_0x4d48c1||0xc8;return function(_0x2b1ce7){if(_0x2b1ce7){return _0x5691ef[_0x84a5('0x25')](_0x4d48c1)[_0x84a5('0x26')](_0x2b1ce7);}};}function respondWithFilteredResult(_0x469091,_0x143d6b){return function(_0x1d7ab2){if(_0x1d7ab2){var _0x2fc833=_0x1d7ab2[_0x84a5('0x27')],_0x2cda4d=_0x143d6b[_0x84a5('0x28')],_0x15d389=_0x143d6b[_0x84a5('0x28')]+_0x143d6b['limit'],_0x379285;if(_0x15d389>=_0x2fc833){_0x15d389=_0x2fc833;_0x379285=0xc8;}else{_0x379285=0xce;}_0x469091['status'](_0x379285);return _0x469091['set'](_0x84a5('0x29'),_0x2cda4d+'-'+_0x15d389+'/'+_0x2fc833)[_0x84a5('0x26')](_0x1d7ab2);}return null;};}function patchUpdates(_0x19c3cf){return function(_0x255d19){try{jsonpatch[_0x84a5('0x2a')](_0x255d19,_0x19c3cf,!![]);}catch(_0x1570ee){return BPromise['reject'](_0x1570ee);}return _0x255d19[_0x84a5('0x2b')]();};}function saveUpdates(_0x43cfc4,_0x244143){return function(_0x3512a8){if(_0x3512a8){return _0x3512a8[_0x84a5('0x2c')](_0x43cfc4)[_0x84a5('0x19')](function(_0x48f626){return _0x48f626;});}return null;};}function removeEntity(_0x571b3e,_0x12b7ba){return function(_0x70d23e){if(_0x70d23e){return _0x70d23e[_0x84a5('0x2d')]()['then'](function(){_0x571b3e[_0x84a5('0x25')](0xcc)[_0x84a5('0x2e')]();});}};}function handleEntityNotFound(_0x344dff,_0xcaaa6f){return function(_0x425b30){if(!_0x425b30){_0x344dff[_0x84a5('0x24')](0x194);}return _0x425b30;};}function handleError(_0x46f513,_0xb5d37d){_0xb5d37d=_0xb5d37d||0x1f4;return function(_0x6d616){logger[_0x84a5('0x1e')](_0x6d616[_0x84a5('0x2f')]);if(_0x6d616[_0x84a5('0x30')]){delete _0x6d616[_0x84a5('0x30')];}_0x46f513[_0x84a5('0x25')](_0xb5d37d)[_0x84a5('0x31')](_0x6d616);};}exports['index']=function(_0x10f874,_0x28e75c){var _0x169ce8={},_0x32dd97={},_0x229717={'count':0x0,'rows':[]};var _0x4f5043=_['map'](db['Dynamics365Configuration'][_0x84a5('0x32')],function(_0x5deecd){return{'name':_0x5deecd[_0x84a5('0x33')],'type':_0x5deecd[_0x84a5('0x34')]['key']};});_0x32dd97[_0x84a5('0x35')]=_[_0x84a5('0x36')](_0x4f5043,'name');_0x32dd97[_0x84a5('0x37')]=_[_0x84a5('0x38')](_0x10f874[_0x84a5('0x37')]);_0x32dd97['filters']=_[_0x84a5('0x39')](_0x32dd97['model'],_0x32dd97[_0x84a5('0x37')]);_0x169ce8[_0x84a5('0x3a')]=_[_0x84a5('0x39')](_0x32dd97['model'],qs[_0x84a5('0x3b')](_0x10f874[_0x84a5('0x37')][_0x84a5('0x3b')]));_0x169ce8['attributes']=_0x169ce8['attributes'][_0x84a5('0x3c')]?_0x169ce8['attributes']:_0x32dd97[_0x84a5('0x35')];if(!_0x10f874[_0x84a5('0x37')][_0x84a5('0x3d')](_0x84a5('0x3e'))){_0x169ce8[_0x84a5('0x3f')]=qs['limit'](_0x10f874[_0x84a5('0x37')][_0x84a5('0x3f')]);_0x169ce8[_0x84a5('0x28')]=qs[_0x84a5('0x28')](_0x10f874[_0x84a5('0x37')][_0x84a5('0x28')]);}_0x169ce8[_0x84a5('0x40')]=qs[_0x84a5('0x41')](_0x10f874['query'][_0x84a5('0x41')]);_0x169ce8['where']=qs[_0x84a5('0x42')](_['pick'](_0x10f874['query'],_0x32dd97[_0x84a5('0x42')]),_0x4f5043);if(_0x10f874['query'][_0x84a5('0x43')]){_0x169ce8['where']=_['merge'](_0x169ce8[_0x84a5('0x44')],{'$or':_[_0x84a5('0x36')](_0x4f5043,function(_0x50be0c){if(_0x50be0c[_0x84a5('0x34')]!==_0x84a5('0x45')){var _0x343a28={};_0x343a28[_0x50be0c[_0x84a5('0x30')]]={'$like':'%'+_0x10f874[_0x84a5('0x37')][_0x84a5('0x43')]+'%'};return _0x343a28;}})});}_0x169ce8=_[_0x84a5('0x46')]({},_0x169ce8,_0x10f874[_0x84a5('0x47')]);var _0x45ebd8={'where':_0x169ce8[_0x84a5('0x44')]};return db['Dynamics365Configuration']['count'](_0x45ebd8)[_0x84a5('0x19')](function(_0x2f374a){_0x229717[_0x84a5('0x27')]=_0x2f374a;if(_0x10f874[_0x84a5('0x37')]['includeAll']){_0x169ce8[_0x84a5('0x48')]=[{'all':!![]}];}return db[_0x84a5('0x49')][_0x84a5('0x4a')](_0x169ce8);})['then'](function(_0x3ad181){_0x229717[_0x84a5('0x4b')]=_0x3ad181;return _0x229717;})[_0x84a5('0x19')](respondWithFilteredResult(_0x28e75c,_0x169ce8))[_0x84a5('0x23')](handleError(_0x28e75c,null));};exports[_0x84a5('0x4c')]=function(_0x74f00b,_0x5c5419){var _0x4759c6={'raw':![],'where':{'id':_0x74f00b[_0x84a5('0x4d')]['id']}},_0x2594cc={};_0x2594cc[_0x84a5('0x35')]=_[_0x84a5('0x38')](db[_0x84a5('0x49')][_0x84a5('0x32')]);_0x2594cc['query']=_[_0x84a5('0x38')](_0x74f00b[_0x84a5('0x37')]);_0x2594cc[_0x84a5('0x42')]=_[_0x84a5('0x39')](_0x2594cc[_0x84a5('0x35')],_0x2594cc['query']);_0x4759c6[_0x84a5('0x3a')]=_['intersection'](_0x2594cc[_0x84a5('0x35')],qs[_0x84a5('0x3b')](_0x74f00b[_0x84a5('0x37')][_0x84a5('0x3b')]));_0x4759c6[_0x84a5('0x3a')]=_0x4759c6[_0x84a5('0x3a')][_0x84a5('0x3c')]?_0x4759c6['attributes']:_0x2594cc[_0x84a5('0x35')];if(_0x74f00b[_0x84a5('0x37')][_0x84a5('0x4e')]){_0x4759c6[_0x84a5('0x48')]=[{'all':!![]}];}_0x4759c6=_['merge']({},_0x4759c6,_0x74f00b[_0x84a5('0x47')]);return db[_0x84a5('0x49')][_0x84a5('0x4f')](_0x4759c6)['then'](handleEntityNotFound(_0x5c5419,null))[_0x84a5('0x19')](respondWithResult(_0x5c5419,null))['catch'](handleError(_0x5c5419,null));};exports[_0x84a5('0x50')]=function(_0x5b42b6,_0x526527){return db[_0x84a5('0x49')]['create'](_0x5b42b6[_0x84a5('0x51')],{})[_0x84a5('0x19')](respondWithResult(_0x526527,0xc9))[_0x84a5('0x23')](handleError(_0x526527,null));};exports[_0x84a5('0x2c')]=function(_0x265698,_0x302f94){if(_0x265698[_0x84a5('0x51')]['id']){delete _0x265698[_0x84a5('0x51')]['id'];}return db['Dynamics365Configuration'][_0x84a5('0x4f')]({'where':{'id':_0x265698[_0x84a5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x302f94,null))[_0x84a5('0x19')](saveUpdates(_0x265698[_0x84a5('0x51')],null))[_0x84a5('0x19')](respondWithResult(_0x302f94,null))[_0x84a5('0x23')](handleError(_0x302f94,null));};exports[_0x84a5('0x2d')]=function(_0x3dcea8,_0x29fe30){return db[_0x84a5('0x49')][_0x84a5('0x4f')]({'where':{'id':_0x3dcea8[_0x84a5('0x4d')]['id']}})[_0x84a5('0x19')](handleEntityNotFound(_0x29fe30,null))[_0x84a5('0x19')](removeEntity(_0x29fe30,null))['catch'](handleError(_0x29fe30,null));};exports[_0x84a5('0x52')]=function(_0x36c9d1,_0x5a094d,_0x523a23){var _0x15d9d5={};var _0x18c3de={};var _0x125c70;var _0x2f4d5f;return db[_0x84a5('0x49')]['findOne']({'where':{'id':_0x36c9d1[_0x84a5('0x4d')]['id']}})[_0x84a5('0x19')](handleEntityNotFound(_0x5a094d,null))['then'](function(_0x2a4792){if(_0x2a4792){_0x125c70=_0x2a4792;_0x18c3de[_0x84a5('0x35')]=_[_0x84a5('0x38')](db[_0x84a5('0x53')][_0x84a5('0x32')]);_0x18c3de[_0x84a5('0x37')]=_[_0x84a5('0x38')](_0x36c9d1[_0x84a5('0x37')]);_0x18c3de[_0x84a5('0x42')]=_['intersection'](_0x18c3de['model'],_0x18c3de[_0x84a5('0x37')]);_0x15d9d5['attributes']=_['intersection'](_0x18c3de['model'],qs['fields'](_0x36c9d1['query'][_0x84a5('0x3b')]));_0x15d9d5[_0x84a5('0x3a')]=_0x15d9d5[_0x84a5('0x3a')][_0x84a5('0x3c')]?_0x15d9d5[_0x84a5('0x3a')]:_0x18c3de[_0x84a5('0x35')];_0x15d9d5[_0x84a5('0x40')]=qs[_0x84a5('0x41')](_0x36c9d1[_0x84a5('0x37')]['sort']);_0x15d9d5[_0x84a5('0x44')]=qs[_0x84a5('0x42')](_[_0x84a5('0x54')](_0x36c9d1['query'],_0x18c3de[_0x84a5('0x42')]));if(_0x36c9d1[_0x84a5('0x37')][_0x84a5('0x43')]){_0x15d9d5[_0x84a5('0x44')]=_[_0x84a5('0x46')](_0x15d9d5[_0x84a5('0x44')],{'$or':_['map'](_0x15d9d5['attributes'],function(_0xc60295){var _0xf3b129={};_0xf3b129[_0xc60295]={'$like':'%'+_0x36c9d1[_0x84a5('0x37')][_0x84a5('0x43')]+'%'};return _0xf3b129;})});}_0x15d9d5=_[_0x84a5('0x46')]({},_0x15d9d5,_0x36c9d1[_0x84a5('0x47')]);return _0x125c70[_0x84a5('0x52')](_0x15d9d5);}})[_0x84a5('0x19')](function(_0x4f82f7){if(_0x4f82f7){_0x2f4d5f=_0x4f82f7[_0x84a5('0x3c')];if(!_0x36c9d1[_0x84a5('0x37')][_0x84a5('0x3d')]('nolimit')){_0x15d9d5[_0x84a5('0x3f')]=qs['limit'](_0x36c9d1[_0x84a5('0x37')][_0x84a5('0x3f')]);_0x15d9d5['offset']=qs[_0x84a5('0x28')](_0x36c9d1[_0x84a5('0x37')][_0x84a5('0x28')]);}return _0x125c70[_0x84a5('0x52')](_0x15d9d5);}})[_0x84a5('0x19')](function(_0x1692cf){if(_0x1692cf){return _0x1692cf?{'count':_0x2f4d5f,'rows':_0x1692cf}:null;}})[_0x84a5('0x19')](respondWithResult(_0x5a094d,null))['catch'](handleError(_0x5a094d,null));};exports['getSubjects']=function(_0x14a2c5,_0xd8036f,_0x3f9bf0){var _0x43434d={};var _0x2138f9={};var _0x5f3785;var _0x249886;return db[_0x84a5('0x49')][_0x84a5('0x55')]({'where':{'id':_0x14a2c5[_0x84a5('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd8036f,null))[_0x84a5('0x19')](function(_0x4e9905){if(_0x4e9905){_0x5f3785=_0x4e9905;_0x2138f9[_0x84a5('0x35')]=_[_0x84a5('0x38')](db['Dynamics365Field'][_0x84a5('0x32')]);_0x2138f9[_0x84a5('0x37')]=_[_0x84a5('0x38')](_0x14a2c5[_0x84a5('0x37')]);_0x2138f9[_0x84a5('0x42')]=_[_0x84a5('0x39')](_0x2138f9[_0x84a5('0x35')],_0x2138f9[_0x84a5('0x37')]);_0x43434d[_0x84a5('0x3a')]=_['intersection'](_0x2138f9[_0x84a5('0x35')],qs[_0x84a5('0x3b')](_0x14a2c5[_0x84a5('0x37')][_0x84a5('0x3b')]));_0x43434d[_0x84a5('0x3a')]=_0x43434d[_0x84a5('0x3a')]['length']?_0x43434d['attributes']:_0x2138f9[_0x84a5('0x35')];_0x43434d[_0x84a5('0x40')]=qs[_0x84a5('0x41')](_0x14a2c5[_0x84a5('0x37')][_0x84a5('0x41')]);_0x43434d[_0x84a5('0x44')]=qs[_0x84a5('0x42')](_[_0x84a5('0x54')](_0x14a2c5[_0x84a5('0x37')],_0x2138f9[_0x84a5('0x42')]));if(_0x14a2c5[_0x84a5('0x37')]['filter']){_0x43434d['where']=_[_0x84a5('0x46')](_0x43434d[_0x84a5('0x44')],{'$or':_[_0x84a5('0x36')](_0x43434d[_0x84a5('0x3a')],function(_0xeb22e){var _0x512ee5={};_0x512ee5[_0xeb22e]={'$like':'%'+_0x14a2c5['query'][_0x84a5('0x43')]+'%'};return _0x512ee5;})});}_0x43434d=_[_0x84a5('0x46')]({},_0x43434d,_0x14a2c5[_0x84a5('0x47')]);return _0x5f3785['getSubjects'](_0x43434d);}})[_0x84a5('0x19')](function(_0x1ce3d3){if(_0x1ce3d3){_0x249886=_0x1ce3d3['length'];if(!_0x14a2c5[_0x84a5('0x37')]['hasOwnProperty'](_0x84a5('0x3e'))){_0x43434d[_0x84a5('0x3f')]=qs['limit'](_0x14a2c5['query']['limit']);_0x43434d[_0x84a5('0x28')]=qs[_0x84a5('0x28')](_0x14a2c5[_0x84a5('0x37')][_0x84a5('0x28')]);}return _0x5f3785[_0x84a5('0x56')](_0x43434d);}})[_0x84a5('0x19')](function(_0x5a4d34){if(_0x5a4d34){return _0x5a4d34?{'count':_0x249886,'rows':_0x5a4d34}:null;}})[_0x84a5('0x19')](respondWithResult(_0xd8036f,null))[_0x84a5('0x23')](handleError(_0xd8036f,null));};exports[_0x84a5('0x57')]=function(_0x43039c,_0x56b454,_0x1783d6){var _0x120935={};var _0x1f1fab={};var _0x5c17b0;var _0x17ed66;return db[_0x84a5('0x49')]['findOne']({'where':{'id':_0x43039c[_0x84a5('0x4d')]['id']}})[_0x84a5('0x19')](handleEntityNotFound(_0x56b454,null))[_0x84a5('0x19')](function(_0x48249e){if(_0x48249e){_0x5c17b0=_0x48249e;_0x1f1fab[_0x84a5('0x35')]=_[_0x84a5('0x38')](db[_0x84a5('0x53')][_0x84a5('0x32')]);_0x1f1fab[_0x84a5('0x37')]=_[_0x84a5('0x38')](_0x43039c[_0x84a5('0x37')]);_0x1f1fab[_0x84a5('0x42')]=_[_0x84a5('0x39')](_0x1f1fab[_0x84a5('0x35')],_0x1f1fab[_0x84a5('0x37')]);_0x120935[_0x84a5('0x3a')]=_['intersection'](_0x1f1fab[_0x84a5('0x35')],qs[_0x84a5('0x3b')](_0x43039c['query'][_0x84a5('0x3b')]));_0x120935[_0x84a5('0x3a')]=_0x120935[_0x84a5('0x3a')]['length']?_0x120935['attributes']:_0x1f1fab[_0x84a5('0x35')];_0x120935[_0x84a5('0x40')]=qs['sort'](_0x43039c[_0x84a5('0x37')][_0x84a5('0x41')]);_0x120935[_0x84a5('0x44')]=qs['filters'](_['pick'](_0x43039c[_0x84a5('0x37')],_0x1f1fab[_0x84a5('0x42')]));if(_0x43039c[_0x84a5('0x37')][_0x84a5('0x43')]){_0x120935[_0x84a5('0x44')]=_['merge'](_0x120935[_0x84a5('0x44')],{'$or':_[_0x84a5('0x36')](_0x120935[_0x84a5('0x3a')],function(_0x5d4359){var _0x28720a={};_0x28720a[_0x5d4359]={'$like':'%'+_0x43039c[_0x84a5('0x37')][_0x84a5('0x43')]+'%'};return _0x28720a;})});}_0x120935=_[_0x84a5('0x46')]({},_0x120935,_0x43039c['options']);return _0x5c17b0[_0x84a5('0x57')](_0x120935);}})['then'](function(_0x5c19e4){if(_0x5c19e4){_0x17ed66=_0x5c19e4[_0x84a5('0x3c')];if(!_0x43039c[_0x84a5('0x37')][_0x84a5('0x3d')](_0x84a5('0x3e'))){_0x120935[_0x84a5('0x3f')]=qs[_0x84a5('0x3f')](_0x43039c[_0x84a5('0x37')][_0x84a5('0x3f')]);_0x120935['offset']=qs['offset'](_0x43039c[_0x84a5('0x37')][_0x84a5('0x28')]);}return _0x5c17b0[_0x84a5('0x57')](_0x120935);}})[_0x84a5('0x19')](function(_0x56ab18){if(_0x56ab18){return _0x56ab18?{'count':_0x17ed66,'rows':_0x56ab18}:null;}})['then'](respondWithResult(_0x56b454,null))['catch'](handleError(_0x56b454,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 5a829a1..63cb5cb 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 _0xec1b=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','lodash','util','api','bluebird'];(function(_0x24697b,_0x2eb072){var _0x585b99=function(_0x261980){while(--_0x261980){_0x24697b['push'](_0x24697b['shift']());}};_0x585b99(++_0x2eb072);}(_0xec1b,0x17c));var _0xbec1=function(_0x5c16e1,_0x12ea72){_0x5c16e1=_0x5c16e1-0x0;var _0x4f59d0=_0xec1b[_0x5c16e1];return _0x4f59d0;};'use strict';var _=require(_0xbec1('0x0'));var util=require(_0xbec1('0x1'));var logger=require('../../config/logger')(_0xbec1('0x2'));var moment=require('moment');var BPromise=require(_0xbec1('0x3'));var rp=require(_0xbec1('0x4'));var fs=require('fs');var path=require(_0xbec1('0x5'));var rimraf=require(_0xbec1('0x6'));var config=require(_0xbec1('0x7'));var attributes=require(_0xbec1('0x8'));module[_0xbec1('0x9')]=function(_0xbaaa7e,_0xb6f9cb){return _0xbaaa7e[_0xbec1('0xa')]('Dynamics365Configuration',attributes,{'tableName':_0xbec1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf825=['rimraf','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','lodash','util','moment','bluebird','request-promise'];(function(_0x21b254,_0x28c55b){var _0xa52d8c=function(_0x4f0a70){while(--_0x4f0a70){_0x21b254['push'](_0x21b254['shift']());}};_0xa52d8c(++_0x28c55b);}(_0xf825,0xc3));var _0x5f82=function(_0x39d626,_0x10e403){_0x39d626=_0x39d626-0x0;var _0x3e6773=_0xf825[_0x39d626];return _0x3e6773;};'use strict';var _=require(_0x5f82('0x0'));var util=require(_0x5f82('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5f82('0x2'));var BPromise=require(_0x5f82('0x3'));var rp=require(_0x5f82('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f82('0x5'));var config=require('../../config/environment');var attributes=require(_0x5f82('0x6'));module[_0x5f82('0x7')]=function(_0x1fbb82,_0x471143){return _0x1fbb82[_0x5f82('0x8')]('Dynamics365Configuration',attributes,{'tableName':_0x5f82('0x9'),'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 1378e93..c61f70e 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 _0x7bfa=['../../config/utils','../../config/environment','jayson/promise','client','http','info','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','moment','bluebird','../../mysqldb'];(function(_0x36aae8,_0x3fc00b){var _0x2cada6=function(_0x3ed039){while(--_0x3ed039){_0x36aae8['push'](_0x36aae8['shift']());}};_0x2cada6(++_0x3fc00b);}(_0x7bfa,0x10b));var _0xa7bf=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x7bfa[_0x42bc91];return _0x3f5507;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa7bf('0x0'));var BPromise=require(_0xa7bf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7bf('0x2'))['db'];var utils=require(_0xa7bf('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xa7bf('0x4'));var jayson=require(_0xa7bf('0x5'));var client=jayson[_0xa7bf('0x6')][_0xa7bf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x493b7a,_0x21ae66,_0x58f893){return new BPromise(function(_0x107ce6,_0x148679){return client['request'](_0x493b7a,_0x58f893)['then'](function(_0x3b48cb){logger[_0xa7bf('0x8')]('Dynamics365Configuration,\x20%s,\x20%s',_0x21ae66,'request\x20sent');logger['debug'](_0xa7bf('0x9'),_0x21ae66,_0xa7bf('0xa'),JSON[_0xa7bf('0xb')](_0x3b48cb));if(_0x3b48cb[_0xa7bf('0xc')]){if(_0x3b48cb[_0xa7bf('0xc')][_0xa7bf('0xd')]===0x1f4){logger['error'](_0xa7bf('0xe'),_0x21ae66,_0x3b48cb[_0xa7bf('0xc')][_0xa7bf('0xf')]);return _0x148679(_0x3b48cb[_0xa7bf('0xc')]['message']);}logger[_0xa7bf('0xc')](_0xa7bf('0xe'),_0x21ae66,_0x3b48cb[_0xa7bf('0xc')][_0xa7bf('0xf')]);return _0x107ce6(_0x3b48cb[_0xa7bf('0xc')][_0xa7bf('0xf')]);}else{logger[_0xa7bf('0x8')](_0xa7bf('0xe'),_0x21ae66,_0xa7bf('0xa'));_0x107ce6(_0x3b48cb[_0xa7bf('0x10')][_0xa7bf('0xf')]);}})[_0xa7bf('0x11')](function(_0x331278){logger[_0xa7bf('0xc')](_0xa7bf('0xe'),_0x21ae66,_0x331278);_0x148679(_0x331278);});});} \ No newline at end of file +var _0x51cf=['then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x2b93a5,_0x122285){var _0x1a2f28=function(_0x186def){while(--_0x186def){_0x2b93a5['push'](_0x2b93a5['shift']());}};_0x1a2f28(++_0x122285);}(_0x51cf,0x17c));var _0xf51c=function(_0x301151,_0x172a45){_0x301151=_0x301151-0x0;var _0x4fb3f7=_0x51cf[_0x301151];return _0x4fb3f7;};'use strict';var _=require(_0xf51c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf51c('0x1'));var fs=require('fs');var Redis=require(_0xf51c('0x2'));var db=require(_0xf51c('0x3'))['db'];var utils=require(_0xf51c('0x4'));var logger=require(_0xf51c('0x5'))(_0xf51c('0x6'));var config=require(_0xf51c('0x7'));var jayson=require(_0xf51c('0x8'));var client=jayson[_0xf51c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2af18f,_0x41140a,_0x36212b){return new BPromise(function(_0x8b72e2,_0x36a75f){return client[_0xf51c('0xa')](_0x2af18f,_0x36212b)[_0xf51c('0xb')](function(_0x4fafe2){logger[_0xf51c('0xc')](_0xf51c('0xd'),_0x41140a,_0xf51c('0xe'));logger[_0xf51c('0xf')](_0xf51c('0x10'),_0x41140a,_0xf51c('0xe'),JSON[_0xf51c('0x11')](_0x4fafe2));if(_0x4fafe2[_0xf51c('0x12')]){if(_0x4fafe2[_0xf51c('0x12')][_0xf51c('0x13')]===0x1f4){logger[_0xf51c('0x12')](_0xf51c('0xd'),_0x41140a,_0x4fafe2[_0xf51c('0x12')]['message']);return _0x36a75f(_0x4fafe2[_0xf51c('0x12')]['message']);}logger[_0xf51c('0x12')](_0xf51c('0xd'),_0x41140a,_0x4fafe2[_0xf51c('0x12')][_0xf51c('0x14')]);return _0x8b72e2(_0x4fafe2[_0xf51c('0x12')]['message']);}else{logger[_0xf51c('0xc')](_0xf51c('0xd'),_0x41140a,_0xf51c('0xe'));_0x8b72e2(_0x4fafe2[_0xf51c('0x15')][_0xf51c('0x14')]);}})[_0xf51c('0x16')](function(_0x1b5d4e){logger[_0xf51c('0x12')](_0xf51c('0xd'),_0x41140a,_0x1b5d4e);_0x36a75f(_0x1b5d4e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index a7f18b9..8646eec 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 _0x6282=['update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x3f2c3d,_0x2b937a){var _0x4b4fe4=function(_0x3a915f){while(--_0x3a915f){_0x3f2c3d['push'](_0x3f2c3d['shift']());}};_0x4b4fe4(++_0x2b937a);}(_0x6282,0x76));var _0x2628=function(_0x2ebe55,_0x128938){_0x2ebe55=_0x2ebe55-0x0;var _0x248711=_0x6282[_0x2ebe55];return _0x248711;};'use strict';var multer=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var timeout=require(_0x2628('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2628('0x4'));var interaction=require(_0x2628('0x5'));var config=require('../../config/environment');var controller=require(_0x2628('0x6'));router[_0x2628('0x7')]('/',auth[_0x2628('0x8')](),controller[_0x2628('0x9')]);router[_0x2628('0x7')]('/:id',auth[_0x2628('0x8')](),controller[_0x2628('0xa')]);router[_0x2628('0xb')]('/',auth[_0x2628('0x8')](),controller[_0x2628('0xc')]);router[_0x2628('0xd')](_0x2628('0xe'),auth[_0x2628('0x8')](),controller[_0x2628('0xf')]);router[_0x2628('0x10')](_0x2628('0xe'),auth[_0x2628('0x8')](),controller[_0x2628('0x11')]);module[_0x2628('0x12')]=router; \ No newline at end of file +var _0x222f=['destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete'];(function(_0x2a68f0,_0x5d4902){var _0x3f7d14=function(_0x39ad79){while(--_0x39ad79){_0x2a68f0['push'](_0x2a68f0['shift']());}};_0x3f7d14(++_0x5d4902);}(_0x222f,0x1a4));var _0xf222=function(_0x2d2949,_0x24c559){_0x2d2949=_0x2d2949-0x0;var _0x4bb11f=_0x222f[_0x2d2949];return _0x4bb11f;};'use strict';var multer=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var path=require(_0xf222('0x2'));var timeout=require(_0xf222('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xf222('0x4'));var interaction=require(_0xf222('0x5'));var config=require(_0xf222('0x6'));var controller=require(_0xf222('0x7'));router['get']('/',auth[_0xf222('0x8')](),controller['index']);router[_0xf222('0x9')](_0xf222('0xa'),auth['isAuthenticated'](),controller[_0xf222('0xb')]);router[_0xf222('0xc')]('/',auth['isAuthenticated'](),controller[_0xf222('0xd')]);router[_0xf222('0xe')](_0xf222('0xa'),auth[_0xf222('0x8')](),controller[_0xf222('0xf')]);router[_0xf222('0x10')]('/:id',auth[_0xf222('0x8')](),controller[_0xf222('0x11')]);module[_0xf222('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 b3387b6..5d8217c 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 _0xd59d=['variable','BOOLEAN','ENUM','string','customVariable','keyValue','STRING'];(function(_0x17670f,_0x5cc7d1){var _0xb6ab86=function(_0x4b6a19){while(--_0x4b6a19){_0x17670f['push'](_0x17670f['shift']());}};_0xb6ab86(++_0x5cc7d1);}(_0xd59d,0x1a6));var _0xdd59=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd59d[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xdd59('0x0')](_0xdd59('0x1'),'variable',_0xdd59('0x2'),_0xdd59('0x3')),'defaultValue':_0xdd59('0x1')},'content':{'type':Sequelize[_0xdd59('0x4')]},'key':{'type':Sequelize[_0xdd59('0x4')]},'keyType':{'type':Sequelize[_0xdd59('0x0')](_0xdd59('0x1'),_0xdd59('0x5'),_0xdd59('0x2'))},'keyContent':{'type':Sequelize[_0xdd59('0x4')]},'idField':{'type':Sequelize[_0xdd59('0x4')]},'nameField':{'type':Sequelize[_0xdd59('0x4')]},'customField':{'type':Sequelize[_0xdd59('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd59('0x4')]}}; \ No newline at end of file +var _0x67bb=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x5e5f68,_0x510b86){var _0x22f786=function(_0x271059){while(--_0x271059){_0x5e5f68['push'](_0x5e5f68['shift']());}};_0x22f786(++_0x510b86);}(_0x67bb,0x11a));var _0xb67b=function(_0x561a36,_0x4226d4){_0x561a36=_0x561a36-0x0;var _0x44353b=_0x67bb[_0x561a36];return _0x44353b;};'use strict';var Sequelize=require(_0xb67b('0x0'));module[_0xb67b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb67b('0x2'),_0xb67b('0x3'),_0xb67b('0x4'),_0xb67b('0x5')),'defaultValue':_0xb67b('0x2')},'content':{'type':Sequelize[_0xb67b('0x6')]},'key':{'type':Sequelize[_0xb67b('0x6')]},'keyType':{'type':Sequelize[_0xb67b('0x7')](_0xb67b('0x2'),_0xb67b('0x3'),_0xb67b('0x4'))},'keyContent':{'type':Sequelize[_0xb67b('0x6')]},'idField':{'type':Sequelize[_0xb67b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb67b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb67b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index ce87f2b..6424749 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 _0xdd7e=['where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','find','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort'];(function(_0x10dfdf,_0xd11233){var _0x2ff0c7=function(_0x3b3d32){while(--_0x3b3d32){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x2ff0c7(++_0xd11233);}(_0xdd7e,0x1d2));var _0xedd7=function(_0xa57abd,_0xd091a1){_0xa57abd=_0xa57abd-0x0;var _0x160009=_0xdd7e[_0xa57abd];return _0x160009;};'use strict';var pdf=require(_0xedd7('0x0'));var emlformat=require(_0xedd7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xedd7('0x2'));var jsonpatch=require(_0xedd7('0x3'));var rp=require(_0xedd7('0x4'));var moment=require(_0xedd7('0x5'));var BPromise=require(_0xedd7('0x6'));var Mustache=require(_0xedd7('0x7'));var util=require(_0xedd7('0x8'));var path=require(_0xedd7('0x9'));var sox=require(_0xedd7('0xa'));var csv=require(_0xedd7('0xb'));var ejs=require(_0xedd7('0xc'));var fs=require('fs');var _=require(_0xedd7('0xd'));var squel=require(_0xedd7('0xe'));var crypto=require('crypto');var jsforce=require(_0xedd7('0xf'));var deskjs=require(_0xedd7('0x10'));var toCsv=require(_0xedd7('0xb'));var querystring=require(_0xedd7('0x11'));var Papa=require('papaparse');var Redis=require(_0xedd7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xedd7('0x13'));var as=require(_0xedd7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedd7('0x15'))(_0xedd7('0x16'));var utils=require(_0xedd7('0x17'));var config=require(_0xedd7('0x18'));var licenseUtil=require(_0xedd7('0x19'));var db=require(_0xedd7('0x1a'))['db'];function respondWithStatusCode(_0x4c9080,_0x49a010){_0x49a010=_0x49a010||0xcc;return function(_0x2904a6){if(_0x2904a6){return _0x4c9080['sendStatus'](_0x49a010);}return _0x4c9080['status'](_0x49a010)[_0xedd7('0x1b')]();};}function respondWithResult(_0xa6fe94,_0x214425){_0x214425=_0x214425||0xc8;return function(_0x13b947){if(_0x13b947){return _0xa6fe94[_0xedd7('0x1c')](_0x214425)[_0xedd7('0x1d')](_0x13b947);}};}function respondWithFilteredResult(_0x5d24e0,_0x5bbd8a){return function(_0x495834){if(_0x495834){var _0x23206a=_0x495834[_0xedd7('0x1e')],_0xe6207d=_0x5bbd8a[_0xedd7('0x1f')],_0x2fb4a9=_0x5bbd8a[_0xedd7('0x1f')]+_0x5bbd8a[_0xedd7('0x20')],_0x1504be;if(_0x2fb4a9>=_0x23206a){_0x2fb4a9=_0x23206a;_0x1504be=0xc8;}else{_0x1504be=0xce;}_0x5d24e0[_0xedd7('0x1c')](_0x1504be);return _0x5d24e0[_0xedd7('0x21')](_0xedd7('0x22'),_0xe6207d+'-'+_0x2fb4a9+'/'+_0x23206a)[_0xedd7('0x1d')](_0x495834);}return null;};}function patchUpdates(_0x286124){return function(_0x158e3e){try{jsonpatch[_0xedd7('0x23')](_0x158e3e,_0x286124,!![]);}catch(_0x19a985){return BPromise[_0xedd7('0x24')](_0x19a985);}return _0x158e3e[_0xedd7('0x25')]();};}function saveUpdates(_0x519944,_0x461322){return function(_0x3a6814){if(_0x3a6814){return _0x3a6814['update'](_0x519944)['then'](function(_0x5234a8){return _0x5234a8;});}return null;};}function removeEntity(_0x4a7cd9,_0x558ed9){return function(_0x2dffc7){if(_0x2dffc7){return _0x2dffc7[_0xedd7('0x26')]()['then'](function(){_0x4a7cd9['status'](0xcc)[_0xedd7('0x1b')]();});}};}function handleEntityNotFound(_0x2f97d5,_0x4b7034){return function(_0x4c0297){if(!_0x4c0297){_0x2f97d5['sendStatus'](0x194);}return _0x4c0297;};}function handleError(_0x203405,_0x50d908){_0x50d908=_0x50d908||0x1f4;return function(_0x18c6d4){logger[_0xedd7('0x27')](_0x18c6d4[_0xedd7('0x28')]);if(_0x18c6d4[_0xedd7('0x29')]){delete _0x18c6d4[_0xedd7('0x29')];}_0x203405[_0xedd7('0x1c')](_0x50d908)['send'](_0x18c6d4);};}exports[_0xedd7('0x2a')]=function(_0xc8c409,_0xa381a0){var _0x4a65c0={},_0x59b9a7={},_0x30e463={'count':0x0,'rows':[]};var _0x15c703=_[_0xedd7('0x2b')](db[_0xedd7('0x2c')][_0xedd7('0x2d')],function(_0x55bf21){return{'name':_0x55bf21[_0xedd7('0x2e')],'type':_0x55bf21[_0xedd7('0x2f')][_0xedd7('0x30')]};});_0x59b9a7[_0xedd7('0x31')]=_['map'](_0x15c703,'name');_0x59b9a7[_0xedd7('0x32')]=_[_0xedd7('0x33')](_0xc8c409[_0xedd7('0x32')]);_0x59b9a7[_0xedd7('0x34')]=_[_0xedd7('0x35')](_0x59b9a7[_0xedd7('0x31')],_0x59b9a7[_0xedd7('0x32')]);_0x4a65c0[_0xedd7('0x36')]=_[_0xedd7('0x35')](_0x59b9a7['model'],qs[_0xedd7('0x37')](_0xc8c409['query'][_0xedd7('0x37')]));_0x4a65c0['attributes']=_0x4a65c0['attributes'][_0xedd7('0x38')]?_0x4a65c0[_0xedd7('0x36')]:_0x59b9a7[_0xedd7('0x31')];if(!_0xc8c409[_0xedd7('0x32')]['hasOwnProperty']('nolimit')){_0x4a65c0[_0xedd7('0x20')]=qs['limit'](_0xc8c409[_0xedd7('0x32')][_0xedd7('0x20')]);_0x4a65c0[_0xedd7('0x1f')]=qs['offset'](_0xc8c409['query'][_0xedd7('0x1f')]);}_0x4a65c0[_0xedd7('0x39')]=qs[_0xedd7('0x3a')](_0xc8c409['query'][_0xedd7('0x3a')]);_0x4a65c0[_0xedd7('0x3b')]=qs['filters'](_[_0xedd7('0x3c')](_0xc8c409[_0xedd7('0x32')],_0x59b9a7['filters']),_0x15c703);if(_0xc8c409[_0xedd7('0x32')][_0xedd7('0x3d')]){_0x4a65c0[_0xedd7('0x3b')]=_[_0xedd7('0x3e')](_0x4a65c0['where'],{'$or':_[_0xedd7('0x2b')](_0x15c703,function(_0x451811){if(_0x451811['type']!==_0xedd7('0x3f')){var _0x3ef159={};_0x3ef159[_0x451811[_0xedd7('0x29')]]={'$like':'%'+_0xc8c409[_0xedd7('0x32')][_0xedd7('0x3d')]+'%'};return _0x3ef159;}})});}_0x4a65c0=_['merge']({},_0x4a65c0,_0xc8c409[_0xedd7('0x40')]);var _0x1197e3={'where':_0x4a65c0['where']};return db[_0xedd7('0x2c')][_0xedd7('0x1e')](_0x1197e3)[_0xedd7('0x41')](function(_0x39ab55){_0x30e463['count']=_0x39ab55;if(_0xc8c409[_0xedd7('0x32')][_0xedd7('0x42')]){_0x4a65c0[_0xedd7('0x43')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xedd7('0x44')](_0x4a65c0);})['then'](function(_0x140b07){_0x30e463['rows']=_0x140b07;return _0x30e463;})['then'](respondWithFilteredResult(_0xa381a0,_0x4a65c0))[_0xedd7('0x45')](handleError(_0xa381a0,null));};exports[_0xedd7('0x46')]=function(_0x42a42a,_0x27b13e){var _0x2b3e7c={'raw':!![],'where':{'id':_0x42a42a[_0xedd7('0x47')]['id']}},_0x38f12c={};_0x38f12c[_0xedd7('0x31')]=_[_0xedd7('0x33')](db[_0xedd7('0x2c')]['rawAttributes']);_0x38f12c['query']=_[_0xedd7('0x33')](_0x42a42a[_0xedd7('0x32')]);_0x38f12c[_0xedd7('0x34')]=_[_0xedd7('0x35')](_0x38f12c[_0xedd7('0x31')],_0x38f12c[_0xedd7('0x32')]);_0x2b3e7c[_0xedd7('0x36')]=_['intersection'](_0x38f12c['model'],qs[_0xedd7('0x37')](_0x42a42a[_0xedd7('0x32')]['fields']));_0x2b3e7c[_0xedd7('0x36')]=_0x2b3e7c['attributes'][_0xedd7('0x38')]?_0x2b3e7c['attributes']:_0x38f12c['model'];if(_0x42a42a['query']['includeAll']){_0x2b3e7c[_0xedd7('0x43')]=[{'all':!![]}];}_0x2b3e7c=_[_0xedd7('0x3e')]({},_0x2b3e7c,_0x42a42a[_0xedd7('0x40')]);return db['Dynamics365Field'][_0xedd7('0x48')](_0x2b3e7c)[_0xedd7('0x41')](handleEntityNotFound(_0x27b13e,null))[_0xedd7('0x41')](respondWithResult(_0x27b13e,null))[_0xedd7('0x45')](handleError(_0x27b13e,null));};exports['create']=function(_0x144ad1,_0x5c8169){return db['Dynamics365Field']['create'](_0x144ad1[_0xedd7('0x49')],{})['then'](respondWithResult(_0x5c8169,0xc9))['catch'](handleError(_0x5c8169,null));};exports[_0xedd7('0x4a')]=function(_0x497d0c,_0x5111bd){if(_0x497d0c[_0xedd7('0x49')]['id']){delete _0x497d0c[_0xedd7('0x49')]['id'];}return db[_0xedd7('0x2c')][_0xedd7('0x48')]({'where':{'id':_0x497d0c[_0xedd7('0x47')]['id']}})[_0xedd7('0x41')](handleEntityNotFound(_0x5111bd,null))[_0xedd7('0x41')](saveUpdates(_0x497d0c['body'],null))['then'](respondWithResult(_0x5111bd,null))['catch'](handleError(_0x5111bd,null));};exports['destroy']=function(_0x4a7004,_0x4be5b4){return db[_0xedd7('0x2c')][_0xedd7('0x48')]({'where':{'id':_0x4a7004[_0xedd7('0x47')]['id']}})[_0xedd7('0x41')](handleEntityNotFound(_0x4be5b4,null))[_0xedd7('0x41')](removeEntity(_0x4be5b4,null))['catch'](handleError(_0x4be5b4,null));}; \ No newline at end of file +var _0x517c=['rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','intersection','find','catch','create','body','html-pdf','eml-format'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x517c,0x92));var _0xc517=function(_0x215971,_0x37ea84){_0x215971=_0x215971-0x0;var _0x1031a4=_0x517c[_0x215971];return _0x1031a4;};'use strict';var pdf=require(_0xc517('0x0'));var emlformat=require(_0xc517('0x1'));var rimraf=require(_0xc517('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc517('0x3'));var rp=require(_0xc517('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc517('0x5'));var util=require(_0xc517('0x6'));var path=require(_0xc517('0x7'));var sox=require(_0xc517('0x8'));var csv=require('to-csv');var ejs=require(_0xc517('0x9'));var fs=require('fs');var _=require(_0xc517('0xa'));var squel=require(_0xc517('0xb'));var crypto=require('crypto');var jsforce=require(_0xc517('0xc'));var deskjs=require(_0xc517('0xd'));var toCsv=require(_0xc517('0xe'));var querystring=require(_0xc517('0xf'));var Papa=require('papaparse');var Redis=require(_0xc517('0x10'));var authService=require(_0xc517('0x11'));var qs=require(_0xc517('0x12'));var as=require(_0xc517('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc517('0x14'));var config=require(_0xc517('0x15'));var licenseUtil=require(_0xc517('0x16'));var db=require(_0xc517('0x17'))['db'];function respondWithStatusCode(_0x244b48,_0x52fd19){_0x52fd19=_0x52fd19||0xcc;return function(_0x3629be){if(_0x3629be){return _0x244b48[_0xc517('0x18')](_0x52fd19);}return _0x244b48[_0xc517('0x19')](_0x52fd19)[_0xc517('0x1a')]();};}function respondWithResult(_0x469ecc,_0xddb018){_0xddb018=_0xddb018||0xc8;return function(_0x1e4cd1){if(_0x1e4cd1){return _0x469ecc[_0xc517('0x19')](_0xddb018)['json'](_0x1e4cd1);}};}function respondWithFilteredResult(_0x290901,_0x22b173){return function(_0xa3d830){if(_0xa3d830){var _0x4259e3=_0xa3d830[_0xc517('0x1b')],_0x4148d9=_0x22b173[_0xc517('0x1c')],_0x3ed91e=_0x22b173[_0xc517('0x1c')]+_0x22b173[_0xc517('0x1d')],_0x28693a;if(_0x3ed91e>=_0x4259e3){_0x3ed91e=_0x4259e3;_0x28693a=0xc8;}else{_0x28693a=0xce;}_0x290901[_0xc517('0x19')](_0x28693a);return _0x290901[_0xc517('0x1e')]('Content-Range',_0x4148d9+'-'+_0x3ed91e+'/'+_0x4259e3)[_0xc517('0x1f')](_0xa3d830);}return null;};}function patchUpdates(_0x3549bb){return function(_0x11c48f){try{jsonpatch[_0xc517('0x20')](_0x11c48f,_0x3549bb,!![]);}catch(_0x42cca7){return BPromise[_0xc517('0x21')](_0x42cca7);}return _0x11c48f[_0xc517('0x22')]();};}function saveUpdates(_0x540375,_0x1587a){return function(_0x136751){if(_0x136751){return _0x136751[_0xc517('0x23')](_0x540375)[_0xc517('0x24')](function(_0x35564e){return _0x35564e;});}return null;};}function removeEntity(_0x5be43d,_0x2434a3){return function(_0x4a04eb){if(_0x4a04eb){return _0x4a04eb[_0xc517('0x25')]()['then'](function(){_0x5be43d[_0xc517('0x19')](0xcc)[_0xc517('0x1a')]();});}};}function handleEntityNotFound(_0x3da3b3,_0x241d5c){return function(_0x44d8ff){if(!_0x44d8ff){_0x3da3b3[_0xc517('0x18')](0x194);}return _0x44d8ff;};}function handleError(_0x1597a3,_0x2d64e2){_0x2d64e2=_0x2d64e2||0x1f4;return function(_0x2bd23d){logger['error'](_0x2bd23d[_0xc517('0x26')]);if(_0x2bd23d[_0xc517('0x27')]){delete _0x2bd23d['name'];}_0x1597a3[_0xc517('0x19')](_0x2d64e2)[_0xc517('0x28')](_0x2bd23d);};}exports[_0xc517('0x29')]=function(_0x1b2d9c,_0x261925){var _0x459db8={},_0x2b4096={},_0x56c828={'count':0x0,'rows':[]};var _0x17e318=_['map'](db[_0xc517('0x2a')][_0xc517('0x2b')],function(_0xdf51d7){return{'name':_0xdf51d7[_0xc517('0x2c')],'type':_0xdf51d7[_0xc517('0x2d')][_0xc517('0x2e')]};});_0x2b4096[_0xc517('0x2f')]=_[_0xc517('0x30')](_0x17e318,_0xc517('0x27'));_0x2b4096[_0xc517('0x31')]=_[_0xc517('0x32')](_0x1b2d9c[_0xc517('0x31')]);_0x2b4096[_0xc517('0x33')]=_['intersection'](_0x2b4096[_0xc517('0x2f')],_0x2b4096['query']);_0x459db8[_0xc517('0x34')]=_['intersection'](_0x2b4096[_0xc517('0x2f')],qs[_0xc517('0x35')](_0x1b2d9c[_0xc517('0x31')][_0xc517('0x35')]));_0x459db8['attributes']=_0x459db8[_0xc517('0x34')][_0xc517('0x36')]?_0x459db8[_0xc517('0x34')]:_0x2b4096['model'];if(!_0x1b2d9c[_0xc517('0x31')][_0xc517('0x37')](_0xc517('0x38'))){_0x459db8[_0xc517('0x1d')]=qs['limit'](_0x1b2d9c[_0xc517('0x31')][_0xc517('0x1d')]);_0x459db8[_0xc517('0x1c')]=qs[_0xc517('0x1c')](_0x1b2d9c[_0xc517('0x31')][_0xc517('0x1c')]);}_0x459db8[_0xc517('0x39')]=qs['sort'](_0x1b2d9c['query'][_0xc517('0x3a')]);_0x459db8[_0xc517('0x3b')]=qs['filters'](_[_0xc517('0x3c')](_0x1b2d9c['query'],_0x2b4096[_0xc517('0x33')]),_0x17e318);if(_0x1b2d9c['query'][_0xc517('0x3d')]){_0x459db8[_0xc517('0x3b')]=_[_0xc517('0x3e')](_0x459db8['where'],{'$or':_[_0xc517('0x30')](_0x17e318,function(_0x249b6f){if(_0x249b6f['type']!==_0xc517('0x3f')){var _0x4ef3f2={};_0x4ef3f2[_0x249b6f[_0xc517('0x27')]]={'$like':'%'+_0x1b2d9c['query'][_0xc517('0x3d')]+'%'};return _0x4ef3f2;}})});}_0x459db8=_['merge']({},_0x459db8,_0x1b2d9c[_0xc517('0x40')]);var _0x5a0d84={'where':_0x459db8[_0xc517('0x3b')]};return db[_0xc517('0x2a')][_0xc517('0x1b')](_0x5a0d84)['then'](function(_0xe09f97){_0x56c828[_0xc517('0x1b')]=_0xe09f97;if(_0x1b2d9c[_0xc517('0x31')][_0xc517('0x41')]){_0x459db8['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xc517('0x42')](_0x459db8);})[_0xc517('0x24')](function(_0x152f16){_0x56c828[_0xc517('0x43')]=_0x152f16;return _0x56c828;})[_0xc517('0x24')](respondWithFilteredResult(_0x261925,_0x459db8))['catch'](handleError(_0x261925,null));};exports['show']=function(_0x586f3d,_0x428e66){var _0x24986d={'raw':!![],'where':{'id':_0x586f3d[_0xc517('0x44')]['id']}},_0x1312dc={};_0x1312dc['model']=_[_0xc517('0x32')](db[_0xc517('0x2a')][_0xc517('0x2b')]);_0x1312dc[_0xc517('0x31')]=_[_0xc517('0x32')](_0x586f3d[_0xc517('0x31')]);_0x1312dc[_0xc517('0x33')]=_[_0xc517('0x45')](_0x1312dc[_0xc517('0x2f')],_0x1312dc['query']);_0x24986d[_0xc517('0x34')]=_[_0xc517('0x45')](_0x1312dc[_0xc517('0x2f')],qs[_0xc517('0x35')](_0x586f3d[_0xc517('0x31')][_0xc517('0x35')]));_0x24986d[_0xc517('0x34')]=_0x24986d[_0xc517('0x34')][_0xc517('0x36')]?_0x24986d[_0xc517('0x34')]:_0x1312dc['model'];if(_0x586f3d[_0xc517('0x31')][_0xc517('0x41')]){_0x24986d['include']=[{'all':!![]}];}_0x24986d=_[_0xc517('0x3e')]({},_0x24986d,_0x586f3d[_0xc517('0x40')]);return db[_0xc517('0x2a')][_0xc517('0x46')](_0x24986d)[_0xc517('0x24')](handleEntityNotFound(_0x428e66,null))[_0xc517('0x24')](respondWithResult(_0x428e66,null))[_0xc517('0x47')](handleError(_0x428e66,null));};exports['create']=function(_0x402f15,_0x3947bb){return db['Dynamics365Field'][_0xc517('0x48')](_0x402f15[_0xc517('0x49')],{})[_0xc517('0x24')](respondWithResult(_0x3947bb,0xc9))[_0xc517('0x47')](handleError(_0x3947bb,null));};exports[_0xc517('0x23')]=function(_0x86ddb4,_0x23db1d){if(_0x86ddb4[_0xc517('0x49')]['id']){delete _0x86ddb4[_0xc517('0x49')]['id'];}return db[_0xc517('0x2a')][_0xc517('0x46')]({'where':{'id':_0x86ddb4[_0xc517('0x44')]['id']}})['then'](handleEntityNotFound(_0x23db1d,null))[_0xc517('0x24')](saveUpdates(_0x86ddb4[_0xc517('0x49')],null))[_0xc517('0x24')](respondWithResult(_0x23db1d,null))[_0xc517('0x47')](handleError(_0x23db1d,null));};exports['destroy']=function(_0x30a367,_0x58e9a2){return db['Dynamics365Field'][_0xc517('0x46')]({'where':{'id':_0x30a367['params']['id']}})[_0xc517('0x24')](handleEntityNotFound(_0x58e9a2,null))['then'](removeEntity(_0x58e9a2,null))['catch'](handleError(_0x58e9a2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 3702977..f93e777 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 _0x9cc0=['bluebird','rimraf','./intDynamics365Field.attributes','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','util','../../config/logger','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9cc0,0x129));var _0x09cc=function(_0x952282,_0x51a614){_0x952282=_0x952282-0x0;var _0x613507=_0x9cc0[_0x952282];return _0x613507;};'use strict';var _=require('lodash');var util=require(_0x09cc('0x0'));var logger=require(_0x09cc('0x1'))('api');var moment=require(_0x09cc('0x2'));var BPromise=require(_0x09cc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x09cc('0x4'));var config=require('../../config/environment');var attributes=require(_0x09cc('0x5'));module['exports']=function(_0x3847fa,_0x29df5f){return _0x3847fa['define'](_0x09cc('0x6'),attributes,{'tableName':_0x09cc('0x7'),'paranoid':![],'indexes':[{'name':_0x09cc('0x8'),'fields':['idField',_0x09cc('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa6db=['../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x186f67,_0x4dcb01){var _0x1dd738=function(_0x4250ae){while(--_0x4250ae){_0x186f67['push'](_0x186f67['shift']());}};_0x1dd738(++_0x4dcb01);}(_0xa6db,0x161));var _0xba6d=function(_0x51bb2c,_0xf80d15){_0x51bb2c=_0x51bb2c-0x0;var _0x583cbe=_0xa6db[_0x51bb2c];return _0x583cbe;};'use strict';var _=require(_0xba6d('0x0'));var util=require(_0xba6d('0x1'));var logger=require(_0xba6d('0x2'))(_0xba6d('0x3'));var moment=require(_0xba6d('0x4'));var BPromise=require('bluebird');var rp=require(_0xba6d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba6d('0x6'));var config=require(_0xba6d('0x7'));var attributes=require(_0xba6d('0x8'));module[_0xba6d('0x9')]=function(_0x1e3867,_0x422ad2){return _0x1e3867[_0xba6d('0xa')](_0xba6d('0xb'),attributes,{'tableName':_0xba6d('0xc'),'paranoid':![],'indexes':[{'name':_0xba6d('0xd'),'fields':[_0xba6d('0xe'),'FieldId'],'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 0fd0048..b09929b 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 _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4cf166,_0x4b0f57){var _0x216274=function(_0x75631){while(--_0x75631){_0x4cf166['push'](_0x4cf166['shift']());}};_0x216274(++_0x4b0f57);}(_0x1623,0xab));var _0x3162=function(_0xdf6307,_0x560494){_0xdf6307=_0xdf6307-0x0;var _0x552ef6=_0x1623[_0xdf6307];return _0x552ef6;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file +var _0x6b1b=['info','request\x20sent','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0xd53046,_0x30a03c){var _0x493d79=function(_0x567c09){while(--_0x567c09){_0xd53046['push'](_0xd53046['shift']());}};_0x493d79(++_0x30a03c);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x6b1b[_0x9df060];return _0x338dfe;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var moment=require(_0xb6b1('0x1'));var BPromise=require(_0xb6b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6b1('0x3'));var db=require(_0xb6b1('0x4'))['db'];var utils=require(_0xb6b1('0x5'));var logger=require(_0xb6b1('0x6'))(_0xb6b1('0x7'));var config=require(_0xb6b1('0x8'));var jayson=require(_0xb6b1('0x9'));var client=jayson[_0xb6b1('0xa')][_0xb6b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13334e,_0x1a4cd0,_0x5b440a){return new BPromise(function(_0x2734cc,_0x52aa76){return client['request'](_0x13334e,_0x5b440a)[_0xb6b1('0xc')](function(_0x58027c){logger[_0xb6b1('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x1a4cd0,'request\x20sent');logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x1a4cd0,_0xb6b1('0xe'),JSON[_0xb6b1('0xf')](_0x58027c));if(_0x58027c['error']){if(_0x58027c[_0xb6b1('0x10')]['code']===0x1f4){logger['error'](_0xb6b1('0x11'),_0x1a4cd0,_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);return _0x52aa76(_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);}logger[_0xb6b1('0x10')](_0xb6b1('0x11'),_0x1a4cd0,_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);return _0x2734cc(_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);}else{logger[_0xb6b1('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x1a4cd0,'request\x20sent');_0x2734cc(_0x58027c['result']['message']);}})[_0xb6b1('0x13')](function(_0x12c595){logger[_0xb6b1('0x10')](_0xb6b1('0x11'),_0x1a4cd0,_0x12c595);_0x52aa76(_0x12c595);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a3bb8b8..ab909fa 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 _0x390b=['connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','util','path'];(function(_0x43cec8,_0x319431){var _0x351f73=function(_0xa44cd0){while(--_0xa44cd0){_0x43cec8['push'](_0x43cec8['shift']());}};_0x351f73(++_0x319431);}(_0x390b,0x1e2));var _0xb390=function(_0x5dfc6b,_0x1a3d70){_0x5dfc6b=_0x5dfc6b-0x0;var _0x312c28=_0x390b[_0x5dfc6b];return _0x312c28;};'use strict';var multer=require('multer');var util=require(_0xb390('0x0'));var path=require(_0xb390('0x1'));var timeout=require(_0xb390('0x2'));var express=require('express');var router=express[_0xb390('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb390('0x4'));var config=require(_0xb390('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0xb390('0x6')]('/',auth[_0xb390('0x7')](),controller['index']);router[_0xb390('0x6')]('/:id',auth[_0xb390('0x7')](),controller[_0xb390('0x8')]);router[_0xb390('0x6')](_0xb390('0x9'),auth[_0xb390('0x7')](),controller[_0xb390('0xa')]);router[_0xb390('0x6')](_0xb390('0xb'),auth[_0xb390('0x7')](),controller[_0xb390('0xc')]);router[_0xb390('0xd')]('/',auth[_0xb390('0x7')](),controller[_0xb390('0xe')]);router[_0xb390('0xd')](_0xb390('0x9'),auth[_0xb390('0x7')](),controller[_0xb390('0xf')]);router[_0xb390('0x10')](_0xb390('0x11'),auth[_0xb390('0x7')](),controller[_0xb390('0x12')]);router[_0xb390('0x13')](_0xb390('0x11'),auth[_0xb390('0x7')](),controller[_0xb390('0x14')]);module[_0xb390('0x15')]=router; \ No newline at end of file +var _0xc14d=['express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5ecf2d,_0x1b9156){var _0x28eaed=function(_0x3ddf8e){while(--_0x3ddf8e){_0x5ecf2d['push'](_0x5ecf2d['shift']());}};_0x28eaed(++_0x1b9156);}(_0xc14d,0xef));var _0xdc14=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc14d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xdc14('0x0'));var path=require(_0xdc14('0x1'));var timeout=require(_0xdc14('0x2'));var express=require(_0xdc14('0x3'));var router=express[_0xdc14('0x4')]();var auth=require(_0xdc14('0x5'));var interaction=require(_0xdc14('0x6'));var config=require('../../config/environment');var controller=require(_0xdc14('0x7'));router[_0xdc14('0x8')]('/',auth[_0xdc14('0x9')](),controller['index']);router[_0xdc14('0x8')](_0xdc14('0xa'),auth[_0xdc14('0x9')](),controller[_0xdc14('0xb')]);router[_0xdc14('0x8')](_0xdc14('0xc'),auth[_0xdc14('0x9')](),controller[_0xdc14('0xd')]);router['get'](_0xdc14('0xe'),auth[_0xdc14('0x9')](),controller[_0xdc14('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xdc14('0x10')]);router[_0xdc14('0x11')](_0xdc14('0xa'),auth['isAuthenticated'](),controller[_0xdc14('0x12')]);router[_0xdc14('0x13')](_0xdc14('0xa'),auth[_0xdc14('0x9')](),controller[_0xdc14('0x14')]);module[_0xdc14('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index de6eef1..3955023 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 _0xc128=['remoteUri','sequelize','exports','STRING'];(function(_0x384d87,_0x632ff4){var _0x568d91=function(_0x4b6d01){while(--_0x4b6d01){_0x384d87['push'](_0x384d87['shift']());}};_0x568d91(++_0x632ff4);}(_0xc128,0x1ed));var _0x8c12=function(_0x1a5186,_0x2bdf51){_0x1a5186=_0x1a5186-0x0;var _0x528ae7=_0xc128[_0x1a5186];return _0x528ae7;};'use strict';var Sequelize=require(_0x8c12('0x0'));module[_0x8c12('0x1')]={'name':{'type':Sequelize[_0x8c12('0x2')]},'description':{'type':Sequelize[_0x8c12('0x2')]},'username':{'type':Sequelize[_0x8c12('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x8c12('0x2')]},'remoteUri':{'type':Sequelize[_0x8c12('0x2')],'unique':_0x8c12('0x3')},'serverUrl':{'type':Sequelize[_0x8c12('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2f31=['sequelize','STRING','username'];(function(_0x2df2c4,_0x3b183b){var _0x3244d3=function(_0x26e5b2){while(--_0x26e5b2){_0x2df2c4['push'](_0x2df2c4['shift']());}};_0x3244d3(++_0x3b183b);}(_0x2f31,0x1e0));var _0x12f3=function(_0x4dba49,_0x2deb13){_0x4dba49=_0x4dba49-0x0;var _0x3793c5=_0x2f31[_0x4dba49];return _0x3793c5;};'use strict';var Sequelize=require(_0x12f3('0x0'));module['exports']={'name':{'type':Sequelize[_0x12f3('0x1')]},'description':{'type':Sequelize[_0x12f3('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x12f3('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x12f3('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x12f3('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 1bf9844..495b9d7 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 _0x0c3d=['stack','name','send','index','map','FreshdeskAccount','rawAttributes','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','params','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','substring','lastIndexOf','format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','group','source','ticket_type','company','remove','includes','default','type','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x1c48cd,_0x4d4c8e){var _0x3284ff=function(_0x859d5c){while(--_0x859d5c){_0x1c48cd['push'](_0x1c48cd['shift']());}};_0x3284ff(++_0x4d4c8e);}(_0x0c3d,0x1a9));var _0xd0c3=function(_0xe45c3a,_0x183904){_0xe45c3a=_0xe45c3a-0x0;var _0x1bc5e8=_0x0c3d[_0xe45c3a];return _0x1bc5e8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd0c3('0x0'));var jsonpatch=require(_0xd0c3('0x1'));var rp=require(_0xd0c3('0x2'));var moment=require(_0xd0c3('0x3'));var BPromise=require(_0xd0c3('0x4'));var Mustache=require(_0xd0c3('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd0c3('0x6'));var csv=require(_0xd0c3('0x7'));var ejs=require(_0xd0c3('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd0c3('0x9'));var crypto=require(_0xd0c3('0xa'));var jsforce=require(_0xd0c3('0xb'));var deskjs=require(_0xd0c3('0xc'));var toCsv=require(_0xd0c3('0x7'));var querystring=require('querystring');var Papa=require(_0xd0c3('0xd'));var Redis=require(_0xd0c3('0xe'));var authService=require(_0xd0c3('0xf'));var qs=require(_0xd0c3('0x10'));var as=require(_0xd0c3('0x11'));var hardwareService=require(_0xd0c3('0x12'));var logger=require(_0xd0c3('0x13'))('api');var utils=require(_0xd0c3('0x14'));var config=require(_0xd0c3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd0c3('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xd0c3('0x17')][_0xd0c3('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x20e685,_0x1a1cdd,_0x8cab7,_0x47c30c){return new BPromise(function(_0x48927c,_0x13157e){var _0x41b55d=_0x47c30c||client;return _0x41b55d[_0xd0c3('0x19')](_0x20e685,_0x8cab7)[_0xd0c3('0x1a')](function(_0x157cf3){logger[_0xd0c3('0x1b')]('FreshdeskAccount,\x20%s,\x20%s',_0x1a1cdd,_0xd0c3('0x1c'));logger[_0xd0c3('0x1d')](_0xd0c3('0x1e'),_0x1a1cdd,_0xd0c3('0x1c'),JSON[_0xd0c3('0x1f')](_0x157cf3));if(_0x157cf3[_0xd0c3('0x20')]){if(_0x157cf3[_0xd0c3('0x20')][_0xd0c3('0x21')]===0x1f4){logger[_0xd0c3('0x20')](_0xd0c3('0x22'),_0x1a1cdd,_0x157cf3[_0xd0c3('0x20')][_0xd0c3('0x23')]);return _0x13157e(_0x157cf3[_0xd0c3('0x20')][_0xd0c3('0x23')]);}logger[_0xd0c3('0x20')](_0xd0c3('0x22'),_0x1a1cdd,_0x157cf3[_0xd0c3('0x20')]['message']);return _0x48927c(_0x157cf3['error']['message']);}else{logger[_0xd0c3('0x1b')](_0xd0c3('0x22'),_0x1a1cdd,_0xd0c3('0x1c'));_0x48927c(_0x157cf3[_0xd0c3('0x24')][_0xd0c3('0x23')]);}})[_0xd0c3('0x25')](function(_0xad99e9){logger[_0xd0c3('0x20')](_0xd0c3('0x22'),_0x1a1cdd,_0xad99e9);_0x13157e(_0xad99e9);});});}function respondWithStatusCode(_0x4b7883,_0x44c138){_0x44c138=_0x44c138||0xcc;return function(_0x9dfa2d){if(_0x9dfa2d){return _0x4b7883[_0xd0c3('0x26')](_0x44c138);}return _0x4b7883[_0xd0c3('0x27')](_0x44c138)['end']();};}function respondWithResult(_0x380ed5,_0x7e4ba9){_0x7e4ba9=_0x7e4ba9||0xc8;return function(_0x1a5913){if(_0x1a5913){return _0x380ed5[_0xd0c3('0x27')](_0x7e4ba9)[_0xd0c3('0x28')](_0x1a5913);}};}function respondWithFilteredResult(_0x538a69,_0x343523){return function(_0x3a6f08){if(_0x3a6f08){var _0x7005d5=_0x3a6f08[_0xd0c3('0x29')],_0x31cdbe=_0x343523[_0xd0c3('0x2a')],_0x3f0203=_0x343523[_0xd0c3('0x2a')]+_0x343523[_0xd0c3('0x2b')],_0x529788;if(_0x3f0203>=_0x7005d5){_0x3f0203=_0x7005d5;_0x529788=0xc8;}else{_0x529788=0xce;}_0x538a69[_0xd0c3('0x27')](_0x529788);return _0x538a69[_0xd0c3('0x2c')](_0xd0c3('0x2d'),_0x31cdbe+'-'+_0x3f0203+'/'+_0x7005d5)['json'](_0x3a6f08);}return null;};}function patchUpdates(_0xd5aa79){return function(_0x53e94e){try{jsonpatch[_0xd0c3('0x2e')](_0x53e94e,_0xd5aa79,!![]);}catch(_0x9c6030){return BPromise[_0xd0c3('0x2f')](_0x9c6030);}return _0x53e94e[_0xd0c3('0x30')]();};}function saveUpdates(_0x10fb0d,_0x3a2897){return function(_0x23ad8a){if(_0x23ad8a){return _0x23ad8a[_0xd0c3('0x31')](_0x10fb0d)[_0xd0c3('0x1a')](function(_0x61a389){return _0x61a389;});}return null;};}function removeEntity(_0x27e4dd,_0xbc0074){return function(_0x567489){if(_0x567489){return _0x567489[_0xd0c3('0x32')]()[_0xd0c3('0x1a')](function(){_0x27e4dd[_0xd0c3('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16a55c,_0x29c1bc){return function(_0x48b960){if(!_0x48b960){_0x16a55c[_0xd0c3('0x26')](0x194);}return _0x48b960;};}function handleError(_0x13031d,_0x5c3768){_0x5c3768=_0x5c3768||0x1f4;return function(_0x217f44){logger[_0xd0c3('0x20')](_0x217f44[_0xd0c3('0x33')]);if(_0x217f44[_0xd0c3('0x34')]){delete _0x217f44['name'];}_0x13031d[_0xd0c3('0x27')](_0x5c3768)[_0xd0c3('0x35')](_0x217f44);};}exports[_0xd0c3('0x36')]=function(_0x70dbee,_0x72eff6){var _0x34bf70={},_0x5075d6={},_0x29e33d={'count':0x0,'rows':[]};var _0x1d57ca=_[_0xd0c3('0x37')](db[_0xd0c3('0x38')][_0xd0c3('0x39')],function(_0x558016){return{'name':_0x558016['fieldName'],'type':_0x558016['type']['key']};});_0x5075d6['model']=_[_0xd0c3('0x37')](_0x1d57ca,_0xd0c3('0x34'));_0x5075d6['query']=_[_0xd0c3('0x3a')](_0x70dbee[_0xd0c3('0x3b')]);_0x5075d6[_0xd0c3('0x3c')]=_[_0xd0c3('0x3d')](_0x5075d6[_0xd0c3('0x3e')],_0x5075d6[_0xd0c3('0x3b')]);_0x34bf70[_0xd0c3('0x3f')]=_[_0xd0c3('0x3d')](_0x5075d6['model'],qs['fields'](_0x70dbee[_0xd0c3('0x3b')][_0xd0c3('0x40')]));_0x34bf70[_0xd0c3('0x3f')]=_0x34bf70[_0xd0c3('0x3f')][_0xd0c3('0x41')]?_0x34bf70[_0xd0c3('0x3f')]:_0x5075d6[_0xd0c3('0x3e')];if(!_0x70dbee[_0xd0c3('0x3b')][_0xd0c3('0x42')](_0xd0c3('0x43'))){_0x34bf70['limit']=qs[_0xd0c3('0x2b')](_0x70dbee['query'][_0xd0c3('0x2b')]);_0x34bf70['offset']=qs['offset'](_0x70dbee[_0xd0c3('0x3b')]['offset']);}_0x34bf70[_0xd0c3('0x44')]=qs[_0xd0c3('0x45')](_0x70dbee[_0xd0c3('0x3b')][_0xd0c3('0x45')]);_0x34bf70[_0xd0c3('0x46')]=qs[_0xd0c3('0x3c')](_[_0xd0c3('0x47')](_0x70dbee['query'],_0x5075d6['filters']),_0x1d57ca);if(_0x70dbee['query'][_0xd0c3('0x48')]){_0x34bf70[_0xd0c3('0x46')]=_[_0xd0c3('0x49')](_0x34bf70[_0xd0c3('0x46')],{'$or':_[_0xd0c3('0x37')](_0x1d57ca,function(_0x2159a8){if(_0x2159a8['type']!==_0xd0c3('0x4a')){var _0x1e8e66={};_0x1e8e66[_0x2159a8[_0xd0c3('0x34')]]={'$like':'%'+_0x70dbee[_0xd0c3('0x3b')][_0xd0c3('0x48')]+'%'};return _0x1e8e66;}})});}_0x34bf70=_[_0xd0c3('0x49')]({},_0x34bf70,_0x70dbee[_0xd0c3('0x4b')]);var _0x3daf65={'where':_0x34bf70['where']};return db[_0xd0c3('0x38')]['count'](_0x3daf65)['then'](function(_0x30b5f0){_0x29e33d[_0xd0c3('0x29')]=_0x30b5f0;if(_0x70dbee['query'][_0xd0c3('0x4c')]){_0x34bf70[_0xd0c3('0x4d')]=[{'all':!![]}];}return db[_0xd0c3('0x38')]['findAll'](_0x34bf70);})[_0xd0c3('0x1a')](function(_0x2a584b){_0x29e33d['rows']=_0x2a584b;return _0x29e33d;})[_0xd0c3('0x1a')](respondWithFilteredResult(_0x72eff6,_0x34bf70))['catch'](handleError(_0x72eff6,null));};exports['show']=function(_0x2b2ee7,_0x3798e6){var _0x1a136d={'raw':![],'where':{'id':_0x2b2ee7[_0xd0c3('0x4e')]['id']}},_0x3f59cd={};_0x3f59cd[_0xd0c3('0x3e')]=_[_0xd0c3('0x3a')](db[_0xd0c3('0x38')][_0xd0c3('0x39')]);_0x3f59cd['query']=_[_0xd0c3('0x3a')](_0x2b2ee7[_0xd0c3('0x3b')]);_0x3f59cd[_0xd0c3('0x3c')]=_['intersection'](_0x3f59cd[_0xd0c3('0x3e')],_0x3f59cd[_0xd0c3('0x3b')]);_0x1a136d[_0xd0c3('0x3f')]=_[_0xd0c3('0x3d')](_0x3f59cd['model'],qs[_0xd0c3('0x40')](_0x2b2ee7[_0xd0c3('0x3b')][_0xd0c3('0x40')]));_0x1a136d[_0xd0c3('0x3f')]=_0x1a136d[_0xd0c3('0x3f')][_0xd0c3('0x41')]?_0x1a136d[_0xd0c3('0x3f')]:_0x3f59cd[_0xd0c3('0x3e')];if(_0x2b2ee7['query']['includeAll']){_0x1a136d[_0xd0c3('0x4d')]=[{'all':!![]}];}_0x1a136d=_[_0xd0c3('0x49')]({},_0x1a136d,_0x2b2ee7[_0xd0c3('0x4b')]);return db['FreshdeskAccount'][_0xd0c3('0x4f')](_0x1a136d)[_0xd0c3('0x1a')](handleEntityNotFound(_0x3798e6,null))[_0xd0c3('0x1a')](respondWithResult(_0x3798e6,null))['catch'](handleError(_0x3798e6,null));};exports[_0xd0c3('0x50')]=function(_0x4cf478,_0x1eec39){return db[_0xd0c3('0x38')][_0xd0c3('0x50')](_0x4cf478[_0xd0c3('0x51')],{})[_0xd0c3('0x1a')](respondWithResult(_0x1eec39,0xc9))['catch'](handleError(_0x1eec39,null));};exports[_0xd0c3('0x31')]=function(_0x48ca1a,_0x39b08b){if(_0x48ca1a[_0xd0c3('0x51')]['id']){delete _0x48ca1a['body']['id'];}return db[_0xd0c3('0x38')][_0xd0c3('0x4f')]({'where':{'id':_0x48ca1a['params']['id']}})[_0xd0c3('0x1a')](handleEntityNotFound(_0x39b08b,null))['then'](saveUpdates(_0x48ca1a[_0xd0c3('0x51')],null))[_0xd0c3('0x1a')](respondWithResult(_0x39b08b,null))[_0xd0c3('0x25')](handleError(_0x39b08b,null));};exports['destroy']=function(_0x28d1e6,_0x5bb32b){return db[_0xd0c3('0x38')][_0xd0c3('0x4f')]({'where':{'id':_0x28d1e6[_0xd0c3('0x4e')]['id']}})[_0xd0c3('0x1a')](handleEntityNotFound(_0x5bb32b,null))[_0xd0c3('0x1a')](removeEntity(_0x5bb32b,null))['catch'](handleError(_0x5bb32b,null));};exports[_0xd0c3('0x52')]=function(_0x3f40c8,_0x16fda5,_0x5d2e28){var _0x4d1225={};var _0x1c0ebc={};var _0x4e4b2c;var _0x1315a9;return db[_0xd0c3('0x38')][_0xd0c3('0x53')]({'where':{'id':_0x3f40c8[_0xd0c3('0x4e')]['id']}})[_0xd0c3('0x1a')](handleEntityNotFound(_0x16fda5,null))[_0xd0c3('0x1a')](function(_0xaffb55){if(_0xaffb55){_0x4e4b2c=_0xaffb55;_0x1c0ebc['model']=_[_0xd0c3('0x3a')](db[_0xd0c3('0x54')][_0xd0c3('0x39')]);_0x1c0ebc[_0xd0c3('0x3b')]=_['keys'](_0x3f40c8[_0xd0c3('0x3b')]);_0x1c0ebc['filters']=_[_0xd0c3('0x3d')](_0x1c0ebc[_0xd0c3('0x3e')],_0x1c0ebc['query']);_0x4d1225['attributes']=_[_0xd0c3('0x3d')](_0x1c0ebc[_0xd0c3('0x3e')],qs[_0xd0c3('0x40')](_0x3f40c8['query'][_0xd0c3('0x40')]));_0x4d1225[_0xd0c3('0x3f')]=_0x4d1225[_0xd0c3('0x3f')][_0xd0c3('0x41')]?_0x4d1225[_0xd0c3('0x3f')]:_0x1c0ebc[_0xd0c3('0x3e')];_0x4d1225[_0xd0c3('0x44')]=qs[_0xd0c3('0x45')](_0x3f40c8[_0xd0c3('0x3b')][_0xd0c3('0x45')]);_0x4d1225['where']=qs[_0xd0c3('0x3c')](_[_0xd0c3('0x47')](_0x3f40c8[_0xd0c3('0x3b')],_0x1c0ebc[_0xd0c3('0x3c')]));if(_0x3f40c8[_0xd0c3('0x3b')]['filter']){_0x4d1225[_0xd0c3('0x46')]=_[_0xd0c3('0x49')](_0x4d1225[_0xd0c3('0x46')],{'$or':_['map'](_0x4d1225[_0xd0c3('0x3f')],function(_0x21779e){var _0x457eb0={};_0x457eb0[_0x21779e]={'$like':'%'+_0x3f40c8[_0xd0c3('0x3b')][_0xd0c3('0x48')]+'%'};return _0x457eb0;})});}_0x4d1225=_['merge']({},_0x4d1225,_0x3f40c8[_0xd0c3('0x4b')]);return _0x4e4b2c[_0xd0c3('0x52')](_0x4d1225);}})[_0xd0c3('0x1a')](function(_0x19c9eb){if(_0x19c9eb){_0x1315a9=_0x19c9eb[_0xd0c3('0x41')];if(!_0x3f40c8[_0xd0c3('0x3b')][_0xd0c3('0x42')](_0xd0c3('0x43'))){_0x4d1225[_0xd0c3('0x2b')]=qs[_0xd0c3('0x2b')](_0x3f40c8['query'][_0xd0c3('0x2b')]);_0x4d1225['offset']=qs[_0xd0c3('0x2a')](_0x3f40c8[_0xd0c3('0x3b')][_0xd0c3('0x2a')]);}return _0x4e4b2c['getConfigurations'](_0x4d1225);}})['then'](function(_0x2224d0){if(_0x2224d0){return _0x2224d0?{'count':_0x1315a9,'rows':_0x2224d0}:null;}})[_0xd0c3('0x1a')](respondWithResult(_0x16fda5,null))[_0xd0c3('0x25')](handleError(_0x16fda5,null));};exports['addConfiguration']=function(_0x3df75c,_0x41f416,_0x5df99d){if(_0x3df75c[_0xd0c3('0x51')]['id']){delete _0x3df75c[_0xd0c3('0x51')]['id'];}return db[_0xd0c3('0x38')][_0xd0c3('0x53')]({'where':{'id':_0x3df75c[_0xd0c3('0x4e')]['id']}})[_0xd0c3('0x1a')](handleEntityNotFound(_0x41f416,null))[_0xd0c3('0x1a')](function(_0x437f14){if(_0x437f14){_0x3df75c[_0xd0c3('0x51')][_0xd0c3('0x55')]=_0x437f14['id'];_0x3df75c['body'][_0xd0c3('0x56')]=integrations[_0xd0c3('0x57')](_0x3df75c[_0xd0c3('0x51')][_0xd0c3('0x58')],_0x3df75c[_0xd0c3('0x51')]['type']);_0x3df75c['body'][_0xd0c3('0x59')]=integrations['getDescriptions'](_0x3df75c[_0xd0c3('0x51')][_0xd0c3('0x58')],_0x3df75c[_0xd0c3('0x51')]['type']);return db[_0xd0c3('0x54')][_0xd0c3('0x50')](_0x3df75c[_0xd0c3('0x51')],{'include':[{'model':db[_0xd0c3('0x5a')],'as':_0xd0c3('0x56')},{'model':db[_0xd0c3('0x5a')],'as':_0xd0c3('0x59')}]});}return null;})[_0xd0c3('0x1a')](respondWithResult(_0x41f416,null))[_0xd0c3('0x25')](handleError(_0x41f416,null));};exports[_0xd0c3('0x5b')]=function(_0x37d749,_0x23dd13,_0x31e50b){var _0x7cdf36='';return db[_0xd0c3('0x38')]['findOne']({'where':{'id':_0x37d749[_0xd0c3('0x4e')]['id']},'attributes':['id','remoteUri','apiKey']})[_0xd0c3('0x1a')](handleEntityNotFound(_0x23dd13,null))[_0xd0c3('0x1a')](function(_0x57432d){if(_0x57432d){_0x7cdf36=_0x57432d[_0xd0c3('0x5c')];var _0x1ab3f5=_0x7cdf36['slice'](-0x1);if(_0x1ab3f5==='/'){_0x7cdf36=_0x7cdf36[_0xd0c3('0x5d')](0x0,_0x7cdf36[_0xd0c3('0x5e')](_0x1ab3f5));}return rp({'method':'GET','uri':util[_0xd0c3('0x5f')](_0xd0c3('0x60'),_0x7cdf36,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0xd0c3('0x61'),new Buffer(util[_0xd0c3('0x5f')](_0xd0c3('0x62'),_0x57432d['apiKey']))[_0xd0c3('0x63')](_0xd0c3('0x64')))},'json':!![]});}})['then'](function(_0x58a819){if(_0x58a819){var _0x59d44c=[_0xd0c3('0x65'),_0xd0c3('0x66'),'agent',_0xd0c3('0x67'),_0xd0c3('0x27'),_0xd0c3('0x68'),_0xd0c3('0x69'),_0xd0c3('0x6a'),_0xd0c3('0x6b'),_0xd0c3('0x69'),_0xd0c3('0x6c')];_[_0xd0c3('0x6d')](_0x58a819,function(_0x1c6cf1){return _0x59d44c[_0xd0c3('0x6e')](_0x1c6cf1['name'])||!_0x1c6cf1[_0xd0c3('0x6f')]&&_0x1c6cf1[_0xd0c3('0x70')]!=='custom_text'&&_0x1c6cf1[_0xd0c3('0x70')]!==_0xd0c3('0x71');});return{'count':_0x58a819[_0xd0c3('0x41')],'rows':_[_0xd0c3('0x37')](_0x58a819,function(_0x462122){return{'id':_0x462122[_0xd0c3('0x34')],'name':_0x462122[_0xd0c3('0x72')],'custom':!_0x462122['default'],'options':_0x462122[_0xd0c3('0x73')]?_['map'](_0x462122[_0xd0c3('0x73')],function(_0x2e951d){return{'name':_[_0xd0c3('0x74')](_0x2e951d),'value':_0x2e951d};}):[]};})};}})['then'](respondWithResult(_0x23dd13,null))[_0xd0c3('0x25')](function(_0x44daa4){var _0x5a5c60=_0x37d749[_0xd0c3('0x3b')]['test']?0x1f4:_0x44daa4['statusCode']||0x1f4;logger[_0xd0c3('0x20')](_0xd0c3('0x75'),_0xd0c3('0x5b'),_0x5a5c60,JSON[_0xd0c3('0x1f')](_0x44daa4));delete _0x44daa4[_0xd0c3('0x34')];if(_0x5a5c60===0x191){_0x5a5c60=0x190;}_0x23dd13['status'](_0x5a5c60)[_0xd0c3('0x35')](_0x37d749[_0xd0c3('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x44daa4[_0xd0c3('0x76')]}:_0x44daa4);});}; \ No newline at end of file +var _0xdb5d=['description','priority','source','group','company','remove','default','custom_dropdown','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','catch','status','json','offset','limit','set','Content-Range','apply','save','update','then','end','stack','name','send','index','map','FreshdeskAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','filters','merge','where','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','keys','length','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','apiKey','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','subject','agent'];(function(_0x1efc51,_0x5c0937){var _0xd18a7c=function(_0x2560d5){while(--_0x2560d5){_0x1efc51['push'](_0x1efc51['shift']());}};_0xd18a7c(++_0x5c0937);}(_0xdb5d,0x1f1));var _0xddb5=function(_0x1d1329,_0x7878b1){_0x1d1329=_0x1d1329-0x0;var _0x4bc602=_0xdb5d[_0x1d1329];return _0x4bc602;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xddb5('0x0'));var zipdir=require(_0xddb5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddb5('0x2'));var moment=require(_0xddb5('0x3'));var BPromise=require(_0xddb5('0x4'));var Mustache=require(_0xddb5('0x5'));var util=require('util');var path=require(_0xddb5('0x6'));var sox=require(_0xddb5('0x7'));var csv=require(_0xddb5('0x8'));var ejs=require(_0xddb5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xddb5('0xa'));var crypto=require(_0xddb5('0xb'));var jsforce=require(_0xddb5('0xc'));var deskjs=require(_0xddb5('0xd'));var toCsv=require(_0xddb5('0x8'));var querystring=require(_0xddb5('0xe'));var Papa=require('papaparse');var Redis=require(_0xddb5('0xf'));var authService=require(_0xddb5('0x10'));var qs=require(_0xddb5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddb5('0x12'));var logger=require(_0xddb5('0x13'))(_0xddb5('0x14'));var utils=require(_0xddb5('0x15'));var config=require(_0xddb5('0x16'));var licenseUtil=require(_0xddb5('0x17'));var db=require(_0xddb5('0x18'))['db'];var integrations=require(_0xddb5('0x19'));var jayson=require(_0xddb5('0x1a'));var client=jayson[_0xddb5('0x1b')][_0xddb5('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2ef456,_0x92840d,_0xbc9cd4,_0x32bea2){return new BPromise(function(_0x41d2c9,_0x225bbc){var _0x331d59=_0x32bea2||client;return _0x331d59[_0xddb5('0x1d')](_0x2ef456,_0xbc9cd4)['then'](function(_0x35defe){logger[_0xddb5('0x1e')]('FreshdeskAccount,\x20%s,\x20%s',_0x92840d,_0xddb5('0x1f'));logger['debug'](_0xddb5('0x20'),_0x92840d,_0xddb5('0x1f'),JSON[_0xddb5('0x21')](_0x35defe));if(_0x35defe[_0xddb5('0x22')]){if(_0x35defe[_0xddb5('0x22')]['code']===0x1f4){logger[_0xddb5('0x22')](_0xddb5('0x23'),_0x92840d,_0x35defe[_0xddb5('0x22')][_0xddb5('0x24')]);return _0x225bbc(_0x35defe[_0xddb5('0x22')]['message']);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x92840d,_0x35defe['error'][_0xddb5('0x24')]);return _0x41d2c9(_0x35defe[_0xddb5('0x22')][_0xddb5('0x24')]);}else{logger[_0xddb5('0x1e')](_0xddb5('0x23'),_0x92840d,_0xddb5('0x1f'));_0x41d2c9(_0x35defe['result'][_0xddb5('0x24')]);}})[_0xddb5('0x25')](function(_0x466310){logger[_0xddb5('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0x92840d,_0x466310);_0x225bbc(_0x466310);});});}function respondWithStatusCode(_0x3b051d,_0xd91f25){_0xd91f25=_0xd91f25||0xcc;return function(_0x2a4c4e){if(_0x2a4c4e){return _0x3b051d['sendStatus'](_0xd91f25);}return _0x3b051d['status'](_0xd91f25)['end']();};}function respondWithResult(_0x2dba16,_0x3450c7){_0x3450c7=_0x3450c7||0xc8;return function(_0x43617f){if(_0x43617f){return _0x2dba16[_0xddb5('0x26')](_0x3450c7)[_0xddb5('0x27')](_0x43617f);}};}function respondWithFilteredResult(_0x46c67d,_0x5d48dc){return function(_0x5f04dc){if(_0x5f04dc){var _0x59baf7=_0x5f04dc['count'],_0x1e1a3c=_0x5d48dc[_0xddb5('0x28')],_0x2c61c5=_0x5d48dc[_0xddb5('0x28')]+_0x5d48dc[_0xddb5('0x29')],_0x4beba7;if(_0x2c61c5>=_0x59baf7){_0x2c61c5=_0x59baf7;_0x4beba7=0xc8;}else{_0x4beba7=0xce;}_0x46c67d[_0xddb5('0x26')](_0x4beba7);return _0x46c67d[_0xddb5('0x2a')](_0xddb5('0x2b'),_0x1e1a3c+'-'+_0x2c61c5+'/'+_0x59baf7)['json'](_0x5f04dc);}return null;};}function patchUpdates(_0x1bdcda){return function(_0x5157b9){try{jsonpatch[_0xddb5('0x2c')](_0x5157b9,_0x1bdcda,!![]);}catch(_0x17bd2b){return BPromise['reject'](_0x17bd2b);}return _0x5157b9[_0xddb5('0x2d')]();};}function saveUpdates(_0x4fe9b9,_0x34aef5){return function(_0x22b243){if(_0x22b243){return _0x22b243[_0xddb5('0x2e')](_0x4fe9b9)['then'](function(_0x33a980){return _0x33a980;});}return null;};}function removeEntity(_0x40df02,_0x35c5d1){return function(_0x4192cf){if(_0x4192cf){return _0x4192cf['destroy']()[_0xddb5('0x2f')](function(){_0x40df02[_0xddb5('0x26')](0xcc)[_0xddb5('0x30')]();});}};}function handleEntityNotFound(_0x2e143c,_0x8f2e31){return function(_0x227c07){if(!_0x227c07){_0x2e143c['sendStatus'](0x194);}return _0x227c07;};}function handleError(_0x29d1a4,_0x671457){_0x671457=_0x671457||0x1f4;return function(_0x486924){logger[_0xddb5('0x22')](_0x486924[_0xddb5('0x31')]);if(_0x486924[_0xddb5('0x32')]){delete _0x486924[_0xddb5('0x32')];}_0x29d1a4['status'](_0x671457)[_0xddb5('0x33')](_0x486924);};}exports[_0xddb5('0x34')]=function(_0x5c4a33,_0x574280){var _0x22b913={},_0x5f0e60={},_0x26aa8a={'count':0x0,'rows':[]};var _0x3c4465=_[_0xddb5('0x35')](db[_0xddb5('0x36')][_0xddb5('0x37')],function(_0x587321){return{'name':_0x587321['fieldName'],'type':_0x587321[_0xddb5('0x38')][_0xddb5('0x39')]};});_0x5f0e60[_0xddb5('0x3a')]=_[_0xddb5('0x35')](_0x3c4465,'name');_0x5f0e60[_0xddb5('0x3b')]=_['keys'](_0x5c4a33[_0xddb5('0x3b')]);_0x5f0e60['filters']=_[_0xddb5('0x3c')](_0x5f0e60[_0xddb5('0x3a')],_0x5f0e60[_0xddb5('0x3b')]);_0x22b913[_0xddb5('0x3d')]=_[_0xddb5('0x3c')](_0x5f0e60[_0xddb5('0x3a')],qs['fields'](_0x5c4a33[_0xddb5('0x3b')][_0xddb5('0x3e')]));_0x22b913['attributes']=_0x22b913['attributes']['length']?_0x22b913[_0xddb5('0x3d')]:_0x5f0e60[_0xddb5('0x3a')];if(!_0x5c4a33[_0xddb5('0x3b')]['hasOwnProperty'](_0xddb5('0x3f'))){_0x22b913[_0xddb5('0x29')]=qs[_0xddb5('0x29')](_0x5c4a33[_0xddb5('0x3b')][_0xddb5('0x29')]);_0x22b913[_0xddb5('0x28')]=qs[_0xddb5('0x28')](_0x5c4a33[_0xddb5('0x3b')][_0xddb5('0x28')]);}_0x22b913[_0xddb5('0x40')]=qs[_0xddb5('0x41')](_0x5c4a33[_0xddb5('0x3b')][_0xddb5('0x41')]);_0x22b913['where']=qs[_0xddb5('0x42')](_['pick'](_0x5c4a33[_0xddb5('0x3b')],_0x5f0e60[_0xddb5('0x42')]),_0x3c4465);if(_0x5c4a33['query']['filter']){_0x22b913['where']=_[_0xddb5('0x43')](_0x22b913[_0xddb5('0x44')],{'$or':_[_0xddb5('0x35')](_0x3c4465,function(_0x1240ef){if(_0x1240ef[_0xddb5('0x38')]!==_0xddb5('0x45')){var _0x16e3cf={};_0x16e3cf[_0x1240ef[_0xddb5('0x32')]]={'$like':'%'+_0x5c4a33[_0xddb5('0x3b')][_0xddb5('0x46')]+'%'};return _0x16e3cf;}})});}_0x22b913=_['merge']({},_0x22b913,_0x5c4a33[_0xddb5('0x47')]);var _0x959fad={'where':_0x22b913[_0xddb5('0x44')]};return db[_0xddb5('0x36')][_0xddb5('0x48')](_0x959fad)[_0xddb5('0x2f')](function(_0x1c6010){_0x26aa8a['count']=_0x1c6010;if(_0x5c4a33[_0xddb5('0x3b')][_0xddb5('0x49')]){_0x22b913[_0xddb5('0x4a')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xddb5('0x4b')](_0x22b913);})[_0xddb5('0x2f')](function(_0x4df049){_0x26aa8a[_0xddb5('0x4c')]=_0x4df049;return _0x26aa8a;})[_0xddb5('0x2f')](respondWithFilteredResult(_0x574280,_0x22b913))[_0xddb5('0x25')](handleError(_0x574280,null));};exports['show']=function(_0x497abb,_0x1c86cb){var _0x542ceb={'raw':![],'where':{'id':_0x497abb[_0xddb5('0x4d')]['id']}},_0x3f2d79={};_0x3f2d79[_0xddb5('0x3a')]=_[_0xddb5('0x4e')](db[_0xddb5('0x36')]['rawAttributes']);_0x3f2d79[_0xddb5('0x3b')]=_[_0xddb5('0x4e')](_0x497abb[_0xddb5('0x3b')]);_0x3f2d79['filters']=_[_0xddb5('0x3c')](_0x3f2d79['model'],_0x3f2d79[_0xddb5('0x3b')]);_0x542ceb[_0xddb5('0x3d')]=_['intersection'](_0x3f2d79[_0xddb5('0x3a')],qs[_0xddb5('0x3e')](_0x497abb[_0xddb5('0x3b')][_0xddb5('0x3e')]));_0x542ceb[_0xddb5('0x3d')]=_0x542ceb[_0xddb5('0x3d')][_0xddb5('0x4f')]?_0x542ceb[_0xddb5('0x3d')]:_0x3f2d79['model'];if(_0x497abb[_0xddb5('0x3b')][_0xddb5('0x49')]){_0x542ceb[_0xddb5('0x4a')]=[{'all':!![]}];}_0x542ceb=_[_0xddb5('0x43')]({},_0x542ceb,_0x497abb[_0xddb5('0x47')]);return db[_0xddb5('0x36')][_0xddb5('0x50')](_0x542ceb)[_0xddb5('0x2f')](handleEntityNotFound(_0x1c86cb,null))['then'](respondWithResult(_0x1c86cb,null))[_0xddb5('0x25')](handleError(_0x1c86cb,null));};exports[_0xddb5('0x51')]=function(_0x31310a,_0x2f58b){return db[_0xddb5('0x36')][_0xddb5('0x51')](_0x31310a[_0xddb5('0x52')],{})[_0xddb5('0x2f')](respondWithResult(_0x2f58b,0xc9))['catch'](handleError(_0x2f58b,null));};exports[_0xddb5('0x2e')]=function(_0x471ba3,_0x431db2){if(_0x471ba3[_0xddb5('0x52')]['id']){delete _0x471ba3['body']['id'];}return db['FreshdeskAccount'][_0xddb5('0x50')]({'where':{'id':_0x471ba3['params']['id']}})[_0xddb5('0x2f')](handleEntityNotFound(_0x431db2,null))[_0xddb5('0x2f')](saveUpdates(_0x471ba3[_0xddb5('0x52')],null))['then'](respondWithResult(_0x431db2,null))[_0xddb5('0x25')](handleError(_0x431db2,null));};exports[_0xddb5('0x53')]=function(_0x453ca7,_0x37b091){return db[_0xddb5('0x36')][_0xddb5('0x50')]({'where':{'id':_0x453ca7[_0xddb5('0x4d')]['id']}})[_0xddb5('0x2f')](handleEntityNotFound(_0x37b091,null))[_0xddb5('0x2f')](removeEntity(_0x37b091,null))[_0xddb5('0x25')](handleError(_0x37b091,null));};exports[_0xddb5('0x54')]=function(_0x24ec08,_0xf65e3c,_0x34fca4){var _0x27d84d={};var _0x4014ac={};var _0x537433;var _0x5394b5;return db['FreshdeskAccount'][_0xddb5('0x55')]({'where':{'id':_0x24ec08[_0xddb5('0x4d')]['id']}})[_0xddb5('0x2f')](handleEntityNotFound(_0xf65e3c,null))[_0xddb5('0x2f')](function(_0x157374){if(_0x157374){_0x537433=_0x157374;_0x4014ac[_0xddb5('0x3a')]=_[_0xddb5('0x4e')](db[_0xddb5('0x56')][_0xddb5('0x37')]);_0x4014ac['query']=_[_0xddb5('0x4e')](_0x24ec08[_0xddb5('0x3b')]);_0x4014ac[_0xddb5('0x42')]=_['intersection'](_0x4014ac[_0xddb5('0x3a')],_0x4014ac[_0xddb5('0x3b')]);_0x27d84d[_0xddb5('0x3d')]=_[_0xddb5('0x3c')](_0x4014ac[_0xddb5('0x3a')],qs[_0xddb5('0x3e')](_0x24ec08['query']['fields']));_0x27d84d[_0xddb5('0x3d')]=_0x27d84d['attributes'][_0xddb5('0x4f')]?_0x27d84d['attributes']:_0x4014ac['model'];_0x27d84d[_0xddb5('0x40')]=qs['sort'](_0x24ec08[_0xddb5('0x3b')][_0xddb5('0x41')]);_0x27d84d[_0xddb5('0x44')]=qs['filters'](_['pick'](_0x24ec08['query'],_0x4014ac['filters']));if(_0x24ec08[_0xddb5('0x3b')]['filter']){_0x27d84d[_0xddb5('0x44')]=_[_0xddb5('0x43')](_0x27d84d[_0xddb5('0x44')],{'$or':_[_0xddb5('0x35')](_0x27d84d['attributes'],function(_0x389a58){var _0x37530f={};_0x37530f[_0x389a58]={'$like':'%'+_0x24ec08['query'][_0xddb5('0x46')]+'%'};return _0x37530f;})});}_0x27d84d=_[_0xddb5('0x43')]({},_0x27d84d,_0x24ec08[_0xddb5('0x47')]);return _0x537433[_0xddb5('0x54')](_0x27d84d);}})[_0xddb5('0x2f')](function(_0x737cb6){if(_0x737cb6){_0x5394b5=_0x737cb6[_0xddb5('0x4f')];if(!_0x24ec08[_0xddb5('0x3b')][_0xddb5('0x57')](_0xddb5('0x3f'))){_0x27d84d['limit']=qs[_0xddb5('0x29')](_0x24ec08[_0xddb5('0x3b')][_0xddb5('0x29')]);_0x27d84d[_0xddb5('0x28')]=qs[_0xddb5('0x28')](_0x24ec08['query']['offset']);}return _0x537433['getConfigurations'](_0x27d84d);}})[_0xddb5('0x2f')](function(_0x423450){if(_0x423450){return _0x423450?{'count':_0x5394b5,'rows':_0x423450}:null;}})[_0xddb5('0x2f')](respondWithResult(_0xf65e3c,null))[_0xddb5('0x25')](handleError(_0xf65e3c,null));};exports[_0xddb5('0x58')]=function(_0x238888,_0x4c0fe1,_0xa0c5b1){if(_0x238888[_0xddb5('0x52')]['id']){delete _0x238888['body']['id'];}return db[_0xddb5('0x36')][_0xddb5('0x55')]({'where':{'id':_0x238888[_0xddb5('0x4d')]['id']}})[_0xddb5('0x2f')](handleEntityNotFound(_0x4c0fe1,null))['then'](function(_0xefcbdf){if(_0xefcbdf){_0x238888[_0xddb5('0x52')][_0xddb5('0x59')]=_0xefcbdf['id'];_0x238888[_0xddb5('0x52')][_0xddb5('0x5a')]=integrations[_0xddb5('0x5b')](_0x238888[_0xddb5('0x52')]['channel'],_0x238888[_0xddb5('0x52')][_0xddb5('0x38')]);_0x238888[_0xddb5('0x52')][_0xddb5('0x5c')]=integrations[_0xddb5('0x5d')](_0x238888[_0xddb5('0x52')][_0xddb5('0x5e')],_0x238888[_0xddb5('0x52')][_0xddb5('0x38')]);return db[_0xddb5('0x56')]['create'](_0x238888['body'],{'include':[{'model':db[_0xddb5('0x5f')],'as':_0xddb5('0x5a')},{'model':db[_0xddb5('0x5f')],'as':'Descriptions'}]});}return null;})[_0xddb5('0x2f')](respondWithResult(_0x4c0fe1,null))[_0xddb5('0x25')](handleError(_0x4c0fe1,null));};exports[_0xddb5('0x60')]=function(_0x57f9ec,_0x7966d5,_0x42b003){var _0x9b53ac='';return db['FreshdeskAccount'][_0xddb5('0x55')]({'where':{'id':_0x57f9ec[_0xddb5('0x4d')]['id']},'attributes':['id','remoteUri',_0xddb5('0x61')]})[_0xddb5('0x2f')](handleEntityNotFound(_0x7966d5,null))[_0xddb5('0x2f')](function(_0xe5d259){if(_0xe5d259){_0x9b53ac=_0xe5d259['remoteUri'];var _0x3ef36d=_0x9b53ac['slice'](-0x1);if(_0x3ef36d==='/'){_0x9b53ac=_0x9b53ac[_0xddb5('0x62')](0x0,_0x9b53ac[_0xddb5('0x63')](_0x3ef36d));}return rp({'method':_0xddb5('0x64'),'uri':util[_0xddb5('0x65')](_0xddb5('0x66'),_0x9b53ac,_0xddb5('0x67')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xddb5('0x65')](_0xddb5('0x68'),_0xe5d259['apiKey']))[_0xddb5('0x69')]('base64'))},'json':!![]});}})[_0xddb5('0x2f')](function(_0x3f8f5e){if(_0x3f8f5e){var _0x49b4b2=['requester',_0xddb5('0x6a'),_0xddb5('0x6b'),_0xddb5('0x6c'),_0xddb5('0x26'),_0xddb5('0x6d'),'group',_0xddb5('0x6e'),'ticket_type',_0xddb5('0x6f'),_0xddb5('0x70')];_[_0xddb5('0x71')](_0x3f8f5e,function(_0x26e3c9){return _0x49b4b2['includes'](_0x26e3c9[_0xddb5('0x32')])||!_0x26e3c9[_0xddb5('0x72')]&&_0x26e3c9[_0xddb5('0x38')]!=='custom_text'&&_0x26e3c9[_0xddb5('0x38')]!==_0xddb5('0x73');});return{'count':_0x3f8f5e['length'],'rows':_[_0xddb5('0x35')](_0x3f8f5e,function(_0x151ae7){return{'id':_0x151ae7[_0xddb5('0x32')],'name':_0x151ae7[_0xddb5('0x74')],'custom':!_0x151ae7[_0xddb5('0x72')],'options':_0x151ae7['choices']?_[_0xddb5('0x35')](_0x151ae7['choices'],function(_0x77f9c1){return{'name':_['capitalize'](_0x77f9c1),'value':_0x77f9c1};}):[]};})};}})['then'](respondWithResult(_0x7966d5,null))[_0xddb5('0x25')](function(_0x5b3aeb){var _0x5b9a1e=_0x57f9ec[_0xddb5('0x3b')][_0xddb5('0x75')]?0x1f4:_0x5b3aeb[_0xddb5('0x76')]||0x1f4;logger['error'](_0xddb5('0x77'),'getFields',_0x5b9a1e,JSON[_0xddb5('0x21')](_0x5b3aeb));delete _0x5b3aeb[_0xddb5('0x32')];if(_0x5b9a1e===0x191){_0x5b9a1e=0x190;}_0x7966d5['status'](_0x5b9a1e)['send'](_0x57f9ec['query'][_0xddb5('0x75')]?{'message':_0xddb5('0x78'),'statusCode':_0x5b3aeb[_0xddb5('0x76')]}:_0x5b3aeb);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index dc69207..9e00090 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 _0x2a93=['path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a93,0x1c9));var _0x32a9=function(_0x15e1f8,_0x22e6ab){_0x15e1f8=_0x15e1f8-0x0;var _0x5d4054=_0x2a93[_0x15e1f8];return _0x5d4054;};'use strict';var _=require(_0x32a9('0x0'));var util=require(_0x32a9('0x1'));var logger=require(_0x32a9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x32a9('0x3'));var rp=require(_0x32a9('0x4'));var fs=require('fs');var path=require(_0x32a9('0x5'));var rimraf=require(_0x32a9('0x6'));var config=require(_0x32a9('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x32a9('0x8'));module['exports']=function(_0x2ce6fb,_0x1ddac9){return _0x2ce6fb[_0x32a9('0x9')](_0x32a9('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc95d=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x38bf7a,_0x33da03){var _0x25e8f9=function(_0x2a33f7){while(--_0x2a33f7){_0x38bf7a['push'](_0x38bf7a['shift']());}};_0x25e8f9(++_0x33da03);}(_0xc95d,0x1df));var _0xdc95=function(_0x4073cb,_0x5b09a9){_0x4073cb=_0x4073cb-0x0;var _0x59472c=_0xc95d[_0x4073cb];return _0x59472c;};'use strict';var _=require(_0xdc95('0x0'));var util=require(_0xdc95('0x1'));var logger=require(_0xdc95('0x2'))(_0xdc95('0x3'));var moment=require(_0xdc95('0x4'));var BPromise=require('bluebird');var rp=require(_0xdc95('0x5'));var fs=require('fs');var path=require(_0xdc95('0x6'));var rimraf=require(_0xdc95('0x7'));var config=require(_0xdc95('0x8'));var attributes=require(_0xdc95('0x9'));var integrations=require(_0xdc95('0xa'));module[_0xdc95('0xb')]=function(_0x2a4635,_0x793af6){return _0x2a4635[_0xdc95('0xc')](_0xdc95('0xd'),attributes,{'tableName':_0xdc95('0xe'),'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 0c29355..4842f94 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 _0x4cde=['error','code','message','result','catch','GetFreshdeskAccount','raw','options','attributes','limit','include','model','map','FreshdeskAccount','where','ShowFreshdeskAccount','debug','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x4cde,0x185));var _0xe4cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4cde[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe4cd('0x0'));var BPromise=require('bluebird');var rs=require(_0xe4cd('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe4cd('0x2'))(_0xe4cd('0x3'));var config=require(_0xe4cd('0x4'));var jayson=require(_0xe4cd('0x5'));var client=jayson[_0xe4cd('0x6')][_0xe4cd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4de8da,_0x4228d7,_0x75dd4c){return new BPromise(function(_0x56fad7,_0x1e267d){return client['request'](_0x4de8da,_0x75dd4c)[_0xe4cd('0x8')](function(_0x1ff226){logger[_0xe4cd('0x9')](_0xe4cd('0xa'),_0x4228d7,_0xe4cd('0xb'));logger['debug'](_0xe4cd('0xc'),_0x4228d7,_0xe4cd('0xb'),JSON[_0xe4cd('0xd')](_0x1ff226));if(_0x1ff226['error']){if(_0x1ff226[_0xe4cd('0xe')][_0xe4cd('0xf')]===0x1f4){logger['error'](_0xe4cd('0xa'),_0x4228d7,_0x1ff226[_0xe4cd('0xe')][_0xe4cd('0x10')]);return _0x1e267d(_0x1ff226[_0xe4cd('0xe')][_0xe4cd('0x10')]);}logger['error'](_0xe4cd('0xa'),_0x4228d7,_0x1ff226[_0xe4cd('0xe')][_0xe4cd('0x10')]);return _0x56fad7(_0x1ff226[_0xe4cd('0xe')][_0xe4cd('0x10')]);}else{logger[_0xe4cd('0x9')]('FreshdeskAccount,\x20%s,\x20%s',_0x4228d7,_0xe4cd('0xb'));_0x56fad7(_0x1ff226[_0xe4cd('0x11')]['message']);}})[_0xe4cd('0x12')](function(_0x38c25b){logger['error'](_0xe4cd('0xa'),_0x4228d7,_0x38c25b);_0x1e267d(_0x38c25b);});});}exports[_0xe4cd('0x13')]=function(_0x5ea42a){var _0x5ba571=this;return new Promise(function(_0x20ccad,_0x2cfc6e){return db['FreshdeskAccount']['findAll']({'raw':_0x5ea42a['options']?_0x5ea42a['options'][_0xe4cd('0x14')]===undefined?!![]:![]:!![],'where':_0x5ea42a[_0xe4cd('0x15')]?_0x5ea42a[_0xe4cd('0x15')]['where']||null:null,'attributes':_0x5ea42a[_0xe4cd('0x15')]?_0x5ea42a[_0xe4cd('0x15')][_0xe4cd('0x16')]||null:null,'limit':_0x5ea42a['options']?_0x5ea42a[_0xe4cd('0x15')][_0xe4cd('0x17')]||null:null,'include':_0x5ea42a['options']?_0x5ea42a['options'][_0xe4cd('0x18')]?_['map'](_0x5ea42a['options']['include'],function(_0x3698fb){return{'model':db[_0x3698fb[_0xe4cd('0x19')]],'as':_0x3698fb['as'],'attributes':_0x3698fb[_0xe4cd('0x16')],'include':_0x3698fb[_0xe4cd('0x18')]?_[_0xe4cd('0x1a')](_0x3698fb['include'],function(_0x8af687){return{'model':db[_0x8af687['model']],'as':_0x8af687['as'],'attributes':_0x8af687[_0xe4cd('0x16')],'include':_0x8af687[_0xe4cd('0x18')]?_['map'](_0x8af687['include'],function(_0x192790){return{'model':db[_0x192790[_0xe4cd('0x19')]],'as':_0x192790['as'],'attributes':_0x192790['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x208997){logger[_0xe4cd('0x9')]('GetFreshdeskAccount',_0x5ea42a);logger['debug'](_0xe4cd('0x13'),_0x5ea42a,JSON[_0xe4cd('0xd')](_0x208997));_0x20ccad(_0x208997);})[_0xe4cd('0x12')](function(_0x2bff33){logger[_0xe4cd('0xe')](_0xe4cd('0x13'),_0x2bff33[_0xe4cd('0x10')],_0x5ea42a);_0x2cfc6e(_0x5ba571[_0xe4cd('0xe')](0x1f4,_0x2bff33[_0xe4cd('0x10')]));});});};exports['ShowFreshdeskAccount']=function(_0x24cf93){var _0x336371=this;return new Promise(function(_0x4a09dc,_0x720c26){return db[_0xe4cd('0x1b')]['find']({'raw':_0x24cf93['options']?_0x24cf93['options'][_0xe4cd('0x14')]===undefined?!![]:![]:!![],'where':_0x24cf93[_0xe4cd('0x15')]?_0x24cf93[_0xe4cd('0x15')][_0xe4cd('0x1c')]||null:null,'attributes':_0x24cf93[_0xe4cd('0x15')]?_0x24cf93['options'][_0xe4cd('0x16')]||null:null,'include':_0x24cf93[_0xe4cd('0x15')]?_0x24cf93[_0xe4cd('0x15')][_0xe4cd('0x18')]?_[_0xe4cd('0x1a')](_0x24cf93['options'][_0xe4cd('0x18')],function(_0x36f372){return{'model':db[_0x36f372[_0xe4cd('0x19')]],'as':_0x36f372['as'],'attributes':_0x36f372[_0xe4cd('0x16')],'include':_0x36f372[_0xe4cd('0x18')]?_[_0xe4cd('0x1a')](_0x36f372[_0xe4cd('0x18')],function(_0x15def1){return{'model':db[_0x15def1[_0xe4cd('0x19')]],'as':_0x15def1['as'],'attributes':_0x15def1[_0xe4cd('0x16')],'include':_0x15def1['include']?_['map'](_0x15def1['include'],function(_0x411831){return{'model':db[_0x411831[_0xe4cd('0x19')]],'as':_0x411831['as'],'attributes':_0x411831[_0xe4cd('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35d928){logger['info'](_0xe4cd('0x1d'),_0x24cf93);logger[_0xe4cd('0x1e')](_0xe4cd('0x1d'),_0x24cf93,JSON[_0xe4cd('0xd')](_0x35d928));_0x4a09dc(_0x35d928);})[_0xe4cd('0x12')](function(_0x32f38c){logger[_0xe4cd('0xe')]('ShowFreshdeskAccount',_0x32f38c[_0xe4cd('0x10')],_0x24cf93);_0x720c26(_0x336371[_0xe4cd('0xe')](0x1f4,_0x32f38c[_0xe4cd('0x10')]));});});}; \ No newline at end of file +var _0xfcf0=['where','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','attributes','limit','include','map','model','stringify','ShowFreshdeskAccount','find','raw'];(function(_0x3452c5,_0x11829a){var _0x3d2172=function(_0x57478f){while(--_0x57478f){_0x3452c5['push'](_0x3452c5['shift']());}};_0x3d2172(++_0x11829a);}(_0xfcf0,0x1a1));var _0x0fcf=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0xfcf0[_0x3cb30b];return _0x2ca717;};'use strict';var _=require(_0x0fcf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fcf('0x1'));var fs=require('fs');var Redis=require(_0x0fcf('0x2'));var db=require(_0x0fcf('0x3'))['db'];var utils=require(_0x0fcf('0x4'));var logger=require(_0x0fcf('0x5'))('rpc');var config=require(_0x0fcf('0x6'));var jayson=require(_0x0fcf('0x7'));var client=jayson['client'][_0x0fcf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b8608,_0x2f62c3,_0x1be501){return new BPromise(function(_0xf75051,_0xa0b2e4){return client['request'](_0x5b8608,_0x1be501)[_0x0fcf('0x9')](function(_0x4dae85){logger['info'](_0x0fcf('0xa'),_0x2f62c3,_0x0fcf('0xb'));logger[_0x0fcf('0xc')](_0x0fcf('0xd'),_0x2f62c3,'request\x20sent',JSON['stringify'](_0x4dae85));if(_0x4dae85['error']){if(_0x4dae85[_0x0fcf('0xe')]['code']===0x1f4){logger[_0x0fcf('0xe')](_0x0fcf('0xa'),_0x2f62c3,_0x4dae85['error'][_0x0fcf('0xf')]);return _0xa0b2e4(_0x4dae85[_0x0fcf('0xe')][_0x0fcf('0xf')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x2f62c3,_0x4dae85[_0x0fcf('0xe')]['message']);return _0xf75051(_0x4dae85[_0x0fcf('0xe')][_0x0fcf('0xf')]);}else{logger[_0x0fcf('0x10')](_0x0fcf('0xa'),_0x2f62c3,_0x0fcf('0xb'));_0xf75051(_0x4dae85[_0x0fcf('0x11')]['message']);}})[_0x0fcf('0x12')](function(_0x138a04){logger['error'](_0x0fcf('0xa'),_0x2f62c3,_0x138a04);_0xa0b2e4(_0x138a04);});});}exports[_0x0fcf('0x13')]=function(_0x304bb9){var _0x37d29d=this;return new Promise(function(_0x2613e3,_0x5e34e1){return db[_0x0fcf('0x14')]['findAll']({'raw':_0x304bb9[_0x0fcf('0x15')]?_0x304bb9[_0x0fcf('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x304bb9[_0x0fcf('0x15')]?_0x304bb9['options']['where']||null:null,'attributes':_0x304bb9[_0x0fcf('0x15')]?_0x304bb9['options'][_0x0fcf('0x16')]||null:null,'limit':_0x304bb9[_0x0fcf('0x15')]?_0x304bb9[_0x0fcf('0x15')][_0x0fcf('0x17')]||null:null,'include':_0x304bb9[_0x0fcf('0x15')]?_0x304bb9[_0x0fcf('0x15')][_0x0fcf('0x18')]?_[_0x0fcf('0x19')](_0x304bb9[_0x0fcf('0x15')][_0x0fcf('0x18')],function(_0x7e9edc){return{'model':db[_0x7e9edc['model']],'as':_0x7e9edc['as'],'attributes':_0x7e9edc['attributes'],'include':_0x7e9edc['include']?_['map'](_0x7e9edc[_0x0fcf('0x18')],function(_0x5cce87){return{'model':db[_0x5cce87['model']],'as':_0x5cce87['as'],'attributes':_0x5cce87['attributes'],'include':_0x5cce87[_0x0fcf('0x18')]?_[_0x0fcf('0x19')](_0x5cce87[_0x0fcf('0x18')],function(_0x43757f){return{'model':db[_0x43757f[_0x0fcf('0x1a')]],'as':_0x43757f['as'],'attributes':_0x43757f[_0x0fcf('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cf407){logger['info']('GetFreshdeskAccount',_0x304bb9);logger[_0x0fcf('0xc')]('GetFreshdeskAccount',_0x304bb9,JSON[_0x0fcf('0x1b')](_0x3cf407));_0x2613e3(_0x3cf407);})['catch'](function(_0x282374){logger[_0x0fcf('0xe')](_0x0fcf('0x13'),_0x282374[_0x0fcf('0xf')],_0x304bb9);_0x5e34e1(_0x37d29d[_0x0fcf('0xe')](0x1f4,_0x282374[_0x0fcf('0xf')]));});});};exports[_0x0fcf('0x1c')]=function(_0x55bbd1){var _0x555c6f=this;return new Promise(function(_0x316e03,_0x3950be){return db[_0x0fcf('0x14')][_0x0fcf('0x1d')]({'raw':_0x55bbd1[_0x0fcf('0x15')]?_0x55bbd1[_0x0fcf('0x15')][_0x0fcf('0x1e')]===undefined?!![]:![]:!![],'where':_0x55bbd1['options']?_0x55bbd1['options'][_0x0fcf('0x1f')]||null:null,'attributes':_0x55bbd1[_0x0fcf('0x15')]?_0x55bbd1[_0x0fcf('0x15')][_0x0fcf('0x16')]||null:null,'include':_0x55bbd1['options']?_0x55bbd1[_0x0fcf('0x15')][_0x0fcf('0x18')]?_[_0x0fcf('0x19')](_0x55bbd1[_0x0fcf('0x15')]['include'],function(_0x3525e1){return{'model':db[_0x3525e1[_0x0fcf('0x1a')]],'as':_0x3525e1['as'],'attributes':_0x3525e1[_0x0fcf('0x16')],'include':_0x3525e1[_0x0fcf('0x18')]?_['map'](_0x3525e1['include'],function(_0x34b3c7){return{'model':db[_0x34b3c7[_0x0fcf('0x1a')]],'as':_0x34b3c7['as'],'attributes':_0x34b3c7[_0x0fcf('0x16')],'include':_0x34b3c7[_0x0fcf('0x18')]?_[_0x0fcf('0x19')](_0x34b3c7[_0x0fcf('0x18')],function(_0xedfbba){return{'model':db[_0xedfbba['model']],'as':_0xedfbba['as'],'attributes':_0xedfbba[_0x0fcf('0x16')]};}):[]};}):[]};}):[]:[]})[_0x0fcf('0x9')](function(_0xea4858){logger[_0x0fcf('0x10')](_0x0fcf('0x1c'),_0x55bbd1);logger[_0x0fcf('0xc')](_0x0fcf('0x1c'),_0x55bbd1,JSON[_0x0fcf('0x1b')](_0xea4858));_0x316e03(_0xea4858);})[_0x0fcf('0x12')](function(_0x22c2ea){logger[_0x0fcf('0xe')](_0x0fcf('0x1c'),_0x22c2ea[_0x0fcf('0xf')],_0x55bbd1);_0x3950be(_0x555c6f['error'](0x1f4,_0x22c2ea[_0x0fcf('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ead4d96..23342c5 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 _0xd684=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update'];(function(_0x50656,_0xcb9cdf){var _0xd281ab=function(_0x1d78eb){while(--_0x1d78eb){_0x50656['push'](_0x50656['shift']());}};_0xd281ab(++_0xcb9cdf);}(_0xd684,0x1df));var _0x4d68=function(_0x6c9b2c,_0x2e1e98){_0x6c9b2c=_0x6c9b2c-0x0;var _0x2dbb9c=_0xd684[_0x6c9b2c];return _0x2dbb9c;};'use strict';var multer=require(_0x4d68('0x0'));var util=require('util');var path=require(_0x4d68('0x1'));var timeout=require(_0x4d68('0x2'));var express=require(_0x4d68('0x3'));var router=express[_0x4d68('0x4')]();var auth=require(_0x4d68('0x5'));var interaction=require(_0x4d68('0x6'));var config=require('../../config/environment');var controller=require(_0x4d68('0x7'));router[_0x4d68('0x8')]('/',auth[_0x4d68('0x9')](),controller[_0x4d68('0xa')]);router[_0x4d68('0x8')](_0x4d68('0xb'),auth[_0x4d68('0x9')](),controller[_0x4d68('0xc')]);router[_0x4d68('0x8')](_0x4d68('0xd'),auth[_0x4d68('0x9')](),controller[_0x4d68('0xe')]);router['get'](_0x4d68('0xf'),auth['isAuthenticated'](),controller[_0x4d68('0x10')]);router[_0x4d68('0x8')](_0x4d68('0x11'),auth[_0x4d68('0x9')](),controller[_0x4d68('0x12')]);router[_0x4d68('0x8')](_0x4d68('0x13'),auth[_0x4d68('0x9')](),controller[_0x4d68('0x14')]);router[_0x4d68('0x15')]('/',auth[_0x4d68('0x9')](),controller[_0x4d68('0x16')]);router[_0x4d68('0x15')](_0x4d68('0x13'),auth[_0x4d68('0x9')](),controller['setTags']);router[_0x4d68('0x17')]('/:id',auth[_0x4d68('0x9')](),controller[_0x4d68('0x18')]);router[_0x4d68('0x19')](_0x4d68('0xb'),auth[_0x4d68('0x9')](),controller[_0x4d68('0x1a')]);module[_0x4d68('0x1b')]=router; \ No newline at end of file +var _0xa4ea=['get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0xf74836,_0x9074c1){var _0x1373ac=function(_0x12d3b3){while(--_0x12d3b3){_0xf74836['push'](_0xf74836['shift']());}};_0x1373ac(++_0x9074c1);}(_0xa4ea,0x1de));var _0xaa4e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa4ea[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0xaa4e('0x0'));var path=require('path');var timeout=require(_0xaa4e('0x1'));var express=require(_0xaa4e('0x2'));var router=express['Router']();var auth=require(_0xaa4e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xaa4e('0x4'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xaa4e('0x5')]('/',auth[_0xaa4e('0x6')](),controller[_0xaa4e('0x7')]);router['get'](_0xaa4e('0x8'),auth[_0xaa4e('0x6')](),controller[_0xaa4e('0x9')]);router[_0xaa4e('0x5')]('/:id/fields',auth[_0xaa4e('0x6')](),controller['getFields']);router[_0xaa4e('0x5')]('/:id/subjects',auth[_0xaa4e('0x6')](),controller[_0xaa4e('0xa')]);router[_0xaa4e('0x5')](_0xaa4e('0xb'),auth[_0xaa4e('0x6')](),controller[_0xaa4e('0xc')]);router['get']('/:id/tags',auth[_0xaa4e('0x6')](),controller[_0xaa4e('0xd')]);router[_0xaa4e('0xe')]('/',auth[_0xaa4e('0x6')](),controller[_0xaa4e('0xf')]);router[_0xaa4e('0xe')](_0xaa4e('0x10'),auth[_0xaa4e('0x6')](),controller[_0xaa4e('0x11')]);router[_0xaa4e('0x12')](_0xaa4e('0x8'),auth[_0xaa4e('0x6')](),controller[_0xaa4e('0x13')]);router[_0xaa4e('0x14')]('/:id',auth[_0xaa4e('0x6')](),controller[_0xaa4e('0x15')]);module[_0xaa4e('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 cc70327..9358c4a 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 _0x6fb6=['STRING','sequelize'];(function(_0x2f9c1f,_0x473981){var _0x19c8c5=function(_0x237188){while(--_0x237188){_0x2f9c1f['push'](_0x2f9c1f['shift']());}};_0x19c8c5(++_0x473981);}(_0x6fb6,0xa1));var _0x66fb=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x6fb6[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x66fb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x66fb('0x1')]}}; \ No newline at end of file +var _0xdc8d=['STRING','exports'];(function(_0x5a5905,_0x40c33e){var _0x32e812=function(_0x4a161d){while(--_0x4a161d){_0x5a5905['push'](_0x5a5905['shift']());}};_0x32e812(++_0x40c33e);}(_0xdc8d,0xff));var _0xddc8=function(_0x43a013,_0x1fa0f8){_0x43a013=_0x43a013-0x0;var _0x3dd545=_0xdc8d[_0x43a013];return _0x3dd545;};'use strict';var Sequelize=require('sequelize');module[_0xddc8('0x0')]={'name':{'type':Sequelize[_0xddc8('0x1')]},'description':{'type':Sequelize[_0xddc8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 55860ee..470db8a 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 _0x5481=['where','VIRTUAL','includeAll','findAll','rows','show','params','length','options','find','create','body','destroy','pick','getFields','getSubjects','FreshdeskField','order','getDescriptions','findOne','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','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','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','end','stack','name','index','FreshdeskConfiguration','rawAttributes','fieldName','type','model','map','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','filters','filter','merge'];(function(_0x71a70,_0x4e1cdd){var _0x3a2b22=function(_0x17d53f){while(--_0x17d53f){_0x71a70['push'](_0x71a70['shift']());}};_0x3a2b22(++_0x4e1cdd);}(_0x5481,0x76));var _0x1548=function(_0x291964,_0x53a984){_0x291964=_0x291964-0x0;var _0x411e8b=_0x5481[_0x291964];return _0x411e8b;};'use strict';var pdf=require(_0x1548('0x0'));var emlformat=require(_0x1548('0x1'));var rimraf=require(_0x1548('0x2'));var zipdir=require(_0x1548('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1548('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1548('0x5'));var sox=require(_0x1548('0x6'));var csv=require(_0x1548('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1548('0x8'));var squel=require(_0x1548('0x9'));var crypto=require(_0x1548('0xa'));var jsforce=require(_0x1548('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1548('0xc'));var Papa=require(_0x1548('0xd'));var Redis=require(_0x1548('0xe'));var authService=require(_0x1548('0xf'));var qs=require(_0x1548('0x10'));var as=require(_0x1548('0x11'));var hardwareService=require(_0x1548('0x12'));var logger=require(_0x1548('0x13'))('api');var utils=require(_0x1548('0x14'));var config=require(_0x1548('0x15'));var licenseUtil=require(_0x1548('0x16'));var db=require(_0x1548('0x17'))['db'];var jayson=require(_0x1548('0x18'));var client=jayson[_0x1548('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3376c8,_0x41b933,_0x24dd00,_0x4d71c6){return new BPromise(function(_0x390192,_0x84ffc0){var _0x2a82f7=_0x4d71c6||client;return _0x2a82f7[_0x1548('0x1a')](_0x3376c8,_0x24dd00)[_0x1548('0x1b')](function(_0x254bb2){logger[_0x1548('0x1c')](_0x1548('0x1d'),_0x41b933,_0x1548('0x1e'));logger[_0x1548('0x1f')](_0x1548('0x20'),_0x41b933,_0x1548('0x1e'),JSON[_0x1548('0x21')](_0x254bb2));if(_0x254bb2[_0x1548('0x22')]){if(_0x254bb2[_0x1548('0x22')]['code']===0x1f4){logger['error'](_0x1548('0x1d'),_0x41b933,_0x254bb2['error'][_0x1548('0x23')]);return _0x84ffc0(_0x254bb2[_0x1548('0x22')]['message']);}logger[_0x1548('0x22')](_0x1548('0x1d'),_0x41b933,_0x254bb2[_0x1548('0x22')][_0x1548('0x23')]);return _0x390192(_0x254bb2[_0x1548('0x22')][_0x1548('0x23')]);}else{logger[_0x1548('0x1c')](_0x1548('0x1d'),_0x41b933,_0x1548('0x1e'));_0x390192(_0x254bb2[_0x1548('0x24')]['message']);}})[_0x1548('0x25')](function(_0x18a11d){logger[_0x1548('0x22')](_0x1548('0x1d'),_0x41b933,_0x18a11d);_0x84ffc0(_0x18a11d);});});}function respondWithStatusCode(_0x12de8b,_0x45d4f5){_0x45d4f5=_0x45d4f5||0xcc;return function(_0x56839a){if(_0x56839a){return _0x12de8b[_0x1548('0x26')](_0x45d4f5);}return _0x12de8b[_0x1548('0x27')](_0x45d4f5)['end']();};}function respondWithResult(_0x91b646,_0xdd0f78){_0xdd0f78=_0xdd0f78||0xc8;return function(_0x4be7a1){if(_0x4be7a1){return _0x91b646['status'](_0xdd0f78)[_0x1548('0x28')](_0x4be7a1);}};}function respondWithFilteredResult(_0x3f8dc6,_0x7b17b1){return function(_0x2d1f3b){if(_0x2d1f3b){var _0x1ac8ae=_0x2d1f3b[_0x1548('0x29')],_0x522130=_0x7b17b1[_0x1548('0x2a')],_0xff257=_0x7b17b1[_0x1548('0x2a')]+_0x7b17b1['limit'],_0x313c4f;if(_0xff257>=_0x1ac8ae){_0xff257=_0x1ac8ae;_0x313c4f=0xc8;}else{_0x313c4f=0xce;}_0x3f8dc6[_0x1548('0x27')](_0x313c4f);return _0x3f8dc6[_0x1548('0x2b')](_0x1548('0x2c'),_0x522130+'-'+_0xff257+'/'+_0x1ac8ae)[_0x1548('0x28')](_0x2d1f3b);}return null;};}function patchUpdates(_0x3e7463){return function(_0x42ef5b){try{jsonpatch[_0x1548('0x2d')](_0x42ef5b,_0x3e7463,!![]);}catch(_0x386cfc){return BPromise[_0x1548('0x2e')](_0x386cfc);}return _0x42ef5b['save']();};}function saveUpdates(_0x2f2bc4,_0x37e4e4){return function(_0x5b0b82){if(_0x5b0b82){return _0x5b0b82[_0x1548('0x2f')](_0x2f2bc4)['then'](function(_0x560625){return _0x560625;});}return null;};}function removeEntity(_0x42804b,_0x2a1cef){return function(_0x4d304b){if(_0x4d304b){return _0x4d304b['destroy']()[_0x1548('0x1b')](function(){_0x42804b[_0x1548('0x27')](0xcc)[_0x1548('0x30')]();});}};}function handleEntityNotFound(_0xd933fd,_0x569b05){return function(_0x24ce22){if(!_0x24ce22){_0xd933fd[_0x1548('0x26')](0x194);}return _0x24ce22;};}function handleError(_0xb4c7e,_0x452906){_0x452906=_0x452906||0x1f4;return function(_0x162449){logger['error'](_0x162449[_0x1548('0x31')]);if(_0x162449[_0x1548('0x32')]){delete _0x162449[_0x1548('0x32')];}_0xb4c7e[_0x1548('0x27')](_0x452906)['send'](_0x162449);};}exports[_0x1548('0x33')]=function(_0x373118,_0x3cff75){var _0x1956e8={},_0x47902e={},_0x36d532={'count':0x0,'rows':[]};var _0x455f32=_['map'](db[_0x1548('0x34')][_0x1548('0x35')],function(_0x1120fb){return{'name':_0x1120fb[_0x1548('0x36')],'type':_0x1120fb[_0x1548('0x37')]['key']};});_0x47902e[_0x1548('0x38')]=_[_0x1548('0x39')](_0x455f32,_0x1548('0x32'));_0x47902e['query']=_[_0x1548('0x3a')](_0x373118[_0x1548('0x3b')]);_0x47902e['filters']=_['intersection'](_0x47902e[_0x1548('0x38')],_0x47902e[_0x1548('0x3b')]);_0x1956e8[_0x1548('0x3c')]=_[_0x1548('0x3d')](_0x47902e[_0x1548('0x38')],qs[_0x1548('0x3e')](_0x373118[_0x1548('0x3b')]['fields']));_0x1956e8[_0x1548('0x3c')]=_0x1956e8[_0x1548('0x3c')]['length']?_0x1956e8[_0x1548('0x3c')]:_0x47902e[_0x1548('0x38')];if(!_0x373118[_0x1548('0x3b')][_0x1548('0x3f')](_0x1548('0x40'))){_0x1956e8[_0x1548('0x41')]=qs[_0x1548('0x41')](_0x373118[_0x1548('0x3b')][_0x1548('0x41')]);_0x1956e8['offset']=qs[_0x1548('0x2a')](_0x373118['query'][_0x1548('0x2a')]);}_0x1956e8['order']=qs[_0x1548('0x42')](_0x373118['query'][_0x1548('0x42')]);_0x1956e8['where']=qs['filters'](_['pick'](_0x373118[_0x1548('0x3b')],_0x47902e[_0x1548('0x43')]),_0x455f32);if(_0x373118[_0x1548('0x3b')][_0x1548('0x44')]){_0x1956e8['where']=_[_0x1548('0x45')](_0x1956e8[_0x1548('0x46')],{'$or':_[_0x1548('0x39')](_0x455f32,function(_0x172b94){if(_0x172b94[_0x1548('0x37')]!==_0x1548('0x47')){var _0x2522c5={};_0x2522c5[_0x172b94[_0x1548('0x32')]]={'$like':'%'+_0x373118['query'][_0x1548('0x44')]+'%'};return _0x2522c5;}})});}_0x1956e8=_['merge']({},_0x1956e8,_0x373118['options']);var _0xcf0fac={'where':_0x1956e8['where']};return db['FreshdeskConfiguration'][_0x1548('0x29')](_0xcf0fac)[_0x1548('0x1b')](function(_0x3348ef){_0x36d532[_0x1548('0x29')]=_0x3348ef;if(_0x373118[_0x1548('0x3b')][_0x1548('0x48')]){_0x1956e8['include']=[{'all':!![]}];}return db[_0x1548('0x34')][_0x1548('0x49')](_0x1956e8);})[_0x1548('0x1b')](function(_0x496c96){_0x36d532[_0x1548('0x4a')]=_0x496c96;return _0x36d532;})[_0x1548('0x1b')](respondWithFilteredResult(_0x3cff75,_0x1956e8))[_0x1548('0x25')](handleError(_0x3cff75,null));};exports[_0x1548('0x4b')]=function(_0x47aa00,_0x55e955){var _0x22cc57={'raw':![],'where':{'id':_0x47aa00[_0x1548('0x4c')]['id']}},_0x4cebe4={};_0x4cebe4[_0x1548('0x38')]=_[_0x1548('0x3a')](db[_0x1548('0x34')][_0x1548('0x35')]);_0x4cebe4[_0x1548('0x3b')]=_['keys'](_0x47aa00[_0x1548('0x3b')]);_0x4cebe4[_0x1548('0x43')]=_[_0x1548('0x3d')](_0x4cebe4['model'],_0x4cebe4[_0x1548('0x3b')]);_0x22cc57[_0x1548('0x3c')]=_[_0x1548('0x3d')](_0x4cebe4[_0x1548('0x38')],qs['fields'](_0x47aa00[_0x1548('0x3b')][_0x1548('0x3e')]));_0x22cc57[_0x1548('0x3c')]=_0x22cc57[_0x1548('0x3c')][_0x1548('0x4d')]?_0x22cc57[_0x1548('0x3c')]:_0x4cebe4['model'];if(_0x47aa00[_0x1548('0x3b')][_0x1548('0x48')]){_0x22cc57['include']=[{'all':!![]}];}_0x22cc57=_[_0x1548('0x45')]({},_0x22cc57,_0x47aa00[_0x1548('0x4e')]);return db[_0x1548('0x34')][_0x1548('0x4f')](_0x22cc57)['then'](handleEntityNotFound(_0x55e955,null))[_0x1548('0x1b')](respondWithResult(_0x55e955,null))[_0x1548('0x25')](handleError(_0x55e955,null));};exports[_0x1548('0x50')]=function(_0x3048a6,_0xa36ddf){return db['FreshdeskConfiguration']['create'](_0x3048a6[_0x1548('0x51')],{})[_0x1548('0x1b')](respondWithResult(_0xa36ddf,0xc9))['catch'](handleError(_0xa36ddf,null));};exports[_0x1548('0x2f')]=function(_0x448b9d,_0x383f56){if(_0x448b9d['body']['id']){delete _0x448b9d[_0x1548('0x51')]['id'];}return db[_0x1548('0x34')][_0x1548('0x4f')]({'where':{'id':_0x448b9d[_0x1548('0x4c')]['id']}})[_0x1548('0x1b')](handleEntityNotFound(_0x383f56,null))[_0x1548('0x1b')](saveUpdates(_0x448b9d[_0x1548('0x51')],null))[_0x1548('0x1b')](respondWithResult(_0x383f56,null))[_0x1548('0x25')](handleError(_0x383f56,null));};exports[_0x1548('0x52')]=function(_0x233316,_0x597cb3){return db[_0x1548('0x34')][_0x1548('0x4f')]({'where':{'id':_0x233316[_0x1548('0x4c')]['id']}})[_0x1548('0x1b')](handleEntityNotFound(_0x597cb3,null))[_0x1548('0x1b')](removeEntity(_0x597cb3,null))[_0x1548('0x25')](handleError(_0x597cb3,null));};exports['getFields']=function(_0x52dea0,_0x5bf5f9,_0x254a67){var _0x518e12={};var _0x366248={};var _0x1d83e1;var _0x3604e2;return db[_0x1548('0x34')]['findOne']({'where':{'id':_0x52dea0['params']['id']}})[_0x1548('0x1b')](handleEntityNotFound(_0x5bf5f9,null))[_0x1548('0x1b')](function(_0x4cb954){if(_0x4cb954){_0x1d83e1=_0x4cb954;_0x366248[_0x1548('0x38')]=_[_0x1548('0x3a')](db['FreshdeskField'][_0x1548('0x35')]);_0x366248[_0x1548('0x3b')]=_[_0x1548('0x3a')](_0x52dea0[_0x1548('0x3b')]);_0x366248['filters']=_[_0x1548('0x3d')](_0x366248[_0x1548('0x38')],_0x366248[_0x1548('0x3b')]);_0x518e12[_0x1548('0x3c')]=_['intersection'](_0x366248['model'],qs[_0x1548('0x3e')](_0x52dea0[_0x1548('0x3b')][_0x1548('0x3e')]));_0x518e12[_0x1548('0x3c')]=_0x518e12['attributes'][_0x1548('0x4d')]?_0x518e12['attributes']:_0x366248[_0x1548('0x38')];_0x518e12['order']=qs[_0x1548('0x42')](_0x52dea0[_0x1548('0x3b')][_0x1548('0x42')]);_0x518e12[_0x1548('0x46')]=qs['filters'](_[_0x1548('0x53')](_0x52dea0[_0x1548('0x3b')],_0x366248[_0x1548('0x43')]));if(_0x52dea0[_0x1548('0x3b')][_0x1548('0x44')]){_0x518e12[_0x1548('0x46')]=_['merge'](_0x518e12[_0x1548('0x46')],{'$or':_[_0x1548('0x39')](_0x518e12[_0x1548('0x3c')],function(_0x48d9de){var _0x1417e5={};_0x1417e5[_0x48d9de]={'$like':'%'+_0x52dea0[_0x1548('0x3b')]['filter']+'%'};return _0x1417e5;})});}_0x518e12=_[_0x1548('0x45')]({},_0x518e12,_0x52dea0[_0x1548('0x4e')]);return _0x1d83e1['getFields'](_0x518e12);}})[_0x1548('0x1b')](function(_0x18dc80){if(_0x18dc80){_0x3604e2=_0x18dc80[_0x1548('0x4d')];if(!_0x52dea0[_0x1548('0x3b')][_0x1548('0x3f')]('nolimit')){_0x518e12['limit']=qs['limit'](_0x52dea0[_0x1548('0x3b')][_0x1548('0x41')]);_0x518e12['offset']=qs[_0x1548('0x2a')](_0x52dea0[_0x1548('0x3b')]['offset']);}return _0x1d83e1[_0x1548('0x54')](_0x518e12);}})[_0x1548('0x1b')](function(_0xcad187){if(_0xcad187){return _0xcad187?{'count':_0x3604e2,'rows':_0xcad187}:null;}})[_0x1548('0x1b')](respondWithResult(_0x5bf5f9,null))[_0x1548('0x25')](handleError(_0x5bf5f9,null));};exports[_0x1548('0x55')]=function(_0x564cbd,_0x362b0a,_0x3daff4){var _0x37c859={};var _0x251d00={};var _0x31df3e;var _0x24ef13;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x564cbd['params']['id']}})['then'](handleEntityNotFound(_0x362b0a,null))[_0x1548('0x1b')](function(_0x8f549){if(_0x8f549){_0x31df3e=_0x8f549;_0x251d00['model']=_[_0x1548('0x3a')](db[_0x1548('0x56')]['rawAttributes']);_0x251d00[_0x1548('0x3b')]=_[_0x1548('0x3a')](_0x564cbd[_0x1548('0x3b')]);_0x251d00[_0x1548('0x43')]=_[_0x1548('0x3d')](_0x251d00[_0x1548('0x38')],_0x251d00[_0x1548('0x3b')]);_0x37c859[_0x1548('0x3c')]=_[_0x1548('0x3d')](_0x251d00[_0x1548('0x38')],qs['fields'](_0x564cbd['query'][_0x1548('0x3e')]));_0x37c859[_0x1548('0x3c')]=_0x37c859[_0x1548('0x3c')][_0x1548('0x4d')]?_0x37c859[_0x1548('0x3c')]:_0x251d00[_0x1548('0x38')];_0x37c859[_0x1548('0x57')]=qs[_0x1548('0x42')](_0x564cbd[_0x1548('0x3b')][_0x1548('0x42')]);_0x37c859[_0x1548('0x46')]=qs['filters'](_[_0x1548('0x53')](_0x564cbd['query'],_0x251d00['filters']));if(_0x564cbd[_0x1548('0x3b')][_0x1548('0x44')]){_0x37c859[_0x1548('0x46')]=_[_0x1548('0x45')](_0x37c859[_0x1548('0x46')],{'$or':_[_0x1548('0x39')](_0x37c859[_0x1548('0x3c')],function(_0x1a819c){var _0x54230c={};_0x54230c[_0x1a819c]={'$like':'%'+_0x564cbd[_0x1548('0x3b')][_0x1548('0x44')]+'%'};return _0x54230c;})});}_0x37c859=_[_0x1548('0x45')]({},_0x37c859,_0x564cbd['options']);return _0x31df3e[_0x1548('0x55')](_0x37c859);}})['then'](function(_0x51358e){if(_0x51358e){_0x24ef13=_0x51358e[_0x1548('0x4d')];if(!_0x564cbd['query'][_0x1548('0x3f')](_0x1548('0x40'))){_0x37c859[_0x1548('0x41')]=qs[_0x1548('0x41')](_0x564cbd[_0x1548('0x3b')][_0x1548('0x41')]);_0x37c859['offset']=qs[_0x1548('0x2a')](_0x564cbd['query'][_0x1548('0x2a')]);}return _0x31df3e[_0x1548('0x55')](_0x37c859);}})[_0x1548('0x1b')](function(_0x3564bc){if(_0x3564bc){return _0x3564bc?{'count':_0x24ef13,'rows':_0x3564bc}:null;}})['then'](respondWithResult(_0x362b0a,null))['catch'](handleError(_0x362b0a,null));};exports[_0x1548('0x58')]=function(_0x2ff54a,_0x2af72d,_0x1e46bf){var _0x1857db={};var _0x51be34={};var _0x54e9fa;var _0xb125ce;return db['FreshdeskConfiguration'][_0x1548('0x59')]({'where':{'id':_0x2ff54a[_0x1548('0x4c')]['id']}})[_0x1548('0x1b')](handleEntityNotFound(_0x2af72d,null))[_0x1548('0x1b')](function(_0x1dee40){if(_0x1dee40){_0x54e9fa=_0x1dee40;_0x51be34[_0x1548('0x38')]=_[_0x1548('0x3a')](db[_0x1548('0x56')][_0x1548('0x35')]);_0x51be34[_0x1548('0x3b')]=_['keys'](_0x2ff54a['query']);_0x51be34[_0x1548('0x43')]=_['intersection'](_0x51be34[_0x1548('0x38')],_0x51be34[_0x1548('0x3b')]);_0x1857db['attributes']=_[_0x1548('0x3d')](_0x51be34['model'],qs['fields'](_0x2ff54a['query'][_0x1548('0x3e')]));_0x1857db['attributes']=_0x1857db[_0x1548('0x3c')][_0x1548('0x4d')]?_0x1857db[_0x1548('0x3c')]:_0x51be34[_0x1548('0x38')];_0x1857db[_0x1548('0x57')]=qs['sort'](_0x2ff54a[_0x1548('0x3b')][_0x1548('0x42')]);_0x1857db[_0x1548('0x46')]=qs[_0x1548('0x43')](_[_0x1548('0x53')](_0x2ff54a[_0x1548('0x3b')],_0x51be34[_0x1548('0x43')]));if(_0x2ff54a[_0x1548('0x3b')]['filter']){_0x1857db[_0x1548('0x46')]=_[_0x1548('0x45')](_0x1857db[_0x1548('0x46')],{'$or':_[_0x1548('0x39')](_0x1857db['attributes'],function(_0x2d68f5){var _0xdb2e03={};_0xdb2e03[_0x2d68f5]={'$like':'%'+_0x2ff54a[_0x1548('0x3b')][_0x1548('0x44')]+'%'};return _0xdb2e03;})});}_0x1857db=_[_0x1548('0x45')]({},_0x1857db,_0x2ff54a[_0x1548('0x4e')]);return _0x54e9fa[_0x1548('0x58')](_0x1857db);}})['then'](function(_0x56cfda){if(_0x56cfda){_0xb125ce=_0x56cfda[_0x1548('0x4d')];if(!_0x2ff54a['query'][_0x1548('0x3f')](_0x1548('0x40'))){_0x1857db[_0x1548('0x41')]=qs[_0x1548('0x41')](_0x2ff54a[_0x1548('0x3b')][_0x1548('0x41')]);_0x1857db[_0x1548('0x2a')]=qs['offset'](_0x2ff54a[_0x1548('0x3b')][_0x1548('0x2a')]);}return _0x54e9fa['getDescriptions'](_0x1857db);}})[_0x1548('0x1b')](function(_0x388250){if(_0x388250){return _0x388250?{'count':_0xb125ce,'rows':_0x388250}:null;}})[_0x1548('0x1b')](respondWithResult(_0x2af72d,null))['catch'](handleError(_0x2af72d,null));};exports['getTags']=function(_0x349c14,_0x3a8089,_0x3a03ec){var _0x502432={};var _0x5e9acf={};var _0x3d6d3f;var _0x5b7b64;return db[_0x1548('0x34')][_0x1548('0x59')]({'where':{'id':_0x349c14[_0x1548('0x4c')]['id']}})[_0x1548('0x1b')](handleEntityNotFound(_0x3a8089,null))[_0x1548('0x1b')](function(_0x181c96){if(_0x181c96){_0x3d6d3f=_0x181c96;_0x5e9acf['model']=_[_0x1548('0x3a')](db[_0x1548('0x5a')][_0x1548('0x35')]);_0x5e9acf[_0x1548('0x3b')]=_['keys'](_0x349c14[_0x1548('0x3b')]);_0x5e9acf[_0x1548('0x43')]=_[_0x1548('0x3d')](_0x5e9acf[_0x1548('0x38')],_0x5e9acf[_0x1548('0x3b')]);_0x502432[_0x1548('0x3c')]=_[_0x1548('0x3d')](_0x5e9acf[_0x1548('0x38')],qs[_0x1548('0x3e')](_0x349c14[_0x1548('0x3b')]['fields']));_0x502432[_0x1548('0x3c')]=_0x502432[_0x1548('0x3c')]['length']?_0x502432['attributes']:_0x5e9acf[_0x1548('0x38')];_0x502432[_0x1548('0x57')]=qs['sort'](_0x349c14[_0x1548('0x3b')]['sort']);_0x502432[_0x1548('0x46')]=qs['filters'](_[_0x1548('0x53')](_0x349c14['query'],_0x5e9acf[_0x1548('0x43')]));if(_0x349c14['query'][_0x1548('0x44')]){_0x502432['where']=_['merge'](_0x502432['where'],{'$or':_[_0x1548('0x39')](_0x502432[_0x1548('0x3c')],function(_0x9b5811){var _0x1b4d17={};_0x1b4d17[_0x9b5811]={'$like':'%'+_0x349c14['query']['filter']+'%'};return _0x1b4d17;})});}_0x502432=_[_0x1548('0x45')]({},_0x502432,_0x349c14[_0x1548('0x4e')]);return _0x3d6d3f[_0x1548('0x5b')](_0x502432);}})[_0x1548('0x1b')](function(_0x2063c0){if(_0x2063c0){_0x5b7b64=_0x2063c0['length'];if(!_0x349c14[_0x1548('0x3b')][_0x1548('0x3f')](_0x1548('0x40'))){_0x502432[_0x1548('0x41')]=qs['limit'](_0x349c14[_0x1548('0x3b')][_0x1548('0x41')]);_0x502432['offset']=qs[_0x1548('0x2a')](_0x349c14[_0x1548('0x3b')][_0x1548('0x2a')]);}return _0x3d6d3f[_0x1548('0x5b')](_0x502432);}})[_0x1548('0x1b')](function(_0x1445aa){if(_0x1445aa){return _0x1445aa?{'count':_0x5b7b64,'rows':_0x1445aa}:null;}})[_0x1548('0x1b')](respondWithResult(_0x3a8089,null))[_0x1548('0x25')](handleError(_0x3a8089,null));};exports[_0x1548('0x5c')]=function(_0x3e1a6b,_0x36b638,_0x4b9d82){if(_0x3e1a6b['body']['id']){delete _0x3e1a6b[_0x1548('0x51')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3e1a6b[_0x1548('0x4c')]['id']}})['then'](handleEntityNotFound(_0x36b638,null))[_0x1548('0x1b')](function(_0x4fe912){if(_0x4fe912){return _0x4fe912[_0x1548('0x5c')](_0x3e1a6b[_0x1548('0x51')][_0x1548('0x5d')]||[]);}return null;})[_0x1548('0x1b')](respondWithResult(_0x36b638,null))[_0x1548('0x25')](handleError(_0x36b638,null));}; \ No newline at end of file +var _0x4b51=['options','includeAll','include','findAll','rows','show','find','create','body','params','getFields','findOne','FreshdeskField','rawAttributes','filter','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','name','index','map','FreshdeskConfiguration','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x20943d,_0x58dac0){var _0x5a09bd=function(_0x5c2060){while(--_0x5c2060){_0x20943d['push'](_0x20943d['shift']());}};_0x5a09bd(++_0x58dac0);}(_0x4b51,0x1e7));var _0x14b5=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x4b51[_0x29d94e];return _0x106237;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x14b5('0x0'));var rimraf=require(_0x14b5('0x1'));var zipdir=require(_0x14b5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x14b5('0x3'));var moment=require(_0x14b5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x14b5('0x5'));var util=require(_0x14b5('0x6'));var path=require(_0x14b5('0x7'));var sox=require(_0x14b5('0x8'));var csv=require(_0x14b5('0x9'));var ejs=require(_0x14b5('0xa'));var fs=require('fs');var _=require(_0x14b5('0xb'));var squel=require('squel');var crypto=require(_0x14b5('0xc'));var jsforce=require(_0x14b5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x14b5('0x9'));var querystring=require(_0x14b5('0xe'));var Papa=require(_0x14b5('0xf'));var Redis=require('ioredis');var authService=require(_0x14b5('0x10'));var qs=require(_0x14b5('0x11'));var as=require(_0x14b5('0x12'));var hardwareService=require(_0x14b5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x14b5('0x14'));var config=require(_0x14b5('0x15'));var licenseUtil=require(_0x14b5('0x16'));var db=require(_0x14b5('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x14b5('0x18')][_0x14b5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xa39afd,_0x11fe3c,_0xcc27a5,_0x43c2ce){return new BPromise(function(_0x40be37,_0x45caff){var _0x1fe97e=_0x43c2ce||client;return _0x1fe97e[_0x14b5('0x1a')](_0xa39afd,_0xcc27a5)[_0x14b5('0x1b')](function(_0x87335a){logger[_0x14b5('0x1c')](_0x14b5('0x1d'),_0x11fe3c,'request\x20sent');logger[_0x14b5('0x1e')](_0x14b5('0x1f'),_0x11fe3c,_0x14b5('0x20'),JSON[_0x14b5('0x21')](_0x87335a));if(_0x87335a['error']){if(_0x87335a['error'][_0x14b5('0x22')]===0x1f4){logger['error'](_0x14b5('0x1d'),_0x11fe3c,_0x87335a[_0x14b5('0x23')][_0x14b5('0x24')]);return _0x45caff(_0x87335a[_0x14b5('0x23')][_0x14b5('0x24')]);}logger[_0x14b5('0x23')](_0x14b5('0x1d'),_0x11fe3c,_0x87335a[_0x14b5('0x23')]['message']);return _0x40be37(_0x87335a[_0x14b5('0x23')][_0x14b5('0x24')]);}else{logger[_0x14b5('0x1c')](_0x14b5('0x1d'),_0x11fe3c,_0x14b5('0x20'));_0x40be37(_0x87335a['result']['message']);}})[_0x14b5('0x25')](function(_0x1dda4b){logger[_0x14b5('0x23')](_0x14b5('0x1d'),_0x11fe3c,_0x1dda4b);_0x45caff(_0x1dda4b);});});}function respondWithStatusCode(_0x319828,_0x2b44e4){_0x2b44e4=_0x2b44e4||0xcc;return function(_0x565bc6){if(_0x565bc6){return _0x319828[_0x14b5('0x26')](_0x2b44e4);}return _0x319828[_0x14b5('0x27')](_0x2b44e4)[_0x14b5('0x28')]();};}function respondWithResult(_0x91a36d,_0x5cb1af){_0x5cb1af=_0x5cb1af||0xc8;return function(_0xd6df83){if(_0xd6df83){return _0x91a36d[_0x14b5('0x27')](_0x5cb1af)[_0x14b5('0x29')](_0xd6df83);}};}function respondWithFilteredResult(_0x1e9b66,_0x141451){return function(_0x41a48b){if(_0x41a48b){var _0x4e58e0=_0x41a48b[_0x14b5('0x2a')],_0x34ca50=_0x141451['offset'],_0x405755=_0x141451[_0x14b5('0x2b')]+_0x141451[_0x14b5('0x2c')],_0x42a9a5;if(_0x405755>=_0x4e58e0){_0x405755=_0x4e58e0;_0x42a9a5=0xc8;}else{_0x42a9a5=0xce;}_0x1e9b66[_0x14b5('0x27')](_0x42a9a5);return _0x1e9b66['set'](_0x14b5('0x2d'),_0x34ca50+'-'+_0x405755+'/'+_0x4e58e0)[_0x14b5('0x29')](_0x41a48b);}return null;};}function patchUpdates(_0x1aeaca){return function(_0x29dc89){try{jsonpatch[_0x14b5('0x2e')](_0x29dc89,_0x1aeaca,!![]);}catch(_0x143b78){return BPromise[_0x14b5('0x2f')](_0x143b78);}return _0x29dc89[_0x14b5('0x30')]();};}function saveUpdates(_0x85d8b3,_0x205963){return function(_0x5dd797){if(_0x5dd797){return _0x5dd797['update'](_0x85d8b3)[_0x14b5('0x1b')](function(_0x1dbd99){return _0x1dbd99;});}return null;};}function removeEntity(_0x26da73,_0x54ba98){return function(_0x29a56f){if(_0x29a56f){return _0x29a56f[_0x14b5('0x31')]()[_0x14b5('0x1b')](function(){_0x26da73[_0x14b5('0x27')](0xcc)[_0x14b5('0x28')]();});}};}function handleEntityNotFound(_0xa7dfc8,_0x46aceb){return function(_0x364045){if(!_0x364045){_0xa7dfc8[_0x14b5('0x26')](0x194);}return _0x364045;};}function handleError(_0x2eeb8c,_0xa762d2){_0xa762d2=_0xa762d2||0x1f4;return function(_0x466c40){logger['error'](_0x466c40['stack']);if(_0x466c40[_0x14b5('0x32')]){delete _0x466c40[_0x14b5('0x32')];}_0x2eeb8c[_0x14b5('0x27')](_0xa762d2)['send'](_0x466c40);};}exports[_0x14b5('0x33')]=function(_0x15f60d,_0x557f1b){var _0x2487e5={},_0x548437={},_0x3f6c74={'count':0x0,'rows':[]};var _0x3c9686=_[_0x14b5('0x34')](db[_0x14b5('0x35')]['rawAttributes'],function(_0x455c9b){return{'name':_0x455c9b[_0x14b5('0x36')],'type':_0x455c9b[_0x14b5('0x37')]['key']};});_0x548437[_0x14b5('0x38')]=_[_0x14b5('0x34')](_0x3c9686,_0x14b5('0x32'));_0x548437[_0x14b5('0x39')]=_[_0x14b5('0x3a')](_0x15f60d[_0x14b5('0x39')]);_0x548437[_0x14b5('0x3b')]=_[_0x14b5('0x3c')](_0x548437[_0x14b5('0x38')],_0x548437['query']);_0x2487e5['attributes']=_['intersection'](_0x548437[_0x14b5('0x38')],qs['fields'](_0x15f60d[_0x14b5('0x39')][_0x14b5('0x3d')]));_0x2487e5['attributes']=_0x2487e5['attributes'][_0x14b5('0x3e')]?_0x2487e5[_0x14b5('0x3f')]:_0x548437['model'];if(!_0x15f60d[_0x14b5('0x39')]['hasOwnProperty'](_0x14b5('0x40'))){_0x2487e5[_0x14b5('0x2c')]=qs['limit'](_0x15f60d['query'][_0x14b5('0x2c')]);_0x2487e5[_0x14b5('0x2b')]=qs[_0x14b5('0x2b')](_0x15f60d['query'][_0x14b5('0x2b')]);}_0x2487e5[_0x14b5('0x41')]=qs[_0x14b5('0x42')](_0x15f60d[_0x14b5('0x39')][_0x14b5('0x42')]);_0x2487e5[_0x14b5('0x43')]=qs[_0x14b5('0x3b')](_[_0x14b5('0x44')](_0x15f60d['query'],_0x548437[_0x14b5('0x3b')]),_0x3c9686);if(_0x15f60d[_0x14b5('0x39')]['filter']){_0x2487e5[_0x14b5('0x43')]=_[_0x14b5('0x45')](_0x2487e5[_0x14b5('0x43')],{'$or':_[_0x14b5('0x34')](_0x3c9686,function(_0x585fc1){if(_0x585fc1[_0x14b5('0x37')]!==_0x14b5('0x46')){var _0x167478={};_0x167478[_0x585fc1['name']]={'$like':'%'+_0x15f60d[_0x14b5('0x39')]['filter']+'%'};return _0x167478;}})});}_0x2487e5=_['merge']({},_0x2487e5,_0x15f60d[_0x14b5('0x47')]);var _0x1aadf8={'where':_0x2487e5[_0x14b5('0x43')]};return db['FreshdeskConfiguration'][_0x14b5('0x2a')](_0x1aadf8)[_0x14b5('0x1b')](function(_0x2653bf){_0x3f6c74[_0x14b5('0x2a')]=_0x2653bf;if(_0x15f60d['query'][_0x14b5('0x48')]){_0x2487e5[_0x14b5('0x49')]=[{'all':!![]}];}return db[_0x14b5('0x35')][_0x14b5('0x4a')](_0x2487e5);})[_0x14b5('0x1b')](function(_0x2c0ce9){_0x3f6c74[_0x14b5('0x4b')]=_0x2c0ce9;return _0x3f6c74;})[_0x14b5('0x1b')](respondWithFilteredResult(_0x557f1b,_0x2487e5))['catch'](handleError(_0x557f1b,null));};exports[_0x14b5('0x4c')]=function(_0x444e5c,_0x578a2d){var _0x1c4003={'raw':![],'where':{'id':_0x444e5c['params']['id']}},_0x20bd48={};_0x20bd48['model']=_[_0x14b5('0x3a')](db[_0x14b5('0x35')]['rawAttributes']);_0x20bd48[_0x14b5('0x39')]=_[_0x14b5('0x3a')](_0x444e5c[_0x14b5('0x39')]);_0x20bd48[_0x14b5('0x3b')]=_['intersection'](_0x20bd48['model'],_0x20bd48['query']);_0x1c4003[_0x14b5('0x3f')]=_[_0x14b5('0x3c')](_0x20bd48[_0x14b5('0x38')],qs[_0x14b5('0x3d')](_0x444e5c[_0x14b5('0x39')]['fields']));_0x1c4003['attributes']=_0x1c4003[_0x14b5('0x3f')][_0x14b5('0x3e')]?_0x1c4003[_0x14b5('0x3f')]:_0x20bd48[_0x14b5('0x38')];if(_0x444e5c[_0x14b5('0x39')][_0x14b5('0x48')]){_0x1c4003[_0x14b5('0x49')]=[{'all':!![]}];}_0x1c4003=_['merge']({},_0x1c4003,_0x444e5c[_0x14b5('0x47')]);return db[_0x14b5('0x35')][_0x14b5('0x4d')](_0x1c4003)[_0x14b5('0x1b')](handleEntityNotFound(_0x578a2d,null))[_0x14b5('0x1b')](respondWithResult(_0x578a2d,null))[_0x14b5('0x25')](handleError(_0x578a2d,null));};exports['create']=function(_0x480395,_0xf2c904){return db['FreshdeskConfiguration'][_0x14b5('0x4e')](_0x480395[_0x14b5('0x4f')],{})['then'](respondWithResult(_0xf2c904,0xc9))['catch'](handleError(_0xf2c904,null));};exports['update']=function(_0x2e5e7a,_0x531dfe){if(_0x2e5e7a[_0x14b5('0x4f')]['id']){delete _0x2e5e7a['body']['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x2e5e7a['params']['id']}})[_0x14b5('0x1b')](handleEntityNotFound(_0x531dfe,null))['then'](saveUpdates(_0x2e5e7a[_0x14b5('0x4f')],null))[_0x14b5('0x1b')](respondWithResult(_0x531dfe,null))[_0x14b5('0x25')](handleError(_0x531dfe,null));};exports[_0x14b5('0x31')]=function(_0x7ffc95,_0x30f105){return db[_0x14b5('0x35')]['find']({'where':{'id':_0x7ffc95[_0x14b5('0x50')]['id']}})[_0x14b5('0x1b')](handleEntityNotFound(_0x30f105,null))[_0x14b5('0x1b')](removeEntity(_0x30f105,null))['catch'](handleError(_0x30f105,null));};exports[_0x14b5('0x51')]=function(_0x566a83,_0x36956e,_0x15239c){var _0x33c6e4={};var _0x4ecaaa={};var _0x2a4e46;var _0x3e2642;return db[_0x14b5('0x35')][_0x14b5('0x52')]({'where':{'id':_0x566a83[_0x14b5('0x50')]['id']}})['then'](handleEntityNotFound(_0x36956e,null))[_0x14b5('0x1b')](function(_0x36ab08){if(_0x36ab08){_0x2a4e46=_0x36ab08;_0x4ecaaa['model']=_['keys'](db[_0x14b5('0x53')][_0x14b5('0x54')]);_0x4ecaaa[_0x14b5('0x39')]=_['keys'](_0x566a83[_0x14b5('0x39')]);_0x4ecaaa['filters']=_[_0x14b5('0x3c')](_0x4ecaaa[_0x14b5('0x38')],_0x4ecaaa[_0x14b5('0x39')]);_0x33c6e4['attributes']=_[_0x14b5('0x3c')](_0x4ecaaa['model'],qs['fields'](_0x566a83['query'][_0x14b5('0x3d')]));_0x33c6e4[_0x14b5('0x3f')]=_0x33c6e4['attributes'][_0x14b5('0x3e')]?_0x33c6e4[_0x14b5('0x3f')]:_0x4ecaaa[_0x14b5('0x38')];_0x33c6e4['order']=qs[_0x14b5('0x42')](_0x566a83[_0x14b5('0x39')]['sort']);_0x33c6e4['where']=qs[_0x14b5('0x3b')](_[_0x14b5('0x44')](_0x566a83[_0x14b5('0x39')],_0x4ecaaa[_0x14b5('0x3b')]));if(_0x566a83[_0x14b5('0x39')][_0x14b5('0x55')]){_0x33c6e4[_0x14b5('0x43')]=_['merge'](_0x33c6e4[_0x14b5('0x43')],{'$or':_[_0x14b5('0x34')](_0x33c6e4['attributes'],function(_0x169697){var _0x4fc694={};_0x4fc694[_0x169697]={'$like':'%'+_0x566a83[_0x14b5('0x39')][_0x14b5('0x55')]+'%'};return _0x4fc694;})});}_0x33c6e4=_[_0x14b5('0x45')]({},_0x33c6e4,_0x566a83[_0x14b5('0x47')]);return _0x2a4e46[_0x14b5('0x51')](_0x33c6e4);}})[_0x14b5('0x1b')](function(_0x369bee){if(_0x369bee){_0x3e2642=_0x369bee[_0x14b5('0x3e')];if(!_0x566a83[_0x14b5('0x39')][_0x14b5('0x56')](_0x14b5('0x40'))){_0x33c6e4[_0x14b5('0x2c')]=qs[_0x14b5('0x2c')](_0x566a83[_0x14b5('0x39')][_0x14b5('0x2c')]);_0x33c6e4[_0x14b5('0x2b')]=qs[_0x14b5('0x2b')](_0x566a83[_0x14b5('0x39')][_0x14b5('0x2b')]);}return _0x2a4e46[_0x14b5('0x51')](_0x33c6e4);}})[_0x14b5('0x1b')](function(_0x2f9f4c){if(_0x2f9f4c){return _0x2f9f4c?{'count':_0x3e2642,'rows':_0x2f9f4c}:null;}})[_0x14b5('0x1b')](respondWithResult(_0x36956e,null))['catch'](handleError(_0x36956e,null));};exports[_0x14b5('0x57')]=function(_0x3686f4,_0x4b1bf9,_0x5e88cf){var _0x24e3af={};var _0x4bc47c={};var _0x2dff9a;var _0x545d60;return db['FreshdeskConfiguration'][_0x14b5('0x52')]({'where':{'id':_0x3686f4[_0x14b5('0x50')]['id']}})['then'](handleEntityNotFound(_0x4b1bf9,null))[_0x14b5('0x1b')](function(_0x570bc9){if(_0x570bc9){_0x2dff9a=_0x570bc9;_0x4bc47c[_0x14b5('0x38')]=_[_0x14b5('0x3a')](db['FreshdeskField']['rawAttributes']);_0x4bc47c[_0x14b5('0x39')]=_['keys'](_0x3686f4[_0x14b5('0x39')]);_0x4bc47c['filters']=_[_0x14b5('0x3c')](_0x4bc47c[_0x14b5('0x38')],_0x4bc47c['query']);_0x24e3af[_0x14b5('0x3f')]=_[_0x14b5('0x3c')](_0x4bc47c[_0x14b5('0x38')],qs['fields'](_0x3686f4[_0x14b5('0x39')]['fields']));_0x24e3af[_0x14b5('0x3f')]=_0x24e3af[_0x14b5('0x3f')][_0x14b5('0x3e')]?_0x24e3af['attributes']:_0x4bc47c['model'];_0x24e3af[_0x14b5('0x41')]=qs[_0x14b5('0x42')](_0x3686f4[_0x14b5('0x39')][_0x14b5('0x42')]);_0x24e3af['where']=qs['filters'](_[_0x14b5('0x44')](_0x3686f4[_0x14b5('0x39')],_0x4bc47c[_0x14b5('0x3b')]));if(_0x3686f4[_0x14b5('0x39')]['filter']){_0x24e3af[_0x14b5('0x43')]=_[_0x14b5('0x45')](_0x24e3af[_0x14b5('0x43')],{'$or':_[_0x14b5('0x34')](_0x24e3af[_0x14b5('0x3f')],function(_0x59f226){var _0x324b09={};_0x324b09[_0x59f226]={'$like':'%'+_0x3686f4[_0x14b5('0x39')][_0x14b5('0x55')]+'%'};return _0x324b09;})});}_0x24e3af=_['merge']({},_0x24e3af,_0x3686f4['options']);return _0x2dff9a[_0x14b5('0x57')](_0x24e3af);}})[_0x14b5('0x1b')](function(_0x5d5b69){if(_0x5d5b69){_0x545d60=_0x5d5b69[_0x14b5('0x3e')];if(!_0x3686f4[_0x14b5('0x39')][_0x14b5('0x56')]('nolimit')){_0x24e3af[_0x14b5('0x2c')]=qs['limit'](_0x3686f4[_0x14b5('0x39')][_0x14b5('0x2c')]);_0x24e3af[_0x14b5('0x2b')]=qs[_0x14b5('0x2b')](_0x3686f4[_0x14b5('0x39')][_0x14b5('0x2b')]);}return _0x2dff9a[_0x14b5('0x57')](_0x24e3af);}})[_0x14b5('0x1b')](function(_0x48ddb4){if(_0x48ddb4){return _0x48ddb4?{'count':_0x545d60,'rows':_0x48ddb4}:null;}})[_0x14b5('0x1b')](respondWithResult(_0x4b1bf9,null))[_0x14b5('0x25')](handleError(_0x4b1bf9,null));};exports[_0x14b5('0x58')]=function(_0x523040,_0x4a51a0,_0x18733f){var _0x34501e={};var _0x264c4c={};var _0x559628;var _0x5d7e36;return db[_0x14b5('0x35')][_0x14b5('0x52')]({'where':{'id':_0x523040['params']['id']}})['then'](handleEntityNotFound(_0x4a51a0,null))[_0x14b5('0x1b')](function(_0x298c24){if(_0x298c24){_0x559628=_0x298c24;_0x264c4c[_0x14b5('0x38')]=_['keys'](db[_0x14b5('0x53')][_0x14b5('0x54')]);_0x264c4c['query']=_[_0x14b5('0x3a')](_0x523040[_0x14b5('0x39')]);_0x264c4c['filters']=_[_0x14b5('0x3c')](_0x264c4c[_0x14b5('0x38')],_0x264c4c[_0x14b5('0x39')]);_0x34501e[_0x14b5('0x3f')]=_[_0x14b5('0x3c')](_0x264c4c[_0x14b5('0x38')],qs[_0x14b5('0x3d')](_0x523040['query']['fields']));_0x34501e[_0x14b5('0x3f')]=_0x34501e[_0x14b5('0x3f')][_0x14b5('0x3e')]?_0x34501e[_0x14b5('0x3f')]:_0x264c4c['model'];_0x34501e['order']=qs[_0x14b5('0x42')](_0x523040[_0x14b5('0x39')][_0x14b5('0x42')]);_0x34501e[_0x14b5('0x43')]=qs[_0x14b5('0x3b')](_[_0x14b5('0x44')](_0x523040[_0x14b5('0x39')],_0x264c4c[_0x14b5('0x3b')]));if(_0x523040['query'][_0x14b5('0x55')]){_0x34501e[_0x14b5('0x43')]=_['merge'](_0x34501e['where'],{'$or':_['map'](_0x34501e[_0x14b5('0x3f')],function(_0x5241fb){var _0x4364ff={};_0x4364ff[_0x5241fb]={'$like':'%'+_0x523040[_0x14b5('0x39')][_0x14b5('0x55')]+'%'};return _0x4364ff;})});}_0x34501e=_['merge']({},_0x34501e,_0x523040['options']);return _0x559628[_0x14b5('0x58')](_0x34501e);}})[_0x14b5('0x1b')](function(_0x329af5){if(_0x329af5){_0x5d7e36=_0x329af5['length'];if(!_0x523040[_0x14b5('0x39')][_0x14b5('0x56')](_0x14b5('0x40'))){_0x34501e[_0x14b5('0x2c')]=qs['limit'](_0x523040[_0x14b5('0x39')]['limit']);_0x34501e[_0x14b5('0x2b')]=qs['offset'](_0x523040[_0x14b5('0x39')]['offset']);}return _0x559628[_0x14b5('0x58')](_0x34501e);}})[_0x14b5('0x1b')](function(_0x849c4b){if(_0x849c4b){return _0x849c4b?{'count':_0x5d7e36,'rows':_0x849c4b}:null;}})['then'](respondWithResult(_0x4a51a0,null))[_0x14b5('0x25')](handleError(_0x4a51a0,null));};exports['getTags']=function(_0x38c9a5,_0x546753,_0x4f297c){var _0x13ccae={};var _0x12ac84={};var _0x2e07a6;var _0x354eaf;return db[_0x14b5('0x35')]['findOne']({'where':{'id':_0x38c9a5[_0x14b5('0x50')]['id']}})[_0x14b5('0x1b')](handleEntityNotFound(_0x546753,null))['then'](function(_0x463858){if(_0x463858){_0x2e07a6=_0x463858;_0x12ac84[_0x14b5('0x38')]=_['keys'](db[_0x14b5('0x59')][_0x14b5('0x54')]);_0x12ac84[_0x14b5('0x39')]=_[_0x14b5('0x3a')](_0x38c9a5[_0x14b5('0x39')]);_0x12ac84[_0x14b5('0x3b')]=_['intersection'](_0x12ac84['model'],_0x12ac84[_0x14b5('0x39')]);_0x13ccae[_0x14b5('0x3f')]=_['intersection'](_0x12ac84[_0x14b5('0x38')],qs[_0x14b5('0x3d')](_0x38c9a5['query'][_0x14b5('0x3d')]));_0x13ccae[_0x14b5('0x3f')]=_0x13ccae[_0x14b5('0x3f')][_0x14b5('0x3e')]?_0x13ccae[_0x14b5('0x3f')]:_0x12ac84[_0x14b5('0x38')];_0x13ccae[_0x14b5('0x41')]=qs[_0x14b5('0x42')](_0x38c9a5[_0x14b5('0x39')][_0x14b5('0x42')]);_0x13ccae['where']=qs[_0x14b5('0x3b')](_[_0x14b5('0x44')](_0x38c9a5[_0x14b5('0x39')],_0x12ac84['filters']));if(_0x38c9a5[_0x14b5('0x39')][_0x14b5('0x55')]){_0x13ccae[_0x14b5('0x43')]=_[_0x14b5('0x45')](_0x13ccae['where'],{'$or':_[_0x14b5('0x34')](_0x13ccae[_0x14b5('0x3f')],function(_0x1e7bb8){var _0x40f2f9={};_0x40f2f9[_0x1e7bb8]={'$like':'%'+_0x38c9a5['query'][_0x14b5('0x55')]+'%'};return _0x40f2f9;})});}_0x13ccae=_[_0x14b5('0x45')]({},_0x13ccae,_0x38c9a5[_0x14b5('0x47')]);return _0x2e07a6[_0x14b5('0x5a')](_0x13ccae);}})[_0x14b5('0x1b')](function(_0x4bc49a){if(_0x4bc49a){_0x354eaf=_0x4bc49a[_0x14b5('0x3e')];if(!_0x38c9a5['query'][_0x14b5('0x56')](_0x14b5('0x40'))){_0x13ccae['limit']=qs[_0x14b5('0x2c')](_0x38c9a5['query'][_0x14b5('0x2c')]);_0x13ccae[_0x14b5('0x2b')]=qs[_0x14b5('0x2b')](_0x38c9a5[_0x14b5('0x39')][_0x14b5('0x2b')]);}return _0x2e07a6[_0x14b5('0x5a')](_0x13ccae);}})[_0x14b5('0x1b')](function(_0x48bf34){if(_0x48bf34){return _0x48bf34?{'count':_0x354eaf,'rows':_0x48bf34}:null;}})[_0x14b5('0x1b')](respondWithResult(_0x546753,null))[_0x14b5('0x25')](handleError(_0x546753,null));};exports[_0x14b5('0x5b')]=function(_0x14310f,_0x1ef079,_0x1d3e2d){if(_0x14310f['body']['id']){delete _0x14310f['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x14310f[_0x14b5('0x50')]['id']}})[_0x14b5('0x1b')](handleEntityNotFound(_0x1ef079,null))['then'](function(_0x546ad8){if(_0x546ad8){return _0x546ad8['setTags'](_0x14310f[_0x14b5('0x4f')][_0x14b5('0x5c')]||[]);}return null;})[_0x14b5('0x1b')](respondWithResult(_0x1ef079,null))[_0x14b5('0x25')](handleError(_0x1ef079,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index c4fe46b..a53a6db 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 _0x2200=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','int_freshdesk_configurations','lodash','util','../../config/logger'];(function(_0x7129ea,_0x57833e){var _0x30a7ea=function(_0x5d89a5){while(--_0x5d89a5){_0x7129ea['push'](_0x7129ea['shift']());}};_0x30a7ea(++_0x57833e);}(_0x2200,0x135));var _0x0220=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0x2200[_0x26a906];return _0x495575;};'use strict';var _=require(_0x0220('0x0'));var util=require(_0x0220('0x1'));var logger=require(_0x0220('0x2'))(_0x0220('0x3'));var moment=require(_0x0220('0x4'));var BPromise=require(_0x0220('0x5'));var rp=require(_0x0220('0x6'));var fs=require('fs');var path=require(_0x0220('0x7'));var rimraf=require(_0x0220('0x8'));var config=require(_0x0220('0x9'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x0220('0xa')]=function(_0x8c1d7c,_0x2e345c){return _0x8c1d7c['define']('FreshdeskConfiguration',attributes,{'tableName':_0x0220('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb605=['moment','request-promise','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','api'];(function(_0x43c997,_0x58d111){var _0x3ee32d=function(_0x5395d5){while(--_0x5395d5){_0x43c997['push'](_0x43c997['shift']());}};_0x3ee32d(++_0x58d111);}(_0xb605,0x184));var _0x5b60=function(_0x65d12e,_0x4b0a30){_0x65d12e=_0x65d12e-0x0;var _0x4274e0=_0xb605[_0x65d12e];return _0x4274e0;};'use strict';var _=require(_0x5b60('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5b60('0x1'));var moment=require(_0x5b60('0x2'));var BPromise=require('bluebird');var rp=require(_0x5b60('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5b60('0x4'));var attributes=require(_0x5b60('0x5'));module[_0x5b60('0x6')]=function(_0x13e308,_0x53947a){return _0x13e308[_0x5b60('0x7')](_0x5b60('0x8'),attributes,{'tableName':_0x5b60('0x9'),'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 cf074e3..c28f893 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 _0x2d0f=['client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x21f4cb,_0xf0f7db){var _0x129276=function(_0x5d73f9){while(--_0x5d73f9){_0x21f4cb['push'](_0x21f4cb['shift']());}};_0x129276(++_0xf0f7db);}(_0x2d0f,0x19e));var _0xf2d0=function(_0x5d770a,_0xf5448c){_0x5d770a=_0x5d770a-0x0;var _0x3e435e=_0x2d0f[_0x5d770a];return _0x3e435e;};'use strict';var _=require(_0xf2d0('0x0'));var util=require(_0xf2d0('0x1'));var moment=require(_0xf2d0('0x2'));var BPromise=require(_0xf2d0('0x3'));var rs=require(_0xf2d0('0x4'));var fs=require('fs');var Redis=require(_0xf2d0('0x5'));var db=require(_0xf2d0('0x6'))['db'];var utils=require(_0xf2d0('0x7'));var logger=require(_0xf2d0('0x8'))('rpc');var config=require(_0xf2d0('0x9'));var jayson=require(_0xf2d0('0xa'));var client=jayson[_0xf2d0('0xb')][_0xf2d0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x35971d,_0x467457,_0x542cf8){return new BPromise(function(_0x2d9ce2,_0x2344f9){return client[_0xf2d0('0xd')](_0x35971d,_0x542cf8)[_0xf2d0('0xe')](function(_0x278811){logger[_0xf2d0('0xf')](_0xf2d0('0x10'),_0x467457,_0xf2d0('0x11'));logger[_0xf2d0('0x12')](_0xf2d0('0x13'),_0x467457,'request\x20sent',JSON[_0xf2d0('0x14')](_0x278811));if(_0x278811[_0xf2d0('0x15')]){if(_0x278811[_0xf2d0('0x15')][_0xf2d0('0x16')]===0x1f4){logger['error'](_0xf2d0('0x10'),_0x467457,_0x278811[_0xf2d0('0x15')][_0xf2d0('0x17')]);return _0x2344f9(_0x278811['error']['message']);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x467457,_0x278811[_0xf2d0('0x15')]['message']);return _0x2d9ce2(_0x278811['error'][_0xf2d0('0x17')]);}else{logger[_0xf2d0('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x467457,'request\x20sent');_0x2d9ce2(_0x278811[_0xf2d0('0x18')][_0xf2d0('0x17')]);}})['catch'](function(_0x201694){logger[_0xf2d0('0x15')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x467457,_0x201694);_0x2344f9(_0x201694);});});} \ No newline at end of file +var _0xc115=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0xc115,0x83));var _0x5c11=function(_0x3889d9,_0x334950){_0x3889d9=_0x3889d9-0x0;var _0x3ef146=_0xc115[_0x3889d9];return _0x3ef146;};'use strict';var _=require(_0x5c11('0x0'));var util=require(_0x5c11('0x1'));var moment=require(_0x5c11('0x2'));var BPromise=require(_0x5c11('0x3'));var rs=require(_0x5c11('0x4'));var fs=require('fs');var Redis=require(_0x5c11('0x5'));var db=require(_0x5c11('0x6'))['db'];var utils=require(_0x5c11('0x7'));var logger=require(_0x5c11('0x8'))(_0x5c11('0x9'));var config=require(_0x5c11('0xa'));var jayson=require(_0x5c11('0xb'));var client=jayson[_0x5c11('0xc')][_0x5c11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c5067,_0x2db1ac,_0x2e9cae){return new BPromise(function(_0xd862a2,_0x349235){return client[_0x5c11('0xe')](_0x3c5067,_0x2e9cae)[_0x5c11('0xf')](function(_0x115dfb){logger[_0x5c11('0x10')](_0x5c11('0x11'),_0x2db1ac,_0x5c11('0x12'));logger[_0x5c11('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2db1ac,_0x5c11('0x12'),JSON[_0x5c11('0x14')](_0x115dfb));if(_0x115dfb[_0x5c11('0x15')]){if(_0x115dfb[_0x5c11('0x15')][_0x5c11('0x16')]===0x1f4){logger[_0x5c11('0x15')](_0x5c11('0x11'),_0x2db1ac,_0x115dfb[_0x5c11('0x15')][_0x5c11('0x17')]);return _0x349235(_0x115dfb[_0x5c11('0x15')]['message']);}logger[_0x5c11('0x15')](_0x5c11('0x11'),_0x2db1ac,_0x115dfb['error']['message']);return _0xd862a2(_0x115dfb[_0x5c11('0x15')][_0x5c11('0x17')]);}else{logger['info'](_0x5c11('0x11'),_0x2db1ac,_0x5c11('0x12'));_0xd862a2(_0x115dfb[_0x5c11('0x18')][_0x5c11('0x17')]);}})[_0x5c11('0x19')](function(_0x1c2d83){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2db1ac,_0x1c2d83);_0x349235(_0x1c2d83);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 7c3f328..10c6f00 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 _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x5a8111,_0x2f66c8){var _0x55311c=function(_0x381a25){while(--_0x381a25){_0x5a8111['push'](_0x5a8111['shift']());}};_0x55311c(++_0x2f66c8);}(_0x008c,0x188));var _0xc008=function(_0x21d383,_0x71056d){_0x21d383=_0x21d383-0x0;var _0x3ea4a5=_0x008c[_0x21d383];return _0x3ea4a5;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file +var _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x11c98c,_0x418789){var _0xe4ec92=function(_0x5ec5fc){while(--_0x5ec5fc){_0x11c98c['push'](_0x11c98c['shift']());}};_0xe4ec92(++_0x418789);}(_0x008c,0x188));var _0xc008=function(_0xae5e3c,_0x1a07bf){_0xae5e3c=_0xae5e3c-0x0;var _0x5c87b8=_0x008c[_0xae5e3c];return _0x5c87b8;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 6644b60..793f95c 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 _0x1c88=['string','variable','STRING','customVariable','BOOLEAN','sequelize','ENUM'];(function(_0x4d560a,_0x48d9dd){var _0x368b51=function(_0x4124a8){while(--_0x4124a8){_0x4d560a['push'](_0x4d560a['shift']());}};_0x368b51(++_0x48d9dd);}(_0x1c88,0x1a9));var _0x81c8=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0x1c88[_0x3f2fea];return _0x69a4d5;};'use strict';var Sequelize=require(_0x81c8('0x0'));module['exports']={'type':{'type':Sequelize[_0x81c8('0x1')](_0x81c8('0x2'),_0x81c8('0x3'),'customVariable','keyValue'),'defaultValue':_0x81c8('0x2')},'content':{'type':Sequelize[_0x81c8('0x4')]},'key':{'type':Sequelize[_0x81c8('0x4')]},'keyType':{'type':Sequelize[_0x81c8('0x1')](_0x81c8('0x2'),_0x81c8('0x3'),_0x81c8('0x5'))},'keyContent':{'type':Sequelize[_0x81c8('0x4')]},'idField':{'type':Sequelize[_0x81c8('0x4')]},'nameField':{'type':Sequelize[_0x81c8('0x4')]},'customField':{'type':Sequelize[_0x81c8('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x81c8('0x4')]}}; \ No newline at end of file +var _0xd7ff=['sequelize','exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0xd7ff,0x100));var _0xfd7f=function(_0xc88a95,_0x132392){_0xc88a95=_0xc88a95-0x0;var _0x5ae1b2=_0xd7ff[_0xc88a95];return _0x5ae1b2;};'use strict';var Sequelize=require(_0xfd7f('0x0'));module[_0xfd7f('0x1')]={'type':{'type':Sequelize[_0xfd7f('0x2')](_0xfd7f('0x3'),_0xfd7f('0x4'),_0xfd7f('0x5'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xfd7f('0x6')]},'key':{'type':Sequelize[_0xfd7f('0x6')]},'keyType':{'type':Sequelize[_0xfd7f('0x2')](_0xfd7f('0x3'),'variable',_0xfd7f('0x5'))},'keyContent':{'type':Sequelize[_0xfd7f('0x6')]},'idField':{'type':Sequelize[_0xfd7f('0x6')]},'nameField':{'type':Sequelize[_0xfd7f('0x6')]},'customField':{'type':Sequelize[_0xfd7f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfd7f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 3a243a9..587feb6 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 _0x6b6d=['set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','FreshdeskField','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','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'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6b6d,0xbd));var _0xd6b6=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0x6b6d[_0xa3463d];return _0x50fd67;};'use strict';var pdf=require(_0xd6b6('0x0'));var emlformat=require(_0xd6b6('0x1'));var rimraf=require(_0xd6b6('0x2'));var zipdir=require(_0xd6b6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6b6('0x4'));var moment=require(_0xd6b6('0x5'));var BPromise=require(_0xd6b6('0x6'));var Mustache=require(_0xd6b6('0x7'));var util=require('util');var path=require(_0xd6b6('0x8'));var sox=require(_0xd6b6('0x9'));var csv=require(_0xd6b6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd6b6('0xb'));var squel=require(_0xd6b6('0xc'));var crypto=require(_0xd6b6('0xd'));var jsforce=require(_0xd6b6('0xe'));var deskjs=require(_0xd6b6('0xf'));var toCsv=require(_0xd6b6('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd6b6('0x10'));var authService=require(_0xd6b6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd6b6('0x12'));var hardwareService=require(_0xd6b6('0x13'));var logger=require(_0xd6b6('0x14'))(_0xd6b6('0x15'));var utils=require(_0xd6b6('0x16'));var config=require(_0xd6b6('0x17'));var licenseUtil=require(_0xd6b6('0x18'));var db=require(_0xd6b6('0x19'))['db'];function respondWithStatusCode(_0x39f337,_0x4c423a){_0x4c423a=_0x4c423a||0xcc;return function(_0x90c080){if(_0x90c080){return _0x39f337[_0xd6b6('0x1a')](_0x4c423a);}return _0x39f337[_0xd6b6('0x1b')](_0x4c423a)[_0xd6b6('0x1c')]();};}function respondWithResult(_0x4fa74c,_0x427410){_0x427410=_0x427410||0xc8;return function(_0x308f04){if(_0x308f04){return _0x4fa74c[_0xd6b6('0x1b')](_0x427410)[_0xd6b6('0x1d')](_0x308f04);}};}function respondWithFilteredResult(_0x3f0d23,_0x1d5fff){return function(_0x224b75){if(_0x224b75){var _0x274b04=_0x224b75[_0xd6b6('0x1e')],_0x2dbe4e=_0x1d5fff[_0xd6b6('0x1f')],_0x1b4729=_0x1d5fff[_0xd6b6('0x1f')]+_0x1d5fff[_0xd6b6('0x20')],_0x2d3464;if(_0x1b4729>=_0x274b04){_0x1b4729=_0x274b04;_0x2d3464=0xc8;}else{_0x2d3464=0xce;}_0x3f0d23['status'](_0x2d3464);return _0x3f0d23[_0xd6b6('0x21')](_0xd6b6('0x22'),_0x2dbe4e+'-'+_0x1b4729+'/'+_0x274b04)[_0xd6b6('0x1d')](_0x224b75);}return null;};}function patchUpdates(_0x777096){return function(_0x48b7c4){try{jsonpatch[_0xd6b6('0x23')](_0x48b7c4,_0x777096,!![]);}catch(_0x49c545){return BPromise['reject'](_0x49c545);}return _0x48b7c4[_0xd6b6('0x24')]();};}function saveUpdates(_0x1eb04a,_0x383248){return function(_0x3ab945){if(_0x3ab945){return _0x3ab945[_0xd6b6('0x25')](_0x1eb04a)[_0xd6b6('0x26')](function(_0x116e4d){return _0x116e4d;});}return null;};}function removeEntity(_0x208032,_0x146e4d){return function(_0x575cae){if(_0x575cae){return _0x575cae[_0xd6b6('0x27')]()['then'](function(){_0x208032['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x468621,_0x4d8339){return function(_0x26d577){if(!_0x26d577){_0x468621['sendStatus'](0x194);}return _0x26d577;};}function handleError(_0x10c2d9,_0x235bee){_0x235bee=_0x235bee||0x1f4;return function(_0x27b03a){logger[_0xd6b6('0x28')](_0x27b03a[_0xd6b6('0x29')]);if(_0x27b03a[_0xd6b6('0x2a')]){delete _0x27b03a[_0xd6b6('0x2a')];}_0x10c2d9[_0xd6b6('0x1b')](_0x235bee)[_0xd6b6('0x2b')](_0x27b03a);};}exports['index']=function(_0x463787,_0x55f91c){var _0x4d16fc={},_0x269c3a={},_0xa444e4={'count':0x0,'rows':[]};var _0x31c774=_[_0xd6b6('0x2c')](db[_0xd6b6('0x2d')]['rawAttributes'],function(_0x52b640){return{'name':_0x52b640['fieldName'],'type':_0x52b640[_0xd6b6('0x2e')]['key']};});_0x269c3a[_0xd6b6('0x2f')]=_['map'](_0x31c774,_0xd6b6('0x2a'));_0x269c3a[_0xd6b6('0x30')]=_[_0xd6b6('0x31')](_0x463787[_0xd6b6('0x30')]);_0x269c3a[_0xd6b6('0x32')]=_[_0xd6b6('0x33')](_0x269c3a['model'],_0x269c3a[_0xd6b6('0x30')]);_0x4d16fc['attributes']=_[_0xd6b6('0x33')](_0x269c3a[_0xd6b6('0x2f')],qs[_0xd6b6('0x34')](_0x463787[_0xd6b6('0x30')][_0xd6b6('0x34')]));_0x4d16fc[_0xd6b6('0x35')]=_0x4d16fc[_0xd6b6('0x35')][_0xd6b6('0x36')]?_0x4d16fc[_0xd6b6('0x35')]:_0x269c3a['model'];if(!_0x463787[_0xd6b6('0x30')][_0xd6b6('0x37')](_0xd6b6('0x38'))){_0x4d16fc[_0xd6b6('0x20')]=qs['limit'](_0x463787[_0xd6b6('0x30')]['limit']);_0x4d16fc[_0xd6b6('0x1f')]=qs['offset'](_0x463787[_0xd6b6('0x30')][_0xd6b6('0x1f')]);}_0x4d16fc[_0xd6b6('0x39')]=qs[_0xd6b6('0x3a')](_0x463787[_0xd6b6('0x30')][_0xd6b6('0x3a')]);_0x4d16fc[_0xd6b6('0x3b')]=qs[_0xd6b6('0x32')](_['pick'](_0x463787[_0xd6b6('0x30')],_0x269c3a[_0xd6b6('0x32')]),_0x31c774);if(_0x463787['query'][_0xd6b6('0x3c')]){_0x4d16fc['where']=_['merge'](_0x4d16fc[_0xd6b6('0x3b')],{'$or':_[_0xd6b6('0x2c')](_0x31c774,function(_0x319b79){if(_0x319b79['type']!==_0xd6b6('0x3d')){var _0x5a9cdc={};_0x5a9cdc[_0x319b79[_0xd6b6('0x2a')]]={'$like':'%'+_0x463787[_0xd6b6('0x30')]['filter']+'%'};return _0x5a9cdc;}})});}_0x4d16fc=_[_0xd6b6('0x3e')]({},_0x4d16fc,_0x463787['options']);var _0x36f2db={'where':_0x4d16fc['where']};return db[_0xd6b6('0x2d')][_0xd6b6('0x1e')](_0x36f2db)[_0xd6b6('0x26')](function(_0xce37fa){_0xa444e4['count']=_0xce37fa;if(_0x463787[_0xd6b6('0x30')][_0xd6b6('0x3f')]){_0x4d16fc[_0xd6b6('0x40')]=[{'all':!![]}];}return db['FreshdeskField'][_0xd6b6('0x41')](_0x4d16fc);})[_0xd6b6('0x26')](function(_0x282b2f){_0xa444e4[_0xd6b6('0x42')]=_0x282b2f;return _0xa444e4;})['then'](respondWithFilteredResult(_0x55f91c,_0x4d16fc))['catch'](handleError(_0x55f91c,null));};exports[_0xd6b6('0x43')]=function(_0x259eab,_0x4ef6fb){var _0x188fc2={'raw':!![],'where':{'id':_0x259eab[_0xd6b6('0x44')]['id']}},_0x483cff={};_0x483cff['model']=_[_0xd6b6('0x31')](db['FreshdeskField'][_0xd6b6('0x45')]);_0x483cff[_0xd6b6('0x30')]=_[_0xd6b6('0x31')](_0x259eab[_0xd6b6('0x30')]);_0x483cff['filters']=_['intersection'](_0x483cff[_0xd6b6('0x2f')],_0x483cff['query']);_0x188fc2[_0xd6b6('0x35')]=_[_0xd6b6('0x33')](_0x483cff[_0xd6b6('0x2f')],qs['fields'](_0x259eab[_0xd6b6('0x30')][_0xd6b6('0x34')]));_0x188fc2[_0xd6b6('0x35')]=_0x188fc2[_0xd6b6('0x35')][_0xd6b6('0x36')]?_0x188fc2[_0xd6b6('0x35')]:_0x483cff[_0xd6b6('0x2f')];if(_0x259eab[_0xd6b6('0x30')]['includeAll']){_0x188fc2[_0xd6b6('0x40')]=[{'all':!![]}];}_0x188fc2=_['merge']({},_0x188fc2,_0x259eab['options']);return db['FreshdeskField'][_0xd6b6('0x46')](_0x188fc2)[_0xd6b6('0x26')](handleEntityNotFound(_0x4ef6fb,null))[_0xd6b6('0x26')](respondWithResult(_0x4ef6fb,null))['catch'](handleError(_0x4ef6fb,null));};exports[_0xd6b6('0x47')]=function(_0x1b26d9,_0x3a224c){return db[_0xd6b6('0x2d')][_0xd6b6('0x47')](_0x1b26d9[_0xd6b6('0x48')],{})[_0xd6b6('0x26')](respondWithResult(_0x3a224c,0xc9))[_0xd6b6('0x49')](handleError(_0x3a224c,null));};exports[_0xd6b6('0x25')]=function(_0x187f70,_0x13583d){if(_0x187f70[_0xd6b6('0x48')]['id']){delete _0x187f70[_0xd6b6('0x48')]['id'];}return db['FreshdeskField'][_0xd6b6('0x46')]({'where':{'id':_0x187f70[_0xd6b6('0x44')]['id']}})[_0xd6b6('0x26')](handleEntityNotFound(_0x13583d,null))[_0xd6b6('0x26')](saveUpdates(_0x187f70[_0xd6b6('0x48')],null))[_0xd6b6('0x26')](respondWithResult(_0x13583d,null))[_0xd6b6('0x49')](handleError(_0x13583d,null));};exports['destroy']=function(_0x58966c,_0x3d2efa){return db[_0xd6b6('0x2d')][_0xd6b6('0x46')]({'where':{'id':_0x58966c[_0xd6b6('0x44')]['id']}})[_0xd6b6('0x26')](handleEntityNotFound(_0x3d2efa,null))[_0xd6b6('0x26')](removeEntity(_0x3d2efa,null))[_0xd6b6('0x49')](handleError(_0x3d2efa,null));}; \ No newline at end of file +var _0xa630=['limit','set','Content-Range','reject','update','then','destroy','end','sendStatus','stack','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','catch','create','body','html-pdf','eml-format','fast-json-patch','moment','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','../../mysqldb','status','json','count','offset'];(function(_0x5e9689,_0x48e034){var _0x2fac94=function(_0x1e8f97){while(--_0x1e8f97){_0x5e9689['push'](_0x5e9689['shift']());}};_0x2fac94(++_0x48e034);}(_0xa630,0xbe));var _0x0a63=function(_0x1adf4a,_0x55d81f){_0x1adf4a=_0x1adf4a-0x0;var _0x20c377=_0xa630[_0x1adf4a];return _0x20c377;};'use strict';var pdf=require(_0x0a63('0x0'));var emlformat=require(_0x0a63('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0a63('0x2'));var rp=require('request-promise');var moment=require(_0x0a63('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a63('0x4'));var util=require(_0x0a63('0x5'));var path=require(_0x0a63('0x6'));var sox=require(_0x0a63('0x7'));var csv=require(_0x0a63('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x8'));var querystring=require('querystring');var Papa=require(_0x0a63('0xe'));var Redis=require(_0x0a63('0xf'));var authService=require(_0x0a63('0x10'));var qs=require(_0x0a63('0x11'));var as=require(_0x0a63('0x12'));var hardwareService=require(_0x0a63('0x13'));var logger=require(_0x0a63('0x14'))(_0x0a63('0x15'));var utils=require(_0x0a63('0x16'));var config=require(_0x0a63('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a63('0x18'))['db'];function respondWithStatusCode(_0x420043,_0x2fce86){_0x2fce86=_0x2fce86||0xcc;return function(_0x3d6323){if(_0x3d6323){return _0x420043['sendStatus'](_0x2fce86);}return _0x420043[_0x0a63('0x19')](_0x2fce86)['end']();};}function respondWithResult(_0x331e99,_0x19e922){_0x19e922=_0x19e922||0xc8;return function(_0x26b2bc){if(_0x26b2bc){return _0x331e99[_0x0a63('0x19')](_0x19e922)[_0x0a63('0x1a')](_0x26b2bc);}};}function respondWithFilteredResult(_0x23b49d,_0x552b1f){return function(_0x1e3251){if(_0x1e3251){var _0x524a98=_0x1e3251[_0x0a63('0x1b')],_0x47788e=_0x552b1f[_0x0a63('0x1c')],_0x56b314=_0x552b1f[_0x0a63('0x1c')]+_0x552b1f[_0x0a63('0x1d')],_0x282856;if(_0x56b314>=_0x524a98){_0x56b314=_0x524a98;_0x282856=0xc8;}else{_0x282856=0xce;}_0x23b49d[_0x0a63('0x19')](_0x282856);return _0x23b49d[_0x0a63('0x1e')](_0x0a63('0x1f'),_0x47788e+'-'+_0x56b314+'/'+_0x524a98)[_0x0a63('0x1a')](_0x1e3251);}return null;};}function patchUpdates(_0x3cc74d){return function(_0x2ad167){try{jsonpatch['apply'](_0x2ad167,_0x3cc74d,!![]);}catch(_0x550568){return BPromise[_0x0a63('0x20')](_0x550568);}return _0x2ad167['save']();};}function saveUpdates(_0x2fc87c,_0x5937df){return function(_0x58513d){if(_0x58513d){return _0x58513d[_0x0a63('0x21')](_0x2fc87c)[_0x0a63('0x22')](function(_0x46b968){return _0x46b968;});}return null;};}function removeEntity(_0x5da46b,_0x398a16){return function(_0x4c225a){if(_0x4c225a){return _0x4c225a[_0x0a63('0x23')]()[_0x0a63('0x22')](function(){_0x5da46b[_0x0a63('0x19')](0xcc)[_0x0a63('0x24')]();});}};}function handleEntityNotFound(_0x343273,_0x1f929f){return function(_0x263236){if(!_0x263236){_0x343273[_0x0a63('0x25')](0x194);}return _0x263236;};}function handleError(_0x567017,_0x5e5987){_0x5e5987=_0x5e5987||0x1f4;return function(_0x55fb70){logger['error'](_0x55fb70[_0x0a63('0x26')]);if(_0x55fb70['name']){delete _0x55fb70['name'];}_0x567017[_0x0a63('0x19')](_0x5e5987)[_0x0a63('0x27')](_0x55fb70);};}exports[_0x0a63('0x28')]=function(_0x2e2526,_0x52e7ef){var _0x402692={},_0x498371={},_0x25ab82={'count':0x0,'rows':[]};var _0x5772f8=_[_0x0a63('0x29')](db[_0x0a63('0x2a')][_0x0a63('0x2b')],function(_0x145090){return{'name':_0x145090[_0x0a63('0x2c')],'type':_0x145090[_0x0a63('0x2d')][_0x0a63('0x2e')]};});_0x498371[_0x0a63('0x2f')]=_['map'](_0x5772f8,_0x0a63('0x30'));_0x498371['query']=_[_0x0a63('0x31')](_0x2e2526[_0x0a63('0x32')]);_0x498371[_0x0a63('0x33')]=_[_0x0a63('0x34')](_0x498371[_0x0a63('0x2f')],_0x498371['query']);_0x402692[_0x0a63('0x35')]=_[_0x0a63('0x34')](_0x498371[_0x0a63('0x2f')],qs[_0x0a63('0x36')](_0x2e2526['query'][_0x0a63('0x36')]));_0x402692[_0x0a63('0x35')]=_0x402692['attributes']['length']?_0x402692[_0x0a63('0x35')]:_0x498371['model'];if(!_0x2e2526['query'][_0x0a63('0x37')](_0x0a63('0x38'))){_0x402692['limit']=qs[_0x0a63('0x1d')](_0x2e2526[_0x0a63('0x32')][_0x0a63('0x1d')]);_0x402692[_0x0a63('0x1c')]=qs[_0x0a63('0x1c')](_0x2e2526['query']['offset']);}_0x402692[_0x0a63('0x39')]=qs[_0x0a63('0x3a')](_0x2e2526[_0x0a63('0x32')][_0x0a63('0x3a')]);_0x402692[_0x0a63('0x3b')]=qs[_0x0a63('0x33')](_['pick'](_0x2e2526[_0x0a63('0x32')],_0x498371[_0x0a63('0x33')]),_0x5772f8);if(_0x2e2526['query'][_0x0a63('0x3c')]){_0x402692['where']=_['merge'](_0x402692[_0x0a63('0x3b')],{'$or':_[_0x0a63('0x29')](_0x5772f8,function(_0xdc602c){if(_0xdc602c['type']!==_0x0a63('0x3d')){var _0x35b68e={};_0x35b68e[_0xdc602c[_0x0a63('0x30')]]={'$like':'%'+_0x2e2526[_0x0a63('0x32')][_0x0a63('0x3c')]+'%'};return _0x35b68e;}})});}_0x402692=_[_0x0a63('0x3e')]({},_0x402692,_0x2e2526[_0x0a63('0x3f')]);var _0x4be8e3={'where':_0x402692[_0x0a63('0x3b')]};return db[_0x0a63('0x2a')][_0x0a63('0x1b')](_0x4be8e3)['then'](function(_0x5d9952){_0x25ab82[_0x0a63('0x1b')]=_0x5d9952;if(_0x2e2526['query'][_0x0a63('0x40')]){_0x402692[_0x0a63('0x41')]=[{'all':!![]}];}return db[_0x0a63('0x2a')]['findAll'](_0x402692);})[_0x0a63('0x22')](function(_0x14c737){_0x25ab82[_0x0a63('0x42')]=_0x14c737;return _0x25ab82;})[_0x0a63('0x22')](respondWithFilteredResult(_0x52e7ef,_0x402692))['catch'](handleError(_0x52e7ef,null));};exports[_0x0a63('0x43')]=function(_0x236617,_0x4234cd){var _0x2ccd99={'raw':!![],'where':{'id':_0x236617[_0x0a63('0x44')]['id']}},_0xf18ace={};_0xf18ace['model']=_[_0x0a63('0x31')](db[_0x0a63('0x2a')][_0x0a63('0x2b')]);_0xf18ace[_0x0a63('0x32')]=_[_0x0a63('0x31')](_0x236617[_0x0a63('0x32')]);_0xf18ace[_0x0a63('0x33')]=_[_0x0a63('0x34')](_0xf18ace[_0x0a63('0x2f')],_0xf18ace[_0x0a63('0x32')]);_0x2ccd99[_0x0a63('0x35')]=_[_0x0a63('0x34')](_0xf18ace[_0x0a63('0x2f')],qs[_0x0a63('0x36')](_0x236617[_0x0a63('0x32')][_0x0a63('0x36')]));_0x2ccd99[_0x0a63('0x35')]=_0x2ccd99[_0x0a63('0x35')]['length']?_0x2ccd99[_0x0a63('0x35')]:_0xf18ace['model'];if(_0x236617['query'][_0x0a63('0x40')]){_0x2ccd99[_0x0a63('0x41')]=[{'all':!![]}];}_0x2ccd99=_[_0x0a63('0x3e')]({},_0x2ccd99,_0x236617[_0x0a63('0x3f')]);return db[_0x0a63('0x2a')][_0x0a63('0x45')](_0x2ccd99)[_0x0a63('0x22')](handleEntityNotFound(_0x4234cd,null))[_0x0a63('0x22')](respondWithResult(_0x4234cd,null))[_0x0a63('0x46')](handleError(_0x4234cd,null));};exports[_0x0a63('0x47')]=function(_0x9e5009,_0x98f1e4){return db[_0x0a63('0x2a')][_0x0a63('0x47')](_0x9e5009[_0x0a63('0x48')],{})[_0x0a63('0x22')](respondWithResult(_0x98f1e4,0xc9))[_0x0a63('0x46')](handleError(_0x98f1e4,null));};exports[_0x0a63('0x21')]=function(_0x366887,_0x148e0a){if(_0x366887['body']['id']){delete _0x366887[_0x0a63('0x48')]['id'];}return db[_0x0a63('0x2a')]['find']({'where':{'id':_0x366887['params']['id']}})['then'](handleEntityNotFound(_0x148e0a,null))['then'](saveUpdates(_0x366887[_0x0a63('0x48')],null))[_0x0a63('0x22')](respondWithResult(_0x148e0a,null))['catch'](handleError(_0x148e0a,null));};exports[_0x0a63('0x23')]=function(_0x59c367,_0x3e3680){return db[_0x0a63('0x2a')]['find']({'where':{'id':_0x59c367['params']['id']}})['then'](handleEntityNotFound(_0x3e3680,null))[_0x0a63('0x22')](removeEntity(_0x3e3680,null))[_0x0a63('0x46')](handleError(_0x3e3680,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 83d27b3..dba01cf 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 _0x8107=['define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','exports'];(function(_0x4be151,_0x2ba906){var _0x10c65a=function(_0x2bc6b9){while(--_0x2bc6b9){_0x4be151['push'](_0x4be151['shift']());}};_0x10c65a(++_0x2ba906);}(_0x8107,0x6e));var _0x7810=function(_0x43f9fd,_0x3bb23c){_0x43f9fd=_0x43f9fd-0x0;var _0x15360e=_0x8107[_0x43f9fd];return _0x15360e;};'use strict';var _=require(_0x7810('0x0'));var util=require(_0x7810('0x1'));var logger=require('../../config/logger')(_0x7810('0x2'));var moment=require(_0x7810('0x3'));var BPromise=require(_0x7810('0x4'));var rp=require(_0x7810('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x7810('0x6')]=function(_0x185ed3,_0x4dca41){return _0x185ed3[_0x7810('0x7')](_0x7810('0x8'),attributes,{'tableName':_0x7810('0x9'),'paranoid':![],'indexes':[{'name':_0x7810('0xa'),'fields':[_0x7810('0xb'),_0x7810('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3911=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x2ef3d7,_0xcfdf7a){var _0x44ba40=function(_0x467eff){while(--_0x467eff){_0x2ef3d7['push'](_0x2ef3d7['shift']());}};_0x44ba40(++_0xcfdf7a);}(_0x3911,0x124));var _0x1391=function(_0x2b4895,_0x20c70a){_0x2b4895=_0x2b4895-0x0;var _0x569215=_0x3911[_0x2b4895];return _0x569215;};'use strict';var _=require('lodash');var util=require(_0x1391('0x0'));var logger=require(_0x1391('0x1'))(_0x1391('0x2'));var moment=require('moment');var BPromise=require(_0x1391('0x3'));var rp=require(_0x1391('0x4'));var fs=require('fs');var path=require(_0x1391('0x5'));var rimraf=require(_0x1391('0x6'));var config=require(_0x1391('0x7'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0xfec34,_0x56febe){return _0xfec34[_0x1391('0x8')](_0x1391('0x9'),attributes,{'tableName':_0x1391('0xa'),'paranoid':![],'indexes':[{'name':_0x1391('0xb'),'fields':[_0x1391('0xc'),_0x1391('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 0b288e7..3a19752 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(_0x4687ca,_0x2f5563){var _0x2102d7=function(_0x4ab179){while(--_0x4ab179){_0x4687ca['push'](_0x4687ca['shift']());}};_0x2102d7(++_0x2f5563);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f229e,_0x1b1e6c){_0x4f229e=_0x4f229e-0x0;var _0x407c5e=_0xb10b[_0x4f229e];return _0x407c5e;};'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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x468691,_0x20aad){_0x468691=_0x468691-0x0;var _0x4a33fa=_0x7a54[_0x468691];return _0x4a33fa;};'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 5684517..86b00cb 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 _0x1a2a=['create','post','/:id/configurations','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields'];(function(_0xc12c8f,_0x23c49c){var _0x1cc7df=function(_0x4dac64){while(--_0x4dac64){_0xc12c8f['push'](_0xc12c8f['shift']());}};_0x1cc7df(++_0x23c49c);}(_0x1a2a,0x9f));var _0xa1a2=function(_0x4276aa,_0xbdba9b){_0x4276aa=_0x4276aa-0x0;var _0x2c49f8=_0x1a2a[_0x4276aa];return _0x2c49f8;};'use strict';var multer=require(_0xa1a2('0x0'));var util=require(_0xa1a2('0x1'));var path=require(_0xa1a2('0x2'));var timeout=require(_0xa1a2('0x3'));var express=require(_0xa1a2('0x4'));var router=express[_0xa1a2('0x5')]();var auth=require(_0xa1a2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa1a2('0x7'));var controller=require(_0xa1a2('0x8'));router[_0xa1a2('0x9')]('/',auth[_0xa1a2('0xa')](),controller[_0xa1a2('0xb')]);router[_0xa1a2('0x9')]('/:id',auth[_0xa1a2('0xa')](),controller[_0xa1a2('0xc')]);router[_0xa1a2('0x9')]('/:id/configurations',auth[_0xa1a2('0xa')](),controller[_0xa1a2('0xd')]);router['get'](_0xa1a2('0xe'),auth[_0xa1a2('0xa')](),controller[_0xa1a2('0xf')]);router['post']('/',auth[_0xa1a2('0xa')](),controller[_0xa1a2('0x10')]);router[_0xa1a2('0x11')](_0xa1a2('0x12'),auth[_0xa1a2('0xa')](),controller[_0xa1a2('0x13')]);router[_0xa1a2('0x14')](_0xa1a2('0x15'),auth[_0xa1a2('0xa')](),controller[_0xa1a2('0x16')]);router['delete'](_0xa1a2('0x15'),auth[_0xa1a2('0xa')](),controller[_0xa1a2('0x17')]);module[_0xa1a2('0x18')]=router; \ No newline at end of file +var _0xeba2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x39f72c,_0x2ecc44){var _0x4179f8=function(_0x3e02f1){while(--_0x3e02f1){_0x39f72c['push'](_0x39f72c['shift']());}};_0x4179f8(++_0x2ecc44);}(_0xeba2,0x8e));var _0x2eba=function(_0x35468d,_0x2a7240){_0x35468d=_0x35468d-0x0;var _0x30da52=_0xeba2[_0x35468d];return _0x30da52;};'use strict';var multer=require(_0x2eba('0x0'));var util=require(_0x2eba('0x1'));var path=require(_0x2eba('0x2'));var timeout=require(_0x2eba('0x3'));var express=require('express');var router=express[_0x2eba('0x4')]();var auth=require(_0x2eba('0x5'));var interaction=require(_0x2eba('0x6'));var config=require(_0x2eba('0x7'));var controller=require(_0x2eba('0x8'));router[_0x2eba('0x9')]('/',auth[_0x2eba('0xa')](),controller[_0x2eba('0xb')]);router[_0x2eba('0x9')](_0x2eba('0xc'),auth[_0x2eba('0xa')](),controller['show']);router[_0x2eba('0x9')](_0x2eba('0xd'),auth[_0x2eba('0xa')](),controller[_0x2eba('0xe')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x2eba('0xf')]);router[_0x2eba('0x10')]('/',auth[_0x2eba('0xa')](),controller[_0x2eba('0x11')]);router[_0x2eba('0x10')]('/:id/configurations',auth[_0x2eba('0xa')](),controller[_0x2eba('0x12')]);router['put']('/:id',auth[_0x2eba('0xa')](),controller['update']);router[_0x2eba('0x13')](_0x2eba('0xc'),auth[_0x2eba('0xa')](),controller['destroy']);module[_0x2eba('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 93b03d6..2ec608a 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 _0x759c=['exports','STRING','username','remoteUri','sequelize'];(function(_0x3f1324,_0x495823){var _0x3eb1af=function(_0xf945ad){while(--_0xf945ad){_0x3f1324['push'](_0x3f1324['shift']());}};_0x3eb1af(++_0x495823);}(_0x759c,0x112));var _0xc759=function(_0x584fe2,_0x4f9d98){_0x584fe2=_0x584fe2-0x0;var _0x4e8fbf=_0x759c[_0x584fe2];return _0x4e8fbf;};'use strict';var Sequelize=require(_0xc759('0x0'));module[_0xc759('0x1')]={'name':{'type':Sequelize[_0xc759('0x2')]},'description':{'type':Sequelize[_0xc759('0x2')]},'username':{'type':Sequelize[_0xc759('0x2')],'unique':_0xc759('0x3')},'apiKey':{'type':Sequelize[_0xc759('0x2')]},'remoteUri':{'type':Sequelize[_0xc759('0x2')],'unique':_0xc759('0x4')},'serverUrl':{'type':Sequelize[_0xc759('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xcbb4=['username','remoteUri','sequelize','exports','STRING'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0xcbb4,0x165));var _0x4cbb=function(_0x385ef4,_0x593598){_0x385ef4=_0x385ef4-0x0;var _0x2a7f3f=_0xcbb4[_0x385ef4];return _0x2a7f3f;};'use strict';var Sequelize=require(_0x4cbb('0x0'));module[_0x4cbb('0x1')]={'name':{'type':Sequelize[_0x4cbb('0x2')]},'description':{'type':Sequelize[_0x4cbb('0x2')]},'username':{'type':Sequelize[_0x4cbb('0x2')],'unique':_0x4cbb('0x3')},'apiKey':{'type':Sequelize[_0x4cbb('0x2')]},'remoteUri':{'type':Sequelize[_0x4cbb('0x2')],'unique':_0x4cbb('0x4')},'serverUrl':{'type':Sequelize[_0x4cbb('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 7531c2b..f9ab850 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 _0x7072=['error','code','message','info','result','catch','sendStatus','end','status','count','offset','limit','Content-Range','reject','save','update','destroy','name','send','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','apiKey','username','remoteUri','slice','substring','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','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/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x434010,_0x591dd5){var _0x37cab1=function(_0x4fab0b){while(--_0x4fab0b){_0x434010['push'](_0x434010['shift']());}};_0x37cab1(++_0x591dd5);}(_0x7072,0x138));var _0x2707=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x7072[_0x3d42d8];return _0x27fc41;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2707('0x0'));var rimraf=require(_0x2707('0x1'));var zipdir=require(_0x2707('0x2'));var jsonpatch=require(_0x2707('0x3'));var rp=require(_0x2707('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2707('0x5'));var util=require('util');var path=require(_0x2707('0x6'));var sox=require(_0x2707('0x7'));var csv=require(_0x2707('0x8'));var ejs=require(_0x2707('0x9'));var fs=require('fs');var _=require(_0x2707('0xa'));var squel=require(_0x2707('0xb'));var crypto=require(_0x2707('0xc'));var jsforce=require(_0x2707('0xd'));var deskjs=require(_0x2707('0xe'));var toCsv=require(_0x2707('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2707('0xf'));var authService=require(_0x2707('0x10'));var qs=require(_0x2707('0x11'));var as=require(_0x2707('0x12'));var hardwareService=require(_0x2707('0x13'));var logger=require(_0x2707('0x14'))(_0x2707('0x15'));var utils=require(_0x2707('0x16'));var config=require(_0x2707('0x17'));var licenseUtil=require(_0x2707('0x18'));var db=require(_0x2707('0x19'))['db'];var integrations=require(_0x2707('0x1a'));var jayson=require(_0x2707('0x1b'));var client=jayson['client'][_0x2707('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x590152,_0x2a1bff,_0x307367,_0xfe975c){return new BPromise(function(_0x3a67f2,_0x13d9ac){var _0x4e52a3=_0xfe975c||client;return _0x4e52a3[_0x2707('0x1d')](_0x590152,_0x307367)[_0x2707('0x1e')](function(_0x2f6381){logger['info'](_0x2707('0x1f'),_0x2a1bff,_0x2707('0x20'));logger[_0x2707('0x21')](_0x2707('0x22'),_0x2a1bff,_0x2707('0x20'),JSON[_0x2707('0x23')](_0x2f6381));if(_0x2f6381['error']){if(_0x2f6381[_0x2707('0x24')][_0x2707('0x25')]===0x1f4){logger[_0x2707('0x24')]('FreshsalesAccount,\x20%s,\x20%s',_0x2a1bff,_0x2f6381['error']['message']);return _0x13d9ac(_0x2f6381[_0x2707('0x24')][_0x2707('0x26')]);}logger[_0x2707('0x24')](_0x2707('0x1f'),_0x2a1bff,_0x2f6381[_0x2707('0x24')][_0x2707('0x26')]);return _0x3a67f2(_0x2f6381[_0x2707('0x24')][_0x2707('0x26')]);}else{logger[_0x2707('0x27')](_0x2707('0x1f'),_0x2a1bff,_0x2707('0x20'));_0x3a67f2(_0x2f6381[_0x2707('0x28')][_0x2707('0x26')]);}})[_0x2707('0x29')](function(_0x5f50a8){logger[_0x2707('0x24')](_0x2707('0x1f'),_0x2a1bff,_0x5f50a8);_0x13d9ac(_0x5f50a8);});});}function respondWithStatusCode(_0x46259e,_0x369e3a){_0x369e3a=_0x369e3a||0xcc;return function(_0x378ca4){if(_0x378ca4){return _0x46259e[_0x2707('0x2a')](_0x369e3a);}return _0x46259e['status'](_0x369e3a)[_0x2707('0x2b')]();};}function respondWithResult(_0x3f6976,_0x171add){_0x171add=_0x171add||0xc8;return function(_0x2ad386){if(_0x2ad386){return _0x3f6976[_0x2707('0x2c')](_0x171add)['json'](_0x2ad386);}};}function respondWithFilteredResult(_0x2dce16,_0x4ca05d){return function(_0x29dad2){if(_0x29dad2){var _0x34dc4e=_0x29dad2[_0x2707('0x2d')],_0x2aa3fe=_0x4ca05d[_0x2707('0x2e')],_0x57da26=_0x4ca05d['offset']+_0x4ca05d[_0x2707('0x2f')],_0x115eee;if(_0x57da26>=_0x34dc4e){_0x57da26=_0x34dc4e;_0x115eee=0xc8;}else{_0x115eee=0xce;}_0x2dce16[_0x2707('0x2c')](_0x115eee);return _0x2dce16['set'](_0x2707('0x30'),_0x2aa3fe+'-'+_0x57da26+'/'+_0x34dc4e)['json'](_0x29dad2);}return null;};}function patchUpdates(_0x5aaffb){return function(_0x16b91f){try{jsonpatch['apply'](_0x16b91f,_0x5aaffb,!![]);}catch(_0x2a0d24){return BPromise[_0x2707('0x31')](_0x2a0d24);}return _0x16b91f[_0x2707('0x32')]();};}function saveUpdates(_0x36b2e9,_0x48832b){return function(_0xd83ce3){if(_0xd83ce3){return _0xd83ce3[_0x2707('0x33')](_0x36b2e9)[_0x2707('0x1e')](function(_0x154799){return _0x154799;});}return null;};}function removeEntity(_0x12ec96,_0x341e14){return function(_0x2838c2){if(_0x2838c2){return _0x2838c2[_0x2707('0x34')]()[_0x2707('0x1e')](function(){_0x12ec96['status'](0xcc)[_0x2707('0x2b')]();});}};}function handleEntityNotFound(_0x12356d,_0x5bcdef){return function(_0x47ce1c){if(!_0x47ce1c){_0x12356d['sendStatus'](0x194);}return _0x47ce1c;};}function handleError(_0x57caf7,_0x4bd001){_0x4bd001=_0x4bd001||0x1f4;return function(_0x137e04){logger['error'](_0x137e04['stack']);if(_0x137e04[_0x2707('0x35')]){delete _0x137e04[_0x2707('0x35')];}_0x57caf7['status'](_0x4bd001)[_0x2707('0x36')](_0x137e04);};}exports[_0x2707('0x37')]=function(_0x5df463,_0x5e6b51){var _0x30b645={},_0x3bf57e={},_0x521edb={'count':0x0,'rows':[]};var _0x5d69cf=_[_0x2707('0x38')](db[_0x2707('0x39')]['rawAttributes'],function(_0x3ecda0){return{'name':_0x3ecda0[_0x2707('0x3a')],'type':_0x3ecda0[_0x2707('0x3b')][_0x2707('0x3c')]};});_0x3bf57e[_0x2707('0x3d')]=_[_0x2707('0x38')](_0x5d69cf,'name');_0x3bf57e[_0x2707('0x3e')]=_[_0x2707('0x3f')](_0x5df463[_0x2707('0x3e')]);_0x3bf57e[_0x2707('0x40')]=_[_0x2707('0x41')](_0x3bf57e[_0x2707('0x3d')],_0x3bf57e[_0x2707('0x3e')]);_0x30b645['attributes']=_[_0x2707('0x41')](_0x3bf57e[_0x2707('0x3d')],qs[_0x2707('0x42')](_0x5df463[_0x2707('0x3e')][_0x2707('0x42')]));_0x30b645[_0x2707('0x43')]=_0x30b645[_0x2707('0x43')][_0x2707('0x44')]?_0x30b645[_0x2707('0x43')]:_0x3bf57e[_0x2707('0x3d')];if(!_0x5df463[_0x2707('0x3e')][_0x2707('0x45')](_0x2707('0x46'))){_0x30b645[_0x2707('0x2f')]=qs[_0x2707('0x2f')](_0x5df463[_0x2707('0x3e')]['limit']);_0x30b645[_0x2707('0x2e')]=qs[_0x2707('0x2e')](_0x5df463['query'][_0x2707('0x2e')]);}_0x30b645['order']=qs[_0x2707('0x47')](_0x5df463[_0x2707('0x3e')][_0x2707('0x47')]);_0x30b645[_0x2707('0x48')]=qs[_0x2707('0x40')](_[_0x2707('0x49')](_0x5df463[_0x2707('0x3e')],_0x3bf57e['filters']),_0x5d69cf);if(_0x5df463[_0x2707('0x3e')][_0x2707('0x4a')]){_0x30b645['where']=_[_0x2707('0x4b')](_0x30b645[_0x2707('0x48')],{'$or':_[_0x2707('0x38')](_0x5d69cf,function(_0x5a4c53){if(_0x5a4c53['type']!==_0x2707('0x4c')){var _0x2e72f2={};_0x2e72f2[_0x5a4c53['name']]={'$like':'%'+_0x5df463[_0x2707('0x3e')]['filter']+'%'};return _0x2e72f2;}})});}_0x30b645=_[_0x2707('0x4b')]({},_0x30b645,_0x5df463[_0x2707('0x4d')]);var _0x323703={'where':_0x30b645[_0x2707('0x48')]};return db['FreshsalesAccount'][_0x2707('0x2d')](_0x323703)[_0x2707('0x1e')](function(_0x3310e6){_0x521edb[_0x2707('0x2d')]=_0x3310e6;if(_0x5df463[_0x2707('0x3e')][_0x2707('0x4e')]){_0x30b645[_0x2707('0x4f')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x2707('0x50')](_0x30b645);})[_0x2707('0x1e')](function(_0x36df38){_0x521edb[_0x2707('0x51')]=_0x36df38;return _0x521edb;})[_0x2707('0x1e')](respondWithFilteredResult(_0x5e6b51,_0x30b645))['catch'](handleError(_0x5e6b51,null));};exports[_0x2707('0x52')]=function(_0x4a6eea,_0xf96f41){var _0x6ada76={'raw':![],'where':{'id':_0x4a6eea[_0x2707('0x53')]['id']}},_0x511a96={};_0x511a96[_0x2707('0x3d')]=_[_0x2707('0x3f')](db['FreshsalesAccount'][_0x2707('0x54')]);_0x511a96['query']=_[_0x2707('0x3f')](_0x4a6eea[_0x2707('0x3e')]);_0x511a96['filters']=_[_0x2707('0x41')](_0x511a96[_0x2707('0x3d')],_0x511a96[_0x2707('0x3e')]);_0x6ada76['attributes']=_['intersection'](_0x511a96[_0x2707('0x3d')],qs[_0x2707('0x42')](_0x4a6eea[_0x2707('0x3e')][_0x2707('0x42')]));_0x6ada76[_0x2707('0x43')]=_0x6ada76['attributes']['length']?_0x6ada76['attributes']:_0x511a96[_0x2707('0x3d')];if(_0x4a6eea[_0x2707('0x3e')][_0x2707('0x4e')]){_0x6ada76[_0x2707('0x4f')]=[{'all':!![]}];}_0x6ada76=_[_0x2707('0x4b')]({},_0x6ada76,_0x4a6eea['options']);return db[_0x2707('0x39')][_0x2707('0x55')](_0x6ada76)['then'](handleEntityNotFound(_0xf96f41,null))['then'](respondWithResult(_0xf96f41,null))[_0x2707('0x29')](handleError(_0xf96f41,null));};exports[_0x2707('0x56')]=function(_0x3a8cf9,_0x57c1c5){return db[_0x2707('0x39')][_0x2707('0x56')](_0x3a8cf9[_0x2707('0x57')],{})[_0x2707('0x1e')](respondWithResult(_0x57c1c5,0xc9))['catch'](handleError(_0x57c1c5,null));};exports[_0x2707('0x33')]=function(_0x20df29,_0x28a80e){if(_0x20df29[_0x2707('0x57')]['id']){delete _0x20df29[_0x2707('0x57')]['id'];}return db[_0x2707('0x39')][_0x2707('0x55')]({'where':{'id':_0x20df29[_0x2707('0x53')]['id']}})[_0x2707('0x1e')](handleEntityNotFound(_0x28a80e,null))[_0x2707('0x1e')](saveUpdates(_0x20df29['body'],null))[_0x2707('0x1e')](respondWithResult(_0x28a80e,null))['catch'](handleError(_0x28a80e,null));};exports['destroy']=function(_0x3029ce,_0x4b9451){return db['FreshsalesAccount'][_0x2707('0x55')]({'where':{'id':_0x3029ce[_0x2707('0x53')]['id']}})[_0x2707('0x1e')](handleEntityNotFound(_0x4b9451,null))[_0x2707('0x1e')](removeEntity(_0x4b9451,null))[_0x2707('0x29')](handleError(_0x4b9451,null));};exports[_0x2707('0x58')]=function(_0x4264dc,_0x2726ef,_0xf4d542){var _0xc88cd7={};var _0x40c333={};var _0x5852bd;var _0x4c4568;return db['FreshsalesAccount'][_0x2707('0x59')]({'where':{'id':_0x4264dc[_0x2707('0x53')]['id']}})[_0x2707('0x1e')](handleEntityNotFound(_0x2726ef,null))['then'](function(_0x5d0708){if(_0x5d0708){_0x5852bd=_0x5d0708;_0x40c333[_0x2707('0x3d')]=_[_0x2707('0x3f')](db[_0x2707('0x5a')][_0x2707('0x54')]);_0x40c333[_0x2707('0x3e')]=_['keys'](_0x4264dc['query']);_0x40c333[_0x2707('0x40')]=_[_0x2707('0x41')](_0x40c333[_0x2707('0x3d')],_0x40c333[_0x2707('0x3e')]);_0xc88cd7[_0x2707('0x43')]=_[_0x2707('0x41')](_0x40c333[_0x2707('0x3d')],qs[_0x2707('0x42')](_0x4264dc[_0x2707('0x3e')]['fields']));_0xc88cd7[_0x2707('0x43')]=_0xc88cd7[_0x2707('0x43')][_0x2707('0x44')]?_0xc88cd7[_0x2707('0x43')]:_0x40c333[_0x2707('0x3d')];_0xc88cd7[_0x2707('0x5b')]=qs['sort'](_0x4264dc['query'][_0x2707('0x47')]);_0xc88cd7[_0x2707('0x48')]=qs['filters'](_['pick'](_0x4264dc['query'],_0x40c333['filters']));if(_0x4264dc[_0x2707('0x3e')][_0x2707('0x4a')]){_0xc88cd7['where']=_[_0x2707('0x4b')](_0xc88cd7[_0x2707('0x48')],{'$or':_[_0x2707('0x38')](_0xc88cd7['attributes'],function(_0x508265){var _0x3e8730={};_0x3e8730[_0x508265]={'$like':'%'+_0x4264dc[_0x2707('0x3e')][_0x2707('0x4a')]+'%'};return _0x3e8730;})});}_0xc88cd7=_[_0x2707('0x4b')]({},_0xc88cd7,_0x4264dc[_0x2707('0x4d')]);return _0x5852bd[_0x2707('0x58')](_0xc88cd7);}})[_0x2707('0x1e')](function(_0x4da6cf){if(_0x4da6cf){_0x4c4568=_0x4da6cf[_0x2707('0x44')];if(!_0x4264dc[_0x2707('0x3e')][_0x2707('0x45')](_0x2707('0x46'))){_0xc88cd7[_0x2707('0x2f')]=qs[_0x2707('0x2f')](_0x4264dc['query'][_0x2707('0x2f')]);_0xc88cd7[_0x2707('0x2e')]=qs[_0x2707('0x2e')](_0x4264dc[_0x2707('0x3e')][_0x2707('0x2e')]);}return _0x5852bd[_0x2707('0x58')](_0xc88cd7);}})['then'](function(_0x47eb92){if(_0x47eb92){return _0x47eb92?{'count':_0x4c4568,'rows':_0x47eb92}:null;}})[_0x2707('0x1e')](respondWithResult(_0x2726ef,null))[_0x2707('0x29')](handleError(_0x2726ef,null));};exports[_0x2707('0x5c')]=function(_0x42da4e,_0x3ae5c6,_0x2af149){if(_0x42da4e['body']['id']){delete _0x42da4e['body']['id'];}return db[_0x2707('0x39')]['findOne']({'where':{'id':_0x42da4e[_0x2707('0x53')]['id']}})[_0x2707('0x1e')](handleEntityNotFound(_0x3ae5c6,null))[_0x2707('0x1e')](function(_0x3015d4){if(_0x3015d4){_0x42da4e[_0x2707('0x57')][_0x2707('0x5d')]=_0x3015d4['id'];_0x42da4e['body'][_0x2707('0x5e')]=integrations['getSubjects'](_0x42da4e[_0x2707('0x57')][_0x2707('0x5f')],_0x42da4e['body'][_0x2707('0x3b')]);_0x42da4e[_0x2707('0x57')][_0x2707('0x60')]=integrations[_0x2707('0x61')](_0x42da4e[_0x2707('0x57')]['channel'],_0x42da4e[_0x2707('0x57')][_0x2707('0x3b')]);return db[_0x2707('0x5a')][_0x2707('0x56')](_0x42da4e[_0x2707('0x57')],{'include':[{'model':db[_0x2707('0x62')],'as':_0x2707('0x5e')},{'model':db[_0x2707('0x62')],'as':_0x2707('0x60')}]});}return null;})[_0x2707('0x1e')](respondWithResult(_0x3ae5c6,null))[_0x2707('0x29')](handleError(_0x3ae5c6,null));};exports[_0x2707('0x63')]=function(_0x8a6179,_0x18863b,_0x449e97){var _0x34abc8='';var _0x2b43be='';return db[_0x2707('0x39')]['findOne']({'where':{'id':_0x8a6179[_0x2707('0x53')]['id']},'attributes':['id','username','remoteUri',_0x2707('0x64')]})[_0x2707('0x1e')](handleEntityNotFound(_0x18863b,null))[_0x2707('0x1e')](function(_0x11ac13){if(_0x11ac13){_0x2b43be=_0x11ac13[_0x2707('0x65')];_0x34abc8=_0x11ac13[_0x2707('0x66')];var _0x555094=_0x11ac13[_0x2707('0x66')][_0x2707('0x67')](-0x1);if(_0x555094==='/'){_0x34abc8=_0x34abc8[_0x2707('0x68')](0x0,_0x34abc8['lastIndexOf'](_0x555094));}return rp({'method':_0x2707('0x69'),'uri':util[_0x2707('0x6a')](_0x2707('0x6b'),_0x34abc8,_0x2707('0x6c')),'headers':{'Authorization':'Token\x20token='+_0x11ac13[_0x2707('0x64')]},'json':!![]});}})['then'](function(_0x3dbf7d){if(_0x3dbf7d){var _0x19a980=_0x3dbf7d[_0x2707('0x6d')];var _0x202ae0=![];var _0x3e673b=null;for(_0x3e673b=0x0;_0x3e673b<_0x19a980[_0x2707('0x44')];_0x3e673b++){if(_0x19a980[_0x3e673b][_0x2707('0x6e')]===_0x2b43be){_0x202ae0=!![];}}if(_0x202ae0){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2707('0x6f')});}}})[_0x2707('0x1e')](respondWithResult(_0x18863b,null))['catch'](function(_0x4530bc){var _0x5a1a24=_0x8a6179[_0x2707('0x3e')][_0x2707('0x70')]?0x1f4:_0x4530bc[_0x2707('0x71')]||0x1f4;logger[_0x2707('0x24')](_0x2707('0x72'),_0x2707('0x63'),_0x5a1a24,JSON['stringify'](_0x4530bc));delete _0x4530bc['name'];if(_0x5a1a24===0x191){_0x5a1a24=0x190;}_0x18863b[_0x2707('0x2c')](_0x5a1a24)['send'](_0x8a6179[_0x2707('0x3e')][_0x2707('0x70')]?{'message':_0x2707('0x73'),'statusCode':_0x4530bc[_0x2707('0x71')]}:_0x4530bc);});}; \ No newline at end of file +var _0xb4e6=['to-csv','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','Content-Range','json','apply','destroy','stack','name','send','index','FreshsalesAccount','rawAttributes','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','show','params','keys','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','order','addConfiguration','AccountId','Subjects','Descriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','%s%s','/api/selector/owners','Token\x20token=','email','statusCode','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x1924f9,_0x17f7cb){var _0x1965a3=function(_0x22c758){while(--_0x22c758){_0x1924f9['push'](_0x1924f9['shift']());}};_0x1965a3(++_0x17f7cb);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0xb4e6[_0x495e9f];return _0xb249d2;};'use strict';var pdf=require(_0x6b4e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6b4e('0x1'));var zipdir=require(_0x6b4e('0x2'));var jsonpatch=require(_0x6b4e('0x3'));var rp=require(_0x6b4e('0x4'));var moment=require(_0x6b4e('0x5'));var BPromise=require(_0x6b4e('0x6'));var Mustache=require(_0x6b4e('0x7'));var util=require('util');var path=require(_0x6b4e('0x8'));var sox=require(_0x6b4e('0x9'));var csv=require(_0x6b4e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6b4e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b4e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b4e('0xd'));var Papa=require(_0x6b4e('0xe'));var Redis=require(_0x6b4e('0xf'));var authService=require(_0x6b4e('0x10'));var qs=require(_0x6b4e('0x11'));var as=require(_0x6b4e('0x12'));var hardwareService=require(_0x6b4e('0x13'));var logger=require('../../config/logger')(_0x6b4e('0x14'));var utils=require(_0x6b4e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6b4e('0x16'));var db=require(_0x6b4e('0x17'))['db'];var integrations=require(_0x6b4e('0x18'));var jayson=require(_0x6b4e('0x19'));var client=jayson[_0x6b4e('0x1a')][_0x6b4e('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1db513,_0x531eec,_0x36f8a5,_0x29bdee){return new BPromise(function(_0x4788cf,_0x29a6df){var _0x4b62ad=_0x29bdee||client;return _0x4b62ad[_0x6b4e('0x1c')](_0x1db513,_0x36f8a5)[_0x6b4e('0x1d')](function(_0x3ba513){logger[_0x6b4e('0x1e')](_0x6b4e('0x1f'),_0x531eec,_0x6b4e('0x20'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x531eec,_0x6b4e('0x20'),JSON[_0x6b4e('0x21')](_0x3ba513));if(_0x3ba513[_0x6b4e('0x22')]){if(_0x3ba513[_0x6b4e('0x22')][_0x6b4e('0x23')]===0x1f4){logger[_0x6b4e('0x22')](_0x6b4e('0x1f'),_0x531eec,_0x3ba513[_0x6b4e('0x22')][_0x6b4e('0x24')]);return _0x29a6df(_0x3ba513[_0x6b4e('0x22')][_0x6b4e('0x24')]);}logger['error'](_0x6b4e('0x1f'),_0x531eec,_0x3ba513[_0x6b4e('0x22')][_0x6b4e('0x24')]);return _0x4788cf(_0x3ba513[_0x6b4e('0x22')]['message']);}else{logger[_0x6b4e('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x531eec,_0x6b4e('0x20'));_0x4788cf(_0x3ba513[_0x6b4e('0x25')][_0x6b4e('0x24')]);}})[_0x6b4e('0x26')](function(_0xa06ccd){logger[_0x6b4e('0x22')](_0x6b4e('0x1f'),_0x531eec,_0xa06ccd);_0x29a6df(_0xa06ccd);});});}function respondWithStatusCode(_0x5c33be,_0x2e36db){_0x2e36db=_0x2e36db||0xcc;return function(_0x4a8ac4){if(_0x4a8ac4){return _0x5c33be[_0x6b4e('0x27')](_0x2e36db);}return _0x5c33be[_0x6b4e('0x28')](_0x2e36db)[_0x6b4e('0x29')]();};}function respondWithResult(_0xdba4fe,_0x4ec9cc){_0x4ec9cc=_0x4ec9cc||0xc8;return function(_0xec7d35){if(_0xec7d35){return _0xdba4fe[_0x6b4e('0x28')](_0x4ec9cc)['json'](_0xec7d35);}};}function respondWithFilteredResult(_0x32102f,_0x381ff0){return function(_0x3513b2){if(_0x3513b2){var _0x44b399=_0x3513b2['count'],_0x5bfe9e=_0x381ff0[_0x6b4e('0x2a')],_0x2d42be=_0x381ff0[_0x6b4e('0x2a')]+_0x381ff0[_0x6b4e('0x2b')],_0x182375;if(_0x2d42be>=_0x44b399){_0x2d42be=_0x44b399;_0x182375=0xc8;}else{_0x182375=0xce;}_0x32102f[_0x6b4e('0x28')](_0x182375);return _0x32102f['set'](_0x6b4e('0x2c'),_0x5bfe9e+'-'+_0x2d42be+'/'+_0x44b399)[_0x6b4e('0x2d')](_0x3513b2);}return null;};}function patchUpdates(_0x47ab11){return function(_0x37d8bb){try{jsonpatch[_0x6b4e('0x2e')](_0x37d8bb,_0x47ab11,!![]);}catch(_0x37b636){return BPromise['reject'](_0x37b636);}return _0x37d8bb['save']();};}function saveUpdates(_0x11156e,_0x2e6414){return function(_0x3ec877){if(_0x3ec877){return _0x3ec877['update'](_0x11156e)[_0x6b4e('0x1d')](function(_0x421177){return _0x421177;});}return null;};}function removeEntity(_0x45b948,_0x5c1444){return function(_0x5a8f89){if(_0x5a8f89){return _0x5a8f89[_0x6b4e('0x2f')]()['then'](function(){_0x45b948[_0x6b4e('0x28')](0xcc)[_0x6b4e('0x29')]();});}};}function handleEntityNotFound(_0x5ce786,_0x885c35){return function(_0x3b3094){if(!_0x3b3094){_0x5ce786[_0x6b4e('0x27')](0x194);}return _0x3b3094;};}function handleError(_0x1e8d8d,_0x516b9f){_0x516b9f=_0x516b9f||0x1f4;return function(_0x4ea04e){logger[_0x6b4e('0x22')](_0x4ea04e[_0x6b4e('0x30')]);if(_0x4ea04e[_0x6b4e('0x31')]){delete _0x4ea04e[_0x6b4e('0x31')];}_0x1e8d8d[_0x6b4e('0x28')](_0x516b9f)[_0x6b4e('0x32')](_0x4ea04e);};}exports[_0x6b4e('0x33')]=function(_0x1fdc14,_0x144954){var _0x3785d5={},_0x2707d4={},_0x42eca4={'count':0x0,'rows':[]};var _0x39b955=_['map'](db[_0x6b4e('0x34')][_0x6b4e('0x35')],function(_0x3f2c1d){return{'name':_0x3f2c1d['fieldName'],'type':_0x3f2c1d[_0x6b4e('0x36')]['key']};});_0x2707d4[_0x6b4e('0x37')]=_[_0x6b4e('0x38')](_0x39b955,_0x6b4e('0x31'));_0x2707d4['query']=_['keys'](_0x1fdc14[_0x6b4e('0x39')]);_0x2707d4[_0x6b4e('0x3a')]=_['intersection'](_0x2707d4['model'],_0x2707d4[_0x6b4e('0x39')]);_0x3785d5[_0x6b4e('0x3b')]=_[_0x6b4e('0x3c')](_0x2707d4[_0x6b4e('0x37')],qs[_0x6b4e('0x3d')](_0x1fdc14[_0x6b4e('0x39')][_0x6b4e('0x3d')]));_0x3785d5[_0x6b4e('0x3b')]=_0x3785d5[_0x6b4e('0x3b')][_0x6b4e('0x3e')]?_0x3785d5[_0x6b4e('0x3b')]:_0x2707d4['model'];if(!_0x1fdc14[_0x6b4e('0x39')][_0x6b4e('0x3f')]('nolimit')){_0x3785d5[_0x6b4e('0x2b')]=qs[_0x6b4e('0x2b')](_0x1fdc14[_0x6b4e('0x39')][_0x6b4e('0x2b')]);_0x3785d5[_0x6b4e('0x2a')]=qs['offset'](_0x1fdc14['query'][_0x6b4e('0x2a')]);}_0x3785d5['order']=qs[_0x6b4e('0x40')](_0x1fdc14[_0x6b4e('0x39')]['sort']);_0x3785d5[_0x6b4e('0x41')]=qs['filters'](_[_0x6b4e('0x42')](_0x1fdc14['query'],_0x2707d4[_0x6b4e('0x3a')]),_0x39b955);if(_0x1fdc14[_0x6b4e('0x39')][_0x6b4e('0x43')]){_0x3785d5[_0x6b4e('0x41')]=_['merge'](_0x3785d5[_0x6b4e('0x41')],{'$or':_[_0x6b4e('0x38')](_0x39b955,function(_0x539e3c){if(_0x539e3c['type']!==_0x6b4e('0x44')){var _0x2f0ea5={};_0x2f0ea5[_0x539e3c[_0x6b4e('0x31')]]={'$like':'%'+_0x1fdc14[_0x6b4e('0x39')][_0x6b4e('0x43')]+'%'};return _0x2f0ea5;}})});}_0x3785d5=_[_0x6b4e('0x45')]({},_0x3785d5,_0x1fdc14[_0x6b4e('0x46')]);var _0x2dfb38={'where':_0x3785d5[_0x6b4e('0x41')]};return db['FreshsalesAccount'][_0x6b4e('0x47')](_0x2dfb38)[_0x6b4e('0x1d')](function(_0x148b66){_0x42eca4[_0x6b4e('0x47')]=_0x148b66;if(_0x1fdc14[_0x6b4e('0x39')]['includeAll']){_0x3785d5[_0x6b4e('0x48')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x6b4e('0x49')](_0x3785d5);})[_0x6b4e('0x1d')](function(_0x2f2973){_0x42eca4[_0x6b4e('0x4a')]=_0x2f2973;return _0x42eca4;})['then'](respondWithFilteredResult(_0x144954,_0x3785d5))[_0x6b4e('0x26')](handleError(_0x144954,null));};exports[_0x6b4e('0x4b')]=function(_0x1d0eb3,_0x5b9da3){var _0x2e91f9={'raw':![],'where':{'id':_0x1d0eb3[_0x6b4e('0x4c')]['id']}},_0x455afc={};_0x455afc[_0x6b4e('0x37')]=_[_0x6b4e('0x4d')](db[_0x6b4e('0x34')][_0x6b4e('0x35')]);_0x455afc[_0x6b4e('0x39')]=_[_0x6b4e('0x4d')](_0x1d0eb3[_0x6b4e('0x39')]);_0x455afc['filters']=_[_0x6b4e('0x3c')](_0x455afc[_0x6b4e('0x37')],_0x455afc[_0x6b4e('0x39')]);_0x2e91f9['attributes']=_[_0x6b4e('0x3c')](_0x455afc[_0x6b4e('0x37')],qs[_0x6b4e('0x3d')](_0x1d0eb3[_0x6b4e('0x39')][_0x6b4e('0x3d')]));_0x2e91f9[_0x6b4e('0x3b')]=_0x2e91f9[_0x6b4e('0x3b')][_0x6b4e('0x3e')]?_0x2e91f9[_0x6b4e('0x3b')]:_0x455afc[_0x6b4e('0x37')];if(_0x1d0eb3[_0x6b4e('0x39')]['includeAll']){_0x2e91f9['include']=[{'all':!![]}];}_0x2e91f9=_[_0x6b4e('0x45')]({},_0x2e91f9,_0x1d0eb3[_0x6b4e('0x46')]);return db[_0x6b4e('0x34')][_0x6b4e('0x4e')](_0x2e91f9)['then'](handleEntityNotFound(_0x5b9da3,null))[_0x6b4e('0x1d')](respondWithResult(_0x5b9da3,null))[_0x6b4e('0x26')](handleError(_0x5b9da3,null));};exports[_0x6b4e('0x4f')]=function(_0x59db52,_0x477831){return db[_0x6b4e('0x34')][_0x6b4e('0x4f')](_0x59db52[_0x6b4e('0x50')],{})[_0x6b4e('0x1d')](respondWithResult(_0x477831,0xc9))['catch'](handleError(_0x477831,null));};exports[_0x6b4e('0x51')]=function(_0x5cdf45,_0x43397c){if(_0x5cdf45[_0x6b4e('0x50')]['id']){delete _0x5cdf45['body']['id'];}return db[_0x6b4e('0x34')]['find']({'where':{'id':_0x5cdf45[_0x6b4e('0x4c')]['id']}})[_0x6b4e('0x1d')](handleEntityNotFound(_0x43397c,null))[_0x6b4e('0x1d')](saveUpdates(_0x5cdf45[_0x6b4e('0x50')],null))[_0x6b4e('0x1d')](respondWithResult(_0x43397c,null))['catch'](handleError(_0x43397c,null));};exports[_0x6b4e('0x2f')]=function(_0x292e36,_0x9f8aab){return db['FreshsalesAccount']['find']({'where':{'id':_0x292e36[_0x6b4e('0x4c')]['id']}})[_0x6b4e('0x1d')](handleEntityNotFound(_0x9f8aab,null))['then'](removeEntity(_0x9f8aab,null))[_0x6b4e('0x26')](handleError(_0x9f8aab,null));};exports[_0x6b4e('0x52')]=function(_0x3d5845,_0x12adfe,_0x45f16e){var _0x5786f5={};var _0x52faab={};var _0x1b3f3c;var _0x1c2f9d;return db[_0x6b4e('0x34')][_0x6b4e('0x53')]({'where':{'id':_0x3d5845[_0x6b4e('0x4c')]['id']}})[_0x6b4e('0x1d')](handleEntityNotFound(_0x12adfe,null))[_0x6b4e('0x1d')](function(_0x3661c5){if(_0x3661c5){_0x1b3f3c=_0x3661c5;_0x52faab[_0x6b4e('0x37')]=_['keys'](db[_0x6b4e('0x54')][_0x6b4e('0x35')]);_0x52faab[_0x6b4e('0x39')]=_['keys'](_0x3d5845['query']);_0x52faab[_0x6b4e('0x3a')]=_[_0x6b4e('0x3c')](_0x52faab[_0x6b4e('0x37')],_0x52faab[_0x6b4e('0x39')]);_0x5786f5[_0x6b4e('0x3b')]=_['intersection'](_0x52faab[_0x6b4e('0x37')],qs[_0x6b4e('0x3d')](_0x3d5845[_0x6b4e('0x39')]['fields']));_0x5786f5[_0x6b4e('0x3b')]=_0x5786f5[_0x6b4e('0x3b')][_0x6b4e('0x3e')]?_0x5786f5['attributes']:_0x52faab[_0x6b4e('0x37')];_0x5786f5[_0x6b4e('0x55')]=qs['sort'](_0x3d5845[_0x6b4e('0x39')][_0x6b4e('0x40')]);_0x5786f5[_0x6b4e('0x41')]=qs[_0x6b4e('0x3a')](_[_0x6b4e('0x42')](_0x3d5845[_0x6b4e('0x39')],_0x52faab[_0x6b4e('0x3a')]));if(_0x3d5845['query'][_0x6b4e('0x43')]){_0x5786f5[_0x6b4e('0x41')]=_[_0x6b4e('0x45')](_0x5786f5[_0x6b4e('0x41')],{'$or':_[_0x6b4e('0x38')](_0x5786f5['attributes'],function(_0x15a835){var _0x20b212={};_0x20b212[_0x15a835]={'$like':'%'+_0x3d5845[_0x6b4e('0x39')][_0x6b4e('0x43')]+'%'};return _0x20b212;})});}_0x5786f5=_[_0x6b4e('0x45')]({},_0x5786f5,_0x3d5845['options']);return _0x1b3f3c[_0x6b4e('0x52')](_0x5786f5);}})['then'](function(_0x2d62c6){if(_0x2d62c6){_0x1c2f9d=_0x2d62c6[_0x6b4e('0x3e')];if(!_0x3d5845[_0x6b4e('0x39')][_0x6b4e('0x3f')]('nolimit')){_0x5786f5[_0x6b4e('0x2b')]=qs[_0x6b4e('0x2b')](_0x3d5845[_0x6b4e('0x39')][_0x6b4e('0x2b')]);_0x5786f5[_0x6b4e('0x2a')]=qs[_0x6b4e('0x2a')](_0x3d5845[_0x6b4e('0x39')]['offset']);}return _0x1b3f3c['getConfigurations'](_0x5786f5);}})['then'](function(_0x381e06){if(_0x381e06){return _0x381e06?{'count':_0x1c2f9d,'rows':_0x381e06}:null;}})[_0x6b4e('0x1d')](respondWithResult(_0x12adfe,null))[_0x6b4e('0x26')](handleError(_0x12adfe,null));};exports[_0x6b4e('0x56')]=function(_0x15d6d1,_0x381045,_0x5882b8){if(_0x15d6d1['body']['id']){delete _0x15d6d1[_0x6b4e('0x50')]['id'];}return db[_0x6b4e('0x34')][_0x6b4e('0x53')]({'where':{'id':_0x15d6d1[_0x6b4e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x381045,null))[_0x6b4e('0x1d')](function(_0x573c11){if(_0x573c11){_0x15d6d1[_0x6b4e('0x50')][_0x6b4e('0x57')]=_0x573c11['id'];_0x15d6d1[_0x6b4e('0x50')][_0x6b4e('0x58')]=integrations['getSubjects'](_0x15d6d1[_0x6b4e('0x50')]['channel'],_0x15d6d1[_0x6b4e('0x50')]['type']);_0x15d6d1[_0x6b4e('0x50')][_0x6b4e('0x59')]=integrations['getDescriptions'](_0x15d6d1[_0x6b4e('0x50')]['channel'],_0x15d6d1[_0x6b4e('0x50')][_0x6b4e('0x36')]);return db[_0x6b4e('0x54')][_0x6b4e('0x4f')](_0x15d6d1['body'],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0x6b4e('0x5a')],'as':_0x6b4e('0x59')}]});}return null;})['then'](respondWithResult(_0x381045,null))[_0x6b4e('0x26')](handleError(_0x381045,null));};exports[_0x6b4e('0x5b')]=function(_0x1f1fcf,_0x29c314,_0x3d9927){var _0xa7db79='';var _0x8cfd3c='';return db[_0x6b4e('0x34')][_0x6b4e('0x53')]({'where':{'id':_0x1f1fcf[_0x6b4e('0x4c')]['id']},'attributes':['id',_0x6b4e('0x5c'),'remoteUri',_0x6b4e('0x5d')]})[_0x6b4e('0x1d')](handleEntityNotFound(_0x29c314,null))[_0x6b4e('0x1d')](function(_0x7692bc){if(_0x7692bc){_0x8cfd3c=_0x7692bc[_0x6b4e('0x5c')];_0xa7db79=_0x7692bc[_0x6b4e('0x5e')];var _0x1f446f=_0x7692bc[_0x6b4e('0x5e')][_0x6b4e('0x5f')](-0x1);if(_0x1f446f==='/'){_0xa7db79=_0xa7db79['substring'](0x0,_0xa7db79['lastIndexOf'](_0x1f446f));}return rp({'method':'GET','uri':util['format'](_0x6b4e('0x60'),_0xa7db79,_0x6b4e('0x61')),'headers':{'Authorization':_0x6b4e('0x62')+_0x7692bc[_0x6b4e('0x5d')]},'json':!![]});}})['then'](function(_0x4784f4){if(_0x4784f4){var _0x349964=_0x4784f4['users'];var _0x1ad4bb=![];var _0x2be5b4=null;for(_0x2be5b4=0x0;_0x2be5b4<_0x349964[_0x6b4e('0x3e')];_0x2be5b4++){if(_0x349964[_0x2be5b4][_0x6b4e('0x63')]===_0x8cfd3c){_0x1ad4bb=!![];}}if(_0x1ad4bb){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x6b4e('0x1d')](respondWithResult(_0x29c314,null))[_0x6b4e('0x26')](function(_0x4b0a4e){var _0x50bbeb=_0x1f1fcf[_0x6b4e('0x39')]['test']?0x1f4:_0x4b0a4e[_0x6b4e('0x64')]||0x1f4;logger[_0x6b4e('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x6b4e('0x5b'),_0x50bbeb,JSON[_0x6b4e('0x21')](_0x4b0a4e));delete _0x4b0a4e[_0x6b4e('0x31')];if(_0x50bbeb===0x191){_0x50bbeb=0x190;}_0x29c314[_0x6b4e('0x28')](_0x50bbeb)[_0x6b4e('0x32')](_0x1f1fcf['query']['test']?{'message':_0x6b4e('0x65'),'statusCode':_0x4b0a4e[_0x6b4e('0x64')]}:_0x4b0a4e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c065dc7..0656b31 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 _0x89f5=['../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x23de94,_0x2391f1){var _0x37854c=function(_0x4e0b21){while(--_0x4e0b21){_0x23de94['push'](_0x23de94['shift']());}};_0x37854c(++_0x2391f1);}(_0x89f5,0x118));var _0x589f=function(_0x1b4b0a,_0x1083d5){_0x1b4b0a=_0x1b4b0a-0x0;var _0x2e6f15=_0x89f5[_0x1b4b0a];return _0x2e6f15;};'use strict';var _=require(_0x589f('0x0'));var util=require(_0x589f('0x1'));var logger=require(_0x589f('0x2'))(_0x589f('0x3'));var moment=require('moment');var BPromise=require(_0x589f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x589f('0x5'));var config=require(_0x589f('0x6'));var attributes=require(_0x589f('0x7'));var integrations=require(_0x589f('0x8'));module[_0x589f('0x9')]=function(_0x311918,_0x388d16){return _0x311918[_0x589f('0xa')](_0x589f('0xb'),attributes,{'tableName':_0x589f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ef6=['request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b6ca3,_0x2d4312){var _0x4c9fc8=function(_0x540a0d){while(--_0x540a0d){_0x3b6ca3['push'](_0x3b6ca3['shift']());}};_0x4c9fc8(++_0x2d4312);}(_0x5ef6,0xe8));var _0x65ef=function(_0x4f345d,_0x22f2ea){_0x4f345d=_0x4f345d-0x0;var _0x4e75d5=_0x5ef6[_0x4f345d];return _0x4e75d5;};'use strict';var _=require(_0x65ef('0x0'));var util=require(_0x65ef('0x1'));var logger=require(_0x65ef('0x2'))(_0x65ef('0x3'));var moment=require(_0x65ef('0x4'));var BPromise=require(_0x65ef('0x5'));var rp=require(_0x65ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x65ef('0x7'));var config=require(_0x65ef('0x8'));var attributes=require(_0x65ef('0x9'));var integrations=require(_0x65ef('0xa'));module[_0x65ef('0xb')]=function(_0xcc6c55,_0x33814c){return _0xcc6c55['define'](_0x65ef('0xc'),attributes,{'tableName':_0x65ef('0xd'),'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 363ded7..2efb93e 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 _0xd48e=['map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include'];(function(_0x10daff,_0x44a2dc){var _0x3ea007=function(_0x271863){while(--_0x271863){_0x10daff['push'](_0x10daff['shift']());}};_0x3ea007(++_0x44a2dc);}(_0xd48e,0x93));var _0xed48=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xd48e[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var util=require(_0xed48('0x0'));var moment=require(_0xed48('0x1'));var BPromise=require(_0xed48('0x2'));var rs=require(_0xed48('0x3'));var fs=require('fs');var Redis=require(_0xed48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed48('0x5'));var logger=require(_0xed48('0x6'))(_0xed48('0x7'));var config=require('../../config/environment');var jayson=require(_0xed48('0x8'));var client=jayson[_0xed48('0x9')][_0xed48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50b4ce,_0x2cc522,_0x1c9299){return new BPromise(function(_0x52a5e2,_0x5f0f1b){return client['request'](_0x50b4ce,_0x1c9299)[_0xed48('0xb')](function(_0x28096a){logger[_0xed48('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x2cc522,'request\x20sent');logger[_0xed48('0xd')](_0xed48('0xe'),_0x2cc522,_0xed48('0xf'),JSON['stringify'](_0x28096a));if(_0x28096a[_0xed48('0x10')]){if(_0x28096a[_0xed48('0x10')][_0xed48('0x11')]===0x1f4){logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);return _0x5f0f1b(_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);}logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);return _0x52a5e2(_0x28096a['error'][_0xed48('0x13')]);}else{logger['info'](_0xed48('0x12'),_0x2cc522,'request\x20sent');_0x52a5e2(_0x28096a['result'][_0xed48('0x13')]);}})[_0xed48('0x14')](function(_0x3dd77d){logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x3dd77d);_0x5f0f1b(_0x3dd77d);});});}exports['GetFreshsalesAccount']=function(_0x355224){var _0x5a058c=this;return new Promise(function(_0x10c4a8,_0x4e5eaf){return db[_0xed48('0x15')][_0xed48('0x16')]({'raw':_0x355224[_0xed48('0x17')]?_0x355224['options']['raw']===undefined?!![]:![]:!![],'where':_0x355224[_0xed48('0x17')]?_0x355224[_0xed48('0x17')][_0xed48('0x18')]||null:null,'attributes':_0x355224['options']?_0x355224[_0xed48('0x17')][_0xed48('0x19')]||null:null,'limit':_0x355224[_0xed48('0x17')]?_0x355224['options'][_0xed48('0x1a')]||null:null,'include':_0x355224[_0xed48('0x17')]?_0x355224[_0xed48('0x17')][_0xed48('0x1b')]?_[_0xed48('0x1c')](_0x355224[_0xed48('0x17')]['include'],function(_0x2683e4){return{'model':db[_0x2683e4['model']],'as':_0x2683e4['as'],'attributes':_0x2683e4[_0xed48('0x19')],'include':_0x2683e4[_0xed48('0x1b')]?_[_0xed48('0x1c')](_0x2683e4['include'],function(_0x4b460f){return{'model':db[_0x4b460f[_0xed48('0x1d')]],'as':_0x4b460f['as'],'attributes':_0x4b460f[_0xed48('0x19')],'include':_0x4b460f[_0xed48('0x1b')]?_[_0xed48('0x1c')](_0x4b460f[_0xed48('0x1b')],function(_0x28dbf6){return{'model':db[_0x28dbf6[_0xed48('0x1d')]],'as':_0x28dbf6['as'],'attributes':_0x28dbf6['attributes']};}):[]};}):[]};}):[]:[]})[_0xed48('0xb')](function(_0x3ce573){logger[_0xed48('0xc')]('GetFreshsalesAccount',_0x355224);logger[_0xed48('0xd')](_0xed48('0x1e'),_0x355224,JSON['stringify'](_0x3ce573));_0x10c4a8(_0x3ce573);})[_0xed48('0x14')](function(_0x5ed24d){logger['error'](_0xed48('0x1e'),_0x5ed24d['message'],_0x355224);_0x4e5eaf(_0x5a058c['error'](0x1f4,_0x5ed24d[_0xed48('0x13')]));});});};exports[_0xed48('0x1f')]=function(_0xc1b7da){var _0x52246b=this;return new Promise(function(_0x1ca723,_0x7c59){return db[_0xed48('0x15')][_0xed48('0x20')]({'raw':_0xc1b7da['options']?_0xc1b7da['options'][_0xed48('0x21')]===undefined?!![]:![]:!![],'where':_0xc1b7da['options']?_0xc1b7da[_0xed48('0x17')][_0xed48('0x18')]||null:null,'attributes':_0xc1b7da[_0xed48('0x17')]?_0xc1b7da[_0xed48('0x17')]['attributes']||null:null,'include':_0xc1b7da['options']?_0xc1b7da[_0xed48('0x17')][_0xed48('0x1b')]?_[_0xed48('0x1c')](_0xc1b7da[_0xed48('0x17')][_0xed48('0x1b')],function(_0x32d3a8){return{'model':db[_0x32d3a8[_0xed48('0x1d')]],'as':_0x32d3a8['as'],'attributes':_0x32d3a8[_0xed48('0x19')],'include':_0x32d3a8[_0xed48('0x1b')]?_[_0xed48('0x1c')](_0x32d3a8[_0xed48('0x1b')],function(_0x33db30){return{'model':db[_0x33db30['model']],'as':_0x33db30['as'],'attributes':_0x33db30[_0xed48('0x19')],'include':_0x33db30[_0xed48('0x1b')]?_[_0xed48('0x1c')](_0x33db30[_0xed48('0x1b')],function(_0x8f2fe){return{'model':db[_0x8f2fe[_0xed48('0x1d')]],'as':_0x8f2fe['as'],'attributes':_0x8f2fe[_0xed48('0x19')]};}):[]};}):[]};}):[]:[]})[_0xed48('0xb')](function(_0x17ed62){logger[_0xed48('0xc')]('ShowFreshsalesAccount',_0xc1b7da);logger[_0xed48('0xd')](_0xed48('0x1f'),_0xc1b7da,JSON[_0xed48('0x22')](_0x17ed62));_0x1ca723(_0x17ed62);})[_0xed48('0x14')](function(_0x5426c4){logger[_0xed48('0x10')](_0xed48('0x1f'),_0x5426c4['message'],_0xc1b7da);_0x7c59(_0x52246b[_0xed48('0x10')](0x1f4,_0x5426c4[_0xed48('0x13')]));});});}; \ No newline at end of file +var _0xa9fc=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','FreshsalesAccount,\x20%s,\x20%s','message','result','FreshsalesAccount','options','raw','where','attributes','limit','map','include','model','GetFreshsalesAccount','catch','find','ShowFreshsalesAccount','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','debug'];(function(_0x28bef9,_0x28e8d6){var _0x45db81=function(_0x269033){while(--_0x269033){_0x28bef9['push'](_0x28bef9['shift']());}};_0x45db81(++_0x28e8d6);}(_0xa9fc,0x19f));var _0xca9f=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0xa9fc[_0x30f5bb];return _0x1cfc00;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var moment=require(_0xca9f('0x2'));var BPromise=require(_0xca9f('0x3'));var rs=require(_0xca9f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca9f('0x6'))(_0xca9f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xca9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48f9ca,_0x39963d,_0x61b1b6){return new BPromise(function(_0x400980,_0xf7ebb1){return client[_0xca9f('0x9')](_0x48f9ca,_0x61b1b6)[_0xca9f('0xa')](function(_0x4713f0){logger[_0xca9f('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x39963d,_0xca9f('0xc'));logger[_0xca9f('0xd')](_0xca9f('0xe'),_0x39963d,_0xca9f('0xc'),JSON['stringify'](_0x4713f0));if(_0x4713f0[_0xca9f('0xf')]){if(_0x4713f0[_0xca9f('0xf')]['code']===0x1f4){logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x39963d,_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);return _0xf7ebb1(_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);}logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x39963d,_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);return _0x400980(_0x4713f0['error']['message']);}else{logger[_0xca9f('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x39963d,'request\x20sent');_0x400980(_0x4713f0[_0xca9f('0x12')][_0xca9f('0x11')]);}})['catch'](function(_0x4afedf){logger['error'](_0xca9f('0x10'),_0x39963d,_0x4afedf);_0xf7ebb1(_0x4afedf);});});}exports['GetFreshsalesAccount']=function(_0x22c161){var _0x2b3cfc=this;return new Promise(function(_0x1543aa,_0x83aa2b){return db[_0xca9f('0x13')]['findAll']({'raw':_0x22c161[_0xca9f('0x14')]?_0x22c161['options'][_0xca9f('0x15')]===undefined?!![]:![]:!![],'where':_0x22c161[_0xca9f('0x14')]?_0x22c161[_0xca9f('0x14')][_0xca9f('0x16')]||null:null,'attributes':_0x22c161[_0xca9f('0x14')]?_0x22c161['options'][_0xca9f('0x17')]||null:null,'limit':_0x22c161[_0xca9f('0x14')]?_0x22c161[_0xca9f('0x14')][_0xca9f('0x18')]||null:null,'include':_0x22c161[_0xca9f('0x14')]?_0x22c161['options']['include']?_[_0xca9f('0x19')](_0x22c161[_0xca9f('0x14')][_0xca9f('0x1a')],function(_0x1066bc){return{'model':db[_0x1066bc[_0xca9f('0x1b')]],'as':_0x1066bc['as'],'attributes':_0x1066bc['attributes'],'include':_0x1066bc[_0xca9f('0x1a')]?_[_0xca9f('0x19')](_0x1066bc[_0xca9f('0x1a')],function(_0x4d64eb){return{'model':db[_0x4d64eb[_0xca9f('0x1b')]],'as':_0x4d64eb['as'],'attributes':_0x4d64eb[_0xca9f('0x17')],'include':_0x4d64eb[_0xca9f('0x1a')]?_[_0xca9f('0x19')](_0x4d64eb[_0xca9f('0x1a')],function(_0x4c4558){return{'model':db[_0x4c4558[_0xca9f('0x1b')]],'as':_0x4c4558['as'],'attributes':_0x4c4558[_0xca9f('0x17')]};}):[]};}):[]};}):[]:[]})[_0xca9f('0xa')](function(_0x460ed6){logger[_0xca9f('0xb')]('GetFreshsalesAccount',_0x22c161);logger['debug'](_0xca9f('0x1c'),_0x22c161,JSON['stringify'](_0x460ed6));_0x1543aa(_0x460ed6);})[_0xca9f('0x1d')](function(_0x16b189){logger[_0xca9f('0xf')](_0xca9f('0x1c'),_0x16b189['message'],_0x22c161);_0x83aa2b(_0x2b3cfc['error'](0x1f4,_0x16b189[_0xca9f('0x11')]));});});};exports['ShowFreshsalesAccount']=function(_0x26b33d){var _0x54beae=this;return new Promise(function(_0x2fa5e1,_0xe0e25e){return db[_0xca9f('0x13')][_0xca9f('0x1e')]({'raw':_0x26b33d[_0xca9f('0x14')]?_0x26b33d[_0xca9f('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x26b33d['options']?_0x26b33d[_0xca9f('0x14')]['where']||null:null,'attributes':_0x26b33d[_0xca9f('0x14')]?_0x26b33d[_0xca9f('0x14')][_0xca9f('0x17')]||null:null,'include':_0x26b33d['options']?_0x26b33d['options'][_0xca9f('0x1a')]?_[_0xca9f('0x19')](_0x26b33d[_0xca9f('0x14')]['include'],function(_0x7cec1c){return{'model':db[_0x7cec1c[_0xca9f('0x1b')]],'as':_0x7cec1c['as'],'attributes':_0x7cec1c['attributes'],'include':_0x7cec1c['include']?_[_0xca9f('0x19')](_0x7cec1c[_0xca9f('0x1a')],function(_0x33e1dc){return{'model':db[_0x33e1dc[_0xca9f('0x1b')]],'as':_0x33e1dc['as'],'attributes':_0x33e1dc[_0xca9f('0x17')],'include':_0x33e1dc[_0xca9f('0x1a')]?_[_0xca9f('0x19')](_0x33e1dc[_0xca9f('0x1a')],function(_0xaa5f8f){return{'model':db[_0xaa5f8f[_0xca9f('0x1b')]],'as':_0xaa5f8f['as'],'attributes':_0xaa5f8f[_0xca9f('0x17')]};}):[]};}):[]};}):[]:[]})[_0xca9f('0xa')](function(_0x27ead3){logger['info'](_0xca9f('0x1f'),_0x26b33d);logger['debug'](_0xca9f('0x1f'),_0x26b33d,JSON[_0xca9f('0x20')](_0x27ead3));_0x2fa5e1(_0x27ead3);})['catch'](function(_0x6ba7ba){logger[_0xca9f('0xf')](_0xca9f('0x1f'),_0x6ba7ba[_0xca9f('0x11')],_0x26b33d);_0xe0e25e(_0x54beae[_0xca9f('0xf')](0x1f4,_0x6ba7ba['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index b84967b..c3c7ee7 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 _0x0170=['isAuthenticated','index','get','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0xd3e9cd,_0x38f343){var _0x2889d7=function(_0x5e1717){while(--_0x5e1717){_0xd3e9cd['push'](_0xd3e9cd['shift']());}};_0x2889d7(++_0x38f343);}(_0x0170,0x1ea));var _0x0017=function(_0x3f24da,_0x88ef40){_0x3f24da=_0x3f24da-0x0;var _0x40f13e=_0x0170[_0x3f24da];return _0x40f13e;};'use strict';var multer=require(_0x0017('0x0'));var util=require(_0x0017('0x1'));var path=require(_0x0017('0x2'));var timeout=require(_0x0017('0x3'));var express=require(_0x0017('0x4'));var router=express[_0x0017('0x5')]();var auth=require(_0x0017('0x6'));var interaction=require(_0x0017('0x7'));var config=require(_0x0017('0x8'));var controller=require(_0x0017('0x9'));router['get']('/',auth[_0x0017('0xa')](),controller[_0x0017('0xb')]);router[_0x0017('0xc')](_0x0017('0xd'),auth[_0x0017('0xa')](),controller[_0x0017('0xe')]);router[_0x0017('0xc')]('/:id/subjects',auth[_0x0017('0xa')](),controller[_0x0017('0xf')]);router['get'](_0x0017('0x10'),auth[_0x0017('0xa')](),controller[_0x0017('0x11')]);router[_0x0017('0xc')](_0x0017('0x12'),auth['isAuthenticated'](),controller[_0x0017('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0017('0x14')]);router[_0x0017('0x15')](_0x0017('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0017('0x16')](_0x0017('0xd'),auth['isAuthenticated'](),controller[_0x0017('0x17')]);module[_0x0017('0x18')]=router; \ No newline at end of file +var _0xd823=['./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x81e6e2,_0x3565ca){var _0x56bb71=function(_0x49c2b7){while(--_0x49c2b7){_0x81e6e2['push'](_0x81e6e2['shift']());}};_0x56bb71(++_0x3565ca);}(_0xd823,0x100));var _0x3d82=function(_0x22d655,_0x3941dd){_0x22d655=_0x22d655-0x0;var _0x257739=_0xd823[_0x22d655];return _0x257739;};'use strict';var multer=require(_0x3d82('0x0'));var util=require(_0x3d82('0x1'));var path=require(_0x3d82('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d82('0x3'));var router=express[_0x3d82('0x4')]();var auth=require(_0x3d82('0x5'));var interaction=require(_0x3d82('0x6'));var config=require(_0x3d82('0x7'));var controller=require(_0x3d82('0x8'));router[_0x3d82('0x9')]('/',auth[_0x3d82('0xa')](),controller['index']);router[_0x3d82('0x9')](_0x3d82('0xb'),auth[_0x3d82('0xa')](),controller[_0x3d82('0xc')]);router[_0x3d82('0x9')]('/:id/subjects',auth[_0x3d82('0xa')](),controller[_0x3d82('0xd')]);router[_0x3d82('0x9')](_0x3d82('0xe'),auth[_0x3d82('0xa')](),controller[_0x3d82('0xf')]);router[_0x3d82('0x9')](_0x3d82('0x10'),auth[_0x3d82('0xa')](),controller[_0x3d82('0x11')]);router[_0x3d82('0x12')]('/',auth[_0x3d82('0xa')](),controller[_0x3d82('0x13')]);router[_0x3d82('0x14')](_0x3d82('0xb'),auth[_0x3d82('0xa')](),controller[_0x3d82('0x15')]);router['delete'](_0x3d82('0xb'),auth[_0x3d82('0xa')](),controller[_0x3d82('0x16')]);module[_0x3d82('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 8fd4260..7e11539 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 _0xe58c=['STRING','exports'];(function(_0x34ef84,_0x5ae1ad){var _0x722daf=function(_0x3746fe){while(--_0x3746fe){_0x34ef84['push'](_0x34ef84['shift']());}};_0x722daf(++_0x5ae1ad);}(_0xe58c,0x1e9));var _0xce58=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xe58c[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require('sequelize');module[_0xce58('0x0')]={'name':{'type':Sequelize[_0xce58('0x1')]},'description':{'type':Sequelize[_0xce58('0x1')]}}; \ No newline at end of file +var _0x406a=['STRING','sequelize','exports'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x406a,0x9a));var _0xa406=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x406a[_0x36c6eb];return _0x30675b;};'use strict';var Sequelize=require(_0xa406('0x0'));module[_0xa406('0x1')]={'name':{'type':Sequelize[_0xa406('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 5fad7d3..188cad7 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 _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(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0x5fab[_0x323430];return _0x9eecd1;};'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 +var _0xabce=['../../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','then','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','status','json','offset','set','Content-Range','apply','reject','update','end','sendStatus','name','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','length','limit','order','pick','filters','where','VIRTUAL','merge','options','FreshsalesConfiguration','count','include','findAll','rows','show','params','fields','includeAll','find','create','body','getSubjects','findOne','sort','filter','getDescriptions','FreshsalesField','hasOwnProperty','nolimit','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xabce,0x103));var _0xeabc=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xabce[_0x494d1f];return _0x457b6e;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var jayson=require(_0xeabc('0x1a'));var client=jayson[_0xeabc('0x1b')][_0xeabc('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x53df9c,_0x235c2d,_0x1319f3,_0x3251c6){return new BPromise(function(_0x55f0de,_0x5f4ee8){var _0x3170ea=_0x3251c6||client;return _0x3170ea[_0xeabc('0x1d')](_0x53df9c,_0x1319f3)[_0xeabc('0x1e')](function(_0x53d5cb){logger[_0xeabc('0x1f')](_0xeabc('0x20'),_0x235c2d,'request\x20sent');logger['debug'](_0xeabc('0x21'),_0x235c2d,'request\x20sent',JSON[_0xeabc('0x22')](_0x53d5cb));if(_0x53d5cb[_0xeabc('0x23')]){if(_0x53d5cb[_0xeabc('0x23')][_0xeabc('0x24')]===0x1f4){logger[_0xeabc('0x23')](_0xeabc('0x20'),_0x235c2d,_0x53d5cb[_0xeabc('0x23')][_0xeabc('0x25')]);return _0x5f4ee8(_0x53d5cb['error'][_0xeabc('0x25')]);}logger['error'](_0xeabc('0x20'),_0x235c2d,_0x53d5cb[_0xeabc('0x23')]['message']);return _0x55f0de(_0x53d5cb[_0xeabc('0x23')][_0xeabc('0x25')]);}else{logger[_0xeabc('0x1f')](_0xeabc('0x20'),_0x235c2d,_0xeabc('0x26'));_0x55f0de(_0x53d5cb['result'][_0xeabc('0x25')]);}})[_0xeabc('0x27')](function(_0x91ab00){logger['error'](_0xeabc('0x20'),_0x235c2d,_0x91ab00);_0x5f4ee8(_0x91ab00);});});}function respondWithStatusCode(_0x3854d2,_0x214953){_0x214953=_0x214953||0xcc;return function(_0x319119){if(_0x319119){return _0x3854d2['sendStatus'](_0x214953);}return _0x3854d2[_0xeabc('0x28')](_0x214953)['end']();};}function respondWithResult(_0x27dbaf,_0x4d4e29){_0x4d4e29=_0x4d4e29||0xc8;return function(_0x811f0d){if(_0x811f0d){return _0x27dbaf[_0xeabc('0x28')](_0x4d4e29)[_0xeabc('0x29')](_0x811f0d);}};}function respondWithFilteredResult(_0x3f194e,_0x3a1a04){return function(_0x137293){if(_0x137293){var _0x131722=_0x137293['count'],_0x4c2693=_0x3a1a04[_0xeabc('0x2a')],_0x5b2934=_0x3a1a04[_0xeabc('0x2a')]+_0x3a1a04['limit'],_0x459c8a;if(_0x5b2934>=_0x131722){_0x5b2934=_0x131722;_0x459c8a=0xc8;}else{_0x459c8a=0xce;}_0x3f194e[_0xeabc('0x28')](_0x459c8a);return _0x3f194e[_0xeabc('0x2b')](_0xeabc('0x2c'),_0x4c2693+'-'+_0x5b2934+'/'+_0x131722)[_0xeabc('0x29')](_0x137293);}return null;};}function patchUpdates(_0x149170){return function(_0x481ee1){try{jsonpatch[_0xeabc('0x2d')](_0x481ee1,_0x149170,!![]);}catch(_0x38dc0a){return BPromise[_0xeabc('0x2e')](_0x38dc0a);}return _0x481ee1['save']();};}function saveUpdates(_0x5b34dd,_0x5bb1f1){return function(_0x2f03e8){if(_0x2f03e8){return _0x2f03e8[_0xeabc('0x2f')](_0x5b34dd)[_0xeabc('0x1e')](function(_0x3c606a){return _0x3c606a;});}return null;};}function removeEntity(_0x73c8d4,_0x368b8a){return function(_0x61c0af){if(_0x61c0af){return _0x61c0af['destroy']()[_0xeabc('0x1e')](function(){_0x73c8d4[_0xeabc('0x28')](0xcc)[_0xeabc('0x30')]();});}};}function handleEntityNotFound(_0x4918e2,_0x1e74ca){return function(_0x3777c1){if(!_0x3777c1){_0x4918e2[_0xeabc('0x31')](0x194);}return _0x3777c1;};}function handleError(_0x4e9e17,_0xc0a5b0){_0xc0a5b0=_0xc0a5b0||0x1f4;return function(_0x36cc2f){logger[_0xeabc('0x23')](_0x36cc2f['stack']);if(_0x36cc2f[_0xeabc('0x32')]){delete _0x36cc2f[_0xeabc('0x32')];}_0x4e9e17['status'](_0xc0a5b0)['send'](_0x36cc2f);};}exports[_0xeabc('0x33')]=function(_0x3829a9,_0x4fc60c){var _0x43df50={},_0x81976d={},_0x3edee7={'count':0x0,'rows':[]};var _0x10434e=_[_0xeabc('0x34')](db['FreshsalesConfiguration'][_0xeabc('0x35')],function(_0x5b61fa){return{'name':_0x5b61fa[_0xeabc('0x36')],'type':_0x5b61fa[_0xeabc('0x37')][_0xeabc('0x38')]};});_0x81976d['model']=_['map'](_0x10434e,_0xeabc('0x32'));_0x81976d['query']=_[_0xeabc('0x39')](_0x3829a9['query']);_0x81976d['filters']=_['intersection'](_0x81976d['model'],_0x81976d[_0xeabc('0x3a')]);_0x43df50['attributes']=_[_0xeabc('0x3b')](_0x81976d[_0xeabc('0x3c')],qs['fields'](_0x3829a9[_0xeabc('0x3a')]['fields']));_0x43df50[_0xeabc('0x3d')]=_0x43df50['attributes'][_0xeabc('0x3e')]?_0x43df50[_0xeabc('0x3d')]:_0x81976d[_0xeabc('0x3c')];if(!_0x3829a9['query']['hasOwnProperty']('nolimit')){_0x43df50[_0xeabc('0x3f')]=qs[_0xeabc('0x3f')](_0x3829a9[_0xeabc('0x3a')]['limit']);_0x43df50['offset']=qs[_0xeabc('0x2a')](_0x3829a9[_0xeabc('0x3a')]['offset']);}_0x43df50[_0xeabc('0x40')]=qs['sort'](_0x3829a9[_0xeabc('0x3a')]['sort']);_0x43df50['where']=qs['filters'](_[_0xeabc('0x41')](_0x3829a9[_0xeabc('0x3a')],_0x81976d[_0xeabc('0x42')]),_0x10434e);if(_0x3829a9[_0xeabc('0x3a')]['filter']){_0x43df50[_0xeabc('0x43')]=_['merge'](_0x43df50[_0xeabc('0x43')],{'$or':_[_0xeabc('0x34')](_0x10434e,function(_0x3a7807){if(_0x3a7807[_0xeabc('0x37')]!==_0xeabc('0x44')){var _0x48b988={};_0x48b988[_0x3a7807['name']]={'$like':'%'+_0x3829a9[_0xeabc('0x3a')]['filter']+'%'};return _0x48b988;}})});}_0x43df50=_[_0xeabc('0x45')]({},_0x43df50,_0x3829a9[_0xeabc('0x46')]);var _0x4d92b2={'where':_0x43df50[_0xeabc('0x43')]};return db[_0xeabc('0x47')][_0xeabc('0x48')](_0x4d92b2)[_0xeabc('0x1e')](function(_0x4360d7){_0x3edee7[_0xeabc('0x48')]=_0x4360d7;if(_0x3829a9[_0xeabc('0x3a')]['includeAll']){_0x43df50[_0xeabc('0x49')]=[{'all':!![]}];}return db[_0xeabc('0x47')][_0xeabc('0x4a')](_0x43df50);})[_0xeabc('0x1e')](function(_0x271f8c){_0x3edee7[_0xeabc('0x4b')]=_0x271f8c;return _0x3edee7;})[_0xeabc('0x1e')](respondWithFilteredResult(_0x4fc60c,_0x43df50))[_0xeabc('0x27')](handleError(_0x4fc60c,null));};exports[_0xeabc('0x4c')]=function(_0x44e714,_0x5689fc){var _0x38356c={'raw':![],'where':{'id':_0x44e714[_0xeabc('0x4d')]['id']}},_0x2e6efb={};_0x2e6efb[_0xeabc('0x3c')]=_[_0xeabc('0x39')](db[_0xeabc('0x47')][_0xeabc('0x35')]);_0x2e6efb['query']=_[_0xeabc('0x39')](_0x44e714[_0xeabc('0x3a')]);_0x2e6efb[_0xeabc('0x42')]=_[_0xeabc('0x3b')](_0x2e6efb[_0xeabc('0x3c')],_0x2e6efb['query']);_0x38356c[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](_0x2e6efb[_0xeabc('0x3c')],qs[_0xeabc('0x4e')](_0x44e714['query'][_0xeabc('0x4e')]));_0x38356c[_0xeabc('0x3d')]=_0x38356c['attributes'][_0xeabc('0x3e')]?_0x38356c['attributes']:_0x2e6efb[_0xeabc('0x3c')];if(_0x44e714['query'][_0xeabc('0x4f')]){_0x38356c[_0xeabc('0x49')]=[{'all':!![]}];}_0x38356c=_[_0xeabc('0x45')]({},_0x38356c,_0x44e714[_0xeabc('0x46')]);return db[_0xeabc('0x47')][_0xeabc('0x50')](_0x38356c)[_0xeabc('0x1e')](handleEntityNotFound(_0x5689fc,null))[_0xeabc('0x1e')](respondWithResult(_0x5689fc,null))[_0xeabc('0x27')](handleError(_0x5689fc,null));};exports[_0xeabc('0x51')]=function(_0x48a13f,_0x180a14){return db[_0xeabc('0x47')][_0xeabc('0x51')](_0x48a13f[_0xeabc('0x52')],{})['then'](respondWithResult(_0x180a14,0xc9))[_0xeabc('0x27')](handleError(_0x180a14,null));};exports[_0xeabc('0x2f')]=function(_0x10d56f,_0x21f972){if(_0x10d56f['body']['id']){delete _0x10d56f[_0xeabc('0x52')]['id'];}return db[_0xeabc('0x47')][_0xeabc('0x50')]({'where':{'id':_0x10d56f[_0xeabc('0x4d')]['id']}})[_0xeabc('0x1e')](handleEntityNotFound(_0x21f972,null))[_0xeabc('0x1e')](saveUpdates(_0x10d56f[_0xeabc('0x52')],null))[_0xeabc('0x1e')](respondWithResult(_0x21f972,null))[_0xeabc('0x27')](handleError(_0x21f972,null));};exports['destroy']=function(_0x4546c4,_0x4cdb05){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x4546c4[_0xeabc('0x4d')]['id']}})[_0xeabc('0x1e')](handleEntityNotFound(_0x4cdb05,null))[_0xeabc('0x1e')](removeEntity(_0x4cdb05,null))[_0xeabc('0x27')](handleError(_0x4cdb05,null));};exports[_0xeabc('0x53')]=function(_0x2f78f3,_0x4a2ad6,_0x4358d7){var _0x25fd83={};var _0x19f61e={};var _0x104c1e;var _0x2ddc53;return db[_0xeabc('0x47')][_0xeabc('0x54')]({'where':{'id':_0x2f78f3[_0xeabc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4a2ad6,null))['then'](function(_0x180e62){if(_0x180e62){_0x104c1e=_0x180e62;_0x19f61e[_0xeabc('0x3c')]=_[_0xeabc('0x39')](db['FreshsalesField'][_0xeabc('0x35')]);_0x19f61e['query']=_['keys'](_0x2f78f3[_0xeabc('0x3a')]);_0x19f61e[_0xeabc('0x42')]=_[_0xeabc('0x3b')](_0x19f61e[_0xeabc('0x3c')],_0x19f61e[_0xeabc('0x3a')]);_0x25fd83[_0xeabc('0x3d')]=_['intersection'](_0x19f61e[_0xeabc('0x3c')],qs[_0xeabc('0x4e')](_0x2f78f3[_0xeabc('0x3a')][_0xeabc('0x4e')]));_0x25fd83[_0xeabc('0x3d')]=_0x25fd83[_0xeabc('0x3d')]['length']?_0x25fd83[_0xeabc('0x3d')]:_0x19f61e[_0xeabc('0x3c')];_0x25fd83[_0xeabc('0x40')]=qs[_0xeabc('0x55')](_0x2f78f3[_0xeabc('0x3a')][_0xeabc('0x55')]);_0x25fd83[_0xeabc('0x43')]=qs[_0xeabc('0x42')](_[_0xeabc('0x41')](_0x2f78f3['query'],_0x19f61e[_0xeabc('0x42')]));if(_0x2f78f3['query'][_0xeabc('0x56')]){_0x25fd83[_0xeabc('0x43')]=_[_0xeabc('0x45')](_0x25fd83[_0xeabc('0x43')],{'$or':_[_0xeabc('0x34')](_0x25fd83[_0xeabc('0x3d')],function(_0xf48062){var _0xb59a2a={};_0xb59a2a[_0xf48062]={'$like':'%'+_0x2f78f3[_0xeabc('0x3a')][_0xeabc('0x56')]+'%'};return _0xb59a2a;})});}_0x25fd83=_['merge']({},_0x25fd83,_0x2f78f3[_0xeabc('0x46')]);return _0x104c1e[_0xeabc('0x53')](_0x25fd83);}})[_0xeabc('0x1e')](function(_0x41cad5){if(_0x41cad5){_0x2ddc53=_0x41cad5['length'];if(!_0x2f78f3[_0xeabc('0x3a')]['hasOwnProperty']('nolimit')){_0x25fd83[_0xeabc('0x3f')]=qs[_0xeabc('0x3f')](_0x2f78f3[_0xeabc('0x3a')][_0xeabc('0x3f')]);_0x25fd83['offset']=qs['offset'](_0x2f78f3[_0xeabc('0x3a')]['offset']);}return _0x104c1e['getSubjects'](_0x25fd83);}})[_0xeabc('0x1e')](function(_0x4f1a4f){if(_0x4f1a4f){return _0x4f1a4f?{'count':_0x2ddc53,'rows':_0x4f1a4f}:null;}})['then'](respondWithResult(_0x4a2ad6,null))[_0xeabc('0x27')](handleError(_0x4a2ad6,null));};exports[_0xeabc('0x57')]=function(_0x5613ef,_0x48cccc,_0xd866c0){var _0x5d183a={};var _0x238e2d={};var _0x15ca17;var _0x4c84a9;return db['FreshsalesConfiguration'][_0xeabc('0x54')]({'where':{'id':_0x5613ef[_0xeabc('0x4d')]['id']}})[_0xeabc('0x1e')](handleEntityNotFound(_0x48cccc,null))[_0xeabc('0x1e')](function(_0x1debaa){if(_0x1debaa){_0x15ca17=_0x1debaa;_0x238e2d['model']=_['keys'](db[_0xeabc('0x58')]['rawAttributes']);_0x238e2d[_0xeabc('0x3a')]=_['keys'](_0x5613ef[_0xeabc('0x3a')]);_0x238e2d['filters']=_[_0xeabc('0x3b')](_0x238e2d['model'],_0x238e2d[_0xeabc('0x3a')]);_0x5d183a[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](_0x238e2d[_0xeabc('0x3c')],qs['fields'](_0x5613ef[_0xeabc('0x3a')]['fields']));_0x5d183a[_0xeabc('0x3d')]=_0x5d183a[_0xeabc('0x3d')][_0xeabc('0x3e')]?_0x5d183a[_0xeabc('0x3d')]:_0x238e2d[_0xeabc('0x3c')];_0x5d183a['order']=qs[_0xeabc('0x55')](_0x5613ef[_0xeabc('0x3a')][_0xeabc('0x55')]);_0x5d183a[_0xeabc('0x43')]=qs['filters'](_[_0xeabc('0x41')](_0x5613ef[_0xeabc('0x3a')],_0x238e2d[_0xeabc('0x42')]));if(_0x5613ef[_0xeabc('0x3a')]['filter']){_0x5d183a[_0xeabc('0x43')]=_[_0xeabc('0x45')](_0x5d183a[_0xeabc('0x43')],{'$or':_[_0xeabc('0x34')](_0x5d183a['attributes'],function(_0x56b7d0){var _0x30e9eb={};_0x30e9eb[_0x56b7d0]={'$like':'%'+_0x5613ef['query']['filter']+'%'};return _0x30e9eb;})});}_0x5d183a=_[_0xeabc('0x45')]({},_0x5d183a,_0x5613ef[_0xeabc('0x46')]);return _0x15ca17[_0xeabc('0x57')](_0x5d183a);}})['then'](function(_0x1baf30){if(_0x1baf30){_0x4c84a9=_0x1baf30[_0xeabc('0x3e')];if(!_0x5613ef['query'][_0xeabc('0x59')](_0xeabc('0x5a'))){_0x5d183a[_0xeabc('0x3f')]=qs[_0xeabc('0x3f')](_0x5613ef[_0xeabc('0x3a')]['limit']);_0x5d183a[_0xeabc('0x2a')]=qs['offset'](_0x5613ef['query']['offset']);}return _0x15ca17[_0xeabc('0x57')](_0x5d183a);}})[_0xeabc('0x1e')](function(_0x1b6e9e){if(_0x1b6e9e){return _0x1b6e9e?{'count':_0x4c84a9,'rows':_0x1b6e9e}:null;}})[_0xeabc('0x1e')](respondWithResult(_0x48cccc,null))[_0xeabc('0x27')](handleError(_0x48cccc,null));};exports['getFields']=function(_0x39f961,_0x47fd82,_0x1795fe){var _0x2f95c7={};var _0x4dac49={};var _0x11dda7;var _0x4d7821;return db['FreshsalesConfiguration'][_0xeabc('0x54')]({'where':{'id':_0x39f961[_0xeabc('0x4d')]['id']}})[_0xeabc('0x1e')](handleEntityNotFound(_0x47fd82,null))[_0xeabc('0x1e')](function(_0x3c6a49){if(_0x3c6a49){_0x11dda7=_0x3c6a49;_0x4dac49['model']=_[_0xeabc('0x39')](db[_0xeabc('0x58')][_0xeabc('0x35')]);_0x4dac49[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x39f961[_0xeabc('0x3a')]);_0x4dac49[_0xeabc('0x42')]=_[_0xeabc('0x3b')](_0x4dac49[_0xeabc('0x3c')],_0x4dac49[_0xeabc('0x3a')]);_0x2f95c7['attributes']=_[_0xeabc('0x3b')](_0x4dac49[_0xeabc('0x3c')],qs[_0xeabc('0x4e')](_0x39f961['query']['fields']));_0x2f95c7[_0xeabc('0x3d')]=_0x2f95c7[_0xeabc('0x3d')][_0xeabc('0x3e')]?_0x2f95c7[_0xeabc('0x3d')]:_0x4dac49[_0xeabc('0x3c')];_0x2f95c7['order']=qs[_0xeabc('0x55')](_0x39f961['query']['sort']);_0x2f95c7[_0xeabc('0x43')]=qs[_0xeabc('0x42')](_['pick'](_0x39f961[_0xeabc('0x3a')],_0x4dac49[_0xeabc('0x42')]));if(_0x39f961[_0xeabc('0x3a')][_0xeabc('0x56')]){_0x2f95c7[_0xeabc('0x43')]=_[_0xeabc('0x45')](_0x2f95c7[_0xeabc('0x43')],{'$or':_[_0xeabc('0x34')](_0x2f95c7[_0xeabc('0x3d')],function(_0x1b0995){var _0x1f8197={};_0x1f8197[_0x1b0995]={'$like':'%'+_0x39f961['query'][_0xeabc('0x56')]+'%'};return _0x1f8197;})});}_0x2f95c7=_['merge']({},_0x2f95c7,_0x39f961[_0xeabc('0x46')]);return _0x11dda7[_0xeabc('0x5b')](_0x2f95c7);}})[_0xeabc('0x1e')](function(_0x2d1441){if(_0x2d1441){_0x4d7821=_0x2d1441[_0xeabc('0x3e')];if(!_0x39f961[_0xeabc('0x3a')][_0xeabc('0x59')](_0xeabc('0x5a'))){_0x2f95c7[_0xeabc('0x3f')]=qs[_0xeabc('0x3f')](_0x39f961[_0xeabc('0x3a')]['limit']);_0x2f95c7[_0xeabc('0x2a')]=qs[_0xeabc('0x2a')](_0x39f961[_0xeabc('0x3a')][_0xeabc('0x2a')]);}return _0x11dda7['getFields'](_0x2f95c7);}})[_0xeabc('0x1e')](function(_0x180f99){if(_0x180f99){return _0x180f99?{'count':_0x4d7821,'rows':_0x180f99}:null;}})['then'](respondWithResult(_0x47fd82,null))[_0xeabc('0x27')](handleError(_0x47fd82,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index fa3fd0c..7625419 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 _0x8aa7=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x143ce6,_0x46e089){var _0x33ed64=function(_0x5a6856){while(--_0x5a6856){_0x143ce6['push'](_0x143ce6['shift']());}};_0x33ed64(++_0x46e089);}(_0x8aa7,0xb6));var _0x78aa=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x8aa7[_0x11ce46];return _0x368a1e;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var logger=require(_0x78aa('0x1'))(_0x78aa('0x2'));var moment=require(_0x78aa('0x3'));var BPromise=require(_0x78aa('0x4'));var rp=require(_0x78aa('0x5'));var fs=require('fs');var path=require(_0x78aa('0x6'));var rimraf=require('rimraf');var config=require(_0x78aa('0x7'));var attributes=require(_0x78aa('0x8'));module[_0x78aa('0x9')]=function(_0x229075,_0x2d17c2){return _0x229075[_0x78aa('0xa')](_0x78aa('0xb'),attributes,{'tableName':_0x78aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf109=['FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x5ccdd0,_0x23a0ba){var _0x4788ea=function(_0x40750c){while(--_0x40750c){_0x5ccdd0['push'](_0x5ccdd0['shift']());}};_0x4788ea(++_0x23a0ba);}(_0xf109,0xce));var _0x9f10=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xf109[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'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 3cbe4c1..9581ba5 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 _0x6146=['then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesConfiguration,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3163b3,_0x56a80f){var _0x4f148d=function(_0x1c93c2){while(--_0x1c93c2){_0x3163b3['push'](_0x3163b3['shift']());}};_0x4f148d(++_0x56a80f);}(_0x6146,0xba));var _0x6614=function(_0x102ba4,_0x28b1f7){_0x102ba4=_0x102ba4-0x0;var _0xc8973a=_0x6146[_0x102ba4];return _0xc8973a;};'use strict';var _=require(_0x6614('0x0'));var util=require('util');var moment=require(_0x6614('0x1'));var BPromise=require(_0x6614('0x2'));var rs=require(_0x6614('0x3'));var fs=require('fs');var Redis=require(_0x6614('0x4'));var db=require(_0x6614('0x5'))['db'];var utils=require(_0x6614('0x6'));var logger=require(_0x6614('0x7'))('rpc');var config=require(_0x6614('0x8'));var jayson=require(_0x6614('0x9'));var client=jayson[_0x6614('0xa')][_0x6614('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b158b,_0x2e84fa,_0x4116e4){return new BPromise(function(_0x209bdd,_0x9bf15){return client['request'](_0x3b158b,_0x4116e4)[_0x6614('0xc')](function(_0x267e1b){logger[_0x6614('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2e84fa,_0x6614('0xe'));logger[_0x6614('0xf')](_0x6614('0x10'),_0x2e84fa,_0x6614('0xe'),JSON[_0x6614('0x11')](_0x267e1b));if(_0x267e1b[_0x6614('0x12')]){if(_0x267e1b[_0x6614('0x12')]['code']===0x1f4){logger[_0x6614('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2e84fa,_0x267e1b[_0x6614('0x12')][_0x6614('0x13')]);return _0x9bf15(_0x267e1b[_0x6614('0x12')][_0x6614('0x13')]);}logger[_0x6614('0x12')](_0x6614('0x14'),_0x2e84fa,_0x267e1b[_0x6614('0x12')][_0x6614('0x13')]);return _0x209bdd(_0x267e1b[_0x6614('0x12')]['message']);}else{logger['info'](_0x6614('0x14'),_0x2e84fa,_0x6614('0xe'));_0x209bdd(_0x267e1b['result'][_0x6614('0x13')]);}})[_0x6614('0x15')](function(_0x3a0fee){logger['error'](_0x6614('0x14'),_0x2e84fa,_0x3a0fee);_0x9bf15(_0x3a0fee);});});} \ No newline at end of file +var _0x2547=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util'];(function(_0x2e7f96,_0x2ffe43){var _0x315277=function(_0x26bcae){while(--_0x26bcae){_0x2e7f96['push'](_0x2e7f96['shift']());}};_0x315277(++_0x2ffe43);}(_0x2547,0x1cd));var _0x7254=function(_0xaefe99,_0x4e8896){_0xaefe99=_0xaefe99-0x0;var _0x4c8d2c=_0x2547[_0xaefe99];return _0x4c8d2c;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var moment=require(_0x7254('0x1'));var BPromise=require(_0x7254('0x2'));var rs=require(_0x7254('0x3'));var fs=require('fs');var Redis=require(_0x7254('0x4'));var db=require(_0x7254('0x5'))['db'];var utils=require(_0x7254('0x6'));var logger=require(_0x7254('0x7'))('rpc');var config=require(_0x7254('0x8'));var jayson=require(_0x7254('0x9'));var client=jayson[_0x7254('0xa')][_0x7254('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b845f,_0x253b1e,_0x6e3d84){return new BPromise(function(_0x395913,_0x5da1ec){return client[_0x7254('0xc')](_0x4b845f,_0x6e3d84)['then'](function(_0x50925f){logger['info'](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));logger[_0x7254('0xf')](_0x7254('0x10'),_0x253b1e,_0x7254('0xe'),JSON[_0x7254('0x11')](_0x50925f));if(_0x50925f['error']){if(_0x50925f[_0x7254('0x12')]['code']===0x1f4){logger[_0x7254('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x5da1ec(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);return _0x395913(_0x50925f[_0x7254('0x12')][_0x7254('0x13')]);}else{logger[_0x7254('0x14')](_0x7254('0xd'),_0x253b1e,_0x7254('0xe'));_0x395913(_0x50925f['result'][_0x7254('0x13')]);}})[_0x7254('0x15')](function(_0xf47255){logger[_0x7254('0x12')](_0x7254('0xd'),_0x253b1e,_0xf47255);_0x5da1ec(_0xf47255);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index b9393f4..9a057b7 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 _0x6e4c=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy'];(function(_0xba40c1,_0x205117){var _0x16d40a=function(_0xe0bc1d){while(--_0xe0bc1d){_0xba40c1['push'](_0xba40c1['shift']());}};_0x16d40a(++_0x205117);}(_0x6e4c,0x169));var _0xc6e4=function(_0x2947f9,_0x3de637){_0x2947f9=_0x2947f9-0x0;var _0x3736b4=_0x6e4c[_0x2947f9];return _0x3736b4;};'use strict';var multer=require('multer');var util=require(_0xc6e4('0x0'));var path=require(_0xc6e4('0x1'));var timeout=require(_0xc6e4('0x2'));var express=require(_0xc6e4('0x3'));var router=express[_0xc6e4('0x4')]();var auth=require(_0xc6e4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e4('0x6'));var controller=require(_0xc6e4('0x7'));router[_0xc6e4('0x8')]('/',auth[_0xc6e4('0x9')](),controller[_0xc6e4('0xa')]);router[_0xc6e4('0x8')](_0xc6e4('0xb'),auth[_0xc6e4('0x9')](),controller['show']);router[_0xc6e4('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc6e4('0xd')](_0xc6e4('0xb'),auth[_0xc6e4('0x9')](),controller[_0xc6e4('0xe')]);router[_0xc6e4('0xf')](_0xc6e4('0xb'),auth[_0xc6e4('0x9')](),controller[_0xc6e4('0x10')]);module[_0xc6e4('0x11')]=router; \ No newline at end of file +var _0x77a6=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x5a0684,_0x45a5ad){var _0x519051=function(_0xb9e622){while(--_0xb9e622){_0x5a0684['push'](_0x5a0684['shift']());}};_0x519051(++_0x45a5ad);}(_0x77a6,0x12f));var _0x677a=function(_0x75819f,_0x4840c9){_0x75819f=_0x75819f-0x0;var _0x487d34=_0x77a6[_0x75819f];return _0x487d34;};'use strict';var multer=require(_0x677a('0x0'));var util=require('util');var path=require(_0x677a('0x1'));var timeout=require(_0x677a('0x2'));var express=require('express');var router=express[_0x677a('0x3')]();var auth=require(_0x677a('0x4'));var interaction=require(_0x677a('0x5'));var config=require(_0x677a('0x6'));var controller=require('./intFreshsalesField.controller');router[_0x677a('0x7')]('/',auth[_0x677a('0x8')](),controller[_0x677a('0x9')]);router[_0x677a('0x7')]('/:id',auth[_0x677a('0x8')](),controller[_0x677a('0xa')]);router['post']('/',auth[_0x677a('0x8')](),controller[_0x677a('0xb')]);router[_0x677a('0xc')]('/:id',auth[_0x677a('0x8')](),controller[_0x677a('0xd')]);router[_0x677a('0xe')](_0x677a('0xf'),auth[_0x677a('0x8')](),controller[_0x677a('0x10')]);module[_0x677a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 717a7a6..fbfb803 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 _0x98fc=['sequelize','exports','ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN'];(function(_0x165d70,_0xf77262){var _0x497a28=function(_0x56cf16){while(--_0x56cf16){_0x165d70['push'](_0x165d70['shift']());}};_0x497a28(++_0xf77262);}(_0x98fc,0x156));var _0xc98f=function(_0x388da2,_0x571cad){_0x388da2=_0x388da2-0x0;var _0x2b1a45=_0x98fc[_0x388da2];return _0x2b1a45;};'use strict';var Sequelize=require(_0xc98f('0x0'));module[_0xc98f('0x1')]={'type':{'type':Sequelize[_0xc98f('0x2')](_0xc98f('0x3'),_0xc98f('0x4'),'customVariable',_0xc98f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc98f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc98f('0x2')](_0xc98f('0x3'),_0xc98f('0x4'),_0xc98f('0x7'))},'keyContent':{'type':Sequelize[_0xc98f('0x6')]},'idField':{'type':Sequelize[_0xc98f('0x6')]},'nameField':{'type':Sequelize[_0xc98f('0x6')]},'customField':{'type':Sequelize[_0xc98f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc98f('0x6')]}}; \ No newline at end of file +var _0x2b87=['ENUM','keyValue','string','STRING','variable','customVariable','sequelize','exports'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x2b87,0x186));var _0x72b8=function(_0x4123bf,_0x51e1e6){_0x4123bf=_0x4123bf-0x0;var _0x54339f=_0x2b87[_0x4123bf];return _0x54339f;};'use strict';var Sequelize=require(_0x72b8('0x0'));module[_0x72b8('0x1')]={'type':{'type':Sequelize[_0x72b8('0x2')]('string','variable','customVariable',_0x72b8('0x3')),'defaultValue':_0x72b8('0x4')},'content':{'type':Sequelize[_0x72b8('0x5')]},'key':{'type':Sequelize[_0x72b8('0x5')]},'keyType':{'type':Sequelize[_0x72b8('0x2')](_0x72b8('0x4'),_0x72b8('0x6'),_0x72b8('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x72b8('0x5')]},'nameField':{'type':Sequelize[_0x72b8('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x72b8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index cfc4c17..82baf6b 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 _0xaa3b=['destroy','error','stack','name','send','index','FreshsalesField','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','rawAttributes','includeAll','find','update','params','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','limit','set','Content-Range','json','apply','reject','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaa3b,0xae));var _0xbaa3=function(_0x25e7de,_0x24b676){_0x25e7de=_0x25e7de-0x0;var _0x5cd6b8=_0xaa3b[_0x25e7de];return _0x5cd6b8;};'use strict';var pdf=require(_0xbaa3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbaa3('0x1'));var zipdir=require(_0xbaa3('0x2'));var jsonpatch=require(_0xbaa3('0x3'));var rp=require(_0xbaa3('0x4'));var moment=require(_0xbaa3('0x5'));var BPromise=require(_0xbaa3('0x6'));var Mustache=require(_0xbaa3('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbaa3('0x8'));var ejs=require(_0xbaa3('0x9'));var fs=require('fs');var _=require(_0xbaa3('0xa'));var squel=require(_0xbaa3('0xb'));var crypto=require(_0xbaa3('0xc'));var jsforce=require(_0xbaa3('0xd'));var deskjs=require(_0xbaa3('0xe'));var toCsv=require(_0xbaa3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbaa3('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbaa3('0x10'));var hardwareService=require(_0xbaa3('0x11'));var logger=require(_0xbaa3('0x12'))(_0xbaa3('0x13'));var utils=require(_0xbaa3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbaa3('0x15'));var db=require(_0xbaa3('0x16'))['db'];function respondWithStatusCode(_0x36f4b3,_0x379b98){_0x379b98=_0x379b98||0xcc;return function(_0x368684){if(_0x368684){return _0x36f4b3[_0xbaa3('0x17')](_0x379b98);}return _0x36f4b3[_0xbaa3('0x18')](_0x379b98)['end']();};}function respondWithResult(_0x543059,_0x173485){_0x173485=_0x173485||0xc8;return function(_0x5989aa){if(_0x5989aa){return _0x543059[_0xbaa3('0x18')](_0x173485)['json'](_0x5989aa);}};}function respondWithFilteredResult(_0x3af0f2,_0x26046a){return function(_0x44e6f3){if(_0x44e6f3){var _0xe7d4ee=_0x44e6f3[_0xbaa3('0x19')],_0x5adff1=_0x26046a['offset'],_0x5ba940=_0x26046a['offset']+_0x26046a[_0xbaa3('0x1a')],_0x129181;if(_0x5ba940>=_0xe7d4ee){_0x5ba940=_0xe7d4ee;_0x129181=0xc8;}else{_0x129181=0xce;}_0x3af0f2[_0xbaa3('0x18')](_0x129181);return _0x3af0f2[_0xbaa3('0x1b')](_0xbaa3('0x1c'),_0x5adff1+'-'+_0x5ba940+'/'+_0xe7d4ee)[_0xbaa3('0x1d')](_0x44e6f3);}return null;};}function patchUpdates(_0x13fd45){return function(_0xfd363a){try{jsonpatch[_0xbaa3('0x1e')](_0xfd363a,_0x13fd45,!![]);}catch(_0x3a9684){return BPromise[_0xbaa3('0x1f')](_0x3a9684);}return _0xfd363a['save']();};}function saveUpdates(_0x5aee8b,_0x1c3fb3){return function(_0x3cb49f){if(_0x3cb49f){return _0x3cb49f['update'](_0x5aee8b)[_0xbaa3('0x20')](function(_0x14c899){return _0x14c899;});}return null;};}function removeEntity(_0x2b2e3c,_0x1f827b){return function(_0x48a284){if(_0x48a284){return _0x48a284[_0xbaa3('0x21')]()[_0xbaa3('0x20')](function(){_0x2b2e3c[_0xbaa3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39a654,_0x2d5f06){return function(_0x536c9d){if(!_0x536c9d){_0x39a654['sendStatus'](0x194);}return _0x536c9d;};}function handleError(_0x1b9d09,_0x2362d8){_0x2362d8=_0x2362d8||0x1f4;return function(_0x234c57){logger[_0xbaa3('0x22')](_0x234c57[_0xbaa3('0x23')]);if(_0x234c57[_0xbaa3('0x24')]){delete _0x234c57[_0xbaa3('0x24')];}_0x1b9d09[_0xbaa3('0x18')](_0x2362d8)[_0xbaa3('0x25')](_0x234c57);};}exports[_0xbaa3('0x26')]=function(_0x5cc726,_0xea25d3){var _0x4bf0={},_0x3d140d={},_0x49d030={'count':0x0,'rows':[]};var _0x15e597=_['map'](db[_0xbaa3('0x27')]['rawAttributes'],function(_0x23faee){return{'name':_0x23faee['fieldName'],'type':_0x23faee[_0xbaa3('0x28')][_0xbaa3('0x29')]};});_0x3d140d['model']=_[_0xbaa3('0x2a')](_0x15e597,'name');_0x3d140d[_0xbaa3('0x2b')]=_[_0xbaa3('0x2c')](_0x5cc726['query']);_0x3d140d[_0xbaa3('0x2d')]=_[_0xbaa3('0x2e')](_0x3d140d[_0xbaa3('0x2f')],_0x3d140d[_0xbaa3('0x2b')]);_0x4bf0['attributes']=_[_0xbaa3('0x2e')](_0x3d140d[_0xbaa3('0x2f')],qs['fields'](_0x5cc726['query'][_0xbaa3('0x30')]));_0x4bf0[_0xbaa3('0x31')]=_0x4bf0[_0xbaa3('0x31')]['length']?_0x4bf0['attributes']:_0x3d140d[_0xbaa3('0x2f')];if(!_0x5cc726[_0xbaa3('0x2b')][_0xbaa3('0x32')](_0xbaa3('0x33'))){_0x4bf0[_0xbaa3('0x1a')]=qs[_0xbaa3('0x1a')](_0x5cc726[_0xbaa3('0x2b')][_0xbaa3('0x1a')]);_0x4bf0['offset']=qs[_0xbaa3('0x34')](_0x5cc726[_0xbaa3('0x2b')][_0xbaa3('0x34')]);}_0x4bf0[_0xbaa3('0x35')]=qs[_0xbaa3('0x36')](_0x5cc726[_0xbaa3('0x2b')]['sort']);_0x4bf0[_0xbaa3('0x37')]=qs[_0xbaa3('0x2d')](_['pick'](_0x5cc726[_0xbaa3('0x2b')],_0x3d140d[_0xbaa3('0x2d')]),_0x15e597);if(_0x5cc726['query'][_0xbaa3('0x38')]){_0x4bf0[_0xbaa3('0x37')]=_[_0xbaa3('0x39')](_0x4bf0['where'],{'$or':_['map'](_0x15e597,function(_0x322b61){if(_0x322b61['type']!==_0xbaa3('0x3a')){var _0x526a9e={};_0x526a9e[_0x322b61[_0xbaa3('0x24')]]={'$like':'%'+_0x5cc726[_0xbaa3('0x2b')][_0xbaa3('0x38')]+'%'};return _0x526a9e;}})});}_0x4bf0=_['merge']({},_0x4bf0,_0x5cc726[_0xbaa3('0x3b')]);var _0x170718={'where':_0x4bf0[_0xbaa3('0x37')]};return db[_0xbaa3('0x27')][_0xbaa3('0x19')](_0x170718)['then'](function(_0x34936c){_0x49d030[_0xbaa3('0x19')]=_0x34936c;if(_0x5cc726[_0xbaa3('0x2b')]['includeAll']){_0x4bf0[_0xbaa3('0x3c')]=[{'all':!![]}];}return db[_0xbaa3('0x27')]['findAll'](_0x4bf0);})[_0xbaa3('0x20')](function(_0x5006ff){_0x49d030[_0xbaa3('0x3d')]=_0x5006ff;return _0x49d030;})[_0xbaa3('0x20')](respondWithFilteredResult(_0xea25d3,_0x4bf0))[_0xbaa3('0x3e')](handleError(_0xea25d3,null));};exports['show']=function(_0x2dc5f7,_0x2b7f8b){var _0x4795cc={'raw':!![],'where':{'id':_0x2dc5f7['params']['id']}},_0x3b18f2={};_0x3b18f2['model']=_[_0xbaa3('0x2c')](db[_0xbaa3('0x27')][_0xbaa3('0x3f')]);_0x3b18f2[_0xbaa3('0x2b')]=_[_0xbaa3('0x2c')](_0x2dc5f7['query']);_0x3b18f2[_0xbaa3('0x2d')]=_['intersection'](_0x3b18f2['model'],_0x3b18f2[_0xbaa3('0x2b')]);_0x4795cc[_0xbaa3('0x31')]=_[_0xbaa3('0x2e')](_0x3b18f2[_0xbaa3('0x2f')],qs[_0xbaa3('0x30')](_0x2dc5f7[_0xbaa3('0x2b')][_0xbaa3('0x30')]));_0x4795cc[_0xbaa3('0x31')]=_0x4795cc[_0xbaa3('0x31')]['length']?_0x4795cc[_0xbaa3('0x31')]:_0x3b18f2[_0xbaa3('0x2f')];if(_0x2dc5f7[_0xbaa3('0x2b')][_0xbaa3('0x40')]){_0x4795cc[_0xbaa3('0x3c')]=[{'all':!![]}];}_0x4795cc=_[_0xbaa3('0x39')]({},_0x4795cc,_0x2dc5f7[_0xbaa3('0x3b')]);return db[_0xbaa3('0x27')][_0xbaa3('0x41')](_0x4795cc)[_0xbaa3('0x20')](handleEntityNotFound(_0x2b7f8b,null))['then'](respondWithResult(_0x2b7f8b,null))[_0xbaa3('0x3e')](handleError(_0x2b7f8b,null));};exports['create']=function(_0x5ed21e,_0x3ff0ea){return db[_0xbaa3('0x27')]['create'](_0x5ed21e['body'],{})['then'](respondWithResult(_0x3ff0ea,0xc9))[_0xbaa3('0x3e')](handleError(_0x3ff0ea,null));};exports[_0xbaa3('0x42')]=function(_0x2f26d4,_0x487e6c){if(_0x2f26d4['body']['id']){delete _0x2f26d4['body']['id'];}return db[_0xbaa3('0x27')][_0xbaa3('0x41')]({'where':{'id':_0x2f26d4[_0xbaa3('0x43')]['id']}})[_0xbaa3('0x20')](handleEntityNotFound(_0x487e6c,null))['then'](saveUpdates(_0x2f26d4[_0xbaa3('0x44')],null))['then'](respondWithResult(_0x487e6c,null))[_0xbaa3('0x3e')](handleError(_0x487e6c,null));};exports[_0xbaa3('0x21')]=function(_0x425bae,_0x56e451){return db[_0xbaa3('0x27')][_0xbaa3('0x41')]({'where':{'id':_0x425bae[_0xbaa3('0x43')]['id']}})[_0xbaa3('0x20')](handleEntityNotFound(_0x56e451,null))['then'](removeEntity(_0x56e451,null))[_0xbaa3('0x3e')](handleError(_0x56e451,null));}; \ No newline at end of file +var _0x23f1=['params','keys','includeAll','find','create','body','destroy','html-pdf','eml-format','request-promise','moment','mustache','util','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/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','end','sendStatus','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','show'];(function(_0x188cc7,_0x567b4c){var _0x4cd07a=function(_0x571e10){while(--_0x571e10){_0x188cc7['push'](_0x188cc7['shift']());}};_0x4cd07a(++_0x567b4c);}(_0x23f1,0x12f));var _0x123f=function(_0x3c2b00,_0x15e5fe){_0x3c2b00=_0x3c2b00-0x0;var _0x3c5030=_0x23f1[_0x3c2b00];return _0x3c5030;};'use strict';var pdf=require(_0x123f('0x0'));var emlformat=require(_0x123f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x123f('0x2'));var moment=require(_0x123f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x123f('0x4'));var util=require(_0x123f('0x5'));var path=require('path');var sox=require(_0x123f('0x6'));var csv=require(_0x123f('0x7'));var ejs=require(_0x123f('0x8'));var fs=require('fs');var _=require(_0x123f('0x9'));var squel=require(_0x123f('0xa'));var crypto=require(_0x123f('0xb'));var jsforce=require(_0x123f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x123f('0x7'));var querystring=require(_0x123f('0xd'));var Papa=require(_0x123f('0xe'));var Redis=require(_0x123f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x123f('0x10'));var as=require(_0x123f('0x11'));var hardwareService=require(_0x123f('0x12'));var logger=require(_0x123f('0x13'))('api');var utils=require(_0x123f('0x14'));var config=require(_0x123f('0x15'));var licenseUtil=require(_0x123f('0x16'));var db=require(_0x123f('0x17'))['db'];function respondWithStatusCode(_0x9dff46,_0x2a2386){_0x2a2386=_0x2a2386||0xcc;return function(_0x4a2cbc){if(_0x4a2cbc){return _0x9dff46['sendStatus'](_0x2a2386);}return _0x9dff46[_0x123f('0x18')](_0x2a2386)['end']();};}function respondWithResult(_0x2828d0,_0x563a0c){_0x563a0c=_0x563a0c||0xc8;return function(_0x493294){if(_0x493294){return _0x2828d0[_0x123f('0x18')](_0x563a0c)['json'](_0x493294);}};}function respondWithFilteredResult(_0xd49028,_0x2d7110){return function(_0xb0b8a8){if(_0xb0b8a8){var _0x3eceb4=_0xb0b8a8[_0x123f('0x19')],_0x2981f3=_0x2d7110[_0x123f('0x1a')],_0x46e5da=_0x2d7110[_0x123f('0x1a')]+_0x2d7110[_0x123f('0x1b')],_0x1f8454;if(_0x46e5da>=_0x3eceb4){_0x46e5da=_0x3eceb4;_0x1f8454=0xc8;}else{_0x1f8454=0xce;}_0xd49028['status'](_0x1f8454);return _0xd49028[_0x123f('0x1c')](_0x123f('0x1d'),_0x2981f3+'-'+_0x46e5da+'/'+_0x3eceb4)[_0x123f('0x1e')](_0xb0b8a8);}return null;};}function patchUpdates(_0x103fde){return function(_0xeae699){try{jsonpatch[_0x123f('0x1f')](_0xeae699,_0x103fde,!![]);}catch(_0xc1f5f9){return BPromise[_0x123f('0x20')](_0xc1f5f9);}return _0xeae699['save']();};}function saveUpdates(_0x34697c,_0x50e6bb){return function(_0xe2c8f4){if(_0xe2c8f4){return _0xe2c8f4[_0x123f('0x21')](_0x34697c)['then'](function(_0x25f300){return _0x25f300;});}return null;};}function removeEntity(_0x323a46,_0x543090){return function(_0x489f95){if(_0x489f95){return _0x489f95['destroy']()[_0x123f('0x22')](function(){_0x323a46[_0x123f('0x18')](0xcc)[_0x123f('0x23')]();});}};}function handleEntityNotFound(_0x925f3,_0x919d5b){return function(_0x3f848c){if(!_0x3f848c){_0x925f3[_0x123f('0x24')](0x194);}return _0x3f848c;};}function handleError(_0x212214,_0x1e7e8c){_0x1e7e8c=_0x1e7e8c||0x1f4;return function(_0x5314be){logger[_0x123f('0x25')](_0x5314be[_0x123f('0x26')]);if(_0x5314be[_0x123f('0x27')]){delete _0x5314be[_0x123f('0x27')];}_0x212214[_0x123f('0x18')](_0x1e7e8c)['send'](_0x5314be);};}exports[_0x123f('0x28')]=function(_0xc1bc23,_0x1a625b){var _0x27705d={},_0x531f99={},_0x122d83={'count':0x0,'rows':[]};var _0x1b08a0=_[_0x123f('0x29')](db[_0x123f('0x2a')][_0x123f('0x2b')],function(_0x13e665){return{'name':_0x13e665[_0x123f('0x2c')],'type':_0x13e665[_0x123f('0x2d')][_0x123f('0x2e')]};});_0x531f99[_0x123f('0x2f')]=_[_0x123f('0x29')](_0x1b08a0,_0x123f('0x27'));_0x531f99[_0x123f('0x30')]=_['keys'](_0xc1bc23[_0x123f('0x30')]);_0x531f99[_0x123f('0x31')]=_['intersection'](_0x531f99[_0x123f('0x2f')],_0x531f99['query']);_0x27705d[_0x123f('0x32')]=_[_0x123f('0x33')](_0x531f99[_0x123f('0x2f')],qs['fields'](_0xc1bc23[_0x123f('0x30')][_0x123f('0x34')]));_0x27705d[_0x123f('0x32')]=_0x27705d[_0x123f('0x32')][_0x123f('0x35')]?_0x27705d[_0x123f('0x32')]:_0x531f99[_0x123f('0x2f')];if(!_0xc1bc23[_0x123f('0x30')][_0x123f('0x36')](_0x123f('0x37'))){_0x27705d['limit']=qs[_0x123f('0x1b')](_0xc1bc23[_0x123f('0x30')][_0x123f('0x1b')]);_0x27705d[_0x123f('0x1a')]=qs[_0x123f('0x1a')](_0xc1bc23[_0x123f('0x30')]['offset']);}_0x27705d[_0x123f('0x38')]=qs['sort'](_0xc1bc23['query']['sort']);_0x27705d['where']=qs[_0x123f('0x31')](_[_0x123f('0x39')](_0xc1bc23[_0x123f('0x30')],_0x531f99[_0x123f('0x31')]),_0x1b08a0);if(_0xc1bc23['query'][_0x123f('0x3a')]){_0x27705d['where']=_[_0x123f('0x3b')](_0x27705d[_0x123f('0x3c')],{'$or':_[_0x123f('0x29')](_0x1b08a0,function(_0x2acebd){if(_0x2acebd[_0x123f('0x2d')]!==_0x123f('0x3d')){var _0x18e16f={};_0x18e16f[_0x2acebd[_0x123f('0x27')]]={'$like':'%'+_0xc1bc23[_0x123f('0x30')]['filter']+'%'};return _0x18e16f;}})});}_0x27705d=_[_0x123f('0x3b')]({},_0x27705d,_0xc1bc23[_0x123f('0x3e')]);var _0x431f08={'where':_0x27705d[_0x123f('0x3c')]};return db[_0x123f('0x2a')][_0x123f('0x19')](_0x431f08)['then'](function(_0x3bf17b){_0x122d83[_0x123f('0x19')]=_0x3bf17b;if(_0xc1bc23[_0x123f('0x30')]['includeAll']){_0x27705d['include']=[{'all':!![]}];}return db[_0x123f('0x2a')][_0x123f('0x3f')](_0x27705d);})[_0x123f('0x22')](function(_0x515774){_0x122d83[_0x123f('0x40')]=_0x515774;return _0x122d83;})[_0x123f('0x22')](respondWithFilteredResult(_0x1a625b,_0x27705d))[_0x123f('0x41')](handleError(_0x1a625b,null));};exports[_0x123f('0x42')]=function(_0x2eb559,_0x1e2e53){var _0x3bcc29={'raw':!![],'where':{'id':_0x2eb559[_0x123f('0x43')]['id']}},_0x13531f={};_0x13531f[_0x123f('0x2f')]=_[_0x123f('0x44')](db[_0x123f('0x2a')]['rawAttributes']);_0x13531f[_0x123f('0x30')]=_[_0x123f('0x44')](_0x2eb559[_0x123f('0x30')]);_0x13531f[_0x123f('0x31')]=_[_0x123f('0x33')](_0x13531f['model'],_0x13531f[_0x123f('0x30')]);_0x3bcc29[_0x123f('0x32')]=_[_0x123f('0x33')](_0x13531f[_0x123f('0x2f')],qs[_0x123f('0x34')](_0x2eb559[_0x123f('0x30')][_0x123f('0x34')]));_0x3bcc29['attributes']=_0x3bcc29['attributes'][_0x123f('0x35')]?_0x3bcc29['attributes']:_0x13531f[_0x123f('0x2f')];if(_0x2eb559[_0x123f('0x30')][_0x123f('0x45')]){_0x3bcc29['include']=[{'all':!![]}];}_0x3bcc29=_[_0x123f('0x3b')]({},_0x3bcc29,_0x2eb559[_0x123f('0x3e')]);return db[_0x123f('0x2a')][_0x123f('0x46')](_0x3bcc29)[_0x123f('0x22')](handleEntityNotFound(_0x1e2e53,null))[_0x123f('0x22')](respondWithResult(_0x1e2e53,null))[_0x123f('0x41')](handleError(_0x1e2e53,null));};exports[_0x123f('0x47')]=function(_0x443996,_0x5f4071){return db[_0x123f('0x2a')][_0x123f('0x47')](_0x443996[_0x123f('0x48')],{})[_0x123f('0x22')](respondWithResult(_0x5f4071,0xc9))[_0x123f('0x41')](handleError(_0x5f4071,null));};exports[_0x123f('0x21')]=function(_0x1bd042,_0x1e7934){if(_0x1bd042[_0x123f('0x48')]['id']){delete _0x1bd042[_0x123f('0x48')]['id'];}return db[_0x123f('0x2a')]['find']({'where':{'id':_0x1bd042[_0x123f('0x43')]['id']}})[_0x123f('0x22')](handleEntityNotFound(_0x1e7934,null))[_0x123f('0x22')](saveUpdates(_0x1bd042[_0x123f('0x48')],null))[_0x123f('0x22')](respondWithResult(_0x1e7934,null))[_0x123f('0x41')](handleError(_0x1e7934,null));};exports[_0x123f('0x49')]=function(_0x58fcd6,_0x7ebd32){return db['FreshsalesField'][_0x123f('0x46')]({'where':{'id':_0x58fcd6[_0x123f('0x43')]['id']}})[_0x123f('0x22')](handleEntityNotFound(_0x7ebd32,null))[_0x123f('0x22')](removeEntity(_0x7ebd32,null))['catch'](handleError(_0x7ebd32,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 4861f53..5c27483 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 _0x1d51=['bluebird','path','rimraf','./intFreshsalesField.attributes','exports','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x1b2e2c,_0x488295){var _0x5db810=function(_0x3f2831){while(--_0x3f2831){_0x1b2e2c['push'](_0x1b2e2c['shift']());}};_0x5db810(++_0x488295);}(_0x1d51,0x98));var _0x11d5=function(_0x23d2d2,_0x317baf){_0x23d2d2=_0x23d2d2-0x0;var _0x337c5c=_0x1d51[_0x23d2d2];return _0x337c5c;};'use strict';var _=require(_0x11d5('0x0'));var util=require(_0x11d5('0x1'));var logger=require(_0x11d5('0x2'))(_0x11d5('0x3'));var moment=require('moment');var BPromise=require(_0x11d5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x11d5('0x5'));var rimraf=require(_0x11d5('0x6'));var config=require('../../config/environment');var attributes=require(_0x11d5('0x7'));module[_0x11d5('0x8')]=function(_0x4eb760,_0x593b36){return _0x4eb760['define']('FreshsalesField',attributes,{'tableName':_0x11d5('0x9'),'paranoid':![],'indexes':[{'name':_0x11d5('0xa'),'fields':[_0x11d5('0xb'),_0x11d5('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x12d3=['idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','FreshsalesField','freshsales_unique_index'];(function(_0x2e5ad4,_0x211fc3){var _0x13453e=function(_0x226068){while(--_0x226068){_0x2e5ad4['push'](_0x2e5ad4['shift']());}};_0x13453e(++_0x211fc3);}(_0x12d3,0xab));var _0x312d=function(_0x4d480f,_0x2f4f4a){_0x4d480f=_0x4d480f-0x0;var _0x366a33=_0x12d3[_0x4d480f];return _0x366a33;};'use strict';var _=require(_0x312d('0x0'));var util=require(_0x312d('0x1'));var logger=require(_0x312d('0x2'))(_0x312d('0x3'));var moment=require(_0x312d('0x4'));var BPromise=require('bluebird');var rp=require(_0x312d('0x5'));var fs=require('fs');var path=require(_0x312d('0x6'));var rimraf=require(_0x312d('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0x312d('0x8')]=function(_0x484ab0,_0x264811){return _0x484ab0['define'](_0x312d('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x312d('0xa'),'fields':[_0x312d('0xb'),_0x312d('0xc')],'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 7572892..8d21cdc 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 _0x2be1=['client','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x2be1,0xd3));var _0x12be=function(_0x46306f,_0x5aef14){_0x46306f=_0x46306f-0x0;var _0x16a27f=_0x2be1[_0x46306f];return _0x16a27f;};'use strict';var _=require(_0x12be('0x0'));var util=require(_0x12be('0x1'));var moment=require(_0x12be('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12be('0x3'));var db=require(_0x12be('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x12be('0x5'))(_0x12be('0x6'));var config=require(_0x12be('0x7'));var jayson=require(_0x12be('0x8'));var client=jayson[_0x12be('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3522f3,_0xea70b0,_0x838f76){return new BPromise(function(_0x422ad8,_0x20ac9c){return client[_0x12be('0xa')](_0x3522f3,_0x838f76)['then'](function(_0xf5f172){logger[_0x12be('0xb')](_0x12be('0xc'),_0xea70b0,_0x12be('0xd'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0xea70b0,_0x12be('0xd'),JSON[_0x12be('0xe')](_0xf5f172));if(_0xf5f172['error']){if(_0xf5f172[_0x12be('0xf')][_0x12be('0x10')]===0x1f4){logger[_0x12be('0xf')](_0x12be('0xc'),_0xea70b0,_0xf5f172[_0x12be('0xf')][_0x12be('0x11')]);return _0x20ac9c(_0xf5f172[_0x12be('0xf')][_0x12be('0x11')]);}logger[_0x12be('0xf')](_0x12be('0xc'),_0xea70b0,_0xf5f172[_0x12be('0xf')]['message']);return _0x422ad8(_0xf5f172[_0x12be('0xf')][_0x12be('0x11')]);}else{logger['info'](_0x12be('0xc'),_0xea70b0,_0x12be('0xd'));_0x422ad8(_0xf5f172[_0x12be('0x12')]['message']);}})[_0x12be('0x13')](function(_0x807c80){logger['error'](_0x12be('0xc'),_0xea70b0,_0x807c80);_0x20ac9c(_0x807c80);});});} \ No newline at end of file +var _0xefb3=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','catch','bluebird'];(function(_0x7e9416,_0x5af1ad){var _0x44cf06=function(_0x451238){while(--_0x451238){_0x7e9416['push'](_0x7e9416['shift']());}};_0x44cf06(++_0x5af1ad);}(_0xefb3,0x167));var _0x3efb=function(_0x299e1c,_0x23e10f){_0x299e1c=_0x299e1c-0x0;var _0x1a5d86=_0xefb3[_0x299e1c];return _0x1a5d86;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3efb('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3efb('0x1'));var db=require(_0x3efb('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3efb('0x3'))(_0x3efb('0x4'));var config=require(_0x3efb('0x5'));var jayson=require(_0x3efb('0x6'));var client=jayson[_0x3efb('0x7')][_0x3efb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29b8d2,_0x3bc6a1,_0x58f75a){return new BPromise(function(_0x2b07a6,_0x32d55b){return client[_0x3efb('0x9')](_0x29b8d2,_0x58f75a)[_0x3efb('0xa')](function(_0x4b31a3){logger[_0x3efb('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x3bc6a1,_0x3efb('0xc'));logger['debug'](_0x3efb('0xd'),_0x3bc6a1,_0x3efb('0xc'),JSON[_0x3efb('0xe')](_0x4b31a3));if(_0x4b31a3[_0x3efb('0xf')]){if(_0x4b31a3['error'][_0x3efb('0x10')]===0x1f4){logger[_0x3efb('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3bc6a1,_0x4b31a3['error'][_0x3efb('0x11')]);return _0x32d55b(_0x4b31a3[_0x3efb('0xf')][_0x3efb('0x11')]);}logger[_0x3efb('0xf')](_0x3efb('0x12'),_0x3bc6a1,_0x4b31a3[_0x3efb('0xf')]['message']);return _0x2b07a6(_0x4b31a3[_0x3efb('0xf')][_0x3efb('0x11')]);}else{logger[_0x3efb('0xb')](_0x3efb('0x12'),_0x3bc6a1,_0x3efb('0xc'));_0x2b07a6(_0x4b31a3['result'][_0x3efb('0x11')]);}})[_0x3efb('0x13')](function(_0x3761ff){logger[_0x3efb('0xf')](_0x3efb('0x12'),_0x3bc6a1,_0x3761ff);_0x32d55b(_0x3761ff);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 5329478..ff7541f 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 _0x033c=['/:id/fields','getFields','create','/:id','update','destroy','exports','multer','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id/configurations','getConfigurations'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x033c,0xc2));var _0xc033=function(_0x519160,_0x1330e3){_0x519160=_0x519160-0x0;var _0x9ae5=_0x033c[_0x519160];return _0x9ae5;};'use strict';var multer=require(_0xc033('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc033('0x1'));var router=express[_0xc033('0x2')]();var auth=require(_0xc033('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc033('0x4'));var controller=require('./intSalesforceAccount.controller');router['get']('/',auth[_0xc033('0x5')](),controller[_0xc033('0x6')]);router[_0xc033('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc033('0x7')](_0xc033('0x8'),auth[_0xc033('0x5')](),controller[_0xc033('0x9')]);router['get'](_0xc033('0xa'),auth['isAuthenticated'](),controller[_0xc033('0xb')]);router['post']('/',auth[_0xc033('0x5')](),controller[_0xc033('0xc')]);router['post'](_0xc033('0x8'),auth[_0xc033('0x5')](),controller['addConfiguration']);router['put'](_0xc033('0xd'),auth[_0xc033('0x5')](),controller[_0xc033('0xe')]);router['delete'](_0xc033('0xd'),auth[_0xc033('0x5')](),controller[_0xc033('0xf')]);module[_0xc033('0x10')]=router; \ No newline at end of file +var _0xbc02=['post','create','addConfiguration','update','delete','destroy','multer','path','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x2a8f56,_0x3cb867){var _0x357afd=function(_0x5e6a48){while(--_0x5e6a48){_0x2a8f56['push'](_0x2a8f56['shift']());}};_0x357afd(++_0x3cb867);}(_0xbc02,0x156));var _0x2bc0=function(_0x50b750,_0xe5817b){_0x50b750=_0x50b750-0x0;var _0x1b60a8=_0xbc02[_0x50b750];return _0x1b60a8;};'use strict';var multer=require(_0x2bc0('0x0'));var util=require('util');var path=require(_0x2bc0('0x1'));var timeout=require('connect-timeout');var express=require(_0x2bc0('0x2'));var router=express[_0x2bc0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2bc0('0x4'));var config=require(_0x2bc0('0x5'));var controller=require(_0x2bc0('0x6'));router[_0x2bc0('0x7')]('/',auth[_0x2bc0('0x8')](),controller[_0x2bc0('0x9')]);router[_0x2bc0('0x7')](_0x2bc0('0xa'),auth['isAuthenticated'](),controller[_0x2bc0('0xb')]);router[_0x2bc0('0x7')](_0x2bc0('0xc'),auth['isAuthenticated'](),controller[_0x2bc0('0xd')]);router[_0x2bc0('0x7')](_0x2bc0('0xe'),auth[_0x2bc0('0x8')](),controller['getFields']);router[_0x2bc0('0xf')]('/',auth[_0x2bc0('0x8')](),controller[_0x2bc0('0x10')]);router[_0x2bc0('0xf')](_0x2bc0('0xc'),auth[_0x2bc0('0x8')](),controller[_0x2bc0('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2bc0('0x12')]);router[_0x2bc0('0x13')](_0x2bc0('0xa'),auth[_0x2bc0('0x8')](),controller[_0x2bc0('0x14')]);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 91d9978..2547c72 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 _0x881b=['STRING','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x595631,_0x4539a2){var _0x3c3a6e=function(_0x36193e){while(--_0x36193e){_0x595631['push'](_0x595631['shift']());}};_0x3c3a6e(++_0x4539a2);}(_0x881b,0x1a2));var _0xb881=function(_0x19940b,_0xebefb5){_0x19940b=_0x19940b-0x0;var _0x44604a=_0x881b[_0x19940b];return _0x44604a;};'use strict';var Sequelize=require(_0xb881('0x0'));module[_0xb881('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb881('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb881('0x2')]},'clientId':{'type':Sequelize[_0xb881('0x2')]},'clientSecret':{'type':Sequelize[_0xb881('0x2')]},'securityToken':{'type':Sequelize[_0xb881('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb881('0x3')](_0xb881('0x4'),_0xb881('0x5')),'defaultValue':_0xb881('0x4')}}; \ No newline at end of file +var _0xff35=['sequelize','STRING','ENUM','integrationTab','newTab'];(function(_0x5cbed1,_0x2db17b){var _0x267334=function(_0x3ae4d4){while(--_0x3ae4d4){_0x5cbed1['push'](_0x5cbed1['shift']());}};_0x267334(++_0x2db17b);}(_0xff35,0x177));var _0x5ff3=function(_0x2e28d3,_0x6cbe9b){_0x2e28d3=_0x2e28d3-0x0;var _0x5e10a4=_0xff35[_0x2e28d3];return _0x5e10a4;};'use strict';var Sequelize=require(_0x5ff3('0x0'));module['exports']={'name':{'type':Sequelize[_0x5ff3('0x1')]},'description':{'type':Sequelize[_0x5ff3('0x1')]},'username':{'type':Sequelize[_0x5ff3('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x5ff3('0x1')]},'password':{'type':Sequelize[_0x5ff3('0x1')]},'clientId':{'type':Sequelize[_0x5ff3('0x1')]},'clientSecret':{'type':Sequelize[_0x5ff3('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5ff3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5ff3('0x2')](_0x5ff3('0x3'),_0x5ff3('0x4')),'defaultValue':_0x5ff3('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 47a7de0..cb50a89 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 _0xa571=['zip-dir','request-promise','moment','util','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','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','attributes','fields','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','SalesforceAccount','count','include','findAll','rows','show','params','keys','intersection','find','create','body','getConfigurations','findOne','SalesforceConfiguration','length','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','Connection','login','concat','isNil','OwnerId','ActivityDate','IsRecurrence','Subject','Description','int','picklist','email','textarea','phone','remove','includes','label','custom','picklistValues','value','boolean','True','true','False','false','statusCode','test','html-pdf','eml-format','rimraf'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xa571,0x107));var _0x1a57=function(_0x170703,_0x5d11c4){_0x170703=_0x170703-0x0;var _0x47b361=_0xa571[_0x170703];return _0x47b361;};'use strict';var pdf=require(_0x1a57('0x0'));var emlformat=require(_0x1a57('0x1'));var rimraf=require(_0x1a57('0x2'));var zipdir=require(_0x1a57('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a57('0x4'));var moment=require(_0x1a57('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a57('0x6'));var path=require('path');var sox=require(_0x1a57('0x7'));var csv=require(_0x1a57('0x8'));var ejs=require(_0x1a57('0x9'));var fs=require('fs');var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x8'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];var integrations=require(_0x1a57('0x18'));var jayson=require(_0x1a57('0x19'));var client=jayson['client'][_0x1a57('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x18eec5,_0x4c5ed4,_0x503278,_0x587422){return new BPromise(function(_0xd08107,_0x17434c){var _0x27e824=_0x587422||client;return _0x27e824[_0x1a57('0x1b')](_0x18eec5,_0x503278)['then'](function(_0x20f7ad){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x4c5ed4,_0x1a57('0x1c'));logger[_0x1a57('0x1d')](_0x1a57('0x1e'),_0x4c5ed4,'request\x20sent',JSON[_0x1a57('0x1f')](_0x20f7ad));if(_0x20f7ad[_0x1a57('0x20')]){if(_0x20f7ad[_0x1a57('0x20')]['code']===0x1f4){logger[_0x1a57('0x20')](_0x1a57('0x21'),_0x4c5ed4,_0x20f7ad[_0x1a57('0x20')][_0x1a57('0x22')]);return _0x17434c(_0x20f7ad[_0x1a57('0x20')]['message']);}logger['error'](_0x1a57('0x21'),_0x4c5ed4,_0x20f7ad[_0x1a57('0x20')][_0x1a57('0x22')]);return _0xd08107(_0x20f7ad['error']['message']);}else{logger['info'](_0x1a57('0x21'),_0x4c5ed4,_0x1a57('0x1c'));_0xd08107(_0x20f7ad[_0x1a57('0x23')][_0x1a57('0x22')]);}})[_0x1a57('0x24')](function(_0x39d3ce){logger[_0x1a57('0x20')](_0x1a57('0x21'),_0x4c5ed4,_0x39d3ce);_0x17434c(_0x39d3ce);});});}function respondWithStatusCode(_0x183ca3,_0x35d5dc){_0x35d5dc=_0x35d5dc||0xcc;return function(_0x29e7cd){if(_0x29e7cd){return _0x183ca3[_0x1a57('0x25')](_0x35d5dc);}return _0x183ca3[_0x1a57('0x26')](_0x35d5dc)[_0x1a57('0x27')]();};}function respondWithResult(_0x2f9454,_0x182649){_0x182649=_0x182649||0xc8;return function(_0x25c1e9){if(_0x25c1e9){return _0x2f9454[_0x1a57('0x26')](_0x182649)[_0x1a57('0x28')](_0x25c1e9);}};}function respondWithFilteredResult(_0xf6ffef,_0x26584b){return function(_0x1dd939){if(_0x1dd939){var _0x5a53c8=_0x1dd939['count'],_0x530401=_0x26584b[_0x1a57('0x29')],_0x139d8c=_0x26584b['offset']+_0x26584b[_0x1a57('0x2a')],_0x22549f;if(_0x139d8c>=_0x5a53c8){_0x139d8c=_0x5a53c8;_0x22549f=0xc8;}else{_0x22549f=0xce;}_0xf6ffef[_0x1a57('0x26')](_0x22549f);return _0xf6ffef['set'](_0x1a57('0x2b'),_0x530401+'-'+_0x139d8c+'/'+_0x5a53c8)[_0x1a57('0x28')](_0x1dd939);}return null;};}function patchUpdates(_0x30527c){return function(_0xe49543){try{jsonpatch['apply'](_0xe49543,_0x30527c,!![]);}catch(_0x366d5f){return BPromise[_0x1a57('0x2c')](_0x366d5f);}return _0xe49543[_0x1a57('0x2d')]();};}function saveUpdates(_0x160536,_0x5763ba){return function(_0xa42d2b){if(_0xa42d2b){return _0xa42d2b[_0x1a57('0x2e')](_0x160536)[_0x1a57('0x2f')](function(_0x32f79f){return _0x32f79f;});}return null;};}function removeEntity(_0x3ac6ff,_0x335c14){return function(_0x35df7d){if(_0x35df7d){return _0x35df7d[_0x1a57('0x30')]()[_0x1a57('0x2f')](function(){_0x3ac6ff['status'](0xcc)[_0x1a57('0x27')]();});}};}function handleEntityNotFound(_0x1e27b4,_0x497488){return function(_0x4f9368){if(!_0x4f9368){_0x1e27b4[_0x1a57('0x25')](0x194);}return _0x4f9368;};}function handleError(_0x136842,_0x159c74){_0x159c74=_0x159c74||0x1f4;return function(_0x170bf7){logger[_0x1a57('0x20')](_0x170bf7[_0x1a57('0x31')]);if(_0x170bf7[_0x1a57('0x32')]){delete _0x170bf7[_0x1a57('0x32')];}_0x136842[_0x1a57('0x26')](_0x159c74)[_0x1a57('0x33')](_0x170bf7);};}exports[_0x1a57('0x34')]=function(_0x24025c,_0x12f3a7){var _0x1a6231={},_0x106a2c={},_0x12102f={'count':0x0,'rows':[]};var _0x90b82e=_[_0x1a57('0x35')](db['SalesforceAccount'][_0x1a57('0x36')],function(_0x173671){return{'name':_0x173671[_0x1a57('0x37')],'type':_0x173671[_0x1a57('0x38')][_0x1a57('0x39')]};});_0x106a2c[_0x1a57('0x3a')]=_[_0x1a57('0x35')](_0x90b82e,_0x1a57('0x32'));_0x106a2c[_0x1a57('0x3b')]=_['keys'](_0x24025c['query']);_0x106a2c['filters']=_['intersection'](_0x106a2c[_0x1a57('0x3a')],_0x106a2c[_0x1a57('0x3b')]);_0x1a6231[_0x1a57('0x3c')]=_['intersection'](_0x106a2c[_0x1a57('0x3a')],qs[_0x1a57('0x3d')](_0x24025c[_0x1a57('0x3b')][_0x1a57('0x3d')]));_0x1a6231['attributes']=_0x1a6231[_0x1a57('0x3c')]['length']?_0x1a6231[_0x1a57('0x3c')]:_0x106a2c[_0x1a57('0x3a')];if(!_0x24025c[_0x1a57('0x3b')]['hasOwnProperty'](_0x1a57('0x3e'))){_0x1a6231[_0x1a57('0x2a')]=qs[_0x1a57('0x2a')](_0x24025c[_0x1a57('0x3b')][_0x1a57('0x2a')]);_0x1a6231['offset']=qs[_0x1a57('0x29')](_0x24025c['query']['offset']);}_0x1a6231[_0x1a57('0x3f')]=qs['sort'](_0x24025c[_0x1a57('0x3b')][_0x1a57('0x40')]);_0x1a6231[_0x1a57('0x41')]=qs['filters'](_[_0x1a57('0x42')](_0x24025c[_0x1a57('0x3b')],_0x106a2c[_0x1a57('0x43')]),_0x90b82e);if(_0x24025c[_0x1a57('0x3b')]['filter']){_0x1a6231[_0x1a57('0x41')]=_[_0x1a57('0x44')](_0x1a6231['where'],{'$or':_[_0x1a57('0x35')](_0x90b82e,function(_0x4c0759){if(_0x4c0759['type']!==_0x1a57('0x45')){var _0x30a7a5={};_0x30a7a5[_0x4c0759[_0x1a57('0x32')]]={'$like':'%'+_0x24025c[_0x1a57('0x3b')]['filter']+'%'};return _0x30a7a5;}})});}_0x1a6231=_[_0x1a57('0x44')]({},_0x1a6231,_0x24025c[_0x1a57('0x46')]);var _0x20517c={'where':_0x1a6231[_0x1a57('0x41')]};return db[_0x1a57('0x47')]['count'](_0x20517c)[_0x1a57('0x2f')](function(_0x1175ca){_0x12102f[_0x1a57('0x48')]=_0x1175ca;if(_0x24025c[_0x1a57('0x3b')]['includeAll']){_0x1a6231[_0x1a57('0x49')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x1a57('0x4a')](_0x1a6231);})[_0x1a57('0x2f')](function(_0x167b40){_0x12102f[_0x1a57('0x4b')]=_0x167b40;return _0x12102f;})[_0x1a57('0x2f')](respondWithFilteredResult(_0x12f3a7,_0x1a6231))[_0x1a57('0x24')](handleError(_0x12f3a7,null));};exports[_0x1a57('0x4c')]=function(_0x401285,_0x29fe1f){var _0x424065={'raw':![],'where':{'id':_0x401285[_0x1a57('0x4d')]['id']}},_0x7413df={};_0x7413df[_0x1a57('0x3a')]=_['keys'](db[_0x1a57('0x47')][_0x1a57('0x36')]);_0x7413df[_0x1a57('0x3b')]=_[_0x1a57('0x4e')](_0x401285[_0x1a57('0x3b')]);_0x7413df[_0x1a57('0x43')]=_[_0x1a57('0x4f')](_0x7413df[_0x1a57('0x3a')],_0x7413df[_0x1a57('0x3b')]);_0x424065[_0x1a57('0x3c')]=_[_0x1a57('0x4f')](_0x7413df['model'],qs[_0x1a57('0x3d')](_0x401285[_0x1a57('0x3b')]['fields']));_0x424065[_0x1a57('0x3c')]=_0x424065[_0x1a57('0x3c')]['length']?_0x424065[_0x1a57('0x3c')]:_0x7413df[_0x1a57('0x3a')];if(_0x401285['query']['includeAll']){_0x424065['include']=[{'all':!![]}];}_0x424065=_[_0x1a57('0x44')]({},_0x424065,_0x401285[_0x1a57('0x46')]);return db['SalesforceAccount'][_0x1a57('0x50')](_0x424065)[_0x1a57('0x2f')](handleEntityNotFound(_0x29fe1f,null))['then'](respondWithResult(_0x29fe1f,null))['catch'](handleError(_0x29fe1f,null));};exports['create']=function(_0x3cb9ce,_0x23d1c3){return db[_0x1a57('0x47')][_0x1a57('0x51')](_0x3cb9ce[_0x1a57('0x52')],{})[_0x1a57('0x2f')](respondWithResult(_0x23d1c3,0xc9))[_0x1a57('0x24')](handleError(_0x23d1c3,null));};exports[_0x1a57('0x2e')]=function(_0x516aff,_0x5473cb){if(_0x516aff['body']['id']){delete _0x516aff['body']['id'];}return db['SalesforceAccount'][_0x1a57('0x50')]({'where':{'id':_0x516aff[_0x1a57('0x4d')]['id']}})[_0x1a57('0x2f')](handleEntityNotFound(_0x5473cb,null))[_0x1a57('0x2f')](saveUpdates(_0x516aff[_0x1a57('0x52')],null))[_0x1a57('0x2f')](respondWithResult(_0x5473cb,null))[_0x1a57('0x24')](handleError(_0x5473cb,null));};exports[_0x1a57('0x30')]=function(_0x4b20ed,_0x48cc13){return db['SalesforceAccount'][_0x1a57('0x50')]({'where':{'id':_0x4b20ed['params']['id']}})[_0x1a57('0x2f')](handleEntityNotFound(_0x48cc13,null))[_0x1a57('0x2f')](removeEntity(_0x48cc13,null))[_0x1a57('0x24')](handleError(_0x48cc13,null));};exports[_0x1a57('0x53')]=function(_0x4521cc,_0x369c57,_0x5a80be){var _0x561add={};var _0x4e56b5={};var _0x4d5b1d;var _0xc936a7;return db[_0x1a57('0x47')][_0x1a57('0x54')]({'where':{'id':_0x4521cc[_0x1a57('0x4d')]['id']}})[_0x1a57('0x2f')](handleEntityNotFound(_0x369c57,null))[_0x1a57('0x2f')](function(_0x2ca029){if(_0x2ca029){_0x4d5b1d=_0x2ca029;_0x4e56b5['model']=_['keys'](db[_0x1a57('0x55')][_0x1a57('0x36')]);_0x4e56b5[_0x1a57('0x3b')]=_[_0x1a57('0x4e')](_0x4521cc[_0x1a57('0x3b')]);_0x4e56b5[_0x1a57('0x43')]=_['intersection'](_0x4e56b5['model'],_0x4e56b5[_0x1a57('0x3b')]);_0x561add[_0x1a57('0x3c')]=_['intersection'](_0x4e56b5['model'],qs[_0x1a57('0x3d')](_0x4521cc[_0x1a57('0x3b')][_0x1a57('0x3d')]));_0x561add[_0x1a57('0x3c')]=_0x561add[_0x1a57('0x3c')][_0x1a57('0x56')]?_0x561add[_0x1a57('0x3c')]:_0x4e56b5['model'];_0x561add['order']=qs[_0x1a57('0x40')](_0x4521cc[_0x1a57('0x3b')][_0x1a57('0x40')]);_0x561add[_0x1a57('0x41')]=qs['filters'](_[_0x1a57('0x42')](_0x4521cc[_0x1a57('0x3b')],_0x4e56b5[_0x1a57('0x43')]));if(_0x4521cc[_0x1a57('0x3b')][_0x1a57('0x57')]){_0x561add['where']=_['merge'](_0x561add['where'],{'$or':_[_0x1a57('0x35')](_0x561add[_0x1a57('0x3c')],function(_0x1e2df1){var _0x33ffe5={};_0x33ffe5[_0x1e2df1]={'$like':'%'+_0x4521cc[_0x1a57('0x3b')][_0x1a57('0x57')]+'%'};return _0x33ffe5;})});}_0x561add=_[_0x1a57('0x44')]({},_0x561add,_0x4521cc[_0x1a57('0x46')]);return _0x4d5b1d['getConfigurations'](_0x561add);}})[_0x1a57('0x2f')](function(_0x39399b){if(_0x39399b){_0xc936a7=_0x39399b['length'];if(!_0x4521cc['query'][_0x1a57('0x58')]('nolimit')){_0x561add[_0x1a57('0x2a')]=qs[_0x1a57('0x2a')](_0x4521cc[_0x1a57('0x3b')][_0x1a57('0x2a')]);_0x561add[_0x1a57('0x29')]=qs[_0x1a57('0x29')](_0x4521cc[_0x1a57('0x3b')][_0x1a57('0x29')]);}return _0x4d5b1d['getConfigurations'](_0x561add);}})[_0x1a57('0x2f')](function(_0xc33b56){if(_0xc33b56){return _0xc33b56?{'count':_0xc936a7,'rows':_0xc33b56}:null;}})['then'](respondWithResult(_0x369c57,null))[_0x1a57('0x24')](handleError(_0x369c57,null));};exports[_0x1a57('0x59')]=function(_0x20b0d5,_0x570674,_0x5c3eb8){if(_0x20b0d5[_0x1a57('0x52')]['id']){delete _0x20b0d5[_0x1a57('0x52')]['id'];}return db[_0x1a57('0x47')][_0x1a57('0x54')]({'where':{'id':_0x20b0d5['params']['id']}})[_0x1a57('0x2f')](handleEntityNotFound(_0x570674,null))[_0x1a57('0x2f')](function(_0x12d4cc){if(_0x12d4cc){_0x20b0d5[_0x1a57('0x52')][_0x1a57('0x5a')]=_0x12d4cc['id'];_0x20b0d5['body'][_0x1a57('0x5b')]=integrations[_0x1a57('0x5c')](_0x20b0d5[_0x1a57('0x52')][_0x1a57('0x5d')],_0x20b0d5[_0x1a57('0x52')][_0x1a57('0x38')]);_0x20b0d5[_0x1a57('0x52')][_0x1a57('0x5e')]=integrations[_0x1a57('0x5f')](_0x20b0d5[_0x1a57('0x52')][_0x1a57('0x5d')],_0x20b0d5['body'][_0x1a57('0x38')]);return db[_0x1a57('0x55')]['create'](_0x20b0d5[_0x1a57('0x52')],{'include':[{'model':db[_0x1a57('0x60')],'as':'Subjects'},{'model':db[_0x1a57('0x60')],'as':_0x1a57('0x5e')}]});}return null;})[_0x1a57('0x2f')](respondWithResult(_0x570674,null))[_0x1a57('0x24')](handleError(_0x570674,null));};exports[_0x1a57('0x61')]=function(_0x1cb859,_0x8cb993,_0x1484ab){var _0x559a71;var _0x190631='';var _0x598a8d='Task';return db[_0x1a57('0x47')][_0x1a57('0x54')]({'where':{'id':_0x1cb859[_0x1a57('0x4d')]['id']},'attributes':['id',_0x1a57('0x62'),_0x1a57('0x63'),_0x1a57('0x64'),_0x1a57('0x65'),_0x1a57('0x66'),_0x1a57('0x67')]})['then'](handleEntityNotFound(_0x8cb993,null))[_0x1a57('0x2f')](function(_0x14072a){if(_0x14072a){_0x190631=_0x14072a[_0x1a57('0x62')];var _0x1e4d4e=_0x190631[_0x1a57('0x68')](-0x1);if(_0x1e4d4e==='/'){_0x190631=_0x190631['substring'](0x0,_0x190631[_0x1a57('0x69')](_0x1e4d4e));}_0x559a71=new jsforce[(_0x1a57('0x6a'))]({'oauth2':{'loginUrl':_0x190631,'clientId':_0x14072a[_0x1a57('0x63')],'clientSecret':_0x14072a[_0x1a57('0x64')]}});return _0x559a71[_0x1a57('0x6b')](_0x14072a[_0x1a57('0x65')],_0x14072a[_0x1a57('0x66')][_0x1a57('0x6c')](_0x14072a['securityToken']));}})[_0x1a57('0x2f')](function(_0x854914){if(_0x854914){if(!_[_0x1a57('0x6d')](_0x1cb859[_0x1a57('0x3b')]['ticketType'])){_0x598a8d=_0x1cb859['query']['ticketType'];}return _0x559a71['sobject'](_0x598a8d)['describe']();}})[_0x1a57('0x2f')](function(_0x1d04cc){var _0x5e640b=[_0x1a57('0x6e'),_0x1a57('0x6f'),'IsReminderSet',_0x1a57('0x70'),_0x1a57('0x71'),_0x1a57('0x72')];var _0x9ceb94=['string',_0x1a57('0x73'),_0x1a57('0x74'),'boolean',_0x1a57('0x75'),_0x1a57('0x76'),_0x1a57('0x77')];if(_0x1d04cc){_[_0x1a57('0x78')](_0x1d04cc[_0x1a57('0x3d')],function(_0x15d424){return _0x5e640b[_0x1a57('0x79')](_0x15d424['name'])||!_0x9ceb94[_0x1a57('0x79')](_0x15d424['type']);});return{'count':_0x1d04cc[_0x1a57('0x3d')][_0x1a57('0x56')],'rows':_[_0x1a57('0x35')](_0x1d04cc[_0x1a57('0x3d')],function(_0x537b30){return{'id':_0x537b30[_0x1a57('0x32')],'name':_0x537b30[_0x1a57('0x7a')],'custom':_0x537b30[_0x1a57('0x7b')],'options':_0x537b30['picklistValues'][_0x1a57('0x56')]>0x0?_[_0x1a57('0x35')](_0x537b30[_0x1a57('0x7c')],function(_0x50f1a0){return{'name':_0x50f1a0[_0x1a57('0x7a')],'value':_0x50f1a0[_0x1a57('0x7d')]};}):_0x537b30[_0x1a57('0x38')]==_0x1a57('0x7e')?[{'name':_0x1a57('0x7f'),'value':_0x1a57('0x80')},{'name':_0x1a57('0x81'),'value':_0x1a57('0x82')}]:[]};})};}})[_0x1a57('0x2f')](respondWithResult(_0x8cb993,null))[_0x1a57('0x24')](function(_0x29d8f6){var _0x5de7b1=_0x1cb859[_0x1a57('0x3b')]['test']?0x1f4:_0x29d8f6[_0x1a57('0x83')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5de7b1,JSON['stringify'](_0x29d8f6));delete _0x29d8f6[_0x1a57('0x32')];if(_0x5de7b1===0x191){_0x5de7b1=0x190;}_0x8cb993[_0x1a57('0x26')](_0x5de7b1)[_0x1a57('0x33')](_0x1cb859['query'][_0x1a57('0x84')]?{'message':'Wrong\x20credentials','statusCode':_0x29d8f6[_0x1a57('0x83')]}:_0x29d8f6);});}; \ No newline at end of file +var _0xa575=['result','catch','sendStatus','status','json','offset','limit','apply','reject','save','update','then','destroy','end','name','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','fields','includeAll','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','Subjects','channel','type','Descriptions','getDescriptions','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','concat','ticketType','sobject','describe','IsReminderSet','IsRecurrence','Subject','string','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','SalesforceAccount,\x20%s,\x20%s','message'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0xa575,0x1e2));var _0x5a57=function(_0x209eca,_0x26a6a7){_0x209eca=_0x209eca-0x0;var _0x5c2622=_0xa575[_0x209eca];return _0x5c2622;};'use strict';var pdf=require(_0x5a57('0x0'));var emlformat=require(_0x5a57('0x1'));var rimraf=require(_0x5a57('0x2'));var zipdir=require(_0x5a57('0x3'));var jsonpatch=require(_0x5a57('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5a57('0x5'));var Mustache=require(_0x5a57('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5a57('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5a57('0x8'));var squel=require(_0x5a57('0x9'));var crypto=require(_0x5a57('0xa'));var jsforce=require(_0x5a57('0xb'));var deskjs=require(_0x5a57('0xc'));var toCsv=require(_0x5a57('0x7'));var querystring=require(_0x5a57('0xd'));var Papa=require(_0x5a57('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5a57('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a57('0x10'))(_0x5a57('0x11'));var utils=require(_0x5a57('0x12'));var config=require(_0x5a57('0x13'));var licenseUtil=require(_0x5a57('0x14'));var db=require(_0x5a57('0x15'))['db'];var integrations=require(_0x5a57('0x16'));var jayson=require(_0x5a57('0x17'));var client=jayson[_0x5a57('0x18')][_0x5a57('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x758c1c,_0x4e058d,_0x399d00,_0x136b51){return new BPromise(function(_0x5ab6b1,_0x24cc71){var _0x1da685=_0x136b51||client;return _0x1da685[_0x5a57('0x1a')](_0x758c1c,_0x399d00)['then'](function(_0x14a833){logger[_0x5a57('0x1b')]('SalesforceAccount,\x20%s,\x20%s',_0x4e058d,_0x5a57('0x1c'));logger[_0x5a57('0x1d')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4e058d,_0x5a57('0x1c'),JSON['stringify'](_0x14a833));if(_0x14a833['error']){if(_0x14a833[_0x5a57('0x1e')][_0x5a57('0x1f')]===0x1f4){logger[_0x5a57('0x1e')](_0x5a57('0x20'),_0x4e058d,_0x14a833[_0x5a57('0x1e')][_0x5a57('0x21')]);return _0x24cc71(_0x14a833[_0x5a57('0x1e')][_0x5a57('0x21')]);}logger[_0x5a57('0x1e')](_0x5a57('0x20'),_0x4e058d,_0x14a833[_0x5a57('0x1e')][_0x5a57('0x21')]);return _0x5ab6b1(_0x14a833[_0x5a57('0x1e')]['message']);}else{logger[_0x5a57('0x1b')](_0x5a57('0x20'),_0x4e058d,_0x5a57('0x1c'));_0x5ab6b1(_0x14a833[_0x5a57('0x22')][_0x5a57('0x21')]);}})[_0x5a57('0x23')](function(_0xacf4bb){logger[_0x5a57('0x1e')]('SalesforceAccount,\x20%s,\x20%s',_0x4e058d,_0xacf4bb);_0x24cc71(_0xacf4bb);});});}function respondWithStatusCode(_0x2ef0b3,_0x319e55){_0x319e55=_0x319e55||0xcc;return function(_0x1a8dbf){if(_0x1a8dbf){return _0x2ef0b3[_0x5a57('0x24')](_0x319e55);}return _0x2ef0b3[_0x5a57('0x25')](_0x319e55)['end']();};}function respondWithResult(_0x5e5f5e,_0x44abb2){_0x44abb2=_0x44abb2||0xc8;return function(_0x5e542f){if(_0x5e542f){return _0x5e5f5e[_0x5a57('0x25')](_0x44abb2)[_0x5a57('0x26')](_0x5e542f);}};}function respondWithFilteredResult(_0x391a42,_0x60736e){return function(_0x279cb5){if(_0x279cb5){var _0x14e2f5=_0x279cb5['count'],_0x526126=_0x60736e['offset'],_0x5c2d8f=_0x60736e[_0x5a57('0x27')]+_0x60736e[_0x5a57('0x28')],_0x467cc9;if(_0x5c2d8f>=_0x14e2f5){_0x5c2d8f=_0x14e2f5;_0x467cc9=0xc8;}else{_0x467cc9=0xce;}_0x391a42[_0x5a57('0x25')](_0x467cc9);return _0x391a42['set']('Content-Range',_0x526126+'-'+_0x5c2d8f+'/'+_0x14e2f5)[_0x5a57('0x26')](_0x279cb5);}return null;};}function patchUpdates(_0x1256e3){return function(_0x557f88){try{jsonpatch[_0x5a57('0x29')](_0x557f88,_0x1256e3,!![]);}catch(_0xf8c23e){return BPromise[_0x5a57('0x2a')](_0xf8c23e);}return _0x557f88[_0x5a57('0x2b')]();};}function saveUpdates(_0x16331b,_0x49f784){return function(_0x223c6a){if(_0x223c6a){return _0x223c6a[_0x5a57('0x2c')](_0x16331b)[_0x5a57('0x2d')](function(_0x1cc37a){return _0x1cc37a;});}return null;};}function removeEntity(_0xc8f973,_0xda4ec3){return function(_0x20f749){if(_0x20f749){return _0x20f749[_0x5a57('0x2e')]()['then'](function(){_0xc8f973['status'](0xcc)[_0x5a57('0x2f')]();});}};}function handleEntityNotFound(_0x58a0dc,_0x152c94){return function(_0x40927f){if(!_0x40927f){_0x58a0dc[_0x5a57('0x24')](0x194);}return _0x40927f;};}function handleError(_0x230b20,_0x3fc0a2){_0x3fc0a2=_0x3fc0a2||0x1f4;return function(_0x5e9267){logger[_0x5a57('0x1e')](_0x5e9267['stack']);if(_0x5e9267['name']){delete _0x5e9267[_0x5a57('0x30')];}_0x230b20[_0x5a57('0x25')](_0x3fc0a2)['send'](_0x5e9267);};}exports[_0x5a57('0x31')]=function(_0x55fcba,_0x2566d9){var _0x42978c={},_0x4a4dc4={},_0x29e012={'count':0x0,'rows':[]};var _0x55a1f8=_[_0x5a57('0x32')](db[_0x5a57('0x33')][_0x5a57('0x34')],function(_0x1d1dcc){return{'name':_0x1d1dcc[_0x5a57('0x35')],'type':_0x1d1dcc['type'][_0x5a57('0x36')]};});_0x4a4dc4[_0x5a57('0x37')]=_['map'](_0x55a1f8,'name');_0x4a4dc4[_0x5a57('0x38')]=_[_0x5a57('0x39')](_0x55fcba[_0x5a57('0x38')]);_0x4a4dc4[_0x5a57('0x3a')]=_[_0x5a57('0x3b')](_0x4a4dc4[_0x5a57('0x37')],_0x4a4dc4['query']);_0x42978c[_0x5a57('0x3c')]=_['intersection'](_0x4a4dc4[_0x5a57('0x37')],qs['fields'](_0x55fcba[_0x5a57('0x38')]['fields']));_0x42978c[_0x5a57('0x3c')]=_0x42978c['attributes'][_0x5a57('0x3d')]?_0x42978c['attributes']:_0x4a4dc4['model'];if(!_0x55fcba['query'][_0x5a57('0x3e')](_0x5a57('0x3f'))){_0x42978c[_0x5a57('0x28')]=qs[_0x5a57('0x28')](_0x55fcba[_0x5a57('0x38')][_0x5a57('0x28')]);_0x42978c[_0x5a57('0x27')]=qs['offset'](_0x55fcba['query'][_0x5a57('0x27')]);}_0x42978c[_0x5a57('0x40')]=qs[_0x5a57('0x41')](_0x55fcba['query'][_0x5a57('0x41')]);_0x42978c[_0x5a57('0x42')]=qs[_0x5a57('0x3a')](_[_0x5a57('0x43')](_0x55fcba[_0x5a57('0x38')],_0x4a4dc4[_0x5a57('0x3a')]),_0x55a1f8);if(_0x55fcba[_0x5a57('0x38')][_0x5a57('0x44')]){_0x42978c[_0x5a57('0x42')]=_[_0x5a57('0x45')](_0x42978c[_0x5a57('0x42')],{'$or':_[_0x5a57('0x32')](_0x55a1f8,function(_0x170ef3){if(_0x170ef3['type']!==_0x5a57('0x46')){var _0x4c56eb={};_0x4c56eb[_0x170ef3['name']]={'$like':'%'+_0x55fcba[_0x5a57('0x38')]['filter']+'%'};return _0x4c56eb;}})});}_0x42978c=_[_0x5a57('0x45')]({},_0x42978c,_0x55fcba[_0x5a57('0x47')]);var _0x46ad77={'where':_0x42978c[_0x5a57('0x42')]};return db[_0x5a57('0x33')][_0x5a57('0x48')](_0x46ad77)[_0x5a57('0x2d')](function(_0x43a2b4){_0x29e012['count']=_0x43a2b4;if(_0x55fcba[_0x5a57('0x38')]['includeAll']){_0x42978c[_0x5a57('0x49')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x5a57('0x4a')](_0x42978c);})[_0x5a57('0x2d')](function(_0x3d538e){_0x29e012[_0x5a57('0x4b')]=_0x3d538e;return _0x29e012;})['then'](respondWithFilteredResult(_0x2566d9,_0x42978c))['catch'](handleError(_0x2566d9,null));};exports[_0x5a57('0x4c')]=function(_0x2f8684,_0x1c0f2e){var _0x3ebb3f={'raw':![],'where':{'id':_0x2f8684[_0x5a57('0x4d')]['id']}},_0x84986={};_0x84986['model']=_[_0x5a57('0x39')](db['SalesforceAccount']['rawAttributes']);_0x84986['query']=_[_0x5a57('0x39')](_0x2f8684['query']);_0x84986['filters']=_[_0x5a57('0x3b')](_0x84986[_0x5a57('0x37')],_0x84986[_0x5a57('0x38')]);_0x3ebb3f[_0x5a57('0x3c')]=_[_0x5a57('0x3b')](_0x84986['model'],qs[_0x5a57('0x4e')](_0x2f8684[_0x5a57('0x38')]['fields']));_0x3ebb3f[_0x5a57('0x3c')]=_0x3ebb3f[_0x5a57('0x3c')][_0x5a57('0x3d')]?_0x3ebb3f[_0x5a57('0x3c')]:_0x84986[_0x5a57('0x37')];if(_0x2f8684[_0x5a57('0x38')][_0x5a57('0x4f')]){_0x3ebb3f[_0x5a57('0x49')]=[{'all':!![]}];}_0x3ebb3f=_[_0x5a57('0x45')]({},_0x3ebb3f,_0x2f8684[_0x5a57('0x47')]);return db[_0x5a57('0x33')][_0x5a57('0x50')](_0x3ebb3f)['then'](handleEntityNotFound(_0x1c0f2e,null))[_0x5a57('0x2d')](respondWithResult(_0x1c0f2e,null))[_0x5a57('0x23')](handleError(_0x1c0f2e,null));};exports[_0x5a57('0x51')]=function(_0x3d834c,_0x2143d4){return db[_0x5a57('0x33')][_0x5a57('0x51')](_0x3d834c[_0x5a57('0x52')],{})['then'](respondWithResult(_0x2143d4,0xc9))[_0x5a57('0x23')](handleError(_0x2143d4,null));};exports[_0x5a57('0x2c')]=function(_0x4ce078,_0x27bec2){if(_0x4ce078[_0x5a57('0x52')]['id']){delete _0x4ce078[_0x5a57('0x52')]['id'];}return db[_0x5a57('0x33')][_0x5a57('0x50')]({'where':{'id':_0x4ce078[_0x5a57('0x4d')]['id']}})['then'](handleEntityNotFound(_0x27bec2,null))[_0x5a57('0x2d')](saveUpdates(_0x4ce078['body'],null))['then'](respondWithResult(_0x27bec2,null))[_0x5a57('0x23')](handleError(_0x27bec2,null));};exports[_0x5a57('0x2e')]=function(_0x83b8d1,_0x3063c7){return db[_0x5a57('0x33')][_0x5a57('0x50')]({'where':{'id':_0x83b8d1[_0x5a57('0x4d')]['id']}})[_0x5a57('0x2d')](handleEntityNotFound(_0x3063c7,null))[_0x5a57('0x2d')](removeEntity(_0x3063c7,null))[_0x5a57('0x23')](handleError(_0x3063c7,null));};exports[_0x5a57('0x53')]=function(_0x1a40cd,_0x199510,_0x2541e7){var _0x498f3c={};var _0x3ed716={};var _0x52b50f;var _0x15bb07;return db['SalesforceAccount'][_0x5a57('0x54')]({'where':{'id':_0x1a40cd[_0x5a57('0x4d')]['id']}})['then'](handleEntityNotFound(_0x199510,null))[_0x5a57('0x2d')](function(_0xf13a6d){if(_0xf13a6d){_0x52b50f=_0xf13a6d;_0x3ed716['model']=_[_0x5a57('0x39')](db[_0x5a57('0x55')][_0x5a57('0x34')]);_0x3ed716[_0x5a57('0x38')]=_[_0x5a57('0x39')](_0x1a40cd['query']);_0x3ed716[_0x5a57('0x3a')]=_[_0x5a57('0x3b')](_0x3ed716['model'],_0x3ed716['query']);_0x498f3c[_0x5a57('0x3c')]=_[_0x5a57('0x3b')](_0x3ed716[_0x5a57('0x37')],qs[_0x5a57('0x4e')](_0x1a40cd['query'][_0x5a57('0x4e')]));_0x498f3c['attributes']=_0x498f3c[_0x5a57('0x3c')]['length']?_0x498f3c['attributes']:_0x3ed716[_0x5a57('0x37')];_0x498f3c[_0x5a57('0x40')]=qs[_0x5a57('0x41')](_0x1a40cd['query']['sort']);_0x498f3c[_0x5a57('0x42')]=qs[_0x5a57('0x3a')](_[_0x5a57('0x43')](_0x1a40cd['query'],_0x3ed716['filters']));if(_0x1a40cd[_0x5a57('0x38')][_0x5a57('0x44')]){_0x498f3c[_0x5a57('0x42')]=_[_0x5a57('0x45')](_0x498f3c[_0x5a57('0x42')],{'$or':_[_0x5a57('0x32')](_0x498f3c[_0x5a57('0x3c')],function(_0x3fb8c4){var _0x2a6132={};_0x2a6132[_0x3fb8c4]={'$like':'%'+_0x1a40cd['query'][_0x5a57('0x44')]+'%'};return _0x2a6132;})});}_0x498f3c=_[_0x5a57('0x45')]({},_0x498f3c,_0x1a40cd[_0x5a57('0x47')]);return _0x52b50f[_0x5a57('0x53')](_0x498f3c);}})['then'](function(_0x488bc2){if(_0x488bc2){_0x15bb07=_0x488bc2[_0x5a57('0x3d')];if(!_0x1a40cd[_0x5a57('0x38')]['hasOwnProperty'](_0x5a57('0x3f'))){_0x498f3c[_0x5a57('0x28')]=qs[_0x5a57('0x28')](_0x1a40cd[_0x5a57('0x38')][_0x5a57('0x28')]);_0x498f3c[_0x5a57('0x27')]=qs[_0x5a57('0x27')](_0x1a40cd['query']['offset']);}return _0x52b50f[_0x5a57('0x53')](_0x498f3c);}})[_0x5a57('0x2d')](function(_0x310b86){if(_0x310b86){return _0x310b86?{'count':_0x15bb07,'rows':_0x310b86}:null;}})[_0x5a57('0x2d')](respondWithResult(_0x199510,null))['catch'](handleError(_0x199510,null));};exports[_0x5a57('0x56')]=function(_0x406025,_0x2739ae,_0x55fb90){if(_0x406025[_0x5a57('0x52')]['id']){delete _0x406025[_0x5a57('0x52')]['id'];}return db[_0x5a57('0x33')][_0x5a57('0x54')]({'where':{'id':_0x406025[_0x5a57('0x4d')]['id']}})[_0x5a57('0x2d')](handleEntityNotFound(_0x2739ae,null))[_0x5a57('0x2d')](function(_0x30e71c){if(_0x30e71c){_0x406025['body']['AccountId']=_0x30e71c['id'];_0x406025['body'][_0x5a57('0x57')]=integrations['getSubjects'](_0x406025[_0x5a57('0x52')][_0x5a57('0x58')],_0x406025[_0x5a57('0x52')][_0x5a57('0x59')]);_0x406025['body'][_0x5a57('0x5a')]=integrations[_0x5a57('0x5b')](_0x406025[_0x5a57('0x52')]['channel'],_0x406025[_0x5a57('0x52')][_0x5a57('0x59')]);return db[_0x5a57('0x55')][_0x5a57('0x51')](_0x406025[_0x5a57('0x52')],{'include':[{'model':db['SalesforceField'],'as':_0x5a57('0x57')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2739ae,null))[_0x5a57('0x23')](handleError(_0x2739ae,null));};exports[_0x5a57('0x5c')]=function(_0x256940,_0x31d1fc,_0x14c39a){var _0x3252d2;var _0xc7be36='';var _0x2ccce9=_0x5a57('0x5d');return db['SalesforceAccount'][_0x5a57('0x54')]({'where':{'id':_0x256940[_0x5a57('0x4d')]['id']},'attributes':['id',_0x5a57('0x5e'),_0x5a57('0x5f'),_0x5a57('0x60'),'username',_0x5a57('0x61'),_0x5a57('0x62')]})[_0x5a57('0x2d')](handleEntityNotFound(_0x31d1fc,null))['then'](function(_0x4edb79){if(_0x4edb79){_0xc7be36=_0x4edb79[_0x5a57('0x5e')];var _0x32309e=_0xc7be36[_0x5a57('0x63')](-0x1);if(_0x32309e==='/'){_0xc7be36=_0xc7be36[_0x5a57('0x64')](0x0,_0xc7be36[_0x5a57('0x65')](_0x32309e));}_0x3252d2=new jsforce['Connection']({'oauth2':{'loginUrl':_0xc7be36,'clientId':_0x4edb79['clientId'],'clientSecret':_0x4edb79[_0x5a57('0x60')]}});return _0x3252d2['login'](_0x4edb79['username'],_0x4edb79[_0x5a57('0x61')][_0x5a57('0x66')](_0x4edb79['securityToken']));}})[_0x5a57('0x2d')](function(_0x5e8273){if(_0x5e8273){if(!_['isNil'](_0x256940[_0x5a57('0x38')][_0x5a57('0x67')])){_0x2ccce9=_0x256940[_0x5a57('0x38')][_0x5a57('0x67')];}return _0x3252d2[_0x5a57('0x68')](_0x2ccce9)[_0x5a57('0x69')]();}})[_0x5a57('0x2d')](function(_0x1fb970){var _0x264e65=['OwnerId','ActivityDate',_0x5a57('0x6a'),_0x5a57('0x6b'),_0x5a57('0x6c'),'Description'];var _0x2beb5f=[_0x5a57('0x6d'),'int',_0x5a57('0x6e'),_0x5a57('0x6f'),_0x5a57('0x70'),_0x5a57('0x71'),_0x5a57('0x72')];if(_0x1fb970){_[_0x5a57('0x73')](_0x1fb970['fields'],function(_0x5d40c6){return _0x264e65[_0x5a57('0x74')](_0x5d40c6['name'])||!_0x2beb5f[_0x5a57('0x74')](_0x5d40c6[_0x5a57('0x59')]);});return{'count':_0x1fb970[_0x5a57('0x4e')]['length'],'rows':_['map'](_0x1fb970['fields'],function(_0xe617cd){return{'id':_0xe617cd[_0x5a57('0x30')],'name':_0xe617cd[_0x5a57('0x75')],'custom':_0xe617cd[_0x5a57('0x76')],'options':_0xe617cd['picklistValues'][_0x5a57('0x3d')]>0x0?_[_0x5a57('0x32')](_0xe617cd[_0x5a57('0x77')],function(_0x20caf1){return{'name':_0x20caf1[_0x5a57('0x75')],'value':_0x20caf1[_0x5a57('0x78')]};}):_0xe617cd[_0x5a57('0x59')]==_0x5a57('0x6f')?[{'name':_0x5a57('0x79'),'value':'true'},{'name':_0x5a57('0x7a'),'value':_0x5a57('0x7b')}]:[]};})};}})[_0x5a57('0x2d')](respondWithResult(_0x31d1fc,null))[_0x5a57('0x23')](function(_0x222f6a){var _0x58132b=_0x256940[_0x5a57('0x38')][_0x5a57('0x7c')]?0x1f4:_0x222f6a[_0x5a57('0x7d')]||0x1f4;logger[_0x5a57('0x1e')](_0x5a57('0x7e'),_0x5a57('0x5c'),_0x58132b,JSON['stringify'](_0x222f6a));delete _0x222f6a[_0x5a57('0x30')];if(_0x58132b===0x191){_0x58132b=0x190;}_0x31d1fc[_0x5a57('0x25')](_0x58132b)[_0x5a57('0x7f')](_0x256940[_0x5a57('0x38')][_0x5a57('0x7c')]?{'message':_0x5a57('0x80'),'statusCode':_0x222f6a[_0x5a57('0x7d')]}:_0x222f6a);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 3b46d34..6c3ca3e 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 _0x3d2b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x3d2b,0x9c));var _0xb3d2=function(_0x5bccf0,_0x21aca8){_0x5bccf0=_0x5bccf0-0x0;var _0xa327cd=_0x3d2b[_0x5bccf0];return _0xa327cd;};'use strict';var _=require(_0xb3d2('0x0'));var util=require(_0xb3d2('0x1'));var logger=require(_0xb3d2('0x2'))(_0xb3d2('0x3'));var moment=require(_0xb3d2('0x4'));var BPromise=require(_0xb3d2('0x5'));var rp=require(_0xb3d2('0x6'));var fs=require('fs');var path=require(_0xb3d2('0x7'));var rimraf=require('rimraf');var config=require(_0xb3d2('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xb3d2('0x9'));module[_0xb3d2('0xa')]=function(_0x56c3e6,_0x59abf0){return _0x56c3e6['define'](_0xb3d2('0xb'),attributes,{'tableName':_0xb3d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3137=['int_salesforce_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0x3cc527,_0x1d2dc9){var _0x20f384=function(_0x5b5129){while(--_0x5b5129){_0x3cc527['push'](_0x3cc527['shift']());}};_0x20f384(++_0x1d2dc9);}(_0x3137,0x9d));var _0x7313=function(_0x1271cb,_0x4db4c7){_0x1271cb=_0x1271cb-0x0;var _0x1fb44f=_0x3137[_0x1271cb];return _0x1fb44f;};'use strict';var _=require(_0x7313('0x0'));var util=require(_0x7313('0x1'));var logger=require(_0x7313('0x2'))(_0x7313('0x3'));var moment=require(_0x7313('0x4'));var BPromise=require('bluebird');var rp=require(_0x7313('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7313('0x6'));var config=require('../../config/environment');var attributes=require(_0x7313('0x7'));var integrations=require(_0x7313('0x8'));module[_0x7313('0x9')]=function(_0x4d516a,_0x4a9885){return _0x4d516a[_0x7313('0xa')](_0x7313('0xb'),attributes,{'tableName':_0x7313('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 59efd3d..9eecda6 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 _0xa75b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','SalesforceAccount','findAll','options','raw','where','limit','map','include','model','attributes','catch','GetSalesforceAccount','find','then','ShowSalesforceAccount','lodash','bluebird'];(function(_0x1e3627,_0x42b4a6){var _0x3812c4=function(_0x5399cb){while(--_0x5399cb){_0x1e3627['push'](_0x1e3627['shift']());}};_0x3812c4(++_0x42b4a6);}(_0xa75b,0x170));var _0xba75=function(_0x379be1,_0x2b1a6b){_0x379be1=_0x379be1-0x0;var _0xf29257=_0xa75b[_0x379be1];return _0xf29257;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});}exports['GetSalesforceAccount']=function(_0x2822af){var _0xd8850f=this;return new Promise(function(_0xc4bf17,_0x132750){return db[_0xba75('0x16')][_0xba75('0x17')]({'raw':_0x2822af['options']?_0x2822af[_0xba75('0x18')][_0xba75('0x19')]===undefined?!![]:![]:!![],'where':_0x2822af['options']?_0x2822af['options'][_0xba75('0x1a')]||null:null,'attributes':_0x2822af[_0xba75('0x18')]?_0x2822af['options']['attributes']||null:null,'limit':_0x2822af[_0xba75('0x18')]?_0x2822af['options'][_0xba75('0x1b')]||null:null,'include':_0x2822af[_0xba75('0x18')]?_0x2822af[_0xba75('0x18')]['include']?_[_0xba75('0x1c')](_0x2822af[_0xba75('0x18')][_0xba75('0x1d')],function(_0x3e9bd9){return{'model':db[_0x3e9bd9[_0xba75('0x1e')]],'as':_0x3e9bd9['as'],'attributes':_0x3e9bd9[_0xba75('0x1f')],'include':_0x3e9bd9['include']?_[_0xba75('0x1c')](_0x3e9bd9[_0xba75('0x1d')],function(_0xe579fb){return{'model':db[_0xe579fb[_0xba75('0x1e')]],'as':_0xe579fb['as'],'attributes':_0xe579fb[_0xba75('0x1f')],'include':_0xe579fb[_0xba75('0x1d')]?_[_0xba75('0x1c')](_0xe579fb[_0xba75('0x1d')],function(_0x35c571){return{'model':db[_0x35c571[_0xba75('0x1e')]],'as':_0x35c571['as'],'attributes':_0x35c571['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e1987){logger[_0xba75('0x14')]('GetSalesforceAccount',_0x2822af);logger[_0xba75('0xe')]('GetSalesforceAccount',_0x2822af,JSON[_0xba75('0x10')](_0x4e1987));_0xc4bf17(_0x4e1987);})[_0xba75('0x20')](function(_0x20ac78){logger['error'](_0xba75('0x21'),_0x20ac78[_0xba75('0x13')],_0x2822af);_0x132750(_0xd8850f[_0xba75('0x11')](0x1f4,_0x20ac78[_0xba75('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x4791a5){var _0x200715=this;return new Promise(function(_0x481a04,_0x5a85ee){return db[_0xba75('0x16')][_0xba75('0x22')]({'raw':_0x4791a5[_0xba75('0x18')]?_0x4791a5['options'][_0xba75('0x19')]===undefined?!![]:![]:!![],'where':_0x4791a5[_0xba75('0x18')]?_0x4791a5['options'][_0xba75('0x1a')]||null:null,'attributes':_0x4791a5[_0xba75('0x18')]?_0x4791a5[_0xba75('0x18')][_0xba75('0x1f')]||null:null,'include':_0x4791a5['options']?_0x4791a5[_0xba75('0x18')][_0xba75('0x1d')]?_['map'](_0x4791a5[_0xba75('0x18')][_0xba75('0x1d')],function(_0x5a88a3){return{'model':db[_0x5a88a3['model']],'as':_0x5a88a3['as'],'attributes':_0x5a88a3[_0xba75('0x1f')],'include':_0x5a88a3[_0xba75('0x1d')]?_[_0xba75('0x1c')](_0x5a88a3[_0xba75('0x1d')],function(_0x5e3c8c){return{'model':db[_0x5e3c8c[_0xba75('0x1e')]],'as':_0x5e3c8c['as'],'attributes':_0x5e3c8c[_0xba75('0x1f')],'include':_0x5e3c8c['include']?_['map'](_0x5e3c8c[_0xba75('0x1d')],function(_0x39ab01){return{'model':db[_0x39ab01[_0xba75('0x1e')]],'as':_0x39ab01['as'],'attributes':_0x39ab01['attributes']};}):[]};}):[]};}):[]:[]})[_0xba75('0x23')](function(_0x2c1e9e){logger['info']('ShowSalesforceAccount',_0x4791a5);logger[_0xba75('0xe')](_0xba75('0x24'),_0x4791a5,JSON[_0xba75('0x10')](_0x2c1e9e));_0x481a04(_0x2c1e9e);})[_0xba75('0x20')](function(_0x92882d){logger['error']('ShowSalesforceAccount',_0x92882d[_0xba75('0x13')],_0x4791a5);_0x5a85ee(_0x200715[_0xba75('0x11')](0x1f4,_0x92882d[_0xba75('0x13')]));});});}; \ No newline at end of file +var _0x6737=['options','raw','where','attributes','include','map','model','catch','ShowSalesforceAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetSalesforceAccount','SalesforceAccount'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6737,0xe2));var _0x7673=function(_0x2090cb,_0x38c762){_0x2090cb=_0x2090cb-0x0;var _0x1a6e54=_0x6737[_0x2090cb];return _0x1a6e54;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var moment=require(_0x7673('0x1'));var BPromise=require('bluebird');var rs=require(_0x7673('0x2'));var fs=require('fs');var Redis=require(_0x7673('0x3'));var db=require(_0x7673('0x4'))['db'];var utils=require(_0x7673('0x5'));var logger=require('../../config/logger')(_0x7673('0x6'));var config=require(_0x7673('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7673('0x8')][_0x7673('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af802,_0x4e4b24,_0x53d67d){return new BPromise(function(_0x5292f7,_0x285c6d){return client['request'](_0x5af802,_0x53d67d)[_0x7673('0xa')](function(_0x1fb769){logger['info'](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));logger[_0x7673('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4e4b24,'request\x20sent',JSON[_0x7673('0xe')](_0x1fb769));if(_0x1fb769['error']){if(_0x1fb769[_0x7673('0xf')][_0x7673('0x10')]===0x1f4){logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);return _0x285c6d(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769['error'][_0x7673('0x11')]);return _0x5292f7(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}else{logger[_0x7673('0x12')](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));_0x5292f7(_0x1fb769[_0x7673('0x13')]['message']);}})['catch'](function(_0x164d05){logger[_0x7673('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x4e4b24,_0x164d05);_0x285c6d(_0x164d05);});});}exports[_0x7673('0x14')]=function(_0x17699a){var _0x58a821=this;return new Promise(function(_0x33ff7d,_0x44704d){return db[_0x7673('0x15')]['findAll']({'raw':_0x17699a['options']?_0x17699a[_0x7673('0x16')][_0x7673('0x17')]===undefined?!![]:![]:!![],'where':_0x17699a['options']?_0x17699a[_0x7673('0x16')][_0x7673('0x18')]||null:null,'attributes':_0x17699a[_0x7673('0x16')]?_0x17699a[_0x7673('0x16')][_0x7673('0x19')]||null:null,'limit':_0x17699a[_0x7673('0x16')]?_0x17699a['options']['limit']||null:null,'include':_0x17699a[_0x7673('0x16')]?_0x17699a[_0x7673('0x16')][_0x7673('0x1a')]?_[_0x7673('0x1b')](_0x17699a[_0x7673('0x16')]['include'],function(_0x2009e1){return{'model':db[_0x2009e1[_0x7673('0x1c')]],'as':_0x2009e1['as'],'attributes':_0x2009e1[_0x7673('0x19')],'include':_0x2009e1[_0x7673('0x1a')]?_[_0x7673('0x1b')](_0x2009e1[_0x7673('0x1a')],function(_0x538280){return{'model':db[_0x538280[_0x7673('0x1c')]],'as':_0x538280['as'],'attributes':_0x538280[_0x7673('0x19')],'include':_0x538280[_0x7673('0x1a')]?_[_0x7673('0x1b')](_0x538280['include'],function(_0x5e2cd7){return{'model':db[_0x5e2cd7[_0x7673('0x1c')]],'as':_0x5e2cd7['as'],'attributes':_0x5e2cd7[_0x7673('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7673('0xa')](function(_0x9d9eab){logger[_0x7673('0x12')](_0x7673('0x14'),_0x17699a);logger[_0x7673('0xd')]('GetSalesforceAccount',_0x17699a,JSON['stringify'](_0x9d9eab));_0x33ff7d(_0x9d9eab);})[_0x7673('0x1d')](function(_0x2d4c0a){logger[_0x7673('0xf')](_0x7673('0x14'),_0x2d4c0a[_0x7673('0x11')],_0x17699a);_0x44704d(_0x58a821[_0x7673('0xf')](0x1f4,_0x2d4c0a[_0x7673('0x11')]));});});};exports['ShowSalesforceAccount']=function(_0x4fcacc){var _0xe7e528=this;return new Promise(function(_0x36c841,_0x268863){return db[_0x7673('0x15')]['find']({'raw':_0x4fcacc[_0x7673('0x16')]?_0x4fcacc['options'][_0x7673('0x17')]===undefined?!![]:![]:!![],'where':_0x4fcacc[_0x7673('0x16')]?_0x4fcacc[_0x7673('0x16')][_0x7673('0x18')]||null:null,'attributes':_0x4fcacc[_0x7673('0x16')]?_0x4fcacc[_0x7673('0x16')][_0x7673('0x19')]||null:null,'include':_0x4fcacc[_0x7673('0x16')]?_0x4fcacc[_0x7673('0x16')][_0x7673('0x1a')]?_[_0x7673('0x1b')](_0x4fcacc[_0x7673('0x16')][_0x7673('0x1a')],function(_0x485b39){return{'model':db[_0x485b39[_0x7673('0x1c')]],'as':_0x485b39['as'],'attributes':_0x485b39[_0x7673('0x19')],'include':_0x485b39[_0x7673('0x1a')]?_[_0x7673('0x1b')](_0x485b39[_0x7673('0x1a')],function(_0x7b2313){return{'model':db[_0x7b2313[_0x7673('0x1c')]],'as':_0x7b2313['as'],'attributes':_0x7b2313['attributes'],'include':_0x7b2313['include']?_[_0x7673('0x1b')](_0x7b2313[_0x7673('0x1a')],function(_0x2d34cb){return{'model':db[_0x2d34cb[_0x7673('0x1c')]],'as':_0x2d34cb['as'],'attributes':_0x2d34cb[_0x7673('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7673('0xa')](function(_0x159afd){logger['info'](_0x7673('0x1e'),_0x4fcacc);logger[_0x7673('0xd')]('ShowSalesforceAccount',_0x4fcacc,JSON[_0x7673('0xe')](_0x159afd));_0x36c841(_0x159afd);})[_0x7673('0x1d')](function(_0x287eee){logger[_0x7673('0xf')]('ShowSalesforceAccount',_0x287eee[_0x7673('0x11')],_0x4fcacc);_0x268863(_0xe7e528[_0x7673('0xf')](0x1f4,_0x287eee['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index a796447..141f34c 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 _0xb97e=['delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','/:id','update'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0xb97e,0x18e));var _0xeb97=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xb97e[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0xeb97('0x0'));var util=require('util');var path=require(_0xeb97('0x1'));var timeout=require(_0xeb97('0x2'));var express=require('express');var router=express[_0xeb97('0x3')]();var auth=require(_0xeb97('0x4'));var interaction=require(_0xeb97('0x5'));var config=require(_0xeb97('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0xeb97('0x7')]('/',auth[_0xeb97('0x8')](),controller[_0xeb97('0x9')]);router[_0xeb97('0x7')]('/:id',auth[_0xeb97('0x8')](),controller[_0xeb97('0xa')]);router[_0xeb97('0x7')](_0xeb97('0xb'),auth['isAuthenticated'](),controller[_0xeb97('0xc')]);router[_0xeb97('0x7')](_0xeb97('0xd'),auth[_0xeb97('0x8')](),controller[_0xeb97('0xe')]);router[_0xeb97('0x7')](_0xeb97('0xf'),auth['isAuthenticated'](),controller[_0xeb97('0x10')]);router['post']('/',auth[_0xeb97('0x8')](),controller[_0xeb97('0x11')]);router['put'](_0xeb97('0x12'),auth[_0xeb97('0x8')](),controller[_0xeb97('0x13')]);router[_0xeb97('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xeb97('0x15')]=router; \ No newline at end of file +var _0x5d1e=['index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./intSalesforceConfiguration.controller','get','isAuthenticated'];(function(_0x395ab3,_0x5e1439){var _0x3dd827=function(_0x39172b){while(--_0x39172b){_0x395ab3['push'](_0x395ab3['shift']());}};_0x3dd827(++_0x5e1439);}(_0x5d1e,0x16d));var _0xe5d1=function(_0x461c1e,_0x5cc67e){_0x461c1e=_0x461c1e-0x0;var _0x59b56e=_0x5d1e[_0x461c1e];return _0x59b56e;};'use strict';var multer=require(_0xe5d1('0x0'));var util=require(_0xe5d1('0x1'));var path=require(_0xe5d1('0x2'));var timeout=require(_0xe5d1('0x3'));var express=require('express');var router=express[_0xe5d1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe5d1('0x5'));var config=require('../../config/environment');var controller=require(_0xe5d1('0x6'));router[_0xe5d1('0x7')]('/',auth[_0xe5d1('0x8')](),controller[_0xe5d1('0x9')]);router[_0xe5d1('0x7')](_0xe5d1('0xa'),auth[_0xe5d1('0x8')](),controller[_0xe5d1('0xb')]);router[_0xe5d1('0x7')](_0xe5d1('0xc'),auth['isAuthenticated'](),controller[_0xe5d1('0xd')]);router[_0xe5d1('0x7')]('/:id/subjects',auth[_0xe5d1('0x8')](),controller[_0xe5d1('0xe')]);router[_0xe5d1('0x7')](_0xe5d1('0xf'),auth[_0xe5d1('0x8')](),controller[_0xe5d1('0x10')]);router['post']('/',auth[_0xe5d1('0x8')](),controller[_0xe5d1('0x11')]);router[_0xe5d1('0x12')]('/:id',auth[_0xe5d1('0x8')](),controller['update']);router[_0xe5d1('0x13')](_0xe5d1('0xa'),auth['isAuthenticated'](),controller[_0xe5d1('0x14')]);module[_0xe5d1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 8417719..bbbaa4c 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 _0x373d=['contact_lead','nothing','sequelize','exports','ENUM','Task','contact','lead'];(function(_0x1e0c53,_0x1a0e4f){var _0x41942f=function(_0x5afe6e){while(--_0x5afe6e){_0x1e0c53['push'](_0x1e0c53['shift']());}};_0x41942f(++_0x1a0e4f);}(_0x373d,0x8a));var _0xd373=function(_0x4f0054,_0x6dc732){_0x4f0054=_0x4f0054-0x0;var _0x507888=_0x373d[_0x4f0054];return _0x507888;};'use strict';var Sequelize=require(_0xd373('0x0'));module[_0xd373('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xd373('0x2')](_0xd373('0x3'),'Case'),'defaultValue':_0xd373('0x3')},'moduleSearch':{'type':Sequelize[_0xd373('0x2')]('contact_lead',_0xd373('0x4'),_0xd373('0x5')),'defaultValue':_0xd373('0x6')},'moduleCreate':{'type':Sequelize[_0xd373('0x2')](_0xd373('0x7'),_0xd373('0x4'),'lead'),'defaultValue':_0xd373('0x5')}}; \ No newline at end of file +var _0x8bd0=['exports','STRING','ENUM','Task','Case','contact_lead','lead','nothing'];(function(_0x5b84f3,_0x4e72d9){var _0x950681=function(_0x2f36ca){while(--_0x2f36ca){_0x5b84f3['push'](_0x5b84f3['shift']());}};_0x950681(++_0x4e72d9);}(_0x8bd0,0x88));var _0x08bd=function(_0x2d81de,_0x2ed903){_0x2d81de=_0x2d81de-0x0;var _0xe91fc1=_0x8bd0[_0x2d81de];return _0xe91fc1;};'use strict';var Sequelize=require('sequelize');module[_0x08bd('0x0')]={'name':{'type':Sequelize[_0x08bd('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x08bd('0x2')](_0x08bd('0x3'),_0x08bd('0x4')),'defaultValue':_0x08bd('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x08bd('0x5'),'contact',_0x08bd('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x08bd('0x7'),'contact',_0x08bd('0x6')),'defaultValue':_0x08bd('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 787f594..800fd8d 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 _0xf667=['path','sox','ejs','lodash','crypto','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','jayson/promise','client','http','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','index','SalesforceConfiguration','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','find','create','body','findOne','SalesforceField','rawAttributes','pick','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x104ffd,_0x39df60){var _0x4e01ad=function(_0x3b97e3){while(--_0x3b97e3){_0x104ffd['push'](_0x104ffd['shift']());}};_0x4e01ad(++_0x39df60);}(_0xf667,0x1c3));var _0x7f66=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xf667[_0x381589];return _0x2a075d;};'use strict';var pdf=require(_0x7f66('0x0'));var emlformat=require(_0x7f66('0x1'));var rimraf=require(_0x7f66('0x2'));var zipdir=require(_0x7f66('0x3'));var jsonpatch=require(_0x7f66('0x4'));var rp=require(_0x7f66('0x5'));var moment=require(_0x7f66('0x6'));var BPromise=require(_0x7f66('0x7'));var Mustache=require('mustache');var util=require(_0x7f66('0x8'));var path=require(_0x7f66('0x9'));var sox=require(_0x7f66('0xa'));var csv=require('to-csv');var ejs=require(_0x7f66('0xb'));var fs=require('fs');var _=require(_0x7f66('0xc'));var squel=require('squel');var crypto=require(_0x7f66('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f66('0xe'));var toCsv=require(_0x7f66('0xf'));var querystring=require(_0x7f66('0x10'));var Papa=require(_0x7f66('0x11'));var Redis=require(_0x7f66('0x12'));var authService=require(_0x7f66('0x13'));var qs=require(_0x7f66('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f66('0x15'));var logger=require(_0x7f66('0x16'))(_0x7f66('0x17'));var utils=require(_0x7f66('0x18'));var config=require(_0x7f66('0x19'));var licenseUtil=require(_0x7f66('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7f66('0x1b'));var client=jayson[_0x7f66('0x1c')][_0x7f66('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1635f7,_0x17554a,_0x315bb1,_0x2498bf){return new BPromise(function(_0x25f227,_0x42b12b){var _0x5e1f84=_0x2498bf||client;return _0x5e1f84['request'](_0x1635f7,_0x315bb1)[_0x7f66('0x1e')](function(_0x5b2249){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x17554a,_0x7f66('0x1f'));logger[_0x7f66('0x20')](_0x7f66('0x21'),_0x17554a,_0x7f66('0x1f'),JSON[_0x7f66('0x22')](_0x5b2249));if(_0x5b2249[_0x7f66('0x23')]){if(_0x5b2249[_0x7f66('0x23')][_0x7f66('0x24')]===0x1f4){logger[_0x7f66('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x17554a,_0x5b2249[_0x7f66('0x23')][_0x7f66('0x25')]);return _0x42b12b(_0x5b2249[_0x7f66('0x23')]['message']);}logger[_0x7f66('0x23')](_0x7f66('0x26'),_0x17554a,_0x5b2249[_0x7f66('0x23')][_0x7f66('0x25')]);return _0x25f227(_0x5b2249[_0x7f66('0x23')][_0x7f66('0x25')]);}else{logger['info'](_0x7f66('0x26'),_0x17554a,_0x7f66('0x1f'));_0x25f227(_0x5b2249[_0x7f66('0x27')]['message']);}})[_0x7f66('0x28')](function(_0x4d02ab){logger['error'](_0x7f66('0x26'),_0x17554a,_0x4d02ab);_0x42b12b(_0x4d02ab);});});}function respondWithStatusCode(_0x433c54,_0x1f3c09){_0x1f3c09=_0x1f3c09||0xcc;return function(_0x5a367a){if(_0x5a367a){return _0x433c54[_0x7f66('0x29')](_0x1f3c09);}return _0x433c54[_0x7f66('0x2a')](_0x1f3c09)[_0x7f66('0x2b')]();};}function respondWithResult(_0x1b57db,_0x36dab5){_0x36dab5=_0x36dab5||0xc8;return function(_0x1e7ac3){if(_0x1e7ac3){return _0x1b57db['status'](_0x36dab5)['json'](_0x1e7ac3);}};}function respondWithFilteredResult(_0x275b93,_0x4354f9){return function(_0x585699){if(_0x585699){var _0x12af47=_0x585699[_0x7f66('0x2c')],_0x8b0fb3=_0x4354f9[_0x7f66('0x2d')],_0x5c4769=_0x4354f9[_0x7f66('0x2d')]+_0x4354f9[_0x7f66('0x2e')],_0x31f655;if(_0x5c4769>=_0x12af47){_0x5c4769=_0x12af47;_0x31f655=0xc8;}else{_0x31f655=0xce;}_0x275b93[_0x7f66('0x2a')](_0x31f655);return _0x275b93[_0x7f66('0x2f')]('Content-Range',_0x8b0fb3+'-'+_0x5c4769+'/'+_0x12af47)['json'](_0x585699);}return null;};}function patchUpdates(_0x2ad954){return function(_0x16dbab){try{jsonpatch[_0x7f66('0x30')](_0x16dbab,_0x2ad954,!![]);}catch(_0x27d258){return BPromise[_0x7f66('0x31')](_0x27d258);}return _0x16dbab[_0x7f66('0x32')]();};}function saveUpdates(_0x45696d,_0x189ab2){return function(_0x3b3ec9){if(_0x3b3ec9){return _0x3b3ec9[_0x7f66('0x33')](_0x45696d)[_0x7f66('0x1e')](function(_0x134621){return _0x134621;});}return null;};}function removeEntity(_0x2fe19b,_0x3e479c){return function(_0x25bf3f){if(_0x25bf3f){return _0x25bf3f[_0x7f66('0x34')]()['then'](function(){_0x2fe19b['status'](0xcc)[_0x7f66('0x2b')]();});}};}function handleEntityNotFound(_0x36f45c,_0x477d72){return function(_0x2a25cc){if(!_0x2a25cc){_0x36f45c[_0x7f66('0x29')](0x194);}return _0x2a25cc;};}function handleError(_0x199ca0,_0x25e3e6){_0x25e3e6=_0x25e3e6||0x1f4;return function(_0xee9c44){logger['error'](_0xee9c44[_0x7f66('0x35')]);if(_0xee9c44[_0x7f66('0x36')]){delete _0xee9c44['name'];}_0x199ca0['status'](_0x25e3e6)['send'](_0xee9c44);};}exports[_0x7f66('0x37')]=function(_0x3f53f6,_0x29a2c1){var _0x1cf169={},_0x55fa23={},_0xd23d4d={'count':0x0,'rows':[]};var _0x36e4bf=_['map'](db[_0x7f66('0x38')]['rawAttributes'],function(_0x5eb56d){return{'name':_0x5eb56d['fieldName'],'type':_0x5eb56d[_0x7f66('0x39')][_0x7f66('0x3a')]};});_0x55fa23['model']=_[_0x7f66('0x3b')](_0x36e4bf,_0x7f66('0x36'));_0x55fa23[_0x7f66('0x3c')]=_['keys'](_0x3f53f6[_0x7f66('0x3c')]);_0x55fa23[_0x7f66('0x3d')]=_[_0x7f66('0x3e')](_0x55fa23[_0x7f66('0x3f')],_0x55fa23[_0x7f66('0x3c')]);_0x1cf169[_0x7f66('0x40')]=_['intersection'](_0x55fa23[_0x7f66('0x3f')],qs[_0x7f66('0x41')](_0x3f53f6['query'][_0x7f66('0x41')]));_0x1cf169['attributes']=_0x1cf169[_0x7f66('0x40')][_0x7f66('0x42')]?_0x1cf169[_0x7f66('0x40')]:_0x55fa23[_0x7f66('0x3f')];if(!_0x3f53f6[_0x7f66('0x3c')][_0x7f66('0x43')](_0x7f66('0x44'))){_0x1cf169[_0x7f66('0x2e')]=qs[_0x7f66('0x2e')](_0x3f53f6[_0x7f66('0x3c')][_0x7f66('0x2e')]);_0x1cf169[_0x7f66('0x2d')]=qs[_0x7f66('0x2d')](_0x3f53f6[_0x7f66('0x3c')]['offset']);}_0x1cf169[_0x7f66('0x45')]=qs[_0x7f66('0x46')](_0x3f53f6[_0x7f66('0x3c')]['sort']);_0x1cf169[_0x7f66('0x47')]=qs['filters'](_['pick'](_0x3f53f6[_0x7f66('0x3c')],_0x55fa23[_0x7f66('0x3d')]),_0x36e4bf);if(_0x3f53f6[_0x7f66('0x3c')]['filter']){_0x1cf169['where']=_[_0x7f66('0x48')](_0x1cf169[_0x7f66('0x47')],{'$or':_['map'](_0x36e4bf,function(_0xc8cbb0){if(_0xc8cbb0[_0x7f66('0x39')]!==_0x7f66('0x49')){var _0x58e26b={};_0x58e26b[_0xc8cbb0['name']]={'$like':'%'+_0x3f53f6[_0x7f66('0x3c')][_0x7f66('0x4a')]+'%'};return _0x58e26b;}})});}_0x1cf169=_['merge']({},_0x1cf169,_0x3f53f6[_0x7f66('0x4b')]);var _0x3523c6={'where':_0x1cf169[_0x7f66('0x47')]};return db[_0x7f66('0x38')][_0x7f66('0x2c')](_0x3523c6)['then'](function(_0x4c2570){_0xd23d4d[_0x7f66('0x2c')]=_0x4c2570;if(_0x3f53f6[_0x7f66('0x3c')][_0x7f66('0x4c')]){_0x1cf169[_0x7f66('0x4d')]=[{'all':!![]}];}return db[_0x7f66('0x38')][_0x7f66('0x4e')](_0x1cf169);})['then'](function(_0x20e2e0){_0xd23d4d['rows']=_0x20e2e0;return _0xd23d4d;})[_0x7f66('0x1e')](respondWithFilteredResult(_0x29a2c1,_0x1cf169))[_0x7f66('0x28')](handleError(_0x29a2c1,null));};exports[_0x7f66('0x4f')]=function(_0x555ea0,_0x43cd8d){var _0x1a6439={'raw':![],'where':{'id':_0x555ea0[_0x7f66('0x50')]['id']}},_0x654cf0={};_0x654cf0[_0x7f66('0x3f')]=_[_0x7f66('0x51')](db[_0x7f66('0x38')]['rawAttributes']);_0x654cf0[_0x7f66('0x3c')]=_['keys'](_0x555ea0['query']);_0x654cf0[_0x7f66('0x3d')]=_['intersection'](_0x654cf0[_0x7f66('0x3f')],_0x654cf0[_0x7f66('0x3c')]);_0x1a6439[_0x7f66('0x40')]=_['intersection'](_0x654cf0[_0x7f66('0x3f')],qs[_0x7f66('0x41')](_0x555ea0[_0x7f66('0x3c')][_0x7f66('0x41')]));_0x1a6439['attributes']=_0x1a6439['attributes']['length']?_0x1a6439[_0x7f66('0x40')]:_0x654cf0[_0x7f66('0x3f')];if(_0x555ea0[_0x7f66('0x3c')][_0x7f66('0x4c')]){_0x1a6439[_0x7f66('0x4d')]=[{'all':!![]}];}_0x1a6439=_[_0x7f66('0x48')]({},_0x1a6439,_0x555ea0[_0x7f66('0x4b')]);return db[_0x7f66('0x38')][_0x7f66('0x52')](_0x1a6439)[_0x7f66('0x1e')](handleEntityNotFound(_0x43cd8d,null))[_0x7f66('0x1e')](respondWithResult(_0x43cd8d,null))['catch'](handleError(_0x43cd8d,null));};exports['create']=function(_0x44c50b,_0x116a4b){return db[_0x7f66('0x38')][_0x7f66('0x53')](_0x44c50b[_0x7f66('0x54')],{})[_0x7f66('0x1e')](respondWithResult(_0x116a4b,0xc9))[_0x7f66('0x28')](handleError(_0x116a4b,null));};exports['update']=function(_0xa60b6c,_0x16e366){if(_0xa60b6c['body']['id']){delete _0xa60b6c['body']['id'];}return db[_0x7f66('0x38')][_0x7f66('0x52')]({'where':{'id':_0xa60b6c[_0x7f66('0x50')]['id']}})[_0x7f66('0x1e')](handleEntityNotFound(_0x16e366,null))['then'](saveUpdates(_0xa60b6c['body'],null))['then'](respondWithResult(_0x16e366,null))[_0x7f66('0x28')](handleError(_0x16e366,null));};exports['destroy']=function(_0x4a5910,_0x3614ad){return db[_0x7f66('0x38')][_0x7f66('0x52')]({'where':{'id':_0x4a5910[_0x7f66('0x50')]['id']}})[_0x7f66('0x1e')](handleEntityNotFound(_0x3614ad,null))['then'](removeEntity(_0x3614ad,null))['catch'](handleError(_0x3614ad,null));};exports['getFields']=function(_0x39eec4,_0x205dad,_0x492851){var _0x4d981e={};var _0x19cadf={};var _0x3ce199;var _0x128c46;return db[_0x7f66('0x38')][_0x7f66('0x55')]({'where':{'id':_0x39eec4[_0x7f66('0x50')]['id']}})[_0x7f66('0x1e')](handleEntityNotFound(_0x205dad,null))[_0x7f66('0x1e')](function(_0x48d605){if(_0x48d605){_0x3ce199=_0x48d605;_0x19cadf['model']=_[_0x7f66('0x51')](db[_0x7f66('0x56')][_0x7f66('0x57')]);_0x19cadf[_0x7f66('0x3c')]=_[_0x7f66('0x51')](_0x39eec4[_0x7f66('0x3c')]);_0x19cadf[_0x7f66('0x3d')]=_[_0x7f66('0x3e')](_0x19cadf['model'],_0x19cadf[_0x7f66('0x3c')]);_0x4d981e[_0x7f66('0x40')]=_['intersection'](_0x19cadf[_0x7f66('0x3f')],qs[_0x7f66('0x41')](_0x39eec4['query'][_0x7f66('0x41')]));_0x4d981e[_0x7f66('0x40')]=_0x4d981e[_0x7f66('0x40')][_0x7f66('0x42')]?_0x4d981e[_0x7f66('0x40')]:_0x19cadf[_0x7f66('0x3f')];_0x4d981e[_0x7f66('0x45')]=qs[_0x7f66('0x46')](_0x39eec4[_0x7f66('0x3c')][_0x7f66('0x46')]);_0x4d981e['where']=qs[_0x7f66('0x3d')](_[_0x7f66('0x58')](_0x39eec4[_0x7f66('0x3c')],_0x19cadf[_0x7f66('0x3d')]));if(_0x39eec4['query'][_0x7f66('0x4a')]){_0x4d981e[_0x7f66('0x47')]=_[_0x7f66('0x48')](_0x4d981e[_0x7f66('0x47')],{'$or':_[_0x7f66('0x3b')](_0x4d981e[_0x7f66('0x40')],function(_0x159cc8){var _0x3647cd={};_0x3647cd[_0x159cc8]={'$like':'%'+_0x39eec4[_0x7f66('0x3c')][_0x7f66('0x4a')]+'%'};return _0x3647cd;})});}_0x4d981e=_[_0x7f66('0x48')]({},_0x4d981e,_0x39eec4[_0x7f66('0x4b')]);return _0x3ce199[_0x7f66('0x59')](_0x4d981e);}})[_0x7f66('0x1e')](function(_0x2aba9c){if(_0x2aba9c){_0x128c46=_0x2aba9c[_0x7f66('0x42')];if(!_0x39eec4[_0x7f66('0x3c')][_0x7f66('0x43')]('nolimit')){_0x4d981e[_0x7f66('0x2e')]=qs['limit'](_0x39eec4[_0x7f66('0x3c')][_0x7f66('0x2e')]);_0x4d981e[_0x7f66('0x2d')]=qs['offset'](_0x39eec4['query'][_0x7f66('0x2d')]);}return _0x3ce199[_0x7f66('0x59')](_0x4d981e);}})[_0x7f66('0x1e')](function(_0x53b2b9){if(_0x53b2b9){return _0x53b2b9?{'count':_0x128c46,'rows':_0x53b2b9}:null;}})[_0x7f66('0x1e')](respondWithResult(_0x205dad,null))[_0x7f66('0x28')](handleError(_0x205dad,null));};exports[_0x7f66('0x5a')]=function(_0x49e1e7,_0xcb7502,_0x251d39){var _0x46c870={};var _0x4067b9={};var _0x4b68a3;var _0x5024ec;return db[_0x7f66('0x38')]['findOne']({'where':{'id':_0x49e1e7[_0x7f66('0x50')]['id']}})[_0x7f66('0x1e')](handleEntityNotFound(_0xcb7502,null))[_0x7f66('0x1e')](function(_0x1b2ebc){if(_0x1b2ebc){_0x4b68a3=_0x1b2ebc;_0x4067b9[_0x7f66('0x3f')]=_[_0x7f66('0x51')](db[_0x7f66('0x56')][_0x7f66('0x57')]);_0x4067b9['query']=_[_0x7f66('0x51')](_0x49e1e7[_0x7f66('0x3c')]);_0x4067b9['filters']=_[_0x7f66('0x3e')](_0x4067b9[_0x7f66('0x3f')],_0x4067b9[_0x7f66('0x3c')]);_0x46c870[_0x7f66('0x40')]=_['intersection'](_0x4067b9[_0x7f66('0x3f')],qs[_0x7f66('0x41')](_0x49e1e7[_0x7f66('0x3c')][_0x7f66('0x41')]));_0x46c870[_0x7f66('0x40')]=_0x46c870[_0x7f66('0x40')][_0x7f66('0x42')]?_0x46c870[_0x7f66('0x40')]:_0x4067b9[_0x7f66('0x3f')];_0x46c870[_0x7f66('0x45')]=qs[_0x7f66('0x46')](_0x49e1e7[_0x7f66('0x3c')][_0x7f66('0x46')]);_0x46c870[_0x7f66('0x47')]=qs[_0x7f66('0x3d')](_[_0x7f66('0x58')](_0x49e1e7[_0x7f66('0x3c')],_0x4067b9[_0x7f66('0x3d')]));if(_0x49e1e7[_0x7f66('0x3c')][_0x7f66('0x4a')]){_0x46c870['where']=_['merge'](_0x46c870['where'],{'$or':_[_0x7f66('0x3b')](_0x46c870['attributes'],function(_0x500686){var _0x1dbc8a={};_0x1dbc8a[_0x500686]={'$like':'%'+_0x49e1e7[_0x7f66('0x3c')][_0x7f66('0x4a')]+'%'};return _0x1dbc8a;})});}_0x46c870=_[_0x7f66('0x48')]({},_0x46c870,_0x49e1e7['options']);return _0x4b68a3[_0x7f66('0x5a')](_0x46c870);}})[_0x7f66('0x1e')](function(_0x50a951){if(_0x50a951){_0x5024ec=_0x50a951[_0x7f66('0x42')];if(!_0x49e1e7[_0x7f66('0x3c')][_0x7f66('0x43')](_0x7f66('0x44'))){_0x46c870[_0x7f66('0x2e')]=qs[_0x7f66('0x2e')](_0x49e1e7[_0x7f66('0x3c')][_0x7f66('0x2e')]);_0x46c870[_0x7f66('0x2d')]=qs[_0x7f66('0x2d')](_0x49e1e7[_0x7f66('0x3c')]['offset']);}return _0x4b68a3[_0x7f66('0x5a')](_0x46c870);}})[_0x7f66('0x1e')](function(_0x5c0ba0){if(_0x5c0ba0){return _0x5c0ba0?{'count':_0x5024ec,'rows':_0x5c0ba0}:null;}})[_0x7f66('0x1e')](respondWithResult(_0xcb7502,null))[_0x7f66('0x28')](handleError(_0xcb7502,null));};exports['getDescriptions']=function(_0x3a21da,_0x25eda6,_0x3f6eb6){var _0x879dc8={};var _0x435f6c={};var _0x3ddfbf;var _0x56a600;return db[_0x7f66('0x38')][_0x7f66('0x55')]({'where':{'id':_0x3a21da[_0x7f66('0x50')]['id']}})[_0x7f66('0x1e')](handleEntityNotFound(_0x25eda6,null))['then'](function(_0x3864e9){if(_0x3864e9){_0x3ddfbf=_0x3864e9;_0x435f6c[_0x7f66('0x3f')]=_[_0x7f66('0x51')](db['SalesforceField']['rawAttributes']);_0x435f6c[_0x7f66('0x3c')]=_[_0x7f66('0x51')](_0x3a21da[_0x7f66('0x3c')]);_0x435f6c[_0x7f66('0x3d')]=_[_0x7f66('0x3e')](_0x435f6c[_0x7f66('0x3f')],_0x435f6c[_0x7f66('0x3c')]);_0x879dc8[_0x7f66('0x40')]=_[_0x7f66('0x3e')](_0x435f6c[_0x7f66('0x3f')],qs[_0x7f66('0x41')](_0x3a21da[_0x7f66('0x3c')][_0x7f66('0x41')]));_0x879dc8[_0x7f66('0x40')]=_0x879dc8[_0x7f66('0x40')][_0x7f66('0x42')]?_0x879dc8[_0x7f66('0x40')]:_0x435f6c[_0x7f66('0x3f')];_0x879dc8[_0x7f66('0x45')]=qs['sort'](_0x3a21da[_0x7f66('0x3c')][_0x7f66('0x46')]);_0x879dc8[_0x7f66('0x47')]=qs[_0x7f66('0x3d')](_[_0x7f66('0x58')](_0x3a21da[_0x7f66('0x3c')],_0x435f6c[_0x7f66('0x3d')]));if(_0x3a21da[_0x7f66('0x3c')]['filter']){_0x879dc8[_0x7f66('0x47')]=_[_0x7f66('0x48')](_0x879dc8['where'],{'$or':_['map'](_0x879dc8[_0x7f66('0x40')],function(_0x4d81c3){var _0x334c6a={};_0x334c6a[_0x4d81c3]={'$like':'%'+_0x3a21da['query'][_0x7f66('0x4a')]+'%'};return _0x334c6a;})});}_0x879dc8=_['merge']({},_0x879dc8,_0x3a21da['options']);return _0x3ddfbf[_0x7f66('0x5b')](_0x879dc8);}})[_0x7f66('0x1e')](function(_0x300ccc){if(_0x300ccc){_0x56a600=_0x300ccc['length'];if(!_0x3a21da['query'][_0x7f66('0x43')](_0x7f66('0x44'))){_0x879dc8[_0x7f66('0x2e')]=qs[_0x7f66('0x2e')](_0x3a21da[_0x7f66('0x3c')][_0x7f66('0x2e')]);_0x879dc8[_0x7f66('0x2d')]=qs['offset'](_0x3a21da[_0x7f66('0x3c')][_0x7f66('0x2d')]);}return _0x3ddfbf['getDescriptions'](_0x879dc8);}})[_0x7f66('0x1e')](function(_0x384620){if(_0x384620){return _0x384620?{'count':_0x56a600,'rows':_0x384620}:null;}})[_0x7f66('0x1e')](respondWithResult(_0x25eda6,null))['catch'](handleError(_0x25eda6,null));}; \ No newline at end of file +var _0x9936=['save','destroy','sendStatus','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','getFields','pick','filter','getSubjects','SalesforceField','findOne','getDescriptions','html-pdf','eml-format','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x5e29e6,_0x19f937){var _0x42e866=function(_0xfd86f9){while(--_0xfd86f9){_0x5e29e6['push'](_0x5e29e6['shift']());}};_0x42e866(++_0x19f937);}(_0x9936,0x13c));var _0x6993=function(_0x25aaec,_0x159e5b){_0x25aaec=_0x25aaec-0x0;var _0x293c2f=_0x9936[_0x25aaec];return _0x293c2f;};'use strict';var pdf=require(_0x6993('0x0'));var emlformat=require(_0x6993('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6993('0x2'));var moment=require(_0x6993('0x3'));var BPromise=require(_0x6993('0x4'));var Mustache=require('mustache');var util=require(_0x6993('0x5'));var path=require(_0x6993('0x6'));var sox=require(_0x6993('0x7'));var csv=require(_0x6993('0x8'));var ejs=require(_0x6993('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6993('0xa'));var crypto=require('crypto');var jsforce=require(_0x6993('0xb'));var deskjs=require(_0x6993('0xc'));var toCsv=require(_0x6993('0x8'));var querystring=require(_0x6993('0xd'));var Papa=require(_0x6993('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6993('0xf'));var as=require(_0x6993('0x10'));var hardwareService=require(_0x6993('0x11'));var logger=require(_0x6993('0x12'))(_0x6993('0x13'));var utils=require(_0x6993('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6993('0x15'));var db=require(_0x6993('0x16'))['db'];var jayson=require(_0x6993('0x17'));var client=jayson['client'][_0x6993('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2d5224,_0x2104de,_0x3ffede,_0x2b94fd){return new BPromise(function(_0x1b5e2d,_0xbb0f55){var _0x2787e9=_0x2b94fd||client;return _0x2787e9['request'](_0x2d5224,_0x3ffede)[_0x6993('0x19')](function(_0x4ed0c5){logger[_0x6993('0x1a')](_0x6993('0x1b'),_0x2104de,_0x6993('0x1c'));logger[_0x6993('0x1d')](_0x6993('0x1e'),_0x2104de,_0x6993('0x1c'),JSON[_0x6993('0x1f')](_0x4ed0c5));if(_0x4ed0c5[_0x6993('0x20')]){if(_0x4ed0c5[_0x6993('0x20')]['code']===0x1f4){logger[_0x6993('0x20')](_0x6993('0x1b'),_0x2104de,_0x4ed0c5[_0x6993('0x20')][_0x6993('0x21')]);return _0xbb0f55(_0x4ed0c5[_0x6993('0x20')][_0x6993('0x21')]);}logger[_0x6993('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2104de,_0x4ed0c5['error'][_0x6993('0x21')]);return _0x1b5e2d(_0x4ed0c5[_0x6993('0x20')][_0x6993('0x21')]);}else{logger['info'](_0x6993('0x1b'),_0x2104de,_0x6993('0x1c'));_0x1b5e2d(_0x4ed0c5['result'][_0x6993('0x21')]);}})['catch'](function(_0x476827){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2104de,_0x476827);_0xbb0f55(_0x476827);});});}function respondWithStatusCode(_0x868019,_0xed5ab6){_0xed5ab6=_0xed5ab6||0xcc;return function(_0x57a83c){if(_0x57a83c){return _0x868019['sendStatus'](_0xed5ab6);}return _0x868019[_0x6993('0x22')](_0xed5ab6)[_0x6993('0x23')]();};}function respondWithResult(_0x140b93,_0x5e299f){_0x5e299f=_0x5e299f||0xc8;return function(_0xf06b59){if(_0xf06b59){return _0x140b93[_0x6993('0x22')](_0x5e299f)[_0x6993('0x24')](_0xf06b59);}};}function respondWithFilteredResult(_0x153f20,_0x3bd24e){return function(_0x21decf){if(_0x21decf){var _0x3c0497=_0x21decf[_0x6993('0x25')],_0x325e53=_0x3bd24e[_0x6993('0x26')],_0x3cdfad=_0x3bd24e['offset']+_0x3bd24e[_0x6993('0x27')],_0x4f2a06;if(_0x3cdfad>=_0x3c0497){_0x3cdfad=_0x3c0497;_0x4f2a06=0xc8;}else{_0x4f2a06=0xce;}_0x153f20[_0x6993('0x22')](_0x4f2a06);return _0x153f20[_0x6993('0x28')](_0x6993('0x29'),_0x325e53+'-'+_0x3cdfad+'/'+_0x3c0497)[_0x6993('0x24')](_0x21decf);}return null;};}function patchUpdates(_0xfa4273){return function(_0x3e71a1){try{jsonpatch[_0x6993('0x2a')](_0x3e71a1,_0xfa4273,!![]);}catch(_0x34228b){return BPromise[_0x6993('0x2b')](_0x34228b);}return _0x3e71a1[_0x6993('0x2c')]();};}function saveUpdates(_0x4c89c8,_0x56cbb9){return function(_0x52ef23){if(_0x52ef23){return _0x52ef23['update'](_0x4c89c8)[_0x6993('0x19')](function(_0x548c83){return _0x548c83;});}return null;};}function removeEntity(_0x1bcdcb,_0x34fc1e){return function(_0x293239){if(_0x293239){return _0x293239[_0x6993('0x2d')]()[_0x6993('0x19')](function(){_0x1bcdcb['status'](0xcc)[_0x6993('0x23')]();});}};}function handleEntityNotFound(_0x1c45a2,_0x4904cc){return function(_0x37460c){if(!_0x37460c){_0x1c45a2[_0x6993('0x2e')](0x194);}return _0x37460c;};}function handleError(_0x446949,_0x3704e1){_0x3704e1=_0x3704e1||0x1f4;return function(_0x986fbf){logger[_0x6993('0x20')](_0x986fbf[_0x6993('0x2f')]);if(_0x986fbf['name']){delete _0x986fbf[_0x6993('0x30')];}_0x446949[_0x6993('0x22')](_0x3704e1)[_0x6993('0x31')](_0x986fbf);};}exports[_0x6993('0x32')]=function(_0x2e6be5,_0x36853a){var _0x1b9093={},_0x145a23={},_0x38c82b={'count':0x0,'rows':[]};var _0x4b5b4d=_[_0x6993('0x33')](db[_0x6993('0x34')]['rawAttributes'],function(_0x2a6d3e){return{'name':_0x2a6d3e[_0x6993('0x35')],'type':_0x2a6d3e[_0x6993('0x36')][_0x6993('0x37')]};});_0x145a23[_0x6993('0x38')]=_[_0x6993('0x33')](_0x4b5b4d,'name');_0x145a23['query']=_[_0x6993('0x39')](_0x2e6be5[_0x6993('0x3a')]);_0x145a23[_0x6993('0x3b')]=_[_0x6993('0x3c')](_0x145a23[_0x6993('0x38')],_0x145a23[_0x6993('0x3a')]);_0x1b9093[_0x6993('0x3d')]=_[_0x6993('0x3c')](_0x145a23[_0x6993('0x38')],qs[_0x6993('0x3e')](_0x2e6be5['query'][_0x6993('0x3e')]));_0x1b9093['attributes']=_0x1b9093['attributes'][_0x6993('0x3f')]?_0x1b9093[_0x6993('0x3d')]:_0x145a23[_0x6993('0x38')];if(!_0x2e6be5[_0x6993('0x3a')][_0x6993('0x40')](_0x6993('0x41'))){_0x1b9093[_0x6993('0x27')]=qs[_0x6993('0x27')](_0x2e6be5[_0x6993('0x3a')]['limit']);_0x1b9093[_0x6993('0x26')]=qs[_0x6993('0x26')](_0x2e6be5[_0x6993('0x3a')][_0x6993('0x26')]);}_0x1b9093[_0x6993('0x42')]=qs[_0x6993('0x43')](_0x2e6be5[_0x6993('0x3a')][_0x6993('0x43')]);_0x1b9093[_0x6993('0x44')]=qs[_0x6993('0x3b')](_['pick'](_0x2e6be5[_0x6993('0x3a')],_0x145a23['filters']),_0x4b5b4d);if(_0x2e6be5['query']['filter']){_0x1b9093[_0x6993('0x44')]=_[_0x6993('0x45')](_0x1b9093['where'],{'$or':_[_0x6993('0x33')](_0x4b5b4d,function(_0x5d9f1d){if(_0x5d9f1d[_0x6993('0x36')]!=='VIRTUAL'){var _0x59ac9c={};_0x59ac9c[_0x5d9f1d[_0x6993('0x30')]]={'$like':'%'+_0x2e6be5[_0x6993('0x3a')]['filter']+'%'};return _0x59ac9c;}})});}_0x1b9093=_[_0x6993('0x45')]({},_0x1b9093,_0x2e6be5[_0x6993('0x46')]);var _0x107fb9={'where':_0x1b9093[_0x6993('0x44')]};return db[_0x6993('0x34')][_0x6993('0x25')](_0x107fb9)[_0x6993('0x19')](function(_0x12919d){_0x38c82b['count']=_0x12919d;if(_0x2e6be5[_0x6993('0x3a')][_0x6993('0x47')]){_0x1b9093[_0x6993('0x48')]=[{'all':!![]}];}return db[_0x6993('0x34')][_0x6993('0x49')](_0x1b9093);})['then'](function(_0x28f24a){_0x38c82b[_0x6993('0x4a')]=_0x28f24a;return _0x38c82b;})[_0x6993('0x19')](respondWithFilteredResult(_0x36853a,_0x1b9093))[_0x6993('0x4b')](handleError(_0x36853a,null));};exports[_0x6993('0x4c')]=function(_0x5b3d4b,_0x47a0d0){var _0x4f532e={'raw':![],'where':{'id':_0x5b3d4b[_0x6993('0x4d')]['id']}},_0x36042b={};_0x36042b[_0x6993('0x38')]=_['keys'](db[_0x6993('0x34')][_0x6993('0x4e')]);_0x36042b[_0x6993('0x3a')]=_[_0x6993('0x39')](_0x5b3d4b[_0x6993('0x3a')]);_0x36042b[_0x6993('0x3b')]=_[_0x6993('0x3c')](_0x36042b[_0x6993('0x38')],_0x36042b[_0x6993('0x3a')]);_0x4f532e['attributes']=_[_0x6993('0x3c')](_0x36042b['model'],qs[_0x6993('0x3e')](_0x5b3d4b[_0x6993('0x3a')][_0x6993('0x3e')]));_0x4f532e[_0x6993('0x3d')]=_0x4f532e[_0x6993('0x3d')][_0x6993('0x3f')]?_0x4f532e[_0x6993('0x3d')]:_0x36042b[_0x6993('0x38')];if(_0x5b3d4b[_0x6993('0x3a')][_0x6993('0x47')]){_0x4f532e[_0x6993('0x48')]=[{'all':!![]}];}_0x4f532e=_[_0x6993('0x45')]({},_0x4f532e,_0x5b3d4b[_0x6993('0x46')]);return db[_0x6993('0x34')][_0x6993('0x4f')](_0x4f532e)[_0x6993('0x19')](handleEntityNotFound(_0x47a0d0,null))[_0x6993('0x19')](respondWithResult(_0x47a0d0,null))[_0x6993('0x4b')](handleError(_0x47a0d0,null));};exports[_0x6993('0x50')]=function(_0x18f296,_0x54674f){return db[_0x6993('0x34')][_0x6993('0x50')](_0x18f296[_0x6993('0x51')],{})[_0x6993('0x19')](respondWithResult(_0x54674f,0xc9))[_0x6993('0x4b')](handleError(_0x54674f,null));};exports[_0x6993('0x52')]=function(_0x17915c,_0x347e57){if(_0x17915c[_0x6993('0x51')]['id']){delete _0x17915c[_0x6993('0x51')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x17915c[_0x6993('0x4d')]['id']}})[_0x6993('0x19')](handleEntityNotFound(_0x347e57,null))[_0x6993('0x19')](saveUpdates(_0x17915c[_0x6993('0x51')],null))['then'](respondWithResult(_0x347e57,null))['catch'](handleError(_0x347e57,null));};exports['destroy']=function(_0x355de4,_0x2f2b0b){return db[_0x6993('0x34')]['find']({'where':{'id':_0x355de4[_0x6993('0x4d')]['id']}})[_0x6993('0x19')](handleEntityNotFound(_0x2f2b0b,null))[_0x6993('0x19')](removeEntity(_0x2f2b0b,null))[_0x6993('0x4b')](handleError(_0x2f2b0b,null));};exports[_0x6993('0x53')]=function(_0x52c4c1,_0x1e3815,_0x2a6358){var _0x5d0d5b={};var _0x5c804a={};var _0x3ebcc0;var _0x192489;return db[_0x6993('0x34')]['findOne']({'where':{'id':_0x52c4c1['params']['id']}})[_0x6993('0x19')](handleEntityNotFound(_0x1e3815,null))[_0x6993('0x19')](function(_0x5ac7c1){if(_0x5ac7c1){_0x3ebcc0=_0x5ac7c1;_0x5c804a[_0x6993('0x38')]=_[_0x6993('0x39')](db['SalesforceField'][_0x6993('0x4e')]);_0x5c804a[_0x6993('0x3a')]=_[_0x6993('0x39')](_0x52c4c1['query']);_0x5c804a[_0x6993('0x3b')]=_[_0x6993('0x3c')](_0x5c804a[_0x6993('0x38')],_0x5c804a[_0x6993('0x3a')]);_0x5d0d5b[_0x6993('0x3d')]=_[_0x6993('0x3c')](_0x5c804a[_0x6993('0x38')],qs[_0x6993('0x3e')](_0x52c4c1[_0x6993('0x3a')][_0x6993('0x3e')]));_0x5d0d5b[_0x6993('0x3d')]=_0x5d0d5b[_0x6993('0x3d')][_0x6993('0x3f')]?_0x5d0d5b[_0x6993('0x3d')]:_0x5c804a[_0x6993('0x38')];_0x5d0d5b['order']=qs[_0x6993('0x43')](_0x52c4c1[_0x6993('0x3a')][_0x6993('0x43')]);_0x5d0d5b[_0x6993('0x44')]=qs[_0x6993('0x3b')](_[_0x6993('0x54')](_0x52c4c1[_0x6993('0x3a')],_0x5c804a[_0x6993('0x3b')]));if(_0x52c4c1[_0x6993('0x3a')][_0x6993('0x55')]){_0x5d0d5b['where']=_[_0x6993('0x45')](_0x5d0d5b[_0x6993('0x44')],{'$or':_[_0x6993('0x33')](_0x5d0d5b[_0x6993('0x3d')],function(_0x33be7e){var _0x137dc2={};_0x137dc2[_0x33be7e]={'$like':'%'+_0x52c4c1[_0x6993('0x3a')][_0x6993('0x55')]+'%'};return _0x137dc2;})});}_0x5d0d5b=_['merge']({},_0x5d0d5b,_0x52c4c1['options']);return _0x3ebcc0[_0x6993('0x53')](_0x5d0d5b);}})['then'](function(_0x22982d){if(_0x22982d){_0x192489=_0x22982d[_0x6993('0x3f')];if(!_0x52c4c1[_0x6993('0x3a')][_0x6993('0x40')](_0x6993('0x41'))){_0x5d0d5b['limit']=qs[_0x6993('0x27')](_0x52c4c1[_0x6993('0x3a')][_0x6993('0x27')]);_0x5d0d5b['offset']=qs['offset'](_0x52c4c1[_0x6993('0x3a')][_0x6993('0x26')]);}return _0x3ebcc0[_0x6993('0x53')](_0x5d0d5b);}})[_0x6993('0x19')](function(_0x56e61a){if(_0x56e61a){return _0x56e61a?{'count':_0x192489,'rows':_0x56e61a}:null;}})[_0x6993('0x19')](respondWithResult(_0x1e3815,null))['catch'](handleError(_0x1e3815,null));};exports[_0x6993('0x56')]=function(_0x28103f,_0x394744,_0x2ed897){var _0x4dfe56={};var _0x68f0d1={};var _0x2feb63;var _0x439165;return db[_0x6993('0x34')]['findOne']({'where':{'id':_0x28103f['params']['id']}})[_0x6993('0x19')](handleEntityNotFound(_0x394744,null))['then'](function(_0x4015a1){if(_0x4015a1){_0x2feb63=_0x4015a1;_0x68f0d1['model']=_[_0x6993('0x39')](db[_0x6993('0x57')][_0x6993('0x4e')]);_0x68f0d1[_0x6993('0x3a')]=_[_0x6993('0x39')](_0x28103f[_0x6993('0x3a')]);_0x68f0d1['filters']=_[_0x6993('0x3c')](_0x68f0d1[_0x6993('0x38')],_0x68f0d1[_0x6993('0x3a')]);_0x4dfe56[_0x6993('0x3d')]=_[_0x6993('0x3c')](_0x68f0d1[_0x6993('0x38')],qs[_0x6993('0x3e')](_0x28103f['query']['fields']));_0x4dfe56[_0x6993('0x3d')]=_0x4dfe56[_0x6993('0x3d')][_0x6993('0x3f')]?_0x4dfe56['attributes']:_0x68f0d1[_0x6993('0x38')];_0x4dfe56[_0x6993('0x42')]=qs[_0x6993('0x43')](_0x28103f[_0x6993('0x3a')]['sort']);_0x4dfe56['where']=qs['filters'](_[_0x6993('0x54')](_0x28103f['query'],_0x68f0d1[_0x6993('0x3b')]));if(_0x28103f[_0x6993('0x3a')][_0x6993('0x55')]){_0x4dfe56[_0x6993('0x44')]=_[_0x6993('0x45')](_0x4dfe56[_0x6993('0x44')],{'$or':_[_0x6993('0x33')](_0x4dfe56[_0x6993('0x3d')],function(_0x5ed6bb){var _0x2c0388={};_0x2c0388[_0x5ed6bb]={'$like':'%'+_0x28103f[_0x6993('0x3a')][_0x6993('0x55')]+'%'};return _0x2c0388;})});}_0x4dfe56=_[_0x6993('0x45')]({},_0x4dfe56,_0x28103f['options']);return _0x2feb63[_0x6993('0x56')](_0x4dfe56);}})[_0x6993('0x19')](function(_0x292b70){if(_0x292b70){_0x439165=_0x292b70['length'];if(!_0x28103f[_0x6993('0x3a')][_0x6993('0x40')](_0x6993('0x41'))){_0x4dfe56['limit']=qs[_0x6993('0x27')](_0x28103f[_0x6993('0x3a')][_0x6993('0x27')]);_0x4dfe56['offset']=qs[_0x6993('0x26')](_0x28103f[_0x6993('0x3a')][_0x6993('0x26')]);}return _0x2feb63[_0x6993('0x56')](_0x4dfe56);}})[_0x6993('0x19')](function(_0x2ec97b){if(_0x2ec97b){return _0x2ec97b?{'count':_0x439165,'rows':_0x2ec97b}:null;}})[_0x6993('0x19')](respondWithResult(_0x394744,null))[_0x6993('0x4b')](handleError(_0x394744,null));};exports['getDescriptions']=function(_0x3042a5,_0x33b6e0,_0x22e1d8){var _0x108457={};var _0x358ca9={};var _0x29bebd;var _0x3da67f;return db[_0x6993('0x34')][_0x6993('0x58')]({'where':{'id':_0x3042a5['params']['id']}})['then'](handleEntityNotFound(_0x33b6e0,null))['then'](function(_0xc43757){if(_0xc43757){_0x29bebd=_0xc43757;_0x358ca9[_0x6993('0x38')]=_['keys'](db[_0x6993('0x57')]['rawAttributes']);_0x358ca9[_0x6993('0x3a')]=_['keys'](_0x3042a5[_0x6993('0x3a')]);_0x358ca9[_0x6993('0x3b')]=_[_0x6993('0x3c')](_0x358ca9[_0x6993('0x38')],_0x358ca9[_0x6993('0x3a')]);_0x108457[_0x6993('0x3d')]=_['intersection'](_0x358ca9['model'],qs[_0x6993('0x3e')](_0x3042a5[_0x6993('0x3a')][_0x6993('0x3e')]));_0x108457[_0x6993('0x3d')]=_0x108457[_0x6993('0x3d')][_0x6993('0x3f')]?_0x108457[_0x6993('0x3d')]:_0x358ca9[_0x6993('0x38')];_0x108457['order']=qs['sort'](_0x3042a5['query'][_0x6993('0x43')]);_0x108457[_0x6993('0x44')]=qs[_0x6993('0x3b')](_['pick'](_0x3042a5['query'],_0x358ca9['filters']));if(_0x3042a5['query'][_0x6993('0x55')]){_0x108457[_0x6993('0x44')]=_[_0x6993('0x45')](_0x108457[_0x6993('0x44')],{'$or':_['map'](_0x108457['attributes'],function(_0x2d9c09){var _0x3e529f={};_0x3e529f[_0x2d9c09]={'$like':'%'+_0x3042a5[_0x6993('0x3a')][_0x6993('0x55')]+'%'};return _0x3e529f;})});}_0x108457=_['merge']({},_0x108457,_0x3042a5[_0x6993('0x46')]);return _0x29bebd[_0x6993('0x59')](_0x108457);}})[_0x6993('0x19')](function(_0x31f203){if(_0x31f203){_0x3da67f=_0x31f203[_0x6993('0x3f')];if(!_0x3042a5[_0x6993('0x3a')][_0x6993('0x40')](_0x6993('0x41'))){_0x108457['limit']=qs[_0x6993('0x27')](_0x3042a5['query'][_0x6993('0x27')]);_0x108457['offset']=qs['offset'](_0x3042a5['query']['offset']);}return _0x29bebd[_0x6993('0x59')](_0x108457);}})[_0x6993('0x19')](function(_0x8fabf4){if(_0x8fabf4){return _0x8fabf4?{'count':_0x3da67f,'rows':_0x8fabf4}:null;}})[_0x6993('0x19')](respondWithResult(_0x33b6e0,null))['catch'](handleError(_0x33b6e0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 6efd7d1..d693e02 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 _0xa520=['bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x81d9ad,_0x3155e6){var _0x8764f6=function(_0x23aa6f){while(--_0x23aa6f){_0x81d9ad['push'](_0x81d9ad['shift']());}};_0x8764f6(++_0x3155e6);}(_0xa520,0xa1));var _0x0a52=function(_0x44a6f5,_0x1375d3){_0x44a6f5=_0x44a6f5-0x0;var _0x2f0b54=_0xa520[_0x44a6f5];return _0x2f0b54;};'use strict';var _=require(_0x0a52('0x0'));var util=require(_0x0a52('0x1'));var logger=require(_0x0a52('0x2'))(_0x0a52('0x3'));var moment=require('moment');var BPromise=require(_0x0a52('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a52('0x5'));var rimraf=require(_0x0a52('0x6'));var config=require(_0x0a52('0x7'));var attributes=require(_0x0a52('0x8'));module[_0x0a52('0x9')]=function(_0x50fc8a,_0x3b7f26){return _0x50fc8a[_0x0a52('0xa')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0f1=['SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x1f246f,_0x1f3cd8){var _0x2c393d=function(_0x3d21f5){while(--_0x3d21f5){_0x1f246f['push'](_0x1f246f['shift']());}};_0x2c393d(++_0x1f3cd8);}(_0xd0f1,0x1a6));var _0x1d0f=function(_0x16be54,_0xfea8f5){_0x16be54=_0x16be54-0x0;var _0x23ee27=_0xd0f1[_0x16be54];return _0x23ee27;};'use strict';var _=require(_0x1d0f('0x0'));var util=require('util');var logger=require(_0x1d0f('0x1'))(_0x1d0f('0x2'));var moment=require(_0x1d0f('0x3'));var BPromise=require(_0x1d0f('0x4'));var rp=require(_0x1d0f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1d0f('0x6'));var attributes=require(_0x1d0f('0x7'));module[_0x1d0f('0x8')]=function(_0x400495,_0x26f3ca){return _0x400495[_0x1d0f('0x9')](_0x1d0f('0xa'),attributes,{'tableName':_0x1d0f('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 6cfcada..fce3ea8 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 _0xfab6=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x259a33,_0x459c93){var _0x249465=function(_0x5d3ccf){while(--_0x5d3ccf){_0x259a33['push'](_0x259a33['shift']());}};_0x249465(++_0x459c93);}(_0xfab6,0x113));var _0x6fab=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xfab6[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x6fab('0x0'));var util=require('util');var moment=require(_0x6fab('0x1'));var BPromise=require(_0x6fab('0x2'));var rs=require(_0x6fab('0x3'));var fs=require('fs');var Redis=require(_0x6fab('0x4'));var db=require(_0x6fab('0x5'))['db'];var utils=require(_0x6fab('0x6'));var logger=require(_0x6fab('0x7'))(_0x6fab('0x8'));var config=require('../../config/environment');var jayson=require(_0x6fab('0x9'));var client=jayson[_0x6fab('0xa')][_0x6fab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3511cd,_0x42a47e,_0xd8e688){return new BPromise(function(_0x1dcd2d,_0xde0f38){return client[_0x6fab('0xc')](_0x3511cd,_0xd8e688)[_0x6fab('0xd')](function(_0x2c3d48){logger['info'](_0x6fab('0xe'),_0x42a47e,_0x6fab('0xf'));logger[_0x6fab('0x10')](_0x6fab('0x11'),_0x42a47e,_0x6fab('0xf'),JSON[_0x6fab('0x12')](_0x2c3d48));if(_0x2c3d48[_0x6fab('0x13')]){if(_0x2c3d48[_0x6fab('0x13')][_0x6fab('0x14')]===0x1f4){logger['error'](_0x6fab('0xe'),_0x42a47e,_0x2c3d48['error'][_0x6fab('0x15')]);return _0xde0f38(_0x2c3d48['error'][_0x6fab('0x15')]);}logger[_0x6fab('0x13')](_0x6fab('0xe'),_0x42a47e,_0x2c3d48[_0x6fab('0x13')]['message']);return _0x1dcd2d(_0x2c3d48[_0x6fab('0x13')][_0x6fab('0x15')]);}else{logger[_0x6fab('0x16')](_0x6fab('0xe'),_0x42a47e,_0x6fab('0xf'));_0x1dcd2d(_0x2c3d48[_0x6fab('0x17')][_0x6fab('0x15')]);}})[_0x6fab('0x18')](function(_0x43d763){logger[_0x6fab('0x13')](_0x6fab('0xe'),_0x42a47e,_0x43d763);_0xde0f38(_0x43d763);});});} \ No newline at end of file +var _0x0275=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','bluebird'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x0275,0x185));var _0x5027=function(_0x4a071c,_0x1ae33b){_0x4a071c=_0x4a071c-0x0;var _0xe6230b=_0x0275[_0x4a071c];return _0xe6230b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5027('0x0'));var BPromise=require(_0x5027('0x1'));var rs=require(_0x5027('0x2'));var fs=require('fs');var Redis=require(_0x5027('0x3'));var db=require(_0x5027('0x4'))['db'];var utils=require(_0x5027('0x5'));var logger=require(_0x5027('0x6'))(_0x5027('0x7'));var config=require(_0x5027('0x8'));var jayson=require(_0x5027('0x9'));var client=jayson[_0x5027('0xa')][_0x5027('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43f808,_0x3133fb,_0x24239e){return new BPromise(function(_0x28c96b,_0x2a30b5){return client[_0x5027('0xc')](_0x43f808,_0x24239e)[_0x5027('0xd')](function(_0x3f4e28){logger[_0x5027('0xe')](_0x5027('0xf'),_0x3133fb,'request\x20sent');logger['debug'](_0x5027('0x10'),_0x3133fb,_0x5027('0x11'),JSON['stringify'](_0x3f4e28));if(_0x3f4e28[_0x5027('0x12')]){if(_0x3f4e28[_0x5027('0x12')][_0x5027('0x13')]===0x1f4){logger[_0x5027('0x12')](_0x5027('0xf'),_0x3133fb,_0x3f4e28[_0x5027('0x12')]['message']);return _0x2a30b5(_0x3f4e28['error'][_0x5027('0x14')]);}logger[_0x5027('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3133fb,_0x3f4e28['error'][_0x5027('0x14')]);return _0x28c96b(_0x3f4e28[_0x5027('0x12')]['message']);}else{logger[_0x5027('0xe')](_0x5027('0xf'),_0x3133fb,'request\x20sent');_0x28c96b(_0x3f4e28[_0x5027('0x15')][_0x5027('0x14')]);}})[_0x5027('0x16')](function(_0x4079bf){logger[_0x5027('0x12')](_0x5027('0xf'),_0x3133fb,_0x4079bf);_0x2a30b5(_0x4079bf);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 3af2639..da5ebd3 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 _0x71ab=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0xb78f74,_0x2548d1){var _0x465eb1=function(_0x590567){while(--_0x590567){_0xb78f74['push'](_0xb78f74['shift']());}};_0x465eb1(++_0x2548d1);}(_0x71ab,0x64));var _0xb71a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x71ab[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var auth=require(_0xb71a('0x3'));var interaction=require(_0xb71a('0x4'));var config=require(_0xb71a('0x5'));var controller=require(_0xb71a('0x6'));router[_0xb71a('0x7')]('/',auth[_0xb71a('0x8')](),controller[_0xb71a('0x9')]);router[_0xb71a('0x7')](_0xb71a('0xa'),auth[_0xb71a('0x8')](),controller[_0xb71a('0xb')]);router[_0xb71a('0xc')]('/',auth[_0xb71a('0x8')](),controller[_0xb71a('0xd')]);router[_0xb71a('0xe')](_0xb71a('0xa'),auth[_0xb71a('0x8')](),controller['update']);router[_0xb71a('0xf')]('/:id',auth[_0xb71a('0x8')](),controller[_0xb71a('0x10')]);module[_0xb71a('0x11')]=router; \ No newline at end of file +var _0x46ed=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x76eebd,_0x246f7d){var _0x236b42=function(_0x8c000f){while(--_0x8c000f){_0x76eebd['push'](_0x76eebd['shift']());}};_0x236b42(++_0x246f7d);}(_0x46ed,0x168));var _0xd46e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x46ed[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd46e('0x5'));var config=require(_0xd46e('0x6'));var controller=require('./intSalesforceField.controller');router[_0xd46e('0x7')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0x9')]);router[_0xd46e('0x7')](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')]('/:id',auth[_0xd46e('0x8')](),controller[_0xd46e('0xf')]);router['delete'](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 0c96456..dd719f0 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 _0xc1e2=['keyValue','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x5bc091,_0x527016){var _0x4dc03f=function(_0x10d991){while(--_0x10d991){_0x5bc091['push'](_0x5bc091['shift']());}};_0x4dc03f(++_0x527016);}(_0xc1e2,0x13b));var _0x2c1e=function(_0x12080f,_0x5cebcd){_0x12080f=_0x12080f-0x0;var _0x1b1448=_0xc1e2[_0x12080f];return _0x1b1448;};'use strict';var Sequelize=require(_0x2c1e('0x0'));module[_0x2c1e('0x1')]={'type':{'type':Sequelize[_0x2c1e('0x2')](_0x2c1e('0x3'),_0x2c1e('0x4'),'customVariable',_0x2c1e('0x5')),'defaultValue':_0x2c1e('0x3')},'content':{'type':Sequelize[_0x2c1e('0x6')]},'key':{'type':Sequelize[_0x2c1e('0x6')]},'keyType':{'type':Sequelize[_0x2c1e('0x2')](_0x2c1e('0x3'),_0x2c1e('0x4'),_0x2c1e('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2c1e('0x6')]},'variableName':{'type':Sequelize[_0x2c1e('0x6')]}}; \ No newline at end of file +var _0xbd0f=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0xcbf9ec,_0xf68410){var _0x35153a=function(_0x190fbe){while(--_0x190fbe){_0xcbf9ec['push'](_0xcbf9ec['shift']());}};_0x35153a(++_0xf68410);}(_0xbd0f,0x1a8));var _0xfbd0=function(_0x5e283a,_0x3e09ee){_0x5e283a=_0x5e283a-0x0;var _0x4ffaa2=_0xbd0f[_0x5e283a];return _0x4ffaa2;};'use strict';var Sequelize=require(_0xfbd0('0x0'));module[_0xfbd0('0x1')]={'type':{'type':Sequelize[_0xfbd0('0x2')](_0xfbd0('0x3'),_0xfbd0('0x4'),_0xfbd0('0x5'),_0xfbd0('0x6')),'defaultValue':_0xfbd0('0x3')},'content':{'type':Sequelize[_0xfbd0('0x7')]},'key':{'type':Sequelize[_0xfbd0('0x7')]},'keyType':{'type':Sequelize[_0xfbd0('0x2')](_0xfbd0('0x3'),_0xfbd0('0x4'),_0xfbd0('0x5'))},'keyContent':{'type':Sequelize[_0xfbd0('0x7')]},'idField':{'type':Sequelize[_0xfbd0('0x7')]},'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 eaee960..da2b3ee 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 _0xda15=['map','SalesforceField','rawAttributes','fieldName','model','query','attributes','fields','length','hasOwnProperty','order','sort','filters','merge','where','type','VIRTUAL','filter','options','count','then','include','findAll','show','params','keys','intersection','includeAll','find','catch','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','update','stack','name','send'];(function(_0x5a5fb9,_0x314837){var _0x3585cd=function(_0x3949e2){while(--_0x3949e2){_0x5a5fb9['push'](_0x5a5fb9['shift']());}};_0x3585cd(++_0x314837);}(_0xda15,0x175));var _0x5da1=function(_0x4f276e,_0x348fd4){_0x4f276e=_0x4f276e-0x0;var _0x8bd4a3=_0xda15[_0x4f276e];return _0x8bd4a3;};'use strict';var pdf=require(_0x5da1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5da1('0x1'));var zipdir=require(_0x5da1('0x2'));var jsonpatch=require(_0x5da1('0x3'));var rp=require(_0x5da1('0x4'));var moment=require(_0x5da1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5da1('0x6'));var util=require(_0x5da1('0x7'));var path=require('path');var sox=require(_0x5da1('0x8'));var csv=require(_0x5da1('0x9'));var ejs=require(_0x5da1('0xa'));var fs=require('fs');var _=require(_0x5da1('0xb'));var squel=require('squel');var crypto=require(_0x5da1('0xc'));var jsforce=require(_0x5da1('0xd'));var deskjs=require(_0x5da1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5da1('0xf'));var Papa=require(_0x5da1('0x10'));var Redis=require(_0x5da1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5da1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5da1('0x13'))('api');var utils=require(_0x5da1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5da1('0x15'));var db=require(_0x5da1('0x16'))['db'];function respondWithStatusCode(_0x2aa64d,_0x53e441){_0x53e441=_0x53e441||0xcc;return function(_0x38bb36){if(_0x38bb36){return _0x2aa64d[_0x5da1('0x17')](_0x53e441);}return _0x2aa64d[_0x5da1('0x18')](_0x53e441)['end']();};}function respondWithResult(_0x589f72,_0x4d7e19){_0x4d7e19=_0x4d7e19||0xc8;return function(_0xa2dcf2){if(_0xa2dcf2){return _0x589f72[_0x5da1('0x18')](_0x4d7e19)[_0x5da1('0x19')](_0xa2dcf2);}};}function respondWithFilteredResult(_0x173065,_0x321f3a){return function(_0x287da1){if(_0x287da1){var _0x680588=_0x287da1['count'],_0x45af0c=_0x321f3a[_0x5da1('0x1a')],_0x40ec6b=_0x321f3a[_0x5da1('0x1a')]+_0x321f3a[_0x5da1('0x1b')],_0x2b52a1;if(_0x40ec6b>=_0x680588){_0x40ec6b=_0x680588;_0x2b52a1=0xc8;}else{_0x2b52a1=0xce;}_0x173065[_0x5da1('0x18')](_0x2b52a1);return _0x173065[_0x5da1('0x1c')](_0x5da1('0x1d'),_0x45af0c+'-'+_0x40ec6b+'/'+_0x680588)[_0x5da1('0x19')](_0x287da1);}return null;};}function patchUpdates(_0x2ffacf){return function(_0x43c739){try{jsonpatch['apply'](_0x43c739,_0x2ffacf,!![]);}catch(_0x54a1bf){return BPromise[_0x5da1('0x1e')](_0x54a1bf);}return _0x43c739['save']();};}function saveUpdates(_0x560510,_0x2949bc){return function(_0x14c6c7){if(_0x14c6c7){return _0x14c6c7[_0x5da1('0x1f')](_0x560510)['then'](function(_0x5f1b5c){return _0x5f1b5c;});}return null;};}function removeEntity(_0xed60f0,_0x1eab35){return function(_0xecb86){if(_0xecb86){return _0xecb86['destroy']()['then'](function(){_0xed60f0[_0x5da1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51ec07,_0x2cb918){return function(_0x5a73f2){if(!_0x5a73f2){_0x51ec07[_0x5da1('0x17')](0x194);}return _0x5a73f2;};}function handleError(_0x50894f,_0x1d2474){_0x1d2474=_0x1d2474||0x1f4;return function(_0x2e2d0f){logger['error'](_0x2e2d0f[_0x5da1('0x20')]);if(_0x2e2d0f[_0x5da1('0x21')]){delete _0x2e2d0f[_0x5da1('0x21')];}_0x50894f[_0x5da1('0x18')](_0x1d2474)[_0x5da1('0x22')](_0x2e2d0f);};}exports['index']=function(_0x598e76,_0x10b68f){var _0x28f9a3={},_0x135cde={},_0xae9f91={'count':0x0,'rows':[]};var _0x8b3497=_[_0x5da1('0x23')](db[_0x5da1('0x24')][_0x5da1('0x25')],function(_0x25c47c){return{'name':_0x25c47c[_0x5da1('0x26')],'type':_0x25c47c['type']['key']};});_0x135cde[_0x5da1('0x27')]=_['map'](_0x8b3497,'name');_0x135cde[_0x5da1('0x28')]=_['keys'](_0x598e76['query']);_0x135cde['filters']=_['intersection'](_0x135cde['model'],_0x135cde[_0x5da1('0x28')]);_0x28f9a3[_0x5da1('0x29')]=_['intersection'](_0x135cde[_0x5da1('0x27')],qs[_0x5da1('0x2a')](_0x598e76[_0x5da1('0x28')][_0x5da1('0x2a')]));_0x28f9a3['attributes']=_0x28f9a3[_0x5da1('0x29')][_0x5da1('0x2b')]?_0x28f9a3['attributes']:_0x135cde[_0x5da1('0x27')];if(!_0x598e76[_0x5da1('0x28')][_0x5da1('0x2c')]('nolimit')){_0x28f9a3[_0x5da1('0x1b')]=qs['limit'](_0x598e76[_0x5da1('0x28')]['limit']);_0x28f9a3[_0x5da1('0x1a')]=qs['offset'](_0x598e76[_0x5da1('0x28')][_0x5da1('0x1a')]);}_0x28f9a3[_0x5da1('0x2d')]=qs[_0x5da1('0x2e')](_0x598e76['query'][_0x5da1('0x2e')]);_0x28f9a3['where']=qs[_0x5da1('0x2f')](_['pick'](_0x598e76[_0x5da1('0x28')],_0x135cde['filters']),_0x8b3497);if(_0x598e76['query']['filter']){_0x28f9a3['where']=_[_0x5da1('0x30')](_0x28f9a3[_0x5da1('0x31')],{'$or':_[_0x5da1('0x23')](_0x8b3497,function(_0x2700bd){if(_0x2700bd[_0x5da1('0x32')]!==_0x5da1('0x33')){var _0x2cd7f1={};_0x2cd7f1[_0x2700bd[_0x5da1('0x21')]]={'$like':'%'+_0x598e76[_0x5da1('0x28')][_0x5da1('0x34')]+'%'};return _0x2cd7f1;}})});}_0x28f9a3=_[_0x5da1('0x30')]({},_0x28f9a3,_0x598e76[_0x5da1('0x35')]);var _0x4942e7={'where':_0x28f9a3[_0x5da1('0x31')]};return db[_0x5da1('0x24')][_0x5da1('0x36')](_0x4942e7)[_0x5da1('0x37')](function(_0x5e2839){_0xae9f91[_0x5da1('0x36')]=_0x5e2839;if(_0x598e76[_0x5da1('0x28')]['includeAll']){_0x28f9a3[_0x5da1('0x38')]=[{'all':!![]}];}return db[_0x5da1('0x24')][_0x5da1('0x39')](_0x28f9a3);})[_0x5da1('0x37')](function(_0x5b7b21){_0xae9f91['rows']=_0x5b7b21;return _0xae9f91;})[_0x5da1('0x37')](respondWithFilteredResult(_0x10b68f,_0x28f9a3))['catch'](handleError(_0x10b68f,null));};exports[_0x5da1('0x3a')]=function(_0x3db369,_0x1386ba){var _0x3b1aa0={'raw':!![],'where':{'id':_0x3db369[_0x5da1('0x3b')]['id']}},_0x406e0b={};_0x406e0b[_0x5da1('0x27')]=_['keys'](db[_0x5da1('0x24')][_0x5da1('0x25')]);_0x406e0b['query']=_[_0x5da1('0x3c')](_0x3db369['query']);_0x406e0b[_0x5da1('0x2f')]=_[_0x5da1('0x3d')](_0x406e0b['model'],_0x406e0b[_0x5da1('0x28')]);_0x3b1aa0[_0x5da1('0x29')]=_['intersection'](_0x406e0b['model'],qs['fields'](_0x3db369[_0x5da1('0x28')][_0x5da1('0x2a')]));_0x3b1aa0[_0x5da1('0x29')]=_0x3b1aa0[_0x5da1('0x29')]['length']?_0x3b1aa0[_0x5da1('0x29')]:_0x406e0b['model'];if(_0x3db369[_0x5da1('0x28')][_0x5da1('0x3e')]){_0x3b1aa0[_0x5da1('0x38')]=[{'all':!![]}];}_0x3b1aa0=_[_0x5da1('0x30')]({},_0x3b1aa0,_0x3db369[_0x5da1('0x35')]);return db[_0x5da1('0x24')][_0x5da1('0x3f')](_0x3b1aa0)[_0x5da1('0x37')](handleEntityNotFound(_0x1386ba,null))[_0x5da1('0x37')](respondWithResult(_0x1386ba,null))[_0x5da1('0x40')](handleError(_0x1386ba,null));};exports[_0x5da1('0x41')]=function(_0x33958c,_0x111c2e){return db[_0x5da1('0x24')][_0x5da1('0x41')](_0x33958c[_0x5da1('0x42')],{})['then'](respondWithResult(_0x111c2e,0xc9))[_0x5da1('0x40')](handleError(_0x111c2e,null));};exports[_0x5da1('0x1f')]=function(_0x1f2a68,_0x382920){if(_0x1f2a68[_0x5da1('0x42')]['id']){delete _0x1f2a68['body']['id'];}return db[_0x5da1('0x24')]['find']({'where':{'id':_0x1f2a68['params']['id']}})[_0x5da1('0x37')](handleEntityNotFound(_0x382920,null))[_0x5da1('0x37')](saveUpdates(_0x1f2a68[_0x5da1('0x42')],null))[_0x5da1('0x37')](respondWithResult(_0x382920,null))['catch'](handleError(_0x382920,null));};exports[_0x5da1('0x43')]=function(_0x2f26c2,_0x5a753f){return db['SalesforceField'][_0x5da1('0x3f')]({'where':{'id':_0x2f26c2['params']['id']}})['then'](handleEntityNotFound(_0x5a753f,null))[_0x5da1('0x37')](removeEntity(_0x5a753f,null))['catch'](handleError(_0x5a753f,null));}; \ No newline at end of file +var _0x6789=['hasOwnProperty','nolimit','limit','offset','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','destroy','html-pdf','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','set','Content-Range','json','apply','save','update','then','sendStatus','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length'];(function(_0x8cb90e,_0x142ba5){var _0x569aa9=function(_0x58d32f){while(--_0x58d32f){_0x8cb90e['push'](_0x8cb90e['shift']());}};_0x569aa9(++_0x142ba5);}(_0x6789,0xaf));var _0x9678=function(_0x4c0110,_0x53a47b){_0x4c0110=_0x4c0110-0x0;var _0x4276cb=_0x6789[_0x4c0110];return _0x4276cb;};'use strict';var pdf=require(_0x9678('0x0'));var emlformat=require(_0x9678('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9678('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9678('0x3'));var moment=require('moment');var BPromise=require(_0x9678('0x4'));var Mustache=require('mustache');var util=require(_0x9678('0x5'));var path=require(_0x9678('0x6'));var sox=require(_0x9678('0x7'));var csv=require(_0x9678('0x8'));var ejs=require(_0x9678('0x9'));var fs=require('fs');var _=require(_0x9678('0xa'));var squel=require('squel');var crypto=require(_0x9678('0xb'));var jsforce=require(_0x9678('0xc'));var deskjs=require(_0x9678('0xd'));var toCsv=require(_0x9678('0x8'));var querystring=require(_0x9678('0xe'));var Papa=require(_0x9678('0xf'));var Redis=require(_0x9678('0x10'));var authService=require(_0x9678('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9678('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9678('0x13'))(_0x9678('0x14'));var utils=require(_0x9678('0x15'));var config=require(_0x9678('0x16'));var licenseUtil=require(_0x9678('0x17'));var db=require(_0x9678('0x18'))['db'];function respondWithStatusCode(_0x66fd29,_0x4e8351){_0x4e8351=_0x4e8351||0xcc;return function(_0x1d01c6){if(_0x1d01c6){return _0x66fd29['sendStatus'](_0x4e8351);}return _0x66fd29[_0x9678('0x19')](_0x4e8351)[_0x9678('0x1a')]();};}function respondWithResult(_0xb470e4,_0x3c228b){_0x3c228b=_0x3c228b||0xc8;return function(_0x8aba82){if(_0x8aba82){return _0xb470e4['status'](_0x3c228b)['json'](_0x8aba82);}};}function respondWithFilteredResult(_0x466b57,_0x3f537f){return function(_0x68ccc3){if(_0x68ccc3){var _0xcfda2e=_0x68ccc3[_0x9678('0x1b')],_0x5c8271=_0x3f537f['offset'],_0x46a9d5=_0x3f537f['offset']+_0x3f537f['limit'],_0x558590;if(_0x46a9d5>=_0xcfda2e){_0x46a9d5=_0xcfda2e;_0x558590=0xc8;}else{_0x558590=0xce;}_0x466b57[_0x9678('0x19')](_0x558590);return _0x466b57[_0x9678('0x1c')](_0x9678('0x1d'),_0x5c8271+'-'+_0x46a9d5+'/'+_0xcfda2e)[_0x9678('0x1e')](_0x68ccc3);}return null;};}function patchUpdates(_0x18086e){return function(_0x31733e){try{jsonpatch[_0x9678('0x1f')](_0x31733e,_0x18086e,!![]);}catch(_0xe2001c){return BPromise['reject'](_0xe2001c);}return _0x31733e[_0x9678('0x20')]();};}function saveUpdates(_0x15c01b,_0x4e1a9c){return function(_0x4a6835){if(_0x4a6835){return _0x4a6835[_0x9678('0x21')](_0x15c01b)[_0x9678('0x22')](function(_0x465164){return _0x465164;});}return null;};}function removeEntity(_0x22ba1d,_0x43e368){return function(_0x343c6d){if(_0x343c6d){return _0x343c6d['destroy']()['then'](function(){_0x22ba1d[_0x9678('0x19')](0xcc)[_0x9678('0x1a')]();});}};}function handleEntityNotFound(_0x4c9e18,_0x29cb17){return function(_0x8a05b0){if(!_0x8a05b0){_0x4c9e18[_0x9678('0x23')](0x194);}return _0x8a05b0;};}function handleError(_0x413ae1,_0x1e4143){_0x1e4143=_0x1e4143||0x1f4;return function(_0x110940){logger['error'](_0x110940[_0x9678('0x24')]);if(_0x110940[_0x9678('0x25')]){delete _0x110940[_0x9678('0x25')];}_0x413ae1[_0x9678('0x19')](_0x1e4143)[_0x9678('0x26')](_0x110940);};}exports[_0x9678('0x27')]=function(_0x4ec6bd,_0x3c7d7a){var _0x296ccd={},_0x25429e={},_0x2ae39b={'count':0x0,'rows':[]};var _0x22c408=_[_0x9678('0x28')](db[_0x9678('0x29')][_0x9678('0x2a')],function(_0x310c9e){return{'name':_0x310c9e[_0x9678('0x2b')],'type':_0x310c9e[_0x9678('0x2c')][_0x9678('0x2d')]};});_0x25429e[_0x9678('0x2e')]=_[_0x9678('0x28')](_0x22c408,_0x9678('0x25'));_0x25429e[_0x9678('0x2f')]=_[_0x9678('0x30')](_0x4ec6bd['query']);_0x25429e[_0x9678('0x31')]=_['intersection'](_0x25429e[_0x9678('0x2e')],_0x25429e[_0x9678('0x2f')]);_0x296ccd['attributes']=_['intersection'](_0x25429e[_0x9678('0x2e')],qs[_0x9678('0x32')](_0x4ec6bd[_0x9678('0x2f')][_0x9678('0x32')]));_0x296ccd[_0x9678('0x33')]=_0x296ccd[_0x9678('0x33')][_0x9678('0x34')]?_0x296ccd[_0x9678('0x33')]:_0x25429e['model'];if(!_0x4ec6bd[_0x9678('0x2f')][_0x9678('0x35')](_0x9678('0x36'))){_0x296ccd[_0x9678('0x37')]=qs[_0x9678('0x37')](_0x4ec6bd[_0x9678('0x2f')][_0x9678('0x37')]);_0x296ccd[_0x9678('0x38')]=qs[_0x9678('0x38')](_0x4ec6bd[_0x9678('0x2f')]['offset']);}_0x296ccd[_0x9678('0x39')]=qs[_0x9678('0x3a')](_0x4ec6bd[_0x9678('0x2f')][_0x9678('0x3a')]);_0x296ccd[_0x9678('0x3b')]=qs['filters'](_['pick'](_0x4ec6bd['query'],_0x25429e[_0x9678('0x31')]),_0x22c408);if(_0x4ec6bd[_0x9678('0x2f')][_0x9678('0x3c')]){_0x296ccd[_0x9678('0x3b')]=_[_0x9678('0x3d')](_0x296ccd[_0x9678('0x3b')],{'$or':_[_0x9678('0x28')](_0x22c408,function(_0x2551c1){if(_0x2551c1[_0x9678('0x2c')]!==_0x9678('0x3e')){var _0x3dafdc={};_0x3dafdc[_0x2551c1[_0x9678('0x25')]]={'$like':'%'+_0x4ec6bd['query'][_0x9678('0x3c')]+'%'};return _0x3dafdc;}})});}_0x296ccd=_['merge']({},_0x296ccd,_0x4ec6bd[_0x9678('0x3f')]);var _0x4f379a={'where':_0x296ccd[_0x9678('0x3b')]};return db[_0x9678('0x29')][_0x9678('0x1b')](_0x4f379a)[_0x9678('0x22')](function(_0x1321c2){_0x2ae39b['count']=_0x1321c2;if(_0x4ec6bd[_0x9678('0x2f')]['includeAll']){_0x296ccd[_0x9678('0x40')]=[{'all':!![]}];}return db[_0x9678('0x29')][_0x9678('0x41')](_0x296ccd);})[_0x9678('0x22')](function(_0x4e8616){_0x2ae39b[_0x9678('0x42')]=_0x4e8616;return _0x2ae39b;})[_0x9678('0x22')](respondWithFilteredResult(_0x3c7d7a,_0x296ccd))[_0x9678('0x43')](handleError(_0x3c7d7a,null));};exports[_0x9678('0x44')]=function(_0x148cf0,_0x2b3019){var _0x40efea={'raw':!![],'where':{'id':_0x148cf0[_0x9678('0x45')]['id']}},_0x374eb0={};_0x374eb0[_0x9678('0x2e')]=_[_0x9678('0x30')](db['SalesforceField'][_0x9678('0x2a')]);_0x374eb0[_0x9678('0x2f')]=_[_0x9678('0x30')](_0x148cf0[_0x9678('0x2f')]);_0x374eb0[_0x9678('0x31')]=_[_0x9678('0x46')](_0x374eb0[_0x9678('0x2e')],_0x374eb0[_0x9678('0x2f')]);_0x40efea['attributes']=_['intersection'](_0x374eb0[_0x9678('0x2e')],qs['fields'](_0x148cf0[_0x9678('0x2f')]['fields']));_0x40efea[_0x9678('0x33')]=_0x40efea['attributes'][_0x9678('0x34')]?_0x40efea[_0x9678('0x33')]:_0x374eb0[_0x9678('0x2e')];if(_0x148cf0[_0x9678('0x2f')][_0x9678('0x47')]){_0x40efea[_0x9678('0x40')]=[{'all':!![]}];}_0x40efea=_['merge']({},_0x40efea,_0x148cf0[_0x9678('0x3f')]);return db[_0x9678('0x29')][_0x9678('0x48')](_0x40efea)['then'](handleEntityNotFound(_0x2b3019,null))[_0x9678('0x22')](respondWithResult(_0x2b3019,null))[_0x9678('0x43')](handleError(_0x2b3019,null));};exports[_0x9678('0x49')]=function(_0x2c6029,_0x164d6b){return db['SalesforceField'][_0x9678('0x49')](_0x2c6029[_0x9678('0x4a')],{})['then'](respondWithResult(_0x164d6b,0xc9))[_0x9678('0x43')](handleError(_0x164d6b,null));};exports[_0x9678('0x21')]=function(_0x45ef2c,_0x1a29d4){if(_0x45ef2c['body']['id']){delete _0x45ef2c['body']['id'];}return db[_0x9678('0x29')]['find']({'where':{'id':_0x45ef2c['params']['id']}})['then'](handleEntityNotFound(_0x1a29d4,null))[_0x9678('0x22')](saveUpdates(_0x45ef2c[_0x9678('0x4a')],null))[_0x9678('0x22')](respondWithResult(_0x1a29d4,null))['catch'](handleError(_0x1a29d4,null));};exports[_0x9678('0x4b')]=function(_0x5edf6d,_0x4c3f67){return db[_0x9678('0x29')][_0x9678('0x48')]({'where':{'id':_0x5edf6d['params']['id']}})[_0x9678('0x22')](handleEntityNotFound(_0x4c3f67,null))[_0x9678('0x22')](removeEntity(_0x4c3f67,null))[_0x9678('0x43')](handleError(_0x4c3f67,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 5950762..fc1eb88 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 _0x50c3=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x35dc46,_0x4e2e39){var _0x4ee5a5=function(_0x6d2920){while(--_0x6d2920){_0x35dc46['push'](_0x35dc46['shift']());}};_0x4ee5a5(++_0x4e2e39);}(_0x50c3,0x81));var _0x350c=function(_0xc97177,_0xfa7c7c){_0xc97177=_0xc97177-0x0;var _0x131409=_0x50c3[_0xc97177];return _0x131409;};'use strict';var _=require(_0x350c('0x0'));var util=require(_0x350c('0x1'));var logger=require(_0x350c('0x2'))(_0x350c('0x3'));var moment=require(_0x350c('0x4'));var BPromise=require(_0x350c('0x5'));var rp=require(_0x350c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x350c('0x7'));var config=require(_0x350c('0x8'));var attributes=require(_0x350c('0x9'));module['exports']=function(_0x5eb46c,_0x54e655){return _0x5eb46c[_0x350c('0xa')](_0x350c('0xb'),attributes,{'tableName':_0x350c('0xc'),'paranoid':![],'indexes':[{'name':_0x350c('0xd'),'fields':[_0x350c('0xe'),_0x350c('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b2d=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x223049,_0x36d987){var _0x5e3729=function(_0x21cd70){while(--_0x21cd70){_0x223049['push'](_0x223049['shift']());}};_0x5e3729(++_0x36d987);}(_0x8b2d,0xe5));var _0xd8b2=function(_0x1cc211,_0x4856f1){_0x1cc211=_0x1cc211-0x0;var _0x5df05a=_0x8b2d[_0x1cc211];return _0x5df05a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd8b2('0x0'))('api');var moment=require(_0xd8b2('0x1'));var BPromise=require(_0xd8b2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8b2('0x3'));var rimraf=require(_0xd8b2('0x4'));var config=require('../../config/environment');var attributes=require(_0xd8b2('0x5'));module[_0xd8b2('0x6')]=function(_0x36eb23,_0x282a58){return _0x36eb23[_0xd8b2('0x7')](_0xd8b2('0x8'),attributes,{'tableName':_0xd8b2('0x9'),'paranoid':![],'indexes':[{'name':_0xd8b2('0xa'),'fields':[_0xd8b2('0xb'),_0xd8b2('0xc')],'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 1dfd5c0..a5309a0 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 _0x6f0d=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent'];(function(_0x521abb,_0x22a241){var _0x4bbb28=function(_0x4728d3){while(--_0x4728d3){_0x521abb['push'](_0x521abb['shift']());}};_0x4bbb28(++_0x22a241);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x149667,_0x5abb75){_0x149667=_0x149667-0x0;var _0x3cfea8=_0x6f0d[_0x149667];return _0x3cfea8;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('SalesforceField,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0x9ffd=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x4d0347,_0x443c17){var _0x14406e=function(_0x570822){while(--_0x570822){_0x4d0347['push'](_0x4d0347['shift']());}};_0x14406e(++_0x443c17);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x31fac9,_0x26ca76){_0x31fac9=_0x31fac9-0x0;var _0x529c3e=_0x9ffd[_0x31fac9];return _0x529c3e;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('SalesforceField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index c2148b7..39ed428 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 _0xe266=['../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','/:id/configurations','update','delete','destroy','exports','connect-timeout','Router'];(function(_0x49f9c5,_0x3c549e){var _0x43b265=function(_0x425ac7){while(--_0x425ac7){_0x49f9c5['push'](_0x49f9c5['shift']());}};_0x43b265(++_0x3c549e);}(_0xe266,0x174));var _0x6e26=function(_0x2ffdee,_0x42beea){_0x2ffdee=_0x2ffdee-0x0;var _0x5561b9=_0xe266[_0x2ffdee];return _0x5561b9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6e26('0x0'));var express=require('express');var router=express[_0x6e26('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6e26('0x2'));var controller=require(_0x6e26('0x3'));router[_0x6e26('0x4')]('/',auth[_0x6e26('0x5')](),controller[_0x6e26('0x6')]);router[_0x6e26('0x4')](_0x6e26('0x7'),auth[_0x6e26('0x5')](),controller[_0x6e26('0x8')]);router['get']('/:id/configurations',auth[_0x6e26('0x5')](),controller['getConfigurations']);router['get'](_0x6e26('0x9'),auth['isAuthenticated'](),controller[_0x6e26('0xa')]);router[_0x6e26('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6e26('0xc'),auth[_0x6e26('0x5')](),controller['addConfiguration']);router['put']('/:id',auth[_0x6e26('0x5')](),controller[_0x6e26('0xd')]);router[_0x6e26('0xe')]('/:id',auth[_0x6e26('0x5')](),controller[_0x6e26('0xf')]);module[_0x6e26('0x10')]=router; \ No newline at end of file +var _0xbeba=['get','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./intServicenowAccount.controller'];(function(_0x167833,_0x47f198){var _0x205bbb=function(_0x78d358){while(--_0x78d358){_0x167833['push'](_0x167833['shift']());}};_0x205bbb(++_0x47f198);}(_0xbeba,0xb6));var _0xabeb=function(_0x469f96,_0x50796c){_0x469f96=_0x469f96-0x0;var _0x12c7fd=_0xbeba[_0x469f96];return _0x12c7fd;};'use strict';var multer=require(_0xabeb('0x0'));var util=require(_0xabeb('0x1'));var path=require(_0xabeb('0x2'));var timeout=require('connect-timeout');var express=require(_0xabeb('0x3'));var router=express[_0xabeb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xabeb('0x5'));var config=require('../../config/environment');var controller=require(_0xabeb('0x6'));router[_0xabeb('0x7')]('/',auth[_0xabeb('0x8')](),controller['index']);router[_0xabeb('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xabeb('0x7')]('/:id/configurations',auth[_0xabeb('0x8')](),controller[_0xabeb('0x9')]);router[_0xabeb('0x7')](_0xabeb('0xa'),auth['isAuthenticated'](),controller[_0xabeb('0xb')]);router[_0xabeb('0xc')]('/',auth[_0xabeb('0x8')](),controller[_0xabeb('0xd')]);router[_0xabeb('0xc')](_0xabeb('0xe'),auth['isAuthenticated'](),controller[_0xabeb('0xf')]);router[_0xabeb('0x10')](_0xabeb('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xabeb('0x12')](_0xabeb('0x11'),auth['isAuthenticated'](),controller[_0xabeb('0x13')]);module[_0xabeb('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index c024494..8d392d7 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 _0x8939=['exports','STRING','username','remoteUri'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x8939,0x118));var _0x9893=function(_0x95e93c,_0x4a52db){_0x95e93c=_0x95e93c-0x0;var _0x15d87c=_0x8939[_0x95e93c];return _0x15d87c;};'use strict';var Sequelize=require('sequelize');module[_0x9893('0x0')]={'name':{'type':Sequelize[_0x9893('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9893('0x1')],'unique':_0x9893('0x2')},'password':{'type':Sequelize[_0x9893('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9893('0x1')],'unique':_0x9893('0x3')},'serverUrl':{'type':Sequelize[_0x9893('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xfc43=['STRING','username','remoteUri','sequelize','exports'];(function(_0x2b90dc,_0x10b832){var _0x4794a6=function(_0x3720ca){while(--_0x3720ca){_0x2b90dc['push'](_0x2b90dc['shift']());}};_0x4794a6(++_0x10b832);}(_0xfc43,0x1cf));var _0x3fc4=function(_0x7237c9,_0x39ad04){_0x7237c9=_0x7237c9-0x0;var _0x745594=_0xfc43[_0x7237c9];return _0x745594;};'use strict';var Sequelize=require(_0x3fc4('0x0'));module[_0x3fc4('0x1')]={'name':{'type':Sequelize[_0x3fc4('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3fc4('0x2')],'unique':_0x3fc4('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3fc4('0x4')},'serverUrl':{'type':Sequelize[_0x3fc4('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 9f84720..a79ba9c 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 _0x10f2=['type','VIRTUAL','options','count','includeAll','findAll','rows','params','keys','rawAttributes','length','include','create','body','update','find','getConfigurations','findOne','order','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','incident_state','severity','parent','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','business_stc','description','calendar_duration','notify','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','activity_due','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','category','username','password','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','remove','includes','forEach','label','push','all','assign','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','test','boolean','True','False','false','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ServicenowAccount','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','filter','merge'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x10f2,0x139));var _0x210f=function(_0xf4b05a,_0x301123){_0xf4b05a=_0xf4b05a-0x0;var _0x29812f=_0x10f2[_0xf4b05a];return _0x29812f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x210f('0x0'));var rimraf=require(_0x210f('0x1'));var zipdir=require(_0x210f('0x2'));var jsonpatch=require(_0x210f('0x3'));var rp=require(_0x210f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x210f('0x5'));var util=require(_0x210f('0x6'));var path=require(_0x210f('0x7'));var sox=require(_0x210f('0x8'));var csv=require(_0x210f('0x9'));var ejs=require(_0x210f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x210f('0xb'));var crypto=require('crypto');var jsforce=require(_0x210f('0xc'));var deskjs=require(_0x210f('0xd'));var toCsv=require(_0x210f('0x9'));var querystring=require(_0x210f('0xe'));var Papa=require(_0x210f('0xf'));var Redis=require(_0x210f('0x10'));var authService=require(_0x210f('0x11'));var qs=require(_0x210f('0x12'));var as=require(_0x210f('0x13'));var hardwareService=require(_0x210f('0x14'));var logger=require('../../config/logger')(_0x210f('0x15'));var utils=require(_0x210f('0x16'));var config=require(_0x210f('0x17'));var licenseUtil=require(_0x210f('0x18'));var db=require(_0x210f('0x19'))['db'];var integrations=require(_0x210f('0x1a'));var jayson=require(_0x210f('0x1b'));var client=jayson[_0x210f('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45e6b1,_0x310827,_0x44abdf,_0x2b86b2){return new BPromise(function(_0x42f7ba,_0x3769a8){var _0x457626=_0x2b86b2||client;return _0x457626[_0x210f('0x1d')](_0x45e6b1,_0x44abdf)['then'](function(_0x2eeb46){logger[_0x210f('0x1e')](_0x210f('0x1f'),_0x310827,_0x210f('0x20'));logger[_0x210f('0x21')](_0x210f('0x22'),_0x310827,_0x210f('0x20'),JSON['stringify'](_0x2eeb46));if(_0x2eeb46['error']){if(_0x2eeb46[_0x210f('0x23')][_0x210f('0x24')]===0x1f4){logger[_0x210f('0x23')](_0x210f('0x1f'),_0x310827,_0x2eeb46[_0x210f('0x23')][_0x210f('0x25')]);return _0x3769a8(_0x2eeb46[_0x210f('0x23')][_0x210f('0x25')]);}logger[_0x210f('0x23')](_0x210f('0x1f'),_0x310827,_0x2eeb46[_0x210f('0x23')][_0x210f('0x25')]);return _0x42f7ba(_0x2eeb46['error']['message']);}else{logger[_0x210f('0x1e')](_0x210f('0x1f'),_0x310827,'request\x20sent');_0x42f7ba(_0x2eeb46[_0x210f('0x26')][_0x210f('0x25')]);}})[_0x210f('0x27')](function(_0x3f71e5){logger[_0x210f('0x23')](_0x210f('0x1f'),_0x310827,_0x3f71e5);_0x3769a8(_0x3f71e5);});});}function respondWithStatusCode(_0x18bef4,_0x37c2d7){_0x37c2d7=_0x37c2d7||0xcc;return function(_0xb1df7){if(_0xb1df7){return _0x18bef4[_0x210f('0x28')](_0x37c2d7);}return _0x18bef4[_0x210f('0x29')](_0x37c2d7)['end']();};}function respondWithResult(_0x3bbf4a,_0x1c26f8){_0x1c26f8=_0x1c26f8||0xc8;return function(_0x1fc5f0){if(_0x1fc5f0){return _0x3bbf4a[_0x210f('0x29')](_0x1c26f8)[_0x210f('0x2a')](_0x1fc5f0);}};}function respondWithFilteredResult(_0x259392,_0x2fd143){return function(_0xec1602){if(_0xec1602){var _0x4d4459=_0xec1602['count'],_0x2a50a5=_0x2fd143[_0x210f('0x2b')],_0x46ca73=_0x2fd143[_0x210f('0x2b')]+_0x2fd143['limit'],_0x91c02f;if(_0x46ca73>=_0x4d4459){_0x46ca73=_0x4d4459;_0x91c02f=0xc8;}else{_0x91c02f=0xce;}_0x259392['status'](_0x91c02f);return _0x259392[_0x210f('0x2c')](_0x210f('0x2d'),_0x2a50a5+'-'+_0x46ca73+'/'+_0x4d4459)[_0x210f('0x2a')](_0xec1602);}return null;};}function patchUpdates(_0xca026e){return function(_0x27b259){try{jsonpatch[_0x210f('0x2e')](_0x27b259,_0xca026e,!![]);}catch(_0x372607){return BPromise[_0x210f('0x2f')](_0x372607);}return _0x27b259[_0x210f('0x30')]();};}function saveUpdates(_0x5ef419,_0x5d2ab3){return function(_0x4cca11){if(_0x4cca11){return _0x4cca11['update'](_0x5ef419)[_0x210f('0x31')](function(_0x4d78b2){return _0x4d78b2;});}return null;};}function removeEntity(_0x29ec9b,_0x3e8e91){return function(_0x5caa58){if(_0x5caa58){return _0x5caa58[_0x210f('0x32')]()[_0x210f('0x31')](function(){_0x29ec9b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x490c21,_0x2d2407){return function(_0x2743f4){if(!_0x2743f4){_0x490c21[_0x210f('0x28')](0x194);}return _0x2743f4;};}function handleError(_0x28458a,_0x267c6b){_0x267c6b=_0x267c6b||0x1f4;return function(_0x183a9f){logger[_0x210f('0x23')](_0x183a9f[_0x210f('0x33')]);if(_0x183a9f[_0x210f('0x34')]){delete _0x183a9f[_0x210f('0x34')];}_0x28458a['status'](_0x267c6b)[_0x210f('0x35')](_0x183a9f);};}exports[_0x210f('0x36')]=function(_0x1b5fc2,_0x3a7fcb){var _0x4cfbf2={},_0x88ac78={},_0xa6b6b8={'count':0x0,'rows':[]};var _0x596183=_[_0x210f('0x37')](db[_0x210f('0x38')]['rawAttributes'],function(_0x855648){return{'name':_0x855648['fieldName'],'type':_0x855648['type'][_0x210f('0x39')]};});_0x88ac78[_0x210f('0x3a')]=_[_0x210f('0x37')](_0x596183,_0x210f('0x34'));_0x88ac78[_0x210f('0x3b')]=_['keys'](_0x1b5fc2[_0x210f('0x3b')]);_0x88ac78[_0x210f('0x3c')]=_[_0x210f('0x3d')](_0x88ac78[_0x210f('0x3a')],_0x88ac78['query']);_0x4cfbf2[_0x210f('0x3e')]=_[_0x210f('0x3d')](_0x88ac78['model'],qs['fields'](_0x1b5fc2[_0x210f('0x3b')][_0x210f('0x3f')]));_0x4cfbf2['attributes']=_0x4cfbf2[_0x210f('0x3e')]['length']?_0x4cfbf2[_0x210f('0x3e')]:_0x88ac78[_0x210f('0x3a')];if(!_0x1b5fc2[_0x210f('0x3b')]['hasOwnProperty'](_0x210f('0x40'))){_0x4cfbf2['limit']=qs[_0x210f('0x41')](_0x1b5fc2[_0x210f('0x3b')][_0x210f('0x41')]);_0x4cfbf2[_0x210f('0x2b')]=qs['offset'](_0x1b5fc2[_0x210f('0x3b')][_0x210f('0x2b')]);}_0x4cfbf2['order']=qs[_0x210f('0x42')](_0x1b5fc2[_0x210f('0x3b')]['sort']);_0x4cfbf2[_0x210f('0x43')]=qs[_0x210f('0x3c')](_[_0x210f('0x44')](_0x1b5fc2[_0x210f('0x3b')],_0x88ac78[_0x210f('0x3c')]),_0x596183);if(_0x1b5fc2[_0x210f('0x3b')][_0x210f('0x45')]){_0x4cfbf2[_0x210f('0x43')]=_[_0x210f('0x46')](_0x4cfbf2['where'],{'$or':_[_0x210f('0x37')](_0x596183,function(_0x2f8b28){if(_0x2f8b28[_0x210f('0x47')]!==_0x210f('0x48')){var _0x2e4296={};_0x2e4296[_0x2f8b28['name']]={'$like':'%'+_0x1b5fc2[_0x210f('0x3b')][_0x210f('0x45')]+'%'};return _0x2e4296;}})});}_0x4cfbf2=_['merge']({},_0x4cfbf2,_0x1b5fc2[_0x210f('0x49')]);var _0x460a70={'where':_0x4cfbf2[_0x210f('0x43')]};return db[_0x210f('0x38')][_0x210f('0x4a')](_0x460a70)[_0x210f('0x31')](function(_0x3086b0){_0xa6b6b8[_0x210f('0x4a')]=_0x3086b0;if(_0x1b5fc2[_0x210f('0x3b')][_0x210f('0x4b')]){_0x4cfbf2['include']=[{'all':!![]}];}return db[_0x210f('0x38')][_0x210f('0x4c')](_0x4cfbf2);})[_0x210f('0x31')](function(_0x5798cf){_0xa6b6b8[_0x210f('0x4d')]=_0x5798cf;return _0xa6b6b8;})[_0x210f('0x31')](respondWithFilteredResult(_0x3a7fcb,_0x4cfbf2))['catch'](handleError(_0x3a7fcb,null));};exports['show']=function(_0x28a1b3,_0x158799){var _0x10325a={'raw':![],'where':{'id':_0x28a1b3[_0x210f('0x4e')]['id']}},_0x41eaa2={};_0x41eaa2[_0x210f('0x3a')]=_[_0x210f('0x4f')](db['ServicenowAccount'][_0x210f('0x50')]);_0x41eaa2[_0x210f('0x3b')]=_[_0x210f('0x4f')](_0x28a1b3['query']);_0x41eaa2[_0x210f('0x3c')]=_[_0x210f('0x3d')](_0x41eaa2[_0x210f('0x3a')],_0x41eaa2[_0x210f('0x3b')]);_0x10325a['attributes']=_[_0x210f('0x3d')](_0x41eaa2[_0x210f('0x3a')],qs[_0x210f('0x3f')](_0x28a1b3[_0x210f('0x3b')][_0x210f('0x3f')]));_0x10325a[_0x210f('0x3e')]=_0x10325a[_0x210f('0x3e')][_0x210f('0x51')]?_0x10325a[_0x210f('0x3e')]:_0x41eaa2['model'];if(_0x28a1b3[_0x210f('0x3b')][_0x210f('0x4b')]){_0x10325a[_0x210f('0x52')]=[{'all':!![]}];}_0x10325a=_['merge']({},_0x10325a,_0x28a1b3[_0x210f('0x49')]);return db['ServicenowAccount']['find'](_0x10325a)[_0x210f('0x31')](handleEntityNotFound(_0x158799,null))['then'](respondWithResult(_0x158799,null))[_0x210f('0x27')](handleError(_0x158799,null));};exports[_0x210f('0x53')]=function(_0x3c287b,_0x5c85be){return db[_0x210f('0x38')][_0x210f('0x53')](_0x3c287b[_0x210f('0x54')],{})[_0x210f('0x31')](respondWithResult(_0x5c85be,0xc9))[_0x210f('0x27')](handleError(_0x5c85be,null));};exports[_0x210f('0x55')]=function(_0x5f5a63,_0x56977d){if(_0x5f5a63[_0x210f('0x54')]['id']){delete _0x5f5a63[_0x210f('0x54')]['id'];}return db[_0x210f('0x38')][_0x210f('0x56')]({'where':{'id':_0x5f5a63['params']['id']}})[_0x210f('0x31')](handleEntityNotFound(_0x56977d,null))[_0x210f('0x31')](saveUpdates(_0x5f5a63[_0x210f('0x54')],null))[_0x210f('0x31')](respondWithResult(_0x56977d,null))[_0x210f('0x27')](handleError(_0x56977d,null));};exports[_0x210f('0x32')]=function(_0x1d4bd3,_0x305eec){return db[_0x210f('0x38')][_0x210f('0x56')]({'where':{'id':_0x1d4bd3[_0x210f('0x4e')]['id']}})[_0x210f('0x31')](handleEntityNotFound(_0x305eec,null))[_0x210f('0x31')](removeEntity(_0x305eec,null))[_0x210f('0x27')](handleError(_0x305eec,null));};exports[_0x210f('0x57')]=function(_0x3797cc,_0x51514f,_0x1fe69f){var _0x1f524f={};var _0x36a3f3={};var _0x33f217;var _0x2812ca;return db[_0x210f('0x38')][_0x210f('0x58')]({'where':{'id':_0x3797cc['params']['id']}})[_0x210f('0x31')](handleEntityNotFound(_0x51514f,null))[_0x210f('0x31')](function(_0x3ccbbc){if(_0x3ccbbc){_0x33f217=_0x3ccbbc;_0x36a3f3[_0x210f('0x3a')]=_[_0x210f('0x4f')](db['ServicenowConfiguration']['rawAttributes']);_0x36a3f3[_0x210f('0x3b')]=_[_0x210f('0x4f')](_0x3797cc[_0x210f('0x3b')]);_0x36a3f3[_0x210f('0x3c')]=_[_0x210f('0x3d')](_0x36a3f3[_0x210f('0x3a')],_0x36a3f3[_0x210f('0x3b')]);_0x1f524f[_0x210f('0x3e')]=_['intersection'](_0x36a3f3[_0x210f('0x3a')],qs[_0x210f('0x3f')](_0x3797cc[_0x210f('0x3b')][_0x210f('0x3f')]));_0x1f524f[_0x210f('0x3e')]=_0x1f524f[_0x210f('0x3e')]['length']?_0x1f524f[_0x210f('0x3e')]:_0x36a3f3[_0x210f('0x3a')];_0x1f524f[_0x210f('0x59')]=qs[_0x210f('0x42')](_0x3797cc[_0x210f('0x3b')][_0x210f('0x42')]);_0x1f524f[_0x210f('0x43')]=qs[_0x210f('0x3c')](_[_0x210f('0x44')](_0x3797cc[_0x210f('0x3b')],_0x36a3f3[_0x210f('0x3c')]));if(_0x3797cc[_0x210f('0x3b')]['filter']){_0x1f524f[_0x210f('0x43')]=_['merge'](_0x1f524f['where'],{'$or':_[_0x210f('0x37')](_0x1f524f[_0x210f('0x3e')],function(_0x10681b){var _0x1e858d={};_0x1e858d[_0x10681b]={'$like':'%'+_0x3797cc['query']['filter']+'%'};return _0x1e858d;})});}_0x1f524f=_[_0x210f('0x46')]({},_0x1f524f,_0x3797cc[_0x210f('0x49')]);return _0x33f217[_0x210f('0x57')](_0x1f524f);}})[_0x210f('0x31')](function(_0xc0b663){if(_0xc0b663){_0x2812ca=_0xc0b663[_0x210f('0x51')];if(!_0x3797cc[_0x210f('0x3b')][_0x210f('0x5a')]('nolimit')){_0x1f524f['limit']=qs['limit'](_0x3797cc[_0x210f('0x3b')][_0x210f('0x41')]);_0x1f524f['offset']=qs[_0x210f('0x2b')](_0x3797cc[_0x210f('0x3b')][_0x210f('0x2b')]);}return _0x33f217[_0x210f('0x57')](_0x1f524f);}})[_0x210f('0x31')](function(_0x12e307){if(_0x12e307){return _0x12e307?{'count':_0x2812ca,'rows':_0x12e307}:null;}})[_0x210f('0x31')](respondWithResult(_0x51514f,null))[_0x210f('0x27')](handleError(_0x51514f,null));};exports[_0x210f('0x5b')]=function(_0x21d8db,_0x35fb18,_0x13441a){if(_0x21d8db[_0x210f('0x54')]['id']){delete _0x21d8db[_0x210f('0x54')]['id'];}return db[_0x210f('0x38')][_0x210f('0x58')]({'where':{'id':_0x21d8db[_0x210f('0x4e')]['id']}})[_0x210f('0x31')](handleEntityNotFound(_0x35fb18,null))['then'](function(_0x35325f){if(_0x35325f){_0x21d8db[_0x210f('0x54')][_0x210f('0x5c')]=_0x35325f['id'];_0x21d8db[_0x210f('0x54')][_0x210f('0x5d')]=integrations['getSubjects'](_0x21d8db[_0x210f('0x54')][_0x210f('0x5e')],_0x21d8db[_0x210f('0x54')][_0x210f('0x47')]);_0x21d8db[_0x210f('0x54')][_0x210f('0x5f')]=integrations[_0x210f('0x60')](_0x21d8db[_0x210f('0x54')][_0x210f('0x5e')],_0x21d8db[_0x210f('0x54')][_0x210f('0x47')]);return db[_0x210f('0x61')]['create'](_0x21d8db[_0x210f('0x54')],{'include':[{'model':db[_0x210f('0x62')],'as':_0x210f('0x5d')},{'model':db['ServicenowField'],'as':_0x210f('0x5f')}]});}return null;})['then'](respondWithResult(_0x35fb18,null))[_0x210f('0x27')](handleError(_0x35fb18,null));};exports[_0x210f('0x63')]=function(_0x2db551,_0x49d314,_0x2f6b59){var _0x85935=[_0x210f('0x64'),_0x210f('0x65'),'knowledge',_0x210f('0x66'),_0x210f('0x67'),'notify',_0x210f('0x68'),_0x210f('0x69'),'category'];var _0x261960=[_0x210f('0x6a'),_0x210f('0x64'),'caused_by',_0x210f('0x6b'),_0x210f('0x6c'),_0x210f('0x6d'),'child_incidents',_0x210f('0x65'),_0x210f('0x6e'),_0x210f('0x6f'),_0x210f('0x70'),'sys_updated_by',_0x210f('0x71'),_0x210f('0x72'),_0x210f('0x73'),_0x210f('0x74'),'state',_0x210f('0x75'),'knowledge',_0x210f('0x59'),_0x210f('0x76'),_0x210f('0x77'),_0x210f('0x78'),_0x210f('0x79'),_0x210f('0x7a'),_0x210f('0x7b'),'work_notes_list','business_service',_0x210f('0x7c'),_0x210f('0x7d'),_0x210f('0x7e'),_0x210f('0x7f'),_0x210f('0x80'),'opened_at',_0x210f('0x81'),_0x210f('0x82'),'work_end',_0x210f('0x83'),_0x210f('0x84'),_0x210f('0x85'),_0x210f('0x86'),_0x210f('0x66'),_0x210f('0x87'),'short_description','close_code',_0x210f('0x88'),_0x210f('0x89'),_0x210f('0x8a'),'assignment_group',_0x210f('0x8b'),'additional_assignee_list',_0x210f('0x8c'),_0x210f('0x8d'),_0x210f('0x8e'),_0x210f('0x8f'),'close_notes',_0x210f('0x90'),_0x210f('0x91'),_0x210f('0x92'),_0x210f('0x93'),_0x210f('0x94'),'reopened_by',_0x210f('0x68'),_0x210f('0x95'),_0x210f('0x96'),_0x210f('0x97'),'reassignment_count',_0x210f('0x98'),'assigned_to',_0x210f('0x69'),_0x210f('0x99'),'sla_due',_0x210f('0x9a'),_0x210f('0x9b'),_0x210f('0x9c'),_0x210f('0x9d'),_0x210f('0x9e'),_0x210f('0x9f'),_0x210f('0xa0'),_0x210f('0xa1'),'correlation_id',_0x210f('0xa2'),_0x210f('0xa3')];var _0x5e8c66='';var _0x284026='';var _0x54422b=[];var _0x5a5a29='';var _0x27f487='';var _0x311719=[];var _0x5bc3e1='';var _0x5015bd='';var _0x497c51={};var _0x3cf7f4='';return db[_0x210f('0x38')][_0x210f('0x58')]({'where':{'id':_0x2db551[_0x210f('0x4e')]['id']},'attributes':['id',_0x210f('0xa4'),_0x210f('0xa5'),'email','remoteUri',_0x210f('0xa6')]})['then'](handleEntityNotFound(_0x49d314,null))[_0x210f('0x31')](function(_0xbf0707){if(_0xbf0707){_0x3cf7f4=_0xbf0707['remoteUri'];var _0x52129e=_0x3cf7f4[_0x210f('0xa7')](-0x1);if(_0x52129e==='/'){_0x3cf7f4=_0x3cf7f4[_0x210f('0xa8')](0x0,_0x3cf7f4['lastIndexOf'](_0x52129e));}_0x5015bd=util[_0x210f('0xa9')](_0x210f('0xaa'),_0x3cf7f4);_0x5bc3e1=util[_0x210f('0xa9')]('%s/api/now/table/',_0x3cf7f4);_0x497c51={'user':_0xbf0707[_0x210f('0xa4')],'pass':_0xbf0707[_0x210f('0xa5')]};var _0x353815={'method':_0x210f('0xab'),'uri':_0x5015bd+_0x210f('0xac'),'auth':_0x497c51,'json':!![]};return rp(_0x353815);}})[_0x210f('0x31')](function(_0x3ab6bd){if(_0x3ab6bd[_0x210f('0x26')][_0x210f('0x51')]>0x0){_0x5e8c66=_0x3ab6bd['result'];}console[_0x210f('0xad')](_0x210f('0xae'),_0x5e8c66);_0x311719=[];_0x284026=Object['assign']([],_0x5e8c66);_[_0x210f('0xaf')](_0x284026,function(_0x2375b1){return!_0x85935[_0x210f('0xb0')](_0x2375b1['name']);});_0x284026[_0x210f('0xb1')](function(_0x347565){var _0x2e7a1e=createFieldObject(_0x5bc3e1,_0x497c51,_0x347565['internalType'],_0x347565[_0x210f('0x34')],_0x347565[_0x210f('0xb2')],![]);_0x311719[_0x210f('0xb3')](_0x2e7a1e);});return Promise[_0x210f('0xb4')](_0x311719);})['then'](function(_0x33e7ee){_0x54422b=_0x33e7ee;_0x5a5a29=Object[_0x210f('0xb5')]([],_0x5e8c66);console[_0x210f('0xad')]('TCL:\x20_object',_0x5e8c66);_[_0x210f('0xaf')](_0x5a5a29,function(_0x3ce408){return _0x261960[_0x210f('0xb0')](_0x3ce408['name']);});console[_0x210f('0xad')](_0x210f('0xb6'),_0x5a5a29);_0x311719=[];_0x5a5a29[_0x210f('0xb1')](function(_0x533c4f){var _0x3b5bc3=createFieldObject(_0x5bc3e1,_0x497c51,_0x533c4f[_0x210f('0xb7')],_0x533c4f[_0x210f('0x34')],_0x533c4f[_0x210f('0xb2')],!![]);_0x311719['push'](_0x3b5bc3);});return Promise['all'](_0x311719);})[_0x210f('0x31')](function(_0x3f25ce){_0x27f487=_0x3f25ce;var _0x35a4e6=_0x54422b[_0x210f('0xb8')](_0x27f487);return{'count':_0x35a4e6['length'],'rows':_0x35a4e6};})['then'](respondWithResult(_0x49d314,null))['catch'](function(_0xd1117){console[_0x210f('0xad')](_0x210f('0xb9')+_0xd1117);var _0x3bfc9b=_0x2db551[_0x210f('0x3b')][_0x210f('0xba')]?0x1f4:_0xd1117['statusCode']||0x1f4;logger[_0x210f('0x23')](_0xd1117[_0x210f('0x33')]);delete _0xd1117[_0x210f('0x34')];if(_0x3bfc9b===0x191){_0x3bfc9b=0x190;}_0x49d314[_0x210f('0x29')](_0x3bfc9b)['send'](_0x2db551['query'][_0x210f('0xba')]?{'message':'Wrong\x20credentials','statusCode':_0xd1117['statusCode']}:_0xd1117);});};function createFieldObject(_0x21b968,_0x5521c5,_0x494755,_0x385c5d,_0x4b34ec,_0x5e6e32){return new Promise(function(_0x531096,_0x5d2bc6){var _0x2b1b6d={'id':_0x385c5d,'name':_0x4b34ec,'custom':_0x5e6e32};if(_0x494755===_0x210f('0xbb')){_0x2b1b6d[_0x210f('0x49')]=[{'name':_0x210f('0xbc'),'value':'true'},{'name':_0x210f('0xbd'),'value':_0x210f('0xbe')}];_0x531096(_0x2b1b6d);}else{var _0x35c25d={'method':_0x210f('0xab'),'uri':_0x21b968+'sys_choice?sysparm_query=name=incident^element='+_0x385c5d,'auth':_0x5521c5,'json':!![]};return rp(_0x35c25d)[_0x210f('0x31')](function(_0x5db0cb){var _0x2d1de6=[];if(_0x5db0cb[_0x210f('0x26')]['length']>0x0){_0x5db0cb[_0x210f('0x26')]['forEach'](function(_0x27263c){if(_0x27263c[_0x210f('0xbf')]===_0x210f('0xbe')){var _0x2cff33={'name':_0x27263c[_0x210f('0xb2')],'value':_0x27263c['value']};_0x2d1de6[_0x210f('0xb3')](_0x2cff33);}});}_0x2b1b6d[_0x210f('0x49')]=_0x2d1de6;if(_0x2b1b6d['options'][_0x210f('0x51')]>0x0){_0x531096(_0x2b1b6d);}else{if(_0x5e6e32==![]){_0x531096();}else{_0x531096(_0x2b1b6d);}}});}});} \ No newline at end of file +var _0x2758=['merge','options','count','includeAll','include','rows','show','find','create','body','destroy','ServicenowConfiguration','order','hasOwnProperty','nolimit','getConfigurations','addConfiguration','findOne','params','getSubjects','Descriptions','getDescriptions','channel','Subjects','getFields','made_sla','subcategory','close_code','notify','incident_state','severity','category','parent','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','work_end','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','log','includes','forEach','internalType','push','all','assign','TCL:\x20_object','remove','label','test','statusCode','True','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','message','info','ServicenowAccount,\x20%s,\x20%s','result','catch','status','end','json','offset','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','map','ServicenowAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','limit','sort','where','pick','VIRTUAL','filter'];(function(_0xe3c2d,_0xa2b2cf){var _0x3c7df0=function(_0x3b0882){while(--_0x3b0882){_0xe3c2d['push'](_0xe3c2d['shift']());}};_0x3c7df0(++_0xa2b2cf);}(_0x2758,0x74));var _0x8275=function(_0x2be719,_0x351547){_0x2be719=_0x2be719-0x0;var _0x1355db=_0x2758[_0x2be719];return _0x1355db;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8275('0x0'));var rimraf=require(_0x8275('0x1'));var zipdir=require(_0x8275('0x2'));var jsonpatch=require(_0x8275('0x3'));var rp=require('request-promise');var moment=require(_0x8275('0x4'));var BPromise=require(_0x8275('0x5'));var Mustache=require(_0x8275('0x6'));var util=require(_0x8275('0x7'));var path=require(_0x8275('0x8'));var sox=require('sox');var csv=require(_0x8275('0x9'));var ejs=require(_0x8275('0xa'));var fs=require('fs');var _=require(_0x8275('0xb'));var squel=require(_0x8275('0xc'));var crypto=require('crypto');var jsforce=require(_0x8275('0xd'));var deskjs=require(_0x8275('0xe'));var toCsv=require(_0x8275('0x9'));var querystring=require(_0x8275('0xf'));var Papa=require('papaparse');var Redis=require(_0x8275('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8275('0x11'));var as=require(_0x8275('0x12'));var hardwareService=require(_0x8275('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8275('0x14'));var config=require(_0x8275('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x8275('0x16'));var jayson=require(_0x8275('0x17'));var client=jayson[_0x8275('0x18')][_0x8275('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x57ed1d,_0x3ce7c9,_0x59839b,_0xca8581){return new BPromise(function(_0x46f5e8,_0x23ee6f){var _0x112832=_0xca8581||client;return _0x112832[_0x8275('0x1a')](_0x57ed1d,_0x59839b)[_0x8275('0x1b')](function(_0x32bc65){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x3ce7c9,_0x8275('0x1c'));logger[_0x8275('0x1d')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3ce7c9,_0x8275('0x1c'),JSON[_0x8275('0x1e')](_0x32bc65));if(_0x32bc65[_0x8275('0x1f')]){if(_0x32bc65['error']['code']===0x1f4){logger[_0x8275('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0x3ce7c9,_0x32bc65[_0x8275('0x1f')][_0x8275('0x20')]);return _0x23ee6f(_0x32bc65['error'][_0x8275('0x20')]);}logger[_0x8275('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0x3ce7c9,_0x32bc65[_0x8275('0x1f')]['message']);return _0x46f5e8(_0x32bc65[_0x8275('0x1f')]['message']);}else{logger[_0x8275('0x21')](_0x8275('0x22'),_0x3ce7c9,_0x8275('0x1c'));_0x46f5e8(_0x32bc65[_0x8275('0x23')]['message']);}})[_0x8275('0x24')](function(_0xd45fde){logger[_0x8275('0x1f')](_0x8275('0x22'),_0x3ce7c9,_0xd45fde);_0x23ee6f(_0xd45fde);});});}function respondWithStatusCode(_0x19e28e,_0x35ea41){_0x35ea41=_0x35ea41||0xcc;return function(_0x573078){if(_0x573078){return _0x19e28e['sendStatus'](_0x35ea41);}return _0x19e28e[_0x8275('0x25')](_0x35ea41)[_0x8275('0x26')]();};}function respondWithResult(_0x115c2e,_0x11dc47){_0x11dc47=_0x11dc47||0xc8;return function(_0x52e3fe){if(_0x52e3fe){return _0x115c2e[_0x8275('0x25')](_0x11dc47)[_0x8275('0x27')](_0x52e3fe);}};}function respondWithFilteredResult(_0x547b1d,_0x135b9b){return function(_0x4c3096){if(_0x4c3096){var _0x19cebe=_0x4c3096['count'],_0x33f20a=_0x135b9b[_0x8275('0x28')],_0x5a25b7=_0x135b9b[_0x8275('0x28')]+_0x135b9b['limit'],_0x54fe47;if(_0x5a25b7>=_0x19cebe){_0x5a25b7=_0x19cebe;_0x54fe47=0xc8;}else{_0x54fe47=0xce;}_0x547b1d[_0x8275('0x25')](_0x54fe47);return _0x547b1d[_0x8275('0x29')](_0x8275('0x2a'),_0x33f20a+'-'+_0x5a25b7+'/'+_0x19cebe)[_0x8275('0x27')](_0x4c3096);}return null;};}function patchUpdates(_0x41cc98){return function(_0x264b88){try{jsonpatch[_0x8275('0x2b')](_0x264b88,_0x41cc98,!![]);}catch(_0x1fd619){return BPromise[_0x8275('0x2c')](_0x1fd619);}return _0x264b88[_0x8275('0x2d')]();};}function saveUpdates(_0x4f1168,_0x489ba7){return function(_0x2aca21){if(_0x2aca21){return _0x2aca21[_0x8275('0x2e')](_0x4f1168)['then'](function(_0x6f146){return _0x6f146;});}return null;};}function removeEntity(_0x63f9ec,_0x3285f2){return function(_0x465f8a){if(_0x465f8a){return _0x465f8a['destroy']()[_0x8275('0x1b')](function(){_0x63f9ec[_0x8275('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x483e37,_0x499f28){return function(_0x1aedd0){if(!_0x1aedd0){_0x483e37[_0x8275('0x2f')](0x194);}return _0x1aedd0;};}function handleError(_0x2048f9,_0x1d5f48){_0x1d5f48=_0x1d5f48||0x1f4;return function(_0x505469){logger['error'](_0x505469[_0x8275('0x30')]);if(_0x505469[_0x8275('0x31')]){delete _0x505469[_0x8275('0x31')];}_0x2048f9[_0x8275('0x25')](_0x1d5f48)[_0x8275('0x32')](_0x505469);};}exports['index']=function(_0x402b48,_0x49287c){var _0x1dd0ac={},_0x5be51e={},_0xc8fee9={'count':0x0,'rows':[]};var _0x3b5bdf=_[_0x8275('0x33')](db[_0x8275('0x34')][_0x8275('0x35')],function(_0x55f99f){return{'name':_0x55f99f['fieldName'],'type':_0x55f99f[_0x8275('0x36')]['key']};});_0x5be51e[_0x8275('0x37')]=_[_0x8275('0x33')](_0x3b5bdf,_0x8275('0x31'));_0x5be51e[_0x8275('0x38')]=_[_0x8275('0x39')](_0x402b48[_0x8275('0x38')]);_0x5be51e[_0x8275('0x3a')]=_['intersection'](_0x5be51e[_0x8275('0x37')],_0x5be51e[_0x8275('0x38')]);_0x1dd0ac['attributes']=_[_0x8275('0x3b')](_0x5be51e[_0x8275('0x37')],qs[_0x8275('0x3c')](_0x402b48[_0x8275('0x38')][_0x8275('0x3c')]));_0x1dd0ac[_0x8275('0x3d')]=_0x1dd0ac[_0x8275('0x3d')][_0x8275('0x3e')]?_0x1dd0ac['attributes']:_0x5be51e['model'];if(!_0x402b48['query']['hasOwnProperty']('nolimit')){_0x1dd0ac[_0x8275('0x3f')]=qs[_0x8275('0x3f')](_0x402b48['query'][_0x8275('0x3f')]);_0x1dd0ac['offset']=qs[_0x8275('0x28')](_0x402b48[_0x8275('0x38')][_0x8275('0x28')]);}_0x1dd0ac['order']=qs[_0x8275('0x40')](_0x402b48['query'][_0x8275('0x40')]);_0x1dd0ac[_0x8275('0x41')]=qs['filters'](_[_0x8275('0x42')](_0x402b48[_0x8275('0x38')],_0x5be51e['filters']),_0x3b5bdf);if(_0x402b48[_0x8275('0x38')]['filter']){_0x1dd0ac[_0x8275('0x41')]=_['merge'](_0x1dd0ac[_0x8275('0x41')],{'$or':_[_0x8275('0x33')](_0x3b5bdf,function(_0x27471a){if(_0x27471a[_0x8275('0x36')]!==_0x8275('0x43')){var _0x4191bd={};_0x4191bd[_0x27471a[_0x8275('0x31')]]={'$like':'%'+_0x402b48[_0x8275('0x38')][_0x8275('0x44')]+'%'};return _0x4191bd;}})});}_0x1dd0ac=_[_0x8275('0x45')]({},_0x1dd0ac,_0x402b48[_0x8275('0x46')]);var _0x186651={'where':_0x1dd0ac[_0x8275('0x41')]};return db['ServicenowAccount'][_0x8275('0x47')](_0x186651)[_0x8275('0x1b')](function(_0x567e50){_0xc8fee9[_0x8275('0x47')]=_0x567e50;if(_0x402b48['query'][_0x8275('0x48')]){_0x1dd0ac[_0x8275('0x49')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x1dd0ac);})[_0x8275('0x1b')](function(_0x19afaf){_0xc8fee9[_0x8275('0x4a')]=_0x19afaf;return _0xc8fee9;})[_0x8275('0x1b')](respondWithFilteredResult(_0x49287c,_0x1dd0ac))[_0x8275('0x24')](handleError(_0x49287c,null));};exports[_0x8275('0x4b')]=function(_0x23a8c8,_0xb19a3b){var _0x2229fc={'raw':![],'where':{'id':_0x23a8c8['params']['id']}},_0x47d626={};_0x47d626[_0x8275('0x37')]=_[_0x8275('0x39')](db[_0x8275('0x34')][_0x8275('0x35')]);_0x47d626['query']=_[_0x8275('0x39')](_0x23a8c8[_0x8275('0x38')]);_0x47d626[_0x8275('0x3a')]=_[_0x8275('0x3b')](_0x47d626[_0x8275('0x37')],_0x47d626[_0x8275('0x38')]);_0x2229fc['attributes']=_[_0x8275('0x3b')](_0x47d626[_0x8275('0x37')],qs['fields'](_0x23a8c8['query'][_0x8275('0x3c')]));_0x2229fc[_0x8275('0x3d')]=_0x2229fc[_0x8275('0x3d')][_0x8275('0x3e')]?_0x2229fc[_0x8275('0x3d')]:_0x47d626[_0x8275('0x37')];if(_0x23a8c8['query'][_0x8275('0x48')]){_0x2229fc[_0x8275('0x49')]=[{'all':!![]}];}_0x2229fc=_['merge']({},_0x2229fc,_0x23a8c8[_0x8275('0x46')]);return db[_0x8275('0x34')][_0x8275('0x4c')](_0x2229fc)[_0x8275('0x1b')](handleEntityNotFound(_0xb19a3b,null))[_0x8275('0x1b')](respondWithResult(_0xb19a3b,null))['catch'](handleError(_0xb19a3b,null));};exports['create']=function(_0x10cf64,_0x12e0fd){return db[_0x8275('0x34')][_0x8275('0x4d')](_0x10cf64[_0x8275('0x4e')],{})[_0x8275('0x1b')](respondWithResult(_0x12e0fd,0xc9))[_0x8275('0x24')](handleError(_0x12e0fd,null));};exports['update']=function(_0x84c1cb,_0x5b90b0){if(_0x84c1cb[_0x8275('0x4e')]['id']){delete _0x84c1cb[_0x8275('0x4e')]['id'];}return db[_0x8275('0x34')][_0x8275('0x4c')]({'where':{'id':_0x84c1cb['params']['id']}})[_0x8275('0x1b')](handleEntityNotFound(_0x5b90b0,null))[_0x8275('0x1b')](saveUpdates(_0x84c1cb[_0x8275('0x4e')],null))[_0x8275('0x1b')](respondWithResult(_0x5b90b0,null))[_0x8275('0x24')](handleError(_0x5b90b0,null));};exports[_0x8275('0x4f')]=function(_0xd69f63,_0x55231a){return db[_0x8275('0x34')][_0x8275('0x4c')]({'where':{'id':_0xd69f63['params']['id']}})['then'](handleEntityNotFound(_0x55231a,null))[_0x8275('0x1b')](removeEntity(_0x55231a,null))['catch'](handleError(_0x55231a,null));};exports['getConfigurations']=function(_0x4a2b68,_0x53d55c,_0xce9882){var _0x54b4bc={};var _0x36822d={};var _0x3b2121;var _0x26fd44;return db[_0x8275('0x34')]['findOne']({'where':{'id':_0x4a2b68['params']['id']}})[_0x8275('0x1b')](handleEntityNotFound(_0x53d55c,null))[_0x8275('0x1b')](function(_0x56dd08){if(_0x56dd08){_0x3b2121=_0x56dd08;_0x36822d[_0x8275('0x37')]=_[_0x8275('0x39')](db[_0x8275('0x50')][_0x8275('0x35')]);_0x36822d[_0x8275('0x38')]=_[_0x8275('0x39')](_0x4a2b68[_0x8275('0x38')]);_0x36822d[_0x8275('0x3a')]=_[_0x8275('0x3b')](_0x36822d[_0x8275('0x37')],_0x36822d[_0x8275('0x38')]);_0x54b4bc['attributes']=_[_0x8275('0x3b')](_0x36822d[_0x8275('0x37')],qs[_0x8275('0x3c')](_0x4a2b68[_0x8275('0x38')][_0x8275('0x3c')]));_0x54b4bc[_0x8275('0x3d')]=_0x54b4bc[_0x8275('0x3d')]['length']?_0x54b4bc[_0x8275('0x3d')]:_0x36822d[_0x8275('0x37')];_0x54b4bc[_0x8275('0x51')]=qs[_0x8275('0x40')](_0x4a2b68[_0x8275('0x38')][_0x8275('0x40')]);_0x54b4bc[_0x8275('0x41')]=qs[_0x8275('0x3a')](_['pick'](_0x4a2b68['query'],_0x36822d[_0x8275('0x3a')]));if(_0x4a2b68['query'][_0x8275('0x44')]){_0x54b4bc[_0x8275('0x41')]=_[_0x8275('0x45')](_0x54b4bc[_0x8275('0x41')],{'$or':_['map'](_0x54b4bc[_0x8275('0x3d')],function(_0x4a53ae){var _0x4be038={};_0x4be038[_0x4a53ae]={'$like':'%'+_0x4a2b68['query'][_0x8275('0x44')]+'%'};return _0x4be038;})});}_0x54b4bc=_[_0x8275('0x45')]({},_0x54b4bc,_0x4a2b68[_0x8275('0x46')]);return _0x3b2121['getConfigurations'](_0x54b4bc);}})[_0x8275('0x1b')](function(_0x3bb17b){if(_0x3bb17b){_0x26fd44=_0x3bb17b['length'];if(!_0x4a2b68[_0x8275('0x38')][_0x8275('0x52')](_0x8275('0x53'))){_0x54b4bc[_0x8275('0x3f')]=qs['limit'](_0x4a2b68[_0x8275('0x38')][_0x8275('0x3f')]);_0x54b4bc['offset']=qs['offset'](_0x4a2b68[_0x8275('0x38')]['offset']);}return _0x3b2121[_0x8275('0x54')](_0x54b4bc);}})[_0x8275('0x1b')](function(_0x22d430){if(_0x22d430){return _0x22d430?{'count':_0x26fd44,'rows':_0x22d430}:null;}})['then'](respondWithResult(_0x53d55c,null))[_0x8275('0x24')](handleError(_0x53d55c,null));};exports[_0x8275('0x55')]=function(_0x583230,_0x2b6cb7,_0x40290c){if(_0x583230['body']['id']){delete _0x583230['body']['id'];}return db[_0x8275('0x34')][_0x8275('0x56')]({'where':{'id':_0x583230[_0x8275('0x57')]['id']}})[_0x8275('0x1b')](handleEntityNotFound(_0x2b6cb7,null))[_0x8275('0x1b')](function(_0x5ddef9){if(_0x5ddef9){_0x583230[_0x8275('0x4e')]['AccountId']=_0x5ddef9['id'];_0x583230[_0x8275('0x4e')]['Subjects']=integrations[_0x8275('0x58')](_0x583230['body']['channel'],_0x583230[_0x8275('0x4e')]['type']);_0x583230[_0x8275('0x4e')][_0x8275('0x59')]=integrations[_0x8275('0x5a')](_0x583230[_0x8275('0x4e')][_0x8275('0x5b')],_0x583230[_0x8275('0x4e')][_0x8275('0x36')]);return db[_0x8275('0x50')][_0x8275('0x4d')](_0x583230['body'],{'include':[{'model':db['ServicenowField'],'as':_0x8275('0x5c')},{'model':db['ServicenowField'],'as':_0x8275('0x59')}]});}return null;})[_0x8275('0x1b')](respondWithResult(_0x2b6cb7,null))[_0x8275('0x24')](handleError(_0x2b6cb7,null));};exports[_0x8275('0x5d')]=function(_0x143956,_0x30db07,_0x1349b1){var _0x3ec58e=[_0x8275('0x5e'),'hold_reason','knowledge',_0x8275('0x5f'),_0x8275('0x60'),_0x8275('0x61'),_0x8275('0x62'),_0x8275('0x63'),_0x8275('0x64')];var _0x5311bd=[_0x8275('0x65'),_0x8275('0x5e'),'caused_by','watch_list',_0x8275('0x66'),_0x8275('0x67'),_0x8275('0x68'),_0x8275('0x69'),_0x8275('0x6a'),_0x8275('0x6b'),_0x8275('0x6c'),_0x8275('0x6d'),'opened_by',_0x8275('0x6e'),_0x8275('0x6f'),_0x8275('0x70'),_0x8275('0x71'),'sys_created_by',_0x8275('0x72'),_0x8275('0x51'),_0x8275('0x73'),_0x8275('0x74'),_0x8275('0x75'),_0x8275('0x76'),_0x8275('0x77'),_0x8275('0x78'),_0x8275('0x79'),'business_service','priority',_0x8275('0x7a'),_0x8275('0x7b'),'time_worked',_0x8275('0x7c'),_0x8275('0x7d'),_0x8275('0x7e'),_0x8275('0x7f'),_0x8275('0x80'),'reopened_time','resolved_at',_0x8275('0x81'),_0x8275('0x82'),'subcategory','work_notes',_0x8275('0x83'),_0x8275('0x60'),_0x8275('0x84'),_0x8275('0x85'),_0x8275('0x86'),'assignment_group',_0x8275('0x87'),_0x8275('0x88'),_0x8275('0x89'),_0x8275('0x8a'),'notify',_0x8275('0x8b'),'close_notes','closed_by',_0x8275('0x8c'),_0x8275('0x8d'),_0x8275('0x8e'),'contact_type',_0x8275('0x8f'),_0x8275('0x62'),_0x8275('0x90'),_0x8275('0x91'),_0x8275('0x92'),'reassignment_count','activity_due',_0x8275('0x93'),'severity',_0x8275('0x94'),_0x8275('0x95'),_0x8275('0x96'),_0x8275('0x97'),'due_date',_0x8275('0x98'),_0x8275('0x99'),_0x8275('0x9a'),'escalation',_0x8275('0x9b'),_0x8275('0x9c'),_0x8275('0x9d'),_0x8275('0x64')];var _0x4d7607='';var _0x3bb2f3='';var _0x4afe79=[];var _0x5ec0ab='';var _0x1045e0='';var _0x2b2411=[];var _0x5b2b2e='';var _0x35a8a7='';var _0x536676={};var _0x2b78cf='';return db[_0x8275('0x34')]['findOne']({'where':{'id':_0x143956[_0x8275('0x57')]['id']},'attributes':['id',_0x8275('0x9e'),_0x8275('0x9f'),'email','remoteUri',_0x8275('0xa0')]})['then'](handleEntityNotFound(_0x30db07,null))['then'](function(_0x10a85c){if(_0x10a85c){_0x2b78cf=_0x10a85c['remoteUri'];var _0x392d9a=_0x2b78cf[_0x8275('0xa1')](-0x1);if(_0x392d9a==='/'){_0x2b78cf=_0x2b78cf[_0x8275('0xa2')](0x0,_0x2b78cf[_0x8275('0xa3')](_0x392d9a));}_0x35a8a7=util[_0x8275('0xa4')](_0x8275('0xa5'),_0x2b78cf);_0x5b2b2e=util[_0x8275('0xa4')](_0x8275('0xa6'),_0x2b78cf);_0x536676={'user':_0x10a85c['username'],'pass':_0x10a85c[_0x8275('0x9f')]};var _0x5bff83={'method':'GET','uri':_0x35a8a7+'incident?sysparm_display_value=all','auth':_0x536676,'json':!![]};return rp(_0x5bff83);}})[_0x8275('0x1b')](function(_0x2365ee){if(_0x2365ee['result'][_0x8275('0x3e')]>0x0){_0x4d7607=_0x2365ee[_0x8275('0x23')];}console[_0x8275('0xa7')]('incident\x20table\x20objects',_0x4d7607);_0x2b2411=[];_0x3bb2f3=Object['assign']([],_0x4d7607);_['remove'](_0x3bb2f3,function(_0x1c3fcc){return!_0x3ec58e[_0x8275('0xa8')](_0x1c3fcc[_0x8275('0x31')]);});_0x3bb2f3[_0x8275('0xa9')](function(_0x525902){var _0x564f66=createFieldObject(_0x5b2b2e,_0x536676,_0x525902[_0x8275('0xaa')],_0x525902[_0x8275('0x31')],_0x525902['label'],![]);_0x2b2411[_0x8275('0xab')](_0x564f66);});return Promise[_0x8275('0xac')](_0x2b2411);})[_0x8275('0x1b')](function(_0x3c223f){_0x4afe79=_0x3c223f;_0x5ec0ab=Object[_0x8275('0xad')]([],_0x4d7607);console[_0x8275('0xa7')](_0x8275('0xae'),_0x4d7607);_[_0x8275('0xaf')](_0x5ec0ab,function(_0x12cd71){return _0x5311bd['includes'](_0x12cd71['name']);});console[_0x8275('0xa7')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x5ec0ab);_0x2b2411=[];_0x5ec0ab[_0x8275('0xa9')](function(_0x12e388){var _0x14e805=createFieldObject(_0x5b2b2e,_0x536676,_0x12e388[_0x8275('0xaa')],_0x12e388[_0x8275('0x31')],_0x12e388[_0x8275('0xb0')],!![]);_0x2b2411[_0x8275('0xab')](_0x14e805);});return Promise[_0x8275('0xac')](_0x2b2411);})['then'](function(_0x2b3717){_0x1045e0=_0x2b3717;var _0x2e5320=_0x4afe79['concat'](_0x1045e0);return{'count':_0x2e5320['length'],'rows':_0x2e5320};})[_0x8275('0x1b')](respondWithResult(_0x30db07,null))[_0x8275('0x24')](function(_0xe2653){console[_0x8275('0xa7')]('ServiceNow\x20error:\x20'+_0xe2653);var _0x3746cd=_0x143956['query'][_0x8275('0xb1')]?0x1f4:_0xe2653[_0x8275('0xb2')]||0x1f4;logger[_0x8275('0x1f')](_0xe2653[_0x8275('0x30')]);delete _0xe2653[_0x8275('0x31')];if(_0x3746cd===0x191){_0x3746cd=0x190;}_0x30db07[_0x8275('0x25')](_0x3746cd)['send'](_0x143956[_0x8275('0x38')][_0x8275('0xb1')]?{'message':'Wrong\x20credentials','statusCode':_0xe2653[_0x8275('0xb2')]}:_0xe2653);});};function createFieldObject(_0xfecc2f,_0x35b29c,_0x126369,_0x4bc8b2,_0x1b4311,_0x3dc56a){return new Promise(function(_0x59569d,_0x332e16){var _0x13a5f1={'id':_0x4bc8b2,'name':_0x1b4311,'custom':_0x3dc56a};if(_0x126369==='boolean'){_0x13a5f1[_0x8275('0x46')]=[{'name':_0x8275('0xb3'),'value':'true'},{'name':'False','value':_0x8275('0xb4')}];_0x59569d(_0x13a5f1);}else{var _0x14fd2a={'method':_0x8275('0xb5'),'uri':_0xfecc2f+_0x8275('0xb6')+_0x4bc8b2,'auth':_0x35b29c,'json':!![]};return rp(_0x14fd2a)[_0x8275('0x1b')](function(_0x206105){var _0x283b2c=[];if(_0x206105[_0x8275('0x23')][_0x8275('0x3e')]>0x0){_0x206105['result'][_0x8275('0xa9')](function(_0x1d88ec){if(_0x1d88ec[_0x8275('0xb7')]===_0x8275('0xb4')){var _0x365b88={'name':_0x1d88ec[_0x8275('0xb0')],'value':_0x1d88ec[_0x8275('0xb8')]};_0x283b2c[_0x8275('0xab')](_0x365b88);}});}_0x13a5f1['options']=_0x283b2c;if(_0x13a5f1[_0x8275('0x46')][_0x8275('0x3e')]>0x0){_0x59569d(_0x13a5f1);}else{if(_0x3dc56a==![]){_0x59569d();}else{_0x59569d(_0x13a5f1);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 4fc0772..8004b8f 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 _0xeec6=['ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define'];(function(_0x3c3ca9,_0x5cf06d){var _0x33c985=function(_0x28e2ff){while(--_0x28e2ff){_0x3c3ca9['push'](_0x3c3ca9['shift']());}};_0x33c985(++_0x5cf06d);}(_0xeec6,0x1c2));var _0x6eec=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xeec6[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var logger=require(_0x6eec('0x2'))(_0x6eec('0x3'));var moment=require('moment');var BPromise=require(_0x6eec('0x4'));var rp=require(_0x6eec('0x5'));var fs=require('fs');var path=require(_0x6eec('0x6'));var rimraf=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var attributes=require(_0x6eec('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x6eec('0xa')]=function(_0x3c6eda,_0x48064a){return _0x3c6eda[_0x6eec('0xb')](_0x6eec('0xc'),attributes,{'tableName':_0x6eec('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3baf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3baf,0xf7));var _0xf3ba=function(_0xe33b12,_0x2a9761){_0xe33b12=_0xe33b12-0x0;var _0x30699d=_0x3baf[_0xe33b12];return _0x30699d;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require(_0xf3ba('0x2'))(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var BPromise=require(_0xf3ba('0x5'));var rp=require(_0xf3ba('0x6'));var fs=require('fs');var path=require(_0xf3ba('0x7'));var rimraf=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var attributes=require(_0xf3ba('0xa'));var integrations=require(_0xf3ba('0xb'));module[_0xf3ba('0xc')]=function(_0x2e6df2,_0x1284b7){return _0x2e6df2['define']('ServicenowAccount',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 1fca51f..a601636 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 _0xf9b1=['GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','debug','ShowServicenowAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x40afa8,_0x5c30a8){var _0x253083=function(_0x2ebeef){while(--_0x2ebeef){_0x40afa8['push'](_0x40afa8['shift']());}};_0x253083(++_0x5c30a8);}(_0xf9b1,0x1ca));var _0x1f9b=function(_0x1e3001,_0x47e420){_0x1e3001=_0x1e3001-0x0;var _0x6529f2=_0xf9b1[_0x1e3001];return _0x6529f2;};'use strict';var _=require('lodash');var util=require(_0x1f9b('0x0'));var moment=require(_0x1f9b('0x1'));var BPromise=require(_0x1f9b('0x2'));var rs=require(_0x1f9b('0x3'));var fs=require('fs');var Redis=require(_0x1f9b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f9b('0x5'));var logger=require(_0x1f9b('0x6'))(_0x1f9b('0x7'));var config=require(_0x1f9b('0x8'));var jayson=require(_0x1f9b('0x9'));var client=jayson[_0x1f9b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53495a,_0x49da14,_0x3a2e93){return new BPromise(function(_0x35beb0,_0x4a6154){return client[_0x1f9b('0xb')](_0x53495a,_0x3a2e93)[_0x1f9b('0xc')](function(_0x324b21){logger[_0x1f9b('0xd')](_0x1f9b('0xe'),_0x49da14,_0x1f9b('0xf'));logger['debug'](_0x1f9b('0x10'),_0x49da14,_0x1f9b('0xf'),JSON[_0x1f9b('0x11')](_0x324b21));if(_0x324b21[_0x1f9b('0x12')]){if(_0x324b21[_0x1f9b('0x12')][_0x1f9b('0x13')]===0x1f4){logger[_0x1f9b('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x49da14,_0x324b21[_0x1f9b('0x12')][_0x1f9b('0x14')]);return _0x4a6154(_0x324b21['error'][_0x1f9b('0x14')]);}logger[_0x1f9b('0x12')](_0x1f9b('0xe'),_0x49da14,_0x324b21[_0x1f9b('0x12')][_0x1f9b('0x14')]);return _0x35beb0(_0x324b21[_0x1f9b('0x12')]['message']);}else{logger[_0x1f9b('0xd')](_0x1f9b('0xe'),_0x49da14,_0x1f9b('0xf'));_0x35beb0(_0x324b21[_0x1f9b('0x15')][_0x1f9b('0x14')]);}})[_0x1f9b('0x16')](function(_0x253c22){logger[_0x1f9b('0x12')](_0x1f9b('0xe'),_0x49da14,_0x253c22);_0x4a6154(_0x253c22);});});}exports[_0x1f9b('0x17')]=function(_0x1ff594){var _0x48afd2=this;return new Promise(function(_0x10e1e2,_0x4ba84c){return db[_0x1f9b('0x18')][_0x1f9b('0x19')]({'raw':_0x1ff594['options']?_0x1ff594[_0x1f9b('0x1a')][_0x1f9b('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ff594[_0x1f9b('0x1a')]?_0x1ff594['options'][_0x1f9b('0x1c')]||null:null,'attributes':_0x1ff594[_0x1f9b('0x1a')]?_0x1ff594[_0x1f9b('0x1a')][_0x1f9b('0x1d')]||null:null,'limit':_0x1ff594[_0x1f9b('0x1a')]?_0x1ff594[_0x1f9b('0x1a')][_0x1f9b('0x1e')]||null:null,'include':_0x1ff594[_0x1f9b('0x1a')]?_0x1ff594[_0x1f9b('0x1a')]['include']?_['map'](_0x1ff594[_0x1f9b('0x1a')][_0x1f9b('0x1f')],function(_0x4e6cbd){return{'model':db[_0x4e6cbd[_0x1f9b('0x20')]],'as':_0x4e6cbd['as'],'attributes':_0x4e6cbd[_0x1f9b('0x1d')],'include':_0x4e6cbd[_0x1f9b('0x1f')]?_[_0x1f9b('0x21')](_0x4e6cbd[_0x1f9b('0x1f')],function(_0x2b84e4){return{'model':db[_0x2b84e4['model']],'as':_0x2b84e4['as'],'attributes':_0x2b84e4[_0x1f9b('0x1d')],'include':_0x2b84e4[_0x1f9b('0x1f')]?_[_0x1f9b('0x21')](_0x2b84e4['include'],function(_0xd5f3b8){return{'model':db[_0xd5f3b8[_0x1f9b('0x20')]],'as':_0xd5f3b8['as'],'attributes':_0xd5f3b8[_0x1f9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1f9b('0xc')](function(_0x40f6a8){logger[_0x1f9b('0xd')](_0x1f9b('0x17'),_0x1ff594);logger[_0x1f9b('0x22')]('GetServicenowAccount',_0x1ff594,JSON[_0x1f9b('0x11')](_0x40f6a8));_0x10e1e2(_0x40f6a8);})[_0x1f9b('0x16')](function(_0xdff2b8){logger[_0x1f9b('0x12')](_0x1f9b('0x17'),_0xdff2b8[_0x1f9b('0x14')],_0x1ff594);_0x4ba84c(_0x48afd2[_0x1f9b('0x12')](0x1f4,_0xdff2b8['message']));});});};exports[_0x1f9b('0x23')]=function(_0x169f6c){var _0x5c3008=this;return new Promise(function(_0x495105,_0x4e6b46){return db['ServicenowAccount'][_0x1f9b('0x24')]({'raw':_0x169f6c[_0x1f9b('0x1a')]?_0x169f6c[_0x1f9b('0x1a')][_0x1f9b('0x1b')]===undefined?!![]:![]:!![],'where':_0x169f6c[_0x1f9b('0x1a')]?_0x169f6c[_0x1f9b('0x1a')][_0x1f9b('0x1c')]||null:null,'attributes':_0x169f6c[_0x1f9b('0x1a')]?_0x169f6c['options'][_0x1f9b('0x1d')]||null:null,'include':_0x169f6c[_0x1f9b('0x1a')]?_0x169f6c[_0x1f9b('0x1a')][_0x1f9b('0x1f')]?_['map'](_0x169f6c[_0x1f9b('0x1a')][_0x1f9b('0x1f')],function(_0x48a0b7){return{'model':db[_0x48a0b7[_0x1f9b('0x20')]],'as':_0x48a0b7['as'],'attributes':_0x48a0b7[_0x1f9b('0x1d')],'include':_0x48a0b7[_0x1f9b('0x1f')]?_[_0x1f9b('0x21')](_0x48a0b7['include'],function(_0x2daa2e){return{'model':db[_0x2daa2e['model']],'as':_0x2daa2e['as'],'attributes':_0x2daa2e[_0x1f9b('0x1d')],'include':_0x2daa2e[_0x1f9b('0x1f')]?_[_0x1f9b('0x21')](_0x2daa2e['include'],function(_0xa5397a){return{'model':db[_0xa5397a[_0x1f9b('0x20')]],'as':_0xa5397a['as'],'attributes':_0xa5397a[_0x1f9b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1f9b('0xc')](function(_0x5f3967){logger[_0x1f9b('0xd')](_0x1f9b('0x23'),_0x169f6c);logger['debug'](_0x1f9b('0x23'),_0x169f6c,JSON[_0x1f9b('0x11')](_0x5f3967));_0x495105(_0x5f3967);})[_0x1f9b('0x16')](function(_0x1d63bf){logger[_0x1f9b('0x12')](_0x1f9b('0x23'),_0x1d63bf[_0x1f9b('0x14')],_0x169f6c);_0x4e6b46(_0x5c3008[_0x1f9b('0x12')](0x1f4,_0x1d63bf['message']));});});}; \ No newline at end of file +var _0x9cb2=['error','message','result','catch','ServicenowAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetServicenowAccount','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x24ed4f,_0x220655){var _0x59d573=function(_0x1e873f){while(--_0x1e873f){_0x24ed4f['push'](_0x24ed4f['shift']());}};_0x59d573(++_0x220655);}(_0x9cb2,0x76));var _0x29cb=function(_0x3882a8,_0x2c3b74){_0x3882a8=_0x3882a8-0x0;var _0x4ab8d2=_0x9cb2[_0x3882a8];return _0x4ab8d2;};'use strict';var _=require(_0x29cb('0x0'));var util=require(_0x29cb('0x1'));var moment=require(_0x29cb('0x2'));var BPromise=require(_0x29cb('0x3'));var rs=require(_0x29cb('0x4'));var fs=require('fs');var Redis=require(_0x29cb('0x5'));var db=require(_0x29cb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x29cb('0x7'))(_0x29cb('0x8'));var config=require('../../config/environment');var jayson=require(_0x29cb('0x9'));var client=jayson[_0x29cb('0xa')][_0x29cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x407b1a,_0x4948af,_0x3e7506){return new BPromise(function(_0x16542f,_0xce9c0f){return client['request'](_0x407b1a,_0x3e7506)[_0x29cb('0xc')](function(_0x4cd569){logger[_0x29cb('0xd')](_0x29cb('0xe'),_0x4948af,_0x29cb('0xf'));logger[_0x29cb('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4948af,_0x29cb('0xf'),JSON[_0x29cb('0x11')](_0x4cd569));if(_0x4cd569[_0x29cb('0x12')]){if(_0x4cd569[_0x29cb('0x12')]['code']===0x1f4){logger[_0x29cb('0x12')](_0x29cb('0xe'),_0x4948af,_0x4cd569['error'][_0x29cb('0x13')]);return _0xce9c0f(_0x4cd569['error'][_0x29cb('0x13')]);}logger[_0x29cb('0x12')](_0x29cb('0xe'),_0x4948af,_0x4cd569[_0x29cb('0x12')]['message']);return _0x16542f(_0x4cd569[_0x29cb('0x12')][_0x29cb('0x13')]);}else{logger[_0x29cb('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x4948af,_0x29cb('0xf'));_0x16542f(_0x4cd569[_0x29cb('0x14')][_0x29cb('0x13')]);}})[_0x29cb('0x15')](function(_0x551adf){logger[_0x29cb('0x12')](_0x29cb('0xe'),_0x4948af,_0x551adf);_0xce9c0f(_0x551adf);});});}exports['GetServicenowAccount']=function(_0x494b77){var _0x2c4e40=this;return new Promise(function(_0x438255,_0x112fe0){return db[_0x29cb('0x16')][_0x29cb('0x17')]({'raw':_0x494b77['options']?_0x494b77[_0x29cb('0x18')][_0x29cb('0x19')]===undefined?!![]:![]:!![],'where':_0x494b77[_0x29cb('0x18')]?_0x494b77[_0x29cb('0x18')][_0x29cb('0x1a')]||null:null,'attributes':_0x494b77[_0x29cb('0x18')]?_0x494b77[_0x29cb('0x18')]['attributes']||null:null,'limit':_0x494b77[_0x29cb('0x18')]?_0x494b77[_0x29cb('0x18')][_0x29cb('0x1b')]||null:null,'include':_0x494b77['options']?_0x494b77['options'][_0x29cb('0x1c')]?_[_0x29cb('0x1d')](_0x494b77[_0x29cb('0x18')][_0x29cb('0x1c')],function(_0x51e973){return{'model':db[_0x51e973[_0x29cb('0x1e')]],'as':_0x51e973['as'],'attributes':_0x51e973[_0x29cb('0x1f')],'include':_0x51e973['include']?_[_0x29cb('0x1d')](_0x51e973[_0x29cb('0x1c')],function(_0x5958fa){return{'model':db[_0x5958fa[_0x29cb('0x1e')]],'as':_0x5958fa['as'],'attributes':_0x5958fa[_0x29cb('0x1f')],'include':_0x5958fa['include']?_[_0x29cb('0x1d')](_0x5958fa[_0x29cb('0x1c')],function(_0x5b59cc){return{'model':db[_0x5b59cc['model']],'as':_0x5b59cc['as'],'attributes':_0x5b59cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x29cb('0xc')](function(_0x1b9078){logger[_0x29cb('0xd')](_0x29cb('0x20'),_0x494b77);logger['debug'](_0x29cb('0x20'),_0x494b77,JSON['stringify'](_0x1b9078));_0x438255(_0x1b9078);})[_0x29cb('0x15')](function(_0x10f086){logger['error'](_0x29cb('0x20'),_0x10f086[_0x29cb('0x13')],_0x494b77);_0x112fe0(_0x2c4e40[_0x29cb('0x12')](0x1f4,_0x10f086[_0x29cb('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x1de671){var _0x669087=this;return new Promise(function(_0x1dc800,_0x398725){return db[_0x29cb('0x16')]['find']({'raw':_0x1de671[_0x29cb('0x18')]?_0x1de671[_0x29cb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1de671['options']?_0x1de671[_0x29cb('0x18')][_0x29cb('0x1a')]||null:null,'attributes':_0x1de671[_0x29cb('0x18')]?_0x1de671[_0x29cb('0x18')][_0x29cb('0x1f')]||null:null,'include':_0x1de671[_0x29cb('0x18')]?_0x1de671['options'][_0x29cb('0x1c')]?_['map'](_0x1de671[_0x29cb('0x18')]['include'],function(_0x25556a){return{'model':db[_0x25556a[_0x29cb('0x1e')]],'as':_0x25556a['as'],'attributes':_0x25556a['attributes'],'include':_0x25556a[_0x29cb('0x1c')]?_[_0x29cb('0x1d')](_0x25556a[_0x29cb('0x1c')],function(_0x3757e1){return{'model':db[_0x3757e1['model']],'as':_0x3757e1['as'],'attributes':_0x3757e1[_0x29cb('0x1f')],'include':_0x3757e1[_0x29cb('0x1c')]?_[_0x29cb('0x1d')](_0x3757e1[_0x29cb('0x1c')],function(_0x3f621a){return{'model':db[_0x3f621a[_0x29cb('0x1e')]],'as':_0x3f621a['as'],'attributes':_0x3f621a[_0x29cb('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x570479){logger[_0x29cb('0xd')](_0x29cb('0x21'),_0x1de671);logger[_0x29cb('0x10')](_0x29cb('0x21'),_0x1de671,JSON['stringify'](_0x570479));_0x1dc800(_0x570479);})[_0x29cb('0x15')](function(_0x117e22){logger[_0x29cb('0x12')](_0x29cb('0x21'),_0x117e22['message'],_0x1de671);_0x398725(_0x669087[_0x29cb('0x12')](0x1f4,_0x117e22[_0x29cb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 396cebb..d70e8f7 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 _0xe859=['update','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getDescriptions','post','create','put'];(function(_0x4fe679,_0x212aab){var _0x39b3d3=function(_0x5e4390){while(--_0x5e4390){_0x4fe679['push'](_0x4fe679['shift']());}};_0x39b3d3(++_0x212aab);}(_0xe859,0xea));var _0x9e85=function(_0x579859,_0x4e9af7){_0x579859=_0x579859-0x0;var _0x49565f=_0xe859[_0x579859];return _0x49565f;};'use strict';var multer=require(_0x9e85('0x0'));var util=require(_0x9e85('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9e85('0x2')]();var auth=require(_0x9e85('0x3'));var interaction=require(_0x9e85('0x4'));var config=require(_0x9e85('0x5'));var controller=require(_0x9e85('0x6'));router[_0x9e85('0x7')]('/',auth[_0x9e85('0x8')](),controller[_0x9e85('0x9')]);router[_0x9e85('0x7')](_0x9e85('0xa'),auth[_0x9e85('0x8')](),controller[_0x9e85('0xb')]);router['get'](_0x9e85('0xc'),auth[_0x9e85('0x8')](),controller[_0x9e85('0xd')]);router[_0x9e85('0x7')]('/:id/subjects',auth[_0x9e85('0x8')](),controller['getSubjects']);router[_0x9e85('0x7')]('/:id/descriptions',auth[_0x9e85('0x8')](),controller[_0x9e85('0xe')]);router[_0x9e85('0xf')]('/',auth[_0x9e85('0x8')](),controller[_0x9e85('0x10')]);router[_0x9e85('0x11')](_0x9e85('0xa'),auth[_0x9e85('0x8')](),controller[_0x9e85('0x12')]);router['delete']('/:id',auth[_0x9e85('0x8')](),controller[_0x9e85('0x13')]);module[_0x9e85('0x14')]=router; \ No newline at end of file +var _0x7ea0=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intServicenowConfiguration.controller','index','get','/:id','isAuthenticated','show'];(function(_0x48c188,_0x28304f){var _0x496831=function(_0xd19522){while(--_0xd19522){_0x48c188['push'](_0x48c188['shift']());}};_0x496831(++_0x28304f);}(_0x7ea0,0x143));var _0x07ea=function(_0x4c0564,_0x3de145){_0x4c0564=_0x4c0564-0x0;var _0x2f8413=_0x7ea0[_0x4c0564];return _0x2f8413;};'use strict';var multer=require(_0x07ea('0x0'));var util=require(_0x07ea('0x1'));var path=require(_0x07ea('0x2'));var timeout=require(_0x07ea('0x3'));var express=require(_0x07ea('0x4'));var router=express[_0x07ea('0x5')]();var auth=require(_0x07ea('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x07ea('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x07ea('0x8')]);router[_0x07ea('0x9')](_0x07ea('0xa'),auth[_0x07ea('0xb')](),controller[_0x07ea('0xc')]);router[_0x07ea('0x9')](_0x07ea('0xd'),auth['isAuthenticated'](),controller[_0x07ea('0xe')]);router['get'](_0x07ea('0xf'),auth['isAuthenticated'](),controller[_0x07ea('0x10')]);router[_0x07ea('0x9')](_0x07ea('0x11'),auth[_0x07ea('0xb')](),controller['getDescriptions']);router[_0x07ea('0x12')]('/',auth[_0x07ea('0xb')](),controller[_0x07ea('0x13')]);router[_0x07ea('0x14')]('/:id',auth[_0x07ea('0xb')](),controller[_0x07ea('0x15')]);router['delete'](_0x07ea('0xa'),auth['isAuthenticated'](),controller[_0x07ea('0x16')]);module[_0x07ea('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 091d852..4550a5b 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 _0x82a3=['STRING','sequelize'];(function(_0x54bab0,_0x5122cb){var _0x1dda21=function(_0x22c769){while(--_0x22c769){_0x54bab0['push'](_0x54bab0['shift']());}};_0x1dda21(++_0x5122cb);}(_0x82a3,0x15f));var _0x382a=function(_0x11ba32,_0x5a7ba6){_0x11ba32=_0x11ba32-0x0;var _0x296558=_0x82a3[_0x11ba32];return _0x296558;};'use strict';var Sequelize=require(_0x382a('0x0'));module['exports']={'name':{'type':Sequelize[_0x382a('0x1')]},'description':{'type':Sequelize[_0x382a('0x1')]}}; \ No newline at end of file +var _0x96f9=['sequelize','exports','STRING'];(function(_0x4f7cc5,_0x118a50){var _0x4da93e=function(_0x269b4a){while(--_0x269b4a){_0x4f7cc5['push'](_0x4f7cc5['shift']());}};_0x4da93e(++_0x118a50);}(_0x96f9,0x13b));var _0x996f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x96f9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x996f('0x0'));module[_0x996f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x996f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index acd3ab2..b7dc7e9 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 _0x80a3=['show','params','includeAll','find','create','body','findOne','order','getFields','nolimit','getSubjects','ServicenowField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/license/util','../../mysqldb','jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','json','offset','limit','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','options','count','include','ServicenowConfiguration','rows','catch'];(function(_0x3abe58,_0x184dd9){var _0x457389=function(_0x59f517){while(--_0x59f517){_0x3abe58['push'](_0x3abe58['shift']());}};_0x457389(++_0x184dd9);}(_0x80a3,0x6d));var _0x380a=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x80a3[_0x5447fd];return _0x15b28a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x380a('0x0'));var zipdir=require(_0x380a('0x1'));var jsonpatch=require(_0x380a('0x2'));var rp=require(_0x380a('0x3'));var moment=require(_0x380a('0x4'));var BPromise=require(_0x380a('0x5'));var Mustache=require(_0x380a('0x6'));var util=require('util');var path=require(_0x380a('0x7'));var sox=require(_0x380a('0x8'));var csv=require(_0x380a('0x9'));var ejs=require(_0x380a('0xa'));var fs=require('fs');var _=require(_0x380a('0xb'));var squel=require('squel');var crypto=require(_0x380a('0xc'));var jsforce=require(_0x380a('0xd'));var deskjs=require(_0x380a('0xe'));var toCsv=require(_0x380a('0x9'));var querystring=require(_0x380a('0xf'));var Papa=require(_0x380a('0x10'));var Redis=require(_0x380a('0x11'));var authService=require(_0x380a('0x12'));var qs=require(_0x380a('0x13'));var as=require(_0x380a('0x14'));var hardwareService=require(_0x380a('0x15'));var logger=require(_0x380a('0x16'))('api');var utils=require(_0x380a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x380a('0x18'));var db=require(_0x380a('0x19'))['db'];var jayson=require(_0x380a('0x1a'));var client=jayson[_0x380a('0x1b')][_0x380a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3840b8,_0x559201,_0x2dc48c,_0x425c61){return new BPromise(function(_0x1b3b77,_0x1b884b){var _0xd646a0=_0x425c61||client;return _0xd646a0[_0x380a('0x1d')](_0x3840b8,_0x2dc48c)[_0x380a('0x1e')](function(_0x4f99c2){logger['info'](_0x380a('0x1f'),_0x559201,_0x380a('0x20'));logger[_0x380a('0x21')](_0x380a('0x22'),_0x559201,_0x380a('0x20'),JSON[_0x380a('0x23')](_0x4f99c2));if(_0x4f99c2[_0x380a('0x24')]){if(_0x4f99c2[_0x380a('0x24')][_0x380a('0x25')]===0x1f4){logger[_0x380a('0x24')](_0x380a('0x1f'),_0x559201,_0x4f99c2[_0x380a('0x24')]['message']);return _0x1b884b(_0x4f99c2['error'][_0x380a('0x26')]);}logger['error'](_0x380a('0x1f'),_0x559201,_0x4f99c2[_0x380a('0x24')][_0x380a('0x26')]);return _0x1b3b77(_0x4f99c2[_0x380a('0x24')][_0x380a('0x26')]);}else{logger[_0x380a('0x27')](_0x380a('0x1f'),_0x559201,_0x380a('0x20'));_0x1b3b77(_0x4f99c2[_0x380a('0x28')][_0x380a('0x26')]);}})['catch'](function(_0x4a3ec1){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x559201,_0x4a3ec1);_0x1b884b(_0x4a3ec1);});});}function respondWithStatusCode(_0x1abd9a,_0x2649db){_0x2649db=_0x2649db||0xcc;return function(_0x46d65c){if(_0x46d65c){return _0x1abd9a[_0x380a('0x29')](_0x2649db);}return _0x1abd9a[_0x380a('0x2a')](_0x2649db)['end']();};}function respondWithResult(_0x258339,_0x3b7dd3){_0x3b7dd3=_0x3b7dd3||0xc8;return function(_0x5e79c1){if(_0x5e79c1){return _0x258339[_0x380a('0x2a')](_0x3b7dd3)[_0x380a('0x2b')](_0x5e79c1);}};}function respondWithFilteredResult(_0x5deab0,_0x861a64){return function(_0x53f6d0){if(_0x53f6d0){var _0x425e68=_0x53f6d0['count'],_0xee55ed=_0x861a64[_0x380a('0x2c')],_0x569f52=_0x861a64['offset']+_0x861a64[_0x380a('0x2d')],_0x4d2d10;if(_0x569f52>=_0x425e68){_0x569f52=_0x425e68;_0x4d2d10=0xc8;}else{_0x4d2d10=0xce;}_0x5deab0[_0x380a('0x2a')](_0x4d2d10);return _0x5deab0[_0x380a('0x2e')]('Content-Range',_0xee55ed+'-'+_0x569f52+'/'+_0x425e68)[_0x380a('0x2b')](_0x53f6d0);}return null;};}function patchUpdates(_0xfc324f){return function(_0x522a1f){try{jsonpatch[_0x380a('0x2f')](_0x522a1f,_0xfc324f,!![]);}catch(_0x1d93d5){return BPromise[_0x380a('0x30')](_0x1d93d5);}return _0x522a1f[_0x380a('0x31')]();};}function saveUpdates(_0x4513ed,_0xd95f37){return function(_0x171077){if(_0x171077){return _0x171077[_0x380a('0x32')](_0x4513ed)[_0x380a('0x1e')](function(_0x4ca7e1){return _0x4ca7e1;});}return null;};}function removeEntity(_0x13841d,_0x5a4907){return function(_0x581945){if(_0x581945){return _0x581945[_0x380a('0x33')]()[_0x380a('0x1e')](function(){_0x13841d['status'](0xcc)[_0x380a('0x34')]();});}};}function handleEntityNotFound(_0x298eb1,_0x19d044){return function(_0x19cea0){if(!_0x19cea0){_0x298eb1[_0x380a('0x29')](0x194);}return _0x19cea0;};}function handleError(_0x29f8a8,_0x5dce75){_0x5dce75=_0x5dce75||0x1f4;return function(_0x188016){logger[_0x380a('0x24')](_0x188016[_0x380a('0x35')]);if(_0x188016[_0x380a('0x36')]){delete _0x188016['name'];}_0x29f8a8[_0x380a('0x2a')](_0x5dce75)[_0x380a('0x37')](_0x188016);};}exports[_0x380a('0x38')]=function(_0x42cd08,_0x277bed){var _0x4e9120={},_0x1ba270={},_0x154b65={'count':0x0,'rows':[]};var _0x42888b=_[_0x380a('0x39')](db['ServicenowConfiguration'][_0x380a('0x3a')],function(_0x2bc486){return{'name':_0x2bc486[_0x380a('0x3b')],'type':_0x2bc486[_0x380a('0x3c')][_0x380a('0x3d')]};});_0x1ba270[_0x380a('0x3e')]=_[_0x380a('0x39')](_0x42888b,'name');_0x1ba270[_0x380a('0x3f')]=_[_0x380a('0x40')](_0x42cd08[_0x380a('0x3f')]);_0x1ba270[_0x380a('0x41')]=_[_0x380a('0x42')](_0x1ba270[_0x380a('0x3e')],_0x1ba270[_0x380a('0x3f')]);_0x4e9120[_0x380a('0x43')]=_['intersection'](_0x1ba270[_0x380a('0x3e')],qs[_0x380a('0x44')](_0x42cd08[_0x380a('0x3f')][_0x380a('0x44')]));_0x4e9120['attributes']=_0x4e9120[_0x380a('0x43')][_0x380a('0x45')]?_0x4e9120[_0x380a('0x43')]:_0x1ba270[_0x380a('0x3e')];if(!_0x42cd08['query'][_0x380a('0x46')]('nolimit')){_0x4e9120['limit']=qs[_0x380a('0x2d')](_0x42cd08[_0x380a('0x3f')][_0x380a('0x2d')]);_0x4e9120[_0x380a('0x2c')]=qs[_0x380a('0x2c')](_0x42cd08[_0x380a('0x3f')][_0x380a('0x2c')]);}_0x4e9120['order']=qs[_0x380a('0x47')](_0x42cd08['query'][_0x380a('0x47')]);_0x4e9120['where']=qs[_0x380a('0x41')](_[_0x380a('0x48')](_0x42cd08[_0x380a('0x3f')],_0x1ba270['filters']),_0x42888b);if(_0x42cd08[_0x380a('0x3f')]['filter']){_0x4e9120[_0x380a('0x49')]=_[_0x380a('0x4a')](_0x4e9120[_0x380a('0x49')],{'$or':_[_0x380a('0x39')](_0x42888b,function(_0x40405b){if(_0x40405b[_0x380a('0x3c')]!==_0x380a('0x4b')){var _0x20d6cb={};_0x20d6cb[_0x40405b[_0x380a('0x36')]]={'$like':'%'+_0x42cd08[_0x380a('0x3f')][_0x380a('0x4c')]+'%'};return _0x20d6cb;}})});}_0x4e9120=_[_0x380a('0x4a')]({},_0x4e9120,_0x42cd08[_0x380a('0x4d')]);var _0x20bc8c={'where':_0x4e9120[_0x380a('0x49')]};return db['ServicenowConfiguration']['count'](_0x20bc8c)[_0x380a('0x1e')](function(_0x1b5aeb){_0x154b65[_0x380a('0x4e')]=_0x1b5aeb;if(_0x42cd08[_0x380a('0x3f')]['includeAll']){_0x4e9120[_0x380a('0x4f')]=[{'all':!![]}];}return db[_0x380a('0x50')]['findAll'](_0x4e9120);})[_0x380a('0x1e')](function(_0x3e2496){_0x154b65[_0x380a('0x51')]=_0x3e2496;return _0x154b65;})[_0x380a('0x1e')](respondWithFilteredResult(_0x277bed,_0x4e9120))[_0x380a('0x52')](handleError(_0x277bed,null));};exports[_0x380a('0x53')]=function(_0x394c91,_0x14bc64){var _0x287767={'raw':![],'where':{'id':_0x394c91[_0x380a('0x54')]['id']}},_0x247d3e={};_0x247d3e['model']=_[_0x380a('0x40')](db[_0x380a('0x50')][_0x380a('0x3a')]);_0x247d3e[_0x380a('0x3f')]=_['keys'](_0x394c91[_0x380a('0x3f')]);_0x247d3e[_0x380a('0x41')]=_[_0x380a('0x42')](_0x247d3e[_0x380a('0x3e')],_0x247d3e[_0x380a('0x3f')]);_0x287767[_0x380a('0x43')]=_['intersection'](_0x247d3e[_0x380a('0x3e')],qs['fields'](_0x394c91[_0x380a('0x3f')][_0x380a('0x44')]));_0x287767[_0x380a('0x43')]=_0x287767[_0x380a('0x43')][_0x380a('0x45')]?_0x287767['attributes']:_0x247d3e['model'];if(_0x394c91[_0x380a('0x3f')][_0x380a('0x55')]){_0x287767[_0x380a('0x4f')]=[{'all':!![]}];}_0x287767=_[_0x380a('0x4a')]({},_0x287767,_0x394c91[_0x380a('0x4d')]);return db[_0x380a('0x50')][_0x380a('0x56')](_0x287767)[_0x380a('0x1e')](handleEntityNotFound(_0x14bc64,null))[_0x380a('0x1e')](respondWithResult(_0x14bc64,null))['catch'](handleError(_0x14bc64,null));};exports['create']=function(_0x27a2bc,_0x9a6607){return db['ServicenowConfiguration'][_0x380a('0x57')](_0x27a2bc[_0x380a('0x58')],{})['then'](respondWithResult(_0x9a6607,0xc9))['catch'](handleError(_0x9a6607,null));};exports['update']=function(_0x4afa36,_0xaa4fa7){if(_0x4afa36[_0x380a('0x58')]['id']){delete _0x4afa36['body']['id'];}return db[_0x380a('0x50')][_0x380a('0x56')]({'where':{'id':_0x4afa36['params']['id']}})['then'](handleEntityNotFound(_0xaa4fa7,null))[_0x380a('0x1e')](saveUpdates(_0x4afa36['body'],null))[_0x380a('0x1e')](respondWithResult(_0xaa4fa7,null))[_0x380a('0x52')](handleError(_0xaa4fa7,null));};exports[_0x380a('0x33')]=function(_0x2e483e,_0x5d55f7){return db[_0x380a('0x50')][_0x380a('0x56')]({'where':{'id':_0x2e483e[_0x380a('0x54')]['id']}})[_0x380a('0x1e')](handleEntityNotFound(_0x5d55f7,null))['then'](removeEntity(_0x5d55f7,null))[_0x380a('0x52')](handleError(_0x5d55f7,null));};exports['getFields']=function(_0x5d0a62,_0x2f85e5,_0x2fcd65){var _0x21b7ba={};var _0x41d4f3={};var _0x11e0d9;var _0x3ea848;return db['ServicenowConfiguration'][_0x380a('0x59')]({'where':{'id':_0x5d0a62['params']['id']}})[_0x380a('0x1e')](handleEntityNotFound(_0x2f85e5,null))[_0x380a('0x1e')](function(_0xbb462e){if(_0xbb462e){_0x11e0d9=_0xbb462e;_0x41d4f3[_0x380a('0x3e')]=_[_0x380a('0x40')](db['ServicenowField'][_0x380a('0x3a')]);_0x41d4f3[_0x380a('0x3f')]=_[_0x380a('0x40')](_0x5d0a62[_0x380a('0x3f')]);_0x41d4f3['filters']=_[_0x380a('0x42')](_0x41d4f3[_0x380a('0x3e')],_0x41d4f3[_0x380a('0x3f')]);_0x21b7ba[_0x380a('0x43')]=_[_0x380a('0x42')](_0x41d4f3[_0x380a('0x3e')],qs[_0x380a('0x44')](_0x5d0a62[_0x380a('0x3f')][_0x380a('0x44')]));_0x21b7ba['attributes']=_0x21b7ba[_0x380a('0x43')][_0x380a('0x45')]?_0x21b7ba[_0x380a('0x43')]:_0x41d4f3[_0x380a('0x3e')];_0x21b7ba[_0x380a('0x5a')]=qs[_0x380a('0x47')](_0x5d0a62['query'][_0x380a('0x47')]);_0x21b7ba['where']=qs[_0x380a('0x41')](_[_0x380a('0x48')](_0x5d0a62[_0x380a('0x3f')],_0x41d4f3[_0x380a('0x41')]));if(_0x5d0a62[_0x380a('0x3f')][_0x380a('0x4c')]){_0x21b7ba['where']=_['merge'](_0x21b7ba['where'],{'$or':_[_0x380a('0x39')](_0x21b7ba['attributes'],function(_0x38eafb){var _0x23fdc9={};_0x23fdc9[_0x38eafb]={'$like':'%'+_0x5d0a62[_0x380a('0x3f')][_0x380a('0x4c')]+'%'};return _0x23fdc9;})});}_0x21b7ba=_['merge']({},_0x21b7ba,_0x5d0a62[_0x380a('0x4d')]);return _0x11e0d9[_0x380a('0x5b')](_0x21b7ba);}})[_0x380a('0x1e')](function(_0x4c040f){if(_0x4c040f){_0x3ea848=_0x4c040f[_0x380a('0x45')];if(!_0x5d0a62[_0x380a('0x3f')][_0x380a('0x46')](_0x380a('0x5c'))){_0x21b7ba['limit']=qs['limit'](_0x5d0a62['query'][_0x380a('0x2d')]);_0x21b7ba['offset']=qs[_0x380a('0x2c')](_0x5d0a62['query']['offset']);}return _0x11e0d9[_0x380a('0x5b')](_0x21b7ba);}})[_0x380a('0x1e')](function(_0x3bf6e8){if(_0x3bf6e8){return _0x3bf6e8?{'count':_0x3ea848,'rows':_0x3bf6e8}:null;}})[_0x380a('0x1e')](respondWithResult(_0x2f85e5,null))[_0x380a('0x52')](handleError(_0x2f85e5,null));};exports[_0x380a('0x5d')]=function(_0x60fa34,_0xec1d35,_0x3bd013){var _0x3d3633={};var _0x4c083d={};var _0x5e600b;var _0x476d06;return db[_0x380a('0x50')]['findOne']({'where':{'id':_0x60fa34[_0x380a('0x54')]['id']}})['then'](handleEntityNotFound(_0xec1d35,null))[_0x380a('0x1e')](function(_0x53ccae){if(_0x53ccae){_0x5e600b=_0x53ccae;_0x4c083d[_0x380a('0x3e')]=_['keys'](db[_0x380a('0x5e')][_0x380a('0x3a')]);_0x4c083d['query']=_[_0x380a('0x40')](_0x60fa34[_0x380a('0x3f')]);_0x4c083d[_0x380a('0x41')]=_[_0x380a('0x42')](_0x4c083d[_0x380a('0x3e')],_0x4c083d[_0x380a('0x3f')]);_0x3d3633[_0x380a('0x43')]=_[_0x380a('0x42')](_0x4c083d[_0x380a('0x3e')],qs[_0x380a('0x44')](_0x60fa34[_0x380a('0x3f')][_0x380a('0x44')]));_0x3d3633[_0x380a('0x43')]=_0x3d3633[_0x380a('0x43')]['length']?_0x3d3633[_0x380a('0x43')]:_0x4c083d[_0x380a('0x3e')];_0x3d3633[_0x380a('0x5a')]=qs[_0x380a('0x47')](_0x60fa34[_0x380a('0x3f')][_0x380a('0x47')]);_0x3d3633[_0x380a('0x49')]=qs[_0x380a('0x41')](_[_0x380a('0x48')](_0x60fa34[_0x380a('0x3f')],_0x4c083d[_0x380a('0x41')]));if(_0x60fa34[_0x380a('0x3f')][_0x380a('0x4c')]){_0x3d3633[_0x380a('0x49')]=_[_0x380a('0x4a')](_0x3d3633['where'],{'$or':_[_0x380a('0x39')](_0x3d3633[_0x380a('0x43')],function(_0x3f8342){var _0x448043={};_0x448043[_0x3f8342]={'$like':'%'+_0x60fa34[_0x380a('0x3f')][_0x380a('0x4c')]+'%'};return _0x448043;})});}_0x3d3633=_[_0x380a('0x4a')]({},_0x3d3633,_0x60fa34[_0x380a('0x4d')]);return _0x5e600b[_0x380a('0x5d')](_0x3d3633);}})[_0x380a('0x1e')](function(_0xafcaad){if(_0xafcaad){_0x476d06=_0xafcaad[_0x380a('0x45')];if(!_0x60fa34[_0x380a('0x3f')][_0x380a('0x46')](_0x380a('0x5c'))){_0x3d3633[_0x380a('0x2d')]=qs[_0x380a('0x2d')](_0x60fa34[_0x380a('0x3f')][_0x380a('0x2d')]);_0x3d3633[_0x380a('0x2c')]=qs[_0x380a('0x2c')](_0x60fa34[_0x380a('0x3f')][_0x380a('0x2c')]);}return _0x5e600b[_0x380a('0x5d')](_0x3d3633);}})[_0x380a('0x1e')](function(_0x572b15){if(_0x572b15){return _0x572b15?{'count':_0x476d06,'rows':_0x572b15}:null;}})[_0x380a('0x1e')](respondWithResult(_0xec1d35,null))[_0x380a('0x52')](handleError(_0xec1d35,null));};exports['getDescriptions']=function(_0x2c56e9,_0x35a16f,_0x19fe9d){var _0x48418d={};var _0xf9433={};var _0x5c11c8;var _0x4e184b;return db['ServicenowConfiguration'][_0x380a('0x59')]({'where':{'id':_0x2c56e9[_0x380a('0x54')]['id']}})[_0x380a('0x1e')](handleEntityNotFound(_0x35a16f,null))['then'](function(_0x1caf35){if(_0x1caf35){_0x5c11c8=_0x1caf35;_0xf9433[_0x380a('0x3e')]=_['keys'](db[_0x380a('0x5e')][_0x380a('0x3a')]);_0xf9433['query']=_['keys'](_0x2c56e9['query']);_0xf9433[_0x380a('0x41')]=_[_0x380a('0x42')](_0xf9433['model'],_0xf9433[_0x380a('0x3f')]);_0x48418d[_0x380a('0x43')]=_['intersection'](_0xf9433['model'],qs[_0x380a('0x44')](_0x2c56e9[_0x380a('0x3f')][_0x380a('0x44')]));_0x48418d[_0x380a('0x43')]=_0x48418d['attributes'][_0x380a('0x45')]?_0x48418d['attributes']:_0xf9433[_0x380a('0x3e')];_0x48418d['order']=qs[_0x380a('0x47')](_0x2c56e9[_0x380a('0x3f')][_0x380a('0x47')]);_0x48418d[_0x380a('0x49')]=qs[_0x380a('0x41')](_[_0x380a('0x48')](_0x2c56e9[_0x380a('0x3f')],_0xf9433[_0x380a('0x41')]));if(_0x2c56e9[_0x380a('0x3f')][_0x380a('0x4c')]){_0x48418d[_0x380a('0x49')]=_[_0x380a('0x4a')](_0x48418d[_0x380a('0x49')],{'$or':_[_0x380a('0x39')](_0x48418d[_0x380a('0x43')],function(_0x5d1dbc){var _0x28cf44={};_0x28cf44[_0x5d1dbc]={'$like':'%'+_0x2c56e9[_0x380a('0x3f')][_0x380a('0x4c')]+'%'};return _0x28cf44;})});}_0x48418d=_[_0x380a('0x4a')]({},_0x48418d,_0x2c56e9[_0x380a('0x4d')]);return _0x5c11c8[_0x380a('0x5f')](_0x48418d);}})[_0x380a('0x1e')](function(_0x171ee8){if(_0x171ee8){_0x4e184b=_0x171ee8['length'];if(!_0x2c56e9[_0x380a('0x3f')][_0x380a('0x46')](_0x380a('0x5c'))){_0x48418d[_0x380a('0x2d')]=qs[_0x380a('0x2d')](_0x2c56e9[_0x380a('0x3f')][_0x380a('0x2d')]);_0x48418d[_0x380a('0x2c')]=qs[_0x380a('0x2c')](_0x2c56e9[_0x380a('0x3f')][_0x380a('0x2c')]);}return _0x5c11c8['getDescriptions'](_0x48418d);}})[_0x380a('0x1e')](function(_0x57186c){if(_0x57186c){return _0x57186c?{'count':_0x4e184b,'rows':_0x57186c}:null;}})[_0x380a('0x1e')](respondWithResult(_0x35a16f,null))[_0x380a('0x52')](handleError(_0x35a16f,null));}; \ No newline at end of file +var _0x5ac9=['intersection','fields','attributes','hasOwnProperty','nolimit','pick','filter','where','map','merge','options','includeAll','findAll','rows','show','params','keys','length','include','find','create','body','getFields','findOne','order','sort','getSubjects','ServicenowField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','catch','sendStatus','status','json','count','offset','limit','set','reject','update','destroy','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0xa3fa3,_0x328285){var _0x488dd4=function(_0x1c4f57){while(--_0x1c4f57){_0xa3fa3['push'](_0xa3fa3['shift']());}};_0x488dd4(++_0x328285);}(_0x5ac9,0x185));var _0x95ac=function(_0x45fd9d,_0x1ddb22){_0x45fd9d=_0x45fd9d-0x0;var _0xa1dec8=_0x5ac9[_0x45fd9d];return _0xa1dec8;};'use strict';var pdf=require(_0x95ac('0x0'));var emlformat=require(_0x95ac('0x1'));var rimraf=require(_0x95ac('0x2'));var zipdir=require(_0x95ac('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95ac('0x4'));var moment=require(_0x95ac('0x5'));var BPromise=require(_0x95ac('0x6'));var Mustache=require(_0x95ac('0x7'));var util=require(_0x95ac('0x8'));var path=require(_0x95ac('0x9'));var sox=require(_0x95ac('0xa'));var csv=require(_0x95ac('0xb'));var ejs=require(_0x95ac('0xc'));var fs=require('fs');var _=require(_0x95ac('0xd'));var squel=require(_0x95ac('0xe'));var crypto=require(_0x95ac('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x95ac('0x10'));var toCsv=require('to-csv');var querystring=require(_0x95ac('0x11'));var Papa=require(_0x95ac('0x12'));var Redis=require(_0x95ac('0x13'));var authService=require(_0x95ac('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x95ac('0x15'));var hardwareService=require(_0x95ac('0x16'));var logger=require(_0x95ac('0x17'))('api');var utils=require(_0x95ac('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x95ac('0x19'));var db=require(_0x95ac('0x1a'))['db'];var jayson=require(_0x95ac('0x1b'));var client=jayson[_0x95ac('0x1c')][_0x95ac('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x14b3b0,_0x51ffe4,_0x222357,_0x5aba15){return new BPromise(function(_0x2b72bb,_0x5c2a6b){var _0x48d93b=_0x5aba15||client;return _0x48d93b[_0x95ac('0x1e')](_0x14b3b0,_0x222357)[_0x95ac('0x1f')](function(_0x374d32){logger[_0x95ac('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x51ffe4,'request\x20sent');logger['debug'](_0x95ac('0x21'),_0x51ffe4,_0x95ac('0x22'),JSON['stringify'](_0x374d32));if(_0x374d32[_0x95ac('0x23')]){if(_0x374d32[_0x95ac('0x23')][_0x95ac('0x24')]===0x1f4){logger[_0x95ac('0x23')]('ServicenowConfiguration,\x20%s,\x20%s',_0x51ffe4,_0x374d32['error']['message']);return _0x5c2a6b(_0x374d32['error'][_0x95ac('0x25')]);}logger['error'](_0x95ac('0x26'),_0x51ffe4,_0x374d32[_0x95ac('0x23')]['message']);return _0x2b72bb(_0x374d32['error'][_0x95ac('0x25')]);}else{logger[_0x95ac('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x51ffe4,_0x95ac('0x22'));_0x2b72bb(_0x374d32['result'][_0x95ac('0x25')]);}})[_0x95ac('0x27')](function(_0x323ee0){logger[_0x95ac('0x23')](_0x95ac('0x26'),_0x51ffe4,_0x323ee0);_0x5c2a6b(_0x323ee0);});});}function respondWithStatusCode(_0x821b79,_0x51caeb){_0x51caeb=_0x51caeb||0xcc;return function(_0x277e4c){if(_0x277e4c){return _0x821b79[_0x95ac('0x28')](_0x51caeb);}return _0x821b79[_0x95ac('0x29')](_0x51caeb)['end']();};}function respondWithResult(_0x2612eb,_0x27c8be){_0x27c8be=_0x27c8be||0xc8;return function(_0x15ebb6){if(_0x15ebb6){return _0x2612eb['status'](_0x27c8be)[_0x95ac('0x2a')](_0x15ebb6);}};}function respondWithFilteredResult(_0x66a307,_0x5d2a71){return function(_0x10f9e3){if(_0x10f9e3){var _0x8e3976=_0x10f9e3[_0x95ac('0x2b')],_0x1ca498=_0x5d2a71[_0x95ac('0x2c')],_0x35ab71=_0x5d2a71[_0x95ac('0x2c')]+_0x5d2a71[_0x95ac('0x2d')],_0x37b6fc;if(_0x35ab71>=_0x8e3976){_0x35ab71=_0x8e3976;_0x37b6fc=0xc8;}else{_0x37b6fc=0xce;}_0x66a307[_0x95ac('0x29')](_0x37b6fc);return _0x66a307[_0x95ac('0x2e')]('Content-Range',_0x1ca498+'-'+_0x35ab71+'/'+_0x8e3976)[_0x95ac('0x2a')](_0x10f9e3);}return null;};}function patchUpdates(_0x3a6979){return function(_0x3c04b2){try{jsonpatch['apply'](_0x3c04b2,_0x3a6979,!![]);}catch(_0x3489ea){return BPromise[_0x95ac('0x2f')](_0x3489ea);}return _0x3c04b2['save']();};}function saveUpdates(_0xb312d6,_0x363a1a){return function(_0x244bf2){if(_0x244bf2){return _0x244bf2[_0x95ac('0x30')](_0xb312d6)[_0x95ac('0x1f')](function(_0x459a6c){return _0x459a6c;});}return null;};}function removeEntity(_0x8c6f2f,_0x594a60){return function(_0x4e119f){if(_0x4e119f){return _0x4e119f[_0x95ac('0x31')]()[_0x95ac('0x1f')](function(){_0x8c6f2f[_0x95ac('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x234c19,_0x608954){return function(_0x3c7d4c){if(!_0x3c7d4c){_0x234c19[_0x95ac('0x28')](0x194);}return _0x3c7d4c;};}function handleError(_0x2d23dd,_0x22e79a){_0x22e79a=_0x22e79a||0x1f4;return function(_0x81bbc){logger[_0x95ac('0x23')](_0x81bbc['stack']);if(_0x81bbc[_0x95ac('0x32')]){delete _0x81bbc[_0x95ac('0x32')];}_0x2d23dd[_0x95ac('0x29')](_0x22e79a)[_0x95ac('0x33')](_0x81bbc);};}exports[_0x95ac('0x34')]=function(_0x2e8e0f,_0x13ab90){var _0x256c45={},_0x2ee616={},_0x3b3a28={'count':0x0,'rows':[]};var _0x194af1=_['map'](db[_0x95ac('0x35')][_0x95ac('0x36')],function(_0x357131){return{'name':_0x357131[_0x95ac('0x37')],'type':_0x357131[_0x95ac('0x38')][_0x95ac('0x39')]};});_0x2ee616[_0x95ac('0x3a')]=_['map'](_0x194af1,'name');_0x2ee616[_0x95ac('0x3b')]=_['keys'](_0x2e8e0f['query']);_0x2ee616[_0x95ac('0x3c')]=_[_0x95ac('0x3d')](_0x2ee616[_0x95ac('0x3a')],_0x2ee616['query']);_0x256c45['attributes']=_[_0x95ac('0x3d')](_0x2ee616['model'],qs[_0x95ac('0x3e')](_0x2e8e0f[_0x95ac('0x3b')]['fields']));_0x256c45['attributes']=_0x256c45[_0x95ac('0x3f')]['length']?_0x256c45[_0x95ac('0x3f')]:_0x2ee616[_0x95ac('0x3a')];if(!_0x2e8e0f[_0x95ac('0x3b')][_0x95ac('0x40')](_0x95ac('0x41'))){_0x256c45[_0x95ac('0x2d')]=qs[_0x95ac('0x2d')](_0x2e8e0f[_0x95ac('0x3b')][_0x95ac('0x2d')]);_0x256c45[_0x95ac('0x2c')]=qs[_0x95ac('0x2c')](_0x2e8e0f[_0x95ac('0x3b')]['offset']);}_0x256c45['order']=qs['sort'](_0x2e8e0f['query']['sort']);_0x256c45['where']=qs['filters'](_[_0x95ac('0x42')](_0x2e8e0f[_0x95ac('0x3b')],_0x2ee616['filters']),_0x194af1);if(_0x2e8e0f['query'][_0x95ac('0x43')]){_0x256c45[_0x95ac('0x44')]=_['merge'](_0x256c45[_0x95ac('0x44')],{'$or':_[_0x95ac('0x45')](_0x194af1,function(_0x39a2b5){if(_0x39a2b5[_0x95ac('0x38')]!=='VIRTUAL'){var _0x1caf1b={};_0x1caf1b[_0x39a2b5[_0x95ac('0x32')]]={'$like':'%'+_0x2e8e0f[_0x95ac('0x3b')][_0x95ac('0x43')]+'%'};return _0x1caf1b;}})});}_0x256c45=_[_0x95ac('0x46')]({},_0x256c45,_0x2e8e0f[_0x95ac('0x47')]);var _0x2be25e={'where':_0x256c45['where']};return db[_0x95ac('0x35')][_0x95ac('0x2b')](_0x2be25e)[_0x95ac('0x1f')](function(_0x3ac78b){_0x3b3a28[_0x95ac('0x2b')]=_0x3ac78b;if(_0x2e8e0f[_0x95ac('0x3b')][_0x95ac('0x48')]){_0x256c45['include']=[{'all':!![]}];}return db[_0x95ac('0x35')][_0x95ac('0x49')](_0x256c45);})[_0x95ac('0x1f')](function(_0x4758f2){_0x3b3a28[_0x95ac('0x4a')]=_0x4758f2;return _0x3b3a28;})['then'](respondWithFilteredResult(_0x13ab90,_0x256c45))['catch'](handleError(_0x13ab90,null));};exports[_0x95ac('0x4b')]=function(_0x2263ad,_0x161ffb){var _0x4760be={'raw':![],'where':{'id':_0x2263ad[_0x95ac('0x4c')]['id']}},_0x29d5a1={};_0x29d5a1[_0x95ac('0x3a')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x29d5a1[_0x95ac('0x3b')]=_[_0x95ac('0x4d')](_0x2263ad['query']);_0x29d5a1[_0x95ac('0x3c')]=_[_0x95ac('0x3d')](_0x29d5a1[_0x95ac('0x3a')],_0x29d5a1[_0x95ac('0x3b')]);_0x4760be[_0x95ac('0x3f')]=_['intersection'](_0x29d5a1[_0x95ac('0x3a')],qs['fields'](_0x2263ad['query'][_0x95ac('0x3e')]));_0x4760be[_0x95ac('0x3f')]=_0x4760be[_0x95ac('0x3f')][_0x95ac('0x4e')]?_0x4760be['attributes']:_0x29d5a1[_0x95ac('0x3a')];if(_0x2263ad[_0x95ac('0x3b')][_0x95ac('0x48')]){_0x4760be[_0x95ac('0x4f')]=[{'all':!![]}];}_0x4760be=_[_0x95ac('0x46')]({},_0x4760be,_0x2263ad[_0x95ac('0x47')]);return db['ServicenowConfiguration'][_0x95ac('0x50')](_0x4760be)[_0x95ac('0x1f')](handleEntityNotFound(_0x161ffb,null))[_0x95ac('0x1f')](respondWithResult(_0x161ffb,null))['catch'](handleError(_0x161ffb,null));};exports[_0x95ac('0x51')]=function(_0x37c5cb,_0x544620){return db[_0x95ac('0x35')]['create'](_0x37c5cb[_0x95ac('0x52')],{})[_0x95ac('0x1f')](respondWithResult(_0x544620,0xc9))[_0x95ac('0x27')](handleError(_0x544620,null));};exports[_0x95ac('0x30')]=function(_0x7447a9,_0x439709){if(_0x7447a9[_0x95ac('0x52')]['id']){delete _0x7447a9[_0x95ac('0x52')]['id'];}return db[_0x95ac('0x35')][_0x95ac('0x50')]({'where':{'id':_0x7447a9[_0x95ac('0x4c')]['id']}})[_0x95ac('0x1f')](handleEntityNotFound(_0x439709,null))['then'](saveUpdates(_0x7447a9[_0x95ac('0x52')],null))['then'](respondWithResult(_0x439709,null))['catch'](handleError(_0x439709,null));};exports[_0x95ac('0x31')]=function(_0xc20a0d,_0x51fd1e){return db[_0x95ac('0x35')][_0x95ac('0x50')]({'where':{'id':_0xc20a0d['params']['id']}})[_0x95ac('0x1f')](handleEntityNotFound(_0x51fd1e,null))[_0x95ac('0x1f')](removeEntity(_0x51fd1e,null))['catch'](handleError(_0x51fd1e,null));};exports[_0x95ac('0x53')]=function(_0x207fa3,_0x46650d,_0x370185){var _0x34e7b0={};var _0x1bf44c={};var _0x5b7593;var _0x31560a;return db['ServicenowConfiguration'][_0x95ac('0x54')]({'where':{'id':_0x207fa3['params']['id']}})[_0x95ac('0x1f')](handleEntityNotFound(_0x46650d,null))[_0x95ac('0x1f')](function(_0x551b11){if(_0x551b11){_0x5b7593=_0x551b11;_0x1bf44c[_0x95ac('0x3a')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x1bf44c[_0x95ac('0x3b')]=_[_0x95ac('0x4d')](_0x207fa3[_0x95ac('0x3b')]);_0x1bf44c[_0x95ac('0x3c')]=_[_0x95ac('0x3d')](_0x1bf44c['model'],_0x1bf44c['query']);_0x34e7b0[_0x95ac('0x3f')]=_[_0x95ac('0x3d')](_0x1bf44c[_0x95ac('0x3a')],qs[_0x95ac('0x3e')](_0x207fa3[_0x95ac('0x3b')][_0x95ac('0x3e')]));_0x34e7b0[_0x95ac('0x3f')]=_0x34e7b0[_0x95ac('0x3f')][_0x95ac('0x4e')]?_0x34e7b0['attributes']:_0x1bf44c[_0x95ac('0x3a')];_0x34e7b0[_0x95ac('0x55')]=qs['sort'](_0x207fa3[_0x95ac('0x3b')][_0x95ac('0x56')]);_0x34e7b0[_0x95ac('0x44')]=qs['filters'](_[_0x95ac('0x42')](_0x207fa3['query'],_0x1bf44c[_0x95ac('0x3c')]));if(_0x207fa3[_0x95ac('0x3b')][_0x95ac('0x43')]){_0x34e7b0[_0x95ac('0x44')]=_[_0x95ac('0x46')](_0x34e7b0[_0x95ac('0x44')],{'$or':_[_0x95ac('0x45')](_0x34e7b0[_0x95ac('0x3f')],function(_0x56874b){var _0x41a18c={};_0x41a18c[_0x56874b]={'$like':'%'+_0x207fa3[_0x95ac('0x3b')][_0x95ac('0x43')]+'%'};return _0x41a18c;})});}_0x34e7b0=_[_0x95ac('0x46')]({},_0x34e7b0,_0x207fa3[_0x95ac('0x47')]);return _0x5b7593[_0x95ac('0x53')](_0x34e7b0);}})[_0x95ac('0x1f')](function(_0x261da2){if(_0x261da2){_0x31560a=_0x261da2[_0x95ac('0x4e')];if(!_0x207fa3['query']['hasOwnProperty']('nolimit')){_0x34e7b0[_0x95ac('0x2d')]=qs[_0x95ac('0x2d')](_0x207fa3[_0x95ac('0x3b')][_0x95ac('0x2d')]);_0x34e7b0[_0x95ac('0x2c')]=qs[_0x95ac('0x2c')](_0x207fa3[_0x95ac('0x3b')][_0x95ac('0x2c')]);}return _0x5b7593[_0x95ac('0x53')](_0x34e7b0);}})['then'](function(_0x3152f6){if(_0x3152f6){return _0x3152f6?{'count':_0x31560a,'rows':_0x3152f6}:null;}})[_0x95ac('0x1f')](respondWithResult(_0x46650d,null))[_0x95ac('0x27')](handleError(_0x46650d,null));};exports[_0x95ac('0x57')]=function(_0x97c803,_0x23282a,_0x344dec){var _0x40508a={};var _0x1a612d={};var _0x28ee84;var _0x246398;return db[_0x95ac('0x35')]['findOne']({'where':{'id':_0x97c803['params']['id']}})[_0x95ac('0x1f')](handleEntityNotFound(_0x23282a,null))[_0x95ac('0x1f')](function(_0x116de8){if(_0x116de8){_0x28ee84=_0x116de8;_0x1a612d[_0x95ac('0x3a')]=_[_0x95ac('0x4d')](db[_0x95ac('0x58')][_0x95ac('0x36')]);_0x1a612d[_0x95ac('0x3b')]=_[_0x95ac('0x4d')](_0x97c803[_0x95ac('0x3b')]);_0x1a612d[_0x95ac('0x3c')]=_[_0x95ac('0x3d')](_0x1a612d['model'],_0x1a612d[_0x95ac('0x3b')]);_0x40508a[_0x95ac('0x3f')]=_[_0x95ac('0x3d')](_0x1a612d['model'],qs[_0x95ac('0x3e')](_0x97c803[_0x95ac('0x3b')][_0x95ac('0x3e')]));_0x40508a[_0x95ac('0x3f')]=_0x40508a['attributes']['length']?_0x40508a['attributes']:_0x1a612d[_0x95ac('0x3a')];_0x40508a[_0x95ac('0x55')]=qs[_0x95ac('0x56')](_0x97c803[_0x95ac('0x3b')]['sort']);_0x40508a['where']=qs[_0x95ac('0x3c')](_[_0x95ac('0x42')](_0x97c803[_0x95ac('0x3b')],_0x1a612d[_0x95ac('0x3c')]));if(_0x97c803[_0x95ac('0x3b')][_0x95ac('0x43')]){_0x40508a['where']=_[_0x95ac('0x46')](_0x40508a['where'],{'$or':_['map'](_0x40508a['attributes'],function(_0x1b8399){var _0x1ad97f={};_0x1ad97f[_0x1b8399]={'$like':'%'+_0x97c803[_0x95ac('0x3b')][_0x95ac('0x43')]+'%'};return _0x1ad97f;})});}_0x40508a=_['merge']({},_0x40508a,_0x97c803[_0x95ac('0x47')]);return _0x28ee84[_0x95ac('0x57')](_0x40508a);}})[_0x95ac('0x1f')](function(_0x13ff2c){if(_0x13ff2c){_0x246398=_0x13ff2c[_0x95ac('0x4e')];if(!_0x97c803[_0x95ac('0x3b')][_0x95ac('0x40')](_0x95ac('0x41'))){_0x40508a[_0x95ac('0x2d')]=qs['limit'](_0x97c803[_0x95ac('0x3b')][_0x95ac('0x2d')]);_0x40508a[_0x95ac('0x2c')]=qs[_0x95ac('0x2c')](_0x97c803[_0x95ac('0x3b')][_0x95ac('0x2c')]);}return _0x28ee84['getSubjects'](_0x40508a);}})[_0x95ac('0x1f')](function(_0x1af941){if(_0x1af941){return _0x1af941?{'count':_0x246398,'rows':_0x1af941}:null;}})['then'](respondWithResult(_0x23282a,null))[_0x95ac('0x27')](handleError(_0x23282a,null));};exports[_0x95ac('0x59')]=function(_0x31aac0,_0x2d89c9,_0x2ec264){var _0x127b8e={};var _0x5471de={};var _0x36d475;var _0x9c230b;return db[_0x95ac('0x35')]['findOne']({'where':{'id':_0x31aac0[_0x95ac('0x4c')]['id']}})[_0x95ac('0x1f')](handleEntityNotFound(_0x2d89c9,null))[_0x95ac('0x1f')](function(_0x5de881){if(_0x5de881){_0x36d475=_0x5de881;_0x5471de['model']=_[_0x95ac('0x4d')](db[_0x95ac('0x58')][_0x95ac('0x36')]);_0x5471de[_0x95ac('0x3b')]=_[_0x95ac('0x4d')](_0x31aac0[_0x95ac('0x3b')]);_0x5471de[_0x95ac('0x3c')]=_[_0x95ac('0x3d')](_0x5471de[_0x95ac('0x3a')],_0x5471de['query']);_0x127b8e[_0x95ac('0x3f')]=_['intersection'](_0x5471de[_0x95ac('0x3a')],qs['fields'](_0x31aac0[_0x95ac('0x3b')]['fields']));_0x127b8e['attributes']=_0x127b8e[_0x95ac('0x3f')]['length']?_0x127b8e['attributes']:_0x5471de[_0x95ac('0x3a')];_0x127b8e[_0x95ac('0x55')]=qs['sort'](_0x31aac0['query']['sort']);_0x127b8e[_0x95ac('0x44')]=qs[_0x95ac('0x3c')](_[_0x95ac('0x42')](_0x31aac0[_0x95ac('0x3b')],_0x5471de[_0x95ac('0x3c')]));if(_0x31aac0[_0x95ac('0x3b')][_0x95ac('0x43')]){_0x127b8e[_0x95ac('0x44')]=_['merge'](_0x127b8e[_0x95ac('0x44')],{'$or':_['map'](_0x127b8e['attributes'],function(_0x58d3d6){var _0x244aee={};_0x244aee[_0x58d3d6]={'$like':'%'+_0x31aac0[_0x95ac('0x3b')][_0x95ac('0x43')]+'%'};return _0x244aee;})});}_0x127b8e=_[_0x95ac('0x46')]({},_0x127b8e,_0x31aac0[_0x95ac('0x47')]);return _0x36d475[_0x95ac('0x59')](_0x127b8e);}})[_0x95ac('0x1f')](function(_0x44ff13){if(_0x44ff13){_0x9c230b=_0x44ff13[_0x95ac('0x4e')];if(!_0x31aac0[_0x95ac('0x3b')][_0x95ac('0x40')]('nolimit')){_0x127b8e['limit']=qs[_0x95ac('0x2d')](_0x31aac0['query'][_0x95ac('0x2d')]);_0x127b8e[_0x95ac('0x2c')]=qs[_0x95ac('0x2c')](_0x31aac0[_0x95ac('0x3b')][_0x95ac('0x2c')]);}return _0x36d475['getDescriptions'](_0x127b8e);}})[_0x95ac('0x1f')](function(_0x41ec05){if(_0x41ec05){return _0x41ec05?{'count':_0x9c230b,'rows':_0x41ec05}:null;}})['then'](respondWithResult(_0x2d89c9,null))[_0x95ac('0x27')](handleError(_0x2d89c9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 6f0a04f..ba6e913 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 _0x9dbe=['moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x9dbe,0x1c4));var _0xe9db=function(_0x542a5d,_0x27e6c8){_0x542a5d=_0x542a5d-0x0;var _0x251378=_0x9dbe[_0x542a5d];return _0x251378;};'use strict';var _=require(_0xe9db('0x0'));var util=require(_0xe9db('0x1'));var logger=require(_0xe9db('0x2'))(_0xe9db('0x3'));var moment=require(_0xe9db('0x4'));var BPromise=require(_0xe9db('0x5'));var rp=require(_0xe9db('0x6'));var fs=require('fs');var path=require(_0xe9db('0x7'));var rimraf=require('rimraf');var config=require(_0xe9db('0x8'));var attributes=require(_0xe9db('0x9'));module[_0xe9db('0xa')]=function(_0x5501c1,_0x444e0f){return _0x5501c1[_0xe9db('0xb')]('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb38f=['api','moment','bluebird','request-promise','../../config/environment','exports','ServicenowConfiguration','lodash','util','../../config/logger'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb38f,0x13d));var _0xfb38=function(_0x3c3698,_0xa0bf08){_0x3c3698=_0x3c3698-0x0;var _0x4e6637=_0xb38f[_0x3c3698];return _0x4e6637;};'use strict';var _=require(_0xfb38('0x0'));var util=require(_0xfb38('0x1'));var logger=require(_0xfb38('0x2'))(_0xfb38('0x3'));var moment=require(_0xfb38('0x4'));var BPromise=require(_0xfb38('0x5'));var rp=require(_0xfb38('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfb38('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xfb38('0x8')]=function(_0x45e2fd,_0x4f56c3){return _0x45e2fd['define'](_0xfb38('0x9'),attributes,{'tableName':'int_servicenow_configurations','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 003e8ea..6711880 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 _0x0620=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird'];(function(_0x3cf1ad,_0x5a153d){var _0x481ca3=function(_0x4db9e8){while(--_0x4db9e8){_0x3cf1ad['push'](_0x3cf1ad['shift']());}};_0x481ca3(++_0x5a153d);}(_0x0620,0xd5));var _0x0062=function(_0x536526,_0x11220c){_0x536526=_0x536526-0x0;var _0x2e93d2=_0x0620[_0x536526];return _0x2e93d2;};'use strict';var _=require('lodash');var util=require(_0x0062('0x0'));var moment=require(_0x0062('0x1'));var BPromise=require(_0x0062('0x2'));var rs=require(_0x0062('0x3'));var fs=require('fs');var Redis=require(_0x0062('0x4'));var db=require(_0x0062('0x5'))['db'];var utils=require(_0x0062('0x6'));var logger=require(_0x0062('0x7'))(_0x0062('0x8'));var config=require(_0x0062('0x9'));var jayson=require(_0x0062('0xa'));var client=jayson[_0x0062('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41d96c,_0x101c99,_0xdd5f1f){return new BPromise(function(_0x12aa07,_0x143e3b){return client[_0x0062('0xc')](_0x41d96c,_0xdd5f1f)[_0x0062('0xd')](function(_0x163c1c){logger[_0x0062('0xe')](_0x0062('0xf'),_0x101c99,_0x0062('0x10'));logger[_0x0062('0x11')](_0x0062('0x12'),_0x101c99,_0x0062('0x10'),JSON['stringify'](_0x163c1c));if(_0x163c1c[_0x0062('0x13')]){if(_0x163c1c['error'][_0x0062('0x14')]===0x1f4){logger['error'](_0x0062('0xf'),_0x101c99,_0x163c1c[_0x0062('0x13')][_0x0062('0x15')]);return _0x143e3b(_0x163c1c[_0x0062('0x13')][_0x0062('0x15')]);}logger[_0x0062('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x101c99,_0x163c1c[_0x0062('0x13')][_0x0062('0x15')]);return _0x12aa07(_0x163c1c[_0x0062('0x13')][_0x0062('0x15')]);}else{logger[_0x0062('0xe')](_0x0062('0xf'),_0x101c99,'request\x20sent');_0x12aa07(_0x163c1c[_0x0062('0x16')]['message']);}})[_0x0062('0x17')](function(_0x487406){logger[_0x0062('0x13')](_0x0062('0xf'),_0x101c99,_0x487406);_0x143e3b(_0x487406);});});} \ No newline at end of file +var _0x9d11=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info'];(function(_0x3e079f,_0x189e15){var _0x296a34=function(_0xa31a0a){while(--_0xa31a0a){_0x3e079f['push'](_0x3e079f['shift']());}};_0x296a34(++_0x189e15);}(_0x9d11,0x1ad));var _0x19d1=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x9d11[_0x30faee];return _0x3a90ab;};'use strict';var _=require(_0x19d1('0x0'));var util=require('util');var moment=require(_0x19d1('0x1'));var BPromise=require(_0x19d1('0x2'));var rs=require(_0x19d1('0x3'));var fs=require('fs');var Redis=require(_0x19d1('0x4'));var db=require(_0x19d1('0x5'))['db'];var utils=require(_0x19d1('0x6'));var logger=require('../../config/logger')(_0x19d1('0x7'));var config=require(_0x19d1('0x8'));var jayson=require(_0x19d1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27e769,_0x5f606e,_0x484c6c){return new BPromise(function(_0x5733d3,_0x183707){return client[_0x19d1('0xa')](_0x27e769,_0x484c6c)['then'](function(_0x4284ce){logger[_0x19d1('0xb')](_0x19d1('0xc'),_0x5f606e,_0x19d1('0xd'));logger[_0x19d1('0xe')](_0x19d1('0xf'),_0x5f606e,_0x19d1('0xd'),JSON[_0x19d1('0x10')](_0x4284ce));if(_0x4284ce['error']){if(_0x4284ce[_0x19d1('0x11')][_0x19d1('0x12')]===0x1f4){logger['error'](_0x19d1('0xc'),_0x5f606e,_0x4284ce[_0x19d1('0x11')]['message']);return _0x183707(_0x4284ce['error']['message']);}logger[_0x19d1('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5f606e,_0x4284ce[_0x19d1('0x11')]['message']);return _0x5733d3(_0x4284ce['error'][_0x19d1('0x13')]);}else{logger[_0x19d1('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5f606e,'request\x20sent');_0x5733d3(_0x4284ce[_0x19d1('0x14')][_0x19d1('0x13')]);}})['catch'](function(_0x2a8351){logger[_0x19d1('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5f606e,_0x2a8351);_0x183707(_0x2a8351);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 9da0ade..36992a3 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 _0x23e5=['index','/:id','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated'];(function(_0x312cbe,_0x54cca8){var _0xb04aef=function(_0x5bfd2c){while(--_0x5bfd2c){_0x312cbe['push'](_0x312cbe['shift']());}};_0xb04aef(++_0x54cca8);}(_0x23e5,0x196));var _0x523e=function(_0x72de8b,_0x161b46){_0x72de8b=_0x72de8b-0x0;var _0x33b93e=_0x23e5[_0x72de8b];return _0x33b93e;};'use strict';var multer=require('multer');var util=require(_0x523e('0x0'));var path=require(_0x523e('0x1'));var timeout=require(_0x523e('0x2'));var express=require(_0x523e('0x3'));var router=express[_0x523e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x523e('0x5'));var config=require(_0x523e('0x6'));var controller=require(_0x523e('0x7'));router[_0x523e('0x8')]('/',auth[_0x523e('0x9')](),controller[_0x523e('0xa')]);router[_0x523e('0x8')](_0x523e('0xb'),auth[_0x523e('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x523e('0xc')]('/:id',auth[_0x523e('0x9')](),controller[_0x523e('0xd')]);router[_0x523e('0xe')](_0x523e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x523e('0xf')]=router; \ No newline at end of file +var _0x19e2=['update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','create','put'];(function(_0x336116,_0x2a05b7){var _0x3d8b64=function(_0x550205){while(--_0x550205){_0x336116['push'](_0x336116['shift']());}};_0x3d8b64(++_0x2a05b7);}(_0x19e2,0x99));var _0x219e=function(_0x42e9fb,_0x7088bc){_0x42e9fb=_0x42e9fb-0x0;var _0x3d6003=_0x19e2[_0x42e9fb];return _0x3d6003;};'use strict';var multer=require('multer');var util=require(_0x219e('0x0'));var path=require(_0x219e('0x1'));var timeout=require(_0x219e('0x2'));var express=require('express');var router=express[_0x219e('0x3')]();var auth=require(_0x219e('0x4'));var interaction=require(_0x219e('0x5'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x219e('0x6')]('/',auth[_0x219e('0x7')](),controller['index']);router[_0x219e('0x6')](_0x219e('0x8'),auth[_0x219e('0x7')](),controller[_0x219e('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x219e('0xa')]);router[_0x219e('0xb')]('/:id',auth[_0x219e('0x7')](),controller[_0x219e('0xc')]);router[_0x219e('0xd')](_0x219e('0x8'),auth['isAuthenticated'](),controller[_0x219e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 83aeb83..40e9367 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 _0x6f2d=['variable','BOOLEAN','sequelize','string','customVariable','keyValue','STRING','ENUM'];(function(_0x3f3901,_0xb734a8){var _0x8e30ee=function(_0x5ec03e){while(--_0x5ec03e){_0x3f3901['push'](_0x3f3901['shift']());}};_0x8e30ee(++_0xb734a8);}(_0x6f2d,0x182));var _0xd6f2=function(_0x27a2d6,_0x5e3172){_0x27a2d6=_0x27a2d6-0x0;var _0x3aa4fd=_0x6f2d[_0x27a2d6];return _0x3aa4fd;};'use strict';var Sequelize=require(_0xd6f2('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xd6f2('0x1'),'variable',_0xd6f2('0x2'),_0xd6f2('0x3')),'defaultValue':_0xd6f2('0x1')},'content':{'type':Sequelize[_0xd6f2('0x4')]},'key':{'type':Sequelize[_0xd6f2('0x4')]},'keyType':{'type':Sequelize[_0xd6f2('0x5')](_0xd6f2('0x1'),_0xd6f2('0x6'),_0xd6f2('0x2'))},'keyContent':{'type':Sequelize[_0xd6f2('0x4')]},'idField':{'type':Sequelize[_0xd6f2('0x4')]},'nameField':{'type':Sequelize[_0xd6f2('0x4')]},'customField':{'type':Sequelize[_0xd6f2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd6f2('0x4')]}}; \ No newline at end of file +var _0xdff5=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0xdff5,0x100));var _0x5dff=function(_0x10f21a,_0x240adf){_0x10f21a=_0x10f21a-0x0;var _0xe00c20=_0xdff5[_0x10f21a];return _0xe00c20;};'use strict';var Sequelize=require('sequelize');module[_0x5dff('0x0')]={'type':{'type':Sequelize[_0x5dff('0x1')](_0x5dff('0x2'),_0x5dff('0x3'),_0x5dff('0x4'),_0x5dff('0x5')),'defaultValue':_0x5dff('0x2')},'content':{'type':Sequelize[_0x5dff('0x6')]},'key':{'type':Sequelize[_0x5dff('0x6')]},'keyType':{'type':Sequelize[_0x5dff('0x1')](_0x5dff('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x5dff('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5dff('0x6')]},'customField':{'type':Sequelize[_0x5dff('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5dff('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 312e287..51103b4 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 _0xdaa8=['key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','filter','where','merge','options','includeAll','include','show','params','keys','catch','create','body','find','html-pdf','eml-format','rimraf','zip-dir','path','sox','to-csv','squel','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','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','ServicenowField','rawAttributes','type'];(function(_0x1cbb79,_0x37f771){var _0x19c706=function(_0x3f880b){while(--_0x3f880b){_0x1cbb79['push'](_0x1cbb79['shift']());}};_0x19c706(++_0x37f771);}(_0xdaa8,0xe4));var _0x8daa=function(_0x54a2a9,_0x3606ee){_0x54a2a9=_0x54a2a9-0x0;var _0x2167e2=_0xdaa8[_0x54a2a9];return _0x2167e2;};'use strict';var pdf=require(_0x8daa('0x0'));var emlformat=require(_0x8daa('0x1'));var rimraf=require(_0x8daa('0x2'));var zipdir=require(_0x8daa('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8daa('0x4'));var sox=require(_0x8daa('0x5'));var csv=require(_0x8daa('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8daa('0x7'));var crypto=require('crypto');var jsforce=require(_0x8daa('0x8'));var deskjs=require(_0x8daa('0x9'));var toCsv=require(_0x8daa('0x6'));var querystring=require(_0x8daa('0xa'));var Papa=require(_0x8daa('0xb'));var Redis=require('ioredis');var authService=require(_0x8daa('0xc'));var qs=require(_0x8daa('0xd'));var as=require(_0x8daa('0xe'));var hardwareService=require(_0x8daa('0xf'));var logger=require(_0x8daa('0x10'))(_0x8daa('0x11'));var utils=require(_0x8daa('0x12'));var config=require(_0x8daa('0x13'));var licenseUtil=require(_0x8daa('0x14'));var db=require(_0x8daa('0x15'))['db'];function respondWithStatusCode(_0x151f24,_0x536f7e){_0x536f7e=_0x536f7e||0xcc;return function(_0x17b260){if(_0x17b260){return _0x151f24[_0x8daa('0x16')](_0x536f7e);}return _0x151f24[_0x8daa('0x17')](_0x536f7e)['end']();};}function respondWithResult(_0x33fbf4,_0x5130a4){_0x5130a4=_0x5130a4||0xc8;return function(_0x28900d){if(_0x28900d){return _0x33fbf4[_0x8daa('0x17')](_0x5130a4)[_0x8daa('0x18')](_0x28900d);}};}function respondWithFilteredResult(_0x531f62,_0x3e90ad){return function(_0x3f1f8f){if(_0x3f1f8f){var _0x55bf66=_0x3f1f8f[_0x8daa('0x19')],_0x4bfdfb=_0x3e90ad[_0x8daa('0x1a')],_0x442d09=_0x3e90ad[_0x8daa('0x1a')]+_0x3e90ad[_0x8daa('0x1b')],_0x2fc822;if(_0x442d09>=_0x55bf66){_0x442d09=_0x55bf66;_0x2fc822=0xc8;}else{_0x2fc822=0xce;}_0x531f62[_0x8daa('0x17')](_0x2fc822);return _0x531f62[_0x8daa('0x1c')](_0x8daa('0x1d'),_0x4bfdfb+'-'+_0x442d09+'/'+_0x55bf66)[_0x8daa('0x18')](_0x3f1f8f);}return null;};}function patchUpdates(_0x550ec4){return function(_0x490d91){try{jsonpatch['apply'](_0x490d91,_0x550ec4,!![]);}catch(_0x3cf4d5){return BPromise[_0x8daa('0x1e')](_0x3cf4d5);}return _0x490d91[_0x8daa('0x1f')]();};}function saveUpdates(_0x57c76b,_0x3d5675){return function(_0x5f0e18){if(_0x5f0e18){return _0x5f0e18[_0x8daa('0x20')](_0x57c76b)[_0x8daa('0x21')](function(_0x1348e8){return _0x1348e8;});}return null;};}function removeEntity(_0x55d563,_0x1ed29e){return function(_0x4db25d){if(_0x4db25d){return _0x4db25d[_0x8daa('0x22')]()['then'](function(){_0x55d563['status'](0xcc)[_0x8daa('0x23')]();});}};}function handleEntityNotFound(_0x15a4be,_0x221d96){return function(_0x58af34){if(!_0x58af34){_0x15a4be[_0x8daa('0x16')](0x194);}return _0x58af34;};}function handleError(_0xbd075f,_0x5d786a){_0x5d786a=_0x5d786a||0x1f4;return function(_0x35dbc1){logger[_0x8daa('0x24')](_0x35dbc1[_0x8daa('0x25')]);if(_0x35dbc1[_0x8daa('0x26')]){delete _0x35dbc1[_0x8daa('0x26')];}_0xbd075f[_0x8daa('0x17')](_0x5d786a)[_0x8daa('0x27')](_0x35dbc1);};}exports['index']=function(_0x41862b,_0x5f1609){var _0x41e96a={},_0x5151f8={},_0xb78435={'count':0x0,'rows':[]};var _0x54cfc1=_[_0x8daa('0x28')](db[_0x8daa('0x29')][_0x8daa('0x2a')],function(_0x1981db){return{'name':_0x1981db['fieldName'],'type':_0x1981db[_0x8daa('0x2b')][_0x8daa('0x2c')]};});_0x5151f8[_0x8daa('0x2d')]=_[_0x8daa('0x28')](_0x54cfc1,'name');_0x5151f8['query']=_['keys'](_0x41862b[_0x8daa('0x2e')]);_0x5151f8['filters']=_[_0x8daa('0x2f')](_0x5151f8[_0x8daa('0x2d')],_0x5151f8[_0x8daa('0x2e')]);_0x41e96a[_0x8daa('0x30')]=_['intersection'](_0x5151f8[_0x8daa('0x2d')],qs['fields'](_0x41862b['query'][_0x8daa('0x31')]));_0x41e96a[_0x8daa('0x30')]=_0x41e96a[_0x8daa('0x30')][_0x8daa('0x32')]?_0x41e96a[_0x8daa('0x30')]:_0x5151f8[_0x8daa('0x2d')];if(!_0x41862b[_0x8daa('0x2e')][_0x8daa('0x33')]('nolimit')){_0x41e96a[_0x8daa('0x1b')]=qs[_0x8daa('0x1b')](_0x41862b['query'][_0x8daa('0x1b')]);_0x41e96a[_0x8daa('0x1a')]=qs[_0x8daa('0x1a')](_0x41862b[_0x8daa('0x2e')][_0x8daa('0x1a')]);}_0x41e96a['order']=qs[_0x8daa('0x34')](_0x41862b[_0x8daa('0x2e')]['sort']);_0x41e96a['where']=qs['filters'](_[_0x8daa('0x35')](_0x41862b[_0x8daa('0x2e')],_0x5151f8[_0x8daa('0x36')]),_0x54cfc1);if(_0x41862b[_0x8daa('0x2e')][_0x8daa('0x37')]){_0x41e96a[_0x8daa('0x38')]=_['merge'](_0x41e96a['where'],{'$or':_[_0x8daa('0x28')](_0x54cfc1,function(_0x597d96){if(_0x597d96[_0x8daa('0x2b')]!=='VIRTUAL'){var _0x89fa8f={};_0x89fa8f[_0x597d96[_0x8daa('0x26')]]={'$like':'%'+_0x41862b[_0x8daa('0x2e')]['filter']+'%'};return _0x89fa8f;}})});}_0x41e96a=_[_0x8daa('0x39')]({},_0x41e96a,_0x41862b[_0x8daa('0x3a')]);var _0x47a4df={'where':_0x41e96a[_0x8daa('0x38')]};return db['ServicenowField']['count'](_0x47a4df)[_0x8daa('0x21')](function(_0x5cc76f){_0xb78435[_0x8daa('0x19')]=_0x5cc76f;if(_0x41862b[_0x8daa('0x2e')][_0x8daa('0x3b')]){_0x41e96a[_0x8daa('0x3c')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x41e96a);})['then'](function(_0x5e2b0d){_0xb78435['rows']=_0x5e2b0d;return _0xb78435;})[_0x8daa('0x21')](respondWithFilteredResult(_0x5f1609,_0x41e96a))['catch'](handleError(_0x5f1609,null));};exports[_0x8daa('0x3d')]=function(_0x2ca776,_0x124206){var _0x4d8ca8={'raw':!![],'where':{'id':_0x2ca776[_0x8daa('0x3e')]['id']}},_0x4b1331={};_0x4b1331[_0x8daa('0x2d')]=_[_0x8daa('0x3f')](db[_0x8daa('0x29')][_0x8daa('0x2a')]);_0x4b1331['query']=_[_0x8daa('0x3f')](_0x2ca776[_0x8daa('0x2e')]);_0x4b1331['filters']=_[_0x8daa('0x2f')](_0x4b1331[_0x8daa('0x2d')],_0x4b1331[_0x8daa('0x2e')]);_0x4d8ca8['attributes']=_[_0x8daa('0x2f')](_0x4b1331[_0x8daa('0x2d')],qs['fields'](_0x2ca776['query'][_0x8daa('0x31')]));_0x4d8ca8['attributes']=_0x4d8ca8['attributes'][_0x8daa('0x32')]?_0x4d8ca8[_0x8daa('0x30')]:_0x4b1331[_0x8daa('0x2d')];if(_0x2ca776['query']['includeAll']){_0x4d8ca8[_0x8daa('0x3c')]=[{'all':!![]}];}_0x4d8ca8=_[_0x8daa('0x39')]({},_0x4d8ca8,_0x2ca776[_0x8daa('0x3a')]);return db[_0x8daa('0x29')]['find'](_0x4d8ca8)[_0x8daa('0x21')](handleEntityNotFound(_0x124206,null))[_0x8daa('0x21')](respondWithResult(_0x124206,null))[_0x8daa('0x40')](handleError(_0x124206,null));};exports['create']=function(_0x18f37a,_0x3fb159){return db[_0x8daa('0x29')][_0x8daa('0x41')](_0x18f37a[_0x8daa('0x42')],{})[_0x8daa('0x21')](respondWithResult(_0x3fb159,0xc9))[_0x8daa('0x40')](handleError(_0x3fb159,null));};exports['update']=function(_0x4a31d1,_0x3e40f5){if(_0x4a31d1['body']['id']){delete _0x4a31d1[_0x8daa('0x42')]['id'];}return db[_0x8daa('0x29')]['find']({'where':{'id':_0x4a31d1[_0x8daa('0x3e')]['id']}})[_0x8daa('0x21')](handleEntityNotFound(_0x3e40f5,null))[_0x8daa('0x21')](saveUpdates(_0x4a31d1[_0x8daa('0x42')],null))[_0x8daa('0x21')](respondWithResult(_0x3e40f5,null))['catch'](handleError(_0x3e40f5,null));};exports[_0x8daa('0x22')]=function(_0x33ddf8,_0x5b3ad5){return db['ServicenowField'][_0x8daa('0x43')]({'where':{'id':_0x33ddf8[_0x8daa('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5b3ad5,null))[_0x8daa('0x21')](removeEntity(_0x5b3ad5,null))[_0x8daa('0x40')](handleError(_0x5b3ad5,null));}; \ No newline at end of file +var _0x0d8b=['save','then','destroy','end','error','stack','name','send','index','ServicenowField','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','count','includeAll','findAll','rows','show','params','rawAttributes','length','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','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','json','offset','limit','Content-Range'];(function(_0x70bb8,_0x1da278){var _0x48ba84=function(_0xb567b9){while(--_0xb567b9){_0x70bb8['push'](_0x70bb8['shift']());}};_0x48ba84(++_0x1da278);}(_0x0d8b,0x1e6));var _0xb0d8=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0x0d8b[_0x4702ee];return _0x62ca7d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb0d8('0x0'));var rimraf=require(_0xb0d8('0x1'));var zipdir=require(_0xb0d8('0x2'));var jsonpatch=require(_0xb0d8('0x3'));var rp=require(_0xb0d8('0x4'));var moment=require(_0xb0d8('0x5'));var BPromise=require(_0xb0d8('0x6'));var Mustache=require('mustache');var util=require(_0xb0d8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb0d8('0x8'));var ejs=require(_0xb0d8('0x9'));var fs=require('fs');var _=require(_0xb0d8('0xa'));var squel=require(_0xb0d8('0xb'));var crypto=require(_0xb0d8('0xc'));var jsforce=require(_0xb0d8('0xd'));var deskjs=require(_0xb0d8('0xe'));var toCsv=require(_0xb0d8('0x8'));var querystring=require(_0xb0d8('0xf'));var Papa=require('papaparse');var Redis=require(_0xb0d8('0x10'));var authService=require(_0xb0d8('0x11'));var qs=require(_0xb0d8('0x12'));var as=require(_0xb0d8('0x13'));var hardwareService=require(_0xb0d8('0x14'));var logger=require('../../config/logger')(_0xb0d8('0x15'));var utils=require(_0xb0d8('0x16'));var config=require(_0xb0d8('0x17'));var licenseUtil=require(_0xb0d8('0x18'));var db=require(_0xb0d8('0x19'))['db'];function respondWithStatusCode(_0x1bd3b3,_0x461cec){_0x461cec=_0x461cec||0xcc;return function(_0x2d3763){if(_0x2d3763){return _0x1bd3b3[_0xb0d8('0x1a')](_0x461cec);}return _0x1bd3b3[_0xb0d8('0x1b')](_0x461cec)['end']();};}function respondWithResult(_0x51d290,_0x5af20f){_0x5af20f=_0x5af20f||0xc8;return function(_0x444109){if(_0x444109){return _0x51d290[_0xb0d8('0x1b')](_0x5af20f)[_0xb0d8('0x1c')](_0x444109);}};}function respondWithFilteredResult(_0x2a7ffa,_0x109e40){return function(_0x1ab147){if(_0x1ab147){var _0x198645=_0x1ab147['count'],_0x341678=_0x109e40[_0xb0d8('0x1d')],_0x34fbc3=_0x109e40[_0xb0d8('0x1d')]+_0x109e40[_0xb0d8('0x1e')],_0x326f42;if(_0x34fbc3>=_0x198645){_0x34fbc3=_0x198645;_0x326f42=0xc8;}else{_0x326f42=0xce;}_0x2a7ffa[_0xb0d8('0x1b')](_0x326f42);return _0x2a7ffa['set'](_0xb0d8('0x1f'),_0x341678+'-'+_0x34fbc3+'/'+_0x198645)[_0xb0d8('0x1c')](_0x1ab147);}return null;};}function patchUpdates(_0x2c2947){return function(_0x484bcb){try{jsonpatch['apply'](_0x484bcb,_0x2c2947,!![]);}catch(_0x5b89b2){return BPromise['reject'](_0x5b89b2);}return _0x484bcb[_0xb0d8('0x20')]();};}function saveUpdates(_0x1b2428,_0x2db988){return function(_0x5c5e27){if(_0x5c5e27){return _0x5c5e27['update'](_0x1b2428)[_0xb0d8('0x21')](function(_0x7174fa){return _0x7174fa;});}return null;};}function removeEntity(_0x18e202,_0x481e86){return function(_0xa63793){if(_0xa63793){return _0xa63793[_0xb0d8('0x22')]()[_0xb0d8('0x21')](function(){_0x18e202[_0xb0d8('0x1b')](0xcc)[_0xb0d8('0x23')]();});}};}function handleEntityNotFound(_0x2b504e,_0x52fab8){return function(_0x5a6aab){if(!_0x5a6aab){_0x2b504e[_0xb0d8('0x1a')](0x194);}return _0x5a6aab;};}function handleError(_0x14a553,_0x46b5ab){_0x46b5ab=_0x46b5ab||0x1f4;return function(_0x503bdf){logger[_0xb0d8('0x24')](_0x503bdf[_0xb0d8('0x25')]);if(_0x503bdf[_0xb0d8('0x26')]){delete _0x503bdf['name'];}_0x14a553[_0xb0d8('0x1b')](_0x46b5ab)[_0xb0d8('0x27')](_0x503bdf);};}exports[_0xb0d8('0x28')]=function(_0x45bd09,_0x83d3f2){var _0x427c6f={},_0x17d7f6={},_0x42c467={'count':0x0,'rows':[]};var _0x19277e=_['map'](db[_0xb0d8('0x29')]['rawAttributes'],function(_0x388f99){return{'name':_0x388f99[_0xb0d8('0x2a')],'type':_0x388f99[_0xb0d8('0x2b')][_0xb0d8('0x2c')]};});_0x17d7f6[_0xb0d8('0x2d')]=_['map'](_0x19277e,'name');_0x17d7f6[_0xb0d8('0x2e')]=_[_0xb0d8('0x2f')](_0x45bd09['query']);_0x17d7f6['filters']=_['intersection'](_0x17d7f6['model'],_0x17d7f6[_0xb0d8('0x2e')]);_0x427c6f[_0xb0d8('0x30')]=_[_0xb0d8('0x31')](_0x17d7f6[_0xb0d8('0x2d')],qs['fields'](_0x45bd09[_0xb0d8('0x2e')][_0xb0d8('0x32')]));_0x427c6f[_0xb0d8('0x30')]=_0x427c6f[_0xb0d8('0x30')]['length']?_0x427c6f[_0xb0d8('0x30')]:_0x17d7f6[_0xb0d8('0x2d')];if(!_0x45bd09[_0xb0d8('0x2e')]['hasOwnProperty'](_0xb0d8('0x33'))){_0x427c6f[_0xb0d8('0x1e')]=qs['limit'](_0x45bd09[_0xb0d8('0x2e')]['limit']);_0x427c6f[_0xb0d8('0x1d')]=qs[_0xb0d8('0x1d')](_0x45bd09['query'][_0xb0d8('0x1d')]);}_0x427c6f[_0xb0d8('0x34')]=qs[_0xb0d8('0x35')](_0x45bd09['query']['sort']);_0x427c6f[_0xb0d8('0x36')]=qs[_0xb0d8('0x37')](_['pick'](_0x45bd09['query'],_0x17d7f6[_0xb0d8('0x37')]),_0x19277e);if(_0x45bd09[_0xb0d8('0x2e')][_0xb0d8('0x38')]){_0x427c6f[_0xb0d8('0x36')]=_[_0xb0d8('0x39')](_0x427c6f[_0xb0d8('0x36')],{'$or':_[_0xb0d8('0x3a')](_0x19277e,function(_0x2b1e40){if(_0x2b1e40[_0xb0d8('0x2b')]!==_0xb0d8('0x3b')){var _0xea7cf8={};_0xea7cf8[_0x2b1e40[_0xb0d8('0x26')]]={'$like':'%'+_0x45bd09[_0xb0d8('0x2e')][_0xb0d8('0x38')]+'%'};return _0xea7cf8;}})});}_0x427c6f=_[_0xb0d8('0x39')]({},_0x427c6f,_0x45bd09[_0xb0d8('0x3c')]);var _0x424824={'where':_0x427c6f[_0xb0d8('0x36')]};return db[_0xb0d8('0x29')][_0xb0d8('0x3d')](_0x424824)[_0xb0d8('0x21')](function(_0x15d5af){_0x42c467[_0xb0d8('0x3d')]=_0x15d5af;if(_0x45bd09[_0xb0d8('0x2e')][_0xb0d8('0x3e')]){_0x427c6f['include']=[{'all':!![]}];}return db[_0xb0d8('0x29')][_0xb0d8('0x3f')](_0x427c6f);})[_0xb0d8('0x21')](function(_0x2c53c7){_0x42c467[_0xb0d8('0x40')]=_0x2c53c7;return _0x42c467;})[_0xb0d8('0x21')](respondWithFilteredResult(_0x83d3f2,_0x427c6f))['catch'](handleError(_0x83d3f2,null));};exports[_0xb0d8('0x41')]=function(_0xdcb7b2,_0x68f363){var _0x2f13f7={'raw':!![],'where':{'id':_0xdcb7b2[_0xb0d8('0x42')]['id']}},_0x556d9b={};_0x556d9b[_0xb0d8('0x2d')]=_[_0xb0d8('0x2f')](db[_0xb0d8('0x29')][_0xb0d8('0x43')]);_0x556d9b[_0xb0d8('0x2e')]=_[_0xb0d8('0x2f')](_0xdcb7b2[_0xb0d8('0x2e')]);_0x556d9b[_0xb0d8('0x37')]=_[_0xb0d8('0x31')](_0x556d9b[_0xb0d8('0x2d')],_0x556d9b[_0xb0d8('0x2e')]);_0x2f13f7[_0xb0d8('0x30')]=_['intersection'](_0x556d9b[_0xb0d8('0x2d')],qs[_0xb0d8('0x32')](_0xdcb7b2[_0xb0d8('0x2e')][_0xb0d8('0x32')]));_0x2f13f7[_0xb0d8('0x30')]=_0x2f13f7[_0xb0d8('0x30')][_0xb0d8('0x44')]?_0x2f13f7['attributes']:_0x556d9b['model'];if(_0xdcb7b2[_0xb0d8('0x2e')][_0xb0d8('0x3e')]){_0x2f13f7['include']=[{'all':!![]}];}_0x2f13f7=_[_0xb0d8('0x39')]({},_0x2f13f7,_0xdcb7b2['options']);return db[_0xb0d8('0x29')]['find'](_0x2f13f7)[_0xb0d8('0x21')](handleEntityNotFound(_0x68f363,null))[_0xb0d8('0x21')](respondWithResult(_0x68f363,null))[_0xb0d8('0x45')](handleError(_0x68f363,null));};exports[_0xb0d8('0x46')]=function(_0x24863a,_0x22b229){return db[_0xb0d8('0x29')]['create'](_0x24863a[_0xb0d8('0x47')],{})['then'](respondWithResult(_0x22b229,0xc9))[_0xb0d8('0x45')](handleError(_0x22b229,null));};exports[_0xb0d8('0x48')]=function(_0x241704,_0x4c77af){if(_0x241704[_0xb0d8('0x47')]['id']){delete _0x241704[_0xb0d8('0x47')]['id'];}return db['ServicenowField'][_0xb0d8('0x49')]({'where':{'id':_0x241704['params']['id']}})['then'](handleEntityNotFound(_0x4c77af,null))[_0xb0d8('0x21')](saveUpdates(_0x241704[_0xb0d8('0x47')],null))[_0xb0d8('0x21')](respondWithResult(_0x4c77af,null))[_0xb0d8('0x45')](handleError(_0x4c77af,null));};exports[_0xb0d8('0x22')]=function(_0x35e011,_0x5780ec){return db['ServicenowField']['find']({'where':{'id':_0x35e011[_0xb0d8('0x42')]['id']}})['then'](handleEntityNotFound(_0x5780ec,null))[_0xb0d8('0x21')](removeEntity(_0x5780ec,null))[_0xb0d8('0x45')](handleError(_0x5780ec,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 35a5a20..768cedc 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 _0x9d8c=['rimraf','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x55ca6c,_0x57154a){var _0x2cbda9=function(_0x54c0b5){while(--_0x54c0b5){_0x55ca6c['push'](_0x55ca6c['shift']());}};_0x2cbda9(++_0x57154a);}(_0x9d8c,0x162));var _0xc9d8=function(_0x5509b5,_0x4dd802){_0x5509b5=_0x5509b5-0x0;var _0x27c70c=_0x9d8c[_0x5509b5];return _0x27c70c;};'use strict';var _=require(_0xc9d8('0x0'));var util=require('util');var logger=require(_0xc9d8('0x1'))(_0xc9d8('0x2'));var moment=require(_0xc9d8('0x3'));var BPromise=require('bluebird');var rp=require(_0xc9d8('0x4'));var fs=require('fs');var path=require(_0xc9d8('0x5'));var rimraf=require(_0xc9d8('0x6'));var config=require(_0xc9d8('0x7'));var attributes=require('./intServicenowField.attributes');module[_0xc9d8('0x8')]=function(_0x40855,_0x5adfb2){return _0x40855[_0xc9d8('0x9')](_0xc9d8('0xa'),attributes,{'tableName':_0xc9d8('0xb'),'paranoid':![],'indexes':[{'name':_0xc9d8('0xc'),'fields':[_0xc9d8('0xd'),_0xc9d8('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf030=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intServicenowField.attributes','define'];(function(_0x5f4c54,_0x18da5d){var _0x290e40=function(_0x3ff1df){while(--_0x3ff1df){_0x5f4c54['push'](_0x5f4c54['shift']());}};_0x290e40(++_0x18da5d);}(_0xf030,0xf3));var _0x0f03=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf030[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0f03('0x0'));var util=require(_0x0f03('0x1'));var logger=require(_0x0f03('0x2'))(_0x0f03('0x3'));var moment=require(_0x0f03('0x4'));var BPromise=require(_0x0f03('0x5'));var rp=require(_0x0f03('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0f03('0x7'));module['exports']=function(_0x3eb2f7,_0xa4ae88){return _0x3eb2f7[_0x0f03('0x8')](_0x0f03('0x9'),attributes,{'tableName':_0x0f03('0xa'),'paranoid':![],'indexes':[{'name':_0x0f03('0xb'),'fields':[_0x0f03('0xc'),_0x0f03('0xd')],'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 5c50764..874023a 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 _0xc57d=['then','ServicenowField,\x20%s,\x20%s','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','rpc','jayson/promise','request'];(function(_0x5edb15,_0x16b365){var _0xa3f0d9=function(_0x4fde1b){while(--_0x4fde1b){_0x5edb15['push'](_0x5edb15['shift']());}};_0xa3f0d9(++_0x16b365);}(_0xc57d,0x1e6));var _0xdc57=function(_0x44e06d,_0x51d67b){_0x44e06d=_0x44e06d-0x0;var _0x5d9b10=_0xc57d[_0x44e06d];return _0x5d9b10;};'use strict';var _=require(_0xdc57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdc57('0x1'));var rs=require(_0xdc57('0x2'));var fs=require('fs');var Redis=require(_0xdc57('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdc57('0x4'));var config=require('../../config/environment');var jayson=require(_0xdc57('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x592c7f,_0x29e0c9,_0x5eeeec){return new BPromise(function(_0x41b33d,_0x3ca3d5){return client[_0xdc57('0x6')](_0x592c7f,_0x5eeeec)[_0xdc57('0x7')](function(_0xc9e129){logger['info'](_0xdc57('0x8'),_0x29e0c9,'request\x20sent');logger['debug'](_0xdc57('0x9'),_0x29e0c9,_0xdc57('0xa'),JSON[_0xdc57('0xb')](_0xc9e129));if(_0xc9e129[_0xdc57('0xc')]){if(_0xc9e129[_0xdc57('0xc')][_0xdc57('0xd')]===0x1f4){logger[_0xdc57('0xc')](_0xdc57('0x8'),_0x29e0c9,_0xc9e129[_0xdc57('0xc')][_0xdc57('0xe')]);return _0x3ca3d5(_0xc9e129[_0xdc57('0xc')][_0xdc57('0xe')]);}logger[_0xdc57('0xc')](_0xdc57('0x8'),_0x29e0c9,_0xc9e129[_0xdc57('0xc')][_0xdc57('0xe')]);return _0x41b33d(_0xc9e129[_0xdc57('0xc')]['message']);}else{logger[_0xdc57('0xf')]('ServicenowField,\x20%s,\x20%s',_0x29e0c9,_0xdc57('0xa'));_0x41b33d(_0xc9e129[_0xdc57('0x10')]['message']);}})['catch'](function(_0x201137){logger[_0xdc57('0xc')](_0xdc57('0x8'),_0x29e0c9,_0x201137);_0x3ca3d5(_0x201137);});});} \ No newline at end of file +var _0xa54d=['request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xa54d,0x1e7));var _0xda54=function(_0x50b0eb,_0x1f1454){_0x50b0eb=_0x50b0eb-0x0;var _0x5165aa=_0xa54d[_0x50b0eb];return _0x5165aa;};'use strict';var _=require(_0xda54('0x0'));var util=require(_0xda54('0x1'));var moment=require(_0xda54('0x2'));var BPromise=require(_0xda54('0x3'));var rs=require(_0xda54('0x4'));var fs=require('fs');var Redis=require(_0xda54('0x5'));var db=require(_0xda54('0x6'))['db'];var utils=require(_0xda54('0x7'));var logger=require(_0xda54('0x8'))(_0xda54('0x9'));var config=require(_0xda54('0xa'));var jayson=require(_0xda54('0xb'));var client=jayson['client'][_0xda54('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x670bb0,_0x114819,_0x5a3d78){return new BPromise(function(_0x47408c,_0xf8060e){return client[_0xda54('0xd')](_0x670bb0,_0x5a3d78)[_0xda54('0xe')](function(_0x3dc708){logger[_0xda54('0xf')](_0xda54('0x10'),_0x114819,_0xda54('0x11'));logger[_0xda54('0x12')](_0xda54('0x13'),_0x114819,'request\x20sent',JSON['stringify'](_0x3dc708));if(_0x3dc708[_0xda54('0x14')]){if(_0x3dc708['error'][_0xda54('0x15')]===0x1f4){logger['error'](_0xda54('0x10'),_0x114819,_0x3dc708[_0xda54('0x14')]['message']);return _0xf8060e(_0x3dc708[_0xda54('0x14')][_0xda54('0x16')]);}logger[_0xda54('0x14')](_0xda54('0x10'),_0x114819,_0x3dc708[_0xda54('0x14')][_0xda54('0x16')]);return _0x47408c(_0x3dc708['error'][_0xda54('0x16')]);}else{logger[_0xda54('0xf')]('ServicenowField,\x20%s,\x20%s',_0x114819,_0xda54('0x11'));_0x47408c(_0x3dc708[_0xda54('0x17')][_0xda54('0x16')]);}})[_0xda54('0x18')](function(_0x5cdd18){logger[_0xda54('0x14')]('ServicenowField,\x20%s,\x20%s',_0x114819,_0x5cdd18);_0xf8060e(_0x5cdd18);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 520b034..1fad374 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 _0x6002=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','put','update','delete','/:id','multer'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x6002,0x103));var _0x2600=function(_0x38a040,_0x1cb9c3){_0x38a040=_0x38a040-0x0;var _0x50e92f=_0x6002[_0x38a040];return _0x50e92f;};'use strict';var multer=require(_0x2600('0x0'));var util=require(_0x2600('0x1'));var path=require('path');var timeout=require(_0x2600('0x2'));var express=require(_0x2600('0x3'));var router=express['Router']();var auth=require(_0x2600('0x4'));var interaction=require(_0x2600('0x5'));var config=require(_0x2600('0x6'));var controller=require('./intSugarcrmAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2600('0x7')]);router[_0x2600('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0x2600('0x9')](),controller[_0x2600('0xa')]);router[_0x2600('0x8')](_0x2600('0xb'),auth[_0x2600('0x9')](),controller[_0x2600('0xc')]);router['post']('/',auth[_0x2600('0x9')](),controller[_0x2600('0xd')]);router[_0x2600('0xe')](_0x2600('0xf'),auth[_0x2600('0x9')](),controller['addConfiguration']);router[_0x2600('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2600('0x11')]);router[_0x2600('0x12')](_0x2600('0x13'),auth[_0x2600('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xee39=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','post','addConfiguration','put','/:id','update'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xee39,0x1e6));var _0x9ee3=function(_0x2d7c67,_0x358a79){_0x2d7c67=_0x2d7c67-0x0;var _0x523bd4=_0xee39[_0x2d7c67];return _0x523bd4;};'use strict';var multer=require(_0x9ee3('0x0'));var util=require(_0x9ee3('0x1'));var path=require(_0x9ee3('0x2'));var timeout=require('connect-timeout');var express=require(_0x9ee3('0x3'));var router=express[_0x9ee3('0x4')]();var auth=require(_0x9ee3('0x5'));var interaction=require(_0x9ee3('0x6'));var config=require(_0x9ee3('0x7'));var controller=require(_0x9ee3('0x8'));router[_0x9ee3('0x9')]('/',auth[_0x9ee3('0xa')](),controller[_0x9ee3('0xb')]);router[_0x9ee3('0x9')]('/:id',auth[_0x9ee3('0xa')](),controller[_0x9ee3('0xc')]);router[_0x9ee3('0x9')]('/:id/configurations',auth[_0x9ee3('0xa')](),controller['getConfigurations']);router[_0x9ee3('0x9')]('/:id/fields',auth[_0x9ee3('0xa')](),controller['getFields']);router['post']('/',auth[_0x9ee3('0xa')](),controller['create']);router[_0x9ee3('0xd')]('/:id/configurations',auth[_0x9ee3('0xa')](),controller[_0x9ee3('0xe')]);router[_0x9ee3('0xf')](_0x9ee3('0x10'),auth[_0x9ee3('0xa')](),controller[_0x9ee3('0x11')]);router[_0x9ee3('0x12')]('/:id',auth[_0x9ee3('0xa')](),controller[_0x9ee3('0x13')]);module[_0x9ee3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 5b16b42..b707240 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 _0x999d=['username','sequelize','exports','STRING'];(function(_0x4192eb,_0x3c0a8d){var _0xc728cc=function(_0x5e4ed3){while(--_0x5e4ed3){_0x4192eb['push'](_0x4192eb['shift']());}};_0xc728cc(++_0x3c0a8d);}(_0x999d,0x105));var _0xd999=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0x999d[_0x40ebff];return _0x40122a;};'use strict';var Sequelize=require(_0xd999('0x0'));module[_0xd999('0x1')]={'name':{'type':Sequelize[_0xd999('0x2')]},'description':{'type':Sequelize[_0xd999('0x2')]},'username':{'type':Sequelize[_0xd999('0x2')],'unique':_0xd999('0x3')},'password':{'type':Sequelize[_0xd999('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd999('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x96d0=['exports','STRING','sequelize'];(function(_0x53b9e2,_0x5e3769){var _0x4cf430=function(_0x1fd66e){while(--_0x1fd66e){_0x53b9e2['push'](_0x53b9e2['shift']());}};_0x4cf430(++_0x5e3769);}(_0x96d0,0x80));var _0x096d=function(_0x1d4976,_0x2a2dfe){_0x1d4976=_0x1d4976-0x0;var _0x3e0c40=_0x96d0[_0x1d4976];return _0x3e0c40;};'use strict';var Sequelize=require(_0x096d('0x0'));module[_0x096d('0x1')]={'name':{'type':Sequelize[_0x096d('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x096d('0x2')]},'remoteUri':{'type':Sequelize[_0x096d('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x096d('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index e9bfc50..3554b4d 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 _0x1618=['options','includeAll','include','show','create','body','find','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','format','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','then','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','end','status','json','count','offset','set','Content-Range','reject','save','update','sendStatus','stack','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','filter','where','merge','VIRTUAL'];(function(_0x5549f3,_0x3bcfb3){var _0x47bd21=function(_0x319e6e){while(--_0x319e6e){_0x5549f3['push'](_0x5549f3['shift']());}};_0x47bd21(++_0x3bcfb3);}(_0x1618,0xbe));var _0x8161=function(_0x5282c7,_0x2b2309){_0x5282c7=_0x5282c7-0x0;var _0x3c45a5=_0x1618[_0x5282c7];return _0x3c45a5;};'use strict';var pdf=require(_0x8161('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8161('0x1'));var zipdir=require(_0x8161('0x2'));var jsonpatch=require(_0x8161('0x3'));var rp=require(_0x8161('0x4'));var moment=require(_0x8161('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8161('0x6'));var util=require(_0x8161('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8161('0x8'));var ejs=require(_0x8161('0x9'));var fs=require('fs');var _=require(_0x8161('0xa'));var squel=require(_0x8161('0xb'));var crypto=require(_0x8161('0xc'));var jsforce=require(_0x8161('0xd'));var deskjs=require(_0x8161('0xe'));var toCsv=require(_0x8161('0x8'));var querystring=require(_0x8161('0xf'));var Papa=require(_0x8161('0x10'));var Redis=require(_0x8161('0x11'));var authService=require(_0x8161('0x12'));var qs=require(_0x8161('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8161('0x14'));var logger=require(_0x8161('0x15'))(_0x8161('0x16'));var utils=require(_0x8161('0x17'));var config=require(_0x8161('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8161('0x19'))['db'];var integrations=require(_0x8161('0x1a'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x133f13,_0xae10e9,_0x3e3df4,_0xb55602){return new BPromise(function(_0x14b8b1,_0x37aa65){var _0xa653f3=_0xb55602||client;return _0xa653f3['request'](_0x133f13,_0x3e3df4)[_0x8161('0x1b')](function(_0x54ec87){logger['info'](_0x8161('0x1c'),_0xae10e9,'request\x20sent');logger[_0x8161('0x1d')](_0x8161('0x1e'),_0xae10e9,_0x8161('0x1f'),JSON['stringify'](_0x54ec87));if(_0x54ec87['error']){if(_0x54ec87[_0x8161('0x20')][_0x8161('0x21')]===0x1f4){logger[_0x8161('0x20')]('SugarcrmAccount,\x20%s,\x20%s',_0xae10e9,_0x54ec87[_0x8161('0x20')][_0x8161('0x22')]);return _0x37aa65(_0x54ec87[_0x8161('0x20')][_0x8161('0x22')]);}logger['error'](_0x8161('0x1c'),_0xae10e9,_0x54ec87['error'][_0x8161('0x22')]);return _0x14b8b1(_0x54ec87[_0x8161('0x20')][_0x8161('0x22')]);}else{logger[_0x8161('0x23')](_0x8161('0x1c'),_0xae10e9,'request\x20sent');_0x14b8b1(_0x54ec87[_0x8161('0x24')][_0x8161('0x22')]);}})[_0x8161('0x25')](function(_0x2cdd13){logger['error'](_0x8161('0x1c'),_0xae10e9,_0x2cdd13);_0x37aa65(_0x2cdd13);});});}function respondWithStatusCode(_0x5d3aff,_0x5c484c){_0x5c484c=_0x5c484c||0xcc;return function(_0x1ce7d5){if(_0x1ce7d5){return _0x5d3aff['sendStatus'](_0x5c484c);}return _0x5d3aff['status'](_0x5c484c)[_0x8161('0x26')]();};}function respondWithResult(_0x5e5cf1,_0x43633d){_0x43633d=_0x43633d||0xc8;return function(_0x146302){if(_0x146302){return _0x5e5cf1[_0x8161('0x27')](_0x43633d)[_0x8161('0x28')](_0x146302);}};}function respondWithFilteredResult(_0x31769d,_0x988224){return function(_0x5ea250){if(_0x5ea250){var _0x52b114=_0x5ea250[_0x8161('0x29')],_0x5aca50=_0x988224[_0x8161('0x2a')],_0x3dc9a3=_0x988224[_0x8161('0x2a')]+_0x988224['limit'],_0x54590a;if(_0x3dc9a3>=_0x52b114){_0x3dc9a3=_0x52b114;_0x54590a=0xc8;}else{_0x54590a=0xce;}_0x31769d['status'](_0x54590a);return _0x31769d[_0x8161('0x2b')](_0x8161('0x2c'),_0x5aca50+'-'+_0x3dc9a3+'/'+_0x52b114)[_0x8161('0x28')](_0x5ea250);}return null;};}function patchUpdates(_0x293f36){return function(_0x3ba665){try{jsonpatch['apply'](_0x3ba665,_0x293f36,!![]);}catch(_0x2c6d69){return BPromise[_0x8161('0x2d')](_0x2c6d69);}return _0x3ba665[_0x8161('0x2e')]();};}function saveUpdates(_0x311751,_0x362ef4){return function(_0xb8d211){if(_0xb8d211){return _0xb8d211[_0x8161('0x2f')](_0x311751)[_0x8161('0x1b')](function(_0x45a4ea){return _0x45a4ea;});}return null;};}function removeEntity(_0x4f0276,_0x456d43){return function(_0x145c21){if(_0x145c21){return _0x145c21['destroy']()[_0x8161('0x1b')](function(){_0x4f0276[_0x8161('0x27')](0xcc)[_0x8161('0x26')]();});}};}function handleEntityNotFound(_0x46cb8d,_0x33b0bf){return function(_0x1c2892){if(!_0x1c2892){_0x46cb8d[_0x8161('0x30')](0x194);}return _0x1c2892;};}function handleError(_0x57080e,_0x1377f4){_0x1377f4=_0x1377f4||0x1f4;return function(_0x79f95b){logger['error'](_0x79f95b[_0x8161('0x31')]);if(_0x79f95b['name']){delete _0x79f95b['name'];}_0x57080e['status'](_0x1377f4)[_0x8161('0x32')](_0x79f95b);};}exports[_0x8161('0x33')]=function(_0x1bfaea,_0x51405e){var _0x70392d={},_0xb9735a={},_0x2b2383={'count':0x0,'rows':[]};var _0x5d5373=_[_0x8161('0x34')](db[_0x8161('0x35')][_0x8161('0x36')],function(_0x1ec2f3){return{'name':_0x1ec2f3[_0x8161('0x37')],'type':_0x1ec2f3[_0x8161('0x38')][_0x8161('0x39')]};});_0xb9735a[_0x8161('0x3a')]=_[_0x8161('0x34')](_0x5d5373,_0x8161('0x3b'));_0xb9735a[_0x8161('0x3c')]=_[_0x8161('0x3d')](_0x1bfaea[_0x8161('0x3c')]);_0xb9735a[_0x8161('0x3e')]=_[_0x8161('0x3f')](_0xb9735a[_0x8161('0x3a')],_0xb9735a['query']);_0x70392d[_0x8161('0x40')]=_[_0x8161('0x3f')](_0xb9735a[_0x8161('0x3a')],qs[_0x8161('0x41')](_0x1bfaea[_0x8161('0x3c')]['fields']));_0x70392d[_0x8161('0x40')]=_0x70392d[_0x8161('0x40')][_0x8161('0x42')]?_0x70392d['attributes']:_0xb9735a['model'];if(!_0x1bfaea[_0x8161('0x3c')][_0x8161('0x43')](_0x8161('0x44'))){_0x70392d['limit']=qs['limit'](_0x1bfaea[_0x8161('0x3c')][_0x8161('0x45')]);_0x70392d['offset']=qs[_0x8161('0x2a')](_0x1bfaea[_0x8161('0x3c')][_0x8161('0x2a')]);}_0x70392d[_0x8161('0x46')]=qs['sort'](_0x1bfaea['query']['sort']);_0x70392d['where']=qs[_0x8161('0x3e')](_[_0x8161('0x47')](_0x1bfaea['query'],_0xb9735a[_0x8161('0x3e')]),_0x5d5373);if(_0x1bfaea[_0x8161('0x3c')][_0x8161('0x48')]){_0x70392d[_0x8161('0x49')]=_[_0x8161('0x4a')](_0x70392d[_0x8161('0x49')],{'$or':_['map'](_0x5d5373,function(_0x335d5a){if(_0x335d5a[_0x8161('0x38')]!==_0x8161('0x4b')){var _0x53cb78={};_0x53cb78[_0x335d5a[_0x8161('0x3b')]]={'$like':'%'+_0x1bfaea[_0x8161('0x3c')]['filter']+'%'};return _0x53cb78;}})});}_0x70392d=_['merge']({},_0x70392d,_0x1bfaea[_0x8161('0x4c')]);var _0x152b27={'where':_0x70392d[_0x8161('0x49')]};return db['SugarcrmAccount'][_0x8161('0x29')](_0x152b27)[_0x8161('0x1b')](function(_0x2f43a6){_0x2b2383[_0x8161('0x29')]=_0x2f43a6;if(_0x1bfaea[_0x8161('0x3c')][_0x8161('0x4d')]){_0x70392d[_0x8161('0x4e')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x70392d);})[_0x8161('0x1b')](function(_0x177e82){_0x2b2383['rows']=_0x177e82;return _0x2b2383;})[_0x8161('0x1b')](respondWithFilteredResult(_0x51405e,_0x70392d))[_0x8161('0x25')](handleError(_0x51405e,null));};exports[_0x8161('0x4f')]=function(_0x2e593a,_0x4a1bd4){var _0x17a870={'raw':![],'where':{'id':_0x2e593a['params']['id']}},_0x5cb129={};_0x5cb129[_0x8161('0x3a')]=_[_0x8161('0x3d')](db[_0x8161('0x35')][_0x8161('0x36')]);_0x5cb129[_0x8161('0x3c')]=_['keys'](_0x2e593a['query']);_0x5cb129[_0x8161('0x3e')]=_[_0x8161('0x3f')](_0x5cb129['model'],_0x5cb129[_0x8161('0x3c')]);_0x17a870['attributes']=_[_0x8161('0x3f')](_0x5cb129[_0x8161('0x3a')],qs['fields'](_0x2e593a[_0x8161('0x3c')]['fields']));_0x17a870[_0x8161('0x40')]=_0x17a870[_0x8161('0x40')]['length']?_0x17a870[_0x8161('0x40')]:_0x5cb129['model'];if(_0x2e593a['query'][_0x8161('0x4d')]){_0x17a870[_0x8161('0x4e')]=[{'all':!![]}];}_0x17a870=_[_0x8161('0x4a')]({},_0x17a870,_0x2e593a[_0x8161('0x4c')]);return db[_0x8161('0x35')]['find'](_0x17a870)[_0x8161('0x1b')](handleEntityNotFound(_0x4a1bd4,null))[_0x8161('0x1b')](respondWithResult(_0x4a1bd4,null))[_0x8161('0x25')](handleError(_0x4a1bd4,null));};exports['create']=function(_0x2ff3e8,_0x3e9f2d){return db[_0x8161('0x35')][_0x8161('0x50')](_0x2ff3e8[_0x8161('0x51')],{})[_0x8161('0x1b')](respondWithResult(_0x3e9f2d,0xc9))[_0x8161('0x25')](handleError(_0x3e9f2d,null));};exports[_0x8161('0x2f')]=function(_0xc85595,_0x46ba61){if(_0xc85595['body']['id']){delete _0xc85595[_0x8161('0x51')]['id'];}return db[_0x8161('0x35')][_0x8161('0x52')]({'where':{'id':_0xc85595[_0x8161('0x53')]['id']}})['then'](handleEntityNotFound(_0x46ba61,null))[_0x8161('0x1b')](saveUpdates(_0xc85595[_0x8161('0x51')],null))['then'](respondWithResult(_0x46ba61,null))['catch'](handleError(_0x46ba61,null));};exports['destroy']=function(_0x45bc34,_0x14c7bb){return db['SugarcrmAccount'][_0x8161('0x52')]({'where':{'id':_0x45bc34[_0x8161('0x53')]['id']}})[_0x8161('0x1b')](handleEntityNotFound(_0x14c7bb,null))[_0x8161('0x1b')](removeEntity(_0x14c7bb,null))[_0x8161('0x25')](handleError(_0x14c7bb,null));};exports[_0x8161('0x54')]=function(_0x6cb8c6,_0xb25eff,_0x315a00){var _0x178263={};var _0x4c1c6c={};var _0x36a672;var _0x503b08;return db[_0x8161('0x35')][_0x8161('0x55')]({'where':{'id':_0x6cb8c6['params']['id']}})['then'](handleEntityNotFound(_0xb25eff,null))[_0x8161('0x1b')](function(_0x4cf9ff){if(_0x4cf9ff){_0x36a672=_0x4cf9ff;_0x4c1c6c[_0x8161('0x3a')]=_['keys'](db[_0x8161('0x56')][_0x8161('0x36')]);_0x4c1c6c['query']=_[_0x8161('0x3d')](_0x6cb8c6[_0x8161('0x3c')]);_0x4c1c6c['filters']=_[_0x8161('0x3f')](_0x4c1c6c[_0x8161('0x3a')],_0x4c1c6c['query']);_0x178263[_0x8161('0x40')]=_[_0x8161('0x3f')](_0x4c1c6c['model'],qs[_0x8161('0x41')](_0x6cb8c6[_0x8161('0x3c')][_0x8161('0x41')]));_0x178263[_0x8161('0x40')]=_0x178263[_0x8161('0x40')]['length']?_0x178263[_0x8161('0x40')]:_0x4c1c6c[_0x8161('0x3a')];_0x178263[_0x8161('0x46')]=qs['sort'](_0x6cb8c6[_0x8161('0x3c')]['sort']);_0x178263['where']=qs[_0x8161('0x3e')](_[_0x8161('0x47')](_0x6cb8c6[_0x8161('0x3c')],_0x4c1c6c[_0x8161('0x3e')]));if(_0x6cb8c6[_0x8161('0x3c')][_0x8161('0x48')]){_0x178263['where']=_['merge'](_0x178263[_0x8161('0x49')],{'$or':_[_0x8161('0x34')](_0x178263[_0x8161('0x40')],function(_0x398053){var _0x406089={};_0x406089[_0x398053]={'$like':'%'+_0x6cb8c6[_0x8161('0x3c')]['filter']+'%'};return _0x406089;})});}_0x178263=_[_0x8161('0x4a')]({},_0x178263,_0x6cb8c6[_0x8161('0x4c')]);return _0x36a672[_0x8161('0x54')](_0x178263);}})[_0x8161('0x1b')](function(_0x2295c9){if(_0x2295c9){_0x503b08=_0x2295c9[_0x8161('0x42')];if(!_0x6cb8c6[_0x8161('0x3c')][_0x8161('0x43')](_0x8161('0x44'))){_0x178263[_0x8161('0x45')]=qs[_0x8161('0x45')](_0x6cb8c6[_0x8161('0x3c')][_0x8161('0x45')]);_0x178263[_0x8161('0x2a')]=qs[_0x8161('0x2a')](_0x6cb8c6[_0x8161('0x3c')][_0x8161('0x2a')]);}return _0x36a672[_0x8161('0x54')](_0x178263);}})[_0x8161('0x1b')](function(_0x563dae){if(_0x563dae){return _0x563dae?{'count':_0x503b08,'rows':_0x563dae}:null;}})[_0x8161('0x1b')](respondWithResult(_0xb25eff,null))[_0x8161('0x25')](handleError(_0xb25eff,null));};exports[_0x8161('0x57')]=function(_0xf7c035,_0x395035,_0x17a8f0){if(_0xf7c035['body']['id']){delete _0xf7c035[_0x8161('0x51')]['id'];}return db[_0x8161('0x35')][_0x8161('0x55')]({'where':{'id':_0xf7c035[_0x8161('0x53')]['id']}})[_0x8161('0x1b')](handleEntityNotFound(_0x395035,null))['then'](function(_0x2142cd){if(_0x2142cd){_0xf7c035[_0x8161('0x51')][_0x8161('0x58')]=_0x2142cd['id'];_0xf7c035[_0x8161('0x51')][_0x8161('0x59')]=integrations[_0x8161('0x5a')](_0xf7c035['body']['channel'],_0xf7c035[_0x8161('0x51')][_0x8161('0x38')]);_0xf7c035[_0x8161('0x51')][_0x8161('0x5b')]=integrations[_0x8161('0x5c')](_0xf7c035[_0x8161('0x51')][_0x8161('0x5d')],_0xf7c035[_0x8161('0x51')]['type']);return db['SugarcrmConfiguration']['create'](_0xf7c035['body'],{'include':[{'model':db[_0x8161('0x5e')],'as':_0x8161('0x59')},{'model':db[_0x8161('0x5e')],'as':_0x8161('0x5b')}]});}return null;})[_0x8161('0x1b')](respondWithResult(_0x395035,null))[_0x8161('0x25')](handleError(_0x395035,null));};exports['getFields']=function(_0x23b4cb,_0x57a177,_0x21ed54){var _0x4b419f='';var _0x7ca4d=['id',_0x8161('0x3b'),_0x8161('0x5f'),_0x8161('0x60'),_0x8161('0x61'),'date_start',_0x8161('0x62'),_0x8161('0x63'),_0x8161('0x64'),_0x8161('0x65'),_0x8161('0x66'),_0x8161('0x67')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x23b4cb['params']['id']},'attributes':['id',_0x8161('0x68'),_0x8161('0x69'),_0x8161('0x6a')]})[_0x8161('0x1b')](handleEntityNotFound(_0x57a177,null))['then'](function(_0x1fbffa){if(_0x1fbffa){_0x4b419f=_0x1fbffa[_0x8161('0x6a')];var _0x4eed4d=_0x4b419f[_0x8161('0x6b')](-0x1);if(_0x4eed4d==='/'){_0x4b419f=_0x4b419f[_0x8161('0x6c')](0x0,_0x4b419f['lastIndexOf'](_0x4eed4d));}return rp({'method':_0x8161('0x6d'),'uri':util[_0x8161('0x6e')](_0x8161('0x6f'),_0x4b419f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x8161('0x70'),'input_type':'JSON','response_type':_0x8161('0x71'),'rest_data':JSON[_0x8161('0x72')]({'user_auth':{'user_name':_0x1fbffa[_0x8161('0x68')],'password':_0x1fbffa[_0x8161('0x69')],'encryption':_0x8161('0x73')},'application':_0x8161('0x74')})}});}})[_0x8161('0x1b')](function(_0x161d23){if(_0x161d23&&_0x161d23[_0x8161('0x3b')]!==_0x8161('0x75')&&_0x161d23[_0x8161('0x3b')]!=='Password\x20Expired'){return rp({'method':_0x8161('0x6d'),'uri':util[_0x8161('0x6e')](_0x8161('0x6f'),_0x4b419f,_0x8161('0x76')),'json':!![],'form':{'method':_0x8161('0x77'),'input_type':_0x8161('0x71'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x161d23['id'],'module_name':_0x8161('0x78')})}})[_0x8161('0x1b')](function(_0x45c176){if(_0x45c176){var _0x2d91ad=_[_0x8161('0x79')](_0x45c176[_0x8161('0x7a')]);_[_0x8161('0x7b')](_0x2d91ad,function(_0x26da10){return _0x7ca4d[_0x8161('0x7c')](_0x26da10['name']);});return{'count':_0x2d91ad[_0x8161('0x42')],'rows':_['map'](_0x2d91ad,function(_0x560be1){return{'id':_0x560be1[_0x8161('0x3b')],'name':_0x560be1[_0x8161('0x7d')],'custom':_[_0x8161('0x7e')](_0x560be1['name'],'_c')?!![]:![],'options':_0x560be1[_0x8161('0x4c')]?_['map'](_[_0x8161('0x79')](_0x560be1[_0x8161('0x4c')]),function(_0x219a2d){return{'name':_0x219a2d[_0x8161('0x7f')],'value':_0x219a2d[_0x8161('0x3b')]};}):[]};})};}})[_0x8161('0x1b')](respondWithResult(_0x57a177,null))[_0x8161('0x25')](function(_0x5baf70){var _0x401803=_0x23b4cb[_0x8161('0x3c')][_0x8161('0x80')]?0x1f4:_0x5baf70[_0x8161('0x81')]||0x1f4;logger[_0x8161('0x20')](_0x8161('0x82'),_0x8161('0x83'),_0x401803,JSON[_0x8161('0x72')](_0x5baf70));delete _0x5baf70[_0x8161('0x3b')];if(_0x401803===0x191){_0x401803=0x190;}_0x57a177[_0x8161('0x27')](_0x401803)[_0x8161('0x32')](_0x23b4cb[_0x8161('0x3c')][_0x8161('0x80')]?{'message':_0x8161('0x84'),'statusCode':_0x5baf70[_0x8161('0x81')]}:_0x5baf70);});}else{var _0x4aabfb=0x1f4;_0x57a177[_0x8161('0x27')](_0x4aabfb)[_0x8161('0x32')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xcedf=['json','offset','set','apply','reject','destroy','sendStatus','stack','name','send','index','map','SugarcrmAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','nolimit','limit','filter','where','merge','VIRTUAL','count','includeAll','include','rows','show','params','rawAttributes','fields','options','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','order','sort','pick','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_name','direction','username','remoteUri','slice','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','POST','get_module_fields','values','module_fields','remove','includes','label','endsWith','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','jsforce','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','../../components/integrations/configuration','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','info','result','catch','status','end'];(function(_0x26e372,_0x5c1c57){var _0x5c2ae6=function(_0x286d8d){while(--_0x286d8d){_0x26e372['push'](_0x26e372['shift']());}};_0x5c2ae6(++_0x5c1c57);}(_0xcedf,0x15b));var _0xfced=function(_0x4bb916,_0x3119d0){_0x4bb916=_0x4bb916-0x0;var _0x47f238=_0xcedf[_0x4bb916];return _0x47f238;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfced('0x0'));var rimraf=require(_0xfced('0x1'));var zipdir=require(_0xfced('0x2'));var jsonpatch=require(_0xfced('0x3'));var rp=require(_0xfced('0x4'));var moment=require(_0xfced('0x5'));var BPromise=require(_0xfced('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfced('0x7'));var sox=require(_0xfced('0x8'));var csv=require('to-csv');var ejs=require(_0xfced('0x9'));var fs=require('fs');var _=require(_0xfced('0xa'));var squel=require(_0xfced('0xb'));var crypto=require('crypto');var jsforce=require(_0xfced('0xc'));var deskjs=require(_0xfced('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfced('0xe'));var Papa=require('papaparse');var Redis=require(_0xfced('0xf'));var authService=require(_0xfced('0x10'));var qs=require(_0xfced('0x11'));var as=require(_0xfced('0x12'));var hardwareService=require(_0xfced('0x13'));var logger=require(_0xfced('0x14'))(_0xfced('0x15'));var utils=require(_0xfced('0x16'));var config=require(_0xfced('0x17'));var licenseUtil=require(_0xfced('0x18'));var db=require(_0xfced('0x19'))['db'];var integrations=require(_0xfced('0x1a'));var jayson=require(_0xfced('0x1b'));var client=jayson[_0xfced('0x1c')][_0xfced('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5d285f,_0x120ae5,_0x5182d1,_0x486ac1){return new BPromise(function(_0x4fff1b,_0x3a3d0e){var _0x47094f=_0x486ac1||client;return _0x47094f[_0xfced('0x1e')](_0x5d285f,_0x5182d1)[_0xfced('0x1f')](function(_0xd90a1e){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x120ae5,_0xfced('0x20'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x120ae5,'request\x20sent',JSON[_0xfced('0x21')](_0xd90a1e));if(_0xd90a1e['error']){if(_0xd90a1e[_0xfced('0x22')][_0xfced('0x23')]===0x1f4){logger[_0xfced('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x120ae5,_0xd90a1e[_0xfced('0x22')][_0xfced('0x24')]);return _0x3a3d0e(_0xd90a1e[_0xfced('0x22')][_0xfced('0x24')]);}logger[_0xfced('0x22')](_0xfced('0x25'),_0x120ae5,_0xd90a1e['error'][_0xfced('0x24')]);return _0x4fff1b(_0xd90a1e[_0xfced('0x22')][_0xfced('0x24')]);}else{logger[_0xfced('0x26')](_0xfced('0x25'),_0x120ae5,'request\x20sent');_0x4fff1b(_0xd90a1e[_0xfced('0x27')][_0xfced('0x24')]);}})[_0xfced('0x28')](function(_0x308a76){logger[_0xfced('0x22')](_0xfced('0x25'),_0x120ae5,_0x308a76);_0x3a3d0e(_0x308a76);});});}function respondWithStatusCode(_0x44a8e3,_0x21a0e4){_0x21a0e4=_0x21a0e4||0xcc;return function(_0x44b828){if(_0x44b828){return _0x44a8e3['sendStatus'](_0x21a0e4);}return _0x44a8e3[_0xfced('0x29')](_0x21a0e4)[_0xfced('0x2a')]();};}function respondWithResult(_0x5ca480,_0x3747d6){_0x3747d6=_0x3747d6||0xc8;return function(_0x1810cf){if(_0x1810cf){return _0x5ca480[_0xfced('0x29')](_0x3747d6)[_0xfced('0x2b')](_0x1810cf);}};}function respondWithFilteredResult(_0x376a49,_0x3a7e04){return function(_0x13e3d6){if(_0x13e3d6){var _0x107740=_0x13e3d6['count'],_0x39cd03=_0x3a7e04['offset'],_0x1f6986=_0x3a7e04[_0xfced('0x2c')]+_0x3a7e04['limit'],_0x5c260f;if(_0x1f6986>=_0x107740){_0x1f6986=_0x107740;_0x5c260f=0xc8;}else{_0x5c260f=0xce;}_0x376a49[_0xfced('0x29')](_0x5c260f);return _0x376a49[_0xfced('0x2d')]('Content-Range',_0x39cd03+'-'+_0x1f6986+'/'+_0x107740)['json'](_0x13e3d6);}return null;};}function patchUpdates(_0x28e744){return function(_0x14d93f){try{jsonpatch[_0xfced('0x2e')](_0x14d93f,_0x28e744,!![]);}catch(_0x35fa52){return BPromise[_0xfced('0x2f')](_0x35fa52);}return _0x14d93f['save']();};}function saveUpdates(_0x101cfc,_0x5c35f8){return function(_0x1d41c8){if(_0x1d41c8){return _0x1d41c8['update'](_0x101cfc)['then'](function(_0x22b004){return _0x22b004;});}return null;};}function removeEntity(_0x25bb00,_0x146d22){return function(_0x4e3c10){if(_0x4e3c10){return _0x4e3c10[_0xfced('0x30')]()[_0xfced('0x1f')](function(){_0x25bb00[_0xfced('0x29')](0xcc)[_0xfced('0x2a')]();});}};}function handleEntityNotFound(_0x5ed065,_0x37fd69){return function(_0x228493){if(!_0x228493){_0x5ed065[_0xfced('0x31')](0x194);}return _0x228493;};}function handleError(_0x423d93,_0xaa07a3){_0xaa07a3=_0xaa07a3||0x1f4;return function(_0x4a163d){logger[_0xfced('0x22')](_0x4a163d[_0xfced('0x32')]);if(_0x4a163d[_0xfced('0x33')]){delete _0x4a163d[_0xfced('0x33')];}_0x423d93['status'](_0xaa07a3)[_0xfced('0x34')](_0x4a163d);};}exports[_0xfced('0x35')]=function(_0x33d44b,_0x4f7c0){var _0x439910={},_0x3e090b={},_0x41d81d={'count':0x0,'rows':[]};var _0x17ccb4=_[_0xfced('0x36')](db[_0xfced('0x37')]['rawAttributes'],function(_0x49f5bc){return{'name':_0x49f5bc[_0xfced('0x38')],'type':_0x49f5bc[_0xfced('0x39')][_0xfced('0x3a')]};});_0x3e090b['model']=_[_0xfced('0x36')](_0x17ccb4,_0xfced('0x33'));_0x3e090b[_0xfced('0x3b')]=_[_0xfced('0x3c')](_0x33d44b[_0xfced('0x3b')]);_0x3e090b[_0xfced('0x3d')]=_[_0xfced('0x3e')](_0x3e090b[_0xfced('0x3f')],_0x3e090b[_0xfced('0x3b')]);_0x439910[_0xfced('0x40')]=_[_0xfced('0x3e')](_0x3e090b[_0xfced('0x3f')],qs['fields'](_0x33d44b[_0xfced('0x3b')]['fields']));_0x439910[_0xfced('0x40')]=_0x439910[_0xfced('0x40')][_0xfced('0x41')]?_0x439910['attributes']:_0x3e090b[_0xfced('0x3f')];if(!_0x33d44b[_0xfced('0x3b')]['hasOwnProperty'](_0xfced('0x42'))){_0x439910[_0xfced('0x43')]=qs['limit'](_0x33d44b[_0xfced('0x3b')]['limit']);_0x439910[_0xfced('0x2c')]=qs[_0xfced('0x2c')](_0x33d44b[_0xfced('0x3b')][_0xfced('0x2c')]);}_0x439910['order']=qs['sort'](_0x33d44b[_0xfced('0x3b')]['sort']);_0x439910['where']=qs[_0xfced('0x3d')](_['pick'](_0x33d44b[_0xfced('0x3b')],_0x3e090b[_0xfced('0x3d')]),_0x17ccb4);if(_0x33d44b[_0xfced('0x3b')][_0xfced('0x44')]){_0x439910[_0xfced('0x45')]=_[_0xfced('0x46')](_0x439910[_0xfced('0x45')],{'$or':_['map'](_0x17ccb4,function(_0x47aba6){if(_0x47aba6[_0xfced('0x39')]!==_0xfced('0x47')){var _0x24abfa={};_0x24abfa[_0x47aba6['name']]={'$like':'%'+_0x33d44b[_0xfced('0x3b')]['filter']+'%'};return _0x24abfa;}})});}_0x439910=_[_0xfced('0x46')]({},_0x439910,_0x33d44b['options']);var _0x4cb1a9={'where':_0x439910['where']};return db[_0xfced('0x37')][_0xfced('0x48')](_0x4cb1a9)['then'](function(_0x378ed7){_0x41d81d['count']=_0x378ed7;if(_0x33d44b[_0xfced('0x3b')][_0xfced('0x49')]){_0x439910[_0xfced('0x4a')]=[{'all':!![]}];}return db[_0xfced('0x37')]['findAll'](_0x439910);})[_0xfced('0x1f')](function(_0x395292){_0x41d81d[_0xfced('0x4b')]=_0x395292;return _0x41d81d;})[_0xfced('0x1f')](respondWithFilteredResult(_0x4f7c0,_0x439910))['catch'](handleError(_0x4f7c0,null));};exports[_0xfced('0x4c')]=function(_0x4d2cc5,_0x5716a1){var _0x418974={'raw':![],'where':{'id':_0x4d2cc5[_0xfced('0x4d')]['id']}},_0x386bed={};_0x386bed[_0xfced('0x3f')]=_[_0xfced('0x3c')](db[_0xfced('0x37')][_0xfced('0x4e')]);_0x386bed[_0xfced('0x3b')]=_[_0xfced('0x3c')](_0x4d2cc5['query']);_0x386bed[_0xfced('0x3d')]=_['intersection'](_0x386bed['model'],_0x386bed[_0xfced('0x3b')]);_0x418974[_0xfced('0x40')]=_[_0xfced('0x3e')](_0x386bed[_0xfced('0x3f')],qs[_0xfced('0x4f')](_0x4d2cc5[_0xfced('0x3b')][_0xfced('0x4f')]));_0x418974['attributes']=_0x418974[_0xfced('0x40')][_0xfced('0x41')]?_0x418974[_0xfced('0x40')]:_0x386bed[_0xfced('0x3f')];if(_0x4d2cc5[_0xfced('0x3b')][_0xfced('0x49')]){_0x418974['include']=[{'all':!![]}];}_0x418974=_['merge']({},_0x418974,_0x4d2cc5[_0xfced('0x50')]);return db[_0xfced('0x37')][_0xfced('0x51')](_0x418974)[_0xfced('0x1f')](handleEntityNotFound(_0x5716a1,null))['then'](respondWithResult(_0x5716a1,null))['catch'](handleError(_0x5716a1,null));};exports[_0xfced('0x52')]=function(_0x17e713,_0x380f26){return db[_0xfced('0x37')][_0xfced('0x52')](_0x17e713[_0xfced('0x53')],{})[_0xfced('0x1f')](respondWithResult(_0x380f26,0xc9))['catch'](handleError(_0x380f26,null));};exports[_0xfced('0x54')]=function(_0x184fba,_0x4bb0ea){if(_0x184fba['body']['id']){delete _0x184fba['body']['id'];}return db[_0xfced('0x37')][_0xfced('0x51')]({'where':{'id':_0x184fba[_0xfced('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4bb0ea,null))['then'](saveUpdates(_0x184fba[_0xfced('0x53')],null))['then'](respondWithResult(_0x4bb0ea,null))[_0xfced('0x28')](handleError(_0x4bb0ea,null));};exports[_0xfced('0x30')]=function(_0x27ce76,_0x4d5129){return db['SugarcrmAccount'][_0xfced('0x51')]({'where':{'id':_0x27ce76['params']['id']}})['then'](handleEntityNotFound(_0x4d5129,null))[_0xfced('0x1f')](removeEntity(_0x4d5129,null))[_0xfced('0x28')](handleError(_0x4d5129,null));};exports[_0xfced('0x55')]=function(_0x5da9f8,_0x123155,_0xca6c09){var _0x83013c={};var _0x299828={};var _0x5c10b1;var _0x2cf9ac;return db['SugarcrmAccount'][_0xfced('0x56')]({'where':{'id':_0x5da9f8['params']['id']}})['then'](handleEntityNotFound(_0x123155,null))[_0xfced('0x1f')](function(_0x2ac32a){if(_0x2ac32a){_0x5c10b1=_0x2ac32a;_0x299828[_0xfced('0x3f')]=_[_0xfced('0x3c')](db[_0xfced('0x57')][_0xfced('0x4e')]);_0x299828[_0xfced('0x3b')]=_[_0xfced('0x3c')](_0x5da9f8[_0xfced('0x3b')]);_0x299828['filters']=_[_0xfced('0x3e')](_0x299828[_0xfced('0x3f')],_0x299828[_0xfced('0x3b')]);_0x83013c['attributes']=_[_0xfced('0x3e')](_0x299828[_0xfced('0x3f')],qs[_0xfced('0x4f')](_0x5da9f8[_0xfced('0x3b')][_0xfced('0x4f')]));_0x83013c['attributes']=_0x83013c['attributes'][_0xfced('0x41')]?_0x83013c[_0xfced('0x40')]:_0x299828[_0xfced('0x3f')];_0x83013c[_0xfced('0x58')]=qs[_0xfced('0x59')](_0x5da9f8[_0xfced('0x3b')]['sort']);_0x83013c[_0xfced('0x45')]=qs['filters'](_[_0xfced('0x5a')](_0x5da9f8[_0xfced('0x3b')],_0x299828[_0xfced('0x3d')]));if(_0x5da9f8[_0xfced('0x3b')][_0xfced('0x44')]){_0x83013c['where']=_[_0xfced('0x46')](_0x83013c[_0xfced('0x45')],{'$or':_[_0xfced('0x36')](_0x83013c['attributes'],function(_0x2ae9d2){var _0x1a0028={};_0x1a0028[_0x2ae9d2]={'$like':'%'+_0x5da9f8[_0xfced('0x3b')][_0xfced('0x44')]+'%'};return _0x1a0028;})});}_0x83013c=_[_0xfced('0x46')]({},_0x83013c,_0x5da9f8['options']);return _0x5c10b1['getConfigurations'](_0x83013c);}})[_0xfced('0x1f')](function(_0x3ec65d){if(_0x3ec65d){_0x2cf9ac=_0x3ec65d[_0xfced('0x41')];if(!_0x5da9f8[_0xfced('0x3b')][_0xfced('0x5b')](_0xfced('0x42'))){_0x83013c[_0xfced('0x43')]=qs[_0xfced('0x43')](_0x5da9f8[_0xfced('0x3b')][_0xfced('0x43')]);_0x83013c['offset']=qs[_0xfced('0x2c')](_0x5da9f8[_0xfced('0x3b')][_0xfced('0x2c')]);}return _0x5c10b1[_0xfced('0x55')](_0x83013c);}})[_0xfced('0x1f')](function(_0x23b63e){if(_0x23b63e){return _0x23b63e?{'count':_0x2cf9ac,'rows':_0x23b63e}:null;}})[_0xfced('0x1f')](respondWithResult(_0x123155,null))['catch'](handleError(_0x123155,null));};exports['addConfiguration']=function(_0x4de8ce,_0x422c4b,_0x2b919d){if(_0x4de8ce[_0xfced('0x53')]['id']){delete _0x4de8ce[_0xfced('0x53')]['id'];}return db[_0xfced('0x37')][_0xfced('0x56')]({'where':{'id':_0x4de8ce[_0xfced('0x4d')]['id']}})[_0xfced('0x1f')](handleEntityNotFound(_0x422c4b,null))[_0xfced('0x1f')](function(_0x5f3600){if(_0x5f3600){_0x4de8ce['body'][_0xfced('0x5c')]=_0x5f3600['id'];_0x4de8ce['body'][_0xfced('0x5d')]=integrations[_0xfced('0x5e')](_0x4de8ce['body'][_0xfced('0x5f')],_0x4de8ce[_0xfced('0x53')][_0xfced('0x39')]);_0x4de8ce[_0xfced('0x53')][_0xfced('0x60')]=integrations['getDescriptions'](_0x4de8ce[_0xfced('0x53')][_0xfced('0x5f')],_0x4de8ce['body'][_0xfced('0x39')]);return db[_0xfced('0x57')][_0xfced('0x52')](_0x4de8ce[_0xfced('0x53')],{'include':[{'model':db[_0xfced('0x61')],'as':_0xfced('0x5d')},{'model':db[_0xfced('0x61')],'as':_0xfced('0x60')}]});}return null;})[_0xfced('0x1f')](respondWithResult(_0x422c4b,null))[_0xfced('0x28')](handleError(_0x422c4b,null));};exports[_0xfced('0x62')]=function(_0x5df2eb,_0x1d4094,_0x51d178){var _0x37fb85='';var _0x51aa15=['id','name',_0xfced('0x63'),'created_by',_0xfced('0x64'),_0xfced('0x65'),_0xfced('0x66'),_0xfced('0x67'),'parent_id','parent_type',_0xfced('0x68'),_0xfced('0x69')];return db[_0xfced('0x37')][_0xfced('0x56')]({'where':{'id':_0x5df2eb['params']['id']},'attributes':['id',_0xfced('0x6a'),'password',_0xfced('0x6b')]})['then'](handleEntityNotFound(_0x1d4094,null))[_0xfced('0x1f')](function(_0x447934){if(_0x447934){_0x37fb85=_0x447934['remoteUri'];var _0x529c36=_0x37fb85[_0xfced('0x6c')](-0x1);if(_0x529c36==='/'){_0x37fb85=_0x37fb85['substring'](0x0,_0x37fb85[_0xfced('0x6d')](_0x529c36));}return rp({'method':'POST','uri':util[_0xfced('0x6e')](_0xfced('0x6f'),_0x37fb85,_0xfced('0x70')),'json':!![],'form':{'method':_0xfced('0x71'),'input_type':_0xfced('0x72'),'response_type':_0xfced('0x72'),'rest_data':JSON[_0xfced('0x21')]({'user_auth':{'user_name':_0x447934['username'],'password':_0x447934[_0xfced('0x73')],'encryption':_0xfced('0x74')},'application':_0xfced('0x75')})}});}})[_0xfced('0x1f')](function(_0x4a4e56){if(_0x4a4e56&&_0x4a4e56['name']!==_0xfced('0x76')&&_0x4a4e56[_0xfced('0x33')]!=='Password\x20Expired'){return rp({'method':_0xfced('0x77'),'uri':util[_0xfced('0x6e')](_0xfced('0x6f'),_0x37fb85,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xfced('0x78'),'input_type':_0xfced('0x72'),'response_type':'JSON','rest_data':JSON[_0xfced('0x21')]({'session':_0x4a4e56['id'],'module_name':'Calls'})}})[_0xfced('0x1f')](function(_0x1219fd){if(_0x1219fd){var _0x107930=_[_0xfced('0x79')](_0x1219fd[_0xfced('0x7a')]);_[_0xfced('0x7b')](_0x107930,function(_0x42da71){return _0x51aa15[_0xfced('0x7c')](_0x42da71[_0xfced('0x33')]);});return{'count':_0x107930[_0xfced('0x41')],'rows':_[_0xfced('0x36')](_0x107930,function(_0xb9d05a){return{'id':_0xb9d05a['name'],'name':_0xb9d05a[_0xfced('0x7d')],'custom':_[_0xfced('0x7e')](_0xb9d05a['name'],'_c')?!![]:![],'options':_0xb9d05a[_0xfced('0x50')]?_[_0xfced('0x36')](_[_0xfced('0x79')](_0xb9d05a[_0xfced('0x50')]),function(_0x577bbe){return{'name':_0x577bbe['value'],'value':_0x577bbe[_0xfced('0x33')]};}):[]};})};}})[_0xfced('0x1f')](respondWithResult(_0x1d4094,null))[_0xfced('0x28')](function(_0xb3c882){var _0x2ee8ef=_0x5df2eb[_0xfced('0x3b')][_0xfced('0x7f')]?0x1f4:_0xb3c882[_0xfced('0x80')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2ee8ef,JSON[_0xfced('0x21')](_0xb3c882));delete _0xb3c882[_0xfced('0x33')];if(_0x2ee8ef===0x191){_0x2ee8ef=0x190;}_0x1d4094[_0xfced('0x29')](_0x2ee8ef)[_0xfced('0x34')](_0x5df2eb[_0xfced('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xb3c882[_0xfced('0x80')]}:_0xb3c882);});}else{var _0x19025a=0x1f4;_0x1d4094[_0xfced('0x29')](_0x19025a)['send']({'message':_0xfced('0x81'),'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 f9a2e0e..aa5b56c 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 _0x3b6a=['int_sugarcrm_accounts','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x4573bd,_0x19b9b5){var _0xc07bb9=function(_0x36a36a){while(--_0x36a36a){_0x4573bd['push'](_0x4573bd['shift']());}};_0xc07bb9(++_0x19b9b5);}(_0x3b6a,0xd9));var _0xa3b6=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0x3b6a[_0x38fb8b];return _0x1ec681;};'use strict';var _=require('lodash');var util=require(_0xa3b6('0x0'));var logger=require(_0xa3b6('0x1'))(_0xa3b6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa3b6('0x3'));var fs=require('fs');var path=require(_0xa3b6('0x4'));var rimraf=require(_0xa3b6('0x5'));var config=require(_0xa3b6('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xa3b6('0x7'));module[_0xa3b6('0x8')]=function(_0x1dbb33,_0x12cd54){return _0x1dbb33[_0xa3b6('0x9')](_0xa3b6('0xa'),attributes,{'tableName':_0xa3b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc34f=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xa44be7,_0x455088){var _0x20e22e=function(_0x361d14){while(--_0x361d14){_0xa44be7['push'](_0xa44be7['shift']());}};_0x20e22e(++_0x455088);}(_0xc34f,0xfa));var _0xfc34=function(_0x6e5e10,_0x4ea002){_0x6e5e10=_0x6e5e10-0x0;var _0x38e7e5=_0xc34f[_0x6e5e10];return _0x38e7e5;};'use strict';var _=require(_0xfc34('0x0'));var util=require(_0xfc34('0x1'));var logger=require('../../config/logger')(_0xfc34('0x2'));var moment=require(_0xfc34('0x3'));var BPromise=require(_0xfc34('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc34('0x5'));var config=require(_0xfc34('0x6'));var attributes=require(_0xfc34('0x7'));var integrations=require(_0xfc34('0x8'));module[_0xfc34('0x9')]=function(_0xc08b9f,_0x4f3b58){return _0xc08b9f[_0xfc34('0xa')](_0xfc34('0xb'),attributes,{'tableName':_0xfc34('0xc'),'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 6b213cf..83e0c50 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 _0x5971=['findAll','options','where','limit','model','attributes','include','map','GetSugarcrmAccount','stringify','catch','find','raw','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','SugarcrmAccount'];(function(_0x518243,_0x964629){var _0x43dea8=function(_0x16e0ab){while(--_0x16e0ab){_0x518243['push'](_0x518243['shift']());}};_0x43dea8(++_0x964629);}(_0x5971,0x19a));var _0x1597=function(_0xd4bd22,_0x9bd3a7){_0xd4bd22=_0xd4bd22-0x0;var _0x477bfa=_0x5971[_0xd4bd22];return _0x477bfa;};'use strict';var _=require(_0x1597('0x0'));var util=require(_0x1597('0x1'));var moment=require(_0x1597('0x2'));var BPromise=require(_0x1597('0x3'));var rs=require(_0x1597('0x4'));var fs=require('fs');var Redis=require(_0x1597('0x5'));var db=require(_0x1597('0x6'))['db'];var utils=require(_0x1597('0x7'));var logger=require('../../config/logger')(_0x1597('0x8'));var config=require(_0x1597('0x9'));var jayson=require(_0x1597('0xa'));var client=jayson[_0x1597('0xb')][_0x1597('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x62bf62,_0x30d46f,_0x107e3){return new BPromise(function(_0x253ed9,_0x450353){return client['request'](_0x62bf62,_0x107e3)[_0x1597('0xd')](function(_0x361f48){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x30d46f,_0x1597('0xe'));logger[_0x1597('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x30d46f,_0x1597('0xe'),JSON['stringify'](_0x361f48));if(_0x361f48[_0x1597('0x10')]){if(_0x361f48[_0x1597('0x10')][_0x1597('0x11')]===0x1f4){logger[_0x1597('0x10')](_0x1597('0x12'),_0x30d46f,_0x361f48['error']['message']);return _0x450353(_0x361f48[_0x1597('0x10')][_0x1597('0x13')]);}logger['error'](_0x1597('0x12'),_0x30d46f,_0x361f48[_0x1597('0x10')][_0x1597('0x13')]);return _0x253ed9(_0x361f48[_0x1597('0x10')][_0x1597('0x13')]);}else{logger[_0x1597('0x14')](_0x1597('0x12'),_0x30d46f,_0x1597('0xe'));_0x253ed9(_0x361f48['result']['message']);}})['catch'](function(_0x19f8e6){logger[_0x1597('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x30d46f,_0x19f8e6);_0x450353(_0x19f8e6);});});}exports['GetSugarcrmAccount']=function(_0x57e121){var _0x3e4746=this;return new Promise(function(_0x386a6e,_0x651b8a){return db[_0x1597('0x15')][_0x1597('0x16')]({'raw':_0x57e121['options']?_0x57e121[_0x1597('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x57e121[_0x1597('0x17')]?_0x57e121['options'][_0x1597('0x18')]||null:null,'attributes':_0x57e121[_0x1597('0x17')]?_0x57e121[_0x1597('0x17')]['attributes']||null:null,'limit':_0x57e121[_0x1597('0x17')]?_0x57e121[_0x1597('0x17')][_0x1597('0x19')]||null:null,'include':_0x57e121[_0x1597('0x17')]?_0x57e121[_0x1597('0x17')]['include']?_['map'](_0x57e121[_0x1597('0x17')]['include'],function(_0x346949){return{'model':db[_0x346949[_0x1597('0x1a')]],'as':_0x346949['as'],'attributes':_0x346949[_0x1597('0x1b')],'include':_0x346949[_0x1597('0x1c')]?_[_0x1597('0x1d')](_0x346949[_0x1597('0x1c')],function(_0xcfe4ff){return{'model':db[_0xcfe4ff[_0x1597('0x1a')]],'as':_0xcfe4ff['as'],'attributes':_0xcfe4ff[_0x1597('0x1b')],'include':_0xcfe4ff[_0x1597('0x1c')]?_['map'](_0xcfe4ff[_0x1597('0x1c')],function(_0x54498e){return{'model':db[_0x54498e['model']],'as':_0x54498e['as'],'attributes':_0x54498e[_0x1597('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d8e14){logger[_0x1597('0x14')](_0x1597('0x1e'),_0x57e121);logger[_0x1597('0xf')](_0x1597('0x1e'),_0x57e121,JSON[_0x1597('0x1f')](_0x3d8e14));_0x386a6e(_0x3d8e14);})[_0x1597('0x20')](function(_0x5e4bc3){logger[_0x1597('0x10')](_0x1597('0x1e'),_0x5e4bc3['message'],_0x57e121);_0x651b8a(_0x3e4746[_0x1597('0x10')](0x1f4,_0x5e4bc3[_0x1597('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x50f573){var _0x4232da=this;return new Promise(function(_0x12412b,_0x439f1a){return db[_0x1597('0x15')][_0x1597('0x21')]({'raw':_0x50f573[_0x1597('0x17')]?_0x50f573[_0x1597('0x17')][_0x1597('0x22')]===undefined?!![]:![]:!![],'where':_0x50f573[_0x1597('0x17')]?_0x50f573[_0x1597('0x17')]['where']||null:null,'attributes':_0x50f573[_0x1597('0x17')]?_0x50f573[_0x1597('0x17')][_0x1597('0x1b')]||null:null,'include':_0x50f573[_0x1597('0x17')]?_0x50f573[_0x1597('0x17')][_0x1597('0x1c')]?_[_0x1597('0x1d')](_0x50f573[_0x1597('0x17')]['include'],function(_0x1a04a3){return{'model':db[_0x1a04a3[_0x1597('0x1a')]],'as':_0x1a04a3['as'],'attributes':_0x1a04a3[_0x1597('0x1b')],'include':_0x1a04a3[_0x1597('0x1c')]?_[_0x1597('0x1d')](_0x1a04a3[_0x1597('0x1c')],function(_0x4f3fec){return{'model':db[_0x4f3fec[_0x1597('0x1a')]],'as':_0x4f3fec['as'],'attributes':_0x4f3fec[_0x1597('0x1b')],'include':_0x4f3fec['include']?_[_0x1597('0x1d')](_0x4f3fec['include'],function(_0x59fbb1){return{'model':db[_0x59fbb1['model']],'as':_0x59fbb1['as'],'attributes':_0x59fbb1[_0x1597('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1597('0xd')](function(_0x554165){logger['info'](_0x1597('0x23'),_0x50f573);logger[_0x1597('0xf')]('ShowSugarcrmAccount',_0x50f573,JSON[_0x1597('0x1f')](_0x554165));_0x12412b(_0x554165);})['catch'](function(_0x522b88){logger['error'](_0x1597('0x23'),_0x522b88[_0x1597('0x13')],_0x50f573);_0x439f1a(_0x4232da[_0x1597('0x10')](0x1f4,_0x522b88[_0x1597('0x13')]));});});}; \ No newline at end of file +var _0xc3d7=['include','map','model','then','debug','GetSugarcrmAccount','ShowSugarcrmAccount','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','SugarcrmAccount','findAll','options','raw','where','attributes','limit'];(function(_0x2ce5f2,_0x361fc6){var _0x1a362a=function(_0x220cb4){while(--_0x220cb4){_0x2ce5f2['push'](_0x2ce5f2['shift']());}};_0x1a362a(++_0x361fc6);}(_0xc3d7,0x143));var _0x7c3d=function(_0x1de41f,_0x2de6bb){_0x1de41f=_0x1de41f-0x0;var _0x53afbe=_0xc3d7[_0x1de41f];return _0x53afbe;};'use strict';var _=require('lodash');var util=require(_0x7c3d('0x0'));var moment=require(_0x7c3d('0x1'));var BPromise=require(_0x7c3d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c3d('0x3'));var db=require(_0x7c3d('0x4'))['db'];var utils=require(_0x7c3d('0x5'));var logger=require('../../config/logger')(_0x7c3d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c3d('0x7')][_0x7c3d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x152d3b,_0xfb5b3b,_0x3e43fa){return new BPromise(function(_0x22c0f1,_0x1492dd){return client[_0x7c3d('0x9')](_0x152d3b,_0x3e43fa)['then'](function(_0xab6981){logger[_0x7c3d('0xa')](_0x7c3d('0xb'),_0xfb5b3b,'request\x20sent');logger['debug'](_0x7c3d('0xc'),_0xfb5b3b,'request\x20sent',JSON[_0x7c3d('0xd')](_0xab6981));if(_0xab6981['error']){if(_0xab6981[_0x7c3d('0xe')][_0x7c3d('0xf')]===0x1f4){logger[_0x7c3d('0xe')](_0x7c3d('0xb'),_0xfb5b3b,_0xab6981['error'][_0x7c3d('0x10')]);return _0x1492dd(_0xab6981[_0x7c3d('0xe')][_0x7c3d('0x10')]);}logger['error'](_0x7c3d('0xb'),_0xfb5b3b,_0xab6981['error'][_0x7c3d('0x10')]);return _0x22c0f1(_0xab6981[_0x7c3d('0xe')][_0x7c3d('0x10')]);}else{logger[_0x7c3d('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0xfb5b3b,_0x7c3d('0x11'));_0x22c0f1(_0xab6981[_0x7c3d('0x12')][_0x7c3d('0x10')]);}})[_0x7c3d('0x13')](function(_0x23bde7){logger[_0x7c3d('0xe')](_0x7c3d('0xb'),_0xfb5b3b,_0x23bde7);_0x1492dd(_0x23bde7);});});}exports['GetSugarcrmAccount']=function(_0x544c24){var _0x39adf1=this;return new Promise(function(_0x5ae1c8,_0xa49c63){return db[_0x7c3d('0x14')][_0x7c3d('0x15')]({'raw':_0x544c24[_0x7c3d('0x16')]?_0x544c24['options'][_0x7c3d('0x17')]===undefined?!![]:![]:!![],'where':_0x544c24[_0x7c3d('0x16')]?_0x544c24[_0x7c3d('0x16')][_0x7c3d('0x18')]||null:null,'attributes':_0x544c24[_0x7c3d('0x16')]?_0x544c24[_0x7c3d('0x16')][_0x7c3d('0x19')]||null:null,'limit':_0x544c24[_0x7c3d('0x16')]?_0x544c24['options'][_0x7c3d('0x1a')]||null:null,'include':_0x544c24[_0x7c3d('0x16')]?_0x544c24['options'][_0x7c3d('0x1b')]?_[_0x7c3d('0x1c')](_0x544c24['options'][_0x7c3d('0x1b')],function(_0x56d411){return{'model':db[_0x56d411[_0x7c3d('0x1d')]],'as':_0x56d411['as'],'attributes':_0x56d411['attributes'],'include':_0x56d411[_0x7c3d('0x1b')]?_['map'](_0x56d411[_0x7c3d('0x1b')],function(_0x4f0d18){return{'model':db[_0x4f0d18[_0x7c3d('0x1d')]],'as':_0x4f0d18['as'],'attributes':_0x4f0d18[_0x7c3d('0x19')],'include':_0x4f0d18[_0x7c3d('0x1b')]?_[_0x7c3d('0x1c')](_0x4f0d18[_0x7c3d('0x1b')],function(_0x702acd){return{'model':db[_0x702acd[_0x7c3d('0x1d')]],'as':_0x702acd['as'],'attributes':_0x702acd[_0x7c3d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7c3d('0x1e')](function(_0x19663c){logger[_0x7c3d('0xa')]('GetSugarcrmAccount',_0x544c24);logger[_0x7c3d('0x1f')](_0x7c3d('0x20'),_0x544c24,JSON[_0x7c3d('0xd')](_0x19663c));_0x5ae1c8(_0x19663c);})['catch'](function(_0x22575c){logger['error']('GetSugarcrmAccount',_0x22575c['message'],_0x544c24);_0xa49c63(_0x39adf1[_0x7c3d('0xe')](0x1f4,_0x22575c[_0x7c3d('0x10')]));});});};exports[_0x7c3d('0x21')]=function(_0x46e216){var _0x10f4c8=this;return new Promise(function(_0xace846,_0x1108d4){return db['SugarcrmAccount'][_0x7c3d('0x22')]({'raw':_0x46e216['options']?_0x46e216[_0x7c3d('0x16')][_0x7c3d('0x17')]===undefined?!![]:![]:!![],'where':_0x46e216[_0x7c3d('0x16')]?_0x46e216[_0x7c3d('0x16')][_0x7c3d('0x18')]||null:null,'attributes':_0x46e216['options']?_0x46e216['options'][_0x7c3d('0x19')]||null:null,'include':_0x46e216[_0x7c3d('0x16')]?_0x46e216[_0x7c3d('0x16')][_0x7c3d('0x1b')]?_[_0x7c3d('0x1c')](_0x46e216[_0x7c3d('0x16')][_0x7c3d('0x1b')],function(_0x49ca9b){return{'model':db[_0x49ca9b[_0x7c3d('0x1d')]],'as':_0x49ca9b['as'],'attributes':_0x49ca9b['attributes'],'include':_0x49ca9b[_0x7c3d('0x1b')]?_[_0x7c3d('0x1c')](_0x49ca9b[_0x7c3d('0x1b')],function(_0x393c20){return{'model':db[_0x393c20[_0x7c3d('0x1d')]],'as':_0x393c20['as'],'attributes':_0x393c20[_0x7c3d('0x19')],'include':_0x393c20[_0x7c3d('0x1b')]?_[_0x7c3d('0x1c')](_0x393c20[_0x7c3d('0x1b')],function(_0x2d8a31){return{'model':db[_0x2d8a31[_0x7c3d('0x1d')]],'as':_0x2d8a31['as'],'attributes':_0x2d8a31[_0x7c3d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x368d02){logger[_0x7c3d('0xa')](_0x7c3d('0x21'),_0x46e216);logger[_0x7c3d('0x1f')](_0x7c3d('0x21'),_0x46e216,JSON[_0x7c3d('0xd')](_0x368d02));_0xace846(_0x368d02);})[_0x7c3d('0x13')](function(_0x14245e){logger[_0x7c3d('0xe')](_0x7c3d('0x21'),_0x14245e[_0x7c3d('0x10')],_0x46e216);_0x1108d4(_0x10f4c8['error'](0x1f4,_0x14245e[_0x7c3d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a8e5360..b553ee1 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 _0x1dd2=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','exports','multer','util','path','connect-timeout'];(function(_0x6b30b6,_0x1c61c7){var _0x349f74=function(_0x6b77c2){while(--_0x6b77c2){_0x6b30b6['push'](_0x6b30b6['shift']());}};_0x349f74(++_0x1c61c7);}(_0x1dd2,0x176));var _0x21dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x21dd('0x0'));var util=require(_0x21dd('0x1'));var path=require(_0x21dd('0x2'));var timeout=require(_0x21dd('0x3'));var express=require(_0x21dd('0x4'));var router=express[_0x21dd('0x5')]();var auth=require(_0x21dd('0x6'));var interaction=require(_0x21dd('0x7'));var config=require(_0x21dd('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x21dd('0x9')]);router[_0x21dd('0xa')](_0x21dd('0xb'),auth[_0x21dd('0xc')](),controller['show']);router[_0x21dd('0xa')](_0x21dd('0xd'),auth[_0x21dd('0xc')](),controller[_0x21dd('0xe')]);router['get'](_0x21dd('0xf'),auth['isAuthenticated'](),controller[_0x21dd('0x10')]);router[_0x21dd('0xa')]('/:id/descriptions',auth[_0x21dd('0xc')](),controller[_0x21dd('0x11')]);router['post']('/',auth[_0x21dd('0xc')](),controller[_0x21dd('0x12')]);router[_0x21dd('0x13')](_0x21dd('0xb'),auth[_0x21dd('0xc')](),controller['update']);router['delete'](_0x21dd('0xb'),auth[_0x21dd('0xc')](),controller['destroy']);module[_0x21dd('0x14')]=router; \ No newline at end of file +var _0x1cda=['Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','isAuthenticated','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','/:id','update','destroy','exports','util','connect-timeout','express'];(function(_0x4c983f,_0x5b8c0a){var _0x40d1ce=function(_0x23291b){while(--_0x23291b){_0x4c983f['push'](_0x4c983f['shift']());}};_0x40d1ce(++_0x5b8c0a);}(_0x1cda,0x90));var _0xa1cd=function(_0x57596c,_0x5b20a6){_0x57596c=_0x57596c-0x0;var _0x2a9a4f=_0x1cda[_0x57596c];return _0x2a9a4f;};'use strict';var multer=require('multer');var util=require(_0xa1cd('0x0'));var path=require('path');var timeout=require(_0xa1cd('0x1'));var express=require(_0xa1cd('0x2'));var router=express[_0xa1cd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa1cd('0x4'));var config=require(_0xa1cd('0x5'));var controller=require(_0xa1cd('0x6'));router[_0xa1cd('0x7')]('/',auth['isAuthenticated'](),controller[_0xa1cd('0x8')]);router['get']('/:id',auth[_0xa1cd('0x9')](),controller['show']);router[_0xa1cd('0x7')](_0xa1cd('0xa'),auth[_0xa1cd('0x9')](),controller[_0xa1cd('0xb')]);router['get'](_0xa1cd('0xc'),auth[_0xa1cd('0x9')](),controller['getSubjects']);router[_0xa1cd('0x7')]('/:id/descriptions',auth[_0xa1cd('0x9')](),controller[_0xa1cd('0xd')]);router[_0xa1cd('0xe')]('/',auth[_0xa1cd('0x9')](),controller[_0xa1cd('0xf')]);router[_0xa1cd('0x10')](_0xa1cd('0x11'),auth[_0xa1cd('0x9')](),controller[_0xa1cd('0x12')]);router['delete'](_0xa1cd('0x11'),auth[_0xa1cd('0x9')](),controller[_0xa1cd('0x13')]);module[_0xa1cd('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 9a563ff..fb635c1 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 _0xf1fa=['sequelize','exports','STRING'];(function(_0x773333,_0x568b15){var _0x561265=function(_0x207b17){while(--_0x207b17){_0x773333['push'](_0x773333['shift']());}};_0x561265(++_0x568b15);}(_0xf1fa,0x120));var _0xaf1f=function(_0x29b38e,_0x4a9741){_0x29b38e=_0x29b38e-0x0;var _0xb2ea1a=_0xf1fa[_0x29b38e];return _0xb2ea1a;};'use strict';var Sequelize=require(_0xaf1f('0x0'));module[_0xaf1f('0x1')]={'name':{'type':Sequelize[_0xaf1f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa939=['exports','STRING','sequelize'];(function(_0x196326,_0xa35b2a){var _0x37a346=function(_0x26c794){while(--_0x26c794){_0x196326['push'](_0x196326['shift']());}};_0x37a346(++_0xa35b2a);}(_0xa939,0x1f1));var _0x9a93=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa939[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x9a93('0x0'));module[_0x9a93('0x1')]={'name':{'type':Sequelize[_0x9a93('0x2')]},'description':{'type':Sequelize[_0x9a93('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 88c3408..9708ad6 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 _0x3c54=['offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','SugarcrmConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','show','params','catch','create','body','find','findOne','SugarcrmField','getSubjects','order','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','jayson/promise','http','request','then','request\x20sent','code','SugarcrmConfiguration,\x20%s,\x20%s','message','error','result','sendStatus','end','status','json'];(function(_0x5363c3,_0x2319cc){var _0x1872d0=function(_0x240b33){while(--_0x240b33){_0x5363c3['push'](_0x5363c3['shift']());}};_0x1872d0(++_0x2319cc);}(_0x3c54,0x82));var _0x43c5=function(_0x1066cb,_0x49df94){_0x1066cb=_0x1066cb-0x0;var _0x4c9025=_0x3c54[_0x1066cb];return _0x4c9025;};'use strict';var pdf=require(_0x43c5('0x0'));var emlformat=require(_0x43c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x43c5('0x2'));var jsonpatch=require(_0x43c5('0x3'));var rp=require(_0x43c5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43c5('0x5'));var util=require(_0x43c5('0x6'));var path=require(_0x43c5('0x7'));var sox=require(_0x43c5('0x8'));var csv=require('to-csv');var ejs=require(_0x43c5('0x9'));var fs=require('fs');var _=require(_0x43c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43c5('0xb'));var deskjs=require(_0x43c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x43c5('0xd'));var Papa=require('papaparse');var Redis=require(_0x43c5('0xe'));var authService=require(_0x43c5('0xf'));var qs=require(_0x43c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x43c5('0x11'))(_0x43c5('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x43c5('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x43c5('0x14'));var client=jayson['client'][_0x43c5('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x37491f,_0x555e31,_0x300abb,_0x9f0d36){return new BPromise(function(_0x483dec,_0x260c52){var _0x2eab6c=_0x9f0d36||client;return _0x2eab6c[_0x43c5('0x16')](_0x37491f,_0x300abb)[_0x43c5('0x17')](function(_0x4f811e){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x555e31,_0x43c5('0x18'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x555e31,_0x43c5('0x18'),JSON['stringify'](_0x4f811e));if(_0x4f811e['error']){if(_0x4f811e['error'][_0x43c5('0x19')]===0x1f4){logger['error'](_0x43c5('0x1a'),_0x555e31,_0x4f811e['error'][_0x43c5('0x1b')]);return _0x260c52(_0x4f811e[_0x43c5('0x1c')]['message']);}logger[_0x43c5('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x555e31,_0x4f811e[_0x43c5('0x1c')]['message']);return _0x483dec(_0x4f811e[_0x43c5('0x1c')][_0x43c5('0x1b')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x555e31,_0x43c5('0x18'));_0x483dec(_0x4f811e[_0x43c5('0x1d')][_0x43c5('0x1b')]);}})['catch'](function(_0x53cd29){logger[_0x43c5('0x1c')](_0x43c5('0x1a'),_0x555e31,_0x53cd29);_0x260c52(_0x53cd29);});});}function respondWithStatusCode(_0x14804d,_0x233d99){_0x233d99=_0x233d99||0xcc;return function(_0x1f4e7e){if(_0x1f4e7e){return _0x14804d[_0x43c5('0x1e')](_0x233d99);}return _0x14804d['status'](_0x233d99)[_0x43c5('0x1f')]();};}function respondWithResult(_0x2506bc,_0x5344e8){_0x5344e8=_0x5344e8||0xc8;return function(_0xc3214f){if(_0xc3214f){return _0x2506bc[_0x43c5('0x20')](_0x5344e8)[_0x43c5('0x21')](_0xc3214f);}};}function respondWithFilteredResult(_0x231422,_0x2ed46f){return function(_0x4e2cfe){if(_0x4e2cfe){var _0x48ec30=_0x4e2cfe['count'],_0x8485b7=_0x2ed46f[_0x43c5('0x22')],_0xec0f64=_0x2ed46f['offset']+_0x2ed46f[_0x43c5('0x23')],_0x39b560;if(_0xec0f64>=_0x48ec30){_0xec0f64=_0x48ec30;_0x39b560=0xc8;}else{_0x39b560=0xce;}_0x231422['status'](_0x39b560);return _0x231422['set'](_0x43c5('0x24'),_0x8485b7+'-'+_0xec0f64+'/'+_0x48ec30)[_0x43c5('0x21')](_0x4e2cfe);}return null;};}function patchUpdates(_0x4cd4c5){return function(_0x58643e){try{jsonpatch[_0x43c5('0x25')](_0x58643e,_0x4cd4c5,!![]);}catch(_0x2f7fa2){return BPromise[_0x43c5('0x26')](_0x2f7fa2);}return _0x58643e[_0x43c5('0x27')]();};}function saveUpdates(_0x470d3c,_0x1b4977){return function(_0x1e4937){if(_0x1e4937){return _0x1e4937[_0x43c5('0x28')](_0x470d3c)[_0x43c5('0x17')](function(_0x47d07b){return _0x47d07b;});}return null;};}function removeEntity(_0x45d0bc,_0x5a6cf8){return function(_0xcf3547){if(_0xcf3547){return _0xcf3547[_0x43c5('0x29')]()['then'](function(){_0x45d0bc[_0x43c5('0x20')](0xcc)[_0x43c5('0x1f')]();});}};}function handleEntityNotFound(_0x5326c3,_0x2f9c9f){return function(_0x28ca80){if(!_0x28ca80){_0x5326c3['sendStatus'](0x194);}return _0x28ca80;};}function handleError(_0x43c853,_0x494a9b){_0x494a9b=_0x494a9b||0x1f4;return function(_0x29c0c4){logger[_0x43c5('0x1c')](_0x29c0c4[_0x43c5('0x2a')]);if(_0x29c0c4[_0x43c5('0x2b')]){delete _0x29c0c4[_0x43c5('0x2b')];}_0x43c853[_0x43c5('0x20')](_0x494a9b)['send'](_0x29c0c4);};}exports[_0x43c5('0x2c')]=function(_0x434172,_0x42184c){var _0x481004={},_0x5e0255={},_0x144576={'count':0x0,'rows':[]};var _0x5957b8=_[_0x43c5('0x2d')](db[_0x43c5('0x2e')][_0x43c5('0x2f')],function(_0x33fc26){return{'name':_0x33fc26['fieldName'],'type':_0x33fc26['type'][_0x43c5('0x30')]};});_0x5e0255[_0x43c5('0x31')]=_['map'](_0x5957b8,'name');_0x5e0255[_0x43c5('0x32')]=_[_0x43c5('0x33')](_0x434172['query']);_0x5e0255[_0x43c5('0x34')]=_[_0x43c5('0x35')](_0x5e0255[_0x43c5('0x31')],_0x5e0255[_0x43c5('0x32')]);_0x481004['attributes']=_[_0x43c5('0x35')](_0x5e0255[_0x43c5('0x31')],qs['fields'](_0x434172[_0x43c5('0x32')][_0x43c5('0x36')]));_0x481004[_0x43c5('0x37')]=_0x481004[_0x43c5('0x37')][_0x43c5('0x38')]?_0x481004['attributes']:_0x5e0255[_0x43c5('0x31')];if(!_0x434172['query'][_0x43c5('0x39')](_0x43c5('0x3a'))){_0x481004[_0x43c5('0x23')]=qs[_0x43c5('0x23')](_0x434172['query']['limit']);_0x481004[_0x43c5('0x22')]=qs['offset'](_0x434172[_0x43c5('0x32')][_0x43c5('0x22')]);}_0x481004['order']=qs[_0x43c5('0x3b')](_0x434172[_0x43c5('0x32')][_0x43c5('0x3b')]);_0x481004[_0x43c5('0x3c')]=qs[_0x43c5('0x34')](_[_0x43c5('0x3d')](_0x434172[_0x43c5('0x32')],_0x5e0255[_0x43c5('0x34')]),_0x5957b8);if(_0x434172[_0x43c5('0x32')][_0x43c5('0x3e')]){_0x481004['where']=_[_0x43c5('0x3f')](_0x481004['where'],{'$or':_[_0x43c5('0x2d')](_0x5957b8,function(_0xf736f7){if(_0xf736f7[_0x43c5('0x40')]!==_0x43c5('0x41')){var _0x122f33={};_0x122f33[_0xf736f7[_0x43c5('0x2b')]]={'$like':'%'+_0x434172[_0x43c5('0x32')]['filter']+'%'};return _0x122f33;}})});}_0x481004=_['merge']({},_0x481004,_0x434172[_0x43c5('0x42')]);var _0x2b37e4={'where':_0x481004[_0x43c5('0x3c')]};return db[_0x43c5('0x2e')][_0x43c5('0x43')](_0x2b37e4)[_0x43c5('0x17')](function(_0x3e2315){_0x144576[_0x43c5('0x43')]=_0x3e2315;if(_0x434172['query'][_0x43c5('0x44')]){_0x481004[_0x43c5('0x45')]=[{'all':!![]}];}return db[_0x43c5('0x2e')][_0x43c5('0x46')](_0x481004);})[_0x43c5('0x17')](function(_0x3e5777){_0x144576['rows']=_0x3e5777;return _0x144576;})[_0x43c5('0x17')](respondWithFilteredResult(_0x42184c,_0x481004))['catch'](handleError(_0x42184c,null));};exports[_0x43c5('0x47')]=function(_0x19b5d1,_0x579e31){var _0x189e2a={'raw':![],'where':{'id':_0x19b5d1[_0x43c5('0x48')]['id']}},_0x44775e={};_0x44775e[_0x43c5('0x31')]=_[_0x43c5('0x33')](db[_0x43c5('0x2e')][_0x43c5('0x2f')]);_0x44775e[_0x43c5('0x32')]=_[_0x43c5('0x33')](_0x19b5d1[_0x43c5('0x32')]);_0x44775e[_0x43c5('0x34')]=_[_0x43c5('0x35')](_0x44775e['model'],_0x44775e[_0x43c5('0x32')]);_0x189e2a[_0x43c5('0x37')]=_[_0x43c5('0x35')](_0x44775e[_0x43c5('0x31')],qs[_0x43c5('0x36')](_0x19b5d1[_0x43c5('0x32')][_0x43c5('0x36')]));_0x189e2a[_0x43c5('0x37')]=_0x189e2a[_0x43c5('0x37')][_0x43c5('0x38')]?_0x189e2a[_0x43c5('0x37')]:_0x44775e[_0x43c5('0x31')];if(_0x19b5d1[_0x43c5('0x32')]['includeAll']){_0x189e2a['include']=[{'all':!![]}];}_0x189e2a=_[_0x43c5('0x3f')]({},_0x189e2a,_0x19b5d1['options']);return db[_0x43c5('0x2e')]['find'](_0x189e2a)['then'](handleEntityNotFound(_0x579e31,null))[_0x43c5('0x17')](respondWithResult(_0x579e31,null))[_0x43c5('0x49')](handleError(_0x579e31,null));};exports['create']=function(_0x83f4f5,_0x57ffbd){return db['SugarcrmConfiguration'][_0x43c5('0x4a')](_0x83f4f5[_0x43c5('0x4b')],{})['then'](respondWithResult(_0x57ffbd,0xc9))[_0x43c5('0x49')](handleError(_0x57ffbd,null));};exports[_0x43c5('0x28')]=function(_0x1e5e45,_0x4f7a1b){if(_0x1e5e45[_0x43c5('0x4b')]['id']){delete _0x1e5e45[_0x43c5('0x4b')]['id'];}return db[_0x43c5('0x2e')]['find']({'where':{'id':_0x1e5e45[_0x43c5('0x48')]['id']}})[_0x43c5('0x17')](handleEntityNotFound(_0x4f7a1b,null))[_0x43c5('0x17')](saveUpdates(_0x1e5e45[_0x43c5('0x4b')],null))[_0x43c5('0x17')](respondWithResult(_0x4f7a1b,null))[_0x43c5('0x49')](handleError(_0x4f7a1b,null));};exports[_0x43c5('0x29')]=function(_0xa6ef16,_0x1c7789){return db['SugarcrmConfiguration'][_0x43c5('0x4c')]({'where':{'id':_0xa6ef16[_0x43c5('0x48')]['id']}})[_0x43c5('0x17')](handleEntityNotFound(_0x1c7789,null))[_0x43c5('0x17')](removeEntity(_0x1c7789,null))[_0x43c5('0x49')](handleError(_0x1c7789,null));};exports['getFields']=function(_0x3a36be,_0x119100,_0x6a2a85){var _0xe685ab={};var _0x598cc9={};var _0x3556f7;var _0x56656a;return db[_0x43c5('0x2e')][_0x43c5('0x4d')]({'where':{'id':_0x3a36be['params']['id']}})[_0x43c5('0x17')](handleEntityNotFound(_0x119100,null))[_0x43c5('0x17')](function(_0x33872e){if(_0x33872e){_0x3556f7=_0x33872e;_0x598cc9[_0x43c5('0x31')]=_['keys'](db[_0x43c5('0x4e')][_0x43c5('0x2f')]);_0x598cc9['query']=_[_0x43c5('0x33')](_0x3a36be[_0x43c5('0x32')]);_0x598cc9[_0x43c5('0x34')]=_['intersection'](_0x598cc9[_0x43c5('0x31')],_0x598cc9[_0x43c5('0x32')]);_0xe685ab[_0x43c5('0x37')]=_[_0x43c5('0x35')](_0x598cc9[_0x43c5('0x31')],qs[_0x43c5('0x36')](_0x3a36be[_0x43c5('0x32')]['fields']));_0xe685ab[_0x43c5('0x37')]=_0xe685ab[_0x43c5('0x37')][_0x43c5('0x38')]?_0xe685ab[_0x43c5('0x37')]:_0x598cc9['model'];_0xe685ab['order']=qs['sort'](_0x3a36be['query'][_0x43c5('0x3b')]);_0xe685ab[_0x43c5('0x3c')]=qs['filters'](_[_0x43c5('0x3d')](_0x3a36be['query'],_0x598cc9['filters']));if(_0x3a36be['query']['filter']){_0xe685ab[_0x43c5('0x3c')]=_[_0x43c5('0x3f')](_0xe685ab[_0x43c5('0x3c')],{'$or':_[_0x43c5('0x2d')](_0xe685ab[_0x43c5('0x37')],function(_0x3ee8f3){var _0x294107={};_0x294107[_0x3ee8f3]={'$like':'%'+_0x3a36be[_0x43c5('0x32')][_0x43c5('0x3e')]+'%'};return _0x294107;})});}_0xe685ab=_[_0x43c5('0x3f')]({},_0xe685ab,_0x3a36be[_0x43c5('0x42')]);return _0x3556f7['getFields'](_0xe685ab);}})['then'](function(_0x4484a8){if(_0x4484a8){_0x56656a=_0x4484a8['length'];if(!_0x3a36be[_0x43c5('0x32')]['hasOwnProperty'](_0x43c5('0x3a'))){_0xe685ab[_0x43c5('0x23')]=qs[_0x43c5('0x23')](_0x3a36be[_0x43c5('0x32')][_0x43c5('0x23')]);_0xe685ab['offset']=qs[_0x43c5('0x22')](_0x3a36be[_0x43c5('0x32')][_0x43c5('0x22')]);}return _0x3556f7['getFields'](_0xe685ab);}})['then'](function(_0x1c762d){if(_0x1c762d){return _0x1c762d?{'count':_0x56656a,'rows':_0x1c762d}:null;}})[_0x43c5('0x17')](respondWithResult(_0x119100,null))[_0x43c5('0x49')](handleError(_0x119100,null));};exports[_0x43c5('0x4f')]=function(_0x402b7e,_0x3a5545,_0x4bf078){var _0x2ba0e1={};var _0x52dd66={};var _0xb70bb0;var _0x57eb82;return db[_0x43c5('0x2e')][_0x43c5('0x4d')]({'where':{'id':_0x402b7e['params']['id']}})['then'](handleEntityNotFound(_0x3a5545,null))[_0x43c5('0x17')](function(_0x3c9442){if(_0x3c9442){_0xb70bb0=_0x3c9442;_0x52dd66[_0x43c5('0x31')]=_['keys'](db[_0x43c5('0x4e')][_0x43c5('0x2f')]);_0x52dd66[_0x43c5('0x32')]=_[_0x43c5('0x33')](_0x402b7e[_0x43c5('0x32')]);_0x52dd66[_0x43c5('0x34')]=_['intersection'](_0x52dd66[_0x43c5('0x31')],_0x52dd66['query']);_0x2ba0e1['attributes']=_[_0x43c5('0x35')](_0x52dd66[_0x43c5('0x31')],qs[_0x43c5('0x36')](_0x402b7e['query'][_0x43c5('0x36')]));_0x2ba0e1[_0x43c5('0x37')]=_0x2ba0e1['attributes'][_0x43c5('0x38')]?_0x2ba0e1['attributes']:_0x52dd66[_0x43c5('0x31')];_0x2ba0e1[_0x43c5('0x50')]=qs[_0x43c5('0x3b')](_0x402b7e['query']['sort']);_0x2ba0e1[_0x43c5('0x3c')]=qs[_0x43c5('0x34')](_[_0x43c5('0x3d')](_0x402b7e[_0x43c5('0x32')],_0x52dd66['filters']));if(_0x402b7e['query'][_0x43c5('0x3e')]){_0x2ba0e1[_0x43c5('0x3c')]=_[_0x43c5('0x3f')](_0x2ba0e1[_0x43c5('0x3c')],{'$or':_[_0x43c5('0x2d')](_0x2ba0e1[_0x43c5('0x37')],function(_0x51fce8){var _0x400839={};_0x400839[_0x51fce8]={'$like':'%'+_0x402b7e[_0x43c5('0x32')][_0x43c5('0x3e')]+'%'};return _0x400839;})});}_0x2ba0e1=_['merge']({},_0x2ba0e1,_0x402b7e['options']);return _0xb70bb0[_0x43c5('0x4f')](_0x2ba0e1);}})[_0x43c5('0x17')](function(_0xa842e2){if(_0xa842e2){_0x57eb82=_0xa842e2[_0x43c5('0x38')];if(!_0x402b7e[_0x43c5('0x32')][_0x43c5('0x39')]('nolimit')){_0x2ba0e1[_0x43c5('0x23')]=qs[_0x43c5('0x23')](_0x402b7e['query']['limit']);_0x2ba0e1[_0x43c5('0x22')]=qs[_0x43c5('0x22')](_0x402b7e[_0x43c5('0x32')][_0x43c5('0x22')]);}return _0xb70bb0[_0x43c5('0x4f')](_0x2ba0e1);}})[_0x43c5('0x17')](function(_0x1f36be){if(_0x1f36be){return _0x1f36be?{'count':_0x57eb82,'rows':_0x1f36be}:null;}})[_0x43c5('0x17')](respondWithResult(_0x3a5545,null))[_0x43c5('0x49')](handleError(_0x3a5545,null));};exports[_0x43c5('0x51')]=function(_0x491aab,_0x4815a2,_0x50e586){var _0xc5b64={};var _0x4b548b={};var _0x514047;var _0x345b30;return db[_0x43c5('0x2e')][_0x43c5('0x4d')]({'where':{'id':_0x491aab[_0x43c5('0x48')]['id']}})[_0x43c5('0x17')](handleEntityNotFound(_0x4815a2,null))['then'](function(_0x5556ce){if(_0x5556ce){_0x514047=_0x5556ce;_0x4b548b[_0x43c5('0x31')]=_[_0x43c5('0x33')](db[_0x43c5('0x4e')][_0x43c5('0x2f')]);_0x4b548b[_0x43c5('0x32')]=_[_0x43c5('0x33')](_0x491aab[_0x43c5('0x32')]);_0x4b548b['filters']=_[_0x43c5('0x35')](_0x4b548b[_0x43c5('0x31')],_0x4b548b[_0x43c5('0x32')]);_0xc5b64[_0x43c5('0x37')]=_[_0x43c5('0x35')](_0x4b548b[_0x43c5('0x31')],qs['fields'](_0x491aab[_0x43c5('0x32')][_0x43c5('0x36')]));_0xc5b64[_0x43c5('0x37')]=_0xc5b64['attributes'][_0x43c5('0x38')]?_0xc5b64[_0x43c5('0x37')]:_0x4b548b[_0x43c5('0x31')];_0xc5b64[_0x43c5('0x50')]=qs[_0x43c5('0x3b')](_0x491aab[_0x43c5('0x32')][_0x43c5('0x3b')]);_0xc5b64[_0x43c5('0x3c')]=qs[_0x43c5('0x34')](_[_0x43c5('0x3d')](_0x491aab[_0x43c5('0x32')],_0x4b548b['filters']));if(_0x491aab[_0x43c5('0x32')]['filter']){_0xc5b64[_0x43c5('0x3c')]=_[_0x43c5('0x3f')](_0xc5b64[_0x43c5('0x3c')],{'$or':_[_0x43c5('0x2d')](_0xc5b64['attributes'],function(_0x48e2fd){var _0x154d27={};_0x154d27[_0x48e2fd]={'$like':'%'+_0x491aab[_0x43c5('0x32')][_0x43c5('0x3e')]+'%'};return _0x154d27;})});}_0xc5b64=_['merge']({},_0xc5b64,_0x491aab[_0x43c5('0x42')]);return _0x514047[_0x43c5('0x51')](_0xc5b64);}})['then'](function(_0x19caa6){if(_0x19caa6){_0x345b30=_0x19caa6[_0x43c5('0x38')];if(!_0x491aab[_0x43c5('0x32')]['hasOwnProperty']('nolimit')){_0xc5b64['limit']=qs[_0x43c5('0x23')](_0x491aab['query'][_0x43c5('0x23')]);_0xc5b64[_0x43c5('0x22')]=qs[_0x43c5('0x22')](_0x491aab[_0x43c5('0x32')][_0x43c5('0x22')]);}return _0x514047[_0x43c5('0x51')](_0xc5b64);}})[_0x43c5('0x17')](function(_0x47cb64){if(_0x47cb64){return _0x47cb64?{'count':_0x345b30,'rows':_0x47cb64}:null;}})[_0x43c5('0x17')](respondWithResult(_0x4815a2,null))[_0x43c5('0x49')](handleError(_0x4815a2,null));}; \ No newline at end of file +var _0x387b=['api','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','SugarcrmConfiguration,\x20%s,\x20%s','result','status','end','json','count','offset','limit','set','Content-Range','reject','save','sendStatus','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','find','create','body','destroy','getFields','findOne','SugarcrmField','filter','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x4552f1,_0x3a8a9b){var _0x4b7209=function(_0x2d5ffc){while(--_0x2d5ffc){_0x4552f1['push'](_0x4552f1['shift']());}};_0x4b7209(++_0x3a8a9b);}(_0x387b,0x14b));var _0xb387=function(_0x2c51b4,_0x53f633){_0x2c51b4=_0x2c51b4-0x0;var _0x45fc74=_0x387b[_0x2c51b4];return _0x45fc74;};'use strict';var pdf=require(_0xb387('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb387('0x1'));var zipdir=require(_0xb387('0x2'));var jsonpatch=require(_0xb387('0x3'));var rp=require(_0xb387('0x4'));var moment=require(_0xb387('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb387('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb387('0x7'));var csv=require(_0xb387('0x8'));var ejs=require(_0xb387('0x9'));var fs=require('fs');var _=require(_0xb387('0xa'));var squel=require(_0xb387('0xb'));var crypto=require('crypto');var jsforce=require(_0xb387('0xc'));var deskjs=require(_0xb387('0xd'));var toCsv=require(_0xb387('0x8'));var querystring=require(_0xb387('0xe'));var Papa=require(_0xb387('0xf'));var Redis=require(_0xb387('0x10'));var authService=require(_0xb387('0x11'));var qs=require(_0xb387('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb387('0x13'));var logger=require(_0xb387('0x14'))(_0xb387('0x15'));var utils=require('../../config/utils');var config=require(_0xb387('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb387('0x17'))['db'];var jayson=require(_0xb387('0x18'));var client=jayson[_0xb387('0x19')][_0xb387('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x519b1a,_0x2c69bf,_0x351fcf,_0x370294){return new BPromise(function(_0x87080b,_0x3be850){var _0x555f5a=_0x370294||client;return _0x555f5a['request'](_0x519b1a,_0x351fcf)[_0xb387('0x1b')](function(_0x94bd7e){logger[_0xb387('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2c69bf,'request\x20sent');logger[_0xb387('0x1d')](_0xb387('0x1e'),_0x2c69bf,_0xb387('0x1f'),JSON['stringify'](_0x94bd7e));if(_0x94bd7e[_0xb387('0x20')]){if(_0x94bd7e[_0xb387('0x20')]['code']===0x1f4){logger[_0xb387('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2c69bf,_0x94bd7e[_0xb387('0x20')][_0xb387('0x21')]);return _0x3be850(_0x94bd7e['error'][_0xb387('0x21')]);}logger[_0xb387('0x20')](_0xb387('0x22'),_0x2c69bf,_0x94bd7e[_0xb387('0x20')][_0xb387('0x21')]);return _0x87080b(_0x94bd7e[_0xb387('0x20')][_0xb387('0x21')]);}else{logger[_0xb387('0x1c')](_0xb387('0x22'),_0x2c69bf,_0xb387('0x1f'));_0x87080b(_0x94bd7e[_0xb387('0x23')]['message']);}})['catch'](function(_0x2410ef){logger[_0xb387('0x20')](_0xb387('0x22'),_0x2c69bf,_0x2410ef);_0x3be850(_0x2410ef);});});}function respondWithStatusCode(_0x3c8cac,_0x331ae7){_0x331ae7=_0x331ae7||0xcc;return function(_0x40163b){if(_0x40163b){return _0x3c8cac['sendStatus'](_0x331ae7);}return _0x3c8cac[_0xb387('0x24')](_0x331ae7)[_0xb387('0x25')]();};}function respondWithResult(_0x306e5c,_0x8bc18){_0x8bc18=_0x8bc18||0xc8;return function(_0x532c03){if(_0x532c03){return _0x306e5c[_0xb387('0x24')](_0x8bc18)[_0xb387('0x26')](_0x532c03);}};}function respondWithFilteredResult(_0x3f4ec5,_0x4b0f60){return function(_0x14034d){if(_0x14034d){var _0x1c58b4=_0x14034d[_0xb387('0x27')],_0x374f01=_0x4b0f60[_0xb387('0x28')],_0xcd5e4c=_0x4b0f60[_0xb387('0x28')]+_0x4b0f60[_0xb387('0x29')],_0x1f7015;if(_0xcd5e4c>=_0x1c58b4){_0xcd5e4c=_0x1c58b4;_0x1f7015=0xc8;}else{_0x1f7015=0xce;}_0x3f4ec5[_0xb387('0x24')](_0x1f7015);return _0x3f4ec5[_0xb387('0x2a')](_0xb387('0x2b'),_0x374f01+'-'+_0xcd5e4c+'/'+_0x1c58b4)[_0xb387('0x26')](_0x14034d);}return null;};}function patchUpdates(_0x461a47){return function(_0x4ef3b7){try{jsonpatch['apply'](_0x4ef3b7,_0x461a47,!![]);}catch(_0x1557b8){return BPromise[_0xb387('0x2c')](_0x1557b8);}return _0x4ef3b7[_0xb387('0x2d')]();};}function saveUpdates(_0x123e4f,_0x283197){return function(_0x4709d9){if(_0x4709d9){return _0x4709d9['update'](_0x123e4f)[_0xb387('0x1b')](function(_0x59a406){return _0x59a406;});}return null;};}function removeEntity(_0x17d167,_0x1e7f40){return function(_0x44e47b){if(_0x44e47b){return _0x44e47b['destroy']()['then'](function(){_0x17d167[_0xb387('0x24')](0xcc)[_0xb387('0x25')]();});}};}function handleEntityNotFound(_0x18e2ed,_0x71d2c0){return function(_0x458b74){if(!_0x458b74){_0x18e2ed[_0xb387('0x2e')](0x194);}return _0x458b74;};}function handleError(_0x5dfc92,_0x16f2a3){_0x16f2a3=_0x16f2a3||0x1f4;return function(_0x59b925){logger[_0xb387('0x20')](_0x59b925[_0xb387('0x2f')]);if(_0x59b925[_0xb387('0x30')]){delete _0x59b925[_0xb387('0x30')];}_0x5dfc92[_0xb387('0x24')](_0x16f2a3)[_0xb387('0x31')](_0x59b925);};}exports['index']=function(_0x34d652,_0x42de10){var _0x4c8349={},_0x24be5f={},_0x3e101b={'count':0x0,'rows':[]};var _0x430745=_[_0xb387('0x32')](db[_0xb387('0x33')][_0xb387('0x34')],function(_0x2f2323){return{'name':_0x2f2323[_0xb387('0x35')],'type':_0x2f2323[_0xb387('0x36')][_0xb387('0x37')]};});_0x24be5f['model']=_[_0xb387('0x32')](_0x430745,_0xb387('0x30'));_0x24be5f[_0xb387('0x38')]=_[_0xb387('0x39')](_0x34d652['query']);_0x24be5f['filters']=_[_0xb387('0x3a')](_0x24be5f[_0xb387('0x3b')],_0x24be5f[_0xb387('0x38')]);_0x4c8349[_0xb387('0x3c')]=_['intersection'](_0x24be5f[_0xb387('0x3b')],qs[_0xb387('0x3d')](_0x34d652['query'][_0xb387('0x3d')]));_0x4c8349[_0xb387('0x3c')]=_0x4c8349[_0xb387('0x3c')][_0xb387('0x3e')]?_0x4c8349[_0xb387('0x3c')]:_0x24be5f['model'];if(!_0x34d652[_0xb387('0x38')][_0xb387('0x3f')](_0xb387('0x40'))){_0x4c8349['limit']=qs['limit'](_0x34d652[_0xb387('0x38')][_0xb387('0x29')]);_0x4c8349[_0xb387('0x28')]=qs[_0xb387('0x28')](_0x34d652[_0xb387('0x38')][_0xb387('0x28')]);}_0x4c8349[_0xb387('0x41')]=qs[_0xb387('0x42')](_0x34d652[_0xb387('0x38')][_0xb387('0x42')]);_0x4c8349[_0xb387('0x43')]=qs[_0xb387('0x44')](_[_0xb387('0x45')](_0x34d652[_0xb387('0x38')],_0x24be5f[_0xb387('0x44')]),_0x430745);if(_0x34d652['query']['filter']){_0x4c8349[_0xb387('0x43')]=_[_0xb387('0x46')](_0x4c8349[_0xb387('0x43')],{'$or':_[_0xb387('0x32')](_0x430745,function(_0x1d2261){if(_0x1d2261[_0xb387('0x36')]!==_0xb387('0x47')){var _0x3f8e7e={};_0x3f8e7e[_0x1d2261[_0xb387('0x30')]]={'$like':'%'+_0x34d652[_0xb387('0x38')]['filter']+'%'};return _0x3f8e7e;}})});}_0x4c8349=_[_0xb387('0x46')]({},_0x4c8349,_0x34d652['options']);var _0x4b881d={'where':_0x4c8349[_0xb387('0x43')]};return db['SugarcrmConfiguration']['count'](_0x4b881d)[_0xb387('0x1b')](function(_0x336df7){_0x3e101b[_0xb387('0x27')]=_0x336df7;if(_0x34d652[_0xb387('0x38')][_0xb387('0x48')]){_0x4c8349[_0xb387('0x49')]=[{'all':!![]}];}return db[_0xb387('0x33')][_0xb387('0x4a')](_0x4c8349);})[_0xb387('0x1b')](function(_0x20412f){_0x3e101b['rows']=_0x20412f;return _0x3e101b;})['then'](respondWithFilteredResult(_0x42de10,_0x4c8349))[_0xb387('0x4b')](handleError(_0x42de10,null));};exports['show']=function(_0x525848,_0x263aaf){var _0x2ad998={'raw':![],'where':{'id':_0x525848[_0xb387('0x4c')]['id']}},_0xcdf5ce={};_0xcdf5ce[_0xb387('0x3b')]=_[_0xb387('0x39')](db['SugarcrmConfiguration']['rawAttributes']);_0xcdf5ce[_0xb387('0x38')]=_[_0xb387('0x39')](_0x525848['query']);_0xcdf5ce['filters']=_[_0xb387('0x3a')](_0xcdf5ce['model'],_0xcdf5ce['query']);_0x2ad998[_0xb387('0x3c')]=_['intersection'](_0xcdf5ce[_0xb387('0x3b')],qs[_0xb387('0x3d')](_0x525848[_0xb387('0x38')][_0xb387('0x3d')]));_0x2ad998[_0xb387('0x3c')]=_0x2ad998[_0xb387('0x3c')][_0xb387('0x3e')]?_0x2ad998[_0xb387('0x3c')]:_0xcdf5ce[_0xb387('0x3b')];if(_0x525848['query'][_0xb387('0x48')]){_0x2ad998[_0xb387('0x49')]=[{'all':!![]}];}_0x2ad998=_['merge']({},_0x2ad998,_0x525848[_0xb387('0x4d')]);return db[_0xb387('0x33')][_0xb387('0x4e')](_0x2ad998)['then'](handleEntityNotFound(_0x263aaf,null))[_0xb387('0x1b')](respondWithResult(_0x263aaf,null))[_0xb387('0x4b')](handleError(_0x263aaf,null));};exports[_0xb387('0x4f')]=function(_0x306edd,_0x698730){return db[_0xb387('0x33')]['create'](_0x306edd[_0xb387('0x50')],{})[_0xb387('0x1b')](respondWithResult(_0x698730,0xc9))[_0xb387('0x4b')](handleError(_0x698730,null));};exports['update']=function(_0x5029be,_0x12ef16){if(_0x5029be['body']['id']){delete _0x5029be[_0xb387('0x50')]['id'];}return db[_0xb387('0x33')][_0xb387('0x4e')]({'where':{'id':_0x5029be[_0xb387('0x4c')]['id']}})[_0xb387('0x1b')](handleEntityNotFound(_0x12ef16,null))[_0xb387('0x1b')](saveUpdates(_0x5029be[_0xb387('0x50')],null))[_0xb387('0x1b')](respondWithResult(_0x12ef16,null))[_0xb387('0x4b')](handleError(_0x12ef16,null));};exports[_0xb387('0x51')]=function(_0x59ee36,_0x5ed5e5){return db[_0xb387('0x33')][_0xb387('0x4e')]({'where':{'id':_0x59ee36[_0xb387('0x4c')]['id']}})[_0xb387('0x1b')](handleEntityNotFound(_0x5ed5e5,null))[_0xb387('0x1b')](removeEntity(_0x5ed5e5,null))[_0xb387('0x4b')](handleError(_0x5ed5e5,null));};exports[_0xb387('0x52')]=function(_0x4a03a6,_0x2c5bee,_0x153974){var _0x3a291e={};var _0x516173={};var _0xf9dd45;var _0x432232;return db[_0xb387('0x33')][_0xb387('0x53')]({'where':{'id':_0x4a03a6[_0xb387('0x4c')]['id']}})[_0xb387('0x1b')](handleEntityNotFound(_0x2c5bee,null))[_0xb387('0x1b')](function(_0x53ab2e){if(_0x53ab2e){_0xf9dd45=_0x53ab2e;_0x516173['model']=_[_0xb387('0x39')](db[_0xb387('0x54')][_0xb387('0x34')]);_0x516173[_0xb387('0x38')]=_[_0xb387('0x39')](_0x4a03a6[_0xb387('0x38')]);_0x516173[_0xb387('0x44')]=_['intersection'](_0x516173[_0xb387('0x3b')],_0x516173[_0xb387('0x38')]);_0x3a291e[_0xb387('0x3c')]=_['intersection'](_0x516173[_0xb387('0x3b')],qs[_0xb387('0x3d')](_0x4a03a6[_0xb387('0x38')][_0xb387('0x3d')]));_0x3a291e[_0xb387('0x3c')]=_0x3a291e[_0xb387('0x3c')][_0xb387('0x3e')]?_0x3a291e[_0xb387('0x3c')]:_0x516173[_0xb387('0x3b')];_0x3a291e[_0xb387('0x41')]=qs[_0xb387('0x42')](_0x4a03a6[_0xb387('0x38')][_0xb387('0x42')]);_0x3a291e[_0xb387('0x43')]=qs['filters'](_[_0xb387('0x45')](_0x4a03a6['query'],_0x516173['filters']));if(_0x4a03a6[_0xb387('0x38')][_0xb387('0x55')]){_0x3a291e['where']=_[_0xb387('0x46')](_0x3a291e[_0xb387('0x43')],{'$or':_[_0xb387('0x32')](_0x3a291e[_0xb387('0x3c')],function(_0x455490){var _0x3362b5={};_0x3362b5[_0x455490]={'$like':'%'+_0x4a03a6[_0xb387('0x38')][_0xb387('0x55')]+'%'};return _0x3362b5;})});}_0x3a291e=_[_0xb387('0x46')]({},_0x3a291e,_0x4a03a6['options']);return _0xf9dd45[_0xb387('0x52')](_0x3a291e);}})[_0xb387('0x1b')](function(_0x5543c3){if(_0x5543c3){_0x432232=_0x5543c3[_0xb387('0x3e')];if(!_0x4a03a6[_0xb387('0x38')][_0xb387('0x3f')](_0xb387('0x40'))){_0x3a291e['limit']=qs[_0xb387('0x29')](_0x4a03a6[_0xb387('0x38')][_0xb387('0x29')]);_0x3a291e[_0xb387('0x28')]=qs[_0xb387('0x28')](_0x4a03a6[_0xb387('0x38')][_0xb387('0x28')]);}return _0xf9dd45['getFields'](_0x3a291e);}})[_0xb387('0x1b')](function(_0x3e9012){if(_0x3e9012){return _0x3e9012?{'count':_0x432232,'rows':_0x3e9012}:null;}})[_0xb387('0x1b')](respondWithResult(_0x2c5bee,null))[_0xb387('0x4b')](handleError(_0x2c5bee,null));};exports[_0xb387('0x56')]=function(_0x3bf218,_0x23e08b,_0x4dbe21){var _0x18ae73={};var _0x2c1e39={};var _0x2c737f;var _0x3508b8;return db[_0xb387('0x33')][_0xb387('0x53')]({'where':{'id':_0x3bf218[_0xb387('0x4c')]['id']}})[_0xb387('0x1b')](handleEntityNotFound(_0x23e08b,null))['then'](function(_0x489b87){if(_0x489b87){_0x2c737f=_0x489b87;_0x2c1e39[_0xb387('0x3b')]=_[_0xb387('0x39')](db[_0xb387('0x54')][_0xb387('0x34')]);_0x2c1e39[_0xb387('0x38')]=_['keys'](_0x3bf218[_0xb387('0x38')]);_0x2c1e39[_0xb387('0x44')]=_[_0xb387('0x3a')](_0x2c1e39[_0xb387('0x3b')],_0x2c1e39['query']);_0x18ae73[_0xb387('0x3c')]=_[_0xb387('0x3a')](_0x2c1e39[_0xb387('0x3b')],qs[_0xb387('0x3d')](_0x3bf218[_0xb387('0x38')]['fields']));_0x18ae73[_0xb387('0x3c')]=_0x18ae73[_0xb387('0x3c')][_0xb387('0x3e')]?_0x18ae73[_0xb387('0x3c')]:_0x2c1e39[_0xb387('0x3b')];_0x18ae73[_0xb387('0x41')]=qs[_0xb387('0x42')](_0x3bf218[_0xb387('0x38')]['sort']);_0x18ae73[_0xb387('0x43')]=qs[_0xb387('0x44')](_['pick'](_0x3bf218[_0xb387('0x38')],_0x2c1e39[_0xb387('0x44')]));if(_0x3bf218[_0xb387('0x38')]['filter']){_0x18ae73[_0xb387('0x43')]=_['merge'](_0x18ae73['where'],{'$or':_['map'](_0x18ae73[_0xb387('0x3c')],function(_0x2ab9d8){var _0x20c2ee={};_0x20c2ee[_0x2ab9d8]={'$like':'%'+_0x3bf218['query'][_0xb387('0x55')]+'%'};return _0x20c2ee;})});}_0x18ae73=_[_0xb387('0x46')]({},_0x18ae73,_0x3bf218[_0xb387('0x4d')]);return _0x2c737f[_0xb387('0x56')](_0x18ae73);}})[_0xb387('0x1b')](function(_0x3eb3aa){if(_0x3eb3aa){_0x3508b8=_0x3eb3aa['length'];if(!_0x3bf218[_0xb387('0x38')][_0xb387('0x3f')](_0xb387('0x40'))){_0x18ae73['limit']=qs[_0xb387('0x29')](_0x3bf218[_0xb387('0x38')]['limit']);_0x18ae73[_0xb387('0x28')]=qs['offset'](_0x3bf218[_0xb387('0x38')]['offset']);}return _0x2c737f[_0xb387('0x56')](_0x18ae73);}})[_0xb387('0x1b')](function(_0x31d833){if(_0x31d833){return _0x31d833?{'count':_0x3508b8,'rows':_0x31d833}:null;}})[_0xb387('0x1b')](respondWithResult(_0x23e08b,null))[_0xb387('0x4b')](handleError(_0x23e08b,null));};exports[_0xb387('0x57')]=function(_0x471c19,_0x1d4ac5,_0x143b3b){var _0x3b67de={};var _0xbc0bb8={};var _0x3d5a53;var _0x1675e1;return db[_0xb387('0x33')][_0xb387('0x53')]({'where':{'id':_0x471c19[_0xb387('0x4c')]['id']}})[_0xb387('0x1b')](handleEntityNotFound(_0x1d4ac5,null))[_0xb387('0x1b')](function(_0x48d9b7){if(_0x48d9b7){_0x3d5a53=_0x48d9b7;_0xbc0bb8['model']=_['keys'](db['SugarcrmField'][_0xb387('0x34')]);_0xbc0bb8[_0xb387('0x38')]=_[_0xb387('0x39')](_0x471c19[_0xb387('0x38')]);_0xbc0bb8[_0xb387('0x44')]=_[_0xb387('0x3a')](_0xbc0bb8['model'],_0xbc0bb8[_0xb387('0x38')]);_0x3b67de[_0xb387('0x3c')]=_['intersection'](_0xbc0bb8[_0xb387('0x3b')],qs['fields'](_0x471c19[_0xb387('0x38')][_0xb387('0x3d')]));_0x3b67de[_0xb387('0x3c')]=_0x3b67de[_0xb387('0x3c')][_0xb387('0x3e')]?_0x3b67de[_0xb387('0x3c')]:_0xbc0bb8[_0xb387('0x3b')];_0x3b67de[_0xb387('0x41')]=qs[_0xb387('0x42')](_0x471c19['query'][_0xb387('0x42')]);_0x3b67de[_0xb387('0x43')]=qs['filters'](_[_0xb387('0x45')](_0x471c19[_0xb387('0x38')],_0xbc0bb8[_0xb387('0x44')]));if(_0x471c19[_0xb387('0x38')][_0xb387('0x55')]){_0x3b67de[_0xb387('0x43')]=_[_0xb387('0x46')](_0x3b67de[_0xb387('0x43')],{'$or':_[_0xb387('0x32')](_0x3b67de[_0xb387('0x3c')],function(_0x5e8306){var _0x10bb78={};_0x10bb78[_0x5e8306]={'$like':'%'+_0x471c19[_0xb387('0x38')][_0xb387('0x55')]+'%'};return _0x10bb78;})});}_0x3b67de=_['merge']({},_0x3b67de,_0x471c19[_0xb387('0x4d')]);return _0x3d5a53[_0xb387('0x57')](_0x3b67de);}})[_0xb387('0x1b')](function(_0x5a0a9f){if(_0x5a0a9f){_0x1675e1=_0x5a0a9f[_0xb387('0x3e')];if(!_0x471c19[_0xb387('0x38')][_0xb387('0x3f')](_0xb387('0x40'))){_0x3b67de[_0xb387('0x29')]=qs[_0xb387('0x29')](_0x471c19['query']['limit']);_0x3b67de[_0xb387('0x28')]=qs[_0xb387('0x28')](_0x471c19[_0xb387('0x38')]['offset']);}return _0x3d5a53[_0xb387('0x57')](_0x3b67de);}})['then'](function(_0xc9e7e9){if(_0xc9e7e9){return _0xc9e7e9?{'count':_0x1675e1,'rows':_0xc9e7e9}:null;}})[_0xb387('0x1b')](respondWithResult(_0x1d4ac5,null))[_0xb387('0x4b')](handleError(_0x1d4ac5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 9026b9b..490e038 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 _0x78bb=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x3cda69,_0x4dea92){var _0x530268=function(_0xf0d24){while(--_0xf0d24){_0x3cda69['push'](_0x3cda69['shift']());}};_0x530268(++_0x4dea92);}(_0x78bb,0x84));var _0xb78b=function(_0x435fa1,_0x58550a){_0x435fa1=_0x435fa1-0x0;var _0x845f9f=_0x78bb[_0x435fa1];return _0x845f9f;};'use strict';var _=require(_0xb78b('0x0'));var util=require(_0xb78b('0x1'));var logger=require(_0xb78b('0x2'))(_0xb78b('0x3'));var moment=require(_0xb78b('0x4'));var BPromise=require('bluebird');var rp=require(_0xb78b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb78b('0x6'));var config=require(_0xb78b('0x7'));var attributes=require(_0xb78b('0x8'));module[_0xb78b('0x9')]=function(_0xf04aa0,_0x362961){return _0xf04aa0[_0xb78b('0xa')](_0xb78b('0xb'),attributes,{'tableName':_0xb78b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd3f=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x143a6a,_0x560e0f){var _0x4bbe68=function(_0x200889){while(--_0x200889){_0x143a6a['push'](_0x143a6a['shift']());}};_0x4bbe68(++_0x560e0f);}(_0xdd3f,0x16d));var _0xfdd3=function(_0x253a79,_0x2311b1){_0x253a79=_0x253a79-0x0;var _0x2bf78b=_0xdd3f[_0x253a79];return _0x2bf78b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfdd3('0x0'))(_0xfdd3('0x1'));var moment=require(_0xfdd3('0x2'));var BPromise=require(_0xfdd3('0x3'));var rp=require(_0xfdd3('0x4'));var fs=require('fs');var path=require(_0xfdd3('0x5'));var rimraf=require(_0xfdd3('0x6'));var config=require(_0xfdd3('0x7'));var attributes=require(_0xfdd3('0x8'));module[_0xfdd3('0x9')]=function(_0x25ea1a,_0x4bc155){return _0x25ea1a[_0xfdd3('0xa')](_0xfdd3('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','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 26d7414..503ec57 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 _0x18c4=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result'];(function(_0x51d20e,_0x426e72){var _0x1005bd=function(_0x3033ad){while(--_0x3033ad){_0x51d20e['push'](_0x51d20e['shift']());}};_0x1005bd(++_0x426e72);}(_0x18c4,0x17c));var _0x418c=function(_0x3fd7c8,_0x453506){_0x3fd7c8=_0x3fd7c8-0x0;var _0xa9f40b=_0x18c4[_0x3fd7c8];return _0xa9f40b;};'use strict';var _=require(_0x418c('0x0'));var util=require(_0x418c('0x1'));var moment=require('moment');var BPromise=require(_0x418c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x418c('0x3'))['db'];var utils=require(_0x418c('0x4'));var logger=require(_0x418c('0x5'))(_0x418c('0x6'));var config=require(_0x418c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x418c('0x8')][_0x418c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x165c65,_0x5bd1b8,_0x3b6ce3){return new BPromise(function(_0x435a2d,_0x125be3){return client[_0x418c('0xa')](_0x165c65,_0x3b6ce3)[_0x418c('0xb')](function(_0x568ee9){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5bd1b8,_0x418c('0xc'));logger[_0x418c('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x5bd1b8,_0x418c('0xc'),JSON[_0x418c('0xe')](_0x568ee9));if(_0x568ee9['error']){if(_0x568ee9[_0x418c('0xf')]['code']===0x1f4){logger[_0x418c('0xf')](_0x418c('0x10'),_0x5bd1b8,_0x568ee9[_0x418c('0xf')][_0x418c('0x11')]);return _0x125be3(_0x568ee9[_0x418c('0xf')][_0x418c('0x11')]);}logger[_0x418c('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5bd1b8,_0x568ee9['error']['message']);return _0x435a2d(_0x568ee9['error']['message']);}else{logger[_0x418c('0x12')](_0x418c('0x10'),_0x5bd1b8,_0x418c('0xc'));_0x435a2d(_0x568ee9[_0x418c('0x13')]['message']);}})['catch'](function(_0x53dfe1){logger[_0x418c('0xf')](_0x418c('0x10'),_0x5bd1b8,_0x53dfe1);_0x125be3(_0x53dfe1);});});} \ No newline at end of file +var _0x48a5=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1fffcc,_0xb258ec){var _0xa83ea3=function(_0x327fcc){while(--_0x327fcc){_0x1fffcc['push'](_0x1fffcc['shift']());}};_0xa83ea3(++_0xb258ec);}(_0x48a5,0x143));var _0x548a=function(_0x3b4eee,_0x336f9a){_0x3b4eee=_0x3b4eee-0x0;var _0x5c9421=_0x48a5[_0x3b4eee];return _0x5c9421;};'use strict';var _=require(_0x548a('0x0'));var util=require('util');var moment=require(_0x548a('0x1'));var BPromise=require(_0x548a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x548a('0x3'));var db=require(_0x548a('0x4'))['db'];var utils=require(_0x548a('0x5'));var logger=require(_0x548a('0x6'))(_0x548a('0x7'));var config=require(_0x548a('0x8'));var jayson=require(_0x548a('0x9'));var client=jayson[_0x548a('0xa')][_0x548a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x426e09,_0x558d6b,_0x40a7c2){return new BPromise(function(_0x66c1d8,_0x4b7a93){return client['request'](_0x426e09,_0x40a7c2)[_0x548a('0xc')](function(_0x28b2b6){logger['info'](_0x548a('0xd'),_0x558d6b,'request\x20sent');logger[_0x548a('0xe')](_0x548a('0xf'),_0x558d6b,_0x548a('0x10'),JSON[_0x548a('0x11')](_0x28b2b6));if(_0x28b2b6[_0x548a('0x12')]){if(_0x28b2b6[_0x548a('0x12')][_0x548a('0x13')]===0x1f4){logger['error'](_0x548a('0xd'),_0x558d6b,_0x28b2b6[_0x548a('0x12')]['message']);return _0x4b7a93(_0x28b2b6[_0x548a('0x12')][_0x548a('0x14')]);}logger[_0x548a('0x12')](_0x548a('0xd'),_0x558d6b,_0x28b2b6[_0x548a('0x12')][_0x548a('0x14')]);return _0x66c1d8(_0x28b2b6[_0x548a('0x12')][_0x548a('0x14')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x558d6b,_0x548a('0x10'));_0x66c1d8(_0x28b2b6[_0x548a('0x15')]['message']);}})[_0x548a('0x16')](function(_0x53c91a){logger['error'](_0x548a('0xd'),_0x558d6b,_0x53c91a);_0x4b7a93(_0x53c91a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index cff2a1c..e23f508 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 _0x04d5=['delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x3b0b0e,_0x53ee68){var _0x1d18ad=function(_0x4fa6c5){while(--_0x4fa6c5){_0x3b0b0e['push'](_0x3b0b0e['shift']());}};_0x1d18ad(++_0x53ee68);}(_0x04d5,0x1b2));var _0x504d=function(_0x269020,_0x2622d1){_0x269020=_0x269020-0x0;var _0x5e00d1=_0x04d5[_0x269020];return _0x5e00d1;};'use strict';var multer=require(_0x504d('0x0'));var util=require(_0x504d('0x1'));var path=require(_0x504d('0x2'));var timeout=require(_0x504d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x504d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x504d('0x5'));var controller=require(_0x504d('0x6'));router[_0x504d('0x7')]('/',auth['isAuthenticated'](),controller[_0x504d('0x8')]);router['get'](_0x504d('0x9'),auth['isAuthenticated'](),controller[_0x504d('0xa')]);router[_0x504d('0xb')]('/',auth[_0x504d('0xc')](),controller[_0x504d('0xd')]);router[_0x504d('0xe')]('/:id',auth[_0x504d('0xc')](),controller[_0x504d('0xf')]);router[_0x504d('0x10')](_0x504d('0x9'),auth[_0x504d('0xc')](),controller[_0x504d('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb14a=['Router','../../components/auth/service','get','isAuthenticated','show','post','create','/:id','update','delete','multer','util','path','connect-timeout','express'];(function(_0x462dc9,_0x1e77e0){var _0x4268b6=function(_0x1bde57){while(--_0x1bde57){_0x462dc9['push'](_0x462dc9['shift']());}};_0x4268b6(++_0x1e77e0);}(_0xb14a,0x109));var _0xab14=function(_0x43c440,_0x223bd4){_0x43c440=_0x43c440-0x0;var _0x4f3bc0=_0xb14a[_0x43c440];return _0x4f3bc0;};'use strict';var multer=require(_0xab14('0x0'));var util=require(_0xab14('0x1'));var path=require(_0xab14('0x2'));var timeout=require(_0xab14('0x3'));var express=require(_0xab14('0x4'));var router=express[_0xab14('0x5')]();var auth=require(_0xab14('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0xab14('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xab14('0x7')]('/:id',auth[_0xab14('0x8')](),controller[_0xab14('0x9')]);router[_0xab14('0xa')]('/',auth[_0xab14('0x8')](),controller[_0xab14('0xb')]);router['put'](_0xab14('0xc'),auth[_0xab14('0x8')](),controller[_0xab14('0xd')]);router[_0xab14('0xe')](_0xab14('0xc'),auth[_0xab14('0x8')](),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 e76284d..7ae1a79 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 _0x7da7=['exports','ENUM','customVariable','keyValue','STRING','string','variable','BOOLEAN','sequelize'];(function(_0x2e5a06,_0x52a16d){var _0x1d2ea7=function(_0x528c9e){while(--_0x528c9e){_0x2e5a06['push'](_0x2e5a06['shift']());}};_0x1d2ea7(++_0x52a16d);}(_0x7da7,0x10d));var _0x77da=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0x7da7[_0x3457b4];return _0xaa8fa9;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'type':{'type':Sequelize[_0x77da('0x2')]('string','variable',_0x77da('0x3'),_0x77da('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x77da('0x5')]},'key':{'type':Sequelize[_0x77da('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x77da('0x6'),_0x77da('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x77da('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x77da('0x5')]},'customField':{'type':Sequelize[_0x77da('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x77da('0x5')]}}; \ No newline at end of file +var _0xde5f=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x5f3c92,_0x52b722){var _0x58d180=function(_0x5a7630){while(--_0x5a7630){_0x5f3c92['push'](_0x5f3c92['shift']());}};_0x58d180(++_0x52b722);}(_0xde5f,0x97));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfde5('0x0'));module[_0xfde5('0x1')]={'type':{'type':Sequelize[_0xfde5('0x2')](_0xfde5('0x3'),_0xfde5('0x4'),_0xfde5('0x5'),_0xfde5('0x6')),'defaultValue':_0xfde5('0x3')},'content':{'type':Sequelize[_0xfde5('0x7')]},'key':{'type':Sequelize[_0xfde5('0x7')]},'keyType':{'type':Sequelize[_0xfde5('0x2')](_0xfde5('0x3'),_0xfde5('0x4'),_0xfde5('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfde5('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfde5('0x8')],'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 9a5b914..a000fd2 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 _0x9c5a=['VIRTUAL','merge','options','include','findAll','rows','catch','params','keys','find','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type'];(function(_0x41683e,_0x51f863){var _0x1a2158=function(_0x16f95b){while(--_0x16f95b){_0x41683e['push'](_0x41683e['shift']());}};_0x1a2158(++_0x51f863);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5b88cd,_0x55e055){_0x5b88cd=_0x5b88cd-0x0;var _0x3da70a=_0x9c5a[_0x5b88cd];return _0x3da70a;};'use strict';var pdf=require(_0xa9c5('0x0'));var emlformat=require(_0xa9c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa9c5('0x2'));var jsonpatch=require(_0xa9c5('0x3'));var rp=require(_0xa9c5('0x4'));var moment=require(_0xa9c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa9c5('0x6'));var util=require(_0xa9c5('0x7'));var path=require('path');var sox=require(_0xa9c5('0x8'));var csv=require('to-csv');var ejs=require(_0xa9c5('0x9'));var fs=require('fs');var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=_0x19a43e[_0xa9c5('0x1b')],_0x4bb57e=_0x40b001['offset'],_0x2b0d73=_0x40b001[_0xa9c5('0x1c')]+_0x40b001[_0xa9c5('0x1d')],_0xd85c32;if(_0x2b0d73>=_0xcf13f2){_0x2b0d73=_0xcf13f2;_0xd85c32=0xc8;}else{_0xd85c32=0xce;}_0x251099[_0xa9c5('0x19')](_0xd85c32);return _0x251099[_0xa9c5('0x1e')](_0xa9c5('0x1f'),_0x4bb57e+'-'+_0x2b0d73+'/'+_0xcf13f2)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x3b8d4d){return function(_0x1e5ce6){try{jsonpatch[_0xa9c5('0x20')](_0x1e5ce6,_0x3b8d4d,!![]);}catch(_0x36c486){return BPromise[_0xa9c5('0x21')](_0x36c486);}return _0x1e5ce6[_0xa9c5('0x22')]();};}function saveUpdates(_0x54f8b9,_0x1115ad){return function(_0x21ab50){if(_0x21ab50){return _0x21ab50['update'](_0x54f8b9)['then'](function(_0xce9af6){return _0xce9af6;});}return null;};}function removeEntity(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')]()[_0xa9c5('0x24')](function(){_0x366f5c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4e1b,_0x11d395){return function(_0x4b0f05){if(!_0x4b0f05){_0x3d4e1b[_0xa9c5('0x17')](0x194);}return _0x4b0f05;};}function handleError(_0x424b4c,_0x306c9b){_0x306c9b=_0x306c9b||0x1f4;return function(_0x32fc7d){logger[_0xa9c5('0x25')](_0x32fc7d[_0xa9c5('0x26')]);if(_0x32fc7d[_0xa9c5('0x27')]){delete _0x32fc7d['name'];}_0x424b4c['status'](_0x306c9b)[_0xa9c5('0x28')](_0x32fc7d);};}exports['index']=function(_0x1762ac,_0x830bad){var _0x4caefa={},_0x11a723={},_0x320dc0={'count':0x0,'rows':[]};var _0x5f468b=_[_0xa9c5('0x29')](db[_0xa9c5('0x2a')][_0xa9c5('0x2b')],function(_0x185eb8){return{'name':_0x185eb8[_0xa9c5('0x2c')],'type':_0x185eb8['type'][_0xa9c5('0x2d')]};});_0x11a723['model']=_[_0xa9c5('0x29')](_0x5f468b,_0xa9c5('0x27'));_0x11a723[_0xa9c5('0x2e')]=_['keys'](_0x1762ac[_0xa9c5('0x2e')]);_0x11a723[_0xa9c5('0x2f')]=_['intersection'](_0x11a723[_0xa9c5('0x30')],_0x11a723[_0xa9c5('0x2e')]);_0x4caefa[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x11a723[_0xa9c5('0x30')],qs[_0xa9c5('0x33')](_0x1762ac[_0xa9c5('0x2e')]['fields']));_0x4caefa[_0xa9c5('0x31')]=_0x4caefa[_0xa9c5('0x31')][_0xa9c5('0x34')]?_0x4caefa[_0xa9c5('0x31')]:_0x11a723[_0xa9c5('0x30')];if(!_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x4caefa['limit']=qs['limit'](_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x1d')]);_0x4caefa[_0xa9c5('0x1c')]=qs[_0xa9c5('0x1c')](_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x1c')]);}_0x4caefa['order']=qs['sort'](_0x1762ac['query'][_0xa9c5('0x37')]);_0x4caefa[_0xa9c5('0x38')]=qs['filters'](_[_0xa9c5('0x39')](_0x1762ac['query'],_0x11a723[_0xa9c5('0x2f')]),_0x5f468b);if(_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x4caefa[_0xa9c5('0x38')]=_['merge'](_0x4caefa[_0xa9c5('0x38')],{'$or':_[_0xa9c5('0x29')](_0x5f468b,function(_0x191153){if(_0x191153[_0xa9c5('0x3b')]!==_0xa9c5('0x3c')){var _0x17ef8e={};_0x17ef8e[_0x191153[_0xa9c5('0x27')]]={'$like':'%'+_0x1762ac[_0xa9c5('0x2e')]['filter']+'%'};return _0x17ef8e;}})});}_0x4caefa=_[_0xa9c5('0x3d')]({},_0x4caefa,_0x1762ac[_0xa9c5('0x3e')]);var _0x841c18={'where':_0x4caefa[_0xa9c5('0x38')]};return db[_0xa9c5('0x2a')][_0xa9c5('0x1b')](_0x841c18)['then'](function(_0x307736){_0x320dc0['count']=_0x307736;if(_0x1762ac[_0xa9c5('0x2e')]['includeAll']){_0x4caefa[_0xa9c5('0x3f')]=[{'all':!![]}];}return db[_0xa9c5('0x2a')][_0xa9c5('0x40')](_0x4caefa);})['then'](function(_0x12e19c){_0x320dc0[_0xa9c5('0x41')]=_0x12e19c;return _0x320dc0;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x830bad,_0x4caefa))[_0xa9c5('0x42')](handleError(_0x830bad,null));};exports['show']=function(_0x2dbb48,_0x97803f){var _0x3db918={'raw':!![],'where':{'id':_0x2dbb48[_0xa9c5('0x43')]['id']}},_0x45668e={};_0x45668e['model']=_[_0xa9c5('0x44')](db['SugarcrmField'][_0xa9c5('0x2b')]);_0x45668e[_0xa9c5('0x2e')]=_[_0xa9c5('0x44')](_0x2dbb48[_0xa9c5('0x2e')]);_0x45668e[_0xa9c5('0x2f')]=_[_0xa9c5('0x32')](_0x45668e[_0xa9c5('0x30')],_0x45668e[_0xa9c5('0x2e')]);_0x3db918[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x45668e['model'],qs[_0xa9c5('0x33')](_0x2dbb48[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x3db918[_0xa9c5('0x31')]=_0x3db918[_0xa9c5('0x31')][_0xa9c5('0x34')]?_0x3db918['attributes']:_0x45668e[_0xa9c5('0x30')];if(_0x2dbb48[_0xa9c5('0x2e')]['includeAll']){_0x3db918['include']=[{'all':!![]}];}_0x3db918=_['merge']({},_0x3db918,_0x2dbb48['options']);return db['SugarcrmField'][_0xa9c5('0x45')](_0x3db918)[_0xa9c5('0x24')](handleEntityNotFound(_0x97803f,null))[_0xa9c5('0x24')](respondWithResult(_0x97803f,null))[_0xa9c5('0x42')](handleError(_0x97803f,null));};exports[_0xa9c5('0x46')]=function(_0x240c40,_0xec9c4){return db[_0xa9c5('0x2a')][_0xa9c5('0x46')](_0x240c40[_0xa9c5('0x47')],{})[_0xa9c5('0x24')](respondWithResult(_0xec9c4,0xc9))[_0xa9c5('0x42')](handleError(_0xec9c4,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){if(_0x4bf8b4['body']['id']){delete _0x4bf8b4[_0xa9c5('0x47')]['id'];}return db[_0xa9c5('0x2a')]['find']({'where':{'id':_0x4bf8b4['params']['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x1108f0,null))[_0xa9c5('0x24')](saveUpdates(_0x4bf8b4[_0xa9c5('0x47')],null))['then'](respondWithResult(_0x1108f0,null))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0xd03cec,_0x481f9c){return db[_0xa9c5('0x2a')][_0xa9c5('0x45')]({'where':{'id':_0xd03cec[_0xa9c5('0x43')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x481f9c,null))[_0xa9c5('0x24')](removeEntity(_0x481f9c,null))[_0xa9c5('0x42')](handleError(_0x481f9c,null));}; \ No newline at end of file +var _0x5fab=['rows','catch','show','fields','includeAll','create','body','update','find','params','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','status','json','offset','limit','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','count','include'];(function(_0x129ba7,_0x103a94){var _0x46a696=function(_0x11bdfe){while(--_0x11bdfe){_0x129ba7['push'](_0x129ba7['shift']());}};_0x46a696(++_0x103a94);}(_0x5fab,0x177));var _0xb5fa=function(_0x536128,_0x205e2b){_0x536128=_0x536128-0x0;var _0x19eb75=_0x5fab[_0x536128];return _0x19eb75;};'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'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=_0x38e964['count'],_0x31f252=_0x567f31[_0xb5fa('0x1c')],_0x27c8f7=_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1d')],_0x56fe10;if(_0x27c8f7>=_0x587043){_0x27c8f7=_0x587043;_0x56fe10=0xc8;}else{_0x56fe10=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0x56fe10);return _0x5371cf[_0xb5fa('0x1e')](_0xb5fa('0x1f'),_0x31f252+'-'+_0x27c8f7+'/'+_0x587043)[_0xb5fa('0x1b')](_0x38e964);}return null;};}function patchUpdates(_0x21f4f4){return function(_0xc14dc4){try{jsonpatch[_0xb5fa('0x20')](_0xc14dc4,_0x21f4f4,!![]);}catch(_0x3c8d53){return BPromise[_0xb5fa('0x21')](_0x3c8d53);}return _0xc14dc4['save']();};}function saveUpdates(_0x432bfa,_0x519e20){return function(_0x37ae06){if(_0x37ae06){return _0x37ae06['update'](_0x432bfa)[_0xb5fa('0x22')](function(_0x43c09f){return _0x43c09f;});}return null;};}function removeEntity(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x23')]()['then'](function(){_0x4e05c0[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x24')]();});}};}function handleEntityNotFound(_0x444237,_0x542348){return function(_0x224ec8){if(!_0x224ec8){_0x444237['sendStatus'](0x194);}return _0x224ec8;};}function handleError(_0x106c4b,_0x264591){_0x264591=_0x264591||0x1f4;return function(_0x11053a){logger[_0xb5fa('0x25')](_0x11053a[_0xb5fa('0x26')]);if(_0x11053a[_0xb5fa('0x27')]){delete _0x11053a[_0xb5fa('0x27')];}_0x106c4b[_0xb5fa('0x1a')](_0x264591)['send'](_0x11053a);};}exports['index']=function(_0x5bdf11,_0x5a1c39){var _0x28a350={},_0x460b54={},_0x12c0d4={'count':0x0,'rows':[]};var _0x2bdf50=_[_0xb5fa('0x28')](db[_0xb5fa('0x29')][_0xb5fa('0x2a')],function(_0x353314){return{'name':_0x353314[_0xb5fa('0x2b')],'type':_0x353314[_0xb5fa('0x2c')][_0xb5fa('0x2d')]};});_0x460b54[_0xb5fa('0x2e')]=_[_0xb5fa('0x28')](_0x2bdf50,_0xb5fa('0x27'));_0x460b54[_0xb5fa('0x2f')]=_[_0xb5fa('0x30')](_0x5bdf11[_0xb5fa('0x2f')]);_0x460b54[_0xb5fa('0x31')]=_[_0xb5fa('0x32')](_0x460b54[_0xb5fa('0x2e')],_0x460b54[_0xb5fa('0x2f')]);_0x28a350[_0xb5fa('0x33')]=_[_0xb5fa('0x32')](_0x460b54[_0xb5fa('0x2e')],qs['fields'](_0x5bdf11[_0xb5fa('0x2f')]['fields']));_0x28a350['attributes']=_0x28a350['attributes'][_0xb5fa('0x34')]?_0x28a350['attributes']:_0x460b54[_0xb5fa('0x2e')];if(!_0x5bdf11['query']['hasOwnProperty'](_0xb5fa('0x35'))){_0x28a350[_0xb5fa('0x1d')]=qs['limit'](_0x5bdf11['query'][_0xb5fa('0x1d')]);_0x28a350[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x5bdf11['query'][_0xb5fa('0x1c')]);}_0x28a350[_0xb5fa('0x36')]=qs['sort'](_0x5bdf11[_0xb5fa('0x2f')][_0xb5fa('0x37')]);_0x28a350[_0xb5fa('0x38')]=qs['filters'](_[_0xb5fa('0x39')](_0x5bdf11[_0xb5fa('0x2f')],_0x460b54[_0xb5fa('0x31')]),_0x2bdf50);if(_0x5bdf11['query'][_0xb5fa('0x3a')]){_0x28a350[_0xb5fa('0x38')]=_[_0xb5fa('0x3b')](_0x28a350[_0xb5fa('0x38')],{'$or':_['map'](_0x2bdf50,function(_0x4bba91){if(_0x4bba91['type']!=='VIRTUAL'){var _0x5989e1={};_0x5989e1[_0x4bba91['name']]={'$like':'%'+_0x5bdf11[_0xb5fa('0x2f')]['filter']+'%'};return _0x5989e1;}})});}_0x28a350=_[_0xb5fa('0x3b')]({},_0x28a350,_0x5bdf11[_0xb5fa('0x3c')]);var _0x36db1a={'where':_0x28a350[_0xb5fa('0x38')]};return db[_0xb5fa('0x29')][_0xb5fa('0x3d')](_0x36db1a)['then'](function(_0x57efb3){_0x12c0d4['count']=_0x57efb3;if(_0x5bdf11[_0xb5fa('0x2f')]['includeAll']){_0x28a350[_0xb5fa('0x3e')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x28a350);})[_0xb5fa('0x22')](function(_0x42d331){_0x12c0d4[_0xb5fa('0x3f')]=_0x42d331;return _0x12c0d4;})[_0xb5fa('0x22')](respondWithFilteredResult(_0x5a1c39,_0x28a350))[_0xb5fa('0x40')](handleError(_0x5a1c39,null));};exports[_0xb5fa('0x41')]=function(_0x337c53,_0x83df0b){var _0x19e370={'raw':!![],'where':{'id':_0x337c53['params']['id']}},_0x402a68={};_0x402a68[_0xb5fa('0x2e')]=_['keys'](db[_0xb5fa('0x29')][_0xb5fa('0x2a')]);_0x402a68[_0xb5fa('0x2f')]=_[_0xb5fa('0x30')](_0x337c53[_0xb5fa('0x2f')]);_0x402a68[_0xb5fa('0x31')]=_[_0xb5fa('0x32')](_0x402a68[_0xb5fa('0x2e')],_0x402a68['query']);_0x19e370[_0xb5fa('0x33')]=_[_0xb5fa('0x32')](_0x402a68['model'],qs[_0xb5fa('0x42')](_0x337c53['query'][_0xb5fa('0x42')]));_0x19e370[_0xb5fa('0x33')]=_0x19e370['attributes']['length']?_0x19e370[_0xb5fa('0x33')]:_0x402a68[_0xb5fa('0x2e')];if(_0x337c53[_0xb5fa('0x2f')][_0xb5fa('0x43')]){_0x19e370[_0xb5fa('0x3e')]=[{'all':!![]}];}_0x19e370=_[_0xb5fa('0x3b')]({},_0x19e370,_0x337c53[_0xb5fa('0x3c')]);return db[_0xb5fa('0x29')]['find'](_0x19e370)[_0xb5fa('0x22')](handleEntityNotFound(_0x83df0b,null))[_0xb5fa('0x22')](respondWithResult(_0x83df0b,null))['catch'](handleError(_0x83df0b,null));};exports[_0xb5fa('0x44')]=function(_0x2c378a,_0x247999){return db[_0xb5fa('0x29')][_0xb5fa('0x44')](_0x2c378a[_0xb5fa('0x45')],{})[_0xb5fa('0x22')](respondWithResult(_0x247999,0xc9))[_0xb5fa('0x40')](handleError(_0x247999,null));};exports[_0xb5fa('0x46')]=function(_0x464e36,_0xfe091){if(_0x464e36[_0xb5fa('0x45')]['id']){delete _0x464e36[_0xb5fa('0x45')]['id'];}return db[_0xb5fa('0x29')][_0xb5fa('0x47')]({'where':{'id':_0x464e36[_0xb5fa('0x48')]['id']}})['then'](handleEntityNotFound(_0xfe091,null))['then'](saveUpdates(_0x464e36[_0xb5fa('0x45')],null))['then'](respondWithResult(_0xfe091,null))[_0xb5fa('0x40')](handleError(_0xfe091,null));};exports[_0xb5fa('0x23')]=function(_0x5404f6,_0x4ef1d0){return db[_0xb5fa('0x29')][_0xb5fa('0x47')]({'where':{'id':_0x5404f6[_0xb5fa('0x48')]['id']}})[_0xb5fa('0x22')](handleEntityNotFound(_0x4ef1d0,null))[_0xb5fa('0x22')](removeEntity(_0x4ef1d0,null))['catch'](handleError(_0x4ef1d0,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 3d51437..176b7f0 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 _0x5e62=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash'];(function(_0x21faec,_0x154ef7){var _0x4b42fa=function(_0x458e3d){while(--_0x458e3d){_0x21faec['push'](_0x21faec['shift']());}};_0x4b42fa(++_0x154ef7);}(_0x5e62,0x149));var _0x25e6=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x5e62[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x25e6('0x0'));var util=require(_0x25e6('0x1'));var logger=require(_0x25e6('0x2'))(_0x25e6('0x3'));var moment=require(_0x25e6('0x4'));var BPromise=require(_0x25e6('0x5'));var rp=require(_0x25e6('0x6'));var fs=require('fs');var path=require(_0x25e6('0x7'));var rimraf=require('rimraf');var config=require(_0x25e6('0x8'));var attributes=require(_0x25e6('0x9'));module[_0x25e6('0xa')]=function(_0x180a60,_0xf92878){return _0x180a60[_0x25e6('0xb')]('SugarcrmField',attributes,{'tableName':_0x25e6('0xc'),'paranoid':![],'indexes':[{'name':_0x25e6('0xd'),'fields':[_0x25e6('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd2f7=['idField','FieldId','lodash','util','api','moment','request-promise','rimraf','./intSugarcrmField.attributes','SugarcrmField','int_sugarcrm_fields'];(function(_0x135168,_0x55379f){var _0x4950ce=function(_0x73ec0c){while(--_0x73ec0c){_0x135168['push'](_0x135168['shift']());}};_0x4950ce(++_0x55379f);}(_0xd2f7,0x1db));var _0x7d2f=function(_0x532b8b,_0x4d0cb0){_0x532b8b=_0x532b8b-0x0;var _0x3e2607=_0xd2f7[_0x532b8b];return _0x3e2607;};'use strict';var _=require(_0x7d2f('0x0'));var util=require(_0x7d2f('0x1'));var logger=require('../../config/logger')(_0x7d2f('0x2'));var moment=require(_0x7d2f('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d2f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d2f('0x5'));var config=require('../../config/environment');var attributes=require(_0x7d2f('0x6'));module['exports']=function(_0xdfbb7d,_0x55e3e6){return _0xdfbb7d['define'](_0x7d2f('0x7'),attributes,{'tableName':_0x7d2f('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x7d2f('0x9'),_0x7d2f('0xa')],'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 4942844..57eef57 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 _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8603,0x190));var _0x3860=function(_0x56a40d,_0x931121){_0x56a40d=_0x56a40d-0x0;var _0xc9b722=_0x8603[_0x56a40d];return _0xc9b722;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2a1721,_0x174359){var _0x46fc9=function(_0x4b59f2){while(--_0x4b59f2){_0x2a1721['push'](_0x2a1721['shift']());}};_0x46fc9(++_0x174359);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f9650,_0x516cb3){_0x2f9650=_0x2f9650-0x0;var _0x13e6f8=_0x5f2f[_0x2f9650];return _0x13e6f8;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index e9c33ca..cb04f74 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 _0x586f=['post','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getFields'];(function(_0x407393,_0x1687d1){var _0x546e7b=function(_0x12a2e6){while(--_0x12a2e6){_0x407393['push'](_0x407393['shift']());}};_0x546e7b(++_0x1687d1);}(_0x586f,0x7e));var _0xf586=function(_0x7cdaf1,_0x40e620){_0x7cdaf1=_0x7cdaf1-0x0;var _0xf58e9a=_0x586f[_0x7cdaf1];return _0xf58e9a;};'use strict';var multer=require('multer');var util=require(_0xf586('0x0'));var path=require('path');var timeout=require(_0xf586('0x1'));var express=require('express');var router=express[_0xf586('0x2')]();var auth=require(_0xf586('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf586('0x4'));var controller=require('./intVtigerAccount.controller');router[_0xf586('0x5')]('/',auth[_0xf586('0x6')](),controller[_0xf586('0x7')]);router[_0xf586('0x5')]('/:id',auth[_0xf586('0x6')](),controller['show']);router[_0xf586('0x5')](_0xf586('0x8'),auth[_0xf586('0x6')](),controller['getConfigurations']);router[_0xf586('0x5')]('/:id/fields',auth[_0xf586('0x6')](),controller[_0xf586('0x9')]);router[_0xf586('0xa')]('/',auth[_0xf586('0x6')](),controller['create']);router['post'](_0xf586('0x8'),auth[_0xf586('0x6')](),controller[_0xf586('0xb')]);router[_0xf586('0xc')]('/:id',auth[_0xf586('0x6')](),controller[_0xf586('0xd')]);router[_0xf586('0xe')]('/:id',auth[_0xf586('0x6')](),controller[_0xf586('0xf')]);module[_0xf586('0x10')]=router; \ No newline at end of file +var _0x783c=['update','delete','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','/:id/fields','post','addConfiguration','put'];(function(_0x2c03e1,_0x2d9021){var _0xf9df57=function(_0x1d40da){while(--_0x1d40da){_0x2c03e1['push'](_0x2c03e1['shift']());}};_0xf9df57(++_0x2d9021);}(_0x783c,0x192));var _0xc783=function(_0x73c965,_0x4d0dd0){_0x73c965=_0x73c965-0x0;var _0x4348e9=_0x783c[_0x73c965];return _0x4348e9;};'use strict';var multer=require(_0xc783('0x0'));var util=require('util');var path=require(_0xc783('0x1'));var timeout=require('connect-timeout');var express=require(_0xc783('0x2'));var router=express[_0xc783('0x3')]();var auth=require(_0xc783('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc783('0x5'));var controller=require(_0xc783('0x6'));router['get']('/',auth[_0xc783('0x7')](),controller['index']);router[_0xc783('0x8')](_0xc783('0x9'),auth[_0xc783('0x7')](),controller[_0xc783('0xa')]);router[_0xc783('0x8')](_0xc783('0xb'),auth[_0xc783('0x7')](),controller['getConfigurations']);router[_0xc783('0x8')](_0xc783('0xc'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xc783('0x7')](),controller['create']);router[_0xc783('0xd')](_0xc783('0xb'),auth[_0xc783('0x7')](),controller[_0xc783('0xe')]);router[_0xc783('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc783('0x10')]);router[_0xc783('0x11')](_0xc783('0x9'),auth[_0xc783('0x7')](),controller['destroy']);module[_0xc783('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index cc39854..87722c8 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 _0x843b=['HelpDesk','sequelize','exports','STRING'];(function(_0x44d88c,_0x4e0cb4){var _0x508da7=function(_0x464d98){while(--_0x464d98){_0x44d88c['push'](_0x44d88c['shift']());}};_0x508da7(++_0x4e0cb4);}(_0x843b,0x91));var _0xb843=function(_0x33b338,_0x416501){_0x33b338=_0x33b338-0x0;var _0x5654b7=_0x843b[_0x33b338];return _0x5654b7;};'use strict';var Sequelize=require(_0xb843('0x0'));module[_0xb843('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb843('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb843('0x2')],'allowNull':![],'defaultValue':_0xb843('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb843('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb843('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1b65=['sequelize','exports','STRING','HelpDesk'];(function(_0x3038be,_0x425d69){var _0x581d4e=function(_0x1f0731){while(--_0x1f0731){_0x3038be['push'](_0x3038be['shift']());}};_0x581d4e(++_0x425d69);}(_0x1b65,0x1b4));var _0x51b6=function(_0x8a0c86,_0xfe68c1){_0x8a0c86=_0x8a0c86-0x0;var _0x4e2c86=_0x1b65[_0x8a0c86];return _0x4e2c86;};'use strict';var Sequelize=require(_0x51b6('0x0'));module[_0x51b6('0x1')]={'name':{'type':Sequelize[_0x51b6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x51b6('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x51b6('0x2')],'allowNull':![],'defaultValue':_0x51b6('0x3')},'remoteUri':{'type':Sequelize[_0x51b6('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x51b6('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x51b6('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index ae57ef0..edc5484 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 _0xeeda=['VtigerAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','length','attributes','order','sort','filter','merge','where','includeAll','findAll','rows','show','params','include','options','find','create','update','body','getConfigurations','findOne','VtigerConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','%s/webservice.php','GET','getchallenge','success','login','describe','sessionName','autogenerated','remove','includes','startsWith','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','api','../../config/utils','../../config/license/util','../../mysqldb','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','destroy','stack','name','map'];(function(_0xd621b3,_0x2edb78){var _0x4ecabc=function(_0x12e343){while(--_0x12e343){_0xd621b3['push'](_0xd621b3['shift']());}};_0x4ecabc(++_0x2edb78);}(_0xeeda,0x1be));var _0xaeed=function(_0xafe8a1,_0x5cfad4){_0xafe8a1=_0xafe8a1-0x0;var _0x31a06=_0xeeda[_0xafe8a1];return _0x31a06;};'use strict';var pdf=require(_0xaeed('0x0'));var emlformat=require(_0xaeed('0x1'));var rimraf=require(_0xaeed('0x2'));var zipdir=require(_0xaeed('0x3'));var jsonpatch=require(_0xaeed('0x4'));var rp=require(_0xaeed('0x5'));var moment=require(_0xaeed('0x6'));var BPromise=require(_0xaeed('0x7'));var Mustache=require(_0xaeed('0x8'));var util=require(_0xaeed('0x9'));var path=require(_0xaeed('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaeed('0xb'));var fs=require('fs');var _=require(_0xaeed('0xc'));var squel=require(_0xaeed('0xd'));var crypto=require(_0xaeed('0xe'));var jsforce=require(_0xaeed('0xf'));var deskjs=require(_0xaeed('0x10'));var toCsv=require(_0xaeed('0x11'));var querystring=require(_0xaeed('0x12'));var Papa=require(_0xaeed('0x13'));var Redis=require(_0xaeed('0x14'));var authService=require(_0xaeed('0x15'));var qs=require(_0xaeed('0x16'));var as=require(_0xaeed('0x17'));var hardwareService=require(_0xaeed('0x18'));var logger=require(_0xaeed('0x19'))(_0xaeed('0x1a'));var utils=require(_0xaeed('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xaeed('0x1c'));var db=require(_0xaeed('0x1d'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0xaeed('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x255dbb,_0x36aeb3,_0x4d3712,_0x4130e5){return new BPromise(function(_0xcb1ecb,_0x4ad2e9){var _0x61908f=_0x4130e5||client;return _0x61908f[_0xaeed('0x1f')](_0x255dbb,_0x4d3712)[_0xaeed('0x20')](function(_0x4e649b){logger[_0xaeed('0x21')]('VtigerAccount,\x20%s,\x20%s',_0x36aeb3,_0xaeed('0x22'));logger[_0xaeed('0x23')](_0xaeed('0x24'),_0x36aeb3,'request\x20sent',JSON[_0xaeed('0x25')](_0x4e649b));if(_0x4e649b[_0xaeed('0x26')]){if(_0x4e649b['error'][_0xaeed('0x27')]===0x1f4){logger[_0xaeed('0x26')](_0xaeed('0x28'),_0x36aeb3,_0x4e649b['error'][_0xaeed('0x29')]);return _0x4ad2e9(_0x4e649b['error']['message']);}logger['error'](_0xaeed('0x28'),_0x36aeb3,_0x4e649b[_0xaeed('0x26')]['message']);return _0xcb1ecb(_0x4e649b[_0xaeed('0x26')]['message']);}else{logger[_0xaeed('0x21')](_0xaeed('0x28'),_0x36aeb3,_0xaeed('0x22'));_0xcb1ecb(_0x4e649b[_0xaeed('0x2a')][_0xaeed('0x29')]);}})[_0xaeed('0x2b')](function(_0x31461d){logger[_0xaeed('0x26')]('VtigerAccount,\x20%s,\x20%s',_0x36aeb3,_0x31461d);_0x4ad2e9(_0x31461d);});});}function respondWithStatusCode(_0x368ce5,_0x3fb569){_0x3fb569=_0x3fb569||0xcc;return function(_0xd439cd){if(_0xd439cd){return _0x368ce5[_0xaeed('0x2c')](_0x3fb569);}return _0x368ce5[_0xaeed('0x2d')](_0x3fb569)[_0xaeed('0x2e')]();};}function respondWithResult(_0x13bf50,_0x10ce48){_0x10ce48=_0x10ce48||0xc8;return function(_0x25eba4){if(_0x25eba4){return _0x13bf50['status'](_0x10ce48)[_0xaeed('0x2f')](_0x25eba4);}};}function respondWithFilteredResult(_0x5767af,_0x3f54a1){return function(_0x375bcb){if(_0x375bcb){var _0x596af9=_0x375bcb[_0xaeed('0x30')],_0x3c8d46=_0x3f54a1[_0xaeed('0x31')],_0x3c377a=_0x3f54a1[_0xaeed('0x31')]+_0x3f54a1[_0xaeed('0x32')],_0x44ed62;if(_0x3c377a>=_0x596af9){_0x3c377a=_0x596af9;_0x44ed62=0xc8;}else{_0x44ed62=0xce;}_0x5767af[_0xaeed('0x2d')](_0x44ed62);return _0x5767af['set'](_0xaeed('0x33'),_0x3c8d46+'-'+_0x3c377a+'/'+_0x596af9)[_0xaeed('0x2f')](_0x375bcb);}return null;};}function patchUpdates(_0x39ca22){return function(_0x251892){try{jsonpatch[_0xaeed('0x34')](_0x251892,_0x39ca22,!![]);}catch(_0x4b41c1){return BPromise[_0xaeed('0x35')](_0x4b41c1);}return _0x251892['save']();};}function saveUpdates(_0x1ec23b,_0x13d7ec){return function(_0x8a07d8){if(_0x8a07d8){return _0x8a07d8['update'](_0x1ec23b)['then'](function(_0x505751){return _0x505751;});}return null;};}function removeEntity(_0x524e13,_0x3fe747){return function(_0x61a41d){if(_0x61a41d){return _0x61a41d[_0xaeed('0x36')]()[_0xaeed('0x20')](function(){_0x524e13[_0xaeed('0x2d')](0xcc)[_0xaeed('0x2e')]();});}};}function handleEntityNotFound(_0x12aa79,_0x474fa1){return function(_0x5c1324){if(!_0x5c1324){_0x12aa79[_0xaeed('0x2c')](0x194);}return _0x5c1324;};}function handleError(_0x3039c0,_0x32815e){_0x32815e=_0x32815e||0x1f4;return function(_0x2d95a2){logger[_0xaeed('0x26')](_0x2d95a2[_0xaeed('0x37')]);if(_0x2d95a2[_0xaeed('0x38')]){delete _0x2d95a2['name'];}_0x3039c0[_0xaeed('0x2d')](_0x32815e)['send'](_0x2d95a2);};}exports['index']=function(_0x111931,_0x1fc5de){var _0x2b13ab={},_0x5b99b2={},_0x5be6c={'count':0x0,'rows':[]};var _0x9ace06=_[_0xaeed('0x39')](db[_0xaeed('0x3a')][_0xaeed('0x3b')],function(_0x48ee3c){return{'name':_0x48ee3c[_0xaeed('0x3c')],'type':_0x48ee3c[_0xaeed('0x3d')][_0xaeed('0x3e')]};});_0x5b99b2[_0xaeed('0x3f')]=_[_0xaeed('0x39')](_0x9ace06,_0xaeed('0x38'));_0x5b99b2['query']=_[_0xaeed('0x40')](_0x111931['query']);_0x5b99b2[_0xaeed('0x41')]=_['intersection'](_0x5b99b2[_0xaeed('0x3f')],_0x5b99b2['query']);_0x2b13ab['attributes']=_[_0xaeed('0x42')](_0x5b99b2[_0xaeed('0x3f')],qs['fields'](_0x111931[_0xaeed('0x43')][_0xaeed('0x44')]));_0x2b13ab['attributes']=_0x2b13ab['attributes'][_0xaeed('0x45')]?_0x2b13ab[_0xaeed('0x46')]:_0x5b99b2[_0xaeed('0x3f')];if(!_0x111931[_0xaeed('0x43')]['hasOwnProperty']('nolimit')){_0x2b13ab[_0xaeed('0x32')]=qs[_0xaeed('0x32')](_0x111931[_0xaeed('0x43')][_0xaeed('0x32')]);_0x2b13ab[_0xaeed('0x31')]=qs[_0xaeed('0x31')](_0x111931['query'][_0xaeed('0x31')]);}_0x2b13ab[_0xaeed('0x47')]=qs[_0xaeed('0x48')](_0x111931[_0xaeed('0x43')][_0xaeed('0x48')]);_0x2b13ab['where']=qs[_0xaeed('0x41')](_['pick'](_0x111931[_0xaeed('0x43')],_0x5b99b2['filters']),_0x9ace06);if(_0x111931[_0xaeed('0x43')][_0xaeed('0x49')]){_0x2b13ab['where']=_[_0xaeed('0x4a')](_0x2b13ab[_0xaeed('0x4b')],{'$or':_['map'](_0x9ace06,function(_0x516ead){if(_0x516ead[_0xaeed('0x3d')]!=='VIRTUAL'){var _0x2b632e={};_0x2b632e[_0x516ead[_0xaeed('0x38')]]={'$like':'%'+_0x111931[_0xaeed('0x43')][_0xaeed('0x49')]+'%'};return _0x2b632e;}})});}_0x2b13ab=_[_0xaeed('0x4a')]({},_0x2b13ab,_0x111931['options']);var _0x154794={'where':_0x2b13ab[_0xaeed('0x4b')]};return db['VtigerAccount']['count'](_0x154794)['then'](function(_0x44569c){_0x5be6c[_0xaeed('0x30')]=_0x44569c;if(_0x111931[_0xaeed('0x43')][_0xaeed('0x4c')]){_0x2b13ab['include']=[{'all':!![]}];}return db['VtigerAccount'][_0xaeed('0x4d')](_0x2b13ab);})[_0xaeed('0x20')](function(_0x8bec66){_0x5be6c[_0xaeed('0x4e')]=_0x8bec66;return _0x5be6c;})[_0xaeed('0x20')](respondWithFilteredResult(_0x1fc5de,_0x2b13ab))[_0xaeed('0x2b')](handleError(_0x1fc5de,null));};exports[_0xaeed('0x4f')]=function(_0x2da6d3,_0x2a9d6e){var _0xad7040={'raw':![],'where':{'id':_0x2da6d3[_0xaeed('0x50')]['id']}},_0x406fd1={};_0x406fd1[_0xaeed('0x3f')]=_[_0xaeed('0x40')](db[_0xaeed('0x3a')][_0xaeed('0x3b')]);_0x406fd1[_0xaeed('0x43')]=_[_0xaeed('0x40')](_0x2da6d3[_0xaeed('0x43')]);_0x406fd1[_0xaeed('0x41')]=_[_0xaeed('0x42')](_0x406fd1['model'],_0x406fd1[_0xaeed('0x43')]);_0xad7040[_0xaeed('0x46')]=_[_0xaeed('0x42')](_0x406fd1['model'],qs[_0xaeed('0x44')](_0x2da6d3['query']['fields']));_0xad7040['attributes']=_0xad7040['attributes'][_0xaeed('0x45')]?_0xad7040[_0xaeed('0x46')]:_0x406fd1[_0xaeed('0x3f')];if(_0x2da6d3[_0xaeed('0x43')][_0xaeed('0x4c')]){_0xad7040[_0xaeed('0x51')]=[{'all':!![]}];}_0xad7040=_[_0xaeed('0x4a')]({},_0xad7040,_0x2da6d3[_0xaeed('0x52')]);return db[_0xaeed('0x3a')][_0xaeed('0x53')](_0xad7040)[_0xaeed('0x20')](handleEntityNotFound(_0x2a9d6e,null))[_0xaeed('0x20')](respondWithResult(_0x2a9d6e,null))[_0xaeed('0x2b')](handleError(_0x2a9d6e,null));};exports[_0xaeed('0x54')]=function(_0xee3831,_0x2d2f7e){return db[_0xaeed('0x3a')]['create'](_0xee3831['body'],{})[_0xaeed('0x20')](respondWithResult(_0x2d2f7e,0xc9))[_0xaeed('0x2b')](handleError(_0x2d2f7e,null));};exports[_0xaeed('0x55')]=function(_0xe9a5fd,_0x464a37){if(_0xe9a5fd[_0xaeed('0x56')]['id']){delete _0xe9a5fd[_0xaeed('0x56')]['id'];}return db['VtigerAccount'][_0xaeed('0x53')]({'where':{'id':_0xe9a5fd['params']['id']}})[_0xaeed('0x20')](handleEntityNotFound(_0x464a37,null))[_0xaeed('0x20')](saveUpdates(_0xe9a5fd['body'],null))['then'](respondWithResult(_0x464a37,null))['catch'](handleError(_0x464a37,null));};exports['destroy']=function(_0x5f0d24,_0x89fc8){return db['VtigerAccount'][_0xaeed('0x53')]({'where':{'id':_0x5f0d24['params']['id']}})[_0xaeed('0x20')](handleEntityNotFound(_0x89fc8,null))['then'](removeEntity(_0x89fc8,null))['catch'](handleError(_0x89fc8,null));};exports[_0xaeed('0x57')]=function(_0x4a2f86,_0x3db6e8,_0x76b29){var _0x42bb33={};var _0x4d49a5={};var _0x10c2cd;var _0x24512c;return db[_0xaeed('0x3a')][_0xaeed('0x58')]({'where':{'id':_0x4a2f86[_0xaeed('0x50')]['id']}})[_0xaeed('0x20')](handleEntityNotFound(_0x3db6e8,null))[_0xaeed('0x20')](function(_0x53c8dd){if(_0x53c8dd){_0x10c2cd=_0x53c8dd;_0x4d49a5[_0xaeed('0x3f')]=_[_0xaeed('0x40')](db[_0xaeed('0x59')]['rawAttributes']);_0x4d49a5[_0xaeed('0x43')]=_[_0xaeed('0x40')](_0x4a2f86['query']);_0x4d49a5[_0xaeed('0x41')]=_[_0xaeed('0x42')](_0x4d49a5['model'],_0x4d49a5[_0xaeed('0x43')]);_0x42bb33[_0xaeed('0x46')]=_[_0xaeed('0x42')](_0x4d49a5[_0xaeed('0x3f')],qs[_0xaeed('0x44')](_0x4a2f86[_0xaeed('0x43')][_0xaeed('0x44')]));_0x42bb33[_0xaeed('0x46')]=_0x42bb33[_0xaeed('0x46')]['length']?_0x42bb33[_0xaeed('0x46')]:_0x4d49a5['model'];_0x42bb33[_0xaeed('0x47')]=qs[_0xaeed('0x48')](_0x4a2f86['query'][_0xaeed('0x48')]);_0x42bb33['where']=qs[_0xaeed('0x41')](_['pick'](_0x4a2f86['query'],_0x4d49a5[_0xaeed('0x41')]));if(_0x4a2f86[_0xaeed('0x43')][_0xaeed('0x49')]){_0x42bb33[_0xaeed('0x4b')]=_[_0xaeed('0x4a')](_0x42bb33[_0xaeed('0x4b')],{'$or':_[_0xaeed('0x39')](_0x42bb33[_0xaeed('0x46')],function(_0x39272e){var _0x2218b6={};_0x2218b6[_0x39272e]={'$like':'%'+_0x4a2f86[_0xaeed('0x43')][_0xaeed('0x49')]+'%'};return _0x2218b6;})});}_0x42bb33=_[_0xaeed('0x4a')]({},_0x42bb33,_0x4a2f86[_0xaeed('0x52')]);return _0x10c2cd[_0xaeed('0x57')](_0x42bb33);}})[_0xaeed('0x20')](function(_0x1cab9b){if(_0x1cab9b){_0x24512c=_0x1cab9b[_0xaeed('0x45')];if(!_0x4a2f86['query']['hasOwnProperty'](_0xaeed('0x5a'))){_0x42bb33[_0xaeed('0x32')]=qs[_0xaeed('0x32')](_0x4a2f86[_0xaeed('0x43')][_0xaeed('0x32')]);_0x42bb33['offset']=qs[_0xaeed('0x31')](_0x4a2f86[_0xaeed('0x43')]['offset']);}return _0x10c2cd[_0xaeed('0x57')](_0x42bb33);}})[_0xaeed('0x20')](function(_0x499c34){if(_0x499c34){return _0x499c34?{'count':_0x24512c,'rows':_0x499c34}:null;}})['then'](respondWithResult(_0x3db6e8,null))[_0xaeed('0x2b')](handleError(_0x3db6e8,null));};exports[_0xaeed('0x5b')]=function(_0x1c78cd,_0x2e634b,_0x1f4151){if(_0x1c78cd[_0xaeed('0x56')]['id']){delete _0x1c78cd[_0xaeed('0x56')]['id'];}return db[_0xaeed('0x3a')][_0xaeed('0x58')]({'where':{'id':_0x1c78cd[_0xaeed('0x50')]['id']}})['then'](handleEntityNotFound(_0x2e634b,null))[_0xaeed('0x20')](function(_0x11a7c9){if(_0x11a7c9){_0x1c78cd[_0xaeed('0x56')][_0xaeed('0x5c')]=_0x11a7c9['id'];_0x1c78cd[_0xaeed('0x56')][_0xaeed('0x5d')]=integrations[_0xaeed('0x5e')](_0x1c78cd['body'][_0xaeed('0x5f')],_0x1c78cd[_0xaeed('0x56')]['type']);_0x1c78cd[_0xaeed('0x56')][_0xaeed('0x60')]=integrations['getDescriptions'](_0x1c78cd[_0xaeed('0x56')][_0xaeed('0x5f')],_0x1c78cd[_0xaeed('0x56')][_0xaeed('0x3d')]);return db[_0xaeed('0x59')]['create'](_0x1c78cd[_0xaeed('0x56')],{'include':[{'model':db[_0xaeed('0x61')],'as':'Subjects'},{'model':db[_0xaeed('0x61')],'as':_0xaeed('0x60')}]});}return null;})['then'](respondWithResult(_0x2e634b,null))['catch'](handleError(_0x2e634b,null));};var md5=require(_0xaeed('0x62'));exports[_0xaeed('0x63')]=function(_0x5cf3df,_0x77f5c1,_0x2d8614){var _0x923297=null;var _0x2ed0ec=null;var _0x16b300=null;var _0x4147aa=null;var _0xade4f7='';return db[_0xaeed('0x3a')][_0xaeed('0x58')]({'where':{'id':_0x5cf3df[_0xaeed('0x50')]['id']},'attributes':['id',_0xaeed('0x38'),_0xaeed('0x64'),_0xaeed('0x65'),_0xaeed('0x66'),_0xaeed('0x67'),_0xaeed('0x68'),'accessKey']})[_0xaeed('0x20')](handleEntityNotFound(_0x77f5c1,null))['then'](function(_0x2f6f1c){if(_0x2f6f1c){_0x923297=_0x2f6f1c[_0xaeed('0x64')];_0x2ed0ec=_0x2f6f1c[_0xaeed('0x69')];_0x16b300=_0x2f6f1c[_0xaeed('0x66')];_0xade4f7=_0x2f6f1c['remoteUri'];var _0xd75bc=_0xade4f7[_0xaeed('0x6a')](-0x1);if(_0xd75bc==='/'){_0xade4f7=_0xade4f7[_0xaeed('0x6b')](0x0,_0xade4f7['lastIndexOf'](_0xd75bc));}_0x4147aa=util['format'](_0xaeed('0x6c'),_0xade4f7);var _0x1f6f77={'method':_0xaeed('0x6d'),'uri':_0x4147aa,'qs':{'operation':_0xaeed('0x6e'),'username':_0x2f6f1c[_0xaeed('0x64')]},'json':!![]};return rp(_0x1f6f77);}})['then'](function(_0xc219de){if(_0xc219de[_0xaeed('0x6f')]){var _0x4c31ef={'method':'POST','uri':_0x4147aa,'form':{'operation':_0xaeed('0x70'),'username':_0x923297,'accessKey':md5(_0xc219de['result']['token']+_0x2ed0ec)},'json':!![]};return rp(_0x4c31ef);}})[_0xaeed('0x20')](function(_0x12c6c1){if(_0x12c6c1[_0xaeed('0x6f')]){var _0x1ba4d5={'method':'GET','uri':_0x4147aa,'qs':{'operation':_0xaeed('0x71'),'username':_0x923297,'sessionName':_0x12c6c1[_0xaeed('0x2a')][_0xaeed('0x72')],'elementType':_0x16b300},'json':!![]};return rp(_0x1ba4d5);}})[_0xaeed('0x20')](function(_0x5e96b2){if(_0x5e96b2[_0xaeed('0x6f')]){var _0x64a942=[_0xaeed('0x73'),'reference','owner'];_[_0xaeed('0x74')](_0x5e96b2[_0xaeed('0x2a')]['fields'],function(_0x3db8d2){return _0x64a942[_0xaeed('0x75')](_0x3db8d2[_0xaeed('0x3d')][_0xaeed('0x38')]);});_[_0xaeed('0x74')](_0x5e96b2[_0xaeed('0x2a')][_0xaeed('0x44')],function(_0x2a10bf){return _0x2a10bf['editable']==='false';});return{'count':_0x5e96b2[_0xaeed('0x2a')][_0xaeed('0x44')][_0xaeed('0x45')],'rows':_[_0xaeed('0x39')](_0x5e96b2[_0xaeed('0x2a')][_0xaeed('0x44')],function(_0xb8a745){return{'id':_0xb8a745[_0xaeed('0x38')],'name':_0xb8a745['label'],'custom':_[_0xaeed('0x76')](_0xb8a745[_0xaeed('0x38')],'cf_')?!![]:![],'options':_0xb8a745[_0xaeed('0x3d')]['name']==='picklist'&&_0xb8a745[_0xaeed('0x3d')][_0xaeed('0x77')][_0xaeed('0x45')]>0x0?_[_0xaeed('0x39')](_0xb8a745['type']['picklistValues'],function(_0xd0d436){return{'name':_0xd0d436['label'],'value':_0xd0d436[_0xaeed('0x78')]};}):[]};})};}})[_0xaeed('0x20')](respondWithResult(_0x77f5c1,null))[_0xaeed('0x2b')](function(_0x341d5f){console[_0xaeed('0x79')](_0xaeed('0x7a')+_0x341d5f);var _0x51c37b=_0x5cf3df['query'][_0xaeed('0x7b')]?0x1f4:_0x341d5f[_0xaeed('0x7c')]||0x1f4;logger[_0xaeed('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x51c37b,JSON[_0xaeed('0x25')](_0x341d5f));delete _0x341d5f[_0xaeed('0x38')];if(_0x51c37b===0x191){_0x51c37b=0x190;}_0x77f5c1['status'](_0x51c37b)[_0xaeed('0x7d')](_0x5cf3df[_0xaeed('0x43')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x341d5f[_0xaeed('0x7c')]}:_0x341d5f);});}; \ No newline at end of file +var _0xadfd=['info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','VtigerAccount','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','getConfigurations','findOne','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','getFields','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','token','GET','describe','sessionName','autogenerated','reference','owner','remove','editable','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http'];(function(_0x3c6042,_0x58edda){var _0x40c1b3=function(_0x2e73cf){while(--_0x2e73cf){_0x3c6042['push'](_0x3c6042['shift']());}};_0x40c1b3(++_0x58edda);}(_0xadfd,0xf0));var _0xdadf=function(_0x727da6,_0x57ee62){_0x727da6=_0x727da6-0x0;var _0x1c0470=_0xadfd[_0x727da6];return _0x1c0470;};'use strict';var pdf=require(_0xdadf('0x0'));var emlformat=require(_0xdadf('0x1'));var rimraf=require(_0xdadf('0x2'));var zipdir=require(_0xdadf('0x3'));var jsonpatch=require(_0xdadf('0x4'));var rp=require(_0xdadf('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdadf('0x6'));var util=require(_0xdadf('0x7'));var path=require(_0xdadf('0x8'));var sox=require(_0xdadf('0x9'));var csv=require(_0xdadf('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdadf('0xb'));var squel=require(_0xdadf('0xc'));var crypto=require('crypto');var jsforce=require(_0xdadf('0xd'));var deskjs=require(_0xdadf('0xe'));var toCsv=require(_0xdadf('0xa'));var querystring=require(_0xdadf('0xf'));var Papa=require(_0xdadf('0x10'));var Redis=require(_0xdadf('0x11'));var authService=require(_0xdadf('0x12'));var qs=require(_0xdadf('0x13'));var as=require(_0xdadf('0x14'));var hardwareService=require(_0xdadf('0x15'));var logger=require(_0xdadf('0x16'))(_0xdadf('0x17'));var utils=require(_0xdadf('0x18'));var config=require(_0xdadf('0x19'));var licenseUtil=require(_0xdadf('0x1a'));var db=require(_0xdadf('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xdadf('0x1c'));var client=jayson['client'][_0xdadf('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x46f521,_0x20b4c1,_0x174260,_0x27b973){return new BPromise(function(_0x15a858,_0x940b15){var _0x4d7360=_0x27b973||client;return _0x4d7360['request'](_0x46f521,_0x174260)['then'](function(_0x240cfd){logger[_0xdadf('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x20b4c1,_0xdadf('0x1f'));logger[_0xdadf('0x20')](_0xdadf('0x21'),_0x20b4c1,_0xdadf('0x1f'),JSON[_0xdadf('0x22')](_0x240cfd));if(_0x240cfd[_0xdadf('0x23')]){if(_0x240cfd['error'][_0xdadf('0x24')]===0x1f4){logger['error'](_0xdadf('0x25'),_0x20b4c1,_0x240cfd[_0xdadf('0x23')][_0xdadf('0x26')]);return _0x940b15(_0x240cfd[_0xdadf('0x23')]['message']);}logger[_0xdadf('0x23')](_0xdadf('0x25'),_0x20b4c1,_0x240cfd[_0xdadf('0x23')][_0xdadf('0x26')]);return _0x15a858(_0x240cfd['error'][_0xdadf('0x26')]);}else{logger[_0xdadf('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x20b4c1,'request\x20sent');_0x15a858(_0x240cfd[_0xdadf('0x27')][_0xdadf('0x26')]);}})['catch'](function(_0x5ca8b3){logger[_0xdadf('0x23')](_0xdadf('0x25'),_0x20b4c1,_0x5ca8b3);_0x940b15(_0x5ca8b3);});});}function respondWithStatusCode(_0x443890,_0x5b5c52){_0x5b5c52=_0x5b5c52||0xcc;return function(_0x166962){if(_0x166962){return _0x443890['sendStatus'](_0x5b5c52);}return _0x443890[_0xdadf('0x28')](_0x5b5c52)[_0xdadf('0x29')]();};}function respondWithResult(_0x43ecdf,_0xd2c9f0){_0xd2c9f0=_0xd2c9f0||0xc8;return function(_0x3256ff){if(_0x3256ff){return _0x43ecdf[_0xdadf('0x28')](_0xd2c9f0)[_0xdadf('0x2a')](_0x3256ff);}};}function respondWithFilteredResult(_0x3b9b6f,_0xcfb3c1){return function(_0x190c33){if(_0x190c33){var _0x286ac4=_0x190c33[_0xdadf('0x2b')],_0x332170=_0xcfb3c1[_0xdadf('0x2c')],_0x1c17bf=_0xcfb3c1['offset']+_0xcfb3c1[_0xdadf('0x2d')],_0x3a1a58;if(_0x1c17bf>=_0x286ac4){_0x1c17bf=_0x286ac4;_0x3a1a58=0xc8;}else{_0x3a1a58=0xce;}_0x3b9b6f['status'](_0x3a1a58);return _0x3b9b6f[_0xdadf('0x2e')](_0xdadf('0x2f'),_0x332170+'-'+_0x1c17bf+'/'+_0x286ac4)[_0xdadf('0x2a')](_0x190c33);}return null;};}function patchUpdates(_0x5e89af){return function(_0x47cab4){try{jsonpatch[_0xdadf('0x30')](_0x47cab4,_0x5e89af,!![]);}catch(_0xb8e694){return BPromise[_0xdadf('0x31')](_0xb8e694);}return _0x47cab4[_0xdadf('0x32')]();};}function saveUpdates(_0x260db7,_0x114553){return function(_0x365eb0){if(_0x365eb0){return _0x365eb0[_0xdadf('0x33')](_0x260db7)[_0xdadf('0x34')](function(_0x161e0f){return _0x161e0f;});}return null;};}function removeEntity(_0x588780,_0x138a02){return function(_0x49988d){if(_0x49988d){return _0x49988d[_0xdadf('0x35')]()['then'](function(){_0x588780[_0xdadf('0x28')](0xcc)[_0xdadf('0x29')]();});}};}function handleEntityNotFound(_0x46c2c1,_0x161256){return function(_0x2b07c6){if(!_0x2b07c6){_0x46c2c1[_0xdadf('0x36')](0x194);}return _0x2b07c6;};}function handleError(_0x4a578f,_0x4092c7){_0x4092c7=_0x4092c7||0x1f4;return function(_0x5b63be){logger['error'](_0x5b63be[_0xdadf('0x37')]);if(_0x5b63be[_0xdadf('0x38')]){delete _0x5b63be[_0xdadf('0x38')];}_0x4a578f[_0xdadf('0x28')](_0x4092c7)[_0xdadf('0x39')](_0x5b63be);};}exports['index']=function(_0x5dfde4,_0x4706af){var _0x594d3b={},_0x4e9e01={},_0x334280={'count':0x0,'rows':[]};var _0x45853c=_[_0xdadf('0x3a')](db[_0xdadf('0x3b')]['rawAttributes'],function(_0x2d7128){return{'name':_0x2d7128[_0xdadf('0x3c')],'type':_0x2d7128['type'][_0xdadf('0x3d')]};});_0x4e9e01['model']=_['map'](_0x45853c,_0xdadf('0x38'));_0x4e9e01[_0xdadf('0x3e')]=_[_0xdadf('0x3f')](_0x5dfde4[_0xdadf('0x3e')]);_0x4e9e01[_0xdadf('0x40')]=_['intersection'](_0x4e9e01[_0xdadf('0x41')],_0x4e9e01['query']);_0x594d3b[_0xdadf('0x42')]=_[_0xdadf('0x43')](_0x4e9e01[_0xdadf('0x41')],qs[_0xdadf('0x44')](_0x5dfde4[_0xdadf('0x3e')][_0xdadf('0x44')]));_0x594d3b[_0xdadf('0x42')]=_0x594d3b[_0xdadf('0x42')][_0xdadf('0x45')]?_0x594d3b[_0xdadf('0x42')]:_0x4e9e01[_0xdadf('0x41')];if(!_0x5dfde4[_0xdadf('0x3e')]['hasOwnProperty'](_0xdadf('0x46'))){_0x594d3b[_0xdadf('0x2d')]=qs[_0xdadf('0x2d')](_0x5dfde4[_0xdadf('0x3e')][_0xdadf('0x2d')]);_0x594d3b[_0xdadf('0x2c')]=qs[_0xdadf('0x2c')](_0x5dfde4[_0xdadf('0x3e')][_0xdadf('0x2c')]);}_0x594d3b[_0xdadf('0x47')]=qs[_0xdadf('0x48')](_0x5dfde4[_0xdadf('0x3e')]['sort']);_0x594d3b[_0xdadf('0x49')]=qs[_0xdadf('0x40')](_[_0xdadf('0x4a')](_0x5dfde4['query'],_0x4e9e01['filters']),_0x45853c);if(_0x5dfde4[_0xdadf('0x3e')][_0xdadf('0x4b')]){_0x594d3b[_0xdadf('0x49')]=_['merge'](_0x594d3b[_0xdadf('0x49')],{'$or':_[_0xdadf('0x3a')](_0x45853c,function(_0x1846b6){if(_0x1846b6[_0xdadf('0x4c')]!==_0xdadf('0x4d')){var _0x47c398={};_0x47c398[_0x1846b6[_0xdadf('0x38')]]={'$like':'%'+_0x5dfde4[_0xdadf('0x3e')][_0xdadf('0x4b')]+'%'};return _0x47c398;}})});}_0x594d3b=_[_0xdadf('0x4e')]({},_0x594d3b,_0x5dfde4[_0xdadf('0x4f')]);var _0x4f634d={'where':_0x594d3b[_0xdadf('0x49')]};return db[_0xdadf('0x3b')][_0xdadf('0x2b')](_0x4f634d)[_0xdadf('0x34')](function(_0xb998cc){_0x334280['count']=_0xb998cc;if(_0x5dfde4[_0xdadf('0x3e')]['includeAll']){_0x594d3b['include']=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x594d3b);})[_0xdadf('0x34')](function(_0x382924){_0x334280[_0xdadf('0x50')]=_0x382924;return _0x334280;})[_0xdadf('0x34')](respondWithFilteredResult(_0x4706af,_0x594d3b))[_0xdadf('0x51')](handleError(_0x4706af,null));};exports[_0xdadf('0x52')]=function(_0x447a3f,_0x5be3e6){var _0xf676ab={'raw':![],'where':{'id':_0x447a3f[_0xdadf('0x53')]['id']}},_0x26f0d5={};_0x26f0d5[_0xdadf('0x41')]=_[_0xdadf('0x3f')](db[_0xdadf('0x3b')][_0xdadf('0x54')]);_0x26f0d5['query']=_['keys'](_0x447a3f[_0xdadf('0x3e')]);_0x26f0d5[_0xdadf('0x40')]=_['intersection'](_0x26f0d5[_0xdadf('0x41')],_0x26f0d5['query']);_0xf676ab[_0xdadf('0x42')]=_['intersection'](_0x26f0d5[_0xdadf('0x41')],qs[_0xdadf('0x44')](_0x447a3f[_0xdadf('0x3e')][_0xdadf('0x44')]));_0xf676ab[_0xdadf('0x42')]=_0xf676ab[_0xdadf('0x42')][_0xdadf('0x45')]?_0xf676ab[_0xdadf('0x42')]:_0x26f0d5[_0xdadf('0x41')];if(_0x447a3f[_0xdadf('0x3e')][_0xdadf('0x55')]){_0xf676ab[_0xdadf('0x56')]=[{'all':!![]}];}_0xf676ab=_[_0xdadf('0x4e')]({},_0xf676ab,_0x447a3f[_0xdadf('0x4f')]);return db[_0xdadf('0x3b')][_0xdadf('0x57')](_0xf676ab)[_0xdadf('0x34')](handleEntityNotFound(_0x5be3e6,null))['then'](respondWithResult(_0x5be3e6,null))[_0xdadf('0x51')](handleError(_0x5be3e6,null));};exports[_0xdadf('0x58')]=function(_0x992288,_0x30af2f){return db['VtigerAccount'][_0xdadf('0x58')](_0x992288[_0xdadf('0x59')],{})[_0xdadf('0x34')](respondWithResult(_0x30af2f,0xc9))['catch'](handleError(_0x30af2f,null));};exports['update']=function(_0x1ecb15,_0x5d19ae){if(_0x1ecb15[_0xdadf('0x59')]['id']){delete _0x1ecb15['body']['id'];}return db[_0xdadf('0x3b')][_0xdadf('0x57')]({'where':{'id':_0x1ecb15[_0xdadf('0x53')]['id']}})[_0xdadf('0x34')](handleEntityNotFound(_0x5d19ae,null))['then'](saveUpdates(_0x1ecb15[_0xdadf('0x59')],null))[_0xdadf('0x34')](respondWithResult(_0x5d19ae,null))[_0xdadf('0x51')](handleError(_0x5d19ae,null));};exports[_0xdadf('0x35')]=function(_0x5d1b83,_0x35ec6c){return db[_0xdadf('0x3b')][_0xdadf('0x57')]({'where':{'id':_0x5d1b83['params']['id']}})[_0xdadf('0x34')](handleEntityNotFound(_0x35ec6c,null))[_0xdadf('0x34')](removeEntity(_0x35ec6c,null))['catch'](handleError(_0x35ec6c,null));};exports[_0xdadf('0x5a')]=function(_0x1fb3cf,_0x2cedaf,_0x140f61){var _0x19da96={};var _0x53df6b={};var _0x168e84;var _0x8421d8;return db[_0xdadf('0x3b')][_0xdadf('0x5b')]({'where':{'id':_0x1fb3cf[_0xdadf('0x53')]['id']}})[_0xdadf('0x34')](handleEntityNotFound(_0x2cedaf,null))[_0xdadf('0x34')](function(_0x477f8e){if(_0x477f8e){_0x168e84=_0x477f8e;_0x53df6b['model']=_[_0xdadf('0x3f')](db['VtigerConfiguration'][_0xdadf('0x54')]);_0x53df6b[_0xdadf('0x3e')]=_[_0xdadf('0x3f')](_0x1fb3cf[_0xdadf('0x3e')]);_0x53df6b[_0xdadf('0x40')]=_[_0xdadf('0x43')](_0x53df6b[_0xdadf('0x41')],_0x53df6b[_0xdadf('0x3e')]);_0x19da96[_0xdadf('0x42')]=_[_0xdadf('0x43')](_0x53df6b['model'],qs[_0xdadf('0x44')](_0x1fb3cf[_0xdadf('0x3e')][_0xdadf('0x44')]));_0x19da96[_0xdadf('0x42')]=_0x19da96[_0xdadf('0x42')][_0xdadf('0x45')]?_0x19da96[_0xdadf('0x42')]:_0x53df6b[_0xdadf('0x41')];_0x19da96[_0xdadf('0x47')]=qs['sort'](_0x1fb3cf[_0xdadf('0x3e')][_0xdadf('0x48')]);_0x19da96[_0xdadf('0x49')]=qs['filters'](_['pick'](_0x1fb3cf[_0xdadf('0x3e')],_0x53df6b[_0xdadf('0x40')]));if(_0x1fb3cf['query'][_0xdadf('0x4b')]){_0x19da96[_0xdadf('0x49')]=_['merge'](_0x19da96[_0xdadf('0x49')],{'$or':_['map'](_0x19da96[_0xdadf('0x42')],function(_0x5926dc){var _0x51c858={};_0x51c858[_0x5926dc]={'$like':'%'+_0x1fb3cf[_0xdadf('0x3e')][_0xdadf('0x4b')]+'%'};return _0x51c858;})});}_0x19da96=_['merge']({},_0x19da96,_0x1fb3cf[_0xdadf('0x4f')]);return _0x168e84[_0xdadf('0x5a')](_0x19da96);}})['then'](function(_0x37e702){if(_0x37e702){_0x8421d8=_0x37e702[_0xdadf('0x45')];if(!_0x1fb3cf['query'][_0xdadf('0x5c')](_0xdadf('0x46'))){_0x19da96[_0xdadf('0x2d')]=qs['limit'](_0x1fb3cf[_0xdadf('0x3e')]['limit']);_0x19da96[_0xdadf('0x2c')]=qs[_0xdadf('0x2c')](_0x1fb3cf[_0xdadf('0x3e')][_0xdadf('0x2c')]);}return _0x168e84[_0xdadf('0x5a')](_0x19da96);}})['then'](function(_0x112613){if(_0x112613){return _0x112613?{'count':_0x8421d8,'rows':_0x112613}:null;}})[_0xdadf('0x34')](respondWithResult(_0x2cedaf,null))[_0xdadf('0x51')](handleError(_0x2cedaf,null));};exports['addConfiguration']=function(_0x2774b5,_0x180ba4,_0x4248b1){if(_0x2774b5['body']['id']){delete _0x2774b5['body']['id'];}return db[_0xdadf('0x3b')][_0xdadf('0x5b')]({'where':{'id':_0x2774b5[_0xdadf('0x53')]['id']}})[_0xdadf('0x34')](handleEntityNotFound(_0x180ba4,null))['then'](function(_0x1606cd){if(_0x1606cd){_0x2774b5['body'][_0xdadf('0x5d')]=_0x1606cd['id'];_0x2774b5[_0xdadf('0x59')][_0xdadf('0x5e')]=integrations[_0xdadf('0x5f')](_0x2774b5[_0xdadf('0x59')][_0xdadf('0x60')],_0x2774b5['body']['type']);_0x2774b5[_0xdadf('0x59')][_0xdadf('0x61')]=integrations[_0xdadf('0x62')](_0x2774b5[_0xdadf('0x59')][_0xdadf('0x60')],_0x2774b5[_0xdadf('0x59')][_0xdadf('0x4c')]);return db[_0xdadf('0x63')][_0xdadf('0x58')](_0x2774b5['body'],{'include':[{'model':db[_0xdadf('0x64')],'as':_0xdadf('0x5e')},{'model':db['VtigerField'],'as':_0xdadf('0x61')}]});}return null;})['then'](respondWithResult(_0x180ba4,null))['catch'](handleError(_0x180ba4,null));};var md5=require('md5');exports[_0xdadf('0x65')]=function(_0x465a8c,_0x5d5bbb,_0x12d4f6){var _0x3c860d=null;var _0x2ceb0f=null;var _0x231ce4=null;var _0x59688e=null;var _0x3457d8='';return db[_0xdadf('0x3b')][_0xdadf('0x5b')]({'where':{'id':_0x465a8c[_0xdadf('0x53')]['id']},'attributes':['id',_0xdadf('0x38'),'username','description','moduleName',_0xdadf('0x66'),_0xdadf('0x67'),_0xdadf('0x68')]})[_0xdadf('0x34')](handleEntityNotFound(_0x5d5bbb,null))[_0xdadf('0x34')](function(_0x2686db){if(_0x2686db){_0x3c860d=_0x2686db[_0xdadf('0x69')];_0x2ceb0f=_0x2686db[_0xdadf('0x68')];_0x231ce4=_0x2686db['moduleName'];_0x3457d8=_0x2686db[_0xdadf('0x66')];var _0x18d266=_0x3457d8[_0xdadf('0x6a')](-0x1);if(_0x18d266==='/'){_0x3457d8=_0x3457d8[_0xdadf('0x6b')](0x0,_0x3457d8[_0xdadf('0x6c')](_0x18d266));}_0x59688e=util[_0xdadf('0x6d')](_0xdadf('0x6e'),_0x3457d8);var _0x1392fc={'method':'GET','uri':_0x59688e,'qs':{'operation':_0xdadf('0x6f'),'username':_0x2686db[_0xdadf('0x69')]},'json':!![]};return rp(_0x1392fc);}})[_0xdadf('0x34')](function(_0x5d2ba8){if(_0x5d2ba8[_0xdadf('0x70')]){var _0x2bce94={'method':_0xdadf('0x71'),'uri':_0x59688e,'form':{'operation':_0xdadf('0x72'),'username':_0x3c860d,'accessKey':md5(_0x5d2ba8[_0xdadf('0x27')][_0xdadf('0x73')]+_0x2ceb0f)},'json':!![]};return rp(_0x2bce94);}})[_0xdadf('0x34')](function(_0x3b7046){if(_0x3b7046[_0xdadf('0x70')]){var _0x26cf5c={'method':_0xdadf('0x74'),'uri':_0x59688e,'qs':{'operation':_0xdadf('0x75'),'username':_0x3c860d,'sessionName':_0x3b7046['result'][_0xdadf('0x76')],'elementType':_0x231ce4},'json':!![]};return rp(_0x26cf5c);}})[_0xdadf('0x34')](function(_0x568cba){if(_0x568cba[_0xdadf('0x70')]){var _0x4fac69=[_0xdadf('0x77'),_0xdadf('0x78'),_0xdadf('0x79')];_[_0xdadf('0x7a')](_0x568cba[_0xdadf('0x27')][_0xdadf('0x44')],function(_0x3c4d9a){return _0x4fac69['includes'](_0x3c4d9a['type'][_0xdadf('0x38')]);});_[_0xdadf('0x7a')](_0x568cba['result'][_0xdadf('0x44')],function(_0x5d61d7){return _0x5d61d7[_0xdadf('0x7b')]==='false';});return{'count':_0x568cba['result']['fields'][_0xdadf('0x45')],'rows':_[_0xdadf('0x3a')](_0x568cba['result'][_0xdadf('0x44')],function(_0x25a34e){return{'id':_0x25a34e[_0xdadf('0x38')],'name':_0x25a34e[_0xdadf('0x7c')],'custom':_[_0xdadf('0x7d')](_0x25a34e[_0xdadf('0x38')],_0xdadf('0x7e'))?!![]:![],'options':_0x25a34e[_0xdadf('0x4c')][_0xdadf('0x38')]===_0xdadf('0x7f')&&_0x25a34e['type'][_0xdadf('0x80')][_0xdadf('0x45')]>0x0?_[_0xdadf('0x3a')](_0x25a34e[_0xdadf('0x4c')]['picklistValues'],function(_0x18c749){return{'name':_0x18c749[_0xdadf('0x7c')],'value':_0x18c749[_0xdadf('0x81')]};}):[]};})};}})[_0xdadf('0x34')](respondWithResult(_0x5d5bbb,null))[_0xdadf('0x51')](function(_0x1058b6){console[_0xdadf('0x82')](_0xdadf('0x83')+_0x1058b6);var _0x5485f1=_0x465a8c[_0xdadf('0x3e')][_0xdadf('0x84')]?0x1f4:_0x1058b6[_0xdadf('0x85')]||0x1f4;logger[_0xdadf('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xdadf('0x65'),_0x5485f1,JSON[_0xdadf('0x22')](_0x1058b6));delete _0x1058b6['name'];if(_0x5485f1===0x191){_0x5485f1=0x190;}_0x5d5bbb[_0xdadf('0x28')](_0x5485f1)[_0xdadf('0x39')](_0x465a8c[_0xdadf('0x3e')][_0xdadf('0x84')]?{'message':_0xdadf('0x86'),'statusCode':_0x1058b6[_0xdadf('0x85')]}:_0x1058b6);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e06d6aa..516b5ed 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 _0x2b10=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash'];(function(_0x442c60,_0x7ce430){var _0x28fcc9=function(_0x44e90f){while(--_0x44e90f){_0x442c60['push'](_0x442c60['shift']());}};_0x28fcc9(++_0x7ce430);}(_0x2b10,0x1b9));var _0x02b1=function(_0x1d4d3a,_0x56fa34){_0x1d4d3a=_0x1d4d3a-0x0;var _0x4cc162=_0x2b10[_0x1d4d3a];return _0x4cc162;};'use strict';var _=require(_0x02b1('0x0'));var util=require(_0x02b1('0x1'));var logger=require(_0x02b1('0x2'))(_0x02b1('0x3'));var moment=require(_0x02b1('0x4'));var BPromise=require(_0x02b1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02b1('0x6'));var rimraf=require('rimraf');var config=require(_0x02b1('0x7'));var attributes=require(_0x02b1('0x8'));var integrations=require(_0x02b1('0x9'));module[_0x02b1('0xa')]=function(_0x493c6d,_0x23d94b){return _0x493c6d[_0x02b1('0xb')](_0x02b1('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8ec=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x11ecea,_0x94df11){var _0xc508e=function(_0x125478){while(--_0x125478){_0x11ecea['push'](_0x11ecea['shift']());}};_0xc508e(++_0x94df11);}(_0xb8ec,0x174));var _0xcb8e=function(_0x4fe73f,_0x10f03e){_0x4fe73f=_0x4fe73f-0x0;var _0x139ab6=_0xb8ec[_0x4fe73f];return _0x139ab6;};'use strict';var _=require(_0xcb8e('0x0'));var util=require(_0xcb8e('0x1'));var logger=require(_0xcb8e('0x2'))(_0xcb8e('0x3'));var moment=require(_0xcb8e('0x4'));var BPromise=require(_0xcb8e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcb8e('0x6'));var config=require(_0xcb8e('0x7'));var attributes=require(_0xcb8e('0x8'));var integrations=require(_0xcb8e('0x9'));module[_0xcb8e('0xa')]=function(_0x31d2a2,_0x51d106){return _0x31d2a2[_0xcb8e('0xb')](_0xcb8e('0xc'),attributes,{'tableName':_0xcb8e('0xd'),'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 bb702cb..a26ff3d 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 _0xe88c=['then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','findAll','options','raw','attributes','include','map','model','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','find','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3d6135,_0x256136){var _0x16f3c1=function(_0x5e7576){while(--_0x5e7576){_0x3d6135['push'](_0x3d6135['shift']());}};_0x16f3c1(++_0x256136);}(_0xe88c,0x13d));var _0xce88=function(_0xa20086,_0x3978a9){_0xa20086=_0xa20086-0x0;var _0x121c6e=_0xe88c[_0xa20086];return _0x121c6e;};'use strict';var _=require(_0xce88('0x0'));var util=require(_0xce88('0x1'));var moment=require(_0xce88('0x2'));var BPromise=require(_0xce88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce88('0x4'));var db=require(_0xce88('0x5'))['db'];var utils=require(_0xce88('0x6'));var logger=require(_0xce88('0x7'))(_0xce88('0x8'));var config=require(_0xce88('0x9'));var jayson=require(_0xce88('0xa'));var client=jayson[_0xce88('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed13d,_0x4166c2,_0x35a945){return new BPromise(function(_0x4418ae,_0x310e34){return client[_0xce88('0xc')](_0x2ed13d,_0x35a945)[_0xce88('0xd')](function(_0x85430e){logger[_0xce88('0xe')](_0xce88('0xf'),_0x4166c2,_0xce88('0x10'));logger[_0xce88('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4166c2,_0xce88('0x10'),JSON['stringify'](_0x85430e));if(_0x85430e[_0xce88('0x12')]){if(_0x85430e[_0xce88('0x12')]['code']===0x1f4){logger[_0xce88('0x12')](_0xce88('0xf'),_0x4166c2,_0x85430e[_0xce88('0x12')][_0xce88('0x13')]);return _0x310e34(_0x85430e[_0xce88('0x12')][_0xce88('0x13')]);}logger[_0xce88('0x12')](_0xce88('0xf'),_0x4166c2,_0x85430e['error'][_0xce88('0x13')]);return _0x4418ae(_0x85430e['error'][_0xce88('0x13')]);}else{logger[_0xce88('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x4166c2,_0xce88('0x10'));_0x4418ae(_0x85430e['result'][_0xce88('0x13')]);}})[_0xce88('0x14')](function(_0x42d452){logger[_0xce88('0x12')](_0xce88('0xf'),_0x4166c2,_0x42d452);_0x310e34(_0x42d452);});});}exports['GetVtigerAccount']=function(_0x18948c){var _0x1eeac9=this;return new Promise(function(_0x43f99f,_0x2e6a9c){return db['VtigerAccount'][_0xce88('0x15')]({'raw':_0x18948c[_0xce88('0x16')]?_0x18948c['options'][_0xce88('0x17')]===undefined?!![]:![]:!![],'where':_0x18948c[_0xce88('0x16')]?_0x18948c[_0xce88('0x16')]['where']||null:null,'attributes':_0x18948c[_0xce88('0x16')]?_0x18948c[_0xce88('0x16')][_0xce88('0x18')]||null:null,'limit':_0x18948c['options']?_0x18948c[_0xce88('0x16')]['limit']||null:null,'include':_0x18948c[_0xce88('0x16')]?_0x18948c['options'][_0xce88('0x19')]?_[_0xce88('0x1a')](_0x18948c['options']['include'],function(_0x1673f0){return{'model':db[_0x1673f0[_0xce88('0x1b')]],'as':_0x1673f0['as'],'attributes':_0x1673f0[_0xce88('0x18')],'include':_0x1673f0[_0xce88('0x19')]?_[_0xce88('0x1a')](_0x1673f0[_0xce88('0x19')],function(_0x4b8985){return{'model':db[_0x4b8985[_0xce88('0x1b')]],'as':_0x4b8985['as'],'attributes':_0x4b8985[_0xce88('0x18')],'include':_0x4b8985[_0xce88('0x19')]?_[_0xce88('0x1a')](_0x4b8985[_0xce88('0x19')],function(_0x3c5404){return{'model':db[_0x3c5404[_0xce88('0x1b')]],'as':_0x3c5404['as'],'attributes':_0x3c5404[_0xce88('0x18')]};}):[]};}):[]};}):[]:[]})[_0xce88('0xd')](function(_0x545f13){logger[_0xce88('0xe')](_0xce88('0x1c'),_0x18948c);logger[_0xce88('0x11')](_0xce88('0x1c'),_0x18948c,JSON['stringify'](_0x545f13));_0x43f99f(_0x545f13);})[_0xce88('0x14')](function(_0xabd889){logger[_0xce88('0x12')](_0xce88('0x1c'),_0xabd889[_0xce88('0x13')],_0x18948c);_0x2e6a9c(_0x1eeac9['error'](0x1f4,_0xabd889['message']));});});};exports[_0xce88('0x1d')]=function(_0x483180){var _0x276ad4=this;return new Promise(function(_0x208941,_0x1bf732){return db[_0xce88('0x1e')][_0xce88('0x1f')]({'raw':_0x483180[_0xce88('0x16')]?_0x483180[_0xce88('0x16')][_0xce88('0x17')]===undefined?!![]:![]:!![],'where':_0x483180['options']?_0x483180[_0xce88('0x16')]['where']||null:null,'attributes':_0x483180[_0xce88('0x16')]?_0x483180[_0xce88('0x16')][_0xce88('0x18')]||null:null,'include':_0x483180['options']?_0x483180['options'][_0xce88('0x19')]?_[_0xce88('0x1a')](_0x483180['options'][_0xce88('0x19')],function(_0xb3b23b){return{'model':db[_0xb3b23b[_0xce88('0x1b')]],'as':_0xb3b23b['as'],'attributes':_0xb3b23b[_0xce88('0x18')],'include':_0xb3b23b[_0xce88('0x19')]?_[_0xce88('0x1a')](_0xb3b23b['include'],function(_0x57ee81){return{'model':db[_0x57ee81[_0xce88('0x1b')]],'as':_0x57ee81['as'],'attributes':_0x57ee81['attributes'],'include':_0x57ee81[_0xce88('0x19')]?_[_0xce88('0x1a')](_0x57ee81[_0xce88('0x19')],function(_0x36960b){return{'model':db[_0x36960b[_0xce88('0x1b')]],'as':_0x36960b['as'],'attributes':_0x36960b['attributes']};}):[]};}):[]};}):[]:[]})[_0xce88('0xd')](function(_0x531b0d){logger['info'](_0xce88('0x1d'),_0x483180);logger[_0xce88('0x11')](_0xce88('0x1d'),_0x483180,JSON[_0xce88('0x20')](_0x531b0d));_0x208941(_0x531b0d);})[_0xce88('0x14')](function(_0x2ed8fb){logger['error'](_0xce88('0x1d'),_0x2ed8fb[_0xce88('0x13')],_0x483180);_0x1bf732(_0x276ad4[_0xce88('0x12')](0x1f4,_0x2ed8fb[_0xce88('0x13')]));});});}; \ No newline at end of file +var _0x7dd1=['http','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','findAll','options','raw','attributes','limit','include','map','model','ShowVtigerAccount','VtigerAccount','find','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x7dd1,0x170));var _0x17dd=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x7dd1[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x17dd('0x0'));var util=require(_0x17dd('0x1'));var moment=require(_0x17dd('0x2'));var BPromise=require(_0x17dd('0x3'));var rs=require(_0x17dd('0x4'));var fs=require('fs');var Redis=require(_0x17dd('0x5'));var db=require(_0x17dd('0x6'))['db'];var utils=require(_0x17dd('0x7'));var logger=require('../../config/logger')(_0x17dd('0x8'));var config=require(_0x17dd('0x9'));var jayson=require(_0x17dd('0xa'));var client=jayson[_0x17dd('0xb')][_0x17dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4eb949,_0x523d9b,_0x231822){return new BPromise(function(_0x4b4d7a,_0x239ddf){return client[_0x17dd('0xd')](_0x4eb949,_0x231822)[_0x17dd('0xe')](function(_0x3efabf){logger['info'](_0x17dd('0xf'),_0x523d9b,_0x17dd('0x10'));logger[_0x17dd('0x11')](_0x17dd('0x12'),_0x523d9b,'request\x20sent',JSON[_0x17dd('0x13')](_0x3efabf));if(_0x3efabf[_0x17dd('0x14')]){if(_0x3efabf['error'][_0x17dd('0x15')]===0x1f4){logger[_0x17dd('0x14')](_0x17dd('0xf'),_0x523d9b,_0x3efabf[_0x17dd('0x14')][_0x17dd('0x16')]);return _0x239ddf(_0x3efabf[_0x17dd('0x14')][_0x17dd('0x16')]);}logger[_0x17dd('0x14')](_0x17dd('0xf'),_0x523d9b,_0x3efabf[_0x17dd('0x14')][_0x17dd('0x16')]);return _0x4b4d7a(_0x3efabf[_0x17dd('0x14')]['message']);}else{logger['info'](_0x17dd('0xf'),_0x523d9b,'request\x20sent');_0x4b4d7a(_0x3efabf[_0x17dd('0x17')][_0x17dd('0x16')]);}})[_0x17dd('0x18')](function(_0x2d67ae){logger[_0x17dd('0x14')](_0x17dd('0xf'),_0x523d9b,_0x2d67ae);_0x239ddf(_0x2d67ae);});});}exports[_0x17dd('0x19')]=function(_0x17f635){var _0x33d545=this;return new Promise(function(_0x294a42,_0x4e9848){return db['VtigerAccount'][_0x17dd('0x1a')]({'raw':_0x17f635[_0x17dd('0x1b')]?_0x17f635['options'][_0x17dd('0x1c')]===undefined?!![]:![]:!![],'where':_0x17f635[_0x17dd('0x1b')]?_0x17f635[_0x17dd('0x1b')]['where']||null:null,'attributes':_0x17f635[_0x17dd('0x1b')]?_0x17f635[_0x17dd('0x1b')][_0x17dd('0x1d')]||null:null,'limit':_0x17f635[_0x17dd('0x1b')]?_0x17f635['options'][_0x17dd('0x1e')]||null:null,'include':_0x17f635[_0x17dd('0x1b')]?_0x17f635['options'][_0x17dd('0x1f')]?_[_0x17dd('0x20')](_0x17f635[_0x17dd('0x1b')][_0x17dd('0x1f')],function(_0x1d592f){return{'model':db[_0x1d592f['model']],'as':_0x1d592f['as'],'attributes':_0x1d592f['attributes'],'include':_0x1d592f[_0x17dd('0x1f')]?_[_0x17dd('0x20')](_0x1d592f[_0x17dd('0x1f')],function(_0x2f3914){return{'model':db[_0x2f3914[_0x17dd('0x21')]],'as':_0x2f3914['as'],'attributes':_0x2f3914[_0x17dd('0x1d')],'include':_0x2f3914['include']?_['map'](_0x2f3914[_0x17dd('0x1f')],function(_0x1aa8bd){return{'model':db[_0x1aa8bd[_0x17dd('0x21')]],'as':_0x1aa8bd['as'],'attributes':_0x1aa8bd['attributes']};}):[]};}):[]};}):[]:[]})[_0x17dd('0xe')](function(_0x234a0e){logger['info'](_0x17dd('0x19'),_0x17f635);logger[_0x17dd('0x11')](_0x17dd('0x19'),_0x17f635,JSON[_0x17dd('0x13')](_0x234a0e));_0x294a42(_0x234a0e);})[_0x17dd('0x18')](function(_0x230607){logger[_0x17dd('0x14')](_0x17dd('0x19'),_0x230607[_0x17dd('0x16')],_0x17f635);_0x4e9848(_0x33d545[_0x17dd('0x14')](0x1f4,_0x230607[_0x17dd('0x16')]));});});};exports[_0x17dd('0x22')]=function(_0x203b5c){var _0x2c3e46=this;return new Promise(function(_0x4d685f,_0x3474bc){return db[_0x17dd('0x23')][_0x17dd('0x24')]({'raw':_0x203b5c[_0x17dd('0x1b')]?_0x203b5c[_0x17dd('0x1b')][_0x17dd('0x1c')]===undefined?!![]:![]:!![],'where':_0x203b5c[_0x17dd('0x1b')]?_0x203b5c[_0x17dd('0x1b')]['where']||null:null,'attributes':_0x203b5c[_0x17dd('0x1b')]?_0x203b5c[_0x17dd('0x1b')][_0x17dd('0x1d')]||null:null,'include':_0x203b5c['options']?_0x203b5c['options']['include']?_[_0x17dd('0x20')](_0x203b5c['options']['include'],function(_0x161011){return{'model':db[_0x161011[_0x17dd('0x21')]],'as':_0x161011['as'],'attributes':_0x161011[_0x17dd('0x1d')],'include':_0x161011[_0x17dd('0x1f')]?_[_0x17dd('0x20')](_0x161011[_0x17dd('0x1f')],function(_0x206a6d){return{'model':db[_0x206a6d['model']],'as':_0x206a6d['as'],'attributes':_0x206a6d[_0x17dd('0x1d')],'include':_0x206a6d['include']?_[_0x17dd('0x20')](_0x206a6d[_0x17dd('0x1f')],function(_0x1c3214){return{'model':db[_0x1c3214[_0x17dd('0x21')]],'as':_0x1c3214['as'],'attributes':_0x1c3214[_0x17dd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x17dd('0xe')](function(_0x2276e7){logger[_0x17dd('0x25')](_0x17dd('0x22'),_0x203b5c);logger[_0x17dd('0x11')]('ShowVtigerAccount',_0x203b5c,JSON[_0x17dd('0x13')](_0x2276e7));_0x4d685f(_0x2276e7);})['catch'](function(_0x1965d8){logger['error'](_0x17dd('0x22'),_0x1965d8[_0x17dd('0x16')],_0x203b5c);_0x3474bc(_0x2c3e46['error'](0x1f4,_0x1965d8[_0x17dd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index dfec196..f4dfeb5 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(_0x511122,_0x463f3c){var _0xa9e57c=function(_0x2e3bc6){while(--_0x2e3bc6){_0x511122['push'](_0x511122['shift']());}};_0xa9e57c(++_0x463f3c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5cdbfa,_0x4395c6){_0x5cdbfa=_0x5cdbfa-0x0;var _0x4eebc8=_0x5f2f[_0x5cdbfa];return _0x4eebc8;};'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 _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(_0x24b32a,_0x3b7b37){var _0x4ef8fb=function(_0x768a18){while(--_0x768a18){_0x24b32a['push'](_0x24b32a['shift']());}};_0x4ef8fb(++_0x3b7b37);}(_0x5f2f,0x73));var _0xf5f2=function(_0x531c92,_0x579347){_0x531c92=_0x531c92-0x0;var _0x1df86f=_0x5f2f[_0x531c92];return _0x1df86f;};'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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 19d4226..0d12286 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 _0x9aba=['STRING','exports'];(function(_0x1c0956,_0x9caa37){var _0x6743c1=function(_0x3dcd81){while(--_0x3dcd81){_0x1c0956['push'](_0x1c0956['shift']());}};_0x6743c1(++_0x9caa37);}(_0x9aba,0x1db));var _0xa9ab=function(_0x3ec08c,_0x29cbe3){_0x3ec08c=_0x3ec08c-0x0;var _0x4600cd=_0x9aba[_0x3ec08c];return _0x4600cd;};'use strict';var Sequelize=require('sequelize');module[_0xa9ab('0x0')]={'name':{'type':Sequelize[_0xa9ab('0x1')]},'description':{'type':Sequelize[_0xa9ab('0x1')]}}; \ No newline at end of file +var _0x0b23=['sequelize','STRING'];(function(_0x3d7811,_0x59daeb){var _0x927cfa=function(_0x5ce736){while(--_0x5ce736){_0x3d7811['push'](_0x3d7811['shift']());}};_0x927cfa(++_0x59daeb);}(_0x0b23,0x1ac));var _0x30b2=function(_0x4dd5b0,_0x37f3f4){_0x4dd5b0=_0x4dd5b0-0x0;var _0x59604f=_0x0b23[_0x4dd5b0];return _0x59604f;};'use strict';var Sequelize=require(_0x30b2('0x0'));module['exports']={'name':{'type':Sequelize[_0x30b2('0x1')]},'description':{'type':Sequelize[_0x30b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 14d91d7..01e4201 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 _0x421a=['jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','http','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','VtigerConfiguration','show','params','find','create','body','getFields','findOne','VtigerField','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x25b274,_0x578748){var _0x367046=function(_0x160fd6){while(--_0x160fd6){_0x25b274['push'](_0x25b274['shift']());}};_0x367046(++_0x578748);}(_0x421a,0x146));var _0xa421=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x421a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa421('0x0'));var emlformat=require(_0xa421('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa421('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa421('0x3'));var moment=require(_0xa421('0x4'));var BPromise=require(_0xa421('0x5'));var Mustache=require(_0xa421('0x6'));var util=require('util');var path=require(_0xa421('0x7'));var sox=require(_0xa421('0x8'));var csv=require(_0xa421('0x9'));var ejs=require(_0xa421('0xa'));var fs=require('fs');var _=require(_0xa421('0xb'));var squel=require(_0xa421('0xc'));var crypto=require(_0xa421('0xd'));var jsforce=require(_0xa421('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa421('0x9'));var querystring=require(_0xa421('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa421('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa421('0x11'));var hardwareService=require(_0xa421('0x12'));var logger=require(_0xa421('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa421('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa421('0x15'))['db'];var jayson=require(_0xa421('0x16'));var client=jayson['client'][_0xa421('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4d9f54,_0x34a4a5,_0x4841fa,_0x1224b5){return new BPromise(function(_0x552ebb,_0x2af29e){var _0xe55550=_0x1224b5||client;return _0xe55550['request'](_0x4d9f54,_0x4841fa)[_0xa421('0x18')](function(_0x1c4961){logger[_0xa421('0x19')](_0xa421('0x1a'),_0x34a4a5,'request\x20sent');logger['debug'](_0xa421('0x1b'),_0x34a4a5,_0xa421('0x1c'),JSON[_0xa421('0x1d')](_0x1c4961));if(_0x1c4961[_0xa421('0x1e')]){if(_0x1c4961[_0xa421('0x1e')]['code']===0x1f4){logger['error'](_0xa421('0x1a'),_0x34a4a5,_0x1c4961['error'][_0xa421('0x1f')]);return _0x2af29e(_0x1c4961[_0xa421('0x1e')][_0xa421('0x1f')]);}logger[_0xa421('0x1e')](_0xa421('0x1a'),_0x34a4a5,_0x1c4961[_0xa421('0x1e')][_0xa421('0x1f')]);return _0x552ebb(_0x1c4961['error']['message']);}else{logger[_0xa421('0x19')]('VtigerConfiguration,\x20%s,\x20%s',_0x34a4a5,_0xa421('0x1c'));_0x552ebb(_0x1c4961[_0xa421('0x20')]['message']);}})[_0xa421('0x21')](function(_0x166e1e){logger[_0xa421('0x1e')](_0xa421('0x1a'),_0x34a4a5,_0x166e1e);_0x2af29e(_0x166e1e);});});}function respondWithStatusCode(_0x239f3e,_0x54970e){_0x54970e=_0x54970e||0xcc;return function(_0x20e4ca){if(_0x20e4ca){return _0x239f3e[_0xa421('0x22')](_0x54970e);}return _0x239f3e[_0xa421('0x23')](_0x54970e)[_0xa421('0x24')]();};}function respondWithResult(_0x4580d9,_0x55f010){_0x55f010=_0x55f010||0xc8;return function(_0x1e867e){if(_0x1e867e){return _0x4580d9[_0xa421('0x23')](_0x55f010)[_0xa421('0x25')](_0x1e867e);}};}function respondWithFilteredResult(_0x2c22b5,_0x120435){return function(_0x25fdb4){if(_0x25fdb4){var _0x3771c6=_0x25fdb4[_0xa421('0x26')],_0x16a731=_0x120435[_0xa421('0x27')],_0x1f3ce5=_0x120435[_0xa421('0x27')]+_0x120435[_0xa421('0x28')],_0x28fdde;if(_0x1f3ce5>=_0x3771c6){_0x1f3ce5=_0x3771c6;_0x28fdde=0xc8;}else{_0x28fdde=0xce;}_0x2c22b5[_0xa421('0x23')](_0x28fdde);return _0x2c22b5[_0xa421('0x29')](_0xa421('0x2a'),_0x16a731+'-'+_0x1f3ce5+'/'+_0x3771c6)[_0xa421('0x25')](_0x25fdb4);}return null;};}function patchUpdates(_0x26769f){return function(_0x454c3c){try{jsonpatch[_0xa421('0x2b')](_0x454c3c,_0x26769f,!![]);}catch(_0x3f811d){return BPromise[_0xa421('0x2c')](_0x3f811d);}return _0x454c3c[_0xa421('0x2d')]();};}function saveUpdates(_0x8a3067,_0x4a70fb){return function(_0x570f2c){if(_0x570f2c){return _0x570f2c[_0xa421('0x2e')](_0x8a3067)[_0xa421('0x18')](function(_0x1fd0a9){return _0x1fd0a9;});}return null;};}function removeEntity(_0x4fbc76,_0x39fc3b){return function(_0x319f52){if(_0x319f52){return _0x319f52[_0xa421('0x2f')]()[_0xa421('0x18')](function(){_0x4fbc76[_0xa421('0x23')](0xcc)[_0xa421('0x24')]();});}};}function handleEntityNotFound(_0x4bd5c7,_0xe70df6){return function(_0x1cd9b0){if(!_0x1cd9b0){_0x4bd5c7['sendStatus'](0x194);}return _0x1cd9b0;};}function handleError(_0x281b8d,_0x3e373e){_0x3e373e=_0x3e373e||0x1f4;return function(_0x579dee){logger[_0xa421('0x1e')](_0x579dee['stack']);if(_0x579dee[_0xa421('0x30')]){delete _0x579dee[_0xa421('0x30')];}_0x281b8d[_0xa421('0x23')](_0x3e373e)['send'](_0x579dee);};}exports[_0xa421('0x31')]=function(_0x424791,_0xa4668f){var _0xa81e8e={},_0x11839e={},_0x10e09c={'count':0x0,'rows':[]};var _0x460c97=_[_0xa421('0x32')](db['VtigerConfiguration'][_0xa421('0x33')],function(_0x445055){return{'name':_0x445055[_0xa421('0x34')],'type':_0x445055['type']['key']};});_0x11839e[_0xa421('0x35')]=_['map'](_0x460c97,_0xa421('0x30'));_0x11839e[_0xa421('0x36')]=_[_0xa421('0x37')](_0x424791[_0xa421('0x36')]);_0x11839e[_0xa421('0x38')]=_[_0xa421('0x39')](_0x11839e[_0xa421('0x35')],_0x11839e['query']);_0xa81e8e[_0xa421('0x3a')]=_[_0xa421('0x39')](_0x11839e[_0xa421('0x35')],qs['fields'](_0x424791[_0xa421('0x36')][_0xa421('0x3b')]));_0xa81e8e['attributes']=_0xa81e8e[_0xa421('0x3a')][_0xa421('0x3c')]?_0xa81e8e['attributes']:_0x11839e[_0xa421('0x35')];if(!_0x424791[_0xa421('0x36')]['hasOwnProperty'](_0xa421('0x3d'))){_0xa81e8e['limit']=qs['limit'](_0x424791[_0xa421('0x36')]['limit']);_0xa81e8e[_0xa421('0x27')]=qs[_0xa421('0x27')](_0x424791[_0xa421('0x36')][_0xa421('0x27')]);}_0xa81e8e[_0xa421('0x3e')]=qs[_0xa421('0x3f')](_0x424791[_0xa421('0x36')][_0xa421('0x3f')]);_0xa81e8e[_0xa421('0x40')]=qs[_0xa421('0x38')](_[_0xa421('0x41')](_0x424791['query'],_0x11839e[_0xa421('0x38')]),_0x460c97);if(_0x424791['query'][_0xa421('0x42')]){_0xa81e8e[_0xa421('0x40')]=_[_0xa421('0x43')](_0xa81e8e['where'],{'$or':_['map'](_0x460c97,function(_0x143028){if(_0x143028[_0xa421('0x44')]!==_0xa421('0x45')){var _0x59c078={};_0x59c078[_0x143028[_0xa421('0x30')]]={'$like':'%'+_0x424791[_0xa421('0x36')]['filter']+'%'};return _0x59c078;}})});}_0xa81e8e=_['merge']({},_0xa81e8e,_0x424791[_0xa421('0x46')]);var _0x564f09={'where':_0xa81e8e[_0xa421('0x40')]};return db['VtigerConfiguration']['count'](_0x564f09)['then'](function(_0x207971){_0x10e09c['count']=_0x207971;if(_0x424791[_0xa421('0x36')][_0xa421('0x47')]){_0xa81e8e[_0xa421('0x48')]=[{'all':!![]}];}return db[_0xa421('0x49')]['findAll'](_0xa81e8e);})[_0xa421('0x18')](function(_0x1ae6af){_0x10e09c['rows']=_0x1ae6af;return _0x10e09c;})[_0xa421('0x18')](respondWithFilteredResult(_0xa4668f,_0xa81e8e))['catch'](handleError(_0xa4668f,null));};exports[_0xa421('0x4a')]=function(_0x260c5a,_0x307d45){var _0x301137={'raw':![],'where':{'id':_0x260c5a[_0xa421('0x4b')]['id']}},_0x201022={};_0x201022['model']=_[_0xa421('0x37')](db[_0xa421('0x49')][_0xa421('0x33')]);_0x201022[_0xa421('0x36')]=_[_0xa421('0x37')](_0x260c5a[_0xa421('0x36')]);_0x201022['filters']=_[_0xa421('0x39')](_0x201022[_0xa421('0x35')],_0x201022[_0xa421('0x36')]);_0x301137[_0xa421('0x3a')]=_[_0xa421('0x39')](_0x201022['model'],qs[_0xa421('0x3b')](_0x260c5a[_0xa421('0x36')]['fields']));_0x301137['attributes']=_0x301137[_0xa421('0x3a')][_0xa421('0x3c')]?_0x301137[_0xa421('0x3a')]:_0x201022['model'];if(_0x260c5a['query']['includeAll']){_0x301137[_0xa421('0x48')]=[{'all':!![]}];}_0x301137=_['merge']({},_0x301137,_0x260c5a[_0xa421('0x46')]);return db['VtigerConfiguration'][_0xa421('0x4c')](_0x301137)[_0xa421('0x18')](handleEntityNotFound(_0x307d45,null))['then'](respondWithResult(_0x307d45,null))[_0xa421('0x21')](handleError(_0x307d45,null));};exports[_0xa421('0x4d')]=function(_0x49f158,_0x7ada4e){return db[_0xa421('0x49')][_0xa421('0x4d')](_0x49f158[_0xa421('0x4e')],{})[_0xa421('0x18')](respondWithResult(_0x7ada4e,0xc9))['catch'](handleError(_0x7ada4e,null));};exports[_0xa421('0x2e')]=function(_0xcb68e3,_0x19e21d){if(_0xcb68e3[_0xa421('0x4e')]['id']){delete _0xcb68e3[_0xa421('0x4e')]['id'];}return db[_0xa421('0x49')][_0xa421('0x4c')]({'where':{'id':_0xcb68e3[_0xa421('0x4b')]['id']}})[_0xa421('0x18')](handleEntityNotFound(_0x19e21d,null))[_0xa421('0x18')](saveUpdates(_0xcb68e3['body'],null))['then'](respondWithResult(_0x19e21d,null))[_0xa421('0x21')](handleError(_0x19e21d,null));};exports[_0xa421('0x2f')]=function(_0x35a555,_0x130d8a){return db[_0xa421('0x49')][_0xa421('0x4c')]({'where':{'id':_0x35a555[_0xa421('0x4b')]['id']}})[_0xa421('0x18')](handleEntityNotFound(_0x130d8a,null))[_0xa421('0x18')](removeEntity(_0x130d8a,null))[_0xa421('0x21')](handleError(_0x130d8a,null));};exports[_0xa421('0x4f')]=function(_0x5c77d2,_0x1c2714,_0x50d8cc){var _0x54e120={};var _0x509dc7={};var _0x285ba9;var _0x56504a;return db['VtigerConfiguration'][_0xa421('0x50')]({'where':{'id':_0x5c77d2['params']['id']}})[_0xa421('0x18')](handleEntityNotFound(_0x1c2714,null))[_0xa421('0x18')](function(_0x160822){if(_0x160822){_0x285ba9=_0x160822;_0x509dc7[_0xa421('0x35')]=_['keys'](db[_0xa421('0x51')][_0xa421('0x33')]);_0x509dc7[_0xa421('0x36')]=_[_0xa421('0x37')](_0x5c77d2[_0xa421('0x36')]);_0x509dc7[_0xa421('0x38')]=_['intersection'](_0x509dc7[_0xa421('0x35')],_0x509dc7[_0xa421('0x36')]);_0x54e120['attributes']=_['intersection'](_0x509dc7[_0xa421('0x35')],qs[_0xa421('0x3b')](_0x5c77d2[_0xa421('0x36')][_0xa421('0x3b')]));_0x54e120[_0xa421('0x3a')]=_0x54e120[_0xa421('0x3a')][_0xa421('0x3c')]?_0x54e120[_0xa421('0x3a')]:_0x509dc7[_0xa421('0x35')];_0x54e120[_0xa421('0x3e')]=qs['sort'](_0x5c77d2['query']['sort']);_0x54e120[_0xa421('0x40')]=qs[_0xa421('0x38')](_['pick'](_0x5c77d2[_0xa421('0x36')],_0x509dc7[_0xa421('0x38')]));if(_0x5c77d2['query']['filter']){_0x54e120['where']=_['merge'](_0x54e120[_0xa421('0x40')],{'$or':_['map'](_0x54e120['attributes'],function(_0x57c19a){var _0x3e601c={};_0x3e601c[_0x57c19a]={'$like':'%'+_0x5c77d2['query'][_0xa421('0x42')]+'%'};return _0x3e601c;})});}_0x54e120=_[_0xa421('0x43')]({},_0x54e120,_0x5c77d2[_0xa421('0x46')]);return _0x285ba9[_0xa421('0x4f')](_0x54e120);}})[_0xa421('0x18')](function(_0x153c9f){if(_0x153c9f){_0x56504a=_0x153c9f['length'];if(!_0x5c77d2[_0xa421('0x36')][_0xa421('0x52')](_0xa421('0x3d'))){_0x54e120[_0xa421('0x28')]=qs[_0xa421('0x28')](_0x5c77d2['query'][_0xa421('0x28')]);_0x54e120[_0xa421('0x27')]=qs[_0xa421('0x27')](_0x5c77d2[_0xa421('0x36')]['offset']);}return _0x285ba9['getFields'](_0x54e120);}})[_0xa421('0x18')](function(_0x1d5d96){if(_0x1d5d96){return _0x1d5d96?{'count':_0x56504a,'rows':_0x1d5d96}:null;}})[_0xa421('0x18')](respondWithResult(_0x1c2714,null))[_0xa421('0x21')](handleError(_0x1c2714,null));};exports['getSubjects']=function(_0x59c921,_0x4d1220,_0x22c22a){var _0x18b6e9={};var _0x354275={};var _0x935368;var _0x137c2d;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x59c921[_0xa421('0x4b')]['id']}})[_0xa421('0x18')](handleEntityNotFound(_0x4d1220,null))[_0xa421('0x18')](function(_0x179cad){if(_0x179cad){_0x935368=_0x179cad;_0x354275[_0xa421('0x35')]=_[_0xa421('0x37')](db[_0xa421('0x51')]['rawAttributes']);_0x354275['query']=_['keys'](_0x59c921[_0xa421('0x36')]);_0x354275[_0xa421('0x38')]=_['intersection'](_0x354275[_0xa421('0x35')],_0x354275[_0xa421('0x36')]);_0x18b6e9[_0xa421('0x3a')]=_[_0xa421('0x39')](_0x354275[_0xa421('0x35')],qs['fields'](_0x59c921[_0xa421('0x36')][_0xa421('0x3b')]));_0x18b6e9[_0xa421('0x3a')]=_0x18b6e9[_0xa421('0x3a')][_0xa421('0x3c')]?_0x18b6e9[_0xa421('0x3a')]:_0x354275[_0xa421('0x35')];_0x18b6e9['order']=qs[_0xa421('0x3f')](_0x59c921[_0xa421('0x36')]['sort']);_0x18b6e9[_0xa421('0x40')]=qs[_0xa421('0x38')](_['pick'](_0x59c921[_0xa421('0x36')],_0x354275[_0xa421('0x38')]));if(_0x59c921[_0xa421('0x36')][_0xa421('0x42')]){_0x18b6e9[_0xa421('0x40')]=_[_0xa421('0x43')](_0x18b6e9[_0xa421('0x40')],{'$or':_[_0xa421('0x32')](_0x18b6e9['attributes'],function(_0x5da451){var _0x1673f0={};_0x1673f0[_0x5da451]={'$like':'%'+_0x59c921[_0xa421('0x36')][_0xa421('0x42')]+'%'};return _0x1673f0;})});}_0x18b6e9=_[_0xa421('0x43')]({},_0x18b6e9,_0x59c921[_0xa421('0x46')]);return _0x935368[_0xa421('0x53')](_0x18b6e9);}})[_0xa421('0x18')](function(_0x145301){if(_0x145301){_0x137c2d=_0x145301[_0xa421('0x3c')];if(!_0x59c921[_0xa421('0x36')][_0xa421('0x52')](_0xa421('0x3d'))){_0x18b6e9[_0xa421('0x28')]=qs[_0xa421('0x28')](_0x59c921[_0xa421('0x36')][_0xa421('0x28')]);_0x18b6e9['offset']=qs[_0xa421('0x27')](_0x59c921[_0xa421('0x36')][_0xa421('0x27')]);}return _0x935368['getSubjects'](_0x18b6e9);}})[_0xa421('0x18')](function(_0x14a2a9){if(_0x14a2a9){return _0x14a2a9?{'count':_0x137c2d,'rows':_0x14a2a9}:null;}})[_0xa421('0x18')](respondWithResult(_0x4d1220,null))[_0xa421('0x21')](handleError(_0x4d1220,null));};exports[_0xa421('0x54')]=function(_0x14aa99,_0xe51aff,_0x45775d){var _0x319e09={};var _0x4d2530={};var _0x122a1e;var _0x50d5db;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x14aa99[_0xa421('0x4b')]['id']}})[_0xa421('0x18')](handleEntityNotFound(_0xe51aff,null))[_0xa421('0x18')](function(_0x445b25){if(_0x445b25){_0x122a1e=_0x445b25;_0x4d2530[_0xa421('0x35')]=_[_0xa421('0x37')](db['VtigerField'][_0xa421('0x33')]);_0x4d2530['query']=_[_0xa421('0x37')](_0x14aa99['query']);_0x4d2530[_0xa421('0x38')]=_[_0xa421('0x39')](_0x4d2530[_0xa421('0x35')],_0x4d2530['query']);_0x319e09[_0xa421('0x3a')]=_[_0xa421('0x39')](_0x4d2530[_0xa421('0x35')],qs[_0xa421('0x3b')](_0x14aa99[_0xa421('0x36')][_0xa421('0x3b')]));_0x319e09['attributes']=_0x319e09[_0xa421('0x3a')][_0xa421('0x3c')]?_0x319e09['attributes']:_0x4d2530['model'];_0x319e09['order']=qs['sort'](_0x14aa99[_0xa421('0x36')]['sort']);_0x319e09[_0xa421('0x40')]=qs[_0xa421('0x38')](_[_0xa421('0x41')](_0x14aa99[_0xa421('0x36')],_0x4d2530['filters']));if(_0x14aa99[_0xa421('0x36')][_0xa421('0x42')]){_0x319e09[_0xa421('0x40')]=_[_0xa421('0x43')](_0x319e09['where'],{'$or':_[_0xa421('0x32')](_0x319e09[_0xa421('0x3a')],function(_0x39fa2f){var _0x4a494c={};_0x4a494c[_0x39fa2f]={'$like':'%'+_0x14aa99[_0xa421('0x36')][_0xa421('0x42')]+'%'};return _0x4a494c;})});}_0x319e09=_['merge']({},_0x319e09,_0x14aa99['options']);return _0x122a1e[_0xa421('0x54')](_0x319e09);}})[_0xa421('0x18')](function(_0x302642){if(_0x302642){_0x50d5db=_0x302642[_0xa421('0x3c')];if(!_0x14aa99[_0xa421('0x36')]['hasOwnProperty'](_0xa421('0x3d'))){_0x319e09[_0xa421('0x28')]=qs['limit'](_0x14aa99[_0xa421('0x36')]['limit']);_0x319e09[_0xa421('0x27')]=qs['offset'](_0x14aa99[_0xa421('0x36')]['offset']);}return _0x122a1e['getDescriptions'](_0x319e09);}})[_0xa421('0x18')](function(_0x59745a){if(_0x59745a){return _0x59745a?{'count':_0x50d5db,'rows':_0x59745a}:null;}})[_0xa421('0x18')](respondWithResult(_0xe51aff,null))[_0xa421('0x21')](handleError(_0xe51aff,null));}; \ No newline at end of file +var _0xe480=['name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','VtigerConfiguration','includeAll','include','findAll','rows','params','options','find','create','body','update','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','jayson/promise','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','destroy','stack','send','map','rawAttributes','type'];(function(_0x2eb54a,_0x84a229){var _0x1edc07=function(_0x228957){while(--_0x228957){_0x2eb54a['push'](_0x2eb54a['shift']());}};_0x1edc07(++_0x84a229);}(_0xe480,0x17f));var _0x0e48=function(_0x231b8b,_0xea71c7){_0x231b8b=_0x231b8b-0x0;var _0x3b8262=_0xe480[_0x231b8b];return _0x3b8262;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0e48('0x0'));var rimraf=require(_0x0e48('0x1'));var zipdir=require(_0x0e48('0x2'));var jsonpatch=require(_0x0e48('0x3'));var rp=require(_0x0e48('0x4'));var moment=require(_0x0e48('0x5'));var BPromise=require(_0x0e48('0x6'));var Mustache=require(_0x0e48('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e48('0x8'));var squel=require(_0x0e48('0x9'));var crypto=require(_0x0e48('0xa'));var jsforce=require(_0x0e48('0xb'));var deskjs=require(_0x0e48('0xc'));var toCsv=require(_0x0e48('0xd'));var querystring=require(_0x0e48('0xe'));var Papa=require('papaparse');var Redis=require(_0x0e48('0xf'));var authService=require(_0x0e48('0x10'));var qs=require(_0x0e48('0x11'));var as=require(_0x0e48('0x12'));var hardwareService=require(_0x0e48('0x13'));var logger=require(_0x0e48('0x14'))(_0x0e48('0x15'));var utils=require(_0x0e48('0x16'));var config=require(_0x0e48('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e48('0x18'))['db'];var jayson=require(_0x0e48('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x589ec4,_0x24116f,_0x26bc04,_0x28779b){return new BPromise(function(_0x1a3bf8,_0x32ddd5){var _0x406aca=_0x28779b||client;return _0x406aca[_0x0e48('0x1a')](_0x589ec4,_0x26bc04)[_0x0e48('0x1b')](function(_0x4fd2e3){logger[_0x0e48('0x1c')](_0x0e48('0x1d'),_0x24116f,_0x0e48('0x1e'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x24116f,_0x0e48('0x1e'),JSON[_0x0e48('0x1f')](_0x4fd2e3));if(_0x4fd2e3[_0x0e48('0x20')]){if(_0x4fd2e3[_0x0e48('0x20')][_0x0e48('0x21')]===0x1f4){logger[_0x0e48('0x20')](_0x0e48('0x1d'),_0x24116f,_0x4fd2e3[_0x0e48('0x20')][_0x0e48('0x22')]);return _0x32ddd5(_0x4fd2e3[_0x0e48('0x20')][_0x0e48('0x22')]);}logger[_0x0e48('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x24116f,_0x4fd2e3[_0x0e48('0x20')][_0x0e48('0x22')]);return _0x1a3bf8(_0x4fd2e3[_0x0e48('0x20')][_0x0e48('0x22')]);}else{logger[_0x0e48('0x1c')](_0x0e48('0x1d'),_0x24116f,'request\x20sent');_0x1a3bf8(_0x4fd2e3['result']['message']);}})[_0x0e48('0x23')](function(_0x489757){logger[_0x0e48('0x20')](_0x0e48('0x1d'),_0x24116f,_0x489757);_0x32ddd5(_0x489757);});});}function respondWithStatusCode(_0x4dd75e,_0x3ab6fe){_0x3ab6fe=_0x3ab6fe||0xcc;return function(_0x366fb4){if(_0x366fb4){return _0x4dd75e[_0x0e48('0x24')](_0x3ab6fe);}return _0x4dd75e[_0x0e48('0x25')](_0x3ab6fe)[_0x0e48('0x26')]();};}function respondWithResult(_0x2d2878,_0x16a681){_0x16a681=_0x16a681||0xc8;return function(_0x38b1c0){if(_0x38b1c0){return _0x2d2878['status'](_0x16a681)[_0x0e48('0x27')](_0x38b1c0);}};}function respondWithFilteredResult(_0x29aebb,_0x5a6786){return function(_0x497f21){if(_0x497f21){var _0x242ed1=_0x497f21[_0x0e48('0x28')],_0x5079cc=_0x5a6786[_0x0e48('0x29')],_0x26f0a8=_0x5a6786[_0x0e48('0x29')]+_0x5a6786['limit'],_0x2eef3d;if(_0x26f0a8>=_0x242ed1){_0x26f0a8=_0x242ed1;_0x2eef3d=0xc8;}else{_0x2eef3d=0xce;}_0x29aebb['status'](_0x2eef3d);return _0x29aebb[_0x0e48('0x2a')](_0x0e48('0x2b'),_0x5079cc+'-'+_0x26f0a8+'/'+_0x242ed1)[_0x0e48('0x27')](_0x497f21);}return null;};}function patchUpdates(_0x33c464){return function(_0x308a5d){try{jsonpatch[_0x0e48('0x2c')](_0x308a5d,_0x33c464,!![]);}catch(_0x327df8){return BPromise['reject'](_0x327df8);}return _0x308a5d[_0x0e48('0x2d')]();};}function saveUpdates(_0x57e3bb,_0x834c55){return function(_0x2e2b6b){if(_0x2e2b6b){return _0x2e2b6b['update'](_0x57e3bb)[_0x0e48('0x1b')](function(_0x77e321){return _0x77e321;});}return null;};}function removeEntity(_0x3fdb36,_0x933a9e){return function(_0x5a6101){if(_0x5a6101){return _0x5a6101[_0x0e48('0x2e')]()['then'](function(){_0x3fdb36[_0x0e48('0x25')](0xcc)[_0x0e48('0x26')]();});}};}function handleEntityNotFound(_0x2b1fcf,_0x22c91f){return function(_0x5dbb94){if(!_0x5dbb94){_0x2b1fcf[_0x0e48('0x24')](0x194);}return _0x5dbb94;};}function handleError(_0x467ffd,_0x171d72){_0x171d72=_0x171d72||0x1f4;return function(_0x4b81ed){logger['error'](_0x4b81ed[_0x0e48('0x2f')]);if(_0x4b81ed['name']){delete _0x4b81ed['name'];}_0x467ffd['status'](_0x171d72)[_0x0e48('0x30')](_0x4b81ed);};}exports['index']=function(_0x33d2e6,_0x194de7){var _0xf6d3ab={},_0x181db0={},_0x5ae245={'count':0x0,'rows':[]};var _0x54f561=_[_0x0e48('0x31')](db['VtigerConfiguration'][_0x0e48('0x32')],function(_0x474245){return{'name':_0x474245['fieldName'],'type':_0x474245[_0x0e48('0x33')]['key']};});_0x181db0['model']=_[_0x0e48('0x31')](_0x54f561,_0x0e48('0x34'));_0x181db0[_0x0e48('0x35')]=_[_0x0e48('0x36')](_0x33d2e6['query']);_0x181db0[_0x0e48('0x37')]=_[_0x0e48('0x38')](_0x181db0['model'],_0x181db0[_0x0e48('0x35')]);_0xf6d3ab[_0x0e48('0x39')]=_[_0x0e48('0x38')](_0x181db0[_0x0e48('0x3a')],qs[_0x0e48('0x3b')](_0x33d2e6[_0x0e48('0x35')][_0x0e48('0x3b')]));_0xf6d3ab[_0x0e48('0x39')]=_0xf6d3ab[_0x0e48('0x39')][_0x0e48('0x3c')]?_0xf6d3ab[_0x0e48('0x39')]:_0x181db0[_0x0e48('0x3a')];if(!_0x33d2e6[_0x0e48('0x35')][_0x0e48('0x3d')](_0x0e48('0x3e'))){_0xf6d3ab[_0x0e48('0x3f')]=qs[_0x0e48('0x3f')](_0x33d2e6[_0x0e48('0x35')]['limit']);_0xf6d3ab[_0x0e48('0x29')]=qs['offset'](_0x33d2e6[_0x0e48('0x35')][_0x0e48('0x29')]);}_0xf6d3ab[_0x0e48('0x40')]=qs['sort'](_0x33d2e6['query'][_0x0e48('0x41')]);_0xf6d3ab[_0x0e48('0x42')]=qs[_0x0e48('0x37')](_[_0x0e48('0x43')](_0x33d2e6['query'],_0x181db0[_0x0e48('0x37')]),_0x54f561);if(_0x33d2e6['query'][_0x0e48('0x44')]){_0xf6d3ab[_0x0e48('0x42')]=_[_0x0e48('0x45')](_0xf6d3ab[_0x0e48('0x42')],{'$or':_[_0x0e48('0x31')](_0x54f561,function(_0x41fee3){if(_0x41fee3['type']!==_0x0e48('0x46')){var _0x5e7bed={};_0x5e7bed[_0x41fee3[_0x0e48('0x34')]]={'$like':'%'+_0x33d2e6[_0x0e48('0x35')]['filter']+'%'};return _0x5e7bed;}})});}_0xf6d3ab=_[_0x0e48('0x45')]({},_0xf6d3ab,_0x33d2e6['options']);var _0x33b1bb={'where':_0xf6d3ab[_0x0e48('0x42')]};return db[_0x0e48('0x47')][_0x0e48('0x28')](_0x33b1bb)[_0x0e48('0x1b')](function(_0x3d035e){_0x5ae245[_0x0e48('0x28')]=_0x3d035e;if(_0x33d2e6[_0x0e48('0x35')][_0x0e48('0x48')]){_0xf6d3ab[_0x0e48('0x49')]=[{'all':!![]}];}return db[_0x0e48('0x47')][_0x0e48('0x4a')](_0xf6d3ab);})[_0x0e48('0x1b')](function(_0x4baa83){_0x5ae245[_0x0e48('0x4b')]=_0x4baa83;return _0x5ae245;})[_0x0e48('0x1b')](respondWithFilteredResult(_0x194de7,_0xf6d3ab))[_0x0e48('0x23')](handleError(_0x194de7,null));};exports['show']=function(_0x329fdf,_0x4dada2){var _0x4dda7a={'raw':![],'where':{'id':_0x329fdf[_0x0e48('0x4c')]['id']}},_0x397b93={};_0x397b93[_0x0e48('0x3a')]=_[_0x0e48('0x36')](db[_0x0e48('0x47')][_0x0e48('0x32')]);_0x397b93[_0x0e48('0x35')]=_[_0x0e48('0x36')](_0x329fdf[_0x0e48('0x35')]);_0x397b93[_0x0e48('0x37')]=_[_0x0e48('0x38')](_0x397b93[_0x0e48('0x3a')],_0x397b93[_0x0e48('0x35')]);_0x4dda7a[_0x0e48('0x39')]=_[_0x0e48('0x38')](_0x397b93[_0x0e48('0x3a')],qs[_0x0e48('0x3b')](_0x329fdf[_0x0e48('0x35')]['fields']));_0x4dda7a['attributes']=_0x4dda7a['attributes'][_0x0e48('0x3c')]?_0x4dda7a[_0x0e48('0x39')]:_0x397b93[_0x0e48('0x3a')];if(_0x329fdf['query']['includeAll']){_0x4dda7a[_0x0e48('0x49')]=[{'all':!![]}];}_0x4dda7a=_[_0x0e48('0x45')]({},_0x4dda7a,_0x329fdf[_0x0e48('0x4d')]);return db[_0x0e48('0x47')][_0x0e48('0x4e')](_0x4dda7a)[_0x0e48('0x1b')](handleEntityNotFound(_0x4dada2,null))[_0x0e48('0x1b')](respondWithResult(_0x4dada2,null))[_0x0e48('0x23')](handleError(_0x4dada2,null));};exports[_0x0e48('0x4f')]=function(_0x54e26d,_0x50aa9a){return db[_0x0e48('0x47')][_0x0e48('0x4f')](_0x54e26d[_0x0e48('0x50')],{})[_0x0e48('0x1b')](respondWithResult(_0x50aa9a,0xc9))[_0x0e48('0x23')](handleError(_0x50aa9a,null));};exports[_0x0e48('0x51')]=function(_0x19b52d,_0x389bce){if(_0x19b52d[_0x0e48('0x50')]['id']){delete _0x19b52d[_0x0e48('0x50')]['id'];}return db[_0x0e48('0x47')][_0x0e48('0x4e')]({'where':{'id':_0x19b52d[_0x0e48('0x4c')]['id']}})[_0x0e48('0x1b')](handleEntityNotFound(_0x389bce,null))[_0x0e48('0x1b')](saveUpdates(_0x19b52d[_0x0e48('0x50')],null))['then'](respondWithResult(_0x389bce,null))['catch'](handleError(_0x389bce,null));};exports[_0x0e48('0x2e')]=function(_0x10208c,_0x14ee16){return db[_0x0e48('0x47')][_0x0e48('0x4e')]({'where':{'id':_0x10208c[_0x0e48('0x4c')]['id']}})[_0x0e48('0x1b')](handleEntityNotFound(_0x14ee16,null))[_0x0e48('0x1b')](removeEntity(_0x14ee16,null))[_0x0e48('0x23')](handleError(_0x14ee16,null));};exports['getFields']=function(_0x41a71d,_0x45d31d,_0x307fb2){var _0x414714={};var _0x5bb21c={};var _0x2919e1;var _0xbfde11;return db['VtigerConfiguration'][_0x0e48('0x52')]({'where':{'id':_0x41a71d[_0x0e48('0x4c')]['id']}})[_0x0e48('0x1b')](handleEntityNotFound(_0x45d31d,null))[_0x0e48('0x1b')](function(_0x58fbec){if(_0x58fbec){_0x2919e1=_0x58fbec;_0x5bb21c[_0x0e48('0x3a')]=_[_0x0e48('0x36')](db[_0x0e48('0x53')][_0x0e48('0x32')]);_0x5bb21c[_0x0e48('0x35')]=_['keys'](_0x41a71d[_0x0e48('0x35')]);_0x5bb21c['filters']=_['intersection'](_0x5bb21c[_0x0e48('0x3a')],_0x5bb21c['query']);_0x414714[_0x0e48('0x39')]=_[_0x0e48('0x38')](_0x5bb21c[_0x0e48('0x3a')],qs[_0x0e48('0x3b')](_0x41a71d[_0x0e48('0x35')][_0x0e48('0x3b')]));_0x414714[_0x0e48('0x39')]=_0x414714[_0x0e48('0x39')][_0x0e48('0x3c')]?_0x414714[_0x0e48('0x39')]:_0x5bb21c[_0x0e48('0x3a')];_0x414714['order']=qs[_0x0e48('0x41')](_0x41a71d[_0x0e48('0x35')][_0x0e48('0x41')]);_0x414714[_0x0e48('0x42')]=qs[_0x0e48('0x37')](_[_0x0e48('0x43')](_0x41a71d[_0x0e48('0x35')],_0x5bb21c[_0x0e48('0x37')]));if(_0x41a71d['query'][_0x0e48('0x44')]){_0x414714[_0x0e48('0x42')]=_['merge'](_0x414714[_0x0e48('0x42')],{'$or':_['map'](_0x414714[_0x0e48('0x39')],function(_0x1cee6a){var _0x358532={};_0x358532[_0x1cee6a]={'$like':'%'+_0x41a71d['query']['filter']+'%'};return _0x358532;})});}_0x414714=_[_0x0e48('0x45')]({},_0x414714,_0x41a71d[_0x0e48('0x4d')]);return _0x2919e1['getFields'](_0x414714);}})[_0x0e48('0x1b')](function(_0x6f9351){if(_0x6f9351){_0xbfde11=_0x6f9351['length'];if(!_0x41a71d[_0x0e48('0x35')][_0x0e48('0x3d')](_0x0e48('0x3e'))){_0x414714[_0x0e48('0x3f')]=qs['limit'](_0x41a71d[_0x0e48('0x35')][_0x0e48('0x3f')]);_0x414714[_0x0e48('0x29')]=qs[_0x0e48('0x29')](_0x41a71d[_0x0e48('0x35')][_0x0e48('0x29')]);}return _0x2919e1[_0x0e48('0x54')](_0x414714);}})[_0x0e48('0x1b')](function(_0x3094b9){if(_0x3094b9){return _0x3094b9?{'count':_0xbfde11,'rows':_0x3094b9}:null;}})[_0x0e48('0x1b')](respondWithResult(_0x45d31d,null))[_0x0e48('0x23')](handleError(_0x45d31d,null));};exports[_0x0e48('0x55')]=function(_0x2a664a,_0x4bea7f,_0x25ab0a){var _0x51d12a={};var _0x3e11f8={};var _0x313a86;var _0x47cde7;return db[_0x0e48('0x47')][_0x0e48('0x52')]({'where':{'id':_0x2a664a[_0x0e48('0x4c')]['id']}})[_0x0e48('0x1b')](handleEntityNotFound(_0x4bea7f,null))[_0x0e48('0x1b')](function(_0x4f2556){if(_0x4f2556){_0x313a86=_0x4f2556;_0x3e11f8[_0x0e48('0x3a')]=_[_0x0e48('0x36')](db[_0x0e48('0x53')]['rawAttributes']);_0x3e11f8[_0x0e48('0x35')]=_['keys'](_0x2a664a[_0x0e48('0x35')]);_0x3e11f8['filters']=_[_0x0e48('0x38')](_0x3e11f8[_0x0e48('0x3a')],_0x3e11f8['query']);_0x51d12a[_0x0e48('0x39')]=_[_0x0e48('0x38')](_0x3e11f8['model'],qs[_0x0e48('0x3b')](_0x2a664a[_0x0e48('0x35')][_0x0e48('0x3b')]));_0x51d12a[_0x0e48('0x39')]=_0x51d12a['attributes']['length']?_0x51d12a['attributes']:_0x3e11f8[_0x0e48('0x3a')];_0x51d12a['order']=qs[_0x0e48('0x41')](_0x2a664a[_0x0e48('0x35')][_0x0e48('0x41')]);_0x51d12a[_0x0e48('0x42')]=qs['filters'](_[_0x0e48('0x43')](_0x2a664a['query'],_0x3e11f8['filters']));if(_0x2a664a[_0x0e48('0x35')][_0x0e48('0x44')]){_0x51d12a['where']=_[_0x0e48('0x45')](_0x51d12a[_0x0e48('0x42')],{'$or':_['map'](_0x51d12a['attributes'],function(_0x55ac42){var _0x122720={};_0x122720[_0x55ac42]={'$like':'%'+_0x2a664a[_0x0e48('0x35')]['filter']+'%'};return _0x122720;})});}_0x51d12a=_[_0x0e48('0x45')]({},_0x51d12a,_0x2a664a[_0x0e48('0x4d')]);return _0x313a86[_0x0e48('0x55')](_0x51d12a);}})[_0x0e48('0x1b')](function(_0x3fc47c){if(_0x3fc47c){_0x47cde7=_0x3fc47c[_0x0e48('0x3c')];if(!_0x2a664a['query'][_0x0e48('0x3d')](_0x0e48('0x3e'))){_0x51d12a[_0x0e48('0x3f')]=qs[_0x0e48('0x3f')](_0x2a664a[_0x0e48('0x35')][_0x0e48('0x3f')]);_0x51d12a[_0x0e48('0x29')]=qs['offset'](_0x2a664a[_0x0e48('0x35')][_0x0e48('0x29')]);}return _0x313a86[_0x0e48('0x55')](_0x51d12a);}})['then'](function(_0x34cc31){if(_0x34cc31){return _0x34cc31?{'count':_0x47cde7,'rows':_0x34cc31}:null;}})[_0x0e48('0x1b')](respondWithResult(_0x4bea7f,null))['catch'](handleError(_0x4bea7f,null));};exports['getDescriptions']=function(_0x1b0ce4,_0x58e13a,_0x412654){var _0x1c13b4={};var _0x293fc6={};var _0x5b01a8;var _0x489db6;return db['VtigerConfiguration'][_0x0e48('0x52')]({'where':{'id':_0x1b0ce4[_0x0e48('0x4c')]['id']}})[_0x0e48('0x1b')](handleEntityNotFound(_0x58e13a,null))[_0x0e48('0x1b')](function(_0x1b0c37){if(_0x1b0c37){_0x5b01a8=_0x1b0c37;_0x293fc6['model']=_[_0x0e48('0x36')](db[_0x0e48('0x53')][_0x0e48('0x32')]);_0x293fc6['query']=_[_0x0e48('0x36')](_0x1b0ce4[_0x0e48('0x35')]);_0x293fc6[_0x0e48('0x37')]=_[_0x0e48('0x38')](_0x293fc6['model'],_0x293fc6[_0x0e48('0x35')]);_0x1c13b4[_0x0e48('0x39')]=_[_0x0e48('0x38')](_0x293fc6['model'],qs[_0x0e48('0x3b')](_0x1b0ce4[_0x0e48('0x35')][_0x0e48('0x3b')]));_0x1c13b4[_0x0e48('0x39')]=_0x1c13b4['attributes'][_0x0e48('0x3c')]?_0x1c13b4['attributes']:_0x293fc6[_0x0e48('0x3a')];_0x1c13b4['order']=qs[_0x0e48('0x41')](_0x1b0ce4['query'][_0x0e48('0x41')]);_0x1c13b4[_0x0e48('0x42')]=qs[_0x0e48('0x37')](_[_0x0e48('0x43')](_0x1b0ce4[_0x0e48('0x35')],_0x293fc6[_0x0e48('0x37')]));if(_0x1b0ce4['query'][_0x0e48('0x44')]){_0x1c13b4[_0x0e48('0x42')]=_['merge'](_0x1c13b4[_0x0e48('0x42')],{'$or':_['map'](_0x1c13b4[_0x0e48('0x39')],function(_0x5f5cee){var _0x29d8fe={};_0x29d8fe[_0x5f5cee]={'$like':'%'+_0x1b0ce4[_0x0e48('0x35')][_0x0e48('0x44')]+'%'};return _0x29d8fe;})});}_0x1c13b4=_[_0x0e48('0x45')]({},_0x1c13b4,_0x1b0ce4[_0x0e48('0x4d')]);return _0x5b01a8[_0x0e48('0x56')](_0x1c13b4);}})['then'](function(_0x2b8ff0){if(_0x2b8ff0){_0x489db6=_0x2b8ff0[_0x0e48('0x3c')];if(!_0x1b0ce4[_0x0e48('0x35')][_0x0e48('0x3d')](_0x0e48('0x3e'))){_0x1c13b4[_0x0e48('0x3f')]=qs[_0x0e48('0x3f')](_0x1b0ce4[_0x0e48('0x35')][_0x0e48('0x3f')]);_0x1c13b4[_0x0e48('0x29')]=qs[_0x0e48('0x29')](_0x1b0ce4[_0x0e48('0x35')][_0x0e48('0x29')]);}return _0x5b01a8[_0x0e48('0x56')](_0x1c13b4);}})[_0x0e48('0x1b')](function(_0x1b4011){if(_0x1b4011){return _0x1b4011?{'count':_0x489db6,'rows':_0x1b4011}:null;}})['then'](respondWithResult(_0x58e13a,null))[_0x0e48('0x23')](handleError(_0x58e13a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e2ae743..2aebbd1 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 _0x00e1=['../../config/logger','api','moment','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','lodash','util'];(function(_0x61e2c3,_0x4957b6){var _0x37e9d1=function(_0x356cee){while(--_0x356cee){_0x61e2c3['push'](_0x61e2c3['shift']());}};_0x37e9d1(++_0x4957b6);}(_0x00e1,0x1b6));var _0x100e=function(_0xe51106,_0x484690){_0xe51106=_0xe51106-0x0;var _0x425894=_0x00e1[_0xe51106];return _0x425894;};'use strict';var _=require(_0x100e('0x0'));var util=require(_0x100e('0x1'));var logger=require(_0x100e('0x2'))(_0x100e('0x3'));var moment=require(_0x100e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x100e('0x5'));var rimraf=require(_0x100e('0x6'));var config=require(_0x100e('0x7'));var attributes=require(_0x100e('0x8'));module[_0x100e('0x9')]=function(_0x77610c,_0x2a99ee){return _0x77610c['define'](_0x100e('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2622=['define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x4baea5,_0x10fc2b){var _0x57b25b=function(_0x5cb144){while(--_0x5cb144){_0x4baea5['push'](_0x4baea5['shift']());}};_0x57b25b(++_0x10fc2b);}(_0x2622,0x114));var _0x2262=function(_0x7bd905,_0x2b6115){_0x7bd905=_0x7bd905-0x0;var _0x728f45=_0x2622[_0x7bd905];return _0x728f45;};'use strict';var _=require('lodash');var util=require(_0x2262('0x0'));var logger=require(_0x2262('0x1'))('api');var moment=require(_0x2262('0x2'));var BPromise=require(_0x2262('0x3'));var rp=require(_0x2262('0x4'));var fs=require('fs');var path=require(_0x2262('0x5'));var rimraf=require(_0x2262('0x6'));var config=require(_0x2262('0x7'));var attributes=require(_0x2262('0x8'));module[_0x2262('0x9')]=function(_0x187d88,_0x77a98d){return _0x187d88[_0x2262('0xa')](_0x2262('0xb'),attributes,{'tableName':_0x2262('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 195db05..c24127d 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 _0x85b4=['error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','VtigerConfiguration,\x20%s,\x20%s','debug','stringify'];(function(_0xcd9ece,_0x33ff67){var _0x36f54f=function(_0x54ec76){while(--_0x54ec76){_0xcd9ece['push'](_0xcd9ece['shift']());}};_0x36f54f(++_0x33ff67);}(_0x85b4,0x1d3));var _0x485b=function(_0x147686,_0x292c6a){_0x147686=_0x147686-0x0;var _0x4db1b8=_0x85b4[_0x147686];return _0x4db1b8;};'use strict';var _=require(_0x485b('0x0'));var util=require(_0x485b('0x1'));var moment=require(_0x485b('0x2'));var BPromise=require(_0x485b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x485b('0x4'));var db=require(_0x485b('0x5'))['db'];var utils=require(_0x485b('0x6'));var logger=require('../../config/logger')(_0x485b('0x7'));var config=require(_0x485b('0x8'));var jayson=require(_0x485b('0x9'));var client=jayson['client'][_0x485b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28f06f,_0x5919dc,_0x33fbf3){return new BPromise(function(_0x90f0b1,_0x572b19){return client[_0x485b('0xb')](_0x28f06f,_0x33fbf3)[_0x485b('0xc')](function(_0x659552){logger['info'](_0x485b('0xd'),_0x5919dc,'request\x20sent');logger[_0x485b('0xe')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x5919dc,'request\x20sent',JSON[_0x485b('0xf')](_0x659552));if(_0x659552[_0x485b('0x10')]){if(_0x659552[_0x485b('0x10')][_0x485b('0x11')]===0x1f4){logger['error'](_0x485b('0xd'),_0x5919dc,_0x659552['error'][_0x485b('0x12')]);return _0x572b19(_0x659552[_0x485b('0x10')][_0x485b('0x12')]);}logger[_0x485b('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x5919dc,_0x659552[_0x485b('0x10')]['message']);return _0x90f0b1(_0x659552['error'][_0x485b('0x12')]);}else{logger[_0x485b('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x5919dc,_0x485b('0x14'));_0x90f0b1(_0x659552[_0x485b('0x15')][_0x485b('0x12')]);}})[_0x485b('0x16')](function(_0x4dd5af){logger[_0x485b('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x5919dc,_0x4dd5af);_0x572b19(_0x4dd5af);});});} \ No newline at end of file +var _0xde31=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis'];(function(_0x4439dc,_0x1611d1){var _0xe2d8ce=function(_0x1b1156){while(--_0x1b1156){_0x4439dc['push'](_0x4439dc['shift']());}};_0xe2d8ce(++_0x1611d1);}(_0xde31,0x1e0));var _0x1de3=function(_0x12877b,_0x8650cf){_0x12877b=_0x12877b-0x0;var _0x3549ff=_0xde31[_0x12877b];return _0x3549ff;};'use strict';var _=require('lodash');var util=require(_0x1de3('0x0'));var moment=require(_0x1de3('0x1'));var BPromise=require('bluebird');var rs=require(_0x1de3('0x2'));var fs=require('fs');var Redis=require(_0x1de3('0x3'));var db=require(_0x1de3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1de3('0x5'))(_0x1de3('0x6'));var config=require(_0x1de3('0x7'));var jayson=require(_0x1de3('0x8'));var client=jayson[_0x1de3('0x9')][_0x1de3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x97fc86,_0x108d25,_0x2a5b80){return new BPromise(function(_0x2f357e,_0x98a58e){return client[_0x1de3('0xb')](_0x97fc86,_0x2a5b80)[_0x1de3('0xc')](function(_0x21511d){logger[_0x1de3('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x108d25,_0x1de3('0xe'));logger['debug'](_0x1de3('0xf'),_0x108d25,_0x1de3('0xe'),JSON[_0x1de3('0x10')](_0x21511d));if(_0x21511d[_0x1de3('0x11')]){if(_0x21511d[_0x1de3('0x11')][_0x1de3('0x12')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x108d25,_0x21511d[_0x1de3('0x11')]['message']);return _0x98a58e(_0x21511d[_0x1de3('0x11')][_0x1de3('0x13')]);}logger[_0x1de3('0x11')](_0x1de3('0x14'),_0x108d25,_0x21511d[_0x1de3('0x11')][_0x1de3('0x13')]);return _0x2f357e(_0x21511d[_0x1de3('0x11')][_0x1de3('0x13')]);}else{logger['info'](_0x1de3('0x14'),_0x108d25,'request\x20sent');_0x2f357e(_0x21511d['result'][_0x1de3('0x13')]);}})[_0x1de3('0x15')](function(_0x2ce9fe){logger[_0x1de3('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x108d25,_0x2ce9fe);_0x98a58e(_0x2ce9fe);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 1dc4b60..477bbc9 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 _0x981c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x33dfac,_0x21bc6e){var _0x3371ae=function(_0x1ab7a4){while(--_0x1ab7a4){_0x33dfac['push'](_0x33dfac['shift']());}};_0x3371ae(++_0x21bc6e);}(_0x981c,0x1bf));var _0xc981=function(_0x5891b5,_0x139750){_0x5891b5=_0x5891b5-0x0;var _0x514779=_0x981c[_0x5891b5];return _0x514779;};'use strict';var multer=require(_0xc981('0x0'));var util=require(_0xc981('0x1'));var path=require(_0xc981('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc981('0x3')]();var auth=require(_0xc981('0x4'));var interaction=require(_0xc981('0x5'));var config=require(_0xc981('0x6'));var controller=require('./intVtigerField.controller');router[_0xc981('0x7')]('/',auth[_0xc981('0x8')](),controller['index']);router[_0xc981('0x7')](_0xc981('0x9'),auth[_0xc981('0x8')](),controller[_0xc981('0xa')]);router[_0xc981('0xb')]('/',auth[_0xc981('0x8')](),controller[_0xc981('0xc')]);router[_0xc981('0xd')](_0xc981('0x9'),auth[_0xc981('0x8')](),controller[_0xc981('0xe')]);router[_0xc981('0xf')](_0xc981('0x9'),auth[_0xc981('0x8')](),controller[_0xc981('0x10')]);module[_0xc981('0x11')]=router; \ No newline at end of file +var _0x83b2=['create','put','delete','destroy','exports','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','get','/:id','show','post'];(function(_0x768bbb,_0x5592c4){var _0x5d05c6=function(_0x13f629){while(--_0x13f629){_0x768bbb['push'](_0x768bbb['shift']());}};_0x5d05c6(++_0x5592c4);}(_0x83b2,0xb9));var _0x283b=function(_0x54a7ec,_0x14367b){_0x54a7ec=_0x54a7ec-0x0;var _0x55718a=_0x83b2[_0x54a7ec];return _0x55718a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x283b('0x0'));var express=require('express');var router=express['Router']();var auth=require(_0x283b('0x1'));var interaction=require(_0x283b('0x2'));var config=require(_0x283b('0x3'));var controller=require(_0x283b('0x4'));router['get']('/',auth[_0x283b('0x5')](),controller['index']);router[_0x283b('0x6')](_0x283b('0x7'),auth[_0x283b('0x5')](),controller[_0x283b('0x8')]);router[_0x283b('0x9')]('/',auth[_0x283b('0x5')](),controller[_0x283b('0xa')]);router[_0x283b('0xb')]('/:id',auth[_0x283b('0x5')](),controller['update']);router[_0x283b('0xc')](_0x283b('0x7'),auth['isAuthenticated'](),controller[_0x283b('0xd')]);module[_0x283b('0xe')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index bdb50cc..0b187a3 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 _0x1294=['STRING','BOOLEAN','sequelize','ENUM','variable','customVariable','string'];(function(_0x4090da,_0x117652){var _0x591411=function(_0x48fe85){while(--_0x48fe85){_0x4090da['push'](_0x4090da['shift']());}};_0x591411(++_0x117652);}(_0x1294,0xb8));var _0x4129=function(_0x52c1e1,_0x5d4e83){_0x52c1e1=_0x52c1e1-0x0;var _0x25d937=_0x1294[_0x52c1e1];return _0x25d937;};'use strict';var Sequelize=require(_0x4129('0x0'));module['exports']={'type':{'type':Sequelize[_0x4129('0x1')]('string',_0x4129('0x2'),_0x4129('0x3'),'keyValue'),'defaultValue':_0x4129('0x4')},'content':{'type':Sequelize[_0x4129('0x5')]},'key':{'type':Sequelize[_0x4129('0x5')]},'keyType':{'type':Sequelize[_0x4129('0x1')](_0x4129('0x4'),_0x4129('0x2'),_0x4129('0x3'))},'keyContent':{'type':Sequelize[_0x4129('0x5')]},'idField':{'type':Sequelize[_0x4129('0x5')]},'nameField':{'type':Sequelize[_0x4129('0x5')]},'customField':{'type':Sequelize[_0x4129('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4129('0x5')]}}; \ No newline at end of file +var _0xf181=['sequelize','exports','ENUM','customVariable','keyValue','string','STRING','variable','BOOLEAN'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0xf181,0x6c));var _0x1f18=function(_0x41dd6b,_0x5ae4ba){_0x41dd6b=_0x41dd6b-0x0;var _0x156c5a=_0xf181[_0x41dd6b];return _0x156c5a;};'use strict';var Sequelize=require(_0x1f18('0x0'));module[_0x1f18('0x1')]={'type':{'type':Sequelize[_0x1f18('0x2')]('string','variable',_0x1f18('0x3'),_0x1f18('0x4')),'defaultValue':_0x1f18('0x5')},'content':{'type':Sequelize[_0x1f18('0x6')]},'key':{'type':Sequelize[_0x1f18('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x1f18('0x5'),_0x1f18('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x1f18('0x6')]},'idField':{'type':Sequelize[_0x1f18('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1f18('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1f18('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 06adae6..432892a 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 _0x6ec2=['../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','reject','save','update','destroy','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','VtigerField','includeAll','include','findAll','then','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5a6f0d,_0x28bfa5){var _0x13d5f0=function(_0x2873d7){while(--_0x2873d7){_0x5a6f0d['push'](_0x5a6f0d['shift']());}};_0x13d5f0(++_0x28bfa5);}(_0x6ec2,0x78));var _0x26ec=function(_0x9d25ce,_0x494215){_0x9d25ce=_0x9d25ce-0x0;var _0xa58a3=_0x6ec2[_0x9d25ce];return _0xa58a3;};'use strict';var pdf=require(_0x26ec('0x0'));var emlformat=require(_0x26ec('0x1'));var rimraf=require(_0x26ec('0x2'));var zipdir=require(_0x26ec('0x3'));var jsonpatch=require(_0x26ec('0x4'));var rp=require(_0x26ec('0x5'));var moment=require('moment');var BPromise=require(_0x26ec('0x6'));var Mustache=require(_0x26ec('0x7'));var util=require(_0x26ec('0x8'));var path=require(_0x26ec('0x9'));var sox=require(_0x26ec('0xa'));var csv=require('to-csv');var ejs=require(_0x26ec('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x26ec('0xc'));var jsforce=require(_0x26ec('0xd'));var deskjs=require(_0x26ec('0xe'));var toCsv=require('to-csv');var querystring=require(_0x26ec('0xf'));var Papa=require('papaparse');var Redis=require(_0x26ec('0x10'));var authService=require(_0x26ec('0x11'));var qs=require(_0x26ec('0x12'));var as=require(_0x26ec('0x13'));var hardwareService=require(_0x26ec('0x14'));var logger=require(_0x26ec('0x15'))(_0x26ec('0x16'));var utils=require(_0x26ec('0x17'));var config=require(_0x26ec('0x18'));var licenseUtil=require(_0x26ec('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5212e4,_0x2d869a){_0x2d869a=_0x2d869a||0xcc;return function(_0x1bec27){if(_0x1bec27){return _0x5212e4[_0x26ec('0x1a')](_0x2d869a);}return _0x5212e4[_0x26ec('0x1b')](_0x2d869a)[_0x26ec('0x1c')]();};}function respondWithResult(_0xff29e5,_0x30cbd3){_0x30cbd3=_0x30cbd3||0xc8;return function(_0x49467a){if(_0x49467a){return _0xff29e5[_0x26ec('0x1b')](_0x30cbd3)[_0x26ec('0x1d')](_0x49467a);}};}function respondWithFilteredResult(_0x302bde,_0x7f9bb2){return function(_0x4f9950){if(_0x4f9950){var _0x4d366c=_0x4f9950[_0x26ec('0x1e')],_0x438985=_0x7f9bb2['offset'],_0x127385=_0x7f9bb2[_0x26ec('0x1f')]+_0x7f9bb2[_0x26ec('0x20')],_0x4bdced;if(_0x127385>=_0x4d366c){_0x127385=_0x4d366c;_0x4bdced=0xc8;}else{_0x4bdced=0xce;}_0x302bde['status'](_0x4bdced);return _0x302bde['set']('Content-Range',_0x438985+'-'+_0x127385+'/'+_0x4d366c)[_0x26ec('0x1d')](_0x4f9950);}return null;};}function patchUpdates(_0x38516d){return function(_0x60511e){try{jsonpatch['apply'](_0x60511e,_0x38516d,!![]);}catch(_0x4ad50c){return BPromise[_0x26ec('0x21')](_0x4ad50c);}return _0x60511e[_0x26ec('0x22')]();};}function saveUpdates(_0x33a28b,_0x2f4d14){return function(_0x1353db){if(_0x1353db){return _0x1353db[_0x26ec('0x23')](_0x33a28b)['then'](function(_0x14080d){return _0x14080d;});}return null;};}function removeEntity(_0x29c34a,_0x2a9e82){return function(_0x46f766){if(_0x46f766){return _0x46f766[_0x26ec('0x24')]()['then'](function(){_0x29c34a['status'](0xcc)[_0x26ec('0x1c')]();});}};}function handleEntityNotFound(_0x16154d,_0x65aea3){return function(_0x50e4e8){if(!_0x50e4e8){_0x16154d['sendStatus'](0x194);}return _0x50e4e8;};}function handleError(_0x19cadf,_0xaf6c39){_0xaf6c39=_0xaf6c39||0x1f4;return function(_0x16aba4){logger[_0x26ec('0x25')](_0x16aba4[_0x26ec('0x26')]);if(_0x16aba4[_0x26ec('0x27')]){delete _0x16aba4[_0x26ec('0x27')];}_0x19cadf['status'](_0xaf6c39)['send'](_0x16aba4);};}exports['index']=function(_0x45509f,_0xddd5fc){var _0x352bef={},_0x3fd842={},_0x19e0fc={'count':0x0,'rows':[]};var _0x2fb176=_[_0x26ec('0x28')](db['VtigerField'][_0x26ec('0x29')],function(_0x5d10ba){return{'name':_0x5d10ba[_0x26ec('0x2a')],'type':_0x5d10ba[_0x26ec('0x2b')]['key']};});_0x3fd842[_0x26ec('0x2c')]=_[_0x26ec('0x28')](_0x2fb176,_0x26ec('0x27'));_0x3fd842[_0x26ec('0x2d')]=_[_0x26ec('0x2e')](_0x45509f[_0x26ec('0x2d')]);_0x3fd842['filters']=_[_0x26ec('0x2f')](_0x3fd842['model'],_0x3fd842[_0x26ec('0x2d')]);_0x352bef['attributes']=_[_0x26ec('0x2f')](_0x3fd842[_0x26ec('0x2c')],qs['fields'](_0x45509f[_0x26ec('0x2d')][_0x26ec('0x30')]));_0x352bef[_0x26ec('0x31')]=_0x352bef[_0x26ec('0x31')][_0x26ec('0x32')]?_0x352bef[_0x26ec('0x31')]:_0x3fd842['model'];if(!_0x45509f['query']['hasOwnProperty']('nolimit')){_0x352bef['limit']=qs[_0x26ec('0x20')](_0x45509f[_0x26ec('0x2d')][_0x26ec('0x20')]);_0x352bef[_0x26ec('0x1f')]=qs[_0x26ec('0x1f')](_0x45509f['query'][_0x26ec('0x1f')]);}_0x352bef[_0x26ec('0x33')]=qs[_0x26ec('0x34')](_0x45509f[_0x26ec('0x2d')][_0x26ec('0x34')]);_0x352bef['where']=qs[_0x26ec('0x35')](_[_0x26ec('0x36')](_0x45509f[_0x26ec('0x2d')],_0x3fd842[_0x26ec('0x35')]),_0x2fb176);if(_0x45509f[_0x26ec('0x2d')][_0x26ec('0x37')]){_0x352bef[_0x26ec('0x38')]=_[_0x26ec('0x39')](_0x352bef[_0x26ec('0x38')],{'$or':_[_0x26ec('0x28')](_0x2fb176,function(_0x48d7cf){if(_0x48d7cf['type']!==_0x26ec('0x3a')){var _0xbabf16={};_0xbabf16[_0x48d7cf['name']]={'$like':'%'+_0x45509f[_0x26ec('0x2d')]['filter']+'%'};return _0xbabf16;}})});}_0x352bef=_[_0x26ec('0x39')]({},_0x352bef,_0x45509f[_0x26ec('0x3b')]);var _0x11fc8c={'where':_0x352bef[_0x26ec('0x38')]};return db[_0x26ec('0x3c')][_0x26ec('0x1e')](_0x11fc8c)['then'](function(_0x2a5e2d){_0x19e0fc[_0x26ec('0x1e')]=_0x2a5e2d;if(_0x45509f[_0x26ec('0x2d')][_0x26ec('0x3d')]){_0x352bef[_0x26ec('0x3e')]=[{'all':!![]}];}return db[_0x26ec('0x3c')][_0x26ec('0x3f')](_0x352bef);})[_0x26ec('0x40')](function(_0x60c74c){_0x19e0fc[_0x26ec('0x41')]=_0x60c74c;return _0x19e0fc;})[_0x26ec('0x40')](respondWithFilteredResult(_0xddd5fc,_0x352bef))[_0x26ec('0x42')](handleError(_0xddd5fc,null));};exports[_0x26ec('0x43')]=function(_0x27704e,_0x20a6dd){var _0x568df7={'raw':!![],'where':{'id':_0x27704e[_0x26ec('0x44')]['id']}},_0x101046={};_0x101046[_0x26ec('0x2c')]=_[_0x26ec('0x2e')](db[_0x26ec('0x3c')][_0x26ec('0x29')]);_0x101046['query']=_['keys'](_0x27704e[_0x26ec('0x2d')]);_0x101046['filters']=_[_0x26ec('0x2f')](_0x101046[_0x26ec('0x2c')],_0x101046[_0x26ec('0x2d')]);_0x568df7[_0x26ec('0x31')]=_[_0x26ec('0x2f')](_0x101046[_0x26ec('0x2c')],qs[_0x26ec('0x30')](_0x27704e[_0x26ec('0x2d')]['fields']));_0x568df7[_0x26ec('0x31')]=_0x568df7[_0x26ec('0x31')][_0x26ec('0x32')]?_0x568df7['attributes']:_0x101046[_0x26ec('0x2c')];if(_0x27704e[_0x26ec('0x2d')][_0x26ec('0x3d')]){_0x568df7[_0x26ec('0x3e')]=[{'all':!![]}];}_0x568df7=_[_0x26ec('0x39')]({},_0x568df7,_0x27704e[_0x26ec('0x3b')]);return db[_0x26ec('0x3c')][_0x26ec('0x45')](_0x568df7)[_0x26ec('0x40')](handleEntityNotFound(_0x20a6dd,null))[_0x26ec('0x40')](respondWithResult(_0x20a6dd,null))[_0x26ec('0x42')](handleError(_0x20a6dd,null));};exports[_0x26ec('0x46')]=function(_0x2950bd,_0x155c8b){return db['VtigerField']['create'](_0x2950bd[_0x26ec('0x47')],{})['then'](respondWithResult(_0x155c8b,0xc9))['catch'](handleError(_0x155c8b,null));};exports[_0x26ec('0x23')]=function(_0xc9eda3,_0xcd057a){if(_0xc9eda3['body']['id']){delete _0xc9eda3['body']['id'];}return db['VtigerField']['find']({'where':{'id':_0xc9eda3[_0x26ec('0x44')]['id']}})['then'](handleEntityNotFound(_0xcd057a,null))[_0x26ec('0x40')](saveUpdates(_0xc9eda3[_0x26ec('0x47')],null))['then'](respondWithResult(_0xcd057a,null))['catch'](handleError(_0xcd057a,null));};exports[_0x26ec('0x24')]=function(_0x2d5866,_0x4f7931){return db[_0x26ec('0x3c')][_0x26ec('0x45')]({'where':{'id':_0x2d5866['params']['id']}})['then'](handleEntityNotFound(_0x4f7931,null))[_0x26ec('0x40')](removeEntity(_0x4f7931,null))[_0x26ec('0x42')](handleError(_0x4f7931,null));}; \ No newline at end of file +var _0x6363=['params','length','include','create','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','merge','includeAll','findAll','rows','catch','show'];(function(_0x5587c9,_0x292e72){var _0x50c5ab=function(_0x27e678){while(--_0x27e678){_0x5587c9['push'](_0x5587c9['shift']());}};_0x50c5ab(++_0x292e72);}(_0x6363,0x13a));var _0x3636=function(_0xbe11f8,_0x3dd74f){_0xbe11f8=_0xbe11f8-0x0;var _0x547af3=_0x6363[_0xbe11f8];return _0x547af3;};'use strict';var pdf=require(_0x3636('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3636('0x1'));var zipdir=require(_0x3636('0x2'));var jsonpatch=require(_0x3636('0x3'));var rp=require(_0x3636('0x4'));var moment=require(_0x3636('0x5'));var BPromise=require(_0x3636('0x6'));var Mustache=require(_0x3636('0x7'));var util=require(_0x3636('0x8'));var path=require(_0x3636('0x9'));var sox=require(_0x3636('0xa'));var csv=require(_0x3636('0xb'));var ejs=require(_0x3636('0xc'));var fs=require('fs');var _=require(_0x3636('0xd'));var squel=require(_0x3636('0xe'));var crypto=require('crypto');var jsforce=require(_0x3636('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3636('0xb'));var querystring=require(_0x3636('0x10'));var Papa=require(_0x3636('0x11'));var Redis=require(_0x3636('0x12'));var authService=require(_0x3636('0x13'));var qs=require(_0x3636('0x14'));var as=require(_0x3636('0x15'));var hardwareService=require(_0x3636('0x16'));var logger=require(_0x3636('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x3636('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3636('0x19'))['db'];function respondWithStatusCode(_0x41ddae,_0x62d6f9){_0x62d6f9=_0x62d6f9||0xcc;return function(_0x13ca35){if(_0x13ca35){return _0x41ddae[_0x3636('0x1a')](_0x62d6f9);}return _0x41ddae[_0x3636('0x1b')](_0x62d6f9)[_0x3636('0x1c')]();};}function respondWithResult(_0x12dfa9,_0x3295ab){_0x3295ab=_0x3295ab||0xc8;return function(_0x7b4b16){if(_0x7b4b16){return _0x12dfa9[_0x3636('0x1b')](_0x3295ab)[_0x3636('0x1d')](_0x7b4b16);}};}function respondWithFilteredResult(_0xcb2aa3,_0x3fc712){return function(_0x23cc34){if(_0x23cc34){var _0x3cbd0d=_0x23cc34[_0x3636('0x1e')],_0x2dbd4d=_0x3fc712['offset'],_0x50474f=_0x3fc712[_0x3636('0x1f')]+_0x3fc712['limit'],_0x11b53e;if(_0x50474f>=_0x3cbd0d){_0x50474f=_0x3cbd0d;_0x11b53e=0xc8;}else{_0x11b53e=0xce;}_0xcb2aa3['status'](_0x11b53e);return _0xcb2aa3[_0x3636('0x20')](_0x3636('0x21'),_0x2dbd4d+'-'+_0x50474f+'/'+_0x3cbd0d)[_0x3636('0x1d')](_0x23cc34);}return null;};}function patchUpdates(_0xc1c96d){return function(_0xe0e633){try{jsonpatch[_0x3636('0x22')](_0xe0e633,_0xc1c96d,!![]);}catch(_0xa2b8fe){return BPromise[_0x3636('0x23')](_0xa2b8fe);}return _0xe0e633['save']();};}function saveUpdates(_0x48f598,_0x316930){return function(_0x34a975){if(_0x34a975){return _0x34a975[_0x3636('0x24')](_0x48f598)['then'](function(_0x1734cd){return _0x1734cd;});}return null;};}function removeEntity(_0xa46471,_0x15a0b3){return function(_0xe34cd9){if(_0xe34cd9){return _0xe34cd9[_0x3636('0x25')]()[_0x3636('0x26')](function(){_0xa46471['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x368356,_0x4ee098){return function(_0x50ba2f){if(!_0x50ba2f){_0x368356[_0x3636('0x1a')](0x194);}return _0x50ba2f;};}function handleError(_0x57f7c6,_0x4182b7){_0x4182b7=_0x4182b7||0x1f4;return function(_0x4c24cf){logger[_0x3636('0x27')](_0x4c24cf[_0x3636('0x28')]);if(_0x4c24cf[_0x3636('0x29')]){delete _0x4c24cf[_0x3636('0x29')];}_0x57f7c6[_0x3636('0x1b')](_0x4182b7)[_0x3636('0x2a')](_0x4c24cf);};}exports[_0x3636('0x2b')]=function(_0x3c3d45,_0x37ad2d){var _0x701651={},_0x22574e={},_0x550443={'count':0x0,'rows':[]};var _0x43811e=_[_0x3636('0x2c')](db[_0x3636('0x2d')][_0x3636('0x2e')],function(_0xd37c62){return{'name':_0xd37c62[_0x3636('0x2f')],'type':_0xd37c62['type'][_0x3636('0x30')]};});_0x22574e[_0x3636('0x31')]=_['map'](_0x43811e,_0x3636('0x29'));_0x22574e[_0x3636('0x32')]=_[_0x3636('0x33')](_0x3c3d45[_0x3636('0x32')]);_0x22574e[_0x3636('0x34')]=_['intersection'](_0x22574e[_0x3636('0x31')],_0x22574e[_0x3636('0x32')]);_0x701651[_0x3636('0x35')]=_[_0x3636('0x36')](_0x22574e[_0x3636('0x31')],qs[_0x3636('0x37')](_0x3c3d45[_0x3636('0x32')][_0x3636('0x37')]));_0x701651[_0x3636('0x35')]=_0x701651['attributes']['length']?_0x701651[_0x3636('0x35')]:_0x22574e['model'];if(!_0x3c3d45['query'][_0x3636('0x38')](_0x3636('0x39'))){_0x701651[_0x3636('0x3a')]=qs['limit'](_0x3c3d45[_0x3636('0x32')][_0x3636('0x3a')]);_0x701651[_0x3636('0x1f')]=qs[_0x3636('0x1f')](_0x3c3d45[_0x3636('0x32')][_0x3636('0x1f')]);}_0x701651[_0x3636('0x3b')]=qs[_0x3636('0x3c')](_0x3c3d45[_0x3636('0x32')][_0x3636('0x3c')]);_0x701651[_0x3636('0x3d')]=qs[_0x3636('0x34')](_[_0x3636('0x3e')](_0x3c3d45['query'],_0x22574e[_0x3636('0x34')]),_0x43811e);if(_0x3c3d45[_0x3636('0x32')][_0x3636('0x3f')]){_0x701651[_0x3636('0x3d')]=_['merge'](_0x701651['where'],{'$or':_[_0x3636('0x2c')](_0x43811e,function(_0x3807ad){if(_0x3807ad[_0x3636('0x40')]!=='VIRTUAL'){var _0x227e4d={};_0x227e4d[_0x3807ad[_0x3636('0x29')]]={'$like':'%'+_0x3c3d45['query']['filter']+'%'};return _0x227e4d;}})});}_0x701651=_[_0x3636('0x41')]({},_0x701651,_0x3c3d45['options']);var _0x8c04cf={'where':_0x701651[_0x3636('0x3d')]};return db[_0x3636('0x2d')][_0x3636('0x1e')](_0x8c04cf)[_0x3636('0x26')](function(_0x1ff266){_0x550443[_0x3636('0x1e')]=_0x1ff266;if(_0x3c3d45[_0x3636('0x32')][_0x3636('0x42')]){_0x701651['include']=[{'all':!![]}];}return db[_0x3636('0x2d')][_0x3636('0x43')](_0x701651);})[_0x3636('0x26')](function(_0x9aa815){_0x550443[_0x3636('0x44')]=_0x9aa815;return _0x550443;})[_0x3636('0x26')](respondWithFilteredResult(_0x37ad2d,_0x701651))[_0x3636('0x45')](handleError(_0x37ad2d,null));};exports[_0x3636('0x46')]=function(_0x292aee,_0x4df331){var _0x2c594e={'raw':!![],'where':{'id':_0x292aee[_0x3636('0x47')]['id']}},_0x2d2d88={};_0x2d2d88[_0x3636('0x31')]=_[_0x3636('0x33')](db[_0x3636('0x2d')][_0x3636('0x2e')]);_0x2d2d88[_0x3636('0x32')]=_[_0x3636('0x33')](_0x292aee[_0x3636('0x32')]);_0x2d2d88[_0x3636('0x34')]=_[_0x3636('0x36')](_0x2d2d88[_0x3636('0x31')],_0x2d2d88[_0x3636('0x32')]);_0x2c594e[_0x3636('0x35')]=_['intersection'](_0x2d2d88[_0x3636('0x31')],qs[_0x3636('0x37')](_0x292aee[_0x3636('0x32')][_0x3636('0x37')]));_0x2c594e[_0x3636('0x35')]=_0x2c594e[_0x3636('0x35')][_0x3636('0x48')]?_0x2c594e[_0x3636('0x35')]:_0x2d2d88[_0x3636('0x31')];if(_0x292aee[_0x3636('0x32')][_0x3636('0x42')]){_0x2c594e[_0x3636('0x49')]=[{'all':!![]}];}_0x2c594e=_[_0x3636('0x41')]({},_0x2c594e,_0x292aee['options']);return db['VtigerField']['find'](_0x2c594e)[_0x3636('0x26')](handleEntityNotFound(_0x4df331,null))['then'](respondWithResult(_0x4df331,null))['catch'](handleError(_0x4df331,null));};exports[_0x3636('0x4a')]=function(_0xb39a2a,_0x253c4a){return db['VtigerField'][_0x3636('0x4a')](_0xb39a2a[_0x3636('0x4b')],{})[_0x3636('0x26')](respondWithResult(_0x253c4a,0xc9))[_0x3636('0x45')](handleError(_0x253c4a,null));};exports[_0x3636('0x24')]=function(_0x329c8d,_0x1347c2){if(_0x329c8d[_0x3636('0x4b')]['id']){delete _0x329c8d[_0x3636('0x4b')]['id'];}return db['VtigerField'][_0x3636('0x4c')]({'where':{'id':_0x329c8d[_0x3636('0x47')]['id']}})[_0x3636('0x26')](handleEntityNotFound(_0x1347c2,null))[_0x3636('0x26')](saveUpdates(_0x329c8d[_0x3636('0x4b')],null))[_0x3636('0x26')](respondWithResult(_0x1347c2,null))['catch'](handleError(_0x1347c2,null));};exports[_0x3636('0x25')]=function(_0xf79c81,_0x2c8543){return db[_0x3636('0x2d')][_0x3636('0x4c')]({'where':{'id':_0xf79c81['params']['id']}})[_0x3636('0x26')](handleEntityNotFound(_0x2c8543,null))[_0x3636('0x26')](removeEntity(_0x2c8543,null))[_0x3636('0x45')](handleError(_0x2c8543,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 00598b6..adf50ec 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 _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'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(_0x12ef1a,_0x1af841){var _0x40dcfd=function(_0x59273b){while(--_0x59273b){_0x12ef1a['push'](_0x12ef1a['shift']());}};_0x40dcfd(++_0x1af841);}(_0x7a54,0x106));var _0x47a5=function(_0x40052a,_0x4557a2){_0x40052a=_0x40052a-0x0;var _0x4f29f9=_0x7a54[_0x40052a];return _0x4f29f9;};'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 85aee90..aba7f86 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 _0x38d0=['debug','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0x29517e,_0x47fdef){var _0x818e0b=function(_0x4050b6){while(--_0x4050b6){_0x29517e['push'](_0x29517e['shift']());}};_0x818e0b(++_0x47fdef);}(_0x38d0,0x123));var _0x038d=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x38d0[_0x45d55e];return _0x29812a;};'use strict';var _=require('lodash');var util=require(_0x038d('0x0'));var moment=require(_0x038d('0x1'));var BPromise=require(_0x038d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x038d('0x3'));var db=require(_0x038d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x038d('0x5'));var config=require('../../config/environment');var jayson=require(_0x038d('0x6'));var client=jayson[_0x038d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10dca5,_0x18b35a,_0x434026){return new BPromise(function(_0x76bc10,_0x22d8ab){return client[_0x038d('0x8')](_0x10dca5,_0x434026)[_0x038d('0x9')](function(_0x353806){logger[_0x038d('0xa')](_0x038d('0xb'),_0x18b35a,_0x038d('0xc'));logger[_0x038d('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x18b35a,_0x038d('0xc'),JSON[_0x038d('0xe')](_0x353806));if(_0x353806[_0x038d('0xf')]){if(_0x353806['error'][_0x038d('0x10')]===0x1f4){logger[_0x038d('0xf')](_0x038d('0xb'),_0x18b35a,_0x353806[_0x038d('0xf')][_0x038d('0x11')]);return _0x22d8ab(_0x353806[_0x038d('0xf')][_0x038d('0x11')]);}logger[_0x038d('0xf')](_0x038d('0xb'),_0x18b35a,_0x353806['error']['message']);return _0x76bc10(_0x353806['error'][_0x038d('0x11')]);}else{logger[_0x038d('0xa')]('VtigerField,\x20%s,\x20%s',_0x18b35a,'request\x20sent');_0x76bc10(_0x353806['result']['message']);}})[_0x038d('0x12')](function(_0x748d51){logger[_0x038d('0xf')](_0x038d('0xb'),_0x18b35a,_0x748d51);_0x22d8ab(_0x748d51);});});} \ No newline at end of file +var _0xd05a=['info','result','catch','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd05a,0x143));var _0xad05=function(_0x309e4c,_0xe50b68){_0x309e4c=_0x309e4c-0x0;var _0x18e3ae=_0xd05a[_0x309e4c];return _0x18e3ae;};'use strict';var _=require('lodash');var util=require(_0xad05('0x0'));var moment=require(_0xad05('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad05('0x2'));var logger=require(_0xad05('0x3'))(_0xad05('0x4'));var config=require(_0xad05('0x5'));var jayson=require(_0xad05('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39ddaf,_0x45303c,_0xd12d76){return new BPromise(function(_0x565f85,_0x17ec26){return client[_0xad05('0x7')](_0x39ddaf,_0xd12d76)[_0xad05('0x8')](function(_0x573acb){logger['info'](_0xad05('0x9'),_0x45303c,'request\x20sent');logger[_0xad05('0xa')](_0xad05('0xb'),_0x45303c,_0xad05('0xc'),JSON[_0xad05('0xd')](_0x573acb));if(_0x573acb[_0xad05('0xe')]){if(_0x573acb[_0xad05('0xe')][_0xad05('0xf')]===0x1f4){logger[_0xad05('0xe')](_0xad05('0x9'),_0x45303c,_0x573acb[_0xad05('0xe')]['message']);return _0x17ec26(_0x573acb[_0xad05('0xe')]['message']);}logger[_0xad05('0xe')]('VtigerField,\x20%s,\x20%s',_0x45303c,_0x573acb[_0xad05('0xe')][_0xad05('0x10')]);return _0x565f85(_0x573acb[_0xad05('0xe')]['message']);}else{logger[_0xad05('0x11')]('VtigerField,\x20%s,\x20%s',_0x45303c,_0xad05('0xc'));_0x565f85(_0x573acb[_0xad05('0x12')][_0xad05('0x10')]);}})[_0xad05('0x13')](function(_0x43ab03){logger[_0xad05('0xe')]('VtigerField,\x20%s,\x20%s',_0x45303c,_0x43ab03);_0x17ec26(_0x43ab03);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 0c085ef..704161b 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 _0x7533=['index','/:id','show','getConfigurations','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x290f52,_0x2d8307){var _0x323c8e=function(_0x242b9c){while(--_0x242b9c){_0x290f52['push'](_0x290f52['shift']());}};_0x323c8e(++_0x2d8307);}(_0x7533,0x7e));var _0x3753=function(_0x516ac7,_0xd96caa){_0x516ac7=_0x516ac7-0x0;var _0x2e22ca=_0x7533[_0x516ac7];return _0x2e22ca;};'use strict';var multer=require(_0x3753('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3753('0x1'));var express=require('express');var router=express[_0x3753('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x3753('0x3'));var config=require(_0x3753('0x4'));var controller=require('./intZendeskAccount.controller');router[_0x3753('0x5')]('/',auth[_0x3753('0x6')](),controller[_0x3753('0x7')]);router['get'](_0x3753('0x8'),auth[_0x3753('0x6')](),controller[_0x3753('0x9')]);router[_0x3753('0x5')]('/:id/configurations',auth[_0x3753('0x6')](),controller[_0x3753('0xa')]);router[_0x3753('0x5')]('/:id/fields',auth[_0x3753('0x6')](),controller[_0x3753('0xb')]);router[_0x3753('0xc')]('/',auth['isAuthenticated'](),controller[_0x3753('0xd')]);router['post']('/:id/configurations',auth[_0x3753('0x6')](),controller[_0x3753('0xe')]);router['put'](_0x3753('0x8'),auth['isAuthenticated'](),controller[_0x3753('0xf')]);router[_0x3753('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3753('0x11')]);module[_0x3753('0x12')]=router; \ No newline at end of file +var _0x25a3=['/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x56f05d,_0x5a2025){var _0x38104c=function(_0x523f5f){while(--_0x523f5f){_0x56f05d['push'](_0x56f05d['shift']());}};_0x38104c(++_0x5a2025);}(_0x25a3,0x121));var _0x325a=function(_0x1762d2,_0x24eb8c){_0x1762d2=_0x1762d2-0x0;var _0xfd822d=_0x25a3[_0x1762d2];return _0xfd822d;};'use strict';var multer=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var path=require(_0x325a('0x2'));var timeout=require('connect-timeout');var express=require(_0x325a('0x3'));var router=express['Router']();var auth=require(_0x325a('0x4'));var interaction=require(_0x325a('0x5'));var config=require(_0x325a('0x6'));var controller=require('./intZendeskAccount.controller');router[_0x325a('0x7')]('/',auth[_0x325a('0x8')](),controller[_0x325a('0x9')]);router['get']('/:id',auth[_0x325a('0x8')](),controller[_0x325a('0xa')]);router[_0x325a('0x7')](_0x325a('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x325a('0x7')](_0x325a('0xc'),auth[_0x325a('0x8')](),controller[_0x325a('0xd')]);router[_0x325a('0xe')]('/',auth[_0x325a('0x8')](),controller['create']);router[_0x325a('0xe')](_0x325a('0xb'),auth['isAuthenticated'](),controller[_0x325a('0xf')]);router[_0x325a('0x10')](_0x325a('0x11'),auth[_0x325a('0x8')](),controller['update']);router['delete'](_0x325a('0x11'),auth['isAuthenticated'](),controller[_0x325a('0x12')]);module[_0x325a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 8408dbe..965042f 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 _0x2e73=['password','token','integrationTab','newTab','STRING','username','remoteUri'];(function(_0x32cc7d,_0x30ae7f){var _0x2e13ed=function(_0x553bb4){while(--_0x553bb4){_0x32cc7d['push'](_0x32cc7d['shift']());}};_0x2e13ed(++_0x30ae7f);}(_0x2e73,0x1b6));var _0x32e7=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0x2e73[_0x685346];return _0x52e15b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x32e7('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x32e7('0x1')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x32e7('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x32e7('0x2')},'authType':{'type':Sequelize['ENUM'](_0x32e7('0x3'),_0x32e7('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x32e7('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x32e7('0x5'),_0x32e7('0x6')),'defaultValue':_0x32e7('0x5')}}; \ No newline at end of file +var _0xb9c9=['password','ENUM','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','token'];(function(_0x415ad8,_0x4a8bf3){var _0x6ca45f=function(_0x30e952){while(--_0x30e952){_0x415ad8['push'](_0x415ad8['shift']());}};_0x6ca45f(++_0x4a8bf3);}(_0xb9c9,0x1bc));var _0x9b9c=function(_0x5f57bd,_0x289587){_0x5f57bd=_0x5f57bd-0x0;var _0x2aee25=_0xb9c9[_0x5f57bd];return _0x2aee25;};'use strict';var Sequelize=require(_0x9b9c('0x0'));module[_0x9b9c('0x1')]={'name':{'type':Sequelize[_0x9b9c('0x2')]},'description':{'type':Sequelize[_0x9b9c('0x2')]},'username':{'type':Sequelize[_0x9b9c('0x2')],'unique':_0x9b9c('0x3')},'password':{'type':Sequelize[_0x9b9c('0x2')]},'token':{'type':Sequelize[_0x9b9c('0x2')]},'remoteUri':{'type':Sequelize[_0x9b9c('0x2')],'unique':_0x9b9c('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0x9b9c('0x5')),'defaultValue':_0x9b9c('0x6')},'serverUrl':{'type':Sequelize[_0x9b9c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9b9c('0x7')](_0x9b9c('0x8'),_0x9b9c('0x9')),'defaultValue':_0x9b9c('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 607d27b..109a8b9 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 _0x4dd2=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','status','end','json','count','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ZendeskAccount','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','ZendeskConfiguration','addConfiguration','AccountId','Descriptions','channel','ZendeskField','Subjects','getFields','findOne','username','password','authType','remoteUri','slice','lastIndexOf','GET','%s/%s','headers','format','Basic\x20%s','%s:%s','toString','%s/token:%s','token','base64','Sequelize','ValidationError','subject','description','group','remove','ticket_fields','includes','title','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x4dd2,0xf1));var _0x24dd=function(_0x20713e,_0x44f710){_0x20713e=_0x20713e-0x0;var _0x7d998b=_0x4dd2[_0x20713e];return _0x7d998b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x24dd('0x0'));var rimraf=require(_0x24dd('0x1'));var zipdir=require(_0x24dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24dd('0x3'));var moment=require('moment');var BPromise=require(_0x24dd('0x4'));var Mustache=require('mustache');var util=require(_0x24dd('0x5'));var path=require(_0x24dd('0x6'));var sox=require(_0x24dd('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x24dd('0x8'));var squel=require(_0x24dd('0x9'));var crypto=require(_0x24dd('0xa'));var jsforce=require(_0x24dd('0xb'));var deskjs=require(_0x24dd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x24dd('0xd'));var Papa=require(_0x24dd('0xe'));var Redis=require(_0x24dd('0xf'));var authService=require(_0x24dd('0x10'));var qs=require(_0x24dd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24dd('0x12'));var logger=require(_0x24dd('0x13'))(_0x24dd('0x14'));var utils=require(_0x24dd('0x15'));var config=require(_0x24dd('0x16'));var licenseUtil=require(_0x24dd('0x17'));var db=require(_0x24dd('0x18'))['db'];var integrations=require(_0x24dd('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x24dd('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x317fe8,_0x42a5dc,_0x4b3f0d,_0x5498a6){return new BPromise(function(_0x45da78,_0x15ed4d){var _0x3971fb=_0x5498a6||client;return _0x3971fb['request'](_0x317fe8,_0x4b3f0d)[_0x24dd('0x1b')](function(_0x5a4a2c){logger[_0x24dd('0x1c')](_0x24dd('0x1d'),_0x42a5dc,_0x24dd('0x1e'));logger[_0x24dd('0x1f')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x42a5dc,_0x24dd('0x1e'),JSON[_0x24dd('0x20')](_0x5a4a2c));if(_0x5a4a2c['error']){if(_0x5a4a2c['error'][_0x24dd('0x21')]===0x1f4){logger['error'](_0x24dd('0x1d'),_0x42a5dc,_0x5a4a2c[_0x24dd('0x22')][_0x24dd('0x23')]);return _0x15ed4d(_0x5a4a2c[_0x24dd('0x22')][_0x24dd('0x23')]);}logger[_0x24dd('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x42a5dc,_0x5a4a2c['error'][_0x24dd('0x23')]);return _0x45da78(_0x5a4a2c[_0x24dd('0x22')]['message']);}else{logger['info'](_0x24dd('0x1d'),_0x42a5dc,'request\x20sent');_0x45da78(_0x5a4a2c[_0x24dd('0x24')][_0x24dd('0x23')]);}})['catch'](function(_0x56a1c1){logger[_0x24dd('0x22')](_0x24dd('0x1d'),_0x42a5dc,_0x56a1c1);_0x15ed4d(_0x56a1c1);});});}function respondWithStatusCode(_0x930681,_0xa3262){_0xa3262=_0xa3262||0xcc;return function(_0x28d6e2){if(_0x28d6e2){return _0x930681['sendStatus'](_0xa3262);}return _0x930681[_0x24dd('0x25')](_0xa3262)[_0x24dd('0x26')]();};}function respondWithResult(_0xab4def,_0x57ef48){_0x57ef48=_0x57ef48||0xc8;return function(_0x1d3a8f){if(_0x1d3a8f){return _0xab4def[_0x24dd('0x25')](_0x57ef48)[_0x24dd('0x27')](_0x1d3a8f);}};}function respondWithFilteredResult(_0xd2109e,_0xaf9b90){return function(_0x57affd){if(_0x57affd){var _0x50061f=_0x57affd[_0x24dd('0x28')],_0x56d0e4=_0xaf9b90['offset'],_0x23c3f8=_0xaf9b90['offset']+_0xaf9b90['limit'],_0x26d9aa;if(_0x23c3f8>=_0x50061f){_0x23c3f8=_0x50061f;_0x26d9aa=0xc8;}else{_0x26d9aa=0xce;}_0xd2109e[_0x24dd('0x25')](_0x26d9aa);return _0xd2109e[_0x24dd('0x29')](_0x24dd('0x2a'),_0x56d0e4+'-'+_0x23c3f8+'/'+_0x50061f)[_0x24dd('0x27')](_0x57affd);}return null;};}function patchUpdates(_0x359a9b){return function(_0x4d7eba){try{jsonpatch[_0x24dd('0x2b')](_0x4d7eba,_0x359a9b,!![]);}catch(_0x561d10){return BPromise[_0x24dd('0x2c')](_0x561d10);}return _0x4d7eba[_0x24dd('0x2d')]();};}function saveUpdates(_0x23ea3d,_0x49925b){return function(_0x1c8dad){if(_0x1c8dad){return _0x1c8dad[_0x24dd('0x2e')](_0x23ea3d)['then'](function(_0x3ee42c){return _0x3ee42c;});}return null;};}function removeEntity(_0x58b47b,_0xfdd965){return function(_0x2bcefa){if(_0x2bcefa){return _0x2bcefa['destroy']()['then'](function(){_0x58b47b[_0x24dd('0x25')](0xcc)[_0x24dd('0x26')]();});}};}function handleEntityNotFound(_0xc8887e,_0x160ad8){return function(_0x15afa2){if(!_0x15afa2){_0xc8887e[_0x24dd('0x2f')](0x194);}return _0x15afa2;};}function handleError(_0x2e13bc,_0x22fa75){_0x22fa75=_0x22fa75||0x1f4;return function(_0x327031){logger[_0x24dd('0x22')](_0x327031[_0x24dd('0x30')]);if(_0x327031[_0x24dd('0x31')]){delete _0x327031['name'];}_0x2e13bc[_0x24dd('0x25')](_0x22fa75)[_0x24dd('0x32')](_0x327031);};}exports['index']=function(_0x27d261,_0x510d5b){var _0x591919={},_0x20cd08={},_0x68b55={'count':0x0,'rows':[]};var _0x5d0f73=_[_0x24dd('0x33')](db['ZendeskAccount'][_0x24dd('0x34')],function(_0x216468){return{'name':_0x216468[_0x24dd('0x35')],'type':_0x216468[_0x24dd('0x36')][_0x24dd('0x37')]};});_0x20cd08[_0x24dd('0x38')]=_[_0x24dd('0x33')](_0x5d0f73,_0x24dd('0x31'));_0x20cd08[_0x24dd('0x39')]=_[_0x24dd('0x3a')](_0x27d261[_0x24dd('0x39')]);_0x20cd08[_0x24dd('0x3b')]=_[_0x24dd('0x3c')](_0x20cd08[_0x24dd('0x38')],_0x20cd08[_0x24dd('0x39')]);_0x591919['attributes']=_[_0x24dd('0x3c')](_0x20cd08['model'],qs[_0x24dd('0x3d')](_0x27d261[_0x24dd('0x39')][_0x24dd('0x3d')]));_0x591919[_0x24dd('0x3e')]=_0x591919[_0x24dd('0x3e')][_0x24dd('0x3f')]?_0x591919[_0x24dd('0x3e')]:_0x20cd08['model'];if(!_0x27d261[_0x24dd('0x39')][_0x24dd('0x40')](_0x24dd('0x41'))){_0x591919[_0x24dd('0x42')]=qs[_0x24dd('0x42')](_0x27d261[_0x24dd('0x39')][_0x24dd('0x42')]);_0x591919[_0x24dd('0x43')]=qs['offset'](_0x27d261[_0x24dd('0x39')][_0x24dd('0x43')]);}_0x591919[_0x24dd('0x44')]=qs[_0x24dd('0x45')](_0x27d261[_0x24dd('0x39')][_0x24dd('0x45')]);_0x591919[_0x24dd('0x46')]=qs[_0x24dd('0x3b')](_[_0x24dd('0x47')](_0x27d261[_0x24dd('0x39')],_0x20cd08[_0x24dd('0x3b')]),_0x5d0f73);if(_0x27d261[_0x24dd('0x39')][_0x24dd('0x48')]){_0x591919[_0x24dd('0x46')]=_[_0x24dd('0x49')](_0x591919[_0x24dd('0x46')],{'$or':_[_0x24dd('0x33')](_0x5d0f73,function(_0x31988b){if(_0x31988b[_0x24dd('0x36')]!==_0x24dd('0x4a')){var _0x238dd6={};_0x238dd6[_0x31988b['name']]={'$like':'%'+_0x27d261[_0x24dd('0x39')]['filter']+'%'};return _0x238dd6;}})});}_0x591919=_['merge']({},_0x591919,_0x27d261[_0x24dd('0x4b')]);var _0x46181b={'where':_0x591919[_0x24dd('0x46')]};return db['ZendeskAccount'][_0x24dd('0x28')](_0x46181b)[_0x24dd('0x1b')](function(_0xcfdb1a){_0x68b55['count']=_0xcfdb1a;if(_0x27d261[_0x24dd('0x39')][_0x24dd('0x4c')]){_0x591919[_0x24dd('0x4d')]=[{'all':!![]}];}return db[_0x24dd('0x4e')][_0x24dd('0x4f')](_0x591919);})[_0x24dd('0x1b')](function(_0x36589b){_0x68b55[_0x24dd('0x50')]=_0x36589b;return _0x68b55;})['then'](respondWithFilteredResult(_0x510d5b,_0x591919))[_0x24dd('0x51')](handleError(_0x510d5b,null));};exports[_0x24dd('0x52')]=function(_0x298a3f,_0x28b7f8){var _0x33be8b={'raw':![],'where':{'id':_0x298a3f[_0x24dd('0x53')]['id']}},_0x3d61ae={};_0x3d61ae[_0x24dd('0x38')]=_['keys'](db[_0x24dd('0x4e')]['rawAttributes']);_0x3d61ae[_0x24dd('0x39')]=_[_0x24dd('0x3a')](_0x298a3f['query']);_0x3d61ae[_0x24dd('0x3b')]=_['intersection'](_0x3d61ae[_0x24dd('0x38')],_0x3d61ae[_0x24dd('0x39')]);_0x33be8b[_0x24dd('0x3e')]=_[_0x24dd('0x3c')](_0x3d61ae[_0x24dd('0x38')],qs[_0x24dd('0x3d')](_0x298a3f[_0x24dd('0x39')][_0x24dd('0x3d')]));_0x33be8b[_0x24dd('0x3e')]=_0x33be8b['attributes'][_0x24dd('0x3f')]?_0x33be8b['attributes']:_0x3d61ae[_0x24dd('0x38')];if(_0x298a3f['query']['includeAll']){_0x33be8b[_0x24dd('0x4d')]=[{'all':!![]}];}_0x33be8b=_['merge']({},_0x33be8b,_0x298a3f['options']);return db['ZendeskAccount'][_0x24dd('0x54')](_0x33be8b)[_0x24dd('0x1b')](handleEntityNotFound(_0x28b7f8,null))[_0x24dd('0x1b')](respondWithResult(_0x28b7f8,null))[_0x24dd('0x51')](handleError(_0x28b7f8,null));};exports[_0x24dd('0x55')]=function(_0x33927d,_0x45ec14){return db['ZendeskAccount'][_0x24dd('0x55')](_0x33927d[_0x24dd('0x56')],{})[_0x24dd('0x1b')](respondWithResult(_0x45ec14,0xc9))[_0x24dd('0x51')](handleError(_0x45ec14,null));};exports[_0x24dd('0x2e')]=function(_0x34b86d,_0x2300f6){if(_0x34b86d[_0x24dd('0x56')]['id']){delete _0x34b86d[_0x24dd('0x56')]['id'];}return db[_0x24dd('0x4e')][_0x24dd('0x54')]({'where':{'id':_0x34b86d[_0x24dd('0x53')]['id']}})[_0x24dd('0x1b')](handleEntityNotFound(_0x2300f6,null))['then'](saveUpdates(_0x34b86d[_0x24dd('0x56')],null))[_0x24dd('0x1b')](respondWithResult(_0x2300f6,null))['catch'](handleError(_0x2300f6,null));};exports[_0x24dd('0x57')]=function(_0xd052f4,_0x1c7c88){return db[_0x24dd('0x4e')][_0x24dd('0x54')]({'where':{'id':_0xd052f4[_0x24dd('0x53')]['id']}})[_0x24dd('0x1b')](handleEntityNotFound(_0x1c7c88,null))[_0x24dd('0x1b')](removeEntity(_0x1c7c88,null))[_0x24dd('0x51')](handleError(_0x1c7c88,null));};exports[_0x24dd('0x58')]=function(_0x4a8990,_0x59d3c9,_0x5affb8){var _0x584328={};var _0x25014c={};var _0x3a9f1c;var _0x5633d5;return db[_0x24dd('0x4e')]['findOne']({'where':{'id':_0x4a8990[_0x24dd('0x53')]['id']}})['then'](handleEntityNotFound(_0x59d3c9,null))[_0x24dd('0x1b')](function(_0x42fc86){if(_0x42fc86){_0x3a9f1c=_0x42fc86;_0x25014c[_0x24dd('0x38')]=_[_0x24dd('0x3a')](db[_0x24dd('0x59')][_0x24dd('0x34')]);_0x25014c['query']=_['keys'](_0x4a8990['query']);_0x25014c[_0x24dd('0x3b')]=_[_0x24dd('0x3c')](_0x25014c[_0x24dd('0x38')],_0x25014c['query']);_0x584328[_0x24dd('0x3e')]=_[_0x24dd('0x3c')](_0x25014c['model'],qs['fields'](_0x4a8990[_0x24dd('0x39')][_0x24dd('0x3d')]));_0x584328['attributes']=_0x584328['attributes'][_0x24dd('0x3f')]?_0x584328['attributes']:_0x25014c['model'];_0x584328[_0x24dd('0x44')]=qs['sort'](_0x4a8990[_0x24dd('0x39')][_0x24dd('0x45')]);_0x584328[_0x24dd('0x46')]=qs[_0x24dd('0x3b')](_[_0x24dd('0x47')](_0x4a8990[_0x24dd('0x39')],_0x25014c['filters']));if(_0x4a8990[_0x24dd('0x39')][_0x24dd('0x48')]){_0x584328[_0x24dd('0x46')]=_[_0x24dd('0x49')](_0x584328[_0x24dd('0x46')],{'$or':_[_0x24dd('0x33')](_0x584328['attributes'],function(_0x59be02){var _0x2c2268={};_0x2c2268[_0x59be02]={'$like':'%'+_0x4a8990['query'][_0x24dd('0x48')]+'%'};return _0x2c2268;})});}_0x584328=_[_0x24dd('0x49')]({},_0x584328,_0x4a8990[_0x24dd('0x4b')]);return _0x3a9f1c[_0x24dd('0x58')](_0x584328);}})[_0x24dd('0x1b')](function(_0x7af4d1){if(_0x7af4d1){_0x5633d5=_0x7af4d1[_0x24dd('0x3f')];if(!_0x4a8990['query'][_0x24dd('0x40')]('nolimit')){_0x584328[_0x24dd('0x42')]=qs[_0x24dd('0x42')](_0x4a8990[_0x24dd('0x39')][_0x24dd('0x42')]);_0x584328['offset']=qs[_0x24dd('0x43')](_0x4a8990[_0x24dd('0x39')][_0x24dd('0x43')]);}return _0x3a9f1c[_0x24dd('0x58')](_0x584328);}})['then'](function(_0x275cbe){if(_0x275cbe){return _0x275cbe?{'count':_0x5633d5,'rows':_0x275cbe}:null;}})[_0x24dd('0x1b')](respondWithResult(_0x59d3c9,null))[_0x24dd('0x51')](handleError(_0x59d3c9,null));};exports[_0x24dd('0x5a')]=function(_0x20ad34,_0x195b71,_0x556573){if(_0x20ad34[_0x24dd('0x56')]['id']){delete _0x20ad34[_0x24dd('0x56')]['id'];}return db[_0x24dd('0x4e')]['findOne']({'where':{'id':_0x20ad34[_0x24dd('0x53')]['id']}})[_0x24dd('0x1b')](handleEntityNotFound(_0x195b71,null))[_0x24dd('0x1b')](function(_0x35d5c1){if(_0x35d5c1){_0x20ad34['body'][_0x24dd('0x5b')]=_0x35d5c1['id'];_0x20ad34['body']['Subjects']=integrations['getSubjects'](_0x20ad34[_0x24dd('0x56')]['channel'],_0x20ad34['body'][_0x24dd('0x36')]);_0x20ad34[_0x24dd('0x56')][_0x24dd('0x5c')]=integrations['getDescriptions'](_0x20ad34['body'][_0x24dd('0x5d')],_0x20ad34[_0x24dd('0x56')][_0x24dd('0x36')]);return db[_0x24dd('0x59')][_0x24dd('0x55')](_0x20ad34['body'],{'include':[{'model':db[_0x24dd('0x5e')],'as':_0x24dd('0x5f')},{'model':db['ZendeskField'],'as':_0x24dd('0x5c')}]});}return null;})[_0x24dd('0x1b')](respondWithResult(_0x195b71,null))[_0x24dd('0x51')](handleError(_0x195b71,null));};exports[_0x24dd('0x60')]=function(_0x249dbe,_0x539c0d,_0x683bfa){var _0x140d61='';return db[_0x24dd('0x4e')][_0x24dd('0x61')]({'where':{'id':_0x249dbe[_0x24dd('0x53')]['id']},'attributes':['id',_0x24dd('0x62'),_0x24dd('0x63'),'token',_0x24dd('0x64'),_0x24dd('0x65')]})[_0x24dd('0x1b')](handleEntityNotFound(_0x539c0d,null))[_0x24dd('0x1b')](function(_0x1b5e51){if(_0x1b5e51){_0x140d61=_0x1b5e51['remoteUri'];var _0x27c14f=_0x140d61[_0x24dd('0x66')](-0x1);if(_0x27c14f==='/'){_0x140d61=_0x140d61['substring'](0x0,_0x140d61[_0x24dd('0x67')](_0x27c14f));}var _0x52ebfa={'method':_0x24dd('0x68'),'uri':util['format'](_0x24dd('0x69'),_0x140d61,'ticket_fields'),'json':!![]};switch(_0x1b5e51['authType']){case _0x24dd('0x63'):_0x52ebfa[_0x24dd('0x6a')]={'Authorization':util[_0x24dd('0x6b')](_0x24dd('0x6c'),new Buffer(util['format'](_0x24dd('0x6d'),_0x1b5e51[_0x24dd('0x62')],_0x1b5e51[_0x24dd('0x63')]))[_0x24dd('0x6e')]('base64'))};break;case'token':_0x52ebfa[_0x24dd('0x6a')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x24dd('0x6f'),_0x1b5e51[_0x24dd('0x62')],_0x1b5e51[_0x24dd('0x70')]))[_0x24dd('0x6e')](_0x24dd('0x71')))};break;default:throw new db[(_0x24dd('0x72'))][(_0x24dd('0x73'))]('Unknown\x20authentication\x20type');}return rp(_0x52ebfa);}})['then'](function(_0x12c6c4){if(_0x12c6c4){var _0x37e2cc=[_0x24dd('0x74'),_0x24dd('0x75'),_0x24dd('0x76'),'assignee'];_[_0x24dd('0x77')](_0x12c6c4[_0x24dd('0x78')],function(_0x7fc8c0){return _0x37e2cc[_0x24dd('0x79')](_0x7fc8c0[_0x24dd('0x36')]);});return{'count':_0x12c6c4[_0x24dd('0x78')][_0x24dd('0x3f')],'rows':_[_0x24dd('0x33')](_0x12c6c4[_0x24dd('0x78')],function(_0x484bee){return{'id':_0x484bee['id'],'name':_0x484bee['position']>0x7?_0x484bee[_0x24dd('0x7a')]:_0x484bee[_0x24dd('0x36')],'custom':_0x484bee[_0x24dd('0x7b')]>0x7?!![]:![],'options':_0x484bee[_0x24dd('0x7c')]?_0x484bee[_0x24dd('0x7c')]:_0x484bee['custom_field_options']?_0x484bee[_0x24dd('0x7d')]:[]};})};}})[_0x24dd('0x1b')](respondWithResult(_0x539c0d,null))[_0x24dd('0x51')](function(_0x3abb29){var _0x4d52ac=_0x249dbe[_0x24dd('0x39')]['test']?0x1f4:_0x3abb29[_0x24dd('0x7e')]||0x1f4;logger[_0x24dd('0x22')](_0x24dd('0x7f'),_0x24dd('0x60'),_0x4d52ac,JSON[_0x24dd('0x20')](_0x3abb29));delete _0x3abb29[_0x24dd('0x31')];if(_0x4d52ac===0x191){_0x4d52ac=0x190;}_0x539c0d['status'](_0x4d52ac)[_0x24dd('0x32')](_0x249dbe[_0x24dd('0x39')][_0x24dd('0x80')]?{'message':_0x24dd('0x81'),'statusCode':_0x3abb29['statusCode']}:_0x3abb29);});}; \ No newline at end of file +var _0x644a=['title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','json','offset','limit','reject','save','update','then','destroy','end','name','send','index','map','ZendeskAccount','rawAttributes','type','key','model','keys','query','intersection','attributes','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','fields','length','includeAll','create','body','find','findOne','params','ZendeskConfiguration','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','password','token','remoteUri','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','username','toString','headers','%s/token:%s','Sequelize','ValidationError','description','assignee','includes','position'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0x644a,0xfd));var _0xa644=function(_0x3cb52a,_0x5a586d){_0x3cb52a=_0x3cb52a-0x0;var _0x4e6bab=_0x644a[_0x3cb52a];return _0x4e6bab;};'use strict';var pdf=require(_0xa644('0x0'));var emlformat=require(_0xa644('0x1'));var rimraf=require(_0xa644('0x2'));var zipdir=require(_0xa644('0x3'));var jsonpatch=require(_0xa644('0x4'));var rp=require('request-promise');var moment=require(_0xa644('0x5'));var BPromise=require(_0xa644('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa644('0x7'));var sox=require(_0xa644('0x8'));var csv=require(_0xa644('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa644('0xa'));var squel=require(_0xa644('0xb'));var crypto=require('crypto');var jsforce=require(_0xa644('0xc'));var deskjs=require(_0xa644('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa644('0xe'));var Redis=require(_0xa644('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa644('0x10'));var as=require(_0xa644('0x11'));var hardwareService=require(_0xa644('0x12'));var logger=require(_0xa644('0x13'))(_0xa644('0x14'));var utils=require('../../config/utils');var config=require(_0xa644('0x15'));var licenseUtil=require(_0xa644('0x16'));var db=require(_0xa644('0x17'))['db'];var integrations=require(_0xa644('0x18'));var jayson=require(_0xa644('0x19'));var client=jayson[_0xa644('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53553a,_0x357a21,_0x2d9b98,_0x10783c){return new BPromise(function(_0x3abf72,_0x270e3d){var _0x54ce7b=_0x10783c||client;return _0x54ce7b['request'](_0x53553a,_0x2d9b98)['then'](function(_0x57ccc2){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x357a21,_0xa644('0x1b'));logger[_0xa644('0x1c')](_0xa644('0x1d'),_0x357a21,_0xa644('0x1b'),JSON[_0xa644('0x1e')](_0x57ccc2));if(_0x57ccc2[_0xa644('0x1f')]){if(_0x57ccc2[_0xa644('0x1f')][_0xa644('0x20')]===0x1f4){logger[_0xa644('0x1f')](_0xa644('0x21'),_0x357a21,_0x57ccc2[_0xa644('0x1f')][_0xa644('0x22')]);return _0x270e3d(_0x57ccc2[_0xa644('0x1f')][_0xa644('0x22')]);}logger[_0xa644('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x357a21,_0x57ccc2[_0xa644('0x1f')][_0xa644('0x22')]);return _0x3abf72(_0x57ccc2[_0xa644('0x1f')]['message']);}else{logger[_0xa644('0x23')](_0xa644('0x21'),_0x357a21,'request\x20sent');_0x3abf72(_0x57ccc2[_0xa644('0x24')][_0xa644('0x22')]);}})['catch'](function(_0x254254){logger[_0xa644('0x1f')](_0xa644('0x21'),_0x357a21,_0x254254);_0x270e3d(_0x254254);});});}function respondWithStatusCode(_0x3eeb0d,_0x13dfd6){_0x13dfd6=_0x13dfd6||0xcc;return function(_0x285a35){if(_0x285a35){return _0x3eeb0d[_0xa644('0x25')](_0x13dfd6);}return _0x3eeb0d[_0xa644('0x26')](_0x13dfd6)['end']();};}function respondWithResult(_0x328e00,_0x41d671){_0x41d671=_0x41d671||0xc8;return function(_0x54718a){if(_0x54718a){return _0x328e00[_0xa644('0x26')](_0x41d671)[_0xa644('0x27')](_0x54718a);}};}function respondWithFilteredResult(_0x23fd0f,_0x7ed5ac){return function(_0x5d33f9){if(_0x5d33f9){var _0x42d743=_0x5d33f9['count'],_0x332ad5=_0x7ed5ac['offset'],_0x38615f=_0x7ed5ac[_0xa644('0x28')]+_0x7ed5ac[_0xa644('0x29')],_0x214bdc;if(_0x38615f>=_0x42d743){_0x38615f=_0x42d743;_0x214bdc=0xc8;}else{_0x214bdc=0xce;}_0x23fd0f[_0xa644('0x26')](_0x214bdc);return _0x23fd0f['set']('Content-Range',_0x332ad5+'-'+_0x38615f+'/'+_0x42d743)[_0xa644('0x27')](_0x5d33f9);}return null;};}function patchUpdates(_0x5d6c43){return function(_0xc8a932){try{jsonpatch['apply'](_0xc8a932,_0x5d6c43,!![]);}catch(_0x1e84eb){return BPromise[_0xa644('0x2a')](_0x1e84eb);}return _0xc8a932[_0xa644('0x2b')]();};}function saveUpdates(_0x5a038f,_0x569590){return function(_0x25a8c8){if(_0x25a8c8){return _0x25a8c8[_0xa644('0x2c')](_0x5a038f)[_0xa644('0x2d')](function(_0x4b824c){return _0x4b824c;});}return null;};}function removeEntity(_0x586945,_0x573e86){return function(_0x1eaac5){if(_0x1eaac5){return _0x1eaac5[_0xa644('0x2e')]()['then'](function(){_0x586945[_0xa644('0x26')](0xcc)[_0xa644('0x2f')]();});}};}function handleEntityNotFound(_0x161ff2,_0x25c185){return function(_0x252bee){if(!_0x252bee){_0x161ff2[_0xa644('0x25')](0x194);}return _0x252bee;};}function handleError(_0xee8218,_0x2b2ee7){_0x2b2ee7=_0x2b2ee7||0x1f4;return function(_0xe92169){logger[_0xa644('0x1f')](_0xe92169['stack']);if(_0xe92169[_0xa644('0x30')]){delete _0xe92169[_0xa644('0x30')];}_0xee8218[_0xa644('0x26')](_0x2b2ee7)[_0xa644('0x31')](_0xe92169);};}exports[_0xa644('0x32')]=function(_0x5626e1,_0x32c602){var _0x4f0a8a={},_0x3f1539={},_0x36d4fa={'count':0x0,'rows':[]};var _0x330058=_[_0xa644('0x33')](db[_0xa644('0x34')][_0xa644('0x35')],function(_0x2310fb){return{'name':_0x2310fb['fieldName'],'type':_0x2310fb[_0xa644('0x36')][_0xa644('0x37')]};});_0x3f1539[_0xa644('0x38')]=_[_0xa644('0x33')](_0x330058,_0xa644('0x30'));_0x3f1539['query']=_[_0xa644('0x39')](_0x5626e1[_0xa644('0x3a')]);_0x3f1539['filters']=_[_0xa644('0x3b')](_0x3f1539['model'],_0x3f1539[_0xa644('0x3a')]);_0x4f0a8a[_0xa644('0x3c')]=_[_0xa644('0x3b')](_0x3f1539[_0xa644('0x38')],qs['fields'](_0x5626e1[_0xa644('0x3a')]['fields']));_0x4f0a8a[_0xa644('0x3c')]=_0x4f0a8a[_0xa644('0x3c')]['length']?_0x4f0a8a[_0xa644('0x3c')]:_0x3f1539['model'];if(!_0x5626e1[_0xa644('0x3a')]['hasOwnProperty'](_0xa644('0x3d'))){_0x4f0a8a[_0xa644('0x29')]=qs['limit'](_0x5626e1['query']['limit']);_0x4f0a8a['offset']=qs[_0xa644('0x28')](_0x5626e1[_0xa644('0x3a')]['offset']);}_0x4f0a8a[_0xa644('0x3e')]=qs['sort'](_0x5626e1['query'][_0xa644('0x3f')]);_0x4f0a8a[_0xa644('0x40')]=qs[_0xa644('0x41')](_[_0xa644('0x42')](_0x5626e1[_0xa644('0x3a')],_0x3f1539[_0xa644('0x41')]),_0x330058);if(_0x5626e1[_0xa644('0x3a')]['filter']){_0x4f0a8a[_0xa644('0x40')]=_['merge'](_0x4f0a8a[_0xa644('0x40')],{'$or':_[_0xa644('0x33')](_0x330058,function(_0xaa3cb9){if(_0xaa3cb9[_0xa644('0x36')]!==_0xa644('0x43')){var _0x52b3b6={};_0x52b3b6[_0xaa3cb9[_0xa644('0x30')]]={'$like':'%'+_0x5626e1['query'][_0xa644('0x44')]+'%'};return _0x52b3b6;}})});}_0x4f0a8a=_[_0xa644('0x45')]({},_0x4f0a8a,_0x5626e1[_0xa644('0x46')]);var _0x303881={'where':_0x4f0a8a[_0xa644('0x40')]};return db['ZendeskAccount'][_0xa644('0x47')](_0x303881)[_0xa644('0x2d')](function(_0x29b0cb){_0x36d4fa['count']=_0x29b0cb;if(_0x5626e1['query']['includeAll']){_0x4f0a8a[_0xa644('0x48')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xa644('0x49')](_0x4f0a8a);})[_0xa644('0x2d')](function(_0x3eb6a3){_0x36d4fa[_0xa644('0x4a')]=_0x3eb6a3;return _0x36d4fa;})[_0xa644('0x2d')](respondWithFilteredResult(_0x32c602,_0x4f0a8a))[_0xa644('0x4b')](handleError(_0x32c602,null));};exports[_0xa644('0x4c')]=function(_0x3ba2e7,_0x44a462){var _0x1bae36={'raw':![],'where':{'id':_0x3ba2e7['params']['id']}},_0x33a4db={};_0x33a4db[_0xa644('0x38')]=_[_0xa644('0x39')](db[_0xa644('0x34')][_0xa644('0x35')]);_0x33a4db[_0xa644('0x3a')]=_[_0xa644('0x39')](_0x3ba2e7['query']);_0x33a4db['filters']=_['intersection'](_0x33a4db[_0xa644('0x38')],_0x33a4db['query']);_0x1bae36[_0xa644('0x3c')]=_[_0xa644('0x3b')](_0x33a4db['model'],qs[_0xa644('0x4d')](_0x3ba2e7[_0xa644('0x3a')][_0xa644('0x4d')]));_0x1bae36[_0xa644('0x3c')]=_0x1bae36[_0xa644('0x3c')][_0xa644('0x4e')]?_0x1bae36[_0xa644('0x3c')]:_0x33a4db[_0xa644('0x38')];if(_0x3ba2e7[_0xa644('0x3a')][_0xa644('0x4f')]){_0x1bae36[_0xa644('0x48')]=[{'all':!![]}];}_0x1bae36=_[_0xa644('0x45')]({},_0x1bae36,_0x3ba2e7[_0xa644('0x46')]);return db[_0xa644('0x34')]['find'](_0x1bae36)[_0xa644('0x2d')](handleEntityNotFound(_0x44a462,null))[_0xa644('0x2d')](respondWithResult(_0x44a462,null))['catch'](handleError(_0x44a462,null));};exports[_0xa644('0x50')]=function(_0x2d253a,_0xfc5e52){return db[_0xa644('0x34')][_0xa644('0x50')](_0x2d253a[_0xa644('0x51')],{})[_0xa644('0x2d')](respondWithResult(_0xfc5e52,0xc9))[_0xa644('0x4b')](handleError(_0xfc5e52,null));};exports[_0xa644('0x2c')]=function(_0x32b3e5,_0x5d4297){if(_0x32b3e5['body']['id']){delete _0x32b3e5[_0xa644('0x51')]['id'];}return db[_0xa644('0x34')]['find']({'where':{'id':_0x32b3e5['params']['id']}})[_0xa644('0x2d')](handleEntityNotFound(_0x5d4297,null))[_0xa644('0x2d')](saveUpdates(_0x32b3e5[_0xa644('0x51')],null))[_0xa644('0x2d')](respondWithResult(_0x5d4297,null))[_0xa644('0x4b')](handleError(_0x5d4297,null));};exports[_0xa644('0x2e')]=function(_0x157523,_0x4dd989){return db['ZendeskAccount'][_0xa644('0x52')]({'where':{'id':_0x157523['params']['id']}})[_0xa644('0x2d')](handleEntityNotFound(_0x4dd989,null))['then'](removeEntity(_0x4dd989,null))[_0xa644('0x4b')](handleError(_0x4dd989,null));};exports['getConfigurations']=function(_0x388e98,_0x483277,_0x53d9ed){var _0x429748={};var _0x3e242a={};var _0x2969d3;var _0x3844dc;return db['ZendeskAccount'][_0xa644('0x53')]({'where':{'id':_0x388e98[_0xa644('0x54')]['id']}})[_0xa644('0x2d')](handleEntityNotFound(_0x483277,null))[_0xa644('0x2d')](function(_0x211095){if(_0x211095){_0x2969d3=_0x211095;_0x3e242a['model']=_[_0xa644('0x39')](db[_0xa644('0x55')][_0xa644('0x35')]);_0x3e242a['query']=_[_0xa644('0x39')](_0x388e98[_0xa644('0x3a')]);_0x3e242a[_0xa644('0x41')]=_[_0xa644('0x3b')](_0x3e242a[_0xa644('0x38')],_0x3e242a['query']);_0x429748['attributes']=_[_0xa644('0x3b')](_0x3e242a[_0xa644('0x38')],qs[_0xa644('0x4d')](_0x388e98['query'][_0xa644('0x4d')]));_0x429748[_0xa644('0x3c')]=_0x429748[_0xa644('0x3c')]['length']?_0x429748[_0xa644('0x3c')]:_0x3e242a['model'];_0x429748[_0xa644('0x3e')]=qs[_0xa644('0x3f')](_0x388e98[_0xa644('0x3a')][_0xa644('0x3f')]);_0x429748[_0xa644('0x40')]=qs[_0xa644('0x41')](_[_0xa644('0x42')](_0x388e98[_0xa644('0x3a')],_0x3e242a['filters']));if(_0x388e98[_0xa644('0x3a')][_0xa644('0x44')]){_0x429748[_0xa644('0x40')]=_[_0xa644('0x45')](_0x429748[_0xa644('0x40')],{'$or':_['map'](_0x429748[_0xa644('0x3c')],function(_0x8c6f5c){var _0x3ebcc={};_0x3ebcc[_0x8c6f5c]={'$like':'%'+_0x388e98['query'][_0xa644('0x44')]+'%'};return _0x3ebcc;})});}_0x429748=_['merge']({},_0x429748,_0x388e98['options']);return _0x2969d3[_0xa644('0x56')](_0x429748);}})[_0xa644('0x2d')](function(_0xc0179){if(_0xc0179){_0x3844dc=_0xc0179['length'];if(!_0x388e98[_0xa644('0x3a')][_0xa644('0x57')]('nolimit')){_0x429748['limit']=qs[_0xa644('0x29')](_0x388e98[_0xa644('0x3a')][_0xa644('0x29')]);_0x429748['offset']=qs['offset'](_0x388e98[_0xa644('0x3a')][_0xa644('0x28')]);}return _0x2969d3[_0xa644('0x56')](_0x429748);}})[_0xa644('0x2d')](function(_0x33edc1){if(_0x33edc1){return _0x33edc1?{'count':_0x3844dc,'rows':_0x33edc1}:null;}})[_0xa644('0x2d')](respondWithResult(_0x483277,null))['catch'](handleError(_0x483277,null));};exports['addConfiguration']=function(_0x4a1c44,_0x1979ed,_0x355680){if(_0x4a1c44[_0xa644('0x51')]['id']){delete _0x4a1c44['body']['id'];}return db[_0xa644('0x34')]['findOne']({'where':{'id':_0x4a1c44[_0xa644('0x54')]['id']}})[_0xa644('0x2d')](handleEntityNotFound(_0x1979ed,null))[_0xa644('0x2d')](function(_0x834b9b){if(_0x834b9b){_0x4a1c44[_0xa644('0x51')][_0xa644('0x58')]=_0x834b9b['id'];_0x4a1c44[_0xa644('0x51')][_0xa644('0x59')]=integrations[_0xa644('0x5a')](_0x4a1c44[_0xa644('0x51')][_0xa644('0x5b')],_0x4a1c44[_0xa644('0x51')]['type']);_0x4a1c44[_0xa644('0x51')][_0xa644('0x5c')]=integrations[_0xa644('0x5d')](_0x4a1c44[_0xa644('0x51')][_0xa644('0x5b')],_0x4a1c44[_0xa644('0x51')][_0xa644('0x36')]);return db[_0xa644('0x55')]['create'](_0x4a1c44[_0xa644('0x51')],{'include':[{'model':db[_0xa644('0x5e')],'as':_0xa644('0x59')},{'model':db['ZendeskField'],'as':_0xa644('0x5c')}]});}return null;})['then'](respondWithResult(_0x1979ed,null))[_0xa644('0x4b')](handleError(_0x1979ed,null));};exports[_0xa644('0x5f')]=function(_0xa5b587,_0x9dd13,_0x3a5f2a){var _0x588533='';return db['ZendeskAccount']['findOne']({'where':{'id':_0xa5b587[_0xa644('0x54')]['id']},'attributes':['id','username',_0xa644('0x60'),_0xa644('0x61'),'authType',_0xa644('0x62')]})[_0xa644('0x2d')](handleEntityNotFound(_0x9dd13,null))[_0xa644('0x2d')](function(_0x199cca){if(_0x199cca){_0x588533=_0x199cca[_0xa644('0x62')];var _0x5af5a4=_0x588533['slice'](-0x1);if(_0x5af5a4==='/'){_0x588533=_0x588533['substring'](0x0,_0x588533[_0xa644('0x63')](_0x5af5a4));}var _0x26f604={'method':_0xa644('0x64'),'uri':util[_0xa644('0x65')](_0xa644('0x66'),_0x588533,_0xa644('0x67')),'json':!![]};switch(_0x199cca['authType']){case _0xa644('0x60'):_0x26f604['headers']={'Authorization':util[_0xa644('0x65')](_0xa644('0x68'),new Buffer(util[_0xa644('0x65')](_0xa644('0x69'),_0x199cca[_0xa644('0x6a')],_0x199cca['password']))[_0xa644('0x6b')]('base64'))};break;case _0xa644('0x61'):_0x26f604[_0xa644('0x6c')]={'Authorization':util[_0xa644('0x65')](_0xa644('0x68'),new Buffer(util[_0xa644('0x65')](_0xa644('0x6d'),_0x199cca['username'],_0x199cca[_0xa644('0x61')]))['toString']('base64'))};break;default:throw new db[(_0xa644('0x6e'))][(_0xa644('0x6f'))]('Unknown\x20authentication\x20type');}return rp(_0x26f604);}})[_0xa644('0x2d')](function(_0x50b1d1){if(_0x50b1d1){var _0x5b4800=['subject',_0xa644('0x70'),'group',_0xa644('0x71')];_['remove'](_0x50b1d1[_0xa644('0x67')],function(_0x4752fc){return _0x5b4800[_0xa644('0x72')](_0x4752fc['type']);});return{'count':_0x50b1d1[_0xa644('0x67')][_0xa644('0x4e')],'rows':_[_0xa644('0x33')](_0x50b1d1[_0xa644('0x67')],function(_0x4410db){return{'id':_0x4410db['id'],'name':_0x4410db[_0xa644('0x73')]>0x7?_0x4410db[_0xa644('0x74')]:_0x4410db[_0xa644('0x36')],'custom':_0x4410db[_0xa644('0x73')]>0x7?!![]:![],'options':_0x4410db[_0xa644('0x75')]?_0x4410db[_0xa644('0x75')]:_0x4410db['custom_field_options']?_0x4410db[_0xa644('0x76')]:[]};})};}})['then'](respondWithResult(_0x9dd13,null))[_0xa644('0x4b')](function(_0x550fa5){var _0xe224fb=_0xa5b587[_0xa644('0x3a')][_0xa644('0x77')]?0x1f4:_0x550fa5[_0xa644('0x78')]||0x1f4;logger['error'](_0xa644('0x79'),_0xa644('0x5f'),_0xe224fb,JSON['stringify'](_0x550fa5));delete _0x550fa5['name'];if(_0xe224fb===0x191){_0xe224fb=0x190;}_0x9dd13['status'](_0xe224fb)[_0xa644('0x31')](_0xa5b587[_0xa644('0x3a')][_0xa644('0x77')]?{'message':_0xa644('0x7a'),'statusCode':_0x550fa5['statusCode']}:_0x550fa5);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 82dde32..1604517 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 _0x65d4=['request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','moment','bluebird'];(function(_0x3f6e69,_0x5bf75d){var _0x1e106a=function(_0x11068d){while(--_0x11068d){_0x3f6e69['push'](_0x3f6e69['shift']());}};_0x1e106a(++_0x5bf75d);}(_0x65d4,0xbf));var _0x465d=function(_0x2cdd18,_0x11d1d3){_0x2cdd18=_0x2cdd18-0x0;var _0x3b90ca=_0x65d4[_0x2cdd18];return _0x3b90ca;};'use strict';var _=require('lodash');var util=require(_0x465d('0x0'));var logger=require(_0x465d('0x1'))('api');var moment=require(_0x465d('0x2'));var BPromise=require(_0x465d('0x3'));var rp=require(_0x465d('0x4'));var fs=require('fs');var path=require(_0x465d('0x5'));var rimraf=require('rimraf');var config=require(_0x465d('0x6'));var attributes=require(_0x465d('0x7'));var integrations=require(_0x465d('0x8'));module[_0x465d('0x9')]=function(_0x237576,_0x25bf4d){return _0x237576[_0x465d('0xa')](_0x465d('0xb'),attributes,{'tableName':_0x465d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cec=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount'];(function(_0x36ccb1,_0xfda8d6){var _0x354dbe=function(_0x42a046){while(--_0x42a046){_0x36ccb1['push'](_0x36ccb1['shift']());}};_0x354dbe(++_0xfda8d6);}(_0x0cec,0x152));var _0xc0ce=function(_0x4807a1,_0x19522d){_0x4807a1=_0x4807a1-0x0;var _0x1925e9=_0x0cec[_0x4807a1];return _0x1925e9;};'use strict';var _=require(_0xc0ce('0x0'));var util=require(_0xc0ce('0x1'));var logger=require(_0xc0ce('0x2'))(_0xc0ce('0x3'));var moment=require(_0xc0ce('0x4'));var BPromise=require(_0xc0ce('0x5'));var rp=require(_0xc0ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0ce('0x7'));var config=require(_0xc0ce('0x8'));var attributes=require(_0xc0ce('0x9'));var integrations=require(_0xc0ce('0xa'));module[_0xc0ce('0xb')]=function(_0x3bc050,_0x2aa1cc){return _0x3bc050['define'](_0xc0ce('0xc'),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 62e494b..1f75612 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 _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x2ad351,_0x4ce033){var _0xd5fe1b=function(_0x2987f7){while(--_0x2987f7){_0x2ad351['push'](_0x2ad351['shift']());}};_0xd5fe1b(++_0x4ce033);}(_0xe706,0xa3));var _0x6e70=function(_0x12fec1,_0x20be9c){_0x12fec1=_0x12fec1-0x0;var _0x26c3af=_0xe706[_0x12fec1];return _0x26c3af;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file +var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x157c25,_0x37343d){var _0xf9b45c=function(_0x1a8426){while(--_0x1a8426){_0x157c25['push'](_0x157c25['shift']());}};_0xf9b45c(++_0x37343d);}(_0xe706,0xa3));var _0x6e70=function(_0xe17fa4,_0x5e9a7d){_0xe17fa4=_0xe17fa4-0x0;var _0x51c079=_0xe706[_0xe17fa4];return _0x51c079;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 6733e9b..cb36fcf 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 _0x0ab7=['create','setTags','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post'];(function(_0x8fe1f1,_0x1c9cb9){var _0x4d4f5c=function(_0x539e8c){while(--_0x539e8c){_0x8fe1f1['push'](_0x8fe1f1['shift']());}};_0x4d4f5c(++_0x1c9cb9);}(_0x0ab7,0x9b));var _0x70ab=function(_0x6d0256,_0x4218e4){_0x6d0256=_0x6d0256-0x0;var _0xd353c2=_0x0ab7[_0x6d0256];return _0xd353c2;};'use strict';var multer=require(_0x70ab('0x0'));var util=require(_0x70ab('0x1'));var path=require(_0x70ab('0x2'));var timeout=require(_0x70ab('0x3'));var express=require(_0x70ab('0x4'));var router=express[_0x70ab('0x5')]();var auth=require(_0x70ab('0x6'));var interaction=require(_0x70ab('0x7'));var config=require(_0x70ab('0x8'));var controller=require(_0x70ab('0x9'));router[_0x70ab('0xa')]('/',auth[_0x70ab('0xb')](),controller[_0x70ab('0xc')]);router[_0x70ab('0xa')](_0x70ab('0xd'),auth[_0x70ab('0xb')](),controller[_0x70ab('0xe')]);router['get']('/:id/fields',auth[_0x70ab('0xb')](),controller['getFields']);router[_0x70ab('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x70ab('0xf')]);router[_0x70ab('0xa')](_0x70ab('0x10'),auth[_0x70ab('0xb')](),controller[_0x70ab('0x11')]);router[_0x70ab('0xa')](_0x70ab('0x12'),auth[_0x70ab('0xb')](),controller['getTags']);router[_0x70ab('0x13')]('/',auth[_0x70ab('0xb')](),controller[_0x70ab('0x14')]);router[_0x70ab('0x13')]('/:id/tags',auth[_0x70ab('0xb')](),controller[_0x70ab('0x15')]);router['put'](_0x70ab('0xd'),auth['isAuthenticated'](),controller[_0x70ab('0x16')]);router[_0x70ab('0x17')](_0x70ab('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x70ab('0x18')]=router; \ No newline at end of file +var _0x16d5=['exports','multer','connect-timeout','express','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','put','delete','destroy'];(function(_0x1a5946,_0x426991){var _0x25e9d5=function(_0x44e1ce){while(--_0x44e1ce){_0x1a5946['push'](_0x1a5946['shift']());}};_0x25e9d5(++_0x426991);}(_0x16d5,0x1b6));var _0x516d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16d5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x516d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x516d('0x1'));var express=require(_0x516d('0x2'));var router=express[_0x516d('0x3')]();var auth=require(_0x516d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x516d('0x5'));router[_0x516d('0x6')]('/',auth[_0x516d('0x7')](),controller[_0x516d('0x8')]);router[_0x516d('0x6')](_0x516d('0x9'),auth[_0x516d('0x7')](),controller[_0x516d('0xa')]);router[_0x516d('0x6')](_0x516d('0xb'),auth[_0x516d('0x7')](),controller[_0x516d('0xc')]);router[_0x516d('0x6')](_0x516d('0xd'),auth[_0x516d('0x7')](),controller[_0x516d('0xe')]);router[_0x516d('0x6')]('/:id/descriptions',auth[_0x516d('0x7')](),controller[_0x516d('0xf')]);router[_0x516d('0x6')](_0x516d('0x10'),auth[_0x516d('0x7')](),controller[_0x516d('0x11')]);router[_0x516d('0x12')]('/',auth[_0x516d('0x7')](),controller['create']);router[_0x516d('0x12')](_0x516d('0x10'),auth[_0x516d('0x7')](),controller['setTags']);router[_0x516d('0x13')](_0x516d('0x9'),auth[_0x516d('0x7')](),controller['update']);router[_0x516d('0x14')](_0x516d('0x9'),auth['isAuthenticated'](),controller[_0x516d('0x15')]);module[_0x516d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 30fd28c..814227a 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 _0x0721=['STRING'];(function(_0x24d580,_0x120702){var _0x16d22b=function(_0x8906ce){while(--_0x8906ce){_0x24d580['push'](_0x24d580['shift']());}};_0x16d22b(++_0x120702);}(_0x0721,0x117));var _0x1072=function(_0x25f797,_0x449916){_0x25f797=_0x25f797-0x0;var _0x157fdd=_0x0721[_0x25f797];return _0x157fdd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1072('0x0')]},'description':{'type':Sequelize[_0x1072('0x0')]}}; \ No newline at end of file +var _0x640b=['sequelize','exports','STRING'];(function(_0x1e1033,_0x2f8ecc){var _0x3d5488=function(_0x318dc3){while(--_0x318dc3){_0x1e1033['push'](_0x1e1033['shift']());}};_0x3d5488(++_0x2f8ecc);}(_0x640b,0x16b));var _0xb640=function(_0x198e29,_0x3b8474){_0x198e29=_0x198e29-0x0;var _0x10ccb3=_0x640b[_0x198e29];return _0x10ccb3;};'use strict';var Sequelize=require(_0xb640('0x0'));module[_0xb640('0x1')]={'name':{'type':Sequelize[_0xb640('0x2')]},'description':{'type':Sequelize[_0xb640('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index ce2aac3..05c846c 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 _0xecf6=['mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','length','options','find','create','body','update','params','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xecf6,0xbc));var _0x6ecf=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xecf6[_0x487b0c];return _0x1adbdc;};'use strict';var pdf=require(_0x6ecf('0x0'));var emlformat=require(_0x6ecf('0x1'));var rimraf=require(_0x6ecf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ecf('0x3'));var rp=require('request-promise');var moment=require(_0x6ecf('0x4'));var BPromise=require(_0x6ecf('0x5'));var Mustache=require(_0x6ecf('0x6'));var util=require(_0x6ecf('0x7'));var path=require(_0x6ecf('0x8'));var sox=require(_0x6ecf('0x9'));var csv=require(_0x6ecf('0xa'));var ejs=require(_0x6ecf('0xb'));var fs=require('fs');var _=require(_0x6ecf('0xc'));var squel=require('squel');var crypto=require(_0x6ecf('0xd'));var jsforce=require(_0x6ecf('0xe'));var deskjs=require(_0x6ecf('0xf'));var toCsv=require(_0x6ecf('0xa'));var querystring=require('querystring');var Papa=require(_0x6ecf('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6ecf('0x11'));var as=require(_0x6ecf('0x12'));var hardwareService=require(_0x6ecf('0x13'));var logger=require(_0x6ecf('0x14'))(_0x6ecf('0x15'));var utils=require(_0x6ecf('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6ecf('0x17'));var db=require(_0x6ecf('0x18'))['db'];var jayson=require(_0x6ecf('0x19'));var client=jayson[_0x6ecf('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x468b34,_0x47b06a,_0x1a687a,_0x26549c){return new BPromise(function(_0x53b7fd,_0x137ef0){var _0xf7e730=_0x26549c||client;return _0xf7e730['request'](_0x468b34,_0x1a687a)[_0x6ecf('0x1b')](function(_0x5a40fd){logger[_0x6ecf('0x1c')](_0x6ecf('0x1d'),_0x47b06a,'request\x20sent');logger[_0x6ecf('0x1e')](_0x6ecf('0x1f'),_0x47b06a,_0x6ecf('0x20'),JSON[_0x6ecf('0x21')](_0x5a40fd));if(_0x5a40fd[_0x6ecf('0x22')]){if(_0x5a40fd[_0x6ecf('0x22')][_0x6ecf('0x23')]===0x1f4){logger[_0x6ecf('0x22')](_0x6ecf('0x1d'),_0x47b06a,_0x5a40fd['error'][_0x6ecf('0x24')]);return _0x137ef0(_0x5a40fd[_0x6ecf('0x22')][_0x6ecf('0x24')]);}logger[_0x6ecf('0x22')](_0x6ecf('0x1d'),_0x47b06a,_0x5a40fd['error']['message']);return _0x53b7fd(_0x5a40fd['error']['message']);}else{logger[_0x6ecf('0x1c')](_0x6ecf('0x1d'),_0x47b06a,_0x6ecf('0x20'));_0x53b7fd(_0x5a40fd[_0x6ecf('0x25')]['message']);}})['catch'](function(_0x4fc055){logger[_0x6ecf('0x22')](_0x6ecf('0x1d'),_0x47b06a,_0x4fc055);_0x137ef0(_0x4fc055);});});}function respondWithStatusCode(_0xb8544a,_0x2fda45){_0x2fda45=_0x2fda45||0xcc;return function(_0x246d5c){if(_0x246d5c){return _0xb8544a[_0x6ecf('0x26')](_0x2fda45);}return _0xb8544a[_0x6ecf('0x27')](_0x2fda45)[_0x6ecf('0x28')]();};}function respondWithResult(_0x3cc087,_0x9caf28){_0x9caf28=_0x9caf28||0xc8;return function(_0x4ff7cc){if(_0x4ff7cc){return _0x3cc087[_0x6ecf('0x27')](_0x9caf28)[_0x6ecf('0x29')](_0x4ff7cc);}};}function respondWithFilteredResult(_0x32fc36,_0x527828){return function(_0x3fece2){if(_0x3fece2){var _0x4e47e9=_0x3fece2[_0x6ecf('0x2a')],_0x39d438=_0x527828[_0x6ecf('0x2b')],_0x1f649c=_0x527828[_0x6ecf('0x2b')]+_0x527828[_0x6ecf('0x2c')],_0x5e880c;if(_0x1f649c>=_0x4e47e9){_0x1f649c=_0x4e47e9;_0x5e880c=0xc8;}else{_0x5e880c=0xce;}_0x32fc36[_0x6ecf('0x27')](_0x5e880c);return _0x32fc36[_0x6ecf('0x2d')](_0x6ecf('0x2e'),_0x39d438+'-'+_0x1f649c+'/'+_0x4e47e9)[_0x6ecf('0x29')](_0x3fece2);}return null;};}function patchUpdates(_0x221867){return function(_0x11ab4d){try{jsonpatch['apply'](_0x11ab4d,_0x221867,!![]);}catch(_0x5c0b04){return BPromise[_0x6ecf('0x2f')](_0x5c0b04);}return _0x11ab4d[_0x6ecf('0x30')]();};}function saveUpdates(_0x850153,_0x21a2f0){return function(_0x298c00){if(_0x298c00){return _0x298c00['update'](_0x850153)[_0x6ecf('0x1b')](function(_0xe38943){return _0xe38943;});}return null;};}function removeEntity(_0x370b88,_0x36de4e){return function(_0x1d3ea8){if(_0x1d3ea8){return _0x1d3ea8[_0x6ecf('0x31')]()[_0x6ecf('0x1b')](function(){_0x370b88[_0x6ecf('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x571f8e,_0xe25292){return function(_0x2cb4d7){if(!_0x2cb4d7){_0x571f8e[_0x6ecf('0x26')](0x194);}return _0x2cb4d7;};}function handleError(_0x3904ad,_0x1a0087){_0x1a0087=_0x1a0087||0x1f4;return function(_0xf43747){logger[_0x6ecf('0x22')](_0xf43747[_0x6ecf('0x32')]);if(_0xf43747['name']){delete _0xf43747[_0x6ecf('0x33')];}_0x3904ad['status'](_0x1a0087)[_0x6ecf('0x34')](_0xf43747);};}exports[_0x6ecf('0x35')]=function(_0x4927b6,_0x58e8cf){var _0xcf71c={},_0x9b3663={},_0xd2b890={'count':0x0,'rows':[]};var _0x371023=_[_0x6ecf('0x36')](db[_0x6ecf('0x37')][_0x6ecf('0x38')],function(_0x51b859){return{'name':_0x51b859[_0x6ecf('0x39')],'type':_0x51b859[_0x6ecf('0x3a')][_0x6ecf('0x3b')]};});_0x9b3663[_0x6ecf('0x3c')]=_[_0x6ecf('0x36')](_0x371023,'name');_0x9b3663[_0x6ecf('0x3d')]=_[_0x6ecf('0x3e')](_0x4927b6[_0x6ecf('0x3d')]);_0x9b3663[_0x6ecf('0x3f')]=_[_0x6ecf('0x40')](_0x9b3663[_0x6ecf('0x3c')],_0x9b3663[_0x6ecf('0x3d')]);_0xcf71c[_0x6ecf('0x41')]=_['intersection'](_0x9b3663[_0x6ecf('0x3c')],qs['fields'](_0x4927b6[_0x6ecf('0x3d')][_0x6ecf('0x42')]));_0xcf71c[_0x6ecf('0x41')]=_0xcf71c[_0x6ecf('0x41')]['length']?_0xcf71c[_0x6ecf('0x41')]:_0x9b3663['model'];if(!_0x4927b6[_0x6ecf('0x3d')][_0x6ecf('0x43')](_0x6ecf('0x44'))){_0xcf71c['limit']=qs['limit'](_0x4927b6[_0x6ecf('0x3d')][_0x6ecf('0x2c')]);_0xcf71c['offset']=qs['offset'](_0x4927b6[_0x6ecf('0x3d')][_0x6ecf('0x2b')]);}_0xcf71c[_0x6ecf('0x45')]=qs['sort'](_0x4927b6[_0x6ecf('0x3d')][_0x6ecf('0x46')]);_0xcf71c[_0x6ecf('0x47')]=qs[_0x6ecf('0x3f')](_[_0x6ecf('0x48')](_0x4927b6[_0x6ecf('0x3d')],_0x9b3663[_0x6ecf('0x3f')]),_0x371023);if(_0x4927b6[_0x6ecf('0x3d')][_0x6ecf('0x49')]){_0xcf71c[_0x6ecf('0x47')]=_['merge'](_0xcf71c['where'],{'$or':_[_0x6ecf('0x36')](_0x371023,function(_0x27b783){if(_0x27b783[_0x6ecf('0x3a')]!==_0x6ecf('0x4a')){var _0x4bb7aa={};_0x4bb7aa[_0x27b783[_0x6ecf('0x33')]]={'$like':'%'+_0x4927b6[_0x6ecf('0x3d')][_0x6ecf('0x49')]+'%'};return _0x4bb7aa;}})});}_0xcf71c=_[_0x6ecf('0x4b')]({},_0xcf71c,_0x4927b6['options']);var _0x49ffc1={'where':_0xcf71c[_0x6ecf('0x47')]};return db[_0x6ecf('0x37')]['count'](_0x49ffc1)[_0x6ecf('0x1b')](function(_0x43b085){_0xd2b890['count']=_0x43b085;if(_0x4927b6['query']['includeAll']){_0xcf71c[_0x6ecf('0x4c')]=[{'all':!![]}];}return db[_0x6ecf('0x37')][_0x6ecf('0x4d')](_0xcf71c);})[_0x6ecf('0x1b')](function(_0x34c20a){_0xd2b890[_0x6ecf('0x4e')]=_0x34c20a;return _0xd2b890;})[_0x6ecf('0x1b')](respondWithFilteredResult(_0x58e8cf,_0xcf71c))[_0x6ecf('0x4f')](handleError(_0x58e8cf,null));};exports[_0x6ecf('0x50')]=function(_0x3cd4df,_0x1af3a9){var _0x20134d={'raw':![],'where':{'id':_0x3cd4df['params']['id']}},_0x4b2c2d={};_0x4b2c2d[_0x6ecf('0x3c')]=_[_0x6ecf('0x3e')](db[_0x6ecf('0x37')][_0x6ecf('0x38')]);_0x4b2c2d[_0x6ecf('0x3d')]=_[_0x6ecf('0x3e')](_0x3cd4df[_0x6ecf('0x3d')]);_0x4b2c2d['filters']=_[_0x6ecf('0x40')](_0x4b2c2d[_0x6ecf('0x3c')],_0x4b2c2d[_0x6ecf('0x3d')]);_0x20134d[_0x6ecf('0x41')]=_['intersection'](_0x4b2c2d['model'],qs['fields'](_0x3cd4df['query']['fields']));_0x20134d[_0x6ecf('0x41')]=_0x20134d[_0x6ecf('0x41')][_0x6ecf('0x51')]?_0x20134d[_0x6ecf('0x41')]:_0x4b2c2d[_0x6ecf('0x3c')];if(_0x3cd4df[_0x6ecf('0x3d')]['includeAll']){_0x20134d[_0x6ecf('0x4c')]=[{'all':!![]}];}_0x20134d=_['merge']({},_0x20134d,_0x3cd4df[_0x6ecf('0x52')]);return db['ZendeskConfiguration'][_0x6ecf('0x53')](_0x20134d)['then'](handleEntityNotFound(_0x1af3a9,null))[_0x6ecf('0x1b')](respondWithResult(_0x1af3a9,null))[_0x6ecf('0x4f')](handleError(_0x1af3a9,null));};exports[_0x6ecf('0x54')]=function(_0x322ef1,_0x102c00){return db[_0x6ecf('0x37')][_0x6ecf('0x54')](_0x322ef1[_0x6ecf('0x55')],{})['then'](respondWithResult(_0x102c00,0xc9))['catch'](handleError(_0x102c00,null));};exports[_0x6ecf('0x56')]=function(_0x2df1ee,_0x3840f7){if(_0x2df1ee[_0x6ecf('0x55')]['id']){delete _0x2df1ee[_0x6ecf('0x55')]['id'];}return db[_0x6ecf('0x37')]['find']({'where':{'id':_0x2df1ee[_0x6ecf('0x57')]['id']}})[_0x6ecf('0x1b')](handleEntityNotFound(_0x3840f7,null))['then'](saveUpdates(_0x2df1ee['body'],null))[_0x6ecf('0x1b')](respondWithResult(_0x3840f7,null))['catch'](handleError(_0x3840f7,null));};exports[_0x6ecf('0x31')]=function(_0xf1bcdf,_0x25e156){return db['ZendeskConfiguration'][_0x6ecf('0x53')]({'where':{'id':_0xf1bcdf[_0x6ecf('0x57')]['id']}})[_0x6ecf('0x1b')](handleEntityNotFound(_0x25e156,null))[_0x6ecf('0x1b')](removeEntity(_0x25e156,null))['catch'](handleError(_0x25e156,null));};exports[_0x6ecf('0x58')]=function(_0x3f3af5,_0x574f47,_0x2a8fe6){var _0x315dc3={};var _0x593999={};var _0x2c6daf;var _0x227c3b;return db[_0x6ecf('0x37')][_0x6ecf('0x59')]({'where':{'id':_0x3f3af5['params']['id']}})[_0x6ecf('0x1b')](handleEntityNotFound(_0x574f47,null))['then'](function(_0x13cce8){if(_0x13cce8){_0x2c6daf=_0x13cce8;_0x593999[_0x6ecf('0x3c')]=_[_0x6ecf('0x3e')](db[_0x6ecf('0x5a')][_0x6ecf('0x38')]);_0x593999[_0x6ecf('0x3d')]=_[_0x6ecf('0x3e')](_0x3f3af5[_0x6ecf('0x3d')]);_0x593999[_0x6ecf('0x3f')]=_[_0x6ecf('0x40')](_0x593999[_0x6ecf('0x3c')],_0x593999['query']);_0x315dc3[_0x6ecf('0x41')]=_[_0x6ecf('0x40')](_0x593999[_0x6ecf('0x3c')],qs[_0x6ecf('0x42')](_0x3f3af5[_0x6ecf('0x3d')]['fields']));_0x315dc3[_0x6ecf('0x41')]=_0x315dc3[_0x6ecf('0x41')][_0x6ecf('0x51')]?_0x315dc3[_0x6ecf('0x41')]:_0x593999[_0x6ecf('0x3c')];_0x315dc3[_0x6ecf('0x45')]=qs['sort'](_0x3f3af5['query']['sort']);_0x315dc3[_0x6ecf('0x47')]=qs[_0x6ecf('0x3f')](_['pick'](_0x3f3af5[_0x6ecf('0x3d')],_0x593999[_0x6ecf('0x3f')]));if(_0x3f3af5['query'][_0x6ecf('0x49')]){_0x315dc3[_0x6ecf('0x47')]=_['merge'](_0x315dc3[_0x6ecf('0x47')],{'$or':_[_0x6ecf('0x36')](_0x315dc3[_0x6ecf('0x41')],function(_0x5daa64){var _0x5d595a={};_0x5d595a[_0x5daa64]={'$like':'%'+_0x3f3af5[_0x6ecf('0x3d')][_0x6ecf('0x49')]+'%'};return _0x5d595a;})});}_0x315dc3=_[_0x6ecf('0x4b')]({},_0x315dc3,_0x3f3af5[_0x6ecf('0x52')]);return _0x2c6daf['getFields'](_0x315dc3);}})[_0x6ecf('0x1b')](function(_0x10ebe8){if(_0x10ebe8){_0x227c3b=_0x10ebe8[_0x6ecf('0x51')];if(!_0x3f3af5['query'][_0x6ecf('0x43')]('nolimit')){_0x315dc3[_0x6ecf('0x2c')]=qs[_0x6ecf('0x2c')](_0x3f3af5['query'][_0x6ecf('0x2c')]);_0x315dc3[_0x6ecf('0x2b')]=qs['offset'](_0x3f3af5['query'][_0x6ecf('0x2b')]);}return _0x2c6daf[_0x6ecf('0x58')](_0x315dc3);}})[_0x6ecf('0x1b')](function(_0x2027d6){if(_0x2027d6){return _0x2027d6?{'count':_0x227c3b,'rows':_0x2027d6}:null;}})[_0x6ecf('0x1b')](respondWithResult(_0x574f47,null))['catch'](handleError(_0x574f47,null));};exports[_0x6ecf('0x5b')]=function(_0x222bce,_0x297958,_0x58d03e){var _0x35535c={};var _0x4d23e6={};var _0x4fea10;var _0x554f28;return db['ZendeskConfiguration'][_0x6ecf('0x59')]({'where':{'id':_0x222bce[_0x6ecf('0x57')]['id']}})['then'](handleEntityNotFound(_0x297958,null))[_0x6ecf('0x1b')](function(_0x3fee7f){if(_0x3fee7f){_0x4fea10=_0x3fee7f;_0x4d23e6[_0x6ecf('0x3c')]=_[_0x6ecf('0x3e')](db[_0x6ecf('0x5a')][_0x6ecf('0x38')]);_0x4d23e6[_0x6ecf('0x3d')]=_[_0x6ecf('0x3e')](_0x222bce[_0x6ecf('0x3d')]);_0x4d23e6[_0x6ecf('0x3f')]=_[_0x6ecf('0x40')](_0x4d23e6[_0x6ecf('0x3c')],_0x4d23e6['query']);_0x35535c[_0x6ecf('0x41')]=_['intersection'](_0x4d23e6[_0x6ecf('0x3c')],qs[_0x6ecf('0x42')](_0x222bce[_0x6ecf('0x3d')][_0x6ecf('0x42')]));_0x35535c['attributes']=_0x35535c[_0x6ecf('0x41')][_0x6ecf('0x51')]?_0x35535c[_0x6ecf('0x41')]:_0x4d23e6[_0x6ecf('0x3c')];_0x35535c['order']=qs[_0x6ecf('0x46')](_0x222bce[_0x6ecf('0x3d')]['sort']);_0x35535c['where']=qs['filters'](_['pick'](_0x222bce['query'],_0x4d23e6[_0x6ecf('0x3f')]));if(_0x222bce[_0x6ecf('0x3d')][_0x6ecf('0x49')]){_0x35535c[_0x6ecf('0x47')]=_[_0x6ecf('0x4b')](_0x35535c[_0x6ecf('0x47')],{'$or':_[_0x6ecf('0x36')](_0x35535c[_0x6ecf('0x41')],function(_0x13a1de){var _0x4bf90f={};_0x4bf90f[_0x13a1de]={'$like':'%'+_0x222bce[_0x6ecf('0x3d')][_0x6ecf('0x49')]+'%'};return _0x4bf90f;})});}_0x35535c=_[_0x6ecf('0x4b')]({},_0x35535c,_0x222bce['options']);return _0x4fea10[_0x6ecf('0x5b')](_0x35535c);}})[_0x6ecf('0x1b')](function(_0x26ff15){if(_0x26ff15){_0x554f28=_0x26ff15[_0x6ecf('0x51')];if(!_0x222bce[_0x6ecf('0x3d')][_0x6ecf('0x43')](_0x6ecf('0x44'))){_0x35535c['limit']=qs[_0x6ecf('0x2c')](_0x222bce[_0x6ecf('0x3d')]['limit']);_0x35535c['offset']=qs[_0x6ecf('0x2b')](_0x222bce['query'][_0x6ecf('0x2b')]);}return _0x4fea10[_0x6ecf('0x5b')](_0x35535c);}})[_0x6ecf('0x1b')](function(_0xf3d39){if(_0xf3d39){return _0xf3d39?{'count':_0x554f28,'rows':_0xf3d39}:null;}})[_0x6ecf('0x1b')](respondWithResult(_0x297958,null))[_0x6ecf('0x4f')](handleError(_0x297958,null));};exports[_0x6ecf('0x5c')]=function(_0x5836b2,_0x3b5bf6,_0x422df0){var _0x480ed7={};var _0x145b7d={};var _0x121f5a;var _0x5118f6;return db[_0x6ecf('0x37')][_0x6ecf('0x59')]({'where':{'id':_0x5836b2[_0x6ecf('0x57')]['id']}})['then'](handleEntityNotFound(_0x3b5bf6,null))[_0x6ecf('0x1b')](function(_0xf4dcbd){if(_0xf4dcbd){_0x121f5a=_0xf4dcbd;_0x145b7d[_0x6ecf('0x3c')]=_[_0x6ecf('0x3e')](db[_0x6ecf('0x5a')][_0x6ecf('0x38')]);_0x145b7d[_0x6ecf('0x3d')]=_[_0x6ecf('0x3e')](_0x5836b2[_0x6ecf('0x3d')]);_0x145b7d[_0x6ecf('0x3f')]=_[_0x6ecf('0x40')](_0x145b7d['model'],_0x145b7d[_0x6ecf('0x3d')]);_0x480ed7[_0x6ecf('0x41')]=_[_0x6ecf('0x40')](_0x145b7d[_0x6ecf('0x3c')],qs[_0x6ecf('0x42')](_0x5836b2[_0x6ecf('0x3d')]['fields']));_0x480ed7[_0x6ecf('0x41')]=_0x480ed7['attributes'][_0x6ecf('0x51')]?_0x480ed7[_0x6ecf('0x41')]:_0x145b7d['model'];_0x480ed7[_0x6ecf('0x45')]=qs[_0x6ecf('0x46')](_0x5836b2['query'][_0x6ecf('0x46')]);_0x480ed7[_0x6ecf('0x47')]=qs[_0x6ecf('0x3f')](_[_0x6ecf('0x48')](_0x5836b2[_0x6ecf('0x3d')],_0x145b7d[_0x6ecf('0x3f')]));if(_0x5836b2[_0x6ecf('0x3d')][_0x6ecf('0x49')]){_0x480ed7[_0x6ecf('0x47')]=_[_0x6ecf('0x4b')](_0x480ed7[_0x6ecf('0x47')],{'$or':_[_0x6ecf('0x36')](_0x480ed7['attributes'],function(_0x3ef511){var _0x4dcf2c={};_0x4dcf2c[_0x3ef511]={'$like':'%'+_0x5836b2[_0x6ecf('0x3d')][_0x6ecf('0x49')]+'%'};return _0x4dcf2c;})});}_0x480ed7=_[_0x6ecf('0x4b')]({},_0x480ed7,_0x5836b2['options']);return _0x121f5a[_0x6ecf('0x5c')](_0x480ed7);}})[_0x6ecf('0x1b')](function(_0x2e9c1c){if(_0x2e9c1c){_0x5118f6=_0x2e9c1c[_0x6ecf('0x51')];if(!_0x5836b2['query']['hasOwnProperty'](_0x6ecf('0x44'))){_0x480ed7['limit']=qs[_0x6ecf('0x2c')](_0x5836b2[_0x6ecf('0x3d')][_0x6ecf('0x2c')]);_0x480ed7[_0x6ecf('0x2b')]=qs[_0x6ecf('0x2b')](_0x5836b2[_0x6ecf('0x3d')]['offset']);}return _0x121f5a['getDescriptions'](_0x480ed7);}})[_0x6ecf('0x1b')](function(_0x39d8c0){if(_0x39d8c0){return _0x39d8c0?{'count':_0x5118f6,'rows':_0x39d8c0}:null;}})[_0x6ecf('0x1b')](respondWithResult(_0x3b5bf6,null))[_0x6ecf('0x4f')](handleError(_0x3b5bf6,null));};exports[_0x6ecf('0x5d')]=function(_0x232c1f,_0x543929,_0x9e9a52){var _0x4c15ff={};var _0x17a8f3={};var _0x1dfbbe;var _0x1b82ce;return db['ZendeskConfiguration'][_0x6ecf('0x59')]({'where':{'id':_0x232c1f[_0x6ecf('0x57')]['id']}})[_0x6ecf('0x1b')](handleEntityNotFound(_0x543929,null))[_0x6ecf('0x1b')](function(_0x155ee2){if(_0x155ee2){_0x1dfbbe=_0x155ee2;_0x17a8f3[_0x6ecf('0x3c')]=_['keys'](db[_0x6ecf('0x5e')][_0x6ecf('0x38')]);_0x17a8f3['query']=_['keys'](_0x232c1f[_0x6ecf('0x3d')]);_0x17a8f3[_0x6ecf('0x3f')]=_[_0x6ecf('0x40')](_0x17a8f3[_0x6ecf('0x3c')],_0x17a8f3[_0x6ecf('0x3d')]);_0x4c15ff[_0x6ecf('0x41')]=_[_0x6ecf('0x40')](_0x17a8f3[_0x6ecf('0x3c')],qs[_0x6ecf('0x42')](_0x232c1f['query'][_0x6ecf('0x42')]));_0x4c15ff[_0x6ecf('0x41')]=_0x4c15ff['attributes'][_0x6ecf('0x51')]?_0x4c15ff['attributes']:_0x17a8f3[_0x6ecf('0x3c')];_0x4c15ff[_0x6ecf('0x45')]=qs[_0x6ecf('0x46')](_0x232c1f['query'][_0x6ecf('0x46')]);_0x4c15ff[_0x6ecf('0x47')]=qs[_0x6ecf('0x3f')](_[_0x6ecf('0x48')](_0x232c1f[_0x6ecf('0x3d')],_0x17a8f3['filters']));if(_0x232c1f[_0x6ecf('0x3d')]['filter']){_0x4c15ff['where']=_['merge'](_0x4c15ff[_0x6ecf('0x47')],{'$or':_[_0x6ecf('0x36')](_0x4c15ff['attributes'],function(_0x23769a){var _0x1cf484={};_0x1cf484[_0x23769a]={'$like':'%'+_0x232c1f[_0x6ecf('0x3d')][_0x6ecf('0x49')]+'%'};return _0x1cf484;})});}_0x4c15ff=_[_0x6ecf('0x4b')]({},_0x4c15ff,_0x232c1f[_0x6ecf('0x52')]);return _0x1dfbbe[_0x6ecf('0x5d')](_0x4c15ff);}})[_0x6ecf('0x1b')](function(_0x9c01e0){if(_0x9c01e0){_0x1b82ce=_0x9c01e0[_0x6ecf('0x51')];if(!_0x232c1f[_0x6ecf('0x3d')][_0x6ecf('0x43')]('nolimit')){_0x4c15ff['limit']=qs['limit'](_0x232c1f[_0x6ecf('0x3d')][_0x6ecf('0x2c')]);_0x4c15ff['offset']=qs['offset'](_0x232c1f[_0x6ecf('0x3d')]['offset']);}return _0x1dfbbe[_0x6ecf('0x5d')](_0x4c15ff);}})[_0x6ecf('0x1b')](function(_0xefc43d){if(_0xefc43d){return _0xefc43d?{'count':_0x1b82ce,'rows':_0xefc43d}:null;}})['then'](respondWithResult(_0x543929,null))['catch'](handleError(_0x543929,null));};exports[_0x6ecf('0x5f')]=function(_0x4031be,_0x165a83,_0x119b03){if(_0x4031be[_0x6ecf('0x55')]['id']){delete _0x4031be[_0x6ecf('0x55')]['id'];}return db['ZendeskConfiguration'][_0x6ecf('0x59')]({'where':{'id':_0x4031be[_0x6ecf('0x57')]['id']}})['then'](handleEntityNotFound(_0x165a83,null))[_0x6ecf('0x1b')](function(_0x3f4d0d){if(_0x3f4d0d){return _0x3f4d0d[_0x6ecf('0x5f')](_0x4031be['body'][_0x6ecf('0x60')]||[]);}return null;})[_0x6ecf('0x1b')](respondWithResult(_0x165a83,null))[_0x6ecf('0x4f')](handleError(_0x165a83,null));}; \ No newline at end of file +var _0xe8ed=['intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','update','getFields','findOne','ZendeskField','sort','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','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','http','request','then','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','destroy','stack','name','index','map','ZendeskConfiguration','fieldName','key','model','query','keys','filters'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0xe8ed,0x140));var _0xde8e=function(_0x59a2cb,_0x3cda22){_0x59a2cb=_0x59a2cb-0x0;var _0x2398c1=_0xe8ed[_0x59a2cb];return _0x2398c1;};'use strict';var pdf=require(_0xde8e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xde8e('0x1'));var zipdir=require(_0xde8e('0x2'));var jsonpatch=require(_0xde8e('0x3'));var rp=require(_0xde8e('0x4'));var moment=require(_0xde8e('0x5'));var BPromise=require(_0xde8e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xde8e('0x7'));var sox=require(_0xde8e('0x8'));var csv=require('to-csv');var ejs=require(_0xde8e('0x9'));var fs=require('fs');var _=require(_0xde8e('0xa'));var squel=require(_0xde8e('0xb'));var crypto=require(_0xde8e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xde8e('0xd'));var Papa=require(_0xde8e('0xe'));var Redis=require(_0xde8e('0xf'));var authService=require(_0xde8e('0x10'));var qs=require(_0xde8e('0x11'));var as=require(_0xde8e('0x12'));var hardwareService=require(_0xde8e('0x13'));var logger=require(_0xde8e('0x14'))(_0xde8e('0x15'));var utils=require(_0xde8e('0x16'));var config=require(_0xde8e('0x17'));var licenseUtil=require(_0xde8e('0x18'));var db=require(_0xde8e('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xde8e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x514af9,_0x280084,_0x4b4f08,_0x211f9d){return new BPromise(function(_0x42f37f,_0x1dd6fc){var _0x3efe81=_0x211f9d||client;return _0x3efe81[_0xde8e('0x1b')](_0x514af9,_0x4b4f08)[_0xde8e('0x1c')](function(_0x2b500c){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x280084,_0xde8e('0x1d'));logger[_0xde8e('0x1e')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x280084,_0xde8e('0x1d'),JSON[_0xde8e('0x1f')](_0x2b500c));if(_0x2b500c['error']){if(_0x2b500c[_0xde8e('0x20')][_0xde8e('0x21')]===0x1f4){logger[_0xde8e('0x20')](_0xde8e('0x22'),_0x280084,_0x2b500c['error'][_0xde8e('0x23')]);return _0x1dd6fc(_0x2b500c[_0xde8e('0x20')][_0xde8e('0x23')]);}logger[_0xde8e('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x280084,_0x2b500c[_0xde8e('0x20')][_0xde8e('0x23')]);return _0x42f37f(_0x2b500c[_0xde8e('0x20')][_0xde8e('0x23')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x280084,_0xde8e('0x1d'));_0x42f37f(_0x2b500c[_0xde8e('0x24')][_0xde8e('0x23')]);}})[_0xde8e('0x25')](function(_0x4d3308){logger[_0xde8e('0x20')](_0xde8e('0x22'),_0x280084,_0x4d3308);_0x1dd6fc(_0x4d3308);});});}function respondWithStatusCode(_0x2e5d57,_0x26364f){_0x26364f=_0x26364f||0xcc;return function(_0x43f60a){if(_0x43f60a){return _0x2e5d57[_0xde8e('0x26')](_0x26364f);}return _0x2e5d57['status'](_0x26364f)[_0xde8e('0x27')]();};}function respondWithResult(_0x49b6e2,_0x3d5818){_0x3d5818=_0x3d5818||0xc8;return function(_0x34d647){if(_0x34d647){return _0x49b6e2[_0xde8e('0x28')](_0x3d5818)[_0xde8e('0x29')](_0x34d647);}};}function respondWithFilteredResult(_0x200fee,_0x3e574e){return function(_0x5866fb){if(_0x5866fb){var _0x2544e5=_0x5866fb[_0xde8e('0x2a')],_0x437404=_0x3e574e[_0xde8e('0x2b')],_0x2ee502=_0x3e574e[_0xde8e('0x2b')]+_0x3e574e[_0xde8e('0x2c')],_0x27ee28;if(_0x2ee502>=_0x2544e5){_0x2ee502=_0x2544e5;_0x27ee28=0xc8;}else{_0x27ee28=0xce;}_0x200fee['status'](_0x27ee28);return _0x200fee[_0xde8e('0x2d')](_0xde8e('0x2e'),_0x437404+'-'+_0x2ee502+'/'+_0x2544e5)[_0xde8e('0x29')](_0x5866fb);}return null;};}function patchUpdates(_0x1ac6bb){return function(_0x38d662){try{jsonpatch['apply'](_0x38d662,_0x1ac6bb,!![]);}catch(_0x22d94b){return BPromise[_0xde8e('0x2f')](_0x22d94b);}return _0x38d662['save']();};}function saveUpdates(_0x579625,_0x28c68d){return function(_0x57c8a4){if(_0x57c8a4){return _0x57c8a4['update'](_0x579625)[_0xde8e('0x1c')](function(_0x437d46){return _0x437d46;});}return null;};}function removeEntity(_0x71e72e,_0x2c0608){return function(_0x36f41f){if(_0x36f41f){return _0x36f41f[_0xde8e('0x30')]()[_0xde8e('0x1c')](function(){_0x71e72e[_0xde8e('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47d1f0,_0x51125b){return function(_0x10ed31){if(!_0x10ed31){_0x47d1f0[_0xde8e('0x26')](0x194);}return _0x10ed31;};}function handleError(_0x49a455,_0x3c3f50){_0x3c3f50=_0x3c3f50||0x1f4;return function(_0x2b7781){logger[_0xde8e('0x20')](_0x2b7781[_0xde8e('0x31')]);if(_0x2b7781[_0xde8e('0x32')]){delete _0x2b7781['name'];}_0x49a455[_0xde8e('0x28')](_0x3c3f50)['send'](_0x2b7781);};}exports[_0xde8e('0x33')]=function(_0x10d16f,_0x33a257){var _0x16068b={},_0x43c14a={},_0x544dd0={'count':0x0,'rows':[]};var _0x396a9c=_[_0xde8e('0x34')](db[_0xde8e('0x35')]['rawAttributes'],function(_0x5cfbf8){return{'name':_0x5cfbf8[_0xde8e('0x36')],'type':_0x5cfbf8['type'][_0xde8e('0x37')]};});_0x43c14a[_0xde8e('0x38')]=_['map'](_0x396a9c,_0xde8e('0x32'));_0x43c14a[_0xde8e('0x39')]=_[_0xde8e('0x3a')](_0x10d16f[_0xde8e('0x39')]);_0x43c14a[_0xde8e('0x3b')]=_[_0xde8e('0x3c')](_0x43c14a[_0xde8e('0x38')],_0x43c14a['query']);_0x16068b[_0xde8e('0x3d')]=_[_0xde8e('0x3c')](_0x43c14a[_0xde8e('0x38')],qs['fields'](_0x10d16f[_0xde8e('0x39')][_0xde8e('0x3e')]));_0x16068b[_0xde8e('0x3d')]=_0x16068b['attributes'][_0xde8e('0x3f')]?_0x16068b[_0xde8e('0x3d')]:_0x43c14a[_0xde8e('0x38')];if(!_0x10d16f['query'][_0xde8e('0x40')]('nolimit')){_0x16068b[_0xde8e('0x2c')]=qs[_0xde8e('0x2c')](_0x10d16f[_0xde8e('0x39')][_0xde8e('0x2c')]);_0x16068b[_0xde8e('0x2b')]=qs[_0xde8e('0x2b')](_0x10d16f['query'][_0xde8e('0x2b')]);}_0x16068b[_0xde8e('0x41')]=qs['sort'](_0x10d16f[_0xde8e('0x39')]['sort']);_0x16068b[_0xde8e('0x42')]=qs[_0xde8e('0x3b')](_[_0xde8e('0x43')](_0x10d16f['query'],_0x43c14a[_0xde8e('0x3b')]),_0x396a9c);if(_0x10d16f[_0xde8e('0x39')][_0xde8e('0x44')]){_0x16068b['where']=_[_0xde8e('0x45')](_0x16068b[_0xde8e('0x42')],{'$or':_[_0xde8e('0x34')](_0x396a9c,function(_0x57930a){if(_0x57930a[_0xde8e('0x46')]!==_0xde8e('0x47')){var _0x42317e={};_0x42317e[_0x57930a[_0xde8e('0x32')]]={'$like':'%'+_0x10d16f['query']['filter']+'%'};return _0x42317e;}})});}_0x16068b=_[_0xde8e('0x45')]({},_0x16068b,_0x10d16f[_0xde8e('0x48')]);var _0x2c2068={'where':_0x16068b[_0xde8e('0x42')]};return db['ZendeskConfiguration']['count'](_0x2c2068)[_0xde8e('0x1c')](function(_0x503258){_0x544dd0[_0xde8e('0x2a')]=_0x503258;if(_0x10d16f[_0xde8e('0x39')]['includeAll']){_0x16068b[_0xde8e('0x49')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xde8e('0x4a')](_0x16068b);})[_0xde8e('0x1c')](function(_0x4247c6){_0x544dd0[_0xde8e('0x4b')]=_0x4247c6;return _0x544dd0;})[_0xde8e('0x1c')](respondWithFilteredResult(_0x33a257,_0x16068b))[_0xde8e('0x25')](handleError(_0x33a257,null));};exports[_0xde8e('0x4c')]=function(_0x3098b7,_0x1b6cc0){var _0x5e1424={'raw':![],'where':{'id':_0x3098b7[_0xde8e('0x4d')]['id']}},_0x2f9b1e={};_0x2f9b1e[_0xde8e('0x38')]=_[_0xde8e('0x3a')](db['ZendeskConfiguration'][_0xde8e('0x4e')]);_0x2f9b1e[_0xde8e('0x39')]=_[_0xde8e('0x3a')](_0x3098b7[_0xde8e('0x39')]);_0x2f9b1e['filters']=_[_0xde8e('0x3c')](_0x2f9b1e['model'],_0x2f9b1e[_0xde8e('0x39')]);_0x5e1424[_0xde8e('0x3d')]=_[_0xde8e('0x3c')](_0x2f9b1e['model'],qs[_0xde8e('0x3e')](_0x3098b7[_0xde8e('0x39')]['fields']));_0x5e1424['attributes']=_0x5e1424[_0xde8e('0x3d')]['length']?_0x5e1424[_0xde8e('0x3d')]:_0x2f9b1e[_0xde8e('0x38')];if(_0x3098b7[_0xde8e('0x39')][_0xde8e('0x4f')]){_0x5e1424[_0xde8e('0x49')]=[{'all':!![]}];}_0x5e1424=_[_0xde8e('0x45')]({},_0x5e1424,_0x3098b7[_0xde8e('0x48')]);return db[_0xde8e('0x35')][_0xde8e('0x50')](_0x5e1424)[_0xde8e('0x1c')](handleEntityNotFound(_0x1b6cc0,null))[_0xde8e('0x1c')](respondWithResult(_0x1b6cc0,null))['catch'](handleError(_0x1b6cc0,null));};exports['create']=function(_0x5183d7,_0x443d19){return db[_0xde8e('0x35')][_0xde8e('0x51')](_0x5183d7[_0xde8e('0x52')],{})[_0xde8e('0x1c')](respondWithResult(_0x443d19,0xc9))[_0xde8e('0x25')](handleError(_0x443d19,null));};exports[_0xde8e('0x53')]=function(_0x1dd4c7,_0x55de02){if(_0x1dd4c7[_0xde8e('0x52')]['id']){delete _0x1dd4c7[_0xde8e('0x52')]['id'];}return db['ZendeskConfiguration'][_0xde8e('0x50')]({'where':{'id':_0x1dd4c7[_0xde8e('0x4d')]['id']}})[_0xde8e('0x1c')](handleEntityNotFound(_0x55de02,null))[_0xde8e('0x1c')](saveUpdates(_0x1dd4c7[_0xde8e('0x52')],null))[_0xde8e('0x1c')](respondWithResult(_0x55de02,null))['catch'](handleError(_0x55de02,null));};exports[_0xde8e('0x30')]=function(_0x68bb82,_0x48358d){return db[_0xde8e('0x35')][_0xde8e('0x50')]({'where':{'id':_0x68bb82['params']['id']}})[_0xde8e('0x1c')](handleEntityNotFound(_0x48358d,null))[_0xde8e('0x1c')](removeEntity(_0x48358d,null))[_0xde8e('0x25')](handleError(_0x48358d,null));};exports[_0xde8e('0x54')]=function(_0x15a6ff,_0x458846,_0x3577fd){var _0x469622={};var _0x545a32={};var _0x471dce;var _0x1d0db9;return db[_0xde8e('0x35')][_0xde8e('0x55')]({'where':{'id':_0x15a6ff[_0xde8e('0x4d')]['id']}})[_0xde8e('0x1c')](handleEntityNotFound(_0x458846,null))['then'](function(_0x3365ca){if(_0x3365ca){_0x471dce=_0x3365ca;_0x545a32['model']=_[_0xde8e('0x3a')](db[_0xde8e('0x56')][_0xde8e('0x4e')]);_0x545a32[_0xde8e('0x39')]=_[_0xde8e('0x3a')](_0x15a6ff[_0xde8e('0x39')]);_0x545a32[_0xde8e('0x3b')]=_[_0xde8e('0x3c')](_0x545a32['model'],_0x545a32[_0xde8e('0x39')]);_0x469622[_0xde8e('0x3d')]=_[_0xde8e('0x3c')](_0x545a32[_0xde8e('0x38')],qs['fields'](_0x15a6ff[_0xde8e('0x39')][_0xde8e('0x3e')]));_0x469622['attributes']=_0x469622[_0xde8e('0x3d')][_0xde8e('0x3f')]?_0x469622['attributes']:_0x545a32[_0xde8e('0x38')];_0x469622[_0xde8e('0x41')]=qs[_0xde8e('0x57')](_0x15a6ff[_0xde8e('0x39')][_0xde8e('0x57')]);_0x469622['where']=qs[_0xde8e('0x3b')](_[_0xde8e('0x43')](_0x15a6ff['query'],_0x545a32['filters']));if(_0x15a6ff['query']['filter']){_0x469622[_0xde8e('0x42')]=_[_0xde8e('0x45')](_0x469622['where'],{'$or':_[_0xde8e('0x34')](_0x469622[_0xde8e('0x3d')],function(_0x4730a4){var _0x1340bc={};_0x1340bc[_0x4730a4]={'$like':'%'+_0x15a6ff[_0xde8e('0x39')][_0xde8e('0x44')]+'%'};return _0x1340bc;})});}_0x469622=_[_0xde8e('0x45')]({},_0x469622,_0x15a6ff['options']);return _0x471dce[_0xde8e('0x54')](_0x469622);}})['then'](function(_0x1b9248){if(_0x1b9248){_0x1d0db9=_0x1b9248[_0xde8e('0x3f')];if(!_0x15a6ff[_0xde8e('0x39')]['hasOwnProperty'](_0xde8e('0x58'))){_0x469622['limit']=qs[_0xde8e('0x2c')](_0x15a6ff[_0xde8e('0x39')][_0xde8e('0x2c')]);_0x469622[_0xde8e('0x2b')]=qs['offset'](_0x15a6ff['query'][_0xde8e('0x2b')]);}return _0x471dce[_0xde8e('0x54')](_0x469622);}})[_0xde8e('0x1c')](function(_0x32181c){if(_0x32181c){return _0x32181c?{'count':_0x1d0db9,'rows':_0x32181c}:null;}})[_0xde8e('0x1c')](respondWithResult(_0x458846,null))[_0xde8e('0x25')](handleError(_0x458846,null));};exports[_0xde8e('0x59')]=function(_0x511358,_0x4327a2,_0x3ec7cb){var _0x172a3c={};var _0x53e8a2={};var _0x5aecd4;var _0x26daa4;return db[_0xde8e('0x35')]['findOne']({'where':{'id':_0x511358[_0xde8e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4327a2,null))[_0xde8e('0x1c')](function(_0x2b1892){if(_0x2b1892){_0x5aecd4=_0x2b1892;_0x53e8a2[_0xde8e('0x38')]=_[_0xde8e('0x3a')](db[_0xde8e('0x56')][_0xde8e('0x4e')]);_0x53e8a2[_0xde8e('0x39')]=_['keys'](_0x511358['query']);_0x53e8a2[_0xde8e('0x3b')]=_['intersection'](_0x53e8a2[_0xde8e('0x38')],_0x53e8a2[_0xde8e('0x39')]);_0x172a3c[_0xde8e('0x3d')]=_[_0xde8e('0x3c')](_0x53e8a2[_0xde8e('0x38')],qs[_0xde8e('0x3e')](_0x511358[_0xde8e('0x39')]['fields']));_0x172a3c['attributes']=_0x172a3c[_0xde8e('0x3d')][_0xde8e('0x3f')]?_0x172a3c[_0xde8e('0x3d')]:_0x53e8a2[_0xde8e('0x38')];_0x172a3c[_0xde8e('0x41')]=qs[_0xde8e('0x57')](_0x511358[_0xde8e('0x39')]['sort']);_0x172a3c['where']=qs[_0xde8e('0x3b')](_[_0xde8e('0x43')](_0x511358[_0xde8e('0x39')],_0x53e8a2[_0xde8e('0x3b')]));if(_0x511358['query'][_0xde8e('0x44')]){_0x172a3c[_0xde8e('0x42')]=_['merge'](_0x172a3c['where'],{'$or':_[_0xde8e('0x34')](_0x172a3c[_0xde8e('0x3d')],function(_0x411bfd){var _0x5a03f6={};_0x5a03f6[_0x411bfd]={'$like':'%'+_0x511358[_0xde8e('0x39')]['filter']+'%'};return _0x5a03f6;})});}_0x172a3c=_[_0xde8e('0x45')]({},_0x172a3c,_0x511358[_0xde8e('0x48')]);return _0x5aecd4[_0xde8e('0x59')](_0x172a3c);}})[_0xde8e('0x1c')](function(_0x23b117){if(_0x23b117){_0x26daa4=_0x23b117[_0xde8e('0x3f')];if(!_0x511358['query']['hasOwnProperty']('nolimit')){_0x172a3c['limit']=qs['limit'](_0x511358[_0xde8e('0x39')][_0xde8e('0x2c')]);_0x172a3c[_0xde8e('0x2b')]=qs[_0xde8e('0x2b')](_0x511358[_0xde8e('0x39')]['offset']);}return _0x5aecd4[_0xde8e('0x59')](_0x172a3c);}})[_0xde8e('0x1c')](function(_0x8721b7){if(_0x8721b7){return _0x8721b7?{'count':_0x26daa4,'rows':_0x8721b7}:null;}})['then'](respondWithResult(_0x4327a2,null))[_0xde8e('0x25')](handleError(_0x4327a2,null));};exports[_0xde8e('0x5a')]=function(_0x30f146,_0x19569f,_0xcc1b6c){var _0x59c827={};var _0x59da74={};var _0x3b988d;var _0x3c94ce;return db['ZendeskConfiguration'][_0xde8e('0x55')]({'where':{'id':_0x30f146[_0xde8e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x19569f,null))[_0xde8e('0x1c')](function(_0x23e35f){if(_0x23e35f){_0x3b988d=_0x23e35f;_0x59da74[_0xde8e('0x38')]=_[_0xde8e('0x3a')](db['ZendeskField'][_0xde8e('0x4e')]);_0x59da74[_0xde8e('0x39')]=_[_0xde8e('0x3a')](_0x30f146[_0xde8e('0x39')]);_0x59da74['filters']=_[_0xde8e('0x3c')](_0x59da74[_0xde8e('0x38')],_0x59da74[_0xde8e('0x39')]);_0x59c827[_0xde8e('0x3d')]=_[_0xde8e('0x3c')](_0x59da74['model'],qs[_0xde8e('0x3e')](_0x30f146[_0xde8e('0x39')]['fields']));_0x59c827['attributes']=_0x59c827[_0xde8e('0x3d')][_0xde8e('0x3f')]?_0x59c827['attributes']:_0x59da74['model'];_0x59c827[_0xde8e('0x41')]=qs['sort'](_0x30f146['query']['sort']);_0x59c827['where']=qs[_0xde8e('0x3b')](_[_0xde8e('0x43')](_0x30f146[_0xde8e('0x39')],_0x59da74[_0xde8e('0x3b')]));if(_0x30f146['query'][_0xde8e('0x44')]){_0x59c827['where']=_[_0xde8e('0x45')](_0x59c827[_0xde8e('0x42')],{'$or':_[_0xde8e('0x34')](_0x59c827[_0xde8e('0x3d')],function(_0x324812){var _0x30416f={};_0x30416f[_0x324812]={'$like':'%'+_0x30f146[_0xde8e('0x39')]['filter']+'%'};return _0x30416f;})});}_0x59c827=_['merge']({},_0x59c827,_0x30f146[_0xde8e('0x48')]);return _0x3b988d[_0xde8e('0x5a')](_0x59c827);}})[_0xde8e('0x1c')](function(_0x2911ac){if(_0x2911ac){_0x3c94ce=_0x2911ac[_0xde8e('0x3f')];if(!_0x30f146['query'][_0xde8e('0x40')](_0xde8e('0x58'))){_0x59c827[_0xde8e('0x2c')]=qs[_0xde8e('0x2c')](_0x30f146[_0xde8e('0x39')][_0xde8e('0x2c')]);_0x59c827[_0xde8e('0x2b')]=qs['offset'](_0x30f146[_0xde8e('0x39')]['offset']);}return _0x3b988d[_0xde8e('0x5a')](_0x59c827);}})['then'](function(_0x1235e5){if(_0x1235e5){return _0x1235e5?{'count':_0x3c94ce,'rows':_0x1235e5}:null;}})['then'](respondWithResult(_0x19569f,null))[_0xde8e('0x25')](handleError(_0x19569f,null));};exports['getTags']=function(_0x527a6c,_0xb72a52,_0x4796b3){var _0x16ca09={};var _0x59f540={};var _0x4b5437;var _0x4e47e5;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x527a6c[_0xde8e('0x4d')]['id']}})[_0xde8e('0x1c')](handleEntityNotFound(_0xb72a52,null))[_0xde8e('0x1c')](function(_0x1aee24){if(_0x1aee24){_0x4b5437=_0x1aee24;_0x59f540[_0xde8e('0x38')]=_[_0xde8e('0x3a')](db[_0xde8e('0x5b')][_0xde8e('0x4e')]);_0x59f540['query']=_[_0xde8e('0x3a')](_0x527a6c['query']);_0x59f540[_0xde8e('0x3b')]=_[_0xde8e('0x3c')](_0x59f540[_0xde8e('0x38')],_0x59f540[_0xde8e('0x39')]);_0x16ca09[_0xde8e('0x3d')]=_[_0xde8e('0x3c')](_0x59f540[_0xde8e('0x38')],qs[_0xde8e('0x3e')](_0x527a6c[_0xde8e('0x39')][_0xde8e('0x3e')]));_0x16ca09['attributes']=_0x16ca09['attributes'][_0xde8e('0x3f')]?_0x16ca09[_0xde8e('0x3d')]:_0x59f540[_0xde8e('0x38')];_0x16ca09[_0xde8e('0x41')]=qs[_0xde8e('0x57')](_0x527a6c[_0xde8e('0x39')][_0xde8e('0x57')]);_0x16ca09[_0xde8e('0x42')]=qs['filters'](_[_0xde8e('0x43')](_0x527a6c[_0xde8e('0x39')],_0x59f540[_0xde8e('0x3b')]));if(_0x527a6c[_0xde8e('0x39')][_0xde8e('0x44')]){_0x16ca09[_0xde8e('0x42')]=_[_0xde8e('0x45')](_0x16ca09[_0xde8e('0x42')],{'$or':_[_0xde8e('0x34')](_0x16ca09[_0xde8e('0x3d')],function(_0x53e896){var _0x3f848c={};_0x3f848c[_0x53e896]={'$like':'%'+_0x527a6c[_0xde8e('0x39')][_0xde8e('0x44')]+'%'};return _0x3f848c;})});}_0x16ca09=_[_0xde8e('0x45')]({},_0x16ca09,_0x527a6c[_0xde8e('0x48')]);return _0x4b5437[_0xde8e('0x5c')](_0x16ca09);}})['then'](function(_0x4b54ac){if(_0x4b54ac){_0x4e47e5=_0x4b54ac[_0xde8e('0x3f')];if(!_0x527a6c['query'][_0xde8e('0x40')](_0xde8e('0x58'))){_0x16ca09[_0xde8e('0x2c')]=qs[_0xde8e('0x2c')](_0x527a6c[_0xde8e('0x39')][_0xde8e('0x2c')]);_0x16ca09[_0xde8e('0x2b')]=qs[_0xde8e('0x2b')](_0x527a6c[_0xde8e('0x39')][_0xde8e('0x2b')]);}return _0x4b5437[_0xde8e('0x5c')](_0x16ca09);}})['then'](function(_0x505a97){if(_0x505a97){return _0x505a97?{'count':_0x4e47e5,'rows':_0x505a97}:null;}})[_0xde8e('0x1c')](respondWithResult(_0xb72a52,null))[_0xde8e('0x25')](handleError(_0xb72a52,null));};exports[_0xde8e('0x5d')]=function(_0x5abbd4,_0x506836,_0xa976b5){if(_0x5abbd4[_0xde8e('0x52')]['id']){delete _0x5abbd4[_0xde8e('0x52')]['id'];}return db[_0xde8e('0x35')][_0xde8e('0x55')]({'where':{'id':_0x5abbd4[_0xde8e('0x4d')]['id']}})[_0xde8e('0x1c')](handleEntityNotFound(_0x506836,null))['then'](function(_0x507b78){if(_0x507b78){return _0x507b78[_0xde8e('0x5d')](_0x5abbd4[_0xde8e('0x52')][_0xde8e('0x5e')]||[]);}return null;})[_0xde8e('0x1c')](respondWithResult(_0x506836,null))['catch'](handleError(_0x506836,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6107d84..ea5172c 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 _0x3853=['./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x3853,0xca));var _0x3385=function(_0x1c2138,_0x347892){_0x1c2138=_0x1c2138-0x0;var _0x450d48=_0x3853[_0x1c2138];return _0x450d48;};'use strict';var _=require(_0x3385('0x0'));var util=require(_0x3385('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3385('0x2'));var rp=require(_0x3385('0x3'));var fs=require('fs');var path=require(_0x3385('0x4'));var rimraf=require(_0x3385('0x5'));var config=require(_0x3385('0x6'));var attributes=require(_0x3385('0x7'));module[_0x3385('0x8')]=function(_0x2c8d03,_0x9e3fb6){return _0x2c8d03['define'](_0x3385('0x9'),attributes,{'tableName':_0x3385('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa74d=['util','api','moment','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','lodash'];(function(_0xf59232,_0x548272){var _0x33ae4c=function(_0x32565f){while(--_0x32565f){_0xf59232['push'](_0xf59232['shift']());}};_0x33ae4c(++_0x548272);}(_0xa74d,0x154));var _0xda74=function(_0x64679c,_0xb68c0a){_0x64679c=_0x64679c-0x0;var _0x4b306a=_0xa74d[_0x64679c];return _0x4b306a;};'use strict';var _=require(_0xda74('0x0'));var util=require(_0xda74('0x1'));var logger=require('../../config/logger')(_0xda74('0x2'));var moment=require(_0xda74('0x3'));var BPromise=require(_0xda74('0x4'));var rp=require(_0xda74('0x5'));var fs=require('fs');var path=require(_0xda74('0x6'));var rimraf=require(_0xda74('0x7'));var config=require('../../config/environment');var attributes=require(_0xda74('0x8'));module[_0xda74('0x9')]=function(_0x4a4617,_0x27c9e3){return _0x4a4617['define'](_0xda74('0xa'),attributes,{'tableName':'int_zendesk_configurations','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 85a5ef4..e938c69 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 _0x1f6f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','catch','util','bluebird','randomstring','../../mysqldb'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x1f6f,0x96));var _0xf1f6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1f6f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xf1f6('0x0'));var moment=require('moment');var BPromise=require(_0xf1f6('0x1'));var rs=require(_0xf1f6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf1f6('0x3'))['db'];var utils=require(_0xf1f6('0x4'));var logger=require(_0xf1f6('0x5'))(_0xf1f6('0x6'));var config=require(_0xf1f6('0x7'));var jayson=require(_0xf1f6('0x8'));var client=jayson[_0xf1f6('0x9')][_0xf1f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b7bbb,_0x2fa462,_0x124988){return new BPromise(function(_0x56bc65,_0x51bedf){return client[_0xf1f6('0xb')](_0x3b7bbb,_0x124988)[_0xf1f6('0xc')](function(_0x53c3be){logger[_0xf1f6('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2fa462,_0xf1f6('0xe'));logger[_0xf1f6('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2fa462,_0xf1f6('0xe'),JSON[_0xf1f6('0x10')](_0x53c3be));if(_0x53c3be[_0xf1f6('0x11')]){if(_0x53c3be[_0xf1f6('0x11')][_0xf1f6('0x12')]===0x1f4){logger[_0xf1f6('0x11')](_0xf1f6('0x13'),_0x2fa462,_0x53c3be[_0xf1f6('0x11')][_0xf1f6('0x14')]);return _0x51bedf(_0x53c3be['error']['message']);}logger[_0xf1f6('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2fa462,_0x53c3be[_0xf1f6('0x11')][_0xf1f6('0x14')]);return _0x56bc65(_0x53c3be[_0xf1f6('0x11')][_0xf1f6('0x14')]);}else{logger[_0xf1f6('0xd')](_0xf1f6('0x13'),_0x2fa462,'request\x20sent');_0x56bc65(_0x53c3be['result'][_0xf1f6('0x14')]);}})[_0xf1f6('0x15')](function(_0xa5e4c6){logger[_0xf1f6('0x11')](_0xf1f6('0x13'),_0x2fa462,_0xa5e4c6);_0x51bedf(_0xa5e4c6);});});} \ No newline at end of file +var _0xd20e=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x411dc3,_0x47a8e4){var _0x5b870b=function(_0x5d4bef){while(--_0x5d4bef){_0x411dc3['push'](_0x411dc3['shift']());}};_0x5b870b(++_0x47a8e4);}(_0xd20e,0x198));var _0xed20=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xd20e[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xed20('0x0'));var util=require(_0xed20('0x1'));var moment=require(_0xed20('0x2'));var BPromise=require(_0xed20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed20('0x4'));var db=require(_0xed20('0x5'))['db'];var utils=require(_0xed20('0x6'));var logger=require(_0xed20('0x7'))(_0xed20('0x8'));var config=require('../../config/environment');var jayson=require(_0xed20('0x9'));var client=jayson[_0xed20('0xa')][_0xed20('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dfb95,_0x24b0e1,_0x40e260){return new BPromise(function(_0x31a1ec,_0x1bc984){return client[_0xed20('0xc')](_0x2dfb95,_0x40e260)[_0xed20('0xd')](function(_0x1575c2){logger[_0xed20('0xe')](_0xed20('0xf'),_0x24b0e1,_0xed20('0x10'));logger[_0xed20('0x11')](_0xed20('0x12'),_0x24b0e1,_0xed20('0x10'),JSON[_0xed20('0x13')](_0x1575c2));if(_0x1575c2[_0xed20('0x14')]){if(_0x1575c2[_0xed20('0x14')][_0xed20('0x15')]===0x1f4){logger[_0xed20('0x14')](_0xed20('0xf'),_0x24b0e1,_0x1575c2[_0xed20('0x14')][_0xed20('0x16')]);return _0x1bc984(_0x1575c2[_0xed20('0x14')]['message']);}logger[_0xed20('0x14')](_0xed20('0xf'),_0x24b0e1,_0x1575c2[_0xed20('0x14')][_0xed20('0x16')]);return _0x31a1ec(_0x1575c2['error'][_0xed20('0x16')]);}else{logger[_0xed20('0xe')](_0xed20('0xf'),_0x24b0e1,_0xed20('0x10'));_0x31a1ec(_0x1575c2[_0xed20('0x17')]['message']);}})['catch'](function(_0x577a88){logger[_0xed20('0x14')](_0xed20('0xf'),_0x24b0e1,_0x577a88);_0x1bc984(_0x577a88);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 2d5ef0e..5c89eb4 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 _0x3eb1=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x26d82a,_0x112c76){var _0x31b5a6=function(_0x3fcaf1){while(--_0x3fcaf1){_0x26d82a['push'](_0x26d82a['shift']());}};_0x31b5a6(++_0x112c76);}(_0x3eb1,0xb2));var _0x13eb=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0x3eb1[_0x4fa0ea];return _0x51d027;};'use strict';var multer=require(_0x13eb('0x0'));var util=require(_0x13eb('0x1'));var path=require(_0x13eb('0x2'));var timeout=require(_0x13eb('0x3'));var express=require(_0x13eb('0x4'));var router=express[_0x13eb('0x5')]();var auth=require(_0x13eb('0x6'));var interaction=require(_0x13eb('0x7'));var config=require(_0x13eb('0x8'));var controller=require('./intZendeskField.controller');router[_0x13eb('0x9')]('/',auth[_0x13eb('0xa')](),controller[_0x13eb('0xb')]);router['get']('/:id',auth[_0x13eb('0xa')](),controller[_0x13eb('0xc')]);router[_0x13eb('0xd')]('/',auth['isAuthenticated'](),controller[_0x13eb('0xe')]);router[_0x13eb('0xf')](_0x13eb('0x10'),auth[_0x13eb('0xa')](),controller[_0x13eb('0x11')]);router[_0x13eb('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x13eb('0x13')]);module['exports']=router; \ No newline at end of file +var _0xafe6=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xafe6,0x66));var _0x6afe=function(_0xf68b07,_0x5d5522){_0xf68b07=_0xf68b07-0x0;var _0x1e9b86=_0xafe6[_0xf68b07];return _0x1e9b86;};'use strict';var multer=require(_0x6afe('0x0'));var util=require(_0x6afe('0x1'));var path=require(_0x6afe('0x2'));var timeout=require(_0x6afe('0x3'));var express=require(_0x6afe('0x4'));var router=express['Router']();var auth=require(_0x6afe('0x5'));var interaction=require(_0x6afe('0x6'));var config=require(_0x6afe('0x7'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x6afe('0x8')](),controller['index']);router[_0x6afe('0x9')](_0x6afe('0xa'),auth[_0x6afe('0x8')](),controller[_0x6afe('0xb')]);router[_0x6afe('0xc')]('/',auth['isAuthenticated'](),controller[_0x6afe('0xd')]);router['put'](_0x6afe('0xa'),auth['isAuthenticated'](),controller[_0x6afe('0xe')]);router[_0x6afe('0xf')](_0x6afe('0xa'),auth[_0x6afe('0x8')](),controller[_0x6afe('0x10')]);module[_0x6afe('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d2641d7..d95a0f0 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 _0xaf3e=['sequelize','exports','string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN'];(function(_0x5850c0,_0x3c2c){var _0x113882=function(_0x1d8200){while(--_0x1d8200){_0x5850c0['push'](_0x5850c0['shift']());}};_0x113882(++_0x3c2c);}(_0xaf3e,0xcf));var _0xeaf3=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xaf3e[_0x4fbfd9];return _0x31dc94;};'use strict';var Sequelize=require(_0xeaf3('0x0'));module[_0xeaf3('0x1')]={'type':{'type':Sequelize['ENUM'](_0xeaf3('0x2'),'variable',_0xeaf3('0x3'),_0xeaf3('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xeaf3('0x5')]},'key':{'type':Sequelize[_0xeaf3('0x5')]},'keyType':{'type':Sequelize[_0xeaf3('0x6')](_0xeaf3('0x2'),_0xeaf3('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xeaf3('0x5')]},'idField':{'type':Sequelize[_0xeaf3('0x5')]},'nameField':{'type':Sequelize[_0xeaf3('0x5')]},'customField':{'type':Sequelize[_0xeaf3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xeaf3('0x5')]}}; \ No newline at end of file +var _0x34c6=['ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x2fc791,_0x312b37){var _0x373ce0=function(_0x1e4b24){while(--_0x1e4b24){_0x2fc791['push'](_0x2fc791['shift']());}};_0x373ce0(++_0x312b37);}(_0x34c6,0x1cd));var _0x634c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x34c6[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x634c('0x0'));module['exports']={'type':{'type':Sequelize[_0x634c('0x1')](_0x634c('0x2'),_0x634c('0x3'),_0x634c('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x634c('0x5')]},'key':{'type':Sequelize[_0x634c('0x5')]},'keyType':{'type':Sequelize[_0x634c('0x1')]('string',_0x634c('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x634c('0x5')]},'idField':{'type':Sequelize[_0x634c('0x5')]},'nameField':{'type':Sequelize[_0x634c('0x5')]},'customField':{'type':Sequelize[_0x634c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x634c('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 973ce4f..faa180c 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 _0x1623=['name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ZendeskField','includeAll','include','catch','show','params','create','body','update','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','status','end','json','count','offset','limit','Content-Range','destroy','then','sendStatus','error','stack'];(function(_0x5c6bcb,_0x5bcb30){var _0x19b730=function(_0x3c0b26){while(--_0x3c0b26){_0x5c6bcb['push'](_0x5c6bcb['shift']());}};_0x19b730(++_0x5bcb30);}(_0x1623,0xab));var _0x3162=function(_0x3bc2cd,_0x2abdb2){_0x3bc2cd=_0x3bc2cd-0x0;var _0x304a14=_0x1623[_0x3bc2cd];return _0x304a14;};'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'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x18')](_0x4c3625)[_0x3162('0x19')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x18')](_0x4a393a)[_0x3162('0x1a')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=_0x3d0bea[_0x3162('0x1b')],_0x490371=_0x15e348[_0x3162('0x1c')],_0x78a56c=_0x15e348[_0x3162('0x1c')]+_0x15e348[_0x3162('0x1d')],_0x42cf7d;if(_0x78a56c>=_0x2705d1){_0x78a56c=_0x2705d1;_0x42cf7d=0xc8;}else{_0x42cf7d=0xce;}_0x4b8a3b[_0x3162('0x18')](_0x42cf7d);return _0x4b8a3b['set'](_0x3162('0x1e'),_0x490371+'-'+_0x78a56c+'/'+_0x2705d1)[_0x3162('0x1a')](_0x3d0bea);}return null;};}function patchUpdates(_0x460b7b){return function(_0x36ca97){try{jsonpatch['apply'](_0x36ca97,_0x460b7b,!![]);}catch(_0x1dfd5c){return BPromise['reject'](_0x1dfd5c);}return _0x36ca97['save']();};}function saveUpdates(_0xa5c62b,_0x3e4d23){return function(_0x31946d){if(_0x31946d){return _0x31946d['update'](_0xa5c62b)['then'](function(_0x27133e){return _0x27133e;});}return null;};}function removeEntity(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x1f')]()[_0x3162('0x20')](function(){_0x396372[_0x3162('0x18')](0xcc)[_0x3162('0x19')]();});}};}function handleEntityNotFound(_0x5a4994,_0xd283d6){return function(_0x2433f8){if(!_0x2433f8){_0x5a4994[_0x3162('0x21')](0x194);}return _0x2433f8;};}function handleError(_0x1fd76f,_0x1c9992){_0x1c9992=_0x1c9992||0x1f4;return function(_0x3c543e){logger[_0x3162('0x22')](_0x3c543e[_0x3162('0x23')]);if(_0x3c543e[_0x3162('0x24')]){delete _0x3c543e[_0x3162('0x24')];}_0x1fd76f[_0x3162('0x18')](_0x1c9992)[_0x3162('0x25')](_0x3c543e);};}exports[_0x3162('0x26')]=function(_0x48de45,_0x4025c3){var _0x552469={},_0x37acdd={},_0x31f7fd={'count':0x0,'rows':[]};var _0x10c90b=_['map'](db['ZendeskField'][_0x3162('0x27')],function(_0xaa1f35){return{'name':_0xaa1f35[_0x3162('0x28')],'type':_0xaa1f35[_0x3162('0x29')][_0x3162('0x2a')]};});_0x37acdd['model']=_[_0x3162('0x2b')](_0x10c90b,'name');_0x37acdd[_0x3162('0x2c')]=_[_0x3162('0x2d')](_0x48de45[_0x3162('0x2c')]);_0x37acdd[_0x3162('0x2e')]=_[_0x3162('0x2f')](_0x37acdd[_0x3162('0x30')],_0x37acdd[_0x3162('0x2c')]);_0x552469[_0x3162('0x31')]=_['intersection'](_0x37acdd[_0x3162('0x30')],qs[_0x3162('0x32')](_0x48de45['query'][_0x3162('0x32')]));_0x552469[_0x3162('0x31')]=_0x552469['attributes']['length']?_0x552469[_0x3162('0x31')]:_0x37acdd['model'];if(!_0x48de45[_0x3162('0x2c')][_0x3162('0x33')](_0x3162('0x34'))){_0x552469['limit']=qs['limit'](_0x48de45[_0x3162('0x2c')][_0x3162('0x1d')]);_0x552469['offset']=qs[_0x3162('0x1c')](_0x48de45['query'][_0x3162('0x1c')]);}_0x552469[_0x3162('0x35')]=qs[_0x3162('0x36')](_0x48de45[_0x3162('0x2c')][_0x3162('0x36')]);_0x552469[_0x3162('0x37')]=qs[_0x3162('0x2e')](_[_0x3162('0x38')](_0x48de45[_0x3162('0x2c')],_0x37acdd[_0x3162('0x2e')]),_0x10c90b);if(_0x48de45[_0x3162('0x2c')]['filter']){_0x552469[_0x3162('0x37')]=_[_0x3162('0x39')](_0x552469[_0x3162('0x37')],{'$or':_['map'](_0x10c90b,function(_0x59759d){if(_0x59759d[_0x3162('0x29')]!==_0x3162('0x3a')){var _0x2e1ab5={};_0x2e1ab5[_0x59759d[_0x3162('0x24')]]={'$like':'%'+_0x48de45['query'][_0x3162('0x3b')]+'%'};return _0x2e1ab5;}})});}_0x552469=_['merge']({},_0x552469,_0x48de45['options']);var _0x5dee49={'where':_0x552469[_0x3162('0x37')]};return db[_0x3162('0x3c')][_0x3162('0x1b')](_0x5dee49)['then'](function(_0xbf9e0c){_0x31f7fd[_0x3162('0x1b')]=_0xbf9e0c;if(_0x48de45[_0x3162('0x2c')][_0x3162('0x3d')]){_0x552469[_0x3162('0x3e')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x552469);})[_0x3162('0x20')](function(_0x3783bd){_0x31f7fd['rows']=_0x3783bd;return _0x31f7fd;})['then'](respondWithFilteredResult(_0x4025c3,_0x552469))[_0x3162('0x3f')](handleError(_0x4025c3,null));};exports[_0x3162('0x40')]=function(_0x379756,_0x4883ac){var _0x3502ba={'raw':!![],'where':{'id':_0x379756[_0x3162('0x41')]['id']}},_0x3efd0d={};_0x3efd0d[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3c')][_0x3162('0x27')]);_0x3efd0d['query']=_[_0x3162('0x2d')](_0x379756[_0x3162('0x2c')]);_0x3efd0d['filters']=_[_0x3162('0x2f')](_0x3efd0d[_0x3162('0x30')],_0x3efd0d['query']);_0x3502ba[_0x3162('0x31')]=_['intersection'](_0x3efd0d[_0x3162('0x30')],qs[_0x3162('0x32')](_0x379756[_0x3162('0x2c')][_0x3162('0x32')]));_0x3502ba[_0x3162('0x31')]=_0x3502ba[_0x3162('0x31')]['length']?_0x3502ba[_0x3162('0x31')]:_0x3efd0d[_0x3162('0x30')];if(_0x379756[_0x3162('0x2c')]['includeAll']){_0x3502ba[_0x3162('0x3e')]=[{'all':!![]}];}_0x3502ba=_[_0x3162('0x39')]({},_0x3502ba,_0x379756['options']);return db[_0x3162('0x3c')]['find'](_0x3502ba)['then'](handleEntityNotFound(_0x4883ac,null))['then'](respondWithResult(_0x4883ac,null))[_0x3162('0x3f')](handleError(_0x4883ac,null));};exports[_0x3162('0x42')]=function(_0x2f68a0,_0x2dfc2e){return db[_0x3162('0x3c')][_0x3162('0x42')](_0x2f68a0[_0x3162('0x43')],{})[_0x3162('0x20')](respondWithResult(_0x2dfc2e,0xc9))[_0x3162('0x3f')](handleError(_0x2dfc2e,null));};exports[_0x3162('0x44')]=function(_0x1c81b5,_0x3a167f){if(_0x1c81b5[_0x3162('0x43')]['id']){delete _0x1c81b5['body']['id'];}return db[_0x3162('0x3c')]['find']({'where':{'id':_0x1c81b5['params']['id']}})[_0x3162('0x20')](handleEntityNotFound(_0x3a167f,null))[_0x3162('0x20')](saveUpdates(_0x1c81b5[_0x3162('0x43')],null))[_0x3162('0x20')](respondWithResult(_0x3a167f,null))['catch'](handleError(_0x3a167f,null));};exports[_0x3162('0x1f')]=function(_0x54941b,_0xa11c6e){return db[_0x3162('0x3c')]['find']({'where':{'id':_0x54941b[_0x3162('0x41')]['id']}})['then'](handleEntityNotFound(_0xa11c6e,null))['then'](removeEntity(_0xa11c6e,null))[_0x3162('0x3f')](handleError(_0xa11c6e,null));}; \ No newline at end of file +var _0x0120=['sendStatus','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end'];(function(_0xdd0a6c,_0x417641){var _0x1e9c2d=function(_0x306625){while(--_0x306625){_0xdd0a6c['push'](_0xdd0a6c['shift']());}};_0x1e9c2d(++_0x417641);}(_0x0120,0x6f));var _0x0012=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0120[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x0012('0x0'));var emlformat=require(_0x0012('0x1'));var rimraf=require(_0x0012('0x2'));var zipdir=require(_0x0012('0x3'));var jsonpatch=require(_0x0012('0x4'));var rp=require(_0x0012('0x5'));var moment=require(_0x0012('0x6'));var BPromise=require(_0x0012('0x7'));var Mustache=require(_0x0012('0x8'));var util=require(_0x0012('0x9'));var path=require(_0x0012('0xa'));var sox=require(_0x0012('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0012('0xc'));var crypto=require(_0x0012('0xd'));var jsforce=require(_0x0012('0xe'));var deskjs=require(_0x0012('0xf'));var toCsv=require(_0x0012('0x10'));var querystring=require('querystring');var Papa=require(_0x0012('0x11'));var Redis=require(_0x0012('0x12'));var authService=require(_0x0012('0x13'));var qs=require(_0x0012('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x15'));var logger=require('../../config/logger')(_0x0012('0x16'));var utils=require(_0x0012('0x17'));var config=require(_0x0012('0x18'));var licenseUtil=require(_0x0012('0x19'));var db=require(_0x0012('0x1a'))['db'];function respondWithStatusCode(_0x4d3e7a,_0x6d4a1a){_0x6d4a1a=_0x6d4a1a||0xcc;return function(_0x4f0ee1){if(_0x4f0ee1){return _0x4d3e7a['sendStatus'](_0x6d4a1a);}return _0x4d3e7a['status'](_0x6d4a1a)['end']();};}function respondWithResult(_0x3a7d50,_0x496a2b){_0x496a2b=_0x496a2b||0xc8;return function(_0x3995fd){if(_0x3995fd){return _0x3a7d50[_0x0012('0x1b')](_0x496a2b)['json'](_0x3995fd);}};}function respondWithFilteredResult(_0x24f4ed,_0x1a0c0d){return function(_0x348810){if(_0x348810){var _0x3b8dfc=_0x348810[_0x0012('0x1c')],_0x522e9b=_0x1a0c0d[_0x0012('0x1d')],_0x4e72da=_0x1a0c0d[_0x0012('0x1d')]+_0x1a0c0d[_0x0012('0x1e')],_0x1e7fbe;if(_0x4e72da>=_0x3b8dfc){_0x4e72da=_0x3b8dfc;_0x1e7fbe=0xc8;}else{_0x1e7fbe=0xce;}_0x24f4ed[_0x0012('0x1b')](_0x1e7fbe);return _0x24f4ed[_0x0012('0x1f')](_0x0012('0x20'),_0x522e9b+'-'+_0x4e72da+'/'+_0x3b8dfc)['json'](_0x348810);}return null;};}function patchUpdates(_0x226968){return function(_0x56b0e1){try{jsonpatch['apply'](_0x56b0e1,_0x226968,!![]);}catch(_0x45d00b){return BPromise[_0x0012('0x21')](_0x45d00b);}return _0x56b0e1[_0x0012('0x22')]();};}function saveUpdates(_0x2c837e,_0x53ac2d){return function(_0x4d56ff){if(_0x4d56ff){return _0x4d56ff[_0x0012('0x23')](_0x2c837e)[_0x0012('0x24')](function(_0x35f9ee){return _0x35f9ee;});}return null;};}function removeEntity(_0x7177bc,_0x190f07){return function(_0x2e6a2c){if(_0x2e6a2c){return _0x2e6a2c[_0x0012('0x25')]()[_0x0012('0x24')](function(){_0x7177bc['status'](0xcc)[_0x0012('0x26')]();});}};}function handleEntityNotFound(_0x24a280,_0x4cf4bd){return function(_0x36cf42){if(!_0x36cf42){_0x24a280[_0x0012('0x27')](0x194);}return _0x36cf42;};}function handleError(_0x340622,_0x46c260){_0x46c260=_0x46c260||0x1f4;return function(_0x42bcd7){logger['error'](_0x42bcd7[_0x0012('0x28')]);if(_0x42bcd7[_0x0012('0x29')]){delete _0x42bcd7[_0x0012('0x29')];}_0x340622[_0x0012('0x1b')](_0x46c260)[_0x0012('0x2a')](_0x42bcd7);};}exports[_0x0012('0x2b')]=function(_0x15d48a,_0xf3781e){var _0x300e13={},_0x29a577={},_0x34efc7={'count':0x0,'rows':[]};var _0x20b78f=_[_0x0012('0x2c')](db[_0x0012('0x2d')][_0x0012('0x2e')],function(_0x276389){return{'name':_0x276389[_0x0012('0x2f')],'type':_0x276389[_0x0012('0x30')][_0x0012('0x31')]};});_0x29a577[_0x0012('0x32')]=_[_0x0012('0x2c')](_0x20b78f,'name');_0x29a577[_0x0012('0x33')]=_[_0x0012('0x34')](_0x15d48a['query']);_0x29a577[_0x0012('0x35')]=_[_0x0012('0x36')](_0x29a577[_0x0012('0x32')],_0x29a577[_0x0012('0x33')]);_0x300e13[_0x0012('0x37')]=_['intersection'](_0x29a577[_0x0012('0x32')],qs[_0x0012('0x38')](_0x15d48a[_0x0012('0x33')]['fields']));_0x300e13[_0x0012('0x37')]=_0x300e13[_0x0012('0x37')][_0x0012('0x39')]?_0x300e13[_0x0012('0x37')]:_0x29a577[_0x0012('0x32')];if(!_0x15d48a[_0x0012('0x33')]['hasOwnProperty'](_0x0012('0x3a'))){_0x300e13[_0x0012('0x1e')]=qs[_0x0012('0x1e')](_0x15d48a[_0x0012('0x33')]['limit']);_0x300e13['offset']=qs[_0x0012('0x1d')](_0x15d48a[_0x0012('0x33')][_0x0012('0x1d')]);}_0x300e13[_0x0012('0x3b')]=qs[_0x0012('0x3c')](_0x15d48a[_0x0012('0x33')][_0x0012('0x3c')]);_0x300e13['where']=qs[_0x0012('0x35')](_[_0x0012('0x3d')](_0x15d48a['query'],_0x29a577[_0x0012('0x35')]),_0x20b78f);if(_0x15d48a[_0x0012('0x33')][_0x0012('0x3e')]){_0x300e13[_0x0012('0x3f')]=_[_0x0012('0x40')](_0x300e13[_0x0012('0x3f')],{'$or':_[_0x0012('0x2c')](_0x20b78f,function(_0x4a4af8){if(_0x4a4af8[_0x0012('0x30')]!=='VIRTUAL'){var _0xaf7315={};_0xaf7315[_0x4a4af8['name']]={'$like':'%'+_0x15d48a['query'][_0x0012('0x3e')]+'%'};return _0xaf7315;}})});}_0x300e13=_[_0x0012('0x40')]({},_0x300e13,_0x15d48a[_0x0012('0x41')]);var _0x4e4424={'where':_0x300e13[_0x0012('0x3f')]};return db[_0x0012('0x2d')][_0x0012('0x1c')](_0x4e4424)[_0x0012('0x24')](function(_0x3d81ed){_0x34efc7[_0x0012('0x1c')]=_0x3d81ed;if(_0x15d48a[_0x0012('0x33')][_0x0012('0x42')]){_0x300e13['include']=[{'all':!![]}];}return db[_0x0012('0x2d')][_0x0012('0x43')](_0x300e13);})[_0x0012('0x24')](function(_0x1799f2){_0x34efc7[_0x0012('0x44')]=_0x1799f2;return _0x34efc7;})[_0x0012('0x24')](respondWithFilteredResult(_0xf3781e,_0x300e13))[_0x0012('0x45')](handleError(_0xf3781e,null));};exports['show']=function(_0x56782d,_0x1c54de){var _0x574ece={'raw':!![],'where':{'id':_0x56782d[_0x0012('0x46')]['id']}},_0x10a2df={};_0x10a2df[_0x0012('0x32')]=_[_0x0012('0x34')](db[_0x0012('0x2d')]['rawAttributes']);_0x10a2df[_0x0012('0x33')]=_[_0x0012('0x34')](_0x56782d['query']);_0x10a2df[_0x0012('0x35')]=_[_0x0012('0x36')](_0x10a2df[_0x0012('0x32')],_0x10a2df[_0x0012('0x33')]);_0x574ece['attributes']=_['intersection'](_0x10a2df[_0x0012('0x32')],qs['fields'](_0x56782d[_0x0012('0x33')]['fields']));_0x574ece[_0x0012('0x37')]=_0x574ece[_0x0012('0x37')][_0x0012('0x39')]?_0x574ece[_0x0012('0x37')]:_0x10a2df['model'];if(_0x56782d[_0x0012('0x33')]['includeAll']){_0x574ece[_0x0012('0x47')]=[{'all':!![]}];}_0x574ece=_[_0x0012('0x40')]({},_0x574ece,_0x56782d[_0x0012('0x41')]);return db[_0x0012('0x2d')][_0x0012('0x48')](_0x574ece)[_0x0012('0x24')](handleEntityNotFound(_0x1c54de,null))[_0x0012('0x24')](respondWithResult(_0x1c54de,null))['catch'](handleError(_0x1c54de,null));};exports[_0x0012('0x49')]=function(_0x34d592,_0x2855cd){return db[_0x0012('0x2d')][_0x0012('0x49')](_0x34d592[_0x0012('0x4a')],{})['then'](respondWithResult(_0x2855cd,0xc9))['catch'](handleError(_0x2855cd,null));};exports['update']=function(_0x5b6370,_0x475407){if(_0x5b6370[_0x0012('0x4a')]['id']){delete _0x5b6370[_0x0012('0x4a')]['id'];}return db[_0x0012('0x2d')][_0x0012('0x48')]({'where':{'id':_0x5b6370['params']['id']}})[_0x0012('0x24')](handleEntityNotFound(_0x475407,null))[_0x0012('0x24')](saveUpdates(_0x5b6370[_0x0012('0x4a')],null))[_0x0012('0x24')](respondWithResult(_0x475407,null))[_0x0012('0x45')](handleError(_0x475407,null));};exports[_0x0012('0x25')]=function(_0x156490,_0x26fb2b){return db[_0x0012('0x2d')][_0x0012('0x48')]({'where':{'id':_0x156490[_0x0012('0x46')]['id']}})['then'](handleEntityNotFound(_0x26fb2b,null))[_0x0012('0x24')](removeEntity(_0x26fb2b,null))[_0x0012('0x45')](handleError(_0x26fb2b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index fbfd58f..59fb335 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 _0xd2bf=['path','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','moment','bluebird'];(function(_0x3d2b55,_0x2ad222){var _0x57b5b8=function(_0x21f013){while(--_0x21f013){_0x3d2b55['push'](_0x3d2b55['shift']());}};_0x57b5b8(++_0x2ad222);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd2bf[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xfd2b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfd2b('0x1'));var BPromise=require(_0xfd2b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd2b('0x3'));var rimraf=require('rimraf');var config=require(_0xfd2b('0x4'));var attributes=require(_0xfd2b('0x5'));module[_0xfd2b('0x6')]=function(_0x1abfd2,_0x443190){return _0x1abfd2['define'](_0xfd2b('0x7'),attributes,{'tableName':_0xfd2b('0x8'),'paranoid':![],'indexes':[{'name':_0xfd2b('0x9'),'fields':[_0xfd2b('0xa'),_0xfd2b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf6ed=['lodash','../../config/logger','api','moment','path','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId'];(function(_0xfe32fc,_0x21d79b){var _0x1a63f4=function(_0x350b42){while(--_0x350b42){_0xfe32fc['push'](_0xfe32fc['shift']());}};_0x1a63f4(++_0x21d79b);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x633bc1,_0x2dfa5c){_0x633bc1=_0x633bc1-0x0;var _0x5556d8=_0xf6ed[_0x633bc1];return _0x5556d8;};'use strict';var _=require(_0xdf6e('0x0'));var util=require('util');var logger=require(_0xdf6e('0x1'))(_0xdf6e('0x2'));var moment=require(_0xdf6e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf6e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdf6e('0x5'));module['exports']=function(_0x2a844a,_0x5eb5d1){return _0x2a844a[_0xdf6e('0x6')](_0xdf6e('0x7'),attributes,{'tableName':_0xdf6e('0x8'),'paranoid':![],'indexes':[{'name':_0xdf6e('0x9'),'fields':['idField',_0xdf6e('0xa')],'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 3892631..392f8b3 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 _0x7641=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x44e16f,_0x22136c){var _0x4d76e7=function(_0x30740d){while(--_0x30740d){_0x44e16f['push'](_0x44e16f['shift']());}};_0x4d76e7(++_0x22136c);}(_0x7641,0x162));var _0x1764=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7641[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x1764('0x0'));var util=require(_0x1764('0x1'));var moment=require(_0x1764('0x2'));var BPromise=require(_0x1764('0x3'));var rs=require(_0x1764('0x4'));var fs=require('fs');var Redis=require(_0x1764('0x5'));var db=require(_0x1764('0x6'))['db'];var utils=require(_0x1764('0x7'));var logger=require('../../config/logger')(_0x1764('0x8'));var config=require(_0x1764('0x9'));var jayson=require(_0x1764('0xa'));var client=jayson[_0x1764('0xb')][_0x1764('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1deb34,_0x3a9284,_0x3392e9){return new BPromise(function(_0x8786ef,_0x3d3f98){return client['request'](_0x1deb34,_0x3392e9)[_0x1764('0xd')](function(_0x5d198e){logger[_0x1764('0xe')](_0x1764('0xf'),_0x3a9284,_0x1764('0x10'));logger[_0x1764('0x11')](_0x1764('0x12'),_0x3a9284,_0x1764('0x10'),JSON[_0x1764('0x13')](_0x5d198e));if(_0x5d198e[_0x1764('0x14')]){if(_0x5d198e[_0x1764('0x14')][_0x1764('0x15')]===0x1f4){logger[_0x1764('0x14')](_0x1764('0xf'),_0x3a9284,_0x5d198e[_0x1764('0x14')][_0x1764('0x16')]);return _0x3d3f98(_0x5d198e[_0x1764('0x14')]['message']);}logger[_0x1764('0x14')](_0x1764('0xf'),_0x3a9284,_0x5d198e[_0x1764('0x14')][_0x1764('0x16')]);return _0x8786ef(_0x5d198e[_0x1764('0x14')][_0x1764('0x16')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x3a9284,_0x1764('0x10'));_0x8786ef(_0x5d198e[_0x1764('0x17')][_0x1764('0x16')]);}})[_0x1764('0x18')](function(_0x323346){logger['error'](_0x1764('0xf'),_0x3a9284,_0x323346);_0x3d3f98(_0x323346);});});} \ No newline at end of file +var _0xbf57=['message','result','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5f56d4,_0xe465a8){var _0x119509=function(_0x3abf0c){while(--_0x3abf0c){_0x5f56d4['push'](_0x5f56d4['shift']());}};_0x119509(++_0xe465a8);}(_0xbf57,0x6e));var _0x7bf5=function(_0x27c981,_0x3d0496){_0x27c981=_0x27c981-0x0;var _0x12685d=_0xbf57[_0x27c981];return _0x12685d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7bf5('0x0'));var rs=require(_0x7bf5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bf5('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7bf5('0x3'));var config=require(_0x7bf5('0x4'));var jayson=require(_0x7bf5('0x5'));var client=jayson[_0x7bf5('0x6')][_0x7bf5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x50e996,_0x36c164,_0x4338ff){return new BPromise(function(_0x58e615,_0x474361){return client[_0x7bf5('0x8')](_0x50e996,_0x4338ff)['then'](function(_0x295164){logger[_0x7bf5('0x9')](_0x7bf5('0xa'),_0x36c164,'request\x20sent');logger[_0x7bf5('0xb')](_0x7bf5('0xc'),_0x36c164,_0x7bf5('0xd'),JSON[_0x7bf5('0xe')](_0x295164));if(_0x295164['error']){if(_0x295164[_0x7bf5('0xf')]['code']===0x1f4){logger['error'](_0x7bf5('0xa'),_0x36c164,_0x295164[_0x7bf5('0xf')]['message']);return _0x474361(_0x295164[_0x7bf5('0xf')][_0x7bf5('0x10')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x36c164,_0x295164[_0x7bf5('0xf')][_0x7bf5('0x10')]);return _0x58e615(_0x295164[_0x7bf5('0xf')][_0x7bf5('0x10')]);}else{logger[_0x7bf5('0x9')](_0x7bf5('0xa'),_0x36c164,_0x7bf5('0xd'));_0x58e615(_0x295164[_0x7bf5('0x11')][_0x7bf5('0x10')]);}})['catch'](function(_0x3a215b){logger['error'](_0x7bf5('0xa'),_0x36c164,_0x3a215b);_0x474361(_0x3a215b);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 641a3dc..c6abded 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(_0x2a80b4,_0x8e67bd){var _0x5ebcce=function(_0x1468e0){while(--_0x1468e0){_0x2a80b4['push'](_0x2a80b4['shift']());}};_0x5ebcce(++_0x8e67bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x353f7d,_0x47ac02){var _0xcec763=function(_0x503413){while(--_0x503413){_0x353f7d['push'](_0x353f7d['shift']());}};_0xcec763(++_0x47ac02);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 2007bd6..09df5b6 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 _0x8600=['STRING','exports'];(function(_0x4b2c57,_0x2d8cd9){var _0x10ac0b=function(_0x48de8b){while(--_0x48de8b){_0x4b2c57['push'](_0x4b2c57['shift']());}};_0x10ac0b(++_0x2d8cd9);}(_0x8600,0x19f));var _0x0860=function(_0x261d9e,_0x4f0942){_0x261d9e=_0x261d9e-0x0;var _0x3f8a2c=_0x8600[_0x261d9e];return _0x3f8a2c;};'use strict';var Sequelize=require('sequelize');module[_0x0860('0x0')]={'name':{'type':Sequelize[_0x0860('0x1')]},'description':{'type':Sequelize[_0x0860('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x0860('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x0860('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x0860('0x1')]}}; \ No newline at end of file +var _0xbcdd=['STRING'];(function(_0x3739ab,_0xb7ad04){var _0x558cec=function(_0x320ed9){while(--_0x320ed9){_0x3739ab['push'](_0x3739ab['shift']());}};_0x558cec(++_0xb7ad04);}(_0xbcdd,0x142));var _0xdbcd=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0xbcdd[_0x16bb4b];return _0x8aeb84;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdbcd('0x0')]},'description':{'type':Sequelize[_0xdbcd('0x0')]},'host':{'type':Sequelize[_0xdbcd('0x0')]},'zone':{'type':Sequelize[_0xdbcd('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xdbcd('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xdbcd('0x0')]},'refreshToken':{'type':Sequelize[_0xdbcd('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a844325..681935c 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 _0xc891=['key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','show','params','include','find','create','body','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','ZohoField','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','map','ZohoAccount','rawAttributes','type'];(function(_0x311d38,_0x20f206){var _0x3336ad=function(_0x4ec178){while(--_0x4ec178){_0x311d38['push'](_0x311d38['shift']());}};_0x3336ad(++_0x20f206);}(_0xc891,0x152));var _0x1c89=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xc891[_0x18cd5b];return _0x5eaa52;};'use strict';var pdf=require(_0x1c89('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1c89('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c89('0x2'));var moment=require(_0x1c89('0x3'));var BPromise=require(_0x1c89('0x4'));var Mustache=require('mustache');var util=require(_0x1c89('0x5'));var path=require(_0x1c89('0x6'));var sox=require(_0x1c89('0x7'));var csv=require(_0x1c89('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c89('0x9'));var squel=require(_0x1c89('0xa'));var crypto=require('crypto');var jsforce=require(_0x1c89('0xb'));var deskjs=require(_0x1c89('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1c89('0xd'));var Papa=require('papaparse');var Redis=require(_0x1c89('0xe'));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(_0x1c89('0xf'))('api');var utils=require(_0x1c89('0x10'));var config=require(_0x1c89('0x11'));var licenseUtil=require(_0x1c89('0x12'));var db=require(_0x1c89('0x13'))['db'];var integrations=require(_0x1c89('0x14'));var jayson=require(_0x1c89('0x15'));var client=jayson[_0x1c89('0x16')][_0x1c89('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4c66b9,_0x45d17d,_0x514e4d,_0x46be15){return new BPromise(function(_0x424651,_0x12062e){var _0x4c2d09=_0x46be15||client;return _0x4c2d09[_0x1c89('0x18')](_0x4c66b9,_0x514e4d)[_0x1c89('0x19')](function(_0x2c9572){logger['info'](_0x1c89('0x1a'),_0x45d17d,_0x1c89('0x1b'));logger[_0x1c89('0x1c')](_0x1c89('0x1d'),_0x45d17d,_0x1c89('0x1b'),JSON[_0x1c89('0x1e')](_0x2c9572));if(_0x2c9572[_0x1c89('0x1f')]){if(_0x2c9572[_0x1c89('0x1f')][_0x1c89('0x20')]===0x1f4){logger[_0x1c89('0x1f')](_0x1c89('0x1a'),_0x45d17d,_0x2c9572['error'][_0x1c89('0x21')]);return _0x12062e(_0x2c9572[_0x1c89('0x1f')]['message']);}logger[_0x1c89('0x1f')](_0x1c89('0x1a'),_0x45d17d,_0x2c9572[_0x1c89('0x1f')][_0x1c89('0x21')]);return _0x424651(_0x2c9572['error']['message']);}else{logger[_0x1c89('0x22')](_0x1c89('0x1a'),_0x45d17d,_0x1c89('0x1b'));_0x424651(_0x2c9572[_0x1c89('0x23')]['message']);}})[_0x1c89('0x24')](function(_0x372ed5){logger['error'](_0x1c89('0x1a'),_0x45d17d,_0x372ed5);_0x12062e(_0x372ed5);});});}function respondWithStatusCode(_0x26a1cc,_0x1ac0cc){_0x1ac0cc=_0x1ac0cc||0xcc;return function(_0x479a19){if(_0x479a19){return _0x26a1cc[_0x1c89('0x25')](_0x1ac0cc);}return _0x26a1cc[_0x1c89('0x26')](_0x1ac0cc)[_0x1c89('0x27')]();};}function respondWithResult(_0x59a87e,_0x22afe9){_0x22afe9=_0x22afe9||0xc8;return function(_0x49f69b){if(_0x49f69b){return _0x59a87e['status'](_0x22afe9)[_0x1c89('0x28')](_0x49f69b);}};}function respondWithFilteredResult(_0x352449,_0x4c4694){return function(_0x480d76){if(_0x480d76){var _0x50868f=_0x480d76[_0x1c89('0x29')],_0x1d40e1=_0x4c4694['offset'],_0x5ce91f=_0x4c4694[_0x1c89('0x2a')]+_0x4c4694['limit'],_0x4b37cf;if(_0x5ce91f>=_0x50868f){_0x5ce91f=_0x50868f;_0x4b37cf=0xc8;}else{_0x4b37cf=0xce;}_0x352449['status'](_0x4b37cf);return _0x352449[_0x1c89('0x2b')](_0x1c89('0x2c'),_0x1d40e1+'-'+_0x5ce91f+'/'+_0x50868f)[_0x1c89('0x28')](_0x480d76);}return null;};}function patchUpdates(_0x52b4e8){return function(_0xe662){try{jsonpatch[_0x1c89('0x2d')](_0xe662,_0x52b4e8,!![]);}catch(_0x487916){return BPromise[_0x1c89('0x2e')](_0x487916);}return _0xe662['save']();};}function saveUpdates(_0x13bb07,_0x38679f){return function(_0x1ff398){if(_0x1ff398){return _0x1ff398[_0x1c89('0x2f')](_0x13bb07)[_0x1c89('0x19')](function(_0x204ee2){return _0x204ee2;});}return null;};}function removeEntity(_0x3a0190,_0x4222e7){return function(_0x1c0b67){if(_0x1c0b67){return _0x1c0b67[_0x1c89('0x30')]()['then'](function(){_0x3a0190[_0x1c89('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d42fa,_0x2425c6){return function(_0x1a5af9){if(!_0x1a5af9){_0x4d42fa[_0x1c89('0x25')](0x194);}return _0x1a5af9;};}function handleError(_0xa9e895,_0x1f5b99){_0x1f5b99=_0x1f5b99||0x1f4;return function(_0x1c7ce2){logger[_0x1c89('0x1f')](_0x1c7ce2[_0x1c89('0x31')]);if(_0x1c7ce2[_0x1c89('0x32')]){delete _0x1c7ce2[_0x1c89('0x32')];}_0xa9e895[_0x1c89('0x26')](_0x1f5b99)['send'](_0x1c7ce2);};}exports['index']=function(_0x5bf65f,_0x495a4a){var _0x534693={},_0x3e6923={},_0x238c6d={'count':0x0,'rows':[]};var _0x414635=_[_0x1c89('0x33')](db[_0x1c89('0x34')][_0x1c89('0x35')],function(_0x68fd73){return{'name':_0x68fd73['fieldName'],'type':_0x68fd73[_0x1c89('0x36')][_0x1c89('0x37')]};});_0x3e6923['model']=_[_0x1c89('0x33')](_0x414635,_0x1c89('0x32'));_0x3e6923[_0x1c89('0x38')]=_[_0x1c89('0x39')](_0x5bf65f[_0x1c89('0x38')]);_0x3e6923['filters']=_[_0x1c89('0x3a')](_0x3e6923[_0x1c89('0x3b')],_0x3e6923[_0x1c89('0x38')]);_0x534693['attributes']=_[_0x1c89('0x3a')](_0x3e6923['model'],qs[_0x1c89('0x3c')](_0x5bf65f['query'][_0x1c89('0x3c')]));_0x534693[_0x1c89('0x3d')]=_0x534693[_0x1c89('0x3d')][_0x1c89('0x3e')]?_0x534693[_0x1c89('0x3d')]:_0x3e6923[_0x1c89('0x3b')];if(!_0x5bf65f[_0x1c89('0x38')][_0x1c89('0x3f')](_0x1c89('0x40'))){_0x534693['limit']=qs[_0x1c89('0x41')](_0x5bf65f[_0x1c89('0x38')][_0x1c89('0x41')]);_0x534693[_0x1c89('0x2a')]=qs['offset'](_0x5bf65f[_0x1c89('0x38')][_0x1c89('0x2a')]);}_0x534693[_0x1c89('0x42')]=qs['sort'](_0x5bf65f['query'][_0x1c89('0x43')]);_0x534693[_0x1c89('0x44')]=qs['filters'](_[_0x1c89('0x45')](_0x5bf65f[_0x1c89('0x38')],_0x3e6923[_0x1c89('0x46')]),_0x414635);if(_0x5bf65f[_0x1c89('0x38')][_0x1c89('0x47')]){_0x534693[_0x1c89('0x44')]=_[_0x1c89('0x48')](_0x534693['where'],{'$or':_[_0x1c89('0x33')](_0x414635,function(_0x517da1){if(_0x517da1['type']!==_0x1c89('0x49')){var _0x1ec830={};_0x1ec830[_0x517da1[_0x1c89('0x32')]]={'$like':'%'+_0x5bf65f[_0x1c89('0x38')][_0x1c89('0x47')]+'%'};return _0x1ec830;}})});}_0x534693=_[_0x1c89('0x48')]({},_0x534693,_0x5bf65f[_0x1c89('0x4a')]);var _0x595305={'where':_0x534693[_0x1c89('0x44')]};return db[_0x1c89('0x34')][_0x1c89('0x29')](_0x595305)[_0x1c89('0x19')](function(_0x19858a){_0x238c6d[_0x1c89('0x29')]=_0x19858a;if(_0x5bf65f[_0x1c89('0x38')][_0x1c89('0x4b')]){_0x534693['include']=[{'all':!![]}];}return db[_0x1c89('0x34')]['findAll'](_0x534693);})['then'](function(_0x280c71){_0x238c6d['rows']=_0x280c71;return _0x238c6d;})['then'](respondWithFilteredResult(_0x495a4a,_0x534693))[_0x1c89('0x24')](handleError(_0x495a4a,null));};exports[_0x1c89('0x4c')]=function(_0x5f102d,_0x4c8e9f){var _0x8accfb={'raw':![],'where':{'id':_0x5f102d[_0x1c89('0x4d')]['id']}},_0x5d1ce5={};_0x5d1ce5['model']=_[_0x1c89('0x39')](db['ZohoAccount'][_0x1c89('0x35')]);_0x5d1ce5[_0x1c89('0x38')]=_[_0x1c89('0x39')](_0x5f102d['query']);_0x5d1ce5[_0x1c89('0x46')]=_[_0x1c89('0x3a')](_0x5d1ce5['model'],_0x5d1ce5['query']);_0x8accfb[_0x1c89('0x3d')]=_[_0x1c89('0x3a')](_0x5d1ce5[_0x1c89('0x3b')],qs[_0x1c89('0x3c')](_0x5f102d[_0x1c89('0x38')][_0x1c89('0x3c')]));_0x8accfb[_0x1c89('0x3d')]=_0x8accfb[_0x1c89('0x3d')][_0x1c89('0x3e')]?_0x8accfb[_0x1c89('0x3d')]:_0x5d1ce5[_0x1c89('0x3b')];if(_0x5f102d[_0x1c89('0x38')][_0x1c89('0x4b')]){_0x8accfb[_0x1c89('0x4e')]=[{'all':!![]}];}_0x8accfb=_[_0x1c89('0x48')]({},_0x8accfb,_0x5f102d[_0x1c89('0x4a')]);return db[_0x1c89('0x34')][_0x1c89('0x4f')](_0x8accfb)[_0x1c89('0x19')](handleEntityNotFound(_0x4c8e9f,null))[_0x1c89('0x19')](respondWithResult(_0x4c8e9f,null))['catch'](handleError(_0x4c8e9f,null));};exports[_0x1c89('0x50')]=function(_0x1a2b06,_0x3ef99d){return db[_0x1c89('0x34')][_0x1c89('0x50')](_0x1a2b06[_0x1c89('0x51')],{})[_0x1c89('0x19')](respondWithResult(_0x3ef99d,0xc9))[_0x1c89('0x24')](handleError(_0x3ef99d,null));};exports['update']=function(_0x21964d,_0x34b4d2){if(_0x21964d[_0x1c89('0x51')]['id']){delete _0x21964d['body']['id'];}return db[_0x1c89('0x34')][_0x1c89('0x4f')]({'where':{'id':_0x21964d[_0x1c89('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34b4d2,null))[_0x1c89('0x19')](saveUpdates(_0x21964d[_0x1c89('0x51')],null))['then'](respondWithResult(_0x34b4d2,null))['catch'](handleError(_0x34b4d2,null));};exports['destroy']=function(_0x395a9e,_0x3f6455){return db[_0x1c89('0x34')][_0x1c89('0x4f')]({'where':{'id':_0x395a9e[_0x1c89('0x4d')]['id']}})[_0x1c89('0x19')](handleEntityNotFound(_0x3f6455,null))[_0x1c89('0x19')](removeEntity(_0x3f6455,null))['catch'](handleError(_0x3f6455,null));};exports['getConfigurations']=function(_0x2df550,_0x1d4822,_0x236824){var _0x2cf147={};var _0x391d91={};var _0x38d5e6;var _0x1bdc34;return db[_0x1c89('0x34')][_0x1c89('0x52')]({'where':{'id':_0x2df550[_0x1c89('0x4d')]['id']}})[_0x1c89('0x19')](handleEntityNotFound(_0x1d4822,null))['then'](function(_0x358fcc){if(_0x358fcc){_0x38d5e6=_0x358fcc;_0x391d91[_0x1c89('0x3b')]=_[_0x1c89('0x39')](db[_0x1c89('0x53')][_0x1c89('0x35')]);_0x391d91[_0x1c89('0x38')]=_['keys'](_0x2df550[_0x1c89('0x38')]);_0x391d91[_0x1c89('0x46')]=_[_0x1c89('0x3a')](_0x391d91[_0x1c89('0x3b')],_0x391d91[_0x1c89('0x38')]);_0x2cf147['attributes']=_[_0x1c89('0x3a')](_0x391d91[_0x1c89('0x3b')],qs[_0x1c89('0x3c')](_0x2df550[_0x1c89('0x38')][_0x1c89('0x3c')]));_0x2cf147[_0x1c89('0x3d')]=_0x2cf147[_0x1c89('0x3d')][_0x1c89('0x3e')]?_0x2cf147[_0x1c89('0x3d')]:_0x391d91['model'];_0x2cf147[_0x1c89('0x42')]=qs[_0x1c89('0x43')](_0x2df550[_0x1c89('0x38')][_0x1c89('0x43')]);_0x2cf147['where']=qs[_0x1c89('0x46')](_['pick'](_0x2df550[_0x1c89('0x38')],_0x391d91['filters']));if(_0x2df550[_0x1c89('0x38')][_0x1c89('0x47')]){_0x2cf147[_0x1c89('0x44')]=_[_0x1c89('0x48')](_0x2cf147[_0x1c89('0x44')],{'$or':_[_0x1c89('0x33')](_0x2cf147[_0x1c89('0x3d')],function(_0x410b3b){var _0xa37ee2={};_0xa37ee2[_0x410b3b]={'$like':'%'+_0x2df550[_0x1c89('0x38')][_0x1c89('0x47')]+'%'};return _0xa37ee2;})});}_0x2cf147=_[_0x1c89('0x48')]({},_0x2cf147,_0x2df550[_0x1c89('0x4a')]);return _0x38d5e6[_0x1c89('0x54')](_0x2cf147);}})[_0x1c89('0x19')](function(_0x314c2d){if(_0x314c2d){_0x1bdc34=_0x314c2d[_0x1c89('0x3e')];if(!_0x2df550[_0x1c89('0x38')]['hasOwnProperty'](_0x1c89('0x40'))){_0x2cf147['limit']=qs[_0x1c89('0x41')](_0x2df550[_0x1c89('0x38')][_0x1c89('0x41')]);_0x2cf147[_0x1c89('0x2a')]=qs[_0x1c89('0x2a')](_0x2df550[_0x1c89('0x38')]['offset']);}return _0x38d5e6[_0x1c89('0x54')](_0x2cf147);}})[_0x1c89('0x19')](function(_0x128dd9){if(_0x128dd9){return _0x128dd9?{'count':_0x1bdc34,'rows':_0x128dd9}:null;}})[_0x1c89('0x19')](respondWithResult(_0x1d4822,null))[_0x1c89('0x24')](handleError(_0x1d4822,null));};exports[_0x1c89('0x55')]=function(_0x18eead,_0x2fb0fe,_0x14934a){if(_0x18eead[_0x1c89('0x51')]['id']){delete _0x18eead[_0x1c89('0x51')]['id'];}return db[_0x1c89('0x34')][_0x1c89('0x52')]({'where':{'id':_0x18eead[_0x1c89('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2fb0fe,null))[_0x1c89('0x19')](function(_0xc92dc0){if(_0xc92dc0){_0x18eead['body'][_0x1c89('0x56')]=_0xc92dc0['id'];_0x18eead[_0x1c89('0x51')][_0x1c89('0x57')]=integrations['getSubjects'](_0x18eead[_0x1c89('0x51')]['channel'],_0x18eead[_0x1c89('0x51')][_0x1c89('0x36')]);_0x18eead['body'][_0x1c89('0x58')]=integrations['getDescriptions'](_0x18eead[_0x1c89('0x51')]['channel'],_0x18eead[_0x1c89('0x51')][_0x1c89('0x36')]);return db[_0x1c89('0x53')][_0x1c89('0x50')](_0x18eead[_0x1c89('0x51')],{'include':[{'model':db['ZohoField'],'as':_0x1c89('0x57')},{'model':db[_0x1c89('0x59')],'as':_0x1c89('0x58')}]});}return null;})[_0x1c89('0x19')](respondWithResult(_0x2fb0fe,null))[_0x1c89('0x24')](handleError(_0x2fb0fe,null));};function getAccessToken(_0x553c0e){return new Promise(function(_0x559f9a,_0x4e48a1){var _0x1ddf82;switch(_0x553c0e['zone']){case'US':_0x1ddf82='https://accounts.zoho.com';break;case'AU':_0x1ddf82='https://accounts.zoho.com.au';break;case'EU':_0x1ddf82='https://accounts.zoho.eu';break;case'IN':_0x1ddf82=_0x1c89('0x5a');break;case'CN':_0x1ddf82=_0x1c89('0x5b');break;default:_0x1ddf82=_0x1c89('0x5c');break;}var _0x459056={'method':_0x1c89('0x5d'),'uri':_0x1ddf82+_0x1c89('0x5e'),'qs':{'refresh_token':_0x553c0e['refreshToken'],'client_id':_0x553c0e[_0x1c89('0x5f')],'client_secret':_0x553c0e[_0x1c89('0x60')],'grant_type':_0x1c89('0x61')},'json':!![]};return rp(_0x459056)[_0x1c89('0x19')](function(_0x492498){if(_0x492498[_0x1c89('0x62')]){_0x559f9a(_0x492498[_0x1c89('0x62')]);}else{_0x4e48a1(_0x1c89('0x63'));}})[_0x1c89('0x24')](function(_0x3474d3){_0x4e48a1(_0x3474d3);});});}exports[_0x1c89('0x64')]=function(_0x12da81,_0x252963,_0x3f218b){var _0x4b19e6,_0xf5c9db,_0x14a56a,_0x422e3f,_0x265df9;return db[_0x1c89('0x34')][_0x1c89('0x52')]({'where':{'id':_0x12da81[_0x1c89('0x4d')]['id']},'attributes':['id',_0x1c89('0x65'),_0x1c89('0x66'),_0x1c89('0x5f'),_0x1c89('0x60'),_0x1c89('0x67'),'code','refreshToken']})['then'](handleEntityNotFound(_0x252963,null))[_0x1c89('0x19')](function(_0x6bc2e9){_0x265df9=_0x6bc2e9;_0x4b19e6=_0x265df9[_0x1c89('0x65')];_0xf5c9db=_0x4b19e6==='zoho.eu'?'eu':_0x1c89('0x68');_0x14a56a=_0x265df9[_0x1c89('0x67')];var _0x16f4a2=_0x14a56a[_0x1c89('0x69')](-0x1);if(_0x16f4a2==='/'||_0x16f4a2==='\x5c'||_0x16f4a2===':'){_0x14a56a=_0x14a56a['substring'](0x0,_0x14a56a[_0x1c89('0x6a')](_0x16f4a2));}if(!_0x265df9['refreshToken']){throw new Error(_0x1c89('0x6b'));}return getAccessToken(_0x265df9);})[_0x1c89('0x19')](function(_0x1e1e17){if(_0x1e1e17){return rp({'method':_0x1c89('0x6c'),'uri':util['format'](_0x1c89('0x6d'),_0xf5c9db),'qs':{'module':_0x1c89('0x6e')},'headers':{'Authorization':_0x1c89('0x6f')+_0x1e1e17},'json':!![]});}})[_0x1c89('0x19')](function(_0x563e5d){if(_0x563e5d){if(_0x563e5d[_0x1c89('0x70')]&&_0x563e5d['response'][_0x1c89('0x1f')]){throw new Error(_0x563e5d[_0x1c89('0x70')]['error'][_0x1c89('0x21')]);}var _0x26fb95=[];var _0x4e445c=[];var _0x41add9=['Owner',_0x1c89('0x71'),_0x1c89('0x72'),'WhoId',_0x1c89('0x73'),_0x1c89('0x74'),_0x1c89('0x75'),_0x1c89('0x76')];_0x4e445c=_[_0x1c89('0x77')](_0x563e5d['fields'],function(_0x23b5c8){return _0x41add9[_0x1c89('0x78')](_0x23b5c8['api_name']);});for(var _0x209eec=0x0;_0x209eec<_0x4e445c[_0x1c89('0x3e')];_0x209eec++){if(_0x4e445c[_0x209eec][_0x1c89('0x79')]===![]){_0x26fb95[_0x1c89('0x7a')]({'id':_0x4e445c[_0x209eec]['id'],'name':_0x4e445c[_0x209eec][_0x1c89('0x7b')],'custom':_0x4e445c[_0x209eec][_0x1c89('0x7c')],'options':_0x4e445c[_0x209eec][_0x1c89('0x7d')]===_0x1c89('0x7e')&&_0x4e445c[_0x209eec]['pick_list_values'][_0x1c89('0x3e')]>-0x1?_[_0x1c89('0x33')](_0x4e445c[_0x209eec][_0x1c89('0x7f')],function(_0x5613d1){return{'name':_0x5613d1,'value':_0x5613d1};}):[]});}}return{'count':_0x26fb95[_0x1c89('0x3e')],'rows':_0x26fb95};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x252963,null))[_0x1c89('0x24')](function(_0x2398e6){var _0x266d88=_0x12da81[_0x1c89('0x38')][_0x1c89('0x80')]?0x1f4:_0x2398e6[_0x1c89('0x81')]||0x1f4;logger[_0x1c89('0x1f')](_0x1c89('0x82'),_0x1c89('0x64'),_0x266d88,JSON['stringify'](_0x2398e6));delete _0x2398e6[_0x1c89('0x32')];if(_0x266d88===0x191){_0x266d88=0x190;}_0x252963[_0x1c89('0x26')](_0x266d88)['send'](_0x12da81[_0x1c89('0x38')][_0x1c89('0x80')]?{'message':'Wrong\x20credentials','statusCode':_0x2398e6[_0x1c89('0x81')]}:_0x2398e6);});}; \ No newline at end of file +var _0xf79e=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','ZohoAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','ZohoAccount','includeAll','findAll','rows','show','params','include','create','body','update','find','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','refreshToken','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','desk.js'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xf79e,0x185));var _0xef79=function(_0x1d18eb,_0x44511f){_0x1d18eb=_0x1d18eb-0x0;var _0x1112e1=_0xf79e[_0x1d18eb];return _0x1112e1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xef79('0x0'));var rimraf=require(_0xef79('0x1'));var zipdir=require(_0xef79('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef79('0x3'));var moment=require(_0xef79('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xef79('0x5'));var path=require(_0xef79('0x6'));var sox=require(_0xef79('0x7'));var csv=require(_0xef79('0x8'));var ejs=require(_0xef79('0x9'));var fs=require('fs');var _=require(_0xef79('0xa'));var squel=require('squel');var crypto=require(_0xef79('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xef79('0xc'));var toCsv=require(_0xef79('0x8'));var querystring=require('querystring');var Papa=require(_0xef79('0xd'));var Redis=require(_0xef79('0xe'));var authService=require(_0xef79('0xf'));var qs=require(_0xef79('0x10'));var as=require(_0xef79('0x11'));var hardwareService=require(_0xef79('0x12'));var logger=require(_0xef79('0x13'))(_0xef79('0x14'));var utils=require('../../config/utils');var config=require(_0xef79('0x15'));var licenseUtil=require(_0xef79('0x16'));var db=require(_0xef79('0x17'))['db'];var integrations=require(_0xef79('0x18'));var jayson=require(_0xef79('0x19'));var client=jayson[_0xef79('0x1a')][_0xef79('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x25ddf4,_0x1d0dbf,_0x353e76,_0x4bc3ac){return new BPromise(function(_0x561b3b,_0x54f93e){var _0x499738=_0x4bc3ac||client;return _0x499738[_0xef79('0x1c')](_0x25ddf4,_0x353e76)[_0xef79('0x1d')](function(_0xfbbcfe){logger[_0xef79('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x1d0dbf,_0xef79('0x1f'));logger[_0xef79('0x20')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x1d0dbf,_0xef79('0x1f'),JSON[_0xef79('0x21')](_0xfbbcfe));if(_0xfbbcfe[_0xef79('0x22')]){if(_0xfbbcfe[_0xef79('0x22')]['code']===0x1f4){logger[_0xef79('0x22')]('ZohoAccount,\x20%s,\x20%s',_0x1d0dbf,_0xfbbcfe[_0xef79('0x22')][_0xef79('0x23')]);return _0x54f93e(_0xfbbcfe[_0xef79('0x22')]['message']);}logger[_0xef79('0x22')](_0xef79('0x24'),_0x1d0dbf,_0xfbbcfe['error']['message']);return _0x561b3b(_0xfbbcfe[_0xef79('0x22')][_0xef79('0x23')]);}else{logger['info'](_0xef79('0x24'),_0x1d0dbf,_0xef79('0x1f'));_0x561b3b(_0xfbbcfe[_0xef79('0x25')]['message']);}})[_0xef79('0x26')](function(_0x4ed6ad){logger['error'](_0xef79('0x24'),_0x1d0dbf,_0x4ed6ad);_0x54f93e(_0x4ed6ad);});});}function respondWithStatusCode(_0x196672,_0x48b3f3){_0x48b3f3=_0x48b3f3||0xcc;return function(_0x172522){if(_0x172522){return _0x196672[_0xef79('0x27')](_0x48b3f3);}return _0x196672[_0xef79('0x28')](_0x48b3f3)[_0xef79('0x29')]();};}function respondWithResult(_0x5b4017,_0xa0efa7){_0xa0efa7=_0xa0efa7||0xc8;return function(_0x1d9220){if(_0x1d9220){return _0x5b4017[_0xef79('0x28')](_0xa0efa7)[_0xef79('0x2a')](_0x1d9220);}};}function respondWithFilteredResult(_0x5c9d06,_0x38ec60){return function(_0x52c241){if(_0x52c241){var _0x395674=_0x52c241[_0xef79('0x2b')],_0x5b9568=_0x38ec60[_0xef79('0x2c')],_0x102d6f=_0x38ec60[_0xef79('0x2c')]+_0x38ec60[_0xef79('0x2d')],_0xadbb5a;if(_0x102d6f>=_0x395674){_0x102d6f=_0x395674;_0xadbb5a=0xc8;}else{_0xadbb5a=0xce;}_0x5c9d06[_0xef79('0x28')](_0xadbb5a);return _0x5c9d06[_0xef79('0x2e')]('Content-Range',_0x5b9568+'-'+_0x102d6f+'/'+_0x395674)[_0xef79('0x2a')](_0x52c241);}return null;};}function patchUpdates(_0x4b0d0d){return function(_0x174eeb){try{jsonpatch[_0xef79('0x2f')](_0x174eeb,_0x4b0d0d,!![]);}catch(_0x22904e){return BPromise[_0xef79('0x30')](_0x22904e);}return _0x174eeb[_0xef79('0x31')]();};}function saveUpdates(_0x3bb745,_0x2d70ce){return function(_0x2b09c0){if(_0x2b09c0){return _0x2b09c0['update'](_0x3bb745)[_0xef79('0x1d')](function(_0x5b8b70){return _0x5b8b70;});}return null;};}function removeEntity(_0x100978,_0x3efb8c){return function(_0xebb64f){if(_0xebb64f){return _0xebb64f[_0xef79('0x32')]()[_0xef79('0x1d')](function(){_0x100978['status'](0xcc)[_0xef79('0x29')]();});}};}function handleEntityNotFound(_0x11613a,_0x35f3ae){return function(_0x29018e){if(!_0x29018e){_0x11613a[_0xef79('0x27')](0x194);}return _0x29018e;};}function handleError(_0x369e1f,_0x12648c){_0x12648c=_0x12648c||0x1f4;return function(_0x360b28){logger[_0xef79('0x22')](_0x360b28[_0xef79('0x33')]);if(_0x360b28[_0xef79('0x34')]){delete _0x360b28[_0xef79('0x34')];}_0x369e1f[_0xef79('0x28')](_0x12648c)[_0xef79('0x35')](_0x360b28);};}exports[_0xef79('0x36')]=function(_0x1ee5d1,_0x34037a){var _0x424f87={},_0xec323d={},_0x565cf1={'count':0x0,'rows':[]};var _0x4c1584=_[_0xef79('0x37')](db['ZohoAccount'][_0xef79('0x38')],function(_0x4843b6){return{'name':_0x4843b6[_0xef79('0x39')],'type':_0x4843b6[_0xef79('0x3a')]['key']};});_0xec323d[_0xef79('0x3b')]=_['map'](_0x4c1584,'name');_0xec323d['query']=_[_0xef79('0x3c')](_0x1ee5d1[_0xef79('0x3d')]);_0xec323d[_0xef79('0x3e')]=_[_0xef79('0x3f')](_0xec323d[_0xef79('0x3b')],_0xec323d[_0xef79('0x3d')]);_0x424f87[_0xef79('0x40')]=_[_0xef79('0x3f')](_0xec323d[_0xef79('0x3b')],qs[_0xef79('0x41')](_0x1ee5d1[_0xef79('0x3d')]['fields']));_0x424f87['attributes']=_0x424f87[_0xef79('0x40')][_0xef79('0x42')]?_0x424f87[_0xef79('0x40')]:_0xec323d['model'];if(!_0x1ee5d1[_0xef79('0x3d')][_0xef79('0x43')]('nolimit')){_0x424f87[_0xef79('0x2d')]=qs[_0xef79('0x2d')](_0x1ee5d1[_0xef79('0x3d')][_0xef79('0x2d')]);_0x424f87[_0xef79('0x2c')]=qs[_0xef79('0x2c')](_0x1ee5d1['query'][_0xef79('0x2c')]);}_0x424f87[_0xef79('0x44')]=qs['sort'](_0x1ee5d1[_0xef79('0x3d')][_0xef79('0x45')]);_0x424f87['where']=qs[_0xef79('0x3e')](_[_0xef79('0x46')](_0x1ee5d1[_0xef79('0x3d')],_0xec323d[_0xef79('0x3e')]),_0x4c1584);if(_0x1ee5d1[_0xef79('0x3d')][_0xef79('0x47')]){_0x424f87['where']=_['merge'](_0x424f87[_0xef79('0x48')],{'$or':_[_0xef79('0x37')](_0x4c1584,function(_0x1e4daf){if(_0x1e4daf['type']!==_0xef79('0x49')){var _0x5d86e5={};_0x5d86e5[_0x1e4daf['name']]={'$like':'%'+_0x1ee5d1['query'][_0xef79('0x47')]+'%'};return _0x5d86e5;}})});}_0x424f87=_[_0xef79('0x4a')]({},_0x424f87,_0x1ee5d1[_0xef79('0x4b')]);var _0x48f0a0={'where':_0x424f87[_0xef79('0x48')]};return db[_0xef79('0x4c')][_0xef79('0x2b')](_0x48f0a0)[_0xef79('0x1d')](function(_0x41053a){_0x565cf1[_0xef79('0x2b')]=_0x41053a;if(_0x1ee5d1[_0xef79('0x3d')][_0xef79('0x4d')]){_0x424f87['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xef79('0x4e')](_0x424f87);})[_0xef79('0x1d')](function(_0x2e9bbf){_0x565cf1[_0xef79('0x4f')]=_0x2e9bbf;return _0x565cf1;})[_0xef79('0x1d')](respondWithFilteredResult(_0x34037a,_0x424f87))[_0xef79('0x26')](handleError(_0x34037a,null));};exports[_0xef79('0x50')]=function(_0x400f9a,_0x47c9a9){var _0x4fbdde={'raw':![],'where':{'id':_0x400f9a[_0xef79('0x51')]['id']}},_0x5ab7dc={};_0x5ab7dc[_0xef79('0x3b')]=_['keys'](db[_0xef79('0x4c')][_0xef79('0x38')]);_0x5ab7dc[_0xef79('0x3d')]=_['keys'](_0x400f9a[_0xef79('0x3d')]);_0x5ab7dc['filters']=_[_0xef79('0x3f')](_0x5ab7dc[_0xef79('0x3b')],_0x5ab7dc[_0xef79('0x3d')]);_0x4fbdde['attributes']=_[_0xef79('0x3f')](_0x5ab7dc['model'],qs[_0xef79('0x41')](_0x400f9a[_0xef79('0x3d')][_0xef79('0x41')]));_0x4fbdde['attributes']=_0x4fbdde[_0xef79('0x40')][_0xef79('0x42')]?_0x4fbdde[_0xef79('0x40')]:_0x5ab7dc['model'];if(_0x400f9a[_0xef79('0x3d')]['includeAll']){_0x4fbdde[_0xef79('0x52')]=[{'all':!![]}];}_0x4fbdde=_[_0xef79('0x4a')]({},_0x4fbdde,_0x400f9a['options']);return db[_0xef79('0x4c')]['find'](_0x4fbdde)[_0xef79('0x1d')](handleEntityNotFound(_0x47c9a9,null))[_0xef79('0x1d')](respondWithResult(_0x47c9a9,null))[_0xef79('0x26')](handleError(_0x47c9a9,null));};exports[_0xef79('0x53')]=function(_0xdababe,_0x156702){return db[_0xef79('0x4c')][_0xef79('0x53')](_0xdababe[_0xef79('0x54')],{})[_0xef79('0x1d')](respondWithResult(_0x156702,0xc9))[_0xef79('0x26')](handleError(_0x156702,null));};exports[_0xef79('0x55')]=function(_0x34b17c,_0x336df7){if(_0x34b17c[_0xef79('0x54')]['id']){delete _0x34b17c[_0xef79('0x54')]['id'];}return db[_0xef79('0x4c')][_0xef79('0x56')]({'where':{'id':_0x34b17c[_0xef79('0x51')]['id']}})['then'](handleEntityNotFound(_0x336df7,null))[_0xef79('0x1d')](saveUpdates(_0x34b17c[_0xef79('0x54')],null))[_0xef79('0x1d')](respondWithResult(_0x336df7,null))[_0xef79('0x26')](handleError(_0x336df7,null));};exports[_0xef79('0x32')]=function(_0x5b78c5,_0x143bfc){return db[_0xef79('0x4c')][_0xef79('0x56')]({'where':{'id':_0x5b78c5['params']['id']}})[_0xef79('0x1d')](handleEntityNotFound(_0x143bfc,null))[_0xef79('0x1d')](removeEntity(_0x143bfc,null))['catch'](handleError(_0x143bfc,null));};exports['getConfigurations']=function(_0x3b0253,_0x114414,_0x990d86){var _0x4d6803={};var _0x12522b={};var _0x431945;var _0x40a0f5;return db['ZohoAccount'][_0xef79('0x57')]({'where':{'id':_0x3b0253['params']['id']}})['then'](handleEntityNotFound(_0x114414,null))[_0xef79('0x1d')](function(_0xdf24d8){if(_0xdf24d8){_0x431945=_0xdf24d8;_0x12522b['model']=_['keys'](db[_0xef79('0x58')][_0xef79('0x38')]);_0x12522b[_0xef79('0x3d')]=_[_0xef79('0x3c')](_0x3b0253[_0xef79('0x3d')]);_0x12522b[_0xef79('0x3e')]=_['intersection'](_0x12522b[_0xef79('0x3b')],_0x12522b['query']);_0x4d6803[_0xef79('0x40')]=_[_0xef79('0x3f')](_0x12522b[_0xef79('0x3b')],qs[_0xef79('0x41')](_0x3b0253[_0xef79('0x3d')][_0xef79('0x41')]));_0x4d6803[_0xef79('0x40')]=_0x4d6803[_0xef79('0x40')][_0xef79('0x42')]?_0x4d6803[_0xef79('0x40')]:_0x12522b[_0xef79('0x3b')];_0x4d6803[_0xef79('0x44')]=qs['sort'](_0x3b0253[_0xef79('0x3d')][_0xef79('0x45')]);_0x4d6803[_0xef79('0x48')]=qs[_0xef79('0x3e')](_[_0xef79('0x46')](_0x3b0253['query'],_0x12522b['filters']));if(_0x3b0253[_0xef79('0x3d')][_0xef79('0x47')]){_0x4d6803[_0xef79('0x48')]=_[_0xef79('0x4a')](_0x4d6803['where'],{'$or':_[_0xef79('0x37')](_0x4d6803[_0xef79('0x40')],function(_0x3b1427){var _0x1103ab={};_0x1103ab[_0x3b1427]={'$like':'%'+_0x3b0253[_0xef79('0x3d')][_0xef79('0x47')]+'%'};return _0x1103ab;})});}_0x4d6803=_[_0xef79('0x4a')]({},_0x4d6803,_0x3b0253[_0xef79('0x4b')]);return _0x431945[_0xef79('0x59')](_0x4d6803);}})[_0xef79('0x1d')](function(_0x2f9af4){if(_0x2f9af4){_0x40a0f5=_0x2f9af4[_0xef79('0x42')];if(!_0x3b0253[_0xef79('0x3d')][_0xef79('0x43')]('nolimit')){_0x4d6803[_0xef79('0x2d')]=qs[_0xef79('0x2d')](_0x3b0253['query'][_0xef79('0x2d')]);_0x4d6803[_0xef79('0x2c')]=qs[_0xef79('0x2c')](_0x3b0253['query'][_0xef79('0x2c')]);}return _0x431945[_0xef79('0x59')](_0x4d6803);}})[_0xef79('0x1d')](function(_0x546f5b){if(_0x546f5b){return _0x546f5b?{'count':_0x40a0f5,'rows':_0x546f5b}:null;}})['then'](respondWithResult(_0x114414,null))[_0xef79('0x26')](handleError(_0x114414,null));};exports[_0xef79('0x5a')]=function(_0x968e72,_0x14c11c,_0x1a4f91){if(_0x968e72['body']['id']){delete _0x968e72['body']['id'];}return db[_0xef79('0x4c')][_0xef79('0x57')]({'where':{'id':_0x968e72[_0xef79('0x51')]['id']}})['then'](handleEntityNotFound(_0x14c11c,null))[_0xef79('0x1d')](function(_0x3dcd00){if(_0x3dcd00){_0x968e72[_0xef79('0x54')][_0xef79('0x5b')]=_0x3dcd00['id'];_0x968e72['body'][_0xef79('0x5c')]=integrations[_0xef79('0x5d')](_0x968e72['body'][_0xef79('0x5e')],_0x968e72[_0xef79('0x54')]['type']);_0x968e72[_0xef79('0x54')][_0xef79('0x5f')]=integrations[_0xef79('0x60')](_0x968e72[_0xef79('0x54')][_0xef79('0x5e')],_0x968e72[_0xef79('0x54')][_0xef79('0x3a')]);return db[_0xef79('0x58')][_0xef79('0x53')](_0x968e72[_0xef79('0x54')],{'include':[{'model':db[_0xef79('0x61')],'as':_0xef79('0x5c')},{'model':db[_0xef79('0x61')],'as':_0xef79('0x5f')}]});}return null;})[_0xef79('0x1d')](respondWithResult(_0x14c11c,null))[_0xef79('0x26')](handleError(_0x14c11c,null));};function getAccessToken(_0xe57fbe){return new Promise(function(_0x47bb55,_0x5a9b4d){var _0x21f718;switch(_0xe57fbe['zone']){case'US':_0x21f718=_0xef79('0x62');break;case'AU':_0x21f718='https://accounts.zoho.com.au';break;case'EU':_0x21f718=_0xef79('0x63');break;case'IN':_0x21f718=_0xef79('0x64');break;case'CN':_0x21f718=_0xef79('0x65');break;default:_0x21f718='https://accounts.zoho.eu';break;}var _0x1257f0={'method':_0xef79('0x66'),'uri':_0x21f718+_0xef79('0x67'),'qs':{'refresh_token':_0xe57fbe['refreshToken'],'client_id':_0xe57fbe['clientId'],'client_secret':_0xe57fbe[_0xef79('0x68')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1257f0)[_0xef79('0x1d')](function(_0x19ee5c){if(_0x19ee5c[_0xef79('0x69')]){_0x47bb55(_0x19ee5c['access_token']);}else{_0x5a9b4d(_0xef79('0x6a'));}})[_0xef79('0x26')](function(_0x587054){_0x5a9b4d(_0x587054);});});}exports[_0xef79('0x6b')]=function(_0x4eafb1,_0x5cd711,_0x36d0e9){var _0x59577d,_0xcc6536,_0x118b4c,_0x48a75a,_0x2c82cd;return db['ZohoAccount'][_0xef79('0x57')]({'where':{'id':_0x4eafb1['params']['id']},'attributes':['id',_0xef79('0x6c'),'zone','clientId',_0xef79('0x68'),_0xef79('0x6d'),_0xef79('0x6e'),_0xef79('0x6f')]})['then'](handleEntityNotFound(_0x5cd711,null))[_0xef79('0x1d')](function(_0x3411ae){_0x2c82cd=_0x3411ae;_0x59577d=_0x2c82cd['host'];_0xcc6536=_0x59577d==='zoho.eu'?'eu':'com';_0x118b4c=_0x2c82cd[_0xef79('0x6d')];var _0x3d7842=_0x118b4c['slice'](-0x1);if(_0x3d7842==='/'||_0x3d7842==='\x5c'||_0x3d7842===':'){_0x118b4c=_0x118b4c['substring'](0x0,_0x118b4c['lastIndexOf'](_0x3d7842));}if(!_0x2c82cd[_0xef79('0x6f')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2c82cd);})[_0xef79('0x1d')](function(_0x1dbc67){if(_0x1dbc67){return rp({'method':_0xef79('0x70'),'uri':util[_0xef79('0x71')](_0xef79('0x72'),_0xcc6536),'qs':{'module':_0xef79('0x73')},'headers':{'Authorization':_0xef79('0x74')+_0x1dbc67},'json':!![]});}})['then'](function(_0x2f3659){if(_0x2f3659){if(_0x2f3659[_0xef79('0x75')]&&_0x2f3659[_0xef79('0x75')][_0xef79('0x22')]){throw new Error(_0x2f3659['response'][_0xef79('0x22')][_0xef79('0x23')]);}var _0x31d3eb=[];var _0x507314=[];var _0x5eb2d0=['Owner','Subject',_0xef79('0x76'),'WhoId',_0xef79('0x77'),_0xef79('0x78'),_0xef79('0x79'),_0xef79('0x7a')];_0x507314=_['remove'](_0x2f3659[_0xef79('0x41')],function(_0x3cbd45){return _0x5eb2d0[_0xef79('0x7b')](_0x3cbd45[_0xef79('0x7c')]);});for(var _0x3b7e06=0x0;_0x3b7e06<_0x507314[_0xef79('0x42')];_0x3b7e06++){if(_0x507314[_0x3b7e06]['system_mandatory']===![]){_0x31d3eb[_0xef79('0x7d')]({'id':_0x507314[_0x3b7e06]['id'],'name':_0x507314[_0x3b7e06]['display_label'],'custom':_0x507314[_0x3b7e06][_0xef79('0x7e')],'options':_0x507314[_0x3b7e06][_0xef79('0x7f')]===_0xef79('0x80')&&_0x507314[_0x3b7e06][_0xef79('0x81')]['length']>-0x1?_['map'](_0x507314[_0x3b7e06]['pick_list_values'],function(_0x1ee702){return{'name':_0x1ee702,'value':_0x1ee702};}):[]});}}return{'count':_0x31d3eb[_0xef79('0x42')],'rows':_0x31d3eb};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5cd711,null))[_0xef79('0x26')](function(_0xea2cb){var _0x5291b6=_0x4eafb1[_0xef79('0x3d')][_0xef79('0x82')]?0x1f4:_0xea2cb[_0xef79('0x83')]||0x1f4;logger[_0xef79('0x22')](_0xef79('0x84'),_0xef79('0x6b'),_0x5291b6,JSON['stringify'](_0xea2cb));delete _0xea2cb[_0xef79('0x34')];if(_0x5291b6===0x191){_0x5291b6=0x190;}_0x5cd711[_0xef79('0x28')](_0x5291b6)[_0xef79('0x35')](_0x4eafb1[_0xef79('0x3d')][_0xef79('0x82')]?{'message':_0xef79('0x85'),'statusCode':_0xea2cb[_0xef79('0x83')]}:_0xea2cb);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index f54b7ee..d3c506c 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 _0x4dbb=['then','parse','refresh_token','refreshToken','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','inspect','catch','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','application/x-www-form-urlencoded','info','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.eu','/oauth/v2/token','authorization_code'];(function(_0x38a385,_0x2179bb){var _0x205a81=function(_0x4149a1){while(--_0x4149a1){_0x38a385['push'](_0x38a385['shift']());}};_0x205a81(++_0x2179bb);}(_0x4dbb,0x170));var _0xb4db=function(_0x5d160,_0xa4838e){_0x5d160=_0x5d160-0x0;var _0x1d180d=_0x4dbb[_0x5d160];return _0x1d180d;};'use strict';var _=require(_0xb4db('0x0'));var util=require(_0xb4db('0x1'));var logger=require('../../config/logger')(_0xb4db('0x2'));var moment=require('moment');var BPromise=require(_0xb4db('0x3'));var rp=require(_0xb4db('0x4'));var fs=require('fs');var path=require(_0xb4db('0x5'));var rimraf=require(_0xb4db('0x6'));var config=require(_0xb4db('0x7'));var attributes=require(_0xb4db('0x8'));var integrations=require(_0xb4db('0x9'));module[_0xb4db('0xa')]=function(_0x2599d2,_0x854f41){return _0x2599d2[_0xb4db('0xb')](_0xb4db('0xc'),attributes,{'tableName':_0xb4db('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a8324,_0x123b95,_0x21593b){if(_0x3a8324[_0xb4db('0xe')](_0xb4db('0xf'))||_0x3a8324[_0xb4db('0xe')](_0xb4db('0x10'))||_0x3a8324[_0xb4db('0xe')](_0xb4db('0x11'))||_0x3a8324[_0xb4db('0xe')](_0xb4db('0x12'))||_0x3a8324[_0xb4db('0xe')](_0xb4db('0x13'))||_0x3a8324[_0xb4db('0xe')](_0xb4db('0x14'))){var _0x5ea2f8,_0x426727;_0x5ea2f8=_0x3a8324[_0xb4db('0x10')];var _0x268ca2=_0x5ea2f8[_0xb4db('0x15')](-0x1);if(_0x268ca2==='/'||_0x268ca2==='\x5c'||_0x268ca2===':'){_0x5ea2f8=_0x5ea2f8[_0xb4db('0x16')](0x0,_0x5ea2f8[_0xb4db('0x17')](_0x268ca2));}switch(_0x3a8324[_0xb4db('0xf')]){case'US':_0x426727=_0xb4db('0x18');break;case'AU':_0x426727='https://accounts.zoho.com.au';break;case'IN':_0x426727='https://accounts.zoho.in';break;case'CN':_0x426727='https://accounts.zoho.com.cn';break;default:_0x426727=_0xb4db('0x19');break;}var _0x4c7b79={'method':'POST','uri':_0x426727+_0xb4db('0x1a'),'form':{'grant_type':_0xb4db('0x1b'),'client_id':_0x3a8324[_0xb4db('0x11')],'client_secret':_0x3a8324[_0xb4db('0x12')],'redirect_uri':_0x3a8324['serverUrl'],'code':_0x3a8324['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4c7b79)[_0xb4db('0x1c')](function(_0x566b0a){var _0x5646d7=JSON[_0xb4db('0x1d')](_0x566b0a);if(_0x5646d7[_0xb4db('0x1e')]){_0x3a8324[_0xb4db('0x1f')]=_0x5646d7[_0xb4db('0x1e')];logger['info'](util[_0xb4db('0x20')](_0xb4db('0x21'),_0x3a8324[_0xb4db('0x22')],_0x3a8324['id']));}else{logger[_0xb4db('0x23')](util[_0xb4db('0x20')](_0xb4db('0x24'),_0x3a8324[_0xb4db('0x22')],_0x3a8324['id']),util[_0xb4db('0x25')](_0x5646d7,{'showHidden':![],'depth':null}));}return _0x21593b(null,_0x123b95);})[_0xb4db('0x26')](function(_0x328c1c){logger[_0xb4db('0x23')](util[_0xb4db('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3a8324[_0xb4db('0x22')],_0x3a8324['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x21593b(_0x328c1c);});}else{return _0x21593b(null,_0x123b95);}},'beforeUpdate':function(_0x26e445,_0x13993e,_0x1b2185){if(_0x26e445[_0xb4db('0xe')](_0xb4db('0xf'))||_0x26e445[_0xb4db('0xe')](_0xb4db('0x10'))||_0x26e445[_0xb4db('0xe')](_0xb4db('0x11'))||_0x26e445[_0xb4db('0xe')](_0xb4db('0x12'))||_0x26e445[_0xb4db('0xe')]('code')||_0x26e445['changed'](_0xb4db('0x14'))){var _0x304761,_0xb30900;_0x304761=_0x26e445['serverUrl'];var _0x30fcb1=_0x304761[_0xb4db('0x15')](-0x1);if(_0x30fcb1==='/'||_0x30fcb1==='\x5c'||_0x30fcb1===':'){_0x304761=_0x304761[_0xb4db('0x16')](0x0,_0x304761['lastIndexOf'](_0x30fcb1));}switch(_0x26e445[_0xb4db('0xf')]){case'US':_0xb30900='https://accounts.zoho.com';break;case'AU':_0xb30900=_0xb4db('0x27');break;case'IN':_0xb30900=_0xb4db('0x28');break;case'CN':_0xb30900='https://accounts.zoho.com.cn';break;default:_0xb30900=_0xb4db('0x19');break;}var _0x17dad5={'method':_0xb4db('0x29'),'uri':_0xb30900+_0xb4db('0x1a'),'form':{'grant_type':_0xb4db('0x1b'),'client_id':_0x26e445[_0xb4db('0x11')],'client_secret':_0x26e445['clientSecret'],'redirect_uri':_0x26e445[_0xb4db('0x10')],'code':_0x26e445[_0xb4db('0x13')]},'headers':{'Content-Type':_0xb4db('0x2a')}};return rp(_0x17dad5)['then'](function(_0x1821ca){var _0x5bade3=JSON['parse'](_0x1821ca);if(_0x5bade3[_0xb4db('0x1e')]){_0x26e445[_0xb4db('0x1f')]=_0x5bade3['refresh_token'];logger[_0xb4db('0x2b')](util['format'](_0xb4db('0x21'),_0x26e445[_0xb4db('0x22')],_0x26e445['id']));}else{logger[_0xb4db('0x23')](util[_0xb4db('0x20')](_0xb4db('0x24'),_0x26e445[_0xb4db('0x22')],_0x26e445['id']),util[_0xb4db('0x25')](_0x5bade3,{'showHidden':![],'depth':null}));}return _0x1b2185(null,_0x13993e);})[_0xb4db('0x26')](function(_0x16a4ba){logger[_0xb4db('0x23')](util['format'](_0xb4db('0x24'),_0x26e445[_0xb4db('0x22')],_0x26e445['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1b2185(_0x16a4ba);});}else{return _0x1b2185(null,_0x13993e);}}}});}; \ No newline at end of file +var _0x2fb7=['catch','clientId','https://accounts.zoho.eu','refreshToken','inspect','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','ZohoAccount','changed','zone','serverUrl','clientSecret','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name'];(function(_0x2dcd42,_0x18b2d6){var _0x3132ca=function(_0x39c68a){while(--_0x39c68a){_0x2dcd42['push'](_0x2dcd42['shift']());}};_0x3132ca(++_0x18b2d6);}(_0x2fb7,0xf5));var _0x72fb=function(_0x25dd57,_0xa977af){_0x25dd57=_0x25dd57-0x0;var _0x58abd1=_0x2fb7[_0x25dd57];return _0x58abd1;};'use strict';var _=require(_0x72fb('0x0'));var util=require(_0x72fb('0x1'));var logger=require(_0x72fb('0x2'))(_0x72fb('0x3'));var moment=require(_0x72fb('0x4'));var BPromise=require(_0x72fb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72fb('0x6'));var rimraf=require(_0x72fb('0x7'));var config=require(_0x72fb('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x72fb('0x9')]=function(_0x10f8ef,_0x27e8e9){return _0x10f8ef['define'](_0x72fb('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x111db4,_0x13b0c9,_0x258695){if(_0x111db4[_0x72fb('0xb')](_0x72fb('0xc'))||_0x111db4[_0x72fb('0xb')](_0x72fb('0xd'))||_0x111db4[_0x72fb('0xb')]('clientId')||_0x111db4[_0x72fb('0xb')](_0x72fb('0xe'))||_0x111db4[_0x72fb('0xb')]('code')||_0x111db4['changed']('host')){var _0x19873e,_0x4742d0;_0x19873e=_0x111db4[_0x72fb('0xd')];var _0x327db6=_0x19873e[_0x72fb('0xf')](-0x1);if(_0x327db6==='/'||_0x327db6==='\x5c'||_0x327db6===':'){_0x19873e=_0x19873e[_0x72fb('0x10')](0x0,_0x19873e[_0x72fb('0x11')](_0x327db6));}switch(_0x111db4[_0x72fb('0xc')]){case'US':_0x4742d0=_0x72fb('0x12');break;case'AU':_0x4742d0=_0x72fb('0x13');break;case'IN':_0x4742d0=_0x72fb('0x14');break;case'CN':_0x4742d0=_0x72fb('0x15');break;default:_0x4742d0='https://accounts.zoho.eu';break;}var _0x56fde4={'method':_0x72fb('0x16'),'uri':_0x4742d0+_0x72fb('0x17'),'form':{'grant_type':_0x72fb('0x18'),'client_id':_0x111db4['clientId'],'client_secret':_0x111db4[_0x72fb('0xe')],'redirect_uri':_0x111db4[_0x72fb('0xd')],'code':_0x111db4[_0x72fb('0x19')]},'headers':{'Content-Type':_0x72fb('0x1a')}};return rp(_0x56fde4)[_0x72fb('0x1b')](function(_0x5528ff){var _0x285e75=JSON['parse'](_0x5528ff);if(_0x285e75[_0x72fb('0x1c')]){_0x111db4['refreshToken']=_0x285e75[_0x72fb('0x1c')];logger[_0x72fb('0x1d')](util[_0x72fb('0x1e')](_0x72fb('0x1f'),_0x111db4['name'],_0x111db4['id']));}else{logger[_0x72fb('0x20')](util[_0x72fb('0x1e')](_0x72fb('0x21'),_0x111db4[_0x72fb('0x22')],_0x111db4['id']),util['inspect'](_0x285e75,{'showHidden':![],'depth':null}));}return _0x258695(null,_0x13b0c9);})[_0x72fb('0x23')](function(_0x1c0dc4){logger[_0x72fb('0x20')](util[_0x72fb('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x111db4['name'],_0x111db4['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x258695(_0x1c0dc4);});}else{return _0x258695(null,_0x13b0c9);}},'beforeUpdate':function(_0x4561b5,_0x529a6b,_0x30f4f3){if(_0x4561b5[_0x72fb('0xb')](_0x72fb('0xc'))||_0x4561b5['changed'](_0x72fb('0xd'))||_0x4561b5[_0x72fb('0xb')](_0x72fb('0x24'))||_0x4561b5[_0x72fb('0xb')](_0x72fb('0xe'))||_0x4561b5[_0x72fb('0xb')](_0x72fb('0x19'))||_0x4561b5[_0x72fb('0xb')]('host')){var _0x2e4353,_0x480e7a;_0x2e4353=_0x4561b5[_0x72fb('0xd')];var _0x183f1f=_0x2e4353['slice'](-0x1);if(_0x183f1f==='/'||_0x183f1f==='\x5c'||_0x183f1f===':'){_0x2e4353=_0x2e4353['substring'](0x0,_0x2e4353[_0x72fb('0x11')](_0x183f1f));}switch(_0x4561b5[_0x72fb('0xc')]){case'US':_0x480e7a=_0x72fb('0x12');break;case'AU':_0x480e7a='https://accounts.zoho.com.au';break;case'IN':_0x480e7a=_0x72fb('0x14');break;case'CN':_0x480e7a='https://accounts.zoho.com.cn';break;default:_0x480e7a=_0x72fb('0x25');break;}var _0x143a34={'method':_0x72fb('0x16'),'uri':_0x480e7a+'/oauth/v2/token','form':{'grant_type':_0x72fb('0x18'),'client_id':_0x4561b5[_0x72fb('0x24')],'client_secret':_0x4561b5['clientSecret'],'redirect_uri':_0x4561b5[_0x72fb('0xd')],'code':_0x4561b5[_0x72fb('0x19')]},'headers':{'Content-Type':_0x72fb('0x1a')}};return rp(_0x143a34)[_0x72fb('0x1b')](function(_0x792a2d){var _0x1bc938=JSON['parse'](_0x792a2d);if(_0x1bc938['refresh_token']){_0x4561b5[_0x72fb('0x26')]=_0x1bc938[_0x72fb('0x1c')];logger['info'](util[_0x72fb('0x1e')](_0x72fb('0x1f'),_0x4561b5[_0x72fb('0x22')],_0x4561b5['id']));}else{logger[_0x72fb('0x20')](util[_0x72fb('0x1e')](_0x72fb('0x21'),_0x4561b5[_0x72fb('0x22')],_0x4561b5['id']),util[_0x72fb('0x27')](_0x1bc938,{'showHidden':![],'depth':null}));}return _0x30f4f3(null,_0x529a6b);})[_0x72fb('0x23')](function(_0x107858){logger[_0x72fb('0x20')](util[_0x72fb('0x1e')](_0x72fb('0x21'),_0x4561b5[_0x72fb('0x22')],_0x4561b5['id']),util[_0x72fb('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x30f4f3(_0x107858);});}else{return _0x30f4f3(null,_0x529a6b);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b5df3cf..76da8de 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 _0xd906=['where','limit','include','map','model','attributes','then','ShowZohoAccount','find','raw','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetZohoAccount','ZohoAccount','options'];(function(_0x50b650,_0x7839f9){var _0x5a5ef7=function(_0xaa74d4){while(--_0xaa74d4){_0x50b650['push'](_0x50b650['shift']());}};_0x5a5ef7(++_0x7839f9);}(_0xd906,0x6b));var _0x6d90=function(_0x3971a9,_0x3caf60){_0x3971a9=_0x3971a9-0x0;var _0x2987a1=_0xd906[_0x3971a9];return _0x2987a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d90('0x0'));var BPromise=require(_0x6d90('0x1'));var rs=require(_0x6d90('0x2'));var fs=require('fs');var Redis=require(_0x6d90('0x3'));var db=require(_0x6d90('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d90('0x5'))(_0x6d90('0x6'));var config=require(_0x6d90('0x7'));var jayson=require(_0x6d90('0x8'));var client=jayson['client'][_0x6d90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19eb61,_0xd120f6,_0x160c7d){return new BPromise(function(_0x219737,_0x5d0ed4){return client['request'](_0x19eb61,_0x160c7d)['then'](function(_0x41c0a3){logger[_0x6d90('0xa')](_0x6d90('0xb'),_0xd120f6,_0x6d90('0xc'));logger[_0x6d90('0xd')](_0x6d90('0xe'),_0xd120f6,_0x6d90('0xc'),JSON['stringify'](_0x41c0a3));if(_0x41c0a3[_0x6d90('0xf')]){if(_0x41c0a3['error'][_0x6d90('0x10')]===0x1f4){logger['error'](_0x6d90('0xb'),_0xd120f6,_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);return _0x5d0ed4(_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);}logger[_0x6d90('0xf')](_0x6d90('0xb'),_0xd120f6,_0x41c0a3[_0x6d90('0xf')]['message']);return _0x219737(_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);}else{logger[_0x6d90('0xa')](_0x6d90('0xb'),_0xd120f6,_0x6d90('0xc'));_0x219737(_0x41c0a3['result'][_0x6d90('0x11')]);}})['catch'](function(_0x379439){logger['error'](_0x6d90('0xb'),_0xd120f6,_0x379439);_0x5d0ed4(_0x379439);});});}exports[_0x6d90('0x12')]=function(_0x352736){var _0x3d37c6=this;return new Promise(function(_0x4e6682,_0x5dd53c){return db[_0x6d90('0x13')]['findAll']({'raw':_0x352736[_0x6d90('0x14')]?_0x352736[_0x6d90('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x352736['options']?_0x352736[_0x6d90('0x14')][_0x6d90('0x15')]||null:null,'attributes':_0x352736[_0x6d90('0x14')]?_0x352736['options']['attributes']||null:null,'limit':_0x352736['options']?_0x352736['options'][_0x6d90('0x16')]||null:null,'include':_0x352736['options']?_0x352736[_0x6d90('0x14')][_0x6d90('0x17')]?_[_0x6d90('0x18')](_0x352736[_0x6d90('0x14')][_0x6d90('0x17')],function(_0x3dcccd){return{'model':db[_0x3dcccd[_0x6d90('0x19')]],'as':_0x3dcccd['as'],'attributes':_0x3dcccd[_0x6d90('0x1a')],'include':_0x3dcccd[_0x6d90('0x17')]?_[_0x6d90('0x18')](_0x3dcccd[_0x6d90('0x17')],function(_0x597386){return{'model':db[_0x597386[_0x6d90('0x19')]],'as':_0x597386['as'],'attributes':_0x597386[_0x6d90('0x1a')],'include':_0x597386[_0x6d90('0x17')]?_['map'](_0x597386[_0x6d90('0x17')],function(_0x1fefae){return{'model':db[_0x1fefae[_0x6d90('0x19')]],'as':_0x1fefae['as'],'attributes':_0x1fefae[_0x6d90('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6d90('0x1b')](function(_0x41cdfc){logger[_0x6d90('0xa')](_0x6d90('0x12'),_0x352736);logger[_0x6d90('0xd')](_0x6d90('0x12'),_0x352736,JSON['stringify'](_0x41cdfc));_0x4e6682(_0x41cdfc);})['catch'](function(_0x5e1ab7){logger[_0x6d90('0xf')]('GetZohoAccount',_0x5e1ab7[_0x6d90('0x11')],_0x352736);_0x5dd53c(_0x3d37c6[_0x6d90('0xf')](0x1f4,_0x5e1ab7[_0x6d90('0x11')]));});});};exports[_0x6d90('0x1c')]=function(_0x2cfc62){var _0x1b7790=this;return new Promise(function(_0x196da5,_0x2423c3){return db[_0x6d90('0x13')][_0x6d90('0x1d')]({'raw':_0x2cfc62[_0x6d90('0x14')]?_0x2cfc62[_0x6d90('0x14')][_0x6d90('0x1e')]===undefined?!![]:![]:!![],'where':_0x2cfc62['options']?_0x2cfc62[_0x6d90('0x14')][_0x6d90('0x15')]||null:null,'attributes':_0x2cfc62['options']?_0x2cfc62[_0x6d90('0x14')][_0x6d90('0x1a')]||null:null,'include':_0x2cfc62['options']?_0x2cfc62[_0x6d90('0x14')][_0x6d90('0x17')]?_[_0x6d90('0x18')](_0x2cfc62[_0x6d90('0x14')][_0x6d90('0x17')],function(_0x13aa29){return{'model':db[_0x13aa29[_0x6d90('0x19')]],'as':_0x13aa29['as'],'attributes':_0x13aa29[_0x6d90('0x1a')],'include':_0x13aa29[_0x6d90('0x17')]?_[_0x6d90('0x18')](_0x13aa29[_0x6d90('0x17')],function(_0x12f20e){return{'model':db[_0x12f20e[_0x6d90('0x19')]],'as':_0x12f20e['as'],'attributes':_0x12f20e[_0x6d90('0x1a')],'include':_0x12f20e[_0x6d90('0x17')]?_[_0x6d90('0x18')](_0x12f20e[_0x6d90('0x17')],function(_0x118b03){return{'model':db[_0x118b03['model']],'as':_0x118b03['as'],'attributes':_0x118b03[_0x6d90('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41f8e2){logger[_0x6d90('0xa')]('ShowZohoAccount',_0x2cfc62);logger[_0x6d90('0xd')](_0x6d90('0x1c'),_0x2cfc62,JSON['stringify'](_0x41f8e2));_0x196da5(_0x41f8e2);})[_0x6d90('0x1f')](function(_0x34a3a3){logger[_0x6d90('0xf')](_0x6d90('0x1c'),_0x34a3a3[_0x6d90('0x11')],_0x2cfc62);_0x2423c3(_0x1b7790['error'](0x1f4,_0x34a3a3[_0x6d90('0x11')]));});});}; \ No newline at end of file +var _0x8032=['GetZohoAccount','ZohoAccount','findAll','options','where','attributes','include','map','model','then','debug','ShowZohoAccount','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8032,0xd9));var _0x2803=function(_0x13f0a2,_0x1b3623){_0x13f0a2=_0x13f0a2-0x0;var _0x4cd0b4=_0x8032[_0x13f0a2];return _0x4cd0b4;};'use strict';var _=require(_0x2803('0x0'));var util=require(_0x2803('0x1'));var moment=require(_0x2803('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2803('0x3'));var db=require(_0x2803('0x4'))['db'];var utils=require(_0x2803('0x5'));var logger=require(_0x2803('0x6'))('rpc');var config=require(_0x2803('0x7'));var jayson=require(_0x2803('0x8'));var client=jayson[_0x2803('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x152b0a,_0x384a39,_0x597a1d){return new BPromise(function(_0x1b7ee5,_0x439d94){return client[_0x2803('0xa')](_0x152b0a,_0x597a1d)['then'](function(_0x5e60ba){logger['info'](_0x2803('0xb'),_0x384a39,'request\x20sent');logger['debug'](_0x2803('0xc'),_0x384a39,_0x2803('0xd'),JSON[_0x2803('0xe')](_0x5e60ba));if(_0x5e60ba[_0x2803('0xf')]){if(_0x5e60ba[_0x2803('0xf')][_0x2803('0x10')]===0x1f4){logger[_0x2803('0xf')](_0x2803('0xb'),_0x384a39,_0x5e60ba['error'][_0x2803('0x11')]);return _0x439d94(_0x5e60ba[_0x2803('0xf')][_0x2803('0x11')]);}logger[_0x2803('0xf')](_0x2803('0xb'),_0x384a39,_0x5e60ba[_0x2803('0xf')][_0x2803('0x11')]);return _0x1b7ee5(_0x5e60ba[_0x2803('0xf')][_0x2803('0x11')]);}else{logger[_0x2803('0x12')](_0x2803('0xb'),_0x384a39,'request\x20sent');_0x1b7ee5(_0x5e60ba[_0x2803('0x13')][_0x2803('0x11')]);}})[_0x2803('0x14')](function(_0x6cb891){logger[_0x2803('0xf')](_0x2803('0xb'),_0x384a39,_0x6cb891);_0x439d94(_0x6cb891);});});}exports[_0x2803('0x15')]=function(_0x371e52){var _0xe40473=this;return new Promise(function(_0xcf8d10,_0x33aab9){return db[_0x2803('0x16')][_0x2803('0x17')]({'raw':_0x371e52[_0x2803('0x18')]?_0x371e52[_0x2803('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x371e52[_0x2803('0x18')]?_0x371e52[_0x2803('0x18')][_0x2803('0x19')]||null:null,'attributes':_0x371e52[_0x2803('0x18')]?_0x371e52[_0x2803('0x18')][_0x2803('0x1a')]||null:null,'limit':_0x371e52[_0x2803('0x18')]?_0x371e52[_0x2803('0x18')]['limit']||null:null,'include':_0x371e52[_0x2803('0x18')]?_0x371e52['options'][_0x2803('0x1b')]?_[_0x2803('0x1c')](_0x371e52[_0x2803('0x18')]['include'],function(_0x3e1966){return{'model':db[_0x3e1966[_0x2803('0x1d')]],'as':_0x3e1966['as'],'attributes':_0x3e1966[_0x2803('0x1a')],'include':_0x3e1966[_0x2803('0x1b')]?_['map'](_0x3e1966['include'],function(_0x118fd5){return{'model':db[_0x118fd5[_0x2803('0x1d')]],'as':_0x118fd5['as'],'attributes':_0x118fd5[_0x2803('0x1a')],'include':_0x118fd5[_0x2803('0x1b')]?_[_0x2803('0x1c')](_0x118fd5['include'],function(_0x25b895){return{'model':db[_0x25b895[_0x2803('0x1d')]],'as':_0x25b895['as'],'attributes':_0x25b895[_0x2803('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2803('0x1e')](function(_0x4cb05b){logger[_0x2803('0x12')]('GetZohoAccount',_0x371e52);logger[_0x2803('0x1f')](_0x2803('0x15'),_0x371e52,JSON[_0x2803('0xe')](_0x4cb05b));_0xcf8d10(_0x4cb05b);})[_0x2803('0x14')](function(_0x555f0e){logger[_0x2803('0xf')](_0x2803('0x15'),_0x555f0e['message'],_0x371e52);_0x33aab9(_0xe40473[_0x2803('0xf')](0x1f4,_0x555f0e[_0x2803('0x11')]));});});};exports[_0x2803('0x20')]=function(_0x4f1f73){var _0x1336cc=this;return new Promise(function(_0x3aef0e,_0x3b744a){return db[_0x2803('0x16')]['find']({'raw':_0x4f1f73['options']?_0x4f1f73[_0x2803('0x18')][_0x2803('0x21')]===undefined?!![]:![]:!![],'where':_0x4f1f73[_0x2803('0x18')]?_0x4f1f73[_0x2803('0x18')][_0x2803('0x19')]||null:null,'attributes':_0x4f1f73[_0x2803('0x18')]?_0x4f1f73[_0x2803('0x18')][_0x2803('0x1a')]||null:null,'include':_0x4f1f73[_0x2803('0x18')]?_0x4f1f73[_0x2803('0x18')]['include']?_[_0x2803('0x1c')](_0x4f1f73[_0x2803('0x18')][_0x2803('0x1b')],function(_0x7deca1){return{'model':db[_0x7deca1['model']],'as':_0x7deca1['as'],'attributes':_0x7deca1[_0x2803('0x1a')],'include':_0x7deca1[_0x2803('0x1b')]?_[_0x2803('0x1c')](_0x7deca1[_0x2803('0x1b')],function(_0x21ac81){return{'model':db[_0x21ac81[_0x2803('0x1d')]],'as':_0x21ac81['as'],'attributes':_0x21ac81[_0x2803('0x1a')],'include':_0x21ac81[_0x2803('0x1b')]?_[_0x2803('0x1c')](_0x21ac81['include'],function(_0x57da6a){return{'model':db[_0x57da6a['model']],'as':_0x57da6a['as'],'attributes':_0x57da6a[_0x2803('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3155ee){logger[_0x2803('0x12')]('ShowZohoAccount',_0x4f1f73);logger['debug'](_0x2803('0x20'),_0x4f1f73,JSON[_0x2803('0xe')](_0x3155ee));_0x3aef0e(_0x3155ee);})['catch'](function(_0x3a1617){logger[_0x2803('0xf')](_0x2803('0x20'),_0x3a1617[_0x2803('0x11')],_0x4f1f73);_0x3b744a(_0x1336cc[_0x2803('0xf')](0x1f4,_0x3a1617[_0x2803('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 41710a3..56111cf 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 _0x7980=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x1c7e8e,_0x3faab8){var _0x2c27f2=function(_0x1b16a1){while(--_0x1b16a1){_0x1c7e8e['push'](_0x1c7e8e['shift']());}};_0x2c27f2(++_0x3faab8);}(_0x7980,0x123));var _0x0798=function(_0x1c4639,_0x5b4d73){_0x1c4639=_0x1c4639-0x0;var _0x4b0c3d=_0x7980[_0x1c4639];return _0x4b0c3d;};'use strict';var multer=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var path=require('path');var timeout=require(_0x0798('0x2'));var express=require(_0x0798('0x3'));var router=express[_0x0798('0x4')]();var auth=require(_0x0798('0x5'));var interaction=require(_0x0798('0x6'));var config=require(_0x0798('0x7'));var controller=require(_0x0798('0x8'));router[_0x0798('0x9')]('/',auth['isAuthenticated'](),controller[_0x0798('0xa')]);router[_0x0798('0x9')](_0x0798('0xb'),auth[_0x0798('0xc')](),controller[_0x0798('0xd')]);router[_0x0798('0x9')]('/:id/fields',auth[_0x0798('0xc')](),controller[_0x0798('0xe')]);router[_0x0798('0x9')](_0x0798('0xf'),auth[_0x0798('0xc')](),controller[_0x0798('0x10')]);router[_0x0798('0x9')](_0x0798('0x11'),auth[_0x0798('0xc')](),controller[_0x0798('0x12')]);router[_0x0798('0x13')]('/',auth[_0x0798('0xc')](),controller['create']);router[_0x0798('0x14')]('/:id',auth[_0x0798('0xc')](),controller['update']);router[_0x0798('0x15')]('/:id',auth[_0x0798('0xc')](),controller[_0x0798('0x16')]);module[_0x0798('0x17')]=router; \ No newline at end of file +var _0xde2c=['delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','show','getFields','getSubjects','/:id/descriptions','post','create','put','/:id'];(function(_0x13f2ec,_0x407206){var _0x389ca9=function(_0x43d7d6){while(--_0x43d7d6){_0x13f2ec['push'](_0x13f2ec['shift']());}};_0x389ca9(++_0x407206);}(_0xde2c,0x7f));var _0xcde2=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xde2c[_0x454018];return _0x24697d;};'use strict';var multer=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var path=require(_0xcde2('0x2'));var timeout=require(_0xcde2('0x3'));var express=require(_0xcde2('0x4'));var router=express[_0xcde2('0x5')]();var auth=require(_0xcde2('0x6'));var interaction=require(_0xcde2('0x7'));var config=require('../../config/environment');var controller=require(_0xcde2('0x8'));router[_0xcde2('0x9')]('/',auth[_0xcde2('0xa')](),controller[_0xcde2('0xb')]);router[_0xcde2('0x9')]('/:id',auth[_0xcde2('0xa')](),controller[_0xcde2('0xc')]);router[_0xcde2('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xcde2('0xd')]);router[_0xcde2('0x9')]('/:id/subjects',auth[_0xcde2('0xa')](),controller[_0xcde2('0xe')]);router[_0xcde2('0x9')](_0xcde2('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xcde2('0x10')]('/',auth[_0xcde2('0xa')](),controller[_0xcde2('0x11')]);router[_0xcde2('0x12')](_0xcde2('0x13'),auth[_0xcde2('0xa')](),controller['update']);router[_0xcde2('0x14')]('/:id',auth[_0xcde2('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 55d36de..617fc02 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 _0x6d0e=['ENUM','contact_lead','sequelize','exports','STRING','lead','contact'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0x6d0e,0x1d0));var _0xe6d0=function(_0x2f6f77,_0x3db200){_0x2f6f77=_0x2f6f77-0x0;var _0x3d9082=_0x6d0e[_0x2f6f77];return _0x3d9082;};'use strict';var Sequelize=require(_0xe6d0('0x0'));module[_0xe6d0('0x1')]={'name':{'type':Sequelize[_0xe6d0('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xe6d0('0x3'),_0xe6d0('0x4'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xe6d0('0x5')](_0xe6d0('0x6'),_0xe6d0('0x4'),'lead'),'defaultValue':_0xe6d0('0x6')},'description':{'type':Sequelize[_0xe6d0('0x2')]}}; \ No newline at end of file +var _0x86a6=['lead','contact','nothing','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x281ba7,_0x30e002){var _0x2501ce=function(_0x41575a){while(--_0x41575a){_0x281ba7['push'](_0x281ba7['shift']());}};_0x2501ce(++_0x30e002);}(_0x86a6,0x134));var _0x686a=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x86a6[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0x686a('0x0'));module[_0x686a('0x1')]={'name':{'type':Sequelize[_0x686a('0x2')]},'moduleCreate':{'type':Sequelize[_0x686a('0x3')](_0x686a('0x4'),_0x686a('0x5'),_0x686a('0x6')),'defaultValue':_0x686a('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x686a('0x5'),'lead'),'defaultValue':_0x686a('0x7')},'description':{'type':Sequelize[_0x686a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 5080de6..52ce4e9 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(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 490193e..8626f60 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 _0xf521=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','int_zoho_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x30717b,_0x478ed4){var _0x4fc73b=function(_0x474c2e){while(--_0x474c2e){_0x30717b['push'](_0x30717b['shift']());}};_0x4fc73b(++_0x478ed4);}(_0xf521,0x193));var _0x1f52=function(_0x27c24d,_0x2b50f1){_0x27c24d=_0x27c24d-0x0;var _0x14e722=_0xf521[_0x27c24d];return _0x14e722;};'use strict';var _=require(_0x1f52('0x0'));var util=require(_0x1f52('0x1'));var logger=require(_0x1f52('0x2'))(_0x1f52('0x3'));var moment=require(_0x1f52('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f52('0x5'));var fs=require('fs');var path=require(_0x1f52('0x6'));var rimraf=require(_0x1f52('0x7'));var config=require(_0x1f52('0x8'));var attributes=require(_0x1f52('0x9'));module[_0x1f52('0xa')]=function(_0x4c75c2,_0x3256ce){return _0x4c75c2['define']('ZohoConfiguration',attributes,{'tableName':_0x1f52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6833=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x255a85,_0x43ea4c){var _0x5ee089=function(_0x4c1c5d){while(--_0x4c1c5d){_0x255a85['push'](_0x255a85['shift']());}};_0x5ee089(++_0x43ea4c);}(_0x6833,0xf3));var _0x3683=function(_0x218e91,_0x29d1be){_0x218e91=_0x218e91-0x0;var _0x4dcf3c=_0x6833[_0x218e91];return _0x4dcf3c;};'use strict';var _=require(_0x3683('0x0'));var util=require(_0x3683('0x1'));var logger=require(_0x3683('0x2'))(_0x3683('0x3'));var moment=require(_0x3683('0x4'));var BPromise=require(_0x3683('0x5'));var rp=require(_0x3683('0x6'));var fs=require('fs');var path=require(_0x3683('0x7'));var rimraf=require(_0x3683('0x8'));var config=require(_0x3683('0x9'));var attributes=require(_0x3683('0xa'));module[_0x3683('0xb')]=function(_0x2326b2,_0x10df0a){return _0x2326b2[_0x3683('0xc')](_0x3683('0xd'),attributes,{'tableName':_0x3683('0xe'),'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 a0f1d9a..c439958 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 _0x7153=['jayson/promise','http','then','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x7153,0x1ab));var _0x3715=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0x7153[_0x4cfa2e];return _0x279b50;};'use strict';var _=require(_0x3715('0x0'));var util=require(_0x3715('0x1'));var moment=require(_0x3715('0x2'));var BPromise=require(_0x3715('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3715('0x4'));var db=require(_0x3715('0x5'))['db'];var utils=require(_0x3715('0x6'));var logger=require(_0x3715('0x7'))(_0x3715('0x8'));var config=require(_0x3715('0x9'));var jayson=require(_0x3715('0xa'));var client=jayson['client'][_0x3715('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20975b,_0xb59128,_0x54f95b){return new BPromise(function(_0x4252a7,_0x3af787){return client['request'](_0x20975b,_0x54f95b)[_0x3715('0xc')](function(_0x3a093b){logger['info'](_0x3715('0xd'),_0xb59128,'request\x20sent');logger[_0x3715('0xe')](_0x3715('0xf'),_0xb59128,_0x3715('0x10'),JSON['stringify'](_0x3a093b));if(_0x3a093b[_0x3715('0x11')]){if(_0x3a093b['error'][_0x3715('0x12')]===0x1f4){logger[_0x3715('0x11')](_0x3715('0xd'),_0xb59128,_0x3a093b[_0x3715('0x11')][_0x3715('0x13')]);return _0x3af787(_0x3a093b[_0x3715('0x11')][_0x3715('0x13')]);}logger[_0x3715('0x11')](_0x3715('0xd'),_0xb59128,_0x3a093b['error']['message']);return _0x4252a7(_0x3a093b[_0x3715('0x11')]['message']);}else{logger[_0x3715('0x14')](_0x3715('0xd'),_0xb59128,_0x3715('0x10'));_0x4252a7(_0x3a093b[_0x3715('0x15')][_0x3715('0x13')]);}})[_0x3715('0x16')](function(_0x4bde29){logger[_0x3715('0x11')](_0x3715('0xd'),_0xb59128,_0x4bde29);_0x3af787(_0x4bde29);});});} \ No newline at end of file +var _0x5718=['../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','message','ZohoConfiguration,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x30225a,_0x233ad6){var _0x3551ef=function(_0x1a32d5){while(--_0x1a32d5){_0x30225a['push'](_0x30225a['shift']());}};_0x3551ef(++_0x233ad6);}(_0x5718,0x82));var _0x8571=function(_0x4a3056,_0x427108){_0x4a3056=_0x4a3056-0x0;var _0x5dcab9=_0x5718[_0x4a3056];return _0x5dcab9;};'use strict';var _=require(_0x8571('0x0'));var util=require(_0x8571('0x1'));var moment=require(_0x8571('0x2'));var BPromise=require(_0x8571('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8571('0x4'))['db'];var utils=require(_0x8571('0x5'));var logger=require(_0x8571('0x6'))(_0x8571('0x7'));var config=require(_0x8571('0x8'));var jayson=require(_0x8571('0x9'));var client=jayson[_0x8571('0xa')][_0x8571('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cf8d3,_0x5470d9,_0xbfe38){return new BPromise(function(_0x2b7f99,_0x3abc15){return client['request'](_0x4cf8d3,_0xbfe38)[_0x8571('0xc')](function(_0x2d458e){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x5470d9,_0x8571('0xd'));logger[_0x8571('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x5470d9,_0x8571('0xd'),JSON[_0x8571('0xf')](_0x2d458e));if(_0x2d458e[_0x8571('0x10')]){if(_0x2d458e['error'][_0x8571('0x11')]===0x1f4){logger[_0x8571('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x5470d9,_0x2d458e['error']['message']);return _0x3abc15(_0x2d458e[_0x8571('0x10')][_0x8571('0x12')]);}logger['error'](_0x8571('0x13'),_0x5470d9,_0x2d458e[_0x8571('0x10')]['message']);return _0x2b7f99(_0x2d458e['error'][_0x8571('0x12')]);}else{logger[_0x8571('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x5470d9,_0x8571('0xd'));_0x2b7f99(_0x2d458e[_0x8571('0x15')]['message']);}})[_0x8571('0x16')](function(_0x7c77b0){logger[_0x8571('0x10')](_0x8571('0x13'),_0x5470d9,_0x7c77b0);_0x3abc15(_0x7c77b0);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 2f504f0..cfb31e7 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 _0x9582=['show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id'];(function(_0x3c7d07,_0x4722f3){var _0x1c48c4=function(_0x2589f4){while(--_0x2589f4){_0x3c7d07['push'](_0x3c7d07['shift']());}};_0x1c48c4(++_0x4722f3);}(_0x9582,0x95));var _0x2958=function(_0x4f5529,_0x247bc2){_0x4f5529=_0x4f5529-0x0;var _0x59f64f=_0x9582[_0x4f5529];return _0x59f64f;};'use strict';var multer=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var path=require(_0x2958('0x2'));var timeout=require(_0x2958('0x3'));var express=require(_0x2958('0x4'));var router=express[_0x2958('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2958('0x6'));var config=require(_0x2958('0x7'));var controller=require(_0x2958('0x8'));router[_0x2958('0x9')]('/',auth[_0x2958('0xa')](),controller[_0x2958('0xb')]);router[_0x2958('0x9')](_0x2958('0xc'),auth[_0x2958('0xa')](),controller[_0x2958('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2958('0xe')]);router['put'](_0x2958('0xc'),auth['isAuthenticated'](),controller[_0x2958('0xf')]);router['delete'](_0x2958('0xc'),auth[_0x2958('0xa')](),controller[_0x2958('0x10')]);module[_0x2958('0x11')]=router; \ No newline at end of file +var _0x6a95=['util','path','connect-timeout','express','Router','../../components/auth/service','./intZohoField.controller','get','isAuthenticated','index','/:id','create','update','delete','destroy','exports','multer'];(function(_0x59b93f,_0x5a47bc){var _0x4df2a4=function(_0x4a124f){while(--_0x4a124f){_0x59b93f['push'](_0x59b93f['shift']());}};_0x4df2a4(++_0x5a47bc);}(_0x6a95,0x1db));var _0x56a9=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x6a95[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var path=require(_0x56a9('0x2'));var timeout=require(_0x56a9('0x3'));var express=require(_0x56a9('0x4'));var router=express[_0x56a9('0x5')]();var auth=require(_0x56a9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x56a9('0x7'));router[_0x56a9('0x8')]('/',auth[_0x56a9('0x9')](),controller[_0x56a9('0xa')]);router[_0x56a9('0x8')](_0x56a9('0xb'),auth[_0x56a9('0x9')](),controller['show']);router['post']('/',auth[_0x56a9('0x9')](),controller[_0x56a9('0xc')]);router['put'](_0x56a9('0xb'),auth[_0x56a9('0x9')](),controller[_0x56a9('0xd')]);router[_0x56a9('0xe')](_0x56a9('0xb'),auth[_0x56a9('0x9')](),controller[_0x56a9('0xf')]);module[_0x56a9('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 6c89b74..443d866 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 _0x2624=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports','string'];(function(_0xb65f0c,_0xe60c57){var _0x2ff246=function(_0x7d191c){while(--_0x7d191c){_0xb65f0c['push'](_0xb65f0c['shift']());}};_0x2ff246(++_0xe60c57);}(_0x2624,0x75));var _0x4262=function(_0x467ce0,_0x5593d0){_0x467ce0=_0x467ce0-0x0;var _0x2021d8=_0x2624[_0x467ce0];return _0x2021d8;};'use strict';var Sequelize=require(_0x4262('0x0'));module[_0x4262('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4262('0x2'),_0x4262('0x3'),_0x4262('0x4'),_0x4262('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4262('0x6')]},'key':{'type':Sequelize[_0x4262('0x6')]},'keyType':{'type':Sequelize[_0x4262('0x7')]('string','variable',_0x4262('0x4'))},'keyContent':{'type':Sequelize[_0x4262('0x6')]},'idField':{'type':Sequelize[_0x4262('0x6')]},'nameField':{'type':Sequelize[_0x4262('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5977=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN'];(function(_0x387243,_0xa85f6){var _0xefb76b=function(_0x3a7cff){while(--_0x3a7cff){_0x387243['push'](_0x387243['shift']());}};_0xefb76b(++_0xa85f6);}(_0x5977,0xe1));var _0x7597=function(_0x48db8c,_0x39baa3){_0x48db8c=_0x48db8c-0x0;var _0x3f4618=_0x5977[_0x48db8c];return _0x3f4618;};'use strict';var Sequelize=require(_0x7597('0x0'));module[_0x7597('0x1')]={'type':{'type':Sequelize[_0x7597('0x2')](_0x7597('0x3'),'variable',_0x7597('0x4'),_0x7597('0x5')),'defaultValue':_0x7597('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7597('0x6')]},'keyType':{'type':Sequelize[_0x7597('0x2')](_0x7597('0x3'),_0x7597('0x7'),_0x7597('0x4'))},'keyContent':{'type':Sequelize[_0x7597('0x6')]},'idField':{'type':Sequelize[_0x7597('0x6')]},'nameField':{'type':Sequelize[_0x7597('0x6')]},'customField':{'type':Sequelize[_0x7597('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7597('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index e29587e..930548c 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 _0x71e4=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','html-pdf','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs'];(function(_0x1bf0c9,_0x5bc860){var _0x44093a=function(_0x13c6dc){while(--_0x13c6dc){_0x1bf0c9['push'](_0x1bf0c9['shift']());}};_0x44093a(++_0x5bc860);}(_0x71e4,0xd8));var _0x471e=function(_0xc1263e,_0x56d738){_0xc1263e=_0xc1263e-0x0;var _0x471f07=_0x71e4[_0xc1263e];return _0x471f07;};'use strict';var pdf=require(_0x471e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x471e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x471e('0x2'));var rp=require('request-promise');var moment=require(_0x471e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x471e('0x4'));var util=require('util');var path=require(_0x471e('0x5'));var sox=require(_0x471e('0x6'));var csv=require(_0x471e('0x7'));var ejs=require(_0x471e('0x8'));var fs=require('fs');var _=require(_0x471e('0x9'));var squel=require('squel');var crypto=require(_0x471e('0xa'));var jsforce=require(_0x471e('0xb'));var deskjs=require(_0x471e('0xc'));var toCsv=require(_0x471e('0x7'));var querystring=require(_0x471e('0xd'));var Papa=require(_0x471e('0xe'));var Redis=require(_0x471e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x471e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x471e('0x11'));var logger=require(_0x471e('0x12'))(_0x471e('0x13'));var utils=require('../../config/utils');var config=require(_0x471e('0x14'));var licenseUtil=require(_0x471e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d24d,_0x11ad35){_0x11ad35=_0x11ad35||0xcc;return function(_0xc04abe){if(_0xc04abe){return _0x58d24d[_0x471e('0x16')](_0x11ad35);}return _0x58d24d[_0x471e('0x17')](_0x11ad35)[_0x471e('0x18')]();};}function respondWithResult(_0x5588bd,_0x7c40d4){_0x7c40d4=_0x7c40d4||0xc8;return function(_0x542ab5){if(_0x542ab5){return _0x5588bd[_0x471e('0x17')](_0x7c40d4)[_0x471e('0x19')](_0x542ab5);}};}function respondWithFilteredResult(_0x4561e2,_0x23d5a4){return function(_0x580c77){if(_0x580c77){var _0x2b193f=_0x580c77[_0x471e('0x1a')],_0x989441=_0x23d5a4['offset'],_0x1bb00b=_0x23d5a4[_0x471e('0x1b')]+_0x23d5a4[_0x471e('0x1c')],_0x1ac224;if(_0x1bb00b>=_0x2b193f){_0x1bb00b=_0x2b193f;_0x1ac224=0xc8;}else{_0x1ac224=0xce;}_0x4561e2[_0x471e('0x17')](_0x1ac224);return _0x4561e2[_0x471e('0x1d')](_0x471e('0x1e'),_0x989441+'-'+_0x1bb00b+'/'+_0x2b193f)[_0x471e('0x19')](_0x580c77);}return null;};}function patchUpdates(_0x5bea8f){return function(_0x5672d9){try{jsonpatch[_0x471e('0x1f')](_0x5672d9,_0x5bea8f,!![]);}catch(_0x466149){return BPromise[_0x471e('0x20')](_0x466149);}return _0x5672d9[_0x471e('0x21')]();};}function saveUpdates(_0x41ead6,_0x50a979){return function(_0xb4fe25){if(_0xb4fe25){return _0xb4fe25[_0x471e('0x22')](_0x41ead6)[_0x471e('0x23')](function(_0x2b9048){return _0x2b9048;});}return null;};}function removeEntity(_0x6342d5,_0x4fa197){return function(_0x20a337){if(_0x20a337){return _0x20a337[_0x471e('0x24')]()[_0x471e('0x23')](function(){_0x6342d5[_0x471e('0x17')](0xcc)[_0x471e('0x18')]();});}};}function handleEntityNotFound(_0x3c03fc,_0x1fd147){return function(_0x7e735b){if(!_0x7e735b){_0x3c03fc['sendStatus'](0x194);}return _0x7e735b;};}function handleError(_0x42b0e1,_0x5c035e){_0x5c035e=_0x5c035e||0x1f4;return function(_0x190b4b){logger[_0x471e('0x25')](_0x190b4b[_0x471e('0x26')]);if(_0x190b4b[_0x471e('0x27')]){delete _0x190b4b[_0x471e('0x27')];}_0x42b0e1['status'](_0x5c035e)[_0x471e('0x28')](_0x190b4b);};}exports[_0x471e('0x29')]=function(_0x237ec4,_0x10c719){var _0x3e352f={},_0x482e8f={},_0x59df09={'count':0x0,'rows':[]};var _0x177ffd=_[_0x471e('0x2a')](db[_0x471e('0x2b')][_0x471e('0x2c')],function(_0x46272c){return{'name':_0x46272c[_0x471e('0x2d')],'type':_0x46272c['type'][_0x471e('0x2e')]};});_0x482e8f[_0x471e('0x2f')]=_[_0x471e('0x2a')](_0x177ffd,'name');_0x482e8f[_0x471e('0x30')]=_[_0x471e('0x31')](_0x237ec4['query']);_0x482e8f[_0x471e('0x32')]=_[_0x471e('0x33')](_0x482e8f[_0x471e('0x2f')],_0x482e8f[_0x471e('0x30')]);_0x3e352f[_0x471e('0x34')]=_[_0x471e('0x33')](_0x482e8f['model'],qs['fields'](_0x237ec4[_0x471e('0x30')][_0x471e('0x35')]));_0x3e352f['attributes']=_0x3e352f['attributes'][_0x471e('0x36')]?_0x3e352f[_0x471e('0x34')]:_0x482e8f[_0x471e('0x2f')];if(!_0x237ec4[_0x471e('0x30')][_0x471e('0x37')](_0x471e('0x38'))){_0x3e352f[_0x471e('0x1c')]=qs[_0x471e('0x1c')](_0x237ec4[_0x471e('0x30')][_0x471e('0x1c')]);_0x3e352f[_0x471e('0x1b')]=qs[_0x471e('0x1b')](_0x237ec4[_0x471e('0x30')]['offset']);}_0x3e352f[_0x471e('0x39')]=qs['sort'](_0x237ec4['query'][_0x471e('0x3a')]);_0x3e352f[_0x471e('0x3b')]=qs['filters'](_['pick'](_0x237ec4[_0x471e('0x30')],_0x482e8f[_0x471e('0x32')]),_0x177ffd);if(_0x237ec4[_0x471e('0x30')][_0x471e('0x3c')]){_0x3e352f[_0x471e('0x3b')]=_[_0x471e('0x3d')](_0x3e352f['where'],{'$or':_[_0x471e('0x2a')](_0x177ffd,function(_0x5389e5){if(_0x5389e5[_0x471e('0x3e')]!==_0x471e('0x3f')){var _0x2dbd7a={};_0x2dbd7a[_0x5389e5[_0x471e('0x27')]]={'$like':'%'+_0x237ec4['query']['filter']+'%'};return _0x2dbd7a;}})});}_0x3e352f=_[_0x471e('0x3d')]({},_0x3e352f,_0x237ec4['options']);var _0x69f2e8={'where':_0x3e352f['where']};return db[_0x471e('0x2b')][_0x471e('0x1a')](_0x69f2e8)[_0x471e('0x23')](function(_0x4524b3){_0x59df09['count']=_0x4524b3;if(_0x237ec4[_0x471e('0x30')][_0x471e('0x40')]){_0x3e352f[_0x471e('0x41')]=[{'all':!![]}];}return db[_0x471e('0x2b')][_0x471e('0x42')](_0x3e352f);})[_0x471e('0x23')](function(_0x25326a){_0x59df09[_0x471e('0x43')]=_0x25326a;return _0x59df09;})[_0x471e('0x23')](respondWithFilteredResult(_0x10c719,_0x3e352f))[_0x471e('0x44')](handleError(_0x10c719,null));};exports[_0x471e('0x45')]=function(_0x3ef6cf,_0x504696){var _0x1557e5={'raw':!![],'where':{'id':_0x3ef6cf[_0x471e('0x46')]['id']}},_0x4abdd1={};_0x4abdd1[_0x471e('0x2f')]=_[_0x471e('0x31')](db[_0x471e('0x2b')][_0x471e('0x2c')]);_0x4abdd1[_0x471e('0x30')]=_[_0x471e('0x31')](_0x3ef6cf[_0x471e('0x30')]);_0x4abdd1[_0x471e('0x32')]=_[_0x471e('0x33')](_0x4abdd1[_0x471e('0x2f')],_0x4abdd1['query']);_0x1557e5[_0x471e('0x34')]=_[_0x471e('0x33')](_0x4abdd1[_0x471e('0x2f')],qs[_0x471e('0x35')](_0x3ef6cf[_0x471e('0x30')][_0x471e('0x35')]));_0x1557e5[_0x471e('0x34')]=_0x1557e5[_0x471e('0x34')][_0x471e('0x36')]?_0x1557e5[_0x471e('0x34')]:_0x4abdd1['model'];if(_0x3ef6cf[_0x471e('0x30')]['includeAll']){_0x1557e5[_0x471e('0x41')]=[{'all':!![]}];}_0x1557e5=_[_0x471e('0x3d')]({},_0x1557e5,_0x3ef6cf[_0x471e('0x47')]);return db['ZohoField'][_0x471e('0x48')](_0x1557e5)[_0x471e('0x23')](handleEntityNotFound(_0x504696,null))['then'](respondWithResult(_0x504696,null))['catch'](handleError(_0x504696,null));};exports[_0x471e('0x49')]=function(_0x39bf94,_0x299036){return db[_0x471e('0x2b')]['create'](_0x39bf94['body'],{})[_0x471e('0x23')](respondWithResult(_0x299036,0xc9))['catch'](handleError(_0x299036,null));};exports[_0x471e('0x22')]=function(_0x1430fb,_0x1483f3){if(_0x1430fb['body']['id']){delete _0x1430fb['body']['id'];}return db[_0x471e('0x2b')][_0x471e('0x48')]({'where':{'id':_0x1430fb[_0x471e('0x46')]['id']}})[_0x471e('0x23')](handleEntityNotFound(_0x1483f3,null))[_0x471e('0x23')](saveUpdates(_0x1430fb[_0x471e('0x4a')],null))[_0x471e('0x23')](respondWithResult(_0x1483f3,null))[_0x471e('0x44')](handleError(_0x1483f3,null));};exports[_0x471e('0x24')]=function(_0x3ec623,_0x1068e3){return db['ZohoField']['find']({'where':{'id':_0x3ec623[_0x471e('0x46')]['id']}})[_0x471e('0x23')](handleEntityNotFound(_0x1068e3,null))[_0x471e('0x23')](removeEntity(_0x1068e3,null))[_0x471e('0x44')](handleError(_0x1068e3,null));}; \ No newline at end of file +var _0x340e=['request-promise','moment','mustache','util','path','sox','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','ZohoField','count','includeAll','findAll','rows','show','params','rawAttributes','include','create','body','catch','find','destroy','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x3cd540,_0x5f192a){var _0x47642f=function(_0xcb14){while(--_0xcb14){_0x3cd540['push'](_0x3cd540['shift']());}};_0x47642f(++_0x5f192a);}(_0x340e,0xe3));var _0xe340=function(_0x30eb9b,_0x4407b8){_0x30eb9b=_0x30eb9b-0x0;var _0x158fbd=_0x340e[_0x30eb9b];return _0x158fbd;};'use strict';var pdf=require(_0xe340('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe340('0x1'));var zipdir=require(_0xe340('0x2'));var jsonpatch=require(_0xe340('0x3'));var rp=require(_0xe340('0x4'));var moment=require(_0xe340('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe340('0x6'));var util=require(_0xe340('0x7'));var path=require(_0xe340('0x8'));var sox=require(_0xe340('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe340('0xa'));var crypto=require(_0xe340('0xb'));var jsforce=require(_0xe340('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe340('0xd'));var querystring=require(_0xe340('0xe'));var Papa=require('papaparse');var Redis=require(_0xe340('0xf'));var authService=require(_0xe340('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe340('0x11'));var hardwareService=require(_0xe340('0x12'));var logger=require(_0xe340('0x13'))(_0xe340('0x14'));var utils=require(_0xe340('0x15'));var config=require(_0xe340('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe340('0x17'))['db'];function respondWithStatusCode(_0x29a291,_0x4cdca9){_0x4cdca9=_0x4cdca9||0xcc;return function(_0x1d1378){if(_0x1d1378){return _0x29a291[_0xe340('0x18')](_0x4cdca9);}return _0x29a291[_0xe340('0x19')](_0x4cdca9)[_0xe340('0x1a')]();};}function respondWithResult(_0x409357,_0x5bee04){_0x5bee04=_0x5bee04||0xc8;return function(_0x4db48c){if(_0x4db48c){return _0x409357[_0xe340('0x19')](_0x5bee04)[_0xe340('0x1b')](_0x4db48c);}};}function respondWithFilteredResult(_0x234d00,_0x151205){return function(_0x204d8a){if(_0x204d8a){var _0x323d27=_0x204d8a['count'],_0x34eb11=_0x151205[_0xe340('0x1c')],_0x7a5b6c=_0x151205[_0xe340('0x1c')]+_0x151205[_0xe340('0x1d')],_0x1fdd8e;if(_0x7a5b6c>=_0x323d27){_0x7a5b6c=_0x323d27;_0x1fdd8e=0xc8;}else{_0x1fdd8e=0xce;}_0x234d00[_0xe340('0x19')](_0x1fdd8e);return _0x234d00[_0xe340('0x1e')](_0xe340('0x1f'),_0x34eb11+'-'+_0x7a5b6c+'/'+_0x323d27)[_0xe340('0x1b')](_0x204d8a);}return null;};}function patchUpdates(_0xfa6983){return function(_0x324f33){try{jsonpatch[_0xe340('0x20')](_0x324f33,_0xfa6983,!![]);}catch(_0x5eb868){return BPromise[_0xe340('0x21')](_0x5eb868);}return _0x324f33[_0xe340('0x22')]();};}function saveUpdates(_0x4ba279,_0x30a058){return function(_0x241ba2){if(_0x241ba2){return _0x241ba2[_0xe340('0x23')](_0x4ba279)['then'](function(_0x421379){return _0x421379;});}return null;};}function removeEntity(_0x4de3ed,_0x5d2758){return function(_0xb8f96a){if(_0xb8f96a){return _0xb8f96a['destroy']()[_0xe340('0x24')](function(){_0x4de3ed[_0xe340('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35299b,_0x42cee5){return function(_0x596786){if(!_0x596786){_0x35299b[_0xe340('0x18')](0x194);}return _0x596786;};}function handleError(_0xb1bfae,_0x5a43b6){_0x5a43b6=_0x5a43b6||0x1f4;return function(_0x30b469){logger[_0xe340('0x25')](_0x30b469[_0xe340('0x26')]);if(_0x30b469[_0xe340('0x27')]){delete _0x30b469['name'];}_0xb1bfae[_0xe340('0x19')](_0x5a43b6)[_0xe340('0x28')](_0x30b469);};}exports[_0xe340('0x29')]=function(_0x555325,_0x55a9cc){var _0x552a70={},_0x32949f={},_0x433187={'count':0x0,'rows':[]};var _0x441807=_[_0xe340('0x2a')](db['ZohoField']['rawAttributes'],function(_0x592dc6){return{'name':_0x592dc6[_0xe340('0x2b')],'type':_0x592dc6[_0xe340('0x2c')][_0xe340('0x2d')]};});_0x32949f[_0xe340('0x2e')]=_[_0xe340('0x2a')](_0x441807,'name');_0x32949f[_0xe340('0x2f')]=_[_0xe340('0x30')](_0x555325[_0xe340('0x2f')]);_0x32949f[_0xe340('0x31')]=_[_0xe340('0x32')](_0x32949f[_0xe340('0x2e')],_0x32949f[_0xe340('0x2f')]);_0x552a70[_0xe340('0x33')]=_[_0xe340('0x32')](_0x32949f[_0xe340('0x2e')],qs[_0xe340('0x34')](_0x555325[_0xe340('0x2f')][_0xe340('0x34')]));_0x552a70['attributes']=_0x552a70['attributes'][_0xe340('0x35')]?_0x552a70[_0xe340('0x33')]:_0x32949f[_0xe340('0x2e')];if(!_0x555325['query']['hasOwnProperty'](_0xe340('0x36'))){_0x552a70['limit']=qs['limit'](_0x555325['query'][_0xe340('0x1d')]);_0x552a70['offset']=qs[_0xe340('0x1c')](_0x555325[_0xe340('0x2f')][_0xe340('0x1c')]);}_0x552a70[_0xe340('0x37')]=qs[_0xe340('0x38')](_0x555325[_0xe340('0x2f')]['sort']);_0x552a70['where']=qs[_0xe340('0x31')](_[_0xe340('0x39')](_0x555325[_0xe340('0x2f')],_0x32949f[_0xe340('0x31')]),_0x441807);if(_0x555325['query'][_0xe340('0x3a')]){_0x552a70['where']=_[_0xe340('0x3b')](_0x552a70[_0xe340('0x3c')],{'$or':_['map'](_0x441807,function(_0x34f5eb){if(_0x34f5eb[_0xe340('0x2c')]!==_0xe340('0x3d')){var _0x5231f4={};_0x5231f4[_0x34f5eb[_0xe340('0x27')]]={'$like':'%'+_0x555325[_0xe340('0x2f')]['filter']+'%'};return _0x5231f4;}})});}_0x552a70=_[_0xe340('0x3b')]({},_0x552a70,_0x555325[_0xe340('0x3e')]);var _0x27cc88={'where':_0x552a70[_0xe340('0x3c')]};return db[_0xe340('0x3f')][_0xe340('0x40')](_0x27cc88)[_0xe340('0x24')](function(_0x212e67){_0x433187[_0xe340('0x40')]=_0x212e67;if(_0x555325[_0xe340('0x2f')][_0xe340('0x41')]){_0x552a70['include']=[{'all':!![]}];}return db[_0xe340('0x3f')][_0xe340('0x42')](_0x552a70);})[_0xe340('0x24')](function(_0x2b6388){_0x433187[_0xe340('0x43')]=_0x2b6388;return _0x433187;})[_0xe340('0x24')](respondWithFilteredResult(_0x55a9cc,_0x552a70))['catch'](handleError(_0x55a9cc,null));};exports[_0xe340('0x44')]=function(_0x2988a7,_0x146858){var _0x4df404={'raw':!![],'where':{'id':_0x2988a7[_0xe340('0x45')]['id']}},_0x1472d2={};_0x1472d2['model']=_[_0xe340('0x30')](db[_0xe340('0x3f')][_0xe340('0x46')]);_0x1472d2['query']=_[_0xe340('0x30')](_0x2988a7[_0xe340('0x2f')]);_0x1472d2[_0xe340('0x31')]=_[_0xe340('0x32')](_0x1472d2[_0xe340('0x2e')],_0x1472d2[_0xe340('0x2f')]);_0x4df404['attributes']=_['intersection'](_0x1472d2['model'],qs['fields'](_0x2988a7[_0xe340('0x2f')][_0xe340('0x34')]));_0x4df404[_0xe340('0x33')]=_0x4df404[_0xe340('0x33')][_0xe340('0x35')]?_0x4df404[_0xe340('0x33')]:_0x1472d2[_0xe340('0x2e')];if(_0x2988a7[_0xe340('0x2f')]['includeAll']){_0x4df404[_0xe340('0x47')]=[{'all':!![]}];}_0x4df404=_['merge']({},_0x4df404,_0x2988a7[_0xe340('0x3e')]);return db[_0xe340('0x3f')]['find'](_0x4df404)['then'](handleEntityNotFound(_0x146858,null))[_0xe340('0x24')](respondWithResult(_0x146858,null))['catch'](handleError(_0x146858,null));};exports[_0xe340('0x48')]=function(_0x1a5e07,_0x4e4c2c){return db[_0xe340('0x3f')][_0xe340('0x48')](_0x1a5e07[_0xe340('0x49')],{})[_0xe340('0x24')](respondWithResult(_0x4e4c2c,0xc9))[_0xe340('0x4a')](handleError(_0x4e4c2c,null));};exports[_0xe340('0x23')]=function(_0x10b21c,_0x5b16ff){if(_0x10b21c[_0xe340('0x49')]['id']){delete _0x10b21c[_0xe340('0x49')]['id'];}return db['ZohoField'][_0xe340('0x4b')]({'where':{'id':_0x10b21c['params']['id']}})[_0xe340('0x24')](handleEntityNotFound(_0x5b16ff,null))[_0xe340('0x24')](saveUpdates(_0x10b21c[_0xe340('0x49')],null))[_0xe340('0x24')](respondWithResult(_0x5b16ff,null))[_0xe340('0x4a')](handleError(_0x5b16ff,null));};exports[_0xe340('0x4c')]=function(_0x1cffb5,_0x4fbaea){return db[_0xe340('0x3f')][_0xe340('0x4b')]({'where':{'id':_0x1cffb5[_0xe340('0x45')]['id']}})[_0xe340('0x24')](handleEntityNotFound(_0x4fbaea,null))[_0xe340('0x24')](removeEntity(_0x4fbaea,null))['catch'](handleError(_0x4fbaea,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b4ee19f..57ed0f8 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 _0x6aa6=['./intZohoField.attributes','int_zoho_fields','zoho_unique_index','idField','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x8abd64,_0x539570){var _0xd2511e=function(_0x9fef7d){while(--_0x9fef7d){_0x8abd64['push'](_0x8abd64['shift']());}};_0xd2511e(++_0x539570);}(_0x6aa6,0x1ee));var _0x66aa=function(_0xc88848,_0x3c79ac){_0xc88848=_0xc88848-0x0;var _0x27d8ae=_0x6aa6[_0xc88848];return _0x27d8ae;};'use strict';var _=require(_0x66aa('0x0'));var util=require('util');var logger=require(_0x66aa('0x1'))('api');var moment=require(_0x66aa('0x2'));var BPromise=require('bluebird');var rp=require(_0x66aa('0x3'));var fs=require('fs');var path=require(_0x66aa('0x4'));var rimraf=require(_0x66aa('0x5'));var config=require('../../config/environment');var attributes=require(_0x66aa('0x6'));module['exports']=function(_0x6fad1b,_0x3dcb16){return _0x6fad1b['define']('ZohoField',attributes,{'tableName':_0x66aa('0x7'),'paranoid':![],'indexes':[{'name':_0x66aa('0x8'),'fields':[_0x66aa('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7f37=['./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2d17af,_0x5b9704){var _0x15df58=function(_0x30d795){while(--_0x30d795){_0x2d17af['push'](_0x2d17af['shift']());}};_0x15df58(++_0x5b9704);}(_0x7f37,0xd9));var _0x77f3=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7f37[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x77f3('0x0'));var util=require(_0x77f3('0x1'));var logger=require('../../config/logger')(_0x77f3('0x2'));var moment=require(_0x77f3('0x3'));var BPromise=require(_0x77f3('0x4'));var rp=require(_0x77f3('0x5'));var fs=require('fs');var path=require(_0x77f3('0x6'));var rimraf=require('rimraf');var config=require(_0x77f3('0x7'));var attributes=require(_0x77f3('0x8'));module[_0x77f3('0x9')]=function(_0x4cb26a,_0x44efa0){return _0x4cb26a[_0x77f3('0xa')]('ZohoField',attributes,{'tableName':_0x77f3('0xb'),'paranoid':![],'indexes':[{'name':_0x77f3('0xc'),'fields':[_0x77f3('0xd'),_0x77f3('0xe')],'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 3a4a441..b0fa82d 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 _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x1f9cc7,_0x38564b){var _0x3dcc30=function(_0x113b5e){while(--_0x113b5e){_0x1f9cc7['push'](_0x1f9cc7['shift']());}};_0x3dcc30(++_0x38564b);}(_0x425d,0x1e0));var _0xd425=function(_0x41cbab,_0x25ca4b){_0x41cbab=_0x41cbab-0x0;var _0x1c4b0e=_0x425d[_0x41cbab];return _0x1c4b0e;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){return client[_0xd425('0xc')](_0x1d97d9,_0x50b061)[_0xd425('0xd')](function(_0x2db9da){logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));logger[_0xd425('0x11')](_0xd425('0x12'),_0x1d2ed0,_0xd425('0x10'),JSON[_0xd425('0x13')](_0x2db9da));if(_0x2db9da[_0xd425('0x14')]){if(_0x2db9da[_0xd425('0x14')][_0xd425('0x15')]===0x1f4){logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);return _0x374c3d(_0x2db9da[_0xd425('0x14')]['message']);}logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')]['message']);return _0xb6ba8e(_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);}else{logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));_0xb6ba8e(_0x2db9da['result'][_0xd425('0x16')]);}})[_0xd425('0x17')](function(_0x7e267e){logger[_0xd425('0x14')]('ZohoField,\x20%s,\x20%s',_0x1d2ed0,_0x7e267e);_0x374c3d(_0x7e267e);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x22fb30,_0x31c201){var _0x4aecba=function(_0x528783){while(--_0x528783){_0x22fb30['push'](_0x22fb30['shift']());}};_0x4aecba(++_0x31c201);}(_0x34e8,0x12c));var _0x834e=function(_0x44eac4,_0x4eb789){_0x44eac4=_0x44eac4-0x0;var _0x2582e9=_0x34e8[_0x44eac4];return _0x2582e9;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('ZohoField,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('ZohoField,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index ce032c2..03b4be0 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 _0x8c50=['../../components/interaction/service','../../config/environment','util','connect-timeout','Router','../../components/auth/service'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x8c50,0x19a));var _0x08c5=function(_0xac53d0,_0x475785){_0xac53d0=_0xac53d0-0x0;var _0x517511=_0x8c50[_0xac53d0];return _0x517511;};'use strict';var multer=require('multer');var util=require(_0x08c5('0x0'));var path=require('path');var timeout=require(_0x08c5('0x1'));var express=require('express');var router=express[_0x08c5('0x2')]();var auth=require(_0x08c5('0x3'));var interaction=require(_0x08c5('0x4'));var config=require(_0x08c5('0x5'));module['exports']=router; \ No newline at end of file +var _0x8e60=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x5df5af,_0x35e02f){var _0x4f49d9=function(_0x5d7601){while(--_0x5d7601){_0x5df5af['push'](_0x5df5af['shift']());}};_0x4f49d9(++_0x35e02f);}(_0x8e60,0xd2));var _0x08e6=function(_0x2022bd,_0x244d49){_0x2022bd=_0x2022bd-0x0;var _0x16520a=_0x8e60[_0x2022bd];return _0x16520a;};'use strict';var multer=require(_0x08e6('0x0'));var util=require(_0x08e6('0x1'));var path=require(_0x08e6('0x2'));var timeout=require(_0x08e6('0x3'));var express=require(_0x08e6('0x4'));var router=express[_0x08e6('0x5')]();var auth=require(_0x08e6('0x6'));var interaction=require(_0x08e6('0x7'));var config=require(_0x08e6('0x8'));module[_0x08e6('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 47a7837..5a76687 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 _0x1ddd=['state','sequelize','STRING','app.js','INTEGER','BOOLEAN'];(function(_0x16da6f,_0x336861){var _0x49dc8f=function(_0x20c922){while(--_0x20c922){_0x16da6f['push'](_0x16da6f['shift']());}};_0x49dc8f(++_0x336861);}(_0x1ddd,0x103));var _0xd1dd=function(_0x461a5e,_0x75aa3){_0x461a5e=_0x461a5e-0x0;var _0x37491e=_0x1ddd[_0x461a5e];return _0x37491e;};'use strict';var Sequelize=require(_0xd1dd('0x0'));module['exports']={'name':{'type':Sequelize[_0xd1dd('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xd1dd('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0xd1dd('0x2')},'filename':{'type':Sequelize[_0xd1dd('0x1')]},'path':{'type':Sequelize[_0xd1dd('0x1')]},'type':{'type':Sequelize[_0xd1dd('0x1')]},'size':{'type':Sequelize[_0xd1dd('0x3')]},'active':{'type':Sequelize[_0xd1dd('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0xd1dd('0x5')},'description':{'type':Sequelize[_0xd1dd('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd1dd('0x1')]},'link':{'type':Sequelize[_0xd1dd('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xe232=['sequelize','unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state'];(function(_0x25f0aa,_0x319f87){var _0x433835=function(_0x2b8696){while(--_0x2b8696){_0x25f0aa['push'](_0x25f0aa['shift']());}};_0x433835(++_0x319f87);}(_0xe232,0x188));var _0x2e23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe232[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2e23('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2e23('0x1')},'version':{'type':Sequelize[_0x2e23('0x2')],'allowNull':![],'unique':_0x2e23('0x1')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x2e23('0x3')},'filename':{'type':Sequelize[_0x2e23('0x2')]},'path':{'type':Sequelize[_0x2e23('0x2')]},'type':{'type':Sequelize[_0x2e23('0x2')]},'size':{'type':Sequelize[_0x2e23('0x4')]},'active':{'type':Sequelize[_0x2e23('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x2e23('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x2e23('0x6')},'description':{'type':Sequelize[_0x2e23('0x2')]},'title':{'type':Sequelize[_0x2e23('0x2')]},'remoteUri':{'type':Sequelize[_0x2e23('0x2')]},'link':{'type':Sequelize[_0x2e23('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 65d4ff2..2f37f53 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 _0x5693=['filter','merge','where','options','Integration','include','rows','catch','show','rawAttributes','includeAll','find','create','body','update','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','querystring','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','set','apply','reject','save','then','error','name','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','filters','pick'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x5693,0x174));var _0x3569=function(_0x5a1533,_0x1dc425){_0x5a1533=_0x5a1533-0x0;var _0x3fba08=_0x5693[_0x5a1533];return _0x3fba08;};'use strict';var pdf=require(_0x3569('0x0'));var emlformat=require(_0x3569('0x1'));var rimraf=require(_0x3569('0x2'));var zipdir=require(_0x3569('0x3'));var jsonpatch=require(_0x3569('0x4'));var rp=require('request-promise');var moment=require(_0x3569('0x5'));var BPromise=require(_0x3569('0x6'));var Mustache=require('mustache');var util=require(_0x3569('0x7'));var path=require(_0x3569('0x8'));var sox=require('sox');var csv=require(_0x3569('0x9'));var ejs=require(_0x3569('0xa'));var fs=require('fs');var _=require(_0x3569('0xb'));var squel=require(_0x3569('0xc'));var crypto=require(_0x3569('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3569('0x9'));var querystring=require(_0x3569('0xe'));var Papa=require('papaparse');var Redis=require(_0x3569('0xf'));var authService=require(_0x3569('0x10'));var qs=require(_0x3569('0x11'));var as=require(_0x3569('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3569('0x13'))('api');var utils=require(_0x3569('0x14'));var config=require(_0x3569('0x15'));var licenseUtil=require(_0x3569('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f69d1,_0x1d5c83){_0x1d5c83=_0x1d5c83||0xcc;return function(_0x1ee00c){if(_0x1ee00c){return _0x3f69d1[_0x3569('0x17')](_0x1d5c83);}return _0x3f69d1['status'](_0x1d5c83)[_0x3569('0x18')]();};}function respondWithResult(_0x32ecd6,_0x223b4f){_0x223b4f=_0x223b4f||0xc8;return function(_0x26f0b9){if(_0x26f0b9){return _0x32ecd6[_0x3569('0x19')](_0x223b4f)[_0x3569('0x1a')](_0x26f0b9);}};}function respondWithFilteredResult(_0x2ddfa1,_0x2f37c1){return function(_0x502d3e){if(_0x502d3e){var _0x5c0bac=_0x502d3e[_0x3569('0x1b')],_0x4efaba=_0x2f37c1[_0x3569('0x1c')],_0x5a71eb=_0x2f37c1['offset']+_0x2f37c1['limit'],_0x47a4ba;if(_0x5a71eb>=_0x5c0bac){_0x5a71eb=_0x5c0bac;_0x47a4ba=0xc8;}else{_0x47a4ba=0xce;}_0x2ddfa1[_0x3569('0x19')](_0x47a4ba);return _0x2ddfa1[_0x3569('0x1d')]('Content-Range',_0x4efaba+'-'+_0x5a71eb+'/'+_0x5c0bac)['json'](_0x502d3e);}return null;};}function patchUpdates(_0x5941d4){return function(_0x1bbab5){try{jsonpatch[_0x3569('0x1e')](_0x1bbab5,_0x5941d4,!![]);}catch(_0x2b2eb4){return BPromise[_0x3569('0x1f')](_0x2b2eb4);}return _0x1bbab5[_0x3569('0x20')]();};}function saveUpdates(_0x155aaf,_0x432c44){return function(_0x2a9106){if(_0x2a9106){return _0x2a9106['update'](_0x155aaf)[_0x3569('0x21')](function(_0x56fed5){return _0x56fed5;});}return null;};}function removeEntity(_0x3772d8,_0xe5ef25){return function(_0x3c86c9){if(_0x3c86c9){return _0x3c86c9['destroy']()[_0x3569('0x21')](function(){_0x3772d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37f9c5,_0x111a44){return function(_0x17b1ca){if(!_0x17b1ca){_0x37f9c5[_0x3569('0x17')](0x194);}return _0x17b1ca;};}function handleError(_0x3102c6,_0x46a926){_0x46a926=_0x46a926||0x1f4;return function(_0x3c51f1){logger[_0x3569('0x22')](_0x3c51f1['stack']);if(_0x3c51f1['name']){delete _0x3c51f1[_0x3569('0x23')];}_0x3102c6['status'](_0x46a926)['send'](_0x3c51f1);};}exports[_0x3569('0x24')]=function(_0x1285ec,_0x27adac){var _0x347bdb={},_0x173fa5={},_0x517040={'count':0x0,'rows':[]};var _0x2d766c=_[_0x3569('0x25')](db['Integration']['rawAttributes'],function(_0x2a53dd){return{'name':_0x2a53dd[_0x3569('0x26')],'type':_0x2a53dd[_0x3569('0x27')][_0x3569('0x28')]};});_0x173fa5[_0x3569('0x29')]=_['map'](_0x2d766c,'name');_0x173fa5[_0x3569('0x2a')]=_[_0x3569('0x2b')](_0x1285ec[_0x3569('0x2a')]);_0x173fa5['filters']=_[_0x3569('0x2c')](_0x173fa5['model'],_0x173fa5[_0x3569('0x2a')]);_0x347bdb[_0x3569('0x2d')]=_[_0x3569('0x2c')](_0x173fa5['model'],qs[_0x3569('0x2e')](_0x1285ec[_0x3569('0x2a')][_0x3569('0x2e')]));_0x347bdb['attributes']=_0x347bdb[_0x3569('0x2d')][_0x3569('0x2f')]?_0x347bdb[_0x3569('0x2d')]:_0x173fa5['model'];if(!_0x1285ec['query']['hasOwnProperty'](_0x3569('0x30'))){_0x347bdb[_0x3569('0x31')]=qs['limit'](_0x1285ec[_0x3569('0x2a')][_0x3569('0x31')]);_0x347bdb[_0x3569('0x1c')]=qs[_0x3569('0x1c')](_0x1285ec['query'][_0x3569('0x1c')]);}_0x347bdb[_0x3569('0x32')]=qs[_0x3569('0x33')](_0x1285ec[_0x3569('0x2a')][_0x3569('0x33')]);_0x347bdb['where']=qs[_0x3569('0x34')](_[_0x3569('0x35')](_0x1285ec['query'],_0x173fa5[_0x3569('0x34')]),_0x2d766c);if(_0x1285ec[_0x3569('0x2a')][_0x3569('0x36')]){_0x347bdb['where']=_[_0x3569('0x37')](_0x347bdb[_0x3569('0x38')],{'$or':_[_0x3569('0x25')](_0x2d766c,function(_0x1f3a16){if(_0x1f3a16['type']!=='VIRTUAL'){var _0x43e80a={};_0x43e80a[_0x1f3a16[_0x3569('0x23')]]={'$like':'%'+_0x1285ec[_0x3569('0x2a')][_0x3569('0x36')]+'%'};return _0x43e80a;}})});}_0x347bdb=_[_0x3569('0x37')]({},_0x347bdb,_0x1285ec[_0x3569('0x39')]);var _0x211a35={'where':_0x347bdb['where']};return db[_0x3569('0x3a')][_0x3569('0x1b')](_0x211a35)[_0x3569('0x21')](function(_0xef13d0){_0x517040[_0x3569('0x1b')]=_0xef13d0;if(_0x1285ec['query']['includeAll']){_0x347bdb[_0x3569('0x3b')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x347bdb);})['then'](function(_0x3ff72f){_0x517040[_0x3569('0x3c')]=_0x3ff72f;return _0x517040;})[_0x3569('0x21')](respondWithFilteredResult(_0x27adac,_0x347bdb))[_0x3569('0x3d')](handleError(_0x27adac,null));};exports[_0x3569('0x3e')]=function(_0x2add18,_0x556177){var _0x1b60c3={'raw':![],'where':{'id':_0x2add18['params']['id']}},_0x1814fd={};_0x1814fd[_0x3569('0x29')]=_[_0x3569('0x2b')](db['Integration'][_0x3569('0x3f')]);_0x1814fd[_0x3569('0x2a')]=_['keys'](_0x2add18[_0x3569('0x2a')]);_0x1814fd[_0x3569('0x34')]=_[_0x3569('0x2c')](_0x1814fd[_0x3569('0x29')],_0x1814fd['query']);_0x1b60c3[_0x3569('0x2d')]=_[_0x3569('0x2c')](_0x1814fd[_0x3569('0x29')],qs[_0x3569('0x2e')](_0x2add18[_0x3569('0x2a')][_0x3569('0x2e')]));_0x1b60c3[_0x3569('0x2d')]=_0x1b60c3[_0x3569('0x2d')][_0x3569('0x2f')]?_0x1b60c3[_0x3569('0x2d')]:_0x1814fd[_0x3569('0x29')];if(_0x2add18[_0x3569('0x2a')][_0x3569('0x40')]){_0x1b60c3[_0x3569('0x3b')]=[{'all':!![]}];}_0x1b60c3=_[_0x3569('0x37')]({},_0x1b60c3,_0x2add18['options']);return db[_0x3569('0x3a')][_0x3569('0x41')](_0x1b60c3)[_0x3569('0x21')](handleEntityNotFound(_0x556177,null))['then'](respondWithResult(_0x556177,null))[_0x3569('0x3d')](handleError(_0x556177,null));};exports[_0x3569('0x42')]=function(_0x33d32b,_0x5357f4){return db['Integration']['create'](_0x33d32b[_0x3569('0x43')],{})[_0x3569('0x21')](respondWithResult(_0x5357f4,0xc9))[_0x3569('0x3d')](handleError(_0x5357f4,null));};exports[_0x3569('0x44')]=function(_0x3db39b,_0x405a58){if(_0x3db39b['body']['id']){delete _0x3db39b['body']['id'];}return db[_0x3569('0x3a')][_0x3569('0x41')]({'where':{'id':_0x3db39b[_0x3569('0x45')]['id']}})[_0x3569('0x21')](handleEntityNotFound(_0x405a58,null))[_0x3569('0x21')](saveUpdates(_0x3db39b['body'],null))[_0x3569('0x21')](respondWithResult(_0x405a58,null))[_0x3569('0x3d')](handleError(_0x405a58,null));};exports[_0x3569('0x46')]=function(_0x52ab08,_0x5da557){return db[_0x3569('0x3a')]['find']({'where':{'id':_0x52ab08[_0x3569('0x45')]['id']}})['then'](handleEntityNotFound(_0x5da557,null))[_0x3569('0x21')](removeEntity(_0x5da557,null))[_0x3569('0x3d')](handleError(_0x5da557,null));}; \ No newline at end of file +var _0xc659=['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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','Integration','count','then','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','html-pdf'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xc659,0x12f));var _0x9c65=function(_0x402dd1,_0x132faf){_0x402dd1=_0x402dd1-0x0;var _0x2fd7dd=_0xc659[_0x402dd1];return _0x2fd7dd;};'use strict';var pdf=require(_0x9c65('0x0'));var emlformat=require(_0x9c65('0x1'));var rimraf=require(_0x9c65('0x2'));var zipdir=require(_0x9c65('0x3'));var jsonpatch=require(_0x9c65('0x4'));var rp=require(_0x9c65('0x5'));var moment=require(_0x9c65('0x6'));var BPromise=require(_0x9c65('0x7'));var Mustache=require(_0x9c65('0x8'));var util=require(_0x9c65('0x9'));var path=require(_0x9c65('0xa'));var sox=require(_0x9c65('0xb'));var csv=require(_0x9c65('0xc'));var ejs=require(_0x9c65('0xd'));var fs=require('fs');var _=require(_0x9c65('0xe'));var squel=require('squel');var crypto=require(_0x9c65('0xf'));var jsforce=require(_0x9c65('0x10'));var deskjs=require(_0x9c65('0x11'));var toCsv=require(_0x9c65('0xc'));var querystring=require(_0x9c65('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9c65('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9c65('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c65('0x15'))(_0x9c65('0x16'));var utils=require(_0x9c65('0x17'));var config=require(_0x9c65('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c65('0x19'))['db'];function respondWithStatusCode(_0x2aec9a,_0x4e7114){_0x4e7114=_0x4e7114||0xcc;return function(_0x17e00c){if(_0x17e00c){return _0x2aec9a[_0x9c65('0x1a')](_0x4e7114);}return _0x2aec9a[_0x9c65('0x1b')](_0x4e7114)[_0x9c65('0x1c')]();};}function respondWithResult(_0x13bbb0,_0x489210){_0x489210=_0x489210||0xc8;return function(_0x3b543c){if(_0x3b543c){return _0x13bbb0['status'](_0x489210)[_0x9c65('0x1d')](_0x3b543c);}};}function respondWithFilteredResult(_0x2eedc8,_0x751973){return function(_0x2d8694){if(_0x2d8694){var _0x430016=_0x2d8694['count'],_0x240414=_0x751973['offset'],_0x149ba2=_0x751973[_0x9c65('0x1e')]+_0x751973[_0x9c65('0x1f')],_0x25fe1c;if(_0x149ba2>=_0x430016){_0x149ba2=_0x430016;_0x25fe1c=0xc8;}else{_0x25fe1c=0xce;}_0x2eedc8['status'](_0x25fe1c);return _0x2eedc8[_0x9c65('0x20')]('Content-Range',_0x240414+'-'+_0x149ba2+'/'+_0x430016)[_0x9c65('0x1d')](_0x2d8694);}return null;};}function patchUpdates(_0x17b861){return function(_0x2f671c){try{jsonpatch[_0x9c65('0x21')](_0x2f671c,_0x17b861,!![]);}catch(_0x16d0ff){return BPromise[_0x9c65('0x22')](_0x16d0ff);}return _0x2f671c[_0x9c65('0x23')]();};}function saveUpdates(_0x4f9363,_0x146327){return function(_0x470357){if(_0x470357){return _0x470357[_0x9c65('0x24')](_0x4f9363)['then'](function(_0x3ced61){return _0x3ced61;});}return null;};}function removeEntity(_0x1504bc,_0x283642){return function(_0x260b52){if(_0x260b52){return _0x260b52[_0x9c65('0x25')]()['then'](function(){_0x1504bc[_0x9c65('0x1b')](0xcc)[_0x9c65('0x1c')]();});}};}function handleEntityNotFound(_0x3b13b7,_0x415a4d){return function(_0x2218e6){if(!_0x2218e6){_0x3b13b7['sendStatus'](0x194);}return _0x2218e6;};}function handleError(_0x1e6ae8,_0x348a21){_0x348a21=_0x348a21||0x1f4;return function(_0x1e3edc){logger['error'](_0x1e3edc[_0x9c65('0x26')]);if(_0x1e3edc[_0x9c65('0x27')]){delete _0x1e3edc['name'];}_0x1e6ae8[_0x9c65('0x1b')](_0x348a21)[_0x9c65('0x28')](_0x1e3edc);};}exports[_0x9c65('0x29')]=function(_0x52b393,_0x34098d){var _0x173196={},_0xae2fa1={},_0x589217={'count':0x0,'rows':[]};var _0x49e017=_['map'](db['Integration'][_0x9c65('0x2a')],function(_0x4b6e17){return{'name':_0x4b6e17[_0x9c65('0x2b')],'type':_0x4b6e17[_0x9c65('0x2c')]['key']};});_0xae2fa1[_0x9c65('0x2d')]=_['map'](_0x49e017,'name');_0xae2fa1[_0x9c65('0x2e')]=_[_0x9c65('0x2f')](_0x52b393[_0x9c65('0x2e')]);_0xae2fa1[_0x9c65('0x30')]=_['intersection'](_0xae2fa1[_0x9c65('0x2d')],_0xae2fa1['query']);_0x173196[_0x9c65('0x31')]=_['intersection'](_0xae2fa1[_0x9c65('0x2d')],qs[_0x9c65('0x32')](_0x52b393[_0x9c65('0x2e')][_0x9c65('0x32')]));_0x173196[_0x9c65('0x31')]=_0x173196[_0x9c65('0x31')][_0x9c65('0x33')]?_0x173196['attributes']:_0xae2fa1[_0x9c65('0x2d')];if(!_0x52b393[_0x9c65('0x2e')][_0x9c65('0x34')](_0x9c65('0x35'))){_0x173196['limit']=qs[_0x9c65('0x1f')](_0x52b393[_0x9c65('0x2e')][_0x9c65('0x1f')]);_0x173196[_0x9c65('0x1e')]=qs[_0x9c65('0x1e')](_0x52b393[_0x9c65('0x2e')][_0x9c65('0x1e')]);}_0x173196[_0x9c65('0x36')]=qs[_0x9c65('0x37')](_0x52b393[_0x9c65('0x2e')][_0x9c65('0x37')]);_0x173196[_0x9c65('0x38')]=qs['filters'](_[_0x9c65('0x39')](_0x52b393[_0x9c65('0x2e')],_0xae2fa1[_0x9c65('0x30')]),_0x49e017);if(_0x52b393['query'][_0x9c65('0x3a')]){_0x173196[_0x9c65('0x38')]=_['merge'](_0x173196[_0x9c65('0x38')],{'$or':_[_0x9c65('0x3b')](_0x49e017,function(_0x1de23b){if(_0x1de23b[_0x9c65('0x2c')]!==_0x9c65('0x3c')){var _0x3fc4d5={};_0x3fc4d5[_0x1de23b['name']]={'$like':'%'+_0x52b393['query'][_0x9c65('0x3a')]+'%'};return _0x3fc4d5;}})});}_0x173196=_[_0x9c65('0x3d')]({},_0x173196,_0x52b393[_0x9c65('0x3e')]);var _0x4be900={'where':_0x173196[_0x9c65('0x38')]};return db[_0x9c65('0x3f')][_0x9c65('0x40')](_0x4be900)[_0x9c65('0x41')](function(_0x2da3d9){_0x589217['count']=_0x2da3d9;if(_0x52b393[_0x9c65('0x2e')][_0x9c65('0x42')]){_0x173196[_0x9c65('0x43')]=[{'all':!![]}];}return db[_0x9c65('0x3f')][_0x9c65('0x44')](_0x173196);})['then'](function(_0x193d77){_0x589217[_0x9c65('0x45')]=_0x193d77;return _0x589217;})[_0x9c65('0x41')](respondWithFilteredResult(_0x34098d,_0x173196))[_0x9c65('0x46')](handleError(_0x34098d,null));};exports[_0x9c65('0x47')]=function(_0x18a1c0,_0x6db7ff){var _0x3e43be={'raw':![],'where':{'id':_0x18a1c0[_0x9c65('0x48')]['id']}},_0x5c9d04={};_0x5c9d04[_0x9c65('0x2d')]=_[_0x9c65('0x2f')](db[_0x9c65('0x3f')][_0x9c65('0x2a')]);_0x5c9d04['query']=_['keys'](_0x18a1c0[_0x9c65('0x2e')]);_0x5c9d04['filters']=_[_0x9c65('0x49')](_0x5c9d04[_0x9c65('0x2d')],_0x5c9d04['query']);_0x3e43be[_0x9c65('0x31')]=_[_0x9c65('0x49')](_0x5c9d04['model'],qs[_0x9c65('0x32')](_0x18a1c0['query']['fields']));_0x3e43be[_0x9c65('0x31')]=_0x3e43be[_0x9c65('0x31')][_0x9c65('0x33')]?_0x3e43be[_0x9c65('0x31')]:_0x5c9d04[_0x9c65('0x2d')];if(_0x18a1c0[_0x9c65('0x2e')][_0x9c65('0x42')]){_0x3e43be['include']=[{'all':!![]}];}_0x3e43be=_[_0x9c65('0x3d')]({},_0x3e43be,_0x18a1c0[_0x9c65('0x3e')]);return db['Integration'][_0x9c65('0x4a')](_0x3e43be)[_0x9c65('0x41')](handleEntityNotFound(_0x6db7ff,null))[_0x9c65('0x41')](respondWithResult(_0x6db7ff,null))['catch'](handleError(_0x6db7ff,null));};exports[_0x9c65('0x4b')]=function(_0x24bfbc,_0x359e33){return db[_0x9c65('0x3f')][_0x9c65('0x4b')](_0x24bfbc['body'],{})[_0x9c65('0x41')](respondWithResult(_0x359e33,0xc9))[_0x9c65('0x46')](handleError(_0x359e33,null));};exports[_0x9c65('0x24')]=function(_0x3f988f,_0x420133){if(_0x3f988f['body']['id']){delete _0x3f988f['body']['id'];}return db[_0x9c65('0x3f')][_0x9c65('0x4a')]({'where':{'id':_0x3f988f[_0x9c65('0x48')]['id']}})[_0x9c65('0x41')](handleEntityNotFound(_0x420133,null))['then'](saveUpdates(_0x3f988f['body'],null))[_0x9c65('0x41')](respondWithResult(_0x420133,null))['catch'](handleError(_0x420133,null));};exports[_0x9c65('0x25')]=function(_0x2f16cc,_0x2e4dfa){return db['Integration'][_0x9c65('0x4a')]({'where':{'id':_0x2f16cc['params']['id']}})[_0x9c65('0x41')](handleEntityNotFound(_0x2e4dfa,null))[_0x9c65('0x41')](removeEntity(_0x2e4dfa,null))['catch'](handleError(_0x2e4dfa,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index ba13579..6e1dbcb 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 _0x225b=['request-promise','rimraf','../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x296754,_0x5befe9){var _0x1d9f1d=function(_0x3f033e){while(--_0x3f033e){_0x296754['push'](_0x296754['shift']());}};_0x1d9f1d(++_0x5befe9);}(_0x225b,0xf1));var _0xb225=function(_0x24c28c,_0x1b0fbe){_0x24c28c=_0x24c28c-0x0;var _0x482197=_0x225b[_0x24c28c];return _0x482197;};'use strict';var _=require(_0xb225('0x0'));var util=require(_0xb225('0x1'));var logger=require(_0xb225('0x2'))(_0xb225('0x3'));var moment=require(_0xb225('0x4'));var BPromise=require(_0xb225('0x5'));var rp=require(_0xb225('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb225('0x7'));var config=require(_0xb225('0x8'));var attributes=require('./integration.attributes');module[_0xb225('0x9')]=function(_0x21f09e,_0x210e1b){return _0x21f09e[_0xb225('0xa')](_0xb225('0xb'),attributes,{'tableName':_0xb225('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb46=['bluebird','request-promise','path','rimraf','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','moment'];(function(_0xf1febe,_0x4b0182){var _0x560123=function(_0x1e9216){while(--_0x1e9216){_0xf1febe['push'](_0xf1febe['shift']());}};_0x560123(++_0x4b0182);}(_0xbb46,0xf8));var _0x6bb4=function(_0x268e12,_0x3c62dc){_0x268e12=_0x268e12-0x0;var _0x1d0aeb=_0xbb46[_0x268e12];return _0x1d0aeb;};'use strict';var _=require(_0x6bb4('0x0'));var util=require(_0x6bb4('0x1'));var logger=require(_0x6bb4('0x2'))('api');var moment=require(_0x6bb4('0x3'));var BPromise=require(_0x6bb4('0x4'));var rp=require(_0x6bb4('0x5'));var fs=require('fs');var path=require(_0x6bb4('0x6'));var rimraf=require(_0x6bb4('0x7'));var config=require('../../config/environment');var attributes=require(_0x6bb4('0x8'));module[_0x6bb4('0x9')]=function(_0x5aa661,_0x50a091){return _0x5aa661[_0x6bb4('0xa')]('Integration',attributes,{'tableName':_0x6bb4('0xb'),'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 78b64cb..fe94b7e 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 _0xb71d=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x576e3a,_0x540867){var _0x4c8b0e=function(_0x4869d0){while(--_0x4869d0){_0x576e3a['push'](_0x576e3a['shift']());}};_0x4c8b0e(++_0x540867);}(_0xb71d,0xc0));var _0xdb71=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb71d[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xdb71('0x0'));var util=require(_0xdb71('0x1'));var moment=require(_0xdb71('0x2'));var BPromise=require(_0xdb71('0x3'));var rs=require(_0xdb71('0x4'));var fs=require('fs');var Redis=require(_0xdb71('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb71('0x6'));var logger=require(_0xdb71('0x7'))(_0xdb71('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb71('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4512f8,_0x4d142c,_0x5070bc){return new BPromise(function(_0x28bbfc,_0x5e3b43){return client[_0xdb71('0xa')](_0x4512f8,_0x5070bc)[_0xdb71('0xb')](function(_0x5826db){logger[_0xdb71('0xc')](_0xdb71('0xd'),_0x4d142c,_0xdb71('0xe'));logger[_0xdb71('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x4d142c,_0xdb71('0xe'),JSON['stringify'](_0x5826db));if(_0x5826db[_0xdb71('0x10')]){if(_0x5826db[_0xdb71('0x10')][_0xdb71('0x11')]===0x1f4){logger[_0xdb71('0x10')]('Integration,\x20%s,\x20%s',_0x4d142c,_0x5826db[_0xdb71('0x10')]['message']);return _0x5e3b43(_0x5826db[_0xdb71('0x10')]['message']);}logger[_0xdb71('0x10')](_0xdb71('0xd'),_0x4d142c,_0x5826db[_0xdb71('0x10')]['message']);return _0x28bbfc(_0x5826db[_0xdb71('0x10')][_0xdb71('0x12')]);}else{logger[_0xdb71('0xc')](_0xdb71('0xd'),_0x4d142c,'request\x20sent');_0x28bbfc(_0x5826db['result'][_0xdb71('0x12')]);}})['catch'](function(_0x1b5315){logger[_0xdb71('0x10')](_0xdb71('0xd'),_0x4d142c,_0x1b5315);_0x5e3b43(_0x1b5315);});});} \ No newline at end of file +var _0xb4a3=['../../config/logger','../../config/environment','client','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3912b7,_0x55a291){var _0x5a57e5=function(_0x5a7b4c){while(--_0x5a7b4c){_0x3912b7['push'](_0x3912b7['shift']());}};_0x5a57e5(++_0x55a291);}(_0xb4a3,0x174));var _0x3b4a=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0xb4a3[_0x291f8b];return _0x275171;};'use strict';var _=require(_0x3b4a('0x0'));var util=require(_0x3b4a('0x1'));var moment=require('moment');var BPromise=require(_0x3b4a('0x2'));var rs=require(_0x3b4a('0x3'));var fs=require('fs');var Redis=require(_0x3b4a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b4a('0x5'));var logger=require(_0x3b4a('0x6'))('rpc');var config=require(_0x3b4a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3b4a('0x8')][_0x3b4a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dbe46,_0x4baf27,_0x5d291b){return new BPromise(function(_0x1b1482,_0x16c77a){return client['request'](_0x3dbe46,_0x5d291b)['then'](function(_0x3fd85e){logger[_0x3b4a('0xa')](_0x3b4a('0xb'),_0x4baf27,_0x3b4a('0xc'));logger[_0x3b4a('0xd')]('Integration,\x20%s,\x20%s,\x20%s',_0x4baf27,_0x3b4a('0xc'),JSON[_0x3b4a('0xe')](_0x3fd85e));if(_0x3fd85e[_0x3b4a('0xf')]){if(_0x3fd85e[_0x3b4a('0xf')]['code']===0x1f4){logger[_0x3b4a('0xf')](_0x3b4a('0xb'),_0x4baf27,_0x3fd85e['error'][_0x3b4a('0x10')]);return _0x16c77a(_0x3fd85e[_0x3b4a('0xf')][_0x3b4a('0x10')]);}logger[_0x3b4a('0xf')](_0x3b4a('0xb'),_0x4baf27,_0x3fd85e[_0x3b4a('0xf')][_0x3b4a('0x10')]);return _0x1b1482(_0x3fd85e['error'][_0x3b4a('0x10')]);}else{logger['info'](_0x3b4a('0xb'),_0x4baf27,_0x3b4a('0xc'));_0x1b1482(_0x3fd85e['result'][_0x3b4a('0x10')]);}})[_0x3b4a('0x11')](function(_0x5eaca8){logger[_0x3b4a('0xf')](_0x3b4a('0xb'),_0x4baf27,_0x5eaca8);_0x16c77a(_0x5eaca8);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 3887aaa..9e01cad 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 _0xb427=['/:id','post','create','put','delete','destroy','exports','util','path','express','Router','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x2258c1,_0x305d38){var _0x2349c6=function(_0x4d431c){while(--_0x4d431c){_0x2258c1['push'](_0x2258c1['shift']());}};_0x2349c6(++_0x305d38);}(_0xb427,0x139));var _0x7b42=function(_0x5d2ae5,_0x4c2804){_0x5d2ae5=_0x5d2ae5-0x0;var _0x3db644=_0xb427[_0x5d2ae5];return _0x3db644;};'use strict';var multer=require('multer');var util=require(_0x7b42('0x0'));var path=require(_0x7b42('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b42('0x2'));var router=express[_0x7b42('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7b42('0x4'));var controller=require(_0x7b42('0x5'));router[_0x7b42('0x6')]('/',auth['isAuthenticated'](),controller[_0x7b42('0x7')]);router['get'](_0x7b42('0x8'),auth[_0x7b42('0x9')](),controller[_0x7b42('0xa')]);router[_0x7b42('0x6')](_0x7b42('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7b42('0xc')]('/',auth['isAuthenticated'](),controller[_0x7b42('0xd')]);router[_0x7b42('0xe')](_0x7b42('0xb'),auth[_0x7b42('0x9')](),controller['update']);router[_0x7b42('0xf')](_0x7b42('0xb'),auth['isAuthenticated'](),controller[_0x7b42('0x10')]);module[_0x7b42('0x11')]=router; \ No newline at end of file +var _0x0e3e=['/:id','show','put','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x5f4894,_0x51aa24){var _0x4d0a71=function(_0x19aad5){while(--_0x19aad5){_0x5f4894['push'](_0x5f4894['shift']());}};_0x4d0a71(++_0x51aa24);}(_0x0e3e,0x16b));var _0xe0e3=function(_0x263a04,_0x155b97){_0x263a04=_0x263a04-0x0;var _0x44e9bd=_0x0e3e[_0x263a04];return _0x44e9bd;};'use strict';var multer=require(_0xe0e3('0x0'));var util=require('util');var path=require(_0xe0e3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe0e3('0x2')]();var auth=require(_0xe0e3('0x3'));var interaction=require(_0xe0e3('0x4'));var config=require(_0xe0e3('0x5'));var controller=require(_0xe0e3('0x6'));router[_0xe0e3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe0e3('0x7')](_0xe0e3('0x8'),auth[_0xe0e3('0x9')](),controller[_0xe0e3('0xa')]);router[_0xe0e3('0x7')](_0xe0e3('0xb'),auth['isAuthenticated'](),controller[_0xe0e3('0xc')]);router['post']('/',auth[_0xe0e3('0x9')](),controller['create']);router[_0xe0e3('0xd')](_0xe0e3('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xe0e3('0xe')]('/:id',auth[_0xe0e3('0x9')](),controller[_0xe0e3('0xf')]);module[_0xe0e3('0x10')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 45c6e17..61750dd 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 _0xa27d=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','DATE','INTEGER','BOOLEAN','TEXT'];(function(_0x5258bd,_0x2e4919){var _0xd562d2=function(_0x284e02){while(--_0x284e02){_0x5258bd['push'](_0x5258bd['shift']());}};_0xd562d2(++_0x2e4919);}(_0xa27d,0xec));var _0xda27=function(_0x2fe5b9,_0x127e48){_0x2fe5b9=_0x2fe5b9-0x0;var _0x6f874=_0xa27d[_0x2fe5b9];return _0x6f874;};'use strict';var Sequelize=require(_0xda27('0x0'));module['exports']={'integration':{'type':Sequelize[_0xda27('0x1')]},'eventChannel':{'type':Sequelize[_0xda27('0x1')]},'exitStatus':{'type':Sequelize[_0xda27('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xda27('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xda27('0x1')]},'membername':{'type':Sequelize[_0xda27('0x1')]},'agentcalledAt':{'type':Sequelize[_0xda27('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xda27('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xda27('0x2')]},'talktime':{'type':Sequelize[_0xda27('0x3')]},'agentacw':{'type':Sequelize[_0xda27('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xda27('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xda27('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xda27('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xda27('0x1')]},'channelstate':{'type':Sequelize[_0xda27('0x3')]},'channelstatedesc':{'type':Sequelize[_0xda27('0x1')]},'connectedlinenum':{'type':Sequelize[_0xda27('0x1')]},'connectedlinename':{'type':Sequelize[_0xda27('0x1')]},'language':{'type':Sequelize[_0xda27('0x1')]},'accountcode':{'type':Sequelize[_0xda27('0x1')]},'context':{'type':Sequelize[_0xda27('0x1')]},'exten':{'type':Sequelize[_0xda27('0x1')]},'priority':{'type':Sequelize[_0xda27('0x1')]},'destchannel':{'type':Sequelize[_0xda27('0x1')]},'destchannelstate':{'type':Sequelize[_0xda27('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xda27('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xda27('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xda27('0x1')]},'destlanguage':{'type':Sequelize[_0xda27('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xda27('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xda27('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xda27('0x1')]},'inReplyTo':{'type':Sequelize[_0xda27('0x1')]},'subject':{'type':Sequelize[_0xda27('0x1')]},'from':{'type':Sequelize[_0xda27('0x1')]},'to':{'type':Sequelize[_0xda27('0x1')]},'cc':{'type':Sequelize[_0xda27('0x1')]},'attachment':{'type':Sequelize[_0xda27('0x5')]},'html':{'type':Sequelize[_0xda27('0x5')]},'text':{'type':Sequelize[_0xda27('0x5')]},'status':{'type':Sequelize[_0xda27('0x6')](_0xda27('0x7'),_0xda27('0x8'),_0xda27('0x9'),_0xda27('0xa'))},'url':{'type':Sequelize[_0xda27('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xda27('0x1')]},'projectId':{'type':Sequelize[_0xda27('0x3')]}}; \ No newline at end of file +var _0xe08e=['DATE','BOOLEAN','TEXT','ENUM','SENT','exports','STRING','INTEGER'];(function(_0x86a266,_0x58c42d){var _0x4c9b2c=function(_0x59a6ed){while(--_0x59a6ed){_0x86a266['push'](_0x86a266['shift']());}};_0x4c9b2c(++_0x58c42d);}(_0xe08e,0x1b5));var _0xee08=function(_0x41c4ef,_0x1e3bf8){_0x41c4ef=_0x41c4ef-0x0;var _0x5c596b=_0xe08e[_0x41c4ef];return _0x5c596b;};'use strict';var Sequelize=require('sequelize');module[_0xee08('0x0')]={'integration':{'type':Sequelize[_0xee08('0x1')]},'eventChannel':{'type':Sequelize[_0xee08('0x1')]},'exitStatus':{'type':Sequelize[_0xee08('0x1')]},'ticketId':{'type':Sequelize[_0xee08('0x1')]},'integrationId':{'type':Sequelize[_0xee08('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xee08('0x1')]},'calleridnum':{'type':Sequelize[_0xee08('0x1')]},'calleridname':{'type':Sequelize[_0xee08('0x1')]},'queue':{'type':Sequelize[_0xee08('0x1')]},'interface':{'type':Sequelize[_0xee08('0x1')]},'membername':{'type':Sequelize[_0xee08('0x1')]},'agentcalledAt':{'type':Sequelize[_0xee08('0x3')]},'agentconnectAt':{'type':Sequelize[_0xee08('0x3')]},'holdtime':{'type':Sequelize[_0xee08('0x2')]},'agentcomplete':{'type':Sequelize[_0xee08('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xee08('0x3')]},'talktime':{'type':Sequelize[_0xee08('0x2')]},'agentacw':{'type':Sequelize[_0xee08('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xee08('0x2')]},'reason':{'type':Sequelize[_0xee08('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xee08('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xee08('0x3')]},'lastevent':{'type':Sequelize[_0xee08('0x1')]},'channel':{'type':Sequelize[_0xee08('0x1')]},'channelstate':{'type':Sequelize[_0xee08('0x2')]},'channelstatedesc':{'type':Sequelize[_0xee08('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xee08('0x1')]},'language':{'type':Sequelize[_0xee08('0x1')]},'accountcode':{'type':Sequelize[_0xee08('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xee08('0x1')]},'priority':{'type':Sequelize[_0xee08('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xee08('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xee08('0x1')]},'destcalleridnum':{'type':Sequelize[_0xee08('0x1')]},'destcalleridname':{'type':Sequelize[_0xee08('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xee08('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xee08('0x1')]},'destlanguage':{'type':Sequelize[_0xee08('0x1')]},'destaccountcode':{'type':Sequelize[_0xee08('0x1')]},'destcontext':{'type':Sequelize[_0xee08('0x1')]},'destexten':{'type':Sequelize[_0xee08('0x1')]},'destpriority':{'type':Sequelize[_0xee08('0x1')]},'destuniqueid':{'type':Sequelize[_0xee08('0x1')]},'messageId':{'type':Sequelize[_0xee08('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xee08('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xee08('0x1')]},'attachment':{'type':Sequelize[_0xee08('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xee08('0x6')](_0xee08('0x7'),'SENDING','RECEIVED','FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xee08('0x1')]},'appdata':{'type':Sequelize[_0xee08('0x1')]},'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 0789906..d3b8495 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 _0xfd34=['options','count','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','merge'];(function(_0x108f83,_0x5a3f53){var _0xf835ac=function(_0x3b05ab){while(--_0x3b05ab){_0x108f83['push'](_0x108f83['shift']());}};_0xf835ac(++_0x5a3f53);}(_0xfd34,0xa1));var _0x4fd3=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0xfd34[_0xd2d54];return _0x78b113;};'use strict';var pdf=require(_0x4fd3('0x0'));var emlformat=require(_0x4fd3('0x1'));var rimraf=require(_0x4fd3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4fd3('0x3'));var BPromise=require(_0x4fd3('0x4'));var Mustache=require(_0x4fd3('0x5'));var util=require(_0x4fd3('0x6'));var path=require('path');var sox=require(_0x4fd3('0x7'));var csv=require(_0x4fd3('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4fd3('0x9'));var squel=require(_0x4fd3('0xa'));var crypto=require(_0x4fd3('0xb'));var jsforce=require(_0x4fd3('0xc'));var deskjs=require(_0x4fd3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4fd3('0xe'));var Papa=require(_0x4fd3('0xf'));var Redis=require(_0x4fd3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4fd3('0x11'));var as=require(_0x4fd3('0x12'));var hardwareService=require(_0x4fd3('0x13'));var logger=require(_0x4fd3('0x14'))(_0x4fd3('0x15'));var utils=require(_0x4fd3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4fd3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d9d2c,_0x3787e5){_0x3787e5=_0x3787e5||0xcc;return function(_0x305a6b){if(_0x305a6b){return _0x1d9d2c['sendStatus'](_0x3787e5);}return _0x1d9d2c[_0x4fd3('0x18')](_0x3787e5)[_0x4fd3('0x19')]();};}function respondWithResult(_0x9f0cde,_0x5e4448){_0x5e4448=_0x5e4448||0xc8;return function(_0x135e8d){if(_0x135e8d){return _0x9f0cde[_0x4fd3('0x18')](_0x5e4448)[_0x4fd3('0x1a')](_0x135e8d);}};}function respondWithFilteredResult(_0x489b5f,_0x23004d){return function(_0x41a86a){if(_0x41a86a){var _0x40cb74=_0x41a86a['count'],_0x4bad1f=_0x23004d[_0x4fd3('0x1b')],_0x3f9b33=_0x23004d['offset']+_0x23004d[_0x4fd3('0x1c')],_0x9d79b2;if(_0x3f9b33>=_0x40cb74){_0x3f9b33=_0x40cb74;_0x9d79b2=0xc8;}else{_0x9d79b2=0xce;}_0x489b5f[_0x4fd3('0x18')](_0x9d79b2);return _0x489b5f[_0x4fd3('0x1d')]('Content-Range',_0x4bad1f+'-'+_0x3f9b33+'/'+_0x40cb74)['json'](_0x41a86a);}return null;};}function patchUpdates(_0x12a9c8){return function(_0x11e7a3){try{jsonpatch[_0x4fd3('0x1e')](_0x11e7a3,_0x12a9c8,!![]);}catch(_0x4c9be5){return BPromise[_0x4fd3('0x1f')](_0x4c9be5);}return _0x11e7a3[_0x4fd3('0x20')]();};}function saveUpdates(_0x920f0b,_0x309206){return function(_0xc1b3bf){if(_0xc1b3bf){return _0xc1b3bf[_0x4fd3('0x21')](_0x920f0b)['then'](function(_0x48ea90){return _0x48ea90;});}return null;};}function removeEntity(_0x395d7c,_0x25992c){return function(_0x4f546c){if(_0x4f546c){return _0x4f546c[_0x4fd3('0x22')]()[_0x4fd3('0x23')](function(){_0x395d7c[_0x4fd3('0x18')](0xcc)[_0x4fd3('0x19')]();});}};}function handleEntityNotFound(_0x37e90a,_0x5d4ede){return function(_0x34eb3f){if(!_0x34eb3f){_0x37e90a[_0x4fd3('0x24')](0x194);}return _0x34eb3f;};}function handleError(_0x418a15,_0x16d486){_0x16d486=_0x16d486||0x1f4;return function(_0x3cdd40){logger[_0x4fd3('0x25')](_0x3cdd40[_0x4fd3('0x26')]);if(_0x3cdd40[_0x4fd3('0x27')]){delete _0x3cdd40['name'];}_0x418a15[_0x4fd3('0x18')](_0x16d486)[_0x4fd3('0x28')](_0x3cdd40);};}exports[_0x4fd3('0x29')]=function(_0x15f35b,_0x5033ca){var _0x3cb6ff={},_0x43a55f={},_0x37b790={'count':0x0,'rows':[]};var _0x464af3=_[_0x4fd3('0x2a')](db[_0x4fd3('0x2b')][_0x4fd3('0x2c')],function(_0x31182f){return{'name':_0x31182f[_0x4fd3('0x2d')],'type':_0x31182f[_0x4fd3('0x2e')][_0x4fd3('0x2f')]};});_0x43a55f[_0x4fd3('0x30')]=_['map'](_0x464af3,'name');_0x43a55f[_0x4fd3('0x31')]=_['keys'](_0x15f35b[_0x4fd3('0x31')]);_0x43a55f[_0x4fd3('0x32')]=_[_0x4fd3('0x33')](_0x43a55f['model'],_0x43a55f[_0x4fd3('0x31')]);_0x3cb6ff[_0x4fd3('0x34')]=_['intersection'](_0x43a55f[_0x4fd3('0x30')],qs[_0x4fd3('0x35')](_0x15f35b['query'][_0x4fd3('0x35')]));_0x3cb6ff['attributes']=_0x3cb6ff[_0x4fd3('0x34')][_0x4fd3('0x36')]?_0x3cb6ff['attributes']:_0x43a55f[_0x4fd3('0x30')];if(!_0x15f35b[_0x4fd3('0x31')][_0x4fd3('0x37')]('nolimit')){_0x3cb6ff['limit']=qs[_0x4fd3('0x1c')](_0x15f35b[_0x4fd3('0x31')][_0x4fd3('0x1c')]);_0x3cb6ff['offset']=qs[_0x4fd3('0x1b')](_0x15f35b[_0x4fd3('0x31')]['offset']);}_0x3cb6ff['order']=qs[_0x4fd3('0x38')](_0x15f35b[_0x4fd3('0x31')]['sort']);_0x3cb6ff[_0x4fd3('0x39')]=qs[_0x4fd3('0x32')](_[_0x4fd3('0x3a')](_0x15f35b[_0x4fd3('0x31')],_0x43a55f[_0x4fd3('0x32')]),_0x464af3);if(_0x15f35b[_0x4fd3('0x31')]['filter']){_0x3cb6ff[_0x4fd3('0x39')]=_['merge'](_0x3cb6ff[_0x4fd3('0x39')],{'$or':_[_0x4fd3('0x2a')](_0x464af3,function(_0x658e82){if(_0x658e82[_0x4fd3('0x2e')]!==_0x4fd3('0x3b')){var _0x70b0f3={};_0x70b0f3[_0x658e82['name']]={'$like':'%'+_0x15f35b['query']['filter']+'%'};return _0x70b0f3;}})});}_0x3cb6ff=_[_0x4fd3('0x3c')]({},_0x3cb6ff,_0x15f35b[_0x4fd3('0x3d')]);var _0x994664={'where':_0x3cb6ff[_0x4fd3('0x39')]};return db[_0x4fd3('0x2b')][_0x4fd3('0x3e')](_0x994664)[_0x4fd3('0x23')](function(_0x5c921f){_0x37b790[_0x4fd3('0x3e')]=_0x5c921f;if(_0x15f35b['query'][_0x4fd3('0x3f')]){_0x3cb6ff[_0x4fd3('0x40')]=[{'all':!![]}];}return db[_0x4fd3('0x2b')][_0x4fd3('0x41')](_0x3cb6ff);})['then'](function(_0x13075f){_0x37b790['rows']=_0x13075f;return _0x37b790;})[_0x4fd3('0x23')](respondWithFilteredResult(_0x5033ca,_0x3cb6ff))[_0x4fd3('0x42')](handleError(_0x5033ca,null));};exports[_0x4fd3('0x43')]=function(_0x5dc828,_0x277bc7){var _0x1b5cf9={'raw':![],'where':{'id':_0x5dc828[_0x4fd3('0x44')]['id']}},_0x58ff9c={};_0x58ff9c[_0x4fd3('0x30')]=_[_0x4fd3('0x45')](db[_0x4fd3('0x2b')][_0x4fd3('0x2c')]);_0x58ff9c[_0x4fd3('0x31')]=_[_0x4fd3('0x45')](_0x5dc828[_0x4fd3('0x31')]);_0x58ff9c[_0x4fd3('0x32')]=_['intersection'](_0x58ff9c[_0x4fd3('0x30')],_0x58ff9c[_0x4fd3('0x31')]);_0x1b5cf9[_0x4fd3('0x34')]=_[_0x4fd3('0x33')](_0x58ff9c[_0x4fd3('0x30')],qs[_0x4fd3('0x35')](_0x5dc828[_0x4fd3('0x31')][_0x4fd3('0x35')]));_0x1b5cf9['attributes']=_0x1b5cf9[_0x4fd3('0x34')]['length']?_0x1b5cf9[_0x4fd3('0x34')]:_0x58ff9c['model'];if(_0x5dc828[_0x4fd3('0x31')][_0x4fd3('0x3f')]){_0x1b5cf9[_0x4fd3('0x40')]=[{'all':!![]}];}_0x1b5cf9=_[_0x4fd3('0x3c')]({},_0x1b5cf9,_0x5dc828[_0x4fd3('0x3d')]);return db[_0x4fd3('0x2b')][_0x4fd3('0x46')](_0x1b5cf9)[_0x4fd3('0x23')](handleEntityNotFound(_0x277bc7,null))[_0x4fd3('0x23')](respondWithResult(_0x277bc7,null))[_0x4fd3('0x42')](handleError(_0x277bc7,null));};exports[_0x4fd3('0x47')]=function(_0xea1635,_0x498eb6){return db['IntegrationReport'][_0x4fd3('0x47')](_0xea1635['body'],{})[_0x4fd3('0x23')](respondWithResult(_0x498eb6,0xc9))[_0x4fd3('0x42')](handleError(_0x498eb6,null));};exports[_0x4fd3('0x21')]=function(_0x4ca820,_0x14efc2){if(_0x4ca820['body']['id']){delete _0x4ca820[_0x4fd3('0x48')]['id'];}return db[_0x4fd3('0x2b')][_0x4fd3('0x46')]({'where':{'id':_0x4ca820['params']['id']}})[_0x4fd3('0x23')](handleEntityNotFound(_0x14efc2,null))[_0x4fd3('0x23')](saveUpdates(_0x4ca820['body'],null))[_0x4fd3('0x23')](respondWithResult(_0x14efc2,null))[_0x4fd3('0x42')](handleError(_0x14efc2,null));};exports[_0x4fd3('0x22')]=function(_0x14399c,_0x3653bd){return db[_0x4fd3('0x2b')][_0x4fd3('0x46')]({'where':{'id':_0x14399c[_0x4fd3('0x44')]['id']}})['then'](handleEntityNotFound(_0x3653bd,null))[_0x4fd3('0x23')](removeEntity(_0x3653bd,null))[_0x4fd3('0x42')](handleError(_0x3653bd,null));};exports[_0x4fd3('0x49')]=function(_0x48009d,_0x4db14b){return db[_0x4fd3('0x2b')][_0x4fd3('0x49')]()[_0x4fd3('0x23')](respondWithResult(_0x4db14b,null))[_0x4fd3('0x42')](handleError(_0x4db14b,null));}; \ No newline at end of file +var _0xe8c3=['mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','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','reject','save','update','then','destroy','error','name','send','map','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x32a55c,_0x5c8037){var _0x2c276e=function(_0x4bcfe2){while(--_0x4bcfe2){_0x32a55c['push'](_0x32a55c['shift']());}};_0x2c276e(++_0x5c8037);}(_0xe8c3,0x1d2));var _0x3e8c=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0xe8c3[_0x3df223];return _0x562d11;};'use strict';var pdf=require(_0x3e8c('0x0'));var emlformat=require(_0x3e8c('0x1'));var rimraf=require(_0x3e8c('0x2'));var zipdir=require(_0x3e8c('0x3'));var jsonpatch=require(_0x3e8c('0x4'));var rp=require(_0x3e8c('0x5'));var moment=require(_0x3e8c('0x6'));var BPromise=require(_0x3e8c('0x7'));var Mustache=require(_0x3e8c('0x8'));var util=require(_0x3e8c('0x9'));var path=require(_0x3e8c('0xa'));var sox=require(_0x3e8c('0xb'));var csv=require(_0x3e8c('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3e8c('0xd'));var crypto=require(_0x3e8c('0xe'));var jsforce=require(_0x3e8c('0xf'));var deskjs=require(_0x3e8c('0x10'));var toCsv=require(_0x3e8c('0xc'));var querystring=require(_0x3e8c('0x11'));var Papa=require(_0x3e8c('0x12'));var Redis=require('ioredis');var authService=require(_0x3e8c('0x13'));var qs=require(_0x3e8c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e8c('0x15'));var logger=require('../../config/logger')(_0x3e8c('0x16'));var utils=require(_0x3e8c('0x17'));var config=require(_0x3e8c('0x18'));var licenseUtil=require(_0x3e8c('0x19'));var db=require(_0x3e8c('0x1a'))['db'];function respondWithStatusCode(_0x1ee82e,_0x4438db){_0x4438db=_0x4438db||0xcc;return function(_0x6b5a57){if(_0x6b5a57){return _0x1ee82e[_0x3e8c('0x1b')](_0x4438db);}return _0x1ee82e[_0x3e8c('0x1c')](_0x4438db)[_0x3e8c('0x1d')]();};}function respondWithResult(_0x130806,_0x47ef80){_0x47ef80=_0x47ef80||0xc8;return function(_0x46dcd1){if(_0x46dcd1){return _0x130806[_0x3e8c('0x1c')](_0x47ef80)[_0x3e8c('0x1e')](_0x46dcd1);}};}function respondWithFilteredResult(_0x32b3d2,_0x145e0b){return function(_0x244f35){if(_0x244f35){var _0x39b2=_0x244f35[_0x3e8c('0x1f')],_0xdf278b=_0x145e0b[_0x3e8c('0x20')],_0x1976ae=_0x145e0b[_0x3e8c('0x20')]+_0x145e0b['limit'],_0x5bd31b;if(_0x1976ae>=_0x39b2){_0x1976ae=_0x39b2;_0x5bd31b=0xc8;}else{_0x5bd31b=0xce;}_0x32b3d2[_0x3e8c('0x1c')](_0x5bd31b);return _0x32b3d2[_0x3e8c('0x21')](_0x3e8c('0x22'),_0xdf278b+'-'+_0x1976ae+'/'+_0x39b2)[_0x3e8c('0x1e')](_0x244f35);}return null;};}function patchUpdates(_0x57ed76){return function(_0x307c80){try{jsonpatch[_0x3e8c('0x23')](_0x307c80,_0x57ed76,!![]);}catch(_0x3732d3){return BPromise[_0x3e8c('0x24')](_0x3732d3);}return _0x307c80[_0x3e8c('0x25')]();};}function saveUpdates(_0x34a28b,_0x51f380){return function(_0xa1e4d1){if(_0xa1e4d1){return _0xa1e4d1[_0x3e8c('0x26')](_0x34a28b)[_0x3e8c('0x27')](function(_0x514384){return _0x514384;});}return null;};}function removeEntity(_0x4391c4,_0x32e3f2){return function(_0x346bd2){if(_0x346bd2){return _0x346bd2[_0x3e8c('0x28')]()[_0x3e8c('0x27')](function(){_0x4391c4[_0x3e8c('0x1c')](0xcc)[_0x3e8c('0x1d')]();});}};}function handleEntityNotFound(_0x3bfa96,_0x59c9b2){return function(_0x4777e7){if(!_0x4777e7){_0x3bfa96['sendStatus'](0x194);}return _0x4777e7;};}function handleError(_0x1f3294,_0x5070b0){_0x5070b0=_0x5070b0||0x1f4;return function(_0x4ec87f){logger[_0x3e8c('0x29')](_0x4ec87f['stack']);if(_0x4ec87f['name']){delete _0x4ec87f[_0x3e8c('0x2a')];}_0x1f3294['status'](_0x5070b0)[_0x3e8c('0x2b')](_0x4ec87f);};}exports['index']=function(_0x5635cb,_0x3576cf){var _0x2f53b3={},_0x2a58db={},_0x4de7a8={'count':0x0,'rows':[]};var _0x52f54f=_[_0x3e8c('0x2c')](db[_0x3e8c('0x2d')][_0x3e8c('0x2e')],function(_0x4d08a0){return{'name':_0x4d08a0['fieldName'],'type':_0x4d08a0[_0x3e8c('0x2f')][_0x3e8c('0x30')]};});_0x2a58db[_0x3e8c('0x31')]=_[_0x3e8c('0x2c')](_0x52f54f,_0x3e8c('0x2a'));_0x2a58db[_0x3e8c('0x32')]=_[_0x3e8c('0x33')](_0x5635cb[_0x3e8c('0x32')]);_0x2a58db[_0x3e8c('0x34')]=_[_0x3e8c('0x35')](_0x2a58db['model'],_0x2a58db[_0x3e8c('0x32')]);_0x2f53b3['attributes']=_['intersection'](_0x2a58db[_0x3e8c('0x31')],qs[_0x3e8c('0x36')](_0x5635cb[_0x3e8c('0x32')][_0x3e8c('0x36')]));_0x2f53b3['attributes']=_0x2f53b3['attributes'][_0x3e8c('0x37')]?_0x2f53b3[_0x3e8c('0x38')]:_0x2a58db['model'];if(!_0x5635cb[_0x3e8c('0x32')][_0x3e8c('0x39')](_0x3e8c('0x3a'))){_0x2f53b3[_0x3e8c('0x3b')]=qs[_0x3e8c('0x3b')](_0x5635cb[_0x3e8c('0x32')]['limit']);_0x2f53b3['offset']=qs[_0x3e8c('0x20')](_0x5635cb[_0x3e8c('0x32')][_0x3e8c('0x20')]);}_0x2f53b3[_0x3e8c('0x3c')]=qs['sort'](_0x5635cb[_0x3e8c('0x32')][_0x3e8c('0x3d')]);_0x2f53b3[_0x3e8c('0x3e')]=qs[_0x3e8c('0x34')](_[_0x3e8c('0x3f')](_0x5635cb[_0x3e8c('0x32')],_0x2a58db[_0x3e8c('0x34')]),_0x52f54f);if(_0x5635cb['query']['filter']){_0x2f53b3[_0x3e8c('0x3e')]=_['merge'](_0x2f53b3['where'],{'$or':_[_0x3e8c('0x2c')](_0x52f54f,function(_0x181c1a){if(_0x181c1a[_0x3e8c('0x2f')]!==_0x3e8c('0x40')){var _0x2032d2={};_0x2032d2[_0x181c1a[_0x3e8c('0x2a')]]={'$like':'%'+_0x5635cb[_0x3e8c('0x32')][_0x3e8c('0x41')]+'%'};return _0x2032d2;}})});}_0x2f53b3=_[_0x3e8c('0x42')]({},_0x2f53b3,_0x5635cb[_0x3e8c('0x43')]);var _0x5a7a58={'where':_0x2f53b3['where']};return db[_0x3e8c('0x2d')][_0x3e8c('0x1f')](_0x5a7a58)[_0x3e8c('0x27')](function(_0x1d8f3a){_0x4de7a8[_0x3e8c('0x1f')]=_0x1d8f3a;if(_0x5635cb[_0x3e8c('0x32')][_0x3e8c('0x44')]){_0x2f53b3[_0x3e8c('0x45')]=[{'all':!![]}];}return db[_0x3e8c('0x2d')][_0x3e8c('0x46')](_0x2f53b3);})[_0x3e8c('0x27')](function(_0x248ab8){_0x4de7a8[_0x3e8c('0x47')]=_0x248ab8;return _0x4de7a8;})[_0x3e8c('0x27')](respondWithFilteredResult(_0x3576cf,_0x2f53b3))[_0x3e8c('0x48')](handleError(_0x3576cf,null));};exports[_0x3e8c('0x49')]=function(_0x753ecf,_0x392b9f){var _0x209e08={'raw':![],'where':{'id':_0x753ecf[_0x3e8c('0x4a')]['id']}},_0x34d03d={};_0x34d03d[_0x3e8c('0x31')]=_[_0x3e8c('0x33')](db[_0x3e8c('0x2d')][_0x3e8c('0x2e')]);_0x34d03d[_0x3e8c('0x32')]=_[_0x3e8c('0x33')](_0x753ecf['query']);_0x34d03d['filters']=_[_0x3e8c('0x35')](_0x34d03d[_0x3e8c('0x31')],_0x34d03d[_0x3e8c('0x32')]);_0x209e08[_0x3e8c('0x38')]=_[_0x3e8c('0x35')](_0x34d03d[_0x3e8c('0x31')],qs['fields'](_0x753ecf['query'][_0x3e8c('0x36')]));_0x209e08[_0x3e8c('0x38')]=_0x209e08[_0x3e8c('0x38')]['length']?_0x209e08[_0x3e8c('0x38')]:_0x34d03d[_0x3e8c('0x31')];if(_0x753ecf['query']['includeAll']){_0x209e08[_0x3e8c('0x45')]=[{'all':!![]}];}_0x209e08=_[_0x3e8c('0x42')]({},_0x209e08,_0x753ecf['options']);return db[_0x3e8c('0x2d')][_0x3e8c('0x4b')](_0x209e08)[_0x3e8c('0x27')](handleEntityNotFound(_0x392b9f,null))[_0x3e8c('0x27')](respondWithResult(_0x392b9f,null))['catch'](handleError(_0x392b9f,null));};exports[_0x3e8c('0x4c')]=function(_0x154e14,_0x240d86){return db[_0x3e8c('0x2d')]['create'](_0x154e14[_0x3e8c('0x4d')],{})[_0x3e8c('0x27')](respondWithResult(_0x240d86,0xc9))[_0x3e8c('0x48')](handleError(_0x240d86,null));};exports['update']=function(_0x516e57,_0x4d0555){if(_0x516e57[_0x3e8c('0x4d')]['id']){delete _0x516e57['body']['id'];}return db[_0x3e8c('0x2d')][_0x3e8c('0x4b')]({'where':{'id':_0x516e57[_0x3e8c('0x4a')]['id']}})[_0x3e8c('0x27')](handleEntityNotFound(_0x4d0555,null))[_0x3e8c('0x27')](saveUpdates(_0x516e57[_0x3e8c('0x4d')],null))[_0x3e8c('0x27')](respondWithResult(_0x4d0555,null))[_0x3e8c('0x48')](handleError(_0x4d0555,null));};exports[_0x3e8c('0x28')]=function(_0x317f70,_0x13edec){return db['IntegrationReport'][_0x3e8c('0x4b')]({'where':{'id':_0x317f70[_0x3e8c('0x4a')]['id']}})[_0x3e8c('0x27')](handleEntityNotFound(_0x13edec,null))[_0x3e8c('0x27')](removeEntity(_0x13edec,null))[_0x3e8c('0x48')](handleError(_0x13edec,null));};exports[_0x3e8c('0x4e')]=function(_0x2cc409,_0x5eb8df){return db['IntegrationReport']['describe']()[_0x3e8c('0x27')](respondWithResult(_0x5eb8df,null))[_0x3e8c('0x48')](handleError(_0x5eb8df,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 31a65d8..c67b05d 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 _0x010a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','../../config/logger'];(function(_0x18b0fc,_0x488479){var _0x5ab8e5=function(_0x4e6fd6){while(--_0x4e6fd6){_0x18b0fc['push'](_0x18b0fc['shift']());}};_0x5ab8e5(++_0x488479);}(_0x010a,0x178));var _0xa010=function(_0x54e85c,_0x5370af){_0x54e85c=_0x54e85c-0x0;var _0x1012ee=_0x010a[_0x54e85c];return _0x1012ee;};'use strict';var _=require(_0xa010('0x0'));var util=require('util');var logger=require(_0xa010('0x1'))(_0xa010('0x2'));var moment=require(_0xa010('0x3'));var BPromise=require(_0xa010('0x4'));var rp=require(_0xa010('0x5'));var fs=require('fs');var path=require(_0xa010('0x6'));var rimraf=require(_0xa010('0x7'));var config=require(_0xa010('0x8'));var attributes=require(_0xa010('0x9'));module[_0xa010('0xa')]=function(_0x3120c8,_0x48b674){return _0x3120c8[_0xa010('0xb')](_0xa010('0xc'),attributes,{'tableName':_0xa010('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d68=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration'];(function(_0x451532,_0x2cbcfe){var _0x577d1d=function(_0x1785e8){while(--_0x1785e8){_0x451532['push'](_0x451532['shift']());}};_0x577d1d(++_0x2cbcfe);}(_0x3d68,0xd2));var _0x83d6=function(_0x1d01f0,_0x2d143a){_0x1d01f0=_0x1d01f0-0x0;var _0x53dc2e=_0x3d68[_0x1d01f0];return _0x53dc2e;};'use strict';var _=require(_0x83d6('0x0'));var util=require(_0x83d6('0x1'));var logger=require(_0x83d6('0x2'))(_0x83d6('0x3'));var moment=require(_0x83d6('0x4'));var BPromise=require('bluebird');var rp=require(_0x83d6('0x5'));var fs=require('fs');var path=require(_0x83d6('0x6'));var rimraf=require(_0x83d6('0x7'));var config=require(_0x83d6('0x8'));var attributes=require(_0x83d6('0x9'));module[_0x83d6('0xa')]=function(_0x36bae7,_0x36df29){return _0x36bae7[_0x83d6('0xb')](_0x83d6('0xc'),attributes,{'tableName':_0x83d6('0xd'),'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 5404133..7b50da6 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x5b5c45,_0x199467){var _0x2cd0dd=function(_0x3f3266){while(--_0x3f3266){_0x5b5c45['push'](_0x5b5c45['shift']());}};_0x2cd0dd(++_0x199467);}(_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);});});} \ No newline at end of file +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(_0x1be50b,_0x27c249){var _0x5a70eb=function(_0x3732f5){while(--_0x3732f5){_0x1be50b['push'](_0x1be50b['shift']());}};_0x5a70eb(++_0x27c249);}(_0x14a0,0x8e));var _0x014a=function(_0x4308fa,_0x5c8884){_0x4308fa=_0x4308fa-0x0;var _0x2334bd=_0x14a0[_0x4308fa];return _0x2334bd;};'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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index fb46aeb..c4cc2b8 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 _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0x301426,_0x4b461a){var _0x196e84=function(_0x68588b){while(--_0x68588b){_0x301426['push'](_0x301426['shift']());}};_0x196e84(++_0x4b461a);}(_0x3e74,0x175));var _0x43e7=function(_0x3a678e,_0x839967){_0x3a678e=_0x3a678e-0x0;var _0x446323=_0x3e74[_0x3a678e];return _0x446323;};'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('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file +var _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_0x385500,_0x1f8cf3){var _0x2ad4c6=function(_0x507532){while(--_0x507532){_0x385500['push'](_0x385500['shift']());}};_0x2ad4c6(++_0x1f8cf3);}(_0x008c,0x188));var _0xc008=function(_0x20d9f0,_0x453415){_0x20d9f0=_0x20d9f0-0x0;var _0x195dda=_0x008c[_0x20d9f0];return _0x195dda;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xc008('0xf')]('/',auth[_0xc008('0xa')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xc008('0xa')](),controller[_0xc008('0x10')]);router['post'](_0xc008('0x11'),auth[_0xc008('0xa')](),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xc'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router['delete']('/:id',auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('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 0174c16..663e1e1 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 _0xbfca=['sequelize','exports','STRING'];(function(_0x66acb3,_0x2f6440){var _0x289d45=function(_0x37821d){while(--_0x37821d){_0x66acb3['push'](_0x66acb3['shift']());}};_0x289d45(++_0x2f6440);}(_0xbfca,0xba));var _0xabfc=function(_0x58d0bc,_0x48c016){_0x58d0bc=_0x58d0bc-0x0;var _0x28cfcc=_0xbfca[_0x58d0bc];return _0x28cfcc;};'use strict';var Sequelize=require(_0xabfc('0x0'));module[_0xabfc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xabfc('0x2')]},'interval':{'type':Sequelize[_0xabfc('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x3254=['exports','STRING','sequelize'];(function(_0x27aaa9,_0x18d1bd){var _0x27d69c=function(_0x51e16c){while(--_0x51e16c){_0x27aaa9['push'](_0x27aaa9['shift']());}};_0x27d69c(++_0x18d1bd);}(_0x3254,0x19a));var _0x4325=function(_0x4eb53d,_0x563029){_0x4eb53d=_0x4eb53d-0x0;var _0x47ad0d=_0x3254[_0x4eb53d];return _0x47ad0d;};'use strict';var Sequelize=require(_0x4325('0x0'));module[_0x4325('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4325('0x2')]},'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 e7f5065..56073df 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 _0x59e6=['index','map','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','filter','where','type','VIRTUAL','merge','options','Interval','findAll','catch','show','params','rawAttributes','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','findOne','order','getIntervals','nolimit','addIntervals','sequelize','transaction','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','destroy','error','stack','name'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x59e6,0x187));var _0x659e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x59e6[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x659e('0x0'));var emlformat=require(_0x659e('0x1'));var rimraf=require(_0x659e('0x2'));var zipdir=require(_0x659e('0x3'));var jsonpatch=require(_0x659e('0x4'));var rp=require(_0x659e('0x5'));var moment=require('moment');var BPromise=require(_0x659e('0x6'));var Mustache=require(_0x659e('0x7'));var util=require(_0x659e('0x8'));var path=require(_0x659e('0x9'));var sox=require(_0x659e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x659e('0xb'));var squel=require(_0x659e('0xc'));var crypto=require('crypto');var jsforce=require(_0x659e('0xd'));var deskjs=require(_0x659e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x659e('0xf'));var qs=require(_0x659e('0x10'));var as=require(_0x659e('0x11'));var hardwareService=require(_0x659e('0x12'));var logger=require(_0x659e('0x13'))(_0x659e('0x14'));var utils=require(_0x659e('0x15'));var config=require(_0x659e('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x659e('0x17'));function respondWithStatusCode(_0x5cad7f,_0x42f042){_0x42f042=_0x42f042||0xcc;return function(_0x353859){if(_0x353859){return _0x5cad7f[_0x659e('0x18')](_0x42f042);}return _0x5cad7f[_0x659e('0x19')](_0x42f042)['end']();};}function respondWithResult(_0x4af9d5,_0xd3e253){_0xd3e253=_0xd3e253||0xc8;return function(_0x2a499b){if(_0x2a499b){return _0x4af9d5[_0x659e('0x19')](_0xd3e253)[_0x659e('0x1a')](_0x2a499b);}};}function respondWithFilteredResult(_0x5a1a19,_0x378aa9){return function(_0x4f21fe){if(_0x4f21fe){var _0x38e913=_0x4f21fe[_0x659e('0x1b')],_0x1d1d85=_0x378aa9['offset'],_0xea3c91=_0x378aa9[_0x659e('0x1c')]+_0x378aa9[_0x659e('0x1d')],_0x561f96;if(_0xea3c91>=_0x38e913){_0xea3c91=_0x38e913;_0x561f96=0xc8;}else{_0x561f96=0xce;}_0x5a1a19[_0x659e('0x19')](_0x561f96);return _0x5a1a19[_0x659e('0x1e')](_0x659e('0x1f'),_0x1d1d85+'-'+_0xea3c91+'/'+_0x38e913)[_0x659e('0x1a')](_0x4f21fe);}return null;};}function patchUpdates(_0x8181c4){return function(_0x2b400c){try{jsonpatch[_0x659e('0x20')](_0x2b400c,_0x8181c4,!![]);}catch(_0xf42708){return BPromise[_0x659e('0x21')](_0xf42708);}return _0x2b400c[_0x659e('0x22')]();};}function saveUpdates(_0x5eea76,_0x1724aa){return function(_0x29027a){if(_0x29027a){return _0x29027a[_0x659e('0x23')](_0x5eea76)['then'](function(_0x4dd30b){return _0x4dd30b;});}return null;};}function removeEntity(_0x5c01f5,_0x1254b0){return function(_0x22ce58){if(_0x22ce58){return _0x22ce58['destroy']()[_0x659e('0x24')](function(){var _0xd928ad=_0x22ce58[_0x659e('0x25')]({'plain':!![]});var _0x33d45d=_0x659e('0x26');return db[_0x659e('0x27')][_0x659e('0x28')]({'where':{'type':_0x33d45d,'resourceId':_0xd928ad['id']}})['then'](function(){return _0x22ce58;});})['then'](function(){_0x5c01f5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1963a2,_0x165ccc){return function(_0x2f4f92){if(!_0x2f4f92){_0x1963a2[_0x659e('0x18')](0x194);}return _0x2f4f92;};}function handleError(_0x412f7d,_0x396292){_0x396292=_0x396292||0x1f4;return function(_0x26505c){logger[_0x659e('0x29')](_0x26505c[_0x659e('0x2a')]);if(_0x26505c[_0x659e('0x2b')]){delete _0x26505c['name'];}_0x412f7d[_0x659e('0x19')](_0x396292)['send'](_0x26505c);};}exports[_0x659e('0x2c')]=function(_0x1cc562,_0x3ec77b){var _0x4b2424={},_0x4452f9={},_0x2529d0={'count':0x0,'rows':[]};var _0x334361=_[_0x659e('0x2d')](db['Interval']['rawAttributes'],function(_0x36649c){return{'name':_0x36649c[_0x659e('0x2e')],'type':_0x36649c['type'][_0x659e('0x2f')]};});_0x4452f9['model']=_[_0x659e('0x2d')](_0x334361,_0x659e('0x2b'));_0x4452f9[_0x659e('0x30')]=_[_0x659e('0x31')](_0x1cc562[_0x659e('0x30')]);_0x4452f9[_0x659e('0x32')]=_['intersection'](_0x4452f9[_0x659e('0x33')],_0x4452f9[_0x659e('0x30')]);_0x4b2424[_0x659e('0x34')]=_[_0x659e('0x35')](_0x4452f9['model'],qs[_0x659e('0x36')](_0x1cc562[_0x659e('0x30')][_0x659e('0x36')]));_0x4b2424['attributes']=_0x4b2424[_0x659e('0x34')][_0x659e('0x37')]?_0x4b2424['attributes']:_0x4452f9[_0x659e('0x33')];if(!_0x1cc562[_0x659e('0x30')][_0x659e('0x38')]('nolimit')){_0x4b2424[_0x659e('0x1d')]=qs['limit'](_0x1cc562[_0x659e('0x30')][_0x659e('0x1d')]);_0x4b2424[_0x659e('0x1c')]=qs[_0x659e('0x1c')](_0x1cc562[_0x659e('0x30')]['offset']);}_0x4b2424['order']=qs[_0x659e('0x39')](_0x1cc562[_0x659e('0x30')][_0x659e('0x39')]);_0x4b2424['where']=qs[_0x659e('0x32')](_['pick'](_0x1cc562[_0x659e('0x30')],_0x4452f9[_0x659e('0x32')]),_0x334361);if(_0x1cc562[_0x659e('0x30')][_0x659e('0x3a')]){_0x4b2424[_0x659e('0x3b')]=_['merge'](_0x4b2424[_0x659e('0x3b')],{'$or':_[_0x659e('0x2d')](_0x334361,function(_0x383979){if(_0x383979[_0x659e('0x3c')]!==_0x659e('0x3d')){var _0x17060a={};_0x17060a[_0x383979[_0x659e('0x2b')]]={'$like':'%'+_0x1cc562[_0x659e('0x30')]['filter']+'%'};return _0x17060a;}})});}_0x4b2424=_[_0x659e('0x3e')]({},_0x4b2424,_0x1cc562[_0x659e('0x3f')]);var _0x5997e7={'where':_0x4b2424[_0x659e('0x3b')]};return db[_0x659e('0x40')]['count'](_0x5997e7)[_0x659e('0x24')](function(_0x4fa38c){_0x2529d0['count']=_0x4fa38c;if(_0x1cc562[_0x659e('0x30')]['includeAll']){_0x4b2424['include']=[{'all':!![]}];}return db['Interval'][_0x659e('0x41')](_0x4b2424);})['then'](function(_0x4bd9ef){_0x2529d0['rows']=_0x4bd9ef;return _0x2529d0;})[_0x659e('0x24')](respondWithFilteredResult(_0x3ec77b,_0x4b2424))[_0x659e('0x42')](handleError(_0x3ec77b,null));};exports[_0x659e('0x43')]=function(_0x227c48,_0x579b3f){var _0x133849={'raw':!![],'where':{'id':_0x227c48[_0x659e('0x44')]['id']}},_0xdb45ba={};_0xdb45ba[_0x659e('0x33')]=_['keys'](db['Interval'][_0x659e('0x45')]);_0xdb45ba[_0x659e('0x30')]=_[_0x659e('0x31')](_0x227c48[_0x659e('0x30')]);_0xdb45ba[_0x659e('0x32')]=_[_0x659e('0x35')](_0xdb45ba['model'],_0xdb45ba['query']);_0x133849[_0x659e('0x34')]=_['intersection'](_0xdb45ba[_0x659e('0x33')],qs[_0x659e('0x36')](_0x227c48[_0x659e('0x30')]['fields']));_0x133849['attributes']=_0x133849[_0x659e('0x34')][_0x659e('0x37')]?_0x133849[_0x659e('0x34')]:_0xdb45ba[_0x659e('0x33')];if(_0x227c48[_0x659e('0x30')][_0x659e('0x46')]){_0x133849['include']=[{'all':!![]}];}_0x133849=_[_0x659e('0x3e')]({},_0x133849,_0x227c48['options']);return db[_0x659e('0x40')]['find'](_0x133849)['then'](handleEntityNotFound(_0x579b3f,null))['then'](respondWithResult(_0x579b3f,null))[_0x659e('0x42')](handleError(_0x579b3f,null));};exports['create']=function(_0x39bf28,_0x2aac99){return db[_0x659e('0x40')][_0x659e('0x47')](_0x39bf28[_0x659e('0x48')],{})[_0x659e('0x24')](function(_0x2fe1af){var _0x2b0384=_0x39bf28[_0x659e('0x49')][_0x659e('0x25')]({'plain':!![]});if(!_0x2b0384)throw new Error(_0x659e('0x4a'));if(_0x2b0384[_0x659e('0x4b')]===_0x659e('0x49')){var _0x3a4661=_0x2fe1af[_0x659e('0x25')]({'plain':!![]});var _0x1beba0='Intervals';return db[_0x659e('0x4c')][_0x659e('0x4d')]({'where':{'name':_0x1beba0,'userProfileId':_0x2b0384[_0x659e('0x4e')]},'raw':!![]})[_0x659e('0x24')](function(_0x3c34c9){if(_0x3c34c9&&_0x3c34c9[_0x659e('0x4f')]===0x0){return db[_0x659e('0x27')][_0x659e('0x47')]({'name':_0x3a4661[_0x659e('0x2b')],'resourceId':_0x3a4661['id'],'type':_0x3c34c9[_0x659e('0x2b')],'sectionId':_0x3c34c9['id']},{})[_0x659e('0x24')](function(){return _0x2fe1af;});}else{return _0x2fe1af;}})['catch'](function(_0x5acf45){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5acf45);throw _0x5acf45;});}return _0x2fe1af;})[_0x659e('0x24')](respondWithResult(_0x2aac99,0xc9))[_0x659e('0x42')](handleError(_0x2aac99,null));};exports[_0x659e('0x23')]=function(_0x47cb95,_0x3088b3){if(_0x47cb95['body']['id']){delete _0x47cb95[_0x659e('0x48')]['id'];}return db[_0x659e('0x40')][_0x659e('0x4d')]({'where':{'id':_0x47cb95[_0x659e('0x44')]['id']}})['then'](handleEntityNotFound(_0x3088b3,null))['then'](saveUpdates(_0x47cb95[_0x659e('0x48')],null))['then'](respondWithResult(_0x3088b3,null))[_0x659e('0x42')](handleError(_0x3088b3,null));};exports[_0x659e('0x28')]=function(_0x3255e3,_0x25d25e){return db[_0x659e('0x40')][_0x659e('0x4d')]({'where':{'id':_0x3255e3[_0x659e('0x44')]['id']}})[_0x659e('0x24')](handleEntityNotFound(_0x25d25e,null))[_0x659e('0x24')](removeEntity(_0x25d25e,null))[_0x659e('0x42')](handleError(_0x25d25e,null));};exports['addInterval']=function(_0x4a8893,_0x305ad7,_0xe0d69d){if(_0x4a8893['body']['id']){delete _0x4a8893[_0x659e('0x48')]['id'];}return db[_0x659e('0x40')][_0x659e('0x4d')]({'where':{'id':_0x4a8893['params']['id']}})['then'](handleEntityNotFound(_0x305ad7,null))[_0x659e('0x24')](function(_0x5ec022){if(_0x5ec022){_0x4a8893[_0x659e('0x48')]['IntervalId']=_0x5ec022['id'];return db[_0x659e('0x40')]['create'](_0x4a8893['body']);}})[_0x659e('0x24')](respondWithResult(_0x305ad7,null))[_0x659e('0x42')](handleError(_0x305ad7,null));};exports['getIntervals']=function(_0xd6508a,_0x4ca7c8,_0x2491b6){var _0x138561={};var _0x1a283b={};var _0x312a58;var _0x43aa37;return db['Interval'][_0x659e('0x50')]({'where':{'id':_0xd6508a[_0x659e('0x44')]['id']}})['then'](handleEntityNotFound(_0x4ca7c8,null))[_0x659e('0x24')](function(_0x516c7b){if(_0x516c7b){_0x312a58=_0x516c7b;_0x1a283b[_0x659e('0x33')]=_[_0x659e('0x31')](db[_0x659e('0x40')]['rawAttributes']);_0x1a283b['query']=_[_0x659e('0x31')](_0xd6508a[_0x659e('0x30')]);_0x1a283b[_0x659e('0x32')]=_[_0x659e('0x35')](_0x1a283b[_0x659e('0x33')],_0x1a283b['query']);_0x138561[_0x659e('0x34')]=_['intersection'](_0x1a283b[_0x659e('0x33')],qs['fields'](_0xd6508a[_0x659e('0x30')]['fields']));_0x138561['attributes']=_0x138561[_0x659e('0x34')][_0x659e('0x37')]?_0x138561['attributes']:_0x1a283b[_0x659e('0x33')];_0x138561[_0x659e('0x51')]=qs['sort'](_0xd6508a[_0x659e('0x30')][_0x659e('0x39')]);_0x138561['where']=qs[_0x659e('0x32')](_['pick'](_0xd6508a[_0x659e('0x30')],_0x1a283b[_0x659e('0x32')]));if(_0xd6508a[_0x659e('0x30')]['filter']){_0x138561['where']=_['merge'](_0x138561[_0x659e('0x3b')],{'$or':_[_0x659e('0x2d')](_0x138561[_0x659e('0x34')],function(_0x7b3548){var _0x13580c={};_0x13580c[_0x7b3548]={'$like':'%'+_0xd6508a['query'][_0x659e('0x3a')]+'%'};return _0x13580c;})});}_0x138561=_[_0x659e('0x3e')]({},_0x138561,_0xd6508a['options']);return _0x312a58[_0x659e('0x52')](_0x138561);}})[_0x659e('0x24')](function(_0x74ade3){if(_0x74ade3){_0x43aa37=_0x74ade3[_0x659e('0x37')];if(!_0xd6508a[_0x659e('0x30')][_0x659e('0x38')](_0x659e('0x53'))){_0x138561[_0x659e('0x1d')]=qs[_0x659e('0x1d')](_0xd6508a['query']['limit']);_0x138561['offset']=qs[_0x659e('0x1c')](_0xd6508a['query']['offset']);}return _0x312a58[_0x659e('0x52')](_0x138561);}})[_0x659e('0x24')](function(_0x18b2c5){if(_0x18b2c5){return _0x18b2c5?{'count':_0x43aa37,'rows':_0x18b2c5}:null;}})[_0x659e('0x24')](respondWithResult(_0x4ca7c8,null))['catch'](handleError(_0x4ca7c8,null));};exports[_0x659e('0x54')]=function(_0x57043c,_0xb8b9b,_0x11446e){return db[_0x659e('0x40')][_0x659e('0x50')]({'where':{'id':_0x57043c['params']['id']}})['then'](handleEntityNotFound(_0xb8b9b,null))[_0x659e('0x24')](function(_0x2cc39a){if(_0x2cc39a){return db[_0x659e('0x55')][_0x659e('0x56')](function(_0x367a0b){return db[_0x659e('0x40')]['destroy']({'where':{'IntervalId':_0x57043c[_0x659e('0x44')]['id']},'transaction':_0x367a0b})[_0x659e('0x24')](function(_0xba2e2c){var _0x7732b8=_[_0x659e('0x2d')](_0x57043c[_0x659e('0x48')],function(_0x136993){delete _0x136993['id'];_0x136993['IntervalId']=_0x57043c['params']['id'];return _0x136993;});return db[_0x659e('0x40')]['bulkCreate'](_0x7732b8,{'transaction':_0x367a0b});});})[_0x659e('0x24')](function(){return db[_0x659e('0x40')][_0x659e('0x41')]({'where':{'IntervalId':_0x57043c['params']['id']}});});}})['then'](respondWithResult(_0xb8b9b,null))[_0x659e('0x42')](handleError(_0xb8b9b,null));}; \ No newline at end of file +var _0xc3f4=['UserProfileResource','destroy','error','stack','name','send','index','map','Interval','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','rawAttributes','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','IntervalId','getIntervals','findOne','order','addIntervals','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','lodash','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','get'];(function(_0x488bac,_0x3cb679){var _0xbcc123=function(_0x4d092b){while(--_0x4d092b){_0x488bac['push'](_0x488bac['shift']());}};_0xbcc123(++_0x3cb679);}(_0xc3f4,0x8d));var _0x4c3f=function(_0x2190bb,_0x4e60bf){_0x2190bb=_0x2190bb-0x0;var _0x52b6a2=_0xc3f4[_0x2190bb];return _0x52b6a2;};'use strict';var pdf=require(_0x4c3f('0x0'));var emlformat=require(_0x4c3f('0x1'));var rimraf=require(_0x4c3f('0x2'));var zipdir=require(_0x4c3f('0x3'));var jsonpatch=require(_0x4c3f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4c3f('0x5'));var Mustache=require(_0x4c3f('0x6'));var util=require('util');var path=require(_0x4c3f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c3f('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4c3f('0x9'));var deskjs=require(_0x4c3f('0xa'));var toCsv=require(_0x4c3f('0xb'));var querystring=require(_0x4c3f('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4c3f('0xd'));var as=require(_0x4c3f('0xe'));var hardwareService=require(_0x4c3f('0xf'));var logger=require(_0x4c3f('0x10'))(_0x4c3f('0x11'));var utils=require(_0x4c3f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x4c3f('0x13'));var db=require(_0x4c3f('0x14'))['db'];var extensions=require(_0x4c3f('0x15'));function respondWithStatusCode(_0xffcc00,_0xe454ba){_0xe454ba=_0xe454ba||0xcc;return function(_0xa3be98){if(_0xa3be98){return _0xffcc00[_0x4c3f('0x16')](_0xe454ba);}return _0xffcc00[_0x4c3f('0x17')](_0xe454ba)[_0x4c3f('0x18')]();};}function respondWithResult(_0x3559b3,_0x38806e){_0x38806e=_0x38806e||0xc8;return function(_0x2de362){if(_0x2de362){return _0x3559b3['status'](_0x38806e)[_0x4c3f('0x19')](_0x2de362);}};}function respondWithFilteredResult(_0x49c2e9,_0x4121bb){return function(_0x2a5699){if(_0x2a5699){var _0x1414e1=_0x2a5699['count'],_0x322ec4=_0x4121bb[_0x4c3f('0x1a')],_0x3a5f5e=_0x4121bb[_0x4c3f('0x1a')]+_0x4121bb[_0x4c3f('0x1b')],_0x191c9b;if(_0x3a5f5e>=_0x1414e1){_0x3a5f5e=_0x1414e1;_0x191c9b=0xc8;}else{_0x191c9b=0xce;}_0x49c2e9[_0x4c3f('0x17')](_0x191c9b);return _0x49c2e9[_0x4c3f('0x1c')](_0x4c3f('0x1d'),_0x322ec4+'-'+_0x3a5f5e+'/'+_0x1414e1)[_0x4c3f('0x19')](_0x2a5699);}return null;};}function patchUpdates(_0x379c1c){return function(_0x487b73){try{jsonpatch[_0x4c3f('0x1e')](_0x487b73,_0x379c1c,!![]);}catch(_0x32d606){return BPromise[_0x4c3f('0x1f')](_0x32d606);}return _0x487b73['save']();};}function saveUpdates(_0x240d2f,_0x2b4774){return function(_0x34a796){if(_0x34a796){return _0x34a796[_0x4c3f('0x20')](_0x240d2f)[_0x4c3f('0x21')](function(_0x337085){return _0x337085;});}return null;};}function removeEntity(_0x157e66,_0x22eb5a){return function(_0x307e99){if(_0x307e99){return _0x307e99['destroy']()[_0x4c3f('0x21')](function(){var _0x14ff83=_0x307e99[_0x4c3f('0x22')]({'plain':!![]});var _0xe096c2='Intervals';return db[_0x4c3f('0x23')][_0x4c3f('0x24')]({'where':{'type':_0xe096c2,'resourceId':_0x14ff83['id']}})[_0x4c3f('0x21')](function(){return _0x307e99;});})[_0x4c3f('0x21')](function(){_0x157e66[_0x4c3f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5af54a,_0x491052){return function(_0x651006){if(!_0x651006){_0x5af54a[_0x4c3f('0x16')](0x194);}return _0x651006;};}function handleError(_0x2cfe33,_0x384699){_0x384699=_0x384699||0x1f4;return function(_0x12c5f7){logger[_0x4c3f('0x25')](_0x12c5f7[_0x4c3f('0x26')]);if(_0x12c5f7[_0x4c3f('0x27')]){delete _0x12c5f7['name'];}_0x2cfe33[_0x4c3f('0x17')](_0x384699)[_0x4c3f('0x28')](_0x12c5f7);};}exports[_0x4c3f('0x29')]=function(_0x3a1ffb,_0x2494a1){var _0x1df4aa={},_0x468616={},_0x3fe4de={'count':0x0,'rows':[]};var _0x358ad1=_[_0x4c3f('0x2a')](db[_0x4c3f('0x2b')]['rawAttributes'],function(_0x52d8bf){return{'name':_0x52d8bf[_0x4c3f('0x2c')],'type':_0x52d8bf[_0x4c3f('0x2d')][_0x4c3f('0x2e')]};});_0x468616[_0x4c3f('0x2f')]=_[_0x4c3f('0x2a')](_0x358ad1,_0x4c3f('0x27'));_0x468616[_0x4c3f('0x30')]=_[_0x4c3f('0x31')](_0x3a1ffb[_0x4c3f('0x30')]);_0x468616[_0x4c3f('0x32')]=_[_0x4c3f('0x33')](_0x468616['model'],_0x468616[_0x4c3f('0x30')]);_0x1df4aa['attributes']=_[_0x4c3f('0x33')](_0x468616[_0x4c3f('0x2f')],qs[_0x4c3f('0x34')](_0x3a1ffb[_0x4c3f('0x30')][_0x4c3f('0x34')]));_0x1df4aa[_0x4c3f('0x35')]=_0x1df4aa[_0x4c3f('0x35')]['length']?_0x1df4aa[_0x4c3f('0x35')]:_0x468616[_0x4c3f('0x2f')];if(!_0x3a1ffb[_0x4c3f('0x30')][_0x4c3f('0x36')](_0x4c3f('0x37'))){_0x1df4aa[_0x4c3f('0x1b')]=qs[_0x4c3f('0x1b')](_0x3a1ffb['query'][_0x4c3f('0x1b')]);_0x1df4aa[_0x4c3f('0x1a')]=qs[_0x4c3f('0x1a')](_0x3a1ffb[_0x4c3f('0x30')]['offset']);}_0x1df4aa['order']=qs[_0x4c3f('0x38')](_0x3a1ffb[_0x4c3f('0x30')]['sort']);_0x1df4aa['where']=qs[_0x4c3f('0x32')](_[_0x4c3f('0x39')](_0x3a1ffb[_0x4c3f('0x30')],_0x468616[_0x4c3f('0x32')]),_0x358ad1);if(_0x3a1ffb[_0x4c3f('0x30')][_0x4c3f('0x3a')]){_0x1df4aa[_0x4c3f('0x3b')]=_['merge'](_0x1df4aa[_0x4c3f('0x3b')],{'$or':_[_0x4c3f('0x2a')](_0x358ad1,function(_0x6c643){if(_0x6c643[_0x4c3f('0x2d')]!==_0x4c3f('0x3c')){var _0x522a1d={};_0x522a1d[_0x6c643['name']]={'$like':'%'+_0x3a1ffb['query'][_0x4c3f('0x3a')]+'%'};return _0x522a1d;}})});}_0x1df4aa=_[_0x4c3f('0x3d')]({},_0x1df4aa,_0x3a1ffb[_0x4c3f('0x3e')]);var _0x626412={'where':_0x1df4aa[_0x4c3f('0x3b')]};return db[_0x4c3f('0x2b')][_0x4c3f('0x3f')](_0x626412)[_0x4c3f('0x21')](function(_0x143bfb){_0x3fe4de['count']=_0x143bfb;if(_0x3a1ffb[_0x4c3f('0x30')][_0x4c3f('0x40')]){_0x1df4aa[_0x4c3f('0x41')]=[{'all':!![]}];}return db['Interval'][_0x4c3f('0x42')](_0x1df4aa);})[_0x4c3f('0x21')](function(_0x249e41){_0x3fe4de[_0x4c3f('0x43')]=_0x249e41;return _0x3fe4de;})['then'](respondWithFilteredResult(_0x2494a1,_0x1df4aa))['catch'](handleError(_0x2494a1,null));};exports['show']=function(_0x91f2e4,_0x4d089a){var _0x22a860={'raw':!![],'where':{'id':_0x91f2e4['params']['id']}},_0x2fc234={};_0x2fc234[_0x4c3f('0x2f')]=_[_0x4c3f('0x31')](db[_0x4c3f('0x2b')][_0x4c3f('0x44')]);_0x2fc234[_0x4c3f('0x30')]=_[_0x4c3f('0x31')](_0x91f2e4['query']);_0x2fc234[_0x4c3f('0x32')]=_['intersection'](_0x2fc234[_0x4c3f('0x2f')],_0x2fc234[_0x4c3f('0x30')]);_0x22a860[_0x4c3f('0x35')]=_[_0x4c3f('0x33')](_0x2fc234[_0x4c3f('0x2f')],qs[_0x4c3f('0x34')](_0x91f2e4['query'][_0x4c3f('0x34')]));_0x22a860['attributes']=_0x22a860[_0x4c3f('0x35')][_0x4c3f('0x45')]?_0x22a860[_0x4c3f('0x35')]:_0x2fc234[_0x4c3f('0x2f')];if(_0x91f2e4[_0x4c3f('0x30')][_0x4c3f('0x40')]){_0x22a860[_0x4c3f('0x41')]=[{'all':!![]}];}_0x22a860=_[_0x4c3f('0x3d')]({},_0x22a860,_0x91f2e4['options']);return db[_0x4c3f('0x2b')]['find'](_0x22a860)['then'](handleEntityNotFound(_0x4d089a,null))[_0x4c3f('0x21')](respondWithResult(_0x4d089a,null))['catch'](handleError(_0x4d089a,null));};exports[_0x4c3f('0x46')]=function(_0x570941,_0x1e52e1){return db[_0x4c3f('0x2b')][_0x4c3f('0x46')](_0x570941['body'],{})[_0x4c3f('0x21')](function(_0x51e9ac){var _0x4502d6=_0x570941['user'][_0x4c3f('0x22')]({'plain':!![]});if(!_0x4502d6)throw new Error(_0x4c3f('0x47'));if(_0x4502d6[_0x4c3f('0x48')]==='user'){var _0x2b586a=_0x51e9ac[_0x4c3f('0x22')]({'plain':!![]});var _0x14da97='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x14da97,'userProfileId':_0x4502d6[_0x4c3f('0x49')]},'raw':!![]})[_0x4c3f('0x21')](function(_0x12ddf7){if(_0x12ddf7&&_0x12ddf7[_0x4c3f('0x4a')]===0x0){return db[_0x4c3f('0x23')]['create']({'name':_0x2b586a[_0x4c3f('0x27')],'resourceId':_0x2b586a['id'],'type':_0x12ddf7[_0x4c3f('0x27')],'sectionId':_0x12ddf7['id']},{})[_0x4c3f('0x21')](function(){return _0x51e9ac;});}else{return _0x51e9ac;}})[_0x4c3f('0x4b')](function(_0x3a2247){logger[_0x4c3f('0x25')](_0x4c3f('0x4c'),_0x3a2247);throw _0x3a2247;});}return _0x51e9ac;})[_0x4c3f('0x21')](respondWithResult(_0x1e52e1,0xc9))[_0x4c3f('0x4b')](handleError(_0x1e52e1,null));};exports[_0x4c3f('0x20')]=function(_0xedf5fe,_0x36715f){if(_0xedf5fe[_0x4c3f('0x4d')]['id']){delete _0xedf5fe[_0x4c3f('0x4d')]['id'];}return db[_0x4c3f('0x2b')][_0x4c3f('0x4e')]({'where':{'id':_0xedf5fe[_0x4c3f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36715f,null))['then'](saveUpdates(_0xedf5fe[_0x4c3f('0x4d')],null))[_0x4c3f('0x21')](respondWithResult(_0x36715f,null))[_0x4c3f('0x4b')](handleError(_0x36715f,null));};exports['destroy']=function(_0x1db357,_0x5bfc40){return db['Interval'][_0x4c3f('0x4e')]({'where':{'id':_0x1db357[_0x4c3f('0x4f')]['id']}})[_0x4c3f('0x21')](handleEntityNotFound(_0x5bfc40,null))[_0x4c3f('0x21')](removeEntity(_0x5bfc40,null))[_0x4c3f('0x4b')](handleError(_0x5bfc40,null));};exports['addInterval']=function(_0x37e6da,_0x4a7ddd,_0x588c73){if(_0x37e6da[_0x4c3f('0x4d')]['id']){delete _0x37e6da[_0x4c3f('0x4d')]['id'];}return db[_0x4c3f('0x2b')]['find']({'where':{'id':_0x37e6da['params']['id']}})[_0x4c3f('0x21')](handleEntityNotFound(_0x4a7ddd,null))[_0x4c3f('0x21')](function(_0x1aec6d){if(_0x1aec6d){_0x37e6da[_0x4c3f('0x4d')][_0x4c3f('0x50')]=_0x1aec6d['id'];return db[_0x4c3f('0x2b')][_0x4c3f('0x46')](_0x37e6da[_0x4c3f('0x4d')]);}})[_0x4c3f('0x21')](respondWithResult(_0x4a7ddd,null))['catch'](handleError(_0x4a7ddd,null));};exports[_0x4c3f('0x51')]=function(_0x2ffeac,_0x3f201c,_0x523d97){var _0x23c25f={};var _0x43726c={};var _0x617d4e;var _0x2f1640;return db[_0x4c3f('0x2b')][_0x4c3f('0x52')]({'where':{'id':_0x2ffeac[_0x4c3f('0x4f')]['id']}})[_0x4c3f('0x21')](handleEntityNotFound(_0x3f201c,null))[_0x4c3f('0x21')](function(_0x358080){if(_0x358080){_0x617d4e=_0x358080;_0x43726c[_0x4c3f('0x2f')]=_[_0x4c3f('0x31')](db[_0x4c3f('0x2b')][_0x4c3f('0x44')]);_0x43726c[_0x4c3f('0x30')]=_[_0x4c3f('0x31')](_0x2ffeac['query']);_0x43726c[_0x4c3f('0x32')]=_[_0x4c3f('0x33')](_0x43726c['model'],_0x43726c[_0x4c3f('0x30')]);_0x23c25f['attributes']=_[_0x4c3f('0x33')](_0x43726c[_0x4c3f('0x2f')],qs[_0x4c3f('0x34')](_0x2ffeac[_0x4c3f('0x30')][_0x4c3f('0x34')]));_0x23c25f[_0x4c3f('0x35')]=_0x23c25f[_0x4c3f('0x35')][_0x4c3f('0x45')]?_0x23c25f[_0x4c3f('0x35')]:_0x43726c[_0x4c3f('0x2f')];_0x23c25f[_0x4c3f('0x53')]=qs[_0x4c3f('0x38')](_0x2ffeac[_0x4c3f('0x30')][_0x4c3f('0x38')]);_0x23c25f[_0x4c3f('0x3b')]=qs[_0x4c3f('0x32')](_['pick'](_0x2ffeac[_0x4c3f('0x30')],_0x43726c['filters']));if(_0x2ffeac['query']['filter']){_0x23c25f[_0x4c3f('0x3b')]=_['merge'](_0x23c25f[_0x4c3f('0x3b')],{'$or':_[_0x4c3f('0x2a')](_0x23c25f['attributes'],function(_0x70c2e9){var _0x44a9ab={};_0x44a9ab[_0x70c2e9]={'$like':'%'+_0x2ffeac['query'][_0x4c3f('0x3a')]+'%'};return _0x44a9ab;})});}_0x23c25f=_[_0x4c3f('0x3d')]({},_0x23c25f,_0x2ffeac[_0x4c3f('0x3e')]);return _0x617d4e[_0x4c3f('0x51')](_0x23c25f);}})[_0x4c3f('0x21')](function(_0x3ccdb7){if(_0x3ccdb7){_0x2f1640=_0x3ccdb7[_0x4c3f('0x45')];if(!_0x2ffeac['query'][_0x4c3f('0x36')](_0x4c3f('0x37'))){_0x23c25f[_0x4c3f('0x1b')]=qs['limit'](_0x2ffeac['query'][_0x4c3f('0x1b')]);_0x23c25f[_0x4c3f('0x1a')]=qs['offset'](_0x2ffeac['query'][_0x4c3f('0x1a')]);}return _0x617d4e[_0x4c3f('0x51')](_0x23c25f);}})[_0x4c3f('0x21')](function(_0x28d066){if(_0x28d066){return _0x28d066?{'count':_0x2f1640,'rows':_0x28d066}:null;}})[_0x4c3f('0x21')](respondWithResult(_0x3f201c,null))[_0x4c3f('0x4b')](handleError(_0x3f201c,null));};exports[_0x4c3f('0x54')]=function(_0x48c5e8,_0x37ba05,_0x1adb90){return db['Interval'][_0x4c3f('0x52')]({'where':{'id':_0x48c5e8['params']['id']}})[_0x4c3f('0x21')](handleEntityNotFound(_0x37ba05,null))[_0x4c3f('0x21')](function(_0x55e5e7){if(_0x55e5e7){return db[_0x4c3f('0x55')][_0x4c3f('0x56')](function(_0x4e9650){return db[_0x4c3f('0x2b')][_0x4c3f('0x24')]({'where':{'IntervalId':_0x48c5e8[_0x4c3f('0x4f')]['id']},'transaction':_0x4e9650})['then'](function(_0x4f9980){var _0x5a7c35=_[_0x4c3f('0x2a')](_0x48c5e8['body'],function(_0x36501d){delete _0x36501d['id'];_0x36501d[_0x4c3f('0x50')]=_0x48c5e8[_0x4c3f('0x4f')]['id'];return _0x36501d;});return db[_0x4c3f('0x2b')][_0x4c3f('0x57')](_0x5a7c35,{'transaction':_0x4e9650});});})['then'](function(){return db[_0x4c3f('0x2b')][_0x4c3f('0x42')]({'where':{'IntervalId':_0x48c5e8[_0x4c3f('0x4f')]['id']}});});}})[_0x4c3f('0x21')](respondWithResult(_0x37ba05,null))[_0x4c3f('0x4b')](handleError(_0x37ba05,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index e355900..128bf1c 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 _0xdbae=['path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1c5f93,_0x35de09){var _0x464e11=function(_0x425844){while(--_0x425844){_0x1c5f93['push'](_0x1c5f93['shift']());}};_0x464e11(++_0x35de09);}(_0xdbae,0x116));var _0xedba=function(_0x10752c,_0x2bec58){_0x10752c=_0x10752c-0x0;var _0x3a9914=_0xdbae[_0x10752c];return _0x3a9914;};'use strict';var _=require(_0xedba('0x0'));var util=require(_0xedba('0x1'));var logger=require(_0xedba('0x2'))(_0xedba('0x3'));var moment=require(_0xedba('0x4'));var BPromise=require(_0xedba('0x5'));var rp=require(_0xedba('0x6'));var fs=require('fs');var path=require(_0xedba('0x7'));var rimraf=require(_0xedba('0x8'));var config=require(_0xedba('0x9'));var attributes=require(_0xedba('0xa'));var extensions=require(_0xedba('0xb'));module['exports']=function(_0x1fae2c,_0x3e0c46){return _0x1fae2c[_0xedba('0xc')](_0xedba('0xd'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f18cd,_0x2989b5){extensions['rewrite'](_0x1fae2c,_0x5f18cd);},'afterBulkCreate':function(_0x3919b6,_0x32e77b,_0x576360){_0x576360();extensions[_0xedba('0xe')](_0x1fae2c,_0x3919b6[0x0]);},'afterUpdate':function(_0x27b9ad,_0x246f8a){extensions[_0xedba('0xe')](_0x1fae2c,_0x27b9ad);},'afterDestroy':function(_0x3e1868,_0x112716){extensions[_0xedba('0xe')](_0x1fae2c,_0x3e1868);}}});}; \ No newline at end of file +var _0xa74f=['define','Interval','tools_intervals','rewrite','../../config/logger','bluebird','request-promise','path','rimraf','./interval.attributes'];(function(_0x4fbd61,_0x4d0605){var _0x579ea5=function(_0x112512){while(--_0x112512){_0x4fbd61['push'](_0x4fbd61['shift']());}};_0x579ea5(++_0x4d0605);}(_0xa74f,0x9a));var _0xfa74=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xa74f[_0x376db5];return _0x304c17;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x43dd2f,_0x9ddbd2){return _0x43dd2f[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x344e04,_0x5c0eb2){extensions[_0xfa74('0x9')](_0x43dd2f,_0x344e04);},'afterBulkCreate':function(_0x37d4d8,_0x355e37,_0x2a405e){_0x2a405e();extensions['rewrite'](_0x43dd2f,_0x37d4d8[0x0]);},'afterUpdate':function(_0x46117e,_0x4f8891){extensions['rewrite'](_0x43dd2f,_0x46117e);},'afterDestroy':function(_0x335056,_0x1d919d){extensions[_0xfa74('0x9')](_0x43dd2f,_0x335056);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 1069243..76fda10 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 _0x4dc1=['find','where','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','Interval,\x20%s,\x20%s','message','info','result','catch','GetInterval','Interval','findAll','options','raw','attributes','limit','include','map','model','ShowInterval'];(function(_0x2d4421,_0x409d9b){var _0x8b5814=function(_0x14cfa9){while(--_0x14cfa9){_0x2d4421['push'](_0x2d4421['shift']());}};_0x8b5814(++_0x409d9b);}(_0x4dc1,0x1bf));var _0x14dc=function(_0x52b4f9,_0x1b2670){_0x52b4f9=_0x52b4f9-0x0;var _0x4a9b81=_0x4dc1[_0x52b4f9];return _0x4a9b81;};'use strict';var _=require(_0x14dc('0x0'));var util=require(_0x14dc('0x1'));var moment=require(_0x14dc('0x2'));var BPromise=require('bluebird');var rs=require(_0x14dc('0x3'));var fs=require('fs');var Redis=require(_0x14dc('0x4'));var db=require(_0x14dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x14dc('0x6'))(_0x14dc('0x7'));var config=require(_0x14dc('0x8'));var jayson=require(_0x14dc('0x9'));var client=jayson[_0x14dc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x449548,_0x542451,_0x216397){return new BPromise(function(_0x50d526,_0x1c431b){return client[_0x14dc('0xb')](_0x449548,_0x216397)['then'](function(_0x304aad){logger['info']('Interval,\x20%s,\x20%s',_0x542451,_0x14dc('0xc'));logger[_0x14dc('0xd')](_0x14dc('0xe'),_0x542451,_0x14dc('0xc'),JSON[_0x14dc('0xf')](_0x304aad));if(_0x304aad[_0x14dc('0x10')]){if(_0x304aad['error'][_0x14dc('0x11')]===0x1f4){logger[_0x14dc('0x10')]('Interval,\x20%s,\x20%s',_0x542451,_0x304aad[_0x14dc('0x10')]['message']);return _0x1c431b(_0x304aad[_0x14dc('0x10')]['message']);}logger[_0x14dc('0x10')](_0x14dc('0x12'),_0x542451,_0x304aad[_0x14dc('0x10')][_0x14dc('0x13')]);return _0x50d526(_0x304aad[_0x14dc('0x10')][_0x14dc('0x13')]);}else{logger[_0x14dc('0x14')]('Interval,\x20%s,\x20%s',_0x542451,'request\x20sent');_0x50d526(_0x304aad[_0x14dc('0x15')][_0x14dc('0x13')]);}})[_0x14dc('0x16')](function(_0x483df6){logger[_0x14dc('0x10')](_0x14dc('0x12'),_0x542451,_0x483df6);_0x1c431b(_0x483df6);});});}exports[_0x14dc('0x17')]=function(_0x45fe71){var _0x479f34=this;return new Promise(function(_0x190b20,_0x3e2b1b){return db[_0x14dc('0x18')][_0x14dc('0x19')]({'raw':_0x45fe71[_0x14dc('0x1a')]?_0x45fe71[_0x14dc('0x1a')][_0x14dc('0x1b')]===undefined?!![]:![]:!![],'where':_0x45fe71[_0x14dc('0x1a')]?_0x45fe71['options']['where']||null:null,'attributes':_0x45fe71[_0x14dc('0x1a')]?_0x45fe71[_0x14dc('0x1a')][_0x14dc('0x1c')]||null:null,'limit':_0x45fe71[_0x14dc('0x1a')]?_0x45fe71[_0x14dc('0x1a')][_0x14dc('0x1d')]||null:null,'include':_0x45fe71[_0x14dc('0x1a')]?_0x45fe71[_0x14dc('0x1a')][_0x14dc('0x1e')]?_[_0x14dc('0x1f')](_0x45fe71['options']['include'],function(_0x28d38a){return{'model':db[_0x28d38a[_0x14dc('0x20')]],'as':_0x28d38a['as'],'attributes':_0x28d38a['attributes'],'include':_0x28d38a[_0x14dc('0x1e')]?_[_0x14dc('0x1f')](_0x28d38a[_0x14dc('0x1e')],function(_0x14159b){return{'model':db[_0x14159b[_0x14dc('0x20')]],'as':_0x14159b['as'],'attributes':_0x14159b[_0x14dc('0x1c')],'include':_0x14159b['include']?_['map'](_0x14159b[_0x14dc('0x1e')],function(_0x36ffc8){return{'model':db[_0x36ffc8[_0x14dc('0x20')]],'as':_0x36ffc8['as'],'attributes':_0x36ffc8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49e674){logger[_0x14dc('0x14')](_0x14dc('0x17'),_0x45fe71);logger[_0x14dc('0xd')](_0x14dc('0x17'),_0x45fe71,JSON[_0x14dc('0xf')](_0x49e674));_0x190b20(_0x49e674);})[_0x14dc('0x16')](function(_0x44ebeb){logger[_0x14dc('0x10')](_0x14dc('0x17'),_0x44ebeb[_0x14dc('0x13')],_0x45fe71);_0x3e2b1b(_0x479f34['error'](0x1f4,_0x44ebeb['message']));});});};exports[_0x14dc('0x21')]=function(_0x2b1971){var _0x492491=this;return new Promise(function(_0x3c2b4b,_0x22b94a){return db[_0x14dc('0x18')][_0x14dc('0x22')]({'raw':_0x2b1971[_0x14dc('0x1a')]?_0x2b1971[_0x14dc('0x1a')][_0x14dc('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b1971[_0x14dc('0x1a')]?_0x2b1971[_0x14dc('0x1a')][_0x14dc('0x23')]||null:null,'attributes':_0x2b1971[_0x14dc('0x1a')]?_0x2b1971['options'][_0x14dc('0x1c')]||null:null,'include':_0x2b1971[_0x14dc('0x1a')]?_0x2b1971[_0x14dc('0x1a')][_0x14dc('0x1e')]?_[_0x14dc('0x1f')](_0x2b1971['options']['include'],function(_0x1cfa49){return{'model':db[_0x1cfa49[_0x14dc('0x20')]],'as':_0x1cfa49['as'],'attributes':_0x1cfa49['attributes'],'include':_0x1cfa49['include']?_[_0x14dc('0x1f')](_0x1cfa49[_0x14dc('0x1e')],function(_0x4470a0){return{'model':db[_0x4470a0[_0x14dc('0x20')]],'as':_0x4470a0['as'],'attributes':_0x4470a0[_0x14dc('0x1c')],'include':_0x4470a0[_0x14dc('0x1e')]?_[_0x14dc('0x1f')](_0x4470a0[_0x14dc('0x1e')],function(_0x4d54e1){return{'model':db[_0x4d54e1[_0x14dc('0x20')]],'as':_0x4d54e1['as'],'attributes':_0x4d54e1[_0x14dc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x14dc('0x24')](function(_0x25510a){logger['info'](_0x14dc('0x21'),_0x2b1971);logger[_0x14dc('0xd')](_0x14dc('0x21'),_0x2b1971,JSON[_0x14dc('0xf')](_0x25510a));_0x3c2b4b(_0x25510a);})['catch'](function(_0x54f496){logger[_0x14dc('0x10')](_0x14dc('0x21'),_0x54f496[_0x14dc('0x13')],_0x2b1971);_0x22b94a(_0x492491[_0x14dc('0x10')](0x1f4,_0x54f496[_0x14dc('0x13')]));});});}; \ No newline at end of file +var _0x6b91=['error','code','message','result','catch','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowInterval','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x6b91,0x185));var _0x16b9=function(_0x194afb,_0x2aaae7){_0x194afb=_0x194afb-0x0;var _0x33ff44=_0x6b91[_0x194afb];return _0x33ff44;};'use strict';var _=require(_0x16b9('0x0'));var util=require(_0x16b9('0x1'));var moment=require(_0x16b9('0x2'));var BPromise=require(_0x16b9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16b9('0x4'));var db=require(_0x16b9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x16b9('0x6'));var config=require(_0x16b9('0x7'));var jayson=require(_0x16b9('0x8'));var client=jayson[_0x16b9('0x9')][_0x16b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7b9e56,_0x19b4ce,_0x4a2311){return new BPromise(function(_0x278e78,_0x5381c4){return client[_0x16b9('0xb')](_0x7b9e56,_0x4a2311)[_0x16b9('0xc')](function(_0x206d4b){logger[_0x16b9('0xd')](_0x16b9('0xe'),_0x19b4ce,_0x16b9('0xf'));logger['debug'](_0x16b9('0x10'),_0x19b4ce,'request\x20sent',JSON[_0x16b9('0x11')](_0x206d4b));if(_0x206d4b[_0x16b9('0x12')]){if(_0x206d4b['error'][_0x16b9('0x13')]===0x1f4){logger[_0x16b9('0x12')]('Interval,\x20%s,\x20%s',_0x19b4ce,_0x206d4b['error'][_0x16b9('0x14')]);return _0x5381c4(_0x206d4b[_0x16b9('0x12')][_0x16b9('0x14')]);}logger[_0x16b9('0x12')](_0x16b9('0xe'),_0x19b4ce,_0x206d4b[_0x16b9('0x12')][_0x16b9('0x14')]);return _0x278e78(_0x206d4b['error'][_0x16b9('0x14')]);}else{logger[_0x16b9('0xd')](_0x16b9('0xe'),_0x19b4ce,_0x16b9('0xf'));_0x278e78(_0x206d4b[_0x16b9('0x15')][_0x16b9('0x14')]);}})[_0x16b9('0x16')](function(_0x4b8f0f){logger[_0x16b9('0x12')](_0x16b9('0xe'),_0x19b4ce,_0x4b8f0f);_0x5381c4(_0x4b8f0f);});});}exports[_0x16b9('0x17')]=function(_0x252bff){var _0x262cd7=this;return new Promise(function(_0x581d02,_0x42b9e0){return db[_0x16b9('0x18')][_0x16b9('0x19')]({'raw':_0x252bff[_0x16b9('0x1a')]?_0x252bff['options'][_0x16b9('0x1b')]===undefined?!![]:![]:!![],'where':_0x252bff[_0x16b9('0x1a')]?_0x252bff[_0x16b9('0x1a')][_0x16b9('0x1c')]||null:null,'attributes':_0x252bff[_0x16b9('0x1a')]?_0x252bff[_0x16b9('0x1a')][_0x16b9('0x1d')]||null:null,'limit':_0x252bff[_0x16b9('0x1a')]?_0x252bff[_0x16b9('0x1a')][_0x16b9('0x1e')]||null:null,'include':_0x252bff['options']?_0x252bff[_0x16b9('0x1a')][_0x16b9('0x1f')]?_[_0x16b9('0x20')](_0x252bff['options'][_0x16b9('0x1f')],function(_0x37fedd){return{'model':db[_0x37fedd['model']],'as':_0x37fedd['as'],'attributes':_0x37fedd[_0x16b9('0x1d')],'include':_0x37fedd['include']?_[_0x16b9('0x20')](_0x37fedd['include'],function(_0x50cc22){return{'model':db[_0x50cc22['model']],'as':_0x50cc22['as'],'attributes':_0x50cc22[_0x16b9('0x1d')],'include':_0x50cc22[_0x16b9('0x1f')]?_['map'](_0x50cc22['include'],function(_0x207a40){return{'model':db[_0x207a40[_0x16b9('0x21')]],'as':_0x207a40['as'],'attributes':_0x207a40[_0x16b9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x16b9('0xc')](function(_0xa0e3d0){logger[_0x16b9('0xd')]('GetInterval',_0x252bff);logger[_0x16b9('0x22')](_0x16b9('0x17'),_0x252bff,JSON[_0x16b9('0x11')](_0xa0e3d0));_0x581d02(_0xa0e3d0);})[_0x16b9('0x16')](function(_0xb009d0){logger[_0x16b9('0x12')]('GetInterval',_0xb009d0[_0x16b9('0x14')],_0x252bff);_0x42b9e0(_0x262cd7[_0x16b9('0x12')](0x1f4,_0xb009d0[_0x16b9('0x14')]));});});};exports[_0x16b9('0x23')]=function(_0x4a404b){var _0x51b51b=this;return new Promise(function(_0x450dd8,_0x102eaa){return db[_0x16b9('0x18')][_0x16b9('0x24')]({'raw':_0x4a404b[_0x16b9('0x1a')]?_0x4a404b[_0x16b9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4a404b[_0x16b9('0x1a')]?_0x4a404b[_0x16b9('0x1a')][_0x16b9('0x1c')]||null:null,'attributes':_0x4a404b[_0x16b9('0x1a')]?_0x4a404b[_0x16b9('0x1a')][_0x16b9('0x1d')]||null:null,'include':_0x4a404b[_0x16b9('0x1a')]?_0x4a404b[_0x16b9('0x1a')]['include']?_[_0x16b9('0x20')](_0x4a404b[_0x16b9('0x1a')]['include'],function(_0x93d9f7){return{'model':db[_0x93d9f7[_0x16b9('0x21')]],'as':_0x93d9f7['as'],'attributes':_0x93d9f7[_0x16b9('0x1d')],'include':_0x93d9f7[_0x16b9('0x1f')]?_['map'](_0x93d9f7[_0x16b9('0x1f')],function(_0xb69149){return{'model':db[_0xb69149['model']],'as':_0xb69149['as'],'attributes':_0xb69149[_0x16b9('0x1d')],'include':_0xb69149[_0x16b9('0x1f')]?_[_0x16b9('0x20')](_0xb69149['include'],function(_0x46aa5e){return{'model':db[_0x46aa5e[_0x16b9('0x21')]],'as':_0x46aa5e['as'],'attributes':_0x46aa5e[_0x16b9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x16b9('0xc')](function(_0x3a59f3){logger[_0x16b9('0xd')](_0x16b9('0x23'),_0x4a404b);logger['debug'](_0x16b9('0x23'),_0x4a404b,JSON[_0x16b9('0x11')](_0x3a59f3));_0x450dd8(_0x3a59f3);})['catch'](function(_0xcd1bb4){logger[_0x16b9('0x12')](_0x16b9('0x23'),_0xcd1bb4[_0x16b9('0x14')],_0x4a404b);_0x102eaa(_0x51b51b[_0x16b9('0x12')](0x1f4,_0xcd1bb4[_0x16b9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 2751b55..3a2f93d 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 _0x859b=['./jira.controller','post','isAuthenticated','send','exports','express'];(function(_0xe61c77,_0x1cbad7){var _0x3e1c1e=function(_0x19d65a){while(--_0x19d65a){_0xe61c77['push'](_0xe61c77['shift']());}};_0x3e1c1e(++_0x1cbad7);}(_0x859b,0x179));var _0xb859=function(_0x98ef0a,_0x4b545d){_0x98ef0a=_0x98ef0a-0x0;var _0x9f0f3b=_0x859b[_0x98ef0a];return _0x9f0f3b;};'use strict';var express=require(_0xb859('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xb859('0x1'));router[_0xb859('0x2')]('/',auth[_0xb859('0x3')](),controller[_0xb859('0x4')]);module[_0xb859('0x5')]=router; \ No newline at end of file +var _0xc4dd=['./jira.controller','post','isAuthenticated','send','exports','express','Router','../../components/auth/service'];(function(_0x2009de,_0x1c9b48){var _0x522c20=function(_0x393d43){while(--_0x393d43){_0x2009de['push'](_0x2009de['shift']());}};_0x522c20(++_0x1c9b48);}(_0xc4dd,0xe5));var _0xdc4d=function(_0x20c22c,_0x3fc521){_0x20c22c=_0x20c22c-0x0;var _0x11ce7e=_0xc4dd[_0x20c22c];return _0x11ce7e;};'use strict';var express=require(_0xdc4d('0x0'));var router=express[_0xdc4d('0x1')]();var auth=require(_0xdc4d('0x2'));var controller=require(_0xdc4d('0x3'));router[_0xdc4d('0x4')]('/',auth[_0xdc4d('0x5')](),controller[_0xdc4d('0x6')]);module[_0xdc4d('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 164a70c..7326ebd 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 _0x8899=['toString','base64','request','setEncoding','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','send','body','headers','remoteAddress','socket','connection','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0x8899,0x1b9));var _0x9889=function(_0x29cec0,_0x562007){_0x29cec0=_0x29cec0-0x0;var _0x2cb302=_0x8899[_0x29cec0];return _0x2cb302;};'use strict';var BPromise=require(_0x9889('0x0'));var https=require(_0x9889('0x1'));var logger=require(_0x9889('0x2'))(_0x9889('0x3'));var USERNAME='support';var PASSWORD=_0x9889('0x4');function openIssue(_0x37ba35,_0x5e215d){var _0x187809={'fields':{'project':{'key':_0x37ba35[_0x9889('0x5')]||_0x9889('0x6')},'summary':(_0x37ba35[_0x9889('0x7')]||_0x9889('0x8'))+_0x9889('0x9')+_0x37ba35['ip'],'description':_0x37ba35[_0x9889('0xa')]||JSON[_0x9889('0xb')](_0x37ba35),'issuetype':{'name':_0x37ba35[_0x9889('0xc')]||_0x9889('0xd')}}};_0x187809[_0x9889('0xe')][_0x9889('0xf')]=_0x37ba35['email'];_0x187809['fields'][_0x9889('0x10')]=_0x37ba35[_0x9889('0x11')];_0x187809[_0x9889('0xe')][_0x9889('0x12')]=_0x37ba35[_0x9889('0x13')];_0x187809['fields'][_0x9889('0x14')]=_0x37ba35[_0x9889('0x15')];_0x187809[_0x9889('0xe')][_0x9889('0x16')]=_0x37ba35[_0x9889('0x17')];_0x187809[_0x9889('0xe')][_0x9889('0x18')]=_0x37ba35['ip'];var _0x3a5b06={'host':_0x9889('0x19'),'port':0x1bb,'path':_0x9889('0x1a'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x9889('0x1b'),'Authorization':_0x9889('0x1c')+new Buffer(USERNAME+':'+PASSWORD)[_0x9889('0x1d')](_0x9889('0x1e'))}};var _0x1e59ba=JSON[_0x9889('0xb')](_0x187809);var _0x75d64c=https[_0x9889('0x1f')](_0x3a5b06,function(_0x5df744){_0x5df744[_0x9889('0x20')]('utf8');var _0x5f729c='';_0x5df744['on'](_0x9889('0x21'),function(_0x5eeb1e){_0x5f729c+=_0x5eeb1e;});_0x5df744['on'](_0x9889('0x22'),function(){if(_0x5e215d){return _0x5e215d[_0x9889('0x23')](_0x5df744[_0x9889('0x24')])[_0x9889('0x25')](JSON[_0x9889('0x26')](_0x5f729c));}});});_0x75d64c['on']('error',function(_0x1a7020){if(_0x5e215d){return _0x5e215d[_0x9889('0x23')](0x1f4)[_0x9889('0x25')]({'errors':[{'message':_0x9889('0x27'),'type':'api.jira'}]});}});_0x75d64c['write'](_0x1e59ba);_0x75d64c[_0x9889('0x22')]();}exports[_0x9889('0x28')]=openIssue;exports[_0x9889('0x29')]=function(_0x30e130,_0x3598af){_0x30e130[_0x9889('0x2a')]['ip']=_0x30e130[_0x9889('0x2b')]['x-forwarded-for']||_0x30e130['connection'][_0x9889('0x2c')]||_0x30e130[_0x9889('0x2d')][_0x9889('0x2c')]||_0x30e130[_0x9889('0x2e')][_0x9889('0x2d')][_0x9889('0x2c')];return openIssue(_0x30e130[_0x9889('0x2a')],_0x3598af);}; \ No newline at end of file +var _0x33af=['statusCode','error','json','end','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','summary','Report','stringify','Bug','fields','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','toString','base64','request','setEncoding','data','status'];(function(_0x5400a1,_0x2275aa){var _0x4006c7=function(_0x5002dc){while(--_0x5002dc){_0x5400a1['push'](_0x5400a1['shift']());}};_0x4006c7(++_0x2275aa);}(_0x33af,0xa3));var _0xf33a=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x33af[_0x40ac5e];return _0x2839d6;};'use strict';var BPromise=require(_0xf33a('0x0'));var https=require(_0xf33a('0x1'));var logger=require(_0xf33a('0x2'))(_0xf33a('0x3'));var USERNAME='support';var PASSWORD=_0xf33a('0x4');function openIssue(_0x40834e,_0x5051d3){var _0x1348dd={'fields':{'project':{'key':_0x40834e['key']||'MOTGUI'},'summary':(_0x40834e[_0xf33a('0x5')]||_0xf33a('0x6'))+'\x20from\x20'+_0x40834e['ip'],'description':_0x40834e['description']||JSON[_0xf33a('0x7')](_0x40834e),'issuetype':{'name':_0x40834e['issuetype']||_0xf33a('0x8')}}};_0x1348dd[_0xf33a('0x9')]['customfield_11500']=_0x40834e[_0xf33a('0xa')];_0x1348dd[_0xf33a('0x9')][_0xf33a('0xb')]=_0x40834e['oldToken'];_0x1348dd['fields'][_0xf33a('0xc')]=_0x40834e[_0xf33a('0xd')];_0x1348dd['fields'][_0xf33a('0xe')]=_0x40834e[_0xf33a('0xf')];_0x1348dd[_0xf33a('0x9')][_0xf33a('0x10')]=_0x40834e[_0xf33a('0x11')];_0x1348dd['fields']['customfield_10102']=_0x40834e['ip'];var _0x40f535={'host':_0xf33a('0x12'),'port':0x1bb,'path':_0xf33a('0x13'),'method':_0xf33a('0x14'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xf33a('0x15')](_0xf33a('0x16'))}};var _0x1cee4b=JSON[_0xf33a('0x7')](_0x1348dd);var _0x34565f=https[_0xf33a('0x17')](_0x40f535,function(_0x48aa03){_0x48aa03[_0xf33a('0x18')]('utf8');var _0xa166ec='';_0x48aa03['on'](_0xf33a('0x19'),function(_0xdcbcb1){_0xa166ec+=_0xdcbcb1;});_0x48aa03['on']('end',function(){if(_0x5051d3){return _0x5051d3[_0xf33a('0x1a')](_0x48aa03[_0xf33a('0x1b')])['json'](JSON['parse'](_0xa166ec));}});});_0x34565f['on'](_0xf33a('0x1c'),function(_0x2cfde3){if(_0x5051d3){return _0x5051d3[_0xf33a('0x1a')](0x1f4)[_0xf33a('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x34565f['write'](_0x1cee4b);_0x34565f[_0xf33a('0x1e')]();}exports[_0xf33a('0x1f')]=openIssue;exports['send']=function(_0x2cdd3f,_0x5937e2){_0x2cdd3f[_0xf33a('0x20')]['ip']=_0x2cdd3f[_0xf33a('0x21')][_0xf33a('0x22')]||_0x2cdd3f[_0xf33a('0x23')][_0xf33a('0x24')]||_0x2cdd3f[_0xf33a('0x25')]['remoteAddress']||_0x2cdd3f[_0xf33a('0x23')][_0xf33a('0x25')][_0xf33a('0x24')];return openIssue(_0x2cdd3f['body'],_0x5937e2);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index b991591..b5c22af 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 _0x32a3=['isAuthenticated','index','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x4dc901,_0x25b58d){var _0x5f3e3d=function(_0x10c13b){while(--_0x10c13b){_0x4dc901['push'](_0x4dc901['shift']());}};_0x5f3e3d(++_0x25b58d);}(_0x32a3,0x1e5));var _0x332a=function(_0x284127,_0xf6e797){_0x284127=_0x284127-0x0;var _0x5aac9e=_0x32a3[_0x284127];return _0x5aac9e;};'use strict';var multer=require(_0x332a('0x0'));var util=require(_0x332a('0x1'));var path=require(_0x332a('0x2'));var timeout=require(_0x332a('0x3'));var express=require(_0x332a('0x4'));var router=express[_0x332a('0x5')]();var auth=require(_0x332a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x332a('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x332a('0x8')]('/',auth[_0x332a('0x9')](),controller[_0x332a('0xa')]);router[_0x332a('0x8')]('/describe',auth[_0x332a('0x9')](),controller[_0x332a('0xb')]);router[_0x332a('0x8')](_0x332a('0xc'),auth['isAuthenticated'](),controller[_0x332a('0xd')]);router[_0x332a('0xe')]('/',auth['isAuthenticated'](),controller[_0x332a('0xf')]);router['put'](_0x332a('0xc'),auth[_0x332a('0x9')](),controller[_0x332a('0x10')]);router[_0x332a('0x11')](_0x332a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x332a('0x12')]=router; \ No newline at end of file +var _0x9279=['show','post','create','put','/:id','destroy','exports','multer','path','Router','../../config/environment','./jscriptyAnswerReport.controller','index','get','isAuthenticated','describe'];(function(_0x337df0,_0x8551ea){var _0x148952=function(_0x5403c5){while(--_0x5403c5){_0x337df0['push'](_0x337df0['shift']());}};_0x148952(++_0x8551ea);}(_0x9279,0xb7));var _0x9927=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x9279[_0x341e0f];return _0x59555a;};'use strict';var multer=require(_0x9927('0x0'));var util=require('util');var path=require(_0x9927('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9927('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9927('0x3'));var controller=require(_0x9927('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x9927('0x5')]);router[_0x9927('0x6')]('/describe',auth[_0x9927('0x7')](),controller[_0x9927('0x8')]);router[_0x9927('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x9927('0x9')]);router[_0x9927('0xa')]('/',auth[_0x9927('0x7')](),controller[_0x9927('0xb')]);router[_0x9927('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x9927('0xd'),auth[_0x9927('0x7')](),controller[_0x9927('0xe')]);module[_0x9927('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index ccb3bb1..29fd7cd 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 _0x1752=['STRING','exports','TEXT','long'];(function(_0x302d39,_0x463596){var _0x3efb40=function(_0xcb50eb){while(--_0xcb50eb){_0x302d39['push'](_0x302d39['shift']());}};_0x3efb40(++_0x463596);}(_0x1752,0xa5));var _0x2175=function(_0x54c6df,_0xa22ee3){_0x54c6df=_0x54c6df-0x0;var _0x3cdcc1=_0x1752[_0x54c6df];return _0x3cdcc1;};'use strict';var Sequelize=require('sequelize');module[_0x2175('0x0')]={'question':{'type':Sequelize[_0x2175('0x1')]},'answer':{'type':Sequelize[_0x2175('0x1')](_0x2175('0x2'))},'membername':{'type':Sequelize[_0x2175('0x3')]},'projectname':{'type':Sequelize[_0x2175('0x3')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2175('0x3')]},'calleridname':{'type':Sequelize[_0x2175('0x3')]},'calleridnum':{'type':Sequelize[_0x2175('0x3')]},'questionId':{'type':Sequelize[_0x2175('0x3')]}}; \ No newline at end of file +var _0x337f=['exports','TEXT','long','STRING','sequelize'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x337f,0x11c));var _0xf337=function(_0x1bcb0e,_0x46dd19){_0x1bcb0e=_0x1bcb0e-0x0;var _0x52aa39=_0x337f[_0x1bcb0e];return _0x52aa39;};'use strict';var Sequelize=require(_0xf337('0x0'));module[_0xf337('0x1')]={'question':{'type':Sequelize[_0xf337('0x2')]},'answer':{'type':Sequelize['TEXT'](_0xf337('0x3'))},'membername':{'type':Sequelize[_0xf337('0x4')]},'projectname':{'type':Sequelize[_0xf337('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf337('0x4')]},'calleridname':{'type':Sequelize[_0xf337('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xf337('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index bb149d2..1229b9e 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 _0x59ad=['includeAll','findAll','show','include','merge','find','catch','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','JscriptyAnswerReport'];(function(_0x37ca2a,_0xd9a32b){var _0x2a9be9=function(_0x38d026){while(--_0x38d026){_0x37ca2a['push'](_0x37ca2a['shift']());}};_0x2a9be9(++_0xd9a32b);}(_0x59ad,0x9c));var _0xd59a=function(_0x24aa43,_0x5b5ec6){_0x24aa43=_0x24aa43-0x0;var _0x51dd33=_0x59ad[_0x24aa43];return _0x51dd33;};'use strict';var pdf=require(_0xd59a('0x0'));var emlformat=require(_0xd59a('0x1'));var rimraf=require(_0xd59a('0x2'));var zipdir=require(_0xd59a('0x3'));var jsonpatch=require(_0xd59a('0x4'));var rp=require(_0xd59a('0x5'));var moment=require('moment');var BPromise=require(_0xd59a('0x6'));var Mustache=require('mustache');var util=require(_0xd59a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd59a('0x8'));var ejs=require(_0xd59a('0x9'));var fs=require('fs');var _=require(_0xd59a('0xa'));var squel=require(_0xd59a('0xb'));var crypto=require(_0xd59a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd59a('0x8'));var querystring=require(_0xd59a('0xd'));var Papa=require(_0xd59a('0xe'));var Redis=require(_0xd59a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd59a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd59a('0x11'))(_0xd59a('0x12'));var utils=require(_0xd59a('0x13'));var config=require(_0xd59a('0x14'));var licenseUtil=require(_0xd59a('0x15'));var db=require(_0xd59a('0x16'))['db'];function respondWithStatusCode(_0x2fa89d,_0x3f3e0d){_0x3f3e0d=_0x3f3e0d||0xcc;return function(_0x4f6056){if(_0x4f6056){return _0x2fa89d[_0xd59a('0x17')](_0x3f3e0d);}return _0x2fa89d['status'](_0x3f3e0d)[_0xd59a('0x18')]();};}function respondWithResult(_0x2ff95d,_0x2149d8){_0x2149d8=_0x2149d8||0xc8;return function(_0x271ff4){if(_0x271ff4){return _0x2ff95d[_0xd59a('0x19')](_0x2149d8)['json'](_0x271ff4);}};}function respondWithFilteredResult(_0x1a6193,_0x18501d){return function(_0x7725c6){if(_0x7725c6){var _0xe97770=_0x7725c6[_0xd59a('0x1a')],_0x55c816=_0x18501d[_0xd59a('0x1b')],_0x30368a=_0x18501d['offset']+_0x18501d[_0xd59a('0x1c')],_0x339db1;if(_0x30368a>=_0xe97770){_0x30368a=_0xe97770;_0x339db1=0xc8;}else{_0x339db1=0xce;}_0x1a6193[_0xd59a('0x19')](_0x339db1);return _0x1a6193['set'](_0xd59a('0x1d'),_0x55c816+'-'+_0x30368a+'/'+_0xe97770)['json'](_0x7725c6);}return null;};}function patchUpdates(_0x362cfb){return function(_0x5e2cf7){try{jsonpatch[_0xd59a('0x1e')](_0x5e2cf7,_0x362cfb,!![]);}catch(_0x59f5fb){return BPromise[_0xd59a('0x1f')](_0x59f5fb);}return _0x5e2cf7[_0xd59a('0x20')]();};}function saveUpdates(_0x2912de,_0x29f978){return function(_0x5ca90a){if(_0x5ca90a){return _0x5ca90a['update'](_0x2912de)['then'](function(_0x15faac){return _0x15faac;});}return null;};}function removeEntity(_0x1b90b4,_0x365de6){return function(_0x27ac7d){if(_0x27ac7d){return _0x27ac7d['destroy']()[_0xd59a('0x21')](function(){_0x1b90b4[_0xd59a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x509b72,_0x98190){return function(_0x50cd63){if(!_0x50cd63){_0x509b72[_0xd59a('0x17')](0x194);}return _0x50cd63;};}function handleError(_0xec2b04,_0x30be1a){_0x30be1a=_0x30be1a||0x1f4;return function(_0x8bfb2a){logger[_0xd59a('0x22')](_0x8bfb2a[_0xd59a('0x23')]);if(_0x8bfb2a[_0xd59a('0x24')]){delete _0x8bfb2a['name'];}_0xec2b04[_0xd59a('0x19')](_0x30be1a)[_0xd59a('0x25')](_0x8bfb2a);};}exports[_0xd59a('0x26')]=function(_0x5bfe38,_0x429d2c){var _0x4468cd={},_0x393630={},_0x44b370={'count':0x0,'rows':[]};var _0x132acc=_[_0xd59a('0x27')](db['JscriptyAnswerReport'][_0xd59a('0x28')],function(_0x370c75){return{'name':_0x370c75[_0xd59a('0x29')],'type':_0x370c75[_0xd59a('0x2a')][_0xd59a('0x2b')]};});_0x393630[_0xd59a('0x2c')]=_[_0xd59a('0x27')](_0x132acc,_0xd59a('0x24'));_0x393630[_0xd59a('0x2d')]=_[_0xd59a('0x2e')](_0x5bfe38['query']);_0x393630['filters']=_['intersection'](_0x393630[_0xd59a('0x2c')],_0x393630[_0xd59a('0x2d')]);_0x4468cd[_0xd59a('0x2f')]=_[_0xd59a('0x30')](_0x393630[_0xd59a('0x2c')],qs['fields'](_0x5bfe38['query'][_0xd59a('0x31')]));_0x4468cd[_0xd59a('0x2f')]=_0x4468cd[_0xd59a('0x2f')][_0xd59a('0x32')]?_0x4468cd[_0xd59a('0x2f')]:_0x393630['model'];if(!_0x5bfe38[_0xd59a('0x2d')][_0xd59a('0x33')](_0xd59a('0x34'))){_0x4468cd[_0xd59a('0x1c')]=qs[_0xd59a('0x1c')](_0x5bfe38['query'][_0xd59a('0x1c')]);_0x4468cd[_0xd59a('0x1b')]=qs[_0xd59a('0x1b')](_0x5bfe38[_0xd59a('0x2d')][_0xd59a('0x1b')]);}_0x4468cd[_0xd59a('0x35')]=qs[_0xd59a('0x36')](_0x5bfe38[_0xd59a('0x2d')]['sort']);_0x4468cd['where']=qs[_0xd59a('0x37')](_[_0xd59a('0x38')](_0x5bfe38[_0xd59a('0x2d')],_0x393630['filters']),_0x132acc);if(_0x5bfe38['query']['filter']){_0x4468cd[_0xd59a('0x39')]=_['merge'](_0x4468cd[_0xd59a('0x39')],{'$or':_[_0xd59a('0x27')](_0x132acc,function(_0x52c6ae){if(_0x52c6ae[_0xd59a('0x2a')]!=='VIRTUAL'){var _0x48bcef={};_0x48bcef[_0x52c6ae[_0xd59a('0x24')]]={'$like':'%'+_0x5bfe38[_0xd59a('0x2d')][_0xd59a('0x3a')]+'%'};return _0x48bcef;}})});}_0x4468cd=_['merge']({},_0x4468cd,_0x5bfe38['options']);var _0x236477={'where':_0x4468cd['where']};return db[_0xd59a('0x3b')][_0xd59a('0x1a')](_0x236477)[_0xd59a('0x21')](function(_0x57171b){_0x44b370[_0xd59a('0x1a')]=_0x57171b;if(_0x5bfe38['query'][_0xd59a('0x3c')]){_0x4468cd['include']=[{'all':!![]}];}return db[_0xd59a('0x3b')][_0xd59a('0x3d')](_0x4468cd);})[_0xd59a('0x21')](function(_0x1be622){_0x44b370['rows']=_0x1be622;return _0x44b370;})[_0xd59a('0x21')](respondWithFilteredResult(_0x429d2c,_0x4468cd))['catch'](handleError(_0x429d2c,null));};exports[_0xd59a('0x3e')]=function(_0x4ccd87,_0x287222){var _0x572540={'raw':!![],'where':{'id':_0x4ccd87['params']['id']}},_0x2ff969={};_0x2ff969['model']=_[_0xd59a('0x2e')](db[_0xd59a('0x3b')][_0xd59a('0x28')]);_0x2ff969['query']=_[_0xd59a('0x2e')](_0x4ccd87['query']);_0x2ff969[_0xd59a('0x37')]=_[_0xd59a('0x30')](_0x2ff969[_0xd59a('0x2c')],_0x2ff969[_0xd59a('0x2d')]);_0x572540['attributes']=_[_0xd59a('0x30')](_0x2ff969[_0xd59a('0x2c')],qs[_0xd59a('0x31')](_0x4ccd87[_0xd59a('0x2d')][_0xd59a('0x31')]));_0x572540['attributes']=_0x572540[_0xd59a('0x2f')][_0xd59a('0x32')]?_0x572540['attributes']:_0x2ff969['model'];if(_0x4ccd87[_0xd59a('0x2d')][_0xd59a('0x3c')]){_0x572540[_0xd59a('0x3f')]=[{'all':!![]}];}_0x572540=_[_0xd59a('0x40')]({},_0x572540,_0x4ccd87['options']);return db['JscriptyAnswerReport'][_0xd59a('0x41')](_0x572540)[_0xd59a('0x21')](handleEntityNotFound(_0x287222,null))[_0xd59a('0x21')](respondWithResult(_0x287222,null))[_0xd59a('0x42')](handleError(_0x287222,null));};exports['create']=function(_0x3011b7,_0x3ba2bd){return db[_0xd59a('0x3b')][_0xd59a('0x43')](_0x3011b7[_0xd59a('0x44')],{})[_0xd59a('0x21')](respondWithResult(_0x3ba2bd,0xc9))[_0xd59a('0x42')](handleError(_0x3ba2bd,null));};exports['update']=function(_0x44df01,_0x1f9b24){if(_0x44df01[_0xd59a('0x44')]['id']){delete _0x44df01['body']['id'];}return db[_0xd59a('0x3b')][_0xd59a('0x41')]({'where':{'id':_0x44df01[_0xd59a('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f9b24,null))[_0xd59a('0x21')](saveUpdates(_0x44df01['body'],null))[_0xd59a('0x21')](respondWithResult(_0x1f9b24,null))[_0xd59a('0x42')](handleError(_0x1f9b24,null));};exports[_0xd59a('0x46')]=function(_0x2e06e6,_0x815855){return db[_0xd59a('0x3b')][_0xd59a('0x41')]({'where':{'id':_0x2e06e6[_0xd59a('0x45')]['id']}})[_0xd59a('0x21')](handleEntityNotFound(_0x815855,null))[_0xd59a('0x21')](removeEntity(_0x815855,null))[_0xd59a('0x42')](handleError(_0x815855,null));};exports[_0xd59a('0x47')]=function(_0x5bec43,_0x446b62){return db[_0xd59a('0x3b')]['describe']()['then'](respondWithResult(_0x446b62,null))[_0xd59a('0x42')](handleError(_0x446b62,null));}; \ No newline at end of file +var _0xe393=['include','findAll','rows','catch','params','keys','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll'];(function(_0x3bceea,_0x58af75){var _0x30a8d3=function(_0x1550b5){while(--_0x1550b5){_0x3bceea['push'](_0x3bceea['shift']());}};_0x30a8d3(++_0x58af75);}(_0xe393,0x143));var _0x3e39=function(_0x3e23fd,_0x324cb8){_0x3e23fd=_0x3e23fd-0x0;var _0x23e70d=_0xe393[_0x3e23fd];return _0x23e70d;};'use strict';var pdf=require(_0x3e39('0x0'));var emlformat=require(_0x3e39('0x1'));var rimraf=require(_0x3e39('0x2'));var zipdir=require(_0x3e39('0x3'));var jsonpatch=require(_0x3e39('0x4'));var rp=require(_0x3e39('0x5'));var moment=require(_0x3e39('0x6'));var BPromise=require(_0x3e39('0x7'));var Mustache=require(_0x3e39('0x8'));var util=require(_0x3e39('0x9'));var path=require(_0x3e39('0xa'));var sox=require(_0x3e39('0xb'));var csv=require('to-csv');var ejs=require(_0x3e39('0xc'));var fs=require('fs');var _=require(_0x3e39('0xd'));var squel=require(_0x3e39('0xe'));var crypto=require(_0x3e39('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3e39('0x10'));var toCsv=require(_0x3e39('0x11'));var querystring=require(_0x3e39('0x12'));var Papa=require(_0x3e39('0x13'));var Redis=require(_0x3e39('0x14'));var authService=require(_0x3e39('0x15'));var qs=require(_0x3e39('0x16'));var as=require(_0x3e39('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3e39('0x18'));var utils=require(_0x3e39('0x19'));var config=require(_0x3e39('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4feceb,_0x45b23c){_0x45b23c=_0x45b23c||0xcc;return function(_0x463d40){if(_0x463d40){return _0x4feceb['sendStatus'](_0x45b23c);}return _0x4feceb[_0x3e39('0x1b')](_0x45b23c)[_0x3e39('0x1c')]();};}function respondWithResult(_0x2cc45c,_0x3788ff){_0x3788ff=_0x3788ff||0xc8;return function(_0x3f99b0){if(_0x3f99b0){return _0x2cc45c[_0x3e39('0x1b')](_0x3788ff)[_0x3e39('0x1d')](_0x3f99b0);}};}function respondWithFilteredResult(_0x441c12,_0x53617a){return function(_0x9631a7){if(_0x9631a7){var _0x9805a7=_0x9631a7[_0x3e39('0x1e')],_0x1d9a95=_0x53617a[_0x3e39('0x1f')],_0x35ad9d=_0x53617a['offset']+_0x53617a[_0x3e39('0x20')],_0x52acd4;if(_0x35ad9d>=_0x9805a7){_0x35ad9d=_0x9805a7;_0x52acd4=0xc8;}else{_0x52acd4=0xce;}_0x441c12[_0x3e39('0x1b')](_0x52acd4);return _0x441c12[_0x3e39('0x21')](_0x3e39('0x22'),_0x1d9a95+'-'+_0x35ad9d+'/'+_0x9805a7)[_0x3e39('0x1d')](_0x9631a7);}return null;};}function patchUpdates(_0x5742a8){return function(_0x4a37f4){try{jsonpatch[_0x3e39('0x23')](_0x4a37f4,_0x5742a8,!![]);}catch(_0x47d503){return BPromise[_0x3e39('0x24')](_0x47d503);}return _0x4a37f4[_0x3e39('0x25')]();};}function saveUpdates(_0x2af373,_0x617d4f){return function(_0x5b96ea){if(_0x5b96ea){return _0x5b96ea[_0x3e39('0x26')](_0x2af373)[_0x3e39('0x27')](function(_0x62b0be){return _0x62b0be;});}return null;};}function removeEntity(_0x55c61c,_0x452927){return function(_0x568a5d){if(_0x568a5d){return _0x568a5d['destroy']()[_0x3e39('0x27')](function(){_0x55c61c[_0x3e39('0x1b')](0xcc)[_0x3e39('0x1c')]();});}};}function handleEntityNotFound(_0x5b5a4f,_0x22c497){return function(_0x23c9ae){if(!_0x23c9ae){_0x5b5a4f['sendStatus'](0x194);}return _0x23c9ae;};}function handleError(_0x3a7ddb,_0x53f862){_0x53f862=_0x53f862||0x1f4;return function(_0x3c4f34){logger['error'](_0x3c4f34[_0x3e39('0x28')]);if(_0x3c4f34[_0x3e39('0x29')]){delete _0x3c4f34[_0x3e39('0x29')];}_0x3a7ddb[_0x3e39('0x1b')](_0x53f862)['send'](_0x3c4f34);};}exports[_0x3e39('0x2a')]=function(_0x25c949,_0x352f6e){var _0x35049c={},_0xc72feb={},_0x1178d8={'count':0x0,'rows':[]};var _0x9d170c=_[_0x3e39('0x2b')](db['JscriptyAnswerReport'][_0x3e39('0x2c')],function(_0x1d106d){return{'name':_0x1d106d[_0x3e39('0x2d')],'type':_0x1d106d[_0x3e39('0x2e')][_0x3e39('0x2f')]};});_0xc72feb['model']=_['map'](_0x9d170c,'name');_0xc72feb[_0x3e39('0x30')]=_['keys'](_0x25c949[_0x3e39('0x30')]);_0xc72feb[_0x3e39('0x31')]=_[_0x3e39('0x32')](_0xc72feb[_0x3e39('0x33')],_0xc72feb['query']);_0x35049c[_0x3e39('0x34')]=_[_0x3e39('0x32')](_0xc72feb[_0x3e39('0x33')],qs[_0x3e39('0x35')](_0x25c949[_0x3e39('0x30')]['fields']));_0x35049c[_0x3e39('0x34')]=_0x35049c[_0x3e39('0x34')][_0x3e39('0x36')]?_0x35049c[_0x3e39('0x34')]:_0xc72feb[_0x3e39('0x33')];if(!_0x25c949[_0x3e39('0x30')][_0x3e39('0x37')](_0x3e39('0x38'))){_0x35049c[_0x3e39('0x20')]=qs['limit'](_0x25c949[_0x3e39('0x30')][_0x3e39('0x20')]);_0x35049c[_0x3e39('0x1f')]=qs[_0x3e39('0x1f')](_0x25c949[_0x3e39('0x30')][_0x3e39('0x1f')]);}_0x35049c[_0x3e39('0x39')]=qs[_0x3e39('0x3a')](_0x25c949[_0x3e39('0x30')][_0x3e39('0x3a')]);_0x35049c[_0x3e39('0x3b')]=qs[_0x3e39('0x31')](_[_0x3e39('0x3c')](_0x25c949[_0x3e39('0x30')],_0xc72feb[_0x3e39('0x31')]),_0x9d170c);if(_0x25c949[_0x3e39('0x30')][_0x3e39('0x3d')]){_0x35049c[_0x3e39('0x3b')]=_[_0x3e39('0x3e')](_0x35049c[_0x3e39('0x3b')],{'$or':_['map'](_0x9d170c,function(_0x14feb8){if(_0x14feb8[_0x3e39('0x2e')]!==_0x3e39('0x3f')){var _0x4c0479={};_0x4c0479[_0x14feb8[_0x3e39('0x29')]]={'$like':'%'+_0x25c949[_0x3e39('0x30')][_0x3e39('0x3d')]+'%'};return _0x4c0479;}})});}_0x35049c=_['merge']({},_0x35049c,_0x25c949[_0x3e39('0x40')]);var _0x641907={'where':_0x35049c[_0x3e39('0x3b')]};return db[_0x3e39('0x41')][_0x3e39('0x1e')](_0x641907)[_0x3e39('0x27')](function(_0x58ee91){_0x1178d8[_0x3e39('0x1e')]=_0x58ee91;if(_0x25c949[_0x3e39('0x30')][_0x3e39('0x42')]){_0x35049c[_0x3e39('0x43')]=[{'all':!![]}];}return db[_0x3e39('0x41')][_0x3e39('0x44')](_0x35049c);})[_0x3e39('0x27')](function(_0x363393){_0x1178d8[_0x3e39('0x45')]=_0x363393;return _0x1178d8;})[_0x3e39('0x27')](respondWithFilteredResult(_0x352f6e,_0x35049c))[_0x3e39('0x46')](handleError(_0x352f6e,null));};exports['show']=function(_0x142742,_0x14f3a0){var _0x4a9abb={'raw':!![],'where':{'id':_0x142742[_0x3e39('0x47')]['id']}},_0x1a4278={};_0x1a4278[_0x3e39('0x33')]=_[_0x3e39('0x48')](db[_0x3e39('0x41')][_0x3e39('0x2c')]);_0x1a4278[_0x3e39('0x30')]=_[_0x3e39('0x48')](_0x142742[_0x3e39('0x30')]);_0x1a4278[_0x3e39('0x31')]=_[_0x3e39('0x32')](_0x1a4278['model'],_0x1a4278[_0x3e39('0x30')]);_0x4a9abb[_0x3e39('0x34')]=_[_0x3e39('0x32')](_0x1a4278[_0x3e39('0x33')],qs[_0x3e39('0x35')](_0x142742[_0x3e39('0x30')][_0x3e39('0x35')]));_0x4a9abb[_0x3e39('0x34')]=_0x4a9abb['attributes'][_0x3e39('0x36')]?_0x4a9abb[_0x3e39('0x34')]:_0x1a4278['model'];if(_0x142742['query'][_0x3e39('0x42')]){_0x4a9abb[_0x3e39('0x43')]=[{'all':!![]}];}_0x4a9abb=_[_0x3e39('0x3e')]({},_0x4a9abb,_0x142742[_0x3e39('0x40')]);return db[_0x3e39('0x41')]['find'](_0x4a9abb)[_0x3e39('0x27')](handleEntityNotFound(_0x14f3a0,null))[_0x3e39('0x27')](respondWithResult(_0x14f3a0,null))[_0x3e39('0x46')](handleError(_0x14f3a0,null));};exports[_0x3e39('0x49')]=function(_0x5ddfbc,_0x56b9b9){return db['JscriptyAnswerReport'][_0x3e39('0x49')](_0x5ddfbc['body'],{})[_0x3e39('0x27')](respondWithResult(_0x56b9b9,0xc9))[_0x3e39('0x46')](handleError(_0x56b9b9,null));};exports[_0x3e39('0x26')]=function(_0x476c5e,_0x52dd84){if(_0x476c5e['body']['id']){delete _0x476c5e[_0x3e39('0x4a')]['id'];}return db['JscriptyAnswerReport'][_0x3e39('0x4b')]({'where':{'id':_0x476c5e[_0x3e39('0x47')]['id']}})[_0x3e39('0x27')](handleEntityNotFound(_0x52dd84,null))['then'](saveUpdates(_0x476c5e[_0x3e39('0x4a')],null))['then'](respondWithResult(_0x52dd84,null))[_0x3e39('0x46')](handleError(_0x52dd84,null));};exports[_0x3e39('0x4c')]=function(_0x38067d,_0x4c97e0){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x38067d[_0x3e39('0x47')]['id']}})['then'](handleEntityNotFound(_0x4c97e0,null))[_0x3e39('0x27')](removeEntity(_0x4c97e0,null))[_0x3e39('0x46')](handleError(_0x4c97e0,null));};exports[_0x3e39('0x4d')]=function(_0x2c09f4,_0x369503){return db[_0x3e39('0x41')]['describe']()[_0x3e39('0x27')](respondWithResult(_0x369503,null))[_0x3e39('0x46')](handleError(_0x369503,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index f14a30b..6896d42 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 _0xe33c=['define','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x35563c,_0x1393e9){var _0x2a763c=function(_0x14ebd9){while(--_0x14ebd9){_0x35563c['push'](_0x35563c['shift']());}};_0x2a763c(++_0x1393e9);}(_0xe33c,0xbc));var _0xce33=function(_0x46b669,_0x3dc437){_0x46b669=_0x46b669-0x0;var _0x33e9d9=_0xe33c[_0x46b669];return _0x33e9d9;};'use strict';var _=require('lodash');var util=require(_0xce33('0x0'));var logger=require('../../config/logger')(_0xce33('0x1'));var moment=require(_0xce33('0x2'));var BPromise=require(_0xce33('0x3'));var rp=require(_0xce33('0x4'));var fs=require('fs');var path=require(_0xce33('0x5'));var rimraf=require(_0xce33('0x6'));var config=require(_0xce33('0x7'));var attributes=require(_0xce33('0x8'));module[_0xce33('0x9')]=function(_0x1f5c67,_0x3a2092){return _0x1f5c67[_0xce33('0xa')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa54b=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x460fd9,_0x4b4b97){var _0x424e18=function(_0x4a4942){while(--_0x4a4942){_0x460fd9['push'](_0x460fd9['shift']());}};_0x424e18(++_0x4b4b97);}(_0xa54b,0x1df));var _0xba54=function(_0x2ca036,_0x2d87c8){_0x2ca036=_0x2ca036-0x0;var _0xa44c08=_0xa54b[_0x2ca036];return _0xa44c08;};'use strict';var _=require(_0xba54('0x0'));var util=require(_0xba54('0x1'));var logger=require('../../config/logger')(_0xba54('0x2'));var moment=require(_0xba54('0x3'));var BPromise=require(_0xba54('0x4'));var rp=require(_0xba54('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba54('0x6'));var config=require(_0xba54('0x7'));var attributes=require(_0xba54('0x8'));module['exports']=function(_0x5c1e46,_0x2e2583){return _0x5c1e46[_0xba54('0x9')](_0xba54('0xa'),attributes,{'tableName':_0xba54('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 b9a3b33..171c296 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 _0x1eb7=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x1eb7,0x183));var _0x71eb=function(_0x2bf477,_0x4a153f){_0x2bf477=_0x2bf477-0x0;var _0x98d01a=_0x1eb7[_0x2bf477];return _0x98d01a;};'use strict';var _=require(_0x71eb('0x0'));var util=require(_0x71eb('0x1'));var moment=require(_0x71eb('0x2'));var BPromise=require('bluebird');var rs=require(_0x71eb('0x3'));var fs=require('fs');var Redis=require(_0x71eb('0x4'));var db=require(_0x71eb('0x5'))['db'];var utils=require(_0x71eb('0x6'));var logger=require('../../config/logger')(_0x71eb('0x7'));var config=require('../../config/environment');var jayson=require(_0x71eb('0x8'));var client=jayson[_0x71eb('0x9')][_0x71eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x377ab6,_0x12e3e3,_0x47fe7c){return new BPromise(function(_0x2d5a83,_0x2deb08){return client[_0x71eb('0xb')](_0x377ab6,_0x47fe7c)[_0x71eb('0xc')](function(_0x27909f){logger[_0x71eb('0xd')](_0x71eb('0xe'),_0x12e3e3,_0x71eb('0xf'));logger[_0x71eb('0x10')](_0x71eb('0x11'),_0x12e3e3,'request\x20sent',JSON[_0x71eb('0x12')](_0x27909f));if(_0x27909f['error']){if(_0x27909f[_0x71eb('0x13')][_0x71eb('0x14')]===0x1f4){logger[_0x71eb('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x12e3e3,_0x27909f[_0x71eb('0x13')][_0x71eb('0x15')]);return _0x2deb08(_0x27909f[_0x71eb('0x13')]['message']);}logger[_0x71eb('0x13')](_0x71eb('0xe'),_0x12e3e3,_0x27909f[_0x71eb('0x13')]['message']);return _0x2d5a83(_0x27909f[_0x71eb('0x13')][_0x71eb('0x15')]);}else{logger[_0x71eb('0xd')](_0x71eb('0xe'),_0x12e3e3,_0x71eb('0xf'));_0x2d5a83(_0x27909f[_0x71eb('0x16')]['message']);}})[_0x71eb('0x17')](function(_0x3ffda9){logger[_0x71eb('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x12e3e3,_0x3ffda9);_0x2deb08(_0x3ffda9);});});} \ No newline at end of file +var _0xd000=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xd000,0xac));var _0x0d00=function(_0x3fd566,_0xbae27b){_0x3fd566=_0x3fd566-0x0;var _0x2e6dae=_0xd000[_0x3fd566];return _0x2e6dae;};'use strict';var _=require(_0x0d00('0x0'));var util=require(_0x0d00('0x1'));var moment=require(_0x0d00('0x2'));var BPromise=require(_0x0d00('0x3'));var rs=require(_0x0d00('0x4'));var fs=require('fs');var Redis=require(_0x0d00('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0d00('0x6'))(_0x0d00('0x7'));var config=require(_0x0d00('0x8'));var jayson=require(_0x0d00('0x9'));var client=jayson[_0x0d00('0xa')][_0x0d00('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6f51e7,_0x4ce285,_0x104363){return new BPromise(function(_0x1a6dba,_0x14a550){return client['request'](_0x6f51e7,_0x104363)['then'](function(_0x53db7e){logger[_0x0d00('0xc')](_0x0d00('0xd'),_0x4ce285,'request\x20sent');logger['debug'](_0x0d00('0xe'),_0x4ce285,_0x0d00('0xf'),JSON[_0x0d00('0x10')](_0x53db7e));if(_0x53db7e['error']){if(_0x53db7e[_0x0d00('0x11')][_0x0d00('0x12')]===0x1f4){logger[_0x0d00('0x11')](_0x0d00('0xd'),_0x4ce285,_0x53db7e['error'][_0x0d00('0x13')]);return _0x14a550(_0x53db7e['error'][_0x0d00('0x13')]);}logger['error'](_0x0d00('0xd'),_0x4ce285,_0x53db7e[_0x0d00('0x11')][_0x0d00('0x13')]);return _0x1a6dba(_0x53db7e[_0x0d00('0x11')][_0x0d00('0x13')]);}else{logger[_0x0d00('0xc')](_0x0d00('0xd'),_0x4ce285,_0x0d00('0xf'));_0x1a6dba(_0x53db7e['result'][_0x0d00('0x13')]);}})[_0x0d00('0x14')](function(_0x54fe2c){logger[_0x0d00('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4ce285,_0x54fe2c);_0x14a550(_0x54fe2c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 84cbcec..f8698dd 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 _0x0ee5=['isAuthenticated','index','get','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','/:id/clone','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e048b,_0x460d81){var _0x29aeb9=function(_0x585e09){while(--_0x585e09){_0x2e048b['push'](_0x2e048b['shift']());}};_0x29aeb9(++_0x460d81);}(_0x0ee5,0x12f));var _0x50ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0ee5[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x50ee('0x0'));var util=require(_0x50ee('0x1'));var path=require(_0x50ee('0x2'));var timeout=require(_0x50ee('0x3'));var express=require(_0x50ee('0x4'));var router=express[_0x50ee('0x5')]();var auth=require(_0x50ee('0x6'));var interaction=require(_0x50ee('0x7'));var config=require(_0x50ee('0x8'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x50ee('0x9')](),controller[_0x50ee('0xa')]);router[_0x50ee('0xb')](_0x50ee('0xc'),auth[_0x50ee('0x9')](),controller['show']);router[_0x50ee('0xb')](_0x50ee('0xd'),auth[_0x50ee('0x9')](),controller[_0x50ee('0xe')]);router[_0x50ee('0xb')](_0x50ee('0xf'),auth['isAuthenticated'](),controller[_0x50ee('0x10')]);router['get'](_0x50ee('0x11'),auth['isAuthenticated'](),timeout(_0x50ee('0x12')),controller[_0x50ee('0x13')]);router['post']('/',auth[_0x50ee('0x9')](),controller[_0x50ee('0x14')]);router['post'](_0x50ee('0x15'),auth['isAuthenticated'](),controller['clone']);router[_0x50ee('0x16')](_0x50ee('0xc'),auth[_0x50ee('0x9')](),controller[_0x50ee('0x17')]);router[_0x50ee('0x18')](_0x50ee('0xc'),auth[_0x50ee('0x9')](),controller[_0x50ee('0x19')]);module['exports']=router; \ No newline at end of file +var _0x9047=['/:id/summary','30s','getSummary','create','post','/:id/clone','clone','put','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','getAnswers'];(function(_0x52bbb4,_0x2b7f28){var _0x42d82e=function(_0xc9f1f2){while(--_0xc9f1f2){_0x52bbb4['push'](_0x52bbb4['shift']());}};_0x42d82e(++_0x2b7f28);}(_0x9047,0x128));var _0x7904=function(_0x4cf9a8,_0x4b6b9d){_0x4cf9a8=_0x4cf9a8-0x0;var _0x18387d=_0x9047[_0x4cf9a8];return _0x18387d;};'use strict';var multer=require('multer');var util=require(_0x7904('0x0'));var path=require(_0x7904('0x1'));var timeout=require('connect-timeout');var express=require(_0x7904('0x2'));var router=express[_0x7904('0x3')]();var auth=require(_0x7904('0x4'));var interaction=require(_0x7904('0x5'));var config=require(_0x7904('0x6'));var controller=require(_0x7904('0x7'));router[_0x7904('0x8')]('/',auth['isAuthenticated'](),controller[_0x7904('0x9')]);router[_0x7904('0x8')](_0x7904('0xa'),auth[_0x7904('0xb')](),controller[_0x7904('0xc')]);router['get'](_0x7904('0xd'),auth[_0x7904('0xb')](),controller[_0x7904('0xe')]);router[_0x7904('0x8')]('/:id/answers',auth[_0x7904('0xb')](),controller[_0x7904('0xf')]);router[_0x7904('0x8')](_0x7904('0x10'),auth[_0x7904('0xb')](),timeout(_0x7904('0x11')),controller[_0x7904('0x12')]);router['post']('/',auth[_0x7904('0xb')](),controller[_0x7904('0x13')]);router[_0x7904('0x14')](_0x7904('0x15'),auth['isAuthenticated'](),controller[_0x7904('0x16')]);router[_0x7904('0x17')](_0x7904('0xa'),auth[_0x7904('0xb')](),controller['update']);router[_0x7904('0x18')](_0x7904('0xa'),auth[_0x7904('0xb')](),controller['destroy']);module[_0x7904('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 65d8e80..b0458a1 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 _0x690c=['description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','long','isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x4261a5,_0x4df735){var _0x17a35a=function(_0x4a1297){while(--_0x4a1297){_0x4261a5['push'](_0x4261a5['shift']());}};_0x17a35a(++_0x4df735);}(_0x690c,0x162));var _0xc690=function(_0x3aa2ed,_0x3882f7){_0x3aa2ed=_0x3aa2ed-0x0;var _0x4d704d=_0x690c[_0x3aa2ed];return _0x4d704d;};'use strict';var Sequelize=require(_0xc690('0x0'));var _=require(_0xc690('0x1'));var util=require(_0xc690('0x2'));module[_0xc690('0x3')]={'name':{'type':Sequelize[_0xc690('0x4')],'unique':_0xc690('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xc690('0x6')),'set':function(_0x4e82bd){if(_[_0xc690('0x7')](_0x4e82bd)){this[_0xc690('0x8')](_0xc690('0x9'),JSON[_0xc690('0xa')](_0x4e82bd));}else if(_['isString'](_0x4e82bd)){this['setDataValue']('formData',_0x4e82bd);}else{this['setDataValue'](_0xc690('0x9'),util[_0xc690('0xb')](_0xc690('0xc'),this[_0xc690('0xd')]('name')||'',this[_0xc690('0xd')](_0xc690('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc690('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xde6e=['sequelize','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x5d9613,_0x11eead){var _0x3d96f4=function(_0x1947f9){while(--_0x1947f9){_0x5d9613['push'](_0x5d9613['shift']());}};_0x3d96f4(++_0x11eead);}(_0xde6e,0x120));var _0xede6=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0xde6e[_0x3c6dce];return _0x1450e9;};'use strict';var Sequelize=require(_0xede6('0x0'));var _=require('lodash');var util=require(_0xede6('0x1'));module[_0xede6('0x2')]={'name':{'type':Sequelize[_0xede6('0x3')],'unique':_0xede6('0x4')},'description':{'type':Sequelize[_0xede6('0x3')]},'formData':{'type':Sequelize[_0xede6('0x5')](_0xede6('0x6')),'set':function(_0x321011){if(_[_0xede6('0x7')](_0x321011)){this[_0xede6('0x8')]('formData',JSON[_0xede6('0x9')](_0x321011));}else if(_[_0xede6('0xa')](_0x321011)){this[_0xede6('0x8')](_0xede6('0xb'),_0x321011);}else{this[_0xede6('0x8')](_0xede6('0xb'),util['format'](_0xede6('0xc'),this[_0xede6('0xd')]('name')||'',this[_0xede6('0xd')](_0xede6('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xede6('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xede6('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a3dd009..96f62b0 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 _0x625a=['params','rawAttributes','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','clone','createdAt','updatedAt','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','JscriptySessionReport','hasOwnProperty','rows','getAnswers','findOne','JscriptyAnswerReport','ProjectId','number','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Projects','UserProfileResource','sendStatus','name','send','index','map','JscriptyProject','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x625a,0x1a2));var _0xa625=function(_0x5ec453,_0x30b0ba){_0x5ec453=_0x5ec453-0x0;var _0x25548f=_0x625a[_0x5ec453];return _0x25548f;};'use strict';var pdf=require(_0xa625('0x0'));var emlformat=require(_0xa625('0x1'));var rimraf=require(_0xa625('0x2'));var zipdir=require(_0xa625('0x3'));var jsonpatch=require(_0xa625('0x4'));var rp=require(_0xa625('0x5'));var moment=require(_0xa625('0x6'));var BPromise=require(_0xa625('0x7'));var Mustache=require(_0xa625('0x8'));var util=require('util');var path=require(_0xa625('0x9'));var sox=require(_0xa625('0xa'));var csv=require(_0xa625('0xb'));var ejs=require(_0xa625('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa625('0xd'));var crypto=require('crypto');var jsforce=require(_0xa625('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa625('0xf'));var Papa=require(_0xa625('0x10'));var Redis=require(_0xa625('0x11'));var authService=require(_0xa625('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa625('0x13'));var hardwareService=require(_0xa625('0x14'));var logger=require('../../config/logger')(_0xa625('0x15'));var utils=require(_0xa625('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa625('0x17'));var db=require(_0xa625('0x18'))['db'];function respondWithStatusCode(_0x52f760,_0x32ee29){_0x32ee29=_0x32ee29||0xcc;return function(_0x30a926){if(_0x30a926){return _0x52f760['sendStatus'](_0x32ee29);}return _0x52f760['status'](_0x32ee29)[_0xa625('0x19')]();};}function respondWithResult(_0x2fd297,_0x5ce680){_0x5ce680=_0x5ce680||0xc8;return function(_0x43d4b5){if(_0x43d4b5){return _0x2fd297[_0xa625('0x1a')](_0x5ce680)[_0xa625('0x1b')](_0x43d4b5);}};}function respondWithFilteredResult(_0xfdf741,_0x218f4d){return function(_0x4d7f6c){if(_0x4d7f6c){var _0x16477b=_0x4d7f6c[_0xa625('0x1c')],_0x12f135=_0x218f4d[_0xa625('0x1d')],_0xa87be8=_0x218f4d[_0xa625('0x1d')]+_0x218f4d[_0xa625('0x1e')],_0x50ed2f;if(_0xa87be8>=_0x16477b){_0xa87be8=_0x16477b;_0x50ed2f=0xc8;}else{_0x50ed2f=0xce;}_0xfdf741[_0xa625('0x1a')](_0x50ed2f);return _0xfdf741[_0xa625('0x1f')](_0xa625('0x20'),_0x12f135+'-'+_0xa87be8+'/'+_0x16477b)[_0xa625('0x1b')](_0x4d7f6c);}return null;};}function patchUpdates(_0x323b7a){return function(_0x344dc7){try{jsonpatch['apply'](_0x344dc7,_0x323b7a,!![]);}catch(_0x21c4c5){return BPromise[_0xa625('0x21')](_0x21c4c5);}return _0x344dc7[_0xa625('0x22')]();};}function saveUpdates(_0x1d2c76,_0x943195){return function(_0x22a88d){if(_0x22a88d){return _0x22a88d[_0xa625('0x23')](_0x1d2c76)[_0xa625('0x24')](function(_0x202fa0){return _0x202fa0;});}return null;};}function removeEntity(_0x361edf,_0x1469b9){return function(_0x338bcc){if(_0x338bcc){return _0x338bcc[_0xa625('0x25')]()['then'](function(){var _0x2970f7=_0x338bcc[_0xa625('0x26')]({'plain':!![]});var _0x4edd71=_0xa625('0x27');return db[_0xa625('0x28')][_0xa625('0x25')]({'where':{'type':_0x4edd71,'resourceId':_0x2970f7['id']}})[_0xa625('0x24')](function(){return _0x338bcc;});})[_0xa625('0x24')](function(){_0x361edf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47df21,_0x5ca907){return function(_0x124ccb){if(!_0x124ccb){_0x47df21[_0xa625('0x29')](0x194);}return _0x124ccb;};}function handleError(_0x424c34,_0x11be0c){_0x11be0c=_0x11be0c||0x1f4;return function(_0x2e98cb){logger['error'](_0x2e98cb['stack']);if(_0x2e98cb[_0xa625('0x2a')]){delete _0x2e98cb[_0xa625('0x2a')];}_0x424c34[_0xa625('0x1a')](_0x11be0c)[_0xa625('0x2b')](_0x2e98cb);};}exports[_0xa625('0x2c')]=function(_0x43bda3,_0xdd9802){var _0x3fa324={},_0x2d2d54={},_0x457f83={'count':0x0,'rows':[]};var _0x243f4c=_[_0xa625('0x2d')](db[_0xa625('0x2e')]['rawAttributes'],function(_0x13d348){return{'name':_0x13d348[_0xa625('0x2f')],'type':_0x13d348[_0xa625('0x30')][_0xa625('0x31')]};});_0x2d2d54[_0xa625('0x32')]=_[_0xa625('0x2d')](_0x243f4c,_0xa625('0x2a'));_0x2d2d54['query']=_[_0xa625('0x33')](_0x43bda3['query']);_0x2d2d54[_0xa625('0x34')]=_[_0xa625('0x35')](_0x2d2d54['model'],_0x2d2d54[_0xa625('0x36')]);_0x3fa324['attributes']=_['intersection'](_0x2d2d54[_0xa625('0x32')],qs[_0xa625('0x37')](_0x43bda3[_0xa625('0x36')][_0xa625('0x37')]));_0x3fa324[_0xa625('0x38')]=_0x3fa324[_0xa625('0x38')]['length']?_0x3fa324[_0xa625('0x38')]:_0x2d2d54['model'];if(!_0x43bda3['query']['hasOwnProperty'](_0xa625('0x39'))){_0x3fa324[_0xa625('0x1e')]=qs[_0xa625('0x1e')](_0x43bda3[_0xa625('0x36')][_0xa625('0x1e')]);_0x3fa324[_0xa625('0x1d')]=qs[_0xa625('0x1d')](_0x43bda3[_0xa625('0x36')]['offset']);}_0x3fa324[_0xa625('0x3a')]=qs[_0xa625('0x3b')](_0x43bda3[_0xa625('0x36')][_0xa625('0x3b')]);_0x3fa324[_0xa625('0x3c')]=qs[_0xa625('0x34')](_[_0xa625('0x3d')](_0x43bda3[_0xa625('0x36')],_0x2d2d54[_0xa625('0x34')]),_0x243f4c);if(_0x43bda3[_0xa625('0x36')][_0xa625('0x3e')]){_0x3fa324['where']=_['merge'](_0x3fa324[_0xa625('0x3c')],{'$or':_[_0xa625('0x2d')](_0x243f4c,function(_0xd10f32){if(_0xd10f32['type']!==_0xa625('0x3f')){var _0x38cbd6={};_0x38cbd6[_0xd10f32[_0xa625('0x2a')]]={'$like':'%'+_0x43bda3[_0xa625('0x36')][_0xa625('0x3e')]+'%'};return _0x38cbd6;}})});}_0x3fa324=_[_0xa625('0x40')]({},_0x3fa324,_0x43bda3['options']);var _0x330e10={'where':_0x3fa324[_0xa625('0x3c')]};return db['JscriptyProject'][_0xa625('0x1c')](_0x330e10)['then'](function(_0x3c31d1){_0x457f83[_0xa625('0x1c')]=_0x3c31d1;if(_0x43bda3[_0xa625('0x36')][_0xa625('0x41')]){_0x3fa324[_0xa625('0x42')]=[{'all':!![]}];}return db[_0xa625('0x2e')][_0xa625('0x43')](_0x3fa324);})['then'](function(_0x42ccc5){_0x457f83['rows']=_0x42ccc5;return _0x457f83;})[_0xa625('0x24')](respondWithFilteredResult(_0xdd9802,_0x3fa324))[_0xa625('0x44')](handleError(_0xdd9802,null));};exports[_0xa625('0x45')]=function(_0x274ded,_0x1662e3){var _0x22826f={'raw':![],'where':{'id':_0x274ded[_0xa625('0x46')]['id']}},_0xe7291f={};_0xe7291f[_0xa625('0x32')]=_[_0xa625('0x33')](db[_0xa625('0x2e')][_0xa625('0x47')]);_0xe7291f[_0xa625('0x36')]=_[_0xa625('0x33')](_0x274ded[_0xa625('0x36')]);_0xe7291f[_0xa625('0x34')]=_['intersection'](_0xe7291f['model'],_0xe7291f[_0xa625('0x36')]);_0x22826f[_0xa625('0x38')]=_[_0xa625('0x35')](_0xe7291f[_0xa625('0x32')],qs[_0xa625('0x37')](_0x274ded[_0xa625('0x36')][_0xa625('0x37')]));_0x22826f[_0xa625('0x38')]=_0x22826f[_0xa625('0x38')][_0xa625('0x48')]?_0x22826f[_0xa625('0x38')]:_0xe7291f[_0xa625('0x32')];if(_0x274ded[_0xa625('0x36')][_0xa625('0x41')]){_0x22826f['include']=[{'all':!![]}];}_0x22826f=_[_0xa625('0x40')]({},_0x22826f,_0x274ded[_0xa625('0x49')]);return db['JscriptyProject'][_0xa625('0x4a')](_0x22826f)['then'](handleEntityNotFound(_0x1662e3,null))['then'](respondWithResult(_0x1662e3,null))['catch'](handleError(_0x1662e3,null));};exports[_0xa625('0x4b')]=function(_0x52436d,_0x34fb51){return db[_0xa625('0x2e')]['create'](_0x52436d[_0xa625('0x4c')],{})[_0xa625('0x24')](function(_0x2bb2f6){var _0x138368=_0x52436d[_0xa625('0x4d')][_0xa625('0x26')]({'plain':!![]});if(!_0x138368)throw new Error(_0xa625('0x4e'));if(_0x138368[_0xa625('0x4f')]==='user'){var _0x971216=_0x2bb2f6[_0xa625('0x26')]({'plain':!![]});var _0x3aaffd=_0xa625('0x27');return db[_0xa625('0x50')]['find']({'where':{'name':_0x3aaffd,'userProfileId':_0x138368['userProfileId']},'raw':!![]})[_0xa625('0x24')](function(_0x13ef6d){if(_0x13ef6d&&_0x13ef6d[_0xa625('0x51')]===0x0){return db[_0xa625('0x28')][_0xa625('0x4b')]({'name':_0x971216[_0xa625('0x2a')],'resourceId':_0x971216['id'],'type':_0x13ef6d[_0xa625('0x2a')],'sectionId':_0x13ef6d['id']},{})[_0xa625('0x24')](function(){return _0x2bb2f6;});}else{return _0x2bb2f6;}})[_0xa625('0x44')](function(_0x44a5fa){logger[_0xa625('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44a5fa);throw _0x44a5fa;});}return _0x2bb2f6;})[_0xa625('0x24')](respondWithResult(_0x34fb51,0xc9))[_0xa625('0x44')](handleError(_0x34fb51,null));};exports[_0xa625('0x53')]=function(_0x581ff0,_0x834d30){var _0x5ec857={'where':{'id':_0x581ff0[_0xa625('0x46')]['id']}},_0x5ab608={};_0x5ab608[_0xa625('0x32')]=_[_0xa625('0x33')](db[_0xa625('0x2e')][_0xa625('0x47')]);_0x5ec857[_0xa625('0x38')]=_[_0xa625('0x35')](_0x5ab608['model'],qs[_0xa625('0x37')](_0x581ff0[_0xa625('0x36')][_0xa625('0x37')]));_0x5ec857['attributes']=_0x5ec857[_0xa625('0x38')][_0xa625('0x48')]?_0x5ec857[_0xa625('0x38')]:_0x5ab608[_0xa625('0x32')];if(_0x581ff0[_0xa625('0x36')][_0xa625('0x41')]){_0x5ec857[_0xa625('0x42')]=[{'all':!![]}];}_0x5ec857=_[_0xa625('0x40')]({},_0x5ec857,_0x581ff0[_0xa625('0x49')]);return db[_0xa625('0x2e')][_0xa625('0x4a')](_0x5ec857)['then'](handleEntityNotFound(_0x834d30,null))[_0xa625('0x24')](function(_0x4aedf4){if(_0x4aedf4){var _0x516674=_0x4aedf4[_0xa625('0x26')]({'plain':!![]});_0x516674=qs['omit'](_0x516674,['id',_0xa625('0x54'),_0xa625('0x55')]);_0x581ff0[_0xa625('0x4c')]=_[_0xa625('0x56')](_0x581ff0[_0xa625('0x4c')],['id',_0xa625('0x54'),_0xa625('0x55')]);return db[_0xa625('0x2e')][_0xa625('0x4b')](_['merge'](_0x516674,_0x581ff0[_0xa625('0x4c')]),{'include':_0x581ff0[_0xa625('0x36')][_0xa625('0x41')]?[{'all':!![]}]:undefined})[_0xa625('0x24')](function(_0x38846b){var _0x120a9e=_0x581ff0[_0xa625('0x4d')][_0xa625('0x26')]({'plain':!![]});if(!_0x120a9e)throw new Error(_0xa625('0x4e'));if(_0x120a9e['role']==='user'){var _0x2e06e4=_0x38846b[_0xa625('0x26')]({'plain':!![]});var _0xaea576='Projects';return db[_0xa625('0x50')][_0xa625('0x4a')]({'where':{'name':_0xaea576,'userProfileId':_0x120a9e['userProfileId']},'raw':!![]})['then'](function(_0x4cb4f8){if(_0x4cb4f8&&_0x4cb4f8[_0xa625('0x51')]===0x0){return db['UserProfileResource'][_0xa625('0x4b')]({'name':_0x2e06e4[_0xa625('0x2a')],'resourceId':_0x2e06e4['id'],'type':_0x4cb4f8['name'],'sectionId':_0x4cb4f8['id']},{})[_0xa625('0x24')](function(){return _0x38846b;});}else{return _0x38846b;}})[_0xa625('0x44')](function(_0x1be6a0){logger[_0xa625('0x52')](_0xa625('0x57'),_0x1be6a0);throw _0x1be6a0;});}return _0x38846b;});}})[_0xa625('0x24')](respondWithResult(_0x834d30,0xc9))[_0xa625('0x44')](handleError(_0x834d30,null));};exports[_0xa625('0x23')]=function(_0x57fcb6,_0x209d96){if(_0x57fcb6['body']['id']){delete _0x57fcb6[_0xa625('0x4c')]['id'];}return db[_0xa625('0x2e')][_0xa625('0x4a')]({'where':{'id':_0x57fcb6[_0xa625('0x46')]['id']}})[_0xa625('0x24')](handleEntityNotFound(_0x209d96,null))['then'](saveUpdates(_0x57fcb6[_0xa625('0x4c')],null))[_0xa625('0x24')](respondWithResult(_0x209d96,null))[_0xa625('0x44')](handleError(_0x209d96,null));};exports[_0xa625('0x25')]=function(_0x1a2969,_0x2e2550){return db[_0xa625('0x2e')][_0xa625('0x4a')]({'where':{'id':_0x1a2969[_0xa625('0x46')]['id']}})[_0xa625('0x24')](handleEntityNotFound(_0x2e2550,null))[_0xa625('0x24')](removeEntity(_0x2e2550,null))[_0xa625('0x44')](handleError(_0x2e2550,null));};exports[_0xa625('0x58')]=function(_0x394f55,_0x17f46a,_0xe0cccb){var _0xec3a3d={'raw':!![],'where':{}};var _0x1221a5={};var _0x1cd4c1={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x394f55[_0xa625('0x46')]['id']}})[_0xa625('0x24')](handleEntityNotFound(_0x17f46a,null))['then'](function(_0x503bc3){if(_0x503bc3){_0x1221a5['model']=_['keys'](db[_0xa625('0x59')][_0xa625('0x47')]);_0x1221a5[_0xa625('0x36')]=_[_0xa625('0x33')](_0x394f55[_0xa625('0x36')]);_0x1221a5[_0xa625('0x34')]=_[_0xa625('0x35')](_0x1221a5['model'],_0x1221a5[_0xa625('0x36')]);_0xec3a3d[_0xa625('0x38')]=_[_0xa625('0x35')](_0x1221a5[_0xa625('0x32')],qs[_0xa625('0x37')](_0x394f55[_0xa625('0x36')][_0xa625('0x37')]));_0xec3a3d['attributes']=_0xec3a3d['attributes'][_0xa625('0x48')]?_0xec3a3d[_0xa625('0x38')]:_0x1221a5[_0xa625('0x32')];if(!_0x394f55['query'][_0xa625('0x5a')](_0xa625('0x39'))){_0xec3a3d[_0xa625('0x1e')]=qs[_0xa625('0x1e')](_0x394f55[_0xa625('0x36')][_0xa625('0x1e')]);_0xec3a3d[_0xa625('0x1d')]=qs[_0xa625('0x1d')](_0x394f55['query'][_0xa625('0x1d')]);}_0xec3a3d['order']=qs[_0xa625('0x3b')](_0x394f55['query'][_0xa625('0x3b')]);_0xec3a3d[_0xa625('0x3c')]=qs['filters'](_[_0xa625('0x3d')](_0x394f55[_0xa625('0x36')],_0x1221a5[_0xa625('0x34')]));_0xec3a3d[_0xa625('0x3c')]['ProjectId']=_0x503bc3['id'];if(_0x394f55[_0xa625('0x36')][_0xa625('0x3e')]){_0xec3a3d[_0xa625('0x3c')]=_[_0xa625('0x40')](_0xec3a3d[_0xa625('0x3c')],{'$or':_[_0xa625('0x2d')](_0xec3a3d[_0xa625('0x38')],function(_0xf7d3b3){var _0x1e73e6={};_0x1e73e6[_0xf7d3b3]={'$like':'%'+_0x394f55['query'][_0xa625('0x3e')]+'%'};return _0x1e73e6;})});}_0xec3a3d=_[_0xa625('0x40')]({},_0xec3a3d,_0x394f55[_0xa625('0x49')]);return db[_0xa625('0x59')][_0xa625('0x1c')]({'where':_0xec3a3d[_0xa625('0x3c')]})[_0xa625('0x24')](function(_0x1eb507){_0x1cd4c1[_0xa625('0x1c')]=_0x1eb507;if(_0x394f55['query'][_0xa625('0x41')]){_0xec3a3d['include']=[{'all':!![]}];}return db[_0xa625('0x59')]['findAll'](_0xec3a3d);})[_0xa625('0x24')](function(_0x3db16c){_0x1cd4c1[_0xa625('0x5b')]=_0x3db16c;return _0x1cd4c1;});}})[_0xa625('0x24')](respondWithFilteredResult(_0x17f46a,_0xec3a3d))[_0xa625('0x44')](handleError(_0x17f46a,null));};exports[_0xa625('0x5c')]=function(_0x5ef1be,_0xb7de37,_0x797875){var _0x42291a={'raw':!![],'where':{}};var _0x309902={};var _0x407196={'count':0x0,'rows':[]};return db[_0xa625('0x2e')][_0xa625('0x5d')]({'where':{'id':_0x5ef1be[_0xa625('0x46')]['id']}})['then'](handleEntityNotFound(_0xb7de37,null))['then'](function(_0x5bc6a4){if(_0x5bc6a4){_0x309902[_0xa625('0x32')]=_[_0xa625('0x33')](db[_0xa625('0x5e')]['rawAttributes']);_0x309902[_0xa625('0x36')]=_['keys'](_0x5ef1be[_0xa625('0x36')]);_0x309902[_0xa625('0x34')]=_[_0xa625('0x35')](_0x309902['model'],_0x309902[_0xa625('0x36')]);_0x42291a[_0xa625('0x38')]=_[_0xa625('0x35')](_0x309902[_0xa625('0x32')],qs[_0xa625('0x37')](_0x5ef1be[_0xa625('0x36')]['fields']));_0x42291a[_0xa625('0x38')]=_0x42291a[_0xa625('0x38')][_0xa625('0x48')]?_0x42291a[_0xa625('0x38')]:_0x309902[_0xa625('0x32')];if(!_0x5ef1be[_0xa625('0x36')][_0xa625('0x5a')](_0xa625('0x39'))){_0x42291a[_0xa625('0x1e')]=qs[_0xa625('0x1e')](_0x5ef1be[_0xa625('0x36')][_0xa625('0x1e')]);_0x42291a[_0xa625('0x1d')]=qs[_0xa625('0x1d')](_0x5ef1be['query'][_0xa625('0x1d')]);}_0x42291a[_0xa625('0x3a')]=qs[_0xa625('0x3b')](_0x5ef1be[_0xa625('0x36')]['sort']);_0x42291a[_0xa625('0x3c')]=qs[_0xa625('0x34')](_[_0xa625('0x3d')](_0x5ef1be[_0xa625('0x36')],_0x309902[_0xa625('0x34')]));_0x42291a['where'][_0xa625('0x5f')]=_0x5bc6a4['id'];if(_0x5ef1be['query'][_0xa625('0x3e')]){_0x42291a[_0xa625('0x3c')]=_[_0xa625('0x40')](_0x42291a[_0xa625('0x3c')],{'$or':_[_0xa625('0x2d')](_0x42291a[_0xa625('0x38')],function(_0x2b34e6){var _0x3623b3={};_0x3623b3[_0x2b34e6]={'$like':'%'+_0x5ef1be[_0xa625('0x36')][_0xa625('0x3e')]+'%'};return _0x3623b3;})});}_0x42291a=_[_0xa625('0x40')]({},_0x42291a,_0x5ef1be['options']);return db[_0xa625('0x5e')][_0xa625('0x1c')]({'where':_0x42291a[_0xa625('0x3c')]})[_0xa625('0x24')](function(_0x281e23){_0x407196[_0xa625('0x1c')]=_0x281e23;if(_0x5ef1be['query']['includeAll']){_0x42291a[_0xa625('0x42')]=[{'all':!![]}];}return db[_0xa625('0x5e')][_0xa625('0x43')](_0x42291a);})['then'](function(_0x446ea1){_0x407196['rows']=_0x446ea1;return _0x407196;});}})[_0xa625('0x24')](respondWithFilteredResult(_0xb7de37,_0x42291a))[_0xa625('0x44')](handleError(_0xb7de37,null));};function char(_0x3e0587){return _0xa625('0x60')===typeof _0x3e0587?String['fromCharCode'][_0xa625('0x61')](null,arguments):_0x3e0587;}function needsEncapsulation(_0x229c93){return!!_0x229c93&&(_0x229c93[_0xa625('0x62')]()[_0xa625('0x63')](char(0xd))>=0x0||_0x229c93['toString']()[_0xa625('0x63')](char(0xa))>=0x0||_0x229c93[_0xa625('0x62')]()[_0xa625('0x63')](char(0x2c))>=0x0||_0x229c93[_0xa625('0x62')]()[_0xa625('0x63')](char(0x22))>=0x0);}function encapsulate(_0x356786){var _0x59ffa7=char(0x22),_0x4ab32c='\x5c'+char(0x22),_0x10bd3a=_0x356786[_0xa625('0x62')]()[_0xa625('0x64')](new RegExp(_0x59ffa7,'g'),_0x4ab32c);return _0x59ffa7+_0x10bd3a+_0x59ffa7;}exports[_0xa625('0x65')]=function(_0x349f36,_0x756b23,_0x58ba96){var _0x487208,_0x5eca59;var _0x58087e={'where':{'ProjectId':_0x349f36[_0xa625('0x46')]['id']}};if(_0x349f36['query'][_0xa625('0x66')]){_0x58087e[_0xa625('0x3c')][_0xa625('0x67')]=JSON[_0xa625('0x68')](_0x349f36[_0xa625('0x36')][_0xa625('0x66')]);}return db[_0xa625('0x59')][_0xa625('0x43')](_0x58087e)['then'](handleEntityNotFound(_0x756b23,null))['then'](function(_0x2e5567){if(_0x2e5567){_0x487208=_0x2e5567;return db[_0xa625('0x69')][_0xa625('0x43')]({'where':{'SessionId':{'$in':_[_0xa625('0x2d')](_0x487208,'id')},'ProjectId':_0x349f36[_0xa625('0x46')]['id']},'order':_0xa625('0x6a')});}})[_0xa625('0x24')](handleEntityNotFound(_0x756b23,null))[_0xa625('0x24')](function(_0x4cc1ee){if(_0x4cc1ee){_0x5eca59=_0x4cc1ee;var _0x4a1415={};for(var _0xbf750b=0x0,_0x3ca9b6=_0x5eca59[_0xa625('0x48')];_0xbf750b<_0x3ca9b6;_0xbf750b++){if(!_0x4a1415['hasOwnProperty'](_0x5eca59[_0xbf750b][_0xa625('0x6b')])){_0x4a1415[_0x5eca59[_0xbf750b][_0xa625('0x6b')]]=needsEncapsulation(_0x5eca59[_0xbf750b][_0xa625('0x6c')])?encapsulate(_0x5eca59[_0xbf750b][_0xa625('0x6c')]):_0x5eca59[_0xbf750b][_0xa625('0x6c')];}}var _0x10b819=[],_0x4a6a98={};for(var _0x4c62e4=0x0,_0x52b4f8=_0x487208[_0xa625('0x48')];_0x4c62e4<_0x52b4f8;_0x4c62e4++){_0x4a6a98={'ProjectId':_0x349f36['params']['id'],'SessionId':_0x487208[_0x4c62e4]['id'],'StartTime':moment(_0x487208[_0x4c62e4][_0xa625('0x67')])[_0xa625('0x6d')](_0xa625('0x6e'))};for(var _0xa48c03=0x0,_0x381895=_0x5eca59[_0xa625('0x48')];_0xa48c03<_0x381895;_0xa48c03++){if(_0x5eca59[_0xa48c03][_0xa625('0x6f')]==_0x487208[_0x4c62e4]['id']&&_0x4a1415[_0xa625('0x5a')](_0x5eca59[_0xa48c03][_0xa625('0x6b')])){_0x4a6a98[_0x4a1415[_0x5eca59[_0xa48c03][_0xa625('0x6b')]]]=_0x5eca59[_0xa48c03]['answer'];}}for(var _0x7cd90a in _0x4a1415){if(!_0x4a6a98[_0xa625('0x5a')](_0x4a1415[_0x7cd90a])){_0x4a6a98[_0x4a1415[_0x7cd90a]]=null;}}_0x10b819[_0xa625('0x70')](_0x4a6a98);}return _0x10b819;}})[_0xa625('0x24')](function(_0x2635d8){if(!_['isEmpty'](_0x2635d8)){var _0x1f30e0=toCsv(_0x2635d8);var _0x4e8907=Date[_0xa625('0x71')]();fs[_0xa625('0x72')](util[_0xa625('0x6d')](_0xa625('0x73'),_0x349f36[_0xa625('0x46')]['id'],_0x4e8907),_0x1f30e0);_0x756b23[_0xa625('0x74')](_0xa625('0x75'),_0xa625('0x76')+util[_0xa625('0x6d')](_0xa625('0x77'),_0x349f36[_0xa625('0x46')]['id'],_0x4e8907));_0x756b23[_0xa625('0x74')](_0xa625('0x78'),_0xa625('0x79'));return _0x756b23['download'](util[_0xa625('0x6d')](_0xa625('0x73'),_0x349f36[_0xa625('0x46')]['id'],_0x4e8907));}else{return _0x756b23[_0xa625('0x29')](0xcc);}})['catch'](handleError(_0x756b23,null));}; \ No newline at end of file +var _0x08f7=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','update','destroy','then','get','Projects','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','merge','options','include','findAll','rows','show','includeAll','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','clone','createdAt','updatedAt','UserProfileResource','catch','params','findOne','JscriptySessionReport','filter','getAnswers','nolimit','pick','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','starttime','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis'];(function(_0xddbe56,_0xb5d9ae){var _0x4c692a=function(_0x81508d){while(--_0x81508d){_0xddbe56['push'](_0xddbe56['shift']());}};_0x4c692a(++_0xb5d9ae);}(_0x08f7,0xd7));var _0x708f=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0x08f7[_0x2f48cd];return _0x193ae2;};'use strict';var pdf=require(_0x708f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x708f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x708f('0x2'));var rp=require(_0x708f('0x3'));var moment=require(_0x708f('0x4'));var BPromise=require(_0x708f('0x5'));var Mustache=require('mustache');var util=require(_0x708f('0x6'));var path=require(_0x708f('0x7'));var sox=require(_0x708f('0x8'));var csv=require(_0x708f('0x9'));var ejs=require(_0x708f('0xa'));var fs=require('fs');var _=require(_0x708f('0xb'));var squel=require(_0x708f('0xc'));var crypto=require(_0x708f('0xd'));var jsforce=require(_0x708f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x708f('0x9'));var querystring=require(_0x708f('0xf'));var Papa=require('papaparse');var Redis=require(_0x708f('0x10'));var authService=require(_0x708f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x708f('0x12'));var hardwareService=require(_0x708f('0x13'));var logger=require(_0x708f('0x14'))(_0x708f('0x15'));var utils=require('../../config/utils');var config=require(_0x708f('0x16'));var licenseUtil=require(_0x708f('0x17'));var db=require(_0x708f('0x18'))['db'];function respondWithStatusCode(_0x6b5bd3,_0x75e204){_0x75e204=_0x75e204||0xcc;return function(_0x4291c5){if(_0x4291c5){return _0x6b5bd3[_0x708f('0x19')](_0x75e204);}return _0x6b5bd3[_0x708f('0x1a')](_0x75e204)[_0x708f('0x1b')]();};}function respondWithResult(_0x4b3913,_0x39842d){_0x39842d=_0x39842d||0xc8;return function(_0x4d039f){if(_0x4d039f){return _0x4b3913['status'](_0x39842d)['json'](_0x4d039f);}};}function respondWithFilteredResult(_0x261af7,_0x20d168){return function(_0x1dadb8){if(_0x1dadb8){var _0x30dfdc=_0x1dadb8[_0x708f('0x1c')],_0x5a7ea1=_0x20d168['offset'],_0x3d5c8c=_0x20d168[_0x708f('0x1d')]+_0x20d168['limit'],_0x5699f2;if(_0x3d5c8c>=_0x30dfdc){_0x3d5c8c=_0x30dfdc;_0x5699f2=0xc8;}else{_0x5699f2=0xce;}_0x261af7[_0x708f('0x1a')](_0x5699f2);return _0x261af7[_0x708f('0x1e')](_0x708f('0x1f'),_0x5a7ea1+'-'+_0x3d5c8c+'/'+_0x30dfdc)[_0x708f('0x20')](_0x1dadb8);}return null;};}function patchUpdates(_0x54cc45){return function(_0x454471){try{jsonpatch[_0x708f('0x21')](_0x454471,_0x54cc45,!![]);}catch(_0x1b2d36){return BPromise[_0x708f('0x22')](_0x1b2d36);}return _0x454471['save']();};}function saveUpdates(_0x2f3700,_0x838707){return function(_0x4a92a5){if(_0x4a92a5){return _0x4a92a5[_0x708f('0x23')](_0x2f3700)['then'](function(_0x28199b){return _0x28199b;});}return null;};}function removeEntity(_0xda1c0f,_0x976d9){return function(_0x4d1394){if(_0x4d1394){return _0x4d1394[_0x708f('0x24')]()[_0x708f('0x25')](function(){var _0x6457f9=_0x4d1394[_0x708f('0x26')]({'plain':!![]});var _0x58d625=_0x708f('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x58d625,'resourceId':_0x6457f9['id']}})[_0x708f('0x25')](function(){return _0x4d1394;});})[_0x708f('0x25')](function(){_0xda1c0f[_0x708f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58f534,_0x2fa0c0){return function(_0x2c7f91){if(!_0x2c7f91){_0x58f534[_0x708f('0x19')](0x194);}return _0x2c7f91;};}function handleError(_0x24fafc,_0x24e68f){_0x24e68f=_0x24e68f||0x1f4;return function(_0x3d7e8e){logger['error'](_0x3d7e8e[_0x708f('0x28')]);if(_0x3d7e8e[_0x708f('0x29')]){delete _0x3d7e8e['name'];}_0x24fafc[_0x708f('0x1a')](_0x24e68f)[_0x708f('0x2a')](_0x3d7e8e);};}exports[_0x708f('0x2b')]=function(_0x1be19e,_0x1d1521){var _0x53dfa5={},_0x45d5f3={},_0x34934b={'count':0x0,'rows':[]};var _0x41e2ac=_['map'](db[_0x708f('0x2c')][_0x708f('0x2d')],function(_0x5df69f){return{'name':_0x5df69f[_0x708f('0x2e')],'type':_0x5df69f[_0x708f('0x2f')]['key']};});_0x45d5f3[_0x708f('0x30')]=_[_0x708f('0x31')](_0x41e2ac,_0x708f('0x29'));_0x45d5f3[_0x708f('0x32')]=_[_0x708f('0x33')](_0x1be19e['query']);_0x45d5f3[_0x708f('0x34')]=_[_0x708f('0x35')](_0x45d5f3[_0x708f('0x30')],_0x45d5f3[_0x708f('0x32')]);_0x53dfa5[_0x708f('0x36')]=_[_0x708f('0x35')](_0x45d5f3[_0x708f('0x30')],qs[_0x708f('0x37')](_0x1be19e[_0x708f('0x32')]['fields']));_0x53dfa5[_0x708f('0x36')]=_0x53dfa5[_0x708f('0x36')][_0x708f('0x38')]?_0x53dfa5[_0x708f('0x36')]:_0x45d5f3[_0x708f('0x30')];if(!_0x1be19e[_0x708f('0x32')][_0x708f('0x39')]('nolimit')){_0x53dfa5[_0x708f('0x3a')]=qs[_0x708f('0x3a')](_0x1be19e[_0x708f('0x32')][_0x708f('0x3a')]);_0x53dfa5[_0x708f('0x1d')]=qs[_0x708f('0x1d')](_0x1be19e[_0x708f('0x32')][_0x708f('0x1d')]);}_0x53dfa5[_0x708f('0x3b')]=qs[_0x708f('0x3c')](_0x1be19e[_0x708f('0x32')][_0x708f('0x3c')]);_0x53dfa5[_0x708f('0x3d')]=qs['filters'](_['pick'](_0x1be19e[_0x708f('0x32')],_0x45d5f3[_0x708f('0x34')]),_0x41e2ac);if(_0x1be19e[_0x708f('0x32')]['filter']){_0x53dfa5[_0x708f('0x3d')]=_[_0x708f('0x3e')](_0x53dfa5[_0x708f('0x3d')],{'$or':_[_0x708f('0x31')](_0x41e2ac,function(_0x5069b0){if(_0x5069b0['type']!=='VIRTUAL'){var _0xddbeff={};_0xddbeff[_0x5069b0[_0x708f('0x29')]]={'$like':'%'+_0x1be19e[_0x708f('0x32')]['filter']+'%'};return _0xddbeff;}})});}_0x53dfa5=_[_0x708f('0x3e')]({},_0x53dfa5,_0x1be19e[_0x708f('0x3f')]);var _0x147f7f={'where':_0x53dfa5[_0x708f('0x3d')]};return db[_0x708f('0x2c')]['count'](_0x147f7f)[_0x708f('0x25')](function(_0x1c769f){_0x34934b[_0x708f('0x1c')]=_0x1c769f;if(_0x1be19e['query']['includeAll']){_0x53dfa5[_0x708f('0x40')]=[{'all':!![]}];}return db[_0x708f('0x2c')][_0x708f('0x41')](_0x53dfa5);})[_0x708f('0x25')](function(_0x4c9fb0){_0x34934b[_0x708f('0x42')]=_0x4c9fb0;return _0x34934b;})[_0x708f('0x25')](respondWithFilteredResult(_0x1d1521,_0x53dfa5))['catch'](handleError(_0x1d1521,null));};exports[_0x708f('0x43')]=function(_0x56a8a5,_0x2babb9){var _0x668331={'raw':![],'where':{'id':_0x56a8a5['params']['id']}},_0x5d77a8={};_0x5d77a8[_0x708f('0x30')]=_[_0x708f('0x33')](db[_0x708f('0x2c')][_0x708f('0x2d')]);_0x5d77a8[_0x708f('0x32')]=_['keys'](_0x56a8a5['query']);_0x5d77a8[_0x708f('0x34')]=_[_0x708f('0x35')](_0x5d77a8[_0x708f('0x30')],_0x5d77a8['query']);_0x668331[_0x708f('0x36')]=_[_0x708f('0x35')](_0x5d77a8[_0x708f('0x30')],qs[_0x708f('0x37')](_0x56a8a5[_0x708f('0x32')][_0x708f('0x37')]));_0x668331[_0x708f('0x36')]=_0x668331[_0x708f('0x36')]['length']?_0x668331[_0x708f('0x36')]:_0x5d77a8['model'];if(_0x56a8a5['query'][_0x708f('0x44')]){_0x668331[_0x708f('0x40')]=[{'all':!![]}];}_0x668331=_['merge']({},_0x668331,_0x56a8a5[_0x708f('0x3f')]);return db['JscriptyProject'][_0x708f('0x45')](_0x668331)[_0x708f('0x25')](handleEntityNotFound(_0x2babb9,null))[_0x708f('0x25')](respondWithResult(_0x2babb9,null))['catch'](handleError(_0x2babb9,null));};exports[_0x708f('0x46')]=function(_0x47017e,_0x2a3559){return db['JscriptyProject'][_0x708f('0x46')](_0x47017e[_0x708f('0x47')],{})['then'](function(_0x173fac){var _0x37b4fa=_0x47017e[_0x708f('0x48')][_0x708f('0x26')]({'plain':!![]});if(!_0x37b4fa)throw new Error(_0x708f('0x49'));if(_0x37b4fa[_0x708f('0x4a')]===_0x708f('0x48')){var _0x166ff0=_0x173fac[_0x708f('0x26')]({'plain':!![]});var _0x4e0d33=_0x708f('0x27');return db[_0x708f('0x4b')][_0x708f('0x45')]({'where':{'name':_0x4e0d33,'userProfileId':_0x37b4fa[_0x708f('0x4c')]},'raw':!![]})[_0x708f('0x25')](function(_0x1807e7){if(_0x1807e7&&_0x1807e7[_0x708f('0x4d')]===0x0){return db['UserProfileResource'][_0x708f('0x46')]({'name':_0x166ff0[_0x708f('0x29')],'resourceId':_0x166ff0['id'],'type':_0x1807e7[_0x708f('0x29')],'sectionId':_0x1807e7['id']},{})[_0x708f('0x25')](function(){return _0x173fac;});}else{return _0x173fac;}})['catch'](function(_0x2756d5){logger[_0x708f('0x4e')](_0x708f('0x4f'),_0x2756d5);throw _0x2756d5;});}return _0x173fac;})[_0x708f('0x25')](respondWithResult(_0x2a3559,0xc9))['catch'](handleError(_0x2a3559,null));};exports[_0x708f('0x50')]=function(_0x23c909,_0xf6d3de){var _0x411fb1={'where':{'id':_0x23c909['params']['id']}},_0x50194c={};_0x50194c[_0x708f('0x30')]=_[_0x708f('0x33')](db[_0x708f('0x2c')][_0x708f('0x2d')]);_0x411fb1['attributes']=_[_0x708f('0x35')](_0x50194c['model'],qs[_0x708f('0x37')](_0x23c909[_0x708f('0x32')][_0x708f('0x37')]));_0x411fb1[_0x708f('0x36')]=_0x411fb1['attributes']['length']?_0x411fb1[_0x708f('0x36')]:_0x50194c[_0x708f('0x30')];if(_0x23c909[_0x708f('0x32')][_0x708f('0x44')]){_0x411fb1[_0x708f('0x40')]=[{'all':!![]}];}_0x411fb1=_[_0x708f('0x3e')]({},_0x411fb1,_0x23c909['options']);return db['JscriptyProject'][_0x708f('0x45')](_0x411fb1)[_0x708f('0x25')](handleEntityNotFound(_0xf6d3de,null))[_0x708f('0x25')](function(_0x4d61a8){if(_0x4d61a8){var _0x5ebb00=_0x4d61a8[_0x708f('0x26')]({'plain':!![]});_0x5ebb00=qs['omit'](_0x5ebb00,['id',_0x708f('0x51'),'updatedAt']);_0x23c909['body']=_['omit'](_0x23c909[_0x708f('0x47')],['id','createdAt',_0x708f('0x52')]);return db[_0x708f('0x2c')][_0x708f('0x46')](_[_0x708f('0x3e')](_0x5ebb00,_0x23c909[_0x708f('0x47')]),{'include':_0x23c909[_0x708f('0x32')][_0x708f('0x44')]?[{'all':!![]}]:undefined})[_0x708f('0x25')](function(_0x23fd03){var _0xeb3963=_0x23c909['user'][_0x708f('0x26')]({'plain':!![]});if(!_0xeb3963)throw new Error(_0x708f('0x49'));if(_0xeb3963[_0x708f('0x4a')]===_0x708f('0x48')){var _0x341fa0=_0x23fd03['get']({'plain':!![]});var _0x29ae59='Projects';return db['UserProfileSection'][_0x708f('0x45')]({'where':{'name':_0x29ae59,'userProfileId':_0xeb3963['userProfileId']},'raw':!![]})[_0x708f('0x25')](function(_0x4302bf){if(_0x4302bf&&_0x4302bf[_0x708f('0x4d')]===0x0){return db[_0x708f('0x53')][_0x708f('0x46')]({'name':_0x341fa0['name'],'resourceId':_0x341fa0['id'],'type':_0x4302bf[_0x708f('0x29')],'sectionId':_0x4302bf['id']},{})[_0x708f('0x25')](function(){return _0x23fd03;});}else{return _0x23fd03;}})[_0x708f('0x54')](function(_0x1a7522){logger[_0x708f('0x4e')](_0x708f('0x4f'),_0x1a7522);throw _0x1a7522;});}return _0x23fd03;});}})['then'](respondWithResult(_0xf6d3de,0xc9))['catch'](handleError(_0xf6d3de,null));};exports['update']=function(_0x428a47,_0x3a75c8){if(_0x428a47[_0x708f('0x47')]['id']){delete _0x428a47['body']['id'];}return db[_0x708f('0x2c')][_0x708f('0x45')]({'where':{'id':_0x428a47[_0x708f('0x55')]['id']}})['then'](handleEntityNotFound(_0x3a75c8,null))[_0x708f('0x25')](saveUpdates(_0x428a47['body'],null))['then'](respondWithResult(_0x3a75c8,null))['catch'](handleError(_0x3a75c8,null));};exports[_0x708f('0x24')]=function(_0x2afc5c,_0x39a102){return db[_0x708f('0x2c')][_0x708f('0x45')]({'where':{'id':_0x2afc5c[_0x708f('0x55')]['id']}})[_0x708f('0x25')](handleEntityNotFound(_0x39a102,null))[_0x708f('0x25')](removeEntity(_0x39a102,null))[_0x708f('0x54')](handleError(_0x39a102,null));};exports['getSessions']=function(_0x405226,_0x3782f4,_0xfa1e3a){var _0x5c7cca={'raw':!![],'where':{}};var _0xac8ea6={};var _0x269347={'count':0x0,'rows':[]};return db[_0x708f('0x2c')][_0x708f('0x56')]({'where':{'id':_0x405226[_0x708f('0x55')]['id']}})['then'](handleEntityNotFound(_0x3782f4,null))[_0x708f('0x25')](function(_0x447855){if(_0x447855){_0xac8ea6[_0x708f('0x30')]=_[_0x708f('0x33')](db[_0x708f('0x57')][_0x708f('0x2d')]);_0xac8ea6[_0x708f('0x32')]=_['keys'](_0x405226[_0x708f('0x32')]);_0xac8ea6[_0x708f('0x34')]=_['intersection'](_0xac8ea6[_0x708f('0x30')],_0xac8ea6[_0x708f('0x32')]);_0x5c7cca[_0x708f('0x36')]=_[_0x708f('0x35')](_0xac8ea6[_0x708f('0x30')],qs['fields'](_0x405226[_0x708f('0x32')][_0x708f('0x37')]));_0x5c7cca[_0x708f('0x36')]=_0x5c7cca[_0x708f('0x36')][_0x708f('0x38')]?_0x5c7cca[_0x708f('0x36')]:_0xac8ea6['model'];if(!_0x405226[_0x708f('0x32')][_0x708f('0x39')]('nolimit')){_0x5c7cca[_0x708f('0x3a')]=qs['limit'](_0x405226[_0x708f('0x32')][_0x708f('0x3a')]);_0x5c7cca[_0x708f('0x1d')]=qs[_0x708f('0x1d')](_0x405226[_0x708f('0x32')][_0x708f('0x1d')]);}_0x5c7cca[_0x708f('0x3b')]=qs[_0x708f('0x3c')](_0x405226[_0x708f('0x32')][_0x708f('0x3c')]);_0x5c7cca[_0x708f('0x3d')]=qs[_0x708f('0x34')](_['pick'](_0x405226[_0x708f('0x32')],_0xac8ea6[_0x708f('0x34')]));_0x5c7cca[_0x708f('0x3d')]['ProjectId']=_0x447855['id'];if(_0x405226['query']['filter']){_0x5c7cca[_0x708f('0x3d')]=_[_0x708f('0x3e')](_0x5c7cca[_0x708f('0x3d')],{'$or':_[_0x708f('0x31')](_0x5c7cca[_0x708f('0x36')],function(_0x51f7bb){var _0x3a3330={};_0x3a3330[_0x51f7bb]={'$like':'%'+_0x405226[_0x708f('0x32')][_0x708f('0x58')]+'%'};return _0x3a3330;})});}_0x5c7cca=_[_0x708f('0x3e')]({},_0x5c7cca,_0x405226[_0x708f('0x3f')]);return db[_0x708f('0x57')]['count']({'where':_0x5c7cca[_0x708f('0x3d')]})[_0x708f('0x25')](function(_0x59b38e){_0x269347['count']=_0x59b38e;if(_0x405226[_0x708f('0x32')]['includeAll']){_0x5c7cca[_0x708f('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x708f('0x41')](_0x5c7cca);})[_0x708f('0x25')](function(_0x5f3c72){_0x269347[_0x708f('0x42')]=_0x5f3c72;return _0x269347;});}})[_0x708f('0x25')](respondWithFilteredResult(_0x3782f4,_0x5c7cca))[_0x708f('0x54')](handleError(_0x3782f4,null));};exports[_0x708f('0x59')]=function(_0x4d87ee,_0x1102b5,_0x3008bb){var _0x1e6c0a={'raw':!![],'where':{}};var _0x401c30={};var _0x359c5f={'count':0x0,'rows':[]};return db[_0x708f('0x2c')][_0x708f('0x56')]({'where':{'id':_0x4d87ee['params']['id']}})[_0x708f('0x25')](handleEntityNotFound(_0x1102b5,null))[_0x708f('0x25')](function(_0x12debf){if(_0x12debf){_0x401c30['model']=_['keys'](db['JscriptyAnswerReport'][_0x708f('0x2d')]);_0x401c30['query']=_[_0x708f('0x33')](_0x4d87ee['query']);_0x401c30[_0x708f('0x34')]=_[_0x708f('0x35')](_0x401c30['model'],_0x401c30[_0x708f('0x32')]);_0x1e6c0a['attributes']=_[_0x708f('0x35')](_0x401c30['model'],qs[_0x708f('0x37')](_0x4d87ee[_0x708f('0x32')][_0x708f('0x37')]));_0x1e6c0a[_0x708f('0x36')]=_0x1e6c0a['attributes'][_0x708f('0x38')]?_0x1e6c0a[_0x708f('0x36')]:_0x401c30['model'];if(!_0x4d87ee[_0x708f('0x32')]['hasOwnProperty'](_0x708f('0x5a'))){_0x1e6c0a[_0x708f('0x3a')]=qs[_0x708f('0x3a')](_0x4d87ee[_0x708f('0x32')][_0x708f('0x3a')]);_0x1e6c0a[_0x708f('0x1d')]=qs[_0x708f('0x1d')](_0x4d87ee['query'][_0x708f('0x1d')]);}_0x1e6c0a[_0x708f('0x3b')]=qs[_0x708f('0x3c')](_0x4d87ee[_0x708f('0x32')][_0x708f('0x3c')]);_0x1e6c0a[_0x708f('0x3d')]=qs[_0x708f('0x34')](_[_0x708f('0x5b')](_0x4d87ee[_0x708f('0x32')],_0x401c30[_0x708f('0x34')]));_0x1e6c0a[_0x708f('0x3d')]['ProjectId']=_0x12debf['id'];if(_0x4d87ee[_0x708f('0x32')][_0x708f('0x58')]){_0x1e6c0a[_0x708f('0x3d')]=_[_0x708f('0x3e')](_0x1e6c0a[_0x708f('0x3d')],{'$or':_[_0x708f('0x31')](_0x1e6c0a[_0x708f('0x36')],function(_0x3c90a1){var _0x214b27={};_0x214b27[_0x3c90a1]={'$like':'%'+_0x4d87ee[_0x708f('0x32')]['filter']+'%'};return _0x214b27;})});}_0x1e6c0a=_[_0x708f('0x3e')]({},_0x1e6c0a,_0x4d87ee[_0x708f('0x3f')]);return db['JscriptyAnswerReport'][_0x708f('0x1c')]({'where':_0x1e6c0a[_0x708f('0x3d')]})['then'](function(_0x5acd80){_0x359c5f[_0x708f('0x1c')]=_0x5acd80;if(_0x4d87ee[_0x708f('0x32')][_0x708f('0x44')]){_0x1e6c0a[_0x708f('0x40')]=[{'all':!![]}];}return db[_0x708f('0x5c')][_0x708f('0x41')](_0x1e6c0a);})['then'](function(_0x258741){_0x359c5f[_0x708f('0x42')]=_0x258741;return _0x359c5f;});}})[_0x708f('0x25')](respondWithFilteredResult(_0x1102b5,_0x1e6c0a))[_0x708f('0x54')](handleError(_0x1102b5,null));};function char(_0x1b2598){return _0x708f('0x5d')===typeof _0x1b2598?String['fromCharCode'][_0x708f('0x21')](null,arguments):_0x1b2598;}function needsEncapsulation(_0x3f3ff2){return!!_0x3f3ff2&&(_0x3f3ff2[_0x708f('0x5e')]()[_0x708f('0x5f')](char(0xd))>=0x0||_0x3f3ff2[_0x708f('0x5e')]()[_0x708f('0x5f')](char(0xa))>=0x0||_0x3f3ff2['toString']()[_0x708f('0x5f')](char(0x2c))>=0x0||_0x3f3ff2[_0x708f('0x5e')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x6a549c){var _0x551027=char(0x22),_0x423b17='\x5c'+char(0x22),_0x452edd=_0x6a549c[_0x708f('0x5e')]()[_0x708f('0x60')](new RegExp(_0x551027,'g'),_0x423b17);return _0x551027+_0x452edd+_0x551027;}exports[_0x708f('0x61')]=function(_0x21206f,_0x3a168a,_0x213d70){var _0x1bf4c0,_0xe67ef7;var _0x122f6e={'where':{'ProjectId':_0x21206f[_0x708f('0x55')]['id']}};if(_0x21206f[_0x708f('0x32')][_0x708f('0x62')]){_0x122f6e[_0x708f('0x3d')][_0x708f('0x63')]=JSON['parse'](_0x21206f[_0x708f('0x32')]['startTime']);}return db[_0x708f('0x57')]['findAll'](_0x122f6e)[_0x708f('0x25')](handleEntityNotFound(_0x3a168a,null))[_0x708f('0x25')](function(_0x11a3f7){if(_0x11a3f7){_0x1bf4c0=_0x11a3f7;return db['JscriptyQuestionReport'][_0x708f('0x41')]({'where':{'SessionId':{'$in':_[_0x708f('0x31')](_0x1bf4c0,'id')},'ProjectId':_0x21206f[_0x708f('0x55')]['id']},'order':'-createdAt'});}})[_0x708f('0x25')](handleEntityNotFound(_0x3a168a,null))[_0x708f('0x25')](function(_0x467435){if(_0x467435){_0xe67ef7=_0x467435;var _0x54cb42={};for(var _0x51758d=0x0,_0x306642=_0xe67ef7[_0x708f('0x38')];_0x51758d<_0x306642;_0x51758d++){if(!_0x54cb42[_0x708f('0x39')](_0xe67ef7[_0x51758d][_0x708f('0x64')])){_0x54cb42[_0xe67ef7[_0x51758d]['questionId']]=needsEncapsulation(_0xe67ef7[_0x51758d][_0x708f('0x65')])?encapsulate(_0xe67ef7[_0x51758d][_0x708f('0x65')]):_0xe67ef7[_0x51758d]['question'];}}var _0x393d01=[],_0x575834={};for(var _0x4f9710=0x0,_0x3012bc=_0x1bf4c0['length'];_0x4f9710<_0x3012bc;_0x4f9710++){_0x575834={'ProjectId':_0x21206f[_0x708f('0x55')]['id'],'SessionId':_0x1bf4c0[_0x4f9710]['id'],'StartTime':moment(_0x1bf4c0[_0x4f9710]['starttime'])[_0x708f('0x66')](_0x708f('0x67'))};for(var _0xaa50e2=0x0,_0x5958b9=_0xe67ef7[_0x708f('0x38')];_0xaa50e2<_0x5958b9;_0xaa50e2++){if(_0xe67ef7[_0xaa50e2][_0x708f('0x68')]==_0x1bf4c0[_0x4f9710]['id']&&_0x54cb42[_0x708f('0x39')](_0xe67ef7[_0xaa50e2][_0x708f('0x64')])){_0x575834[_0x54cb42[_0xe67ef7[_0xaa50e2][_0x708f('0x64')]]]=_0xe67ef7[_0xaa50e2][_0x708f('0x69')];}}for(var _0x5aa5bd in _0x54cb42){if(!_0x575834[_0x708f('0x39')](_0x54cb42[_0x5aa5bd])){_0x575834[_0x54cb42[_0x5aa5bd]]=null;}}_0x393d01[_0x708f('0x6a')](_0x575834);}return _0x393d01;}})[_0x708f('0x25')](function(_0x1d6c52){if(!_[_0x708f('0x6b')](_0x1d6c52)){var _0x5606c3=toCsv(_0x1d6c52);var _0x386e86=Date[_0x708f('0x6c')]();fs[_0x708f('0x6d')](util[_0x708f('0x66')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x21206f['params']['id'],_0x386e86),_0x5606c3);_0x3a168a[_0x708f('0x6e')]('Content-disposition','attachment;\x20filename='+util['format'](_0x708f('0x6f'),_0x21206f[_0x708f('0x55')]['id'],_0x386e86));_0x3a168a[_0x708f('0x6e')](_0x708f('0x70'),_0x708f('0x71'));return _0x3a168a[_0x708f('0x72')](util['format'](_0x708f('0x73'),_0x21206f[_0x708f('0x55')]['id'],_0x386e86));}else{return _0x3a168a['sendStatus'](0xcc);}})[_0x708f('0x54')](handleError(_0x3a168a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index a2c0b66..840e0bd 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 _0x76e4=['jscripty_projects','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76e4,0x12c));var _0x476e=function(_0x587808,_0x2382e7){_0x587808=_0x587808-0x0;var _0x239834=_0x76e4[_0x587808];return _0x239834;};'use strict';var _=require(_0x476e('0x0'));var util=require('util');var logger=require(_0x476e('0x1'))(_0x476e('0x2'));var moment=require(_0x476e('0x3'));var BPromise=require(_0x476e('0x4'));var rp=require(_0x476e('0x5'));var fs=require('fs');var path=require(_0x476e('0x6'));var rimraf=require(_0x476e('0x7'));var config=require(_0x476e('0x8'));var attributes=require(_0x476e('0x9'));module['exports']=function(_0x5270d1,_0x592d53){return _0x5270d1[_0x476e('0xa')](_0x476e('0xb'),attributes,{'tableName':_0x476e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c9=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4261ba,_0x137c23){var _0xef8472=function(_0x4a5aa4){while(--_0x4a5aa4){_0x4261ba['push'](_0x4261ba['shift']());}};_0xef8472(++_0x137c23);}(_0xe0c9,0x199));var _0x9e0c=function(_0x245cbf,_0x4ff281){_0x245cbf=_0x245cbf-0x0;var _0x1f3c4b=_0xe0c9[_0x245cbf];return _0x1f3c4b;};'use strict';var _=require('lodash');var util=require(_0x9e0c('0x0'));var logger=require(_0x9e0c('0x1'))(_0x9e0c('0x2'));var moment=require('moment');var BPromise=require(_0x9e0c('0x3'));var rp=require(_0x9e0c('0x4'));var fs=require('fs');var path=require(_0x9e0c('0x5'));var rimraf=require(_0x9e0c('0x6'));var config=require(_0x9e0c('0x7'));var attributes=require(_0x9e0c('0x8'));module[_0x9e0c('0x9')]=function(_0x5c4023,_0x5d1bd6){return _0x5c4023[_0x9e0c('0xa')](_0x9e0c('0xb'),attributes,{'tableName':_0x9e0c('0xc'),'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 a729381..69bc655 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 _0xeb10=['http','request','then','request\x20sent','debug','stringify','error','code','JscriptyProject,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xeb10,0xbc));var _0x0eb1=function(_0xa8a699,_0x338306){_0xa8a699=_0xa8a699-0x0;var _0x976fcf=_0xeb10[_0xa8a699];return _0x976fcf;};'use strict';var _=require(_0x0eb1('0x0'));var util=require(_0x0eb1('0x1'));var moment=require(_0x0eb1('0x2'));var BPromise=require(_0x0eb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0eb1('0x4'));var logger=require(_0x0eb1('0x5'))(_0x0eb1('0x6'));var config=require(_0x0eb1('0x7'));var jayson=require(_0x0eb1('0x8'));var client=jayson[_0x0eb1('0x9')][_0x0eb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f777,_0x1cbc7a,_0x4f7c01){return new BPromise(function(_0x5b0251,_0x435f7d){return client[_0x0eb1('0xb')](_0x54f777,_0x4f7c01)[_0x0eb1('0xc')](function(_0x1cf4bd){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x1cbc7a,_0x0eb1('0xd'));logger[_0x0eb1('0xe')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x1cbc7a,'request\x20sent',JSON[_0x0eb1('0xf')](_0x1cf4bd));if(_0x1cf4bd['error']){if(_0x1cf4bd[_0x0eb1('0x10')][_0x0eb1('0x11')]===0x1f4){logger['error'](_0x0eb1('0x12'),_0x1cbc7a,_0x1cf4bd[_0x0eb1('0x10')][_0x0eb1('0x13')]);return _0x435f7d(_0x1cf4bd[_0x0eb1('0x10')][_0x0eb1('0x13')]);}logger[_0x0eb1('0x10')](_0x0eb1('0x12'),_0x1cbc7a,_0x1cf4bd[_0x0eb1('0x10')][_0x0eb1('0x13')]);return _0x5b0251(_0x1cf4bd['error'][_0x0eb1('0x13')]);}else{logger[_0x0eb1('0x14')](_0x0eb1('0x12'),_0x1cbc7a,_0x0eb1('0xd'));_0x5b0251(_0x1cf4bd[_0x0eb1('0x15')][_0x0eb1('0x13')]);}})['catch'](function(_0x5a78f1){logger[_0x0eb1('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x1cbc7a,_0x5a78f1);_0x435f7d(_0x5a78f1);});});} \ No newline at end of file +var _0xf8fe=['error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f56be,_0x4ec278){var _0x46db32=function(_0x29af80){while(--_0x29af80){_0x2f56be['push'](_0x2f56be['shift']());}};_0x46db32(++_0x4ec278);}(_0xf8fe,0x15e));var _0xef8f=function(_0xd38e9,_0x1a15f7){_0xd38e9=_0xd38e9-0x0;var _0x18c2f7=_0xf8fe[_0xd38e9];return _0x18c2f7;};'use strict';var _=require(_0xef8f('0x0'));var util=require(_0xef8f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xef8f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef8f('0x3'))['db'];var utils=require(_0xef8f('0x4'));var logger=require(_0xef8f('0x5'))(_0xef8f('0x6'));var config=require('../../config/environment');var jayson=require(_0xef8f('0x7'));var client=jayson[_0xef8f('0x8')][_0xef8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2be1b9,_0x1c3541,_0x230c41){return new BPromise(function(_0x57636d,_0x5310e4){return client[_0xef8f('0xa')](_0x2be1b9,_0x230c41)[_0xef8f('0xb')](function(_0x46580e){logger[_0xef8f('0xc')](_0xef8f('0xd'),_0x1c3541,_0xef8f('0xe'));logger[_0xef8f('0xf')](_0xef8f('0x10'),_0x1c3541,_0xef8f('0xe'),JSON[_0xef8f('0x11')](_0x46580e));if(_0x46580e[_0xef8f('0x12')]){if(_0x46580e[_0xef8f('0x12')][_0xef8f('0x13')]===0x1f4){logger[_0xef8f('0x12')](_0xef8f('0xd'),_0x1c3541,_0x46580e[_0xef8f('0x12')][_0xef8f('0x14')]);return _0x5310e4(_0x46580e[_0xef8f('0x12')]['message']);}logger[_0xef8f('0x12')](_0xef8f('0xd'),_0x1c3541,_0x46580e[_0xef8f('0x12')][_0xef8f('0x14')]);return _0x57636d(_0x46580e[_0xef8f('0x12')][_0xef8f('0x14')]);}else{logger[_0xef8f('0xc')](_0xef8f('0xd'),_0x1c3541,'request\x20sent');_0x57636d(_0x46580e[_0xef8f('0x15')][_0xef8f('0x14')]);}})[_0xef8f('0x16')](function(_0x4dd77c){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x1c3541,_0x4dd77c);_0x5310e4(_0x4dd77c);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 9913045..ed6391a 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 _0xc113=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0xc113,0x1ab));var _0x3c11=function(_0x3a81e6,_0xe4af2){_0x3a81e6=_0x3a81e6-0x0;var _0xbd0030=_0xc113[_0x3a81e6];return _0xbd0030;};'use strict';var multer=require(_0x3c11('0x0'));var util=require(_0x3c11('0x1'));var path=require(_0x3c11('0x2'));var timeout=require(_0x3c11('0x3'));var express=require(_0x3c11('0x4'));var router=express[_0x3c11('0x5')]();var auth=require(_0x3c11('0x6'));var interaction=require(_0x3c11('0x7'));var config=require(_0x3c11('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x3c11('0x9')]('/',auth[_0x3c11('0xa')](),controller['index']);router[_0x3c11('0x9')](_0x3c11('0xb'),auth[_0x3c11('0xa')](),controller['describe']);router[_0x3c11('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3c11('0xc')]('/',auth[_0x3c11('0xa')](),controller['create']);router[_0x3c11('0xd')](_0x3c11('0xe'),auth[_0x3c11('0xa')](),controller['update']);router[_0x3c11('0xf')](_0x3c11('0xe'),auth[_0x3c11('0xa')](),controller[_0x3c11('0x10')]);module[_0x3c11('0x11')]=router; \ No newline at end of file +var _0x4813=['/:id','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x1c8e52,_0x306f5a){var _0x26ebe9=function(_0x524052){while(--_0x524052){_0x1c8e52['push'](_0x1c8e52['shift']());}};_0x26ebe9(++_0x306f5a);}(_0x4813,0xdc));var _0x3481=function(_0x10f1cc,_0x5eb8e8){_0x10f1cc=_0x10f1cc-0x0;var _0x218477=_0x4813[_0x10f1cc];return _0x218477;};'use strict';var multer=require(_0x3481('0x0'));var util=require('util');var path=require(_0x3481('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3481('0x2')]();var auth=require(_0x3481('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3481('0x4'));var controller=require(_0x3481('0x5'));router[_0x3481('0x6')]('/',auth[_0x3481('0x7')](),controller[_0x3481('0x8')]);router[_0x3481('0x6')](_0x3481('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x3481('0x6')]('/:id',auth[_0x3481('0x7')](),controller[_0x3481('0xa')]);router[_0x3481('0xb')]('/',auth[_0x3481('0x7')](),controller[_0x3481('0xc')]);router[_0x3481('0xd')](_0x3481('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x3481('0xf')](_0x3481('0xe'),auth[_0x3481('0x7')](),controller[_0x3481('0x10')]);module[_0x3481('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index a60e9e2..f0f3766 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 _0xa571=['exports','TEXT','STRING','sequelize'];(function(_0x32b7ea,_0x4a9bb8){var _0x51491c=function(_0xa45cc6){while(--_0xa45cc6){_0x32b7ea['push'](_0x32b7ea['shift']());}};_0x51491c(++_0x4a9bb8);}(_0xa571,0x107));var _0x1a57=function(_0x2a5d70,_0x4a7a48){_0x2a5d70=_0x2a5d70-0x0;var _0x212df6=_0xa571[_0x2a5d70];return _0x212df6;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'question':{'type':Sequelize[_0x1a57('0x2')]},'answer':{'type':Sequelize[_0x1a57('0x2')]('long')},'membername':{'type':Sequelize[_0x1a57('0x3')]},'projectname':{'type':Sequelize[_0x1a57('0x3')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1a57('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x1a57('0x3')]}}; \ No newline at end of file +var _0x24cf=['STRING','TEXT','long'];(function(_0x231022,_0x515be9){var _0x3c2415=function(_0x11169f){while(--_0x11169f){_0x231022['push'](_0x231022['shift']());}};_0x3c2415(++_0x515be9);}(_0x24cf,0x1d5));var _0xf24c=function(_0x185caf,_0x3c999a){_0x185caf=_0x185caf-0x0;var _0x4f0a2d=_0x24cf[_0x185caf];return _0x4f0a2d;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0xf24c('0x0')]},'answer':{'type':Sequelize[_0xf24c('0x0')](_0xf24c('0x1'))},'membername':{'type':Sequelize[_0xf24c('0x2')]},'projectname':{'type':Sequelize[_0xf24c('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf24c('0x2')]},'calleridname':{'type':Sequelize[_0xf24c('0x2')]},'calleridnum':{'type':Sequelize[_0xf24c('0x2')]},'questionId':{'type':Sequelize[_0xf24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 436177a..59d1dfc 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 _0x70b7=['squel','jsforce','desk.js','to-csv','querystring','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','apply','save','update','then','destroy','error','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','filters','pick','filter','where','merge','include','catch','show','params','includeAll','options','find','create','body','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','lodash'];(function(_0x3ad798,_0x11f5e6){var _0x20408f=function(_0x193f6b){while(--_0x193f6b){_0x3ad798['push'](_0x3ad798['shift']());}};_0x20408f(++_0x11f5e6);}(_0x70b7,0x194));var _0x770b=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0x70b7[_0xa9eaa0];return _0x30897a;};'use strict';var pdf=require(_0x770b('0x0'));var emlformat=require(_0x770b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x770b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x770b('0x3'));var moment=require('moment');var BPromise=require(_0x770b('0x4'));var Mustache=require(_0x770b('0x5'));var util=require(_0x770b('0x6'));var path=require(_0x770b('0x7'));var sox=require(_0x770b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x770b('0x9'));var squel=require(_0x770b('0xa'));var crypto=require('crypto');var jsforce=require(_0x770b('0xb'));var deskjs=require(_0x770b('0xc'));var toCsv=require(_0x770b('0xd'));var querystring=require(_0x770b('0xe'));var Papa=require('papaparse');var Redis=require(_0x770b('0xf'));var authService=require(_0x770b('0x10'));var qs=require(_0x770b('0x11'));var as=require(_0x770b('0x12'));var hardwareService=require(_0x770b('0x13'));var logger=require(_0x770b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x770b('0x15'));var licenseUtil=require(_0x770b('0x16'));var db=require(_0x770b('0x17'))['db'];function respondWithStatusCode(_0x436349,_0x1268c7){_0x1268c7=_0x1268c7||0xcc;return function(_0x24ce8d){if(_0x24ce8d){return _0x436349[_0x770b('0x18')](_0x1268c7);}return _0x436349[_0x770b('0x19')](_0x1268c7)[_0x770b('0x1a')]();};}function respondWithResult(_0x2d2cc4,_0x2507ae){_0x2507ae=_0x2507ae||0xc8;return function(_0x559fa1){if(_0x559fa1){return _0x2d2cc4['status'](_0x2507ae)[_0x770b('0x1b')](_0x559fa1);}};}function respondWithFilteredResult(_0x4d55b2,_0x5b7d08){return function(_0x92025){if(_0x92025){var _0x2ba4f0=_0x92025[_0x770b('0x1c')],_0x3eb360=_0x5b7d08[_0x770b('0x1d')],_0x26130a=_0x5b7d08[_0x770b('0x1d')]+_0x5b7d08[_0x770b('0x1e')],_0x103e98;if(_0x26130a>=_0x2ba4f0){_0x26130a=_0x2ba4f0;_0x103e98=0xc8;}else{_0x103e98=0xce;}_0x4d55b2[_0x770b('0x19')](_0x103e98);return _0x4d55b2[_0x770b('0x1f')]('Content-Range',_0x3eb360+'-'+_0x26130a+'/'+_0x2ba4f0)['json'](_0x92025);}return null;};}function patchUpdates(_0x1875bd){return function(_0x3dcd5f){try{jsonpatch[_0x770b('0x20')](_0x3dcd5f,_0x1875bd,!![]);}catch(_0x1e5970){return BPromise['reject'](_0x1e5970);}return _0x3dcd5f[_0x770b('0x21')]();};}function saveUpdates(_0x2f099d,_0x4d4e08){return function(_0x4505a1){if(_0x4505a1){return _0x4505a1[_0x770b('0x22')](_0x2f099d)[_0x770b('0x23')](function(_0x7b6d70){return _0x7b6d70;});}return null;};}function removeEntity(_0x3654b5,_0x334083){return function(_0x32a720){if(_0x32a720){return _0x32a720[_0x770b('0x24')]()['then'](function(){_0x3654b5[_0x770b('0x19')](0xcc)[_0x770b('0x1a')]();});}};}function handleEntityNotFound(_0x22213c,_0x55e392){return function(_0x5a3d8a){if(!_0x5a3d8a){_0x22213c[_0x770b('0x18')](0x194);}return _0x5a3d8a;};}function handleError(_0x453077,_0x1028a9){_0x1028a9=_0x1028a9||0x1f4;return function(_0x3fc723){logger[_0x770b('0x25')](_0x3fc723['stack']);if(_0x3fc723['name']){delete _0x3fc723[_0x770b('0x26')];}_0x453077[_0x770b('0x19')](_0x1028a9)['send'](_0x3fc723);};}exports[_0x770b('0x27')]=function(_0x3f47ea,_0x3cf1c2){var _0x456e7f={},_0xcb34a5={},_0x1b991c={'count':0x0,'rows':[]};var _0x1b65c0=_[_0x770b('0x28')](db[_0x770b('0x29')][_0x770b('0x2a')],function(_0x150353){return{'name':_0x150353[_0x770b('0x2b')],'type':_0x150353[_0x770b('0x2c')][_0x770b('0x2d')]};});_0xcb34a5['model']=_['map'](_0x1b65c0,_0x770b('0x26'));_0xcb34a5[_0x770b('0x2e')]=_[_0x770b('0x2f')](_0x3f47ea[_0x770b('0x2e')]);_0xcb34a5['filters']=_[_0x770b('0x30')](_0xcb34a5[_0x770b('0x31')],_0xcb34a5[_0x770b('0x2e')]);_0x456e7f[_0x770b('0x32')]=_[_0x770b('0x30')](_0xcb34a5['model'],qs['fields'](_0x3f47ea[_0x770b('0x2e')][_0x770b('0x33')]));_0x456e7f['attributes']=_0x456e7f[_0x770b('0x32')][_0x770b('0x34')]?_0x456e7f[_0x770b('0x32')]:_0xcb34a5[_0x770b('0x31')];if(!_0x3f47ea[_0x770b('0x2e')]['hasOwnProperty'](_0x770b('0x35'))){_0x456e7f[_0x770b('0x1e')]=qs['limit'](_0x3f47ea[_0x770b('0x2e')]['limit']);_0x456e7f[_0x770b('0x1d')]=qs[_0x770b('0x1d')](_0x3f47ea[_0x770b('0x2e')]['offset']);}_0x456e7f['order']=qs[_0x770b('0x36')](_0x3f47ea['query'][_0x770b('0x36')]);_0x456e7f['where']=qs[_0x770b('0x37')](_[_0x770b('0x38')](_0x3f47ea['query'],_0xcb34a5[_0x770b('0x37')]),_0x1b65c0);if(_0x3f47ea['query'][_0x770b('0x39')]){_0x456e7f[_0x770b('0x3a')]=_[_0x770b('0x3b')](_0x456e7f[_0x770b('0x3a')],{'$or':_['map'](_0x1b65c0,function(_0x277159){if(_0x277159[_0x770b('0x2c')]!=='VIRTUAL'){var _0xdf212d={};_0xdf212d[_0x277159['name']]={'$like':'%'+_0x3f47ea[_0x770b('0x2e')][_0x770b('0x39')]+'%'};return _0xdf212d;}})});}_0x456e7f=_['merge']({},_0x456e7f,_0x3f47ea['options']);var _0x21e542={'where':_0x456e7f[_0x770b('0x3a')]};return db['JscriptyQuestionReport']['count'](_0x21e542)['then'](function(_0x3b74d7){_0x1b991c[_0x770b('0x1c')]=_0x3b74d7;if(_0x3f47ea[_0x770b('0x2e')]['includeAll']){_0x456e7f[_0x770b('0x3c')]=[{'all':!![]}];}return db[_0x770b('0x29')]['findAll'](_0x456e7f);})[_0x770b('0x23')](function(_0x1e1084){_0x1b991c['rows']=_0x1e1084;return _0x1b991c;})[_0x770b('0x23')](respondWithFilteredResult(_0x3cf1c2,_0x456e7f))[_0x770b('0x3d')](handleError(_0x3cf1c2,null));};exports[_0x770b('0x3e')]=function(_0x20c978,_0x2903a0){var _0x5c4093={'raw':!![],'where':{'id':_0x20c978[_0x770b('0x3f')]['id']}},_0x23ec6a={};_0x23ec6a['model']=_[_0x770b('0x2f')](db[_0x770b('0x29')][_0x770b('0x2a')]);_0x23ec6a[_0x770b('0x2e')]=_[_0x770b('0x2f')](_0x20c978[_0x770b('0x2e')]);_0x23ec6a[_0x770b('0x37')]=_[_0x770b('0x30')](_0x23ec6a[_0x770b('0x31')],_0x23ec6a['query']);_0x5c4093['attributes']=_[_0x770b('0x30')](_0x23ec6a[_0x770b('0x31')],qs[_0x770b('0x33')](_0x20c978[_0x770b('0x2e')]['fields']));_0x5c4093['attributes']=_0x5c4093['attributes'][_0x770b('0x34')]?_0x5c4093[_0x770b('0x32')]:_0x23ec6a[_0x770b('0x31')];if(_0x20c978[_0x770b('0x2e')][_0x770b('0x40')]){_0x5c4093[_0x770b('0x3c')]=[{'all':!![]}];}_0x5c4093=_[_0x770b('0x3b')]({},_0x5c4093,_0x20c978[_0x770b('0x41')]);return db['JscriptyQuestionReport'][_0x770b('0x42')](_0x5c4093)[_0x770b('0x23')](handleEntityNotFound(_0x2903a0,null))[_0x770b('0x23')](respondWithResult(_0x2903a0,null))['catch'](handleError(_0x2903a0,null));};exports[_0x770b('0x43')]=function(_0x431eb1,_0x2bffc3){return db['JscriptyQuestionReport'][_0x770b('0x43')](_0x431eb1[_0x770b('0x44')],{})[_0x770b('0x23')](respondWithResult(_0x2bffc3,0xc9))[_0x770b('0x3d')](handleError(_0x2bffc3,null));};exports[_0x770b('0x22')]=function(_0x395201,_0x43ee29){if(_0x395201[_0x770b('0x44')]['id']){delete _0x395201[_0x770b('0x44')]['id'];}return db[_0x770b('0x29')]['find']({'where':{'id':_0x395201[_0x770b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x43ee29,null))[_0x770b('0x23')](saveUpdates(_0x395201[_0x770b('0x44')],null))[_0x770b('0x23')](respondWithResult(_0x43ee29,null))[_0x770b('0x3d')](handleError(_0x43ee29,null));};exports[_0x770b('0x24')]=function(_0x6e7080,_0x39cde7){return db[_0x770b('0x29')][_0x770b('0x42')]({'where':{'id':_0x6e7080['params']['id']}})[_0x770b('0x23')](handleEntityNotFound(_0x39cde7,null))[_0x770b('0x23')](removeEntity(_0x39cde7,null))[_0x770b('0x3d')](handleError(_0x39cde7,null));};exports['describe']=function(_0x2c73ae,_0x417db1){return db[_0x770b('0x29')]['describe']()[_0x770b('0x23')](respondWithResult(_0x417db1,null))[_0x770b('0x3d')](handleError(_0x417db1,null));}; \ No newline at end of file +var _0x0eb2=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x0eb2,0x147));var _0x20eb=function(_0x260964,_0x1101c2){_0x260964=_0x260964-0x0;var _0x3aae6f=_0x0eb2[_0x260964];return _0x3aae6f;};'use strict';var pdf=require(_0x20eb('0x0'));var emlformat=require(_0x20eb('0x1'));var rimraf=require(_0x20eb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x20eb('0x3'));var BPromise=require(_0x20eb('0x4'));var Mustache=require(_0x20eb('0x5'));var util=require(_0x20eb('0x6'));var path=require(_0x20eb('0x7'));var sox=require(_0x20eb('0x8'));var csv=require('to-csv');var ejs=require(_0x20eb('0x9'));var fs=require('fs');var _=require(_0x20eb('0xa'));var squel=require(_0x20eb('0xb'));var crypto=require(_0x20eb('0xc'));var jsforce=require(_0x20eb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x20eb('0xe'));var querystring=require('querystring');var Papa=require(_0x20eb('0xf'));var Redis=require('ioredis');var authService=require(_0x20eb('0x10'));var qs=require(_0x20eb('0x11'));var as=require(_0x20eb('0x12'));var hardwareService=require(_0x20eb('0x13'));var logger=require(_0x20eb('0x14'))(_0x20eb('0x15'));var utils=require(_0x20eb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x20eb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x120c9e,_0x220f4c){_0x220f4c=_0x220f4c||0xcc;return function(_0x8dd6d5){if(_0x8dd6d5){return _0x120c9e['sendStatus'](_0x220f4c);}return _0x120c9e[_0x20eb('0x18')](_0x220f4c)['end']();};}function respondWithResult(_0x58fce0,_0x1a0177){_0x1a0177=_0x1a0177||0xc8;return function(_0x7178fc){if(_0x7178fc){return _0x58fce0[_0x20eb('0x18')](_0x1a0177)['json'](_0x7178fc);}};}function respondWithFilteredResult(_0x42d1c4,_0x1a3b77){return function(_0x519a83){if(_0x519a83){var _0xbab17f=_0x519a83[_0x20eb('0x19')],_0x487a5a=_0x1a3b77[_0x20eb('0x1a')],_0x3509a3=_0x1a3b77[_0x20eb('0x1a')]+_0x1a3b77[_0x20eb('0x1b')],_0x294fcd;if(_0x3509a3>=_0xbab17f){_0x3509a3=_0xbab17f;_0x294fcd=0xc8;}else{_0x294fcd=0xce;}_0x42d1c4[_0x20eb('0x18')](_0x294fcd);return _0x42d1c4[_0x20eb('0x1c')](_0x20eb('0x1d'),_0x487a5a+'-'+_0x3509a3+'/'+_0xbab17f)[_0x20eb('0x1e')](_0x519a83);}return null;};}function patchUpdates(_0x505ae9){return function(_0x1057b7){try{jsonpatch[_0x20eb('0x1f')](_0x1057b7,_0x505ae9,!![]);}catch(_0x5cdc78){return BPromise[_0x20eb('0x20')](_0x5cdc78);}return _0x1057b7[_0x20eb('0x21')]();};}function saveUpdates(_0x9a0e2e,_0x50b0f7){return function(_0x144e3b){if(_0x144e3b){return _0x144e3b[_0x20eb('0x22')](_0x9a0e2e)[_0x20eb('0x23')](function(_0x14a1b5){return _0x14a1b5;});}return null;};}function removeEntity(_0x588f6a,_0x1db439){return function(_0x55e009){if(_0x55e009){return _0x55e009[_0x20eb('0x24')]()[_0x20eb('0x23')](function(){_0x588f6a[_0x20eb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e62b,_0x4c02f4){return function(_0x13ee84){if(!_0x13ee84){_0x59e62b[_0x20eb('0x25')](0x194);}return _0x13ee84;};}function handleError(_0xf9d216,_0x1460b9){_0x1460b9=_0x1460b9||0x1f4;return function(_0x1fdd82){logger[_0x20eb('0x26')](_0x1fdd82['stack']);if(_0x1fdd82[_0x20eb('0x27')]){delete _0x1fdd82['name'];}_0xf9d216['status'](_0x1460b9)[_0x20eb('0x28')](_0x1fdd82);};}exports[_0x20eb('0x29')]=function(_0x33cec9,_0x460c48){var _0x321eff={},_0x41c8c1={},_0x4ac183={'count':0x0,'rows':[]};var _0x3e966d=_[_0x20eb('0x2a')](db[_0x20eb('0x2b')][_0x20eb('0x2c')],function(_0x5dd029){return{'name':_0x5dd029[_0x20eb('0x2d')],'type':_0x5dd029[_0x20eb('0x2e')][_0x20eb('0x2f')]};});_0x41c8c1['model']=_[_0x20eb('0x2a')](_0x3e966d,_0x20eb('0x27'));_0x41c8c1[_0x20eb('0x30')]=_[_0x20eb('0x31')](_0x33cec9[_0x20eb('0x30')]);_0x41c8c1[_0x20eb('0x32')]=_[_0x20eb('0x33')](_0x41c8c1[_0x20eb('0x34')],_0x41c8c1['query']);_0x321eff[_0x20eb('0x35')]=_[_0x20eb('0x33')](_0x41c8c1[_0x20eb('0x34')],qs[_0x20eb('0x36')](_0x33cec9[_0x20eb('0x30')][_0x20eb('0x36')]));_0x321eff['attributes']=_0x321eff['attributes'][_0x20eb('0x37')]?_0x321eff[_0x20eb('0x35')]:_0x41c8c1[_0x20eb('0x34')];if(!_0x33cec9['query'][_0x20eb('0x38')](_0x20eb('0x39'))){_0x321eff['limit']=qs[_0x20eb('0x1b')](_0x33cec9['query'][_0x20eb('0x1b')]);_0x321eff[_0x20eb('0x1a')]=qs['offset'](_0x33cec9[_0x20eb('0x30')][_0x20eb('0x1a')]);}_0x321eff[_0x20eb('0x3a')]=qs['sort'](_0x33cec9[_0x20eb('0x30')][_0x20eb('0x3b')]);_0x321eff[_0x20eb('0x3c')]=qs[_0x20eb('0x32')](_['pick'](_0x33cec9[_0x20eb('0x30')],_0x41c8c1[_0x20eb('0x32')]),_0x3e966d);if(_0x33cec9[_0x20eb('0x30')]['filter']){_0x321eff[_0x20eb('0x3c')]=_[_0x20eb('0x3d')](_0x321eff[_0x20eb('0x3c')],{'$or':_['map'](_0x3e966d,function(_0x5945a0){if(_0x5945a0[_0x20eb('0x2e')]!=='VIRTUAL'){var _0x1194d5={};_0x1194d5[_0x5945a0[_0x20eb('0x27')]]={'$like':'%'+_0x33cec9['query'][_0x20eb('0x3e')]+'%'};return _0x1194d5;}})});}_0x321eff=_['merge']({},_0x321eff,_0x33cec9[_0x20eb('0x3f')]);var _0x3c3fb1={'where':_0x321eff[_0x20eb('0x3c')]};return db[_0x20eb('0x2b')][_0x20eb('0x19')](_0x3c3fb1)['then'](function(_0x4235ed){_0x4ac183['count']=_0x4235ed;if(_0x33cec9[_0x20eb('0x30')][_0x20eb('0x40')]){_0x321eff[_0x20eb('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x20eb('0x42')](_0x321eff);})[_0x20eb('0x23')](function(_0x4a4908){_0x4ac183[_0x20eb('0x43')]=_0x4a4908;return _0x4ac183;})[_0x20eb('0x23')](respondWithFilteredResult(_0x460c48,_0x321eff))[_0x20eb('0x44')](handleError(_0x460c48,null));};exports[_0x20eb('0x45')]=function(_0x5ecabf,_0x579536){var _0x2b8bec={'raw':!![],'where':{'id':_0x5ecabf[_0x20eb('0x46')]['id']}},_0x41e49e={};_0x41e49e[_0x20eb('0x34')]=_[_0x20eb('0x31')](db['JscriptyQuestionReport']['rawAttributes']);_0x41e49e['query']=_[_0x20eb('0x31')](_0x5ecabf[_0x20eb('0x30')]);_0x41e49e['filters']=_['intersection'](_0x41e49e[_0x20eb('0x34')],_0x41e49e[_0x20eb('0x30')]);_0x2b8bec[_0x20eb('0x35')]=_[_0x20eb('0x33')](_0x41e49e['model'],qs['fields'](_0x5ecabf['query']['fields']));_0x2b8bec[_0x20eb('0x35')]=_0x2b8bec[_0x20eb('0x35')][_0x20eb('0x37')]?_0x2b8bec[_0x20eb('0x35')]:_0x41e49e[_0x20eb('0x34')];if(_0x5ecabf[_0x20eb('0x30')][_0x20eb('0x40')]){_0x2b8bec['include']=[{'all':!![]}];}_0x2b8bec=_[_0x20eb('0x3d')]({},_0x2b8bec,_0x5ecabf['options']);return db[_0x20eb('0x2b')]['find'](_0x2b8bec)['then'](handleEntityNotFound(_0x579536,null))[_0x20eb('0x23')](respondWithResult(_0x579536,null))[_0x20eb('0x44')](handleError(_0x579536,null));};exports['create']=function(_0x3dd6f3,_0x43a37d){return db['JscriptyQuestionReport'][_0x20eb('0x47')](_0x3dd6f3[_0x20eb('0x48')],{})['then'](respondWithResult(_0x43a37d,0xc9))[_0x20eb('0x44')](handleError(_0x43a37d,null));};exports['update']=function(_0x1f077e,_0x5dd878){if(_0x1f077e[_0x20eb('0x48')]['id']){delete _0x1f077e['body']['id'];}return db[_0x20eb('0x2b')][_0x20eb('0x49')]({'where':{'id':_0x1f077e['params']['id']}})[_0x20eb('0x23')](handleEntityNotFound(_0x5dd878,null))[_0x20eb('0x23')](saveUpdates(_0x1f077e['body'],null))[_0x20eb('0x23')](respondWithResult(_0x5dd878,null))[_0x20eb('0x44')](handleError(_0x5dd878,null));};exports[_0x20eb('0x24')]=function(_0x4a97db,_0x1dc152){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x4a97db[_0x20eb('0x46')]['id']}})[_0x20eb('0x23')](handleEntityNotFound(_0x1dc152,null))[_0x20eb('0x23')](removeEntity(_0x1dc152,null))[_0x20eb('0x44')](handleError(_0x1dc152,null));};exports[_0x20eb('0x4a')]=function(_0x28053e,_0x439f19){return db[_0x20eb('0x2b')]['describe']()[_0x20eb('0x23')](respondWithResult(_0x439f19,null))[_0x20eb('0x44')](handleError(_0x439f19,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a99411b..546af30 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 _0x26d7=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x202419,_0x465b5f){var _0x432e57=function(_0x12e72b){while(--_0x12e72b){_0x202419['push'](_0x202419['shift']());}};_0x432e57(++_0x465b5f);}(_0x26d7,0x18b));var _0x726d=function(_0x698602,_0x3b70bd){_0x698602=_0x698602-0x0;var _0x1b0e8d=_0x26d7[_0x698602];return _0x1b0e8d;};'use strict';var _=require(_0x726d('0x0'));var util=require(_0x726d('0x1'));var logger=require(_0x726d('0x2'))('api');var moment=require(_0x726d('0x3'));var BPromise=require(_0x726d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x726d('0x5'));var rimraf=require(_0x726d('0x6'));var config=require(_0x726d('0x7'));var attributes=require(_0x726d('0x8'));module[_0x726d('0x9')]=function(_0x1561b0,_0x57f230){return _0x1561b0[_0x726d('0xa')](_0x726d('0xb'),attributes,{'tableName':_0x726d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x465c=['path','rimraf','../../config/environment','define','report_jscripty_questions','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2b0de7,_0x5d397d){var _0x271f4f=function(_0x16d535){while(--_0x16d535){_0x2b0de7['push'](_0x2b0de7['shift']());}};_0x271f4f(++_0x5d397d);}(_0x465c,0x73));var _0xc465=function(_0x3f2ab4,_0x58f1f9){_0x3f2ab4=_0x3f2ab4-0x0;var _0x3df6f1=_0x465c[_0x3f2ab4];return _0x3df6f1;};'use strict';var _=require('lodash');var util=require(_0xc465('0x0'));var logger=require(_0xc465('0x1'))(_0xc465('0x2'));var moment=require(_0xc465('0x3'));var BPromise=require(_0xc465('0x4'));var rp=require(_0xc465('0x5'));var fs=require('fs');var path=require(_0xc465('0x6'));var rimraf=require(_0xc465('0x7'));var config=require(_0xc465('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x9017ac,_0x8b1242){return _0x9017ac[_0xc465('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0xc465('0xa'),'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 8228c59..e63b819 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 _0x59bd=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis'];(function(_0x2d1097,_0x478462){var _0x76ad34=function(_0x17c59a){while(--_0x17c59a){_0x2d1097['push'](_0x2d1097['shift']());}};_0x76ad34(++_0x478462);}(_0x59bd,0x1e0));var _0xd59b=function(_0x414d38,_0x4d2603){_0x414d38=_0x414d38-0x0;var _0x387cde=_0x59bd[_0x414d38];return _0x387cde;};'use strict';var _=require(_0xd59b('0x0'));var util=require('util');var moment=require(_0xd59b('0x1'));var BPromise=require('bluebird');var rs=require(_0xd59b('0x2'));var fs=require('fs');var Redis=require(_0xd59b('0x3'));var db=require(_0xd59b('0x4'))['db'];var utils=require(_0xd59b('0x5'));var logger=require(_0xd59b('0x6'))('rpc');var config=require(_0xd59b('0x7'));var jayson=require(_0xd59b('0x8'));var client=jayson[_0xd59b('0x9')][_0xd59b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x255692,_0x5654f6,_0x5d05cb){return new BPromise(function(_0x26818e,_0x3fec56){return client[_0xd59b('0xb')](_0x255692,_0x5d05cb)[_0xd59b('0xc')](function(_0x323deb){logger[_0xd59b('0xd')](_0xd59b('0xe'),_0x5654f6,_0xd59b('0xf'));logger[_0xd59b('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x5654f6,_0xd59b('0xf'),JSON[_0xd59b('0x11')](_0x323deb));if(_0x323deb[_0xd59b('0x12')]){if(_0x323deb[_0xd59b('0x12')][_0xd59b('0x13')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5654f6,_0x323deb[_0xd59b('0x12')]['message']);return _0x3fec56(_0x323deb[_0xd59b('0x12')][_0xd59b('0x14')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5654f6,_0x323deb['error']['message']);return _0x26818e(_0x323deb[_0xd59b('0x12')][_0xd59b('0x14')]);}else{logger[_0xd59b('0xd')](_0xd59b('0xe'),_0x5654f6,_0xd59b('0xf'));_0x26818e(_0x323deb['result']['message']);}})[_0xd59b('0x15')](function(_0x1b1220){logger['error'](_0xd59b('0xe'),_0x5654f6,_0x1b1220);_0x3fec56(_0x1b1220);});});} \ No newline at end of file +var _0xf82e=['stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x36da82,_0x21e3b1){var _0x365c7b=function(_0x188b2c){while(--_0x188b2c){_0x36da82['push'](_0x36da82['shift']());}};_0x365c7b(++_0x21e3b1);}(_0xf82e,0x19e));var _0xef82=function(_0x4b26f3,_0x2293ed){_0x4b26f3=_0x4b26f3-0x0;var _0x3f87d1=_0xf82e[_0x4b26f3];return _0x3f87d1;};'use strict';var _=require(_0xef82('0x0'));var util=require(_0xef82('0x1'));var moment=require(_0xef82('0x2'));var BPromise=require(_0xef82('0x3'));var rs=require(_0xef82('0x4'));var fs=require('fs');var Redis=require(_0xef82('0x5'));var db=require(_0xef82('0x6'))['db'];var utils=require(_0xef82('0x7'));var logger=require(_0xef82('0x8'))('rpc');var config=require(_0xef82('0x9'));var jayson=require(_0xef82('0xa'));var client=jayson[_0xef82('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f4614,_0x374723,_0x5f0dc7){return new BPromise(function(_0x820c18,_0xb83256){return client[_0xef82('0xc')](_0x2f4614,_0x5f0dc7)[_0xef82('0xd')](function(_0x4f7e3e){logger['info'](_0xef82('0xe'),_0x374723,_0xef82('0xf'));logger[_0xef82('0x10')](_0xef82('0x11'),_0x374723,_0xef82('0xf'),JSON[_0xef82('0x12')](_0x4f7e3e));if(_0x4f7e3e[_0xef82('0x13')]){if(_0x4f7e3e['error'][_0xef82('0x14')]===0x1f4){logger[_0xef82('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x374723,_0x4f7e3e[_0xef82('0x13')][_0xef82('0x15')]);return _0xb83256(_0x4f7e3e[_0xef82('0x13')][_0xef82('0x15')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x374723,_0x4f7e3e[_0xef82('0x13')][_0xef82('0x15')]);return _0x820c18(_0x4f7e3e['error']['message']);}else{logger[_0xef82('0x16')](_0xef82('0xe'),_0x374723,_0xef82('0xf'));_0x820c18(_0x4f7e3e['result'][_0xef82('0x15')]);}})[_0xef82('0x17')](function(_0x54f92b){logger[_0xef82('0x13')](_0xef82('0xe'),_0x374723,_0x54f92b);_0xb83256(_0x54f92b);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 3e87141..e6ec365 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 _0x432b=['Router','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/questions','getQuestions','post','delete','exports','multer','path','connect-timeout','express'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb432('0x0'));var util=require('util');var path=require(_0xb432('0x1'));var timeout=require(_0xb432('0x2'));var express=require(_0xb432('0x3'));var router=express[_0xb432('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb432('0x5'));var controller=require('./jscriptySessionReport.controller');router[_0xb432('0x6')]('/',auth['isAuthenticated'](),controller[_0xb432('0x7')]);router[_0xb432('0x6')](_0xb432('0x8'),auth[_0xb432('0x9')](),controller[_0xb432('0xa')]);router[_0xb432('0x6')](_0xb432('0xb'),auth[_0xb432('0x9')](),controller['show']);router[_0xb432('0x6')](_0xb432('0xc'),auth[_0xb432('0x9')](),controller[_0xb432('0xd')]);router[_0xb432('0xe')]('/',auth[_0xb432('0x9')](),controller['create']);router['put'](_0xb432('0xb'),auth[_0xb432('0x9')](),controller['update']);router[_0xb432('0xf')](_0xb432('0xb'),auth[_0xb432('0x9')](),controller['destroy']);module[_0xb432('0x10')]=router; \ No newline at end of file +var _0x5301=['put','update','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','getQuestions','post'];(function(_0x8214d1,_0x565c76){var _0x25ad4a=function(_0x5d1d02){while(--_0x5d1d02){_0x8214d1['push'](_0x8214d1['shift']());}};_0x25ad4a(++_0x565c76);}(_0x5301,0x157));var _0x1530=function(_0x1b86d2,_0x5a0664){_0x1b86d2=_0x1b86d2-0x0;var _0x401b48=_0x5301[_0x1b86d2];return _0x401b48;};'use strict';var multer=require('multer');var util=require(_0x1530('0x0'));var path=require(_0x1530('0x1'));var timeout=require(_0x1530('0x2'));var express=require(_0x1530('0x3'));var router=express[_0x1530('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1530('0x5'));var config=require(_0x1530('0x6'));var controller=require(_0x1530('0x7'));router[_0x1530('0x8')]('/',auth['isAuthenticated'](),controller[_0x1530('0x9')]);router['get'](_0x1530('0xa'),auth['isAuthenticated'](),controller[_0x1530('0xb')]);router[_0x1530('0x8')](_0x1530('0xc'),auth[_0x1530('0xd')](),controller[_0x1530('0xe')]);router['get']('/:id/questions',auth[_0x1530('0xd')](),controller[_0x1530('0xf')]);router[_0x1530('0x10')]('/',auth[_0x1530('0xd')](),controller['create']);router[_0x1530('0x11')](_0x1530('0xc'),auth[_0x1530('0xd')](),controller[_0x1530('0x12')]);router['delete']('/:id',auth[_0x1530('0xd')](),controller[_0x1530('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 773e117..cb12358 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 _0x5a5e=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','starttime'];(function(_0x9c9ccf,_0x373a22){var _0x2054a9=function(_0x497cfe){while(--_0x497cfe){_0x9c9ccf['push'](_0x9c9ccf['shift']());}};_0x2054a9(++_0x373a22);}(_0x5a5e,0x1d1));var _0xe5a5=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0x5a5e[_0x3299d1];return _0x44356e;};'use strict';var moment=require(_0xe5a5('0x0'));var Sequelize=require(_0xe5a5('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xe5a5('0x2')],'set':function(_0x42cb81){this[_0xe5a5('0x3')](_0xe5a5('0x4'),_0x42cb81);this[_0xe5a5('0x3')](_0xe5a5('0x5'),moment()[_0xe5a5('0x6')](_0xe5a5('0x7')));}},'endtime':{'type':Sequelize[_0xe5a5('0x2')]},'membername':{'type':Sequelize[_0xe5a5('0x8')]},'projectname':{'type':Sequelize[_0xe5a5('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xe5a5('0x8')]},'calleridname':{'type':Sequelize[_0xe5a5('0x8')]},'calleridnum':{'type':Sequelize[_0xe5a5('0x8')]},'completed':{'type':Sequelize[_0xe5a5('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x784c=['moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x2e9009,_0x34ae49){var _0x3498eb=function(_0x12cdee){while(--_0x12cdee){_0x2e9009['push'](_0x2e9009['shift']());}};_0x3498eb(++_0x34ae49);}(_0x784c,0x84));var _0xc784=function(_0x458fe2,_0x546842){_0x458fe2=_0x458fe2-0x0;var _0x1cf969=_0x784c[_0x458fe2];return _0x1cf969;};'use strict';var moment=require(_0xc784('0x0'));var Sequelize=require(_0xc784('0x1'));module[_0xc784('0x2')]={'starttime':{'type':Sequelize[_0xc784('0x3')],'set':function(_0x36c36e){this[_0xc784('0x4')](_0xc784('0x5'),_0x36c36e);this['setDataValue'](_0xc784('0x6'),moment()[_0xc784('0x7')](_0xc784('0x8')));}},'endtime':{'type':Sequelize[_0xc784('0x3')]},'membername':{'type':Sequelize[_0xc784('0x9')]},'projectname':{'type':Sequelize[_0xc784('0x9')]},'queue':{'type':Sequelize[_0xc784('0x9')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc784('0x9')]},'calleridnum':{'type':Sequelize[_0xc784('0x9')]},'completed':{'type':Sequelize[_0xc784('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 3b5da1a..1550b75 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 _0xf765=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','update','describe','getQuestions','SessionId','JscriptyQuestionReport','findAll','rows','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf765,0xdd));var _0x5f76=function(_0x11e9d6,_0x900eac){_0x11e9d6=_0x11e9d6-0x0;var _0x1822e5=_0xf765[_0x11e9d6];return _0x1822e5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5f76('0x0'));var rimraf=require(_0x5f76('0x1'));var zipdir=require(_0x5f76('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f76('0x3'));var moment=require('moment');var BPromise=require(_0x5f76('0x4'));var Mustache=require(_0x5f76('0x5'));var util=require('util');var path=require(_0x5f76('0x6'));var sox=require(_0x5f76('0x7'));var csv=require(_0x5f76('0x8'));var ejs=require(_0x5f76('0x9'));var fs=require('fs');var _=require(_0x5f76('0xa'));var squel=require('squel');var crypto=require(_0x5f76('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5f76('0xc'));var toCsv=require(_0x5f76('0x8'));var querystring=require(_0x5f76('0xd'));var Papa=require(_0x5f76('0xe'));var Redis=require(_0x5f76('0xf'));var authService=require(_0x5f76('0x10'));var qs=require(_0x5f76('0x11'));var as=require(_0x5f76('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f76('0x13'));var utils=require(_0x5f76('0x14'));var config=require(_0x5f76('0x15'));var licenseUtil=require(_0x5f76('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x394f03,_0x384193){_0x384193=_0x384193||0xcc;return function(_0x2de101){if(_0x2de101){return _0x394f03[_0x5f76('0x17')](_0x384193);}return _0x394f03['status'](_0x384193)[_0x5f76('0x18')]();};}function respondWithResult(_0x298123,_0x2bd535){_0x2bd535=_0x2bd535||0xc8;return function(_0x155d02){if(_0x155d02){return _0x298123[_0x5f76('0x19')](_0x2bd535)[_0x5f76('0x1a')](_0x155d02);}};}function respondWithFilteredResult(_0x365224,_0x329164){return function(_0x57c693){if(_0x57c693){var _0x148de5=_0x57c693[_0x5f76('0x1b')],_0x5cfa79=_0x329164[_0x5f76('0x1c')],_0x38f5a2=_0x329164[_0x5f76('0x1c')]+_0x329164[_0x5f76('0x1d')],_0x36a411;if(_0x38f5a2>=_0x148de5){_0x38f5a2=_0x148de5;_0x36a411=0xc8;}else{_0x36a411=0xce;}_0x365224[_0x5f76('0x19')](_0x36a411);return _0x365224[_0x5f76('0x1e')](_0x5f76('0x1f'),_0x5cfa79+'-'+_0x38f5a2+'/'+_0x148de5)[_0x5f76('0x1a')](_0x57c693);}return null;};}function patchUpdates(_0x289cd1){return function(_0x314728){try{jsonpatch['apply'](_0x314728,_0x289cd1,!![]);}catch(_0xd9573c){return BPromise[_0x5f76('0x20')](_0xd9573c);}return _0x314728[_0x5f76('0x21')]();};}function saveUpdates(_0x5b54fc,_0x577353){return function(_0x49a60e){if(_0x49a60e){return _0x49a60e['update'](_0x5b54fc)['then'](function(_0x47c893){return _0x47c893;});}return null;};}function removeEntity(_0xa735b9,_0x58a68d){return function(_0x8e70f9){if(_0x8e70f9){return _0x8e70f9[_0x5f76('0x22')]()[_0x5f76('0x23')](function(){_0xa735b9[_0x5f76('0x19')](0xcc)[_0x5f76('0x18')]();});}};}function handleEntityNotFound(_0x243ea8,_0x9f023f){return function(_0x53d223){if(!_0x53d223){_0x243ea8[_0x5f76('0x17')](0x194);}return _0x53d223;};}function handleError(_0x4e2825,_0x549297){_0x549297=_0x549297||0x1f4;return function(_0x17777c){logger[_0x5f76('0x24')](_0x17777c[_0x5f76('0x25')]);if(_0x17777c[_0x5f76('0x26')]){delete _0x17777c[_0x5f76('0x26')];}_0x4e2825['status'](_0x549297)[_0x5f76('0x27')](_0x17777c);};}exports[_0x5f76('0x28')]=function(_0xb5e5f0,_0x4f5d6b){var _0x537c8d={},_0x396520={},_0x86657e={'count':0x0,'rows':[]};var _0x1cbfae=_[_0x5f76('0x29')](db[_0x5f76('0x2a')][_0x5f76('0x2b')],function(_0x2972f6){return{'name':_0x2972f6[_0x5f76('0x2c')],'type':_0x2972f6[_0x5f76('0x2d')][_0x5f76('0x2e')]};});_0x396520['model']=_[_0x5f76('0x29')](_0x1cbfae,_0x5f76('0x26'));_0x396520['query']=_[_0x5f76('0x2f')](_0xb5e5f0[_0x5f76('0x30')]);_0x396520[_0x5f76('0x31')]=_['intersection'](_0x396520[_0x5f76('0x32')],_0x396520[_0x5f76('0x30')]);_0x537c8d[_0x5f76('0x33')]=_[_0x5f76('0x34')](_0x396520[_0x5f76('0x32')],qs[_0x5f76('0x35')](_0xb5e5f0['query'][_0x5f76('0x35')]));_0x537c8d['attributes']=_0x537c8d[_0x5f76('0x33')][_0x5f76('0x36')]?_0x537c8d[_0x5f76('0x33')]:_0x396520[_0x5f76('0x32')];if(!_0xb5e5f0[_0x5f76('0x30')][_0x5f76('0x37')](_0x5f76('0x38'))){_0x537c8d[_0x5f76('0x1d')]=qs['limit'](_0xb5e5f0['query']['limit']);_0x537c8d['offset']=qs['offset'](_0xb5e5f0[_0x5f76('0x30')][_0x5f76('0x1c')]);}_0x537c8d[_0x5f76('0x39')]=qs[_0x5f76('0x3a')](_0xb5e5f0[_0x5f76('0x30')]['sort']);_0x537c8d[_0x5f76('0x3b')]=qs['filters'](_[_0x5f76('0x3c')](_0xb5e5f0[_0x5f76('0x30')],_0x396520[_0x5f76('0x31')]),_0x1cbfae);if(_0xb5e5f0['query'][_0x5f76('0x3d')]){_0x537c8d[_0x5f76('0x3b')]=_[_0x5f76('0x3e')](_0x537c8d[_0x5f76('0x3b')],{'$or':_[_0x5f76('0x29')](_0x1cbfae,function(_0x52942a){if(_0x52942a[_0x5f76('0x2d')]!==_0x5f76('0x3f')){var _0x5e4319={};_0x5e4319[_0x52942a[_0x5f76('0x26')]]={'$like':'%'+_0xb5e5f0[_0x5f76('0x30')][_0x5f76('0x3d')]+'%'};return _0x5e4319;}})});}_0x537c8d=_[_0x5f76('0x3e')]({},_0x537c8d,_0xb5e5f0[_0x5f76('0x40')]);var _0x2ceabb={'where':_0x537c8d[_0x5f76('0x3b')]};return db[_0x5f76('0x2a')][_0x5f76('0x1b')](_0x2ceabb)[_0x5f76('0x23')](function(_0xdf810){_0x86657e[_0x5f76('0x1b')]=_0xdf810;if(_0xb5e5f0['query']['includeAll']){_0x537c8d[_0x5f76('0x41')]=[{'all':!![]}];}return db[_0x5f76('0x2a')]['findAll'](_0x537c8d);})['then'](function(_0x4026f2){_0x86657e['rows']=_0x4026f2;return _0x86657e;})[_0x5f76('0x23')](respondWithFilteredResult(_0x4f5d6b,_0x537c8d))[_0x5f76('0x42')](handleError(_0x4f5d6b,null));};exports[_0x5f76('0x43')]=function(_0x466f5f,_0x31a339){var _0x2620e3={'raw':!![],'where':{'id':_0x466f5f[_0x5f76('0x44')]['id']}},_0x3f99ba={};_0x3f99ba[_0x5f76('0x32')]=_['keys'](db['JscriptySessionReport'][_0x5f76('0x2b')]);_0x3f99ba[_0x5f76('0x30')]=_[_0x5f76('0x2f')](_0x466f5f['query']);_0x3f99ba[_0x5f76('0x31')]=_['intersection'](_0x3f99ba['model'],_0x3f99ba[_0x5f76('0x30')]);_0x2620e3[_0x5f76('0x33')]=_[_0x5f76('0x34')](_0x3f99ba[_0x5f76('0x32')],qs[_0x5f76('0x35')](_0x466f5f[_0x5f76('0x30')][_0x5f76('0x35')]));_0x2620e3['attributes']=_0x2620e3[_0x5f76('0x33')]['length']?_0x2620e3[_0x5f76('0x33')]:_0x3f99ba[_0x5f76('0x32')];if(_0x466f5f['query'][_0x5f76('0x45')]){_0x2620e3[_0x5f76('0x41')]=[{'all':!![]}];}_0x2620e3=_[_0x5f76('0x3e')]({},_0x2620e3,_0x466f5f['options']);return db[_0x5f76('0x2a')][_0x5f76('0x46')](_0x2620e3)[_0x5f76('0x23')](handleEntityNotFound(_0x31a339,null))[_0x5f76('0x23')](respondWithResult(_0x31a339,null))['catch'](handleError(_0x31a339,null));};exports[_0x5f76('0x47')]=function(_0x189573,_0x5011bc){return db[_0x5f76('0x2a')][_0x5f76('0x47')](_0x189573[_0x5f76('0x48')],{})['then'](respondWithResult(_0x5011bc,0xc9))[_0x5f76('0x42')](handleError(_0x5011bc,null));};exports[_0x5f76('0x49')]=function(_0x26420b,_0x5823bc){if(_0x26420b[_0x5f76('0x48')]['id']){delete _0x26420b[_0x5f76('0x48')]['id'];}return db[_0x5f76('0x2a')][_0x5f76('0x46')]({'where':{'id':_0x26420b[_0x5f76('0x44')]['id']}})[_0x5f76('0x23')](handleEntityNotFound(_0x5823bc,null))[_0x5f76('0x23')](saveUpdates(_0x26420b[_0x5f76('0x48')],null))[_0x5f76('0x23')](respondWithResult(_0x5823bc,null))[_0x5f76('0x42')](handleError(_0x5823bc,null));};exports[_0x5f76('0x22')]=function(_0x5d80f6,_0x2a830b){return db[_0x5f76('0x2a')][_0x5f76('0x46')]({'where':{'id':_0x5d80f6[_0x5f76('0x44')]['id']}})[_0x5f76('0x23')](handleEntityNotFound(_0x2a830b,null))[_0x5f76('0x23')](removeEntity(_0x2a830b,null))[_0x5f76('0x42')](handleError(_0x2a830b,null));};exports['describe']=function(_0xf294c2,_0xbfff55){return db[_0x5f76('0x2a')][_0x5f76('0x4a')]()[_0x5f76('0x23')](respondWithResult(_0xbfff55,null))['catch'](handleError(_0xbfff55,null));};exports[_0x5f76('0x4b')]=function(_0x3d2610,_0x3bf3b7,_0x2a54c8){var _0x5657d4={'raw':!![],'where':{}};var _0x48e08f={};var _0x579c32={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x3d2610[_0x5f76('0x44')]['id']}})[_0x5f76('0x23')](handleEntityNotFound(_0x3bf3b7,null))[_0x5f76('0x23')](function(_0x777f74){if(_0x777f74){_0x48e08f[_0x5f76('0x32')]=_[_0x5f76('0x2f')](db['JscriptyQuestionReport'][_0x5f76('0x2b')]);_0x48e08f[_0x5f76('0x30')]=_[_0x5f76('0x2f')](_0x3d2610['query']);_0x48e08f[_0x5f76('0x31')]=_[_0x5f76('0x34')](_0x48e08f['model'],_0x48e08f[_0x5f76('0x30')]);_0x5657d4[_0x5f76('0x33')]=_[_0x5f76('0x34')](_0x48e08f['model'],qs[_0x5f76('0x35')](_0x3d2610[_0x5f76('0x30')][_0x5f76('0x35')]));_0x5657d4[_0x5f76('0x33')]=_0x5657d4[_0x5f76('0x33')][_0x5f76('0x36')]?_0x5657d4[_0x5f76('0x33')]:_0x48e08f[_0x5f76('0x32')];if(!_0x3d2610[_0x5f76('0x30')][_0x5f76('0x37')](_0x5f76('0x38'))){_0x5657d4['limit']=qs['limit'](_0x3d2610[_0x5f76('0x30')][_0x5f76('0x1d')]);_0x5657d4[_0x5f76('0x1c')]=qs['offset'](_0x3d2610[_0x5f76('0x30')][_0x5f76('0x1c')]);}_0x5657d4[_0x5f76('0x39')]=qs[_0x5f76('0x3a')](_0x3d2610['query']['sort']);_0x5657d4['where']=qs[_0x5f76('0x31')](_[_0x5f76('0x3c')](_0x3d2610[_0x5f76('0x30')],_0x48e08f[_0x5f76('0x31')]));_0x5657d4[_0x5f76('0x3b')][_0x5f76('0x4c')]=_0x777f74['id'];if(_0x3d2610[_0x5f76('0x30')][_0x5f76('0x3d')]){_0x5657d4[_0x5f76('0x3b')]=_['merge'](_0x5657d4['where'],{'$or':_[_0x5f76('0x29')](_0x5657d4['attributes'],function(_0x18b863){var _0x43fe4a={};_0x43fe4a[_0x18b863]={'$like':'%'+_0x3d2610[_0x5f76('0x30')][_0x5f76('0x3d')]+'%'};return _0x43fe4a;})});}_0x5657d4=_[_0x5f76('0x3e')]({},_0x5657d4,_0x3d2610[_0x5f76('0x40')]);return db[_0x5f76('0x4d')][_0x5f76('0x1b')]({'where':_0x5657d4['where']})[_0x5f76('0x23')](function(_0x4b83f2){_0x579c32[_0x5f76('0x1b')]=_0x4b83f2;if(_0x3d2610[_0x5f76('0x30')][_0x5f76('0x45')]){_0x5657d4[_0x5f76('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x5f76('0x4e')](_0x5657d4);})[_0x5f76('0x23')](function(_0x12fa4c){_0x579c32[_0x5f76('0x4f')]=_0x12fa4c;return _0x579c32;});}})[_0x5f76('0x23')](respondWithFilteredResult(_0x3bf3b7,_0x5657d4))[_0x5f76('0x42')](handleError(_0x3bf3b7,null));}; \ No newline at end of file +var _0xbbe5=['SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','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','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','end','name','send','index','map','JscriptySessionReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','update','describe','findOne','JscriptyQuestionReport'];(function(_0x2d0bba,_0x4f178d){var _0x36f650=function(_0x1b6862){while(--_0x1b6862){_0x2d0bba['push'](_0x2d0bba['shift']());}};_0x36f650(++_0x4f178d);}(_0xbbe5,0x1db));var _0x5bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe5[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5bbe('0x0'));var rimraf=require(_0x5bbe('0x1'));var zipdir=require(_0x5bbe('0x2'));var jsonpatch=require(_0x5bbe('0x3'));var rp=require(_0x5bbe('0x4'));var moment=require('moment');var BPromise=require(_0x5bbe('0x5'));var Mustache=require(_0x5bbe('0x6'));var util=require('util');var path=require(_0x5bbe('0x7'));var sox=require(_0x5bbe('0x8'));var csv=require('to-csv');var ejs=require(_0x5bbe('0x9'));var fs=require('fs');var _=require(_0x5bbe('0xa'));var squel=require('squel');var crypto=require(_0x5bbe('0xb'));var jsforce=require(_0x5bbe('0xc'));var deskjs=require(_0x5bbe('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5bbe('0xe'));var Papa=require(_0x5bbe('0xf'));var Redis=require(_0x5bbe('0x10'));var authService=require(_0x5bbe('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5bbe('0x12'));var hardwareService=require(_0x5bbe('0x13'));var logger=require(_0x5bbe('0x14'))(_0x5bbe('0x15'));var utils=require(_0x5bbe('0x16'));var config=require(_0x5bbe('0x17'));var licenseUtil=require(_0x5bbe('0x18'));var db=require(_0x5bbe('0x19'))['db'];function respondWithStatusCode(_0x173405,_0x1cc941){_0x1cc941=_0x1cc941||0xcc;return function(_0xa68bee){if(_0xa68bee){return _0x173405[_0x5bbe('0x1a')](_0x1cc941);}return _0x173405[_0x5bbe('0x1b')](_0x1cc941)['end']();};}function respondWithResult(_0x309269,_0x36b7b9){_0x36b7b9=_0x36b7b9||0xc8;return function(_0x419af6){if(_0x419af6){return _0x309269[_0x5bbe('0x1b')](_0x36b7b9)[_0x5bbe('0x1c')](_0x419af6);}};}function respondWithFilteredResult(_0x35c81e,_0x5d7a51){return function(_0x1aeca3){if(_0x1aeca3){var _0x4da9e8=_0x1aeca3[_0x5bbe('0x1d')],_0x1e77d5=_0x5d7a51[_0x5bbe('0x1e')],_0xc36c9f=_0x5d7a51[_0x5bbe('0x1e')]+_0x5d7a51[_0x5bbe('0x1f')],_0x595ea6;if(_0xc36c9f>=_0x4da9e8){_0xc36c9f=_0x4da9e8;_0x595ea6=0xc8;}else{_0x595ea6=0xce;}_0x35c81e[_0x5bbe('0x1b')](_0x595ea6);return _0x35c81e[_0x5bbe('0x20')](_0x5bbe('0x21'),_0x1e77d5+'-'+_0xc36c9f+'/'+_0x4da9e8)[_0x5bbe('0x1c')](_0x1aeca3);}return null;};}function patchUpdates(_0x4dba82){return function(_0x241991){try{jsonpatch['apply'](_0x241991,_0x4dba82,!![]);}catch(_0x1d244f){return BPromise[_0x5bbe('0x22')](_0x1d244f);}return _0x241991[_0x5bbe('0x23')]();};}function saveUpdates(_0x4b9a4b,_0x24da5e){return function(_0x5ad19b){if(_0x5ad19b){return _0x5ad19b['update'](_0x4b9a4b)[_0x5bbe('0x24')](function(_0x527226){return _0x527226;});}return null;};}function removeEntity(_0x2670c4,_0x4d31e6){return function(_0xb58945){if(_0xb58945){return _0xb58945[_0x5bbe('0x25')]()['then'](function(){_0x2670c4['status'](0xcc)[_0x5bbe('0x26')]();});}};}function handleEntityNotFound(_0xde3450,_0x5ae599){return function(_0x16d067){if(!_0x16d067){_0xde3450['sendStatus'](0x194);}return _0x16d067;};}function handleError(_0x206c9b,_0x2087cd){_0x2087cd=_0x2087cd||0x1f4;return function(_0x3191fc){logger['error'](_0x3191fc['stack']);if(_0x3191fc[_0x5bbe('0x27')]){delete _0x3191fc[_0x5bbe('0x27')];}_0x206c9b[_0x5bbe('0x1b')](_0x2087cd)[_0x5bbe('0x28')](_0x3191fc);};}exports[_0x5bbe('0x29')]=function(_0x502c5a,_0x3092d2){var _0x3b1b2a={},_0x34f87c={},_0x36f195={'count':0x0,'rows':[]};var _0x59f19e=_[_0x5bbe('0x2a')](db[_0x5bbe('0x2b')]['rawAttributes'],function(_0x62601){return{'name':_0x62601[_0x5bbe('0x2c')],'type':_0x62601[_0x5bbe('0x2d')][_0x5bbe('0x2e')]};});_0x34f87c['model']=_[_0x5bbe('0x2a')](_0x59f19e,_0x5bbe('0x27'));_0x34f87c[_0x5bbe('0x2f')]=_[_0x5bbe('0x30')](_0x502c5a[_0x5bbe('0x2f')]);_0x34f87c['filters']=_[_0x5bbe('0x31')](_0x34f87c[_0x5bbe('0x32')],_0x34f87c['query']);_0x3b1b2a[_0x5bbe('0x33')]=_['intersection'](_0x34f87c['model'],qs[_0x5bbe('0x34')](_0x502c5a[_0x5bbe('0x2f')][_0x5bbe('0x34')]));_0x3b1b2a[_0x5bbe('0x33')]=_0x3b1b2a[_0x5bbe('0x33')][_0x5bbe('0x35')]?_0x3b1b2a['attributes']:_0x34f87c[_0x5bbe('0x32')];if(!_0x502c5a['query'][_0x5bbe('0x36')](_0x5bbe('0x37'))){_0x3b1b2a[_0x5bbe('0x1f')]=qs[_0x5bbe('0x1f')](_0x502c5a[_0x5bbe('0x2f')][_0x5bbe('0x1f')]);_0x3b1b2a[_0x5bbe('0x1e')]=qs['offset'](_0x502c5a['query'][_0x5bbe('0x1e')]);}_0x3b1b2a[_0x5bbe('0x38')]=qs[_0x5bbe('0x39')](_0x502c5a['query'][_0x5bbe('0x39')]);_0x3b1b2a[_0x5bbe('0x3a')]=qs['filters'](_['pick'](_0x502c5a[_0x5bbe('0x2f')],_0x34f87c[_0x5bbe('0x3b')]),_0x59f19e);if(_0x502c5a[_0x5bbe('0x2f')][_0x5bbe('0x3c')]){_0x3b1b2a[_0x5bbe('0x3a')]=_[_0x5bbe('0x3d')](_0x3b1b2a[_0x5bbe('0x3a')],{'$or':_['map'](_0x59f19e,function(_0x2314d1){if(_0x2314d1['type']!==_0x5bbe('0x3e')){var _0x25255b={};_0x25255b[_0x2314d1['name']]={'$like':'%'+_0x502c5a[_0x5bbe('0x2f')]['filter']+'%'};return _0x25255b;}})});}_0x3b1b2a=_[_0x5bbe('0x3d')]({},_0x3b1b2a,_0x502c5a[_0x5bbe('0x3f')]);var _0x24962f={'where':_0x3b1b2a[_0x5bbe('0x3a')]};return db['JscriptySessionReport']['count'](_0x24962f)[_0x5bbe('0x24')](function(_0x5f23dc){_0x36f195[_0x5bbe('0x1d')]=_0x5f23dc;if(_0x502c5a[_0x5bbe('0x2f')][_0x5bbe('0x40')]){_0x3b1b2a[_0x5bbe('0x41')]=[{'all':!![]}];}return db[_0x5bbe('0x2b')][_0x5bbe('0x42')](_0x3b1b2a);})[_0x5bbe('0x24')](function(_0x12945e){_0x36f195[_0x5bbe('0x43')]=_0x12945e;return _0x36f195;})['then'](respondWithFilteredResult(_0x3092d2,_0x3b1b2a))[_0x5bbe('0x44')](handleError(_0x3092d2,null));};exports['show']=function(_0x4a674c,_0x33f319){var _0x3e8656={'raw':!![],'where':{'id':_0x4a674c[_0x5bbe('0x45')]['id']}},_0x434945={};_0x434945['model']=_[_0x5bbe('0x30')](db[_0x5bbe('0x2b')][_0x5bbe('0x46')]);_0x434945[_0x5bbe('0x2f')]=_['keys'](_0x4a674c[_0x5bbe('0x2f')]);_0x434945[_0x5bbe('0x3b')]=_[_0x5bbe('0x31')](_0x434945[_0x5bbe('0x32')],_0x434945['query']);_0x3e8656[_0x5bbe('0x33')]=_[_0x5bbe('0x31')](_0x434945[_0x5bbe('0x32')],qs[_0x5bbe('0x34')](_0x4a674c[_0x5bbe('0x2f')]['fields']));_0x3e8656[_0x5bbe('0x33')]=_0x3e8656[_0x5bbe('0x33')][_0x5bbe('0x35')]?_0x3e8656['attributes']:_0x434945[_0x5bbe('0x32')];if(_0x4a674c[_0x5bbe('0x2f')][_0x5bbe('0x40')]){_0x3e8656[_0x5bbe('0x41')]=[{'all':!![]}];}_0x3e8656=_[_0x5bbe('0x3d')]({},_0x3e8656,_0x4a674c['options']);return db[_0x5bbe('0x2b')][_0x5bbe('0x47')](_0x3e8656)['then'](handleEntityNotFound(_0x33f319,null))[_0x5bbe('0x24')](respondWithResult(_0x33f319,null))[_0x5bbe('0x44')](handleError(_0x33f319,null));};exports[_0x5bbe('0x48')]=function(_0x2cd0ed,_0x2c3a20){return db['JscriptySessionReport'][_0x5bbe('0x48')](_0x2cd0ed[_0x5bbe('0x49')],{})[_0x5bbe('0x24')](respondWithResult(_0x2c3a20,0xc9))[_0x5bbe('0x44')](handleError(_0x2c3a20,null));};exports[_0x5bbe('0x4a')]=function(_0x323804,_0x447c90){if(_0x323804[_0x5bbe('0x49')]['id']){delete _0x323804[_0x5bbe('0x49')]['id'];}return db[_0x5bbe('0x2b')]['find']({'where':{'id':_0x323804['params']['id']}})[_0x5bbe('0x24')](handleEntityNotFound(_0x447c90,null))['then'](saveUpdates(_0x323804['body'],null))[_0x5bbe('0x24')](respondWithResult(_0x447c90,null))[_0x5bbe('0x44')](handleError(_0x447c90,null));};exports[_0x5bbe('0x25')]=function(_0x245af6,_0x34686e){return db[_0x5bbe('0x2b')][_0x5bbe('0x47')]({'where':{'id':_0x245af6[_0x5bbe('0x45')]['id']}})['then'](handleEntityNotFound(_0x34686e,null))['then'](removeEntity(_0x34686e,null))[_0x5bbe('0x44')](handleError(_0x34686e,null));};exports[_0x5bbe('0x4b')]=function(_0x5d1764,_0x13fb08){return db[_0x5bbe('0x2b')][_0x5bbe('0x4b')]()[_0x5bbe('0x24')](respondWithResult(_0x13fb08,null))[_0x5bbe('0x44')](handleError(_0x13fb08,null));};exports['getQuestions']=function(_0x55cf6c,_0x58358b,_0x22b091){var _0x3ab9b5={'raw':!![],'where':{}};var _0x3f4002={};var _0x5dc853={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x5bbe('0x4c')]({'where':{'id':_0x55cf6c[_0x5bbe('0x45')]['id']}})[_0x5bbe('0x24')](handleEntityNotFound(_0x58358b,null))[_0x5bbe('0x24')](function(_0x526a2e){if(_0x526a2e){_0x3f4002[_0x5bbe('0x32')]=_[_0x5bbe('0x30')](db[_0x5bbe('0x4d')]['rawAttributes']);_0x3f4002['query']=_[_0x5bbe('0x30')](_0x55cf6c['query']);_0x3f4002['filters']=_[_0x5bbe('0x31')](_0x3f4002[_0x5bbe('0x32')],_0x3f4002[_0x5bbe('0x2f')]);_0x3ab9b5[_0x5bbe('0x33')]=_[_0x5bbe('0x31')](_0x3f4002[_0x5bbe('0x32')],qs[_0x5bbe('0x34')](_0x55cf6c[_0x5bbe('0x2f')][_0x5bbe('0x34')]));_0x3ab9b5[_0x5bbe('0x33')]=_0x3ab9b5['attributes'][_0x5bbe('0x35')]?_0x3ab9b5[_0x5bbe('0x33')]:_0x3f4002['model'];if(!_0x55cf6c[_0x5bbe('0x2f')][_0x5bbe('0x36')]('nolimit')){_0x3ab9b5[_0x5bbe('0x1f')]=qs[_0x5bbe('0x1f')](_0x55cf6c[_0x5bbe('0x2f')][_0x5bbe('0x1f')]);_0x3ab9b5['offset']=qs[_0x5bbe('0x1e')](_0x55cf6c[_0x5bbe('0x2f')][_0x5bbe('0x1e')]);}_0x3ab9b5[_0x5bbe('0x38')]=qs[_0x5bbe('0x39')](_0x55cf6c[_0x5bbe('0x2f')][_0x5bbe('0x39')]);_0x3ab9b5[_0x5bbe('0x3a')]=qs[_0x5bbe('0x3b')](_['pick'](_0x55cf6c['query'],_0x3f4002[_0x5bbe('0x3b')]));_0x3ab9b5[_0x5bbe('0x3a')][_0x5bbe('0x4e')]=_0x526a2e['id'];if(_0x55cf6c[_0x5bbe('0x2f')][_0x5bbe('0x3c')]){_0x3ab9b5[_0x5bbe('0x3a')]=_[_0x5bbe('0x3d')](_0x3ab9b5[_0x5bbe('0x3a')],{'$or':_[_0x5bbe('0x2a')](_0x3ab9b5[_0x5bbe('0x33')],function(_0x179a29){var _0x138aea={};_0x138aea[_0x179a29]={'$like':'%'+_0x55cf6c[_0x5bbe('0x2f')][_0x5bbe('0x3c')]+'%'};return _0x138aea;})});}_0x3ab9b5=_[_0x5bbe('0x3d')]({},_0x3ab9b5,_0x55cf6c['options']);return db[_0x5bbe('0x4d')][_0x5bbe('0x1d')]({'where':_0x3ab9b5[_0x5bbe('0x3a')]})[_0x5bbe('0x24')](function(_0x287f9f){_0x5dc853['count']=_0x287f9f;if(_0x55cf6c[_0x5bbe('0x2f')][_0x5bbe('0x40')]){_0x3ab9b5[_0x5bbe('0x41')]=[{'all':!![]}];}return db[_0x5bbe('0x4d')][_0x5bbe('0x42')](_0x3ab9b5);})[_0x5bbe('0x24')](function(_0x2590f6){_0x5dc853[_0x5bbe('0x43')]=_0x2590f6;return _0x5dc853;});}})[_0x5bbe('0x24')](respondWithFilteredResult(_0x58358b,_0x3ab9b5))[_0x5bbe('0x44')](handleError(_0x58358b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 9e596a3..4af6747 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 _0x88c8=['api','moment','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger'];(function(_0x256af2,_0x10630b){var _0x279757=function(_0x44431d){while(--_0x44431d){_0x256af2['push'](_0x256af2['shift']());}};_0x279757(++_0x10630b);}(_0x88c8,0xca));var _0x888c=function(_0x955613,_0x29ac04){_0x955613=_0x955613-0x0;var _0x3709fa=_0x88c8[_0x955613];return _0x3709fa;};'use strict';var _=require('lodash');var util=require(_0x888c('0x0'));var logger=require(_0x888c('0x1'))(_0x888c('0x2'));var moment=require(_0x888c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x888c('0x4'));var rimraf=require(_0x888c('0x5'));var config=require(_0x888c('0x6'));var attributes=require(_0x888c('0x7'));module[_0x888c('0x8')]=function(_0x1b538d,_0x4211dd){return _0x1b538d[_0x888c('0x9')](_0x888c('0xa'),attributes,{'tableName':_0x888c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98aa=['moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','util','api'];(function(_0x57d712,_0x57dca1){var _0xb6c0c1=function(_0x2ecc3b){while(--_0x2ecc3b){_0x57d712['push'](_0x57d712['shift']());}};_0xb6c0c1(++_0x57dca1);}(_0x98aa,0x11c));var _0xa98a=function(_0x360581,_0x208bdc){_0x360581=_0x360581-0x0;var _0x3c0f5c=_0x98aa[_0x360581];return _0x3c0f5c;};'use strict';var _=require('lodash');var util=require(_0xa98a('0x0'));var logger=require('../../config/logger')(_0xa98a('0x1'));var moment=require(_0xa98a('0x2'));var BPromise=require(_0xa98a('0x3'));var rp=require(_0xa98a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa98a('0x5'));var config=require(_0xa98a('0x6'));var attributes=require(_0xa98a('0x7'));module[_0xa98a('0x8')]=function(_0x364c75,_0x2c32ae){return _0x364c75[_0xa98a('0x9')]('JscriptySessionReport',attributes,{'tableName':_0xa98a('0xa'),'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 67493fa..9d0a849 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 _0xdbe1=['then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x488c0b,_0x975b3c){var _0x38e8e4=function(_0x38aa6d){while(--_0x38aa6d){_0x488c0b['push'](_0x488c0b['shift']());}};_0x38e8e4(++_0x975b3c);}(_0xdbe1,0x137));var _0x1dbe=function(_0x1c4302,_0x67f07){_0x1c4302=_0x1c4302-0x0;var _0x48c453=_0xdbe1[_0x1c4302];return _0x48c453;};'use strict';var _=require(_0x1dbe('0x0'));var util=require('util');var moment=require(_0x1dbe('0x1'));var BPromise=require('bluebird');var rs=require(_0x1dbe('0x2'));var fs=require('fs');var Redis=require(_0x1dbe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1dbe('0x4'));var logger=require(_0x1dbe('0x5'))(_0x1dbe('0x6'));var config=require('../../config/environment');var jayson=require(_0x1dbe('0x7'));var client=jayson[_0x1dbe('0x8')][_0x1dbe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbf2b82,_0x273807,_0x41d38d){return new BPromise(function(_0x40ce7e,_0x3267cf){return client[_0x1dbe('0xa')](_0xbf2b82,_0x41d38d)[_0x1dbe('0xb')](function(_0x246d18){logger[_0x1dbe('0xc')](_0x1dbe('0xd'),_0x273807,_0x1dbe('0xe'));logger[_0x1dbe('0xf')](_0x1dbe('0x10'),_0x273807,'request\x20sent',JSON[_0x1dbe('0x11')](_0x246d18));if(_0x246d18[_0x1dbe('0x12')]){if(_0x246d18[_0x1dbe('0x12')][_0x1dbe('0x13')]===0x1f4){logger[_0x1dbe('0x12')](_0x1dbe('0xd'),_0x273807,_0x246d18['error'][_0x1dbe('0x14')]);return _0x3267cf(_0x246d18[_0x1dbe('0x12')][_0x1dbe('0x14')]);}logger[_0x1dbe('0x12')](_0x1dbe('0xd'),_0x273807,_0x246d18[_0x1dbe('0x12')][_0x1dbe('0x14')]);return _0x40ce7e(_0x246d18[_0x1dbe('0x12')][_0x1dbe('0x14')]);}else{logger[_0x1dbe('0xc')](_0x1dbe('0xd'),_0x273807,_0x1dbe('0xe'));_0x40ce7e(_0x246d18[_0x1dbe('0x15')][_0x1dbe('0x14')]);}})[_0x1dbe('0x16')](function(_0x466c0d){logger[_0x1dbe('0x12')](_0x1dbe('0xd'),_0x273807,_0x466c0d);_0x3267cf(_0x466c0d);});});} \ No newline at end of file +var _0x22c9=['result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message'];(function(_0x575d72,_0xca45c4){var _0x3559a2=function(_0x1f3efd){while(--_0x1f3efd){_0x575d72['push'](_0x575d72['shift']());}};_0x3559a2(++_0xca45c4);}(_0x22c9,0x8b));var _0x922c=function(_0xe9c8e4,_0x3aa2f6){_0xe9c8e4=_0xe9c8e4-0x0;var _0x2037fa=_0x22c9[_0xe9c8e4];return _0x2037fa;};'use strict';var _=require(_0x922c('0x0'));var util=require(_0x922c('0x1'));var moment=require(_0x922c('0x2'));var BPromise=require(_0x922c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x922c('0x4'))['db'];var utils=require(_0x922c('0x5'));var logger=require(_0x922c('0x6'))(_0x922c('0x7'));var config=require(_0x922c('0x8'));var jayson=require(_0x922c('0x9'));var client=jayson[_0x922c('0xa')][_0x922c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35451c,_0x1408d3,_0x395fc1){return new BPromise(function(_0xe8b783,_0x9fac83){return client[_0x922c('0xc')](_0x35451c,_0x395fc1)[_0x922c('0xd')](function(_0x5b4599){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x1408d3,'request\x20sent');logger[_0x922c('0xe')](_0x922c('0xf'),_0x1408d3,_0x922c('0x10'),JSON[_0x922c('0x11')](_0x5b4599));if(_0x5b4599[_0x922c('0x12')]){if(_0x5b4599[_0x922c('0x12')][_0x922c('0x13')]===0x1f4){logger['error'](_0x922c('0x14'),_0x1408d3,_0x5b4599[_0x922c('0x12')][_0x922c('0x15')]);return _0x9fac83(_0x5b4599['error']['message']);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x1408d3,_0x5b4599['error'][_0x922c('0x15')]);return _0xe8b783(_0x5b4599[_0x922c('0x12')][_0x922c('0x15')]);}else{logger['info'](_0x922c('0x14'),_0x1408d3,'request\x20sent');_0xe8b783(_0x5b4599[_0x922c('0x16')][_0x922c('0x15')]);}})['catch'](function(_0x567856){logger[_0x922c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x1408d3,_0x567856);_0x9fac83(_0x567856);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index b3d85b5..e781859 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 _0xf958=['../../config/environment','./license.controller','get','put','update','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x59ce74,_0x97a4de){var _0x3af230=function(_0x265e16){while(--_0x265e16){_0x59ce74['push'](_0x59ce74['shift']());}};_0x3af230(++_0x97a4de);}(_0xf958,0x1a7));var _0x8f95=function(_0x2f1550,_0x498ff7){_0x2f1550=_0x2f1550-0x0;var _0xe159e9=_0xf958[_0x2f1550];return _0xe159e9;};'use strict';var multer=require('multer');var util=require(_0x8f95('0x0'));var path=require(_0x8f95('0x1'));var timeout=require(_0x8f95('0x2'));var express=require('express');var router=express[_0x8f95('0x3')]();var auth=require(_0x8f95('0x4'));var interaction=require(_0x8f95('0x5'));var config=require(_0x8f95('0x6'));var controller=require(_0x8f95('0x7'));router[_0x8f95('0x8')]('/',controller['index']);router[_0x8f95('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8f95('0xa')]);module['exports']=router; \ No newline at end of file +var _0x26ca=['express','Router','../../components/auth/service','../../components/interaction/service','./license.controller','index','put','isAuthenticated','update','multer','util','path','connect-timeout'];(function(_0x5d6eec,_0x2e796b){var _0x5f028f=function(_0x45107e){while(--_0x45107e){_0x5d6eec['push'](_0x5d6eec['shift']());}};_0x5f028f(++_0x2e796b);}(_0x26ca,0x1dd));var _0xa26c=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x26ca[_0x264b9b];return _0x4c7a0e;};'use strict';var multer=require(_0xa26c('0x0'));var util=require(_0xa26c('0x1'));var path=require(_0xa26c('0x2'));var timeout=require(_0xa26c('0x3'));var express=require(_0xa26c('0x4'));var router=express[_0xa26c('0x5')]();var auth=require(_0xa26c('0x6'));var interaction=require(_0xa26c('0x7'));var config=require('../../config/environment');var controller=require(_0xa26c('0x8'));router['get']('/',controller[_0xa26c('0x9')]);router[_0xa26c('0xa')]('/:id',auth[_0xa26c('0xb')](),controller[_0xa26c('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 79b08ff..9b2fed8 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 _0x46ed=['sequelize','exports','STRING','INTEGER'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x46ed,0x168));var _0xd46e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x46ed[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd46e('0x2')]},'data2':{'type':Sequelize[_0xd46e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd46e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ef3=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x4b6827,_0x42d422){var _0x43fad1=function(_0x18b171){while(--_0x18b171){_0x4b6827['push'](_0x4b6827['shift']());}};_0x43fad1(++_0x42d422);}(_0x2ef3,0xba));var _0x32ef=function(_0x9138c0,_0x4002e1){_0x9138c0=_0x9138c0-0x0;var _0x2a8abb=_0x2ef3[_0x9138c0];return _0x2a8abb;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'license':{'type':Sequelize[_0x32ef('0x2')]},'data1':{'type':Sequelize[_0x32ef('0x3')]},'data2':{'type':Sequelize[_0x32ef('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x32ef('0x4')],'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 3981a99..6840f3a 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 _0xa276=['../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','model','License','rawAttributes','keys','query','filters','intersection','attributes','fields','merge','options','getLicense','catch','body','find','params','get','checkLicense','demo','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xa276,0x9a));var _0x6a27=function(_0x2e0ec8,_0x27c06d){_0x2e0ec8=_0x2e0ec8-0x0;var _0x54f786=_0xa276[_0x2e0ec8];return _0x54f786;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6a27('0x0'));var rimraf=require(_0x6a27('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a27('0x2'));var rp=require(_0x6a27('0x3'));var moment=require('moment');var BPromise=require(_0x6a27('0x4'));var Mustache=require(_0x6a27('0x5'));var util=require(_0x6a27('0x6'));var path=require('path');var sox=require(_0x6a27('0x7'));var csv=require(_0x6a27('0x8'));var ejs=require(_0x6a27('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6a27('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a27('0xb'));var Papa=require(_0x6a27('0xc'));var Redis=require(_0x6a27('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6a27('0xe'));var hardwareService=require(_0x6a27('0xf'));var logger=require(_0x6a27('0x10'))(_0x6a27('0x11'));var utils=require(_0x6a27('0x12'));var config=require(_0x6a27('0x13'));var licenseUtil=require(_0x6a27('0x14'));var db=require(_0x6a27('0x15'))['db'];function respondWithStatusCode(_0x394307,_0x4a7209){_0x4a7209=_0x4a7209||0xcc;return function(_0x96472c){if(_0x96472c){return _0x394307['sendStatus'](_0x4a7209);}return _0x394307['status'](_0x4a7209)[_0x6a27('0x16')]();};}function respondWithResult(_0x1e987f,_0x39ef85){_0x39ef85=_0x39ef85||0xc8;return function(_0x5b28c6){if(_0x5b28c6){return _0x1e987f[_0x6a27('0x17')](_0x39ef85)[_0x6a27('0x18')](_0x5b28c6);}};}function respondWithFilteredResult(_0x318b61,_0x8f297b){return function(_0x294ac7){if(_0x294ac7){var _0x523e6d=_0x294ac7[_0x6a27('0x19')],_0x57a347=_0x8f297b[_0x6a27('0x1a')],_0xcd0e2b=_0x8f297b[_0x6a27('0x1a')]+_0x8f297b[_0x6a27('0x1b')],_0x5bb1f3;if(_0xcd0e2b>=_0x523e6d){_0xcd0e2b=_0x523e6d;_0x5bb1f3=0xc8;}else{_0x5bb1f3=0xce;}_0x318b61['status'](_0x5bb1f3);return _0x318b61[_0x6a27('0x1c')](_0x6a27('0x1d'),_0x57a347+'-'+_0xcd0e2b+'/'+_0x523e6d)[_0x6a27('0x18')](_0x294ac7);}return null;};}function patchUpdates(_0x192255){return function(_0x50ddcc){try{jsonpatch[_0x6a27('0x1e')](_0x50ddcc,_0x192255,!![]);}catch(_0x1edfc6){return BPromise[_0x6a27('0x1f')](_0x1edfc6);}return _0x50ddcc[_0x6a27('0x20')]();};}function saveUpdates(_0x57649a,_0x531d60){return function(_0x4528ef){if(_0x4528ef){return _0x4528ef[_0x6a27('0x21')](_0x57649a)['then'](function(_0x1fbd6e){return _0x1fbd6e;});}return null;};}function removeEntity(_0x2a7fdf,_0x13fc15){return function(_0x167076){if(_0x167076){return _0x167076[_0x6a27('0x22')]()[_0x6a27('0x23')](function(){_0x2a7fdf[_0x6a27('0x17')](0xcc)[_0x6a27('0x16')]();});}};}function handleEntityNotFound(_0x5e3a2e,_0x241029){return function(_0x2beb14){if(!_0x2beb14){_0x5e3a2e[_0x6a27('0x24')](0x194);}return _0x2beb14;};}function handleError(_0x7f1408,_0x2b3e5e){_0x2b3e5e=_0x2b3e5e||0x1f4;return function(_0x5f4897){logger['error'](_0x5f4897[_0x6a27('0x25')]);if(_0x5f4897[_0x6a27('0x26')]){delete _0x5f4897[_0x6a27('0x26')];}_0x7f1408[_0x6a27('0x17')](_0x2b3e5e)['send'](_0x5f4897);};}var utilLicense=require(_0x6a27('0x14'));exports['index']=function(_0x5cb004,_0x24f378){var _0x16032a={'raw':!![],'where':{'id':0x1}},_0x4d1711={};_0x4d1711[_0x6a27('0x27')]=_['keys'](db[_0x6a27('0x28')][_0x6a27('0x29')]);_0x4d1711['query']=_[_0x6a27('0x2a')](_0x5cb004[_0x6a27('0x2b')]);_0x4d1711[_0x6a27('0x2c')]=_[_0x6a27('0x2d')](_0x4d1711[_0x6a27('0x27')],_0x4d1711[_0x6a27('0x2b')]);_0x16032a[_0x6a27('0x2e')]=_[_0x6a27('0x2d')](_0x4d1711['model'],qs[_0x6a27('0x2f')](_0x5cb004[_0x6a27('0x2b')][_0x6a27('0x2f')]));_0x16032a[_0x6a27('0x2e')]=_0x16032a['attributes']['length']?_0x16032a[_0x6a27('0x2e')]:_0x4d1711['model'];_0x16032a=_[_0x6a27('0x30')]({},_0x16032a,_0x5cb004[_0x6a27('0x31')]);return utilLicense[_0x6a27('0x32')](_0x16032a)[_0x6a27('0x23')](respondWithResult(_0x24f378,null))[_0x6a27('0x33')](handleError(_0x24f378,null));};exports[_0x6a27('0x21')]=function(_0x2de7c4,_0x2fe07a){if(_0x2de7c4['body']['id']){delete _0x2de7c4[_0x6a27('0x34')]['id'];}return db['License'][_0x6a27('0x35')]({'where':{'id':_0x2de7c4[_0x6a27('0x36')]['id']}})[_0x6a27('0x23')](handleEntityNotFound(_0x2fe07a,null))[_0x6a27('0x23')](function(_0x164d6f){var _0x47d628=_0x164d6f[_0x6a27('0x37')]({'plain':!![]});return utilLicense[_0x6a27('0x38')](_0x47d628,_0x2de7c4['body']['key']);})[_0x6a27('0x23')](function(_0x16683d){if(!_0x16683d[_0x6a27('0x39')]){return saveUpdates(_0x2de7c4[_0x6a27('0x34')],null);}return _0x16683d;})[_0x6a27('0x23')](respondWithResult(_0x2fe07a,null))[_0x6a27('0x33')](handleError(_0x2fe07a,null));}; \ No newline at end of file +var _0xca9e=['params','get','checkLicense','key','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','set','Content-Range','reject','update','then','destroy','error','name','send','index','model','keys','License','rawAttributes','query','intersection','attributes','fields','length','options','getLicense','catch','body','find'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xca9e,0x136));var _0xeca9=function(_0x53e1da,_0x1e7b66){_0x53e1da=_0x53e1da-0x0;var _0x330143=_0xca9e[_0x53e1da];return _0x330143;};'use strict';var pdf=require(_0xeca9('0x0'));var emlformat=require(_0xeca9('0x1'));var rimraf=require(_0xeca9('0x2'));var zipdir=require(_0xeca9('0x3'));var jsonpatch=require(_0xeca9('0x4'));var rp=require(_0xeca9('0x5'));var moment=require(_0xeca9('0x6'));var BPromise=require(_0xeca9('0x7'));var Mustache=require(_0xeca9('0x8'));var util=require(_0xeca9('0x9'));var path=require(_0xeca9('0xa'));var sox=require(_0xeca9('0xb'));var csv=require(_0xeca9('0xc'));var ejs=require(_0xeca9('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeca9('0xe'));var crypto=require(_0xeca9('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeca9('0xc'));var querystring=require(_0xeca9('0x10'));var Papa=require(_0xeca9('0x11'));var Redis=require('ioredis');var authService=require(_0xeca9('0x12'));var qs=require(_0xeca9('0x13'));var as=require(_0xeca9('0x14'));var hardwareService=require(_0xeca9('0x15'));var logger=require(_0xeca9('0x16'))(_0xeca9('0x17'));var utils=require('../../config/utils');var config=require(_0xeca9('0x18'));var licenseUtil=require(_0xeca9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27ca6f,_0x4b2ae1){_0x4b2ae1=_0x4b2ae1||0xcc;return function(_0x3c6cc7){if(_0x3c6cc7){return _0x27ca6f[_0xeca9('0x1a')](_0x4b2ae1);}return _0x27ca6f['status'](_0x4b2ae1)[_0xeca9('0x1b')]();};}function respondWithResult(_0x384ae2,_0x1ba9e9){_0x1ba9e9=_0x1ba9e9||0xc8;return function(_0x4d65ee){if(_0x4d65ee){return _0x384ae2[_0xeca9('0x1c')](_0x1ba9e9)[_0xeca9('0x1d')](_0x4d65ee);}};}function respondWithFilteredResult(_0x910814,_0x6e9fd4){return function(_0x551393){if(_0x551393){var _0x520411=_0x551393[_0xeca9('0x1e')],_0x964e05=_0x6e9fd4[_0xeca9('0x1f')],_0x77cb=_0x6e9fd4['offset']+_0x6e9fd4['limit'],_0x553965;if(_0x77cb>=_0x520411){_0x77cb=_0x520411;_0x553965=0xc8;}else{_0x553965=0xce;}_0x910814['status'](_0x553965);return _0x910814[_0xeca9('0x20')](_0xeca9('0x21'),_0x964e05+'-'+_0x77cb+'/'+_0x520411)[_0xeca9('0x1d')](_0x551393);}return null;};}function patchUpdates(_0x5dde5f){return function(_0xf1ef9f){try{jsonpatch['apply'](_0xf1ef9f,_0x5dde5f,!![]);}catch(_0x5bbdce){return BPromise[_0xeca9('0x22')](_0x5bbdce);}return _0xf1ef9f['save']();};}function saveUpdates(_0x31720b,_0x1c4dd6){return function(_0x52464f){if(_0x52464f){return _0x52464f[_0xeca9('0x23')](_0x31720b)[_0xeca9('0x24')](function(_0x55cd76){return _0x55cd76;});}return null;};}function removeEntity(_0x3647ed,_0x5279d0){return function(_0x3a3608){if(_0x3a3608){return _0x3a3608[_0xeca9('0x25')]()[_0xeca9('0x24')](function(){_0x3647ed['status'](0xcc)[_0xeca9('0x1b')]();});}};}function handleEntityNotFound(_0x466883,_0x515e63){return function(_0x4593b5){if(!_0x4593b5){_0x466883[_0xeca9('0x1a')](0x194);}return _0x4593b5;};}function handleError(_0x2b2c70,_0x26bb0c){_0x26bb0c=_0x26bb0c||0x1f4;return function(_0x498f4a){logger[_0xeca9('0x26')](_0x498f4a['stack']);if(_0x498f4a[_0xeca9('0x27')]){delete _0x498f4a[_0xeca9('0x27')];}_0x2b2c70[_0xeca9('0x1c')](_0x26bb0c)[_0xeca9('0x28')](_0x498f4a);};}var utilLicense=require(_0xeca9('0x19'));exports[_0xeca9('0x29')]=function(_0x85cbd4,_0x7fcf4b){var _0x467979={'raw':!![],'where':{'id':0x1}},_0x271720={};_0x271720[_0xeca9('0x2a')]=_[_0xeca9('0x2b')](db[_0xeca9('0x2c')][_0xeca9('0x2d')]);_0x271720[_0xeca9('0x2e')]=_['keys'](_0x85cbd4['query']);_0x271720['filters']=_[_0xeca9('0x2f')](_0x271720['model'],_0x271720[_0xeca9('0x2e')]);_0x467979[_0xeca9('0x30')]=_[_0xeca9('0x2f')](_0x271720[_0xeca9('0x2a')],qs[_0xeca9('0x31')](_0x85cbd4[_0xeca9('0x2e')]['fields']));_0x467979[_0xeca9('0x30')]=_0x467979['attributes'][_0xeca9('0x32')]?_0x467979[_0xeca9('0x30')]:_0x271720[_0xeca9('0x2a')];_0x467979=_['merge']({},_0x467979,_0x85cbd4[_0xeca9('0x33')]);return utilLicense[_0xeca9('0x34')](_0x467979)[_0xeca9('0x24')](respondWithResult(_0x7fcf4b,null))[_0xeca9('0x35')](handleError(_0x7fcf4b,null));};exports['update']=function(_0x41900f,_0x4875f8){if(_0x41900f[_0xeca9('0x36')]['id']){delete _0x41900f[_0xeca9('0x36')]['id'];}return db[_0xeca9('0x2c')][_0xeca9('0x37')]({'where':{'id':_0x41900f[_0xeca9('0x38')]['id']}})[_0xeca9('0x24')](handleEntityNotFound(_0x4875f8,null))['then'](function(_0x41ef3c){var _0x2424df=_0x41ef3c[_0xeca9('0x39')]({'plain':!![]});return utilLicense[_0xeca9('0x3a')](_0x2424df,_0x41900f[_0xeca9('0x36')][_0xeca9('0x3b')]);})[_0xeca9('0x24')](function(_0x54d9cf){if(!_0x54d9cf[_0xeca9('0x3c')]){return saveUpdates(_0x41900f[_0xeca9('0x36')],null);}return _0x54d9cf;})[_0xeca9('0x24')](respondWithResult(_0x4875f8,null))[_0xeca9('0x35')](handleError(_0x4875f8,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 7396072..168618d 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 _0xa61d=['rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','moment','request-promise','path'];(function(_0x5c9649,_0x1aac13){var _0x10572f=function(_0x63cdd){while(--_0x63cdd){_0x5c9649['push'](_0x5c9649['shift']());}};_0x10572f(++_0x1aac13);}(_0xa61d,0x7f));var _0xda61=function(_0x3cca7a,_0x109a23){_0x3cca7a=_0x3cca7a-0x0;var _0x34e717=_0xa61d[_0x3cca7a];return _0x34e717;};'use strict';var _=require(_0xda61('0x0'));var util=require(_0xda61('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xda61('0x2'));var BPromise=require('bluebird');var rp=require(_0xda61('0x3'));var fs=require('fs');var path=require(_0xda61('0x4'));var rimraf=require(_0xda61('0x5'));var config=require(_0xda61('0x6'));var attributes=require(_0xda61('0x7'));module[_0xda61('0x8')]=function(_0x2b94b9,_0x30781e){return _0x2b94b9[_0xda61('0x9')](_0xda61('0xa'),attributes,{'tableName':_0xda61('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x931f=['path','rimraf','exports','license','lodash','util','moment','request-promise'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x931f,0x184));var _0xf931=function(_0x204a28,_0x359c57){_0x204a28=_0x204a28-0x0;var _0x2d8e3d=_0x931f[_0x204a28];return _0x2d8e3d;};'use strict';var _=require(_0xf931('0x0'));var util=require(_0xf931('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf931('0x2'));var BPromise=require('bluebird');var rp=require(_0xf931('0x3'));var fs=require('fs');var path=require(_0xf931('0x4'));var rimraf=require(_0xf931('0x5'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0xf931('0x6')]=function(_0x234a31,_0x20557e){return _0x234a31['define']('License',attributes,{'tableName':_0xf931('0x7'),'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 b29e177..d532502 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 _0x96d9=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x45801c,_0x2db8e2){var _0x2ee28e=function(_0x2de68a){while(--_0x2de68a){_0x45801c['push'](_0x45801c['shift']());}};_0x2ee28e(++_0x2db8e2);}(_0x96d9,0xea));var _0x996d=function(_0x1848ed,_0x555123){_0x1848ed=_0x1848ed-0x0;var _0x5dd96c=_0x96d9[_0x1848ed];return _0x5dd96c;};'use strict';var _=require(_0x996d('0x0'));var util=require(_0x996d('0x1'));var moment=require(_0x996d('0x2'));var BPromise=require(_0x996d('0x3'));var rs=require(_0x996d('0x4'));var fs=require('fs');var Redis=require(_0x996d('0x5'));var db=require(_0x996d('0x6'))['db'];var utils=require(_0x996d('0x7'));var logger=require('../../config/logger')(_0x996d('0x8'));var config=require(_0x996d('0x9'));var jayson=require(_0x996d('0xa'));var client=jayson[_0x996d('0xb')][_0x996d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x427a02,_0x327d3e,_0x4d65b5){return new BPromise(function(_0x40c142,_0x344899){return client[_0x996d('0xd')](_0x427a02,_0x4d65b5)[_0x996d('0xe')](function(_0x31694c){logger['info'](_0x996d('0xf'),_0x327d3e,_0x996d('0x10'));logger[_0x996d('0x11')](_0x996d('0x12'),_0x327d3e,'request\x20sent',JSON[_0x996d('0x13')](_0x31694c));if(_0x31694c[_0x996d('0x14')]){if(_0x31694c['error']['code']===0x1f4){logger['error'](_0x996d('0xf'),_0x327d3e,_0x31694c[_0x996d('0x14')]['message']);return _0x344899(_0x31694c[_0x996d('0x14')][_0x996d('0x15')]);}logger['error'](_0x996d('0xf'),_0x327d3e,_0x31694c[_0x996d('0x14')][_0x996d('0x15')]);return _0x40c142(_0x31694c['error'][_0x996d('0x15')]);}else{logger['info'](_0x996d('0xf'),_0x327d3e,_0x996d('0x10'));_0x40c142(_0x31694c[_0x996d('0x16')][_0x996d('0x15')]);}})[_0x996d('0x17')](function(_0x87f980){logger[_0x996d('0x14')]('License,\x20%s,\x20%s',_0x327d3e,_0x87f980);_0x344899(_0x87f980);});});} \ No newline at end of file +var _0x83e1=['ioredis','../../config/logger','rpc','http','request','info','License,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x26e6fb,_0x12ed5c){var _0x409440=function(_0x40e0f4){while(--_0x40e0f4){_0x26e6fb['push'](_0x26e6fb['shift']());}};_0x409440(++_0x12ed5c);}(_0x83e1,0x1ad));var _0x183e=function(_0x24f232,_0x52c57c){_0x24f232=_0x24f232-0x0;var _0x1bc966=_0x83e1[_0x24f232];return _0x1bc966;};'use strict';var _=require(_0x183e('0x0'));var util=require(_0x183e('0x1'));var moment=require('moment');var BPromise=require(_0x183e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x183e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x183e('0x4'))(_0x183e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x183e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xab00d2,_0x14bea7,_0x4ee4bc){return new BPromise(function(_0x8e55be,_0x15be67){return client[_0x183e('0x7')](_0xab00d2,_0x4ee4bc)['then'](function(_0x11f0e9){logger[_0x183e('0x8')](_0x183e('0x9'),_0x14bea7,'request\x20sent');logger[_0x183e('0xa')]('License,\x20%s,\x20%s,\x20%s',_0x14bea7,_0x183e('0xb'),JSON[_0x183e('0xc')](_0x11f0e9));if(_0x11f0e9[_0x183e('0xd')]){if(_0x11f0e9[_0x183e('0xd')][_0x183e('0xe')]===0x1f4){logger[_0x183e('0xd')](_0x183e('0x9'),_0x14bea7,_0x11f0e9['error']['message']);return _0x15be67(_0x11f0e9['error'][_0x183e('0xf')]);}logger[_0x183e('0xd')](_0x183e('0x9'),_0x14bea7,_0x11f0e9['error'][_0x183e('0xf')]);return _0x8e55be(_0x11f0e9[_0x183e('0xd')][_0x183e('0xf')]);}else{logger['info'](_0x183e('0x9'),_0x14bea7,_0x183e('0xb'));_0x8e55be(_0x11f0e9[_0x183e('0x10')][_0x183e('0xf')]);}})[_0x183e('0x11')](function(_0x13e5d9){logger[_0x183e('0xd')](_0x183e('0x9'),_0x14bea7,_0x13e5d9);_0x15be67(_0x13e5d9);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 342b53a..38bb306 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 _0x1c23=['getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','send','put','delete','/:id/dispositions','removeDispositions','removeImap','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2275e4,_0x1e6c11){var _0x40909a=function(_0x1dad34){while(--_0x1dad34){_0x2275e4['push'](_0x2275e4['shift']());}};_0x40909a(++_0x1e6c11);}(_0x1c23,0x1d5));var _0x31c2=function(_0x29d0bc,_0x5b53b4){_0x29d0bc=_0x29d0bc-0x0;var _0x103e64=_0x1c23[_0x29d0bc];return _0x103e64;};'use strict';var multer=require(_0x31c2('0x0'));var util=require(_0x31c2('0x1'));var path=require(_0x31c2('0x2'));var timeout=require(_0x31c2('0x3'));var express=require(_0x31c2('0x4'));var router=express[_0x31c2('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x31c2('0x6'));var config=require(_0x31c2('0x7'));var controller=require('./mailAccount.controller');router[_0x31c2('0x8')]('/',auth[_0x31c2('0x9')](),controller[_0x31c2('0xa')]);router[_0x31c2('0x8')](_0x31c2('0xb'),auth['isAuthenticated'](),controller[_0x31c2('0xc')]);router[_0x31c2('0x8')](_0x31c2('0xd'),auth[_0x31c2('0x9')](),controller[_0x31c2('0xe')]);router['get']('/:id/dispositions',auth[_0x31c2('0x9')](),controller[_0x31c2('0xf')]);router[_0x31c2('0x8')](_0x31c2('0x10'),auth[_0x31c2('0x9')](),controller[_0x31c2('0x11')]);router['get'](_0x31c2('0x12'),auth['isAuthenticated'](),controller[_0x31c2('0x13')]);router[_0x31c2('0x8')](_0x31c2('0x14'),auth['isAuthenticated'](),controller[_0x31c2('0x15')]);router[_0x31c2('0x8')]('/:id/interactions',auth[_0x31c2('0x9')](),controller[_0x31c2('0x16')]);router[_0x31c2('0x8')](_0x31c2('0x17'),auth[_0x31c2('0x9')](),controller[_0x31c2('0x18')]);router[_0x31c2('0x8')](_0x31c2('0x19'),auth[_0x31c2('0x9')](),controller[_0x31c2('0x1a')]);router[_0x31c2('0x8')]('/:id/verify',auth['isAuthenticated'](),controller[_0x31c2('0x1b')]);router[_0x31c2('0x8')](_0x31c2('0x1c'),auth['isAuthenticated'](),controller['getAgents']);router[_0x31c2('0x1d')]('/:id/dispositions',auth[_0x31c2('0x9')](),controller[_0x31c2('0x1e')]);router[_0x31c2('0x1d')](_0x31c2('0x10'),auth['isAuthenticated'](),controller[_0x31c2('0x1f')]);router['post']('/',auth[_0x31c2('0x9')](),controller[_0x31c2('0x20')]);router['post']('/:id/in_servers',auth[_0x31c2('0x9')](),controller[_0x31c2('0x21')]);router['post'](_0x31c2('0x14'),auth[_0x31c2('0x9')](),controller[_0x31c2('0x22')]);router[_0x31c2('0x1d')]('/:id/interactions',auth[_0x31c2('0x9')](),controller[_0x31c2('0x23')]);router['post'](_0x31c2('0x17'),auth['isAuthenticated'](),controller['addApplications']);router[_0x31c2('0x1d')]('/:id/send',auth[_0x31c2('0x9')](),controller[_0x31c2('0x24')]);router[_0x31c2('0x1d')](_0x31c2('0x1c'),auth[_0x31c2('0x9')](),controller['addAgents']);router[_0x31c2('0x25')](_0x31c2('0xd'),auth[_0x31c2('0x9')](),controller['update']);router[_0x31c2('0x26')](_0x31c2('0x27'),auth[_0x31c2('0x9')](),controller[_0x31c2('0x28')]);router[_0x31c2('0x26')](_0x31c2('0x10'),auth[_0x31c2('0x9')](),controller['removeAnswers']);router[_0x31c2('0x26')](_0x31c2('0x12'),auth[_0x31c2('0x9')](),controller[_0x31c2('0x29')]);router[_0x31c2('0x26')](_0x31c2('0x14'),auth[_0x31c2('0x9')](),controller['removeSmtp']);router['delete'](_0x31c2('0xd'),auth['isAuthenticated'](),controller[_0x31c2('0x2a')]);router[_0x31c2('0x26')](_0x31c2('0x1c'),auth[_0x31c2('0x9')](),controller['removeAgents']);module[_0x31c2('0x2b')]=router; \ No newline at end of file +var _0x598a=['verifySmtp','/:id/users','getAgents','addDisposition','post','/:id/in_servers','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/send','addAgents','delete','removeDispositions','removeSmtp','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getImap','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify'];(function(_0x469503,_0x514cdc){var _0x915b4e=function(_0x16dd70){while(--_0x16dd70){_0x469503['push'](_0x469503['shift']());}};_0x915b4e(++_0x514cdc);}(_0x598a,0xfb));var _0xa598=function(_0xbc7572,_0x38da66){_0xbc7572=_0xbc7572-0x0;var _0x319aa7=_0x598a[_0xbc7572];return _0x319aa7;};'use strict';var multer=require(_0xa598('0x0'));var util=require(_0xa598('0x1'));var path=require(_0xa598('0x2'));var timeout=require(_0xa598('0x3'));var express=require(_0xa598('0x4'));var router=express['Router']();var auth=require(_0xa598('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0xa598('0x6')]('/',auth[_0xa598('0x7')](),controller[_0xa598('0x8')]);router[_0xa598('0x6')](_0xa598('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xa598('0x6')](_0xa598('0xa'),auth[_0xa598('0x7')](),controller[_0xa598('0xb')]);router[_0xa598('0x6')](_0xa598('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xa598('0x6')](_0xa598('0xd'),auth[_0xa598('0x7')](),controller[_0xa598('0xe')]);router[_0xa598('0x6')]('/:id/in_servers',auth[_0xa598('0x7')](),controller[_0xa598('0xf')]);router[_0xa598('0x6')]('/:id/out_servers',auth[_0xa598('0x7')](),controller['getSmtp']);router[_0xa598('0x6')](_0xa598('0x10'),auth[_0xa598('0x7')](),controller[_0xa598('0x11')]);router[_0xa598('0x6')](_0xa598('0x12'),auth[_0xa598('0x7')](),controller[_0xa598('0x13')]);router[_0xa598('0x6')]('/:id/messages',auth[_0xa598('0x7')](),controller[_0xa598('0x14')]);router[_0xa598('0x6')](_0xa598('0x15'),auth[_0xa598('0x7')](),controller[_0xa598('0x16')]);router[_0xa598('0x6')](_0xa598('0x17'),auth[_0xa598('0x7')](),controller[_0xa598('0x18')]);router['post'](_0xa598('0xc'),auth[_0xa598('0x7')](),controller[_0xa598('0x19')]);router[_0xa598('0x1a')](_0xa598('0xd'),auth[_0xa598('0x7')](),controller['addAnswer']);router['post']('/',auth[_0xa598('0x7')](),controller['create']);router[_0xa598('0x1a')](_0xa598('0x1b'),auth[_0xa598('0x7')](),controller[_0xa598('0x1c')]);router[_0xa598('0x1a')](_0xa598('0x1d'),auth['isAuthenticated'](),controller[_0xa598('0x1e')]);router[_0xa598('0x1a')](_0xa598('0x10'),auth[_0xa598('0x7')](),controller[_0xa598('0x1f')]);router[_0xa598('0x1a')](_0xa598('0x12'),auth[_0xa598('0x7')](),controller['addApplications']);router[_0xa598('0x1a')](_0xa598('0x20'),auth['isAuthenticated'](),controller['send']);router[_0xa598('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xa598('0x21')]);router['put'](_0xa598('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xa598('0x22')](_0xa598('0xc'),auth['isAuthenticated'](),controller[_0xa598('0x23')]);router[_0xa598('0x22')](_0xa598('0xd'),auth[_0xa598('0x7')](),controller['removeAnswers']);router[_0xa598('0x22')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router[_0xa598('0x22')]('/:id/out_servers',auth[_0xa598('0x7')](),controller[_0xa598('0x24')]);router[_0xa598('0x22')]('/:id',auth[_0xa598('0x7')](),controller[_0xa598('0x25')]);router[_0xa598('0x22')](_0xa598('0x17'),auth[_0xa598('0x7')](),controller['removeAgents']);module[_0xa598('0x26')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 8edb676..0a9deb1 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 _0x1058=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0x4efd56,_0x2231bd){var _0x3957a6=function(_0x2bcfc2){while(--_0x2bcfc2){_0x4efd56['push'](_0x4efd56['shift']());}};_0x3957a6(++_0x2231bd);}(_0x1058,0x150));var _0x8105=function(_0x5f56ff,_0x4bfa55){_0x5f56ff=_0x5f56ff-0x0;var _0x1a90a6=_0x1058[_0x5f56ff];return _0x1a90a6;};'use strict';var Sequelize=require(_0x8105('0x0'));module[_0x8105('0x1')]={'description':{'type':Sequelize[_0x8105('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x8105('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x8105('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x8105('0x4')]},'markAsUnread':{'type':Sequelize[_0x8105('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8105('0x2')],'allowNull':![],'defaultValue':_0x8105('0x5')},'fontSize':{'type':Sequelize[_0x8105('0x6')](0x2)[_0x8105('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8105('0x4')],'defaultValue':function(){return _0x8105('0x8');}},'notificationSound':{'type':Sequelize[_0x8105('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8105('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8105('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8105('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8105('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8105('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8105('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x8105('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x8105('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x467003){if(!_0x467003)this['setDataValue'](_0x8105('0xa'),null);this[_0x8105('0xb')](_0x8105('0xc'),_0x467003);}}}; \ No newline at end of file +var _0x227e=['BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','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','mandatoryDisposition','exports','STRING'];(function(_0x2dbcf0,_0x1c9ce9){var _0x185a15=function(_0x51b059){while(--_0x51b059){_0x2dbcf0['push'](_0x2dbcf0['shift']());}};_0x185a15(++_0x1c9ce9);}(_0x227e,0x1d2));var _0xe227=function(_0x15a11e,_0x3acdd2){_0x15a11e=_0x15a11e-0x0;var _0x3f7536=_0x227e[_0x15a11e];return _0x3f7536;};'use strict';var Sequelize=require('sequelize');module[_0xe227('0x0')]={'description':{'type':Sequelize[_0xe227('0x1')]},'name':{'type':Sequelize[_0xe227('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xe227('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xe227('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xe227('0x3')]},'markAsUnread':{'type':Sequelize[_0xe227('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe227('0x1')],'allowNull':![],'defaultValue':_0xe227('0x4')},'fontSize':{'type':Sequelize[_0xe227('0x5')](0x2)[_0xe227('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe227('0x3')],'defaultValue':function(){return _0xe227('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe227('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe227('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe227('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe227('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe227('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe227('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xe227('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xe227('0x2')],'defaultValue':![],'comment':_0xe227('0x9'),'set':function(_0x3c46ba){if(!_0x3c46ba)this[_0xe227('0xa')](_0xe227('0xb'),null);this[_0xe227('0xa')](_0xe227('0xc'),_0x3c46ba);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 22856c5..d7dba64 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 _0xb9cf=['merge','type','VIRTUAL','options','params','MailServerIn','MailServerOut','Smtp','rawAttributes','includeAll','include','find','body','describe','addDisposition','MailAccountId','Disposition','create','findOne','order','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','isNil','active','description','cservice','user','cuser','password','cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','Owner','Tag','Tags','color','tag','addApplications','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','split','CmList','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','defaults','ListId','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./mailAccount.socket','register','jayson/promise','client','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','get','MailAccounts','UserProfileResource','sendStatus','name','send','index','Imap','Pause','map','MailAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb9cf,0x71));var _0xfb9c=function(_0x34b8e3,_0x2f2c6a){_0x34b8e3=_0x34b8e3-0x0;var _0x814b0c=_0xb9cf[_0x34b8e3];return _0x814b0c;};'use strict';var pdf=require(_0xfb9c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfb9c('0x1'));var zipdir=require(_0xfb9c('0x2'));var jsonpatch=require(_0xfb9c('0x3'));var rp=require(_0xfb9c('0x4'));var moment=require(_0xfb9c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfb9c('0x6'));var util=require(_0xfb9c('0x7'));var path=require(_0xfb9c('0x8'));var sox=require(_0xfb9c('0x9'));var csv=require('to-csv');var ejs=require(_0xfb9c('0xa'));var fs=require('fs');var _=require(_0xfb9c('0xb'));var squel=require('squel');var crypto=require(_0xfb9c('0xc'));var jsforce=require(_0xfb9c('0xd'));var deskjs=require(_0xfb9c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfb9c('0xf'));var Papa=require('papaparse');var htmlToText=require(_0xfb9c('0x10'));var juice=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('../../config/utils');var config=require(_0xfb9c('0x18'));var licenseUtil=require(_0xfb9c('0x19'));var db=require(_0xfb9c('0x1a'))['db'];config[_0xfb9c('0x1b')]=_['defaults'](config['redis'],{'host':_0xfb9c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb9c('0x1b')]));require(_0xfb9c('0x1d'))[_0xfb9c('0x1e')](socket);var jayson=require(_0xfb9c('0x1f'));var client=jayson[_0xfb9c('0x20')]['http']({'port':0x232b});function respondWithRpcPromise(_0x13610e,_0x128693,_0x23af54,_0xb11adc){return new BPromise(function(_0xb81d2a,_0x4e6253){var _0x1a109a=_0xb11adc||client;return _0x1a109a[_0xfb9c('0x21')](_0x13610e,_0x23af54)['then'](function(_0x1553b9){logger[_0xfb9c('0x22')](_0xfb9c('0x23'),_0x128693,_0xfb9c('0x24'));logger[_0xfb9c('0x25')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x128693,_0xfb9c('0x24'),JSON['stringify'](_0x1553b9));if(_0x1553b9['error']){if(_0x1553b9[_0xfb9c('0x26')]['code']===0x1f4){logger[_0xfb9c('0x26')]('MailAccount,\x20%s,\x20%s',_0x128693,_0x1553b9['error'][_0xfb9c('0x27')]);return _0x4e6253(_0x1553b9[_0xfb9c('0x26')]['message']);}logger['error'](_0xfb9c('0x23'),_0x128693,_0x1553b9[_0xfb9c('0x26')]['message']);return _0xb81d2a(_0x1553b9['error'][_0xfb9c('0x27')]);}else{logger[_0xfb9c('0x22')](_0xfb9c('0x23'),_0x128693,_0xfb9c('0x24'));_0xb81d2a(_0x1553b9[_0xfb9c('0x28')][_0xfb9c('0x27')]);}})[_0xfb9c('0x29')](function(_0x48c29a){logger['error'](_0xfb9c('0x23'),_0x128693,_0x48c29a);_0x4e6253(_0x48c29a);});});}function respondWithStatusCode(_0x3d45cb,_0x390184){_0x390184=_0x390184||0xcc;return function(_0x3fc5ea){if(_0x3fc5ea){return _0x3d45cb['sendStatus'](_0x390184);}return _0x3d45cb[_0xfb9c('0x2a')](_0x390184)[_0xfb9c('0x2b')]();};}function respondWithResult(_0x1efa2b,_0x23a5ed){_0x23a5ed=_0x23a5ed||0xc8;return function(_0x21ade8){if(_0x21ade8){return _0x1efa2b['status'](_0x23a5ed)[_0xfb9c('0x2c')](_0x21ade8);}};}function respondWithFilteredResult(_0x2805e3,_0x21a558){return function(_0x4c64c5){if(_0x4c64c5){var _0x4d0d9e=_0x4c64c5[_0xfb9c('0x2d')],_0x9d8d7=_0x21a558[_0xfb9c('0x2e')],_0x4d57a7=_0x21a558[_0xfb9c('0x2e')]+_0x21a558[_0xfb9c('0x2f')],_0x715bf0;if(_0x4d57a7>=_0x4d0d9e){_0x4d57a7=_0x4d0d9e;_0x715bf0=0xc8;}else{_0x715bf0=0xce;}_0x2805e3[_0xfb9c('0x2a')](_0x715bf0);return _0x2805e3[_0xfb9c('0x30')]('Content-Range',_0x9d8d7+'-'+_0x4d57a7+'/'+_0x4d0d9e)[_0xfb9c('0x2c')](_0x4c64c5);}return null;};}function patchUpdates(_0x5b4090){return function(_0x4b7fef){try{jsonpatch['apply'](_0x4b7fef,_0x5b4090,!![]);}catch(_0x8fadea){return BPromise[_0xfb9c('0x31')](_0x8fadea);}return _0x4b7fef[_0xfb9c('0x32')]();};}function saveUpdates(_0x40d16e,_0x5a7aaa){return function(_0x3630ec){if(_0x3630ec){return _0x3630ec[_0xfb9c('0x33')](_0x40d16e)[_0xfb9c('0x34')](function(_0x1b1301){return _0x1b1301;});}return null;};}function removeEntity(_0x44b37b,_0x5ab803){return function(_0x370941){if(_0x370941){return _0x370941[_0xfb9c('0x35')]()[_0xfb9c('0x34')](function(){var _0x2a14b9=_0x370941[_0xfb9c('0x36')]({'plain':!![]});var _0x325c66=_0xfb9c('0x37');return db[_0xfb9c('0x38')][_0xfb9c('0x35')]({'where':{'type':_0x325c66,'resourceId':_0x2a14b9['id']}})[_0xfb9c('0x34')](function(){return _0x370941;});})['then'](function(){_0x44b37b['status'](0xcc)[_0xfb9c('0x2b')]();});}};}function handleEntityNotFound(_0x87a0fc,_0x518f49){return function(_0x5b8deb){if(!_0x5b8deb){_0x87a0fc[_0xfb9c('0x39')](0x194);}return _0x5b8deb;};}function handleError(_0x37069e,_0x20e322){_0x20e322=_0x20e322||0x1f4;return function(_0x953885){logger['error'](_0x953885['stack']);if(_0x953885[_0xfb9c('0x3a')]){delete _0x953885[_0xfb9c('0x3a')];}_0x37069e[_0xfb9c('0x2a')](_0x20e322)[_0xfb9c('0x3b')](_0x953885);};}exports[_0xfb9c('0x3c')]=function(_0x3bcb80,_0x1cec85){var _0x46afb7={'include':[{'model':db['MailServerIn'],'as':_0xfb9c('0x3d')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xfb9c('0x3e')],'as':'mandatoryDispositionPause'}]},_0x45b08a={},_0x33148e={'count':0x0,'rows':[]};var _0x1f9176=_[_0xfb9c('0x3f')](db[_0xfb9c('0x40')]['rawAttributes'],function(_0x33db63){return{'name':_0x33db63[_0xfb9c('0x41')],'type':_0x33db63['type'][_0xfb9c('0x42')]};});_0x45b08a[_0xfb9c('0x43')]=_[_0xfb9c('0x3f')](_0x1f9176,_0xfb9c('0x3a'));_0x45b08a[_0xfb9c('0x44')]=_[_0xfb9c('0x45')](_0x3bcb80[_0xfb9c('0x44')]);_0x45b08a[_0xfb9c('0x46')]=_[_0xfb9c('0x47')](_0x45b08a[_0xfb9c('0x43')],_0x45b08a['query']);_0x46afb7[_0xfb9c('0x48')]=_[_0xfb9c('0x47')](_0x45b08a[_0xfb9c('0x43')],qs[_0xfb9c('0x49')](_0x3bcb80[_0xfb9c('0x44')]['fields']));_0x46afb7[_0xfb9c('0x48')]=_0x46afb7[_0xfb9c('0x48')][_0xfb9c('0x4a')]?_0x46afb7[_0xfb9c('0x48')]:_0x45b08a[_0xfb9c('0x43')];if(!_0x3bcb80[_0xfb9c('0x44')][_0xfb9c('0x4b')](_0xfb9c('0x4c'))){_0x46afb7[_0xfb9c('0x2f')]=qs[_0xfb9c('0x2f')](_0x3bcb80[_0xfb9c('0x44')][_0xfb9c('0x2f')]);_0x46afb7['offset']=qs['offset'](_0x3bcb80[_0xfb9c('0x44')]['offset']);}_0x46afb7['order']=qs[_0xfb9c('0x4d')](_0x3bcb80['query'][_0xfb9c('0x4d')]);_0x46afb7[_0xfb9c('0x4e')]=qs[_0xfb9c('0x46')](_['pick'](_0x3bcb80['query'],_0x45b08a['filters']),_0x1f9176);if(_0x3bcb80[_0xfb9c('0x44')][_0xfb9c('0x4f')]){_0x46afb7[_0xfb9c('0x4e')]=_[_0xfb9c('0x50')](_0x46afb7[_0xfb9c('0x4e')],{'$or':_[_0xfb9c('0x3f')](_0x1f9176,function(_0x5f5b79){if(_0x5f5b79[_0xfb9c('0x51')]!==_0xfb9c('0x52')){var _0x43e274={};_0x43e274[_0x5f5b79['name']]={'$like':'%'+_0x3bcb80[_0xfb9c('0x44')]['filter']+'%'};return _0x43e274;}})});}_0x46afb7=_[_0xfb9c('0x50')]({},_0x46afb7,_0x3bcb80[_0xfb9c('0x53')]);var _0x5d39c3={'where':_0x46afb7[_0xfb9c('0x4e')]};return db[_0xfb9c('0x40')][_0xfb9c('0x2d')](_0x5d39c3)[_0xfb9c('0x34')](function(_0x4c6da3){_0x33148e['count']=_0x4c6da3;if(_0x3bcb80['query']['includeAll']){_0x46afb7['include']=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x46afb7);})['then'](function(_0x4d9b10){_0x33148e['rows']=_0x4d9b10;return _0x33148e;})[_0xfb9c('0x34')](respondWithFilteredResult(_0x1cec85,_0x46afb7))[_0xfb9c('0x29')](handleError(_0x1cec85,null));};exports['show']=function(_0x37053f,_0x247a2c){var _0x422579={'raw':![],'where':{'id':_0x37053f[_0xfb9c('0x54')]['id']},'include':[{'model':db[_0xfb9c('0x55')],'as':_0xfb9c('0x3d')},{'model':db[_0xfb9c('0x56')],'as':_0xfb9c('0x57')},{'model':db[_0xfb9c('0x3e')],'as':'mandatoryDispositionPause'}]},_0x12a9b0={};_0x12a9b0['model']=_[_0xfb9c('0x45')](db[_0xfb9c('0x40')][_0xfb9c('0x58')]);_0x12a9b0[_0xfb9c('0x44')]=_[_0xfb9c('0x45')](_0x37053f[_0xfb9c('0x44')]);_0x12a9b0[_0xfb9c('0x46')]=_[_0xfb9c('0x47')](_0x12a9b0[_0xfb9c('0x43')],_0x12a9b0['query']);_0x422579['attributes']=_['intersection'](_0x12a9b0[_0xfb9c('0x43')],qs['fields'](_0x37053f[_0xfb9c('0x44')][_0xfb9c('0x49')]));_0x422579[_0xfb9c('0x48')]=_0x422579[_0xfb9c('0x48')][_0xfb9c('0x4a')]?_0x422579[_0xfb9c('0x48')]:_0x12a9b0['model'];if(_0x37053f[_0xfb9c('0x44')][_0xfb9c('0x59')]){_0x422579[_0xfb9c('0x5a')]=[{'all':!![]}];}_0x422579=_['merge']({},_0x422579,_0x37053f[_0xfb9c('0x53')]);return db[_0xfb9c('0x40')][_0xfb9c('0x5b')](_0x422579)[_0xfb9c('0x34')](handleEntityNotFound(_0x247a2c,null))['then'](respondWithResult(_0x247a2c,null))[_0xfb9c('0x29')](handleError(_0x247a2c,null));};exports['update']=function(_0x2afd37,_0x1c0b0f){if(_0x2afd37[_0xfb9c('0x5c')]['id']){delete _0x2afd37['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x2afd37[_0xfb9c('0x54')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xfb9c('0x3d')},{'model':db[_0xfb9c('0x56')],'as':'Smtp'},{'model':db[_0xfb9c('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xfb9c('0x34')](handleEntityNotFound(_0x1c0b0f,null))[_0xfb9c('0x34')](saveUpdates(_0x2afd37[_0xfb9c('0x5c')],null))[_0xfb9c('0x34')](function(_0x5d6aa1){if(_0x5d6aa1&&_0x2afd37[_0xfb9c('0x5c')][_0xfb9c('0x3d')]){return db[_0xfb9c('0x55')][_0xfb9c('0x33')](_0x2afd37[_0xfb9c('0x5c')][_0xfb9c('0x3d')],{'where':{'MailAccountId':_0x5d6aa1['id']}})[_0xfb9c('0x34')](function(){return _0x5d6aa1;});}return _0x5d6aa1;})[_0xfb9c('0x34')](function(_0x5ea733){if(_0x5ea733&&_0x2afd37[_0xfb9c('0x5c')][_0xfb9c('0x57')]){return db[_0xfb9c('0x56')][_0xfb9c('0x33')](_0x2afd37[_0xfb9c('0x5c')][_0xfb9c('0x57')],{'where':{'MailAccountId':_0x5ea733['id']}})[_0xfb9c('0x34')](function(){return _0x5ea733;});}return _0x5ea733;})[_0xfb9c('0x34')](respondWithResult(_0x1c0b0f,null))[_0xfb9c('0x29')](handleError(_0x1c0b0f,null));};exports['describe']=function(_0x49789d,_0x113152){return db[_0xfb9c('0x40')][_0xfb9c('0x5d')]()[_0xfb9c('0x34')](respondWithResult(_0x113152,null))[_0xfb9c('0x29')](handleError(_0x113152,null));};exports[_0xfb9c('0x5e')]=function(_0x95aa91,_0xb5fb4e,_0x34dc48){if(_0x95aa91[_0xfb9c('0x5c')]['id']){delete _0x95aa91[_0xfb9c('0x5c')]['id'];}return db[_0xfb9c('0x40')][_0xfb9c('0x5b')]({'where':{'id':_0x95aa91['params']['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0xb5fb4e,null))['then'](function(_0x3f917a){if(_0x3f917a){_0x95aa91['body'][_0xfb9c('0x5f')]=_0x3f917a['id'];return db[_0xfb9c('0x60')][_0xfb9c('0x61')](_0x95aa91[_0xfb9c('0x5c')]);}})[_0xfb9c('0x34')](respondWithResult(_0xb5fb4e,null))[_0xfb9c('0x29')](handleError(_0xb5fb4e,null));};exports['getDispositions']=function(_0x4a890a,_0x59502d,_0x69dec){var _0x1d08c4={'raw':![],'where':{}};var _0x19a1ea={};var _0x4dfddc={'count':0x0,'rows':[]};return db[_0xfb9c('0x40')][_0xfb9c('0x62')]({'where':{'id':_0x4a890a[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x59502d,null))['then'](function(_0x4152d8){if(_0x4152d8){_0x19a1ea['model']=_[_0xfb9c('0x45')](db[_0xfb9c('0x60')][_0xfb9c('0x58')]);_0x19a1ea[_0xfb9c('0x44')]=_[_0xfb9c('0x45')](_0x4a890a[_0xfb9c('0x44')]);_0x19a1ea[_0xfb9c('0x46')]=_[_0xfb9c('0x47')](_0x19a1ea['model'],_0x19a1ea['query']);_0x1d08c4[_0xfb9c('0x48')]=_[_0xfb9c('0x47')](_0x19a1ea[_0xfb9c('0x43')],qs[_0xfb9c('0x49')](_0x4a890a[_0xfb9c('0x44')][_0xfb9c('0x49')]));_0x1d08c4[_0xfb9c('0x48')]=_0x1d08c4['attributes'][_0xfb9c('0x4a')]?_0x1d08c4[_0xfb9c('0x48')]:_0x19a1ea[_0xfb9c('0x43')];if(!_0x4a890a[_0xfb9c('0x44')][_0xfb9c('0x4b')]('nolimit')){_0x1d08c4[_0xfb9c('0x2f')]=qs[_0xfb9c('0x2f')](_0x4a890a[_0xfb9c('0x44')][_0xfb9c('0x2f')]);_0x1d08c4[_0xfb9c('0x2e')]=qs[_0xfb9c('0x2e')](_0x4a890a[_0xfb9c('0x44')][_0xfb9c('0x2e')]);}_0x1d08c4[_0xfb9c('0x63')]=qs['sort'](_0x4a890a[_0xfb9c('0x44')][_0xfb9c('0x4d')]);_0x1d08c4[_0xfb9c('0x4e')]=qs[_0xfb9c('0x46')](_[_0xfb9c('0x64')](_0x4a890a[_0xfb9c('0x44')],_0x19a1ea[_0xfb9c('0x46')]));_0x1d08c4['where'][_0xfb9c('0x5f')]=_0x4152d8['id'];if(_0x4a890a[_0xfb9c('0x44')][_0xfb9c('0x4f')]){_0x1d08c4[_0xfb9c('0x4e')]=_[_0xfb9c('0x50')](_0x1d08c4[_0xfb9c('0x4e')],{'$or':_[_0xfb9c('0x3f')](_0x1d08c4['attributes'],function(_0x20b070){var _0x39722f={};_0x39722f[_0x20b070]={'$like':'%'+_0x4a890a[_0xfb9c('0x44')][_0xfb9c('0x4f')]+'%'};return _0x39722f;})});}_0x1d08c4=_[_0xfb9c('0x50')]({},_0x1d08c4,_0x4a890a[_0xfb9c('0x53')]);return db['Disposition'][_0xfb9c('0x2d')]({'where':_0x1d08c4['where']})[_0xfb9c('0x34')](function(_0x299e4d){_0x4dfddc['count']=_0x299e4d;if(_0x4a890a[_0xfb9c('0x44')][_0xfb9c('0x59')]){_0x1d08c4['include']=[{'all':!![]}];}return db['Disposition'][_0xfb9c('0x65')](_0x1d08c4);})[_0xfb9c('0x34')](function(_0x25a7a7){_0x4dfddc['rows']=_0x25a7a7;return _0x4dfddc;});}})[_0xfb9c('0x34')](respondWithFilteredResult(_0x59502d,_0x1d08c4))['catch'](handleError(_0x59502d,null));};exports[_0xfb9c('0x66')]=function(_0x1c8fb0,_0x47c8ec,_0x3c1632){return db['MailAccount'][_0xfb9c('0x5b')]({'where':{'id':_0x1c8fb0[_0xfb9c('0x54')]['id']}})['then'](handleEntityNotFound(_0x47c8ec,null))['then'](function(_0x55ca0b){if(_0x55ca0b){return _0x55ca0b[_0xfb9c('0x66')](_0x1c8fb0['query'][_0xfb9c('0x67')]);}})[_0xfb9c('0x34')](respondWithStatusCode(_0x47c8ec,null))[_0xfb9c('0x29')](handleError(_0x47c8ec,null));};exports[_0xfb9c('0x68')]=function(_0x59c86b,_0xde9dbc,_0x49deab){if(_0x59c86b[_0xfb9c('0x5c')]['id']){delete _0x59c86b[_0xfb9c('0x5c')]['id'];}return db[_0xfb9c('0x40')][_0xfb9c('0x5b')]({'where':{'id':_0x59c86b[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0xde9dbc,null))[_0xfb9c('0x34')](function(_0x1f1fc6){if(_0x1f1fc6){_0x59c86b['body'][_0xfb9c('0x5f')]=_0x1f1fc6['id'];return db['CannedAnswer'][_0xfb9c('0x61')](_0x59c86b[_0xfb9c('0x5c')]);}})[_0xfb9c('0x34')](respondWithResult(_0xde9dbc,null))[_0xfb9c('0x29')](handleError(_0xde9dbc,null));};exports['getAnswers']=function(_0x3cf85f,_0x5c5f6d,_0x540e19){var _0x408e07={'raw':![],'where':{}};var _0x372049={};var _0x1f17d6={'count':0x0,'rows':[]};return db[_0xfb9c('0x40')][_0xfb9c('0x62')]({'where':{'id':_0x3cf85f['params']['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x5c5f6d,null))[_0xfb9c('0x34')](function(_0x3edbf5){if(_0x3edbf5){_0x372049['model']=_[_0xfb9c('0x45')](db[_0xfb9c('0x69')]['rawAttributes']);_0x372049[_0xfb9c('0x44')]=_[_0xfb9c('0x45')](_0x3cf85f[_0xfb9c('0x44')]);_0x372049['filters']=_['intersection'](_0x372049[_0xfb9c('0x43')],_0x372049[_0xfb9c('0x44')]);_0x408e07['attributes']=_[_0xfb9c('0x47')](_0x372049[_0xfb9c('0x43')],qs['fields'](_0x3cf85f[_0xfb9c('0x44')][_0xfb9c('0x49')]));_0x408e07[_0xfb9c('0x48')]=_0x408e07[_0xfb9c('0x48')][_0xfb9c('0x4a')]?_0x408e07[_0xfb9c('0x48')]:_0x372049['model'];if(!_0x3cf85f['query']['hasOwnProperty'](_0xfb9c('0x4c'))){_0x408e07['limit']=qs[_0xfb9c('0x2f')](_0x3cf85f[_0xfb9c('0x44')]['limit']);_0x408e07[_0xfb9c('0x2e')]=qs[_0xfb9c('0x2e')](_0x3cf85f[_0xfb9c('0x44')]['offset']);}_0x408e07['order']=qs[_0xfb9c('0x4d')](_0x3cf85f[_0xfb9c('0x44')]['sort']);_0x408e07[_0xfb9c('0x4e')]=qs['filters'](_[_0xfb9c('0x64')](_0x3cf85f[_0xfb9c('0x44')],_0x372049[_0xfb9c('0x46')]));_0x408e07['where']['MailAccountId']=_0x3edbf5['id'];if(_0x3cf85f['query'][_0xfb9c('0x4f')]){_0x408e07[_0xfb9c('0x4e')]=_['merge'](_0x408e07['where'],{'$or':_[_0xfb9c('0x3f')](_0x408e07[_0xfb9c('0x48')],function(_0x332b3e){var _0x10084a={};_0x10084a[_0x332b3e]={'$like':'%'+_0x3cf85f[_0xfb9c('0x44')][_0xfb9c('0x4f')]+'%'};return _0x10084a;})});}_0x408e07=_[_0xfb9c('0x50')]({},_0x408e07,_0x3cf85f[_0xfb9c('0x53')]);return db[_0xfb9c('0x69')][_0xfb9c('0x2d')]({'where':_0x408e07[_0xfb9c('0x4e')]})['then'](function(_0x14e0fb){_0x1f17d6[_0xfb9c('0x2d')]=_0x14e0fb;if(_0x3cf85f[_0xfb9c('0x44')]['includeAll']){_0x408e07['include']=[{'all':!![]}];}return db[_0xfb9c('0x69')][_0xfb9c('0x65')](_0x408e07);})[_0xfb9c('0x34')](function(_0x46c06e){_0x1f17d6['rows']=_0x46c06e;return _0x1f17d6;});}})[_0xfb9c('0x34')](respondWithFilteredResult(_0x5c5f6d,_0x408e07))[_0xfb9c('0x29')](handleError(_0x5c5f6d,null));};exports[_0xfb9c('0x6a')]=function(_0x4947b2,_0x2524dc,_0x2771df){return db[_0xfb9c('0x40')][_0xfb9c('0x5b')]({'where':{'id':_0x4947b2[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x2524dc,null))[_0xfb9c('0x34')](function(_0x5009b6){if(_0x5009b6){return _0x5009b6[_0xfb9c('0x6a')](_0x4947b2[_0xfb9c('0x44')]['ids']);}})[_0xfb9c('0x34')](respondWithStatusCode(_0x2524dc,null))[_0xfb9c('0x29')](handleError(_0x2524dc,null));};exports['create']=function(_0x5e037f,_0x2b97d0){var _0x45383d={'name':_0x5e037f[_0xfb9c('0x5c')]['name'],'key':_0x5e037f[_0xfb9c('0x5c')][_0xfb9c('0x42')],'email':_0x5e037f[_0xfb9c('0x5c')][_0xfb9c('0x6b')],'ListId':_0x5e037f[_0xfb9c('0x5c')]['ListId'],'active':!_[_0xfb9c('0x6c')](_0x5e037f[_0xfb9c('0x5c')][_0xfb9c('0x6d')])?_0x5e037f[_0xfb9c('0x5c')][_0xfb9c('0x6d')]:!![],'description':_0x5e037f[_0xfb9c('0x5c')][_0xfb9c('0x6e')]||null,'Imap':{},'Smtp':{}};if(_[_0xfb9c('0x6c')](_0x5e037f[_0xfb9c('0x5c')][_0xfb9c('0x6f')])){if(_0x5e037f['body']['cauthentication']){_0x45383d[_0xfb9c('0x3d')][_0xfb9c('0x70')]=_0x45383d[_0xfb9c('0x57')]['user']=_0x5e037f[_0xfb9c('0x5c')][_0xfb9c('0x71')];_0x45383d[_0xfb9c('0x3d')][_0xfb9c('0x72')]=_0x45383d[_0xfb9c('0x57')]['pass']=_0x5e037f[_0xfb9c('0x5c')][_0xfb9c('0x73')];}else{_0x45383d[_0xfb9c('0x3d')][_0xfb9c('0x74')]=_0x45383d[_0xfb9c('0x57')][_0xfb9c('0x74')]=![];}_0x45383d['Imap'][_0xfb9c('0x75')]=_0x5e037f['body'][_0xfb9c('0x3d')]['host'];_0x45383d[_0xfb9c('0x3d')]['port']=_0x5e037f[_0xfb9c('0x5c')][_0xfb9c('0x3d')][_0xfb9c('0x76')];_0x45383d['Smtp'][_0xfb9c('0x75')]=_0x5e037f[_0xfb9c('0x5c')][_0xfb9c('0x57')][_0xfb9c('0x75')];_0x45383d['Smtp'][_0xfb9c('0x76')]=_0x5e037f[_0xfb9c('0x5c')]['Smtp'][_0xfb9c('0x76')];}else{_0x45383d[_0xfb9c('0x3d')][_0xfb9c('0x77')]=_0x45383d[_0xfb9c('0x57')][_0xfb9c('0x77')]=_0x5e037f['body'][_0xfb9c('0x6f')];_0x45383d[_0xfb9c('0x3d')]['user']=_0x45383d[_0xfb9c('0x57')][_0xfb9c('0x70')]=_0x5e037f[_0xfb9c('0x5c')][_0xfb9c('0x71')];_0x45383d['Imap'][_0xfb9c('0x72')]=_0x45383d['Smtp'][_0xfb9c('0x78')]=_0x5e037f[_0xfb9c('0x5c')][_0xfb9c('0x73')];}return db[_0xfb9c('0x40')]['create'](_0x45383d,{'include':[{'model':db['MailServerOut'],'as':_0xfb9c('0x57')},{'model':db[_0xfb9c('0x55')],'as':_0xfb9c('0x3d')}]})[_0xfb9c('0x34')](function(_0x283571){var _0x18912a=_0x5e037f[_0xfb9c('0x70')][_0xfb9c('0x36')]({'plain':!![]});if(!_0x18912a)throw new Error(_0xfb9c('0x79'));if(_0x18912a[_0xfb9c('0x7a')]===_0xfb9c('0x70')){var _0x2e7725=_0x283571['get']({'plain':!![]});return db[_0xfb9c('0x7b')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x18912a[_0xfb9c('0x7c')]},'raw':!![]})[_0xfb9c('0x34')](function(_0x756594){if(_0x756594&&_0x756594['autoAssociation']===0x0){return db[_0xfb9c('0x38')][_0xfb9c('0x61')]({'name':_0x2e7725[_0xfb9c('0x3a')],'resourceId':_0x2e7725['id'],'type':_0x756594[_0xfb9c('0x3a')],'sectionId':_0x756594['id']},{})['then'](function(){return _0x283571;});}else{return _0x283571;}})[_0xfb9c('0x29')](function(_0xfa37d7){logger[_0xfb9c('0x26')](_0xfb9c('0x7d'),_0xfa37d7);throw _0xfa37d7;});}return _0x283571;})[_0xfb9c('0x34')](respondWithResult(_0x2b97d0,0xc9))[_0xfb9c('0x29')](handleError(_0x2b97d0,null));};exports[_0xfb9c('0x7e')]=function(_0x783a68,_0x5c20e3,_0x197522){return db['MailAccount'][_0xfb9c('0x62')]({'where':{'id':_0x783a68[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x5c20e3,null))[_0xfb9c('0x34')](function(_0x365f40){if(_0x365f40){return _0x365f40[_0xfb9c('0x7e')]();}return null;})[_0xfb9c('0x34')](respondWithResult(_0x5c20e3,null))[_0xfb9c('0x29')](handleError(_0x5c20e3,null));};exports[_0xfb9c('0x7f')]=function(_0x27ad5f,_0x2e99ae,_0x1b4a9b){if(_0x27ad5f[_0xfb9c('0x5c')]['id']){delete _0x27ad5f['body']['id'];}return db['MailAccount'][_0xfb9c('0x5b')]({'where':{'id':_0x27ad5f[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x2e99ae,null))[_0xfb9c('0x34')](function(_0x2e5935){if(_0x2e5935){_0x27ad5f[_0xfb9c('0x5c')]['MailAccountId']=_0x2e5935['id'];return db[_0xfb9c('0x55')][_0xfb9c('0x61')](_0x27ad5f['body']);}})['then'](respondWithResult(_0x2e99ae,null))['catch'](handleError(_0x2e99ae,null));};exports[_0xfb9c('0x80')]=function(_0x5e34c0,_0x27afc2,_0x43751e){return db[_0xfb9c('0x40')][_0xfb9c('0x62')]({'where':{'id':_0x5e34c0['params']['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x27afc2,null))['then'](function(_0x6713bb){if(_0x6713bb){return _0x6713bb[_0xfb9c('0x81')](null);}return null;})['then'](respondWithStatusCode(_0x27afc2,null))['catch'](handleError(_0x27afc2,null));};exports[_0xfb9c('0x82')]=function(_0x45dda8,_0x5089ac,_0x10d29a){return db[_0xfb9c('0x40')][_0xfb9c('0x62')]({'where':{'id':_0x45dda8[_0xfb9c('0x54')]['id']}})['then'](handleEntityNotFound(_0x5089ac,null))['then'](function(_0x1d5b30){if(_0x1d5b30){return _0x1d5b30[_0xfb9c('0x82')]();}return null;})[_0xfb9c('0x34')](respondWithResult(_0x5089ac,null))['catch'](handleError(_0x5089ac,null));};exports[_0xfb9c('0x83')]=function(_0x4e63b8,_0x32d8a5,_0x1aed5a){if(_0x4e63b8[_0xfb9c('0x5c')]['id']){delete _0x4e63b8['body']['id'];}return db[_0xfb9c('0x40')]['find']({'where':{'id':_0x4e63b8[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x32d8a5,null))[_0xfb9c('0x34')](function(_0x7e7eda){if(_0x7e7eda){_0x4e63b8['body'][_0xfb9c('0x5f')]=_0x7e7eda['id'];return db[_0xfb9c('0x56')][_0xfb9c('0x61')](_0x4e63b8['body']);}})['then'](respondWithResult(_0x32d8a5,null))[_0xfb9c('0x29')](handleError(_0x32d8a5,null));};exports[_0xfb9c('0x84')]=function(_0x3586ed,_0x2ac454,_0x3a4a13){return db[_0xfb9c('0x40')][_0xfb9c('0x62')]({'where':{'id':_0x3586ed[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x2ac454,null))[_0xfb9c('0x34')](function(_0x45c919){if(_0x45c919){return _0x45c919['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x2ac454,null))[_0xfb9c('0x29')](handleError(_0x2ac454,null));};exports['addInteraction']=function(_0xdf326,_0x11541f,_0x4f76fb){return db[_0xfb9c('0x85')][_0xfb9c('0x5b')]({'where':{'id':_0xdf326[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x11541f,null))[_0xfb9c('0x34')](function(_0x23e64f){if(_0x23e64f){return _0x23e64f[_0xfb9c('0x86')](_0xdf326['body'][_0xfb9c('0x67')],_[_0xfb9c('0x87')](_0xdf326[_0xfb9c('0x5c')],['ids','id'])||{});}})[_0xfb9c('0x34')](respondWithResult(_0x11541f,null))[_0xfb9c('0x29')](handleError(_0x11541f,null));};exports['getInteractions']=function(_0x2672fe,_0x19c64a,_0x2ff4b6){var _0x174794={'raw':![],'where':{}};var _0x2d63e7={};var _0x381ccf={'count':0x0,'rows':[]};return db[_0xfb9c('0x40')]['findOne']({'where':{'id':_0x2672fe[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x19c64a,null))[_0xfb9c('0x34')](function(_0x29bea1){if(_0x29bea1){_0x2d63e7[_0xfb9c('0x43')]=_[_0xfb9c('0x45')](db['MailInteraction'][_0xfb9c('0x58')]);_0x2d63e7[_0xfb9c('0x44')]=_[_0xfb9c('0x45')](_0x2672fe[_0xfb9c('0x44')]);_0x2d63e7['filters']=_[_0xfb9c('0x47')](_0x2d63e7[_0xfb9c('0x43')],_0x2d63e7['query']);_0x174794['attributes']=_[_0xfb9c('0x47')](_0x2d63e7[_0xfb9c('0x43')],qs[_0xfb9c('0x49')](_0x2672fe[_0xfb9c('0x44')][_0xfb9c('0x49')]));_0x174794[_0xfb9c('0x48')]=_0x174794[_0xfb9c('0x48')][_0xfb9c('0x4a')]?_0x174794['attributes']:_0x2d63e7[_0xfb9c('0x43')];if(!_0x2672fe['query'][_0xfb9c('0x4b')](_0xfb9c('0x4c'))){_0x174794[_0xfb9c('0x2f')]=qs['limit'](_0x2672fe[_0xfb9c('0x44')]['limit']);_0x174794[_0xfb9c('0x2e')]=qs['offset'](_0x2672fe[_0xfb9c('0x44')]['offset']);}_0x174794[_0xfb9c('0x63')]=qs['sort'](_0x2672fe[_0xfb9c('0x44')][_0xfb9c('0x4d')]);_0x174794[_0xfb9c('0x4e')]=qs['filters'](_[_0xfb9c('0x64')](_0x2672fe[_0xfb9c('0x44')],_0x2d63e7['filters']));_0x174794[_0xfb9c('0x4e')][_0xfb9c('0x5f')]=_0x29bea1['id'];if(_0x2672fe[_0xfb9c('0x44')][_0xfb9c('0x4f')]){_0x174794[_0xfb9c('0x4e')]=_[_0xfb9c('0x50')](_0x174794[_0xfb9c('0x4e')],{'$or':_[_0xfb9c('0x3f')](_0x174794[_0xfb9c('0x48')],function(_0x5e23cc){var _0x18d054={};_0x18d054[_0x5e23cc]={'$like':'%'+_0x2672fe[_0xfb9c('0x44')]['filter']+'%'};return _0x18d054;})});}_0x174794=_['merge']({},_0x174794,_0x2672fe['options']);return db[_0xfb9c('0x85')][_0xfb9c('0x2d')]({'where':_0x174794[_0xfb9c('0x4e')]})[_0xfb9c('0x34')](function(_0x27dc6c){_0x381ccf[_0xfb9c('0x2d')]=_0x27dc6c;if(_0x2672fe[_0xfb9c('0x44')][_0xfb9c('0x59')]){_0x174794[_0xfb9c('0x5a')]=[{'model':db[_0xfb9c('0x88')],'as':_0xfb9c('0x89'),'required':![]},{'model':db[_0xfb9c('0x8a')],'as':_0xfb9c('0x8b'),'attributes':[_0xfb9c('0x3a'),'fullname','internal'],'required':![]},{'model':db[_0xfb9c('0x8c')],'as':_0xfb9c('0x8d'),'attributes':['id',_0xfb9c('0x3a'),_0xfb9c('0x8e')],'where':_0x2672fe[_0xfb9c('0x44')][_0xfb9c('0x8f')]?{'id':_0x2672fe[_0xfb9c('0x44')][_0xfb9c('0x8f')]}:undefined,'required':_0x2672fe[_0xfb9c('0x44')][_0xfb9c('0x8f')]?!![]:![]}];}return db[_0xfb9c('0x85')][_0xfb9c('0x65')](_0x174794);})[_0xfb9c('0x34')](function(_0x4bb1b4){_0x381ccf['rows']=_0x4bb1b4;return _0x381ccf;});}})['then'](respondWithFilteredResult(_0x19c64a,_0x174794))[_0xfb9c('0x29')](handleError(_0x19c64a,null));};exports[_0xfb9c('0x90')]=function(_0x58689b,_0x285d6b,_0x45bd33){return db[_0xfb9c('0x40')][_0xfb9c('0x62')]({'where':{'id':_0x58689b[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x285d6b,null))['then'](function(_0x227746){if(_0x227746){return db[_0xfb9c('0x91')]['transaction'](function(_0x224963){return db['MailApplication'][_0xfb9c('0x35')]({'where':{'MailAccountId':_0x58689b[_0xfb9c('0x54')]['id']},'transaction':_0x224963})[_0xfb9c('0x34')](function(_0x1b75f7){var _0x2e33e6=_[_0xfb9c('0x3f')](_0x58689b['body'],function(_0x4b501a){_0x4b501a[_0xfb9c('0x5f')]=_0x58689b[_0xfb9c('0x54')]['id'];return _0x4b501a;});return db[_0xfb9c('0x92')][_0xfb9c('0x93')](_0x2e33e6,{'transaction':_0x224963});});})[_0xfb9c('0x34')](function(){return db[_0xfb9c('0x92')][_0xfb9c('0x94')]({'where':{'MailAccountId':_0x58689b[_0xfb9c('0x54')]['id']},'order':_0xfb9c('0x95')});});}})['then'](respondWithResult(_0x285d6b,null))[_0xfb9c('0x29')](handleError(_0x285d6b,null));};exports[_0xfb9c('0x96')]=function(_0x3717c8,_0x18a79b,_0xe7146a){var _0x44611d={};var _0x2efdfd={};var _0x5837ff;var _0x354327;return db[_0xfb9c('0x40')][_0xfb9c('0x62')]({'where':{'id':_0x3717c8['params']['id']}})['then'](handleEntityNotFound(_0x18a79b,null))[_0xfb9c('0x34')](function(_0x135189){if(_0x135189){_0x5837ff=_0x135189;_0x2efdfd[_0xfb9c('0x43')]=_[_0xfb9c('0x45')](db[_0xfb9c('0x92')][_0xfb9c('0x58')]);_0x2efdfd[_0xfb9c('0x44')]=_[_0xfb9c('0x45')](_0x3717c8['query']);_0x2efdfd[_0xfb9c('0x46')]=_[_0xfb9c('0x47')](_0x2efdfd['model'],_0x2efdfd['query']);_0x44611d[_0xfb9c('0x48')]=_[_0xfb9c('0x47')](_0x2efdfd[_0xfb9c('0x43')],qs[_0xfb9c('0x49')](_0x3717c8['query'][_0xfb9c('0x49')]));_0x44611d[_0xfb9c('0x48')]=_0x44611d['attributes'][_0xfb9c('0x4a')]?_0x44611d['attributes']:_0x2efdfd[_0xfb9c('0x43')];_0x44611d[_0xfb9c('0x63')]=qs[_0xfb9c('0x4d')](_0x3717c8[_0xfb9c('0x44')]['sort']);_0x44611d[_0xfb9c('0x4e')]=qs[_0xfb9c('0x46')](_[_0xfb9c('0x64')](_0x3717c8['query'],_0x2efdfd[_0xfb9c('0x46')]));if(_0x3717c8[_0xfb9c('0x44')]['filter']){_0x44611d[_0xfb9c('0x4e')]=_[_0xfb9c('0x50')](_0x44611d['where'],{'$or':_['map'](_0x44611d[_0xfb9c('0x48')],function(_0x41614a){var _0x3244fb={};_0x3244fb[_0x41614a]={'$like':'%'+_0x3717c8[_0xfb9c('0x44')][_0xfb9c('0x4f')]+'%'};return _0x3244fb;})});}_0x44611d=_[_0xfb9c('0x50')]({},_0x44611d,_0x3717c8[_0xfb9c('0x53')]);return _0x5837ff[_0xfb9c('0x96')](_0x44611d);}})[_0xfb9c('0x34')](function(_0x55ad2f){if(_0x55ad2f){_0x354327=_0x55ad2f['length'];if(!_0x3717c8['query'][_0xfb9c('0x4b')](_0xfb9c('0x4c'))){_0x44611d[_0xfb9c('0x2f')]=qs['limit'](_0x3717c8[_0xfb9c('0x44')]['limit']);_0x44611d[_0xfb9c('0x2e')]=qs['offset'](_0x3717c8[_0xfb9c('0x44')][_0xfb9c('0x2e')]);}return _0x5837ff['getApplications'](_0x44611d);}})[_0xfb9c('0x34')](function(_0x114080){if(_0x114080){return _0x114080?{'count':_0x354327,'rows':_0x114080}:null;}})[_0xfb9c('0x34')](respondWithResult(_0x18a79b,null))['catch'](handleError(_0x18a79b,null));};exports['getMessages']=function(_0x1dd469,_0x557035,_0xef3091){var _0x45c41a={'raw':!![],'where':{}};var _0x24de53={};var _0x31b62a={'count':0x0,'rows':[]};return db[_0xfb9c('0x40')]['findOne']({'where':{'id':_0x1dd469[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x557035,null))[_0xfb9c('0x34')](function(_0x37ed89){if(_0x37ed89){_0x24de53[_0xfb9c('0x43')]=_[_0xfb9c('0x45')](db['MailMessage'][_0xfb9c('0x58')]);_0x24de53[_0xfb9c('0x44')]=_[_0xfb9c('0x45')](_0x1dd469[_0xfb9c('0x44')]);_0x24de53['filters']=_[_0xfb9c('0x47')](_0x24de53['model'],_0x24de53[_0xfb9c('0x44')]);_0x45c41a['attributes']=_['intersection'](_0x24de53[_0xfb9c('0x43')],qs[_0xfb9c('0x49')](_0x1dd469['query'][_0xfb9c('0x49')]));_0x45c41a[_0xfb9c('0x48')]=_0x45c41a[_0xfb9c('0x48')][_0xfb9c('0x4a')]?_0x45c41a[_0xfb9c('0x48')]:_0x24de53['model'];if(!_0x1dd469[_0xfb9c('0x44')][_0xfb9c('0x4b')](_0xfb9c('0x4c'))){_0x45c41a[_0xfb9c('0x2f')]=qs[_0xfb9c('0x2f')](_0x1dd469[_0xfb9c('0x44')][_0xfb9c('0x2f')]);_0x45c41a[_0xfb9c('0x2e')]=qs['offset'](_0x1dd469['query'][_0xfb9c('0x2e')]);}_0x45c41a[_0xfb9c('0x63')]=qs['sort'](_0x1dd469[_0xfb9c('0x44')]['sort']);_0x45c41a[_0xfb9c('0x4e')]=qs[_0xfb9c('0x46')](_['pick'](_0x1dd469[_0xfb9c('0x44')],_0x24de53[_0xfb9c('0x46')]));_0x45c41a[_0xfb9c('0x4e')]['MailAccountId']=_0x37ed89['id'];if(_0x1dd469[_0xfb9c('0x44')]['filter']){_0x45c41a[_0xfb9c('0x4e')]=_[_0xfb9c('0x50')](_0x45c41a[_0xfb9c('0x4e')],{'$or':_[_0xfb9c('0x3f')](_0x45c41a[_0xfb9c('0x48')],function(_0x105db4){var _0x532d54={};_0x532d54[_0x105db4]={'$like':'%'+_0x1dd469[_0xfb9c('0x44')]['filter']+'%'};return _0x532d54;})});}if(_0x1dd469[_0xfb9c('0x44')]['$gte']){var _0x360654=_0x1dd469[_0xfb9c('0x44')][_0xfb9c('0x97')]['split'](',');var _0x191f78={};_0x191f78[_0x360654[0x0]]={'$gte':moment(_0x360654[0x1])[_0xfb9c('0x98')](_0xfb9c('0x99'))};_0x45c41a[_0xfb9c('0x4e')]=_[_0xfb9c('0x50')](_0x45c41a[_0xfb9c('0x4e')],_0x191f78);}_0x45c41a=_[_0xfb9c('0x50')]({},_0x45c41a,_0x1dd469[_0xfb9c('0x53')]);return db[_0xfb9c('0x9a')][_0xfb9c('0x2d')]({'where':_0x45c41a[_0xfb9c('0x4e')]})['then'](function(_0x3484e5){_0x31b62a['count']=_0x3484e5;if(_0x1dd469['query']['includeAll']){_0x45c41a['include']=[{'all':!![]}];}return db[_0xfb9c('0x9a')][_0xfb9c('0x65')](_0x45c41a);})[_0xfb9c('0x34')](function(_0x53bf0a){if(_0x1dd469[_0xfb9c('0x44')][_0xfb9c('0x9b')]===_0xfb9c('0x9c')){for(var _0x565896=0x0;_0x565896<_0x53bf0a[_0xfb9c('0x4a')];_0x565896++){_0x53bf0a[_0x565896][_0xfb9c('0x5c')]=juice(_0x53bf0a[_0x565896]['body']);}}_0x31b62a['rows']=_0x53bf0a;return _0x31b62a;});}})[_0xfb9c('0x34')](respondWithFilteredResult(_0x557035,_0x45c41a))[_0xfb9c('0x29')](handleError(_0x557035,null));};exports['send']=function(_0x2b6a26,_0x617168,_0xdfd08b){var _0x59abf2,_0x3d3d84={},_0x3753ee;if(_0x2b6a26['body']['to']){_0x3753ee=_0x2b6a26[_0xfb9c('0x5c')]['to'][_0xfb9c('0x9d')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x2b6a26[_0xfb9c('0x54')]['id']},'include':[{'model':db[_0xfb9c('0x9e')],'as':'List','include':[{'model':db[_0xfb9c('0x88')],'as':_0xfb9c('0x9f'),'where':{'email':_0x3753ee},'limit':0x1,'order':[[_0xfb9c('0xa0'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xfb9c('0x57'),'raw':!![]}]})[_0xfb9c('0x34')](handleEntityNotFound(_0x617168,null))[_0xfb9c('0x34')](function(_0x36b62f){if(_0x36b62f){_0x59abf2=_0x36b62f;if(_0x36b62f[_0xfb9c('0x57')]){if(_[_0xfb9c('0x6c')](_0x2b6a26[_0xfb9c('0x5c')][_0xfb9c('0xa1')])){_0x2b6a26[_0xfb9c('0x5c')][_0xfb9c('0xa1')]=util[_0xfb9c('0x98')](_0xfb9c('0xa2'),_0x36b62f[_0xfb9c('0x3a')],_0x36b62f[_0xfb9c('0x6b')]||_0x36b62f[_0xfb9c('0x57')][_0xfb9c('0x70')]);}if(_0x2b6a26[_0xfb9c('0x5c')][_0xfb9c('0xa3')]&&_0x2b6a26[_0xfb9c('0x5c')][_0xfb9c('0xa3')]['length']){for(var _0x528af0=0x0;_0x528af0<_0x2b6a26[_0xfb9c('0x5c')][_0xfb9c('0xa3')][_0xfb9c('0x4a')];_0x528af0+=0x1){_0x2b6a26[_0xfb9c('0x5c')][_0xfb9c('0xa3')][_0x528af0]={'filename':_0x2b6a26['body'][_0xfb9c('0xa3')][_0x528af0][_0xfb9c('0x3a')],'path':path[_0xfb9c('0xa4')](config[_0xfb9c('0xa5')],_0xfb9c('0xa6'),_0x2b6a26[_0xfb9c('0x5c')][_0xfb9c('0xa3')][_0x528af0][_0xfb9c('0xa7')])};}}var _0xa2ab0={'tls':{'rejectUnauthorized':![]}};if(_[_0xfb9c('0x6c')](_0x36b62f[_0xfb9c('0x57')][_0xfb9c('0x77')])){if(_0x36b62f[_0xfb9c('0x57')][_0xfb9c('0x74')]){_0xa2ab0[_0xfb9c('0xa8')]={'user':_0x36b62f['Smtp']['user'],'pass':_0x36b62f[_0xfb9c('0x57')][_0xfb9c('0x78')]};}_0xa2ab0[_0xfb9c('0x75')]=_0x36b62f['Smtp'][_0xfb9c('0x75')];_0xa2ab0[_0xfb9c('0x76')]=_0x36b62f[_0xfb9c('0x57')][_0xfb9c('0x76')];_0xa2ab0['secure']=_0x36b62f[_0xfb9c('0x57')][_0xfb9c('0xa9')];}else{_0xa2ab0[_0xfb9c('0x77')]=_0x36b62f['Smtp']['service'];_0xa2ab0['auth']={'user':_0x36b62f[_0xfb9c('0x57')][_0xfb9c('0x70')],'pass':_0x36b62f[_0xfb9c('0x57')]['pass']};}return respondWithRpcPromise(_0xfb9c('0xaa'),_0xfb9c('0xab'),{'account':_0xa2ab0,'message':_0x2b6a26[_0xfb9c('0x5c')]});}else{throw new Error(_0xfb9c('0xac'));}}})[_0xfb9c('0x34')](function(_0xc0db02){if(_0xc0db02){_0x3d3d84=_0xc0db02;if(_0x59abf2[_0xfb9c('0xad')]){if(_0x59abf2[_0xfb9c('0xad')][_0xfb9c('0x9f')][_0xfb9c('0x4a')]){return _0x59abf2[_0xfb9c('0xad')]['Contacts'][0x0];}else{return db[_0xfb9c('0x88')][_0xfb9c('0x61')](_[_0xfb9c('0xae')](_0x2b6a26[_0xfb9c('0x5c')],{'firstName':_0x2b6a26[_0xfb9c('0x5c')]['to'],'email':_0x2b6a26[_0xfb9c('0x5c')]['to'],'phone':_0x2b6a26['body']['to'],'ListId':_0x59abf2[_0xfb9c('0xaf')]}));}}else{throw new Error(_0xfb9c('0xac'));}}})['then'](function(_0x25ea70){if(_0x25ea70){var _0x45f6ad={'UserId':_0x2b6a26[_0xfb9c('0x70')]['id'],'ContactId':_0x25ea70['id'],'MailAccountId':_0x59abf2['id'],'inReplyTo':_0x3d3d84['messageId'],'to':_0x2b6a26['body']['from'],'cc':_0x2b6a26[_0xfb9c('0x5c')]['cc'],'subject':_0x2b6a26[_0xfb9c('0x5c')]['subject'],'attach':_0x2b6a26[_0xfb9c('0x5c')]['attach'],'firstMsgDirection':_0xfb9c('0xb0'),'lastMsgAt':moment()['format'](_0xfb9c('0x99')),'lastMsgDirection':_0xfb9c('0xb0'),'lastMsgBody':_0x2b6a26['body']['body'],'Messages':[_[_0xfb9c('0x50')](_0x2b6a26['body'],{'messageId':_0x3d3d84[_0xfb9c('0xb1')],'sentAt':moment()[_0xfb9c('0x98')](_0xfb9c('0x99')),'read':!![],'MailAccountId':_0x59abf2['id'],'UserId':_0x2b6a26[_0xfb9c('0x70')]['id'],'ContactId':_0x25ea70['id']})]};if(_0x2b6a26[_0xfb9c('0x5c')][_0xfb9c('0xb2')]){_0x45f6ad=_[_0xfb9c('0x50')](_0x45f6ad,_0x2b6a26[_0xfb9c('0x5c')]['Interaction']);}return db['MailInteraction'][_0xfb9c('0x61')](_0x45f6ad,{'include':[{'model':db[_0xfb9c('0x9a')],'as':_0xfb9c('0xb3')}]});}})[_0xfb9c('0x34')](respondWithResult(_0x617168,null))['catch'](handleError(_0x617168,null));};exports[_0xfb9c('0xb4')]=function(_0x27e6c6,_0x2fd725,_0x597898){return db[_0xfb9c('0x40')][_0xfb9c('0x5b')]({'where':{'id':_0x27e6c6[_0xfb9c('0x54')]['id']},'include':[{'model':db[_0xfb9c('0x56')],'as':'Smtp','raw':!![]}]})[_0xfb9c('0x34')](handleEntityNotFound(_0x2fd725,null))[_0xfb9c('0x34')](function(_0x5a12f7){if(_0x5a12f7&&_0x5a12f7[_0xfb9c('0x57')]){var _0x284068={'id':_0x5a12f7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5a12f7[_0xfb9c('0x57')][_0xfb9c('0x77')]){_0x284068[_0xfb9c('0x77')]=_0x5a12f7['Smtp']['service'];}else{_0x284068[_0xfb9c('0x75')]=_0x5a12f7[_0xfb9c('0x57')]['host'];_0x284068['port']=_0x5a12f7[_0xfb9c('0x57')][_0xfb9c('0x76')];_0x284068[_0xfb9c('0xa9')]=_0x5a12f7[_0xfb9c('0x57')]['secure'];}if(_0x5a12f7[_0xfb9c('0x57')][_0xfb9c('0x74')]){_0x284068[_0xfb9c('0xa8')]={'user':_0x5a12f7[_0xfb9c('0x57')]['user'],'pass':_0x5a12f7[_0xfb9c('0x57')][_0xfb9c('0x78')]};}return respondWithRpcPromise(_0xfb9c('0xb5'),'verifySmtp',{'account':_0x284068});}})[_0xfb9c('0x34')](respondWithResult(_0x2fd725,null))[_0xfb9c('0x29')](handleError(_0x2fd725,null));};exports[_0xfb9c('0x35')]=function(_0x4f05ae,_0xe051b2){return db[_0xfb9c('0x40')][_0xfb9c('0x5b')]({'where':{'id':_0x4f05ae[_0xfb9c('0x54')]['id']}})['then'](handleEntityNotFound(_0xe051b2,null))['then'](function(_0x2c0187){if(_0x2c0187&&_0x2c0187[_0xfb9c('0x77')]){throw new db[(_0xfb9c('0xb6'))][(_0xfb9c('0xb7'))](_0xfb9c('0xb8'));}return _0x2c0187;})['then'](removeEntity(_0xe051b2,null))[_0xfb9c('0x29')](handleError(_0xe051b2,null));};exports['addAgents']=function(_0x403fca,_0x148bff,_0x50c4c0){return db['MailAccount'][_0xfb9c('0x5b')]({'where':{'id':_0x403fca[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x148bff,null))[_0xfb9c('0x34')](function(_0x49b9d9){if(_0x49b9d9){return _0x49b9d9[_0xfb9c('0xb9')](_0x403fca[_0xfb9c('0x5c')][_0xfb9c('0x67')],_[_0xfb9c('0x87')](_0x403fca[_0xfb9c('0x5c')],[_0xfb9c('0x67'),'id'])||{})[_0xfb9c('0xba')](function(_0x4ca820){for(var _0x4ee4fe=0x0;_0x4ee4fe<_0x403fca[_0xfb9c('0x5c')]['ids']['length'];_0x4ee4fe+=0x1){socket[_0xfb9c('0xbb')](_0xfb9c('0xbc'),{'UserId':_0x403fca[_0xfb9c('0x5c')][_0xfb9c('0x67')][_0x4ee4fe],'MailAccountId':_0x403fca[_0xfb9c('0x54')]['id']});}return _0x4ca820;});}})[_0xfb9c('0x34')](respondWithResult(_0x148bff,null))[_0xfb9c('0x29')](handleError(_0x148bff,null));};exports[_0xfb9c('0xbd')]=function(_0x6c7701,_0x51f048,_0x1d90b7){return db[_0xfb9c('0x40')][_0xfb9c('0x5b')]({'where':{'id':_0x6c7701[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x51f048,null))[_0xfb9c('0x34')](function(_0xd9068f){if(_0xd9068f){return _0xd9068f[_0xfb9c('0xbd')](_0x6c7701[_0xfb9c('0x44')][_0xfb9c('0x67')])[_0xfb9c('0x34')](function(){if(_[_0xfb9c('0xbe')](_0x6c7701[_0xfb9c('0x44')][_0xfb9c('0x67')])){for(var _0x37f5bf=0x0;_0x37f5bf<_0x6c7701[_0xfb9c('0x44')][_0xfb9c('0x67')][_0xfb9c('0x4a')];_0x37f5bf+=0x1){socket['emit'](_0xfb9c('0xbf'),{'UserId':Number(_0x6c7701[_0xfb9c('0x44')][_0xfb9c('0x67')][_0x37f5bf]),'MailAccountId':Number(_0x6c7701['params']['id'])});}}else{socket[_0xfb9c('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x6c7701['query'][_0xfb9c('0x67')]),'MailAccountId':Number(_0x6c7701[_0xfb9c('0x54')]['id'])});}});}})[_0xfb9c('0x34')](respondWithStatusCode(_0x51f048,null))[_0xfb9c('0x29')](handleError(_0x51f048,null));};exports[_0xfb9c('0xc0')]=function(_0x507cf3,_0x273f8a,_0x3650e6){var _0x566b3e={};var _0x131e94={};var _0x59737e;var _0x215555;return db[_0xfb9c('0x40')][_0xfb9c('0x62')]({'where':{'id':_0x507cf3[_0xfb9c('0x54')]['id']}})[_0xfb9c('0x34')](handleEntityNotFound(_0x273f8a,null))[_0xfb9c('0x34')](function(_0x29acdf){if(_0x29acdf){_0x59737e=_0x29acdf;_0x131e94[_0xfb9c('0x43')]=_[_0xfb9c('0x45')](db[_0xfb9c('0x8a')][_0xfb9c('0x58')]);_0x131e94[_0xfb9c('0x44')]=_[_0xfb9c('0x45')](_0x507cf3[_0xfb9c('0x44')]);_0x131e94[_0xfb9c('0x46')]=_[_0xfb9c('0x47')](_0x131e94['model'],_0x131e94[_0xfb9c('0x44')]);_0x566b3e[_0xfb9c('0x48')]=_[_0xfb9c('0x47')](_0x131e94['model'],qs['fields'](_0x507cf3[_0xfb9c('0x44')][_0xfb9c('0x49')]));_0x566b3e[_0xfb9c('0x48')]=_0x566b3e[_0xfb9c('0x48')][_0xfb9c('0x4a')]?_0x566b3e[_0xfb9c('0x48')]:_0x131e94[_0xfb9c('0x43')];_0x566b3e['order']=qs[_0xfb9c('0x4d')](_0x507cf3[_0xfb9c('0x44')][_0xfb9c('0x4d')]);_0x566b3e[_0xfb9c('0x4e')]=qs[_0xfb9c('0x46')](_[_0xfb9c('0x64')](_0x507cf3[_0xfb9c('0x44')],_0x131e94[_0xfb9c('0x46')]));if(_0x507cf3[_0xfb9c('0x44')][_0xfb9c('0x4f')]){_0x566b3e[_0xfb9c('0x4e')]=_[_0xfb9c('0x50')](_0x566b3e[_0xfb9c('0x4e')],{'$or':_[_0xfb9c('0x3f')](_0x566b3e[_0xfb9c('0x48')],function(_0x3d5a2d){var _0x44205b={};_0x44205b[_0x3d5a2d]={'$like':'%'+_0x507cf3[_0xfb9c('0x44')][_0xfb9c('0x4f')]+'%'};return _0x44205b;})});}_0x566b3e=_[_0xfb9c('0x50')]({},_0x566b3e,_0x507cf3['options']);return _0x59737e[_0xfb9c('0xc0')](_0x566b3e);}})['then'](function(_0x253ab0){if(_0x253ab0){_0x215555=_0x253ab0[_0xfb9c('0x4a')];if(!_0x507cf3[_0xfb9c('0x44')]['hasOwnProperty']('nolimit')){_0x566b3e[_0xfb9c('0x2f')]=qs[_0xfb9c('0x2f')](_0x507cf3[_0xfb9c('0x44')][_0xfb9c('0x2f')]);_0x566b3e[_0xfb9c('0x2e')]=qs[_0xfb9c('0x2e')](_0x507cf3[_0xfb9c('0x44')]['offset']);}return _0x59737e['getAgents'](_0x566b3e);}})['then'](function(_0x3ad303){if(_0x3ad303){return _0x3ad303?{'count':_0x215555,'rows':_0x3ad303}:null;}})['then'](respondWithResult(_0x273f8a,null))[_0xfb9c('0x29')](handleError(_0x273f8a,null));}; \ No newline at end of file +var _0xce7c=['VIRTUAL','options','includeAll','include','findAll','rows','show','params','Smtp','find','catch','update','body','describe','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','order','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','email','active','cservice','user','pass','authentication','host','port','service','cuser','password','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','Contacts','updatedAt','DESC','isNil','from','format','%s\x20<%s>','attachments','root','basename','auth','secure','SendMail','sendMail','ListId','List\x20not\x20found','subject','attach','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','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','./mailAccount.socket','jayson/promise','client','http','request','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','then','MailAccounts','UserProfileResource','name','index','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0xce7c,0x13a));var _0xcce7=function(_0x5eb294,_0x5b52ba){_0x5eb294=_0x5eb294-0x0;var _0xd139fd=_0xce7c[_0x5eb294];return _0xd139fd;};'use strict';var pdf=require(_0xcce7('0x0'));var emlformat=require(_0xcce7('0x1'));var rimraf=require(_0xcce7('0x2'));var zipdir=require(_0xcce7('0x3'));var jsonpatch=require(_0xcce7('0x4'));var rp=require(_0xcce7('0x5'));var moment=require(_0xcce7('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcce7('0x7'));var path=require(_0xcce7('0x8'));var sox=require(_0xcce7('0x9'));var csv=require('to-csv');var ejs=require(_0xcce7('0xa'));var fs=require('fs');var _=require(_0xcce7('0xb'));var squel=require(_0xcce7('0xc'));var crypto=require(_0xcce7('0xd'));var jsforce=require(_0xcce7('0xe'));var deskjs=require(_0xcce7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcce7('0x10'));var Papa=require(_0xcce7('0x11'));var htmlToText=require(_0xcce7('0x12'));var juice=require(_0xcce7('0x13'));var Redis=require(_0xcce7('0x14'));var authService=require(_0xcce7('0x15'));var qs=require(_0xcce7('0x16'));var as=require(_0xcce7('0x17'));var hardwareService=require(_0xcce7('0x18'));var logger=require('../../config/logger')(_0xcce7('0x19'));var utils=require(_0xcce7('0x1a'));var config=require(_0xcce7('0x1b'));var licenseUtil=require(_0xcce7('0x1c'));var db=require(_0xcce7('0x1d'))['db'];config[_0xcce7('0x1e')]=_[_0xcce7('0x1f')](config[_0xcce7('0x1e')],{'host':_0xcce7('0x20'),'port':0x18eb});var socket=require(_0xcce7('0x21'))(new Redis(config['redis']));require(_0xcce7('0x22'))['register'](socket);var jayson=require(_0xcce7('0x23'));var client=jayson[_0xcce7('0x24')][_0xcce7('0x25')]({'port':0x232b});function respondWithRpcPromise(_0x5d2337,_0x51e342,_0x234b40,_0x4e6e5f){return new BPromise(function(_0x2632a0,_0x3b6729){var _0x129ea6=_0x4e6e5f||client;return _0x129ea6[_0xcce7('0x26')](_0x5d2337,_0x234b40)['then'](function(_0xa85a25){logger[_0xcce7('0x27')]('MailAccount,\x20%s,\x20%s',_0x51e342,'request\x20sent');logger[_0xcce7('0x28')](_0xcce7('0x29'),_0x51e342,_0xcce7('0x2a'),JSON[_0xcce7('0x2b')](_0xa85a25));if(_0xa85a25[_0xcce7('0x2c')]){if(_0xa85a25['error'][_0xcce7('0x2d')]===0x1f4){logger[_0xcce7('0x2c')](_0xcce7('0x2e'),_0x51e342,_0xa85a25['error'][_0xcce7('0x2f')]);return _0x3b6729(_0xa85a25[_0xcce7('0x2c')][_0xcce7('0x2f')]);}logger[_0xcce7('0x2c')](_0xcce7('0x2e'),_0x51e342,_0xa85a25[_0xcce7('0x2c')][_0xcce7('0x2f')]);return _0x2632a0(_0xa85a25[_0xcce7('0x2c')][_0xcce7('0x2f')]);}else{logger[_0xcce7('0x27')](_0xcce7('0x2e'),_0x51e342,_0xcce7('0x2a'));_0x2632a0(_0xa85a25[_0xcce7('0x30')]['message']);}})['catch'](function(_0x41eff2){logger['error']('MailAccount,\x20%s,\x20%s',_0x51e342,_0x41eff2);_0x3b6729(_0x41eff2);});});}function respondWithStatusCode(_0x46e4ff,_0x30cfc9){_0x30cfc9=_0x30cfc9||0xcc;return function(_0x584535){if(_0x584535){return _0x46e4ff[_0xcce7('0x31')](_0x30cfc9);}return _0x46e4ff[_0xcce7('0x32')](_0x30cfc9)[_0xcce7('0x33')]();};}function respondWithResult(_0x722068,_0x4efa11){_0x4efa11=_0x4efa11||0xc8;return function(_0x48c207){if(_0x48c207){return _0x722068[_0xcce7('0x32')](_0x4efa11)[_0xcce7('0x34')](_0x48c207);}};}function respondWithFilteredResult(_0x30345e,_0x184120){return function(_0x323253){if(_0x323253){var _0x544159=_0x323253[_0xcce7('0x35')],_0xb477a=_0x184120['offset'],_0x2a14d2=_0x184120[_0xcce7('0x36')]+_0x184120[_0xcce7('0x37')],_0x4486e9;if(_0x2a14d2>=_0x544159){_0x2a14d2=_0x544159;_0x4486e9=0xc8;}else{_0x4486e9=0xce;}_0x30345e[_0xcce7('0x32')](_0x4486e9);return _0x30345e[_0xcce7('0x38')](_0xcce7('0x39'),_0xb477a+'-'+_0x2a14d2+'/'+_0x544159)['json'](_0x323253);}return null;};}function patchUpdates(_0xfc5294){return function(_0x2ac838){try{jsonpatch[_0xcce7('0x3a')](_0x2ac838,_0xfc5294,!![]);}catch(_0x3fffe8){return BPromise[_0xcce7('0x3b')](_0x3fffe8);}return _0x2ac838['save']();};}function saveUpdates(_0x1ddeea,_0x4e7ce8){return function(_0x3ab19c){if(_0x3ab19c){return _0x3ab19c['update'](_0x1ddeea)['then'](function(_0x41a68c){return _0x41a68c;});}return null;};}function removeEntity(_0x2f18aa,_0x10c401){return function(_0x44d790){if(_0x44d790){return _0x44d790[_0xcce7('0x3c')]()[_0xcce7('0x3d')](function(){var _0x1ad693=_0x44d790['get']({'plain':!![]});var _0x1389e2=_0xcce7('0x3e');return db[_0xcce7('0x3f')][_0xcce7('0x3c')]({'where':{'type':_0x1389e2,'resourceId':_0x1ad693['id']}})[_0xcce7('0x3d')](function(){return _0x44d790;});})[_0xcce7('0x3d')](function(){_0x2f18aa[_0xcce7('0x32')](0xcc)[_0xcce7('0x33')]();});}};}function handleEntityNotFound(_0x5ed929,_0x5dddb3){return function(_0x50509f){if(!_0x50509f){_0x5ed929[_0xcce7('0x31')](0x194);}return _0x50509f;};}function handleError(_0x568ef1,_0x497e82){_0x497e82=_0x497e82||0x1f4;return function(_0x2d13f9){logger[_0xcce7('0x2c')](_0x2d13f9['stack']);if(_0x2d13f9[_0xcce7('0x40')]){delete _0x2d13f9[_0xcce7('0x40')];}_0x568ef1[_0xcce7('0x32')](_0x497e82)['send'](_0x2d13f9);};}exports[_0xcce7('0x41')]=function(_0x5b0b2c,_0x31598a){var _0x50ef94={'include':[{'model':db[_0xcce7('0x42')],'as':_0xcce7('0x43')},{'model':db[_0xcce7('0x44')],'as':'Smtp'},{'model':db[_0xcce7('0x45')],'as':_0xcce7('0x46')}]},_0xcc3215={},_0x38adf1={'count':0x0,'rows':[]};var _0x833c81=_[_0xcce7('0x47')](db[_0xcce7('0x48')][_0xcce7('0x49')],function(_0xa13237){return{'name':_0xa13237[_0xcce7('0x4a')],'type':_0xa13237[_0xcce7('0x4b')]['key']};});_0xcc3215[_0xcce7('0x4c')]=_[_0xcce7('0x47')](_0x833c81,_0xcce7('0x40'));_0xcc3215[_0xcce7('0x4d')]=_[_0xcce7('0x4e')](_0x5b0b2c[_0xcce7('0x4d')]);_0xcc3215['filters']=_['intersection'](_0xcc3215[_0xcce7('0x4c')],_0xcc3215['query']);_0x50ef94[_0xcce7('0x4f')]=_[_0xcce7('0x50')](_0xcc3215[_0xcce7('0x4c')],qs[_0xcce7('0x51')](_0x5b0b2c[_0xcce7('0x4d')][_0xcce7('0x51')]));_0x50ef94[_0xcce7('0x4f')]=_0x50ef94[_0xcce7('0x4f')][_0xcce7('0x52')]?_0x50ef94[_0xcce7('0x4f')]:_0xcc3215['model'];if(!_0x5b0b2c[_0xcce7('0x4d')][_0xcce7('0x53')]('nolimit')){_0x50ef94['limit']=qs[_0xcce7('0x37')](_0x5b0b2c[_0xcce7('0x4d')][_0xcce7('0x37')]);_0x50ef94[_0xcce7('0x36')]=qs[_0xcce7('0x36')](_0x5b0b2c[_0xcce7('0x4d')][_0xcce7('0x36')]);}_0x50ef94['order']=qs[_0xcce7('0x54')](_0x5b0b2c[_0xcce7('0x4d')][_0xcce7('0x54')]);_0x50ef94[_0xcce7('0x55')]=qs[_0xcce7('0x56')](_[_0xcce7('0x57')](_0x5b0b2c[_0xcce7('0x4d')],_0xcc3215[_0xcce7('0x56')]),_0x833c81);if(_0x5b0b2c[_0xcce7('0x4d')][_0xcce7('0x58')]){_0x50ef94[_0xcce7('0x55')]=_[_0xcce7('0x59')](_0x50ef94['where'],{'$or':_[_0xcce7('0x47')](_0x833c81,function(_0x52e178){if(_0x52e178[_0xcce7('0x4b')]!==_0xcce7('0x5a')){var _0x4f645f={};_0x4f645f[_0x52e178[_0xcce7('0x40')]]={'$like':'%'+_0x5b0b2c[_0xcce7('0x4d')][_0xcce7('0x58')]+'%'};return _0x4f645f;}})});}_0x50ef94=_[_0xcce7('0x59')]({},_0x50ef94,_0x5b0b2c[_0xcce7('0x5b')]);var _0x3606c2={'where':_0x50ef94[_0xcce7('0x55')]};return db[_0xcce7('0x48')]['count'](_0x3606c2)[_0xcce7('0x3d')](function(_0x3dc0a4){_0x38adf1['count']=_0x3dc0a4;if(_0x5b0b2c[_0xcce7('0x4d')][_0xcce7('0x5c')]){_0x50ef94[_0xcce7('0x5d')]=[{'all':!![]}];}return db[_0xcce7('0x48')][_0xcce7('0x5e')](_0x50ef94);})[_0xcce7('0x3d')](function(_0x572123){_0x38adf1[_0xcce7('0x5f')]=_0x572123;return _0x38adf1;})[_0xcce7('0x3d')](respondWithFilteredResult(_0x31598a,_0x50ef94))['catch'](handleError(_0x31598a,null));};exports[_0xcce7('0x60')]=function(_0x3ea186,_0x53020b){var _0x1ed70c={'raw':![],'where':{'id':_0x3ea186[_0xcce7('0x61')]['id']},'include':[{'model':db[_0xcce7('0x42')],'as':'Imap'},{'model':db[_0xcce7('0x44')],'as':_0xcce7('0x62')},{'model':db[_0xcce7('0x45')],'as':_0xcce7('0x46')}]},_0x598940={};_0x598940[_0xcce7('0x4c')]=_[_0xcce7('0x4e')](db['MailAccount'][_0xcce7('0x49')]);_0x598940['query']=_[_0xcce7('0x4e')](_0x3ea186[_0xcce7('0x4d')]);_0x598940['filters']=_[_0xcce7('0x50')](_0x598940[_0xcce7('0x4c')],_0x598940[_0xcce7('0x4d')]);_0x1ed70c['attributes']=_[_0xcce7('0x50')](_0x598940[_0xcce7('0x4c')],qs['fields'](_0x3ea186[_0xcce7('0x4d')][_0xcce7('0x51')]));_0x1ed70c[_0xcce7('0x4f')]=_0x1ed70c[_0xcce7('0x4f')]['length']?_0x1ed70c[_0xcce7('0x4f')]:_0x598940[_0xcce7('0x4c')];if(_0x3ea186[_0xcce7('0x4d')][_0xcce7('0x5c')]){_0x1ed70c['include']=[{'all':!![]}];}_0x1ed70c=_['merge']({},_0x1ed70c,_0x3ea186[_0xcce7('0x5b')]);return db[_0xcce7('0x48')][_0xcce7('0x63')](_0x1ed70c)[_0xcce7('0x3d')](handleEntityNotFound(_0x53020b,null))[_0xcce7('0x3d')](respondWithResult(_0x53020b,null))[_0xcce7('0x64')](handleError(_0x53020b,null));};exports[_0xcce7('0x65')]=function(_0x53e484,_0x148e39){if(_0x53e484['body']['id']){delete _0x53e484[_0xcce7('0x66')]['id'];}return db[_0xcce7('0x48')][_0xcce7('0x63')]({'where':{'id':_0x53e484[_0xcce7('0x61')]['id']},'include':[{'model':db[_0xcce7('0x42')],'as':_0xcce7('0x43')},{'model':db[_0xcce7('0x44')],'as':_0xcce7('0x62')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xcce7('0x3d')](handleEntityNotFound(_0x148e39,null))['then'](saveUpdates(_0x53e484['body'],null))[_0xcce7('0x3d')](function(_0x1b08f0){if(_0x1b08f0&&_0x53e484[_0xcce7('0x66')]['Imap']){return db[_0xcce7('0x42')]['update'](_0x53e484[_0xcce7('0x66')][_0xcce7('0x43')],{'where':{'MailAccountId':_0x1b08f0['id']}})[_0xcce7('0x3d')](function(){return _0x1b08f0;});}return _0x1b08f0;})['then'](function(_0x11517c){if(_0x11517c&&_0x53e484[_0xcce7('0x66')][_0xcce7('0x62')]){return db[_0xcce7('0x44')]['update'](_0x53e484[_0xcce7('0x66')][_0xcce7('0x62')],{'where':{'MailAccountId':_0x11517c['id']}})[_0xcce7('0x3d')](function(){return _0x11517c;});}return _0x11517c;})[_0xcce7('0x3d')](respondWithResult(_0x148e39,null))['catch'](handleError(_0x148e39,null));};exports[_0xcce7('0x67')]=function(_0x52111a,_0x322ad0){return db['MailAccount'][_0xcce7('0x67')]()[_0xcce7('0x3d')](respondWithResult(_0x322ad0,null))[_0xcce7('0x64')](handleError(_0x322ad0,null));};exports['addDisposition']=function(_0x19f0c7,_0x4671a2,_0x237d38){if(_0x19f0c7[_0xcce7('0x66')]['id']){delete _0x19f0c7['body']['id'];}return db[_0xcce7('0x48')]['find']({'where':{'id':_0x19f0c7['params']['id']}})['then'](handleEntityNotFound(_0x4671a2,null))[_0xcce7('0x3d')](function(_0xf7b830){if(_0xf7b830){_0x19f0c7[_0xcce7('0x66')][_0xcce7('0x68')]=_0xf7b830['id'];return db[_0xcce7('0x69')][_0xcce7('0x6a')](_0x19f0c7['body']);}})[_0xcce7('0x3d')](respondWithResult(_0x4671a2,null))[_0xcce7('0x64')](handleError(_0x4671a2,null));};exports[_0xcce7('0x6b')]=function(_0x367899,_0x25cf41,_0x3c1644){var _0x3021f9={'raw':![],'where':{}};var _0x432806={};var _0x84acac={'count':0x0,'rows':[]};return db[_0xcce7('0x48')][_0xcce7('0x6c')]({'where':{'id':_0x367899['params']['id']}})['then'](handleEntityNotFound(_0x25cf41,null))[_0xcce7('0x3d')](function(_0x48a277){if(_0x48a277){_0x432806[_0xcce7('0x4c')]=_['keys'](db[_0xcce7('0x69')][_0xcce7('0x49')]);_0x432806[_0xcce7('0x4d')]=_[_0xcce7('0x4e')](_0x367899[_0xcce7('0x4d')]);_0x432806[_0xcce7('0x56')]=_[_0xcce7('0x50')](_0x432806[_0xcce7('0x4c')],_0x432806['query']);_0x3021f9[_0xcce7('0x4f')]=_[_0xcce7('0x50')](_0x432806[_0xcce7('0x4c')],qs[_0xcce7('0x51')](_0x367899[_0xcce7('0x4d')][_0xcce7('0x51')]));_0x3021f9['attributes']=_0x3021f9[_0xcce7('0x4f')]['length']?_0x3021f9[_0xcce7('0x4f')]:_0x432806[_0xcce7('0x4c')];if(!_0x367899[_0xcce7('0x4d')][_0xcce7('0x53')](_0xcce7('0x6d'))){_0x3021f9[_0xcce7('0x37')]=qs[_0xcce7('0x37')](_0x367899[_0xcce7('0x4d')][_0xcce7('0x37')]);_0x3021f9[_0xcce7('0x36')]=qs[_0xcce7('0x36')](_0x367899[_0xcce7('0x4d')][_0xcce7('0x36')]);}_0x3021f9[_0xcce7('0x6e')]=qs[_0xcce7('0x54')](_0x367899[_0xcce7('0x4d')][_0xcce7('0x54')]);_0x3021f9['where']=qs[_0xcce7('0x56')](_['pick'](_0x367899[_0xcce7('0x4d')],_0x432806[_0xcce7('0x56')]));_0x3021f9[_0xcce7('0x55')][_0xcce7('0x68')]=_0x48a277['id'];if(_0x367899[_0xcce7('0x4d')][_0xcce7('0x58')]){_0x3021f9['where']=_[_0xcce7('0x59')](_0x3021f9[_0xcce7('0x55')],{'$or':_['map'](_0x3021f9['attributes'],function(_0x4f7028){var _0x5a3a68={};_0x5a3a68[_0x4f7028]={'$like':'%'+_0x367899[_0xcce7('0x4d')]['filter']+'%'};return _0x5a3a68;})});}_0x3021f9=_[_0xcce7('0x59')]({},_0x3021f9,_0x367899[_0xcce7('0x5b')]);return db['Disposition'][_0xcce7('0x35')]({'where':_0x3021f9[_0xcce7('0x55')]})['then'](function(_0x532bff){_0x84acac['count']=_0x532bff;if(_0x367899['query']['includeAll']){_0x3021f9[_0xcce7('0x5d')]=[{'all':!![]}];}return db[_0xcce7('0x69')][_0xcce7('0x5e')](_0x3021f9);})[_0xcce7('0x3d')](function(_0x5bd7fd){_0x84acac[_0xcce7('0x5f')]=_0x5bd7fd;return _0x84acac;});}})[_0xcce7('0x3d')](respondWithFilteredResult(_0x25cf41,_0x3021f9))[_0xcce7('0x64')](handleError(_0x25cf41,null));};exports['removeDispositions']=function(_0x2c8652,_0x1c1e31,_0x550f1f){return db['MailAccount'][_0xcce7('0x63')]({'where':{'id':_0x2c8652[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x1c1e31,null))[_0xcce7('0x3d')](function(_0xd4a29c){if(_0xd4a29c){return _0xd4a29c['removeDispositions'](_0x2c8652[_0xcce7('0x4d')][_0xcce7('0x6f')]);}})[_0xcce7('0x3d')](respondWithStatusCode(_0x1c1e31,null))[_0xcce7('0x64')](handleError(_0x1c1e31,null));};exports[_0xcce7('0x70')]=function(_0x38922c,_0x579ef1,_0x5501bd){if(_0x38922c['body']['id']){delete _0x38922c[_0xcce7('0x66')]['id'];}return db[_0xcce7('0x48')][_0xcce7('0x63')]({'where':{'id':_0x38922c[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x579ef1,null))[_0xcce7('0x3d')](function(_0x5316d3){if(_0x5316d3){_0x38922c[_0xcce7('0x66')][_0xcce7('0x68')]=_0x5316d3['id'];return db[_0xcce7('0x71')][_0xcce7('0x6a')](_0x38922c['body']);}})[_0xcce7('0x3d')](respondWithResult(_0x579ef1,null))[_0xcce7('0x64')](handleError(_0x579ef1,null));};exports[_0xcce7('0x72')]=function(_0x4ddf4d,_0x35a864,_0x4504a1){var _0xbf21={'raw':![],'where':{}};var _0x912b9d={};var _0xb7a128={'count':0x0,'rows':[]};return db[_0xcce7('0x48')][_0xcce7('0x6c')]({'where':{'id':_0x4ddf4d['params']['id']}})['then'](handleEntityNotFound(_0x35a864,null))[_0xcce7('0x3d')](function(_0x38a051){if(_0x38a051){_0x912b9d['model']=_['keys'](db[_0xcce7('0x71')][_0xcce7('0x49')]);_0x912b9d[_0xcce7('0x4d')]=_['keys'](_0x4ddf4d[_0xcce7('0x4d')]);_0x912b9d[_0xcce7('0x56')]=_[_0xcce7('0x50')](_0x912b9d['model'],_0x912b9d['query']);_0xbf21[_0xcce7('0x4f')]=_[_0xcce7('0x50')](_0x912b9d[_0xcce7('0x4c')],qs[_0xcce7('0x51')](_0x4ddf4d[_0xcce7('0x4d')][_0xcce7('0x51')]));_0xbf21[_0xcce7('0x4f')]=_0xbf21[_0xcce7('0x4f')][_0xcce7('0x52')]?_0xbf21[_0xcce7('0x4f')]:_0x912b9d[_0xcce7('0x4c')];if(!_0x4ddf4d[_0xcce7('0x4d')][_0xcce7('0x53')]('nolimit')){_0xbf21[_0xcce7('0x37')]=qs[_0xcce7('0x37')](_0x4ddf4d[_0xcce7('0x4d')]['limit']);_0xbf21[_0xcce7('0x36')]=qs[_0xcce7('0x36')](_0x4ddf4d[_0xcce7('0x4d')][_0xcce7('0x36')]);}_0xbf21[_0xcce7('0x6e')]=qs[_0xcce7('0x54')](_0x4ddf4d[_0xcce7('0x4d')][_0xcce7('0x54')]);_0xbf21[_0xcce7('0x55')]=qs[_0xcce7('0x56')](_[_0xcce7('0x57')](_0x4ddf4d[_0xcce7('0x4d')],_0x912b9d[_0xcce7('0x56')]));_0xbf21[_0xcce7('0x55')][_0xcce7('0x68')]=_0x38a051['id'];if(_0x4ddf4d['query']['filter']){_0xbf21[_0xcce7('0x55')]=_[_0xcce7('0x59')](_0xbf21['where'],{'$or':_[_0xcce7('0x47')](_0xbf21['attributes'],function(_0x4eeae0){var _0x206b81={};_0x206b81[_0x4eeae0]={'$like':'%'+_0x4ddf4d[_0xcce7('0x4d')][_0xcce7('0x58')]+'%'};return _0x206b81;})});}_0xbf21=_['merge']({},_0xbf21,_0x4ddf4d[_0xcce7('0x5b')]);return db['CannedAnswer']['count']({'where':_0xbf21[_0xcce7('0x55')]})[_0xcce7('0x3d')](function(_0x5b6b85){_0xb7a128['count']=_0x5b6b85;if(_0x4ddf4d[_0xcce7('0x4d')][_0xcce7('0x5c')]){_0xbf21[_0xcce7('0x5d')]=[{'all':!![]}];}return db[_0xcce7('0x71')][_0xcce7('0x5e')](_0xbf21);})[_0xcce7('0x3d')](function(_0x327489){_0xb7a128[_0xcce7('0x5f')]=_0x327489;return _0xb7a128;});}})[_0xcce7('0x3d')](respondWithFilteredResult(_0x35a864,_0xbf21))[_0xcce7('0x64')](handleError(_0x35a864,null));};exports['removeAnswers']=function(_0x3c7915,_0x4d71e2,_0x493189){return db[_0xcce7('0x48')]['find']({'where':{'id':_0x3c7915[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x4d71e2,null))[_0xcce7('0x3d')](function(_0x1a1a9a){if(_0x1a1a9a){return _0x1a1a9a[_0xcce7('0x73')](_0x3c7915['query'][_0xcce7('0x6f')]);}})[_0xcce7('0x3d')](respondWithStatusCode(_0x4d71e2,null))['catch'](handleError(_0x4d71e2,null));};exports[_0xcce7('0x6a')]=function(_0x4ab454,_0x14a1d6){var _0x5573ff={'name':_0x4ab454[_0xcce7('0x66')]['name'],'key':_0x4ab454[_0xcce7('0x66')][_0xcce7('0x74')],'email':_0x4ab454[_0xcce7('0x66')][_0xcce7('0x75')],'ListId':_0x4ab454[_0xcce7('0x66')]['ListId'],'active':!_['isNil'](_0x4ab454['body'][_0xcce7('0x76')])?_0x4ab454['body']['active']:!![],'description':_0x4ab454[_0xcce7('0x66')]['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x4ab454['body'][_0xcce7('0x77')])){if(_0x4ab454[_0xcce7('0x66')]['cauthentication']){_0x5573ff[_0xcce7('0x43')]['user']=_0x5573ff['Smtp'][_0xcce7('0x78')]=_0x4ab454[_0xcce7('0x66')]['cuser'];_0x5573ff[_0xcce7('0x43')]['password']=_0x5573ff[_0xcce7('0x62')][_0xcce7('0x79')]=_0x4ab454[_0xcce7('0x66')]['cpassword'];}else{_0x5573ff[_0xcce7('0x43')][_0xcce7('0x7a')]=_0x5573ff[_0xcce7('0x62')][_0xcce7('0x7a')]=![];}_0x5573ff[_0xcce7('0x43')][_0xcce7('0x7b')]=_0x4ab454[_0xcce7('0x66')][_0xcce7('0x43')][_0xcce7('0x7b')];_0x5573ff[_0xcce7('0x43')][_0xcce7('0x7c')]=_0x4ab454[_0xcce7('0x66')][_0xcce7('0x43')][_0xcce7('0x7c')];_0x5573ff['Smtp'][_0xcce7('0x7b')]=_0x4ab454[_0xcce7('0x66')][_0xcce7('0x62')][_0xcce7('0x7b')];_0x5573ff['Smtp'][_0xcce7('0x7c')]=_0x4ab454['body']['Smtp'][_0xcce7('0x7c')];}else{_0x5573ff['Imap'][_0xcce7('0x7d')]=_0x5573ff['Smtp'][_0xcce7('0x7d')]=_0x4ab454[_0xcce7('0x66')][_0xcce7('0x77')];_0x5573ff[_0xcce7('0x43')][_0xcce7('0x78')]=_0x5573ff[_0xcce7('0x62')][_0xcce7('0x78')]=_0x4ab454[_0xcce7('0x66')][_0xcce7('0x7e')];_0x5573ff[_0xcce7('0x43')][_0xcce7('0x7f')]=_0x5573ff[_0xcce7('0x62')][_0xcce7('0x79')]=_0x4ab454[_0xcce7('0x66')][_0xcce7('0x80')];}return db['MailAccount'][_0xcce7('0x6a')](_0x5573ff,{'include':[{'model':db[_0xcce7('0x44')],'as':_0xcce7('0x62')},{'model':db[_0xcce7('0x42')],'as':_0xcce7('0x43')}]})[_0xcce7('0x3d')](function(_0x46733b){var _0x412f23=_0x4ab454['user']['get']({'plain':!![]});if(!_0x412f23)throw new Error(_0xcce7('0x81'));if(_0x412f23['role']===_0xcce7('0x78')){var _0x2c9892=_0x46733b[_0xcce7('0x82')]({'plain':!![]});return db[_0xcce7('0x83')][_0xcce7('0x63')]({'where':{'name':_0xcce7('0x3e'),'userProfileId':_0x412f23['userProfileId']},'raw':!![]})[_0xcce7('0x3d')](function(_0x2809d5){if(_0x2809d5&&_0x2809d5[_0xcce7('0x84')]===0x0){return db[_0xcce7('0x3f')][_0xcce7('0x6a')]({'name':_0x2c9892[_0xcce7('0x40')],'resourceId':_0x2c9892['id'],'type':_0x2809d5[_0xcce7('0x40')],'sectionId':_0x2809d5['id']},{})[_0xcce7('0x3d')](function(){return _0x46733b;});}else{return _0x46733b;}})[_0xcce7('0x64')](function(_0x3e98d6){logger[_0xcce7('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e98d6);throw _0x3e98d6;});}return _0x46733b;})[_0xcce7('0x3d')](respondWithResult(_0x14a1d6,0xc9))[_0xcce7('0x64')](handleError(_0x14a1d6,null));};exports[_0xcce7('0x85')]=function(_0x25579a,_0x190586,_0x2a759e){return db['MailAccount'][_0xcce7('0x6c')]({'where':{'id':_0x25579a[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x190586,null))[_0xcce7('0x3d')](function(_0x4300e5){if(_0x4300e5){return _0x4300e5[_0xcce7('0x85')]();}return null;})[_0xcce7('0x3d')](respondWithResult(_0x190586,null))[_0xcce7('0x64')](handleError(_0x190586,null));};exports[_0xcce7('0x86')]=function(_0x26483c,_0x1e7d24,_0x175862){if(_0x26483c[_0xcce7('0x66')]['id']){delete _0x26483c['body']['id'];}return db[_0xcce7('0x48')][_0xcce7('0x63')]({'where':{'id':_0x26483c[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x1e7d24,null))[_0xcce7('0x3d')](function(_0x46d098){if(_0x46d098){_0x26483c[_0xcce7('0x66')][_0xcce7('0x68')]=_0x46d098['id'];return db[_0xcce7('0x42')][_0xcce7('0x6a')](_0x26483c[_0xcce7('0x66')]);}})[_0xcce7('0x3d')](respondWithResult(_0x1e7d24,null))['catch'](handleError(_0x1e7d24,null));};exports['removeImap']=function(_0x3a619a,_0x1eadba,_0x27fddd){return db[_0xcce7('0x48')][_0xcce7('0x6c')]({'where':{'id':_0x3a619a['params']['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x1eadba,null))[_0xcce7('0x3d')](function(_0x5030d5){if(_0x5030d5){return _0x5030d5[_0xcce7('0x87')](null);}return null;})[_0xcce7('0x3d')](respondWithStatusCode(_0x1eadba,null))[_0xcce7('0x64')](handleError(_0x1eadba,null));};exports[_0xcce7('0x88')]=function(_0x1d218a,_0x34541c,_0x3d46e5){return db[_0xcce7('0x48')][_0xcce7('0x6c')]({'where':{'id':_0x1d218a['params']['id']}})['then'](handleEntityNotFound(_0x34541c,null))[_0xcce7('0x3d')](function(_0x1b9fb0){if(_0x1b9fb0){return _0x1b9fb0[_0xcce7('0x88')]();}return null;})[_0xcce7('0x3d')](respondWithResult(_0x34541c,null))[_0xcce7('0x64')](handleError(_0x34541c,null));};exports['addSmtp']=function(_0x5adb0a,_0x396b99,_0x5012de){if(_0x5adb0a[_0xcce7('0x66')]['id']){delete _0x5adb0a['body']['id'];}return db[_0xcce7('0x48')][_0xcce7('0x63')]({'where':{'id':_0x5adb0a[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x396b99,null))[_0xcce7('0x3d')](function(_0x233196){if(_0x233196){_0x5adb0a['body'][_0xcce7('0x68')]=_0x233196['id'];return db[_0xcce7('0x44')]['create'](_0x5adb0a[_0xcce7('0x66')]);}})['then'](respondWithResult(_0x396b99,null))[_0xcce7('0x64')](handleError(_0x396b99,null));};exports[_0xcce7('0x89')]=function(_0x5e686d,_0x4f14dd,_0x7a1a7b){return db[_0xcce7('0x48')]['findOne']({'where':{'id':_0x5e686d[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x4f14dd,null))[_0xcce7('0x3d')](function(_0x23a9f3){if(_0x23a9f3){return _0x23a9f3[_0xcce7('0x8a')](null);}return null;})[_0xcce7('0x3d')](respondWithStatusCode(_0x4f14dd,null))[_0xcce7('0x64')](handleError(_0x4f14dd,null));};exports[_0xcce7('0x8b')]=function(_0x55a7f4,_0x25ecf8,_0x5455ad){return db[_0xcce7('0x8c')]['find']({'where':{'id':_0x55a7f4[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x25ecf8,null))[_0xcce7('0x3d')](function(_0x569d19){if(_0x569d19){return _0x569d19[_0xcce7('0x8b')](_0x55a7f4[_0xcce7('0x66')]['ids'],_[_0xcce7('0x8d')](_0x55a7f4[_0xcce7('0x66')],[_0xcce7('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x25ecf8,null))[_0xcce7('0x64')](handleError(_0x25ecf8,null));};exports[_0xcce7('0x8e')]=function(_0xc28d0c,_0x5d644b,_0x1f5de3){var _0x588f2a={'raw':![],'where':{}};var _0x343c8c={};var _0x238568={'count':0x0,'rows':[]};return db[_0xcce7('0x48')][_0xcce7('0x6c')]({'where':{'id':_0xc28d0c[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x5d644b,null))['then'](function(_0x1f65ee){if(_0x1f65ee){_0x343c8c['model']=_[_0xcce7('0x4e')](db[_0xcce7('0x8c')][_0xcce7('0x49')]);_0x343c8c[_0xcce7('0x4d')]=_[_0xcce7('0x4e')](_0xc28d0c[_0xcce7('0x4d')]);_0x343c8c[_0xcce7('0x56')]=_[_0xcce7('0x50')](_0x343c8c[_0xcce7('0x4c')],_0x343c8c[_0xcce7('0x4d')]);_0x588f2a['attributes']=_[_0xcce7('0x50')](_0x343c8c[_0xcce7('0x4c')],qs[_0xcce7('0x51')](_0xc28d0c[_0xcce7('0x4d')][_0xcce7('0x51')]));_0x588f2a[_0xcce7('0x4f')]=_0x588f2a['attributes'][_0xcce7('0x52')]?_0x588f2a[_0xcce7('0x4f')]:_0x343c8c[_0xcce7('0x4c')];if(!_0xc28d0c[_0xcce7('0x4d')][_0xcce7('0x53')](_0xcce7('0x6d'))){_0x588f2a[_0xcce7('0x37')]=qs[_0xcce7('0x37')](_0xc28d0c[_0xcce7('0x4d')][_0xcce7('0x37')]);_0x588f2a[_0xcce7('0x36')]=qs[_0xcce7('0x36')](_0xc28d0c[_0xcce7('0x4d')][_0xcce7('0x36')]);}_0x588f2a[_0xcce7('0x6e')]=qs[_0xcce7('0x54')](_0xc28d0c[_0xcce7('0x4d')][_0xcce7('0x54')]);_0x588f2a[_0xcce7('0x55')]=qs[_0xcce7('0x56')](_[_0xcce7('0x57')](_0xc28d0c[_0xcce7('0x4d')],_0x343c8c[_0xcce7('0x56')]));_0x588f2a[_0xcce7('0x55')]['MailAccountId']=_0x1f65ee['id'];if(_0xc28d0c[_0xcce7('0x4d')]['filter']){_0x588f2a[_0xcce7('0x55')]=_['merge'](_0x588f2a['where'],{'$or':_[_0xcce7('0x47')](_0x588f2a[_0xcce7('0x4f')],function(_0x46f65d){var _0x1fa6b0={};_0x1fa6b0[_0x46f65d]={'$like':'%'+_0xc28d0c[_0xcce7('0x4d')][_0xcce7('0x58')]+'%'};return _0x1fa6b0;})});}_0x588f2a=_[_0xcce7('0x59')]({},_0x588f2a,_0xc28d0c['options']);return db[_0xcce7('0x8c')][_0xcce7('0x35')]({'where':_0x588f2a['where']})[_0xcce7('0x3d')](function(_0x1586d9){_0x238568[_0xcce7('0x35')]=_0x1586d9;if(_0xc28d0c[_0xcce7('0x4d')][_0xcce7('0x5c')]){_0x588f2a[_0xcce7('0x5d')]=[{'model':db[_0xcce7('0x8f')],'as':_0xcce7('0x90'),'required':![]},{'model':db[_0xcce7('0x91')],'as':_0xcce7('0x92'),'attributes':['name',_0xcce7('0x93'),_0xcce7('0x94')],'required':![]},{'model':db[_0xcce7('0x95')],'as':_0xcce7('0x96'),'attributes':['id',_0xcce7('0x40'),_0xcce7('0x97')],'where':_0xc28d0c[_0xcce7('0x4d')]['tag']?{'id':_0xc28d0c[_0xcce7('0x4d')][_0xcce7('0x98')]}:undefined,'required':_0xc28d0c[_0xcce7('0x4d')][_0xcce7('0x98')]?!![]:![]}];}return db[_0xcce7('0x8c')][_0xcce7('0x5e')](_0x588f2a);})[_0xcce7('0x3d')](function(_0x3f56ca){_0x238568[_0xcce7('0x5f')]=_0x3f56ca;return _0x238568;});}})[_0xcce7('0x3d')](respondWithFilteredResult(_0x5d644b,_0x588f2a))['catch'](handleError(_0x5d644b,null));};exports['addApplications']=function(_0x175c6b,_0x50b840,_0x4bf01e){return db['MailAccount'][_0xcce7('0x6c')]({'where':{'id':_0x175c6b[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x50b840,null))[_0xcce7('0x3d')](function(_0x3d6e52){if(_0x3d6e52){return db[_0xcce7('0x99')]['transaction'](function(_0xc9a6ce){return db[_0xcce7('0x9a')][_0xcce7('0x3c')]({'where':{'MailAccountId':_0x175c6b[_0xcce7('0x61')]['id']},'transaction':_0xc9a6ce})[_0xcce7('0x3d')](function(_0x2ef2ad){var _0x2650df=_[_0xcce7('0x47')](_0x175c6b[_0xcce7('0x66')],function(_0x304539){_0x304539[_0xcce7('0x68')]=_0x175c6b['params']['id'];return _0x304539;});return db[_0xcce7('0x9a')][_0xcce7('0x9b')](_0x2650df,{'transaction':_0xc9a6ce});});})[_0xcce7('0x3d')](function(){return db[_0xcce7('0x9a')][_0xcce7('0x9c')]({'where':{'MailAccountId':_0x175c6b[_0xcce7('0x61')]['id']},'order':_0xcce7('0x9d')});});}})[_0xcce7('0x3d')](respondWithResult(_0x50b840,null))[_0xcce7('0x64')](handleError(_0x50b840,null));};exports[_0xcce7('0x9e')]=function(_0x198bcc,_0x2483a0,_0x72ede1){var _0x5490c8={};var _0x4bc8e2={};var _0xea2231;var _0x1a4974;return db['MailAccount'][_0xcce7('0x6c')]({'where':{'id':_0x198bcc[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x2483a0,null))[_0xcce7('0x3d')](function(_0x54876f){if(_0x54876f){_0xea2231=_0x54876f;_0x4bc8e2[_0xcce7('0x4c')]=_[_0xcce7('0x4e')](db[_0xcce7('0x9a')][_0xcce7('0x49')]);_0x4bc8e2[_0xcce7('0x4d')]=_[_0xcce7('0x4e')](_0x198bcc['query']);_0x4bc8e2[_0xcce7('0x56')]=_[_0xcce7('0x50')](_0x4bc8e2['model'],_0x4bc8e2['query']);_0x5490c8[_0xcce7('0x4f')]=_[_0xcce7('0x50')](_0x4bc8e2[_0xcce7('0x4c')],qs[_0xcce7('0x51')](_0x198bcc['query']['fields']));_0x5490c8['attributes']=_0x5490c8[_0xcce7('0x4f')][_0xcce7('0x52')]?_0x5490c8[_0xcce7('0x4f')]:_0x4bc8e2[_0xcce7('0x4c')];_0x5490c8[_0xcce7('0x6e')]=qs[_0xcce7('0x54')](_0x198bcc[_0xcce7('0x4d')][_0xcce7('0x54')]);_0x5490c8[_0xcce7('0x55')]=qs['filters'](_['pick'](_0x198bcc[_0xcce7('0x4d')],_0x4bc8e2['filters']));if(_0x198bcc[_0xcce7('0x4d')][_0xcce7('0x58')]){_0x5490c8[_0xcce7('0x55')]=_[_0xcce7('0x59')](_0x5490c8['where'],{'$or':_[_0xcce7('0x47')](_0x5490c8[_0xcce7('0x4f')],function(_0x185082){var _0x517995={};_0x517995[_0x185082]={'$like':'%'+_0x198bcc[_0xcce7('0x4d')][_0xcce7('0x58')]+'%'};return _0x517995;})});}_0x5490c8=_[_0xcce7('0x59')]({},_0x5490c8,_0x198bcc[_0xcce7('0x5b')]);return _0xea2231['getApplications'](_0x5490c8);}})[_0xcce7('0x3d')](function(_0x3ed99a){if(_0x3ed99a){_0x1a4974=_0x3ed99a[_0xcce7('0x52')];if(!_0x198bcc[_0xcce7('0x4d')][_0xcce7('0x53')]('nolimit')){_0x5490c8['limit']=qs[_0xcce7('0x37')](_0x198bcc[_0xcce7('0x4d')][_0xcce7('0x37')]);_0x5490c8[_0xcce7('0x36')]=qs['offset'](_0x198bcc[_0xcce7('0x4d')][_0xcce7('0x36')]);}return _0xea2231[_0xcce7('0x9e')](_0x5490c8);}})[_0xcce7('0x3d')](function(_0x420cea){if(_0x420cea){return _0x420cea?{'count':_0x1a4974,'rows':_0x420cea}:null;}})['then'](respondWithResult(_0x2483a0,null))[_0xcce7('0x64')](handleError(_0x2483a0,null));};exports[_0xcce7('0x9f')]=function(_0x273863,_0x4896f2,_0x59d035){var _0x42c9d0={'raw':!![],'where':{}};var _0x5adc0f={};var _0x336957={'count':0x0,'rows':[]};return db[_0xcce7('0x48')]['findOne']({'where':{'id':_0x273863[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x4896f2,null))[_0xcce7('0x3d')](function(_0x5d31ca){if(_0x5d31ca){_0x5adc0f[_0xcce7('0x4c')]=_[_0xcce7('0x4e')](db[_0xcce7('0xa0')][_0xcce7('0x49')]);_0x5adc0f[_0xcce7('0x4d')]=_['keys'](_0x273863[_0xcce7('0x4d')]);_0x5adc0f['filters']=_[_0xcce7('0x50')](_0x5adc0f[_0xcce7('0x4c')],_0x5adc0f[_0xcce7('0x4d')]);_0x42c9d0[_0xcce7('0x4f')]=_[_0xcce7('0x50')](_0x5adc0f[_0xcce7('0x4c')],qs[_0xcce7('0x51')](_0x273863['query']['fields']));_0x42c9d0[_0xcce7('0x4f')]=_0x42c9d0[_0xcce7('0x4f')]['length']?_0x42c9d0[_0xcce7('0x4f')]:_0x5adc0f['model'];if(!_0x273863[_0xcce7('0x4d')][_0xcce7('0x53')](_0xcce7('0x6d'))){_0x42c9d0[_0xcce7('0x37')]=qs[_0xcce7('0x37')](_0x273863[_0xcce7('0x4d')][_0xcce7('0x37')]);_0x42c9d0['offset']=qs[_0xcce7('0x36')](_0x273863[_0xcce7('0x4d')][_0xcce7('0x36')]);}_0x42c9d0[_0xcce7('0x6e')]=qs[_0xcce7('0x54')](_0x273863[_0xcce7('0x4d')][_0xcce7('0x54')]);_0x42c9d0[_0xcce7('0x55')]=qs['filters'](_[_0xcce7('0x57')](_0x273863[_0xcce7('0x4d')],_0x5adc0f[_0xcce7('0x56')]));_0x42c9d0[_0xcce7('0x55')][_0xcce7('0x68')]=_0x5d31ca['id'];if(_0x273863[_0xcce7('0x4d')][_0xcce7('0x58')]){_0x42c9d0[_0xcce7('0x55')]=_[_0xcce7('0x59')](_0x42c9d0['where'],{'$or':_['map'](_0x42c9d0['attributes'],function(_0x1df0bc){var _0x2e9adf={};_0x2e9adf[_0x1df0bc]={'$like':'%'+_0x273863[_0xcce7('0x4d')][_0xcce7('0x58')]+'%'};return _0x2e9adf;})});}if(_0x273863[_0xcce7('0x4d')][_0xcce7('0xa1')]){var _0x183c60=_0x273863['query'][_0xcce7('0xa1')]['split'](',');var _0x70f352={};_0x70f352[_0x183c60[0x0]]={'$gte':moment(_0x183c60[0x1])['format'](_0xcce7('0xa2'))};_0x42c9d0[_0xcce7('0x55')]=_[_0xcce7('0x59')](_0x42c9d0[_0xcce7('0x55')],_0x70f352);}_0x42c9d0=_[_0xcce7('0x59')]({},_0x42c9d0,_0x273863[_0xcce7('0x5b')]);return db[_0xcce7('0xa0')][_0xcce7('0x35')]({'where':_0x42c9d0['where']})[_0xcce7('0x3d')](function(_0x4091b2){_0x336957[_0xcce7('0x35')]=_0x4091b2;if(_0x273863[_0xcce7('0x4d')][_0xcce7('0x5c')]){_0x42c9d0[_0xcce7('0x5d')]=[{'all':!![]}];}return db[_0xcce7('0xa0')]['findAll'](_0x42c9d0);})[_0xcce7('0x3d')](function(_0x51d1bd){if(_0x273863[_0xcce7('0x4d')][_0xcce7('0xa3')]===_0xcce7('0xa4')){for(var _0x279b79=0x0;_0x279b79<_0x51d1bd[_0xcce7('0x52')];_0x279b79++){_0x51d1bd[_0x279b79]['body']=juice(_0x51d1bd[_0x279b79][_0xcce7('0x66')]);}}_0x336957[_0xcce7('0x5f')]=_0x51d1bd;return _0x336957;});}})[_0xcce7('0x3d')](respondWithFilteredResult(_0x4896f2,_0x42c9d0))[_0xcce7('0x64')](handleError(_0x4896f2,null));};exports['send']=function(_0x17c363,_0x11fee7,_0x56c484){var _0x1634bc,_0x19210d={},_0x19089f;if(_0x17c363[_0xcce7('0x66')]['to']){_0x19089f=_0x17c363[_0xcce7('0x66')]['to'][_0xcce7('0xa5')](',')[0x0];}return db[_0xcce7('0x48')][_0xcce7('0x63')]({'where':{'id':_0x17c363['params']['id']},'include':[{'model':db[_0xcce7('0xa6')],'as':_0xcce7('0xa7'),'include':[{'model':db[_0xcce7('0x8f')],'as':_0xcce7('0xa8'),'where':{'email':_0x19089f},'limit':0x1,'order':[[_0xcce7('0xa9'),_0xcce7('0xaa')]]}]},{'model':db[_0xcce7('0x44')],'as':_0xcce7('0x62'),'raw':!![]}]})[_0xcce7('0x3d')](handleEntityNotFound(_0x11fee7,null))['then'](function(_0x535f50){if(_0x535f50){_0x1634bc=_0x535f50;if(_0x535f50['Smtp']){if(_[_0xcce7('0xab')](_0x17c363[_0xcce7('0x66')]['from'])){_0x17c363[_0xcce7('0x66')][_0xcce7('0xac')]=util[_0xcce7('0xad')](_0xcce7('0xae'),_0x535f50[_0xcce7('0x40')],_0x535f50[_0xcce7('0x75')]||_0x535f50[_0xcce7('0x62')]['user']);}if(_0x17c363[_0xcce7('0x66')][_0xcce7('0xaf')]&&_0x17c363[_0xcce7('0x66')][_0xcce7('0xaf')]['length']){for(var _0x5e6549=0x0;_0x5e6549<_0x17c363[_0xcce7('0x66')][_0xcce7('0xaf')]['length'];_0x5e6549+=0x1){_0x17c363[_0xcce7('0x66')][_0xcce7('0xaf')][_0x5e6549]={'filename':_0x17c363[_0xcce7('0x66')]['attachments'][_0x5e6549][_0xcce7('0x40')],'path':path['join'](config[_0xcce7('0xb0')],'server/files/attachments',_0x17c363[_0xcce7('0x66')][_0xcce7('0xaf')][_0x5e6549][_0xcce7('0xb1')])};}}var _0x116acc={'tls':{'rejectUnauthorized':![]}};if(_[_0xcce7('0xab')](_0x535f50['Smtp']['service'])){if(_0x535f50[_0xcce7('0x62')][_0xcce7('0x7a')]){_0x116acc[_0xcce7('0xb2')]={'user':_0x535f50[_0xcce7('0x62')]['user'],'pass':_0x535f50[_0xcce7('0x62')][_0xcce7('0x79')]};}_0x116acc[_0xcce7('0x7b')]=_0x535f50[_0xcce7('0x62')][_0xcce7('0x7b')];_0x116acc[_0xcce7('0x7c')]=_0x535f50[_0xcce7('0x62')][_0xcce7('0x7c')];_0x116acc[_0xcce7('0xb3')]=_0x535f50[_0xcce7('0x62')][_0xcce7('0xb3')];}else{_0x116acc[_0xcce7('0x7d')]=_0x535f50['Smtp']['service'];_0x116acc[_0xcce7('0xb2')]={'user':_0x535f50['Smtp'][_0xcce7('0x78')],'pass':_0x535f50[_0xcce7('0x62')]['pass']};}return respondWithRpcPromise(_0xcce7('0xb4'),_0xcce7('0xb5'),{'account':_0x116acc,'message':_0x17c363['body']});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0xc4f797){if(_0xc4f797){_0x19210d=_0xc4f797;if(_0x1634bc[_0xcce7('0xa7')]){if(_0x1634bc[_0xcce7('0xa7')][_0xcce7('0xa8')][_0xcce7('0x52')]){return _0x1634bc[_0xcce7('0xa7')][_0xcce7('0xa8')][0x0];}else{return db['CmContact'][_0xcce7('0x6a')](_[_0xcce7('0x1f')](_0x17c363['body'],{'firstName':_0x17c363[_0xcce7('0x66')]['to'],'email':_0x17c363[_0xcce7('0x66')]['to'],'phone':_0x17c363['body']['to'],'ListId':_0x1634bc[_0xcce7('0xb6')]}));}}else{throw new Error(_0xcce7('0xb7'));}}})[_0xcce7('0x3d')](function(_0x3b8470){if(_0x3b8470){var _0x28c5b3={'UserId':_0x17c363['user']['id'],'ContactId':_0x3b8470['id'],'MailAccountId':_0x1634bc['id'],'inReplyTo':_0x19210d['messageId'],'to':_0x17c363[_0xcce7('0x66')]['from'],'cc':_0x17c363[_0xcce7('0x66')]['cc'],'subject':_0x17c363[_0xcce7('0x66')][_0xcce7('0xb8')],'attach':_0x17c363[_0xcce7('0x66')][_0xcce7('0xb9')],'firstMsgDirection':_0xcce7('0xba'),'lastMsgAt':moment()[_0xcce7('0xad')](_0xcce7('0xa2')),'lastMsgDirection':_0xcce7('0xba'),'lastMsgBody':_0x17c363[_0xcce7('0x66')]['body'],'Messages':[_[_0xcce7('0x59')](_0x17c363[_0xcce7('0x66')],{'messageId':_0x19210d[_0xcce7('0xbb')],'sentAt':moment()['format'](_0xcce7('0xa2')),'read':!![],'MailAccountId':_0x1634bc['id'],'UserId':_0x17c363[_0xcce7('0x78')]['id'],'ContactId':_0x3b8470['id']})]};if(_0x17c363[_0xcce7('0x66')][_0xcce7('0xbc')]){_0x28c5b3=_['merge'](_0x28c5b3,_0x17c363[_0xcce7('0x66')][_0xcce7('0xbc')]);}return db[_0xcce7('0x8c')]['create'](_0x28c5b3,{'include':[{'model':db[_0xcce7('0xa0')],'as':_0xcce7('0xbd')}]});}})[_0xcce7('0x3d')](respondWithResult(_0x11fee7,null))['catch'](handleError(_0x11fee7,null));};exports[_0xcce7('0xbe')]=function(_0x4c87c1,_0x1b534e,_0x432ce7){return db[_0xcce7('0x48')][_0xcce7('0x63')]({'where':{'id':_0x4c87c1[_0xcce7('0x61')]['id']},'include':[{'model':db[_0xcce7('0x44')],'as':_0xcce7('0x62'),'raw':!![]}]})[_0xcce7('0x3d')](handleEntityNotFound(_0x1b534e,null))[_0xcce7('0x3d')](function(_0x38abb9){if(_0x38abb9&&_0x38abb9[_0xcce7('0x62')]){var _0x1cd348={'id':_0x38abb9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x38abb9[_0xcce7('0x62')][_0xcce7('0x7d')]){_0x1cd348[_0xcce7('0x7d')]=_0x38abb9['Smtp'][_0xcce7('0x7d')];}else{_0x1cd348[_0xcce7('0x7b')]=_0x38abb9['Smtp']['host'];_0x1cd348[_0xcce7('0x7c')]=_0x38abb9[_0xcce7('0x62')][_0xcce7('0x7c')];_0x1cd348[_0xcce7('0xb3')]=_0x38abb9[_0xcce7('0x62')][_0xcce7('0xb3')];}if(_0x38abb9[_0xcce7('0x62')]['authentication']){_0x1cd348[_0xcce7('0xb2')]={'user':_0x38abb9['Smtp'][_0xcce7('0x78')],'pass':_0x38abb9[_0xcce7('0x62')][_0xcce7('0x79')]};}return respondWithRpcPromise(_0xcce7('0xbf'),_0xcce7('0xbe'),{'account':_0x1cd348});}})['then'](respondWithResult(_0x1b534e,null))[_0xcce7('0x64')](handleError(_0x1b534e,null));};exports[_0xcce7('0x3c')]=function(_0x37fce7,_0x5eb670){return db[_0xcce7('0x48')]['find']({'where':{'id':_0x37fce7['params']['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x5eb670,null))[_0xcce7('0x3d')](function(_0x5f5c78){if(_0x5f5c78&&_0x5f5c78[_0xcce7('0x7d')]){throw new db[(_0xcce7('0xc0'))][(_0xcce7('0xc1'))](_0xcce7('0xc2'));}return _0x5f5c78;})[_0xcce7('0x3d')](removeEntity(_0x5eb670,null))['catch'](handleError(_0x5eb670,null));};exports['addAgents']=function(_0x372db2,_0x284640,_0x2bf853){return db[_0xcce7('0x48')]['find']({'where':{'id':_0x372db2[_0xcce7('0x61')]['id']}})['then'](handleEntityNotFound(_0x284640,null))[_0xcce7('0x3d')](function(_0x5db64b){if(_0x5db64b){return _0x5db64b[_0xcce7('0xc3')](_0x372db2[_0xcce7('0x66')][_0xcce7('0x6f')],_[_0xcce7('0x8d')](_0x372db2[_0xcce7('0x66')],[_0xcce7('0x6f'),'id'])||{})[_0xcce7('0xc4')](function(_0x3591eb){for(var _0x17e1b5=0x0;_0x17e1b5<_0x372db2['body']['ids'][_0xcce7('0x52')];_0x17e1b5+=0x1){socket[_0xcce7('0xc5')](_0xcce7('0xc6'),{'UserId':_0x372db2[_0xcce7('0x66')][_0xcce7('0x6f')][_0x17e1b5],'MailAccountId':_0x372db2[_0xcce7('0x61')]['id']});}return _0x3591eb;});}})[_0xcce7('0x3d')](respondWithResult(_0x284640,null))[_0xcce7('0x64')](handleError(_0x284640,null));};exports[_0xcce7('0xc7')]=function(_0x45465d,_0x15ddc6,_0x3d300f){return db[_0xcce7('0x48')][_0xcce7('0x63')]({'where':{'id':_0x45465d['params']['id']}})['then'](handleEntityNotFound(_0x15ddc6,null))['then'](function(_0xa28341){if(_0xa28341){return _0xa28341[_0xcce7('0xc7')](_0x45465d[_0xcce7('0x4d')][_0xcce7('0x6f')])['then'](function(){if(_['isArray'](_0x45465d[_0xcce7('0x4d')][_0xcce7('0x6f')])){for(var _0x19c32b=0x0;_0x19c32b<_0x45465d[_0xcce7('0x4d')][_0xcce7('0x6f')]['length'];_0x19c32b+=0x1){socket[_0xcce7('0xc5')](_0xcce7('0xc8'),{'UserId':Number(_0x45465d[_0xcce7('0x4d')]['ids'][_0x19c32b]),'MailAccountId':Number(_0x45465d['params']['id'])});}}else{socket[_0xcce7('0xc5')](_0xcce7('0xc8'),{'UserId':Number(_0x45465d[_0xcce7('0x4d')][_0xcce7('0x6f')]),'MailAccountId':Number(_0x45465d[_0xcce7('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x15ddc6,null))['catch'](handleError(_0x15ddc6,null));};exports[_0xcce7('0xc9')]=function(_0xdeb89b,_0x2b59f0,_0x3f9682){var _0x32df98={};var _0x5d4774={};var _0x513623;var _0x3a8e7c;return db['MailAccount'][_0xcce7('0x6c')]({'where':{'id':_0xdeb89b[_0xcce7('0x61')]['id']}})[_0xcce7('0x3d')](handleEntityNotFound(_0x2b59f0,null))[_0xcce7('0x3d')](function(_0x1aa823){if(_0x1aa823){_0x513623=_0x1aa823;_0x5d4774[_0xcce7('0x4c')]=_[_0xcce7('0x4e')](db[_0xcce7('0x91')]['rawAttributes']);_0x5d4774['query']=_['keys'](_0xdeb89b[_0xcce7('0x4d')]);_0x5d4774[_0xcce7('0x56')]=_[_0xcce7('0x50')](_0x5d4774[_0xcce7('0x4c')],_0x5d4774[_0xcce7('0x4d')]);_0x32df98['attributes']=_['intersection'](_0x5d4774['model'],qs[_0xcce7('0x51')](_0xdeb89b[_0xcce7('0x4d')][_0xcce7('0x51')]));_0x32df98[_0xcce7('0x4f')]=_0x32df98[_0xcce7('0x4f')]['length']?_0x32df98[_0xcce7('0x4f')]:_0x5d4774[_0xcce7('0x4c')];_0x32df98[_0xcce7('0x6e')]=qs[_0xcce7('0x54')](_0xdeb89b[_0xcce7('0x4d')][_0xcce7('0x54')]);_0x32df98[_0xcce7('0x55')]=qs[_0xcce7('0x56')](_[_0xcce7('0x57')](_0xdeb89b['query'],_0x5d4774[_0xcce7('0x56')]));if(_0xdeb89b[_0xcce7('0x4d')][_0xcce7('0x58')]){_0x32df98[_0xcce7('0x55')]=_[_0xcce7('0x59')](_0x32df98[_0xcce7('0x55')],{'$or':_['map'](_0x32df98[_0xcce7('0x4f')],function(_0x25ee23){var _0x202196={};_0x202196[_0x25ee23]={'$like':'%'+_0xdeb89b['query']['filter']+'%'};return _0x202196;})});}_0x32df98=_[_0xcce7('0x59')]({},_0x32df98,_0xdeb89b[_0xcce7('0x5b')]);return _0x513623[_0xcce7('0xc9')](_0x32df98);}})['then'](function(_0x109766){if(_0x109766){_0x3a8e7c=_0x109766['length'];if(!_0xdeb89b[_0xcce7('0x4d')][_0xcce7('0x53')](_0xcce7('0x6d'))){_0x32df98[_0xcce7('0x37')]=qs[_0xcce7('0x37')](_0xdeb89b[_0xcce7('0x4d')]['limit']);_0x32df98[_0xcce7('0x36')]=qs[_0xcce7('0x36')](_0xdeb89b[_0xcce7('0x4d')]['offset']);}return _0x513623['getAgents'](_0x32df98);}})[_0xcce7('0x3d')](function(_0x37f76a){if(_0x37f76a){return _0x37f76a?{'count':_0x3a8e7c,'rows':_0x37f76a}:null;}})[_0xcce7('0x3d')](respondWithResult(_0x2b59f0,null))[_0xcce7('0x64')](handleError(_0x2b59f0,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 2bfdf92..ffb0487 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 _0x1287=['update','remove','emit','exports','events','MailAccount','setMaxListeners'];(function(_0x2286fb,_0x145e8a){var _0x43a8d0=function(_0x5708ae){while(--_0x5708ae){_0x2286fb['push'](_0x2286fb['shift']());}};_0x43a8d0(++_0x145e8a);}(_0x1287,0x1a8));var _0x7128=function(_0x1fcb20,_0x1eb645){_0x1fcb20=_0x1fcb20-0x0;var _0x2c7ed4=_0x1287[_0x1fcb20];return _0x2c7ed4;};'use strict';var EventEmitter=require(_0x7128('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x7128('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7128('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7128('0x3'),'afterDestroy':_0x7128('0x4')};function emitEvent(_0x44efde){return function(_0x5af23c,_0x5a970f,_0x52c3c5){MailAccountEvents[_0x7128('0x5')](_0x44efde+':'+_0x5af23c['id'],_0x5af23c);MailAccountEvents[_0x7128('0x5')](_0x44efde,_0x5af23c);_0x52c3c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x7128('0x6')]=MailAccountEvents; \ No newline at end of file +var _0x077e=['update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x077e,0x7b));var _0xe077=function(_0xd32313,_0x3da2d9){_0xd32313=_0xd32313-0x0;var _0x3a9516=_0x077e[_0xd32313];return _0x3a9516;};'use strict';var EventEmitter=require(_0xe077('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xe077('0x1')](0x0);var events={'afterCreate':_0xe077('0x2'),'afterUpdate':_0xe077('0x3'),'afterDestroy':_0xe077('0x4')};function emitEvent(_0x483a2c){return function(_0x25dad1,_0xa5c536,_0x3284db){MailAccountEvents[_0xe077('0x5')](_0x483a2c+':'+_0x25dad1['id'],_0x25dad1);MailAccountEvents[_0xe077('0x5')](_0x483a2c,_0x25dad1);_0x3284db(null);};}for(var e in events){if(events[_0xe077('0x6')](e)){var event=events[e];MailAccount[_0xe077('0x7')](e,emitEvent(event));}}module[_0xe077('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 0457b6c..4038f40 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 _0x2a58=['moment','bluebird','request-promise','path','../../config/environment','./mailAccount.attributes','define','MailAccount','mail_accounts','lodash','util','../../config/logger','api'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x2a58,0x1d0));var _0x82a5=function(_0x169260,_0x36b1e3){_0x169260=_0x169260-0x0;var _0x5a271e=_0x2a58[_0x169260];return _0x5a271e;};'use strict';var _=require(_0x82a5('0x0'));var util=require(_0x82a5('0x1'));var logger=require(_0x82a5('0x2'))(_0x82a5('0x3'));var moment=require(_0x82a5('0x4'));var BPromise=require(_0x82a5('0x5'));var rp=require(_0x82a5('0x6'));var fs=require('fs');var path=require(_0x82a5('0x7'));var rimraf=require('rimraf');var config=require(_0x82a5('0x8'));var attributes=require(_0x82a5('0x9'));module['exports']=function(_0x50591f,_0x391c6a){return _0x50591f[_0x82a5('0xa')](_0x82a5('0xb'),attributes,{'tableName':_0x82a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc50=['exports','MailAccount','mail_accounts','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailAccount.attributes'];(function(_0x4deb89,_0x358208){var _0x26b6c1=function(_0x203954){while(--_0x203954){_0x4deb89['push'](_0x4deb89['shift']());}};_0x26b6c1(++_0x358208);}(_0xbc50,0x85));var _0x0bc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0bc5('0x0'))('api');var moment=require(_0x0bc5('0x1'));var BPromise=require(_0x0bc5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bc5('0x3'));var rimraf=require(_0x0bc5('0x4'));var config=require(_0x0bc5('0x5'));var attributes=require(_0x0bc5('0x6'));module[_0x0bc5('0x7')]=function(_0x5b8f7c,_0x46853b){return _0x5b8f7c['define'](_0x0bc5('0x8'),attributes,{'tableName':_0x0bc5('0x9'),'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 8821a1a..34012d1 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 _0xd139=['omit','applications','list','orderBy','priority','asc','autoclose','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','subject','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Contact\x20not\x20found','spread','update','attach','format','interaction','attachments','originTo','bcc','Attachment','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','register','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','MailAccount,\x20%s,\x20%s','message','info','result','catch','GetMailAccount','options','raw','where','limit','include','model','attributes','map','MailAccount','find','ShowMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','Contacts','DESC','Applications','MailServerOut','List','get'];(function(_0x49bb91,_0x86ecf3){var _0x2b4339=function(_0x4fb062){while(--_0x4fb062){_0x49bb91['push'](_0x49bb91['shift']());}};_0x2b4339(++_0x86ecf3);}(_0xd139,0x14e));var _0x9d13=function(_0x492caa,_0x2e45ed){_0x492caa=_0x492caa-0x0;var _0x172ebe=_0xd139[_0x492caa];return _0x172ebe;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d13('0x2'));var fs=require('fs');var Redis=require(_0x9d13('0x3'));var db=require(_0x9d13('0x4'))['db'];var utils=require(_0x9d13('0x5'));var logger=require(_0x9d13('0x6'))(_0x9d13('0x7'));var config=require(_0x9d13('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d13('0x9')][_0x9d13('0xa')]({'port':0x232c});config['redis']=_[_0x9d13('0xb')](config['redis'],{'host':_0x9d13('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailAccount.socket')[_0x9d13('0xd')](socket);function respondWithRpcPromise(_0xba5caa,_0x41eef2,_0x51ac36){return new BPromise(function(_0x135232,_0x5aa0c8){return client[_0x9d13('0xe')](_0xba5caa,_0x51ac36)[_0x9d13('0xf')](function(_0x43a3cc){logger['info']('MailAccount,\x20%s,\x20%s',_0x41eef2,_0x9d13('0x10'));logger[_0x9d13('0x11')](_0x9d13('0x12'),_0x41eef2,_0x9d13('0x10'),JSON[_0x9d13('0x13')](_0x43a3cc));if(_0x43a3cc['error']){if(_0x43a3cc['error'][_0x9d13('0x14')]===0x1f4){logger[_0x9d13('0x15')](_0x9d13('0x16'),_0x41eef2,_0x43a3cc[_0x9d13('0x15')][_0x9d13('0x17')]);return _0x5aa0c8(_0x43a3cc[_0x9d13('0x15')][_0x9d13('0x17')]);}logger['error'](_0x9d13('0x16'),_0x41eef2,_0x43a3cc[_0x9d13('0x15')][_0x9d13('0x17')]);return _0x135232(_0x43a3cc[_0x9d13('0x15')][_0x9d13('0x17')]);}else{logger[_0x9d13('0x18')](_0x9d13('0x16'),_0x41eef2,_0x9d13('0x10'));_0x135232(_0x43a3cc[_0x9d13('0x19')][_0x9d13('0x17')]);}})[_0x9d13('0x1a')](function(_0x38acaf){logger[_0x9d13('0x15')]('MailAccount,\x20%s,\x20%s',_0x41eef2,_0x38acaf);_0x5aa0c8(_0x38acaf);});});}exports[_0x9d13('0x1b')]=function(_0x12e56d){var _0xf3fede=this;return new Promise(function(_0x649908,_0x4e1425){return db['MailAccount']['findAll']({'raw':_0x12e56d[_0x9d13('0x1c')]?_0x12e56d[_0x9d13('0x1c')][_0x9d13('0x1d')]===undefined?!![]:![]:!![],'where':_0x12e56d[_0x9d13('0x1c')]?_0x12e56d[_0x9d13('0x1c')][_0x9d13('0x1e')]||null:null,'attributes':_0x12e56d[_0x9d13('0x1c')]?_0x12e56d[_0x9d13('0x1c')]['attributes']||null:null,'limit':_0x12e56d[_0x9d13('0x1c')]?_0x12e56d[_0x9d13('0x1c')][_0x9d13('0x1f')]||null:null,'include':_0x12e56d[_0x9d13('0x1c')]?_0x12e56d['options'][_0x9d13('0x20')]?_['map'](_0x12e56d[_0x9d13('0x1c')][_0x9d13('0x20')],function(_0xe0c57){return{'model':db[_0xe0c57[_0x9d13('0x21')]],'as':_0xe0c57['as'],'attributes':_0xe0c57[_0x9d13('0x22')],'include':_0xe0c57[_0x9d13('0x20')]?_[_0x9d13('0x23')](_0xe0c57[_0x9d13('0x20')],function(_0x5d854e){return{'model':db[_0x5d854e[_0x9d13('0x21')]],'as':_0x5d854e['as'],'attributes':_0x5d854e['attributes'],'include':_0x5d854e[_0x9d13('0x20')]?_[_0x9d13('0x23')](_0x5d854e[_0x9d13('0x20')],function(_0x1d9f56){return{'model':db[_0x1d9f56[_0x9d13('0x21')]],'as':_0x1d9f56['as'],'attributes':_0x1d9f56[_0x9d13('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9d13('0xf')](function(_0x3dcc6c){logger[_0x9d13('0x18')](_0x9d13('0x1b'),_0x12e56d);logger[_0x9d13('0x11')](_0x9d13('0x1b'),_0x12e56d,JSON['stringify'](_0x3dcc6c));_0x649908(_0x3dcc6c);})[_0x9d13('0x1a')](function(_0x580aa4){logger[_0x9d13('0x15')](_0x9d13('0x1b'),_0x580aa4['message'],_0x12e56d);_0x4e1425(_0xf3fede[_0x9d13('0x15')](0x1f4,_0x580aa4[_0x9d13('0x17')]));});});};exports['ShowMailAccount']=function(_0x4a4238){var _0x5c5ab4=this;return new Promise(function(_0x181b09,_0x5ad0a9){return db[_0x9d13('0x24')][_0x9d13('0x25')]({'raw':_0x4a4238[_0x9d13('0x1c')]?_0x4a4238['options'][_0x9d13('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a4238[_0x9d13('0x1c')]?_0x4a4238[_0x9d13('0x1c')][_0x9d13('0x1e')]||null:null,'attributes':_0x4a4238['options']?_0x4a4238['options'][_0x9d13('0x22')]||null:null,'include':_0x4a4238[_0x9d13('0x1c')]?_0x4a4238['options'][_0x9d13('0x20')]?_[_0x9d13('0x23')](_0x4a4238[_0x9d13('0x1c')][_0x9d13('0x20')],function(_0x7f7a0f){return{'model':db[_0x7f7a0f[_0x9d13('0x21')]],'as':_0x7f7a0f['as'],'attributes':_0x7f7a0f[_0x9d13('0x22')],'include':_0x7f7a0f['include']?_[_0x9d13('0x23')](_0x7f7a0f['include'],function(_0x4b60d7){return{'model':db[_0x4b60d7['model']],'as':_0x4b60d7['as'],'attributes':_0x4b60d7[_0x9d13('0x22')],'include':_0x4b60d7[_0x9d13('0x20')]?_[_0x9d13('0x23')](_0x4b60d7[_0x9d13('0x20')],function(_0x3467eb){return{'model':db[_0x3467eb['model']],'as':_0x3467eb['as'],'attributes':_0x3467eb[_0x9d13('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9d13('0xf')](function(_0x162261){logger[_0x9d13('0x18')](_0x9d13('0x26'),_0x4a4238);logger[_0x9d13('0x11')]('ShowMailAccount',_0x4a4238,JSON[_0x9d13('0x13')](_0x162261));_0x181b09(_0x162261);})[_0x9d13('0x1a')](function(_0x287d0b){logger['error']('ShowMailAccount',_0x287d0b[_0x9d13('0x17')],_0x4a4238);_0x5ad0a9(_0x5c5ab4[_0x9d13('0x15')](0x1f4,_0x287d0b[_0x9d13('0x17')]));});});};exports['NotifyMailAccount']=function(_0x206f29){var _0x198fe7=this;return new Promise(function(_0x4cff31,_0x206c08){var _0x2451f6={'body':_0x206f29[_0x9d13('0x27')],'channel':_0x9d13('0x28')};var _0x3d5716=_[_0x9d13('0x29')](_[_0x9d13('0x2a')](db[_0x9d13('0x2b')][_0x9d13('0x2c')]),['createdAt',_0x9d13('0x2d'),_0x9d13('0x2e'),_0x9d13('0x2f')]);var _0x1dd5dc=![];if(_0x206f29[_0x9d13('0x27')]['id']){delete _0x206f29[_0x9d13('0x27')]['id'];}if(_[_0x9d13('0x30')](_0x206f29['body'][_0x9d13('0x31')])){return _0x206c08(_0x198fe7[_0x9d13('0x15')](0x1f4,_0x9d13('0x32')));}if(_[_0x9d13('0x30')](_0x206f29[_0x9d13('0x27')][_0x9d13('0x27')])||_0x206f29['body']['body']===''){return _0x206c08(_0x198fe7[_0x9d13('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x9d13('0x30')](_0x206f29['body'][_0x9d13('0x33')])){return _0x206c08(_0x198fe7[_0x9d13('0x15')](0x1f4,_0x9d13('0x34')+_0x3d5716));}if(!_[_0x9d13('0x35')](_0x3d5716,_0x206f29[_0x9d13('0x27')]['mapKey'])){return _0x206c08(_0x198fe7[_0x9d13('0x15')](0x1f4,_0x9d13('0x36')+_0x3d5716));}var _0x3e61dd={};_0x3e61dd[_0x206f29[_0x9d13('0x27')][_0x9d13('0x33')]]=_0x206f29[_0x9d13('0x27')][_0x9d13('0x31')];return db[_0x9d13('0x24')][_0x9d13('0x25')]({'where':{'id':_0x206f29[_0x9d13('0x37')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9d13('0x2b')],'as':_0x9d13('0x38'),'where':_0x3e61dd,'limit':0x1,'order':[['updatedAt',_0x9d13('0x39')]]}]},{'model':db['MailApplication'],'as':_0x9d13('0x3a')},{'model':db[_0x9d13('0x3b')],'as':'Smtp'}]})['then'](function(_0xcba714){if(_0xcba714&&_0xcba714[_0x9d13('0x3c')]){var _0x4a70d5=_0xcba714[_0x9d13('0x3d')]({'plain':!![]});_0x2451f6[_0x9d13('0x37')]=_[_0x9d13('0x3e')](_0x4a70d5,[_0x9d13('0x3a'),_0x9d13('0x3c')]);_0x2451f6[_0x9d13('0x3f')]=_0x4a70d5['Applications'];_0x2451f6[_0x9d13('0x40')]=_0x4a70d5['List'];_0x2451f6['applications']=_[_0x9d13('0x41')](_0x2451f6['applications'],[_0x9d13('0x42')],[_0x9d13('0x43')]);if(_0x2451f6[_0x9d13('0x37')]&&_0x2451f6[_0x9d13('0x37')][_0x9d13('0x44')]){_0x2451f6[_0x9d13('0x3f')]['push']({'id':0x0,'priority':_0x2451f6[_0x9d13('0x3f')][_0x9d13('0x45')]+0x1,'app':_0x9d13('0x46'),'appdata':_0x9d13('0x44'),'interval':_0x9d13('0x47')});}if(_0x2451f6[_0x9d13('0x37')][_0x9d13('0x3a')]){delete _0x2451f6['account'][_0x9d13('0x3a')];}if(_0x2451f6[_0x9d13('0x37')][_0x9d13('0x3c')]){delete _0x2451f6[_0x9d13('0x37')][_0x9d13('0x3c')];}if(_0x4a70d5[_0x9d13('0x3c')][_0x9d13('0x38')][_0x9d13('0x45')]){return _0x4a70d5[_0x9d13('0x3c')][_0x9d13('0x38')][0x0];}var _0x4a9fb7=_[_0x9d13('0xb')](_0x206f29[_0x9d13('0x27')],{'firstName':_0x206f29[_0x9d13('0x27')]['from'],'ListId':_0x4a70d5[_0x9d13('0x2f')]});_0x4a9fb7[_0x206f29['body']['mapKey']]=_0x206f29[_0x9d13('0x27')]['from'];return db[_0x9d13('0x2b')][_0x9d13('0x48')](_0x4a9fb7);}else{throw new Error(_0x9d13('0x49'));}})[_0x9d13('0xf')](function(_0x3e206){_0x2451f6[_0x9d13('0x4a')]=_0x3e206;if(_0x3e206){if(!_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')][_0x9d13('0x4b')]){_0x206f29['body'][_0x9d13('0x17')]['messageId']=rs['generate']()+'\x20'+_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')][_0x9d13('0x31')];}var _0x9d499={'ContactId':_0x3e206['id'],'MailAccountId':_0x206f29[_0x9d13('0x37')]['id'],'inReplyTo':_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')][_0x9d13('0x4b')],'to':_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')][_0x9d13('0x31')],'cc':_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')]['cc'],'subject':_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')][_0x9d13('0x4c')],'attach':_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')]['attach'],'lastMsgAt':moment()['format'](_0x9d13('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x206f29['body'][_0x9d13('0x27')]};return db[_0x9d13('0x4e')][_0x9d13('0x25')]({'where':{'closed':![],'MailAccountId':_0x206f29[_0x9d13('0x37')]['id']},'include':[{'model':db[_0x9d13('0x4f')],'as':'Messages','attributes':[_0x9d13('0x4b')],'where':{'messageId':_0x206f29['body'][_0x9d13('0x17')]['inReplyTo']}}]})[_0x9d13('0xf')](function(_0xbe63da){if(_0xbe63da){return[_0xbe63da,![]];}return db[_0x9d13('0x4e')][_0x9d13('0x48')](_0x9d499)[_0x9d13('0xf')](function(_0x399199){return[_0x399199,!![]];});});}else{throw new Error(_0x9d13('0x50'));}})[_0x9d13('0x51')](function(_0x5cc47b,_0x35ffa4){if(_0x5cc47b){_0x1dd5dc=_0x35ffa4;if(!_0x35ffa4){return _0x5cc47b[_0x9d13('0x52')]({'inReplyTo':_0x206f29['body']['message'][_0x9d13('0x4b')],'to':_0x206f29[_0x9d13('0x27')]['message'][_0x9d13('0x31')],'cc':_0x206f29[_0x9d13('0x27')]['message']['cc'],'subject':_0x206f29[_0x9d13('0x27')]['message'][_0x9d13('0x4c')],'attach':_0x5cc47b['attach']?_0x5cc47b[_0x9d13('0x53')]:_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')][_0x9d13('0x53')],'substatus':null,'substatusAt':moment()[_0x9d13('0x54')](_0x9d13('0x4d')),'lastMsgAt':moment()['format'](_0x9d13('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x206f29['body'][_0x9d13('0x27')]});}else{return _0x5cc47b;}}})['then'](function(_0x300d4a){_0x2451f6[_0x9d13('0x55')]=_0x300d4a[_0x9d13('0x3d')]({'plain':!![]});_0x2451f6[_0x9d13('0x55')]['created']=_0x1dd5dc;return db['MailMessage'][_0x9d13('0x48')]({'body':_0x206f29[_0x9d13('0x27')][_0x9d13('0x27')],'MailAccountId':_0x206f29[_0x9d13('0x37')]['id'],'MailInteractionId':_0x300d4a['id'],'direction':'in','ContactId':_0x2451f6[_0x9d13('0x4a')]['id'],'messageId':_0x206f29['body']['message']['messageId'],'from':_0x206f29['body'][_0x9d13('0x17')][_0x9d13('0x31')],'to':_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')]['to'],'cc':_0x206f29[_0x9d13('0x27')]['message']['cc'],'subject':_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')][_0x9d13('0x4c')],'attach':_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')][_0x9d13('0x53')],'Attachments':_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')][_0x9d13('0x56')],'originTo':_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')][_0x9d13('0x57')],'originCc':_0x206f29[_0x9d13('0x27')]['message']['originCc'],'bcc':_0x206f29[_0x9d13('0x27')][_0x9d13('0x17')][_0x9d13('0x58')]},{'include':[{'model':db[_0x9d13('0x59')],'as':_0x9d13('0x5a')}]});})[_0x9d13('0xf')](function(_0x37872b){_0x2451f6[_0x9d13('0x17')]=_0x37872b;if(_0x2451f6['interaction'][_0x9d13('0x5b')]){return db[_0x9d13('0x5c')]['find']({'attributes':['id','name'],'where':{'id':_0x2451f6[_0x9d13('0x55')][_0x9d13('0x5b')]}})[_0x9d13('0xf')](function(_0x372317){if(_0x372317){_0x2451f6[_0x9d13('0x3f')][_0x9d13('0x5d')]({'id':0x0,'priority':0x0,'app':_0x9d13('0x5e'),'appdata':_0x372317[_0x9d13('0x5f')]+','+(_0x2451f6[_0x9d13('0x37')][_0x9d13('0x60')]||0xa),'interval':_0x9d13('0x47')});}return respondWithRpcPromise(_0x9d13('0x61'),_0x9d13('0x62'),_0x2451f6);});}return respondWithRpcPromise(_0x9d13('0x61'),_0x9d13('0x62'),_0x2451f6);})['then'](function(_0x529509){_0x4cff31(_0x529509);})[_0x9d13('0x1a')](function(_0x3d1de6){_0x206c08(_0x198fe7[_0x9d13('0x15')](0x1f4,_0x3d1de6[_0x9d13('0x17')]));});});}; \ No newline at end of file +var _0xfb30=['asc','account','autoclose','push','length','close','*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','interaction','get','created','bcc','Attachment','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','MailApplication','Applications','MailServerOut','omit','applications','priority'];(function(_0x36cff7,_0x5cb048){var _0x21c697=function(_0x1aab10){while(--_0x1aab10){_0x36cff7['push'](_0x36cff7['shift']());}};_0x21c697(++_0x5cb048);}(_0xfb30,0x88));var _0x0fb3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfb30[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0fb3('0x0'));var util=require(_0x0fb3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fb3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fb3('0x3'))['db'];var utils=require(_0x0fb3('0x4'));var logger=require(_0x0fb3('0x5'))(_0x0fb3('0x6'));var config=require(_0x0fb3('0x7'));var jayson=require(_0x0fb3('0x8'));var client=jayson[_0x0fb3('0x9')][_0x0fb3('0xa')]({'port':0x232c});config[_0x0fb3('0xb')]=_[_0x0fb3('0xc')](config[_0x0fb3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fb3('0xd'))(new Redis(config['redis']));require(_0x0fb3('0xe'))[_0x0fb3('0xf')](socket);function respondWithRpcPromise(_0x3b5f43,_0x3e89c0,_0x30ad73){return new BPromise(function(_0x5d58f3,_0x5db95f){return client[_0x0fb3('0x10')](_0x3b5f43,_0x30ad73)[_0x0fb3('0x11')](function(_0x182943){logger[_0x0fb3('0x12')]('MailAccount,\x20%s,\x20%s',_0x3e89c0,_0x0fb3('0x13'));logger[_0x0fb3('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3e89c0,_0x0fb3('0x13'),JSON[_0x0fb3('0x15')](_0x182943));if(_0x182943[_0x0fb3('0x16')]){if(_0x182943[_0x0fb3('0x16')][_0x0fb3('0x17')]===0x1f4){logger[_0x0fb3('0x16')](_0x0fb3('0x18'),_0x3e89c0,_0x182943[_0x0fb3('0x16')]['message']);return _0x5db95f(_0x182943[_0x0fb3('0x16')][_0x0fb3('0x19')]);}logger[_0x0fb3('0x16')](_0x0fb3('0x18'),_0x3e89c0,_0x182943[_0x0fb3('0x16')][_0x0fb3('0x19')]);return _0x5d58f3(_0x182943[_0x0fb3('0x16')][_0x0fb3('0x19')]);}else{logger['info'](_0x0fb3('0x18'),_0x3e89c0,'request\x20sent');_0x5d58f3(_0x182943['result']['message']);}})[_0x0fb3('0x1a')](function(_0x398678){logger[_0x0fb3('0x16')]('MailAccount,\x20%s,\x20%s',_0x3e89c0,_0x398678);_0x5db95f(_0x398678);});});}exports[_0x0fb3('0x1b')]=function(_0x1f7f32){var _0x9fb63d=this;return new Promise(function(_0x230a44,_0x40ddf6){return db[_0x0fb3('0x1c')][_0x0fb3('0x1d')]({'raw':_0x1f7f32['options']?_0x1f7f32[_0x0fb3('0x1e')][_0x0fb3('0x1f')]===undefined?!![]:![]:!![],'where':_0x1f7f32[_0x0fb3('0x1e')]?_0x1f7f32[_0x0fb3('0x1e')][_0x0fb3('0x20')]||null:null,'attributes':_0x1f7f32[_0x0fb3('0x1e')]?_0x1f7f32['options'][_0x0fb3('0x21')]||null:null,'limit':_0x1f7f32[_0x0fb3('0x1e')]?_0x1f7f32[_0x0fb3('0x1e')][_0x0fb3('0x22')]||null:null,'include':_0x1f7f32[_0x0fb3('0x1e')]?_0x1f7f32[_0x0fb3('0x1e')][_0x0fb3('0x23')]?_[_0x0fb3('0x24')](_0x1f7f32[_0x0fb3('0x1e')]['include'],function(_0x20b79e){return{'model':db[_0x20b79e['model']],'as':_0x20b79e['as'],'attributes':_0x20b79e[_0x0fb3('0x21')],'include':_0x20b79e['include']?_[_0x0fb3('0x24')](_0x20b79e[_0x0fb3('0x23')],function(_0xa3db94){return{'model':db[_0xa3db94[_0x0fb3('0x25')]],'as':_0xa3db94['as'],'attributes':_0xa3db94['attributes'],'include':_0xa3db94['include']?_[_0x0fb3('0x24')](_0xa3db94['include'],function(_0xbf2629){return{'model':db[_0xbf2629[_0x0fb3('0x25')]],'as':_0xbf2629['as'],'attributes':_0xbf2629[_0x0fb3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0fb3('0x11')](function(_0x2708ef){logger[_0x0fb3('0x12')](_0x0fb3('0x1b'),_0x1f7f32);logger[_0x0fb3('0x14')](_0x0fb3('0x1b'),_0x1f7f32,JSON[_0x0fb3('0x15')](_0x2708ef));_0x230a44(_0x2708ef);})[_0x0fb3('0x1a')](function(_0x1f4032){logger[_0x0fb3('0x16')](_0x0fb3('0x1b'),_0x1f4032[_0x0fb3('0x19')],_0x1f7f32);_0x40ddf6(_0x9fb63d[_0x0fb3('0x16')](0x1f4,_0x1f4032[_0x0fb3('0x19')]));});});};exports[_0x0fb3('0x26')]=function(_0xf7817c){var _0x48ce1b=this;return new Promise(function(_0x1507ef,_0x3391e7){return db['MailAccount'][_0x0fb3('0x27')]({'raw':_0xf7817c[_0x0fb3('0x1e')]?_0xf7817c['options'][_0x0fb3('0x1f')]===undefined?!![]:![]:!![],'where':_0xf7817c['options']?_0xf7817c[_0x0fb3('0x1e')][_0x0fb3('0x20')]||null:null,'attributes':_0xf7817c['options']?_0xf7817c[_0x0fb3('0x1e')][_0x0fb3('0x21')]||null:null,'include':_0xf7817c['options']?_0xf7817c[_0x0fb3('0x1e')]['include']?_[_0x0fb3('0x24')](_0xf7817c[_0x0fb3('0x1e')][_0x0fb3('0x23')],function(_0x3bfac2){return{'model':db[_0x3bfac2[_0x0fb3('0x25')]],'as':_0x3bfac2['as'],'attributes':_0x3bfac2[_0x0fb3('0x21')],'include':_0x3bfac2[_0x0fb3('0x23')]?_['map'](_0x3bfac2[_0x0fb3('0x23')],function(_0xa9a764){return{'model':db[_0xa9a764[_0x0fb3('0x25')]],'as':_0xa9a764['as'],'attributes':_0xa9a764[_0x0fb3('0x21')],'include':_0xa9a764[_0x0fb3('0x23')]?_[_0x0fb3('0x24')](_0xa9a764[_0x0fb3('0x23')],function(_0x54b86a){return{'model':db[_0x54b86a[_0x0fb3('0x25')]],'as':_0x54b86a['as'],'attributes':_0x54b86a[_0x0fb3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0fb3('0x11')](function(_0x44c46b){logger['info'](_0x0fb3('0x26'),_0xf7817c);logger['debug'](_0x0fb3('0x26'),_0xf7817c,JSON['stringify'](_0x44c46b));_0x1507ef(_0x44c46b);})[_0x0fb3('0x1a')](function(_0x247d39){logger[_0x0fb3('0x16')](_0x0fb3('0x26'),_0x247d39['message'],_0xf7817c);_0x3391e7(_0x48ce1b[_0x0fb3('0x16')](0x1f4,_0x247d39[_0x0fb3('0x19')]));});});};exports[_0x0fb3('0x28')]=function(_0x10ea57){var _0x219997=this;return new Promise(function(_0x20e4c3,_0xbcb722){var _0x11f44b={'body':_0x10ea57[_0x0fb3('0x29')],'channel':_0x0fb3('0x2a')};var _0x19a98d=_['difference'](_[_0x0fb3('0x2b')](db[_0x0fb3('0x2c')][_0x0fb3('0x2d')]),['createdAt',_0x0fb3('0x2e'),_0x0fb3('0x2f'),_0x0fb3('0x30')]);var _0x19384f=![];if(_0x10ea57[_0x0fb3('0x29')]['id']){delete _0x10ea57['body']['id'];}if(_[_0x0fb3('0x31')](_0x10ea57['body'][_0x0fb3('0x32')])){return _0xbcb722(_0x219997['error'](0x1f4,_0x0fb3('0x33')));}if(_[_0x0fb3('0x31')](_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x29')])||_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x29')]===''){return _0xbcb722(_0x219997[_0x0fb3('0x16')](0x1f4,_0x0fb3('0x34')));}if(_[_0x0fb3('0x31')](_0x10ea57[_0x0fb3('0x29')]['mapKey'])){return _0xbcb722(_0x219997[_0x0fb3('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x19a98d));}if(!_[_0x0fb3('0x35')](_0x19a98d,_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x36')])){return _0xbcb722(_0x219997[_0x0fb3('0x16')](0x1f4,_0x0fb3('0x37')+_0x19a98d));}var _0x35eacb={};_0x35eacb[_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x36')]]=_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x32')];return db[_0x0fb3('0x1c')][_0x0fb3('0x27')]({'where':{'id':_0x10ea57['account']['id']},'include':[{'model':db[_0x0fb3('0x38')],'as':_0x0fb3('0x39'),'include':[{'model':db[_0x0fb3('0x2c')],'as':'Contacts','where':_0x35eacb,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x0fb3('0x3a')],'as':_0x0fb3('0x3b')},{'model':db[_0x0fb3('0x3c')],'as':'Smtp'}]})[_0x0fb3('0x11')](function(_0x9c5837){if(_0x9c5837&&_0x9c5837[_0x0fb3('0x39')]){var _0x4c6153=_0x9c5837['get']({'plain':!![]});_0x11f44b['account']=_[_0x0fb3('0x3d')](_0x4c6153,[_0x0fb3('0x3b'),_0x0fb3('0x39')]);_0x11f44b[_0x0fb3('0x3e')]=_0x4c6153[_0x0fb3('0x3b')];_0x11f44b['list']=_0x4c6153[_0x0fb3('0x39')];_0x11f44b[_0x0fb3('0x3e')]=_['orderBy'](_0x11f44b[_0x0fb3('0x3e')],[_0x0fb3('0x3f')],[_0x0fb3('0x40')]);if(_0x11f44b[_0x0fb3('0x41')]&&_0x11f44b[_0x0fb3('0x41')][_0x0fb3('0x42')]){_0x11f44b[_0x0fb3('0x3e')][_0x0fb3('0x43')]({'id':0x0,'priority':_0x11f44b[_0x0fb3('0x3e')][_0x0fb3('0x44')]+0x1,'app':_0x0fb3('0x45'),'appdata':_0x0fb3('0x42'),'interval':_0x0fb3('0x46')});}if(_0x11f44b[_0x0fb3('0x41')]['Applications']){delete _0x11f44b[_0x0fb3('0x41')][_0x0fb3('0x3b')];}if(_0x11f44b[_0x0fb3('0x41')]['List']){delete _0x11f44b[_0x0fb3('0x41')]['List'];}if(_0x4c6153[_0x0fb3('0x39')][_0x0fb3('0x47')][_0x0fb3('0x44')]){return _0x4c6153[_0x0fb3('0x39')][_0x0fb3('0x47')][0x0];}var _0x394e6b=_[_0x0fb3('0xc')](_0x10ea57[_0x0fb3('0x29')],{'firstName':_0x10ea57[_0x0fb3('0x29')]['from'],'ListId':_0x4c6153['ListId']});_0x394e6b[_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x36')]]=_0x10ea57['body'][_0x0fb3('0x32')];return db['CmContact'][_0x0fb3('0x48')](_0x394e6b);}else{throw new Error(_0x0fb3('0x49'));}})['then'](function(_0x36f24f){_0x11f44b[_0x0fb3('0x4a')]=_0x36f24f;if(_0x36f24f){if(!_0x10ea57[_0x0fb3('0x29')]['message'][_0x0fb3('0x4b')]){_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x4b')]=rs['generate']()+'\x20'+_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x32')];}var _0x3c4e89={'ContactId':_0x36f24f['id'],'MailAccountId':_0x10ea57[_0x0fb3('0x41')]['id'],'inReplyTo':_0x10ea57[_0x0fb3('0x29')]['message'][_0x0fb3('0x4b')],'to':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x32')],'cc':_0x10ea57[_0x0fb3('0x29')]['message']['cc'],'subject':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x4c')],'attach':_0x10ea57[_0x0fb3('0x29')]['message'][_0x0fb3('0x4d')],'lastMsgAt':moment()[_0x0fb3('0x4e')](_0x0fb3('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x29')]};return db['MailInteraction'][_0x0fb3('0x27')]({'where':{'closed':![],'MailAccountId':_0x10ea57[_0x0fb3('0x41')]['id']},'include':[{'model':db[_0x0fb3('0x50')],'as':_0x0fb3('0x51'),'attributes':[_0x0fb3('0x4b')],'where':{'messageId':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x52')]}}]})[_0x0fb3('0x11')](function(_0x4b3d39){if(_0x4b3d39){return[_0x4b3d39,![]];}return db[_0x0fb3('0x53')][_0x0fb3('0x48')](_0x3c4e89)[_0x0fb3('0x11')](function(_0x952ed2){return[_0x952ed2,!![]];});});}else{throw new Error(_0x0fb3('0x54'));}})[_0x0fb3('0x55')](function(_0xa3713f,_0x592e98){if(_0xa3713f){_0x19384f=_0x592e98;if(!_0x592e98){return _0xa3713f[_0x0fb3('0x56')]({'inReplyTo':_0x10ea57['body']['message'][_0x0fb3('0x4b')],'to':_0x10ea57['body']['message'][_0x0fb3('0x32')],'cc':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')]['cc'],'subject':_0x10ea57['body'][_0x0fb3('0x19')][_0x0fb3('0x4c')],'attach':_0xa3713f[_0x0fb3('0x4d')]?_0xa3713f[_0x0fb3('0x4d')]:_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x4d')],'substatus':null,'substatusAt':moment()[_0x0fb3('0x4e')](_0x0fb3('0x4f')),'lastMsgAt':moment()['format'](_0x0fb3('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x10ea57[_0x0fb3('0x29')]['body']});}else{return _0xa3713f;}}})['then'](function(_0x4e4e73){_0x11f44b[_0x0fb3('0x57')]=_0x4e4e73[_0x0fb3('0x58')]({'plain':!![]});_0x11f44b[_0x0fb3('0x57')][_0x0fb3('0x59')]=_0x19384f;return db['MailMessage'][_0x0fb3('0x48')]({'body':_0x10ea57['body'][_0x0fb3('0x29')],'MailAccountId':_0x10ea57[_0x0fb3('0x41')]['id'],'MailInteractionId':_0x4e4e73['id'],'direction':'in','ContactId':_0x11f44b[_0x0fb3('0x4a')]['id'],'messageId':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x4b')],'from':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x32')],'to':_0x10ea57['body']['message']['to'],'cc':_0x10ea57['body'][_0x0fb3('0x19')]['cc'],'subject':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x4c')],'attach':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x4d')],'Attachments':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')]['attachments'],'originTo':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')]['originTo'],'originCc':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')]['originCc'],'bcc':_0x10ea57[_0x0fb3('0x29')][_0x0fb3('0x19')][_0x0fb3('0x5a')]},{'include':[{'model':db[_0x0fb3('0x5b')],'as':_0x0fb3('0x5c')}]});})[_0x0fb3('0x11')](function(_0x5cf0e8){_0x11f44b[_0x0fb3('0x19')]=_0x5cf0e8;if(_0x11f44b[_0x0fb3('0x57')][_0x0fb3('0x5d')]){return db[_0x0fb3('0x5e')][_0x0fb3('0x27')]({'attributes':['id',_0x0fb3('0x5f')],'where':{'id':_0x11f44b[_0x0fb3('0x57')][_0x0fb3('0x5d')]}})[_0x0fb3('0x11')](function(_0x250a8c){if(_0x250a8c){_0x11f44b['applications'][_0x0fb3('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x250a8c['name']+','+(_0x11f44b[_0x0fb3('0x41')][_0x0fb3('0x61')]||0xa),'interval':_0x0fb3('0x46')});}return respondWithRpcPromise(_0x0fb3('0x62'),_0x0fb3('0x63'),_0x11f44b);});}return respondWithRpcPromise(_0x0fb3('0x62'),_0x0fb3('0x63'),_0x11f44b);})['then'](function(_0x1043d5){_0x20e4c3(_0x1043d5);})['catch'](function(_0x4f9907){_0xbcb722(_0x219997[_0x0fb3('0x16')](0x1f4,_0x4f9907[_0x0fb3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 3f42d50..325161a 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 _0x872a=['removeListener','register','length','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x3837f3,_0x5713e5){var _0x553228=function(_0x560145){while(--_0x560145){_0x3837f3['push'](_0x3837f3['shift']());}};_0x553228(++_0x5713e5);}(_0x872a,0x100));var _0xa872=function(_0x3e27ea,_0xa2347a){_0x3e27ea=_0x3e27ea-0x0;var _0x3eb467=_0x872a[_0x3e27ea];return _0x3eb467;};'use strict';var MailAccountEvents=require(_0xa872('0x0'));var events=[_0xa872('0x1'),_0xa872('0x2'),_0xa872('0x3')];function createListener(_0x4a2170,_0x48294d){return function(_0x4c6509){_0x48294d[_0xa872('0x4')](_0x4a2170,_0x4c6509);};}function removeListener(_0x58715a,_0x2854a7){return function(){MailAccountEvents[_0xa872('0x5')](_0x58715a,_0x2854a7);};}exports[_0xa872('0x6')]=function(_0x1c8d2f){for(var _0x3e3cd4=0x0,_0x4aab9d=events[_0xa872('0x7')];_0x3e3cd4<_0x4aab9d;_0x3e3cd4++){var _0x1b87b7=events[_0x3e3cd4];var _0x1e0c05=createListener(_0xa872('0x8')+_0x1b87b7,_0x1c8d2f);MailAccountEvents['on'](_0x1b87b7,_0x1e0c05);}}; \ No newline at end of file +var _0x8585=['remove','removeListener','length','mailAccount:','./mailAccount.events','save'];(function(_0xe9a4ac,_0x4c5d28){var _0x42474c=function(_0x113bf6){while(--_0x113bf6){_0xe9a4ac['push'](_0xe9a4ac['shift']());}};_0x42474c(++_0x4c5d28);}(_0x8585,0x64));var _0x5858=function(_0x222bd3,_0x4c9a4f){_0x222bd3=_0x222bd3-0x0;var _0x4bed46=_0x8585[_0x222bd3];return _0x4bed46;};'use strict';var MailAccountEvents=require(_0x5858('0x0'));var events=[_0x5858('0x1'),_0x5858('0x2'),'update'];function createListener(_0x2864b0,_0x294e8e){return function(_0x5739bc){_0x294e8e['emit'](_0x2864b0,_0x5739bc);};}function removeListener(_0x5c548b,_0x307ed3){return function(){MailAccountEvents[_0x5858('0x3')](_0x5c548b,_0x307ed3);};}exports['register']=function(_0x5807a2){for(var _0x35b37a=0x0,_0x1d26d1=events[_0x5858('0x4')];_0x35b37a<_0x1d26d1;_0x35b37a++){var _0x5c8e94=events[_0x35b37a];var _0x4d5efe=createListener(_0x5858('0x5')+_0x5c8e94,_0x5807a2);MailAccountEvents['on'](_0x5c8e94,_0x4d5efe);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index f4f85ff..799889c 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 _0x2f68=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','delete','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2f68,0x9a));var _0x82f6=function(_0x3ce043,_0x11d614){_0x3ce043=_0x3ce043-0x0;var _0x1a5feb=_0x2f68[_0x3ce043];return _0x1a5feb;};'use strict';var multer=require('multer');var util=require(_0x82f6('0x0'));var path=require(_0x82f6('0x1'));var timeout=require(_0x82f6('0x2'));var express=require(_0x82f6('0x3'));var router=express['Router']();var auth=require(_0x82f6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x82f6('0x5'));var controller=require(_0x82f6('0x6'));router['get'](_0x82f6('0x7'),auth[_0x82f6('0x8')](),controller['show']);router['put'](_0x82f6('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x82f6('0x9')](_0x82f6('0x7'),auth[_0x82f6('0x8')](),controller['destroy']);module[_0x82f6('0xa')]=router; \ No newline at end of file +var _0x6324=['multer','util','path','connect-timeout','Router','../../components/interaction/service','./mailApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy'];(function(_0x48c9b3,_0x1fb678){var _0x4c782f=function(_0x4b3842){while(--_0x4b3842){_0x48c9b3['push'](_0x48c9b3['shift']());}};_0x4c782f(++_0x1fb678);}(_0x6324,0x142));var _0x4632=function(_0x3bd608,_0x4983d3){_0x3bd608=_0x3bd608-0x0;var _0x538339=_0x6324[_0x3bd608];return _0x538339;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4632('0x5'));var config=require('../../config/environment');var controller=require(_0x4632('0x6'));router['get'](_0x4632('0x7'),auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0xa')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router[_0x4632('0xc')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 8dc6c4b..92bee5b 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 _0x490f=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x1eeb94,_0xb7570a){var _0x50b85b=function(_0x4f22fc){while(--_0x4f22fc){_0x1eeb94['push'](_0x1eeb94['shift']());}};_0x50b85b(++_0xb7570a);}(_0x490f,0x1ec));var _0xf490=function(_0x1f62c3,_0x1ff95b){_0x1f62c3=_0x1f62c3-0x0;var _0x385c1c=_0x490f[_0x1f62c3];return _0x385c1c;};'use strict';var Sequelize=require(_0xf490('0x0'));module[_0xf490('0x1')]={'priority':{'type':Sequelize[_0xf490('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf490('0x3')},'appdata':{'type':Sequelize[_0xf490('0x4')]()},'description':{'type':Sequelize[_0xf490('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf490('0x6')}}; \ No newline at end of file +var _0x1250=['*,*,*,*','sequelize','INTEGER','STRING','TEXT'];(function(_0xcb5cca,_0x3701ce){var _0xf52198=function(_0x509a69){while(--_0x509a69){_0xcb5cca['push'](_0xcb5cca['shift']());}};_0xf52198(++_0x3701ce);}(_0x1250,0xe2));var _0x0125=function(_0x32a71e,_0x3f3515){_0x32a71e=_0x32a71e-0x0;var _0x125207=_0x1250[_0x32a71e];return _0x125207;};'use strict';var Sequelize=require(_0x0125('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0125('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0125('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0125('0x3')]()},'description':{'type':Sequelize[_0x0125('0x2')]},'interval':{'type':Sequelize[_0x0125('0x2')],'defaultValue':_0x0125('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 868a115..6cb9596 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 _0xf781=['limit','set','apply','reject','save','update','destroy','then','error','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x324571,_0x107d53){var _0x2b3efa=function(_0x19a9d3){while(--_0x19a9d3){_0x324571['push'](_0x324571['shift']());}};_0x2b3efa(++_0x107d53);}(_0xf781,0x179));var _0x1f78=function(_0x230295,_0x24e3e8){_0x230295=_0x230295-0x0;var _0xaa6aee=_0xf781[_0x230295];return _0xaa6aee;};'use strict';var pdf=require(_0x1f78('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1f78('0x1'));var zipdir=require(_0x1f78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f78('0x3'));var moment=require(_0x1f78('0x4'));var BPromise=require(_0x1f78('0x5'));var Mustache=require('mustache');var util=require(_0x1f78('0x6'));var path=require(_0x1f78('0x7'));var sox=require(_0x1f78('0x8'));var csv=require(_0x1f78('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1f78('0xa'));var crypto=require(_0x1f78('0xb'));var jsforce=require(_0x1f78('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1f78('0x9'));var querystring=require(_0x1f78('0xd'));var Papa=require(_0x1f78('0xe'));var Redis=require(_0x1f78('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1f78('0x10'));var hardwareService=require(_0x1f78('0x11'));var logger=require('../../config/logger')(_0x1f78('0x12'));var utils=require(_0x1f78('0x13'));var config=require(_0x1f78('0x14'));var licenseUtil=require(_0x1f78('0x15'));var db=require(_0x1f78('0x16'))['db'];function respondWithStatusCode(_0x2860ab,_0x5f6013){_0x5f6013=_0x5f6013||0xcc;return function(_0x4d1e57){if(_0x4d1e57){return _0x2860ab[_0x1f78('0x17')](_0x5f6013);}return _0x2860ab[_0x1f78('0x18')](_0x5f6013)[_0x1f78('0x19')]();};}function respondWithResult(_0x2bbb4d,_0x46c777){_0x46c777=_0x46c777||0xc8;return function(_0x131605){if(_0x131605){return _0x2bbb4d[_0x1f78('0x18')](_0x46c777)[_0x1f78('0x1a')](_0x131605);}};}function respondWithFilteredResult(_0x34b1f0,_0x3f0354){return function(_0x22fae7){if(_0x22fae7){var _0x21513e=_0x22fae7[_0x1f78('0x1b')],_0x26385a=_0x3f0354[_0x1f78('0x1c')],_0x21bc22=_0x3f0354[_0x1f78('0x1c')]+_0x3f0354[_0x1f78('0x1d')],_0x33eb03;if(_0x21bc22>=_0x21513e){_0x21bc22=_0x21513e;_0x33eb03=0xc8;}else{_0x33eb03=0xce;}_0x34b1f0[_0x1f78('0x18')](_0x33eb03);return _0x34b1f0[_0x1f78('0x1e')]('Content-Range',_0x26385a+'-'+_0x21bc22+'/'+_0x21513e)['json'](_0x22fae7);}return null;};}function patchUpdates(_0x3da041){return function(_0x295460){try{jsonpatch[_0x1f78('0x1f')](_0x295460,_0x3da041,!![]);}catch(_0x57ba13){return BPromise[_0x1f78('0x20')](_0x57ba13);}return _0x295460[_0x1f78('0x21')]();};}function saveUpdates(_0x4dddcb,_0x16ba83){return function(_0x1bfe86){if(_0x1bfe86){return _0x1bfe86[_0x1f78('0x22')](_0x4dddcb)['then'](function(_0x2da4c5){return _0x2da4c5;});}return null;};}function removeEntity(_0x10028c,_0x4dc309){return function(_0x237421){if(_0x237421){return _0x237421[_0x1f78('0x23')]()[_0x1f78('0x24')](function(){_0x10028c['status'](0xcc)[_0x1f78('0x19')]();});}};}function handleEntityNotFound(_0x2add86,_0x4c4139){return function(_0x5799fe){if(!_0x5799fe){_0x2add86[_0x1f78('0x17')](0x194);}return _0x5799fe;};}function handleError(_0xc946db,_0xd9e92c){_0xd9e92c=_0xd9e92c||0x1f4;return function(_0x1d7939){logger[_0x1f78('0x25')](_0x1d7939[_0x1f78('0x26')]);if(_0x1d7939[_0x1f78('0x27')]){delete _0x1d7939[_0x1f78('0x27')];}_0xc946db[_0x1f78('0x18')](_0xd9e92c)[_0x1f78('0x28')](_0x1d7939);};}exports['show']=function(_0x550d04,_0x4df8de){var _0x4c9b13={'raw':!![],'where':{'id':_0x550d04[_0x1f78('0x29')]['id']}},_0x565cbd={};_0x565cbd[_0x1f78('0x2a')]=_[_0x1f78('0x2b')](db[_0x1f78('0x2c')]['rawAttributes']);_0x565cbd['query']=_[_0x1f78('0x2b')](_0x550d04[_0x1f78('0x2d')]);_0x565cbd[_0x1f78('0x2e')]=_[_0x1f78('0x2f')](_0x565cbd[_0x1f78('0x2a')],_0x565cbd[_0x1f78('0x2d')]);_0x4c9b13[_0x1f78('0x30')]=_[_0x1f78('0x2f')](_0x565cbd[_0x1f78('0x2a')],qs[_0x1f78('0x31')](_0x550d04['query']['fields']));_0x4c9b13[_0x1f78('0x30')]=_0x4c9b13['attributes'][_0x1f78('0x32')]?_0x4c9b13[_0x1f78('0x30')]:_0x565cbd[_0x1f78('0x2a')];if(_0x550d04[_0x1f78('0x2d')][_0x1f78('0x33')]){_0x4c9b13[_0x1f78('0x34')]=[{'all':!![]}];}_0x4c9b13=_[_0x1f78('0x35')]({},_0x4c9b13,_0x550d04[_0x1f78('0x36')]);return db[_0x1f78('0x2c')][_0x1f78('0x37')](_0x4c9b13)['then'](handleEntityNotFound(_0x4df8de,null))[_0x1f78('0x24')](respondWithResult(_0x4df8de,null))[_0x1f78('0x38')](handleError(_0x4df8de,null));};exports[_0x1f78('0x22')]=function(_0x5c0a00,_0x4e3e98){if(_0x5c0a00[_0x1f78('0x39')]['id']){delete _0x5c0a00[_0x1f78('0x39')]['id'];}return db['MailApplication'][_0x1f78('0x37')]({'where':{'id':_0x5c0a00[_0x1f78('0x29')]['id']}})['then'](handleEntityNotFound(_0x4e3e98,null))[_0x1f78('0x24')](saveUpdates(_0x5c0a00['body'],null))[_0x1f78('0x24')](respondWithResult(_0x4e3e98,null))[_0x1f78('0x38')](handleError(_0x4e3e98,null));};exports[_0x1f78('0x23')]=function(_0x321047,_0x49c145){return db['MailApplication']['find']({'where':{'id':_0x321047[_0x1f78('0x29')]['id']}})[_0x1f78('0x24')](handleEntityNotFound(_0x49c145,null))[_0x1f78('0x24')](removeEntity(_0x49c145,null))[_0x1f78('0x38')](handleError(_0x49c145,null));}; \ No newline at end of file +var _0xa40d=['intersection','attributes','fields','length','includeAll','merge','options','find','catch','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','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','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','model','keys','MailApplication','rawAttributes','query','filters'];(function(_0x24dcb4,_0x1af2b9){var _0x124804=function(_0x4587db){while(--_0x4587db){_0x24dcb4['push'](_0x24dcb4['shift']());}};_0x124804(++_0x1af2b9);}(_0xa40d,0x167));var _0xda40=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0xa40d[_0x1ac120];return _0x19b703;};'use strict';var pdf=require(_0xda40('0x0'));var emlformat=require(_0xda40('0x1'));var rimraf=require(_0xda40('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda40('0x3'));var rp=require(_0xda40('0x4'));var moment=require(_0xda40('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xda40('0x6'));var util=require(_0xda40('0x7'));var path=require(_0xda40('0x8'));var sox=require(_0xda40('0x9'));var csv=require(_0xda40('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xda40('0xb'));var crypto=require(_0xda40('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xda40('0xd'));var toCsv=require(_0xda40('0xa'));var querystring=require('querystring');var Papa=require(_0xda40('0xe'));var Redis=require('ioredis');var authService=require(_0xda40('0xf'));var qs=require(_0xda40('0x10'));var as=require(_0xda40('0x11'));var hardwareService=require(_0xda40('0x12'));var logger=require(_0xda40('0x13'))(_0xda40('0x14'));var utils=require(_0xda40('0x15'));var config=require(_0xda40('0x16'));var licenseUtil=require(_0xda40('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdd7bcd,_0x153980){_0x153980=_0x153980||0xcc;return function(_0x84e6fe){if(_0x84e6fe){return _0xdd7bcd[_0xda40('0x18')](_0x153980);}return _0xdd7bcd[_0xda40('0x19')](_0x153980)['end']();};}function respondWithResult(_0x2f7f7b,_0x5177eb){_0x5177eb=_0x5177eb||0xc8;return function(_0x388ed6){if(_0x388ed6){return _0x2f7f7b[_0xda40('0x19')](_0x5177eb)[_0xda40('0x1a')](_0x388ed6);}};}function respondWithFilteredResult(_0x5640ef,_0x8f6ac5){return function(_0x48219a){if(_0x48219a){var _0x44992c=_0x48219a[_0xda40('0x1b')],_0xd77d64=_0x8f6ac5[_0xda40('0x1c')],_0x5afe79=_0x8f6ac5[_0xda40('0x1c')]+_0x8f6ac5[_0xda40('0x1d')],_0x36a606;if(_0x5afe79>=_0x44992c){_0x5afe79=_0x44992c;_0x36a606=0xc8;}else{_0x36a606=0xce;}_0x5640ef[_0xda40('0x19')](_0x36a606);return _0x5640ef[_0xda40('0x1e')](_0xda40('0x1f'),_0xd77d64+'-'+_0x5afe79+'/'+_0x44992c)[_0xda40('0x1a')](_0x48219a);}return null;};}function patchUpdates(_0x2de18a){return function(_0x555807){try{jsonpatch[_0xda40('0x20')](_0x555807,_0x2de18a,!![]);}catch(_0x193c2e){return BPromise['reject'](_0x193c2e);}return _0x555807[_0xda40('0x21')]();};}function saveUpdates(_0xd972c3,_0x45f65c){return function(_0x2b9361){if(_0x2b9361){return _0x2b9361[_0xda40('0x22')](_0xd972c3)[_0xda40('0x23')](function(_0x1591f4){return _0x1591f4;});}return null;};}function removeEntity(_0x2afc14,_0x3f42a8){return function(_0x45d7a2){if(_0x45d7a2){return _0x45d7a2[_0xda40('0x24')]()[_0xda40('0x23')](function(){_0x2afc14[_0xda40('0x19')](0xcc)[_0xda40('0x25')]();});}};}function handleEntityNotFound(_0x534347,_0xbcfcb3){return function(_0x4f6c12){if(!_0x4f6c12){_0x534347[_0xda40('0x18')](0x194);}return _0x4f6c12;};}function handleError(_0x35c13c,_0x280c71){_0x280c71=_0x280c71||0x1f4;return function(_0x27f432){logger[_0xda40('0x26')](_0x27f432[_0xda40('0x27')]);if(_0x27f432['name']){delete _0x27f432[_0xda40('0x28')];}_0x35c13c[_0xda40('0x19')](_0x280c71)['send'](_0x27f432);};}exports['show']=function(_0x2f2951,_0x1f78cf){var _0x397068={'raw':!![],'where':{'id':_0x2f2951['params']['id']}},_0x4ae252={};_0x4ae252[_0xda40('0x29')]=_[_0xda40('0x2a')](db[_0xda40('0x2b')][_0xda40('0x2c')]);_0x4ae252[_0xda40('0x2d')]=_[_0xda40('0x2a')](_0x2f2951[_0xda40('0x2d')]);_0x4ae252[_0xda40('0x2e')]=_[_0xda40('0x2f')](_0x4ae252[_0xda40('0x29')],_0x4ae252[_0xda40('0x2d')]);_0x397068[_0xda40('0x30')]=_[_0xda40('0x2f')](_0x4ae252[_0xda40('0x29')],qs[_0xda40('0x31')](_0x2f2951['query'][_0xda40('0x31')]));_0x397068[_0xda40('0x30')]=_0x397068['attributes'][_0xda40('0x32')]?_0x397068[_0xda40('0x30')]:_0x4ae252[_0xda40('0x29')];if(_0x2f2951[_0xda40('0x2d')][_0xda40('0x33')]){_0x397068['include']=[{'all':!![]}];}_0x397068=_[_0xda40('0x34')]({},_0x397068,_0x2f2951[_0xda40('0x35')]);return db[_0xda40('0x2b')][_0xda40('0x36')](_0x397068)['then'](handleEntityNotFound(_0x1f78cf,null))['then'](respondWithResult(_0x1f78cf,null))[_0xda40('0x37')](handleError(_0x1f78cf,null));};exports['update']=function(_0x39aa40,_0x2214f9){if(_0x39aa40[_0xda40('0x38')]['id']){delete _0x39aa40[_0xda40('0x38')]['id'];}return db[_0xda40('0x2b')]['find']({'where':{'id':_0x39aa40['params']['id']}})[_0xda40('0x23')](handleEntityNotFound(_0x2214f9,null))['then'](saveUpdates(_0x39aa40[_0xda40('0x38')],null))[_0xda40('0x23')](respondWithResult(_0x2214f9,null))[_0xda40('0x37')](handleError(_0x2214f9,null));};exports[_0xda40('0x24')]=function(_0x4c3eb8,_0x150226){return db[_0xda40('0x2b')][_0xda40('0x36')]({'where':{'id':_0x4c3eb8[_0xda40('0x39')]['id']}})[_0xda40('0x23')](handleEntityNotFound(_0x150226,null))[_0xda40('0x23')](removeEntity(_0x150226,null))[_0xda40('0x37')](handleError(_0x150226,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 719b52f..c07f602 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 _0x583c=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./mailApplication.attributes','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1f3516,_0x45706b){var _0x53b65e=function(_0x4d20be){while(--_0x4d20be){_0x1f3516['push'](_0x1f3516['shift']());}};_0x53b65e(++_0x45706b);}(_0x583c,0x12b));var _0xc583=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0x583c[_0xac0de1];return _0x1c1995;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var logger=require(_0xc583('0x2'))(_0xc583('0x3'));var moment=require('moment');var BPromise=require(_0xc583('0x4'));var rp=require(_0xc583('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc583('0x6'));var attributes=require(_0xc583('0x7'));module['exports']=function(_0xd3a750,_0x365ed6){return _0xd3a750[_0xc583('0x8')](_0xc583('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc583('0xa'),'collate':_0xc583('0xb')});}; \ No newline at end of file +var _0xdfb1=['bluebird','request-promise','path','rimraf','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x2c9724,_0xc692e6){var _0x4bf044=function(_0x308c6c){while(--_0x308c6c){_0x2c9724['push'](_0x2c9724['shift']());}};_0x4bf044(++_0xc692e6);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x5e2e8a,_0x40d0d4){_0x5e2e8a=_0x5e2e8a-0x0;var _0x3162b1=_0xdfb1[_0x5e2e8a];return _0x3162b1;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var logger=require(_0x1dfb('0x2'))(_0x1dfb('0x3'));var moment=require('moment');var BPromise=require(_0x1dfb('0x4'));var rp=require(_0x1dfb('0x5'));var fs=require('fs');var path=require(_0x1dfb('0x6'));var rimraf=require(_0x1dfb('0x7'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module['exports']=function(_0x31f0ff,_0x36bf77){return _0x31f0ff[_0x1dfb('0x8')]('MailApplication',attributes,{'tableName':_0x1dfb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1dfb('0xa'),'collate':_0x1dfb('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 7c91091..fd37747 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 _0xeef6=['rpc','../../config/environment','http','request','then','info','debug','request\x20sent','stringify','error','MailApplication,\x20%s,\x20%s','result','catch','UpdateMailApplication','MailApplication','update','body','options','attributes','limit','message','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2350fc,_0x37dcc4){var _0x33c026=function(_0x13c463){while(--_0x13c463){_0x2350fc['push'](_0x2350fc['shift']());}};_0x33c026(++_0x37dcc4);}(_0xeef6,0x66));var _0x6eef=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xeef6[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6eef('0x0'));var util=require('util');var moment=require(_0x6eef('0x1'));var BPromise=require('bluebird');var rs=require(_0x6eef('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6eef('0x3'))['db'];var utils=require(_0x6eef('0x4'));var logger=require(_0x6eef('0x5'))(_0x6eef('0x6'));var config=require(_0x6eef('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6eef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd42cc4,_0x2bc8ad,_0x3ae79a){return new BPromise(function(_0x17b6f5,_0x5b6702){return client[_0x6eef('0x9')](_0xd42cc4,_0x3ae79a)[_0x6eef('0xa')](function(_0x17b2c1){logger[_0x6eef('0xb')]('MailApplication,\x20%s,\x20%s',_0x2bc8ad,'request\x20sent');logger[_0x6eef('0xc')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x2bc8ad,_0x6eef('0xd'),JSON[_0x6eef('0xe')](_0x17b2c1));if(_0x17b2c1[_0x6eef('0xf')]){if(_0x17b2c1[_0x6eef('0xf')]['code']===0x1f4){logger[_0x6eef('0xf')](_0x6eef('0x10'),_0x2bc8ad,_0x17b2c1[_0x6eef('0xf')]['message']);return _0x5b6702(_0x17b2c1[_0x6eef('0xf')]['message']);}logger[_0x6eef('0xf')]('MailApplication,\x20%s,\x20%s',_0x2bc8ad,_0x17b2c1[_0x6eef('0xf')]['message']);return _0x17b6f5(_0x17b2c1[_0x6eef('0xf')]['message']);}else{logger[_0x6eef('0xb')]('MailApplication,\x20%s,\x20%s',_0x2bc8ad,_0x6eef('0xd'));_0x17b6f5(_0x17b2c1[_0x6eef('0x11')]['message']);}})[_0x6eef('0x12')](function(_0x36fdcb){logger['error']('MailApplication,\x20%s,\x20%s',_0x2bc8ad,_0x36fdcb);_0x5b6702(_0x36fdcb);});});}exports[_0x6eef('0x13')]=function(_0x21494d){var _0x120a06=this;return new Promise(function(_0x219f01,_0x2f2868){return db[_0x6eef('0x14')][_0x6eef('0x15')](_0x21494d[_0x6eef('0x16')],{'raw':_0x21494d['options']?_0x21494d[_0x6eef('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21494d[_0x6eef('0x17')]?_0x21494d[_0x6eef('0x17')]['where']||null:null,'attributes':_0x21494d['options']?_0x21494d[_0x6eef('0x17')][_0x6eef('0x18')]||null:null,'limit':_0x21494d[_0x6eef('0x17')]?_0x21494d[_0x6eef('0x17')][_0x6eef('0x19')]||null:null})[_0x6eef('0xa')](function(_0x58e354){logger[_0x6eef('0xb')](_0x6eef('0x13'),_0x21494d);logger[_0x6eef('0xc')]('UpdateMailApplication',_0x21494d,JSON[_0x6eef('0xe')](_0x58e354));_0x219f01(_0x58e354);})['catch'](function(_0xaaf694){logger[_0x6eef('0xf')](_0x6eef('0x13'),_0xaaf694[_0x6eef('0x1a')],_0x21494d);_0x2f2868(_0x120a06[_0x6eef('0xf')](0x1f4,_0xaaf694[_0x6eef('0x1a')]));});});}; \ No newline at end of file +var _0xf87b=['MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','limit','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0xf87b,0x88));var _0xbf87=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf87b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbf87('0x0'));var util=require(_0xbf87('0x1'));var moment=require(_0xbf87('0x2'));var BPromise=require(_0xbf87('0x3'));var rs=require(_0xbf87('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf87('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf87('0x6'))(_0xbf87('0x7'));var config=require(_0xbf87('0x8'));var jayson=require(_0xbf87('0x9'));var client=jayson[_0xbf87('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xab7f0,_0x31f613,_0x42cd92){return new BPromise(function(_0x5544cc,_0x249409){return client[_0xbf87('0xb')](_0xab7f0,_0x42cd92)[_0xbf87('0xc')](function(_0x5e5e4a){logger[_0xbf87('0xd')](_0xbf87('0xe'),_0x31f613,_0xbf87('0xf'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x31f613,_0xbf87('0xf'),JSON[_0xbf87('0x10')](_0x5e5e4a));if(_0x5e5e4a['error']){if(_0x5e5e4a[_0xbf87('0x11')]['code']===0x1f4){logger[_0xbf87('0x11')](_0xbf87('0xe'),_0x31f613,_0x5e5e4a[_0xbf87('0x11')][_0xbf87('0x12')]);return _0x249409(_0x5e5e4a[_0xbf87('0x11')][_0xbf87('0x12')]);}logger[_0xbf87('0x11')](_0xbf87('0xe'),_0x31f613,_0x5e5e4a[_0xbf87('0x11')]['message']);return _0x5544cc(_0x5e5e4a[_0xbf87('0x11')][_0xbf87('0x12')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x31f613,_0xbf87('0xf'));_0x5544cc(_0x5e5e4a[_0xbf87('0x13')][_0xbf87('0x12')]);}})[_0xbf87('0x14')](function(_0x11ba9d){logger[_0xbf87('0x11')]('MailApplication,\x20%s,\x20%s',_0x31f613,_0x11ba9d);_0x249409(_0x11ba9d);});});}exports[_0xbf87('0x15')]=function(_0x3c9dfe){var _0x54a03a=this;return new Promise(function(_0x1777a6,_0xae8486){return db[_0xbf87('0x16')][_0xbf87('0x17')](_0x3c9dfe[_0xbf87('0x18')],{'raw':_0x3c9dfe[_0xbf87('0x19')]?_0x3c9dfe[_0xbf87('0x19')][_0xbf87('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c9dfe[_0xbf87('0x19')]?_0x3c9dfe[_0xbf87('0x19')][_0xbf87('0x1b')]||null:null,'attributes':_0x3c9dfe['options']?_0x3c9dfe[_0xbf87('0x19')]['attributes']||null:null,'limit':_0x3c9dfe[_0xbf87('0x19')]?_0x3c9dfe['options'][_0xbf87('0x1c')]||null:null})[_0xbf87('0xc')](function(_0xe12442){logger[_0xbf87('0xd')](_0xbf87('0x15'),_0x3c9dfe);logger[_0xbf87('0x1d')](_0xbf87('0x15'),_0x3c9dfe,JSON[_0xbf87('0x10')](_0xe12442));_0x1777a6(_0xe12442);})['catch'](function(_0x1f7603){logger[_0xbf87('0x11')](_0xbf87('0x15'),_0x1f7603[_0xbf87('0x12')],_0x3c9dfe);_0xae8486(_0x54a03a['error'](0x1f4,_0x1f7603[_0xbf87('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 7db8271..25da9d8 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 _0xfd0f=['isAuthenticated','index','/describe','describe','show','/:id/messages','/:id/download','create','addMessage','/:id/tags','mail','put','tracked','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./mailInteraction.controller','get'];(function(_0x107234,_0x49236c){var _0x14e00b=function(_0x25b686){while(--_0x25b686){_0x107234['push'](_0x107234['shift']());}};_0x14e00b(++_0x49236c);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x3d7cb8,_0x58d178){_0x3d7cb8=_0x3d7cb8-0x0;var _0x262a02=_0xfd0f[_0x3d7cb8];return _0x262a02;};'use strict';var multer=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var path=require('path');var timeout=require(_0xffd0('0x2'));var express=require(_0xffd0('0x3'));var router=express[_0xffd0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xffd0('0x5'));var config=require('../../config/environment');var controller=require(_0xffd0('0x6'));router[_0xffd0('0x7')]('/',auth[_0xffd0('0x8')](),controller[_0xffd0('0x9')]);router[_0xffd0('0x7')](_0xffd0('0xa'),auth[_0xffd0('0x8')](),controller[_0xffd0('0xb')]);router[_0xffd0('0x7')]('/:id',auth[_0xffd0('0x8')](),controller[_0xffd0('0xc')]);router[_0xffd0('0x7')](_0xffd0('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0xffd0('0x7')](_0xffd0('0xe'),auth[_0xffd0('0x8')](),controller['download']);router['post']('/',auth[_0xffd0('0x8')](),controller[_0xffd0('0xf')]);router['post'](_0xffd0('0xd'),auth[_0xffd0('0x8')](),controller[_0xffd0('0x10')]);router['post'](_0xffd0('0x11'),auth[_0xffd0('0x8')](),interaction['tracked'](_0xffd0('0x12'),'mailinteraction:addtags'),controller['addTags']);router[_0xffd0('0x13')]('/:id',auth[_0xffd0('0x8')](),interaction[_0xffd0('0x14')](_0xffd0('0x12'),_0xffd0('0x15')),controller[_0xffd0('0x16')]);router['delete']('/:id',auth[_0xffd0('0x8')](),interaction[_0xffd0('0x14')](_0xffd0('0x12'),_0xffd0('0x17')),controller[_0xffd0('0x18')]);router[_0xffd0('0x19')](_0xffd0('0x11'),auth[_0xffd0('0x8')](),controller[_0xffd0('0x1a')]);module[_0xffd0('0x1b')]=router; \ No newline at end of file +var _0xf3cd=['download','post','create','addMessage','tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x915de9,_0xabf9e5){_0x915de9=_0x915de9-0x0;var _0x274129=_0xf3cd[_0x915de9];return _0x274129;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf3c('0x6'));var config=require(_0xdf3c('0x7'));var controller=require(_0xdf3c('0x8'));router['get']('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xa')]);router[_0xdf3c('0xb')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xd')]);router['get'](_0xdf3c('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xdf3c('0xb')](_0xdf3c('0xf'),auth['isAuthenticated'](),controller[_0xdf3c('0x10')]);router[_0xdf3c('0xb')](_0xdf3c('0x11'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x12')]);router[_0xdf3c('0x13')]('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x14')]);router['post'](_0xdf3c('0xf'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x15')]);router[_0xdf3c('0x13')]('/:id/tags',auth[_0xdf3c('0x9')](),interaction[_0xdf3c('0x16')](_0xdf3c('0x17'),'mailinteraction:addtags'),controller[_0xdf3c('0x18')]);router[_0xdf3c('0x19')](_0xdf3c('0xe'),auth[_0xdf3c('0x9')](),interaction[_0xdf3c('0x16')](_0xdf3c('0x17'),_0xdf3c('0x1a')),controller[_0xdf3c('0x1b')]);router[_0xdf3c('0x1c')](_0xdf3c('0xe'),auth['isAuthenticated'](),interaction[_0xdf3c('0x16')](_0xdf3c('0x17'),_0xdf3c('0x1d')),controller[_0xdf3c('0x1e')]);router[_0xdf3c('0x1c')](_0xdf3c('0x1f'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x20')]);module[_0xdf3c('0x21')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 099facc..98b4ba7 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 _0x2cb9=['sequelize','BOOLEAN','DATE','STRING','TEXT','long','out'];(function(_0x3760f1,_0x498373){var _0x14d886=function(_0x104123){while(--_0x104123){_0x3760f1['push'](_0x3760f1['shift']());}};_0x14d886(++_0x498373);}(_0x2cb9,0x142));var _0x92cb=function(_0x870499,_0x2bcd69){_0x870499=_0x870499-0x0;var _0x188f31=_0x2cb9[_0x870499];return _0x188f31;};'use strict';var Sequelize=require(_0x92cb('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x92cb('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x92cb('0x2')]},'disposition':{'type':Sequelize[_0x92cb('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x92cb('0x3')]},'note':{'type':Sequelize[_0x92cb('0x3')]},'inReplyTo':{'type':Sequelize[_0x92cb('0x3')](0x1fe)},'to':{'type':Sequelize[_0x92cb('0x3')]},'cc':{'type':Sequelize[_0x92cb('0x4')](_0x92cb('0x5'))},'subject':{'type':Sequelize[_0x92cb('0x4')]()},'attach':{'type':Sequelize[_0x92cb('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x92cb('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x92cb('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x92cb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x92cb('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x92cb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT']('long')},'lastMsgText':{'type':Sequelize[_0x92cb('0x4')](_0x92cb('0x5'))}}; \ No newline at end of file +var _0x5429=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5429,0x10d));var _0x9542=function(_0xfb8f31,_0x2d3880){_0xfb8f31=_0xfb8f31-0x0;var _0x28b6e0=_0x5429[_0xfb8f31];return _0x28b6e0;};'use strict';var Sequelize=require(_0x9542('0x0'));var iconv=require(_0x9542('0x1'));module[_0x9542('0x2')]={'closed':{'type':Sequelize[_0x9542('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9542('0x4')]},'disposition':{'type':Sequelize[_0x9542('0x5')]},'secondDisposition':{'type':Sequelize[_0x9542('0x5')]},'thirdDisposition':{'type':Sequelize[_0x9542('0x5')]},'note':{'type':Sequelize[_0x9542('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x9542('0x5')]},'cc':{'type':Sequelize[_0x9542('0x6')](_0x9542('0x7'))},'subject':{'type':Sequelize[_0x9542('0x6')]()},'attach':{'type':Sequelize[_0x9542('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9542('0x4')]},'substatus':{'type':Sequelize[_0x9542('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x9542('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9542('0x8')]('in',_0x9542('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9542('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9542('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x9542('0x6')](_0x9542('0x7'))},'lastMsgText':{'type':Sequelize[_0x9542('0x6')]('long')}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index becfd60..6cc20f2 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 _0xaebd=['mkdirSync','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','writeFileSync','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','count','offset','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','fullname','Tags','TagIds','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','fromString','catch','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','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','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','operator','length','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','MailAccountId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IN\x20?','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','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.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','params','rawAttributes','include','options','create','update','body','describe','addMessage','MailMessage','ids','getMessages','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','true','rows','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','attachments','format','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','get'];(function(_0x45d2fa,_0x36752f){var _0x5df9d3=function(_0x2513b7){while(--_0x2513b7){_0x45d2fa['push'](_0x45d2fa['shift']());}};_0x5df9d3(++_0x36752f);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x5f2f72,_0x7a26da){_0x5f2f72=_0x5f2f72-0x0;var _0x27aabc=_0xaebd[_0x5f2f72];return _0x27aabc;};'use strict';var pdf=require(_0xdaeb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdaeb('0x1'));var zipdir=require(_0xdaeb('0x2'));var jsonpatch=require(_0xdaeb('0x3'));var rp=require(_0xdaeb('0x4'));var moment=require(_0xdaeb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdaeb('0x6'));var util=require(_0xdaeb('0x7'));var path=require(_0xdaeb('0x8'));var sox=require(_0xdaeb('0x9'));var csv=require(_0xdaeb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0xa'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var htmlToText=require(_0xdaeb('0xf'));var juice=require('juice');var Redis=require(_0xdaeb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x12'));var logger=require(_0xdaeb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xdaeb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x15'))['db'];config[_0xdaeb('0x16')]=_[_0xdaeb('0x17')](config[_0xdaeb('0x16')],{'host':_0xdaeb('0x18'),'port':0x18eb});var socket=require(_0xdaeb('0x19'))(new Redis(config[_0xdaeb('0x16')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x96371f,_0x306bdb){_0x306bdb=_0x306bdb||0xcc;return function(_0x34b2fe){if(_0x34b2fe){return _0x96371f[_0xdaeb('0x1a')](_0x306bdb);}return _0x96371f['status'](_0x306bdb)['end']();};}function respondWithResult(_0x24b898,_0x4dd803){_0x4dd803=_0x4dd803||0xc8;return function(_0x47984b){if(_0x47984b){return _0x24b898[_0xdaeb('0x1b')](_0x4dd803)[_0xdaeb('0x1c')](_0x47984b);}};}function respondWithFilteredResult(_0x1b5243,_0x1fe84e){return function(_0x2d8f11){if(_0x2d8f11){var _0x36f9ac=_0x2d8f11[_0xdaeb('0x1d')],_0x501f77=_0x1fe84e[_0xdaeb('0x1e')],_0x22089c=_0x1fe84e[_0xdaeb('0x1e')]+_0x1fe84e['limit'],_0x5ccf66;if(_0x22089c>=_0x36f9ac){_0x22089c=_0x36f9ac;_0x5ccf66=0xc8;}else{_0x5ccf66=0xce;}_0x1b5243['status'](_0x5ccf66);return _0x1b5243[_0xdaeb('0x1f')](_0xdaeb('0x20'),_0x501f77+'-'+_0x22089c+'/'+_0x36f9ac)[_0xdaeb('0x1c')](_0x2d8f11);}return null;};}function patchUpdates(_0x236ccb){return function(_0xc274f8){try{jsonpatch['apply'](_0xc274f8,_0x236ccb,!![]);}catch(_0x597bb7){return BPromise[_0xdaeb('0x21')](_0x597bb7);}return _0xc274f8[_0xdaeb('0x22')]();};}function saveUpdates(_0x1c8af2,_0x1d919a){return function(_0x39dfae){if(_0x39dfae){return _0x39dfae['update'](_0x1c8af2)[_0xdaeb('0x23')](function(_0x4dc25f){return _0x4dc25f;});}return null;};}function removeEntity(_0x130c35,_0x398616){return function(_0x451101){if(_0x451101){return _0x451101[_0xdaeb('0x24')]()[_0xdaeb('0x23')](function(){_0x130c35['status'](0xcc)[_0xdaeb('0x25')]();});}};}function handleEntityNotFound(_0x34fa21,_0x338687){return function(_0x4eb719){if(!_0x4eb719){_0x34fa21['sendStatus'](0x194);}return _0x4eb719;};}function handleError(_0x43095f,_0x4e7f44){_0x4e7f44=_0x4e7f44||0x1f4;return function(_0x5045f8){logger[_0xdaeb('0x26')](_0x5045f8[_0xdaeb('0x27')]);if(_0x5045f8[_0xdaeb('0x28')]){delete _0x5045f8['name'];}_0x43095f['status'](_0x4e7f44)[_0xdaeb('0x29')](_0x5045f8);};}function getInteractionUsers(_0x440022,_0x37f468){return new BPromise(function(_0x596c19,_0x36c933){try{if(_0x37f468[_0x440022['id']]){_0x440022['Users']=_['map'](_0x37f468[_0x440022['id']],function(_0x28812c){return{'id':_0x28812c['id'],'fullname':_0x28812c[_0xdaeb('0x2a')]};});}}catch(_0x2fb019){_0x36c933(_0x2fb019);}_0x596c19(_0x440022);});}function getInteractionTags(_0x28c15c,_0x3276c2){return new BPromise(function(_0x2cbad2,_0x31baf1){try{if(_0x28c15c['TagIds']){_0x28c15c[_0xdaeb('0x2b')]=[];_0x28c15c[_0xdaeb('0x2c')][_0xdaeb('0x2d')](',')[_0xdaeb('0x2e')](function(_0x2c89ae){_0x28c15c['Tags'][_0xdaeb('0x2f')](_0x3276c2[_0x2c89ae]);});}delete _0x28c15c[_0xdaeb('0x2c')];}catch(_0x4a7abe){_0x31baf1(_0x4a7abe);}_0x2cbad2(_0x28c15c);});}function getLastMessageText(_0x2102fe){return new BPromise(function(_0x1464ac,_0x304abe){return db[_0xdaeb('0x30')][_0xdaeb('0x31')]({'where':{'id':_0x2102fe['id']},'attributes':[_0xdaeb('0x32'),_0xdaeb('0x33')],'raw':!![]})[_0xdaeb('0x23')](function(_0x2aed8e){if(!_0x2aed8e[_0xdaeb('0x33')]){_0x2102fe['lastMsgText']=_['trimStart'](htmlToText[_0xdaeb('0x34')](_0x2aed8e['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2102fe[_0xdaeb('0x33')]=_0x2aed8e[_0xdaeb('0x33')];}_0x1464ac(_0x2102fe);})[_0xdaeb('0x35')](function(_0x331624){_0x304abe(_0x331624);});});}function updateMailInteraction(_0x1917e9,_0xfa78c1,_0x5b2a73,_0x1f4dcb){return new BPromise(function(_0x2a2a42,_0xcc4e68){return getInteractionUsers(_0x1917e9,_0x5b2a73)['then'](function(_0xbc333f){return getInteractionTags(_0xbc333f,_0xfa78c1);})[_0xdaeb('0x23')](function(_0x30080b){if(_0x1f4dcb){_0x2a2a42(getLastMessageText(_0x30080b));}else{_0x2a2a42(_0x30080b);}})[_0xdaeb('0x35')](function(_0x62fd11){_0xcc4e68(_0x62fd11);});});}exports[_0xdaeb('0x36')]=function(_0x3c983d,_0x5a0252){var _0x3afd0c={},_0x170009={},_0x54e1ac={'count':0x0,'rows':[]};var _0x50c6db=_[_0xdaeb('0x37')](db[_0xdaeb('0x30')]['rawAttributes'],function(_0x1ba33c){return{'name':_0x1ba33c[_0xdaeb('0x38')],'type':_0x1ba33c['type'][_0xdaeb('0x39')]};});_0x170009[_0xdaeb('0x3a')]=_['map'](_0x50c6db,'name');_0x170009[_0xdaeb('0x3b')]=_[_0xdaeb('0x3c')](_0x3c983d[_0xdaeb('0x3b')]);_0x170009[_0xdaeb('0x3d')]=_[_0xdaeb('0x3e')](_0x170009[_0xdaeb('0x3a')],_0x170009['query']);_0x3afd0c[_0xdaeb('0x3f')]=_['intersection'](_0x170009[_0xdaeb('0x3a')],qs['fields'](_0x3c983d['query'][_0xdaeb('0x40')]));_0x3afd0c['attributes']=_0x3afd0c[_0xdaeb('0x3f')]['length']?_0x3afd0c[_0xdaeb('0x3f')]:_0x170009[_0xdaeb('0x3a')];if(!_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x41')]('nolimit')){_0x3afd0c[_0xdaeb('0x42')]=qs['limit'](_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x42')]);_0x3afd0c[_0xdaeb('0x1e')]=qs['offset'](_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x1e')]);}_0x3afd0c[_0xdaeb('0x43')]=qs[_0xdaeb('0x44')](_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x44')]);_0x3afd0c[_0xdaeb('0x45')]=qs[_0xdaeb('0x3d')](_[_0xdaeb('0x46')](_0x3c983d[_0xdaeb('0x3b')],_0x170009[_0xdaeb('0x3d')]),_0x50c6db);var _0x396588=[];var _0x5a2186=squel[_0xdaeb('0x47')]()[_0xdaeb('0x48')]('id')['field']('name')[_0xdaeb('0x48')](_0xdaeb('0x49'))[_0xdaeb('0x4a')]('tools_tags');var _0x220ed6=squel[_0xdaeb('0x47')]()[_0xdaeb('0x48')](_0xdaeb('0x4b'))[_0xdaeb('0x48')](_0xdaeb('0x4c'))[_0xdaeb('0x48')](_0xdaeb('0x4d'))['from'](_0xdaeb('0x4e'),'ui')[_0xdaeb('0x4f')]('users','u',_0xdaeb('0x50'));var _0x4dd70c=squel[_0xdaeb('0x47')]()[_0xdaeb('0x4a')](_0xdaeb('0x51'),'i')[_0xdaeb('0x4f')](_0xdaeb('0x52'),'c',_0xdaeb('0x53'))[_0xdaeb('0x4f')](_0xdaeb('0x54'),'o',_0xdaeb('0x55'))['left_join']('mail_accounts','a',_0xdaeb('0x56'))[_0xdaeb('0x4f')](_0xdaeb('0x57'),'me',_0xdaeb('0x58'))[_0xdaeb('0x4f')](_0xdaeb('0x59'),'it','it.MailInteractionId\x20=\x20i.id')[_0xdaeb('0x4f')](_0xdaeb('0x5a'),'t',_0xdaeb('0x5b'));var _0x589442=squel[_0xdaeb('0x5c')]();var _0x597584=[];var _0x3fe511=squel[_0xdaeb('0x5c')]();var _0x4696bf;if(_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x5d')]){_0x4696bf=as[_0xdaeb('0x5e')](_0x3c983d['query']['search']);var _0x4abd5e=_0x4696bf[_0xdaeb('0x5f')];for(var _0x10287e=0x0;_0x10287e<_0x4696bf['conditions']['length'];_0x10287e++){var _0x57f387=_0x4696bf[_0xdaeb('0x60')][_0x10287e];var _0x1dfc27='i';var _0x2846f7=_[_0xdaeb('0x61')](_0x50c6db,[_0xdaeb('0x28'),_0x57f387['field']]);if(!_0x2846f7){switch(_0x57f387[_0xdaeb('0x48')]){case'unreadMessages':if(_0x57f387[_0xdaeb('0x62')]==0x1){_0x4dd70c[_0xdaeb('0x63')]('`'+_0x57f387[_0xdaeb('0x48')]+_0xdaeb('0x64'));}else{_0x4dd70c[_0xdaeb('0x63')]('`'+_0x57f387[_0xdaeb('0x48')]+'`\x20>\x200');}break;case'Contact':if(_0x57f387[_0xdaeb('0x65')]==='$substring'){if(_0x57f387[_0xdaeb('0x62')][_0xdaeb('0x2d')]('\x20')[_0xdaeb('0x66')]>0x1){_0x589442[_0x4abd5e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xdaeb('0x67')](_0x57f387[_0xdaeb('0x62')]),null);}else{var _0x2432ef='%'+_0x57f387[_0xdaeb('0x62')]+'%';_0x589442[_0x4abd5e](_0xdaeb('0x68'),_0x2432ef,_0x2432ef,_0x2432ef);}}else{_0x2846f7=_[_0xdaeb('0x61')](_0x50c6db,[_0xdaeb('0x28'),_0xdaeb('0x69')]);_0x57f387[_0xdaeb('0x48')]='ContactId';_0x285815=as[_0xdaeb('0x6a')](_0x1dfc27,_0x2846f7[_0xdaeb('0x6b')],_0x57f387);_0x589442[_0x4abd5e](_0x285815[_0xdaeb('0x6c')],_0x285815[_0xdaeb('0x62')]['start'],_0x285815['value'][_0xdaeb('0x25')]);}break;case _0xdaeb('0x6d'):var _0x2fb187=_0x57f387[_0xdaeb('0x62')]['split'](',')[_0xdaeb('0x37')](function(_0x5e20b4){return Number(_0x5e20b4);});_0x2fb187[_0xdaeb('0x2e')](function(_0x4a0af5){_0x3fe511['or'](_0xdaeb('0x6e'),'%,'+_0x4a0af5+',%');});_0x597584=_['union'](_0x597584,_0x2fb187);break;case _0xdaeb('0x6f'):if(_0x57f387[_0xdaeb('0x65')]===_0xdaeb('0x70')){_0x589442[_0x4abd5e](_0xdaeb('0x71'),'%'+_0x57f387[_0xdaeb('0x62')]+'%',null);}else{_0x2846f7=_[_0xdaeb('0x61')](_0x50c6db,[_0xdaeb('0x28'),_0xdaeb('0x72')]);_0x57f387[_0xdaeb('0x48')]=_0xdaeb('0x72');_0x285815=as[_0xdaeb('0x6a')](_0x1dfc27,_0x2846f7[_0xdaeb('0x6b')],_0x57f387);_0x589442[_0x4abd5e](_0x285815['text'],_0x285815[_0xdaeb('0x62')][_0xdaeb('0x73')],_0x285815['value'][_0xdaeb('0x25')]);}break;case'plainBody':_0x285815=as[_0xdaeb('0x6a')]('me',null,_0x57f387);_0x589442[_0x4abd5e](_0x285815[_0xdaeb('0x6c')],_0x285815['value'][_0xdaeb('0x73')],_0x285815[_0xdaeb('0x62')][_0xdaeb('0x25')]);break;}}else{var _0x285815=as[_0xdaeb('0x6a')](_0x1dfc27,_0x2846f7[_0xdaeb('0x6b')],_0x57f387);_0x589442[_0x4abd5e](_0x285815['text'],_0x285815[_0xdaeb('0x62')][_0xdaeb('0x73')],_0x285815[_0xdaeb('0x62')][_0xdaeb('0x25')]);}}}else{var _0x41cf4c=_(_0x3c983d[_0xdaeb('0x3b')])[_0xdaeb('0x3c')]()['map'](function(_0x333954){return _[_0xdaeb('0x74')](_0x50c6db,[_0xdaeb('0x28'),_0x333954])?_0x333954:undefined;})[_0xdaeb('0x75')]()[_0xdaeb('0x62')]();if(!_['isEmpty'](_0x41cf4c)){_0x41cf4c[_0xdaeb('0x2e')](function(_0x4292d9){if(_0x4292d9===_0xdaeb('0x76')){_0x4dd70c[_0xdaeb('0x45')]('i.MailAccountId\x20IN\x20?',[][_0xdaeb('0x77')](_0x3c983d[_0xdaeb('0x3b')][_0x4292d9]));}else if(_0x4292d9===_0xdaeb('0x78')){var _0x578af3=JSON[_0xdaeb('0x79')](_0x3c983d[_0xdaeb('0x3b')][_0x4292d9])['$gte'];var _0x3ac0f0=JSON[_0xdaeb('0x79')](_0x3c983d[_0xdaeb('0x3b')][_0x4292d9])[_0xdaeb('0x7a')];_0x4dd70c['where'](_0xdaeb('0x7b'),_0x578af3,_0x3ac0f0);}else{if(_0x3c983d['query'][_0x4292d9]===_0xdaeb('0x7c')){_0x4dd70c[_0xdaeb('0x45')]('i.'+_0x4292d9+_0xdaeb('0x7d'));}else{_0x4dd70c[_0xdaeb('0x45')]('i.'+_0x4292d9+_0xdaeb('0x7e'),_0x3c983d[_0xdaeb('0x3b')][_0x4292d9]);}}});}if(_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x7f')]){if(_0x3c983d['query'][_0xdaeb('0x7f')]==0x1){_0x4dd70c[_0xdaeb('0x63')](_0xdaeb('0x80'));}else{_0x4dd70c[_0xdaeb('0x63')](_0xdaeb('0x81'));}}if(_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x82')]){_0x597584=_[_0xdaeb('0x83')](_0x3c983d['query']['tag'])?_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x82')]:new Array(_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x82')]);_0x597584[_0xdaeb('0x2e')](function(_0x3f3357){_0x3fe511['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3f3357+',%');});}if(_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x84')]){var _0x433667=_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x84')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xdaeb('0x85')](_0x433667)){_0x589442['or'](_0xdaeb('0x86'),_0x433667+'%');}else if(qs[_0xdaeb('0x87')](_0x433667)){_0x589442['or']('c.email\x20LIKE\x20?',_0x433667+'%');}else{_0x589442['or'](_0xdaeb('0x88'),qs[_0xdaeb('0x67')](_0x433667))['or'](_0xdaeb('0x89'),qs[_0xdaeb('0x67')](_0x433667));}}}_0x4dd70c[_0xdaeb('0x45')](_0x589442);_0x4dd70c[_0xdaeb('0x8a')]('i.id');var _0x1cb098={'type':db['Sequelize'][_0xdaeb('0x8b')][_0xdaeb('0x8c')],'raw':!![]};var _0x2f9672=_0x4dd70c[_0xdaeb('0x8d')]();_0x2f9672['field'](_0xdaeb('0x8e'));_0x2f9672[_0xdaeb('0x48')](_0xdaeb('0x8f'),'unreadMessages');if(_0x3afd0c[_0xdaeb('0x43')]){_0x3afd0c[_0xdaeb('0x43')][_0xdaeb('0x2e')](function(_0x128408){var _0x10c7d7=_0x128408[0x0]==='contactName'?_0x128408[0x0]:'i.'+_0x128408[0x0];_0x4dd70c['order'](_0x10c7d7,_0x128408[0x1]==='DESC'?![]:!![]);});}if(!_[_0xdaeb('0x90')](_0x597584)){_0x4dd70c['having'](_0x3fe511);_0x2f9672[_0xdaeb('0x45')](_0xdaeb('0x91'),_0x597584);}BPromise['resolve']()[_0xdaeb('0x23')](function(){if(!_0x4696bf){if(_0x3c983d['query'][_0xdaeb('0x76')])return;_0x2f9672[_0xdaeb('0x45')](_0xdaeb('0x92'));_0x4dd70c[_0xdaeb('0x45')](_0xdaeb('0x92'));return;}if(_0x3c983d[_0xdaeb('0x93')]['role']!==_0xdaeb('0x94'))return;return _0x3c983d[_0xdaeb('0x93')][_0xdaeb('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1d31f8){if(_[_0xdaeb('0x90')](_0x1d31f8)){_0x2f9672[_0xdaeb('0x45')]('i.MailAccountId\x20IS\x20NULL');_0x4dd70c[_0xdaeb('0x45')]('i.MailAccountId\x20IS\x20NULL');}else{_0x2f9672[_0xdaeb('0x45')](_0xdaeb('0x96'),_[_0xdaeb('0x37')](_0x1d31f8,'id'));_0x4dd70c[_0xdaeb('0x45')]('i.MailAccountId\x20IN\x20?',_['map'](_0x1d31f8,'id'));}});})[_0xdaeb('0x23')](function(){if(_0x3c983d[_0xdaeb('0x93')]['role']===_0xdaeb('0x94')&&!_0x4696bf&&!_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x76')])return[];return db[_0xdaeb('0x97')][_0xdaeb('0x3b')](_0x2f9672[_0xdaeb('0x98')](),_0x1cb098);})[_0xdaeb('0x23')](function(_0x146448){_0x54e1ac['count']=_0x146448[_0xdaeb('0x66')];if(_0x54e1ac[_0xdaeb('0x1d')]===0x0)return[];return db[_0xdaeb('0x97')][_0xdaeb('0x3b')](_0x5a2186[_0xdaeb('0x98')](),_0x1cb098)[_0xdaeb('0x23')](function(_0x915399){_0x396588=_['keyBy'](_0x915399,'id');_0x1cb098=_[_0xdaeb('0x99')](_0x1cb098,{'model':db[_0xdaeb('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c983d[_0xdaeb('0x3b')][_0xdaeb('0x40')]){_0x3afd0c[_0xdaeb('0x3f')][_0xdaeb('0x2e')](function(_0x4e7ef8){_0x4dd70c[_0xdaeb('0x48')]('i.'+_0x4e7ef8);});}else{_0x4dd70c[_0xdaeb('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0x9a'),_0xdaeb('0x9b'));_0x4dd70c['field'](_0xdaeb('0x9c'),_0xdaeb('0x9d'));_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0x9e'),_0xdaeb('0x9f'));_0x4dd70c['field'](_0xdaeb('0x8e'));_0x4dd70c[_0xdaeb('0x48')]('i.createdAt');_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xa0'));_0x4dd70c['field']('i.closed');_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xa1'));_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xa2'));_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xa3'));_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xa4'));_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xa5'));_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xa6'));_0x4dd70c['field'](_0xdaeb('0xa7'));_0x4dd70c[_0xdaeb('0x48')]('i.thirdDisposition');_0x4dd70c['field'](_0xdaeb('0xa8'));_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xa9'));_0x4dd70c[_0xdaeb('0x48')]('i.ContactId');_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xaa'));_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xab'));_0x4dd70c[_0xdaeb('0x48')]('c.firstName','Contact.firstName');_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xac'),_0xdaeb('0xad'));_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xae'),_0xdaeb('0xaf'));_0x4dd70c[_0xdaeb('0x48')]('c.phone','Contact.phone');_0x4dd70c['field'](_0xdaeb('0xb0'),'Contact.mobile');_0x4dd70c[_0xdaeb('0x48')]('c.fax','Contact.fax');_0x4dd70c[_0xdaeb('0x48')]('o.fullname',_0xdaeb('0xb1'));_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xb2'),_0xdaeb('0xb3'));_0x4dd70c[_0xdaeb('0x48')](_0xdaeb('0xb4'),_0xdaeb('0x2c'));}if(_0x3afd0c[_0xdaeb('0x42')])_0x4dd70c[_0xdaeb('0x42')](_0x3afd0c[_0xdaeb('0x42')]);if(_0x3afd0c[_0xdaeb('0x1e')])_0x4dd70c['offset'](_0x3afd0c[_0xdaeb('0x1e')]);return db['sequelize'][_0xdaeb('0x3b')](_0x4dd70c['toString'](),_0x1cb098);})['then'](function(_0x17d425){_0x220ed6[_0xdaeb('0x45')](_0xdaeb('0xb5'),_[_0xdaeb('0x37')](_0x17d425,'id'));return db[_0xdaeb('0x97')][_0xdaeb('0x3b')](_0x220ed6[_0xdaeb('0x98')](),_0x1cb098)[_0xdaeb('0x23')](function(_0x40c3c4){var _0x264bc6=_[_0xdaeb('0xb6')](_0x40c3c4,_0xdaeb('0xb7'));var _0x1b414d=[];return db[_0xdaeb('0xb8')][_0xdaeb('0x31')]({'attributes':[_0xdaeb('0xb9')],'raw':!![]})[_0xdaeb('0x23')](function(_0x1f8666){var _0x5b8773=_0x1f8666[_0xdaeb('0xb9')];_0x17d425[_0xdaeb('0x2e')](function(_0x50232a){_0x1b414d['push'](updateMailInteraction(_0x50232a,_0x396588,_0x264bc6,_0x5b8773));});return BPromise[_0xdaeb('0xba')](_0x1b414d);});});});})['then'](function(_0xa7fbd9){_0x54e1ac['rows']=_0xa7fbd9;return _0x54e1ac;})[_0xdaeb('0x23')](respondWithFilteredResult(_0x5a0252,_0x3afd0c))[_0xdaeb('0x35')](handleError(_0x5a0252,null));};exports['show']=function(_0x450e95,_0x4ce598){var _0x3e14f8={'raw':![],'where':{'id':_0x450e95[_0xdaeb('0xbb')]['id']}},_0x536eb0={};_0x536eb0['model']=_[_0xdaeb('0x3c')](db[_0xdaeb('0x30')][_0xdaeb('0xbc')]);_0x536eb0['query']=_[_0xdaeb('0x3c')](_0x450e95['query']);_0x536eb0[_0xdaeb('0x3d')]=_[_0xdaeb('0x3e')](_0x536eb0[_0xdaeb('0x3a')],_0x536eb0[_0xdaeb('0x3b')]);_0x3e14f8[_0xdaeb('0x3f')]=_['intersection'](_0x536eb0[_0xdaeb('0x3a')],qs[_0xdaeb('0x40')](_0x450e95[_0xdaeb('0x3b')]['fields']));_0x3e14f8['attributes']=_0x3e14f8[_0xdaeb('0x3f')][_0xdaeb('0x66')]?_0x3e14f8[_0xdaeb('0x3f')]:_0x536eb0['model'];if(_0x450e95[_0xdaeb('0x3b')]['includeAll']){_0x3e14f8[_0xdaeb('0xbd')]=[{'all':!![]}];}_0x3e14f8=_[_0xdaeb('0x99')]({},_0x3e14f8,_0x450e95[_0xdaeb('0xbe')]);return db[_0xdaeb('0x30')][_0xdaeb('0x61')](_0x3e14f8)[_0xdaeb('0x23')](handleEntityNotFound(_0x4ce598,null))['then'](respondWithResult(_0x4ce598,null))[_0xdaeb('0x35')](handleError(_0x4ce598,null));};exports[_0xdaeb('0xbf')]=function(_0x5c7612,_0x289dcb){return db[_0xdaeb('0x30')][_0xdaeb('0xbf')](_0x5c7612['body'],{})[_0xdaeb('0x23')](respondWithResult(_0x289dcb,0xc9))['catch'](handleError(_0x289dcb,null));};exports[_0xdaeb('0xc0')]=function(_0x12113f,_0x19dac9){if(_0x12113f['body']['id']){delete _0x12113f[_0xdaeb('0xc1')]['id'];}return db[_0xdaeb('0x30')][_0xdaeb('0x61')]({'where':{'id':_0x12113f[_0xdaeb('0xbb')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x19dac9,null))[_0xdaeb('0x23')](saveUpdates(_0x12113f[_0xdaeb('0xc1')],null))['then'](respondWithResult(_0x19dac9,null))[_0xdaeb('0x35')](handleError(_0x19dac9,null));};exports['destroy']=function(_0x1db8fa,_0x3e5de7){return db[_0xdaeb('0x30')][_0xdaeb('0x61')]({'where':{'id':_0x1db8fa[_0xdaeb('0xbb')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x3e5de7,null))['then'](removeEntity(_0x3e5de7,null))['catch'](handleError(_0x3e5de7,null));};exports['describe']=function(_0x4146f6,_0x43e9ba){return db[_0xdaeb('0x30')][_0xdaeb('0xc2')]()[_0xdaeb('0x23')](respondWithResult(_0x43e9ba,null))[_0xdaeb('0x35')](handleError(_0x43e9ba,null));};exports[_0xdaeb('0xc3')]=function(_0x3cf389,_0x1b0c40,_0x4f5d62){return db[_0xdaeb('0xc4')][_0xdaeb('0x61')]({'where':{'id':_0x3cf389['params']['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x1b0c40,null))[_0xdaeb('0x23')](function(_0x2dc58b){if(_0x2dc58b){return _0x2dc58b['addMessage'](_0x3cf389['body'][_0xdaeb('0xc5')],_['omit'](_0x3cf389[_0xdaeb('0xc1')],['ids','id'])||{});}})[_0xdaeb('0x23')](respondWithResult(_0x1b0c40,null))[_0xdaeb('0x35')](handleError(_0x1b0c40,null));};exports[_0xdaeb('0xc6')]=function(_0x3ad101,_0x375278,_0x49b16c){var _0x1581b7={'raw':![],'where':{}};var _0x136500={};var _0x5b7f98={'count':0x0,'rows':[]};return db['MailInteraction'][_0xdaeb('0x31')]({'where':{'id':_0x3ad101[_0xdaeb('0xbb')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x375278,null))['then'](function(_0x418914){if(_0x418914){_0x136500['model']=_[_0xdaeb('0x3c')](db[_0xdaeb('0xc4')]['rawAttributes']);_0x136500[_0xdaeb('0x3b')]=_[_0xdaeb('0x3c')](_0x3ad101[_0xdaeb('0x3b')]);_0x136500[_0xdaeb('0x3d')]=_[_0xdaeb('0x3e')](_0x136500[_0xdaeb('0x3a')],_0x136500[_0xdaeb('0x3b')]);_0x1581b7[_0xdaeb('0x3f')]=_[_0xdaeb('0x3e')](_0x136500[_0xdaeb('0x3a')],qs[_0xdaeb('0x40')](_0x3ad101[_0xdaeb('0x3b')]['fields']));_0x1581b7[_0xdaeb('0x3f')]=_0x1581b7[_0xdaeb('0x3f')][_0xdaeb('0x66')]?_0x1581b7[_0xdaeb('0x3f')]:_0x136500[_0xdaeb('0x3a')];if(!_0x3ad101[_0xdaeb('0x3b')][_0xdaeb('0x41')](_0xdaeb('0xc7'))){_0x1581b7[_0xdaeb('0x42')]=qs['limit'](_0x3ad101[_0xdaeb('0x3b')]['limit']);_0x1581b7[_0xdaeb('0x1e')]=qs[_0xdaeb('0x1e')](_0x3ad101[_0xdaeb('0x3b')]['offset']);}_0x1581b7[_0xdaeb('0x43')]=qs[_0xdaeb('0x44')](_0x3ad101[_0xdaeb('0x3b')][_0xdaeb('0x44')]);_0x1581b7[_0xdaeb('0x45')]=qs[_0xdaeb('0x3d')](_[_0xdaeb('0x46')](_0x3ad101[_0xdaeb('0x3b')],_0x136500['filters']));_0x1581b7['where']['MailInteractionId']=_0x418914['id'];if(_0x3ad101['query']['filter']){_0x1581b7[_0xdaeb('0x45')]=_['merge'](_0x1581b7['where'],{'$or':_[_0xdaeb('0x37')](_0x1581b7[_0xdaeb('0x3f')],function(_0x119448){var _0x39790f={};_0x39790f[_0x119448]={'$like':'%'+_0x3ad101[_0xdaeb('0x3b')][_0xdaeb('0x84')]+'%'};return _0x39790f;})});}if(_0x3ad101[_0xdaeb('0x3b')][_0xdaeb('0xc8')]){var _0x6b8282=_0x3ad101[_0xdaeb('0x3b')]['$gte'][_0xdaeb('0x2d')](',');var _0x59775a={};_0x59775a[_0x6b8282[0x0]]={'$gte':moment(_0x6b8282[0x1])['format'](_0xdaeb('0xc9'))};_0x1581b7[_0xdaeb('0x45')]=_['merge'](_0x1581b7[_0xdaeb('0x45')],_0x59775a);}_0x1581b7=_['merge']({},_0x1581b7,_0x3ad101['options']);return db[_0xdaeb('0xc4')][_0xdaeb('0x1d')]({'where':_0x1581b7[_0xdaeb('0x45')]})[_0xdaeb('0x23')](function(_0x16bfe6){_0x5b7f98[_0xdaeb('0x1d')]=_0x16bfe6;if(_0x3ad101[_0xdaeb('0x3b')][_0xdaeb('0xca')]){_0x1581b7[_0xdaeb('0xbd')]=[{'all':!![]}];}return db[_0xdaeb('0xc4')][_0xdaeb('0xcb')](_0x1581b7);})[_0xdaeb('0x23')](function(_0x4525b0){if(_0x3ad101['query'][_0xdaeb('0xcc')]===_0xdaeb('0xcd')){for(var _0x2a0c54=0x0;_0x2a0c54<_0x4525b0['length'];_0x2a0c54++){_0x4525b0[_0x2a0c54][_0xdaeb('0xc1')]=juice(_0x4525b0[_0x2a0c54]['body']);}}_0x5b7f98[_0xdaeb('0xce')]=_0x4525b0;return _0x5b7f98;});}})['then'](respondWithFilteredResult(_0x375278,_0x1581b7))[_0xdaeb('0x35')](handleError(_0x375278,null));};exports[_0xdaeb('0xcf')]=function(_0x7633fc,_0x5402f4,_0x5885c9){return db[_0xdaeb('0x30')]['find']({'where':{'id':_0x7633fc[_0xdaeb('0xbb')]['id']}})['then'](handleEntityNotFound(_0x5402f4,null))['then'](function(_0x4285f3){if(_0x4285f3){return _0x4285f3[_0xdaeb('0xd0')](_0x7633fc[_0xdaeb('0xc1')][_0xdaeb('0xc5')],_['omit'](_0x7633fc[_0xdaeb('0xc1')],[_0xdaeb('0xc5'),'id'])||{})[_0xdaeb('0xd1')](function(){return db['Tag'][_0xdaeb('0xcb')]({'attributes':['id',_0xdaeb('0x28'),_0xdaeb('0x49')],'where':{'id':_0x7633fc[_0xdaeb('0xc1')]['ids']}});})[_0xdaeb('0x23')](function(_0x1b4a6a){socket[_0xdaeb('0xd2')](_0xdaeb('0xd3'),{'id':Number(_0x7633fc['params']['id']),'tags':_0x1b4a6a||[]});return{'id':Number(_0x7633fc[_0xdaeb('0xbb')]['id']),'tags':_0x1b4a6a||[]};});}})[_0xdaeb('0x23')](respondWithResult(_0x5402f4,null))[_0xdaeb('0x35')](handleError(_0x5402f4,null));};exports[_0xdaeb('0xd4')]=function(_0x48ac5d,_0x4ae6d2,_0x36ab63){return db['MailInteraction'][_0xdaeb('0x61')]({'where':{'id':_0x48ac5d[_0xdaeb('0xbb')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x4ae6d2,null))[_0xdaeb('0x23')](function(_0x4b5c5d){if(_0x4b5c5d){return _0x4b5c5d[_0xdaeb('0xd4')](_0x48ac5d[_0xdaeb('0x3b')][_0xdaeb('0xc5')]);}})[_0xdaeb('0x23')](respondWithStatusCode(_0x4ae6d2,null))[_0xdaeb('0x35')](handleError(_0x4ae6d2,null));};exports[_0xdaeb('0xd5')]=function(_0x3122ba,_0x320e4b){var _0x30da34=moment()[_0xdaeb('0xd6')]()[_0xdaeb('0x98')]();var _0x4e2c53=path['join'](config['root'],_0xdaeb('0xd7'),_0xdaeb('0xd8'),_0xdaeb('0xd9'));var _0x56eb1a=path[_0xdaeb('0xda')](config[_0xdaeb('0xdb')],_0xdaeb('0xd7'),_0xdaeb('0xd8'),_0xdaeb('0xdc'));var _0x42c98a=path['join'](_0x4e2c53,_0x30da34);var _0x461abb=util[_0xdaeb('0xdd')](_0xdaeb('0xde'),_0x3122ba[_0xdaeb('0xbb')]['id'],_0x30da34);var _0x3c7633=path[_0xdaeb('0xda')](_0x4e2c53,_0x461abb);var _0x49689c=[];if(_0x3122ba['query']['attachments']){_0x49689c[_0xdaeb('0x2f')]({'model':db[_0xdaeb('0xdf')],'as':_0xdaeb('0xe0'),'raw':!![]});}var _0x5a770d=[{'model':db[_0xdaeb('0xc4')],'as':_0xdaeb('0xe1'),'attributes':['id','body',_0xdaeb('0x4a'),'to','cc',_0xdaeb('0xe2'),'subject',_0xdaeb('0x78')],'where':{'secret':![]},'order':qs[_0xdaeb('0x44')]('id'),'include':_0x49689c}];return db[_0xdaeb('0x30')][_0xdaeb('0x61')]({'where':{'id':_0x3122ba[_0xdaeb('0xbb')]['id']},'include':_0x5a770d})[_0xdaeb('0x23')](handleEntityNotFound(_0x320e4b,null))[_0xdaeb('0x23')](function(_0x12b1f0){if(_0x12b1f0&&_0x12b1f0['Messages']){var _0xcb13cf=_0x12b1f0[_0xdaeb('0xe3')]({'plain':!![]});fs[_0xdaeb('0xe4')](_0x42c98a);return BPromise['each'](_0xcb13cf[_0xdaeb('0xe1')],function(_0x3aa60b,_0xf97310){var _0x106a36={'from':_0x3aa60b[_0xdaeb('0x4a')],'to':_0x3aa60b['to'],'subject':_0x3aa60b[_0xdaeb('0xe5')],'html':_0x3aa60b[_0xdaeb('0xc1')],'headers':{'Date':moment(_0x3aa60b['createdAt'])['format'](_0xdaeb('0xe6'))},'attachments':[]};if(_0x3aa60b['cc']){_0x106a36[_0xdaeb('0xe7')]['Cc']=_0x3aa60b['cc'];}if(_0x3aa60b[_0xdaeb('0xe2')]){_0x106a36[_0xdaeb('0xe7')][_0xdaeb('0xe8')]=_0x3aa60b[_0xdaeb('0xe2')];}return new BPromise(function(_0x490d1b,_0x483dc0){if(_0x3aa60b['Attachments']){for(var _0x54a4c1=0x0;_0x54a4c1<_0x3aa60b[_0xdaeb('0xe0')]['length'];_0x54a4c1++){var _0x1cab51=_0x3aa60b[_0xdaeb('0xe0')][_0x54a4c1];var _0x246e24=path[_0xdaeb('0xda')](_0x56eb1a,_0x1cab51['basename']);if(fs[_0xdaeb('0xe9')](_0x246e24)){_0x106a36[_0xdaeb('0xdc')][_0xdaeb('0x2f')]({'name':_0x1cab51[_0xdaeb('0x28')],'contentType':_0x1cab51[_0xdaeb('0x6b')],'data':fs['readFileSync'](_0x246e24)});}}}emlformat[_0xdaeb('0xea')](_0x106a36,function(_0x9d2447,_0x3af3e1){if(_0x9d2447)return _0x483dc0(_0x9d2447);fs[_0xdaeb('0xeb')](path['join'](_0x42c98a,util[_0xdaeb('0xdd')]('message%d.eml',_0xf97310)),_0x3af3e1);return _0x490d1b(_0x3af3e1);});});})['then'](function(){return new BPromise(function(_0x2b1d26,_0xda3a09){zipdir(_0x42c98a,{'saveTo':_0x3c7633},function(_0x4d3048,_0x30f1f1){if(_0x4d3048)return _0xda3a09(_0x4d3048);return _0x2b1d26(_0x30f1f1);});})[_0xdaeb('0x23')](function(){return new BPromise(function(_0x4604e1,_0x13c1bb){rimraf(_0x42c98a,function(_0x150ede){if(_0x150ede)_0x13c1bb(_0x150ede);return _0x4604e1();});});})['then'](function(){return _0x320e4b[_0xdaeb('0xd5')](_0x3c7633,_0x461abb,function(_0x2839c7){if(_0x2839c7){console[_0xdaeb('0xec')](_0xdaeb('0xed'),_0x2839c7);}else{fs[_0xdaeb('0xee')](_0x3c7633);}});});});}else{return _0x320e4b[_0xdaeb('0x1a')](0xc8);}})[_0xdaeb('0x35')](handleError(_0x320e4b,null));}; \ No newline at end of file +var _0xe511=['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','ContactId','buildExpression','text','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','user','role','agent','getMailAccounts','isEmpty','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','MailAccountId','count','sequelize','toString','keyBy','merge','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','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','all','catch','params','includeAll','include','options','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','nolimit','pick','MailInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','headers','Bcc','bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','log','err','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','reject','save','update','then','destroy','stack','name','fullname','TagIds','Tags','split','forEach','push','findOne','lastMsgBody','lastMsgText','index','map','MailInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','it.MailInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages'];(function(_0x493258,_0x3df458){var _0x2b128d=function(_0x385ee2){while(--_0x385ee2){_0x493258['push'](_0x493258['shift']());}};_0x2b128d(++_0x3df458);}(_0xe511,0x16f));var _0x1e51=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0xe511[_0x172133];return _0x2460e5;};'use strict';var pdf=require(_0x1e51('0x0'));var emlformat=require(_0x1e51('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e51('0x3'));var moment=require(_0x1e51('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1e51('0x5'));var util=require(_0x1e51('0x6'));var path=require(_0x1e51('0x7'));var sox=require(_0x1e51('0x8'));var csv=require('to-csv');var ejs=require(_0x1e51('0x9'));var fs=require('fs');var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var htmlToText=require(_0x1e51('0xe'));var juice=require(_0x1e51('0xf'));var Redis=require(_0x1e51('0x10'));var authService=require(_0x1e51('0x11'));var qs=require(_0x1e51('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e51('0x13'));var logger=require(_0x1e51('0x14'))(_0x1e51('0x15'));var utils=require(_0x1e51('0x16'));var config=require(_0x1e51('0x17'));var licenseUtil=require(_0x1e51('0x18'));var db=require('../../mysqldb')['db'];config[_0x1e51('0x19')]=_[_0x1e51('0x1a')](config[_0x1e51('0x19')],{'host':_0x1e51('0x1b'),'port':0x18eb});var socket=require(_0x1e51('0x1c'))(new Redis(config[_0x1e51('0x19')]));require(_0x1e51('0x1d'))[_0x1e51('0x1e')](socket);function respondWithStatusCode(_0x1cc62a,_0xd76fba){_0xd76fba=_0xd76fba||0xcc;return function(_0x5a5c07){if(_0x5a5c07){return _0x1cc62a[_0x1e51('0x1f')](_0xd76fba);}return _0x1cc62a[_0x1e51('0x20')](_0xd76fba)[_0x1e51('0x21')]();};}function respondWithResult(_0x5857e2,_0xa3b410){_0xa3b410=_0xa3b410||0xc8;return function(_0x4f7aaf){if(_0x4f7aaf){return _0x5857e2['status'](_0xa3b410)[_0x1e51('0x22')](_0x4f7aaf);}};}function respondWithFilteredResult(_0x27dcad,_0x40ae4c){return function(_0x4785a5){if(_0x4785a5){var _0x4d1aae=_0x4785a5['count'],_0x3e4234=_0x40ae4c[_0x1e51('0x23')],_0x4ef18a=_0x40ae4c[_0x1e51('0x23')]+_0x40ae4c[_0x1e51('0x24')],_0x39449b;if(_0x4ef18a>=_0x4d1aae){_0x4ef18a=_0x4d1aae;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0x27dcad[_0x1e51('0x20')](_0x39449b);return _0x27dcad['set']('Content-Range',_0x3e4234+'-'+_0x4ef18a+'/'+_0x4d1aae)['json'](_0x4785a5);}return null;};}function patchUpdates(_0x548c32){return function(_0x1aec4f){try{jsonpatch['apply'](_0x1aec4f,_0x548c32,!![]);}catch(_0x3f7340){return BPromise[_0x1e51('0x25')](_0x3f7340);}return _0x1aec4f[_0x1e51('0x26')]();};}function saveUpdates(_0x13240f,_0x23c85a){return function(_0xf9298){if(_0xf9298){return _0xf9298[_0x1e51('0x27')](_0x13240f)[_0x1e51('0x28')](function(_0x4bcdd3){return _0x4bcdd3;});}return null;};}function removeEntity(_0x4d04c0,_0x43f5c5){return function(_0xdf6c02){if(_0xdf6c02){return _0xdf6c02[_0x1e51('0x29')]()[_0x1e51('0x28')](function(){_0x4d04c0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x486ad6,_0x1eb83f){return function(_0x2a1561){if(!_0x2a1561){_0x486ad6[_0x1e51('0x1f')](0x194);}return _0x2a1561;};}function handleError(_0x5412bc,_0x1e7a96){_0x1e7a96=_0x1e7a96||0x1f4;return function(_0x49c507){logger['error'](_0x49c507[_0x1e51('0x2a')]);if(_0x49c507['name']){delete _0x49c507[_0x1e51('0x2b')];}_0x5412bc[_0x1e51('0x20')](_0x1e7a96)['send'](_0x49c507);};}function getInteractionUsers(_0x3e6ef2,_0x10ee23){return new BPromise(function(_0x71c7af,_0x6862d1){try{if(_0x10ee23[_0x3e6ef2['id']]){_0x3e6ef2['Users']=_['map'](_0x10ee23[_0x3e6ef2['id']],function(_0x4f67d3){return{'id':_0x4f67d3['id'],'fullname':_0x4f67d3[_0x1e51('0x2c')]};});}}catch(_0x288b50){_0x6862d1(_0x288b50);}_0x71c7af(_0x3e6ef2);});}function getInteractionTags(_0x1ba84a,_0x36dabe){return new BPromise(function(_0x368609,_0x27d9a2){try{if(_0x1ba84a[_0x1e51('0x2d')]){_0x1ba84a[_0x1e51('0x2e')]=[];_0x1ba84a[_0x1e51('0x2d')][_0x1e51('0x2f')](',')[_0x1e51('0x30')](function(_0x54c84e){_0x1ba84a[_0x1e51('0x2e')][_0x1e51('0x31')](_0x36dabe[_0x54c84e]);});}delete _0x1ba84a[_0x1e51('0x2d')];}catch(_0x12da89){_0x27d9a2(_0x12da89);}_0x368609(_0x1ba84a);});}function getLastMessageText(_0xcf6b2){return new BPromise(function(_0x5e4869,_0x2a54b1){return db['MailInteraction'][_0x1e51('0x32')]({'where':{'id':_0xcf6b2['id']},'attributes':[_0x1e51('0x33'),_0x1e51('0x34')],'raw':!![]})['then'](function(_0x3e3742){if(!_0x3e3742['lastMsgText']){_0xcf6b2[_0x1e51('0x34')]=_['trimStart'](htmlToText['fromString'](_0x3e3742[_0x1e51('0x33')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0xcf6b2[_0x1e51('0x34')]=_0x3e3742[_0x1e51('0x34')];}_0x5e4869(_0xcf6b2);})['catch'](function(_0x42ac30){_0x2a54b1(_0x42ac30);});});}function updateMailInteraction(_0x5ad306,_0x3797a6,_0x2df269,_0x5760ba){return new BPromise(function(_0xd4fd91,_0x1bab7f){return getInteractionUsers(_0x5ad306,_0x2df269)[_0x1e51('0x28')](function(_0xeeff34){return getInteractionTags(_0xeeff34,_0x3797a6);})[_0x1e51('0x28')](function(_0x1e08ed){if(_0x5760ba){_0xd4fd91(getLastMessageText(_0x1e08ed));}else{_0xd4fd91(_0x1e08ed);}})['catch'](function(_0x509f7d){_0x1bab7f(_0x509f7d);});});}exports[_0x1e51('0x35')]=function(_0x58cbbe,_0x3c6c35){var _0x152e34={},_0x32c41b={},_0xcfa1d8={'count':0x0,'rows':[]};var _0x1ce020=_[_0x1e51('0x36')](db[_0x1e51('0x37')][_0x1e51('0x38')],function(_0xe54828){return{'name':_0xe54828[_0x1e51('0x39')],'type':_0xe54828[_0x1e51('0x3a')]['key']};});_0x32c41b[_0x1e51('0x3b')]=_['map'](_0x1ce020,_0x1e51('0x2b'));_0x32c41b[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x58cbbe[_0x1e51('0x3c')]);_0x32c41b[_0x1e51('0x3e')]=_[_0x1e51('0x3f')](_0x32c41b[_0x1e51('0x3b')],_0x32c41b[_0x1e51('0x3c')]);_0x152e34[_0x1e51('0x40')]=_[_0x1e51('0x3f')](_0x32c41b[_0x1e51('0x3b')],qs['fields'](_0x58cbbe['query'][_0x1e51('0x41')]));_0x152e34[_0x1e51('0x40')]=_0x152e34[_0x1e51('0x40')][_0x1e51('0x42')]?_0x152e34[_0x1e51('0x40')]:_0x32c41b[_0x1e51('0x3b')];if(!_0x58cbbe[_0x1e51('0x3c')][_0x1e51('0x43')]('nolimit')){_0x152e34[_0x1e51('0x24')]=qs[_0x1e51('0x24')](_0x58cbbe[_0x1e51('0x3c')][_0x1e51('0x24')]);_0x152e34[_0x1e51('0x23')]=qs[_0x1e51('0x23')](_0x58cbbe[_0x1e51('0x3c')]['offset']);}_0x152e34[_0x1e51('0x44')]=qs[_0x1e51('0x45')](_0x58cbbe['query'][_0x1e51('0x45')]);_0x152e34[_0x1e51('0x46')]=qs[_0x1e51('0x3e')](_['pick'](_0x58cbbe[_0x1e51('0x3c')],_0x32c41b[_0x1e51('0x3e')]),_0x1ce020);var _0x21d61e=[];var _0x3ad909=squel[_0x1e51('0x47')]()[_0x1e51('0x48')]('id')[_0x1e51('0x48')](_0x1e51('0x2b'))[_0x1e51('0x48')]('color')[_0x1e51('0x49')](_0x1e51('0x4a'));var _0x4b5fa7=squel[_0x1e51('0x47')]()[_0x1e51('0x48')](_0x1e51('0x4b'))['field'](_0x1e51('0x4c'))[_0x1e51('0x48')](_0x1e51('0x4d'))['from'](_0x1e51('0x4e'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x169e6c=squel[_0x1e51('0x47')]()['from']('mail_interactions','i')[_0x1e51('0x4f')](_0x1e51('0x50'),'c',_0x1e51('0x51'))[_0x1e51('0x4f')](_0x1e51('0x52'),'o',_0x1e51('0x53'))['left_join'](_0x1e51('0x54'),'a','a.id\x20=\x20i.MailAccountId')[_0x1e51('0x4f')](_0x1e51('0x55'),'me','me.MailInteractionId\x20=\x20i.id')['left_join']('mail_interaction_has_tags','it',_0x1e51('0x56'))[_0x1e51('0x4f')](_0x1e51('0x4a'),'t','t.id\x20=\x20it.TagId');var _0x2fdee1=squel[_0x1e51('0x57')]();var _0x4226da=[];var _0x2100d4=squel[_0x1e51('0x57')]();var _0x12584c;if(_0x58cbbe[_0x1e51('0x3c')][_0x1e51('0x58')]){_0x12584c=as['parseSearch'](_0x58cbbe[_0x1e51('0x3c')][_0x1e51('0x58')]);var _0xeb77ad=_0x12584c[_0x1e51('0x59')];for(var _0x177b63=0x0;_0x177b63<_0x12584c[_0x1e51('0x5a')]['length'];_0x177b63++){var _0x23ccb5=_0x12584c['conditions'][_0x177b63];var _0x56a276='i';var _0x4807b9=_[_0x1e51('0x5b')](_0x1ce020,[_0x1e51('0x2b'),_0x23ccb5[_0x1e51('0x48')]]);if(!_0x4807b9){switch(_0x23ccb5['field']){case _0x1e51('0x5c'):if(_0x23ccb5[_0x1e51('0x5d')]==0x1){_0x169e6c[_0x1e51('0x5e')]('`'+_0x23ccb5['field']+_0x1e51('0x5f'));}else{_0x169e6c[_0x1e51('0x5e')]('`'+_0x23ccb5[_0x1e51('0x48')]+'`\x20>\x200');}break;case _0x1e51('0x60'):if(_0x23ccb5[_0x1e51('0x61')]===_0x1e51('0x62')){if(_0x23ccb5[_0x1e51('0x5d')][_0x1e51('0x2f')]('\x20')[_0x1e51('0x42')]>0x1){_0x2fdee1[_0xeb77ad](_0x1e51('0x63'),qs[_0x1e51('0x64')](_0x23ccb5['value']),null);}else{var _0xd21d08='%'+_0x23ccb5[_0x1e51('0x5d')]+'%';_0x2fdee1[_0xeb77ad]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xd21d08,_0xd21d08,_0xd21d08);}}else{_0x4807b9=_['find'](_0x1ce020,['name',_0x1e51('0x65')]);_0x23ccb5[_0x1e51('0x48')]=_0x1e51('0x65');_0x5db283=as[_0x1e51('0x66')](_0x56a276,_0x4807b9[_0x1e51('0x3a')],_0x23ccb5);_0x2fdee1[_0xeb77ad](_0x5db283[_0x1e51('0x67')],_0x5db283[_0x1e51('0x5d')][_0x1e51('0x68')],_0x5db283[_0x1e51('0x5d')]['end']);}break;case'Tag':var _0x512a43=_0x23ccb5[_0x1e51('0x5d')][_0x1e51('0x2f')](',')['map'](function(_0x4e1fa8){return Number(_0x4e1fa8);});_0x512a43[_0x1e51('0x30')](function(_0x114657){_0x2100d4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x114657+',%');});_0x4226da=_[_0x1e51('0x69')](_0x4226da,_0x512a43);break;case _0x1e51('0x6a'):if(_0x23ccb5[_0x1e51('0x61')]===_0x1e51('0x62')){_0x2fdee1[_0xeb77ad](_0x1e51('0x6b'),'%'+_0x23ccb5[_0x1e51('0x5d')]+'%',null);}else{_0x4807b9=_[_0x1e51('0x5b')](_0x1ce020,[_0x1e51('0x2b'),_0x1e51('0x6c')]);_0x23ccb5[_0x1e51('0x48')]='UserId';_0x5db283=as[_0x1e51('0x66')](_0x56a276,_0x4807b9[_0x1e51('0x3a')],_0x23ccb5);_0x2fdee1[_0xeb77ad](_0x5db283[_0x1e51('0x67')],_0x5db283[_0x1e51('0x5d')][_0x1e51('0x68')],_0x5db283[_0x1e51('0x5d')]['end']);}break;case'plainBody':_0x5db283=as[_0x1e51('0x66')]('me',null,_0x23ccb5);_0x2fdee1[_0xeb77ad](_0x5db283[_0x1e51('0x67')],_0x5db283[_0x1e51('0x5d')][_0x1e51('0x68')],_0x5db283['value']['end']);break;}}else{var _0x5db283=as[_0x1e51('0x66')](_0x56a276,_0x4807b9[_0x1e51('0x3a')],_0x23ccb5);_0x2fdee1[_0xeb77ad](_0x5db283[_0x1e51('0x67')],_0x5db283[_0x1e51('0x5d')][_0x1e51('0x68')],_0x5db283['value'][_0x1e51('0x21')]);}}}else{var _0x3f9cea=_(_0x58cbbe[_0x1e51('0x3c')])['keys']()[_0x1e51('0x36')](function(_0x77f0c1){return _[_0x1e51('0x6d')](_0x1ce020,['name',_0x77f0c1])?_0x77f0c1:undefined;})[_0x1e51('0x6e')]()[_0x1e51('0x5d')]();if(!_['isEmpty'](_0x3f9cea)){_0x3f9cea['forEach'](function(_0x40d5e8){if(_0x40d5e8==='MailAccountId'){_0x169e6c[_0x1e51('0x46')]('i.MailAccountId\x20IN\x20?',[][_0x1e51('0x6f')](_0x58cbbe[_0x1e51('0x3c')][_0x40d5e8]));}else if(_0x40d5e8===_0x1e51('0x70')){var _0x457e4a=JSON['parse'](_0x58cbbe[_0x1e51('0x3c')][_0x40d5e8])['$gte'];var _0x5eaa16=JSON[_0x1e51('0x71')](_0x58cbbe[_0x1e51('0x3c')][_0x40d5e8])[_0x1e51('0x72')];_0x169e6c['where'](_0x1e51('0x73'),_0x457e4a,_0x5eaa16);}else{if(_0x58cbbe[_0x1e51('0x3c')][_0x40d5e8]===_0x1e51('0x74')){_0x169e6c[_0x1e51('0x46')]('i.'+_0x40d5e8+'\x20IS\x20NULL');}else{_0x169e6c[_0x1e51('0x46')]('i.'+_0x40d5e8+'\x20=\x20?',_0x58cbbe['query'][_0x40d5e8]);}}});}if(_0x58cbbe[_0x1e51('0x3c')]['read']){if(_0x58cbbe[_0x1e51('0x3c')]['read']==0x1){_0x169e6c[_0x1e51('0x5e')]('`unreadMessages`\x20=\x200');}else{_0x169e6c[_0x1e51('0x5e')](_0x1e51('0x75'));}}if(_0x58cbbe['query'][_0x1e51('0x76')]){_0x4226da=_['isArray'](_0x58cbbe[_0x1e51('0x3c')][_0x1e51('0x76')])?_0x58cbbe[_0x1e51('0x3c')][_0x1e51('0x76')]:new Array(_0x58cbbe[_0x1e51('0x3c')][_0x1e51('0x76')]);_0x4226da['forEach'](function(_0x23cce4){_0x2100d4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x23cce4+',%');});}if(_0x58cbbe['query'][_0x1e51('0x77')]){var _0x2f3e2f=_0x58cbbe[_0x1e51('0x3c')][_0x1e51('0x77')][_0x1e51('0x78')]('\x5c','\x5c\x5c')[_0x1e51('0x78')](/'/g,'\x27\x27');if(qs[_0x1e51('0x79')](_0x2f3e2f)){_0x2fdee1['or']('i.id\x20LIKE\x20?',_0x2f3e2f+'%');}else if(qs[_0x1e51('0x7a')](_0x2f3e2f)){_0x2fdee1['or'](_0x1e51('0x7b'),_0x2f3e2f+'%');}else{_0x2fdee1['or'](_0x1e51('0x7c'),qs['getFullTextValue'](_0x2f3e2f))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1e51('0x64')](_0x2f3e2f));}}}_0x169e6c[_0x1e51('0x46')](_0x2fdee1);_0x169e6c['group'](_0x1e51('0x7d'));var _0x419b35={'type':db['Sequelize']['QueryTypes'][_0x1e51('0x7e')],'raw':!![]};var _0x49263c=_0x169e6c[_0x1e51('0x7f')]();_0x49263c[_0x1e51('0x48')](_0x1e51('0x7d'));_0x49263c[_0x1e51('0x48')](_0x1e51('0x80'),'unreadMessages');if(_0x152e34['order']){_0x152e34[_0x1e51('0x44')][_0x1e51('0x30')](function(_0x5468ad){var _0x17e98b=_0x5468ad[0x0]===_0x1e51('0x81')?_0x5468ad[0x0]:'i.'+_0x5468ad[0x0];_0x169e6c['order'](_0x17e98b,_0x5468ad[0x1]===_0x1e51('0x82')?![]:!![]);});}if(!_['isEmpty'](_0x4226da)){_0x169e6c[_0x1e51('0x5e')](_0x2100d4);_0x49263c['where']('t.id\x20IN\x20?',_0x4226da);}BPromise['resolve']()['then'](function(){if(!_0x12584c){if(_0x58cbbe['query']['MailAccountId'])return;_0x49263c[_0x1e51('0x46')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x169e6c[_0x1e51('0x46')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x58cbbe[_0x1e51('0x83')][_0x1e51('0x84')]!==_0x1e51('0x85'))return;return _0x58cbbe['user'][_0x1e51('0x86')]({'attributes':['id'],'raw':!![]})[_0x1e51('0x28')](function(_0x4a2b44){if(_[_0x1e51('0x87')](_0x4a2b44)){_0x49263c['where'](_0x1e51('0x88'));_0x169e6c['where'](_0x1e51('0x88'));}else{_0x49263c[_0x1e51('0x46')](_0x1e51('0x89'),_[_0x1e51('0x36')](_0x4a2b44,'id'));_0x169e6c[_0x1e51('0x46')](_0x1e51('0x89'),_['map'](_0x4a2b44,'id'));}});})[_0x1e51('0x28')](function(){if(_0x58cbbe['user'][_0x1e51('0x84')]===_0x1e51('0x85')&&!_0x12584c&&!_0x58cbbe[_0x1e51('0x3c')][_0x1e51('0x8a')])return[];return db['sequelize']['query'](_0x49263c['toString'](),_0x419b35);})[_0x1e51('0x28')](function(_0xec2a65){_0xcfa1d8[_0x1e51('0x8b')]=_0xec2a65[_0x1e51('0x42')];if(_0xcfa1d8['count']===0x0)return[];return db[_0x1e51('0x8c')]['query'](_0x3ad909[_0x1e51('0x8d')](),_0x419b35)['then'](function(_0x552683){_0x21d61e=_[_0x1e51('0x8e')](_0x552683,'id');_0x419b35=_[_0x1e51('0x8f')](_0x419b35,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x58cbbe[_0x1e51('0x3c')]['fields']){_0x152e34[_0x1e51('0x40')]['forEach'](function(_0x4d2e09){_0x169e6c[_0x1e51('0x48')]('i.'+_0x4d2e09);});}else{_0x169e6c['field'](_0x1e51('0x80'),'unreadMessages');_0x169e6c[_0x1e51('0x48')](_0x1e51('0x90'),_0x1e51('0x91'));_0x169e6c[_0x1e51('0x48')]('a.mandatoryDisposition',_0x1e51('0x92'));_0x169e6c[_0x1e51('0x48')](_0x1e51('0x93'),'contactName');_0x169e6c['field'](_0x1e51('0x7d'));_0x169e6c[_0x1e51('0x48')](_0x1e51('0x94'));_0x169e6c['field']('i.updatedAt');_0x169e6c['field'](_0x1e51('0x95'));_0x169e6c[_0x1e51('0x48')](_0x1e51('0x96'));_0x169e6c['field'](_0x1e51('0x97'));_0x169e6c[_0x1e51('0x48')]('i.lastMsgAt');_0x169e6c[_0x1e51('0x48')](_0x1e51('0x98'));_0x169e6c[_0x1e51('0x48')]('i.subject');_0x169e6c[_0x1e51('0x48')]('i.disposition');_0x169e6c[_0x1e51('0x48')](_0x1e51('0x99'));_0x169e6c[_0x1e51('0x48')](_0x1e51('0x9a'));_0x169e6c[_0x1e51('0x48')](_0x1e51('0x9b'));_0x169e6c[_0x1e51('0x48')](_0x1e51('0x9c'));_0x169e6c[_0x1e51('0x48')]('i.ContactId');_0x169e6c[_0x1e51('0x48')]('i.MailAccountId');_0x169e6c[_0x1e51('0x48')]('i.UserId');_0x169e6c[_0x1e51('0x48')](_0x1e51('0x9d'),_0x1e51('0x9e'));_0x169e6c[_0x1e51('0x48')](_0x1e51('0x9f'),_0x1e51('0xa0'));_0x169e6c[_0x1e51('0x48')](_0x1e51('0xa1'),_0x1e51('0xa2'));_0x169e6c['field'](_0x1e51('0xa3'),_0x1e51('0xa4'));_0x169e6c[_0x1e51('0x48')]('c.mobile',_0x1e51('0xa5'));_0x169e6c[_0x1e51('0x48')](_0x1e51('0xa6'),'Contact.fax');_0x169e6c[_0x1e51('0x48')](_0x1e51('0xa7'),_0x1e51('0xa8'));_0x169e6c[_0x1e51('0x48')](_0x1e51('0xa9'),'Owner.internal');_0x169e6c['field'](_0x1e51('0xaa'),'TagIds');}if(_0x152e34['limit'])_0x169e6c[_0x1e51('0x24')](_0x152e34[_0x1e51('0x24')]);if(_0x152e34[_0x1e51('0x23')])_0x169e6c[_0x1e51('0x23')](_0x152e34[_0x1e51('0x23')]);return db[_0x1e51('0x8c')][_0x1e51('0x3c')](_0x169e6c[_0x1e51('0x8d')](),_0x419b35);})[_0x1e51('0x28')](function(_0x508550){_0x4b5fa7[_0x1e51('0x46')](_0x1e51('0xab'),_[_0x1e51('0x36')](_0x508550,'id'));return db['sequelize']['query'](_0x4b5fa7[_0x1e51('0x8d')](),_0x419b35)[_0x1e51('0x28')](function(_0x5dc64d){var _0x27a872=_[_0x1e51('0xac')](_0x5dc64d,'MailInteractionId');var _0x45a942=[];return db[_0x1e51('0xad')][_0x1e51('0x32')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x1e51('0x28')](function(_0x1dd6e8){var _0x464628=_0x1dd6e8[_0x1e51('0xae')];_0x508550[_0x1e51('0x30')](function(_0x3bcc3c){_0x45a942[_0x1e51('0x31')](updateMailInteraction(_0x3bcc3c,_0x21d61e,_0x27a872,_0x464628));});return BPromise[_0x1e51('0xaf')](_0x45a942);});});});})[_0x1e51('0x28')](function(_0x401702){_0xcfa1d8['rows']=_0x401702;return _0xcfa1d8;})['then'](respondWithFilteredResult(_0x3c6c35,_0x152e34))[_0x1e51('0xb0')](handleError(_0x3c6c35,null));};exports['show']=function(_0x5abc8e,_0x5ea710){var _0x251595={'raw':![],'where':{'id':_0x5abc8e[_0x1e51('0xb1')]['id']}},_0x53dbbb={};_0x53dbbb['model']=_[_0x1e51('0x3d')](db[_0x1e51('0x37')]['rawAttributes']);_0x53dbbb[_0x1e51('0x3c')]=_['keys'](_0x5abc8e[_0x1e51('0x3c')]);_0x53dbbb[_0x1e51('0x3e')]=_['intersection'](_0x53dbbb[_0x1e51('0x3b')],_0x53dbbb[_0x1e51('0x3c')]);_0x251595['attributes']=_['intersection'](_0x53dbbb['model'],qs[_0x1e51('0x41')](_0x5abc8e[_0x1e51('0x3c')][_0x1e51('0x41')]));_0x251595['attributes']=_0x251595['attributes'][_0x1e51('0x42')]?_0x251595[_0x1e51('0x40')]:_0x53dbbb[_0x1e51('0x3b')];if(_0x5abc8e['query'][_0x1e51('0xb2')]){_0x251595[_0x1e51('0xb3')]=[{'all':!![]}];}_0x251595=_[_0x1e51('0x8f')]({},_0x251595,_0x5abc8e[_0x1e51('0xb4')]);return db[_0x1e51('0x37')][_0x1e51('0x5b')](_0x251595)['then'](handleEntityNotFound(_0x5ea710,null))[_0x1e51('0x28')](respondWithResult(_0x5ea710,null))[_0x1e51('0xb0')](handleError(_0x5ea710,null));};exports[_0x1e51('0xb5')]=function(_0x584da9,_0x516a92){return db[_0x1e51('0x37')]['create'](_0x584da9['body'],{})['then'](respondWithResult(_0x516a92,0xc9))[_0x1e51('0xb0')](handleError(_0x516a92,null));};exports[_0x1e51('0x27')]=function(_0x3b9b46,_0x12d05b){if(_0x3b9b46['body']['id']){delete _0x3b9b46['body']['id'];}return db['MailInteraction'][_0x1e51('0x5b')]({'where':{'id':_0x3b9b46['params']['id']}})[_0x1e51('0x28')](handleEntityNotFound(_0x12d05b,null))[_0x1e51('0x28')](saveUpdates(_0x3b9b46[_0x1e51('0xb6')],null))[_0x1e51('0x28')](respondWithResult(_0x12d05b,null))[_0x1e51('0xb0')](handleError(_0x12d05b,null));};exports[_0x1e51('0x29')]=function(_0xf1aad4,_0x53714d){return db[_0x1e51('0x37')][_0x1e51('0x5b')]({'where':{'id':_0xf1aad4[_0x1e51('0xb1')]['id']}})[_0x1e51('0x28')](handleEntityNotFound(_0x53714d,null))['then'](removeEntity(_0x53714d,null))[_0x1e51('0xb0')](handleError(_0x53714d,null));};exports[_0x1e51('0xb7')]=function(_0x57c3a2,_0x2b12e9){return db[_0x1e51('0x37')][_0x1e51('0xb7')]()[_0x1e51('0x28')](respondWithResult(_0x2b12e9,null))[_0x1e51('0xb0')](handleError(_0x2b12e9,null));};exports[_0x1e51('0xb8')]=function(_0x6b3edc,_0x128cc9,_0x90756){return db[_0x1e51('0xb9')]['find']({'where':{'id':_0x6b3edc[_0x1e51('0xb1')]['id']}})[_0x1e51('0x28')](handleEntityNotFound(_0x128cc9,null))[_0x1e51('0x28')](function(_0x586153){if(_0x586153){return _0x586153[_0x1e51('0xb8')](_0x6b3edc[_0x1e51('0xb6')][_0x1e51('0xba')],_[_0x1e51('0xbb')](_0x6b3edc[_0x1e51('0xb6')],[_0x1e51('0xba'),'id'])||{});}})[_0x1e51('0x28')](respondWithResult(_0x128cc9,null))['catch'](handleError(_0x128cc9,null));};exports[_0x1e51('0xbc')]=function(_0x3fa83a,_0x4c0f22,_0x5ae595){var _0x4595d6={'raw':![],'where':{}};var _0x3ac432={};var _0x9aa50a={'count':0x0,'rows':[]};return db[_0x1e51('0x37')][_0x1e51('0x32')]({'where':{'id':_0x3fa83a[_0x1e51('0xb1')]['id']}})['then'](handleEntityNotFound(_0x4c0f22,null))['then'](function(_0x290551){if(_0x290551){_0x3ac432[_0x1e51('0x3b')]=_['keys'](db[_0x1e51('0xb9')][_0x1e51('0x38')]);_0x3ac432[_0x1e51('0x3c')]=_['keys'](_0x3fa83a[_0x1e51('0x3c')]);_0x3ac432[_0x1e51('0x3e')]=_[_0x1e51('0x3f')](_0x3ac432['model'],_0x3ac432[_0x1e51('0x3c')]);_0x4595d6[_0x1e51('0x40')]=_[_0x1e51('0x3f')](_0x3ac432[_0x1e51('0x3b')],qs['fields'](_0x3fa83a[_0x1e51('0x3c')][_0x1e51('0x41')]));_0x4595d6['attributes']=_0x4595d6[_0x1e51('0x40')][_0x1e51('0x42')]?_0x4595d6[_0x1e51('0x40')]:_0x3ac432[_0x1e51('0x3b')];if(!_0x3fa83a['query'][_0x1e51('0x43')](_0x1e51('0xbd'))){_0x4595d6[_0x1e51('0x24')]=qs[_0x1e51('0x24')](_0x3fa83a[_0x1e51('0x3c')]['limit']);_0x4595d6[_0x1e51('0x23')]=qs[_0x1e51('0x23')](_0x3fa83a[_0x1e51('0x3c')][_0x1e51('0x23')]);}_0x4595d6['order']=qs['sort'](_0x3fa83a[_0x1e51('0x3c')]['sort']);_0x4595d6['where']=qs[_0x1e51('0x3e')](_[_0x1e51('0xbe')](_0x3fa83a[_0x1e51('0x3c')],_0x3ac432[_0x1e51('0x3e')]));_0x4595d6[_0x1e51('0x46')][_0x1e51('0xbf')]=_0x290551['id'];if(_0x3fa83a['query'][_0x1e51('0x77')]){_0x4595d6[_0x1e51('0x46')]=_['merge'](_0x4595d6['where'],{'$or':_['map'](_0x4595d6['attributes'],function(_0x293f2a){var _0x1d4d92={};_0x1d4d92[_0x293f2a]={'$like':'%'+_0x3fa83a['query'][_0x1e51('0x77')]+'%'};return _0x1d4d92;})});}if(_0x3fa83a[_0x1e51('0x3c')][_0x1e51('0xc0')]){var _0x32a411=_0x3fa83a[_0x1e51('0x3c')][_0x1e51('0xc0')][_0x1e51('0x2f')](',');var _0x2bb07e={};_0x2bb07e[_0x32a411[0x0]]={'$gte':moment(_0x32a411[0x1])[_0x1e51('0xc1')](_0x1e51('0xc2'))};_0x4595d6[_0x1e51('0x46')]=_['merge'](_0x4595d6[_0x1e51('0x46')],_0x2bb07e);}_0x4595d6=_[_0x1e51('0x8f')]({},_0x4595d6,_0x3fa83a[_0x1e51('0xb4')]);return db[_0x1e51('0xb9')]['count']({'where':_0x4595d6['where']})[_0x1e51('0x28')](function(_0x410e15){_0x9aa50a['count']=_0x410e15;if(_0x3fa83a[_0x1e51('0x3c')][_0x1e51('0xb2')]){_0x4595d6['include']=[{'all':!![]}];}return db['MailMessage'][_0x1e51('0xc3')](_0x4595d6);})[_0x1e51('0x28')](function(_0x4f0144){if(_0x3fa83a[_0x1e51('0x3c')][_0x1e51('0xc4')]===_0x1e51('0xc5')){for(var _0x4ca6d9=0x0;_0x4ca6d9<_0x4f0144[_0x1e51('0x42')];_0x4ca6d9++){_0x4f0144[_0x4ca6d9]['body']=juice(_0x4f0144[_0x4ca6d9]['body']);}}_0x9aa50a['rows']=_0x4f0144;return _0x9aa50a;});}})[_0x1e51('0x28')](respondWithFilteredResult(_0x4c0f22,_0x4595d6))['catch'](handleError(_0x4c0f22,null));};exports['addTags']=function(_0x2e4845,_0x30d666,_0x1a0573){return db[_0x1e51('0x37')][_0x1e51('0x5b')]({'where':{'id':_0x2e4845[_0x1e51('0xb1')]['id']}})[_0x1e51('0x28')](handleEntityNotFound(_0x30d666,null))[_0x1e51('0x28')](function(_0x969e1a){if(_0x969e1a){return _0x969e1a[_0x1e51('0xc6')](_0x2e4845[_0x1e51('0xb6')][_0x1e51('0xba')],_[_0x1e51('0xbb')](_0x2e4845['body'],[_0x1e51('0xba'),'id'])||{})[_0x1e51('0xc7')](function(){return db[_0x1e51('0xc8')]['findAll']({'attributes':['id',_0x1e51('0x2b'),_0x1e51('0xc9')],'where':{'id':_0x2e4845['body'][_0x1e51('0xba')]}});})[_0x1e51('0x28')](function(_0x1a62c0){socket[_0x1e51('0xca')](_0x1e51('0xcb'),{'id':Number(_0x2e4845[_0x1e51('0xb1')]['id']),'tags':_0x1a62c0||[]});return{'id':Number(_0x2e4845[_0x1e51('0xb1')]['id']),'tags':_0x1a62c0||[]};});}})[_0x1e51('0x28')](respondWithResult(_0x30d666,null))[_0x1e51('0xb0')](handleError(_0x30d666,null));};exports[_0x1e51('0xcc')]=function(_0x9a9340,_0x55c6cc,_0x2fa933){return db[_0x1e51('0x37')][_0x1e51('0x5b')]({'where':{'id':_0x9a9340[_0x1e51('0xb1')]['id']}})['then'](handleEntityNotFound(_0x55c6cc,null))[_0x1e51('0x28')](function(_0xe0aec2){if(_0xe0aec2){return _0xe0aec2[_0x1e51('0xcc')](_0x9a9340['query']['ids']);}})[_0x1e51('0x28')](respondWithStatusCode(_0x55c6cc,null))[_0x1e51('0xb0')](handleError(_0x55c6cc,null));};exports[_0x1e51('0xcd')]=function(_0x389043,_0x3adb47){var _0x4d3ccc=moment()['unix']()[_0x1e51('0x8d')]();var _0x23e5e3=path[_0x1e51('0xce')](config[_0x1e51('0xcf')],'server',_0x1e51('0xd0'),_0x1e51('0xd1'));var _0xeb0741=path[_0x1e51('0xce')](config[_0x1e51('0xcf')],_0x1e51('0xd2'),_0x1e51('0xd0'),_0x1e51('0xd3'));var _0x39819f=path['join'](_0x23e5e3,_0x4d3ccc);var _0x34605b=util[_0x1e51('0xc1')](_0x1e51('0xd4'),_0x389043[_0x1e51('0xb1')]['id'],_0x4d3ccc);var _0x2a4888=path[_0x1e51('0xce')](_0x23e5e3,_0x34605b);var _0x6032e=[];if(_0x389043[_0x1e51('0x3c')]['attachments']){_0x6032e[_0x1e51('0x31')]({'model':db[_0x1e51('0xd5')],'as':_0x1e51('0xd6'),'raw':!![]});}var _0x1901b9=[{'model':db[_0x1e51('0xb9')],'as':_0x1e51('0xd7'),'attributes':['id',_0x1e51('0xb6'),'from','to','cc','bcc',_0x1e51('0xd8'),'createdAt'],'where':{'secret':![]},'order':qs[_0x1e51('0x45')]('id'),'include':_0x6032e}];return db['MailInteraction'][_0x1e51('0x5b')]({'where':{'id':_0x389043[_0x1e51('0xb1')]['id']},'include':_0x1901b9})[_0x1e51('0x28')](handleEntityNotFound(_0x3adb47,null))[_0x1e51('0x28')](function(_0x55cb8f){if(_0x55cb8f&&_0x55cb8f[_0x1e51('0xd7')]){var _0x566d45=_0x55cb8f[_0x1e51('0xd9')]({'plain':!![]});fs['mkdirSync'](_0x39819f);return BPromise[_0x1e51('0xda')](_0x566d45['Messages'],function(_0x12dc5e,_0xbc5696){var _0x4c61b8={'from':_0x12dc5e[_0x1e51('0x49')],'to':_0x12dc5e['to'],'subject':_0x12dc5e[_0x1e51('0xd8')],'html':_0x12dc5e['body'],'headers':{'Date':moment(_0x12dc5e[_0x1e51('0x70')])[_0x1e51('0xc1')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x12dc5e['cc']){_0x4c61b8[_0x1e51('0xdb')]['Cc']=_0x12dc5e['cc'];}if(_0x12dc5e['bcc']){_0x4c61b8[_0x1e51('0xdb')][_0x1e51('0xdc')]=_0x12dc5e[_0x1e51('0xdd')];}return new BPromise(function(_0x323781,_0x562a4b){if(_0x12dc5e[_0x1e51('0xd6')]){for(var _0x1a719f=0x0;_0x1a719f<_0x12dc5e['Attachments'][_0x1e51('0x42')];_0x1a719f++){var _0x2f5b0a=_0x12dc5e[_0x1e51('0xd6')][_0x1a719f];var _0x2c2228=path[_0x1e51('0xce')](_0xeb0741,_0x2f5b0a[_0x1e51('0xde')]);if(fs[_0x1e51('0xdf')](_0x2c2228)){_0x4c61b8[_0x1e51('0xd3')][_0x1e51('0x31')]({'name':_0x2f5b0a[_0x1e51('0x2b')],'contentType':_0x2f5b0a[_0x1e51('0x3a')],'data':fs[_0x1e51('0xe0')](_0x2c2228)});}}}emlformat[_0x1e51('0xe1')](_0x4c61b8,function(_0x2e23a6,_0x102a89){if(_0x2e23a6)return _0x562a4b(_0x2e23a6);fs[_0x1e51('0xe2')](path[_0x1e51('0xce')](_0x39819f,util[_0x1e51('0xc1')](_0x1e51('0xe3'),_0xbc5696)),_0x102a89);return _0x323781(_0x102a89);});});})[_0x1e51('0x28')](function(){return new BPromise(function(_0x2a0b48,_0x1bbccf){zipdir(_0x39819f,{'saveTo':_0x2a4888},function(_0x315377,_0x565e82){if(_0x315377)return _0x1bbccf(_0x315377);return _0x2a0b48(_0x565e82);});})[_0x1e51('0x28')](function(){return new BPromise(function(_0x543cee,_0x12ac29){rimraf(_0x39819f,function(_0x52ca8b){if(_0x52ca8b)_0x12ac29(_0x52ca8b);return _0x543cee();});});})['then'](function(){return _0x3adb47[_0x1e51('0xcd')](_0x2a4888,_0x34605b,function(_0x59a40b){if(_0x59a40b){console[_0x1e51('0xe4')](_0x1e51('0xe5'),_0x59a40b);}else{fs['unlinkSync'](_0x2a4888);}});});});}else{return _0x3adb47[_0x1e51('0x1f')](0xc8);}})[_0x1e51('0xb0')](handleError(_0x3adb47,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 6d2968a..7933fbc 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 _0xfe53=['MailMessage','setMaxListeners','save','update','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0xfe53,0x1be));var _0x3fe5=function(_0x1879a6,_0x2cb4df){_0x1879a6=_0x1879a6-0x0;var _0x3ca317=_0xfe53[_0x1879a6];return _0x3ca317;};'use strict';var EventEmitter=require(_0x3fe5('0x0'));var MailInteraction=require(_0x3fe5('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x3fe5('0x1'))['db'][_0x3fe5('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3fe5('0x3')](0x0);var events={'afterCreate':_0x3fe5('0x4'),'afterUpdate':_0x3fe5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x585e4b){return function(_0x32772d,_0x163a04,_0xcfb961){_0x32772d['getUsers']({'attributes':['id'],'raw':!![]})[_0x3fe5('0x6')](function(_0x4f257c){_0x32772d[_0x3fe5('0x7')](_0x3fe5('0x8'),_0x4f257c['map'](function(_0x567a34){return{'id':_0x567a34['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x32772d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3fe5('0x6')](function(_0x3c3f61){_0x32772d[_0x3fe5('0x7')](_0x3fe5('0x9'),_0x3c3f61[_0x3fe5('0xa')]);MailInteractionEvents[_0x3fe5('0xb')](_0x585e4b+':'+_0x32772d['id'],_0x32772d);MailInteractionEvents[_0x3fe5('0xb')](_0x585e4b,_0x32772d);_0xcfb961(null);})[_0x3fe5('0xc')](_0xcfb961(null));};}for(var e in events){if(events[_0x3fe5('0xd')](e)){var event=events[e];MailInteraction[_0x3fe5('0xe')](e,emitEvent(event));}}module[_0x3fe5('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x24f3=['map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x24f3,0x15d));var _0x324f=function(_0xec55e1,_0xc4d37e){_0xec55e1=_0xec55e1-0x0;var _0x2960db=_0x24f3[_0xec55e1];return _0x2960db;};'use strict';var EventEmitter=require(_0x324f('0x0'));var MailInteraction=require(_0x324f('0x1'))['db'][_0x324f('0x2')];var MailMessage=require(_0x324f('0x1'))['db'][_0x324f('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x324f('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x324f('0x5'),'afterDestroy':_0x324f('0x6')};function emitEvent(_0x402798){return function(_0x1164d5,_0x10a551,_0x4180c8){_0x1164d5[_0x324f('0x7')]({'attributes':['id'],'raw':!![]})[_0x324f('0x8')](function(_0x2f1891){_0x1164d5[_0x324f('0x9')](_0x324f('0xa'),_0x2f1891[_0x324f('0xb')](function(_0x48c482){return{'id':_0x48c482['id']};}));return MailMessage[_0x324f('0xc')]({'where':{'MailInteractionId':_0x1164d5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3eedd9){_0x1164d5[_0x324f('0x9')](_0x324f('0xd'),_0x3eedd9['length']);MailInteractionEvents[_0x324f('0xe')](_0x402798+':'+_0x1164d5['id'],_0x1164d5);MailInteractionEvents[_0x324f('0xe')](_0x402798,_0x1164d5);_0x4180c8(null);})[_0x324f('0xf')](_0x4180c8(null));};}for(var e in events){if(events[_0x324f('0x10')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x324f('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 7897ac0..ba565f2 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 _0xb8fb=['format','changed','substatusAt','get','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','fti_mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x25e3b0,_0x44629b){var _0x2eefd9=function(_0x3a3488){while(--_0x3a3488){_0x25e3b0['push'](_0x25e3b0['shift']());}};_0x2eefd9(++_0x44629b);}(_0xb8fb,0xa4));var _0xbb8f=function(_0x40ed4a,_0x3bb30d){_0x40ed4a=_0x40ed4a-0x0;var _0x3a2b75=_0xb8fb[_0x40ed4a];return _0x3a2b75;};'use strict';var _=require(_0xbb8f('0x0'));var util=require(_0xbb8f('0x1'));var logger=require('../../config/logger')(_0xbb8f('0x2'));var moment=require(_0xbb8f('0x3'));var BPromise=require(_0xbb8f('0x4'));var rp=require(_0xbb8f('0x5'));var fs=require('fs');var path=require(_0xbb8f('0x6'));var rimraf=require(_0xbb8f('0x7'));var config=require(_0xbb8f('0x8'));var attributes=require(_0xbb8f('0x9'));module['exports']=function(_0x3e4c25,_0x3f8db9){return _0x3e4c25[_0xbb8f('0xa')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xbb8f('0xb'),'fields':[_0xbb8f('0xc'),'to'],'type':_0xbb8f('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x247ff7,_0x40fd2e,_0x314b8e){if(_0x247ff7[_0xbb8f('0xe')]){_0x247ff7['substatusAt']=moment()['format'](_0xbb8f('0xf'));}if(_0x247ff7[_0xbb8f('0x10')]){_0x247ff7[_0xbb8f('0x11')]=moment()[_0xbb8f('0x12')](_0xbb8f('0xf'));}_0x314b8e(null,_0x40fd2e);},'beforeUpdate':function(_0x5cfbea,_0x51451f,_0x17dc8e){if(_0x5cfbea[_0xbb8f('0x13')]('substatus')){_0x5cfbea['substatusAt']=_0x5cfbea[_0xbb8f('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x5cfbea[_0xbb8f('0x13')](_0xbb8f('0x10'))){_0x5cfbea[_0xbb8f('0x11')]=moment()[_0xbb8f('0x12')](_0xbb8f('0xf'));_0x5cfbea[_0xbb8f('0xe')]=null;_0x5cfbea[_0xbb8f('0x14')]=null;}_0x17dc8e(null,_0x5cfbea);},'afterUpdate':function(_0x59a50b,_0x1e4528,_0xef0652){var _0x40ce46=_0x3e4c25['models'];var _0x49407d=_0x59a50b[_0xbb8f('0x15')]({'plain':!![]});if(_0x49407d['closed']){return _0x40ce46['MailMessage'][_0xbb8f('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x49407d['id']}})[_0xbb8f('0x17')](function(){_0xef0652();})['catch'](function(_0x4e1e0b){_0xef0652(_0x4e1e0b);});}else{_0xef0652();}}},'charset':_0xbb8f('0x18'),'collate':_0xbb8f('0x19')});}; \ No newline at end of file +var _0x520e=['YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','models','get','MailMessage','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format'];(function(_0x52b131,_0x22748c){var _0x5bec7b=function(_0x13043b){while(--_0x13043b){_0x52b131['push'](_0x52b131['shift']());}};_0x5bec7b(++_0x22748c);}(_0x520e,0x90));var _0xe520=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x520e[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0xe520('0x0'));var util=require(_0xe520('0x1'));var logger=require(_0xe520('0x2'))(_0xe520('0x3'));var moment=require(_0xe520('0x4'));var BPromise=require(_0xe520('0x5'));var rp=require(_0xe520('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe520('0x7'));var config=require(_0xe520('0x8'));var attributes=require('./mailInteraction.attributes');module[_0xe520('0x9')]=function(_0x3b7dbc,_0x22f368){return _0x3b7dbc[_0xe520('0xa')](_0xe520('0xb'),attributes,{'tableName':_0xe520('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xe520('0xd'),'to'],'type':_0xe520('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x373964,_0x1b4d5c,_0x24243c){if(_0x373964[_0xe520('0xf')]){_0x373964[_0xe520('0x10')]=moment()[_0xe520('0x11')](_0xe520('0x12'));}if(_0x373964[_0xe520('0x13')]){_0x373964[_0xe520('0x14')]=moment()[_0xe520('0x11')](_0xe520('0x12'));}_0x24243c(null,_0x1b4d5c);},'beforeUpdate':function(_0x2f8f3e,_0x1cb271,_0x2eaa9d){if(_0x2f8f3e['changed']('substatus')){_0x2f8f3e[_0xe520('0x10')]=_0x2f8f3e['substatus']?moment()[_0xe520('0x11')](_0xe520('0x12')):null;}if(_0x2f8f3e['changed'](_0xe520('0x13'))){_0x2f8f3e[_0xe520('0x14')]=moment()[_0xe520('0x11')](_0xe520('0x12'));_0x2f8f3e[_0xe520('0xf')]=null;_0x2f8f3e[_0xe520('0x10')]=null;}_0x2eaa9d(null,_0x2f8f3e);},'afterUpdate':function(_0x3f1a29,_0x277160,_0x2e2306){var _0x4e0c99=_0x3b7dbc[_0xe520('0x15')];var _0x5ee9b5=_0x3f1a29[_0xe520('0x16')]({'plain':!![]});if(_0x5ee9b5[_0xe520('0x13')]){return _0x4e0c99[_0xe520('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x5ee9b5['id']}})['then'](function(){_0x2e2306();})[_0xe520('0x18')](function(_0x5170b1){_0x2e2306(_0x5170b1);});}else{_0x2e2306();}}},'charset':_0xe520('0x19'),'collate':_0xe520('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index c2810e5..f60a7e6 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 _0xea1a=['UpdateMailInteraction','MailInteraction','update','body','options','attributes','limit','then','AddTagsToMailInteraction','ids','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','MailInteraction,\x20%s,\x20%s','message','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xea1a,0x158));var _0xaea1=function(_0x1d2f49,_0x562bbf){_0x1d2f49=_0x1d2f49-0x0;var _0xd451e1=_0xea1a[_0x1d2f49];return _0xd451e1;};'use strict';var _=require(_0xaea1('0x0'));var util=require(_0xaea1('0x1'));var moment=require(_0xaea1('0x2'));var BPromise=require(_0xaea1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaea1('0x4'));var db=require(_0xaea1('0x5'))['db'];var utils=require(_0xaea1('0x6'));var logger=require(_0xaea1('0x7'))(_0xaea1('0x8'));var config=require(_0xaea1('0x9'));var jayson=require(_0xaea1('0xa'));var client=jayson[_0xaea1('0xb')]['http']({'port':0x232a});config[_0xaea1('0xc')]=_[_0xaea1('0xd')](config[_0xaea1('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xaea1('0xe'))(new Redis(config['redis']));require(_0xaea1('0xf'))['register'](socket);function respondWithRpcPromise(_0x26fb87,_0x4de4c1,_0x5663f9){return new BPromise(function(_0x541e58,_0x443249){return client['request'](_0x26fb87,_0x5663f9)['then'](function(_0x18a725){logger[_0xaea1('0x10')]('MailInteraction,\x20%s,\x20%s',_0x4de4c1,_0xaea1('0x11'));logger[_0xaea1('0x12')](_0xaea1('0x13'),_0x4de4c1,_0xaea1('0x11'),JSON[_0xaea1('0x14')](_0x18a725));if(_0x18a725[_0xaea1('0x15')]){if(_0x18a725[_0xaea1('0x15')]['code']===0x1f4){logger[_0xaea1('0x15')](_0xaea1('0x16'),_0x4de4c1,_0x18a725[_0xaea1('0x15')][_0xaea1('0x17')]);return _0x443249(_0x18a725[_0xaea1('0x15')][_0xaea1('0x17')]);}logger[_0xaea1('0x15')](_0xaea1('0x16'),_0x4de4c1,_0x18a725[_0xaea1('0x15')][_0xaea1('0x17')]);return _0x541e58(_0x18a725[_0xaea1('0x15')][_0xaea1('0x17')]);}else{logger[_0xaea1('0x10')](_0xaea1('0x16'),_0x4de4c1,_0xaea1('0x11'));_0x541e58(_0x18a725[_0xaea1('0x18')][_0xaea1('0x17')]);}})[_0xaea1('0x19')](function(_0x5b38af){logger[_0xaea1('0x15')]('MailInteraction,\x20%s,\x20%s',_0x4de4c1,_0x5b38af);_0x443249(_0x5b38af);});});}exports[_0xaea1('0x1a')]=function(_0x2125cb){var _0x1b18d0=this;return new Promise(function(_0x448f36,_0x10fa19){return db[_0xaea1('0x1b')][_0xaea1('0x1c')](_0x2125cb[_0xaea1('0x1d')],{'raw':_0x2125cb[_0xaea1('0x1e')]?_0x2125cb[_0xaea1('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2125cb[_0xaea1('0x1e')]?_0x2125cb['options']['where']||null:null,'attributes':_0x2125cb['options']?_0x2125cb['options'][_0xaea1('0x1f')]||null:null,'limit':_0x2125cb['options']?_0x2125cb['options'][_0xaea1('0x20')]||null:null})[_0xaea1('0x21')](function(_0x3b2d67){logger['info']('UpdateMailInteraction',_0x2125cb);logger[_0xaea1('0x12')](_0xaea1('0x1a'),_0x2125cb,JSON[_0xaea1('0x14')](_0x3b2d67));_0x448f36(_0x3b2d67);})[_0xaea1('0x19')](function(_0x38d92f){logger['error'](_0xaea1('0x1a'),_0x38d92f[_0xaea1('0x17')],_0x2125cb);_0x10fa19(_0x1b18d0[_0xaea1('0x15')](0x1f4,_0x38d92f[_0xaea1('0x17')]));});});};exports[_0xaea1('0x22')]=function(_0x2765d0){return new Promise(function(_0x167391,_0x5b5556){return db[_0xaea1('0x1b')]['find']({'where':_0x2765d0[_0xaea1('0x1e')]?_0x2765d0[_0xaea1('0x1e')]['where']||null:null})[_0xaea1('0x21')](function(_0x2f9025){if(_0x2f9025){return _0x2f9025['addTags'](_0x2765d0[_0xaea1('0x1d')]['ids'],_['omit'](_0x2765d0['body'],[_0xaea1('0x23'),'id'])||{});}})['spread'](function(_0x1a5f9a){logger['info'](_0xaea1('0x24'),_0x2765d0);logger['debug'](_0xaea1('0x24'),_0x2765d0,JSON[_0xaea1('0x14')](_0x1a5f9a));_0x167391(_0x1a5f9a);})[_0xaea1('0x19')](function(_0x3dee97){logger[_0xaea1('0x15')]('AddTags',_0x3dee97[_0xaea1('0x17')],_0x2765d0);_0x5b5556(_this[_0xaea1('0x15')](0x1f4,_0x3dee97[_0xaea1('0x17')]));});});}; \ No newline at end of file +var _0x8a9a=['client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailInteraction','update','body','options','raw','where','attributes','then','UpdateMailInteraction','stringify','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0xb1174e,_0x1e68a7){var _0x285bac=function(_0x32c505){while(--_0x32c505){_0xb1174e['push'](_0xb1174e['shift']());}};_0x285bac(++_0x1e68a7);}(_0x8a9a,0x193));var _0xa8a9=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x8a9a[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa8a9('0x0'));var BPromise=require(_0xa8a9('0x1'));var rs=require(_0xa8a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8a9('0x3'))['db'];var utils=require(_0xa8a9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8a9('0x5'));var jayson=require(_0xa8a9('0x6'));var client=jayson[_0xa8a9('0x7')][_0xa8a9('0x8')]({'port':0x232a});config[_0xa8a9('0x9')]=_['defaults'](config['redis'],{'host':_0xa8a9('0xa'),'port':0x18eb});var socket=require(_0xa8a9('0xb'))(new Redis(config[_0xa8a9('0x9')]));require(_0xa8a9('0xc'))[_0xa8a9('0xd')](socket);function respondWithRpcPromise(_0x15ae41,_0x4699bd,_0x5a87ec){return new BPromise(function(_0x26bf12,_0x59fe12){return client[_0xa8a9('0xe')](_0x15ae41,_0x5a87ec)['then'](function(_0x142da4){logger[_0xa8a9('0xf')](_0xa8a9('0x10'),_0x4699bd,_0xa8a9('0x11'));logger[_0xa8a9('0x12')](_0xa8a9('0x13'),_0x4699bd,'request\x20sent',JSON['stringify'](_0x142da4));if(_0x142da4[_0xa8a9('0x14')]){if(_0x142da4['error'][_0xa8a9('0x15')]===0x1f4){logger[_0xa8a9('0x14')](_0xa8a9('0x10'),_0x4699bd,_0x142da4[_0xa8a9('0x14')][_0xa8a9('0x16')]);return _0x59fe12(_0x142da4['error'][_0xa8a9('0x16')]);}logger['error'](_0xa8a9('0x10'),_0x4699bd,_0x142da4['error'][_0xa8a9('0x16')]);return _0x26bf12(_0x142da4[_0xa8a9('0x14')]['message']);}else{logger[_0xa8a9('0xf')]('MailInteraction,\x20%s,\x20%s',_0x4699bd,_0xa8a9('0x11'));_0x26bf12(_0x142da4[_0xa8a9('0x17')][_0xa8a9('0x16')]);}})[_0xa8a9('0x18')](function(_0x4b2710){logger['error'](_0xa8a9('0x10'),_0x4699bd,_0x4b2710);_0x59fe12(_0x4b2710);});});}exports['UpdateMailInteraction']=function(_0x37eeaf){var _0x82487e=this;return new Promise(function(_0x3ca556,_0x39384c){return db[_0xa8a9('0x19')][_0xa8a9('0x1a')](_0x37eeaf[_0xa8a9('0x1b')],{'raw':_0x37eeaf[_0xa8a9('0x1c')]?_0x37eeaf[_0xa8a9('0x1c')][_0xa8a9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37eeaf[_0xa8a9('0x1c')]?_0x37eeaf[_0xa8a9('0x1c')][_0xa8a9('0x1e')]||null:null,'attributes':_0x37eeaf['options']?_0x37eeaf['options'][_0xa8a9('0x1f')]||null:null,'limit':_0x37eeaf[_0xa8a9('0x1c')]?_0x37eeaf[_0xa8a9('0x1c')]['limit']||null:null})[_0xa8a9('0x20')](function(_0x312608){logger[_0xa8a9('0xf')](_0xa8a9('0x21'),_0x37eeaf);logger['debug'](_0xa8a9('0x21'),_0x37eeaf,JSON[_0xa8a9('0x22')](_0x312608));_0x3ca556(_0x312608);})[_0xa8a9('0x18')](function(_0x1aef34){logger['error']('UpdateMailInteraction',_0x1aef34[_0xa8a9('0x16')],_0x37eeaf);_0x39384c(_0x82487e[_0xa8a9('0x14')](0x1f4,_0x1aef34[_0xa8a9('0x16')]));});});};exports[_0xa8a9('0x23')]=function(_0xc3ae19){return new Promise(function(_0x2a2f98,_0x2abeb7){return db[_0xa8a9('0x19')]['find']({'where':_0xc3ae19[_0xa8a9('0x1c')]?_0xc3ae19[_0xa8a9('0x1c')][_0xa8a9('0x1e')]||null:null})[_0xa8a9('0x20')](function(_0x186026){if(_0x186026){return _0x186026[_0xa8a9('0x24')](_0xc3ae19[_0xa8a9('0x1b')][_0xa8a9('0x25')],_[_0xa8a9('0x26')](_0xc3ae19[_0xa8a9('0x1b')],[_0xa8a9('0x25'),'id'])||{});}})[_0xa8a9('0x27')](function(_0x255457){logger[_0xa8a9('0xf')](_0xa8a9('0x28'),_0xc3ae19);logger[_0xa8a9('0x12')]('AddTags',_0xc3ae19,JSON[_0xa8a9('0x22')](_0x255457));_0x2a2f98(_0x255457);})[_0xa8a9('0x18')](function(_0x34228e){logger[_0xa8a9('0x14')]('AddTags',_0x34228e[_0xa8a9('0x16')],_0xc3ae19);_0x2abeb7(_this[_0xa8a9('0x14')](0x1f4,_0x34228e['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 38cf1f3..96d5be0 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 _0x473a=['mailInteraction:','save','remove','update','emit','removeListener','register','length'];(function(_0x1eab34,_0x1c96fe){var _0x12523a=function(_0x9870b6){while(--_0x9870b6){_0x1eab34['push'](_0x1eab34['shift']());}};_0x12523a(++_0x1c96fe);}(_0x473a,0x189));var _0xa473=function(_0x492130,_0x1645a0){_0x492130=_0x492130-0x0;var _0xd84b34=_0x473a[_0x492130];return _0xd84b34;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xa473('0x0'),_0xa473('0x1'),_0xa473('0x2')];function createListener(_0x3ec0d9,_0x2845b3){return function(_0x15dea9){_0x2845b3[_0xa473('0x3')](_0x3ec0d9,_0x15dea9);};}function removeListener(_0x516e4c,_0x2c2b6f){return function(){MailInteractionEvents[_0xa473('0x4')](_0x516e4c,_0x2c2b6f);};}exports[_0xa473('0x5')]=function(_0x308657){for(var _0x22e850=0x0,_0x3856f3=events[_0xa473('0x6')];_0x22e850<_0x3856f3;_0x22e850++){var _0x12893b=events[_0x22e850];var _0xcddfaf=createListener(_0xa473('0x7')+_0x12893b,_0x308657);MailInteractionEvents['on'](_0x12893b,_0xcddfaf);}}; \ No newline at end of file +var _0xcb89=['save','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x85e51e,_0x43826e){var _0x3fe15d=function(_0x56e08c){while(--_0x56e08c){_0x85e51e['push'](_0x85e51e['shift']());}};_0x3fe15d(++_0x43826e);}(_0xcb89,0x1cd));var _0x9cb8=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xcb89[_0x22b68a];return _0x1ac67a;};'use strict';var MailInteractionEvents=require(_0x9cb8('0x0'));var events=[_0x9cb8('0x1'),'remove','update'];function createListener(_0x543b4d,_0x44f47d){return function(_0x3fb1d3){_0x44f47d['emit'](_0x543b4d,_0x3fb1d3);};}function removeListener(_0x3b7be8,_0x3c0990){return function(){MailInteractionEvents[_0x9cb8('0x2')](_0x3b7be8,_0x3c0990);};}exports[_0x9cb8('0x3')]=function(_0x6a1baa){for(var _0x1cead9=0x0,_0x8e1e6e=events[_0x9cb8('0x4')];_0x1cead9<_0x8e1e6e;_0x1cead9++){var _0x491f50=events[_0x1cead9];var _0x51d803=createListener(_0x9cb8('0x5')+_0x491f50,_0x6a1baa);MailInteractionEvents['on'](_0x491f50,_0x51d803);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e55f3a4..512e985 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 _0x9c5a=['isAuthenticated','get','/describe','/:id','show','download','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller'];(function(_0x1d4a48,_0x1b289c){var _0x100d67=function(_0x7ba067){while(--_0x7ba067){_0x1d4a48['push'](_0x1d4a48['shift']());}};_0x100d67(++_0x1b289c);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x32a851,_0x529675){_0x32a851=_0x32a851-0x0;var _0x315341=_0x9c5a[_0x32a851];return _0x315341;};'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['describe']);router[_0xa9c5('0x9')](_0xa9c5('0xb'),auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0x9')]('/:id/download',auth[_0xa9c5('0x8')](),controller[_0xa9c5('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xa9c5('0xe')](_0xa9c5('0xf'),_0xa9c5('0x10')),controller[_0xa9c5('0x11')]);router[_0xa9c5('0x12')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x13')]);router[_0xa9c5('0x12')](_0xa9c5('0x14'),auth['isAuthenticated'](),controller[_0xa9c5('0x15')]);router[_0xa9c5('0x12')](_0xa9c5('0x16'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x17')]);router[_0xa9c5('0x18')](_0xa9c5('0xb'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x19')]);module[_0xa9c5('0x1a')]=router; \ No newline at end of file +var _0xe14d=['index','describe','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xe14d,0x1ee));var _0xde14=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe14d[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var auth=require(_0xde14('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xde14('0x6'));var controller=require(_0xde14('0x7'));router[_0xde14('0x8')]('/',auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router[_0xde14('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xde14('0xb')]);router[_0xde14('0x8')](_0xde14('0xc'),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router[_0xde14('0x8')](_0xde14('0xe'),auth[_0xde14('0x9')](),controller['download']);router[_0xde14('0xf')]('/',auth[_0xde14('0x9')](),interaction[_0xde14('0x10')](_0xde14('0x11'),_0xde14('0x12')),controller[_0xde14('0x13')]);router[_0xde14('0x14')](_0xde14('0xc'),auth[_0xde14('0x9')](),controller[_0xde14('0x15')]);router[_0xde14('0x14')](_0xde14('0x16'),auth[_0xde14('0x9')](),controller[_0xde14('0x17')]);router[_0xde14('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0xde14('0x18')]);router[_0xde14('0x19')](_0xde14('0xc'),auth['isAuthenticated'](),controller[_0xde14('0x1a')]);module[_0xde14('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 4c0f8e0..7c2e301 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 _0xe797=['INTEGER','sequelize','lodash','exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x5a433c,_0x423be6){var _0x310003=function(_0x293dc2){while(--_0x293dc2){_0x5a433c['push'](_0x5a433c['shift']());}};_0x310003(++_0x423be6);}(_0xe797,0x12a));var _0x7e79=function(_0x3d4c14,_0x5ee241){_0x3d4c14=_0x3d4c14-0x0;var _0xa9b4d2=_0xe797[_0x3d4c14];return _0xa9b4d2;};'use strict';var Sequelize=require(_0x7e79('0x0'));var _=require(_0x7e79('0x1'));module[_0x7e79('0x2')]={'body':{'type':Sequelize[_0x7e79('0x3')](_0x7e79('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7e79('0x3')]('medium')},'read':{'type':Sequelize[_0x7e79('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7e79('0x6')]('in','out'),'defaultValue':_0x7e79('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7e79('0x8')](0x1fe)},'from':{'type':Sequelize[_0x7e79('0x8')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x7e79('0x3')](_0x7e79('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x7e79('0x3')]},'sentAt':{'type':Sequelize[_0x7e79('0x9')]},'attach':{'type':Sequelize[_0x7e79('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7e79('0x9')]},'originTo':{'type':Sequelize[_0x7e79('0x3')](_0x7e79('0x4'))},'originCc':{'type':Sequelize[_0x7e79('0x3')](_0x7e79('0x4'))}}; \ No newline at end of file +var _0x47c5=['ENUM','out','STRING','DATE','INTEGER','sequelize','lodash','exports','TEXT','long','BOOLEAN'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x47c5,0x165));var _0x547c=function(_0x5ce43c,_0x397d8a){_0x5ce43c=_0x5ce43c-0x0;var _0xb7b3ee=_0x47c5[_0x5ce43c];return _0xb7b3ee;};'use strict';var Sequelize=require(_0x547c('0x0'));var _=require(_0x547c('0x1'));module[_0x547c('0x2')]={'body':{'type':Sequelize[_0x547c('0x3')](_0x547c('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x547c('0x3')]('medium')},'read':{'type':Sequelize[_0x547c('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x547c('0x6')]('in','out'),'defaultValue':_0x547c('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x547c('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x547c('0x3')](_0x547c('0x4'))},'cc':{'type':Sequelize[_0x547c('0x3')](_0x547c('0x4'))},'bcc':{'type':Sequelize[_0x547c('0x3')](_0x547c('0x4'))},'subject':{'type':Sequelize[_0x547c('0x3')]},'sentAt':{'type':Sequelize[_0x547c('0x9')]},'attach':{'type':Sequelize[_0x547c('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x547c('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x547c('0x9')]},'originTo':{'type':Sequelize[_0x547c('0x3')](_0x547c('0x4'))},'originCc':{'type':Sequelize[_0x547c('0x3')](_0x547c('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 3f48024..b36b9dc 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 _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','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','redis','defaults','localhost','./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'];(function(_0x3385ff,_0x29433d){var _0x56f2d2=function(_0x1f179c){while(--_0x1f179c){_0x3385ff['push'](_0x3385ff['shift']());}};_0x56f2d2(++_0x29433d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file +var _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','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','redis','defaults','localhost','./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'];(function(_0x543e78,_0x476ffa){var _0x10d803=function(_0x164e5e){while(--_0x164e5e){_0x543e78['push'](_0x543e78['shift']());}};_0x10d803(++_0x476ffa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 6d82c69..f71d7c4 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 _0x4a3c=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailMessage','save'];(function(_0x52f65d,_0x311e6a){var _0x270461=function(_0x3665d8){while(--_0x3665d8){_0x52f65d['push'](_0x52f65d['shift']());}};_0x270461(++_0x311e6a);}(_0x4a3c,0x11c));var _0xc4a3=function(_0x338214,_0x47c9d9){_0x338214=_0x338214-0x0;var _0x59aed2=_0x4a3c[_0x338214];return _0x59aed2;};'use strict';var EventEmitter=require(_0xc4a3('0x0'));var MailMessage=require(_0xc4a3('0x1'))['db'][_0xc4a3('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc4a3('0x3'),'afterUpdate':_0xc4a3('0x4'),'afterDestroy':_0xc4a3('0x5')};function emitEvent(_0x4147a5){return function(_0x33e0b2,_0x132eb7,_0x11f0a4){MailMessageEvents[_0xc4a3('0x6')](_0x4147a5+':'+_0x33e0b2['id'],_0x33e0b2);MailMessageEvents['emit'](_0x4147a5,_0x33e0b2);_0x11f0a4(null);};}for(var e in events){if(events[_0xc4a3('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xc4a3('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x0cd2=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2cbd7d,_0x52db1e){var _0x56a4f0=function(_0x519629){while(--_0x519629){_0x2cbd7d['push'](_0x2cbd7d['shift']());}};_0x56a4f0(++_0x52db1e);}(_0x0cd2,0x18d));var _0x20cd=function(_0x19052b,_0x2bd01c){_0x19052b=_0x19052b-0x0;var _0x355cfc=_0x0cd2[_0x19052b];return _0x355cfc;};'use strict';var EventEmitter=require(_0x20cd('0x0'));var MailMessage=require(_0x20cd('0x1'))['db'][_0x20cd('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x20cd('0x3')](0x0);var events={'afterCreate':_0x20cd('0x4'),'afterUpdate':_0x20cd('0x5'),'afterDestroy':_0x20cd('0x6')};function emitEvent(_0x303380){return function(_0x57bebd,_0x532aba,_0x261ee5){MailMessageEvents[_0x20cd('0x7')](_0x303380+':'+_0x57bebd['id'],_0x57bebd);MailMessageEvents[_0x20cd('0x7')](_0x303380,_0x57bebd);_0x261ee5(null);};}for(var e in events){if(events[_0x20cd('0x8')](e)){var event=events[e];MailMessage[_0x20cd('0x9')](e,emitEvent(event));}}module[_0x20cd('0xa')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index a7e244e..9e4e137 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 _0x06a5=['fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0x06a5,0x1f1));var _0x506a=function(_0x4c2905,_0x3c9401){_0x4c2905=_0x4c2905-0x0;var _0x5595f5=_0x06a5[_0x4c2905];return _0x5595f5;};'use strict';var _=require('lodash');var util=require(_0x506a('0x0'));var logger=require(_0x506a('0x1'))(_0x506a('0x2'));var moment=require(_0x506a('0x3'));var BPromise=require(_0x506a('0x4'));var rp=require(_0x506a('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x506a('0x6'));var rimraf=require('rimraf');var config=require(_0x506a('0x7'));var attributes=require(_0x506a('0x8'));module['exports']=function(_0x5a33c9,_0x598178){return _0x5a33c9[_0x506a('0x9')](_0x506a('0xa'),attributes,{'tableName':_0x506a('0xb'),'paranoid':![],'indexes':[{'name':_0x506a('0xc'),'fields':[_0x506a('0xc')]},{'name':_0x506a('0xd'),'fields':[_0x506a('0xe'),_0x506a('0xf')],'type':_0x506a('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b0d6a,_0x38977c,_0x3f472a){if(_0x1b0d6a[_0x506a('0x11')]){_0x1b0d6a[_0x506a('0xe')]=htmlToText[_0x506a('0x12')](_0x1b0d6a[_0x506a('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3f472a(null,_0x38977c);},'afterCreate':function(_0x5321ab,_0x1a0e7c,_0x4cdbef){var _0x4e7154=_0x5a33c9[_0x506a('0x13')];var _0x42f133=_0x5321ab[_0x506a('0x14')]({'plain':!![]});if(_0x42f133[_0x506a('0x15')][_0x506a('0x16')]()==='in'||_0x42f133[_0x506a('0x15')][_0x506a('0x16')]()===_0x506a('0x17')&&!_0x42f133[_0x506a('0x18')]&&!_['isNil'](_0x42f133[_0x506a('0x19')])){_0x4e7154[_0x506a('0x1a')][_0x506a('0x1b')]({'where':{'id':_0x42f133[_0x506a('0x1c')]}})[_0x506a('0x1d')](function(_0x300c5d){if(_0x300c5d){_0x300c5d['update']({'lastMsgAt':_0x42f133['createdAt'],'lastMsgDirection':_0x42f133['direction']['toLowerCase'](),'lastMsgBody':_0x42f133['body']});}})[_0x506a('0x1e')](function(_0x4c3883){console[_0x506a('0x1f')](_0x4c3883);});}_0x4cdbef();}},'charset':_0x506a('0x20'),'collate':_0x506a('0x21')});}; \ No newline at end of file +var _0x54c7=['isNil','UserId','findOne','createdAt','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','direction','toLowerCase','out','secret'];(function(_0x28f675,_0x17bb9c){var _0x5f2f12=function(_0x497563){while(--_0x497563){_0x28f675['push'](_0x28f675['shift']());}};_0x5f2f12(++_0x17bb9c);}(_0x54c7,0x1d4));var _0x754c=function(_0x1d5e5c,_0x405a91){_0x1d5e5c=_0x1d5e5c-0x0;var _0x466020=_0x54c7[_0x1d5e5c];return _0x466020;};'use strict';var _=require(_0x754c('0x0'));var util=require(_0x754c('0x1'));var logger=require(_0x754c('0x2'))(_0x754c('0x3'));var moment=require(_0x754c('0x4'));var BPromise=require(_0x754c('0x5'));var rp=require(_0x754c('0x6'));var htmlToText=require(_0x754c('0x7'));var fs=require('fs');var path=require(_0x754c('0x8'));var rimraf=require(_0x754c('0x9'));var config=require(_0x754c('0xa'));var attributes=require(_0x754c('0xb'));module['exports']=function(_0x573527,_0x1a5697){return _0x573527[_0x754c('0xc')](_0x754c('0xd'),attributes,{'tableName':_0x754c('0xe'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x754c('0xf')]},{'name':_0x754c('0x10'),'fields':[_0x754c('0x11'),_0x754c('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5e8556,_0x3896b7,_0x2563ee){if(_0x5e8556[_0x754c('0x13')]){_0x5e8556[_0x754c('0x11')]=htmlToText[_0x754c('0x14')](_0x5e8556[_0x754c('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2563ee(null,_0x3896b7);},'afterCreate':function(_0x41e141,_0x2f3754,_0xe76af2){var _0x36d9b8=_0x573527[_0x754c('0x15')];var _0x38d89c=_0x41e141[_0x754c('0x16')]({'plain':!![]});if(_0x38d89c[_0x754c('0x17')][_0x754c('0x18')]()==='in'||_0x38d89c[_0x754c('0x17')][_0x754c('0x18')]()===_0x754c('0x19')&&!_0x38d89c[_0x754c('0x1a')]&&!_[_0x754c('0x1b')](_0x38d89c[_0x754c('0x1c')])){_0x36d9b8['MailInteraction'][_0x754c('0x1d')]({'where':{'id':_0x38d89c['MailInteractionId']}})['then'](function(_0x518862){if(_0x518862){_0x518862['update']({'lastMsgAt':_0x38d89c[_0x754c('0x1e')],'lastMsgDirection':_0x38d89c[_0x754c('0x17')]['toLowerCase'](),'lastMsgBody':_0x38d89c[_0x754c('0x13')]});}})[_0x754c('0x1f')](function(_0x39ff94){console[_0x754c('0x20')](_0x39ff94);});}_0xe76af2();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 5ab46e3..1829224 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 _0x3845=['http','redis','defaults','localhost','./mailMessage.socket','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','message','MailMessage,\x20%s,\x20%s','result','catch','MailMessage','create','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1e9a78,_0x174858){var _0x317002=function(_0x4fbcde){while(--_0x4fbcde){_0x1e9a78['push'](_0x1e9a78['shift']());}};_0x317002(++_0x174858);}(_0x3845,0x9e));var _0x5384=function(_0xed8af6,_0x1b864f){_0xed8af6=_0xed8af6-0x0;var _0x47a4d8=_0x3845[_0xed8af6];return _0x47a4d8;};'use strict';var _=require(_0x5384('0x0'));var util=require(_0x5384('0x1'));var moment=require(_0x5384('0x2'));var BPromise=require(_0x5384('0x3'));var rs=require(_0x5384('0x4'));var fs=require('fs');var Redis=require(_0x5384('0x5'));var db=require(_0x5384('0x6'))['db'];var utils=require(_0x5384('0x7'));var logger=require(_0x5384('0x8'))('rpc');var config=require(_0x5384('0x9'));var jayson=require(_0x5384('0xa'));var client=jayson[_0x5384('0xb')][_0x5384('0xc')]({'port':0x232a});config[_0x5384('0xd')]=_[_0x5384('0xe')](config['redis'],{'host':_0x5384('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5384('0xd')]));require(_0x5384('0x10'))['register'](socket);function respondWithRpcPromise(_0x318055,_0x35a984,_0x464af5){return new BPromise(function(_0x163677,_0x17951b){return client[_0x5384('0x11')](_0x318055,_0x464af5)[_0x5384('0x12')](function(_0x458c99){logger[_0x5384('0x13')]('MailMessage,\x20%s,\x20%s',_0x35a984,_0x5384('0x14'));logger['debug'](_0x5384('0x15'),_0x35a984,_0x5384('0x14'),JSON['stringify'](_0x458c99));if(_0x458c99['error']){if(_0x458c99[_0x5384('0x16')]['code']===0x1f4){logger[_0x5384('0x16')]('MailMessage,\x20%s,\x20%s',_0x35a984,_0x458c99[_0x5384('0x16')]['message']);return _0x17951b(_0x458c99[_0x5384('0x16')][_0x5384('0x17')]);}logger['error'](_0x5384('0x18'),_0x35a984,_0x458c99['error']['message']);return _0x163677(_0x458c99[_0x5384('0x16')]['message']);}else{logger['info'](_0x5384('0x18'),_0x35a984,_0x5384('0x14'));_0x163677(_0x458c99[_0x5384('0x19')][_0x5384('0x17')]);}})[_0x5384('0x1a')](function(_0x4f4d0b){logger[_0x5384('0x16')](_0x5384('0x18'),_0x35a984,_0x4f4d0b);_0x17951b(_0x4f4d0b);});});}exports['CreateMailMessage']=function(_0x283aa8){var _0x1b4419=this;return new Promise(function(_0x14d71c,_0x217119){return db[_0x5384('0x1b')][_0x5384('0x1c')](_0x283aa8[_0x5384('0x1d')],{'raw':_0x283aa8[_0x5384('0x1e')]?_0x283aa8['options'][_0x5384('0x1f')]===undefined?!![]:![]:!![]})[_0x5384('0x12')](function(_0x5d1617){logger[_0x5384('0x13')](_0x5384('0x20'),_0x283aa8);logger['debug']('CreateMailMessage',_0x283aa8,JSON[_0x5384('0x21')](_0x5d1617));_0x14d71c(_0x5d1617);})[_0x5384('0x1a')](function(_0x77041c){logger[_0x5384('0x16')](_0x5384('0x20'),_0x77041c[_0x5384('0x17')],_0x283aa8);_0x217119(_0x1b4419[_0x5384('0x16')](0x1f4,_0x77041c[_0x5384('0x17')]));});});}; \ No newline at end of file +var _0xacb8=['request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','CreateMailMessage','MailMessage','create','body','options','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x1058da,_0x27b7c6){var _0x14da71=function(_0x910c91){while(--_0x910c91){_0x1058da['push'](_0x1058da['shift']());}};_0x14da71(++_0x27b7c6);}(_0xacb8,0x119));var _0x8acb=function(_0x1a4c0b,_0x315038){_0x1a4c0b=_0x1a4c0b-0x0;var _0x24d5c0=_0xacb8[_0x1a4c0b];return _0x24d5c0;};'use strict';var _=require(_0x8acb('0x0'));var util=require('util');var moment=require(_0x8acb('0x1'));var BPromise=require(_0x8acb('0x2'));var rs=require(_0x8acb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8acb('0x4'))['db'];var utils=require(_0x8acb('0x5'));var logger=require('../../config/logger')(_0x8acb('0x6'));var config=require(_0x8acb('0x7'));var jayson=require(_0x8acb('0x8'));var client=jayson[_0x8acb('0x9')][_0x8acb('0xa')]({'port':0x232a});config[_0x8acb('0xb')]=_['defaults'](config[_0x8acb('0xb')],{'host':_0x8acb('0xc'),'port':0x18eb});var socket=require(_0x8acb('0xd'))(new Redis(config[_0x8acb('0xb')]));require(_0x8acb('0xe'))[_0x8acb('0xf')](socket);function respondWithRpcPromise(_0x4e3dee,_0x559dd6,_0x444897){return new BPromise(function(_0xd30d24,_0x4b7df9){return client[_0x8acb('0x10')](_0x4e3dee,_0x444897)['then'](function(_0x3437b0){logger[_0x8acb('0x11')]('MailMessage,\x20%s,\x20%s',_0x559dd6,_0x8acb('0x12'));logger[_0x8acb('0x13')](_0x8acb('0x14'),_0x559dd6,_0x8acb('0x12'),JSON[_0x8acb('0x15')](_0x3437b0));if(_0x3437b0['error']){if(_0x3437b0[_0x8acb('0x16')][_0x8acb('0x17')]===0x1f4){logger[_0x8acb('0x16')](_0x8acb('0x18'),_0x559dd6,_0x3437b0[_0x8acb('0x16')][_0x8acb('0x19')]);return _0x4b7df9(_0x3437b0['error'][_0x8acb('0x19')]);}logger[_0x8acb('0x16')](_0x8acb('0x18'),_0x559dd6,_0x3437b0[_0x8acb('0x16')][_0x8acb('0x19')]);return _0xd30d24(_0x3437b0[_0x8acb('0x16')][_0x8acb('0x19')]);}else{logger[_0x8acb('0x11')](_0x8acb('0x18'),_0x559dd6,'request\x20sent');_0xd30d24(_0x3437b0[_0x8acb('0x1a')][_0x8acb('0x19')]);}})['catch'](function(_0x4d6d45){logger[_0x8acb('0x16')]('MailMessage,\x20%s,\x20%s',_0x559dd6,_0x4d6d45);_0x4b7df9(_0x4d6d45);});});}exports[_0x8acb('0x1b')]=function(_0x1a9ba4){var _0x588325=this;return new Promise(function(_0x23569f,_0x926cd7){return db[_0x8acb('0x1c')][_0x8acb('0x1d')](_0x1a9ba4[_0x8acb('0x1e')],{'raw':_0x1a9ba4[_0x8acb('0x1f')]?_0x1a9ba4[_0x8acb('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x316258){logger[_0x8acb('0x11')](_0x8acb('0x1b'),_0x1a9ba4);logger[_0x8acb('0x13')](_0x8acb('0x1b'),_0x1a9ba4,JSON[_0x8acb('0x15')](_0x316258));_0x23569f(_0x316258);})[_0x8acb('0x20')](function(_0x5b3e8f){logger['error'](_0x8acb('0x1b'),_0x5b3e8f['message'],_0x1a9ba4);_0x926cd7(_0x588325[_0x8acb('0x16')](0x1f4,_0x5b3e8f['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 8f7c761..aface05 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 _0xb957=['length','remove','removeListener','register'];(function(_0x295ece,_0x55ed2d){var _0x47a60e=function(_0x554fd2){while(--_0x554fd2){_0x295ece['push'](_0x295ece['shift']());}};_0x47a60e(++_0x55ed2d);}(_0xb957,0x6d));var _0x7b95=function(_0x5643d8,_0x388e5b){_0x5643d8=_0x5643d8-0x0;var _0x37fbd2=_0xb957[_0x5643d8];return _0x37fbd2;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x7b95('0x0'),'update'];function createListener(_0x477577,_0x24ded4){return function(_0xef509a){_0x24ded4['emit'](_0x477577,_0xef509a);};}function removeListener(_0x45db17,_0x2c8a4d){return function(){MailMessageEvents[_0x7b95('0x1')](_0x45db17,_0x2c8a4d);};}exports[_0x7b95('0x2')]=function(_0x19ff14){for(var _0x518099=0x0,_0x2912d5=events[_0x7b95('0x3')];_0x518099<_0x2912d5;_0x518099++){var _0x161768=events[_0x518099];var _0x495bea=createListener('mailMessage:'+_0x161768,_0x19ff14);MailMessageEvents['on'](_0x161768,_0x495bea);}}; \ No newline at end of file +var _0xc698=['remove','removeListener','register','length','mailMessage:','./mailMessage.events','save'];(function(_0x19ee96,_0x48b7d5){var _0x57aaf0=function(_0x26f332){while(--_0x26f332){_0x19ee96['push'](_0x19ee96['shift']());}};_0x57aaf0(++_0x48b7d5);}(_0xc698,0x116));var _0x8c69=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xc698[_0x1c546c];return _0x2cc384;};'use strict';var MailMessageEvents=require(_0x8c69('0x0'));var events=[_0x8c69('0x1'),_0x8c69('0x2'),'update'];function createListener(_0xc4ba5e,_0x2285a9){return function(_0x3183c1){_0x2285a9['emit'](_0xc4ba5e,_0x3183c1);};}function removeListener(_0x18a076,_0x4d29b1){return function(){MailMessageEvents[_0x8c69('0x3')](_0x18a076,_0x4d29b1);};}exports[_0x8c69('0x4')]=function(_0x47902d){for(var _0x58bc06=0x0,_0x468970=events[_0x8c69('0x5')];_0x58bc06<_0x468970;_0x58bc06++){var _0x128b7b=events[_0x58bc06];var _0x14269f=createListener(_0x8c69('0x6')+_0x128b7b,_0x47902d);MailMessageEvents['on'](_0x128b7b,_0x14269f);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 3731406..b028882 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 _0x5e08=['removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','delete','destroy','removeTeams'];(function(_0x29f258,_0x559572){var _0x1315c7=function(_0x140cde){while(--_0x140cde){_0x29f258['push'](_0x29f258['shift']());}};_0x1315c7(++_0x559572);}(_0x5e08,0x1d2));var _0x85e0=function(_0x269cea,_0x405ef7){_0x269cea=_0x269cea-0x0;var _0x1c6598=_0x5e08[_0x269cea];return _0x1c6598;};'use strict';var multer=require(_0x85e0('0x0'));var util=require(_0x85e0('0x1'));var path=require(_0x85e0('0x2'));var timeout=require(_0x85e0('0x3'));var express=require(_0x85e0('0x4'));var router=express[_0x85e0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x85e0('0x6'));var config=require(_0x85e0('0x7'));var controller=require(_0x85e0('0x8'));router[_0x85e0('0x9')]('/',auth[_0x85e0('0xa')](),controller[_0x85e0('0xb')]);router[_0x85e0('0x9')](_0x85e0('0xc'),auth[_0x85e0('0xa')](),controller[_0x85e0('0xd')]);router['get'](_0x85e0('0xe'),auth[_0x85e0('0xa')](),controller[_0x85e0('0xf')]);router[_0x85e0('0x9')](_0x85e0('0x10'),auth[_0x85e0('0xa')](),controller[_0x85e0('0x11')]);router[_0x85e0('0x9')](_0x85e0('0x12'),auth[_0x85e0('0xa')](),controller[_0x85e0('0x13')]);router[_0x85e0('0x9')](_0x85e0('0x14'),auth['isAuthenticated'](),controller[_0x85e0('0x15')]);router['post']('/',auth[_0x85e0('0xa')](),controller[_0x85e0('0x16')]);router[_0x85e0('0x17')](_0x85e0('0x12'),auth[_0x85e0('0xa')](),controller[_0x85e0('0x18')]);router[_0x85e0('0x17')](_0x85e0('0x14'),auth[_0x85e0('0xa')](),controller[_0x85e0('0x19')]);router[_0x85e0('0x1a')](_0x85e0('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x85e0('0x1b')](_0x85e0('0xe'),auth['isAuthenticated'](),controller[_0x85e0('0x1c')]);router[_0x85e0('0x1b')]('/:id/teams',auth['isAuthenticated'](),controller[_0x85e0('0x1d')]);router['delete'](_0x85e0('0x14'),auth[_0x85e0('0xa')](),controller[_0x85e0('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x6818=['/:id','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','delete','removeAgents','exports','path','../../components/interaction/service','./mailQueue.controller','get','/describe','isAuthenticated','describe'];(function(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0x6818,0x1ae));var _0x8681=function(_0x4b030a,_0x163428){_0x4b030a=_0x4b030a-0x0;var _0x430fdd=_0x6818[_0x4b030a];return _0x430fdd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8681('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8681('0x1'));var config=require('../../config/environment');var controller=require(_0x8681('0x2'));router[_0x8681('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8681('0x3')](_0x8681('0x4'),auth[_0x8681('0x5')](),controller[_0x8681('0x6')]);router[_0x8681('0x3')](_0x8681('0x7'),auth[_0x8681('0x5')](),controller['show']);router[_0x8681('0x3')](_0x8681('0x8'),auth[_0x8681('0x5')](),controller['getMembers']);router['get'](_0x8681('0x9'),auth[_0x8681('0x5')](),controller['getTeams']);router[_0x8681('0x3')](_0x8681('0xa'),auth['isAuthenticated'](),controller[_0x8681('0xb')]);router[_0x8681('0xc')]('/',auth[_0x8681('0x5')](),controller[_0x8681('0xd')]);router[_0x8681('0xc')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8681('0xe')]);router[_0x8681('0xc')]('/:id/users',auth[_0x8681('0x5')](),controller[_0x8681('0xf')]);router['put'](_0x8681('0x7'),auth[_0x8681('0x5')](),controller['update']);router[_0x8681('0x10')](_0x8681('0x7'),auth[_0x8681('0x5')](),controller['destroy']);router[_0x8681('0x10')](_0x8681('0x9'),auth[_0x8681('0x5')](),controller['removeTeams']);router[_0x8681('0x10')]('/:id/users',auth[_0x8681('0x5')](),controller[_0x8681('0x11')]);module[_0x8681('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f4ccecd..cae85aa 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 _0x686f=['name','INTEGER','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x686f,0x108));var _0xf686=function(_0x18b168,_0x5341d5){_0x18b168=_0x18b168-0x0;var _0x365671=_0x686f[_0x18b168];return _0x365671;};'use strict';var Sequelize=require('sequelize');module[_0xf686('0x0')]={'name':{'type':Sequelize[_0xf686('0x1')],'unique':_0xf686('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf686('0x1')]},'timeout':{'type':Sequelize[_0xf686('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf686('0x4'),_0xf686('0x5'),_0xf686('0x6'))}}; \ No newline at end of file +var _0x7918=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x372bae,_0xd5357c){var _0xfce3f4=function(_0x1b90d4){while(--_0x1b90d4){_0x372bae['push'](_0x372bae['shift']());}};_0xfce3f4(++_0xd5357c);}(_0x7918,0x1e1));var _0x8791=function(_0x42b148,_0x21580f){_0x42b148=_0x42b148-0x0;var _0x2ae507=_0x7918[_0x42b148];return _0x2ae507;};'use strict';var Sequelize=require(_0x8791('0x0'));module[_0x8791('0x1')]={'name':{'type':Sequelize[_0x8791('0x2')],'unique':_0x8791('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8791('0x2')]},'timeout':{'type':Sequelize[_0x8791('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8791('0x5')](_0x8791('0x6'),'beepall',_0x8791('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 36a3b78..179f682 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 _0xf3a8=['Content-Range','apply','reject','update','then','destroy','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','keys','length','include','MailQueue','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','findOne','UserMailQueue','hasOwnProperty','pick','findAndCountAll','UserId','agent','mailPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','User','select','field','tq.TeamId','from','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./mailQueue.socket','register','status','end','json','count','offset','limit'];(function(_0x1551ea,_0x21272d){var _0xe06058=function(_0x13662c){while(--_0x13662c){_0x1551ea['push'](_0x1551ea['shift']());}};_0xe06058(++_0x21272d);}(_0xf3a8,0xf2));var _0x8f3a=function(_0x14564e,_0xf5dc91){_0x14564e=_0x14564e-0x0;var _0x5eb2c5=_0xf3a8[_0x14564e];return _0x5eb2c5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8f3a('0x0'));var rimraf=require(_0x8f3a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f3a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8f3a('0x3'));var Mustache=require('mustache');var util=require(_0x8f3a('0x4'));var path=require('path');var sox=require(_0x8f3a('0x5'));var csv=require(_0x8f3a('0x6'));var ejs=require(_0x8f3a('0x7'));var fs=require('fs');var _=require(_0x8f3a('0x8'));var squel=require(_0x8f3a('0x9'));var crypto=require(_0x8f3a('0xa'));var jsforce=require(_0x8f3a('0xb'));var deskjs=require(_0x8f3a('0xc'));var toCsv=require(_0x8f3a('0x6'));var querystring=require('querystring');var Papa=require(_0x8f3a('0xd'));var Redis=require('ioredis');var authService=require(_0x8f3a('0xe'));var qs=require(_0x8f3a('0xf'));var as=require(_0x8f3a('0x10'));var hardwareService=require(_0x8f3a('0x11'));var logger=require(_0x8f3a('0x12'))('api');var utils=require(_0x8f3a('0x13'));var config=require(_0x8f3a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f3a('0x15'))['db'];config['redis']=_['defaults'](config[_0x8f3a('0x16')],{'host':_0x8f3a('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f3a('0x16')]));require(_0x8f3a('0x18'))[_0x8f3a('0x19')](socket);function respondWithStatusCode(_0x5c4c6c,_0x297d9b){_0x297d9b=_0x297d9b||0xcc;return function(_0x475f2a){if(_0x475f2a){return _0x5c4c6c['sendStatus'](_0x297d9b);}return _0x5c4c6c[_0x8f3a('0x1a')](_0x297d9b)[_0x8f3a('0x1b')]();};}function respondWithResult(_0x4ad8ee,_0x2a491a){_0x2a491a=_0x2a491a||0xc8;return function(_0x2f9c72){if(_0x2f9c72){return _0x4ad8ee[_0x8f3a('0x1a')](_0x2a491a)[_0x8f3a('0x1c')](_0x2f9c72);}};}function respondWithFilteredResult(_0x2a7c0c,_0x512d94){return function(_0x451aee){if(_0x451aee){var _0x2b05ef=_0x451aee[_0x8f3a('0x1d')],_0x17c14c=_0x512d94['offset'],_0x3a0b94=_0x512d94[_0x8f3a('0x1e')]+_0x512d94[_0x8f3a('0x1f')],_0x31e4cc;if(_0x3a0b94>=_0x2b05ef){_0x3a0b94=_0x2b05ef;_0x31e4cc=0xc8;}else{_0x31e4cc=0xce;}_0x2a7c0c[_0x8f3a('0x1a')](_0x31e4cc);return _0x2a7c0c['set'](_0x8f3a('0x20'),_0x17c14c+'-'+_0x3a0b94+'/'+_0x2b05ef)['json'](_0x451aee);}return null;};}function patchUpdates(_0x2fc64d){return function(_0x356f72){try{jsonpatch[_0x8f3a('0x21')](_0x356f72,_0x2fc64d,!![]);}catch(_0x1428e5){return BPromise[_0x8f3a('0x22')](_0x1428e5);}return _0x356f72['save']();};}function saveUpdates(_0x5a6177,_0xa34219){return function(_0x32e4dc){if(_0x32e4dc){return _0x32e4dc[_0x8f3a('0x23')](_0x5a6177)[_0x8f3a('0x24')](function(_0x5a72d4){return _0x5a72d4;});}return null;};}function removeEntity(_0x556a88,_0x37f23b){return function(_0x5b0211){if(_0x5b0211){return _0x5b0211[_0x8f3a('0x25')]()[_0x8f3a('0x24')](function(){var _0x5e47ab=_0x5b0211['get']({'plain':!![]});var _0x49f6c5='MailQueues';return db[_0x8f3a('0x26')]['destroy']({'where':{'type':_0x49f6c5,'resourceId':_0x5e47ab['id']}})['then'](function(){return _0x5b0211;});})[_0x8f3a('0x24')](function(){_0x556a88[_0x8f3a('0x1a')](0xcc)[_0x8f3a('0x1b')]();});}};}function handleEntityNotFound(_0x87656f,_0x2db288){return function(_0x281d9b){if(!_0x281d9b){_0x87656f[_0x8f3a('0x27')](0x194);}return _0x281d9b;};}function handleError(_0xd618ee,_0x3f827f){_0x3f827f=_0x3f827f||0x1f4;return function(_0x12f0ba){logger['error'](_0x12f0ba[_0x8f3a('0x28')]);if(_0x12f0ba['name']){delete _0x12f0ba[_0x8f3a('0x29')];}_0xd618ee[_0x8f3a('0x1a')](_0x3f827f)[_0x8f3a('0x2a')](_0x12f0ba);};}exports[_0x8f3a('0x2b')]=function(_0x1ba5ef,_0x5f5874){var _0x3d7414={},_0x1c6255={},_0x779f0b={'count':0x0,'rows':[]};var _0x3c377f=_[_0x8f3a('0x2c')](db['MailQueue'][_0x8f3a('0x2d')],function(_0xe7c54b){return{'name':_0xe7c54b[_0x8f3a('0x2e')],'type':_0xe7c54b[_0x8f3a('0x2f')][_0x8f3a('0x30')]};});_0x1c6255[_0x8f3a('0x31')]=_[_0x8f3a('0x2c')](_0x3c377f,_0x8f3a('0x29'));_0x1c6255['query']=_['keys'](_0x1ba5ef['query']);_0x1c6255[_0x8f3a('0x32')]=_[_0x8f3a('0x33')](_0x1c6255[_0x8f3a('0x31')],_0x1c6255[_0x8f3a('0x34')]);_0x3d7414['attributes']=_[_0x8f3a('0x33')](_0x1c6255[_0x8f3a('0x31')],qs[_0x8f3a('0x35')](_0x1ba5ef[_0x8f3a('0x34')][_0x8f3a('0x35')]));_0x3d7414[_0x8f3a('0x36')]=_0x3d7414[_0x8f3a('0x36')]['length']?_0x3d7414[_0x8f3a('0x36')]:_0x1c6255[_0x8f3a('0x31')];if(!_0x1ba5ef[_0x8f3a('0x34')]['hasOwnProperty'](_0x8f3a('0x37'))){_0x3d7414[_0x8f3a('0x1f')]=qs[_0x8f3a('0x1f')](_0x1ba5ef[_0x8f3a('0x34')][_0x8f3a('0x1f')]);_0x3d7414['offset']=qs['offset'](_0x1ba5ef[_0x8f3a('0x34')][_0x8f3a('0x1e')]);}_0x3d7414[_0x8f3a('0x38')]=qs[_0x8f3a('0x39')](_0x1ba5ef[_0x8f3a('0x34')][_0x8f3a('0x39')]);_0x3d7414[_0x8f3a('0x3a')]=qs[_0x8f3a('0x32')](_['pick'](_0x1ba5ef[_0x8f3a('0x34')],_0x1c6255['filters']),_0x3c377f);if(_0x1ba5ef[_0x8f3a('0x34')][_0x8f3a('0x3b')]){_0x3d7414[_0x8f3a('0x3a')]=_['merge'](_0x3d7414[_0x8f3a('0x3a')],{'$or':_[_0x8f3a('0x2c')](_0x3c377f,function(_0x346420){if(_0x346420[_0x8f3a('0x2f')]!==_0x8f3a('0x3c')){var _0x3ce61c={};_0x3ce61c[_0x346420[_0x8f3a('0x29')]]={'$like':'%'+_0x1ba5ef[_0x8f3a('0x34')][_0x8f3a('0x3b')]+'%'};return _0x3ce61c;}})});}_0x3d7414=_[_0x8f3a('0x3d')]({},_0x3d7414,_0x1ba5ef[_0x8f3a('0x3e')]);var _0x18d0d1={'where':_0x3d7414[_0x8f3a('0x3a')]};return db['MailQueue'][_0x8f3a('0x1d')](_0x18d0d1)[_0x8f3a('0x24')](function(_0xea9dce){_0x779f0b[_0x8f3a('0x1d')]=_0xea9dce;if(_0x1ba5ef[_0x8f3a('0x34')][_0x8f3a('0x3f')]){_0x3d7414['include']=[{'all':!![]}];}return db['MailQueue'][_0x8f3a('0x40')](_0x3d7414);})[_0x8f3a('0x24')](function(_0x4a50a9){_0x779f0b[_0x8f3a('0x41')]=_0x4a50a9;return _0x779f0b;})[_0x8f3a('0x24')](respondWithFilteredResult(_0x5f5874,_0x3d7414))[_0x8f3a('0x42')](handleError(_0x5f5874,null));};exports[_0x8f3a('0x43')]=function(_0xe8d3f0,_0x1f304a){var _0x293d00={'raw':!![],'where':{'id':_0xe8d3f0['params']['id']}},_0x2654ae={};_0x2654ae[_0x8f3a('0x31')]=_[_0x8f3a('0x44')](db['MailQueue'][_0x8f3a('0x2d')]);_0x2654ae[_0x8f3a('0x34')]=_[_0x8f3a('0x44')](_0xe8d3f0[_0x8f3a('0x34')]);_0x2654ae['filters']=_[_0x8f3a('0x33')](_0x2654ae['model'],_0x2654ae[_0x8f3a('0x34')]);_0x293d00[_0x8f3a('0x36')]=_[_0x8f3a('0x33')](_0x2654ae[_0x8f3a('0x31')],qs[_0x8f3a('0x35')](_0xe8d3f0[_0x8f3a('0x34')][_0x8f3a('0x35')]));_0x293d00[_0x8f3a('0x36')]=_0x293d00[_0x8f3a('0x36')][_0x8f3a('0x45')]?_0x293d00[_0x8f3a('0x36')]:_0x2654ae[_0x8f3a('0x31')];if(_0xe8d3f0['query']['includeAll']){_0x293d00[_0x8f3a('0x46')]=[{'all':!![]}];}_0x293d00=_['merge']({},_0x293d00,_0xe8d3f0['options']);return db[_0x8f3a('0x47')][_0x8f3a('0x48')](_0x293d00)['then'](handleEntityNotFound(_0x1f304a,null))[_0x8f3a('0x24')](respondWithResult(_0x1f304a,null))[_0x8f3a('0x42')](handleError(_0x1f304a,null));};exports[_0x8f3a('0x49')]=function(_0x373f61,_0x416870){return db[_0x8f3a('0x47')][_0x8f3a('0x49')](_0x373f61['body'],{})[_0x8f3a('0x24')](function(_0x71343a){var _0x48c98b=_0x373f61[_0x8f3a('0x4a')][_0x8f3a('0x4b')]({'plain':!![]});if(!_0x48c98b)throw new Error(_0x8f3a('0x4c'));if(_0x48c98b[_0x8f3a('0x4d')]==='user'){var _0x3c6996=_0x71343a[_0x8f3a('0x4b')]({'plain':!![]});var _0x25e562='MailQueues';return db[_0x8f3a('0x4e')][_0x8f3a('0x48')]({'where':{'name':_0x25e562,'userProfileId':_0x48c98b['userProfileId']},'raw':!![]})[_0x8f3a('0x24')](function(_0x3baa4d){if(_0x3baa4d&&_0x3baa4d['autoAssociation']===0x0){return db[_0x8f3a('0x26')][_0x8f3a('0x49')]({'name':_0x3c6996['name'],'resourceId':_0x3c6996['id'],'type':_0x3baa4d[_0x8f3a('0x29')],'sectionId':_0x3baa4d['id']},{})[_0x8f3a('0x24')](function(){return _0x71343a;});}else{return _0x71343a;}})[_0x8f3a('0x42')](function(_0xe795a5){logger[_0x8f3a('0x4f')](_0x8f3a('0x50'),_0xe795a5);throw _0xe795a5;});}return _0x71343a;})[_0x8f3a('0x24')](respondWithResult(_0x416870,0xc9))[_0x8f3a('0x42')](handleError(_0x416870,null));};exports[_0x8f3a('0x23')]=function(_0x804189,_0x544878){if(_0x804189[_0x8f3a('0x51')]['id']){delete _0x804189[_0x8f3a('0x51')]['id'];}return db[_0x8f3a('0x47')][_0x8f3a('0x48')]({'where':{'id':_0x804189[_0x8f3a('0x52')]['id']}})[_0x8f3a('0x24')](handleEntityNotFound(_0x544878,null))['then'](saveUpdates(_0x804189[_0x8f3a('0x51')],null))['then'](respondWithResult(_0x544878,null))[_0x8f3a('0x42')](handleError(_0x544878,null));};exports[_0x8f3a('0x25')]=function(_0x391a52,_0x1284db){return db[_0x8f3a('0x47')][_0x8f3a('0x48')]({'where':{'id':_0x391a52[_0x8f3a('0x52')]['id']}})[_0x8f3a('0x24')](handleEntityNotFound(_0x1284db,null))[_0x8f3a('0x24')](removeEntity(_0x1284db,null))['catch'](handleError(_0x1284db,null));};exports[_0x8f3a('0x53')]=function(_0x284dcd,_0x1cddda){return db[_0x8f3a('0x47')][_0x8f3a('0x53')]()[_0x8f3a('0x24')](respondWithResult(_0x1cddda,null))[_0x8f3a('0x42')](handleError(_0x1cddda,null));};exports['getMembers']=function(_0x1d4155,_0x500b1a,_0x4eee8b){var _0x1aa51d={'raw':!![],'where':{}},_0x3abd1a={},_0x2ef51c;return db[_0x8f3a('0x47')][_0x8f3a('0x54')]({'where':{'id':_0x1d4155[_0x8f3a('0x52')]['id']}})[_0x8f3a('0x24')](handleEntityNotFound(_0x500b1a,null))[_0x8f3a('0x24')](function(_0x36cb3b){if(_0x36cb3b){_0x2ef51c=_0x36cb3b['get']({'plain':!![]});_0x3abd1a[_0x8f3a('0x31')]=_[_0x8f3a('0x44')](db[_0x8f3a('0x55')][_0x8f3a('0x2d')]);_0x3abd1a[_0x8f3a('0x34')]=_[_0x8f3a('0x44')](_0x1d4155[_0x8f3a('0x34')]);_0x3abd1a[_0x8f3a('0x32')]=_['intersection'](_0x3abd1a[_0x8f3a('0x31')],_0x3abd1a[_0x8f3a('0x34')]);_0x1aa51d[_0x8f3a('0x36')]=_[_0x8f3a('0x33')](_0x3abd1a[_0x8f3a('0x31')],qs[_0x8f3a('0x35')](_0x1d4155[_0x8f3a('0x34')]['fields']));_0x1aa51d[_0x8f3a('0x36')]=_0x1aa51d['attributes'][_0x8f3a('0x45')]?_0x1aa51d[_0x8f3a('0x36')]:_0x3abd1a[_0x8f3a('0x31')];if(!_0x1d4155[_0x8f3a('0x34')][_0x8f3a('0x56')](_0x8f3a('0x37'))){_0x1aa51d[_0x8f3a('0x1f')]=qs[_0x8f3a('0x1f')](_0x1d4155[_0x8f3a('0x34')][_0x8f3a('0x1f')]);_0x1aa51d[_0x8f3a('0x1e')]=qs[_0x8f3a('0x1e')](_0x1d4155['query'][_0x8f3a('0x1e')]);}_0x1aa51d[_0x8f3a('0x38')]=qs['sort'](_0x1d4155['query'][_0x8f3a('0x39')]);_0x1aa51d[_0x8f3a('0x3a')]=qs['filters'](_[_0x8f3a('0x57')](_0x1d4155[_0x8f3a('0x34')],_0x3abd1a[_0x8f3a('0x32')]));_0x1aa51d[_0x8f3a('0x3a')]['MailQueueId']=_0x36cb3b['id'];if(_0x1d4155[_0x8f3a('0x34')][_0x8f3a('0x3b')]){_0x1aa51d[_0x8f3a('0x3a')]=_[_0x8f3a('0x3d')](_0x1aa51d[_0x8f3a('0x3a')],{'$or':_[_0x8f3a('0x2c')](_0x1aa51d[_0x8f3a('0x36')],function(_0x318bd3){var _0x56d6ca={};_0x56d6ca[_0x318bd3]={'$like':'%'+_0x1d4155[_0x8f3a('0x34')][_0x8f3a('0x3b')]+'%'};return _0x56d6ca;})});}_0x1aa51d=_[_0x8f3a('0x3d')]({},_0x1aa51d,_0x1d4155['options']);return db[_0x8f3a('0x55')][_0x8f3a('0x40')](_0x1aa51d);}})[_0x8f3a('0x24')](function(_0x344c67){if(_0x344c67){return db['User'][_0x8f3a('0x58')]({'where':{'id':_['map'](_0x344c67,_0x8f3a('0x59')),'role':_0x8f3a('0x5a')},'attributes':['id','name',_0x8f3a('0x5b'),_0x8f3a('0x5c'),'createdAt']});}})[_0x8f3a('0x24')](function(_0x1401d8){if(_0x1401d8){return{'count':_0x1401d8[_0x8f3a('0x1d')],'rows':_[_0x8f3a('0x2c')](_0x1401d8['rows'],function(_0x3cbf5b){return{'membername':_0x3cbf5b['name'],'UserId':_0x3cbf5b['id'],'queue_name':_0x2ef51c['name'],'MailQueueId':_0x2ef51c['id'],'interface':util[_0x8f3a('0x5d')](_0x8f3a('0x5e'),'SIP',_0x3cbf5b['name']),'penalty':0x0,'paused':_0x3cbf5b[_0x8f3a('0x5b')],'createdAt':_0x3cbf5b[_0x8f3a('0x5f')],'updatedAt':_0x3cbf5b[_0x8f3a('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8f3a('0x24')](respondWithFilteredResult(_0x500b1a,_0x1aa51d))[_0x8f3a('0x42')](handleError(_0x500b1a,null));};exports[_0x8f3a('0x60')]=function(_0x2e9eca,_0x30ae06,_0x369f84){var _0xede8ef={};var _0x3d470f={};var _0xaf1492;var _0x2d2509;return db[_0x8f3a('0x47')][_0x8f3a('0x54')]({'where':{'id':_0x2e9eca[_0x8f3a('0x52')]['id']}})[_0x8f3a('0x24')](handleEntityNotFound(_0x30ae06,null))[_0x8f3a('0x24')](function(_0x3a5488){if(_0x3a5488){_0xaf1492=_0x3a5488;_0x3d470f[_0x8f3a('0x31')]=_[_0x8f3a('0x44')](db[_0x8f3a('0x61')][_0x8f3a('0x2d')]);_0x3d470f['query']=_[_0x8f3a('0x44')](_0x2e9eca[_0x8f3a('0x34')]);_0x3d470f['filters']=_['intersection'](_0x3d470f[_0x8f3a('0x31')],_0x3d470f[_0x8f3a('0x34')]);_0xede8ef['attributes']=_[_0x8f3a('0x33')](_0x3d470f[_0x8f3a('0x31')],qs[_0x8f3a('0x35')](_0x2e9eca[_0x8f3a('0x34')][_0x8f3a('0x35')]));_0xede8ef[_0x8f3a('0x36')]=_0xede8ef['attributes']['length']?_0xede8ef[_0x8f3a('0x36')]:_0x3d470f[_0x8f3a('0x31')];_0xede8ef['order']=qs[_0x8f3a('0x39')](_0x2e9eca[_0x8f3a('0x34')][_0x8f3a('0x39')]);_0xede8ef[_0x8f3a('0x3a')]=qs[_0x8f3a('0x32')](_[_0x8f3a('0x57')](_0x2e9eca[_0x8f3a('0x34')],_0x3d470f[_0x8f3a('0x32')]));if(_0x2e9eca[_0x8f3a('0x34')][_0x8f3a('0x3b')]){_0xede8ef['where']=_[_0x8f3a('0x3d')](_0xede8ef[_0x8f3a('0x3a')],{'$or':_['map'](_0xede8ef[_0x8f3a('0x36')],function(_0x3623d5){var _0x3225f1={};_0x3225f1[_0x3623d5]={'$like':'%'+_0x2e9eca[_0x8f3a('0x34')][_0x8f3a('0x3b')]+'%'};return _0x3225f1;})});}_0xede8ef=_[_0x8f3a('0x3d')]({},_0xede8ef,_0x2e9eca[_0x8f3a('0x3e')]);return _0xaf1492[_0x8f3a('0x60')](_0xede8ef);}})[_0x8f3a('0x24')](function(_0x51305e){if(_0x51305e){_0x2d2509=_0x51305e['length'];if(!_0x2e9eca[_0x8f3a('0x34')]['hasOwnProperty'](_0x8f3a('0x37'))){_0xede8ef[_0x8f3a('0x1f')]=qs[_0x8f3a('0x1f')](_0x2e9eca[_0x8f3a('0x34')]['limit']);_0xede8ef[_0x8f3a('0x1e')]=qs[_0x8f3a('0x1e')](_0x2e9eca[_0x8f3a('0x34')][_0x8f3a('0x1e')]);}return _0xaf1492[_0x8f3a('0x60')](_0xede8ef);}})[_0x8f3a('0x24')](function(_0x45c42c){if(_0x45c42c){return _0x45c42c?{'count':_0x2d2509,'rows':_0x45c42c}:null;}})[_0x8f3a('0x24')](respondWithResult(_0x30ae06,null))[_0x8f3a('0x42')](handleError(_0x30ae06,null));};exports['addTeams']=function(_0xa07d91,_0x2974ba,_0x527b42){var _0x30a1df=_0xa07d91[_0x8f3a('0x51')][_0x8f3a('0x62')];return db[_0x8f3a('0x61')][_0x8f3a('0x40')]({'where':{'id':_0x30a1df},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8f3a('0x63'),'attributes':['id','name',_0x8f3a('0x64'),_0x8f3a('0x65'),_0x8f3a('0x66')],'raw':!![]}]})[_0x8f3a('0x24')](function(_0xd3288e){if(_0xd3288e){var _0x2241e9=_[_0x8f3a('0x67')](_0xd3288e,function(_0x3ba6f3){var _0x582218=_0x3ba6f3['get']({'plain':!![]});return _0x582218[_0x8f3a('0x63')];});return db['MailQueue'][_0x8f3a('0x48')]({'where':{'id':_0xa07d91[_0x8f3a('0x52')]['id']}})[_0x8f3a('0x24')](function(_0x144ec5){return db[_0x8f3a('0x68')][_0x8f3a('0x69')](function(_0x528c80){return _0x144ec5['addTeams'](_0x30a1df,{'transaction':_0x528c80})[_0x8f3a('0x24')](function(){return BPromise[_0x8f3a('0x6a')](_0x2241e9,function(_0x460446){return db[_0x8f3a('0x55')][_0x8f3a('0x6b')]({'where':{'UserId':_0x460446['id'],'MailQueueId':_0xa07d91[_0x8f3a('0x52')]['id']},'transaction':_0x528c80});});})[_0x8f3a('0x24')](function(){_0x2241e9[_0x8f3a('0x6c')](function(_0x2ffba6){socket['emit'](_0x8f3a('0x6d'),{'UserId':_0x2ffba6['id'],'MailQueueId':_0x144ec5['id']});});});});});}})[_0x8f3a('0x24')](respondWithStatusCode(_0x2974ba,null))[_0x8f3a('0x42')](handleError(_0x2974ba,null));};exports[_0x8f3a('0x6e')]=function(_0x29131d,_0x5b393c,_0x5dce7e){return db[_0x8f3a('0x61')][_0x8f3a('0x40')]({'where':{'id':_0x29131d['query'][_0x8f3a('0x62')]},'attributes':['id'],'include':[{'model':db[_0x8f3a('0x6f')],'as':_0x8f3a('0x63'),'attributes':['id'],'raw':!![]}]})[_0x8f3a('0x24')](handleEntityNotFound(_0x5b393c,null))[_0x8f3a('0x24')](function(_0x1d1fd1){var _0x1707fc=_[_0x8f3a('0x2c')](_0x1d1fd1,'id');var _0x4e06a1=[];var _0x5f43e3=[];var _0xa7f85c=squel[_0x8f3a('0x70')]();_0xa7f85c[_0x8f3a('0x71')](_0x8f3a('0x72'))[_0x8f3a('0x73')]('team_has_mail_queues','tq')[_0x8f3a('0x74')](_0x8f3a('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8f3a('0x3a')](_0x8f3a('0x76'),_0x29131d['params']['id']);for(var _0x4f412e=0x0;_0x4f412e<_0x1d1fd1[_0x8f3a('0x45')];_0x4f412e+=0x1){let _0x5326fb=_0x1d1fd1[_0x4f412e];for(var _0x5e6645=0x0;_0x5e6645<_0x5326fb[_0x8f3a('0x63')][_0x8f3a('0x45')];_0x5e6645+=0x1){let _0x277131=_0x5326fb[_0x8f3a('0x63')][_0x5e6645];var _0xd60809=_0xa7f85c[_0x8f3a('0x77')]();_0xd60809[_0x8f3a('0x3a')](_0x8f3a('0x78'),_0x277131['id']);_0x5f43e3['push'](db[_0x8f3a('0x68')][_0x8f3a('0x34')](_0xd60809['toString'](),{'type':db[_0x8f3a('0x68')][_0x8f3a('0x79')][_0x8f3a('0x7a')]})[_0x8f3a('0x24')](function(_0x51cc44){if(_0x51cc44['length']===0x1){return _0x277131['id'];}else{var _0x54467e=_[_0x8f3a('0x7b')](_['map'](_0x51cc44,_0x8f3a('0x7c')),function(_0x193cbb){return _['includes'](_0x1707fc,_0x193cbb);});if(_0x54467e){return _0x277131['id'];}}}));}}return BPromise[_0x8f3a('0x7d')](_0x5f43e3)[_0x8f3a('0x24')](function(_0x2f86dd){_0x4e06a1=_(_0x4e06a1)[_0x8f3a('0x7e')](_0x2f86dd)[_0x8f3a('0x7f')]()[_0x8f3a('0x80')]();return db['MailQueue'][_0x8f3a('0x48')]({'where':{'id':_0x29131d[_0x8f3a('0x52')]['id']}})[_0x8f3a('0x24')](function(_0x56689e){return db[_0x8f3a('0x68')][_0x8f3a('0x69')](function(_0x2ce28f){return _0x56689e[_0x8f3a('0x6e')](_0x29131d['query'][_0x8f3a('0x62')],{'transaction':_0x2ce28f})[_0x8f3a('0x24')](function(){if(!_['isEmpty'](_0x4e06a1)){return _0x56689e[_0x8f3a('0x81')](_0x4e06a1,{'transaction':_0x2ce28f});}})[_0x8f3a('0x24')](function(){_0x4e06a1['forEach'](function(_0x5b4fc6){socket[_0x8f3a('0x82')](_0x8f3a('0x83'),{'UserId':_0x5b4fc6,'MailQueueId':_0x56689e['id']});});});});});});})[_0x8f3a('0x24')](respondWithStatusCode(_0x5b393c,null))[_0x8f3a('0x42')](handleError(_0x5b393c,null));};exports[_0x8f3a('0x84')]=function(_0xb91d3a,_0x9320f1,_0x3d0d16){return db[_0x8f3a('0x47')][_0x8f3a('0x48')]({'where':{'id':_0xb91d3a[_0x8f3a('0x52')]['id']}})[_0x8f3a('0x24')](handleEntityNotFound(_0x9320f1,null))[_0x8f3a('0x24')](function(_0x5be176){if(_0x5be176){return _0x5be176[_0x8f3a('0x84')](_0xb91d3a[_0x8f3a('0x51')][_0x8f3a('0x62')],_[_0x8f3a('0x85')](_0xb91d3a[_0x8f3a('0x51')],[_0x8f3a('0x62'),'id'])||{})[_0x8f3a('0x86')](function(_0x2d7ed9){for(var _0x43804e=0x0;_0x43804e<_0xb91d3a['body']['ids'][_0x8f3a('0x45')];_0x43804e+=0x1){socket['emit'](_0x8f3a('0x6d'),{'UserId':_0xb91d3a['body'][_0x8f3a('0x62')][_0x43804e],'MailQueueId':_0xb91d3a['params']['id']});}return _0x2d7ed9;});}})[_0x8f3a('0x24')](respondWithResult(_0x9320f1,null))[_0x8f3a('0x42')](handleError(_0x9320f1,null));};exports[_0x8f3a('0x81')]=function(_0x1a9270,_0x55b46a,_0x3f08ea){return db['MailQueue']['find']({'where':{'id':_0x1a9270[_0x8f3a('0x52')]['id']}})[_0x8f3a('0x24')](handleEntityNotFound(_0x55b46a,null))[_0x8f3a('0x24')](function(_0x34892d){if(_0x34892d){return _0x34892d[_0x8f3a('0x81')](_0x1a9270[_0x8f3a('0x34')][_0x8f3a('0x62')])[_0x8f3a('0x24')](function(){if(_[_0x8f3a('0x87')](_0x1a9270[_0x8f3a('0x34')][_0x8f3a('0x62')])){for(var _0x158925=0x0;_0x158925<_0x1a9270[_0x8f3a('0x34')][_0x8f3a('0x62')][_0x8f3a('0x45')];_0x158925+=0x1){socket[_0x8f3a('0x82')](_0x8f3a('0x83'),{'UserId':Number(_0x1a9270['query'][_0x8f3a('0x62')][_0x158925]),'MailQueueId':Number(_0x1a9270[_0x8f3a('0x52')]['id'])});}}else{socket[_0x8f3a('0x82')](_0x8f3a('0x83'),{'UserId':Number(_0x1a9270[_0x8f3a('0x34')][_0x8f3a('0x62')]),'MailQueueId':Number(_0x1a9270[_0x8f3a('0x52')]['id'])});}});}})[_0x8f3a('0x24')](respondWithStatusCode(_0x55b46a,null))[_0x8f3a('0x42')](handleError(_0x55b46a,null));};exports[_0x8f3a('0x88')]=function(_0x47f6d8,_0x312517,_0x4e93f1){var _0x80d64={};var _0x24770f={};var _0x3bdde9;var _0x2f8b92;return db[_0x8f3a('0x47')][_0x8f3a('0x54')]({'where':{'id':_0x47f6d8[_0x8f3a('0x52')]['id']}})[_0x8f3a('0x24')](handleEntityNotFound(_0x312517,null))[_0x8f3a('0x24')](function(_0x4c8013){if(_0x4c8013){_0x3bdde9=_0x4c8013;_0x24770f['model']=_[_0x8f3a('0x44')](db['User']['rawAttributes']);_0x24770f[_0x8f3a('0x34')]=_[_0x8f3a('0x44')](_0x47f6d8[_0x8f3a('0x34')]);_0x24770f[_0x8f3a('0x32')]=_[_0x8f3a('0x33')](_0x24770f[_0x8f3a('0x31')],_0x24770f[_0x8f3a('0x34')]);_0x80d64[_0x8f3a('0x36')]=_['intersection'](_0x24770f[_0x8f3a('0x31')],qs[_0x8f3a('0x35')](_0x47f6d8[_0x8f3a('0x34')][_0x8f3a('0x35')]));_0x80d64[_0x8f3a('0x36')]=_0x80d64['attributes']['length']?_0x80d64['attributes']:_0x24770f[_0x8f3a('0x31')];_0x80d64[_0x8f3a('0x38')]=qs[_0x8f3a('0x39')](_0x47f6d8[_0x8f3a('0x34')][_0x8f3a('0x39')]);_0x80d64[_0x8f3a('0x3a')]=qs[_0x8f3a('0x32')](_['pick'](_0x47f6d8[_0x8f3a('0x34')],_0x24770f['filters']));if(_0x47f6d8[_0x8f3a('0x34')][_0x8f3a('0x3b')]){_0x80d64[_0x8f3a('0x3a')]=_[_0x8f3a('0x3d')](_0x80d64[_0x8f3a('0x3a')],{'$or':_[_0x8f3a('0x2c')](_0x80d64[_0x8f3a('0x36')],function(_0x3ad2de){var _0x4bb628={};_0x4bb628[_0x3ad2de]={'$like':'%'+_0x47f6d8['query']['filter']+'%'};return _0x4bb628;})});}_0x80d64=_['merge']({},_0x80d64,_0x47f6d8[_0x8f3a('0x3e')]);return _0x3bdde9[_0x8f3a('0x88')](_0x80d64);}})[_0x8f3a('0x24')](function(_0x11bc02){if(_0x11bc02){_0x2f8b92=_0x11bc02['length'];if(!_0x47f6d8[_0x8f3a('0x34')]['hasOwnProperty']('nolimit')){_0x80d64[_0x8f3a('0x1f')]=qs[_0x8f3a('0x1f')](_0x47f6d8[_0x8f3a('0x34')][_0x8f3a('0x1f')]);_0x80d64['offset']=qs[_0x8f3a('0x1e')](_0x47f6d8[_0x8f3a('0x34')][_0x8f3a('0x1e')]);}return _0x3bdde9[_0x8f3a('0x88')](_0x80d64);}})['then'](function(_0x2a03eb){if(_0x2a03eb){return _0x2a03eb?{'count':_0x2f8b92,'rows':_0x2a03eb}:null;}})[_0x8f3a('0x24')](respondWithResult(_0x312517,null))[_0x8f3a('0x42')](handleError(_0x312517,null));}; \ No newline at end of file +var _0x6017=['online','flatMap','sequelize','transaction','findOrCreate','forEach','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../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','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','MailQueue','include','catch','show','params','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserMailQueue','order','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','filter','addTeams','Agents'];(function(_0x50bb31,_0x1c8cb4){var _0x4f59ce=function(_0x156d35){while(--_0x156d35){_0x50bb31['push'](_0x50bb31['shift']());}};_0x4f59ce(++_0x1c8cb4);}(_0x6017,0xae));var _0x7601=function(_0xfb4a67,_0x457378){_0xfb4a67=_0xfb4a67-0x0;var _0x320cc4=_0x6017[_0xfb4a67];return _0x320cc4;};'use strict';var pdf=require(_0x7601('0x0'));var emlformat=require(_0x7601('0x1'));var rimraf=require(_0x7601('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7601('0x3'));var rp=require(_0x7601('0x4'));var moment=require('moment');var BPromise=require(_0x7601('0x5'));var Mustache=require('mustache');var util=require(_0x7601('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7601('0x7'));var ejs=require(_0x7601('0x8'));var fs=require('fs');var _=require(_0x7601('0x9'));var squel=require(_0x7601('0xa'));var crypto=require(_0x7601('0xb'));var jsforce=require(_0x7601('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7601('0x7'));var querystring=require(_0x7601('0xd'));var Papa=require(_0x7601('0xe'));var Redis=require('ioredis');var authService=require(_0x7601('0xf'));var qs=require(_0x7601('0x10'));var as=require(_0x7601('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7601('0x12'))(_0x7601('0x13'));var utils=require(_0x7601('0x14'));var config=require(_0x7601('0x15'));var licenseUtil=require(_0x7601('0x16'));var db=require(_0x7601('0x17'))['db'];config[_0x7601('0x18')]=_[_0x7601('0x19')](config[_0x7601('0x18')],{'host':_0x7601('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7601('0x18')]));require('./mailQueue.socket')[_0x7601('0x1b')](socket);function respondWithStatusCode(_0x2b8cbc,_0x6da06c){_0x6da06c=_0x6da06c||0xcc;return function(_0x263314){if(_0x263314){return _0x2b8cbc[_0x7601('0x1c')](_0x6da06c);}return _0x2b8cbc[_0x7601('0x1d')](_0x6da06c)[_0x7601('0x1e')]();};}function respondWithResult(_0xdd9b16,_0xdfb58a){_0xdfb58a=_0xdfb58a||0xc8;return function(_0x5e99b9){if(_0x5e99b9){return _0xdd9b16[_0x7601('0x1d')](_0xdfb58a)[_0x7601('0x1f')](_0x5e99b9);}};}function respondWithFilteredResult(_0x5329e6,_0x17ed47){return function(_0x5c3fb7){if(_0x5c3fb7){var _0x5f530e=_0x5c3fb7[_0x7601('0x20')],_0x22520e=_0x17ed47[_0x7601('0x21')],_0x403e38=_0x17ed47[_0x7601('0x21')]+_0x17ed47[_0x7601('0x22')],_0x3c1b4b;if(_0x403e38>=_0x5f530e){_0x403e38=_0x5f530e;_0x3c1b4b=0xc8;}else{_0x3c1b4b=0xce;}_0x5329e6['status'](_0x3c1b4b);return _0x5329e6[_0x7601('0x23')](_0x7601('0x24'),_0x22520e+'-'+_0x403e38+'/'+_0x5f530e)['json'](_0x5c3fb7);}return null;};}function patchUpdates(_0x204292){return function(_0x5169c9){try{jsonpatch[_0x7601('0x25')](_0x5169c9,_0x204292,!![]);}catch(_0x3cfd9a){return BPromise[_0x7601('0x26')](_0x3cfd9a);}return _0x5169c9[_0x7601('0x27')]();};}function saveUpdates(_0x4cbf1e,_0x1fa3bc){return function(_0x9bc1ad){if(_0x9bc1ad){return _0x9bc1ad[_0x7601('0x28')](_0x4cbf1e)[_0x7601('0x29')](function(_0x57e7a6){return _0x57e7a6;});}return null;};}function removeEntity(_0x2b9bd,_0x53425f){return function(_0x44944f){if(_0x44944f){return _0x44944f['destroy']()['then'](function(){var _0x326f8f=_0x44944f[_0x7601('0x2a')]({'plain':!![]});var _0x5277d0='MailQueues';return db[_0x7601('0x2b')]['destroy']({'where':{'type':_0x5277d0,'resourceId':_0x326f8f['id']}})['then'](function(){return _0x44944f;});})[_0x7601('0x29')](function(){_0x2b9bd[_0x7601('0x1d')](0xcc)[_0x7601('0x1e')]();});}};}function handleEntityNotFound(_0x5807ce,_0xfcc562){return function(_0x4a2321){if(!_0x4a2321){_0x5807ce[_0x7601('0x1c')](0x194);}return _0x4a2321;};}function handleError(_0xa05dda,_0x58fd92){_0x58fd92=_0x58fd92||0x1f4;return function(_0x4ab32d){logger[_0x7601('0x2c')](_0x4ab32d[_0x7601('0x2d')]);if(_0x4ab32d[_0x7601('0x2e')]){delete _0x4ab32d[_0x7601('0x2e')];}_0xa05dda[_0x7601('0x1d')](_0x58fd92)[_0x7601('0x2f')](_0x4ab32d);};}exports['index']=function(_0x497f5f,_0x27f423){var _0x170d27={},_0xa483c4={},_0x135920={'count':0x0,'rows':[]};var _0x1b3ec1=_['map'](db['MailQueue'][_0x7601('0x30')],function(_0x27862b){return{'name':_0x27862b[_0x7601('0x31')],'type':_0x27862b[_0x7601('0x32')][_0x7601('0x33')]};});_0xa483c4['model']=_[_0x7601('0x34')](_0x1b3ec1,_0x7601('0x2e'));_0xa483c4['query']=_[_0x7601('0x35')](_0x497f5f[_0x7601('0x36')]);_0xa483c4[_0x7601('0x37')]=_[_0x7601('0x38')](_0xa483c4[_0x7601('0x39')],_0xa483c4['query']);_0x170d27[_0x7601('0x3a')]=_[_0x7601('0x38')](_0xa483c4[_0x7601('0x39')],qs[_0x7601('0x3b')](_0x497f5f['query'][_0x7601('0x3b')]));_0x170d27['attributes']=_0x170d27['attributes'][_0x7601('0x3c')]?_0x170d27[_0x7601('0x3a')]:_0xa483c4[_0x7601('0x39')];if(!_0x497f5f[_0x7601('0x36')][_0x7601('0x3d')](_0x7601('0x3e'))){_0x170d27[_0x7601('0x22')]=qs[_0x7601('0x22')](_0x497f5f[_0x7601('0x36')][_0x7601('0x22')]);_0x170d27[_0x7601('0x21')]=qs[_0x7601('0x21')](_0x497f5f[_0x7601('0x36')][_0x7601('0x21')]);}_0x170d27['order']=qs[_0x7601('0x3f')](_0x497f5f[_0x7601('0x36')][_0x7601('0x3f')]);_0x170d27[_0x7601('0x40')]=qs[_0x7601('0x37')](_[_0x7601('0x41')](_0x497f5f['query'],_0xa483c4[_0x7601('0x37')]),_0x1b3ec1);if(_0x497f5f[_0x7601('0x36')]['filter']){_0x170d27[_0x7601('0x40')]=_['merge'](_0x170d27[_0x7601('0x40')],{'$or':_['map'](_0x1b3ec1,function(_0x4f13d6){if(_0x4f13d6['type']!==_0x7601('0x42')){var _0x2a5cea={};_0x2a5cea[_0x4f13d6[_0x7601('0x2e')]]={'$like':'%'+_0x497f5f[_0x7601('0x36')]['filter']+'%'};return _0x2a5cea;}})});}_0x170d27=_[_0x7601('0x43')]({},_0x170d27,_0x497f5f['options']);var _0x9bc661={'where':_0x170d27[_0x7601('0x40')]};return db[_0x7601('0x44')][_0x7601('0x20')](_0x9bc661)[_0x7601('0x29')](function(_0x25f348){_0x135920['count']=_0x25f348;if(_0x497f5f[_0x7601('0x36')]['includeAll']){_0x170d27[_0x7601('0x45')]=[{'all':!![]}];}return db[_0x7601('0x44')]['findAll'](_0x170d27);})['then'](function(_0x486551){_0x135920['rows']=_0x486551;return _0x135920;})[_0x7601('0x29')](respondWithFilteredResult(_0x27f423,_0x170d27))[_0x7601('0x46')](handleError(_0x27f423,null));};exports[_0x7601('0x47')]=function(_0x458a4e,_0x248ab7){var _0x15fc13={'raw':!![],'where':{'id':_0x458a4e[_0x7601('0x48')]['id']}},_0x3c6012={};_0x3c6012[_0x7601('0x39')]=_[_0x7601('0x35')](db[_0x7601('0x44')][_0x7601('0x30')]);_0x3c6012[_0x7601('0x36')]=_[_0x7601('0x35')](_0x458a4e[_0x7601('0x36')]);_0x3c6012[_0x7601('0x37')]=_['intersection'](_0x3c6012[_0x7601('0x39')],_0x3c6012[_0x7601('0x36')]);_0x15fc13[_0x7601('0x3a')]=_[_0x7601('0x38')](_0x3c6012[_0x7601('0x39')],qs['fields'](_0x458a4e[_0x7601('0x36')]['fields']));_0x15fc13[_0x7601('0x3a')]=_0x15fc13[_0x7601('0x3a')]['length']?_0x15fc13['attributes']:_0x3c6012[_0x7601('0x39')];if(_0x458a4e[_0x7601('0x36')][_0x7601('0x49')]){_0x15fc13[_0x7601('0x45')]=[{'all':!![]}];}_0x15fc13=_[_0x7601('0x43')]({},_0x15fc13,_0x458a4e[_0x7601('0x4a')]);return db['MailQueue'][_0x7601('0x4b')](_0x15fc13)['then'](handleEntityNotFound(_0x248ab7,null))['then'](respondWithResult(_0x248ab7,null))[_0x7601('0x46')](handleError(_0x248ab7,null));};exports[_0x7601('0x4c')]=function(_0xe7c6a4,_0x56b813){return db[_0x7601('0x44')][_0x7601('0x4c')](_0xe7c6a4['body'],{})[_0x7601('0x29')](function(_0x21c366){var _0x390b44=_0xe7c6a4[_0x7601('0x4d')][_0x7601('0x2a')]({'plain':!![]});if(!_0x390b44)throw new Error(_0x7601('0x4e'));if(_0x390b44[_0x7601('0x4f')]==='user'){var _0x12b31d=_0x21c366[_0x7601('0x2a')]({'plain':!![]});var _0x41d8bb='MailQueues';return db[_0x7601('0x50')][_0x7601('0x4b')]({'where':{'name':_0x41d8bb,'userProfileId':_0x390b44[_0x7601('0x51')]},'raw':!![]})[_0x7601('0x29')](function(_0x3df2c2){if(_0x3df2c2&&_0x3df2c2['autoAssociation']===0x0){return db[_0x7601('0x2b')][_0x7601('0x4c')]({'name':_0x12b31d[_0x7601('0x2e')],'resourceId':_0x12b31d['id'],'type':_0x3df2c2[_0x7601('0x2e')],'sectionId':_0x3df2c2['id']},{})[_0x7601('0x29')](function(){return _0x21c366;});}else{return _0x21c366;}})[_0x7601('0x46')](function(_0x5a07c5){logger[_0x7601('0x2c')](_0x7601('0x52'),_0x5a07c5);throw _0x5a07c5;});}return _0x21c366;})[_0x7601('0x29')](respondWithResult(_0x56b813,0xc9))[_0x7601('0x46')](handleError(_0x56b813,null));};exports['update']=function(_0x1615f3,_0x1b5aec){if(_0x1615f3[_0x7601('0x53')]['id']){delete _0x1615f3[_0x7601('0x53')]['id'];}return db[_0x7601('0x44')][_0x7601('0x4b')]({'where':{'id':_0x1615f3[_0x7601('0x48')]['id']}})[_0x7601('0x29')](handleEntityNotFound(_0x1b5aec,null))[_0x7601('0x29')](saveUpdates(_0x1615f3[_0x7601('0x53')],null))[_0x7601('0x29')](respondWithResult(_0x1b5aec,null))[_0x7601('0x46')](handleError(_0x1b5aec,null));};exports[_0x7601('0x54')]=function(_0x5a9781,_0x44d83b){return db['MailQueue']['find']({'where':{'id':_0x5a9781[_0x7601('0x48')]['id']}})[_0x7601('0x29')](handleEntityNotFound(_0x44d83b,null))[_0x7601('0x29')](removeEntity(_0x44d83b,null))[_0x7601('0x46')](handleError(_0x44d83b,null));};exports[_0x7601('0x55')]=function(_0x426f50,_0x107ac0){return db[_0x7601('0x44')]['describe']()[_0x7601('0x29')](respondWithResult(_0x107ac0,null))[_0x7601('0x46')](handleError(_0x107ac0,null));};exports[_0x7601('0x56')]=function(_0x3dea9c,_0x2617a4,_0x282584){var _0x2a0d57={'raw':!![],'where':{}},_0x5385cc={},_0x3eeef0;return db['MailQueue'][_0x7601('0x57')]({'where':{'id':_0x3dea9c['params']['id']}})[_0x7601('0x29')](handleEntityNotFound(_0x2617a4,null))[_0x7601('0x29')](function(_0x10654a){if(_0x10654a){_0x3eeef0=_0x10654a[_0x7601('0x2a')]({'plain':!![]});_0x5385cc[_0x7601('0x39')]=_[_0x7601('0x35')](db[_0x7601('0x58')][_0x7601('0x30')]);_0x5385cc[_0x7601('0x36')]=_[_0x7601('0x35')](_0x3dea9c['query']);_0x5385cc[_0x7601('0x37')]=_[_0x7601('0x38')](_0x5385cc[_0x7601('0x39')],_0x5385cc[_0x7601('0x36')]);_0x2a0d57[_0x7601('0x3a')]=_['intersection'](_0x5385cc[_0x7601('0x39')],qs[_0x7601('0x3b')](_0x3dea9c[_0x7601('0x36')][_0x7601('0x3b')]));_0x2a0d57[_0x7601('0x3a')]=_0x2a0d57[_0x7601('0x3a')][_0x7601('0x3c')]?_0x2a0d57[_0x7601('0x3a')]:_0x5385cc[_0x7601('0x39')];if(!_0x3dea9c[_0x7601('0x36')][_0x7601('0x3d')](_0x7601('0x3e'))){_0x2a0d57[_0x7601('0x22')]=qs[_0x7601('0x22')](_0x3dea9c[_0x7601('0x36')]['limit']);_0x2a0d57[_0x7601('0x21')]=qs['offset'](_0x3dea9c[_0x7601('0x36')][_0x7601('0x21')]);}_0x2a0d57[_0x7601('0x59')]=qs[_0x7601('0x3f')](_0x3dea9c[_0x7601('0x36')][_0x7601('0x3f')]);_0x2a0d57[_0x7601('0x40')]=qs['filters'](_[_0x7601('0x41')](_0x3dea9c[_0x7601('0x36')],_0x5385cc[_0x7601('0x37')]));_0x2a0d57[_0x7601('0x40')][_0x7601('0x5a')]=_0x10654a['id'];if(_0x3dea9c['query']['filter']){_0x2a0d57[_0x7601('0x40')]=_[_0x7601('0x43')](_0x2a0d57['where'],{'$or':_[_0x7601('0x34')](_0x2a0d57['attributes'],function(_0x52da8f){var _0x7aaabb={};_0x7aaabb[_0x52da8f]={'$like':'%'+_0x3dea9c[_0x7601('0x36')]['filter']+'%'};return _0x7aaabb;})});}_0x2a0d57=_[_0x7601('0x43')]({},_0x2a0d57,_0x3dea9c['options']);return db['UserMailQueue'][_0x7601('0x5b')](_0x2a0d57);}})['then'](function(_0x4d8817){if(_0x4d8817){return db[_0x7601('0x5c')][_0x7601('0x5d')]({'where':{'id':_[_0x7601('0x34')](_0x4d8817,_0x7601('0x5e')),'role':_0x7601('0x5f')},'attributes':['id','name',_0x7601('0x60'),'updatedAt',_0x7601('0x61')]});}})[_0x7601('0x29')](function(_0xfefc6){if(_0xfefc6){return{'count':_0xfefc6[_0x7601('0x20')],'rows':_[_0x7601('0x34')](_0xfefc6['rows'],function(_0x458247){return{'membername':_0x458247[_0x7601('0x2e')],'UserId':_0x458247['id'],'queue_name':_0x3eeef0['name'],'MailQueueId':_0x3eeef0['id'],'interface':util['format'](_0x7601('0x62'),_0x7601('0x63'),_0x458247[_0x7601('0x2e')]),'penalty':0x0,'paused':_0x458247[_0x7601('0x60')],'createdAt':_0x458247[_0x7601('0x61')],'updatedAt':_0x458247[_0x7601('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2617a4,_0x2a0d57))['catch'](handleError(_0x2617a4,null));};exports[_0x7601('0x65')]=function(_0x59988c,_0x321e7a,_0x3c1824){var _0x72cbe8={};var _0x47206c={};var _0x19ebb3;var _0x3854fe;return db[_0x7601('0x44')][_0x7601('0x57')]({'where':{'id':_0x59988c['params']['id']}})[_0x7601('0x29')](handleEntityNotFound(_0x321e7a,null))[_0x7601('0x29')](function(_0x2aecb3){if(_0x2aecb3){_0x19ebb3=_0x2aecb3;_0x47206c[_0x7601('0x39')]=_[_0x7601('0x35')](db[_0x7601('0x66')]['rawAttributes']);_0x47206c['query']=_[_0x7601('0x35')](_0x59988c[_0x7601('0x36')]);_0x47206c[_0x7601('0x37')]=_[_0x7601('0x38')](_0x47206c['model'],_0x47206c[_0x7601('0x36')]);_0x72cbe8[_0x7601('0x3a')]=_['intersection'](_0x47206c[_0x7601('0x39')],qs['fields'](_0x59988c[_0x7601('0x36')][_0x7601('0x3b')]));_0x72cbe8[_0x7601('0x3a')]=_0x72cbe8[_0x7601('0x3a')][_0x7601('0x3c')]?_0x72cbe8[_0x7601('0x3a')]:_0x47206c[_0x7601('0x39')];_0x72cbe8[_0x7601('0x59')]=qs[_0x7601('0x3f')](_0x59988c[_0x7601('0x36')]['sort']);_0x72cbe8[_0x7601('0x40')]=qs['filters'](_[_0x7601('0x41')](_0x59988c[_0x7601('0x36')],_0x47206c[_0x7601('0x37')]));if(_0x59988c['query'][_0x7601('0x67')]){_0x72cbe8[_0x7601('0x40')]=_[_0x7601('0x43')](_0x72cbe8[_0x7601('0x40')],{'$or':_[_0x7601('0x34')](_0x72cbe8[_0x7601('0x3a')],function(_0x5280fc){var _0x571633={};_0x571633[_0x5280fc]={'$like':'%'+_0x59988c[_0x7601('0x36')]['filter']+'%'};return _0x571633;})});}_0x72cbe8=_[_0x7601('0x43')]({},_0x72cbe8,_0x59988c[_0x7601('0x4a')]);return _0x19ebb3[_0x7601('0x65')](_0x72cbe8);}})[_0x7601('0x29')](function(_0x14a6f8){if(_0x14a6f8){_0x3854fe=_0x14a6f8[_0x7601('0x3c')];if(!_0x59988c['query']['hasOwnProperty'](_0x7601('0x3e'))){_0x72cbe8['limit']=qs[_0x7601('0x22')](_0x59988c['query'][_0x7601('0x22')]);_0x72cbe8[_0x7601('0x21')]=qs[_0x7601('0x21')](_0x59988c[_0x7601('0x36')]['offset']);}return _0x19ebb3['getTeams'](_0x72cbe8);}})['then'](function(_0x29685a){if(_0x29685a){return _0x29685a?{'count':_0x3854fe,'rows':_0x29685a}:null;}})[_0x7601('0x29')](respondWithResult(_0x321e7a,null))[_0x7601('0x46')](handleError(_0x321e7a,null));};exports[_0x7601('0x68')]=function(_0x4ef015,_0x264b7c,_0x1fef0d){var _0x4b4d54=_0x4ef015[_0x7601('0x53')]['ids'];return db[_0x7601('0x66')]['findAll']({'where':{'id':_0x4b4d54},'attributes':['id'],'include':[{'model':db[_0x7601('0x5c')],'as':_0x7601('0x69'),'attributes':['id',_0x7601('0x2e'),_0x7601('0x6a'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1c9de9){if(_0x1c9de9){var _0x44f458=_[_0x7601('0x6b')](_0x1c9de9,function(_0x29269c){var _0x549d1f=_0x29269c[_0x7601('0x2a')]({'plain':!![]});return _0x549d1f[_0x7601('0x69')];});return db[_0x7601('0x44')][_0x7601('0x4b')]({'where':{'id':_0x4ef015['params']['id']}})[_0x7601('0x29')](function(_0x1a520a){return db[_0x7601('0x6c')][_0x7601('0x6d')](function(_0x509bca){return _0x1a520a[_0x7601('0x68')](_0x4b4d54,{'transaction':_0x509bca})[_0x7601('0x29')](function(){return BPromise['each'](_0x44f458,function(_0x14bff8){return db['UserMailQueue'][_0x7601('0x6e')]({'where':{'UserId':_0x14bff8['id'],'MailQueueId':_0x4ef015[_0x7601('0x48')]['id']},'transaction':_0x509bca});});})[_0x7601('0x29')](function(){_0x44f458[_0x7601('0x6f')](function(_0x530c58){socket['emit'](_0x7601('0x70'),{'UserId':_0x530c58['id'],'MailQueueId':_0x1a520a['id']});});});});});}})[_0x7601('0x29')](respondWithStatusCode(_0x264b7c,null))[_0x7601('0x46')](handleError(_0x264b7c,null));};exports[_0x7601('0x71')]=function(_0x54131f,_0x19a0cd,_0x197dcd){return db[_0x7601('0x66')]['findAll']({'where':{'id':_0x54131f['query'][_0x7601('0x72')]},'attributes':['id'],'include':[{'model':db[_0x7601('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7601('0x29')](handleEntityNotFound(_0x19a0cd,null))[_0x7601('0x29')](function(_0x386cbc){var _0x216e58=_[_0x7601('0x34')](_0x386cbc,'id');var _0x317184=[];var _0x2a0373=[];var _0x19a442=squel[_0x7601('0x73')]();_0x19a442[_0x7601('0x74')](_0x7601('0x75'))['from'](_0x7601('0x76'),'tq')[_0x7601('0x77')]('user_has_teams','ut',_0x7601('0x78'))['where']('MailQueueId\x20=\x20?',_0x54131f[_0x7601('0x48')]['id']);for(var _0x3ad441=0x0;_0x3ad441<_0x386cbc[_0x7601('0x3c')];_0x3ad441+=0x1){let _0x179cc2=_0x386cbc[_0x3ad441];for(var _0x2e8e8d=0x0;_0x2e8e8d<_0x179cc2[_0x7601('0x69')][_0x7601('0x3c')];_0x2e8e8d+=0x1){let _0x1a9af7=_0x179cc2[_0x7601('0x69')][_0x2e8e8d];var _0x384318=_0x19a442['clone']();_0x384318[_0x7601('0x40')](_0x7601('0x79'),_0x1a9af7['id']);_0x2a0373['push'](db[_0x7601('0x6c')]['query'](_0x384318[_0x7601('0x7a')](),{'type':db['sequelize'][_0x7601('0x7b')][_0x7601('0x7c')]})[_0x7601('0x29')](function(_0xe134c3){if(_0xe134c3[_0x7601('0x3c')]===0x1){return _0x1a9af7['id'];}else{var _0x2f29ee=_[_0x7601('0x7d')](_[_0x7601('0x34')](_0xe134c3,'TeamId'),function(_0x575bfd){return _[_0x7601('0x7e')](_0x216e58,_0x575bfd);});if(_0x2f29ee){return _0x1a9af7['id'];}}}));}}return BPromise[_0x7601('0x7f')](_0x2a0373)['then'](function(_0x163ae1){_0x317184=_(_0x317184)[_0x7601('0x80')](_0x163ae1)[_0x7601('0x81')]()[_0x7601('0x82')]();return db[_0x7601('0x44')][_0x7601('0x4b')]({'where':{'id':_0x54131f[_0x7601('0x48')]['id']}})[_0x7601('0x29')](function(_0x59ca8a){return db[_0x7601('0x6c')][_0x7601('0x6d')](function(_0x33c2cf){return _0x59ca8a[_0x7601('0x71')](_0x54131f[_0x7601('0x36')]['ids'],{'transaction':_0x33c2cf})[_0x7601('0x29')](function(){if(!_[_0x7601('0x83')](_0x317184)){return _0x59ca8a[_0x7601('0x84')](_0x317184,{'transaction':_0x33c2cf});}})[_0x7601('0x29')](function(){_0x317184[_0x7601('0x6f')](function(_0x5cdc05){socket['emit'](_0x7601('0x85'),{'UserId':_0x5cdc05,'MailQueueId':_0x59ca8a['id']});});});});});});})[_0x7601('0x29')](respondWithStatusCode(_0x19a0cd,null))[_0x7601('0x46')](handleError(_0x19a0cd,null));};exports[_0x7601('0x86')]=function(_0x438871,_0x4d144a,_0x8fea40){return db[_0x7601('0x44')][_0x7601('0x4b')]({'where':{'id':_0x438871[_0x7601('0x48')]['id']}})[_0x7601('0x29')](handleEntityNotFound(_0x4d144a,null))[_0x7601('0x29')](function(_0x43a8b0){if(_0x43a8b0){return _0x43a8b0[_0x7601('0x86')](_0x438871['body']['ids'],_[_0x7601('0x87')](_0x438871['body'],[_0x7601('0x72'),'id'])||{})[_0x7601('0x88')](function(_0x4ae02c){for(var _0x5e1dd8=0x0;_0x5e1dd8<_0x438871['body'][_0x7601('0x72')]['length'];_0x5e1dd8+=0x1){socket[_0x7601('0x89')]('userMailQueue:save',{'UserId':_0x438871[_0x7601('0x53')][_0x7601('0x72')][_0x5e1dd8],'MailQueueId':_0x438871['params']['id']});}return _0x4ae02c;});}})[_0x7601('0x29')](respondWithResult(_0x4d144a,null))['catch'](handleError(_0x4d144a,null));};exports['removeAgents']=function(_0x4b357f,_0x4c490a,_0x412bda){return db['MailQueue'][_0x7601('0x4b')]({'where':{'id':_0x4b357f['params']['id']}})['then'](handleEntityNotFound(_0x4c490a,null))[_0x7601('0x29')](function(_0x8d400f){if(_0x8d400f){return _0x8d400f['removeAgents'](_0x4b357f['query'][_0x7601('0x72')])[_0x7601('0x29')](function(){if(_[_0x7601('0x8a')](_0x4b357f[_0x7601('0x36')]['ids'])){for(var _0x3fb762=0x0;_0x3fb762<_0x4b357f[_0x7601('0x36')][_0x7601('0x72')]['length'];_0x3fb762+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x4b357f[_0x7601('0x36')][_0x7601('0x72')][_0x3fb762]),'MailQueueId':Number(_0x4b357f[_0x7601('0x48')]['id'])});}}else{socket[_0x7601('0x89')](_0x7601('0x85'),{'UserId':Number(_0x4b357f[_0x7601('0x36')][_0x7601('0x72')]),'MailQueueId':Number(_0x4b357f[_0x7601('0x48')]['id'])});}});}})[_0x7601('0x29')](respondWithStatusCode(_0x4c490a,null))['catch'](handleError(_0x4c490a,null));};exports['getAgents']=function(_0x36577c,_0x373224,_0x33de6b){var _0x5181d8={};var _0x3623ba={};var _0x9ba27f;var _0x5b9b9f;return db[_0x7601('0x44')]['findOne']({'where':{'id':_0x36577c[_0x7601('0x48')]['id']}})[_0x7601('0x29')](handleEntityNotFound(_0x373224,null))[_0x7601('0x29')](function(_0x24dfbf){if(_0x24dfbf){_0x9ba27f=_0x24dfbf;_0x3623ba[_0x7601('0x39')]=_[_0x7601('0x35')](db[_0x7601('0x5c')][_0x7601('0x30')]);_0x3623ba['query']=_[_0x7601('0x35')](_0x36577c[_0x7601('0x36')]);_0x3623ba[_0x7601('0x37')]=_[_0x7601('0x38')](_0x3623ba['model'],_0x3623ba[_0x7601('0x36')]);_0x5181d8[_0x7601('0x3a')]=_[_0x7601('0x38')](_0x3623ba[_0x7601('0x39')],qs[_0x7601('0x3b')](_0x36577c[_0x7601('0x36')][_0x7601('0x3b')]));_0x5181d8['attributes']=_0x5181d8['attributes']['length']?_0x5181d8['attributes']:_0x3623ba[_0x7601('0x39')];_0x5181d8['order']=qs[_0x7601('0x3f')](_0x36577c[_0x7601('0x36')][_0x7601('0x3f')]);_0x5181d8[_0x7601('0x40')]=qs[_0x7601('0x37')](_[_0x7601('0x41')](_0x36577c[_0x7601('0x36')],_0x3623ba[_0x7601('0x37')]));if(_0x36577c['query'][_0x7601('0x67')]){_0x5181d8['where']=_['merge'](_0x5181d8['where'],{'$or':_['map'](_0x5181d8['attributes'],function(_0x1f2b29){var _0x1f695b={};_0x1f695b[_0x1f2b29]={'$like':'%'+_0x36577c[_0x7601('0x36')][_0x7601('0x67')]+'%'};return _0x1f695b;})});}_0x5181d8=_[_0x7601('0x43')]({},_0x5181d8,_0x36577c['options']);return _0x9ba27f['getAgents'](_0x5181d8);}})[_0x7601('0x29')](function(_0x349af0){if(_0x349af0){_0x5b9b9f=_0x349af0[_0x7601('0x3c')];if(!_0x36577c['query'][_0x7601('0x3d')](_0x7601('0x3e'))){_0x5181d8[_0x7601('0x22')]=qs[_0x7601('0x22')](_0x36577c[_0x7601('0x36')][_0x7601('0x22')]);_0x5181d8[_0x7601('0x21')]=qs['offset'](_0x36577c[_0x7601('0x36')][_0x7601('0x21')]);}return _0x9ba27f[_0x7601('0x8b')](_0x5181d8);}})[_0x7601('0x29')](function(_0x5c0d8e){if(_0x5c0d8e){return _0x5c0d8e?{'count':_0x5b9b9f,'rows':_0x5c0d8e}:null;}})[_0x7601('0x29')](respondWithResult(_0x373224,null))[_0x7601('0x46')](handleError(_0x373224,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 76e3251..957849c 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 _0x55b3=['../../mysqldb','MailQueue','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x52a518,_0x1ffdfc){var _0x1beb46=function(_0x476d8c){while(--_0x476d8c){_0x52a518['push'](_0x52a518['shift']());}};_0x1beb46(++_0x1ffdfc);}(_0x55b3,0x6b));var _0x355b=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x55b3[_0x4ae6ef];return _0x3cbb4e;};'use strict';var EventEmitter=require(_0x355b('0x0'));var MailQueue=require(_0x355b('0x1'))['db'][_0x355b('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x355b('0x3')](0x0);var events={'afterCreate':_0x355b('0x4'),'afterUpdate':_0x355b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x375ef2){return function(_0xe141f,_0x3ba85f,_0x1cc1c6){MailQueueEvents[_0x355b('0x6')](_0x375ef2+':'+_0xe141f['id'],_0xe141f);MailQueueEvents['emit'](_0x375ef2,_0xe141f);_0x1cc1c6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x355b('0x7')](e,emitEvent(event));}}module[_0x355b('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xa40f=['../../mysqldb','MailQueue','save','emit','hasOwnProperty','hook','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa40f,0x142));var _0xfa40=function(_0x11b463,_0xc0ebbf){_0x11b463=_0x11b463-0x0;var _0x5026a5=_0xa40f[_0x11b463];return _0x5026a5;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xfa40('0x0'))['db'][_0xfa40('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfa40('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c8979){return function(_0x2f974d,_0x3ceb89,_0x5599d4){MailQueueEvents['emit'](_0x5c8979+':'+_0x2f974d['id'],_0x2f974d);MailQueueEvents[_0xfa40('0x3')](_0x5c8979,_0x2f974d);_0x5599d4(null);};}for(var e in events){if(events[_0xfa40('0x4')](e)){var event=events[e];MailQueue[_0xfa40('0x5')](e,emitEvent(event));}}module[_0xfa40('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 8d88ef9..f397d6e 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 _0x2d9b=['moment','request-promise','rimraf','../../config/environment','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api'];(function(_0x2baf20,_0x46cc60){var _0x50df6d=function(_0x34179b){while(--_0x34179b){_0x2baf20['push'](_0x2baf20['shift']());}};_0x50df6d(++_0x46cc60);}(_0x2d9b,0x158));var _0xb2d9=function(_0x7e5e04,_0x85cbf9){_0x7e5e04=_0x7e5e04-0x0;var _0x4a18ef=_0x2d9b[_0x7e5e04];return _0x4a18ef;};'use strict';var _=require(_0xb2d9('0x0'));var util=require(_0xb2d9('0x1'));var logger=require(_0xb2d9('0x2'))(_0xb2d9('0x3'));var moment=require(_0xb2d9('0x4'));var BPromise=require('bluebird');var rp=require(_0xb2d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2d9('0x6'));var config=require(_0xb2d9('0x7'));var attributes=require('./mailQueue.attributes');module[_0xb2d9('0x8')]=function(_0x26043d,_0x2eee45){return _0x26043d[_0xb2d9('0x9')](_0xb2d9('0xa'),attributes,{'tableName':_0xb2d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3243=['moment','bluebird','path','rimraf','../../config/environment','exports','define','MailQueue','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3243,0xf8));var _0x3324=function(_0x326c5b,_0x4b7e74){_0x326c5b=_0x326c5b-0x0;var _0x59de0a=_0x3243[_0x326c5b];return _0x59de0a;};'use strict';var _=require(_0x3324('0x0'));var util=require(_0x3324('0x1'));var logger=require(_0x3324('0x2'))(_0x3324('0x3'));var moment=require(_0x3324('0x4'));var BPromise=require(_0x3324('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3324('0x6'));var rimraf=require(_0x3324('0x7'));var config=require(_0x3324('0x8'));var attributes=require('./mailQueue.attributes');module[_0x3324('0x9')]=function(_0x2f880f,_0x3214cd){return _0x2f880f[_0x3324('0xa')](_0x3324('0xb'),attributes,{'tableName':'mail_queues','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 04a9793..e2706dd 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 _0xffdc=['error','MailQueue,\x20%s,\x20%s','message','catch','GetMailQueue','MailQueue','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','ShowMailQueue','where','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent'];(function(_0x2a36e5,_0xab1eb9){var _0xff838f=function(_0x409c7a){while(--_0x409c7a){_0x2a36e5['push'](_0x2a36e5['shift']());}};_0xff838f(++_0xab1eb9);}(_0xffdc,0x9a));var _0xcffd=function(_0x37810c,_0x480382){_0x37810c=_0x37810c-0x0;var _0x44c4ef=_0xffdc[_0x37810c];return _0x44c4ef;};'use strict';var _=require('lodash');var util=require(_0xcffd('0x0'));var moment=require('moment');var BPromise=require(_0xcffd('0x1'));var rs=require(_0xcffd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcffd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcffd('0x4'))('rpc');var config=require(_0xcffd('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcffd('0x6')]({'port':0x232a});config[_0xcffd('0x7')]=_[_0xcffd('0x8')](config['redis'],{'host':_0xcffd('0x9'),'port':0x18eb});var socket=require(_0xcffd('0xa'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xcffd('0xb')](socket);function respondWithRpcPromise(_0x2961ae,_0x5aa7b5,_0x22ca89){return new BPromise(function(_0x3dd9b6,_0x369158){return client[_0xcffd('0xc')](_0x2961ae,_0x22ca89)[_0xcffd('0xd')](function(_0x27ab3a){logger[_0xcffd('0xe')]('MailQueue,\x20%s,\x20%s',_0x5aa7b5,'request\x20sent');logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x5aa7b5,_0xcffd('0xf'),JSON['stringify'](_0x27ab3a));if(_0x27ab3a[_0xcffd('0x10')]){if(_0x27ab3a['error']['code']===0x1f4){logger[_0xcffd('0x10')](_0xcffd('0x11'),_0x5aa7b5,_0x27ab3a['error']['message']);return _0x369158(_0x27ab3a[_0xcffd('0x10')][_0xcffd('0x12')]);}logger[_0xcffd('0x10')]('MailQueue,\x20%s,\x20%s',_0x5aa7b5,_0x27ab3a[_0xcffd('0x10')][_0xcffd('0x12')]);return _0x3dd9b6(_0x27ab3a[_0xcffd('0x10')][_0xcffd('0x12')]);}else{logger[_0xcffd('0xe')](_0xcffd('0x11'),_0x5aa7b5,'request\x20sent');_0x3dd9b6(_0x27ab3a['result']['message']);}})[_0xcffd('0x13')](function(_0x5b7c1c){logger[_0xcffd('0x10')](_0xcffd('0x11'),_0x5aa7b5,_0x5b7c1c);_0x369158(_0x5b7c1c);});});}exports[_0xcffd('0x14')]=function(_0x5c9030){var _0xed67f=this;return new Promise(function(_0x3d8c9e,_0x3418ea){return db[_0xcffd('0x15')][_0xcffd('0x16')]({'raw':_0x5c9030[_0xcffd('0x17')]?_0x5c9030[_0xcffd('0x17')][_0xcffd('0x18')]===undefined?!![]:![]:!![],'where':_0x5c9030[_0xcffd('0x17')]?_0x5c9030[_0xcffd('0x17')]['where']||null:null,'attributes':_0x5c9030[_0xcffd('0x17')]?_0x5c9030[_0xcffd('0x17')][_0xcffd('0x19')]||null:null,'limit':_0x5c9030[_0xcffd('0x17')]?_0x5c9030[_0xcffd('0x17')][_0xcffd('0x1a')]||null:null,'include':_0x5c9030['options']?_0x5c9030[_0xcffd('0x17')][_0xcffd('0x1b')]?_[_0xcffd('0x1c')](_0x5c9030['options']['include'],function(_0x1dd4d8){return{'model':db[_0x1dd4d8[_0xcffd('0x1d')]],'as':_0x1dd4d8['as'],'attributes':_0x1dd4d8['attributes'],'include':_0x1dd4d8[_0xcffd('0x1b')]?_[_0xcffd('0x1c')](_0x1dd4d8[_0xcffd('0x1b')],function(_0x446a6d){return{'model':db[_0x446a6d[_0xcffd('0x1d')]],'as':_0x446a6d['as'],'attributes':_0x446a6d['attributes'],'include':_0x446a6d[_0xcffd('0x1b')]?_[_0xcffd('0x1c')](_0x446a6d['include'],function(_0x339b25){return{'model':db[_0x339b25[_0xcffd('0x1d')]],'as':_0x339b25['as'],'attributes':_0x339b25[_0xcffd('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcffd('0xd')](function(_0x19bf46){logger[_0xcffd('0xe')](_0xcffd('0x14'),_0x5c9030);logger[_0xcffd('0x1e')](_0xcffd('0x14'),_0x5c9030,JSON[_0xcffd('0x1f')](_0x19bf46));_0x3d8c9e(_0x19bf46);})[_0xcffd('0x13')](function(_0x4824c9){logger['error'](_0xcffd('0x14'),_0x4824c9[_0xcffd('0x12')],_0x5c9030);_0x3418ea(_0xed67f['error'](0x1f4,_0x4824c9['message']));});});};exports[_0xcffd('0x20')]=function(_0x501400){var _0xff4911=this;return new Promise(function(_0x9446ea,_0x503070){return db[_0xcffd('0x15')]['find']({'raw':_0x501400[_0xcffd('0x17')]?_0x501400[_0xcffd('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x501400[_0xcffd('0x17')]?_0x501400[_0xcffd('0x17')][_0xcffd('0x21')]||null:null,'attributes':_0x501400['options']?_0x501400[_0xcffd('0x17')][_0xcffd('0x19')]||null:null,'include':_0x501400[_0xcffd('0x17')]?_0x501400[_0xcffd('0x17')][_0xcffd('0x1b')]?_[_0xcffd('0x1c')](_0x501400[_0xcffd('0x17')][_0xcffd('0x1b')],function(_0x1a7373){return{'model':db[_0x1a7373[_0xcffd('0x1d')]],'as':_0x1a7373['as'],'attributes':_0x1a7373[_0xcffd('0x19')],'include':_0x1a7373[_0xcffd('0x1b')]?_[_0xcffd('0x1c')](_0x1a7373[_0xcffd('0x1b')],function(_0x228b82){return{'model':db[_0x228b82[_0xcffd('0x1d')]],'as':_0x228b82['as'],'attributes':_0x228b82['attributes'],'include':_0x228b82[_0xcffd('0x1b')]?_[_0xcffd('0x1c')](_0x228b82[_0xcffd('0x1b')],function(_0x17e3b7){return{'model':db[_0x17e3b7[_0xcffd('0x1d')]],'as':_0x17e3b7['as'],'attributes':_0x17e3b7['attributes']};}):[]};}):[]};}):[]:[]})[_0xcffd('0xd')](function(_0x10372a){logger[_0xcffd('0xe')]('ShowMailQueue',_0x501400);logger[_0xcffd('0x1e')](_0xcffd('0x20'),_0x501400,JSON[_0xcffd('0x1f')](_0x10372a));_0x9446ea(_0x10372a);})['catch'](function(_0x319f1e){logger[_0xcffd('0x10')](_0xcffd('0x20'),_0x319f1e['message'],_0x501400);_0x503070(_0xff4911['error'](0x1f4,_0x319f1e['message']));});});}; \ No newline at end of file +var _0x77e3=['../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','ShowMailQueue','find','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x28ba65,_0x2e542e){var _0x5b7992=function(_0x39db70){while(--_0x39db70){_0x28ba65['push'](_0x28ba65['shift']());}};_0x5b7992(++_0x2e542e);}(_0x77e3,0x13a));var _0x377e=function(_0x32d6cd,_0x56b92f){_0x32d6cd=_0x32d6cd-0x0;var _0x8120a2=_0x77e3[_0x32d6cd];return _0x8120a2;};'use strict';var _=require(_0x377e('0x0'));var util=require(_0x377e('0x1'));var moment=require(_0x377e('0x2'));var BPromise=require(_0x377e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x377e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x377e('0x5'));var logger=require(_0x377e('0x6'))('rpc');var config=require(_0x377e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x377e('0x8')][_0x377e('0x9')]({'port':0x232a});config[_0x377e('0xa')]=_['defaults'](config['redis'],{'host':_0x377e('0xb'),'port':0x18eb});var socket=require(_0x377e('0xc'))(new Redis(config[_0x377e('0xa')]));require(_0x377e('0xd'))[_0x377e('0xe')](socket);function respondWithRpcPromise(_0x5d5d3c,_0x20b394,_0xdfc8ca){return new BPromise(function(_0x2a8c18,_0x3317fc){return client[_0x377e('0xf')](_0x5d5d3c,_0xdfc8ca)['then'](function(_0x269e87){logger[_0x377e('0x10')](_0x377e('0x11'),_0x20b394,'request\x20sent');logger['debug'](_0x377e('0x12'),_0x20b394,_0x377e('0x13'),JSON[_0x377e('0x14')](_0x269e87));if(_0x269e87[_0x377e('0x15')]){if(_0x269e87[_0x377e('0x15')][_0x377e('0x16')]===0x1f4){logger[_0x377e('0x15')]('MailQueue,\x20%s,\x20%s',_0x20b394,_0x269e87[_0x377e('0x15')][_0x377e('0x17')]);return _0x3317fc(_0x269e87[_0x377e('0x15')]['message']);}logger['error']('MailQueue,\x20%s,\x20%s',_0x20b394,_0x269e87[_0x377e('0x15')][_0x377e('0x17')]);return _0x2a8c18(_0x269e87[_0x377e('0x15')][_0x377e('0x17')]);}else{logger[_0x377e('0x10')]('MailQueue,\x20%s,\x20%s',_0x20b394,'request\x20sent');_0x2a8c18(_0x269e87['result'][_0x377e('0x17')]);}})[_0x377e('0x18')](function(_0x1f592f){logger[_0x377e('0x15')](_0x377e('0x11'),_0x20b394,_0x1f592f);_0x3317fc(_0x1f592f);});});}exports[_0x377e('0x19')]=function(_0x16c958){var _0x2d50f3=this;return new Promise(function(_0x497976,_0x18f723){return db[_0x377e('0x1a')][_0x377e('0x1b')]({'raw':_0x16c958['options']?_0x16c958[_0x377e('0x1c')][_0x377e('0x1d')]===undefined?!![]:![]:!![],'where':_0x16c958['options']?_0x16c958[_0x377e('0x1c')][_0x377e('0x1e')]||null:null,'attributes':_0x16c958[_0x377e('0x1c')]?_0x16c958[_0x377e('0x1c')][_0x377e('0x1f')]||null:null,'limit':_0x16c958[_0x377e('0x1c')]?_0x16c958[_0x377e('0x1c')][_0x377e('0x20')]||null:null,'include':_0x16c958[_0x377e('0x1c')]?_0x16c958['options'][_0x377e('0x21')]?_['map'](_0x16c958[_0x377e('0x1c')][_0x377e('0x21')],function(_0x302070){return{'model':db[_0x302070[_0x377e('0x22')]],'as':_0x302070['as'],'attributes':_0x302070[_0x377e('0x1f')],'include':_0x302070[_0x377e('0x21')]?_[_0x377e('0x23')](_0x302070[_0x377e('0x21')],function(_0x4792ae){return{'model':db[_0x4792ae[_0x377e('0x22')]],'as':_0x4792ae['as'],'attributes':_0x4792ae[_0x377e('0x1f')],'include':_0x4792ae[_0x377e('0x21')]?_[_0x377e('0x23')](_0x4792ae[_0x377e('0x21')],function(_0x2d6af7){return{'model':db[_0x2d6af7['model']],'as':_0x2d6af7['as'],'attributes':_0x2d6af7[_0x377e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x377e('0x24')](function(_0x2aa7ad){logger[_0x377e('0x10')](_0x377e('0x19'),_0x16c958);logger[_0x377e('0x25')](_0x377e('0x19'),_0x16c958,JSON[_0x377e('0x14')](_0x2aa7ad));_0x497976(_0x2aa7ad);})[_0x377e('0x18')](function(_0x1c06ff){logger[_0x377e('0x15')](_0x377e('0x19'),_0x1c06ff[_0x377e('0x17')],_0x16c958);_0x18f723(_0x2d50f3[_0x377e('0x15')](0x1f4,_0x1c06ff['message']));});});};exports[_0x377e('0x26')]=function(_0x4d311b){var _0x22e760=this;return new Promise(function(_0x1e6fd4,_0xe0168c){return db[_0x377e('0x1a')][_0x377e('0x27')]({'raw':_0x4d311b[_0x377e('0x1c')]?_0x4d311b['options'][_0x377e('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d311b[_0x377e('0x1c')]?_0x4d311b['options'][_0x377e('0x1e')]||null:null,'attributes':_0x4d311b[_0x377e('0x1c')]?_0x4d311b[_0x377e('0x1c')][_0x377e('0x1f')]||null:null,'include':_0x4d311b[_0x377e('0x1c')]?_0x4d311b[_0x377e('0x1c')]['include']?_[_0x377e('0x23')](_0x4d311b[_0x377e('0x1c')][_0x377e('0x21')],function(_0x2906ad){return{'model':db[_0x2906ad[_0x377e('0x22')]],'as':_0x2906ad['as'],'attributes':_0x2906ad[_0x377e('0x1f')],'include':_0x2906ad[_0x377e('0x21')]?_[_0x377e('0x23')](_0x2906ad[_0x377e('0x21')],function(_0x25f5a1){return{'model':db[_0x25f5a1[_0x377e('0x22')]],'as':_0x25f5a1['as'],'attributes':_0x25f5a1['attributes'],'include':_0x25f5a1[_0x377e('0x21')]?_['map'](_0x25f5a1[_0x377e('0x21')],function(_0x55304d){return{'model':db[_0x55304d[_0x377e('0x22')]],'as':_0x55304d['as'],'attributes':_0x55304d['attributes']};}):[]};}):[]};}):[]:[]})[_0x377e('0x24')](function(_0x5f16f4){logger[_0x377e('0x10')](_0x377e('0x26'),_0x4d311b);logger[_0x377e('0x25')](_0x377e('0x26'),_0x4d311b,JSON['stringify'](_0x5f16f4));_0x1e6fd4(_0x5f16f4);})['catch'](function(_0x41adad){logger[_0x377e('0x15')](_0x377e('0x26'),_0x41adad[_0x377e('0x17')],_0x4d311b);_0xe0168c(_0x22e760[_0x377e('0x15')](0x1f4,_0x41adad['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e964994..df43b5d 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 _0xa1aa=['remove','update','emit','removeListener','./mailQueue.events'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa1aa,0x1b7));var _0xaa1a=function(_0x4fdebc,_0xd6542d){_0x4fdebc=_0x4fdebc-0x0;var _0x10c973=_0xa1aa[_0x4fdebc];return _0x10c973;};'use strict';var MailQueueEvents=require(_0xaa1a('0x0'));var events=['save',_0xaa1a('0x1'),_0xaa1a('0x2')];function createListener(_0x23ff5a,_0x3c66c6){return function(_0x4f0cab){_0x3c66c6[_0xaa1a('0x3')](_0x23ff5a,_0x4f0cab);};}function removeListener(_0x1659e4,_0x456178){return function(){MailQueueEvents[_0xaa1a('0x4')](_0x1659e4,_0x456178);};}exports['register']=function(_0x5ebf28){for(var _0x5f9870=0x0,_0x5de458=events['length'];_0x5f9870<_0x5de458;_0x5f9870++){var _0x56d23=events[_0x5f9870];var _0x4f6b64=createListener('mailQueue:'+_0x56d23,_0x5ebf28);MailQueueEvents['on'](_0x56d23,_0x4f6b64);}}; \ No newline at end of file +var _0xced7=['./mailQueue.events','save','remove','update','emit','removeListener','register','length','mailQueue:'];(function(_0xaecc27,_0x3b15ab){var _0x2203ec=function(_0x47efdf){while(--_0x47efdf){_0xaecc27['push'](_0xaecc27['shift']());}};_0x2203ec(++_0x3b15ab);}(_0xced7,0xe1));var _0x7ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced7[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0x7ced('0x0'));var events=[_0x7ced('0x1'),_0x7ced('0x2'),_0x7ced('0x3')];function createListener(_0x235c9d,_0x2810c5){return function(_0x18760e){_0x2810c5[_0x7ced('0x4')](_0x235c9d,_0x18760e);};}function removeListener(_0x4d5ddf,_0xfb61d3){return function(){MailQueueEvents[_0x7ced('0x5')](_0x4d5ddf,_0xfb61d3);};}exports[_0x7ced('0x6')]=function(_0x148241){for(var _0x3eba1b=0x0,_0x4e80d0=events[_0x7ced('0x7')];_0x3eba1b<_0x4e80d0;_0x3eba1b++){var _0x40ee81=events[_0x3eba1b];var _0x79d938=createListener(_0x7ced('0x8')+_0x40ee81,_0x148241);MailQueueEvents['on'](_0x40ee81,_0x79d938);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index ae5647a..f78d55e 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 _0x8b59=['../../config/environment','get','isAuthenticated','index','describe','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1b7796,_0x7bf91b){var _0x2e79a6=function(_0x5b3d91){while(--_0x5b3d91){_0x1b7796['push'](_0x1b7796['shift']());}};_0x2e79a6(++_0x7bf91b);}(_0x8b59,0xae));var _0x98b5=function(_0x37c60c,_0x15bbdd){_0x37c60c=_0x37c60c-0x0;var _0x3e7426=_0x8b59[_0x37c60c];return _0x3e7426;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x98b5('0x0'));var timeout=require(_0x98b5('0x1'));var express=require(_0x98b5('0x2'));var router=express[_0x98b5('0x3')]();var auth=require(_0x98b5('0x4'));var interaction=require(_0x98b5('0x5'));var config=require(_0x98b5('0x6'));var controller=require('./mailQueueReport.controller');router[_0x98b5('0x7')]('/',auth[_0x98b5('0x8')](),controller[_0x98b5('0x9')]);router['get']('/describe',auth[_0x98b5('0x8')](),controller[_0x98b5('0xa')]);router[_0x98b5('0x7')]('/:id',auth[_0x98b5('0x8')](),controller['show']);router[_0x98b5('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x98b5('0xc')](_0x98b5('0xd'),auth[_0x98b5('0x8')](),controller[_0x98b5('0xe')]);router[_0x98b5('0xf')](_0x98b5('0xd'),auth[_0x98b5('0x8')](),controller[_0x98b5('0x10')]);module[_0x98b5('0x11')]=router; \ No newline at end of file +var _0xac89=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x53eb8b,_0x2392b7){var _0x23890=function(_0x522405){while(--_0x522405){_0x53eb8b['push'](_0x53eb8b['shift']());}};_0x23890(++_0x2392b7);}(_0xac89,0xf6));var _0x9ac8=function(_0x343595,_0x3c5e93){_0x343595=_0x343595-0x0;var _0x32c374=_0xac89[_0x343595];return _0x32c374;};'use strict';var multer=require(_0x9ac8('0x0'));var util=require(_0x9ac8('0x1'));var path=require(_0x9ac8('0x2'));var timeout=require(_0x9ac8('0x3'));var express=require(_0x9ac8('0x4'));var router=express[_0x9ac8('0x5')]();var auth=require(_0x9ac8('0x6'));var interaction=require(_0x9ac8('0x7'));var config=require(_0x9ac8('0x8'));var controller=require(_0x9ac8('0x9'));router['get']('/',auth[_0x9ac8('0xa')](),controller[_0x9ac8('0xb')]);router[_0x9ac8('0xc')](_0x9ac8('0xd'),auth['isAuthenticated'](),controller[_0x9ac8('0xe')]);router['get'](_0x9ac8('0xf'),auth[_0x9ac8('0xa')](),controller[_0x9ac8('0x10')]);router[_0x9ac8('0x11')]('/',auth['isAuthenticated'](),controller[_0x9ac8('0x12')]);router[_0x9ac8('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x9ac8('0x14')]);router[_0x9ac8('0x15')]('/:id',auth[_0x9ac8('0xa')](),controller[_0x9ac8('0x16')]);module[_0x9ac8('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 92c8dfa..c8be151 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 _0x514a=['exports','STRING','DATE','moment'];(function(_0x43bc08,_0x3eee57){var _0x43e96a=function(_0x4b89d5){while(--_0x4b89d5){_0x43bc08['push'](_0x43bc08['shift']());}};_0x43e96a(++_0x3eee57);}(_0x514a,0x1bb));var _0xa514=function(_0x4d25e0,_0x25bb05){_0x4d25e0=_0x4d25e0-0x0;var _0x52a27c=_0x514a[_0x4d25e0];return _0x52a27c;};'use strict';var moment=require(_0xa514('0x0'));var Sequelize=require('sequelize');module[_0xa514('0x1')]={'uniqueid':{'type':Sequelize[_0xa514('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa514('0x2')]},'joinAt':{'type':Sequelize[_0xa514('0x3')]},'leaveAt':{'type':Sequelize[_0xa514('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa514('0x3')]},'reason':{'type':Sequelize[_0xa514('0x2')]}}; \ No newline at end of file +var _0x3038=['sequelize','exports','STRING','DATE','moment'];(function(_0x29caf3,_0x88a317){var _0x3dc931=function(_0x228469){while(--_0x228469){_0x29caf3['push'](_0x29caf3['shift']());}};_0x3dc931(++_0x88a317);}(_0x3038,0x15d));var _0x8303=function(_0xc8a11,_0x347a33){_0xc8a11=_0xc8a11-0x0;var _0x55a500=_0x3038[_0xc8a11];return _0x55a500;};'use strict';var moment=require(_0x8303('0x0'));var Sequelize=require(_0x8303('0x1'));module[_0x8303('0x2')]={'uniqueid':{'type':Sequelize[_0x8303('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8303('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8303('0x4')]},'acceptAt':{'type':Sequelize[_0x8303('0x4')]},'exitAt':{'type':Sequelize[_0x8303('0x4')]},'reason':{'type':Sequelize[_0x8303('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 9677149..fb5ebba 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 _0xd652=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','VIRTUAL','merge','where','include','findAll','rows','catch','show','params','keys','length','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1dfc7e,_0x31b757){var _0x1bd821=function(_0x3c7d29){while(--_0x3c7d29){_0x1dfc7e['push'](_0x1dfc7e['shift']());}};_0x1bd821(++_0x31b757);}(_0xd652,0xd3));var _0x2d65=function(_0x5d5ab2,_0x1d3681){_0x5d5ab2=_0x5d5ab2-0x0;var _0xb8fe37=_0xd652[_0x5d5ab2];return _0xb8fe37;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2d65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d65('0x1'));var jsonpatch=require(_0x2d65('0x2'));var rp=require('request-promise');var moment=require(_0x2d65('0x3'));var BPromise=require(_0x2d65('0x4'));var Mustache=require(_0x2d65('0x5'));var util=require(_0x2d65('0x6'));var path=require(_0x2d65('0x7'));var sox=require(_0x2d65('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2d65('0x9'));var squel=require(_0x2d65('0xa'));var crypto=require(_0x2d65('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2d65('0xc'));var toCsv=require(_0x2d65('0xd'));var querystring=require(_0x2d65('0xe'));var Papa=require(_0x2d65('0xf'));var Redis=require(_0x2d65('0x10'));var authService=require(_0x2d65('0x11'));var qs=require(_0x2d65('0x12'));var as=require(_0x2d65('0x13'));var hardwareService=require(_0x2d65('0x14'));var logger=require('../../config/logger')(_0x2d65('0x15'));var utils=require(_0x2d65('0x16'));var config=require(_0x2d65('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d65('0x18'))['db'];function respondWithStatusCode(_0xda882f,_0x4e6ab7){_0x4e6ab7=_0x4e6ab7||0xcc;return function(_0x515b2b){if(_0x515b2b){return _0xda882f[_0x2d65('0x19')](_0x4e6ab7);}return _0xda882f['status'](_0x4e6ab7)[_0x2d65('0x1a')]();};}function respondWithResult(_0xa6167f,_0x561704){_0x561704=_0x561704||0xc8;return function(_0x387ef1){if(_0x387ef1){return _0xa6167f[_0x2d65('0x1b')](_0x561704)['json'](_0x387ef1);}};}function respondWithFilteredResult(_0x135fa0,_0x55ecb4){return function(_0x3fbe3c){if(_0x3fbe3c){var _0x1a6da4=_0x3fbe3c[_0x2d65('0x1c')],_0x457af1=_0x55ecb4[_0x2d65('0x1d')],_0x2fed86=_0x55ecb4[_0x2d65('0x1d')]+_0x55ecb4[_0x2d65('0x1e')],_0xbb24eb;if(_0x2fed86>=_0x1a6da4){_0x2fed86=_0x1a6da4;_0xbb24eb=0xc8;}else{_0xbb24eb=0xce;}_0x135fa0[_0x2d65('0x1b')](_0xbb24eb);return _0x135fa0[_0x2d65('0x1f')]('Content-Range',_0x457af1+'-'+_0x2fed86+'/'+_0x1a6da4)[_0x2d65('0x20')](_0x3fbe3c);}return null;};}function patchUpdates(_0x95fc3c){return function(_0x391b7b){try{jsonpatch[_0x2d65('0x21')](_0x391b7b,_0x95fc3c,!![]);}catch(_0x1ea69d){return BPromise[_0x2d65('0x22')](_0x1ea69d);}return _0x391b7b[_0x2d65('0x23')]();};}function saveUpdates(_0x2ef168,_0x56e3ce){return function(_0x1c22e3){if(_0x1c22e3){return _0x1c22e3[_0x2d65('0x24')](_0x2ef168)[_0x2d65('0x25')](function(_0x2f90d7){return _0x2f90d7;});}return null;};}function removeEntity(_0x92a9b7,_0x4941a4){return function(_0x164571){if(_0x164571){return _0x164571[_0x2d65('0x26')]()[_0x2d65('0x25')](function(){_0x92a9b7[_0x2d65('0x1b')](0xcc)[_0x2d65('0x1a')]();});}};}function handleEntityNotFound(_0x5729b7,_0x4f1dd3){return function(_0xf1ae89){if(!_0xf1ae89){_0x5729b7['sendStatus'](0x194);}return _0xf1ae89;};}function handleError(_0x402b3f,_0x15e895){_0x15e895=_0x15e895||0x1f4;return function(_0x4afc60){logger[_0x2d65('0x27')](_0x4afc60[_0x2d65('0x28')]);if(_0x4afc60['name']){delete _0x4afc60['name'];}_0x402b3f[_0x2d65('0x1b')](_0x15e895)[_0x2d65('0x29')](_0x4afc60);};}exports[_0x2d65('0x2a')]=function(_0x2c0042,_0x4fc849){var _0x257f69={},_0x2dc3b9={},_0x268a9d={'count':0x0,'rows':[]};var _0x34454e=_['map'](db[_0x2d65('0x2b')][_0x2d65('0x2c')],function(_0x30784c){return{'name':_0x30784c[_0x2d65('0x2d')],'type':_0x30784c[_0x2d65('0x2e')][_0x2d65('0x2f')]};});_0x2dc3b9[_0x2d65('0x30')]=_[_0x2d65('0x31')](_0x34454e,_0x2d65('0x32'));_0x2dc3b9[_0x2d65('0x33')]=_['keys'](_0x2c0042[_0x2d65('0x33')]);_0x2dc3b9[_0x2d65('0x34')]=_[_0x2d65('0x35')](_0x2dc3b9[_0x2d65('0x30')],_0x2dc3b9[_0x2d65('0x33')]);_0x257f69[_0x2d65('0x36')]=_[_0x2d65('0x35')](_0x2dc3b9[_0x2d65('0x30')],qs[_0x2d65('0x37')](_0x2c0042['query'][_0x2d65('0x37')]));_0x257f69['attributes']=_0x257f69['attributes']['length']?_0x257f69[_0x2d65('0x36')]:_0x2dc3b9[_0x2d65('0x30')];if(!_0x2c0042[_0x2d65('0x33')][_0x2d65('0x38')](_0x2d65('0x39'))){_0x257f69[_0x2d65('0x1e')]=qs['limit'](_0x2c0042['query'][_0x2d65('0x1e')]);_0x257f69[_0x2d65('0x1d')]=qs['offset'](_0x2c0042[_0x2d65('0x33')][_0x2d65('0x1d')]);}_0x257f69[_0x2d65('0x3a')]=qs[_0x2d65('0x3b')](_0x2c0042[_0x2d65('0x33')][_0x2d65('0x3b')]);_0x257f69['where']=qs[_0x2d65('0x34')](_['pick'](_0x2c0042['query'],_0x2dc3b9[_0x2d65('0x34')]),_0x34454e);if(_0x2c0042[_0x2d65('0x33')][_0x2d65('0x3c')]){_0x257f69['where']=_['merge'](_0x257f69['where'],{'$or':_[_0x2d65('0x31')](_0x34454e,function(_0x361033){if(_0x361033[_0x2d65('0x2e')]!==_0x2d65('0x3d')){var _0x67ae17={};_0x67ae17[_0x361033[_0x2d65('0x32')]]={'$like':'%'+_0x2c0042[_0x2d65('0x33')][_0x2d65('0x3c')]+'%'};return _0x67ae17;}})});}_0x257f69=_[_0x2d65('0x3e')]({},_0x257f69,_0x2c0042['options']);var _0x2f5216={'where':_0x257f69[_0x2d65('0x3f')]};return db['MailQueueReport'][_0x2d65('0x1c')](_0x2f5216)[_0x2d65('0x25')](function(_0x24da19){_0x268a9d[_0x2d65('0x1c')]=_0x24da19;if(_0x2c0042[_0x2d65('0x33')]['includeAll']){_0x257f69[_0x2d65('0x40')]=[{'all':!![]}];}return db[_0x2d65('0x2b')][_0x2d65('0x41')](_0x257f69);})[_0x2d65('0x25')](function(_0x97dc86){_0x268a9d[_0x2d65('0x42')]=_0x97dc86;return _0x268a9d;})[_0x2d65('0x25')](respondWithFilteredResult(_0x4fc849,_0x257f69))[_0x2d65('0x43')](handleError(_0x4fc849,null));};exports[_0x2d65('0x44')]=function(_0x2838d2,_0x297d86){var _0x3a9b76={'raw':!![],'where':{'id':_0x2838d2[_0x2d65('0x45')]['id']}},_0x312346={};_0x312346[_0x2d65('0x30')]=_[_0x2d65('0x46')](db['MailQueueReport']['rawAttributes']);_0x312346[_0x2d65('0x33')]=_['keys'](_0x2838d2[_0x2d65('0x33')]);_0x312346[_0x2d65('0x34')]=_[_0x2d65('0x35')](_0x312346['model'],_0x312346['query']);_0x3a9b76['attributes']=_[_0x2d65('0x35')](_0x312346[_0x2d65('0x30')],qs['fields'](_0x2838d2[_0x2d65('0x33')][_0x2d65('0x37')]));_0x3a9b76[_0x2d65('0x36')]=_0x3a9b76[_0x2d65('0x36')][_0x2d65('0x47')]?_0x3a9b76[_0x2d65('0x36')]:_0x312346[_0x2d65('0x30')];if(_0x2838d2['query']['includeAll']){_0x3a9b76[_0x2d65('0x40')]=[{'all':!![]}];}_0x3a9b76=_[_0x2d65('0x3e')]({},_0x3a9b76,_0x2838d2[_0x2d65('0x48')]);return db['MailQueueReport']['find'](_0x3a9b76)[_0x2d65('0x25')](handleEntityNotFound(_0x297d86,null))[_0x2d65('0x25')](respondWithResult(_0x297d86,null))[_0x2d65('0x43')](handleError(_0x297d86,null));};exports['create']=function(_0x590fcf,_0x244f58){return db['MailQueueReport'][_0x2d65('0x49')](_0x590fcf['body'],{})['then'](respondWithResult(_0x244f58,0xc9))['catch'](handleError(_0x244f58,null));};exports[_0x2d65('0x24')]=function(_0x594d61,_0x137333){if(_0x594d61[_0x2d65('0x4a')]['id']){delete _0x594d61[_0x2d65('0x4a')]['id'];}return db['MailQueueReport'][_0x2d65('0x4b')]({'where':{'id':_0x594d61['params']['id']}})[_0x2d65('0x25')](handleEntityNotFound(_0x137333,null))[_0x2d65('0x25')](saveUpdates(_0x594d61[_0x2d65('0x4a')],null))[_0x2d65('0x25')](respondWithResult(_0x137333,null))[_0x2d65('0x43')](handleError(_0x137333,null));};exports['destroy']=function(_0x3a6c83,_0x5a7cef){return db['MailQueueReport']['find']({'where':{'id':_0x3a6c83['params']['id']}})['then'](handleEntityNotFound(_0x5a7cef,null))[_0x2d65('0x25')](removeEntity(_0x5a7cef,null))[_0x2d65('0x43')](handleError(_0x5a7cef,null));};exports[_0x2d65('0x4c')]=function(_0x3e3f23,_0x32f64b){return db['MailQueueReport'][_0x2d65('0x4c')]()['then'](respondWithResult(_0x32f64b,null))[_0x2d65('0x43')](handleError(_0x32f64b,null));}; \ No newline at end of file +var _0x5906=['to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','name','index','map','MailQueueReport','rawAttributes','key','query','keys','intersection','attributes','fields','model','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto'];(function(_0x2908c3,_0x375437){var _0x111fcb=function(_0x35b1d0){while(--_0x35b1d0){_0x2908c3['push'](_0x2908c3['shift']());}};_0x111fcb(++_0x375437);}(_0x5906,0x1dd));var _0x6590=function(_0x3d4782,_0x59eb24){_0x3d4782=_0x3d4782-0x0;var _0x19d236=_0x5906[_0x3d4782];return _0x19d236;};'use strict';var pdf=require(_0x6590('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6590('0x1'));var zipdir=require(_0x6590('0x2'));var jsonpatch=require(_0x6590('0x3'));var rp=require(_0x6590('0x4'));var moment=require(_0x6590('0x5'));var BPromise=require(_0x6590('0x6'));var Mustache=require(_0x6590('0x7'));var util=require('util');var path=require(_0x6590('0x8'));var sox=require(_0x6590('0x9'));var csv=require('to-csv');var ejs=require(_0x6590('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6590('0xb'));var crypto=require(_0x6590('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6590('0xd'));var querystring=require('querystring');var Papa=require(_0x6590('0xe'));var Redis=require(_0x6590('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6590('0x10'));var as=require(_0x6590('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6590('0x12'))(_0x6590('0x13'));var utils=require(_0x6590('0x14'));var config=require(_0x6590('0x15'));var licenseUtil=require(_0x6590('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fd95f,_0x3c4776){_0x3c4776=_0x3c4776||0xcc;return function(_0x2c4203){if(_0x2c4203){return _0x1fd95f[_0x6590('0x17')](_0x3c4776);}return _0x1fd95f[_0x6590('0x18')](_0x3c4776)[_0x6590('0x19')]();};}function respondWithResult(_0x9475e0,_0xd899c){_0xd899c=_0xd899c||0xc8;return function(_0x377cc8){if(_0x377cc8){return _0x9475e0['status'](_0xd899c)[_0x6590('0x1a')](_0x377cc8);}};}function respondWithFilteredResult(_0x9a5f1f,_0x860ee2){return function(_0x2839fd){if(_0x2839fd){var _0x1fb698=_0x2839fd[_0x6590('0x1b')],_0x28f176=_0x860ee2[_0x6590('0x1c')],_0x58d039=_0x860ee2[_0x6590('0x1c')]+_0x860ee2[_0x6590('0x1d')],_0x2cdf4f;if(_0x58d039>=_0x1fb698){_0x58d039=_0x1fb698;_0x2cdf4f=0xc8;}else{_0x2cdf4f=0xce;}_0x9a5f1f['status'](_0x2cdf4f);return _0x9a5f1f[_0x6590('0x1e')]('Content-Range',_0x28f176+'-'+_0x58d039+'/'+_0x1fb698)[_0x6590('0x1a')](_0x2839fd);}return null;};}function patchUpdates(_0x4cc606){return function(_0x8e4fe8){try{jsonpatch[_0x6590('0x1f')](_0x8e4fe8,_0x4cc606,!![]);}catch(_0x1c4228){return BPromise[_0x6590('0x20')](_0x1c4228);}return _0x8e4fe8['save']();};}function saveUpdates(_0x1dfc4d,_0x3e7834){return function(_0xe569c3){if(_0xe569c3){return _0xe569c3[_0x6590('0x21')](_0x1dfc4d)[_0x6590('0x22')](function(_0xf55cca){return _0xf55cca;});}return null;};}function removeEntity(_0x3822b1,_0x5f9b98){return function(_0x18bff0){if(_0x18bff0){return _0x18bff0[_0x6590('0x23')]()['then'](function(){_0x3822b1[_0x6590('0x18')](0xcc)[_0x6590('0x19')]();});}};}function handleEntityNotFound(_0x2a8236,_0x45de63){return function(_0x2cdebf){if(!_0x2cdebf){_0x2a8236[_0x6590('0x17')](0x194);}return _0x2cdebf;};}function handleError(_0x5de09e,_0xc7dabf){_0xc7dabf=_0xc7dabf||0x1f4;return function(_0x2e3254){logger[_0x6590('0x24')](_0x2e3254['stack']);if(_0x2e3254[_0x6590('0x25')]){delete _0x2e3254[_0x6590('0x25')];}_0x5de09e[_0x6590('0x18')](_0xc7dabf)['send'](_0x2e3254);};}exports[_0x6590('0x26')]=function(_0x8e6805,_0x1b05b1){var _0x40dec3={},_0x9d4424={},_0x44afed={'count':0x0,'rows':[]};var _0x4fa87a=_[_0x6590('0x27')](db[_0x6590('0x28')][_0x6590('0x29')],function(_0x3b5e9){return{'name':_0x3b5e9['fieldName'],'type':_0x3b5e9['type'][_0x6590('0x2a')]};});_0x9d4424['model']=_[_0x6590('0x27')](_0x4fa87a,_0x6590('0x25'));_0x9d4424[_0x6590('0x2b')]=_[_0x6590('0x2c')](_0x8e6805[_0x6590('0x2b')]);_0x9d4424['filters']=_[_0x6590('0x2d')](_0x9d4424['model'],_0x9d4424[_0x6590('0x2b')]);_0x40dec3[_0x6590('0x2e')]=_[_0x6590('0x2d')](_0x9d4424['model'],qs[_0x6590('0x2f')](_0x8e6805[_0x6590('0x2b')][_0x6590('0x2f')]));_0x40dec3[_0x6590('0x2e')]=_0x40dec3[_0x6590('0x2e')]['length']?_0x40dec3['attributes']:_0x9d4424[_0x6590('0x30')];if(!_0x8e6805[_0x6590('0x2b')]['hasOwnProperty'](_0x6590('0x31'))){_0x40dec3[_0x6590('0x1d')]=qs[_0x6590('0x1d')](_0x8e6805[_0x6590('0x2b')]['limit']);_0x40dec3[_0x6590('0x1c')]=qs[_0x6590('0x1c')](_0x8e6805[_0x6590('0x2b')]['offset']);}_0x40dec3[_0x6590('0x32')]=qs[_0x6590('0x33')](_0x8e6805[_0x6590('0x2b')][_0x6590('0x33')]);_0x40dec3[_0x6590('0x34')]=qs[_0x6590('0x35')](_[_0x6590('0x36')](_0x8e6805['query'],_0x9d4424[_0x6590('0x35')]),_0x4fa87a);if(_0x8e6805[_0x6590('0x2b')][_0x6590('0x37')]){_0x40dec3[_0x6590('0x34')]=_['merge'](_0x40dec3['where'],{'$or':_[_0x6590('0x27')](_0x4fa87a,function(_0x54e90f){if(_0x54e90f[_0x6590('0x38')]!==_0x6590('0x39')){var _0x447657={};_0x447657[_0x54e90f['name']]={'$like':'%'+_0x8e6805[_0x6590('0x2b')][_0x6590('0x37')]+'%'};return _0x447657;}})});}_0x40dec3=_[_0x6590('0x3a')]({},_0x40dec3,_0x8e6805[_0x6590('0x3b')]);var _0x179236={'where':_0x40dec3[_0x6590('0x34')]};return db[_0x6590('0x28')][_0x6590('0x1b')](_0x179236)[_0x6590('0x22')](function(_0x360d3c){_0x44afed[_0x6590('0x1b')]=_0x360d3c;if(_0x8e6805['query'][_0x6590('0x3c')]){_0x40dec3['include']=[{'all':!![]}];}return db[_0x6590('0x28')][_0x6590('0x3d')](_0x40dec3);})[_0x6590('0x22')](function(_0x10cfba){_0x44afed[_0x6590('0x3e')]=_0x10cfba;return _0x44afed;})[_0x6590('0x22')](respondWithFilteredResult(_0x1b05b1,_0x40dec3))[_0x6590('0x3f')](handleError(_0x1b05b1,null));};exports['show']=function(_0x18c0d1,_0x291057){var _0x51ce1b={'raw':!![],'where':{'id':_0x18c0d1[_0x6590('0x40')]['id']}},_0x3b9463={};_0x3b9463[_0x6590('0x30')]=_[_0x6590('0x2c')](db[_0x6590('0x28')]['rawAttributes']);_0x3b9463[_0x6590('0x2b')]=_['keys'](_0x18c0d1[_0x6590('0x2b')]);_0x3b9463['filters']=_[_0x6590('0x2d')](_0x3b9463[_0x6590('0x30')],_0x3b9463[_0x6590('0x2b')]);_0x51ce1b['attributes']=_[_0x6590('0x2d')](_0x3b9463[_0x6590('0x30')],qs['fields'](_0x18c0d1[_0x6590('0x2b')][_0x6590('0x2f')]));_0x51ce1b[_0x6590('0x2e')]=_0x51ce1b['attributes']['length']?_0x51ce1b['attributes']:_0x3b9463[_0x6590('0x30')];if(_0x18c0d1['query'][_0x6590('0x3c')]){_0x51ce1b[_0x6590('0x41')]=[{'all':!![]}];}_0x51ce1b=_[_0x6590('0x3a')]({},_0x51ce1b,_0x18c0d1['options']);return db['MailQueueReport'][_0x6590('0x42')](_0x51ce1b)[_0x6590('0x22')](handleEntityNotFound(_0x291057,null))[_0x6590('0x22')](respondWithResult(_0x291057,null))[_0x6590('0x3f')](handleError(_0x291057,null));};exports[_0x6590('0x43')]=function(_0x5d4d8c,_0x2eed1c){return db[_0x6590('0x28')][_0x6590('0x43')](_0x5d4d8c[_0x6590('0x44')],{})['then'](respondWithResult(_0x2eed1c,0xc9))['catch'](handleError(_0x2eed1c,null));};exports['update']=function(_0x55c0aa,_0x326786){if(_0x55c0aa[_0x6590('0x44')]['id']){delete _0x55c0aa['body']['id'];}return db[_0x6590('0x28')][_0x6590('0x42')]({'where':{'id':_0x55c0aa[_0x6590('0x40')]['id']}})[_0x6590('0x22')](handleEntityNotFound(_0x326786,null))[_0x6590('0x22')](saveUpdates(_0x55c0aa['body'],null))['then'](respondWithResult(_0x326786,null))['catch'](handleError(_0x326786,null));};exports[_0x6590('0x23')]=function(_0x278767,_0x36ab02){return db[_0x6590('0x28')][_0x6590('0x42')]({'where':{'id':_0x278767[_0x6590('0x40')]['id']}})['then'](handleEntityNotFound(_0x36ab02,null))[_0x6590('0x22')](removeEntity(_0x36ab02,null))[_0x6590('0x3f')](handleError(_0x36ab02,null));};exports['describe']=function(_0x1cc693,_0x501d7d){return db['MailQueueReport'][_0x6590('0x45')]()['then'](respondWithResult(_0x501d7d,null))[_0x6590('0x3f')](handleError(_0x501d7d,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8be2d71..89385a8 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 _0x1242=['MailQueueReport','uniqueid','lodash','../../config/logger','moment','path','../../config/environment','./mailQueueReport.attributes'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x1242,0x10a));var _0x2124=function(_0x11ccde,_0x42546d){_0x11ccde=_0x11ccde-0x0;var _0x2fac73=_0x1242[_0x11ccde];return _0x2fac73;};'use strict';var _=require(_0x2124('0x0'));var util=require('util');var logger=require(_0x2124('0x1'))('api');var moment=require(_0x2124('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2124('0x3'));var rimraf=require('rimraf');var config=require(_0x2124('0x4'));var attributes=require(_0x2124('0x5'));module['exports']=function(_0x45ba87,_0x2c0ea8){return _0x45ba87['define'](_0x2124('0x6'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x2124('0x7'),'fields':[_0x2124('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe912=['report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x1ddf57,_0x5daa7b){var _0x3651ee=function(_0x4be1b4){while(--_0x4be1b4){_0x1ddf57['push'](_0x1ddf57['shift']());}};_0x3651ee(++_0x5daa7b);}(_0xe912,0x188));var _0x2e91=function(_0xc8afd9,_0x375e49){_0xc8afd9=_0xc8afd9-0x0;var _0x1b8743=_0xe912[_0xc8afd9];return _0x1b8743;};'use strict';var _=require(_0x2e91('0x0'));var util=require(_0x2e91('0x1'));var logger=require(_0x2e91('0x2'))(_0x2e91('0x3'));var moment=require(_0x2e91('0x4'));var BPromise=require(_0x2e91('0x5'));var rp=require(_0x2e91('0x6'));var fs=require('fs');var path=require(_0x2e91('0x7'));var rimraf=require(_0x2e91('0x8'));var config=require(_0x2e91('0x9'));var attributes=require(_0x2e91('0xa'));module[_0x2e91('0xb')]=function(_0x320704,_0x35f0d5){return _0x320704[_0x2e91('0xc')]('MailQueueReport',attributes,{'tableName':_0x2e91('0xd'),'paranoid':![],'indexes':[{'name':_0x2e91('0xe'),'fields':[_0x2e91('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 832ff0a..c2d535c 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 _0x95ec=['error','message','result','CreateMailQueueReport','create','body','options','debug','catch','MailQueueReport','update','raw','where','attributes','limit','UpdateMailQueueReport','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x14f681,_0xa0808e){var _0x1d4cb2=function(_0x66e474){while(--_0x66e474){_0x14f681['push'](_0x14f681['shift']());}};_0x1d4cb2(++_0xa0808e);}(_0x95ec,0x17b));var _0xc95e=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x95ec[_0x2605dc];return _0x4568c9;};'use strict';var _=require(_0xc95e('0x0'));var util=require(_0xc95e('0x1'));var moment=require(_0xc95e('0x2'));var BPromise=require(_0xc95e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc95e('0x4'));var logger=require(_0xc95e('0x5'))(_0xc95e('0x6'));var config=require(_0xc95e('0x7'));var jayson=require(_0xc95e('0x8'));var client=jayson[_0xc95e('0x9')][_0xc95e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16a280,_0x2c1bf6,_0xdac29c){return new BPromise(function(_0x5e791e,_0x496c62){return client['request'](_0x16a280,_0xdac29c)[_0xc95e('0xb')](function(_0x433d06){logger[_0xc95e('0xc')](_0xc95e('0xd'),_0x2c1bf6,_0xc95e('0xe'));logger['debug'](_0xc95e('0xf'),_0x2c1bf6,_0xc95e('0xe'),JSON[_0xc95e('0x10')](_0x433d06));if(_0x433d06[_0xc95e('0x11')]){if(_0x433d06[_0xc95e('0x11')]['code']===0x1f4){logger[_0xc95e('0x11')]('MailQueueReport,\x20%s,\x20%s',_0x2c1bf6,_0x433d06[_0xc95e('0x11')]['message']);return _0x496c62(_0x433d06[_0xc95e('0x11')][_0xc95e('0x12')]);}logger[_0xc95e('0x11')](_0xc95e('0xd'),_0x2c1bf6,_0x433d06[_0xc95e('0x11')][_0xc95e('0x12')]);return _0x5e791e(_0x433d06['error']['message']);}else{logger['info'](_0xc95e('0xd'),_0x2c1bf6,'request\x20sent');_0x5e791e(_0x433d06[_0xc95e('0x13')][_0xc95e('0x12')]);}})['catch'](function(_0x52d990){logger[_0xc95e('0x11')](_0xc95e('0xd'),_0x2c1bf6,_0x52d990);_0x496c62(_0x52d990);});});}exports[_0xc95e('0x14')]=function(_0x4a0d7b){var _0x3f5daf=this;return new Promise(function(_0x532f30,_0x21f6db){return db['MailQueueReport'][_0xc95e('0x15')](_0x4a0d7b[_0xc95e('0x16')],{'raw':_0x4a0d7b['options']?_0x4a0d7b[_0xc95e('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xc95e('0xb')](function(_0x49d67c){logger[_0xc95e('0xc')]('CreateMailQueueReport',_0x4a0d7b);logger[_0xc95e('0x18')](_0xc95e('0x14'),_0x4a0d7b,JSON['stringify'](_0x49d67c));_0x532f30(_0x49d67c);})[_0xc95e('0x19')](function(_0x4650f5){logger[_0xc95e('0x11')](_0xc95e('0x14'),_0x4650f5['message'],_0x4a0d7b);_0x21f6db(_0x3f5daf[_0xc95e('0x11')](0x1f4,_0x4650f5[_0xc95e('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x402a29){var _0x554b82=this;return new Promise(function(_0x1691de,_0x3ee1e2){return db[_0xc95e('0x1a')][_0xc95e('0x1b')](_0x402a29[_0xc95e('0x16')],{'raw':_0x402a29['options']?_0x402a29['options'][_0xc95e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x402a29[_0xc95e('0x17')]?_0x402a29[_0xc95e('0x17')][_0xc95e('0x1d')]||null:null,'attributes':_0x402a29['options']?_0x402a29[_0xc95e('0x17')][_0xc95e('0x1e')]||null:null,'limit':_0x402a29[_0xc95e('0x17')]?_0x402a29[_0xc95e('0x17')][_0xc95e('0x1f')]||null:null})['then'](function(_0x217965){logger[_0xc95e('0xc')](_0xc95e('0x20'),_0x402a29);logger[_0xc95e('0x18')]('UpdateMailQueueReport',_0x402a29,JSON[_0xc95e('0x10')](_0x217965));_0x1691de(_0x217965);})['catch'](function(_0x4ce684){logger[_0xc95e('0x11')](_0xc95e('0x20'),_0x4ce684[_0xc95e('0x12')],_0x402a29);_0x3ee1e2(_0x554b82['error'](0x1f4,_0x4ce684[_0xc95e('0x12')]));});});}; \ No newline at end of file +var _0xdf51=['create','body','options','then','debug','stringify','catch','UpdateMailQueueReport','update','raw','where','attributes','limit','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateMailQueueReport','MailQueueReport'];(function(_0x383c94,_0x2c7402){var _0x149b61=function(_0x33dac0){while(--_0x33dac0){_0x383c94['push'](_0x383c94['shift']());}};_0x149b61(++_0x2c7402);}(_0xdf51,0x89));var _0x1df5=function(_0x279a3b,_0x506385){_0x279a3b=_0x279a3b-0x0;var _0x5d8f54=_0xdf51[_0x279a3b];return _0x5d8f54;};'use strict';var _=require(_0x1df5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1df5('0x1'));var rs=require(_0x1df5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1df5('0x3'));var logger=require(_0x1df5('0x4'))(_0x1df5('0x5'));var config=require(_0x1df5('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1df5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb74cca,_0x505f1a,_0x309ff6){return new BPromise(function(_0x3da8f9,_0x485643){return client[_0x1df5('0x8')](_0xb74cca,_0x309ff6)['then'](function(_0x24f111){logger[_0x1df5('0x9')](_0x1df5('0xa'),_0x505f1a,_0x1df5('0xb'));logger['debug'](_0x1df5('0xc'),_0x505f1a,_0x1df5('0xb'),JSON['stringify'](_0x24f111));if(_0x24f111[_0x1df5('0xd')]){if(_0x24f111[_0x1df5('0xd')][_0x1df5('0xe')]===0x1f4){logger['error'](_0x1df5('0xa'),_0x505f1a,_0x24f111[_0x1df5('0xd')][_0x1df5('0xf')]);return _0x485643(_0x24f111[_0x1df5('0xd')][_0x1df5('0xf')]);}logger['error']('MailQueueReport,\x20%s,\x20%s',_0x505f1a,_0x24f111[_0x1df5('0xd')][_0x1df5('0xf')]);return _0x3da8f9(_0x24f111[_0x1df5('0xd')][_0x1df5('0xf')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x505f1a,_0x1df5('0xb'));_0x3da8f9(_0x24f111['result'][_0x1df5('0xf')]);}})['catch'](function(_0x3f4e12){logger['error'](_0x1df5('0xa'),_0x505f1a,_0x3f4e12);_0x485643(_0x3f4e12);});});}exports[_0x1df5('0x10')]=function(_0x87c4a0){var _0x37c987=this;return new Promise(function(_0x50bc49,_0x324d00){return db[_0x1df5('0x11')][_0x1df5('0x12')](_0x87c4a0[_0x1df5('0x13')],{'raw':_0x87c4a0[_0x1df5('0x14')]?_0x87c4a0['options']['raw']===undefined?!![]:![]:!![]})[_0x1df5('0x15')](function(_0x173980){logger[_0x1df5('0x9')]('CreateMailQueueReport',_0x87c4a0);logger[_0x1df5('0x16')](_0x1df5('0x10'),_0x87c4a0,JSON[_0x1df5('0x17')](_0x173980));_0x50bc49(_0x173980);})[_0x1df5('0x18')](function(_0x369100){logger[_0x1df5('0xd')]('CreateMailQueueReport',_0x369100['message'],_0x87c4a0);_0x324d00(_0x37c987[_0x1df5('0xd')](0x1f4,_0x369100[_0x1df5('0xf')]));});});};exports[_0x1df5('0x19')]=function(_0x4f6021){var _0x22d18d=this;return new Promise(function(_0x8af5d,_0x5717b0){return db[_0x1df5('0x11')][_0x1df5('0x1a')](_0x4f6021[_0x1df5('0x13')],{'raw':_0x4f6021[_0x1df5('0x14')]?_0x4f6021['options'][_0x1df5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6021[_0x1df5('0x14')]?_0x4f6021['options'][_0x1df5('0x1c')]||null:null,'attributes':_0x4f6021['options']?_0x4f6021[_0x1df5('0x14')][_0x1df5('0x1d')]||null:null,'limit':_0x4f6021[_0x1df5('0x14')]?_0x4f6021['options'][_0x1df5('0x1e')]||null:null})[_0x1df5('0x15')](function(_0x52fb7f){logger['info'](_0x1df5('0x19'),_0x4f6021);logger[_0x1df5('0x16')](_0x1df5('0x19'),_0x4f6021,JSON[_0x1df5('0x17')](_0x52fb7f));_0x8af5d(_0x52fb7f);})[_0x1df5('0x18')](function(_0xc8168a){logger[_0x1df5('0xd')]('UpdateMailQueueReport',_0xc8168a[_0x1df5('0xf')],_0x4f6021);_0x5717b0(_0x22d18d[_0x1df5('0xd')](0x1f4,_0xc8168a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 7fa2fb7..dd62415 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 _0x2045=['../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2a04d4,_0xa57830){var _0x40b2f9=function(_0x44f8cf){while(--_0x44f8cf){_0x2a04d4['push'](_0x2a04d4['shift']());}};_0x40b2f9(++_0xa57830);}(_0x2045,0x152));var _0x5204=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0x2045[_0x43a5c7];return _0x3b12a2;};'use strict';var multer=require(_0x5204('0x0'));var util=require(_0x5204('0x1'));var path=require(_0x5204('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5204('0x3')]();var auth=require(_0x5204('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5204('0x5'));module[_0x5204('0x6')]=router; \ No newline at end of file +var _0x45d8=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x9c2845,_0x1ab683){var _0x4f635f=function(_0x569115){while(--_0x569115){_0x9c2845['push'](_0x9c2845['shift']());}};_0x4f635f(++_0x1ab683);}(_0x45d8,0x1df));var _0x845d=function(_0x41a3ab,_0x4bb061){_0x41a3ab=_0x41a3ab-0x0;var _0x3c9da9=_0x45d8[_0x41a3ab];return _0x3c9da9;};'use strict';var multer=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var path=require(_0x845d('0x2'));var timeout=require(_0x845d('0x3'));var express=require(_0x845d('0x4'));var router=express[_0x845d('0x5')]();var auth=require(_0x845d('0x6'));var interaction=require(_0x845d('0x7'));var config=require(_0x845d('0x8'));module[_0x845d('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 9f5fd22..ddd4c93 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 _0x3ff1=['username','INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x399a68,_0x32b703){var _0x283d8c=function(_0x22a206){while(--_0x22a206){_0x399a68['push'](_0x399a68['shift']());}};_0x283d8c(++_0x32b703);}(_0x3ff1,0x1df));var _0x13ff=function(_0x436015,_0x4c5240){_0x436015=_0x436015-0x0;var _0x5de12e=_0x3ff1[_0x436015];return _0x5de12e;};'use strict';var Sequelize=require(_0x13ff('0x0'));module[_0x13ff('0x1')]={'description':{'type':Sequelize[_0x13ff('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x13ff('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x13ff('0x2')],'unique':_0x13ff('0x4')},'password':{'type':Sequelize[_0x13ff('0x2')]},'port':{'type':Sequelize[_0x13ff('0x5')]},'tls':{'type':Sequelize[_0x13ff('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x13ff('0x6')},'connTimeout':{'type':Sequelize[_0x13ff('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x13ff('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x13ff('0x2')]}}; \ No newline at end of file +var _0x5095=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x5a41b8,_0xfb31e9){var _0x37069f=function(_0xdff7a3){while(--_0xdff7a3){_0x5a41b8['push'](_0x5a41b8['shift']());}};_0x37069f(++_0xfb31e9);}(_0x5095,0x162));var _0x5509=function(_0x7c2bce,_0x370cf3){_0x7c2bce=_0x7c2bce-0x0;var _0xc7ae58=_0x5095[_0x7c2bce];return _0xc7ae58;};'use strict';var Sequelize=require(_0x5509('0x0'));module[_0x5509('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5509('0x2')]},'authentication':{'type':Sequelize[_0x5509('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5509('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x5509('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5509('0x2')],'defaultValue':_0x5509('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x5509('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index c6cc9eb..4770868 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 _0x1eba=['define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x545cbc,_0x155fcd){var _0x3b88a4=function(_0x419907){while(--_0x419907){_0x545cbc['push'](_0x545cbc['shift']());}};_0x3b88a4(++_0x155fcd);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x1eba[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var logger=require(_0xa1eb('0x2'))(_0xa1eb('0x3'));var moment=require(_0xa1eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1eb('0x5'));var rimraf=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var attributes=require(_0xa1eb('0x8'));module[_0xa1eb('0x9')]=function(_0x2933d0,_0x1d0d67){return _0x2933d0[_0xa1eb('0xa')](_0xa1eb('0xb'),attributes,{'tableName':_0xa1eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa30a=['path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var logger=require(_0xaa30('0x2'))('api');var moment=require(_0xaa30('0x3'));var BPromise=require(_0xaa30('0x4'));var rp=require(_0xaa30('0x5'));var fs=require('fs');var path=require(_0xaa30('0x6'));var rimraf=require(_0xaa30('0x7'));var config=require(_0xaa30('0x8'));var attributes=require(_0xaa30('0x9'));module['exports']=function(_0x347cd5,_0x4efe89){return _0x347cd5[_0xaa30('0xa')](_0xaa30('0xb'),attributes,{'tableName':_0xaa30('0xc'),'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 a368699..6ac3a42 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 _0x1021=['MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x1021,0x92));var _0x1102=function(_0x102ad3,_0x2a359b){_0x102ad3=_0x102ad3-0x0;var _0x52c7ab=_0x1021[_0x102ad3];return _0x52c7ab;};'use strict';var _=require('lodash');var util=require(_0x1102('0x0'));var moment=require('moment');var BPromise=require(_0x1102('0x1'));var rs=require(_0x1102('0x2'));var fs=require('fs');var Redis=require(_0x1102('0x3'));var db=require(_0x1102('0x4'))['db'];var utils=require(_0x1102('0x5'));var logger=require(_0x1102('0x6'))(_0x1102('0x7'));var config=require(_0x1102('0x8'));var jayson=require(_0x1102('0x9'));var client=jayson[_0x1102('0xa')][_0x1102('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49e79b,_0x4ecfa7,_0x177699){return new BPromise(function(_0x31c019,_0x39e698){return client['request'](_0x49e79b,_0x177699)[_0x1102('0xc')](function(_0x2cd670){logger[_0x1102('0xd')](_0x1102('0xe'),_0x4ecfa7,_0x1102('0xf'));logger[_0x1102('0x10')](_0x1102('0x11'),_0x4ecfa7,_0x1102('0xf'),JSON[_0x1102('0x12')](_0x2cd670));if(_0x2cd670[_0x1102('0x13')]){if(_0x2cd670[_0x1102('0x13')][_0x1102('0x14')]===0x1f4){logger[_0x1102('0x13')]('MailServerIn,\x20%s,\x20%s',_0x4ecfa7,_0x2cd670[_0x1102('0x13')][_0x1102('0x15')]);return _0x39e698(_0x2cd670['error'][_0x1102('0x15')]);}logger['error'](_0x1102('0xe'),_0x4ecfa7,_0x2cd670[_0x1102('0x13')][_0x1102('0x15')]);return _0x31c019(_0x2cd670[_0x1102('0x13')]['message']);}else{logger[_0x1102('0xd')](_0x1102('0xe'),_0x4ecfa7,_0x1102('0xf'));_0x31c019(_0x2cd670['result'][_0x1102('0x15')]);}})[_0x1102('0x16')](function(_0x4f8c99){logger['error'](_0x1102('0xe'),_0x4ecfa7,_0x4f8c99);_0x39e698(_0x4f8c99);});});}exports[_0x1102('0x17')]=function(_0x7dd7ba){var _0x725676=this;return new Promise(function(_0x458c7a,_0x24a107){return db[_0x1102('0x18')][_0x1102('0x19')]({'raw':_0x7dd7ba[_0x1102('0x1a')]?_0x7dd7ba[_0x1102('0x1a')][_0x1102('0x1b')]===undefined?!![]:![]:!![],'where':_0x7dd7ba['options']?_0x7dd7ba[_0x1102('0x1a')][_0x1102('0x1c')]||null:null,'attributes':_0x7dd7ba[_0x1102('0x1a')]?_0x7dd7ba[_0x1102('0x1a')][_0x1102('0x1d')]||null:null,'limit':_0x7dd7ba[_0x1102('0x1a')]?_0x7dd7ba[_0x1102('0x1a')][_0x1102('0x1e')]||null:null,'include':_0x7dd7ba[_0x1102('0x1a')]?_0x7dd7ba[_0x1102('0x1a')][_0x1102('0x1f')]?_[_0x1102('0x20')](_0x7dd7ba[_0x1102('0x1a')][_0x1102('0x1f')],function(_0x3f6c3d){return{'model':db[_0x3f6c3d[_0x1102('0x21')]],'as':_0x3f6c3d['as'],'attributes':_0x3f6c3d[_0x1102('0x1d')],'include':_0x3f6c3d[_0x1102('0x1f')]?_[_0x1102('0x20')](_0x3f6c3d[_0x1102('0x1f')],function(_0x1643b1){return{'model':db[_0x1643b1[_0x1102('0x21')]],'as':_0x1643b1['as'],'attributes':_0x1643b1[_0x1102('0x1d')],'include':_0x1643b1['include']?_[_0x1102('0x20')](_0x1643b1[_0x1102('0x1f')],function(_0x152ba9){return{'model':db[_0x152ba9[_0x1102('0x21')]],'as':_0x152ba9['as'],'attributes':_0x152ba9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35541c){logger[_0x1102('0xd')](_0x1102('0x17'),_0x7dd7ba);logger[_0x1102('0x10')](_0x1102('0x17'),_0x7dd7ba,JSON[_0x1102('0x12')](_0x35541c));_0x458c7a(_0x35541c);})[_0x1102('0x16')](function(_0x30e11c){logger[_0x1102('0x13')](_0x1102('0x17'),_0x30e11c[_0x1102('0x15')],_0x7dd7ba);_0x24a107(_0x725676[_0x1102('0x13')](0x1f4,_0x30e11c[_0x1102('0x15')]));});});}; \ No newline at end of file +var _0x515e=['jayson/promise','http','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','catch','MailServerIn','findAll','options','where','attributes','include','model','map','GetMailServerIn','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3e36ba,_0x4e018e){var _0x2fa041=function(_0xb084c6){while(--_0xb084c6){_0x3e36ba['push'](_0x3e36ba['shift']());}};_0x2fa041(++_0x4e018e);}(_0x515e,0x1b9));var _0xe515=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0x515e[_0x51ab83];return _0x14b6de;};'use strict';var _=require(_0xe515('0x0'));var util=require(_0xe515('0x1'));var moment=require(_0xe515('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe515('0x3'));var db=require(_0xe515('0x4'))['db'];var utils=require(_0xe515('0x5'));var logger=require(_0xe515('0x6'))(_0xe515('0x7'));var config=require(_0xe515('0x8'));var jayson=require(_0xe515('0x9'));var client=jayson['client'][_0xe515('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x324d4b,_0x18036e,_0x31ff51){return new BPromise(function(_0x3e3f5e,_0x4aa674){return client['request'](_0x324d4b,_0x31ff51)[_0xe515('0xb')](function(_0x3a5563){logger[_0xe515('0xc')]('MailServerIn,\x20%s,\x20%s',_0x18036e,_0xe515('0xd'));logger[_0xe515('0xe')](_0xe515('0xf'),_0x18036e,'request\x20sent',JSON[_0xe515('0x10')](_0x3a5563));if(_0x3a5563[_0xe515('0x11')]){if(_0x3a5563['error']['code']===0x1f4){logger[_0xe515('0x11')](_0xe515('0x12'),_0x18036e,_0x3a5563[_0xe515('0x11')][_0xe515('0x13')]);return _0x4aa674(_0x3a5563[_0xe515('0x11')][_0xe515('0x13')]);}logger['error'](_0xe515('0x12'),_0x18036e,_0x3a5563['error'][_0xe515('0x13')]);return _0x3e3f5e(_0x3a5563[_0xe515('0x11')][_0xe515('0x13')]);}else{logger[_0xe515('0xc')](_0xe515('0x12'),_0x18036e,_0xe515('0xd'));_0x3e3f5e(_0x3a5563['result'][_0xe515('0x13')]);}})[_0xe515('0x14')](function(_0x4dffd5){logger[_0xe515('0x11')]('MailServerIn,\x20%s,\x20%s',_0x18036e,_0x4dffd5);_0x4aa674(_0x4dffd5);});});}exports['GetMailServerIn']=function(_0x175b3f){var _0x39db30=this;return new Promise(function(_0x2421b9,_0x305c99){return db[_0xe515('0x15')][_0xe515('0x16')]({'raw':_0x175b3f[_0xe515('0x17')]?_0x175b3f['options']['raw']===undefined?!![]:![]:!![],'where':_0x175b3f[_0xe515('0x17')]?_0x175b3f[_0xe515('0x17')][_0xe515('0x18')]||null:null,'attributes':_0x175b3f[_0xe515('0x17')]?_0x175b3f[_0xe515('0x17')][_0xe515('0x19')]||null:null,'limit':_0x175b3f[_0xe515('0x17')]?_0x175b3f[_0xe515('0x17')]['limit']||null:null,'include':_0x175b3f['options']?_0x175b3f[_0xe515('0x17')][_0xe515('0x1a')]?_['map'](_0x175b3f[_0xe515('0x17')][_0xe515('0x1a')],function(_0x3c5903){return{'model':db[_0x3c5903[_0xe515('0x1b')]],'as':_0x3c5903['as'],'attributes':_0x3c5903[_0xe515('0x19')],'include':_0x3c5903[_0xe515('0x1a')]?_[_0xe515('0x1c')](_0x3c5903[_0xe515('0x1a')],function(_0x320f9f){return{'model':db[_0x320f9f[_0xe515('0x1b')]],'as':_0x320f9f['as'],'attributes':_0x320f9f['attributes'],'include':_0x320f9f[_0xe515('0x1a')]?_['map'](_0x320f9f[_0xe515('0x1a')],function(_0x21583e){return{'model':db[_0x21583e[_0xe515('0x1b')]],'as':_0x21583e['as'],'attributes':_0x21583e[_0xe515('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe515('0xb')](function(_0x4e7864){logger[_0xe515('0xc')]('GetMailServerIn',_0x175b3f);logger[_0xe515('0xe')](_0xe515('0x1d'),_0x175b3f,JSON[_0xe515('0x10')](_0x4e7864));_0x2421b9(_0x4e7864);})[_0xe515('0x14')](function(_0x2d2a14){logger[_0xe515('0x11')]('GetMailServerIn',_0x2d2a14[_0xe515('0x13')],_0x175b3f);_0x305c99(_0x39db30[_0xe515('0x11')](0x1f4,_0x2d2a14[_0xe515('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b152dc5..72fa81a 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 _0x2e19=['get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xdd2c12,_0x3529eb){var _0xeb20d2=function(_0x429ec6){while(--_0x429ec6){_0xdd2c12['push'](_0xdd2c12['shift']());}};_0xeb20d2(++_0x3529eb);}(_0x2e19,0x1c4));var _0x92e1=function(_0x3666fe,_0x42be05){_0x3666fe=_0x3666fe-0x0;var _0x115f23=_0x2e19[_0x3666fe];return _0x115f23;};'use strict';var multer=require(_0x92e1('0x0'));var util=require(_0x92e1('0x1'));var path=require(_0x92e1('0x2'));var timeout=require(_0x92e1('0x3'));var express=require('express');var router=express[_0x92e1('0x4')]();var auth=require(_0x92e1('0x5'));var interaction=require(_0x92e1('0x6'));var config=require('../../config/environment');var controller=require('./mailServerOut.controller');router[_0x92e1('0x7')]('/',auth[_0x92e1('0x8')](),controller[_0x92e1('0x9')]);router[_0x92e1('0x7')](_0x92e1('0xa'),auth[_0x92e1('0x8')](),controller[_0x92e1('0xb')]);router[_0x92e1('0xc')]('/',auth[_0x92e1('0x8')](),controller[_0x92e1('0xd')]);router[_0x92e1('0xe')](_0x92e1('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x92e1('0xf')](_0x92e1('0xa'),auth[_0x92e1('0x8')](),controller[_0x92e1('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2252=['../../components/interaction/service','./mailServerOut.controller','index','get','/:id','show','post','create','put','isAuthenticated','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x54fd84,_0x30c427){var _0x19964d=function(_0x1368ca){while(--_0x1368ca){_0x54fd84['push'](_0x54fd84['shift']());}};_0x19964d(++_0x30c427);}(_0x2252,0x181));var _0x2225=function(_0x349ce6,_0x2b4a35){_0x349ce6=_0x349ce6-0x0;var _0x8671be=_0x2252[_0x349ce6];return _0x8671be;};'use strict';var multer=require(_0x2225('0x0'));var util=require(_0x2225('0x1'));var path=require('path');var timeout=require(_0x2225('0x2'));var express=require(_0x2225('0x3'));var router=express[_0x2225('0x4')]();var auth=require(_0x2225('0x5'));var interaction=require(_0x2225('0x6'));var config=require('../../config/environment');var controller=require(_0x2225('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2225('0x8')]);router[_0x2225('0x9')](_0x2225('0xa'),auth['isAuthenticated'](),controller[_0x2225('0xb')]);router[_0x2225('0xc')]('/',auth['isAuthenticated'](),controller[_0x2225('0xd')]);router[_0x2225('0xe')](_0x2225('0xa'),auth[_0x2225('0xf')](),controller['update']);router['delete'](_0x2225('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2225('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index d42a52f..8502618 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 _0x1bce=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x1bce,0x73));var _0xe1bc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bce[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xe1bc('0x0'));module[_0xe1bc('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe1bc('0x2')]},'user':{'type':Sequelize[_0xe1bc('0x2')]},'pass':{'type':Sequelize[_0xe1bc('0x2')]},'port':{'type':Sequelize[_0xe1bc('0x3')]},'secure':{'type':Sequelize[_0xe1bc('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xe1bc('0x2')]},'authentication':{'type':Sequelize[_0xe1bc('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9c48=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x9733df,_0x450c75){var _0x1abfad=function(_0x536974){while(--_0x536974){_0x9733df['push'](_0x9733df['shift']());}};_0x1abfad(++_0x450c75);}(_0x9c48,0xa1));var _0x89c4=function(_0x1fa48e,_0x9d8448){_0x1fa48e=_0x1fa48e-0x0;var _0x5cc93f=_0x9c48[_0x1fa48e];return _0x5cc93f;};'use strict';var Sequelize=require(_0x89c4('0x0'));module[_0x89c4('0x1')]={'description':{'type':Sequelize[_0x89c4('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x89c4('0x2')]},'pass':{'type':Sequelize[_0x89c4('0x2')]},'port':{'type':Sequelize[_0x89c4('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x89c4('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 76434f5..ae007a0 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 _0x94a4=['to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','error','name','send','MailServerOut','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','params','find','catch','create','body','update','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x94a4,0x1d4));var _0x494a=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x94a4[_0x486f4a];return _0x135d99;};'use strict';var pdf=require(_0x494a('0x0'));var emlformat=require(_0x494a('0x1'));var rimraf=require(_0x494a('0x2'));var zipdir=require(_0x494a('0x3'));var jsonpatch=require(_0x494a('0x4'));var rp=require(_0x494a('0x5'));var moment=require('moment');var BPromise=require(_0x494a('0x6'));var Mustache=require(_0x494a('0x7'));var util=require('util');var path=require(_0x494a('0x8'));var sox=require(_0x494a('0x9'));var csv=require('to-csv');var ejs=require(_0x494a('0xa'));var fs=require('fs');var _=require(_0x494a('0xb'));var squel=require(_0x494a('0xc'));var crypto=require('crypto');var jsforce=require(_0x494a('0xd'));var deskjs=require(_0x494a('0xe'));var toCsv=require(_0x494a('0xf'));var querystring=require(_0x494a('0x10'));var Papa=require('papaparse');var Redis=require(_0x494a('0x11'));var authService=require(_0x494a('0x12'));var qs=require(_0x494a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x494a('0x14'));var logger=require(_0x494a('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x494a('0x16'));var licenseUtil=require(_0x494a('0x17'));var db=require(_0x494a('0x18'))['db'];function respondWithStatusCode(_0x2fa678,_0x1b3c43){_0x1b3c43=_0x1b3c43||0xcc;return function(_0x545e7f){if(_0x545e7f){return _0x2fa678[_0x494a('0x19')](_0x1b3c43);}return _0x2fa678[_0x494a('0x1a')](_0x1b3c43)['end']();};}function respondWithResult(_0x2e3a51,_0x35403f){_0x35403f=_0x35403f||0xc8;return function(_0x469513){if(_0x469513){return _0x2e3a51['status'](_0x35403f)[_0x494a('0x1b')](_0x469513);}};}function respondWithFilteredResult(_0x41628d,_0x170e0c){return function(_0xff812b){if(_0xff812b){var _0x1dd944=_0xff812b[_0x494a('0x1c')],_0x1f452a=_0x170e0c[_0x494a('0x1d')],_0x1c355b=_0x170e0c[_0x494a('0x1d')]+_0x170e0c[_0x494a('0x1e')],_0x27a785;if(_0x1c355b>=_0x1dd944){_0x1c355b=_0x1dd944;_0x27a785=0xc8;}else{_0x27a785=0xce;}_0x41628d[_0x494a('0x1a')](_0x27a785);return _0x41628d[_0x494a('0x1f')]('Content-Range',_0x1f452a+'-'+_0x1c355b+'/'+_0x1dd944)[_0x494a('0x1b')](_0xff812b);}return null;};}function patchUpdates(_0x1b9879){return function(_0x131508){try{jsonpatch[_0x494a('0x20')](_0x131508,_0x1b9879,!![]);}catch(_0x10d74d){return BPromise[_0x494a('0x21')](_0x10d74d);}return _0x131508[_0x494a('0x22')]();};}function saveUpdates(_0x6734f5,_0x1f38f0){return function(_0x590ae1){if(_0x590ae1){return _0x590ae1['update'](_0x6734f5)[_0x494a('0x23')](function(_0x4baaa2){return _0x4baaa2;});}return null;};}function removeEntity(_0x3d7a4a,_0x512485){return function(_0x340193){if(_0x340193){return _0x340193['destroy']()[_0x494a('0x23')](function(){_0x3d7a4a[_0x494a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x262e32,_0x5dbe9a){return function(_0x4777dc){if(!_0x4777dc){_0x262e32[_0x494a('0x19')](0x194);}return _0x4777dc;};}function handleError(_0x44bc34,_0x9d44ec){_0x9d44ec=_0x9d44ec||0x1f4;return function(_0x1a2c14){logger[_0x494a('0x24')](_0x1a2c14['stack']);if(_0x1a2c14[_0x494a('0x25')]){delete _0x1a2c14[_0x494a('0x25')];}_0x44bc34[_0x494a('0x1a')](_0x9d44ec)[_0x494a('0x26')](_0x1a2c14);};}exports['index']=function(_0x1191f5,_0x16fc3e){var _0x5f93d7={},_0x3c200f={},_0x30d035={'count':0x0,'rows':[]};var _0x445f2b=_['map'](db[_0x494a('0x27')][_0x494a('0x28')],function(_0x4997de){return{'name':_0x4997de['fieldName'],'type':_0x4997de['type'][_0x494a('0x29')]};});_0x3c200f[_0x494a('0x2a')]=_[_0x494a('0x2b')](_0x445f2b,_0x494a('0x25'));_0x3c200f[_0x494a('0x2c')]=_[_0x494a('0x2d')](_0x1191f5[_0x494a('0x2c')]);_0x3c200f[_0x494a('0x2e')]=_['intersection'](_0x3c200f[_0x494a('0x2a')],_0x3c200f[_0x494a('0x2c')]);_0x5f93d7[_0x494a('0x2f')]=_[_0x494a('0x30')](_0x3c200f[_0x494a('0x2a')],qs[_0x494a('0x31')](_0x1191f5[_0x494a('0x2c')][_0x494a('0x31')]));_0x5f93d7[_0x494a('0x2f')]=_0x5f93d7['attributes'][_0x494a('0x32')]?_0x5f93d7[_0x494a('0x2f')]:_0x3c200f[_0x494a('0x2a')];if(!_0x1191f5['query'][_0x494a('0x33')]('nolimit')){_0x5f93d7[_0x494a('0x1e')]=qs[_0x494a('0x1e')](_0x1191f5[_0x494a('0x2c')][_0x494a('0x1e')]);_0x5f93d7[_0x494a('0x1d')]=qs[_0x494a('0x1d')](_0x1191f5[_0x494a('0x2c')][_0x494a('0x1d')]);}_0x5f93d7[_0x494a('0x34')]=qs[_0x494a('0x35')](_0x1191f5[_0x494a('0x2c')][_0x494a('0x35')]);_0x5f93d7['where']=qs[_0x494a('0x2e')](_[_0x494a('0x36')](_0x1191f5[_0x494a('0x2c')],_0x3c200f[_0x494a('0x2e')]),_0x445f2b);if(_0x1191f5['query'][_0x494a('0x37')]){_0x5f93d7[_0x494a('0x38')]=_[_0x494a('0x39')](_0x5f93d7['where'],{'$or':_[_0x494a('0x2b')](_0x445f2b,function(_0x531d96){if(_0x531d96['type']!=='VIRTUAL'){var _0x492003={};_0x492003[_0x531d96['name']]={'$like':'%'+_0x1191f5[_0x494a('0x2c')][_0x494a('0x37')]+'%'};return _0x492003;}})});}_0x5f93d7=_[_0x494a('0x39')]({},_0x5f93d7,_0x1191f5[_0x494a('0x3a')]);var _0x5c8d4d={'where':_0x5f93d7[_0x494a('0x38')]};return db[_0x494a('0x27')][_0x494a('0x1c')](_0x5c8d4d)[_0x494a('0x23')](function(_0x44381a){_0x30d035[_0x494a('0x1c')]=_0x44381a;if(_0x1191f5[_0x494a('0x2c')][_0x494a('0x3b')]){_0x5f93d7[_0x494a('0x3c')]=[{'all':!![]}];}return db[_0x494a('0x27')][_0x494a('0x3d')](_0x5f93d7);})[_0x494a('0x23')](function(_0x3f323f){_0x30d035['rows']=_0x3f323f;return _0x30d035;})[_0x494a('0x23')](respondWithFilteredResult(_0x16fc3e,_0x5f93d7))['catch'](handleError(_0x16fc3e,null));};exports['show']=function(_0xb23931,_0x553e4d){var _0x2d531c={'raw':!![],'where':{'id':_0xb23931[_0x494a('0x3e')]['id']}},_0x16b66b={};_0x16b66b['model']=_[_0x494a('0x2d')](db[_0x494a('0x27')][_0x494a('0x28')]);_0x16b66b[_0x494a('0x2c')]=_[_0x494a('0x2d')](_0xb23931[_0x494a('0x2c')]);_0x16b66b[_0x494a('0x2e')]=_[_0x494a('0x30')](_0x16b66b[_0x494a('0x2a')],_0x16b66b[_0x494a('0x2c')]);_0x2d531c[_0x494a('0x2f')]=_['intersection'](_0x16b66b['model'],qs[_0x494a('0x31')](_0xb23931['query'][_0x494a('0x31')]));_0x2d531c[_0x494a('0x2f')]=_0x2d531c[_0x494a('0x2f')][_0x494a('0x32')]?_0x2d531c[_0x494a('0x2f')]:_0x16b66b[_0x494a('0x2a')];if(_0xb23931[_0x494a('0x2c')][_0x494a('0x3b')]){_0x2d531c[_0x494a('0x3c')]=[{'all':!![]}];}_0x2d531c=_[_0x494a('0x39')]({},_0x2d531c,_0xb23931[_0x494a('0x3a')]);return db[_0x494a('0x27')][_0x494a('0x3f')](_0x2d531c)[_0x494a('0x23')](handleEntityNotFound(_0x553e4d,null))[_0x494a('0x23')](respondWithResult(_0x553e4d,null))[_0x494a('0x40')](handleError(_0x553e4d,null));};exports[_0x494a('0x41')]=function(_0x327a8e,_0x1873f1){return db[_0x494a('0x27')]['create'](_0x327a8e[_0x494a('0x42')],{})[_0x494a('0x23')](respondWithResult(_0x1873f1,0xc9))[_0x494a('0x40')](handleError(_0x1873f1,null));};exports[_0x494a('0x43')]=function(_0x426eb5,_0x3408c9){if(_0x426eb5['body']['id']){delete _0x426eb5[_0x494a('0x42')]['id'];}return db[_0x494a('0x27')][_0x494a('0x3f')]({'where':{'id':_0x426eb5[_0x494a('0x3e')]['id']}})[_0x494a('0x23')](handleEntityNotFound(_0x3408c9,null))[_0x494a('0x23')](saveUpdates(_0x426eb5[_0x494a('0x42')],null))[_0x494a('0x23')](respondWithResult(_0x3408c9,null))[_0x494a('0x40')](handleError(_0x3408c9,null));};exports[_0x494a('0x44')]=function(_0x1391e4,_0x767712){return db[_0x494a('0x27')]['find']({'where':{'id':_0x1391e4[_0x494a('0x3e')]['id']}})[_0x494a('0x23')](handleEntityNotFound(_0x767712,null))[_0x494a('0x23')](removeEntity(_0x767712,null))['catch'](handleError(_0x767712,null));}; \ No newline at end of file +var _0x97ca=['status','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','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','json','count','offset','limit'];(function(_0x888b10,_0x2dca69){var _0x353022=function(_0x30ef18){while(--_0x30ef18){_0x888b10['push'](_0x888b10['shift']());}};_0x353022(++_0x2dca69);}(_0x97ca,0x148));var _0xa97c=function(_0xcb62,_0x1da81b){_0xcb62=_0xcb62-0x0;var _0x3b56b4=_0x97ca[_0xcb62];return _0x3b56b4;};'use strict';var pdf=require(_0xa97c('0x0'));var emlformat=require(_0xa97c('0x1'));var rimraf=require(_0xa97c('0x2'));var zipdir=require(_0xa97c('0x3'));var jsonpatch=require(_0xa97c('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa97c('0x5'));var util=require(_0xa97c('0x6'));var path=require('path');var sox=require(_0xa97c('0x7'));var csv=require(_0xa97c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa97c('0x9'));var jsforce=require(_0xa97c('0xa'));var deskjs=require(_0xa97c('0xb'));var toCsv=require(_0xa97c('0x8'));var querystring=require(_0xa97c('0xc'));var Papa=require(_0xa97c('0xd'));var Redis=require(_0xa97c('0xe'));var authService=require(_0xa97c('0xf'));var qs=require(_0xa97c('0x10'));var as=require(_0xa97c('0x11'));var hardwareService=require(_0xa97c('0x12'));var logger=require(_0xa97c('0x13'))(_0xa97c('0x14'));var utils=require(_0xa97c('0x15'));var config=require(_0xa97c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bc173,_0x4321bd){_0x4321bd=_0x4321bd||0xcc;return function(_0x1ea0b5){if(_0x1ea0b5){return _0x4bc173['sendStatus'](_0x4321bd);}return _0x4bc173['status'](_0x4321bd)['end']();};}function respondWithResult(_0x5599fa,_0x4aab2f){_0x4aab2f=_0x4aab2f||0xc8;return function(_0x7304a7){if(_0x7304a7){return _0x5599fa['status'](_0x4aab2f)[_0xa97c('0x17')](_0x7304a7);}};}function respondWithFilteredResult(_0x1a61b2,_0x519f41){return function(_0x162b2f){if(_0x162b2f){var _0x1e088b=_0x162b2f[_0xa97c('0x18')],_0xaedddd=_0x519f41[_0xa97c('0x19')],_0x5adad5=_0x519f41[_0xa97c('0x19')]+_0x519f41[_0xa97c('0x1a')],_0x4f32d3;if(_0x5adad5>=_0x1e088b){_0x5adad5=_0x1e088b;_0x4f32d3=0xc8;}else{_0x4f32d3=0xce;}_0x1a61b2[_0xa97c('0x1b')](_0x4f32d3);return _0x1a61b2[_0xa97c('0x1c')](_0xa97c('0x1d'),_0xaedddd+'-'+_0x5adad5+'/'+_0x1e088b)[_0xa97c('0x17')](_0x162b2f);}return null;};}function patchUpdates(_0x5af0c1){return function(_0x2a1bba){try{jsonpatch['apply'](_0x2a1bba,_0x5af0c1,!![]);}catch(_0x4e3a45){return BPromise[_0xa97c('0x1e')](_0x4e3a45);}return _0x2a1bba[_0xa97c('0x1f')]();};}function saveUpdates(_0x500c15,_0x36b3a8){return function(_0x485a4a){if(_0x485a4a){return _0x485a4a[_0xa97c('0x20')](_0x500c15)[_0xa97c('0x21')](function(_0x1c2953){return _0x1c2953;});}return null;};}function removeEntity(_0x54a3ad,_0x9a67ce){return function(_0x546485){if(_0x546485){return _0x546485['destroy']()[_0xa97c('0x21')](function(){_0x54a3ad[_0xa97c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ff49,_0xd68305){return function(_0x5434cd){if(!_0x5434cd){_0x25ff49[_0xa97c('0x22')](0x194);}return _0x5434cd;};}function handleError(_0xb2e7cd,_0x3bcff2){_0x3bcff2=_0x3bcff2||0x1f4;return function(_0x1a6719){logger[_0xa97c('0x23')](_0x1a6719[_0xa97c('0x24')]);if(_0x1a6719[_0xa97c('0x25')]){delete _0x1a6719[_0xa97c('0x25')];}_0xb2e7cd[_0xa97c('0x1b')](_0x3bcff2)['send'](_0x1a6719);};}exports[_0xa97c('0x26')]=function(_0x3624c4,_0x31d1d4){var _0x2a9ed0={},_0x17e400={},_0x53c517={'count':0x0,'rows':[]};var _0x5c4eaa=_[_0xa97c('0x27')](db[_0xa97c('0x28')][_0xa97c('0x29')],function(_0x4195a8){return{'name':_0x4195a8[_0xa97c('0x2a')],'type':_0x4195a8['type']['key']};});_0x17e400['model']=_[_0xa97c('0x27')](_0x5c4eaa,_0xa97c('0x25'));_0x17e400['query']=_[_0xa97c('0x2b')](_0x3624c4[_0xa97c('0x2c')]);_0x17e400[_0xa97c('0x2d')]=_['intersection'](_0x17e400[_0xa97c('0x2e')],_0x17e400[_0xa97c('0x2c')]);_0x2a9ed0[_0xa97c('0x2f')]=_[_0xa97c('0x30')](_0x17e400[_0xa97c('0x2e')],qs[_0xa97c('0x31')](_0x3624c4[_0xa97c('0x2c')][_0xa97c('0x31')]));_0x2a9ed0[_0xa97c('0x2f')]=_0x2a9ed0[_0xa97c('0x2f')][_0xa97c('0x32')]?_0x2a9ed0[_0xa97c('0x2f')]:_0x17e400[_0xa97c('0x2e')];if(!_0x3624c4[_0xa97c('0x2c')]['hasOwnProperty'](_0xa97c('0x33'))){_0x2a9ed0[_0xa97c('0x1a')]=qs[_0xa97c('0x1a')](_0x3624c4[_0xa97c('0x2c')][_0xa97c('0x1a')]);_0x2a9ed0['offset']=qs[_0xa97c('0x19')](_0x3624c4[_0xa97c('0x2c')][_0xa97c('0x19')]);}_0x2a9ed0[_0xa97c('0x34')]=qs[_0xa97c('0x35')](_0x3624c4[_0xa97c('0x2c')][_0xa97c('0x35')]);_0x2a9ed0['where']=qs['filters'](_[_0xa97c('0x36')](_0x3624c4['query'],_0x17e400[_0xa97c('0x2d')]),_0x5c4eaa);if(_0x3624c4['query'][_0xa97c('0x37')]){_0x2a9ed0[_0xa97c('0x38')]=_[_0xa97c('0x39')](_0x2a9ed0[_0xa97c('0x38')],{'$or':_['map'](_0x5c4eaa,function(_0x47bb95){if(_0x47bb95[_0xa97c('0x3a')]!==_0xa97c('0x3b')){var _0x49de3a={};_0x49de3a[_0x47bb95['name']]={'$like':'%'+_0x3624c4['query']['filter']+'%'};return _0x49de3a;}})});}_0x2a9ed0=_[_0xa97c('0x39')]({},_0x2a9ed0,_0x3624c4[_0xa97c('0x3c')]);var _0x3be719={'where':_0x2a9ed0['where']};return db['MailServerOut'][_0xa97c('0x18')](_0x3be719)[_0xa97c('0x21')](function(_0x21be49){_0x53c517[_0xa97c('0x18')]=_0x21be49;if(_0x3624c4['query']['includeAll']){_0x2a9ed0[_0xa97c('0x3d')]=[{'all':!![]}];}return db[_0xa97c('0x28')]['findAll'](_0x2a9ed0);})['then'](function(_0x4d6e36){_0x53c517[_0xa97c('0x3e')]=_0x4d6e36;return _0x53c517;})[_0xa97c('0x21')](respondWithFilteredResult(_0x31d1d4,_0x2a9ed0))[_0xa97c('0x3f')](handleError(_0x31d1d4,null));};exports[_0xa97c('0x40')]=function(_0xe9c774,_0x5e1771){var _0x47d649={'raw':!![],'where':{'id':_0xe9c774[_0xa97c('0x41')]['id']}},_0x93740b={};_0x93740b['model']=_[_0xa97c('0x2b')](db[_0xa97c('0x28')][_0xa97c('0x29')]);_0x93740b['query']=_['keys'](_0xe9c774[_0xa97c('0x2c')]);_0x93740b[_0xa97c('0x2d')]=_['intersection'](_0x93740b['model'],_0x93740b[_0xa97c('0x2c')]);_0x47d649['attributes']=_['intersection'](_0x93740b['model'],qs[_0xa97c('0x31')](_0xe9c774[_0xa97c('0x2c')][_0xa97c('0x31')]));_0x47d649['attributes']=_0x47d649[_0xa97c('0x2f')][_0xa97c('0x32')]?_0x47d649[_0xa97c('0x2f')]:_0x93740b[_0xa97c('0x2e')];if(_0xe9c774[_0xa97c('0x2c')][_0xa97c('0x42')]){_0x47d649[_0xa97c('0x3d')]=[{'all':!![]}];}_0x47d649=_[_0xa97c('0x39')]({},_0x47d649,_0xe9c774['options']);return db[_0xa97c('0x28')][_0xa97c('0x43')](_0x47d649)['then'](handleEntityNotFound(_0x5e1771,null))[_0xa97c('0x21')](respondWithResult(_0x5e1771,null))[_0xa97c('0x3f')](handleError(_0x5e1771,null));};exports[_0xa97c('0x44')]=function(_0x38ef8e,_0x443e82){return db['MailServerOut'][_0xa97c('0x44')](_0x38ef8e[_0xa97c('0x45')],{})[_0xa97c('0x21')](respondWithResult(_0x443e82,0xc9))[_0xa97c('0x3f')](handleError(_0x443e82,null));};exports[_0xa97c('0x20')]=function(_0x1b4bb7,_0x1599ae){if(_0x1b4bb7[_0xa97c('0x45')]['id']){delete _0x1b4bb7[_0xa97c('0x45')]['id'];}return db[_0xa97c('0x28')]['find']({'where':{'id':_0x1b4bb7['params']['id']}})[_0xa97c('0x21')](handleEntityNotFound(_0x1599ae,null))[_0xa97c('0x21')](saveUpdates(_0x1b4bb7[_0xa97c('0x45')],null))[_0xa97c('0x21')](respondWithResult(_0x1599ae,null))[_0xa97c('0x3f')](handleError(_0x1599ae,null));};exports[_0xa97c('0x46')]=function(_0x2eb448,_0x5ee920){return db[_0xa97c('0x28')][_0xa97c('0x43')]({'where':{'id':_0x2eb448[_0xa97c('0x41')]['id']}})[_0xa97c('0x21')](handleEntityNotFound(_0x5ee920,null))[_0xa97c('0x21')](removeEntity(_0x5ee920,null))['catch'](handleError(_0x5ee920,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e46a45b..c204bb8 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 _0x3f8a=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x10eb5b,_0x10f47a){var _0x6fd2da=function(_0xc2a969){while(--_0xc2a969){_0x10eb5b['push'](_0x10eb5b['shift']());}};_0x6fd2da(++_0x10f47a);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xce2139,_0x2ef047){_0xce2139=_0xce2139-0x0;var _0x13aa6a=_0x3f8a[_0xce2139];return _0x13aa6a;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc97=['path','../../config/environment','./mailServerOut.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x287059,_0x499940){var _0x225c79=function(_0x3aa36e){while(--_0x3aa36e){_0x287059['push'](_0x287059['shift']());}};_0x225c79(++_0x499940);}(_0xdc97,0x13b));var _0x7dc9=function(_0x176514,_0x473111){_0x176514=_0x176514-0x0;var _0x15acf0=_0xdc97[_0x176514];return _0x15acf0;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('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 e1640d2..84027e1 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 _0xd619=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','MailServerOut,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash'];(function(_0xfad00d,_0x311d9b){var _0x28328c=function(_0x5bb4b1){while(--_0x5bb4b1){_0xfad00d['push'](_0xfad00d['shift']());}};_0x28328c(++_0x311d9b);}(_0xd619,0xe3));var _0x9d61=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xd619[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0x9d61('0x0'));var util=require(_0x9d61('0x1'));var moment=require(_0x9d61('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d61('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d61('0x4'))['db'];var utils=require(_0x9d61('0x5'));var logger=require(_0x9d61('0x6'))(_0x9d61('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9d61('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56d6a7,_0x9daf3b,_0x372e33){return new BPromise(function(_0x3e3e70,_0x48e03b){return client['request'](_0x56d6a7,_0x372e33)[_0x9d61('0x9')](function(_0x4d6a61){logger[_0x9d61('0xa')](_0x9d61('0xb'),_0x9daf3b,'request\x20sent');logger[_0x9d61('0xc')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x9daf3b,_0x9d61('0xd'),JSON['stringify'](_0x4d6a61));if(_0x4d6a61[_0x9d61('0xe')]){if(_0x4d6a61[_0x9d61('0xe')][_0x9d61('0xf')]===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x9daf3b,_0x4d6a61[_0x9d61('0xe')][_0x9d61('0x10')]);return _0x48e03b(_0x4d6a61[_0x9d61('0xe')][_0x9d61('0x10')]);}logger[_0x9d61('0xe')](_0x9d61('0xb'),_0x9daf3b,_0x4d6a61[_0x9d61('0xe')][_0x9d61('0x10')]);return _0x3e3e70(_0x4d6a61[_0x9d61('0xe')][_0x9d61('0x10')]);}else{logger[_0x9d61('0xa')](_0x9d61('0xb'),_0x9daf3b,_0x9d61('0xd'));_0x3e3e70(_0x4d6a61[_0x9d61('0x11')][_0x9d61('0x10')]);}})[_0x9d61('0x12')](function(_0x5b4b1b){logger[_0x9d61('0xe')](_0x9d61('0xb'),_0x9daf3b,_0x5b4b1b);_0x48e03b(_0x5b4b1b);});});} \ No newline at end of file +var _0x9fc8=['client','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fc8,0xd0));var _0x89fc=function(_0x40dc9e,_0x3e6c5f){_0x40dc9e=_0x40dc9e-0x0;var _0x3a32d2=_0x9fc8[_0x40dc9e];return _0x3a32d2;};'use strict';var _=require(_0x89fc('0x0'));var util=require('util');var moment=require(_0x89fc('0x1'));var BPromise=require(_0x89fc('0x2'));var rs=require(_0x89fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x89fc('0x4'))['db'];var utils=require(_0x89fc('0x5'));var logger=require(_0x89fc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x89fc('0x7'));var client=jayson[_0x89fc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fed68,_0x1e9423,_0x2f5566){return new BPromise(function(_0x2ed0a0,_0x1c920a){return client['request'](_0x4fed68,_0x2f5566)[_0x89fc('0x9')](function(_0x43243d){logger[_0x89fc('0xa')](_0x89fc('0xb'),_0x1e9423,_0x89fc('0xc'));logger['debug'](_0x89fc('0xd'),_0x1e9423,_0x89fc('0xc'),JSON['stringify'](_0x43243d));if(_0x43243d[_0x89fc('0xe')]){if(_0x43243d[_0x89fc('0xe')][_0x89fc('0xf')]===0x1f4){logger[_0x89fc('0xe')]('MailServerOut,\x20%s,\x20%s',_0x1e9423,_0x43243d[_0x89fc('0xe')][_0x89fc('0x10')]);return _0x1c920a(_0x43243d[_0x89fc('0xe')][_0x89fc('0x10')]);}logger[_0x89fc('0xe')]('MailServerOut,\x20%s,\x20%s',_0x1e9423,_0x43243d[_0x89fc('0xe')]['message']);return _0x2ed0a0(_0x43243d[_0x89fc('0xe')][_0x89fc('0x10')]);}else{logger[_0x89fc('0xa')](_0x89fc('0xb'),_0x1e9423,'request\x20sent');_0x2ed0a0(_0x43243d['result']['message']);}})[_0x89fc('0x11')](function(_0x361d76){logger['error'](_0x89fc('0xb'),_0x1e9423,_0x361d76);_0x1c920a(_0x361d76);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index c57c463..cd653ab 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 _0xa795=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','exports','multer'];(function(_0x8ac56c,_0x2956b1){var _0x1c24db=function(_0x52b07c){while(--_0x52b07c){_0x8ac56c['push'](_0x8ac56c['shift']());}};_0x1c24db(++_0x2956b1);}(_0xa795,0xe3));var _0x5a79=function(_0x54b03f,_0x2fc96c){_0x54b03f=_0x54b03f-0x0;var _0x49e94d=_0xa795[_0x54b03f];return _0x49e94d;};'use strict';var multer=require(_0x5a79('0x0'));var util=require('util');var path=require(_0x5a79('0x1'));var timeout=require(_0x5a79('0x2'));var express=require('express');var router=express[_0x5a79('0x3')]();var auth=require(_0x5a79('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5a79('0x5'));var controller=require(_0x5a79('0x6'));router[_0x5a79('0x7')]('/',auth[_0x5a79('0x8')](),controller[_0x5a79('0x9')]);router[_0x5a79('0x7')]('/describe',auth[_0x5a79('0x8')](),controller[_0x5a79('0xa')]);router[_0x5a79('0x7')]('/:id',auth[_0x5a79('0x8')](),controller[_0x5a79('0xb')]);router[_0x5a79('0xc')]('/',auth[_0x5a79('0x8')](),controller[_0x5a79('0xd')]);router[_0x5a79('0xe')](_0x5a79('0xf'),auth['isAuthenticated'](),controller[_0x5a79('0x10')]);router[_0x5a79('0x11')](_0x5a79('0xf'),auth[_0x5a79('0x8')](),controller['destroy']);module[_0x5a79('0x12')]=router; \ No newline at end of file +var _0xd95f=['./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','exports','multer','util','path','connect-timeout'];(function(_0x4aa3f3,_0x14cdee){var _0x163f8a=function(_0x4fe095){while(--_0x4fe095){_0x4aa3f3['push'](_0x4aa3f3['shift']());}};_0x163f8a(++_0x14cdee);}(_0xd95f,0x10c));var _0xfd95=function(_0x2b5e62,_0x1959b7){_0x2b5e62=_0x2b5e62-0x0;var _0x285b6b=_0xd95f[_0x2b5e62];return _0x285b6b;};'use strict';var multer=require(_0xfd95('0x0'));var util=require(_0xfd95('0x1'));var path=require(_0xfd95('0x2'));var timeout=require(_0xfd95('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(_0xfd95('0x4'));router[_0xfd95('0x5')]('/',auth[_0xfd95('0x6')](),controller[_0xfd95('0x7')]);router[_0xfd95('0x5')](_0xfd95('0x8'),auth[_0xfd95('0x6')](),controller[_0xfd95('0x9')]);router[_0xfd95('0x5')](_0xfd95('0xa'),auth[_0xfd95('0x6')](),controller['show']);router[_0xfd95('0xb')]('/',auth[_0xfd95('0x6')](),controller[_0xfd95('0xc')]);router[_0xfd95('0xd')](_0xfd95('0xa'),auth['isAuthenticated'](),controller[_0xfd95('0xe')]);router['delete']('/:id',auth[_0xfd95('0x6')](),controller['destroy']);module[_0xfd95('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 0a6b9a1..09d99d7 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 _0xc051=['STRING','sequelize','exports'];(function(_0x57a4d0,_0xa6e6b){var _0xaaadee=function(_0x544da2){while(--_0x544da2){_0x57a4d0['push'](_0x57a4d0['shift']());}};_0xaaadee(++_0xa6e6b);}(_0xc051,0xb5));var _0x1c05=function(_0x1ad6f8,_0x9160db){_0x1ad6f8=_0x1ad6f8-0x0;var _0xc83409=_0xc051[_0x1ad6f8];return _0xc83409;};'use strict';var Sequelize=require(_0x1c05('0x0'));module[_0x1c05('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1c05('0x2')]}}; \ No newline at end of file +var _0x7fea=['STRING','exports'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x7fea,0x149));var _0xa7fe=function(_0x38b1a0,_0x5575a9){_0x38b1a0=_0x38b1a0-0x0;var _0xd37e34=_0x7fea[_0x38b1a0];return _0xd37e34;};'use strict';var Sequelize=require('sequelize');module[_0xa7fe('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa7fe('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 196c124..5d2128e 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 _0x25a8=['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','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','count','findAll','rows','catch','show','params','includeAll','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x25a8,0xe7));var _0x825a=function(_0x5e9c17,_0x434a04){_0x5e9c17=_0x5e9c17-0x0;var _0x5d3f1a=_0x25a8[_0x5e9c17];return _0x5d3f1a;};'use strict';var pdf=require(_0x825a('0x0'));var emlformat=require(_0x825a('0x1'));var rimraf=require(_0x825a('0x2'));var zipdir=require(_0x825a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x825a('0x4'));var moment=require('moment');var BPromise=require(_0x825a('0x5'));var Mustache=require(_0x825a('0x6'));var util=require(_0x825a('0x7'));var path=require(_0x825a('0x8'));var sox=require(_0x825a('0x9'));var csv=require(_0x825a('0xa'));var ejs=require(_0x825a('0xb'));var fs=require('fs');var _=require(_0x825a('0xc'));var squel=require(_0x825a('0xd'));var crypto=require(_0x825a('0xe'));var jsforce=require(_0x825a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x825a('0xa'));var querystring=require(_0x825a('0x10'));var Papa=require(_0x825a('0x11'));var Redis=require('ioredis');var authService=require(_0x825a('0x12'));var qs=require(_0x825a('0x13'));var as=require(_0x825a('0x14'));var hardwareService=require(_0x825a('0x15'));var logger=require(_0x825a('0x16'))(_0x825a('0x17'));var utils=require(_0x825a('0x18'));var config=require(_0x825a('0x19'));var licenseUtil=require(_0x825a('0x1a'));var db=require(_0x825a('0x1b'))['db'];function respondWithStatusCode(_0x4041bc,_0xc3595c){_0xc3595c=_0xc3595c||0xcc;return function(_0x148883){if(_0x148883){return _0x4041bc[_0x825a('0x1c')](_0xc3595c);}return _0x4041bc[_0x825a('0x1d')](_0xc3595c)['end']();};}function respondWithResult(_0x26dd7b,_0x10899e){_0x10899e=_0x10899e||0xc8;return function(_0x1ec5a8){if(_0x1ec5a8){return _0x26dd7b[_0x825a('0x1d')](_0x10899e)[_0x825a('0x1e')](_0x1ec5a8);}};}function respondWithFilteredResult(_0x189ca7,_0x7562a3){return function(_0x2f47dd){if(_0x2f47dd){var _0x4dba08=_0x2f47dd['count'],_0x5194df=_0x7562a3[_0x825a('0x1f')],_0x2cc5fe=_0x7562a3[_0x825a('0x1f')]+_0x7562a3[_0x825a('0x20')],_0x48c976;if(_0x2cc5fe>=_0x4dba08){_0x2cc5fe=_0x4dba08;_0x48c976=0xc8;}else{_0x48c976=0xce;}_0x189ca7['status'](_0x48c976);return _0x189ca7[_0x825a('0x21')](_0x825a('0x22'),_0x5194df+'-'+_0x2cc5fe+'/'+_0x4dba08)[_0x825a('0x1e')](_0x2f47dd);}return null;};}function patchUpdates(_0x447fc6){return function(_0x2a3240){try{jsonpatch[_0x825a('0x23')](_0x2a3240,_0x447fc6,!![]);}catch(_0x1648c0){return BPromise[_0x825a('0x24')](_0x1648c0);}return _0x2a3240[_0x825a('0x25')]();};}function saveUpdates(_0x43ddc3,_0x4aeaf4){return function(_0x53a737){if(_0x53a737){return _0x53a737['update'](_0x43ddc3)[_0x825a('0x26')](function(_0x2b12de){return _0x2b12de;});}return null;};}function removeEntity(_0x3ad230,_0x109428){return function(_0x750601){if(_0x750601){return _0x750601[_0x825a('0x27')]()[_0x825a('0x26')](function(){_0x3ad230['status'](0xcc)[_0x825a('0x28')]();});}};}function handleEntityNotFound(_0x18dca7,_0x3bfa1e){return function(_0x41c45f){if(!_0x41c45f){_0x18dca7['sendStatus'](0x194);}return _0x41c45f;};}function handleError(_0x404a0b,_0x3dd87a){_0x3dd87a=_0x3dd87a||0x1f4;return function(_0x4f8249){logger[_0x825a('0x29')](_0x4f8249[_0x825a('0x2a')]);if(_0x4f8249['name']){delete _0x4f8249['name'];}_0x404a0b[_0x825a('0x1d')](_0x3dd87a)['send'](_0x4f8249);};}exports[_0x825a('0x2b')]=function(_0x5d6e83,_0x5b9461){var _0x4c18f9={},_0x36bf02={},_0x2b1d70={'count':0x0,'rows':[]};var _0x5d653e=_[_0x825a('0x2c')](db[_0x825a('0x2d')][_0x825a('0x2e')],function(_0x5f181b){return{'name':_0x5f181b[_0x825a('0x2f')],'type':_0x5f181b[_0x825a('0x30')][_0x825a('0x31')]};});_0x36bf02[_0x825a('0x32')]=_['map'](_0x5d653e,_0x825a('0x33'));_0x36bf02[_0x825a('0x34')]=_[_0x825a('0x35')](_0x5d6e83[_0x825a('0x34')]);_0x36bf02['filters']=_[_0x825a('0x36')](_0x36bf02[_0x825a('0x32')],_0x36bf02[_0x825a('0x34')]);_0x4c18f9[_0x825a('0x37')]=_[_0x825a('0x36')](_0x36bf02[_0x825a('0x32')],qs[_0x825a('0x38')](_0x5d6e83[_0x825a('0x34')][_0x825a('0x38')]));_0x4c18f9['attributes']=_0x4c18f9[_0x825a('0x37')][_0x825a('0x39')]?_0x4c18f9[_0x825a('0x37')]:_0x36bf02[_0x825a('0x32')];if(!_0x5d6e83[_0x825a('0x34')][_0x825a('0x3a')](_0x825a('0x3b'))){_0x4c18f9[_0x825a('0x20')]=qs['limit'](_0x5d6e83[_0x825a('0x34')][_0x825a('0x20')]);_0x4c18f9[_0x825a('0x1f')]=qs['offset'](_0x5d6e83[_0x825a('0x34')]['offset']);}_0x4c18f9[_0x825a('0x3c')]=qs[_0x825a('0x3d')](_0x5d6e83[_0x825a('0x34')][_0x825a('0x3d')]);_0x4c18f9[_0x825a('0x3e')]=qs[_0x825a('0x3f')](_[_0x825a('0x40')](_0x5d6e83[_0x825a('0x34')],_0x36bf02[_0x825a('0x3f')]),_0x5d653e);if(_0x5d6e83[_0x825a('0x34')]['filter']){_0x4c18f9['where']=_['merge'](_0x4c18f9[_0x825a('0x3e')],{'$or':_['map'](_0x5d653e,function(_0xe685bf){if(_0xe685bf[_0x825a('0x30')]!==_0x825a('0x41')){var _0x6b3efa={};_0x6b3efa[_0xe685bf[_0x825a('0x33')]]={'$like':'%'+_0x5d6e83['query'][_0x825a('0x42')]+'%'};return _0x6b3efa;}})});}_0x4c18f9=_[_0x825a('0x43')]({},_0x4c18f9,_0x5d6e83[_0x825a('0x44')]);var _0x1c56db={'where':_0x4c18f9['where']};return db[_0x825a('0x2d')][_0x825a('0x45')](_0x1c56db)[_0x825a('0x26')](function(_0xbac42f){_0x2b1d70[_0x825a('0x45')]=_0xbac42f;if(_0x5d6e83[_0x825a('0x34')]['includeAll']){_0x4c18f9['include']=[{'all':!![]}];}return db[_0x825a('0x2d')][_0x825a('0x46')](_0x4c18f9);})[_0x825a('0x26')](function(_0x325642){_0x2b1d70[_0x825a('0x47')]=_0x325642;return _0x2b1d70;})[_0x825a('0x26')](respondWithFilteredResult(_0x5b9461,_0x4c18f9))[_0x825a('0x48')](handleError(_0x5b9461,null));};exports[_0x825a('0x49')]=function(_0x401a4c,_0x2ec05b){var _0x36864b={'raw':!![],'where':{'id':_0x401a4c[_0x825a('0x4a')]['id']}},_0x47f8d9={};_0x47f8d9['model']=_[_0x825a('0x35')](db['MailSubstatus'][_0x825a('0x2e')]);_0x47f8d9['query']=_[_0x825a('0x35')](_0x401a4c[_0x825a('0x34')]);_0x47f8d9[_0x825a('0x3f')]=_[_0x825a('0x36')](_0x47f8d9[_0x825a('0x32')],_0x47f8d9[_0x825a('0x34')]);_0x36864b[_0x825a('0x37')]=_[_0x825a('0x36')](_0x47f8d9[_0x825a('0x32')],qs[_0x825a('0x38')](_0x401a4c[_0x825a('0x34')]['fields']));_0x36864b[_0x825a('0x37')]=_0x36864b[_0x825a('0x37')][_0x825a('0x39')]?_0x36864b['attributes']:_0x47f8d9['model'];if(_0x401a4c[_0x825a('0x34')][_0x825a('0x4b')]){_0x36864b['include']=[{'all':!![]}];}_0x36864b=_[_0x825a('0x43')]({},_0x36864b,_0x401a4c[_0x825a('0x44')]);return db[_0x825a('0x2d')][_0x825a('0x4c')](_0x36864b)[_0x825a('0x26')](handleEntityNotFound(_0x2ec05b,null))['then'](respondWithResult(_0x2ec05b,null))[_0x825a('0x48')](handleError(_0x2ec05b,null));};exports[_0x825a('0x4d')]=function(_0x27a421,_0x24df05){return db[_0x825a('0x2d')][_0x825a('0x4d')](_0x27a421[_0x825a('0x4e')],{})[_0x825a('0x26')](respondWithResult(_0x24df05,0xc9))[_0x825a('0x48')](handleError(_0x24df05,null));};exports[_0x825a('0x4f')]=function(_0x1e4116,_0xb96829){if(_0x1e4116[_0x825a('0x4e')]['id']){delete _0x1e4116['body']['id'];}return db['MailSubstatus'][_0x825a('0x4c')]({'where':{'id':_0x1e4116[_0x825a('0x4a')]['id']}})[_0x825a('0x26')](handleEntityNotFound(_0xb96829,null))[_0x825a('0x26')](saveUpdates(_0x1e4116[_0x825a('0x4e')],null))['then'](respondWithResult(_0xb96829,null))[_0x825a('0x48')](handleError(_0xb96829,null));};exports[_0x825a('0x27')]=function(_0x13fb15,_0x44c01c){return db[_0x825a('0x2d')][_0x825a('0x4c')]({'where':{'id':_0x13fb15[_0x825a('0x4a')]['id']}})[_0x825a('0x26')](handleEntityNotFound(_0x44c01c,null))[_0x825a('0x26')](removeEntity(_0x44c01c,null))['catch'](handleError(_0x44c01c,null));};exports['describe']=function(_0xf4adf,_0xdf74e2){return db[_0x825a('0x2d')][_0x825a('0x50')]()[_0x825a('0x26')](respondWithResult(_0xdf74e2,null))[_0x825a('0x48')](handleError(_0xdf74e2,null));}; \ No newline at end of file +var _0x6cb5=['find','create','body','update','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','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','limit','set','reject','save','destroy','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','length'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0x6cb5,0xea));var _0x56cb=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x6cb5[_0x288f5e];return _0x476cc9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x56cb('0x0'));var rimraf=require(_0x56cb('0x1'));var zipdir=require(_0x56cb('0x2'));var jsonpatch=require(_0x56cb('0x3'));var rp=require('request-promise');var moment=require(_0x56cb('0x4'));var BPromise=require(_0x56cb('0x5'));var Mustache=require('mustache');var util=require(_0x56cb('0x6'));var path=require(_0x56cb('0x7'));var sox=require(_0x56cb('0x8'));var csv=require(_0x56cb('0x9'));var ejs=require(_0x56cb('0xa'));var fs=require('fs');var _=require(_0x56cb('0xb'));var squel=require(_0x56cb('0xc'));var crypto=require(_0x56cb('0xd'));var jsforce=require(_0x56cb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x56cb('0x9'));var querystring=require('querystring');var Papa=require(_0x56cb('0xf'));var Redis=require(_0x56cb('0x10'));var authService=require(_0x56cb('0x11'));var qs=require(_0x56cb('0x12'));var as=require(_0x56cb('0x13'));var hardwareService=require(_0x56cb('0x14'));var logger=require(_0x56cb('0x15'))(_0x56cb('0x16'));var utils=require(_0x56cb('0x17'));var config=require(_0x56cb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x56cb('0x19'))['db'];function respondWithStatusCode(_0xea78fa,_0x3180fe){_0x3180fe=_0x3180fe||0xcc;return function(_0x318274){if(_0x318274){return _0xea78fa[_0x56cb('0x1a')](_0x3180fe);}return _0xea78fa[_0x56cb('0x1b')](_0x3180fe)[_0x56cb('0x1c')]();};}function respondWithResult(_0x5f2f21,_0xb270cb){_0xb270cb=_0xb270cb||0xc8;return function(_0x500889){if(_0x500889){return _0x5f2f21[_0x56cb('0x1b')](_0xb270cb)[_0x56cb('0x1d')](_0x500889);}};}function respondWithFilteredResult(_0xa1bdfc,_0x25d751){return function(_0x3c8f70){if(_0x3c8f70){var _0x44dab3=_0x3c8f70[_0x56cb('0x1e')],_0x126083=_0x25d751[_0x56cb('0x1f')],_0xf8c290=_0x25d751['offset']+_0x25d751[_0x56cb('0x20')],_0x44f368;if(_0xf8c290>=_0x44dab3){_0xf8c290=_0x44dab3;_0x44f368=0xc8;}else{_0x44f368=0xce;}_0xa1bdfc[_0x56cb('0x1b')](_0x44f368);return _0xa1bdfc[_0x56cb('0x21')]('Content-Range',_0x126083+'-'+_0xf8c290+'/'+_0x44dab3)[_0x56cb('0x1d')](_0x3c8f70);}return null;};}function patchUpdates(_0xf2589a){return function(_0x42c6fa){try{jsonpatch['apply'](_0x42c6fa,_0xf2589a,!![]);}catch(_0x141279){return BPromise[_0x56cb('0x22')](_0x141279);}return _0x42c6fa[_0x56cb('0x23')]();};}function saveUpdates(_0x27f4dd,_0x3a9a29){return function(_0x2bce04){if(_0x2bce04){return _0x2bce04['update'](_0x27f4dd)['then'](function(_0x5bb4b4){return _0x5bb4b4;});}return null;};}function removeEntity(_0x2b7f16,_0x3fb3a1){return function(_0x122f83){if(_0x122f83){return _0x122f83[_0x56cb('0x24')]()[_0x56cb('0x25')](function(){_0x2b7f16[_0x56cb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23cf20,_0x7b8987){return function(_0x4c3f6c){if(!_0x4c3f6c){_0x23cf20[_0x56cb('0x1a')](0x194);}return _0x4c3f6c;};}function handleError(_0x442d4c,_0x45a114){_0x45a114=_0x45a114||0x1f4;return function(_0x346646){logger[_0x56cb('0x26')](_0x346646[_0x56cb('0x27')]);if(_0x346646[_0x56cb('0x28')]){delete _0x346646[_0x56cb('0x28')];}_0x442d4c[_0x56cb('0x1b')](_0x45a114)[_0x56cb('0x29')](_0x346646);};}exports[_0x56cb('0x2a')]=function(_0x103f12,_0x4ecec4){var _0x1a3774={},_0x59e93d={},_0x395b04={'count':0x0,'rows':[]};var _0x3b5839=_[_0x56cb('0x2b')](db[_0x56cb('0x2c')][_0x56cb('0x2d')],function(_0x5f3d18){return{'name':_0x5f3d18[_0x56cb('0x2e')],'type':_0x5f3d18[_0x56cb('0x2f')]['key']};});_0x59e93d[_0x56cb('0x30')]=_[_0x56cb('0x2b')](_0x3b5839,_0x56cb('0x28'));_0x59e93d['query']=_[_0x56cb('0x31')](_0x103f12[_0x56cb('0x32')]);_0x59e93d[_0x56cb('0x33')]=_[_0x56cb('0x34')](_0x59e93d[_0x56cb('0x30')],_0x59e93d[_0x56cb('0x32')]);_0x1a3774['attributes']=_[_0x56cb('0x34')](_0x59e93d[_0x56cb('0x30')],qs[_0x56cb('0x35')](_0x103f12[_0x56cb('0x32')][_0x56cb('0x35')]));_0x1a3774['attributes']=_0x1a3774[_0x56cb('0x36')]['length']?_0x1a3774[_0x56cb('0x36')]:_0x59e93d[_0x56cb('0x30')];if(!_0x103f12[_0x56cb('0x32')][_0x56cb('0x37')](_0x56cb('0x38'))){_0x1a3774[_0x56cb('0x20')]=qs['limit'](_0x103f12['query'][_0x56cb('0x20')]);_0x1a3774['offset']=qs[_0x56cb('0x1f')](_0x103f12['query'][_0x56cb('0x1f')]);}_0x1a3774['order']=qs[_0x56cb('0x39')](_0x103f12[_0x56cb('0x32')][_0x56cb('0x39')]);_0x1a3774['where']=qs[_0x56cb('0x33')](_[_0x56cb('0x3a')](_0x103f12['query'],_0x59e93d['filters']),_0x3b5839);if(_0x103f12[_0x56cb('0x32')]['filter']){_0x1a3774['where']=_['merge'](_0x1a3774[_0x56cb('0x3b')],{'$or':_['map'](_0x3b5839,function(_0x13ba94){if(_0x13ba94[_0x56cb('0x2f')]!==_0x56cb('0x3c')){var _0x52eed8={};_0x52eed8[_0x13ba94[_0x56cb('0x28')]]={'$like':'%'+_0x103f12['query'][_0x56cb('0x3d')]+'%'};return _0x52eed8;}})});}_0x1a3774=_[_0x56cb('0x3e')]({},_0x1a3774,_0x103f12[_0x56cb('0x3f')]);var _0x54ea22={'where':_0x1a3774[_0x56cb('0x3b')]};return db['MailSubstatus']['count'](_0x54ea22)['then'](function(_0x39533e){_0x395b04[_0x56cb('0x1e')]=_0x39533e;if(_0x103f12['query'][_0x56cb('0x40')]){_0x1a3774[_0x56cb('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0x56cb('0x42')](_0x1a3774);})[_0x56cb('0x25')](function(_0x4c55b7){_0x395b04['rows']=_0x4c55b7;return _0x395b04;})[_0x56cb('0x25')](respondWithFilteredResult(_0x4ecec4,_0x1a3774))['catch'](handleError(_0x4ecec4,null));};exports[_0x56cb('0x43')]=function(_0x1b8722,_0x5a67fb){var _0x200683={'raw':!![],'where':{'id':_0x1b8722[_0x56cb('0x44')]['id']}},_0x4b1584={};_0x4b1584[_0x56cb('0x30')]=_[_0x56cb('0x31')](db[_0x56cb('0x2c')][_0x56cb('0x2d')]);_0x4b1584['query']=_['keys'](_0x1b8722['query']);_0x4b1584['filters']=_['intersection'](_0x4b1584[_0x56cb('0x30')],_0x4b1584[_0x56cb('0x32')]);_0x200683[_0x56cb('0x36')]=_[_0x56cb('0x34')](_0x4b1584['model'],qs[_0x56cb('0x35')](_0x1b8722['query'][_0x56cb('0x35')]));_0x200683['attributes']=_0x200683[_0x56cb('0x36')][_0x56cb('0x45')]?_0x200683['attributes']:_0x4b1584['model'];if(_0x1b8722['query'][_0x56cb('0x40')]){_0x200683[_0x56cb('0x41')]=[{'all':!![]}];}_0x200683=_[_0x56cb('0x3e')]({},_0x200683,_0x1b8722[_0x56cb('0x3f')]);return db[_0x56cb('0x2c')][_0x56cb('0x46')](_0x200683)[_0x56cb('0x25')](handleEntityNotFound(_0x5a67fb,null))['then'](respondWithResult(_0x5a67fb,null))['catch'](handleError(_0x5a67fb,null));};exports[_0x56cb('0x47')]=function(_0x12e52a,_0x1a8778){return db[_0x56cb('0x2c')]['create'](_0x12e52a[_0x56cb('0x48')],{})[_0x56cb('0x25')](respondWithResult(_0x1a8778,0xc9))['catch'](handleError(_0x1a8778,null));};exports[_0x56cb('0x49')]=function(_0x20f036,_0x5583ac){if(_0x20f036['body']['id']){delete _0x20f036['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x20f036[_0x56cb('0x44')]['id']}})['then'](handleEntityNotFound(_0x5583ac,null))[_0x56cb('0x25')](saveUpdates(_0x20f036[_0x56cb('0x48')],null))[_0x56cb('0x25')](respondWithResult(_0x5583ac,null))[_0x56cb('0x4a')](handleError(_0x5583ac,null));};exports[_0x56cb('0x24')]=function(_0x4415de,_0x2a6416){return db[_0x56cb('0x2c')][_0x56cb('0x46')]({'where':{'id':_0x4415de[_0x56cb('0x44')]['id']}})[_0x56cb('0x25')](handleEntityNotFound(_0x2a6416,null))[_0x56cb('0x25')](removeEntity(_0x2a6416,null))['catch'](handleError(_0x2a6416,null));};exports['describe']=function(_0x1f69df,_0x5dde30){return db['MailSubstatus'][_0x56cb('0x4b')]()[_0x56cb('0x25')](respondWithResult(_0x5dde30,null))[_0x56cb('0x4a')](handleError(_0x5dde30,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 64cc356..7a8d3d4 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 _0x1d21=['rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5cb207,_0x11bb63){var _0x1deb61=function(_0x170626){while(--_0x170626){_0x5cb207['push'](_0x5cb207['shift']());}};_0x1deb61(++_0x11bb63);}(_0x1d21,0x158));var _0x11d2=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0x1d21[_0xe2c95e];return _0x42ce6f;};'use strict';var _=require(_0x11d2('0x0'));var util=require(_0x11d2('0x1'));var logger=require(_0x11d2('0x2'))(_0x11d2('0x3'));var moment=require('moment');var BPromise=require(_0x11d2('0x4'));var rp=require(_0x11d2('0x5'));var fs=require('fs');var path=require(_0x11d2('0x6'));var rimraf=require(_0x11d2('0x7'));var config=require('../../config/environment');var attributes=require(_0x11d2('0x8'));module[_0x11d2('0x9')]=function(_0x16e99c,_0x21a2d3){return _0x16e99c[_0x11d2('0xa')](_0x11d2('0xb'),attributes,{'tableName':_0x11d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6017=['../../config/environment','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x1a52f1,_0x30de59){var _0x4b5684=function(_0x3300da){while(--_0x3300da){_0x1a52f1['push'](_0x1a52f1['shift']());}};_0x4b5684(++_0x30de59);}(_0x6017,0xae));var _0x7601=function(_0x2157c0,_0x1e6004){_0x2157c0=_0x2157c0-0x0;var _0x26325f=_0x6017[_0x2157c0];return _0x26325f;};'use strict';var _=require(_0x7601('0x0'));var util=require(_0x7601('0x1'));var logger=require(_0x7601('0x2'))('api');var moment=require(_0x7601('0x3'));var BPromise=require(_0x7601('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7601('0x5'));var rimraf=require('rimraf');var config=require(_0x7601('0x6'));var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x425bf9,_0xc62b2c){return _0x425bf9[_0x7601('0x7')](_0x7601('0x8'),attributes,{'tableName':_0x7601('0x9'),'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 2d9a8ca..96df0ea 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 _0x6f7a=['http','request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4ea809,_0x5416a6){var _0x31be45=function(_0x347d68){while(--_0x347d68){_0x4ea809['push'](_0x4ea809['shift']());}};_0x31be45(++_0x5416a6);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x6c225a,_0x1a4ecc){_0x6c225a=_0x6c225a-0x0;var _0x40a0c5=_0x6f7a[_0x6c225a];return _0x40a0c5;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335aaa,_0x1a06d1,_0x481a8c){return new BPromise(function(_0x4b4f9e,_0x30f2a7){return client[_0xa6f7('0xd')](_0x335aaa,_0x481a8c)[_0xa6f7('0xe')](function(_0x362404){logger[_0xa6f7('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x1a06d1,'request\x20sent');logger[_0xa6f7('0x10')](_0xa6f7('0x11'),_0x1a06d1,'request\x20sent',JSON[_0xa6f7('0x12')](_0x362404));if(_0x362404['error']){if(_0x362404[_0xa6f7('0x13')][_0xa6f7('0x14')]===0x1f4){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x30f2a7(_0x362404['error'][_0xa6f7('0x16')]);}logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x4b4f9e(_0x362404['error'][_0xa6f7('0x16')]);}else{logger['info'](_0xa6f7('0x15'),_0x1a06d1,_0xa6f7('0x17'));_0x4b4f9e(_0x362404[_0xa6f7('0x18')]['message']);}})[_0xa6f7('0x19')](function(_0x22635e){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x22635e);_0x30f2a7(_0x22635e);});});} \ No newline at end of file +var _0x5b02=['client','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x22df9f,_0x9ec477){var _0x4ed906=function(_0x3bdb69){while(--_0x3bdb69){_0x22df9f['push'](_0x22df9f['shift']());}};_0x4ed906(++_0x9ec477);}(_0x5b02,0xe9));var _0x25b0=function(_0x40b759,_0x6cc8bf){_0x40b759=_0x40b759-0x0;var _0x24b4bd=_0x5b02[_0x40b759];return _0x24b4bd;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var BPromise=require(_0x25b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b0('0x5'))(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var jayson=require(_0x25b0('0x8'));var client=jayson[_0x25b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d82c6,_0xd8276d,_0x49ef3a){return new BPromise(function(_0x412954,_0x4d3e71){return client['request'](_0x1d82c6,_0x49ef3a)[_0x25b0('0xa')](function(_0x45429b){logger[_0x25b0('0xb')]('MailSubstatus,\x20%s,\x20%s',_0xd8276d,_0x25b0('0xc'));logger[_0x25b0('0xd')](_0x25b0('0xe'),_0xd8276d,_0x25b0('0xc'),JSON[_0x25b0('0xf')](_0x45429b));if(_0x45429b[_0x25b0('0x10')]){if(_0x45429b[_0x25b0('0x10')][_0x25b0('0x11')]===0x1f4){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x4d3e71(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x412954(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}else{logger[_0x25b0('0xb')]('MailSubstatus,\x20%s,\x20%s',_0xd8276d,'request\x20sent');_0x412954(_0x45429b[_0x25b0('0x14')]['message']);}})[_0x25b0('0x15')](function(_0x1d009f){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x1d009f);_0x4d3e71(_0x1d009f);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f04b2c6..485fab2 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 _0x5f2f=['describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f2f,0x8e));var _0xf5f2=function(_0xfef55b,_0x15e320){_0xfef55b=_0xfef55b-0x0;var _0x129f63=_0x5f2f[_0xfef55b];return _0x129f63;};'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('../../components/auth/service');var interaction=require(_0xf5f2('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xf5f2('0x7')]('/',auth[_0xf5f2('0x8')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0x7')]('/describe',auth[_0xf5f2('0x8')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x7')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x8')](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/:id',auth[_0xf5f2('0x8')](),controller['update']);router[_0xf5f2('0x10')](_0xf5f2('0xb'),auth[_0xf5f2('0x8')](),controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +var _0xc5fc=['util','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','delete','destroy','exports','multer'];(function(_0x35b4f6,_0x25be16){var _0xd5bc8f=function(_0x16ae61){while(--_0x16ae61){_0x35b4f6['push'](_0x35b4f6['shift']());}};_0xd5bc8f(++_0x25be16);}(_0xc5fc,0x10f));var _0xcc5f=function(_0xb30e26,_0x54c213){_0xb30e26=_0xb30e26-0x0;var _0x2c1605=_0xc5fc[_0xb30e26];return _0x2c1605;};'use strict';var multer=require(_0xcc5f('0x0'));var util=require(_0xcc5f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc5f('0x2'));var router=express[_0xcc5f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xcc5f('0x4'));var config=require(_0xcc5f('0x5'));var controller=require(_0xcc5f('0x6'));router[_0xcc5f('0x7')]('/',auth[_0xcc5f('0x8')](),controller[_0xcc5f('0x9')]);router[_0xcc5f('0x7')](_0xcc5f('0xa'),auth[_0xcc5f('0x8')](),controller[_0xcc5f('0xb')]);router[_0xcc5f('0x7')](_0xcc5f('0xc'),auth[_0xcc5f('0x8')](),controller['show']);router['post']('/',auth[_0xcc5f('0x8')](),controller[_0xcc5f('0xd')]);router['put'](_0xcc5f('0xc'),auth[_0xcc5f('0x8')](),controller['update']);router[_0xcc5f('0xe')](_0xcc5f('0xc'),auth['isAuthenticated'](),controller[_0xcc5f('0xf')]);module[_0xcc5f('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index d7b49af..106024f 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 _0xc2bd=['agent','DATE','moment','STRING','ENUM'];(function(_0x21a2d2,_0x39b797){var _0x2c4da5=function(_0x13c0dd){while(--_0x13c0dd){_0x21a2d2['push'](_0x21a2d2['shift']());}};_0x2c4da5(++_0x39b797);}(_0xc2bd,0x84));var _0xdc2b=function(_0x597a72,_0x4c3108){_0x597a72=_0x597a72-0x0;var _0x26d393=_0xc2bd[_0x597a72];return _0x26d393;};'use strict';var moment=require(_0xdc2b('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xdc2b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xdc2b('0x2')]('account',_0xdc2b('0x3'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xdc2b('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x310c=['exports','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x310c,0x178));var _0xc310=function(_0x1a2955,_0x1d7e24){_0x1a2955=_0x1a2955-0x0;var _0xf97e94=_0x310c[_0x1a2955];return _0xf97e94;};'use strict';var moment=require(_0xc310('0x0'));var Sequelize=require(_0xc310('0x1'));module[_0xc310('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xc310('0x3'),_0xc310('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xc310('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xc310('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 2fdfec1..b125bdc 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 _0xe097=['apply','reject','update','then','destroy','error','stack','name','send','MailTransferReport','rawAttributes','map','query','keys','filters','intersection','model','attributes','fields','length','order','sort','pick','filter','where','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','find','catch','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0xe097,0x186));var _0x7e09=function(_0x5c2d7b,_0x4918c5){_0x5c2d7b=_0x5c2d7b-0x0;var _0x27e5f6=_0xe097[_0x5c2d7b];return _0x27e5f6;};'use strict';var pdf=require(_0x7e09('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7e09('0x1'));var jsonpatch=require(_0x7e09('0x2'));var rp=require(_0x7e09('0x3'));var moment=require('moment');var BPromise=require(_0x7e09('0x4'));var Mustache=require(_0x7e09('0x5'));var util=require(_0x7e09('0x6'));var path=require('path');var sox=require(_0x7e09('0x7'));var csv=require(_0x7e09('0x8'));var ejs=require(_0x7e09('0x9'));var fs=require('fs');var _=require(_0x7e09('0xa'));var squel=require(_0x7e09('0xb'));var crypto=require(_0x7e09('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e09('0x8'));var querystring=require('querystring');var Papa=require(_0x7e09('0xd'));var Redis=require('ioredis');var authService=require(_0x7e09('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e09('0xf'));var logger=require(_0x7e09('0x10'))(_0x7e09('0x11'));var utils=require(_0x7e09('0x12'));var config=require(_0x7e09('0x13'));var licenseUtil=require(_0x7e09('0x14'));var db=require(_0x7e09('0x15'))['db'];function respondWithStatusCode(_0x492979,_0x42239d){_0x42239d=_0x42239d||0xcc;return function(_0x5d53a4){if(_0x5d53a4){return _0x492979[_0x7e09('0x16')](_0x42239d);}return _0x492979['status'](_0x42239d)[_0x7e09('0x17')]();};}function respondWithResult(_0x1c4c74,_0x235071){_0x235071=_0x235071||0xc8;return function(_0x3a0f11){if(_0x3a0f11){return _0x1c4c74[_0x7e09('0x18')](_0x235071)[_0x7e09('0x19')](_0x3a0f11);}};}function respondWithFilteredResult(_0x2c453a,_0x4cb863){return function(_0x50d2ea){if(_0x50d2ea){var _0xffd7a1=_0x50d2ea['count'],_0x1e404e=_0x4cb863[_0x7e09('0x1a')],_0x5f4fc0=_0x4cb863[_0x7e09('0x1a')]+_0x4cb863[_0x7e09('0x1b')],_0x51737a;if(_0x5f4fc0>=_0xffd7a1){_0x5f4fc0=_0xffd7a1;_0x51737a=0xc8;}else{_0x51737a=0xce;}_0x2c453a[_0x7e09('0x18')](_0x51737a);return _0x2c453a[_0x7e09('0x1c')](_0x7e09('0x1d'),_0x1e404e+'-'+_0x5f4fc0+'/'+_0xffd7a1)[_0x7e09('0x19')](_0x50d2ea);}return null;};}function patchUpdates(_0x4c3d44){return function(_0x5de0b2){try{jsonpatch[_0x7e09('0x1e')](_0x5de0b2,_0x4c3d44,!![]);}catch(_0x1c3c3d){return BPromise[_0x7e09('0x1f')](_0x1c3c3d);}return _0x5de0b2['save']();};}function saveUpdates(_0x50d468,_0x22d6db){return function(_0x500840){if(_0x500840){return _0x500840[_0x7e09('0x20')](_0x50d468)[_0x7e09('0x21')](function(_0x4273b4){return _0x4273b4;});}return null;};}function removeEntity(_0xdebb85,_0x335e4f){return function(_0x1f5433){if(_0x1f5433){return _0x1f5433[_0x7e09('0x22')]()[_0x7e09('0x21')](function(){_0xdebb85[_0x7e09('0x18')](0xcc)[_0x7e09('0x17')]();});}};}function handleEntityNotFound(_0x1cfa47,_0x39c06b){return function(_0x57e7f9){if(!_0x57e7f9){_0x1cfa47['sendStatus'](0x194);}return _0x57e7f9;};}function handleError(_0x281060,_0x26c2ba){_0x26c2ba=_0x26c2ba||0x1f4;return function(_0x21b51d){logger[_0x7e09('0x23')](_0x21b51d[_0x7e09('0x24')]);if(_0x21b51d[_0x7e09('0x25')]){delete _0x21b51d[_0x7e09('0x25')];}_0x281060[_0x7e09('0x18')](_0x26c2ba)[_0x7e09('0x26')](_0x21b51d);};}exports['index']=function(_0x490976,_0x35249f){var _0x493872={},_0x1a424f={},_0x4d9cf7={'count':0x0,'rows':[]};var _0x379d17=_['map'](db[_0x7e09('0x27')][_0x7e09('0x28')],function(_0x2dd6d7){return{'name':_0x2dd6d7['fieldName'],'type':_0x2dd6d7['type']['key']};});_0x1a424f['model']=_[_0x7e09('0x29')](_0x379d17,'name');_0x1a424f[_0x7e09('0x2a')]=_[_0x7e09('0x2b')](_0x490976[_0x7e09('0x2a')]);_0x1a424f[_0x7e09('0x2c')]=_[_0x7e09('0x2d')](_0x1a424f[_0x7e09('0x2e')],_0x1a424f[_0x7e09('0x2a')]);_0x493872[_0x7e09('0x2f')]=_[_0x7e09('0x2d')](_0x1a424f['model'],qs[_0x7e09('0x30')](_0x490976[_0x7e09('0x2a')][_0x7e09('0x30')]));_0x493872['attributes']=_0x493872[_0x7e09('0x2f')][_0x7e09('0x31')]?_0x493872['attributes']:_0x1a424f[_0x7e09('0x2e')];if(!_0x490976[_0x7e09('0x2a')]['hasOwnProperty']('nolimit')){_0x493872[_0x7e09('0x1b')]=qs['limit'](_0x490976[_0x7e09('0x2a')][_0x7e09('0x1b')]);_0x493872[_0x7e09('0x1a')]=qs[_0x7e09('0x1a')](_0x490976[_0x7e09('0x2a')][_0x7e09('0x1a')]);}_0x493872[_0x7e09('0x32')]=qs[_0x7e09('0x33')](_0x490976[_0x7e09('0x2a')]['sort']);_0x493872['where']=qs[_0x7e09('0x2c')](_[_0x7e09('0x34')](_0x490976['query'],_0x1a424f[_0x7e09('0x2c')]),_0x379d17);if(_0x490976[_0x7e09('0x2a')][_0x7e09('0x35')]){_0x493872['where']=_['merge'](_0x493872[_0x7e09('0x36')],{'$or':_[_0x7e09('0x29')](_0x379d17,function(_0x344d2d){if(_0x344d2d[_0x7e09('0x37')]!==_0x7e09('0x38')){var _0x30292b={};_0x30292b[_0x344d2d['name']]={'$like':'%'+_0x490976[_0x7e09('0x2a')]['filter']+'%'};return _0x30292b;}})});}_0x493872=_[_0x7e09('0x39')]({},_0x493872,_0x490976[_0x7e09('0x3a')]);var _0x168213={'where':_0x493872['where']};return db[_0x7e09('0x27')][_0x7e09('0x3b')](_0x168213)[_0x7e09('0x21')](function(_0x13dd25){_0x4d9cf7[_0x7e09('0x3b')]=_0x13dd25;if(_0x490976['query'][_0x7e09('0x3c')]){_0x493872[_0x7e09('0x3d')]=[{'all':!![]}];}return db[_0x7e09('0x27')][_0x7e09('0x3e')](_0x493872);})[_0x7e09('0x21')](function(_0x34a84b){_0x4d9cf7[_0x7e09('0x3f')]=_0x34a84b;return _0x4d9cf7;})[_0x7e09('0x21')](respondWithFilteredResult(_0x35249f,_0x493872))['catch'](handleError(_0x35249f,null));};exports[_0x7e09('0x40')]=function(_0x42e1c1,_0x2963b4){var _0x5806c={'raw':!![],'where':{'id':_0x42e1c1['params']['id']}},_0x1350af={};_0x1350af[_0x7e09('0x2e')]=_['keys'](db[_0x7e09('0x27')][_0x7e09('0x28')]);_0x1350af['query']=_[_0x7e09('0x2b')](_0x42e1c1[_0x7e09('0x2a')]);_0x1350af[_0x7e09('0x2c')]=_[_0x7e09('0x2d')](_0x1350af['model'],_0x1350af['query']);_0x5806c[_0x7e09('0x2f')]=_['intersection'](_0x1350af[_0x7e09('0x2e')],qs[_0x7e09('0x30')](_0x42e1c1[_0x7e09('0x2a')]['fields']));_0x5806c['attributes']=_0x5806c[_0x7e09('0x2f')]['length']?_0x5806c[_0x7e09('0x2f')]:_0x1350af['model'];if(_0x42e1c1[_0x7e09('0x2a')]['includeAll']){_0x5806c['include']=[{'all':!![]}];}_0x5806c=_[_0x7e09('0x39')]({},_0x5806c,_0x42e1c1[_0x7e09('0x3a')]);return db['MailTransferReport'][_0x7e09('0x41')](_0x5806c)[_0x7e09('0x21')](handleEntityNotFound(_0x2963b4,null))[_0x7e09('0x21')](respondWithResult(_0x2963b4,null))[_0x7e09('0x42')](handleError(_0x2963b4,null));};exports[_0x7e09('0x43')]=function(_0x5a1417,_0x849c84){return db[_0x7e09('0x27')][_0x7e09('0x43')](_0x5a1417['body'],{})['then'](respondWithResult(_0x849c84,0xc9))['catch'](handleError(_0x849c84,null));};exports[_0x7e09('0x20')]=function(_0x4320cd,_0x19ba90){if(_0x4320cd[_0x7e09('0x44')]['id']){delete _0x4320cd[_0x7e09('0x44')]['id'];}return db[_0x7e09('0x27')][_0x7e09('0x41')]({'where':{'id':_0x4320cd['params']['id']}})[_0x7e09('0x21')](handleEntityNotFound(_0x19ba90,null))[_0x7e09('0x21')](saveUpdates(_0x4320cd['body'],null))[_0x7e09('0x21')](respondWithResult(_0x19ba90,null))[_0x7e09('0x42')](handleError(_0x19ba90,null));};exports[_0x7e09('0x22')]=function(_0x3552a8,_0x851d51){return db[_0x7e09('0x27')][_0x7e09('0x41')]({'where':{'id':_0x3552a8['params']['id']}})[_0x7e09('0x21')](handleEntityNotFound(_0x851d51,null))['then'](removeEntity(_0x851d51,null))[_0x7e09('0x42')](handleError(_0x851d51,null));};exports[_0x7e09('0x45')]=function(_0x525ff6,_0x42bd61){return db[_0x7e09('0x27')][_0x7e09('0x45')]()[_0x7e09('0x21')](respondWithResult(_0x42bd61,null))[_0x7e09('0x42')](handleError(_0x42bd61,null));}; \ No newline at end of file +var _0x337f=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','filter','merge','where','options','MailTransferReport','includeAll','findAll','rows','catch','params','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x337f,0x1ab));var _0xf337=function(_0x2ce90c,_0x319498){_0x2ce90c=_0x2ce90c-0x0;var _0x585ccd=_0x337f[_0x2ce90c];return _0x585ccd;};'use strict';var pdf=require(_0xf337('0x0'));var emlformat=require(_0xf337('0x1'));var rimraf=require(_0xf337('0x2'));var zipdir=require(_0xf337('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf337('0x4'));var moment=require(_0xf337('0x5'));var BPromise=require(_0xf337('0x6'));var Mustache=require(_0xf337('0x7'));var util=require(_0xf337('0x8'));var path=require(_0xf337('0x9'));var sox=require(_0xf337('0xa'));var csv=require(_0xf337('0xb'));var ejs=require(_0xf337('0xc'));var fs=require('fs');var _=require(_0xf337('0xd'));var squel=require(_0xf337('0xe'));var crypto=require(_0xf337('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf337('0x10'));var toCsv=require(_0xf337('0xb'));var querystring=require(_0xf337('0x11'));var Papa=require(_0xf337('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf337('0x13'));var as=require(_0xf337('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf337('0x15'))('api');var utils=require(_0xf337('0x16'));var config=require(_0xf337('0x17'));var licenseUtil=require(_0xf337('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25108e,_0xa24a17){_0xa24a17=_0xa24a17||0xcc;return function(_0x1bf171){if(_0x1bf171){return _0x25108e['sendStatus'](_0xa24a17);}return _0x25108e['status'](_0xa24a17)[_0xf337('0x19')]();};}function respondWithResult(_0x12f321,_0x2b8433){_0x2b8433=_0x2b8433||0xc8;return function(_0x20ada5){if(_0x20ada5){return _0x12f321[_0xf337('0x1a')](_0x2b8433)[_0xf337('0x1b')](_0x20ada5);}};}function respondWithFilteredResult(_0x15c8d3,_0x2be7b2){return function(_0x1cdcb6){if(_0x1cdcb6){var _0x1bf116=_0x1cdcb6[_0xf337('0x1c')],_0x9d62fe=_0x2be7b2[_0xf337('0x1d')],_0x2575cc=_0x2be7b2[_0xf337('0x1d')]+_0x2be7b2[_0xf337('0x1e')],_0x4a9ca4;if(_0x2575cc>=_0x1bf116){_0x2575cc=_0x1bf116;_0x4a9ca4=0xc8;}else{_0x4a9ca4=0xce;}_0x15c8d3[_0xf337('0x1a')](_0x4a9ca4);return _0x15c8d3[_0xf337('0x1f')](_0xf337('0x20'),_0x9d62fe+'-'+_0x2575cc+'/'+_0x1bf116)['json'](_0x1cdcb6);}return null;};}function patchUpdates(_0x24715a){return function(_0x389894){try{jsonpatch[_0xf337('0x21')](_0x389894,_0x24715a,!![]);}catch(_0x43fdce){return BPromise['reject'](_0x43fdce);}return _0x389894[_0xf337('0x22')]();};}function saveUpdates(_0x1aeb0c,_0x1c13ed){return function(_0x2b78c8){if(_0x2b78c8){return _0x2b78c8[_0xf337('0x23')](_0x1aeb0c)[_0xf337('0x24')](function(_0x113d44){return _0x113d44;});}return null;};}function removeEntity(_0x3daed1,_0x154235){return function(_0x516592){if(_0x516592){return _0x516592[_0xf337('0x25')]()[_0xf337('0x24')](function(){_0x3daed1[_0xf337('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b4575,_0x16b5fe){return function(_0x341d43){if(!_0x341d43){_0x1b4575[_0xf337('0x26')](0x194);}return _0x341d43;};}function handleError(_0x2430bb,_0x5ccf47){_0x5ccf47=_0x5ccf47||0x1f4;return function(_0x44e92e){logger[_0xf337('0x27')](_0x44e92e[_0xf337('0x28')]);if(_0x44e92e[_0xf337('0x29')]){delete _0x44e92e['name'];}_0x2430bb['status'](_0x5ccf47)[_0xf337('0x2a')](_0x44e92e);};}exports[_0xf337('0x2b')]=function(_0x313869,_0x5d9197){var _0x1747a5={},_0x2f12db={},_0x55fb32={'count':0x0,'rows':[]};var _0x1503e6=_[_0xf337('0x2c')](db['MailTransferReport'][_0xf337('0x2d')],function(_0x474e97){return{'name':_0x474e97[_0xf337('0x2e')],'type':_0x474e97[_0xf337('0x2f')][_0xf337('0x30')]};});_0x2f12db[_0xf337('0x31')]=_[_0xf337('0x2c')](_0x1503e6,'name');_0x2f12db['query']=_[_0xf337('0x32')](_0x313869[_0xf337('0x33')]);_0x2f12db[_0xf337('0x34')]=_[_0xf337('0x35')](_0x2f12db['model'],_0x2f12db[_0xf337('0x33')]);_0x1747a5[_0xf337('0x36')]=_[_0xf337('0x35')](_0x2f12db[_0xf337('0x31')],qs[_0xf337('0x37')](_0x313869[_0xf337('0x33')][_0xf337('0x37')]));_0x1747a5[_0xf337('0x36')]=_0x1747a5['attributes'][_0xf337('0x38')]?_0x1747a5['attributes']:_0x2f12db[_0xf337('0x31')];if(!_0x313869['query']['hasOwnProperty']('nolimit')){_0x1747a5[_0xf337('0x1e')]=qs[_0xf337('0x1e')](_0x313869[_0xf337('0x33')][_0xf337('0x1e')]);_0x1747a5[_0xf337('0x1d')]=qs[_0xf337('0x1d')](_0x313869[_0xf337('0x33')][_0xf337('0x1d')]);}_0x1747a5[_0xf337('0x39')]=qs[_0xf337('0x3a')](_0x313869['query'][_0xf337('0x3a')]);_0x1747a5['where']=qs['filters'](_['pick'](_0x313869[_0xf337('0x33')],_0x2f12db[_0xf337('0x34')]),_0x1503e6);if(_0x313869[_0xf337('0x33')][_0xf337('0x3b')]){_0x1747a5['where']=_[_0xf337('0x3c')](_0x1747a5[_0xf337('0x3d')],{'$or':_[_0xf337('0x2c')](_0x1503e6,function(_0x5396c7){if(_0x5396c7[_0xf337('0x2f')]!=='VIRTUAL'){var _0x22ab1a={};_0x22ab1a[_0x5396c7[_0xf337('0x29')]]={'$like':'%'+_0x313869[_0xf337('0x33')][_0xf337('0x3b')]+'%'};return _0x22ab1a;}})});}_0x1747a5=_[_0xf337('0x3c')]({},_0x1747a5,_0x313869[_0xf337('0x3e')]);var _0x194d8a={'where':_0x1747a5[_0xf337('0x3d')]};return db[_0xf337('0x3f')][_0xf337('0x1c')](_0x194d8a)['then'](function(_0x2c469a){_0x55fb32[_0xf337('0x1c')]=_0x2c469a;if(_0x313869[_0xf337('0x33')][_0xf337('0x40')]){_0x1747a5['include']=[{'all':!![]}];}return db[_0xf337('0x3f')][_0xf337('0x41')](_0x1747a5);})[_0xf337('0x24')](function(_0x839f7f){_0x55fb32[_0xf337('0x42')]=_0x839f7f;return _0x55fb32;})['then'](respondWithFilteredResult(_0x5d9197,_0x1747a5))[_0xf337('0x43')](handleError(_0x5d9197,null));};exports['show']=function(_0x299139,_0x366a10){var _0x207e30={'raw':!![],'where':{'id':_0x299139[_0xf337('0x44')]['id']}},_0x46cc77={};_0x46cc77[_0xf337('0x31')]=_[_0xf337('0x32')](db[_0xf337('0x3f')][_0xf337('0x2d')]);_0x46cc77[_0xf337('0x33')]=_['keys'](_0x299139[_0xf337('0x33')]);_0x46cc77[_0xf337('0x34')]=_[_0xf337('0x35')](_0x46cc77[_0xf337('0x31')],_0x46cc77['query']);_0x207e30[_0xf337('0x36')]=_['intersection'](_0x46cc77[_0xf337('0x31')],qs['fields'](_0x299139[_0xf337('0x33')][_0xf337('0x37')]));_0x207e30[_0xf337('0x36')]=_0x207e30[_0xf337('0x36')]['length']?_0x207e30[_0xf337('0x36')]:_0x46cc77[_0xf337('0x31')];if(_0x299139['query'][_0xf337('0x40')]){_0x207e30[_0xf337('0x45')]=[{'all':!![]}];}_0x207e30=_[_0xf337('0x3c')]({},_0x207e30,_0x299139[_0xf337('0x3e')]);return db[_0xf337('0x3f')][_0xf337('0x46')](_0x207e30)['then'](handleEntityNotFound(_0x366a10,null))[_0xf337('0x24')](respondWithResult(_0x366a10,null))[_0xf337('0x43')](handleError(_0x366a10,null));};exports[_0xf337('0x47')]=function(_0xeb4d9e,_0x2eb6d1){return db[_0xf337('0x3f')]['create'](_0xeb4d9e[_0xf337('0x48')],{})[_0xf337('0x24')](respondWithResult(_0x2eb6d1,0xc9))['catch'](handleError(_0x2eb6d1,null));};exports[_0xf337('0x23')]=function(_0x4d6bd8,_0x3ef636){if(_0x4d6bd8[_0xf337('0x48')]['id']){delete _0x4d6bd8[_0xf337('0x48')]['id'];}return db[_0xf337('0x3f')]['find']({'where':{'id':_0x4d6bd8[_0xf337('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ef636,null))[_0xf337('0x24')](saveUpdates(_0x4d6bd8['body'],null))[_0xf337('0x24')](respondWithResult(_0x3ef636,null))[_0xf337('0x43')](handleError(_0x3ef636,null));};exports[_0xf337('0x25')]=function(_0x558c93,_0x7214ab){return db[_0xf337('0x3f')]['find']({'where':{'id':_0x558c93[_0xf337('0x44')]['id']}})['then'](handleEntityNotFound(_0x7214ab,null))['then'](removeEntity(_0x7214ab,null))['catch'](handleError(_0x7214ab,null));};exports['describe']=function(_0x471aeb,_0x34f3fe){return db[_0xf337('0x3f')][_0xf337('0x49')]()[_0xf337('0x24')](respondWithResult(_0x34f3fe,null))[_0xf337('0x43')](handleError(_0x34f3fe,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 327d161..0dda957 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 _0xff27=['path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','api','moment','bluebird','request-promise'];(function(_0x49c3ef,_0x3009a9){var _0x3a0ff5=function(_0x14d8a1){while(--_0x14d8a1){_0x49c3ef['push'](_0x49c3ef['shift']());}};_0x3a0ff5(++_0x3009a9);}(_0xff27,0x133));var _0x7ff2=function(_0x43b5a7,_0xf5e3d6){_0x43b5a7=_0x43b5a7-0x0;var _0x5461fe=_0xff27[_0x43b5a7];return _0x5461fe;};'use strict';var _=require(_0x7ff2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7ff2('0x1'));var moment=require(_0x7ff2('0x2'));var BPromise=require(_0x7ff2('0x3'));var rp=require(_0x7ff2('0x4'));var fs=require('fs');var path=require(_0x7ff2('0x5'));var rimraf=require(_0x7ff2('0x6'));var config=require(_0x7ff2('0x7'));var attributes=require(_0x7ff2('0x8'));module[_0x7ff2('0x9')]=function(_0xf6bac8,_0xd3cd64){return _0xf6bac8[_0x7ff2('0xa')]('MailTransferReport',attributes,{'tableName':_0x7ff2('0xb'),'paranoid':![],'indexes':[{'name':_0x7ff2('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcbd3=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','path','rimraf','./mailTransferReport.attributes'];(function(_0x49299f,_0xd068ee){var _0x45696b=function(_0x4b997a){while(--_0x4b997a){_0x49299f['push'](_0x49299f['shift']());}};_0x45696b(++_0xd068ee);}(_0xcbd3,0x1d9));var _0x3cbd=function(_0xc8157f,_0x1b8b1a){_0xc8157f=_0xc8157f-0x0;var _0xe91bac=_0xcbd3[_0xc8157f];return _0xe91bac;};'use strict';var _=require('lodash');var util=require(_0x3cbd('0x0'));var logger=require(_0x3cbd('0x1'))(_0x3cbd('0x2'));var moment=require(_0x3cbd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cbd('0x4'));var rimraf=require(_0x3cbd('0x5'));var config=require('../../config/environment');var attributes=require(_0x3cbd('0x6'));module[_0x3cbd('0x7')]=function(_0x6224ec,_0x1a77d7){return _0x6224ec[_0x3cbd('0x8')](_0x3cbd('0x9'),attributes,{'tableName':_0x3cbd('0xa'),'paranoid':![],'indexes':[{'name':_0x3cbd('0xb'),'fields':[_0x3cbd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index aba43ff..15c2d43 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 _0x7a84=['http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x196f40,_0x417e6e){var _0x544d7b=function(_0x46c19c){while(--_0x46c19c){_0x196f40['push'](_0x196f40['shift']());}};_0x544d7b(++_0x417e6e);}(_0x7a84,0x1c4));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('moment');var BPromise=require(_0x47a8('0x1'));var rs=require(_0x47a8('0x2'));var fs=require('fs');var Redis=require(_0x47a8('0x3'));var db=require(_0x47a8('0x4'))['db'];var utils=require(_0x47a8('0x5'));var logger=require('../../config/logger')(_0x47a8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x47a8('0x7')][_0x47a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7e21ff,_0x3c3618,_0x330bcf){return new BPromise(function(_0x329c9b,_0x579ae7){return client['request'](_0x7e21ff,_0x330bcf)[_0x47a8('0x9')](function(_0xb4510e){logger[_0x47a8('0xa')](_0x47a8('0xb'),_0x3c3618,_0x47a8('0xc'));logger[_0x47a8('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x3c3618,'request\x20sent',JSON[_0x47a8('0xe')](_0xb4510e));if(_0xb4510e[_0x47a8('0xf')]){if(_0xb4510e['error'][_0x47a8('0x10')]===0x1f4){logger[_0x47a8('0xf')](_0x47a8('0xb'),_0x3c3618,_0xb4510e['error'][_0x47a8('0x11')]);return _0x579ae7(_0xb4510e[_0x47a8('0xf')][_0x47a8('0x11')]);}logger[_0x47a8('0xf')](_0x47a8('0xb'),_0x3c3618,_0xb4510e[_0x47a8('0xf')][_0x47a8('0x11')]);return _0x329c9b(_0xb4510e[_0x47a8('0xf')][_0x47a8('0x11')]);}else{logger[_0x47a8('0xa')](_0x47a8('0xb'),_0x3c3618,_0x47a8('0xc'));_0x329c9b(_0xb4510e[_0x47a8('0x12')][_0x47a8('0x11')]);}})[_0x47a8('0x13')](function(_0x4d3442){logger[_0x47a8('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x3c3618,_0x4d3442);_0x579ae7(_0x4d3442);});});} \ No newline at end of file +var _0xf930=['request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MailTransferReport,\x20%s,\x20%s'];(function(_0x458a5e,_0x1d3287){var _0x55bb46=function(_0x3c47f2){while(--_0x3c47f2){_0x458a5e['push'](_0x458a5e['shift']());}};_0x55bb46(++_0x1d3287);}(_0xf930,0x189));var _0x0f93=function(_0x5169f5,_0x5065e7){_0x5169f5=_0x5169f5-0x0;var _0x330776=_0xf930[_0x5169f5];return _0x330776;};'use strict';var _=require(_0x0f93('0x0'));var util=require(_0x0f93('0x1'));var moment=require(_0x0f93('0x2'));var BPromise=require(_0x0f93('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f93('0x4'));var db=require(_0x0f93('0x5'))['db'];var utils=require(_0x0f93('0x6'));var logger=require(_0x0f93('0x7'))(_0x0f93('0x8'));var config=require(_0x0f93('0x9'));var jayson=require(_0x0f93('0xa'));var client=jayson['client'][_0x0f93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a8fc1,_0x58b45c,_0x30c9d7){return new BPromise(function(_0x4808f3,_0x23c67c){return client[_0x0f93('0xc')](_0x3a8fc1,_0x30c9d7)[_0x0f93('0xd')](function(_0x289565){logger['info'](_0x0f93('0xe'),_0x58b45c,_0x0f93('0xf'));logger[_0x0f93('0x10')](_0x0f93('0x11'),_0x58b45c,'request\x20sent',JSON[_0x0f93('0x12')](_0x289565));if(_0x289565[_0x0f93('0x13')]){if(_0x289565[_0x0f93('0x13')][_0x0f93('0x14')]===0x1f4){logger[_0x0f93('0x13')](_0x0f93('0xe'),_0x58b45c,_0x289565['error']['message']);return _0x23c67c(_0x289565[_0x0f93('0x13')][_0x0f93('0x15')]);}logger[_0x0f93('0x13')](_0x0f93('0xe'),_0x58b45c,_0x289565['error'][_0x0f93('0x15')]);return _0x4808f3(_0x289565[_0x0f93('0x13')]['message']);}else{logger[_0x0f93('0x16')](_0x0f93('0xe'),_0x58b45c,'request\x20sent');_0x4808f3(_0x289565['result'][_0x0f93('0x15')]);}})[_0x0f93('0x17')](function(_0x3ba30d){logger[_0x0f93('0x13')](_0x0f93('0xe'),_0x58b45c,_0x3ba30d);_0x23c67c(_0x3ba30d);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f388f77..e456bd6 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 _0x8353=['isAuthenticated','index','/describe','describe','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./memberReport.controller','get'];(function(_0x1c5932,_0x24b5b3){var _0x1194b4=function(_0xb75d47){while(--_0xb75d47){_0x1c5932['push'](_0x1c5932['shift']());}};_0x1194b4(++_0x24b5b3);}(_0x8353,0xe0));var _0x3835=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x8353[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require(_0x3835('0x0'));var util=require(_0x3835('0x1'));var path=require(_0x3835('0x2'));var timeout=require(_0x3835('0x3'));var express=require(_0x3835('0x4'));var router=express[_0x3835('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3835('0x6'));var config=require(_0x3835('0x7'));var controller=require(_0x3835('0x8'));router[_0x3835('0x9')]('/',auth[_0x3835('0xa')](),controller[_0x3835('0xb')]);router[_0x3835('0x9')](_0x3835('0xc'),auth[_0x3835('0xa')](),controller[_0x3835('0xd')]);router[_0x3835('0x9')](_0x3835('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3835('0xf')]);router[_0x3835('0x10')](_0x3835('0xe'),auth['isAuthenticated'](),controller[_0x3835('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5a83=['create','put','/:id','update','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','index','/describe','describe','get','isAuthenticated','show','post'];(function(_0x312ff8,_0x5d7167){var _0x4e144b=function(_0x8c0bd5){while(--_0x8c0bd5){_0x312ff8['push'](_0x312ff8['shift']());}};_0x4e144b(++_0x5d7167);}(_0x5a83,0x6a));var _0x35a8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5a83[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x35a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x35a8('0x1'));var express=require(_0x35a8('0x2'));var router=express['Router']();var auth=require(_0x35a8('0x3'));var interaction=require(_0x35a8('0x4'));var config=require(_0x35a8('0x5'));var controller=require(_0x35a8('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x35a8('0x7')]);router['get'](_0x35a8('0x8'),auth['isAuthenticated'](),controller[_0x35a8('0x9')]);router[_0x35a8('0xa')]('/:id',auth[_0x35a8('0xb')](),controller[_0x35a8('0xc')]);router[_0x35a8('0xd')]('/',auth[_0x35a8('0xb')](),controller[_0x35a8('0xe')]);router[_0x35a8('0xf')](_0x35a8('0x10'),auth[_0x35a8('0xb')](),controller[_0x35a8('0x11')]);router['delete'](_0x35a8('0x10'),auth[_0x35a8('0xb')](),controller[_0x35a8('0x12')]);module[_0x35a8('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 71ab56c..8fe1e8d 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 _0x2da8=['INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x2da8,0x9b));var _0x82da=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2da8[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x82da('0x0'));var moment=require('moment');module[_0x82da('0x1')]={'channel':{'type':Sequelize[_0x82da('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x82da('0x2')],'defaultValue':_0x82da('0x3'),'comment':_0x82da('0x4')},'duration':{'type':Sequelize[_0x82da('0x5')]},'enterAt':{'type':Sequelize[_0x82da('0x6')]},'exitAt':{'type':Sequelize[_0x82da('0x6')],'set':function(_0x16d3b3){var _0x332ea1=moment(_0x16d3b3);var _0x46b085=moment(this['getDataValue'](_0x82da('0x7')));var _0x4c7b33=_0x332ea1[_0x82da('0x8')](_0x46b085,_0x82da('0x9'));this[_0x82da('0xa')](_0x82da('0xb'),_0x16d3b3);this[_0x82da('0xa')]('duration',_0x4c7b33||null);}},'data1':{'type':Sequelize[_0x82da('0x2')],'comment':_0x82da('0xc')},'data2':{'type':Sequelize[_0x82da('0x2')],'comment':_0x82da('0xd')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x82da('0x2')],'comment':_0x82da('0xe')},'data5':{'type':Sequelize[_0x82da('0x2')],'comment':_0x82da('0xf')},'role':{'type':Sequelize[_0x82da('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x82da('0x2')]}}; \ No newline at end of file +var _0xfe3d=['moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]'];(function(_0x43026b,_0x928d8c){var _0x4a96cd=function(_0x362cbd){while(--_0x362cbd){_0x43026b['push'](_0x43026b['shift']());}};_0x4a96cd(++_0x928d8c);}(_0xfe3d,0x104));var _0xdfe3=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xfe3d[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdfe3('0x0'));module['exports']={'channel':{'type':Sequelize[_0xdfe3('0x1')]},'membername':{'type':Sequelize[_0xdfe3('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0xdfe3('0x2'),'comment':_0xdfe3('0x3')},'duration':{'type':Sequelize[_0xdfe3('0x4')]},'enterAt':{'type':Sequelize[_0xdfe3('0x5')]},'exitAt':{'type':Sequelize[_0xdfe3('0x5')],'set':function(_0x360f05){var _0x505585=moment(_0x360f05);var _0x25aa6d=moment(this['getDataValue'](_0xdfe3('0x6')));var _0x2aef32=_0x505585[_0xdfe3('0x7')](_0x25aa6d,_0xdfe3('0x8'));this[_0xdfe3('0x9')]('exitAt',_0x360f05);this['setDataValue'](_0xdfe3('0xa'),_0x2aef32||null);}},'data1':{'type':Sequelize[_0xdfe3('0x1')],'comment':_0xdfe3('0xb')},'data2':{'type':Sequelize[_0xdfe3('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xdfe3('0x1')],'comment':_0xdfe3('0xc')},'data4':{'type':Sequelize[_0xdfe3('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xdfe3('0x1')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 08dafc7..8163eae 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 _0x6c99=['findAll','rows','catch','show','params','find','create','body','update','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','to-csv','squel','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','name','send','index','MemberReport','rawAttributes','fieldName','type','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x6c99,0x136));var _0x96c9=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x6c99[_0x435044];return _0x33d4c6;};'use strict';var pdf=require(_0x96c9('0x0'));var emlformat=require(_0x96c9('0x1'));var rimraf=require(_0x96c9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x96c9('0x3'));var moment=require('moment');var BPromise=require(_0x96c9('0x4'));var Mustache=require(_0x96c9('0x5'));var util=require(_0x96c9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x96c9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x96c9('0x8'));var crypto=require('crypto');var jsforce=require(_0x96c9('0x9'));var deskjs=require(_0x96c9('0xa'));var toCsv=require(_0x96c9('0x7'));var querystring=require('querystring');var Papa=require(_0x96c9('0xb'));var Redis=require(_0x96c9('0xc'));var authService=require(_0x96c9('0xd'));var qs=require(_0x96c9('0xe'));var as=require(_0x96c9('0xf'));var hardwareService=require(_0x96c9('0x10'));var logger=require(_0x96c9('0x11'))(_0x96c9('0x12'));var utils=require(_0x96c9('0x13'));var config=require(_0x96c9('0x14'));var licenseUtil=require(_0x96c9('0x15'));var db=require(_0x96c9('0x16'))['db'];function respondWithStatusCode(_0x344c79,_0x404829){_0x404829=_0x404829||0xcc;return function(_0x2ea7d7){if(_0x2ea7d7){return _0x344c79[_0x96c9('0x17')](_0x404829);}return _0x344c79[_0x96c9('0x18')](_0x404829)[_0x96c9('0x19')]();};}function respondWithResult(_0x20856d,_0x56f2d3){_0x56f2d3=_0x56f2d3||0xc8;return function(_0x2276a0){if(_0x2276a0){return _0x20856d['status'](_0x56f2d3)[_0x96c9('0x1a')](_0x2276a0);}};}function respondWithFilteredResult(_0x53e419,_0x28f658){return function(_0x4c5d2b){if(_0x4c5d2b){var _0x4c18a5=_0x4c5d2b[_0x96c9('0x1b')],_0x1d64be=_0x28f658[_0x96c9('0x1c')],_0x371277=_0x28f658['offset']+_0x28f658[_0x96c9('0x1d')],_0x196824;if(_0x371277>=_0x4c18a5){_0x371277=_0x4c18a5;_0x196824=0xc8;}else{_0x196824=0xce;}_0x53e419[_0x96c9('0x18')](_0x196824);return _0x53e419[_0x96c9('0x1e')](_0x96c9('0x1f'),_0x1d64be+'-'+_0x371277+'/'+_0x4c18a5)[_0x96c9('0x1a')](_0x4c5d2b);}return null;};}function patchUpdates(_0x4752e7){return function(_0xbb0a9){try{jsonpatch[_0x96c9('0x20')](_0xbb0a9,_0x4752e7,!![]);}catch(_0x126b0a){return BPromise['reject'](_0x126b0a);}return _0xbb0a9[_0x96c9('0x21')]();};}function saveUpdates(_0x4fba55,_0x327a73){return function(_0x3aa2e3){if(_0x3aa2e3){return _0x3aa2e3['update'](_0x4fba55)[_0x96c9('0x22')](function(_0x273dd1){return _0x273dd1;});}return null;};}function removeEntity(_0x1da825,_0x2ec012){return function(_0x48dead){if(_0x48dead){return _0x48dead[_0x96c9('0x23')]()[_0x96c9('0x22')](function(){_0x1da825['status'](0xcc)[_0x96c9('0x19')]();});}};}function handleEntityNotFound(_0x18241f,_0x3b4bdf){return function(_0x221ff7){if(!_0x221ff7){_0x18241f[_0x96c9('0x17')](0x194);}return _0x221ff7;};}function handleError(_0x4ebd13,_0x56c058){_0x56c058=_0x56c058||0x1f4;return function(_0x50547c){logger[_0x96c9('0x24')](_0x50547c['stack']);if(_0x50547c[_0x96c9('0x25')]){delete _0x50547c['name'];}_0x4ebd13['status'](_0x56c058)[_0x96c9('0x26')](_0x50547c);};}exports[_0x96c9('0x27')]=function(_0x458014,_0x1c264f){var _0x40a855={},_0x36d644={},_0x31ea72={'count':0x0,'rows':[]};var _0x289393=_['map'](db[_0x96c9('0x28')][_0x96c9('0x29')],function(_0x497642){return{'name':_0x497642[_0x96c9('0x2a')],'type':_0x497642[_0x96c9('0x2b')]['key']};});_0x36d644[_0x96c9('0x2c')]=_[_0x96c9('0x2d')](_0x289393,_0x96c9('0x25'));_0x36d644[_0x96c9('0x2e')]=_[_0x96c9('0x2f')](_0x458014[_0x96c9('0x2e')]);_0x36d644['filters']=_['intersection'](_0x36d644['model'],_0x36d644[_0x96c9('0x2e')]);_0x40a855[_0x96c9('0x30')]=_[_0x96c9('0x31')](_0x36d644[_0x96c9('0x2c')],qs[_0x96c9('0x32')](_0x458014[_0x96c9('0x2e')]['fields']));_0x40a855['attributes']=_0x40a855[_0x96c9('0x30')][_0x96c9('0x33')]?_0x40a855['attributes']:_0x36d644[_0x96c9('0x2c')];if(!_0x458014['query'][_0x96c9('0x34')](_0x96c9('0x35'))){_0x40a855[_0x96c9('0x1d')]=qs[_0x96c9('0x1d')](_0x458014[_0x96c9('0x2e')][_0x96c9('0x1d')]);_0x40a855['offset']=qs[_0x96c9('0x1c')](_0x458014['query'][_0x96c9('0x1c')]);}_0x40a855[_0x96c9('0x36')]=qs['sort'](_0x458014['query'][_0x96c9('0x37')]);_0x40a855['where']=qs[_0x96c9('0x38')](_[_0x96c9('0x39')](_0x458014[_0x96c9('0x2e')],_0x36d644['filters']),_0x289393);if(_0x458014[_0x96c9('0x2e')][_0x96c9('0x3a')]){_0x40a855[_0x96c9('0x3b')]=_[_0x96c9('0x3c')](_0x40a855[_0x96c9('0x3b')],{'$or':_[_0x96c9('0x2d')](_0x289393,function(_0x397d6e){if(_0x397d6e['type']!==_0x96c9('0x3d')){var _0x4788d8={};_0x4788d8[_0x397d6e[_0x96c9('0x25')]]={'$like':'%'+_0x458014['query'][_0x96c9('0x3a')]+'%'};return _0x4788d8;}})});}_0x40a855=_[_0x96c9('0x3c')]({},_0x40a855,_0x458014[_0x96c9('0x3e')]);var _0x282b4b={'where':_0x40a855[_0x96c9('0x3b')]};return db[_0x96c9('0x28')]['count'](_0x282b4b)['then'](function(_0x44bf10){_0x31ea72[_0x96c9('0x1b')]=_0x44bf10;if(_0x458014[_0x96c9('0x2e')][_0x96c9('0x3f')]){_0x40a855[_0x96c9('0x40')]=[{'all':!![]}];}return db[_0x96c9('0x28')][_0x96c9('0x41')](_0x40a855);})[_0x96c9('0x22')](function(_0x171677){_0x31ea72[_0x96c9('0x42')]=_0x171677;return _0x31ea72;})['then'](respondWithFilteredResult(_0x1c264f,_0x40a855))[_0x96c9('0x43')](handleError(_0x1c264f,null));};exports[_0x96c9('0x44')]=function(_0x2cbc9b,_0x459d32){var _0x96dbf9={'raw':!![],'where':{'id':_0x2cbc9b[_0x96c9('0x45')]['id']}},_0x58b57d={};_0x58b57d['model']=_[_0x96c9('0x2f')](db[_0x96c9('0x28')][_0x96c9('0x29')]);_0x58b57d[_0x96c9('0x2e')]=_[_0x96c9('0x2f')](_0x2cbc9b[_0x96c9('0x2e')]);_0x58b57d['filters']=_[_0x96c9('0x31')](_0x58b57d[_0x96c9('0x2c')],_0x58b57d['query']);_0x96dbf9[_0x96c9('0x30')]=_[_0x96c9('0x31')](_0x58b57d[_0x96c9('0x2c')],qs[_0x96c9('0x32')](_0x2cbc9b['query'][_0x96c9('0x32')]));_0x96dbf9[_0x96c9('0x30')]=_0x96dbf9[_0x96c9('0x30')]['length']?_0x96dbf9[_0x96c9('0x30')]:_0x58b57d[_0x96c9('0x2c')];if(_0x2cbc9b[_0x96c9('0x2e')]['includeAll']){_0x96dbf9[_0x96c9('0x40')]=[{'all':!![]}];}_0x96dbf9=_['merge']({},_0x96dbf9,_0x2cbc9b[_0x96c9('0x3e')]);return db[_0x96c9('0x28')][_0x96c9('0x46')](_0x96dbf9)[_0x96c9('0x22')](handleEntityNotFound(_0x459d32,null))[_0x96c9('0x22')](respondWithResult(_0x459d32,null))[_0x96c9('0x43')](handleError(_0x459d32,null));};exports[_0x96c9('0x47')]=function(_0x1243d0,_0x279bc6){return db[_0x96c9('0x28')][_0x96c9('0x47')](_0x1243d0[_0x96c9('0x48')],{})['then'](respondWithResult(_0x279bc6,0xc9))[_0x96c9('0x43')](handleError(_0x279bc6,null));};exports[_0x96c9('0x49')]=function(_0x3df8ca,_0x453ada){if(_0x3df8ca[_0x96c9('0x48')]['id']){delete _0x3df8ca['body']['id'];}return db[_0x96c9('0x28')]['find']({'where':{'id':_0x3df8ca[_0x96c9('0x45')]['id']}})[_0x96c9('0x22')](handleEntityNotFound(_0x453ada,null))[_0x96c9('0x22')](saveUpdates(_0x3df8ca['body'],null))[_0x96c9('0x22')](respondWithResult(_0x453ada,null))[_0x96c9('0x43')](handleError(_0x453ada,null));};exports[_0x96c9('0x23')]=function(_0x254d12,_0x3770fb){return db['MemberReport'][_0x96c9('0x46')]({'where':{'id':_0x254d12[_0x96c9('0x45')]['id']}})['then'](handleEntityNotFound(_0x3770fb,null))['then'](removeEntity(_0x3770fb,null))[_0x96c9('0x43')](handleError(_0x3770fb,null));};exports[_0x96c9('0x4a')]=function(_0x5e3258,_0x1a95c9){return db[_0x96c9('0x28')][_0x96c9('0x4a')]()['then'](respondWithResult(_0x1a95c9,null))[_0x96c9('0x43')](handleError(_0x1a95c9,null));}; \ No newline at end of file +var _0xb945=['moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','html-pdf','rimraf','zip-dir','request-promise'];(function(_0xc69f39,_0x2ce0cf){var _0x93be41=function(_0xd66056){while(--_0xd66056){_0xc69f39['push'](_0xc69f39['shift']());}};_0x93be41(++_0x2ce0cf);}(_0xb945,0x120));var _0x5b94=function(_0x5ad3b0,_0x15bdad){_0x5ad3b0=_0x5ad3b0-0x0;var _0x3a01f9=_0xb945[_0x5ad3b0];return _0x3a01f9;};'use strict';var pdf=require(_0x5b94('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5b94('0x1'));var zipdir=require(_0x5b94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b94('0x3'));var moment=require(_0x5b94('0x4'));var BPromise=require(_0x5b94('0x5'));var Mustache=require(_0x5b94('0x6'));var util=require(_0x5b94('0x7'));var path=require(_0x5b94('0x8'));var sox=require('sox');var csv=require(_0x5b94('0x9'));var ejs=require(_0x5b94('0xa'));var fs=require('fs');var _=require(_0x5b94('0xb'));var squel=require(_0x5b94('0xc'));var crypto=require(_0x5b94('0xd'));var jsforce=require(_0x5b94('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5b94('0x9'));var querystring=require(_0x5b94('0xf'));var Papa=require(_0x5b94('0x10'));var Redis=require(_0x5b94('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b94('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b94('0x13'));var logger=require(_0x5b94('0x14'))(_0x5b94('0x15'));var utils=require(_0x5b94('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5b94('0x17'));var db=require(_0x5b94('0x18'))['db'];function respondWithStatusCode(_0x3e0dde,_0x3263f6){_0x3263f6=_0x3263f6||0xcc;return function(_0x15b021){if(_0x15b021){return _0x3e0dde[_0x5b94('0x19')](_0x3263f6);}return _0x3e0dde['status'](_0x3263f6)[_0x5b94('0x1a')]();};}function respondWithResult(_0x3867a5,_0x170872){_0x170872=_0x170872||0xc8;return function(_0x4bcb9a){if(_0x4bcb9a){return _0x3867a5[_0x5b94('0x1b')](_0x170872)[_0x5b94('0x1c')](_0x4bcb9a);}};}function respondWithFilteredResult(_0x39c47b,_0x387d16){return function(_0x1f8589){if(_0x1f8589){var _0x4efecf=_0x1f8589['count'],_0x46bfaa=_0x387d16[_0x5b94('0x1d')],_0x126f6e=_0x387d16['offset']+_0x387d16[_0x5b94('0x1e')],_0x5912de;if(_0x126f6e>=_0x4efecf){_0x126f6e=_0x4efecf;_0x5912de=0xc8;}else{_0x5912de=0xce;}_0x39c47b['status'](_0x5912de);return _0x39c47b[_0x5b94('0x1f')](_0x5b94('0x20'),_0x46bfaa+'-'+_0x126f6e+'/'+_0x4efecf)['json'](_0x1f8589);}return null;};}function patchUpdates(_0x3c9f41){return function(_0x2f8c5d){try{jsonpatch[_0x5b94('0x21')](_0x2f8c5d,_0x3c9f41,!![]);}catch(_0x3c0f9d){return BPromise['reject'](_0x3c0f9d);}return _0x2f8c5d['save']();};}function saveUpdates(_0x2f1d9d,_0x543596){return function(_0x1a8418){if(_0x1a8418){return _0x1a8418[_0x5b94('0x22')](_0x2f1d9d)[_0x5b94('0x23')](function(_0x4d5fd6){return _0x4d5fd6;});}return null;};}function removeEntity(_0x76fe62,_0x3af95f){return function(_0x477a86){if(_0x477a86){return _0x477a86[_0x5b94('0x24')]()['then'](function(){_0x76fe62[_0x5b94('0x1b')](0xcc)[_0x5b94('0x1a')]();});}};}function handleEntityNotFound(_0x54cf72,_0x1c273b){return function(_0x986720){if(!_0x986720){_0x54cf72[_0x5b94('0x19')](0x194);}return _0x986720;};}function handleError(_0x23a553,_0x68353f){_0x68353f=_0x68353f||0x1f4;return function(_0x1567d3){logger[_0x5b94('0x25')](_0x1567d3[_0x5b94('0x26')]);if(_0x1567d3[_0x5b94('0x27')]){delete _0x1567d3[_0x5b94('0x27')];}_0x23a553[_0x5b94('0x1b')](_0x68353f)['send'](_0x1567d3);};}exports['index']=function(_0xb8d786,_0x42b406){var _0x15e4b5={},_0x3eeaff={},_0x3b571d={'count':0x0,'rows':[]};var _0x301e6d=_[_0x5b94('0x28')](db[_0x5b94('0x29')][_0x5b94('0x2a')],function(_0x576712){return{'name':_0x576712[_0x5b94('0x2b')],'type':_0x576712[_0x5b94('0x2c')][_0x5b94('0x2d')]};});_0x3eeaff[_0x5b94('0x2e')]=_[_0x5b94('0x28')](_0x301e6d,_0x5b94('0x27'));_0x3eeaff[_0x5b94('0x2f')]=_['keys'](_0xb8d786['query']);_0x3eeaff[_0x5b94('0x30')]=_[_0x5b94('0x31')](_0x3eeaff[_0x5b94('0x2e')],_0x3eeaff[_0x5b94('0x2f')]);_0x15e4b5[_0x5b94('0x32')]=_['intersection'](_0x3eeaff[_0x5b94('0x2e')],qs[_0x5b94('0x33')](_0xb8d786[_0x5b94('0x2f')][_0x5b94('0x33')]));_0x15e4b5[_0x5b94('0x32')]=_0x15e4b5[_0x5b94('0x32')][_0x5b94('0x34')]?_0x15e4b5['attributes']:_0x3eeaff['model'];if(!_0xb8d786[_0x5b94('0x2f')]['hasOwnProperty'](_0x5b94('0x35'))){_0x15e4b5[_0x5b94('0x1e')]=qs[_0x5b94('0x1e')](_0xb8d786['query'][_0x5b94('0x1e')]);_0x15e4b5[_0x5b94('0x1d')]=qs['offset'](_0xb8d786[_0x5b94('0x2f')][_0x5b94('0x1d')]);}_0x15e4b5[_0x5b94('0x36')]=qs[_0x5b94('0x37')](_0xb8d786['query'][_0x5b94('0x37')]);_0x15e4b5[_0x5b94('0x38')]=qs[_0x5b94('0x30')](_['pick'](_0xb8d786[_0x5b94('0x2f')],_0x3eeaff['filters']),_0x301e6d);if(_0xb8d786[_0x5b94('0x2f')][_0x5b94('0x39')]){_0x15e4b5[_0x5b94('0x38')]=_[_0x5b94('0x3a')](_0x15e4b5[_0x5b94('0x38')],{'$or':_[_0x5b94('0x28')](_0x301e6d,function(_0x15fe37){if(_0x15fe37['type']!==_0x5b94('0x3b')){var _0x55138d={};_0x55138d[_0x15fe37[_0x5b94('0x27')]]={'$like':'%'+_0xb8d786[_0x5b94('0x2f')][_0x5b94('0x39')]+'%'};return _0x55138d;}})});}_0x15e4b5=_[_0x5b94('0x3a')]({},_0x15e4b5,_0xb8d786[_0x5b94('0x3c')]);var _0x3f4501={'where':_0x15e4b5['where']};return db['MemberReport'][_0x5b94('0x3d')](_0x3f4501)[_0x5b94('0x23')](function(_0x314b61){_0x3b571d[_0x5b94('0x3d')]=_0x314b61;if(_0xb8d786[_0x5b94('0x2f')][_0x5b94('0x3e')]){_0x15e4b5[_0x5b94('0x3f')]=[{'all':!![]}];}return db[_0x5b94('0x29')][_0x5b94('0x40')](_0x15e4b5);})['then'](function(_0xd40c18){_0x3b571d['rows']=_0xd40c18;return _0x3b571d;})[_0x5b94('0x23')](respondWithFilteredResult(_0x42b406,_0x15e4b5))[_0x5b94('0x41')](handleError(_0x42b406,null));};exports[_0x5b94('0x42')]=function(_0x1fd1d0,_0x161d18){var _0x364f65={'raw':!![],'where':{'id':_0x1fd1d0[_0x5b94('0x43')]['id']}},_0x5c0c97={};_0x5c0c97[_0x5b94('0x2e')]=_[_0x5b94('0x44')](db[_0x5b94('0x29')]['rawAttributes']);_0x5c0c97['query']=_[_0x5b94('0x44')](_0x1fd1d0[_0x5b94('0x2f')]);_0x5c0c97[_0x5b94('0x30')]=_['intersection'](_0x5c0c97[_0x5b94('0x2e')],_0x5c0c97['query']);_0x364f65['attributes']=_['intersection'](_0x5c0c97[_0x5b94('0x2e')],qs[_0x5b94('0x33')](_0x1fd1d0[_0x5b94('0x2f')][_0x5b94('0x33')]));_0x364f65[_0x5b94('0x32')]=_0x364f65[_0x5b94('0x32')][_0x5b94('0x34')]?_0x364f65[_0x5b94('0x32')]:_0x5c0c97[_0x5b94('0x2e')];if(_0x1fd1d0[_0x5b94('0x2f')][_0x5b94('0x3e')]){_0x364f65[_0x5b94('0x3f')]=[{'all':!![]}];}_0x364f65=_[_0x5b94('0x3a')]({},_0x364f65,_0x1fd1d0[_0x5b94('0x3c')]);return db[_0x5b94('0x29')][_0x5b94('0x45')](_0x364f65)[_0x5b94('0x23')](handleEntityNotFound(_0x161d18,null))[_0x5b94('0x23')](respondWithResult(_0x161d18,null))[_0x5b94('0x41')](handleError(_0x161d18,null));};exports[_0x5b94('0x46')]=function(_0x3d652f,_0x3e8c42){return db['MemberReport']['create'](_0x3d652f[_0x5b94('0x47')],{})[_0x5b94('0x23')](respondWithResult(_0x3e8c42,0xc9))[_0x5b94('0x41')](handleError(_0x3e8c42,null));};exports[_0x5b94('0x22')]=function(_0x4e913e,_0x191263){if(_0x4e913e[_0x5b94('0x47')]['id']){delete _0x4e913e[_0x5b94('0x47')]['id'];}return db[_0x5b94('0x29')][_0x5b94('0x45')]({'where':{'id':_0x4e913e[_0x5b94('0x43')]['id']}})[_0x5b94('0x23')](handleEntityNotFound(_0x191263,null))[_0x5b94('0x23')](saveUpdates(_0x4e913e[_0x5b94('0x47')],null))['then'](respondWithResult(_0x191263,null))[_0x5b94('0x41')](handleError(_0x191263,null));};exports['destroy']=function(_0x494ad1,_0x46adc3){return db[_0x5b94('0x29')][_0x5b94('0x45')]({'where':{'id':_0x494ad1[_0x5b94('0x43')]['id']}})['then'](handleEntityNotFound(_0x46adc3,null))[_0x5b94('0x23')](removeEntity(_0x46adc3,null))['catch'](handleError(_0x46adc3,null));};exports[_0x5b94('0x48')]=function(_0x4f84fd,_0x2729c7){return db[_0x5b94('0x29')][_0x5b94('0x48')]()[_0x5b94('0x23')](respondWithResult(_0x2729c7,null))[_0x5b94('0x41')](handleError(_0x2729c7,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d3955ef..8129a87 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 _0x2e64=['api','moment','bluebird','request-promise','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util'];(function(_0x329fa9,_0x2e0953){var _0xc612d7=function(_0x509ffa){while(--_0x509ffa){_0x329fa9['push'](_0x329fa9['shift']());}};_0xc612d7(++_0x2e0953);}(_0x2e64,0x1c0));var _0x42e6=function(_0x17dbf8,_0x2a1239){_0x17dbf8=_0x17dbf8-0x0;var _0x16b824=_0x2e64[_0x17dbf8];return _0x16b824;};'use strict';var _=require(_0x42e6('0x0'));var util=require(_0x42e6('0x1'));var logger=require('../../config/logger')(_0x42e6('0x2'));var moment=require(_0x42e6('0x3'));var BPromise=require(_0x42e6('0x4'));var rp=require(_0x42e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x42e6('0x6'));var attributes=require(_0x42e6('0x7'));module[_0x42e6('0x8')]=function(_0x222afe,_0x58bc6d){return _0x222afe[_0x42e6('0x9')](_0x42e6('0xa'),attributes,{'tableName':_0x42e6('0xb'),'paranoid':![],'indexes':[{'name':_0x42e6('0xc'),'fields':[_0x42e6('0xd'),_0x42e6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38ed=['exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','api','bluebird','../../config/environment','./memberReport.attributes'];(function(_0x4f2320,_0x48f7c1){var _0x5d1b00=function(_0x55c68e){while(--_0x55c68e){_0x4f2320['push'](_0x4f2320['shift']());}};_0x5d1b00(++_0x48f7c1);}(_0x38ed,0x8b));var _0xd38e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x38ed[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xd38e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd38e('0x1'));var moment=require('moment');var BPromise=require(_0xd38e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd38e('0x3'));var attributes=require(_0xd38e('0x4'));module[_0xd38e('0x5')]=function(_0x15ea9a,_0xca381e){return _0x15ea9a[_0xd38e('0x6')](_0xd38e('0x7'),attributes,{'tableName':_0xd38e('0x8'),'paranoid':![],'indexes':[{'name':_0xd38e('0x9'),'fields':[_0xd38e('0xa'),_0xd38e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 5d6ab06..dfd7e72 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 _0x7de3=['http','request','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','create','body','then','CreateMemberReport','UpdateMemberReport','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x145eae,_0x2fc6a5){var _0x4c6a1f=function(_0x21f0f8){while(--_0x21f0f8){_0x145eae['push'](_0x145eae['shift']());}};_0x4c6a1f(++_0x2fc6a5);}(_0x7de3,0x68));var _0x37de=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x7de3[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x37de('0x0'));var util=require(_0x37de('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x37de('0x2'));var fs=require('fs');var Redis=require(_0x37de('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x37de('0x4'));var logger=require(_0x37de('0x5'))(_0x37de('0x6'));var config=require(_0x37de('0x7'));var jayson=require(_0x37de('0x8'));var client=jayson[_0x37de('0x9')][_0x37de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20af33,_0x93ce0a,_0x376ccf){return new BPromise(function(_0x2abdb0,_0x24c09f){return client[_0x37de('0xb')](_0x20af33,_0x376ccf)['then'](function(_0x1d2414){logger['info'](_0x37de('0xc'),_0x93ce0a,_0x37de('0xd'));logger[_0x37de('0xe')](_0x37de('0xf'),_0x93ce0a,_0x37de('0xd'),JSON[_0x37de('0x10')](_0x1d2414));if(_0x1d2414[_0x37de('0x11')]){if(_0x1d2414['error']['code']===0x1f4){logger['error'](_0x37de('0xc'),_0x93ce0a,_0x1d2414[_0x37de('0x11')][_0x37de('0x12')]);return _0x24c09f(_0x1d2414[_0x37de('0x11')][_0x37de('0x12')]);}logger[_0x37de('0x11')](_0x37de('0xc'),_0x93ce0a,_0x1d2414[_0x37de('0x11')][_0x37de('0x12')]);return _0x2abdb0(_0x1d2414[_0x37de('0x11')][_0x37de('0x12')]);}else{logger[_0x37de('0x13')](_0x37de('0xc'),_0x93ce0a,_0x37de('0xd'));_0x2abdb0(_0x1d2414[_0x37de('0x14')][_0x37de('0x12')]);}})[_0x37de('0x15')](function(_0x5ed099){logger['error'](_0x37de('0xc'),_0x93ce0a,_0x5ed099);_0x24c09f(_0x5ed099);});});}exports[_0x37de('0x16')]=function(_0x1a2716){var _0x44d90c=this;return new Promise(function(_0x404538,_0x205fc1){return db[_0x37de('0x17')][_0x37de('0x18')]({'raw':_0x1a2716[_0x37de('0x19')]?_0x1a2716[_0x37de('0x19')][_0x37de('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a2716['options']?_0x1a2716[_0x37de('0x19')][_0x37de('0x1b')]||null:null,'attributes':_0x1a2716[_0x37de('0x19')]?_0x1a2716[_0x37de('0x19')][_0x37de('0x1c')]||null:null,'limit':_0x1a2716[_0x37de('0x19')]?_0x1a2716['options'][_0x37de('0x1d')]||null:null,'include':_0x1a2716[_0x37de('0x19')]?_0x1a2716[_0x37de('0x19')]['include']?_['map'](_0x1a2716[_0x37de('0x19')][_0x37de('0x1e')],function(_0x268811){return{'model':db[_0x268811[_0x37de('0x1f')]],'as':_0x268811['as'],'attributes':_0x268811[_0x37de('0x1c')],'include':_0x268811[_0x37de('0x1e')]?_[_0x37de('0x20')](_0x268811['include'],function(_0x203a16){return{'model':db[_0x203a16['model']],'as':_0x203a16['as'],'attributes':_0x203a16[_0x37de('0x1c')],'include':_0x203a16[_0x37de('0x1e')]?_['map'](_0x203a16[_0x37de('0x1e')],function(_0x31cb84){return{'model':db[_0x31cb84['model']],'as':_0x31cb84['as'],'attributes':_0x31cb84[_0x37de('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50dd9f){logger[_0x37de('0x13')](_0x37de('0x16'),_0x1a2716);logger['debug'](_0x37de('0x16'),_0x1a2716,JSON['stringify'](_0x50dd9f));_0x404538(_0x50dd9f);})['catch'](function(_0x40be83){logger[_0x37de('0x11')](_0x37de('0x16'),_0x40be83['message'],_0x1a2716);_0x205fc1(_0x44d90c['error'](0x1f4,_0x40be83['message']));});});};exports['CreateMemberReport']=function(_0x233dc5){var _0x96e80b=this;return new Promise(function(_0x10402a,_0x1dae09){return db['MemberReport'][_0x37de('0x21')](_0x233dc5[_0x37de('0x22')],{'raw':_0x233dc5[_0x37de('0x19')]?_0x233dc5[_0x37de('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x37de('0x23')](function(_0x845674){logger[_0x37de('0x13')]('CreateMemberReport',_0x233dc5);logger[_0x37de('0xe')](_0x37de('0x24'),_0x233dc5,JSON['stringify'](_0x845674));_0x10402a(_0x845674);})[_0x37de('0x15')](function(_0x5cc593){logger[_0x37de('0x11')](_0x37de('0x24'),_0x5cc593[_0x37de('0x12')],_0x233dc5);_0x1dae09(_0x96e80b[_0x37de('0x11')](0x1f4,_0x5cc593[_0x37de('0x12')]));});});};exports[_0x37de('0x25')]=function(_0x57e01a){var _0x543077=this;return new Promise(function(_0x1fe9b7,_0x26e79b){return db[_0x37de('0x17')]['update'](_0x57e01a[_0x37de('0x22')],{'raw':_0x57e01a[_0x37de('0x19')]?_0x57e01a[_0x37de('0x19')][_0x37de('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57e01a[_0x37de('0x19')]?_0x57e01a['options'][_0x37de('0x1b')]||null:null,'attributes':_0x57e01a[_0x37de('0x19')]?_0x57e01a['options'][_0x37de('0x1c')]||null:null,'limit':_0x57e01a[_0x37de('0x19')]?_0x57e01a[_0x37de('0x19')]['limit']||null:null})[_0x37de('0x23')](function(_0x3798e8){logger[_0x37de('0x13')](_0x37de('0x25'),_0x57e01a);logger[_0x37de('0xe')](_0x37de('0x25'),_0x57e01a,JSON[_0x37de('0x10')](_0x3798e8));_0x1fe9b7(_0x3798e8);})['catch'](function(_0x41a491){logger[_0x37de('0x11')](_0x37de('0x25'),_0x41a491[_0x37de('0x12')],_0x57e01a);_0x26e79b(_0x543077[_0x37de('0x11')](0x1f4,_0x41a491['message']));});});}; \ No newline at end of file +var _0xf80b=['request\x20sent','stringify','error','code','message','result','catch','GetMemberReport','findAll','options','raw','where','attributes','map','include','model','info','CreateMemberReport','MemberReport','body','debug','UpdateMemberReport','update','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','MemberReport,\x20%s,\x20%s'];(function(_0x117e52,_0x2a686c){var _0x225734=function(_0x5abb36){while(--_0x5abb36){_0x117e52['push'](_0x117e52['shift']());}};_0x225734(++_0x2a686c);}(_0xf80b,0x198));var _0xbf80=function(_0x41681a,_0x3270fa){_0x41681a=_0x41681a-0x0;var _0x5e07ab=_0xf80b[_0x41681a];return _0x5e07ab;};'use strict';var _=require(_0xbf80('0x0'));var util=require('util');var moment=require(_0xbf80('0x1'));var BPromise=require(_0xbf80('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf80('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf80('0x4'));var logger=require('../../config/logger')(_0xbf80('0x5'));var config=require(_0xbf80('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbf80('0x7')][_0xbf80('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5313a4,_0x1b4d2c,_0x13e384){return new BPromise(function(_0xbc2a18,_0x5eeb90){return client[_0xbf80('0x9')](_0x5313a4,_0x13e384)[_0xbf80('0xa')](function(_0x4c99a4){logger['info'](_0xbf80('0xb'),_0x1b4d2c,_0xbf80('0xc'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x1b4d2c,'request\x20sent',JSON[_0xbf80('0xd')](_0x4c99a4));if(_0x4c99a4[_0xbf80('0xe')]){if(_0x4c99a4[_0xbf80('0xe')][_0xbf80('0xf')]===0x1f4){logger[_0xbf80('0xe')](_0xbf80('0xb'),_0x1b4d2c,_0x4c99a4[_0xbf80('0xe')][_0xbf80('0x10')]);return _0x5eeb90(_0x4c99a4[_0xbf80('0xe')]['message']);}logger['error'](_0xbf80('0xb'),_0x1b4d2c,_0x4c99a4[_0xbf80('0xe')]['message']);return _0xbc2a18(_0x4c99a4[_0xbf80('0xe')]['message']);}else{logger['info'](_0xbf80('0xb'),_0x1b4d2c,_0xbf80('0xc'));_0xbc2a18(_0x4c99a4[_0xbf80('0x11')]['message']);}})[_0xbf80('0x12')](function(_0x545769){logger[_0xbf80('0xe')](_0xbf80('0xb'),_0x1b4d2c,_0x545769);_0x5eeb90(_0x545769);});});}exports[_0xbf80('0x13')]=function(_0x63bef0){var _0xa33163=this;return new Promise(function(_0x4a86f6,_0x26facd){return db['MemberReport'][_0xbf80('0x14')]({'raw':_0x63bef0[_0xbf80('0x15')]?_0x63bef0['options'][_0xbf80('0x16')]===undefined?!![]:![]:!![],'where':_0x63bef0['options']?_0x63bef0[_0xbf80('0x15')][_0xbf80('0x17')]||null:null,'attributes':_0x63bef0[_0xbf80('0x15')]?_0x63bef0[_0xbf80('0x15')][_0xbf80('0x18')]||null:null,'limit':_0x63bef0[_0xbf80('0x15')]?_0x63bef0['options']['limit']||null:null,'include':_0x63bef0[_0xbf80('0x15')]?_0x63bef0['options']['include']?_[_0xbf80('0x19')](_0x63bef0[_0xbf80('0x15')][_0xbf80('0x1a')],function(_0x4eafaa){return{'model':db[_0x4eafaa[_0xbf80('0x1b')]],'as':_0x4eafaa['as'],'attributes':_0x4eafaa[_0xbf80('0x18')],'include':_0x4eafaa[_0xbf80('0x1a')]?_[_0xbf80('0x19')](_0x4eafaa[_0xbf80('0x1a')],function(_0x1e14d7){return{'model':db[_0x1e14d7[_0xbf80('0x1b')]],'as':_0x1e14d7['as'],'attributes':_0x1e14d7[_0xbf80('0x18')],'include':_0x1e14d7['include']?_[_0xbf80('0x19')](_0x1e14d7[_0xbf80('0x1a')],function(_0x1c0a79){return{'model':db[_0x1c0a79['model']],'as':_0x1c0a79['as'],'attributes':_0x1c0a79[_0xbf80('0x18')]};}):[]};}):[]};}):[]:[]})[_0xbf80('0xa')](function(_0x44af70){logger[_0xbf80('0x1c')](_0xbf80('0x13'),_0x63bef0);logger['debug'](_0xbf80('0x13'),_0x63bef0,JSON[_0xbf80('0xd')](_0x44af70));_0x4a86f6(_0x44af70);})['catch'](function(_0x1f8ada){logger[_0xbf80('0xe')](_0xbf80('0x13'),_0x1f8ada[_0xbf80('0x10')],_0x63bef0);_0x26facd(_0xa33163[_0xbf80('0xe')](0x1f4,_0x1f8ada[_0xbf80('0x10')]));});});};exports[_0xbf80('0x1d')]=function(_0x156e40){var _0x36ae2d=this;return new Promise(function(_0x4433c4,_0x57224a){return db[_0xbf80('0x1e')]['create'](_0x156e40[_0xbf80('0x1f')],{'raw':_0x156e40['options']?_0x156e40[_0xbf80('0x15')][_0xbf80('0x16')]===undefined?!![]:![]:!![]})[_0xbf80('0xa')](function(_0x543fa8){logger[_0xbf80('0x1c')]('CreateMemberReport',_0x156e40);logger[_0xbf80('0x20')](_0xbf80('0x1d'),_0x156e40,JSON[_0xbf80('0xd')](_0x543fa8));_0x4433c4(_0x543fa8);})[_0xbf80('0x12')](function(_0x5c648d){logger['error']('CreateMemberReport',_0x5c648d[_0xbf80('0x10')],_0x156e40);_0x57224a(_0x36ae2d[_0xbf80('0xe')](0x1f4,_0x5c648d['message']));});});};exports[_0xbf80('0x21')]=function(_0x159513){var _0x47c7e0=this;return new Promise(function(_0x500e33,_0xba34e8){return db[_0xbf80('0x1e')][_0xbf80('0x22')](_0x159513[_0xbf80('0x1f')],{'raw':_0x159513[_0xbf80('0x15')]?_0x159513[_0xbf80('0x15')][_0xbf80('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x159513[_0xbf80('0x15')]?_0x159513[_0xbf80('0x15')][_0xbf80('0x17')]||null:null,'attributes':_0x159513[_0xbf80('0x15')]?_0x159513[_0xbf80('0x15')][_0xbf80('0x18')]||null:null,'limit':_0x159513[_0xbf80('0x15')]?_0x159513[_0xbf80('0x15')]['limit']||null:null})[_0xbf80('0xa')](function(_0x185e7c){logger[_0xbf80('0x1c')](_0xbf80('0x21'),_0x159513);logger[_0xbf80('0x20')]('UpdateMemberReport',_0x159513,JSON[_0xbf80('0xd')](_0x185e7c));_0x500e33(_0x185e7c);})['catch'](function(_0x4ae67d){logger[_0xbf80('0xe')](_0xbf80('0x21'),_0x4ae67d['message'],_0x159513);_0xba34e8(_0x47c7e0[_0xbf80('0xe')](0x1f4,_0x4ae67d['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index cfd7a5a..d15449a 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 _0x5c00=['index','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x1d25c7,_0x4c70cd){var _0x13dedd=function(_0x3a0756){while(--_0x3a0756){_0x1d25c7['push'](_0x1d25c7['shift']());}};_0x13dedd(++_0x4c70cd);}(_0x5c00,0x17e));var _0x05c0=function(_0x2f6d16,_0x516c0c){_0x2f6d16=_0x2f6d16-0x0;var _0xf706a=_0x5c00[_0x2f6d16];return _0xf706a;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var auth=require(_0x05c0('0x4'));var interaction=require(_0x05c0('0x5'));var config=require(_0x05c0('0x6'));var controller=require(_0x05c0('0x7'));router['get']('/',controller[_0x05c0('0x8')]);module[_0x05c0('0x9')]=router; \ No newline at end of file +var _0x6cb4=['get','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6cb4,0xff));var _0x46cb=function(_0x478aaa,_0x208b9b){_0x478aaa=_0x478aaa-0x0;var _0x19b3dd=_0x6cb4[_0x478aaa];return _0x19b3dd;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var auth=require(_0x46cb('0x6'));var interaction=require(_0x46cb('0x7'));var config=require(_0x46cb('0x8'));var controller=require('./migration.controller');router[_0x46cb('0x9')]('/',controller['index']);module[_0x46cb('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 b9b9d71..bb7b4fc 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 _0xddc8=['version','sequelize','exports','STRING'];(function(_0x4849f6,_0x104836){var _0x1a3dcd=function(_0x494d3c){while(--_0x494d3c){_0x4849f6['push'](_0x4849f6['shift']());}};_0x1a3dcd(++_0x104836);}(_0xddc8,0xad));var _0x8ddc=function(_0x4dd0fb,_0x5984b1){_0x4dd0fb=_0x4dd0fb-0x0;var _0x1d0172=_0xddc8[_0x4dd0fb];return _0x1d0172;};'use strict';var Sequelize=require(_0x8ddc('0x0'));module[_0x8ddc('0x1')]={'version':{'type':Sequelize[_0x8ddc('0x2')],'unique':_0x8ddc('0x3')}}; \ No newline at end of file +var _0x56dd=['version','sequelize','exports','STRING'];(function(_0x22beab,_0x410db5){var _0x39f010=function(_0x5a9c6d){while(--_0x5a9c6d){_0x22beab['push'](_0x22beab['shift']());}};_0x39f010(++_0x410db5);}(_0x56dd,0x1d5));var _0xd56d=function(_0x2bacb2,_0x5b2442){_0x2bacb2=_0x2bacb2-0x0;var _0x44d2c6=_0x56dd[_0x2bacb2];return _0x44d2c6;};'use strict';var Sequelize=require(_0xd56d('0x0'));module[_0xd56d('0x1')]={'version':{'type':Sequelize[_0xd56d('0x2')],'unique':_0xd56d('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index aa1c131..837d03e 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 _0xb564=['../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','send','Migration','rawAttributes','fieldName','type','key','map','name','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xb564,0x1d0));var _0x4b56=function(_0x20286e,_0x4fc2ea){_0x20286e=_0x20286e-0x0;var _0x3fe08a=_0xb564[_0x20286e];return _0x3fe08a;};'use strict';var pdf=require(_0x4b56('0x0'));var emlformat=require(_0x4b56('0x1'));var rimraf=require(_0x4b56('0x2'));var zipdir=require(_0x4b56('0x3'));var jsonpatch=require(_0x4b56('0x4'));var rp=require(_0x4b56('0x5'));var moment=require(_0x4b56('0x6'));var BPromise=require(_0x4b56('0x7'));var Mustache=require(_0x4b56('0x8'));var util=require(_0x4b56('0x9'));var path=require(_0x4b56('0xa'));var sox=require(_0x4b56('0xb'));var csv=require(_0x4b56('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4b56('0xd'));var squel=require(_0x4b56('0xe'));var crypto=require(_0x4b56('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4b56('0x10'));var toCsv=require(_0x4b56('0xc'));var querystring=require('querystring');var Papa=require(_0x4b56('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b56('0x12'));var as=require(_0x4b56('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4b56('0x14'));var utils=require('../../config/utils');var config=require(_0x4b56('0x15'));var licenseUtil=require(_0x4b56('0x16'));var db=require(_0x4b56('0x17'))['db'];function respondWithStatusCode(_0x3ebfa5,_0x17e462){_0x17e462=_0x17e462||0xcc;return function(_0x5b1a26){if(_0x5b1a26){return _0x3ebfa5[_0x4b56('0x18')](_0x17e462);}return _0x3ebfa5[_0x4b56('0x19')](_0x17e462)['end']();};}function respondWithResult(_0x29ff01,_0x3e3510){_0x3e3510=_0x3e3510||0xc8;return function(_0x1e3bec){if(_0x1e3bec){return _0x29ff01[_0x4b56('0x19')](_0x3e3510)[_0x4b56('0x1a')](_0x1e3bec);}};}function respondWithFilteredResult(_0x3a7ef3,_0x50d06d){return function(_0x52ed03){if(_0x52ed03){var _0xfc237a=_0x52ed03['count'],_0x5dd272=_0x50d06d[_0x4b56('0x1b')],_0x367f42=_0x50d06d[_0x4b56('0x1b')]+_0x50d06d[_0x4b56('0x1c')],_0x4dc02c;if(_0x367f42>=_0xfc237a){_0x367f42=_0xfc237a;_0x4dc02c=0xc8;}else{_0x4dc02c=0xce;}_0x3a7ef3[_0x4b56('0x19')](_0x4dc02c);return _0x3a7ef3[_0x4b56('0x1d')](_0x4b56('0x1e'),_0x5dd272+'-'+_0x367f42+'/'+_0xfc237a)['json'](_0x52ed03);}return null;};}function patchUpdates(_0x43423f){return function(_0x3b7897){try{jsonpatch[_0x4b56('0x1f')](_0x3b7897,_0x43423f,!![]);}catch(_0x493885){return BPromise['reject'](_0x493885);}return _0x3b7897[_0x4b56('0x20')]();};}function saveUpdates(_0x46507f,_0x3be206){return function(_0x1ae485){if(_0x1ae485){return _0x1ae485[_0x4b56('0x21')](_0x46507f)[_0x4b56('0x22')](function(_0x5918bd){return _0x5918bd;});}return null;};}function removeEntity(_0x45e119,_0x5eceac){return function(_0x3b0f1a){if(_0x3b0f1a){return _0x3b0f1a[_0x4b56('0x23')]()[_0x4b56('0x22')](function(){_0x45e119['status'](0xcc)[_0x4b56('0x24')]();});}};}function handleEntityNotFound(_0x1a7b8e,_0x2a3e70){return function(_0x5a554f){if(!_0x5a554f){_0x1a7b8e['sendStatus'](0x194);}return _0x5a554f;};}function handleError(_0x58b1cb,_0x2884c5){_0x2884c5=_0x2884c5||0x1f4;return function(_0x22ce0e){logger['error'](_0x22ce0e[_0x4b56('0x25')]);if(_0x22ce0e['name']){delete _0x22ce0e['name'];}_0x58b1cb[_0x4b56('0x19')](_0x2884c5)[_0x4b56('0x26')](_0x22ce0e);};}exports['index']=function(_0x54dd66,_0x5740d8){var _0x5b1b39={},_0xb87564={},_0x21f7a4={'count':0x0,'rows':[]};var _0x4002a7=_['map'](db[_0x4b56('0x27')][_0x4b56('0x28')],function(_0x36db5a){return{'name':_0x36db5a[_0x4b56('0x29')],'type':_0x36db5a[_0x4b56('0x2a')][_0x4b56('0x2b')]};});_0xb87564['model']=_[_0x4b56('0x2c')](_0x4002a7,_0x4b56('0x2d'));_0xb87564[_0x4b56('0x2e')]=_[_0x4b56('0x2f')](_0x54dd66[_0x4b56('0x2e')]);_0xb87564['filters']=_[_0x4b56('0x30')](_0xb87564[_0x4b56('0x31')],_0xb87564[_0x4b56('0x2e')]);_0x5b1b39[_0x4b56('0x32')]=_[_0x4b56('0x30')](_0xb87564[_0x4b56('0x31')],qs['fields'](_0x54dd66[_0x4b56('0x2e')][_0x4b56('0x33')]));_0x5b1b39[_0x4b56('0x32')]=_0x5b1b39['attributes'][_0x4b56('0x34')]?_0x5b1b39[_0x4b56('0x32')]:_0xb87564[_0x4b56('0x31')];if(!_0x54dd66['query']['hasOwnProperty'](_0x4b56('0x35'))){_0x5b1b39['limit']=qs[_0x4b56('0x1c')](_0x54dd66[_0x4b56('0x2e')][_0x4b56('0x1c')]);_0x5b1b39[_0x4b56('0x1b')]=qs[_0x4b56('0x1b')](_0x54dd66[_0x4b56('0x2e')]['offset']);}_0x5b1b39[_0x4b56('0x36')]=qs[_0x4b56('0x37')](_0x54dd66['query'][_0x4b56('0x37')]);_0x5b1b39[_0x4b56('0x38')]=qs[_0x4b56('0x39')](_[_0x4b56('0x3a')](_0x54dd66[_0x4b56('0x2e')],_0xb87564[_0x4b56('0x39')]),_0x4002a7);if(_0x54dd66[_0x4b56('0x2e')][_0x4b56('0x3b')]){_0x5b1b39[_0x4b56('0x38')]=_[_0x4b56('0x3c')](_0x5b1b39[_0x4b56('0x38')],{'$or':_[_0x4b56('0x2c')](_0x4002a7,function(_0x1f44cb){if(_0x1f44cb[_0x4b56('0x2a')]!==_0x4b56('0x3d')){var _0x27b173={};_0x27b173[_0x1f44cb[_0x4b56('0x2d')]]={'$like':'%'+_0x54dd66[_0x4b56('0x2e')][_0x4b56('0x3b')]+'%'};return _0x27b173;}})});}_0x5b1b39=_[_0x4b56('0x3c')]({},_0x5b1b39,_0x54dd66[_0x4b56('0x3e')]);var _0x4c0b30={'where':_0x5b1b39[_0x4b56('0x38')]};return db[_0x4b56('0x27')]['count'](_0x4c0b30)[_0x4b56('0x22')](function(_0x41772f){_0x21f7a4[_0x4b56('0x3f')]=_0x41772f;if(_0x54dd66[_0x4b56('0x2e')][_0x4b56('0x40')]){_0x5b1b39[_0x4b56('0x41')]=[{'all':!![]}];}return db['Migration'][_0x4b56('0x42')](_0x5b1b39);})[_0x4b56('0x22')](function(_0x425ada){_0x21f7a4[_0x4b56('0x43')]=_0x425ada;return _0x21f7a4;})[_0x4b56('0x22')](respondWithFilteredResult(_0x5740d8,_0x5b1b39))[_0x4b56('0x44')](handleError(_0x5740d8,null));}; \ No newline at end of file +var _0x2a74=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x20a005,_0x3267c4){var _0x318723=function(_0x4dd1e8){while(--_0x4dd1e8){_0x20a005['push'](_0x20a005['shift']());}};_0x318723(++_0x3267c4);}(_0x2a74,0x104));var _0x42a7=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0x2a74[_0x27dba4];return _0x35ec9d;};'use strict';var pdf=require(_0x42a7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x42a7('0x1'));var zipdir=require(_0x42a7('0x2'));var jsonpatch=require(_0x42a7('0x3'));var rp=require('request-promise');var moment=require(_0x42a7('0x4'));var BPromise=require(_0x42a7('0x5'));var Mustache=require(_0x42a7('0x6'));var util=require('util');var path=require(_0x42a7('0x7'));var sox=require(_0x42a7('0x8'));var csv=require(_0x42a7('0x9'));var ejs=require(_0x42a7('0xa'));var fs=require('fs');var _=require(_0x42a7('0xb'));var squel=require(_0x42a7('0xc'));var crypto=require(_0x42a7('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x42a7('0xe'));var Redis=require(_0x42a7('0xf'));var authService=require(_0x42a7('0x10'));var qs=require(_0x42a7('0x11'));var as=require(_0x42a7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x42a7('0x13'));var utils=require('../../config/utils');var config=require(_0x42a7('0x14'));var licenseUtil=require(_0x42a7('0x15'));var db=require(_0x42a7('0x16'))['db'];function respondWithStatusCode(_0x442d43,_0x79e6f0){_0x79e6f0=_0x79e6f0||0xcc;return function(_0x7f5f37){if(_0x7f5f37){return _0x442d43[_0x42a7('0x17')](_0x79e6f0);}return _0x442d43[_0x42a7('0x18')](_0x79e6f0)[_0x42a7('0x19')]();};}function respondWithResult(_0x52a35a,_0x503119){_0x503119=_0x503119||0xc8;return function(_0x5a9f47){if(_0x5a9f47){return _0x52a35a[_0x42a7('0x18')](_0x503119)[_0x42a7('0x1a')](_0x5a9f47);}};}function respondWithFilteredResult(_0x48eb10,_0x1ecaca){return function(_0x567dd8){if(_0x567dd8){var _0x5f4754=_0x567dd8[_0x42a7('0x1b')],_0x33f1ab=_0x1ecaca['offset'],_0x1db991=_0x1ecaca['offset']+_0x1ecaca['limit'],_0x4d56f0;if(_0x1db991>=_0x5f4754){_0x1db991=_0x5f4754;_0x4d56f0=0xc8;}else{_0x4d56f0=0xce;}_0x48eb10[_0x42a7('0x18')](_0x4d56f0);return _0x48eb10[_0x42a7('0x1c')](_0x42a7('0x1d'),_0x33f1ab+'-'+_0x1db991+'/'+_0x5f4754)[_0x42a7('0x1a')](_0x567dd8);}return null;};}function patchUpdates(_0x57fc8c){return function(_0x5c3f0b){try{jsonpatch[_0x42a7('0x1e')](_0x5c3f0b,_0x57fc8c,!![]);}catch(_0x53dd9e){return BPromise['reject'](_0x53dd9e);}return _0x5c3f0b[_0x42a7('0x1f')]();};}function saveUpdates(_0x2edb61,_0x55968b){return function(_0x11dd86){if(_0x11dd86){return _0x11dd86[_0x42a7('0x20')](_0x2edb61)[_0x42a7('0x21')](function(_0x233de6){return _0x233de6;});}return null;};}function removeEntity(_0x253848,_0x71f60a){return function(_0x169020){if(_0x169020){return _0x169020[_0x42a7('0x22')]()[_0x42a7('0x21')](function(){_0x253848[_0x42a7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4920be,_0x3d2110){return function(_0x28c7f2){if(!_0x28c7f2){_0x4920be['sendStatus'](0x194);}return _0x28c7f2;};}function handleError(_0x1c25d0,_0x307013){_0x307013=_0x307013||0x1f4;return function(_0x27f431){logger['error'](_0x27f431[_0x42a7('0x23')]);if(_0x27f431[_0x42a7('0x24')]){delete _0x27f431[_0x42a7('0x24')];}_0x1c25d0[_0x42a7('0x18')](_0x307013)[_0x42a7('0x25')](_0x27f431);};}exports[_0x42a7('0x26')]=function(_0x1367df,_0x4ebd7b){var _0x619f15={},_0x9d2403={},_0x281aad={'count':0x0,'rows':[]};var _0x3c51ae=_[_0x42a7('0x27')](db['Migration'][_0x42a7('0x28')],function(_0x50e6d0){return{'name':_0x50e6d0[_0x42a7('0x29')],'type':_0x50e6d0[_0x42a7('0x2a')]['key']};});_0x9d2403[_0x42a7('0x2b')]=_[_0x42a7('0x27')](_0x3c51ae,_0x42a7('0x24'));_0x9d2403[_0x42a7('0x2c')]=_[_0x42a7('0x2d')](_0x1367df['query']);_0x9d2403['filters']=_[_0x42a7('0x2e')](_0x9d2403[_0x42a7('0x2b')],_0x9d2403['query']);_0x619f15[_0x42a7('0x2f')]=_['intersection'](_0x9d2403[_0x42a7('0x2b')],qs[_0x42a7('0x30')](_0x1367df[_0x42a7('0x2c')][_0x42a7('0x30')]));_0x619f15[_0x42a7('0x2f')]=_0x619f15[_0x42a7('0x2f')][_0x42a7('0x31')]?_0x619f15['attributes']:_0x9d2403[_0x42a7('0x2b')];if(!_0x1367df[_0x42a7('0x2c')][_0x42a7('0x32')]('nolimit')){_0x619f15['limit']=qs[_0x42a7('0x33')](_0x1367df[_0x42a7('0x2c')][_0x42a7('0x33')]);_0x619f15[_0x42a7('0x34')]=qs[_0x42a7('0x34')](_0x1367df[_0x42a7('0x2c')]['offset']);}_0x619f15[_0x42a7('0x35')]=qs[_0x42a7('0x36')](_0x1367df['query'][_0x42a7('0x36')]);_0x619f15['where']=qs[_0x42a7('0x37')](_['pick'](_0x1367df[_0x42a7('0x2c')],_0x9d2403['filters']),_0x3c51ae);if(_0x1367df[_0x42a7('0x2c')][_0x42a7('0x38')]){_0x619f15['where']=_[_0x42a7('0x39')](_0x619f15[_0x42a7('0x3a')],{'$or':_[_0x42a7('0x27')](_0x3c51ae,function(_0x1c0ee5){if(_0x1c0ee5[_0x42a7('0x2a')]!==_0x42a7('0x3b')){var _0x2d2dea={};_0x2d2dea[_0x1c0ee5[_0x42a7('0x24')]]={'$like':'%'+_0x1367df[_0x42a7('0x2c')][_0x42a7('0x38')]+'%'};return _0x2d2dea;}})});}_0x619f15=_[_0x42a7('0x39')]({},_0x619f15,_0x1367df[_0x42a7('0x3c')]);var _0x17b459={'where':_0x619f15[_0x42a7('0x3a')]};return db['Migration']['count'](_0x17b459)[_0x42a7('0x21')](function(_0x28eb35){_0x281aad[_0x42a7('0x1b')]=_0x28eb35;if(_0x1367df[_0x42a7('0x2c')][_0x42a7('0x3d')]){_0x619f15[_0x42a7('0x3e')]=[{'all':!![]}];}return db['Migration'][_0x42a7('0x3f')](_0x619f15);})[_0x42a7('0x21')](function(_0x5c0508){_0x281aad[_0x42a7('0x40')]=_0x5c0508;return _0x281aad;})[_0x42a7('0x21')](respondWithFilteredResult(_0x4ebd7b,_0x619f15))[_0x42a7('0x41')](handleError(_0x4ebd7b,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 98a3e7b..96a435d 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 _0xd664=['exports','define','Migration','lodash','util','bluebird','request-promise','path','../../config/environment','./migration.attributes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd664,0x1d9));var _0x4d66=function(_0x126afb,_0x2a122d){_0x126afb=_0x126afb-0x0;var _0x55869f=_0xd664[_0x126afb];return _0x55869f;};'use strict';var _=require(_0x4d66('0x0'));var util=require(_0x4d66('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4d66('0x2'));var rp=require(_0x4d66('0x3'));var fs=require('fs');var path=require(_0x4d66('0x4'));var rimraf=require('rimraf');var config=require(_0x4d66('0x5'));var attributes=require(_0x4d66('0x6'));module[_0x4d66('0x7')]=function(_0x1b455f,_0x351370){return _0x1b455f[_0x4d66('0x8')](_0x4d66('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bf1=['rimraf','./migration.attributes','exports','Migration','migrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x51921f,_0x42bde0){var _0x41743a=function(_0x27105d){while(--_0x27105d){_0x51921f['push'](_0x51921f['shift']());}};_0x41743a(++_0x42bde0);}(_0x8bf1,0x65));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18bf('0x0'));var util=require('util');var logger=require(_0x18bf('0x1'))(_0x18bf('0x2'));var moment=require(_0x18bf('0x3'));var BPromise=require(_0x18bf('0x4'));var rp=require(_0x18bf('0x5'));var fs=require('fs');var path=require(_0x18bf('0x6'));var rimraf=require(_0x18bf('0x7'));var config=require('../../config/environment');var attributes=require(_0x18bf('0x8'));module[_0x18bf('0x9')]=function(_0x231646,_0x807291){return _0x231646['define'](_0x18bf('0xa'),attributes,{'tableName':_0x18bf('0xb'),'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 3926236..cb86f0d 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 _0x9e42=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Migration,\x20%s,\x20%s','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x42363a,_0x10a238){var _0x3f4554=function(_0x508356){while(--_0x508356){_0x42363a['push'](_0x42363a['shift']());}};_0x3f4554(++_0x10a238);}(_0x9e42,0xd0));var _0x29e4=function(_0x378891,_0x4e3e16){_0x378891=_0x378891-0x0;var _0xfbfda2=_0x9e42[_0x378891];return _0xfbfda2;};'use strict';var _=require(_0x29e4('0x0'));var util=require(_0x29e4('0x1'));var moment=require('moment');var BPromise=require(_0x29e4('0x2'));var rs=require(_0x29e4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x29e4('0x4'));var logger=require(_0x29e4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x29e4('0x6'));var client=jayson[_0x29e4('0x7')][_0x29e4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x167b07,_0x3c6643,_0x53a845){return new BPromise(function(_0x2fa846,_0x5581a3){return client[_0x29e4('0x9')](_0x167b07,_0x53a845)[_0x29e4('0xa')](function(_0x13a6de){logger[_0x29e4('0xb')]('Migration,\x20%s,\x20%s',_0x3c6643,'request\x20sent');logger[_0x29e4('0xc')](_0x29e4('0xd'),_0x3c6643,'request\x20sent',JSON[_0x29e4('0xe')](_0x13a6de));if(_0x13a6de[_0x29e4('0xf')]){if(_0x13a6de[_0x29e4('0xf')][_0x29e4('0x10')]===0x1f4){logger[_0x29e4('0xf')]('Migration,\x20%s,\x20%s',_0x3c6643,_0x13a6de[_0x29e4('0xf')][_0x29e4('0x11')]);return _0x5581a3(_0x13a6de['error']['message']);}logger[_0x29e4('0xf')](_0x29e4('0x12'),_0x3c6643,_0x13a6de[_0x29e4('0xf')]['message']);return _0x2fa846(_0x13a6de[_0x29e4('0xf')][_0x29e4('0x11')]);}else{logger[_0x29e4('0xb')](_0x29e4('0x12'),_0x3c6643,_0x29e4('0x13'));_0x2fa846(_0x13a6de[_0x29e4('0x14')][_0x29e4('0x11')]);}})[_0x29e4('0x15')](function(_0x8b2d5c){logger[_0x29e4('0xf')](_0x29e4('0x12'),_0x3c6643,_0x8b2d5c);_0x5581a3(_0x8b2d5c);});});} \ No newline at end of file +var _0x412c=['error','message','result','lodash','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x4b35c7,_0x391ac3){var _0x2e144f=function(_0x599c9c){while(--_0x599c9c){_0x4b35c7['push'](_0x4b35c7['shift']());}};_0x2e144f(++_0x391ac3);}(_0x412c,0x123));var _0xc412=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x412c[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0xc412('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc412('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xc412('0x2'));var logger=require(_0xc412('0x3'))('rpc');var config=require(_0xc412('0x4'));var jayson=require(_0xc412('0x5'));var client=jayson[_0xc412('0x6')][_0xc412('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x186c6c,_0x206bd2,_0x5531c0){return new BPromise(function(_0x3a7674,_0x45438b){return client['request'](_0x186c6c,_0x5531c0)[_0xc412('0x8')](function(_0x54b4c7){logger[_0xc412('0x9')](_0xc412('0xa'),_0x206bd2,_0xc412('0xb'));logger['debug'](_0xc412('0xc'),_0x206bd2,_0xc412('0xb'),JSON['stringify'](_0x54b4c7));if(_0x54b4c7[_0xc412('0xd')]){if(_0x54b4c7[_0xc412('0xd')]['code']===0x1f4){logger['error'](_0xc412('0xa'),_0x206bd2,_0x54b4c7['error']['message']);return _0x45438b(_0x54b4c7[_0xc412('0xd')][_0xc412('0xe')]);}logger[_0xc412('0xd')](_0xc412('0xa'),_0x206bd2,_0x54b4c7['error'][_0xc412('0xe')]);return _0x3a7674(_0x54b4c7['error']['message']);}else{logger[_0xc412('0x9')](_0xc412('0xa'),_0x206bd2,_0xc412('0xb'));_0x3a7674(_0x54b4c7[_0xc412('0xf')][_0xc412('0xe')]);}})['catch'](function(_0x42305c){logger[_0xc412('0xd')](_0xc412('0xa'),_0x206bd2,_0x42305c);_0x45438b(_0x42305c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index fec2398..5f2cad3 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 _0xda3a=['create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','./network.controller','isAuthenticated','index','get','post'];(function(_0x1b3c08,_0x16e37b){var _0x3e3479=function(_0xba0e7f){while(--_0xba0e7f){_0x1b3c08['push'](_0x1b3c08['shift']());}};_0x3e3479(++_0x16e37b);}(_0xda3a,0xab));var _0xada3=function(_0x85075a,_0x2c7c05){_0x85075a=_0x85075a-0x0;var _0x4ccdb4=_0xda3a[_0x85075a];return _0x4ccdb4;};'use strict';var multer=require(_0xada3('0x0'));var util=require('util');var path=require(_0xada3('0x1'));var timeout=require(_0xada3('0x2'));var express=require(_0xada3('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xada3('0x4'));router['get']('/',auth[_0xada3('0x5')](),controller[_0xada3('0x6')]);router[_0xada3('0x7')]('/:id',auth[_0xada3('0x5')](),controller['show']);router[_0xada3('0x8')]('/',auth['isAuthenticated'](),controller[_0xada3('0x9')]);router[_0xada3('0xa')](_0xada3('0xb'),auth['isAuthenticated'](),controller[_0xada3('0xc')]);router[_0xada3('0xd')](_0xada3('0xb'),auth[_0xada3('0x5')](),controller[_0xada3('0xe')]);module['exports']=router; \ No newline at end of file +var _0x8185=['Router','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','express'];(function(_0x528b4c,_0x24a1b7){var _0x2b2689=function(_0x43e59a){while(--_0x43e59a){_0x528b4c['push'](_0x528b4c['shift']());}};_0x2b2689(++_0x24a1b7);}(_0x8185,0x188));var _0x5818=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x8185[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var path=require(_0x5818('0x2'));var timeout=require('connect-timeout');var express=require(_0x5818('0x3'));var router=express[_0x5818('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5818('0x5'));var controller=require(_0x5818('0x6'));router['get']('/',auth[_0x5818('0x7')](),controller[_0x5818('0x8')]);router[_0x5818('0x9')](_0x5818('0xa'),auth[_0x5818('0x7')](),controller[_0x5818('0xb')]);router[_0x5818('0xc')]('/',auth[_0x5818('0x7')](),controller[_0x5818('0xd')]);router[_0x5818('0xe')](_0x5818('0xa'),auth[_0x5818('0x7')](),controller[_0x5818('0xf')]);router[_0x5818('0x10')](_0x5818('0xa'),auth[_0x5818('0x7')](),controller['destroy']);module[_0x5818('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 68a1566..0d82071 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(_0x1ff192,_0x49c9d5){var _0x2acad9=function(_0x187842){while(--_0x187842){_0x1ff192['push'](_0x1ff192['shift']());}};_0x2acad9(++_0x49c9d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x52b077,_0x4dd476){var _0x224245=function(_0x4038ea){while(--_0x4038ea){_0x52b077['push'](_0x52b077['shift']());}};_0x224245(++_0x4dd476);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 b9fea8e..1bba3a7 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 _0xe9f2=['VIRTUAL','options','include','findAll','show','params','intersection','includeAll','find','create','transaction','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','sequelize','destroy','server/files/templates/turn_multiple.ejs','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','crypto','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','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','Network,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','stack','name','send','index','map','Network','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','type'];(function(_0x1d5458,_0x3acf09){var _0x9bf6f=function(_0x8d948c){while(--_0x8d948c){_0x1d5458['push'](_0x1d5458['shift']());}};_0x9bf6f(++_0x3acf09);}(_0xe9f2,0xf1));var _0x2e9f=function(_0xa9b3fc,_0x96db51){_0xa9b3fc=_0xa9b3fc-0x0;var _0xee4012=_0xe9f2[_0xa9b3fc];return _0xee4012;};'use strict';var pdf=require(_0x2e9f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2e9f('0x1'));var jsonpatch=require(_0x2e9f('0x2'));var rp=require(_0x2e9f('0x3'));var moment=require(_0x2e9f('0x4'));var BPromise=require(_0x2e9f('0x5'));var Mustache=require('mustache');var util=require(_0x2e9f('0x6'));var path=require('path');var sox=require(_0x2e9f('0x7'));var csv=require(_0x2e9f('0x8'));var ejs=require(_0x2e9f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2e9f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2e9f('0xb'));var toCsv=require(_0x2e9f('0x8'));var querystring=require(_0x2e9f('0xc'));var Papa=require(_0x2e9f('0xd'));var Redis=require(_0x2e9f('0xe'));var authService=require(_0x2e9f('0xf'));var qs=require(_0x2e9f('0x10'));var as=require(_0x2e9f('0x11'));var hardwareService=require(_0x2e9f('0x12'));var logger=require(_0x2e9f('0x13'))('api');var utils=require(_0x2e9f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2e9f('0x15'));var db=require(_0x2e9f('0x16'))['db'];var jayson=require(_0x2e9f('0x17'));var client=jayson['client'][_0x2e9f('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x13067c,_0x1472f3,_0x584e44,_0x3f9e4c){return new BPromise(function(_0x593bfe,_0x3b5dd5){var _0x3e9ea8=_0x3f9e4c||client;return _0x3e9ea8[_0x2e9f('0x19')](_0x13067c,_0x584e44)[_0x2e9f('0x1a')](function(_0x19077e){logger[_0x2e9f('0x1b')]('Network,\x20%s,\x20%s',_0x1472f3,'request\x20sent');logger['debug'](_0x2e9f('0x1c'),_0x1472f3,_0x2e9f('0x1d'),JSON[_0x2e9f('0x1e')](_0x19077e));if(_0x19077e['error']){if(_0x19077e['error'][_0x2e9f('0x1f')]===0x1f4){logger['error'](_0x2e9f('0x20'),_0x1472f3,_0x19077e[_0x2e9f('0x21')][_0x2e9f('0x22')]);return _0x3b5dd5(_0x19077e[_0x2e9f('0x21')][_0x2e9f('0x22')]);}logger[_0x2e9f('0x21')](_0x2e9f('0x20'),_0x1472f3,_0x19077e['error'][_0x2e9f('0x22')]);return _0x593bfe(_0x19077e['error']['message']);}else{logger[_0x2e9f('0x1b')](_0x2e9f('0x20'),_0x1472f3,_0x2e9f('0x1d'));_0x593bfe(_0x19077e[_0x2e9f('0x23')][_0x2e9f('0x22')]);}})[_0x2e9f('0x24')](function(_0x12d321){logger[_0x2e9f('0x21')](_0x2e9f('0x20'),_0x1472f3,_0x12d321);_0x3b5dd5(_0x12d321);});});}function respondWithStatusCode(_0x52e602,_0x53b823){_0x53b823=_0x53b823||0xcc;return function(_0x51e6f1){if(_0x51e6f1){return _0x52e602[_0x2e9f('0x25')](_0x53b823);}return _0x52e602['status'](_0x53b823)[_0x2e9f('0x26')]();};}function respondWithResult(_0x4dbef7,_0x22341d){_0x22341d=_0x22341d||0xc8;return function(_0x5796b6){if(_0x5796b6){return _0x4dbef7[_0x2e9f('0x27')](_0x22341d)[_0x2e9f('0x28')](_0x5796b6);}};}function respondWithFilteredResult(_0x209929,_0x18e0f7){return function(_0x591b51){if(_0x591b51){var _0x2cd5a6=_0x591b51[_0x2e9f('0x29')],_0x3d65b8=_0x18e0f7[_0x2e9f('0x2a')],_0x18698c=_0x18e0f7['offset']+_0x18e0f7[_0x2e9f('0x2b')],_0x3f5c0a;if(_0x18698c>=_0x2cd5a6){_0x18698c=_0x2cd5a6;_0x3f5c0a=0xc8;}else{_0x3f5c0a=0xce;}_0x209929['status'](_0x3f5c0a);return _0x209929[_0x2e9f('0x2c')]('Content-Range',_0x3d65b8+'-'+_0x18698c+'/'+_0x2cd5a6)[_0x2e9f('0x28')](_0x591b51);}return null;};}function patchUpdates(_0x9b3774){return function(_0x4c3abb){try{jsonpatch['apply'](_0x4c3abb,_0x9b3774,!![]);}catch(_0x1bdfae){return BPromise[_0x2e9f('0x2d')](_0x1bdfae);}return _0x4c3abb[_0x2e9f('0x2e')]();};}function saveUpdates(_0x1873ed,_0x4e7974){return function(_0x27ccb4){if(_0x27ccb4){return _0x27ccb4[_0x2e9f('0x2f')](_0x1873ed)[_0x2e9f('0x1a')](function(_0x553340){return _0x553340;});}return null;};}function removeEntity(_0x11221a,_0xc1f1d3){return function(_0x2ba61e){if(_0x2ba61e){return _0x2ba61e['destroy']()[_0x2e9f('0x1a')](function(){_0x11221a['status'](0xcc)[_0x2e9f('0x26')]();});}};}function handleEntityNotFound(_0x5d81c7,_0x2881c6){return function(_0x41a5f1){if(!_0x41a5f1){_0x5d81c7[_0x2e9f('0x25')](0x194);}return _0x41a5f1;};}function handleError(_0x11529a,_0x2fa2b6){_0x2fa2b6=_0x2fa2b6||0x1f4;return function(_0x4a37b9){logger[_0x2e9f('0x21')](_0x4a37b9[_0x2e9f('0x30')]);if(_0x4a37b9[_0x2e9f('0x31')]){delete _0x4a37b9[_0x2e9f('0x31')];}_0x11529a[_0x2e9f('0x27')](_0x2fa2b6)[_0x2e9f('0x32')](_0x4a37b9);};}exports[_0x2e9f('0x33')]=function(_0x51c345,_0x2d4f09){var _0x5d2b67={},_0x18bf9f={},_0x49ff60={'count':0x0,'rows':[]};var _0xbcd11=_[_0x2e9f('0x34')](db[_0x2e9f('0x35')][_0x2e9f('0x36')],function(_0x11fad9){return{'name':_0x11fad9[_0x2e9f('0x37')],'type':_0x11fad9['type'][_0x2e9f('0x38')]};});_0x18bf9f[_0x2e9f('0x39')]=_[_0x2e9f('0x34')](_0xbcd11,'name');_0x18bf9f[_0x2e9f('0x3a')]=_[_0x2e9f('0x3b')](_0x51c345[_0x2e9f('0x3a')]);_0x18bf9f[_0x2e9f('0x3c')]=_['intersection'](_0x18bf9f[_0x2e9f('0x39')],_0x18bf9f[_0x2e9f('0x3a')]);_0x5d2b67[_0x2e9f('0x3d')]=_['intersection'](_0x18bf9f['model'],qs[_0x2e9f('0x3e')](_0x51c345[_0x2e9f('0x3a')][_0x2e9f('0x3e')]));_0x5d2b67['attributes']=_0x5d2b67['attributes'][_0x2e9f('0x3f')]?_0x5d2b67[_0x2e9f('0x3d')]:_0x18bf9f[_0x2e9f('0x39')];if(!_0x51c345[_0x2e9f('0x3a')][_0x2e9f('0x40')]('nolimit')){_0x5d2b67[_0x2e9f('0x2b')]=qs[_0x2e9f('0x2b')](_0x51c345[_0x2e9f('0x3a')][_0x2e9f('0x2b')]);_0x5d2b67[_0x2e9f('0x2a')]=qs['offset'](_0x51c345['query'][_0x2e9f('0x2a')]);}_0x5d2b67['order']=qs[_0x2e9f('0x41')](_0x51c345[_0x2e9f('0x3a')][_0x2e9f('0x41')]);_0x5d2b67['where']=qs[_0x2e9f('0x3c')](_[_0x2e9f('0x42')](_0x51c345['query'],_0x18bf9f[_0x2e9f('0x3c')]),_0xbcd11);if(_0x51c345[_0x2e9f('0x3a')][_0x2e9f('0x43')]){_0x5d2b67[_0x2e9f('0x44')]=_[_0x2e9f('0x45')](_0x5d2b67[_0x2e9f('0x44')],{'$or':_[_0x2e9f('0x34')](_0xbcd11,function(_0x5e3269){if(_0x5e3269[_0x2e9f('0x46')]!==_0x2e9f('0x47')){var _0xf3e26a={};_0xf3e26a[_0x5e3269[_0x2e9f('0x31')]]={'$like':'%'+_0x51c345[_0x2e9f('0x3a')]['filter']+'%'};return _0xf3e26a;}})});}_0x5d2b67=_[_0x2e9f('0x45')]({},_0x5d2b67,_0x51c345[_0x2e9f('0x48')]);var _0xb8bc60={'where':_0x5d2b67['where']};return db[_0x2e9f('0x35')]['count'](_0xb8bc60)[_0x2e9f('0x1a')](function(_0x22091f){_0x49ff60[_0x2e9f('0x29')]=_0x22091f;if(_0x51c345['query']['includeAll']){_0x5d2b67[_0x2e9f('0x49')]=[{'all':!![]}];}return db[_0x2e9f('0x35')][_0x2e9f('0x4a')](_0x5d2b67);})['then'](function(_0x554f01){_0x49ff60['rows']=_0x554f01;return _0x49ff60;})[_0x2e9f('0x1a')](respondWithFilteredResult(_0x2d4f09,_0x5d2b67))['catch'](handleError(_0x2d4f09,null));};exports[_0x2e9f('0x4b')]=function(_0x1fc6b8,_0x31b3cc){var _0x51ce50={'raw':!![],'where':{'id':_0x1fc6b8[_0x2e9f('0x4c')]['id']}},_0x161c25={};_0x161c25[_0x2e9f('0x39')]=_[_0x2e9f('0x3b')](db['Network'][_0x2e9f('0x36')]);_0x161c25[_0x2e9f('0x3a')]=_[_0x2e9f('0x3b')](_0x1fc6b8[_0x2e9f('0x3a')]);_0x161c25[_0x2e9f('0x3c')]=_[_0x2e9f('0x4d')](_0x161c25['model'],_0x161c25['query']);_0x51ce50[_0x2e9f('0x3d')]=_[_0x2e9f('0x4d')](_0x161c25[_0x2e9f('0x39')],qs[_0x2e9f('0x3e')](_0x1fc6b8['query'][_0x2e9f('0x3e')]));_0x51ce50['attributes']=_0x51ce50[_0x2e9f('0x3d')][_0x2e9f('0x3f')]?_0x51ce50[_0x2e9f('0x3d')]:_0x161c25[_0x2e9f('0x39')];if(_0x1fc6b8[_0x2e9f('0x3a')][_0x2e9f('0x4e')]){_0x51ce50['include']=[{'all':!![]}];}_0x51ce50=_['merge']({},_0x51ce50,_0x1fc6b8['options']);return db[_0x2e9f('0x35')][_0x2e9f('0x4f')](_0x51ce50)['then'](handleEntityNotFound(_0x31b3cc,null))[_0x2e9f('0x1a')](respondWithResult(_0x31b3cc,null))[_0x2e9f('0x24')](handleError(_0x31b3cc,null));};exports[_0x2e9f('0x50')]=function(_0x4f0ade,_0x3817fa,_0x39bb9b){var _0x383feb;return db['sequelize'][_0x2e9f('0x51')](function(_0x4d0a8f){return db[_0x2e9f('0x35')][_0x2e9f('0x50')](_0x4f0ade[_0x2e9f('0x52')],{'raw':!![]})[_0x2e9f('0x1a')](function(_0x4e65bc){_0x383feb=_0x4e65bc;return db[_0x2e9f('0x35')][_0x2e9f('0x4a')]({'where':{'type':_0x4f0ade[_0x2e9f('0x52')][_0x2e9f('0x46')]},'raw':!![]});})['then'](function(_0x597068){if(_0x383feb[_0x2e9f('0x46')]['toUpperCase']()==_0x2e9f('0x53')){var _0x210152=fs[_0x2e9f('0x54')](path[_0x2e9f('0x55')](config[_0x2e9f('0x56')],_0x2e9f('0x57')),_0x2e9f('0x58'));var _0x6b3185=ejs[_0x2e9f('0x59')](_0x210152,{'networks':_0x597068||[]});fs['writeFileSync'](_0x2e9f('0x5a'),_0x6b3185);return respondWithRpcPromise(_0x2e9f('0x5b'),'create',{'module':_0x2e9f('0x5c')});}else if(_0x383feb[_0x2e9f('0x46')][_0x2e9f('0x5d')]()==_0x2e9f('0x5e')){var _0x18e12a=fs['readFileSync'](path[_0x2e9f('0x55')](config[_0x2e9f('0x56')],'server/files/templates/turn_multiple.ejs'),_0x2e9f('0x58'));var _0x500fc3=ejs[_0x2e9f('0x59')](_0x18e12a,{'networks':_0x597068||[]});fs[_0x2e9f('0x5f')](_0x2e9f('0x60'),_0x500fc3);return respondWithRpcPromise('Reload',_0x2e9f('0x50'),{'module':'res_stun_monitor.so'});}else{var _0x1f1326=fs[_0x2e9f('0x54')](path[_0x2e9f('0x55')](config['root'],_0x2e9f('0x61')),'utf8');var _0x1e3baf=ejs[_0x2e9f('0x59')](_0x1f1326,{'networks':_0x597068||[]});fs[_0x2e9f('0x5f')](util[_0x2e9f('0x62')](_0x2e9f('0x63'),_0x4f0ade[_0x2e9f('0x52')][_0x2e9f('0x46')]['toLowerCase']()),_0x1e3baf);return respondWithRpcPromise(_0x2e9f('0x5b'),'create',{'module':_0x2e9f('0x64')});}return null;})[_0x2e9f('0x1a')](function(){return _0x383feb;});})['then'](respondWithResult(_0x3817fa,0xc9))[_0x2e9f('0x24')](handleError(_0x3817fa,null));};exports['update']=function(_0x4aa893,_0x103953,_0x235f12){var _0x3241f4;return db[_0x2e9f('0x65')]['transaction'](function(_0x41127c){return db[_0x2e9f('0x35')]['find']({'where':{'id':_0x4aa893[_0x2e9f('0x4c')]['id']}})[_0x2e9f('0x1a')](handleEntityNotFound(_0x103953,null))[_0x2e9f('0x1a')](saveUpdates(_0x4aa893[_0x2e9f('0x52')],null))['then'](function(_0x26648e){if(_0x26648e){_0x3241f4=_0x26648e;return db[_0x2e9f('0x35')]['findAll']({'where':{'type':_0x3241f4['type']},'raw':!![]});}return null;})[_0x2e9f('0x1a')](function(_0x6b2697){if(_0x3241f4[_0x2e9f('0x46')][_0x2e9f('0x5d')]()==_0x2e9f('0x53')){var _0xb5cd3e=fs[_0x2e9f('0x54')](path['join'](config[_0x2e9f('0x56')],_0x2e9f('0x57')),_0x2e9f('0x58'));var _0x43f240=ejs['render'](_0xb5cd3e,{'networks':_0x6b2697||[]});fs[_0x2e9f('0x5f')](_0x2e9f('0x5a'),_0x43f240);return respondWithRpcPromise(_0x2e9f('0x5b'),_0x2e9f('0x2f'),{'module':_0x2e9f('0x5c')});}else if(_0x3241f4[_0x2e9f('0x46')][_0x2e9f('0x5d')]()==_0x2e9f('0x5e')){var _0x53871d=fs[_0x2e9f('0x54')](path[_0x2e9f('0x55')](config[_0x2e9f('0x56')],'server/files/templates/turn_multiple.ejs'),_0x2e9f('0x58'));var _0x45058a=ejs[_0x2e9f('0x59')](_0x53871d,{'networks':_0x6b2697||[]});fs[_0x2e9f('0x5f')](_0x2e9f('0x60'),_0x45058a);return respondWithRpcPromise(_0x2e9f('0x5b'),_0x2e9f('0x2f'),{'module':_0x2e9f('0x5c')});}else{var _0x33b164=fs['readFileSync'](path['join'](config[_0x2e9f('0x56')],_0x2e9f('0x61')),_0x2e9f('0x58'));var _0xcd0fe4=ejs[_0x2e9f('0x59')](_0x33b164,{'networks':_0x6b2697||[]});fs['writeFileSync'](util[_0x2e9f('0x62')](_0x2e9f('0x63'),_0x4aa893['body'][_0x2e9f('0x46')]['toLowerCase']()),_0xcd0fe4);return respondWithRpcPromise(_0x2e9f('0x5b'),_0x2e9f('0x2f'),{'module':_0x2e9f('0x64')});}return null;})[_0x2e9f('0x1a')](function(_0x18890c){if(_0x18890c){return _0x3241f4;}return null;});})['then'](respondWithResult(_0x103953,null))[_0x2e9f('0x24')](handleError(_0x103953,null));};exports['destroy']=function(_0x3edee3,_0x2b5e6e,_0x2fb3de){var _0x495dee;return db[_0x2e9f('0x35')][_0x2e9f('0x4f')]({'where':{'id':_0x3edee3[_0x2e9f('0x4c')]['id']}})[_0x2e9f('0x1a')](function(_0x3b1e8a){_0x495dee=_0x3b1e8a;return _0x3b1e8a;})[_0x2e9f('0x1a')](handleEntityNotFound(_0x2b5e6e,null))['then'](removeEntity(_0x2b5e6e,null))[_0x2e9f('0x1a')](function(){if(_0x495dee){return db['Network'][_0x2e9f('0x4a')]({'where':{'type':_0x495dee[_0x2e9f('0x46')]},'raw':!![]});}})[_0x2e9f('0x1a')](function(_0x5ac007){if(_0x495dee[_0x2e9f('0x46')][_0x2e9f('0x5d')]()==_0x2e9f('0x53')){var _0x10b9fd=fs[_0x2e9f('0x54')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0x2e9f('0x58'));var _0x5969e3=ejs['render'](_0x10b9fd,{'networks':_0x5ac007||[]});fs[_0x2e9f('0x5f')](_0x2e9f('0x5a'),_0x5969e3);return respondWithRpcPromise('Reload',_0x2e9f('0x66'),{'module':_0x2e9f('0x5c')});}else if(_0x495dee['type']['toUpperCase']()==_0x2e9f('0x5e')){var _0x3ea76b=fs['readFileSync'](path[_0x2e9f('0x55')](config[_0x2e9f('0x56')],_0x2e9f('0x67')),_0x2e9f('0x58'));var _0x1d131c=ejs[_0x2e9f('0x59')](_0x3ea76b,{'networks':_0x5ac007||[]});fs[_0x2e9f('0x5f')](_0x2e9f('0x60'),_0x1d131c);return respondWithRpcPromise('Reload','destroy',{'module':_0x2e9f('0x5c')});}else{var _0x48603c=fs[_0x2e9f('0x54')](path['join'](config['root'],_0x2e9f('0x61')),_0x2e9f('0x58'));var _0x1b2828=ejs[_0x2e9f('0x59')](_0x48603c,{'networks':_0x5ac007||[]});fs['writeFileSync'](util[_0x2e9f('0x62')](_0x2e9f('0x63'),_0x3edee3[_0x2e9f('0x52')]['type']['toLowerCase']()),_0x1b2828);return respondWithRpcPromise('Reload',_0x2e9f('0x66'),{'module':_0x2e9f('0x64')});}return null;})[_0x2e9f('0x24')](handleError(_0x2b5e6e,null));}; \ No newline at end of file +var _0x01dd=['toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/network.ejs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../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','debug','request\x20sent','stringify','error','code','message','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','end','stack','name','send','index','map','Network','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','where','merge','include','findAll','show','params','rawAttributes','length','includeAll','options','find','catch','transaction','create','body'];(function(_0x2609e9,_0x4fa3ba){var _0x47a5a2=function(_0x2bba3d){while(--_0x2bba3d){_0x2609e9['push'](_0x2609e9['shift']());}};_0x47a5a2(++_0x4fa3ba);}(_0x01dd,0x1b0));var _0xd01d=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x01dd[_0x1e2321];return _0x1d346d;};'use strict';var pdf=require(_0xd01d('0x0'));var emlformat=require(_0xd01d('0x1'));var rimraf=require(_0xd01d('0x2'));var zipdir=require(_0xd01d('0x3'));var jsonpatch=require(_0xd01d('0x4'));var rp=require(_0xd01d('0x5'));var moment=require(_0xd01d('0x6'));var BPromise=require(_0xd01d('0x7'));var Mustache=require('mustache');var util=require(_0xd01d('0x8'));var path=require(_0xd01d('0x9'));var sox=require(_0xd01d('0xa'));var csv=require(_0xd01d('0xb'));var ejs=require(_0xd01d('0xc'));var fs=require('fs');var _=require(_0xd01d('0xd'));var squel=require(_0xd01d('0xe'));var crypto=require(_0xd01d('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd01d('0xb'));var querystring=require(_0xd01d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd01d('0x11'));var qs=require(_0xd01d('0x12'));var as=require(_0xd01d('0x13'));var hardwareService=require(_0xd01d('0x14'));var logger=require(_0xd01d('0x15'))(_0xd01d('0x16'));var utils=require(_0xd01d('0x17'));var config=require(_0xd01d('0x18'));var licenseUtil=require(_0xd01d('0x19'));var db=require(_0xd01d('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x895491,_0x751578,_0x4575b3,_0x3490d2){return new BPromise(function(_0x412ae9,_0x31ff8d){var _0x18da09=_0x3490d2||client;return _0x18da09[_0xd01d('0x1b')](_0x895491,_0x4575b3)[_0xd01d('0x1c')](function(_0x2c4836){logger[_0xd01d('0x1d')](_0xd01d('0x1e'),_0x751578,'request\x20sent');logger[_0xd01d('0x1f')]('Network,\x20%s,\x20%s,\x20%s',_0x751578,_0xd01d('0x20'),JSON[_0xd01d('0x21')](_0x2c4836));if(_0x2c4836[_0xd01d('0x22')]){if(_0x2c4836[_0xd01d('0x22')][_0xd01d('0x23')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x751578,_0x2c4836['error']['message']);return _0x31ff8d(_0x2c4836[_0xd01d('0x22')][_0xd01d('0x24')]);}logger['error'](_0xd01d('0x1e'),_0x751578,_0x2c4836[_0xd01d('0x22')][_0xd01d('0x24')]);return _0x412ae9(_0x2c4836[_0xd01d('0x22')][_0xd01d('0x24')]);}else{logger['info'](_0xd01d('0x1e'),_0x751578,'request\x20sent');_0x412ae9(_0x2c4836['result'][_0xd01d('0x24')]);}})['catch'](function(_0x1fc379){logger[_0xd01d('0x22')](_0xd01d('0x1e'),_0x751578,_0x1fc379);_0x31ff8d(_0x1fc379);});});}function respondWithStatusCode(_0x4fe02a,_0x253869){_0x253869=_0x253869||0xcc;return function(_0x6a915f){if(_0x6a915f){return _0x4fe02a[_0xd01d('0x25')](_0x253869);}return _0x4fe02a[_0xd01d('0x26')](_0x253869)['end']();};}function respondWithResult(_0x43b2c6,_0x5d8382){_0x5d8382=_0x5d8382||0xc8;return function(_0x2d9f20){if(_0x2d9f20){return _0x43b2c6[_0xd01d('0x26')](_0x5d8382)[_0xd01d('0x27')](_0x2d9f20);}};}function respondWithFilteredResult(_0x2b1c7a,_0x3500ec){return function(_0x3e3393){if(_0x3e3393){var _0x7e815c=_0x3e3393[_0xd01d('0x28')],_0xe5f4ad=_0x3500ec[_0xd01d('0x29')],_0x3393ac=_0x3500ec['offset']+_0x3500ec[_0xd01d('0x2a')],_0x529011;if(_0x3393ac>=_0x7e815c){_0x3393ac=_0x7e815c;_0x529011=0xc8;}else{_0x529011=0xce;}_0x2b1c7a[_0xd01d('0x26')](_0x529011);return _0x2b1c7a['set'](_0xd01d('0x2b'),_0xe5f4ad+'-'+_0x3393ac+'/'+_0x7e815c)[_0xd01d('0x27')](_0x3e3393);}return null;};}function patchUpdates(_0x393c5c){return function(_0x4ba2d5){try{jsonpatch[_0xd01d('0x2c')](_0x4ba2d5,_0x393c5c,!![]);}catch(_0x5c4e4a){return BPromise['reject'](_0x5c4e4a);}return _0x4ba2d5[_0xd01d('0x2d')]();};}function saveUpdates(_0x500101,_0x43cf26){return function(_0x128d0d){if(_0x128d0d){return _0x128d0d[_0xd01d('0x2e')](_0x500101)['then'](function(_0x263057){return _0x263057;});}return null;};}function removeEntity(_0x31d48e,_0x46bbaa){return function(_0x20c425){if(_0x20c425){return _0x20c425[_0xd01d('0x2f')]()[_0xd01d('0x1c')](function(){_0x31d48e[_0xd01d('0x26')](0xcc)[_0xd01d('0x30')]();});}};}function handleEntityNotFound(_0x1cb38d,_0x4e733f){return function(_0x460881){if(!_0x460881){_0x1cb38d[_0xd01d('0x25')](0x194);}return _0x460881;};}function handleError(_0x468466,_0x3fdf22){_0x3fdf22=_0x3fdf22||0x1f4;return function(_0x4f2853){logger['error'](_0x4f2853[_0xd01d('0x31')]);if(_0x4f2853['name']){delete _0x4f2853[_0xd01d('0x32')];}_0x468466[_0xd01d('0x26')](_0x3fdf22)[_0xd01d('0x33')](_0x4f2853);};}exports[_0xd01d('0x34')]=function(_0x2c039c,_0x27116a){var _0x5403e9={},_0x2b7c60={},_0x3aa966={'count':0x0,'rows':[]};var _0x2cf5fd=_[_0xd01d('0x35')](db[_0xd01d('0x36')]['rawAttributes'],function(_0x9d2ec3){return{'name':_0x9d2ec3[_0xd01d('0x37')],'type':_0x9d2ec3[_0xd01d('0x38')][_0xd01d('0x39')]};});_0x2b7c60[_0xd01d('0x3a')]=_[_0xd01d('0x35')](_0x2cf5fd,_0xd01d('0x32'));_0x2b7c60[_0xd01d('0x3b')]=_[_0xd01d('0x3c')](_0x2c039c['query']);_0x2b7c60[_0xd01d('0x3d')]=_[_0xd01d('0x3e')](_0x2b7c60[_0xd01d('0x3a')],_0x2b7c60[_0xd01d('0x3b')]);_0x5403e9[_0xd01d('0x3f')]=_[_0xd01d('0x3e')](_0x2b7c60[_0xd01d('0x3a')],qs['fields'](_0x2c039c[_0xd01d('0x3b')][_0xd01d('0x40')]));_0x5403e9[_0xd01d('0x3f')]=_0x5403e9['attributes']['length']?_0x5403e9['attributes']:_0x2b7c60[_0xd01d('0x3a')];if(!_0x2c039c[_0xd01d('0x3b')][_0xd01d('0x41')]('nolimit')){_0x5403e9['limit']=qs['limit'](_0x2c039c[_0xd01d('0x3b')][_0xd01d('0x2a')]);_0x5403e9['offset']=qs[_0xd01d('0x29')](_0x2c039c[_0xd01d('0x3b')]['offset']);}_0x5403e9['order']=qs[_0xd01d('0x42')](_0x2c039c[_0xd01d('0x3b')][_0xd01d('0x42')]);_0x5403e9['where']=qs['filters'](_[_0xd01d('0x43')](_0x2c039c['query'],_0x2b7c60['filters']),_0x2cf5fd);if(_0x2c039c[_0xd01d('0x3b')]['filter']){_0x5403e9[_0xd01d('0x44')]=_[_0xd01d('0x45')](_0x5403e9[_0xd01d('0x44')],{'$or':_['map'](_0x2cf5fd,function(_0x1ac35f){if(_0x1ac35f[_0xd01d('0x38')]!=='VIRTUAL'){var _0x134dc4={};_0x134dc4[_0x1ac35f[_0xd01d('0x32')]]={'$like':'%'+_0x2c039c[_0xd01d('0x3b')]['filter']+'%'};return _0x134dc4;}})});}_0x5403e9=_[_0xd01d('0x45')]({},_0x5403e9,_0x2c039c['options']);var _0x1a0950={'where':_0x5403e9['where']};return db['Network']['count'](_0x1a0950)[_0xd01d('0x1c')](function(_0x20d009){_0x3aa966['count']=_0x20d009;if(_0x2c039c[_0xd01d('0x3b')]['includeAll']){_0x5403e9[_0xd01d('0x46')]=[{'all':!![]}];}return db[_0xd01d('0x36')][_0xd01d('0x47')](_0x5403e9);})[_0xd01d('0x1c')](function(_0x22e6e9){_0x3aa966['rows']=_0x22e6e9;return _0x3aa966;})[_0xd01d('0x1c')](respondWithFilteredResult(_0x27116a,_0x5403e9))['catch'](handleError(_0x27116a,null));};exports[_0xd01d('0x48')]=function(_0x5a4a0d,_0x350c56){var _0x302b05={'raw':!![],'where':{'id':_0x5a4a0d[_0xd01d('0x49')]['id']}},_0x2fe5d0={};_0x2fe5d0[_0xd01d('0x3a')]=_[_0xd01d('0x3c')](db[_0xd01d('0x36')][_0xd01d('0x4a')]);_0x2fe5d0['query']=_[_0xd01d('0x3c')](_0x5a4a0d[_0xd01d('0x3b')]);_0x2fe5d0[_0xd01d('0x3d')]=_[_0xd01d('0x3e')](_0x2fe5d0['model'],_0x2fe5d0[_0xd01d('0x3b')]);_0x302b05['attributes']=_[_0xd01d('0x3e')](_0x2fe5d0[_0xd01d('0x3a')],qs[_0xd01d('0x40')](_0x5a4a0d[_0xd01d('0x3b')][_0xd01d('0x40')]));_0x302b05[_0xd01d('0x3f')]=_0x302b05['attributes'][_0xd01d('0x4b')]?_0x302b05['attributes']:_0x2fe5d0['model'];if(_0x5a4a0d[_0xd01d('0x3b')][_0xd01d('0x4c')]){_0x302b05[_0xd01d('0x46')]=[{'all':!![]}];}_0x302b05=_[_0xd01d('0x45')]({},_0x302b05,_0x5a4a0d[_0xd01d('0x4d')]);return db['Network'][_0xd01d('0x4e')](_0x302b05)['then'](handleEntityNotFound(_0x350c56,null))[_0xd01d('0x1c')](respondWithResult(_0x350c56,null))[_0xd01d('0x4f')](handleError(_0x350c56,null));};exports['create']=function(_0xbb3be,_0x33ccae,_0x450de6){var _0x35202a;return db['sequelize'][_0xd01d('0x50')](function(_0x34f9df){return db[_0xd01d('0x36')][_0xd01d('0x51')](_0xbb3be[_0xd01d('0x52')],{'raw':!![]})[_0xd01d('0x1c')](function(_0x56b5c8){_0x35202a=_0x56b5c8;return db[_0xd01d('0x36')][_0xd01d('0x47')]({'where':{'type':_0xbb3be[_0xd01d('0x52')]['type']},'raw':!![]});})[_0xd01d('0x1c')](function(_0x54642d){if(_0x35202a[_0xd01d('0x38')][_0xd01d('0x53')]()==_0xd01d('0x54')){var _0x6c3430=fs[_0xd01d('0x55')](path[_0xd01d('0x56')](config['root'],_0xd01d('0x57')),'utf8');var _0x11f2dd=ejs[_0xd01d('0x58')](_0x6c3430,{'networks':_0x54642d||[]});fs[_0xd01d('0x59')](_0xd01d('0x5a'),_0x11f2dd);return respondWithRpcPromise(_0xd01d('0x5b'),_0xd01d('0x51'),{'module':_0xd01d('0x5c')});}else if(_0x35202a['type'][_0xd01d('0x53')]()==_0xd01d('0x5d')){var _0x26cbd7=fs[_0xd01d('0x55')](path[_0xd01d('0x56')](config[_0xd01d('0x5e')],_0xd01d('0x5f')),_0xd01d('0x60'));var _0x5215f6=ejs[_0xd01d('0x58')](_0x26cbd7,{'networks':_0x54642d||[]});fs[_0xd01d('0x59')](_0xd01d('0x61'),_0x5215f6);return respondWithRpcPromise('Reload',_0xd01d('0x51'),{'module':_0xd01d('0x5c')});}else{var _0xf9ce4b=fs['readFileSync'](path[_0xd01d('0x56')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0xaca7b6=ejs[_0xd01d('0x58')](_0xf9ce4b,{'networks':_0x54642d||[]});fs['writeFileSync'](util[_0xd01d('0x62')](_0xd01d('0x63'),_0xbb3be[_0xd01d('0x52')][_0xd01d('0x38')][_0xd01d('0x64')]()),_0xaca7b6);return respondWithRpcPromise('Reload',_0xd01d('0x51'),{'module':_0xd01d('0x65')});}return null;})[_0xd01d('0x1c')](function(){return _0x35202a;});})['then'](respondWithResult(_0x33ccae,0xc9))[_0xd01d('0x4f')](handleError(_0x33ccae,null));};exports[_0xd01d('0x2e')]=function(_0x192bb1,_0x432de9,_0x4be3f2){var _0x47514a;return db['sequelize']['transaction'](function(_0x139144){return db[_0xd01d('0x36')][_0xd01d('0x4e')]({'where':{'id':_0x192bb1[_0xd01d('0x49')]['id']}})[_0xd01d('0x1c')](handleEntityNotFound(_0x432de9,null))[_0xd01d('0x1c')](saveUpdates(_0x192bb1[_0xd01d('0x52')],null))[_0xd01d('0x1c')](function(_0x13bb5a){if(_0x13bb5a){_0x47514a=_0x13bb5a;return db[_0xd01d('0x36')][_0xd01d('0x47')]({'where':{'type':_0x47514a[_0xd01d('0x38')]},'raw':!![]});}return null;})['then'](function(_0x1be627){if(_0x47514a[_0xd01d('0x38')][_0xd01d('0x53')]()==_0xd01d('0x54')){var _0x2179dc=fs[_0xd01d('0x55')](path[_0xd01d('0x56')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xd01d('0x60'));var _0x4c7f13=ejs['render'](_0x2179dc,{'networks':_0x1be627||[]});fs[_0xd01d('0x59')](_0xd01d('0x5a'),_0x4c7f13);return respondWithRpcPromise(_0xd01d('0x5b'),_0xd01d('0x2e'),{'module':_0xd01d('0x5c')});}else if(_0x47514a['type'][_0xd01d('0x53')]()==_0xd01d('0x5d')){var _0x521330=fs[_0xd01d('0x55')](path[_0xd01d('0x56')](config[_0xd01d('0x5e')],_0xd01d('0x5f')),_0xd01d('0x60'));var _0xccbd23=ejs[_0xd01d('0x58')](_0x521330,{'networks':_0x1be627||[]});fs['writeFileSync'](_0xd01d('0x61'),_0xccbd23);return respondWithRpcPromise(_0xd01d('0x5b'),_0xd01d('0x2e'),{'module':'res_stun_monitor.so'});}else{var _0xe219f3=fs[_0xd01d('0x55')](path['join'](config[_0xd01d('0x5e')],_0xd01d('0x66')),_0xd01d('0x60'));var _0x566d09=ejs['render'](_0xe219f3,{'networks':_0x1be627||[]});fs[_0xd01d('0x59')](util[_0xd01d('0x62')](_0xd01d('0x63'),_0x192bb1[_0xd01d('0x52')][_0xd01d('0x38')][_0xd01d('0x64')]()),_0x566d09);return respondWithRpcPromise('Reload',_0xd01d('0x2e'),{'module':_0xd01d('0x65')});}return null;})[_0xd01d('0x1c')](function(_0x13ad6f){if(_0x13ad6f){return _0x47514a;}return null;});})['then'](respondWithResult(_0x432de9,null))['catch'](handleError(_0x432de9,null));};exports['destroy']=function(_0x1792e1,_0x1e2866,_0x466ed1){var _0x58191;return db['Network']['find']({'where':{'id':_0x1792e1[_0xd01d('0x49')]['id']}})[_0xd01d('0x1c')](function(_0xf262fa){_0x58191=_0xf262fa;return _0xf262fa;})[_0xd01d('0x1c')](handleEntityNotFound(_0x1e2866,null))[_0xd01d('0x1c')](removeEntity(_0x1e2866,null))['then'](function(){if(_0x58191){return db[_0xd01d('0x36')][_0xd01d('0x47')]({'where':{'type':_0x58191[_0xd01d('0x38')]},'raw':!![]});}})['then'](function(_0x161380){if(_0x58191['type'][_0xd01d('0x53')]()==_0xd01d('0x54')){var _0x59b8e9=fs['readFileSync'](path['join'](config['root'],_0xd01d('0x57')),_0xd01d('0x60'));var _0x553a11=ejs[_0xd01d('0x58')](_0x59b8e9,{'networks':_0x161380||[]});fs[_0xd01d('0x59')]('/etc/asterisk/stun_xcally.conf',_0x553a11);return respondWithRpcPromise(_0xd01d('0x5b'),_0xd01d('0x2f'),{'module':'res_stun_monitor.so'});}else if(_0x58191[_0xd01d('0x38')][_0xd01d('0x53')]()==_0xd01d('0x5d')){var _0x4eaad7=fs[_0xd01d('0x55')](path[_0xd01d('0x56')](config[_0xd01d('0x5e')],_0xd01d('0x5f')),_0xd01d('0x60'));var _0xdf4c86=ejs[_0xd01d('0x58')](_0x4eaad7,{'networks':_0x161380||[]});fs[_0xd01d('0x59')](_0xd01d('0x61'),_0xdf4c86);return respondWithRpcPromise(_0xd01d('0x5b'),_0xd01d('0x2f'),{'module':'res_stun_monitor.so'});}else{var _0x5b6118=fs[_0xd01d('0x55')](path[_0xd01d('0x56')](config[_0xd01d('0x5e')],_0xd01d('0x66')),_0xd01d('0x60'));var _0x3356e3=ejs['render'](_0x5b6118,{'networks':_0x161380||[]});fs[_0xd01d('0x59')](util['format'](_0xd01d('0x63'),_0x1792e1['body'][_0xd01d('0x38')][_0xd01d('0x64')]()),_0x3356e3);return respondWithRpcPromise(_0xd01d('0x5b'),_0xd01d('0x2f'),{'module':_0xd01d('0x65')});}return null;})[_0xd01d('0x4f')](handleError(_0x1e2866,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 9035d47..cc9d636 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 _0x4b0b=['Network','network','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x613c9a,_0x184b28){var _0x3d1aec=function(_0x51c8d2){while(--_0x51c8d2){_0x613c9a['push'](_0x613c9a['shift']());}};_0x3d1aec(++_0x184b28);}(_0x4b0b,0x9e));var _0xb4b0=function(_0x37c1e5,_0xa7f246){_0x37c1e5=_0x37c1e5-0x0;var _0x4e33f2=_0x4b0b[_0x37c1e5];return _0x4e33f2;};'use strict';var _=require(_0xb4b0('0x0'));var util=require(_0xb4b0('0x1'));var logger=require(_0xb4b0('0x2'))('api');var moment=require(_0xb4b0('0x3'));var BPromise=require('bluebird');var rp=require(_0xb4b0('0x4'));var fs=require('fs');var path=require(_0xb4b0('0x5'));var rimraf=require(_0xb4b0('0x6'));var config=require(_0xb4b0('0x7'));var attributes=require('./network.attributes');module[_0xb4b0('0x8')]=function(_0x3b021f,_0x4d218c){return _0x3b021f[_0xb4b0('0x9')](_0xb4b0('0xa'),attributes,{'tableName':_0xb4b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fb4=['moment','bluebird','request-promise','../../config/environment','./network.attributes','exports','Network','network','../../config/logger','api'];(function(_0x480684,_0xd5064a){var _0x4bf4f4=function(_0x499b4a){while(--_0x499b4a){_0x480684['push'](_0x480684['shift']());}};_0x4bf4f4(++_0xd5064a);}(_0x2fb4,0x1b6));var _0x42fb=function(_0x3a91c5,_0x341c02){_0x3a91c5=_0x3a91c5-0x0;var _0x270c1b=_0x2fb4[_0x3a91c5];return _0x270c1b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x42fb('0x0'))(_0x42fb('0x1'));var moment=require(_0x42fb('0x2'));var BPromise=require(_0x42fb('0x3'));var rp=require(_0x42fb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x42fb('0x5'));var attributes=require(_0x42fb('0x6'));module[_0x42fb('0x7')]=function(_0x21b2da,_0x5f2c97){return _0x21b2da['define'](_0x42fb('0x8'),attributes,{'tableName':_0x42fb('0x9'),'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 c4b364d..42b76c2 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 _0xf4ba=['debug','stringify','error','code','message','info','Network,\x20%s,\x20%s','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0xf4ba,0x14a));var _0xaf4b=function(_0x2cfe0a,_0x4ece5d){_0x2cfe0a=_0x2cfe0a-0x0;var _0x34f366=_0xf4ba[_0x2cfe0a];return _0x34f366;};'use strict';var _=require(_0xaf4b('0x0'));var util=require(_0xaf4b('0x1'));var moment=require(_0xaf4b('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaf4b('0x4'));var logger=require(_0xaf4b('0x5'))(_0xaf4b('0x6'));var config=require('../../config/environment');var jayson=require(_0xaf4b('0x7'));var client=jayson[_0xaf4b('0x8')][_0xaf4b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a159f,_0x16c28d,_0x2bc967){return new BPromise(function(_0x381a5b,_0x212bbd){return client[_0xaf4b('0xa')](_0x3a159f,_0x2bc967)['then'](function(_0x366ebf){logger['info']('Network,\x20%s,\x20%s',_0x16c28d,_0xaf4b('0xb'));logger[_0xaf4b('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x16c28d,'request\x20sent',JSON[_0xaf4b('0xd')](_0x366ebf));if(_0x366ebf[_0xaf4b('0xe')]){if(_0x366ebf['error'][_0xaf4b('0xf')]===0x1f4){logger[_0xaf4b('0xe')]('Network,\x20%s,\x20%s',_0x16c28d,_0x366ebf[_0xaf4b('0xe')]['message']);return _0x212bbd(_0x366ebf['error'][_0xaf4b('0x10')]);}logger[_0xaf4b('0xe')]('Network,\x20%s,\x20%s',_0x16c28d,_0x366ebf[_0xaf4b('0xe')][_0xaf4b('0x10')]);return _0x381a5b(_0x366ebf[_0xaf4b('0xe')][_0xaf4b('0x10')]);}else{logger[_0xaf4b('0x11')]('Network,\x20%s,\x20%s',_0x16c28d,_0xaf4b('0xb'));_0x381a5b(_0x366ebf['result']['message']);}})['catch'](function(_0x392949){logger[_0xaf4b('0xe')](_0xaf4b('0x12'),_0x16c28d,_0x392949);_0x212bbd(_0x392949);});});} \ No newline at end of file +var _0x0507=['randomstring','../../mysqldb','../../config/utils','rpc','http','then','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util'];(function(_0x9ac89b,_0x25b61d){var _0x40da74=function(_0x2643a2){while(--_0x2643a2){_0x9ac89b['push'](_0x9ac89b['shift']());}};_0x40da74(++_0x25b61d);}(_0x0507,0xdb));var _0x7050=function(_0x167560,_0x2de78d){_0x167560=_0x167560-0x0;var _0x34e64e=_0x0507[_0x167560];return _0x34e64e;};'use strict';var _=require(_0x7050('0x0'));var util=require(_0x7050('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7050('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7050('0x3'))['db'];var utils=require(_0x7050('0x4'));var logger=require('../../config/logger')(_0x7050('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7050('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2a9235,_0x2c39a9,_0x469492){return new BPromise(function(_0x59d2b7,_0x1a4735){return client['request'](_0x2a9235,_0x469492)[_0x7050('0x7')](function(_0xf5d294){logger['info'](_0x7050('0x8'),_0x2c39a9,_0x7050('0x9'));logger['debug'](_0x7050('0xa'),_0x2c39a9,_0x7050('0x9'),JSON[_0x7050('0xb')](_0xf5d294));if(_0xf5d294['error']){if(_0xf5d294[_0x7050('0xc')]['code']===0x1f4){logger[_0x7050('0xc')](_0x7050('0x8'),_0x2c39a9,_0xf5d294['error']['message']);return _0x1a4735(_0xf5d294[_0x7050('0xc')][_0x7050('0xd')]);}logger[_0x7050('0xc')]('Network,\x20%s,\x20%s',_0x2c39a9,_0xf5d294[_0x7050('0xc')][_0x7050('0xd')]);return _0x59d2b7(_0xf5d294['error'][_0x7050('0xd')]);}else{logger[_0x7050('0xe')](_0x7050('0x8'),_0x2c39a9,_0x7050('0x9'));_0x59d2b7(_0xf5d294[_0x7050('0xf')][_0x7050('0xd')]);}})[_0x7050('0x10')](function(_0x531fb9){logger[_0x7050('0xc')](_0x7050('0x8'),_0x2c39a9,_0x531fb9);_0x1a4735(_0x531fb9);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 50ab33b..dde3cbe 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 _0xa2c0=['sendNotification','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./notification.controller','post','isAuthenticated'];(function(_0x5a2162,_0x5a90a3){var _0x4561a7=function(_0x11849e){while(--_0x11849e){_0x5a2162['push'](_0x5a2162['shift']());}};_0x4561a7(++_0x5a90a3);}(_0xa2c0,0x9b));var _0x0a2c=function(_0x216c9d,_0x1769a9){_0x216c9d=_0x216c9d-0x0;var _0x405aaa=_0xa2c0[_0x216c9d];return _0x405aaa;};'use strict';var multer=require(_0x0a2c('0x0'));var util=require(_0x0a2c('0x1'));var path=require(_0x0a2c('0x2'));var timeout=require(_0x0a2c('0x3'));var express=require(_0x0a2c('0x4'));var router=express[_0x0a2c('0x5')]();var auth=require(_0x0a2c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0a2c('0x7'));router[_0x0a2c('0x8')]('/',auth[_0x0a2c('0x9')](),controller[_0x0a2c('0xa')]);module['exports']=router; \ No newline at end of file +var _0xe999=['util','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports'];(function(_0x33977b,_0x730a0f){var _0xc7c81c=function(_0xa7d1e7){while(--_0xa7d1e7){_0x33977b['push'](_0x33977b['shift']());}};_0xc7c81c(++_0x730a0f);}(_0xe999,0x14d));var _0x9e99=function(_0x2e2a5f,_0x163bf3){_0x2e2a5f=_0x2e2a5f-0x0;var _0x445be7=_0xe999[_0x2e2a5f];return _0x445be7;};'use strict';var multer=require('multer');var util=require(_0x9e99('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x9e99('0x1'));var interaction=require(_0x9e99('0x2'));var config=require(_0x9e99('0x3'));var controller=require(_0x9e99('0x4'));router[_0x9e99('0x5')]('/',auth[_0x9e99('0x6')](),controller[_0x9e99('0x7')]);module[_0x9e99('0x8')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index a0274d5..373e4cb 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 _0xbfac=['BOOLEAN','exports','TEXT'];(function(_0x14965b,_0x5c98a0){var _0x512456=function(_0x427646){while(--_0x427646){_0x14965b['push'](_0x14965b['shift']());}};_0x512456(++_0x5c98a0);}(_0xbfac,0x17b));var _0xcbfa=function(_0x51b648,_0x3af80d){_0x51b648=_0x51b648-0x0;var _0x58a6e5=_0xbfac[_0x51b648];return _0x58a6e5;};'use strict';var Sequelize=require('sequelize');module[_0xcbfa('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xcbfa('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xcbfa('0x2')]}}; \ No newline at end of file +var _0xd7fd=['BOOLEAN','exports','TEXT','STRING'];(function(_0x47c8a3,_0x1a7e68){var _0xad9eef=function(_0x4e06f8){while(--_0x4e06f8){_0x47c8a3['push'](_0x47c8a3['shift']());}};_0xad9eef(++_0x1a7e68);}(_0xd7fd,0xbd));var _0xdd7f=function(_0x221637,_0x42a5e0){_0x221637=_0x221637-0x0;var _0x11bf9e=_0xd7fd[_0x221637];return _0x11bf9e;};'use strict';var Sequelize=require('sequelize');module[_0xdd7f('0x0')]={'body':{'type':Sequelize[_0xdd7f('0x1')]},'senderName':{'type':Sequelize[_0xdd7f('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xdd7f('0x2')]},'beep':{'type':Sequelize[_0xdd7f('0x3')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 6367344..8bc2bcd 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 _0xa3c1=['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','../../config/utils','../../config/environment','redis','localhost','./notification.socket','register','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','end','error','name','send','sendNotification','body','hasOwnProperty','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','voicequeue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','recipientsId','sortBy','sequelize','Notification','create','beep','forEach','catch','text','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','model','User','ids','queue','replace','Queue','all','union','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x422b48,_0xf131fb){var _0x4a6f67=function(_0x13309e){while(--_0x13309e){_0x422b48['push'](_0x422b48['shift']());}};_0x4a6f67(++_0xf131fb);}(_0xa3c1,0x117));var _0x1a3c=function(_0x178733,_0x4c9286){_0x178733=_0x178733-0x0;var _0xe295ae=_0xa3c1[_0x178733];return _0xe295ae;};'use strict';var pdf=require(_0x1a3c('0x0'));var emlformat=require(_0x1a3c('0x1'));var rimraf=require(_0x1a3c('0x2'));var zipdir=require(_0x1a3c('0x3'));var jsonpatch=require(_0x1a3c('0x4'));var rp=require(_0x1a3c('0x5'));var moment=require(_0x1a3c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1a3c('0x7'));var util=require(_0x1a3c('0x8'));var path=require(_0x1a3c('0x9'));var sox=require('sox');var csv=require(_0x1a3c('0xa'));var ejs=require(_0x1a3c('0xb'));var fs=require('fs');var _=require(_0x1a3c('0xc'));var squel=require(_0x1a3c('0xd'));var crypto=require(_0x1a3c('0xe'));var jsforce=require(_0x1a3c('0xf'));var deskjs=require(_0x1a3c('0x10'));var toCsv=require(_0x1a3c('0xa'));var querystring=require(_0x1a3c('0x11'));var Papa=require(_0x1a3c('0x12'));var Redis=require(_0x1a3c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1a3c('0x14'));var as=require(_0x1a3c('0x15'));var hardwareService=require(_0x1a3c('0x16'));var logger=require(_0x1a3c('0x17'))('api');var utils=require(_0x1a3c('0x18'));var config=require(_0x1a3c('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1a3c('0x1a')]=_['defaults'](config['redis'],{'host':_0x1a3c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a3c('0x1a')]));require(_0x1a3c('0x1c'))[_0x1a3c('0x1d')](socket);function respondWithStatusCode(_0x11f341,_0x1a02b4){_0x1a02b4=_0x1a02b4||0xcc;return function(_0x2fd79f){if(_0x2fd79f){return _0x11f341[_0x1a3c('0x1e')](_0x1a02b4);}return _0x11f341[_0x1a3c('0x1f')](_0x1a02b4)['end']();};}function respondWithResult(_0x530f0b,_0x4db394){_0x4db394=_0x4db394||0xc8;return function(_0x55ef9e){if(_0x55ef9e){return _0x530f0b[_0x1a3c('0x1f')](_0x4db394)[_0x1a3c('0x20')](_0x55ef9e);}};}function respondWithFilteredResult(_0x4e1899,_0x4d861f){return function(_0xbec5be){if(_0xbec5be){var _0x16266b=_0xbec5be[_0x1a3c('0x21')],_0x1be00f=_0x4d861f[_0x1a3c('0x22')],_0x3bece7=_0x4d861f[_0x1a3c('0x22')]+_0x4d861f[_0x1a3c('0x23')],_0x45fc17;if(_0x3bece7>=_0x16266b){_0x3bece7=_0x16266b;_0x45fc17=0xc8;}else{_0x45fc17=0xce;}_0x4e1899[_0x1a3c('0x1f')](_0x45fc17);return _0x4e1899['set']('Content-Range',_0x1be00f+'-'+_0x3bece7+'/'+_0x16266b)[_0x1a3c('0x20')](_0xbec5be);}return null;};}function patchUpdates(_0x439939){return function(_0x5ecc40){try{jsonpatch[_0x1a3c('0x24')](_0x5ecc40,_0x439939,!![]);}catch(_0x4bef2a){return BPromise[_0x1a3c('0x25')](_0x4bef2a);}return _0x5ecc40[_0x1a3c('0x26')]();};}function saveUpdates(_0x532317,_0x445da7){return function(_0x323049){if(_0x323049){return _0x323049[_0x1a3c('0x27')](_0x532317)[_0x1a3c('0x28')](function(_0x57c227){return _0x57c227;});}return null;};}function removeEntity(_0x21fece,_0x5224e9){return function(_0x15632b){if(_0x15632b){return _0x15632b[_0x1a3c('0x29')]()[_0x1a3c('0x28')](function(){_0x21fece[_0x1a3c('0x1f')](0xcc)[_0x1a3c('0x2a')]();});}};}function handleEntityNotFound(_0x29591f,_0x245367){return function(_0x22bcaf){if(!_0x22bcaf){_0x29591f['sendStatus'](0x194);}return _0x22bcaf;};}function handleError(_0x1f3da1,_0x2f7465){_0x2f7465=_0x2f7465||0x1f4;return function(_0x50d371){logger[_0x1a3c('0x2b')](_0x50d371['stack']);if(_0x50d371['name']){delete _0x50d371[_0x1a3c('0x2c')];}_0x1f3da1[_0x1a3c('0x1f')](_0x2f7465)[_0x1a3c('0x2d')](_0x50d371);};}exports[_0x1a3c('0x2e')]=function(_0x5d701b,_0x33ce00,_0x1dd388){if(!_0x5d701b[_0x1a3c('0x2f')][_0x1a3c('0x30')]('text')&&!_0x5d701b[_0x1a3c('0x2f')][_0x1a3c('0x30')](_0x1a3c('0x31'))){throw new db['Sequelize']['ValidationError'](_0x1a3c('0x32'));}else{if(_0x5d701b[_0x1a3c('0x2f')][_0x1a3c('0x30')](_0x1a3c('0x31'))&&!_0x5d701b[_0x1a3c('0x2f')]['hasOwnProperty'](_0x1a3c('0x33'))){throw new db[(_0x1a3c('0x34'))][(_0x1a3c('0x35'))](_0x1a3c('0x36'));}if(!_0x5d701b[_0x1a3c('0x2f')][_0x1a3c('0x30')](_0x1a3c('0x37'))){throw new db[(_0x1a3c('0x34'))][(_0x1a3c('0x35'))](_0x1a3c('0x38'));}else{try{var _0x3bdb7b=JSON[_0x1a3c('0x39')](_0x5d701b[_0x1a3c('0x2f')]['recipients']);}catch(_0x21dbf9){logger[_0x1a3c('0x2b')](_0x21dbf9);throw new db[(_0x1a3c('0x34'))]['ValidationError'](_0x1a3c('0x3a'));}var _0x30ff13=['chatqueue',_0x1a3c('0x3b'),'mailqueue','openchannelqueue','smsqueue',_0x1a3c('0x3c'),'whatsappqueue',_0x1a3c('0x3d'),_0x1a3c('0x3e')];if(_[_0x1a3c('0x3f')](_0x3bdb7b,function(_0x30ffee){return!_[_0x1a3c('0x40')](_0x30ff13,_0x30ffee['model'][_0x1a3c('0x41')]());})){throw new db[(_0x1a3c('0x34'))][(_0x1a3c('0x35'))](_0x1a3c('0x42'));}}}var _0x38330d={};_0x38330d[_0x1a3c('0x43')]=_0x5d701b[_0x1a3c('0x2f')]['hasOwnProperty'](_0x1a3c('0x43'))?_0x5d701b[_0x1a3c('0x2f')][_0x1a3c('0x43')]:_0x5d701b[_0x1a3c('0x3e')][_0x1a3c('0x44')];_0x38330d['recipientsDescription']=_[_0x1a3c('0x45')](_0x5d701b[_0x1a3c('0x2f')][_0x1a3c('0x46')])?null:_0x5d701b[_0x1a3c('0x2f')][_0x1a3c('0x46')];_0x38330d['beep']=_0x5d701b[_0x1a3c('0x2f')]['beep']||![];_0x38330d['SenderId']=_0x5d701b[_0x1a3c('0x3e')]['id'];return getContent(_0x5d701b['body'])[_0x1a3c('0x28')](function(_0x35b147){_0x38330d[_0x1a3c('0x2f')]=_0x35b147;return getRecipients(_0x3bdb7b);})[_0x1a3c('0x28')](function(_0x580252){_0x38330d[_0x1a3c('0x47')]=_[_0x1a3c('0x48')](_0x580252)['join'](',');return db[_0x1a3c('0x49')]['transaction'](function(_0x250444){return db[_0x1a3c('0x4a')][_0x1a3c('0x4b')](_0x38330d,{'raw':!![],'transaction':_0x250444})['then'](function(_0x559c6d){var _0xac2f={'sender':_0x38330d[_0x1a3c('0x43')],'description':_0x38330d[_0x1a3c('0x46')],'content':_0x38330d[_0x1a3c('0x2f')],'beep':_0x38330d[_0x1a3c('0x4c')]};_0x580252[_0x1a3c('0x4d')](function(_0x3f1f13){_0xac2f['recipient']=_0x3f1f13;socket['emit']('notification:send',_0xac2f);});return _0x559c6d;});});})['then'](respondWithResult(_0x33ce00,0xc9))[_0x1a3c('0x4e')](handleError(_0x33ce00,null));};function getContent(_0x16197f){return new BPromise(function(_0x2d8e0a,_0x1ca304){if(_0x16197f['text']){_0x2d8e0a(_0x16197f[_0x1a3c('0x4f')]);return;}return db[_0x1a3c('0x50')]['findOne']({'attributes':['html'],'where':{'id':_0x16197f['TemplateId']},'raw':!![]})[_0x1a3c('0x28')](function(_0x397e69){if(!_0x397e69)throw new db['Sequelize'][(_0x1a3c('0x35'))](_0x1a3c('0x51'));var _0xb85b52=Mustache[_0x1a3c('0x52')](_0x397e69[_0x1a3c('0x53')],_0x16197f[_0x1a3c('0x33')]);_0x2d8e0a(_0xb85b52);})[_0x1a3c('0x4e')](function(_0x33fa9){_0x1ca304(_0x33fa9);});});}function getRecipients(_0x5d4698){return new BPromise(function(_0xeb6235,_0x1153dc){var _0x1b1c31=[];var _0x5e4819=[];_0x5d4698[_0x1a3c('0x4d')](function(_0x119794){var _0x2aabe7=_[_0x1a3c('0x54')](_0x119794[_0x1a3c('0x55')][_0x1a3c('0x41')]());if(_0x2aabe7===_0x1a3c('0x56')){_0x1b1c31=_['union'](_0x1b1c31,_0x119794[_0x1a3c('0x57')]);}else{if(_[_0x1a3c('0x40')](_0x2aabe7,_0x1a3c('0x58')))_0x2aabe7=_0x2aabe7[_0x1a3c('0x59')](_0x1a3c('0x58'),_0x1a3c('0x5a'));_0x119794[_0x1a3c('0x57')][_0x1a3c('0x4d')](function(_0x30f9e2){_0x5e4819['push'](getAgents(_0x2aabe7,_0x30f9e2));});}});return BPromise[_0x1a3c('0x5b')](_0x5e4819)[_0x1a3c('0x28')](function(_0x4949f6){_0x1b1c31=_[_0x1a3c('0x5c')](_0x1b1c31,_['flatten'](_0x4949f6));_0xeb6235(_0x1b1c31);})[_0x1a3c('0x4e')](function(_0xa0ad64){_0x1153dc(_0xa0ad64);});});}function getAgents(_0x5cb2fc,_0x1ef957){return new BPromise(function(_0x450c8c,_0x267e3d){return db[_0x5cb2fc]['findOne']({'where':{'id':_0x1ef957}})[_0x1a3c('0x28')](function(_0x3ac50b){return _0x3ac50b[_0x1a3c('0x5d')]({'attributes':['id'],'raw':!![]})[_0x1a3c('0x28')](function(_0x539886){var _0xdc6a1a=_[_0x1a3c('0x5e')](_0x539886,'id');_0x450c8c(_0xdc6a1a);});})[_0x1a3c('0x4e')](function(_0x53e6e9){_0x267e3d(_0x53e6e9);});});} \ No newline at end of file +var _0x20f5=['Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','Notification','create','forEach','recipient','emit','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','model','union','ids','queue','getAgents','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','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','./notification.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','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','recipients'];(function(_0x50a9e3,_0x2a24ab){var _0x166071=function(_0x192687){while(--_0x192687){_0x50a9e3['push'](_0x50a9e3['shift']());}};_0x166071(++_0x2a24ab);}(_0x20f5,0x8f));var _0x520f=function(_0xf383dc,_0x3bfa5a){_0xf383dc=_0xf383dc-0x0;var _0x42836c=_0x20f5[_0xf383dc];return _0x42836c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x520f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x520f('0x1'));var jsonpatch=require(_0x520f('0x2'));var rp=require(_0x520f('0x3'));var moment=require(_0x520f('0x4'));var BPromise=require(_0x520f('0x5'));var Mustache=require(_0x520f('0x6'));var util=require(_0x520f('0x7'));var path=require(_0x520f('0x8'));var sox=require(_0x520f('0x9'));var csv=require(_0x520f('0xa'));var ejs=require(_0x520f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x520f('0xc'));var crypto=require(_0x520f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x520f('0xe'));var toCsv=require(_0x520f('0xa'));var querystring=require(_0x520f('0xf'));var Papa=require(_0x520f('0x10'));var Redis=require(_0x520f('0x11'));var authService=require(_0x520f('0x12'));var qs=require(_0x520f('0x13'));var as=require(_0x520f('0x14'));var hardwareService=require(_0x520f('0x15'));var logger=require('../../config/logger')(_0x520f('0x16'));var utils=require(_0x520f('0x17'));var config=require(_0x520f('0x18'));var licenseUtil=require(_0x520f('0x19'));var db=require(_0x520f('0x1a'))['db'];config[_0x520f('0x1b')]=_[_0x520f('0x1c')](config[_0x520f('0x1b')],{'host':_0x520f('0x1d'),'port':0x18eb});var socket=require(_0x520f('0x1e'))(new Redis(config[_0x520f('0x1b')]));require(_0x520f('0x1f'))[_0x520f('0x20')](socket);function respondWithStatusCode(_0x1fca69,_0x405b73){_0x405b73=_0x405b73||0xcc;return function(_0x3c73f3){if(_0x3c73f3){return _0x1fca69[_0x520f('0x21')](_0x405b73);}return _0x1fca69[_0x520f('0x22')](_0x405b73)[_0x520f('0x23')]();};}function respondWithResult(_0x327e1d,_0x2eda6f){_0x2eda6f=_0x2eda6f||0xc8;return function(_0xb56390){if(_0xb56390){return _0x327e1d[_0x520f('0x22')](_0x2eda6f)[_0x520f('0x24')](_0xb56390);}};}function respondWithFilteredResult(_0xc87753,_0x4a890a){return function(_0x583856){if(_0x583856){var _0x496593=_0x583856[_0x520f('0x25')],_0x328900=_0x4a890a[_0x520f('0x26')],_0x3c7743=_0x4a890a[_0x520f('0x26')]+_0x4a890a[_0x520f('0x27')],_0x3d4c81;if(_0x3c7743>=_0x496593){_0x3c7743=_0x496593;_0x3d4c81=0xc8;}else{_0x3d4c81=0xce;}_0xc87753['status'](_0x3d4c81);return _0xc87753[_0x520f('0x28')](_0x520f('0x29'),_0x328900+'-'+_0x3c7743+'/'+_0x496593)[_0x520f('0x24')](_0x583856);}return null;};}function patchUpdates(_0x1a7003){return function(_0x3fbaf7){try{jsonpatch[_0x520f('0x2a')](_0x3fbaf7,_0x1a7003,!![]);}catch(_0x2cafcd){return BPromise[_0x520f('0x2b')](_0x2cafcd);}return _0x3fbaf7['save']();};}function saveUpdates(_0x5da1ff,_0x9a0adc){return function(_0x42cf1d){if(_0x42cf1d){return _0x42cf1d[_0x520f('0x2c')](_0x5da1ff)[_0x520f('0x2d')](function(_0x32d930){return _0x32d930;});}return null;};}function removeEntity(_0x4c947e,_0x542fbc){return function(_0x4a6a97){if(_0x4a6a97){return _0x4a6a97['destroy']()[_0x520f('0x2d')](function(){_0x4c947e[_0x520f('0x22')](0xcc)[_0x520f('0x23')]();});}};}function handleEntityNotFound(_0x23ab00,_0x2f9091){return function(_0x32ce6b){if(!_0x32ce6b){_0x23ab00['sendStatus'](0x194);}return _0x32ce6b;};}function handleError(_0x11a2e8,_0x17779f){_0x17779f=_0x17779f||0x1f4;return function(_0x54f885){logger[_0x520f('0x2e')](_0x54f885[_0x520f('0x2f')]);if(_0x54f885[_0x520f('0x30')]){delete _0x54f885[_0x520f('0x30')];}_0x11a2e8[_0x520f('0x22')](_0x17779f)[_0x520f('0x31')](_0x54f885);};}exports[_0x520f('0x32')]=function(_0x41c014,_0xcc9cd5,_0x5e26b3){if(!_0x41c014[_0x520f('0x33')][_0x520f('0x34')](_0x520f('0x35'))&&!_0x41c014['body'][_0x520f('0x34')]('TemplateId')){throw new db[(_0x520f('0x36'))][(_0x520f('0x37'))](_0x520f('0x38'));}else{if(_0x41c014[_0x520f('0x33')][_0x520f('0x34')](_0x520f('0x39'))&&!_0x41c014[_0x520f('0x33')][_0x520f('0x34')](_0x520f('0x3a'))){throw new db[(_0x520f('0x36'))][(_0x520f('0x37'))](_0x520f('0x3b'));}if(!_0x41c014['body'][_0x520f('0x34')](_0x520f('0x3c'))){throw new db[(_0x520f('0x36'))]['ValidationError'](_0x520f('0x3d'));}else{try{var _0x3327fb=JSON[_0x520f('0x3e')](_0x41c014[_0x520f('0x33')][_0x520f('0x3c')]);}catch(_0x17f7e5){logger[_0x520f('0x2e')](_0x17f7e5);throw new db[(_0x520f('0x36'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x4757cc=[_0x520f('0x3f'),_0x520f('0x40'),_0x520f('0x41'),_0x520f('0x42'),_0x520f('0x43'),_0x520f('0x44'),_0x520f('0x45'),_0x520f('0x46'),_0x520f('0x47')];if(_[_0x520f('0x48')](_0x3327fb,function(_0xadddd){return!_[_0x520f('0x49')](_0x4757cc,_0xadddd['model'][_0x520f('0x4a')]());})){throw new db[(_0x520f('0x36'))]['ValidationError'](_0x520f('0x4b'));}}}var _0x33db22={};_0x33db22[_0x520f('0x4c')]=_0x41c014['body'][_0x520f('0x34')](_0x520f('0x4c'))?_0x41c014['body']['senderName']:_0x41c014['user'][_0x520f('0x4d')];_0x33db22[_0x520f('0x4e')]=_[_0x520f('0x4f')](_0x41c014['body'][_0x520f('0x4e')])?null:_0x41c014[_0x520f('0x33')][_0x520f('0x4e')];_0x33db22['beep']=_0x41c014[_0x520f('0x33')][_0x520f('0x50')]||![];_0x33db22[_0x520f('0x51')]=_0x41c014['user']['id'];return getContent(_0x41c014[_0x520f('0x33')])['then'](function(_0x9c8a71){_0x33db22[_0x520f('0x33')]=_0x9c8a71;return getRecipients(_0x3327fb);})[_0x520f('0x2d')](function(_0x355142){_0x33db22[_0x520f('0x52')]=_[_0x520f('0x53')](_0x355142)['join'](',');return db[_0x520f('0x54')][_0x520f('0x55')](function(_0x2f790b){return db[_0x520f('0x56')][_0x520f('0x57')](_0x33db22,{'raw':!![],'transaction':_0x2f790b})[_0x520f('0x2d')](function(_0x456434){var _0x5a74a0={'sender':_0x33db22['senderName'],'description':_0x33db22[_0x520f('0x4e')],'content':_0x33db22[_0x520f('0x33')],'beep':_0x33db22[_0x520f('0x50')]};_0x355142[_0x520f('0x58')](function(_0x3a08b2){_0x5a74a0[_0x520f('0x59')]=_0x3a08b2;socket[_0x520f('0x5a')]('notification:send',_0x5a74a0);});return _0x456434;});});})[_0x520f('0x2d')](respondWithResult(_0xcc9cd5,0xc9))[_0x520f('0x5b')](handleError(_0xcc9cd5,null));};function getContent(_0x160b3a){return new BPromise(function(_0x131199,_0x2b1d1b){if(_0x160b3a[_0x520f('0x35')]){_0x131199(_0x160b3a[_0x520f('0x35')]);return;}return db['Template'][_0x520f('0x5c')]({'attributes':['html'],'where':{'id':_0x160b3a[_0x520f('0x39')]},'raw':!![]})[_0x520f('0x2d')](function(_0x133822){if(!_0x133822)throw new db['Sequelize']['ValidationError'](_0x520f('0x5d'));var _0x45730b=Mustache[_0x520f('0x5e')](_0x133822[_0x520f('0x5f')],_0x160b3a[_0x520f('0x3a')]);_0x131199(_0x45730b);})[_0x520f('0x5b')](function(_0x1401e3){_0x2b1d1b(_0x1401e3);});});}function getRecipients(_0x46137c){return new BPromise(function(_0x5449c6,_0x387697){var _0x801dea=[];var _0x3f3605=[];_0x46137c[_0x520f('0x58')](function(_0x236c73){var _0x3b0976=_['startCase'](_0x236c73[_0x520f('0x60')][_0x520f('0x4a')]());if(_0x3b0976==='User'){_0x801dea=_[_0x520f('0x61')](_0x801dea,_0x236c73[_0x520f('0x62')]);}else{if(_['includes'](_0x3b0976,'queue'))_0x3b0976=_0x3b0976['replace'](_0x520f('0x63'),'Queue');_0x236c73[_0x520f('0x62')]['forEach'](function(_0x3b7920){_0x3f3605['push'](getAgents(_0x3b0976,_0x3b7920));});}});return BPromise['all'](_0x3f3605)['then'](function(_0x3e65c8){_0x801dea=_[_0x520f('0x61')](_0x801dea,_['flatten'](_0x3e65c8));_0x5449c6(_0x801dea);})['catch'](function(_0x1df411){_0x387697(_0x1df411);});});}function getAgents(_0x19f3b1,_0x1bb00b){return new BPromise(function(_0x3771ef,_0x1a292d){return db[_0x19f3b1][_0x520f('0x5c')]({'where':{'id':_0x1bb00b}})[_0x520f('0x2d')](function(_0x2d8152){return _0x2d8152[_0x520f('0x64')]({'attributes':['id'],'raw':!![]})[_0x520f('0x2d')](function(_0x1f1849){var _0x120989=_[_0x520f('0x65')](_0x1f1849,'id');_0x3771ef(_0x120989);});})[_0x520f('0x5b')](function(_0x3bae5f){_0x1a292d(_0x3bae5f);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index e95624f..b68bb95 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Notification','setMaxListeners','save','update'];(function(_0xd16f7f,_0xc71382){var _0x4029a8=function(_0x4af5ec){while(--_0x4af5ec){_0xd16f7f['push'](_0xd16f7f['shift']());}};_0x4029a8(++_0xc71382);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2e8246,_0x378cd8){_0x2e8246=_0x2e8246-0x0;var _0xbc3a64=_0x5f2f[_0x2e8246];return _0xbc3a64;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Notification=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){NotificationEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);NotificationEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Notification[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=NotificationEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x2032,0xd9));var _0x2203=function(_0xbbed33,_0x19d970){_0xbbed33=_0xbbed33-0x0;var _0x5f3705=_0x2032[_0xbbed33];return _0x5f3705;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 269397c..c1ae895 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 _0x59c7=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./notification.attributes','exports','define','Notification','notifications'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59c7,0x1b2));var _0x759c=function(_0x252c4f,_0x4fde3f){_0x252c4f=_0x252c4f-0x0;var _0x3af091=_0x59c7[_0x252c4f];return _0x3af091;};'use strict';var _=require('lodash');var util=require(_0x759c('0x0'));var logger=require(_0x759c('0x1'))(_0x759c('0x2'));var moment=require(_0x759c('0x3'));var BPromise=require(_0x759c('0x4'));var rp=require(_0x759c('0x5'));var fs=require('fs');var path=require(_0x759c('0x6'));var rimraf=require(_0x759c('0x7'));var config=require(_0x759c('0x8'));var attributes=require(_0x759c('0x9'));module[_0x759c('0xa')]=function(_0x5b3dba,_0x2acbed){return _0x5b3dba[_0x759c('0xb')](_0x759c('0xc'),attributes,{'tableName':_0x759c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x759c('0xe'),'collate':_0x759c('0xf')});}; \ No newline at end of file +var _0xf062=['Notification','notifications','lodash','util','moment','bluebird','request-promise','path','./notification.attributes','exports'];(function(_0x4b397b,_0x57e20c){var _0x58f576=function(_0x36a15a){while(--_0x36a15a){_0x4b397b['push'](_0x4b397b['shift']());}};_0x58f576(++_0x57e20c);}(_0xf062,0x188));var _0x2f06=function(_0x4301ca,_0x5e5f39){_0x4301ca=_0x4301ca-0x0;var _0xa241ad=_0xf062[_0x4301ca];return _0xa241ad;};'use strict';var _=require(_0x2f06('0x0'));var util=require(_0x2f06('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2f06('0x2'));var BPromise=require(_0x2f06('0x3'));var rp=require(_0x2f06('0x4'));var fs=require('fs');var path=require(_0x2f06('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2f06('0x6'));module[_0x2f06('0x7')]=function(_0x2ab92b,_0x4b05fa){return _0x2ab92b['define'](_0x2f06('0x8'),attributes,{'tableName':_0x2f06('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index dde62de..3e2b5bf 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 _0xd91f=['redis','localhost','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x4851d3,_0x25e936){var _0x233f34=function(_0x16165b){while(--_0x16165b){_0x4851d3['push'](_0x4851d3['shift']());}};_0x233f34(++_0x25e936);}(_0xd91f,0x132));var _0xfd91=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0xd91f[_0x44a3b0];return _0x39e6f6;};'use strict';var _=require('lodash');var util=require(_0xfd91('0x0'));var moment=require(_0xfd91('0x1'));var BPromise=require(_0xfd91('0x2'));var rs=require(_0xfd91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd91('0x4'))['db'];var utils=require(_0xfd91('0x5'));var logger=require(_0xfd91('0x6'))(_0xfd91('0x7'));var config=require(_0xfd91('0x8'));var jayson=require(_0xfd91('0x9'));var client=jayson[_0xfd91('0xa')][_0xfd91('0xb')]({'port':0x232a});config['redis']=_[_0xfd91('0xc')](config[_0xfd91('0xd')],{'host':_0xfd91('0xe'),'port':0x18eb});var socket=require(_0xfd91('0xf'))(new Redis(config[_0xfd91('0xd')]));require(_0xfd91('0x10'))[_0xfd91('0x11')](socket);function respondWithRpcPromise(_0x1d3940,_0x1881eb,_0x3a0a1e){return new BPromise(function(_0xe201c8,_0x24ffb9){return client[_0xfd91('0x12')](_0x1d3940,_0x3a0a1e)[_0xfd91('0x13')](function(_0x533da1){logger[_0xfd91('0x14')](_0xfd91('0x15'),_0x1881eb,_0xfd91('0x16'));logger[_0xfd91('0x17')]('Notification,\x20%s,\x20%s,\x20%s',_0x1881eb,_0xfd91('0x16'),JSON[_0xfd91('0x18')](_0x533da1));if(_0x533da1[_0xfd91('0x19')]){if(_0x533da1[_0xfd91('0x19')][_0xfd91('0x1a')]===0x1f4){logger[_0xfd91('0x19')](_0xfd91('0x15'),_0x1881eb,_0x533da1[_0xfd91('0x19')]['message']);return _0x24ffb9(_0x533da1[_0xfd91('0x19')][_0xfd91('0x1b')]);}logger['error'](_0xfd91('0x15'),_0x1881eb,_0x533da1[_0xfd91('0x19')][_0xfd91('0x1b')]);return _0xe201c8(_0x533da1['error']['message']);}else{logger[_0xfd91('0x14')](_0xfd91('0x15'),_0x1881eb,_0xfd91('0x16'));_0xe201c8(_0x533da1['result']['message']);}})[_0xfd91('0x1c')](function(_0x2813de){logger[_0xfd91('0x19')]('Notification,\x20%s,\x20%s',_0x1881eb,_0x2813de);_0x24ffb9(_0x2813de);});});} \ No newline at end of file +var _0xf46d=['jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf46d,0xc2));var _0xdf46=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0xf46d[_0x15876a];return _0xbd900f;};'use strict';var _=require(_0xdf46('0x0'));var util=require(_0xdf46('0x1'));var moment=require('moment');var BPromise=require(_0xdf46('0x2'));var rs=require(_0xdf46('0x3'));var fs=require('fs');var Redis=require(_0xdf46('0x4'));var db=require(_0xdf46('0x5'))['db'];var utils=require(_0xdf46('0x6'));var logger=require('../../config/logger')(_0xdf46('0x7'));var config=require(_0xdf46('0x8'));var jayson=require(_0xdf46('0x9'));var client=jayson[_0xdf46('0xa')]['http']({'port':0x232a});config['redis']=_[_0xdf46('0xb')](config[_0xdf46('0xc')],{'host':_0xdf46('0xd'),'port':0x18eb});var socket=require(_0xdf46('0xe'))(new Redis(config[_0xdf46('0xc')]));require('./notification.socket')[_0xdf46('0xf')](socket);function respondWithRpcPromise(_0x2eb9e2,_0x1dc777,_0x16f96f){return new BPromise(function(_0x1b0e56,_0x123c9d){return client[_0xdf46('0x10')](_0x2eb9e2,_0x16f96f)[_0xdf46('0x11')](function(_0x3edc76){logger[_0xdf46('0x12')](_0xdf46('0x13'),_0x1dc777,'request\x20sent');logger[_0xdf46('0x14')](_0xdf46('0x15'),_0x1dc777,'request\x20sent',JSON[_0xdf46('0x16')](_0x3edc76));if(_0x3edc76['error']){if(_0x3edc76[_0xdf46('0x17')][_0xdf46('0x18')]===0x1f4){logger[_0xdf46('0x17')](_0xdf46('0x13'),_0x1dc777,_0x3edc76['error'][_0xdf46('0x19')]);return _0x123c9d(_0x3edc76[_0xdf46('0x17')][_0xdf46('0x19')]);}logger[_0xdf46('0x17')](_0xdf46('0x13'),_0x1dc777,_0x3edc76['error'][_0xdf46('0x19')]);return _0x1b0e56(_0x3edc76[_0xdf46('0x17')][_0xdf46('0x19')]);}else{logger[_0xdf46('0x12')]('Notification,\x20%s,\x20%s',_0x1dc777,_0xdf46('0x1a'));_0x1b0e56(_0x3edc76[_0xdf46('0x1b')][_0xdf46('0x19')]);}})[_0xdf46('0x1c')](function(_0x599f60){logger[_0xdf46('0x17')](_0xdf46('0x13'),_0x1dc777,_0x599f60);_0x123c9d(_0x599f60);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index b436366..e354a67 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 _0x64ff=['update','emit','removeListener','length','notification:','./notification.events','save'];(function(_0x5ccb51,_0x18dcf9){var _0x137386=function(_0x2803ac){while(--_0x2803ac){_0x5ccb51['push'](_0x5ccb51['shift']());}};_0x137386(++_0x18dcf9);}(_0x64ff,0xb4));var _0xf64f=function(_0x91857c,_0x10710b){_0x91857c=_0x91857c-0x0;var _0xf0ddf=_0x64ff[_0x91857c];return _0xf0ddf;};'use strict';var NotificationEvents=require(_0xf64f('0x0'));var events=[_0xf64f('0x1'),'remove',_0xf64f('0x2')];function createListener(_0x500e3d,_0x4c50d4){return function(_0x51ae8c){_0x4c50d4[_0xf64f('0x3')](_0x500e3d,_0x51ae8c);};}function removeListener(_0x4353b3,_0x44d660){return function(){NotificationEvents[_0xf64f('0x4')](_0x4353b3,_0x44d660);};}exports['register']=function(_0x351170){for(var _0x192ff2=0x0,_0xa9a474=events[_0xf64f('0x5')];_0x192ff2<_0xa9a474;_0x192ff2++){var _0x1d9376=events[_0x192ff2];var _0x53ab0f=createListener(_0xf64f('0x6')+_0x1d9376,_0x351170);NotificationEvents['on'](_0x1d9376,_0x53ab0f);}}; \ No newline at end of file +var _0xbff2=['length','notification:','./notification.events','save','remove','update','emit','removeListener'];(function(_0xc29f64,_0x14fc87){var _0x1fed4d=function(_0x287be4){while(--_0x287be4){_0xc29f64['push'](_0xc29f64['shift']());}};_0x1fed4d(++_0x14fc87);}(_0xbff2,0x1aa));var _0x2bff=function(_0x3d782b,_0x721a7a){_0x3d782b=_0x3d782b-0x0;var _0x364cc4=_0xbff2[_0x3d782b];return _0x364cc4;};'use strict';var NotificationEvents=require(_0x2bff('0x0'));var events=[_0x2bff('0x1'),_0x2bff('0x2'),_0x2bff('0x3')];function createListener(_0x321881,_0x459873){return function(_0x5ce026){_0x459873[_0x2bff('0x4')](_0x321881,_0x5ce026);};}function removeListener(_0x2b5abb,_0x313617){return function(){NotificationEvents[_0x2bff('0x5')](_0x2b5abb,_0x313617);};}exports['register']=function(_0x91976f){for(var _0x4292c4=0x0,_0x14d598=events[_0x2bff('0x6')];_0x4292c4<_0x14d598;_0x4292c4++){var _0x31d298=events[_0x4292c4];var _0x2e7586=createListener(_0x2bff('0x7')+_0x31d298,_0x91976f);NotificationEvents['on'](_0x31d298,_0x2e7586);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 87d3e0a..1a63e7d 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 _0x7f0b=['update','delete','destroy','removeAnswers','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','post','create','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/users','/:id/send','put'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x7f0b,0x1bf));var _0xb7f0=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0x7f0b[_0x233cb1];return _0x29ee7e;};'use strict';var multer=require(_0xb7f0('0x0'));var util=require('util');var path=require(_0xb7f0('0x1'));var timeout=require(_0xb7f0('0x2'));var express=require(_0xb7f0('0x3'));var router=express[_0xb7f0('0x4')]();var auth=require(_0xb7f0('0x5'));var interaction=require(_0xb7f0('0x6'));var config=require(_0xb7f0('0x7'));var controller=require(_0xb7f0('0x8'));router['get']('/',auth[_0xb7f0('0x9')](),controller[_0xb7f0('0xa')]);router[_0xb7f0('0xb')](_0xb7f0('0xc'),auth[_0xb7f0('0x9')](),controller['describe']);router[_0xb7f0('0xb')](_0xb7f0('0xd'),auth[_0xb7f0('0x9')](),controller[_0xb7f0('0xe')]);router[_0xb7f0('0xb')](_0xb7f0('0xf'),auth[_0xb7f0('0x9')](),controller[_0xb7f0('0x10')]);router[_0xb7f0('0xb')](_0xb7f0('0x11'),auth[_0xb7f0('0x9')](),controller['getAnswers']);router[_0xb7f0('0xb')]('/:id/applications',auth[_0xb7f0('0x9')](),controller['getApplications']);router[_0xb7f0('0xb')]('/:id/interactions',auth[_0xb7f0('0x9')](),controller['getInteractions']);router['get']('/:id/users',auth[_0xb7f0('0x9')](),controller[_0xb7f0('0x12')]);router[_0xb7f0('0x13')]('/',auth[_0xb7f0('0x9')](),controller[_0xb7f0('0x14')]);router[_0xb7f0('0x13')](_0xb7f0('0xf'),auth[_0xb7f0('0x9')](),controller['addDisposition']);router[_0xb7f0('0x13')]('/:id/canned_answers',auth[_0xb7f0('0x9')](),controller[_0xb7f0('0x15')]);router[_0xb7f0('0x13')](_0xb7f0('0x16'),controller[_0xb7f0('0x17')]);router[_0xb7f0('0x13')](_0xb7f0('0x18'),auth['isAuthenticated'](),controller[_0xb7f0('0x19')]);router[_0xb7f0('0x13')](_0xb7f0('0x1a'),auth['isAuthenticated'](),controller['addAgents']);router[_0xb7f0('0x13')](_0xb7f0('0x1b'),auth[_0xb7f0('0x9')](),controller['send']);router[_0xb7f0('0x1c')]('/:id',auth[_0xb7f0('0x9')](),controller[_0xb7f0('0x1d')]);router[_0xb7f0('0x1e')](_0xb7f0('0xd'),auth[_0xb7f0('0x9')](),controller[_0xb7f0('0x1f')]);router[_0xb7f0('0x1e')](_0xb7f0('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xb7f0('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb7f0('0x20')]);router[_0xb7f0('0x1e')](_0xb7f0('0x1a'),auth[_0xb7f0('0x9')](),controller[_0xb7f0('0x21')]);module['exports']=router; \ No newline at end of file +var _0x3881=['express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','/:id/users','getAgents','create','addAnswer','/:id/notify','notify','post','/:id/applications','addApplications','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util'];(function(_0x16d24f,_0x4686a5){var _0x3beec6=function(_0x552ae0){while(--_0x552ae0){_0x16d24f['push'](_0x16d24f['shift']());}};_0x3beec6(++_0x4686a5);}(_0x3881,0x154));var _0x1388=function(_0x42b21e,_0x562816){_0x42b21e=_0x42b21e-0x0;var _0x59b411=_0x3881[_0x42b21e];return _0x59b411;};'use strict';var multer=require(_0x1388('0x0'));var util=require(_0x1388('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1388('0x2'));var router=express[_0x1388('0x3')]();var auth=require(_0x1388('0x4'));var interaction=require(_0x1388('0x5'));var config=require('../../config/environment');var controller=require(_0x1388('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1388('0x7')]);router[_0x1388('0x8')](_0x1388('0x9'),auth[_0x1388('0xa')](),controller[_0x1388('0xb')]);router[_0x1388('0x8')](_0x1388('0xc'),auth['isAuthenticated'](),controller[_0x1388('0xd')]);router[_0x1388('0x8')](_0x1388('0xe'),auth['isAuthenticated'](),controller[_0x1388('0xf')]);router[_0x1388('0x8')](_0x1388('0x10'),auth[_0x1388('0xa')](),controller[_0x1388('0x11')]);router[_0x1388('0x8')]('/:id/applications',auth[_0x1388('0xa')](),controller[_0x1388('0x12')]);router[_0x1388('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x1388('0x13')]);router[_0x1388('0x8')](_0x1388('0x14'),auth[_0x1388('0xa')](),controller[_0x1388('0x15')]);router['post']('/',auth[_0x1388('0xa')](),controller[_0x1388('0x16')]);router['post']('/:id/dispositions',auth[_0x1388('0xa')](),controller['addDisposition']);router['post'](_0x1388('0x10'),auth[_0x1388('0xa')](),controller[_0x1388('0x17')]);router['post'](_0x1388('0x18'),controller[_0x1388('0x19')]);router[_0x1388('0x1a')](_0x1388('0x1b'),auth[_0x1388('0xa')](),controller[_0x1388('0x1c')]);router[_0x1388('0x1a')](_0x1388('0x14'),auth['isAuthenticated'](),controller[_0x1388('0x1d')]);router[_0x1388('0x1a')](_0x1388('0x1e'),auth[_0x1388('0xa')](),controller['send']);router[_0x1388('0x1f')](_0x1388('0xc'),auth[_0x1388('0xa')](),controller[_0x1388('0x20')]);router[_0x1388('0x21')](_0x1388('0xc'),auth['isAuthenticated'](),controller[_0x1388('0x22')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x1388('0x23')]);router[_0x1388('0x21')](_0x1388('0x10'),auth[_0x1388('0xa')](),controller[_0x1388('0x24')]);router[_0x1388('0x21')](_0x1388('0x14'),auth[_0x1388('0xa')](),controller['removeAgents']);module[_0x1388('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index fb9d843..ac57fde 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 _0xe081=['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','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x385b70,_0x52974f){var _0x33e2ef=function(_0x273ee9){while(--_0x273ee9){_0x385b70['push'](_0x385b70['shift']());}};_0x33e2ef(++_0x52974f);}(_0xe081,0x17a));var _0x1e08=function(_0x2a09e5,_0xbccfc2){_0x2a09e5=_0x2a09e5-0x0;var _0x42614d=_0xe081[_0x2a09e5];return _0x42614d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x1e08('0x0'));module[_0x1e08('0x1')]={'name':{'type':Sequelize[_0x1e08('0x2')],'unique':_0x1e08('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1e08('0x2')]},'token':{'type':Sequelize[_0x1e08('0x2')],'defaultValue':function(){return rs[_0x1e08('0x4')]();}},'replyUri':{'type':Sequelize[_0x1e08('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1e08('0x5')],'defaultValue':function(){return _0x1e08('0x6');}},'notificationSound':{'type':Sequelize[_0x1e08('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1e08('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1e08('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x1e08('0x2')]},'queueTransfer':{'type':Sequelize[_0x1e08('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1e08('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1e08('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1e08('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x1e08('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1e08('0xa'),'set':function(_0x35cd02){if(!_0x35cd02)this[_0x1e08('0xb')](_0x1e08('0xc'),null);this[_0x1e08('0xb')](_0x1e08('0xd'),_0x35cd02);}}}; \ No newline at end of file +var _0xefe4=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','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'];(function(_0x4d4f7f,_0x46f5b6){var _0x16f544=function(_0x73b1d){while(--_0x73b1d){_0x4d4f7f['push'](_0x4d4f7f['shift']());}};_0x16f544(++_0x46f5b6);}(_0xefe4,0x199));var _0x4efe=function(_0x5c2b1b,_0x2dde40){_0x5c2b1b=_0x5c2b1b-0x0;var _0x4a1fbe=_0xefe4[_0x5c2b1b];return _0x4a1fbe;};'use strict';var Sequelize=require(_0x4efe('0x0'));var rs=require('randomstring');module[_0x4efe('0x1')]={'name':{'type':Sequelize[_0x4efe('0x2')],'unique':_0x4efe('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4efe('0x2')]},'token':{'type':Sequelize[_0x4efe('0x2')],'defaultValue':function(){return rs[_0x4efe('0x4')]();}},'replyUri':{'type':Sequelize[_0x4efe('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x4efe('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4efe('0x5')],'defaultValue':function(){return _0x4efe('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4efe('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4efe('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4efe('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4efe('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x4efe('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4efe('0xa'),'set':function(_0x617193){if(!_0x617193)this[_0x4efe('0xb')](_0x4efe('0xc'),null);this['setDataValue'](_0x4efe('0xd'),_0x617193);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 4e0f790..fa36581 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 _0x35d5=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','OpenchannelAccounts','UserProfileResource','destroy','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','type','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','keys','length','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','ListId','contact','threadId','OpenchannelInteraction','ContactId','spread','firstName','lastName','messageId','interaction','created','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','internal','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','DESC','dataValues','Messages','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch'];(function(_0x151086,_0x49fcb2){var _0x14e225=function(_0x187366){while(--_0x187366){_0x151086['push'](_0x151086['shift']());}};_0x14e225(++_0x49fcb2);}(_0x35d5,0x14b));var _0x535d=function(_0x3f3d35,_0xbe8170){_0x3f3d35=_0x3f3d35-0x0;var _0x166cf9=_0x35d5[_0x3f3d35];return _0x166cf9;};'use strict';var pdf=require(_0x535d('0x0'));var emlformat=require(_0x535d('0x1'));var rimraf=require(_0x535d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x535d('0x3'));var rp=require(_0x535d('0x4'));var moment=require('moment');var BPromise=require(_0x535d('0x5'));var Mustache=require(_0x535d('0x6'));var util=require(_0x535d('0x7'));var path=require(_0x535d('0x8'));var sox=require(_0x535d('0x9'));var csv=require(_0x535d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x535d('0xb'));var squel=require(_0x535d('0xc'));var crypto=require(_0x535d('0xd'));var jsforce=require(_0x535d('0xe'));var deskjs=require(_0x535d('0xf'));var toCsv=require(_0x535d('0xa'));var querystring=require(_0x535d('0x10'));var Papa=require(_0x535d('0x11'));var Redis=require(_0x535d('0x12'));var authService=require(_0x535d('0x13'));var qs=require(_0x535d('0x14'));var as=require(_0x535d('0x15'));var hardwareService=require(_0x535d('0x16'));var logger=require(_0x535d('0x17'))('api');var utils=require(_0x535d('0x18'));var config=require(_0x535d('0x19'));var licenseUtil=require(_0x535d('0x1a'));var db=require(_0x535d('0x1b'))['db'];config[_0x535d('0x1c')]=_[_0x535d('0x1d')](config['redis'],{'host':_0x535d('0x1e'),'port':0x18eb});var socket=require(_0x535d('0x1f'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x535d('0x20')](socket);var jayson=require(_0x535d('0x21'));var client=jayson[_0x535d('0x22')]['http']({'port':0x232c});var client9002=jayson['client'][_0x535d('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x36927c,_0x20fb4c,_0x112b21,_0x358230){return new BPromise(function(_0x594387,_0x577ac9){var _0x404648=_0x358230||client;return _0x404648[_0x535d('0x24')](_0x36927c,_0x112b21)[_0x535d('0x25')](function(_0x4d6949){logger[_0x535d('0x26')](_0x535d('0x27'),_0x20fb4c,'request\x20sent');logger[_0x535d('0x28')](_0x535d('0x29'),_0x20fb4c,_0x535d('0x2a'),JSON[_0x535d('0x2b')](_0x4d6949));if(_0x4d6949[_0x535d('0x2c')]){if(_0x4d6949[_0x535d('0x2c')]['code']===0x1f4){logger[_0x535d('0x2c')](_0x535d('0x27'),_0x20fb4c,_0x4d6949['error'][_0x535d('0x2d')]);return _0x577ac9(_0x4d6949['error'][_0x535d('0x2d')]);}logger[_0x535d('0x2c')](_0x535d('0x27'),_0x20fb4c,_0x4d6949['error'][_0x535d('0x2d')]);return _0x594387(_0x4d6949[_0x535d('0x2c')][_0x535d('0x2d')]);}else{logger['info'](_0x535d('0x27'),_0x20fb4c,_0x535d('0x2a'));_0x594387(_0x4d6949['result'][_0x535d('0x2d')]);}})[_0x535d('0x2e')](function(_0x2e5173){logger['error'](_0x535d('0x27'),_0x20fb4c,_0x2e5173);_0x577ac9(_0x2e5173);});});}function respondWithStatusCode(_0x2a7601,_0x20f656){_0x20f656=_0x20f656||0xcc;return function(_0x3babb7){if(_0x3babb7){return _0x2a7601[_0x535d('0x2f')](_0x20f656);}return _0x2a7601[_0x535d('0x30')](_0x20f656)[_0x535d('0x31')]();};}function respondWithResult(_0x5d4584,_0x2353f7){_0x2353f7=_0x2353f7||0xc8;return function(_0x3ce244){if(_0x3ce244){return _0x5d4584[_0x535d('0x30')](_0x2353f7)[_0x535d('0x32')](_0x3ce244);}};}function respondWithFilteredResult(_0x51d6a8,_0x823377){return function(_0x357b68){if(_0x357b68){var _0x25018f=_0x357b68[_0x535d('0x33')],_0x25f348=_0x823377['offset'],_0x167379=_0x823377[_0x535d('0x34')]+_0x823377[_0x535d('0x35')],_0x55d6d3;if(_0x167379>=_0x25018f){_0x167379=_0x25018f;_0x55d6d3=0xc8;}else{_0x55d6d3=0xce;}_0x51d6a8[_0x535d('0x30')](_0x55d6d3);return _0x51d6a8[_0x535d('0x36')](_0x535d('0x37'),_0x25f348+'-'+_0x167379+'/'+_0x25018f)[_0x535d('0x32')](_0x357b68);}return null;};}function patchUpdates(_0x2764f1){return function(_0x142f92){try{jsonpatch[_0x535d('0x38')](_0x142f92,_0x2764f1,!![]);}catch(_0x509a27){return BPromise['reject'](_0x509a27);}return _0x142f92[_0x535d('0x39')]();};}function saveUpdates(_0x30a62b,_0x3ec22e){return function(_0x43092a){if(_0x43092a){return _0x43092a[_0x535d('0x3a')](_0x30a62b)[_0x535d('0x25')](function(_0x201853){return _0x201853;});}return null;};}function removeEntity(_0x4be342,_0x318416){return function(_0x31ac17){if(_0x31ac17){return _0x31ac17['destroy']()['then'](function(){var _0x560feb=_0x31ac17['get']({'plain':!![]});var _0x1a11ab=_0x535d('0x3b');return db[_0x535d('0x3c')][_0x535d('0x3d')]({'where':{'type':_0x1a11ab,'resourceId':_0x560feb['id']}})['then'](function(){return _0x31ac17;});})[_0x535d('0x25')](function(){_0x4be342[_0x535d('0x30')](0xcc)[_0x535d('0x31')]();});}};}function handleEntityNotFound(_0x55a877,_0x79559b){return function(_0x11e668){if(!_0x11e668){_0x55a877[_0x535d('0x2f')](0x194);}return _0x11e668;};}function handleError(_0x203222,_0x448d14){_0x448d14=_0x448d14||0x1f4;return function(_0x5c3839){logger[_0x535d('0x2c')](_0x5c3839['stack']);if(_0x5c3839['name']){delete _0x5c3839[_0x535d('0x3e')];}_0x203222['status'](_0x448d14)[_0x535d('0x3f')](_0x5c3839);};}exports['index']=function(_0x24af6f,_0x24fc56){var _0x2cb876={'include':[{'model':db[_0x535d('0x40')],'as':_0x535d('0x41')}]},_0xf89544={},_0x127abc={'count':0x0,'rows':[]};var _0x6673f2=_['map'](db[_0x535d('0x42')]['rawAttributes'],function(_0x5f156c){return{'name':_0x5f156c['fieldName'],'type':_0x5f156c[_0x535d('0x43')]['key']};});_0xf89544[_0x535d('0x44')]=_[_0x535d('0x45')](_0x6673f2,_0x535d('0x3e'));_0xf89544[_0x535d('0x46')]=_['keys'](_0x24af6f[_0x535d('0x46')]);_0xf89544[_0x535d('0x47')]=_[_0x535d('0x48')](_0xf89544[_0x535d('0x44')],_0xf89544[_0x535d('0x46')]);_0x2cb876['attributes']=_[_0x535d('0x48')](_0xf89544[_0x535d('0x44')],qs[_0x535d('0x49')](_0x24af6f[_0x535d('0x46')][_0x535d('0x49')]));_0x2cb876[_0x535d('0x4a')]=_0x2cb876['attributes']['length']?_0x2cb876[_0x535d('0x4a')]:_0xf89544[_0x535d('0x44')];if(!_0x24af6f[_0x535d('0x46')][_0x535d('0x4b')](_0x535d('0x4c'))){_0x2cb876[_0x535d('0x35')]=qs[_0x535d('0x35')](_0x24af6f[_0x535d('0x46')][_0x535d('0x35')]);_0x2cb876[_0x535d('0x34')]=qs[_0x535d('0x34')](_0x24af6f[_0x535d('0x46')][_0x535d('0x34')]);}_0x2cb876[_0x535d('0x4d')]=qs[_0x535d('0x4e')](_0x24af6f[_0x535d('0x46')][_0x535d('0x4e')]);_0x2cb876['where']=qs[_0x535d('0x47')](_[_0x535d('0x4f')](_0x24af6f[_0x535d('0x46')],_0xf89544[_0x535d('0x47')]),_0x6673f2);if(_0x24af6f['query'][_0x535d('0x50')]){_0x2cb876[_0x535d('0x51')]=_['merge'](_0x2cb876[_0x535d('0x51')],{'$or':_[_0x535d('0x45')](_0x6673f2,function(_0x1a826f){if(_0x1a826f['type']!=='VIRTUAL'){var _0x368cee={};_0x368cee[_0x1a826f[_0x535d('0x3e')]]={'$like':'%'+_0x24af6f[_0x535d('0x46')][_0x535d('0x50')]+'%'};return _0x368cee;}})});}_0x2cb876=_[_0x535d('0x52')]({},_0x2cb876,_0x24af6f[_0x535d('0x53')]);var _0x54a52f={'where':_0x2cb876['where']};return db[_0x535d('0x42')][_0x535d('0x33')](_0x54a52f)['then'](function(_0x11d867){_0x127abc[_0x535d('0x33')]=_0x11d867;if(_0x24af6f[_0x535d('0x46')][_0x535d('0x54')]){_0x2cb876[_0x535d('0x55')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x535d('0x56')](_0x2cb876);})['then'](function(_0x566932){_0x127abc[_0x535d('0x57')]=_0x566932;return _0x127abc;})[_0x535d('0x25')](respondWithFilteredResult(_0x24fc56,_0x2cb876))['catch'](handleError(_0x24fc56,null));};exports[_0x535d('0x58')]=function(_0xbcfd58,_0x52372b){var _0x3d1457={'raw':![],'where':{'id':_0xbcfd58[_0x535d('0x59')]['id']},'include':[{'model':db[_0x535d('0x40')],'as':_0x535d('0x41')}]},_0x45750b={};_0x45750b[_0x535d('0x44')]=_['keys'](db[_0x535d('0x42')][_0x535d('0x5a')]);_0x45750b[_0x535d('0x46')]=_[_0x535d('0x5b')](_0xbcfd58[_0x535d('0x46')]);_0x45750b['filters']=_['intersection'](_0x45750b[_0x535d('0x44')],_0x45750b['query']);_0x3d1457[_0x535d('0x4a')]=_[_0x535d('0x48')](_0x45750b[_0x535d('0x44')],qs['fields'](_0xbcfd58[_0x535d('0x46')][_0x535d('0x49')]));_0x3d1457[_0x535d('0x4a')]=_0x3d1457[_0x535d('0x4a')][_0x535d('0x5c')]?_0x3d1457[_0x535d('0x4a')]:_0x45750b['model'];if(_0xbcfd58['query'][_0x535d('0x54')]){_0x3d1457[_0x535d('0x55')]=[{'all':!![]}];}_0x3d1457=_[_0x535d('0x52')]({},_0x3d1457,_0xbcfd58['options']);return db[_0x535d('0x42')][_0x535d('0x5d')](_0x3d1457)[_0x535d('0x25')](handleEntityNotFound(_0x52372b,null))[_0x535d('0x25')](respondWithResult(_0x52372b,null))[_0x535d('0x2e')](handleError(_0x52372b,null));};exports['create']=function(_0x3cf5c1,_0x42a8a6){return db[_0x535d('0x42')]['create'](_0x3cf5c1[_0x535d('0x5e')],{})[_0x535d('0x25')](function(_0x3a2766){var _0x3309bc=_0x3cf5c1[_0x535d('0x5f')][_0x535d('0x60')]({'plain':!![]});if(!_0x3309bc)throw new Error(_0x535d('0x61'));if(_0x3309bc[_0x535d('0x62')]===_0x535d('0x5f')){var _0x525b9e=_0x3a2766[_0x535d('0x60')]({'plain':!![]});var _0x285768=_0x535d('0x3b');return db['UserProfileSection']['find']({'where':{'name':_0x285768,'userProfileId':_0x3309bc[_0x535d('0x63')]},'raw':!![]})[_0x535d('0x25')](function(_0x52b814){if(_0x52b814&&_0x52b814[_0x535d('0x64')]===0x0){return db[_0x535d('0x3c')][_0x535d('0x65')]({'name':_0x525b9e[_0x535d('0x3e')],'resourceId':_0x525b9e['id'],'type':_0x52b814['name'],'sectionId':_0x52b814['id']},{})[_0x535d('0x25')](function(){return _0x3a2766;});}else{return _0x3a2766;}})[_0x535d('0x2e')](function(_0x472190){logger[_0x535d('0x2c')](_0x535d('0x66'),_0x472190);throw _0x472190;});}return _0x3a2766;})[_0x535d('0x25')](respondWithResult(_0x42a8a6,0xc9))[_0x535d('0x2e')](handleError(_0x42a8a6,null));};exports[_0x535d('0x3a')]=function(_0x367b23,_0x7042b5){if(_0x367b23[_0x535d('0x5e')]['id']){delete _0x367b23[_0x535d('0x5e')]['id'];}return db['OpenchannelAccount'][_0x535d('0x5d')]({'where':{'id':_0x367b23[_0x535d('0x59')]['id']},'include':[{'model':db[_0x535d('0x40')],'as':_0x535d('0x41')}]})[_0x535d('0x25')](handleEntityNotFound(_0x7042b5,null))['then'](saveUpdates(_0x367b23[_0x535d('0x5e')],null))['then'](respondWithResult(_0x7042b5,null))[_0x535d('0x2e')](handleError(_0x7042b5,null));};exports[_0x535d('0x3d')]=function(_0x1b7ba2,_0x57f43b){return db[_0x535d('0x42')][_0x535d('0x5d')]({'where':{'id':_0x1b7ba2[_0x535d('0x59')]['id']}})['then'](handleEntityNotFound(_0x57f43b,null))[_0x535d('0x25')](removeEntity(_0x57f43b,null))[_0x535d('0x2e')](handleError(_0x57f43b,null));};exports[_0x535d('0x67')]=function(_0x211e52,_0x139b1f){return db[_0x535d('0x42')][_0x535d('0x67')]()[_0x535d('0x25')](respondWithResult(_0x139b1f,null))[_0x535d('0x2e')](handleError(_0x139b1f,null));};exports[_0x535d('0x68')]=function(_0x26aec1,_0x22d2b3,_0xc32621){if(_0x26aec1[_0x535d('0x5e')]['id']){delete _0x26aec1[_0x535d('0x5e')]['id'];}return db[_0x535d('0x42')][_0x535d('0x5d')]({'where':{'id':_0x26aec1[_0x535d('0x59')]['id']}})[_0x535d('0x25')](handleEntityNotFound(_0x22d2b3,null))[_0x535d('0x25')](function(_0x4f8f0d){if(_0x4f8f0d){_0x26aec1['body'][_0x535d('0x69')]=_0x4f8f0d['id'];return db['Disposition'][_0x535d('0x65')](_0x26aec1[_0x535d('0x5e')]);}})[_0x535d('0x25')](respondWithResult(_0x22d2b3,null))[_0x535d('0x2e')](handleError(_0x22d2b3,null));};exports[_0x535d('0x6a')]=function(_0x5be5a3,_0x141c3e,_0x451c10){var _0x5e33b9={'raw':![],'where':{}};var _0xb5c06={};var _0x2bc2f9={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x535d('0x6b')]({'where':{'id':_0x5be5a3[_0x535d('0x59')]['id']}})[_0x535d('0x25')](handleEntityNotFound(_0x141c3e,null))[_0x535d('0x25')](function(_0x31a4d0){if(_0x31a4d0){_0xb5c06[_0x535d('0x44')]=_[_0x535d('0x5b')](db[_0x535d('0x6c')]['rawAttributes']);_0xb5c06[_0x535d('0x46')]=_[_0x535d('0x5b')](_0x5be5a3['query']);_0xb5c06[_0x535d('0x47')]=_[_0x535d('0x48')](_0xb5c06[_0x535d('0x44')],_0xb5c06[_0x535d('0x46')]);_0x5e33b9[_0x535d('0x4a')]=_[_0x535d('0x48')](_0xb5c06[_0x535d('0x44')],qs['fields'](_0x5be5a3['query']['fields']));_0x5e33b9['attributes']=_0x5e33b9['attributes'][_0x535d('0x5c')]?_0x5e33b9['attributes']:_0xb5c06[_0x535d('0x44')];if(!_0x5be5a3[_0x535d('0x46')][_0x535d('0x4b')](_0x535d('0x4c'))){_0x5e33b9[_0x535d('0x35')]=qs['limit'](_0x5be5a3[_0x535d('0x46')][_0x535d('0x35')]);_0x5e33b9[_0x535d('0x34')]=qs['offset'](_0x5be5a3['query'][_0x535d('0x34')]);}_0x5e33b9['order']=qs[_0x535d('0x4e')](_0x5be5a3[_0x535d('0x46')]['sort']);_0x5e33b9[_0x535d('0x51')]=qs[_0x535d('0x47')](_[_0x535d('0x4f')](_0x5be5a3[_0x535d('0x46')],_0xb5c06[_0x535d('0x47')]));_0x5e33b9[_0x535d('0x51')][_0x535d('0x69')]=_0x31a4d0['id'];if(_0x5be5a3['query'][_0x535d('0x50')]){_0x5e33b9['where']=_[_0x535d('0x52')](_0x5e33b9[_0x535d('0x51')],{'$or':_[_0x535d('0x45')](_0x5e33b9[_0x535d('0x4a')],function(_0x39bb4f){var _0x26d267={};_0x26d267[_0x39bb4f]={'$like':'%'+_0x5be5a3['query']['filter']+'%'};return _0x26d267;})});}_0x5e33b9=_[_0x535d('0x52')]({},_0x5e33b9,_0x5be5a3[_0x535d('0x53')]);return db[_0x535d('0x6c')][_0x535d('0x33')]({'where':_0x5e33b9[_0x535d('0x51')]})['then'](function(_0x32b361){_0x2bc2f9['count']=_0x32b361;if(_0x5be5a3[_0x535d('0x46')][_0x535d('0x54')]){_0x5e33b9[_0x535d('0x55')]=[{'all':!![]}];}return db[_0x535d('0x6c')][_0x535d('0x56')](_0x5e33b9);})['then'](function(_0x91b11){_0x2bc2f9[_0x535d('0x57')]=_0x91b11;return _0x2bc2f9;});}})[_0x535d('0x25')](respondWithFilteredResult(_0x141c3e,_0x5e33b9))[_0x535d('0x2e')](handleError(_0x141c3e,null));};exports['removeDispositions']=function(_0x597340,_0x3b1ebc,_0x4093c6){return db[_0x535d('0x42')][_0x535d('0x5d')]({'where':{'id':_0x597340[_0x535d('0x59')]['id']}})['then'](handleEntityNotFound(_0x3b1ebc,null))[_0x535d('0x25')](function(_0x1d92ac){if(_0x1d92ac){return _0x1d92ac[_0x535d('0x6d')](_0x597340[_0x535d('0x46')][_0x535d('0x6e')]);}})[_0x535d('0x25')](respondWithStatusCode(_0x3b1ebc,null))[_0x535d('0x2e')](handleError(_0x3b1ebc,null));};exports[_0x535d('0x6f')]=function(_0xa5a34d,_0x296cd2,_0x40984a){if(_0xa5a34d[_0x535d('0x5e')]['id']){delete _0xa5a34d[_0x535d('0x5e')]['id'];}return db[_0x535d('0x42')][_0x535d('0x5d')]({'where':{'id':_0xa5a34d[_0x535d('0x59')]['id']}})[_0x535d('0x25')](handleEntityNotFound(_0x296cd2,null))[_0x535d('0x25')](function(_0x216849){if(_0x216849){_0xa5a34d[_0x535d('0x5e')]['OpenchannelAccountId']=_0x216849['id'];return db['CannedAnswer'][_0x535d('0x65')](_0xa5a34d[_0x535d('0x5e')]);}})['then'](respondWithResult(_0x296cd2,null))[_0x535d('0x2e')](handleError(_0x296cd2,null));};exports[_0x535d('0x70')]=function(_0x36a52e,_0xd66916,_0x568e6d){var _0x2df6d9={'raw':![],'where':{}};var _0x1bdf1d={};var _0x168844={'count':0x0,'rows':[]};return db[_0x535d('0x42')][_0x535d('0x6b')]({'where':{'id':_0x36a52e[_0x535d('0x59')]['id']}})[_0x535d('0x25')](handleEntityNotFound(_0xd66916,null))[_0x535d('0x25')](function(_0x3390a9){if(_0x3390a9){_0x1bdf1d[_0x535d('0x44')]=_[_0x535d('0x5b')](db[_0x535d('0x71')]['rawAttributes']);_0x1bdf1d[_0x535d('0x46')]=_['keys'](_0x36a52e['query']);_0x1bdf1d[_0x535d('0x47')]=_[_0x535d('0x48')](_0x1bdf1d[_0x535d('0x44')],_0x1bdf1d[_0x535d('0x46')]);_0x2df6d9['attributes']=_[_0x535d('0x48')](_0x1bdf1d['model'],qs[_0x535d('0x49')](_0x36a52e[_0x535d('0x46')][_0x535d('0x49')]));_0x2df6d9[_0x535d('0x4a')]=_0x2df6d9[_0x535d('0x4a')][_0x535d('0x5c')]?_0x2df6d9['attributes']:_0x1bdf1d[_0x535d('0x44')];if(!_0x36a52e[_0x535d('0x46')][_0x535d('0x4b')](_0x535d('0x4c'))){_0x2df6d9['limit']=qs[_0x535d('0x35')](_0x36a52e[_0x535d('0x46')][_0x535d('0x35')]);_0x2df6d9[_0x535d('0x34')]=qs[_0x535d('0x34')](_0x36a52e[_0x535d('0x46')][_0x535d('0x34')]);}_0x2df6d9['order']=qs[_0x535d('0x4e')](_0x36a52e['query']['sort']);_0x2df6d9[_0x535d('0x51')]=qs[_0x535d('0x47')](_['pick'](_0x36a52e[_0x535d('0x46')],_0x1bdf1d[_0x535d('0x47')]));_0x2df6d9[_0x535d('0x51')][_0x535d('0x69')]=_0x3390a9['id'];if(_0x36a52e['query'][_0x535d('0x50')]){_0x2df6d9[_0x535d('0x51')]=_[_0x535d('0x52')](_0x2df6d9['where'],{'$or':_[_0x535d('0x45')](_0x2df6d9['attributes'],function(_0x412711){var _0x49d25d={};_0x49d25d[_0x412711]={'$like':'%'+_0x36a52e[_0x535d('0x46')][_0x535d('0x50')]+'%'};return _0x49d25d;})});}_0x2df6d9=_[_0x535d('0x52')]({},_0x2df6d9,_0x36a52e['options']);return db[_0x535d('0x71')][_0x535d('0x33')]({'where':_0x2df6d9[_0x535d('0x51')]})[_0x535d('0x25')](function(_0x537aab){_0x168844['count']=_0x537aab;if(_0x36a52e[_0x535d('0x46')]['includeAll']){_0x2df6d9[_0x535d('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x535d('0x56')](_0x2df6d9);})[_0x535d('0x25')](function(_0x20817e){_0x168844[_0x535d('0x57')]=_0x20817e;return _0x168844;});}})[_0x535d('0x25')](respondWithFilteredResult(_0xd66916,_0x2df6d9))[_0x535d('0x2e')](handleError(_0xd66916,null));};exports[_0x535d('0x72')]=function(_0xae47ca,_0x552f01,_0xa48600){return db[_0x535d('0x42')]['find']({'where':{'id':_0xae47ca['params']['id']}})[_0x535d('0x25')](handleEntityNotFound(_0x552f01,null))[_0x535d('0x25')](function(_0x10c0c9){if(_0x10c0c9){return _0x10c0c9[_0x535d('0x72')](_0xae47ca[_0x535d('0x46')][_0x535d('0x6e')]);}})['then'](respondWithStatusCode(_0x552f01,null))['catch'](handleError(_0x552f01,null));};exports[_0x535d('0x73')]=function(_0x489edc,_0x190519,_0x22a0e3){var _0x9c79ef={'body':_0x489edc['body'],'channel':_0x535d('0x74')};var _0xec9cd4=[];var _0x26c4f4=[];var _0x1f088e={};var _0x51c71e=![];return db['CmContact'][_0x535d('0x67')]()[_0x535d('0x25')](function(_0x25b4ee){if(!_0x25b4ee){throw new db[(_0x535d('0x75'))][(_0x535d('0x76'))](_0x535d('0x77'));}_0xec9cd4=_[_0x535d('0x78')](_[_0x535d('0x5b')](_0x25b4ee),[_0x535d('0x79'),_0x535d('0x7a')]);_0x26c4f4=_[_0x535d('0x78')](_[_0x535d('0x5b')](_0x25b4ee),['createdAt',_0x535d('0x7a'),'CompanyId','ListId']);if(_0x489edc['body']['id']){delete _0x489edc[_0x535d('0x5e')]['id'];}if(_[_0x535d('0x7b')](_0x489edc[_0x535d('0x5e')][_0x535d('0x7c')])){throw new db[(_0x535d('0x75'))][(_0x535d('0x76'))]('from\x20is\x20mandatory');}if(_[_0x535d('0x7b')](_0x489edc['body'][_0x535d('0x5e')])||_0x489edc[_0x535d('0x5e')][_0x535d('0x5e')]===''){throw new db[(_0x535d('0x75'))][(_0x535d('0x76'))](_0x535d('0x7d'));}if(_[_0x535d('0x7b')](_0x489edc[_0x535d('0x5e')][_0x535d('0x7e')])){throw new db[(_0x535d('0x75'))][(_0x535d('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x26c4f4);}if(!_[_0x535d('0x7f')](_0x26c4f4,_0x489edc[_0x535d('0x5e')]['mapKey'])){throw new db['Sequelize'][(_0x535d('0x76'))](_0x535d('0x80')+_0x26c4f4);}_0x1f088e[_0x489edc['body'][_0x535d('0x7e')]]=_0x489edc[_0x535d('0x5e')][_0x535d('0x7c')];})[_0x535d('0x25')](function(){return db[_0x535d('0x42')][_0x535d('0x5d')]({'where':{'id':_0x489edc[_0x535d('0x59')]['id']},'include':[{'model':db[_0x535d('0x81')],'as':_0x535d('0x82'),'include':[{'model':db[_0x535d('0x83')],'as':_0x535d('0x84'),'where':_0x1f088e,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x535d('0x85')],'as':_0x535d('0x86')}]});})[_0x535d('0x25')](handleEntityNotFound(_0x190519,null))[_0x535d('0x25')](function(_0x28d82f){if(_0x28d82f&&_0x28d82f['List']){_0x9c79ef[_0x535d('0x87')]=_0x28d82f;_0x9c79ef[_0x535d('0x88')]=_0x28d82f[_0x535d('0x86')];_0x9c79ef[_0x535d('0x89')]=_0x28d82f[_0x535d('0x82')];_0x9c79ef[_0x535d('0x88')]=_[_0x535d('0x8a')](_0x9c79ef[_0x535d('0x88')],[_0x535d('0x8b')],[_0x535d('0x8c')]);if(_0x9c79ef[_0x535d('0x87')][_0x535d('0x86')]){delete _0x9c79ef[_0x535d('0x87')][_0x535d('0x86')];}if(_0x9c79ef[_0x535d('0x87')][_0x535d('0x82')]&&_0x9c79ef[_0x535d('0x87')][_0x535d('0x82')][_0x535d('0x84')][_0x535d('0x5c')]){return _0x9c79ef[_0x535d('0x87')][_0x535d('0x82')][_0x535d('0x84')][0x0];}var _0x1c52e4=_['defaults'](_0x489edc[_0x535d('0x5e')],{'firstName':_0x489edc['body'][_0x535d('0x7c')],'ListId':_0x28d82f[_0x535d('0x8d')]});_0x1c52e4[_0x489edc[_0x535d('0x5e')][_0x535d('0x7e')]]=_0x489edc[_0x535d('0x5e')]['from'];return db[_0x535d('0x83')][_0x535d('0x65')](_0x1c52e4,{'fields':_0xec9cd4,'raw':!![]});}})[_0x535d('0x25')](handleEntityNotFound(_0x190519,null))['then'](function(_0x27da68){_0x9c79ef[_0x535d('0x8e')]=_0x27da68;if(_0x27da68){var _0x28e809={'ContactId':_0x27da68['id'],'OpenchannelAccountId':_0x489edc[_0x535d('0x59')]['id'],'from':(_0x27da68['firstName']||'')+'\x20'+(_0x27da68['lastName']||'')};var _0x571ee4={'OpenchannelAccountId':_0x489edc[_0x535d('0x59')]['id'],'closed':![]};if(_0x489edc[_0x535d('0x5e')][_0x535d('0x8f')]){_0x571ee4[_0x535d('0x8f')]=_0x489edc[_0x535d('0x5e')][_0x535d('0x8f')];return db[_0x535d('0x90')]['find']({'where':_0x571ee4})[_0x535d('0x25')](function(_0x172b47){if(_0x172b47){return[_0x172b47,![]];}_0x28e809[_0x535d('0x8f')]=_0x489edc['body']['threadId'];_0x28e809['externalUrl']=_0x489edc[_0x535d('0x5e')]['externalUrl'];return db[_0x535d('0x90')][_0x535d('0x65')](_0x28e809)[_0x535d('0x25')](function(_0x164a0f){return[_0x164a0f,!![]];});});}else{_0x571ee4[_0x535d('0x8f')]=null;}_0x571ee4[_0x535d('0x91')]=_0x27da68['id'];return db[_0x535d('0x90')]['find']({'where':_0x571ee4})[_0x535d('0x25')](function(_0x57f666){if(_0x57f666){return[_0x57f666,![]];}return db[_0x535d('0x90')][_0x535d('0x65')](_0x28e809)[_0x535d('0x25')](function(_0x43fe7b){return[_0x43fe7b,!![]];});});}})[_0x535d('0x92')](function(_0x53aa15,_0x406f1e){if(_0x53aa15){_0x51c71e=_0x406f1e;if(!_0x406f1e){var _0x43a01a={'from':(_0x9c79ef[_0x535d('0x8e')][_0x535d('0x93')]||'')+'\x20'+(_0x9c79ef[_0x535d('0x8e')][_0x535d('0x94')]||'')};if(_0x489edc[_0x535d('0x5e')]['threadId']&&_0x489edc[_0x535d('0x5e')][_0x535d('0x95')]&&_0x489edc[_0x535d('0x5e')][_0x535d('0x8f')]!=_0x489edc[_0x535d('0x5e')]['messageId']){_0x43a01a[_0x535d('0x8f')]=_0x489edc[_0x535d('0x5e')][_0x535d('0x95')];}return _0x53aa15[_0x535d('0x3a')](_0x43a01a);}else{return _0x53aa15;}}})[_0x535d('0x25')](function(_0x37156f){_0x9c79ef[_0x535d('0x96')]=_0x37156f[_0x535d('0x60')]({'plain':!![]});_0x9c79ef[_0x535d('0x96')]['created']=_0x51c71e;if(_0x9c79ef[_0x535d('0x96')][_0x535d('0x97')]){if(_0x9c79ef[_0x535d('0x87')]['autoclose']){_0x9c79ef[_0x535d('0x88')][_0x535d('0x98')]({'id':0x0,'priority':_0x9c79ef['applications'][_0x535d('0x5c')]+0x1,'app':_0x535d('0x99'),'appdata':_0x535d('0x9a'),'interval':'*,*,*,*'});}}return db[_0x535d('0x9b')]['create']({'body':_0x489edc[_0x535d('0x5e')][_0x535d('0x5e')],'OpenchannelAccountId':_0x489edc[_0x535d('0x59')]['id'],'OpenchannelInteractionId':_0x37156f['id'],'direction':'in','ContactId':_0x9c79ef['contact']['id'],'AttachmentId':_0x489edc['body'][_0x535d('0x9c')]});})[_0x535d('0x25')](function(_0x44d22d){_0x9c79ef[_0x535d('0x2d')]=_0x44d22d;if(_0x9c79ef[_0x535d('0x96')][_0x535d('0x9d')]){return db['User'][_0x535d('0x5d')]({'attributes':['id','name'],'where':{'id':_0x9c79ef[_0x535d('0x96')]['UserId']}})[_0x535d('0x25')](function(_0x534402){if(_0x534402){_0x9c79ef[_0x535d('0x88')][_0x535d('0x9e')]({'id':0x0,'priority':0x0,'app':_0x535d('0x9f'),'appdata':_0x534402[_0x535d('0x3e')]+','+(_0x9c79ef[_0x535d('0x87')][_0x535d('0xa0')]||0xa),'interval':_0x535d('0xa1')});_0x9c79ef[_0x535d('0xa2')]=![];}return respondWithRpcPromise(_0x535d('0xa3'),_0x535d('0xa4'),_0x9c79ef);});}return respondWithRpcPromise(_0x535d('0xa3'),_0x535d('0xa4'),_0x9c79ef);})[_0x535d('0x25')](function(_0xeac5c){respondWithRpcPromise('EventManager','EventManager',{'event':_0x535d('0x73'),'message':_0xeac5c},client9002);return _0xeac5c;})[_0x535d('0x25')](respondWithResult(_0x190519,null))[_0x535d('0x2e')](handleError(_0x190519,null));};exports[_0x535d('0xa5')]=function(_0x46e114,_0x5136c5,_0x2b4be7){return db[_0x535d('0x42')][_0x535d('0x6b')]({'where':{'id':_0x46e114['params']['id']}})['then'](handleEntityNotFound(_0x5136c5,null))[_0x535d('0x25')](function(_0x4beb3d){if(_0x4beb3d){return db[_0x535d('0xa6')][_0x535d('0xa7')](function(_0x4c2095){return db[_0x535d('0x85')][_0x535d('0x3d')]({'where':{'OpenchannelAccountId':_0x46e114[_0x535d('0x59')]['id']},'transaction':_0x4c2095})['then'](function(_0x523281){var _0x34554b=_[_0x535d('0x45')](_0x46e114[_0x535d('0x5e')],function(_0x562968){_0x562968['OpenchannelAccountId']=_0x46e114[_0x535d('0x59')]['id'];return _0x562968;});return db['OpenchannelApplication'][_0x535d('0xa8')](_0x34554b,{'transaction':_0x4c2095});});})[_0x535d('0x25')](function(){return db['OpenchannelApplication'][_0x535d('0xa9')]({'where':{'OpenchannelAccountId':_0x46e114[_0x535d('0x59')]['id']},'order':_0x535d('0x8b')});});}})['then'](respondWithResult(_0x5136c5,null))['catch'](handleError(_0x5136c5,null));};exports[_0x535d('0xaa')]=function(_0x3b2010,_0x3fb3b4,_0x178638){var _0x5203b7={};var _0x3420fc={};var _0x48041f;var _0xec0350;return db['OpenchannelAccount'][_0x535d('0x6b')]({'where':{'id':_0x3b2010[_0x535d('0x59')]['id']}})[_0x535d('0x25')](handleEntityNotFound(_0x3fb3b4,null))[_0x535d('0x25')](function(_0x1c2b29){if(_0x1c2b29){_0x48041f=_0x1c2b29;_0x3420fc['model']=_['keys'](db[_0x535d('0x85')][_0x535d('0x5a')]);_0x3420fc['query']=_[_0x535d('0x5b')](_0x3b2010[_0x535d('0x46')]);_0x3420fc[_0x535d('0x47')]=_[_0x535d('0x48')](_0x3420fc[_0x535d('0x44')],_0x3420fc[_0x535d('0x46')]);_0x5203b7[_0x535d('0x4a')]=_[_0x535d('0x48')](_0x3420fc['model'],qs['fields'](_0x3b2010[_0x535d('0x46')]['fields']));_0x5203b7[_0x535d('0x4a')]=_0x5203b7['attributes'][_0x535d('0x5c')]?_0x5203b7[_0x535d('0x4a')]:_0x3420fc[_0x535d('0x44')];_0x5203b7[_0x535d('0x4d')]=qs['sort'](_0x3b2010[_0x535d('0x46')]['sort']);_0x5203b7[_0x535d('0x51')]=qs['filters'](_[_0x535d('0x4f')](_0x3b2010[_0x535d('0x46')],_0x3420fc[_0x535d('0x47')]));if(_0x3b2010['query'][_0x535d('0x50')]){_0x5203b7[_0x535d('0x51')]=_[_0x535d('0x52')](_0x5203b7['where'],{'$or':_[_0x535d('0x45')](_0x5203b7[_0x535d('0x4a')],function(_0x35381d){var _0xa4cbb9={};_0xa4cbb9[_0x35381d]={'$like':'%'+_0x3b2010[_0x535d('0x46')]['filter']+'%'};return _0xa4cbb9;})});}_0x5203b7=_[_0x535d('0x52')]({},_0x5203b7,_0x3b2010[_0x535d('0x53')]);return _0x48041f[_0x535d('0xaa')](_0x5203b7);}})[_0x535d('0x25')](function(_0x30d11a){if(_0x30d11a){_0xec0350=_0x30d11a[_0x535d('0x5c')];if(!_0x3b2010[_0x535d('0x46')]['hasOwnProperty']('nolimit')){_0x5203b7['limit']=qs[_0x535d('0x35')](_0x3b2010[_0x535d('0x46')][_0x535d('0x35')]);_0x5203b7[_0x535d('0x34')]=qs[_0x535d('0x34')](_0x3b2010[_0x535d('0x46')][_0x535d('0x34')]);}return _0x48041f[_0x535d('0xaa')](_0x5203b7);}})[_0x535d('0x25')](function(_0x5b00c7){if(_0x5b00c7){return _0x5b00c7?{'count':_0xec0350,'rows':_0x5b00c7}:null;}})['then'](respondWithResult(_0x3fb3b4,null))[_0x535d('0x2e')](handleError(_0x3fb3b4,null));};exports[_0x535d('0xab')]=function(_0x9e639a,_0x327a20,_0x563735){var _0x133ab4={'raw':![],'where':{}};var _0x6580bc={};var _0x11aa29={'count':0x0,'rows':[]};return db[_0x535d('0x42')][_0x535d('0x6b')]({'where':{'id':_0x9e639a[_0x535d('0x59')]['id']}})[_0x535d('0x25')](handleEntityNotFound(_0x327a20,null))[_0x535d('0x25')](function(_0x424d69){if(_0x424d69){_0x6580bc['model']=_[_0x535d('0x5b')](db[_0x535d('0x90')][_0x535d('0x5a')]);_0x6580bc[_0x535d('0x46')]=_[_0x535d('0x5b')](_0x9e639a[_0x535d('0x46')]);_0x6580bc['filters']=_[_0x535d('0x48')](_0x6580bc[_0x535d('0x44')],_0x6580bc['query']);_0x133ab4[_0x535d('0x4a')]=_['intersection'](_0x6580bc['model'],qs[_0x535d('0x49')](_0x9e639a[_0x535d('0x46')]['fields']));_0x133ab4[_0x535d('0x4a')]=_0x133ab4[_0x535d('0x4a')][_0x535d('0x5c')]?_0x133ab4[_0x535d('0x4a')]:_0x6580bc['model'];if(!_0x9e639a[_0x535d('0x46')][_0x535d('0x4b')](_0x535d('0x4c'))){_0x133ab4[_0x535d('0x35')]=qs['limit'](_0x9e639a['query'][_0x535d('0x35')]);_0x133ab4[_0x535d('0x34')]=qs[_0x535d('0x34')](_0x9e639a[_0x535d('0x46')][_0x535d('0x34')]);}_0x133ab4['order']=qs[_0x535d('0x4e')](_0x9e639a['query']['sort']);_0x133ab4[_0x535d('0x51')]=qs[_0x535d('0x47')](_[_0x535d('0x4f')](_0x9e639a['query'],_0x6580bc[_0x535d('0x47')]));_0x133ab4[_0x535d('0x51')][_0x535d('0x69')]=_0x424d69['id'];if(_0x9e639a[_0x535d('0x46')][_0x535d('0x50')]){_0x133ab4[_0x535d('0x51')]=_['merge'](_0x133ab4[_0x535d('0x51')],{'$or':_[_0x535d('0x45')](_0x133ab4[_0x535d('0x4a')],function(_0x54ade3){var _0x45b639={};_0x45b639[_0x54ade3]={'$like':'%'+_0x9e639a[_0x535d('0x46')][_0x535d('0x50')]+'%'};return _0x45b639;})});}_0x133ab4=_[_0x535d('0x52')]({},_0x133ab4,_0x9e639a[_0x535d('0x53')]);return db[_0x535d('0x90')][_0x535d('0x33')]({'where':_0x133ab4[_0x535d('0x51')]})[_0x535d('0x25')](function(_0x19c747){_0x11aa29['count']=_0x19c747;if(_0x9e639a[_0x535d('0x46')][_0x535d('0x54')]){_0x133ab4[_0x535d('0x55')]=[{'model':db[_0x535d('0x83')],'as':_0x535d('0xac'),'required':![]},{'model':db[_0x535d('0xad')],'as':'Owner','attributes':[_0x535d('0x3e'),'fullname',_0x535d('0xae')],'required':![]},{'model':db['Tag'],'as':_0x535d('0xaf'),'attributes':['id',_0x535d('0x3e'),_0x535d('0xb0')],'where':_0x9e639a[_0x535d('0x46')]['tag']?{'id':_0x9e639a[_0x535d('0x46')][_0x535d('0xb1')]}:undefined,'required':_0x9e639a[_0x535d('0x46')][_0x535d('0xb1')]?!![]:![]}];}return db[_0x535d('0x90')][_0x535d('0x56')](_0x133ab4);})[_0x535d('0x25')](function(_0x510b99){_0x11aa29[_0x535d('0x57')]=_0x510b99;return _0x11aa29;});}})[_0x535d('0x25')](respondWithFilteredResult(_0x327a20,_0x133ab4))[_0x535d('0x2e')](handleError(_0x327a20,null));};exports[_0x535d('0xb2')]=function(_0x4590e9,_0x3744ff,_0x237bbf){return db[_0x535d('0x42')][_0x535d('0x5d')]({'where':{'id':_0x4590e9['params']['id']}})[_0x535d('0x25')](handleEntityNotFound(_0x3744ff,null))[_0x535d('0x25')](function(_0x59616c){if(_0x59616c){return _0x59616c[_0x535d('0xb2')](_0x4590e9[_0x535d('0x5e')][_0x535d('0x6e')],_[_0x535d('0xb3')](_0x4590e9[_0x535d('0x5e')],[_0x535d('0x6e'),'id'])||{})['spread'](function(_0x15e857){for(var _0x4d2955=0x0;_0x4d2955<_0x4590e9['body'][_0x535d('0x6e')]['length'];_0x4d2955+=0x1){socket['emit'](_0x535d('0xb4'),{'UserId':_0x4590e9[_0x535d('0x5e')]['ids'][_0x4d2955],'OpenchannelAccountId':_0x4590e9[_0x535d('0x59')]['id']});}return _0x15e857;});}})['then'](respondWithResult(_0x3744ff,null))[_0x535d('0x2e')](handleError(_0x3744ff,null));};exports[_0x535d('0xb5')]=function(_0x527785,_0x1b1f9c,_0x2f2dc8){return db[_0x535d('0x42')][_0x535d('0x5d')]({'where':{'id':_0x527785['params']['id']}})[_0x535d('0x25')](handleEntityNotFound(_0x1b1f9c,null))['then'](function(_0x3e7559){if(_0x3e7559){return _0x3e7559[_0x535d('0xb5')](_0x527785[_0x535d('0x46')][_0x535d('0x6e')])[_0x535d('0x25')](function(){if(_[_0x535d('0xb6')](_0x527785['query']['ids'])){for(var _0x575995=0x0;_0x575995<_0x527785[_0x535d('0x46')][_0x535d('0x6e')][_0x535d('0x5c')];_0x575995+=0x1){socket[_0x535d('0xb7')](_0x535d('0xb8'),{'UserId':Number(_0x527785[_0x535d('0x46')]['ids'][_0x575995]),'OpenchannelAccountId':Number(_0x527785['params']['id'])});}}else{socket[_0x535d('0xb7')](_0x535d('0xb8'),{'UserId':Number(_0x527785[_0x535d('0x46')][_0x535d('0x6e')]),'OpenchannelAccountId':Number(_0x527785['params']['id'])});}});}})[_0x535d('0x25')](respondWithStatusCode(_0x1b1f9c,null))['catch'](handleError(_0x1b1f9c,null));};exports[_0x535d('0xb9')]=function(_0x3f07ab,_0x1714a4,_0x2548ed){var _0x23226e={};var _0x2823e0={};var _0x375198;var _0x59ef49;return db[_0x535d('0x42')][_0x535d('0x6b')]({'where':{'id':_0x3f07ab['params']['id']}})[_0x535d('0x25')](handleEntityNotFound(_0x1714a4,null))[_0x535d('0x25')](function(_0x41bac1){if(_0x41bac1){_0x375198=_0x41bac1;_0x2823e0[_0x535d('0x44')]=_[_0x535d('0x5b')](db[_0x535d('0xad')][_0x535d('0x5a')]);_0x2823e0['query']=_['keys'](_0x3f07ab['query']);_0x2823e0[_0x535d('0x47')]=_[_0x535d('0x48')](_0x2823e0['model'],_0x2823e0['query']);_0x23226e[_0x535d('0x4a')]=_[_0x535d('0x48')](_0x2823e0[_0x535d('0x44')],qs['fields'](_0x3f07ab[_0x535d('0x46')][_0x535d('0x49')]));_0x23226e[_0x535d('0x4a')]=_0x23226e['attributes'][_0x535d('0x5c')]?_0x23226e[_0x535d('0x4a')]:_0x2823e0['model'];_0x23226e[_0x535d('0x4d')]=qs['sort'](_0x3f07ab[_0x535d('0x46')][_0x535d('0x4e')]);_0x23226e[_0x535d('0x51')]=qs[_0x535d('0x47')](_[_0x535d('0x4f')](_0x3f07ab[_0x535d('0x46')],_0x2823e0['filters']));if(_0x3f07ab[_0x535d('0x46')][_0x535d('0x50')]){_0x23226e[_0x535d('0x51')]=_['merge'](_0x23226e[_0x535d('0x51')],{'$or':_[_0x535d('0x45')](_0x23226e[_0x535d('0x4a')],function(_0x39becc){var _0x1eb9be={};_0x1eb9be[_0x39becc]={'$like':'%'+_0x3f07ab[_0x535d('0x46')][_0x535d('0x50')]+'%'};return _0x1eb9be;})});}_0x23226e=_[_0x535d('0x52')]({},_0x23226e,_0x3f07ab[_0x535d('0x53')]);return _0x375198[_0x535d('0xb9')](_0x23226e);}})[_0x535d('0x25')](function(_0x1766a1){if(_0x1766a1){_0x59ef49=_0x1766a1[_0x535d('0x5c')];if(!_0x3f07ab[_0x535d('0x46')]['hasOwnProperty'](_0x535d('0x4c'))){_0x23226e['limit']=qs[_0x535d('0x35')](_0x3f07ab[_0x535d('0x46')][_0x535d('0x35')]);_0x23226e[_0x535d('0x34')]=qs[_0x535d('0x34')](_0x3f07ab[_0x535d('0x46')]['offset']);}return _0x375198[_0x535d('0xb9')](_0x23226e);}})[_0x535d('0x25')](function(_0x97bde9){if(_0x97bde9){return _0x97bde9?{'count':_0x59ef49,'rows':_0x97bde9}:null;}})[_0x535d('0x25')](respondWithResult(_0x1714a4,null))[_0x535d('0x2e')](handleError(_0x1714a4,null));};exports[_0x535d('0x3f')]=function(_0x12347d,_0x1dac4b,_0x33706d){var _0x25be1a,_0xbcac44,_0xb687bf;if(_[_0x535d('0x7b')](_0x12347d[_0x535d('0x5e')][_0x535d('0x5e')])||_0x12347d[_0x535d('0x5e')][_0x535d('0x5e')]===''){throw new db['Sequelize']['ValidationError'](_0x535d('0x7d'));}if(_['isNil'](_0x12347d[_0x535d('0x5e')]['to'])){}_0x25be1a=_0x12347d[_0x535d('0x5e')]['to'];return db[_0x535d('0x42')][_0x535d('0x6b')]({'where':{'id':_0x12347d[_0x535d('0x59')]['id']}})[_0x535d('0x25')](handleEntityNotFound(_0x1dac4b,null))[_0x535d('0x25')](function(_0x4035b7){if(_0x4035b7){return db[_0x535d('0x42')][_0x535d('0x5d')]({'where':{'id':_0x4035b7['id']},'include':[{'model':db[_0x535d('0x81')],'as':'List','include':[{'model':db[_0x535d('0x83')],'as':'Contacts','where':{[_0x4035b7[_0x535d('0x7e')]]:_0x25be1a},'limit':0x1,'order':[[_0x535d('0x7a'),_0x535d('0xba')]]}]}]})[_0x535d('0x25')](handleEntityNotFound(_0x1dac4b,null))[_0x535d('0x25')](function(_0x12c60b){if(_0x12c60b&&_0x12c60b[_0x535d('0x82')]){_0xbcac44=_0x12c60b[_0x535d('0x60')]({'plain':!![]});if(_0xbcac44['List']&&_0xbcac44['List'][_0x535d('0x84')][_0x535d('0x5c')]){return _0xbcac44[_0x535d('0x82')][_0x535d('0x84')][0x0];}return db[_0x535d('0x83')]['create'](_['defaults'](_0x12347d[_0x535d('0x5e')],{'firstName':_0x25be1a,[_0x12c60b['mapKey']]:_0x25be1a,'phone':_0x25be1a,'ListId':_0xbcac44[_0x535d('0x8d')]}));}})[_0x535d('0x25')](handleEntityNotFound(_0x1dac4b,null))[_0x535d('0x25')](function(_0x9abd43){if(_0x9abd43){_0xb687bf=_0x9abd43;return db['OpenchannelInteraction'][_0x535d('0x5d')]({'where':{'ContactId':_0xb687bf['id'],'closed':![],'OpenchannelAccountId':_0xbcac44['id']}})[_0x535d('0x25')](function(_0x333161){if(_0x333161){return[_0x333161,![]];}return db[_0x535d('0x90')]['create']({'UserId':_0x12347d[_0x535d('0x5f')]['id'],'ContactId':_0xb687bf['id'],'OpenchannelAccountId':_0xbcac44['id'],'lastMsgDirection':'out','Messages':[_['merge'](_0x12347d[_0x535d('0x5e')],{'read':![],'body':_0x12347d[_0x535d('0x5e')][_0x535d('0x5e')],'OpenchannelAccountId':_0xbcac44['id'],'UserId':_0x12347d[_0x535d('0x5f')]['id'],'ContactId':_0xb687bf['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x535d('0x25')](function(_0x58d936){return[_0x58d936,!![]];});});}})['spread'](function(_0x2f7653,_0x7b26e4){if(_0x7b26e4){return _0x2f7653;}return db[_0x535d('0x9b')]['create'](_[_0x535d('0x52')](_0x12347d[_0x535d('0x5e')],{'read':![],'body':_0x12347d[_0x535d('0x5e')][_0x535d('0x5e')],'OpenchannelAccountId':_0xbcac44['id'],'OpenchannelInteractionId':_0x2f7653['id'],'UserId':_0x12347d[_0x535d('0x5f')]['id'],'ContactId':_0xb687bf['id']}))['then'](function(_0x321237){_0x2f7653[_0x535d('0xbb')][_0x535d('0xbc')]=[];_0x2f7653[_0x535d('0xbb')][_0x535d('0xbc')][_0x535d('0x98')](_0x321237[_0x535d('0xbb')]);return _0x2f7653;});});}})[_0x535d('0x25')](respondWithResult(_0x1dac4b,null))['catch'](handleError(_0x1dac4b,null));}; \ No newline at end of file +var _0x892d=['mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','length','find','create','body','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from\x20is\x20mandatory','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','from','CmList','List','CmContact','Contacts','Applications','applications','list','orderBy','asc','account','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','transaction','OpenchannelApplication','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','DESC','defaults','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','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','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','save','destroy','get','OpenchannelAccounts','stack','name','send','index','Pause'];(function(_0x5ee5ac,_0xe68d07){var _0x30fbdd=function(_0x22023d){while(--_0x22023d){_0x5ee5ac['push'](_0x5ee5ac['shift']());}};_0x30fbdd(++_0xe68d07);}(_0x892d,0x136));var _0xd892=function(_0x5ea635,_0x1aa753){_0x5ea635=_0x5ea635-0x0;var _0x4e9a57=_0x892d[_0x5ea635];return _0x4e9a57;};'use strict';var pdf=require(_0xd892('0x0'));var emlformat=require(_0xd892('0x1'));var rimraf=require(_0xd892('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd892('0x3'));var rp=require('request-promise');var moment=require(_0xd892('0x4'));var BPromise=require(_0xd892('0x5'));var Mustache=require(_0xd892('0x6'));var util=require('util');var path=require(_0xd892('0x7'));var sox=require('sox');var csv=require(_0xd892('0x8'));var ejs=require(_0xd892('0x9'));var fs=require('fs');var _=require(_0xd892('0xa'));var squel=require(_0xd892('0xb'));var crypto=require('crypto');var jsforce=require(_0xd892('0xc'));var deskjs=require(_0xd892('0xd'));var toCsv=require(_0xd892('0x8'));var querystring=require(_0xd892('0xe'));var Papa=require(_0xd892('0xf'));var Redis=require(_0xd892('0x10'));var authService=require(_0xd892('0x11'));var qs=require(_0xd892('0x12'));var as=require(_0xd892('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd892('0x14'))(_0xd892('0x15'));var utils=require(_0xd892('0x16'));var config=require(_0xd892('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd892('0x18'))['db'];config[_0xd892('0x19')]=_['defaults'](config['redis'],{'host':_0xd892('0x1a'),'port':0x18eb});var socket=require(_0xd892('0x1b'))(new Redis(config[_0xd892('0x19')]));require(_0xd892('0x1c'))[_0xd892('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd892('0x1e')][_0xd892('0x1f')]({'port':0x232c});var client9002=jayson[_0xd892('0x1e')][_0xd892('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x36ccf4,_0x48aac6,_0x1303c2,_0x29242a){return new BPromise(function(_0x42ed4c,_0x310d06){var _0x39892c=_0x29242a||client;return _0x39892c[_0xd892('0x20')](_0x36ccf4,_0x1303c2)[_0xd892('0x21')](function(_0x8f51f4){logger[_0xd892('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x48aac6,_0xd892('0x23'));logger['debug'](_0xd892('0x24'),_0x48aac6,'request\x20sent',JSON[_0xd892('0x25')](_0x8f51f4));if(_0x8f51f4[_0xd892('0x26')]){if(_0x8f51f4[_0xd892('0x26')]['code']===0x1f4){logger[_0xd892('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x48aac6,_0x8f51f4[_0xd892('0x26')]['message']);return _0x310d06(_0x8f51f4[_0xd892('0x26')][_0xd892('0x27')]);}logger[_0xd892('0x26')](_0xd892('0x28'),_0x48aac6,_0x8f51f4[_0xd892('0x26')]['message']);return _0x42ed4c(_0x8f51f4[_0xd892('0x26')][_0xd892('0x27')]);}else{logger[_0xd892('0x22')](_0xd892('0x28'),_0x48aac6,_0xd892('0x23'));_0x42ed4c(_0x8f51f4[_0xd892('0x29')][_0xd892('0x27')]);}})[_0xd892('0x2a')](function(_0x3f698a){logger[_0xd892('0x26')](_0xd892('0x28'),_0x48aac6,_0x3f698a);_0x310d06(_0x3f698a);});});}function respondWithStatusCode(_0x46d57e,_0x1c63b5){_0x1c63b5=_0x1c63b5||0xcc;return function(_0x893be3){if(_0x893be3){return _0x46d57e[_0xd892('0x2b')](_0x1c63b5);}return _0x46d57e[_0xd892('0x2c')](_0x1c63b5)[_0xd892('0x2d')]();};}function respondWithResult(_0xdf5abe,_0x3350f7){_0x3350f7=_0x3350f7||0xc8;return function(_0x3a4547){if(_0x3a4547){return _0xdf5abe[_0xd892('0x2c')](_0x3350f7)['json'](_0x3a4547);}};}function respondWithFilteredResult(_0x9c5503,_0x4816c4){return function(_0x3cc750){if(_0x3cc750){var _0x2270c3=_0x3cc750[_0xd892('0x2e')],_0x5354b8=_0x4816c4[_0xd892('0x2f')],_0x1c98e0=_0x4816c4[_0xd892('0x2f')]+_0x4816c4[_0xd892('0x30')],_0x3d41d0;if(_0x1c98e0>=_0x2270c3){_0x1c98e0=_0x2270c3;_0x3d41d0=0xc8;}else{_0x3d41d0=0xce;}_0x9c5503['status'](_0x3d41d0);return _0x9c5503[_0xd892('0x31')](_0xd892('0x32'),_0x5354b8+'-'+_0x1c98e0+'/'+_0x2270c3)['json'](_0x3cc750);}return null;};}function patchUpdates(_0x13bd7b){return function(_0x98afa8){try{jsonpatch['apply'](_0x98afa8,_0x13bd7b,!![]);}catch(_0x1bdd89){return BPromise['reject'](_0x1bdd89);}return _0x98afa8[_0xd892('0x33')]();};}function saveUpdates(_0x585edc,_0x7203a2){return function(_0x47e427){if(_0x47e427){return _0x47e427['update'](_0x585edc)[_0xd892('0x21')](function(_0x207503){return _0x207503;});}return null;};}function removeEntity(_0x4240c3,_0x551f92){return function(_0x553d19){if(_0x553d19){return _0x553d19[_0xd892('0x34')]()['then'](function(){var _0x45d250=_0x553d19[_0xd892('0x35')]({'plain':!![]});var _0x5f308a=_0xd892('0x36');return db['UserProfileResource'][_0xd892('0x34')]({'where':{'type':_0x5f308a,'resourceId':_0x45d250['id']}})[_0xd892('0x21')](function(){return _0x553d19;});})[_0xd892('0x21')](function(){_0x4240c3[_0xd892('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43efc6,_0x529e09){return function(_0x56c5f6){if(!_0x56c5f6){_0x43efc6['sendStatus'](0x194);}return _0x56c5f6;};}function handleError(_0x1634fb,_0x5981ae){_0x5981ae=_0x5981ae||0x1f4;return function(_0x459e93){logger[_0xd892('0x26')](_0x459e93[_0xd892('0x37')]);if(_0x459e93[_0xd892('0x38')]){delete _0x459e93[_0xd892('0x38')];}_0x1634fb[_0xd892('0x2c')](_0x5981ae)[_0xd892('0x39')](_0x459e93);};}exports[_0xd892('0x3a')]=function(_0x2a8b93,_0x9bb1af){var _0x3438a6={'include':[{'model':db[_0xd892('0x3b')],'as':_0xd892('0x3c')}]},_0x399177={},_0x3c9aad={'count':0x0,'rows':[]};var _0x467d54=_['map'](db[_0xd892('0x3d')][_0xd892('0x3e')],function(_0x37d250){return{'name':_0x37d250[_0xd892('0x3f')],'type':_0x37d250[_0xd892('0x40')]['key']};});_0x399177[_0xd892('0x41')]=_[_0xd892('0x42')](_0x467d54,'name');_0x399177[_0xd892('0x43')]=_[_0xd892('0x44')](_0x2a8b93[_0xd892('0x43')]);_0x399177['filters']=_[_0xd892('0x45')](_0x399177[_0xd892('0x41')],_0x399177[_0xd892('0x43')]);_0x3438a6[_0xd892('0x46')]=_[_0xd892('0x45')](_0x399177[_0xd892('0x41')],qs[_0xd892('0x47')](_0x2a8b93[_0xd892('0x43')][_0xd892('0x47')]));_0x3438a6[_0xd892('0x46')]=_0x3438a6[_0xd892('0x46')]['length']?_0x3438a6[_0xd892('0x46')]:_0x399177[_0xd892('0x41')];if(!_0x2a8b93['query'][_0xd892('0x48')](_0xd892('0x49'))){_0x3438a6['limit']=qs[_0xd892('0x30')](_0x2a8b93['query']['limit']);_0x3438a6[_0xd892('0x2f')]=qs['offset'](_0x2a8b93[_0xd892('0x43')][_0xd892('0x2f')]);}_0x3438a6[_0xd892('0x4a')]=qs[_0xd892('0x4b')](_0x2a8b93[_0xd892('0x43')][_0xd892('0x4b')]);_0x3438a6[_0xd892('0x4c')]=qs['filters'](_[_0xd892('0x4d')](_0x2a8b93[_0xd892('0x43')],_0x399177[_0xd892('0x4e')]),_0x467d54);if(_0x2a8b93[_0xd892('0x43')]['filter']){_0x3438a6['where']=_[_0xd892('0x4f')](_0x3438a6[_0xd892('0x4c')],{'$or':_[_0xd892('0x42')](_0x467d54,function(_0xe2c770){if(_0xe2c770[_0xd892('0x40')]!==_0xd892('0x50')){var _0x54271f={};_0x54271f[_0xe2c770['name']]={'$like':'%'+_0x2a8b93[_0xd892('0x43')][_0xd892('0x51')]+'%'};return _0x54271f;}})});}_0x3438a6=_[_0xd892('0x4f')]({},_0x3438a6,_0x2a8b93[_0xd892('0x52')]);var _0x18a487={'where':_0x3438a6['where']};return db[_0xd892('0x3d')][_0xd892('0x2e')](_0x18a487)[_0xd892('0x21')](function(_0x16becd){_0x3c9aad[_0xd892('0x2e')]=_0x16becd;if(_0x2a8b93[_0xd892('0x43')][_0xd892('0x53')]){_0x3438a6[_0xd892('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xd892('0x55')](_0x3438a6);})[_0xd892('0x21')](function(_0x22ca80){_0x3c9aad['rows']=_0x22ca80;return _0x3c9aad;})[_0xd892('0x21')](respondWithFilteredResult(_0x9bb1af,_0x3438a6))[_0xd892('0x2a')](handleError(_0x9bb1af,null));};exports[_0xd892('0x56')]=function(_0x38fc46,_0xf2b86e){var _0x1c4da7={'raw':![],'where':{'id':_0x38fc46['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2aa73f={};_0x2aa73f[_0xd892('0x41')]=_[_0xd892('0x44')](db['OpenchannelAccount'][_0xd892('0x3e')]);_0x2aa73f[_0xd892('0x43')]=_['keys'](_0x38fc46[_0xd892('0x43')]);_0x2aa73f[_0xd892('0x4e')]=_['intersection'](_0x2aa73f[_0xd892('0x41')],_0x2aa73f[_0xd892('0x43')]);_0x1c4da7[_0xd892('0x46')]=_[_0xd892('0x45')](_0x2aa73f[_0xd892('0x41')],qs[_0xd892('0x47')](_0x38fc46[_0xd892('0x43')]['fields']));_0x1c4da7[_0xd892('0x46')]=_0x1c4da7[_0xd892('0x46')][_0xd892('0x57')]?_0x1c4da7['attributes']:_0x2aa73f['model'];if(_0x38fc46['query'][_0xd892('0x53')]){_0x1c4da7[_0xd892('0x54')]=[{'all':!![]}];}_0x1c4da7=_[_0xd892('0x4f')]({},_0x1c4da7,_0x38fc46[_0xd892('0x52')]);return db[_0xd892('0x3d')][_0xd892('0x58')](_0x1c4da7)[_0xd892('0x21')](handleEntityNotFound(_0xf2b86e,null))[_0xd892('0x21')](respondWithResult(_0xf2b86e,null))[_0xd892('0x2a')](handleError(_0xf2b86e,null));};exports[_0xd892('0x59')]=function(_0x2ad950,_0x2063bb){return db[_0xd892('0x3d')][_0xd892('0x59')](_0x2ad950[_0xd892('0x5a')],{})[_0xd892('0x21')](function(_0x1fab4b){var _0x5eed29=_0x2ad950[_0xd892('0x5b')][_0xd892('0x35')]({'plain':!![]});if(!_0x5eed29)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5eed29['role']===_0xd892('0x5b')){var _0x4b824b=_0x1fab4b[_0xd892('0x35')]({'plain':!![]});var _0x51ef86='OpenchannelAccounts';return db[_0xd892('0x5c')][_0xd892('0x58')]({'where':{'name':_0x51ef86,'userProfileId':_0x5eed29['userProfileId']},'raw':!![]})[_0xd892('0x21')](function(_0x35a320){if(_0x35a320&&_0x35a320[_0xd892('0x5d')]===0x0){return db[_0xd892('0x5e')][_0xd892('0x59')]({'name':_0x4b824b['name'],'resourceId':_0x4b824b['id'],'type':_0x35a320[_0xd892('0x38')],'sectionId':_0x35a320['id']},{})[_0xd892('0x21')](function(){return _0x1fab4b;});}else{return _0x1fab4b;}})[_0xd892('0x2a')](function(_0x4c9ba9){logger['error'](_0xd892('0x5f'),_0x4c9ba9);throw _0x4c9ba9;});}return _0x1fab4b;})[_0xd892('0x21')](respondWithResult(_0x2063bb,0xc9))['catch'](handleError(_0x2063bb,null));};exports[_0xd892('0x60')]=function(_0x414aaf,_0x14ea4e){if(_0x414aaf[_0xd892('0x5a')]['id']){delete _0x414aaf[_0xd892('0x5a')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x414aaf[_0xd892('0x61')]['id']},'include':[{'model':db[_0xd892('0x3b')],'as':'mandatoryDispositionPause'}]})[_0xd892('0x21')](handleEntityNotFound(_0x14ea4e,null))[_0xd892('0x21')](saveUpdates(_0x414aaf[_0xd892('0x5a')],null))[_0xd892('0x21')](respondWithResult(_0x14ea4e,null))[_0xd892('0x2a')](handleError(_0x14ea4e,null));};exports[_0xd892('0x34')]=function(_0x802229,_0x2d596c){return db[_0xd892('0x3d')][_0xd892('0x58')]({'where':{'id':_0x802229[_0xd892('0x61')]['id']}})[_0xd892('0x21')](handleEntityNotFound(_0x2d596c,null))['then'](removeEntity(_0x2d596c,null))['catch'](handleError(_0x2d596c,null));};exports[_0xd892('0x62')]=function(_0x51954b,_0x28e251){return db[_0xd892('0x3d')][_0xd892('0x62')]()['then'](respondWithResult(_0x28e251,null))['catch'](handleError(_0x28e251,null));};exports['addDisposition']=function(_0x175e20,_0x474e9f,_0x41c7b9){if(_0x175e20['body']['id']){delete _0x175e20[_0xd892('0x5a')]['id'];}return db[_0xd892('0x3d')][_0xd892('0x58')]({'where':{'id':_0x175e20[_0xd892('0x61')]['id']}})[_0xd892('0x21')](handleEntityNotFound(_0x474e9f,null))[_0xd892('0x21')](function(_0x45bf2f){if(_0x45bf2f){_0x175e20['body'][_0xd892('0x63')]=_0x45bf2f['id'];return db[_0xd892('0x64')]['create'](_0x175e20['body']);}})[_0xd892('0x21')](respondWithResult(_0x474e9f,null))[_0xd892('0x2a')](handleError(_0x474e9f,null));};exports[_0xd892('0x65')]=function(_0x41d453,_0x395b44,_0x560c1d){var _0x2c344b={'raw':![],'where':{}};var _0x24e88e={};var _0x48e88f={'count':0x0,'rows':[]};return db[_0xd892('0x3d')][_0xd892('0x66')]({'where':{'id':_0x41d453[_0xd892('0x61')]['id']}})[_0xd892('0x21')](handleEntityNotFound(_0x395b44,null))[_0xd892('0x21')](function(_0x2935bc){if(_0x2935bc){_0x24e88e[_0xd892('0x41')]=_['keys'](db[_0xd892('0x64')][_0xd892('0x3e')]);_0x24e88e[_0xd892('0x43')]=_[_0xd892('0x44')](_0x41d453[_0xd892('0x43')]);_0x24e88e[_0xd892('0x4e')]=_['intersection'](_0x24e88e['model'],_0x24e88e[_0xd892('0x43')]);_0x2c344b[_0xd892('0x46')]=_[_0xd892('0x45')](_0x24e88e[_0xd892('0x41')],qs[_0xd892('0x47')](_0x41d453[_0xd892('0x43')][_0xd892('0x47')]));_0x2c344b[_0xd892('0x46')]=_0x2c344b[_0xd892('0x46')][_0xd892('0x57')]?_0x2c344b['attributes']:_0x24e88e[_0xd892('0x41')];if(!_0x41d453[_0xd892('0x43')][_0xd892('0x48')](_0xd892('0x49'))){_0x2c344b['limit']=qs[_0xd892('0x30')](_0x41d453[_0xd892('0x43')]['limit']);_0x2c344b[_0xd892('0x2f')]=qs[_0xd892('0x2f')](_0x41d453[_0xd892('0x43')][_0xd892('0x2f')]);}_0x2c344b[_0xd892('0x4a')]=qs[_0xd892('0x4b')](_0x41d453['query'][_0xd892('0x4b')]);_0x2c344b[_0xd892('0x4c')]=qs['filters'](_[_0xd892('0x4d')](_0x41d453[_0xd892('0x43')],_0x24e88e[_0xd892('0x4e')]));_0x2c344b[_0xd892('0x4c')]['OpenchannelAccountId']=_0x2935bc['id'];if(_0x41d453[_0xd892('0x43')]['filter']){_0x2c344b[_0xd892('0x4c')]=_[_0xd892('0x4f')](_0x2c344b[_0xd892('0x4c')],{'$or':_[_0xd892('0x42')](_0x2c344b[_0xd892('0x46')],function(_0x55f01e){var _0x3f2ac4={};_0x3f2ac4[_0x55f01e]={'$like':'%'+_0x41d453['query'][_0xd892('0x51')]+'%'};return _0x3f2ac4;})});}_0x2c344b=_[_0xd892('0x4f')]({},_0x2c344b,_0x41d453['options']);return db['Disposition'][_0xd892('0x2e')]({'where':_0x2c344b[_0xd892('0x4c')]})[_0xd892('0x21')](function(_0x27d19d){_0x48e88f['count']=_0x27d19d;if(_0x41d453[_0xd892('0x43')]['includeAll']){_0x2c344b[_0xd892('0x54')]=[{'all':!![]}];}return db[_0xd892('0x64')]['findAll'](_0x2c344b);})[_0xd892('0x21')](function(_0x5654fb){_0x48e88f[_0xd892('0x67')]=_0x5654fb;return _0x48e88f;});}})[_0xd892('0x21')](respondWithFilteredResult(_0x395b44,_0x2c344b))[_0xd892('0x2a')](handleError(_0x395b44,null));};exports[_0xd892('0x68')]=function(_0x4d57d7,_0x13ffd0,_0x13b438){return db[_0xd892('0x3d')][_0xd892('0x58')]({'where':{'id':_0x4d57d7['params']['id']}})[_0xd892('0x21')](handleEntityNotFound(_0x13ffd0,null))[_0xd892('0x21')](function(_0x1f65f0){if(_0x1f65f0){return _0x1f65f0['removeDispositions'](_0x4d57d7[_0xd892('0x43')]['ids']);}})[_0xd892('0x21')](respondWithStatusCode(_0x13ffd0,null))['catch'](handleError(_0x13ffd0,null));};exports[_0xd892('0x69')]=function(_0x461b58,_0x2933df,_0x3072ad){if(_0x461b58['body']['id']){delete _0x461b58[_0xd892('0x5a')]['id'];}return db[_0xd892('0x3d')][_0xd892('0x58')]({'where':{'id':_0x461b58['params']['id']}})['then'](handleEntityNotFound(_0x2933df,null))['then'](function(_0x3de91b){if(_0x3de91b){_0x461b58['body'][_0xd892('0x63')]=_0x3de91b['id'];return db[_0xd892('0x6a')][_0xd892('0x59')](_0x461b58['body']);}})[_0xd892('0x21')](respondWithResult(_0x2933df,null))[_0xd892('0x2a')](handleError(_0x2933df,null));};exports[_0xd892('0x6b')]=function(_0xcb18a2,_0x149799,_0x4af7a4){var _0x414286={'raw':![],'where':{}};var _0x4225db={};var _0x1e4b28={'count':0x0,'rows':[]};return db[_0xd892('0x3d')][_0xd892('0x66')]({'where':{'id':_0xcb18a2[_0xd892('0x61')]['id']}})['then'](handleEntityNotFound(_0x149799,null))[_0xd892('0x21')](function(_0xd60c40){if(_0xd60c40){_0x4225db[_0xd892('0x41')]=_[_0xd892('0x44')](db[_0xd892('0x6a')][_0xd892('0x3e')]);_0x4225db[_0xd892('0x43')]=_[_0xd892('0x44')](_0xcb18a2[_0xd892('0x43')]);_0x4225db[_0xd892('0x4e')]=_[_0xd892('0x45')](_0x4225db[_0xd892('0x41')],_0x4225db[_0xd892('0x43')]);_0x414286['attributes']=_['intersection'](_0x4225db['model'],qs['fields'](_0xcb18a2['query'][_0xd892('0x47')]));_0x414286[_0xd892('0x46')]=_0x414286[_0xd892('0x46')][_0xd892('0x57')]?_0x414286[_0xd892('0x46')]:_0x4225db[_0xd892('0x41')];if(!_0xcb18a2[_0xd892('0x43')][_0xd892('0x48')]('nolimit')){_0x414286[_0xd892('0x30')]=qs[_0xd892('0x30')](_0xcb18a2[_0xd892('0x43')][_0xd892('0x30')]);_0x414286[_0xd892('0x2f')]=qs[_0xd892('0x2f')](_0xcb18a2[_0xd892('0x43')]['offset']);}_0x414286[_0xd892('0x4a')]=qs[_0xd892('0x4b')](_0xcb18a2[_0xd892('0x43')][_0xd892('0x4b')]);_0x414286[_0xd892('0x4c')]=qs[_0xd892('0x4e')](_[_0xd892('0x4d')](_0xcb18a2[_0xd892('0x43')],_0x4225db[_0xd892('0x4e')]));_0x414286['where'][_0xd892('0x63')]=_0xd60c40['id'];if(_0xcb18a2[_0xd892('0x43')]['filter']){_0x414286['where']=_['merge'](_0x414286[_0xd892('0x4c')],{'$or':_['map'](_0x414286['attributes'],function(_0x293e12){var _0x1ee475={};_0x1ee475[_0x293e12]={'$like':'%'+_0xcb18a2[_0xd892('0x43')][_0xd892('0x51')]+'%'};return _0x1ee475;})});}_0x414286=_[_0xd892('0x4f')]({},_0x414286,_0xcb18a2['options']);return db['CannedAnswer']['count']({'where':_0x414286['where']})[_0xd892('0x21')](function(_0x48c5b5){_0x1e4b28['count']=_0x48c5b5;if(_0xcb18a2['query'][_0xd892('0x53')]){_0x414286[_0xd892('0x54')]=[{'all':!![]}];}return db[_0xd892('0x6a')][_0xd892('0x55')](_0x414286);})[_0xd892('0x21')](function(_0x2a20ef){_0x1e4b28[_0xd892('0x67')]=_0x2a20ef;return _0x1e4b28;});}})[_0xd892('0x21')](respondWithFilteredResult(_0x149799,_0x414286))[_0xd892('0x2a')](handleError(_0x149799,null));};exports['removeAnswers']=function(_0x141fb1,_0x1106b6,_0x2f02da){return db[_0xd892('0x3d')]['find']({'where':{'id':_0x141fb1[_0xd892('0x61')]['id']}})[_0xd892('0x21')](handleEntityNotFound(_0x1106b6,null))['then'](function(_0x4026d0){if(_0x4026d0){return _0x4026d0[_0xd892('0x6c')](_0x141fb1['query'][_0xd892('0x6d')]);}})[_0xd892('0x21')](respondWithStatusCode(_0x1106b6,null))['catch'](handleError(_0x1106b6,null));};exports[_0xd892('0x6e')]=function(_0x2cca7a,_0x29a497,_0x23c4e4){var _0x4f1a2e={'body':_0x2cca7a[_0xd892('0x5a')],'channel':_0xd892('0x6f')};var _0x559006=[];var _0x153430=[];var _0x1b6829={};var _0x24b324=![];return db['CmContact']['describe']()[_0xd892('0x21')](function(_0x248449){if(!_0x248449){throw new db[(_0xd892('0x70'))][(_0xd892('0x71'))](_0xd892('0x72'));}_0x559006=_[_0xd892('0x73')](_[_0xd892('0x44')](_0x248449),[_0xd892('0x74'),'updatedAt']);_0x153430=_[_0xd892('0x73')](_[_0xd892('0x44')](_0x248449),[_0xd892('0x74'),_0xd892('0x75'),'CompanyId',_0xd892('0x76')]);if(_0x2cca7a[_0xd892('0x5a')]['id']){delete _0x2cca7a['body']['id'];}if(_['isNil'](_0x2cca7a['body']['from'])){throw new db['Sequelize'][(_0xd892('0x71'))](_0xd892('0x77'));}if(_[_0xd892('0x78')](_0x2cca7a['body'][_0xd892('0x5a')])||_0x2cca7a[_0xd892('0x5a')][_0xd892('0x5a')]===''){throw new db[(_0xd892('0x70'))][(_0xd892('0x71'))](_0xd892('0x79'));}if(_['isNil'](_0x2cca7a['body'][_0xd892('0x7a')])){throw new db[(_0xd892('0x70'))]['ValidationError'](_0xd892('0x7b')+_0x153430);}if(!_[_0xd892('0x7c')](_0x153430,_0x2cca7a[_0xd892('0x5a')][_0xd892('0x7a')])){throw new db['Sequelize'][(_0xd892('0x71'))](_0xd892('0x7d')+_0x153430);}_0x1b6829[_0x2cca7a[_0xd892('0x5a')][_0xd892('0x7a')]]=_0x2cca7a[_0xd892('0x5a')][_0xd892('0x7e')];})['then'](function(){return db[_0xd892('0x3d')][_0xd892('0x58')]({'where':{'id':_0x2cca7a[_0xd892('0x61')]['id']},'include':[{'model':db[_0xd892('0x7f')],'as':_0xd892('0x80'),'include':[{'model':db[_0xd892('0x81')],'as':_0xd892('0x82'),'where':_0x1b6829,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0xd892('0x83')}]});})[_0xd892('0x21')](handleEntityNotFound(_0x29a497,null))[_0xd892('0x21')](function(_0x1a0d45){if(_0x1a0d45&&_0x1a0d45['List']){_0x4f1a2e['account']=_0x1a0d45;_0x4f1a2e[_0xd892('0x84')]=_0x1a0d45['Applications'];_0x4f1a2e[_0xd892('0x85')]=_0x1a0d45[_0xd892('0x80')];_0x4f1a2e[_0xd892('0x84')]=_[_0xd892('0x86')](_0x4f1a2e['applications'],['priority'],[_0xd892('0x87')]);if(_0x4f1a2e[_0xd892('0x88')]['Applications']){delete _0x4f1a2e['account'][_0xd892('0x83')];}if(_0x4f1a2e['account'][_0xd892('0x80')]&&_0x4f1a2e[_0xd892('0x88')][_0xd892('0x80')]['Contacts']['length']){return _0x4f1a2e[_0xd892('0x88')][_0xd892('0x80')][_0xd892('0x82')][0x0];}var _0x2cef9f=_['defaults'](_0x2cca7a['body'],{'firstName':_0x2cca7a[_0xd892('0x5a')]['from'],'ListId':_0x1a0d45['ListId']});_0x2cef9f[_0x2cca7a[_0xd892('0x5a')][_0xd892('0x7a')]]=_0x2cca7a['body'][_0xd892('0x7e')];return db['CmContact'][_0xd892('0x59')](_0x2cef9f,{'fields':_0x559006,'raw':!![]});}})[_0xd892('0x21')](handleEntityNotFound(_0x29a497,null))[_0xd892('0x21')](function(_0x2a9b20){_0x4f1a2e['contact']=_0x2a9b20;if(_0x2a9b20){var _0x47205={'ContactId':_0x2a9b20['id'],'OpenchannelAccountId':_0x2cca7a[_0xd892('0x61')]['id'],'from':(_0x2a9b20[_0xd892('0x89')]||'')+'\x20'+(_0x2a9b20[_0xd892('0x8a')]||'')};var _0x2413e2={'OpenchannelAccountId':_0x2cca7a['params']['id'],'closed':![]};if(_0x2cca7a['body'][_0xd892('0x8b')]){_0x2413e2[_0xd892('0x8b')]=_0x2cca7a[_0xd892('0x5a')][_0xd892('0x8b')];return db[_0xd892('0x8c')]['find']({'where':_0x2413e2})[_0xd892('0x21')](function(_0x5d732a){if(_0x5d732a){return[_0x5d732a,![]];}_0x47205['threadId']=_0x2cca7a[_0xd892('0x5a')][_0xd892('0x8b')];_0x47205[_0xd892('0x8d')]=_0x2cca7a['body']['externalUrl'];return db[_0xd892('0x8c')][_0xd892('0x59')](_0x47205)[_0xd892('0x21')](function(_0x1cd03f){return[_0x1cd03f,!![]];});});}else{_0x2413e2[_0xd892('0x8b')]=null;}_0x2413e2[_0xd892('0x8e')]=_0x2a9b20['id'];return db[_0xd892('0x8c')][_0xd892('0x58')]({'where':_0x2413e2})[_0xd892('0x21')](function(_0xcd9bf8){if(_0xcd9bf8){return[_0xcd9bf8,![]];}return db['OpenchannelInteraction'][_0xd892('0x59')](_0x47205)[_0xd892('0x21')](function(_0x4968ea){return[_0x4968ea,!![]];});});}})[_0xd892('0x8f')](function(_0x516cac,_0x165d60){if(_0x516cac){_0x24b324=_0x165d60;if(!_0x165d60){var _0x2ff6fd={'from':(_0x4f1a2e[_0xd892('0x90')][_0xd892('0x89')]||'')+'\x20'+(_0x4f1a2e[_0xd892('0x90')][_0xd892('0x8a')]||'')};if(_0x2cca7a[_0xd892('0x5a')]['threadId']&&_0x2cca7a[_0xd892('0x5a')]['messageId']&&_0x2cca7a['body'][_0xd892('0x8b')]!=_0x2cca7a[_0xd892('0x5a')][_0xd892('0x91')]){_0x2ff6fd[_0xd892('0x8b')]=_0x2cca7a['body'][_0xd892('0x91')];}return _0x516cac[_0xd892('0x60')](_0x2ff6fd);}else{return _0x516cac;}}})[_0xd892('0x21')](function(_0x34981d){_0x4f1a2e['interaction']=_0x34981d[_0xd892('0x35')]({'plain':!![]});_0x4f1a2e[_0xd892('0x92')]['created']=_0x24b324;if(_0x4f1a2e['interaction'][_0xd892('0x93')]){if(_0x4f1a2e['account'][_0xd892('0x94')]){_0x4f1a2e[_0xd892('0x84')][_0xd892('0x95')]({'id':0x0,'priority':_0x4f1a2e[_0xd892('0x84')]['length']+0x1,'app':_0xd892('0x96'),'appdata':_0xd892('0x97'),'interval':'*,*,*,*'});}}return db[_0xd892('0x98')]['create']({'body':_0x2cca7a[_0xd892('0x5a')]['body'],'OpenchannelAccountId':_0x2cca7a['params']['id'],'OpenchannelInteractionId':_0x34981d['id'],'direction':'in','ContactId':_0x4f1a2e[_0xd892('0x90')]['id'],'AttachmentId':_0x2cca7a[_0xd892('0x5a')]['AttachmentId']});})[_0xd892('0x21')](function(_0x405ef9){_0x4f1a2e['message']=_0x405ef9;if(_0x4f1a2e['interaction']['UserId']){return db[_0xd892('0x99')][_0xd892('0x58')]({'attributes':['id',_0xd892('0x38')],'where':{'id':_0x4f1a2e['interaction'][_0xd892('0x9a')]}})[_0xd892('0x21')](function(_0x439546){if(_0x439546){_0x4f1a2e[_0xd892('0x84')][_0xd892('0x9b')]({'id':0x0,'priority':0x0,'app':_0xd892('0x9c'),'appdata':_0x439546[_0xd892('0x38')]+','+(_0x4f1a2e[_0xd892('0x88')][_0xd892('0x9d')]||0xa),'interval':_0xd892('0x9e')});_0x4f1a2e[_0xd892('0x9f')]=![];}return respondWithRpcPromise(_0xd892('0xa0'),_0xd892('0xa1'),_0x4f1a2e);});}return respondWithRpcPromise('Start',_0xd892('0xa1'),_0x4f1a2e);})[_0xd892('0x21')](function(_0x2c20e0){respondWithRpcPromise(_0xd892('0xa2'),_0xd892('0xa2'),{'event':_0xd892('0x6e'),'message':_0x2c20e0},client9002);return _0x2c20e0;})[_0xd892('0x21')](respondWithResult(_0x29a497,null))[_0xd892('0x2a')](handleError(_0x29a497,null));};exports['addApplications']=function(_0x1dabd9,_0x487cd5,_0x24db02){return db[_0xd892('0x3d')][_0xd892('0x66')]({'where':{'id':_0x1dabd9[_0xd892('0x61')]['id']}})[_0xd892('0x21')](handleEntityNotFound(_0x487cd5,null))[_0xd892('0x21')](function(_0x258006){if(_0x258006){return db['sequelize'][_0xd892('0xa3')](function(_0x1e70fc){return db[_0xd892('0xa4')][_0xd892('0x34')]({'where':{'OpenchannelAccountId':_0x1dabd9[_0xd892('0x61')]['id']},'transaction':_0x1e70fc})[_0xd892('0x21')](function(_0x12dd4f){var _0x4557a7=_[_0xd892('0x42')](_0x1dabd9[_0xd892('0x5a')],function(_0x2dd167){_0x2dd167[_0xd892('0x63')]=_0x1dabd9[_0xd892('0x61')]['id'];return _0x2dd167;});return db[_0xd892('0xa4')]['bulkCreate'](_0x4557a7,{'transaction':_0x1e70fc});});})[_0xd892('0x21')](function(){return db[_0xd892('0xa4')][_0xd892('0xa5')]({'where':{'OpenchannelAccountId':_0x1dabd9[_0xd892('0x61')]['id']},'order':_0xd892('0xa6')});});}})[_0xd892('0x21')](respondWithResult(_0x487cd5,null))[_0xd892('0x2a')](handleError(_0x487cd5,null));};exports[_0xd892('0xa7')]=function(_0x47f226,_0x4b25dc,_0x16fc8c){var _0x50ffe8={};var _0x4a1179={};var _0x223e75;var _0x55c847;return db[_0xd892('0x3d')][_0xd892('0x66')]({'where':{'id':_0x47f226['params']['id']}})[_0xd892('0x21')](handleEntityNotFound(_0x4b25dc,null))[_0xd892('0x21')](function(_0x480d6e){if(_0x480d6e){_0x223e75=_0x480d6e;_0x4a1179[_0xd892('0x41')]=_[_0xd892('0x44')](db[_0xd892('0xa4')][_0xd892('0x3e')]);_0x4a1179[_0xd892('0x43')]=_[_0xd892('0x44')](_0x47f226[_0xd892('0x43')]);_0x4a1179[_0xd892('0x4e')]=_['intersection'](_0x4a1179[_0xd892('0x41')],_0x4a1179[_0xd892('0x43')]);_0x50ffe8[_0xd892('0x46')]=_[_0xd892('0x45')](_0x4a1179['model'],qs[_0xd892('0x47')](_0x47f226[_0xd892('0x43')][_0xd892('0x47')]));_0x50ffe8[_0xd892('0x46')]=_0x50ffe8[_0xd892('0x46')][_0xd892('0x57')]?_0x50ffe8[_0xd892('0x46')]:_0x4a1179[_0xd892('0x41')];_0x50ffe8[_0xd892('0x4a')]=qs[_0xd892('0x4b')](_0x47f226[_0xd892('0x43')][_0xd892('0x4b')]);_0x50ffe8[_0xd892('0x4c')]=qs['filters'](_[_0xd892('0x4d')](_0x47f226[_0xd892('0x43')],_0x4a1179[_0xd892('0x4e')]));if(_0x47f226[_0xd892('0x43')][_0xd892('0x51')]){_0x50ffe8[_0xd892('0x4c')]=_[_0xd892('0x4f')](_0x50ffe8['where'],{'$or':_['map'](_0x50ffe8[_0xd892('0x46')],function(_0x4e9b36){var _0x465876={};_0x465876[_0x4e9b36]={'$like':'%'+_0x47f226[_0xd892('0x43')][_0xd892('0x51')]+'%'};return _0x465876;})});}_0x50ffe8=_['merge']({},_0x50ffe8,_0x47f226[_0xd892('0x52')]);return _0x223e75[_0xd892('0xa7')](_0x50ffe8);}})[_0xd892('0x21')](function(_0x1e3461){if(_0x1e3461){_0x55c847=_0x1e3461[_0xd892('0x57')];if(!_0x47f226[_0xd892('0x43')]['hasOwnProperty'](_0xd892('0x49'))){_0x50ffe8[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x47f226['query']['limit']);_0x50ffe8[_0xd892('0x2f')]=qs[_0xd892('0x2f')](_0x47f226[_0xd892('0x43')][_0xd892('0x2f')]);}return _0x223e75[_0xd892('0xa7')](_0x50ffe8);}})['then'](function(_0x228a75){if(_0x228a75){return _0x228a75?{'count':_0x55c847,'rows':_0x228a75}:null;}})['then'](respondWithResult(_0x4b25dc,null))[_0xd892('0x2a')](handleError(_0x4b25dc,null));};exports[_0xd892('0xa8')]=function(_0x177def,_0x5762e9,_0x3c5bcf){var _0x568d98={'raw':![],'where':{}};var _0x26b87f={};var _0x4cdbda={'count':0x0,'rows':[]};return db[_0xd892('0x3d')]['findOne']({'where':{'id':_0x177def[_0xd892('0x61')]['id']}})[_0xd892('0x21')](handleEntityNotFound(_0x5762e9,null))[_0xd892('0x21')](function(_0x4ddd99){if(_0x4ddd99){_0x26b87f['model']=_['keys'](db['OpenchannelInteraction'][_0xd892('0x3e')]);_0x26b87f[_0xd892('0x43')]=_[_0xd892('0x44')](_0x177def[_0xd892('0x43')]);_0x26b87f[_0xd892('0x4e')]=_['intersection'](_0x26b87f[_0xd892('0x41')],_0x26b87f[_0xd892('0x43')]);_0x568d98['attributes']=_['intersection'](_0x26b87f[_0xd892('0x41')],qs['fields'](_0x177def[_0xd892('0x43')][_0xd892('0x47')]));_0x568d98[_0xd892('0x46')]=_0x568d98[_0xd892('0x46')]['length']?_0x568d98['attributes']:_0x26b87f['model'];if(!_0x177def['query'][_0xd892('0x48')]('nolimit')){_0x568d98[_0xd892('0x30')]=qs['limit'](_0x177def[_0xd892('0x43')][_0xd892('0x30')]);_0x568d98[_0xd892('0x2f')]=qs[_0xd892('0x2f')](_0x177def['query']['offset']);}_0x568d98[_0xd892('0x4a')]=qs[_0xd892('0x4b')](_0x177def['query'][_0xd892('0x4b')]);_0x568d98['where']=qs[_0xd892('0x4e')](_[_0xd892('0x4d')](_0x177def[_0xd892('0x43')],_0x26b87f[_0xd892('0x4e')]));_0x568d98['where'][_0xd892('0x63')]=_0x4ddd99['id'];if(_0x177def[_0xd892('0x43')]['filter']){_0x568d98['where']=_[_0xd892('0x4f')](_0x568d98[_0xd892('0x4c')],{'$or':_['map'](_0x568d98[_0xd892('0x46')],function(_0x378711){var _0x3d7ec2={};_0x3d7ec2[_0x378711]={'$like':'%'+_0x177def[_0xd892('0x43')][_0xd892('0x51')]+'%'};return _0x3d7ec2;})});}_0x568d98=_[_0xd892('0x4f')]({},_0x568d98,_0x177def[_0xd892('0x52')]);return db[_0xd892('0x8c')][_0xd892('0x2e')]({'where':_0x568d98[_0xd892('0x4c')]})[_0xd892('0x21')](function(_0x29fe96){_0x4cdbda[_0xd892('0x2e')]=_0x29fe96;if(_0x177def['query'][_0xd892('0x53')]){_0x568d98[_0xd892('0x54')]=[{'model':db[_0xd892('0x81')],'as':_0xd892('0xa9'),'required':![]},{'model':db['User'],'as':_0xd892('0xaa'),'attributes':[_0xd892('0x38'),_0xd892('0xab'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xd892('0xac')],'where':_0x177def[_0xd892('0x43')][_0xd892('0xad')]?{'id':_0x177def['query'][_0xd892('0xad')]}:undefined,'required':_0x177def['query'][_0xd892('0xad')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xd892('0x55')](_0x568d98);})[_0xd892('0x21')](function(_0x5f4c3e){_0x4cdbda[_0xd892('0x67')]=_0x5f4c3e;return _0x4cdbda;});}})[_0xd892('0x21')](respondWithFilteredResult(_0x5762e9,_0x568d98))[_0xd892('0x2a')](handleError(_0x5762e9,null));};exports[_0xd892('0xae')]=function(_0x6660f1,_0x209b6c,_0x3caaf6){return db[_0xd892('0x3d')][_0xd892('0x58')]({'where':{'id':_0x6660f1[_0xd892('0x61')]['id']}})[_0xd892('0x21')](handleEntityNotFound(_0x209b6c,null))['then'](function(_0x239e62){if(_0x239e62){return _0x239e62[_0xd892('0xae')](_0x6660f1['body'][_0xd892('0x6d')],_[_0xd892('0xaf')](_0x6660f1[_0xd892('0x5a')],[_0xd892('0x6d'),'id'])||{})[_0xd892('0x8f')](function(_0x20f9b8){for(var _0x24a860=0x0;_0x24a860<_0x6660f1[_0xd892('0x5a')][_0xd892('0x6d')][_0xd892('0x57')];_0x24a860+=0x1){socket[_0xd892('0xb0')](_0xd892('0xb1'),{'UserId':_0x6660f1[_0xd892('0x5a')]['ids'][_0x24a860],'OpenchannelAccountId':_0x6660f1[_0xd892('0x61')]['id']});}return _0x20f9b8;});}})[_0xd892('0x21')](respondWithResult(_0x209b6c,null))[_0xd892('0x2a')](handleError(_0x209b6c,null));};exports[_0xd892('0xb2')]=function(_0x1ad3fd,_0x563ab8,_0x1643d0){return db[_0xd892('0x3d')][_0xd892('0x58')]({'where':{'id':_0x1ad3fd[_0xd892('0x61')]['id']}})[_0xd892('0x21')](handleEntityNotFound(_0x563ab8,null))[_0xd892('0x21')](function(_0x4fb903){if(_0x4fb903){return _0x4fb903['removeAgents'](_0x1ad3fd['query']['ids'])[_0xd892('0x21')](function(){if(_['isArray'](_0x1ad3fd[_0xd892('0x43')][_0xd892('0x6d')])){for(var _0x59fbb8=0x0;_0x59fbb8<_0x1ad3fd[_0xd892('0x43')][_0xd892('0x6d')]['length'];_0x59fbb8+=0x1){socket[_0xd892('0xb0')](_0xd892('0xb3'),{'UserId':Number(_0x1ad3fd[_0xd892('0x43')][_0xd892('0x6d')][_0x59fbb8]),'OpenchannelAccountId':Number(_0x1ad3fd[_0xd892('0x61')]['id'])});}}else{socket[_0xd892('0xb0')](_0xd892('0xb3'),{'UserId':Number(_0x1ad3fd[_0xd892('0x43')][_0xd892('0x6d')]),'OpenchannelAccountId':Number(_0x1ad3fd[_0xd892('0x61')]['id'])});}});}})[_0xd892('0x21')](respondWithStatusCode(_0x563ab8,null))[_0xd892('0x2a')](handleError(_0x563ab8,null));};exports[_0xd892('0xb4')]=function(_0x612ff8,_0x44c621,_0x305ca1){var _0x410386={};var _0x4a4d66={};var _0x394ee4;var _0xe29965;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x612ff8['params']['id']}})[_0xd892('0x21')](handleEntityNotFound(_0x44c621,null))[_0xd892('0x21')](function(_0x4fb4a5){if(_0x4fb4a5){_0x394ee4=_0x4fb4a5;_0x4a4d66['model']=_[_0xd892('0x44')](db[_0xd892('0x99')][_0xd892('0x3e')]);_0x4a4d66[_0xd892('0x43')]=_['keys'](_0x612ff8[_0xd892('0x43')]);_0x4a4d66[_0xd892('0x4e')]=_[_0xd892('0x45')](_0x4a4d66['model'],_0x4a4d66[_0xd892('0x43')]);_0x410386['attributes']=_[_0xd892('0x45')](_0x4a4d66[_0xd892('0x41')],qs[_0xd892('0x47')](_0x612ff8['query'][_0xd892('0x47')]));_0x410386[_0xd892('0x46')]=_0x410386[_0xd892('0x46')][_0xd892('0x57')]?_0x410386[_0xd892('0x46')]:_0x4a4d66[_0xd892('0x41')];_0x410386[_0xd892('0x4a')]=qs['sort'](_0x612ff8[_0xd892('0x43')][_0xd892('0x4b')]);_0x410386['where']=qs[_0xd892('0x4e')](_['pick'](_0x612ff8['query'],_0x4a4d66['filters']));if(_0x612ff8[_0xd892('0x43')][_0xd892('0x51')]){_0x410386[_0xd892('0x4c')]=_[_0xd892('0x4f')](_0x410386[_0xd892('0x4c')],{'$or':_[_0xd892('0x42')](_0x410386[_0xd892('0x46')],function(_0x49c1aa){var _0x100739={};_0x100739[_0x49c1aa]={'$like':'%'+_0x612ff8[_0xd892('0x43')]['filter']+'%'};return _0x100739;})});}_0x410386=_[_0xd892('0x4f')]({},_0x410386,_0x612ff8[_0xd892('0x52')]);return _0x394ee4['getAgents'](_0x410386);}})['then'](function(_0x3083e0){if(_0x3083e0){_0xe29965=_0x3083e0['length'];if(!_0x612ff8[_0xd892('0x43')][_0xd892('0x48')](_0xd892('0x49'))){_0x410386[_0xd892('0x30')]=qs['limit'](_0x612ff8['query'][_0xd892('0x30')]);_0x410386[_0xd892('0x2f')]=qs[_0xd892('0x2f')](_0x612ff8[_0xd892('0x43')][_0xd892('0x2f')]);}return _0x394ee4[_0xd892('0xb4')](_0x410386);}})['then'](function(_0x35714c){if(_0x35714c){return _0x35714c?{'count':_0xe29965,'rows':_0x35714c}:null;}})[_0xd892('0x21')](respondWithResult(_0x44c621,null))['catch'](handleError(_0x44c621,null));};exports[_0xd892('0x39')]=function(_0x23f9f3,_0x55fabf,_0x628b53){var _0x3f0812,_0x402d67,_0x32b14d;if(_[_0xd892('0x78')](_0x23f9f3[_0xd892('0x5a')]['body'])||_0x23f9f3['body']['body']===''){throw new db[(_0xd892('0x70'))][(_0xd892('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd892('0x78')](_0x23f9f3[_0xd892('0x5a')]['to'])){}_0x3f0812=_0x23f9f3['body']['to'];return db[_0xd892('0x3d')][_0xd892('0x66')]({'where':{'id':_0x23f9f3[_0xd892('0x61')]['id']}})[_0xd892('0x21')](handleEntityNotFound(_0x55fabf,null))[_0xd892('0x21')](function(_0x14c32d){if(_0x14c32d){return db[_0xd892('0x3d')][_0xd892('0x58')]({'where':{'id':_0x14c32d['id']},'include':[{'model':db['CmList'],'as':_0xd892('0x80'),'include':[{'model':db['CmContact'],'as':_0xd892('0x82'),'where':{[_0x14c32d[_0xd892('0x7a')]]:_0x3f0812},'limit':0x1,'order':[[_0xd892('0x75'),_0xd892('0xb5')]]}]}]})['then'](handleEntityNotFound(_0x55fabf,null))[_0xd892('0x21')](function(_0x4dc87a){if(_0x4dc87a&&_0x4dc87a['List']){_0x402d67=_0x4dc87a[_0xd892('0x35')]({'plain':!![]});if(_0x402d67['List']&&_0x402d67['List'][_0xd892('0x82')]['length']){return _0x402d67[_0xd892('0x80')][_0xd892('0x82')][0x0];}return db[_0xd892('0x81')][_0xd892('0x59')](_[_0xd892('0xb6')](_0x23f9f3['body'],{'firstName':_0x3f0812,[_0x4dc87a[_0xd892('0x7a')]]:_0x3f0812,'phone':_0x3f0812,'ListId':_0x402d67[_0xd892('0x76')]}));}})[_0xd892('0x21')](handleEntityNotFound(_0x55fabf,null))[_0xd892('0x21')](function(_0x3403c7){if(_0x3403c7){_0x32b14d=_0x3403c7;return db[_0xd892('0x8c')][_0xd892('0x58')]({'where':{'ContactId':_0x32b14d['id'],'closed':![],'OpenchannelAccountId':_0x402d67['id']}})[_0xd892('0x21')](function(_0xec9c18){if(_0xec9c18){return[_0xec9c18,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x23f9f3[_0xd892('0x5b')]['id'],'ContactId':_0x32b14d['id'],'OpenchannelAccountId':_0x402d67['id'],'lastMsgDirection':'out','Messages':[_[_0xd892('0x4f')](_0x23f9f3[_0xd892('0x5a')],{'read':![],'body':_0x23f9f3[_0xd892('0x5a')][_0xd892('0x5a')],'OpenchannelAccountId':_0x402d67['id'],'UserId':_0x23f9f3[_0xd892('0x5b')]['id'],'ContactId':_0x32b14d['id']})]},{'include':[{'model':db[_0xd892('0x98')],'as':_0xd892('0xb7')}]})[_0xd892('0x21')](function(_0x12e6d6){return[_0x12e6d6,!![]];});});}})[_0xd892('0x8f')](function(_0x3d8491,_0x2ada02){if(_0x2ada02){return _0x3d8491;}return db[_0xd892('0x98')]['create'](_['merge'](_0x23f9f3[_0xd892('0x5a')],{'read':![],'body':_0x23f9f3[_0xd892('0x5a')][_0xd892('0x5a')],'OpenchannelAccountId':_0x402d67['id'],'OpenchannelInteractionId':_0x3d8491['id'],'UserId':_0x23f9f3[_0xd892('0x5b')]['id'],'ContactId':_0x32b14d['id']}))[_0xd892('0x21')](function(_0x245925){_0x3d8491[_0xd892('0xb8')]['Messages']=[];_0x3d8491[_0xd892('0xb8')]['Messages'][_0xd892('0x95')](_0x245925[_0xd892('0xb8')]);return _0x3d8491;});});}})[_0xd892('0x21')](respondWithResult(_0x55fabf,null))[_0xd892('0x2a')](handleError(_0x55fabf,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 6822621..27d4c2f 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 _0x3809=['events','OpenchannelAccount','update','remove','emit','hasOwnProperty','hook'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x3809,0x1c0));var _0x9380=function(_0x2730ed,_0x118c66){_0x2730ed=_0x2730ed-0x0;var _0x4fc9d4=_0x3809[_0x2730ed];return _0x4fc9d4;};'use strict';var EventEmitter=require(_0x9380('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x9380('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9380('0x2'),'afterDestroy':_0x9380('0x3')};function emitEvent(_0xc62dde){return function(_0x1e6354,_0x25367f,_0x23cdf1){OpenchannelAccountEvents[_0x9380('0x4')](_0xc62dde+':'+_0x1e6354['id'],_0x1e6354);OpenchannelAccountEvents[_0x9380('0x4')](_0xc62dde,_0x1e6354);_0x23cdf1(null);};}for(var e in events){if(events[_0x9380('0x5')](e)){var event=events[e];OpenchannelAccount[_0x9380('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xe369=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x7d6e02,_0x1a0ab9){var _0x114064=function(_0x513fe2){while(--_0x513fe2){_0x7d6e02['push'](_0x7d6e02['shift']());}};_0x114064(++_0x1a0ab9);}(_0xe369,0x13c));var _0x9e36=function(_0x5ddc27,_0x4d7a4d){_0x5ddc27=_0x5ddc27-0x0;var _0x246e6a=_0xe369[_0x5ddc27];return _0x246e6a;};'use strict';var EventEmitter=require(_0x9e36('0x0'));var OpenchannelAccount=require(_0x9e36('0x1'))['db'][_0x9e36('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9e36('0x3')](0x0);var events={'afterCreate':_0x9e36('0x4'),'afterUpdate':_0x9e36('0x5'),'afterDestroy':'remove'};function emitEvent(_0x125352){return function(_0x57fc53,_0x13fcd9,_0x5f4933){OpenchannelAccountEvents[_0x9e36('0x6')](_0x125352+':'+_0x57fc53['id'],_0x57fc53);OpenchannelAccountEvents['emit'](_0x125352,_0x57fc53);_0x5f4933(null);};}for(var e in events){if(events[_0x9e36('0x7')](e)){var event=events[e];OpenchannelAccount[_0x9e36('0x8')](e,emitEvent(event));}}module[_0x9e36('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 7c9207b..0269c46 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 _0x6a2b=['define','openchannel_accounts','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x16e143,_0x5a9e73){var _0x422576=function(_0x571833){while(--_0x571833){_0x16e143['push'](_0x16e143['shift']());}};_0x422576(++_0x5a9e73);}(_0x6a2b,0x1e2));var _0xb6a2=function(_0x52de74,_0x152687){_0x52de74=_0x52de74-0x0;var _0x33113e=_0x6a2b[_0x52de74];return _0x33113e;};'use strict';var _=require('lodash');var util=require(_0xb6a2('0x0'));var logger=require(_0xb6a2('0x1'))('api');var moment=require(_0xb6a2('0x2'));var BPromise=require('bluebird');var rp=require(_0xb6a2('0x3'));var fs=require('fs');var path=require(_0xb6a2('0x4'));var rimraf=require(_0xb6a2('0x5'));var config=require(_0xb6a2('0x6'));var attributes=require('./openchannelAccount.attributes');module[_0xb6a2('0x7')]=function(_0x3dc5ca,_0x3c1d87){return _0x3dc5ca[_0xb6a2('0x8')]('OpenchannelAccount',attributes,{'tableName':_0xb6a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc02d=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xc02d,0x1aa));var _0xdc02=function(_0xbba93b,_0x1e10d0){_0xbba93b=_0xbba93b-0x0;var _0x59d354=_0xc02d[_0xbba93b];return _0x59d354;};'use strict';var _=require('lodash');var util=require(_0xdc02('0x0'));var logger=require(_0xdc02('0x1'))(_0xdc02('0x2'));var moment=require(_0xdc02('0x3'));var BPromise=require(_0xdc02('0x4'));var rp=require(_0xdc02('0x5'));var fs=require('fs');var path=require(_0xdc02('0x6'));var rimraf=require(_0xdc02('0x7'));var config=require(_0xdc02('0x8'));var attributes=require(_0xdc02('0x9'));module[_0xdc02('0xa')]=function(_0x592468,_0x27a980){return _0x592468[_0xdc02('0xb')](_0xdc02('0xc'),attributes,{'tableName':_0xdc02('0xd'),'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 1e9d46f..56d76fd 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 _0xe7da=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x1d9cec,_0x352d38){var _0x2c9cf3=function(_0x45367a){while(--_0x45367a){_0x1d9cec['push'](_0x1d9cec['shift']());}};_0x2c9cf3(++_0x352d38);}(_0xe7da,0x194));var _0xae7d=function(_0x3c51df,_0xed6f28){_0x3c51df=_0x3c51df-0x0;var _0x4a7c33=_0xe7da[_0x3c51df];return _0x4a7c33;};'use strict';var _=require(_0xae7d('0x0'));var util=require('util');var moment=require(_0xae7d('0x1'));var BPromise=require(_0xae7d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae7d('0x3'));var db=require(_0xae7d('0x4'))['db'];var utils=require(_0xae7d('0x5'));var logger=require(_0xae7d('0x6'))(_0xae7d('0x7'));var config=require(_0xae7d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xae7d('0x9')]['http']({'port':0x232a});config[_0xae7d('0xa')]=_['defaults'](config['redis'],{'host':_0xae7d('0xb'),'port':0x18eb});var socket=require(_0xae7d('0xc'))(new Redis(config[_0xae7d('0xa')]));require(_0xae7d('0xd'))[_0xae7d('0xe')](socket);function respondWithRpcPromise(_0x1fdbc7,_0x10f8c0,_0x33973b){return new BPromise(function(_0x2f7ce0,_0x4db081){return client[_0xae7d('0xf')](_0x1fdbc7,_0x33973b)[_0xae7d('0x10')](function(_0x21b9cd){logger[_0xae7d('0x11')](_0xae7d('0x12'),_0x10f8c0,_0xae7d('0x13'));logger[_0xae7d('0x14')](_0xae7d('0x15'),_0x10f8c0,_0xae7d('0x13'),JSON[_0xae7d('0x16')](_0x21b9cd));if(_0x21b9cd[_0xae7d('0x17')]){if(_0x21b9cd[_0xae7d('0x17')][_0xae7d('0x18')]===0x1f4){logger[_0xae7d('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x10f8c0,_0x21b9cd['error'][_0xae7d('0x19')]);return _0x4db081(_0x21b9cd[_0xae7d('0x17')]['message']);}logger[_0xae7d('0x17')](_0xae7d('0x12'),_0x10f8c0,_0x21b9cd[_0xae7d('0x17')][_0xae7d('0x19')]);return _0x2f7ce0(_0x21b9cd[_0xae7d('0x17')]['message']);}else{logger[_0xae7d('0x11')](_0xae7d('0x12'),_0x10f8c0,'request\x20sent');_0x2f7ce0(_0x21b9cd[_0xae7d('0x1a')][_0xae7d('0x19')]);}})['catch'](function(_0x3ec2cc){logger[_0xae7d('0x17')](_0xae7d('0x12'),_0x10f8c0,_0x3ec2cc);_0x4db081(_0x3ec2cc);});});} \ No newline at end of file +var _0x8045=['defaults','localhost','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x296d9d,_0x4d286b){var _0x53f5d0=function(_0x2ebcf9){while(--_0x2ebcf9){_0x296d9d['push'](_0x296d9d['shift']());}};_0x53f5d0(++_0x4d286b);}(_0x8045,0x1da));var _0x5804=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0x8045[_0x484cac];return _0x1d6e77;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5804('0x0'));var BPromise=require(_0x5804('0x1'));var rs=require(_0x5804('0x2'));var fs=require('fs');var Redis=require(_0x5804('0x3'));var db=require(_0x5804('0x4'))['db'];var utils=require(_0x5804('0x5'));var logger=require(_0x5804('0x6'))(_0x5804('0x7'));var config=require(_0x5804('0x8'));var jayson=require(_0x5804('0x9'));var client=jayson[_0x5804('0xa')]['http']({'port':0x232a});config[_0x5804('0xb')]=_[_0x5804('0xc')](config['redis'],{'host':_0x5804('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5804('0xb')]));require(_0x5804('0xe'))[_0x5804('0xf')](socket);function respondWithRpcPromise(_0x49c335,_0x2047db,_0xca401b){return new BPromise(function(_0x3fde68,_0x5b5735){return client[_0x5804('0x10')](_0x49c335,_0xca401b)[_0x5804('0x11')](function(_0x3596d3){logger[_0x5804('0x12')](_0x5804('0x13'),_0x2047db,_0x5804('0x14'));logger['debug'](_0x5804('0x15'),_0x2047db,_0x5804('0x14'),JSON['stringify'](_0x3596d3));if(_0x3596d3[_0x5804('0x16')]){if(_0x3596d3[_0x5804('0x16')][_0x5804('0x17')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2047db,_0x3596d3[_0x5804('0x16')][_0x5804('0x18')]);return _0x5b5735(_0x3596d3[_0x5804('0x16')]['message']);}logger['error'](_0x5804('0x13'),_0x2047db,_0x3596d3[_0x5804('0x16')][_0x5804('0x18')]);return _0x3fde68(_0x3596d3['error']['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2047db,_0x5804('0x14'));_0x3fde68(_0x3596d3[_0x5804('0x19')][_0x5804('0x18')]);}})[_0x5804('0x1a')](function(_0x35776f){logger[_0x5804('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x2047db,_0x35776f);_0x5b5735(_0x35776f);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 243a346..469fb6f 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 _0xdf90=['save','remove','update','emit','removeListener','register','length','./openchannelAccount.events'];(function(_0x23d2d9,_0x5cfb3f){var _0x2d64e4=function(_0x2c1d9d){while(--_0x2c1d9d){_0x23d2d9['push'](_0x23d2d9['shift']());}};_0x2d64e4(++_0x5cfb3f);}(_0xdf90,0x7f));var _0x0df9=function(_0x1621dd,_0x172229){_0x1621dd=_0x1621dd-0x0;var _0x3b0046=_0xdf90[_0x1621dd];return _0x3b0046;};'use strict';var OpenchannelAccountEvents=require(_0x0df9('0x0'));var events=[_0x0df9('0x1'),_0x0df9('0x2'),_0x0df9('0x3')];function createListener(_0x357da1,_0x4c91ab){return function(_0x50d08f){_0x4c91ab[_0x0df9('0x4')](_0x357da1,_0x50d08f);};}function removeListener(_0x3fa0ef,_0x299d31){return function(){OpenchannelAccountEvents[_0x0df9('0x5')](_0x3fa0ef,_0x299d31);};}exports[_0x0df9('0x6')]=function(_0xba5414){for(var _0x1b044a=0x0,_0x56f790=events[_0x0df9('0x7')];_0x1b044a<_0x56f790;_0x1b044a++){var _0x35ecc8=events[_0x1b044a];var _0x5abb5c=createListener('openchannelAccount:'+_0x35ecc8,_0xba5414);OpenchannelAccountEvents['on'](_0x35ecc8,_0x5abb5c);}}; \ No newline at end of file +var _0x2601=['emit','removeListener','register','length','openchannelAccount:','remove'];(function(_0x3ba45b,_0x410d98){var _0x15b075=function(_0x3965fc){while(--_0x3965fc){_0x3ba45b['push'](_0x3ba45b['shift']());}};_0x15b075(++_0x410d98);}(_0x2601,0x1d3));var _0x1260=function(_0x16109f,_0x155f4a){_0x16109f=_0x16109f-0x0;var _0xc77d03=_0x2601[_0x16109f];return _0xc77d03;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x1260('0x0'),'update'];function createListener(_0x35d4e1,_0x124a3f){return function(_0x329d69){_0x124a3f[_0x1260('0x1')](_0x35d4e1,_0x329d69);};}function removeListener(_0x25750f,_0x5dbc17){return function(){OpenchannelAccountEvents[_0x1260('0x2')](_0x25750f,_0x5dbc17);};}exports[_0x1260('0x3')]=function(_0x4b2d57){for(var _0x39a1eb=0x0,_0x14d07d=events[_0x1260('0x4')];_0x39a1eb<_0x14d07d;_0x39a1eb++){var _0x26b0d3=events[_0x39a1eb];var _0x1800b1=createListener(_0x1260('0x5')+_0x26b0d3,_0x4b2d57);OpenchannelAccountEvents['on'](_0x26b0d3,_0x1800b1);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 9a16f88..45c6a41 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 _0xabb4=['./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment'];(function(_0x2e4f51,_0x41906c){var _0x21c986=function(_0x5329ca){while(--_0x5329ca){_0x2e4f51['push'](_0x2e4f51['shift']());}};_0x21c986(++_0x41906c);}(_0xabb4,0x12d));var _0x4abb=function(_0x46f94a,_0x3396b5){_0x46f94a=_0x46f94a-0x0;var _0x53c3ca=_0xabb4[_0x46f94a];return _0x53c3ca;};'use strict';var multer=require('multer');var util=require(_0x4abb('0x0'));var path=require(_0x4abb('0x1'));var timeout=require(_0x4abb('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4abb('0x3'));var config=require(_0x4abb('0x4'));var controller=require(_0x4abb('0x5'));router[_0x4abb('0x6')]('/',auth[_0x4abb('0x7')](),controller[_0x4abb('0x8')]);router[_0x4abb('0x6')](_0x4abb('0x9'),auth[_0x4abb('0x7')](),controller['show']);router[_0x4abb('0xa')]('/',auth[_0x4abb('0x7')](),controller[_0x4abb('0xb')]);router[_0x4abb('0xc')](_0x4abb('0x9'),auth['isAuthenticated'](),controller[_0x4abb('0xd')]);router[_0x4abb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4abb('0xf')]);module[_0x4abb('0x10')]=router; \ No newline at end of file +var _0xc1de=['put','/:id','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create'];(function(_0x77773a,_0x5a7026){var _0x1091a2=function(_0x276af5){while(--_0x276af5){_0x77773a['push'](_0x77773a['shift']());}};_0x1091a2(++_0x5a7026);}(_0xc1de,0x148));var _0xec1d=function(_0x4001df,_0x1c6e2d){_0x4001df=_0x4001df-0x0;var _0x40e7b5=_0xc1de[_0x4001df];return _0x40e7b5;};'use strict';var multer=require(_0xec1d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec1d('0x1'));var express=require(_0xec1d('0x2'));var router=express[_0xec1d('0x3')]();var auth=require(_0xec1d('0x4'));var interaction=require(_0xec1d('0x5'));var config=require(_0xec1d('0x6'));var controller=require(_0xec1d('0x7'));router[_0xec1d('0x8')]('/',auth[_0xec1d('0x9')](),controller[_0xec1d('0xa')]);router[_0xec1d('0x8')]('/:id',auth[_0xec1d('0x9')](),controller[_0xec1d('0xb')]);router[_0xec1d('0xc')]('/',auth[_0xec1d('0x9')](),controller[_0xec1d('0xd')]);router[_0xec1d('0xe')](_0xec1d('0xf'),auth['isAuthenticated'](),controller[_0xec1d('0x10')]);router['delete'](_0xec1d('0xf'),auth[_0xec1d('0x9')](),controller[_0xec1d('0x11')]);module[_0xec1d('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 5ccebe2..832939b 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 _0x1a06=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x8b6277,_0x47abce){var _0x2777ea=function(_0x3c550e){while(--_0x3c550e){_0x8b6277['push'](_0x8b6277['shift']());}};_0x2777ea(++_0x47abce);}(_0x1a06,0x1e4));var _0x61a0=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x1a06[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0x61a0('0x0'));module[_0x61a0('0x1')]={'priority':{'type':Sequelize[_0x61a0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x61a0('0x3')],'allowNull':![],'defaultValue':_0x61a0('0x4')},'appdata':{'type':Sequelize[_0x61a0('0x5')]()},'description':{'type':Sequelize[_0x61a0('0x3')]},'interval':{'type':Sequelize[_0x61a0('0x3')],'defaultValue':_0x61a0('0x6')}}; \ No newline at end of file +var _0xbfa3=['exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x579372,_0x17e291){var _0x47a116=function(_0x47d60b){while(--_0x47d60b){_0x579372['push'](_0x579372['shift']());}};_0x47a116(++_0x17e291);}(_0xbfa3,0x1f4));var _0x3bfa=function(_0x7e8de,_0x13e3b6){_0x7e8de=_0x7e8de-0x0;var _0x55c822=_0xbfa3[_0x7e8de];return _0x55c822;};'use strict';var Sequelize=require('sequelize');module[_0x3bfa('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3bfa('0x1')],'allowNull':![],'defaultValue':_0x3bfa('0x2')},'appdata':{'type':Sequelize[_0x3bfa('0x3')]()},'description':{'type':Sequelize[_0x3bfa('0x1')]},'interval':{'type':Sequelize[_0x3bfa('0x1')],'defaultValue':_0x3bfa('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 6f1b503..7becd3e 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 _0x6958=['key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','options','rows','catch','show','params','includeAll','include','find','create','body','destroy','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','status','set','apply','reject','save','update','then','error','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type'];(function(_0x5f43ce,_0x516a24){var _0x55cca0=function(_0x8a5560){while(--_0x8a5560){_0x5f43ce['push'](_0x5f43ce['shift']());}};_0x55cca0(++_0x516a24);}(_0x6958,0x18a));var _0x8695=function(_0x284a25,_0x2ccad4){_0x284a25=_0x284a25-0x0;var _0x360d31=_0x6958[_0x284a25];return _0x360d31;};'use strict';var pdf=require(_0x8695('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8695('0x1'));var rp=require(_0x8695('0x2'));var moment=require(_0x8695('0x3'));var BPromise=require(_0x8695('0x4'));var Mustache=require(_0x8695('0x5'));var util=require(_0x8695('0x6'));var path=require(_0x8695('0x7'));var sox=require(_0x8695('0x8'));var csv=require(_0x8695('0x9'));var ejs=require(_0x8695('0xa'));var fs=require('fs');var _=require(_0x8695('0xb'));var squel=require(_0x8695('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8695('0x9'));var querystring=require(_0x8695('0xd'));var Papa=require(_0x8695('0xe'));var Redis=require(_0x8695('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8695('0x10'));var as=require(_0x8695('0x11'));var hardwareService=require(_0x8695('0x12'));var logger=require(_0x8695('0x13'))(_0x8695('0x14'));var utils=require(_0x8695('0x15'));var config=require(_0x8695('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8695('0x17'))['db'];function respondWithStatusCode(_0x1947a0,_0x55731c){_0x55731c=_0x55731c||0xcc;return function(_0xca9551){if(_0xca9551){return _0x1947a0[_0x8695('0x18')](_0x55731c);}return _0x1947a0['status'](_0x55731c)[_0x8695('0x19')]();};}function respondWithResult(_0x42ded3,_0x14008a){_0x14008a=_0x14008a||0xc8;return function(_0x521d3f){if(_0x521d3f){return _0x42ded3['status'](_0x14008a)[_0x8695('0x1a')](_0x521d3f);}};}function respondWithFilteredResult(_0xd521,_0x581cf3){return function(_0x55a5c0){if(_0x55a5c0){var _0x2bdfdc=_0x55a5c0['count'],_0x1ce35c=_0x581cf3[_0x8695('0x1b')],_0x20a845=_0x581cf3['offset']+_0x581cf3['limit'],_0x161aaa;if(_0x20a845>=_0x2bdfdc){_0x20a845=_0x2bdfdc;_0x161aaa=0xc8;}else{_0x161aaa=0xce;}_0xd521[_0x8695('0x1c')](_0x161aaa);return _0xd521[_0x8695('0x1d')]('Content-Range',_0x1ce35c+'-'+_0x20a845+'/'+_0x2bdfdc)['json'](_0x55a5c0);}return null;};}function patchUpdates(_0x3d2773){return function(_0x537f9b){try{jsonpatch[_0x8695('0x1e')](_0x537f9b,_0x3d2773,!![]);}catch(_0x3a96e4){return BPromise[_0x8695('0x1f')](_0x3a96e4);}return _0x537f9b[_0x8695('0x20')]();};}function saveUpdates(_0x18ac83,_0x3c4545){return function(_0x507931){if(_0x507931){return _0x507931[_0x8695('0x21')](_0x18ac83)[_0x8695('0x22')](function(_0x4653f2){return _0x4653f2;});}return null;};}function removeEntity(_0x2b8128,_0x5823aa){return function(_0xa94828){if(_0xa94828){return _0xa94828['destroy']()[_0x8695('0x22')](function(){_0x2b8128[_0x8695('0x1c')](0xcc)[_0x8695('0x19')]();});}};}function handleEntityNotFound(_0x197283,_0xda7e4a){return function(_0x2d98c3){if(!_0x2d98c3){_0x197283[_0x8695('0x18')](0x194);}return _0x2d98c3;};}function handleError(_0x46158d,_0x1bc44e){_0x1bc44e=_0x1bc44e||0x1f4;return function(_0x2b5f3b){logger[_0x8695('0x23')](_0x2b5f3b[_0x8695('0x24')]);if(_0x2b5f3b[_0x8695('0x25')]){delete _0x2b5f3b[_0x8695('0x25')];}_0x46158d[_0x8695('0x1c')](_0x1bc44e)['send'](_0x2b5f3b);};}exports[_0x8695('0x26')]=function(_0x42925c,_0x55d343){var _0x290fdd={},_0x48024a={},_0x41e00a={'count':0x0,'rows':[]};var _0x33249b=_[_0x8695('0x27')](db[_0x8695('0x28')][_0x8695('0x29')],function(_0x39fb40){return{'name':_0x39fb40[_0x8695('0x2a')],'type':_0x39fb40[_0x8695('0x2b')][_0x8695('0x2c')]};});_0x48024a[_0x8695('0x2d')]=_[_0x8695('0x27')](_0x33249b,_0x8695('0x25'));_0x48024a[_0x8695('0x2e')]=_[_0x8695('0x2f')](_0x42925c['query']);_0x48024a[_0x8695('0x30')]=_['intersection'](_0x48024a[_0x8695('0x2d')],_0x48024a[_0x8695('0x2e')]);_0x290fdd[_0x8695('0x31')]=_[_0x8695('0x32')](_0x48024a[_0x8695('0x2d')],qs[_0x8695('0x33')](_0x42925c[_0x8695('0x2e')][_0x8695('0x33')]));_0x290fdd['attributes']=_0x290fdd[_0x8695('0x31')][_0x8695('0x34')]?_0x290fdd[_0x8695('0x31')]:_0x48024a['model'];if(!_0x42925c[_0x8695('0x2e')][_0x8695('0x35')](_0x8695('0x36'))){_0x290fdd[_0x8695('0x37')]=qs[_0x8695('0x37')](_0x42925c['query'][_0x8695('0x37')]);_0x290fdd[_0x8695('0x1b')]=qs[_0x8695('0x1b')](_0x42925c['query']['offset']);}_0x290fdd[_0x8695('0x38')]=qs[_0x8695('0x39')](_0x42925c['query'][_0x8695('0x39')]);_0x290fdd['where']=qs[_0x8695('0x30')](_[_0x8695('0x3a')](_0x42925c['query'],_0x48024a['filters']),_0x33249b);if(_0x42925c[_0x8695('0x2e')]['filter']){_0x290fdd[_0x8695('0x3b')]=_[_0x8695('0x3c')](_0x290fdd['where'],{'$or':_[_0x8695('0x27')](_0x33249b,function(_0x1ec003){if(_0x1ec003['type']!==_0x8695('0x3d')){var _0x38ff7b={};_0x38ff7b[_0x1ec003[_0x8695('0x25')]]={'$like':'%'+_0x42925c[_0x8695('0x2e')]['filter']+'%'};return _0x38ff7b;}})});}_0x290fdd=_[_0x8695('0x3c')]({},_0x290fdd,_0x42925c[_0x8695('0x3e')]);var _0x558d2b={'where':_0x290fdd['where']};return db['OpenchannelApplication']['count'](_0x558d2b)['then'](function(_0x3da2bd){_0x41e00a['count']=_0x3da2bd;if(_0x42925c[_0x8695('0x2e')]['includeAll']){_0x290fdd['include']=[{'all':!![]}];}return db[_0x8695('0x28')]['findAll'](_0x290fdd);})[_0x8695('0x22')](function(_0x1101df){_0x41e00a[_0x8695('0x3f')]=_0x1101df;return _0x41e00a;})[_0x8695('0x22')](respondWithFilteredResult(_0x55d343,_0x290fdd))[_0x8695('0x40')](handleError(_0x55d343,null));};exports[_0x8695('0x41')]=function(_0x41db32,_0x3fea4d){var _0xb40231={'raw':!![],'where':{'id':_0x41db32[_0x8695('0x42')]['id']}},_0x34fafd={};_0x34fafd[_0x8695('0x2d')]=_['keys'](db[_0x8695('0x28')][_0x8695('0x29')]);_0x34fafd[_0x8695('0x2e')]=_[_0x8695('0x2f')](_0x41db32[_0x8695('0x2e')]);_0x34fafd[_0x8695('0x30')]=_[_0x8695('0x32')](_0x34fafd[_0x8695('0x2d')],_0x34fafd[_0x8695('0x2e')]);_0xb40231[_0x8695('0x31')]=_['intersection'](_0x34fafd['model'],qs[_0x8695('0x33')](_0x41db32[_0x8695('0x2e')]['fields']));_0xb40231[_0x8695('0x31')]=_0xb40231[_0x8695('0x31')][_0x8695('0x34')]?_0xb40231['attributes']:_0x34fafd[_0x8695('0x2d')];if(_0x41db32[_0x8695('0x2e')][_0x8695('0x43')]){_0xb40231[_0x8695('0x44')]=[{'all':!![]}];}_0xb40231=_[_0x8695('0x3c')]({},_0xb40231,_0x41db32[_0x8695('0x3e')]);return db[_0x8695('0x28')][_0x8695('0x45')](_0xb40231)[_0x8695('0x22')](handleEntityNotFound(_0x3fea4d,null))[_0x8695('0x22')](respondWithResult(_0x3fea4d,null))[_0x8695('0x40')](handleError(_0x3fea4d,null));};exports['create']=function(_0x35c8ef,_0x3becac){return db['OpenchannelApplication'][_0x8695('0x46')](_0x35c8ef[_0x8695('0x47')],{})[_0x8695('0x22')](respondWithResult(_0x3becac,0xc9))[_0x8695('0x40')](handleError(_0x3becac,null));};exports[_0x8695('0x21')]=function(_0x59832e,_0x36087d){if(_0x59832e[_0x8695('0x47')]['id']){delete _0x59832e[_0x8695('0x47')]['id'];}return db[_0x8695('0x28')][_0x8695('0x45')]({'where':{'id':_0x59832e['params']['id']}})[_0x8695('0x22')](handleEntityNotFound(_0x36087d,null))['then'](saveUpdates(_0x59832e['body'],null))[_0x8695('0x22')](respondWithResult(_0x36087d,null))['catch'](handleError(_0x36087d,null));};exports[_0x8695('0x48')]=function(_0x2ddbcf,_0x31e9dc){return db[_0x8695('0x28')][_0x8695('0x45')]({'where':{'id':_0x2ddbcf[_0x8695('0x42')]['id']}})[_0x8695('0x22')](handleEntityNotFound(_0x31e9dc,null))[_0x8695('0x22')](removeEntity(_0x31e9dc,null))[_0x8695('0x40')](handleError(_0x31e9dc,null));}; \ No newline at end of file +var _0x767a=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','sendStatus','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','VIRTUAL','merge','options','OpenchannelApplication','includeAll','include','rows','show','params','keys','find','create','body','catch','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x767a,0xc1));var _0xa767=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x767a[_0x1ccdf7];return _0x52a0ae;};'use strict';var pdf=require(_0xa767('0x0'));var emlformat=require(_0xa767('0x1'));var rimraf=require(_0xa767('0x2'));var zipdir=require(_0xa767('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa767('0x4'));var moment=require(_0xa767('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa767('0x6'));var util=require(_0xa767('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa767('0x8'));var ejs=require(_0xa767('0x9'));var fs=require('fs');var _=require(_0xa767('0xa'));var squel=require(_0xa767('0xb'));var crypto=require('crypto');var jsforce=require(_0xa767('0xc'));var deskjs=require(_0xa767('0xd'));var toCsv=require(_0xa767('0x8'));var querystring=require(_0xa767('0xe'));var Papa=require('papaparse');var Redis=require(_0xa767('0xf'));var authService=require(_0xa767('0x10'));var qs=require(_0xa767('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa767('0x12'));var logger=require(_0xa767('0x13'))(_0xa767('0x14'));var utils=require(_0xa767('0x15'));var config=require(_0xa767('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa767('0x17'))['db'];function respondWithStatusCode(_0x51c944,_0x2a00d1){_0x2a00d1=_0x2a00d1||0xcc;return function(_0x24f21e){if(_0x24f21e){return _0x51c944['sendStatus'](_0x2a00d1);}return _0x51c944[_0xa767('0x18')](_0x2a00d1)[_0xa767('0x19')]();};}function respondWithResult(_0x3d21d8,_0x1c6304){_0x1c6304=_0x1c6304||0xc8;return function(_0x1f6ecb){if(_0x1f6ecb){return _0x3d21d8[_0xa767('0x18')](_0x1c6304)[_0xa767('0x1a')](_0x1f6ecb);}};}function respondWithFilteredResult(_0x504489,_0x32c86b){return function(_0x6afc0e){if(_0x6afc0e){var _0x319eef=_0x6afc0e[_0xa767('0x1b')],_0x498981=_0x32c86b[_0xa767('0x1c')],_0x11f5ee=_0x32c86b['offset']+_0x32c86b[_0xa767('0x1d')],_0xba6d57;if(_0x11f5ee>=_0x319eef){_0x11f5ee=_0x319eef;_0xba6d57=0xc8;}else{_0xba6d57=0xce;}_0x504489[_0xa767('0x18')](_0xba6d57);return _0x504489[_0xa767('0x1e')](_0xa767('0x1f'),_0x498981+'-'+_0x11f5ee+'/'+_0x319eef)[_0xa767('0x1a')](_0x6afc0e);}return null;};}function patchUpdates(_0x17ab29){return function(_0x1f2347){try{jsonpatch[_0xa767('0x20')](_0x1f2347,_0x17ab29,!![]);}catch(_0x5e32c4){return BPromise['reject'](_0x5e32c4);}return _0x1f2347[_0xa767('0x21')]();};}function saveUpdates(_0x2f2078,_0x48167c){return function(_0x6d49ad){if(_0x6d49ad){return _0x6d49ad['update'](_0x2f2078)[_0xa767('0x22')](function(_0x3fa915){return _0x3fa915;});}return null;};}function removeEntity(_0x5e1a8a,_0x5eea07){return function(_0x877b90){if(_0x877b90){return _0x877b90[_0xa767('0x23')]()[_0xa767('0x22')](function(){_0x5e1a8a[_0xa767('0x18')](0xcc)[_0xa767('0x19')]();});}};}function handleEntityNotFound(_0x57fa33,_0xcad17){return function(_0x18bb56){if(!_0x18bb56){_0x57fa33[_0xa767('0x24')](0x194);}return _0x18bb56;};}function handleError(_0x37eb59,_0x40c397){_0x40c397=_0x40c397||0x1f4;return function(_0x4a2207){logger['error'](_0x4a2207['stack']);if(_0x4a2207[_0xa767('0x25')]){delete _0x4a2207[_0xa767('0x25')];}_0x37eb59['status'](_0x40c397)['send'](_0x4a2207);};}exports[_0xa767('0x26')]=function(_0x58826d,_0x5cfe82){var _0x3c1aad={},_0x640be1={},_0x401fed={'count':0x0,'rows':[]};var _0x25af94=_['map'](db['OpenchannelApplication'][_0xa767('0x27')],function(_0x764c2d){return{'name':_0x764c2d[_0xa767('0x28')],'type':_0x764c2d[_0xa767('0x29')][_0xa767('0x2a')]};});_0x640be1[_0xa767('0x2b')]=_[_0xa767('0x2c')](_0x25af94,'name');_0x640be1['query']=_['keys'](_0x58826d[_0xa767('0x2d')]);_0x640be1[_0xa767('0x2e')]=_[_0xa767('0x2f')](_0x640be1['model'],_0x640be1[_0xa767('0x2d')]);_0x3c1aad[_0xa767('0x30')]=_[_0xa767('0x2f')](_0x640be1[_0xa767('0x2b')],qs['fields'](_0x58826d[_0xa767('0x2d')][_0xa767('0x31')]));_0x3c1aad['attributes']=_0x3c1aad[_0xa767('0x30')][_0xa767('0x32')]?_0x3c1aad[_0xa767('0x30')]:_0x640be1[_0xa767('0x2b')];if(!_0x58826d[_0xa767('0x2d')]['hasOwnProperty']('nolimit')){_0x3c1aad['limit']=qs[_0xa767('0x1d')](_0x58826d[_0xa767('0x2d')]['limit']);_0x3c1aad[_0xa767('0x1c')]=qs[_0xa767('0x1c')](_0x58826d['query'][_0xa767('0x1c')]);}_0x3c1aad['order']=qs['sort'](_0x58826d['query'][_0xa767('0x33')]);_0x3c1aad[_0xa767('0x34')]=qs[_0xa767('0x2e')](_[_0xa767('0x35')](_0x58826d[_0xa767('0x2d')],_0x640be1[_0xa767('0x2e')]),_0x25af94);if(_0x58826d[_0xa767('0x2d')][_0xa767('0x36')]){_0x3c1aad[_0xa767('0x34')]=_['merge'](_0x3c1aad[_0xa767('0x34')],{'$or':_[_0xa767('0x2c')](_0x25af94,function(_0x406db3){if(_0x406db3[_0xa767('0x29')]!==_0xa767('0x37')){var _0x1bb4a9={};_0x1bb4a9[_0x406db3[_0xa767('0x25')]]={'$like':'%'+_0x58826d['query'][_0xa767('0x36')]+'%'};return _0x1bb4a9;}})});}_0x3c1aad=_[_0xa767('0x38')]({},_0x3c1aad,_0x58826d[_0xa767('0x39')]);var _0x38999b={'where':_0x3c1aad[_0xa767('0x34')]};return db[_0xa767('0x3a')]['count'](_0x38999b)['then'](function(_0x35bb0d){_0x401fed[_0xa767('0x1b')]=_0x35bb0d;if(_0x58826d[_0xa767('0x2d')][_0xa767('0x3b')]){_0x3c1aad[_0xa767('0x3c')]=[{'all':!![]}];}return db[_0xa767('0x3a')]['findAll'](_0x3c1aad);})[_0xa767('0x22')](function(_0x3042a9){_0x401fed[_0xa767('0x3d')]=_0x3042a9;return _0x401fed;})[_0xa767('0x22')](respondWithFilteredResult(_0x5cfe82,_0x3c1aad))['catch'](handleError(_0x5cfe82,null));};exports[_0xa767('0x3e')]=function(_0x3ce4d6,_0x1815cb){var _0xbe808b={'raw':!![],'where':{'id':_0x3ce4d6[_0xa767('0x3f')]['id']}},_0x3b12a7={};_0x3b12a7[_0xa767('0x2b')]=_[_0xa767('0x40')](db[_0xa767('0x3a')][_0xa767('0x27')]);_0x3b12a7[_0xa767('0x2d')]=_[_0xa767('0x40')](_0x3ce4d6[_0xa767('0x2d')]);_0x3b12a7['filters']=_[_0xa767('0x2f')](_0x3b12a7[_0xa767('0x2b')],_0x3b12a7[_0xa767('0x2d')]);_0xbe808b[_0xa767('0x30')]=_[_0xa767('0x2f')](_0x3b12a7[_0xa767('0x2b')],qs[_0xa767('0x31')](_0x3ce4d6[_0xa767('0x2d')]['fields']));_0xbe808b[_0xa767('0x30')]=_0xbe808b[_0xa767('0x30')][_0xa767('0x32')]?_0xbe808b[_0xa767('0x30')]:_0x3b12a7[_0xa767('0x2b')];if(_0x3ce4d6[_0xa767('0x2d')][_0xa767('0x3b')]){_0xbe808b[_0xa767('0x3c')]=[{'all':!![]}];}_0xbe808b=_[_0xa767('0x38')]({},_0xbe808b,_0x3ce4d6[_0xa767('0x39')]);return db[_0xa767('0x3a')][_0xa767('0x41')](_0xbe808b)[_0xa767('0x22')](handleEntityNotFound(_0x1815cb,null))['then'](respondWithResult(_0x1815cb,null))['catch'](handleError(_0x1815cb,null));};exports[_0xa767('0x42')]=function(_0x196a99,_0x51d7eb){return db['OpenchannelApplication']['create'](_0x196a99[_0xa767('0x43')],{})[_0xa767('0x22')](respondWithResult(_0x51d7eb,0xc9))[_0xa767('0x44')](handleError(_0x51d7eb,null));};exports[_0xa767('0x45')]=function(_0x3f0d87,_0x1abd5c){if(_0x3f0d87[_0xa767('0x43')]['id']){delete _0x3f0d87[_0xa767('0x43')]['id'];}return db['OpenchannelApplication'][_0xa767('0x41')]({'where':{'id':_0x3f0d87['params']['id']}})[_0xa767('0x22')](handleEntityNotFound(_0x1abd5c,null))[_0xa767('0x22')](saveUpdates(_0x3f0d87['body'],null))['then'](respondWithResult(_0x1abd5c,null))[_0xa767('0x44')](handleError(_0x1abd5c,null));};exports[_0xa767('0x23')]=function(_0x39d3ae,_0x158d80){return db[_0xa767('0x3a')]['find']({'where':{'id':_0x39d3ae[_0xa767('0x3f')]['id']}})['then'](handleEntityNotFound(_0x158d80,null))[_0xa767('0x22')](removeEntity(_0x158d80,null))[_0xa767('0x44')](handleError(_0x158d80,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 1cf9c76..c2c85d3 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 _0xfee3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xfee3,0x1c0));var _0x3fee=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0xfee3[_0x31a576];return _0x30b1d3;};'use strict';var _=require(_0x3fee('0x0'));var util=require(_0x3fee('0x1'));var logger=require(_0x3fee('0x2'))(_0x3fee('0x3'));var moment=require(_0x3fee('0x4'));var BPromise=require(_0x3fee('0x5'));var rp=require(_0x3fee('0x6'));var fs=require('fs');var path=require(_0x3fee('0x7'));var rimraf=require('rimraf');var config=require(_0x3fee('0x8'));var attributes=require(_0x3fee('0x9'));module[_0x3fee('0xa')]=function(_0x2aff5d,_0x5cb9a7){return _0x2aff5d[_0x3fee('0xb')](_0x3fee('0xc'),attributes,{'tableName':_0x3fee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3fee('0xe'),'collate':_0x3fee('0xf')});}; \ No newline at end of file +var _0xce94=['api','moment','request-promise','path','rimraf','./openchannelApplication.attributes','define','openchannel_applications','utf8mb4','lodash','../../config/logger'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xce94,0x8d));var _0x4ce9=function(_0xf37aa0,_0x2bcb0b){_0xf37aa0=_0xf37aa0-0x0;var _0x460c69=_0xce94[_0xf37aa0];return _0x460c69;};'use strict';var _=require(_0x4ce9('0x0'));var util=require('util');var logger=require(_0x4ce9('0x1'))(_0x4ce9('0x2'));var moment=require(_0x4ce9('0x3'));var BPromise=require('bluebird');var rp=require(_0x4ce9('0x4'));var fs=require('fs');var path=require(_0x4ce9('0x5'));var rimraf=require(_0x4ce9('0x6'));var config=require('../../config/environment');var attributes=require(_0x4ce9('0x7'));module['exports']=function(_0x4f1c8d,_0x5797fc){return _0x4f1c8d[_0x4ce9('0x8')]('OpenchannelApplication',attributes,{'tableName':_0x4ce9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ce9('0xa'),'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 4e68b87..c8f611d 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 _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_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')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['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(_0x4a903c,_0x463bba){var _0x3e10e0=function(_0x41d53e){while(--_0x41d53e){_0x4a903c['push'](_0x4a903c['shift']());}};_0x3e10e0(++_0x463bba);}(_0xb10b,0x12a));var _0xbb10=function(_0x188926,_0x1b2429){_0x188926=_0x188926-0x0;var _0x17f4bf=_0xb10b[_0x188926];return _0x17f4bf;};'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 418bf3a..92907e0 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 _0x4eeb=['tracked','openchannelinteraction:update','update','delete','destroy','/:id/tags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','openchannel','openchannelinteraction:addtags','addTags'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x4eeb,0x9d));var _0xb4ee=function(_0x38c06a,_0x418df7){_0x38c06a=_0x38c06a-0x0;var _0x57c015=_0x4eeb[_0x38c06a];return _0x57c015;};'use strict';var multer=require(_0xb4ee('0x0'));var util=require(_0xb4ee('0x1'));var path=require(_0xb4ee('0x2'));var timeout=require(_0xb4ee('0x3'));var express=require(_0xb4ee('0x4'));var router=express['Router']();var auth=require(_0xb4ee('0x5'));var interaction=require(_0xb4ee('0x6'));var config=require('../../config/environment');var controller=require(_0xb4ee('0x7'));router[_0xb4ee('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb4ee('0x8')]('/describe',auth[_0xb4ee('0x9')](),controller[_0xb4ee('0xa')]);router['get'](_0xb4ee('0xb'),auth[_0xb4ee('0x9')](),controller[_0xb4ee('0xc')]);router[_0xb4ee('0x8')](_0xb4ee('0xd'),auth[_0xb4ee('0x9')](),controller[_0xb4ee('0xe')]);router[_0xb4ee('0x8')](_0xb4ee('0xf'),auth[_0xb4ee('0x9')](),controller[_0xb4ee('0x10')]);router[_0xb4ee('0x11')]('/',auth[_0xb4ee('0x9')](),controller[_0xb4ee('0x12')]);router['post'](_0xb4ee('0xd'),auth[_0xb4ee('0x9')](),controller[_0xb4ee('0x13')]);router[_0xb4ee('0x11')]('/:id/tags',auth[_0xb4ee('0x9')](),interaction['tracked'](_0xb4ee('0x14'),_0xb4ee('0x15')),controller[_0xb4ee('0x16')]);router['put'](_0xb4ee('0xb'),auth[_0xb4ee('0x9')](),interaction[_0xb4ee('0x17')]('openchannel',_0xb4ee('0x18')),controller[_0xb4ee('0x19')]);router[_0xb4ee('0x1a')](_0xb4ee('0xb'),auth[_0xb4ee('0x9')](),interaction[_0xb4ee('0x17')](_0xb4ee('0x14'),'openchannelinteraction:destroy'),controller[_0xb4ee('0x1b')]);router[_0xb4ee('0x1a')](_0xb4ee('0x1c'),auth[_0xb4ee('0x9')](),controller['removeTags']);module[_0xb4ee('0x1d')]=router; \ No newline at end of file +var _0xa2f5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannel','addTags','put','/:id','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','multer','util','path','connect-timeout','express'];(function(_0x53c1c3,_0x222929){var _0x5c3aff=function(_0x2789da){while(--_0x2789da){_0x53c1c3['push'](_0x53c1c3['shift']());}};_0x5c3aff(++_0x222929);}(_0xa2f5,0xe2));var _0x5a2f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa2f5[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x5a2f('0x0'));var util=require(_0x5a2f('0x1'));var path=require(_0x5a2f('0x2'));var timeout=require(_0x5a2f('0x3'));var express=require(_0x5a2f('0x4'));var router=express[_0x5a2f('0x5')]();var auth=require(_0x5a2f('0x6'));var interaction=require(_0x5a2f('0x7'));var config=require(_0x5a2f('0x8'));var controller=require(_0x5a2f('0x9'));router[_0x5a2f('0xa')]('/',auth['isAuthenticated'](),controller[_0x5a2f('0xb')]);router[_0x5a2f('0xa')](_0x5a2f('0xc'),auth[_0x5a2f('0xd')](),controller[_0x5a2f('0xe')]);router['get']('/:id',auth[_0x5a2f('0xd')](),controller[_0x5a2f('0xf')]);router[_0x5a2f('0xa')](_0x5a2f('0x10'),auth[_0x5a2f('0xd')](),controller[_0x5a2f('0x11')]);router[_0x5a2f('0xa')](_0x5a2f('0x12'),auth[_0x5a2f('0xd')](),controller['download']);router[_0x5a2f('0x13')]('/',auth[_0x5a2f('0xd')](),controller[_0x5a2f('0x14')]);router[_0x5a2f('0x13')](_0x5a2f('0x10'),auth[_0x5a2f('0xd')](),controller[_0x5a2f('0x15')]);router[_0x5a2f('0x13')](_0x5a2f('0x16'),auth['isAuthenticated'](),interaction[_0x5a2f('0x17')](_0x5a2f('0x18'),'openchannelinteraction:addtags'),controller[_0x5a2f('0x19')]);router[_0x5a2f('0x1a')](_0x5a2f('0x1b'),auth['isAuthenticated'](),interaction['tracked'](_0x5a2f('0x18'),_0x5a2f('0x1c')),controller[_0x5a2f('0x1d')]);router[_0x5a2f('0x1e')]('/:id',auth[_0x5a2f('0xd')](),interaction[_0x5a2f('0x17')](_0x5a2f('0x18'),_0x5a2f('0x1f')),controller[_0x5a2f('0x20')]);router[_0x5a2f('0x1e')](_0x5a2f('0x16'),auth[_0x5a2f('0xd')](),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 56fedfb..89a4e83 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 _0xb9a0=['BOOLEAN','STRING','DATE','ENUM','out','sequelize','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb9a0,0x186));var _0x0b9a=function(_0x3adead,_0x3a99a6){_0x3adead=_0x3adead-0x0;var _0x4d4131=_0xb9a0[_0x3adead];return _0x4d4131;};'use strict';var Sequelize=require(_0x0b9a('0x0'));module[_0x0b9a('0x1')]={'closed':{'type':Sequelize[_0x0b9a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0b9a('0x3')]},'secondDisposition':{'type':Sequelize[_0x0b9a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0b9a('0x3')]},'note':{'type':Sequelize[_0x0b9a('0x3')]},'read1stAt':{'type':Sequelize[_0x0b9a('0x4')]},'threadId':{'type':Sequelize[_0x0b9a('0x3')]},'externalUrl':{'type':Sequelize[_0x0b9a('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0b9a('0x5')]('in',_0x0b9a('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0b9a('0x3')]}}; \ No newline at end of file +var _0x466f=['DATE','STRING','ENUM','sequelize','BOOLEAN'];(function(_0x357b77,_0x15c40a){var _0x1f0290=function(_0x49c7a2){while(--_0x49c7a2){_0x357b77['push'](_0x357b77['shift']());}};_0x1f0290(++_0x15c40a);}(_0x466f,0x76));var _0xf466=function(_0x380896,_0x38f9c7){_0x380896=_0x380896-0x0;var _0x3faad4=_0x466f[_0x380896];return _0x3faad4;};'use strict';var Sequelize=require(_0xf466('0x0'));module['exports']={'closed':{'type':Sequelize[_0xf466('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf466('0x2')]},'disposition':{'type':Sequelize[_0xf466('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf466('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf466('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xf466('0x3')]},'lastMsgAt':{'type':Sequelize[_0xf466('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xf466('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf466('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6e726f6..871a15f 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 _0x1bd8=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','value','having','`\x20=\x200','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','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','text','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','OpenchannelInteraction','a.key','Account.key','a.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','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','show','params','include','merge','options','create','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','format','includeAll','findAll','setTags','spread','emit','removeTags','download','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Attachment','Messages','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','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','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','direction','out','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','Users','fullname','TagIds','Tags','forEach','push','catch','index','map','rawAttributes','fieldName','type'];(function(_0x3a03e8,_0xe4c8cc){var _0x401fbc=function(_0xfdf1da){while(--_0xfdf1da){_0x3a03e8['push'](_0x3a03e8['shift']());}};_0x401fbc(++_0xe4c8cc);}(_0x1bd8,0x1ab));var _0x81bd=function(_0xddbb0a,_0x492865){_0xddbb0a=_0xddbb0a-0x0;var _0x4621c7=_0x1bd8[_0xddbb0a];return _0x4621c7;};'use strict';var pdf=require(_0x81bd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x81bd('0x1'));var zipdir=require(_0x81bd('0x2'));var jsonpatch=require(_0x81bd('0x3'));var rp=require(_0x81bd('0x4'));var moment=require(_0x81bd('0x5'));var BPromise=require(_0x81bd('0x6'));var Mustache=require(_0x81bd('0x7'));var util=require(_0x81bd('0x8'));var path=require(_0x81bd('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x81bd('0xa'));var crypto=require(_0x81bd('0xb'));var jsforce=require(_0x81bd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x81bd('0xd'));var querystring=require(_0x81bd('0xe'));var Papa=require('papaparse');var Redis=require(_0x81bd('0xf'));var authService=require(_0x81bd('0x10'));var qs=require(_0x81bd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81bd('0x12'));var logger=require(_0x81bd('0x13'))(_0x81bd('0x14'));var utils=require(_0x81bd('0x15'));var config=require(_0x81bd('0x16'));var licenseUtil=require(_0x81bd('0x17'));var db=require('../../mysqldb')['db'];config[_0x81bd('0x18')]=_[_0x81bd('0x19')](config['redis'],{'host':_0x81bd('0x1a'),'port':0x18eb});var socket=require(_0x81bd('0x1b'))(new Redis(config[_0x81bd('0x18')]));require(_0x81bd('0x1c'))[_0x81bd('0x1d')](socket);function respondWithStatusCode(_0x55ba45,_0x4c8b4c){_0x4c8b4c=_0x4c8b4c||0xcc;return function(_0x47794c){if(_0x47794c){return _0x55ba45[_0x81bd('0x1e')](_0x4c8b4c);}return _0x55ba45[_0x81bd('0x1f')](_0x4c8b4c)[_0x81bd('0x20')]();};}function respondWithResult(_0x53f9e6,_0x4b97da){_0x4b97da=_0x4b97da||0xc8;return function(_0x4333db){if(_0x4333db){return _0x53f9e6[_0x81bd('0x1f')](_0x4b97da)[_0x81bd('0x21')](_0x4333db);}};}function respondWithFilteredResult(_0x5e678a,_0x3e6be6){return function(_0x35239a){if(_0x35239a){var _0xf38cb7=_0x35239a['count'],_0x2e5887=_0x3e6be6[_0x81bd('0x22')],_0x3084ff=_0x3e6be6[_0x81bd('0x22')]+_0x3e6be6[_0x81bd('0x23')],_0x33fdc7;if(_0x3084ff>=_0xf38cb7){_0x3084ff=_0xf38cb7;_0x33fdc7=0xc8;}else{_0x33fdc7=0xce;}_0x5e678a[_0x81bd('0x1f')](_0x33fdc7);return _0x5e678a[_0x81bd('0x24')](_0x81bd('0x25'),_0x2e5887+'-'+_0x3084ff+'/'+_0xf38cb7)[_0x81bd('0x21')](_0x35239a);}return null;};}function patchUpdates(_0xbf5c80){return function(_0x1969c5){try{jsonpatch[_0x81bd('0x26')](_0x1969c5,_0xbf5c80,!![]);}catch(_0x5de8da){return BPromise[_0x81bd('0x27')](_0x5de8da);}return _0x1969c5['save']();};}function saveUpdates(_0x3c44e4,_0x1796e7){return function(_0x15f9f3){if(_0x15f9f3){return _0x15f9f3[_0x81bd('0x28')](_0x3c44e4)['then'](function(_0x37138f){return _0x37138f;});}return null;};}function removeEntity(_0xcad9c9,_0x4f9d88){return function(_0xc2cfab){if(_0xc2cfab){return _0xc2cfab[_0x81bd('0x29')]()[_0x81bd('0x2a')](function(){_0xcad9c9[_0x81bd('0x1f')](0xcc)[_0x81bd('0x20')]();});}};}function handleEntityNotFound(_0x37657e,_0x5dc8f8){return function(_0x84dbd1){if(!_0x84dbd1){_0x37657e[_0x81bd('0x1e')](0x194);}return _0x84dbd1;};}function handleError(_0x6bd656,_0x563176){_0x563176=_0x563176||0x1f4;return function(_0x226985){logger[_0x81bd('0x2b')](_0x226985['stack']);if(_0x226985[_0x81bd('0x2c')]){delete _0x226985['name'];}_0x6bd656[_0x81bd('0x1f')](_0x563176)['send'](_0x226985);};}function getInteractionUsers(_0x44a60f,_0x2c5aa1){return new BPromise(function(_0x152381,_0x43145c){try{if(_0x2c5aa1[_0x44a60f['id']]){_0x44a60f[_0x81bd('0x2d')]=_['map'](_0x2c5aa1[_0x44a60f['id']],function(_0x43d749){return{'id':_0x43d749['id'],'fullname':_0x43d749[_0x81bd('0x2e')]};});}}catch(_0x9cb935){_0x43145c(_0x9cb935);}_0x152381(_0x44a60f);});}function getInteractionTags(_0x1198b6,_0x3d3f6e){return new BPromise(function(_0x581e8a,_0x278f00){try{if(_0x1198b6[_0x81bd('0x2f')]){_0x1198b6[_0x81bd('0x30')]=[];_0x1198b6[_0x81bd('0x2f')]['split'](',')[_0x81bd('0x31')](function(_0x3865ed){_0x1198b6[_0x81bd('0x30')][_0x81bd('0x32')](_0x3d3f6e[_0x3865ed]);});}delete _0x1198b6[_0x81bd('0x2f')];}catch(_0x58c61c){_0x278f00(_0x58c61c);}_0x581e8a(_0x1198b6);});}function updateOpenchannelInteraction(_0x1f92e6,_0x57a01d,_0x1788a5){return new BPromise(function(_0x2743ab,_0x2dc0b0){return getInteractionUsers(_0x1f92e6,_0x1788a5)['then'](function(_0x50d587){return getInteractionTags(_0x50d587,_0x57a01d);})[_0x81bd('0x2a')](function(_0x13f66f){_0x2743ab(_0x13f66f);})[_0x81bd('0x33')](function(_0xf378d0){_0x2dc0b0(_0xf378d0);});});}exports[_0x81bd('0x34')]=function(_0x2adbb5,_0x3f1572){var _0x5a5912={},_0x49bef3={},_0x520a8b={'count':0x0,'rows':[]};var _0x112ab9=_[_0x81bd('0x35')](db['OpenchannelInteraction'][_0x81bd('0x36')],function(_0x2fed39){return{'name':_0x2fed39[_0x81bd('0x37')],'type':_0x2fed39[_0x81bd('0x38')][_0x81bd('0x39')]};});_0x49bef3[_0x81bd('0x3a')]=_['map'](_0x112ab9,_0x81bd('0x2c'));_0x49bef3[_0x81bd('0x3b')]=_[_0x81bd('0x3c')](_0x2adbb5['query']);_0x49bef3[_0x81bd('0x3d')]=_['intersection'](_0x49bef3['model'],_0x49bef3[_0x81bd('0x3b')]);_0x5a5912['attributes']=_[_0x81bd('0x3e')](_0x49bef3[_0x81bd('0x3a')],qs[_0x81bd('0x3f')](_0x2adbb5[_0x81bd('0x3b')][_0x81bd('0x3f')]));_0x5a5912[_0x81bd('0x40')]=_0x5a5912[_0x81bd('0x40')][_0x81bd('0x41')]?_0x5a5912[_0x81bd('0x40')]:_0x49bef3[_0x81bd('0x3a')];if(!_0x2adbb5[_0x81bd('0x3b')][_0x81bd('0x42')](_0x81bd('0x43'))){_0x5a5912['limit']=qs[_0x81bd('0x23')](_0x2adbb5['query'][_0x81bd('0x23')]);_0x5a5912['offset']=qs[_0x81bd('0x22')](_0x2adbb5['query'][_0x81bd('0x22')]);}_0x5a5912[_0x81bd('0x44')]=qs[_0x81bd('0x45')](_0x2adbb5['query'][_0x81bd('0x45')]);_0x5a5912[_0x81bd('0x46')]=qs[_0x81bd('0x3d')](_[_0x81bd('0x47')](_0x2adbb5['query'],_0x49bef3[_0x81bd('0x3d')]),_0x112ab9);var _0x3901f8=[];var _0x26e5f1=squel[_0x81bd('0x48')]()['field']('id')[_0x81bd('0x49')]('name')['field'](_0x81bd('0x4a'))[_0x81bd('0x4b')](_0x81bd('0x4c'));var _0x378677=squel['select']()['field']('u.id')['field']('u.fullname')[_0x81bd('0x49')](_0x81bd('0x4d'))[_0x81bd('0x4b')](_0x81bd('0x4e'),'ui')['left_join'](_0x81bd('0x4f'),'u',_0x81bd('0x50'));var _0x444692=squel[_0x81bd('0x48')]()[_0x81bd('0x4b')](_0x81bd('0x51'),'i')[_0x81bd('0x52')](_0x81bd('0x53'),'c',_0x81bd('0x54'))[_0x81bd('0x52')](_0x81bd('0x4f'),'o',_0x81bd('0x55'))['left_join'](_0x81bd('0x56'),'a',_0x81bd('0x57'))['left_join']('openchannel_messages','me',_0x81bd('0x58'))[_0x81bd('0x52')](_0x81bd('0x59'),'it',_0x81bd('0x5a'))[_0x81bd('0x52')]('tools_tags','t',_0x81bd('0x5b'));var _0x1b9bda=squel[_0x81bd('0x5c')]();var _0x2aa5da=[];var _0x12b80b=squel[_0x81bd('0x5c')]();var _0x5bcd87;if(_0x2adbb5['query'][_0x81bd('0x5d')]){_0x5bcd87=as['parseSearch'](_0x2adbb5[_0x81bd('0x3b')]['search']);var _0x119723=_0x5bcd87['sqlOperator'];for(var _0x15e8d8=0x0;_0x15e8d8<_0x5bcd87[_0x81bd('0x5e')][_0x81bd('0x41')];_0x15e8d8++){var _0x330f24=_0x5bcd87['conditions'][_0x15e8d8];var _0xdd4fe8='i';var _0x50d4cd=_[_0x81bd('0x5f')](_0x112ab9,[_0x81bd('0x2c'),_0x330f24[_0x81bd('0x49')]]);if(!_0x50d4cd){switch(_0x330f24['field']){case'unreadMessages':if(_0x330f24[_0x81bd('0x60')]==0x1){_0x444692[_0x81bd('0x61')]('`'+_0x330f24[_0x81bd('0x49')]+_0x81bd('0x62'));}else{_0x444692[_0x81bd('0x61')]('`'+_0x330f24[_0x81bd('0x49')]+'`\x20>\x200');}break;case'Contact':if(_0x330f24[_0x81bd('0x63')]===_0x81bd('0x64')){if(_0x330f24[_0x81bd('0x60')][_0x81bd('0x65')]('\x20')['length']>0x1){_0x1b9bda[_0x119723](_0x81bd('0x66'),qs[_0x81bd('0x67')](_0x330f24[_0x81bd('0x60')]),null);}else{var _0x30ee9e='%'+_0x330f24[_0x81bd('0x60')]+'%';_0x1b9bda[_0x119723]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x30ee9e,_0x30ee9e,_0x30ee9e);}}else{_0x50d4cd=_['find'](_0x112ab9,[_0x81bd('0x2c'),'ContactId']);_0x330f24[_0x81bd('0x49')]=_0x81bd('0x68');_0x527bec=as[_0x81bd('0x69')](_0xdd4fe8,_0x50d4cd[_0x81bd('0x38')],_0x330f24);_0x1b9bda[_0x119723](_0x527bec['text'],_0x527bec[_0x81bd('0x60')][_0x81bd('0x6a')],_0x527bec[_0x81bd('0x60')][_0x81bd('0x20')]);}break;case _0x81bd('0x6b'):var _0x519312=_0x330f24['value']['split'](',')[_0x81bd('0x35')](function(_0x2088b4){return Number(_0x2088b4);});_0x519312[_0x81bd('0x31')](function(_0x171a13){_0x12b80b['or'](_0x81bd('0x6c'),'%,'+_0x171a13+',%');});_0x2aa5da=_[_0x81bd('0x6d')](_0x2aa5da,_0x519312);break;case _0x81bd('0x6e'):if(_0x330f24[_0x81bd('0x63')]===_0x81bd('0x64')){_0x1b9bda[_0x119723](_0x81bd('0x6f'),'%'+_0x330f24[_0x81bd('0x60')]+'%',null);}else{_0x50d4cd=_[_0x81bd('0x5f')](_0x112ab9,[_0x81bd('0x2c'),_0x81bd('0x70')]);_0x330f24[_0x81bd('0x49')]=_0x81bd('0x70');_0x527bec=as[_0x81bd('0x69')](_0xdd4fe8,_0x50d4cd[_0x81bd('0x38')],_0x330f24);_0x1b9bda[_0x119723](_0x527bec['text'],_0x527bec[_0x81bd('0x60')][_0x81bd('0x6a')],_0x527bec[_0x81bd('0x60')]['end']);}break;case _0x81bd('0x71'):_0x527bec=as[_0x81bd('0x69')]('me',null,_0x330f24);_0x1b9bda[_0x119723](_0x527bec['text'],_0x527bec[_0x81bd('0x60')][_0x81bd('0x6a')],_0x527bec[_0x81bd('0x60')][_0x81bd('0x20')]);break;}}else{var _0x527bec=as[_0x81bd('0x69')](_0xdd4fe8,_0x50d4cd[_0x81bd('0x38')],_0x330f24);_0x1b9bda[_0x119723](_0x527bec[_0x81bd('0x72')],_0x527bec[_0x81bd('0x60')][_0x81bd('0x6a')],_0x527bec[_0x81bd('0x60')][_0x81bd('0x20')]);}}}else{var _0x2a9f0b=_(_0x2adbb5[_0x81bd('0x3b')])['keys']()[_0x81bd('0x35')](function(_0x35dfcf){return _[_0x81bd('0x73')](_0x112ab9,['name',_0x35dfcf])?_0x35dfcf:undefined;})[_0x81bd('0x74')]()[_0x81bd('0x60')]();if(!_[_0x81bd('0x75')](_0x2a9f0b)){_0x2a9f0b['forEach'](function(_0x4e395d){if(_0x4e395d===_0x81bd('0x76')){_0x444692['where'](_0x81bd('0x77'),[]['concat'](_0x2adbb5['query'][_0x4e395d]));}else if(_0x4e395d===_0x81bd('0x78')){var _0x1e81b8=JSON[_0x81bd('0x79')](_0x2adbb5['query'][_0x4e395d])[_0x81bd('0x7a')];var _0x1697f0=JSON[_0x81bd('0x79')](_0x2adbb5['query'][_0x4e395d])['$lte'];_0x444692[_0x81bd('0x46')](_0x81bd('0x7b'),_0x1e81b8,_0x1697f0);}else{if(_0x2adbb5[_0x81bd('0x3b')][_0x4e395d]==='null'){_0x444692[_0x81bd('0x46')]('i.'+_0x4e395d+_0x81bd('0x7c'));}else{_0x444692[_0x81bd('0x46')]('i.'+_0x4e395d+_0x81bd('0x7d'),_0x2adbb5[_0x81bd('0x3b')][_0x4e395d]);}}});}if(_0x2adbb5[_0x81bd('0x3b')][_0x81bd('0x7e')]){if(_0x2adbb5[_0x81bd('0x3b')][_0x81bd('0x7e')]==0x1){_0x444692[_0x81bd('0x61')]('`unreadMessages`\x20=\x200');}else{_0x444692['having'](_0x81bd('0x7f'));}}if(_0x2adbb5['query'][_0x81bd('0x80')]){_0x2aa5da=_[_0x81bd('0x81')](_0x2adbb5[_0x81bd('0x3b')][_0x81bd('0x80')])?_0x2adbb5[_0x81bd('0x3b')][_0x81bd('0x80')]:new Array(_0x2adbb5[_0x81bd('0x3b')]['tag']);_0x2aa5da[_0x81bd('0x31')](function(_0x44447f){_0x12b80b['or'](_0x81bd('0x6c'),'%,'+_0x44447f+',%');});}if(_0x2adbb5['query'][_0x81bd('0x82')]){var _0x20b3ab=_0x2adbb5['query'][_0x81bd('0x82')]['replace']('\x5c','\x5c\x5c')[_0x81bd('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x20b3ab)){_0x1b9bda['or']('i.id\x20LIKE\x20?',_0x20b3ab+'%');}else{_0x1b9bda['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x81bd('0x67')](_0x20b3ab))['or']('i.from\x20LIKE\x20?',_0x20b3ab+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x20b3ab+'%');}}}_0x444692['where'](_0x1b9bda);_0x444692[_0x81bd('0x84')]('i.id');var _0x51e525={'type':db[_0x81bd('0x85')][_0x81bd('0x86')][_0x81bd('0x87')],'raw':!![]};var _0x39f546=_0x444692['clone']();_0x39f546[_0x81bd('0x49')](_0x81bd('0x88'));_0x39f546[_0x81bd('0x49')](_0x81bd('0x89'),_0x81bd('0x8a'));if(_0x5a5912['order']){_0x5a5912[_0x81bd('0x44')][_0x81bd('0x31')](function(_0x2bde61){var _0x36eef8=_0x2bde61[0x0]==='contactName'?_0x2bde61[0x0]:'i.'+_0x2bde61[0x0];_0x444692[_0x81bd('0x44')](_0x36eef8,_0x2bde61[0x1]===_0x81bd('0x8b')?![]:!![]);});}if(!_[_0x81bd('0x75')](_0x2aa5da)){_0x444692[_0x81bd('0x61')](_0x12b80b);_0x39f546[_0x81bd('0x46')](_0x81bd('0x8c'),_0x2aa5da);}BPromise[_0x81bd('0x8d')]()[_0x81bd('0x2a')](function(){if(!_0x5bcd87){if(_0x2adbb5[_0x81bd('0x3b')][_0x81bd('0x76')])return;_0x39f546[_0x81bd('0x46')](_0x81bd('0x8e'));_0x444692[_0x81bd('0x46')](_0x81bd('0x8e'));return;}if(_0x2adbb5[_0x81bd('0x8f')][_0x81bd('0x90')]!==_0x81bd('0x91'))return;return _0x2adbb5[_0x81bd('0x8f')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x81bd('0x2a')](function(_0x12d970){if(_[_0x81bd('0x75')](_0x12d970)){_0x39f546[_0x81bd('0x46')](_0x81bd('0x92'));_0x444692[_0x81bd('0x46')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x39f546['where'](_0x81bd('0x77'),_[_0x81bd('0x35')](_0x12d970,'id'));_0x444692[_0x81bd('0x46')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x12d970,'id'));}});})[_0x81bd('0x2a')](function(){if(_0x2adbb5['user']['role']==='agent'&&!_0x5bcd87&&!_0x2adbb5[_0x81bd('0x3b')][_0x81bd('0x76')])return[];return db[_0x81bd('0x93')][_0x81bd('0x3b')](_0x39f546[_0x81bd('0x94')](),_0x51e525);})['then'](function(_0x3598cf){_0x520a8b[_0x81bd('0x95')]=_0x3598cf[_0x81bd('0x41')];if(_0x520a8b['count']===0x0)return[];return db[_0x81bd('0x93')][_0x81bd('0x3b')](_0x26e5f1[_0x81bd('0x94')](),_0x51e525)[_0x81bd('0x2a')](function(_0x56a078){_0x3901f8=_[_0x81bd('0x96')](_0x56a078,'id');_0x51e525=_['merge'](_0x51e525,{'model':db[_0x81bd('0x97')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2adbb5['query']['fields']){_0x5a5912[_0x81bd('0x40')][_0x81bd('0x31')](function(_0x1dd2da){_0x444692[_0x81bd('0x49')]('i.'+_0x1dd2da);});}else{_0x444692['field'](_0x81bd('0x89'),_0x81bd('0x8a'));_0x444692[_0x81bd('0x49')](_0x81bd('0x98'),_0x81bd('0x99'));_0x444692['field'](_0x81bd('0x9a'),'Account.mandatoryDisposition');_0x444692[_0x81bd('0x49')](_0x81bd('0x9b'),_0x81bd('0x9c'));_0x444692['field'](_0x81bd('0x9d'));_0x444692[_0x81bd('0x49')](_0x81bd('0x9e'),_0x81bd('0x9f'));_0x444692[_0x81bd('0x49')](_0x81bd('0xa0'),_0x81bd('0xa1'));_0x444692['field']('c.email','Contact.email');_0x444692[_0x81bd('0x49')]('c.phone',_0x81bd('0xa2'));_0x444692['field'](_0x81bd('0xa3'),'Contact.mobile');_0x444692[_0x81bd('0x49')](_0x81bd('0xa4'),_0x81bd('0xa5'));_0x444692['field']('o.fullname',_0x81bd('0xa6'));_0x444692[_0x81bd('0x49')](_0x81bd('0xa7'),_0x81bd('0xa8'));_0x444692['field'](_0x81bd('0xa9'),_0x81bd('0x2f'));}if(_0x5a5912['limit'])_0x444692[_0x81bd('0x23')](_0x5a5912['limit']);if(_0x5a5912[_0x81bd('0x22')])_0x444692[_0x81bd('0x22')](_0x5a5912[_0x81bd('0x22')]);return db[_0x81bd('0x93')][_0x81bd('0x3b')](_0x444692[_0x81bd('0x94')](),_0x51e525);})[_0x81bd('0x2a')](function(_0xa129f1){_0x378677[_0x81bd('0x46')](_0x81bd('0xaa'),_[_0x81bd('0x35')](_0xa129f1,'id'));return db['sequelize'][_0x81bd('0x3b')](_0x378677['toString'](),_0x51e525)[_0x81bd('0x2a')](function(_0x235df3){var _0x8d38c3=_['groupBy'](_0x235df3,_0x81bd('0xab'));var _0x2e850e=[];_0xa129f1[_0x81bd('0x31')](function(_0x1c1546){_0x2e850e['push'](updateOpenchannelInteraction(_0x1c1546,_0x3901f8,_0x8d38c3));});return BPromise[_0x81bd('0xac')](_0x2e850e);});});})[_0x81bd('0x2a')](function(_0xf3e40e){_0x520a8b[_0x81bd('0xad')]=_0xf3e40e;return _0x520a8b;})[_0x81bd('0x2a')](respondWithFilteredResult(_0x3f1572,_0x5a5912))['catch'](handleError(_0x3f1572,null));};exports[_0x81bd('0xae')]=function(_0x10b3ce,_0x4265a9){var _0x2d161f={};if(_0x10b3ce[_0x81bd('0x3b')][_0x81bd('0x38')]&&_0x10b3ce[_0x81bd('0x3b')][_0x81bd('0x38')]===_0x81bd('0x4b')){_0x2d161f[_0x81bd('0x4b')]=_0x10b3ce[_0x81bd('0xaf')]['id'];}else{_0x2d161f['id']=_0x10b3ce['params']['id'];}var _0x2c2fa9={'raw':![],'where':_0x2d161f},_0x126525={};_0x126525[_0x81bd('0x3a')]=_[_0x81bd('0x3c')](db['OpenchannelInteraction'][_0x81bd('0x36')]);_0x126525[_0x81bd('0x3b')]=_[_0x81bd('0x3c')](_0x10b3ce[_0x81bd('0x3b')]);_0x126525[_0x81bd('0x3d')]=_[_0x81bd('0x3e')](_0x126525[_0x81bd('0x3a')],_0x126525['query']);_0x2c2fa9['attributes']=_[_0x81bd('0x3e')](_0x126525[_0x81bd('0x3a')],qs[_0x81bd('0x3f')](_0x10b3ce[_0x81bd('0x3b')][_0x81bd('0x3f')]));_0x2c2fa9[_0x81bd('0x40')]=_0x2c2fa9[_0x81bd('0x40')]['length']?_0x2c2fa9[_0x81bd('0x40')]:_0x126525['model'];if(_0x10b3ce['query']['includeAll']){_0x2c2fa9[_0x81bd('0xb0')]=[{'all':!![]}];}_0x2c2fa9=_[_0x81bd('0xb1')]({},_0x2c2fa9,_0x10b3ce[_0x81bd('0xb2')]);return db[_0x81bd('0x97')][_0x81bd('0x5f')](_0x2c2fa9)[_0x81bd('0x2a')](handleEntityNotFound(_0x4265a9,null))[_0x81bd('0x2a')](respondWithResult(_0x4265a9,null))[_0x81bd('0x33')](handleError(_0x4265a9,null));};exports[_0x81bd('0xb3')]=function(_0x2280f3,_0x457816){return db[_0x81bd('0x97')]['create'](_0x2280f3[_0x81bd('0x71')],{})[_0x81bd('0x2a')](respondWithResult(_0x457816,0xc9))['catch'](handleError(_0x457816,null));};exports[_0x81bd('0x28')]=function(_0x367e49,_0x2fd86e){if(_0x367e49[_0x81bd('0x71')]['id']){delete _0x367e49[_0x81bd('0x71')]['id'];}return db[_0x81bd('0x97')]['find']({'where':{'id':_0x367e49[_0x81bd('0xaf')]['id']}})['then'](handleEntityNotFound(_0x2fd86e,null))['then'](saveUpdates(_0x367e49[_0x81bd('0x71')],null))[_0x81bd('0x2a')](respondWithResult(_0x2fd86e,null))[_0x81bd('0x33')](handleError(_0x2fd86e,null));};exports[_0x81bd('0x29')]=function(_0x39b479,_0x2b48b6){return db[_0x81bd('0x97')][_0x81bd('0x5f')]({'where':{'id':_0x39b479[_0x81bd('0xaf')]['id']}})[_0x81bd('0x2a')](handleEntityNotFound(_0x2b48b6,null))[_0x81bd('0x2a')](removeEntity(_0x2b48b6,null))[_0x81bd('0x33')](handleError(_0x2b48b6,null));};exports['describe']=function(_0x51dc93,_0x34f418){return db['OpenchannelInteraction'][_0x81bd('0xb4')]()['then'](respondWithResult(_0x34f418,null))[_0x81bd('0x33')](handleError(_0x34f418,null));};exports['addMessage']=function(_0x4a03fa,_0x1528a2,_0x4256a0){return db['OpenchannelMessage'][_0x81bd('0x5f')]({'where':{'id':_0x4a03fa[_0x81bd('0xaf')]['id']}})['then'](handleEntityNotFound(_0x1528a2,null))[_0x81bd('0x2a')](function(_0x5daa05){if(_0x5daa05){return _0x5daa05[_0x81bd('0xb5')](_0x4a03fa[_0x81bd('0x71')][_0x81bd('0xb6')],_[_0x81bd('0xb7')](_0x4a03fa['body'],['ids','id'])||{});}})[_0x81bd('0x2a')](respondWithResult(_0x1528a2,null))[_0x81bd('0x33')](handleError(_0x1528a2,null));};exports[_0x81bd('0xb8')]=function(_0x1e745a,_0x298635,_0x518e6a){var _0x48275e={'raw':![],'where':{}};var _0x114267={};var _0x148355={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x81bd('0xb9')]({'where':{'id':_0x1e745a['params']['id']}})['then'](handleEntityNotFound(_0x298635,null))['then'](function(_0x399ec2){if(_0x399ec2){_0x114267[_0x81bd('0x3a')]=_[_0x81bd('0x3c')](db[_0x81bd('0xba')][_0x81bd('0x36')]);_0x114267[_0x81bd('0x3b')]=_['keys'](_0x1e745a[_0x81bd('0x3b')]);_0x114267[_0x81bd('0x3d')]=_[_0x81bd('0x3e')](_0x114267[_0x81bd('0x3a')],_0x114267[_0x81bd('0x3b')]);_0x48275e['attributes']=_[_0x81bd('0x3e')](_0x114267[_0x81bd('0x3a')],qs[_0x81bd('0x3f')](_0x1e745a['query'][_0x81bd('0x3f')]));_0x48275e[_0x81bd('0x40')]=_0x48275e[_0x81bd('0x40')][_0x81bd('0x41')]?_0x48275e[_0x81bd('0x40')]:_0x114267[_0x81bd('0x3a')];if(!_0x1e745a['query']['hasOwnProperty'](_0x81bd('0x43'))){_0x48275e[_0x81bd('0x23')]=qs[_0x81bd('0x23')](_0x1e745a['query'][_0x81bd('0x23')]);_0x48275e[_0x81bd('0x22')]=qs['offset'](_0x1e745a['query']['offset']);}_0x48275e['order']=qs[_0x81bd('0x45')](_0x1e745a['query'][_0x81bd('0x45')]);_0x48275e['where']=qs['filters'](_[_0x81bd('0x47')](_0x1e745a[_0x81bd('0x3b')],_0x114267['filters']));_0x48275e['where'][_0x81bd('0xab')]=_0x399ec2['id'];if(_0x1e745a[_0x81bd('0x3b')]['filter']){_0x48275e[_0x81bd('0x46')]=_[_0x81bd('0xb1')](_0x48275e[_0x81bd('0x46')],{'$or':_[_0x81bd('0x35')](_0x48275e[_0x81bd('0x40')],function(_0x433816){var _0x176e88={};_0x176e88[_0x433816]={'$like':'%'+_0x1e745a[_0x81bd('0x3b')][_0x81bd('0x82')]+'%'};return _0x176e88;})});}if(_0x1e745a['query']['$gte']){var _0x1fc35a=_0x1e745a[_0x81bd('0x3b')]['$gte']['split'](',');var _0x360fe4={};_0x360fe4[_0x1fc35a[0x0]]={'$gte':moment(_0x1fc35a[0x1])[_0x81bd('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x48275e[_0x81bd('0x46')]=_['merge'](_0x48275e[_0x81bd('0x46')],_0x360fe4);}_0x48275e=_[_0x81bd('0xb1')]({},_0x48275e,_0x1e745a[_0x81bd('0xb2')]);return db['OpenchannelMessage'][_0x81bd('0x95')]({'where':_0x48275e[_0x81bd('0x46')]})[_0x81bd('0x2a')](function(_0x3077d2){_0x148355[_0x81bd('0x95')]=_0x3077d2;if(_0x1e745a[_0x81bd('0x3b')][_0x81bd('0xbc')]){_0x48275e[_0x81bd('0xb0')]=[{'all':!![]}];}return db[_0x81bd('0xba')][_0x81bd('0xbd')](_0x48275e);})[_0x81bd('0x2a')](function(_0x4a0829){_0x148355[_0x81bd('0xad')]=_0x4a0829;return _0x148355;});}})[_0x81bd('0x2a')](respondWithFilteredResult(_0x298635,_0x48275e))[_0x81bd('0x33')](handleError(_0x298635,null));};exports['addTags']=function(_0x38f62f,_0x528ab3,_0x182176){return db[_0x81bd('0x97')][_0x81bd('0x5f')]({'where':{'id':_0x38f62f[_0x81bd('0xaf')]['id']}})[_0x81bd('0x2a')](handleEntityNotFound(_0x528ab3,null))[_0x81bd('0x2a')](function(_0x3e8f1c){if(_0x3e8f1c){return _0x3e8f1c[_0x81bd('0xbe')](_0x38f62f['body'][_0x81bd('0xb6')],_[_0x81bd('0xb7')](_0x38f62f[_0x81bd('0x71')],['ids','id'])||{})[_0x81bd('0xbf')](function(){return db[_0x81bd('0x6b')]['findAll']({'attributes':['id','name',_0x81bd('0x4a')],'where':{'id':_0x38f62f[_0x81bd('0x71')]['ids']}});})['then'](function(_0x110b5c){socket[_0x81bd('0xc0')]('openchannelInteractionTags:save',{'id':Number(_0x38f62f[_0x81bd('0xaf')]['id']),'tags':_0x110b5c||[]});return{'id':Number(_0x38f62f[_0x81bd('0xaf')]['id']),'tags':_0x110b5c||[]};});}})[_0x81bd('0x2a')](respondWithResult(_0x528ab3,null))[_0x81bd('0x33')](handleError(_0x528ab3,null));};exports[_0x81bd('0xc1')]=function(_0x115c6a,_0x352f8b,_0x93201e){return db[_0x81bd('0x97')][_0x81bd('0x5f')]({'where':{'id':_0x115c6a[_0x81bd('0xaf')]['id']}})[_0x81bd('0x2a')](handleEntityNotFound(_0x352f8b,null))['then'](function(_0xff4692){if(_0xff4692){return _0xff4692[_0x81bd('0xc1')](_0x115c6a['query'][_0x81bd('0xb6')]);}})[_0x81bd('0x2a')](respondWithStatusCode(_0x352f8b,null))[_0x81bd('0x33')](handleError(_0x352f8b,null));};exports[_0x81bd('0xc2')]=function(_0xf91470,_0x3adb8d){var _0x4482b5=moment()['unix']()[_0x81bd('0x94')]();var _0xc1679a=path['join'](config[_0x81bd('0xc3')],_0x81bd('0xc4'),_0x81bd('0xc5'),_0x81bd('0xc6'));var _0x5539a2=path[_0x81bd('0xc7')](config['root'],'server',_0x81bd('0xc5'),_0x81bd('0xc8'));var _0x3c2fbb=path[_0x81bd('0xc7')](_0xc1679a,_0x4482b5);var _0x1fc5b6=util[_0x81bd('0xbb')](_0x81bd('0xc9'),_0xf91470[_0x81bd('0xaf')]['id'],_0x4482b5);var _0x5c78fa=path['join'](_0xc1679a,_0x1fc5b6);var _0x3e79b1=[];_0x3e79b1[_0x81bd('0x32')]({'model':db[_0x81bd('0x6e')],'as':_0x81bd('0x6e'),'attributes':['id',_0x81bd('0x2e')],'raw':!![]});_0x3e79b1[_0x81bd('0x32')]({'model':db['CmContact'],'as':_0x81bd('0xca'),'attributes':['id',_0x81bd('0xcb'),_0x81bd('0xcc')],'raw':!![]});if(_0xf91470[_0x81bd('0x3b')][_0x81bd('0xc8')]){_0x3e79b1['push']({'model':db['Attachment'],'as':_0x81bd('0xcd'),'raw':!![]});}var _0x52596b=[{'model':db['OpenchannelMessage'],'as':_0x81bd('0xce'),'attributes':['id',_0x81bd('0x71'),_0x81bd('0x78'),'direction',_0x81bd('0xcf'),_0x81bd('0x7e')],'include':_0x3e79b1}];_0x52596b[_0x81bd('0x32')]({'model':db['OpenchannelAccount'],'as':_0x81bd('0xd0'),'attributes':['id',_0x81bd('0x2c')]});_0x52596b['push']({'model':db[_0x81bd('0x6e')],'as':_0x81bd('0xd1'),'attributes':['id',_0x81bd('0x2e')]});return db['OpenchannelInteraction'][_0x81bd('0x5f')]({'where':{'id':_0xf91470[_0x81bd('0xaf')]['id']},'include':_0x52596b})[_0x81bd('0x2a')](handleEntityNotFound(_0x3adb8d,null))[_0x81bd('0x2a')](function(_0x1f348f){if(_0x1f348f){var _0x240d22=_0x1f348f[_0x81bd('0xd2')]({'plain':!![]});fs[_0x81bd('0xd3')](_0x3c2fbb);var _0x45c0be={'format':'A4','border':_0x81bd('0xd4'),'header':{'height':_0x81bd('0xd5'),'contents':{'first':_0x81bd('0xd6')}},'footer':{'height':_0x81bd('0xd7'),'contents':{'default':util[_0x81bd('0xbb')](_0x81bd('0xd8'),util[_0x81bd('0xbb')](_0x81bd('0xd9'),_0x81bd('0xda'),_0x240d22['id']),moment()[_0x81bd('0xbb')](_0x81bd('0xdb'))[_0x81bd('0x94')]())}}};var _0xaa1d0={'channel':'Openchannel','account':_0x240d22['Account'][_0x81bd('0x2c')],'agent':_0x240d22['Owner']?_0x240d22[_0x81bd('0xd1')]['fullname']:_0x81bd('0xdc'),'createdAt':moment(_0x240d22['createdAt'])[_0x81bd('0xbb')](_0x81bd('0xdd'))[_0x81bd('0x94')](),'closedAt':_0x240d22[_0x81bd('0xde')]?moment(_0x240d22[_0x81bd('0xdf')])[_0x81bd('0xbb')](_0x81bd('0xdd'))[_0x81bd('0x94')]():'','disposition':_0x240d22[_0x81bd('0xe0')],'visibility':_0x240d22[_0x81bd('0xe1')]?_0x81bd('0xe2'):_0x81bd('0xe3'),'messages':_(_0x240d22[_0x81bd('0xce')])[_0x81bd('0x82')]({'secret':![]})[_0x81bd('0x35')](function(_0x346672){if(_0x346672[_0x81bd('0xcd')]){var _0x35cc59=path[_0x81bd('0xc7')](_0x5539a2,_0x346672[_0x81bd('0xcd')][_0x81bd('0xe4')]);if(fs[_0x81bd('0xe5')](_0x35cc59)){fs['createReadStream'](_0x35cc59)[_0x81bd('0xe6')](fs[_0x81bd('0xe7')](path[_0x81bd('0xc7')](_0x3c2fbb,_0x346672['Attachment'][_0x81bd('0xe4')])));}}return{'date':moment(_0x346672[_0x81bd('0x78')])[_0x81bd('0xbb')](_0x81bd('0xdd'))[_0x81bd('0x94')](),'sender':_0x346672['direction']==='out'?_0x346672['User']?_0x346672[_0x81bd('0x6e')]['fullname']:'System':_0x346672[_0x81bd('0xca')][_0x81bd('0xcb')]+(_0x346672[_0x81bd('0xca')][_0x81bd('0xcc')]?'\x20'+_0x346672[_0x81bd('0xca')][_0x81bd('0xcc')]:''),'body':_0x346672[_0x81bd('0xcd')]?_0x346672[_0x81bd('0xcd')][_0x81bd('0xe4')]:_0x346672['body'],'direction':_0x346672[_0x81bd('0xe8')]===_0x81bd('0xe9')?'A':'C','secret':_0x346672['secret'],'read':_0x346672[_0x81bd('0x7e')],'attachment':_0x346672['Attachment']};})[_0x81bd('0x60')]()};return ejs[_0x81bd('0xea')](path['join'](config['root'],'server',_0x81bd('0xeb'),_0x81bd('0xec')),{'interaction':_0xaa1d0})[_0x81bd('0x2a')](function(_0xc5e9ea){return new BPromise(function(_0x2073ab,_0x5691fa){pdf[_0x81bd('0xb3')](_0xc5e9ea,_0x45c0be)['toFile'](path['join'](_0x3c2fbb,_0x81bd('0xed')+_0x240d22['id']+'-'+_0x4482b5+_0x81bd('0xee')),function(_0x5c5774,_0x19458f){if(_0x5c5774)return _0x5691fa(_0x5c5774);_0x2073ab(_0x19458f);});});})[_0x81bd('0x2a')](function(){return new BPromise(function(_0x2b7191,_0x2afd6c){zipdir(_0x3c2fbb,{'saveTo':_0x5c78fa},function(_0x2f5bca,_0x5ce007){if(_0x2f5bca)return _0x2afd6c(_0x2f5bca);return _0x2b7191(_0x5ce007);});})[_0x81bd('0x2a')](function(){return new BPromise(function(_0x90c029,_0x10390e){rimraf(_0x3c2fbb,function(_0xef5092){if(_0xef5092)_0x10390e(_0xef5092);return _0x90c029();});});})[_0x81bd('0x2a')](function(){return _0x3adb8d['download'](_0x5c78fa,_0x1fc5b6,function(_0x255def){if(_0x255def){console[_0x81bd('0xef')](_0x81bd('0xf0'),_0x255def);}else{fs[_0x81bd('0xf1')](_0x5c78fa);}});});});}else{return _0x3adb8d['sendStatus'](0xc8);}})[_0x81bd('0x33')](handleError(_0x3adb8d,null));}; \ No newline at end of file +var _0xc85c=['createdAt','parse','$gte','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','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','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','i.OpenchannelAccountId\x20IS\x20NULL','role','toString','sequelize','merge','a.key','Account.key','a.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','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','rows','show','params','includeAll','include','options','create','destroy','describe','addMessage','OpenchannelMessage','ids','omit','findOne','filters','format','YYYY-MM-DD\x20HH:mm:ss','findAll','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','files','tmp','join','attachments','transcript-%d-%s.zip','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','get','mkdirSync','10px','40px','30px','%s\x20#%d','YYYY-MM-DD','Owner','closed','disposition','threadId','Public','Private','existsSync','pipe','createWriteStream','basename','direction','root','server','views','downloadInteraction.html','toFile','transcript-','.pdf','err','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','redis','defaults','localhost','./openchannelInteraction.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','Contact','operator','getFullTextValue','find','buildExpression','text','start','Tag','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?'];(function(_0x578f34,_0x55bf23){var _0x417264=function(_0x1014f0){while(--_0x1014f0){_0x578f34['push'](_0x578f34['shift']());}};_0x417264(++_0x55bf23);}(_0xc85c,0x75));var _0xcc85=function(_0x59f5a6,_0x22e5fe){_0x59f5a6=_0x59f5a6-0x0;var _0x824ffa=_0xc85c[_0x59f5a6];return _0x824ffa;};'use strict';var pdf=require(_0xcc85('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcc85('0x1'));var jsonpatch=require(_0xcc85('0x2'));var rp=require(_0xcc85('0x3'));var moment=require('moment');var BPromise=require(_0xcc85('0x4'));var Mustache=require(_0xcc85('0x5'));var util=require(_0xcc85('0x6'));var path=require(_0xcc85('0x7'));var sox=require(_0xcc85('0x8'));var csv=require(_0xcc85('0x9'));var ejs=require(_0xcc85('0xa'));var fs=require('fs');var _=require(_0xcc85('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcc85('0x9'));var querystring=require(_0xcc85('0xc'));var Papa=require(_0xcc85('0xd'));var Redis=require(_0xcc85('0xe'));var authService=require(_0xcc85('0xf'));var qs=require(_0xcc85('0x10'));var as=require(_0xcc85('0x11'));var hardwareService=require(_0xcc85('0x12'));var logger=require(_0xcc85('0x13'))(_0xcc85('0x14'));var utils=require(_0xcc85('0x15'));var config=require(_0xcc85('0x16'));var licenseUtil=require(_0xcc85('0x17'));var db=require('../../mysqldb')['db'];config[_0xcc85('0x18')]=_[_0xcc85('0x19')](config[_0xcc85('0x18')],{'host':_0xcc85('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc85('0x18')]));require(_0xcc85('0x1b'))['register'](socket);function respondWithStatusCode(_0x329591,_0x47e4fe){_0x47e4fe=_0x47e4fe||0xcc;return function(_0x13178b){if(_0x13178b){return _0x329591[_0xcc85('0x1c')](_0x47e4fe);}return _0x329591[_0xcc85('0x1d')](_0x47e4fe)[_0xcc85('0x1e')]();};}function respondWithResult(_0x4e9f2d,_0x3705e6){_0x3705e6=_0x3705e6||0xc8;return function(_0x3636f0){if(_0x3636f0){return _0x4e9f2d[_0xcc85('0x1d')](_0x3705e6)[_0xcc85('0x1f')](_0x3636f0);}};}function respondWithFilteredResult(_0x81a7ef,_0x32c749){return function(_0x3576b7){if(_0x3576b7){var _0x48598e=_0x3576b7[_0xcc85('0x20')],_0x5cd841=_0x32c749[_0xcc85('0x21')],_0x35904a=_0x32c749['offset']+_0x32c749[_0xcc85('0x22')],_0x3a2cb6;if(_0x35904a>=_0x48598e){_0x35904a=_0x48598e;_0x3a2cb6=0xc8;}else{_0x3a2cb6=0xce;}_0x81a7ef[_0xcc85('0x1d')](_0x3a2cb6);return _0x81a7ef[_0xcc85('0x23')](_0xcc85('0x24'),_0x5cd841+'-'+_0x35904a+'/'+_0x48598e)[_0xcc85('0x1f')](_0x3576b7);}return null;};}function patchUpdates(_0x310484){return function(_0x4bebf7){try{jsonpatch[_0xcc85('0x25')](_0x4bebf7,_0x310484,!![]);}catch(_0x4738b0){return BPromise[_0xcc85('0x26')](_0x4738b0);}return _0x4bebf7[_0xcc85('0x27')]();};}function saveUpdates(_0x57ed99,_0x563986){return function(_0x416918){if(_0x416918){return _0x416918[_0xcc85('0x28')](_0x57ed99)[_0xcc85('0x29')](function(_0x3be392){return _0x3be392;});}return null;};}function removeEntity(_0x5885ba,_0x230b88){return function(_0x5345c2){if(_0x5345c2){return _0x5345c2['destroy']()[_0xcc85('0x29')](function(){_0x5885ba[_0xcc85('0x1d')](0xcc)[_0xcc85('0x1e')]();});}};}function handleEntityNotFound(_0x3b2147,_0x22637b){return function(_0x4ec44d){if(!_0x4ec44d){_0x3b2147['sendStatus'](0x194);}return _0x4ec44d;};}function handleError(_0x2d7791,_0x385781){_0x385781=_0x385781||0x1f4;return function(_0x15ffec){logger[_0xcc85('0x2a')](_0x15ffec[_0xcc85('0x2b')]);if(_0x15ffec[_0xcc85('0x2c')]){delete _0x15ffec['name'];}_0x2d7791[_0xcc85('0x1d')](_0x385781)[_0xcc85('0x2d')](_0x15ffec);};}function getInteractionUsers(_0xbf31a6,_0x41b4d6){return new BPromise(function(_0x336835,_0x2661a3){try{if(_0x41b4d6[_0xbf31a6['id']]){_0xbf31a6['Users']=_[_0xcc85('0x2e')](_0x41b4d6[_0xbf31a6['id']],function(_0xc88c28){return{'id':_0xc88c28['id'],'fullname':_0xc88c28[_0xcc85('0x2f')]};});}}catch(_0x26013e){_0x2661a3(_0x26013e);}_0x336835(_0xbf31a6);});}function getInteractionTags(_0x457118,_0x124d4a){return new BPromise(function(_0x24c41c,_0x317921){try{if(_0x457118[_0xcc85('0x30')]){_0x457118[_0xcc85('0x31')]=[];_0x457118[_0xcc85('0x30')][_0xcc85('0x32')](',')[_0xcc85('0x33')](function(_0x4aa3c4){_0x457118[_0xcc85('0x31')][_0xcc85('0x34')](_0x124d4a[_0x4aa3c4]);});}delete _0x457118[_0xcc85('0x30')];}catch(_0x294c21){_0x317921(_0x294c21);}_0x24c41c(_0x457118);});}function updateOpenchannelInteraction(_0x39cd7f,_0x6e73a3,_0x2c4664){return new BPromise(function(_0x43b71f,_0x428e0a){return getInteractionUsers(_0x39cd7f,_0x2c4664)['then'](function(_0x5329c2){return getInteractionTags(_0x5329c2,_0x6e73a3);})[_0xcc85('0x29')](function(_0x531158){_0x43b71f(_0x531158);})[_0xcc85('0x35')](function(_0x515975){_0x428e0a(_0x515975);});});}exports[_0xcc85('0x36')]=function(_0x162966,_0x4dc04a){var _0x57fe12={},_0xbcf921={},_0xe57a0={'count':0x0,'rows':[]};var _0x1ba465=_[_0xcc85('0x2e')](db[_0xcc85('0x37')][_0xcc85('0x38')],function(_0x16a42c){return{'name':_0x16a42c[_0xcc85('0x39')],'type':_0x16a42c[_0xcc85('0x3a')][_0xcc85('0x3b')]};});_0xbcf921[_0xcc85('0x3c')]=_['map'](_0x1ba465,_0xcc85('0x2c'));_0xbcf921[_0xcc85('0x3d')]=_[_0xcc85('0x3e')](_0x162966[_0xcc85('0x3d')]);_0xbcf921['filters']=_['intersection'](_0xbcf921[_0xcc85('0x3c')],_0xbcf921[_0xcc85('0x3d')]);_0x57fe12[_0xcc85('0x3f')]=_[_0xcc85('0x40')](_0xbcf921[_0xcc85('0x3c')],qs[_0xcc85('0x41')](_0x162966['query']['fields']));_0x57fe12[_0xcc85('0x3f')]=_0x57fe12['attributes'][_0xcc85('0x42')]?_0x57fe12[_0xcc85('0x3f')]:_0xbcf921[_0xcc85('0x3c')];if(!_0x162966[_0xcc85('0x3d')][_0xcc85('0x43')](_0xcc85('0x44'))){_0x57fe12['limit']=qs['limit'](_0x162966[_0xcc85('0x3d')][_0xcc85('0x22')]);_0x57fe12[_0xcc85('0x21')]=qs['offset'](_0x162966['query'][_0xcc85('0x21')]);}_0x57fe12[_0xcc85('0x45')]=qs[_0xcc85('0x46')](_0x162966['query'][_0xcc85('0x46')]);_0x57fe12['where']=qs['filters'](_[_0xcc85('0x47')](_0x162966['query'],_0xbcf921['filters']),_0x1ba465);var _0x4ff083=[];var _0x5eb46c=squel[_0xcc85('0x48')]()[_0xcc85('0x49')]('id')[_0xcc85('0x49')](_0xcc85('0x2c'))[_0xcc85('0x49')]('color')[_0xcc85('0x4a')](_0xcc85('0x4b'));var _0x273d1f=squel[_0xcc85('0x48')]()[_0xcc85('0x49')](_0xcc85('0x4c'))['field'](_0xcc85('0x4d'))[_0xcc85('0x49')]('ui.OpenchannelInteractionId')[_0xcc85('0x4a')](_0xcc85('0x4e'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x47b151=squel['select']()[_0xcc85('0x4a')](_0xcc85('0x4f'),'i')['left_join'](_0xcc85('0x50'),'c',_0xcc85('0x51'))[_0xcc85('0x52')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xcc85('0x53'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xcc85('0x52')](_0xcc85('0x54'),'me',_0xcc85('0x55'))['left_join']('openchannel_interaction_has_tags','it',_0xcc85('0x56'))[_0xcc85('0x52')](_0xcc85('0x4b'),'t',_0xcc85('0x57'));var _0x444170=squel[_0xcc85('0x58')]();var _0x2eed9a=[];var _0x1db56e=squel[_0xcc85('0x58')]();var _0x3b6c09;if(_0x162966[_0xcc85('0x3d')][_0xcc85('0x59')]){_0x3b6c09=as[_0xcc85('0x5a')](_0x162966[_0xcc85('0x3d')][_0xcc85('0x59')]);var _0x52e210=_0x3b6c09[_0xcc85('0x5b')];for(var _0x3608c2=0x0;_0x3608c2<_0x3b6c09[_0xcc85('0x5c')][_0xcc85('0x42')];_0x3608c2++){var _0x3c3226=_0x3b6c09[_0xcc85('0x5c')][_0x3608c2];var _0x262225='i';var _0x21e2b1=_['find'](_0x1ba465,['name',_0x3c3226[_0xcc85('0x49')]]);if(!_0x21e2b1){switch(_0x3c3226[_0xcc85('0x49')]){case _0xcc85('0x5d'):if(_0x3c3226[_0xcc85('0x5e')]==0x1){_0x47b151[_0xcc85('0x5f')]('`'+_0x3c3226[_0xcc85('0x49')]+_0xcc85('0x60'));}else{_0x47b151['having']('`'+_0x3c3226['field']+'`\x20>\x200');}break;case _0xcc85('0x61'):if(_0x3c3226[_0xcc85('0x62')]==='$substring'){if(_0x3c3226[_0xcc85('0x5e')]['split']('\x20')['length']>0x1){_0x444170[_0x52e210]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcc85('0x63')](_0x3c3226[_0xcc85('0x5e')]),null);}else{var _0x531f14='%'+_0x3c3226[_0xcc85('0x5e')]+'%';_0x444170[_0x52e210]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x531f14,_0x531f14,_0x531f14);}}else{_0x21e2b1=_[_0xcc85('0x64')](_0x1ba465,[_0xcc85('0x2c'),'ContactId']);_0x3c3226[_0xcc85('0x49')]='ContactId';_0x4b1bda=as[_0xcc85('0x65')](_0x262225,_0x21e2b1[_0xcc85('0x3a')],_0x3c3226);_0x444170[_0x52e210](_0x4b1bda[_0xcc85('0x66')],_0x4b1bda[_0xcc85('0x5e')][_0xcc85('0x67')],_0x4b1bda['value'][_0xcc85('0x1e')]);}break;case _0xcc85('0x68'):var _0xb2cc24=_0x3c3226['value']['split'](',')['map'](function(_0x1a2931){return Number(_0x1a2931);});_0xb2cc24[_0xcc85('0x33')](function(_0x52bcea){_0x1db56e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x52bcea+',%');});_0x2eed9a=_[_0xcc85('0x69')](_0x2eed9a,_0xb2cc24);break;case _0xcc85('0x6a'):if(_0x3c3226[_0xcc85('0x62')]===_0xcc85('0x6b')){_0x444170[_0x52e210](_0xcc85('0x6c'),'%'+_0x3c3226[_0xcc85('0x5e')]+'%',null);}else{_0x21e2b1=_['find'](_0x1ba465,[_0xcc85('0x2c'),'UserId']);_0x3c3226[_0xcc85('0x49')]=_0xcc85('0x6d');_0x4b1bda=as[_0xcc85('0x65')](_0x262225,_0x21e2b1[_0xcc85('0x3a')],_0x3c3226);_0x444170[_0x52e210](_0x4b1bda[_0xcc85('0x66')],_0x4b1bda[_0xcc85('0x5e')]['start'],_0x4b1bda[_0xcc85('0x5e')][_0xcc85('0x1e')]);}break;case _0xcc85('0x6e'):_0x4b1bda=as[_0xcc85('0x65')]('me',null,_0x3c3226);_0x444170[_0x52e210](_0x4b1bda[_0xcc85('0x66')],_0x4b1bda[_0xcc85('0x5e')][_0xcc85('0x67')],_0x4b1bda['value'][_0xcc85('0x1e')]);break;}}else{var _0x4b1bda=as[_0xcc85('0x65')](_0x262225,_0x21e2b1[_0xcc85('0x3a')],_0x3c3226);_0x444170[_0x52e210](_0x4b1bda[_0xcc85('0x66')],_0x4b1bda[_0xcc85('0x5e')]['start'],_0x4b1bda[_0xcc85('0x5e')][_0xcc85('0x1e')]);}}}else{var _0x5bb610=_(_0x162966[_0xcc85('0x3d')])[_0xcc85('0x3e')]()['map'](function(_0x437bb4){return _[_0xcc85('0x6f')](_0x1ba465,[_0xcc85('0x2c'),_0x437bb4])?_0x437bb4:undefined;})['compact']()[_0xcc85('0x5e')]();if(!_[_0xcc85('0x70')](_0x5bb610)){_0x5bb610[_0xcc85('0x33')](function(_0x2afc80){if(_0x2afc80===_0xcc85('0x71')){_0x47b151[_0xcc85('0x72')](_0xcc85('0x73'),[]['concat'](_0x162966[_0xcc85('0x3d')][_0x2afc80]));}else if(_0x2afc80===_0xcc85('0x74')){var _0x1355e0=JSON[_0xcc85('0x75')](_0x162966[_0xcc85('0x3d')][_0x2afc80])[_0xcc85('0x76')];var _0x261bc9=JSON[_0xcc85('0x75')](_0x162966[_0xcc85('0x3d')][_0x2afc80])[_0xcc85('0x77')];_0x47b151['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1355e0,_0x261bc9);}else{if(_0x162966[_0xcc85('0x3d')][_0x2afc80]===_0xcc85('0x78')){_0x47b151['where']('i.'+_0x2afc80+'\x20IS\x20NULL');}else{_0x47b151['where']('i.'+_0x2afc80+_0xcc85('0x79'),_0x162966[_0xcc85('0x3d')][_0x2afc80]);}}});}if(_0x162966[_0xcc85('0x3d')][_0xcc85('0x7a')]){if(_0x162966['query'][_0xcc85('0x7a')]==0x1){_0x47b151[_0xcc85('0x5f')](_0xcc85('0x7b'));}else{_0x47b151[_0xcc85('0x5f')](_0xcc85('0x7c'));}}if(_0x162966[_0xcc85('0x3d')]['tag']){_0x2eed9a=_[_0xcc85('0x7d')](_0x162966['query'][_0xcc85('0x7e')])?_0x162966[_0xcc85('0x3d')][_0xcc85('0x7e')]:new Array(_0x162966[_0xcc85('0x3d')][_0xcc85('0x7e')]);_0x2eed9a[_0xcc85('0x33')](function(_0x427281){_0x1db56e['or'](_0xcc85('0x7f'),'%,'+_0x427281+',%');});}if(_0x162966['query'][_0xcc85('0x80')]){var _0xe8cd89=_0x162966[_0xcc85('0x3d')][_0xcc85('0x80')]['replace']('\x5c','\x5c\x5c')[_0xcc85('0x81')](/'/g,'\x27\x27');if(qs[_0xcc85('0x82')](_0xe8cd89)){_0x444170['or'](_0xcc85('0x83'),_0xe8cd89+'%');}else{_0x444170['or'](_0xcc85('0x84'),qs[_0xcc85('0x63')](_0xe8cd89))['or'](_0xcc85('0x85'),_0xe8cd89+'%')['or'](_0xcc85('0x86'),_0xe8cd89+'%');}}}_0x47b151[_0xcc85('0x72')](_0x444170);_0x47b151[_0xcc85('0x87')](_0xcc85('0x88'));var _0x1096cf={'type':db[_0xcc85('0x89')][_0xcc85('0x8a')][_0xcc85('0x8b')],'raw':!![]};var _0x154309=_0x47b151[_0xcc85('0x8c')]();_0x154309[_0xcc85('0x49')](_0xcc85('0x88'));_0x154309[_0xcc85('0x49')](_0xcc85('0x8d'),'unreadMessages');if(_0x57fe12['order']){_0x57fe12['order']['forEach'](function(_0x4d3ad9){var _0x53e5ac=_0x4d3ad9[0x0]===_0xcc85('0x8e')?_0x4d3ad9[0x0]:'i.'+_0x4d3ad9[0x0];_0x47b151['order'](_0x53e5ac,_0x4d3ad9[0x1]===_0xcc85('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x2eed9a)){_0x47b151[_0xcc85('0x5f')](_0x1db56e);_0x154309[_0xcc85('0x72')](_0xcc85('0x90'),_0x2eed9a);}BPromise['resolve']()[_0xcc85('0x29')](function(){if(!_0x3b6c09){if(_0x162966[_0xcc85('0x3d')]['OpenchannelAccountId'])return;_0x154309[_0xcc85('0x72')](_0xcc85('0x91'));_0x47b151[_0xcc85('0x72')](_0xcc85('0x91'));return;}if(_0x162966[_0xcc85('0x92')]['role']!==_0xcc85('0x93'))return;return _0x162966['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xcc85('0x29')](function(_0x8e2923){if(_['isEmpty'](_0x8e2923)){_0x154309[_0xcc85('0x72')](_0xcc85('0x94'));_0x47b151['where'](_0xcc85('0x94'));}else{_0x154309[_0xcc85('0x72')](_0xcc85('0x73'),_[_0xcc85('0x2e')](_0x8e2923,'id'));_0x47b151[_0xcc85('0x72')](_0xcc85('0x73'),_[_0xcc85('0x2e')](_0x8e2923,'id'));}});})[_0xcc85('0x29')](function(){if(_0x162966[_0xcc85('0x92')][_0xcc85('0x95')]===_0xcc85('0x93')&&!_0x3b6c09&&!_0x162966[_0xcc85('0x3d')][_0xcc85('0x71')])return[];return db['sequelize'][_0xcc85('0x3d')](_0x154309[_0xcc85('0x96')](),_0x1096cf);})[_0xcc85('0x29')](function(_0x396677){_0xe57a0[_0xcc85('0x20')]=_0x396677[_0xcc85('0x42')];if(_0xe57a0[_0xcc85('0x20')]===0x0)return[];return db[_0xcc85('0x97')][_0xcc85('0x3d')](_0x5eb46c['toString'](),_0x1096cf)[_0xcc85('0x29')](function(_0x14b9ef){_0x4ff083=_['keyBy'](_0x14b9ef,'id');_0x1096cf=_[_0xcc85('0x98')](_0x1096cf,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x162966[_0xcc85('0x3d')]['fields']){_0x57fe12[_0xcc85('0x3f')][_0xcc85('0x33')](function(_0x2363f3){_0x47b151['field']('i.'+_0x2363f3);});}else{_0x47b151[_0xcc85('0x49')](_0xcc85('0x8d'),_0xcc85('0x5d'));_0x47b151[_0xcc85('0x49')](_0xcc85('0x99'),_0xcc85('0x9a'));_0x47b151['field'](_0xcc85('0x9b'),'Account.mandatoryDisposition');_0x47b151[_0xcc85('0x49')](_0xcc85('0x9c'),_0xcc85('0x8e'));_0x47b151[_0xcc85('0x49')](_0xcc85('0x9d'));_0x47b151['field'](_0xcc85('0x9e'),'Contact.firstName');_0x47b151[_0xcc85('0x49')](_0xcc85('0x9f'),_0xcc85('0xa0'));_0x47b151[_0xcc85('0x49')](_0xcc85('0xa1'),_0xcc85('0xa2'));_0x47b151[_0xcc85('0x49')](_0xcc85('0xa3'),'Contact.phone');_0x47b151[_0xcc85('0x49')](_0xcc85('0xa4'),_0xcc85('0xa5'));_0x47b151[_0xcc85('0x49')](_0xcc85('0xa6'),_0xcc85('0xa7'));_0x47b151[_0xcc85('0x49')]('o.fullname','Owner.fullname');_0x47b151[_0xcc85('0x49')]('o.internal',_0xcc85('0xa8'));_0x47b151['field'](_0xcc85('0xa9'),_0xcc85('0x30'));}if(_0x57fe12[_0xcc85('0x22')])_0x47b151[_0xcc85('0x22')](_0x57fe12['limit']);if(_0x57fe12['offset'])_0x47b151[_0xcc85('0x21')](_0x57fe12[_0xcc85('0x21')]);return db[_0xcc85('0x97')][_0xcc85('0x3d')](_0x47b151[_0xcc85('0x96')](),_0x1096cf);})['then'](function(_0x75bba2){_0x273d1f[_0xcc85('0x72')](_0xcc85('0xaa'),_[_0xcc85('0x2e')](_0x75bba2,'id'));return db[_0xcc85('0x97')][_0xcc85('0x3d')](_0x273d1f[_0xcc85('0x96')](),_0x1096cf)[_0xcc85('0x29')](function(_0x5178bc){var _0x12e165=_[_0xcc85('0xab')](_0x5178bc,'OpenchannelInteractionId');var _0x113a3e=[];_0x75bba2[_0xcc85('0x33')](function(_0x3c0163){_0x113a3e[_0xcc85('0x34')](updateOpenchannelInteraction(_0x3c0163,_0x4ff083,_0x12e165));});return BPromise['all'](_0x113a3e);});});})[_0xcc85('0x29')](function(_0x2da2ec){_0xe57a0[_0xcc85('0xac')]=_0x2da2ec;return _0xe57a0;})[_0xcc85('0x29')](respondWithFilteredResult(_0x4dc04a,_0x57fe12))['catch'](handleError(_0x4dc04a,null));};exports[_0xcc85('0xad')]=function(_0x5634ef,_0x2d795c){var _0x47809b={};if(_0x5634ef['query']['type']&&_0x5634ef[_0xcc85('0x3d')][_0xcc85('0x3a')]==='from'){_0x47809b[_0xcc85('0x4a')]=_0x5634ef['params']['id'];}else{_0x47809b['id']=_0x5634ef[_0xcc85('0xae')]['id'];}var _0x38f9b1={'raw':![],'where':_0x47809b},_0x5e110a={};_0x5e110a[_0xcc85('0x3c')]=_[_0xcc85('0x3e')](db['OpenchannelInteraction'][_0xcc85('0x38')]);_0x5e110a[_0xcc85('0x3d')]=_['keys'](_0x5634ef[_0xcc85('0x3d')]);_0x5e110a['filters']=_[_0xcc85('0x40')](_0x5e110a[_0xcc85('0x3c')],_0x5e110a['query']);_0x38f9b1[_0xcc85('0x3f')]=_[_0xcc85('0x40')](_0x5e110a[_0xcc85('0x3c')],qs[_0xcc85('0x41')](_0x5634ef[_0xcc85('0x3d')]['fields']));_0x38f9b1['attributes']=_0x38f9b1[_0xcc85('0x3f')][_0xcc85('0x42')]?_0x38f9b1[_0xcc85('0x3f')]:_0x5e110a[_0xcc85('0x3c')];if(_0x5634ef[_0xcc85('0x3d')][_0xcc85('0xaf')]){_0x38f9b1[_0xcc85('0xb0')]=[{'all':!![]}];}_0x38f9b1=_[_0xcc85('0x98')]({},_0x38f9b1,_0x5634ef[_0xcc85('0xb1')]);return db[_0xcc85('0x37')][_0xcc85('0x64')](_0x38f9b1)['then'](handleEntityNotFound(_0x2d795c,null))[_0xcc85('0x29')](respondWithResult(_0x2d795c,null))[_0xcc85('0x35')](handleError(_0x2d795c,null));};exports[_0xcc85('0xb2')]=function(_0x32a664,_0x22a162){return db[_0xcc85('0x37')][_0xcc85('0xb2')](_0x32a664[_0xcc85('0x6e')],{})[_0xcc85('0x29')](respondWithResult(_0x22a162,0xc9))[_0xcc85('0x35')](handleError(_0x22a162,null));};exports[_0xcc85('0x28')]=function(_0x28fb1a,_0x2047ee){if(_0x28fb1a[_0xcc85('0x6e')]['id']){delete _0x28fb1a[_0xcc85('0x6e')]['id'];}return db[_0xcc85('0x37')]['find']({'where':{'id':_0x28fb1a[_0xcc85('0xae')]['id']}})['then'](handleEntityNotFound(_0x2047ee,null))['then'](saveUpdates(_0x28fb1a[_0xcc85('0x6e')],null))[_0xcc85('0x29')](respondWithResult(_0x2047ee,null))['catch'](handleError(_0x2047ee,null));};exports[_0xcc85('0xb3')]=function(_0x382b5a,_0x668b3){return db[_0xcc85('0x37')]['find']({'where':{'id':_0x382b5a[_0xcc85('0xae')]['id']}})[_0xcc85('0x29')](handleEntityNotFound(_0x668b3,null))[_0xcc85('0x29')](removeEntity(_0x668b3,null))[_0xcc85('0x35')](handleError(_0x668b3,null));};exports['describe']=function(_0x299a96,_0x4a2307){return db['OpenchannelInteraction'][_0xcc85('0xb4')]()[_0xcc85('0x29')](respondWithResult(_0x4a2307,null))[_0xcc85('0x35')](handleError(_0x4a2307,null));};exports[_0xcc85('0xb5')]=function(_0x4bd0db,_0x5a00ad,_0x5ecff3){return db[_0xcc85('0xb6')][_0xcc85('0x64')]({'where':{'id':_0x4bd0db['params']['id']}})[_0xcc85('0x29')](handleEntityNotFound(_0x5a00ad,null))['then'](function(_0x4c2334){if(_0x4c2334){return _0x4c2334['addMessage'](_0x4bd0db[_0xcc85('0x6e')][_0xcc85('0xb7')],_[_0xcc85('0xb8')](_0x4bd0db['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x5a00ad,null))[_0xcc85('0x35')](handleError(_0x5a00ad,null));};exports['getMessages']=function(_0x169ae4,_0x42a5b3,_0x13b1b5){var _0xed9402={'raw':![],'where':{}};var _0x4110c3={};var _0x32b349={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xcc85('0xb9')]({'where':{'id':_0x169ae4[_0xcc85('0xae')]['id']}})[_0xcc85('0x29')](handleEntityNotFound(_0x42a5b3,null))['then'](function(_0x3b0cd8){if(_0x3b0cd8){_0x4110c3['model']=_[_0xcc85('0x3e')](db[_0xcc85('0xb6')]['rawAttributes']);_0x4110c3[_0xcc85('0x3d')]=_['keys'](_0x169ae4[_0xcc85('0x3d')]);_0x4110c3['filters']=_[_0xcc85('0x40')](_0x4110c3[_0xcc85('0x3c')],_0x4110c3['query']);_0xed9402[_0xcc85('0x3f')]=_[_0xcc85('0x40')](_0x4110c3['model'],qs['fields'](_0x169ae4['query'][_0xcc85('0x41')]));_0xed9402['attributes']=_0xed9402[_0xcc85('0x3f')]['length']?_0xed9402['attributes']:_0x4110c3[_0xcc85('0x3c')];if(!_0x169ae4['query'][_0xcc85('0x43')](_0xcc85('0x44'))){_0xed9402[_0xcc85('0x22')]=qs[_0xcc85('0x22')](_0x169ae4[_0xcc85('0x3d')]['limit']);_0xed9402['offset']=qs[_0xcc85('0x21')](_0x169ae4[_0xcc85('0x3d')][_0xcc85('0x21')]);}_0xed9402[_0xcc85('0x45')]=qs['sort'](_0x169ae4['query']['sort']);_0xed9402[_0xcc85('0x72')]=qs[_0xcc85('0xba')](_[_0xcc85('0x47')](_0x169ae4[_0xcc85('0x3d')],_0x4110c3['filters']));_0xed9402[_0xcc85('0x72')]['OpenchannelInteractionId']=_0x3b0cd8['id'];if(_0x169ae4[_0xcc85('0x3d')][_0xcc85('0x80')]){_0xed9402[_0xcc85('0x72')]=_['merge'](_0xed9402[_0xcc85('0x72')],{'$or':_[_0xcc85('0x2e')](_0xed9402[_0xcc85('0x3f')],function(_0x53547d){var _0x427cad={};_0x427cad[_0x53547d]={'$like':'%'+_0x169ae4[_0xcc85('0x3d')]['filter']+'%'};return _0x427cad;})});}if(_0x169ae4['query'][_0xcc85('0x76')]){var _0x326c71=_0x169ae4['query'][_0xcc85('0x76')]['split'](',');var _0x3a0c03={};_0x3a0c03[_0x326c71[0x0]]={'$gte':moment(_0x326c71[0x1])[_0xcc85('0xbb')](_0xcc85('0xbc'))};_0xed9402['where']=_[_0xcc85('0x98')](_0xed9402['where'],_0x3a0c03);}_0xed9402=_[_0xcc85('0x98')]({},_0xed9402,_0x169ae4[_0xcc85('0xb1')]);return db['OpenchannelMessage'][_0xcc85('0x20')]({'where':_0xed9402[_0xcc85('0x72')]})[_0xcc85('0x29')](function(_0x1e2f36){_0x32b349[_0xcc85('0x20')]=_0x1e2f36;if(_0x169ae4['query'][_0xcc85('0xaf')]){_0xed9402['include']=[{'all':!![]}];}return db[_0xcc85('0xb6')][_0xcc85('0xbd')](_0xed9402);})[_0xcc85('0x29')](function(_0x36baed){_0x32b349[_0xcc85('0xac')]=_0x36baed;return _0x32b349;});}})[_0xcc85('0x29')](respondWithFilteredResult(_0x42a5b3,_0xed9402))[_0xcc85('0x35')](handleError(_0x42a5b3,null));};exports['addTags']=function(_0x229c66,_0xa89006,_0x4c585c){return db['OpenchannelInteraction'][_0xcc85('0x64')]({'where':{'id':_0x229c66[_0xcc85('0xae')]['id']}})[_0xcc85('0x29')](handleEntityNotFound(_0xa89006,null))[_0xcc85('0x29')](function(_0x58a8d7){if(_0x58a8d7){return _0x58a8d7['setTags'](_0x229c66['body']['ids'],_[_0xcc85('0xb8')](_0x229c66['body'],[_0xcc85('0xb7'),'id'])||{})[_0xcc85('0xbe')](function(){return db[_0xcc85('0x68')][_0xcc85('0xbd')]({'attributes':['id','name','color'],'where':{'id':_0x229c66[_0xcc85('0x6e')]['ids']}});})['then'](function(_0x214fdb){socket[_0xcc85('0xbf')](_0xcc85('0xc0'),{'id':Number(_0x229c66['params']['id']),'tags':_0x214fdb||[]});return{'id':Number(_0x229c66[_0xcc85('0xae')]['id']),'tags':_0x214fdb||[]};});}})[_0xcc85('0x29')](respondWithResult(_0xa89006,null))['catch'](handleError(_0xa89006,null));};exports[_0xcc85('0xc1')]=function(_0x19b81b,_0x41c698,_0x1f85b1){return db['OpenchannelInteraction'][_0xcc85('0x64')]({'where':{'id':_0x19b81b[_0xcc85('0xae')]['id']}})[_0xcc85('0x29')](handleEntityNotFound(_0x41c698,null))[_0xcc85('0x29')](function(_0x126f72){if(_0x126f72){return _0x126f72[_0xcc85('0xc1')](_0x19b81b[_0xcc85('0x3d')][_0xcc85('0xb7')]);}})['then'](respondWithStatusCode(_0x41c698,null))['catch'](handleError(_0x41c698,null));};exports[_0xcc85('0xc2')]=function(_0x599891,_0x1cfcf1){var _0x2c305e=moment()[_0xcc85('0xc3')]()[_0xcc85('0x96')]();var _0x4a9504=path['join'](config['root'],'server',_0xcc85('0xc4'),_0xcc85('0xc5'));var _0x13aac1=path[_0xcc85('0xc6')](config['root'],'server','files',_0xcc85('0xc7'));var _0x4ebe8c=path[_0xcc85('0xc6')](_0x4a9504,_0x2c305e);var _0x2a7667=util[_0xcc85('0xbb')](_0xcc85('0xc8'),_0x599891[_0xcc85('0xae')]['id'],_0x2c305e);var _0x499472=path[_0xcc85('0xc6')](_0x4a9504,_0x2a7667);var _0x4157ca=[];_0x4157ca['push']({'model':db[_0xcc85('0x6a')],'as':_0xcc85('0x6a'),'attributes':['id',_0xcc85('0x2f')],'raw':!![]});_0x4157ca[_0xcc85('0x34')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xcc85('0xc9')],'raw':!![]});if(_0x599891[_0xcc85('0x3d')]['attachments']){_0x4157ca[_0xcc85('0x34')]({'model':db[_0xcc85('0xca')],'as':'Attachment','raw':!![]});}var _0x5ded97=[{'model':db['OpenchannelMessage'],'as':_0xcc85('0xcb'),'attributes':['id',_0xcc85('0x6e'),_0xcc85('0x74'),'direction',_0xcc85('0xcc'),_0xcc85('0x7a')],'include':_0x4157ca}];_0x5ded97[_0xcc85('0x34')]({'model':db[_0xcc85('0xcd')],'as':_0xcc85('0xce'),'attributes':['id','name']});_0x5ded97[_0xcc85('0x34')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0xcc85('0x37')][_0xcc85('0x64')]({'where':{'id':_0x599891[_0xcc85('0xae')]['id']},'include':_0x5ded97})[_0xcc85('0x29')](handleEntityNotFound(_0x1cfcf1,null))[_0xcc85('0x29')](function(_0x261cdd){if(_0x261cdd){var _0x5459fa=_0x261cdd[_0xcc85('0xcf')]({'plain':!![]});fs[_0xcc85('0xd0')](_0x4ebe8c);var _0x3d74a9={'format':'A4','border':_0xcc85('0xd1'),'header':{'height':_0xcc85('0xd2'),'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':_0xcc85('0xd3'),'contents':{'default':util[_0xcc85('0xbb')]('\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['format'](_0xcc85('0xd4'),'Openchannel',_0x5459fa['id']),moment()['format'](_0xcc85('0xd5'))[_0xcc85('0x96')]())}}};var _0x369331={'channel':'Openchannel','account':_0x5459fa[_0xcc85('0xce')][_0xcc85('0x2c')],'agent':_0x5459fa[_0xcc85('0xd6')]?_0x5459fa[_0xcc85('0xd6')]['fullname']:'N.A.','createdAt':moment(_0x5459fa[_0xcc85('0x74')])[_0xcc85('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0xcc85('0x96')](),'closedAt':_0x5459fa[_0xcc85('0xd7')]?moment(_0x5459fa['closedAt'])[_0xcc85('0xbb')](_0xcc85('0xbc'))['toString']():'','disposition':_0x5459fa[_0xcc85('0xd8')],'visibility':_0x5459fa[_0xcc85('0xd9')]?_0xcc85('0xda'):_0xcc85('0xdb'),'messages':_(_0x5459fa[_0xcc85('0xcb')])[_0xcc85('0x80')]({'secret':![]})[_0xcc85('0x2e')](function(_0x3b7d55){if(_0x3b7d55[_0xcc85('0xca')]){var _0x4b9aed=path[_0xcc85('0xc6')](_0x13aac1,_0x3b7d55['Attachment']['basename']);if(fs[_0xcc85('0xdc')](_0x4b9aed)){fs['createReadStream'](_0x4b9aed)[_0xcc85('0xdd')](fs[_0xcc85('0xde')](path[_0xcc85('0xc6')](_0x4ebe8c,_0x3b7d55[_0xcc85('0xca')][_0xcc85('0xdf')])));}}return{'date':moment(_0x3b7d55['createdAt'])[_0xcc85('0xbb')](_0xcc85('0xbc'))[_0xcc85('0x96')](),'sender':_0x3b7d55[_0xcc85('0xe0')]==='out'?_0x3b7d55[_0xcc85('0x6a')]?_0x3b7d55['User'][_0xcc85('0x2f')]:'System':_0x3b7d55['Contact']['firstName']+(_0x3b7d55['Contact'][_0xcc85('0xc9')]?'\x20'+_0x3b7d55[_0xcc85('0x61')][_0xcc85('0xc9')]:''),'body':_0x3b7d55[_0xcc85('0xca')]?_0x3b7d55[_0xcc85('0xca')]['basename']:_0x3b7d55[_0xcc85('0x6e')],'direction':_0x3b7d55[_0xcc85('0xe0')]==='out'?'A':'C','secret':_0x3b7d55[_0xcc85('0xcc')],'read':_0x3b7d55[_0xcc85('0x7a')],'attachment':_0x3b7d55['Attachment']};})[_0xcc85('0x5e')]()};return ejs['renderFile'](path[_0xcc85('0xc6')](config[_0xcc85('0xe1')],_0xcc85('0xe2'),_0xcc85('0xe3'),_0xcc85('0xe4')),{'interaction':_0x369331})[_0xcc85('0x29')](function(_0x31d162){return new BPromise(function(_0x3c951e,_0x2a9345){pdf[_0xcc85('0xb2')](_0x31d162,_0x3d74a9)[_0xcc85('0xe5')](path[_0xcc85('0xc6')](_0x4ebe8c,_0xcc85('0xe6')+_0x5459fa['id']+'-'+_0x2c305e+_0xcc85('0xe7')),function(_0x8c56dd,_0x50bb71){if(_0x8c56dd)return _0x2a9345(_0x8c56dd);_0x3c951e(_0x50bb71);});});})[_0xcc85('0x29')](function(){return new BPromise(function(_0x4e6715,_0x4ebf3b){zipdir(_0x4ebe8c,{'saveTo':_0x499472},function(_0x553b8b,_0x1548ec){if(_0x553b8b)return _0x4ebf3b(_0x553b8b);return _0x4e6715(_0x1548ec);});})['then'](function(){return new BPromise(function(_0xd98584,_0x4231c8){rimraf(_0x4ebe8c,function(_0x5263f4){if(_0x5263f4)_0x4231c8(_0x5263f4);return _0xd98584();});});})[_0xcc85('0x29')](function(){return _0x1cfcf1['download'](_0x499472,_0x2a7667,function(_0x57aab7){if(_0x57aab7){console['log'](_0xcc85('0xe8'),_0x57aab7);}else{fs['unlinkSync'](_0x499472);}});});});}else{return _0x1cfcf1[_0xcc85('0x1c')](0xc8);}})['catch'](handleError(_0x1cfcf1,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 7fd3c8f..eaf1a35 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 _0x36b3=['Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x3dddea,_0x2c7d49){var _0x5cf709=function(_0x2a634f){while(--_0x2a634f){_0x3dddea['push'](_0x3dddea['shift']());}};_0x5cf709(++_0x2c7d49);}(_0x36b3,0x195));var _0x336b=function(_0x409ff4,_0x234563){_0x409ff4=_0x409ff4-0x0;var _0x181e23=_0x36b3[_0x409ff4];return _0x181e23;};'use strict';var EventEmitter=require(_0x336b('0x0'));var OpenchannelInteraction=require(_0x336b('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x336b('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x336b('0x2')](0x0);var events={'afterCreate':_0x336b('0x3'),'afterUpdate':_0x336b('0x4'),'afterDestroy':_0x336b('0x5')};function emitEvent(_0x39f3c2){return function(_0x16c2fc,_0x4ffa1b,_0x120606){_0x16c2fc[_0x336b('0x6')]({'attributes':['id'],'raw':!![]})[_0x336b('0x7')](function(_0x44254e){_0x16c2fc[_0x336b('0x8')](_0x336b('0x9'),_0x44254e[_0x336b('0xa')](function(_0x14ee4f){return{'id':_0x14ee4f['id']};}));return OpenchannelMessage[_0x336b('0xb')]({'where':{'OpenchannelInteractionId':_0x16c2fc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x336b('0x7')](function(_0x3b7c1d){_0x16c2fc[_0x336b('0x8')](_0x336b('0xc'),_0x3b7c1d['length']);OpenchannelInteractionEvents[_0x336b('0xd')](_0x39f3c2+':'+_0x16c2fc['id'],_0x16c2fc);OpenchannelInteractionEvents[_0x336b('0xd')](_0x39f3c2,_0x16c2fc);_0x120606(null);})[_0x336b('0xe')](_0x120606(null));};}for(var e in events){if(events[_0x336b('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x336b('0x10')](e,emitEvent(event));}}module[_0x336b('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2039=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit'];(function(_0x559863,_0x3b14b1){var _0x2c55c8=function(_0x289a9f){while(--_0x289a9f){_0x559863['push'](_0x559863['shift']());}};_0x2c55c8(++_0x3b14b1);}(_0x2039,0x19b));var _0x9203=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2039[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0x9203('0x0'));var OpenchannelInteraction=require(_0x9203('0x1'))['db'][_0x9203('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x9203('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x9203('0x4')](0x0);var events={'afterCreate':_0x9203('0x5'),'afterUpdate':'update','afterDestroy':_0x9203('0x6')};function emitEvent(_0x535175){return function(_0x5c8463,_0x3a6d31,_0x535b4c){_0x5c8463['getUsers']({'attributes':['id'],'raw':!![]})[_0x9203('0x7')](function(_0x2b01a8){_0x5c8463[_0x9203('0x8')](_0x9203('0x9'),_0x2b01a8[_0x9203('0xa')](function(_0x8e5f4d){return{'id':_0x8e5f4d['id']};}));return OpenchannelMessage[_0x9203('0xb')]({'where':{'OpenchannelInteractionId':_0x5c8463['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x33509a){_0x5c8463[_0x9203('0x8')](_0x9203('0xc'),_0x33509a['length']);OpenchannelInteractionEvents[_0x9203('0xd')](_0x535175+':'+_0x5c8463['id'],_0x5c8463);OpenchannelInteractionEvents[_0x9203('0xd')](_0x535175,_0x5c8463);_0x535b4c(null);})['catch'](_0x535b4c(null));};}for(var e in events){if(events[_0x9203('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x9203('0xf')](e,emitEvent(event));}}module[_0x9203('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index e425325..b14a061 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 _0x25fa=['OpenchannelInteraction','openchannel_interactions','changed','closedAt','format','lodash','../../config/logger','api','bluebird','request-promise','path','./openchannelInteraction.attributes','define'];(function(_0x280f8b,_0x326bc2){var _0x2efec5=function(_0x484d08){while(--_0x484d08){_0x280f8b['push'](_0x280f8b['shift']());}};_0x2efec5(++_0x326bc2);}(_0x25fa,0x109));var _0xa25f=function(_0x5e397f,_0x140eba){_0x5e397f=_0x5e397f-0x0;var _0x2e4410=_0x25fa[_0x5e397f];return _0x2e4410;};'use strict';var _=require(_0xa25f('0x0'));var util=require('util');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var moment=require('moment');var BPromise=require(_0xa25f('0x3'));var rp=require(_0xa25f('0x4'));var fs=require('fs');var path=require(_0xa25f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa25f('0x6'));module['exports']=function(_0x2ea9ea,_0x3ab530){return _0x2ea9ea[_0xa25f('0x7')](_0xa25f('0x8'),attributes,{'tableName':_0xa25f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x168907,_0x64bbbf,_0x25445a){if(_0x168907[_0xa25f('0xa')]('closed')){_0x168907[_0xa25f('0xb')]=moment()[_0xa25f('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x25445a(null,_0x168907);}}});}; \ No newline at end of file +var _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','format'];(function(_0x31f23f,_0x421862){var _0x572b25=function(_0x41c5ca){while(--_0x41c5ca){_0x31f23f['push'](_0x31f23f['shift']());}};_0x572b25(++_0x421862);}(_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 logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));module[_0xd7df('0xb')]=function(_0x36cf0f,_0x39ce98){return _0x36cf0f[_0xd7df('0xc')](_0xd7df('0xd'),attributes,{'tableName':_0xd7df('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c220a,_0xab6742,_0xb3557a){if(_0x5c220a[_0xd7df('0xf')](_0xd7df('0x10'))){_0x5c220a['closedAt']=moment()[_0xd7df('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0xb3557a(null,_0x5c220a);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index df9a00a..2f39bec 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 _0xf726=['../../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','error','code','message','result','catch','OpenchannelInteraction','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','stringify','AddTagsToOpenchannelInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x21e403,_0x1804ec){var _0x37c533=function(_0x493898){while(--_0x493898){_0x21e403['push'](_0x21e403['shift']());}};_0x37c533(++_0x1804ec);}(_0xf726,0x18f));var _0x6f72=function(_0x255f1f,_0x1da49b){_0x255f1f=_0x255f1f-0x0;var _0x4ab606=_0xf726[_0x255f1f];return _0x4ab606;};'use strict';var _=require(_0x6f72('0x0'));var util=require(_0x6f72('0x1'));var moment=require(_0x6f72('0x2'));var BPromise=require(_0x6f72('0x3'));var rs=require(_0x6f72('0x4'));var fs=require('fs');var Redis=require(_0x6f72('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f72('0x6'));var logger=require(_0x6f72('0x7'))(_0x6f72('0x8'));var config=require('../../config/environment');var jayson=require(_0x6f72('0x9'));var client=jayson[_0x6f72('0xa')][_0x6f72('0xb')]({'port':0x232a});config[_0x6f72('0xc')]=_[_0x6f72('0xd')](config[_0x6f72('0xc')],{'host':_0x6f72('0xe'),'port':0x18eb});var socket=require(_0x6f72('0xf'))(new Redis(config[_0x6f72('0xc')]));require(_0x6f72('0x10'))[_0x6f72('0x11')](socket);function respondWithRpcPromise(_0x5dec3f,_0x4b980c,_0x3c3bf8){return new BPromise(function(_0x241229,_0x282ae8){return client[_0x6f72('0x12')](_0x5dec3f,_0x3c3bf8)[_0x6f72('0x13')](function(_0x26abb5){logger[_0x6f72('0x14')](_0x6f72('0x15'),_0x4b980c,_0x6f72('0x16'));logger[_0x6f72('0x17')](_0x6f72('0x18'),_0x4b980c,'request\x20sent',JSON['stringify'](_0x26abb5));if(_0x26abb5[_0x6f72('0x19')]){if(_0x26abb5[_0x6f72('0x19')][_0x6f72('0x1a')]===0x1f4){logger[_0x6f72('0x19')](_0x6f72('0x15'),_0x4b980c,_0x26abb5[_0x6f72('0x19')][_0x6f72('0x1b')]);return _0x282ae8(_0x26abb5[_0x6f72('0x19')][_0x6f72('0x1b')]);}logger[_0x6f72('0x19')](_0x6f72('0x15'),_0x4b980c,_0x26abb5[_0x6f72('0x19')][_0x6f72('0x1b')]);return _0x241229(_0x26abb5[_0x6f72('0x19')][_0x6f72('0x1b')]);}else{logger[_0x6f72('0x14')](_0x6f72('0x15'),_0x4b980c,_0x6f72('0x16'));_0x241229(_0x26abb5[_0x6f72('0x1c')][_0x6f72('0x1b')]);}})[_0x6f72('0x1d')](function(_0x262a23){logger[_0x6f72('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4b980c,_0x262a23);_0x282ae8(_0x262a23);});});}exports['UpdateOpenchannelInteraction']=function(_0x4fe15b){var _0x581376=this;return new Promise(function(_0x380080,_0x5d26fe){return db[_0x6f72('0x1e')]['update'](_0x4fe15b[_0x6f72('0x1f')],{'raw':_0x4fe15b[_0x6f72('0x20')]?_0x4fe15b[_0x6f72('0x20')][_0x6f72('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fe15b[_0x6f72('0x20')]?_0x4fe15b['options'][_0x6f72('0x22')]||null:null,'attributes':_0x4fe15b['options']?_0x4fe15b[_0x6f72('0x20')][_0x6f72('0x23')]||null:null,'limit':_0x4fe15b[_0x6f72('0x20')]?_0x4fe15b['options'][_0x6f72('0x24')]||null:null})['then'](function(_0x515c49){logger[_0x6f72('0x14')](_0x6f72('0x25'),_0x4fe15b);logger[_0x6f72('0x17')](_0x6f72('0x25'),_0x4fe15b,JSON[_0x6f72('0x26')](_0x515c49));_0x380080(_0x515c49);})[_0x6f72('0x1d')](function(_0x5f5298){logger[_0x6f72('0x19')](_0x6f72('0x25'),_0x5f5298[_0x6f72('0x1b')],_0x4fe15b);_0x5d26fe(_0x581376[_0x6f72('0x19')](0x1f4,_0x5f5298['message']));});});};exports[_0x6f72('0x27')]=function(_0x12e5e3){return new Promise(function(_0x5eb253,_0x2469e6){return db[_0x6f72('0x1e')][_0x6f72('0x28')]({'where':_0x12e5e3['options']?_0x12e5e3[_0x6f72('0x20')][_0x6f72('0x22')]||null:null})[_0x6f72('0x13')](function(_0x474ab5){if(_0x474ab5){return _0x474ab5[_0x6f72('0x29')](_0x12e5e3[_0x6f72('0x1f')]['ids'],_[_0x6f72('0x2a')](_0x12e5e3[_0x6f72('0x1f')],[_0x6f72('0x2b'),'id'])||{});}})['spread'](function(_0xa779d9){logger[_0x6f72('0x14')]('AddTags',_0x12e5e3);logger[_0x6f72('0x17')](_0x6f72('0x2c'),_0x12e5e3,JSON[_0x6f72('0x26')](_0xa779d9));_0x5eb253(_0xa779d9);})['catch'](function(_0xf28e8d){logger[_0x6f72('0x19')](_0x6f72('0x2c'),_0xf28e8d['message'],_0x12e5e3);_0x2469e6(_this['error'](0x1f4,_0xf28e8d[_0x6f72('0x1b')]));});});}; \ No newline at end of file +var _0xc273=['omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','limit','AddTagsToOpenchannelInteraction','find','addTags','ids'];(function(_0x567afb,_0x3e0ba2){var _0x50ce98=function(_0x30f79b){while(--_0x30f79b){_0x567afb['push'](_0x567afb['shift']());}};_0x50ce98(++_0x3e0ba2);}(_0xc273,0x137));var _0x3c27=function(_0x9efe0,_0x1e7272){_0x9efe0=_0x9efe0-0x0;var _0x232a0f=_0xc273[_0x9efe0];return _0x232a0f;};'use strict';var _=require(_0x3c27('0x0'));var util=require(_0x3c27('0x1'));var moment=require(_0x3c27('0x2'));var BPromise=require(_0x3c27('0x3'));var rs=require(_0x3c27('0x4'));var fs=require('fs');var Redis=require(_0x3c27('0x5'));var db=require(_0x3c27('0x6'))['db'];var utils=require(_0x3c27('0x7'));var logger=require(_0x3c27('0x8'))(_0x3c27('0x9'));var config=require('../../config/environment');var jayson=require(_0x3c27('0xa'));var client=jayson[_0x3c27('0xb')]['http']({'port':0x232a});config[_0x3c27('0xc')]=_[_0x3c27('0xd')](config[_0x3c27('0xc')],{'host':_0x3c27('0xe'),'port':0x18eb});var socket=require(_0x3c27('0xf'))(new Redis(config[_0x3c27('0xc')]));require(_0x3c27('0x10'))[_0x3c27('0x11')](socket);function respondWithRpcPromise(_0x202139,_0x5d98d7,_0x565b94){return new BPromise(function(_0x15ec2b,_0x338068){return client[_0x3c27('0x12')](_0x202139,_0x565b94)[_0x3c27('0x13')](function(_0x58fc90){logger[_0x3c27('0x14')](_0x3c27('0x15'),_0x5d98d7,'request\x20sent');logger[_0x3c27('0x16')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x5d98d7,'request\x20sent',JSON[_0x3c27('0x17')](_0x58fc90));if(_0x58fc90['error']){if(_0x58fc90['error'][_0x3c27('0x18')]===0x1f4){logger[_0x3c27('0x19')](_0x3c27('0x15'),_0x5d98d7,_0x58fc90[_0x3c27('0x19')]['message']);return _0x338068(_0x58fc90[_0x3c27('0x19')][_0x3c27('0x1a')]);}logger[_0x3c27('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5d98d7,_0x58fc90[_0x3c27('0x19')][_0x3c27('0x1a')]);return _0x15ec2b(_0x58fc90[_0x3c27('0x19')]['message']);}else{logger['info'](_0x3c27('0x15'),_0x5d98d7,_0x3c27('0x1b'));_0x15ec2b(_0x58fc90[_0x3c27('0x1c')][_0x3c27('0x1a')]);}})[_0x3c27('0x1d')](function(_0x4c2370){logger[_0x3c27('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5d98d7,_0x4c2370);_0x338068(_0x4c2370);});});}exports[_0x3c27('0x1e')]=function(_0x472504){var _0x4d9eae=this;return new Promise(function(_0x1eb579,_0x2d0d9a){return db[_0x3c27('0x1f')][_0x3c27('0x20')](_0x472504[_0x3c27('0x21')],{'raw':_0x472504['options']?_0x472504['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x472504[_0x3c27('0x22')]?_0x472504[_0x3c27('0x22')][_0x3c27('0x23')]||null:null,'attributes':_0x472504[_0x3c27('0x22')]?_0x472504[_0x3c27('0x22')]['attributes']||null:null,'limit':_0x472504[_0x3c27('0x22')]?_0x472504[_0x3c27('0x22')][_0x3c27('0x24')]||null:null})['then'](function(_0x53de8d){logger[_0x3c27('0x14')]('UpdateOpenchannelInteraction',_0x472504);logger['debug'](_0x3c27('0x1e'),_0x472504,JSON[_0x3c27('0x17')](_0x53de8d));_0x1eb579(_0x53de8d);})[_0x3c27('0x1d')](function(_0x3291c1){logger[_0x3c27('0x19')](_0x3c27('0x1e'),_0x3291c1['message'],_0x472504);_0x2d0d9a(_0x4d9eae['error'](0x1f4,_0x3291c1[_0x3c27('0x1a')]));});});};exports[_0x3c27('0x25')]=function(_0x305f96){return new Promise(function(_0x1436e4,_0x3376b6){return db[_0x3c27('0x1f')][_0x3c27('0x26')]({'where':_0x305f96[_0x3c27('0x22')]?_0x305f96[_0x3c27('0x22')][_0x3c27('0x23')]||null:null})[_0x3c27('0x13')](function(_0x3602a5){if(_0x3602a5){return _0x3602a5[_0x3c27('0x27')](_0x305f96['body'][_0x3c27('0x28')],_[_0x3c27('0x29')](_0x305f96[_0x3c27('0x21')],[_0x3c27('0x28'),'id'])||{});}})[_0x3c27('0x2a')](function(_0x59f43f){logger[_0x3c27('0x14')](_0x3c27('0x2b'),_0x305f96);logger['debug'](_0x3c27('0x2b'),_0x305f96,JSON[_0x3c27('0x17')](_0x59f43f));_0x1436e4(_0x59f43f);})[_0x3c27('0x1d')](function(_0x198dcd){logger[_0x3c27('0x19')]('AddTags',_0x198dcd[_0x3c27('0x1a')],_0x305f96);_0x3376b6(_this['error'](0x1f4,_0x198dcd[_0x3c27('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 3af2d57..ca54b14 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 _0x5e49=['removeListener','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x422a08,_0x41f359){var _0x17ddb7=function(_0x301b47){while(--_0x301b47){_0x422a08['push'](_0x422a08['shift']());}};_0x17ddb7(++_0x41f359);}(_0x5e49,0x72));var _0x95e4=function(_0x488f79,_0x305b4b){_0x488f79=_0x488f79-0x0;var _0x102892=_0x5e49[_0x488f79];return _0x102892;};'use strict';var OpenchannelInteractionEvents=require(_0x95e4('0x0'));var events=[_0x95e4('0x1'),_0x95e4('0x2'),_0x95e4('0x3')];function createListener(_0xfb0aea,_0x1e2be3){return function(_0x55741f){_0x1e2be3[_0x95e4('0x4')](_0xfb0aea,_0x55741f);};}function removeListener(_0x2797c1,_0x33f066){return function(){OpenchannelInteractionEvents[_0x95e4('0x5')](_0x2797c1,_0x33f066);};}exports['register']=function(_0x31ee6b){for(var _0x346cfa=0x0,_0xfc4916=events['length'];_0x346cfa<_0xfc4916;_0x346cfa++){var _0x5a1f6f=events[_0x346cfa];var _0x241562=createListener(_0x95e4('0x6')+_0x5a1f6f,_0x31ee6b);OpenchannelInteractionEvents['on'](_0x5a1f6f,_0x241562);}}; \ No newline at end of file +var _0x6687=['length','openchannelInteraction:','./openchannelInteraction.events','remove','removeListener','register'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x6687,0x80));var _0x7668=function(_0x3b12d4,_0x21f901){_0x3b12d4=_0x3b12d4-0x0;var _0x2dd227=_0x6687[_0x3b12d4];return _0x2dd227;};'use strict';var OpenchannelInteractionEvents=require(_0x7668('0x0'));var events=['save',_0x7668('0x1'),'update'];function createListener(_0x27f479,_0x4d828a){return function(_0x261528){_0x4d828a['emit'](_0x27f479,_0x261528);};}function removeListener(_0x4e2ebc,_0x16f285){return function(){OpenchannelInteractionEvents[_0x7668('0x2')](_0x4e2ebc,_0x16f285);};}exports[_0x7668('0x3')]=function(_0x1565a1){for(var _0x488be4=0x0,_0x42b25c=events[_0x7668('0x4')];_0x488be4<_0x42b25c;_0x488be4++){var _0x670c66=events[_0x488be4];var _0x5e17da=createListener(_0x7668('0x5')+_0x670c66,_0x1565a1);OpenchannelInteractionEvents['on'](_0x670c66,_0x5e17da);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 94437e5..5447bd3 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 _0xc8aa=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','put','/:id/accept','reject','delete','destroy','multer','util'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0xc8aa,0x94));var _0xac8a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc8aa[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xac8a('0x0'));var util=require(_0xac8a('0x1'));var path=require(_0xac8a('0x2'));var timeout=require(_0xac8a('0x3'));var express=require(_0xac8a('0x4'));var router=express['Router']();var auth=require(_0xac8a('0x5'));var interaction=require(_0xac8a('0x6'));var config=require(_0xac8a('0x7'));var controller=require(_0xac8a('0x8'));router[_0xac8a('0x9')]('/',auth[_0xac8a('0xa')](),controller[_0xac8a('0xb')]);router[_0xac8a('0x9')]('/describe',auth[_0xac8a('0xa')](),controller[_0xac8a('0xc')]);router[_0xac8a('0x9')](_0xac8a('0xd'),auth[_0xac8a('0xa')](),controller[_0xac8a('0xe')]);router[_0xac8a('0xf')]('/',auth[_0xac8a('0xa')](),interaction[_0xac8a('0x10')](_0xac8a('0x11'),_0xac8a('0x12')),controller[_0xac8a('0x13')]);router[_0xac8a('0x14')](_0xac8a('0xd'),auth[_0xac8a('0xa')](),controller['update']);router[_0xac8a('0x14')](_0xac8a('0x15'),auth[_0xac8a('0xa')](),controller['accept']);router[_0xac8a('0x14')]('/:id/reject',auth[_0xac8a('0xa')](),controller[_0xac8a('0x16')]);router[_0xac8a('0x17')]('/:id',auth[_0xac8a('0xa')](),controller[_0xac8a('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9318=['/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','exports','path','express','Router','../../config/environment','./openchannelMessage.controller','index','get','/describe','isAuthenticated','describe'];(function(_0x41419c,_0x1755b3){var _0x5f4b22=function(_0x118bfc){while(--_0x118bfc){_0x41419c['push'](_0x41419c['shift']());}};_0x5f4b22(++_0x1755b3);}(_0x9318,0x69));var _0x8931=function(_0x37e629,_0x47100e){_0x37e629=_0x37e629-0x0;var _0x21e4a5=_0x9318[_0x37e629];return _0x21e4a5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8931('0x0'));var timeout=require('connect-timeout');var express=require(_0x8931('0x1'));var router=express[_0x8931('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8931('0x3'));var controller=require(_0x8931('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x8931('0x5')]);router[_0x8931('0x6')](_0x8931('0x7'),auth[_0x8931('0x8')](),controller[_0x8931('0x9')]);router['get'](_0x8931('0xa'),auth[_0x8931('0x8')](),controller[_0x8931('0xb')]);router[_0x8931('0xc')]('/',auth['isAuthenticated'](),interaction[_0x8931('0xd')](_0x8931('0xe'),_0x8931('0xf')),controller['create']);router[_0x8931('0x10')]('/:id',auth[_0x8931('0x8')](),controller[_0x8931('0x11')]);router[_0x8931('0x10')](_0x8931('0x12'),auth['isAuthenticated'](),controller[_0x8931('0x13')]);router[_0x8931('0x10')](_0x8931('0x14'),auth[_0x8931('0x8')](),controller['reject']);router[_0x8931('0x15')](_0x8931('0xa'),auth[_0x8931('0x8')](),controller['destroy']);module[_0x8931('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 9c0cf9f..180f6cb 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 _0x076a=['BOOLEAN','out','STRING','TEXT','exports','medium'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x076a,0x1ba));var _0xa076=function(_0x4503df,_0xfec122){_0x4503df=_0x4503df-0x0;var _0x3f1b2b=_0x076a[_0x4503df];return _0x3f1b2b;};'use strict';var Sequelize=require('sequelize');module[_0xa076('0x0')]={'body':{'type':Sequelize['TEXT'](_0xa076('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xa076('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa076('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa076('0x3')),'defaultValue':_0xa076('0x3'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xa076('0x4')]},'providerResponse':{'type':Sequelize[_0xa076('0x5')]}}; \ No newline at end of file +var _0x8884=['exports','medium','BOOLEAN','ENUM','out','DATE','TEXT','sequelize'];(function(_0x47ad1a,_0x467d68){var _0x586211=function(_0x169364){while(--_0x169364){_0x47ad1a['push'](_0x47ad1a['shift']());}};_0x586211(++_0x467d68);}(_0x8884,0x1af));var _0x4888=function(_0xa9cc87,_0xdab05f){_0xa9cc87=_0xa9cc87-0x0;var _0x5e03c8=_0x8884[_0xa9cc87];return _0x5e03c8;};'use strict';var Sequelize=require(_0x4888('0x0'));module[_0x4888('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4888('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4888('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4888('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4888('0x4')]('in',_0x4888('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x4888('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4888('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index dce3634..8465103 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 _0x47c2=['jayson/promise','http','client','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','key','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','RejectMessage','rejectmessage','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register'];(function(_0x177425,_0x1a9d74){var _0x499c3d=function(_0x5e0557){while(--_0x5e0557){_0x177425['push'](_0x177425['shift']());}};_0x499c3d(++_0x1a9d74);}(_0x47c2,0x1cc));var _0x247c=function(_0x380252,_0x3133e2){_0x380252=_0x380252-0x0;var _0x5d1330=_0x47c2[_0x380252];return _0x5d1330;};'use strict';var pdf=require(_0x247c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x247c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x247c('0x2'));var rp=require('request-promise');var moment=require(_0x247c('0x3'));var BPromise=require(_0x247c('0x4'));var Mustache=require(_0x247c('0x5'));var util=require('util');var path=require(_0x247c('0x6'));var sox=require(_0x247c('0x7'));var csv=require('to-csv');var ejs=require(_0x247c('0x8'));var fs=require('fs');var _=require(_0x247c('0x9'));var squel=require('squel');var crypto=require(_0x247c('0xa'));var jsforce=require(_0x247c('0xb'));var deskjs=require(_0x247c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x247c('0xd'));var Redis=require(_0x247c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x247c('0xf'));var as=require(_0x247c('0x10'));var hardwareService=require(_0x247c('0x11'));var logger=require('../../config/logger')(_0x247c('0x12'));var utils=require('../../config/utils');var config=require(_0x247c('0x13'));var licenseUtil=require(_0x247c('0x14'));var db=require(_0x247c('0x15'))['db'];config[_0x247c('0x16')]=_[_0x247c('0x17')](config[_0x247c('0x16')],{'host':_0x247c('0x18'),'port':0x18eb});var socket=require(_0x247c('0x19'))(new Redis(config['redis']));require(_0x247c('0x1a'))[_0x247c('0x1b')](socket);var jayson=require(_0x247c('0x1c'));var client=jayson['client'][_0x247c('0x1d')]({'port':0x232c});var client9002=jayson[_0x247c('0x1e')][_0x247c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5b6275,_0x522438,_0xffea91,_0x35d4c8){return new BPromise(function(_0x4a9433,_0x5eaf1b){var _0x20d6ab=_0x35d4c8||client;return _0x20d6ab[_0x247c('0x1f')](_0x5b6275,_0xffea91)[_0x247c('0x20')](function(_0x2e349e){logger['info'](_0x247c('0x21'),_0x522438,_0x247c('0x22'));logger[_0x247c('0x23')](_0x247c('0x24'),_0x522438,_0x247c('0x22'),JSON['stringify'](_0x2e349e));if(_0x2e349e['error']){if(_0x2e349e[_0x247c('0x25')]['code']===0x1f4){logger[_0x247c('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x522438,_0x2e349e[_0x247c('0x25')][_0x247c('0x26')]);return _0x5eaf1b(_0x2e349e[_0x247c('0x25')][_0x247c('0x26')]);}logger[_0x247c('0x25')](_0x247c('0x21'),_0x522438,_0x2e349e[_0x247c('0x25')][_0x247c('0x26')]);return _0x4a9433(_0x2e349e[_0x247c('0x25')][_0x247c('0x26')]);}else{logger['info'](_0x247c('0x21'),_0x522438,_0x247c('0x22'));_0x4a9433(_0x2e349e[_0x247c('0x27')][_0x247c('0x26')]);}})[_0x247c('0x28')](function(_0x568b84){logger[_0x247c('0x25')](_0x247c('0x21'),_0x522438,_0x568b84);_0x5eaf1b(_0x568b84);});});}function respondWithStatusCode(_0x45e70f,_0x4f264a){_0x4f264a=_0x4f264a||0xcc;return function(_0x5598f1){if(_0x5598f1){return _0x45e70f['sendStatus'](_0x4f264a);}return _0x45e70f[_0x247c('0x29')](_0x4f264a)[_0x247c('0x2a')]();};}function respondWithResult(_0x1fb52c,_0x4229bc){_0x4229bc=_0x4229bc||0xc8;return function(_0x54e6bf){if(_0x54e6bf){return _0x1fb52c['status'](_0x4229bc)[_0x247c('0x2b')](_0x54e6bf);}};}function respondWithFilteredResult(_0x25dfe6,_0x589042){return function(_0xdf7dca){if(_0xdf7dca){var _0x59145d=_0xdf7dca[_0x247c('0x2c')],_0x3c0a8c=_0x589042[_0x247c('0x2d')],_0xbe533b=_0x589042[_0x247c('0x2d')]+_0x589042[_0x247c('0x2e')],_0x3882bb;if(_0xbe533b>=_0x59145d){_0xbe533b=_0x59145d;_0x3882bb=0xc8;}else{_0x3882bb=0xce;}_0x25dfe6[_0x247c('0x29')](_0x3882bb);return _0x25dfe6[_0x247c('0x2f')](_0x247c('0x30'),_0x3c0a8c+'-'+_0xbe533b+'/'+_0x59145d)[_0x247c('0x2b')](_0xdf7dca);}return null;};}function patchUpdates(_0x5c1765){return function(_0x4dc56d){try{jsonpatch[_0x247c('0x31')](_0x4dc56d,_0x5c1765,!![]);}catch(_0x1cb55f){return BPromise[_0x247c('0x32')](_0x1cb55f);}return _0x4dc56d['save']();};}function saveUpdates(_0x1e9e7d,_0x49a113){return function(_0x551485){if(_0x551485){return _0x551485[_0x247c('0x33')](_0x1e9e7d)['then'](function(_0x235097){return _0x235097;});}return null;};}function removeEntity(_0x39e210,_0xb94dda){return function(_0x34aa10){if(_0x34aa10){return _0x34aa10[_0x247c('0x34')]()[_0x247c('0x20')](function(){_0x39e210[_0x247c('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f7841,_0x5dcbd0){return function(_0x38c947){if(!_0x38c947){_0x4f7841['sendStatus'](0x194);}return _0x38c947;};}function handleError(_0x46a460,_0xd41e8c){_0xd41e8c=_0xd41e8c||0x1f4;return function(_0x78a07a){logger['error'](_0x78a07a[_0x247c('0x35')]);if(_0x78a07a[_0x247c('0x36')]){delete _0x78a07a[_0x247c('0x36')];}_0x46a460[_0x247c('0x29')](_0xd41e8c)[_0x247c('0x37')](_0x78a07a);};}exports[_0x247c('0x38')]=function(_0x48c6a8,_0x43ad6f){var _0x59ba77={},_0x4099af={},_0x54f3cc={'count':0x0,'rows':[]};var _0x2f54c7=_[_0x247c('0x39')](db[_0x247c('0x3a')][_0x247c('0x3b')],function(_0x196d99){return{'name':_0x196d99['fieldName'],'type':_0x196d99['type'][_0x247c('0x3c')]};});_0x4099af['model']=_[_0x247c('0x39')](_0x2f54c7,_0x247c('0x36'));_0x4099af['query']=_['keys'](_0x48c6a8['query']);_0x4099af[_0x247c('0x3d')]=_[_0x247c('0x3e')](_0x4099af[_0x247c('0x3f')],_0x4099af[_0x247c('0x40')]);_0x59ba77[_0x247c('0x41')]=_['intersection'](_0x4099af[_0x247c('0x3f')],qs[_0x247c('0x42')](_0x48c6a8[_0x247c('0x40')]['fields']));_0x59ba77['attributes']=_0x59ba77['attributes'][_0x247c('0x43')]?_0x59ba77[_0x247c('0x41')]:_0x4099af[_0x247c('0x3f')];if(!_0x48c6a8[_0x247c('0x40')]['hasOwnProperty'](_0x247c('0x44'))){_0x59ba77['limit']=qs['limit'](_0x48c6a8[_0x247c('0x40')][_0x247c('0x2e')]);_0x59ba77[_0x247c('0x2d')]=qs['offset'](_0x48c6a8['query']['offset']);}_0x59ba77[_0x247c('0x45')]=qs[_0x247c('0x46')](_0x48c6a8['query'][_0x247c('0x46')]);_0x59ba77[_0x247c('0x47')]=qs[_0x247c('0x3d')](_[_0x247c('0x48')](_0x48c6a8[_0x247c('0x40')],_0x4099af[_0x247c('0x3d')]),_0x2f54c7);if(_0x48c6a8[_0x247c('0x40')][_0x247c('0x49')]){_0x59ba77[_0x247c('0x47')]=_[_0x247c('0x4a')](_0x59ba77['where'],{'$or':_['map'](_0x2f54c7,function(_0xb831ec){if(_0xb831ec[_0x247c('0x4b')]!==_0x247c('0x4c')){var _0x1018dc={};_0x1018dc[_0xb831ec[_0x247c('0x36')]]={'$like':'%'+_0x48c6a8['query'][_0x247c('0x49')]+'%'};return _0x1018dc;}})});}_0x59ba77=_[_0x247c('0x4a')]({},_0x59ba77,_0x48c6a8[_0x247c('0x4d')]);var _0x5b93ed={'where':_0x59ba77[_0x247c('0x47')]};return db[_0x247c('0x3a')][_0x247c('0x2c')](_0x5b93ed)['then'](function(_0x4a6c91){_0x54f3cc[_0x247c('0x2c')]=_0x4a6c91;if(_0x48c6a8[_0x247c('0x40')][_0x247c('0x4e')]){_0x59ba77[_0x247c('0x4f')]=[{'all':!![]}];}return db[_0x247c('0x3a')][_0x247c('0x50')](_0x59ba77);})[_0x247c('0x20')](function(_0x3d9679){_0x54f3cc[_0x247c('0x51')]=_0x3d9679;return _0x54f3cc;})[_0x247c('0x20')](respondWithFilteredResult(_0x43ad6f,_0x59ba77))[_0x247c('0x28')](handleError(_0x43ad6f,null));};exports[_0x247c('0x52')]=function(_0x161cdb,_0x4f6c32){var _0x4146cd={'raw':!![],'where':{'id':_0x161cdb[_0x247c('0x53')]['id']}},_0x1e79f0={};_0x1e79f0['model']=_[_0x247c('0x54')](db['OpenchannelMessage'][_0x247c('0x3b')]);_0x1e79f0['query']=_['keys'](_0x161cdb[_0x247c('0x40')]);_0x1e79f0['filters']=_[_0x247c('0x3e')](_0x1e79f0[_0x247c('0x3f')],_0x1e79f0[_0x247c('0x40')]);_0x4146cd[_0x247c('0x41')]=_['intersection'](_0x1e79f0['model'],qs[_0x247c('0x42')](_0x161cdb[_0x247c('0x40')][_0x247c('0x42')]));_0x4146cd[_0x247c('0x41')]=_0x4146cd['attributes'][_0x247c('0x43')]?_0x4146cd['attributes']:_0x1e79f0[_0x247c('0x3f')];if(_0x161cdb['query'][_0x247c('0x4e')]){_0x4146cd[_0x247c('0x4f')]=[{'all':!![]}];}_0x4146cd=_[_0x247c('0x4a')]({},_0x4146cd,_0x161cdb[_0x247c('0x4d')]);return db[_0x247c('0x3a')][_0x247c('0x55')](_0x4146cd)[_0x247c('0x20')](handleEntityNotFound(_0x4f6c32,null))[_0x247c('0x20')](respondWithResult(_0x4f6c32,null))[_0x247c('0x28')](handleError(_0x4f6c32,null));};exports[_0x247c('0x56')]=function(_0x4eda4d,_0x3a4ed8){return db['OpenchannelMessage'][_0x247c('0x56')](_0x4eda4d[_0x247c('0x57')],{})['then'](respondWithResult(_0x3a4ed8,0xc9))[_0x247c('0x28')](handleError(_0x3a4ed8,null));};exports[_0x247c('0x33')]=function(_0x28d943,_0x8fb19){if(_0x28d943[_0x247c('0x57')]['id']){delete _0x28d943[_0x247c('0x57')]['id'];}return db[_0x247c('0x3a')][_0x247c('0x55')]({'where':{'id':_0x28d943[_0x247c('0x53')]['id']}})[_0x247c('0x20')](handleEntityNotFound(_0x8fb19,null))[_0x247c('0x20')](saveUpdates(_0x28d943[_0x247c('0x57')],null))[_0x247c('0x20')](respondWithResult(_0x8fb19,null))[_0x247c('0x28')](handleError(_0x8fb19,null));};exports[_0x247c('0x34')]=function(_0xf7b0a4,_0x1485ac){return db[_0x247c('0x3a')][_0x247c('0x55')]({'where':{'id':_0xf7b0a4[_0x247c('0x53')]['id']}})['then'](handleEntityNotFound(_0x1485ac,null))[_0x247c('0x20')](removeEntity(_0x1485ac,null))[_0x247c('0x28')](handleError(_0x1485ac,null));};exports[_0x247c('0x58')]=function(_0x262ad0,_0x3e3b0e){return db[_0x247c('0x3a')][_0x247c('0x58')]()[_0x247c('0x20')](respondWithResult(_0x3e3b0e,null))[_0x247c('0x28')](handleError(_0x3e3b0e,null));};var interaction_log=require(_0x247c('0x59'))(_0x247c('0x5a'));exports[_0x247c('0x5b')]=function(_0x2d7b2d,_0x36c9f6,_0x4d353f){var _0x3bf0fb={'agent':{},'channel':_0x247c('0x5c')};if(_0x2d7b2d['body']['id']){delete _0x2d7b2d[_0x247c('0x57')]['id'];}_0x2d7b2d[_0x247c('0x57')][_0x247c('0x5d')]=!![];_0x2d7b2d['body'][_0x247c('0x5e')]=moment()[_0x247c('0x5f')](_0x247c('0x60'));_0x2d7b2d[_0x247c('0x57')][_0x247c('0x61')]=_0x2d7b2d['body'][_0x247c('0x61')]||_0x2d7b2d[_0x247c('0x62')]['id'];_0x3bf0fb[_0x247c('0x63')]['id']=_0x2d7b2d[_0x247c('0x57')]['UserId'];return db[_0x247c('0x3a')]['find']({'where':{'id':_0x2d7b2d['params']['id'],'UserId':null},'include':[{'model':db[_0x247c('0x64')],'as':_0x247c('0x65')}]})[_0x247c('0x20')](handleEntityNotFound(_0x36c9f6,null))[_0x247c('0x20')](saveUpdates(_0x2d7b2d[_0x247c('0x57')],null))[_0x247c('0x20')](function(_0x47c2c0){if(_0x47c2c0){_0x3bf0fb['message']=_0x47c2c0[_0x247c('0x66')]({'plain':!![]});return db[_0x247c('0x67')][_0x247c('0x55')]({'where':{'id':_0x47c2c0[_0x247c('0x68')]}});}return null;})[_0x247c('0x20')](handleEntityNotFound(_0x36c9f6,null))[_0x247c('0x20')](function(_0x5281bf){if(_0x5281bf){return _0x5281bf[_0x247c('0x33')]({'UserId':_0x2d7b2d['body']['UserId'],'read1stAt':_['isNil'](_0x5281bf[_0x247c('0x69')])?moment()[_0x247c('0x5f')](_0x247c('0x60')):undefined});}return null;})['then'](function(_0x2c3d5e){if(_0x2c3d5e){_0x3bf0fb[_0x247c('0x6a')]=_0x2c3d5e[_0x247c('0x66')]({'plain':!![]});interaction_log[_0x247c('0x6b')](_0x247c('0x6c'),_0x2d7b2d[_0x247c('0x62')]['id'],_0x2d7b2d[_0x247c('0x62')][_0x247c('0x36')],_0x2d7b2d[_0x247c('0x62')][_0x247c('0x6d')],_0x3bf0fb[_0x247c('0x6a')]['id'],_0x2d7b2d[_0x247c('0x57')]?JSON[_0x247c('0x6e')](_0x2d7b2d[_0x247c('0x57')]):_0x247c('0x6f'));return respondWithRpcPromise(_0x247c('0x70'),_0x247c('0x71'),_0x3bf0fb);}return null;})[_0x247c('0x20')](function(_0x3d629b){if(_0x3d629b){if(_0x2d7b2d['body'][_0x247c('0x72')]){_0x3bf0fb['message'][_0x247c('0x73')]=util[_0x247c('0x5f')](_0x247c('0x74'),_0x2d7b2d['user'][_0x247c('0x36')]);_0x3bf0fb[_0x247c('0x26')][_0x247c('0x75')]=_0x3bf0fb[_0x247c('0x75')];_0x3bf0fb['message'][_0x247c('0x76')]=_0x247c('0x5b');return respondWithRpcPromise('EventManager',_0x247c('0x77'),{'event':'acceptmessage','message':_0x3bf0fb['message']},client9002)[_0x247c('0x20')](function(){return _0x3bf0fb;});}return _0x3bf0fb;}return null;})[_0x247c('0x20')](respondWithResult(_0x36c9f6,null))['catch'](handleError(_0x36c9f6,null));};var interaction_log=require(_0x247c('0x59'))(_0x247c('0x5a'));exports['reject']=function(_0x1ecd06,_0x44d222,_0x4df556){var _0x17ca3a={'agent':{},'channel':'openchannel'};if(_0x1ecd06[_0x247c('0x57')]['id']){delete _0x1ecd06['body']['id'];}_0x1ecd06[_0x247c('0x57')][_0x247c('0x61')]=_0x1ecd06[_0x247c('0x57')][_0x247c('0x61')]||_0x1ecd06[_0x247c('0x62')]['id'];_0x17ca3a[_0x247c('0x63')]['id']=_0x1ecd06[_0x247c('0x57')][_0x247c('0x61')];return db['OpenchannelMessage'][_0x247c('0x55')]({'where':{'id':_0x1ecd06[_0x247c('0x53')]['id'],'UserId':null}})[_0x247c('0x20')](handleEntityNotFound(_0x44d222,null))['then'](function(_0xdd4ce0){if(_0xdd4ce0){_0x17ca3a['message']=_0xdd4ce0[_0x247c('0x66')]({'plain':!![]});return db[_0x247c('0x67')][_0x247c('0x55')]({'where':{'id':_0xdd4ce0[_0x247c('0x68')]}});}return null;})[_0x247c('0x20')](handleEntityNotFound(_0x44d222,null))[_0x247c('0x20')](function(_0x4bbf1b){if(_0x4bbf1b){_0x17ca3a[_0x247c('0x6a')]=_0x4bbf1b[_0x247c('0x66')]({'plain':!![]});interaction_log[_0x247c('0x6b')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1ecd06[_0x247c('0x62')]['id'],_0x1ecd06[_0x247c('0x62')][_0x247c('0x36')],_0x1ecd06[_0x247c('0x62')][_0x247c('0x6d')],_0x17ca3a[_0x247c('0x6a')]['id'],_0x1ecd06[_0x247c('0x57')]?JSON[_0x247c('0x6e')](_0x1ecd06[_0x247c('0x57')]):_0x247c('0x6f'));return respondWithRpcPromise(_0x247c('0x78'),'rejectMessage',_0x17ca3a);}return null;})[_0x247c('0x20')](function(_0x4680f9){if(_0x4680f9){_0x4680f9[_0x247c('0x26')][_0x247c('0x73')]=util[_0x247c('0x5f')](_0x247c('0x74'),_0x1ecd06[_0x247c('0x62')]['name']);_0x4680f9['message'][_0x247c('0x75')]=_0x17ca3a[_0x247c('0x75')];_0x4680f9[_0x247c('0x26')][_0x247c('0x76')]=_0x247c('0x32');respondWithRpcPromise(_0x247c('0x77'),'EventManager',{'event':_0x247c('0x79'),'message':_0x4680f9[_0x247c('0x26')]},client9002);return _0x17ca3a;}return null;})[_0x247c('0x20')](respondWithResult(_0x44d222,null))[_0x247c('0x28')](handleError(_0x44d222,null));}; \ No newline at end of file +var _0x361e=['reject','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','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','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','end','status','json','offset','limit','set','apply','save','update','name','index','map','OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count','findAll','rows','show','params','includeAll','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','event'];(function(_0x3ed38b,_0x227392){var _0x206749=function(_0x652b87){while(--_0x652b87){_0x3ed38b['push'](_0x3ed38b['shift']());}};_0x206749(++_0x227392);}(_0x361e,0x1e9));var _0xe361=function(_0x83a5a2,_0x18d473){_0x83a5a2=_0x83a5a2-0x0;var _0x1eceb6=_0x361e[_0x83a5a2];return _0x1eceb6;};'use strict';var pdf=require(_0xe361('0x0'));var emlformat=require(_0xe361('0x1'));var rimraf=require(_0xe361('0x2'));var zipdir=require(_0xe361('0x3'));var jsonpatch=require(_0xe361('0x4'));var rp=require(_0xe361('0x5'));var moment=require(_0xe361('0x6'));var BPromise=require(_0xe361('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe361('0x8'));var sox=require(_0xe361('0x9'));var csv=require(_0xe361('0xa'));var ejs=require(_0xe361('0xb'));var fs=require('fs');var _=require(_0xe361('0xc'));var squel=require(_0xe361('0xd'));var crypto=require(_0xe361('0xe'));var jsforce=require(_0xe361('0xf'));var deskjs=require(_0xe361('0x10'));var toCsv=require(_0xe361('0xa'));var querystring=require(_0xe361('0x11'));var Papa=require(_0xe361('0x12'));var Redis=require('ioredis');var authService=require(_0xe361('0x13'));var qs=require(_0xe361('0x14'));var as=require(_0xe361('0x15'));var hardwareService=require(_0xe361('0x16'));var logger=require(_0xe361('0x17'))(_0xe361('0x18'));var utils=require(_0xe361('0x19'));var config=require(_0xe361('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe361('0x1b')]=_[_0xe361('0x1c')](config['redis'],{'host':_0xe361('0x1d'),'port':0x18eb});var socket=require(_0xe361('0x1e'))(new Redis(config[_0xe361('0x1b')]));require('./openchannelMessage.socket')[_0xe361('0x1f')](socket);var jayson=require(_0xe361('0x20'));var client=jayson[_0xe361('0x21')][_0xe361('0x22')]({'port':0x232c});var client9002=jayson[_0xe361('0x21')][_0xe361('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x596865,_0x270976,_0x1856dd,_0x4cb449){return new BPromise(function(_0x33de35,_0x1ca954){var _0x489389=_0x4cb449||client;return _0x489389['request'](_0x596865,_0x1856dd)[_0xe361('0x23')](function(_0x4322b6){logger['info'](_0xe361('0x24'),_0x270976,'request\x20sent');logger['debug'](_0xe361('0x25'),_0x270976,_0xe361('0x26'),JSON['stringify'](_0x4322b6));if(_0x4322b6[_0xe361('0x27')]){if(_0x4322b6[_0xe361('0x27')][_0xe361('0x28')]===0x1f4){logger[_0xe361('0x27')](_0xe361('0x24'),_0x270976,_0x4322b6['error'][_0xe361('0x29')]);return _0x1ca954(_0x4322b6['error']['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x270976,_0x4322b6[_0xe361('0x27')]['message']);return _0x33de35(_0x4322b6['error'][_0xe361('0x29')]);}else{logger[_0xe361('0x2a')](_0xe361('0x24'),_0x270976,_0xe361('0x26'));_0x33de35(_0x4322b6[_0xe361('0x2b')][_0xe361('0x29')]);}})[_0xe361('0x2c')](function(_0x4a91db){logger[_0xe361('0x27')](_0xe361('0x24'),_0x270976,_0x4a91db);_0x1ca954(_0x4a91db);});});}function respondWithStatusCode(_0x38823f,_0x11a634){_0x11a634=_0x11a634||0xcc;return function(_0x2a2126){if(_0x2a2126){return _0x38823f[_0xe361('0x2d')](_0x11a634);}return _0x38823f['status'](_0x11a634)[_0xe361('0x2e')]();};}function respondWithResult(_0x18abc8,_0x5498a3){_0x5498a3=_0x5498a3||0xc8;return function(_0x5c9ec3){if(_0x5c9ec3){return _0x18abc8[_0xe361('0x2f')](_0x5498a3)[_0xe361('0x30')](_0x5c9ec3);}};}function respondWithFilteredResult(_0x45b87b,_0x39bee9){return function(_0x430f30){if(_0x430f30){var _0x5673d5=_0x430f30['count'],_0x1515b3=_0x39bee9[_0xe361('0x31')],_0x6aa601=_0x39bee9[_0xe361('0x31')]+_0x39bee9[_0xe361('0x32')],_0x3b4840;if(_0x6aa601>=_0x5673d5){_0x6aa601=_0x5673d5;_0x3b4840=0xc8;}else{_0x3b4840=0xce;}_0x45b87b['status'](_0x3b4840);return _0x45b87b[_0xe361('0x33')]('Content-Range',_0x1515b3+'-'+_0x6aa601+'/'+_0x5673d5)[_0xe361('0x30')](_0x430f30);}return null;};}function patchUpdates(_0x1aa288){return function(_0x576e5c){try{jsonpatch[_0xe361('0x34')](_0x576e5c,_0x1aa288,!![]);}catch(_0x57b0b8){return BPromise['reject'](_0x57b0b8);}return _0x576e5c[_0xe361('0x35')]();};}function saveUpdates(_0x546aa9,_0x144a6d){return function(_0x45d1ae){if(_0x45d1ae){return _0x45d1ae[_0xe361('0x36')](_0x546aa9)[_0xe361('0x23')](function(_0x9a83a2){return _0x9a83a2;});}return null;};}function removeEntity(_0x4f3b81,_0x1ba7b4){return function(_0x3bb2a1){if(_0x3bb2a1){return _0x3bb2a1['destroy']()[_0xe361('0x23')](function(){_0x4f3b81[_0xe361('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b97c9,_0x1ab020){return function(_0x3ddd92){if(!_0x3ddd92){_0x2b97c9[_0xe361('0x2d')](0x194);}return _0x3ddd92;};}function handleError(_0x4101c3,_0x2b2978){_0x2b2978=_0x2b2978||0x1f4;return function(_0x274928){logger[_0xe361('0x27')](_0x274928['stack']);if(_0x274928[_0xe361('0x37')]){delete _0x274928[_0xe361('0x37')];}_0x4101c3[_0xe361('0x2f')](_0x2b2978)['send'](_0x274928);};}exports[_0xe361('0x38')]=function(_0x3456b5,_0x46762b){var _0x9154de={},_0x25cadc={},_0x3a93e9={'count':0x0,'rows':[]};var _0x1e1dec=_[_0xe361('0x39')](db[_0xe361('0x3a')][_0xe361('0x3b')],function(_0x5d2dc3){return{'name':_0x5d2dc3['fieldName'],'type':_0x5d2dc3[_0xe361('0x3c')][_0xe361('0x3d')]};});_0x25cadc[_0xe361('0x3e')]=_['map'](_0x1e1dec,_0xe361('0x37'));_0x25cadc[_0xe361('0x3f')]=_[_0xe361('0x40')](_0x3456b5[_0xe361('0x3f')]);_0x25cadc[_0xe361('0x41')]=_[_0xe361('0x42')](_0x25cadc[_0xe361('0x3e')],_0x25cadc[_0xe361('0x3f')]);_0x9154de[_0xe361('0x43')]=_[_0xe361('0x42')](_0x25cadc[_0xe361('0x3e')],qs[_0xe361('0x44')](_0x3456b5[_0xe361('0x3f')]['fields']));_0x9154de['attributes']=_0x9154de[_0xe361('0x43')][_0xe361('0x45')]?_0x9154de['attributes']:_0x25cadc[_0xe361('0x3e')];if(!_0x3456b5[_0xe361('0x3f')][_0xe361('0x46')](_0xe361('0x47'))){_0x9154de['limit']=qs['limit'](_0x3456b5['query'][_0xe361('0x32')]);_0x9154de[_0xe361('0x31')]=qs[_0xe361('0x31')](_0x3456b5[_0xe361('0x3f')][_0xe361('0x31')]);}_0x9154de[_0xe361('0x48')]=qs[_0xe361('0x49')](_0x3456b5[_0xe361('0x3f')]['sort']);_0x9154de['where']=qs[_0xe361('0x41')](_['pick'](_0x3456b5[_0xe361('0x3f')],_0x25cadc['filters']),_0x1e1dec);if(_0x3456b5[_0xe361('0x3f')][_0xe361('0x4a')]){_0x9154de[_0xe361('0x4b')]=_[_0xe361('0x4c')](_0x9154de['where'],{'$or':_[_0xe361('0x39')](_0x1e1dec,function(_0x44c072){if(_0x44c072[_0xe361('0x3c')]!==_0xe361('0x4d')){var _0x27feb3={};_0x27feb3[_0x44c072[_0xe361('0x37')]]={'$like':'%'+_0x3456b5[_0xe361('0x3f')][_0xe361('0x4a')]+'%'};return _0x27feb3;}})});}_0x9154de=_[_0xe361('0x4c')]({},_0x9154de,_0x3456b5[_0xe361('0x4e')]);var _0xed32cf={'where':_0x9154de[_0xe361('0x4b')]};return db[_0xe361('0x3a')][_0xe361('0x4f')](_0xed32cf)['then'](function(_0x1c838f){_0x3a93e9[_0xe361('0x4f')]=_0x1c838f;if(_0x3456b5[_0xe361('0x3f')]['includeAll']){_0x9154de['include']=[{'all':!![]}];}return db[_0xe361('0x3a')][_0xe361('0x50')](_0x9154de);})[_0xe361('0x23')](function(_0x45738e){_0x3a93e9[_0xe361('0x51')]=_0x45738e;return _0x3a93e9;})[_0xe361('0x23')](respondWithFilteredResult(_0x46762b,_0x9154de))['catch'](handleError(_0x46762b,null));};exports[_0xe361('0x52')]=function(_0x110808,_0x4eecfc){var _0xcddf09={'raw':!![],'where':{'id':_0x110808[_0xe361('0x53')]['id']}},_0x34ec2e={};_0x34ec2e[_0xe361('0x3e')]=_[_0xe361('0x40')](db[_0xe361('0x3a')][_0xe361('0x3b')]);_0x34ec2e[_0xe361('0x3f')]=_[_0xe361('0x40')](_0x110808[_0xe361('0x3f')]);_0x34ec2e['filters']=_['intersection'](_0x34ec2e['model'],_0x34ec2e[_0xe361('0x3f')]);_0xcddf09[_0xe361('0x43')]=_['intersection'](_0x34ec2e[_0xe361('0x3e')],qs[_0xe361('0x44')](_0x110808[_0xe361('0x3f')][_0xe361('0x44')]));_0xcddf09[_0xe361('0x43')]=_0xcddf09['attributes'][_0xe361('0x45')]?_0xcddf09[_0xe361('0x43')]:_0x34ec2e['model'];if(_0x110808['query'][_0xe361('0x54')]){_0xcddf09['include']=[{'all':!![]}];}_0xcddf09=_[_0xe361('0x4c')]({},_0xcddf09,_0x110808['options']);return db[_0xe361('0x3a')][_0xe361('0x55')](_0xcddf09)[_0xe361('0x23')](handleEntityNotFound(_0x4eecfc,null))[_0xe361('0x23')](respondWithResult(_0x4eecfc,null))[_0xe361('0x2c')](handleError(_0x4eecfc,null));};exports[_0xe361('0x56')]=function(_0x288132,_0xbdbc0){return db[_0xe361('0x3a')]['create'](_0x288132[_0xe361('0x57')],{})[_0xe361('0x23')](respondWithResult(_0xbdbc0,0xc9))[_0xe361('0x2c')](handleError(_0xbdbc0,null));};exports[_0xe361('0x36')]=function(_0x6c2bf4,_0x4a0e50){if(_0x6c2bf4[_0xe361('0x57')]['id']){delete _0x6c2bf4[_0xe361('0x57')]['id'];}return db[_0xe361('0x3a')]['find']({'where':{'id':_0x6c2bf4[_0xe361('0x53')]['id']}})[_0xe361('0x23')](handleEntityNotFound(_0x4a0e50,null))[_0xe361('0x23')](saveUpdates(_0x6c2bf4[_0xe361('0x57')],null))[_0xe361('0x23')](respondWithResult(_0x4a0e50,null))[_0xe361('0x2c')](handleError(_0x4a0e50,null));};exports['destroy']=function(_0x239e84,_0x2994c6){return db['OpenchannelMessage']['find']({'where':{'id':_0x239e84[_0xe361('0x53')]['id']}})[_0xe361('0x23')](handleEntityNotFound(_0x2994c6,null))[_0xe361('0x23')](removeEntity(_0x2994c6,null))['catch'](handleError(_0x2994c6,null));};exports[_0xe361('0x58')]=function(_0x2658a9,_0x42f32e){return db[_0xe361('0x3a')]['describe']()[_0xe361('0x23')](respondWithResult(_0x42f32e,null))[_0xe361('0x2c')](handleError(_0x42f32e,null));};var interaction_log=require(_0xe361('0x17'))(_0xe361('0x59'));exports[_0xe361('0x5a')]=function(_0x48e6d4,_0x3e2945,_0x434312){var _0x33a9a9={'agent':{},'channel':_0xe361('0x5b')};if(_0x48e6d4[_0xe361('0x57')]['id']){delete _0x48e6d4[_0xe361('0x57')]['id'];}_0x48e6d4[_0xe361('0x57')][_0xe361('0x5c')]=!![];_0x48e6d4['body'][_0xe361('0x5d')]=moment()[_0xe361('0x5e')](_0xe361('0x5f'));_0x48e6d4[_0xe361('0x57')][_0xe361('0x60')]=_0x48e6d4[_0xe361('0x57')][_0xe361('0x60')]||_0x48e6d4[_0xe361('0x61')]['id'];_0x33a9a9[_0xe361('0x62')]['id']=_0x48e6d4[_0xe361('0x57')][_0xe361('0x60')];return db[_0xe361('0x3a')][_0xe361('0x55')]({'where':{'id':_0x48e6d4[_0xe361('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xe361('0x63')],'as':_0xe361('0x64')}]})[_0xe361('0x23')](handleEntityNotFound(_0x3e2945,null))[_0xe361('0x23')](saveUpdates(_0x48e6d4[_0xe361('0x57')],null))['then'](function(_0x584219){if(_0x584219){_0x33a9a9[_0xe361('0x29')]=_0x584219[_0xe361('0x65')]({'plain':!![]});return db[_0xe361('0x66')]['find']({'where':{'id':_0x584219[_0xe361('0x67')]}});}return null;})[_0xe361('0x23')](handleEntityNotFound(_0x3e2945,null))[_0xe361('0x23')](function(_0x56da37){if(_0x56da37){return _0x56da37[_0xe361('0x36')]({'UserId':_0x48e6d4[_0xe361('0x57')]['UserId'],'read1stAt':_[_0xe361('0x68')](_0x56da37[_0xe361('0x69')])?moment()[_0xe361('0x5e')](_0xe361('0x5f')):undefined});}return null;})[_0xe361('0x23')](function(_0x487d37){if(_0x487d37){_0x33a9a9[_0xe361('0x6a')]=_0x487d37[_0xe361('0x65')]({'plain':!![]});interaction_log['info'](_0xe361('0x6b'),_0x48e6d4['user']['id'],_0x48e6d4[_0xe361('0x61')][_0xe361('0x37')],_0x48e6d4[_0xe361('0x61')][_0xe361('0x6c')],_0x33a9a9['interaction']['id'],_0x48e6d4['body']?JSON[_0xe361('0x6d')](_0x48e6d4['body']):_0xe361('0x6e'));return respondWithRpcPromise(_0xe361('0x6f'),_0xe361('0x70'),_0x33a9a9);}return null;})['then'](function(_0x3c6453){if(_0x3c6453){if(_0x48e6d4[_0xe361('0x57')]['manual']){_0x33a9a9['message'][_0xe361('0x71')]=util['format'](_0xe361('0x72'),_0x48e6d4[_0xe361('0x61')][_0xe361('0x37')]);_0x33a9a9[_0xe361('0x29')][_0xe361('0x73')]=_0x33a9a9[_0xe361('0x73')];_0x33a9a9[_0xe361('0x29')]['event']=_0xe361('0x5a');return respondWithRpcPromise(_0xe361('0x74'),_0xe361('0x74'),{'event':_0xe361('0x75'),'message':_0x33a9a9[_0xe361('0x29')]},client9002)['then'](function(){return _0x33a9a9;});}return _0x33a9a9;}return null;})[_0xe361('0x23')](respondWithResult(_0x3e2945,null))[_0xe361('0x2c')](handleError(_0x3e2945,null));};var interaction_log=require(_0xe361('0x17'))('openchannel-interactions');exports['reject']=function(_0x424f43,_0x2987ef,_0x5dfe4e){var _0xe3fbd9={'agent':{},'channel':'openchannel'};if(_0x424f43[_0xe361('0x57')]['id']){delete _0x424f43[_0xe361('0x57')]['id'];}_0x424f43[_0xe361('0x57')][_0xe361('0x60')]=_0x424f43[_0xe361('0x57')][_0xe361('0x60')]||_0x424f43['user']['id'];_0xe3fbd9['agent']['id']=_0x424f43[_0xe361('0x57')][_0xe361('0x60')];return db['OpenchannelMessage'][_0xe361('0x55')]({'where':{'id':_0x424f43[_0xe361('0x53')]['id'],'UserId':null}})[_0xe361('0x23')](handleEntityNotFound(_0x2987ef,null))[_0xe361('0x23')](function(_0x30ff9e){if(_0x30ff9e){_0xe3fbd9[_0xe361('0x29')]=_0x30ff9e['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xe361('0x55')]({'where':{'id':_0x30ff9e[_0xe361('0x67')]}});}return null;})[_0xe361('0x23')](handleEntityNotFound(_0x2987ef,null))[_0xe361('0x23')](function(_0x2d5b3e){if(_0x2d5b3e){_0xe3fbd9[_0xe361('0x6a')]=_0x2d5b3e[_0xe361('0x65')]({'plain':!![]});interaction_log[_0xe361('0x2a')](_0xe361('0x76'),_0x424f43[_0xe361('0x61')]['id'],_0x424f43[_0xe361('0x61')][_0xe361('0x37')],_0x424f43[_0xe361('0x61')][_0xe361('0x6c')],_0xe3fbd9['interaction']['id'],_0x424f43['body']?JSON[_0xe361('0x6d')](_0x424f43[_0xe361('0x57')]):_0xe361('0x6e'));return respondWithRpcPromise(_0xe361('0x77'),'rejectMessage',_0xe3fbd9);}return null;})[_0xe361('0x23')](function(_0x39db0b){if(_0x39db0b){_0x39db0b[_0xe361('0x29')][_0xe361('0x71')]=util['format'](_0xe361('0x72'),_0x424f43[_0xe361('0x61')][_0xe361('0x37')]);_0x39db0b[_0xe361('0x29')]['channel']=_0xe3fbd9['channel'];_0x39db0b[_0xe361('0x29')][_0xe361('0x78')]=_0xe361('0x79');respondWithRpcPromise(_0xe361('0x74'),_0xe361('0x74'),{'event':'rejectmessage','message':_0x39db0b['message']},client9002);return _0xe3fbd9;}return null;})['then'](respondWithResult(_0x2987ef,null))[_0xe361('0x2c')](handleError(_0x2987ef,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 16d7837..7dc9c39 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 _0xdbe6=['hasOwnProperty','events','../../mysqldb','OpenchannelMessage','save','update','remove','emit'];(function(_0x327e23,_0x22dd8c){var _0x4e9b6d=function(_0x4548ac){while(--_0x4548ac){_0x327e23['push'](_0x327e23['shift']());}};_0x4e9b6d(++_0x22dd8c);}(_0xdbe6,0xd9));var _0x6dbe=function(_0x28605,_0x5902ee){_0x28605=_0x28605-0x0;var _0x805073=_0xdbe6[_0x28605];return _0x805073;};'use strict';var EventEmitter=require(_0x6dbe('0x0'));var OpenchannelMessage=require(_0x6dbe('0x1'))['db'][_0x6dbe('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6dbe('0x3'),'afterUpdate':_0x6dbe('0x4'),'afterDestroy':_0x6dbe('0x5')};function emitEvent(_0xbba766){return function(_0x52e0b9,_0x5dea19,_0x5b27b4){OpenchannelMessageEvents[_0x6dbe('0x6')](_0xbba766+':'+_0x52e0b9['id'],_0x52e0b9);OpenchannelMessageEvents['emit'](_0xbba766,_0x52e0b9);_0x5b27b4(null);};}for(var e in events){if(events[_0x6dbe('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x475a=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x472172,_0x5e7478){var _0x758797=function(_0x13601a){while(--_0x13601a){_0x472172['push'](_0x472172['shift']());}};_0x758797(++_0x5e7478);}(_0x475a,0x1ef));var _0xa475=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x475a[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xa475('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa475('0x1')](0x0);var events={'afterCreate':_0xa475('0x2'),'afterUpdate':_0xa475('0x3'),'afterDestroy':_0xa475('0x4')};function emitEvent(_0xf63216){return function(_0x1e1b17,_0x1d425f,_0x500b7){OpenchannelMessageEvents[_0xa475('0x5')](_0xf63216+':'+_0x1e1b17['id'],_0x1e1b17);OpenchannelMessageEvents[_0xa475('0x5')](_0xf63216,_0x1e1b17);_0x500b7(null);};}for(var e in events){if(events[_0xa475('0x6')](e)){var event=events[e];OpenchannelMessage[_0xa475('0x7')](e,emitEvent(event));}}module[_0xa475('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 692636c..f419653 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 _0xbbc8=['error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','GET','threadId','catch','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','then','update'];(function(_0x3cb1be,_0x25e99f){var _0x42da74=function(_0x3d9b49){while(--_0x3d9b49){_0x3cb1be['push'](_0x3cb1be['shift']());}};_0x42da74(++_0x25e99f);}(_0xbbc8,0xe9));var _0x8bbc=function(_0x271b83,_0x1c9675){_0x271b83=_0x271b83-0x0;var _0x260d06=_0xbbc8[_0x271b83];return _0x260d06;};'use strict';var _=require(_0x8bbc('0x0'));var util=require('util');var logger=require(_0x8bbc('0x1'))(_0x8bbc('0x2'));var moment=require(_0x8bbc('0x3'));var BPromise=require(_0x8bbc('0x4'));var rp=require(_0x8bbc('0x5'));var fs=require('fs');var path=require(_0x8bbc('0x6'));var rimraf=require(_0x8bbc('0x7'));var config=require(_0x8bbc('0x8'));var attributes=require(_0x8bbc('0x9'));module[_0x8bbc('0xa')]=function(_0x5249b3,_0x16eb43){return _0x5249b3[_0x8bbc('0xb')]('OpenchannelMessage',attributes,{'tableName':_0x8bbc('0xc'),'paranoid':![],'indexes':[{'name':_0x8bbc('0xd'),'fields':[_0x8bbc('0xe')],'type':_0x8bbc('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c09c5,_0x122055,_0x4e4ee7){var _0x42588b=_0x5249b3[_0x8bbc('0x10')];var _0x10e06b=_0x3c09c5[_0x8bbc('0x11')]({'plain':!![]});if(_0x10e06b[_0x8bbc('0x12')][_0x8bbc('0x13')]()==='in'||_0x10e06b[_0x8bbc('0x12')][_0x8bbc('0x13')]()===_0x8bbc('0x14')&&!_0x10e06b[_0x8bbc('0x15')]&&!_[_0x8bbc('0x16')](_0x10e06b[_0x8bbc('0x17')])){_0x42588b[_0x8bbc('0x18')]['findOne']({'where':{'id':_0x10e06b['OpenchannelInteractionId']}})[_0x8bbc('0x19')](function(_0x2c198a){if(_0x2c198a){_0x2c198a[_0x8bbc('0x1a')]({'lastMsgAt':_0x10e06b['createdAt'],'lastMsgDirection':_0x10e06b[_0x8bbc('0x12')][_0x8bbc('0x13')]()});}})['catch'](function(_0x262c6b){console[_0x8bbc('0x1b')](_0x262c6b);});}if(_0x10e06b[_0x8bbc('0x12')]===_0x8bbc('0x14')&&!_0x10e06b[_0x8bbc('0x15')]){var _0x4f736f;_0x42588b[_0x8bbc('0x1c')][_0x8bbc('0x1d')]()[_0x8bbc('0x19')](function(_0x5ded06){return _0x42588b[_0x8bbc('0x1e')][_0x8bbc('0x1f')]({'where':{'id':_0x10e06b[_0x8bbc('0x20')]},'include':[{'model':_0x42588b[_0x8bbc('0x18')],'as':_0x8bbc('0x21'),'where':{'id':_0x10e06b[_0x8bbc('0x22')]},'limit':0x1,'include':[{'model':_0x42588b[_0x8bbc('0x1c')],'as':_0x8bbc('0x23'),'attributes':_[_0x8bbc('0x24')](_0x5ded06)}]}]});})['then'](function(_0x4c2489){_0x4f736f=_0x4c2489[_0x8bbc('0x11')]({'plain':!![]});if(_0x4f736f&&_0x4f736f['replyUri']){logger[_0x8bbc('0x25')](_0x8bbc('0x26'),_0x8bbc('0x27'),util[_0x8bbc('0x28')](_0x8bbc('0x29'),_0x10e06b['id'],_0x4f736f[_0x8bbc('0x2a')]));if(_0x4f736f['Interactions']&&_0x4f736f[_0x8bbc('0x21')][_0x8bbc('0x2b')]){_0x10e06b[_0x8bbc('0x2c')]=_[_0x8bbc('0x2d')](_0x4f736f[_0x8bbc('0x21')][0x0],'Contact');_0x10e06b[_0x8bbc('0x23')]=_0x4f736f[_0x8bbc('0x21')][0x0][_0x8bbc('0x23')];}var _0x122055={'method':_0x8bbc('0x2e'),'uri':encodeURI(_0x4f736f[_0x8bbc('0x2a')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x122055['method']){case _0x8bbc('0x2f'):_0x122055['qs']=_0x10e06b;break;case'POST':_0x122055[_0x8bbc('0xe')]=_0x10e06b;break;}return rp(_0x122055)[_0x8bbc('0x19')](function(_0x1a03ee){logger[_0x8bbc('0x25')](_0x8bbc('0x26'),_0x8bbc('0x27'),util[_0x8bbc('0x28')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x10e06b['id'],_0x4f736f[_0x8bbc('0x2a')]));if(_0x1a03ee[_0x8bbc('0xe')]['threadId']&&_0x1a03ee[_0x8bbc('0xe')]['threadId']!=_0x10e06b[_0x8bbc('0x2c')]['threadId']){return _0x42588b[_0x8bbc('0x18')][_0x8bbc('0x1a')]({'threadId':_0x1a03ee[_0x8bbc('0xe')][_0x8bbc('0x30')]},{'logging':!![],'where':{'id':_0x10e06b[_0x8bbc('0x2c')]['id']}});}else{return;}})[_0x8bbc('0x19')](function(){return _0x3c09c5[_0x8bbc('0x1a')]({'read':!![]});})[_0x8bbc('0x31')](function(_0x4acce6){logger[_0x8bbc('0x1b')](_0x8bbc('0x26'),_0x8bbc('0x27'),util['inspect'](_0x4acce6,{'showHidden':![],'depth':null}));_0x4e4ee7();});}else{_0x4e4ee7();}})[_0x8bbc('0x32')](function(){_0x4e4ee7();});}else{_0x4e4ee7();}}},'charset':'utf8mb4','collate':_0x8bbc('0x33')});}; \ No newline at end of file +var _0xccd1=['replyUri','length','Interaction','omit','POST','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','then','createdAt','error','describe','find','Interactions','OpenchannelInteractionId','CmContact','Contact','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x458589,_0x1cf421){var _0x48686e=function(_0x577061){while(--_0x577061){_0x458589['push'](_0x458589['shift']());}};_0x48686e(++_0x1cf421);}(_0xccd1,0xd2));var _0x1ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1ccd('0x0'));var util=require(_0x1ccd('0x1'));var logger=require(_0x1ccd('0x2'))(_0x1ccd('0x3'));var moment=require(_0x1ccd('0x4'));var BPromise=require('bluebird');var rp=require(_0x1ccd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ccd('0x6'));var config=require(_0x1ccd('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x1ccd('0x8')]=function(_0x37a4c3,_0x2d2df0){return _0x37a4c3[_0x1ccd('0x9')](_0x1ccd('0xa'),attributes,{'tableName':_0x1ccd('0xb'),'paranoid':![],'indexes':[{'name':_0x1ccd('0xc'),'fields':[_0x1ccd('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x54aa45,_0x5d564f,_0x3e2e47){var _0x67ca16=_0x37a4c3[_0x1ccd('0xe')];var _0x249214=_0x54aa45['get']({'plain':!![]});if(_0x249214[_0x1ccd('0xf')][_0x1ccd('0x10')]()==='in'||_0x249214[_0x1ccd('0xf')]['toLowerCase']()===_0x1ccd('0x11')&&!_0x249214[_0x1ccd('0x12')]&&!_[_0x1ccd('0x13')](_0x249214['UserId'])){_0x67ca16[_0x1ccd('0x14')]['findOne']({'where':{'id':_0x249214['OpenchannelInteractionId']}})[_0x1ccd('0x15')](function(_0x30f68c){if(_0x30f68c){_0x30f68c['update']({'lastMsgAt':_0x249214[_0x1ccd('0x16')],'lastMsgDirection':_0x249214[_0x1ccd('0xf')]['toLowerCase']()});}})['catch'](function(_0x83bc5b){console[_0x1ccd('0x17')](_0x83bc5b);});}if(_0x249214['direction']===_0x1ccd('0x11')&&!_0x249214['secret']){var _0x50aa0b;_0x67ca16['CmContact'][_0x1ccd('0x18')]()[_0x1ccd('0x15')](function(_0xc8ac5){return _0x67ca16['OpenchannelAccount'][_0x1ccd('0x19')]({'where':{'id':_0x249214['OpenchannelAccountId']},'include':[{'model':_0x67ca16['OpenchannelInteraction'],'as':_0x1ccd('0x1a'),'where':{'id':_0x249214[_0x1ccd('0x1b')]},'limit':0x1,'include':[{'model':_0x67ca16[_0x1ccd('0x1c')],'as':_0x1ccd('0x1d'),'attributes':_['keys'](_0xc8ac5)}]}]});})[_0x1ccd('0x15')](function(_0xe5970b){_0x50aa0b=_0xe5970b['get']({'plain':!![]});if(_0x50aa0b&&_0x50aa0b['replyUri']){logger[_0x1ccd('0x1e')](_0x1ccd('0x1f'),_0x1ccd('0x20'),util[_0x1ccd('0x21')](_0x1ccd('0x22'),_0x249214['id'],_0x50aa0b[_0x1ccd('0x23')]));if(_0x50aa0b[_0x1ccd('0x1a')]&&_0x50aa0b[_0x1ccd('0x1a')][_0x1ccd('0x24')]){_0x249214[_0x1ccd('0x25')]=_[_0x1ccd('0x26')](_0x50aa0b[_0x1ccd('0x1a')][0x0],_0x1ccd('0x1d'));_0x249214[_0x1ccd('0x1d')]=_0x50aa0b[_0x1ccd('0x1a')][0x0][_0x1ccd('0x1d')];}var _0x5d564f={'method':_0x1ccd('0x27'),'uri':encodeURI(_0x50aa0b[_0x1ccd('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5d564f['method']){case _0x1ccd('0x28'):_0x5d564f['qs']=_0x249214;break;case _0x1ccd('0x27'):_0x5d564f[_0x1ccd('0xd')]=_0x249214;break;}return rp(_0x5d564f)['then'](function(_0x50dbba){logger[_0x1ccd('0x1e')](_0x1ccd('0x1f'),'afterCreate',util[_0x1ccd('0x21')](_0x1ccd('0x29'),_0x249214['id'],_0x50aa0b[_0x1ccd('0x23')]));if(_0x50dbba[_0x1ccd('0xd')][_0x1ccd('0x2a')]&&_0x50dbba['body'][_0x1ccd('0x2a')]!=_0x249214[_0x1ccd('0x25')]['threadId']){return _0x67ca16[_0x1ccd('0x14')][_0x1ccd('0x2b')]({'threadId':_0x50dbba['body']['threadId']},{'logging':!![],'where':{'id':_0x249214[_0x1ccd('0x25')]['id']}});}else{return;}})['then'](function(){return _0x54aa45[_0x1ccd('0x2b')]({'read':!![]});})[_0x1ccd('0x2c')](function(_0x4f275b){logger['error'](_0x1ccd('0x1f'),_0x1ccd('0x20'),util[_0x1ccd('0x2d')](_0x4f275b,{'showHidden':![],'depth':null}));_0x3e2e47();});}else{_0x3e2e47();}})[_0x1ccd('0x2e')](function(){_0x3e2e47();});}else{_0x3e2e47();}}},'charset':_0x1ccd('0x2f'),'collate':_0x1ccd('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 65f2d65..4e9c975 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 _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(_0x21c3a6,_0x381e28){var _0x2ce30e=function(_0x457145){while(--_0x457145){_0x21c3a6['push'](_0x21c3a6['shift']());}};_0x2ce30e(++_0x381e28);}(_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});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 +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(_0x252d53,_0x31204a){var _0x410c8b=function(_0x45e960){while(--_0x45e960){_0x252d53['push'](_0x252d53['shift']());}};_0x410c8b(++_0x31204a);}(_0xb10b,0x12a));var _0xbb10=function(_0x20ea89,_0x1bfce6){_0x20ea89=_0x20ea89-0x0;var _0x1f06a8=_0xb10b[_0x20ea89];return _0x1f06a8;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index c941e79..a130c49 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 _0x70e0=['openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x4ce62a,_0x5b5881){var _0x4b15b7=function(_0x5067ff){while(--_0x5067ff){_0x4ce62a['push'](_0x4ce62a['shift']());}};_0x4b15b7(++_0x5b5881);}(_0x70e0,0x17b));var _0x070e=function(_0x9b3888,_0x2df235){_0x9b3888=_0x9b3888-0x0;var _0x4be100=_0x70e0[_0x9b3888];return _0x4be100;};'use strict';var OpenchannelMessageEvents=require(_0x070e('0x0'));var events=[_0x070e('0x1'),_0x070e('0x2'),'update'];function createListener(_0x579b83,_0x16e651){return function(_0xee173){_0x16e651[_0x070e('0x3')](_0x579b83,_0xee173);};}function removeListener(_0x2593e5,_0x5c90fc){return function(){OpenchannelMessageEvents[_0x070e('0x4')](_0x2593e5,_0x5c90fc);};}exports['register']=function(_0x46fe68){for(var _0x4b041d=0x0,_0x56e420=events['length'];_0x4b041d<_0x56e420;_0x4b041d++){var _0x35ab0c=events[_0x4b041d];var _0x1e11f0=createListener(_0x070e('0x5')+_0x35ab0c,_0x46fe68);OpenchannelMessageEvents['on'](_0x35ab0c,_0x1e11f0);}}; \ No newline at end of file +var _0xac4a=['save','remove','update','removeListener','./openchannelMessage.events'];(function(_0x27b423,_0x312583){var _0x5c11b8=function(_0x22a3b9){while(--_0x22a3b9){_0x27b423['push'](_0x27b423['shift']());}};_0x5c11b8(++_0x312583);}(_0xac4a,0x13f));var _0xaac4=function(_0x510313,_0x563a45){_0x510313=_0x510313-0x0;var _0x3c1d97=_0xac4a[_0x510313];return _0x3c1d97;};'use strict';var OpenchannelMessageEvents=require(_0xaac4('0x0'));var events=[_0xaac4('0x1'),_0xaac4('0x2'),_0xaac4('0x3')];function createListener(_0x38f4f4,_0x1dc251){return function(_0x5aeb7d){_0x1dc251['emit'](_0x38f4f4,_0x5aeb7d);};}function removeListener(_0x2af0f6,_0x2a5762){return function(){OpenchannelMessageEvents[_0xaac4('0x4')](_0x2af0f6,_0x2a5762);};}exports['register']=function(_0x1283a5){for(var _0x53d03a=0x0,_0x1cdfc5=events['length'];_0x53d03a<_0x1cdfc5;_0x53d03a++){var _0x1e4283=events[_0x53d03a];var _0x27354c=createListener('openchannelMessage:'+_0x1e4283,_0x1283a5);OpenchannelMessageEvents['on'](_0x1e4283,_0x27354c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 5135afe..89ffc94 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 _0xb7a7=['../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x4ba380,_0x259bee){var _0x4b111b=function(_0x2bf227){while(--_0x2bf227){_0x4ba380['push'](_0x4ba380['shift']());}};_0x4b111b(++_0x259bee);}(_0xb7a7,0x6e));var _0x7b7a=function(_0x1809d4,_0x7c11b1){_0x1809d4=_0x1809d4-0x0;var _0x55f984=_0xb7a7[_0x1809d4];return _0x55f984;};'use strict';var multer=require(_0x7b7a('0x0'));var util=require(_0x7b7a('0x1'));var path=require(_0x7b7a('0x2'));var timeout=require(_0x7b7a('0x3'));var express=require(_0x7b7a('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7b7a('0x5'));var config=require(_0x7b7a('0x6'));var controller=require(_0x7b7a('0x7'));router['get']('/',auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x9')]);router[_0x7b7a('0xa')](_0x7b7a('0xb'),auth[_0x7b7a('0x8')](),controller[_0x7b7a('0xc')]);router[_0x7b7a('0xa')](_0x7b7a('0xd'),auth[_0x7b7a('0x8')](),controller['show']);router[_0x7b7a('0xa')]('/:id/members',auth[_0x7b7a('0x8')](),controller[_0x7b7a('0xe')]);router[_0x7b7a('0xa')](_0x7b7a('0xf'),auth[_0x7b7a('0x8')](),controller['getTeams']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x7b7a('0x10')]);router[_0x7b7a('0x11')]('/',auth['isAuthenticated'](),controller[_0x7b7a('0x12')]);router[_0x7b7a('0x11')](_0x7b7a('0xf'),auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x13')]);router[_0x7b7a('0x11')](_0x7b7a('0x14'),auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x15')]);router[_0x7b7a('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7b7a('0x17')]);router[_0x7b7a('0x18')](_0x7b7a('0xd'),auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x19')]);router['delete'](_0x7b7a('0xf'),auth['isAuthenticated'](),controller[_0x7b7a('0x1a')]);router[_0x7b7a('0x18')](_0x7b7a('0x14'),auth[_0x7b7a('0x8')](),controller[_0x7b7a('0x1b')]);module[_0x7b7a('0x1c')]=router; \ No newline at end of file +var _0xaf1b=['removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','/:id','update','delete','destroy'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x450f5e,_0x18b22b){_0x450f5e=_0x450f5e-0x0;var _0x48850d=_0xaf1b[_0x450f5e];return _0x48850d;};'use strict';var multer=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var path=require(_0xbaf1('0x2'));var timeout=require(_0xbaf1('0x3'));var express=require(_0xbaf1('0x4'));var router=express[_0xbaf1('0x5')]();var auth=require(_0xbaf1('0x6'));var interaction=require(_0xbaf1('0x7'));var config=require(_0xbaf1('0x8'));var controller=require(_0xbaf1('0x9'));router[_0xbaf1('0xa')]('/',auth[_0xbaf1('0xb')](),controller[_0xbaf1('0xc')]);router[_0xbaf1('0xa')]('/describe',auth[_0xbaf1('0xb')](),controller['describe']);router[_0xbaf1('0xa')]('/:id',auth[_0xbaf1('0xb')](),controller[_0xbaf1('0xd')]);router[_0xbaf1('0xa')]('/:id/members',auth[_0xbaf1('0xb')](),controller[_0xbaf1('0xe')]);router['get'](_0xbaf1('0xf'),auth['isAuthenticated'](),controller[_0xbaf1('0x10')]);router[_0xbaf1('0xa')](_0xbaf1('0x11'),auth[_0xbaf1('0xb')](),controller[_0xbaf1('0x12')]);router[_0xbaf1('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbaf1('0x13')](_0xbaf1('0xf'),auth[_0xbaf1('0xb')](),controller[_0xbaf1('0x14')]);router[_0xbaf1('0x13')](_0xbaf1('0x11'),auth[_0xbaf1('0xb')](),controller['addAgents']);router[_0xbaf1('0x15')](_0xbaf1('0x16'),auth[_0xbaf1('0xb')](),controller[_0xbaf1('0x17')]);router[_0xbaf1('0x18')](_0xbaf1('0x16'),auth[_0xbaf1('0xb')](),controller[_0xbaf1('0x19')]);router['delete'](_0xbaf1('0xf'),auth['isAuthenticated'](),controller[_0xbaf1('0x1a')]);router[_0xbaf1('0x18')](_0xbaf1('0x11'),auth[_0xbaf1('0xb')](),controller['removeAgents']);module[_0xbaf1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index e86121e..ef3993b 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 _0xfe8f=['ENUM','rrmemory','beepall','name','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe8f,0xdb));var _0xffe8=function(_0x517a65,_0x3df21f){_0x517a65=_0x517a65-0x0;var _0x50b1ec=_0xfe8f[_0x517a65];return _0x50b1ec;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xffe8('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xffe8('0x1')]},'timeout':{'type':Sequelize[_0xffe8('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xffe8('0x3')](_0xffe8('0x4'),_0xffe8('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x431b=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x174f22,_0x302d6d){var _0x4e073f=function(_0x2c346d){while(--_0x2c346d){_0x174f22['push'](_0x174f22['shift']());}};_0x4e073f(++_0x302d6d);}(_0x431b,0x18d));var _0xb431=function(_0x1e6f1a,_0x598c23){_0x1e6f1a=_0x1e6f1a-0x0;var _0x1240a3=_0x431b[_0x1e6f1a];return _0x1240a3;};'use strict';var Sequelize=require(_0xb431('0x0'));module[_0xb431('0x1')]={'name':{'type':Sequelize[_0xb431('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb431('0x2')]},'timeout':{'type':Sequelize[_0xb431('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb431('0x4')](_0xb431('0x5'),_0xb431('0x6'),_0xb431('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 854df9f..be024b9 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 _0xd9c9=['register','status','end','json','count','offset','limit','set','apply','reject','destroy','OpenchannelQueues','UserProfileResource','then','sendStatus','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','ids','online','voicePause','interface','flatMap','Agents','sequelize','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','transaction','removeAgents','userOpenchannelQueue:remove','addAgents','isArray','getAgents','html-pdf','eml-format','rimraf','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter'];(function(_0x321b68,_0x10290d){var _0x300582=function(_0x4e7c77){while(--_0x4e7c77){_0x321b68['push'](_0x321b68['shift']());}};_0x300582(++_0x10290d);}(_0xd9c9,0x100));var _0x9d9c=function(_0x392fd7,_0x347b4d){_0x392fd7=_0x392fd7-0x0;var _0x3c168a=_0xd9c9[_0x392fd7];return _0x3c168a;};'use strict';var pdf=require(_0x9d9c('0x0'));var emlformat=require(_0x9d9c('0x1'));var rimraf=require(_0x9d9c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9d9c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9d9c('0x4'));var util=require('util');var path=require(_0x9d9c('0x5'));var sox=require(_0x9d9c('0x6'));var csv=require(_0x9d9c('0x7'));var ejs=require(_0x9d9c('0x8'));var fs=require('fs');var _=require(_0x9d9c('0x9'));var squel=require(_0x9d9c('0xa'));var crypto=require(_0x9d9c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9d9c('0xc'));var toCsv=require(_0x9d9c('0x7'));var querystring=require(_0x9d9c('0xd'));var Papa=require(_0x9d9c('0xe'));var Redis=require(_0x9d9c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d9c('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9d9c('0x11'));var licenseUtil=require(_0x9d9c('0x12'));var db=require(_0x9d9c('0x13'))['db'];config['redis']=_[_0x9d9c('0x14')](config[_0x9d9c('0x15')],{'host':_0x9d9c('0x16'),'port':0x18eb});var socket=require(_0x9d9c('0x17'))(new Redis(config[_0x9d9c('0x15')]));require('./openchannelQueue.socket')[_0x9d9c('0x18')](socket);function respondWithStatusCode(_0x1a98e5,_0x5bae08){_0x5bae08=_0x5bae08||0xcc;return function(_0x943d2e){if(_0x943d2e){return _0x1a98e5['sendStatus'](_0x5bae08);}return _0x1a98e5[_0x9d9c('0x19')](_0x5bae08)[_0x9d9c('0x1a')]();};}function respondWithResult(_0x37a43a,_0x4a494e){_0x4a494e=_0x4a494e||0xc8;return function(_0xd36a64){if(_0xd36a64){return _0x37a43a['status'](_0x4a494e)[_0x9d9c('0x1b')](_0xd36a64);}};}function respondWithFilteredResult(_0x4854d8,_0x11e1d6){return function(_0x3f7d49){if(_0x3f7d49){var _0x1ec601=_0x3f7d49[_0x9d9c('0x1c')],_0x462866=_0x11e1d6[_0x9d9c('0x1d')],_0x12f7d4=_0x11e1d6['offset']+_0x11e1d6[_0x9d9c('0x1e')],_0x4ce8c2;if(_0x12f7d4>=_0x1ec601){_0x12f7d4=_0x1ec601;_0x4ce8c2=0xc8;}else{_0x4ce8c2=0xce;}_0x4854d8[_0x9d9c('0x19')](_0x4ce8c2);return _0x4854d8[_0x9d9c('0x1f')]('Content-Range',_0x462866+'-'+_0x12f7d4+'/'+_0x1ec601)[_0x9d9c('0x1b')](_0x3f7d49);}return null;};}function patchUpdates(_0x38a6fc){return function(_0x453ee4){try{jsonpatch[_0x9d9c('0x20')](_0x453ee4,_0x38a6fc,!![]);}catch(_0x11293d){return BPromise[_0x9d9c('0x21')](_0x11293d);}return _0x453ee4['save']();};}function saveUpdates(_0x34b175,_0x47a6fc){return function(_0x396b98){if(_0x396b98){return _0x396b98['update'](_0x34b175)['then'](function(_0x54056e){return _0x54056e;});}return null;};}function removeEntity(_0x162b2d,_0x46f26d){return function(_0x456bc1){if(_0x456bc1){return _0x456bc1[_0x9d9c('0x22')]()['then'](function(){var _0x3b46b9=_0x456bc1['get']({'plain':!![]});var _0x542a40=_0x9d9c('0x23');return db[_0x9d9c('0x24')][_0x9d9c('0x22')]({'where':{'type':_0x542a40,'resourceId':_0x3b46b9['id']}})['then'](function(){return _0x456bc1;});})[_0x9d9c('0x25')](function(){_0x162b2d['status'](0xcc)[_0x9d9c('0x1a')]();});}};}function handleEntityNotFound(_0x4a165d,_0x1ebeae){return function(_0x4bbe37){if(!_0x4bbe37){_0x4a165d[_0x9d9c('0x26')](0x194);}return _0x4bbe37;};}function handleError(_0x41ebf5,_0x46a15c){_0x46a15c=_0x46a15c||0x1f4;return function(_0xabc151){logger[_0x9d9c('0x27')](_0xabc151[_0x9d9c('0x28')]);if(_0xabc151[_0x9d9c('0x29')]){delete _0xabc151[_0x9d9c('0x29')];}_0x41ebf5[_0x9d9c('0x19')](_0x46a15c)['send'](_0xabc151);};}exports[_0x9d9c('0x2a')]=function(_0x576184,_0x44783f){var _0x161d2b={},_0x4b23d4={},_0x39d96b={'count':0x0,'rows':[]};var _0x19e499=_[_0x9d9c('0x2b')](db[_0x9d9c('0x2c')][_0x9d9c('0x2d')],function(_0x5112ff){return{'name':_0x5112ff[_0x9d9c('0x2e')],'type':_0x5112ff[_0x9d9c('0x2f')][_0x9d9c('0x30')]};});_0x4b23d4[_0x9d9c('0x31')]=_[_0x9d9c('0x2b')](_0x19e499,_0x9d9c('0x29'));_0x4b23d4[_0x9d9c('0x32')]=_[_0x9d9c('0x33')](_0x576184['query']);_0x4b23d4[_0x9d9c('0x34')]=_[_0x9d9c('0x35')](_0x4b23d4[_0x9d9c('0x31')],_0x4b23d4[_0x9d9c('0x32')]);_0x161d2b[_0x9d9c('0x36')]=_[_0x9d9c('0x35')](_0x4b23d4['model'],qs[_0x9d9c('0x37')](_0x576184[_0x9d9c('0x32')][_0x9d9c('0x37')]));_0x161d2b[_0x9d9c('0x36')]=_0x161d2b['attributes']['length']?_0x161d2b['attributes']:_0x4b23d4[_0x9d9c('0x31')];if(!_0x576184[_0x9d9c('0x32')][_0x9d9c('0x38')](_0x9d9c('0x39'))){_0x161d2b[_0x9d9c('0x1e')]=qs[_0x9d9c('0x1e')](_0x576184[_0x9d9c('0x32')][_0x9d9c('0x1e')]);_0x161d2b['offset']=qs[_0x9d9c('0x1d')](_0x576184[_0x9d9c('0x32')]['offset']);}_0x161d2b[_0x9d9c('0x3a')]=qs[_0x9d9c('0x3b')](_0x576184['query'][_0x9d9c('0x3b')]);_0x161d2b['where']=qs[_0x9d9c('0x34')](_[_0x9d9c('0x3c')](_0x576184[_0x9d9c('0x32')],_0x4b23d4[_0x9d9c('0x34')]),_0x19e499);if(_0x576184[_0x9d9c('0x32')][_0x9d9c('0x3d')]){_0x161d2b[_0x9d9c('0x3e')]=_[_0x9d9c('0x3f')](_0x161d2b['where'],{'$or':_[_0x9d9c('0x2b')](_0x19e499,function(_0x2fb18e){if(_0x2fb18e[_0x9d9c('0x2f')]!==_0x9d9c('0x40')){var _0x29f9e8={};_0x29f9e8[_0x2fb18e[_0x9d9c('0x29')]]={'$like':'%'+_0x576184['query'][_0x9d9c('0x3d')]+'%'};return _0x29f9e8;}})});}_0x161d2b=_['merge']({},_0x161d2b,_0x576184[_0x9d9c('0x41')]);var _0x107dbe={'where':_0x161d2b[_0x9d9c('0x3e')]};return db[_0x9d9c('0x2c')][_0x9d9c('0x1c')](_0x107dbe)[_0x9d9c('0x25')](function(_0x125b1d){_0x39d96b[_0x9d9c('0x1c')]=_0x125b1d;if(_0x576184[_0x9d9c('0x32')][_0x9d9c('0x42')]){_0x161d2b[_0x9d9c('0x43')]=[{'all':!![]}];}return db[_0x9d9c('0x2c')][_0x9d9c('0x44')](_0x161d2b);})['then'](function(_0x1bb90b){_0x39d96b[_0x9d9c('0x45')]=_0x1bb90b;return _0x39d96b;})[_0x9d9c('0x25')](respondWithFilteredResult(_0x44783f,_0x161d2b))['catch'](handleError(_0x44783f,null));};exports[_0x9d9c('0x46')]=function(_0x388348,_0x8e9fe3){var _0x2a760f={'raw':!![],'where':{'id':_0x388348[_0x9d9c('0x47')]['id']}},_0x1fe4fe={};_0x1fe4fe[_0x9d9c('0x31')]=_[_0x9d9c('0x33')](db['OpenchannelQueue'][_0x9d9c('0x2d')]);_0x1fe4fe['query']=_[_0x9d9c('0x33')](_0x388348[_0x9d9c('0x32')]);_0x1fe4fe[_0x9d9c('0x34')]=_[_0x9d9c('0x35')](_0x1fe4fe[_0x9d9c('0x31')],_0x1fe4fe[_0x9d9c('0x32')]);_0x2a760f['attributes']=_['intersection'](_0x1fe4fe[_0x9d9c('0x31')],qs[_0x9d9c('0x37')](_0x388348['query'][_0x9d9c('0x37')]));_0x2a760f[_0x9d9c('0x36')]=_0x2a760f['attributes'][_0x9d9c('0x48')]?_0x2a760f[_0x9d9c('0x36')]:_0x1fe4fe['model'];if(_0x388348[_0x9d9c('0x32')][_0x9d9c('0x42')]){_0x2a760f[_0x9d9c('0x43')]=[{'all':!![]}];}_0x2a760f=_[_0x9d9c('0x3f')]({},_0x2a760f,_0x388348[_0x9d9c('0x41')]);return db[_0x9d9c('0x2c')][_0x9d9c('0x49')](_0x2a760f)['then'](handleEntityNotFound(_0x8e9fe3,null))[_0x9d9c('0x25')](respondWithResult(_0x8e9fe3,null))[_0x9d9c('0x4a')](handleError(_0x8e9fe3,null));};exports[_0x9d9c('0x4b')]=function(_0x204a71,_0x32822c){return db['OpenchannelQueue'][_0x9d9c('0x4b')](_0x204a71[_0x9d9c('0x4c')],{})['then'](function(_0x2788c6){var _0x306a79=_0x204a71[_0x9d9c('0x4d')][_0x9d9c('0x4e')]({'plain':!![]});if(!_0x306a79)throw new Error(_0x9d9c('0x4f'));if(_0x306a79[_0x9d9c('0x50')]===_0x9d9c('0x4d')){var _0x37d105=_0x2788c6[_0x9d9c('0x4e')]({'plain':!![]});var _0xbad30e=_0x9d9c('0x23');return db[_0x9d9c('0x51')]['find']({'where':{'name':_0xbad30e,'userProfileId':_0x306a79[_0x9d9c('0x52')]},'raw':!![]})[_0x9d9c('0x25')](function(_0x1ff182){if(_0x1ff182&&_0x1ff182[_0x9d9c('0x53')]===0x0){return db[_0x9d9c('0x24')][_0x9d9c('0x4b')]({'name':_0x37d105['name'],'resourceId':_0x37d105['id'],'type':_0x1ff182['name'],'sectionId':_0x1ff182['id']},{})['then'](function(){return _0x2788c6;});}else{return _0x2788c6;}})[_0x9d9c('0x4a')](function(_0x39d9cd){logger[_0x9d9c('0x27')](_0x9d9c('0x54'),_0x39d9cd);throw _0x39d9cd;});}return _0x2788c6;})[_0x9d9c('0x25')](respondWithResult(_0x32822c,0xc9))[_0x9d9c('0x4a')](handleError(_0x32822c,null));};exports[_0x9d9c('0x55')]=function(_0x99f2e,_0x3b3e02){if(_0x99f2e[_0x9d9c('0x4c')]['id']){delete _0x99f2e[_0x9d9c('0x4c')]['id'];}return db[_0x9d9c('0x2c')][_0x9d9c('0x49')]({'where':{'id':_0x99f2e['params']['id']}})[_0x9d9c('0x25')](handleEntityNotFound(_0x3b3e02,null))['then'](saveUpdates(_0x99f2e['body'],null))[_0x9d9c('0x25')](respondWithResult(_0x3b3e02,null))[_0x9d9c('0x4a')](handleError(_0x3b3e02,null));};exports[_0x9d9c('0x22')]=function(_0x64626b,_0x23f233){return db[_0x9d9c('0x2c')][_0x9d9c('0x49')]({'where':{'id':_0x64626b[_0x9d9c('0x47')]['id']}})['then'](handleEntityNotFound(_0x23f233,null))['then'](removeEntity(_0x23f233,null))[_0x9d9c('0x4a')](handleError(_0x23f233,null));};exports[_0x9d9c('0x56')]=function(_0x3ac3f2,_0x3c0e22){return db['OpenchannelQueue'][_0x9d9c('0x56')]()[_0x9d9c('0x25')](respondWithResult(_0x3c0e22,null))['catch'](handleError(_0x3c0e22,null));};exports[_0x9d9c('0x57')]=function(_0x51b5cf,_0x269f8b,_0x585e3b){var _0x2f5c5b={'raw':!![],'where':{}},_0x1050e0={},_0x1d7346;return db[_0x9d9c('0x2c')]['findOne']({'where':{'id':_0x51b5cf['params']['id']}})['then'](handleEntityNotFound(_0x269f8b,null))[_0x9d9c('0x25')](function(_0x4b448e){if(_0x4b448e){_0x1d7346=_0x4b448e['get']({'plain':!![]});_0x1050e0[_0x9d9c('0x31')]=_['keys'](db[_0x9d9c('0x58')][_0x9d9c('0x2d')]);_0x1050e0['query']=_[_0x9d9c('0x33')](_0x51b5cf[_0x9d9c('0x32')]);_0x1050e0['filters']=_['intersection'](_0x1050e0[_0x9d9c('0x31')],_0x1050e0['query']);_0x2f5c5b['attributes']=_[_0x9d9c('0x35')](_0x1050e0[_0x9d9c('0x31')],qs[_0x9d9c('0x37')](_0x51b5cf['query']['fields']));_0x2f5c5b[_0x9d9c('0x36')]=_0x2f5c5b[_0x9d9c('0x36')]['length']?_0x2f5c5b['attributes']:_0x1050e0[_0x9d9c('0x31')];if(!_0x51b5cf[_0x9d9c('0x32')]['hasOwnProperty'](_0x9d9c('0x39'))){_0x2f5c5b[_0x9d9c('0x1e')]=qs[_0x9d9c('0x1e')](_0x51b5cf[_0x9d9c('0x32')][_0x9d9c('0x1e')]);_0x2f5c5b[_0x9d9c('0x1d')]=qs['offset'](_0x51b5cf[_0x9d9c('0x32')][_0x9d9c('0x1d')]);}_0x2f5c5b['order']=qs[_0x9d9c('0x3b')](_0x51b5cf[_0x9d9c('0x32')][_0x9d9c('0x3b')]);_0x2f5c5b['where']=qs[_0x9d9c('0x34')](_[_0x9d9c('0x3c')](_0x51b5cf[_0x9d9c('0x32')],_0x1050e0[_0x9d9c('0x34')]));_0x2f5c5b[_0x9d9c('0x3e')][_0x9d9c('0x59')]=_0x4b448e['id'];if(_0x51b5cf['query'][_0x9d9c('0x3d')]){_0x2f5c5b[_0x9d9c('0x3e')]=_[_0x9d9c('0x3f')](_0x2f5c5b[_0x9d9c('0x3e')],{'$or':_[_0x9d9c('0x2b')](_0x2f5c5b[_0x9d9c('0x36')],function(_0x4f6451){var _0x129083={};_0x129083[_0x4f6451]={'$like':'%'+_0x51b5cf['query'][_0x9d9c('0x3d')]+'%'};return _0x129083;})});}_0x2f5c5b=_['merge']({},_0x2f5c5b,_0x51b5cf['options']);return db[_0x9d9c('0x58')][_0x9d9c('0x44')](_0x2f5c5b);}})[_0x9d9c('0x25')](function(_0x4607b0){if(_0x4607b0){return db[_0x9d9c('0x5a')][_0x9d9c('0x5b')]({'where':{'id':_[_0x9d9c('0x2b')](_0x4607b0,_0x9d9c('0x5c')),'role':_0x9d9c('0x5d')},'attributes':['id',_0x9d9c('0x29'),_0x9d9c('0x5e'),'updatedAt',_0x9d9c('0x5f')]});}})['then'](function(_0x4199a1){if(_0x4199a1){return{'count':_0x4199a1[_0x9d9c('0x1c')],'rows':_[_0x9d9c('0x2b')](_0x4199a1[_0x9d9c('0x45')],function(_0x2c91ab){return{'membername':_0x2c91ab[_0x9d9c('0x29')],'UserId':_0x2c91ab['id'],'queue_name':_0x1d7346[_0x9d9c('0x29')],'OpenchannelQueueId':_0x1d7346['id'],'interface':util[_0x9d9c('0x60')](_0x9d9c('0x61'),_0x9d9c('0x62'),_0x2c91ab[_0x9d9c('0x29')]),'penalty':0x0,'paused':_0x2c91ab['openchannelPause'],'createdAt':_0x2c91ab[_0x9d9c('0x5f')],'updatedAt':_0x2c91ab[_0x9d9c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x269f8b,_0x2f5c5b))[_0x9d9c('0x4a')](handleError(_0x269f8b,null));};exports[_0x9d9c('0x64')]=function(_0x45656c,_0x24f325,_0x26d189){var _0x154afa={};var _0x5b2cf5={};var _0x2b5dde;var _0x2cbcfb;return db[_0x9d9c('0x2c')][_0x9d9c('0x65')]({'where':{'id':_0x45656c[_0x9d9c('0x47')]['id']}})['then'](handleEntityNotFound(_0x24f325,null))[_0x9d9c('0x25')](function(_0x4880be){if(_0x4880be){_0x2b5dde=_0x4880be;_0x5b2cf5[_0x9d9c('0x31')]=_[_0x9d9c('0x33')](db[_0x9d9c('0x66')][_0x9d9c('0x2d')]);_0x5b2cf5[_0x9d9c('0x32')]=_[_0x9d9c('0x33')](_0x45656c[_0x9d9c('0x32')]);_0x5b2cf5['filters']=_[_0x9d9c('0x35')](_0x5b2cf5[_0x9d9c('0x31')],_0x5b2cf5[_0x9d9c('0x32')]);_0x154afa[_0x9d9c('0x36')]=_[_0x9d9c('0x35')](_0x5b2cf5[_0x9d9c('0x31')],qs[_0x9d9c('0x37')](_0x45656c[_0x9d9c('0x32')][_0x9d9c('0x37')]));_0x154afa[_0x9d9c('0x36')]=_0x154afa[_0x9d9c('0x36')]['length']?_0x154afa[_0x9d9c('0x36')]:_0x5b2cf5['model'];_0x154afa['order']=qs['sort'](_0x45656c['query'][_0x9d9c('0x3b')]);_0x154afa[_0x9d9c('0x3e')]=qs[_0x9d9c('0x34')](_[_0x9d9c('0x3c')](_0x45656c[_0x9d9c('0x32')],_0x5b2cf5[_0x9d9c('0x34')]));if(_0x45656c[_0x9d9c('0x32')][_0x9d9c('0x3d')]){_0x154afa['where']=_[_0x9d9c('0x3f')](_0x154afa[_0x9d9c('0x3e')],{'$or':_[_0x9d9c('0x2b')](_0x154afa['attributes'],function(_0x1e2673){var _0x2cec1d={};_0x2cec1d[_0x1e2673]={'$like':'%'+_0x45656c[_0x9d9c('0x32')][_0x9d9c('0x3d')]+'%'};return _0x2cec1d;})});}_0x154afa=_['merge']({},_0x154afa,_0x45656c[_0x9d9c('0x41')]);return _0x2b5dde[_0x9d9c('0x64')](_0x154afa);}})[_0x9d9c('0x25')](function(_0xdc0081){if(_0xdc0081){_0x2cbcfb=_0xdc0081[_0x9d9c('0x48')];if(!_0x45656c[_0x9d9c('0x32')][_0x9d9c('0x38')](_0x9d9c('0x39'))){_0x154afa[_0x9d9c('0x1e')]=qs[_0x9d9c('0x1e')](_0x45656c['query'][_0x9d9c('0x1e')]);_0x154afa['offset']=qs['offset'](_0x45656c[_0x9d9c('0x32')]['offset']);}return _0x2b5dde[_0x9d9c('0x64')](_0x154afa);}})[_0x9d9c('0x25')](function(_0x5b55e2){if(_0x5b55e2){return _0x5b55e2?{'count':_0x2cbcfb,'rows':_0x5b55e2}:null;}})[_0x9d9c('0x25')](respondWithResult(_0x24f325,null))[_0x9d9c('0x4a')](handleError(_0x24f325,null));};exports['addTeams']=function(_0x241d97,_0x222837,_0x20b988){var _0x45e746=_0x241d97['body'][_0x9d9c('0x67')];return db['Team'][_0x9d9c('0x44')]({'where':{'id':_0x45e746},'attributes':['id'],'include':[{'model':db[_0x9d9c('0x5a')],'as':'Agents','attributes':['id',_0x9d9c('0x29'),_0x9d9c('0x68'),_0x9d9c('0x69'),_0x9d9c('0x6a')],'raw':!![]}]})[_0x9d9c('0x25')](function(_0x164b54){if(_0x164b54){var _0x6a710c=_[_0x9d9c('0x6b')](_0x164b54,function(_0x2a3d42){var _0x44e158=_0x2a3d42[_0x9d9c('0x4e')]({'plain':!![]});return _0x44e158[_0x9d9c('0x6c')];});return db[_0x9d9c('0x2c')][_0x9d9c('0x49')]({'where':{'id':_0x241d97[_0x9d9c('0x47')]['id']}})[_0x9d9c('0x25')](function(_0xc3ac54){return db[_0x9d9c('0x6d')]['transaction'](function(_0x1ccb5e){return _0xc3ac54[_0x9d9c('0x6e')](_0x45e746,{'transaction':_0x1ccb5e})[_0x9d9c('0x25')](function(){return BPromise[_0x9d9c('0x6f')](_0x6a710c,function(_0x3b4226){return db[_0x9d9c('0x58')][_0x9d9c('0x70')]({'where':{'UserId':_0x3b4226['id'],'OpenchannelQueueId':_0x241d97[_0x9d9c('0x47')]['id']},'transaction':_0x1ccb5e});});})[_0x9d9c('0x25')](function(){_0x6a710c[_0x9d9c('0x71')](function(_0x3b314f){socket[_0x9d9c('0x72')](_0x9d9c('0x73'),{'UserId':_0x3b314f['id'],'OpenchannelQueueId':_0xc3ac54['id']});});});});});}})[_0x9d9c('0x25')](respondWithStatusCode(_0x222837,null))['catch'](handleError(_0x222837,null));};exports[_0x9d9c('0x74')]=function(_0x3aee63,_0x2f0f66,_0xa7d2ce){return db['Team']['findAll']({'where':{'id':_0x3aee63['query'][_0x9d9c('0x67')]},'attributes':['id'],'include':[{'model':db[_0x9d9c('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9d9c('0x25')](handleEntityNotFound(_0x2f0f66,null))[_0x9d9c('0x25')](function(_0x339c3f){var _0x2599a3=_[_0x9d9c('0x2b')](_0x339c3f,'id');var _0x30a68a=[];var _0xd3f119=[];var _0x109e58=squel[_0x9d9c('0x75')]();_0x109e58['field']('tq.TeamId')[_0x9d9c('0x76')](_0x9d9c('0x77'),'tq')[_0x9d9c('0x78')](_0x9d9c('0x79'),'ut',_0x9d9c('0x7a'))[_0x9d9c('0x3e')]('OpenchannelQueueId\x20=\x20?',_0x3aee63[_0x9d9c('0x47')]['id']);for(var _0x25ce80=0x0;_0x25ce80<_0x339c3f[_0x9d9c('0x48')];_0x25ce80+=0x1){let _0x3de0f4=_0x339c3f[_0x25ce80];for(var _0xd842f8=0x0;_0xd842f8<_0x3de0f4['Agents'][_0x9d9c('0x48')];_0xd842f8+=0x1){let _0x51a2be=_0x3de0f4['Agents'][_0xd842f8];var _0x1d5bac=_0x109e58[_0x9d9c('0x7b')]();_0x1d5bac[_0x9d9c('0x3e')](_0x9d9c('0x7c'),_0x51a2be['id']);_0xd3f119[_0x9d9c('0x7d')](db[_0x9d9c('0x6d')][_0x9d9c('0x32')](_0x1d5bac[_0x9d9c('0x7e')](),{'type':db[_0x9d9c('0x6d')][_0x9d9c('0x7f')][_0x9d9c('0x80')]})[_0x9d9c('0x25')](function(_0x2edeac){if(_0x2edeac[_0x9d9c('0x48')]===0x1){return _0x51a2be['id'];}else{var _0x24a4aa=_['every'](_[_0x9d9c('0x2b')](_0x2edeac,_0x9d9c('0x81')),function(_0x10c1a9){return _[_0x9d9c('0x82')](_0x2599a3,_0x10c1a9);});if(_0x24a4aa){return _0x51a2be['id'];}}}));}}return BPromise[_0x9d9c('0x83')](_0xd3f119)['then'](function(_0x155023){_0x30a68a=_(_0x30a68a)[_0x9d9c('0x84')](_0x155023)[_0x9d9c('0x85')]()['value']();return db[_0x9d9c('0x2c')][_0x9d9c('0x49')]({'where':{'id':_0x3aee63[_0x9d9c('0x47')]['id']}})[_0x9d9c('0x25')](function(_0x4a585f){return db[_0x9d9c('0x6d')][_0x9d9c('0x86')](function(_0x1064f2){return _0x4a585f[_0x9d9c('0x74')](_0x3aee63['query']['ids'],{'transaction':_0x1064f2})[_0x9d9c('0x25')](function(){if(!_['isEmpty'](_0x30a68a)){return _0x4a585f[_0x9d9c('0x87')](_0x30a68a,{'transaction':_0x1064f2});}})[_0x9d9c('0x25')](function(){_0x30a68a['forEach'](function(_0x16f7eb){socket[_0x9d9c('0x72')](_0x9d9c('0x88'),{'UserId':_0x16f7eb,'OpenchannelQueueId':_0x4a585f['id']});});});});});});})[_0x9d9c('0x25')](respondWithStatusCode(_0x2f0f66,null))[_0x9d9c('0x4a')](handleError(_0x2f0f66,null));};exports[_0x9d9c('0x89')]=function(_0x24cbdb,_0x2cf7d5,_0x1819ed){return db[_0x9d9c('0x2c')][_0x9d9c('0x49')]({'where':{'id':_0x24cbdb[_0x9d9c('0x47')]['id']}})[_0x9d9c('0x25')](handleEntityNotFound(_0x2cf7d5,null))[_0x9d9c('0x25')](function(_0x6972c4){if(_0x6972c4){return _0x6972c4[_0x9d9c('0x89')](_0x24cbdb[_0x9d9c('0x4c')][_0x9d9c('0x67')],_['omit'](_0x24cbdb[_0x9d9c('0x4c')],[_0x9d9c('0x67'),'id'])||{})['spread'](function(_0x414f04){for(var _0x180b27=0x0;_0x180b27<_0x24cbdb['body'][_0x9d9c('0x67')]['length'];_0x180b27+=0x1){socket[_0x9d9c('0x72')]('userOpenchannelQueue:save',{'UserId':_0x24cbdb[_0x9d9c('0x4c')]['ids'][_0x180b27],'OpenchannelQueueId':_0x24cbdb['params']['id']});}return _0x414f04;});}})['then'](respondWithResult(_0x2cf7d5,null))['catch'](handleError(_0x2cf7d5,null));};exports[_0x9d9c('0x87')]=function(_0x2aecaa,_0x4efad4,_0x291fcc){return db['OpenchannelQueue'][_0x9d9c('0x49')]({'where':{'id':_0x2aecaa[_0x9d9c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4efad4,null))[_0x9d9c('0x25')](function(_0x574d3b){if(_0x574d3b){return _0x574d3b[_0x9d9c('0x87')](_0x2aecaa[_0x9d9c('0x32')]['ids'])[_0x9d9c('0x25')](function(){if(_[_0x9d9c('0x8a')](_0x2aecaa[_0x9d9c('0x32')]['ids'])){for(var _0x53dd7a=0x0;_0x53dd7a<_0x2aecaa[_0x9d9c('0x32')]['ids'][_0x9d9c('0x48')];_0x53dd7a+=0x1){socket[_0x9d9c('0x72')](_0x9d9c('0x88'),{'UserId':Number(_0x2aecaa[_0x9d9c('0x32')]['ids'][_0x53dd7a]),'OpenchannelQueueId':Number(_0x2aecaa[_0x9d9c('0x47')]['id'])});}}else{socket[_0x9d9c('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2aecaa[_0x9d9c('0x32')][_0x9d9c('0x67')]),'OpenchannelQueueId':Number(_0x2aecaa[_0x9d9c('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x4efad4,null))[_0x9d9c('0x4a')](handleError(_0x4efad4,null));};exports[_0x9d9c('0x8b')]=function(_0x2d1bbd,_0x33d9d1,_0x29f1f1){var _0x540558={};var _0x4c7122={};var _0x3688e2;var _0x2bc174;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x2d1bbd['params']['id']}})[_0x9d9c('0x25')](handleEntityNotFound(_0x33d9d1,null))[_0x9d9c('0x25')](function(_0x457c55){if(_0x457c55){_0x3688e2=_0x457c55;_0x4c7122[_0x9d9c('0x31')]=_[_0x9d9c('0x33')](db[_0x9d9c('0x5a')][_0x9d9c('0x2d')]);_0x4c7122[_0x9d9c('0x32')]=_[_0x9d9c('0x33')](_0x2d1bbd[_0x9d9c('0x32')]);_0x4c7122['filters']=_[_0x9d9c('0x35')](_0x4c7122[_0x9d9c('0x31')],_0x4c7122['query']);_0x540558[_0x9d9c('0x36')]=_[_0x9d9c('0x35')](_0x4c7122[_0x9d9c('0x31')],qs['fields'](_0x2d1bbd[_0x9d9c('0x32')][_0x9d9c('0x37')]));_0x540558[_0x9d9c('0x36')]=_0x540558[_0x9d9c('0x36')][_0x9d9c('0x48')]?_0x540558[_0x9d9c('0x36')]:_0x4c7122['model'];_0x540558['order']=qs[_0x9d9c('0x3b')](_0x2d1bbd[_0x9d9c('0x32')][_0x9d9c('0x3b')]);_0x540558[_0x9d9c('0x3e')]=qs[_0x9d9c('0x34')](_[_0x9d9c('0x3c')](_0x2d1bbd[_0x9d9c('0x32')],_0x4c7122[_0x9d9c('0x34')]));if(_0x2d1bbd['query'][_0x9d9c('0x3d')]){_0x540558[_0x9d9c('0x3e')]=_[_0x9d9c('0x3f')](_0x540558[_0x9d9c('0x3e')],{'$or':_[_0x9d9c('0x2b')](_0x540558[_0x9d9c('0x36')],function(_0x2a4b7e){var _0x4e3f8c={};_0x4e3f8c[_0x2a4b7e]={'$like':'%'+_0x2d1bbd[_0x9d9c('0x32')]['filter']+'%'};return _0x4e3f8c;})});}_0x540558=_[_0x9d9c('0x3f')]({},_0x540558,_0x2d1bbd[_0x9d9c('0x41')]);return _0x3688e2[_0x9d9c('0x8b')](_0x540558);}})['then'](function(_0x2ed769){if(_0x2ed769){_0x2bc174=_0x2ed769[_0x9d9c('0x48')];if(!_0x2d1bbd[_0x9d9c('0x32')][_0x9d9c('0x38')]('nolimit')){_0x540558[_0x9d9c('0x1e')]=qs[_0x9d9c('0x1e')](_0x2d1bbd[_0x9d9c('0x32')]['limit']);_0x540558['offset']=qs[_0x9d9c('0x1d')](_0x2d1bbd[_0x9d9c('0x32')][_0x9d9c('0x1d')]);}return _0x3688e2[_0x9d9c('0x8b')](_0x540558);}})[_0x9d9c('0x25')](function(_0x3b8fa3){if(_0x3b8fa3){return _0x3b8fa3?{'count':_0x2bc174,'rows':_0x3b8fa3}:null;}})['then'](respondWithResult(_0x33d9d1,null))[_0x9d9c('0x4a')](handleError(_0x33d9d1,null));}; \ No newline at end of file +var _0x397a=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','rawAttributes','OpenchannelQueueId','findAll','User','findAndCountAll','agent','openchannelPause','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','toString','every','TeamId','union','compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x31fbeb,_0x51eb69){var _0x1845a8=function(_0x3492d7){while(--_0x3492d7){_0x31fbeb['push'](_0x31fbeb['shift']());}};_0x1845a8(++_0x51eb69);}(_0x397a,0x108));var _0xa397=function(_0x2ee2e,_0x5c9e69){_0x2ee2e=_0x2ee2e-0x0;var _0x69c02=_0x397a[_0x2ee2e];return _0x69c02;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa397('0x0'));var rimraf=require(_0xa397('0x1'));var zipdir=require(_0xa397('0x2'));var jsonpatch=require(_0xa397('0x3'));var rp=require(_0xa397('0x4'));var moment=require(_0xa397('0x5'));var BPromise=require(_0xa397('0x6'));var Mustache=require(_0xa397('0x7'));var util=require(_0xa397('0x8'));var path=require(_0xa397('0x9'));var sox=require(_0xa397('0xa'));var csv=require(_0xa397('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa397('0xc'));var squel=require('squel');var crypto=require(_0xa397('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa397('0xe'));var toCsv=require(_0xa397('0xb'));var querystring=require('querystring');var Papa=require(_0xa397('0xf'));var Redis=require('ioredis');var authService=require(_0xa397('0x10'));var qs=require(_0xa397('0x11'));var as=require(_0xa397('0x12'));var hardwareService=require(_0xa397('0x13'));var logger=require(_0xa397('0x14'))(_0xa397('0x15'));var utils=require(_0xa397('0x16'));var config=require(_0xa397('0x17'));var licenseUtil=require(_0xa397('0x18'));var db=require(_0xa397('0x19'))['db'];config['redis']=_[_0xa397('0x1a')](config['redis'],{'host':_0xa397('0x1b'),'port':0x18eb});var socket=require(_0xa397('0x1c'))(new Redis(config[_0xa397('0x1d')]));require(_0xa397('0x1e'))[_0xa397('0x1f')](socket);function respondWithStatusCode(_0x2c2c6a,_0x2b1ab0){_0x2b1ab0=_0x2b1ab0||0xcc;return function(_0x25a5c6){if(_0x25a5c6){return _0x2c2c6a[_0xa397('0x20')](_0x2b1ab0);}return _0x2c2c6a[_0xa397('0x21')](_0x2b1ab0)[_0xa397('0x22')]();};}function respondWithResult(_0x2bfdf4,_0x1b5f5d){_0x1b5f5d=_0x1b5f5d||0xc8;return function(_0x250af1){if(_0x250af1){return _0x2bfdf4[_0xa397('0x21')](_0x1b5f5d)['json'](_0x250af1);}};}function respondWithFilteredResult(_0x201eb9,_0x37dee4){return function(_0x57d556){if(_0x57d556){var _0x180a42=_0x57d556[_0xa397('0x23')],_0x32a40a=_0x37dee4['offset'],_0x3e4302=_0x37dee4[_0xa397('0x24')]+_0x37dee4[_0xa397('0x25')],_0xfdff29;if(_0x3e4302>=_0x180a42){_0x3e4302=_0x180a42;_0xfdff29=0xc8;}else{_0xfdff29=0xce;}_0x201eb9[_0xa397('0x21')](_0xfdff29);return _0x201eb9['set'](_0xa397('0x26'),_0x32a40a+'-'+_0x3e4302+'/'+_0x180a42)[_0xa397('0x27')](_0x57d556);}return null;};}function patchUpdates(_0x4b6f33){return function(_0x21120c){try{jsonpatch[_0xa397('0x28')](_0x21120c,_0x4b6f33,!![]);}catch(_0x4ee380){return BPromise[_0xa397('0x29')](_0x4ee380);}return _0x21120c['save']();};}function saveUpdates(_0x43cc6c,_0x34b317){return function(_0xf28ca7){if(_0xf28ca7){return _0xf28ca7[_0xa397('0x2a')](_0x43cc6c)[_0xa397('0x2b')](function(_0x5d5c75){return _0x5d5c75;});}return null;};}function removeEntity(_0x580f83,_0x295dc6){return function(_0x5a5040){if(_0x5a5040){return _0x5a5040[_0xa397('0x2c')]()[_0xa397('0x2b')](function(){var _0x2fa6a3=_0x5a5040[_0xa397('0x2d')]({'plain':!![]});var _0x5dd10e=_0xa397('0x2e');return db[_0xa397('0x2f')][_0xa397('0x2c')]({'where':{'type':_0x5dd10e,'resourceId':_0x2fa6a3['id']}})['then'](function(){return _0x5a5040;});})[_0xa397('0x2b')](function(){_0x580f83['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ff098,_0x276642){return function(_0x35ec6e){if(!_0x35ec6e){_0x2ff098[_0xa397('0x20')](0x194);}return _0x35ec6e;};}function handleError(_0x3daef2,_0x1cc053){_0x1cc053=_0x1cc053||0x1f4;return function(_0x3a8d48){logger[_0xa397('0x30')](_0x3a8d48[_0xa397('0x31')]);if(_0x3a8d48[_0xa397('0x32')]){delete _0x3a8d48[_0xa397('0x32')];}_0x3daef2['status'](_0x1cc053)[_0xa397('0x33')](_0x3a8d48);};}exports['index']=function(_0xdc79d4,_0xbfa7cf){var _0x2e00a4={},_0x314002={},_0x1b7476={'count':0x0,'rows':[]};var _0x5280d7=_[_0xa397('0x34')](db[_0xa397('0x35')]['rawAttributes'],function(_0x48729a){return{'name':_0x48729a[_0xa397('0x36')],'type':_0x48729a[_0xa397('0x37')][_0xa397('0x38')]};});_0x314002['model']=_[_0xa397('0x34')](_0x5280d7,_0xa397('0x32'));_0x314002[_0xa397('0x39')]=_['keys'](_0xdc79d4[_0xa397('0x39')]);_0x314002[_0xa397('0x3a')]=_[_0xa397('0x3b')](_0x314002[_0xa397('0x3c')],_0x314002[_0xa397('0x39')]);_0x2e00a4[_0xa397('0x3d')]=_[_0xa397('0x3b')](_0x314002['model'],qs[_0xa397('0x3e')](_0xdc79d4[_0xa397('0x39')]['fields']));_0x2e00a4['attributes']=_0x2e00a4[_0xa397('0x3d')][_0xa397('0x3f')]?_0x2e00a4[_0xa397('0x3d')]:_0x314002[_0xa397('0x3c')];if(!_0xdc79d4[_0xa397('0x39')][_0xa397('0x40')](_0xa397('0x41'))){_0x2e00a4[_0xa397('0x25')]=qs[_0xa397('0x25')](_0xdc79d4[_0xa397('0x39')][_0xa397('0x25')]);_0x2e00a4['offset']=qs[_0xa397('0x24')](_0xdc79d4['query'][_0xa397('0x24')]);}_0x2e00a4[_0xa397('0x42')]=qs[_0xa397('0x43')](_0xdc79d4['query'][_0xa397('0x43')]);_0x2e00a4[_0xa397('0x44')]=qs['filters'](_[_0xa397('0x45')](_0xdc79d4[_0xa397('0x39')],_0x314002[_0xa397('0x3a')]),_0x5280d7);if(_0xdc79d4[_0xa397('0x39')][_0xa397('0x46')]){_0x2e00a4['where']=_[_0xa397('0x47')](_0x2e00a4[_0xa397('0x44')],{'$or':_[_0xa397('0x34')](_0x5280d7,function(_0x5df2dc){if(_0x5df2dc[_0xa397('0x37')]!==_0xa397('0x48')){var _0x257c64={};_0x257c64[_0x5df2dc[_0xa397('0x32')]]={'$like':'%'+_0xdc79d4['query'][_0xa397('0x46')]+'%'};return _0x257c64;}})});}_0x2e00a4=_['merge']({},_0x2e00a4,_0xdc79d4[_0xa397('0x49')]);var _0x3beb1f={'where':_0x2e00a4[_0xa397('0x44')]};return db[_0xa397('0x35')][_0xa397('0x23')](_0x3beb1f)[_0xa397('0x2b')](function(_0x378c29){_0x1b7476['count']=_0x378c29;if(_0xdc79d4['query'][_0xa397('0x4a')]){_0x2e00a4[_0xa397('0x4b')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x2e00a4);})[_0xa397('0x2b')](function(_0x19ed39){_0x1b7476['rows']=_0x19ed39;return _0x1b7476;})[_0xa397('0x2b')](respondWithFilteredResult(_0xbfa7cf,_0x2e00a4))[_0xa397('0x4c')](handleError(_0xbfa7cf,null));};exports[_0xa397('0x4d')]=function(_0x5d4ebc,_0x294594){var _0x20979c={'raw':!![],'where':{'id':_0x5d4ebc[_0xa397('0x4e')]['id']}},_0x363213={};_0x363213['model']=_[_0xa397('0x4f')](db[_0xa397('0x35')]['rawAttributes']);_0x363213[_0xa397('0x39')]=_[_0xa397('0x4f')](_0x5d4ebc[_0xa397('0x39')]);_0x363213[_0xa397('0x3a')]=_[_0xa397('0x3b')](_0x363213['model'],_0x363213[_0xa397('0x39')]);_0x20979c[_0xa397('0x3d')]=_[_0xa397('0x3b')](_0x363213[_0xa397('0x3c')],qs[_0xa397('0x3e')](_0x5d4ebc['query'][_0xa397('0x3e')]));_0x20979c[_0xa397('0x3d')]=_0x20979c[_0xa397('0x3d')][_0xa397('0x3f')]?_0x20979c[_0xa397('0x3d')]:_0x363213[_0xa397('0x3c')];if(_0x5d4ebc[_0xa397('0x39')]['includeAll']){_0x20979c[_0xa397('0x4b')]=[{'all':!![]}];}_0x20979c=_[_0xa397('0x47')]({},_0x20979c,_0x5d4ebc['options']);return db[_0xa397('0x35')][_0xa397('0x50')](_0x20979c)[_0xa397('0x2b')](handleEntityNotFound(_0x294594,null))[_0xa397('0x2b')](respondWithResult(_0x294594,null))[_0xa397('0x4c')](handleError(_0x294594,null));};exports[_0xa397('0x51')]=function(_0x8375e1,_0x5db9db){return db[_0xa397('0x35')][_0xa397('0x51')](_0x8375e1[_0xa397('0x52')],{})[_0xa397('0x2b')](function(_0x3f9640){var _0x553a1e=_0x8375e1[_0xa397('0x53')][_0xa397('0x2d')]({'plain':!![]});if(!_0x553a1e)throw new Error(_0xa397('0x54'));if(_0x553a1e[_0xa397('0x55')]===_0xa397('0x53')){var _0x135f57=_0x3f9640[_0xa397('0x2d')]({'plain':!![]});var _0x57531c=_0xa397('0x2e');return db[_0xa397('0x56')]['find']({'where':{'name':_0x57531c,'userProfileId':_0x553a1e[_0xa397('0x57')]},'raw':!![]})[_0xa397('0x2b')](function(_0x4cde38){if(_0x4cde38&&_0x4cde38[_0xa397('0x58')]===0x0){return db[_0xa397('0x2f')][_0xa397('0x51')]({'name':_0x135f57['name'],'resourceId':_0x135f57['id'],'type':_0x4cde38[_0xa397('0x32')],'sectionId':_0x4cde38['id']},{})[_0xa397('0x2b')](function(){return _0x3f9640;});}else{return _0x3f9640;}})['catch'](function(_0x380fa9){logger[_0xa397('0x30')](_0xa397('0x59'),_0x380fa9);throw _0x380fa9;});}return _0x3f9640;})[_0xa397('0x2b')](respondWithResult(_0x5db9db,0xc9))[_0xa397('0x4c')](handleError(_0x5db9db,null));};exports[_0xa397('0x2a')]=function(_0x5ebdb3,_0x2c2c83){if(_0x5ebdb3[_0xa397('0x52')]['id']){delete _0x5ebdb3['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x5ebdb3['params']['id']}})[_0xa397('0x2b')](handleEntityNotFound(_0x2c2c83,null))[_0xa397('0x2b')](saveUpdates(_0x5ebdb3['body'],null))[_0xa397('0x2b')](respondWithResult(_0x2c2c83,null))[_0xa397('0x4c')](handleError(_0x2c2c83,null));};exports[_0xa397('0x2c')]=function(_0xdea0a,_0xdb735){return db['OpenchannelQueue'][_0xa397('0x50')]({'where':{'id':_0xdea0a['params']['id']}})[_0xa397('0x2b')](handleEntityNotFound(_0xdb735,null))[_0xa397('0x2b')](removeEntity(_0xdb735,null))['catch'](handleError(_0xdb735,null));};exports[_0xa397('0x5a')]=function(_0x1f8ed6,_0x7a3e33){return db[_0xa397('0x35')][_0xa397('0x5a')]()[_0xa397('0x2b')](respondWithResult(_0x7a3e33,null))[_0xa397('0x4c')](handleError(_0x7a3e33,null));};exports[_0xa397('0x5b')]=function(_0x1629ed,_0x158aef,_0x92bfe7){var _0x4e2624={'raw':!![],'where':{}},_0x57c1f6={},_0x347af0;return db[_0xa397('0x35')][_0xa397('0x5c')]({'where':{'id':_0x1629ed[_0xa397('0x4e')]['id']}})[_0xa397('0x2b')](handleEntityNotFound(_0x158aef,null))[_0xa397('0x2b')](function(_0x297e29){if(_0x297e29){_0x347af0=_0x297e29[_0xa397('0x2d')]({'plain':!![]});_0x57c1f6[_0xa397('0x3c')]=_[_0xa397('0x4f')](db[_0xa397('0x5d')][_0xa397('0x5e')]);_0x57c1f6['query']=_[_0xa397('0x4f')](_0x1629ed[_0xa397('0x39')]);_0x57c1f6[_0xa397('0x3a')]=_[_0xa397('0x3b')](_0x57c1f6['model'],_0x57c1f6[_0xa397('0x39')]);_0x4e2624['attributes']=_[_0xa397('0x3b')](_0x57c1f6[_0xa397('0x3c')],qs[_0xa397('0x3e')](_0x1629ed[_0xa397('0x39')][_0xa397('0x3e')]));_0x4e2624[_0xa397('0x3d')]=_0x4e2624['attributes']['length']?_0x4e2624[_0xa397('0x3d')]:_0x57c1f6[_0xa397('0x3c')];if(!_0x1629ed[_0xa397('0x39')][_0xa397('0x40')](_0xa397('0x41'))){_0x4e2624[_0xa397('0x25')]=qs[_0xa397('0x25')](_0x1629ed[_0xa397('0x39')][_0xa397('0x25')]);_0x4e2624[_0xa397('0x24')]=qs['offset'](_0x1629ed[_0xa397('0x39')][_0xa397('0x24')]);}_0x4e2624['order']=qs['sort'](_0x1629ed['query'][_0xa397('0x43')]);_0x4e2624[_0xa397('0x44')]=qs[_0xa397('0x3a')](_[_0xa397('0x45')](_0x1629ed[_0xa397('0x39')],_0x57c1f6['filters']));_0x4e2624['where'][_0xa397('0x5f')]=_0x297e29['id'];if(_0x1629ed['query'][_0xa397('0x46')]){_0x4e2624[_0xa397('0x44')]=_[_0xa397('0x47')](_0x4e2624[_0xa397('0x44')],{'$or':_['map'](_0x4e2624[_0xa397('0x3d')],function(_0x25bd90){var _0x1f5584={};_0x1f5584[_0x25bd90]={'$like':'%'+_0x1629ed[_0xa397('0x39')][_0xa397('0x46')]+'%'};return _0x1f5584;})});}_0x4e2624=_[_0xa397('0x47')]({},_0x4e2624,_0x1629ed[_0xa397('0x49')]);return db[_0xa397('0x5d')][_0xa397('0x60')](_0x4e2624);}})[_0xa397('0x2b')](function(_0x30f8e3){if(_0x30f8e3){return db[_0xa397('0x61')][_0xa397('0x62')]({'where':{'id':_['map'](_0x30f8e3,'UserId'),'role':_0xa397('0x63')},'attributes':['id',_0xa397('0x32'),_0xa397('0x64'),'updatedAt',_0xa397('0x65')]});}})[_0xa397('0x2b')](function(_0x446667){if(_0x446667){return{'count':_0x446667[_0xa397('0x23')],'rows':_['map'](_0x446667[_0xa397('0x66')],function(_0x1daada){return{'membername':_0x1daada[_0xa397('0x32')],'UserId':_0x1daada['id'],'queue_name':_0x347af0[_0xa397('0x32')],'OpenchannelQueueId':_0x347af0['id'],'interface':util[_0xa397('0x67')](_0xa397('0x68'),_0xa397('0x69'),_0x1daada[_0xa397('0x32')]),'penalty':0x0,'paused':_0x1daada[_0xa397('0x64')],'createdAt':_0x1daada[_0xa397('0x65')],'updatedAt':_0x1daada['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa397('0x2b')](respondWithFilteredResult(_0x158aef,_0x4e2624))[_0xa397('0x4c')](handleError(_0x158aef,null));};exports[_0xa397('0x6a')]=function(_0xc913e0,_0x3728ce,_0x3443ed){var _0xbc4cc3={};var _0x4a5a80={};var _0x1b2846;var _0x300ad1;return db[_0xa397('0x35')][_0xa397('0x5c')]({'where':{'id':_0xc913e0[_0xa397('0x4e')]['id']}})[_0xa397('0x2b')](handleEntityNotFound(_0x3728ce,null))[_0xa397('0x2b')](function(_0x5df3b5){if(_0x5df3b5){_0x1b2846=_0x5df3b5;_0x4a5a80[_0xa397('0x3c')]=_[_0xa397('0x4f')](db['Team'][_0xa397('0x5e')]);_0x4a5a80[_0xa397('0x39')]=_[_0xa397('0x4f')](_0xc913e0[_0xa397('0x39')]);_0x4a5a80[_0xa397('0x3a')]=_['intersection'](_0x4a5a80['model'],_0x4a5a80['query']);_0xbc4cc3[_0xa397('0x3d')]=_[_0xa397('0x3b')](_0x4a5a80['model'],qs[_0xa397('0x3e')](_0xc913e0['query'][_0xa397('0x3e')]));_0xbc4cc3['attributes']=_0xbc4cc3[_0xa397('0x3d')][_0xa397('0x3f')]?_0xbc4cc3[_0xa397('0x3d')]:_0x4a5a80[_0xa397('0x3c')];_0xbc4cc3[_0xa397('0x42')]=qs[_0xa397('0x43')](_0xc913e0['query'][_0xa397('0x43')]);_0xbc4cc3['where']=qs[_0xa397('0x3a')](_[_0xa397('0x45')](_0xc913e0[_0xa397('0x39')],_0x4a5a80[_0xa397('0x3a')]));if(_0xc913e0[_0xa397('0x39')]['filter']){_0xbc4cc3['where']=_[_0xa397('0x47')](_0xbc4cc3['where'],{'$or':_[_0xa397('0x34')](_0xbc4cc3[_0xa397('0x3d')],function(_0x3b6bb9){var _0x522650={};_0x522650[_0x3b6bb9]={'$like':'%'+_0xc913e0['query'][_0xa397('0x46')]+'%'};return _0x522650;})});}_0xbc4cc3=_['merge']({},_0xbc4cc3,_0xc913e0[_0xa397('0x49')]);return _0x1b2846[_0xa397('0x6a')](_0xbc4cc3);}})['then'](function(_0x1f6f02){if(_0x1f6f02){_0x300ad1=_0x1f6f02[_0xa397('0x3f')];if(!_0xc913e0[_0xa397('0x39')]['hasOwnProperty']('nolimit')){_0xbc4cc3[_0xa397('0x25')]=qs['limit'](_0xc913e0[_0xa397('0x39')][_0xa397('0x25')]);_0xbc4cc3[_0xa397('0x24')]=qs[_0xa397('0x24')](_0xc913e0[_0xa397('0x39')][_0xa397('0x24')]);}return _0x1b2846[_0xa397('0x6a')](_0xbc4cc3);}})[_0xa397('0x2b')](function(_0x3a65a6){if(_0x3a65a6){return _0x3a65a6?{'count':_0x300ad1,'rows':_0x3a65a6}:null;}})[_0xa397('0x2b')](respondWithResult(_0x3728ce,null))[_0xa397('0x4c')](handleError(_0x3728ce,null));};exports[_0xa397('0x6b')]=function(_0x58a25f,_0x4c1a0d,_0x419b3d){var _0x3e4a4e=_0x58a25f[_0xa397('0x52')][_0xa397('0x6c')];return db[_0xa397('0x6d')][_0xa397('0x60')]({'where':{'id':_0x3e4a4e},'attributes':['id'],'include':[{'model':db[_0xa397('0x61')],'as':_0xa397('0x6e'),'attributes':['id','name',_0xa397('0x6f'),_0xa397('0x70'),_0xa397('0x71')],'raw':!![]}]})['then'](function(_0x2d1435){if(_0x2d1435){var _0x2a0734=_[_0xa397('0x72')](_0x2d1435,function(_0x17d781){var _0x19155c=_0x17d781['get']({'plain':!![]});return _0x19155c[_0xa397('0x6e')];});return db[_0xa397('0x35')][_0xa397('0x50')]({'where':{'id':_0x58a25f[_0xa397('0x4e')]['id']}})[_0xa397('0x2b')](function(_0x3e8b75){return db[_0xa397('0x73')][_0xa397('0x74')](function(_0x974f34){return _0x3e8b75[_0xa397('0x6b')](_0x3e4a4e,{'transaction':_0x974f34})['then'](function(){return BPromise[_0xa397('0x75')](_0x2a0734,function(_0x3db01e){return db[_0xa397('0x5d')][_0xa397('0x76')]({'where':{'UserId':_0x3db01e['id'],'OpenchannelQueueId':_0x58a25f[_0xa397('0x4e')]['id']},'transaction':_0x974f34});});})[_0xa397('0x2b')](function(){_0x2a0734[_0xa397('0x77')](function(_0x5cbdfa){socket[_0xa397('0x78')](_0xa397('0x79'),{'UserId':_0x5cbdfa['id'],'OpenchannelQueueId':_0x3e8b75['id']});});});});});}})['then'](respondWithStatusCode(_0x4c1a0d,null))[_0xa397('0x4c')](handleError(_0x4c1a0d,null));};exports[_0xa397('0x7a')]=function(_0xd138fb,_0x2ffea6,_0x383592){return db[_0xa397('0x6d')]['findAll']({'where':{'id':_0xd138fb[_0xa397('0x39')][_0xa397('0x6c')]},'attributes':['id'],'include':[{'model':db[_0xa397('0x61')],'as':_0xa397('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2ffea6,null))[_0xa397('0x2b')](function(_0x46bf97){var _0x5c3809=_[_0xa397('0x34')](_0x46bf97,'id');var _0x5c0fab=[];var _0x57b23a=[];var _0x1623c6=squel[_0xa397('0x7b')]();_0x1623c6['field']('tq.TeamId')[_0xa397('0x7c')](_0xa397('0x7d'),'tq')[_0xa397('0x7e')](_0xa397('0x7f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa397('0x44')](_0xa397('0x80'),_0xd138fb[_0xa397('0x4e')]['id']);for(var _0x174ddc=0x0;_0x174ddc<_0x46bf97[_0xa397('0x3f')];_0x174ddc+=0x1){let _0x292b8c=_0x46bf97[_0x174ddc];for(var _0x123ce5=0x0;_0x123ce5<_0x292b8c[_0xa397('0x6e')]['length'];_0x123ce5+=0x1){let _0x56dbac=_0x292b8c[_0xa397('0x6e')][_0x123ce5];var _0x1987c7=_0x1623c6[_0xa397('0x81')]();_0x1987c7[_0xa397('0x44')]('ut.UserId\x20=\x20?',_0x56dbac['id']);_0x57b23a['push'](db[_0xa397('0x73')][_0xa397('0x39')](_0x1987c7[_0xa397('0x82')](),{'type':db[_0xa397('0x73')]['QueryTypes']['SELECT']})[_0xa397('0x2b')](function(_0x1cc5f8){if(_0x1cc5f8[_0xa397('0x3f')]===0x1){return _0x56dbac['id'];}else{var _0x3c6b5d=_[_0xa397('0x83')](_['map'](_0x1cc5f8,_0xa397('0x84')),function(_0x242fba){return _['includes'](_0x5c3809,_0x242fba);});if(_0x3c6b5d){return _0x56dbac['id'];}}}));}}return BPromise['all'](_0x57b23a)[_0xa397('0x2b')](function(_0x490c41){_0x5c0fab=_(_0x5c0fab)[_0xa397('0x85')](_0x490c41)[_0xa397('0x86')]()[_0xa397('0x87')]();return db['OpenchannelQueue'][_0xa397('0x50')]({'where':{'id':_0xd138fb[_0xa397('0x4e')]['id']}})['then'](function(_0x489139){return db[_0xa397('0x73')][_0xa397('0x74')](function(_0x39a0ce){return _0x489139['removeTeams'](_0xd138fb[_0xa397('0x39')]['ids'],{'transaction':_0x39a0ce})['then'](function(){if(!_['isEmpty'](_0x5c0fab)){return _0x489139[_0xa397('0x88')](_0x5c0fab,{'transaction':_0x39a0ce});}})['then'](function(){_0x5c0fab[_0xa397('0x77')](function(_0x138217){socket[_0xa397('0x78')](_0xa397('0x89'),{'UserId':_0x138217,'OpenchannelQueueId':_0x489139['id']});});});});});});})['then'](respondWithStatusCode(_0x2ffea6,null))[_0xa397('0x4c')](handleError(_0x2ffea6,null));};exports[_0xa397('0x8a')]=function(_0x22bd67,_0x5924a0,_0x1a8764){return db[_0xa397('0x35')][_0xa397('0x50')]({'where':{'id':_0x22bd67[_0xa397('0x4e')]['id']}})[_0xa397('0x2b')](handleEntityNotFound(_0x5924a0,null))[_0xa397('0x2b')](function(_0xd561f2){if(_0xd561f2){return _0xd561f2[_0xa397('0x8a')](_0x22bd67[_0xa397('0x52')]['ids'],_[_0xa397('0x8b')](_0x22bd67[_0xa397('0x52')],['ids','id'])||{})[_0xa397('0x8c')](function(_0x27c773){for(var _0xf9d763=0x0;_0xf9d763<_0x22bd67['body'][_0xa397('0x6c')]['length'];_0xf9d763+=0x1){socket[_0xa397('0x78')](_0xa397('0x79'),{'UserId':_0x22bd67[_0xa397('0x52')][_0xa397('0x6c')][_0xf9d763],'OpenchannelQueueId':_0x22bd67['params']['id']});}return _0x27c773;});}})[_0xa397('0x2b')](respondWithResult(_0x5924a0,null))['catch'](handleError(_0x5924a0,null));};exports[_0xa397('0x88')]=function(_0x47c02c,_0x156d41,_0x856b8c){return db[_0xa397('0x35')][_0xa397('0x50')]({'where':{'id':_0x47c02c[_0xa397('0x4e')]['id']}})[_0xa397('0x2b')](handleEntityNotFound(_0x156d41,null))[_0xa397('0x2b')](function(_0x2386f5){if(_0x2386f5){return _0x2386f5['removeAgents'](_0x47c02c[_0xa397('0x39')][_0xa397('0x6c')])[_0xa397('0x2b')](function(){if(_[_0xa397('0x8d')](_0x47c02c[_0xa397('0x39')]['ids'])){for(var _0x5679d5=0x0;_0x5679d5<_0x47c02c[_0xa397('0x39')][_0xa397('0x6c')][_0xa397('0x3f')];_0x5679d5+=0x1){socket[_0xa397('0x78')](_0xa397('0x89'),{'UserId':Number(_0x47c02c['query']['ids'][_0x5679d5]),'OpenchannelQueueId':Number(_0x47c02c[_0xa397('0x4e')]['id'])});}}else{socket[_0xa397('0x78')](_0xa397('0x89'),{'UserId':Number(_0x47c02c[_0xa397('0x39')][_0xa397('0x6c')]),'OpenchannelQueueId':Number(_0x47c02c[_0xa397('0x4e')]['id'])});}});}})[_0xa397('0x2b')](respondWithStatusCode(_0x156d41,null))['catch'](handleError(_0x156d41,null));};exports[_0xa397('0x8e')]=function(_0xc0a3f5,_0x4d3f64,_0x418160){var _0x27e402={};var _0x1507f5={};var _0x4103d1;var _0x5b602b;return db[_0xa397('0x35')][_0xa397('0x5c')]({'where':{'id':_0xc0a3f5[_0xa397('0x4e')]['id']}})[_0xa397('0x2b')](handleEntityNotFound(_0x4d3f64,null))[_0xa397('0x2b')](function(_0xeafbe8){if(_0xeafbe8){_0x4103d1=_0xeafbe8;_0x1507f5[_0xa397('0x3c')]=_['keys'](db[_0xa397('0x61')][_0xa397('0x5e')]);_0x1507f5[_0xa397('0x39')]=_[_0xa397('0x4f')](_0xc0a3f5[_0xa397('0x39')]);_0x1507f5['filters']=_['intersection'](_0x1507f5[_0xa397('0x3c')],_0x1507f5[_0xa397('0x39')]);_0x27e402[_0xa397('0x3d')]=_[_0xa397('0x3b')](_0x1507f5['model'],qs[_0xa397('0x3e')](_0xc0a3f5[_0xa397('0x39')][_0xa397('0x3e')]));_0x27e402['attributes']=_0x27e402[_0xa397('0x3d')][_0xa397('0x3f')]?_0x27e402[_0xa397('0x3d')]:_0x1507f5['model'];_0x27e402[_0xa397('0x42')]=qs[_0xa397('0x43')](_0xc0a3f5['query'][_0xa397('0x43')]);_0x27e402['where']=qs['filters'](_[_0xa397('0x45')](_0xc0a3f5[_0xa397('0x39')],_0x1507f5[_0xa397('0x3a')]));if(_0xc0a3f5[_0xa397('0x39')]['filter']){_0x27e402[_0xa397('0x44')]=_[_0xa397('0x47')](_0x27e402[_0xa397('0x44')],{'$or':_[_0xa397('0x34')](_0x27e402[_0xa397('0x3d')],function(_0x451e7b){var _0x48655e={};_0x48655e[_0x451e7b]={'$like':'%'+_0xc0a3f5[_0xa397('0x39')][_0xa397('0x46')]+'%'};return _0x48655e;})});}_0x27e402=_[_0xa397('0x47')]({},_0x27e402,_0xc0a3f5[_0xa397('0x49')]);return _0x4103d1['getAgents'](_0x27e402);}})[_0xa397('0x2b')](function(_0x58e5f2){if(_0x58e5f2){_0x5b602b=_0x58e5f2[_0xa397('0x3f')];if(!_0xc0a3f5[_0xa397('0x39')][_0xa397('0x40')](_0xa397('0x41'))){_0x27e402[_0xa397('0x25')]=qs[_0xa397('0x25')](_0xc0a3f5['query'][_0xa397('0x25')]);_0x27e402[_0xa397('0x24')]=qs[_0xa397('0x24')](_0xc0a3f5[_0xa397('0x39')][_0xa397('0x24')]);}return _0x4103d1[_0xa397('0x8e')](_0x27e402);}})['then'](function(_0x12e76d){if(_0x12e76d){return _0x12e76d?{'count':_0x5b602b,'rows':_0x12e76d}:null;}})[_0xa397('0x2b')](respondWithResult(_0x4d3f64,null))[_0xa397('0x4c')](handleError(_0x4d3f64,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index ad3a13c..080b909 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 _0x120c=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x1121fc,_0x3ad11a){var _0x7963c3=function(_0x257bf0){while(--_0x257bf0){_0x1121fc['push'](_0x1121fc['shift']());}};_0x7963c3(++_0x3ad11a);}(_0x120c,0x86));var _0xc120=function(_0x1ef5ef,_0xcd1f4f){_0x1ef5ef=_0x1ef5ef-0x0;var _0x457a8d=_0x120c[_0x1ef5ef];return _0x457a8d;};'use strict';var EventEmitter=require(_0xc120('0x0'));var OpenchannelQueue=require(_0xc120('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc120('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc120('0x3'),'afterDestroy':_0xc120('0x4')};function emitEvent(_0x32fee3){return function(_0x433175,_0x4097b1,_0x1548d){OpenchannelQueueEvents[_0xc120('0x5')](_0x32fee3+':'+_0x433175['id'],_0x433175);OpenchannelQueueEvents[_0xc120('0x5')](_0x32fee3,_0x433175);_0x1548d(null);};}for(var e in events){if(events[_0xc120('0x6')](e)){var event=events[e];OpenchannelQueue[_0xc120('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x5b1e=['hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit'];(function(_0x25c9a9,_0x5634a0){var _0x39fdf8=function(_0x5b45c9){while(--_0x5b45c9){_0x25c9a9['push'](_0x25c9a9['shift']());}};_0x39fdf8(++_0x5634a0);}(_0x5b1e,0x9b));var _0xe5b1=function(_0x5b89ea,_0x482e88){_0x5b89ea=_0x5b89ea-0x0;var _0x118964=_0x5b1e[_0x5b89ea];return _0x118964;};'use strict';var EventEmitter=require(_0xe5b1('0x0'));var OpenchannelQueue=require(_0xe5b1('0x1'))['db'][_0xe5b1('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe5b1('0x3')](0x0);var events={'afterCreate':_0xe5b1('0x4'),'afterUpdate':'update','afterDestroy':_0xe5b1('0x5')};function emitEvent(_0x3bfbe5){return function(_0xf14ebc,_0x85c758,_0x1e0e4f){OpenchannelQueueEvents['emit'](_0x3bfbe5+':'+_0xf14ebc['id'],_0xf14ebc);OpenchannelQueueEvents[_0xe5b1('0x6')](_0x3bfbe5,_0xf14ebc);_0x1e0e4f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xe5b1('0x7')](e,emitEvent(event));}}module[_0xe5b1('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 05d9304..e4571bd 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 _0x6d2a=['rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x6d2a,0x10e));var _0xa6d2=function(_0x4e9e0d,_0xd86384){_0x4e9e0d=_0x4e9e0d-0x0;var _0x514622=_0x6d2a[_0x4e9e0d];return _0x514622;};'use strict';var _=require(_0xa6d2('0x0'));var util=require(_0xa6d2('0x1'));var logger=require(_0xa6d2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa6d2('0x3'));var rp=require(_0xa6d2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa6d2('0x5'));var config=require(_0xa6d2('0x6'));var attributes=require(_0xa6d2('0x7'));module['exports']=function(_0x54fa5a,_0x30d4f3){return _0x54fa5a[_0xa6d2('0x8')](_0xa6d2('0x9'),attributes,{'tableName':_0xa6d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8760=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','moment'];(function(_0x5d9434,_0x57bfbe){var _0x3f471d=function(_0x5a0a5e){while(--_0x5a0a5e){_0x5d9434['push'](_0x5d9434['shift']());}};_0x3f471d(++_0x57bfbe);}(_0x8760,0x15a));var _0x0876=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x8760[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0876('0x0'));var util=require('util');var logger=require(_0x0876('0x1'))(_0x0876('0x2'));var moment=require(_0x0876('0x3'));var BPromise=require(_0x0876('0x4'));var rp=require(_0x0876('0x5'));var fs=require('fs');var path=require(_0x0876('0x6'));var rimraf=require(_0x0876('0x7'));var config=require(_0x0876('0x8'));var attributes=require(_0x0876('0x9'));module[_0x0876('0xa')]=function(_0x30e12e,_0xaa21ca){return _0x30e12e[_0x0876('0xb')](_0x0876('0xc'),attributes,{'tableName':_0x0876('0xd'),'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 9844dfe..7aa71af 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 _0x392b=['result','catch','OpenchannelQueue','raw','options','where','attributes','limit','include','map','model','info','GetOpenchannelQueue','debug','ShowOpenchannelQueue','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x23a44d,_0x584c9d){var _0x4f4a7d=function(_0x16de29){while(--_0x16de29){_0x23a44d['push'](_0x23a44d['shift']());}};_0x4f4a7d(++_0x584c9d);}(_0x392b,0x1f1));var _0xb392=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x392b[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb392('0x0'));var BPromise=require(_0xb392('0x1'));var rs=require(_0xb392('0x2'));var fs=require('fs');var Redis=require(_0xb392('0x3'));var db=require(_0xb392('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb392('0x5'))(_0xb392('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb392('0x7')][_0xb392('0x8')]({'port':0x232a});config[_0xb392('0x9')]=_[_0xb392('0xa')](config[_0xb392('0x9')],{'host':_0xb392('0xb'),'port':0x18eb});var socket=require(_0xb392('0xc'))(new Redis(config[_0xb392('0x9')]));require('./openchannelQueue.socket')[_0xb392('0xd')](socket);function respondWithRpcPromise(_0x252d9d,_0x1a6e33,_0x3528d1){return new BPromise(function(_0x45b156,_0x1f9e82){return client['request'](_0x252d9d,_0x3528d1)[_0xb392('0xe')](function(_0x2d2567){logger['info'](_0xb392('0xf'),_0x1a6e33,_0xb392('0x10'));logger['debug'](_0xb392('0x11'),_0x1a6e33,_0xb392('0x10'),JSON['stringify'](_0x2d2567));if(_0x2d2567[_0xb392('0x12')]){if(_0x2d2567[_0xb392('0x12')][_0xb392('0x13')]===0x1f4){logger[_0xb392('0x12')](_0xb392('0xf'),_0x1a6e33,_0x2d2567[_0xb392('0x12')]['message']);return _0x1f9e82(_0x2d2567[_0xb392('0x12')][_0xb392('0x14')]);}logger[_0xb392('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x1a6e33,_0x2d2567[_0xb392('0x12')][_0xb392('0x14')]);return _0x45b156(_0x2d2567[_0xb392('0x12')]['message']);}else{logger['info'](_0xb392('0xf'),_0x1a6e33,_0xb392('0x10'));_0x45b156(_0x2d2567[_0xb392('0x15')]['message']);}})[_0xb392('0x16')](function(_0x48cffb){logger[_0xb392('0x12')](_0xb392('0xf'),_0x1a6e33,_0x48cffb);_0x1f9e82(_0x48cffb);});});}exports['GetOpenchannelQueue']=function(_0x4552d3){var _0x3522c6=this;return new Promise(function(_0xd0f23e,_0x5033ec){return db[_0xb392('0x17')]['findAll']({'raw':_0x4552d3['options']?_0x4552d3['options'][_0xb392('0x18')]===undefined?!![]:![]:!![],'where':_0x4552d3[_0xb392('0x19')]?_0x4552d3[_0xb392('0x19')][_0xb392('0x1a')]||null:null,'attributes':_0x4552d3[_0xb392('0x19')]?_0x4552d3[_0xb392('0x19')][_0xb392('0x1b')]||null:null,'limit':_0x4552d3[_0xb392('0x19')]?_0x4552d3[_0xb392('0x19')][_0xb392('0x1c')]||null:null,'include':_0x4552d3[_0xb392('0x19')]?_0x4552d3[_0xb392('0x19')][_0xb392('0x1d')]?_[_0xb392('0x1e')](_0x4552d3['options'][_0xb392('0x1d')],function(_0xb109b4){return{'model':db[_0xb109b4['model']],'as':_0xb109b4['as'],'attributes':_0xb109b4[_0xb392('0x1b')],'include':_0xb109b4['include']?_['map'](_0xb109b4[_0xb392('0x1d')],function(_0x4cb878){return{'model':db[_0x4cb878[_0xb392('0x1f')]],'as':_0x4cb878['as'],'attributes':_0x4cb878[_0xb392('0x1b')],'include':_0x4cb878['include']?_[_0xb392('0x1e')](_0x4cb878[_0xb392('0x1d')],function(_0x29b032){return{'model':db[_0x29b032[_0xb392('0x1f')]],'as':_0x29b032['as'],'attributes':_0x29b032[_0xb392('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb392('0xe')](function(_0x18e9a3){logger[_0xb392('0x20')](_0xb392('0x21'),_0x4552d3);logger[_0xb392('0x22')](_0xb392('0x21'),_0x4552d3,JSON['stringify'](_0x18e9a3));_0xd0f23e(_0x18e9a3);})['catch'](function(_0x31b2a4){logger[_0xb392('0x12')]('GetOpenchannelQueue',_0x31b2a4[_0xb392('0x14')],_0x4552d3);_0x5033ec(_0x3522c6[_0xb392('0x12')](0x1f4,_0x31b2a4[_0xb392('0x14')]));});});};exports[_0xb392('0x23')]=function(_0x2aaaed){var _0x401831=this;return new Promise(function(_0x386e06,_0x5dc77d){return db[_0xb392('0x17')]['find']({'raw':_0x2aaaed['options']?_0x2aaaed['options'][_0xb392('0x18')]===undefined?!![]:![]:!![],'where':_0x2aaaed[_0xb392('0x19')]?_0x2aaaed['options'][_0xb392('0x1a')]||null:null,'attributes':_0x2aaaed['options']?_0x2aaaed['options']['attributes']||null:null,'include':_0x2aaaed[_0xb392('0x19')]?_0x2aaaed[_0xb392('0x19')][_0xb392('0x1d')]?_['map'](_0x2aaaed[_0xb392('0x19')]['include'],function(_0x195644){return{'model':db[_0x195644[_0xb392('0x1f')]],'as':_0x195644['as'],'attributes':_0x195644[_0xb392('0x1b')],'include':_0x195644[_0xb392('0x1d')]?_[_0xb392('0x1e')](_0x195644[_0xb392('0x1d')],function(_0xf24a64){return{'model':db[_0xf24a64[_0xb392('0x1f')]],'as':_0xf24a64['as'],'attributes':_0xf24a64[_0xb392('0x1b')],'include':_0xf24a64['include']?_['map'](_0xf24a64[_0xb392('0x1d')],function(_0x45551c){return{'model':db[_0x45551c[_0xb392('0x1f')]],'as':_0x45551c['as'],'attributes':_0x45551c[_0xb392('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb392('0xe')](function(_0x252dad){logger[_0xb392('0x20')](_0xb392('0x23'),_0x2aaaed);logger[_0xb392('0x22')](_0xb392('0x23'),_0x2aaaed,JSON[_0xb392('0x24')](_0x252dad));_0x386e06(_0x252dad);})[_0xb392('0x16')](function(_0x3019b4){logger[_0xb392('0x12')](_0xb392('0x23'),_0x3019b4[_0xb392('0x14')],_0x2aaaed);_0x5dc77d(_0x401831[_0xb392('0x12')](0x1f4,_0x3019b4[_0xb392('0x14')]));});});}; \ No newline at end of file +var _0x7aa5=['catch','GetOpenchannelQueue','options','attributes','limit','map','include','model','debug','OpenchannelQueue','raw','where','then','ShowOpenchannelQueue','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x416838,_0x446b55){var _0x400efc=function(_0x23a29f){while(--_0x23a29f){_0x416838['push'](_0x416838['shift']());}};_0x400efc(++_0x446b55);}(_0x7aa5,0x146));var _0x57aa=function(_0x1e18c0,_0x44146e){_0x1e18c0=_0x1e18c0-0x0;var _0xdb46a2=_0x7aa5[_0x1e18c0];return _0xdb46a2;};'use strict';var _=require(_0x57aa('0x0'));var util=require(_0x57aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57aa('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x57aa('0x3'));var logger=require(_0x57aa('0x4'))(_0x57aa('0x5'));var config=require(_0x57aa('0x6'));var jayson=require(_0x57aa('0x7'));var client=jayson[_0x57aa('0x8')][_0x57aa('0x9')]({'port':0x232a});config['redis']=_[_0x57aa('0xa')](config['redis'],{'host':_0x57aa('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57aa('0xc')]));require(_0x57aa('0xd'))[_0x57aa('0xe')](socket);function respondWithRpcPromise(_0x4074f6,_0x2b6c74,_0x20d770){return new BPromise(function(_0x152420,_0x3bfc0a){return client[_0x57aa('0xf')](_0x4074f6,_0x20d770)['then'](function(_0x367e22){logger[_0x57aa('0x10')](_0x57aa('0x11'),_0x2b6c74,_0x57aa('0x12'));logger['debug'](_0x57aa('0x13'),_0x2b6c74,_0x57aa('0x12'),JSON[_0x57aa('0x14')](_0x367e22));if(_0x367e22[_0x57aa('0x15')]){if(_0x367e22[_0x57aa('0x15')][_0x57aa('0x16')]===0x1f4){logger[_0x57aa('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x2b6c74,_0x367e22[_0x57aa('0x15')][_0x57aa('0x17')]);return _0x3bfc0a(_0x367e22[_0x57aa('0x15')]['message']);}logger['error'](_0x57aa('0x11'),_0x2b6c74,_0x367e22[_0x57aa('0x15')][_0x57aa('0x17')]);return _0x152420(_0x367e22['error'][_0x57aa('0x17')]);}else{logger[_0x57aa('0x10')](_0x57aa('0x11'),_0x2b6c74,_0x57aa('0x12'));_0x152420(_0x367e22[_0x57aa('0x18')][_0x57aa('0x17')]);}})[_0x57aa('0x19')](function(_0x2d2130){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x2b6c74,_0x2d2130);_0x3bfc0a(_0x2d2130);});});}exports[_0x57aa('0x1a')]=function(_0x2eccc1){var _0x5e550c=this;return new Promise(function(_0x1d00ed,_0x5bb16c){return db['OpenchannelQueue']['findAll']({'raw':_0x2eccc1['options']?_0x2eccc1[_0x57aa('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2eccc1[_0x57aa('0x1b')]?_0x2eccc1['options']['where']||null:null,'attributes':_0x2eccc1['options']?_0x2eccc1[_0x57aa('0x1b')][_0x57aa('0x1c')]||null:null,'limit':_0x2eccc1[_0x57aa('0x1b')]?_0x2eccc1[_0x57aa('0x1b')][_0x57aa('0x1d')]||null:null,'include':_0x2eccc1[_0x57aa('0x1b')]?_0x2eccc1[_0x57aa('0x1b')]['include']?_[_0x57aa('0x1e')](_0x2eccc1[_0x57aa('0x1b')][_0x57aa('0x1f')],function(_0x4cfa00){return{'model':db[_0x4cfa00['model']],'as':_0x4cfa00['as'],'attributes':_0x4cfa00[_0x57aa('0x1c')],'include':_0x4cfa00[_0x57aa('0x1f')]?_[_0x57aa('0x1e')](_0x4cfa00['include'],function(_0x5fd09e){return{'model':db[_0x5fd09e['model']],'as':_0x5fd09e['as'],'attributes':_0x5fd09e[_0x57aa('0x1c')],'include':_0x5fd09e[_0x57aa('0x1f')]?_[_0x57aa('0x1e')](_0x5fd09e[_0x57aa('0x1f')],function(_0x290f2c){return{'model':db[_0x290f2c[_0x57aa('0x20')]],'as':_0x290f2c['as'],'attributes':_0x290f2c[_0x57aa('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33b210){logger[_0x57aa('0x10')]('GetOpenchannelQueue',_0x2eccc1);logger[_0x57aa('0x21')](_0x57aa('0x1a'),_0x2eccc1,JSON[_0x57aa('0x14')](_0x33b210));_0x1d00ed(_0x33b210);})[_0x57aa('0x19')](function(_0x4a0c5a){logger['error'](_0x57aa('0x1a'),_0x4a0c5a[_0x57aa('0x17')],_0x2eccc1);_0x5bb16c(_0x5e550c[_0x57aa('0x15')](0x1f4,_0x4a0c5a[_0x57aa('0x17')]));});});};exports['ShowOpenchannelQueue']=function(_0x1c9beb){var _0x1cf8fc=this;return new Promise(function(_0x12f3c9,_0x586916){return db[_0x57aa('0x22')]['find']({'raw':_0x1c9beb[_0x57aa('0x1b')]?_0x1c9beb['options'][_0x57aa('0x23')]===undefined?!![]:![]:!![],'where':_0x1c9beb['options']?_0x1c9beb[_0x57aa('0x1b')][_0x57aa('0x24')]||null:null,'attributes':_0x1c9beb['options']?_0x1c9beb[_0x57aa('0x1b')][_0x57aa('0x1c')]||null:null,'include':_0x1c9beb[_0x57aa('0x1b')]?_0x1c9beb[_0x57aa('0x1b')][_0x57aa('0x1f')]?_['map'](_0x1c9beb[_0x57aa('0x1b')][_0x57aa('0x1f')],function(_0x1d15c4){return{'model':db[_0x1d15c4['model']],'as':_0x1d15c4['as'],'attributes':_0x1d15c4['attributes'],'include':_0x1d15c4[_0x57aa('0x1f')]?_[_0x57aa('0x1e')](_0x1d15c4[_0x57aa('0x1f')],function(_0x40c8fe){return{'model':db[_0x40c8fe[_0x57aa('0x20')]],'as':_0x40c8fe['as'],'attributes':_0x40c8fe[_0x57aa('0x1c')],'include':_0x40c8fe[_0x57aa('0x1f')]?_[_0x57aa('0x1e')](_0x40c8fe[_0x57aa('0x1f')],function(_0x51c1bc){return{'model':db[_0x51c1bc[_0x57aa('0x20')]],'as':_0x51c1bc['as'],'attributes':_0x51c1bc['attributes']};}):[]};}):[]};}):[]:[]})[_0x57aa('0x25')](function(_0x17c50d){logger[_0x57aa('0x10')](_0x57aa('0x26'),_0x1c9beb);logger['debug'](_0x57aa('0x26'),_0x1c9beb,JSON[_0x57aa('0x14')](_0x17c50d));_0x12f3c9(_0x17c50d);})[_0x57aa('0x19')](function(_0x1a99af){logger[_0x57aa('0x15')](_0x57aa('0x26'),_0x1a99af[_0x57aa('0x17')],_0x1c9beb);_0x586916(_0x1cf8fc['error'](0x1f4,_0x1a99af[_0x57aa('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 5a113c1..c3380a1 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 _0x802c=['removeListener','length','openchannelQueue:'];(function(_0x4035a2,_0x4a5236){var _0x1fa308=function(_0xe8ea6f){while(--_0xe8ea6f){_0x4035a2['push'](_0x4035a2['shift']());}};_0x1fa308(++_0x4a5236);}(_0x802c,0xfc));var _0xc802=function(_0x586787,_0x202008){_0x586787=_0x586787-0x0;var _0x83ce0e=_0x802c[_0x586787];return _0x83ce0e;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove','update'];function createListener(_0x15cbc8,_0xe8dfee){return function(_0x54c8ed){_0xe8dfee['emit'](_0x15cbc8,_0x54c8ed);};}function removeListener(_0x5670c5,_0x571dfc){return function(){OpenchannelQueueEvents[_0xc802('0x0')](_0x5670c5,_0x571dfc);};}exports['register']=function(_0x56d1be){for(var _0x467ffb=0x0,_0x121be9=events[_0xc802('0x1')];_0x467ffb<_0x121be9;_0x467ffb++){var _0x4c5d34=events[_0x467ffb];var _0x3509ca=createListener(_0xc802('0x2')+_0x4c5d34,_0x56d1be);OpenchannelQueueEvents['on'](_0x4c5d34,_0x3509ca);}}; \ No newline at end of file +var _0xa67a=['remove','removeListener','register','length','./openchannelQueue.events','save'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xa67a,0x18a));var _0xaa67=function(_0xfacfaf,_0x3e00a0){_0xfacfaf=_0xfacfaf-0x0;var _0x3e4851=_0xa67a[_0xfacfaf];return _0x3e4851;};'use strict';var OpenchannelQueueEvents=require(_0xaa67('0x0'));var events=[_0xaa67('0x1'),_0xaa67('0x2'),'update'];function createListener(_0x347630,_0x2168cd){return function(_0x2e2633){_0x2168cd['emit'](_0x347630,_0x2e2633);};}function removeListener(_0x11b775,_0x2328e1){return function(){OpenchannelQueueEvents[_0xaa67('0x3')](_0x11b775,_0x2328e1);};}exports[_0xaa67('0x4')]=function(_0x1fab38){for(var _0x4fdd11=0x0,_0x183236=events[_0xaa67('0x5')];_0x4fdd11<_0x183236;_0x4fdd11++){var _0x106921=events[_0x4fdd11];var _0x20dfa7=createListener('openchannelQueue:'+_0x106921,_0x1fab38);OpenchannelQueueEvents['on'](_0x106921,_0x20dfa7);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 58240bd..bfdd406 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 _0x8007=['exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','delete','/:id'];(function(_0x2f8d06,_0x13fc5e){var _0x554a8e=function(_0x28aacb){while(--_0x28aacb){_0x2f8d06['push'](_0x2f8d06['shift']());}};_0x554a8e(++_0x13fc5e);}(_0x8007,0xab));var _0x7800=function(_0x2b89dc,_0x453e50){_0x2b89dc=_0x2b89dc-0x0;var _0x3178fb=_0x8007[_0x2b89dc];return _0x3178fb;};'use strict';var multer=require(_0x7800('0x0'));var util=require('util');var path=require(_0x7800('0x1'));var timeout=require('connect-timeout');var express=require(_0x7800('0x2'));var router=express['Router']();var auth=require(_0x7800('0x3'));var interaction=require(_0x7800('0x4'));var config=require(_0x7800('0x5'));var controller=require(_0x7800('0x6'));router[_0x7800('0x7')]('/',auth[_0x7800('0x8')](),controller[_0x7800('0x9')]);router[_0x7800('0x7')](_0x7800('0xa'),auth[_0x7800('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7800('0xb')]);router[_0x7800('0xc')]('/',auth[_0x7800('0x8')](),controller[_0x7800('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7800('0xe')](_0x7800('0xf'),auth[_0x7800('0x8')](),controller['destroy']);module[_0x7800('0x10')]=router; \ No newline at end of file +var _0x76cb=['put','update','delete','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','create'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x76cb,0xad));var _0xb76c=function(_0x18c4a8,_0x96c52e){_0x18c4a8=_0x18c4a8-0x0;var _0x189ff1=_0x76cb[_0x18c4a8];return _0x189ff1;};'use strict';var multer=require(_0xb76c('0x0'));var util=require(_0xb76c('0x1'));var path=require('path');var timeout=require(_0xb76c('0x2'));var express=require(_0xb76c('0x3'));var router=express[_0xb76c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb76c('0x5'));var config=require(_0xb76c('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0xb76c('0x7')]('/',auth[_0xb76c('0x8')](),controller[_0xb76c('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb76c('0xa')]);router[_0xb76c('0x7')](_0xb76c('0xb'),auth[_0xb76c('0x8')](),controller[_0xb76c('0xc')]);router['post']('/',auth[_0xb76c('0x8')](),controller[_0xb76c('0xd')]);router[_0xb76c('0xe')](_0xb76c('0xb'),auth['isAuthenticated'](),controller[_0xb76c('0xf')]);router[_0xb76c('0x10')](_0xb76c('0xb'),auth[_0xb76c('0x8')](),controller['destroy']);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 1b25c5f..bbe71d5 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 _0x9fa5=['exports','STRING','DATE','moment','sequelize'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0x9fa5,0x134));var _0x59fa=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x9fa5[_0x220dbb];return _0x2b77de;};'use strict';var moment=require(_0x59fa('0x0'));var Sequelize=require(_0x59fa('0x1'));module[_0x59fa('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x59fa('0x3')]},'joinAt':{'type':Sequelize[_0x59fa('0x4')]},'leaveAt':{'type':Sequelize[_0x59fa('0x4')]},'acceptAt':{'type':Sequelize[_0x59fa('0x4')]},'exitAt':{'type':Sequelize[_0x59fa('0x4')]},'reason':{'type':Sequelize[_0x59fa('0x3')]}}; \ No newline at end of file +var _0x4dc4=['sequelize','STRING','DATE'];(function(_0x1a58dc,_0x3ea47c){var _0xa4a533=function(_0x43df17){while(--_0x43df17){_0x1a58dc['push'](_0x1a58dc['shift']());}};_0xa4a533(++_0x3ea47c);}(_0x4dc4,0x9f));var _0x44dc=function(_0x4a262a,_0x7fba98){_0x4a262a=_0x4a262a-0x0;var _0x331b66=_0x4dc4[_0x4a262a];return _0x331b66;};'use strict';var moment=require('moment');var Sequelize=require(_0x44dc('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x44dc('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x44dc('0x1')]},'joinAt':{'type':Sequelize[_0x44dc('0x2')]},'leaveAt':{'type':Sequelize[_0x44dc('0x2')]},'acceptAt':{'type':Sequelize[_0x44dc('0x2')]},'exitAt':{'type':Sequelize[_0x44dc('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ff42fda..e0b88ad 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 _0x682e=['OpenchannelQueueReport','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','rawAttributes','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index'];(function(_0x4fb9f0,_0x6ef03d){var _0xee433e=function(_0x5c76fc){while(--_0x5c76fc){_0x4fb9f0['push'](_0x4fb9f0['shift']());}};_0xee433e(++_0x6ef03d);}(_0x682e,0x1ce));var _0xe682=function(_0xbe9336,_0x1f51b5){_0xbe9336=_0xbe9336-0x0;var _0x9292b7=_0x682e[_0xbe9336];return _0x9292b7;};'use strict';var pdf=require(_0xe682('0x0'));var emlformat=require(_0xe682('0x1'));var rimraf=require(_0xe682('0x2'));var zipdir=require(_0xe682('0x3'));var jsonpatch=require(_0xe682('0x4'));var rp=require(_0xe682('0x5'));var moment=require('moment');var BPromise=require(_0xe682('0x6'));var Mustache=require(_0xe682('0x7'));var util=require(_0xe682('0x8'));var path=require(_0xe682('0x9'));var sox=require(_0xe682('0xa'));var csv=require(_0xe682('0xb'));var ejs=require(_0xe682('0xc'));var fs=require('fs');var _=require(_0xe682('0xd'));var squel=require(_0xe682('0xe'));var crypto=require(_0xe682('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe682('0x10'));var toCsv=require(_0xe682('0xb'));var querystring=require(_0xe682('0x11'));var Papa=require(_0xe682('0x12'));var Redis=require(_0xe682('0x13'));var authService=require(_0xe682('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe682('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe682('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xe682('0x17'));var licenseUtil=require(_0xe682('0x18'));var db=require(_0xe682('0x19'))['db'];function respondWithStatusCode(_0x178861,_0x9d0c78){_0x9d0c78=_0x9d0c78||0xcc;return function(_0x27ead7){if(_0x27ead7){return _0x178861['sendStatus'](_0x9d0c78);}return _0x178861[_0xe682('0x1a')](_0x9d0c78)[_0xe682('0x1b')]();};}function respondWithResult(_0x1e4755,_0x32b45a){_0x32b45a=_0x32b45a||0xc8;return function(_0x29ec5a){if(_0x29ec5a){return _0x1e4755[_0xe682('0x1a')](_0x32b45a)[_0xe682('0x1c')](_0x29ec5a);}};}function respondWithFilteredResult(_0x30da5d,_0x5940b8){return function(_0x2de4e8){if(_0x2de4e8){var _0x5e29bd=_0x2de4e8[_0xe682('0x1d')],_0x58c7a6=_0x5940b8[_0xe682('0x1e')],_0x4f08af=_0x5940b8[_0xe682('0x1e')]+_0x5940b8['limit'],_0x14fc2f;if(_0x4f08af>=_0x5e29bd){_0x4f08af=_0x5e29bd;_0x14fc2f=0xc8;}else{_0x14fc2f=0xce;}_0x30da5d[_0xe682('0x1a')](_0x14fc2f);return _0x30da5d['set'](_0xe682('0x1f'),_0x58c7a6+'-'+_0x4f08af+'/'+_0x5e29bd)['json'](_0x2de4e8);}return null;};}function patchUpdates(_0xc1cdfa){return function(_0x5a2b51){try{jsonpatch[_0xe682('0x20')](_0x5a2b51,_0xc1cdfa,!![]);}catch(_0x5b27f6){return BPromise['reject'](_0x5b27f6);}return _0x5a2b51[_0xe682('0x21')]();};}function saveUpdates(_0x5ebf37,_0x36c7e0){return function(_0x368349){if(_0x368349){return _0x368349[_0xe682('0x22')](_0x5ebf37)[_0xe682('0x23')](function(_0x17b70f){return _0x17b70f;});}return null;};}function removeEntity(_0x16fbfe,_0x227139){return function(_0x220eb3){if(_0x220eb3){return _0x220eb3[_0xe682('0x24')]()[_0xe682('0x23')](function(){_0x16fbfe[_0xe682('0x1a')](0xcc)[_0xe682('0x1b')]();});}};}function handleEntityNotFound(_0x46402f,_0x5bfb75){return function(_0x4c5ab3){if(!_0x4c5ab3){_0x46402f[_0xe682('0x25')](0x194);}return _0x4c5ab3;};}function handleError(_0xb0bb2f,_0x32353f){_0x32353f=_0x32353f||0x1f4;return function(_0x4d1502){logger[_0xe682('0x26')](_0x4d1502['stack']);if(_0x4d1502['name']){delete _0x4d1502[_0xe682('0x27')];}_0xb0bb2f[_0xe682('0x1a')](_0x32353f)[_0xe682('0x28')](_0x4d1502);};}exports[_0xe682('0x29')]=function(_0x25a32f,_0x4aaaa0){var _0x4945f1={},_0x58da93={},_0x7af36b={'count':0x0,'rows':[]};var _0x50fae3=_['map'](db[_0xe682('0x2a')]['rawAttributes'],function(_0x263154){return{'name':_0x263154['fieldName'],'type':_0x263154['type'][_0xe682('0x2b')]};});_0x58da93[_0xe682('0x2c')]=_[_0xe682('0x2d')](_0x50fae3,_0xe682('0x27'));_0x58da93['query']=_[_0xe682('0x2e')](_0x25a32f[_0xe682('0x2f')]);_0x58da93[_0xe682('0x30')]=_[_0xe682('0x31')](_0x58da93['model'],_0x58da93[_0xe682('0x2f')]);_0x4945f1['attributes']=_[_0xe682('0x31')](_0x58da93[_0xe682('0x2c')],qs['fields'](_0x25a32f[_0xe682('0x2f')][_0xe682('0x32')]));_0x4945f1['attributes']=_0x4945f1[_0xe682('0x33')][_0xe682('0x34')]?_0x4945f1[_0xe682('0x33')]:_0x58da93[_0xe682('0x2c')];if(!_0x25a32f[_0xe682('0x2f')]['hasOwnProperty'](_0xe682('0x35'))){_0x4945f1[_0xe682('0x36')]=qs[_0xe682('0x36')](_0x25a32f['query'][_0xe682('0x36')]);_0x4945f1[_0xe682('0x1e')]=qs['offset'](_0x25a32f[_0xe682('0x2f')][_0xe682('0x1e')]);}_0x4945f1['order']=qs[_0xe682('0x37')](_0x25a32f[_0xe682('0x2f')][_0xe682('0x37')]);_0x4945f1[_0xe682('0x38')]=qs['filters'](_[_0xe682('0x39')](_0x25a32f[_0xe682('0x2f')],_0x58da93[_0xe682('0x30')]),_0x50fae3);if(_0x25a32f[_0xe682('0x2f')][_0xe682('0x3a')]){_0x4945f1[_0xe682('0x38')]=_[_0xe682('0x3b')](_0x4945f1[_0xe682('0x38')],{'$or':_[_0xe682('0x2d')](_0x50fae3,function(_0x41f226){if(_0x41f226[_0xe682('0x3c')]!==_0xe682('0x3d')){var _0x8f642c={};_0x8f642c[_0x41f226[_0xe682('0x27')]]={'$like':'%'+_0x25a32f[_0xe682('0x2f')]['filter']+'%'};return _0x8f642c;}})});}_0x4945f1=_['merge']({},_0x4945f1,_0x25a32f[_0xe682('0x3e')]);var _0x36e66f={'where':_0x4945f1[_0xe682('0x38')]};return db[_0xe682('0x2a')][_0xe682('0x1d')](_0x36e66f)[_0xe682('0x23')](function(_0x429862){_0x7af36b[_0xe682('0x1d')]=_0x429862;if(_0x25a32f[_0xe682('0x2f')][_0xe682('0x3f')]){_0x4945f1[_0xe682('0x40')]=[{'all':!![]}];}return db[_0xe682('0x2a')]['findAll'](_0x4945f1);})['then'](function(_0x32393c){_0x7af36b[_0xe682('0x41')]=_0x32393c;return _0x7af36b;})[_0xe682('0x23')](respondWithFilteredResult(_0x4aaaa0,_0x4945f1))['catch'](handleError(_0x4aaaa0,null));};exports['show']=function(_0x21384d,_0x5aaa0f){var _0x50fdde={'raw':!![],'where':{'id':_0x21384d['params']['id']}},_0x56ddcb={};_0x56ddcb[_0xe682('0x2c')]=_[_0xe682('0x2e')](db[_0xe682('0x2a')][_0xe682('0x42')]);_0x56ddcb[_0xe682('0x2f')]=_[_0xe682('0x2e')](_0x21384d[_0xe682('0x2f')]);_0x56ddcb[_0xe682('0x30')]=_[_0xe682('0x31')](_0x56ddcb[_0xe682('0x2c')],_0x56ddcb['query']);_0x50fdde[_0xe682('0x33')]=_['intersection'](_0x56ddcb[_0xe682('0x2c')],qs[_0xe682('0x32')](_0x21384d[_0xe682('0x2f')][_0xe682('0x32')]));_0x50fdde[_0xe682('0x33')]=_0x50fdde[_0xe682('0x33')][_0xe682('0x34')]?_0x50fdde['attributes']:_0x56ddcb['model'];if(_0x21384d[_0xe682('0x2f')][_0xe682('0x3f')]){_0x50fdde[_0xe682('0x40')]=[{'all':!![]}];}_0x50fdde=_['merge']({},_0x50fdde,_0x21384d[_0xe682('0x3e')]);return db[_0xe682('0x2a')][_0xe682('0x43')](_0x50fdde)[_0xe682('0x23')](handleEntityNotFound(_0x5aaa0f,null))[_0xe682('0x23')](respondWithResult(_0x5aaa0f,null))[_0xe682('0x44')](handleError(_0x5aaa0f,null));};exports[_0xe682('0x45')]=function(_0x444267,_0x24406c){return db[_0xe682('0x2a')][_0xe682('0x45')](_0x444267['body'],{})[_0xe682('0x23')](respondWithResult(_0x24406c,0xc9))['catch'](handleError(_0x24406c,null));};exports['update']=function(_0x11727e,_0x3dc22e){if(_0x11727e[_0xe682('0x46')]['id']){delete _0x11727e[_0xe682('0x46')]['id'];}return db[_0xe682('0x2a')]['find']({'where':{'id':_0x11727e['params']['id']}})[_0xe682('0x23')](handleEntityNotFound(_0x3dc22e,null))[_0xe682('0x23')](saveUpdates(_0x11727e[_0xe682('0x46')],null))[_0xe682('0x23')](respondWithResult(_0x3dc22e,null))[_0xe682('0x44')](handleError(_0x3dc22e,null));};exports[_0xe682('0x24')]=function(_0x3c71b2,_0x101e52){return db[_0xe682('0x2a')]['find']({'where':{'id':_0x3c71b2['params']['id']}})['then'](handleEntityNotFound(_0x101e52,null))['then'](removeEntity(_0x101e52,null))[_0xe682('0x44')](handleError(_0x101e52,null));};exports[_0xe682('0x47')]=function(_0x41da67,_0xcd6dc9){return db[_0xe682('0x2a')][_0xe682('0x47')]()[_0xe682('0x23')](respondWithResult(_0xcd6dc9,null))[_0xe682('0x44')](handleError(_0xcd6dc9,null));}; \ No newline at end of file +var _0xdecb=['VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','reject','destroy','then','error','stack','name','OpenchannelQueueReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','filter','where','merge'];(function(_0xb39e3b,_0x2be5df){var _0x40515c=function(_0x58e386){while(--_0x58e386){_0xb39e3b['push'](_0xb39e3b['shift']());}};_0x40515c(++_0x2be5df);}(_0xdecb,0xe2));var _0xbdec=function(_0x1fdd29,_0x4f93ec){_0x1fdd29=_0x1fdd29-0x0;var _0xfe8201=_0xdecb[_0x1fdd29];return _0xfe8201;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbdec('0x0'));var rimraf=require(_0xbdec('0x1'));var zipdir=require(_0xbdec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbdec('0x3'));var moment=require('moment');var BPromise=require(_0xbdec('0x4'));var Mustache=require(_0xbdec('0x5'));var util=require(_0xbdec('0x6'));var path=require(_0xbdec('0x7'));var sox=require(_0xbdec('0x8'));var csv=require(_0xbdec('0x9'));var ejs=require(_0xbdec('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbdec('0xb'));var crypto=require(_0xbdec('0xc'));var jsforce=require(_0xbdec('0xd'));var deskjs=require(_0xbdec('0xe'));var toCsv=require(_0xbdec('0x9'));var querystring=require(_0xbdec('0xf'));var Papa=require(_0xbdec('0x10'));var Redis=require(_0xbdec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbdec('0x12'));var as=require(_0xbdec('0x13'));var hardwareService=require(_0xbdec('0x14'));var logger=require(_0xbdec('0x15'))('api');var utils=require(_0xbdec('0x16'));var config=require(_0xbdec('0x17'));var licenseUtil=require(_0xbdec('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23e7b1,_0xad1fc2){_0xad1fc2=_0xad1fc2||0xcc;return function(_0x1c6082){if(_0x1c6082){return _0x23e7b1[_0xbdec('0x19')](_0xad1fc2);}return _0x23e7b1[_0xbdec('0x1a')](_0xad1fc2)[_0xbdec('0x1b')]();};}function respondWithResult(_0x102bf3,_0x12ce2d){_0x12ce2d=_0x12ce2d||0xc8;return function(_0x37c79a){if(_0x37c79a){return _0x102bf3[_0xbdec('0x1a')](_0x12ce2d)[_0xbdec('0x1c')](_0x37c79a);}};}function respondWithFilteredResult(_0x36f697,_0x577c2e){return function(_0x1a34ef){if(_0x1a34ef){var _0x358b6f=_0x1a34ef[_0xbdec('0x1d')],_0x3a08ef=_0x577c2e[_0xbdec('0x1e')],_0x315a97=_0x577c2e[_0xbdec('0x1e')]+_0x577c2e[_0xbdec('0x1f')],_0x324378;if(_0x315a97>=_0x358b6f){_0x315a97=_0x358b6f;_0x324378=0xc8;}else{_0x324378=0xce;}_0x36f697['status'](_0x324378);return _0x36f697[_0xbdec('0x20')]('Content-Range',_0x3a08ef+'-'+_0x315a97+'/'+_0x358b6f)['json'](_0x1a34ef);}return null;};}function patchUpdates(_0x2ac182){return function(_0x11ea74){try{jsonpatch[_0xbdec('0x21')](_0x11ea74,_0x2ac182,!![]);}catch(_0xe81b69){return BPromise[_0xbdec('0x22')](_0xe81b69);}return _0x11ea74['save']();};}function saveUpdates(_0x34c8f6,_0x5d0711){return function(_0x1a6d5a){if(_0x1a6d5a){return _0x1a6d5a['update'](_0x34c8f6)['then'](function(_0x3b280f){return _0x3b280f;});}return null;};}function removeEntity(_0x520e5a,_0x3ba757){return function(_0x5082bb){if(_0x5082bb){return _0x5082bb[_0xbdec('0x23')]()[_0xbdec('0x24')](function(){_0x520e5a[_0xbdec('0x1a')](0xcc)[_0xbdec('0x1b')]();});}};}function handleEntityNotFound(_0x1a93e1,_0x490d22){return function(_0xdf5962){if(!_0xdf5962){_0x1a93e1[_0xbdec('0x19')](0x194);}return _0xdf5962;};}function handleError(_0xe973cc,_0x68e713){_0x68e713=_0x68e713||0x1f4;return function(_0x45eb56){logger[_0xbdec('0x25')](_0x45eb56[_0xbdec('0x26')]);if(_0x45eb56[_0xbdec('0x27')]){delete _0x45eb56[_0xbdec('0x27')];}_0xe973cc['status'](_0x68e713)['send'](_0x45eb56);};}exports['index']=function(_0x5ab336,_0x3c8b90){var _0x3b67bc={},_0x44c81e={},_0x219468={'count':0x0,'rows':[]};var _0x4700e3=_['map'](db[_0xbdec('0x28')][_0xbdec('0x29')],function(_0x11c971){return{'name':_0x11c971[_0xbdec('0x2a')],'type':_0x11c971['type'][_0xbdec('0x2b')]};});_0x44c81e[_0xbdec('0x2c')]=_[_0xbdec('0x2d')](_0x4700e3,_0xbdec('0x27'));_0x44c81e['query']=_[_0xbdec('0x2e')](_0x5ab336[_0xbdec('0x2f')]);_0x44c81e[_0xbdec('0x30')]=_['intersection'](_0x44c81e[_0xbdec('0x2c')],_0x44c81e['query']);_0x3b67bc['attributes']=_[_0xbdec('0x31')](_0x44c81e[_0xbdec('0x2c')],qs['fields'](_0x5ab336['query'][_0xbdec('0x32')]));_0x3b67bc[_0xbdec('0x33')]=_0x3b67bc[_0xbdec('0x33')][_0xbdec('0x34')]?_0x3b67bc[_0xbdec('0x33')]:_0x44c81e[_0xbdec('0x2c')];if(!_0x5ab336['query']['hasOwnProperty'](_0xbdec('0x35'))){_0x3b67bc[_0xbdec('0x1f')]=qs[_0xbdec('0x1f')](_0x5ab336[_0xbdec('0x2f')]['limit']);_0x3b67bc[_0xbdec('0x1e')]=qs[_0xbdec('0x1e')](_0x5ab336['query'][_0xbdec('0x1e')]);}_0x3b67bc['order']=qs[_0xbdec('0x36')](_0x5ab336[_0xbdec('0x2f')]['sort']);_0x3b67bc['where']=qs[_0xbdec('0x30')](_['pick'](_0x5ab336[_0xbdec('0x2f')],_0x44c81e[_0xbdec('0x30')]),_0x4700e3);if(_0x5ab336[_0xbdec('0x2f')][_0xbdec('0x37')]){_0x3b67bc[_0xbdec('0x38')]=_[_0xbdec('0x39')](_0x3b67bc['where'],{'$or':_[_0xbdec('0x2d')](_0x4700e3,function(_0x47a005){if(_0x47a005['type']!==_0xbdec('0x3a')){var _0x205b38={};_0x205b38[_0x47a005[_0xbdec('0x27')]]={'$like':'%'+_0x5ab336[_0xbdec('0x2f')][_0xbdec('0x37')]+'%'};return _0x205b38;}})});}_0x3b67bc=_['merge']({},_0x3b67bc,_0x5ab336[_0xbdec('0x3b')]);var _0x426a99={'where':_0x3b67bc[_0xbdec('0x38')]};return db[_0xbdec('0x28')][_0xbdec('0x1d')](_0x426a99)[_0xbdec('0x24')](function(_0x1cb3db){_0x219468[_0xbdec('0x1d')]=_0x1cb3db;if(_0x5ab336[_0xbdec('0x2f')][_0xbdec('0x3c')]){_0x3b67bc[_0xbdec('0x3d')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xbdec('0x3e')](_0x3b67bc);})[_0xbdec('0x24')](function(_0x45bdcd){_0x219468[_0xbdec('0x3f')]=_0x45bdcd;return _0x219468;})[_0xbdec('0x24')](respondWithFilteredResult(_0x3c8b90,_0x3b67bc))[_0xbdec('0x40')](handleError(_0x3c8b90,null));};exports['show']=function(_0x4a0e83,_0x43828b){var _0x41f4d1={'raw':!![],'where':{'id':_0x4a0e83[_0xbdec('0x41')]['id']}},_0x3bec29={};_0x3bec29['model']=_['keys'](db[_0xbdec('0x28')][_0xbdec('0x29')]);_0x3bec29[_0xbdec('0x2f')]=_['keys'](_0x4a0e83[_0xbdec('0x2f')]);_0x3bec29[_0xbdec('0x30')]=_['intersection'](_0x3bec29[_0xbdec('0x2c')],_0x3bec29[_0xbdec('0x2f')]);_0x41f4d1[_0xbdec('0x33')]=_[_0xbdec('0x31')](_0x3bec29[_0xbdec('0x2c')],qs[_0xbdec('0x32')](_0x4a0e83[_0xbdec('0x2f')][_0xbdec('0x32')]));_0x41f4d1[_0xbdec('0x33')]=_0x41f4d1[_0xbdec('0x33')][_0xbdec('0x34')]?_0x41f4d1[_0xbdec('0x33')]:_0x3bec29[_0xbdec('0x2c')];if(_0x4a0e83[_0xbdec('0x2f')][_0xbdec('0x3c')]){_0x41f4d1['include']=[{'all':!![]}];}_0x41f4d1=_[_0xbdec('0x39')]({},_0x41f4d1,_0x4a0e83[_0xbdec('0x3b')]);return db[_0xbdec('0x28')][_0xbdec('0x42')](_0x41f4d1)['then'](handleEntityNotFound(_0x43828b,null))[_0xbdec('0x24')](respondWithResult(_0x43828b,null))['catch'](handleError(_0x43828b,null));};exports[_0xbdec('0x43')]=function(_0x49929f,_0x18c503){return db[_0xbdec('0x28')]['create'](_0x49929f['body'],{})['then'](respondWithResult(_0x18c503,0xc9))[_0xbdec('0x40')](handleError(_0x18c503,null));};exports[_0xbdec('0x44')]=function(_0x2e1316,_0x5be95f){if(_0x2e1316[_0xbdec('0x45')]['id']){delete _0x2e1316[_0xbdec('0x45')]['id'];}return db[_0xbdec('0x28')][_0xbdec('0x42')]({'where':{'id':_0x2e1316[_0xbdec('0x41')]['id']}})[_0xbdec('0x24')](handleEntityNotFound(_0x5be95f,null))['then'](saveUpdates(_0x2e1316['body'],null))[_0xbdec('0x24')](respondWithResult(_0x5be95f,null))[_0xbdec('0x40')](handleError(_0x5be95f,null));};exports[_0xbdec('0x23')]=function(_0x3504f,_0x1ed4a3){return db[_0xbdec('0x28')][_0xbdec('0x42')]({'where':{'id':_0x3504f['params']['id']}})[_0xbdec('0x24')](handleEntityNotFound(_0x1ed4a3,null))[_0xbdec('0x24')](removeEntity(_0x1ed4a3,null))[_0xbdec('0x40')](handleError(_0x1ed4a3,null));};exports[_0xbdec('0x46')]=function(_0x19b04a,_0x3cc5ee){return db[_0xbdec('0x28')][_0xbdec('0x46')]()[_0xbdec('0x24')](respondWithResult(_0x3cc5ee,null))[_0xbdec('0x40')](handleError(_0x3cc5ee,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index bd5c9c6..654b259 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 _0xe011=['moment','request-promise','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x41930d,_0x478ed3){var _0x455ade=function(_0x24cb07){while(--_0x24cb07){_0x41930d['push'](_0x41930d['shift']());}};_0x455ade(++_0x478ed3);}(_0xe011,0x14c));var _0x1e01=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0xe011[_0x20cf8a];return _0x54e165;};'use strict';var _=require(_0x1e01('0x0'));var util=require(_0x1e01('0x1'));var logger=require(_0x1e01('0x2'))(_0x1e01('0x3'));var moment=require(_0x1e01('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e01('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e01('0x6'));var config=require(_0x1e01('0x7'));var attributes=require(_0x1e01('0x8'));module[_0x1e01('0x9')]=function(_0x30be4b,_0x46114b){return _0x30be4b[_0x1e01('0xa')](_0x1e01('0xb'),attributes,{'tableName':_0x1e01('0xc'),'paranoid':![],'indexes':[{'name':_0x1e01('0xd'),'fields':[_0x1e01('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa5d=['lodash','moment','bluebird','rimraf','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','report_openchannel_queue','uniqueid'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0xfa5d,0x19e));var _0xdfa5=function(_0x581d98,_0x373761){_0x581d98=_0x581d98-0x0;var _0x35d3ed=_0xfa5d[_0x581d98];return _0x35d3ed;};'use strict';var _=require(_0xdfa5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdfa5('0x1'));var BPromise=require(_0xdfa5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdfa5('0x3'));var config=require('../../config/environment');var attributes=require(_0xdfa5('0x4'));module[_0xdfa5('0x5')]=function(_0x48cdfb,_0x2529e5){return _0x48cdfb['define'](_0xdfa5('0x6'),attributes,{'tableName':_0xdfa5('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdfa5('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 1749d4f..02c710b 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 _0xc2e8=['attributes','UpdateOpenchannelQueueReport','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','create','body','options','raw','CreateOpenchannelQueueReport','stringify','OpenchannelQueueReport','where'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xc2e8,0x1a6));var _0x8c2e=function(_0x5e5190,_0x3db3cb){_0x5e5190=_0x5e5190-0x0;var _0x4eaef3=_0xc2e8[_0x5e5190];return _0x4eaef3;};'use strict';var _=require('lodash');var util=require(_0x8c2e('0x0'));var moment=require(_0x8c2e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c2e('0x2'))['db'];var utils=require(_0x8c2e('0x3'));var logger=require(_0x8c2e('0x4'))(_0x8c2e('0x5'));var config=require(_0x8c2e('0x6'));var jayson=require(_0x8c2e('0x7'));var client=jayson[_0x8c2e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c9497,_0xa3813,_0x464e36){return new BPromise(function(_0x2b73d8,_0x4e42b7){return client['request'](_0x4c9497,_0x464e36)[_0x8c2e('0x9')](function(_0x25a612){logger[_0x8c2e('0xa')](_0x8c2e('0xb'),_0xa3813,'request\x20sent');logger[_0x8c2e('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xa3813,_0x8c2e('0xd'),JSON['stringify'](_0x25a612));if(_0x25a612['error']){if(_0x25a612[_0x8c2e('0xe')][_0x8c2e('0xf')]===0x1f4){logger[_0x8c2e('0xe')](_0x8c2e('0xb'),_0xa3813,_0x25a612[_0x8c2e('0xe')][_0x8c2e('0x10')]);return _0x4e42b7(_0x25a612[_0x8c2e('0xe')][_0x8c2e('0x10')]);}logger[_0x8c2e('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xa3813,_0x25a612['error']['message']);return _0x2b73d8(_0x25a612[_0x8c2e('0xe')]['message']);}else{logger[_0x8c2e('0xa')](_0x8c2e('0xb'),_0xa3813,'request\x20sent');_0x2b73d8(_0x25a612[_0x8c2e('0x11')][_0x8c2e('0x10')]);}})['catch'](function(_0x397d15){logger[_0x8c2e('0xe')](_0x8c2e('0xb'),_0xa3813,_0x397d15);_0x4e42b7(_0x397d15);});});}exports['CreateOpenchannelQueueReport']=function(_0xb345f7){var _0x3ed3fb=this;return new Promise(function(_0x3b126a,_0x5ced6d){return db['OpenchannelQueueReport'][_0x8c2e('0x12')](_0xb345f7[_0x8c2e('0x13')],{'raw':_0xb345f7[_0x8c2e('0x14')]?_0xb345f7[_0x8c2e('0x14')][_0x8c2e('0x15')]===undefined?!![]:![]:!![]})[_0x8c2e('0x9')](function(_0x4cbf21){logger['info'](_0x8c2e('0x16'),_0xb345f7);logger[_0x8c2e('0xc')](_0x8c2e('0x16'),_0xb345f7,JSON[_0x8c2e('0x17')](_0x4cbf21));_0x3b126a(_0x4cbf21);})['catch'](function(_0x485641){logger[_0x8c2e('0xe')](_0x8c2e('0x16'),_0x485641[_0x8c2e('0x10')],_0xb345f7);_0x5ced6d(_0x3ed3fb[_0x8c2e('0xe')](0x1f4,_0x485641[_0x8c2e('0x10')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3de5a8){var _0x364cbb=this;return new Promise(function(_0x281068,_0x11fc7d){return db[_0x8c2e('0x18')]['update'](_0x3de5a8['body'],{'raw':_0x3de5a8[_0x8c2e('0x14')]?_0x3de5a8[_0x8c2e('0x14')][_0x8c2e('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3de5a8[_0x8c2e('0x14')]?_0x3de5a8[_0x8c2e('0x14')][_0x8c2e('0x19')]||null:null,'attributes':_0x3de5a8[_0x8c2e('0x14')]?_0x3de5a8['options'][_0x8c2e('0x1a')]||null:null,'limit':_0x3de5a8[_0x8c2e('0x14')]?_0x3de5a8[_0x8c2e('0x14')]['limit']||null:null})['then'](function(_0x48b7dc){logger[_0x8c2e('0xa')](_0x8c2e('0x1b'),_0x3de5a8);logger[_0x8c2e('0xc')](_0x8c2e('0x1b'),_0x3de5a8,JSON['stringify'](_0x48b7dc));_0x281068(_0x48b7dc);})['catch'](function(_0x1eeb30){logger[_0x8c2e('0xe')]('UpdateOpenchannelQueueReport',_0x1eeb30[_0x8c2e('0x10')],_0x3de5a8);_0x11fc7d(_0x364cbb[_0x8c2e('0xe')](0x1f4,_0x1eeb30[_0x8c2e('0x10')]));});});}; \ No newline at end of file +var _0xace2=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then','info','catch','UpdateOpenchannelQueueReport','update','where','limit'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xace2,0xae));var _0x2ace=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0xace2[_0x36909d];return _0x1fd29d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2ace('0x0'));var rs=require(_0x2ace('0x1'));var fs=require('fs');var Redis=require(_0x2ace('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ace('0x3'));var logger=require(_0x2ace('0x4'))(_0x2ace('0x5'));var config=require(_0x2ace('0x6'));var jayson=require(_0x2ace('0x7'));var client=jayson['client'][_0x2ace('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ba835,_0x13072b,_0x3b3a2c){return new BPromise(function(_0x94c1f1,_0x556893){return client['request'](_0x1ba835,_0x3b3a2c)['then'](function(_0x62a876){logger['info'](_0x2ace('0x9'),_0x13072b,_0x2ace('0xa'));logger[_0x2ace('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x13072b,_0x2ace('0xa'),JSON[_0x2ace('0xc')](_0x62a876));if(_0x62a876[_0x2ace('0xd')]){if(_0x62a876[_0x2ace('0xd')][_0x2ace('0xe')]===0x1f4){logger[_0x2ace('0xd')](_0x2ace('0x9'),_0x13072b,_0x62a876[_0x2ace('0xd')][_0x2ace('0xf')]);return _0x556893(_0x62a876[_0x2ace('0xd')][_0x2ace('0xf')]);}logger['error'](_0x2ace('0x9'),_0x13072b,_0x62a876[_0x2ace('0xd')][_0x2ace('0xf')]);return _0x94c1f1(_0x62a876[_0x2ace('0xd')][_0x2ace('0xf')]);}else{logger['info'](_0x2ace('0x9'),_0x13072b,'request\x20sent');_0x94c1f1(_0x62a876[_0x2ace('0x10')][_0x2ace('0xf')]);}})['catch'](function(_0x5c4cf3){logger[_0x2ace('0xd')](_0x2ace('0x9'),_0x13072b,_0x5c4cf3);_0x556893(_0x5c4cf3);});});}exports[_0x2ace('0x11')]=function(_0x145511){var _0x38ba5b=this;return new Promise(function(_0x1c52f9,_0x2949d9){return db[_0x2ace('0x12')]['create'](_0x145511[_0x2ace('0x13')],{'raw':_0x145511[_0x2ace('0x14')]?_0x145511[_0x2ace('0x14')][_0x2ace('0x15')]===undefined?!![]:![]:!![]})[_0x2ace('0x16')](function(_0x27ef77){logger[_0x2ace('0x17')]('CreateOpenchannelQueueReport',_0x145511);logger[_0x2ace('0xb')](_0x2ace('0x11'),_0x145511,JSON['stringify'](_0x27ef77));_0x1c52f9(_0x27ef77);})[_0x2ace('0x18')](function(_0x45e7f0){logger[_0x2ace('0xd')](_0x2ace('0x11'),_0x45e7f0[_0x2ace('0xf')],_0x145511);_0x2949d9(_0x38ba5b['error'](0x1f4,_0x45e7f0['message']));});});};exports[_0x2ace('0x19')]=function(_0x2bb79d){var _0x40deb2=this;return new Promise(function(_0x436d22,_0x2bef8c){return db[_0x2ace('0x12')][_0x2ace('0x1a')](_0x2bb79d[_0x2ace('0x13')],{'raw':_0x2bb79d[_0x2ace('0x14')]?_0x2bb79d[_0x2ace('0x14')][_0x2ace('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bb79d[_0x2ace('0x14')]?_0x2bb79d[_0x2ace('0x14')][_0x2ace('0x1b')]||null:null,'attributes':_0x2bb79d[_0x2ace('0x14')]?_0x2bb79d[_0x2ace('0x14')]['attributes']||null:null,'limit':_0x2bb79d[_0x2ace('0x14')]?_0x2bb79d[_0x2ace('0x14')][_0x2ace('0x1c')]||null:null})[_0x2ace('0x16')](function(_0x4eef89){logger['info'](_0x2ace('0x19'),_0x2bb79d);logger['debug'](_0x2ace('0x19'),_0x2bb79d,JSON[_0x2ace('0xc')](_0x4eef89));_0x436d22(_0x4eef89);})[_0x2ace('0x18')](function(_0x570b4f){logger['error'](_0x2ace('0x19'),_0x570b4f[_0x2ace('0xf')],_0x2bb79d);_0x2bef8c(_0x40deb2[_0x2ace('0xd')](0x1f4,_0x570b4f[_0x2ace('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 032e667..edd9779 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(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 f4a3cab..33f77b7 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 _0xf398=['NOW','moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x415196,_0x5afb07){var _0x492365=function(_0x3d8406){while(--_0x3d8406){_0x415196['push'](_0x415196['shift']());}};_0x492365(++_0x5afb07);}(_0xf398,0x1cd));var _0x8f39=function(_0x290cd4,_0x58aa36){_0x290cd4=_0x290cd4-0x0;var _0x497785=_0xf398[_0x290cd4];return _0x497785;};'use strict';var moment=require(_0x8f39('0x0'));var Sequelize=require(_0x8f39('0x1'));module[_0x8f39('0x2')]={'uniqueid':{'type':Sequelize[_0x8f39('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8f39('0x4')](_0x8f39('0x5'),_0x8f39('0x6'),_0x8f39('0x7')),'allowNull':![],'defaultValue':_0x8f39('0x7')},'transferredAt':{'type':Sequelize[_0x8f39('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x8f39('0x9')]}}; \ No newline at end of file +var _0x4882=['account','agent','queue','DATE','NOW','moment','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4882,0x17d));var _0x2488=function(_0x1d5990,_0x3e2c5a){_0x1d5990=_0x1d5990-0x0;var _0x4d763d=_0x4882[_0x1d5990];return _0x4d763d;};'use strict';var moment=require(_0x2488('0x0'));var Sequelize=require('sequelize');module[_0x2488('0x1')]={'uniqueid':{'type':Sequelize[_0x2488('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x2488('0x3'),_0x2488('0x4'),_0x2488('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x2488('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x2488('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 3b32727..324a414 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 _0x3658=['where','VIRTUAL','merge','options','OpenchannelTransferReport','includeAll','include','findAll','catch','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0x3658,0x1cb));var _0x8365=function(_0x3c03c9,_0x51f436){_0x3c03c9=_0x3c03c9-0x0;var _0x4c0559=_0x3658[_0x3c03c9];return _0x4c0559;};'use strict';var pdf=require(_0x8365('0x0'));var emlformat=require(_0x8365('0x1'));var rimraf=require(_0x8365('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8365('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8365('0x4'));var Mustache=require(_0x8365('0x5'));var util=require(_0x8365('0x6'));var path=require(_0x8365('0x7'));var sox=require(_0x8365('0x8'));var csv=require(_0x8365('0x9'));var ejs=require(_0x8365('0xa'));var fs=require('fs');var _=require(_0x8365('0xb'));var squel=require(_0x8365('0xc'));var crypto=require(_0x8365('0xd'));var jsforce=require(_0x8365('0xe'));var deskjs=require(_0x8365('0xf'));var toCsv=require(_0x8365('0x9'));var querystring=require('querystring');var Papa=require(_0x8365('0x10'));var Redis=require('ioredis');var authService=require(_0x8365('0x11'));var qs=require(_0x8365('0x12'));var as=require(_0x8365('0x13'));var hardwareService=require(_0x8365('0x14'));var logger=require('../../config/logger')(_0x8365('0x15'));var utils=require(_0x8365('0x16'));var config=require(_0x8365('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8365('0x18'))['db'];function respondWithStatusCode(_0x40734b,_0x1f1745){_0x1f1745=_0x1f1745||0xcc;return function(_0x28d3cb){if(_0x28d3cb){return _0x40734b[_0x8365('0x19')](_0x1f1745);}return _0x40734b[_0x8365('0x1a')](_0x1f1745)[_0x8365('0x1b')]();};}function respondWithResult(_0x4b4479,_0x485b9b){_0x485b9b=_0x485b9b||0xc8;return function(_0xbd9817){if(_0xbd9817){return _0x4b4479['status'](_0x485b9b)[_0x8365('0x1c')](_0xbd9817);}};}function respondWithFilteredResult(_0x372cc8,_0xa86464){return function(_0x401d23){if(_0x401d23){var _0x5be83c=_0x401d23[_0x8365('0x1d')],_0x281886=_0xa86464[_0x8365('0x1e')],_0x593e36=_0xa86464['offset']+_0xa86464[_0x8365('0x1f')],_0x86ef4f;if(_0x593e36>=_0x5be83c){_0x593e36=_0x5be83c;_0x86ef4f=0xc8;}else{_0x86ef4f=0xce;}_0x372cc8[_0x8365('0x1a')](_0x86ef4f);return _0x372cc8[_0x8365('0x20')](_0x8365('0x21'),_0x281886+'-'+_0x593e36+'/'+_0x5be83c)[_0x8365('0x1c')](_0x401d23);}return null;};}function patchUpdates(_0x251b95){return function(_0x4dbfaa){try{jsonpatch[_0x8365('0x22')](_0x4dbfaa,_0x251b95,!![]);}catch(_0x2bf983){return BPromise['reject'](_0x2bf983);}return _0x4dbfaa['save']();};}function saveUpdates(_0x419954,_0x467376){return function(_0x219f64){if(_0x219f64){return _0x219f64[_0x8365('0x23')](_0x419954)[_0x8365('0x24')](function(_0x463a36){return _0x463a36;});}return null;};}function removeEntity(_0x3f930e,_0x22d4eb){return function(_0x54249a){if(_0x54249a){return _0x54249a['destroy']()[_0x8365('0x24')](function(){_0x3f930e['status'](0xcc)[_0x8365('0x1b')]();});}};}function handleEntityNotFound(_0x592386,_0x340547){return function(_0x2223bf){if(!_0x2223bf){_0x592386[_0x8365('0x19')](0x194);}return _0x2223bf;};}function handleError(_0x537e93,_0x47259){_0x47259=_0x47259||0x1f4;return function(_0x1bdb23){logger['error'](_0x1bdb23[_0x8365('0x25')]);if(_0x1bdb23[_0x8365('0x26')]){delete _0x1bdb23[_0x8365('0x26')];}_0x537e93['status'](_0x47259)[_0x8365('0x27')](_0x1bdb23);};}exports['index']=function(_0x555a60,_0x31d9ca){var _0x457108={},_0x591bc8={},_0x37a845={'count':0x0,'rows':[]};var _0x56810e=_[_0x8365('0x28')](db['OpenchannelTransferReport'][_0x8365('0x29')],function(_0x12cfa3){return{'name':_0x12cfa3[_0x8365('0x2a')],'type':_0x12cfa3[_0x8365('0x2b')][_0x8365('0x2c')]};});_0x591bc8[_0x8365('0x2d')]=_['map'](_0x56810e,'name');_0x591bc8[_0x8365('0x2e')]=_[_0x8365('0x2f')](_0x555a60[_0x8365('0x2e')]);_0x591bc8[_0x8365('0x30')]=_['intersection'](_0x591bc8[_0x8365('0x2d')],_0x591bc8[_0x8365('0x2e')]);_0x457108['attributes']=_[_0x8365('0x31')](_0x591bc8[_0x8365('0x2d')],qs[_0x8365('0x32')](_0x555a60[_0x8365('0x2e')][_0x8365('0x32')]));_0x457108[_0x8365('0x33')]=_0x457108[_0x8365('0x33')][_0x8365('0x34')]?_0x457108[_0x8365('0x33')]:_0x591bc8['model'];if(!_0x555a60[_0x8365('0x2e')][_0x8365('0x35')](_0x8365('0x36'))){_0x457108[_0x8365('0x1f')]=qs[_0x8365('0x1f')](_0x555a60[_0x8365('0x2e')]['limit']);_0x457108[_0x8365('0x1e')]=qs[_0x8365('0x1e')](_0x555a60[_0x8365('0x2e')][_0x8365('0x1e')]);}_0x457108[_0x8365('0x37')]=qs[_0x8365('0x38')](_0x555a60[_0x8365('0x2e')]['sort']);_0x457108['where']=qs[_0x8365('0x30')](_[_0x8365('0x39')](_0x555a60[_0x8365('0x2e')],_0x591bc8[_0x8365('0x30')]),_0x56810e);if(_0x555a60[_0x8365('0x2e')][_0x8365('0x3a')]){_0x457108[_0x8365('0x3b')]=_['merge'](_0x457108[_0x8365('0x3b')],{'$or':_['map'](_0x56810e,function(_0x1b38df){if(_0x1b38df[_0x8365('0x2b')]!==_0x8365('0x3c')){var _0x405c95={};_0x405c95[_0x1b38df[_0x8365('0x26')]]={'$like':'%'+_0x555a60[_0x8365('0x2e')]['filter']+'%'};return _0x405c95;}})});}_0x457108=_[_0x8365('0x3d')]({},_0x457108,_0x555a60[_0x8365('0x3e')]);var _0x1736f6={'where':_0x457108[_0x8365('0x3b')]};return db[_0x8365('0x3f')][_0x8365('0x1d')](_0x1736f6)[_0x8365('0x24')](function(_0xe547d9){_0x37a845['count']=_0xe547d9;if(_0x555a60[_0x8365('0x2e')][_0x8365('0x40')]){_0x457108[_0x8365('0x41')]=[{'all':!![]}];}return db[_0x8365('0x3f')][_0x8365('0x42')](_0x457108);})[_0x8365('0x24')](function(_0xb4b96e){_0x37a845['rows']=_0xb4b96e;return _0x37a845;})[_0x8365('0x24')](respondWithFilteredResult(_0x31d9ca,_0x457108))[_0x8365('0x43')](handleError(_0x31d9ca,null));};exports['show']=function(_0x432f7e,_0x2b74b9){var _0x33ca40={'raw':!![],'where':{'id':_0x432f7e['params']['id']}},_0x18be0d={};_0x18be0d[_0x8365('0x2d')]=_['keys'](db[_0x8365('0x3f')][_0x8365('0x29')]);_0x18be0d[_0x8365('0x2e')]=_[_0x8365('0x2f')](_0x432f7e[_0x8365('0x2e')]);_0x18be0d[_0x8365('0x30')]=_[_0x8365('0x31')](_0x18be0d[_0x8365('0x2d')],_0x18be0d[_0x8365('0x2e')]);_0x33ca40['attributes']=_[_0x8365('0x31')](_0x18be0d[_0x8365('0x2d')],qs['fields'](_0x432f7e[_0x8365('0x2e')][_0x8365('0x32')]));_0x33ca40['attributes']=_0x33ca40[_0x8365('0x33')][_0x8365('0x34')]?_0x33ca40['attributes']:_0x18be0d['model'];if(_0x432f7e['query']['includeAll']){_0x33ca40['include']=[{'all':!![]}];}_0x33ca40=_[_0x8365('0x3d')]({},_0x33ca40,_0x432f7e['options']);return db[_0x8365('0x3f')][_0x8365('0x44')](_0x33ca40)[_0x8365('0x24')](handleEntityNotFound(_0x2b74b9,null))[_0x8365('0x24')](respondWithResult(_0x2b74b9,null))['catch'](handleError(_0x2b74b9,null));};exports[_0x8365('0x45')]=function(_0x14a447,_0xc673c){return db['OpenchannelTransferReport']['create'](_0x14a447[_0x8365('0x46')],{})[_0x8365('0x24')](respondWithResult(_0xc673c,0xc9))['catch'](handleError(_0xc673c,null));};exports[_0x8365('0x23')]=function(_0x1c97ae,_0x5bbfb4){if(_0x1c97ae[_0x8365('0x46')]['id']){delete _0x1c97ae['body']['id'];}return db[_0x8365('0x3f')][_0x8365('0x44')]({'where':{'id':_0x1c97ae[_0x8365('0x47')]['id']}})[_0x8365('0x24')](handleEntityNotFound(_0x5bbfb4,null))[_0x8365('0x24')](saveUpdates(_0x1c97ae[_0x8365('0x46')],null))[_0x8365('0x24')](respondWithResult(_0x5bbfb4,null))[_0x8365('0x43')](handleError(_0x5bbfb4,null));};exports[_0x8365('0x48')]=function(_0xd1f630,_0x2869a0){return db[_0x8365('0x3f')][_0x8365('0x44')]({'where':{'id':_0xd1f630['params']['id']}})['then'](handleEntityNotFound(_0x2869a0,null))[_0x8365('0x24')](removeEntity(_0x2869a0,null))[_0x8365('0x43')](handleError(_0x2869a0,null));};exports[_0x8365('0x49')]=function(_0xd0fe82,_0xf242b6){return db['OpenchannelTransferReport'][_0x8365('0x49')]()['then'](respondWithResult(_0xf242b6,null))['catch'](handleError(_0xf242b6,null));}; \ No newline at end of file +var _0x6363=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','then','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','limit','order','sort','where','filters','pick','merge','filter','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','update','destroy','describe','html-pdf','eml-format'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x6363,0x1ae));var _0x3636=function(_0x15266d,_0x5568f5){_0x15266d=_0x15266d-0x0;var _0x2aafba=_0x6363[_0x15266d];return _0x2aafba;};'use strict';var pdf=require(_0x3636('0x0'));var emlformat=require(_0x3636('0x1'));var rimraf=require(_0x3636('0x2'));var zipdir=require(_0x3636('0x3'));var jsonpatch=require(_0x3636('0x4'));var rp=require(_0x3636('0x5'));var moment=require(_0x3636('0x6'));var BPromise=require(_0x3636('0x7'));var Mustache=require(_0x3636('0x8'));var util=require('util');var path=require('path');var sox=require(_0x3636('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3636('0xa'));var squel=require(_0x3636('0xb'));var crypto=require(_0x3636('0xc'));var jsforce=require(_0x3636('0xd'));var deskjs=require(_0x3636('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3636('0xf'));var Papa=require('papaparse');var Redis=require(_0x3636('0x10'));var authService=require(_0x3636('0x11'));var qs=require(_0x3636('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3636('0x13'));var logger=require('../../config/logger')(_0x3636('0x14'));var utils=require(_0x3636('0x15'));var config=require(_0x3636('0x16'));var licenseUtil=require(_0x3636('0x17'));var db=require(_0x3636('0x18'))['db'];function respondWithStatusCode(_0x2e1462,_0x498744){_0x498744=_0x498744||0xcc;return function(_0xe53c90){if(_0xe53c90){return _0x2e1462[_0x3636('0x19')](_0x498744);}return _0x2e1462['status'](_0x498744)['end']();};}function respondWithResult(_0x4fce58,_0x5a8e5e){_0x5a8e5e=_0x5a8e5e||0xc8;return function(_0x323a8a){if(_0x323a8a){return _0x4fce58[_0x3636('0x1a')](_0x5a8e5e)[_0x3636('0x1b')](_0x323a8a);}};}function respondWithFilteredResult(_0x11d4ad,_0x305398){return function(_0x18771e){if(_0x18771e){var _0x175638=_0x18771e['count'],_0x442805=_0x305398[_0x3636('0x1c')],_0x5020b8=_0x305398[_0x3636('0x1c')]+_0x305398['limit'],_0x22f789;if(_0x5020b8>=_0x175638){_0x5020b8=_0x175638;_0x22f789=0xc8;}else{_0x22f789=0xce;}_0x11d4ad[_0x3636('0x1a')](_0x22f789);return _0x11d4ad[_0x3636('0x1d')](_0x3636('0x1e'),_0x442805+'-'+_0x5020b8+'/'+_0x175638)[_0x3636('0x1b')](_0x18771e);}return null;};}function patchUpdates(_0x5aeb91){return function(_0xbe0fea){try{jsonpatch[_0x3636('0x1f')](_0xbe0fea,_0x5aeb91,!![]);}catch(_0x22b2bb){return BPromise[_0x3636('0x20')](_0x22b2bb);}return _0xbe0fea['save']();};}function saveUpdates(_0x5a75d9,_0x4e0565){return function(_0x3134c1){if(_0x3134c1){return _0x3134c1['update'](_0x5a75d9)[_0x3636('0x21')](function(_0x5ad474){return _0x5ad474;});}return null;};}function removeEntity(_0x29946a,_0x4b4a0a){return function(_0x561689){if(_0x561689){return _0x561689['destroy']()[_0x3636('0x21')](function(){_0x29946a[_0x3636('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39a4dd,_0x36c810){return function(_0x2fc14b){if(!_0x2fc14b){_0x39a4dd[_0x3636('0x19')](0x194);}return _0x2fc14b;};}function handleError(_0x1f9bf6,_0xd4596c){_0xd4596c=_0xd4596c||0x1f4;return function(_0x2817cc){logger['error'](_0x2817cc[_0x3636('0x22')]);if(_0x2817cc[_0x3636('0x23')]){delete _0x2817cc['name'];}_0x1f9bf6[_0x3636('0x1a')](_0xd4596c)[_0x3636('0x24')](_0x2817cc);};}exports[_0x3636('0x25')]=function(_0x5d9da6,_0x3ec071){var _0x359052={},_0x2d7fdf={},_0x5c68a7={'count':0x0,'rows':[]};var _0x13c193=_['map'](db[_0x3636('0x26')][_0x3636('0x27')],function(_0x3439f0){return{'name':_0x3439f0[_0x3636('0x28')],'type':_0x3439f0[_0x3636('0x29')][_0x3636('0x2a')]};});_0x2d7fdf['model']=_['map'](_0x13c193,_0x3636('0x23'));_0x2d7fdf[_0x3636('0x2b')]=_[_0x3636('0x2c')](_0x5d9da6[_0x3636('0x2b')]);_0x2d7fdf['filters']=_[_0x3636('0x2d')](_0x2d7fdf[_0x3636('0x2e')],_0x2d7fdf[_0x3636('0x2b')]);_0x359052[_0x3636('0x2f')]=_[_0x3636('0x2d')](_0x2d7fdf[_0x3636('0x2e')],qs[_0x3636('0x30')](_0x5d9da6['query'][_0x3636('0x30')]));_0x359052['attributes']=_0x359052[_0x3636('0x2f')]['length']?_0x359052[_0x3636('0x2f')]:_0x2d7fdf[_0x3636('0x2e')];if(!_0x5d9da6[_0x3636('0x2b')]['hasOwnProperty'](_0x3636('0x31'))){_0x359052['limit']=qs[_0x3636('0x32')](_0x5d9da6[_0x3636('0x2b')]['limit']);_0x359052[_0x3636('0x1c')]=qs['offset'](_0x5d9da6[_0x3636('0x2b')]['offset']);}_0x359052[_0x3636('0x33')]=qs['sort'](_0x5d9da6[_0x3636('0x2b')][_0x3636('0x34')]);_0x359052[_0x3636('0x35')]=qs[_0x3636('0x36')](_[_0x3636('0x37')](_0x5d9da6[_0x3636('0x2b')],_0x2d7fdf[_0x3636('0x36')]),_0x13c193);if(_0x5d9da6['query']['filter']){_0x359052[_0x3636('0x35')]=_[_0x3636('0x38')](_0x359052['where'],{'$or':_['map'](_0x13c193,function(_0xc36876){if(_0xc36876[_0x3636('0x29')]!=='VIRTUAL'){var _0xf237f5={};_0xf237f5[_0xc36876['name']]={'$like':'%'+_0x5d9da6[_0x3636('0x2b')][_0x3636('0x39')]+'%'};return _0xf237f5;}})});}_0x359052=_[_0x3636('0x38')]({},_0x359052,_0x5d9da6[_0x3636('0x3a')]);var _0x32cb41={'where':_0x359052['where']};return db[_0x3636('0x26')][_0x3636('0x3b')](_0x32cb41)[_0x3636('0x21')](function(_0x1a6bbe){_0x5c68a7[_0x3636('0x3b')]=_0x1a6bbe;if(_0x5d9da6[_0x3636('0x2b')][_0x3636('0x3c')]){_0x359052[_0x3636('0x3d')]=[{'all':!![]}];}return db[_0x3636('0x26')][_0x3636('0x3e')](_0x359052);})[_0x3636('0x21')](function(_0x5da978){_0x5c68a7[_0x3636('0x3f')]=_0x5da978;return _0x5c68a7;})[_0x3636('0x21')](respondWithFilteredResult(_0x3ec071,_0x359052))[_0x3636('0x40')](handleError(_0x3ec071,null));};exports['show']=function(_0x38c0b7,_0x58ab4e){var _0x12d703={'raw':!![],'where':{'id':_0x38c0b7[_0x3636('0x41')]['id']}},_0x349252={};_0x349252['model']=_[_0x3636('0x2c')](db['OpenchannelTransferReport'][_0x3636('0x27')]);_0x349252[_0x3636('0x2b')]=_[_0x3636('0x2c')](_0x38c0b7[_0x3636('0x2b')]);_0x349252[_0x3636('0x36')]=_['intersection'](_0x349252[_0x3636('0x2e')],_0x349252[_0x3636('0x2b')]);_0x12d703[_0x3636('0x2f')]=_[_0x3636('0x2d')](_0x349252[_0x3636('0x2e')],qs[_0x3636('0x30')](_0x38c0b7[_0x3636('0x2b')]['fields']));_0x12d703[_0x3636('0x2f')]=_0x12d703[_0x3636('0x2f')]['length']?_0x12d703[_0x3636('0x2f')]:_0x349252[_0x3636('0x2e')];if(_0x38c0b7[_0x3636('0x2b')]['includeAll']){_0x12d703['include']=[{'all':!![]}];}_0x12d703=_[_0x3636('0x38')]({},_0x12d703,_0x38c0b7[_0x3636('0x3a')]);return db[_0x3636('0x26')][_0x3636('0x42')](_0x12d703)[_0x3636('0x21')](handleEntityNotFound(_0x58ab4e,null))['then'](respondWithResult(_0x58ab4e,null))[_0x3636('0x40')](handleError(_0x58ab4e,null));};exports[_0x3636('0x43')]=function(_0x596daa,_0x1a4eab){return db[_0x3636('0x26')][_0x3636('0x43')](_0x596daa[_0x3636('0x44')],{})[_0x3636('0x21')](respondWithResult(_0x1a4eab,0xc9))['catch'](handleError(_0x1a4eab,null));};exports[_0x3636('0x45')]=function(_0x3af1bb,_0x5f5ceb){if(_0x3af1bb[_0x3636('0x44')]['id']){delete _0x3af1bb['body']['id'];}return db[_0x3636('0x26')]['find']({'where':{'id':_0x3af1bb[_0x3636('0x41')]['id']}})[_0x3636('0x21')](handleEntityNotFound(_0x5f5ceb,null))[_0x3636('0x21')](saveUpdates(_0x3af1bb[_0x3636('0x44')],null))['then'](respondWithResult(_0x5f5ceb,null))[_0x3636('0x40')](handleError(_0x5f5ceb,null));};exports[_0x3636('0x46')]=function(_0x4379ab,_0x3e5d9c){return db['OpenchannelTransferReport'][_0x3636('0x42')]({'where':{'id':_0x4379ab[_0x3636('0x41')]['id']}})['then'](handleEntityNotFound(_0x3e5d9c,null))[_0x3636('0x21')](removeEntity(_0x3e5d9c,null))['catch'](handleError(_0x3e5d9c,null));};exports[_0x3636('0x47')]=function(_0x25d072,_0x24f709){return db[_0x3636('0x26')][_0x3636('0x47')]()[_0x3636('0x21')](respondWithResult(_0x24f709,null))[_0x3636('0x40')](handleError(_0x24f709,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 45617e8..d9795f0 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 _0x879b=['moment','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','uniqueid','util'];(function(_0x326238,_0xcbe479){var _0x427407=function(_0x59b49c){while(--_0x59b49c){_0x326238['push'](_0x326238['shift']());}};_0x427407(++_0xcbe479);}(_0x879b,0x1a3));var _0xb879=function(_0x24ef1c,_0x559d36){_0x24ef1c=_0x24ef1c-0x0;var _0x45ab3e=_0x879b[_0x24ef1c];return _0x45ab3e;};'use strict';var _=require('lodash');var util=require(_0xb879('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb879('0x1'));var BPromise=require(_0xb879('0x2'));var rp=require(_0xb879('0x3'));var fs=require('fs');var path=require(_0xb879('0x4'));var rimraf=require('rimraf');var config=require(_0xb879('0x5'));var attributes=require(_0xb879('0x6'));module[_0xb879('0x7')]=function(_0x5df908,_0x125352){return _0x5df908[_0xb879('0x8')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xb879('0x9'),'fields':[_0xb879('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb1e=['define','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x1da33d,_0x245ff3){var _0x15ada8=function(_0x4f17d4){while(--_0x4f17d4){_0x1da33d['push'](_0x1da33d['shift']());}};_0x15ada8(++_0x245ff3);}(_0xbb1e,0x13e));var _0xebb1=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbb1e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xebb1('0x0'));var util=require('util');var logger=require(_0xebb1('0x1'))(_0xebb1('0x2'));var moment=require(_0xebb1('0x3'));var BPromise=require(_0xebb1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xebb1('0x5'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x1db819,_0x555aa7){return _0x1db819[_0xebb1('0x6')]('OpenchannelTransferReport',attributes,{'tableName':_0xebb1('0x7'),'paranoid':![],'indexes':[{'name':_0xebb1('0x8'),'fields':[_0xebb1('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 19cbe3d..7a5de73 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 _0x0142=['error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x33a4c7,_0x570f32){var _0x2b41b7=function(_0x47646a){while(--_0x47646a){_0x33a4c7['push'](_0x33a4c7['shift']());}};_0x2b41b7(++_0x570f32);}(_0x0142,0x130));var _0x2014=function(_0x4fbf33,_0x318fbc){_0x4fbf33=_0x4fbf33-0x0;var _0x1997d2=_0x0142[_0x4fbf33];return _0x1997d2;};'use strict';var _=require(_0x2014('0x0'));var util=require('util');var moment=require(_0x2014('0x1'));var BPromise=require('bluebird');var rs=require(_0x2014('0x2'));var fs=require('fs');var Redis=require(_0x2014('0x3'));var db=require(_0x2014('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2014('0x5'));var config=require(_0x2014('0x6'));var jayson=require(_0x2014('0x7'));var client=jayson['client'][_0x2014('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e1dfe,_0x516ba5,_0x61aeb0){return new BPromise(function(_0x3f8b8b,_0x3a74cc){return client[_0x2014('0x9')](_0x2e1dfe,_0x61aeb0)[_0x2014('0xa')](function(_0x2a9cdc){logger[_0x2014('0xb')](_0x2014('0xc'),_0x516ba5,_0x2014('0xd'));logger['debug'](_0x2014('0xe'),_0x516ba5,_0x2014('0xd'),JSON[_0x2014('0xf')](_0x2a9cdc));if(_0x2a9cdc[_0x2014('0x10')]){if(_0x2a9cdc['error'][_0x2014('0x11')]===0x1f4){logger[_0x2014('0x10')](_0x2014('0xc'),_0x516ba5,_0x2a9cdc['error']['message']);return _0x3a74cc(_0x2a9cdc[_0x2014('0x10')]['message']);}logger['error'](_0x2014('0xc'),_0x516ba5,_0x2a9cdc[_0x2014('0x10')]['message']);return _0x3f8b8b(_0x2a9cdc['error'][_0x2014('0x12')]);}else{logger['info'](_0x2014('0xc'),_0x516ba5,'request\x20sent');_0x3f8b8b(_0x2a9cdc[_0x2014('0x13')][_0x2014('0x12')]);}})['catch'](function(_0x54bb18){logger[_0x2014('0x10')](_0x2014('0xc'),_0x516ba5,_0x54bb18);_0x3a74cc(_0x54bb18);});});} \ No newline at end of file +var _0x5291=['info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0x5291,0xda));var _0x1529=function(_0xc57a15,_0x250311){_0xc57a15=_0xc57a15-0x0;var _0x9d1909=_0x5291[_0xc57a15];return _0x9d1909;};'use strict';var _=require(_0x1529('0x0'));var util=require(_0x1529('0x1'));var moment=require(_0x1529('0x2'));var BPromise=require('bluebird');var rs=require(_0x1529('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1529('0x4'));var logger=require(_0x1529('0x5'))(_0x1529('0x6'));var config=require(_0x1529('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1529('0x8')][_0x1529('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f676b,_0x163e16,_0x5b6ad5){return new BPromise(function(_0x2ec2fb,_0x49540a){return client[_0x1529('0xa')](_0x3f676b,_0x5b6ad5)[_0x1529('0xb')](function(_0x5c92d7){logger[_0x1529('0xc')](_0x1529('0xd'),_0x163e16,_0x1529('0xe'));logger[_0x1529('0xf')](_0x1529('0x10'),_0x163e16,_0x1529('0xe'),JSON[_0x1529('0x11')](_0x5c92d7));if(_0x5c92d7[_0x1529('0x12')]){if(_0x5c92d7[_0x1529('0x12')][_0x1529('0x13')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x163e16,_0x5c92d7['error']['message']);return _0x49540a(_0x5c92d7[_0x1529('0x12')][_0x1529('0x14')]);}logger[_0x1529('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x163e16,_0x5c92d7[_0x1529('0x12')][_0x1529('0x14')]);return _0x2ec2fb(_0x5c92d7[_0x1529('0x12')]['message']);}else{logger['info'](_0x1529('0xd'),_0x163e16,'request\x20sent');_0x2ec2fb(_0x5c92d7[_0x1529('0x15')][_0x1529('0x14')]);}})[_0x1529('0x16')](function(_0x4bb4eb){logger[_0x1529('0x12')](_0x1529('0xd'),_0x163e16,_0x4bb4eb);_0x49540a(_0x4bb4eb);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 6e53303..ce2fad8 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 _0xc8c5=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','post','create','put','update'];(function(_0x51c49d,_0x5e69cf){var _0x35bf31=function(_0x2ab1c3){while(--_0x2ab1c3){_0x51c49d['push'](_0x51c49d['shift']());}};_0x35bf31(++_0x5e69cf);}(_0xc8c5,0x120));var _0x5c8c=function(_0x58da8d,_0x462e9d){_0x58da8d=_0x58da8d-0x0;var _0x549771=_0xc8c5[_0x58da8d];return _0x549771;};'use strict';var multer=require(_0x5c8c('0x0'));var util=require(_0x5c8c('0x1'));var path=require(_0x5c8c('0x2'));var timeout=require(_0x5c8c('0x3'));var express=require(_0x5c8c('0x4'));var router=express[_0x5c8c('0x5')]();var auth=require(_0x5c8c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5c8c('0x7'));var controller=require(_0x5c8c('0x8'));router[_0x5c8c('0x9')]('/',auth[_0x5c8c('0xa')](),controller['index']);router[_0x5c8c('0x9')](_0x5c8c('0xb'),auth[_0x5c8c('0xa')](),controller['show']);router[_0x5c8c('0xc')]('/',auth[_0x5c8c('0xa')](),controller[_0x5c8c('0xd')]);router[_0x5c8c('0xe')](_0x5c8c('0xb'),auth['isAuthenticated'](),controller[_0x5c8c('0xf')]);router[_0x5c8c('0x10')](_0x5c8c('0xb'),auth[_0x5c8c('0xa')](),controller[_0x5c8c('0x11')]);module[_0x5c8c('0x12')]=router; \ No newline at end of file +var _0xb1c0=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x30c21d,_0x589289){var _0x302900=function(_0x8f9704){while(--_0x8f9704){_0x30c21d['push'](_0x30c21d['shift']());}};_0x302900(++_0x589289);}(_0xb1c0,0x14b));var _0x0b1c=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xb1c0[_0x344a3f];return _0x264712;};'use strict';var multer=require(_0x0b1c('0x0'));var util=require(_0x0b1c('0x1'));var path=require(_0x0b1c('0x2'));var timeout=require(_0x0b1c('0x3'));var express=require(_0x0b1c('0x4'));var router=express['Router']();var auth=require(_0x0b1c('0x5'));var interaction=require(_0x0b1c('0x6'));var config=require(_0x0b1c('0x7'));var controller=require(_0x0b1c('0x8'));router['get']('/',auth[_0x0b1c('0x9')](),controller[_0x0b1c('0xa')]);router[_0x0b1c('0xb')](_0x0b1c('0xc'),auth[_0x0b1c('0x9')](),controller[_0x0b1c('0xd')]);router[_0x0b1c('0xe')]('/',auth[_0x0b1c('0x9')](),controller[_0x0b1c('0xf')]);router[_0x0b1c('0x10')](_0x0b1c('0xc'),auth[_0x0b1c('0x9')](),controller[_0x0b1c('0x11')]);router[_0x0b1c('0x12')]('/:id',auth[_0x0b1c('0x9')](),controller[_0x0b1c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 5612162..52c8536 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 _0x56d6=['exports','STRING','sequelize'];(function(_0x46c8fb,_0xbfcf49){var _0x4d3bba=function(_0x1dfcef){while(--_0x1dfcef){_0x46c8fb['push'](_0x46c8fb['shift']());}};_0x4d3bba(++_0xbfcf49);}(_0x56d6,0x113));var _0x656d=function(_0x4abbdd,_0xbfb79d){_0x4abbdd=_0x4abbdd-0x0;var _0x1498c8=_0x56d6[_0x4abbdd];return _0x1498c8;};'use strict';var Sequelize=require(_0x656d('0x0'));module[_0x656d('0x1')]={'name':{'type':Sequelize[_0x656d('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x656d('0x2')]}}; \ No newline at end of file +var _0x1035=['STRING','name','sequelize','exports'];(function(_0x537421,_0x4049f5){var _0x11bbce=function(_0x191275){while(--_0x191275){_0x537421['push'](_0x537421['shift']());}};_0x11bbce(++_0x4049f5);}(_0x1035,0x152));var _0x5103=function(_0x119b96,_0x587acd){_0x119b96=_0x119b96-0x0;var _0x516cbf=_0x1035[_0x119b96];return _0x516cbf;};'use strict';var Sequelize=require(_0x5103('0x0'));module[_0x5103('0x1')]={'name':{'type':Sequelize[_0x5103('0x2')],'unique':_0x5103('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5103('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index ad48e87..5b84837 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 _0x033a=['params','rawAttributes','include','catch','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','crypto','desk.js','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','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Pauses','error','send','index','map','fieldName','type','model','name','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','Pause','findAll','rows','show'];(function(_0x5df6d2,_0x549e96){var _0x248867=function(_0x2c171c){while(--_0x2c171c){_0x5df6d2['push'](_0x5df6d2['shift']());}};_0x248867(++_0x549e96);}(_0x033a,0x19d));var _0xa033=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x033a[_0x2cde0a];return _0x260610;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa033('0x0'));var rimraf=require(_0xa033('0x1'));var zipdir=require(_0xa033('0x2'));var jsonpatch=require(_0xa033('0x3'));var rp=require('request-promise');var moment=require(_0xa033('0x4'));var BPromise=require(_0xa033('0x5'));var Mustache=require('mustache');var util=require(_0xa033('0x6'));var path=require(_0xa033('0x7'));var sox=require(_0xa033('0x8'));var csv=require(_0xa033('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa033('0xa'));var crypto=require(_0xa033('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa033('0xc'));var toCsv=require(_0xa033('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa033('0xd'));var authService=require(_0xa033('0xe'));var qs=require(_0xa033('0xf'));var as=require(_0xa033('0x10'));var hardwareService=require(_0xa033('0x11'));var logger=require('../../config/logger')(_0xa033('0x12'));var utils=require('../../config/utils');var config=require(_0xa033('0x13'));var licenseUtil=require(_0xa033('0x14'));var db=require(_0xa033('0x15'))['db'];function respondWithStatusCode(_0x23807f,_0x101777){_0x101777=_0x101777||0xcc;return function(_0x3eb052){if(_0x3eb052){return _0x23807f[_0xa033('0x16')](_0x101777);}return _0x23807f[_0xa033('0x17')](_0x101777)[_0xa033('0x18')]();};}function respondWithResult(_0x1af8a3,_0x5367ab){_0x5367ab=_0x5367ab||0xc8;return function(_0x1ae8a6){if(_0x1ae8a6){return _0x1af8a3['status'](_0x5367ab)[_0xa033('0x19')](_0x1ae8a6);}};}function respondWithFilteredResult(_0x353cfd,_0x2436cf){return function(_0x491151){if(_0x491151){var _0x184392=_0x491151[_0xa033('0x1a')],_0xcd5a19=_0x2436cf['offset'],_0x899f46=_0x2436cf[_0xa033('0x1b')]+_0x2436cf[_0xa033('0x1c')],_0xeacbd3;if(_0x899f46>=_0x184392){_0x899f46=_0x184392;_0xeacbd3=0xc8;}else{_0xeacbd3=0xce;}_0x353cfd[_0xa033('0x17')](_0xeacbd3);return _0x353cfd[_0xa033('0x1d')](_0xa033('0x1e'),_0xcd5a19+'-'+_0x899f46+'/'+_0x184392)[_0xa033('0x19')](_0x491151);}return null;};}function patchUpdates(_0x188d9a){return function(_0x55e16a){try{jsonpatch[_0xa033('0x1f')](_0x55e16a,_0x188d9a,!![]);}catch(_0x48c8ba){return BPromise[_0xa033('0x20')](_0x48c8ba);}return _0x55e16a[_0xa033('0x21')]();};}function saveUpdates(_0xbdcab3,_0x359d9b){return function(_0x3ec380){if(_0x3ec380){return _0x3ec380[_0xa033('0x22')](_0xbdcab3)['then'](function(_0x326aff){return _0x326aff;});}return null;};}function removeEntity(_0x4440e3,_0x3f7111){return function(_0x4c8922){if(_0x4c8922){return _0x4c8922[_0xa033('0x23')]()[_0xa033('0x24')](function(){var _0x581c89=_0x4c8922[_0xa033('0x25')]({'plain':!![]});var _0x3ceace=_0xa033('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x3ceace,'resourceId':_0x581c89['id']}})[_0xa033('0x24')](function(){return _0x4c8922;});})['then'](function(){_0x4440e3[_0xa033('0x17')](0xcc)[_0xa033('0x18')]();});}};}function handleEntityNotFound(_0x55cae7,_0x30e9b9){return function(_0xc1bf95){if(!_0xc1bf95){_0x55cae7[_0xa033('0x16')](0x194);}return _0xc1bf95;};}function handleError(_0x43f10b,_0x145a3c){_0x145a3c=_0x145a3c||0x1f4;return function(_0xf51779){logger[_0xa033('0x27')](_0xf51779['stack']);if(_0xf51779['name']){delete _0xf51779['name'];}_0x43f10b[_0xa033('0x17')](_0x145a3c)[_0xa033('0x28')](_0xf51779);};}exports[_0xa033('0x29')]=function(_0x4fa492,_0x23cac0){var _0x3e6562={},_0x209b17={},_0x4b6f04={'count':0x0,'rows':[]};var _0xc49c69=_[_0xa033('0x2a')](db['Pause']['rawAttributes'],function(_0x27242f){return{'name':_0x27242f[_0xa033('0x2b')],'type':_0x27242f[_0xa033('0x2c')]['key']};});_0x209b17[_0xa033('0x2d')]=_[_0xa033('0x2a')](_0xc49c69,_0xa033('0x2e'));_0x209b17['query']=_[_0xa033('0x2f')](_0x4fa492['query']);_0x209b17[_0xa033('0x30')]=_[_0xa033('0x31')](_0x209b17[_0xa033('0x2d')],_0x209b17['query']);_0x3e6562[_0xa033('0x32')]=_[_0xa033('0x31')](_0x209b17[_0xa033('0x2d')],qs[_0xa033('0x33')](_0x4fa492[_0xa033('0x34')]['fields']));_0x3e6562['attributes']=_0x3e6562[_0xa033('0x32')][_0xa033('0x35')]?_0x3e6562[_0xa033('0x32')]:_0x209b17[_0xa033('0x2d')];if(!_0x4fa492[_0xa033('0x34')][_0xa033('0x36')]('nolimit')){_0x3e6562['limit']=qs[_0xa033('0x1c')](_0x4fa492[_0xa033('0x34')]['limit']);_0x3e6562['offset']=qs[_0xa033('0x1b')](_0x4fa492[_0xa033('0x34')][_0xa033('0x1b')]);}_0x3e6562[_0xa033('0x37')]=qs[_0xa033('0x38')](_0x4fa492[_0xa033('0x34')][_0xa033('0x38')]);_0x3e6562['where']=qs[_0xa033('0x30')](_[_0xa033('0x39')](_0x4fa492['query'],_0x209b17[_0xa033('0x30')]),_0xc49c69);if(_0x4fa492['query']['filter']){_0x3e6562[_0xa033('0x3a')]=_[_0xa033('0x3b')](_0x3e6562['where'],{'$or':_[_0xa033('0x2a')](_0xc49c69,function(_0x2991ee){if(_0x2991ee['type']!==_0xa033('0x3c')){var _0x30ff58={};_0x30ff58[_0x2991ee[_0xa033('0x2e')]]={'$like':'%'+_0x4fa492['query'][_0xa033('0x3d')]+'%'};return _0x30ff58;}})});}_0x3e6562=_[_0xa033('0x3b')]({},_0x3e6562,_0x4fa492['options']);var _0x43b844={'where':_0x3e6562[_0xa033('0x3a')]};return db['Pause'][_0xa033('0x1a')](_0x43b844)['then'](function(_0x116362){_0x4b6f04[_0xa033('0x1a')]=_0x116362;if(_0x4fa492[_0xa033('0x34')][_0xa033('0x3e')]){_0x3e6562['include']=[{'all':!![]}];}return db[_0xa033('0x3f')][_0xa033('0x40')](_0x3e6562);})['then'](function(_0x2a8e68){_0x4b6f04[_0xa033('0x41')]=_0x2a8e68;return _0x4b6f04;})[_0xa033('0x24')](respondWithFilteredResult(_0x23cac0,_0x3e6562))['catch'](handleError(_0x23cac0,null));};exports[_0xa033('0x42')]=function(_0x1f6aa9,_0x24fbe1){var _0x5c66a3={'raw':!![],'where':{'id':_0x1f6aa9[_0xa033('0x43')]['id']}},_0x1f2e32={};_0x1f2e32[_0xa033('0x2d')]=_[_0xa033('0x2f')](db[_0xa033('0x3f')][_0xa033('0x44')]);_0x1f2e32[_0xa033('0x34')]=_['keys'](_0x1f6aa9[_0xa033('0x34')]);_0x1f2e32[_0xa033('0x30')]=_[_0xa033('0x31')](_0x1f2e32[_0xa033('0x2d')],_0x1f2e32[_0xa033('0x34')]);_0x5c66a3[_0xa033('0x32')]=_[_0xa033('0x31')](_0x1f2e32[_0xa033('0x2d')],qs['fields'](_0x1f6aa9[_0xa033('0x34')][_0xa033('0x33')]));_0x5c66a3[_0xa033('0x32')]=_0x5c66a3[_0xa033('0x32')][_0xa033('0x35')]?_0x5c66a3['attributes']:_0x1f2e32[_0xa033('0x2d')];if(_0x1f6aa9[_0xa033('0x34')][_0xa033('0x3e')]){_0x5c66a3[_0xa033('0x45')]=[{'all':!![]}];}_0x5c66a3=_['merge']({},_0x5c66a3,_0x1f6aa9['options']);return db['Pause']['find'](_0x5c66a3)[_0xa033('0x24')](handleEntityNotFound(_0x24fbe1,null))[_0xa033('0x24')](respondWithResult(_0x24fbe1,null))[_0xa033('0x46')](handleError(_0x24fbe1,null));};exports[_0xa033('0x47')]=function(_0x41308f,_0x56c574){return db[_0xa033('0x3f')][_0xa033('0x47')](_0x41308f[_0xa033('0x48')],{})['then'](function(_0x14c1f0){var _0x36f749=_0x41308f[_0xa033('0x49')][_0xa033('0x25')]({'plain':!![]});if(!_0x36f749)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36f749[_0xa033('0x4a')]===_0xa033('0x49')){var _0xcbe23a=_0x14c1f0['get']({'plain':!![]});var _0x3995d4=_0xa033('0x26');return db[_0xa033('0x4b')][_0xa033('0x4c')]({'where':{'name':_0x3995d4,'userProfileId':_0x36f749[_0xa033('0x4d')]},'raw':!![]})['then'](function(_0x5d130f){if(_0x5d130f&&_0x5d130f[_0xa033('0x4e')]===0x0){return db['UserProfileResource'][_0xa033('0x47')]({'name':_0xcbe23a[_0xa033('0x2e')],'resourceId':_0xcbe23a['id'],'type':_0x5d130f['name'],'sectionId':_0x5d130f['id']},{})[_0xa033('0x24')](function(){return _0x14c1f0;});}else{return _0x14c1f0;}})['catch'](function(_0x59c7c3){logger['error'](_0xa033('0x4f'),_0x59c7c3);throw _0x59c7c3;});}return _0x14c1f0;})[_0xa033('0x24')](respondWithResult(_0x56c574,0xc9))[_0xa033('0x46')](handleError(_0x56c574,null));};exports[_0xa033('0x22')]=function(_0x3c1c17,_0x6b7c2d){if(_0x3c1c17[_0xa033('0x48')]['id']){delete _0x3c1c17[_0xa033('0x48')]['id'];}return db[_0xa033('0x3f')][_0xa033('0x4c')]({'where':{'id':_0x3c1c17[_0xa033('0x43')]['id']}})['then'](handleEntityNotFound(_0x6b7c2d,null))[_0xa033('0x24')](saveUpdates(_0x3c1c17['body'],null))[_0xa033('0x24')](respondWithResult(_0x6b7c2d,null))[_0xa033('0x46')](handleError(_0x6b7c2d,null));};exports[_0xa033('0x23')]=function(_0x3b4ac3,_0x238407){return db[_0xa033('0x3f')][_0xa033('0x4c')]({'where':{'id':_0x3b4ac3[_0xa033('0x43')]['id']}})['then'](handleEntityNotFound(_0x238407,null))[_0xa033('0x24')](removeEntity(_0x238407,null))['catch'](handleError(_0x238407,null));}; \ No newline at end of file +var _0x8c46=['order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','then','count','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','get','Pauses','UserProfileResource','end','error','stack','name','send','index','Pause','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4a3280,_0x1eec67){var _0x4ff16e=function(_0x442c72){while(--_0x442c72){_0x4a3280['push'](_0x4a3280['shift']());}};_0x4ff16e(++_0x1eec67);}(_0x8c46,0x167));var _0x68c4=function(_0xf3fb4e,_0x1f8665){_0xf3fb4e=_0xf3fb4e-0x0;var _0x561bdb=_0x8c46[_0xf3fb4e];return _0x561bdb;};'use strict';var pdf=require(_0x68c4('0x0'));var emlformat=require(_0x68c4('0x1'));var rimraf=require(_0x68c4('0x2'));var zipdir=require(_0x68c4('0x3'));var jsonpatch=require(_0x68c4('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x68c4('0x5'));var Mustache=require(_0x68c4('0x6'));var util=require(_0x68c4('0x7'));var path=require(_0x68c4('0x8'));var sox=require(_0x68c4('0x9'));var csv=require(_0x68c4('0xa'));var ejs=require(_0x68c4('0xb'));var fs=require('fs');var _=require(_0x68c4('0xc'));var squel=require(_0x68c4('0xd'));var crypto=require(_0x68c4('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x68c4('0xa'));var querystring=require(_0x68c4('0xf'));var Papa=require(_0x68c4('0x10'));var Redis=require(_0x68c4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x68c4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68c4('0x13'));var logger=require('../../config/logger')(_0x68c4('0x14'));var utils=require(_0x68c4('0x15'));var config=require(_0x68c4('0x16'));var licenseUtil=require(_0x68c4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bf29f,_0x571840){_0x571840=_0x571840||0xcc;return function(_0x2be278){if(_0x2be278){return _0x4bf29f[_0x68c4('0x18')](_0x571840);}return _0x4bf29f[_0x68c4('0x19')](_0x571840)['end']();};}function respondWithResult(_0x4c2221,_0x139764){_0x139764=_0x139764||0xc8;return function(_0x3daf10){if(_0x3daf10){return _0x4c2221['status'](_0x139764)[_0x68c4('0x1a')](_0x3daf10);}};}function respondWithFilteredResult(_0x1b4af5,_0x5005d2){return function(_0xe07c2e){if(_0xe07c2e){var _0xa52bd1=_0xe07c2e['count'],_0x2dc00d=_0x5005d2[_0x68c4('0x1b')],_0x268597=_0x5005d2[_0x68c4('0x1b')]+_0x5005d2[_0x68c4('0x1c')],_0x3158b7;if(_0x268597>=_0xa52bd1){_0x268597=_0xa52bd1;_0x3158b7=0xc8;}else{_0x3158b7=0xce;}_0x1b4af5['status'](_0x3158b7);return _0x1b4af5[_0x68c4('0x1d')](_0x68c4('0x1e'),_0x2dc00d+'-'+_0x268597+'/'+_0xa52bd1)[_0x68c4('0x1a')](_0xe07c2e);}return null;};}function patchUpdates(_0x5217b8){return function(_0x134e30){try{jsonpatch[_0x68c4('0x1f')](_0x134e30,_0x5217b8,!![]);}catch(_0x274d0a){return BPromise['reject'](_0x274d0a);}return _0x134e30[_0x68c4('0x20')]();};}function saveUpdates(_0x1c79e1,_0xff2a89){return function(_0x27d69b){if(_0x27d69b){return _0x27d69b[_0x68c4('0x21')](_0x1c79e1)['then'](function(_0x4ee46d){return _0x4ee46d;});}return null;};}function removeEntity(_0x1f196b,_0x56c4ef){return function(_0x5b09b3){if(_0x5b09b3){return _0x5b09b3[_0x68c4('0x22')]()['then'](function(){var _0x16ba0f=_0x5b09b3[_0x68c4('0x23')]({'plain':!![]});var _0x5319fa=_0x68c4('0x24');return db[_0x68c4('0x25')]['destroy']({'where':{'type':_0x5319fa,'resourceId':_0x16ba0f['id']}})['then'](function(){return _0x5b09b3;});})['then'](function(){_0x1f196b[_0x68c4('0x19')](0xcc)[_0x68c4('0x26')]();});}};}function handleEntityNotFound(_0x2592b3,_0x46cd7a){return function(_0x354c48){if(!_0x354c48){_0x2592b3['sendStatus'](0x194);}return _0x354c48;};}function handleError(_0x24b800,_0x394339){_0x394339=_0x394339||0x1f4;return function(_0x46ac7b){logger[_0x68c4('0x27')](_0x46ac7b[_0x68c4('0x28')]);if(_0x46ac7b['name']){delete _0x46ac7b[_0x68c4('0x29')];}_0x24b800[_0x68c4('0x19')](_0x394339)[_0x68c4('0x2a')](_0x46ac7b);};}exports[_0x68c4('0x2b')]=function(_0x4e6b1a,_0x380671){var _0x16ddca={},_0x445234={},_0x407f21={'count':0x0,'rows':[]};var _0x406616=_['map'](db[_0x68c4('0x2c')]['rawAttributes'],function(_0x404b00){return{'name':_0x404b00[_0x68c4('0x2d')],'type':_0x404b00['type'][_0x68c4('0x2e')]};});_0x445234[_0x68c4('0x2f')]=_['map'](_0x406616,'name');_0x445234['query']=_[_0x68c4('0x30')](_0x4e6b1a[_0x68c4('0x31')]);_0x445234[_0x68c4('0x32')]=_[_0x68c4('0x33')](_0x445234[_0x68c4('0x2f')],_0x445234[_0x68c4('0x31')]);_0x16ddca[_0x68c4('0x34')]=_['intersection'](_0x445234['model'],qs[_0x68c4('0x35')](_0x4e6b1a[_0x68c4('0x31')][_0x68c4('0x35')]));_0x16ddca['attributes']=_0x16ddca[_0x68c4('0x34')][_0x68c4('0x36')]?_0x16ddca[_0x68c4('0x34')]:_0x445234[_0x68c4('0x2f')];if(!_0x4e6b1a[_0x68c4('0x31')][_0x68c4('0x37')]('nolimit')){_0x16ddca[_0x68c4('0x1c')]=qs[_0x68c4('0x1c')](_0x4e6b1a['query']['limit']);_0x16ddca['offset']=qs['offset'](_0x4e6b1a[_0x68c4('0x31')][_0x68c4('0x1b')]);}_0x16ddca[_0x68c4('0x38')]=qs[_0x68c4('0x39')](_0x4e6b1a['query'][_0x68c4('0x39')]);_0x16ddca[_0x68c4('0x3a')]=qs[_0x68c4('0x32')](_[_0x68c4('0x3b')](_0x4e6b1a[_0x68c4('0x31')],_0x445234[_0x68c4('0x32')]),_0x406616);if(_0x4e6b1a[_0x68c4('0x31')][_0x68c4('0x3c')]){_0x16ddca[_0x68c4('0x3a')]=_[_0x68c4('0x3d')](_0x16ddca[_0x68c4('0x3a')],{'$or':_[_0x68c4('0x3e')](_0x406616,function(_0x318be2){if(_0x318be2[_0x68c4('0x3f')]!==_0x68c4('0x40')){var _0x496a4c={};_0x496a4c[_0x318be2[_0x68c4('0x29')]]={'$like':'%'+_0x4e6b1a[_0x68c4('0x31')][_0x68c4('0x3c')]+'%'};return _0x496a4c;}})});}_0x16ddca=_[_0x68c4('0x3d')]({},_0x16ddca,_0x4e6b1a[_0x68c4('0x41')]);var _0x31ebdb={'where':_0x16ddca['where']};return db[_0x68c4('0x2c')]['count'](_0x31ebdb)[_0x68c4('0x42')](function(_0x570530){_0x407f21[_0x68c4('0x43')]=_0x570530;if(_0x4e6b1a[_0x68c4('0x31')][_0x68c4('0x44')]){_0x16ddca[_0x68c4('0x45')]=[{'all':!![]}];}return db[_0x68c4('0x2c')][_0x68c4('0x46')](_0x16ddca);})[_0x68c4('0x42')](function(_0x16ab91){_0x407f21[_0x68c4('0x47')]=_0x16ab91;return _0x407f21;})[_0x68c4('0x42')](respondWithFilteredResult(_0x380671,_0x16ddca))[_0x68c4('0x48')](handleError(_0x380671,null));};exports[_0x68c4('0x49')]=function(_0x5efc06,_0x5bc14d){var _0x3498a9={'raw':!![],'where':{'id':_0x5efc06['params']['id']}},_0x34a74e={};_0x34a74e[_0x68c4('0x2f')]=_[_0x68c4('0x30')](db[_0x68c4('0x2c')]['rawAttributes']);_0x34a74e['query']=_[_0x68c4('0x30')](_0x5efc06[_0x68c4('0x31')]);_0x34a74e[_0x68c4('0x32')]=_[_0x68c4('0x33')](_0x34a74e[_0x68c4('0x2f')],_0x34a74e['query']);_0x3498a9['attributes']=_[_0x68c4('0x33')](_0x34a74e[_0x68c4('0x2f')],qs[_0x68c4('0x35')](_0x5efc06['query'][_0x68c4('0x35')]));_0x3498a9[_0x68c4('0x34')]=_0x3498a9[_0x68c4('0x34')]['length']?_0x3498a9[_0x68c4('0x34')]:_0x34a74e[_0x68c4('0x2f')];if(_0x5efc06[_0x68c4('0x31')][_0x68c4('0x44')]){_0x3498a9['include']=[{'all':!![]}];}_0x3498a9=_[_0x68c4('0x3d')]({},_0x3498a9,_0x5efc06['options']);return db['Pause'][_0x68c4('0x4a')](_0x3498a9)[_0x68c4('0x42')](handleEntityNotFound(_0x5bc14d,null))['then'](respondWithResult(_0x5bc14d,null))[_0x68c4('0x48')](handleError(_0x5bc14d,null));};exports[_0x68c4('0x4b')]=function(_0x43f5b0,_0x371253){return db['Pause'][_0x68c4('0x4b')](_0x43f5b0[_0x68c4('0x4c')],{})['then'](function(_0x5f19a4){var _0x2e5cb2=_0x43f5b0[_0x68c4('0x4d')]['get']({'plain':!![]});if(!_0x2e5cb2)throw new Error(_0x68c4('0x4e'));if(_0x2e5cb2['role']==='user'){var _0x345e93=_0x5f19a4['get']({'plain':!![]});var _0x58f5a6=_0x68c4('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x58f5a6,'userProfileId':_0x2e5cb2[_0x68c4('0x4f')]},'raw':!![]})[_0x68c4('0x42')](function(_0x5f6bff){if(_0x5f6bff&&_0x5f6bff[_0x68c4('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x345e93[_0x68c4('0x29')],'resourceId':_0x345e93['id'],'type':_0x5f6bff['name'],'sectionId':_0x5f6bff['id']},{})[_0x68c4('0x42')](function(){return _0x5f19a4;});}else{return _0x5f19a4;}})[_0x68c4('0x48')](function(_0x24a911){logger[_0x68c4('0x27')](_0x68c4('0x51'),_0x24a911);throw _0x24a911;});}return _0x5f19a4;})[_0x68c4('0x42')](respondWithResult(_0x371253,0xc9))[_0x68c4('0x48')](handleError(_0x371253,null));};exports[_0x68c4('0x21')]=function(_0x15b77e,_0x5402ad){if(_0x15b77e[_0x68c4('0x4c')]['id']){delete _0x15b77e[_0x68c4('0x4c')]['id'];}return db[_0x68c4('0x2c')]['find']({'where':{'id':_0x15b77e[_0x68c4('0x52')]['id']}})['then'](handleEntityNotFound(_0x5402ad,null))[_0x68c4('0x42')](saveUpdates(_0x15b77e[_0x68c4('0x4c')],null))[_0x68c4('0x42')](respondWithResult(_0x5402ad,null))[_0x68c4('0x48')](handleError(_0x5402ad,null));};exports[_0x68c4('0x22')]=function(_0x3698dc,_0x576f58){return db['Pause'][_0x68c4('0x4a')]({'where':{'id':_0x3698dc[_0x68c4('0x52')]['id']}})[_0x68c4('0x42')](handleEntityNotFound(_0x576f58,null))[_0x68c4('0x42')](removeEntity(_0x576f58,null))[_0x68c4('0x48')](handleError(_0x576f58,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 59e4f63..76bade7 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 _0x5f66=['request-promise','path','../../config/environment','exports','Pause','tools_pauses','util','api','moment','bluebird'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'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('./pause.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 _0xb0ee=['./pause.attributes','define','Pause','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1dce91,_0x5021c7){var _0x57834e=function(_0x1837ed){while(--_0x1837ed){_0x1dce91['push'](_0x1dce91['shift']());}};_0x57834e(++_0x5021c7);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xb0ee[_0x42bdad];return _0x122626;};'use strict';var _=require('lodash');var util=require(_0xeb0e('0x0'));var logger=require(_0xeb0e('0x1'))(_0xeb0e('0x2'));var moment=require(_0xeb0e('0x3'));var BPromise=require(_0xeb0e('0x4'));var rp=require(_0xeb0e('0x5'));var fs=require('fs');var path=require(_0xeb0e('0x6'));var rimraf=require(_0xeb0e('0x7'));var config=require(_0xeb0e('0x8'));var attributes=require(_0xeb0e('0x9'));module['exports']=function(_0x1a95ad,_0x1e8dca){return _0x1a95ad[_0xeb0e('0xa')](_0xeb0e('0xb'),attributes,{'tableName':'tools_pauses','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 958f2d9..7e27b29 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 _0xd319=['model','ShowPause','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error','code','Pause,\x20%s,\x20%s','message','info','result','catch','Pause','find','options','where','attributes','include'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xd319,0x12e));var _0x9d31=function(_0x4657f0,_0x2bc16d){_0x4657f0=_0x4657f0-0x0;var _0x286c34=_0xd319[_0x4657f0];return _0x286c34;};'use strict';var _=require(_0x9d31('0x0'));var util=require(_0x9d31('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d31('0x2'));var db=require(_0x9d31('0x3'))['db'];var utils=require(_0x9d31('0x4'));var logger=require(_0x9d31('0x5'))(_0x9d31('0x6'));var config=require(_0x9d31('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9d31('0x8')][_0x9d31('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x300ad0,_0x409285,_0x4c2524){return new BPromise(function(_0x282dc6,_0x2f0e45){return client[_0x9d31('0xa')](_0x300ad0,_0x4c2524)[_0x9d31('0xb')](function(_0x34306e){logger['info']('Pause,\x20%s,\x20%s',_0x409285,_0x9d31('0xc'));logger[_0x9d31('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x409285,_0x9d31('0xc'),JSON[_0x9d31('0xe')](_0x34306e));if(_0x34306e[_0x9d31('0xf')]){if(_0x34306e['error'][_0x9d31('0x10')]===0x1f4){logger[_0x9d31('0xf')](_0x9d31('0x11'),_0x409285,_0x34306e[_0x9d31('0xf')][_0x9d31('0x12')]);return _0x2f0e45(_0x34306e[_0x9d31('0xf')][_0x9d31('0x12')]);}logger[_0x9d31('0xf')](_0x9d31('0x11'),_0x409285,_0x34306e[_0x9d31('0xf')][_0x9d31('0x12')]);return _0x282dc6(_0x34306e[_0x9d31('0xf')][_0x9d31('0x12')]);}else{logger[_0x9d31('0x13')](_0x9d31('0x11'),_0x409285,_0x9d31('0xc'));_0x282dc6(_0x34306e[_0x9d31('0x14')][_0x9d31('0x12')]);}})[_0x9d31('0x15')](function(_0x399e50){logger['error']('Pause,\x20%s,\x20%s',_0x409285,_0x399e50);_0x2f0e45(_0x399e50);});});}exports['ShowPause']=function(_0x3ac7d6){var _0xb77e5c=this;return new Promise(function(_0x54bba1,_0x16253a){return db[_0x9d31('0x16')][_0x9d31('0x17')]({'raw':_0x3ac7d6[_0x9d31('0x18')]?_0x3ac7d6[_0x9d31('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3ac7d6[_0x9d31('0x18')]?_0x3ac7d6[_0x9d31('0x18')][_0x9d31('0x19')]||null:null,'attributes':_0x3ac7d6[_0x9d31('0x18')]?_0x3ac7d6['options'][_0x9d31('0x1a')]||null:null,'include':_0x3ac7d6[_0x9d31('0x18')]?_0x3ac7d6[_0x9d31('0x18')]['include']?_['map'](_0x3ac7d6[_0x9d31('0x18')][_0x9d31('0x1b')],function(_0x1e8dc1){return{'model':db[_0x1e8dc1[_0x9d31('0x1c')]],'as':_0x1e8dc1['as'],'attributes':_0x1e8dc1['attributes'],'include':_0x1e8dc1[_0x9d31('0x1b')]?_['map'](_0x1e8dc1['include'],function(_0x361d12){return{'model':db[_0x361d12[_0x9d31('0x1c')]],'as':_0x361d12['as'],'attributes':_0x361d12[_0x9d31('0x1a')],'include':_0x361d12[_0x9d31('0x1b')]?_['map'](_0x361d12[_0x9d31('0x1b')],function(_0x47bd58){return{'model':db[_0x47bd58[_0x9d31('0x1c')]],'as':_0x47bd58['as'],'attributes':_0x47bd58['attributes']};}):[]};}):[]};}):[]:[]})[_0x9d31('0xb')](function(_0x11ce61){logger['info'](_0x9d31('0x1d'),_0x3ac7d6);logger[_0x9d31('0xd')]('ShowPause',_0x3ac7d6,JSON['stringify'](_0x11ce61));_0x54bba1(_0x11ce61);})['catch'](function(_0x3d7336){logger['error'](_0x9d31('0x1d'),_0x3d7336[_0x9d31('0x12')],_0x3ac7d6);_0x16253a(_0xb77e5c['error'](0x1f4,_0x3d7336[_0x9d31('0x12')]));});});}; \ No newline at end of file +var _0xc606=['debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','find','options','raw','where','attributes','include','map','model','then','ShowPause','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','Pause,\x20%s,\x20%s','request\x20sent'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc606,0x17c));var _0x6c60=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0xc606[_0x138d06];return _0x1a01eb;};'use strict';var _=require(_0x6c60('0x0'));var util=require(_0x6c60('0x1'));var moment=require(_0x6c60('0x2'));var BPromise=require(_0x6c60('0x3'));var rs=require(_0x6c60('0x4'));var fs=require('fs');var Redis=require(_0x6c60('0x5'));var db=require(_0x6c60('0x6'))['db'];var utils=require(_0x6c60('0x7'));var logger=require(_0x6c60('0x8'))(_0x6c60('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6c60('0xa')][_0x6c60('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe2184e,_0x4d05f1,_0x1df661){return new BPromise(function(_0x55336a,_0x1e8996){return client[_0x6c60('0xc')](_0xe2184e,_0x1df661)['then'](function(_0x369e5f){logger[_0x6c60('0xd')](_0x6c60('0xe'),_0x4d05f1,_0x6c60('0xf'));logger[_0x6c60('0x10')](_0x6c60('0x11'),_0x4d05f1,_0x6c60('0xf'),JSON[_0x6c60('0x12')](_0x369e5f));if(_0x369e5f[_0x6c60('0x13')]){if(_0x369e5f[_0x6c60('0x13')][_0x6c60('0x14')]===0x1f4){logger[_0x6c60('0x13')](_0x6c60('0xe'),_0x4d05f1,_0x369e5f[_0x6c60('0x13')][_0x6c60('0x15')]);return _0x1e8996(_0x369e5f['error'][_0x6c60('0x15')]);}logger['error']('Pause,\x20%s,\x20%s',_0x4d05f1,_0x369e5f[_0x6c60('0x13')]['message']);return _0x55336a(_0x369e5f['error'][_0x6c60('0x15')]);}else{logger['info'](_0x6c60('0xe'),_0x4d05f1,'request\x20sent');_0x55336a(_0x369e5f['result'][_0x6c60('0x15')]);}})[_0x6c60('0x16')](function(_0x388793){logger[_0x6c60('0x13')](_0x6c60('0xe'),_0x4d05f1,_0x388793);_0x1e8996(_0x388793);});});}exports['ShowPause']=function(_0x4450f0){var _0x21ff22=this;return new Promise(function(_0x3326ce,_0x443c5e){return db['Pause'][_0x6c60('0x17')]({'raw':_0x4450f0['options']?_0x4450f0[_0x6c60('0x18')][_0x6c60('0x19')]===undefined?!![]:![]:!![],'where':_0x4450f0['options']?_0x4450f0[_0x6c60('0x18')][_0x6c60('0x1a')]||null:null,'attributes':_0x4450f0[_0x6c60('0x18')]?_0x4450f0['options'][_0x6c60('0x1b')]||null:null,'include':_0x4450f0[_0x6c60('0x18')]?_0x4450f0['options'][_0x6c60('0x1c')]?_['map'](_0x4450f0[_0x6c60('0x18')]['include'],function(_0x2cc02){return{'model':db[_0x2cc02['model']],'as':_0x2cc02['as'],'attributes':_0x2cc02[_0x6c60('0x1b')],'include':_0x2cc02[_0x6c60('0x1c')]?_[_0x6c60('0x1d')](_0x2cc02[_0x6c60('0x1c')],function(_0x3f15b1){return{'model':db[_0x3f15b1['model']],'as':_0x3f15b1['as'],'attributes':_0x3f15b1['attributes'],'include':_0x3f15b1[_0x6c60('0x1c')]?_['map'](_0x3f15b1[_0x6c60('0x1c')],function(_0x399fb4){return{'model':db[_0x399fb4[_0x6c60('0x1e')]],'as':_0x399fb4['as'],'attributes':_0x399fb4[_0x6c60('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6c60('0x1f')](function(_0x16ca4e){logger[_0x6c60('0xd')](_0x6c60('0x20'),_0x4450f0);logger['debug'](_0x6c60('0x20'),_0x4450f0,JSON['stringify'](_0x16ca4e));_0x3326ce(_0x16ca4e);})[_0x6c60('0x16')](function(_0x3412fc){logger[_0x6c60('0x13')](_0x6c60('0x20'),_0x3412fc['message'],_0x4450f0);_0x443c5e(_0x21ff22[_0x6c60('0x13')](0x1f4,_0x3412fc[_0x6c60('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 124d0ae..e6e8785 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 _0x905e=['Router','../../components/auth/service','../../components/interaction/service','get','/:id','show','isAuthenticated','download','diskStorage','join','server/files/plugins','replace','format','basename','originalname','extname','now','single','upload','/webhook','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x905e,0xaf));var _0xe905=function(_0xb2f567,_0x2aafa8){_0xb2f567=_0xb2f567-0x0;var _0x2ee5d5=_0x905e[_0xb2f567];return _0x2ee5d5;};'use strict';var multer=require(_0xe905('0x0'));var util=require(_0xe905('0x1'));var path=require(_0xe905('0x2'));var timeout=require(_0xe905('0x3'));var express=require(_0xe905('0x4'));var router=express[_0xe905('0x5')]();var auth=require(_0xe905('0x6'));var interaction=require(_0xe905('0x7'));var config=require('../../config/environment');var controller=require('./plugin.controller');router[_0xe905('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/webhook',controller['webhookGet']);router[_0xe905('0x8')](_0xe905('0x9'),auth['isAuthenticated'](),controller[_0xe905('0xa')]);router[_0xe905('0x8')]('/:id/download',auth[_0xe905('0xb')](),controller[_0xe905('0xc')]);var upload=multer({'storage':multer[_0xe905('0xd')]({'destination':function(_0x50d7a5,_0x19b28f,_0x134198){_0x134198(null,path[_0xe905('0xe')](config['root'],_0xe905('0xf')));},'filename':function(_0x1e995a,_0x1f2fe7,_0x196dc6){_0x1f2fe7['originalname']=_0x1f2fe7['originalname'][_0xe905('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x196dc6(null,util[_0xe905('0x11')]('%s-%s%s',path[_0xe905('0x12')](_0x1f2fe7[_0xe905('0x13')],path[_0xe905('0x14')](_0x1f2fe7[_0xe905('0x13')])),Date[_0xe905('0x15')](),path['extname'](_0x1f2fe7['originalname'])));}})});router['post']('/',upload[_0xe905('0x16')]('file'),controller[_0xe905('0x17')]);router['post'](_0xe905('0x18'),controller[_0xe905('0x19')]);router[_0xe905('0x1a')](_0xe905('0x9'),auth[_0xe905('0xb')](),controller[_0xe905('0x1b')]);router[_0xe905('0x1c')](_0xe905('0x9'),auth[_0xe905('0xb')](),controller['delete']);module[_0xe905('0x1d')]=router; \ No newline at end of file +var _0x5d60=['show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','extname','file','upload','webhookPost','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet'];(function(_0x4be9e3,_0x79a04e){var _0x15f280=function(_0x53a342){while(--_0x53a342){_0x4be9e3['push'](_0x4be9e3['shift']());}};_0x15f280(++_0x79a04e);}(_0x5d60,0x17b));var _0x05d6=function(_0x3c0394,_0x1e7ee7){_0x3c0394=_0x3c0394-0x0;var _0x22c6e0=_0x5d60[_0x3c0394];return _0x22c6e0;};'use strict';var multer=require(_0x05d6('0x0'));var util=require(_0x05d6('0x1'));var path=require('path');var timeout=require(_0x05d6('0x2'));var express=require(_0x05d6('0x3'));var router=express[_0x05d6('0x4')]();var auth=require(_0x05d6('0x5'));var interaction=require(_0x05d6('0x6'));var config=require(_0x05d6('0x7'));var controller=require('./plugin.controller');router[_0x05d6('0x8')]('/',auth[_0x05d6('0x9')](),controller[_0x05d6('0xa')]);router[_0x05d6('0x8')](_0x05d6('0xb'),controller[_0x05d6('0xc')]);router[_0x05d6('0x8')]('/:id',auth[_0x05d6('0x9')](),controller[_0x05d6('0xd')]);router['get'](_0x05d6('0xe'),auth[_0x05d6('0x9')](),controller['download']);var upload=multer({'storage':multer[_0x05d6('0xf')]({'destination':function(_0x17013f,_0x30ff2f,_0x41302e){_0x41302e(null,path[_0x05d6('0x10')](config[_0x05d6('0x11')],_0x05d6('0x12')));},'filename':function(_0x58d309,_0x2d1042,_0x1dc78c){_0x2d1042['originalname']=_0x2d1042[_0x05d6('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1dc78c(null,util['format']('%s-%s%s',path['basename'](_0x2d1042[_0x05d6('0x13')],path[_0x05d6('0x14')](_0x2d1042[_0x05d6('0x13')])),Date['now'](),path[_0x05d6('0x14')](_0x2d1042[_0x05d6('0x13')])));}})});router['post']('/',upload['single'](_0x05d6('0x15')),controller[_0x05d6('0x16')]);router['post'](_0x05d6('0xb'),controller[_0x05d6('0x17')]);router['put'](_0x05d6('0x18'),auth[_0x05d6('0x9')](),controller[_0x05d6('0x19')]);router[_0x05d6('0x1a')](_0x05d6('0x18'),auth['isAuthenticated'](),controller[_0x05d6('0x1a')]);module[_0x05d6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a6d9fb3..a6552a5 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 _0xcb66=['adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','ENUM'];(function(_0x3b79d2,_0x29d9bd){var _0x1aa87f=function(_0x2cc074){while(--_0x2cc074){_0x3b79d2['push'](_0x3b79d2['shift']());}};_0x1aa87f(++_0x29d9bd);}(_0xcb66,0xd5));var _0x6cb6=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0xcb66[_0x30182f];return _0x5207db;};'use strict';var Sequelize=require(_0x6cb6('0x0'));module[_0x6cb6('0x1')]={'name':{'type':Sequelize[_0x6cb6('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6cb6('0x3'),'script')},'description':{'type':Sequelize[_0x6cb6('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x6cb6('0x5')},'active':{'type':Sequelize[_0x6cb6('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x6cb6('0x7')](_0x6cb6('0x8'),_0x6cb6('0x9'),_0x6cb6('0xa'),_0x6cb6('0xb')),'defaultValue':_0x6cb6('0xa'),'comment':_0x6cb6('0xc')},'icon':{'type':Sequelize[_0x6cb6('0x2')]},'adminUrl':{'type':Sequelize[_0x6cb6('0x2')]},'agentUrl':{'type':Sequelize[_0x6cb6('0x2')]},'scriptName':{'type':Sequelize[_0x6cb6('0x2')]},'scriptPath':{'type':Sequelize[_0x6cb6('0x2')]}}; \ No newline at end of file +var _0xc6d2=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','script','TEXT'];(function(_0x56e6aa,_0x587144){var _0x34d4a0=function(_0x1ec4d9){while(--_0x1ec4d9){_0x56e6aa['push'](_0x56e6aa['shift']());}};_0x34d4a0(++_0x587144);}(_0xc6d2,0x17b));var _0x2c6d=function(_0x16aafc,_0x1058cd){_0x16aafc=_0x16aafc-0x0;var _0xc700d7=_0xc6d2[_0x16aafc];return _0xc700d7;};'use strict';var Sequelize=require(_0x2c6d('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c6d('0x1')]},'type':{'type':Sequelize[_0x2c6d('0x2')](_0x2c6d('0x3'),_0x2c6d('0x4'))},'description':{'type':Sequelize[_0x2c6d('0x5')]},'version':{'type':Sequelize[_0x2c6d('0x5')]},'path':{'type':Sequelize[_0x2c6d('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x2c6d('0x6')],'defaultValue':0x0,'comment':_0x2c6d('0x7')},'sidebar':{'type':Sequelize[_0x2c6d('0x2')]('adminOnly',_0x2c6d('0x8'),'always','never'),'defaultValue':_0x2c6d('0x9'),'comment':_0x2c6d('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x2c6d('0x1')]},'scriptPath':{'type':Sequelize[_0x2c6d('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 2a89ff7..0eb3f29 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 _0x95fb=['filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','download','find','path','join','root','format','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','server/files/plugins','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','info','upload','filename','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','lstatSync','isFile','Invalid\x20plugin\x20structure','isDirectory','Plugin\x20manifest\x20missing','undefined','Invalid\x20manifest:\x20type\x20missing','version','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','icon-apps','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','dirname','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','resolve','http://localhost:','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','type','key','model','query','keys'];(function(_0x344126,_0x263ee1){var _0x1236b3=function(_0x2b7fec){while(--_0x2b7fec){_0x344126['push'](_0x344126['shift']());}};_0x1236b3(++_0x263ee1);}(_0x95fb,0x10e));var _0xb95f=function(_0x1b196,_0x1dd81c){_0x1b196=_0x1b196-0x0;var _0x264ed0=_0x95fb[_0x1b196];return _0x264ed0;};'use strict';var pdf=require(_0xb95f('0x0'));var emlformat=require(_0xb95f('0x1'));var rimraf=require(_0xb95f('0x2'));var zipdir=require(_0xb95f('0x3'));var jsonpatch=require(_0xb95f('0x4'));var rp=require('request-promise');var moment=require(_0xb95f('0x5'));var BPromise=require(_0xb95f('0x6'));var Mustache=require('mustache');var util=require(_0xb95f('0x7'));var path=require('path');var sox=require(_0xb95f('0x8'));var csv=require(_0xb95f('0x9'));var ejs=require(_0xb95f('0xa'));var fs=require('fs');var _=require(_0xb95f('0xb'));var squel=require(_0xb95f('0xc'));var crypto=require(_0xb95f('0xd'));var jsforce=require(_0xb95f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb95f('0xf'));var Papa=require('papaparse');var extract=require(_0xb95f('0x10'));var rimraf=require(_0xb95f('0x2'));var archiver=require(_0xb95f('0x11'));var Redis=require(_0xb95f('0x12'));var authService=require(_0xb95f('0x13'));var qs=require(_0xb95f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb95f('0x15'));var logger=require(_0xb95f('0x16'))(_0xb95f('0x17'));var utils=require('../../config/utils');var config=require(_0xb95f('0x18'));var licenseUtil=require(_0xb95f('0x19'));var db=require(_0xb95f('0x1a'))['db'];config[_0xb95f('0x1b')]=_[_0xb95f('0x1c')](config[_0xb95f('0x1b')],{'host':_0xb95f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb95f('0x1b')]));require(_0xb95f('0x1e'))['register'](socket);function respondWithStatusCode(_0x21b4e2,_0x367400){_0x367400=_0x367400||0xcc;return function(_0x555943){if(_0x555943){return _0x21b4e2[_0xb95f('0x1f')](_0x367400);}return _0x21b4e2[_0xb95f('0x20')](_0x367400)[_0xb95f('0x21')]();};}function respondWithResult(_0x3fd0ae,_0x3d9c9c){_0x3d9c9c=_0x3d9c9c||0xc8;return function(_0x42ddb4){if(_0x42ddb4){return _0x3fd0ae['status'](_0x3d9c9c)[_0xb95f('0x22')](_0x42ddb4);}};}function respondWithFilteredResult(_0x3094d3,_0x3e15d6){return function(_0x2e7989){if(_0x2e7989){var _0x5ed149=_0x2e7989[_0xb95f('0x23')],_0x438012=_0x3e15d6[_0xb95f('0x24')],_0x2a9737=_0x3e15d6[_0xb95f('0x24')]+_0x3e15d6[_0xb95f('0x25')],_0x5944df;if(_0x2a9737>=_0x5ed149){_0x2a9737=_0x5ed149;_0x5944df=0xc8;}else{_0x5944df=0xce;}_0x3094d3[_0xb95f('0x20')](_0x5944df);return _0x3094d3['set'](_0xb95f('0x26'),_0x438012+'-'+_0x2a9737+'/'+_0x5ed149)[_0xb95f('0x22')](_0x2e7989);}return null;};}function patchUpdates(_0x195a0b){return function(_0x24a6af){try{jsonpatch[_0xb95f('0x27')](_0x24a6af,_0x195a0b,!![]);}catch(_0x2ebb3b){return BPromise[_0xb95f('0x28')](_0x2ebb3b);}return _0x24a6af['save']();};}function saveUpdates(_0x3122fc,_0x82c426){return function(_0x1e97be){if(_0x1e97be){return _0x1e97be[_0xb95f('0x29')](_0x3122fc)[_0xb95f('0x2a')](function(_0xdd42a8){return _0xdd42a8;});}return null;};}function removeEntity(_0x21d9e0,_0x4afd47){return function(_0x2274aa){if(_0x2274aa){return _0x2274aa[_0xb95f('0x2b')]()[_0xb95f('0x2a')](function(){var _0xfcfa10=_0x2274aa[_0xb95f('0x2c')]({'plain':!![]});var _0x43502=_0xb95f('0x2d');return db[_0xb95f('0x2e')][_0xb95f('0x2b')]({'where':{'type':_0x43502,'resourceId':_0xfcfa10['id']}})['then'](function(){return _0x2274aa;});})[_0xb95f('0x2a')](function(){_0x21d9e0[_0xb95f('0x20')](0xcc)[_0xb95f('0x21')]();});}};}function handleEntityNotFound(_0x517d13,_0x46c464){return function(_0x3d4678){if(!_0x3d4678){_0x517d13[_0xb95f('0x1f')](0x194);}return _0x3d4678;};}function handleError(_0x592707,_0xd8bf1a){_0xd8bf1a=_0xd8bf1a||0x1f4;return function(_0x51aed3){logger[_0xb95f('0x2f')](_0x51aed3[_0xb95f('0x30')]);if(_0x51aed3['name']){delete _0x51aed3[_0xb95f('0x31')];}_0x592707[_0xb95f('0x20')](_0xd8bf1a)[_0xb95f('0x32')](_0x51aed3);};}exports[_0xb95f('0x33')]=function(_0x1e680f,_0x1a8e39){var _0x1a31b0={},_0x4299a7={},_0x526be0={'count':0x0,'rows':[]};var _0x343198=_[_0xb95f('0x34')](db[_0xb95f('0x35')][_0xb95f('0x36')],function(_0x2876c9){return{'name':_0x2876c9['fieldName'],'type':_0x2876c9[_0xb95f('0x37')][_0xb95f('0x38')]};});_0x4299a7[_0xb95f('0x39')]=_[_0xb95f('0x34')](_0x343198,_0xb95f('0x31'));_0x4299a7[_0xb95f('0x3a')]=_[_0xb95f('0x3b')](_0x1e680f['query']);_0x4299a7[_0xb95f('0x3c')]=_[_0xb95f('0x3d')](_0x4299a7['model'],_0x4299a7['query']);_0x1a31b0[_0xb95f('0x3e')]=_[_0xb95f('0x3d')](_0x4299a7['model'],qs['fields'](_0x1e680f[_0xb95f('0x3a')]['fields']));_0x1a31b0[_0xb95f('0x3e')]=_0x1a31b0[_0xb95f('0x3e')][_0xb95f('0x3f')]?_0x1a31b0['attributes']:_0x4299a7[_0xb95f('0x39')];if(!_0x1e680f[_0xb95f('0x3a')][_0xb95f('0x40')](_0xb95f('0x41'))){_0x1a31b0[_0xb95f('0x25')]=qs['limit'](_0x1e680f['query'][_0xb95f('0x25')]);_0x1a31b0[_0xb95f('0x24')]=qs[_0xb95f('0x24')](_0x1e680f[_0xb95f('0x3a')][_0xb95f('0x24')]);}_0x1a31b0[_0xb95f('0x42')]=qs[_0xb95f('0x43')](_0x1e680f[_0xb95f('0x3a')][_0xb95f('0x43')]);_0x1a31b0[_0xb95f('0x44')]=qs[_0xb95f('0x3c')](_['pick'](_0x1e680f[_0xb95f('0x3a')],_0x4299a7['filters']),_0x343198);if(_0x1e680f['query']['filter']){_0x1a31b0[_0xb95f('0x44')]=_['merge'](_0x1a31b0['where'],{'$or':_[_0xb95f('0x34')](_0x343198,function(_0x5c646a){if(_0x5c646a['type']!==_0xb95f('0x45')){var _0x4084a2={};_0x4084a2[_0x5c646a[_0xb95f('0x31')]]={'$like':'%'+_0x1e680f[_0xb95f('0x3a')][_0xb95f('0x46')]+'%'};return _0x4084a2;}})});}_0x1a31b0=_[_0xb95f('0x47')]({},_0x1a31b0,_0x1e680f[_0xb95f('0x48')]);var _0x152321={'where':_0x1a31b0[_0xb95f('0x44')]};return db[_0xb95f('0x35')][_0xb95f('0x23')](_0x152321)['then'](function(_0x44fc41){_0x526be0[_0xb95f('0x23')]=_0x44fc41;if(_0x1e680f[_0xb95f('0x3a')][_0xb95f('0x49')]){_0x1a31b0[_0xb95f('0x4a')]=[{'all':!![]}];}return db[_0xb95f('0x35')][_0xb95f('0x4b')](_0x1a31b0);})[_0xb95f('0x2a')](function(_0xf4b948){_0x526be0[_0xb95f('0x4c')]=_0xf4b948;return _0x526be0;})[_0xb95f('0x2a')](respondWithFilteredResult(_0x1a8e39,_0x1a31b0))[_0xb95f('0x4d')](handleError(_0x1a8e39,null));};exports[_0xb95f('0x4e')]=function(_0xbf5420,_0x83a261){var _0x2bc7c6={'raw':!![],'where':{'id':_0xbf5420[_0xb95f('0x4f')]['id']}},_0x2e8f6d={};_0x2e8f6d['model']=_[_0xb95f('0x3b')](db['Plugin'][_0xb95f('0x36')]);_0x2e8f6d['query']=_[_0xb95f('0x3b')](_0xbf5420['query']);_0x2e8f6d[_0xb95f('0x3c')]=_[_0xb95f('0x3d')](_0x2e8f6d[_0xb95f('0x39')],_0x2e8f6d[_0xb95f('0x3a')]);_0x2bc7c6[_0xb95f('0x3e')]=_[_0xb95f('0x3d')](_0x2e8f6d[_0xb95f('0x39')],qs['fields'](_0xbf5420[_0xb95f('0x3a')][_0xb95f('0x50')]));_0x2bc7c6[_0xb95f('0x3e')]=_0x2bc7c6[_0xb95f('0x3e')][_0xb95f('0x3f')]?_0x2bc7c6[_0xb95f('0x3e')]:_0x2e8f6d[_0xb95f('0x39')];if(_0xbf5420['query']['includeAll']){_0x2bc7c6[_0xb95f('0x4a')]=[{'all':!![]}];}_0x2bc7c6=_[_0xb95f('0x47')]({},_0x2bc7c6,_0xbf5420['options']);return db[_0xb95f('0x35')]['find'](_0x2bc7c6)[_0xb95f('0x2a')](handleEntityNotFound(_0x83a261,null))[_0xb95f('0x2a')](respondWithResult(_0x83a261,null))[_0xb95f('0x4d')](handleError(_0x83a261,null));};exports[_0xb95f('0x51')]=function(_0x20128d,_0x3d7955,_0x524a59){return db[_0xb95f('0x35')][_0xb95f('0x52')]({'where':{'id':_0x20128d[_0xb95f('0x4f')]['id']},'attributes':[_0xb95f('0x31'),_0xb95f('0x53')],'raw':!![]})[_0xb95f('0x2a')](handleEntityNotFound(_0x3d7955,null))[_0xb95f('0x2a')](function(_0xaeb52f){if(_0xaeb52f){var _0x5db9f2=path[_0xb95f('0x54')](config[_0xb95f('0x55')],'server/files/plugins',util[_0xb95f('0x56')]('%s.zip',path[_0xb95f('0x57')](_0xaeb52f[_0xb95f('0x53')])));var _0x364adb=fs[_0xb95f('0x58')](_0x5db9f2);var _0x5c6671=archiver(_0xb95f('0x59'),{'zlib':{'level':0x9}});_0x5c6671['on'](_0xb95f('0x5a'),function(_0x40a185){if(_0x40a185[_0xb95f('0x5b')]===_0xb95f('0x5c')){logger[_0xb95f('0x2f')](_0x40a185);}else{throw new db[(_0xb95f('0x5d'))][(_0xb95f('0x5e'))](_0xb95f('0x5f'));}});_0x5c6671['on'](_0xb95f('0x2f'),function(_0x38b87b){throw new db[(_0xb95f('0x5d'))][(_0xb95f('0x5e'))](_0xb95f('0x5f'));});_0x5c6671['pipe'](_0x364adb);_0x5c6671['glob']('**/*',{'cwd':path[_0xb95f('0x54')](config['root'],_0xb95f('0x60'),path['dirname'](_0xaeb52f[_0xb95f('0x53')])),'ignore':[path[_0xb95f('0x54')](path[_0xb95f('0x57')](_0xaeb52f[_0xb95f('0x53')]),_0xb95f('0x61')),path[_0xb95f('0x54')](path[_0xb95f('0x57')](_0xaeb52f[_0xb95f('0x53')]),'attachments/**/*')],'nodir':!![]})[_0xb95f('0x62')]();_0x364adb['on'](_0xb95f('0x63'),function(){if(!fs[_0xb95f('0x64')](_0x5db9f2)){throw new db[(_0xb95f('0x5d'))]['Error'](_0xb95f('0x65'));}return _0x3d7955[_0xb95f('0x51')](_0x5db9f2,util[_0xb95f('0x56')](_0xb95f('0x66'),path[_0xb95f('0x57')](_0xaeb52f[_0xb95f('0x53')])),function(_0x294420){if(_0x294420){throw new db[(_0xb95f('0x5d'))][(_0xb95f('0x5e'))](_0xb95f('0x67'));}fs['unlinkSync'](_0x5db9f2);logger[_0xb95f('0x68')]('Download\x20completed');logger[_0xb95f('0x68')]('Temporary\x20file\x20removed');});});}return null;})[_0xb95f('0x4d')](handleError(_0x3d7955,null));};exports[_0xb95f('0x69')]=function(_0x461039,_0x55ce88,_0x2d2df3){var _0x1d5a74=path[_0xb95f('0x57')](_0x461039['file'][_0xb95f('0x6a')],path['extname'](_0x461039[_0xb95f('0x6b')][_0xb95f('0x6a')]));var _0x4162fe=path[_0xb95f('0x54')](config[_0xb95f('0x55')],_0xb95f('0x60'),_0x461039[_0xb95f('0x6b')][_0xb95f('0x6a')]);var _0x5f3a15=path[_0xb95f('0x54')](config[_0xb95f('0x55')],_0xb95f('0x60'),_0x1d5a74);logger[_0xb95f('0x68')](_0xb95f('0x6c'),_0x4162fe);logger[_0xb95f('0x68')](_0xb95f('0x6d'),_0x5f3a15);try{fs['chmodSync'](_0x4162fe,parseInt(_0xb95f('0x6e'),0x8));extract(_0x4162fe,{'dir':_0x5f3a15},function(_0x49d344){if(_0x49d344){logger['error'](_0x49d344);handleError(_0x49d344,!![]);};var _0x5a0b1a=fs[_0xb95f('0x6f')](_0x5f3a15);if(_0x5a0b1a[_0xb95f('0x3f')]>0x1){removeReferences(_0x4162fe,_0x5f3a15);logger['error']('Invalid\x20plugin\x20structure');return _0x2d2df3(new Error('Invalid\x20plugin\x20structure'));}var _0x55ab69=fs[_0xb95f('0x70')](path[_0xb95f('0x54')](_0x5f3a15,_0x5a0b1a[0x0]));if(_0x55ab69[_0xb95f('0x71')]()){removeReferences(_0x4162fe,_0x5f3a15);logger[_0xb95f('0x2f')](_0xb95f('0x72'));return _0x2d2df3(new Error('Invalid\x20plugin\x20structure'));}if(_0x55ab69[_0xb95f('0x73')]()){var _0x8039a=fs[_0xb95f('0x6f')](path[_0xb95f('0x54')](_0x5f3a15,_0x5a0b1a[0x0]));if(_0x8039a[_0xb95f('0x3f')]===0x0){removeReferences(_0x4162fe,_0x5f3a15);logger[_0xb95f('0x2f')](_0xb95f('0x72'));return _0x2d2df3(new Error('Invalid\x20plugin\x20structure'));}var _0x4d832f=_0x8039a['some'](function(_0x561011){return _0x561011==='manifest.json';});if(!_0x4d832f){return _0x2d2df3(new Error(_0xb95f('0x74')));}var _0x1a0bc2=fs['readFileSync'](path['join'](_0x5f3a15,_0x5a0b1a[0x0],'manifest.json'));var _0x2f867f=JSON['parse'](_0x1a0bc2);if(_0xb95f('0x75')==typeof _0x2f867f[_0xb95f('0x31')]){return _0x2d2df3(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xb95f('0x75')==typeof _0x2f867f['type']){return _0x2d2df3(new Error(_0xb95f('0x76')));}if(_0xb95f('0x75')==typeof _0x2f867f[_0xb95f('0x77')]){return _0x2d2df3(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xb95f('0x75')==typeof _0x2f867f[_0xb95f('0x78')]){return _0x2d2df3(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x2f867f[_0xb95f('0x37')]==='html'){if(_0xb95f('0x75')==typeof _0x2f867f[_0xb95f('0x78')][_0xb95f('0x79')]){return _0x2d2df3(new Error(_0xb95f('0x7a')));}if(_0xb95f('0x75')==typeof _0x2f867f[_0xb95f('0x78')][_0xb95f('0x79')][_0xb95f('0x7b')]&&'undefined'==typeof _0x2f867f[_0xb95f('0x78')][_0xb95f('0x79')][_0xb95f('0x7c')]){return _0x2d2df3(new Error(_0xb95f('0x7d')));}}else if(_0x2f867f[_0xb95f('0x37')]==='script'){if(_0xb95f('0x75')==typeof _0x2f867f[_0xb95f('0x78')][_0xb95f('0x7e')]){return _0x2d2df3(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xb95f('0x75')==typeof _0x2f867f[_0xb95f('0x78')][_0xb95f('0x7f')]){return _0x2d2df3(new Error(_0xb95f('0x80')));}}else{return _0x2d2df3(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5350ba=_0x2f867f[_0xb95f('0x31')];var _0x13fdb1=_0x2f867f[_0xb95f('0x81')];var _0x453035=_0x2f867f[_0xb95f('0x37')];var _0x2821c5=_0x2f867f[_0xb95f('0x82')]?_0x2f867f[_0xb95f('0x82')]:'always';var _0x3ee903=_0x2f867f[_0xb95f('0x83')]?_0x2f867f[_0xb95f('0x83')]:_0xb95f('0x84');var _0x3f914e='';var _0x38100a='';var _0x56c6f7='';var _0x9cea1a='';var _0x277981=_0x2f867f[_0xb95f('0x77')];if(_0x453035===_0xb95f('0x85')){if('undefined'!=typeof _0x2f867f['parameters'][_0xb95f('0x79')]['admin']){var _0x47db6f=_0x2f867f[_0xb95f('0x78')][_0xb95f('0x79')][_0xb95f('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xb95f('0x86')](_0x47db6f)){_0x3f914e=path[_0xb95f('0x54')](_0xb95f('0x87'),_0x1d5a74,_0x5a0b1a[0x0],_0x47db6f);}else{_0x3f914e=_0x47db6f;}}else{logger[_0xb95f('0x68')](_0xb95f('0x88'));}if(_0xb95f('0x75')!=typeof _0x2f867f['parameters'][_0xb95f('0x79')][_0xb95f('0x7c')]){var _0x339b7a=_0x2f867f[_0xb95f('0x78')][_0xb95f('0x79')][_0xb95f('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0xb95f('0x86')](_0x339b7a)){_0x38100a=path[_0xb95f('0x54')](_0xb95f('0x87'),_0x1d5a74,_0x5a0b1a[0x0],_0x339b7a);}else{_0x38100a=_0x339b7a;}}else{logger[_0xb95f('0x68')](_0xb95f('0x89'));}}else if(_0x453035===_0xb95f('0x8a')){_0x56c6f7=_0x2f867f[_0xb95f('0x78')][_0xb95f('0x7e')];_0x9cea1a=_0x2f867f['parameters'][_0xb95f('0x7f')];if('undefined'!=typeof _0x2f867f[_0xb95f('0x78')]['views']){if(_0xb95f('0x75')!=typeof _0x2f867f[_0xb95f('0x78')][_0xb95f('0x79')][_0xb95f('0x7b')]){var _0x47db6f=_0x2f867f[_0xb95f('0x78')]['views'][_0xb95f('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0xb95f('0x86')](_0x47db6f)){_0x3f914e=path[_0xb95f('0x54')]('plugins',_0x1d5a74,_0x5a0b1a[0x0],_0x47db6f);}else{_0x3f914e=_0x47db6f;}}if(_0xb95f('0x75')!=typeof _0x2f867f['parameters'][_0xb95f('0x79')][_0xb95f('0x7c')]){var _0x339b7a=_0x2f867f[_0xb95f('0x78')][_0xb95f('0x79')][_0xb95f('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x339b7a)){_0x38100a=path[_0xb95f('0x54')](_0xb95f('0x87'),_0x1d5a74,_0x5a0b1a[0x0],_0x339b7a);}else{_0x38100a=_0x339b7a;}}}}var _0x1110c3={'name':_0x5350ba,'description':_0x13fdb1,'path':path[_0xb95f('0x54')](_0x1d5a74,_0x5a0b1a[0x0]),'type':_0x453035,'sidebar':_0x2821c5,'icon':_0x3ee903,'adminUrl':_0x3f914e,'agentUrl':_0x38100a,'scriptName':_0x56c6f7,'scriptPath':_0x9cea1a,'version':_0x277981};removeReferences(_0x4162fe,null);return db['Plugin'][_0xb95f('0x8b')](_0x1110c3)['then'](function(_0x2eeaf0){var _0x171c14={'role':_0x461039[_0xb95f('0x8c')][_0xb95f('0x8d')],'userProfileId':_0x461039[_0xb95f('0x8c')][_0xb95f('0x8e')]};if(!_0x171c14)throw new Error(_0xb95f('0x8f'));if(_0x171c14[_0xb95f('0x8d')]==='user'){var _0x5eac06=_0x2eeaf0['get']({'plain':!![]});return db[_0xb95f('0x90')][_0xb95f('0x52')]({'where':{'name':'Plugins','userProfileId':_0x171c14['userProfileId']},'raw':!![]})[_0xb95f('0x2a')](function(_0x5f260f){if(_0x5f260f&&_0x5f260f[_0xb95f('0x91')]===0x0){return db[_0xb95f('0x2e')][_0xb95f('0x8b')]({'name':_0x5eac06[_0xb95f('0x31')],'resourceId':_0x5eac06['id'],'type':_0x5f260f['name'],'sectionId':_0x5f260f['id']},{})['then'](function(){return _0x2eeaf0;});}else{return _0x2eeaf0;}})[_0xb95f('0x4d')](function(_0x446fd2){logger[_0xb95f('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446fd2);throw _0x446fd2;});}return _0x2eeaf0;})[_0xb95f('0x2a')](respondWithResult(_0x55ce88,null))[_0xb95f('0x4d')](handleError(_0x55ce88,null));}});}catch(_0x38d62e){_0x55ce88[_0xb95f('0x20')](0x1f4)[_0xb95f('0x32')](_0x38d62e);}};function removeReferences(_0x550cb3,_0x19b824){try{if(_0x550cb3){fs['unlinkSync'](_0x550cb3);logger[_0xb95f('0x68')](_0xb95f('0x92'));}if(_0x19b824){rimraf(_0x19b824,function(){});logger[_0xb95f('0x68')](_0xb95f('0x93'));}}catch(_0x62de1f){logger['error'](_0x62de1f);}}exports['update']=function(_0x140b03,_0x2996b2,_0x36fcae){return db[_0xb95f('0x35')][_0xb95f('0x52')]({'where':{'id':_0x140b03[_0xb95f('0x4f')]['id']}})[_0xb95f('0x2a')](handleEntityNotFound(_0x2996b2,null))[_0xb95f('0x2a')](saveUpdates(_0x140b03[_0xb95f('0x8c')],null))[_0xb95f('0x2a')](respondWithResult(_0x2996b2,null))[_0xb95f('0x4d')](handleError(_0x2996b2,null));};exports['delete']=function(_0x34368b,_0x1c0d5b,_0x6f631d){return db[_0xb95f('0x35')][_0xb95f('0x52')]({'where':{'id':_0x34368b[_0xb95f('0x4f')]['id']}})[_0xb95f('0x2a')](function(_0x28b0bd){if(_0x28b0bd){return _0x28b0bd['destroy']();}})['then'](function(_0x2997d5){rimraf(path[_0xb95f('0x54')](config[_0xb95f('0x55')],'server/files/plugins',path[_0xb95f('0x94')](_0x2997d5[_0xb95f('0x53')])),function(){});return _0x2997d5;})['then'](handleEntityNotFound(_0x1c0d5b,null))['then'](respondWithStatusCode(_0x1c0d5b,null))[_0xb95f('0x4d')](handleError(_0x1c0d5b,null));};exports['webhookGet']=function(_0x4a1dcc,_0x253288,_0x4f87fc){return BPromise['resolve']()[_0xb95f('0x2a')](function(){if(!_0x4a1dcc[_0xb95f('0x3a')][_0xb95f('0x53')]){throw new Error(_0xb95f('0x95'));}if(!_0x4a1dcc['query'][_0xb95f('0x96')]){throw new Error(_0xb95f('0x97'));}var _0x5494ec=_0x4a1dcc[_0xb95f('0x3a')][_0xb95f('0x98')]?_0x4a1dcc[_0xb95f('0x3a')]['hostname']+':'+_0x4a1dcc[_0xb95f('0x3a')]['port']:'http://localhost:'+_0x4a1dcc[_0xb95f('0x3a')]['port'];var _0x28896f=_0x4a1dcc[_0xb95f('0x3a')][_0xb95f('0x22')]?_0x4a1dcc['query'][_0xb95f('0x22')]:!![];var _0x24d12d=_0x4a1dcc['query'][_0xb95f('0x99')]?_0x4a1dcc['query'][_0xb95f('0x99')]:null;var _0x50afc3={'method':_0x4a1dcc[_0xb95f('0x9a')],'uri':util[_0xb95f('0x56')](_0xb95f('0x9b'),_0x5494ec,_0x4a1dcc[_0xb95f('0x3a')]['path']),'json':_0x28896f,'resolveWithFullResponse':!![],'encoding':_0x24d12d,'qs':_0x4a1dcc[_0xb95f('0x3a')]};if(_0x4a1dcc['headers']){_0x50afc3['headers']=_0x4a1dcc['headers'];if(_0x50afc3[_0xb95f('0x9c')][_0xb95f('0x9d')]){delete _0x50afc3[_0xb95f('0x9c')][_0xb95f('0x9d')];}}if(_0x50afc3['headers']['content-type']){delete _0x50afc3[_0xb95f('0x9c')][_0xb95f('0x9e')];}return rp(_0x50afc3);})[_0xb95f('0x2a')](function(_0x450d81){if(_0x450d81){_0x253288[_0xb95f('0x9f')](_0x450d81[_0xb95f('0x9c')]);logger[_0xb95f('0x68')](_0x450d81['body']);if(_[_0xb95f('0xa0')](_0x4a1dcc[_0xb95f('0x3a')]['path'],_0xb95f('0x51'))&&_0x450d81['statusCode']==0x1f4){return _0x253288[_0xb95f('0x1f')](_0x450d81['statusCode']);}else{return _0x253288[_0xb95f('0x20')](_0x450d81[_0xb95f('0xa1')])[_0xb95f('0x32')](_0x450d81[_0xb95f('0x8c')]);}}else{return _0x253288[_0xb95f('0x1f')](0xc8);}})[_0xb95f('0x4d')](handleError(_0x253288,null));};exports[_0xb95f('0xa2')]=function(_0x53c926,_0x5ced7e,_0x10be5c){return BPromise[_0xb95f('0xa3')]()[_0xb95f('0x2a')](function(){if(!_0x53c926['query'][_0xb95f('0x53')]){throw new Error(_0xb95f('0x95'));}if(!_0x53c926[_0xb95f('0x3a')][_0xb95f('0x96')]){throw new Error(_0xb95f('0x97'));}var _0x3a933e=_0x53c926['query'][_0xb95f('0x98')]?_0x53c926[_0xb95f('0x3a')][_0xb95f('0x98')]+':'+_0x53c926[_0xb95f('0x3a')][_0xb95f('0x96')]:_0xb95f('0xa4')+_0x53c926['query']['port'];var _0x13f59b=_0x53c926[_0xb95f('0x3a')][_0xb95f('0x22')]?_0x53c926[_0xb95f('0x3a')][_0xb95f('0x22')]:!![];var _0xd26b7e=_0x53c926[_0xb95f('0x3a')][_0xb95f('0x99')]?_0x53c926[_0xb95f('0x3a')][_0xb95f('0x99')]:null;var _0x485a9a={'method':_0x53c926['method'],'uri':util['format'](_0xb95f('0x9b'),_0x3a933e,_0x53c926[_0xb95f('0x3a')]['path']),'json':_0x13f59b,'resolveWithFullResponse':!![],'encoding':_0xd26b7e,'body':_0x53c926[_0xb95f('0x8c')]};if(_0x53c926[_0xb95f('0x9c')]){_0x485a9a[_0xb95f('0x9c')]=_0x53c926['headers'];if(_0x485a9a[_0xb95f('0x9c')][_0xb95f('0x9d')]){delete _0x485a9a[_0xb95f('0x9c')][_0xb95f('0x9d')];}}if(_0x485a9a[_0xb95f('0x9c')][_0xb95f('0x9e')]){delete _0x485a9a[_0xb95f('0x9c')][_0xb95f('0x9e')];}return rp(_0x485a9a);})[_0xb95f('0x2a')](function(_0x4b0e40){if(_0x4b0e40){_0x5ced7e[_0xb95f('0x9f')](_0x4b0e40['headers']);logger['info'](_0x4b0e40[_0xb95f('0x8c')]);return _0x5ced7e[_0xb95f('0x20')](_0x4b0e40[_0xb95f('0xa1')])[_0xb95f('0x32')](_0x4b0e40['body']);}else{return _0x5ced7e['sendStatus'](0xc8);}})[_0xb95f('0x4d')](handleError(_0x5ced7e,null));}; \ No newline at end of file +var _0xee94=['to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','Plugin','includeAll','findAll','catch','show','params','find','download','join','root','server/files/plugins','basename','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','format','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','method','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x3889ae,_0x4770c3){var _0x6533dd=function(_0x4275f7){while(--_0x4275f7){_0x3889ae['push'](_0x3889ae['shift']());}};_0x6533dd(++_0x4770c3);}(_0xee94,0x148));var _0x4ee9=function(_0x3165ce,_0x5df1b9){_0x3165ce=_0x3165ce-0x0;var _0x1464aa=_0xee94[_0x3165ce];return _0x1464aa;};'use strict';var pdf=require(_0x4ee9('0x0'));var emlformat=require(_0x4ee9('0x1'));var rimraf=require(_0x4ee9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ee9('0x3'));var rp=require('request-promise');var moment=require(_0x4ee9('0x4'));var BPromise=require(_0x4ee9('0x5'));var Mustache=require(_0x4ee9('0x6'));var util=require(_0x4ee9('0x7'));var path=require(_0x4ee9('0x8'));var sox=require(_0x4ee9('0x9'));var csv=require(_0x4ee9('0xa'));var ejs=require(_0x4ee9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4ee9('0xc'));var crypto=require(_0x4ee9('0xd'));var jsforce=require(_0x4ee9('0xe'));var deskjs=require(_0x4ee9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4ee9('0x10'));var Papa=require(_0x4ee9('0x11'));var extract=require(_0x4ee9('0x12'));var rimraf=require('rimraf');var archiver=require(_0x4ee9('0x13'));var Redis=require('ioredis');var authService=require(_0x4ee9('0x14'));var qs=require(_0x4ee9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ee9('0x16'));var logger=require('../../config/logger')(_0x4ee9('0x17'));var utils=require(_0x4ee9('0x18'));var config=require(_0x4ee9('0x19'));var licenseUtil=require(_0x4ee9('0x1a'));var db=require(_0x4ee9('0x1b'))['db'];config['redis']=_[_0x4ee9('0x1c')](config[_0x4ee9('0x1d')],{'host':_0x4ee9('0x1e'),'port':0x18eb});var socket=require(_0x4ee9('0x1f'))(new Redis(config[_0x4ee9('0x1d')]));require('./plugin.socket')[_0x4ee9('0x20')](socket);function respondWithStatusCode(_0x50afa4,_0x3b9b50){_0x3b9b50=_0x3b9b50||0xcc;return function(_0x14a405){if(_0x14a405){return _0x50afa4[_0x4ee9('0x21')](_0x3b9b50);}return _0x50afa4['status'](_0x3b9b50)['end']();};}function respondWithResult(_0x393257,_0x1d2045){_0x1d2045=_0x1d2045||0xc8;return function(_0x233824){if(_0x233824){return _0x393257[_0x4ee9('0x22')](_0x1d2045)[_0x4ee9('0x23')](_0x233824);}};}function respondWithFilteredResult(_0x3a1161,_0x52d198){return function(_0x47203a){if(_0x47203a){var _0xf3d855=_0x47203a[_0x4ee9('0x24')],_0x151a8a=_0x52d198[_0x4ee9('0x25')],_0x553067=_0x52d198[_0x4ee9('0x25')]+_0x52d198['limit'],_0x110dd2;if(_0x553067>=_0xf3d855){_0x553067=_0xf3d855;_0x110dd2=0xc8;}else{_0x110dd2=0xce;}_0x3a1161['status'](_0x110dd2);return _0x3a1161[_0x4ee9('0x26')]('Content-Range',_0x151a8a+'-'+_0x553067+'/'+_0xf3d855)[_0x4ee9('0x23')](_0x47203a);}return null;};}function patchUpdates(_0x2e4f87){return function(_0x2b02ae){try{jsonpatch[_0x4ee9('0x27')](_0x2b02ae,_0x2e4f87,!![]);}catch(_0xd81384){return BPromise[_0x4ee9('0x28')](_0xd81384);}return _0x2b02ae[_0x4ee9('0x29')]();};}function saveUpdates(_0x1305b5,_0x415390){return function(_0x40a1c4){if(_0x40a1c4){return _0x40a1c4[_0x4ee9('0x2a')](_0x1305b5)[_0x4ee9('0x2b')](function(_0x4b077e){return _0x4b077e;});}return null;};}function removeEntity(_0x564acc,_0x1f57a9){return function(_0x326daf){if(_0x326daf){return _0x326daf[_0x4ee9('0x2c')]()['then'](function(){var _0x1b8442=_0x326daf[_0x4ee9('0x2d')]({'plain':!![]});var _0x36f80a=_0x4ee9('0x2e');return db[_0x4ee9('0x2f')]['destroy']({'where':{'type':_0x36f80a,'resourceId':_0x1b8442['id']}})[_0x4ee9('0x2b')](function(){return _0x326daf;});})[_0x4ee9('0x2b')](function(){_0x564acc[_0x4ee9('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a7f9d,_0x1f02ba){return function(_0x452d54){if(!_0x452d54){_0x1a7f9d['sendStatus'](0x194);}return _0x452d54;};}function handleError(_0x562ef5,_0x2901d9){_0x2901d9=_0x2901d9||0x1f4;return function(_0x48c5dc){logger[_0x4ee9('0x30')](_0x48c5dc['stack']);if(_0x48c5dc[_0x4ee9('0x31')]){delete _0x48c5dc[_0x4ee9('0x31')];}_0x562ef5[_0x4ee9('0x22')](_0x2901d9)[_0x4ee9('0x32')](_0x48c5dc);};}exports[_0x4ee9('0x33')]=function(_0xb56c0f,_0x584693){var _0x5c6f54={},_0x409443={},_0x4288e1={'count':0x0,'rows':[]};var _0x453190=_[_0x4ee9('0x34')](db['Plugin'][_0x4ee9('0x35')],function(_0x4194d2){return{'name':_0x4194d2[_0x4ee9('0x36')],'type':_0x4194d2[_0x4ee9('0x37')][_0x4ee9('0x38')]};});_0x409443[_0x4ee9('0x39')]=_[_0x4ee9('0x34')](_0x453190,_0x4ee9('0x31'));_0x409443['query']=_[_0x4ee9('0x3a')](_0xb56c0f['query']);_0x409443[_0x4ee9('0x3b')]=_['intersection'](_0x409443[_0x4ee9('0x39')],_0x409443['query']);_0x5c6f54['attributes']=_[_0x4ee9('0x3c')](_0x409443[_0x4ee9('0x39')],qs['fields'](_0xb56c0f[_0x4ee9('0x3d')][_0x4ee9('0x3e')]));_0x5c6f54['attributes']=_0x5c6f54[_0x4ee9('0x3f')][_0x4ee9('0x40')]?_0x5c6f54[_0x4ee9('0x3f')]:_0x409443[_0x4ee9('0x39')];if(!_0xb56c0f[_0x4ee9('0x3d')]['hasOwnProperty'](_0x4ee9('0x41'))){_0x5c6f54[_0x4ee9('0x42')]=qs[_0x4ee9('0x42')](_0xb56c0f[_0x4ee9('0x3d')]['limit']);_0x5c6f54['offset']=qs['offset'](_0xb56c0f[_0x4ee9('0x3d')][_0x4ee9('0x25')]);}_0x5c6f54[_0x4ee9('0x43')]=qs['sort'](_0xb56c0f['query'][_0x4ee9('0x44')]);_0x5c6f54[_0x4ee9('0x45')]=qs[_0x4ee9('0x3b')](_[_0x4ee9('0x46')](_0xb56c0f['query'],_0x409443[_0x4ee9('0x3b')]),_0x453190);if(_0xb56c0f[_0x4ee9('0x3d')][_0x4ee9('0x47')]){_0x5c6f54[_0x4ee9('0x45')]=_[_0x4ee9('0x48')](_0x5c6f54[_0x4ee9('0x45')],{'$or':_[_0x4ee9('0x34')](_0x453190,function(_0x164122){if(_0x164122['type']!=='VIRTUAL'){var _0x9dcde4={};_0x9dcde4[_0x164122[_0x4ee9('0x31')]]={'$like':'%'+_0xb56c0f[_0x4ee9('0x3d')][_0x4ee9('0x47')]+'%'};return _0x9dcde4;}})});}_0x5c6f54=_[_0x4ee9('0x48')]({},_0x5c6f54,_0xb56c0f['options']);var _0x2a3411={'where':_0x5c6f54[_0x4ee9('0x45')]};return db[_0x4ee9('0x49')]['count'](_0x2a3411)[_0x4ee9('0x2b')](function(_0x1de192){_0x4288e1['count']=_0x1de192;if(_0xb56c0f[_0x4ee9('0x3d')][_0x4ee9('0x4a')]){_0x5c6f54['include']=[{'all':!![]}];}return db['Plugin'][_0x4ee9('0x4b')](_0x5c6f54);})[_0x4ee9('0x2b')](function(_0xf3dec7){_0x4288e1['rows']=_0xf3dec7;return _0x4288e1;})[_0x4ee9('0x2b')](respondWithFilteredResult(_0x584693,_0x5c6f54))[_0x4ee9('0x4c')](handleError(_0x584693,null));};exports[_0x4ee9('0x4d')]=function(_0x3fbc8f,_0x1c57f9){var _0x32be8e={'raw':!![],'where':{'id':_0x3fbc8f[_0x4ee9('0x4e')]['id']}},_0x3075d3={};_0x3075d3['model']=_['keys'](db[_0x4ee9('0x49')][_0x4ee9('0x35')]);_0x3075d3['query']=_[_0x4ee9('0x3a')](_0x3fbc8f[_0x4ee9('0x3d')]);_0x3075d3[_0x4ee9('0x3b')]=_[_0x4ee9('0x3c')](_0x3075d3['model'],_0x3075d3[_0x4ee9('0x3d')]);_0x32be8e[_0x4ee9('0x3f')]=_[_0x4ee9('0x3c')](_0x3075d3[_0x4ee9('0x39')],qs['fields'](_0x3fbc8f[_0x4ee9('0x3d')][_0x4ee9('0x3e')]));_0x32be8e['attributes']=_0x32be8e[_0x4ee9('0x3f')]['length']?_0x32be8e['attributes']:_0x3075d3[_0x4ee9('0x39')];if(_0x3fbc8f[_0x4ee9('0x3d')][_0x4ee9('0x4a')]){_0x32be8e['include']=[{'all':!![]}];}_0x32be8e=_['merge']({},_0x32be8e,_0x3fbc8f['options']);return db[_0x4ee9('0x49')][_0x4ee9('0x4f')](_0x32be8e)[_0x4ee9('0x2b')](handleEntityNotFound(_0x1c57f9,null))['then'](respondWithResult(_0x1c57f9,null))[_0x4ee9('0x4c')](handleError(_0x1c57f9,null));};exports[_0x4ee9('0x50')]=function(_0x31d7fb,_0x430cf1,_0x1b704a){return db[_0x4ee9('0x49')][_0x4ee9('0x4f')]({'where':{'id':_0x31d7fb[_0x4ee9('0x4e')]['id']},'attributes':[_0x4ee9('0x31'),_0x4ee9('0x8')],'raw':!![]})['then'](handleEntityNotFound(_0x430cf1,null))[_0x4ee9('0x2b')](function(_0x413105){if(_0x413105){var _0xcd3e23=path[_0x4ee9('0x51')](config[_0x4ee9('0x52')],_0x4ee9('0x53'),util['format']('%s.zip',path[_0x4ee9('0x54')](_0x413105[_0x4ee9('0x8')])));var _0x487c82=fs[_0x4ee9('0x55')](_0xcd3e23);var _0x3af096=archiver(_0x4ee9('0x56'),{'zlib':{'level':0x9}});_0x3af096['on'](_0x4ee9('0x57'),function(_0x5647e0){if(_0x5647e0[_0x4ee9('0x58')]==='ENOENT'){logger[_0x4ee9('0x30')](_0x5647e0);}else{throw new db[(_0x4ee9('0x59'))][(_0x4ee9('0x5a'))](_0x4ee9('0x5b'));}});_0x3af096['on'](_0x4ee9('0x30'),function(_0x111cfc){throw new db[(_0x4ee9('0x59'))]['Error'](_0x4ee9('0x5b'));});_0x3af096[_0x4ee9('0x5c')](_0x487c82);_0x3af096[_0x4ee9('0x5d')]('**/*',{'cwd':path[_0x4ee9('0x51')](config[_0x4ee9('0x52')],_0x4ee9('0x53'),path[_0x4ee9('0x5e')](_0x413105['path'])),'ignore':[path['join'](path[_0x4ee9('0x54')](_0x413105[_0x4ee9('0x8')]),_0x4ee9('0x5f')),path[_0x4ee9('0x51')](path[_0x4ee9('0x54')](_0x413105['path']),_0x4ee9('0x60'))],'nodir':!![]})[_0x4ee9('0x61')]();_0x487c82['on'](_0x4ee9('0x62'),function(){if(!fs[_0x4ee9('0x63')](_0xcd3e23)){throw new db[(_0x4ee9('0x59'))][(_0x4ee9('0x5a'))]('Plugin\x20not\x20found');}return _0x430cf1['download'](_0xcd3e23,util[_0x4ee9('0x64')](_0x4ee9('0x65'),path[_0x4ee9('0x54')](_0x413105[_0x4ee9('0x8')])),function(_0x222086){if(_0x222086){throw new db[(_0x4ee9('0x59'))]['Error'](_0x4ee9('0x66'));}fs[_0x4ee9('0x67')](_0xcd3e23);logger[_0x4ee9('0x68')]('Download\x20completed');logger[_0x4ee9('0x68')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x430cf1,null));};exports['upload']=function(_0x52869b,_0x21b9f6,_0x240010){var _0x5c6457=path[_0x4ee9('0x54')](_0x52869b[_0x4ee9('0x69')][_0x4ee9('0x6a')],path[_0x4ee9('0x6b')](_0x52869b[_0x4ee9('0x69')][_0x4ee9('0x6a')]));var _0x92c0b2=path[_0x4ee9('0x51')](config['root'],_0x4ee9('0x53'),_0x52869b['file'][_0x4ee9('0x6a')]);var _0x5e96b9=path['join'](config['root'],'server/files/plugins',_0x5c6457);logger[_0x4ee9('0x68')](_0x4ee9('0x6c'),_0x92c0b2);logger[_0x4ee9('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x5e96b9);try{fs[_0x4ee9('0x6d')](_0x92c0b2,parseInt(_0x4ee9('0x6e'),0x8));extract(_0x92c0b2,{'dir':_0x5e96b9},function(_0x2a749d){if(_0x2a749d){logger[_0x4ee9('0x30')](_0x2a749d);handleError(_0x2a749d,!![]);};var _0x108648=fs['readdirSync'](_0x5e96b9);if(_0x108648[_0x4ee9('0x40')]>0x1){removeReferences(_0x92c0b2,_0x5e96b9);logger[_0x4ee9('0x30')]('Invalid\x20plugin\x20structure');return _0x240010(new Error(_0x4ee9('0x6f')));}var _0x4da179=fs[_0x4ee9('0x70')](path['join'](_0x5e96b9,_0x108648[0x0]));if(_0x4da179[_0x4ee9('0x71')]()){removeReferences(_0x92c0b2,_0x5e96b9);logger[_0x4ee9('0x30')](_0x4ee9('0x6f'));return _0x240010(new Error(_0x4ee9('0x6f')));}if(_0x4da179[_0x4ee9('0x72')]()){var _0x1fa133=fs[_0x4ee9('0x73')](path['join'](_0x5e96b9,_0x108648[0x0]));if(_0x1fa133['length']===0x0){removeReferences(_0x92c0b2,_0x5e96b9);logger[_0x4ee9('0x30')](_0x4ee9('0x6f'));return _0x240010(new Error(_0x4ee9('0x6f')));}var _0x474ce5=_0x1fa133[_0x4ee9('0x74')](function(_0x20faef){return _0x20faef===_0x4ee9('0x75');});if(!_0x474ce5){return _0x240010(new Error(_0x4ee9('0x76')));}var _0x109970=fs[_0x4ee9('0x77')](path[_0x4ee9('0x51')](_0x5e96b9,_0x108648[0x0],_0x4ee9('0x75')));var _0x32e460=JSON[_0x4ee9('0x78')](_0x109970);if(_0x4ee9('0x79')==typeof _0x32e460[_0x4ee9('0x31')]){return _0x240010(new Error(_0x4ee9('0x7a')));}if(_0x4ee9('0x79')==typeof _0x32e460['type']){return _0x240010(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x4ee9('0x79')==typeof _0x32e460[_0x4ee9('0x7b')]){return _0x240010(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x4ee9('0x79')==typeof _0x32e460[_0x4ee9('0x7c')]){return _0x240010(new Error(_0x4ee9('0x7d')));}if(_0x32e460['type']===_0x4ee9('0x7e')){if(_0x4ee9('0x79')==typeof _0x32e460['parameters'][_0x4ee9('0x7f')]){return _0x240010(new Error(_0x4ee9('0x80')));}if('undefined'==typeof _0x32e460['parameters'][_0x4ee9('0x7f')][_0x4ee9('0x81')]&&_0x4ee9('0x79')==typeof _0x32e460[_0x4ee9('0x7c')]['views'][_0x4ee9('0x82')]){return _0x240010(new Error(_0x4ee9('0x83')));}}else if(_0x32e460[_0x4ee9('0x37')]===_0x4ee9('0x84')){if(_0x4ee9('0x79')==typeof _0x32e460['parameters']['scriptName']){return _0x240010(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x4ee9('0x79')==typeof _0x32e460[_0x4ee9('0x7c')]['scriptPath']){return _0x240010(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x240010(new Error(_0x4ee9('0x85')));}var _0x4640e4=_0x32e460[_0x4ee9('0x31')];var _0x3cb5fd=_0x32e460[_0x4ee9('0x86')];var _0x3ac5e3=_0x32e460[_0x4ee9('0x37')];var _0x31724e=_0x32e460[_0x4ee9('0x87')]?_0x32e460[_0x4ee9('0x87')]:_0x4ee9('0x88');var _0x320789=_0x32e460[_0x4ee9('0x89')]?_0x32e460[_0x4ee9('0x89')]:_0x4ee9('0x8a');var _0x3b335f='';var _0x5b66ba='';var _0xe8d822='';var _0x58085d='';var _0x5ea816=_0x32e460[_0x4ee9('0x7b')];if(_0x3ac5e3===_0x4ee9('0x7e')){if(_0x4ee9('0x79')!=typeof _0x32e460[_0x4ee9('0x7c')][_0x4ee9('0x7f')]['admin']){var _0x3a0fe7=_0x32e460['parameters'][_0x4ee9('0x7f')][_0x4ee9('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4ee9('0x8b')](_0x3a0fe7)){_0x3b335f=path['join'](_0x4ee9('0x8c'),_0x5c6457,_0x108648[0x0],_0x3a0fe7);}else{_0x3b335f=_0x3a0fe7;}}else{logger[_0x4ee9('0x68')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x32e460['parameters'][_0x4ee9('0x7f')][_0x4ee9('0x82')]){var _0x456ca4=_0x32e460[_0x4ee9('0x7c')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x4ee9('0x8b')](_0x456ca4)){_0x5b66ba=path[_0x4ee9('0x51')](_0x4ee9('0x8c'),_0x5c6457,_0x108648[0x0],_0x456ca4);}else{_0x5b66ba=_0x456ca4;}}else{logger[_0x4ee9('0x68')](_0x4ee9('0x8d'));}}else if(_0x3ac5e3===_0x4ee9('0x84')){_0xe8d822=_0x32e460[_0x4ee9('0x7c')]['scriptName'];_0x58085d=_0x32e460['parameters']['scriptPath'];if('undefined'!=typeof _0x32e460[_0x4ee9('0x7c')][_0x4ee9('0x7f')]){if(_0x4ee9('0x79')!=typeof _0x32e460[_0x4ee9('0x7c')][_0x4ee9('0x7f')][_0x4ee9('0x81')]){var _0x3a0fe7=_0x32e460[_0x4ee9('0x7c')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x4ee9('0x8b')](_0x3a0fe7)){_0x3b335f=path[_0x4ee9('0x51')](_0x4ee9('0x8c'),_0x5c6457,_0x108648[0x0],_0x3a0fe7);}else{_0x3b335f=_0x3a0fe7;}}if('undefined'!=typeof _0x32e460['parameters'][_0x4ee9('0x7f')]['agent']){var _0x456ca4=_0x32e460['parameters'][_0x4ee9('0x7f')][_0x4ee9('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x456ca4)){_0x5b66ba=path['join'](_0x4ee9('0x8c'),_0x5c6457,_0x108648[0x0],_0x456ca4);}else{_0x5b66ba=_0x456ca4;}}}}var _0x435051={'name':_0x4640e4,'description':_0x3cb5fd,'path':path[_0x4ee9('0x51')](_0x5c6457,_0x108648[0x0]),'type':_0x3ac5e3,'sidebar':_0x31724e,'icon':_0x320789,'adminUrl':_0x3b335f,'agentUrl':_0x5b66ba,'scriptName':_0xe8d822,'scriptPath':_0x58085d,'version':_0x5ea816};removeReferences(_0x92c0b2,null);return db[_0x4ee9('0x49')][_0x4ee9('0x8e')](_0x435051)['then'](function(_0x53e123){var _0x4f0673={'role':_0x52869b[_0x4ee9('0x8f')]['role'],'userProfileId':_0x52869b[_0x4ee9('0x8f')][_0x4ee9('0x90')]};if(!_0x4f0673)throw new Error(_0x4ee9('0x91'));if(_0x4f0673[_0x4ee9('0x92')]===_0x4ee9('0x93')){var _0x5e5538=_0x53e123[_0x4ee9('0x2d')]({'plain':!![]});return db[_0x4ee9('0x94')][_0x4ee9('0x4f')]({'where':{'name':_0x4ee9('0x2e'),'userProfileId':_0x4f0673[_0x4ee9('0x90')]},'raw':!![]})['then'](function(_0xc578aa){if(_0xc578aa&&_0xc578aa[_0x4ee9('0x95')]===0x0){return db['UserProfileResource'][_0x4ee9('0x8e')]({'name':_0x5e5538[_0x4ee9('0x31')],'resourceId':_0x5e5538['id'],'type':_0xc578aa[_0x4ee9('0x31')],'sectionId':_0xc578aa['id']},{})[_0x4ee9('0x2b')](function(){return _0x53e123;});}else{return _0x53e123;}})[_0x4ee9('0x4c')](function(_0x23d677){logger['error'](_0x4ee9('0x96'),_0x23d677);throw _0x23d677;});}return _0x53e123;})['then'](respondWithResult(_0x21b9f6,null))[_0x4ee9('0x4c')](handleError(_0x21b9f6,null));}});}catch(_0x7fb530){_0x21b9f6[_0x4ee9('0x22')](0x1f4)[_0x4ee9('0x32')](_0x7fb530);}};function removeReferences(_0x717b81,_0x53f27d){try{if(_0x717b81){fs[_0x4ee9('0x67')](_0x717b81);logger[_0x4ee9('0x68')]('Zip\x20archive\x20removed');}if(_0x53f27d){rimraf(_0x53f27d,function(){});logger[_0x4ee9('0x68')](_0x4ee9('0x97'));}}catch(_0x369533){logger[_0x4ee9('0x30')](_0x369533);}}exports[_0x4ee9('0x2a')]=function(_0x56513d,_0xa0da1c,_0x473232){return db[_0x4ee9('0x49')][_0x4ee9('0x4f')]({'where':{'id':_0x56513d[_0x4ee9('0x4e')]['id']}})['then'](handleEntityNotFound(_0xa0da1c,null))[_0x4ee9('0x2b')](saveUpdates(_0x56513d[_0x4ee9('0x8f')],null))[_0x4ee9('0x2b')](respondWithResult(_0xa0da1c,null))[_0x4ee9('0x4c')](handleError(_0xa0da1c,null));};exports[_0x4ee9('0x98')]=function(_0x4eb76c,_0x5ef6e4,_0x28c5da){return db[_0x4ee9('0x49')][_0x4ee9('0x4f')]({'where':{'id':_0x4eb76c[_0x4ee9('0x4e')]['id']}})[_0x4ee9('0x2b')](function(_0x3cc156){if(_0x3cc156){return _0x3cc156[_0x4ee9('0x2c')]();}})[_0x4ee9('0x2b')](function(_0x3ecaf0){rimraf(path['join'](config[_0x4ee9('0x52')],_0x4ee9('0x53'),path[_0x4ee9('0x5e')](_0x3ecaf0['path'])),function(){});return _0x3ecaf0;})[_0x4ee9('0x2b')](handleEntityNotFound(_0x5ef6e4,null))['then'](respondWithStatusCode(_0x5ef6e4,null))[_0x4ee9('0x4c')](handleError(_0x5ef6e4,null));};exports[_0x4ee9('0x99')]=function(_0x534562,_0x5d0a6e,_0x36c8ff){return BPromise[_0x4ee9('0x9a')]()[_0x4ee9('0x2b')](function(){if(!_0x534562[_0x4ee9('0x3d')][_0x4ee9('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x534562['query'][_0x4ee9('0x9b')]){throw new Error(_0x4ee9('0x9c'));}var _0x2ab5f5=_0x534562[_0x4ee9('0x3d')][_0x4ee9('0x9d')]?_0x534562[_0x4ee9('0x3d')][_0x4ee9('0x9d')]+':'+_0x534562[_0x4ee9('0x3d')][_0x4ee9('0x9b')]:_0x4ee9('0x9e')+_0x534562[_0x4ee9('0x3d')][_0x4ee9('0x9b')];var _0x2c0cdf=_0x534562[_0x4ee9('0x3d')][_0x4ee9('0x23')]?_0x534562['query']['json']:!![];var _0x8ca543=_0x534562[_0x4ee9('0x3d')][_0x4ee9('0x9f')]?_0x534562['query'][_0x4ee9('0x9f')]:null;var _0x337080={'method':_0x534562['method'],'uri':util[_0x4ee9('0x64')](_0x4ee9('0xa0'),_0x2ab5f5,_0x534562[_0x4ee9('0x3d')]['path']),'json':_0x2c0cdf,'resolveWithFullResponse':!![],'encoding':_0x8ca543,'qs':_0x534562[_0x4ee9('0x3d')]};if(_0x534562[_0x4ee9('0xa1')]){_0x337080['headers']=_0x534562[_0x4ee9('0xa1')];if(_0x337080['headers'][_0x4ee9('0xa2')]){delete _0x337080[_0x4ee9('0xa1')][_0x4ee9('0xa2')];}}if(_0x337080['headers'][_0x4ee9('0xa3')]){delete _0x337080['headers'][_0x4ee9('0xa3')];}return rp(_0x337080);})[_0x4ee9('0x2b')](function(_0x5f270a){if(_0x5f270a){_0x5d0a6e['set'](_0x5f270a[_0x4ee9('0xa1')]);logger[_0x4ee9('0x68')](_0x5f270a[_0x4ee9('0x8f')]);if(_[_0x4ee9('0xa4')](_0x534562[_0x4ee9('0x3d')]['path'],_0x4ee9('0x50'))&&_0x5f270a[_0x4ee9('0xa5')]==0x1f4){return _0x5d0a6e[_0x4ee9('0x21')](_0x5f270a[_0x4ee9('0xa5')]);}else{return _0x5d0a6e[_0x4ee9('0x22')](_0x5f270a[_0x4ee9('0xa5')])[_0x4ee9('0x32')](_0x5f270a[_0x4ee9('0x8f')]);}}else{return _0x5d0a6e['sendStatus'](0xc8);}})[_0x4ee9('0x4c')](handleError(_0x5d0a6e,null));};exports[_0x4ee9('0xa6')]=function(_0x2c46f5,_0x2eedde,_0x3ff7d7){return BPromise[_0x4ee9('0x9a')]()[_0x4ee9('0x2b')](function(){if(!_0x2c46f5[_0x4ee9('0x3d')][_0x4ee9('0x8')]){throw new Error(_0x4ee9('0xa7'));}if(!_0x2c46f5[_0x4ee9('0x3d')][_0x4ee9('0x9b')]){throw new Error(_0x4ee9('0x9c'));}var _0x3ffa5f=_0x2c46f5['query'][_0x4ee9('0x9d')]?_0x2c46f5[_0x4ee9('0x3d')][_0x4ee9('0x9d')]+':'+_0x2c46f5[_0x4ee9('0x3d')][_0x4ee9('0x9b')]:'http://localhost:'+_0x2c46f5[_0x4ee9('0x3d')]['port'];var _0x5224c6=_0x2c46f5[_0x4ee9('0x3d')][_0x4ee9('0x23')]?_0x2c46f5['query'][_0x4ee9('0x23')]:!![];var _0x55a662=_0x2c46f5[_0x4ee9('0x3d')][_0x4ee9('0x9f')]?_0x2c46f5[_0x4ee9('0x3d')][_0x4ee9('0x9f')]:null;var _0x5a17a9={'method':_0x2c46f5[_0x4ee9('0xa8')],'uri':util[_0x4ee9('0x64')](_0x4ee9('0xa0'),_0x3ffa5f,_0x2c46f5[_0x4ee9('0x3d')]['path']),'json':_0x5224c6,'resolveWithFullResponse':!![],'encoding':_0x55a662,'body':_0x2c46f5[_0x4ee9('0x8f')]};if(_0x2c46f5[_0x4ee9('0xa1')]){_0x5a17a9[_0x4ee9('0xa1')]=_0x2c46f5['headers'];if(_0x5a17a9[_0x4ee9('0xa1')][_0x4ee9('0xa2')]){delete _0x5a17a9['headers'][_0x4ee9('0xa2')];}}if(_0x5a17a9[_0x4ee9('0xa1')][_0x4ee9('0xa3')]){delete _0x5a17a9[_0x4ee9('0xa1')][_0x4ee9('0xa3')];}return rp(_0x5a17a9);})[_0x4ee9('0x2b')](function(_0x5a568b){if(_0x5a568b){_0x2eedde[_0x4ee9('0x26')](_0x5a568b[_0x4ee9('0xa1')]);logger[_0x4ee9('0x68')](_0x5a568b[_0x4ee9('0x8f')]);return _0x2eedde[_0x4ee9('0x22')](_0x5a568b[_0x4ee9('0xa5')])['send'](_0x5a568b[_0x4ee9('0x8f')]);}else{return _0x2eedde[_0x4ee9('0x21')](0xc8);}})[_0x4ee9('0x4c')](handleError(_0x2eedde,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 74deef2..4de3474 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 _0x896e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x26d836,_0x116719){var _0x2aac91=function(_0x12265d){while(--_0x12265d){_0x26d836['push'](_0x26d836['shift']());}};_0x2aac91(++_0x116719);}(_0x896e,0x1e9));var _0xe896=function(_0x173e85,_0x51fe0c){_0x173e85=_0x173e85-0x0;var _0xd8328a=_0x896e[_0x173e85];return _0xd8328a;};'use strict';var EventEmitter=require(_0xe896('0x0'));var Plugin=require(_0xe896('0x1'))['db'][_0xe896('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xe896('0x3')](0x0);var events={'afterCreate':_0xe896('0x4'),'afterUpdate':_0xe896('0x5'),'afterDestroy':_0xe896('0x6')};function emitEvent(_0x463f56){return function(_0x3f85e5,_0x2d3521,_0x244f68){PluginEvents[_0xe896('0x7')](_0x463f56+':'+_0x3f85e5['id'],_0x3f85e5);PluginEvents['emit'](_0x463f56,_0x3f85e5);_0x244f68(null);};}for(var e in events){if(events[_0xe896('0x8')](e)){var event=events[e];Plugin[_0xe896('0x9')](e,emitEvent(event));}}module[_0xe896('0xa')]=PluginEvents; \ No newline at end of file +var _0x955f=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x205cab,_0x4cfdef){var _0x4423ad=function(_0x10f799){while(--_0x10f799){_0x205cab['push'](_0x205cab['shift']());}};_0x4423ad(++_0x4cfdef);}(_0x955f,0x1eb));var _0xf955=function(_0x555180,_0x377e55){_0x555180=_0x555180-0x0;var _0x5496e1=_0x955f[_0x555180];return _0x5496e1;};'use strict';var EventEmitter=require(_0xf955('0x0'));var Plugin=require(_0xf955('0x1'))['db'][_0xf955('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xf955('0x3')](0x0);var events={'afterCreate':_0xf955('0x4'),'afterUpdate':'update','afterDestroy':_0xf955('0x5')};function emitEvent(_0x5655ef){return function(_0x5d0c95,_0x1db0dd,_0x5a20bc){PluginEvents[_0xf955('0x6')](_0x5655ef+':'+_0x5d0c95['id'],_0x5d0c95);PluginEvents[_0xf955('0x6')](_0x5655ef,_0x5d0c95);_0x5a20bc(null);};}for(var e in events){if(events[_0xf955('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xf955('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 94f6d31..c5b884b 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 _0x5fd1=['Plugin','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x5fd1,0x155));var _0x15fd=function(_0x260dc5,_0x1b9973){_0x260dc5=_0x260dc5-0x0;var _0x4f7186=_0x5fd1[_0x260dc5];return _0x4f7186;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x15fd('0x4'));var rimraf=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var attributes=require('./plugin.attributes');module[_0x15fd('0x7')]=function(_0x386441,_0x18450c){return _0x386441[_0x15fd('0x8')](_0x15fd('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd28=['rimraf','./plugin.attributes','exports','define','util','../../config/logger','moment','request-promise','path'];(function(_0x1f3161,_0x2052b7){var _0x3b1dcb=function(_0x51e34c){while(--_0x51e34c){_0x1f3161['push'](_0x1f3161['shift']());}};_0x3b1dcb(++_0x2052b7);}(_0xfd28,0x148));var _0x8fd2=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xfd28[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var logger=require(_0x8fd2('0x1'))('api');var moment=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x8fd2('0x3'));var fs=require('fs');var path=require(_0x8fd2('0x4'));var rimraf=require(_0x8fd2('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fd2('0x6'));module[_0x8fd2('0x7')]=function(_0x2ee87e,_0x36178a){return _0x2ee87e[_0x8fd2('0x8')]('Plugin',attributes,{'tableName':'plugins','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 883b97f..2fe07ea 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 _0xe49f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Plugin','create','body','options','raw','then','CreatePlugin','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe49f,0x1c8));var _0xfe49=function(_0x56cbe1,_0x239a28){_0x56cbe1=_0x56cbe1-0x0;var _0x34bec9=_0xe49f[_0x56cbe1];return _0x34bec9;};'use strict';var _=require('lodash');var util=require(_0xfe49('0x0'));var moment=require(_0xfe49('0x1'));var BPromise=require(_0xfe49('0x2'));var rs=require(_0xfe49('0x3'));var fs=require('fs');var Redis=require(_0xfe49('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe49('0x5'));var logger=require(_0xfe49('0x6'))(_0xfe49('0x7'));var config=require(_0xfe49('0x8'));var jayson=require(_0xfe49('0x9'));var client=jayson[_0xfe49('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xfe49('0xb')],{'host':_0xfe49('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe49('0xb')]));require(_0xfe49('0xd'))[_0xfe49('0xe')](socket);function respondWithRpcPromise(_0x1c438a,_0x3a6367,_0x1c9edd){return new BPromise(function(_0x4760bc,_0x431864){return client[_0xfe49('0xf')](_0x1c438a,_0x1c9edd)['then'](function(_0x21e962){logger[_0xfe49('0x10')](_0xfe49('0x11'),_0x3a6367,_0xfe49('0x12'));logger[_0xfe49('0x13')](_0xfe49('0x14'),_0x3a6367,_0xfe49('0x12'),JSON[_0xfe49('0x15')](_0x21e962));if(_0x21e962[_0xfe49('0x16')]){if(_0x21e962['error']['code']===0x1f4){logger[_0xfe49('0x16')]('Plugin,\x20%s,\x20%s',_0x3a6367,_0x21e962['error'][_0xfe49('0x17')]);return _0x431864(_0x21e962[_0xfe49('0x16')][_0xfe49('0x17')]);}logger[_0xfe49('0x16')](_0xfe49('0x11'),_0x3a6367,_0x21e962['error'][_0xfe49('0x17')]);return _0x4760bc(_0x21e962[_0xfe49('0x16')][_0xfe49('0x17')]);}else{logger[_0xfe49('0x10')](_0xfe49('0x11'),_0x3a6367,_0xfe49('0x12'));_0x4760bc(_0x21e962[_0xfe49('0x18')][_0xfe49('0x17')]);}})[_0xfe49('0x19')](function(_0x3ee56e){logger[_0xfe49('0x16')](_0xfe49('0x11'),_0x3a6367,_0x3ee56e);_0x431864(_0x3ee56e);});});}exports['CreatePlugin']=function(_0x3b674e){var _0x2ac3b3=this;return new Promise(function(_0x8cd0a2,_0x526a1b){return db[_0xfe49('0x1a')][_0xfe49('0x1b')](_0x3b674e[_0xfe49('0x1c')],{'raw':_0x3b674e[_0xfe49('0x1d')]?_0x3b674e[_0xfe49('0x1d')][_0xfe49('0x1e')]===undefined?!![]:![]:!![]})[_0xfe49('0x1f')](function(_0x570597){logger[_0xfe49('0x10')]('CreatePlugin',_0x3b674e);logger[_0xfe49('0x13')](_0xfe49('0x20'),_0x3b674e,JSON[_0xfe49('0x15')](_0x570597));_0x8cd0a2(_0x570597);})['catch'](function(_0x241979){logger[_0xfe49('0x16')](_0xfe49('0x20'),_0x241979['message'],_0x3b674e);_0x526a1b(_0x2ac3b3['error'](0x1f4,_0x241979['message']));});});}; \ No newline at end of file +var _0xc351=['CreatePlugin','Plugin','create','body','options','debug','stringify','catch','lodash','util','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','socket.io-emitter','./plugin.socket','request','then','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','error','code','Plugin,\x20%s,\x20%s','message','result'];(function(_0x2b0728,_0x3ed867){var _0x37e9f2=function(_0x4ccbc4){while(--_0x4ccbc4){_0x2b0728['push'](_0x2b0728['shift']());}};_0x37e9f2(++_0x3ed867);}(_0xc351,0x1c8));var _0x1c35=function(_0x318256,_0xa773f3){_0x318256=_0x318256-0x0;var _0xb1e352=_0xc351[_0x318256];return _0xb1e352;};'use strict';var _=require(_0x1c35('0x0'));var util=require(_0x1c35('0x1'));var moment=require(_0x1c35('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(_0x1c35('0x3'));var logger=require(_0x1c35('0x4'))('rpc');var config=require(_0x1c35('0x5'));var jayson=require(_0x1c35('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x1c35('0x7')]=_['defaults'](config[_0x1c35('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c35('0x8'))(new Redis(config[_0x1c35('0x7')]));require(_0x1c35('0x9'))['register'](socket);function respondWithRpcPromise(_0xa974fb,_0x8b99b4,_0x320954){return new BPromise(function(_0x2eacce,_0x472275){return client[_0x1c35('0xa')](_0xa974fb,_0x320954)[_0x1c35('0xb')](function(_0x4e2bbd){logger[_0x1c35('0xc')]('Plugin,\x20%s,\x20%s',_0x8b99b4,_0x1c35('0xd'));logger['debug'](_0x1c35('0xe'),_0x8b99b4,_0x1c35('0xd'),JSON['stringify'](_0x4e2bbd));if(_0x4e2bbd[_0x1c35('0xf')]){if(_0x4e2bbd[_0x1c35('0xf')][_0x1c35('0x10')]===0x1f4){logger['error'](_0x1c35('0x11'),_0x8b99b4,_0x4e2bbd['error'][_0x1c35('0x12')]);return _0x472275(_0x4e2bbd[_0x1c35('0xf')][_0x1c35('0x12')]);}logger['error'](_0x1c35('0x11'),_0x8b99b4,_0x4e2bbd[_0x1c35('0xf')][_0x1c35('0x12')]);return _0x2eacce(_0x4e2bbd[_0x1c35('0xf')]['message']);}else{logger[_0x1c35('0xc')](_0x1c35('0x11'),_0x8b99b4,_0x1c35('0xd'));_0x2eacce(_0x4e2bbd[_0x1c35('0x13')][_0x1c35('0x12')]);}})['catch'](function(_0x767d4f){logger[_0x1c35('0xf')](_0x1c35('0x11'),_0x8b99b4,_0x767d4f);_0x472275(_0x767d4f);});});}exports[_0x1c35('0x14')]=function(_0x433979){var _0x3d5792=this;return new Promise(function(_0x1e776b,_0x13f559){return db[_0x1c35('0x15')][_0x1c35('0x16')](_0x433979[_0x1c35('0x17')],{'raw':_0x433979[_0x1c35('0x18')]?_0x433979['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x40e4c0){logger['info'](_0x1c35('0x14'),_0x433979);logger[_0x1c35('0x19')](_0x1c35('0x14'),_0x433979,JSON[_0x1c35('0x1a')](_0x40e4c0));_0x1e776b(_0x40e4c0);})[_0x1c35('0x1b')](function(_0x174e39){logger[_0x1c35('0xf')](_0x1c35('0x14'),_0x174e39[_0x1c35('0x12')],_0x433979);_0x13f559(_0x3d5792['error'](0x1f4,_0x174e39[_0x1c35('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index fcf51a0..5346e38 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 _0x09cb=['register','./plugin.events','update','emit'];(function(_0x3b65b4,_0x3282bd){var _0x33ff4a=function(_0xd88a93){while(--_0xd88a93){_0x3b65b4['push'](_0x3b65b4['shift']());}};_0x33ff4a(++_0x3282bd);}(_0x09cb,0xdd));var _0xb09c=function(_0x27d590,_0x337396){_0x27d590=_0x27d590-0x0;var _0x51d5f0=_0x09cb[_0x27d590];return _0x51d5f0;};'use strict';var PluginEvents=require(_0xb09c('0x0'));var events=['save','remove',_0xb09c('0x1')];function createListener(_0x235568,_0x12bf1c){return function(_0x31492c){_0x12bf1c[_0xb09c('0x2')](_0x235568,_0x31492c);};}function removeListener(_0x48ff24,_0x5a4f37){return function(){PluginEvents['removeListener'](_0x48ff24,_0x5a4f37);};}exports[_0xb09c('0x3')]=function(_0x57a2aa){for(var _0x3342e1=0x0,_0x249b28=events['length'];_0x3342e1<_0x249b28;_0x3342e1++){var _0x5770f0=events[_0x3342e1];var _0x4eb509=createListener('plugin:'+_0x5770f0,_0x57a2aa);PluginEvents['on'](_0x5770f0,_0x4eb509);}}; \ No newline at end of file +var _0x62a5=['length','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x35aeda,_0x264a31){var _0x40498c=function(_0x25f8fc){while(--_0x25f8fc){_0x35aeda['push'](_0x35aeda['shift']());}};_0x40498c(++_0x264a31);}(_0x62a5,0x14b));var _0x562a=function(_0x1f2a79,_0x37ef7d){_0x1f2a79=_0x1f2a79-0x0;var _0x5edca2=_0x62a5[_0x1f2a79];return _0x5edca2;};'use strict';var PluginEvents=require(_0x562a('0x0'));var events=[_0x562a('0x1'),_0x562a('0x2'),_0x562a('0x3')];function createListener(_0x4dc5ec,_0x4d584b){return function(_0x544618){_0x4d584b[_0x562a('0x4')](_0x4dc5ec,_0x544618);};}function removeListener(_0x3b218c,_0xf797a5){return function(){PluginEvents['removeListener'](_0x3b218c,_0xf797a5);};}exports['register']=function(_0x48420b){for(var _0x21c955=0x0,_0x3d4aaf=events[_0x562a('0x5')];_0x21c955<_0x3d4aaf;_0x21c955++){var _0x52e970=events[_0x21c955];var _0x5e6808=createListener(_0x562a('0x6')+_0x52e970,_0x48420b);PluginEvents['on'](_0x52e970,_0x5e6808);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 731da41..9c276d5 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 _0x61e2=['isAuthenticated','index','/:id','show','post','update','destroy','exports','express','Router','../../components/auth/service','get'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x61e2,0x140));var _0x261e=function(_0x56237f,_0x1b4687){_0x56237f=_0x56237f-0x0;var _0xc9b191=_0x61e2[_0x56237f];return _0xc9b191;};'use strict';var express=require(_0x261e('0x0'));var router=express[_0x261e('0x1')]();var auth=require(_0x261e('0x2'));var controller=require('./pm2.controller');router[_0x261e('0x3')]('/',auth[_0x261e('0x4')](),controller[_0x261e('0x5')]);router['get'](_0x261e('0x6'),auth[_0x261e('0x4')](),controller[_0x261e('0x7')]);router[_0x261e('0x8')]('/',auth[_0x261e('0x4')](),controller['create']);router['put']('/:id',auth[_0x261e('0x4')](),controller[_0x261e('0x9')]);router['delete'](_0x261e('0x6'),auth['isAuthenticated'](),controller[_0x261e('0xa')]);module[_0x261e('0xb')]=router; \ No newline at end of file +var _0x8483=['destroy','express','Router','../../components/auth/service','./pm2.controller','index','get','isAuthenticated','show','create','put','delete','/:id'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0x8483,0x12c));var _0x3848=function(_0x414e0c,_0x4525ce){_0x414e0c=_0x414e0c-0x0;var _0x40780a=_0x8483[_0x414e0c];return _0x40780a;};'use strict';var express=require(_0x3848('0x0'));var router=express[_0x3848('0x1')]();var auth=require(_0x3848('0x2'));var controller=require(_0x3848('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x3848('0x4')]);router[_0x3848('0x5')]('/:id',auth[_0x3848('0x6')](),controller[_0x3848('0x7')]);router['post']('/',auth[_0x3848('0x6')](),controller[_0x3848('0x8')]);router[_0x3848('0x9')]('/:id',auth[_0x3848('0x6')](),controller['update']);router[_0x3848('0xa')](_0x3848('0xb'),auth[_0x3848('0x6')](),controller[_0x3848('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 0292f50..3270802 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 _0x87ec=['stack','name','send','info','index','list','then','express','motion2','length','catch','describe','params','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','error'];(function(_0x2b1a15,_0xb6dea){var _0x13c836=function(_0x55a592){while(--_0x55a592){_0x2b1a15['push'](_0x2b1a15['shift']());}};_0x13c836(++_0xb6dea);}(_0x87ec,0x114));var _0xc87e=function(_0x55ab1c,_0x30d0f4){_0x55ab1c=_0x55ab1c-0x0;var _0x486962=_0x87ec[_0x55ab1c];return _0x486962;};'use strict';var _=require(_0xc87e('0x0'));var pm2=require(_0xc87e('0x1'));var logger=require(_0xc87e('0x2'))(_0xc87e('0x3'));var path=require(_0xc87e('0x4'));var exec=require(_0xc87e('0x5'))[_0xc87e('0x6')];var BPromise=require(_0xc87e('0x7'));function handleEntityNotFound(_0x53c94f,_0x5bbd19){return function(_0x9ccbc8){if(!_0x9ccbc8){_0x53c94f[_0xc87e('0x8')](0x194);;}return _0x9ccbc8;};}function respondWithResult(_0x4d0067,_0xc6d254){_0xc6d254=_0xc6d254||0xc8;return function(_0xfc7756){if(_0xfc7756){return _0x4d0067[_0xc87e('0x9')](_0xc6d254)['json'](_0xfc7756);}return null;};}function handleError(_0x1cb597,_0x463fef){_0x463fef=_0x463fef||0x1f4;return function(_0x5b2bdd){logger[_0xc87e('0xa')](_0x5b2bdd[_0xc87e('0xb')]);if(_0x5b2bdd['name']){delete _0x5b2bdd[_0xc87e('0xc')];}_0x1cb597['status'](_0x463fef)[_0xc87e('0xd')](_0x5b2bdd);};}function execChildProcess(){return new BPromise(function(_0x297f2d,_0x275413){exec('npm\x20install',function(_0x304505,_0x17a8ee,_0x2a8b39){logger[_0xc87e('0xe')](_0x17a8ee);logger['info'](_0x2a8b39);if(_0x304505){logger[_0xc87e('0xa')](_0x304505);return _0x275413(_0x304505);}return _0x297f2d(_0x17a8ee);});});}exports[_0xc87e('0xf')]=function(_0xebdead,_0x4b23d7){return pm2[_0xc87e('0x10')]()[_0xc87e('0x11')](function(_0x4b11e5){if(_0x4b11e5){var _0x3de24d=_['reject'](_0x4b11e5,function(_0x4fb123){return _0x4fb123[_0xc87e('0xc')]===_0xc87e('0x12')||_0x4fb123[_0xc87e('0xc')]===_0xc87e('0x13');});return{'rows':_0x3de24d,'count':_0x3de24d[_0xc87e('0x14')]};}return null;})[_0xc87e('0x11')](respondWithResult(_0x4b23d7,null))[_0xc87e('0x15')](handleError(_0x4b23d7,null));};exports['show']=function(_0x59988e,_0x1ba962){return pm2[_0xc87e('0x16')](_0x59988e[_0xc87e('0x17')]['id'])['then'](respondWithResult(_0x1ba962,null))['then'](handleEntityNotFound(_0x1ba962,null))[_0xc87e('0x15')](handleError(_0x1ba962,null));};exports[_0xc87e('0x18')]=function(_0x303e29,_0xa0811c){if(_0x303e29[_0xc87e('0x19')][_0xc87e('0xc')]&&_0x303e29[_0xc87e('0x19')][_0xc87e('0x1a')]){var _0xc9c1ce=path[_0xc87e('0x1b')](__dirname,_0xc87e('0x1c'),_0x303e29[_0xc87e('0x19')][_0xc87e('0x1a')]);var _0xfced5c=process['cwd']();process[_0xc87e('0x1d')](path[_0xc87e('0x1e')](_0xc9c1ce));return execChildProcess()['then'](function(_0x59602b){process[_0xc87e('0x1d')](_0xfced5c);return pm2[_0xc87e('0x1f')]({'name':_0x303e29['body'][_0xc87e('0xc')],'script':_0xc9c1ce});})[_0xc87e('0x11')](function(_0x3901c0){pm2[_0xc87e('0x20')]();return _0x3901c0[0x0];})['then'](respondWithResult(_0xa0811c,0xc9))[_0xc87e('0x15')](handleError(_0xa0811c,null));}else{return _0xa0811c['status'](0x1f4)[_0xc87e('0xd')]({'message':_0xc87e('0x21')});}};exports['update']=function(_0x2fe0fe,_0x350ba7){if(_0x2fe0fe[_0xc87e('0x19')]['id']){delete _0x2fe0fe[_0xc87e('0x19')]['id'];}var _0x571633={'online':_0xc87e('0x22'),'stopped':_0xc87e('0x23')};if(_0x571633[_0xc87e('0x24')](_0x2fe0fe[_0xc87e('0x19')][_0xc87e('0x9')])){return pm2[_0x571633[_0x2fe0fe['body'][_0xc87e('0x9')]]](_0x2fe0fe[_0xc87e('0x17')]['id'])['then'](respondWithResult(_0x350ba7,0xc8))[_0xc87e('0x15')](handleError(_0x350ba7,null));}else{return _0x350ba7[_0xc87e('0x9')](0x1f4)[_0xc87e('0xd')]({'message':_0xc87e('0x25')});}};exports[_0xc87e('0x26')]=function(_0x12b306,_0x5cfc78){if(_0x12b306[_0xc87e('0x19')]['id']){delete _0x12b306[_0xc87e('0x19')]['id'];}if(_0x12b306[_0xc87e('0x17')]['id']){return pm2[_0xc87e('0x27')](_0x12b306[_0xc87e('0x17')]['id'])[_0xc87e('0x11')](function(_0x1134d5){pm2[_0xc87e('0x20')]();return _0x1134d5[0x0];})[_0xc87e('0x11')](respondWithResult(_0x5cfc78,null))['catch'](handleError(_0x5cfc78,null));}else{return _0x5cfc78[_0xc87e('0x9')](0x1f4)[_0xc87e('0xd')]({'message':_0xc87e('0x28')});}}; \ No newline at end of file +var _0x6266=['npm\x20install','list','then','express','motion2','catch','show','describe','body','script','../../files/plugins','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','params','Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/pm2','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send'];(function(_0x30965b,_0x40c769){var _0x190f0a=function(_0x45a295){while(--_0x45a295){_0x30965b['push'](_0x30965b['shift']());}};_0x190f0a(++_0x40c769);}(_0x6266,0x165));var _0x6626=function(_0x2eccb1,_0x269149){_0x2eccb1=_0x2eccb1-0x0;var _0x265c7d=_0x6266[_0x2eccb1];return _0x265c7d;};'use strict';var _=require(_0x6626('0x0'));var pm2=require(_0x6626('0x1'));var logger=require('../../config/logger')('api');var path=require(_0x6626('0x2'));var exec=require(_0x6626('0x3'))[_0x6626('0x4')];var BPromise=require(_0x6626('0x5'));function handleEntityNotFound(_0x5a0830,_0x926247){return function(_0x303614){if(!_0x303614){_0x5a0830[_0x6626('0x6')](0x194);;}return _0x303614;};}function respondWithResult(_0x38a261,_0x3c96e1){_0x3c96e1=_0x3c96e1||0xc8;return function(_0x166454){if(_0x166454){return _0x38a261[_0x6626('0x7')](_0x3c96e1)[_0x6626('0x8')](_0x166454);}return null;};}function handleError(_0x7eb314,_0x2b2e78){_0x2b2e78=_0x2b2e78||0x1f4;return function(_0x421b16){logger[_0x6626('0x9')](_0x421b16[_0x6626('0xa')]);if(_0x421b16[_0x6626('0xb')]){delete _0x421b16['name'];}_0x7eb314[_0x6626('0x7')](_0x2b2e78)[_0x6626('0xc')](_0x421b16);};}function execChildProcess(){return new BPromise(function(_0xa7f4be,_0x32b81e){exec(_0x6626('0xd'),function(_0x2dc8ed,_0xd8abd0,_0x51026e){logger['info'](_0xd8abd0);logger['info'](_0x51026e);if(_0x2dc8ed){logger[_0x6626('0x9')](_0x2dc8ed);return _0x32b81e(_0x2dc8ed);}return _0xa7f4be(_0xd8abd0);});});}exports['index']=function(_0x5a3c1b,_0x34e6e0){return pm2[_0x6626('0xe')]()[_0x6626('0xf')](function(_0x20ac15){if(_0x20ac15){var _0x4131ac=_['reject'](_0x20ac15,function(_0x4e26e1){return _0x4e26e1[_0x6626('0xb')]===_0x6626('0x10')||_0x4e26e1[_0x6626('0xb')]===_0x6626('0x11');});return{'rows':_0x4131ac,'count':_0x4131ac['length']};}return null;})[_0x6626('0xf')](respondWithResult(_0x34e6e0,null))[_0x6626('0x12')](handleError(_0x34e6e0,null));};exports[_0x6626('0x13')]=function(_0x2aa807,_0x55af13){return pm2[_0x6626('0x14')](_0x2aa807['params']['id'])[_0x6626('0xf')](respondWithResult(_0x55af13,null))['then'](handleEntityNotFound(_0x55af13,null))[_0x6626('0x12')](handleError(_0x55af13,null));};exports['create']=function(_0x517749,_0x3a67a7){if(_0x517749[_0x6626('0x15')][_0x6626('0xb')]&&_0x517749[_0x6626('0x15')][_0x6626('0x16')]){var _0x1213b4=path['join'](__dirname,_0x6626('0x17'),_0x517749[_0x6626('0x15')][_0x6626('0x16')]);var _0x1b7a10=process[_0x6626('0x18')]();process[_0x6626('0x19')](path[_0x6626('0x1a')](_0x1213b4));return execChildProcess()[_0x6626('0xf')](function(_0x3e3fc0){process['chdir'](_0x1b7a10);return pm2[_0x6626('0x1b')]({'name':_0x517749[_0x6626('0x15')]['name'],'script':_0x1213b4});})[_0x6626('0xf')](function(_0x5b2271){pm2['dump']();return _0x5b2271[0x0];})[_0x6626('0xf')](respondWithResult(_0x3a67a7,0xc9))[_0x6626('0x12')](handleError(_0x3a67a7,null));}else{return _0x3a67a7[_0x6626('0x7')](0x1f4)[_0x6626('0xc')]({'message':_0x6626('0x1c')});}};exports[_0x6626('0x1d')]=function(_0x37a2e3,_0x3addc3){if(_0x37a2e3[_0x6626('0x15')]['id']){delete _0x37a2e3[_0x6626('0x15')]['id'];}var _0x495761={'online':_0x6626('0x1e'),'stopped':'stop'};if(_0x495761['hasOwnProperty'](_0x37a2e3[_0x6626('0x15')][_0x6626('0x7')])){return pm2[_0x495761[_0x37a2e3[_0x6626('0x15')][_0x6626('0x7')]]](_0x37a2e3[_0x6626('0x1f')]['id'])[_0x6626('0xf')](respondWithResult(_0x3addc3,0xc8))['catch'](handleError(_0x3addc3,null));}else{return _0x3addc3['status'](0x1f4)[_0x6626('0xc')]({'message':_0x6626('0x20')});}};exports[_0x6626('0x21')]=function(_0x51f83b,_0x184282){if(_0x51f83b['body']['id']){delete _0x51f83b['body']['id'];}if(_0x51f83b['params']['id']){return pm2[_0x6626('0x22')](_0x51f83b['params']['id'])[_0x6626('0xf')](function(_0x1a6daa){pm2[_0x6626('0x23')]();return _0x1a6daa[0x0];})[_0x6626('0xf')](respondWithResult(_0x184282,null))[_0x6626('0x12')](handleError(_0x184282,null));}else{return _0x184282[_0x6626('0x7')](0x1f4)[_0x6626('0xc')]({'message':_0x6626('0x24')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 29a2cfe..73f2e66 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 _0x40ca=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x4bf8a3,_0x41c361){var _0x425b10=function(_0x642268){while(--_0x642268){_0x4bf8a3['push'](_0x4bf8a3['shift']());}};_0x425b10(++_0x41c361);}(_0x40ca,0xee));var _0xa40c=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x40ca[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0xa40c('0x0'));var util=require(_0xa40c('0x1'));var path=require(_0xa40c('0x2'));var timeout=require(_0xa40c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xa40c('0x4'));var interaction=require(_0xa40c('0x5'));var config=require(_0xa40c('0x6'));module[_0xa40c('0x7')]=router; \ No newline at end of file +var _0xa404=['connect-timeout','express','Router','../../components/auth/service','exports','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa404,0x1c5));var _0x4a40=function(_0x55eb40,_0x58546b){_0x55eb40=_0x55eb40-0x0;var _0x449c0b=_0xa404[_0x55eb40];return _0x449c0b;};'use strict';var multer=require(_0x4a40('0x0'));var util=require('util');var path=require(_0x4a40('0x1'));var timeout=require(_0x4a40('0x2'));var express=require(_0x4a40('0x3'));var router=express[_0x4a40('0x4')]();var auth=require(_0x4a40('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x4a40('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 1ec22d0..00715a2 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 _0x7da5=['INTEGER','DATE','STRING','sequelize','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7da5,0xc6));var _0x57da=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x7da5[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0x57da('0x0'));module[_0x57da('0x1')]={'state':{'type':Sequelize[_0x57da('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x57da('0x3')]},'uniqueid':{'type':Sequelize[_0x57da('0x4')]},'starttime':{'type':Sequelize[_0x57da('0x3')]},'responsetime':{'type':Sequelize[_0x57da('0x3')]},'ringtime':{'type':Sequelize[_0x57da('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x57da('0x4')]},'campaigntype':{'type':Sequelize[_0x57da('0x4')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x82b6=['STRING','DATE','sequelize','INTEGER'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x82b6,0xfa));var _0x682b=function(_0x578c66,_0x3e090f){_0x578c66=_0x578c66-0x0;var _0x586aa2=_0x82b6[_0x578c66];return _0x586aa2;};'use strict';var Sequelize=require(_0x682b('0x0'));module['exports']={'state':{'type':Sequelize[_0x682b('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x682b('0x2')]},'scheduledat':{'type':Sequelize[_0x682b('0x3')]},'uniqueid':{'type':Sequelize[_0x682b('0x2')]},'starttime':{'type':Sequelize[_0x682b('0x3')]},'responsetime':{'type':Sequelize[_0x682b('0x3')]},'ringtime':{'type':Sequelize[_0x682b('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x682b('0x2')]},'membername':{'type':Sequelize[_0x682b('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 5605ba0..3e1dfab 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 _0x1481=['path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x37ac13,_0x2fc7a2){var _0x335140=function(_0x70b9aa){while(--_0x70b9aa){_0x37ac13['push'](_0x37ac13['shift']());}};_0x335140(++_0x2fc7a2);}(_0x1481,0x127));var _0x1148=function(_0x363b38,_0x3ebe9e){_0x363b38=_0x363b38-0x0;var _0x148e3c=_0x1481[_0x363b38];return _0x148e3c;};'use strict';var _=require(_0x1148('0x0'));var util=require(_0x1148('0x1'));var logger=require(_0x1148('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1148('0x3'));var rp=require(_0x1148('0x4'));var fs=require('fs');var path=require(_0x1148('0x5'));var rimraf=require(_0x1148('0x6'));var config=require(_0x1148('0x7'));var attributes=require(_0x1148('0x8'));module[_0x1148('0x9')]=function(_0x20abf4,_0x3e0645){return _0x20abf4['define'](_0x1148('0xa'),attributes,{'tableName':_0x1148('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ef9=['lodash','util','api','moment','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','report_agent_preview'];(function(_0x4e82bb,_0x258f06){var _0x4f37de=function(_0x51e7a4){while(--_0x51e7a4){_0x4e82bb['push'](_0x4e82bb['shift']());}};_0x4f37de(++_0x258f06);}(_0x9ef9,0x64));var _0x99ef=function(_0xc2d26f,_0x180ccf){_0xc2d26f=_0xc2d26f-0x0;var _0x50e707=_0x9ef9[_0xc2d26f];return _0x50e707;};'use strict';var _=require(_0x99ef('0x0'));var util=require(_0x99ef('0x1'));var logger=require('../../config/logger')(_0x99ef('0x2'));var moment=require(_0x99ef('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x99ef('0x4'));var rimraf=require(_0x99ef('0x5'));var config=require(_0x99ef('0x6'));var attributes=require(_0x99ef('0x7'));module['exports']=function(_0x4d1f50,_0x547815){return _0x4d1f50[_0x99ef('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x99ef('0x9'),'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 9049b9e..8977144 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 _0x905e=['randomstring','../../mysqldb','../../config/utils','../../config/logger','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','result','catch','ReportAgentPreview','create','body','options','CreateReportAgentPreview','stringify','util','moment','bluebird'];(function(_0x2edc87,_0x344cc2){var _0x2b6305=function(_0x40cac3){while(--_0x40cac3){_0x2edc87['push'](_0x2edc87['shift']());}};_0x2b6305(++_0x344cc2);}(_0x905e,0x1ad));var _0xe905=function(_0x15105a,_0x30279d){_0x15105a=_0x15105a-0x0;var _0x2a5ce6=_0x905e[_0x15105a];return _0x2a5ce6;};'use strict';var _=require('lodash');var util=require(_0xe905('0x0'));var moment=require(_0xe905('0x1'));var BPromise=require(_0xe905('0x2'));var rs=require(_0xe905('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe905('0x4'))['db'];var utils=require(_0xe905('0x5'));var logger=require(_0xe905('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe905('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e5f6a,_0x499ec0,_0x29824d){return new BPromise(function(_0x1860f,_0x583b51){return client['request'](_0x3e5f6a,_0x29824d)[_0xe905('0x8')](function(_0x6958c0){logger[_0xe905('0x9')](_0xe905('0xa'),_0x499ec0,_0xe905('0xb'));logger[_0xe905('0xc')](_0xe905('0xd'),_0x499ec0,_0xe905('0xb'),JSON['stringify'](_0x6958c0));if(_0x6958c0[_0xe905('0xe')]){if(_0x6958c0[_0xe905('0xe')]['code']===0x1f4){logger[_0xe905('0xe')](_0xe905('0xa'),_0x499ec0,_0x6958c0[_0xe905('0xe')][_0xe905('0xf')]);return _0x583b51(_0x6958c0['error'][_0xe905('0xf')]);}logger[_0xe905('0xe')](_0xe905('0xa'),_0x499ec0,_0x6958c0['error'][_0xe905('0xf')]);return _0x1860f(_0x6958c0[_0xe905('0xe')][_0xe905('0xf')]);}else{logger[_0xe905('0x9')](_0xe905('0xa'),_0x499ec0,_0xe905('0xb'));_0x1860f(_0x6958c0[_0xe905('0x10')][_0xe905('0xf')]);}})[_0xe905('0x11')](function(_0x39f827){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x499ec0,_0x39f827);_0x583b51(_0x39f827);});});}exports['CreateReportAgentPreview']=function(_0x3bc123){var _0x20912d=this;return new Promise(function(_0x3bcdc5,_0x42e5e4){return db[_0xe905('0x12')][_0xe905('0x13')](_0x3bc123[_0xe905('0x14')],{'raw':_0x3bc123['options']?_0x3bc123[_0xe905('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xe905('0x8')](function(_0x363c15){logger[_0xe905('0x9')](_0xe905('0x16'),_0x3bc123);logger[_0xe905('0xc')](_0xe905('0x16'),_0x3bc123,JSON[_0xe905('0x17')](_0x363c15));_0x3bcdc5(_0x363c15);})[_0xe905('0x11')](function(_0x48e33b){logger[_0xe905('0xe')]('CreateReportAgentPreview',_0x48e33b[_0xe905('0xf')],_0x3bc123);_0x42e5e4(_0x20912d[_0xe905('0xe')](0x1f4,_0x48e33b[_0xe905('0xf')]));});});}; \ No newline at end of file +var _0x9351=['request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x50fca2,_0x2a23eb){var _0x14ecdb=function(_0x4a9d4a){while(--_0x4a9d4a){_0x50fca2['push'](_0x50fca2['shift']());}};_0x14ecdb(++_0x2a23eb);}(_0x9351,0xb4));var _0x1935=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9351[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x1935('0x0'));var moment=require(_0x1935('0x1'));var BPromise=require('bluebird');var rs=require(_0x1935('0x2'));var fs=require('fs');var Redis=require(_0x1935('0x3'));var db=require(_0x1935('0x4'))['db'];var utils=require(_0x1935('0x5'));var logger=require(_0x1935('0x6'))(_0x1935('0x7'));var config=require(_0x1935('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19e97e,_0x513601,_0x527274){return new BPromise(function(_0x521a6b,_0x319cc2){return client[_0x1935('0x9')](_0x19e97e,_0x527274)[_0x1935('0xa')](function(_0x1f7cd3){logger['info'](_0x1935('0xb'),_0x513601,_0x1935('0xc'));logger[_0x1935('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x513601,_0x1935('0xc'),JSON['stringify'](_0x1f7cd3));if(_0x1f7cd3['error']){if(_0x1f7cd3[_0x1935('0xe')][_0x1935('0xf')]===0x1f4){logger[_0x1935('0xe')](_0x1935('0xb'),_0x513601,_0x1f7cd3[_0x1935('0xe')][_0x1935('0x10')]);return _0x319cc2(_0x1f7cd3[_0x1935('0xe')][_0x1935('0x10')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x513601,_0x1f7cd3[_0x1935('0xe')][_0x1935('0x10')]);return _0x521a6b(_0x1f7cd3[_0x1935('0xe')][_0x1935('0x10')]);}else{logger[_0x1935('0x11')](_0x1935('0xb'),_0x513601,_0x1935('0xc'));_0x521a6b(_0x1f7cd3[_0x1935('0x12')][_0x1935('0x10')]);}})[_0x1935('0x13')](function(_0x5ea2a0){logger['error'](_0x1935('0xb'),_0x513601,_0x5ea2a0);_0x319cc2(_0x5ea2a0);});});}exports[_0x1935('0x14')]=function(_0x5011af){var _0x1f5215=this;return new Promise(function(_0x2f90fa,_0x3109ad){return db[_0x1935('0x15')][_0x1935('0x16')](_0x5011af[_0x1935('0x17')],{'raw':_0x5011af[_0x1935('0x18')]?_0x5011af['options'][_0x1935('0x19')]===undefined?!![]:![]:!![]})[_0x1935('0xa')](function(_0x170dd1){logger[_0x1935('0x11')](_0x1935('0x14'),_0x5011af);logger[_0x1935('0xd')](_0x1935('0x14'),_0x5011af,JSON[_0x1935('0x1a')](_0x170dd1));_0x2f90fa(_0x170dd1);})[_0x1935('0x13')](function(_0x1f7ada){logger[_0x1935('0xe')](_0x1935('0x14'),_0x1f7ada[_0x1935('0x10')],_0x5011af);_0x3109ad(_0x1f5215[_0x1935('0xe')](0x1f4,_0x1f7ada[_0x1935('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 8f2ffce..7e60575 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 _0x2e4d=['mailAccounts','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts'];(function(_0x5ca2f0,_0x44a144){var _0x30a16c=function(_0x29ee59){while(--_0x29ee59){_0x5ca2f0['push'](_0x5ca2f0['shift']());}};_0x30a16c(++_0x44a144);}(_0x2e4d,0x130));var _0xd2e4=function(_0x3119f4,_0x5da3b9){_0x3119f4=_0x3119f4-0x0;var _0x21e3c5=_0x2e4d[_0x3119f4];return _0x21e3c5;};'use strict';var multer=require(_0xd2e4('0x0'));var util=require(_0xd2e4('0x1'));var path=require(_0xd2e4('0x2'));var express=require(_0xd2e4('0x3'));var router=express[_0xd2e4('0x4')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0xd2e4('0x5')](_0xd2e4('0x6'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x8')]);router[_0xd2e4('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x9')]);router[_0xd2e4('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xd2e4('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0xd2e4('0x5')]('/voice/queues',auth[_0xd2e4('0x7')](),controller[_0xd2e4('0xa')]);router[_0xd2e4('0x5')](_0xd2e4('0xb'),auth['isAuthenticated'](),controller[_0xd2e4('0xc')]);router[_0xd2e4('0x5')](_0xd2e4('0xd'),auth['isAuthenticated'](),controller[_0xd2e4('0xe')]);router['get'](_0xd2e4('0xf'),auth['isAuthenticated'](),controller[_0xd2e4('0x10')]);router['get']('/openchannel/queues',auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x11')]);router[_0xd2e4('0x5')]('/sms/queues',auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x12')]);router[_0xd2e4('0x5')](_0xd2e4('0x13'),auth['isAuthenticated'](),controller[_0xd2e4('0x14')]);router[_0xd2e4('0x5')](_0xd2e4('0x15'),auth['isAuthenticated'](),controller[_0xd2e4('0x16')]);router['get']('/voice/queues/preview/:id',auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x17')]);router[_0xd2e4('0x5')](_0xd2e4('0x18'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x19')]);router[_0xd2e4('0x5')](_0xd2e4('0x1a'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x1b')]);router['get'](_0xd2e4('0x1c'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x1d')]);router['get'](_0xd2e4('0x1e'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x1f')]);router[_0xd2e4('0x5')](_0xd2e4('0x20'),auth['isAuthenticated'](),controller[_0xd2e4('0x21')]);router[_0xd2e4('0x5')](_0xd2e4('0x22'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x23')]);router[_0xd2e4('0x5')](_0xd2e4('0x24'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0xd2e4('0x5')]('/agents',auth[_0xd2e4('0x7')](),controller['agents']);router[_0xd2e4('0x25')](_0xd2e4('0x26'),auth['isAuthenticated'](),controller[_0xd2e4('0x27')]);router[_0xd2e4('0x5')](_0xd2e4('0x28'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x29')]);router[_0xd2e4('0x5')]('/trunks',auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x2a')]);router[_0xd2e4('0x5')](_0xd2e4('0x2b'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x2c')]);router['get'](_0xd2e4('0x2d'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x2e')]);router[_0xd2e4('0x5')](_0xd2e4('0x2f'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x30')]);router['get'](_0xd2e4('0x31'),auth[_0xd2e4('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0xd2e4('0x5')]('/openchannel/queues/waitinginteractions',auth[_0xd2e4('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0xd2e4('0x5')](_0xd2e4('0x32'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x33')]);router[_0xd2e4('0x5')](_0xd2e4('0x34'),auth['isAuthenticated'](),controller[_0xd2e4('0x35')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xd2e4('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0xd2e4('0x5')]('/fax/queues/waitinginteractions',auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x36')]);router[_0xd2e4('0x37')](_0xd2e4('0x38'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x39')](_0xd2e4('0x3a')));router['get']('/mail/queues/:id',auth['isAuthenticated'](),controller[_0xd2e4('0x3b')]);router['post'](_0xd2e4('0x3c'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x39')]('chat'));router['get'](_0xd2e4('0x3d'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x3e')]);router[_0xd2e4('0x37')](_0xd2e4('0x3f'),auth['isAuthenticated'](),controller['queueNotify'](_0xd2e4('0x40')));router[_0xd2e4('0x5')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0xd2e4('0x41')]);router['post']('/openchannel/queues/:id/notify',auth[_0xd2e4('0x7')](),controller['queueNotify'](_0xd2e4('0x42')));router[_0xd2e4('0x5')](_0xd2e4('0x43'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x44')]);router[_0xd2e4('0x37')](_0xd2e4('0x45'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x39')](_0xd2e4('0x46')));router[_0xd2e4('0x37')](_0xd2e4('0x47'),auth[_0xd2e4('0x7')](),controller['queueNotify'](_0xd2e4('0x48')));router[_0xd2e4('0x5')](_0xd2e4('0x49'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x4a')]);router[_0xd2e4('0x5')](_0xd2e4('0x4b'),auth[_0xd2e4('0x7')](),controller[_0xd2e4('0x4c')]);router[_0xd2e4('0x37')](_0xd2e4('0x4d'),auth['isAuthenticated'](),controller[_0xd2e4('0x4e')]);module[_0xd2e4('0x4f')]=router; \ No newline at end of file +var _0x1b38=['Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','voiceChannelStopMixMonitor','get','/voice/queues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','outboundChannels','/agents','agents','put','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','multer','util','path','express'];(function(_0x211b19,_0x328151){var _0x149f9a=function(_0x20c238){while(--_0x20c238){_0x211b19['push'](_0x211b19['shift']());}};_0x149f9a(++_0x328151);}(_0x1b38,0x196));var _0x81b3=function(_0x27e297,_0x789346){_0x27e297=_0x27e297-0x0;var _0x2c1458=_0x1b38[_0x27e297];return _0x2c1458;};'use strict';var multer=require(_0x81b3('0x0'));var util=require(_0x81b3('0x1'));var path=require(_0x81b3('0x2'));var express=require(_0x81b3('0x3'));var router=express[_0x81b3('0x4')]();var auth=require(_0x81b3('0x5'));var controller=require(_0x81b3('0x6'));router['get'](_0x81b3('0x7'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x9')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x81b3('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x81b3('0xb')]);router[_0x81b3('0xc')](_0x81b3('0xd'),auth[_0x81b3('0x8')](),controller['voiceQueues']);router[_0x81b3('0xc')](_0x81b3('0xe'),auth['isAuthenticated'](),controller[_0x81b3('0xf')]);router[_0x81b3('0xc')]('/mail/queues',auth[_0x81b3('0x8')](),controller[_0x81b3('0x10')]);router[_0x81b3('0xc')](_0x81b3('0x11'),auth['isAuthenticated'](),controller[_0x81b3('0x12')]);router[_0x81b3('0xc')](_0x81b3('0x13'),auth[_0x81b3('0x8')](),controller['openchannelQueues']);router[_0x81b3('0xc')](_0x81b3('0x14'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x81b3('0xc')](_0x81b3('0x15'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x81b3('0xc')](_0x81b3('0x16'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x17')]);router[_0x81b3('0xc')](_0x81b3('0x18'),auth[_0x81b3('0x8')](),controller['voiceQueuesPreview']);router[_0x81b3('0xc')](_0x81b3('0x19'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x1a')]);router[_0x81b3('0xc')](_0x81b3('0x1b'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x1c')]);router[_0x81b3('0xc')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x81b3('0x8')](),controller[_0x81b3('0x1d')]);router[_0x81b3('0xc')](_0x81b3('0x1e'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x1f')]);router[_0x81b3('0xc')](_0x81b3('0x20'),auth[_0x81b3('0x8')](),controller['showVoiceQueues']);router[_0x81b3('0xc')](_0x81b3('0x21'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x22')]);router[_0x81b3('0xc')]('/outbound/channels',auth[_0x81b3('0x8')](),controller[_0x81b3('0x23')]);router[_0x81b3('0xc')](_0x81b3('0x24'),auth['isAuthenticated'](),controller[_0x81b3('0x25')]);router[_0x81b3('0x26')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x81b3('0x27')]);router[_0x81b3('0xc')](_0x81b3('0x28'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x29')]);router['get']('/trunks',auth[_0x81b3('0x8')](),controller[_0x81b3('0x2a')]);router['get'](_0x81b3('0x2b'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x2c')]);router[_0x81b3('0xc')](_0x81b3('0x2d'),auth['isAuthenticated'](),controller[_0x81b3('0x2e')]);router['get'](_0x81b3('0x2f'),auth[_0x81b3('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x81b3('0xc')](_0x81b3('0x30'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x31')]);router[_0x81b3('0xc')](_0x81b3('0x32'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x33')]);router['get'](_0x81b3('0x34'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x35')]);router[_0x81b3('0xc')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x81b3('0x36')]);router[_0x81b3('0xc')](_0x81b3('0x37'),auth['isAuthenticated'](),controller[_0x81b3('0x38')]);router['get'](_0x81b3('0x39'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x3a')]);router[_0x81b3('0x3b')](_0x81b3('0x3c'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x3d')](_0x81b3('0x3e')));router[_0x81b3('0xc')](_0x81b3('0x3f'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x40')]);router['post'](_0x81b3('0x41'),auth[_0x81b3('0x8')](),controller['queueNotify'](_0x81b3('0x42')));router[_0x81b3('0xc')](_0x81b3('0x43'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x44')]);router[_0x81b3('0x3b')]('/fax/queues/:id/notify',auth[_0x81b3('0x8')](),controller['queueNotify'](_0x81b3('0x45')));router[_0x81b3('0xc')](_0x81b3('0x46'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x47')]);router['post'](_0x81b3('0x48'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x3d')]('openchannel'));router[_0x81b3('0xc')](_0x81b3('0x49'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x4a')]);router[_0x81b3('0x3b')](_0x81b3('0x4b'),auth['isAuthenticated'](),controller['queueNotify'](_0x81b3('0x4c')));router[_0x81b3('0x3b')]('/whatsapp/queues/:id/notify',auth[_0x81b3('0x8')](),controller[_0x81b3('0x3d')](_0x81b3('0x4d')));router[_0x81b3('0xc')](_0x81b3('0x4e'),auth[_0x81b3('0x8')](),controller[_0x81b3('0x4f')]);router[_0x81b3('0xc')](_0x81b3('0x50'),auth[_0x81b3('0x8')](),controller['showWhatsappQueues']);router['post'](_0x81b3('0x51'),auth[_0x81b3('0x8')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index b97a6c1..927caa3 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 _0xf300=['agentNotify','Channel\x20field\x20is\x20mandatory','channel','chat','User','Agent\x20not\x20found','InteractionId','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','message','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','merge','params','voiceQueues','showVoiceQueues','VoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','INTERACTION','length','format','updateAttributes','findOrCreate','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','TransferReport','create','Start','*,*,*,*'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf300,0x16c));var _0x0f30=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0xf300[_0x52f159];return _0x156799;};'use strict';var BPromise=require(_0x0f30('0x0'));var moment=require(_0x0f30('0x1'));var _=require(_0x0f30('0x2'));var util=require(_0x0f30('0x3'));var db=require(_0x0f30('0x4'))['db'];var logger=require(_0x0f30('0x5'))(_0x0f30('0x6'));var jayson=require(_0x0f30('0x7'));var amiClient=jayson[_0x0f30('0x8')][_0x0f30('0x9')]({'port':0x232a});var mailClient=jayson[_0x0f30('0x8')]['http']({'port':0x232b});var routingClient=jayson[_0x0f30('0x8')][_0x0f30('0x9')]({'port':0x232c});function respondWithRpcPromise(_0xf78d18,_0x4da2d5,_0x3eab14){return new BPromise(function(_0x313ddd,_0x415491){var _0x37016a=_0x3eab14?_0x3eab14:amiClient;return _0x37016a['request'](_0xf78d18,_0x4da2d5)[_0x0f30('0xa')](function(_0x3312df){if(_0x3312df[_0x0f30('0xb')]){if(_0x3312df[_0x0f30('0xb')]['code']===0x1f4){return _0x415491(_0x3312df[_0x0f30('0xb')][_0x0f30('0xc')]);}return _0x313ddd(_0x3312df[_0x0f30('0xb')][_0x0f30('0xc')]);}else{_0x313ddd(_0x3312df['result']);}})[_0x0f30('0xd')](function(_0x1a8f65){_0x415491(_0x1a8f65);});});}function respondWithResult(_0x56ae24,_0x4862f5){_0x4862f5=_0x4862f5||0xc8;return function(_0x190399){if(_0x190399){return _0x56ae24[_0x0f30('0xe')](_0x4862f5)['json'](_0x190399);}return _0x56ae24[_0x0f30('0xf')](0x194);};}function handleError(_0x5b75e6,_0x2fc1e4){_0x2fc1e4=_0x2fc1e4||0x1f4;return function(_0x5be9a8){logger[_0x0f30('0xb')](_0x5be9a8[_0x0f30('0x10')]);if(_0x5be9a8['name']){delete _0x5be9a8[_0x0f30('0x11')];}_0x5b75e6[_0x0f30('0xe')](_0x2fc1e4)[_0x0f30('0x12')](_0x5be9a8);};}function findById(_0x1b9c2d){return function(_0x5b1020){if(!_['isNil'](_0x1b9c2d)&&!_[_0x0f30('0x13')](_0x5b1020)&&!_[_0x0f30('0x13')](_0x5b1020[_0x0f30('0x14')])){return _[_0x0f30('0x15')](_0x5b1020[_0x0f30('0x14')],function(_0x25a148){return _0x25a148['id']==_0x1b9c2d;});}return null;};}exports[_0x0f30('0x16')]=function(_0x125524,_0xb0dd60){return respondWithRpcPromise('VoiceChannels',_0x125524[_0x0f30('0x17')])[_0x0f30('0xa')](respondWithResult(_0xb0dd60,null))[_0x0f30('0xd')](handleError(_0xb0dd60,null));};exports[_0x0f30('0x18')]=function(_0x7726ec,_0x244067){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x0f30('0x19')](_0x7726ec[_0x0f30('0x17')],_0x7726ec['params']))[_0x0f30('0xa')](respondWithResult(_0x244067,null))[_0x0f30('0xd')](handleError(_0x244067,null));};exports['voiceChannelStopMixMonitor']=function(_0x51c28b,_0x2314ee){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x0f30('0x19')](_0x51c28b[_0x0f30('0x17')],_0x51c28b[_0x0f30('0x1a')]))[_0x0f30('0xa')](respondWithResult(_0x2314ee,null))[_0x0f30('0xd')](handleError(_0x2314ee,null));};exports[_0x0f30('0x1b')]=function(_0x3d3836,_0x3fa887){return respondWithRpcPromise('VoiceQueues',_0x3d3836[_0x0f30('0x17')])['then'](respondWithResult(_0x3fa887,null))[_0x0f30('0xd')](handleError(_0x3fa887,null));};exports[_0x0f30('0x1c')]=function(_0xb7821a,_0x3dcc9d){return respondWithRpcPromise(_0x0f30('0x1d'),_0xb7821a[_0x0f30('0x17')])[_0x0f30('0xa')](findById(_0xb7821a[_0x0f30('0x1a')]['id']))['then'](respondWithResult(_0x3dcc9d,null))['catch'](handleError(_0x3dcc9d,null));};exports[_0x0f30('0x1e')]=function(_0x1b3450,_0x4eb4a4){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x0f30('0x19')](_0x1b3450['query'],_0x1b3450[_0x0f30('0x1a')]))[_0x0f30('0xa')](respondWithResult(_0x4eb4a4,null))[_0x0f30('0xd')](handleError(_0x4eb4a4,null));};exports[_0x0f30('0x1f')]=function(_0x308abf,_0x36c173){return respondWithRpcPromise(_0x0f30('0x20'),_0x308abf['query'])[_0x0f30('0xa')](respondWithResult(_0x36c173,null))[_0x0f30('0xd')](handleError(_0x36c173,null));};exports['voiceQueuesChannel']=function(_0x266765,_0x5e7c7d){return respondWithRpcPromise(_0x0f30('0x21'),_[_0x0f30('0x19')](_0x266765[_0x0f30('0x17')],_0x266765[_0x0f30('0x1a')]))[_0x0f30('0xa')](respondWithResult(_0x5e7c7d,null))[_0x0f30('0xd')](handleError(_0x5e7c7d,null));};exports[_0x0f30('0x22')]=function(_0x12b8c4,_0x3d6460){return respondWithRpcPromise(_0x0f30('0x23'),_['merge'](_0x12b8c4['query'],_0x12b8c4['params']))[_0x0f30('0xa')](respondWithResult(_0x3d6460,null))[_0x0f30('0xd')](handleError(_0x3d6460,null));};exports[_0x0f30('0x24')]=function(_0x21bb2f,_0x5cbfe5){return respondWithRpcPromise(_0x0f30('0x25'),_[_0x0f30('0x19')](_0x21bb2f[_0x0f30('0x17')],_0x21bb2f[_0x0f30('0x1a')]))[_0x0f30('0xa')](respondWithResult(_0x5cbfe5,null))[_0x0f30('0xd')](handleError(_0x5cbfe5,null));};exports[_0x0f30('0x26')]=function(_0x4f7069,_0x1fd679){return respondWithRpcPromise('Outbound',_0x4f7069[_0x0f30('0x17')])[_0x0f30('0xa')](respondWithResult(_0x1fd679,null))['catch'](handleError(_0x1fd679,null));};exports[_0x0f30('0x27')]=function(_0x5a073b,_0x2c95e5){return respondWithRpcPromise(_0x0f30('0x28'),_0x5a073b[_0x0f30('0x17')])[_0x0f30('0xa')](respondWithResult(_0x2c95e5,null))[_0x0f30('0xd')](handleError(_0x2c95e5,null));};exports[_0x0f30('0x29')]=function(_0x5a1b5a,_0x2061e5){var _0x46634c;return respondWithRpcPromise(_0x0f30('0x2a'),_0x5a1b5a[_0x0f30('0x17')])[_0x0f30('0xa')](function(_0x4fc282){_0x46634c=_0x4fc282;return respondWithRpcPromise(_0x0f30('0x2a'),_0x5a1b5a['query'],routingClient);})[_0x0f30('0xa')](function(_0x4206a9){return _[_0x0f30('0x19')]({},_0x4206a9,_0x46634c);})['then'](respondWithResult(_0x2061e5,null))[_0x0f30('0xd')](handleError(_0x2061e5,null));};exports[_0x0f30('0x2b')]=function(_0x4746ad,_0x4119f1){if(_0x4746ad[_0x0f30('0x2c')]&&_0x4746ad['body'][_0x0f30('0x2d')]&&_0x4746ad[_0x0f30('0x2e')]&&_0x4746ad[_0x0f30('0x2e')][_0x0f30('0x11')]){for(var _0x5acf7b in _0x4746ad[_0x0f30('0x2c')]['interaction']){if(_0x4746ad[_0x0f30('0x2c')][_0x0f30('0x2d')]['hasOwnProperty'](_0x5acf7b)){db[_0x0f30('0x2f')]['findAll']({'where':{'channel':_0x5acf7b,'membername':_0x4746ad[_0x0f30('0x2e')]['name'],'type':_0x0f30('0x30'),'exitAt':null,'uniqueid':_0x4746ad[_0x0f30('0x2c')][_0x0f30('0x2d')][_0x5acf7b]&&_0x4746ad[_0x0f30('0x2c')][_0x0f30('0x2d')][_0x5acf7b][_0x0f30('0x31')]?{'$notIn':_0x4746ad[_0x0f30('0x2c')][_0x0f30('0x2d')][_0x5acf7b]}:{'$ne':null}}})['then'](function(_0x2ba7b8){var _0x35fc47=moment()[_0x0f30('0x32')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4b327b=0x0,_0x40b59a=_0x2ba7b8['length'];_0x4b327b<_0x40b59a;_0x4b327b+=0x1){_0x2ba7b8[_0x4b327b][_0x0f30('0x33')]({'exitAt':_0x35fc47});}});for(var _0x568a5d=0x0;_0x568a5d<_0x4746ad['body'][_0x0f30('0x2d')][_0x5acf7b][_0x0f30('0x31')];_0x568a5d+=0x1){db[_0x0f30('0x2f')][_0x0f30('0x34')]({'where':{'channel':_0x5acf7b,'membername':_0x4746ad[_0x0f30('0x2e')]['name'],'type':_0x0f30('0x30'),'uniqueid':_0x4746ad[_0x0f30('0x2c')][_0x0f30('0x2d')][_0x5acf7b][_0x568a5d],'exitAt':null},'defaults':{'channel':_0x5acf7b,'membername':_0x4746ad[_0x0f30('0x2e')]['name'],'interface':_[_0x0f30('0x13')](_0x4746ad['user'][_0x0f30('0x35')])?util[_0x0f30('0x32')](_0x0f30('0x36'),_0x4746ad[_0x0f30('0x2e')][_0x0f30('0x11')]):_0x4746ad[_0x0f30('0x2e')]['interface'],'type':_0x0f30('0x30'),'enterAt':moment()[_0x0f30('0x32')](_0x0f30('0x37')),'role':_0x0f30('0x38'),'internal':_0x4746ad[_0x0f30('0x2e')][_0x0f30('0x39')],'uniqueid':_0x4746ad[_0x0f30('0x2c')]['interaction'][_0x5acf7b][_0x568a5d]}});}}}}return respondWithRpcPromise(_0x0f30('0x3a'),{'id':_0x4746ad['params']['id'],'capacity':_0x4746ad[_0x0f30('0x2c')]['capacity']},routingClient)['then'](respondWithResult(_0x4119f1,null))['catch'](handleError(_0x4119f1,null));};exports[_0x0f30('0x3b')]=function(_0x9e59f1,_0x588c1f){return respondWithRpcPromise(_0x0f30('0x3c'),_0x9e59f1[_0x0f30('0x17')])[_0x0f30('0xa')](respondWithResult(_0x588c1f,null))[_0x0f30('0xd')](handleError(_0x588c1f,null));};exports['trunks']=function(_0x1a1c0e,_0x2dd97a){return respondWithRpcPromise(_0x0f30('0x3d'),_0x1a1c0e[_0x0f30('0x17')])[_0x0f30('0xa')](respondWithResult(_0x2dd97a,null))[_0x0f30('0xd')](handleError(_0x2dd97a,null));};exports[_0x0f30('0x3e')]=function(_0x494ecd,_0x745137){return respondWithRpcPromise(_0x0f30('0x3f'),_0x494ecd[_0x0f30('0x17')])['then'](respondWithResult(_0x745137,null))[_0x0f30('0xd')](handleError(_0x745137,null));};exports[_0x0f30('0x40')]=function(_0x51e381,_0x5cc808){return respondWithRpcPromise(_0x0f30('0x41'),_0x51e381[_0x0f30('0x17')],routingClient)[_0x0f30('0xa')](respondWithResult(_0x5cc808,null))['catch'](handleError(_0x5cc808,null));};exports[_0x0f30('0x42')]=function(_0x559e7e,_0x4fec41){return respondWithRpcPromise(_0x0f30('0x41'),_0x559e7e['query'],routingClient)[_0x0f30('0xa')](findById(_0x559e7e['params']['id']))[_0x0f30('0xa')](respondWithResult(_0x4fec41,null))[_0x0f30('0xd')](handleError(_0x4fec41,null));};exports[_0x0f30('0x43')]=function(_0x1a5a47,_0x522ed9){return respondWithRpcPromise('MailQueues',_0x1a5a47[_0x0f30('0x17')],routingClient)[_0x0f30('0xa')](respondWithResult(_0x522ed9,null))['catch'](handleError(_0x522ed9,null));};exports[_0x0f30('0x44')]=function(_0x46a032,_0x54e0e2){return respondWithRpcPromise('MailQueues',_0x46a032[_0x0f30('0x17')],routingClient)['then'](findById(_0x46a032[_0x0f30('0x1a')]['id']))[_0x0f30('0xa')](respondWithResult(_0x54e0e2,null))['catch'](handleError(_0x54e0e2,null));};exports[_0x0f30('0x45')]=function(_0x3ca917,_0x38bb2b){return respondWithRpcPromise('MailAccounts',_0x3ca917[_0x0f30('0x17')],mailClient)[_0x0f30('0xa')](respondWithResult(_0x38bb2b,null))[_0x0f30('0xd')](handleError(_0x38bb2b,null));};exports[_0x0f30('0x46')]=function(_0x28b29d,_0x39e7b8){return respondWithRpcPromise(_0x0f30('0x47'),_0x28b29d[_0x0f30('0x17')],routingClient)[_0x0f30('0xa')](respondWithResult(_0x39e7b8,null))[_0x0f30('0xd')](handleError(_0x39e7b8,null));};exports[_0x0f30('0x48')]=function(_0x32d5fc,_0x58e88f){return respondWithRpcPromise(_0x0f30('0x47'),_0x32d5fc[_0x0f30('0x17')],routingClient)[_0x0f30('0xa')](findById(_0x32d5fc['params']['id']))[_0x0f30('0xa')](respondWithResult(_0x58e88f,null))[_0x0f30('0xd')](handleError(_0x58e88f,null));};exports['smsQueues']=function(_0x15652c,_0x49b12c){return respondWithRpcPromise(_0x0f30('0x49'),_0x15652c[_0x0f30('0x17')],routingClient)[_0x0f30('0xa')](respondWithResult(_0x49b12c,null))['catch'](handleError(_0x49b12c,null));};exports[_0x0f30('0x4a')]=function(_0x4661ff,_0x4cde19){return respondWithRpcPromise('SmsQueues',_0x4661ff[_0x0f30('0x17')],routingClient)['then'](findById(_0x4661ff['params']['id']))[_0x0f30('0xa')](respondWithResult(_0x4cde19,null))[_0x0f30('0xd')](handleError(_0x4cde19,null));};exports['whatsappQueues']=function(_0x14a8cf,_0x39b88c){return respondWithRpcPromise(_0x0f30('0x4b'),_0x14a8cf[_0x0f30('0x17')],routingClient)[_0x0f30('0xa')](respondWithResult(_0x39b88c,null))[_0x0f30('0xd')](handleError(_0x39b88c,null));};exports[_0x0f30('0x4c')]=function(_0x2efedd,_0x148ca8){return respondWithRpcPromise(_0x0f30('0x4b'),_0x2efedd[_0x0f30('0x17')],routingClient)[_0x0f30('0xa')](findById(_0x2efedd['params']['id']))[_0x0f30('0xa')](respondWithResult(_0x148ca8,null))[_0x0f30('0xd')](handleError(_0x148ca8,null));};exports[_0x0f30('0x4d')]=function(_0x124470,_0x2b5724){return respondWithRpcPromise(_0x0f30('0x4e'),_0x124470[_0x0f30('0x17')],routingClient)[_0x0f30('0xa')](respondWithResult(_0x2b5724,null))[_0x0f30('0xd')](handleError(_0x2b5724,null));};exports[_0x0f30('0x4f')]=function(_0x559747,_0x1dbfad){return respondWithRpcPromise(_0x0f30('0x4e'),_0x559747[_0x0f30('0x17')],routingClient)[_0x0f30('0xa')](findById(_0x559747[_0x0f30('0x1a')]['id']))[_0x0f30('0xa')](respondWithResult(_0x1dbfad,null))['catch'](handleError(_0x1dbfad,null));};exports[_0x0f30('0x50')]=function(_0x2d37f5,_0x3243a4){return respondWithRpcPromise(_0x0f30('0x51'),_0x2d37f5[_0x0f30('0x17')])['then'](respondWithResult(_0x3243a4,null))[_0x0f30('0xd')](handleError(_0x3243a4,null));};exports[_0x0f30('0x52')]=function(_0x30faaf,_0x34da20){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x30faaf['query'],routingClient)['then'](respondWithResult(_0x34da20,null))[_0x0f30('0xd')](handleError(_0x34da20,null));};exports[_0x0f30('0x53')]=function(_0x370c82,_0x4657e1){return respondWithRpcPromise(_0x0f30('0x54'),_0x370c82[_0x0f30('0x17')],routingClient)[_0x0f30('0xa')](respondWithResult(_0x4657e1,null))[_0x0f30('0xd')](handleError(_0x4657e1,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x136b04,_0x1a9d7d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x136b04[_0x0f30('0x17')],routingClient)[_0x0f30('0xa')](respondWithResult(_0x1a9d7d,null))[_0x0f30('0xd')](handleError(_0x1a9d7d,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x258301,_0x597bf7){return respondWithRpcPromise(_0x0f30('0x55'),_0x258301[_0x0f30('0x17')],routingClient)['then'](function(_0x30e5d2){if(_0x258301['query'][_0x0f30('0x56')]!==undefined){var _0x56f280=_(_0x30e5d2[_0x0f30('0x14')])[_0x0f30('0x57')]([_0x258301['query']['type'],_0x258301['params']['id']])[_0x0f30('0x58')](_0x0f30('0x59'))[_0x0f30('0x5a')]()['value']();return _0x30e5d2[_0x0f30('0x14')][_0x0f30('0x57')](function(_0x3171fe){return _0x56f280[_0x0f30('0x5b')](_0x3171fe[_0x0f30('0x59')])>-0x1;});}else{return _0x30e5d2['rows'][_0x0f30('0x57')](function(_0xa162da){return _0xa162da[_0x0f30('0x59')]===parseInt(_0x258301[_0x0f30('0x1a')]['id']);});}})[_0x0f30('0xa')](respondWithResult(_0x597bf7,null))[_0x0f30('0xd')](handleError(_0x597bf7,null));};exports[_0x0f30('0x5c')]=function(_0x5497ba,_0x2e4bf6){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x5497ba[_0x0f30('0x17')],routingClient)[_0x0f30('0xa')](respondWithResult(_0x2e4bf6,null))['catch'](handleError(_0x2e4bf6,null));};exports[_0x0f30('0x5d')]=function(_0x10154a,_0x529db2){return respondWithRpcPromise(_0x0f30('0x5e'),_0x10154a['query'],routingClient)[_0x0f30('0xa')](respondWithResult(_0x529db2,null))['catch'](handleError(_0x529db2,null));};exports[_0x0f30('0x5f')]=function(_0x9b90e4,_0xbee020){return respondWithRpcPromise(_0x0f30('0x60'),_0x9b90e4['query'],routingClient)[_0x0f30('0xa')](respondWithResult(_0xbee020,null))[_0x0f30('0xd')](handleError(_0xbee020,null));};exports[_0x0f30('0x61')]=function(_0x4f0a5e){return function(_0x43b088,_0x2a1fac){var _0x58aec2,_0x5cf6b6;var _0x22c5c2=_[_0x0f30('0x62')](_0x4f0a5e);var _0x5959fd=_0x4f0a5e==='chat'?'Website':_0x0f30('0x63');return db[_0x22c5c2+_0x0f30('0x64')][_0x0f30('0x65')]({'raw':!![],'where':{'id':_0x43b088[_0x0f30('0x1a')]['id']}})['then'](function(_0x283f24){if(_[_0x0f30('0x13')](_0x283f24)){throw new Error(_0x22c5c2+'\x20Queue\x20not\x20found');}_0x58aec2=_0x283f24;return db[_0x22c5c2+_0x0f30('0x66')][_0x0f30('0x65')]({'where':{'id':_0x43b088[_0x0f30('0x2c')][_0x0f30('0x67')]},'include':[{'model':db[_0x22c5c2+_0x0f30('0x68')],'as':_0x0f30('0x68')},{'model':db[_0x22c5c2+_0x5959fd],'as':_0x0f30('0x63')}]});})[_0x0f30('0xa')](function(_0x36f8c4){if(_[_0x0f30('0x13')](_0x36f8c4)){throw new Error(_0x22c5c2+_0x0f30('0x69'));}_0x5cf6b6=_0x36f8c4;return _0x36f8c4['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x0f30('0xa')](function(){var _0x135cf7={'uniqueid':_0x4f0a5e+'.'+_0x5cf6b6['id']+'.'+_0x5cf6b6['Interaction']['id'],'FromUserId':_0x43b088[_0x0f30('0x2e')]['id'],'type':_0x0f30('0x6a')};_0x135cf7[_0x22c5c2+_0x0f30('0x6b')]=_0x5cf6b6['id'];_0x135cf7[_0x22c5c2+'InteractionId']=_0x5cf6b6[_0x0f30('0x68')]['id'];_0x135cf7['From'+_0x22c5c2+_0x5959fd+'Id']=_0x5cf6b6['Account']['id'];_0x135cf7['To'+_0x22c5c2+'QueueId']=_0x58aec2['id'];return db[_0x22c5c2+_0x0f30('0x6c')][_0x0f30('0x6d')](_0x135cf7);})[_0x0f30('0xa')](function(){return respondWithRpcPromise(_0x0f30('0x6e'),{'channel':_0x4f0a5e,'interaction':_0x5cf6b6[_0x0f30('0x68')],'message':_0x5cf6b6,'account':_0x5cf6b6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x58aec2[_0x0f30('0x11')]+','+(_0x5cf6b6[_0x0f30('0x63')]['queueTransferTimeout']||0x12c),'interval':_0x0f30('0x6f')}]},routingClient);})[_0x0f30('0xa')](respondWithResult(_0x2a1fac,null))[_0x0f30('0xd')](handleError(_0x2a1fac,null));};};exports[_0x0f30('0x70')]=function(_0x2dc1f9,_0x40721d){var _0x5119e8,_0x5185cc;if(_['isNil'](_0x2dc1f9[_0x0f30('0x2c')]['channel'])){throw new Error(_0x0f30('0x71'));}var _0x571cb7=_0x2dc1f9[_0x0f30('0x2c')][_0x0f30('0x72')];var _0x3b3a28=_[_0x0f30('0x62')](_0x571cb7);var _0x7eb574=_0x571cb7===_0x0f30('0x73')?'Website':_0x0f30('0x63');return db[_0x0f30('0x74')][_0x0f30('0x65')]({'raw':!![],'where':{'id':_0x2dc1f9['params']['id'],'role':'agent'}})[_0x0f30('0xa')](function(_0x40586d){if(_[_0x0f30('0x13')](_0x40586d)){throw new Error(_0x0f30('0x75'));}_0x5119e8=_0x40586d;return db[_0x3b3a28+_0x0f30('0x66')][_0x0f30('0x65')]({'where':{'id':_0x2dc1f9[_0x0f30('0x2c')]['messageId']},'include':[{'model':db[_0x3b3a28+'Interaction'],'as':_0x0f30('0x68')},{'model':db[_0x3b3a28+_0x7eb574],'as':_0x0f30('0x63')}]});})[_0x0f30('0xa')](function(_0x3a94f3){if(_[_0x0f30('0x13')](_0x3a94f3)){throw new Error(_0x3b3a28+_0x0f30('0x69'));}_0x5185cc=_0x3a94f3;return _0x3a94f3['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x34cf63={'uniqueid':_0x571cb7+'.'+_0x5185cc['id']+'.'+_0x5185cc['Interaction']['id'],'FromUserId':_0x2dc1f9['user']['id'],'type':_0x0f30('0x6a'),'ToUserId':_0x5119e8['id']};_0x34cf63[_0x3b3a28+_0x0f30('0x6b')]=_0x5185cc['id'];_0x34cf63[_0x3b3a28+_0x0f30('0x76')]=_0x5185cc[_0x0f30('0x68')]['id'];_0x34cf63['From'+_0x3b3a28+_0x7eb574+'Id']=_0x5185cc[_0x0f30('0x63')]['id'];return db[_0x3b3a28+_0x0f30('0x6c')][_0x0f30('0x6d')](_0x34cf63);})[_0x0f30('0xa')](function(){return respondWithRpcPromise(_0x0f30('0x6e'),{'channel':_0x571cb7,'interaction':_0x5185cc[_0x0f30('0x68')],'message':_0x5185cc,'account':_0x5185cc[_0x0f30('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x5119e8['name']+','+(_0x5185cc[_0x0f30('0x63')]['agentTransferTimeout']||0x12c),'interval':_0x0f30('0x6f')}]},routingClient);})[_0x0f30('0xa')](respondWithResult(_0x40721d,null))[_0x0f30('0xd')](handleError(_0x40721d,null));}; \ No newline at end of file +var _0x2ac1=['Account','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','InteractionId','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','findOne','messageId','MessageId','From','agentTransferTimeout','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','then','error','code','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','params','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','hasOwnProperty','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','findOrCreate','user','interface','format','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','Campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat'];(function(_0xd8b06a,_0x6d1486){var _0x36d4ee=function(_0x3ecddb){while(--_0x3ecddb){_0xd8b06a['push'](_0xd8b06a['shift']());}};_0x36d4ee(++_0x6d1486);}(_0x2ac1,0x93));var _0x12ac=function(_0x54c96f,_0x33b442){_0x54c96f=_0x54c96f-0x0;var _0x15eee5=_0x2ac1[_0x54c96f];return _0x15eee5;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x12ac('0x0'));var util=require(_0x12ac('0x1'));var db=require(_0x12ac('0x2'))['db'];var logger=require(_0x12ac('0x3'))('api');var jayson=require(_0x12ac('0x4'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0x12ac('0x5')][_0x12ac('0x6')]({'port':0x232b});var routingClient=jayson[_0x12ac('0x5')][_0x12ac('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x2f5a4,_0x51902c,_0x1657e3){return new BPromise(function(_0xd29fff,_0x134e28){var _0x51ac3f=_0x1657e3?_0x1657e3:amiClient;return _0x51ac3f['request'](_0x2f5a4,_0x51902c)[_0x12ac('0x7')](function(_0x3ad2b5){if(_0x3ad2b5[_0x12ac('0x8')]){if(_0x3ad2b5[_0x12ac('0x8')][_0x12ac('0x9')]===0x1f4){return _0x134e28(_0x3ad2b5[_0x12ac('0x8')]['message']);}return _0xd29fff(_0x3ad2b5[_0x12ac('0x8')]['message']);}else{_0xd29fff(_0x3ad2b5[_0x12ac('0xa')]);}})[_0x12ac('0xb')](function(_0xdbae94){_0x134e28(_0xdbae94);});});}function respondWithResult(_0x1fdde4,_0x38ea10){_0x38ea10=_0x38ea10||0xc8;return function(_0x5c6ef3){if(_0x5c6ef3){return _0x1fdde4[_0x12ac('0xc')](_0x38ea10)['json'](_0x5c6ef3);}return _0x1fdde4[_0x12ac('0xd')](0x194);};}function handleError(_0x3d3a39,_0x4f3267){_0x4f3267=_0x4f3267||0x1f4;return function(_0x12801d){logger[_0x12ac('0x8')](_0x12801d[_0x12ac('0xe')]);if(_0x12801d[_0x12ac('0xf')]){delete _0x12801d[_0x12ac('0xf')];}_0x3d3a39['status'](_0x4f3267)[_0x12ac('0x10')](_0x12801d);};}function findById(_0x21da46){return function(_0x3bdf46){if(!_[_0x12ac('0x11')](_0x21da46)&&!_['isNil'](_0x3bdf46)&&!_[_0x12ac('0x11')](_0x3bdf46[_0x12ac('0x12')])){return _[_0x12ac('0x13')](_0x3bdf46[_0x12ac('0x12')],function(_0x4b7118){return _0x4b7118['id']==_0x21da46;});}return null;};}exports['voiceChannels']=function(_0x7d8469,_0x58e36e){return respondWithRpcPromise(_0x12ac('0x14'),_0x7d8469[_0x12ac('0x15')])[_0x12ac('0x7')](respondWithResult(_0x58e36e,null))[_0x12ac('0xb')](handleError(_0x58e36e,null));};exports['voiceChannelMixMonitor']=function(_0x3c009b,_0x4eb445){return respondWithRpcPromise(_0x12ac('0x16'),_['merge'](_0x3c009b[_0x12ac('0x15')],_0x3c009b['params']))[_0x12ac('0x7')](respondWithResult(_0x4eb445,null))[_0x12ac('0xb')](handleError(_0x4eb445,null));};exports[_0x12ac('0x17')]=function(_0x29c767,_0xc4b7b1){return respondWithRpcPromise(_0x12ac('0x18'),_[_0x12ac('0x19')](_0x29c767[_0x12ac('0x15')],_0x29c767[_0x12ac('0x1a')]))[_0x12ac('0x7')](respondWithResult(_0xc4b7b1,null))['catch'](handleError(_0xc4b7b1,null));};exports[_0x12ac('0x1b')]=function(_0xeecd2e,_0x387b3f){return respondWithRpcPromise(_0x12ac('0x1c'),_0xeecd2e[_0x12ac('0x15')])[_0x12ac('0x7')](respondWithResult(_0x387b3f,null))[_0x12ac('0xb')](handleError(_0x387b3f,null));};exports[_0x12ac('0x1d')]=function(_0x6b4698,_0x440b91){return respondWithRpcPromise(_0x12ac('0x1c'),_0x6b4698[_0x12ac('0x15')])[_0x12ac('0x7')](findById(_0x6b4698[_0x12ac('0x1a')]['id']))[_0x12ac('0x7')](respondWithResult(_0x440b91,null))[_0x12ac('0xb')](handleError(_0x440b91,null));};exports['voiceQueuesPreview']=function(_0x361729,_0x1207ea){return respondWithRpcPromise(_0x12ac('0x1e'),_[_0x12ac('0x19')](_0x361729[_0x12ac('0x15')],_0x361729[_0x12ac('0x1a')]))[_0x12ac('0x7')](respondWithResult(_0x1207ea,null))[_0x12ac('0xb')](handleError(_0x1207ea,null));};exports[_0x12ac('0x1f')]=function(_0x4a9aca,_0x316717){return respondWithRpcPromise(_0x12ac('0x20'),_0x4a9aca[_0x12ac('0x15')])['then'](respondWithResult(_0x316717,null))[_0x12ac('0xb')](handleError(_0x316717,null));};exports[_0x12ac('0x21')]=function(_0x3fa9b3,_0x2546ea){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x3fa9b3[_0x12ac('0x15')],_0x3fa9b3[_0x12ac('0x1a')]))[_0x12ac('0x7')](respondWithResult(_0x2546ea,null))[_0x12ac('0xb')](handleError(_0x2546ea,null));};exports[_0x12ac('0x22')]=function(_0x1f3aee,_0xc16f8c){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x12ac('0x19')](_0x1f3aee[_0x12ac('0x15')],_0x1f3aee[_0x12ac('0x1a')]))[_0x12ac('0x7')](respondWithResult(_0xc16f8c,null))[_0x12ac('0xb')](handleError(_0xc16f8c,null));};exports[_0x12ac('0x23')]=function(_0x11f66e,_0x21ad38){return respondWithRpcPromise(_0x12ac('0x24'),_['merge'](_0x11f66e[_0x12ac('0x15')],_0x11f66e[_0x12ac('0x1a')]))[_0x12ac('0x7')](respondWithResult(_0x21ad38,null))[_0x12ac('0xb')](handleError(_0x21ad38,null));};exports['outbound']=function(_0x606918,_0xa36b06){return respondWithRpcPromise(_0x12ac('0x25'),_0x606918['query'])[_0x12ac('0x7')](respondWithResult(_0xa36b06,null))[_0x12ac('0xb')](handleError(_0xa36b06,null));};exports[_0x12ac('0x26')]=function(_0xa0da60,_0x4bb807){return respondWithRpcPromise(_0x12ac('0x27'),_0xa0da60['query'])[_0x12ac('0x7')](respondWithResult(_0x4bb807,null))[_0x12ac('0xb')](handleError(_0x4bb807,null));};exports[_0x12ac('0x28')]=function(_0x4a31d3,_0xb95da7){var _0xec4858;return respondWithRpcPromise('Agents',_0x4a31d3[_0x12ac('0x15')])[_0x12ac('0x7')](function(_0x5dc376){_0xec4858=_0x5dc376;return respondWithRpcPromise(_0x12ac('0x29'),_0x4a31d3[_0x12ac('0x15')],routingClient);})[_0x12ac('0x7')](function(_0x8003b){return _[_0x12ac('0x19')]({},_0x8003b,_0xec4858);})[_0x12ac('0x7')](respondWithResult(_0xb95da7,null))['catch'](handleError(_0xb95da7,null));};exports[_0x12ac('0x2a')]=function(_0x2ee422,_0x1427a2){if(_0x2ee422[_0x12ac('0x2b')]&&_0x2ee422['body'][_0x12ac('0x2c')]&&_0x2ee422['user']&&_0x2ee422['user'][_0x12ac('0xf')]){for(var _0x1ddb1d in _0x2ee422[_0x12ac('0x2b')]['interaction']){if(_0x2ee422[_0x12ac('0x2b')][_0x12ac('0x2c')][_0x12ac('0x2d')](_0x1ddb1d)){db['MemberReport'][_0x12ac('0x2e')]({'where':{'channel':_0x1ddb1d,'membername':_0x2ee422['user'][_0x12ac('0xf')],'type':_0x12ac('0x2f'),'exitAt':null,'uniqueid':_0x2ee422['body'][_0x12ac('0x2c')][_0x1ddb1d]&&_0x2ee422[_0x12ac('0x2b')][_0x12ac('0x2c')][_0x1ddb1d][_0x12ac('0x30')]?{'$notIn':_0x2ee422[_0x12ac('0x2b')][_0x12ac('0x2c')][_0x1ddb1d]}:{'$ne':null}}})[_0x12ac('0x7')](function(_0x143d20){var _0x31e9d0=moment()['format'](_0x12ac('0x31'));for(var _0x222a1c=0x0,_0x4cd86f=_0x143d20[_0x12ac('0x30')];_0x222a1c<_0x4cd86f;_0x222a1c+=0x1){_0x143d20[_0x222a1c][_0x12ac('0x32')]({'exitAt':_0x31e9d0});}});for(var _0x12c69b=0x0;_0x12c69b<_0x2ee422[_0x12ac('0x2b')][_0x12ac('0x2c')][_0x1ddb1d][_0x12ac('0x30')];_0x12c69b+=0x1){db[_0x12ac('0x33')][_0x12ac('0x34')]({'where':{'channel':_0x1ddb1d,'membername':_0x2ee422[_0x12ac('0x35')][_0x12ac('0xf')],'type':_0x12ac('0x2f'),'uniqueid':_0x2ee422[_0x12ac('0x2b')][_0x12ac('0x2c')][_0x1ddb1d][_0x12c69b],'exitAt':null},'defaults':{'channel':_0x1ddb1d,'membername':_0x2ee422[_0x12ac('0x35')][_0x12ac('0xf')],'interface':_['isNil'](_0x2ee422[_0x12ac('0x35')][_0x12ac('0x36')])?util[_0x12ac('0x37')]('SIP/%s',_0x2ee422[_0x12ac('0x35')][_0x12ac('0xf')]):_0x2ee422[_0x12ac('0x35')]['interface'],'type':_0x12ac('0x2f'),'enterAt':moment()[_0x12ac('0x37')](_0x12ac('0x31')),'role':_0x12ac('0x38'),'internal':_0x2ee422['user'][_0x12ac('0x39')],'uniqueid':_0x2ee422[_0x12ac('0x2b')][_0x12ac('0x2c')][_0x1ddb1d][_0x12c69b]}});}}}}return respondWithRpcPromise(_0x12ac('0x3a'),{'id':_0x2ee422[_0x12ac('0x1a')]['id'],'capacity':_0x2ee422[_0x12ac('0x2b')]['capacity']},routingClient)['then'](respondWithResult(_0x1427a2,null))['catch'](handleError(_0x1427a2,null));};exports[_0x12ac('0x3b')]=function(_0x1ba3c6,_0x228710){return respondWithRpcPromise(_0x12ac('0x3c'),_0x1ba3c6['query'])[_0x12ac('0x7')](respondWithResult(_0x228710,null))['catch'](handleError(_0x228710,null));};exports['trunks']=function(_0x26ec7f,_0x501c8c){return respondWithRpcPromise(_0x12ac('0x3d'),_0x26ec7f[_0x12ac('0x15')])['then'](respondWithResult(_0x501c8c,null))['catch'](handleError(_0x501c8c,null));};exports[_0x12ac('0x3e')]=function(_0x3e9545,_0x1d6562){return respondWithRpcPromise(_0x12ac('0x3f'),_0x3e9545['query'])[_0x12ac('0x7')](respondWithResult(_0x1d6562,null))[_0x12ac('0xb')](handleError(_0x1d6562,null));};exports['chatQueues']=function(_0x12cff3,_0x13449f){return respondWithRpcPromise('ChatQueues',_0x12cff3[_0x12ac('0x15')],routingClient)['then'](respondWithResult(_0x13449f,null))[_0x12ac('0xb')](handleError(_0x13449f,null));};exports[_0x12ac('0x40')]=function(_0x1f16d8,_0x50c02a){return respondWithRpcPromise(_0x12ac('0x41'),_0x1f16d8[_0x12ac('0x15')],routingClient)[_0x12ac('0x7')](findById(_0x1f16d8[_0x12ac('0x1a')]['id']))[_0x12ac('0x7')](respondWithResult(_0x50c02a,null))[_0x12ac('0xb')](handleError(_0x50c02a,null));};exports['mailQueues']=function(_0x559e92,_0x4d6311){return respondWithRpcPromise(_0x12ac('0x42'),_0x559e92[_0x12ac('0x15')],routingClient)[_0x12ac('0x7')](respondWithResult(_0x4d6311,null))[_0x12ac('0xb')](handleError(_0x4d6311,null));};exports[_0x12ac('0x43')]=function(_0x5a6e77,_0x5731fc){return respondWithRpcPromise(_0x12ac('0x42'),_0x5a6e77['query'],routingClient)[_0x12ac('0x7')](findById(_0x5a6e77[_0x12ac('0x1a')]['id']))[_0x12ac('0x7')](respondWithResult(_0x5731fc,null))[_0x12ac('0xb')](handleError(_0x5731fc,null));};exports[_0x12ac('0x44')]=function(_0x11eb14,_0x46f9b8){return respondWithRpcPromise(_0x12ac('0x45'),_0x11eb14['query'],mailClient)[_0x12ac('0x7')](respondWithResult(_0x46f9b8,null))[_0x12ac('0xb')](handleError(_0x46f9b8,null));};exports[_0x12ac('0x46')]=function(_0x15b9e2,_0xb50f01){return respondWithRpcPromise(_0x12ac('0x47'),_0x15b9e2[_0x12ac('0x15')],routingClient)[_0x12ac('0x7')](respondWithResult(_0xb50f01,null))[_0x12ac('0xb')](handleError(_0xb50f01,null));};exports[_0x12ac('0x48')]=function(_0x2814ee,_0x1949f4){return respondWithRpcPromise(_0x12ac('0x47'),_0x2814ee['query'],routingClient)[_0x12ac('0x7')](findById(_0x2814ee[_0x12ac('0x1a')]['id']))['then'](respondWithResult(_0x1949f4,null))[_0x12ac('0xb')](handleError(_0x1949f4,null));};exports[_0x12ac('0x49')]=function(_0x5781ce,_0x416503){return respondWithRpcPromise(_0x12ac('0x4a'),_0x5781ce[_0x12ac('0x15')],routingClient)[_0x12ac('0x7')](respondWithResult(_0x416503,null))[_0x12ac('0xb')](handleError(_0x416503,null));};exports[_0x12ac('0x4b')]=function(_0x1a1fa2,_0x5ee95e){return respondWithRpcPromise('SmsQueues',_0x1a1fa2[_0x12ac('0x15')],routingClient)['then'](findById(_0x1a1fa2['params']['id']))['then'](respondWithResult(_0x5ee95e,null))[_0x12ac('0xb')](handleError(_0x5ee95e,null));};exports['whatsappQueues']=function(_0x2d087c,_0x4fab33){return respondWithRpcPromise(_0x12ac('0x4c'),_0x2d087c[_0x12ac('0x15')],routingClient)[_0x12ac('0x7')](respondWithResult(_0x4fab33,null))[_0x12ac('0xb')](handleError(_0x4fab33,null));};exports[_0x12ac('0x4d')]=function(_0x1e4b97,_0x3c6f05){return respondWithRpcPromise(_0x12ac('0x4c'),_0x1e4b97[_0x12ac('0x15')],routingClient)[_0x12ac('0x7')](findById(_0x1e4b97[_0x12ac('0x1a')]['id']))[_0x12ac('0x7')](respondWithResult(_0x3c6f05,null))[_0x12ac('0xb')](handleError(_0x3c6f05,null));};exports[_0x12ac('0x4e')]=function(_0x5c34d6,_0x2fc24c){return respondWithRpcPromise('FaxQueues',_0x5c34d6[_0x12ac('0x15')],routingClient)[_0x12ac('0x7')](respondWithResult(_0x2fc24c,null))[_0x12ac('0xb')](handleError(_0x2fc24c,null));};exports[_0x12ac('0x4f')]=function(_0x24f1f4,_0x394646){return respondWithRpcPromise(_0x12ac('0x50'),_0x24f1f4[_0x12ac('0x15')],routingClient)[_0x12ac('0x7')](findById(_0x24f1f4[_0x12ac('0x1a')]['id']))[_0x12ac('0x7')](respondWithResult(_0x394646,null))[_0x12ac('0xb')](handleError(_0x394646,null));};exports['faxAccounts']=function(_0x1e3f0a,_0x3aba6c){return respondWithRpcPromise(_0x12ac('0x51'),_0x1e3f0a[_0x12ac('0x15')])[_0x12ac('0x7')](respondWithResult(_0x3aba6c,null))[_0x12ac('0xb')](handleError(_0x3aba6c,null));};exports[_0x12ac('0x52')]=function(_0xa98353,_0x247c32){return respondWithRpcPromise(_0x12ac('0x53'),_0xa98353['query'],routingClient)[_0x12ac('0x7')](respondWithResult(_0x247c32,null))['catch'](handleError(_0x247c32,null));};exports[_0x12ac('0x54')]=function(_0x199b54,_0x531b07){return respondWithRpcPromise(_0x12ac('0x55'),_0x199b54[_0x12ac('0x15')],routingClient)[_0x12ac('0x7')](respondWithResult(_0x531b07,null))[_0x12ac('0xb')](handleError(_0x531b07,null));};exports[_0x12ac('0x56')]=function(_0x538347,_0x54d40a){return respondWithRpcPromise(_0x12ac('0x57'),_0x538347['query'],routingClient)[_0x12ac('0x7')](respondWithResult(_0x54d40a,null))['catch'](handleError(_0x54d40a,null));};exports[_0x12ac('0x58')]=function(_0x4493c1,_0x1ead00){return respondWithRpcPromise(_0x12ac('0x57'),_0x4493c1[_0x12ac('0x15')],routingClient)[_0x12ac('0x7')](function(_0x170672){if(_0x4493c1[_0x12ac('0x15')][_0x12ac('0x59')]!==undefined){var _0xbff61=_(_0x170672[_0x12ac('0x12')])[_0x12ac('0x5a')]([_0x4493c1[_0x12ac('0x15')][_0x12ac('0x59')],_0x4493c1[_0x12ac('0x1a')]['id']])['map'](_0x12ac('0x5b'))['uniq']()['value']();return _0x170672[_0x12ac('0x12')][_0x12ac('0x5a')](function(_0xe66185){return _0xbff61[_0x12ac('0x5c')](_0xe66185[_0x12ac('0x5b')])>-0x1;});}else{return _0x170672[_0x12ac('0x12')][_0x12ac('0x5a')](function(_0xd2c55a){return _0xd2c55a[_0x12ac('0x5b')]===parseInt(_0x4493c1[_0x12ac('0x1a')]['id']);});}})['then'](respondWithResult(_0x1ead00,null))[_0x12ac('0xb')](handleError(_0x1ead00,null));};exports[_0x12ac('0x5d')]=function(_0x297325,_0x1dc2b0){return respondWithRpcPromise(_0x12ac('0x5e'),_0x297325['query'],routingClient)[_0x12ac('0x7')](respondWithResult(_0x1dc2b0,null))['catch'](handleError(_0x1dc2b0,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x1fcc25,_0x561039){return respondWithRpcPromise(_0x12ac('0x5f'),_0x1fcc25['query'],routingClient)[_0x12ac('0x7')](respondWithResult(_0x561039,null))[_0x12ac('0xb')](handleError(_0x561039,null));};exports['faxQueuesWaitingInteractions']=function(_0x4c0b42,_0x4fb014){return respondWithRpcPromise(_0x12ac('0x60'),_0x4c0b42['query'],routingClient)[_0x12ac('0x7')](respondWithResult(_0x4fb014,null))['catch'](handleError(_0x4fb014,null));};exports['queueNotify']=function(_0x62d4ec){return function(_0x4af96c,_0x5ad5b6){var _0x3dad8b,_0xb19a37;var _0x1f0e41=_[_0x12ac('0x61')](_0x62d4ec);var _0x53bc3d=_0x62d4ec===_0x12ac('0x62')?'Website':_0x12ac('0x63');return db[_0x1f0e41+'Queue']['findOne']({'raw':!![],'where':{'id':_0x4af96c['params']['id']}})['then'](function(_0x3eabca){if(_[_0x12ac('0x11')](_0x3eabca)){throw new Error(_0x1f0e41+_0x12ac('0x64'));}_0x3dad8b=_0x3eabca;return db[_0x1f0e41+_0x12ac('0x65')]['findOne']({'where':{'id':_0x4af96c['body']['messageId']},'include':[{'model':db[_0x1f0e41+'Interaction'],'as':_0x12ac('0x66')},{'model':db[_0x1f0e41+_0x53bc3d],'as':'Account'}]});})[_0x12ac('0x7')](function(_0xbd2aef){if(_['isNil'](_0xbd2aef)){throw new Error(_0x1f0e41+_0x12ac('0x67'));}_0xb19a37=_0xbd2aef;return _0xbd2aef[_0x12ac('0x68')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1164cc={'uniqueid':_0x62d4ec+'.'+_0xb19a37['id']+'.'+_0xb19a37[_0x12ac('0x66')]['id'],'FromUserId':_0x4af96c['user']['id'],'type':'queue'};_0x1164cc[_0x1f0e41+'MessageId']=_0xb19a37['id'];_0x1164cc[_0x1f0e41+_0x12ac('0x69')]=_0xb19a37[_0x12ac('0x66')]['id'];_0x1164cc['From'+_0x1f0e41+_0x53bc3d+'Id']=_0xb19a37['Account']['id'];_0x1164cc['To'+_0x1f0e41+_0x12ac('0x6a')]=_0x3dad8b['id'];return db[_0x1f0e41+_0x12ac('0x6b')][_0x12ac('0x6c')](_0x1164cc);})[_0x12ac('0x7')](function(){return respondWithRpcPromise(_0x12ac('0x6d'),{'channel':_0x62d4ec,'interaction':_0xb19a37['Interaction'],'message':_0xb19a37,'account':_0xb19a37['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x12ac('0x6e'),'appdata':_0x3dad8b[_0x12ac('0xf')]+','+(_0xb19a37[_0x12ac('0x63')][_0x12ac('0x6f')]||0x12c),'interval':_0x12ac('0x70')}]},routingClient);})[_0x12ac('0x7')](respondWithResult(_0x5ad5b6,null))['catch'](handleError(_0x5ad5b6,null));};};exports[_0x12ac('0x71')]=function(_0x33e298,_0x48c856){var _0x30aa2b,_0x34c340;if(_[_0x12ac('0x11')](_0x33e298['body'][_0x12ac('0x72')])){throw new Error(_0x12ac('0x73'));}var _0x18e193=_0x33e298[_0x12ac('0x2b')][_0x12ac('0x72')];var _0xc86403=_[_0x12ac('0x61')](_0x18e193);var _0x248fb2=_0x18e193===_0x12ac('0x62')?_0x12ac('0x74'):_0x12ac('0x63');return db[_0x12ac('0x75')]['findOne']({'raw':!![],'where':{'id':_0x33e298[_0x12ac('0x1a')]['id'],'role':'agent'}})[_0x12ac('0x7')](function(_0x2adfb5){if(_['isNil'](_0x2adfb5)){throw new Error('Agent\x20not\x20found');}_0x30aa2b=_0x2adfb5;return db[_0xc86403+_0x12ac('0x65')][_0x12ac('0x76')]({'where':{'id':_0x33e298[_0x12ac('0x2b')][_0x12ac('0x77')]},'include':[{'model':db[_0xc86403+'Interaction'],'as':_0x12ac('0x66')},{'model':db[_0xc86403+_0x248fb2],'as':'Account'}]});})[_0x12ac('0x7')](function(_0x3bf8ce){if(_['isNil'](_0x3bf8ce)){throw new Error(_0xc86403+_0x12ac('0x67'));}_0x34c340=_0x3bf8ce;return _0x3bf8ce[_0x12ac('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x12ac('0x7')](function(){var _0x364d51={'uniqueid':_0x18e193+'.'+_0x34c340['id']+'.'+_0x34c340[_0x12ac('0x66')]['id'],'FromUserId':_0x33e298[_0x12ac('0x35')]['id'],'type':_0x12ac('0x6e'),'ToUserId':_0x30aa2b['id']};_0x364d51[_0xc86403+_0x12ac('0x78')]=_0x34c340['id'];_0x364d51[_0xc86403+'InteractionId']=_0x34c340[_0x12ac('0x66')]['id'];_0x364d51[_0x12ac('0x79')+_0xc86403+_0x248fb2+'Id']=_0x34c340['Account']['id'];return db[_0xc86403+_0x12ac('0x6b')][_0x12ac('0x6c')](_0x364d51);})['then'](function(){return respondWithRpcPromise(_0x12ac('0x6d'),{'channel':_0x18e193,'interaction':_0x34c340[_0x12ac('0x66')],'message':_0x34c340,'account':_0x34c340[_0x12ac('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x30aa2b['name']+','+(_0x34c340[_0x12ac('0x63')][_0x12ac('0x7a')]||0x12c),'interval':_0x12ac('0x70')}]},routingClient);})['then'](respondWithResult(_0x48c856,null))[_0x12ac('0xb')](handleError(_0x48c856,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 64f190e..59c7483 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 _0x4203=['../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post','create','put','update','destroy','exports','multer','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4203,0x19f));var _0x3420=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x4203[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x3420('0x0'));var util=require(_0x3420('0x1'));var path=require(_0x3420('0x2'));var timeout=require('connect-timeout');var express=require(_0x3420('0x3'));var router=express[_0x3420('0x4')]();var auth=require(_0x3420('0x5'));var interaction=require(_0x3420('0x6'));var config=require(_0x3420('0x7'));var controller=require(_0x3420('0x8'));router[_0x3420('0x9')]('/',auth[_0x3420('0xa')](),controller[_0x3420('0xb')]);router[_0x3420('0x9')](_0x3420('0xc'),auth[_0x3420('0xa')](),controller['show']);router[_0x3420('0x9')](_0x3420('0xd'),auth[_0x3420('0xa')](),controller[_0x3420('0xe')]);router[_0x3420('0xf')]('/',auth[_0x3420('0xa')](),controller[_0x3420('0x10')]);router[_0x3420('0x11')](_0x3420('0xc'),auth['isAuthenticated'](),controller[_0x3420('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3420('0x13')]);module[_0x3420('0x14')]=router; \ No newline at end of file +var _0x8105=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./schedule.controller','index','get','/:id','isAuthenticated','show','/:id/run','post','update'];(function(_0x238303,_0x1867df){var _0x404156=function(_0x4a611f){while(--_0x4a611f){_0x238303['push'](_0x238303['shift']());}};_0x404156(++_0x1867df);}(_0x8105,0x16c));var _0x5810=function(_0x5af5e5,_0x2965e9){_0x5af5e5=_0x5af5e5-0x0;var _0x4e60ae=_0x8105[_0x5af5e5];return _0x4e60ae;};'use strict';var multer=require(_0x5810('0x0'));var util=require(_0x5810('0x1'));var path=require(_0x5810('0x2'));var timeout=require(_0x5810('0x3'));var express=require(_0x5810('0x4'));var router=express[_0x5810('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5810('0x6'));var config=require('../../config/environment');var controller=require(_0x5810('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5810('0x8')]);router[_0x5810('0x9')](_0x5810('0xa'),auth[_0x5810('0xb')](),controller[_0x5810('0xc')]);router[_0x5810('0x9')](_0x5810('0xd'),auth['isAuthenticated'](),controller['run']);router[_0x5810('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5810('0xa'),auth[_0x5810('0xb')](),controller[_0x5810('0xf')]);router[_0x5810('0x10')](_0x5810('0xa'),auth[_0x5810('0xb')](),controller[_0x5810('0x11')]);module[_0x5810('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 27c9c1e..84d58d3 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 _0x6c7b=['TEXT','sequelize','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months','weeks','hours','minutes','days','csv','pdf','xlsx','default','custom','STRING'];(function(_0x374870,_0x82a474){var _0x4de8f4=function(_0xc42b7){while(--_0xc42b7){_0x374870['push'](_0x374870['shift']());}};_0x4de8f4(++_0x82a474);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x3ecd80,_0x4f26f1){_0x3ecd80=_0x3ecd80-0x0;var _0x2904b2=_0x6c7b[_0x3ecd80];return _0x2904b2;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xb6c7('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb6c7('0x2')},'startAt':{'type':Sequelize[_0xb6c7('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb6c7('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb6c7('0x4')](_0xb6c7('0x5'),_0xb6c7('0x6'),_0xb6c7('0x7'),_0xb6c7('0x8'),'days',_0xb6c7('0x9'),_0xb6c7('0xa')),'allowNull':![],'defaultValue':_0xb6c7('0xb')},'output':{'type':Sequelize[_0xb6c7('0x4')](_0xb6c7('0xc'),_0xb6c7('0xd'),_0xb6c7('0xe')),'allowNull':![],'defaultValue':_0xb6c7('0xc')},'type':{'type':Sequelize['ENUM']('custom',_0xb6c7('0xf')),'allowNull':![],'defaultValue':_0xb6c7('0x10')},'sendMail':{'type':Sequelize[_0xb6c7('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xb6c7('0x11')]},'cc':{'type':Sequelize[_0xb6c7('0x12')]},'bcc':{'type':Sequelize[_0xb6c7('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xb6c7('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd663=['sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','weeks','minutes','days','ENUM','csv','pdf','xlsx','custom','default','TEXT'];(function(_0x6ca507,_0xaa08b8){var _0xc0b426=function(_0x313888){while(--_0x313888){_0x6ca507['push'](_0x6ca507['shift']());}};_0xc0b426(++_0xaa08b8);}(_0xd663,0x1ed));var _0x3d66=function(_0x1c7057,_0xab2108){_0x1c7057=_0x1c7057-0x0;var _0x133a25=_0xd663[_0x1c7057];return _0x133a25;};'use strict';var Sequelize=require(_0x3d66('0x0'));module[_0x3d66('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3d66('0x2')]},'active':{'type':Sequelize[_0x3d66('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3d66('0x2')],'allowNull':![],'defaultValue':_0x3d66('0x4')},'startAt':{'type':Sequelize[_0x3d66('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x3d66('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years','quarters','months',_0x3d66('0x7'),'days','hours',_0x3d66('0x8')),'allowNull':![],'defaultValue':_0x3d66('0x9')},'output':{'type':Sequelize[_0x3d66('0xa')](_0x3d66('0xb'),_0x3d66('0xc'),_0x3d66('0xd')),'allowNull':![],'defaultValue':_0x3d66('0xb')},'type':{'type':Sequelize['ENUM'](_0x3d66('0xe'),_0x3d66('0xf')),'allowNull':![],'defaultValue':_0x3d66('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x3d66('0x2')]},'cc':{'type':Sequelize[_0x3d66('0x10')]},'bcc':{'type':Sequelize[_0x3d66('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 8b6e6cc..df23a5e 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 _0x1d56=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','name','send','index','map','Schedule','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','html-pdf','eml-format','zip-dir'];(function(_0x1a14e3,_0x3afb9e){var _0x7533a6=function(_0x3430d3){while(--_0x3430d3){_0x1a14e3['push'](_0x1a14e3['shift']());}};_0x7533a6(++_0x3afb9e);}(_0x1d56,0x19c));var _0x61d5=function(_0x3da2c0,_0x625e3f){_0x3da2c0=_0x3da2c0-0x0;var _0x370054=_0x1d56[_0x3da2c0];return _0x370054;};'use strict';var pdf=require(_0x61d5('0x0'));var emlformat=require(_0x61d5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x61d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x61d5('0x3'));var moment=require(_0x61d5('0x4'));var BPromise=require(_0x61d5('0x5'));var Mustache=require(_0x61d5('0x6'));var util=require(_0x61d5('0x7'));var path=require(_0x61d5('0x8'));var sox=require(_0x61d5('0x9'));var csv=require(_0x61d5('0xa'));var ejs=require(_0x61d5('0xb'));var fs=require('fs');var _=require(_0x61d5('0xc'));var squel=require(_0x61d5('0xd'));var crypto=require(_0x61d5('0xe'));var jsforce=require(_0x61d5('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x61d5('0x10'));var Papa=require(_0x61d5('0x11'));var Redis=require(_0x61d5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x61d5('0x13'));var as=require(_0x61d5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x61d5('0x15'));var utils=require(_0x61d5('0x16'));var config=require(_0x61d5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x61d5('0x18'))['db'];function respondWithStatusCode(_0x59cbc4,_0x3da9d8){_0x3da9d8=_0x3da9d8||0xcc;return function(_0x561ce6){if(_0x561ce6){return _0x59cbc4['sendStatus'](_0x3da9d8);}return _0x59cbc4['status'](_0x3da9d8)[_0x61d5('0x19')]();};}function respondWithResult(_0x587eb6,_0x2e2ba6){_0x2e2ba6=_0x2e2ba6||0xc8;return function(_0x5caf62){if(_0x5caf62){return _0x587eb6[_0x61d5('0x1a')](_0x2e2ba6)['json'](_0x5caf62);}};}function respondWithFilteredResult(_0x267944,_0x5b2023){return function(_0x2ad76e){if(_0x2ad76e){var _0x2fe186=_0x2ad76e[_0x61d5('0x1b')],_0x56f846=_0x5b2023['offset'],_0x356986=_0x5b2023[_0x61d5('0x1c')]+_0x5b2023[_0x61d5('0x1d')],_0x59710f;if(_0x356986>=_0x2fe186){_0x356986=_0x2fe186;_0x59710f=0xc8;}else{_0x59710f=0xce;}_0x267944[_0x61d5('0x1a')](_0x59710f);return _0x267944[_0x61d5('0x1e')](_0x61d5('0x1f'),_0x56f846+'-'+_0x356986+'/'+_0x2fe186)['json'](_0x2ad76e);}return null;};}function patchUpdates(_0x5ee6ca){return function(_0x2eac5b){try{jsonpatch[_0x61d5('0x20')](_0x2eac5b,_0x5ee6ca,!![]);}catch(_0x58cec4){return BPromise[_0x61d5('0x21')](_0x58cec4);}return _0x2eac5b[_0x61d5('0x22')]();};}function saveUpdates(_0x52dfdf,_0x1e9c75){return function(_0x547fca){if(_0x547fca){return _0x547fca[_0x61d5('0x23')](_0x52dfdf)[_0x61d5('0x24')](function(_0x3f9ded){return _0x3f9ded;});}return null;};}function removeEntity(_0x46dc70,_0x1f1ca0){return function(_0x43dde0){if(_0x43dde0){return _0x43dde0[_0x61d5('0x25')]()['then'](function(){var _0x5274ff=_0x43dde0[_0x61d5('0x26')]({'plain':!![]});var _0xb4106e='Scheduler';return db['UserProfileResource'][_0x61d5('0x25')]({'where':{'type':_0xb4106e,'resourceId':_0x5274ff['id']}})[_0x61d5('0x24')](function(){return _0x43dde0;});})[_0x61d5('0x24')](function(){_0x46dc70[_0x61d5('0x1a')](0xcc)[_0x61d5('0x19')]();});}};}function handleEntityNotFound(_0x5d2c02,_0x3bbf3e){return function(_0x490825){if(!_0x490825){_0x5d2c02[_0x61d5('0x27')](0x194);}return _0x490825;};}function handleError(_0x2d1482,_0x292cfa){_0x292cfa=_0x292cfa||0x1f4;return function(_0x2387ae){logger['error'](_0x2387ae['stack']);if(_0x2387ae[_0x61d5('0x28')]){delete _0x2387ae[_0x61d5('0x28')];}_0x2d1482[_0x61d5('0x1a')](_0x292cfa)[_0x61d5('0x29')](_0x2387ae);};}exports[_0x61d5('0x2a')]=function(_0x5521f7,_0x2c8c78){var _0x5ca4ce={},_0x37a0dd={},_0x16f725={'count':0x0,'rows':[]};var _0x1af2be=_[_0x61d5('0x2b')](db[_0x61d5('0x2c')]['rawAttributes'],function(_0x2339fe){return{'name':_0x2339fe[_0x61d5('0x2d')],'type':_0x2339fe[_0x61d5('0x2e')][_0x61d5('0x2f')]};});_0x37a0dd[_0x61d5('0x30')]=_['map'](_0x1af2be,_0x61d5('0x28'));_0x37a0dd[_0x61d5('0x31')]=_[_0x61d5('0x32')](_0x5521f7[_0x61d5('0x31')]);_0x37a0dd[_0x61d5('0x33')]=_[_0x61d5('0x34')](_0x37a0dd['model'],_0x37a0dd[_0x61d5('0x31')]);_0x5ca4ce[_0x61d5('0x35')]=_[_0x61d5('0x34')](_0x37a0dd[_0x61d5('0x30')],qs['fields'](_0x5521f7[_0x61d5('0x31')]['fields']));_0x5ca4ce[_0x61d5('0x35')]=_0x5ca4ce[_0x61d5('0x35')][_0x61d5('0x36')]?_0x5ca4ce[_0x61d5('0x35')]:_0x37a0dd['model'];if(!_0x5521f7[_0x61d5('0x31')]['hasOwnProperty'](_0x61d5('0x37'))){_0x5ca4ce[_0x61d5('0x1d')]=qs['limit'](_0x5521f7[_0x61d5('0x31')][_0x61d5('0x1d')]);_0x5ca4ce[_0x61d5('0x1c')]=qs[_0x61d5('0x1c')](_0x5521f7[_0x61d5('0x31')][_0x61d5('0x1c')]);}_0x5ca4ce['order']=qs[_0x61d5('0x38')](_0x5521f7[_0x61d5('0x31')][_0x61d5('0x38')]);_0x5ca4ce[_0x61d5('0x39')]=qs[_0x61d5('0x33')](_[_0x61d5('0x3a')](_0x5521f7['query'],_0x37a0dd[_0x61d5('0x33')]),_0x1af2be);if(_0x5521f7[_0x61d5('0x31')][_0x61d5('0x3b')]){_0x5ca4ce[_0x61d5('0x39')]=_[_0x61d5('0x3c')](_0x5ca4ce['where'],{'$or':_[_0x61d5('0x2b')](_0x1af2be,function(_0x10f2e9){if(_0x10f2e9[_0x61d5('0x2e')]!==_0x61d5('0x3d')){var _0x5ecfa7={};_0x5ecfa7[_0x10f2e9[_0x61d5('0x28')]]={'$like':'%'+_0x5521f7['query']['filter']+'%'};return _0x5ecfa7;}})});}_0x5ca4ce=_['merge']({},_0x5ca4ce,_0x5521f7[_0x61d5('0x3e')]);var _0x3cb86e={'where':_0x5ca4ce[_0x61d5('0x39')]};return db[_0x61d5('0x2c')]['count'](_0x3cb86e)[_0x61d5('0x24')](function(_0x575c7e){_0x16f725[_0x61d5('0x1b')]=_0x575c7e;if(_0x5521f7['query'][_0x61d5('0x3f')]){_0x5ca4ce[_0x61d5('0x40')]=[{'all':!![]}];}return db[_0x61d5('0x2c')][_0x61d5('0x41')](_0x5ca4ce);})[_0x61d5('0x24')](function(_0x1163b0){_0x16f725[_0x61d5('0x42')]=_0x1163b0;return _0x16f725;})[_0x61d5('0x24')](respondWithFilteredResult(_0x2c8c78,_0x5ca4ce))['catch'](handleError(_0x2c8c78,null));};exports[_0x61d5('0x43')]=function(_0x1cf575,_0x3aff2f){var _0x3f6a10={'raw':![],'where':{'id':_0x1cf575[_0x61d5('0x44')]['id']}},_0x37fc5e={};_0x37fc5e[_0x61d5('0x30')]=_[_0x61d5('0x32')](db[_0x61d5('0x2c')][_0x61d5('0x45')]);_0x37fc5e[_0x61d5('0x31')]=_[_0x61d5('0x32')](_0x1cf575[_0x61d5('0x31')]);_0x37fc5e[_0x61d5('0x33')]=_[_0x61d5('0x34')](_0x37fc5e[_0x61d5('0x30')],_0x37fc5e[_0x61d5('0x31')]);_0x3f6a10[_0x61d5('0x35')]=_['intersection'](_0x37fc5e[_0x61d5('0x30')],qs['fields'](_0x1cf575['query']['fields']));_0x3f6a10[_0x61d5('0x35')]=_0x3f6a10[_0x61d5('0x35')]['length']?_0x3f6a10[_0x61d5('0x35')]:_0x37fc5e[_0x61d5('0x30')];if(_0x1cf575[_0x61d5('0x31')][_0x61d5('0x3f')]){_0x3f6a10['include']=[{'all':!![]}];}_0x3f6a10=_[_0x61d5('0x3c')]({},_0x3f6a10,_0x1cf575[_0x61d5('0x3e')]);return db[_0x61d5('0x2c')][_0x61d5('0x46')](_0x3f6a10)[_0x61d5('0x24')](handleEntityNotFound(_0x3aff2f,null))[_0x61d5('0x24')](respondWithResult(_0x3aff2f,null))[_0x61d5('0x47')](handleError(_0x3aff2f,null));};exports[_0x61d5('0x48')]=function(_0x3c10a4,_0x2b12bd){return db[_0x61d5('0x2c')][_0x61d5('0x48')](_0x3c10a4[_0x61d5('0x49')],{})[_0x61d5('0x24')](function(_0x54132c){var _0x187c4c=_0x3c10a4[_0x61d5('0x4a')][_0x61d5('0x26')]({'plain':!![]});if(!_0x187c4c)throw new Error(_0x61d5('0x4b'));if(_0x187c4c[_0x61d5('0x4c')]==='user'){var _0x288a50=_0x54132c[_0x61d5('0x26')]({'plain':!![]});var _0xd4dc11=_0x61d5('0x4d');return db['UserProfileSection']['find']({'where':{'name':_0xd4dc11,'userProfileId':_0x187c4c[_0x61d5('0x4e')]},'raw':!![]})[_0x61d5('0x24')](function(_0x251dd5){if(_0x251dd5&&_0x251dd5[_0x61d5('0x4f')]===0x0){return db['UserProfileResource'][_0x61d5('0x48')]({'name':_0x288a50[_0x61d5('0x28')],'resourceId':_0x288a50['id'],'type':_0x251dd5[_0x61d5('0x28')],'sectionId':_0x251dd5['id']},{})[_0x61d5('0x24')](function(){return _0x54132c;});}else{return _0x54132c;}})[_0x61d5('0x47')](function(_0x2be30c){logger[_0x61d5('0x50')](_0x61d5('0x51'),_0x2be30c);throw _0x2be30c;});}return _0x54132c;})[_0x61d5('0x24')](respondWithResult(_0x2b12bd,0xc9))[_0x61d5('0x47')](handleError(_0x2b12bd,null));};exports[_0x61d5('0x23')]=function(_0x5bb61e,_0x2a49c3){if(_0x5bb61e[_0x61d5('0x49')]['id']){delete _0x5bb61e[_0x61d5('0x49')]['id'];}return db['Schedule']['find']({'where':{'id':_0x5bb61e[_0x61d5('0x44')]['id']}})[_0x61d5('0x24')](handleEntityNotFound(_0x2a49c3,null))[_0x61d5('0x24')](saveUpdates(_0x5bb61e[_0x61d5('0x49')],null))['then'](respondWithResult(_0x2a49c3,null))[_0x61d5('0x47')](handleError(_0x2a49c3,null));};exports[_0x61d5('0x25')]=function(_0x2affdb,_0x1e5e56){return db[_0x61d5('0x2c')][_0x61d5('0x46')]({'where':{'id':_0x2affdb['params']['id']}})[_0x61d5('0x24')](handleEntityNotFound(_0x1e5e56,null))[_0x61d5('0x24')](removeEntity(_0x1e5e56,null))[_0x61d5('0x47')](handleError(_0x1e5e56,null));};exports['run']=function(_0xcd3a,_0x1674a5,_0x45fb1a){var _0x52933e=require(_0x61d5('0x52'));return db[_0x61d5('0x2c')][_0x61d5('0x46')]({'where':{'id':_0xcd3a['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1674a5,null))[_0x61d5('0x24')](function(){_0x52933e['run'](_0xcd3a[_0x61d5('0x44')]['id']);})[_0x61d5('0x24')](respondWithStatusCode(_0x1674a5,null))['catch'](handleError(_0x1674a5,null));}; \ No newline at end of file +var _0x7823=['then','error','stack','name','map','Schedule','type','key','model','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','count','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','get','Scheduler','destroy'];(function(_0x29f869,_0x125c89){var _0x336ea7=function(_0x1df0cc){while(--_0x1df0cc){_0x29f869['push'](_0x29f869['shift']());}};_0x336ea7(++_0x125c89);}(_0x7823,0xc8));var _0x3782=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7823[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x3782('0x0'));var emlformat=require(_0x3782('0x1'));var rimraf=require(_0x3782('0x2'));var zipdir=require(_0x3782('0x3'));var jsonpatch=require(_0x3782('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3782('0x5'));var Mustache=require(_0x3782('0x6'));var util=require('util');var path=require(_0x3782('0x7'));var sox=require(_0x3782('0x8'));var csv=require(_0x3782('0x9'));var ejs=require(_0x3782('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3782('0xb'));var jsforce=require(_0x3782('0xc'));var deskjs=require(_0x3782('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3782('0xe'));var Papa=require('papaparse');var Redis=require(_0x3782('0xf'));var authService=require(_0x3782('0x10'));var qs=require(_0x3782('0x11'));var as=require(_0x3782('0x12'));var hardwareService=require(_0x3782('0x13'));var logger=require(_0x3782('0x14'))(_0x3782('0x15'));var utils=require(_0x3782('0x16'));var config=require(_0x3782('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3782('0x18'))['db'];function respondWithStatusCode(_0x11ca4f,_0x138286){_0x138286=_0x138286||0xcc;return function(_0x2aafd1){if(_0x2aafd1){return _0x11ca4f[_0x3782('0x19')](_0x138286);}return _0x11ca4f[_0x3782('0x1a')](_0x138286)['end']();};}function respondWithResult(_0x4b5fd1,_0x4608ce){_0x4608ce=_0x4608ce||0xc8;return function(_0x569004){if(_0x569004){return _0x4b5fd1[_0x3782('0x1a')](_0x4608ce)[_0x3782('0x1b')](_0x569004);}};}function respondWithFilteredResult(_0x3bc3e3,_0x4f61e9){return function(_0x4e1d8e){if(_0x4e1d8e){var _0x5cf565=_0x4e1d8e['count'],_0x115995=_0x4f61e9[_0x3782('0x1c')],_0x53fd1d=_0x4f61e9[_0x3782('0x1c')]+_0x4f61e9[_0x3782('0x1d')],_0x1d042a;if(_0x53fd1d>=_0x5cf565){_0x53fd1d=_0x5cf565;_0x1d042a=0xc8;}else{_0x1d042a=0xce;}_0x3bc3e3[_0x3782('0x1a')](_0x1d042a);return _0x3bc3e3[_0x3782('0x1e')](_0x3782('0x1f'),_0x115995+'-'+_0x53fd1d+'/'+_0x5cf565)[_0x3782('0x1b')](_0x4e1d8e);}return null;};}function patchUpdates(_0xfd3b26){return function(_0x5aeb81){try{jsonpatch['apply'](_0x5aeb81,_0xfd3b26,!![]);}catch(_0x2c670a){return BPromise[_0x3782('0x20')](_0x2c670a);}return _0x5aeb81[_0x3782('0x21')]();};}function saveUpdates(_0x5a7a57,_0xba27dc){return function(_0x1a28ff){if(_0x1a28ff){return _0x1a28ff['update'](_0x5a7a57)['then'](function(_0x32eddf){return _0x32eddf;});}return null;};}function removeEntity(_0x55f94a,_0x2463ee){return function(_0x3f7cd9){if(_0x3f7cd9){return _0x3f7cd9['destroy']()['then'](function(){var _0x4df330=_0x3f7cd9[_0x3782('0x22')]({'plain':!![]});var _0x2a77c4=_0x3782('0x23');return db['UserProfileResource'][_0x3782('0x24')]({'where':{'type':_0x2a77c4,'resourceId':_0x4df330['id']}})['then'](function(){return _0x3f7cd9;});})[_0x3782('0x25')](function(){_0x55f94a[_0x3782('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54967f,_0x4a8014){return function(_0x3b6761){if(!_0x3b6761){_0x54967f['sendStatus'](0x194);}return _0x3b6761;};}function handleError(_0x4972f7,_0x5c2517){_0x5c2517=_0x5c2517||0x1f4;return function(_0x3bfe45){logger[_0x3782('0x26')](_0x3bfe45[_0x3782('0x27')]);if(_0x3bfe45['name']){delete _0x3bfe45[_0x3782('0x28')];}_0x4972f7[_0x3782('0x1a')](_0x5c2517)['send'](_0x3bfe45);};}exports['index']=function(_0x4f8dda,_0x3e3ab3){var _0x18a6b3={},_0x378749={},_0x3d1a29={'count':0x0,'rows':[]};var _0x5ae21=_[_0x3782('0x29')](db[_0x3782('0x2a')]['rawAttributes'],function(_0x5c942d){return{'name':_0x5c942d['fieldName'],'type':_0x5c942d[_0x3782('0x2b')][_0x3782('0x2c')]};});_0x378749[_0x3782('0x2d')]=_[_0x3782('0x29')](_0x5ae21,'name');_0x378749[_0x3782('0x2e')]=_['keys'](_0x4f8dda[_0x3782('0x2e')]);_0x378749['filters']=_[_0x3782('0x2f')](_0x378749['model'],_0x378749[_0x3782('0x2e')]);_0x18a6b3[_0x3782('0x30')]=_[_0x3782('0x2f')](_0x378749[_0x3782('0x2d')],qs[_0x3782('0x31')](_0x4f8dda['query']['fields']));_0x18a6b3[_0x3782('0x30')]=_0x18a6b3['attributes']['length']?_0x18a6b3[_0x3782('0x30')]:_0x378749['model'];if(!_0x4f8dda[_0x3782('0x2e')][_0x3782('0x32')]('nolimit')){_0x18a6b3[_0x3782('0x1d')]=qs[_0x3782('0x1d')](_0x4f8dda[_0x3782('0x2e')]['limit']);_0x18a6b3[_0x3782('0x1c')]=qs['offset'](_0x4f8dda[_0x3782('0x2e')]['offset']);}_0x18a6b3['order']=qs['sort'](_0x4f8dda['query'][_0x3782('0x33')]);_0x18a6b3[_0x3782('0x34')]=qs[_0x3782('0x35')](_[_0x3782('0x36')](_0x4f8dda[_0x3782('0x2e')],_0x378749[_0x3782('0x35')]),_0x5ae21);if(_0x4f8dda[_0x3782('0x2e')][_0x3782('0x37')]){_0x18a6b3[_0x3782('0x34')]=_['merge'](_0x18a6b3[_0x3782('0x34')],{'$or':_[_0x3782('0x29')](_0x5ae21,function(_0x5e4e28){if(_0x5e4e28[_0x3782('0x2b')]!==_0x3782('0x38')){var _0x4f296f={};_0x4f296f[_0x5e4e28[_0x3782('0x28')]]={'$like':'%'+_0x4f8dda['query'][_0x3782('0x37')]+'%'};return _0x4f296f;}})});}_0x18a6b3=_[_0x3782('0x39')]({},_0x18a6b3,_0x4f8dda['options']);var _0x56ab3b={'where':_0x18a6b3[_0x3782('0x34')]};return db[_0x3782('0x2a')][_0x3782('0x3a')](_0x56ab3b)[_0x3782('0x25')](function(_0x203d81){_0x3d1a29[_0x3782('0x3a')]=_0x203d81;if(_0x4f8dda[_0x3782('0x2e')][_0x3782('0x3b')]){_0x18a6b3[_0x3782('0x3c')]=[{'all':!![]}];}return db[_0x3782('0x2a')][_0x3782('0x3d')](_0x18a6b3);})[_0x3782('0x25')](function(_0x10c08d){_0x3d1a29['rows']=_0x10c08d;return _0x3d1a29;})[_0x3782('0x25')](respondWithFilteredResult(_0x3e3ab3,_0x18a6b3))[_0x3782('0x3e')](handleError(_0x3e3ab3,null));};exports[_0x3782('0x3f')]=function(_0x3e02b2,_0x1ee52d){var _0x144142={'raw':![],'where':{'id':_0x3e02b2[_0x3782('0x40')]['id']}},_0x4cb527={};_0x4cb527[_0x3782('0x2d')]=_[_0x3782('0x41')](db[_0x3782('0x2a')][_0x3782('0x42')]);_0x4cb527[_0x3782('0x2e')]=_['keys'](_0x3e02b2[_0x3782('0x2e')]);_0x4cb527[_0x3782('0x35')]=_[_0x3782('0x2f')](_0x4cb527[_0x3782('0x2d')],_0x4cb527[_0x3782('0x2e')]);_0x144142[_0x3782('0x30')]=_[_0x3782('0x2f')](_0x4cb527[_0x3782('0x2d')],qs[_0x3782('0x31')](_0x3e02b2[_0x3782('0x2e')]['fields']));_0x144142[_0x3782('0x30')]=_0x144142[_0x3782('0x30')][_0x3782('0x43')]?_0x144142[_0x3782('0x30')]:_0x4cb527[_0x3782('0x2d')];if(_0x3e02b2[_0x3782('0x2e')][_0x3782('0x3b')]){_0x144142['include']=[{'all':!![]}];}_0x144142=_[_0x3782('0x39')]({},_0x144142,_0x3e02b2['options']);return db[_0x3782('0x2a')][_0x3782('0x44')](_0x144142)[_0x3782('0x25')](handleEntityNotFound(_0x1ee52d,null))[_0x3782('0x25')](respondWithResult(_0x1ee52d,null))['catch'](handleError(_0x1ee52d,null));};exports['create']=function(_0xb2a809,_0x27b3de){return db[_0x3782('0x2a')][_0x3782('0x45')](_0xb2a809['body'],{})[_0x3782('0x25')](function(_0x26bfbb){var _0x111490=_0xb2a809['user']['get']({'plain':!![]});if(!_0x111490)throw new Error(_0x3782('0x46'));if(_0x111490['role']===_0x3782('0x47')){var _0xc102ae=_0x26bfbb['get']({'plain':!![]});var _0x2f8fd2=_0x3782('0x23');return db[_0x3782('0x48')]['find']({'where':{'name':_0x2f8fd2,'userProfileId':_0x111490[_0x3782('0x49')]},'raw':!![]})[_0x3782('0x25')](function(_0x40a516){if(_0x40a516&&_0x40a516[_0x3782('0x4a')]===0x0){return db[_0x3782('0x4b')]['create']({'name':_0xc102ae[_0x3782('0x28')],'resourceId':_0xc102ae['id'],'type':_0x40a516['name'],'sectionId':_0x40a516['id']},{})['then'](function(){return _0x26bfbb;});}else{return _0x26bfbb;}})[_0x3782('0x3e')](function(_0x5b1800){logger['error'](_0x3782('0x4c'),_0x5b1800);throw _0x5b1800;});}return _0x26bfbb;})[_0x3782('0x25')](respondWithResult(_0x27b3de,0xc9))['catch'](handleError(_0x27b3de,null));};exports['update']=function(_0x3ba034,_0x5000d1){if(_0x3ba034[_0x3782('0x4d')]['id']){delete _0x3ba034[_0x3782('0x4d')]['id'];}return db[_0x3782('0x2a')][_0x3782('0x44')]({'where':{'id':_0x3ba034['params']['id']}})[_0x3782('0x25')](handleEntityNotFound(_0x5000d1,null))[_0x3782('0x25')](saveUpdates(_0x3ba034[_0x3782('0x4d')],null))[_0x3782('0x25')](respondWithResult(_0x5000d1,null))[_0x3782('0x3e')](handleError(_0x5000d1,null));};exports['destroy']=function(_0x2845d9,_0x11a684){return db[_0x3782('0x2a')][_0x3782('0x44')]({'where':{'id':_0x2845d9['params']['id']}})[_0x3782('0x25')](handleEntityNotFound(_0x11a684,null))[_0x3782('0x25')](removeEntity(_0x11a684,null))[_0x3782('0x3e')](handleError(_0x11a684,null));};exports[_0x3782('0x4e')]=function(_0x1f5d36,_0x402995,_0x3b1d09){var _0x1394cc=require('../../config/schedule');return db[_0x3782('0x2a')][_0x3782('0x44')]({'where':{'id':_0x1f5d36[_0x3782('0x40')]['id']},'raw':!![]})[_0x3782('0x25')](handleEntityNotFound(_0x402995,null))[_0x3782('0x25')](function(){_0x1394cc[_0x3782('0x4e')](_0x1f5d36[_0x3782('0x40')]['id']);})[_0x3782('0x25')](respondWithStatusCode(_0x402995,null))[_0x3782('0x3e')](handleError(_0x402995,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index f8a283b..a278aaf 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 _0xb203=['api','bluebird','path','rimraf','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb203,0x81));var _0x3b20=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb203[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x3b20('0x0'));var util=require(_0x3b20('0x1'));var logger=require(_0x3b20('0x2'))(_0x3b20('0x3'));var moment=require('moment');var BPromise=require(_0x3b20('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b20('0x5'));var rimraf=require(_0x3b20('0x6'));var config=require('../../config/environment');var attributes=require(_0x3b20('0x7'));module[_0x3b20('0x8')]=function(_0x2c0cec,_0x30a925){return _0x2c0cec[_0x3b20('0x9')](_0x3b20('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda0e=['../../config/logger','api','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','define','Schedule','tools_schedules','util'];(function(_0x2f040f,_0x28e7a0){var _0xb8787=function(_0x5a2e4c){while(--_0x5a2e4c){_0x2f040f['push'](_0x2f040f['shift']());}};_0xb8787(++_0x28e7a0);}(_0xda0e,0x167));var _0xeda0=function(_0x3295aa,_0x3c0f1b){_0x3295aa=_0x3295aa-0x0;var _0x528565=_0xda0e[_0x3295aa];return _0x528565;};'use strict';var _=require('lodash');var util=require(_0xeda0('0x0'));var logger=require(_0xeda0('0x1'))(_0xeda0('0x2'));var moment=require('moment');var BPromise=require(_0xeda0('0x3'));var rp=require(_0xeda0('0x4'));var fs=require('fs');var path=require(_0xeda0('0x5'));var rimraf=require(_0xeda0('0x6'));var config=require('../../config/environment');var attributes=require(_0xeda0('0x7'));module[_0xeda0('0x8')]=function(_0x3b32e6,_0x1e0de4){return _0x3b32e6[_0xeda0('0x9')](_0xeda0('0xa'),attributes,{'tableName':_0xeda0('0xb'),'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 bbaa381..fe28dda 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 _0x9f67=['../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x356c93,_0x1eceb6){var _0x252a86=function(_0x36e3ff){while(--_0x36e3ff){_0x356c93['push'](_0x356c93['shift']());}};_0x252a86(++_0x1eceb6);}(_0x9f67,0x10e));var _0x79f6=function(_0x387235,_0x17a5db){_0x387235=_0x387235-0x0;var _0x10c23e=_0x9f67[_0x387235];return _0x10c23e;};'use strict';var _=require(_0x79f6('0x0'));var util=require(_0x79f6('0x1'));var moment=require(_0x79f6('0x2'));var BPromise=require(_0x79f6('0x3'));var rs=require(_0x79f6('0x4'));var fs=require('fs');var Redis=require(_0x79f6('0x5'));var db=require(_0x79f6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x79f6('0x7'));var config=require(_0x79f6('0x8'));var jayson=require(_0x79f6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46ccd3,_0xbf7932,_0x4d2a93){return new BPromise(function(_0x424b11,_0x31b4e6){return client[_0x79f6('0xa')](_0x46ccd3,_0x4d2a93)[_0x79f6('0xb')](function(_0x1f6c8e){logger['info'](_0x79f6('0xc'),_0xbf7932,_0x79f6('0xd'));logger[_0x79f6('0xe')](_0x79f6('0xf'),_0xbf7932,_0x79f6('0xd'),JSON[_0x79f6('0x10')](_0x1f6c8e));if(_0x1f6c8e['error']){if(_0x1f6c8e['error'][_0x79f6('0x11')]===0x1f4){logger[_0x79f6('0x12')](_0x79f6('0xc'),_0xbf7932,_0x1f6c8e[_0x79f6('0x12')][_0x79f6('0x13')]);return _0x31b4e6(_0x1f6c8e['error'][_0x79f6('0x13')]);}logger[_0x79f6('0x12')](_0x79f6('0xc'),_0xbf7932,_0x1f6c8e['error'][_0x79f6('0x13')]);return _0x424b11(_0x1f6c8e['error'][_0x79f6('0x13')]);}else{logger[_0x79f6('0x14')](_0x79f6('0xc'),_0xbf7932,_0x79f6('0xd'));_0x424b11(_0x1f6c8e[_0x79f6('0x15')][_0x79f6('0x13')]);}})[_0x79f6('0x16')](function(_0x19ff9d){logger[_0x79f6('0x12')](_0x79f6('0xc'),_0xbf7932,_0x19ff9d);_0x31b4e6(_0x19ff9d);});});} \ No newline at end of file +var _0x299e=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x48063e,_0x3d9aac){var _0x303d56=function(_0x253d04){while(--_0x253d04){_0x48063e['push'](_0x48063e['shift']());}};_0x303d56(++_0x3d9aac);}(_0x299e,0x18c));var _0xe299=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x299e[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xe299('0x0'));var util=require(_0xe299('0x1'));var moment=require(_0xe299('0x2'));var BPromise=require(_0xe299('0x3'));var rs=require(_0xe299('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe299('0x5'));var logger=require(_0xe299('0x6'))(_0xe299('0x7'));var config=require(_0xe299('0x8'));var jayson=require(_0xe299('0x9'));var client=jayson[_0xe299('0xa')][_0xe299('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2baf09,_0x2f00be,_0xd8d33b){return new BPromise(function(_0x462305,_0x2e344f){return client[_0xe299('0xc')](_0x2baf09,_0xd8d33b)['then'](function(_0x47dcda){logger[_0xe299('0xd')](_0xe299('0xe'),_0x2f00be,'request\x20sent');logger['debug'](_0xe299('0xf'),_0x2f00be,_0xe299('0x10'),JSON[_0xe299('0x11')](_0x47dcda));if(_0x47dcda[_0xe299('0x12')]){if(_0x47dcda['error']['code']===0x1f4){logger['error'](_0xe299('0xe'),_0x2f00be,_0x47dcda['error'][_0xe299('0x13')]);return _0x2e344f(_0x47dcda[_0xe299('0x12')][_0xe299('0x13')]);}logger[_0xe299('0x12')](_0xe299('0xe'),_0x2f00be,_0x47dcda[_0xe299('0x12')]['message']);return _0x462305(_0x47dcda[_0xe299('0x12')][_0xe299('0x13')]);}else{logger['info'](_0xe299('0xe'),_0x2f00be,_0xe299('0x10'));_0x462305(_0x47dcda[_0xe299('0x14')][_0xe299('0x13')]);}})[_0xe299('0x15')](function(_0x284f11){logger[_0xe299('0x12')]('Schedule,\x20%s,\x20%s',_0x2f00be,_0x284f11);_0x2e344f(_0x284f11);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 4ec503c..c123e35 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 _0xbc3e=['../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/download','put','/:id','update','delete','destroy','util','path'];(function(_0x261f1a,_0x462ff2){var _0x57920d=function(_0x544169){while(--_0x544169){_0x261f1a['push'](_0x261f1a['shift']());}};_0x57920d(++_0x462ff2);}(_0xbc3e,0xa3));var _0xebc3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xbc3e[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require(_0xebc3('0x0'));var path=require(_0xebc3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xebc3('0x2'));var controller=require('./screenRecording.controller');router[_0xebc3('0x3')]('/',auth[_0xebc3('0x4')](),controller[_0xebc3('0x5')]);router[_0xebc3('0x3')](_0xebc3('0x6'),auth[_0xebc3('0x4')](),controller[_0xebc3('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xebc3('0x8')]);router[_0xebc3('0x3')](_0xebc3('0x9'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xebc3('0xa')](_0xebc3('0xb'),auth[_0xebc3('0x4')](),controller[_0xebc3('0xc')]);router[_0xebc3('0xd')](_0xebc3('0xb'),auth[_0xebc3('0x4')](),controller[_0xebc3('0xe')]);module['exports']=router; \ No newline at end of file +var _0x530b=['isAuthenticated','/describe','describe','get','/:id','show','/:id/download','download','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x5499ab,_0x4c1128){var _0x344478=function(_0x5d767e){while(--_0x5d767e){_0x5499ab['push'](_0x5499ab['shift']());}};_0x344478(++_0x4c1128);}(_0x530b,0x183));var _0xb530=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x530b[_0x1a89a1];return _0x3d5b46;};'use strict';var multer=require(_0xb530('0x0'));var util=require(_0xb530('0x1'));var path=require(_0xb530('0x2'));var timeout=require(_0xb530('0x3'));var express=require('express');var router=express[_0xb530('0x4')]();var auth=require(_0xb530('0x5'));var interaction=require(_0xb530('0x6'));var config=require(_0xb530('0x7'));var controller=require(_0xb530('0x8'));router['get']('/',auth[_0xb530('0x9')](),controller['index']);router['get'](_0xb530('0xa'),auth[_0xb530('0x9')](),controller[_0xb530('0xb')]);router[_0xb530('0xc')](_0xb530('0xd'),auth[_0xb530('0x9')](),controller[_0xb530('0xe')]);router['get'](_0xb530('0xf'),auth[_0xb530('0x9')](),controller[_0xb530('0x10')]);router[_0xb530('0x11')]('/',auth[_0xb530('0x9')](),controller['create']);router[_0xb530('0x12')](_0xb530('0xd'),auth[_0xb530('0x9')](),controller[_0xb530('0x13')]);router['delete'](_0xb530('0xd'),auth[_0xb530('0x9')](),controller[_0xb530('0x14')]);module[_0xb530('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7fcc028..f498e70 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 _0x7217=['value','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7217,0x19e));var _0x7721=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7217[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x7721('0x0'));var moment=require('moment');var path=require(_0x7721('0x1'));var config=require(_0x7721('0x2'));module[_0x7721('0x3')]={'format':{'type':Sequelize[_0x7721('0x4')],'get':function(){return this[_0x7721('0x5')]('value')?path['extname'](this[_0x7721('0x5')](_0x7721('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x7721('0x7')]},'channel':{'type':Sequelize[_0x7721('0x7')]},'value':{'type':Sequelize[_0x7721('0x7')],'set':function(_0xf7ff37){var _0x18ab6b=_0xf7ff37[_0x7721('0x8')](/\\/g,'/');this[_0x7721('0x9')](_0x7721('0x6'),_0x18ab6b);}},'rating':{'type':Sequelize[_0x7721('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7721('0xa')],'set':function(_0xfa8835){this[_0x7721('0x9')](_0x7721('0xb'),moment()['subtract'](_0xfa8835,'ms'));this[_0x7721('0x9')](_0x7721('0xc'),moment());this[_0x7721('0x9')](_0x7721('0xd'),_0xfa8835);}},'startedAt':{'type':Sequelize[_0x7721('0xe')],'get':function(){return moment(this[_0x7721('0x5')](_0x7721('0xb')))[_0x7721('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x7721('0x10')]();}},'closedAt':{'type':Sequelize[_0x7721('0xe')],'get':function(){return moment(this['getDataValue'](_0x7721('0xc')))[_0x7721('0xf')](_0x7721('0x11'))[_0x7721('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7721('0x5')](_0x7721('0x12')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x7721('0xe')],'get':function(){return moment(this[_0x7721('0x5')](_0x7721('0x13')))[_0x7721('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x7721('0x10')]();}}}; \ No newline at end of file +var _0x33c5=['path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','moment'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x33c5,0xe6));var _0x533c=function(_0x5b6a86,_0x59489c){_0x5b6a86=_0x5b6a86-0x0;var _0x425888=_0x33c5[_0x5b6a86];return _0x425888;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var config=require('../../config/environment');module[_0x533c('0x2')]={'format':{'type':Sequelize[_0x533c('0x3')],'get':function(){return this[_0x533c('0x4')](_0x533c('0x5'))?path[_0x533c('0x6')](this['getDataValue'](_0x533c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x533c('0x7')]},'channel':{'type':Sequelize[_0x533c('0x7')]},'value':{'type':Sequelize[_0x533c('0x7')],'set':function(_0x34ca89){var _0x1699d5=_0x34ca89[_0x533c('0x8')](/\\/g,'/');this[_0x533c('0x9')](_0x533c('0x5'),_0x1699d5);}},'rating':{'type':Sequelize[_0x533c('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x533c('0xa')],'set':function(_0x46536d){this[_0x533c('0x9')](_0x533c('0xb'),moment()[_0x533c('0xc')](_0x46536d,'ms'));this[_0x533c('0x9')]('closedAt',moment());this[_0x533c('0x9')](_0x533c('0xd'),_0x46536d);}},'startedAt':{'type':Sequelize[_0x533c('0xe')],'get':function(){return moment(this[_0x533c('0x4')](_0x533c('0xb')))[_0x533c('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x533c('0x10')]();}},'closedAt':{'type':Sequelize[_0x533c('0xe')],'get':function(){return moment(this[_0x533c('0x4')](_0x533c('0x11')))[_0x533c('0xf')](_0x533c('0x12'))[_0x533c('0x10')]();}},'createdAt':{'type':Sequelize[_0x533c('0xe')],'get':function(){return moment(this['getDataValue'](_0x533c('0x13')))[_0x533c('0xf')](_0x533c('0x12'))[_0x533c('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x533c('0x4')](_0x533c('0x14')))[_0x533c('0xf')](_0x533c('0x12'))[_0x533c('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 779bede..e5331a4 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 _0xcbf6=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','name','index','map','ScreenRecording','rawAttributes','fieldName','key','model','differenceBy','format','keys','filters','intersection','attributes','query','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','params','fields','find','create','body','createdAt','value','describe','download','../../components/encryptor','type','uniqueid','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','join','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','destroy','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x55b515,_0x943071){var _0x419b21=function(_0x2d4d8a){while(--_0x2d4d8a){_0x55b515['push'](_0x55b515['shift']());}};_0x419b21(++_0x943071);}(_0xcbf6,0xc0));var _0x6cbf=function(_0x3de99a,_0x20140b){_0x3de99a=_0x3de99a-0x0;var _0x3d9667=_0xcbf6[_0x3de99a];return _0x3d9667;};'use strict';var pdf=require(_0x6cbf('0x0'));var emlformat=require(_0x6cbf('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6cbf('0x2'));var BPromise=require(_0x6cbf('0x3'));var Mustache=require(_0x6cbf('0x4'));var util=require(_0x6cbf('0x5'));var path=require(_0x6cbf('0x6'));var sox=require(_0x6cbf('0x7'));var csv=require(_0x6cbf('0x8'));var ejs=require(_0x6cbf('0x9'));var fs=require('fs');var _=require(_0x6cbf('0xa'));var squel=require(_0x6cbf('0xb'));var crypto=require(_0x6cbf('0xc'));var jsforce=require(_0x6cbf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6cbf('0x8'));var querystring=require(_0x6cbf('0xe'));var Papa=require(_0x6cbf('0xf'));var Redis=require(_0x6cbf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6cbf('0x11'));var as=require(_0x6cbf('0x12'));var hardwareService=require(_0x6cbf('0x13'));var logger=require(_0x6cbf('0x14'))(_0x6cbf('0x15'));var utils=require('../../config/utils');var config=require(_0x6cbf('0x16'));var licenseUtil=require(_0x6cbf('0x17'));var db=require(_0x6cbf('0x18'))['db'];function respondWithStatusCode(_0x42ea20,_0x53ac26){_0x53ac26=_0x53ac26||0xcc;return function(_0x415ed0){if(_0x415ed0){return _0x42ea20[_0x6cbf('0x19')](_0x53ac26);}return _0x42ea20[_0x6cbf('0x1a')](_0x53ac26)[_0x6cbf('0x1b')]();};}function respondWithResult(_0x5da644,_0x15b247){_0x15b247=_0x15b247||0xc8;return function(_0x4d1bed){if(_0x4d1bed){return _0x5da644[_0x6cbf('0x1a')](_0x15b247)[_0x6cbf('0x1c')](_0x4d1bed);}};}function respondWithFilteredResult(_0x44cada,_0x5a9342){return function(_0x1e39b7){if(_0x1e39b7){var _0x5d4538=_0x1e39b7['count'],_0x3b8a03=_0x5a9342['offset'],_0x481c0c=_0x5a9342[_0x6cbf('0x1d')]+_0x5a9342[_0x6cbf('0x1e')],_0x4865b8;if(_0x481c0c>=_0x5d4538){_0x481c0c=_0x5d4538;_0x4865b8=0xc8;}else{_0x4865b8=0xce;}_0x44cada[_0x6cbf('0x1a')](_0x4865b8);return _0x44cada[_0x6cbf('0x1f')](_0x6cbf('0x20'),_0x3b8a03+'-'+_0x481c0c+'/'+_0x5d4538)[_0x6cbf('0x1c')](_0x1e39b7);}return null;};}function patchUpdates(_0x1866ef){return function(_0x4e71cb){try{jsonpatch['apply'](_0x4e71cb,_0x1866ef,!![]);}catch(_0x2b8056){return BPromise[_0x6cbf('0x21')](_0x2b8056);}return _0x4e71cb[_0x6cbf('0x22')]();};}function saveUpdates(_0x20a458,_0x1da2a4){return function(_0x130253){if(_0x130253){return _0x130253[_0x6cbf('0x23')](_0x20a458)[_0x6cbf('0x24')](function(_0x2ab0cd){return _0x2ab0cd;});}return null;};}function removeEntity(_0x4ccbc7,_0x506017){return function(_0x55555e){if(_0x55555e){return _0x55555e['destroy']()['then'](function(){_0x4ccbc7[_0x6cbf('0x1a')](0xcc)[_0x6cbf('0x1b')]();});}};}function handleEntityNotFound(_0x5104f9,_0x21a161){return function(_0x4b77f5){if(!_0x4b77f5){_0x5104f9[_0x6cbf('0x19')](0x194);}return _0x4b77f5;};}function handleError(_0x563428,_0x2988b8){_0x2988b8=_0x2988b8||0x1f4;return function(_0x43e896){logger['error'](_0x43e896['stack']);if(_0x43e896[_0x6cbf('0x25')]){delete _0x43e896[_0x6cbf('0x25')];}_0x563428['status'](_0x2988b8)['send'](_0x43e896);};}exports[_0x6cbf('0x26')]=function(_0x142743,_0x542c4d){var _0x487773={},_0x3fc067={},_0x47c522={'count':0x0,'rows':[]};var _0x4875c4=_[_0x6cbf('0x27')](db[_0x6cbf('0x28')][_0x6cbf('0x29')],function(_0x472b77){return{'name':_0x472b77[_0x6cbf('0x2a')],'type':_0x472b77['type'][_0x6cbf('0x2b')]};});_0x3fc067[_0x6cbf('0x2c')]=_[_0x6cbf('0x2d')](_[_0x6cbf('0x27')](_0x4875c4,_0x6cbf('0x25')),[_0x6cbf('0x2e')]);_0x3fc067['query']=_[_0x6cbf('0x2f')](_0x142743['query']);_0x3fc067[_0x6cbf('0x30')]=_[_0x6cbf('0x31')](_0x3fc067[_0x6cbf('0x2c')],_0x3fc067['query']);_0x487773[_0x6cbf('0x32')]=_[_0x6cbf('0x31')](_0x3fc067['model'],qs['fields'](_0x142743[_0x6cbf('0x33')]['fields']));_0x487773[_0x6cbf('0x32')]=_0x487773[_0x6cbf('0x32')][_0x6cbf('0x34')]?_0x487773['attributes']:_0x3fc067[_0x6cbf('0x2c')];if(!_0x142743['query'][_0x6cbf('0x35')](_0x6cbf('0x36'))){_0x487773['limit']=qs[_0x6cbf('0x1e')](_0x142743[_0x6cbf('0x33')][_0x6cbf('0x1e')]);_0x487773[_0x6cbf('0x1d')]=qs[_0x6cbf('0x1d')](_0x142743[_0x6cbf('0x33')]['offset']);}_0x487773['order']=qs[_0x6cbf('0x37')](_0x142743[_0x6cbf('0x33')][_0x6cbf('0x37')]);_0x487773[_0x6cbf('0x38')]=qs[_0x6cbf('0x30')](_['pick'](_0x142743['query'],_0x3fc067[_0x6cbf('0x30')]),_0x4875c4);if(_0x142743[_0x6cbf('0x33')][_0x6cbf('0x39')]){_0x487773[_0x6cbf('0x38')]=_['merge'](_0x487773[_0x6cbf('0x38')],{'$or':_[_0x6cbf('0x27')](_0x4875c4,function(_0x4cd367){if(_0x4cd367['type']!==_0x6cbf('0x3a')){var _0x570112={};_0x570112[_0x4cd367[_0x6cbf('0x25')]]={'$like':'%'+_0x142743[_0x6cbf('0x33')][_0x6cbf('0x39')]+'%'};return _0x570112;}})});}_0x487773=_[_0x6cbf('0x3b')]({},_0x487773,_0x142743[_0x6cbf('0x3c')]);var _0x3a2bbf={'where':_0x487773['where']};return db[_0x6cbf('0x28')]['count'](_0x3a2bbf)['then'](function(_0x9aac4c){_0x47c522[_0x6cbf('0x3d')]=_0x9aac4c;if(_0x142743['query'][_0x6cbf('0x3e')]){_0x487773[_0x6cbf('0x3f')]=[{'all':!![]}];}return db[_0x6cbf('0x28')]['findAll'](_0x487773);})[_0x6cbf('0x24')](function(_0xaa8391){_0x47c522[_0x6cbf('0x40')]=_0xaa8391;return _0x47c522;})[_0x6cbf('0x24')](respondWithFilteredResult(_0x542c4d,_0x487773))[_0x6cbf('0x41')](handleError(_0x542c4d,null));};exports['show']=function(_0xd5b7f5,_0xeb18){var _0x5c7453={'raw':![],'where':{'id':_0xd5b7f5[_0x6cbf('0x42')]['id']}},_0x4fca9e={};_0x4fca9e[_0x6cbf('0x2c')]=_[_0x6cbf('0x2f')](db[_0x6cbf('0x28')][_0x6cbf('0x29')]);_0x4fca9e[_0x6cbf('0x33')]=_[_0x6cbf('0x2f')](_0xd5b7f5[_0x6cbf('0x33')]);_0x4fca9e[_0x6cbf('0x30')]=_[_0x6cbf('0x31')](_0x4fca9e[_0x6cbf('0x2c')],_0x4fca9e[_0x6cbf('0x33')]);_0x5c7453[_0x6cbf('0x32')]=_[_0x6cbf('0x31')](_0x4fca9e[_0x6cbf('0x2c')],qs['fields'](_0xd5b7f5[_0x6cbf('0x33')][_0x6cbf('0x43')]));_0x5c7453[_0x6cbf('0x32')]=_0x5c7453['attributes'][_0x6cbf('0x34')]?_0x5c7453[_0x6cbf('0x32')]:_0x4fca9e[_0x6cbf('0x2c')];if(_0xd5b7f5[_0x6cbf('0x33')][_0x6cbf('0x3e')]){_0x5c7453[_0x6cbf('0x3f')]=[{'all':!![]}];}_0x5c7453=_[_0x6cbf('0x3b')]({},_0x5c7453,_0xd5b7f5[_0x6cbf('0x3c')]);return db[_0x6cbf('0x28')][_0x6cbf('0x44')](_0x5c7453)[_0x6cbf('0x24')](handleEntityNotFound(_0xeb18,null))[_0x6cbf('0x24')](respondWithResult(_0xeb18,null))[_0x6cbf('0x41')](handleError(_0xeb18,null));};exports['create']=function(_0x2f92eb,_0x5051ea){return db[_0x6cbf('0x28')][_0x6cbf('0x45')](_0x2f92eb[_0x6cbf('0x46')],{})[_0x6cbf('0x24')](respondWithResult(_0x5051ea,0xc9))[_0x6cbf('0x41')](handleError(_0x5051ea,null));};exports[_0x6cbf('0x23')]=function(_0x565b92,_0xb51725){if(_0x565b92[_0x6cbf('0x46')]['id']){delete _0x565b92[_0x6cbf('0x46')]['id'];}delete _0x565b92[_0x6cbf('0x46')]['duration'];delete _0x565b92['body'][_0x6cbf('0x47')];delete _0x565b92['body']['closedAt'];delete _0x565b92[_0x6cbf('0x46')][_0x6cbf('0x48')];return db[_0x6cbf('0x28')][_0x6cbf('0x44')]({'where':{'id':_0x565b92[_0x6cbf('0x42')]['id']}})[_0x6cbf('0x24')](handleEntityNotFound(_0xb51725,null))['then'](saveUpdates(_0x565b92[_0x6cbf('0x46')],null))[_0x6cbf('0x24')](respondWithResult(_0xb51725,null))['catch'](handleError(_0xb51725,null));};exports[_0x6cbf('0x49')]=function(_0x3345ff,_0x256b47){return db[_0x6cbf('0x28')][_0x6cbf('0x49')]()[_0x6cbf('0x24')](respondWithResult(_0x256b47,null))[_0x6cbf('0x41')](handleError(_0x256b47,null));};exports[_0x6cbf('0x4a')]=function(_0x3af9f3,_0x552152,_0x162a29){var _0x70d4c8=require(_0x6cbf('0x4b'));var _0x828f7b=![];var _0x25c914={};if(_0x3af9f3[_0x6cbf('0x33')]['type']&&_0x3af9f3[_0x6cbf('0x33')][_0x6cbf('0x4c')]===_0x6cbf('0x4d')){_0x25c914[_0x6cbf('0x4d')]=_0x3af9f3[_0x6cbf('0x42')]['id'];}else{_0x25c914['id']=_0x3af9f3[_0x6cbf('0x42')]['id'];}return db[_0x6cbf('0x28')]['find']({'where':_0x25c914,'attributes':['id',_0x6cbf('0x48')],'raw':!![]})[_0x6cbf('0x24')](handleEntityNotFound(_0x552152,null))[_0x6cbf('0x24')](function(_0x55e4ed){if(_0x55e4ed){var _0x21fbb2=path['join'](config['root'],_0x6cbf('0x4e'),_0x55e4ed[_0x6cbf('0x48')]);var _0x14dcbd=util[_0x6cbf('0x2e')](_0x6cbf('0x4f'),_0x21fbb2);if(fs[_0x6cbf('0x50')](_0x14dcbd)){_0x828f7b=!![];return _0x70d4c8[_0x6cbf('0x51')](_0x14dcbd,_0x21fbb2,config['secrets'][_0x6cbf('0x52')])[_0x6cbf('0x24')](function(){return _0x55e4ed;});}return _0x55e4ed;}})[_0x6cbf('0x24')](function(_0x477a17){if(_0x477a17){var _0xba24f1=path[_0x6cbf('0x53')](config[_0x6cbf('0x54')],_0x6cbf('0x4e'),_0x477a17[_0x6cbf('0x48')]);if(!fs['existsSync'](_0xba24f1)){throw new db[(_0x6cbf('0x55'))][(_0x6cbf('0x56'))](_0x6cbf('0x57'));}if(_0x477a17['filename']){return _0x552152[_0x6cbf('0x4a')](_0xba24f1,_0x477a17[_0x6cbf('0x58')]+path[_0x6cbf('0x59')](_0xba24f1),function(){if(_0x828f7b){fs[_0x6cbf('0x5a')](_0xba24f1);}});}else{return _0x552152['download'](_0xba24f1,function(_0x4d911c){if(_0x828f7b){fs['unlink'](_0xba24f1);}});}}})[_0x6cbf('0x41')](function(_0x5e0d93){if(_0x5e0d93[_0x6cbf('0x5b')]==='ScreenRecording\x20not\x20found'){_0x552152[_0x6cbf('0x1a')](0x194)[_0x6cbf('0x5c')](_0x6cbf('0x5d'));}else{return handleError(_0x552152,null);}});};exports[_0x6cbf('0x5e')]=function(_0x4d0177,_0x90913c){return db[_0x6cbf('0x28')][_0x6cbf('0x44')]({'where':{'id':_0x4d0177[_0x6cbf('0x42')]['id']}})[_0x6cbf('0x24')](function(_0x4cfb81){if(!_0x4cfb81)throw new ReferenceError('Entity\x20not\x20found');return _0x4cfb81;})[_0x6cbf('0x24')](function(_0x5b32ae){var _0x57a825=path[_0x6cbf('0x53')](config['root'],'server/files/screen_recordings',_0x5b32ae[_0x6cbf('0x48')]);logger[_0x6cbf('0x5f')](_0x6cbf('0x60'),_0x57a825);if(!_[_0x6cbf('0x61')](_0x5b32ae[_0x6cbf('0x48')])&&fs[_0x6cbf('0x50')](_0x57a825)){logger['info'](_0x6cbf('0x62')+_0x57a825+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x57a825);}_0x57a825=_0x57a825+_0x6cbf('0x63');if(!_[_0x6cbf('0x61')](_0x5b32ae['value'])&&fs['existsSync'](_0x57a825)){logger[_0x6cbf('0x5f')](_0x6cbf('0x62')+_0x57a825+_0x6cbf('0x64'));fs['unlinkSync'](_0x57a825);}return _0x5b32ae;})['then'](function(_0x51c099){if(!_0x51c099)throw new InternalError();return _0x51c099[_0x6cbf('0x5e')]();})[_0x6cbf('0x24')](function(){_0x90913c[_0x6cbf('0x1a')](0xcc)[_0x6cbf('0x1b')]();})[_0x6cbf('0x41')](handleError(_0x90913c,null));}; \ No newline at end of file +var _0x5fd7=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','set','json','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','filter','merge','options','count','findAll','rows','show','includeAll','find','catch','create','body','duration','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','%s.cypher','decryptFile','recording','server/files/screen_recordings','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','send','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','isNil','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x4876d4,_0x1a401e){var _0x8df8c7=function(_0x117a2c){while(--_0x117a2c){_0x4876d4['push'](_0x4876d4['shift']());}};_0x8df8c7(++_0x1a401e);}(_0x5fd7,0x134));var _0x75fd=function(_0x1de87c,_0x52ebaf){_0x1de87c=_0x1de87c-0x0;var _0x38a8e9=_0x5fd7[_0x1de87c];return _0x38a8e9;};'use strict';var pdf=require(_0x75fd('0x0'));var emlformat=require(_0x75fd('0x1'));var rimraf=require(_0x75fd('0x2'));var zipdir=require(_0x75fd('0x3'));var jsonpatch=require(_0x75fd('0x4'));var rp=require(_0x75fd('0x5'));var moment=require(_0x75fd('0x6'));var BPromise=require(_0x75fd('0x7'));var Mustache=require(_0x75fd('0x8'));var util=require(_0x75fd('0x9'));var path=require(_0x75fd('0xa'));var sox=require(_0x75fd('0xb'));var csv=require(_0x75fd('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x75fd('0xd'));var squel=require(_0x75fd('0xe'));var crypto=require(_0x75fd('0xf'));var jsforce=require(_0x75fd('0x10'));var deskjs=require(_0x75fd('0x11'));var toCsv=require('to-csv');var querystring=require(_0x75fd('0x12'));var Papa=require(_0x75fd('0x13'));var Redis=require(_0x75fd('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x75fd('0x15'));var as=require(_0x75fd('0x16'));var hardwareService=require(_0x75fd('0x17'));var logger=require('../../config/logger')(_0x75fd('0x18'));var utils=require(_0x75fd('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x75fd('0x1a'));var db=require(_0x75fd('0x1b'))['db'];function respondWithStatusCode(_0x428f45,_0x39023b){_0x39023b=_0x39023b||0xcc;return function(_0x2e3692){if(_0x2e3692){return _0x428f45['sendStatus'](_0x39023b);}return _0x428f45[_0x75fd('0x1c')](_0x39023b)[_0x75fd('0x1d')]();};}function respondWithResult(_0x3f86da,_0x34c167){_0x34c167=_0x34c167||0xc8;return function(_0x4cfff0){if(_0x4cfff0){return _0x3f86da[_0x75fd('0x1c')](_0x34c167)['json'](_0x4cfff0);}};}function respondWithFilteredResult(_0x5c308e,_0x52574a){return function(_0x2d1738){if(_0x2d1738){var _0x3fa7d8=_0x2d1738['count'],_0x4a7c64=_0x52574a[_0x75fd('0x1e')],_0x2f247c=_0x52574a['offset']+_0x52574a[_0x75fd('0x1f')],_0x2beca9;if(_0x2f247c>=_0x3fa7d8){_0x2f247c=_0x3fa7d8;_0x2beca9=0xc8;}else{_0x2beca9=0xce;}_0x5c308e[_0x75fd('0x1c')](_0x2beca9);return _0x5c308e[_0x75fd('0x20')]('Content-Range',_0x4a7c64+'-'+_0x2f247c+'/'+_0x3fa7d8)[_0x75fd('0x21')](_0x2d1738);}return null;};}function patchUpdates(_0x41a730){return function(_0x54ad2c){try{jsonpatch['apply'](_0x54ad2c,_0x41a730,!![]);}catch(_0x527371){return BPromise[_0x75fd('0x22')](_0x527371);}return _0x54ad2c[_0x75fd('0x23')]();};}function saveUpdates(_0x2d0c4a,_0x5a98d1){return function(_0x44977f){if(_0x44977f){return _0x44977f[_0x75fd('0x24')](_0x2d0c4a)[_0x75fd('0x25')](function(_0x456405){return _0x456405;});}return null;};}function removeEntity(_0x31d8c8,_0x595fbb){return function(_0x21d46d){if(_0x21d46d){return _0x21d46d[_0x75fd('0x26')]()[_0x75fd('0x25')](function(){_0x31d8c8[_0x75fd('0x1c')](0xcc)[_0x75fd('0x1d')]();});}};}function handleEntityNotFound(_0x46eb5a,_0x1531b7){return function(_0x4512cd){if(!_0x4512cd){_0x46eb5a[_0x75fd('0x27')](0x194);}return _0x4512cd;};}function handleError(_0x1bccf1,_0x472390){_0x472390=_0x472390||0x1f4;return function(_0x3aaa8c){logger[_0x75fd('0x28')](_0x3aaa8c[_0x75fd('0x29')]);if(_0x3aaa8c[_0x75fd('0x2a')]){delete _0x3aaa8c[_0x75fd('0x2a')];}_0x1bccf1[_0x75fd('0x1c')](_0x472390)['send'](_0x3aaa8c);};}exports[_0x75fd('0x2b')]=function(_0x3e1fa5,_0xd839d0){var _0x15ea4a={},_0x5aa114={},_0x34eddc={'count':0x0,'rows':[]};var _0x2696c3=_[_0x75fd('0x2c')](db[_0x75fd('0x2d')][_0x75fd('0x2e')],function(_0x3bf460){return{'name':_0x3bf460[_0x75fd('0x2f')],'type':_0x3bf460[_0x75fd('0x30')][_0x75fd('0x31')]};});_0x5aa114[_0x75fd('0x32')]=_[_0x75fd('0x33')](_[_0x75fd('0x2c')](_0x2696c3,_0x75fd('0x2a')),[_0x75fd('0x34')]);_0x5aa114[_0x75fd('0x35')]=_[_0x75fd('0x36')](_0x3e1fa5[_0x75fd('0x35')]);_0x5aa114[_0x75fd('0x37')]=_[_0x75fd('0x38')](_0x5aa114[_0x75fd('0x32')],_0x5aa114[_0x75fd('0x35')]);_0x15ea4a[_0x75fd('0x39')]=_[_0x75fd('0x38')](_0x5aa114['model'],qs[_0x75fd('0x3a')](_0x3e1fa5[_0x75fd('0x35')][_0x75fd('0x3a')]));_0x15ea4a['attributes']=_0x15ea4a[_0x75fd('0x39')][_0x75fd('0x3b')]?_0x15ea4a['attributes']:_0x5aa114[_0x75fd('0x32')];if(!_0x3e1fa5[_0x75fd('0x35')]['hasOwnProperty']('nolimit')){_0x15ea4a[_0x75fd('0x1f')]=qs[_0x75fd('0x1f')](_0x3e1fa5[_0x75fd('0x35')][_0x75fd('0x1f')]);_0x15ea4a['offset']=qs[_0x75fd('0x1e')](_0x3e1fa5[_0x75fd('0x35')][_0x75fd('0x1e')]);}_0x15ea4a[_0x75fd('0x3c')]=qs[_0x75fd('0x3d')](_0x3e1fa5['query'][_0x75fd('0x3d')]);_0x15ea4a[_0x75fd('0x3e')]=qs[_0x75fd('0x37')](_[_0x75fd('0x3f')](_0x3e1fa5[_0x75fd('0x35')],_0x5aa114[_0x75fd('0x37')]),_0x2696c3);if(_0x3e1fa5[_0x75fd('0x35')]['filter']){_0x15ea4a[_0x75fd('0x3e')]=_['merge'](_0x15ea4a['where'],{'$or':_[_0x75fd('0x2c')](_0x2696c3,function(_0x478f7e){if(_0x478f7e[_0x75fd('0x30')]!==_0x75fd('0x40')){var _0x55e482={};_0x55e482[_0x478f7e['name']]={'$like':'%'+_0x3e1fa5[_0x75fd('0x35')][_0x75fd('0x41')]+'%'};return _0x55e482;}})});}_0x15ea4a=_[_0x75fd('0x42')]({},_0x15ea4a,_0x3e1fa5[_0x75fd('0x43')]);var _0xac15ea={'where':_0x15ea4a[_0x75fd('0x3e')]};return db[_0x75fd('0x2d')][_0x75fd('0x44')](_0xac15ea)[_0x75fd('0x25')](function(_0x3027f1){_0x34eddc[_0x75fd('0x44')]=_0x3027f1;if(_0x3e1fa5[_0x75fd('0x35')]['includeAll']){_0x15ea4a['include']=[{'all':!![]}];}return db[_0x75fd('0x2d')][_0x75fd('0x45')](_0x15ea4a);})[_0x75fd('0x25')](function(_0x48b517){_0x34eddc[_0x75fd('0x46')]=_0x48b517;return _0x34eddc;})[_0x75fd('0x25')](respondWithFilteredResult(_0xd839d0,_0x15ea4a))['catch'](handleError(_0xd839d0,null));};exports[_0x75fd('0x47')]=function(_0x25932d,_0x3fcf74){var _0x5f53d1={'raw':![],'where':{'id':_0x25932d['params']['id']}},_0x4d840b={};_0x4d840b[_0x75fd('0x32')]=_[_0x75fd('0x36')](db['ScreenRecording'][_0x75fd('0x2e')]);_0x4d840b[_0x75fd('0x35')]=_['keys'](_0x25932d['query']);_0x4d840b[_0x75fd('0x37')]=_['intersection'](_0x4d840b['model'],_0x4d840b[_0x75fd('0x35')]);_0x5f53d1[_0x75fd('0x39')]=_[_0x75fd('0x38')](_0x4d840b['model'],qs[_0x75fd('0x3a')](_0x25932d[_0x75fd('0x35')][_0x75fd('0x3a')]));_0x5f53d1[_0x75fd('0x39')]=_0x5f53d1[_0x75fd('0x39')][_0x75fd('0x3b')]?_0x5f53d1['attributes']:_0x4d840b[_0x75fd('0x32')];if(_0x25932d['query'][_0x75fd('0x48')]){_0x5f53d1['include']=[{'all':!![]}];}_0x5f53d1=_['merge']({},_0x5f53d1,_0x25932d[_0x75fd('0x43')]);return db['ScreenRecording'][_0x75fd('0x49')](_0x5f53d1)[_0x75fd('0x25')](handleEntityNotFound(_0x3fcf74,null))[_0x75fd('0x25')](respondWithResult(_0x3fcf74,null))[_0x75fd('0x4a')](handleError(_0x3fcf74,null));};exports[_0x75fd('0x4b')]=function(_0x44bfec,_0x466c49){return db[_0x75fd('0x2d')][_0x75fd('0x4b')](_0x44bfec[_0x75fd('0x4c')],{})[_0x75fd('0x25')](respondWithResult(_0x466c49,0xc9))[_0x75fd('0x4a')](handleError(_0x466c49,null));};exports['update']=function(_0x5b42f0,_0x258890){if(_0x5b42f0[_0x75fd('0x4c')]['id']){delete _0x5b42f0[_0x75fd('0x4c')]['id'];}delete _0x5b42f0[_0x75fd('0x4c')][_0x75fd('0x4d')];delete _0x5b42f0[_0x75fd('0x4c')][_0x75fd('0x4e')];delete _0x5b42f0[_0x75fd('0x4c')][_0x75fd('0x4f')];delete _0x5b42f0[_0x75fd('0x4c')][_0x75fd('0x50')];return db[_0x75fd('0x2d')][_0x75fd('0x49')]({'where':{'id':_0x5b42f0[_0x75fd('0x51')]['id']}})['then'](handleEntityNotFound(_0x258890,null))[_0x75fd('0x25')](saveUpdates(_0x5b42f0[_0x75fd('0x4c')],null))[_0x75fd('0x25')](respondWithResult(_0x258890,null))[_0x75fd('0x4a')](handleError(_0x258890,null));};exports[_0x75fd('0x52')]=function(_0x314164,_0x1ff92f){return db[_0x75fd('0x2d')][_0x75fd('0x52')]()[_0x75fd('0x25')](respondWithResult(_0x1ff92f,null))[_0x75fd('0x4a')](handleError(_0x1ff92f,null));};exports[_0x75fd('0x53')]=function(_0x5071a5,_0x4edcc3,_0x4ad06c){var _0x57904d=require(_0x75fd('0x54'));var _0x3b432c=![];var _0x2a5338={};if(_0x5071a5['query'][_0x75fd('0x30')]&&_0x5071a5[_0x75fd('0x35')]['type']===_0x75fd('0x55')){_0x2a5338[_0x75fd('0x55')]=_0x5071a5[_0x75fd('0x51')]['id'];}else{_0x2a5338['id']=_0x5071a5[_0x75fd('0x51')]['id'];}return db['ScreenRecording'][_0x75fd('0x49')]({'where':_0x2a5338,'attributes':['id',_0x75fd('0x50')],'raw':!![]})[_0x75fd('0x25')](handleEntityNotFound(_0x4edcc3,null))[_0x75fd('0x25')](function(_0x81757){if(_0x81757){var _0x137e5f=path[_0x75fd('0x56')](config[_0x75fd('0x57')],'server/files/screen_recordings',_0x81757[_0x75fd('0x50')]);var _0x58fa31=util[_0x75fd('0x34')](_0x75fd('0x58'),_0x137e5f);if(fs['existsSync'](_0x58fa31)){_0x3b432c=!![];return _0x57904d[_0x75fd('0x59')](_0x58fa31,_0x137e5f,config['secrets'][_0x75fd('0x5a')])['then'](function(){return _0x81757;});}return _0x81757;}})['then'](function(_0x2a745e){if(_0x2a745e){var _0x3c2158=path[_0x75fd('0x56')](config[_0x75fd('0x57')],_0x75fd('0x5b'),_0x2a745e[_0x75fd('0x50')]);if(!fs[_0x75fd('0x5c')](_0x3c2158)){throw new db[(_0x75fd('0x5d'))][(_0x75fd('0x5e'))]('ScreenRecording\x20not\x20found');}if(_0x2a745e[_0x75fd('0x5f')]){return _0x4edcc3[_0x75fd('0x53')](_0x3c2158,_0x2a745e['filename']+path[_0x75fd('0x60')](_0x3c2158),function(){if(_0x3b432c){fs[_0x75fd('0x61')](_0x3c2158);}});}else{return _0x4edcc3[_0x75fd('0x53')](_0x3c2158,function(_0x46c724){if(_0x3b432c){fs[_0x75fd('0x61')](_0x3c2158);}});}}})[_0x75fd('0x4a')](function(_0x32f0aa){if(_0x32f0aa[_0x75fd('0x62')]==='ScreenRecording\x20not\x20found'){_0x4edcc3[_0x75fd('0x1c')](0x194)[_0x75fd('0x63')](_0x75fd('0x64'));}else{return handleError(_0x4edcc3,null);}});};exports[_0x75fd('0x26')]=function(_0x107424,_0x20d1a1){return db[_0x75fd('0x2d')][_0x75fd('0x49')]({'where':{'id':_0x107424[_0x75fd('0x51')]['id']}})[_0x75fd('0x25')](function(_0x4a69ae){if(!_0x4a69ae)throw new ReferenceError(_0x75fd('0x65'));return _0x4a69ae;})[_0x75fd('0x25')](function(_0x2a03d0){var _0x55cab9=path[_0x75fd('0x56')](config[_0x75fd('0x57')],'server/files/screen_recordings',_0x2a03d0[_0x75fd('0x50')]);logger['info'](_0x75fd('0x66'),_0x55cab9);if(!_['isNil'](_0x2a03d0[_0x75fd('0x50')])&&fs[_0x75fd('0x5c')](_0x55cab9)){logger[_0x75fd('0x67')](_0x75fd('0x68')+_0x55cab9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x75fd('0x69')](_0x55cab9);}_0x55cab9=_0x55cab9+'.cypher';if(!_[_0x75fd('0x6a')](_0x2a03d0[_0x75fd('0x50')])&&fs['existsSync'](_0x55cab9)){logger[_0x75fd('0x67')](_0x75fd('0x68')+_0x55cab9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x55cab9);}return _0x2a03d0;})[_0x75fd('0x25')](function(_0x25f6d1){if(!_0x25f6d1)throw new InternalError();return _0x25f6d1[_0x75fd('0x26')]();})[_0x75fd('0x25')](function(){_0x20d1a1[_0x75fd('0x1c')](0xcc)[_0x75fd('0x1d')]();})[_0x75fd('0x4a')](handleError(_0x20d1a1,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 10510f4..c1de40a 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 _0xbc01=['bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api'];(function(_0x4e47de,_0x48e2ac){var _0x3f373b=function(_0x35ba57){while(--_0x35ba57){_0x4e47de['push'](_0x4e47de['shift']());}};_0x3f373b(++_0x48e2ac);}(_0xbc01,0xf8));var _0x1bc0=function(_0x251362,_0x50a382){_0x251362=_0x251362-0x0;var _0x1abe13=_0xbc01[_0x251362];return _0x1abe13;};'use strict';var _=require(_0x1bc0('0x0'));var util=require(_0x1bc0('0x1'));var logger=require(_0x1bc0('0x2'))(_0x1bc0('0x3'));var moment=require('moment');var BPromise=require(_0x1bc0('0x4'));var rp=require(_0x1bc0('0x5'));var fs=require('fs');var path=require(_0x1bc0('0x6'));var rimraf=require(_0x1bc0('0x7'));var config=require(_0x1bc0('0x8'));var attributes=require(_0x1bc0('0x9'));module[_0x1bc0('0xa')]=function(_0x407a91,_0x474e56){return _0x407a91[_0x1bc0('0xb')](_0x1bc0('0xc'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x1bc0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd742=['../../config/logger','moment','request-promise','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x1d997f,_0x259b5a){var _0x307704=function(_0x4358a8){while(--_0x4358a8){_0x1d997f['push'](_0x1d997f['shift']());}};_0x307704(++_0x259b5a);}(_0xd742,0x160));var _0x2d74=function(_0x5bffa2,_0x26092c){_0x5bffa2=_0x5bffa2-0x0;var _0x5b3503=_0xd742[_0x5bffa2];return _0x5b3503;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d74('0x0'))('api');var moment=require(_0x2d74('0x1'));var BPromise=require('bluebird');var rp=require(_0x2d74('0x2'));var fs=require('fs');var path=require(_0x2d74('0x3'));var rimraf=require('rimraf');var config=require(_0x2d74('0x4'));var attributes=require(_0x2d74('0x5'));module[_0x2d74('0x6')]=function(_0x1f5a47,_0x870171){return _0x1f5a47[_0x2d74('0x7')](_0x2d74('0x8'),attributes,{'tableName':_0x2d74('0x9'),'paranoid':![],'indexes':[{'name':_0x2d74('0xa'),'fields':[_0x2d74('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 626ca4d..7be8812 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(_0xb0dec,_0x27289a){var _0x4c8bf3=function(_0x290011){while(--_0x290011){_0xb0dec['push'](_0xb0dec['shift']());}};_0x4c8bf3(++_0x27289a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0xf55eb3,_0x19ec36){var _0x3f8d9f=function(_0x5b7d3b){while(--_0x5b7d3b){_0xf55eb3['push'](_0xf55eb3['shift']());}};_0x3f8d9f(++_0x19ec36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 01077ef..0de2f2a 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 _0xe96a=['logologin','post','single','root','addPreferred','favicon','addFavicon','put','/:id','isAuthenticated','update','util','path','express','Router','../../components/auth/service','./setting.controller','get','/now','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','join','server/files/images/logos/','%s%s','logo','extname','originalname','file','diskStorage','format'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xe96a,0xc9));var _0xae96=function(_0x5837d1,_0x4661e0){_0x5837d1=_0x5837d1-0x0;var _0x43b3b7=_0xe96a[_0x5837d1];return _0x43b3b7;};'use strict';var multer=require('multer');var util=require(_0xae96('0x0'));var path=require(_0xae96('0x1'));var timeout=require('connect-timeout');var express=require(_0xae96('0x2'));var router=express[_0xae96('0x3')]();var auth=require(_0xae96('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xae96('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xae96('0x6')](_0xae96('0x7'),controller['getDate']);router[_0xae96('0x6')]('/:id',controller[_0xae96('0x8')]);router['get'](_0xae96('0x9'),controller[_0xae96('0xa')]);router[_0xae96('0x6')](_0xae96('0xb'),controller[_0xae96('0xc')]);router[_0xae96('0x6')](_0xae96('0xd'),controller[_0xae96('0xe')]);router[_0xae96('0x6')](_0xae96('0xf'),controller[_0xae96('0x10')]);router[_0xae96('0x6')](_0xae96('0x11'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4c8bd3,_0x445248,_0x226f8c){_0x226f8c(null,path[_0xae96('0x12')](config['root'],_0xae96('0x13')));},'filename':function(_0x9cc1ff,_0x5667f5,_0x5ccdff){_0x5ccdff(null,util['format'](_0xae96('0x14'),_0xae96('0x15'),path[_0xae96('0x16')](_0x5667f5[_0xae96('0x17')])));}})});router['post']('/:id/logo',upload['single'](_0xae96('0x18')),controller['addLogo']);var upload=multer({'storage':multer[_0xae96('0x19')]({'destination':function(_0x4d3ef5,_0x45d985,_0x2f5afe){_0x2f5afe(null,path[_0xae96('0x12')](config['root'],'server/files/images/logos/'));},'filename':function(_0x11324b,_0x24c18d,_0x4659bd){_0x4659bd(null,util[_0xae96('0x1a')](_0xae96('0x14'),_0xae96('0x1b'),path[_0xae96('0x16')](_0x24c18d[_0xae96('0x17')])));}})});router[_0xae96('0x1c')]('/:id/logo_login',upload[_0xae96('0x1d')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1e47d7,_0x53855e,_0x260874){_0x260874(null,path[_0xae96('0x12')](config[_0xae96('0x1e')],_0xae96('0x13')));},'filename':function(_0x3ef975,_0x5322db,_0x1775ee){_0x1775ee(null,util['format']('%s%s','preferred',path[_0xae96('0x16')](_0x5322db[_0xae96('0x17')])));}})});router[_0xae96('0x1c')](_0xae96('0xf'),upload[_0xae96('0x1d')](_0xae96('0x18')),controller[_0xae96('0x1f')]);var upload=multer({'storage':multer[_0xae96('0x19')]({'destination':function(_0x363b43,_0x537303,_0x3cdc04){_0x3cdc04(null,path[_0xae96('0x12')](config[_0xae96('0x1e')],_0xae96('0x13')));},'filename':function(_0x185632,_0x5dbbe0,_0x2c66ce){_0x2c66ce(null,util['format'](_0xae96('0x14'),_0xae96('0x20'),path['extname'](_0x5dbbe0['originalname'])));}})});router[_0xae96('0x1c')](_0xae96('0x11'),upload[_0xae96('0x1d')](_0xae96('0x18')),controller[_0xae96('0x21')]);router[_0xae96('0x22')](_0xae96('0x23'),auth[_0xae96('0x24')](),controller[_0xae96('0x25')]);module['exports']=router; \ No newline at end of file +var _0xfe3f=['/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','post','single','addLogo','format','logologin','extname','originalname','file','addLogoLogin','preferred','addPreferred','favicon','put','update','path','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr'];(function(_0x17c8a9,_0x531ca3){var _0x379aa6=function(_0x5ba780){while(--_0x5ba780){_0x17c8a9['push'](_0x17c8a9['shift']());}};_0x379aa6(++_0x531ca3);}(_0xfe3f,0xdf));var _0xffe3=function(_0x14e44f,_0x5b73ba){_0x14e44f=_0x14e44f-0x0;var _0x2449d1=_0xfe3f[_0x14e44f];return _0x2449d1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xffe3('0x0'));var timeout=require('connect-timeout');var express=require(_0xffe3('0x1'));var router=express[_0xffe3('0x2')]();var auth=require(_0xffe3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xffe3('0x4'));var controller=require(_0xffe3('0x5'));router[_0xffe3('0x6')]('/',auth[_0xffe3('0x7')](),controller['index']);router[_0xffe3('0x6')](_0xffe3('0x8'),controller['getDate']);router[_0xffe3('0x6')](_0xffe3('0x9'),controller[_0xffe3('0xa')]);router[_0xffe3('0x6')](_0xffe3('0xb'),controller[_0xffe3('0xc')]);router['get'](_0xffe3('0xd'),controller[_0xffe3('0xe')]);router[_0xffe3('0x6')](_0xffe3('0xf'),controller[_0xffe3('0x10')]);router[_0xffe3('0x6')](_0xffe3('0x11'),controller[_0xffe3('0x12')]);router[_0xffe3('0x6')](_0xffe3('0x13'),controller['getFavicon']);var upload=multer({'storage':multer[_0xffe3('0x14')]({'destination':function(_0x56c9fd,_0x3725b1,_0x5b899a){_0x5b899a(null,path[_0xffe3('0x15')](config[_0xffe3('0x16')],_0xffe3('0x17')));},'filename':function(_0x1b0ca6,_0x358772,_0x33d7b8){_0x33d7b8(null,util['format'](_0xffe3('0x18'),_0xffe3('0x19'),path['extname'](_0x358772['originalname'])));}})});router[_0xffe3('0x1a')](_0xffe3('0xb'),upload[_0xffe3('0x1b')]('file'),controller[_0xffe3('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1df8bb,_0x24dbaf,_0x3b26d3){_0x3b26d3(null,path[_0xffe3('0x15')](config[_0xffe3('0x16')],'server/files/images/logos/'));},'filename':function(_0x4177b2,_0x5a3e66,_0x1f9a5b){_0x1f9a5b(null,util[_0xffe3('0x1d')](_0xffe3('0x18'),_0xffe3('0x1e'),path[_0xffe3('0x1f')](_0x5a3e66[_0xffe3('0x20')])));}})});router[_0xffe3('0x1a')](_0xffe3('0xd'),upload[_0xffe3('0x1b')](_0xffe3('0x21')),controller[_0xffe3('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x43b301,_0x3a0214,_0x27a26f){_0x27a26f(null,path[_0xffe3('0x15')](config[_0xffe3('0x16')],_0xffe3('0x17')));},'filename':function(_0x48e170,_0x3c915f,_0x2bac0b){_0x2bac0b(null,util['format']('%s%s',_0xffe3('0x23'),path[_0xffe3('0x1f')](_0x3c915f[_0xffe3('0x20')])));}})});router[_0xffe3('0x1a')](_0xffe3('0x11'),upload[_0xffe3('0x1b')](_0xffe3('0x21')),controller[_0xffe3('0x24')]);var upload=multer({'storage':multer[_0xffe3('0x14')]({'destination':function(_0x1751fc,_0x1223c0,_0x255fad){_0x255fad(null,path[_0xffe3('0x15')](config[_0xffe3('0x16')],_0xffe3('0x17')));},'filename':function(_0x56cbb3,_0x5384c4,_0x3fea9d){_0x3fea9d(null,util[_0xffe3('0x1d')](_0xffe3('0x18'),_0xffe3('0x25'),path['extname'](_0x5384c4[_0xffe3('0x20')])));}})});router[_0xffe3('0x1a')](_0xffe3('0x13'),upload[_0xffe3('0x1b')](_0xffe3('0x21')),controller['addFavicon']);router[_0xffe3('0x26')]('/:id',auth[_0xffe3('0x7')](),controller[_0xffe3('0x27')]);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 3f058b9..7f958b6 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 _0x13f8=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER','min_internal','min_mailbox'];(function(_0x2f2de0,_0x224825){var _0x379f07=function(_0x44235b){while(--_0x44235b){_0x2f2de0['push'](_0x2f2de0['shift']());}};_0x379f07(++_0x224825);}(_0x13f8,0x146));var _0x813f=function(_0x271c16,_0x1396f7){_0x271c16=_0x271c16-0x0;var _0x2bdcf5=_0x13f8[_0x271c16];return _0x2bdcf5;};'use strict';var Sequelize=require('sequelize');module[_0x813f('0x0')]={'min_internal':{'type':Sequelize[_0x813f('0x1')](0xb),'unique':_0x813f('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x813f('0x1')](0xb),'unique':_0x813f('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x813f('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x813f('0x4')],'defaultValue':_0x813f('0x5')},'logo':{'type':Sequelize[_0x813f('0x4')]},'defaultLogo':{'type':Sequelize[_0x813f('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x813f('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x813f('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x813f('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x813f('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x813f('0x4')]},'turnusername':{'type':Sequelize[_0x813f('0x4')]},'turnpassword':{'type':Sequelize[_0x813f('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x813f('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x813f('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x813f('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x813f('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x813f('0x4')],'defaultValue':_0x813f('0x7')},'enableEmailPreview':{'type':Sequelize[_0x813f('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x813f('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x813f('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x813f('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x813f('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x813f('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x813f('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x813f('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x813f('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x813f('0x4')]},'defaultFavicon':{'type':Sequelize[_0x813f('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x813f('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x813f('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x813f('0x1')]},'transcribeRegion':{'type':Sequelize[_0x813f('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x813f('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x813f('0x4')]},'bucket':{'type':Sequelize[_0x813f('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x813f('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x813f('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x813f('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x813f('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x813f('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x813f('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x813f('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x813f('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x813f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34ec=['INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','min_internal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34ec,0x16f));var _0xc34e=function(_0x1f0da6,_0x6b2bfb){_0x1f0da6=_0x1f0da6-0x0;var _0x46a94d=_0x34ec[_0x1f0da6];return _0x46a94d;};'use strict';var Sequelize=require(_0xc34e('0x0'));module[_0xc34e('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xc34e('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xc34e('0x3')](0xb),'unique':_0xc34e('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xc34e('0x5')],'defaultValue':_0xc34e('0x6')},'logo':{'type':Sequelize[_0xc34e('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xc34e('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xc34e('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xc34e('0x5')]},'turnaddr':{'type':Sequelize[_0xc34e('0x5')]},'turnusername':{'type':Sequelize[_0xc34e('0x5')]},'turnpassword':{'type':Sequelize[_0xc34e('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xc34e('0x8')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xc34e('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xc34e('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xc34e('0x9')},'chatTimeout':{'type':Sequelize[_0xc34e('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xc34e('0x5')]},'defaultPreferred':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xc34e('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xc34e('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xc34e('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xc34e('0x5')]},'defaultFavicon':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xc34e('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xc34e('0x3')]},'transcribeRegion':{'type':Sequelize[_0xc34e('0x5')]},'sentiment':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xc34e('0x5')]},'language':{'type':Sequelize[_0xc34e('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xc34e('0x3')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0xc34e('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xc34e('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xc34e('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xc34e('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xc34e('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xc34e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 6d8e77a..2ca600d 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 _0xf014=['destroy','stack','name','index','map','Setting','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','body','find','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','default_logo.svg','default','upperFirst','toLower','Sequelize','ValidationError','\x20not\x20found','../../config/license/util','server/files/images/logos','default_loginLogo.svg','custom','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','limit','set','Content-Range','reject','save','update'];(function(_0x32a3af,_0x51daf0){var _0x6b855c=function(_0x55639e){while(--_0x55639e){_0x32a3af['push'](_0x32a3af['shift']());}};_0x6b855c(++_0x51daf0);}(_0xf014,0x149));var _0x4f01=function(_0x5ec21d,_0x5d0772){_0x5ec21d=_0x5ec21d-0x0;var _0x43bde8=_0xf014[_0x5ec21d];return _0x43bde8;};'use strict';var pdf=require(_0x4f01('0x0'));var emlformat=require(_0x4f01('0x1'));var rimraf=require(_0x4f01('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f01('0x3'));var rp=require('request-promise');var moment=require(_0x4f01('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4f01('0x5'));var util=require(_0x4f01('0x6'));var path=require(_0x4f01('0x7'));var sox=require('sox');var csv=require(_0x4f01('0x8'));var ejs=require(_0x4f01('0x9'));var fs=require('fs');var _=require(_0x4f01('0xa'));var squel=require(_0x4f01('0xb'));var crypto=require(_0x4f01('0xc'));var jsforce=require(_0x4f01('0xd'));var deskjs=require(_0x4f01('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4f01('0xf'));var Papa=require(_0x4f01('0x10'));var Redis=require('ioredis');var authService=require(_0x4f01('0x11'));var qs=require(_0x4f01('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f01('0x13'));var logger=require(_0x4f01('0x14'))(_0x4f01('0x15'));var utils=require('../../config/utils');var config=require(_0x4f01('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f01('0x17'))['db'];var jayson=require(_0x4f01('0x18'));var client=jayson['client'][_0x4f01('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xcfe760,_0x204209,_0x2f4e10,_0x45df1c){return new BPromise(function(_0x49ef27,_0x49e10a){var _0x405922=_0x45df1c||client;return _0x405922['request'](_0xcfe760,_0x2f4e10)[_0x4f01('0x1a')](function(_0x353b97){logger[_0x4f01('0x1b')]('Setting,\x20%s,\x20%s',_0x204209,_0x4f01('0x1c'));logger[_0x4f01('0x1d')](_0x4f01('0x1e'),_0x204209,_0x4f01('0x1c'),JSON[_0x4f01('0x1f')](_0x353b97));if(_0x353b97['error']){if(_0x353b97[_0x4f01('0x20')][_0x4f01('0x21')]===0x1f4){logger['error'](_0x4f01('0x22'),_0x204209,_0x353b97[_0x4f01('0x20')][_0x4f01('0x23')]);return _0x49e10a(_0x353b97[_0x4f01('0x20')][_0x4f01('0x23')]);}logger[_0x4f01('0x20')](_0x4f01('0x22'),_0x204209,_0x353b97[_0x4f01('0x20')]['message']);return _0x49ef27(_0x353b97[_0x4f01('0x20')][_0x4f01('0x23')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x204209,_0x4f01('0x1c'));_0x49ef27(_0x353b97[_0x4f01('0x24')][_0x4f01('0x23')]);}})[_0x4f01('0x25')](function(_0x3db69f){logger[_0x4f01('0x20')](_0x4f01('0x22'),_0x204209,_0x3db69f);_0x49e10a(_0x3db69f);});});}function respondWithStatusCode(_0x4f68e1,_0x31bb86){_0x31bb86=_0x31bb86||0xcc;return function(_0x2873ef){if(_0x2873ef){return _0x4f68e1[_0x4f01('0x26')](_0x31bb86);}return _0x4f68e1['status'](_0x31bb86)[_0x4f01('0x27')]();};}function respondWithResult(_0x3d2d44,_0x829572){_0x829572=_0x829572||0xc8;return function(_0x26fb95){if(_0x26fb95){return _0x3d2d44[_0x4f01('0x28')](_0x829572)[_0x4f01('0x29')](_0x26fb95);}};}function respondWithFilteredResult(_0x3236ce,_0x8c10e2){return function(_0x19a1f2){if(_0x19a1f2){var _0x296e44=_0x19a1f2[_0x4f01('0x2a')],_0x1ca3d0=_0x8c10e2['offset'],_0x4ba554=_0x8c10e2['offset']+_0x8c10e2[_0x4f01('0x2b')],_0x1adac2;if(_0x4ba554>=_0x296e44){_0x4ba554=_0x296e44;_0x1adac2=0xc8;}else{_0x1adac2=0xce;}_0x3236ce[_0x4f01('0x28')](_0x1adac2);return _0x3236ce[_0x4f01('0x2c')](_0x4f01('0x2d'),_0x1ca3d0+'-'+_0x4ba554+'/'+_0x296e44)[_0x4f01('0x29')](_0x19a1f2);}return null;};}function patchUpdates(_0x11fc10){return function(_0x5df427){try{jsonpatch['apply'](_0x5df427,_0x11fc10,!![]);}catch(_0x52411b){return BPromise[_0x4f01('0x2e')](_0x52411b);}return _0x5df427[_0x4f01('0x2f')]();};}function saveUpdates(_0x35d61b,_0x38ff75){return function(_0x5f1c78){if(_0x5f1c78){return _0x5f1c78[_0x4f01('0x30')](_0x35d61b)[_0x4f01('0x1a')](function(_0x536098){return _0x536098;});}return null;};}function removeEntity(_0x2cbc26,_0x355b3d){return function(_0x22a6ea){if(_0x22a6ea){return _0x22a6ea[_0x4f01('0x31')]()[_0x4f01('0x1a')](function(){_0x2cbc26[_0x4f01('0x28')](0xcc)[_0x4f01('0x27')]();});}};}function handleEntityNotFound(_0xcccc20,_0x27989a){return function(_0x479a33){if(!_0x479a33){_0xcccc20[_0x4f01('0x26')](0x194);}return _0x479a33;};}function handleError(_0x2e1586,_0x36ef53){_0x36ef53=_0x36ef53||0x1f4;return function(_0x26ccc4){logger['error'](_0x26ccc4[_0x4f01('0x32')]);if(_0x26ccc4['name']){delete _0x26ccc4[_0x4f01('0x33')];}_0x2e1586[_0x4f01('0x28')](_0x36ef53)['send'](_0x26ccc4);};}exports[_0x4f01('0x34')]=function(_0x316cbe,_0x4389c2){var _0x43d062={},_0x396958={},_0x365850={'count':0x0,'rows':[]};var _0x5b37f0=_[_0x4f01('0x35')](db[_0x4f01('0x36')]['rawAttributes'],function(_0x541716){return{'name':_0x541716[_0x4f01('0x37')],'type':_0x541716[_0x4f01('0x38')][_0x4f01('0x39')]};});_0x396958[_0x4f01('0x3a')]=_[_0x4f01('0x35')](_0x5b37f0,_0x4f01('0x33'));_0x396958[_0x4f01('0x3b')]=_[_0x4f01('0x3c')](_0x316cbe['query']);_0x396958[_0x4f01('0x3d')]=_[_0x4f01('0x3e')](_0x396958['model'],_0x396958[_0x4f01('0x3b')]);_0x43d062['attributes']=_[_0x4f01('0x3e')](_0x396958[_0x4f01('0x3a')],qs[_0x4f01('0x3f')](_0x316cbe[_0x4f01('0x3b')][_0x4f01('0x3f')]));_0x43d062[_0x4f01('0x40')]=_0x43d062[_0x4f01('0x40')]['length']?_0x43d062[_0x4f01('0x40')]:_0x396958[_0x4f01('0x3a')];if(!_0x316cbe[_0x4f01('0x3b')][_0x4f01('0x41')](_0x4f01('0x42'))){_0x43d062[_0x4f01('0x2b')]=qs['limit'](_0x316cbe[_0x4f01('0x3b')][_0x4f01('0x2b')]);_0x43d062[_0x4f01('0x43')]=qs[_0x4f01('0x43')](_0x316cbe['query'][_0x4f01('0x43')]);}_0x43d062[_0x4f01('0x44')]=qs['sort'](_0x316cbe[_0x4f01('0x3b')][_0x4f01('0x45')]);_0x43d062['where']=qs['filters'](_[_0x4f01('0x46')](_0x316cbe[_0x4f01('0x3b')],_0x396958[_0x4f01('0x3d')]),_0x5b37f0);if(_0x316cbe[_0x4f01('0x3b')][_0x4f01('0x47')]){_0x43d062[_0x4f01('0x48')]=_[_0x4f01('0x49')](_0x43d062[_0x4f01('0x48')],{'$or':_[_0x4f01('0x35')](_0x5b37f0,function(_0x2e5dae){if(_0x2e5dae[_0x4f01('0x38')]!==_0x4f01('0x4a')){var _0x173d73={};_0x173d73[_0x2e5dae[_0x4f01('0x33')]]={'$like':'%'+_0x316cbe[_0x4f01('0x3b')][_0x4f01('0x47')]+'%'};return _0x173d73;}})});}_0x43d062=_[_0x4f01('0x49')]({},_0x43d062,_0x316cbe[_0x4f01('0x4b')]);var _0x56e255={'where':_0x43d062['where']};return db[_0x4f01('0x36')][_0x4f01('0x2a')](_0x56e255)['then'](function(_0x5d08df){_0x365850[_0x4f01('0x2a')]=_0x5d08df;if(_0x316cbe[_0x4f01('0x3b')][_0x4f01('0x4c')]){_0x43d062[_0x4f01('0x4d')]=[{'all':!![]}];}return db[_0x4f01('0x36')][_0x4f01('0x4e')](_0x43d062);})[_0x4f01('0x1a')](function(_0x182d4e){_0x365850[_0x4f01('0x4f')]=_0x182d4e;return _0x365850;})[_0x4f01('0x1a')](respondWithFilteredResult(_0x4389c2,_0x43d062))['catch'](handleError(_0x4389c2,null));};exports[_0x4f01('0x50')]=function(_0x129f5c,_0x4ac0e6){var _0x1b105f={'raw':![],'where':{'id':_0x129f5c[_0x4f01('0x51')]['id']}},_0x5917db={};_0x5917db['model']=_[_0x4f01('0x3c')](db[_0x4f01('0x36')][_0x4f01('0x52')]);_0x5917db[_0x4f01('0x3b')]=_[_0x4f01('0x3c')](_0x129f5c[_0x4f01('0x3b')]);_0x5917db[_0x4f01('0x3d')]=_[_0x4f01('0x3e')](_0x5917db[_0x4f01('0x3a')],_0x5917db[_0x4f01('0x3b')]);_0x1b105f['attributes']=_[_0x4f01('0x3e')](_0x5917db[_0x4f01('0x3a')],qs[_0x4f01('0x3f')](_0x129f5c['query'][_0x4f01('0x3f')]));_0x1b105f['attributes']=_0x1b105f[_0x4f01('0x40')][_0x4f01('0x53')]?_0x1b105f[_0x4f01('0x40')]:_0x5917db[_0x4f01('0x3a')];if(_0x129f5c['query']['includeAll']){_0x1b105f['include']=[{'all':!![]}];}_0x1b105f=_[_0x4f01('0x49')]({},_0x1b105f,_0x129f5c['options']);return db['Setting']['find'](_0x1b105f)[_0x4f01('0x1a')](handleEntityNotFound(_0x4ac0e6,null))['then'](respondWithResult(_0x4ac0e6,null))[_0x4f01('0x25')](handleError(_0x4ac0e6,null));};exports[_0x4f01('0x30')]=function(_0xdf628a,_0xcc831f){if(_0xdf628a[_0x4f01('0x54')]['id']){delete _0xdf628a['body']['id'];}return db['Setting'][_0x4f01('0x55')]({'where':{'id':_0xdf628a[_0x4f01('0x51')]['id']}})[_0x4f01('0x1a')](handleEntityNotFound(_0xcc831f,null))[_0x4f01('0x1a')](saveUpdates(_0xdf628a[_0x4f01('0x54')],null))[_0x4f01('0x1a')](respondWithResult(_0xcc831f,null))['catch'](handleError(_0xcc831f,null));};exports[_0x4f01('0x56')]=function(_0xc78c82,_0x3257c9,_0x32af88){if(_0xc78c82[_0x4f01('0x57')]&&_0xc78c82[_0x4f01('0x57')][_0x4f01('0x58')]){_0xc78c82[_0x4f01('0x54')][_0x4f01('0x59')]=_0xc78c82[_0x4f01('0x57')][_0x4f01('0x58')];}return db['Setting'][_0x4f01('0x55')]({'where':{'id':_0xc78c82[_0x4f01('0x51')]['id']}})[_0x4f01('0x1a')](handleEntityNotFound(_0x3257c9,null))['then'](saveUpdates(_0xc78c82[_0x4f01('0x54')],null))[_0x4f01('0x1a')](respondWithResult(_0x3257c9,null))['catch'](handleError(_0x3257c9,null));};exports[_0x4f01('0x5a')]=function(_0x5599ce,_0x13fc38,_0x46b832){if(_0x5599ce[_0x4f01('0x57')]&&_0x5599ce['file'][_0x4f01('0x58')]){_0x5599ce[_0x4f01('0x54')][_0x4f01('0x5b')]=_0x5599ce[_0x4f01('0x57')][_0x4f01('0x58')];}return db[_0x4f01('0x36')][_0x4f01('0x55')]({'where':{'id':_0x5599ce[_0x4f01('0x51')]['id']}})[_0x4f01('0x1a')](handleEntityNotFound(_0x13fc38,null))[_0x4f01('0x1a')](saveUpdates(_0x5599ce[_0x4f01('0x54')],null))[_0x4f01('0x1a')](respondWithResult(_0x13fc38,null))[_0x4f01('0x25')](handleError(_0x13fc38,null));};var utilLicense=require('../../config/license/util');exports[_0x4f01('0x5c')]=function(_0x2f576f,_0x2eb29b,_0x1d1517){var _0x2d0e5e='server/files/images/logos';var _0x5dd74a={'custom':![]};return utilLicense[_0x4f01('0x5d')]()[_0x4f01('0x1a')](function(_0x580ca4){if(_0x580ca4){_0x5dd74a=_0x580ca4;}return db['Setting']['find']({'where':{'id':_0x2f576f['params']['id']},'attributes':['logo',_0x4f01('0x5b'),_0x4f01('0x5e'),_0x4f01('0x5f'),_0x4f01('0x60'),_0x4f01('0x61'),_0x4f01('0x62'),_0x4f01('0x63')],'raw':!![]});})[_0x4f01('0x1a')](handleEntityNotFound(_0x2eb29b,null))[_0x4f01('0x1a')](function(_0x2ad54a){if(_0x2ad54a){var _0x110687=_0x2ad54a[_0x4f01('0x59')]&&fs[_0x4f01('0x64')](path[_0x4f01('0x65')](config[_0x4f01('0x66')],_0x2d0e5e,_['toLower'](_0x2ad54a[_0x4f01('0x59')])))?path['join'](config[_0x4f01('0x66')],_0x2d0e5e,_['toLower'](_0x2ad54a['logo'])):path['join'](config['root'],_0x2d0e5e,_['toLower'](_0x4f01('0x67')));var _0x3d189b=_0x4f01('0x68')+_[_0x4f01('0x69')]('logo');if(_0x2ad54a[_0x3d189b]||!_0x5dd74a['custom']){_0x110687=path[_0x4f01('0x65')](config[_0x4f01('0x66')],_0x2d0e5e,_[_0x4f01('0x6a')]('default_logo.svg'));}if(!fs[_0x4f01('0x64')](_0x110687)){throw new db[(_0x4f01('0x6b'))][(_0x4f01('0x6c'))](_[_0x4f01('0x69')]('logo')+_0x4f01('0x6d'));}return _0x2eb29b['download'](_0x110687);}})['catch'](handleError(_0x2eb29b,null));};var utilLicense=require(_0x4f01('0x6e'));exports['getLogoLogin']=function(_0x496f5a,_0x1e4d27,_0x1dc091){var _0x2fb095=_0x4f01('0x6f');var _0x2c4a44={'custom':![]};return utilLicense[_0x4f01('0x5d')]()[_0x4f01('0x1a')](function(_0x2a8f49){if(_0x2a8f49){_0x2c4a44=_0x2a8f49;}return db[_0x4f01('0x36')][_0x4f01('0x55')]({'where':{'id':_0x496f5a[_0x4f01('0x51')]['id']},'attributes':[_0x4f01('0x59'),_0x4f01('0x5b'),_0x4f01('0x5e'),_0x4f01('0x5f'),_0x4f01('0x60'),_0x4f01('0x61'),_0x4f01('0x62'),_0x4f01('0x63')],'raw':!![]});})[_0x4f01('0x1a')](handleEntityNotFound(_0x1e4d27,null))[_0x4f01('0x1a')](function(_0x53bbeb){if(_0x53bbeb){var _0xc1d045=_0x53bbeb['loginLogo']&&fs['existsSync'](path[_0x4f01('0x65')](config['root'],_0x2fb095,_[_0x4f01('0x6a')](_0x53bbeb['loginLogo'])))?path[_0x4f01('0x65')](config[_0x4f01('0x66')],_0x2fb095,_[_0x4f01('0x6a')](_0x53bbeb[_0x4f01('0x5b')])):path['join'](config[_0x4f01('0x66')],_0x2fb095,_[_0x4f01('0x6a')](_0x4f01('0x70')));var _0x4c66ad=_0x4f01('0x68')+_[_0x4f01('0x69')](_0x4f01('0x5b'));if(_0x53bbeb[_0x4c66ad]||!_0x2c4a44[_0x4f01('0x71')]){_0xc1d045=path[_0x4f01('0x65')](config[_0x4f01('0x66')],_0x2fb095,_[_0x4f01('0x6a')](_0x4f01('0x70')));}if(!fs[_0x4f01('0x64')](_0xc1d045)){throw new db[(_0x4f01('0x6b'))][(_0x4f01('0x6c'))](_['upperFirst'](_0x4f01('0x5b'))+_0x4f01('0x6d'));}return _0x1e4d27[_0x4f01('0x72')](_0xc1d045);}})[_0x4f01('0x25')](handleError(_0x1e4d27,null));};exports[_0x4f01('0x73')]=function(_0x16c37b,_0x3da1da){return db[_0x4f01('0x36')][_0x4f01('0x55')]({'where':{'id':_0x16c37b[_0x4f01('0x51')]['id']},'attributes':[_0x4f01('0x74')]})[_0x4f01('0x1a')](respondWithResult(_0x3da1da,null))['catch'](handleError(_0x3da1da,null));};exports[_0x4f01('0x75')]=function(_0x2a08c2,_0x3b568a,_0x2085a4){if(_0x2a08c2[_0x4f01('0x57')]&&_0x2a08c2[_0x4f01('0x57')][_0x4f01('0x58')]){_0x2a08c2['body']['preferred']=_0x2a08c2[_0x4f01('0x57')][_0x4f01('0x58')];}return db[_0x4f01('0x36')][_0x4f01('0x55')]({'where':{'id':_0x2a08c2[_0x4f01('0x51')]['id']}})['then'](handleEntityNotFound(_0x3b568a,null))[_0x4f01('0x1a')](saveUpdates(_0x2a08c2[_0x4f01('0x54')],null))['then'](respondWithResult(_0x3b568a,null))[_0x4f01('0x25')](handleError(_0x3b568a,null));};var utilLicense=require(_0x4f01('0x6e'));exports[_0x4f01('0x76')]=function(_0x170cdf,_0x3579aa,_0x35a536){var _0x83edb7=_0x4f01('0x6f');var _0xe117f0={'custom':![]};return utilLicense[_0x4f01('0x5d')]()[_0x4f01('0x1a')](function(_0x18828f){if(_0x18828f){_0xe117f0=_0x18828f;}return db['Setting']['find']({'where':{'id':_0x170cdf['params']['id']},'attributes':[_0x4f01('0x59'),'loginLogo','preferred',_0x4f01('0x5f'),_0x4f01('0x60'),_0x4f01('0x61'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3579aa,null))['then'](function(_0x2689e0){if(_0x2689e0){var _0x1b1f83=_0x2689e0[_0x4f01('0x5e')]&&fs[_0x4f01('0x64')](path[_0x4f01('0x65')](config['root'],_0x83edb7,_[_0x4f01('0x6a')](_0x2689e0[_0x4f01('0x5e')])))?path[_0x4f01('0x65')](config[_0x4f01('0x66')],_0x83edb7,_[_0x4f01('0x6a')](_0x2689e0[_0x4f01('0x5e')])):path[_0x4f01('0x65')](config[_0x4f01('0x66')],_0x83edb7,_[_0x4f01('0x6a')](_0x4f01('0x77')));var _0xb955e5=_0x4f01('0x68')+_[_0x4f01('0x69')](_0x4f01('0x5e'));if(_0x2689e0[_0xb955e5]||!_0xe117f0[_0x4f01('0x71')]||!_0xe117f0[_0x4f01('0x5e')]){_0x1b1f83=path[_0x4f01('0x65')](config[_0x4f01('0x66')],_0x83edb7,_[_0x4f01('0x6a')](_0x4f01('0x77')));}if(!fs[_0x4f01('0x64')](_0x1b1f83)){throw new db[(_0x4f01('0x6b'))][(_0x4f01('0x6c'))](_['upperFirst']('preferred')+_0x4f01('0x6d'));}return _0x3579aa['download'](_0x1b1f83);}})[_0x4f01('0x25')](handleError(_0x3579aa,null));};exports['addFavicon']=function(_0x15c6a1,_0x47c223,_0x359633){if(_0x15c6a1['file']&&_0x15c6a1['file'][_0x4f01('0x58')]){_0x15c6a1[_0x4f01('0x54')][_0x4f01('0x5f')]=_0x15c6a1[_0x4f01('0x57')][_0x4f01('0x58')];}return db[_0x4f01('0x36')][_0x4f01('0x55')]({'where':{'id':_0x15c6a1[_0x4f01('0x51')]['id']}})[_0x4f01('0x1a')](handleEntityNotFound(_0x47c223,null))[_0x4f01('0x1a')](saveUpdates(_0x15c6a1['body'],null))[_0x4f01('0x1a')](respondWithResult(_0x47c223,null))[_0x4f01('0x25')](handleError(_0x47c223,null));};var utilLicense=require(_0x4f01('0x6e'));exports['getFavicon']=function(_0x20b058,_0x173976,_0x2ad49d){var _0x47449f='server/files/images/logos';var _0x41f5f9={'custom':![]};return utilLicense[_0x4f01('0x5d')]()['then'](function(_0x445644){if(_0x445644){_0x41f5f9=_0x445644;}return db[_0x4f01('0x36')]['find']({'where':{'id':_0x20b058['params']['id']},'attributes':['logo',_0x4f01('0x5b'),_0x4f01('0x5e'),_0x4f01('0x5f'),_0x4f01('0x60'),_0x4f01('0x61'),'defaultPreferred',_0x4f01('0x63')],'raw':!![]});})[_0x4f01('0x1a')](handleEntityNotFound(_0x173976,null))['then'](function(_0x5adcf2){if(_0x5adcf2){var _0x4ede74=_0x5adcf2[_0x4f01('0x5f')]&&fs[_0x4f01('0x64')](path['join'](config[_0x4f01('0x66')],_0x47449f,_['toLower'](_0x5adcf2[_0x4f01('0x5f')])))?path[_0x4f01('0x65')](config[_0x4f01('0x66')],_0x47449f,_['toLower'](_0x5adcf2[_0x4f01('0x5f')])):path[_0x4f01('0x65')](config[_0x4f01('0x66')],_0x47449f,_[_0x4f01('0x6a')](_0x4f01('0x78')));var _0xebd313=_0x4f01('0x68')+_[_0x4f01('0x69')](_0x4f01('0x5f'));if(_0x5adcf2[_0xebd313]||!_0x41f5f9['custom']){_0x4ede74=path[_0x4f01('0x65')](config['root'],_0x47449f,_[_0x4f01('0x6a')](_0x4f01('0x78')));}if(!fs['existsSync'](_0x4ede74)){throw new db[(_0x4f01('0x6b'))]['ValidationError'](_['upperFirst'](_0x4f01('0x5f'))+_0x4f01('0x6d'));}return _0x173976[_0x4f01('0x72')](_0x4ede74);}})[_0x4f01('0x25')](handleError(_0x173976,null));};exports['getDate']=function(_0x9fa6ba,_0x1b3319){var _0x59fff7={'offset':moment()[_0x4f01('0x79')]()};_0x59fff7[_0x4f01('0x7a')]=moment()[_0x4f01('0x79')](_0x59fff7['offset'])[_0x4f01('0x7b')](_0x4f01('0x7c'));return _0x1b3319[_0x4f01('0x28')](0xc8)[_0x4f01('0x7d')](_0x59fff7);}; \ No newline at end of file +var _0x8a87=['addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','root','toLower','join','upperFirst','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','defaultFavicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','custom','addFavicon','getFavicon','default','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Setting,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','offset','limit','set','apply','then','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','params','find','update','addLogo','file','logo','filename','body'];(function(_0x3d011b,_0x35826b){var _0x276944=function(_0x292aeb){while(--_0x292aeb){_0x3d011b['push'](_0x3d011b['shift']());}};_0x276944(++_0x35826b);}(_0x8a87,0x115));var _0x78a8=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0x8a87[_0x21b36c];return _0x236627;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x78a8('0x0'));var rimraf=require(_0x78a8('0x1'));var zipdir=require(_0x78a8('0x2'));var jsonpatch=require(_0x78a8('0x3'));var rp=require('request-promise');var moment=require(_0x78a8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x78a8('0x5'));var util=require(_0x78a8('0x6'));var path=require(_0x78a8('0x7'));var sox=require(_0x78a8('0x8'));var csv=require(_0x78a8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x78a8('0xa'));var squel=require('squel');var crypto=require(_0x78a8('0xb'));var jsforce=require(_0x78a8('0xc'));var deskjs=require(_0x78a8('0xd'));var toCsv=require(_0x78a8('0x9'));var querystring=require(_0x78a8('0xe'));var Papa=require(_0x78a8('0xf'));var Redis=require(_0x78a8('0x10'));var authService=require(_0x78a8('0x11'));var qs=require(_0x78a8('0x12'));var as=require(_0x78a8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x78a8('0x14'));var config=require(_0x78a8('0x15'));var licenseUtil=require(_0x78a8('0x16'));var db=require(_0x78a8('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x78a8('0x18')][_0x78a8('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x456303,_0x17c012,_0x59e6a5,_0x44ab2f){return new BPromise(function(_0x485979,_0x424806){var _0x14d995=_0x44ab2f||client;return _0x14d995[_0x78a8('0x1a')](_0x456303,_0x59e6a5)['then'](function(_0x1724aa){logger['info']('Setting,\x20%s,\x20%s',_0x17c012,_0x78a8('0x1b'));logger[_0x78a8('0x1c')](_0x78a8('0x1d'),_0x17c012,_0x78a8('0x1b'),JSON[_0x78a8('0x1e')](_0x1724aa));if(_0x1724aa['error']){if(_0x1724aa['error'][_0x78a8('0x1f')]===0x1f4){logger[_0x78a8('0x20')]('Setting,\x20%s,\x20%s',_0x17c012,_0x1724aa['error'][_0x78a8('0x21')]);return _0x424806(_0x1724aa['error'][_0x78a8('0x21')]);}logger[_0x78a8('0x20')](_0x78a8('0x22'),_0x17c012,_0x1724aa[_0x78a8('0x20')][_0x78a8('0x21')]);return _0x485979(_0x1724aa[_0x78a8('0x20')][_0x78a8('0x21')]);}else{logger[_0x78a8('0x23')](_0x78a8('0x22'),_0x17c012,_0x78a8('0x1b'));_0x485979(_0x1724aa[_0x78a8('0x24')]['message']);}})[_0x78a8('0x25')](function(_0x50c426){logger[_0x78a8('0x20')](_0x78a8('0x22'),_0x17c012,_0x50c426);_0x424806(_0x50c426);});});}function respondWithStatusCode(_0x5a6c77,_0x223d75){_0x223d75=_0x223d75||0xcc;return function(_0x29ae5d){if(_0x29ae5d){return _0x5a6c77[_0x78a8('0x26')](_0x223d75);}return _0x5a6c77[_0x78a8('0x27')](_0x223d75)[_0x78a8('0x28')]();};}function respondWithResult(_0x2af064,_0x414fec){_0x414fec=_0x414fec||0xc8;return function(_0x42ac38){if(_0x42ac38){return _0x2af064[_0x78a8('0x27')](_0x414fec)[_0x78a8('0x29')](_0x42ac38);}};}function respondWithFilteredResult(_0x77d6b4,_0x5b8d26){return function(_0x14ebd5){if(_0x14ebd5){var _0x4c2aaa=_0x14ebd5['count'],_0x59c10b=_0x5b8d26[_0x78a8('0x2a')],_0x273d9a=_0x5b8d26[_0x78a8('0x2a')]+_0x5b8d26[_0x78a8('0x2b')],_0x464abe;if(_0x273d9a>=_0x4c2aaa){_0x273d9a=_0x4c2aaa;_0x464abe=0xc8;}else{_0x464abe=0xce;}_0x77d6b4[_0x78a8('0x27')](_0x464abe);return _0x77d6b4[_0x78a8('0x2c')]('Content-Range',_0x59c10b+'-'+_0x273d9a+'/'+_0x4c2aaa)[_0x78a8('0x29')](_0x14ebd5);}return null;};}function patchUpdates(_0x4ccbde){return function(_0x2d84c1){try{jsonpatch[_0x78a8('0x2d')](_0x2d84c1,_0x4ccbde,!![]);}catch(_0x454bfc){return BPromise['reject'](_0x454bfc);}return _0x2d84c1['save']();};}function saveUpdates(_0x56b06b,_0x11a290){return function(_0x31aeaa){if(_0x31aeaa){return _0x31aeaa['update'](_0x56b06b)[_0x78a8('0x2e')](function(_0x13266c){return _0x13266c;});}return null;};}function removeEntity(_0x2f835c,_0x4848ab){return function(_0x182863){if(_0x182863){return _0x182863['destroy']()[_0x78a8('0x2e')](function(){_0x2f835c[_0x78a8('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df76e,_0x1f7cb6){return function(_0x421ddb){if(!_0x421ddb){_0x3df76e[_0x78a8('0x26')](0x194);}return _0x421ddb;};}function handleError(_0x10eb8b,_0x7094ed){_0x7094ed=_0x7094ed||0x1f4;return function(_0x40c7b1){logger['error'](_0x40c7b1[_0x78a8('0x2f')]);if(_0x40c7b1[_0x78a8('0x30')]){delete _0x40c7b1[_0x78a8('0x30')];}_0x10eb8b[_0x78a8('0x27')](_0x7094ed)[_0x78a8('0x31')](_0x40c7b1);};}exports[_0x78a8('0x32')]=function(_0x24555c,_0x1b4190){var _0x20e085={},_0x4704b6={},_0x4ae9af={'count':0x0,'rows':[]};var _0x3988ee=_[_0x78a8('0x33')](db[_0x78a8('0x34')][_0x78a8('0x35')],function(_0xa8f715){return{'name':_0xa8f715[_0x78a8('0x36')],'type':_0xa8f715[_0x78a8('0x37')][_0x78a8('0x38')]};});_0x4704b6['model']=_[_0x78a8('0x33')](_0x3988ee,_0x78a8('0x30'));_0x4704b6[_0x78a8('0x39')]=_[_0x78a8('0x3a')](_0x24555c[_0x78a8('0x39')]);_0x4704b6['filters']=_[_0x78a8('0x3b')](_0x4704b6[_0x78a8('0x3c')],_0x4704b6[_0x78a8('0x39')]);_0x20e085[_0x78a8('0x3d')]=_[_0x78a8('0x3b')](_0x4704b6[_0x78a8('0x3c')],qs[_0x78a8('0x3e')](_0x24555c[_0x78a8('0x39')][_0x78a8('0x3e')]));_0x20e085[_0x78a8('0x3d')]=_0x20e085[_0x78a8('0x3d')][_0x78a8('0x3f')]?_0x20e085[_0x78a8('0x3d')]:_0x4704b6['model'];if(!_0x24555c[_0x78a8('0x39')][_0x78a8('0x40')](_0x78a8('0x41'))){_0x20e085[_0x78a8('0x2b')]=qs['limit'](_0x24555c['query']['limit']);_0x20e085[_0x78a8('0x2a')]=qs[_0x78a8('0x2a')](_0x24555c[_0x78a8('0x39')]['offset']);}_0x20e085[_0x78a8('0x42')]=qs[_0x78a8('0x43')](_0x24555c[_0x78a8('0x39')][_0x78a8('0x43')]);_0x20e085[_0x78a8('0x44')]=qs[_0x78a8('0x45')](_[_0x78a8('0x46')](_0x24555c['query'],_0x4704b6[_0x78a8('0x45')]),_0x3988ee);if(_0x24555c[_0x78a8('0x39')][_0x78a8('0x47')]){_0x20e085['where']=_[_0x78a8('0x48')](_0x20e085['where'],{'$or':_[_0x78a8('0x33')](_0x3988ee,function(_0x5520cd){if(_0x5520cd[_0x78a8('0x37')]!=='VIRTUAL'){var _0x82f8c7={};_0x82f8c7[_0x5520cd['name']]={'$like':'%'+_0x24555c[_0x78a8('0x39')][_0x78a8('0x47')]+'%'};return _0x82f8c7;}})});}_0x20e085=_['merge']({},_0x20e085,_0x24555c[_0x78a8('0x49')]);var _0x1cc891={'where':_0x20e085[_0x78a8('0x44')]};return db[_0x78a8('0x34')]['count'](_0x1cc891)['then'](function(_0x8fb0ce){_0x4ae9af[_0x78a8('0x4a')]=_0x8fb0ce;if(_0x24555c['query'][_0x78a8('0x4b')]){_0x20e085[_0x78a8('0x4c')]=[{'all':!![]}];}return db['Setting'][_0x78a8('0x4d')](_0x20e085);})['then'](function(_0x2c4dca){_0x4ae9af['rows']=_0x2c4dca;return _0x4ae9af;})[_0x78a8('0x2e')](respondWithFilteredResult(_0x1b4190,_0x20e085))['catch'](handleError(_0x1b4190,null));};exports['show']=function(_0x30c7bd,_0x4d71ad){var _0x37c7e9={'raw':![],'where':{'id':_0x30c7bd[_0x78a8('0x4e')]['id']}},_0x3aad49={};_0x3aad49['model']=_[_0x78a8('0x3a')](db['Setting'][_0x78a8('0x35')]);_0x3aad49[_0x78a8('0x39')]=_[_0x78a8('0x3a')](_0x30c7bd['query']);_0x3aad49['filters']=_[_0x78a8('0x3b')](_0x3aad49[_0x78a8('0x3c')],_0x3aad49[_0x78a8('0x39')]);_0x37c7e9[_0x78a8('0x3d')]=_[_0x78a8('0x3b')](_0x3aad49[_0x78a8('0x3c')],qs[_0x78a8('0x3e')](_0x30c7bd[_0x78a8('0x39')][_0x78a8('0x3e')]));_0x37c7e9['attributes']=_0x37c7e9[_0x78a8('0x3d')][_0x78a8('0x3f')]?_0x37c7e9['attributes']:_0x3aad49[_0x78a8('0x3c')];if(_0x30c7bd[_0x78a8('0x39')][_0x78a8('0x4b')]){_0x37c7e9[_0x78a8('0x4c')]=[{'all':!![]}];}_0x37c7e9=_[_0x78a8('0x48')]({},_0x37c7e9,_0x30c7bd[_0x78a8('0x49')]);return db['Setting'][_0x78a8('0x4f')](_0x37c7e9)[_0x78a8('0x2e')](handleEntityNotFound(_0x4d71ad,null))['then'](respondWithResult(_0x4d71ad,null))['catch'](handleError(_0x4d71ad,null));};exports[_0x78a8('0x50')]=function(_0x6e70e9,_0x364cdf){if(_0x6e70e9['body']['id']){delete _0x6e70e9['body']['id'];}return db[_0x78a8('0x34')]['find']({'where':{'id':_0x6e70e9[_0x78a8('0x4e')]['id']}})[_0x78a8('0x2e')](handleEntityNotFound(_0x364cdf,null))[_0x78a8('0x2e')](saveUpdates(_0x6e70e9['body'],null))[_0x78a8('0x2e')](respondWithResult(_0x364cdf,null))['catch'](handleError(_0x364cdf,null));};exports[_0x78a8('0x51')]=function(_0xfd169e,_0x50c216,_0xbe6cbf){if(_0xfd169e[_0x78a8('0x52')]&&_0xfd169e[_0x78a8('0x52')]['filename']){_0xfd169e['body'][_0x78a8('0x53')]=_0xfd169e['file'][_0x78a8('0x54')];}return db[_0x78a8('0x34')][_0x78a8('0x4f')]({'where':{'id':_0xfd169e['params']['id']}})['then'](handleEntityNotFound(_0x50c216,null))[_0x78a8('0x2e')](saveUpdates(_0xfd169e[_0x78a8('0x55')],null))[_0x78a8('0x2e')](respondWithResult(_0x50c216,null))[_0x78a8('0x25')](handleError(_0x50c216,null));};exports[_0x78a8('0x56')]=function(_0x4322b5,_0x33261e,_0x35a2bc){if(_0x4322b5[_0x78a8('0x52')]&&_0x4322b5[_0x78a8('0x52')][_0x78a8('0x54')]){_0x4322b5[_0x78a8('0x55')][_0x78a8('0x57')]=_0x4322b5[_0x78a8('0x52')]['filename'];}return db[_0x78a8('0x34')][_0x78a8('0x4f')]({'where':{'id':_0x4322b5[_0x78a8('0x4e')]['id']}})[_0x78a8('0x2e')](handleEntityNotFound(_0x33261e,null))[_0x78a8('0x2e')](saveUpdates(_0x4322b5[_0x78a8('0x55')],null))[_0x78a8('0x2e')](respondWithResult(_0x33261e,null))['catch'](handleError(_0x33261e,null));};var utilLicense=require(_0x78a8('0x16'));exports['getLogo']=function(_0x3ab999,_0x3a8122,_0x3634ff){var _0x2ec1ba=_0x78a8('0x58');var _0x5eac41={'custom':![]};return utilLicense[_0x78a8('0x59')]()[_0x78a8('0x2e')](function(_0x267655){if(_0x267655){_0x5eac41=_0x267655;}return db[_0x78a8('0x34')][_0x78a8('0x4f')]({'where':{'id':_0x3ab999[_0x78a8('0x4e')]['id']},'attributes':[_0x78a8('0x53'),'loginLogo',_0x78a8('0x5a'),'favicon',_0x78a8('0x5b'),_0x78a8('0x5c'),_0x78a8('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x78a8('0x2e')](handleEntityNotFound(_0x3a8122,null))[_0x78a8('0x2e')](function(_0x134529){if(_0x134529){var _0x90c2de=_0x134529[_0x78a8('0x53')]&&fs['existsSync'](path['join'](config[_0x78a8('0x5e')],_0x2ec1ba,_[_0x78a8('0x5f')](_0x134529[_0x78a8('0x53')])))?path['join'](config[_0x78a8('0x5e')],_0x2ec1ba,_[_0x78a8('0x5f')](_0x134529[_0x78a8('0x53')])):path[_0x78a8('0x60')](config[_0x78a8('0x5e')],_0x2ec1ba,_[_0x78a8('0x5f')]('default_logo.svg'));var _0x25f447='default'+_[_0x78a8('0x61')]('logo');if(_0x134529[_0x25f447]||!_0x5eac41['custom']){_0x90c2de=path[_0x78a8('0x60')](config[_0x78a8('0x5e')],_0x2ec1ba,_[_0x78a8('0x5f')]('default_logo.svg'));}if(!fs[_0x78a8('0x62')](_0x90c2de)){throw new db[(_0x78a8('0x63'))][(_0x78a8('0x64'))](_[_0x78a8('0x61')](_0x78a8('0x53'))+_0x78a8('0x65'));}return _0x3a8122[_0x78a8('0x66')](_0x90c2de);}})['catch'](handleError(_0x3a8122,null));};var utilLicense=require(_0x78a8('0x16'));exports[_0x78a8('0x67')]=function(_0x1da17,_0x57cf1d,_0x4792fe){var _0x132ecc=_0x78a8('0x58');var _0x7a6a38={'custom':![]};return utilLicense[_0x78a8('0x59')]()[_0x78a8('0x2e')](function(_0x3c3105){if(_0x3c3105){_0x7a6a38=_0x3c3105;}return db[_0x78a8('0x34')][_0x78a8('0x4f')]({'where':{'id':_0x1da17['params']['id']},'attributes':[_0x78a8('0x53'),'loginLogo','preferred',_0x78a8('0x68'),_0x78a8('0x5b'),_0x78a8('0x5c'),_0x78a8('0x5d'),_0x78a8('0x69')],'raw':!![]});})[_0x78a8('0x2e')](handleEntityNotFound(_0x57cf1d,null))[_0x78a8('0x2e')](function(_0x3e9018){if(_0x3e9018){var _0x383058=_0x3e9018[_0x78a8('0x57')]&&fs[_0x78a8('0x62')](path[_0x78a8('0x60')](config['root'],_0x132ecc,_[_0x78a8('0x5f')](_0x3e9018[_0x78a8('0x57')])))?path[_0x78a8('0x60')](config['root'],_0x132ecc,_[_0x78a8('0x5f')](_0x3e9018[_0x78a8('0x57')])):path['join'](config[_0x78a8('0x5e')],_0x132ecc,_[_0x78a8('0x5f')](_0x78a8('0x6a')));var _0x4da055='default'+_[_0x78a8('0x61')]('loginLogo');if(_0x3e9018[_0x4da055]||!_0x7a6a38['custom']){_0x383058=path['join'](config[_0x78a8('0x5e')],_0x132ecc,_['toLower']('default_loginLogo.svg'));}if(!fs['existsSync'](_0x383058)){throw new db[(_0x78a8('0x63'))][(_0x78a8('0x64'))](_[_0x78a8('0x61')](_0x78a8('0x57'))+_0x78a8('0x65'));}return _0x57cf1d[_0x78a8('0x66')](_0x383058);}})[_0x78a8('0x25')](handleError(_0x57cf1d,null));};exports[_0x78a8('0x6b')]=function(_0x5d68cf,_0x2356cb){return db['Setting']['find']({'where':{'id':_0x5d68cf[_0x78a8('0x4e')]['id']},'attributes':[_0x78a8('0x6c')]})[_0x78a8('0x2e')](respondWithResult(_0x2356cb,null))['catch'](handleError(_0x2356cb,null));};exports[_0x78a8('0x6d')]=function(_0xa87980,_0x4d4377,_0x3d964f){if(_0xa87980[_0x78a8('0x52')]&&_0xa87980['file'][_0x78a8('0x54')]){_0xa87980[_0x78a8('0x55')][_0x78a8('0x5a')]=_0xa87980[_0x78a8('0x52')]['filename'];}return db[_0x78a8('0x34')][_0x78a8('0x4f')]({'where':{'id':_0xa87980[_0x78a8('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d4377,null))[_0x78a8('0x2e')](saveUpdates(_0xa87980[_0x78a8('0x55')],null))[_0x78a8('0x2e')](respondWithResult(_0x4d4377,null))[_0x78a8('0x25')](handleError(_0x4d4377,null));};var utilLicense=require(_0x78a8('0x16'));exports[_0x78a8('0x6e')]=function(_0x59f45f,_0x525052,_0x2ca27e){var _0x155be1=_0x78a8('0x58');var _0xfd3d1a={'custom':![]};return utilLicense[_0x78a8('0x59')]()[_0x78a8('0x2e')](function(_0x4018d2){if(_0x4018d2){_0xfd3d1a=_0x4018d2;}return db[_0x78a8('0x34')]['find']({'where':{'id':_0x59f45f['params']['id']},'attributes':[_0x78a8('0x53'),'loginLogo',_0x78a8('0x5a'),'favicon',_0x78a8('0x5b'),_0x78a8('0x5c'),_0x78a8('0x5d'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x525052,null))[_0x78a8('0x2e')](function(_0x36404f){if(_0x36404f){var _0x241863=_0x36404f[_0x78a8('0x5a')]&&fs['existsSync'](path['join'](config[_0x78a8('0x5e')],_0x155be1,_[_0x78a8('0x5f')](_0x36404f[_0x78a8('0x5a')])))?path[_0x78a8('0x60')](config[_0x78a8('0x5e')],_0x155be1,_[_0x78a8('0x5f')](_0x36404f[_0x78a8('0x5a')])):path[_0x78a8('0x60')](config[_0x78a8('0x5e')],_0x155be1,_[_0x78a8('0x5f')](_0x78a8('0x6f')));var _0x5da705='default'+_[_0x78a8('0x61')](_0x78a8('0x5a'));if(_0x36404f[_0x5da705]||!_0xfd3d1a[_0x78a8('0x70')]||!_0xfd3d1a[_0x78a8('0x5a')]){_0x241863=path['join'](config[_0x78a8('0x5e')],_0x155be1,_[_0x78a8('0x5f')](_0x78a8('0x6f')));}if(!fs[_0x78a8('0x62')](_0x241863)){throw new db['Sequelize'][(_0x78a8('0x64'))](_[_0x78a8('0x61')](_0x78a8('0x5a'))+_0x78a8('0x65'));}return _0x525052[_0x78a8('0x66')](_0x241863);}})['catch'](handleError(_0x525052,null));};exports[_0x78a8('0x71')]=function(_0x113a14,_0x2e54d5,_0x5cddae){if(_0x113a14['file']&&_0x113a14['file'][_0x78a8('0x54')]){_0x113a14['body'][_0x78a8('0x68')]=_0x113a14[_0x78a8('0x52')][_0x78a8('0x54')];}return db['Setting']['find']({'where':{'id':_0x113a14['params']['id']}})[_0x78a8('0x2e')](handleEntityNotFound(_0x2e54d5,null))['then'](saveUpdates(_0x113a14['body'],null))[_0x78a8('0x2e')](respondWithResult(_0x2e54d5,null))['catch'](handleError(_0x2e54d5,null));};var utilLicense=require(_0x78a8('0x16'));exports[_0x78a8('0x72')]=function(_0x4de7ca,_0x353ce4,_0x3485ad){var _0x133546='server/files/images/logos';var _0x3ef8a6={'custom':![]};return utilLicense[_0x78a8('0x59')]()['then'](function(_0x365f67){if(_0x365f67){_0x3ef8a6=_0x365f67;}return db[_0x78a8('0x34')][_0x78a8('0x4f')]({'where':{'id':_0x4de7ca['params']['id']},'attributes':[_0x78a8('0x53'),_0x78a8('0x57'),'preferred',_0x78a8('0x68'),_0x78a8('0x5b'),_0x78a8('0x5c'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x78a8('0x2e')](handleEntityNotFound(_0x353ce4,null))[_0x78a8('0x2e')](function(_0x41f0f6){if(_0x41f0f6){var _0x553c06=_0x41f0f6[_0x78a8('0x68')]&&fs[_0x78a8('0x62')](path['join'](config[_0x78a8('0x5e')],_0x133546,_[_0x78a8('0x5f')](_0x41f0f6[_0x78a8('0x68')])))?path['join'](config['root'],_0x133546,_[_0x78a8('0x5f')](_0x41f0f6['favicon'])):path[_0x78a8('0x60')](config[_0x78a8('0x5e')],_0x133546,_[_0x78a8('0x5f')]('default_favicon.ico'));var _0x23fb11=_0x78a8('0x73')+_['upperFirst'](_0x78a8('0x68'));if(_0x41f0f6[_0x23fb11]||!_0x3ef8a6[_0x78a8('0x70')]){_0x553c06=path[_0x78a8('0x60')](config[_0x78a8('0x5e')],_0x133546,_[_0x78a8('0x5f')](_0x78a8('0x74')));}if(!fs[_0x78a8('0x62')](_0x553c06)){throw new db[(_0x78a8('0x63'))]['ValidationError'](_[_0x78a8('0x61')](_0x78a8('0x68'))+'\x20not\x20found');}return _0x353ce4[_0x78a8('0x66')](_0x553c06);}})[_0x78a8('0x25')](handleError(_0x353ce4,null));};exports['getDate']=function(_0x446769,_0x5336b7){var _0x49bc72={'offset':moment()[_0x78a8('0x75')]()};_0x49bc72[_0x78a8('0x76')]=moment()[_0x78a8('0x75')](_0x49bc72[_0x78a8('0x2a')])[_0x78a8('0x77')](_0x78a8('0x78'));return _0x5336b7[_0x78a8('0x27')](0xc8)[_0x78a8('0x31')](_0x49bc72);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index fc2113b..dec6116 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 _0xa6e9=['api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','define','Setting','util','../../config/logger'];(function(_0x30f372,_0x95f455){var _0x2d3a99=function(_0x537ed8){while(--_0x537ed8){_0x30f372['push'](_0x30f372['shift']());}};_0x2d3a99(++_0x95f455);}(_0xa6e9,0x112));var _0x9a6e=function(_0x3df785,_0x220177){_0x3df785=_0x3df785-0x0;var _0x5a7f57=_0xa6e9[_0x3df785];return _0x5a7f57;};'use strict';var _=require('lodash');var util=require(_0x9a6e('0x0'));var logger=require(_0x9a6e('0x1'))(_0x9a6e('0x2'));var moment=require('moment');var BPromise=require(_0x9a6e('0x3'));var rp=require(_0x9a6e('0x4'));var fs=require('fs');var path=require(_0x9a6e('0x5'));var rimraf=require(_0x9a6e('0x6'));var config=require(_0x9a6e('0x7'));var attributes=require(_0x9a6e('0x8'));module[_0x9a6e('0x9')]=function(_0x10d4aa,_0x4a2070){return _0x10d4aa[_0x9a6e('0xa')](_0x9a6e('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e13=['moment','bluebird','request-promise','rimraf','../../config/environment','./setting.attributes','exports','define','Setting','lodash','util','api'];(function(_0x1e0498,_0x172314){var _0x368419=function(_0x334829){while(--_0x334829){_0x1e0498['push'](_0x1e0498['shift']());}};_0x368419(++_0x172314);}(_0x4e13,0xb1));var _0x34e1=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0x4e13[_0x2cc711];return _0x31a52e;};'use strict';var _=require(_0x34e1('0x0'));var util=require(_0x34e1('0x1'));var logger=require('../../config/logger')(_0x34e1('0x2'));var moment=require(_0x34e1('0x3'));var BPromise=require(_0x34e1('0x4'));var rp=require(_0x34e1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x34e1('0x6'));var config=require(_0x34e1('0x7'));var attributes=require(_0x34e1('0x8'));module[_0x34e1('0x9')]=function(_0xcb4850,_0x190172){return _0xcb4850[_0x34e1('0xa')](_0x34e1('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 09a0c98..1823158 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 _0x4227=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x205e5b,_0x3d9293){var _0x2e60db=function(_0x2e2620){while(--_0x2e2620){_0x205e5b['push'](_0x205e5b['shift']());}};_0x2e60db(++_0x3d9293);}(_0x4227,0x1e5));var _0x7422=function(_0x29bb52,_0x56c291){_0x29bb52=_0x29bb52-0x0;var _0x2b498a=_0x4227[_0x29bb52];return _0x2b498a;};'use strict';var _=require(_0x7422('0x0'));var util=require('util');var moment=require(_0x7422('0x1'));var BPromise=require(_0x7422('0x2'));var rs=require(_0x7422('0x3'));var fs=require('fs');var Redis=require(_0x7422('0x4'));var db=require(_0x7422('0x5'))['db'];var utils=require(_0x7422('0x6'));var logger=require(_0x7422('0x7'))(_0x7422('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7422('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4078ac,_0x55a7b8,_0x67dda7){return new BPromise(function(_0x1d7be4,_0x37ad8f){return client[_0x7422('0xa')](_0x4078ac,_0x67dda7)[_0x7422('0xb')](function(_0x56f91a){logger[_0x7422('0xc')](_0x7422('0xd'),_0x55a7b8,_0x7422('0xe'));logger[_0x7422('0xf')](_0x7422('0x10'),_0x55a7b8,_0x7422('0xe'),JSON[_0x7422('0x11')](_0x56f91a));if(_0x56f91a[_0x7422('0x12')]){if(_0x56f91a[_0x7422('0x12')][_0x7422('0x13')]===0x1f4){logger[_0x7422('0x12')](_0x7422('0xd'),_0x55a7b8,_0x56f91a[_0x7422('0x12')][_0x7422('0x14')]);return _0x37ad8f(_0x56f91a[_0x7422('0x12')]['message']);}logger['error'](_0x7422('0xd'),_0x55a7b8,_0x56f91a[_0x7422('0x12')][_0x7422('0x14')]);return _0x1d7be4(_0x56f91a[_0x7422('0x12')]['message']);}else{logger['info'](_0x7422('0xd'),_0x55a7b8,'request\x20sent');_0x1d7be4(_0x56f91a[_0x7422('0x15')][_0x7422('0x14')]);}})[_0x7422('0x16')](function(_0x583483){logger['error']('Setting,\x20%s,\x20%s',_0x55a7b8,_0x583483);_0x37ad8f(_0x583483);});});} \ No newline at end of file +var _0xf84d=['jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','../../config/logger','rpc'];(function(_0x2e30b0,_0x3be40e){var _0x5167d4=function(_0x24d1db){while(--_0x24d1db){_0x2e30b0['push'](_0x2e30b0['shift']());}};_0x5167d4(++_0x3be40e);}(_0xf84d,0x14e));var _0xdf84=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xf84d[_0x1afabf];return _0x497ff1;};'use strict';var _=require(_0xdf84('0x0'));var util=require(_0xdf84('0x1'));var moment=require(_0xdf84('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf84('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdf84('0x4'))(_0xdf84('0x5'));var config=require('../../config/environment');var jayson=require(_0xdf84('0x6'));var client=jayson[_0xdf84('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf37208,_0x174bcf,_0x21f26d){return new BPromise(function(_0x1345ad,_0x23bfbc){return client[_0xdf84('0x8')](_0xf37208,_0x21f26d)[_0xdf84('0x9')](function(_0x267641){logger['info'](_0xdf84('0xa'),_0x174bcf,_0xdf84('0xb'));logger[_0xdf84('0xc')](_0xdf84('0xd'),_0x174bcf,_0xdf84('0xb'),JSON[_0xdf84('0xe')](_0x267641));if(_0x267641[_0xdf84('0xf')]){if(_0x267641['error'][_0xdf84('0x10')]===0x1f4){logger['error'](_0xdf84('0xa'),_0x174bcf,_0x267641['error'][_0xdf84('0x11')]);return _0x23bfbc(_0x267641[_0xdf84('0xf')][_0xdf84('0x11')]);}logger['error'](_0xdf84('0xa'),_0x174bcf,_0x267641[_0xdf84('0xf')][_0xdf84('0x11')]);return _0x1345ad(_0x267641['error'][_0xdf84('0x11')]);}else{logger[_0xdf84('0x12')](_0xdf84('0xa'),_0x174bcf,_0xdf84('0xb'));_0x1345ad(_0x267641['result'][_0xdf84('0x11')]);}})[_0xdf84('0x13')](function(_0x2a4667){logger[_0xdf84('0xf')](_0xdf84('0xa'),_0x174bcf,_0x2a4667);_0x23bfbc(_0x2a4667);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c3b264c..5c06c49 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 _0xbadf=['addAgents','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','/:id/interactions','getInteractions','statusGet','post','create','addAnswer','/:id/notify','addApplications','/:id/status','status','/:id/users'];(function(_0x1ea729,_0x3552bb){var _0x3576c4=function(_0xb12275){while(--_0xb12275){_0x1ea729['push'](_0x1ea729['shift']());}};_0x3576c4(++_0x3552bb);}(_0xbadf,0x170));var _0xfbad=function(_0x5c6ceb,_0x4ed099){_0x5c6ceb=_0x5c6ceb-0x0;var _0x28821b=_0xbadf[_0x5c6ceb];return _0x28821b;};'use strict';var multer=require(_0xfbad('0x0'));var util=require(_0xfbad('0x1'));var path=require(_0xfbad('0x2'));var timeout=require(_0xfbad('0x3'));var express=require(_0xfbad('0x4'));var router=express[_0xfbad('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xfbad('0x6'));var config=require('../../config/environment');var controller=require('./smsAccount.controller');router[_0xfbad('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfbad('0x7')](_0xfbad('0x8'),auth[_0xfbad('0x9')](),controller[_0xfbad('0xa')]);router[_0xfbad('0x7')](_0xfbad('0xb'),auth[_0xfbad('0x9')](),controller[_0xfbad('0xc')]);router[_0xfbad('0x7')](_0xfbad('0xd'),auth['isAuthenticated'](),controller[_0xfbad('0xe')]);router[_0xfbad('0x7')](_0xfbad('0xf'),auth[_0xfbad('0x9')](),controller['getAnswers']);router[_0xfbad('0x7')](_0xfbad('0x10'),auth[_0xfbad('0x9')](),controller['getApplications']);router[_0xfbad('0x7')](_0xfbad('0x11'),auth[_0xfbad('0x9')](),controller[_0xfbad('0x12')]);router[_0xfbad('0x7')]('/:id/status',controller[_0xfbad('0x13')]);router['get']('/:id/users',auth[_0xfbad('0x9')](),controller['getAgents']);router[_0xfbad('0x14')]('/',auth[_0xfbad('0x9')](),controller[_0xfbad('0x15')]);router[_0xfbad('0x14')](_0xfbad('0xd'),auth[_0xfbad('0x9')](),controller['addDisposition']);router['post'](_0xfbad('0xf'),auth[_0xfbad('0x9')](),controller[_0xfbad('0x16')]);router['post'](_0xfbad('0x17'),controller['notify']);router[_0xfbad('0x14')]('/:id/applications',auth[_0xfbad('0x9')](),controller[_0xfbad('0x18')]);router[_0xfbad('0x14')]('/:id/send',auth[_0xfbad('0x9')](),controller['send']);router[_0xfbad('0x14')](_0xfbad('0x19'),controller[_0xfbad('0x1a')]);router['post'](_0xfbad('0x1b'),auth['isAuthenticated'](),controller[_0xfbad('0x1c')]);router['put'](_0xfbad('0xb'),auth[_0xfbad('0x9')](),controller[_0xfbad('0x1d')]);router['delete'](_0xfbad('0xb'),auth[_0xfbad('0x9')](),controller[_0xfbad('0x1e')]);router[_0xfbad('0x1f')](_0xfbad('0xd'),auth[_0xfbad('0x9')](),controller[_0xfbad('0x20')]);router['delete'](_0xfbad('0xf'),auth[_0xfbad('0x9')](),controller[_0xfbad('0x21')]);router[_0xfbad('0x1f')]('/:id/users',auth[_0xfbad('0x9')](),controller[_0xfbad('0x22')]);module[_0xfbad('0x23')]=router; \ No newline at end of file +var _0x6000=['addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','statusGet','/:id/users','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','addApplications','/:id/status','status'];(function(_0x374bdf,_0x44cbad){var _0x78b2ac=function(_0x12a4ad){while(--_0x12a4ad){_0x374bdf['push'](_0x374bdf['shift']());}};_0x78b2ac(++_0x44cbad);}(_0x6000,0xad));var _0x0600=function(_0xa2a8ea,_0x268d77){_0xa2a8ea=_0xa2a8ea-0x0;var _0x44cf9e=_0x6000[_0xa2a8ea];return _0x44cf9e;};'use strict';var multer=require('multer');var util=require(_0x0600('0x0'));var path=require(_0x0600('0x1'));var timeout=require(_0x0600('0x2'));var express=require(_0x0600('0x3'));var router=express[_0x0600('0x4')]();var auth=require(_0x0600('0x5'));var interaction=require(_0x0600('0x6'));var config=require(_0x0600('0x7'));var controller=require(_0x0600('0x8'));router[_0x0600('0x9')]('/',auth[_0x0600('0xa')](),controller[_0x0600('0xb')]);router[_0x0600('0x9')](_0x0600('0xc'),auth['isAuthenticated'](),controller[_0x0600('0xd')]);router[_0x0600('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0600('0xe')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0600('0xf')]);router[_0x0600('0x9')]('/:id/canned_answers',auth[_0x0600('0xa')](),controller[_0x0600('0x10')]);router['get'](_0x0600('0x11'),auth[_0x0600('0xa')](),controller[_0x0600('0x12')]);router[_0x0600('0x9')](_0x0600('0x13'),auth[_0x0600('0xa')](),controller[_0x0600('0x14')]);router[_0x0600('0x9')]('/:id/status',controller[_0x0600('0x15')]);router[_0x0600('0x9')](_0x0600('0x16'),auth[_0x0600('0xa')](),controller['getAgents']);router[_0x0600('0x17')]('/',auth[_0x0600('0xa')](),controller[_0x0600('0x18')]);router['post'](_0x0600('0x19'),auth['isAuthenticated'](),controller[_0x0600('0x1a')]);router[_0x0600('0x17')]('/:id/canned_answers',auth[_0x0600('0xa')](),controller[_0x0600('0x1b')]);router['post'](_0x0600('0x1c'),controller['notify']);router[_0x0600('0x17')](_0x0600('0x11'),auth[_0x0600('0xa')](),controller[_0x0600('0x1d')]);router[_0x0600('0x17')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x0600('0x17')](_0x0600('0x1e'),controller[_0x0600('0x1f')]);router[_0x0600('0x17')](_0x0600('0x16'),auth[_0x0600('0xa')](),controller[_0x0600('0x20')]);router[_0x0600('0x21')](_0x0600('0x22'),auth[_0x0600('0xa')](),controller[_0x0600('0x23')]);router[_0x0600('0x24')]('/:id',auth[_0x0600('0xa')](),controller[_0x0600('0x25')]);router[_0x0600('0x24')](_0x0600('0x19'),auth[_0x0600('0xa')](),controller[_0x0600('0x26')]);router[_0x0600('0x24')]('/:id/canned_answers',auth[_0x0600('0xa')](),controller[_0x0600('0x27')]);router[_0x0600('0x24')](_0x0600('0x16'),auth[_0x0600('0xa')](),controller['removeAgents']);module[_0x0600('0x28')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index ddcc67c..e52e5f1 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 _0x17d1=['clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','ENUM','connectel','plivo'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x17d1,0xc9));var _0x117d=function(_0x30ed91,_0x2e19e8){_0x30ed91=_0x30ed91-0x0;var _0x18c240=_0x17d1[_0x30ed91];return _0x18c240;};'use strict';var Sequelize=require(_0x117d('0x0'));var rs=require(_0x117d('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x117d('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x117d('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x117d('0x4')]();}},'phone':{'type':Sequelize[_0x117d('0x3')]},'type':{'type':Sequelize[_0x117d('0x5')]('twilio','skebby',_0x117d('0x6'),'clicksend',_0x117d('0x7'),_0x117d('0x8'),'bandwidth',_0x117d('0x9'),_0x117d('0xa'),_0x117d('0xb'))},'accountSid':{'type':Sequelize[_0x117d('0x3')]},'authId':{'type':Sequelize[_0x117d('0x3')]},'authToken':{'type':Sequelize[_0x117d('0x3')]},'smsMethod':{'type':Sequelize[_0x117d('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x117d('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x117d('0x3')]},'applicationId':{'type':Sequelize[_0x117d('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x117d('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x117d('0x3')]},'notificationTemplate':{'type':Sequelize[_0x117d('0xd')],'defaultValue':function(){return _0x117d('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x117d('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x117d('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x117d('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x117d('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x117d('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x117d('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x117d('0xc')],'defaultValue':![],'comment':_0x117d('0x10'),'set':function(_0x24de6b){if(!_0x24de6b)this[_0x117d('0x11')]('mandatoryDispositionPauseId',null);this[_0x117d('0x11')](_0x117d('0x12'),_0x24de6b);}}}; \ No newline at end of file +var _0x49a1=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','twilio','skebby','clicksend','clickatell','bandwidth','infobip','intelepeer','ENUM','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x327d8c,_0x50721e){var _0x45861e=function(_0x35682c){while(--_0x35682c){_0x327d8c['push'](_0x327d8c['shift']());}};_0x45861e(++_0x50721e);}(_0x49a1,0x190));var _0x149a=function(_0x42c9c4,_0xe674a8){_0x42c9c4=_0x42c9c4-0x0;var _0x362907=_0x49a1[_0x42c9c4];return _0x362907;};'use strict';var Sequelize=require(_0x149a('0x0'));var rs=require(_0x149a('0x1'));module[_0x149a('0x2')]={'name':{'type':Sequelize[_0x149a('0x3')],'unique':_0x149a('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x149a('0x5')]();}},'phone':{'type':Sequelize[_0x149a('0x3')]},'type':{'type':Sequelize['ENUM'](_0x149a('0x6'),_0x149a('0x7'),'connectel',_0x149a('0x8'),'plivo',_0x149a('0x9'),_0x149a('0xa'),'csc',_0x149a('0xb'),_0x149a('0xc'))},'accountSid':{'type':Sequelize[_0x149a('0x3')]},'authId':{'type':Sequelize[_0x149a('0x3')]},'authToken':{'type':Sequelize[_0x149a('0x3')]},'smsMethod':{'type':Sequelize[_0x149a('0xd')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x149a('0x3')]},'applicationId':{'type':Sequelize[_0x149a('0x3')]},'accountId':{'type':Sequelize[_0x149a('0x3')]},'senderString':{'type':Sequelize[_0x149a('0x3')]},'deliveryReport':{'type':Sequelize[_0x149a('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x149a('0x3')]},'notificationTemplate':{'type':Sequelize[_0x149a('0xf')],'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[_0x149a('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x149a('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x149a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x149a('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x149a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x149a('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x149a('0x10')],'comment':_0x149a('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x149a('0xe')],'defaultValue':![],'comment':_0x149a('0x12'),'set':function(_0x3e7e0b){if(!_0x3e7e0b)this['setDataValue'](_0x149a('0x13'),null);this[_0x149a('0x14')](_0x149a('0x15'),_0x3e7e0b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f12fda5..e7fe756 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 _0x4429=['received\x20delivery\x20report\x20from','state','message-id','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','destroy','end','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','findOne','keys','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','connectel','message_id','plivo','From','Text','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','Contacts','DESC','list','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','transaction','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','DELIVERED','groupName','redif','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet'];(function(_0x121098,_0x373cfc){var _0x439ccb=function(_0x59150e){while(--_0x59150e){_0x121098['push'](_0x121098['shift']());}};_0x439ccb(++_0x373cfc);}(_0x4429,0xed));var _0x9442=function(_0x3b681d,_0x159ae5){_0x3b681d=_0x3b681d-0x0;var _0x4cdc05=_0x4429[_0x3b681d];return _0x4cdc05;};'use strict';var pdf=require(_0x9442('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9442('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9442('0x2'));var moment=require(_0x9442('0x3'));var BPromise=require(_0x9442('0x4'));var Mustache=require('mustache');var util=require(_0x9442('0x5'));var path=require(_0x9442('0x6'));var sox=require(_0x9442('0x7'));var csv=require('to-csv');var ejs=require(_0x9442('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9442('0x9'));var crypto=require(_0x9442('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9442('0xb'));var querystring=require(_0x9442('0xc'));var Papa=require(_0x9442('0xd'));var Redis=require(_0x9442('0xe'));var authService=require(_0x9442('0xf'));var qs=require(_0x9442('0x10'));var as=require(_0x9442('0x11'));var hardwareService=require(_0x9442('0x12'));var logger=require(_0x9442('0x13'))('api');var utils=require(_0x9442('0x14'));var config=require(_0x9442('0x15'));var licenseUtil=require(_0x9442('0x16'));var db=require('../../mysqldb')['db'];config[_0x9442('0x17')]=_['defaults'](config['redis'],{'host':_0x9442('0x18'),'port':0x18eb});var socket=require(_0x9442('0x19'))(new Redis(config[_0x9442('0x17')]));require(_0x9442('0x1a'))[_0x9442('0x1b')](socket);var jayson=require(_0x9442('0x1c'));var client=jayson[_0x9442('0x1d')][_0x9442('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x479b95,_0x5b0034,_0x1f278b,_0x1eb232){return new BPromise(function(_0x2e1f81,_0x5fa093){var _0x32eed6=_0x1eb232||client;return _0x32eed6[_0x9442('0x1f')](_0x479b95,_0x1f278b)['then'](function(_0x1522e0){logger[_0x9442('0x20')]('SmsAccount,\x20%s,\x20%s',_0x5b0034,_0x9442('0x21'));logger['debug'](_0x9442('0x22'),_0x5b0034,_0x9442('0x21'),JSON[_0x9442('0x23')](_0x1522e0));if(_0x1522e0['error']){if(_0x1522e0['error']['code']===0x1f4){logger[_0x9442('0x24')](_0x9442('0x25'),_0x5b0034,_0x1522e0[_0x9442('0x24')][_0x9442('0x26')]);return _0x5fa093(_0x1522e0[_0x9442('0x24')][_0x9442('0x26')]);}logger[_0x9442('0x24')](_0x9442('0x25'),_0x5b0034,_0x1522e0[_0x9442('0x24')][_0x9442('0x26')]);return _0x2e1f81(_0x1522e0['error'][_0x9442('0x26')]);}else{logger['info'](_0x9442('0x25'),_0x5b0034,'request\x20sent');_0x2e1f81(_0x1522e0[_0x9442('0x27')][_0x9442('0x26')]);}})[_0x9442('0x28')](function(_0x402c7b){logger['error'](_0x9442('0x25'),_0x5b0034,_0x402c7b);_0x5fa093(_0x402c7b);});});}function respondWithStatusCode(_0xb3630a,_0x46c238){_0x46c238=_0x46c238||0xcc;return function(_0x575696){if(_0x575696){return _0xb3630a[_0x9442('0x29')](_0x46c238);}return _0xb3630a[_0x9442('0x2a')](_0x46c238)['end']();};}function respondWithResult(_0x394c31,_0x11a2e3){_0x11a2e3=_0x11a2e3||0xc8;return function(_0x2045d9){if(_0x2045d9){return _0x394c31[_0x9442('0x2a')](_0x11a2e3)[_0x9442('0x2b')](_0x2045d9);}};}function respondWithFilteredResult(_0x129189,_0x2cef4a){return function(_0x3b9946){if(_0x3b9946){var _0x3b0a08=_0x3b9946['count'],_0x295aed=_0x2cef4a['offset'],_0x54bd66=_0x2cef4a[_0x9442('0x2c')]+_0x2cef4a[_0x9442('0x2d')],_0x7faa77;if(_0x54bd66>=_0x3b0a08){_0x54bd66=_0x3b0a08;_0x7faa77=0xc8;}else{_0x7faa77=0xce;}_0x129189['status'](_0x7faa77);return _0x129189[_0x9442('0x2e')](_0x9442('0x2f'),_0x295aed+'-'+_0x54bd66+'/'+_0x3b0a08)[_0x9442('0x2b')](_0x3b9946);}return null;};}function patchUpdates(_0x216890){return function(_0x5f161d){try{jsonpatch[_0x9442('0x30')](_0x5f161d,_0x216890,!![]);}catch(_0x10b014){return BPromise[_0x9442('0x31')](_0x10b014);}return _0x5f161d[_0x9442('0x32')]();};}function saveUpdates(_0x3f6a20,_0x488a3b){return function(_0x89b39b){if(_0x89b39b){return _0x89b39b[_0x9442('0x33')](_0x3f6a20)['then'](function(_0x11816e){return _0x11816e;});}return null;};}function removeEntity(_0x59de3c,_0x416616){return function(_0x470ffe){if(_0x470ffe){return _0x470ffe['destroy']()[_0x9442('0x34')](function(){var _0x433127=_0x470ffe[_0x9442('0x35')]({'plain':!![]});var _0x271ad7='SmsAccounts';return db['UserProfileResource'][_0x9442('0x36')]({'where':{'type':_0x271ad7,'resourceId':_0x433127['id']}})[_0x9442('0x34')](function(){return _0x470ffe;});})[_0x9442('0x34')](function(){_0x59de3c[_0x9442('0x2a')](0xcc)[_0x9442('0x37')]();});}};}function handleEntityNotFound(_0x2dac9d,_0xd74aa5){return function(_0x3e6a13){if(!_0x3e6a13){_0x2dac9d[_0x9442('0x29')](0x194);}return _0x3e6a13;};}function handleError(_0x4fef2a,_0x4166d3){_0x4166d3=_0x4166d3||0x1f4;return function(_0x505787){logger[_0x9442('0x24')](_0x505787['stack']);if(_0x505787[_0x9442('0x38')]){delete _0x505787['name'];}_0x4fef2a['status'](_0x4166d3)[_0x9442('0x39')](_0x505787);};}exports[_0x9442('0x3a')]=function(_0x5a3046,_0x4d79e4){var _0x2a2988={'include':[{'model':db[_0x9442('0x3b')],'as':_0x9442('0x3c')}]},_0x6e643e={},_0x2c6689={'count':0x0,'rows':[]};var _0x528f26=_[_0x9442('0x3d')](db[_0x9442('0x3e')][_0x9442('0x3f')],function(_0x57a4dd){return{'name':_0x57a4dd[_0x9442('0x40')],'type':_0x57a4dd[_0x9442('0x41')][_0x9442('0x42')]};});_0x6e643e[_0x9442('0x43')]=_[_0x9442('0x3d')](_0x528f26,_0x9442('0x38'));_0x6e643e['query']=_['keys'](_0x5a3046[_0x9442('0x44')]);_0x6e643e[_0x9442('0x45')]=_[_0x9442('0x46')](_0x6e643e[_0x9442('0x43')],_0x6e643e[_0x9442('0x44')]);_0x2a2988['attributes']=_[_0x9442('0x46')](_0x6e643e[_0x9442('0x43')],qs[_0x9442('0x47')](_0x5a3046[_0x9442('0x44')][_0x9442('0x47')]));_0x2a2988[_0x9442('0x48')]=_0x2a2988[_0x9442('0x48')][_0x9442('0x49')]?_0x2a2988[_0x9442('0x48')]:_0x6e643e[_0x9442('0x43')];if(!_0x5a3046[_0x9442('0x44')][_0x9442('0x4a')](_0x9442('0x4b'))){_0x2a2988['limit']=qs['limit'](_0x5a3046[_0x9442('0x44')]['limit']);_0x2a2988[_0x9442('0x2c')]=qs[_0x9442('0x2c')](_0x5a3046[_0x9442('0x44')][_0x9442('0x2c')]);}_0x2a2988[_0x9442('0x4c')]=qs[_0x9442('0x4d')](_0x5a3046['query'][_0x9442('0x4d')]);_0x2a2988[_0x9442('0x4e')]=qs['filters'](_[_0x9442('0x4f')](_0x5a3046['query'],_0x6e643e['filters']),_0x528f26);if(_0x5a3046[_0x9442('0x44')][_0x9442('0x50')]){_0x2a2988[_0x9442('0x4e')]=_[_0x9442('0x51')](_0x2a2988[_0x9442('0x4e')],{'$or':_['map'](_0x528f26,function(_0xac7ea9){if(_0xac7ea9['type']!==_0x9442('0x52')){var _0x43d7b5={};_0x43d7b5[_0xac7ea9[_0x9442('0x38')]]={'$like':'%'+_0x5a3046[_0x9442('0x44')][_0x9442('0x50')]+'%'};return _0x43d7b5;}})});}_0x2a2988=_[_0x9442('0x51')]({},_0x2a2988,_0x5a3046[_0x9442('0x53')]);var _0x2d15ee={'where':_0x2a2988[_0x9442('0x4e')]};return db[_0x9442('0x3e')][_0x9442('0x54')](_0x2d15ee)['then'](function(_0x1e480e){_0x2c6689[_0x9442('0x54')]=_0x1e480e;if(_0x5a3046[_0x9442('0x44')][_0x9442('0x55')]){_0x2a2988['include']=[{'all':!![]}];}return db[_0x9442('0x3e')][_0x9442('0x56')](_0x2a2988);})['then'](function(_0x39ff1c){_0x2c6689[_0x9442('0x57')]=_0x39ff1c;return _0x2c6689;})[_0x9442('0x34')](respondWithFilteredResult(_0x4d79e4,_0x2a2988))[_0x9442('0x28')](handleError(_0x4d79e4,null));};exports['show']=function(_0x560089,_0x249095){var _0x7e85b9={'raw':![],'where':{'id':_0x560089[_0x9442('0x58')]['id']},'include':[{'model':db[_0x9442('0x3b')],'as':_0x9442('0x3c')}]},_0x5710ea={};_0x5710ea['model']=_['keys'](db[_0x9442('0x3e')][_0x9442('0x3f')]);_0x5710ea['query']=_['keys'](_0x560089[_0x9442('0x44')]);_0x5710ea[_0x9442('0x45')]=_[_0x9442('0x46')](_0x5710ea['model'],_0x5710ea[_0x9442('0x44')]);_0x7e85b9[_0x9442('0x48')]=_[_0x9442('0x46')](_0x5710ea['model'],qs[_0x9442('0x47')](_0x560089['query'][_0x9442('0x47')]));_0x7e85b9['attributes']=_0x7e85b9[_0x9442('0x48')]['length']?_0x7e85b9[_0x9442('0x48')]:_0x5710ea[_0x9442('0x43')];if(_0x560089[_0x9442('0x44')][_0x9442('0x55')]){_0x7e85b9[_0x9442('0x59')]=[{'all':!![]}];}_0x7e85b9=_['merge']({},_0x7e85b9,_0x560089[_0x9442('0x53')]);return db['SmsAccount'][_0x9442('0x5a')](_0x7e85b9)[_0x9442('0x34')](handleEntityNotFound(_0x249095,null))['then'](respondWithResult(_0x249095,null))[_0x9442('0x28')](handleError(_0x249095,null));};exports[_0x9442('0x5b')]=function(_0x5a4a2d,_0x4f3684){return db['SmsAccount'][_0x9442('0x5b')](_0x5a4a2d[_0x9442('0x5c')],{})[_0x9442('0x34')](function(_0x52f1bd){var _0x2057cd=_0x5a4a2d[_0x9442('0x5d')][_0x9442('0x35')]({'plain':!![]});if(!_0x2057cd)throw new Error(_0x9442('0x5e'));if(_0x2057cd[_0x9442('0x5f')]===_0x9442('0x5d')){var _0x251dc7=_0x52f1bd[_0x9442('0x35')]({'plain':!![]});var _0xfe0d2f='SmsAccounts';return db[_0x9442('0x60')][_0x9442('0x5a')]({'where':{'name':_0xfe0d2f,'userProfileId':_0x2057cd[_0x9442('0x61')]},'raw':!![]})[_0x9442('0x34')](function(_0x381e1b){if(_0x381e1b&&_0x381e1b[_0x9442('0x62')]===0x0){return db[_0x9442('0x63')]['create']({'name':_0x251dc7[_0x9442('0x38')],'resourceId':_0x251dc7['id'],'type':_0x381e1b[_0x9442('0x38')],'sectionId':_0x381e1b['id']},{})['then'](function(){return _0x52f1bd;});}else{return _0x52f1bd;}})[_0x9442('0x28')](function(_0x536f4f){logger[_0x9442('0x24')](_0x9442('0x64'),_0x536f4f);throw _0x536f4f;});}return _0x52f1bd;})['then'](respondWithResult(_0x4f3684,0xc9))[_0x9442('0x28')](handleError(_0x4f3684,null));};exports[_0x9442('0x33')]=function(_0x453bc6,_0x331448){if(_0x453bc6['body']['id']){delete _0x453bc6[_0x9442('0x5c')]['id'];}return db[_0x9442('0x3e')][_0x9442('0x5a')]({'where':{'id':_0x453bc6['params']['id']},'include':[{'model':db[_0x9442('0x3b')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x331448,null))[_0x9442('0x34')](saveUpdates(_0x453bc6[_0x9442('0x5c')],null))[_0x9442('0x34')](respondWithResult(_0x331448,null))['catch'](handleError(_0x331448,null));};exports[_0x9442('0x36')]=function(_0x8320c4,_0x4724b2){return db[_0x9442('0x3e')]['find']({'where':{'id':_0x8320c4[_0x9442('0x58')]['id']}})['then'](handleEntityNotFound(_0x4724b2,null))[_0x9442('0x34')](removeEntity(_0x4724b2,null))[_0x9442('0x28')](handleError(_0x4724b2,null));};exports[_0x9442('0x65')]=function(_0x4a34f6,_0x21bacc){return db[_0x9442('0x3e')][_0x9442('0x65')]()[_0x9442('0x34')](respondWithResult(_0x21bacc,null))[_0x9442('0x28')](handleError(_0x21bacc,null));};exports[_0x9442('0x66')]=function(_0x5d9cc6,_0x85c387,_0x374bd4){if(_0x5d9cc6[_0x9442('0x5c')]['id']){delete _0x5d9cc6[_0x9442('0x5c')]['id'];}return db[_0x9442('0x3e')]['find']({'where':{'id':_0x5d9cc6['params']['id']}})['then'](handleEntityNotFound(_0x85c387,null))[_0x9442('0x34')](function(_0x35e6fd){if(_0x35e6fd){_0x5d9cc6[_0x9442('0x5c')][_0x9442('0x67')]=_0x35e6fd['id'];return db['Disposition'][_0x9442('0x5b')](_0x5d9cc6['body']);}})['then'](respondWithResult(_0x85c387,null))['catch'](handleError(_0x85c387,null));};exports[_0x9442('0x68')]=function(_0x2dbf75,_0x427965,_0x35f272){var _0x860b3={'raw':![],'where':{}};var _0x48c4bb={};var _0x2ea1be={'count':0x0,'rows':[]};return db[_0x9442('0x3e')][_0x9442('0x69')]({'where':{'id':_0x2dbf75[_0x9442('0x58')]['id']}})[_0x9442('0x34')](handleEntityNotFound(_0x427965,null))[_0x9442('0x34')](function(_0x586f32){if(_0x586f32){_0x48c4bb[_0x9442('0x43')]=_[_0x9442('0x6a')](db[_0x9442('0x6b')][_0x9442('0x3f')]);_0x48c4bb[_0x9442('0x44')]=_[_0x9442('0x6a')](_0x2dbf75['query']);_0x48c4bb[_0x9442('0x45')]=_[_0x9442('0x46')](_0x48c4bb[_0x9442('0x43')],_0x48c4bb[_0x9442('0x44')]);_0x860b3['attributes']=_[_0x9442('0x46')](_0x48c4bb['model'],qs[_0x9442('0x47')](_0x2dbf75[_0x9442('0x44')]['fields']));_0x860b3[_0x9442('0x48')]=_0x860b3[_0x9442('0x48')][_0x9442('0x49')]?_0x860b3[_0x9442('0x48')]:_0x48c4bb[_0x9442('0x43')];if(!_0x2dbf75[_0x9442('0x44')][_0x9442('0x4a')](_0x9442('0x4b'))){_0x860b3['limit']=qs[_0x9442('0x2d')](_0x2dbf75[_0x9442('0x44')][_0x9442('0x2d')]);_0x860b3[_0x9442('0x2c')]=qs[_0x9442('0x2c')](_0x2dbf75[_0x9442('0x44')][_0x9442('0x2c')]);}_0x860b3[_0x9442('0x4c')]=qs['sort'](_0x2dbf75[_0x9442('0x44')]['sort']);_0x860b3[_0x9442('0x4e')]=qs[_0x9442('0x45')](_['pick'](_0x2dbf75['query'],_0x48c4bb[_0x9442('0x45')]));_0x860b3[_0x9442('0x4e')][_0x9442('0x67')]=_0x586f32['id'];if(_0x2dbf75[_0x9442('0x44')][_0x9442('0x50')]){_0x860b3['where']=_[_0x9442('0x51')](_0x860b3['where'],{'$or':_[_0x9442('0x3d')](_0x860b3[_0x9442('0x48')],function(_0x125c50){var _0x1be229={};_0x1be229[_0x125c50]={'$like':'%'+_0x2dbf75[_0x9442('0x44')][_0x9442('0x50')]+'%'};return _0x1be229;})});}_0x860b3=_['merge']({},_0x860b3,_0x2dbf75[_0x9442('0x53')]);return db['Disposition'][_0x9442('0x54')]({'where':_0x860b3['where']})[_0x9442('0x34')](function(_0x5af883){_0x2ea1be[_0x9442('0x54')]=_0x5af883;if(_0x2dbf75[_0x9442('0x44')]['includeAll']){_0x860b3['include']=[{'all':!![]}];}return db[_0x9442('0x6b')][_0x9442('0x56')](_0x860b3);})[_0x9442('0x34')](function(_0x95b2d2){_0x2ea1be[_0x9442('0x57')]=_0x95b2d2;return _0x2ea1be;});}})['then'](respondWithFilteredResult(_0x427965,_0x860b3))['catch'](handleError(_0x427965,null));};exports[_0x9442('0x6c')]=function(_0x1eabd4,_0x442d7d,_0x2bd32d){return db[_0x9442('0x3e')][_0x9442('0x5a')]({'where':{'id':_0x1eabd4[_0x9442('0x58')]['id']}})[_0x9442('0x34')](handleEntityNotFound(_0x442d7d,null))['then'](function(_0x5ca112){if(_0x5ca112){return _0x5ca112[_0x9442('0x6c')](_0x1eabd4['query'][_0x9442('0x6d')]);}})[_0x9442('0x34')](respondWithStatusCode(_0x442d7d,null))[_0x9442('0x28')](handleError(_0x442d7d,null));};exports[_0x9442('0x6e')]=function(_0x5966e6,_0x323488,_0x4a63b5){if(_0x5966e6[_0x9442('0x5c')]['id']){delete _0x5966e6[_0x9442('0x5c')]['id'];}return db[_0x9442('0x3e')]['find']({'where':{'id':_0x5966e6[_0x9442('0x58')]['id']}})['then'](handleEntityNotFound(_0x323488,null))['then'](function(_0x5df3ee){if(_0x5df3ee){_0x5966e6[_0x9442('0x5c')][_0x9442('0x67')]=_0x5df3ee['id'];return db[_0x9442('0x6f')][_0x9442('0x5b')](_0x5966e6[_0x9442('0x5c')]);}})[_0x9442('0x34')](respondWithResult(_0x323488,null))[_0x9442('0x28')](handleError(_0x323488,null));};exports[_0x9442('0x70')]=function(_0x583f4b,_0x394560,_0x2f9103){var _0x55399a={'raw':![],'where':{}};var _0x373231={};var _0xcba2e9={'count':0x0,'rows':[]};return db[_0x9442('0x3e')][_0x9442('0x69')]({'where':{'id':_0x583f4b['params']['id']}})[_0x9442('0x34')](handleEntityNotFound(_0x394560,null))['then'](function(_0x21d5b5){if(_0x21d5b5){_0x373231[_0x9442('0x43')]=_[_0x9442('0x6a')](db[_0x9442('0x6f')][_0x9442('0x3f')]);_0x373231[_0x9442('0x44')]=_[_0x9442('0x6a')](_0x583f4b['query']);_0x373231[_0x9442('0x45')]=_[_0x9442('0x46')](_0x373231['model'],_0x373231['query']);_0x55399a[_0x9442('0x48')]=_[_0x9442('0x46')](_0x373231[_0x9442('0x43')],qs['fields'](_0x583f4b[_0x9442('0x44')][_0x9442('0x47')]));_0x55399a[_0x9442('0x48')]=_0x55399a[_0x9442('0x48')]['length']?_0x55399a[_0x9442('0x48')]:_0x373231[_0x9442('0x43')];if(!_0x583f4b['query'][_0x9442('0x4a')](_0x9442('0x4b'))){_0x55399a['limit']=qs[_0x9442('0x2d')](_0x583f4b[_0x9442('0x44')][_0x9442('0x2d')]);_0x55399a[_0x9442('0x2c')]=qs['offset'](_0x583f4b[_0x9442('0x44')][_0x9442('0x2c')]);}_0x55399a['order']=qs[_0x9442('0x4d')](_0x583f4b[_0x9442('0x44')][_0x9442('0x4d')]);_0x55399a[_0x9442('0x4e')]=qs[_0x9442('0x45')](_[_0x9442('0x4f')](_0x583f4b[_0x9442('0x44')],_0x373231[_0x9442('0x45')]));_0x55399a[_0x9442('0x4e')][_0x9442('0x67')]=_0x21d5b5['id'];if(_0x583f4b[_0x9442('0x44')][_0x9442('0x50')]){_0x55399a[_0x9442('0x4e')]=_[_0x9442('0x51')](_0x55399a[_0x9442('0x4e')],{'$or':_[_0x9442('0x3d')](_0x55399a[_0x9442('0x48')],function(_0x4528b8){var _0x1ef9d7={};_0x1ef9d7[_0x4528b8]={'$like':'%'+_0x583f4b[_0x9442('0x44')][_0x9442('0x50')]+'%'};return _0x1ef9d7;})});}_0x55399a=_[_0x9442('0x51')]({},_0x55399a,_0x583f4b['options']);return db['CannedAnswer']['count']({'where':_0x55399a[_0x9442('0x4e')]})['then'](function(_0x51e0d0){_0xcba2e9[_0x9442('0x54')]=_0x51e0d0;if(_0x583f4b['query'][_0x9442('0x55')]){_0x55399a['include']=[{'all':!![]}];}return db[_0x9442('0x6f')][_0x9442('0x56')](_0x55399a);})[_0x9442('0x34')](function(_0x363132){_0xcba2e9[_0x9442('0x57')]=_0x363132;return _0xcba2e9;});}})[_0x9442('0x34')](respondWithFilteredResult(_0x394560,_0x55399a))[_0x9442('0x28')](handleError(_0x394560,null));};exports[_0x9442('0x71')]=function(_0x515b93,_0x2849c1,_0x50dc6d){return db[_0x9442('0x3e')][_0x9442('0x5a')]({'where':{'id':_0x515b93[_0x9442('0x58')]['id']}})[_0x9442('0x34')](handleEntityNotFound(_0x2849c1,null))['then'](function(_0x58bf53){if(_0x58bf53){return _0x58bf53[_0x9442('0x71')](_0x515b93['query'][_0x9442('0x6d')]);}})['then'](respondWithStatusCode(_0x2849c1,null))[_0x9442('0x28')](handleError(_0x2849c1,null));};exports[_0x9442('0x72')]=function(_0x509e8d,_0x2bdcdf,_0x5a6629){var _0x14ac5c={'channel':_0x9442('0x73')};var _0x1016ef=[];var _0x113f31=[];var _0x24cad6={};return db['SmsAccount'][_0x9442('0x5a')]({'where':{'id':_0x509e8d['params']['id']},'include':[{'model':db[_0x9442('0x74')],'as':_0x9442('0x75')}]})[_0x9442('0x34')](handleEntityNotFound(_0x2bdcdf,null))[_0x9442('0x34')](function(_0x43f0f0){_0x14ac5c['account']=_0x43f0f0;_0x14ac5c[_0x9442('0x76')]=_[_0x9442('0x77')](_0x43f0f0[_0x9442('0x75')],[_0x9442('0x78')],[_0x9442('0x79')]);if(_0x14ac5c[_0x9442('0x7a')][_0x9442('0x75')]){delete _0x14ac5c[_0x9442('0x7a')][_0x9442('0x75')];}return db[_0x9442('0x7b')][_0x9442('0x65')]();})[_0x9442('0x34')](function(_0x46ebba){if(!_0x46ebba){throw new db[(_0x9442('0x7c'))][(_0x9442('0x7d'))](_0x9442('0x7e'));}_0x1016ef=_[_0x9442('0x7f')](_['keys'](_0x46ebba),[_0x9442('0x80'),'updatedAt']);_0x113f31=_[_0x9442('0x7f')](_['keys'](_0x46ebba),['createdAt',_0x9442('0x81'),'CompanyId',_0x9442('0x82')]);_0x14ac5c[_0x9442('0x5c')]={'mapKey':_0x9442('0x83')};if(_0x14ac5c[_0x9442('0x7a')]['type']){switch(_0x14ac5c[_0x9442('0x7a')]['type']){case _0x9442('0x84'):_0x14ac5c[_0x9442('0x5c')][_0x9442('0x85')]=_0x509e8d[_0x9442('0x5c')]['From'];_0x14ac5c['body']['body']=_0x509e8d[_0x9442('0x5c')][_0x9442('0x86')];_0x14ac5c[_0x9442('0x5c')][_0x9442('0x87')]=_0x509e8d['body'][_0x9442('0x88')];break;case _0x9442('0x89'):_0x14ac5c[_0x9442('0x5c')][_0x9442('0x85')]='+'+_0x509e8d[_0x9442('0x5c')]['sender'];_0x14ac5c[_0x9442('0x5c')][_0x9442('0x5c')]=_0x509e8d[_0x9442('0x5c')]['text'];break;case _0x9442('0x8a'):_0x14ac5c[_0x9442('0x5c')][_0x9442('0x85')]=_0x509e8d['body'][_0x9442('0x85')];_0x14ac5c[_0x9442('0x5c')][_0x9442('0x5c')]=_0x509e8d[_0x9442('0x5c')]['message'];break;case'clicksend':_0x14ac5c[_0x9442('0x5c')][_0x9442('0x85')]=_0x509e8d['body'][_0x9442('0x85')];_0x14ac5c[_0x9442('0x5c')][_0x9442('0x5c')]=_0x509e8d[_0x9442('0x5c')][_0x9442('0x5c')];_0x14ac5c[_0x9442('0x5c')]['messageId']=_0x509e8d[_0x9442('0x5c')][_0x9442('0x8b')];break;case _0x9442('0x8c'):_0x14ac5c['body']['from']=_0x509e8d[_0x9442('0x5c')][_0x9442('0x8d')];_0x14ac5c['body'][_0x9442('0x5c')]=_0x509e8d[_0x9442('0x5c')][_0x9442('0x8e')];_0x14ac5c[_0x9442('0x5c')]['messageId']=_0x509e8d['body']['MessageUUID'];break;case _0x9442('0x8f'):_0x14ac5c[_0x9442('0x5c')][_0x9442('0x85')]='+'+_0x509e8d[_0x9442('0x5c')][_0x9442('0x90')][0x0][_0x9442('0x85')];_0x14ac5c[_0x9442('0x5c')][_0x9442('0x5c')]=_0x509e8d[_0x9442('0x5c')][_0x9442('0x90')][0x0][_0x9442('0x91')];_0x14ac5c[_0x9442('0x5c')][_0x9442('0x87')]=_0x509e8d[_0x9442('0x5c')][_0x9442('0x90')][0x0][_0x9442('0x87')];break;case _0x9442('0x92'):_0x14ac5c['body']['from']=_0x509e8d[_0x9442('0x5c')][_0x9442('0x93')];_0x14ac5c[_0x9442('0x5c')]['body']=_0x509e8d[_0x9442('0x5c')][_0x9442('0x94')][_0x9442('0x26')];break;case _0x9442('0x95'):_0x14ac5c[_0x9442('0x5c')][_0x9442('0x85')]=_0x509e8d[_0x9442('0x5c')][_0x9442('0x96')];_0x14ac5c[_0x9442('0x5c')][_0x9442('0x5c')]=_0x509e8d[_0x9442('0x5c')][_0x9442('0x91')];_0x14ac5c[_0x9442('0x5c')]['messageId']=_0x509e8d['body'][_0x9442('0x97')];break;case _0x9442('0x98'):_0x14ac5c[_0x9442('0x5c')][_0x9442('0x87')]=_0x509e8d[_0x9442('0x5c')][0x0]['message']['id'];_0x14ac5c[_0x9442('0x5c')]['from']=_0x509e8d[_0x9442('0x5c')][0x0][_0x9442('0x26')][_0x9442('0x85')];_0x14ac5c[_0x9442('0x5c')]['body']=_0x509e8d[_0x9442('0x5c')][0x0][_0x9442('0x26')][_0x9442('0x91')];break;case _0x9442('0x99'):_0x14ac5c[_0x9442('0x5c')][_0x9442('0x85')]=_0x509e8d[_0x9442('0x5c')]['from'];_0x14ac5c[_0x9442('0x5c')]['body']=_0x509e8d['body'][_0x9442('0x26')];_0x14ac5c['body'][_0x9442('0x87')]=_0x509e8d[_0x9442('0x5c')]['refid'];break;}}if(_0x14ac5c[_0x9442('0x5c')]['id']){delete _0x14ac5c[_0x9442('0x5c')]['id'];}if(_[_0x9442('0x9a')](_0x14ac5c['body'][_0x9442('0x85')])){throw new db[(_0x9442('0x7c'))][(_0x9442('0x7d'))]('from\x20is\x20mandatory');}if(_[_0x9442('0x9a')](_0x14ac5c[_0x9442('0x5c')][_0x9442('0x5c')])||_0x14ac5c[_0x9442('0x5c')]['body']===''){throw new db[(_0x9442('0x7c'))][(_0x9442('0x7d'))](_0x9442('0x9b'));}if(_[_0x9442('0x9a')](_0x14ac5c[_0x9442('0x5c')][_0x9442('0x9c')])){throw new db[(_0x9442('0x7c'))][(_0x9442('0x7d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x113f31);}if(!_['includes'](_0x113f31,_0x14ac5c[_0x9442('0x5c')][_0x9442('0x9c')])){throw new db[(_0x9442('0x7c'))][(_0x9442('0x7d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x113f31);}_0x24cad6[_0x14ac5c['body']['mapKey']]=_0x14ac5c[_0x9442('0x5c')]['from'];return db[_0x9442('0x9d')][_0x9442('0x5a')]({'where':{'id':_0x14ac5c[_0x9442('0x7a')][_0x9442('0x82')]},'include':[{'model':db['CmContact'],'as':_0x9442('0x9e'),'where':_0x24cad6,'limit':0x1,'order':[[_0x9442('0x81'),_0x9442('0x9f')]]}]});})[_0x9442('0x34')](handleEntityNotFound(_0x2bdcdf,null))[_0x9442('0x34')](function(_0x146f78){if(_0x146f78){_0x14ac5c[_0x9442('0xa0')]=_['omit'](_0x146f78,[_0x9442('0x9e')]);if(_0x146f78[_0x9442('0x9e')][_0x9442('0x49')]){return _0x146f78['Contacts'][0x0];}var _0x510937=_[_0x9442('0xa1')](_0x14ac5c[_0x9442('0x5c')],{'firstName':_0x14ac5c[_0x9442('0x5c')][_0x9442('0x85')],'ListId':_0x146f78['id']});_0x510937[_0x14ac5c['body'][_0x9442('0x9c')]]=_0x14ac5c[_0x9442('0x5c')][_0x9442('0x85')];return db[_0x9442('0x7b')][_0x9442('0x5b')](_0x510937,{'fields':_0x1016ef,'raw':!![]});}})[_0x9442('0x34')](handleEntityNotFound(_0x2bdcdf,null))[_0x9442('0x34')](function(_0x5d1627){if(_0x5d1627){_0x14ac5c[_0x9442('0xa2')]=_0x5d1627;var _0x26141a={'ContactId':_0x5d1627['id'],'phone':_0x14ac5c[_0x9442('0x5c')][_0x9442('0x85')],'SmsAccountId':_0x509e8d[_0x9442('0x58')]['id']};var _0x374c02={'ContactId':_0x5d1627['id'],'SmsAccountId':_0x509e8d['params']['id'],'closed':![]};return db[_0x9442('0xa3')]['find']({'where':_0x374c02})['then'](function(_0x2a3a94){if(_0x2a3a94){return[_0x2a3a94,![]];}return db[_0x9442('0xa3')][_0x9442('0x5b')](_0x26141a)['then'](function(_0x5c9785){return[_0x5c9785,!![]];});});}})[_0x9442('0xa4')](function(_0x5dd1f2,_0x5146d6){_0x14ac5c[_0x9442('0xa5')]=_0x5dd1f2['get']({'plain':!![]});_0x14ac5c[_0x9442('0xa5')][_0x9442('0xa6')]=![];if(_0x5146d6){if(_0x14ac5c['account'][_0x9442('0xa7')]){_0x14ac5c[_0x9442('0x76')][_0x9442('0xa8')]({'id':0x0,'priority':_0x14ac5c[_0x9442('0x76')][_0x9442('0x49')]+0x1,'app':_0x9442('0xa9'),'appdata':_0x9442('0xaa'),'interval':_0x9442('0xab')});}_0x14ac5c[_0x9442('0xa5')][_0x9442('0xa6')]=!![];}return db[_0x9442('0xac')]['create']({'phone':_0x14ac5c[_0x9442('0x5c')][_0x9442('0x85')],'messageId':_0x14ac5c[_0x9442('0x5c')][_0x9442('0x87')],'body':_0x14ac5c[_0x9442('0x5c')]['body'],'SmsAccountId':_0x509e8d[_0x9442('0x58')]['id'],'SmsInteractionId':_0x5dd1f2['id'],'direction':'in','ContactId':_0x5dd1f2['ContactId'],'AttachmentId':_0x14ac5c[_0x9442('0x5c')]['AttachmentId']});})[_0x9442('0x34')](function(_0x41f81a){_0x14ac5c[_0x9442('0x26')]=_0x41f81a;if(_0x14ac5c[_0x9442('0xa5')][_0x9442('0xad')]){return db[_0x9442('0xae')][_0x9442('0x5a')]({'attributes':['id','name'],'where':{'id':_0x14ac5c[_0x9442('0xa5')][_0x9442('0xad')]}})['then'](function(_0xb88149){if(_0xb88149){_0x14ac5c[_0x9442('0x76')]['unshift']({'id':0x0,'priority':0x0,'app':_0x9442('0xaf'),'appdata':_0xb88149[_0x9442('0x38')]+','+(_0x14ac5c[_0x9442('0x7a')][_0x9442('0xb0')]||0xa),'interval':_0x9442('0xab')});}return respondWithRpcPromise(_0x9442('0xb1'),'startRouting',_0x14ac5c);});}return respondWithRpcPromise(_0x9442('0xb1'),_0x9442('0xb2'),_0x14ac5c);})[_0x9442('0x34')](function(_0x532070){if(_0x532070){var _0x57d2d4=0xc8;var _0x579a6d=_0x9442('0xb3');logger[_0x9442('0x20')](_0x9442('0x22'),_0x579a6d,_0x57d2d4,_0x9442('0xb4'));logger[_0x9442('0xb5')](_0x9442('0xb6'),_0x579a6d,_0x57d2d4,_0x9442('0xb4'),JSON['stringify'](_0x532070));if(_0x14ac5c[_0x9442('0x7a')]['type']===_0x9442('0x84')){return _0x2bdcdf[_0x9442('0x2a')](_0x57d2d4)[_0x9442('0x2e')](_0x9442('0xb7'),_0x9442('0xb8'))[_0x9442('0x39')](_0x9442('0xb9'));}else{return _0x2bdcdf[_0x9442('0x2a')](_0x57d2d4)[_0x9442('0x2b')](_0x532070);}}})[_0x9442('0x28')](handleError(_0x2bdcdf,null));};exports['addApplications']=function(_0x1d3445,_0x46b3df,_0x5e0a74){return db[_0x9442('0x3e')][_0x9442('0x69')]({'where':{'id':_0x1d3445[_0x9442('0x58')]['id']}})[_0x9442('0x34')](handleEntityNotFound(_0x46b3df,null))[_0x9442('0x34')](function(_0x22571d){if(_0x22571d){return db['sequelize'][_0x9442('0xba')](function(_0x44063c){return db[_0x9442('0x74')][_0x9442('0x36')]({'where':{'SmsAccountId':_0x1d3445[_0x9442('0x58')]['id']},'transaction':_0x44063c})[_0x9442('0x34')](function(_0x4447cf){var _0x443e9b=_['map'](_0x1d3445[_0x9442('0x5c')],function(_0x5c3ef4){_0x5c3ef4[_0x9442('0x67')]=_0x1d3445[_0x9442('0x58')]['id'];return _0x5c3ef4;});return db[_0x9442('0x74')]['bulkCreate'](_0x443e9b,{'transaction':_0x44063c});});})[_0x9442('0x34')](function(){return db['SmsApplication'][_0x9442('0xbb')]({'where':{'SmsAccountId':_0x1d3445[_0x9442('0x58')]['id']},'order':_0x9442('0x78')});});}})[_0x9442('0x34')](respondWithResult(_0x46b3df,null))[_0x9442('0x28')](handleError(_0x46b3df,null));};exports[_0x9442('0xbc')]=function(_0x32e08b,_0x1077f6,_0x45c42b){var _0x47276f={};var _0x42ac8b={};var _0x47b0ea;var _0x20e963;return db[_0x9442('0x3e')][_0x9442('0x69')]({'where':{'id':_0x32e08b[_0x9442('0x58')]['id']}})['then'](handleEntityNotFound(_0x1077f6,null))[_0x9442('0x34')](function(_0x5e5b10){if(_0x5e5b10){_0x47b0ea=_0x5e5b10;_0x42ac8b[_0x9442('0x43')]=_['keys'](db[_0x9442('0x74')][_0x9442('0x3f')]);_0x42ac8b[_0x9442('0x44')]=_['keys'](_0x32e08b[_0x9442('0x44')]);_0x42ac8b[_0x9442('0x45')]=_[_0x9442('0x46')](_0x42ac8b['model'],_0x42ac8b[_0x9442('0x44')]);_0x47276f[_0x9442('0x48')]=_[_0x9442('0x46')](_0x42ac8b[_0x9442('0x43')],qs[_0x9442('0x47')](_0x32e08b[_0x9442('0x44')][_0x9442('0x47')]));_0x47276f[_0x9442('0x48')]=_0x47276f[_0x9442('0x48')][_0x9442('0x49')]?_0x47276f[_0x9442('0x48')]:_0x42ac8b[_0x9442('0x43')];_0x47276f[_0x9442('0x4c')]=qs[_0x9442('0x4d')](_0x32e08b[_0x9442('0x44')][_0x9442('0x4d')]);_0x47276f[_0x9442('0x4e')]=qs['filters'](_[_0x9442('0x4f')](_0x32e08b[_0x9442('0x44')],_0x42ac8b[_0x9442('0x45')]));if(_0x32e08b[_0x9442('0x44')][_0x9442('0x50')]){_0x47276f[_0x9442('0x4e')]=_[_0x9442('0x51')](_0x47276f[_0x9442('0x4e')],{'$or':_[_0x9442('0x3d')](_0x47276f[_0x9442('0x48')],function(_0x14dc12){var _0x4c9368={};_0x4c9368[_0x14dc12]={'$like':'%'+_0x32e08b[_0x9442('0x44')]['filter']+'%'};return _0x4c9368;})});}_0x47276f=_['merge']({},_0x47276f,_0x32e08b[_0x9442('0x53')]);return _0x47b0ea[_0x9442('0xbc')](_0x47276f);}})[_0x9442('0x34')](function(_0x1a779d){if(_0x1a779d){_0x20e963=_0x1a779d['length'];if(!_0x32e08b[_0x9442('0x44')]['hasOwnProperty']('nolimit')){_0x47276f[_0x9442('0x2d')]=qs['limit'](_0x32e08b[_0x9442('0x44')]['limit']);_0x47276f['offset']=qs[_0x9442('0x2c')](_0x32e08b[_0x9442('0x44')][_0x9442('0x2c')]);}return _0x47b0ea[_0x9442('0xbc')](_0x47276f);}})[_0x9442('0x34')](function(_0x2f2090){if(_0x2f2090){return _0x2f2090?{'count':_0x20e963,'rows':_0x2f2090}:null;}})['then'](respondWithResult(_0x1077f6,null))[_0x9442('0x28')](handleError(_0x1077f6,null));};exports[_0x9442('0xbd')]=function(_0x46a6ed,_0x550fbf,_0x3d869f){var _0x60ccbc={'raw':![],'where':{}};var _0x59fcd5={};var _0x3fb023={'count':0x0,'rows':[]};return db[_0x9442('0x3e')][_0x9442('0x69')]({'where':{'id':_0x46a6ed[_0x9442('0x58')]['id']}})[_0x9442('0x34')](handleEntityNotFound(_0x550fbf,null))['then'](function(_0x1d30ea){if(_0x1d30ea){_0x59fcd5[_0x9442('0x43')]=_['keys'](db[_0x9442('0xa3')][_0x9442('0x3f')]);_0x59fcd5[_0x9442('0x44')]=_[_0x9442('0x6a')](_0x46a6ed['query']);_0x59fcd5[_0x9442('0x45')]=_['intersection'](_0x59fcd5[_0x9442('0x43')],_0x59fcd5[_0x9442('0x44')]);_0x60ccbc[_0x9442('0x48')]=_[_0x9442('0x46')](_0x59fcd5[_0x9442('0x43')],qs[_0x9442('0x47')](_0x46a6ed[_0x9442('0x44')][_0x9442('0x47')]));_0x60ccbc['attributes']=_0x60ccbc[_0x9442('0x48')]['length']?_0x60ccbc[_0x9442('0x48')]:_0x59fcd5[_0x9442('0x43')];if(!_0x46a6ed[_0x9442('0x44')][_0x9442('0x4a')](_0x9442('0x4b'))){_0x60ccbc[_0x9442('0x2d')]=qs[_0x9442('0x2d')](_0x46a6ed['query'][_0x9442('0x2d')]);_0x60ccbc[_0x9442('0x2c')]=qs['offset'](_0x46a6ed[_0x9442('0x44')]['offset']);}_0x60ccbc[_0x9442('0x4c')]=qs[_0x9442('0x4d')](_0x46a6ed[_0x9442('0x44')][_0x9442('0x4d')]);_0x60ccbc[_0x9442('0x4e')]=qs[_0x9442('0x45')](_[_0x9442('0x4f')](_0x46a6ed['query'],_0x59fcd5[_0x9442('0x45')]));_0x60ccbc[_0x9442('0x4e')][_0x9442('0x67')]=_0x1d30ea['id'];if(_0x46a6ed[_0x9442('0x44')][_0x9442('0x50')]){_0x60ccbc[_0x9442('0x4e')]=_[_0x9442('0x51')](_0x60ccbc['where'],{'$or':_[_0x9442('0x3d')](_0x60ccbc[_0x9442('0x48')],function(_0x90542e){var _0x1b9bcd={};_0x1b9bcd[_0x90542e]={'$like':'%'+_0x46a6ed['query'][_0x9442('0x50')]+'%'};return _0x1b9bcd;})});}_0x60ccbc=_[_0x9442('0x51')]({},_0x60ccbc,_0x46a6ed[_0x9442('0x53')]);return db[_0x9442('0xa3')][_0x9442('0x54')]({'where':_0x60ccbc[_0x9442('0x4e')]})[_0x9442('0x34')](function(_0x23f6a2){_0x3fb023['count']=_0x23f6a2;if(_0x46a6ed[_0x9442('0x44')][_0x9442('0x55')]){_0x60ccbc[_0x9442('0x59')]=[{'model':db[_0x9442('0x7b')],'as':_0x9442('0xbe'),'required':![]},{'model':db[_0x9442('0xae')],'as':_0x9442('0xbf'),'attributes':[_0x9442('0x38'),_0x9442('0xc0'),_0x9442('0xc1')],'required':![]},{'model':db[_0x9442('0xc2')],'as':'Tags','attributes':['id',_0x9442('0x38'),_0x9442('0xc3')],'where':_0x46a6ed[_0x9442('0x44')][_0x9442('0xc4')]?{'id':_0x46a6ed[_0x9442('0x44')][_0x9442('0xc4')]}:undefined,'required':_0x46a6ed[_0x9442('0x44')]['tag']?!![]:![]}];}return db[_0x9442('0xa3')][_0x9442('0x56')](_0x60ccbc);})[_0x9442('0x34')](function(_0x444568){_0x3fb023['rows']=_0x444568;return _0x3fb023;});}})[_0x9442('0x34')](respondWithFilteredResult(_0x550fbf,_0x60ccbc))[_0x9442('0x28')](handleError(_0x550fbf,null));};exports['send']=function(_0x3e1057,_0x12e1b7,_0xb0328e){var _0x11a1e7,_0x138e41,_0x25cb97;if(_[_0x9442('0x9a')](_0x3e1057[_0x9442('0x5c')]['body'])||_0x3e1057[_0x9442('0x5c')][_0x9442('0x5c')]===''){throw new db[(_0x9442('0x7c'))][(_0x9442('0x7d'))](_0x9442('0x9b'));}if(_['isNil'](_0x3e1057[_0x9442('0x5c')]['to'])){throw new db[(_0x9442('0x7c'))][(_0x9442('0x7d'))](_0x9442('0xc5'));}_0x11a1e7=_0x3e1057['body']['to'];return db['SmsAccount'][_0x9442('0x5a')]({'where':{'id':_0x3e1057[_0x9442('0x58')]['id']},'include':[{'model':db[_0x9442('0x9d')],'as':_0x9442('0xc6'),'include':[{'model':db[_0x9442('0x7b')],'as':'Contacts','where':{'mobile':_0x11a1e7},'limit':0x1,'order':[[_0x9442('0x81'),_0x9442('0x9f')]]}]}]})['then'](handleEntityNotFound(_0x12e1b7,null))[_0x9442('0x34')](function(_0x332a68){if(_0x332a68&&_0x332a68[_0x9442('0xc6')]){_0x138e41=_0x332a68[_0x9442('0x35')]({'plain':!![]});if(_0x138e41['List']&&_0x138e41[_0x9442('0xc6')][_0x9442('0x9e')][_0x9442('0x49')]){return _0x138e41[_0x9442('0xc6')]['Contacts'][0x0];}return db[_0x9442('0x7b')][_0x9442('0x5b')](_[_0x9442('0xa1')](_0x3e1057[_0x9442('0x5c')],{'firstName':_0x11a1e7,'mobile':_0x11a1e7,'phone':_0x11a1e7,'ListId':_0x138e41[_0x9442('0x82')]}));}})['then'](handleEntityNotFound(_0x12e1b7,null))['then'](function(_0x4010fa){if(_0x4010fa){_0x25cb97=_0x4010fa;return db[_0x9442('0xa3')][_0x9442('0x5a')]({'where':{'ContactId':_0x25cb97['id'],'closed':![],'SmsAccountId':_0x138e41['id']}})[_0x9442('0x34')](function(_0x10d6df){if(_0x10d6df){return[_0x10d6df,![]];}return db[_0x9442('0xa3')][_0x9442('0x5b')]({'UserId':_0x3e1057[_0x9442('0x5d')]['id'],'ContactId':_0x25cb97['id'],'SmsAccountId':_0x138e41['id'],'phone':_0x11a1e7,'firstMsgDirection':'out','Messages':[_[_0x9442('0x51')](_0x3e1057[_0x9442('0x5c')],{'read':![],'body':_0x3e1057[_0x9442('0x5c')]['body'],'phone':_0x11a1e7,'SmsAccountId':_0x138e41['id'],'UserId':_0x3e1057[_0x9442('0x5d')]['id'],'ContactId':_0x25cb97['id']})]},{'include':[{'model':db[_0x9442('0xac')],'as':_0x9442('0xc7')}]})['then'](function(_0x2bf9a3){return[_0x2bf9a3,!![]];});});}})[_0x9442('0xa4')](function(_0x20d0f3,_0x411c23){if(_0x411c23){return _0x20d0f3;}return db[_0x9442('0xac')]['create'](_['merge'](_0x3e1057[_0x9442('0x5c')],{'read':![],'body':_0x3e1057[_0x9442('0x5c')][_0x9442('0x5c')],'phone':_0x11a1e7,'SmsAccountId':_0x138e41['id'],'SmsInteractionId':_0x20d0f3['id'],'UserId':_0x3e1057[_0x9442('0x5d')]['id'],'ContactId':_0x25cb97['id']}))[_0x9442('0x34')](function(_0x5b6aee){_0x20d0f3[_0x9442('0xc8')][_0x9442('0xc7')]=[];_0x20d0f3[_0x9442('0xc8')][_0x9442('0xc7')][_0x9442('0xa8')](_0x5b6aee[_0x9442('0xc8')]);return _0x20d0f3;});})[_0x9442('0x34')](respondWithResult(_0x12e1b7,null))[_0x9442('0x28')](handleError(_0x12e1b7,null));};exports[_0x9442('0x2a')]=function(_0x3be102,_0x49f3b4,_0x5b218b){if(_0x3be102[_0x9442('0x5c')]['id']){delete _0x3be102[_0x9442('0x5c')]['id'];}var _0x5ecb66,_0x388056,_0x1c69aa;return db[_0x9442('0x3e')][_0x9442('0x5a')]({'where':{'id':_0x3be102[_0x9442('0x58')]['id']}})['then'](handleEntityNotFound(_0x49f3b4,null))[_0x9442('0x34')](function(_0x4f44e8){if(_0x4f44e8){_0x1c69aa=_0x4f44e8;logger[_0x9442('0xb5')](_0x9442('0x22'),_0x9442('0x2a'),'received\x20delivery\x20report\x20from',_0x4f44e8[_0x9442('0x41')],util[_0x9442('0xc9')](_0x3be102[_0x9442('0x5c')],{'showHidden':![],'depth':null}));switch(_0x4f44e8[_0x9442('0x41')]){case _0x9442('0x89'):if(_0x3be102[_0x9442('0x5c')][_0x9442('0xca')]&&_0x3be102[_0x9442('0x5c')][_0x9442('0x2a')]){_0x388056=_0x3be102[_0x9442('0x5c')][_0x9442('0x2a')];return db[_0x9442('0xac')][_0x9442('0x5a')]({'where':{'messageId':_0x3be102[_0x9442('0x5c')][_0x9442('0xca')]}});}break;case _0x9442('0x8a'):if(_0x3be102[_0x9442('0x5c')][_0x9442('0xcb')]&&_0x3be102['body'][_0x9442('0xcc')]){_0x388056=_0x3be102[_0x9442('0x5c')][_0x9442('0xcc')];return db[_0x9442('0xac')][_0x9442('0x5a')]({'where':{'messageId':_0x3be102[_0x9442('0x5c')][_0x9442('0xcb')]}});}break;case _0x9442('0xcd'):if(_0x3be102[_0x9442('0x5c')]['message_id']&&_0x3be102[_0x9442('0x5c')][_0x9442('0xce')]){_0x388056=_0x3be102[_0x9442('0x5c')][_0x9442('0xce')];return db[_0x9442('0xac')][_0x9442('0x5a')]({'where':{'messageId':_0x3be102[_0x9442('0x5c')][_0x9442('0x8b')]}});}break;case _0x9442('0x8f'):var _0x10147d=_0x3be102[_0x9442('0x5c')][_0x9442('0x90')][0x0];if(_0x10147d[_0x9442('0x87')]&&_0x10147d[_0x9442('0x2a')]['groupName']===_0x9442('0xcf')){_0x388056=_0x10147d['status'][_0x9442('0xd0')];return db[_0x9442('0xac')][_0x9442('0x5a')]({'where':{'messageId':_0x10147d['messageId']}});}break;case _0x9442('0x95'):if(_0x3be102[_0x9442('0x5c')][_0x9442('0x87')]&&_0x3be102[_0x9442('0x5c')][_0x9442('0x2a')]){_0x388056=_0x3be102['body'][_0x9442('0x2a')];return db['SmsMessage'][_0x9442('0x5a')]({'where':{'messageId':_0x3be102[_0x9442('0x5c')][_0x9442('0x87')]}});}break;case _0x9442('0x98'):if(_0x3be102['body'][0x0]['message']['id']){_0x388056=_0x3be102[_0x9442('0x5c')][0x0][_0x9442('0x41')];return db['SmsMessage'][_0x9442('0x5a')]({'where':{'messageId':_0x3be102[_0x9442('0x5c')][0x0][_0x9442('0x26')]['id']}});}break;case _0x9442('0x99'):if(_0x3be102[_0x9442('0x5c')][_0x9442('0xd1')]&&_0x3be102['body']['status']){_0x388056=_0x3be102[_0x9442('0x5c')][_0x9442('0x2a')];return db[_0x9442('0xac')][_0x9442('0x5a')]({'where':{'messageId':_0x3be102[_0x9442('0x5c')][_0x9442('0xd1')]}});}break;}}})[_0x9442('0x34')](handleEntityNotFound(_0x49f3b4,null))['then'](function(_0x4244c2){if(_0x4244c2){_0x5ecb66=_0x4244c2;switch(_0x1c69aa['type']){case'skebby':if(_0x388056===_0x9442('0xcf')){return _0x5ecb66['update']({'read':!![]});}else{logger[_0x9442('0x24')](_0x9442('0x22'),_0x9442('0x2a'),_0x9442('0x89'),util[_0x9442('0xc9')](_0x3be102['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x388056==='1'){return _0x5ecb66['update']({'read':!![]});}else{logger[_0x9442('0x24')](_0x9442('0x22'),_0x9442('0x2a'),'skebby',util[_0x9442('0xc9')](_0x3be102['body'],{'showHidden':![],'depth':null}));}break;case _0x9442('0xcd'):if(!_0x3be102[_0x9442('0x5c')]['error_code']&&_0x388056>=0xc8&&_0x388056<=0xce){return _0x5ecb66['update']({'read':!![]});}else{logger[_0x9442('0x24')](_0x9442('0x22'),_0x9442('0x2a'),_0x9442('0xcd'),util['inspect'](_0x3be102[_0x9442('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x9442('0x8f'):var _0xf94fd6=_0x3be102[_0x9442('0x5c')][_0x9442('0x90')][0x0];if(_0xf94fd6[_0x9442('0x2a')][_0x9442('0xd0')]===_0x9442('0xcf')){return _0x5ecb66[_0x9442('0x33')]({'read':!![]});}else{logger[_0x9442('0x24')](_0x9442('0x22'),_0x9442('0x2a'),_0x9442('0x8f'),util[_0x9442('0xc9')](_0x3be102[_0x9442('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x9442('0x95'):if(_0x388056==_0x9442('0xd2')||_0x388056=='RECEIVED_BY_RECIPIENT'){return _0x5ecb66['update']({'read':!![]});}else{logger[_0x9442('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9442('0x2a'),'clickatell',util[_0x9442('0xc9')](_0x3be102['body'],{'showHidden':![],'depth':null}));}break;case _0x9442('0x98'):if(_0x388056==_0x9442('0xd3')){return _0x5ecb66[_0x9442('0x33')]({'read':!![]});}else{logger[_0x9442('0x24')](_0x9442('0x22'),'status',_0x9442('0x98'),util['inspect'](_0x3be102[_0x9442('0x5c')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x388056===_0x9442('0xd4')||_0x388056===_0x9442('0xd5')){return _0x5ecb66[_0x9442('0x33')]({'read':!![]});}else{logger[_0x9442('0x24')](_0x9442('0x22'),_0x9442('0x2a'),_0x9442('0x99'),util[_0x9442('0xc9')](_0x3be102[_0x9442('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x5ecb66;}})[_0x9442('0x34')](respondWithResult(_0x49f3b4,null))['catch'](handleError(_0x49f3b4,null));};exports[_0x9442('0xd6')]=function(_0x4c284e,_0x35b112,_0x40b68c){var _0x47c3c2,_0x18bbda,_0x45d63a;return db[_0x9442('0x3e')][_0x9442('0x5a')]({'where':{'id':_0x4c284e[_0x9442('0x58')]['id']}})[_0x9442('0x34')](handleEntityNotFound(_0x35b112,null))['then'](function(_0x38afe1){if(_0x38afe1){_0x45d63a=_0x38afe1;logger[_0x9442('0xb5')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9442('0x2a'),_0x9442('0xd7'),_0x38afe1[_0x9442('0x41')],util['inspect'](_0x4c284e[_0x9442('0x44')],{'showHidden':![],'depth':null}));switch(_0x38afe1['type']){case _0x9442('0x92'):if(_0x4c284e[_0x9442('0x44')]['message-id']&&_0x4c284e[_0x9442('0x44')]['state']){_0x18bbda=_0x4c284e[_0x9442('0x44')][_0x9442('0xd8')];return db['SmsMessage']['find']({'where':{'messageId':_0x4c284e[_0x9442('0x44')][_0x9442('0xd9')]}});}break;}}})[_0x9442('0x34')](handleEntityNotFound(_0x35b112,null))['then'](function(_0x198a3a){if(_0x198a3a){_0x47c3c2=_0x198a3a;switch(_0x45d63a[_0x9442('0x41')]){case _0x9442('0x92'):if(_0x18bbda==='2'||_0x18bbda==='6'){return _0x47c3c2['update']({'read':!![]});}else{logger[_0x9442('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9442('0x2a'),_0x9442('0x92'),util[_0x9442('0xc9')](_0x4c284e[_0x9442('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x47c3c2;}})[_0x9442('0x34')](respondWithResult(_0x35b112,null))[_0x9442('0x28')](handleError(_0x35b112,null));};exports[_0x9442('0xda')]=function(_0x4d984c,_0xfcb9cb,_0x443785){return db[_0x9442('0x3e')][_0x9442('0x5a')]({'where':{'id':_0x4d984c[_0x9442('0x58')]['id']}})[_0x9442('0x34')](handleEntityNotFound(_0xfcb9cb,null))[_0x9442('0x34')](function(_0x282a6c){if(_0x282a6c){return _0x282a6c[_0x9442('0xda')](_0x4d984c[_0x9442('0x5c')][_0x9442('0x6d')],_[_0x9442('0xdb')](_0x4d984c[_0x9442('0x5c')],['ids','id'])||{})[_0x9442('0xa4')](function(_0xa7a0ea){for(var _0xe33745=0x0;_0xe33745<_0x4d984c[_0x9442('0x5c')]['ids'][_0x9442('0x49')];_0xe33745+=0x1){socket[_0x9442('0xdc')](_0x9442('0xdd'),{'UserId':_0x4d984c[_0x9442('0x5c')][_0x9442('0x6d')][_0xe33745],'SmsAccountId':_0x4d984c[_0x9442('0x58')]['id']});}return _0xa7a0ea;});}})[_0x9442('0x34')](respondWithResult(_0xfcb9cb,null))[_0x9442('0x28')](handleError(_0xfcb9cb,null));};exports[_0x9442('0xde')]=function(_0x38826b,_0x465535,_0x5c929f){return db[_0x9442('0x3e')][_0x9442('0x5a')]({'where':{'id':_0x38826b['params']['id']}})['then'](handleEntityNotFound(_0x465535,null))[_0x9442('0x34')](function(_0x3226fa){if(_0x3226fa){return _0x3226fa[_0x9442('0xde')](_0x38826b[_0x9442('0x44')][_0x9442('0x6d')])[_0x9442('0x34')](function(){if(_[_0x9442('0xdf')](_0x38826b[_0x9442('0x44')][_0x9442('0x6d')])){for(var _0x5b5714=0x0;_0x5b5714<_0x38826b[_0x9442('0x44')]['ids'][_0x9442('0x49')];_0x5b5714+=0x1){socket[_0x9442('0xdc')](_0x9442('0xe0'),{'UserId':Number(_0x38826b[_0x9442('0x44')][_0x9442('0x6d')][_0x5b5714]),'SmsAccountId':Number(_0x38826b[_0x9442('0x58')]['id'])});}}else{socket[_0x9442('0xdc')](_0x9442('0xe0'),{'UserId':Number(_0x38826b['query'][_0x9442('0x6d')]),'SmsAccountId':Number(_0x38826b['params']['id'])});}});}})[_0x9442('0x34')](respondWithStatusCode(_0x465535,null))[_0x9442('0x28')](handleError(_0x465535,null));};exports[_0x9442('0xe1')]=function(_0x10cb1e,_0x495927,_0x471265){var _0x87519d={};var _0x51d870={};var _0x4d7ff4;var _0x2cba9e;return db[_0x9442('0x3e')][_0x9442('0x69')]({'where':{'id':_0x10cb1e['params']['id']}})[_0x9442('0x34')](handleEntityNotFound(_0x495927,null))[_0x9442('0x34')](function(_0x2a9d61){if(_0x2a9d61){_0x4d7ff4=_0x2a9d61;_0x51d870[_0x9442('0x43')]=_['keys'](db[_0x9442('0xae')][_0x9442('0x3f')]);_0x51d870[_0x9442('0x44')]=_[_0x9442('0x6a')](_0x10cb1e[_0x9442('0x44')]);_0x51d870[_0x9442('0x45')]=_[_0x9442('0x46')](_0x51d870[_0x9442('0x43')],_0x51d870['query']);_0x87519d['attributes']=_['intersection'](_0x51d870['model'],qs[_0x9442('0x47')](_0x10cb1e[_0x9442('0x44')]['fields']));_0x87519d['attributes']=_0x87519d[_0x9442('0x48')]['length']?_0x87519d[_0x9442('0x48')]:_0x51d870[_0x9442('0x43')];_0x87519d[_0x9442('0x4c')]=qs[_0x9442('0x4d')](_0x10cb1e['query'][_0x9442('0x4d')]);_0x87519d[_0x9442('0x4e')]=qs[_0x9442('0x45')](_['pick'](_0x10cb1e['query'],_0x51d870['filters']));if(_0x10cb1e[_0x9442('0x44')][_0x9442('0x50')]){_0x87519d[_0x9442('0x4e')]=_['merge'](_0x87519d[_0x9442('0x4e')],{'$or':_[_0x9442('0x3d')](_0x87519d[_0x9442('0x48')],function(_0x1fb802){var _0xa3003e={};_0xa3003e[_0x1fb802]={'$like':'%'+_0x10cb1e['query'][_0x9442('0x50')]+'%'};return _0xa3003e;})});}_0x87519d=_['merge']({},_0x87519d,_0x10cb1e[_0x9442('0x53')]);return _0x4d7ff4[_0x9442('0xe1')](_0x87519d);}})[_0x9442('0x34')](function(_0x23d961){if(_0x23d961){_0x2cba9e=_0x23d961[_0x9442('0x49')];if(!_0x10cb1e[_0x9442('0x44')][_0x9442('0x4a')](_0x9442('0x4b'))){_0x87519d[_0x9442('0x2d')]=qs['limit'](_0x10cb1e[_0x9442('0x44')]['limit']);_0x87519d[_0x9442('0x2c')]=qs[_0x9442('0x2c')](_0x10cb1e['query']['offset']);}return _0x4d7ff4[_0x9442('0xe1')](_0x87519d);}})[_0x9442('0x34')](function(_0x370255){if(_0x370255){return _0x370255?{'count':_0x2cba9e,'rows':_0x370255}:null;}})[_0x9442('0x34')](respondWithResult(_0x495927,null))[_0x9442('0x28')](handleError(_0x495927,null));}; \ No newline at end of file +var _0x6bc1=['removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','redis','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','get','SmsAccounts','destroy','end','stack','name','send','index','Pause','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','SmsAccount','include','findAll','rows','show','params','mandatoryDispositionPause','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','update','body','describe','addDisposition','SmsAccountId','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','orderBy','Applications','priority','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','mobile','twilio','from','Body','messageId','skebby','sender','text','connectel','clicksend','message_id','From','Text','MessageUUID','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','Sequelize','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','ListId','Contacts','omit','contact','SmsInteraction','interaction','created','push','applications','close','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','addApplications','sequelize','transaction','bulkCreate','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','DESC','out','Messages','spread','dataValues','inspect','skebby_dispatch_id','statusInt','requestid','status_code','infobip','groupName','redif','DELIVERED','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','emit'];(function(_0x589fb1,_0x5d8fb5){var _0x12195c=function(_0x2f9a9c){while(--_0x2f9a9c){_0x589fb1['push'](_0x589fb1['shift']());}};_0x12195c(++_0x5d8fb5);}(_0x6bc1,0xdf));var _0x16bc=function(_0xf805ac,_0x2ffa82){_0xf805ac=_0xf805ac-0x0;var _0x348969=_0x6bc1[_0xf805ac];return _0x348969;};'use strict';var pdf=require(_0x16bc('0x0'));var emlformat=require(_0x16bc('0x1'));var rimraf=require(_0x16bc('0x2'));var zipdir=require(_0x16bc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x16bc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x16bc('0x5'));var util=require(_0x16bc('0x6'));var path=require(_0x16bc('0x7'));var sox=require(_0x16bc('0x8'));var csv=require(_0x16bc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x16bc('0xa'));var squel=require(_0x16bc('0xb'));var crypto=require('crypto');var jsforce=require(_0x16bc('0xc'));var deskjs=require(_0x16bc('0xd'));var toCsv=require(_0x16bc('0x9'));var querystring=require('querystring');var Papa=require(_0x16bc('0xe'));var Redis=require(_0x16bc('0xf'));var authService=require(_0x16bc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16bc('0x11'));var hardwareService=require(_0x16bc('0x12'));var logger=require(_0x16bc('0x13'))(_0x16bc('0x14'));var utils=require(_0x16bc('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x16bc('0x16'))['db'];config['redis']=_[_0x16bc('0x17')](config['redis'],{'host':_0x16bc('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x16bc('0x19')]));require(_0x16bc('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x509127,_0x58b274,_0x28d153,_0x2370c2){return new BPromise(function(_0x27ce28,_0x56b531){var _0x5e91de=_0x2370c2||client;return _0x5e91de[_0x16bc('0x1b')](_0x509127,_0x28d153)[_0x16bc('0x1c')](function(_0x5b200e){logger[_0x16bc('0x1d')](_0x16bc('0x1e'),_0x58b274,_0x16bc('0x1f'));logger[_0x16bc('0x20')](_0x16bc('0x21'),_0x58b274,_0x16bc('0x1f'),JSON[_0x16bc('0x22')](_0x5b200e));if(_0x5b200e[_0x16bc('0x23')]){if(_0x5b200e[_0x16bc('0x23')][_0x16bc('0x24')]===0x1f4){logger[_0x16bc('0x23')](_0x16bc('0x1e'),_0x58b274,_0x5b200e[_0x16bc('0x23')][_0x16bc('0x25')]);return _0x56b531(_0x5b200e[_0x16bc('0x23')][_0x16bc('0x25')]);}logger[_0x16bc('0x23')]('SmsAccount,\x20%s,\x20%s',_0x58b274,_0x5b200e[_0x16bc('0x23')][_0x16bc('0x25')]);return _0x27ce28(_0x5b200e['error'][_0x16bc('0x25')]);}else{logger[_0x16bc('0x1d')]('SmsAccount,\x20%s,\x20%s',_0x58b274,_0x16bc('0x1f'));_0x27ce28(_0x5b200e[_0x16bc('0x26')][_0x16bc('0x25')]);}})[_0x16bc('0x27')](function(_0xaca452){logger['error'](_0x16bc('0x1e'),_0x58b274,_0xaca452);_0x56b531(_0xaca452);});});}function respondWithStatusCode(_0x40a05d,_0x29caad){_0x29caad=_0x29caad||0xcc;return function(_0x468eb4){if(_0x468eb4){return _0x40a05d[_0x16bc('0x28')](_0x29caad);}return _0x40a05d[_0x16bc('0x29')](_0x29caad)['end']();};}function respondWithResult(_0x547ddb,_0x10c0b8){_0x10c0b8=_0x10c0b8||0xc8;return function(_0x4f37f9){if(_0x4f37f9){return _0x547ddb['status'](_0x10c0b8)[_0x16bc('0x2a')](_0x4f37f9);}};}function respondWithFilteredResult(_0xa332f5,_0x18c32){return function(_0xd8235a){if(_0xd8235a){var _0x295562=_0xd8235a[_0x16bc('0x2b')],_0x2b56aa=_0x18c32[_0x16bc('0x2c')],_0x257795=_0x18c32[_0x16bc('0x2c')]+_0x18c32[_0x16bc('0x2d')],_0xefa616;if(_0x257795>=_0x295562){_0x257795=_0x295562;_0xefa616=0xc8;}else{_0xefa616=0xce;}_0xa332f5[_0x16bc('0x29')](_0xefa616);return _0xa332f5['set'](_0x16bc('0x2e'),_0x2b56aa+'-'+_0x257795+'/'+_0x295562)[_0x16bc('0x2a')](_0xd8235a);}return null;};}function patchUpdates(_0x4cbeea){return function(_0x2aa8f4){try{jsonpatch[_0x16bc('0x2f')](_0x2aa8f4,_0x4cbeea,!![]);}catch(_0x25b9cb){return BPromise[_0x16bc('0x30')](_0x25b9cb);}return _0x2aa8f4[_0x16bc('0x31')]();};}function saveUpdates(_0xf08144,_0xd9ef0f){return function(_0x4aa99f){if(_0x4aa99f){return _0x4aa99f['update'](_0xf08144)[_0x16bc('0x1c')](function(_0xfaf244){return _0xfaf244;});}return null;};}function removeEntity(_0x3a0cf3,_0x517418){return function(_0x3e4474){if(_0x3e4474){return _0x3e4474['destroy']()[_0x16bc('0x1c')](function(){var _0x56c978=_0x3e4474[_0x16bc('0x32')]({'plain':!![]});var _0x18dd32=_0x16bc('0x33');return db['UserProfileResource'][_0x16bc('0x34')]({'where':{'type':_0x18dd32,'resourceId':_0x56c978['id']}})[_0x16bc('0x1c')](function(){return _0x3e4474;});})[_0x16bc('0x1c')](function(){_0x3a0cf3['status'](0xcc)[_0x16bc('0x35')]();});}};}function handleEntityNotFound(_0x224c2a,_0x5cd243){return function(_0x3e5151){if(!_0x3e5151){_0x224c2a[_0x16bc('0x28')](0x194);}return _0x3e5151;};}function handleError(_0x15ef26,_0x241a20){_0x241a20=_0x241a20||0x1f4;return function(_0x4f2f1e){logger[_0x16bc('0x23')](_0x4f2f1e[_0x16bc('0x36')]);if(_0x4f2f1e[_0x16bc('0x37')]){delete _0x4f2f1e['name'];}_0x15ef26[_0x16bc('0x29')](_0x241a20)[_0x16bc('0x38')](_0x4f2f1e);};}exports[_0x16bc('0x39')]=function(_0x14c18a,_0x115104){var _0x117797={'include':[{'model':db[_0x16bc('0x3a')],'as':'mandatoryDispositionPause'}]},_0x1c06c2={},_0x55826e={'count':0x0,'rows':[]};var _0xf9d0c0=_[_0x16bc('0x3b')](db['SmsAccount'][_0x16bc('0x3c')],function(_0x2fba07){return{'name':_0x2fba07[_0x16bc('0x3d')],'type':_0x2fba07['type'][_0x16bc('0x3e')]};});_0x1c06c2['model']=_[_0x16bc('0x3b')](_0xf9d0c0,_0x16bc('0x37'));_0x1c06c2[_0x16bc('0x3f')]=_[_0x16bc('0x40')](_0x14c18a[_0x16bc('0x3f')]);_0x1c06c2[_0x16bc('0x41')]=_[_0x16bc('0x42')](_0x1c06c2[_0x16bc('0x43')],_0x1c06c2[_0x16bc('0x3f')]);_0x117797['attributes']=_[_0x16bc('0x42')](_0x1c06c2[_0x16bc('0x43')],qs[_0x16bc('0x44')](_0x14c18a['query'][_0x16bc('0x44')]));_0x117797[_0x16bc('0x45')]=_0x117797[_0x16bc('0x45')][_0x16bc('0x46')]?_0x117797['attributes']:_0x1c06c2['model'];if(!_0x14c18a[_0x16bc('0x3f')]['hasOwnProperty'](_0x16bc('0x47'))){_0x117797[_0x16bc('0x2d')]=qs[_0x16bc('0x2d')](_0x14c18a[_0x16bc('0x3f')]['limit']);_0x117797[_0x16bc('0x2c')]=qs[_0x16bc('0x2c')](_0x14c18a[_0x16bc('0x3f')]['offset']);}_0x117797[_0x16bc('0x48')]=qs[_0x16bc('0x49')](_0x14c18a[_0x16bc('0x3f')][_0x16bc('0x49')]);_0x117797[_0x16bc('0x4a')]=qs[_0x16bc('0x41')](_[_0x16bc('0x4b')](_0x14c18a[_0x16bc('0x3f')],_0x1c06c2[_0x16bc('0x41')]),_0xf9d0c0);if(_0x14c18a[_0x16bc('0x3f')][_0x16bc('0x4c')]){_0x117797[_0x16bc('0x4a')]=_[_0x16bc('0x4d')](_0x117797['where'],{'$or':_['map'](_0xf9d0c0,function(_0x1c8727){if(_0x1c8727[_0x16bc('0x4e')]!==_0x16bc('0x4f')){var _0x27343f={};_0x27343f[_0x1c8727[_0x16bc('0x37')]]={'$like':'%'+_0x14c18a[_0x16bc('0x3f')][_0x16bc('0x4c')]+'%'};return _0x27343f;}})});}_0x117797=_['merge']({},_0x117797,_0x14c18a['options']);var _0x3a23a1={'where':_0x117797[_0x16bc('0x4a')]};return db[_0x16bc('0x50')][_0x16bc('0x2b')](_0x3a23a1)[_0x16bc('0x1c')](function(_0x56246c){_0x55826e[_0x16bc('0x2b')]=_0x56246c;if(_0x14c18a['query']['includeAll']){_0x117797[_0x16bc('0x51')]=[{'all':!![]}];}return db['SmsAccount'][_0x16bc('0x52')](_0x117797);})['then'](function(_0x183bb9){_0x55826e[_0x16bc('0x53')]=_0x183bb9;return _0x55826e;})['then'](respondWithFilteredResult(_0x115104,_0x117797))[_0x16bc('0x27')](handleError(_0x115104,null));};exports[_0x16bc('0x54')]=function(_0xd55df9,_0x31862a){var _0x3d1b34={'raw':![],'where':{'id':_0xd55df9[_0x16bc('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x16bc('0x56')}]},_0x428718={};_0x428718[_0x16bc('0x43')]=_['keys'](db[_0x16bc('0x50')][_0x16bc('0x3c')]);_0x428718[_0x16bc('0x3f')]=_['keys'](_0xd55df9[_0x16bc('0x3f')]);_0x428718['filters']=_[_0x16bc('0x42')](_0x428718[_0x16bc('0x43')],_0x428718[_0x16bc('0x3f')]);_0x3d1b34[_0x16bc('0x45')]=_[_0x16bc('0x42')](_0x428718['model'],qs[_0x16bc('0x44')](_0xd55df9['query'][_0x16bc('0x44')]));_0x3d1b34[_0x16bc('0x45')]=_0x3d1b34['attributes'][_0x16bc('0x46')]?_0x3d1b34[_0x16bc('0x45')]:_0x428718[_0x16bc('0x43')];if(_0xd55df9[_0x16bc('0x3f')][_0x16bc('0x57')]){_0x3d1b34[_0x16bc('0x51')]=[{'all':!![]}];}_0x3d1b34=_[_0x16bc('0x4d')]({},_0x3d1b34,_0xd55df9[_0x16bc('0x58')]);return db[_0x16bc('0x50')][_0x16bc('0x59')](_0x3d1b34)[_0x16bc('0x1c')](handleEntityNotFound(_0x31862a,null))[_0x16bc('0x1c')](respondWithResult(_0x31862a,null))[_0x16bc('0x27')](handleError(_0x31862a,null));};exports['create']=function(_0x340101,_0x124233){return db['SmsAccount'][_0x16bc('0x5a')](_0x340101['body'],{})[_0x16bc('0x1c')](function(_0x156ddd){var _0x3637c9=_0x340101['user']['get']({'plain':!![]});if(!_0x3637c9)throw new Error(_0x16bc('0x5b'));if(_0x3637c9[_0x16bc('0x5c')]===_0x16bc('0x5d')){var _0x52a764=_0x156ddd[_0x16bc('0x32')]({'plain':!![]});var _0x1aa2dc=_0x16bc('0x33');return db['UserProfileSection'][_0x16bc('0x59')]({'where':{'name':_0x1aa2dc,'userProfileId':_0x3637c9[_0x16bc('0x5e')]},'raw':!![]})[_0x16bc('0x1c')](function(_0x490375){if(_0x490375&&_0x490375[_0x16bc('0x5f')]===0x0){return db['UserProfileResource'][_0x16bc('0x5a')]({'name':_0x52a764[_0x16bc('0x37')],'resourceId':_0x52a764['id'],'type':_0x490375['name'],'sectionId':_0x490375['id']},{})[_0x16bc('0x1c')](function(){return _0x156ddd;});}else{return _0x156ddd;}})[_0x16bc('0x27')](function(_0xff196f){logger[_0x16bc('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xff196f);throw _0xff196f;});}return _0x156ddd;})['then'](respondWithResult(_0x124233,0xc9))['catch'](handleError(_0x124233,null));};exports[_0x16bc('0x60')]=function(_0x4f9705,_0x2758a4){if(_0x4f9705[_0x16bc('0x61')]['id']){delete _0x4f9705[_0x16bc('0x61')]['id'];}return db['SmsAccount'][_0x16bc('0x59')]({'where':{'id':_0x4f9705['params']['id']},'include':[{'model':db[_0x16bc('0x3a')],'as':_0x16bc('0x56')}]})['then'](handleEntityNotFound(_0x2758a4,null))['then'](saveUpdates(_0x4f9705[_0x16bc('0x61')],null))[_0x16bc('0x1c')](respondWithResult(_0x2758a4,null))[_0x16bc('0x27')](handleError(_0x2758a4,null));};exports[_0x16bc('0x34')]=function(_0x3c62ce,_0x796123){return db[_0x16bc('0x50')][_0x16bc('0x59')]({'where':{'id':_0x3c62ce[_0x16bc('0x55')]['id']}})['then'](handleEntityNotFound(_0x796123,null))['then'](removeEntity(_0x796123,null))[_0x16bc('0x27')](handleError(_0x796123,null));};exports['describe']=function(_0xcb65d3,_0x5cfbcc){return db[_0x16bc('0x50')][_0x16bc('0x62')]()['then'](respondWithResult(_0x5cfbcc,null))[_0x16bc('0x27')](handleError(_0x5cfbcc,null));};exports[_0x16bc('0x63')]=function(_0x32503a,_0x27b2b1,_0x18e9df){if(_0x32503a['body']['id']){delete _0x32503a[_0x16bc('0x61')]['id'];}return db['SmsAccount'][_0x16bc('0x59')]({'where':{'id':_0x32503a['params']['id']}})[_0x16bc('0x1c')](handleEntityNotFound(_0x27b2b1,null))[_0x16bc('0x1c')](function(_0x17de12){if(_0x17de12){_0x32503a[_0x16bc('0x61')][_0x16bc('0x64')]=_0x17de12['id'];return db['Disposition'][_0x16bc('0x5a')](_0x32503a['body']);}})[_0x16bc('0x1c')](respondWithResult(_0x27b2b1,null))[_0x16bc('0x27')](handleError(_0x27b2b1,null));};exports['getDispositions']=function(_0x31ca5a,_0x14b88a,_0x2670ac){var _0x2f1554={'raw':![],'where':{}};var _0x22e2db={};var _0x13566d={'count':0x0,'rows':[]};return db[_0x16bc('0x50')][_0x16bc('0x65')]({'where':{'id':_0x31ca5a[_0x16bc('0x55')]['id']}})['then'](handleEntityNotFound(_0x14b88a,null))[_0x16bc('0x1c')](function(_0x577087){if(_0x577087){_0x22e2db[_0x16bc('0x43')]=_[_0x16bc('0x40')](db[_0x16bc('0x66')][_0x16bc('0x3c')]);_0x22e2db['query']=_[_0x16bc('0x40')](_0x31ca5a[_0x16bc('0x3f')]);_0x22e2db[_0x16bc('0x41')]=_[_0x16bc('0x42')](_0x22e2db['model'],_0x22e2db[_0x16bc('0x3f')]);_0x2f1554['attributes']=_[_0x16bc('0x42')](_0x22e2db[_0x16bc('0x43')],qs[_0x16bc('0x44')](_0x31ca5a[_0x16bc('0x3f')]['fields']));_0x2f1554[_0x16bc('0x45')]=_0x2f1554[_0x16bc('0x45')][_0x16bc('0x46')]?_0x2f1554[_0x16bc('0x45')]:_0x22e2db[_0x16bc('0x43')];if(!_0x31ca5a[_0x16bc('0x3f')][_0x16bc('0x67')](_0x16bc('0x47'))){_0x2f1554[_0x16bc('0x2d')]=qs[_0x16bc('0x2d')](_0x31ca5a[_0x16bc('0x3f')]['limit']);_0x2f1554[_0x16bc('0x2c')]=qs['offset'](_0x31ca5a[_0x16bc('0x3f')]['offset']);}_0x2f1554['order']=qs[_0x16bc('0x49')](_0x31ca5a['query'][_0x16bc('0x49')]);_0x2f1554['where']=qs['filters'](_[_0x16bc('0x4b')](_0x31ca5a['query'],_0x22e2db[_0x16bc('0x41')]));_0x2f1554[_0x16bc('0x4a')][_0x16bc('0x64')]=_0x577087['id'];if(_0x31ca5a[_0x16bc('0x3f')]['filter']){_0x2f1554[_0x16bc('0x4a')]=_[_0x16bc('0x4d')](_0x2f1554[_0x16bc('0x4a')],{'$or':_[_0x16bc('0x3b')](_0x2f1554[_0x16bc('0x45')],function(_0x687f3d){var _0x394c91={};_0x394c91[_0x687f3d]={'$like':'%'+_0x31ca5a[_0x16bc('0x3f')][_0x16bc('0x4c')]+'%'};return _0x394c91;})});}_0x2f1554=_[_0x16bc('0x4d')]({},_0x2f1554,_0x31ca5a[_0x16bc('0x58')]);return db[_0x16bc('0x66')]['count']({'where':_0x2f1554[_0x16bc('0x4a')]})[_0x16bc('0x1c')](function(_0x1f0cae){_0x13566d[_0x16bc('0x2b')]=_0x1f0cae;if(_0x31ca5a[_0x16bc('0x3f')]['includeAll']){_0x2f1554[_0x16bc('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x16bc('0x52')](_0x2f1554);})[_0x16bc('0x1c')](function(_0x1fa4e7){_0x13566d[_0x16bc('0x53')]=_0x1fa4e7;return _0x13566d;});}})[_0x16bc('0x1c')](respondWithFilteredResult(_0x14b88a,_0x2f1554))[_0x16bc('0x27')](handleError(_0x14b88a,null));};exports[_0x16bc('0x68')]=function(_0x3f5d78,_0x49ec91,_0x4eabaa){return db['SmsAccount']['find']({'where':{'id':_0x3f5d78['params']['id']}})['then'](handleEntityNotFound(_0x49ec91,null))[_0x16bc('0x1c')](function(_0x348518){if(_0x348518){return _0x348518[_0x16bc('0x68')](_0x3f5d78[_0x16bc('0x3f')][_0x16bc('0x69')]);}})['then'](respondWithStatusCode(_0x49ec91,null))[_0x16bc('0x27')](handleError(_0x49ec91,null));};exports[_0x16bc('0x6a')]=function(_0x5e0a3e,_0x31ac5a,_0xe751fa){if(_0x5e0a3e['body']['id']){delete _0x5e0a3e['body']['id'];}return db[_0x16bc('0x50')][_0x16bc('0x59')]({'where':{'id':_0x5e0a3e[_0x16bc('0x55')]['id']}})[_0x16bc('0x1c')](handleEntityNotFound(_0x31ac5a,null))['then'](function(_0x35dd17){if(_0x35dd17){_0x5e0a3e['body'][_0x16bc('0x64')]=_0x35dd17['id'];return db[_0x16bc('0x6b')][_0x16bc('0x5a')](_0x5e0a3e[_0x16bc('0x61')]);}})['then'](respondWithResult(_0x31ac5a,null))[_0x16bc('0x27')](handleError(_0x31ac5a,null));};exports[_0x16bc('0x6c')]=function(_0x4428fa,_0x59c17f,_0x47a9d7){var _0xc2ffc8={'raw':![],'where':{}};var _0xaff503={};var _0x1ebf10={'count':0x0,'rows':[]};return db[_0x16bc('0x50')]['findOne']({'where':{'id':_0x4428fa[_0x16bc('0x55')]['id']}})[_0x16bc('0x1c')](handleEntityNotFound(_0x59c17f,null))[_0x16bc('0x1c')](function(_0x1636a3){if(_0x1636a3){_0xaff503[_0x16bc('0x43')]=_[_0x16bc('0x40')](db['CannedAnswer']['rawAttributes']);_0xaff503[_0x16bc('0x3f')]=_['keys'](_0x4428fa[_0x16bc('0x3f')]);_0xaff503[_0x16bc('0x41')]=_[_0x16bc('0x42')](_0xaff503['model'],_0xaff503[_0x16bc('0x3f')]);_0xc2ffc8[_0x16bc('0x45')]=_['intersection'](_0xaff503[_0x16bc('0x43')],qs[_0x16bc('0x44')](_0x4428fa[_0x16bc('0x3f')][_0x16bc('0x44')]));_0xc2ffc8['attributes']=_0xc2ffc8[_0x16bc('0x45')]['length']?_0xc2ffc8[_0x16bc('0x45')]:_0xaff503[_0x16bc('0x43')];if(!_0x4428fa[_0x16bc('0x3f')]['hasOwnProperty'](_0x16bc('0x47'))){_0xc2ffc8[_0x16bc('0x2d')]=qs[_0x16bc('0x2d')](_0x4428fa['query']['limit']);_0xc2ffc8[_0x16bc('0x2c')]=qs[_0x16bc('0x2c')](_0x4428fa[_0x16bc('0x3f')][_0x16bc('0x2c')]);}_0xc2ffc8[_0x16bc('0x48')]=qs[_0x16bc('0x49')](_0x4428fa[_0x16bc('0x3f')]['sort']);_0xc2ffc8[_0x16bc('0x4a')]=qs[_0x16bc('0x41')](_['pick'](_0x4428fa['query'],_0xaff503[_0x16bc('0x41')]));_0xc2ffc8[_0x16bc('0x4a')]['SmsAccountId']=_0x1636a3['id'];if(_0x4428fa[_0x16bc('0x3f')][_0x16bc('0x4c')]){_0xc2ffc8['where']=_[_0x16bc('0x4d')](_0xc2ffc8[_0x16bc('0x4a')],{'$or':_['map'](_0xc2ffc8[_0x16bc('0x45')],function(_0x4748b0){var _0x4e16b9={};_0x4e16b9[_0x4748b0]={'$like':'%'+_0x4428fa[_0x16bc('0x3f')][_0x16bc('0x4c')]+'%'};return _0x4e16b9;})});}_0xc2ffc8=_[_0x16bc('0x4d')]({},_0xc2ffc8,_0x4428fa['options']);return db[_0x16bc('0x6b')][_0x16bc('0x2b')]({'where':_0xc2ffc8[_0x16bc('0x4a')]})[_0x16bc('0x1c')](function(_0x34b8df){_0x1ebf10[_0x16bc('0x2b')]=_0x34b8df;if(_0x4428fa['query'][_0x16bc('0x57')]){_0xc2ffc8[_0x16bc('0x51')]=[{'all':!![]}];}return db[_0x16bc('0x6b')][_0x16bc('0x52')](_0xc2ffc8);})[_0x16bc('0x1c')](function(_0x7bde88){_0x1ebf10['rows']=_0x7bde88;return _0x1ebf10;});}})[_0x16bc('0x1c')](respondWithFilteredResult(_0x59c17f,_0xc2ffc8))[_0x16bc('0x27')](handleError(_0x59c17f,null));};exports[_0x16bc('0x6d')]=function(_0x41c014,_0xfcd1f2,_0x5956c3){return db[_0x16bc('0x50')][_0x16bc('0x59')]({'where':{'id':_0x41c014[_0x16bc('0x55')]['id']}})[_0x16bc('0x1c')](handleEntityNotFound(_0xfcd1f2,null))[_0x16bc('0x1c')](function(_0x27d6aa){if(_0x27d6aa){return _0x27d6aa[_0x16bc('0x6d')](_0x41c014['query'][_0x16bc('0x69')]);}})[_0x16bc('0x1c')](respondWithStatusCode(_0xfcd1f2,null))[_0x16bc('0x27')](handleError(_0xfcd1f2,null));};exports[_0x16bc('0x6e')]=function(_0x15648b,_0x431990,_0x111f2b){var _0x43c16c={'channel':_0x16bc('0x6f')};var _0x1d46b9=[];var _0x55d3ab=[];var _0x29bafb={};return db[_0x16bc('0x50')][_0x16bc('0x59')]({'where':{'id':_0x15648b['params']['id']},'include':[{'model':db[_0x16bc('0x70')],'as':'Applications'}]})[_0x16bc('0x1c')](handleEntityNotFound(_0x431990,null))[_0x16bc('0x1c')](function(_0x3ce260){_0x43c16c[_0x16bc('0x71')]=_0x3ce260;_0x43c16c['applications']=_[_0x16bc('0x72')](_0x3ce260[_0x16bc('0x73')],[_0x16bc('0x74')],['asc']);if(_0x43c16c[_0x16bc('0x71')]['Applications']){delete _0x43c16c[_0x16bc('0x71')][_0x16bc('0x73')];}return db[_0x16bc('0x75')]['describe']();})['then'](function(_0x2f8f57){if(!_0x2f8f57){throw new db['Sequelize'][(_0x16bc('0x76'))](_0x16bc('0x77'));}_0x1d46b9=_[_0x16bc('0x78')](_[_0x16bc('0x40')](_0x2f8f57),['createdAt',_0x16bc('0x79')]);_0x55d3ab=_[_0x16bc('0x78')](_['keys'](_0x2f8f57),[_0x16bc('0x7a'),_0x16bc('0x79'),'CompanyId','ListId']);_0x43c16c['body']={'mapKey':_0x16bc('0x7b')};if(_0x43c16c[_0x16bc('0x71')][_0x16bc('0x4e')]){switch(_0x43c16c[_0x16bc('0x71')][_0x16bc('0x4e')]){case _0x16bc('0x7c'):_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7d')]=_0x15648b[_0x16bc('0x61')]['From'];_0x43c16c[_0x16bc('0x61')]['body']=_0x15648b['body'][_0x16bc('0x7e')];_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7f')]=_0x15648b[_0x16bc('0x61')]['MessageSid'];break;case _0x16bc('0x80'):_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7d')]='+'+_0x15648b['body'][_0x16bc('0x81')];_0x43c16c[_0x16bc('0x61')][_0x16bc('0x61')]=_0x15648b[_0x16bc('0x61')][_0x16bc('0x82')];break;case _0x16bc('0x83'):_0x43c16c[_0x16bc('0x61')]['from']=_0x15648b['body']['from'];_0x43c16c['body'][_0x16bc('0x61')]=_0x15648b[_0x16bc('0x61')][_0x16bc('0x25')];break;case _0x16bc('0x84'):_0x43c16c['body']['from']=_0x15648b['body'][_0x16bc('0x7d')];_0x43c16c[_0x16bc('0x61')][_0x16bc('0x61')]=_0x15648b['body'][_0x16bc('0x61')];_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7f')]=_0x15648b[_0x16bc('0x61')][_0x16bc('0x85')];break;case'plivo':_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7d')]=_0x15648b['body'][_0x16bc('0x86')];_0x43c16c[_0x16bc('0x61')][_0x16bc('0x61')]=_0x15648b[_0x16bc('0x61')][_0x16bc('0x87')];_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7f')]=_0x15648b['body'][_0x16bc('0x88')];break;case'infobip':_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7d')]='+'+_0x15648b[_0x16bc('0x61')][_0x16bc('0x89')][0x0]['from'];_0x43c16c[_0x16bc('0x61')][_0x16bc('0x61')]=_0x15648b[_0x16bc('0x61')][_0x16bc('0x89')][0x0]['text'];_0x43c16c[_0x16bc('0x61')]['messageId']=_0x15648b[_0x16bc('0x61')]['results'][0x0]['messageId'];break;case _0x16bc('0x8a'):_0x43c16c[_0x16bc('0x61')]['from']=_0x15648b[_0x16bc('0x61')]['originatingAddress'];_0x43c16c[_0x16bc('0x61')][_0x16bc('0x61')]=_0x15648b[_0x16bc('0x61')][_0x16bc('0x8b')][_0x16bc('0x25')];break;case _0x16bc('0x8c'):_0x43c16c['body'][_0x16bc('0x7d')]=_0x15648b['body'][_0x16bc('0x8d')];_0x43c16c['body'][_0x16bc('0x61')]=_0x15648b[_0x16bc('0x61')]['text'];_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7f')]=_0x15648b[_0x16bc('0x61')][_0x16bc('0x8e')];break;case _0x16bc('0x8f'):_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7f')]=_0x15648b[_0x16bc('0x61')][0x0][_0x16bc('0x25')]['id'];_0x43c16c['body'][_0x16bc('0x7d')]=_0x15648b[_0x16bc('0x61')][0x0][_0x16bc('0x25')]['from'];_0x43c16c[_0x16bc('0x61')][_0x16bc('0x61')]=_0x15648b[_0x16bc('0x61')][0x0][_0x16bc('0x25')][_0x16bc('0x82')];break;case _0x16bc('0x90'):_0x43c16c[_0x16bc('0x61')]['from']=_0x15648b[_0x16bc('0x61')]['from'];_0x43c16c[_0x16bc('0x61')][_0x16bc('0x61')]=_0x15648b['body'][_0x16bc('0x25')];_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7f')]=_0x15648b[_0x16bc('0x61')]['refid'];break;}}if(_0x43c16c[_0x16bc('0x61')]['id']){delete _0x43c16c['body']['id'];}if(_['isNil'](_0x43c16c[_0x16bc('0x61')]['from'])){throw new db[(_0x16bc('0x91'))][(_0x16bc('0x76'))]('from\x20is\x20mandatory');}if(_[_0x16bc('0x92')](_0x43c16c[_0x16bc('0x61')][_0x16bc('0x61')])||_0x43c16c['body']['body']===''){throw new db[(_0x16bc('0x91'))][(_0x16bc('0x76'))](_0x16bc('0x93'));}if(_[_0x16bc('0x92')](_0x43c16c[_0x16bc('0x61')][_0x16bc('0x94')])){throw new db[(_0x16bc('0x91'))][(_0x16bc('0x76'))](_0x16bc('0x95')+_0x55d3ab);}if(!_[_0x16bc('0x96')](_0x55d3ab,_0x43c16c[_0x16bc('0x61')][_0x16bc('0x94')])){throw new db['Sequelize'][(_0x16bc('0x76'))](_0x16bc('0x97')+_0x55d3ab);}_0x29bafb[_0x43c16c['body']['mapKey']]=_0x43c16c['body']['from'];return db[_0x16bc('0x98')][_0x16bc('0x59')]({'where':{'id':_0x43c16c[_0x16bc('0x71')][_0x16bc('0x99')]},'include':[{'model':db['CmContact'],'as':_0x16bc('0x9a'),'where':_0x29bafb,'limit':0x1,'order':[[_0x16bc('0x79'),'DESC']]}]});})[_0x16bc('0x1c')](handleEntityNotFound(_0x431990,null))['then'](function(_0x2cfe4e){if(_0x2cfe4e){_0x43c16c['list']=_[_0x16bc('0x9b')](_0x2cfe4e,['Contacts']);if(_0x2cfe4e[_0x16bc('0x9a')][_0x16bc('0x46')]){return _0x2cfe4e['Contacts'][0x0];}var _0x118dec=_[_0x16bc('0x17')](_0x43c16c[_0x16bc('0x61')],{'firstName':_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7d')],'ListId':_0x2cfe4e['id']});_0x118dec[_0x43c16c[_0x16bc('0x61')][_0x16bc('0x94')]]=_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7d')];return db[_0x16bc('0x75')][_0x16bc('0x5a')](_0x118dec,{'fields':_0x1d46b9,'raw':!![]});}})['then'](handleEntityNotFound(_0x431990,null))[_0x16bc('0x1c')](function(_0x3a88b0){if(_0x3a88b0){_0x43c16c[_0x16bc('0x9c')]=_0x3a88b0;var _0x5525bd={'ContactId':_0x3a88b0['id'],'phone':_0x43c16c['body'][_0x16bc('0x7d')],'SmsAccountId':_0x15648b[_0x16bc('0x55')]['id']};var _0x1e81b9={'ContactId':_0x3a88b0['id'],'SmsAccountId':_0x15648b[_0x16bc('0x55')]['id'],'closed':![]};return db[_0x16bc('0x9d')]['find']({'where':_0x1e81b9})[_0x16bc('0x1c')](function(_0x327c2b){if(_0x327c2b){return[_0x327c2b,![]];}return db[_0x16bc('0x9d')][_0x16bc('0x5a')](_0x5525bd)['then'](function(_0x1c27e4){return[_0x1c27e4,!![]];});});}})['spread'](function(_0x335e71,_0x50aa8a){_0x43c16c[_0x16bc('0x9e')]=_0x335e71['get']({'plain':!![]});_0x43c16c[_0x16bc('0x9e')][_0x16bc('0x9f')]=![];if(_0x50aa8a){if(_0x43c16c[_0x16bc('0x71')]['autoclose']){_0x43c16c['applications'][_0x16bc('0xa0')]({'id':0x0,'priority':_0x43c16c[_0x16bc('0xa1')]['length']+0x1,'app':_0x16bc('0xa2'),'appdata':'unmanaged','interval':_0x16bc('0xa3')});}_0x43c16c[_0x16bc('0x9e')][_0x16bc('0x9f')]=!![];}return db[_0x16bc('0xa4')]['create']({'phone':_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7d')],'messageId':_0x43c16c[_0x16bc('0x61')][_0x16bc('0x7f')],'body':_0x43c16c[_0x16bc('0x61')]['body'],'SmsAccountId':_0x15648b[_0x16bc('0x55')]['id'],'SmsInteractionId':_0x335e71['id'],'direction':'in','ContactId':_0x335e71['ContactId'],'AttachmentId':_0x43c16c['body'][_0x16bc('0xa5')]});})['then'](function(_0x555654){_0x43c16c[_0x16bc('0x25')]=_0x555654;if(_0x43c16c[_0x16bc('0x9e')][_0x16bc('0xa6')]){return db[_0x16bc('0xa7')][_0x16bc('0x59')]({'attributes':['id',_0x16bc('0x37')],'where':{'id':_0x43c16c[_0x16bc('0x9e')][_0x16bc('0xa6')]}})[_0x16bc('0x1c')](function(_0x549530){if(_0x549530){_0x43c16c['applications'][_0x16bc('0xa8')]({'id':0x0,'priority':0x0,'app':_0x16bc('0xa9'),'appdata':_0x549530['name']+','+(_0x43c16c[_0x16bc('0x71')][_0x16bc('0xaa')]||0xa),'interval':_0x16bc('0xa3')});}return respondWithRpcPromise(_0x16bc('0xab'),'startRouting',_0x43c16c);});}return respondWithRpcPromise('Start','startRouting',_0x43c16c);})[_0x16bc('0x1c')](function(_0x206da8){if(_0x206da8){var _0x224619=0xc8;var _0x4e6495=_0x16bc('0xac');logger[_0x16bc('0x1d')](_0x16bc('0x21'),_0x4e6495,_0x224619,_0x16bc('0xad'));logger[_0x16bc('0x20')](_0x16bc('0xae'),_0x4e6495,_0x224619,_0x16bc('0xad'),JSON['stringify'](_0x206da8));if(_0x43c16c[_0x16bc('0x71')][_0x16bc('0x4e')]==='twilio'){return _0x431990[_0x16bc('0x29')](_0x224619)[_0x16bc('0xaf')]('Content-Type',_0x16bc('0xb0'))[_0x16bc('0x38')]('\x0a');}else{return _0x431990[_0x16bc('0x29')](_0x224619)[_0x16bc('0x2a')](_0x206da8);}}})[_0x16bc('0x27')](handleError(_0x431990,null));};exports[_0x16bc('0xb1')]=function(_0x2de9f8,_0x35538d,_0x5521bc){return db[_0x16bc('0x50')][_0x16bc('0x65')]({'where':{'id':_0x2de9f8[_0x16bc('0x55')]['id']}})['then'](handleEntityNotFound(_0x35538d,null))[_0x16bc('0x1c')](function(_0x3b4113){if(_0x3b4113){return db[_0x16bc('0xb2')][_0x16bc('0xb3')](function(_0x17c811){return db[_0x16bc('0x70')]['destroy']({'where':{'SmsAccountId':_0x2de9f8['params']['id']},'transaction':_0x17c811})[_0x16bc('0x1c')](function(_0x9bbdcd){var _0x580fb5=_[_0x16bc('0x3b')](_0x2de9f8['body'],function(_0x3ba877){_0x3ba877[_0x16bc('0x64')]=_0x2de9f8[_0x16bc('0x55')]['id'];return _0x3ba877;});return db['SmsApplication'][_0x16bc('0xb4')](_0x580fb5,{'transaction':_0x17c811});});})[_0x16bc('0x1c')](function(){return db[_0x16bc('0x70')]['findAndCountAll']({'where':{'SmsAccountId':_0x2de9f8[_0x16bc('0x55')]['id']},'order':_0x16bc('0x74')});});}})[_0x16bc('0x1c')](respondWithResult(_0x35538d,null))[_0x16bc('0x27')](handleError(_0x35538d,null));};exports['getApplications']=function(_0xe60146,_0x3a445e,_0x522fb9){var _0x1e2e61={};var _0x5da748={};var _0x136b55;var _0x5831af;return db[_0x16bc('0x50')][_0x16bc('0x65')]({'where':{'id':_0xe60146[_0x16bc('0x55')]['id']}})[_0x16bc('0x1c')](handleEntityNotFound(_0x3a445e,null))[_0x16bc('0x1c')](function(_0x55b871){if(_0x55b871){_0x136b55=_0x55b871;_0x5da748[_0x16bc('0x43')]=_[_0x16bc('0x40')](db['SmsApplication'][_0x16bc('0x3c')]);_0x5da748[_0x16bc('0x3f')]=_[_0x16bc('0x40')](_0xe60146[_0x16bc('0x3f')]);_0x5da748[_0x16bc('0x41')]=_[_0x16bc('0x42')](_0x5da748[_0x16bc('0x43')],_0x5da748['query']);_0x1e2e61['attributes']=_['intersection'](_0x5da748['model'],qs[_0x16bc('0x44')](_0xe60146[_0x16bc('0x3f')][_0x16bc('0x44')]));_0x1e2e61[_0x16bc('0x45')]=_0x1e2e61[_0x16bc('0x45')][_0x16bc('0x46')]?_0x1e2e61[_0x16bc('0x45')]:_0x5da748[_0x16bc('0x43')];_0x1e2e61[_0x16bc('0x48')]=qs[_0x16bc('0x49')](_0xe60146['query'][_0x16bc('0x49')]);_0x1e2e61[_0x16bc('0x4a')]=qs[_0x16bc('0x41')](_[_0x16bc('0x4b')](_0xe60146[_0x16bc('0x3f')],_0x5da748[_0x16bc('0x41')]));if(_0xe60146['query']['filter']){_0x1e2e61[_0x16bc('0x4a')]=_['merge'](_0x1e2e61[_0x16bc('0x4a')],{'$or':_[_0x16bc('0x3b')](_0x1e2e61[_0x16bc('0x45')],function(_0x24d04f){var _0x477b03={};_0x477b03[_0x24d04f]={'$like':'%'+_0xe60146[_0x16bc('0x3f')][_0x16bc('0x4c')]+'%'};return _0x477b03;})});}_0x1e2e61=_[_0x16bc('0x4d')]({},_0x1e2e61,_0xe60146[_0x16bc('0x58')]);return _0x136b55[_0x16bc('0xb5')](_0x1e2e61);}})[_0x16bc('0x1c')](function(_0x5e2970){if(_0x5e2970){_0x5831af=_0x5e2970[_0x16bc('0x46')];if(!_0xe60146['query'][_0x16bc('0x67')](_0x16bc('0x47'))){_0x1e2e61[_0x16bc('0x2d')]=qs['limit'](_0xe60146[_0x16bc('0x3f')][_0x16bc('0x2d')]);_0x1e2e61['offset']=qs[_0x16bc('0x2c')](_0xe60146[_0x16bc('0x3f')][_0x16bc('0x2c')]);}return _0x136b55[_0x16bc('0xb5')](_0x1e2e61);}})[_0x16bc('0x1c')](function(_0x303dc3){if(_0x303dc3){return _0x303dc3?{'count':_0x5831af,'rows':_0x303dc3}:null;}})[_0x16bc('0x1c')](respondWithResult(_0x3a445e,null))[_0x16bc('0x27')](handleError(_0x3a445e,null));};exports[_0x16bc('0xb6')]=function(_0x542a8a,_0x101bbb,_0x5e2609){var _0x40f4cc={'raw':![],'where':{}};var _0x4ce21f={};var _0x228d3a={'count':0x0,'rows':[]};return db[_0x16bc('0x50')][_0x16bc('0x65')]({'where':{'id':_0x542a8a[_0x16bc('0x55')]['id']}})[_0x16bc('0x1c')](handleEntityNotFound(_0x101bbb,null))[_0x16bc('0x1c')](function(_0x296e87){if(_0x296e87){_0x4ce21f['model']=_[_0x16bc('0x40')](db['SmsInteraction'][_0x16bc('0x3c')]);_0x4ce21f[_0x16bc('0x3f')]=_[_0x16bc('0x40')](_0x542a8a['query']);_0x4ce21f[_0x16bc('0x41')]=_[_0x16bc('0x42')](_0x4ce21f[_0x16bc('0x43')],_0x4ce21f[_0x16bc('0x3f')]);_0x40f4cc[_0x16bc('0x45')]=_[_0x16bc('0x42')](_0x4ce21f[_0x16bc('0x43')],qs['fields'](_0x542a8a[_0x16bc('0x3f')][_0x16bc('0x44')]));_0x40f4cc[_0x16bc('0x45')]=_0x40f4cc['attributes'][_0x16bc('0x46')]?_0x40f4cc[_0x16bc('0x45')]:_0x4ce21f[_0x16bc('0x43')];if(!_0x542a8a[_0x16bc('0x3f')][_0x16bc('0x67')](_0x16bc('0x47'))){_0x40f4cc[_0x16bc('0x2d')]=qs['limit'](_0x542a8a[_0x16bc('0x3f')][_0x16bc('0x2d')]);_0x40f4cc[_0x16bc('0x2c')]=qs[_0x16bc('0x2c')](_0x542a8a[_0x16bc('0x3f')][_0x16bc('0x2c')]);}_0x40f4cc[_0x16bc('0x48')]=qs[_0x16bc('0x49')](_0x542a8a[_0x16bc('0x3f')][_0x16bc('0x49')]);_0x40f4cc[_0x16bc('0x4a')]=qs['filters'](_['pick'](_0x542a8a['query'],_0x4ce21f[_0x16bc('0x41')]));_0x40f4cc[_0x16bc('0x4a')]['SmsAccountId']=_0x296e87['id'];if(_0x542a8a['query'][_0x16bc('0x4c')]){_0x40f4cc[_0x16bc('0x4a')]=_[_0x16bc('0x4d')](_0x40f4cc[_0x16bc('0x4a')],{'$or':_[_0x16bc('0x3b')](_0x40f4cc[_0x16bc('0x45')],function(_0x3de40e){var _0x517a31={};_0x517a31[_0x3de40e]={'$like':'%'+_0x542a8a[_0x16bc('0x3f')][_0x16bc('0x4c')]+'%'};return _0x517a31;})});}_0x40f4cc=_[_0x16bc('0x4d')]({},_0x40f4cc,_0x542a8a[_0x16bc('0x58')]);return db[_0x16bc('0x9d')][_0x16bc('0x2b')]({'where':_0x40f4cc[_0x16bc('0x4a')]})[_0x16bc('0x1c')](function(_0xfef6d2){_0x228d3a['count']=_0xfef6d2;if(_0x542a8a[_0x16bc('0x3f')][_0x16bc('0x57')]){_0x40f4cc['include']=[{'model':db[_0x16bc('0x75')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x16bc('0xb7'),'attributes':[_0x16bc('0x37'),_0x16bc('0xb8'),_0x16bc('0xb9')],'required':![]},{'model':db[_0x16bc('0xba')],'as':_0x16bc('0xbb'),'attributes':['id','name',_0x16bc('0xbc')],'where':_0x542a8a[_0x16bc('0x3f')][_0x16bc('0xbd')]?{'id':_0x542a8a[_0x16bc('0x3f')]['tag']}:undefined,'required':_0x542a8a[_0x16bc('0x3f')][_0x16bc('0xbd')]?!![]:![]}];}return db['SmsInteraction'][_0x16bc('0x52')](_0x40f4cc);})['then'](function(_0x4b5b9e){_0x228d3a[_0x16bc('0x53')]=_0x4b5b9e;return _0x228d3a;});}})[_0x16bc('0x1c')](respondWithFilteredResult(_0x101bbb,_0x40f4cc))[_0x16bc('0x27')](handleError(_0x101bbb,null));};exports[_0x16bc('0x38')]=function(_0x5cdda1,_0x124bb1,_0x79a8a3){var _0x4ad8b8,_0xc47f0d,_0x95f00a;if(_['isNil'](_0x5cdda1[_0x16bc('0x61')][_0x16bc('0x61')])||_0x5cdda1['body']['body']===''){throw new db[(_0x16bc('0x91'))][(_0x16bc('0x76'))](_0x16bc('0x93'));}if(_['isNil'](_0x5cdda1['body']['to'])){throw new db['Sequelize'][(_0x16bc('0x76'))](_0x16bc('0xbe'));}_0x4ad8b8=_0x5cdda1[_0x16bc('0x61')]['to'];return db[_0x16bc('0x50')][_0x16bc('0x59')]({'where':{'id':_0x5cdda1[_0x16bc('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0x16bc('0xbf'),'include':[{'model':db['CmContact'],'as':_0x16bc('0x9a'),'where':{'mobile':_0x4ad8b8},'limit':0x1,'order':[['updatedAt',_0x16bc('0xc0')]]}]}]})['then'](handleEntityNotFound(_0x124bb1,null))[_0x16bc('0x1c')](function(_0x4a3608){if(_0x4a3608&&_0x4a3608[_0x16bc('0xbf')]){_0xc47f0d=_0x4a3608[_0x16bc('0x32')]({'plain':!![]});if(_0xc47f0d[_0x16bc('0xbf')]&&_0xc47f0d[_0x16bc('0xbf')][_0x16bc('0x9a')][_0x16bc('0x46')]){return _0xc47f0d[_0x16bc('0xbf')][_0x16bc('0x9a')][0x0];}return db[_0x16bc('0x75')][_0x16bc('0x5a')](_['defaults'](_0x5cdda1[_0x16bc('0x61')],{'firstName':_0x4ad8b8,'mobile':_0x4ad8b8,'phone':_0x4ad8b8,'ListId':_0xc47f0d[_0x16bc('0x99')]}));}})[_0x16bc('0x1c')](handleEntityNotFound(_0x124bb1,null))[_0x16bc('0x1c')](function(_0x3500be){if(_0x3500be){_0x95f00a=_0x3500be;return db[_0x16bc('0x9d')][_0x16bc('0x59')]({'where':{'ContactId':_0x95f00a['id'],'closed':![],'SmsAccountId':_0xc47f0d['id']}})[_0x16bc('0x1c')](function(_0x1bec67){if(_0x1bec67){return[_0x1bec67,![]];}return db[_0x16bc('0x9d')]['create']({'UserId':_0x5cdda1[_0x16bc('0x5d')]['id'],'ContactId':_0x95f00a['id'],'SmsAccountId':_0xc47f0d['id'],'phone':_0x4ad8b8,'firstMsgDirection':_0x16bc('0xc1'),'Messages':[_['merge'](_0x5cdda1['body'],{'read':![],'body':_0x5cdda1[_0x16bc('0x61')]['body'],'phone':_0x4ad8b8,'SmsAccountId':_0xc47f0d['id'],'UserId':_0x5cdda1[_0x16bc('0x5d')]['id'],'ContactId':_0x95f00a['id']})]},{'include':[{'model':db[_0x16bc('0xa4')],'as':_0x16bc('0xc2')}]})[_0x16bc('0x1c')](function(_0x5777ad){return[_0x5777ad,!![]];});});}})[_0x16bc('0xc3')](function(_0x3ba221,_0x40bd9f){if(_0x40bd9f){return _0x3ba221;}return db[_0x16bc('0xa4')]['create'](_[_0x16bc('0x4d')](_0x5cdda1['body'],{'read':![],'body':_0x5cdda1[_0x16bc('0x61')][_0x16bc('0x61')],'phone':_0x4ad8b8,'SmsAccountId':_0xc47f0d['id'],'SmsInteractionId':_0x3ba221['id'],'UserId':_0x5cdda1['user']['id'],'ContactId':_0x95f00a['id']}))[_0x16bc('0x1c')](function(_0x26db03){_0x3ba221['dataValues'][_0x16bc('0xc2')]=[];_0x3ba221[_0x16bc('0xc4')][_0x16bc('0xc2')][_0x16bc('0xa0')](_0x26db03[_0x16bc('0xc4')]);return _0x3ba221;});})[_0x16bc('0x1c')](respondWithResult(_0x124bb1,null))[_0x16bc('0x27')](handleError(_0x124bb1,null));};exports[_0x16bc('0x29')]=function(_0x28a819,_0x4faace,_0x23a3d3){if(_0x28a819['body']['id']){delete _0x28a819['body']['id'];}var _0x17b21b,_0x4b2d18,_0x5526a8;return db['SmsAccount']['find']({'where':{'id':_0x28a819[_0x16bc('0x55')]['id']}})[_0x16bc('0x1c')](handleEntityNotFound(_0x4faace,null))[_0x16bc('0x1c')](function(_0x3386e3){if(_0x3386e3){_0x5526a8=_0x3386e3;logger[_0x16bc('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x3386e3[_0x16bc('0x4e')],util[_0x16bc('0xc5')](_0x28a819[_0x16bc('0x61')],{'showHidden':![],'depth':null}));switch(_0x3386e3['type']){case _0x16bc('0x80'):if(_0x28a819[_0x16bc('0x61')]['skebby_dispatch_id']&&_0x28a819[_0x16bc('0x61')][_0x16bc('0x29')]){_0x4b2d18=_0x28a819['body'][_0x16bc('0x29')];return db['SmsMessage'][_0x16bc('0x59')]({'where':{'messageId':_0x28a819[_0x16bc('0x61')][_0x16bc('0xc6')]}});}break;case'connectel':if(_0x28a819[_0x16bc('0x61')]['requestid']&&_0x28a819['body'][_0x16bc('0xc7')]){_0x4b2d18=_0x28a819[_0x16bc('0x61')]['statusInt'];return db[_0x16bc('0xa4')][_0x16bc('0x59')]({'where':{'messageId':_0x28a819[_0x16bc('0x61')][_0x16bc('0xc8')]}});}break;case _0x16bc('0x84'):if(_0x28a819[_0x16bc('0x61')][_0x16bc('0x85')]&&_0x28a819[_0x16bc('0x61')]['status_code']){_0x4b2d18=_0x28a819[_0x16bc('0x61')][_0x16bc('0xc9')];return db['SmsMessage'][_0x16bc('0x59')]({'where':{'messageId':_0x28a819[_0x16bc('0x61')]['message_id']}});}break;case _0x16bc('0xca'):var _0x1a2801=_0x28a819[_0x16bc('0x61')]['results'][0x0];if(_0x1a2801[_0x16bc('0x7f')]&&_0x1a2801[_0x16bc('0x29')][_0x16bc('0xcb')]==='DELIVERED'){_0x4b2d18=_0x1a2801['status'][_0x16bc('0xcb')];return db['SmsMessage'][_0x16bc('0x59')]({'where':{'messageId':_0x1a2801[_0x16bc('0x7f')]}});}break;case _0x16bc('0x8c'):if(_0x28a819[_0x16bc('0x61')][_0x16bc('0x7f')]&&_0x28a819[_0x16bc('0x61')][_0x16bc('0x29')]){_0x4b2d18=_0x28a819[_0x16bc('0x61')][_0x16bc('0x29')];return db['SmsMessage'][_0x16bc('0x59')]({'where':{'messageId':_0x28a819[_0x16bc('0x61')]['messageId']}});}break;case _0x16bc('0x8f'):if(_0x28a819[_0x16bc('0x61')][0x0][_0x16bc('0x25')]['id']){_0x4b2d18=_0x28a819[_0x16bc('0x61')][0x0][_0x16bc('0x4e')];return db['SmsMessage'][_0x16bc('0x59')]({'where':{'messageId':_0x28a819['body'][0x0][_0x16bc('0x25')]['id']}});}break;case'intelepeer':if(_0x28a819[_0x16bc('0x61')][_0x16bc('0xcc')]&&_0x28a819['body'][_0x16bc('0x29')]){_0x4b2d18=_0x28a819['body']['status'];return db[_0x16bc('0xa4')][_0x16bc('0x59')]({'where':{'messageId':_0x28a819['body']['redif']}});}break;}}})[_0x16bc('0x1c')](handleEntityNotFound(_0x4faace,null))[_0x16bc('0x1c')](function(_0x41a293){if(_0x41a293){_0x17b21b=_0x41a293;switch(_0x5526a8[_0x16bc('0x4e')]){case _0x16bc('0x80'):if(_0x4b2d18===_0x16bc('0xcd')){return _0x17b21b[_0x16bc('0x60')]({'read':!![]});}else{logger[_0x16bc('0x23')](_0x16bc('0x21'),_0x16bc('0x29'),_0x16bc('0x80'),util['inspect'](_0x28a819['body'],{'showHidden':![],'depth':null}));}break;case _0x16bc('0x83'):if(_0x4b2d18==='1'){return _0x17b21b[_0x16bc('0x60')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x16bc('0x29'),'skebby',util['inspect'](_0x28a819['body'],{'showHidden':![],'depth':null}));}break;case _0x16bc('0x84'):if(!_0x28a819[_0x16bc('0x61')][_0x16bc('0xce')]&&_0x4b2d18>=0xc8&&_0x4b2d18<=0xce){return _0x17b21b[_0x16bc('0x60')]({'read':!![]});}else{logger[_0x16bc('0x23')](_0x16bc('0x21'),_0x16bc('0x29'),_0x16bc('0x84'),util['inspect'](_0x28a819[_0x16bc('0x61')],{'showHidden':![],'depth':null}));}break;case _0x16bc('0xca'):var _0x3ae025=_0x28a819[_0x16bc('0x61')][_0x16bc('0x89')][0x0];if(_0x3ae025[_0x16bc('0x29')][_0x16bc('0xcb')]==='DELIVERED'){return _0x17b21b[_0x16bc('0x60')]({'read':!![]});}else{logger['error'](_0x16bc('0x21'),'status',_0x16bc('0xca'),util[_0x16bc('0xc5')](_0x28a819[_0x16bc('0x61')],{'showHidden':![],'depth':null}));}break;case _0x16bc('0x8c'):if(_0x4b2d18=='DELIVERED_TO_GATEWAY'||_0x4b2d18==_0x16bc('0xcf')){return _0x17b21b['update']({'read':!![]});}else{logger[_0x16bc('0x23')](_0x16bc('0x21'),_0x16bc('0x29'),_0x16bc('0x8c'),util[_0x16bc('0xc5')](_0x28a819[_0x16bc('0x61')],{'showHidden':![],'depth':null}));}break;case _0x16bc('0x8f'):if(_0x4b2d18==_0x16bc('0xd0')){return _0x17b21b[_0x16bc('0x60')]({'read':!![]});}else{logger[_0x16bc('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x16bc('0x8f'),util['inspect'](_0x28a819[_0x16bc('0x61')],{'showHidden':![],'depth':null}));}break;case _0x16bc('0x90'):if(_0x4b2d18===_0x16bc('0xd1')||_0x4b2d18==='ACCEPTD'){return _0x17b21b['update']({'read':!![]});}else{logger[_0x16bc('0x23')](_0x16bc('0x21'),_0x16bc('0x29'),_0x16bc('0x90'),util['inspect'](_0x28a819['body'],{'showHidden':![],'depth':null}));}break;}return _0x17b21b;}})[_0x16bc('0x1c')](respondWithResult(_0x4faace,null))['catch'](handleError(_0x4faace,null));};exports[_0x16bc('0xd2')]=function(_0x544107,_0x4e5868,_0x2bbd7b){var _0x2a6197,_0x537a40,_0x15de24;return db[_0x16bc('0x50')]['find']({'where':{'id':_0x544107[_0x16bc('0x55')]['id']}})[_0x16bc('0x1c')](handleEntityNotFound(_0x4e5868,null))[_0x16bc('0x1c')](function(_0xeab690){if(_0xeab690){_0x15de24=_0xeab690;logger[_0x16bc('0x20')](_0x16bc('0x21'),_0x16bc('0x29'),'received\x20delivery\x20report\x20from',_0xeab690[_0x16bc('0x4e')],util[_0x16bc('0xc5')](_0x544107[_0x16bc('0x3f')],{'showHidden':![],'depth':null}));switch(_0xeab690['type']){case _0x16bc('0x8a'):if(_0x544107[_0x16bc('0x3f')][_0x16bc('0xd3')]&&_0x544107[_0x16bc('0x3f')]['state']){_0x537a40=_0x544107[_0x16bc('0x3f')][_0x16bc('0xd4')];return db[_0x16bc('0xa4')][_0x16bc('0x59')]({'where':{'messageId':_0x544107[_0x16bc('0x3f')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x4e5868,null))['then'](function(_0x5133b7){if(_0x5133b7){_0x2a6197=_0x5133b7;switch(_0x15de24[_0x16bc('0x4e')]){case _0x16bc('0x8a'):if(_0x537a40==='2'||_0x537a40==='6'){return _0x2a6197[_0x16bc('0x60')]({'read':!![]});}else{logger[_0x16bc('0x23')](_0x16bc('0x21'),_0x16bc('0x29'),_0x16bc('0x8a'),util[_0x16bc('0xc5')](_0x544107[_0x16bc('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x2a6197;}})['then'](respondWithResult(_0x4e5868,null))[_0x16bc('0x27')](handleError(_0x4e5868,null));};exports[_0x16bc('0xd5')]=function(_0x4ab5d8,_0x447fc1,_0x1fa0de){return db[_0x16bc('0x50')][_0x16bc('0x59')]({'where':{'id':_0x4ab5d8['params']['id']}})[_0x16bc('0x1c')](handleEntityNotFound(_0x447fc1,null))[_0x16bc('0x1c')](function(_0x1a85a1){if(_0x1a85a1){return _0x1a85a1[_0x16bc('0xd5')](_0x4ab5d8['body']['ids'],_[_0x16bc('0x9b')](_0x4ab5d8[_0x16bc('0x61')],['ids','id'])||{})[_0x16bc('0xc3')](function(_0x55f947){for(var _0x200b28=0x0;_0x200b28<_0x4ab5d8[_0x16bc('0x61')][_0x16bc('0x69')][_0x16bc('0x46')];_0x200b28+=0x1){socket[_0x16bc('0xd6')]('userSmsAccount:save',{'UserId':_0x4ab5d8[_0x16bc('0x61')]['ids'][_0x200b28],'SmsAccountId':_0x4ab5d8[_0x16bc('0x55')]['id']});}return _0x55f947;});}})[_0x16bc('0x1c')](respondWithResult(_0x447fc1,null))[_0x16bc('0x27')](handleError(_0x447fc1,null));};exports[_0x16bc('0xd7')]=function(_0x4aa4d1,_0x5b0cc3,_0x588321){return db[_0x16bc('0x50')][_0x16bc('0x59')]({'where':{'id':_0x4aa4d1['params']['id']}})[_0x16bc('0x1c')](handleEntityNotFound(_0x5b0cc3,null))['then'](function(_0x480e13){if(_0x480e13){return _0x480e13['removeAgents'](_0x4aa4d1['query'][_0x16bc('0x69')])[_0x16bc('0x1c')](function(){if(_[_0x16bc('0xd8')](_0x4aa4d1[_0x16bc('0x3f')]['ids'])){for(var _0xcaf847=0x0;_0xcaf847<_0x4aa4d1[_0x16bc('0x3f')]['ids']['length'];_0xcaf847+=0x1){socket[_0x16bc('0xd6')](_0x16bc('0xd9'),{'UserId':Number(_0x4aa4d1[_0x16bc('0x3f')][_0x16bc('0x69')][_0xcaf847]),'SmsAccountId':Number(_0x4aa4d1[_0x16bc('0x55')]['id'])});}}else{socket[_0x16bc('0xd6')](_0x16bc('0xd9'),{'UserId':Number(_0x4aa4d1[_0x16bc('0x3f')]['ids']),'SmsAccountId':Number(_0x4aa4d1[_0x16bc('0x55')]['id'])});}});}})[_0x16bc('0x1c')](respondWithStatusCode(_0x5b0cc3,null))[_0x16bc('0x27')](handleError(_0x5b0cc3,null));};exports['getAgents']=function(_0x18c6c1,_0x559a02,_0x4eada2){var _0x597a32={};var _0x15a386={};var _0x592bf9;var _0xac0481;return db['SmsAccount'][_0x16bc('0x65')]({'where':{'id':_0x18c6c1[_0x16bc('0x55')]['id']}})['then'](handleEntityNotFound(_0x559a02,null))[_0x16bc('0x1c')](function(_0x277bc4){if(_0x277bc4){_0x592bf9=_0x277bc4;_0x15a386[_0x16bc('0x43')]=_['keys'](db[_0x16bc('0xa7')][_0x16bc('0x3c')]);_0x15a386[_0x16bc('0x3f')]=_['keys'](_0x18c6c1[_0x16bc('0x3f')]);_0x15a386[_0x16bc('0x41')]=_[_0x16bc('0x42')](_0x15a386[_0x16bc('0x43')],_0x15a386['query']);_0x597a32[_0x16bc('0x45')]=_[_0x16bc('0x42')](_0x15a386[_0x16bc('0x43')],qs['fields'](_0x18c6c1[_0x16bc('0x3f')]['fields']));_0x597a32[_0x16bc('0x45')]=_0x597a32[_0x16bc('0x45')][_0x16bc('0x46')]?_0x597a32[_0x16bc('0x45')]:_0x15a386[_0x16bc('0x43')];_0x597a32[_0x16bc('0x48')]=qs[_0x16bc('0x49')](_0x18c6c1[_0x16bc('0x3f')][_0x16bc('0x49')]);_0x597a32['where']=qs[_0x16bc('0x41')](_[_0x16bc('0x4b')](_0x18c6c1[_0x16bc('0x3f')],_0x15a386['filters']));if(_0x18c6c1[_0x16bc('0x3f')][_0x16bc('0x4c')]){_0x597a32[_0x16bc('0x4a')]=_[_0x16bc('0x4d')](_0x597a32[_0x16bc('0x4a')],{'$or':_[_0x16bc('0x3b')](_0x597a32[_0x16bc('0x45')],function(_0x411bf9){var _0x4329aa={};_0x4329aa[_0x411bf9]={'$like':'%'+_0x18c6c1['query']['filter']+'%'};return _0x4329aa;})});}_0x597a32=_['merge']({},_0x597a32,_0x18c6c1[_0x16bc('0x58')]);return _0x592bf9[_0x16bc('0xda')](_0x597a32);}})['then'](function(_0x5c2752){if(_0x5c2752){_0xac0481=_0x5c2752[_0x16bc('0x46')];if(!_0x18c6c1[_0x16bc('0x3f')][_0x16bc('0x67')](_0x16bc('0x47'))){_0x597a32[_0x16bc('0x2d')]=qs[_0x16bc('0x2d')](_0x18c6c1[_0x16bc('0x3f')][_0x16bc('0x2d')]);_0x597a32[_0x16bc('0x2c')]=qs['offset'](_0x18c6c1[_0x16bc('0x3f')][_0x16bc('0x2c')]);}return _0x592bf9[_0x16bc('0xda')](_0x597a32);}})[_0x16bc('0x1c')](function(_0x4c50be){if(_0x4c50be){return _0x4c50be?{'count':_0xac0481,'rows':_0x4c50be}:null;}})[_0x16bc('0x1c')](respondWithResult(_0x559a02,null))[_0x16bc('0x27')](handleError(_0x559a02,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 949c20c..4f11ea3 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 _0x88ed=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x347004,_0x44726f){var _0x53e042=function(_0x13594a){while(--_0x13594a){_0x347004['push'](_0x347004['shift']());}};_0x53e042(++_0x44726f);}(_0x88ed,0x10b));var _0xd88e=function(_0x5783bd,_0x52d143){_0x5783bd=_0x5783bd-0x0;var _0x2d86b6=_0x88ed[_0x5783bd];return _0x2d86b6;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xd88e('0x0'))['db'][_0xd88e('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd88e('0x2')](0x0);var events={'afterCreate':_0xd88e('0x3'),'afterUpdate':_0xd88e('0x4'),'afterDestroy':_0xd88e('0x5')};function emitEvent(_0x305734){return function(_0x3cb25a,_0x221b5a,_0x5d53f5){SmsAccountEvents[_0xd88e('0x6')](_0x305734+':'+_0x3cb25a['id'],_0x3cb25a);SmsAccountEvents['emit'](_0x305734,_0x3cb25a);_0x5d53f5(null);};}for(var e in events){if(events[_0xd88e('0x7')](e)){var event=events[e];SmsAccount[_0xd88e('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x4a8e=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x4a8e,0x78));var _0xe4a8=function(_0x448c09,_0x40cacc){_0x448c09=_0x448c09-0x0;var _0x3825cd=_0x4a8e[_0x448c09];return _0x3825cd;};'use strict';var EventEmitter=require(_0xe4a8('0x0'));var SmsAccount=require(_0xe4a8('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe4a8('0x2')](0x0);var events={'afterCreate':_0xe4a8('0x3'),'afterUpdate':_0xe4a8('0x4'),'afterDestroy':_0xe4a8('0x5')};function emitEvent(_0x507b35){return function(_0x5554a8,_0x404660,_0x42fa75){SmsAccountEvents[_0xe4a8('0x6')](_0x507b35+':'+_0x5554a8['id'],_0x5554a8);SmsAccountEvents[_0xe4a8('0x6')](_0x507b35,_0x5554a8);_0x42fa75(null);};}for(var e in events){if(events[_0xe4a8('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xe4a8('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 0c7980c..15c17b1 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 _0xe583=['sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define'];(function(_0x3e018b,_0x3c8244){var _0x22e2d3=function(_0x42bc49){while(--_0x42bc49){_0x3e018b['push'](_0x3e018b['shift']());}};_0x22e2d3(++_0x3c8244);}(_0xe583,0x119));var _0x3e58=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xe583[_0x54edc9];return _0x2ae7a9;};'use strict';var _=require(_0x3e58('0x0'));var util=require(_0x3e58('0x1'));var logger=require(_0x3e58('0x2'))(_0x3e58('0x3'));var moment=require(_0x3e58('0x4'));var BPromise=require(_0x3e58('0x5'));var rp=require(_0x3e58('0x6'));var fs=require('fs');var path=require(_0x3e58('0x7'));var rimraf=require(_0x3e58('0x8'));var config=require(_0x3e58('0x9'));var attributes=require(_0x3e58('0xa'));module[_0x3e58('0xb')]=function(_0x489048,_0x4682b6){return _0x489048[_0x3e58('0xc')]('SmsAccount',attributes,{'tableName':_0x3e58('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6db=['path','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','util','api','bluebird','request-promise'];(function(_0x22b086,_0x1519c9){var _0x476ddc=function(_0x5167b6){while(--_0x5167b6){_0x22b086['push'](_0x22b086['shift']());}};_0x476ddc(++_0x1519c9);}(_0xf6db,0x145));var _0xbf6d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xf6db[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xbf6d('0x0'));var util=require(_0xbf6d('0x1'));var logger=require('../../config/logger')(_0xbf6d('0x2'));var moment=require('moment');var BPromise=require(_0xbf6d('0x3'));var rp=require(_0xbf6d('0x4'));var fs=require('fs');var path=require(_0xbf6d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbf6d('0x6'));module['exports']=function(_0x1d80f6,_0x2ba0e5){return _0x1d80f6[_0xbf6d('0x7')](_0xbf6d('0x8'),attributes,{'tableName':_0xbf6d('0x9'),'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 9814078..5a3c57f 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 _0xc156=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','then','request\x20sent','debug'];(function(_0x17b2ab,_0x43a8dd){var _0x242a20=function(_0x3f0fe1){while(--_0x3f0fe1){_0x17b2ab['push'](_0x17b2ab['shift']());}};_0x242a20(++_0x43a8dd);}(_0xc156,0x1b5));var _0x6c15=function(_0x4c93ff,_0x1e4710){_0x4c93ff=_0x4c93ff-0x0;var _0x4ce46d=_0xc156[_0x4c93ff];return _0x4ce46d;};'use strict';var _=require(_0x6c15('0x0'));var util=require('util');var moment=require(_0x6c15('0x1'));var BPromise=require(_0x6c15('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c15('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c15('0x4'));var logger=require(_0x6c15('0x5'))(_0x6c15('0x6'));var config=require('../../config/environment');var jayson=require(_0x6c15('0x7'));var client=jayson[_0x6c15('0x8')][_0x6c15('0x9')]({'port':0x232a});config[_0x6c15('0xa')]=_[_0x6c15('0xb')](config[_0x6c15('0xa')],{'host':_0x6c15('0xc'),'port':0x18eb});var socket=require(_0x6c15('0xd'))(new Redis(config['redis']));require(_0x6c15('0xe'))['register'](socket);function respondWithRpcPromise(_0x21d8bd,_0x5dcf53,_0x1a9b2a){return new BPromise(function(_0x55c933,_0x5cd762){return client['request'](_0x21d8bd,_0x1a9b2a)[_0x6c15('0xf')](function(_0x177625){logger['info']('SmsAccount,\x20%s,\x20%s',_0x5dcf53,_0x6c15('0x10'));logger[_0x6c15('0x11')](_0x6c15('0x12'),_0x5dcf53,_0x6c15('0x10'),JSON[_0x6c15('0x13')](_0x177625));if(_0x177625[_0x6c15('0x14')]){if(_0x177625[_0x6c15('0x14')][_0x6c15('0x15')]===0x1f4){logger[_0x6c15('0x14')](_0x6c15('0x16'),_0x5dcf53,_0x177625[_0x6c15('0x14')][_0x6c15('0x17')]);return _0x5cd762(_0x177625['error'][_0x6c15('0x17')]);}logger[_0x6c15('0x14')]('SmsAccount,\x20%s,\x20%s',_0x5dcf53,_0x177625[_0x6c15('0x14')]['message']);return _0x55c933(_0x177625[_0x6c15('0x14')]['message']);}else{logger[_0x6c15('0x18')](_0x6c15('0x16'),_0x5dcf53,_0x6c15('0x10'));_0x55c933(_0x177625['result'][_0x6c15('0x17')]);}})['catch'](function(_0x39f31f){logger[_0x6c15('0x14')](_0x6c15('0x16'),_0x5dcf53,_0x39f31f);_0x5cd762(_0x39f31f);});});}exports[_0x6c15('0x19')]=function(_0x4514e5){var _0x29cd63=this;return new Promise(function(_0x108ea6,_0x502db3){return db[_0x6c15('0x1a')][_0x6c15('0x1b')]({'raw':_0x4514e5[_0x6c15('0x1c')]?_0x4514e5[_0x6c15('0x1c')][_0x6c15('0x1d')]===undefined?!![]:![]:!![],'where':_0x4514e5[_0x6c15('0x1c')]?_0x4514e5[_0x6c15('0x1c')]['where']||null:null,'attributes':_0x4514e5[_0x6c15('0x1c')]?_0x4514e5[_0x6c15('0x1c')][_0x6c15('0x1e')]||null:null,'include':_0x4514e5[_0x6c15('0x1c')]?_0x4514e5['options'][_0x6c15('0x1f')]?_[_0x6c15('0x20')](_0x4514e5[_0x6c15('0x1c')]['include'],function(_0x4bcaff){return{'model':db[_0x4bcaff[_0x6c15('0x21')]],'as':_0x4bcaff['as'],'attributes':_0x4bcaff['attributes'],'include':_0x4bcaff[_0x6c15('0x1f')]?_[_0x6c15('0x20')](_0x4bcaff[_0x6c15('0x1f')],function(_0x2dab7a){return{'model':db[_0x2dab7a['model']],'as':_0x2dab7a['as'],'attributes':_0x2dab7a[_0x6c15('0x1e')],'include':_0x2dab7a[_0x6c15('0x1f')]?_[_0x6c15('0x20')](_0x2dab7a[_0x6c15('0x1f')],function(_0x29d786){return{'model':db[_0x29d786[_0x6c15('0x21')]],'as':_0x29d786['as'],'attributes':_0x29d786['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xeef47e){logger[_0x6c15('0x18')](_0x6c15('0x19'),_0x4514e5);logger[_0x6c15('0x11')]('ShowSmsAccount',_0x4514e5,JSON['stringify'](_0xeef47e));_0x108ea6(_0xeef47e);})[_0x6c15('0x22')](function(_0x30a9e5){logger['error']('ShowSmsAccount',_0x30a9e5[_0x6c15('0x17')],_0x4514e5);_0x502db3(_0x29cd63['error'](0x1f4,_0x30a9e5[_0x6c15('0x17')]));});});}; \ No newline at end of file +var _0x308c=['SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','options','raw','attributes','include','model','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','info'];(function(_0x126091,_0x1ab5c9){var _0xf8e123=function(_0x4f9390){while(--_0x4f9390){_0x126091['push'](_0x126091['shift']());}};_0xf8e123(++_0x1ab5c9);}(_0x308c,0xb6));var _0xc308=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x308c[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xc308('0x0'));var util=require('util');var moment=require(_0xc308('0x1'));var BPromise=require(_0xc308('0x2'));var rs=require(_0xc308('0x3'));var fs=require('fs');var Redis=require(_0xc308('0x4'));var db=require(_0xc308('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc308('0x6'));var jayson=require(_0xc308('0x7'));var client=jayson[_0xc308('0x8')]['http']({'port':0x232a});config[_0xc308('0x9')]=_['defaults'](config['redis'],{'host':_0xc308('0xa'),'port':0x18eb});var socket=require(_0xc308('0xb'))(new Redis(config[_0xc308('0x9')]));require(_0xc308('0xc'))['register'](socket);function respondWithRpcPromise(_0x278af8,_0x31848f,_0x4f20b0){return new BPromise(function(_0x56c144,_0x1490a1){return client[_0xc308('0xd')](_0x278af8,_0x4f20b0)[_0xc308('0xe')](function(_0x4e92e4){logger[_0xc308('0xf')](_0xc308('0x10'),_0x31848f,'request\x20sent');logger[_0xc308('0x11')](_0xc308('0x12'),_0x31848f,_0xc308('0x13'),JSON[_0xc308('0x14')](_0x4e92e4));if(_0x4e92e4[_0xc308('0x15')]){if(_0x4e92e4[_0xc308('0x15')][_0xc308('0x16')]===0x1f4){logger[_0xc308('0x15')](_0xc308('0x10'),_0x31848f,_0x4e92e4['error'][_0xc308('0x17')]);return _0x1490a1(_0x4e92e4[_0xc308('0x15')][_0xc308('0x17')]);}logger[_0xc308('0x15')](_0xc308('0x10'),_0x31848f,_0x4e92e4[_0xc308('0x15')][_0xc308('0x17')]);return _0x56c144(_0x4e92e4[_0xc308('0x15')][_0xc308('0x17')]);}else{logger[_0xc308('0xf')](_0xc308('0x10'),_0x31848f,_0xc308('0x13'));_0x56c144(_0x4e92e4['result'][_0xc308('0x17')]);}})[_0xc308('0x18')](function(_0x476a63){logger['error'](_0xc308('0x10'),_0x31848f,_0x476a63);_0x1490a1(_0x476a63);});});}exports[_0xc308('0x19')]=function(_0xaff99a){var _0x1a2464=this;return new Promise(function(_0x23aa99,_0x482663){return db[_0xc308('0x1a')]['find']({'raw':_0xaff99a[_0xc308('0x1b')]?_0xaff99a[_0xc308('0x1b')][_0xc308('0x1c')]===undefined?!![]:![]:!![],'where':_0xaff99a['options']?_0xaff99a[_0xc308('0x1b')]['where']||null:null,'attributes':_0xaff99a[_0xc308('0x1b')]?_0xaff99a['options'][_0xc308('0x1d')]||null:null,'include':_0xaff99a[_0xc308('0x1b')]?_0xaff99a['options'][_0xc308('0x1e')]?_['map'](_0xaff99a[_0xc308('0x1b')][_0xc308('0x1e')],function(_0x3e79ab){return{'model':db[_0x3e79ab[_0xc308('0x1f')]],'as':_0x3e79ab['as'],'attributes':_0x3e79ab[_0xc308('0x1d')],'include':_0x3e79ab[_0xc308('0x1e')]?_[_0xc308('0x20')](_0x3e79ab['include'],function(_0x511443){return{'model':db[_0x511443['model']],'as':_0x511443['as'],'attributes':_0x511443[_0xc308('0x1d')],'include':_0x511443['include']?_[_0xc308('0x20')](_0x511443[_0xc308('0x1e')],function(_0x5b3ff9){return{'model':db[_0x5b3ff9[_0xc308('0x1f')]],'as':_0x5b3ff9['as'],'attributes':_0x5b3ff9[_0xc308('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5196a7){logger[_0xc308('0xf')](_0xc308('0x19'),_0xaff99a);logger[_0xc308('0x11')]('ShowSmsAccount',_0xaff99a,JSON[_0xc308('0x14')](_0x5196a7));_0x23aa99(_0x5196a7);})['catch'](function(_0x5ca67a){logger[_0xc308('0x15')](_0xc308('0x19'),_0x5ca67a[_0xc308('0x17')],_0xaff99a);_0x482663(_0x1a2464['error'](0x1f4,_0x5ca67a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index c287717..c476717 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 _0x9f7b=['save','remove','update','emit','removeListener','register','length','smsAccount:','./smsAccount.events'];(function(_0x5e17e8,_0x42327b){var _0x10976d=function(_0x42fd20){while(--_0x42fd20){_0x5e17e8['push'](_0x5e17e8['shift']());}};_0x10976d(++_0x42327b);}(_0x9f7b,0x15e));var _0xb9f7=function(_0x381a4c,_0x50b5db){_0x381a4c=_0x381a4c-0x0;var _0x352c04=_0x9f7b[_0x381a4c];return _0x352c04;};'use strict';var SmsAccountEvents=require(_0xb9f7('0x0'));var events=[_0xb9f7('0x1'),_0xb9f7('0x2'),_0xb9f7('0x3')];function createListener(_0x125ac5,_0x9331e4){return function(_0x4d6a27){_0x9331e4[_0xb9f7('0x4')](_0x125ac5,_0x4d6a27);};}function removeListener(_0x1ce15b,_0x4417fb){return function(){SmsAccountEvents[_0xb9f7('0x5')](_0x1ce15b,_0x4417fb);};}exports[_0xb9f7('0x6')]=function(_0x57f659){for(var _0x646fe9=0x0,_0x29c745=events[_0xb9f7('0x7')];_0x646fe9<_0x29c745;_0x646fe9++){var _0xb592fc=events[_0x646fe9];var _0xac6e20=createListener(_0xb9f7('0x8')+_0xb592fc,_0x57f659);SmsAccountEvents['on'](_0xb592fc,_0xac6e20);}}; \ No newline at end of file +var _0x438c=['emit','removeListener','register','length','remove'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x438c,0x1e9));var _0xc438=function(_0x2c4af2,_0x3049a0){_0x2c4af2=_0x2c4af2-0x0;var _0x365802=_0x438c[_0x2c4af2];return _0x365802;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0xc438('0x0'),'update'];function createListener(_0x3c8daa,_0xbd5bfe){return function(_0x2066a7){_0xbd5bfe[_0xc438('0x1')](_0x3c8daa,_0x2066a7);};}function removeListener(_0x3d7323,_0x190e3e){return function(){SmsAccountEvents[_0xc438('0x2')](_0x3d7323,_0x190e3e);};}exports[_0xc438('0x3')]=function(_0x3f2a42){for(var _0x59ddc1=0x0,_0x6b0ec5=events[_0xc438('0x4')];_0x59ddc1<_0x6b0ec5;_0x59ddc1++){var _0x410a11=events[_0x59ddc1];var _0x3bd8a5=createListener('smsAccount:'+_0x410a11,_0x3f2a42);SmsAccountEvents['on'](_0x410a11,_0x3bd8a5);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 0902b73..4e00e95 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 _0x13bc=['show','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x13bc,0x129));var _0xc13b=function(_0x40fc97,_0x4aab72){_0x40fc97=_0x40fc97-0x0;var _0x5dfab7=_0x13bc[_0x40fc97];return _0x5dfab7;};'use strict';var multer=require(_0xc13b('0x0'));var util=require('util');var path=require(_0xc13b('0x1'));var timeout=require(_0xc13b('0x2'));var express=require('express');var router=express[_0xc13b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc13b('0x4'));var config=require(_0xc13b('0x5'));var controller=require('./smsApplication.controller');router['get']('/',auth[_0xc13b('0x6')](),controller[_0xc13b('0x7')]);router[_0xc13b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc13b('0x9')]);router['post']('/',auth[_0xc13b('0x6')](),controller[_0xc13b('0xa')]);router[_0xc13b('0xb')](_0xc13b('0xc'),auth[_0xc13b('0x6')](),controller[_0xc13b('0xd')]);router[_0xc13b('0xe')](_0xc13b('0xc'),auth['isAuthenticated'](),controller[_0xc13b('0xf')]);module[_0xc13b('0x10')]=router; \ No newline at end of file +var _0xcc14=['show','post','create','put','update','exports','multer','util','path','express','Router','./smsApplication.controller','isAuthenticated','get','/:id'];(function(_0x545005,_0x5540bf){var _0x5996b4=function(_0x4aed77){while(--_0x4aed77){_0x545005['push'](_0x545005['shift']());}};_0x5996b4(++_0x5540bf);}(_0xcc14,0x1e6));var _0x4cc1=function(_0x460c40,_0x26991b){_0x460c40=_0x460c40-0x0;var _0x32249b=_0xcc14[_0x460c40];return _0x32249b;};'use strict';var multer=require(_0x4cc1('0x0'));var util=require(_0x4cc1('0x1'));var path=require(_0x4cc1('0x2'));var timeout=require('connect-timeout');var express=require(_0x4cc1('0x3'));var router=express[_0x4cc1('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4cc1('0x5'));router['get']('/',auth[_0x4cc1('0x6')](),controller['index']);router[_0x4cc1('0x7')](_0x4cc1('0x8'),auth[_0x4cc1('0x6')](),controller[_0x4cc1('0x9')]);router[_0x4cc1('0xa')]('/',auth[_0x4cc1('0x6')](),controller[_0x4cc1('0xb')]);router[_0x4cc1('0xc')](_0x4cc1('0x8'),auth[_0x4cc1('0x6')](),controller[_0x4cc1('0xd')]);router['delete']('/:id',auth[_0x4cc1('0x6')](),controller['destroy']);module[_0x4cc1('0xe')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 66add8c..6fc3738 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 _0x450c=['sequelize','INTEGER','noop','STRING','*,*,*,*'];(function(_0x31684a,_0x2a9757){var _0x2b3962=function(_0x10f784){while(--_0x10f784){_0x31684a['push'](_0x31684a['shift']());}};_0x2b3962(++_0x2a9757);}(_0x450c,0xff));var _0xc450=function(_0x5b3233,_0x4d0ea8){_0x5b3233=_0x5b3233-0x0;var _0x106eeb=_0x450c[_0x5b3233];return _0x106eeb;};'use strict';var Sequelize=require(_0xc450('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc450('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc450('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc450('0x3')]},'interval':{'type':Sequelize[_0xc450('0x3')],'defaultValue':_0xc450('0x4')}}; \ No newline at end of file +var _0x6747=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x21c731,_0x32b6fb){var _0x5277c3=function(_0x43f62a){while(--_0x43f62a){_0x21c731['push'](_0x21c731['shift']());}};_0x5277c3(++_0x32b6fb);}(_0x6747,0x8a));var _0x7674=function(_0x27ad3e,_0x15f1a8){_0x27ad3e=_0x27ad3e-0x0;var _0x1777bd=_0x6747[_0x27ad3e];return _0x1777bd;};'use strict';var Sequelize=require(_0x7674('0x0'));module[_0x7674('0x1')]={'priority':{'type':Sequelize[_0x7674('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7674('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7674('0x3')]},'interval':{'type':Sequelize[_0x7674('0x3')],'defaultValue':_0x7674('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 45b1c3a..60a8b72 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 _0x88c3=['mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','set','Content-Range','reject','save','then','end','sendStatus','error','name','map','SmsApplication','rawAttributes','fieldName','type','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','rows','catch','show','model','keys','includeAll','options','find','create','body','update','destroy','params','html-pdf','rimraf','request-promise'];(function(_0x36ac3f,_0x4a1f4e){var _0x4820c7=function(_0x17099c){while(--_0x17099c){_0x36ac3f['push'](_0x36ac3f['shift']());}};_0x4820c7(++_0x4a1f4e);}(_0x88c3,0x1ee));var _0x388c=function(_0x18fa61,_0x1d2fb3){_0x18fa61=_0x18fa61-0x0;var _0x45c0e9=_0x88c3[_0x18fa61];return _0x45c0e9;};'use strict';var pdf=require(_0x388c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x388c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x388c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x388c('0x3'));var util=require(_0x388c('0x4'));var path=require(_0x388c('0x5'));var sox=require(_0x388c('0x6'));var csv=require(_0x388c('0x7'));var ejs=require(_0x388c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x388c('0x9'));var crypto=require(_0x388c('0xa'));var jsforce=require(_0x388c('0xb'));var deskjs=require(_0x388c('0xc'));var toCsv=require(_0x388c('0x7'));var querystring=require(_0x388c('0xd'));var Papa=require(_0x388c('0xe'));var Redis=require(_0x388c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x388c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x388c('0x11'))(_0x388c('0x12'));var utils=require(_0x388c('0x13'));var config=require(_0x388c('0x14'));var licenseUtil=require(_0x388c('0x15'));var db=require(_0x388c('0x16'))['db'];function respondWithStatusCode(_0x462e13,_0x45a3fe){_0x45a3fe=_0x45a3fe||0xcc;return function(_0x262ed1){if(_0x262ed1){return _0x462e13['sendStatus'](_0x45a3fe);}return _0x462e13['status'](_0x45a3fe)['end']();};}function respondWithResult(_0x40c710,_0x41bf59){_0x41bf59=_0x41bf59||0xc8;return function(_0x50e78e){if(_0x50e78e){return _0x40c710[_0x388c('0x17')](_0x41bf59)[_0x388c('0x18')](_0x50e78e);}};}function respondWithFilteredResult(_0x5808fd,_0x56eb71){return function(_0x76001f){if(_0x76001f){var _0x3c5444=_0x76001f['count'],_0x42f3e1=_0x56eb71[_0x388c('0x19')],_0x4d5230=_0x56eb71[_0x388c('0x19')]+_0x56eb71['limit'],_0x10a3b4;if(_0x4d5230>=_0x3c5444){_0x4d5230=_0x3c5444;_0x10a3b4=0xc8;}else{_0x10a3b4=0xce;}_0x5808fd['status'](_0x10a3b4);return _0x5808fd[_0x388c('0x1a')](_0x388c('0x1b'),_0x42f3e1+'-'+_0x4d5230+'/'+_0x3c5444)[_0x388c('0x18')](_0x76001f);}return null;};}function patchUpdates(_0x5026b0){return function(_0x4e780b){try{jsonpatch['apply'](_0x4e780b,_0x5026b0,!![]);}catch(_0x1f6c2e){return BPromise[_0x388c('0x1c')](_0x1f6c2e);}return _0x4e780b[_0x388c('0x1d')]();};}function saveUpdates(_0x5b3031,_0x4a1f36){return function(_0x537188){if(_0x537188){return _0x537188['update'](_0x5b3031)[_0x388c('0x1e')](function(_0x486e6f){return _0x486e6f;});}return null;};}function removeEntity(_0xfff1f5,_0x56e67b){return function(_0x382d97){if(_0x382d97){return _0x382d97['destroy']()[_0x388c('0x1e')](function(){_0xfff1f5['status'](0xcc)[_0x388c('0x1f')]();});}};}function handleEntityNotFound(_0x348bcd,_0x12626e){return function(_0x1924f8){if(!_0x1924f8){_0x348bcd[_0x388c('0x20')](0x194);}return _0x1924f8;};}function handleError(_0x2ce6cc,_0x13b717){_0x13b717=_0x13b717||0x1f4;return function(_0x7ee3c8){logger[_0x388c('0x21')](_0x7ee3c8['stack']);if(_0x7ee3c8['name']){delete _0x7ee3c8[_0x388c('0x22')];}_0x2ce6cc['status'](_0x13b717)['send'](_0x7ee3c8);};}exports['index']=function(_0x201ecd,_0x8c9194){var _0x90c1e3={},_0x16de20={},_0x41dc6d={'count':0x0,'rows':[]};var _0x3558a9=_[_0x388c('0x23')](db[_0x388c('0x24')][_0x388c('0x25')],function(_0x45adf9){return{'name':_0x45adf9[_0x388c('0x26')],'type':_0x45adf9[_0x388c('0x27')]['key']};});_0x16de20['model']=_[_0x388c('0x23')](_0x3558a9,_0x388c('0x22'));_0x16de20[_0x388c('0x28')]=_['keys'](_0x201ecd[_0x388c('0x28')]);_0x16de20[_0x388c('0x29')]=_[_0x388c('0x2a')](_0x16de20['model'],_0x16de20[_0x388c('0x28')]);_0x90c1e3[_0x388c('0x2b')]=_[_0x388c('0x2a')](_0x16de20['model'],qs['fields'](_0x201ecd['query'][_0x388c('0x2c')]));_0x90c1e3[_0x388c('0x2b')]=_0x90c1e3['attributes'][_0x388c('0x2d')]?_0x90c1e3[_0x388c('0x2b')]:_0x16de20['model'];if(!_0x201ecd[_0x388c('0x28')][_0x388c('0x2e')](_0x388c('0x2f'))){_0x90c1e3[_0x388c('0x30')]=qs[_0x388c('0x30')](_0x201ecd[_0x388c('0x28')]['limit']);_0x90c1e3[_0x388c('0x19')]=qs['offset'](_0x201ecd['query']['offset']);}_0x90c1e3[_0x388c('0x31')]=qs[_0x388c('0x32')](_0x201ecd[_0x388c('0x28')][_0x388c('0x32')]);_0x90c1e3[_0x388c('0x33')]=qs[_0x388c('0x29')](_[_0x388c('0x34')](_0x201ecd['query'],_0x16de20['filters']),_0x3558a9);if(_0x201ecd[_0x388c('0x28')][_0x388c('0x35')]){_0x90c1e3[_0x388c('0x33')]=_[_0x388c('0x36')](_0x90c1e3[_0x388c('0x33')],{'$or':_[_0x388c('0x23')](_0x3558a9,function(_0x41e8a1){if(_0x41e8a1[_0x388c('0x27')]!==_0x388c('0x37')){var _0x93d6a0={};_0x93d6a0[_0x41e8a1[_0x388c('0x22')]]={'$like':'%'+_0x201ecd['query'][_0x388c('0x35')]+'%'};return _0x93d6a0;}})});}_0x90c1e3=_[_0x388c('0x36')]({},_0x90c1e3,_0x201ecd['options']);var _0x3fb807={'where':_0x90c1e3['where']};return db[_0x388c('0x24')][_0x388c('0x38')](_0x3fb807)[_0x388c('0x1e')](function(_0x4e29e1){_0x41dc6d[_0x388c('0x38')]=_0x4e29e1;if(_0x201ecd[_0x388c('0x28')]['includeAll']){_0x90c1e3[_0x388c('0x39')]=[{'all':!![]}];}return db[_0x388c('0x24')]['findAll'](_0x90c1e3);})[_0x388c('0x1e')](function(_0x250c76){_0x41dc6d[_0x388c('0x3a')]=_0x250c76;return _0x41dc6d;})[_0x388c('0x1e')](respondWithFilteredResult(_0x8c9194,_0x90c1e3))[_0x388c('0x3b')](handleError(_0x8c9194,null));};exports[_0x388c('0x3c')]=function(_0x188a67,_0x2d69b0){var _0x59a4ce={'raw':!![],'where':{'id':_0x188a67['params']['id']}},_0x4b2990={};_0x4b2990[_0x388c('0x3d')]=_['keys'](db['SmsApplication'][_0x388c('0x25')]);_0x4b2990[_0x388c('0x28')]=_[_0x388c('0x3e')](_0x188a67['query']);_0x4b2990[_0x388c('0x29')]=_[_0x388c('0x2a')](_0x4b2990['model'],_0x4b2990[_0x388c('0x28')]);_0x59a4ce[_0x388c('0x2b')]=_['intersection'](_0x4b2990[_0x388c('0x3d')],qs['fields'](_0x188a67[_0x388c('0x28')]['fields']));_0x59a4ce[_0x388c('0x2b')]=_0x59a4ce[_0x388c('0x2b')][_0x388c('0x2d')]?_0x59a4ce[_0x388c('0x2b')]:_0x4b2990[_0x388c('0x3d')];if(_0x188a67[_0x388c('0x28')][_0x388c('0x3f')]){_0x59a4ce['include']=[{'all':!![]}];}_0x59a4ce=_[_0x388c('0x36')]({},_0x59a4ce,_0x188a67[_0x388c('0x40')]);return db['SmsApplication'][_0x388c('0x41')](_0x59a4ce)[_0x388c('0x1e')](handleEntityNotFound(_0x2d69b0,null))[_0x388c('0x1e')](respondWithResult(_0x2d69b0,null))[_0x388c('0x3b')](handleError(_0x2d69b0,null));};exports['create']=function(_0x53682c,_0x4a336d){return db[_0x388c('0x24')][_0x388c('0x42')](_0x53682c[_0x388c('0x43')],{})[_0x388c('0x1e')](respondWithResult(_0x4a336d,0xc9))['catch'](handleError(_0x4a336d,null));};exports[_0x388c('0x44')]=function(_0x309c9f,_0xc54d8){if(_0x309c9f[_0x388c('0x43')]['id']){delete _0x309c9f[_0x388c('0x43')]['id'];}return db[_0x388c('0x24')][_0x388c('0x41')]({'where':{'id':_0x309c9f['params']['id']}})[_0x388c('0x1e')](handleEntityNotFound(_0xc54d8,null))[_0x388c('0x1e')](saveUpdates(_0x309c9f[_0x388c('0x43')],null))[_0x388c('0x1e')](respondWithResult(_0xc54d8,null))[_0x388c('0x3b')](handleError(_0xc54d8,null));};exports[_0x388c('0x45')]=function(_0x57d1d1,_0x25830a){return db[_0x388c('0x24')][_0x388c('0x41')]({'where':{'id':_0x57d1d1[_0x388c('0x46')]['id']}})[_0x388c('0x1e')](handleEntityNotFound(_0x25830a,null))[_0x388c('0x1e')](removeEntity(_0x25830a,null))[_0x388c('0x3b')](handleError(_0x25830a,null));}; \ No newline at end of file +var _0xc6e8=['filter','options','count','includeAll','include','findAll','rows','catch','params','keys','SmsApplication','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','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','../../mysqldb','status','end','json','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type'];(function(_0x4925b8,_0x580dff){var _0x535277=function(_0x587689){while(--_0x587689){_0x4925b8['push'](_0x4925b8['shift']());}};_0x535277(++_0x580dff);}(_0xc6e8,0x9e));var _0x8c6e=function(_0xd3c2df,_0x21e26a){_0xd3c2df=_0xd3c2df-0x0;var _0x48950d=_0xc6e8[_0xd3c2df];return _0x48950d;};'use strict';var pdf=require(_0x8c6e('0x0'));var emlformat=require(_0x8c6e('0x1'));var rimraf=require(_0x8c6e('0x2'));var zipdir=require(_0x8c6e('0x3'));var jsonpatch=require(_0x8c6e('0x4'));var rp=require('request-promise');var moment=require(_0x8c6e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8c6e('0x6'));var util=require(_0x8c6e('0x7'));var path=require(_0x8c6e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8c6e('0x9'));var fs=require('fs');var _=require(_0x8c6e('0xa'));var squel=require('squel');var crypto=require(_0x8c6e('0xb'));var jsforce=require(_0x8c6e('0xc'));var deskjs=require(_0x8c6e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8c6e('0xe'));var Papa=require(_0x8c6e('0xf'));var Redis=require(_0x8c6e('0x10'));var authService=require(_0x8c6e('0x11'));var qs=require(_0x8c6e('0x12'));var as=require(_0x8c6e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c6e('0x14'))('api');var utils=require(_0x8c6e('0x15'));var config=require(_0x8c6e('0x16'));var licenseUtil=require(_0x8c6e('0x17'));var db=require(_0x8c6e('0x18'))['db'];function respondWithStatusCode(_0x3fced3,_0x21b337){_0x21b337=_0x21b337||0xcc;return function(_0x436486){if(_0x436486){return _0x3fced3['sendStatus'](_0x21b337);}return _0x3fced3[_0x8c6e('0x19')](_0x21b337)[_0x8c6e('0x1a')]();};}function respondWithResult(_0x3a4508,_0x5c6437){_0x5c6437=_0x5c6437||0xc8;return function(_0x3504ef){if(_0x3504ef){return _0x3a4508[_0x8c6e('0x19')](_0x5c6437)[_0x8c6e('0x1b')](_0x3504ef);}};}function respondWithFilteredResult(_0x1d5c4b,_0x5218d4){return function(_0x55264d){if(_0x55264d){var _0x16c6e5=_0x55264d['count'],_0x1187e2=_0x5218d4[_0x8c6e('0x1c')],_0x16ad2f=_0x5218d4['offset']+_0x5218d4[_0x8c6e('0x1d')],_0x15e63d;if(_0x16ad2f>=_0x16c6e5){_0x16ad2f=_0x16c6e5;_0x15e63d=0xc8;}else{_0x15e63d=0xce;}_0x1d5c4b['status'](_0x15e63d);return _0x1d5c4b[_0x8c6e('0x1e')]('Content-Range',_0x1187e2+'-'+_0x16ad2f+'/'+_0x16c6e5)[_0x8c6e('0x1b')](_0x55264d);}return null;};}function patchUpdates(_0xd20316){return function(_0x28a869){try{jsonpatch[_0x8c6e('0x1f')](_0x28a869,_0xd20316,!![]);}catch(_0x2649dc){return BPromise['reject'](_0x2649dc);}return _0x28a869[_0x8c6e('0x20')]();};}function saveUpdates(_0x531a9b,_0x1bc394){return function(_0x1e2d32){if(_0x1e2d32){return _0x1e2d32[_0x8c6e('0x21')](_0x531a9b)[_0x8c6e('0x22')](function(_0x5ce927){return _0x5ce927;});}return null;};}function removeEntity(_0xc1cd49,_0x2b3f02){return function(_0x305b32){if(_0x305b32){return _0x305b32[_0x8c6e('0x23')]()['then'](function(){_0xc1cd49['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x497795,_0x23654d){return function(_0x3102d8){if(!_0x3102d8){_0x497795['sendStatus'](0x194);}return _0x3102d8;};}function handleError(_0x5ec901,_0x43027b){_0x43027b=_0x43027b||0x1f4;return function(_0x33a0a3){logger[_0x8c6e('0x24')](_0x33a0a3[_0x8c6e('0x25')]);if(_0x33a0a3[_0x8c6e('0x26')]){delete _0x33a0a3[_0x8c6e('0x26')];}_0x5ec901[_0x8c6e('0x19')](_0x43027b)[_0x8c6e('0x27')](_0x33a0a3);};}exports[_0x8c6e('0x28')]=function(_0x2da0f8,_0x488d25){var _0x177654={},_0x148960={},_0x2b1f6e={'count':0x0,'rows':[]};var _0x44f305=_['map'](db['SmsApplication'][_0x8c6e('0x29')],function(_0x30391b){return{'name':_0x30391b[_0x8c6e('0x2a')],'type':_0x30391b['type'][_0x8c6e('0x2b')]};});_0x148960[_0x8c6e('0x2c')]=_[_0x8c6e('0x2d')](_0x44f305,'name');_0x148960[_0x8c6e('0x2e')]=_['keys'](_0x2da0f8[_0x8c6e('0x2e')]);_0x148960[_0x8c6e('0x2f')]=_[_0x8c6e('0x30')](_0x148960[_0x8c6e('0x2c')],_0x148960['query']);_0x177654[_0x8c6e('0x31')]=_[_0x8c6e('0x30')](_0x148960[_0x8c6e('0x2c')],qs[_0x8c6e('0x32')](_0x2da0f8[_0x8c6e('0x2e')]['fields']));_0x177654[_0x8c6e('0x31')]=_0x177654[_0x8c6e('0x31')][_0x8c6e('0x33')]?_0x177654[_0x8c6e('0x31')]:_0x148960[_0x8c6e('0x2c')];if(!_0x2da0f8[_0x8c6e('0x2e')][_0x8c6e('0x34')]('nolimit')){_0x177654['limit']=qs[_0x8c6e('0x1d')](_0x2da0f8['query'][_0x8c6e('0x1d')]);_0x177654[_0x8c6e('0x1c')]=qs[_0x8c6e('0x1c')](_0x2da0f8[_0x8c6e('0x2e')]['offset']);}_0x177654[_0x8c6e('0x35')]=qs[_0x8c6e('0x36')](_0x2da0f8['query']['sort']);_0x177654[_0x8c6e('0x37')]=qs['filters'](_[_0x8c6e('0x38')](_0x2da0f8['query'],_0x148960[_0x8c6e('0x2f')]),_0x44f305);if(_0x2da0f8[_0x8c6e('0x2e')]['filter']){_0x177654[_0x8c6e('0x37')]=_['merge'](_0x177654[_0x8c6e('0x37')],{'$or':_[_0x8c6e('0x2d')](_0x44f305,function(_0x4064bc){if(_0x4064bc[_0x8c6e('0x39')]!=='VIRTUAL'){var _0x47eaf0={};_0x47eaf0[_0x4064bc[_0x8c6e('0x26')]]={'$like':'%'+_0x2da0f8[_0x8c6e('0x2e')][_0x8c6e('0x3a')]+'%'};return _0x47eaf0;}})});}_0x177654=_['merge']({},_0x177654,_0x2da0f8[_0x8c6e('0x3b')]);var _0x25f957={'where':_0x177654[_0x8c6e('0x37')]};return db['SmsApplication'][_0x8c6e('0x3c')](_0x25f957)[_0x8c6e('0x22')](function(_0x3b37a0){_0x2b1f6e[_0x8c6e('0x3c')]=_0x3b37a0;if(_0x2da0f8[_0x8c6e('0x2e')][_0x8c6e('0x3d')]){_0x177654[_0x8c6e('0x3e')]=[{'all':!![]}];}return db['SmsApplication'][_0x8c6e('0x3f')](_0x177654);})['then'](function(_0x454d33){_0x2b1f6e[_0x8c6e('0x40')]=_0x454d33;return _0x2b1f6e;})[_0x8c6e('0x22')](respondWithFilteredResult(_0x488d25,_0x177654))[_0x8c6e('0x41')](handleError(_0x488d25,null));};exports['show']=function(_0x251ae6,_0x4cdb05){var _0x29c1d0={'raw':!![],'where':{'id':_0x251ae6[_0x8c6e('0x42')]['id']}},_0x4348c2={};_0x4348c2[_0x8c6e('0x2c')]=_[_0x8c6e('0x43')](db['SmsApplication'][_0x8c6e('0x29')]);_0x4348c2['query']=_[_0x8c6e('0x43')](_0x251ae6[_0x8c6e('0x2e')]);_0x4348c2[_0x8c6e('0x2f')]=_[_0x8c6e('0x30')](_0x4348c2[_0x8c6e('0x2c')],_0x4348c2[_0x8c6e('0x2e')]);_0x29c1d0['attributes']=_[_0x8c6e('0x30')](_0x4348c2['model'],qs['fields'](_0x251ae6[_0x8c6e('0x2e')][_0x8c6e('0x32')]));_0x29c1d0[_0x8c6e('0x31')]=_0x29c1d0[_0x8c6e('0x31')][_0x8c6e('0x33')]?_0x29c1d0['attributes']:_0x4348c2[_0x8c6e('0x2c')];if(_0x251ae6[_0x8c6e('0x2e')][_0x8c6e('0x3d')]){_0x29c1d0[_0x8c6e('0x3e')]=[{'all':!![]}];}_0x29c1d0=_['merge']({},_0x29c1d0,_0x251ae6['options']);return db[_0x8c6e('0x44')][_0x8c6e('0x45')](_0x29c1d0)[_0x8c6e('0x22')](handleEntityNotFound(_0x4cdb05,null))[_0x8c6e('0x22')](respondWithResult(_0x4cdb05,null))[_0x8c6e('0x41')](handleError(_0x4cdb05,null));};exports[_0x8c6e('0x46')]=function(_0xcaa75f,_0x388ef9){return db[_0x8c6e('0x44')][_0x8c6e('0x46')](_0xcaa75f[_0x8c6e('0x47')],{})['then'](respondWithResult(_0x388ef9,0xc9))[_0x8c6e('0x41')](handleError(_0x388ef9,null));};exports[_0x8c6e('0x21')]=function(_0x40a418,_0x29cb96){if(_0x40a418['body']['id']){delete _0x40a418[_0x8c6e('0x47')]['id'];}return db[_0x8c6e('0x44')][_0x8c6e('0x45')]({'where':{'id':_0x40a418[_0x8c6e('0x42')]['id']}})[_0x8c6e('0x22')](handleEntityNotFound(_0x29cb96,null))[_0x8c6e('0x22')](saveUpdates(_0x40a418[_0x8c6e('0x47')],null))['then'](respondWithResult(_0x29cb96,null))[_0x8c6e('0x41')](handleError(_0x29cb96,null));};exports[_0x8c6e('0x23')]=function(_0x4c56e8,_0x64819c){return db[_0x8c6e('0x44')][_0x8c6e('0x45')]({'where':{'id':_0x4c56e8[_0x8c6e('0x42')]['id']}})[_0x8c6e('0x22')](handleEntityNotFound(_0x64819c,null))[_0x8c6e('0x22')](removeEntity(_0x64819c,null))[_0x8c6e('0x41')](handleError(_0x64819c,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 2b6f303..79ec941 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 _0xbf38=['./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2efe5b,_0x372157){var _0x3188a0=function(_0x241b2c){while(--_0x241b2c){_0x2efe5b['push'](_0x2efe5b['shift']());}};_0x3188a0(++_0x372157);}(_0xbf38,0x1b7));var _0x8bf3=function(_0x229cfd,_0x3d7b4c){_0x229cfd=_0x229cfd-0x0;var _0x5621a3=_0xbf38[_0x229cfd];return _0x5621a3;};'use strict';var _=require(_0x8bf3('0x0'));var util=require(_0x8bf3('0x1'));var logger=require(_0x8bf3('0x2'))('api');var moment=require(_0x8bf3('0x3'));var BPromise=require(_0x8bf3('0x4'));var rp=require(_0x8bf3('0x5'));var fs=require('fs');var path=require(_0x8bf3('0x6'));var rimraf=require(_0x8bf3('0x7'));var config=require(_0x8bf3('0x8'));var attributes=require(_0x8bf3('0x9'));module[_0x8bf3('0xa')]=function(_0x100177,_0x27ae12){return _0x100177[_0x8bf3('0xb')](_0x8bf3('0xc'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8bf3('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1869=['lodash','../../config/logger','moment','request-promise','rimraf','exports','define','SmsApplication','utf8mb4'];(function(_0x1d711a,_0x30170f){var _0x40d78b=function(_0x1403fe){while(--_0x1403fe){_0x1d711a['push'](_0x1d711a['shift']());}};_0x40d78b(++_0x30170f);}(_0x1869,0x171));var _0x9186=function(_0x3f0140,_0x1a2ee7){_0x3f0140=_0x3f0140-0x0;var _0x247246=_0x1869[_0x3f0140];return _0x247246;};'use strict';var _=require(_0x9186('0x0'));var util=require('util');var logger=require(_0x9186('0x1'))('api');var moment=require(_0x9186('0x2'));var BPromise=require('bluebird');var rp=require(_0x9186('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9186('0x4'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x9186('0x5')]=function(_0x982bec,_0xbd22cd){return _0x982bec[_0x9186('0x6')](_0x9186('0x7'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9186('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c4adea3..ced711f 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 _0x4da5=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','util'];(function(_0x2ce5fe,_0x50133d){var _0x4062af=function(_0x3ee05f){while(--_0x3ee05f){_0x2ce5fe['push'](_0x2ce5fe['shift']());}};_0x4062af(++_0x50133d);}(_0x4da5,0x1b7));var _0x54da=function(_0x52a76b,_0x59ec9a){_0x52a76b=_0x52a76b-0x0;var _0x1927cb=_0x4da5[_0x52a76b];return _0x1927cb;};'use strict';var _=require('lodash');var util=require(_0x54da('0x0'));var moment=require(_0x54da('0x1'));var BPromise=require(_0x54da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54da('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x54da('0x4'));var logger=require(_0x54da('0x5'))(_0x54da('0x6'));var config=require(_0x54da('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x54da('0x8')][_0x54da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x259062,_0x1b2b5c,_0x2fe7cc){return new BPromise(function(_0x30c17d,_0x1e2c78){return client['request'](_0x259062,_0x2fe7cc)[_0x54da('0xa')](function(_0x3c4e06){logger[_0x54da('0xb')]('SmsApplication,\x20%s,\x20%s',_0x1b2b5c,_0x54da('0xc'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x1b2b5c,_0x54da('0xc'),JSON[_0x54da('0xd')](_0x3c4e06));if(_0x3c4e06[_0x54da('0xe')]){if(_0x3c4e06[_0x54da('0xe')][_0x54da('0xf')]===0x1f4){logger[_0x54da('0xe')](_0x54da('0x10'),_0x1b2b5c,_0x3c4e06[_0x54da('0xe')][_0x54da('0x11')]);return _0x1e2c78(_0x3c4e06[_0x54da('0xe')][_0x54da('0x11')]);}logger[_0x54da('0xe')](_0x54da('0x10'),_0x1b2b5c,_0x3c4e06['error'][_0x54da('0x11')]);return _0x30c17d(_0x3c4e06[_0x54da('0xe')][_0x54da('0x11')]);}else{logger[_0x54da('0xb')]('SmsApplication,\x20%s,\x20%s',_0x1b2b5c,_0x54da('0xc'));_0x30c17d(_0x3c4e06[_0x54da('0x12')][_0x54da('0x11')]);}})[_0x54da('0x13')](function(_0x20ff93){logger[_0x54da('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1b2b5c,_0x20ff93);_0x1e2c78(_0x20ff93);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0xf494,0x1c6));var _0x4f49=function(_0x427565,_0x1f1538){_0x427565=_0x427565-0x0;var _0x1b03d4=_0xf494[_0x427565];return _0x1b03d4;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 082d7af..bffd08e 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 _0xcc4f=['create','/:id/messages','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','sms','smsinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post'];(function(_0x443bdd,_0x517654){var _0x3a1e48=function(_0x3a7e26){while(--_0x3a7e26){_0x443bdd['push'](_0x443bdd['shift']());}};_0x3a1e48(++_0x517654);}(_0xcc4f,0x106));var _0xfcc4=function(_0x5c21ca,_0x1cdefd){_0x5c21ca=_0x5c21ca-0x0;var _0x4c6f8f=_0xcc4f[_0x5c21ca];return _0x4c6f8f;};'use strict';var multer=require(_0xfcc4('0x0'));var util=require('util');var path=require(_0xfcc4('0x1'));var timeout=require(_0xfcc4('0x2'));var express=require(_0xfcc4('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfcc4('0x4'));var config=require(_0xfcc4('0x5'));var controller=require(_0xfcc4('0x6'));router[_0xfcc4('0x7')]('/',auth[_0xfcc4('0x8')](),controller[_0xfcc4('0x9')]);router[_0xfcc4('0x7')](_0xfcc4('0xa'),auth[_0xfcc4('0x8')](),controller[_0xfcc4('0xb')]);router[_0xfcc4('0x7')](_0xfcc4('0xc'),auth[_0xfcc4('0x8')](),controller[_0xfcc4('0xd')]);router[_0xfcc4('0x7')]('/:id/messages',auth[_0xfcc4('0x8')](),controller['getMessages']);router[_0xfcc4('0x7')](_0xfcc4('0xe'),auth['isAuthenticated'](),controller[_0xfcc4('0xf')]);router[_0xfcc4('0x10')]('/',auth[_0xfcc4('0x8')](),controller[_0xfcc4('0x11')]);router[_0xfcc4('0x10')](_0xfcc4('0x12'),auth[_0xfcc4('0x8')](),controller[_0xfcc4('0x13')]);router[_0xfcc4('0x10')](_0xfcc4('0x14'),auth['isAuthenticated'](),interaction[_0xfcc4('0x15')]('sms',_0xfcc4('0x16')),controller[_0xfcc4('0x17')]);router['put'](_0xfcc4('0xc'),auth[_0xfcc4('0x8')](),interaction['tracked']('sms',_0xfcc4('0x18')),controller[_0xfcc4('0x19')]);router[_0xfcc4('0x1a')](_0xfcc4('0xc'),auth[_0xfcc4('0x8')](),interaction[_0xfcc4('0x15')](_0xfcc4('0x1b'),_0xfcc4('0x1c')),controller[_0xfcc4('0x1d')]);router['delete'](_0xfcc4('0x14'),auth[_0xfcc4('0x8')](),controller['removeTags']);module[_0xfcc4('0x1e')]=router; \ No newline at end of file +var _0x31b4=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','removeTags','exports','multer'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0x31b4,0x116));var _0x431b=function(_0x214287,_0x4c31e2){_0x214287=_0x214287-0x0;var _0x5d4d8f=_0x31b4[_0x214287];return _0x5d4d8f;};'use strict';var multer=require(_0x431b('0x0'));var util=require(_0x431b('0x1'));var path=require(_0x431b('0x2'));var timeout=require(_0x431b('0x3'));var express=require(_0x431b('0x4'));var router=express[_0x431b('0x5')]();var auth=require(_0x431b('0x6'));var interaction=require(_0x431b('0x7'));var config=require('../../config/environment');var controller=require(_0x431b('0x8'));router[_0x431b('0x9')]('/',auth[_0x431b('0xa')](),controller[_0x431b('0xb')]);router[_0x431b('0x9')](_0x431b('0xc'),auth[_0x431b('0xa')](),controller[_0x431b('0xd')]);router[_0x431b('0x9')](_0x431b('0xe'),auth[_0x431b('0xa')](),controller[_0x431b('0xf')]);router[_0x431b('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x431b('0x10')]);router[_0x431b('0x9')](_0x431b('0x11'),auth[_0x431b('0xa')](),controller[_0x431b('0x12')]);router[_0x431b('0x13')]('/',auth[_0x431b('0xa')](),controller[_0x431b('0x14')]);router[_0x431b('0x13')]('/:id/messages',auth[_0x431b('0xa')](),controller['addMessage']);router[_0x431b('0x13')](_0x431b('0x15'),auth['isAuthenticated'](),interaction[_0x431b('0x16')](_0x431b('0x17'),_0x431b('0x18')),controller[_0x431b('0x19')]);router['put'](_0x431b('0xe'),auth[_0x431b('0xa')](),interaction['tracked']('sms',_0x431b('0x1a')),controller[_0x431b('0x1b')]);router[_0x431b('0x1c')]('/:id',auth[_0x431b('0xa')](),interaction[_0x431b('0x16')](_0x431b('0x17'),'smsinteraction:destroy'),controller['destroy']);router[_0x431b('0x1c')](_0x431b('0x15'),auth['isAuthenticated'](),controller[_0x431b('0x1d')]);module[_0x431b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index ee160f8..eb05c9e 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 _0xde88=['STRING','DATE','ENUM','out','sequelize','moment','BOOLEAN'];(function(_0x2e848c,_0x754fee){var _0x3de087=function(_0x5d8667){while(--_0x5d8667){_0x2e848c['push'](_0x2e848c['shift']());}};_0x3de087(++_0x754fee);}(_0xde88,0x17e));var _0x8de8=function(_0x54c695,_0x5d6677){_0x54c695=_0x54c695-0x0;var _0x3ce06b=_0xde88[_0x54c695];return _0x3ce06b;};'use strict';var Sequelize=require(_0x8de8('0x0'));var moment=require(_0x8de8('0x1'));module['exports']={'closed':{'type':Sequelize[_0x8de8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8de8('0x3')]},'secondDisposition':{'type':Sequelize[_0x8de8('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8de8('0x3')]},'note':{'type':Sequelize[_0x8de8('0x3')]},'phone':{'type':Sequelize[_0x8de8('0x3')]},'read1stAt':{'type':Sequelize[_0x8de8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8de8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8de8('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8de8('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x9fb3=['BOOLEAN','DATE','STRING','ENUM','out','moment','exports'];(function(_0x3cf6c5,_0x576ef0){var _0xa7b028=function(_0x2e52d5){while(--_0x2e52d5){_0x3cf6c5['push'](_0x3cf6c5['shift']());}};_0xa7b028(++_0x576ef0);}(_0x9fb3,0xad));var _0x39fb=function(_0x1a1aae,_0x41ffde){_0x1a1aae=_0x1a1aae-0x0;var _0x32fcfe=_0x9fb3[_0x1a1aae];return _0x32fcfe;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x39fb('0x0'));module[_0x39fb('0x1')]={'closed':{'type':Sequelize[_0x39fb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x39fb('0x3')]},'disposition':{'type':Sequelize[_0x39fb('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x39fb('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x39fb('0x5')]('in',_0x39fb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x39fb('0x5')]('in',_0x39fb('0x6')),'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 a35cbb2..319b4c2 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 _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','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','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','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','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\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?','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','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['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');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\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[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file +var _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','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','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','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','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\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?','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','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['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');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\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[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index d8f4561..2bda502 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 _0x0e85=['SmsMessage','remove','getUsers','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x0e85,0x7c));var _0x50e8=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x0e85[_0x39096d];return _0x13da4f;};'use strict';var EventEmitter=require(_0x50e8('0x0'));var SmsInteraction=require(_0x50e8('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x50e8('0x1'))['db'][_0x50e8('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x50e8('0x3')};function emitEvent(_0x4e90e7){return function(_0x3048e3,_0x2401b2,_0xe3151e){_0x3048e3[_0x50e8('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3ce904){_0x3048e3[_0x50e8('0x5')](_0x50e8('0x6'),_0x3ce904[_0x50e8('0x7')](function(_0x1fafb0){return{'id':_0x1fafb0['id']};}));return SmsMessage[_0x50e8('0x8')]({'where':{'SmsInteractionId':_0x3048e3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x11717c){_0x3048e3[_0x50e8('0x5')](_0x50e8('0x9'),_0x11717c[_0x50e8('0xa')]);SmsInteractionEvents[_0x50e8('0xb')](_0x4e90e7+':'+_0x3048e3['id'],_0x3048e3);SmsInteractionEvents[_0x50e8('0xb')](_0x4e90e7,_0x3048e3);_0xe3151e(null);})[_0x50e8('0xc')](_0xe3151e(null));};}for(var e in events){if(events[_0x50e8('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xb647=['save','update','getUsers','then','setDataValue','Users','map','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners'];(function(_0x39637b,_0x512d81){var _0x1c7905=function(_0x31fe56){while(--_0x31fe56){_0x39637b['push'](_0x39637b['shift']());}};_0x1c7905(++_0x512d81);}(_0xb647,0xdb));var _0x7b64=function(_0x1c8cd1,_0x2da3d7){_0x1c8cd1=_0x1c8cd1-0x0;var _0x1526d8=_0xb647[_0x1c8cd1];return _0x1526d8;};'use strict';var EventEmitter=require(_0x7b64('0x0'));var SmsInteraction=require(_0x7b64('0x1'))['db'][_0x7b64('0x2')];var SmsMessage=require(_0x7b64('0x1'))['db'][_0x7b64('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7b64('0x4')](0x0);var events={'afterCreate':_0x7b64('0x5'),'afterUpdate':_0x7b64('0x6'),'afterDestroy':'remove'};function emitEvent(_0x36ff12){return function(_0x4aaa21,_0x1daa28,_0x38ebf7){_0x4aaa21[_0x7b64('0x7')]({'attributes':['id'],'raw':!![]})[_0x7b64('0x8')](function(_0xcdec41){_0x4aaa21[_0x7b64('0x9')](_0x7b64('0xa'),_0xcdec41[_0x7b64('0xb')](function(_0x432ced){return{'id':_0x432ced['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x4aaa21['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7b64('0x8')](function(_0x49718f){_0x4aaa21[_0x7b64('0x9')]('unreadMessages',_0x49718f['length']);SmsInteractionEvents[_0x7b64('0xc')](_0x36ff12+':'+_0x4aaa21['id'],_0x4aaa21);SmsInteractionEvents[_0x7b64('0xc')](_0x36ff12,_0x4aaa21);_0x38ebf7(null);})['catch'](_0x38ebf7(null));};}for(var e in events){if(events[_0x7b64('0xd')](e)){var event=events[e];SmsInteraction[_0x7b64('0xe')](e,emitEvent(event));}}module[_0x7b64('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2d7d924..67bf23d 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 _0xee82=['./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','closed','closedAt','format','lodash','util','api','bluebird','path','rimraf','../../config/environment'];(function(_0x5ef55a,_0x2a03b1){var _0x20ae40=function(_0x46ce81){while(--_0x46ce81){_0x5ef55a['push'](_0x5ef55a['shift']());}};_0x20ae40(++_0x2a03b1);}(_0xee82,0x1e3));var _0x2ee8=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xee82[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x2ee8('0x0'));var util=require(_0x2ee8('0x1'));var logger=require('../../config/logger')(_0x2ee8('0x2'));var moment=require('moment');var BPromise=require(_0x2ee8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ee8('0x4'));var rimraf=require(_0x2ee8('0x5'));var config=require(_0x2ee8('0x6'));var attributes=require(_0x2ee8('0x7'));module[_0x2ee8('0x8')]=function(_0x1e7368,_0x56472a){return _0x1e7368['define'](_0x2ee8('0x9'),attributes,{'tableName':_0x2ee8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24b6bd,_0x17a6ee,_0x1002bb){if(_0x24b6bd['changed'](_0x2ee8('0xb'))){_0x24b6bd[_0x2ee8('0xc')]=moment()[_0x2ee8('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1002bb(null,_0x24b6bd);}}});}; \ No newline at end of file +var _0x9b61=['path','rimraf','../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x3b5558,_0xe1fe32){var _0xba49e4=function(_0x675ed4){while(--_0x675ed4){_0x3b5558['push'](_0x3b5558['shift']());}};_0xba49e4(++_0xe1fe32);}(_0x9b61,0x12b));var _0x19b6=function(_0x46ad75,_0x224a38){_0x46ad75=_0x46ad75-0x0;var _0x53ad4b=_0x9b61[_0x46ad75];return _0x53ad4b;};'use strict';var _=require(_0x19b6('0x0'));var util=require('util');var logger=require(_0x19b6('0x1'))('api');var moment=require(_0x19b6('0x2'));var BPromise=require(_0x19b6('0x3'));var rp=require(_0x19b6('0x4'));var fs=require('fs');var path=require(_0x19b6('0x5'));var rimraf=require(_0x19b6('0x6'));var config=require(_0x19b6('0x7'));var attributes=require('./smsInteraction.attributes');module[_0x19b6('0x8')]=function(_0x2ea736,_0xf91f48){return _0x2ea736[_0x19b6('0x9')](_0x19b6('0xa'),attributes,{'tableName':_0x19b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf85bf0,_0x362c53,_0x40d3ea){if(_0xf85bf0[_0x19b6('0xc')](_0x19b6('0xd'))){_0xf85bf0[_0x19b6('0xe')]=moment()[_0x19b6('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x40d3ea(null,_0xf85bf0);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 1ebfec6..d54832c 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 _0x25fe=['options','raw','attributes','limit','debug','catch','AddTagsToSmsInteraction','find','where','addTags','omit','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','UpdateSmsInteraction','SmsInteraction','update','body'];(function(_0x9924b6,_0x4e578a){var _0x53eba6=function(_0x264f53){while(--_0x264f53){_0x9924b6['push'](_0x9924b6['shift']());}};_0x53eba6(++_0x4e578a);}(_0x25fe,0x13a));var _0xe25f=function(_0x158a58,_0x28e8e7){_0x158a58=_0x158a58-0x0;var _0x4935d9=_0x25fe[_0x158a58];return _0x4935d9;};'use strict';var _=require(_0xe25f('0x0'));var util=require('util');var moment=require(_0xe25f('0x1'));var BPromise=require(_0xe25f('0x2'));var rs=require(_0xe25f('0x3'));var fs=require('fs');var Redis=require(_0xe25f('0x4'));var db=require(_0xe25f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe25f('0x6'))('rpc');var config=require(_0xe25f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe25f('0x8')][_0xe25f('0x9')]({'port':0x232a});config[_0xe25f('0xa')]=_[_0xe25f('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe25f('0xc'))(new Redis(config[_0xe25f('0xa')]));require(_0xe25f('0xd'))[_0xe25f('0xe')](socket);function respondWithRpcPromise(_0x550b97,_0x18f7ab,_0x59ff88){return new BPromise(function(_0x484181,_0x41cac0){return client[_0xe25f('0xf')](_0x550b97,_0x59ff88)[_0xe25f('0x10')](function(_0x46d978){logger['info'](_0xe25f('0x11'),_0x18f7ab,'request\x20sent');logger['debug'](_0xe25f('0x12'),_0x18f7ab,_0xe25f('0x13'),JSON[_0xe25f('0x14')](_0x46d978));if(_0x46d978[_0xe25f('0x15')]){if(_0x46d978[_0xe25f('0x15')][_0xe25f('0x16')]===0x1f4){logger['error'](_0xe25f('0x11'),_0x18f7ab,_0x46d978['error'][_0xe25f('0x17')]);return _0x41cac0(_0x46d978['error'][_0xe25f('0x17')]);}logger['error'](_0xe25f('0x11'),_0x18f7ab,_0x46d978[_0xe25f('0x15')][_0xe25f('0x17')]);return _0x484181(_0x46d978['error'][_0xe25f('0x17')]);}else{logger[_0xe25f('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x18f7ab,_0xe25f('0x13'));_0x484181(_0x46d978[_0xe25f('0x19')][_0xe25f('0x17')]);}})['catch'](function(_0x3c805c){logger[_0xe25f('0x15')](_0xe25f('0x11'),_0x18f7ab,_0x3c805c);_0x41cac0(_0x3c805c);});});}exports[_0xe25f('0x1a')]=function(_0x3c275f){var _0x3cb399=this;return new Promise(function(_0x2b806d,_0x2f5c97){return db[_0xe25f('0x1b')][_0xe25f('0x1c')](_0x3c275f[_0xe25f('0x1d')],{'raw':_0x3c275f[_0xe25f('0x1e')]?_0x3c275f[_0xe25f('0x1e')][_0xe25f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c275f[_0xe25f('0x1e')]?_0x3c275f[_0xe25f('0x1e')]['where']||null:null,'attributes':_0x3c275f[_0xe25f('0x1e')]?_0x3c275f[_0xe25f('0x1e')][_0xe25f('0x20')]||null:null,'limit':_0x3c275f[_0xe25f('0x1e')]?_0x3c275f['options'][_0xe25f('0x21')]||null:null})[_0xe25f('0x10')](function(_0x113f19){logger[_0xe25f('0x18')](_0xe25f('0x1a'),_0x3c275f);logger[_0xe25f('0x22')](_0xe25f('0x1a'),_0x3c275f,JSON['stringify'](_0x113f19));_0x2b806d(_0x113f19);})[_0xe25f('0x23')](function(_0x2786fe){logger[_0xe25f('0x15')](_0xe25f('0x1a'),_0x2786fe['message'],_0x3c275f);_0x2f5c97(_0x3cb399[_0xe25f('0x15')](0x1f4,_0x2786fe[_0xe25f('0x17')]));});});};exports[_0xe25f('0x24')]=function(_0x5f3437){return new Promise(function(_0x39b419,_0x1591fc){return db[_0xe25f('0x1b')][_0xe25f('0x25')]({'where':_0x5f3437['options']?_0x5f3437['options'][_0xe25f('0x26')]||null:null})[_0xe25f('0x10')](function(_0x13c834){if(_0x13c834){return _0x13c834[_0xe25f('0x27')](_0x5f3437['body']['ids'],_[_0xe25f('0x28')](_0x5f3437[_0xe25f('0x1d')],[_0xe25f('0x29'),'id'])||{});}})['spread'](function(_0x288a6b){logger[_0xe25f('0x18')](_0xe25f('0x2a'),_0x5f3437);logger[_0xe25f('0x22')](_0xe25f('0x2a'),_0x5f3437,JSON[_0xe25f('0x14')](_0x288a6b));_0x39b419(_0x288a6b);})[_0xe25f('0x23')](function(_0x4d894b){logger['error'](_0xe25f('0x2a'),_0x4d894b[_0xe25f('0x17')],_0x5f3437);_0x1591fc(_this[_0xe25f('0x15')](0x1f4,_0x4d894b[_0xe25f('0x17')]));});});}; \ No newline at end of file +var _0x52d2=['request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsInteraction','update','options','where','attributes','limit','UpdateSmsInteraction','stringify','find','addTags','body','omit','ids','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register'];(function(_0x2a50f7,_0x4c5ed1){var _0x5123ec=function(_0x552d41){while(--_0x552d41){_0x2a50f7['push'](_0x2a50f7['shift']());}};_0x5123ec(++_0x4c5ed1);}(_0x52d2,0x95));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 moment=require('moment');var BPromise=require(_0x252d('0x2'));var rs=require(_0x252d('0x3'));var fs=require('fs');var Redis=require(_0x252d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x252d('0x5'))('rpc');var config=require(_0x252d('0x6'));var jayson=require(_0x252d('0x7'));var client=jayson[_0x252d('0x8')][_0x252d('0x9')]({'port':0x232a});config[_0x252d('0xa')]=_['defaults'](config[_0x252d('0xa')],{'host':_0x252d('0xb'),'port':0x18eb});var socket=require(_0x252d('0xc'))(new Redis(config[_0x252d('0xa')]));require(_0x252d('0xd'))[_0x252d('0xe')](socket);function respondWithRpcPromise(_0x45d8e7,_0x14ba94,_0x19fe6f){return new BPromise(function(_0x54f635,_0x18a202){return client[_0x252d('0xf')](_0x45d8e7,_0x19fe6f)[_0x252d('0x10')](function(_0x323c26){logger[_0x252d('0x11')](_0x252d('0x12'),_0x14ba94,_0x252d('0x13'));logger[_0x252d('0x14')](_0x252d('0x15'),_0x14ba94,_0x252d('0x13'),JSON['stringify'](_0x323c26));if(_0x323c26[_0x252d('0x16')]){if(_0x323c26[_0x252d('0x16')][_0x252d('0x17')]===0x1f4){logger[_0x252d('0x16')](_0x252d('0x12'),_0x14ba94,_0x323c26['error'][_0x252d('0x18')]);return _0x18a202(_0x323c26[_0x252d('0x16')]['message']);}logger['error'](_0x252d('0x12'),_0x14ba94,_0x323c26[_0x252d('0x16')][_0x252d('0x18')]);return _0x54f635(_0x323c26[_0x252d('0x16')][_0x252d('0x18')]);}else{logger[_0x252d('0x11')](_0x252d('0x12'),_0x14ba94,_0x252d('0x13'));_0x54f635(_0x323c26[_0x252d('0x19')][_0x252d('0x18')]);}})[_0x252d('0x1a')](function(_0x44bcad){logger[_0x252d('0x16')](_0x252d('0x12'),_0x14ba94,_0x44bcad);_0x18a202(_0x44bcad);});});}exports['UpdateSmsInteraction']=function(_0x22f102){var _0x4662ed=this;return new Promise(function(_0xe865ce,_0x4bdba8){return db[_0x252d('0x1b')][_0x252d('0x1c')](_0x22f102['body'],{'raw':_0x22f102[_0x252d('0x1d')]?_0x22f102[_0x252d('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22f102[_0x252d('0x1d')]?_0x22f102['options'][_0x252d('0x1e')]||null:null,'attributes':_0x22f102[_0x252d('0x1d')]?_0x22f102[_0x252d('0x1d')][_0x252d('0x1f')]||null:null,'limit':_0x22f102[_0x252d('0x1d')]?_0x22f102[_0x252d('0x1d')][_0x252d('0x20')]||null:null})[_0x252d('0x10')](function(_0x356742){logger[_0x252d('0x11')]('UpdateSmsInteraction',_0x22f102);logger[_0x252d('0x14')](_0x252d('0x21'),_0x22f102,JSON[_0x252d('0x22')](_0x356742));_0xe865ce(_0x356742);})[_0x252d('0x1a')](function(_0x13957c){logger['error'](_0x252d('0x21'),_0x13957c[_0x252d('0x18')],_0x22f102);_0x4bdba8(_0x4662ed[_0x252d('0x16')](0x1f4,_0x13957c[_0x252d('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4dd62c){return new Promise(function(_0x1d8a9d,_0x267d77){return db['SmsInteraction'][_0x252d('0x23')]({'where':_0x4dd62c[_0x252d('0x1d')]?_0x4dd62c[_0x252d('0x1d')][_0x252d('0x1e')]||null:null})[_0x252d('0x10')](function(_0x557eb2){if(_0x557eb2){return _0x557eb2[_0x252d('0x24')](_0x4dd62c[_0x252d('0x25')]['ids'],_[_0x252d('0x26')](_0x4dd62c[_0x252d('0x25')],[_0x252d('0x27'),'id'])||{});}})['spread'](function(_0x47e512){logger['info']('AddTags',_0x4dd62c);logger['debug']('AddTags',_0x4dd62c,JSON['stringify'](_0x47e512));_0x1d8a9d(_0x47e512);})[_0x252d('0x1a')](function(_0x3a58d6){logger['error'](_0x252d('0x28'),_0x3a58d6['message'],_0x4dd62c);_0x267d77(_this[_0x252d('0x16')](0x1f4,_0x3a58d6['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 84b2b8e..f02b417 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 _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x5d9d24,_0x348a17){var _0x5af9b5=function(_0x681643){while(--_0x681643){_0x5d9d24['push'](_0x5d9d24['shift']());}};_0x5af9b5(++_0x348a17);}(_0x757a,0xde));var _0xa757=function(_0x2ea172,_0xa2bae7){_0x2ea172=_0x2ea172-0x0;var _0x2a80f7=_0x757a[_0x2ea172];return _0x2a80f7;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file +var _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x36671d,_0x540a3e){var _0x17d8a2=function(_0x38d693){while(--_0x38d693){_0x36671d['push'](_0x36671d['shift']());}};_0x17d8a2(++_0x540a3e);}(_0x757a,0xde));var _0xa757=function(_0x9d250b,_0x227ba5){_0x9d250b=_0x9d250b-0x0;var _0x3fb04b=_0x757a[_0x9d250b];return _0x3fb04b;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 65f187e..6ec9649 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 _0x057d=['sms','create','status','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','/:id','show','post','tracked'];(function(_0x19ccad,_0x2e2177){var _0x51295a=function(_0x337f2b){while(--_0x337f2b){_0x19ccad['push'](_0x19ccad['shift']());}};_0x51295a(++_0x2e2177);}(_0x057d,0x15d));var _0xd057=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0x057d[_0x2d982d];return _0x4f36b0;};'use strict';var multer=require('multer');var util=require(_0xd057('0x0'));var path=require(_0xd057('0x1'));var timeout=require(_0xd057('0x2'));var express=require(_0xd057('0x3'));var router=express[_0xd057('0x4')]();var auth=require(_0xd057('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd057('0x6'));var controller=require(_0xd057('0x7'));router[_0xd057('0x8')]('/',auth[_0xd057('0x9')](),controller['index']);router[_0xd057('0x8')](_0xd057('0xa'),auth[_0xd057('0x9')](),controller['describe']);router[_0xd057('0x8')](_0xd057('0xb'),auth[_0xd057('0x9')](),controller[_0xd057('0xc')]);router[_0xd057('0xd')]('/',auth[_0xd057('0x9')](),interaction[_0xd057('0xe')](_0xd057('0xf'),'smsmessage:create'),controller[_0xd057('0x10')]);router[_0xd057('0xd')]('/:id/status',controller[_0xd057('0x11')]);router['put'](_0xd057('0xb'),auth[_0xd057('0x9')](),controller[_0xd057('0x12')]);router[_0xd057('0x13')](_0xd057('0x14'),auth['isAuthenticated'](),controller[_0xd057('0x15')]);router[_0xd057('0x13')](_0xd057('0x16'),auth[_0xd057('0x9')](),controller['reject']);router[_0xd057('0x17')]('/:id',auth[_0xd057('0x9')](),controller[_0xd057('0x18')]);module[_0xd057('0x19')]=router; \ No newline at end of file +var _0x318a=['connect-timeout','express','Router','../../components/interaction/service','./smsMessage.controller','isAuthenticated','get','/describe','describe','show','post','tracked','sms','smsmessage:create','create','status','put','/:id','update','accept','/:id/reject','exports','path'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x318a,0xb7));var _0xa318=function(_0x1f23e8,_0x22b5dc){_0x1f23e8=_0x1f23e8-0x0;var _0x4560b6=_0x318a[_0x1f23e8];return _0x4560b6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa318('0x0'));var timeout=require(_0xa318('0x1'));var express=require(_0xa318('0x2'));var router=express[_0xa318('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa318('0x4'));var config=require('../../config/environment');var controller=require(_0xa318('0x5'));router['get']('/',auth[_0xa318('0x6')](),controller['index']);router[_0xa318('0x7')](_0xa318('0x8'),auth[_0xa318('0x6')](),controller[_0xa318('0x9')]);router[_0xa318('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa318('0xa')]);router[_0xa318('0xb')]('/',auth[_0xa318('0x6')](),interaction[_0xa318('0xc')](_0xa318('0xd'),_0xa318('0xe')),controller[_0xa318('0xf')]);router[_0xa318('0xb')]('/:id/status',controller[_0xa318('0x10')]);router[_0xa318('0x11')](_0xa318('0x12'),auth['isAuthenticated'](),controller[_0xa318('0x13')]);router[_0xa318('0x11')]('/:id/accept',auth[_0xa318('0x6')](),controller[_0xa318('0x14')]);router[_0xa318('0x11')](_0xa318('0x15'),auth[_0xa318('0x6')](),controller['reject']);router['delete'](_0xa318('0x12'),auth[_0xa318('0x6')](),controller['destroy']);module[_0xa318('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2ff08ab..cfa2c4b 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 _0x4809=['medium','BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','exports'];(function(_0x5e8e78,_0xa2442f){var _0x278678=function(_0x5dcd67){while(--_0x5dcd67){_0x5e8e78['push'](_0x5e8e78['shift']());}};_0x278678(++_0xa2442f);}(_0x4809,0xb2));var _0x9480=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x4809[_0xef8146];return _0x5a6cb0;};'use strict';var Sequelize=require(_0x9480('0x0'));module[_0x9480('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9480('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9480('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9480('0x4')]('in','out'),'defaultValue':_0x9480('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9480('0x6')](0xbe)},'phone':{'type':Sequelize[_0x9480('0x6')]},'readAt':{'type':Sequelize[_0x9480('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9480('0x6')]},'providerResponse':{'type':Sequelize[_0x9480('0x8')]}}; \ No newline at end of file +var _0x6b0d=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x4a7128,_0x27fb42){var _0x3a9b5e=function(_0x4bb05e){while(--_0x4bb05e){_0x4a7128['push'](_0x4a7128['shift']());}};_0x3a9b5e(++_0x27fb42);}(_0x6b0d,0x196));var _0xd6b0=function(_0x569a89,_0x4d439e){_0x569a89=_0x569a89-0x0;var _0x3f41cb=_0x6b0d[_0x569a89];return _0x3f41cb;};'use strict';var Sequelize=require(_0xd6b0('0x0'));module[_0xd6b0('0x1')]={'body':{'type':Sequelize[_0xd6b0('0x2')](_0xd6b0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd6b0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd6b0('0x5')]('in','out'),'defaultValue':_0xd6b0('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd6b0('0x7')](0xbe)},'phone':{'type':Sequelize[_0xd6b0('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xd6b0('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd6b0('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 3a70d63..07f370e 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 _0x8237=['sms','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SIP/%s','rejectmessage','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','sent','delivered','Status','plivio','results','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','sort','pick','filter','merge','options','includeAll','rows','params','length','include','find','create','body','describe','sms-interactions','read','readAt','format','UserId','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','manual','interface','channel','event','accept','EventManager','reject'];(function(_0x4147bc,_0x5e5937){var _0x58a8b1=function(_0x408a52){while(--_0x408a52){_0x4147bc['push'](_0x4147bc['shift']());}};_0x58a8b1(++_0x5e5937);}(_0x8237,0x1a4));var _0x7823=function(_0xf38861,_0x44d5c0){_0xf38861=_0xf38861-0x0;var _0x19ed80=_0x8237[_0xf38861];return _0x19ed80;};'use strict';var pdf=require(_0x7823('0x0'));var emlformat=require(_0x7823('0x1'));var rimraf=require(_0x7823('0x2'));var zipdir=require(_0x7823('0x3'));var jsonpatch=require(_0x7823('0x4'));var rp=require(_0x7823('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7823('0x6'));var util=require(_0x7823('0x7'));var path=require(_0x7823('0x8'));var sox=require(_0x7823('0x9'));var csv=require(_0x7823('0xa'));var ejs=require(_0x7823('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7823('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7823('0xd'));var toCsv=require(_0x7823('0xa'));var querystring=require(_0x7823('0xe'));var Papa=require('papaparse');var Redis=require(_0x7823('0xf'));var authService=require(_0x7823('0x10'));var qs=require(_0x7823('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7823('0x12'));var logger=require(_0x7823('0x13'))('api');var utils=require(_0x7823('0x14'));var config=require(_0x7823('0x15'));var licenseUtil=require(_0x7823('0x16'));var db=require(_0x7823('0x17'))['db'];config[_0x7823('0x18')]=_[_0x7823('0x19')](config[_0x7823('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x7823('0x1a'))(new Redis(config['redis']));require(_0x7823('0x1b'))[_0x7823('0x1c')](socket);var jayson=require(_0x7823('0x1d'));var client=jayson[_0x7823('0x1e')][_0x7823('0x1f')]({'port':0x232c});var client9002=jayson[_0x7823('0x1e')][_0x7823('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3e84f1,_0x18f3b8,_0x525c02,_0x3d2400){return new BPromise(function(_0x5670b5,_0x349b9d){var _0xd834f2=_0x3d2400||client;return _0xd834f2[_0x7823('0x20')](_0x3e84f1,_0x525c02)['then'](function(_0x1cdb42){logger[_0x7823('0x21')](_0x7823('0x22'),_0x18f3b8,_0x7823('0x23'));logger[_0x7823('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18f3b8,'request\x20sent',JSON[_0x7823('0x25')](_0x1cdb42));if(_0x1cdb42[_0x7823('0x26')]){if(_0x1cdb42['error'][_0x7823('0x27')]===0x1f4){logger[_0x7823('0x26')](_0x7823('0x22'),_0x18f3b8,_0x1cdb42[_0x7823('0x26')]['message']);return _0x349b9d(_0x1cdb42[_0x7823('0x26')][_0x7823('0x28')]);}logger[_0x7823('0x26')](_0x7823('0x22'),_0x18f3b8,_0x1cdb42[_0x7823('0x26')][_0x7823('0x28')]);return _0x5670b5(_0x1cdb42[_0x7823('0x26')][_0x7823('0x28')]);}else{logger[_0x7823('0x21')](_0x7823('0x22'),_0x18f3b8,_0x7823('0x23'));_0x5670b5(_0x1cdb42[_0x7823('0x29')][_0x7823('0x28')]);}})[_0x7823('0x2a')](function(_0x3f0c70){logger[_0x7823('0x26')](_0x7823('0x22'),_0x18f3b8,_0x3f0c70);_0x349b9d(_0x3f0c70);});});}function respondWithStatusCode(_0x5e2582,_0x629321){_0x629321=_0x629321||0xcc;return function(_0x3be53b){if(_0x3be53b){return _0x5e2582[_0x7823('0x2b')](_0x629321);}return _0x5e2582[_0x7823('0x2c')](_0x629321)[_0x7823('0x2d')]();};}function respondWithResult(_0xdcb0bc,_0x18e940){_0x18e940=_0x18e940||0xc8;return function(_0x492005){if(_0x492005){return _0xdcb0bc[_0x7823('0x2c')](_0x18e940)[_0x7823('0x2e')](_0x492005);}};}function respondWithFilteredResult(_0x582d50,_0x3aeee4){return function(_0x368299){if(_0x368299){var _0x4a0898=_0x368299[_0x7823('0x2f')],_0x569988=_0x3aeee4['offset'],_0x3d0879=_0x3aeee4['offset']+_0x3aeee4[_0x7823('0x30')],_0x287ac1;if(_0x3d0879>=_0x4a0898){_0x3d0879=_0x4a0898;_0x287ac1=0xc8;}else{_0x287ac1=0xce;}_0x582d50[_0x7823('0x2c')](_0x287ac1);return _0x582d50[_0x7823('0x31')](_0x7823('0x32'),_0x569988+'-'+_0x3d0879+'/'+_0x4a0898)[_0x7823('0x2e')](_0x368299);}return null;};}function patchUpdates(_0x3d00d3){return function(_0x675a4f){try{jsonpatch[_0x7823('0x33')](_0x675a4f,_0x3d00d3,!![]);}catch(_0x18e04a){return BPromise['reject'](_0x18e04a);}return _0x675a4f[_0x7823('0x34')]();};}function saveUpdates(_0x5da87c,_0x434ffe){return function(_0x483988){if(_0x483988){return _0x483988[_0x7823('0x35')](_0x5da87c)[_0x7823('0x36')](function(_0x23b892){return _0x23b892;});}return null;};}function removeEntity(_0x411f7b,_0x87ec89){return function(_0xa9fd41){if(_0xa9fd41){return _0xa9fd41[_0x7823('0x37')]()['then'](function(){_0x411f7b['status'](0xcc)[_0x7823('0x2d')]();});}};}function handleEntityNotFound(_0x57ab5c,_0x5b6c5b){return function(_0x195210){if(!_0x195210){_0x57ab5c[_0x7823('0x2b')](0x194);}return _0x195210;};}function handleError(_0x274a72,_0x2c5aad){_0x2c5aad=_0x2c5aad||0x1f4;return function(_0x1e13dd){logger['error'](_0x1e13dd['stack']);if(_0x1e13dd[_0x7823('0x38')]){delete _0x1e13dd[_0x7823('0x38')];}_0x274a72[_0x7823('0x2c')](_0x2c5aad)[_0x7823('0x39')](_0x1e13dd);};}exports[_0x7823('0x3a')]=function(_0xc6367f,_0x26985b){var _0xabbda={},_0x5563d0={},_0x378fca={'count':0x0,'rows':[]};var _0x224ba6=_[_0x7823('0x3b')](db[_0x7823('0x3c')][_0x7823('0x3d')],function(_0x1bb5aa){return{'name':_0x1bb5aa[_0x7823('0x3e')],'type':_0x1bb5aa[_0x7823('0x3f')][_0x7823('0x40')]};});_0x5563d0['model']=_[_0x7823('0x3b')](_0x224ba6,'name');_0x5563d0[_0x7823('0x41')]=_[_0x7823('0x42')](_0xc6367f[_0x7823('0x41')]);_0x5563d0[_0x7823('0x43')]=_[_0x7823('0x44')](_0x5563d0[_0x7823('0x45')],_0x5563d0[_0x7823('0x41')]);_0xabbda[_0x7823('0x46')]=_[_0x7823('0x44')](_0x5563d0[_0x7823('0x45')],qs[_0x7823('0x47')](_0xc6367f['query'][_0x7823('0x47')]));_0xabbda[_0x7823('0x46')]=_0xabbda[_0x7823('0x46')]['length']?_0xabbda[_0x7823('0x46')]:_0x5563d0[_0x7823('0x45')];if(!_0xc6367f[_0x7823('0x41')][_0x7823('0x48')](_0x7823('0x49'))){_0xabbda[_0x7823('0x30')]=qs[_0x7823('0x30')](_0xc6367f['query'][_0x7823('0x30')]);_0xabbda[_0x7823('0x4a')]=qs['offset'](_0xc6367f['query']['offset']);}_0xabbda['order']=qs[_0x7823('0x4b')](_0xc6367f[_0x7823('0x41')][_0x7823('0x4b')]);_0xabbda['where']=qs[_0x7823('0x43')](_[_0x7823('0x4c')](_0xc6367f[_0x7823('0x41')],_0x5563d0['filters']),_0x224ba6);if(_0xc6367f['query'][_0x7823('0x4d')]){_0xabbda['where']=_[_0x7823('0x4e')](_0xabbda['where'],{'$or':_[_0x7823('0x3b')](_0x224ba6,function(_0x1f40f1){if(_0x1f40f1['type']!=='VIRTUAL'){var _0x2faaeb={};_0x2faaeb[_0x1f40f1[_0x7823('0x38')]]={'$like':'%'+_0xc6367f[_0x7823('0x41')][_0x7823('0x4d')]+'%'};return _0x2faaeb;}})});}_0xabbda=_[_0x7823('0x4e')]({},_0xabbda,_0xc6367f[_0x7823('0x4f')]);var _0xd11194={'where':_0xabbda['where']};return db['SmsMessage'][_0x7823('0x2f')](_0xd11194)[_0x7823('0x36')](function(_0x5d777b){_0x378fca[_0x7823('0x2f')]=_0x5d777b;if(_0xc6367f[_0x7823('0x41')][_0x7823('0x50')]){_0xabbda['include']=[{'all':!![]}];}return db[_0x7823('0x3c')]['findAll'](_0xabbda);})['then'](function(_0x42f93c){_0x378fca[_0x7823('0x51')]=_0x42f93c;return _0x378fca;})['then'](respondWithFilteredResult(_0x26985b,_0xabbda))[_0x7823('0x2a')](handleError(_0x26985b,null));};exports['show']=function(_0x2ef931,_0x200ea2){var _0x26698b={'raw':!![],'where':{'id':_0x2ef931[_0x7823('0x52')]['id']}},_0x23318c={};_0x23318c[_0x7823('0x45')]=_[_0x7823('0x42')](db[_0x7823('0x3c')]['rawAttributes']);_0x23318c['query']=_[_0x7823('0x42')](_0x2ef931['query']);_0x23318c[_0x7823('0x43')]=_[_0x7823('0x44')](_0x23318c['model'],_0x23318c['query']);_0x26698b[_0x7823('0x46')]=_[_0x7823('0x44')](_0x23318c['model'],qs[_0x7823('0x47')](_0x2ef931[_0x7823('0x41')]['fields']));_0x26698b[_0x7823('0x46')]=_0x26698b[_0x7823('0x46')][_0x7823('0x53')]?_0x26698b[_0x7823('0x46')]:_0x23318c[_0x7823('0x45')];if(_0x2ef931['query'][_0x7823('0x50')]){_0x26698b[_0x7823('0x54')]=[{'all':!![]}];}_0x26698b=_[_0x7823('0x4e')]({},_0x26698b,_0x2ef931['options']);return db[_0x7823('0x3c')][_0x7823('0x55')](_0x26698b)[_0x7823('0x36')](handleEntityNotFound(_0x200ea2,null))[_0x7823('0x36')](respondWithResult(_0x200ea2,null))[_0x7823('0x2a')](handleError(_0x200ea2,null));};exports[_0x7823('0x56')]=function(_0x35054d,_0xc6b977){return db[_0x7823('0x3c')][_0x7823('0x56')](_0x35054d[_0x7823('0x57')],{})[_0x7823('0x36')](respondWithResult(_0xc6b977,0xc9))[_0x7823('0x2a')](handleError(_0xc6b977,null));};exports[_0x7823('0x35')]=function(_0x4f4b21,_0x458f11){if(_0x4f4b21[_0x7823('0x57')]['id']){delete _0x4f4b21['body']['id'];}return db['SmsMessage'][_0x7823('0x55')]({'where':{'id':_0x4f4b21[_0x7823('0x52')]['id']}})[_0x7823('0x36')](handleEntityNotFound(_0x458f11,null))['then'](saveUpdates(_0x4f4b21[_0x7823('0x57')],null))[_0x7823('0x36')](respondWithResult(_0x458f11,null))[_0x7823('0x2a')](handleError(_0x458f11,null));};exports[_0x7823('0x37')]=function(_0x13c4f5,_0x47afd6){return db[_0x7823('0x3c')]['find']({'where':{'id':_0x13c4f5['params']['id']}})['then'](handleEntityNotFound(_0x47afd6,null))[_0x7823('0x36')](removeEntity(_0x47afd6,null))['catch'](handleError(_0x47afd6,null));};exports[_0x7823('0x58')]=function(_0x59c705,_0x88f7e4){return db[_0x7823('0x3c')][_0x7823('0x58')]()[_0x7823('0x36')](respondWithResult(_0x88f7e4,null))['catch'](handleError(_0x88f7e4,null));};var interaction_log=require(_0x7823('0x13'))(_0x7823('0x59'));exports['accept']=function(_0x18cc5b,_0x3b5d07,_0x456ffe){var _0x26a2d5={'agent':{},'channel':'sms'};if(_0x18cc5b[_0x7823('0x57')]['id']){delete _0x18cc5b[_0x7823('0x57')]['id'];}_0x18cc5b[_0x7823('0x57')][_0x7823('0x5a')]=!![];_0x18cc5b[_0x7823('0x57')][_0x7823('0x5b')]=moment()[_0x7823('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x18cc5b['body']['UserId']=_0x18cc5b[_0x7823('0x57')][_0x7823('0x5d')]||_0x18cc5b['user']['id'];_0x26a2d5['agent']['id']=_0x18cc5b[_0x7823('0x57')][_0x7823('0x5d')];return db['SmsMessage'][_0x7823('0x55')]({'where':{'id':_0x18cc5b[_0x7823('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x7823('0x5e')],'as':_0x7823('0x5f')}]})['then'](handleEntityNotFound(_0x3b5d07,null))[_0x7823('0x36')](saveUpdates(_0x18cc5b[_0x7823('0x57')],null))[_0x7823('0x36')](function(_0x5081fb){if(_0x5081fb){_0x26a2d5['message']=_0x5081fb[_0x7823('0x60')]({'plain':!![]});return db[_0x7823('0x61')]['find']({'where':{'id':_0x5081fb[_0x7823('0x62')]}});}return null;})[_0x7823('0x36')](handleEntityNotFound(_0x3b5d07,null))[_0x7823('0x36')](function(_0x1b143f){if(_0x1b143f){return _0x1b143f['update']({'UserId':_0x18cc5b[_0x7823('0x57')][_0x7823('0x5d')],'read1stAt':_[_0x7823('0x63')](_0x1b143f['read1stAt'])?moment()[_0x7823('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7823('0x36')](function(_0x49b6b9){if(_0x49b6b9){_0x26a2d5[_0x7823('0x64')]=_0x49b6b9[_0x7823('0x60')]({'plain':!![]});interaction_log['info'](_0x7823('0x65'),_0x18cc5b[_0x7823('0x66')]['id'],_0x18cc5b['user'][_0x7823('0x38')],_0x18cc5b['user'][_0x7823('0x67')],_0x26a2d5[_0x7823('0x64')]['id'],_0x18cc5b[_0x7823('0x57')]?JSON['stringify'](_0x18cc5b['body']):'null');return respondWithRpcPromise(_0x7823('0x68'),'acceptMessage',_0x26a2d5);}return null;})[_0x7823('0x36')](function(_0x31923a){if(_0x31923a){if(_0x18cc5b['body'][_0x7823('0x69')]){_0x26a2d5[_0x7823('0x28')][_0x7823('0x6a')]=util[_0x7823('0x5c')]('SIP/%s',_0x18cc5b[_0x7823('0x66')][_0x7823('0x38')]);_0x26a2d5[_0x7823('0x28')]['channel']=_0x26a2d5[_0x7823('0x6b')];_0x26a2d5[_0x7823('0x28')][_0x7823('0x6c')]=_0x7823('0x6d');return respondWithRpcPromise('EventManager',_0x7823('0x6e'),{'event':'acceptmessage','message':_0x26a2d5[_0x7823('0x28')]},client9002)[_0x7823('0x36')](function(){return _0x26a2d5;});}return _0x26a2d5;}return null;})[_0x7823('0x36')](respondWithResult(_0x3b5d07,null))['catch'](handleError(_0x3b5d07,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x7823('0x6f')]=function(_0x4fe75d,_0x178231,_0x4ae1fa){var _0x126b6f={'agent':{},'channel':_0x7823('0x70')};if(_0x4fe75d[_0x7823('0x57')]['id']){delete _0x4fe75d['body']['id'];}_0x4fe75d[_0x7823('0x57')][_0x7823('0x5d')]=_0x4fe75d[_0x7823('0x57')][_0x7823('0x5d')]||_0x4fe75d[_0x7823('0x66')]['id'];_0x126b6f[_0x7823('0x71')]['id']=_0x4fe75d[_0x7823('0x57')][_0x7823('0x5d')];return db[_0x7823('0x3c')][_0x7823('0x55')]({'where':{'id':_0x4fe75d[_0x7823('0x52')]['id'],'UserId':null}})[_0x7823('0x36')](handleEntityNotFound(_0x178231,null))[_0x7823('0x36')](function(_0x1c7894){if(_0x1c7894){_0x126b6f[_0x7823('0x28')]=_0x1c7894['get']({'plain':!![]});return db[_0x7823('0x61')][_0x7823('0x55')]({'where':{'id':_0x1c7894[_0x7823('0x62')]}});}return null;})[_0x7823('0x36')](handleEntityNotFound(_0x178231,null))[_0x7823('0x36')](function(_0x332c1b){if(_0x332c1b){_0x126b6f[_0x7823('0x64')]=_0x332c1b[_0x7823('0x60')]({'plain':!![]});interaction_log[_0x7823('0x21')](_0x7823('0x72'),_0x4fe75d[_0x7823('0x66')]['id'],_0x4fe75d[_0x7823('0x66')][_0x7823('0x38')],_0x4fe75d['user']['role'],_0x126b6f[_0x7823('0x64')]['id'],_0x4fe75d[_0x7823('0x57')]?JSON[_0x7823('0x25')](_0x4fe75d[_0x7823('0x57')]):_0x7823('0x73'));return respondWithRpcPromise(_0x7823('0x74'),_0x7823('0x75'),_0x126b6f);}return null;})[_0x7823('0x36')](function(_0x1b7f50){if(_0x1b7f50){_0x1b7f50[_0x7823('0x28')]['interface']=util[_0x7823('0x5c')](_0x7823('0x76'),_0x4fe75d['user'][_0x7823('0x38')]);_0x1b7f50['message'][_0x7823('0x6b')]=_0x126b6f['channel'];_0x1b7f50[_0x7823('0x28')][_0x7823('0x6c')]=_0x7823('0x6f');respondWithRpcPromise(_0x7823('0x6e'),_0x7823('0x6e'),{'event':_0x7823('0x77'),'message':_0x1b7f50['message']},client9002);return _0x126b6f;}return null;})[_0x7823('0x36')](respondWithResult(_0x178231,null))[_0x7823('0x2a')](handleError(_0x178231,null));};exports[_0x7823('0x2c')]=function(_0x34c193,_0x52109e,_0x46b92f){if(_0x34c193['body']['id']){delete _0x34c193[_0x7823('0x57')]['id'];}var _0x42d555;return db[_0x7823('0x3c')][_0x7823('0x55')]({'where':{'id':_0x34c193[_0x7823('0x52')]['id']}})[_0x7823('0x36')](handleEntityNotFound(_0x52109e,null))[_0x7823('0x36')](function(_0x21cc4f){if(_0x21cc4f){_0x42d555=_0x21cc4f;return db['SmsAccount'][_0x7823('0x55')]({'where':{'id':_0x21cc4f['SmsAccountId']}});}})[_0x7823('0x36')](handleEntityNotFound(_0x52109e,null))[_0x7823('0x36')](function(_0x1d3163){if(_0x1d3163){logger[_0x7823('0x24')](_0x7823('0x78'),_0x7823('0x2c'),'received\x20delivery\x20report\x20from',_0x1d3163[_0x7823('0x3f')],util[_0x7823('0x79')](_0x34c193[_0x7823('0x57')],{'showHidden':![],'depth':null}));switch(_0x1d3163[_0x7823('0x3f')]){case'twilio':if(_0x34c193[_0x7823('0x57')]['MessageSid']&&_0x34c193[_0x7823('0x57')][_0x7823('0x7a')]===_0x42d555[_0x7823('0x7b')]){return _0x42d555[_0x7823('0x35')]({'read':!![]});}else{logger[_0x7823('0x26')](_0x7823('0x7c'),_0x7823('0x2c'),_0x7823('0x7d'),util['inspect'](_0x34c193[_0x7823('0x57')],{'showHidden':![],'depth':null}));}break;case _0x7823('0x7e'):if(_0x34c193[_0x7823('0x57')]['MessageUUID']&&_0x34c193['body']['MessageUUID']===_0x42d555[_0x7823('0x7b')]&&_['indexOf']([_0x7823('0x7f'),_0x7823('0x80')],_0x34c193['body'][_0x7823('0x81')])>=0x0){return _0x42d555[_0x7823('0x35')]({'read':!![]});}else{logger['error'](_0x7823('0x7c'),'status',_0x7823('0x82'),util[_0x7823('0x79')](_0x34c193[_0x7823('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x545d3c=_0x34c193['body'][_0x7823('0x83')][0x0];if(_0x545d3c['status']['groupName']===_0x7823('0x84')){return _0x42d555['update']({'read':!![]});}else{logger[_0x7823('0x26')](_0x7823('0x7c'),_0x7823('0x2c'),'infobip',util[_0x7823('0x79')](_0x34c193[_0x7823('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x42d555;}})[_0x7823('0x36')](respondWithResult(_0x52109e,null))[_0x7823('0x2a')](handleError(_0x52109e,null));}; \ No newline at end of file +var _0x6403=['groupName','DELIVERED','infobip','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','client','http','request','then','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','rows','show','keys','length','create','body','update','params','find','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','SIP/%s','channel','event','EventManager','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','SmsAccount','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio'];(function(_0x3b5f66,_0x1dbfc5){var _0x4aa1a8=function(_0x57c05c){while(--_0x57c05c){_0x3b5f66['push'](_0x3b5f66['shift']());}};_0x4aa1a8(++_0x1dbfc5);}(_0x6403,0x1a1));var _0x3640=function(_0x5dda34,_0x4547c3){_0x5dda34=_0x5dda34-0x0;var _0x40ba81=_0x6403[_0x5dda34];return _0x40ba81;};'use strict';var pdf=require(_0x3640('0x0'));var emlformat=require(_0x3640('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3640('0x2'));var jsonpatch=require(_0x3640('0x3'));var rp=require(_0x3640('0x4'));var moment=require('moment');var BPromise=require(_0x3640('0x5'));var Mustache=require('mustache');var util=require(_0x3640('0x6'));var path=require(_0x3640('0x7'));var sox=require(_0x3640('0x8'));var csv=require(_0x3640('0x9'));var ejs=require(_0x3640('0xa'));var fs=require('fs');var _=require(_0x3640('0xb'));var squel=require(_0x3640('0xc'));var crypto=require(_0x3640('0xd'));var jsforce=require(_0x3640('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3640('0x9'));var querystring=require(_0x3640('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3640('0x10'));var qs=require(_0x3640('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3640('0x12'));var logger=require(_0x3640('0x13'))(_0x3640('0x14'));var utils=require(_0x3640('0x15'));var config=require(_0x3640('0x16'));var licenseUtil=require(_0x3640('0x17'));var db=require(_0x3640('0x18'))['db'];config[_0x3640('0x19')]=_[_0x3640('0x1a')](config[_0x3640('0x19')],{'host':_0x3640('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x3640('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3640('0x1d')][_0x3640('0x1e')]({'port':0x232c});var client9002=jayson[_0x3640('0x1d')][_0x3640('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4d953d,_0x24e813,_0x1c447a,_0x2098be){return new BPromise(function(_0x17ecca,_0x465c93){var _0x1d09ff=_0x2098be||client;return _0x1d09ff[_0x3640('0x1f')](_0x4d953d,_0x1c447a)[_0x3640('0x20')](function(_0x12ce3c){logger['info'](_0x3640('0x21'),_0x24e813,'request\x20sent');logger['debug'](_0x3640('0x22'),_0x24e813,_0x3640('0x23'),JSON[_0x3640('0x24')](_0x12ce3c));if(_0x12ce3c[_0x3640('0x25')]){if(_0x12ce3c['error'][_0x3640('0x26')]===0x1f4){logger[_0x3640('0x25')]('SmsMessage,\x20%s,\x20%s',_0x24e813,_0x12ce3c[_0x3640('0x25')][_0x3640('0x27')]);return _0x465c93(_0x12ce3c[_0x3640('0x25')]['message']);}logger[_0x3640('0x25')](_0x3640('0x21'),_0x24e813,_0x12ce3c[_0x3640('0x25')][_0x3640('0x27')]);return _0x17ecca(_0x12ce3c[_0x3640('0x25')][_0x3640('0x27')]);}else{logger['info'](_0x3640('0x21'),_0x24e813,_0x3640('0x23'));_0x17ecca(_0x12ce3c[_0x3640('0x28')]['message']);}})[_0x3640('0x29')](function(_0x3b6daa){logger[_0x3640('0x25')](_0x3640('0x21'),_0x24e813,_0x3b6daa);_0x465c93(_0x3b6daa);});});}function respondWithStatusCode(_0x929f69,_0x134545){_0x134545=_0x134545||0xcc;return function(_0x4a5083){if(_0x4a5083){return _0x929f69[_0x3640('0x2a')](_0x134545);}return _0x929f69[_0x3640('0x2b')](_0x134545)['end']();};}function respondWithResult(_0x5e0dd3,_0x1786b6){_0x1786b6=_0x1786b6||0xc8;return function(_0xf6946d){if(_0xf6946d){return _0x5e0dd3[_0x3640('0x2b')](_0x1786b6)['json'](_0xf6946d);}};}function respondWithFilteredResult(_0x3d6f15,_0x3f7a37){return function(_0x2ee685){if(_0x2ee685){var _0x1f2796=_0x2ee685[_0x3640('0x2c')],_0x5349d9=_0x3f7a37[_0x3640('0x2d')],_0x5e4329=_0x3f7a37[_0x3640('0x2d')]+_0x3f7a37['limit'],_0x572a22;if(_0x5e4329>=_0x1f2796){_0x5e4329=_0x1f2796;_0x572a22=0xc8;}else{_0x572a22=0xce;}_0x3d6f15[_0x3640('0x2b')](_0x572a22);return _0x3d6f15[_0x3640('0x2e')](_0x3640('0x2f'),_0x5349d9+'-'+_0x5e4329+'/'+_0x1f2796)[_0x3640('0x30')](_0x2ee685);}return null;};}function patchUpdates(_0x119d8f){return function(_0x273cd4){try{jsonpatch[_0x3640('0x31')](_0x273cd4,_0x119d8f,!![]);}catch(_0x5edd37){return BPromise[_0x3640('0x32')](_0x5edd37);}return _0x273cd4['save']();};}function saveUpdates(_0xab621e,_0x319df8){return function(_0x3f6cee){if(_0x3f6cee){return _0x3f6cee['update'](_0xab621e)[_0x3640('0x20')](function(_0x47bd48){return _0x47bd48;});}return null;};}function removeEntity(_0x46e669,_0x2d4e03){return function(_0x446938){if(_0x446938){return _0x446938[_0x3640('0x33')]()[_0x3640('0x20')](function(){_0x46e669[_0x3640('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2199ed,_0x2dc5fc){return function(_0x1998ee){if(!_0x1998ee){_0x2199ed[_0x3640('0x2a')](0x194);}return _0x1998ee;};}function handleError(_0x499d73,_0x5472cb){_0x5472cb=_0x5472cb||0x1f4;return function(_0x17104d){logger[_0x3640('0x25')](_0x17104d[_0x3640('0x34')]);if(_0x17104d[_0x3640('0x35')]){delete _0x17104d[_0x3640('0x35')];}_0x499d73['status'](_0x5472cb)[_0x3640('0x36')](_0x17104d);};}exports[_0x3640('0x37')]=function(_0x592cf7,_0x4eb263){var _0x5c96e4={},_0x269b4e={},_0x765546={'count':0x0,'rows':[]};var _0x55218a=_[_0x3640('0x38')](db['SmsMessage'][_0x3640('0x39')],function(_0x4f2531){return{'name':_0x4f2531[_0x3640('0x3a')],'type':_0x4f2531[_0x3640('0x3b')][_0x3640('0x3c')]};});_0x269b4e[_0x3640('0x3d')]=_[_0x3640('0x38')](_0x55218a,_0x3640('0x35'));_0x269b4e[_0x3640('0x3e')]=_['keys'](_0x592cf7[_0x3640('0x3e')]);_0x269b4e[_0x3640('0x3f')]=_['intersection'](_0x269b4e[_0x3640('0x3d')],_0x269b4e[_0x3640('0x3e')]);_0x5c96e4[_0x3640('0x40')]=_[_0x3640('0x41')](_0x269b4e[_0x3640('0x3d')],qs['fields'](_0x592cf7[_0x3640('0x3e')][_0x3640('0x42')]));_0x5c96e4[_0x3640('0x40')]=_0x5c96e4[_0x3640('0x40')]['length']?_0x5c96e4[_0x3640('0x40')]:_0x269b4e[_0x3640('0x3d')];if(!_0x592cf7[_0x3640('0x3e')]['hasOwnProperty'](_0x3640('0x43'))){_0x5c96e4[_0x3640('0x44')]=qs[_0x3640('0x44')](_0x592cf7['query'][_0x3640('0x44')]);_0x5c96e4[_0x3640('0x2d')]=qs[_0x3640('0x2d')](_0x592cf7[_0x3640('0x3e')]['offset']);}_0x5c96e4['order']=qs[_0x3640('0x45')](_0x592cf7['query'][_0x3640('0x45')]);_0x5c96e4[_0x3640('0x46')]=qs[_0x3640('0x3f')](_[_0x3640('0x47')](_0x592cf7['query'],_0x269b4e[_0x3640('0x3f')]),_0x55218a);if(_0x592cf7[_0x3640('0x3e')][_0x3640('0x48')]){_0x5c96e4['where']=_[_0x3640('0x49')](_0x5c96e4[_0x3640('0x46')],{'$or':_['map'](_0x55218a,function(_0x107a03){if(_0x107a03[_0x3640('0x3b')]!==_0x3640('0x4a')){var _0x488908={};_0x488908[_0x107a03['name']]={'$like':'%'+_0x592cf7['query'][_0x3640('0x48')]+'%'};return _0x488908;}})});}_0x5c96e4=_[_0x3640('0x49')]({},_0x5c96e4,_0x592cf7[_0x3640('0x4b')]);var _0x129655={'where':_0x5c96e4[_0x3640('0x46')]};return db[_0x3640('0x4c')][_0x3640('0x2c')](_0x129655)[_0x3640('0x20')](function(_0xb8f126){_0x765546[_0x3640('0x2c')]=_0xb8f126;if(_0x592cf7['query'][_0x3640('0x4d')]){_0x5c96e4[_0x3640('0x4e')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x5c96e4);})[_0x3640('0x20')](function(_0x185a2b){_0x765546[_0x3640('0x4f')]=_0x185a2b;return _0x765546;})['then'](respondWithFilteredResult(_0x4eb263,_0x5c96e4))[_0x3640('0x29')](handleError(_0x4eb263,null));};exports[_0x3640('0x50')]=function(_0x48522e,_0x404b69){var _0x4ed6bb={'raw':!![],'where':{'id':_0x48522e['params']['id']}},_0x199630={};_0x199630[_0x3640('0x3d')]=_[_0x3640('0x51')](db[_0x3640('0x4c')][_0x3640('0x39')]);_0x199630['query']=_[_0x3640('0x51')](_0x48522e['query']);_0x199630[_0x3640('0x3f')]=_[_0x3640('0x41')](_0x199630[_0x3640('0x3d')],_0x199630['query']);_0x4ed6bb[_0x3640('0x40')]=_[_0x3640('0x41')](_0x199630[_0x3640('0x3d')],qs['fields'](_0x48522e[_0x3640('0x3e')][_0x3640('0x42')]));_0x4ed6bb['attributes']=_0x4ed6bb[_0x3640('0x40')][_0x3640('0x52')]?_0x4ed6bb[_0x3640('0x40')]:_0x199630[_0x3640('0x3d')];if(_0x48522e[_0x3640('0x3e')][_0x3640('0x4d')]){_0x4ed6bb[_0x3640('0x4e')]=[{'all':!![]}];}_0x4ed6bb=_['merge']({},_0x4ed6bb,_0x48522e[_0x3640('0x4b')]);return db['SmsMessage']['find'](_0x4ed6bb)[_0x3640('0x20')](handleEntityNotFound(_0x404b69,null))[_0x3640('0x20')](respondWithResult(_0x404b69,null))[_0x3640('0x29')](handleError(_0x404b69,null));};exports[_0x3640('0x53')]=function(_0x3f09a9,_0x3d38d4){return db[_0x3640('0x4c')][_0x3640('0x53')](_0x3f09a9[_0x3640('0x54')],{})[_0x3640('0x20')](respondWithResult(_0x3d38d4,0xc9))[_0x3640('0x29')](handleError(_0x3d38d4,null));};exports[_0x3640('0x55')]=function(_0x2f7f58,_0x207c0b){if(_0x2f7f58[_0x3640('0x54')]['id']){delete _0x2f7f58[_0x3640('0x54')]['id'];}return db[_0x3640('0x4c')]['find']({'where':{'id':_0x2f7f58[_0x3640('0x56')]['id']}})['then'](handleEntityNotFound(_0x207c0b,null))[_0x3640('0x20')](saveUpdates(_0x2f7f58[_0x3640('0x54')],null))[_0x3640('0x20')](respondWithResult(_0x207c0b,null))[_0x3640('0x29')](handleError(_0x207c0b,null));};exports['destroy']=function(_0x358416,_0x35025d){return db[_0x3640('0x4c')][_0x3640('0x57')]({'where':{'id':_0x358416[_0x3640('0x56')]['id']}})['then'](handleEntityNotFound(_0x35025d,null))[_0x3640('0x20')](removeEntity(_0x35025d,null))[_0x3640('0x29')](handleError(_0x35025d,null));};exports[_0x3640('0x58')]=function(_0x414202,_0x2b0ebe){return db['SmsMessage']['describe']()[_0x3640('0x20')](respondWithResult(_0x2b0ebe,null))[_0x3640('0x29')](handleError(_0x2b0ebe,null));};var interaction_log=require('../../config/logger')(_0x3640('0x59'));exports[_0x3640('0x5a')]=function(_0x39ec3c,_0x461e93,_0x500007){var _0x2877e0={'agent':{},'channel':'sms'};if(_0x39ec3c[_0x3640('0x54')]['id']){delete _0x39ec3c[_0x3640('0x54')]['id'];}_0x39ec3c[_0x3640('0x54')][_0x3640('0x5b')]=!![];_0x39ec3c[_0x3640('0x54')][_0x3640('0x5c')]=moment()[_0x3640('0x5d')](_0x3640('0x5e'));_0x39ec3c[_0x3640('0x54')][_0x3640('0x5f')]=_0x39ec3c[_0x3640('0x54')][_0x3640('0x5f')]||_0x39ec3c[_0x3640('0x60')]['id'];_0x2877e0['agent']['id']=_0x39ec3c[_0x3640('0x54')][_0x3640('0x5f')];return db['SmsMessage'][_0x3640('0x57')]({'where':{'id':_0x39ec3c['params']['id'],'UserId':null},'include':[{'model':db[_0x3640('0x61')],'as':_0x3640('0x62')}]})[_0x3640('0x20')](handleEntityNotFound(_0x461e93,null))['then'](saveUpdates(_0x39ec3c[_0x3640('0x54')],null))[_0x3640('0x20')](function(_0x3b1e34){if(_0x3b1e34){_0x2877e0[_0x3640('0x27')]=_0x3b1e34[_0x3640('0x63')]({'plain':!![]});return db[_0x3640('0x64')][_0x3640('0x57')]({'where':{'id':_0x3b1e34[_0x3640('0x65')]}});}return null;})[_0x3640('0x20')](handleEntityNotFound(_0x461e93,null))['then'](function(_0x98ae8f){if(_0x98ae8f){return _0x98ae8f[_0x3640('0x55')]({'UserId':_0x39ec3c[_0x3640('0x54')][_0x3640('0x5f')],'read1stAt':_[_0x3640('0x66')](_0x98ae8f[_0x3640('0x67')])?moment()[_0x3640('0x5d')](_0x3640('0x5e')):undefined});}return null;})[_0x3640('0x20')](function(_0x115433){if(_0x115433){_0x2877e0[_0x3640('0x68')]=_0x115433[_0x3640('0x63')]({'plain':!![]});interaction_log[_0x3640('0x69')](_0x3640('0x6a'),_0x39ec3c[_0x3640('0x60')]['id'],_0x39ec3c[_0x3640('0x60')][_0x3640('0x35')],_0x39ec3c[_0x3640('0x60')][_0x3640('0x6b')],_0x2877e0[_0x3640('0x68')]['id'],_0x39ec3c['body']?JSON[_0x3640('0x24')](_0x39ec3c[_0x3640('0x54')]):_0x3640('0x6c'));return respondWithRpcPromise(_0x3640('0x6d'),'acceptMessage',_0x2877e0);}return null;})[_0x3640('0x20')](function(_0x54eee4){if(_0x54eee4){if(_0x39ec3c[_0x3640('0x54')][_0x3640('0x6e')]){_0x2877e0[_0x3640('0x27')]['interface']=util[_0x3640('0x5d')](_0x3640('0x6f'),_0x39ec3c[_0x3640('0x60')][_0x3640('0x35')]);_0x2877e0['message'][_0x3640('0x70')]=_0x2877e0['channel'];_0x2877e0[_0x3640('0x27')][_0x3640('0x71')]=_0x3640('0x5a');return respondWithRpcPromise(_0x3640('0x72'),_0x3640('0x72'),{'event':'acceptmessage','message':_0x2877e0['message']},client9002)[_0x3640('0x20')](function(){return _0x2877e0;});}return _0x2877e0;}return null;})['then'](respondWithResult(_0x461e93,null))['catch'](handleError(_0x461e93,null));};var interaction_log=require(_0x3640('0x13'))(_0x3640('0x59'));exports['reject']=function(_0x3d4de9,_0x9c0ab2,_0x3aeb61){var _0x8edca={'agent':{},'channel':_0x3640('0x73')};if(_0x3d4de9[_0x3640('0x54')]['id']){delete _0x3d4de9[_0x3640('0x54')]['id'];}_0x3d4de9[_0x3640('0x54')][_0x3640('0x5f')]=_0x3d4de9[_0x3640('0x54')]['UserId']||_0x3d4de9['user']['id'];_0x8edca['agent']['id']=_0x3d4de9[_0x3640('0x54')][_0x3640('0x5f')];return db[_0x3640('0x4c')][_0x3640('0x57')]({'where':{'id':_0x3d4de9[_0x3640('0x56')]['id'],'UserId':null}})[_0x3640('0x20')](handleEntityNotFound(_0x9c0ab2,null))[_0x3640('0x20')](function(_0x554f02){if(_0x554f02){_0x8edca[_0x3640('0x27')]=_0x554f02['get']({'plain':!![]});return db[_0x3640('0x64')][_0x3640('0x57')]({'where':{'id':_0x554f02[_0x3640('0x65')]}});}return null;})[_0x3640('0x20')](handleEntityNotFound(_0x9c0ab2,null))[_0x3640('0x20')](function(_0x567e40){if(_0x567e40){_0x8edca[_0x3640('0x68')]=_0x567e40[_0x3640('0x63')]({'plain':!![]});interaction_log[_0x3640('0x69')](_0x3640('0x74'),_0x3d4de9['user']['id'],_0x3d4de9[_0x3640('0x60')][_0x3640('0x35')],_0x3d4de9['user']['role'],_0x8edca[_0x3640('0x68')]['id'],_0x3d4de9['body']?JSON['stringify'](_0x3d4de9[_0x3640('0x54')]):_0x3640('0x6c'));return respondWithRpcPromise(_0x3640('0x75'),_0x3640('0x76'),_0x8edca);}return null;})[_0x3640('0x20')](function(_0x6090e0){if(_0x6090e0){_0x6090e0[_0x3640('0x27')][_0x3640('0x77')]=util[_0x3640('0x5d')]('SIP/%s',_0x3d4de9[_0x3640('0x60')][_0x3640('0x35')]);_0x6090e0[_0x3640('0x27')][_0x3640('0x70')]=_0x8edca[_0x3640('0x70')];_0x6090e0['message'][_0x3640('0x71')]=_0x3640('0x32');respondWithRpcPromise(_0x3640('0x72'),_0x3640('0x72'),{'event':_0x3640('0x78'),'message':_0x6090e0[_0x3640('0x27')]},client9002);return _0x8edca;}return null;})[_0x3640('0x20')](respondWithResult(_0x9c0ab2,null))[_0x3640('0x29')](handleError(_0x9c0ab2,null));};exports[_0x3640('0x2b')]=function(_0x5679b2,_0x2c0ac2,_0x471080){if(_0x5679b2['body']['id']){delete _0x5679b2[_0x3640('0x54')]['id'];}var _0x34dc82;return db[_0x3640('0x4c')][_0x3640('0x57')]({'where':{'id':_0x5679b2[_0x3640('0x56')]['id']}})[_0x3640('0x20')](handleEntityNotFound(_0x2c0ac2,null))['then'](function(_0x4c9245){if(_0x4c9245){_0x34dc82=_0x4c9245;return db[_0x3640('0x79')]['find']({'where':{'id':_0x4c9245['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x2c0ac2,null))[_0x3640('0x20')](function(_0x53c201){if(_0x53c201){logger[_0x3640('0x7a')](_0x3640('0x22'),'status',_0x3640('0x7b'),_0x53c201['type'],util[_0x3640('0x7c')](_0x5679b2[_0x3640('0x54')],{'showHidden':![],'depth':null}));switch(_0x53c201[_0x3640('0x3b')]){case _0x3640('0x7d'):if(_0x5679b2[_0x3640('0x54')]['MessageSid']&&_0x5679b2[_0x3640('0x54')][_0x3640('0x7e')]===_0x34dc82[_0x3640('0x7f')]){return _0x34dc82[_0x3640('0x55')]({'read':!![]});}else{logger[_0x3640('0x25')](_0x3640('0x80'),_0x3640('0x2b'),_0x3640('0x7d'),util[_0x3640('0x7c')](_0x5679b2[_0x3640('0x54')],{'showHidden':![],'depth':null}));}break;case _0x3640('0x81'):if(_0x5679b2[_0x3640('0x54')]['MessageUUID']&&_0x5679b2[_0x3640('0x54')][_0x3640('0x82')]===_0x34dc82[_0x3640('0x7f')]&&_[_0x3640('0x83')]([_0x3640('0x84'),_0x3640('0x85')],_0x5679b2[_0x3640('0x54')]['Status'])>=0x0){return _0x34dc82[_0x3640('0x55')]({'read':!![]});}else{logger[_0x3640('0x25')](_0x3640('0x80'),_0x3640('0x2b'),_0x3640('0x86'),util['inspect'](_0x5679b2[_0x3640('0x54')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1f5b3d=_0x5679b2[_0x3640('0x54')]['results'][0x0];if(_0x1f5b3d[_0x3640('0x2b')][_0x3640('0x87')]===_0x3640('0x88')){return _0x34dc82[_0x3640('0x55')]({'read':!![]});}else{logger[_0x3640('0x25')](_0x3640('0x80'),_0x3640('0x2b'),_0x3640('0x89'),util[_0x3640('0x7c')](_0x5679b2[_0x3640('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x34dc82;}})[_0x3640('0x20')](respondWithResult(_0x2c0ac2,null))['catch'](handleError(_0x2c0ac2,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 0432a90..2e3b643 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 _0x6ba0=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x1fbe59,_0x45dd45){var _0x315b32=function(_0x403fe){while(--_0x403fe){_0x1fbe59['push'](_0x1fbe59['shift']());}};_0x315b32(++_0x45dd45);}(_0x6ba0,0x1c6));var _0x06ba=function(_0x1f4624,_0x311a09){_0x1f4624=_0x1f4624-0x0;var _0x106d96=_0x6ba0[_0x1f4624];return _0x106d96;};'use strict';var EventEmitter=require(_0x06ba('0x0'));var SmsMessage=require(_0x06ba('0x1'))['db'][_0x06ba('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x06ba('0x3')](0x0);var events={'afterCreate':_0x06ba('0x4'),'afterUpdate':_0x06ba('0x5'),'afterDestroy':_0x06ba('0x6')};function emitEvent(_0x74bde6){return function(_0x2202e5,_0x266a71,_0x56e77d){SmsMessageEvents[_0x06ba('0x7')](_0x74bde6+':'+_0x2202e5['id'],_0x2202e5);SmsMessageEvents[_0x06ba('0x7')](_0x74bde6,_0x2202e5);_0x56e77d(null);};}for(var e in events){if(events[_0x06ba('0x8')](e)){var event=events[e];SmsMessage[_0x06ba('0x9')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x9d87=['../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x278cfd,_0x2a1d92){var _0x253ba2=function(_0x206641){while(--_0x206641){_0x278cfd['push'](_0x278cfd['shift']());}};_0x253ba2(++_0x2a1d92);}(_0x9d87,0x16a));var _0x79d8=function(_0x361b34,_0x257826){_0x361b34=_0x361b34-0x0;var _0x19b72c=_0x9d87[_0x361b34];return _0x19b72c;};'use strict';var EventEmitter=require(_0x79d8('0x0'));var SmsMessage=require(_0x79d8('0x1'))['db'][_0x79d8('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x79d8('0x3')](0x0);var events={'afterCreate':_0x79d8('0x4'),'afterUpdate':_0x79d8('0x5'),'afterDestroy':_0x79d8('0x6')};function emitEvent(_0x2cb51f){return function(_0x1a47e4,_0x33fe44,_0x10fcc8){SmsMessageEvents[_0x79d8('0x7')](_0x2cb51f+':'+_0x1a47e4['id'],_0x1a47e4);SmsMessageEvents['emit'](_0x2cb51f,_0x1a47e4);_0x10fcc8(null);};}for(var e in events){if(events[_0x79d8('0x8')](e)){var event=events[e];SmsMessage[_0x79d8('0x9')](e,emitEvent(event));}}module[_0x79d8('0xa')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 9c9e18f..b938fd1 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 _0xce96=['afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','username','password','GET','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/v2/send/','connectel','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','head','messages','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','/auth/1/session','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','csc','apiKey','timestamp','keys','sort','length','createHash','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','out','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','create','phone','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x283de3,_0x24039c){var _0x29d4ec=function(_0x4eeaf8){while(--_0x4eeaf8){_0x283de3['push'](_0x283de3['shift']());}};_0x29d4ec(++_0x24039c);}(_0xce96,0x1af));var _0x6ce9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xce96[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x6ce9('0x0'));var util=require(_0x6ce9('0x1'));var logger=require(_0x6ce9('0x2'))(_0x6ce9('0x3'));var moment=require('moment');var BPromise=require(_0x6ce9('0x4'));var rp=require(_0x6ce9('0x5'));var fs=require('fs');var path=require(_0x6ce9('0x6'));var rimraf=require('rimraf');var config=require(_0x6ce9('0x7'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x22292b,_0x32f778){return _0x22292b[_0x6ce9('0x8')](_0x6ce9('0x9'),attributes,{'tableName':_0x6ce9('0xa'),'paranoid':![],'indexes':[{'name':_0x6ce9('0xb'),'fields':[_0x6ce9('0xb')]},{'name':_0x6ce9('0xc'),'fields':[_0x6ce9('0xd')],'type':_0x6ce9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x30d799,_0x508179,_0x39b0c5){var _0x1609a4=_0x22292b[_0x6ce9('0xf')];var _0x52acc3=_0x30d799[_0x6ce9('0x10')]({'plain':!![]});if(_0x52acc3[_0x6ce9('0x11')]['toLowerCase']()==='in'||_0x52acc3[_0x6ce9('0x11')]['toLowerCase']()===_0x6ce9('0x12')&&!_0x52acc3['secret']&&!_['isNil'](_0x52acc3[_0x6ce9('0x13')])){_0x1609a4[_0x6ce9('0x14')][_0x6ce9('0x15')]({'where':{'id':_0x52acc3[_0x6ce9('0x16')]}})[_0x6ce9('0x17')](function(_0x4d0c7b){if(_0x4d0c7b){_0x4d0c7b[_0x6ce9('0x18')]({'lastMsgAt':_0x52acc3['createdAt'],'lastMsgDirection':_0x52acc3[_0x6ce9('0x11')]['toLowerCase']()});}})[_0x6ce9('0x19')](function(_0x29944e){console[_0x6ce9('0x1a')](_0x29944e);});}if(_0x52acc3[_0x6ce9('0x11')]===_0x6ce9('0x12')&&!_0x52acc3['secret']){var _0x3e8311;_0x1609a4[_0x6ce9('0x1b')][_0x6ce9('0x1c')]({'where':{'id':_0x52acc3[_0x6ce9('0x1d')]},'raw':!![]})[_0x6ce9('0x17')](function(_0xbefa74){_0x3e8311=_0xbefa74;if(_0x3e8311&&_0x3e8311[_0x6ce9('0x1e')]){switch(_0x3e8311[_0x6ce9('0x1e')]){case _0x6ce9('0x1f'):var _0x5ce025=require('twilio');if(_0x3e8311[_0x6ce9('0x20')]&&_0x3e8311['authToken']&&_0x3e8311['phone']){var _0x283dc8=new _0x5ce025(_0x3e8311[_0x6ce9('0x20')],_0x3e8311[_0x6ce9('0x21')]);_0x283dc8['messages'][_0x6ce9('0x22')]({'body':_0x52acc3[_0x6ce9('0xd')],'to':_0x52acc3[_0x6ce9('0x23')],'from':_0x3e8311[_0x6ce9('0x23')],'statusCallback':_0x3e8311[_0x6ce9('0x24')]+_0x6ce9('0x25')+_0x52acc3['id']+'/status?token='+_0x3e8311[_0x6ce9('0x26')]})[_0x6ce9('0x17')](function(_0x10c03e){if(_0x10c03e['sid']){return _0x30d799[_0x6ce9('0x18')]({'messageId':_0x10c03e[_0x6ce9('0x27')]});}})[_0x6ce9('0x19')](function(_0x406072){logger['error'](_0x6ce9('0x28'),_0x6ce9('0x29'),'twilio',util['inspect'](_0x406072,{'showHidden':![],'depth':null}));});}else{logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),_0x6ce9('0x1f'),_0x6ce9('0x2a'));}break;case _0x6ce9('0x2b'):var _0x450694=_0x6ce9('0x2c');if(_0x3e8311['username']&&_0x3e8311['password']){var _0x45f583={'recipient':[_0x52acc3[_0x6ce9('0x23')]],'message':_0x52acc3['body'],'message_type':_0x3e8311[_0x6ce9('0x2d')]};if(_0x3e8311[_0x6ce9('0x2d')]&&_0x3e8311['smsMethod']!=='SI'){_0x45f583[_0x6ce9('0x2e')]=_0x3e8311[_0x6ce9('0x23')];}var _0x4dd177={'url':_0x450694+'login?username='+_0x3e8311[_0x6ce9('0x2f')]+'&password='+_0x3e8311[_0x6ce9('0x30')],'method':_0x6ce9('0x31')};rp(_0x4dd177)[_0x6ce9('0x17')](function(_0x4dd723){var _0x47309f=_0x4dd723['split'](';');var _0x1e5fe3={'user_key':_0x47309f[0x0],'session_key':_0x47309f[0x1]};_0x4dd177={'url':_0x450694+_0x6ce9('0x32'),'method':_0x6ce9('0x33'),'headers':{'user_key':_0x1e5fe3[_0x6ce9('0x34')],'Session_key':_0x1e5fe3[_0x6ce9('0x35')]},'json':!![],'body':_0x45f583};return rp(_0x4dd177);})[_0x6ce9('0x17')](function(_0x2edad9){if(_0x2edad9['total_sent']>=0x1){var _0x468449={'messageId':_0x2edad9[_0x6ce9('0x36')]};if(_0x3e8311[_0x6ce9('0x2d')]!=='GP'||!_0x3e8311[_0x6ce9('0x37')]){_0x468449[_0x6ce9('0x38')]=!![];}return _0x30d799[_0x6ce9('0x18')](_0x468449);}else{return logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),_0x6ce9('0x2b'),util[_0x6ce9('0x39')](_0x2edad9,{'showHidden':![],'depth':null}));}})[_0x6ce9('0x19')](function(_0x46c3ee){return logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),'skebby',util['inspect'](_0x46c3ee,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6ce9('0x28'),_0x6ce9('0x29'),_0x6ce9('0x2b'),_0x6ce9('0x3a'));}break;case'connectel':if(_0x3e8311[_0x6ce9('0x21')]){var _0x2d3c5a={'recipient':_0x52acc3[_0x6ce9('0x23')],'message':_0x52acc3[_0x6ce9('0xd')],'sender':_0x3e8311['senderString']||_0x3e8311[_0x6ce9('0x23')],'authorization':_0x3e8311[_0x6ce9('0x21')]};var _0x508179={'method':_0x6ce9('0x33'),'uri':_0x6ce9('0x3b'),'body':_0x2d3c5a,'json':!![]};rp(_0x508179)[_0x6ce9('0x17')](function(_0x528a41){var _0x51f7a9={'messageId':_0x528a41['requestid']};if(!_0x3e8311['deliveryReport']){_0x51f7a9[_0x6ce9('0x38')]=!![];}return _0x30d799[_0x6ce9('0x18')](_0x51f7a9);})['catch'](function(_0x46f4a6){logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),_0x6ce9('0x3c'),util[_0x6ce9('0x39')](_0x46f4a6,{'showHidden':![],'depth':null}));});}else{logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),_0x6ce9('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0x6ce9('0x3d'):if(_0x3e8311[_0x6ce9('0x2f')]&&_0x3e8311[_0x6ce9('0x30')]){var _0x2d3c5a={'messages':[{'source':_0x6ce9('0x3e'),'to':_0x52acc3['phone'],'body':_0x52acc3[_0x6ce9('0xd')],'from':_0x3e8311[_0x6ce9('0x3f')]||_0x3e8311[_0x6ce9('0x23')]}]};var _0x397e7d=util[_0x6ce9('0x40')](_0x6ce9('0x41'),_0x3e8311['username'],_0x3e8311[_0x6ce9('0x30')]);var _0x508179={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x2d3c5a,'headers':{'Authorization':util[_0x6ce9('0x40')](_0x6ce9('0x42'),new Buffer(_0x397e7d)[_0x6ce9('0x43')](_0x6ce9('0x44')))},'json':!![]};rp(_0x508179)[_0x6ce9('0x17')](function(_0x1676c7){if(_0x1676c7[_0x6ce9('0x45')]>=0xc8&&_0x1676c7[_0x6ce9('0x45')]<=0xce){if(_0x1676c7[_0x6ce9('0x46')]&&_0x1676c7['data']['queued_count']>0x0){var _0x577698=_[_0x6ce9('0x47')](_0x1676c7[_0x6ce9('0x46')][_0x6ce9('0x48')]);var _0x230e2f={'messageId':_0x577698[_0x6ce9('0x49')]};if(!_0x3e8311[_0x6ce9('0x37')]){_0x230e2f[_0x6ce9('0x38')]=!![];}return _0x30d799[_0x6ce9('0x18')](_0x230e2f);}else{logger[_0x6ce9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ce9('0x29'),_0x6ce9('0x4a'),util[_0x6ce9('0x39')](_0x1676c7,{'showHidden':![],'depth':null}));}}else{logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),_0x6ce9('0x4a'),util[_0x6ce9('0x39')](_0x1676c7,{'showHidden':![],'depth':null}));}})[_0x6ce9('0x19')](function(_0x240ca1){logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),_0x6ce9('0x4a'),util['inspect'](_0x240ca1,{'showHidden':![],'depth':null}));});}else{logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),'afterCreate','clickSend','Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x3e8311[_0x6ce9('0x4b')]&&_0x3e8311['authToken']){var _0x2d3c5a={'dst':_0x52acc3['phone'],'text':_0x52acc3[_0x6ce9('0xd')],'src':_0x3e8311['senderString']||_0x3e8311[_0x6ce9('0x23')],'url':_0x3e8311['remote']+'/api/sms/messages/'+_0x52acc3['id']+'/status?token='+_0x3e8311[_0x6ce9('0x26')]};var _0x397e7d=util[_0x6ce9('0x40')]('%s:%s',_0x3e8311['authId'],_0x3e8311['authToken']);var _0x508179={'method':_0x6ce9('0x33'),'uri':util[_0x6ce9('0x40')](_0x6ce9('0x4c'),_0x3e8311[_0x6ce9('0x4b')]),'body':_0x2d3c5a,'headers':{'Authorization':util[_0x6ce9('0x40')]('Basic\x20%s',new Buffer(_0x397e7d)[_0x6ce9('0x43')]('base64'))},'json':!![]};rp(_0x508179)[_0x6ce9('0x17')](function(_0x3c6b6d){var _0x4db3ec={'messageId':_0x3c6b6d[_0x6ce9('0x4d')][0x0]};return _0x30d799[_0x6ce9('0x18')](_0x4db3ec);})['catch'](function(_0x7c96cf){logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),'afterCreate','plivo',util[_0x6ce9('0x39')](_0x7c96cf,{'showHidden':![],'depth':null}));});}else{logger[_0x6ce9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ce9('0x29'),_0x6ce9('0x4e'),_0x6ce9('0x4f'));}break;case'infobip':if(_0x3e8311[_0x6ce9('0x2f')]&&_0x3e8311['password']){if(_0x3e8311['baseUrl']){var _0x5c29c7={'method':'POST','uri':_0x3e8311['baseUrl']+_0x6ce9('0x50'),'body':{'username':_0x3e8311[_0x6ce9('0x2f')],'password':_0x3e8311[_0x6ce9('0x30')]},'json':!![]};return rp(_0x5c29c7)['then'](function(_0x571f30){var _0x538311={'method':'POST','uri':_0x3e8311[_0x6ce9('0x51')]+_0x6ce9('0x52'),'body':{'messages':[{'from':_0x3e8311[_0x6ce9('0x23')],'destinations':[{'to':_0x52acc3[_0x6ce9('0x23')]}],'text':_0x52acc3[_0x6ce9('0xd')],'notifyUrl':_0x3e8311['remote']+_0x6ce9('0x25')+_0x52acc3['id']+'/status?token='+_0x3e8311['token'],'notifyContentType':_0x6ce9('0x53'),'callbackData':_0x3e8311[_0x6ce9('0x23')]+';'+_0x52acc3[_0x6ce9('0xd')]}]},'headers':{'Authorization':_0x6ce9('0x54')+_0x571f30[_0x6ce9('0x26')]},'json':!![]};return rp(_0x538311)[_0x6ce9('0x17')](function(_0x5c1bcd){if(_0x5c1bcd[_0x6ce9('0x48')]){var _0x3826a5={'messageId':_0x5c1bcd[_0x6ce9('0x48')][0x0][_0x6ce9('0xb')]};if(!_0x3e8311[_0x6ce9('0x37')]){_0x3826a5[_0x6ce9('0x38')]=!![];}return _0x30d799[_0x6ce9('0x18')](_0x3826a5);}else{return logger[_0x6ce9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ce9('0x29'),_0x6ce9('0x55'),util[_0x6ce9('0x39')](_0x5c1bcd,{'showHidden':![],'depth':null}));}});})[_0x6ce9('0x19')](function(_0x2ec963){return logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),_0x6ce9('0x55'),util[_0x6ce9('0x39')](_0x2ec963,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6ce9('0x28'),_0x6ce9('0x29'),_0x6ce9('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),'afterCreate',_0x6ce9('0x55'),_0x6ce9('0x3a'));}break;case _0x6ce9('0x56'):var _0xe10028=require('crypto');if(_0x3e8311[_0x6ce9('0x57')]){var _0x499d4a={};_0x499d4a['login']=_0x3e8311[_0x6ce9('0x2f')];_0x499d4a[_0x6ce9('0x23')]=_0x52acc3[_0x6ce9('0x23')];_0x499d4a[_0x6ce9('0x2e')]=_0x3e8311['phone'];_0x499d4a['text']=_0x52acc3[_0x6ce9('0xd')];_0x499d4a[_0x6ce9('0x58')]=+new Date();var _0x169cd3='';var _0x35abdc='';var _0x50d527=Object[_0x6ce9('0x59')](_0x499d4a);_0x50d527[_0x6ce9('0x5a')]();for(var _0x300701=0x0;_0x300701<_0x50d527[_0x6ce9('0x5b')];_0x300701++){if(_0x169cd3!=''){_0x169cd3+='&';}_0x169cd3+=_0x50d527[_0x300701]+'='+encodeURIComponent(_0x499d4a[_0x50d527[_0x300701]]);_0x35abdc+=_0x499d4a[_0x50d527[_0x300701]];}_0x35abdc+=_0x3e8311[_0x6ce9('0x57')];_0x35abdc=_0xe10028[_0x6ce9('0x5c')]('md5')[_0x6ce9('0x18')](_0x35abdc)[_0x6ce9('0x5d')](_0x6ce9('0x5e'));if(_0x169cd3!==''){_0x169cd3+='&';}_0x169cd3+=_0x6ce9('0x5f')+_0x35abdc;var _0x4dd177={'method':'GET','uri':_0x3e8311[_0x6ce9('0x51')]+_0x6ce9('0x60')+_0x169cd3,'json':!![]};return rp(_0x4dd177)[_0x6ce9('0x17')](function(_0x41356e){var _0x125315=Object[_0x6ce9('0x59')](_0x41356e);if(_0x41356e[_0x125315[0x0]]['error']&&parseInt(_0x41356e[_0x125315[0x0]][_0x6ce9('0x1a')])===0x0){var _0xe451fc={'messageId':_0x41356e[_0x125315[0x0]][_0x6ce9('0x61')]};if(!_0x3e8311['deliveryReport']){_0xe451fc['read']=!![];}return _0x30d799['update'](_0xe451fc);}else{return logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),_0x6ce9('0x56'),util[_0x6ce9('0x39')](_0x41356e[_0x6ce9('0x1a')],{'showHidden':![],'depth':null}));}})[_0x6ce9('0x19')](function(_0x40afea){return logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),'afterCreate',_0x6ce9('0x56'),util['inspect'](_0x40afea,{'showHidden':![],'depth':null}));});}else{logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),'afterCreate',_0x6ce9('0x56'),_0x6ce9('0x62'));}break;case _0x6ce9('0x63'):if(_0x3e8311[_0x6ce9('0x57')]){var _0x2c5e26={'method':'POST','uri':_0x6ce9('0x64'),'headers':{'Authorization':_0x3e8311[_0x6ce9('0x57')]},'body':{'content':_0x52acc3[_0x6ce9('0xd')],'to':[_0x52acc3[_0x6ce9('0x23')]],'from':_0x3e8311['phone'],'binary':![],'clientMessageId':_0x6ce9('0x65'),'charset':_0x6ce9('0x66')},'json':!![]};rp(_0x2c5e26)[_0x6ce9('0x17')](function(_0x16e09e){if(!_0x16e09e['error']){var _0x204c54={'messageId':_0x16e09e[_0x6ce9('0x48')][0x0]['apiMessageId']};if(!_0x3e8311[_0x6ce9('0x37')]){_0x204c54[_0x6ce9('0x38')]=!![];}return _0x30d799[_0x6ce9('0x18')](_0x204c54);}else{return logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),'clickatell',util[_0x6ce9('0x39')](_0x16e09e['error'],{'showHidden':![],'depth':null}));}})[_0x6ce9('0x19')](function(_0x5cb8c8){return logger[_0x6ce9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ce9('0x29'),_0x6ce9('0x63'),util['inspect'](_0x5cb8c8,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',_0x6ce9('0x62'));}break;case _0x6ce9('0x67'):if(_0x3e8311[_0x6ce9('0x2f')]&&_0x3e8311['password']){var _0x397e7d=util[_0x6ce9('0x40')]('%s:%s',_0x3e8311['username'],_0x3e8311[_0x6ce9('0x30')]);var _0x508179={'method':_0x6ce9('0x33'),'uri':_0x6ce9('0x68')+_0x3e8311[_0x6ce9('0x69')]+_0x6ce9('0x6a'),'body':{'to':[_0x52acc3['phone']],'text':_0x52acc3[_0x6ce9('0xd')],'from':_0x3e8311['phone'],'applicationId':_0x3e8311[_0x6ce9('0x6b')]},'headers':{'Authorization':util['format'](_0x6ce9('0x42'),new Buffer(_0x397e7d)[_0x6ce9('0x43')](_0x6ce9('0x44')))},'json':!![]};rp(_0x508179)[_0x6ce9('0x17')](function(_0x115425){if(_0x115425['id']){var _0x2def3d={'messageId':_0x115425['id']};return _0x30d799[_0x6ce9('0x18')](_0x2def3d);}else{logger[_0x6ce9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ce9('0x29'),_0x6ce9('0x67'),util[_0x6ce9('0x39')](_0x115425,{'showHidden':![],'depth':null}));}})[_0x6ce9('0x19')](function(_0x27f962){logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),_0x6ce9('0x67'),util['inspect'](_0x27f962,{'showHidden':![],'depth':null}));});}else{logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),'bandwidth',_0x6ce9('0x3a'));}break;case _0x6ce9('0x6c'):if(_0x3e8311[_0x6ce9('0x57')]){var _0x5d88d5={};var _0x4dd177={'method':'POST','uri':_0x6ce9('0x6d'),'headers':{'Authorization':_0x6ce9('0x6e')+_0x3e8311[_0x6ce9('0x57')],'Content-Type':_0x6ce9('0x53')},'body':{'from':_0x3e8311['phone'],'to':_0x52acc3[_0x6ce9('0x23')],'text':_0x52acc3['body']},'json':!![]};return rp(_0x4dd177)['then'](function(_0xc926a4){if(_0xc926a4['code']==0xca){_0x5d88d5[_0x6ce9('0x6f')]=_0xc926a4;var _0x282a06={'method':_0x6ce9('0x33'),'uri':_0x6ce9('0x70'),'headers':{'Authorization':_0x6ce9('0x6e')+_0x3e8311[_0x6ce9('0x57')],'Content-Type':'application/json'},'body':{'refid':_0x5d88d5['message'][_0x6ce9('0x71')]},'json':!![]};return rp(_0x282a06)[_0x6ce9('0x17')](function(_0x36fbc0){_0x5d88d5[_0x6ce9('0x72')]=_0x36fbc0;var _0xe602fa={'messageId':_0x5d88d5[_0x6ce9('0x6f')][_0x6ce9('0x71')],'read':!![]};return _0x30d799[_0x6ce9('0x18')](_0xe602fa);});}else{return logger[_0x6ce9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ce9('0x29'),_0x6ce9('0x6c'),util['inspect'](_0xc926a4,{'showHidden':![],'depth':null}));}})[_0x6ce9('0x19')](function(_0x54338d){return logger[_0x6ce9('0x1a')](_0x6ce9('0x28'),_0x6ce9('0x29'),'intelepeer',util[_0x6ce9('0x39')](_0x54338d,{'showHidden':![],'depth':null}));});}else{return logger[_0x6ce9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6ce9('0x6c'),_0x6ce9('0x73'));}break;}}})[_0x6ce9('0x74')](function(){_0x39b0c5();});}else{_0x39b0c5();}}},'charset':'utf8mb4','collate':_0x6ce9('0x75')});}; \ No newline at end of file +var _0x2af2=['fti_sms_messages','body','FULLTEXT','get','toLowerCase','direction','out','isNil','findOne','update','error','secret','SmsAccount','find','then','type','twilio','authToken','phone','accountSid','messages','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','total_sent','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','catch','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','head','data','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys','length','createHash','hex','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','accountId','/messages','applicationId','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','code','Bearer\x20','message','refid','status','intelepeer','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','messageId'];(function(_0x2ed92f,_0x54091f){var _0x26ff04=function(_0x5ed317){while(--_0x5ed317){_0x2ed92f['push'](_0x2ed92f['shift']());}};_0x26ff04(++_0x54091f);}(_0x2af2,0xdf));var _0x22af=function(_0x43786a,_0x4e9df0){_0x43786a=_0x43786a-0x0;var _0x4df138=_0x2af2[_0x43786a];return _0x4df138;};'use strict';var _=require(_0x22af('0x0'));var util=require(_0x22af('0x1'));var logger=require(_0x22af('0x2'))(_0x22af('0x3'));var moment=require('moment');var BPromise=require(_0x22af('0x4'));var rp=require(_0x22af('0x5'));var fs=require('fs');var path=require(_0x22af('0x6'));var rimraf=require(_0x22af('0x7'));var config=require(_0x22af('0x8'));var attributes=require(_0x22af('0x9'));module['exports']=function(_0x777575,_0x282bc7){return _0x777575[_0x22af('0xa')](_0x22af('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x22af('0xc'),'fields':[_0x22af('0xc')]},{'name':_0x22af('0xd'),'fields':[_0x22af('0xe')],'type':_0x22af('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45b3b6,_0x5d7458,_0xac05c0){var _0x3204ea=_0x777575['models'];var _0x186cf6=_0x45b3b6[_0x22af('0x10')]({'plain':!![]});if(_0x186cf6['direction'][_0x22af('0x11')]()==='in'||_0x186cf6[_0x22af('0x12')]['toLowerCase']()===_0x22af('0x13')&&!_0x186cf6['secret']&&!_[_0x22af('0x14')](_0x186cf6['UserId'])){_0x3204ea['SmsInteraction'][_0x22af('0x15')]({'where':{'id':_0x186cf6['SmsInteractionId']}})['then'](function(_0x1a580a){if(_0x1a580a){_0x1a580a[_0x22af('0x16')]({'lastMsgAt':_0x186cf6['createdAt'],'lastMsgDirection':_0x186cf6['direction'][_0x22af('0x11')]()});}})['catch'](function(_0x4df854){console[_0x22af('0x17')](_0x4df854);});}if(_0x186cf6[_0x22af('0x12')]==='out'&&!_0x186cf6[_0x22af('0x18')]){var _0x43da04;_0x3204ea[_0x22af('0x19')][_0x22af('0x1a')]({'where':{'id':_0x186cf6['SmsAccountId']},'raw':!![]})[_0x22af('0x1b')](function(_0x38b1af){_0x43da04=_0x38b1af;if(_0x43da04&&_0x43da04[_0x22af('0x1c')]){switch(_0x43da04['type']){case _0x22af('0x1d'):var _0x569282=require('twilio');if(_0x43da04['accountSid']&&_0x43da04[_0x22af('0x1e')]&&_0x43da04[_0x22af('0x1f')]){var _0x227445=new _0x569282(_0x43da04[_0x22af('0x20')],_0x43da04[_0x22af('0x1e')]);_0x227445[_0x22af('0x21')]['create']({'body':_0x186cf6[_0x22af('0xe')],'to':_0x186cf6[_0x22af('0x1f')],'from':_0x43da04[_0x22af('0x1f')],'statusCallback':_0x43da04[_0x22af('0x22')]+_0x22af('0x23')+_0x186cf6['id']+_0x22af('0x24')+_0x43da04[_0x22af('0x25')]})[_0x22af('0x1b')](function(_0x1f48a1){if(_0x1f48a1[_0x22af('0x26')]){return _0x45b3b6[_0x22af('0x16')]({'messageId':_0x1f48a1['sid']});}})['catch'](function(_0xd20d9a){logger[_0x22af('0x17')](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x1d'),util['inspect'](_0xd20d9a,{'showHidden':![],'depth':null}));});}else{logger[_0x22af('0x17')](_0x22af('0x27'),'afterCreate','twilio',_0x22af('0x29'));}break;case _0x22af('0x2a'):var _0x328e8e=_0x22af('0x2b');if(_0x43da04['username']&&_0x43da04[_0x22af('0x2c')]){var _0x1dd172={'recipient':[_0x186cf6['phone']],'message':_0x186cf6[_0x22af('0xe')],'message_type':_0x43da04[_0x22af('0x2d')]};if(_0x43da04[_0x22af('0x2d')]&&_0x43da04[_0x22af('0x2d')]!=='SI'){_0x1dd172[_0x22af('0x2e')]=_0x43da04[_0x22af('0x1f')];}var _0x88c3a4={'url':_0x328e8e+_0x22af('0x2f')+_0x43da04[_0x22af('0x30')]+_0x22af('0x31')+_0x43da04[_0x22af('0x2c')],'method':_0x22af('0x32')};rp(_0x88c3a4)['then'](function(_0x38856e){var _0x43b4ce=_0x38856e[_0x22af('0x33')](';');var _0xc14a0c={'user_key':_0x43b4ce[0x0],'session_key':_0x43b4ce[0x1]};_0x88c3a4={'url':_0x328e8e+_0x22af('0x34'),'method':_0x22af('0x35'),'headers':{'user_key':_0xc14a0c[_0x22af('0x36')],'Session_key':_0xc14a0c['session_key']},'json':!![],'body':_0x1dd172};return rp(_0x88c3a4);})[_0x22af('0x1b')](function(_0x5e4121){if(_0x5e4121[_0x22af('0x37')]>=0x1){var _0x4a14d4={'messageId':_0x5e4121['internal_order_id']};if(_0x43da04[_0x22af('0x2d')]!=='GP'||!_0x43da04[_0x22af('0x38')]){_0x4a14d4[_0x22af('0x39')]=!![];}return _0x45b3b6[_0x22af('0x16')](_0x4a14d4);}else{return logger['error'](_0x22af('0x27'),_0x22af('0x28'),'skebby',util[_0x22af('0x3a')](_0x5e4121,{'showHidden':![],'depth':null}));}})['catch'](function(_0xab47e0){return logger[_0x22af('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x22af('0x2a'),util['inspect'](_0xab47e0,{'showHidden':![],'depth':null}));});}else{logger[_0x22af('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x22af('0x28'),_0x22af('0x2a'),_0x22af('0x3b'));}break;case _0x22af('0x3c'):if(_0x43da04['authToken']){var _0x90c87={'recipient':_0x186cf6[_0x22af('0x1f')],'message':_0x186cf6[_0x22af('0xe')],'sender':_0x43da04[_0x22af('0x3d')]||_0x43da04[_0x22af('0x1f')],'authorization':_0x43da04[_0x22af('0x1e')]};var _0x5d7458={'method':'POST','uri':_0x22af('0x3e'),'body':_0x90c87,'json':!![]};rp(_0x5d7458)[_0x22af('0x1b')](function(_0x2a6046){var _0x4a09dd={'messageId':_0x2a6046[_0x22af('0x3f')]};if(!_0x43da04[_0x22af('0x38')]){_0x4a09dd['read']=!![];}return _0x45b3b6[_0x22af('0x16')](_0x4a09dd);})[_0x22af('0x40')](function(_0x4a0ee7){logger[_0x22af('0x17')](_0x22af('0x27'),'afterCreate',_0x22af('0x3c'),util[_0x22af('0x3a')](_0x4a0ee7,{'showHidden':![],'depth':null}));});}else{logger[_0x22af('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x22af('0x28'),_0x22af('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0x22af('0x41'):if(_0x43da04[_0x22af('0x30')]&&_0x43da04[_0x22af('0x2c')]){var _0x90c87={'messages':[{'source':_0x22af('0x42'),'to':_0x186cf6['phone'],'body':_0x186cf6['body'],'from':_0x43da04[_0x22af('0x3d')]||_0x43da04['phone']}]};var _0x2274ea=util[_0x22af('0x43')](_0x22af('0x44'),_0x43da04[_0x22af('0x30')],_0x43da04[_0x22af('0x2c')]);var _0x5d7458={'method':'POST','uri':_0x22af('0x45'),'body':_0x90c87,'headers':{'Authorization':util[_0x22af('0x43')](_0x22af('0x46'),new Buffer(_0x2274ea)[_0x22af('0x47')](_0x22af('0x48')))},'json':!![]};rp(_0x5d7458)[_0x22af('0x1b')](function(_0x3ee757){if(_0x3ee757[_0x22af('0x49')]>=0xc8&&_0x3ee757['http_code']<=0xce){if(_0x3ee757['data']&&_0x3ee757['data']['queued_count']>0x0){var _0x9b07d2=_[_0x22af('0x4a')](_0x3ee757[_0x22af('0x4b')][_0x22af('0x21')]);var _0x3469ab={'messageId':_0x9b07d2[_0x22af('0x4c')]};if(!_0x43da04['deliveryReport']){_0x3469ab[_0x22af('0x39')]=!![];}return _0x45b3b6[_0x22af('0x16')](_0x3469ab);}else{logger[_0x22af('0x17')](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x4d'),util[_0x22af('0x3a')](_0x3ee757,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x4d'),util['inspect'](_0x3ee757,{'showHidden':![],'depth':null}));}})[_0x22af('0x40')](function(_0x387da6){logger[_0x22af('0x17')](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x4d'),util[_0x22af('0x3a')](_0x387da6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x4d'),_0x22af('0x3b'));}break;case _0x22af('0x4e'):if(_0x43da04['authId']&&_0x43da04[_0x22af('0x1e')]){var _0x90c87={'dst':_0x186cf6[_0x22af('0x1f')],'text':_0x186cf6['body'],'src':_0x43da04[_0x22af('0x3d')]||_0x43da04['phone'],'url':_0x43da04[_0x22af('0x22')]+_0x22af('0x23')+_0x186cf6['id']+_0x22af('0x24')+_0x43da04[_0x22af('0x25')]};var _0x2274ea=util[_0x22af('0x43')](_0x22af('0x44'),_0x43da04[_0x22af('0x4f')],_0x43da04[_0x22af('0x1e')]);var _0x5d7458={'method':'POST','uri':util[_0x22af('0x43')](_0x22af('0x50'),_0x43da04[_0x22af('0x4f')]),'body':_0x90c87,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x2274ea)[_0x22af('0x47')](_0x22af('0x48')))},'json':!![]};rp(_0x5d7458)['then'](function(_0x3a64a1){var _0x5404b5={'messageId':_0x3a64a1[_0x22af('0x51')][0x0]};return _0x45b3b6[_0x22af('0x16')](_0x5404b5);})[_0x22af('0x40')](function(_0x375ac6){logger['error'](_0x22af('0x27'),'afterCreate',_0x22af('0x4e'),util[_0x22af('0x3a')](_0x375ac6,{'showHidden':![],'depth':null}));});}else{logger[_0x22af('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x22af('0x28'),_0x22af('0x4e'),_0x22af('0x52'));}break;case _0x22af('0x53'):if(_0x43da04[_0x22af('0x30')]&&_0x43da04[_0x22af('0x2c')]){if(_0x43da04['baseUrl']){var _0x56e5f8={'method':'POST','uri':_0x43da04[_0x22af('0x54')]+_0x22af('0x55'),'body':{'username':_0x43da04[_0x22af('0x30')],'password':_0x43da04['password']},'json':!![]};return rp(_0x56e5f8)[_0x22af('0x1b')](function(_0x27446a){var _0x375c8f={'method':_0x22af('0x35'),'uri':_0x43da04['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x43da04[_0x22af('0x1f')],'destinations':[{'to':_0x186cf6[_0x22af('0x1f')]}],'text':_0x186cf6[_0x22af('0xe')],'notifyUrl':_0x43da04[_0x22af('0x22')]+'/api/sms/messages/'+_0x186cf6['id']+_0x22af('0x24')+_0x43da04['token'],'notifyContentType':_0x22af('0x56'),'callbackData':_0x43da04[_0x22af('0x1f')]+';'+_0x186cf6[_0x22af('0xe')]}]},'headers':{'Authorization':_0x22af('0x57')+_0x27446a[_0x22af('0x25')]},'json':!![]};return rp(_0x375c8f)['then'](function(_0x49f6f4){if(_0x49f6f4[_0x22af('0x21')]){var _0x89435d={'messageId':_0x49f6f4[_0x22af('0x21')][0x0][_0x22af('0xc')]};if(!_0x43da04[_0x22af('0x38')]){_0x89435d['read']=!![];}return _0x45b3b6['update'](_0x89435d);}else{return logger['error'](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x53'),util[_0x22af('0x3a')](_0x49f6f4,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x1513c8){return logger[_0x22af('0x17')](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x53'),util[_0x22af('0x3a')](_0x1513c8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x53'),_0x22af('0x58'));}}else{logger[_0x22af('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x22af('0x28'),_0x22af('0x53'),_0x22af('0x3b'));}break;case'csc':var _0x43df08=require(_0x22af('0x59'));if(_0x43da04[_0x22af('0x5a')]){var _0x4a6471={};_0x4a6471[_0x22af('0x5b')]=_0x43da04[_0x22af('0x30')];_0x4a6471[_0x22af('0x1f')]=_0x186cf6[_0x22af('0x1f')];_0x4a6471[_0x22af('0x2e')]=_0x43da04[_0x22af('0x1f')];_0x4a6471[_0x22af('0x5c')]=_0x186cf6['body'];_0x4a6471[_0x22af('0x5d')]=+new Date();var _0x567922='';var _0x44a014='';var _0x40179e=Object[_0x22af('0x5e')](_0x4a6471);_0x40179e['sort']();for(var _0x45b11d=0x0;_0x45b11d<_0x40179e[_0x22af('0x5f')];_0x45b11d++){if(_0x567922!=''){_0x567922+='&';}_0x567922+=_0x40179e[_0x45b11d]+'='+encodeURIComponent(_0x4a6471[_0x40179e[_0x45b11d]]);_0x44a014+=_0x4a6471[_0x40179e[_0x45b11d]];}_0x44a014+=_0x43da04['apiKey'];_0x44a014=_0x43df08[_0x22af('0x60')]('md5')[_0x22af('0x16')](_0x44a014)['digest'](_0x22af('0x61'));if(_0x567922!==''){_0x567922+='&';}_0x567922+='signature='+_0x44a014;var _0x88c3a4={'method':'GET','uri':_0x43da04[_0x22af('0x54')]+_0x22af('0x62')+_0x567922,'json':!![]};return rp(_0x88c3a4)['then'](function(_0x493830){var _0x3ad84f=Object[_0x22af('0x5e')](_0x493830);if(_0x493830[_0x3ad84f[0x0]][_0x22af('0x17')]&&parseInt(_0x493830[_0x3ad84f[0x0]][_0x22af('0x17')])===0x0){var _0x4aef41={'messageId':_0x493830[_0x3ad84f[0x0]][_0x22af('0x63')]};if(!_0x43da04[_0x22af('0x38')]){_0x4aef41[_0x22af('0x39')]=!![];}return _0x45b3b6['update'](_0x4aef41);}else{return logger[_0x22af('0x17')](_0x22af('0x27'),'afterCreate',_0x22af('0x64'),util[_0x22af('0x3a')](_0x493830[_0x22af('0x17')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5678e8){return logger[_0x22af('0x17')](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x64'),util['inspect'](_0x5678e8,{'showHidden':![],'depth':null}));});}else{logger[_0x22af('0x17')](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x64'),_0x22af('0x65'));}break;case'clickatell':if(_0x43da04[_0x22af('0x5a')]){var _0x59ffff={'method':_0x22af('0x35'),'uri':_0x22af('0x66'),'headers':{'Authorization':_0x43da04[_0x22af('0x5a')]},'body':{'content':_0x186cf6[_0x22af('0xe')],'to':[_0x186cf6['phone']],'from':_0x43da04[_0x22af('0x1f')],'binary':![],'clientMessageId':'uuid','charset':_0x22af('0x67')},'json':!![]};rp(_0x59ffff)['then'](function(_0x2479ae){if(!_0x2479ae[_0x22af('0x17')]){var _0x589b58={'messageId':_0x2479ae[_0x22af('0x21')][0x0][_0x22af('0x68')]};if(!_0x43da04[_0x22af('0x38')]){_0x589b58[_0x22af('0x39')]=!![];}return _0x45b3b6['update'](_0x589b58);}else{return logger[_0x22af('0x17')](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x69'),util[_0x22af('0x3a')](_0x2479ae[_0x22af('0x17')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x13edfe){return logger[_0x22af('0x17')](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x69'),util['inspect'](_0x13edfe,{'showHidden':![],'depth':null}));});}else{logger[_0x22af('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x22af('0x69'),_0x22af('0x65'));}break;case'bandwidth':if(_0x43da04[_0x22af('0x30')]&&_0x43da04[_0x22af('0x2c')]){var _0x2274ea=util[_0x22af('0x43')](_0x22af('0x44'),_0x43da04[_0x22af('0x30')],_0x43da04[_0x22af('0x2c')]);var _0x5d7458={'method':_0x22af('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x43da04[_0x22af('0x6a')]+_0x22af('0x6b'),'body':{'to':[_0x186cf6['phone']],'text':_0x186cf6['body'],'from':_0x43da04[_0x22af('0x1f')],'applicationId':_0x43da04[_0x22af('0x6c')]},'headers':{'Authorization':util[_0x22af('0x43')](_0x22af('0x46'),new Buffer(_0x2274ea)['toString']('base64'))},'json':!![]};rp(_0x5d7458)[_0x22af('0x1b')](function(_0x122940){if(_0x122940['id']){var _0x29ef0f={'messageId':_0x122940['id']};return _0x45b3b6[_0x22af('0x16')](_0x29ef0f);}else{logger[_0x22af('0x17')](_0x22af('0x27'),'afterCreate',_0x22af('0x6d'),util['inspect'](_0x122940,{'showHidden':![],'depth':null}));}})[_0x22af('0x40')](function(_0x28188e){logger['error'](_0x22af('0x27'),'afterCreate',_0x22af('0x6d'),util[_0x22af('0x3a')](_0x28188e,{'showHidden':![],'depth':null}));});}else{logger[_0x22af('0x17')](_0x22af('0x27'),'afterCreate',_0x22af('0x6d'),_0x22af('0x3b'));}break;case'intelepeer':if(_0x43da04[_0x22af('0x5a')]){var _0x3ee08a={};var _0x88c3a4={'method':_0x22af('0x35'),'uri':_0x22af('0x6e'),'headers':{'Authorization':'Bearer\x20'+_0x43da04['apiKey'],'Content-Type':_0x22af('0x56')},'body':{'from':_0x43da04['phone'],'to':_0x186cf6['phone'],'text':_0x186cf6['body']},'json':!![]};return rp(_0x88c3a4)[_0x22af('0x1b')](function(_0x3214f6){if(_0x3214f6[_0x22af('0x6f')]==0xca){_0x3ee08a['message']=_0x3214f6;var _0x3cf36b={'method':_0x22af('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x22af('0x70')+_0x43da04['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x3ee08a[_0x22af('0x71')][_0x22af('0x72')]},'json':!![]};return rp(_0x3cf36b)[_0x22af('0x1b')](function(_0x321652){_0x3ee08a[_0x22af('0x73')]=_0x321652;var _0x7bec8f={'messageId':_0x3ee08a[_0x22af('0x71')][_0x22af('0x72')],'read':!![]};return _0x45b3b6[_0x22af('0x16')](_0x7bec8f);});}else{return logger[_0x22af('0x17')](_0x22af('0x27'),_0x22af('0x28'),'intelepeer',util[_0x22af('0x3a')](_0x3214f6,{'showHidden':![],'depth':null}));}})[_0x22af('0x40')](function(_0x1d522e){return logger[_0x22af('0x17')](_0x22af('0x27'),_0x22af('0x28'),'intelepeer',util[_0x22af('0x3a')](_0x1d522e,{'showHidden':![],'depth':null}));});}else{return logger[_0x22af('0x17')](_0x22af('0x27'),_0x22af('0x28'),_0x22af('0x74'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0xac05c0();});}else{_0xac05c0();}}},'charset':_0x22af('0x75'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 57ffe11..25b0791 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 _0x6f4f=['request\x20sent','result','catch','create','body','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','./smsMessage.socket','register','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message'];(function(_0x304af3,_0x2405df){var _0x396699=function(_0x5b183a){while(--_0x5b183a){_0x304af3['push'](_0x304af3['shift']());}};_0x396699(++_0x2405df);}(_0x6f4f,0x6e));var _0xf6f4=function(_0x132c55,_0x171c91){_0x132c55=_0x132c55-0x0;var _0x201902=_0x6f4f[_0x132c55];return _0x201902;};'use strict';var _=require(_0xf6f4('0x0'));var util=require(_0xf6f4('0x1'));var moment=require(_0xf6f4('0x2'));var BPromise=require(_0xf6f4('0x3'));var rs=require(_0xf6f4('0x4'));var fs=require('fs');var Redis=require(_0xf6f4('0x5'));var db=require(_0xf6f4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6f4('0x7'))(_0xf6f4('0x8'));var config=require(_0xf6f4('0x9'));var jayson=require(_0xf6f4('0xa'));var client=jayson[_0xf6f4('0xb')][_0xf6f4('0xc')]({'port':0x232a});config['redis']=_[_0xf6f4('0xd')](config['redis'],{'host':_0xf6f4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf6f4('0xf'))[_0xf6f4('0x10')](socket);function respondWithRpcPromise(_0x2964c6,_0x346e4e,_0xf42c7){return new BPromise(function(_0x39853b,_0x4dd73f){return client['request'](_0x2964c6,_0xf42c7)[_0xf6f4('0x11')](function(_0x592fd8){logger[_0xf6f4('0x12')]('SmsMessage,\x20%s,\x20%s',_0x346e4e,'request\x20sent');logger[_0xf6f4('0x13')](_0xf6f4('0x14'),_0x346e4e,'request\x20sent',JSON[_0xf6f4('0x15')](_0x592fd8));if(_0x592fd8[_0xf6f4('0x16')]){if(_0x592fd8['error'][_0xf6f4('0x17')]===0x1f4){logger[_0xf6f4('0x16')](_0xf6f4('0x18'),_0x346e4e,_0x592fd8[_0xf6f4('0x16')][_0xf6f4('0x19')]);return _0x4dd73f(_0x592fd8[_0xf6f4('0x16')][_0xf6f4('0x19')]);}logger[_0xf6f4('0x16')](_0xf6f4('0x18'),_0x346e4e,_0x592fd8[_0xf6f4('0x16')][_0xf6f4('0x19')]);return _0x39853b(_0x592fd8[_0xf6f4('0x16')]['message']);}else{logger[_0xf6f4('0x12')](_0xf6f4('0x18'),_0x346e4e,_0xf6f4('0x1a'));_0x39853b(_0x592fd8[_0xf6f4('0x1b')][_0xf6f4('0x19')]);}})[_0xf6f4('0x1c')](function(_0x5883c8){logger['error'](_0xf6f4('0x18'),_0x346e4e,_0x5883c8);_0x4dd73f(_0x5883c8);});});}exports['CreateSmsMessage']=function(_0x378ffa){var _0x25bc62=this;return new Promise(function(_0x32c20b,_0x13112f){return db['SmsMessage'][_0xf6f4('0x1d')](_0x378ffa[_0xf6f4('0x1e')],{'raw':_0x378ffa[_0xf6f4('0x1f')]?_0x378ffa[_0xf6f4('0x1f')][_0xf6f4('0x20')]===undefined?!![]:![]:!![]})[_0xf6f4('0x11')](function(_0x357823){logger[_0xf6f4('0x12')](_0xf6f4('0x21'),_0x378ffa);logger[_0xf6f4('0x13')](_0xf6f4('0x21'),_0x378ffa,JSON[_0xf6f4('0x15')](_0x357823));_0x32c20b(_0x357823);})[_0xf6f4('0x1c')](function(_0x2ab4a0){logger[_0xf6f4('0x16')](_0xf6f4('0x21'),_0x2ab4a0[_0xf6f4('0x19')],_0x378ffa);_0x13112f(_0x25bc62[_0xf6f4('0x16')](0x1f4,_0x2ab4a0[_0xf6f4('0x19')]));});});}; \ No newline at end of file +var _0x32bb=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateSmsMessage','SmsMessage','options','raw','lodash','util','moment','bluebird'];(function(_0x5886b1,_0x8c78aa){var _0x2713f9=function(_0x651149){while(--_0x651149){_0x5886b1['push'](_0x5886b1['shift']());}};_0x2713f9(++_0x8c78aa);}(_0x32bb,0x78));var _0xb32b=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0x32bb[_0xe30e17];return _0x2342c9;};'use strict';var _=require(_0xb32b('0x0'));var util=require(_0xb32b('0x1'));var moment=require(_0xb32b('0x2'));var BPromise=require(_0xb32b('0x3'));var rs=require(_0xb32b('0x4'));var fs=require('fs');var Redis=require(_0xb32b('0x5'));var db=require(_0xb32b('0x6'))['db'];var utils=require(_0xb32b('0x7'));var logger=require(_0xb32b('0x8'))('rpc');var config=require(_0xb32b('0x9'));var jayson=require(_0xb32b('0xa'));var client=jayson[_0xb32b('0xb')][_0xb32b('0xc')]({'port':0x232a});config[_0xb32b('0xd')]=_[_0xb32b('0xe')](config[_0xb32b('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb32b('0xf'))(new Redis(config[_0xb32b('0xd')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0xa3f0bf,_0x5cc53d,_0x46bbc2){return new BPromise(function(_0x271b4a,_0x1214ea){return client[_0xb32b('0x10')](_0xa3f0bf,_0x46bbc2)[_0xb32b('0x11')](function(_0x456de0){logger[_0xb32b('0x12')](_0xb32b('0x13'),_0x5cc53d,_0xb32b('0x14'));logger[_0xb32b('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5cc53d,_0xb32b('0x14'),JSON[_0xb32b('0x16')](_0x456de0));if(_0x456de0['error']){if(_0x456de0['error']['code']===0x1f4){logger[_0xb32b('0x17')](_0xb32b('0x13'),_0x5cc53d,_0x456de0[_0xb32b('0x17')][_0xb32b('0x18')]);return _0x1214ea(_0x456de0['error'][_0xb32b('0x18')]);}logger[_0xb32b('0x17')](_0xb32b('0x13'),_0x5cc53d,_0x456de0[_0xb32b('0x17')][_0xb32b('0x18')]);return _0x271b4a(_0x456de0[_0xb32b('0x17')][_0xb32b('0x18')]);}else{logger[_0xb32b('0x12')](_0xb32b('0x13'),_0x5cc53d,_0xb32b('0x14'));_0x271b4a(_0x456de0[_0xb32b('0x19')][_0xb32b('0x18')]);}})[_0xb32b('0x1a')](function(_0x5ef2b3){logger[_0xb32b('0x17')]('SmsMessage,\x20%s,\x20%s',_0x5cc53d,_0x5ef2b3);_0x1214ea(_0x5ef2b3);});});}exports[_0xb32b('0x1b')]=function(_0x30f413){var _0x5d214b=this;return new Promise(function(_0x506256,_0x16a3c2){return db[_0xb32b('0x1c')]['create'](_0x30f413['body'],{'raw':_0x30f413[_0xb32b('0x1d')]?_0x30f413['options'][_0xb32b('0x1e')]===undefined?!![]:![]:!![]})[_0xb32b('0x11')](function(_0x36ac60){logger[_0xb32b('0x12')](_0xb32b('0x1b'),_0x30f413);logger[_0xb32b('0x15')](_0xb32b('0x1b'),_0x30f413,JSON[_0xb32b('0x16')](_0x36ac60));_0x506256(_0x36ac60);})[_0xb32b('0x1a')](function(_0x2e294){logger[_0xb32b('0x17')](_0xb32b('0x1b'),_0x2e294[_0xb32b('0x18')],_0x30f413);_0x16a3c2(_0x5d214b[_0xb32b('0x17')](0x1f4,_0x2e294[_0xb32b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 75c3b75..f471e39 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 _0xafd4=['removeListener','register','length','smsMessage:','save','remove','update','emit'];(function(_0x1c67a7,_0x2b35bd){var _0x3dc84a=function(_0x249c51){while(--_0x249c51){_0x1c67a7['push'](_0x1c67a7['shift']());}};_0x3dc84a(++_0x2b35bd);}(_0xafd4,0x184));var _0x4afd=function(_0x2aab8e,_0x440d3b){_0x2aab8e=_0x2aab8e-0x0;var _0x2a67=_0xafd4[_0x2aab8e];return _0x2a67;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x4afd('0x0'),_0x4afd('0x1'),_0x4afd('0x2')];function createListener(_0x498010,_0x50e417){return function(_0x25545c){_0x50e417[_0x4afd('0x3')](_0x498010,_0x25545c);};}function removeListener(_0x57f501,_0x419b78){return function(){SmsMessageEvents[_0x4afd('0x4')](_0x57f501,_0x419b78);};}exports[_0x4afd('0x5')]=function(_0x2fe297){for(var _0x215969=0x0,_0x4c7094=events[_0x4afd('0x6')];_0x215969<_0x4c7094;_0x215969++){var _0x4b67cb=events[_0x215969];var _0x34a6a8=createListener(_0x4afd('0x7')+_0x4b67cb,_0x2fe297);SmsMessageEvents['on'](_0x4b67cb,_0x34a6a8);}}; \ No newline at end of file +var _0x3ee8=['save','remove','update','emit','removeListener','smsMessage:','./smsMessage.events'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x3ee8,0xfb));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0x83ee('0x0'));var events=[_0x83ee('0x1'),_0x83ee('0x2'),_0x83ee('0x3')];function createListener(_0x175fab,_0x3f72b3){return function(_0x32c23c){_0x3f72b3[_0x83ee('0x4')](_0x175fab,_0x32c23c);};}function removeListener(_0x5dd433,_0x53b279){return function(){SmsMessageEvents[_0x83ee('0x5')](_0x5dd433,_0x53b279);};}exports['register']=function(_0x2b960a){for(var _0x5a481f=0x0,_0x121134=events['length'];_0x5a481f<_0x121134;_0x5a481f++){var _0x2a378f=events[_0x5a481f];var _0x315f61=createListener(_0x83ee('0x6')+_0x2a378f,_0x2b960a);SmsMessageEvents['on'](_0x2a378f,_0x315f61);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 5cd02e3..e9a0816 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 _0xb296=['/:id/users','getAgents','create','addTeams','addAgents','put','/:id','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x41e870,_0x406df4){var _0x4e96ca=function(_0x2a0370){while(--_0x2a0370){_0x41e870['push'](_0x41e870['shift']());}};_0x4e96ca(++_0x406df4);}(_0xb296,0xa3));var _0x6b29=function(_0x54a669,_0x4c42fc){_0x54a669=_0x54a669-0x0;var _0x1800e9=_0xb296[_0x54a669];return _0x1800e9;};'use strict';var multer=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var path=require(_0x6b29('0x2'));var timeout=require(_0x6b29('0x3'));var express=require(_0x6b29('0x4'));var router=express[_0x6b29('0x5')]();var auth=require(_0x6b29('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6b29('0x7'));var controller=require('./smsQueue.controller');router[_0x6b29('0x8')]('/',auth[_0x6b29('0x9')](),controller['index']);router[_0x6b29('0x8')](_0x6b29('0xa'),auth[_0x6b29('0x9')](),controller[_0x6b29('0xb')]);router[_0x6b29('0x8')]('/:id',auth[_0x6b29('0x9')](),controller[_0x6b29('0xc')]);router[_0x6b29('0x8')](_0x6b29('0xd'),auth[_0x6b29('0x9')](),controller[_0x6b29('0xe')]);router[_0x6b29('0x8')](_0x6b29('0xf'),auth['isAuthenticated'](),controller[_0x6b29('0x10')]);router[_0x6b29('0x8')](_0x6b29('0x11'),auth['isAuthenticated'](),controller[_0x6b29('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6b29('0x13')]);router['post']('/:id/teams',auth[_0x6b29('0x9')](),controller[_0x6b29('0x14')]);router['post'](_0x6b29('0x11'),auth[_0x6b29('0x9')](),controller[_0x6b29('0x15')]);router[_0x6b29('0x16')](_0x6b29('0x17'),auth[_0x6b29('0x9')](),controller[_0x6b29('0x18')]);router['delete'](_0x6b29('0x17'),auth[_0x6b29('0x9')](),controller[_0x6b29('0x19')]);router['delete']('/:id/teams',auth[_0x6b29('0x9')](),controller[_0x6b29('0x1a')]);router[_0x6b29('0x1b')](_0x6b29('0x11'),auth[_0x6b29('0x9')](),controller[_0x6b29('0x1c')]);module[_0x6b29('0x1d')]=router; \ No newline at end of file +var _0x323f=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','update','delete','destroy','removeTeams'];(function(_0x312080,_0x529652){var _0x1b753e=function(_0x1993f0){while(--_0x1993f0){_0x312080['push'](_0x312080['shift']());}};_0x1b753e(++_0x529652);}(_0x323f,0x1ee));var _0xf323=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x323f[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var auth=require(_0xf323('0x4'));var interaction=require(_0xf323('0x5'));var config=require(_0xf323('0x6'));var controller=require(_0xf323('0x7'));router[_0xf323('0x8')]('/',auth[_0xf323('0x9')](),controller[_0xf323('0xa')]);router['get'](_0xf323('0xb'),auth[_0xf323('0x9')](),controller[_0xf323('0xc')]);router[_0xf323('0x8')](_0xf323('0xd'),auth[_0xf323('0x9')](),controller[_0xf323('0xe')]);router[_0xf323('0x8')](_0xf323('0xf'),auth[_0xf323('0x9')](),controller[_0xf323('0x10')]);router[_0xf323('0x8')](_0xf323('0x11'),auth[_0xf323('0x9')](),controller[_0xf323('0x12')]);router[_0xf323('0x8')](_0xf323('0x13'),auth['isAuthenticated'](),controller[_0xf323('0x14')]);router[_0xf323('0x15')]('/',auth[_0xf323('0x9')](),controller['create']);router[_0xf323('0x15')](_0xf323('0x11'),auth[_0xf323('0x9')](),controller[_0xf323('0x16')]);router[_0xf323('0x15')](_0xf323('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf323('0x17')](_0xf323('0xd'),auth[_0xf323('0x9')](),controller[_0xf323('0x18')]);router[_0xf323('0x19')]('/:id',auth[_0xf323('0x9')](),controller[_0xf323('0x1a')]);router[_0xf323('0x19')](_0xf323('0x11'),auth['isAuthenticated'](),controller[_0xf323('0x1b')]);router[_0xf323('0x19')](_0xf323('0x13'),auth[_0xf323('0x9')](),controller['removeAgents']);module[_0xf323('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 616636d..226a9b8 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 _0x1205=['name','rrmemory','beepall','STRING'];(function(_0x5b8d2b,_0x91b4f1){var _0x573e20=function(_0x29013b){while(--_0x29013b){_0x5b8d2b['push'](_0x5b8d2b['shift']());}};_0x573e20(++_0x91b4f1);}(_0x1205,0x10b));var _0x5120=function(_0x1d3532,_0x56c856){_0x1d3532=_0x1d3532-0x0;var _0x1a8c83=_0x1205[_0x1d3532];return _0x1a8c83;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5120('0x0')],'unique':_0x5120('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5120('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5120('0x2'),_0x5120('0x3'),'roundrobin')}}; \ No newline at end of file +var _0x7263=['beepall','exports','STRING','rrmemory'];(function(_0xbf2512,_0x476653){var _0x3a3a06=function(_0x43947c){while(--_0x43947c){_0xbf2512['push'](_0xbf2512['shift']());}};_0x3a3a06(++_0x476653);}(_0x7263,0x121));var _0x3726=function(_0x41792f,_0xb17f80){_0x41792f=_0x41792f-0x0;var _0x4c6a73=_0x7263[_0x41792f];return _0x4c6a73;};'use strict';var Sequelize=require('sequelize');module[_0x3726('0x0')]={'name':{'type':Sequelize[_0x3726('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3726('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3726('0x2'),_0x3726('0x3'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index a880de4..d30bd17 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 _0x8d0e=['UserSmsQueue','hasOwnProperty','pick','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','end','error','stack','name','SmsQueue','rawAttributes','fieldName','type','model','map','query','filters','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','keys','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers'];(function(_0x5c27ae,_0x10dfb7){var _0x3eef82=function(_0x35b90c){while(--_0x35b90c){_0x5c27ae['push'](_0x5c27ae['shift']());}};_0x3eef82(++_0x10dfb7);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x260afa,_0x317491){_0x260afa=_0x260afa-0x0;var _0x33fff2=_0x8d0e[_0x260afa];return _0x33fff2;};'use strict';var pdf=require(_0xe8d0('0x0'));var emlformat=require(_0xe8d0('0x1'));var rimraf=require(_0xe8d0('0x2'));var zipdir=require(_0xe8d0('0x3'));var jsonpatch=require(_0xe8d0('0x4'));var rp=require(_0xe8d0('0x5'));var moment=require(_0xe8d0('0x6'));var BPromise=require(_0xe8d0('0x7'));var Mustache=require(_0xe8d0('0x8'));var util=require('util');var path=require(_0xe8d0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe8d0('0xa'));var fs=require('fs');var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];config['redis']=_[_0xe8d0('0x1b')](config[_0xe8d0('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8d0('0x1d'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe8d0('0x1e')](socket);function respondWithStatusCode(_0x2aa906,_0x1aa725){_0x1aa725=_0x1aa725||0xcc;return function(_0x291b49){if(_0x291b49){return _0x2aa906[_0xe8d0('0x1f')](_0x1aa725);}return _0x2aa906[_0xe8d0('0x20')](_0x1aa725)['end']();};}function respondWithResult(_0x6ccffa,_0x49554d){_0x49554d=_0x49554d||0xc8;return function(_0x6d932b){if(_0x6d932b){return _0x6ccffa[_0xe8d0('0x20')](_0x49554d)[_0xe8d0('0x21')](_0x6d932b);}};}function respondWithFilteredResult(_0x4d1db4,_0x4d0ddb){return function(_0x47c67a){if(_0x47c67a){var _0x1bdd94=_0x47c67a[_0xe8d0('0x22')],_0x384854=_0x4d0ddb['offset'],_0x27b910=_0x4d0ddb[_0xe8d0('0x23')]+_0x4d0ddb[_0xe8d0('0x24')],_0x44bbe4;if(_0x27b910>=_0x1bdd94){_0x27b910=_0x1bdd94;_0x44bbe4=0xc8;}else{_0x44bbe4=0xce;}_0x4d1db4['status'](_0x44bbe4);return _0x4d1db4['set']('Content-Range',_0x384854+'-'+_0x27b910+'/'+_0x1bdd94)[_0xe8d0('0x21')](_0x47c67a);}return null;};}function patchUpdates(_0x35d131){return function(_0x25363b){try{jsonpatch[_0xe8d0('0x25')](_0x25363b,_0x35d131,!![]);}catch(_0x25f764){return BPromise[_0xe8d0('0x26')](_0x25f764);}return _0x25363b[_0xe8d0('0x27')]();};}function saveUpdates(_0x28a6b5,_0x32e39a){return function(_0x5ab4e7){if(_0x5ab4e7){return _0x5ab4e7[_0xe8d0('0x28')](_0x28a6b5)[_0xe8d0('0x29')](function(_0x572c25){return _0x572c25;});}return null;};}function removeEntity(_0x106614,_0x2e69d1){return function(_0x274cac){if(_0x274cac){return _0x274cac[_0xe8d0('0x2a')]()[_0xe8d0('0x29')](function(){var _0x149dfd=_0x274cac[_0xe8d0('0x2b')]({'plain':!![]});var _0x32f0c1=_0xe8d0('0x2c');return db[_0xe8d0('0x2d')][_0xe8d0('0x2a')]({'where':{'type':_0x32f0c1,'resourceId':_0x149dfd['id']}})['then'](function(){return _0x274cac;});})[_0xe8d0('0x29')](function(){_0x106614[_0xe8d0('0x20')](0xcc)[_0xe8d0('0x2e')]();});}};}function handleEntityNotFound(_0x486f49,_0x10a30b){return function(_0x343b08){if(!_0x343b08){_0x486f49['sendStatus'](0x194);}return _0x343b08;};}function handleError(_0x1519e2,_0x3ffcb7){_0x3ffcb7=_0x3ffcb7||0x1f4;return function(_0x11fcf2){logger[_0xe8d0('0x2f')](_0x11fcf2[_0xe8d0('0x30')]);if(_0x11fcf2['name']){delete _0x11fcf2[_0xe8d0('0x31')];}_0x1519e2['status'](_0x3ffcb7)['send'](_0x11fcf2);};}exports['index']=function(_0x547a2b,_0x13cd4c){var _0x36ccec={},_0x5151fa={},_0x57e375={'count':0x0,'rows':[]};var _0x244a25=_['map'](db[_0xe8d0('0x32')][_0xe8d0('0x33')],function(_0x327004){return{'name':_0x327004[_0xe8d0('0x34')],'type':_0x327004[_0xe8d0('0x35')]['key']};});_0x5151fa[_0xe8d0('0x36')]=_[_0xe8d0('0x37')](_0x244a25,_0xe8d0('0x31'));_0x5151fa[_0xe8d0('0x38')]=_['keys'](_0x547a2b[_0xe8d0('0x38')]);_0x5151fa[_0xe8d0('0x39')]=_['intersection'](_0x5151fa[_0xe8d0('0x36')],_0x5151fa['query']);_0x36ccec[_0xe8d0('0x3a')]=_['intersection'](_0x5151fa[_0xe8d0('0x36')],qs['fields'](_0x547a2b[_0xe8d0('0x38')][_0xe8d0('0x3b')]));_0x36ccec[_0xe8d0('0x3a')]=_0x36ccec[_0xe8d0('0x3a')]['length']?_0x36ccec[_0xe8d0('0x3a')]:_0x5151fa[_0xe8d0('0x36')];if(!_0x547a2b[_0xe8d0('0x38')]['hasOwnProperty'](_0xe8d0('0x3c'))){_0x36ccec[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x547a2b[_0xe8d0('0x38')][_0xe8d0('0x24')]);_0x36ccec['offset']=qs[_0xe8d0('0x23')](_0x547a2b[_0xe8d0('0x38')][_0xe8d0('0x23')]);}_0x36ccec[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x547a2b[_0xe8d0('0x38')][_0xe8d0('0x3e')]);_0x36ccec[_0xe8d0('0x3f')]=qs['filters'](_['pick'](_0x547a2b[_0xe8d0('0x38')],_0x5151fa[_0xe8d0('0x39')]),_0x244a25);if(_0x547a2b[_0xe8d0('0x38')][_0xe8d0('0x40')]){_0x36ccec[_0xe8d0('0x3f')]=_['merge'](_0x36ccec[_0xe8d0('0x3f')],{'$or':_['map'](_0x244a25,function(_0x2da076){if(_0x2da076[_0xe8d0('0x35')]!==_0xe8d0('0x41')){var _0x48fa07={};_0x48fa07[_0x2da076[_0xe8d0('0x31')]]={'$like':'%'+_0x547a2b[_0xe8d0('0x38')][_0xe8d0('0x40')]+'%'};return _0x48fa07;}})});}_0x36ccec=_[_0xe8d0('0x42')]({},_0x36ccec,_0x547a2b[_0xe8d0('0x43')]);var _0x484e27={'where':_0x36ccec['where']};return db['SmsQueue']['count'](_0x484e27)[_0xe8d0('0x29')](function(_0x52f288){_0x57e375[_0xe8d0('0x22')]=_0x52f288;if(_0x547a2b[_0xe8d0('0x38')][_0xe8d0('0x44')]){_0x36ccec[_0xe8d0('0x45')]=[{'all':!![]}];}return db[_0xe8d0('0x32')][_0xe8d0('0x46')](_0x36ccec);})[_0xe8d0('0x29')](function(_0x3cbca5){_0x57e375['rows']=_0x3cbca5;return _0x57e375;})[_0xe8d0('0x29')](respondWithFilteredResult(_0x13cd4c,_0x36ccec))[_0xe8d0('0x47')](handleError(_0x13cd4c,null));};exports['show']=function(_0x4bcdff,_0x3825a1){var _0x18a478={'raw':!![],'where':{'id':_0x4bcdff['params']['id']}},_0x267b32={};_0x267b32[_0xe8d0('0x36')]=_[_0xe8d0('0x48')](db['SmsQueue'][_0xe8d0('0x33')]);_0x267b32[_0xe8d0('0x38')]=_['keys'](_0x4bcdff[_0xe8d0('0x38')]);_0x267b32[_0xe8d0('0x39')]=_[_0xe8d0('0x49')](_0x267b32[_0xe8d0('0x36')],_0x267b32[_0xe8d0('0x38')]);_0x18a478[_0xe8d0('0x3a')]=_[_0xe8d0('0x49')](_0x267b32[_0xe8d0('0x36')],qs['fields'](_0x4bcdff[_0xe8d0('0x38')][_0xe8d0('0x3b')]));_0x18a478[_0xe8d0('0x3a')]=_0x18a478[_0xe8d0('0x3a')][_0xe8d0('0x4a')]?_0x18a478[_0xe8d0('0x3a')]:_0x267b32[_0xe8d0('0x36')];if(_0x4bcdff[_0xe8d0('0x38')][_0xe8d0('0x44')]){_0x18a478[_0xe8d0('0x45')]=[{'all':!![]}];}_0x18a478=_[_0xe8d0('0x42')]({},_0x18a478,_0x4bcdff[_0xe8d0('0x43')]);return db['SmsQueue'][_0xe8d0('0x4b')](_0x18a478)[_0xe8d0('0x29')](handleEntityNotFound(_0x3825a1,null))[_0xe8d0('0x29')](respondWithResult(_0x3825a1,null))[_0xe8d0('0x47')](handleError(_0x3825a1,null));};exports[_0xe8d0('0x4c')]=function(_0x2e4caf,_0x5a0c7e){return db['SmsQueue'][_0xe8d0('0x4c')](_0x2e4caf[_0xe8d0('0x4d')],{})[_0xe8d0('0x29')](function(_0x205933){var _0x4ed47f=_0x2e4caf[_0xe8d0('0x4e')]['get']({'plain':!![]});if(!_0x4ed47f)throw new Error(_0xe8d0('0x4f'));if(_0x4ed47f[_0xe8d0('0x50')]===_0xe8d0('0x4e')){var _0x158d24=_0x205933[_0xe8d0('0x2b')]({'plain':!![]});var _0x34efb0=_0xe8d0('0x2c');return db['UserProfileSection'][_0xe8d0('0x4b')]({'where':{'name':_0x34efb0,'userProfileId':_0x4ed47f['userProfileId']},'raw':!![]})['then'](function(_0x35138a){if(_0x35138a&&_0x35138a['autoAssociation']===0x0){return db[_0xe8d0('0x2d')]['create']({'name':_0x158d24[_0xe8d0('0x31')],'resourceId':_0x158d24['id'],'type':_0x35138a[_0xe8d0('0x31')],'sectionId':_0x35138a['id']},{})[_0xe8d0('0x29')](function(){return _0x205933;});}else{return _0x205933;}})[_0xe8d0('0x47')](function(_0x555a56){logger[_0xe8d0('0x2f')](_0xe8d0('0x51'),_0x555a56);throw _0x555a56;});}return _0x205933;})[_0xe8d0('0x29')](respondWithResult(_0x5a0c7e,0xc9))[_0xe8d0('0x47')](handleError(_0x5a0c7e,null));};exports[_0xe8d0('0x28')]=function(_0x57b77a,_0x3a7a99){if(_0x57b77a[_0xe8d0('0x4d')]['id']){delete _0x57b77a[_0xe8d0('0x4d')]['id'];}return db['SmsQueue'][_0xe8d0('0x4b')]({'where':{'id':_0x57b77a['params']['id']}})['then'](handleEntityNotFound(_0x3a7a99,null))[_0xe8d0('0x29')](saveUpdates(_0x57b77a[_0xe8d0('0x4d')],null))['then'](respondWithResult(_0x3a7a99,null))[_0xe8d0('0x47')](handleError(_0x3a7a99,null));};exports[_0xe8d0('0x2a')]=function(_0x47893d,_0x2a54c1){return db[_0xe8d0('0x32')][_0xe8d0('0x4b')]({'where':{'id':_0x47893d[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x2a54c1,null))[_0xe8d0('0x29')](removeEntity(_0x2a54c1,null))[_0xe8d0('0x47')](handleError(_0x2a54c1,null));};exports[_0xe8d0('0x53')]=function(_0x76316a,_0x51930e){return db[_0xe8d0('0x32')][_0xe8d0('0x53')]()[_0xe8d0('0x29')](respondWithResult(_0x51930e,null))[_0xe8d0('0x47')](handleError(_0x51930e,null));};exports[_0xe8d0('0x54')]=function(_0x29667c,_0x595b24,_0x4fdca4){var _0x2bb54d={'raw':!![],'where':{}},_0x5668db={},_0x3cee4e;return db[_0xe8d0('0x32')]['findOne']({'where':{'id':_0x29667c['params']['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x595b24,null))['then'](function(_0x26af63){if(_0x26af63){_0x3cee4e=_0x26af63['get']({'plain':!![]});_0x5668db[_0xe8d0('0x36')]=_[_0xe8d0('0x48')](db[_0xe8d0('0x55')]['rawAttributes']);_0x5668db[_0xe8d0('0x38')]=_[_0xe8d0('0x48')](_0x29667c['query']);_0x5668db[_0xe8d0('0x39')]=_['intersection'](_0x5668db[_0xe8d0('0x36')],_0x5668db['query']);_0x2bb54d[_0xe8d0('0x3a')]=_[_0xe8d0('0x49')](_0x5668db[_0xe8d0('0x36')],qs[_0xe8d0('0x3b')](_0x29667c[_0xe8d0('0x38')]['fields']));_0x2bb54d['attributes']=_0x2bb54d[_0xe8d0('0x3a')]['length']?_0x2bb54d[_0xe8d0('0x3a')]:_0x5668db[_0xe8d0('0x36')];if(!_0x29667c[_0xe8d0('0x38')][_0xe8d0('0x56')](_0xe8d0('0x3c'))){_0x2bb54d[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x29667c[_0xe8d0('0x38')][_0xe8d0('0x24')]);_0x2bb54d[_0xe8d0('0x23')]=qs[_0xe8d0('0x23')](_0x29667c[_0xe8d0('0x38')][_0xe8d0('0x23')]);}_0x2bb54d[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x29667c['query'][_0xe8d0('0x3e')]);_0x2bb54d[_0xe8d0('0x3f')]=qs[_0xe8d0('0x39')](_[_0xe8d0('0x57')](_0x29667c[_0xe8d0('0x38')],_0x5668db['filters']));_0x2bb54d[_0xe8d0('0x3f')][_0xe8d0('0x58')]=_0x26af63['id'];if(_0x29667c[_0xe8d0('0x38')][_0xe8d0('0x40')]){_0x2bb54d[_0xe8d0('0x3f')]=_[_0xe8d0('0x42')](_0x2bb54d[_0xe8d0('0x3f')],{'$or':_[_0xe8d0('0x37')](_0x2bb54d[_0xe8d0('0x3a')],function(_0x24be86){var _0x23955c={};_0x23955c[_0x24be86]={'$like':'%'+_0x29667c[_0xe8d0('0x38')]['filter']+'%'};return _0x23955c;})});}_0x2bb54d=_['merge']({},_0x2bb54d,_0x29667c[_0xe8d0('0x43')]);return db['UserSmsQueue'][_0xe8d0('0x46')](_0x2bb54d);}})[_0xe8d0('0x29')](function(_0x56761c){if(_0x56761c){return db[_0xe8d0('0x59')][_0xe8d0('0x5a')]({'where':{'id':_[_0xe8d0('0x37')](_0x56761c,_0xe8d0('0x5b')),'role':_0xe8d0('0x5c')},'attributes':['id',_0xe8d0('0x31'),_0xe8d0('0x5d'),_0xe8d0('0x5e'),_0xe8d0('0x5f')]});}})[_0xe8d0('0x29')](function(_0xb078d8){if(_0xb078d8){return{'count':_0xb078d8[_0xe8d0('0x22')],'rows':_[_0xe8d0('0x37')](_0xb078d8[_0xe8d0('0x60')],function(_0x623456){return{'membername':_0x623456[_0xe8d0('0x31')],'UserId':_0x623456['id'],'queue_name':_0x3cee4e[_0xe8d0('0x31')],'SmsQueueId':_0x3cee4e['id'],'interface':util[_0xe8d0('0x61')](_0xe8d0('0x62'),'SIP',_0x623456[_0xe8d0('0x31')]),'penalty':0x0,'paused':_0x623456[_0xe8d0('0x5d')],'createdAt':_0x623456[_0xe8d0('0x5f')],'updatedAt':_0x623456['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe8d0('0x29')](respondWithFilteredResult(_0x595b24,_0x2bb54d))['catch'](handleError(_0x595b24,null));};exports[_0xe8d0('0x63')]=function(_0x1c1794,_0x22791b,_0x561eb3){var _0x1bc8cf={};var _0x6fe4d5={};var _0xc94cd3;var _0x207680;return db[_0xe8d0('0x32')]['findOne']({'where':{'id':_0x1c1794[_0xe8d0('0x52')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x22791b,null))[_0xe8d0('0x29')](function(_0xe4cb93){if(_0xe4cb93){_0xc94cd3=_0xe4cb93;_0x6fe4d5[_0xe8d0('0x36')]=_[_0xe8d0('0x48')](db[_0xe8d0('0x64')][_0xe8d0('0x33')]);_0x6fe4d5['query']=_[_0xe8d0('0x48')](_0x1c1794[_0xe8d0('0x38')]);_0x6fe4d5[_0xe8d0('0x39')]=_[_0xe8d0('0x49')](_0x6fe4d5['model'],_0x6fe4d5[_0xe8d0('0x38')]);_0x1bc8cf[_0xe8d0('0x3a')]=_[_0xe8d0('0x49')](_0x6fe4d5['model'],qs[_0xe8d0('0x3b')](_0x1c1794['query'][_0xe8d0('0x3b')]));_0x1bc8cf['attributes']=_0x1bc8cf[_0xe8d0('0x3a')][_0xe8d0('0x4a')]?_0x1bc8cf[_0xe8d0('0x3a')]:_0x6fe4d5[_0xe8d0('0x36')];_0x1bc8cf[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x1c1794[_0xe8d0('0x38')][_0xe8d0('0x3e')]);_0x1bc8cf[_0xe8d0('0x3f')]=qs[_0xe8d0('0x39')](_[_0xe8d0('0x57')](_0x1c1794[_0xe8d0('0x38')],_0x6fe4d5['filters']));if(_0x1c1794[_0xe8d0('0x38')][_0xe8d0('0x40')]){_0x1bc8cf[_0xe8d0('0x3f')]=_[_0xe8d0('0x42')](_0x1bc8cf[_0xe8d0('0x3f')],{'$or':_[_0xe8d0('0x37')](_0x1bc8cf[_0xe8d0('0x3a')],function(_0x605b5f){var _0x2f9702={};_0x2f9702[_0x605b5f]={'$like':'%'+_0x1c1794[_0xe8d0('0x38')]['filter']+'%'};return _0x2f9702;})});}_0x1bc8cf=_[_0xe8d0('0x42')]({},_0x1bc8cf,_0x1c1794[_0xe8d0('0x43')]);return _0xc94cd3[_0xe8d0('0x63')](_0x1bc8cf);}})[_0xe8d0('0x29')](function(_0x255e4b){if(_0x255e4b){_0x207680=_0x255e4b['length'];if(!_0x1c1794['query'][_0xe8d0('0x56')]('nolimit')){_0x1bc8cf[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x1c1794[_0xe8d0('0x38')]['limit']);_0x1bc8cf[_0xe8d0('0x23')]=qs['offset'](_0x1c1794[_0xe8d0('0x38')][_0xe8d0('0x23')]);}return _0xc94cd3[_0xe8d0('0x63')](_0x1bc8cf);}})[_0xe8d0('0x29')](function(_0x2706e8){if(_0x2706e8){return _0x2706e8?{'count':_0x207680,'rows':_0x2706e8}:null;}})['then'](respondWithResult(_0x22791b,null))['catch'](handleError(_0x22791b,null));};exports[_0xe8d0('0x65')]=function(_0x2b5809,_0x18ec80,_0xa1163b){var _0x2bb013=_0x2b5809[_0xe8d0('0x4d')][_0xe8d0('0x66')];return db[_0xe8d0('0x64')][_0xe8d0('0x46')]({'where':{'id':_0x2bb013},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe8d0('0x67'),'attributes':['id',_0xe8d0('0x31'),_0xe8d0('0x68'),_0xe8d0('0x69'),'interface'],'raw':!![]}]})['then'](function(_0xde507a){if(_0xde507a){var _0x1c0d37=_[_0xe8d0('0x6a')](_0xde507a,function(_0x336649){var _0x38a2dc=_0x336649[_0xe8d0('0x2b')]({'plain':!![]});return _0x38a2dc[_0xe8d0('0x67')];});return db[_0xe8d0('0x32')][_0xe8d0('0x4b')]({'where':{'id':_0x2b5809[_0xe8d0('0x52')]['id']}})['then'](function(_0x1ada69){return db[_0xe8d0('0x6b')][_0xe8d0('0x6c')](function(_0x195a79){return _0x1ada69[_0xe8d0('0x65')](_0x2bb013,{'transaction':_0x195a79})[_0xe8d0('0x29')](function(){return BPromise[_0xe8d0('0x6d')](_0x1c0d37,function(_0x1b1bd3){return db[_0xe8d0('0x55')]['findOrCreate']({'where':{'UserId':_0x1b1bd3['id'],'SmsQueueId':_0x2b5809['params']['id']},'transaction':_0x195a79});});})[_0xe8d0('0x29')](function(){_0x1c0d37[_0xe8d0('0x6e')](function(_0x5763d6){socket[_0xe8d0('0x6f')](_0xe8d0('0x70'),{'UserId':_0x5763d6['id'],'SmsQueueId':_0x1ada69['id']});});});});});}})[_0xe8d0('0x29')](respondWithStatusCode(_0x18ec80,null))['catch'](handleError(_0x18ec80,null));};exports[_0xe8d0('0x71')]=function(_0x3a11f8,_0x233a5a,_0x2746db){return db['Team']['findAll']({'where':{'id':_0x3a11f8[_0xe8d0('0x38')][_0xe8d0('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe8d0('0x29')](handleEntityNotFound(_0x233a5a,null))[_0xe8d0('0x29')](function(_0x5827fa){var _0x5eaf13=_[_0xe8d0('0x37')](_0x5827fa,'id');var _0x4e192c=[];var _0x4bd847=[];var _0x44a4bd=squel[_0xe8d0('0x72')]();_0x44a4bd[_0xe8d0('0x73')](_0xe8d0('0x74'))[_0xe8d0('0x75')]('team_has_sms_queues','tq')[_0xe8d0('0x76')](_0xe8d0('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe8d0('0x3f')](_0xe8d0('0x78'),_0x3a11f8[_0xe8d0('0x52')]['id']);for(var _0x3e18af=0x0;_0x3e18af<_0x5827fa['length'];_0x3e18af+=0x1){let _0x8d5124=_0x5827fa[_0x3e18af];for(var _0x34aa23=0x0;_0x34aa23<_0x8d5124[_0xe8d0('0x67')][_0xe8d0('0x4a')];_0x34aa23+=0x1){let _0x301898=_0x8d5124[_0xe8d0('0x67')][_0x34aa23];var _0x247155=_0x44a4bd[_0xe8d0('0x79')]();_0x247155['where'](_0xe8d0('0x7a'),_0x301898['id']);_0x4bd847[_0xe8d0('0x7b')](db['sequelize']['query'](_0x247155['toString'](),{'type':db['sequelize'][_0xe8d0('0x7c')]['SELECT']})['then'](function(_0x152e76){if(_0x152e76['length']===0x1){return _0x301898['id'];}else{var _0xfac5ae=_[_0xe8d0('0x7d')](_[_0xe8d0('0x37')](_0x152e76,_0xe8d0('0x7e')),function(_0xa807b9){return _[_0xe8d0('0x7f')](_0x5eaf13,_0xa807b9);});if(_0xfac5ae){return _0x301898['id'];}}}));}}return BPromise[_0xe8d0('0x80')](_0x4bd847)[_0xe8d0('0x29')](function(_0x42bf96){_0x4e192c=_(_0x4e192c)[_0xe8d0('0x81')](_0x42bf96)[_0xe8d0('0x82')]()[_0xe8d0('0x83')]();return db[_0xe8d0('0x32')][_0xe8d0('0x4b')]({'where':{'id':_0x3a11f8[_0xe8d0('0x52')]['id']}})['then'](function(_0x2c42f4){return db['sequelize'][_0xe8d0('0x6c')](function(_0x13bee7){return _0x2c42f4[_0xe8d0('0x71')](_0x3a11f8[_0xe8d0('0x38')][_0xe8d0('0x66')],{'transaction':_0x13bee7})[_0xe8d0('0x29')](function(){if(!_[_0xe8d0('0x84')](_0x4e192c)){return _0x2c42f4[_0xe8d0('0x85')](_0x4e192c,{'transaction':_0x13bee7});}})['then'](function(){_0x4e192c[_0xe8d0('0x6e')](function(_0x2c58dc){socket[_0xe8d0('0x6f')](_0xe8d0('0x86'),{'UserId':_0x2c58dc,'SmsQueueId':_0x2c42f4['id']});});});});});});})[_0xe8d0('0x29')](respondWithStatusCode(_0x233a5a,null))['catch'](handleError(_0x233a5a,null));};exports['addAgents']=function(_0x10a10e,_0x31ca6b,_0x33f5db){return db[_0xe8d0('0x32')][_0xe8d0('0x4b')]({'where':{'id':_0x10a10e[_0xe8d0('0x52')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x31ca6b,null))[_0xe8d0('0x29')](function(_0x168d55){if(_0x168d55){return _0x168d55[_0xe8d0('0x87')](_0x10a10e[_0xe8d0('0x4d')][_0xe8d0('0x66')],_[_0xe8d0('0x88')](_0x10a10e['body'],['ids','id'])||{})[_0xe8d0('0x89')](function(_0x1e722e){for(var _0x2aedae=0x0;_0x2aedae<_0x10a10e[_0xe8d0('0x4d')][_0xe8d0('0x66')]['length'];_0x2aedae+=0x1){socket['emit'](_0xe8d0('0x70'),{'UserId':_0x10a10e['body'][_0xe8d0('0x66')][_0x2aedae],'SmsQueueId':_0x10a10e[_0xe8d0('0x52')]['id']});}return _0x1e722e;});}})[_0xe8d0('0x29')](respondWithResult(_0x31ca6b,null))[_0xe8d0('0x47')](handleError(_0x31ca6b,null));};exports[_0xe8d0('0x85')]=function(_0x3dde53,_0x13e8ca,_0x510b47){return db[_0xe8d0('0x32')][_0xe8d0('0x4b')]({'where':{'id':_0x3dde53[_0xe8d0('0x52')]['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x13e8ca,null))[_0xe8d0('0x29')](function(_0x585a9f){if(_0x585a9f){return _0x585a9f['removeAgents'](_0x3dde53[_0xe8d0('0x38')]['ids'])[_0xe8d0('0x29')](function(){if(_['isArray'](_0x3dde53[_0xe8d0('0x38')][_0xe8d0('0x66')])){for(var _0x3b08c7=0x0;_0x3b08c7<_0x3dde53['query'][_0xe8d0('0x66')][_0xe8d0('0x4a')];_0x3b08c7+=0x1){socket['emit'](_0xe8d0('0x86'),{'UserId':Number(_0x3dde53[_0xe8d0('0x38')][_0xe8d0('0x66')][_0x3b08c7]),'SmsQueueId':Number(_0x3dde53['params']['id'])});}}else{socket['emit'](_0xe8d0('0x86'),{'UserId':Number(_0x3dde53[_0xe8d0('0x38')][_0xe8d0('0x66')]),'SmsQueueId':Number(_0x3dde53['params']['id'])});}});}})[_0xe8d0('0x29')](respondWithStatusCode(_0x13e8ca,null))['catch'](handleError(_0x13e8ca,null));};exports[_0xe8d0('0x8a')]=function(_0x59dff1,_0x53aeef,_0x5d742c){var _0x20423f={};var _0x5c2609={};var _0xd9354;var _0x585c42;return db[_0xe8d0('0x32')]['findOne']({'where':{'id':_0x59dff1['params']['id']}})[_0xe8d0('0x29')](handleEntityNotFound(_0x53aeef,null))['then'](function(_0x364869){if(_0x364869){_0xd9354=_0x364869;_0x5c2609[_0xe8d0('0x36')]=_[_0xe8d0('0x48')](db[_0xe8d0('0x59')][_0xe8d0('0x33')]);_0x5c2609[_0xe8d0('0x38')]=_[_0xe8d0('0x48')](_0x59dff1[_0xe8d0('0x38')]);_0x5c2609['filters']=_[_0xe8d0('0x49')](_0x5c2609[_0xe8d0('0x36')],_0x5c2609[_0xe8d0('0x38')]);_0x20423f[_0xe8d0('0x3a')]=_['intersection'](_0x5c2609[_0xe8d0('0x36')],qs[_0xe8d0('0x3b')](_0x59dff1[_0xe8d0('0x38')][_0xe8d0('0x3b')]));_0x20423f[_0xe8d0('0x3a')]=_0x20423f[_0xe8d0('0x3a')][_0xe8d0('0x4a')]?_0x20423f['attributes']:_0x5c2609[_0xe8d0('0x36')];_0x20423f[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x59dff1[_0xe8d0('0x38')][_0xe8d0('0x3e')]);_0x20423f[_0xe8d0('0x3f')]=qs[_0xe8d0('0x39')](_[_0xe8d0('0x57')](_0x59dff1['query'],_0x5c2609[_0xe8d0('0x39')]));if(_0x59dff1[_0xe8d0('0x38')]['filter']){_0x20423f['where']=_['merge'](_0x20423f[_0xe8d0('0x3f')],{'$or':_[_0xe8d0('0x37')](_0x20423f[_0xe8d0('0x3a')],function(_0x101b26){var _0x51595b={};_0x51595b[_0x101b26]={'$like':'%'+_0x59dff1[_0xe8d0('0x38')]['filter']+'%'};return _0x51595b;})});}_0x20423f=_['merge']({},_0x20423f,_0x59dff1[_0xe8d0('0x43')]);return _0xd9354['getAgents'](_0x20423f);}})['then'](function(_0x23921f){if(_0x23921f){_0x585c42=_0x23921f['length'];if(!_0x59dff1[_0xe8d0('0x38')][_0xe8d0('0x56')]('nolimit')){_0x20423f[_0xe8d0('0x24')]=qs[_0xe8d0('0x24')](_0x59dff1['query'][_0xe8d0('0x24')]);_0x20423f[_0xe8d0('0x23')]=qs[_0xe8d0('0x23')](_0x59dff1[_0xe8d0('0x38')][_0xe8d0('0x23')]);}return _0xd9354[_0xe8d0('0x8a')](_0x20423f);}})[_0xe8d0('0x29')](function(_0x45094d){if(_0x45094d){return _0x45094d?{'count':_0x585c42,'rows':_0x45094d}:null;}})[_0xe8d0('0x29')](respondWithResult(_0x53aeef,null))[_0xe8d0('0x47')](handleError(_0x53aeef,null));}; \ No newline at end of file +var _0x038b=['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','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','SmsQueues','error','name','send','index','map','SmsQueue','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','updatedAt','format','%s/%s','SIP','smsPause','createdAt','getTeams','Team','addTeams','ids','online','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel'];(function(_0x22ebb7,_0x1530fa){var _0x22d742=function(_0x5e1b86){while(--_0x5e1b86){_0x22ebb7['push'](_0x22ebb7['shift']());}};_0x22d742(++_0x1530fa);}(_0x038b,0x114));var _0xb038=function(_0x53575f,_0x44c2ff){_0x53575f=_0x53575f-0x0;var _0x13c8b2=_0x038b[_0x53575f];return _0x13c8b2;};'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);function respondWithStatusCode(_0x13acc7,_0x13f893){_0x13f893=_0x13f893||0xcc;return function(_0x535109){if(_0x535109){return _0x13acc7[_0xb038('0x1c')](_0x13f893);}return _0x13acc7[_0xb038('0x1d')](_0x13f893)[_0xb038('0x1e')]();};}function respondWithResult(_0x39323e,_0xdef213){_0xdef213=_0xdef213||0xc8;return function(_0x2b4173){if(_0x2b4173){return _0x39323e['status'](_0xdef213)[_0xb038('0x1f')](_0x2b4173);}};}function respondWithFilteredResult(_0x3039b0,_0xd1fae0){return function(_0x3b095a){if(_0x3b095a){var _0x4aa892=_0x3b095a[_0xb038('0x20')],_0x49b237=_0xd1fae0[_0xb038('0x21')],_0x20cea2=_0xd1fae0['offset']+_0xd1fae0[_0xb038('0x22')],_0x3f48e6;if(_0x20cea2>=_0x4aa892){_0x20cea2=_0x4aa892;_0x3f48e6=0xc8;}else{_0x3f48e6=0xce;}_0x3039b0[_0xb038('0x1d')](_0x3f48e6);return _0x3039b0[_0xb038('0x23')](_0xb038('0x24'),_0x49b237+'-'+_0x20cea2+'/'+_0x4aa892)[_0xb038('0x1f')](_0x3b095a);}return null;};}function patchUpdates(_0x55be53){return function(_0x2e0369){try{jsonpatch[_0xb038('0x25')](_0x2e0369,_0x55be53,!![]);}catch(_0x2481e2){return BPromise[_0xb038('0x26')](_0x2481e2);}return _0x2e0369['save']();};}function saveUpdates(_0x2812c9,_0x1b7505){return function(_0x4bbf38){if(_0x4bbf38){return _0x4bbf38[_0xb038('0x27')](_0x2812c9)[_0xb038('0x28')](function(_0x573f93){return _0x573f93;});}return null;};}function removeEntity(_0x241329,_0x5337e3){return function(_0x25ff46){if(_0x25ff46){return _0x25ff46[_0xb038('0x29')]()[_0xb038('0x28')](function(){var _0x1df7c4=_0x25ff46[_0xb038('0x2a')]({'plain':!![]});var _0xe4ceda=_0xb038('0x2b');return db['UserProfileResource'][_0xb038('0x29')]({'where':{'type':_0xe4ceda,'resourceId':_0x1df7c4['id']}})[_0xb038('0x28')](function(){return _0x25ff46;});})[_0xb038('0x28')](function(){_0x241329['status'](0xcc)[_0xb038('0x1e')]();});}};}function handleEntityNotFound(_0x3af191,_0x1fa72d){return function(_0x47ff40){if(!_0x47ff40){_0x3af191[_0xb038('0x1c')](0x194);}return _0x47ff40;};}function handleError(_0x2855a6,_0x28a6a9){_0x28a6a9=_0x28a6a9||0x1f4;return function(_0x12b3b6){logger[_0xb038('0x2c')](_0x12b3b6['stack']);if(_0x12b3b6[_0xb038('0x2d')]){delete _0x12b3b6[_0xb038('0x2d')];}_0x2855a6[_0xb038('0x1d')](_0x28a6a9)[_0xb038('0x2e')](_0x12b3b6);};}exports[_0xb038('0x2f')]=function(_0xbc8958,_0x29a0d7){var _0x3695aa={},_0xe4eb72={},_0x22fb2c={'count':0x0,'rows':[]};var _0x1599c9=_[_0xb038('0x30')](db[_0xb038('0x31')]['rawAttributes'],function(_0x1d807a){return{'name':_0x1d807a['fieldName'],'type':_0x1d807a[_0xb038('0x32')][_0xb038('0x33')]};});_0xe4eb72[_0xb038('0x34')]=_[_0xb038('0x30')](_0x1599c9,_0xb038('0x2d'));_0xe4eb72[_0xb038('0x35')]=_[_0xb038('0x36')](_0xbc8958[_0xb038('0x35')]);_0xe4eb72[_0xb038('0x37')]=_[_0xb038('0x38')](_0xe4eb72['model'],_0xe4eb72[_0xb038('0x35')]);_0x3695aa[_0xb038('0x39')]=_[_0xb038('0x38')](_0xe4eb72['model'],qs['fields'](_0xbc8958['query'][_0xb038('0x3a')]));_0x3695aa[_0xb038('0x39')]=_0x3695aa[_0xb038('0x39')][_0xb038('0x3b')]?_0x3695aa[_0xb038('0x39')]:_0xe4eb72[_0xb038('0x34')];if(!_0xbc8958['query'][_0xb038('0x3c')](_0xb038('0x3d'))){_0x3695aa[_0xb038('0x22')]=qs[_0xb038('0x22')](_0xbc8958['query'][_0xb038('0x22')]);_0x3695aa[_0xb038('0x21')]=qs['offset'](_0xbc8958['query'][_0xb038('0x21')]);}_0x3695aa[_0xb038('0x3e')]=qs[_0xb038('0x3f')](_0xbc8958[_0xb038('0x35')][_0xb038('0x3f')]);_0x3695aa['where']=qs[_0xb038('0x37')](_[_0xb038('0x40')](_0xbc8958[_0xb038('0x35')],_0xe4eb72[_0xb038('0x37')]),_0x1599c9);if(_0xbc8958['query'][_0xb038('0x41')]){_0x3695aa[_0xb038('0x42')]=_[_0xb038('0x43')](_0x3695aa['where'],{'$or':_[_0xb038('0x30')](_0x1599c9,function(_0x594c0d){if(_0x594c0d[_0xb038('0x32')]!==_0xb038('0x44')){var _0x3ac1db={};_0x3ac1db[_0x594c0d['name']]={'$like':'%'+_0xbc8958[_0xb038('0x35')][_0xb038('0x41')]+'%'};return _0x3ac1db;}})});}_0x3695aa=_[_0xb038('0x43')]({},_0x3695aa,_0xbc8958['options']);var _0x1a164e={'where':_0x3695aa[_0xb038('0x42')]};return db[_0xb038('0x31')][_0xb038('0x20')](_0x1a164e)['then'](function(_0x28b922){_0x22fb2c[_0xb038('0x20')]=_0x28b922;if(_0xbc8958[_0xb038('0x35')][_0xb038('0x45')]){_0x3695aa['include']=[{'all':!![]}];}return db[_0xb038('0x31')][_0xb038('0x46')](_0x3695aa);})['then'](function(_0x207fb5){_0x22fb2c[_0xb038('0x47')]=_0x207fb5;return _0x22fb2c;})[_0xb038('0x28')](respondWithFilteredResult(_0x29a0d7,_0x3695aa))['catch'](handleError(_0x29a0d7,null));};exports[_0xb038('0x48')]=function(_0x317e51,_0x5495c7){var _0x527eaa={'raw':!![],'where':{'id':_0x317e51[_0xb038('0x49')]['id']}},_0x28f1c8={};_0x28f1c8[_0xb038('0x34')]=_[_0xb038('0x36')](db[_0xb038('0x31')][_0xb038('0x4a')]);_0x28f1c8[_0xb038('0x35')]=_[_0xb038('0x36')](_0x317e51['query']);_0x28f1c8['filters']=_['intersection'](_0x28f1c8[_0xb038('0x34')],_0x28f1c8[_0xb038('0x35')]);_0x527eaa['attributes']=_[_0xb038('0x38')](_0x28f1c8[_0xb038('0x34')],qs[_0xb038('0x3a')](_0x317e51['query'][_0xb038('0x3a')]));_0x527eaa['attributes']=_0x527eaa['attributes'][_0xb038('0x3b')]?_0x527eaa[_0xb038('0x39')]:_0x28f1c8[_0xb038('0x34')];if(_0x317e51[_0xb038('0x35')][_0xb038('0x45')]){_0x527eaa[_0xb038('0x4b')]=[{'all':!![]}];}_0x527eaa=_[_0xb038('0x43')]({},_0x527eaa,_0x317e51[_0xb038('0x4c')]);return db[_0xb038('0x31')][_0xb038('0x4d')](_0x527eaa)['then'](handleEntityNotFound(_0x5495c7,null))[_0xb038('0x28')](respondWithResult(_0x5495c7,null))[_0xb038('0x4e')](handleError(_0x5495c7,null));};exports['create']=function(_0x906c9c,_0x19ab72){return db['SmsQueue'][_0xb038('0x4f')](_0x906c9c[_0xb038('0x50')],{})[_0xb038('0x28')](function(_0x32bd6b){var _0x369088=_0x906c9c[_0xb038('0x51')][_0xb038('0x2a')]({'plain':!![]});if(!_0x369088)throw new Error(_0xb038('0x52'));if(_0x369088[_0xb038('0x53')]==='user'){var _0x62daba=_0x32bd6b[_0xb038('0x2a')]({'plain':!![]});var _0x3fda13=_0xb038('0x2b');return db[_0xb038('0x54')][_0xb038('0x4d')]({'where':{'name':_0x3fda13,'userProfileId':_0x369088['userProfileId']},'raw':!![]})[_0xb038('0x28')](function(_0x2f3622){if(_0x2f3622&&_0x2f3622[_0xb038('0x55')]===0x0){return db[_0xb038('0x56')][_0xb038('0x4f')]({'name':_0x62daba[_0xb038('0x2d')],'resourceId':_0x62daba['id'],'type':_0x2f3622[_0xb038('0x2d')],'sectionId':_0x2f3622['id']},{})['then'](function(){return _0x32bd6b;});}else{return _0x32bd6b;}})[_0xb038('0x4e')](function(_0x5c4a79){logger[_0xb038('0x2c')](_0xb038('0x57'),_0x5c4a79);throw _0x5c4a79;});}return _0x32bd6b;})[_0xb038('0x28')](respondWithResult(_0x19ab72,0xc9))[_0xb038('0x4e')](handleError(_0x19ab72,null));};exports[_0xb038('0x27')]=function(_0x5ea7df,_0x5b10cb){if(_0x5ea7df['body']['id']){delete _0x5ea7df[_0xb038('0x50')]['id'];}return db[_0xb038('0x31')][_0xb038('0x4d')]({'where':{'id':_0x5ea7df[_0xb038('0x49')]['id']}})[_0xb038('0x28')](handleEntityNotFound(_0x5b10cb,null))[_0xb038('0x28')](saveUpdates(_0x5ea7df['body'],null))[_0xb038('0x28')](respondWithResult(_0x5b10cb,null))[_0xb038('0x4e')](handleError(_0x5b10cb,null));};exports['destroy']=function(_0x5b27d3,_0xf2907b){return db['SmsQueue'][_0xb038('0x4d')]({'where':{'id':_0x5b27d3['params']['id']}})[_0xb038('0x28')](handleEntityNotFound(_0xf2907b,null))[_0xb038('0x28')](removeEntity(_0xf2907b,null))[_0xb038('0x4e')](handleError(_0xf2907b,null));};exports[_0xb038('0x58')]=function(_0x4ee38b,_0x32aea0){return db[_0xb038('0x31')][_0xb038('0x58')]()[_0xb038('0x28')](respondWithResult(_0x32aea0,null))[_0xb038('0x4e')](handleError(_0x32aea0,null));};exports[_0xb038('0x59')]=function(_0x14a553,_0x401f4c,_0x41623a){var _0x1f524e={'raw':!![],'where':{}},_0x1c9d66={},_0x12aba5;return db['SmsQueue'][_0xb038('0x5a')]({'where':{'id':_0x14a553[_0xb038('0x49')]['id']}})[_0xb038('0x28')](handleEntityNotFound(_0x401f4c,null))[_0xb038('0x28')](function(_0x38417c){if(_0x38417c){_0x12aba5=_0x38417c['get']({'plain':!![]});_0x1c9d66[_0xb038('0x34')]=_['keys'](db[_0xb038('0x5b')][_0xb038('0x4a')]);_0x1c9d66['query']=_[_0xb038('0x36')](_0x14a553[_0xb038('0x35')]);_0x1c9d66[_0xb038('0x37')]=_[_0xb038('0x38')](_0x1c9d66[_0xb038('0x34')],_0x1c9d66[_0xb038('0x35')]);_0x1f524e[_0xb038('0x39')]=_[_0xb038('0x38')](_0x1c9d66[_0xb038('0x34')],qs[_0xb038('0x3a')](_0x14a553['query'][_0xb038('0x3a')]));_0x1f524e['attributes']=_0x1f524e[_0xb038('0x39')][_0xb038('0x3b')]?_0x1f524e[_0xb038('0x39')]:_0x1c9d66[_0xb038('0x34')];if(!_0x14a553[_0xb038('0x35')][_0xb038('0x3c')](_0xb038('0x3d'))){_0x1f524e['limit']=qs['limit'](_0x14a553[_0xb038('0x35')][_0xb038('0x22')]);_0x1f524e[_0xb038('0x21')]=qs['offset'](_0x14a553['query'][_0xb038('0x21')]);}_0x1f524e['order']=qs[_0xb038('0x3f')](_0x14a553['query'][_0xb038('0x3f')]);_0x1f524e['where']=qs[_0xb038('0x37')](_[_0xb038('0x40')](_0x14a553[_0xb038('0x35')],_0x1c9d66[_0xb038('0x37')]));_0x1f524e[_0xb038('0x42')][_0xb038('0x5c')]=_0x38417c['id'];if(_0x14a553['query']['filter']){_0x1f524e[_0xb038('0x42')]=_['merge'](_0x1f524e[_0xb038('0x42')],{'$or':_[_0xb038('0x30')](_0x1f524e[_0xb038('0x39')],function(_0x538690){var _0x3071c8={};_0x3071c8[_0x538690]={'$like':'%'+_0x14a553['query'][_0xb038('0x41')]+'%'};return _0x3071c8;})});}_0x1f524e=_[_0xb038('0x43')]({},_0x1f524e,_0x14a553[_0xb038('0x4c')]);return db[_0xb038('0x5b')][_0xb038('0x46')](_0x1f524e);}})[_0xb038('0x28')](function(_0x3e2b92){if(_0x3e2b92){return db[_0xb038('0x5d')][_0xb038('0x5e')]({'where':{'id':_['map'](_0x3e2b92,'UserId'),'role':'agent'},'attributes':['id',_0xb038('0x2d'),'smsPause',_0xb038('0x5f'),'createdAt']});}})[_0xb038('0x28')](function(_0x240e88){if(_0x240e88){return{'count':_0x240e88[_0xb038('0x20')],'rows':_[_0xb038('0x30')](_0x240e88[_0xb038('0x47')],function(_0x45a91a){return{'membername':_0x45a91a[_0xb038('0x2d')],'UserId':_0x45a91a['id'],'queue_name':_0x12aba5[_0xb038('0x2d')],'SmsQueueId':_0x12aba5['id'],'interface':util[_0xb038('0x60')](_0xb038('0x61'),_0xb038('0x62'),_0x45a91a[_0xb038('0x2d')]),'penalty':0x0,'paused':_0x45a91a[_0xb038('0x63')],'createdAt':_0x45a91a[_0xb038('0x64')],'updatedAt':_0x45a91a[_0xb038('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb038('0x28')](respondWithFilteredResult(_0x401f4c,_0x1f524e))[_0xb038('0x4e')](handleError(_0x401f4c,null));};exports[_0xb038('0x65')]=function(_0x1f9a30,_0x5d0f38,_0x23adc3){var _0x3c194d={};var _0x22e5ba={};var _0x16bb58;var _0xdaacfe;return db['SmsQueue'][_0xb038('0x5a')]({'where':{'id':_0x1f9a30[_0xb038('0x49')]['id']}})[_0xb038('0x28')](handleEntityNotFound(_0x5d0f38,null))[_0xb038('0x28')](function(_0x34e222){if(_0x34e222){_0x16bb58=_0x34e222;_0x22e5ba[_0xb038('0x34')]=_[_0xb038('0x36')](db[_0xb038('0x66')][_0xb038('0x4a')]);_0x22e5ba['query']=_['keys'](_0x1f9a30[_0xb038('0x35')]);_0x22e5ba['filters']=_[_0xb038('0x38')](_0x22e5ba['model'],_0x22e5ba['query']);_0x3c194d['attributes']=_[_0xb038('0x38')](_0x22e5ba[_0xb038('0x34')],qs['fields'](_0x1f9a30[_0xb038('0x35')][_0xb038('0x3a')]));_0x3c194d[_0xb038('0x39')]=_0x3c194d[_0xb038('0x39')][_0xb038('0x3b')]?_0x3c194d[_0xb038('0x39')]:_0x22e5ba[_0xb038('0x34')];_0x3c194d[_0xb038('0x3e')]=qs[_0xb038('0x3f')](_0x1f9a30[_0xb038('0x35')]['sort']);_0x3c194d[_0xb038('0x42')]=qs[_0xb038('0x37')](_[_0xb038('0x40')](_0x1f9a30[_0xb038('0x35')],_0x22e5ba[_0xb038('0x37')]));if(_0x1f9a30[_0xb038('0x35')][_0xb038('0x41')]){_0x3c194d['where']=_[_0xb038('0x43')](_0x3c194d[_0xb038('0x42')],{'$or':_[_0xb038('0x30')](_0x3c194d['attributes'],function(_0x551fcc){var _0x2adf3b={};_0x2adf3b[_0x551fcc]={'$like':'%'+_0x1f9a30[_0xb038('0x35')][_0xb038('0x41')]+'%'};return _0x2adf3b;})});}_0x3c194d=_['merge']({},_0x3c194d,_0x1f9a30[_0xb038('0x4c')]);return _0x16bb58[_0xb038('0x65')](_0x3c194d);}})['then'](function(_0x2e6db4){if(_0x2e6db4){_0xdaacfe=_0x2e6db4[_0xb038('0x3b')];if(!_0x1f9a30[_0xb038('0x35')][_0xb038('0x3c')](_0xb038('0x3d'))){_0x3c194d[_0xb038('0x22')]=qs[_0xb038('0x22')](_0x1f9a30[_0xb038('0x35')][_0xb038('0x22')]);_0x3c194d[_0xb038('0x21')]=qs[_0xb038('0x21')](_0x1f9a30[_0xb038('0x35')][_0xb038('0x21')]);}return _0x16bb58[_0xb038('0x65')](_0x3c194d);}})['then'](function(_0x17a3c9){if(_0x17a3c9){return _0x17a3c9?{'count':_0xdaacfe,'rows':_0x17a3c9}:null;}})[_0xb038('0x28')](respondWithResult(_0x5d0f38,null))[_0xb038('0x4e')](handleError(_0x5d0f38,null));};exports[_0xb038('0x67')]=function(_0x623d4e,_0x1df908,_0x3ce0a2){var _0xf9caa5=_0x623d4e['body'][_0xb038('0x68')];return db[_0xb038('0x66')]['findAll']({'where':{'id':_0xf9caa5},'attributes':['id'],'include':[{'model':db[_0xb038('0x5d')],'as':'Agents','attributes':['id','name',_0xb038('0x69'),'voicePause',_0xb038('0x6a')],'raw':!![]}]})['then'](function(_0x3493da){if(_0x3493da){var _0x1d15df=_[_0xb038('0x6b')](_0x3493da,function(_0xfe866a){var _0x367475=_0xfe866a[_0xb038('0x2a')]({'plain':!![]});return _0x367475[_0xb038('0x6c')];});return db[_0xb038('0x31')]['find']({'where':{'id':_0x623d4e['params']['id']}})[_0xb038('0x28')](function(_0x3365d2){return db[_0xb038('0x6d')][_0xb038('0x6e')](function(_0x4c505f){return _0x3365d2[_0xb038('0x67')](_0xf9caa5,{'transaction':_0x4c505f})[_0xb038('0x28')](function(){return BPromise[_0xb038('0x6f')](_0x1d15df,function(_0x29b84d){return db[_0xb038('0x5b')][_0xb038('0x70')]({'where':{'UserId':_0x29b84d['id'],'SmsQueueId':_0x623d4e[_0xb038('0x49')]['id']},'transaction':_0x4c505f});});})[_0xb038('0x28')](function(){_0x1d15df[_0xb038('0x71')](function(_0x38a66b){socket['emit']('userSmsQueue:save',{'UserId':_0x38a66b['id'],'SmsQueueId':_0x3365d2['id']});});});});});}})[_0xb038('0x28')](respondWithStatusCode(_0x1df908,null))[_0xb038('0x4e')](handleError(_0x1df908,null));};exports[_0xb038('0x72')]=function(_0x291660,_0x3ee569,_0x5fbd02){return db[_0xb038('0x66')]['findAll']({'where':{'id':_0x291660[_0xb038('0x35')][_0xb038('0x68')]},'attributes':['id'],'include':[{'model':db[_0xb038('0x5d')],'as':_0xb038('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xb038('0x28')](handleEntityNotFound(_0x3ee569,null))[_0xb038('0x28')](function(_0x4de432){var _0x451fe5=_[_0xb038('0x30')](_0x4de432,'id');var _0x8bd4c0=[];var _0x3cecdf=[];var _0x4383e6=squel[_0xb038('0x73')]();_0x4383e6[_0xb038('0x74')](_0xb038('0x75'))[_0xb038('0x76')](_0xb038('0x77'),'tq')[_0xb038('0x78')](_0xb038('0x79'),'ut',_0xb038('0x7a'))[_0xb038('0x42')](_0xb038('0x7b'),_0x291660[_0xb038('0x49')]['id']);for(var _0x5448e3=0x0;_0x5448e3<_0x4de432['length'];_0x5448e3+=0x1){let _0x183048=_0x4de432[_0x5448e3];for(var _0x17870b=0x0;_0x17870b<_0x183048[_0xb038('0x6c')]['length'];_0x17870b+=0x1){let _0x283e2b=_0x183048[_0xb038('0x6c')][_0x17870b];var _0xe1fce=_0x4383e6[_0xb038('0x7c')]();_0xe1fce['where']('ut.UserId\x20=\x20?',_0x283e2b['id']);_0x3cecdf[_0xb038('0x7d')](db[_0xb038('0x6d')]['query'](_0xe1fce[_0xb038('0x7e')](),{'type':db[_0xb038('0x6d')][_0xb038('0x7f')][_0xb038('0x80')]})['then'](function(_0xb204f3){if(_0xb204f3[_0xb038('0x3b')]===0x1){return _0x283e2b['id'];}else{var _0x44e0d6=_[_0xb038('0x81')](_[_0xb038('0x30')](_0xb204f3,_0xb038('0x82')),function(_0x108021){return _['includes'](_0x451fe5,_0x108021);});if(_0x44e0d6){return _0x283e2b['id'];}}}));}}return BPromise[_0xb038('0x83')](_0x3cecdf)[_0xb038('0x28')](function(_0x1746c2){_0x8bd4c0=_(_0x8bd4c0)['union'](_0x1746c2)[_0xb038('0x84')]()['value']();return db[_0xb038('0x31')]['find']({'where':{'id':_0x291660[_0xb038('0x49')]['id']}})[_0xb038('0x28')](function(_0x301811){return db['sequelize']['transaction'](function(_0x50a6f3){return _0x301811[_0xb038('0x72')](_0x291660[_0xb038('0x35')][_0xb038('0x68')],{'transaction':_0x50a6f3})['then'](function(){if(!_[_0xb038('0x85')](_0x8bd4c0)){return _0x301811['removeAgents'](_0x8bd4c0,{'transaction':_0x50a6f3});}})[_0xb038('0x28')](function(){_0x8bd4c0['forEach'](function(_0x5d4094){socket[_0xb038('0x86')](_0xb038('0x87'),{'UserId':_0x5d4094,'SmsQueueId':_0x301811['id']});});});});});});})[_0xb038('0x28')](respondWithStatusCode(_0x3ee569,null))[_0xb038('0x4e')](handleError(_0x3ee569,null));};exports[_0xb038('0x88')]=function(_0x6afa65,_0x468a93,_0x4aaf53){return db[_0xb038('0x31')]['find']({'where':{'id':_0x6afa65['params']['id']}})[_0xb038('0x28')](handleEntityNotFound(_0x468a93,null))[_0xb038('0x28')](function(_0x2b161d){if(_0x2b161d){return _0x2b161d[_0xb038('0x88')](_0x6afa65[_0xb038('0x50')][_0xb038('0x68')],_[_0xb038('0x89')](_0x6afa65['body'],[_0xb038('0x68'),'id'])||{})[_0xb038('0x8a')](function(_0x23e0f3){for(var _0x180714=0x0;_0x180714<_0x6afa65[_0xb038('0x50')]['ids'][_0xb038('0x3b')];_0x180714+=0x1){socket[_0xb038('0x86')](_0xb038('0x8b'),{'UserId':_0x6afa65[_0xb038('0x50')]['ids'][_0x180714],'SmsQueueId':_0x6afa65[_0xb038('0x49')]['id']});}return _0x23e0f3;});}})[_0xb038('0x28')](respondWithResult(_0x468a93,null))['catch'](handleError(_0x468a93,null));};exports[_0xb038('0x8c')]=function(_0x538b4d,_0x35aba3,_0x529198){return db['SmsQueue']['find']({'where':{'id':_0x538b4d[_0xb038('0x49')]['id']}})['then'](handleEntityNotFound(_0x35aba3,null))[_0xb038('0x28')](function(_0xc95faf){if(_0xc95faf){return _0xc95faf[_0xb038('0x8c')](_0x538b4d[_0xb038('0x35')][_0xb038('0x68')])[_0xb038('0x28')](function(){if(_[_0xb038('0x8d')](_0x538b4d[_0xb038('0x35')]['ids'])){for(var _0x4fd98e=0x0;_0x4fd98e<_0x538b4d[_0xb038('0x35')]['ids']['length'];_0x4fd98e+=0x1){socket['emit'](_0xb038('0x87'),{'UserId':Number(_0x538b4d[_0xb038('0x35')][_0xb038('0x68')][_0x4fd98e]),'SmsQueueId':Number(_0x538b4d['params']['id'])});}}else{socket[_0xb038('0x86')](_0xb038('0x87'),{'UserId':Number(_0x538b4d[_0xb038('0x35')][_0xb038('0x68')]),'SmsQueueId':Number(_0x538b4d['params']['id'])});}});}})[_0xb038('0x28')](respondWithStatusCode(_0x35aba3,null))[_0xb038('0x4e')](handleError(_0x35aba3,null));};exports[_0xb038('0x8e')]=function(_0x48d1fa,_0x38cd65,_0x19771f){var _0x52c780={};var _0x16fa8d={};var _0x5e30a7;var _0x55be63;return db[_0xb038('0x31')][_0xb038('0x5a')]({'where':{'id':_0x48d1fa['params']['id']}})['then'](handleEntityNotFound(_0x38cd65,null))[_0xb038('0x28')](function(_0x38c614){if(_0x38c614){_0x5e30a7=_0x38c614;_0x16fa8d[_0xb038('0x34')]=_[_0xb038('0x36')](db[_0xb038('0x5d')][_0xb038('0x4a')]);_0x16fa8d[_0xb038('0x35')]=_[_0xb038('0x36')](_0x48d1fa[_0xb038('0x35')]);_0x16fa8d[_0xb038('0x37')]=_[_0xb038('0x38')](_0x16fa8d[_0xb038('0x34')],_0x16fa8d[_0xb038('0x35')]);_0x52c780[_0xb038('0x39')]=_[_0xb038('0x38')](_0x16fa8d[_0xb038('0x34')],qs[_0xb038('0x3a')](_0x48d1fa[_0xb038('0x35')]['fields']));_0x52c780[_0xb038('0x39')]=_0x52c780['attributes']['length']?_0x52c780['attributes']:_0x16fa8d[_0xb038('0x34')];_0x52c780[_0xb038('0x3e')]=qs[_0xb038('0x3f')](_0x48d1fa[_0xb038('0x35')][_0xb038('0x3f')]);_0x52c780[_0xb038('0x42')]=qs[_0xb038('0x37')](_[_0xb038('0x40')](_0x48d1fa[_0xb038('0x35')],_0x16fa8d['filters']));if(_0x48d1fa[_0xb038('0x35')][_0xb038('0x41')]){_0x52c780[_0xb038('0x42')]=_[_0xb038('0x43')](_0x52c780['where'],{'$or':_[_0xb038('0x30')](_0x52c780['attributes'],function(_0x326fa3){var _0xf3e0ab={};_0xf3e0ab[_0x326fa3]={'$like':'%'+_0x48d1fa[_0xb038('0x35')][_0xb038('0x41')]+'%'};return _0xf3e0ab;})});}_0x52c780=_['merge']({},_0x52c780,_0x48d1fa[_0xb038('0x4c')]);return _0x5e30a7[_0xb038('0x8e')](_0x52c780);}})[_0xb038('0x28')](function(_0x3fc071){if(_0x3fc071){_0x55be63=_0x3fc071[_0xb038('0x3b')];if(!_0x48d1fa[_0xb038('0x35')][_0xb038('0x3c')]('nolimit')){_0x52c780['limit']=qs[_0xb038('0x22')](_0x48d1fa[_0xb038('0x35')]['limit']);_0x52c780['offset']=qs[_0xb038('0x21')](_0x48d1fa['query'][_0xb038('0x21')]);}return _0x5e30a7[_0xb038('0x8e')](_0x52c780);}})[_0xb038('0x28')](function(_0x1f42a2){if(_0x1f42a2){return _0x1f42a2?{'count':_0x55be63,'rows':_0x1f42a2}:null;}})['then'](respondWithResult(_0x38cd65,null))['catch'](handleError(_0x38cd65,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index a9d64ef..9ca3bac 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 _0x9345=['SmsQueue','setMaxListeners','save','update','hasOwnProperty','exports'];(function(_0x788d89,_0x45ab3b){var _0x3dedf9=function(_0x18a6a9){while(--_0x18a6a9){_0x788d89['push'](_0x788d89['shift']());}};_0x3dedf9(++_0x45ab3b);}(_0x9345,0x126));var _0x5934=function(_0x1622a0,_0x2b55a9){_0x1622a0=_0x1622a0-0x0;var _0x2a2308=_0x9345[_0x1622a0];return _0x2a2308;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x5934('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5934('0x1')](0x0);var events={'afterCreate':_0x5934('0x2'),'afterUpdate':_0x5934('0x3'),'afterDestroy':'remove'};function emitEvent(_0x258c0e){return function(_0x127649,_0x1f9313,_0x210d18){SmsQueueEvents['emit'](_0x258c0e+':'+_0x127649['id'],_0x127649);SmsQueueEvents['emit'](_0x258c0e,_0x127649);_0x210d18(null);};}for(var e in events){if(events[_0x5934('0x4')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x5934('0x5')]=SmsQueueEvents; \ No newline at end of file +var _0x9356=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0x35a3c2,_0x556835){var _0x3dde7f=function(_0x554478){while(--_0x554478){_0x35a3c2['push'](_0x35a3c2['shift']());}};_0x3dde7f(++_0x556835);}(_0x9356,0xf7));var _0x6935=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x9356[_0x481bf7];return _0x461787;};'use strict';var EventEmitter=require(_0x6935('0x0'));var SmsQueue=require(_0x6935('0x1'))['db'][_0x6935('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6935('0x3')](0x0);var events={'afterCreate':_0x6935('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x30e82a){return function(_0x24f702,_0x53e924,_0x2077c0){SmsQueueEvents[_0x6935('0x5')](_0x30e82a+':'+_0x24f702['id'],_0x24f702);SmsQueueEvents[_0x6935('0x5')](_0x30e82a,_0x24f702);_0x2077c0(null);};}for(var e in events){if(events[_0x6935('0x6')](e)){var event=events[e];SmsQueue[_0x6935('0x7')](e,emitEvent(event));}}module[_0x6935('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 900800c..90ee1dc 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 _0x9233=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x1c1c9b,_0x3d9058){var _0x1316e9=function(_0x29fb17){while(--_0x29fb17){_0x1c1c9b['push'](_0x1c1c9b['shift']());}};_0x1316e9(++_0x3d9058);}(_0x9233,0x183));var _0x3923=function(_0x6289ef,_0x1490c1){_0x6289ef=_0x6289ef-0x0;var _0x4f83a0=_0x9233[_0x6289ef];return _0x4f83a0;};'use strict';var _=require(_0x3923('0x0'));var util=require(_0x3923('0x1'));var logger=require(_0x3923('0x2'))(_0x3923('0x3'));var moment=require(_0x3923('0x4'));var BPromise=require(_0x3923('0x5'));var rp=require(_0x3923('0x6'));var fs=require('fs');var path=require(_0x3923('0x7'));var rimraf=require(_0x3923('0x8'));var config=require(_0x3923('0x9'));var attributes=require(_0x3923('0xa'));module[_0x3923('0xb')]=function(_0x518e05,_0x3acbf5){return _0x518e05[_0x3923('0xc')](_0x3923('0xd'),attributes,{'tableName':_0x3923('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4677=['rimraf','../../config/environment','./smsQueue.attributes','define','sms_queues','util','api','moment','request-promise','path'];(function(_0x53c653,_0x422a6f){var _0x32b399=function(_0x2c9918){while(--_0x2c9918){_0x53c653['push'](_0x53c653['shift']());}};_0x32b399(++_0x422a6f);}(_0x4677,0x159));var _0x7467=function(_0x1951d,_0x309a7a){_0x1951d=_0x1951d-0x0;var _0x46fdfa=_0x4677[_0x1951d];return _0x46fdfa;};'use strict';var _=require('lodash');var util=require(_0x7467('0x0'));var logger=require('../../config/logger')(_0x7467('0x1'));var moment=require(_0x7467('0x2'));var BPromise=require('bluebird');var rp=require(_0x7467('0x3'));var fs=require('fs');var path=require(_0x7467('0x4'));var rimraf=require(_0x7467('0x5'));var config=require(_0x7467('0x6'));var attributes=require(_0x7467('0x7'));module['exports']=function(_0x1683ef,_0x2af1a1){return _0x1683ef[_0x7467('0x8')]('SmsQueue',attributes,{'tableName':_0x7467('0x9'),'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 7f6a7f7..6f61527 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 _0xe46c=['attributes','include','model','map','GetSmsQueue','ShowSmsQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','catch','SmsQueue','findAll','raw','options','where'];(function(_0x2e6c2d,_0x3e6da2){var _0x348513=function(_0x585efc){while(--_0x585efc){_0x2e6c2d['push'](_0x2e6c2d['shift']());}};_0x348513(++_0x3e6da2);}(_0xe46c,0x126));var _0xce46=function(_0x2e5119,_0x53722d){_0x2e5119=_0x2e5119-0x0;var _0x17d08d=_0xe46c[_0x2e5119];return _0x17d08d;};'use strict';var _=require(_0xce46('0x0'));var util=require('util');var moment=require(_0xce46('0x1'));var BPromise=require(_0xce46('0x2'));var rs=require(_0xce46('0x3'));var fs=require('fs');var Redis=require(_0xce46('0x4'));var db=require(_0xce46('0x5'))['db'];var utils=require(_0xce46('0x6'));var logger=require('../../config/logger')(_0xce46('0x7'));var config=require(_0xce46('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xce46('0x9')][_0xce46('0xa')]({'port':0x232a});config[_0xce46('0xb')]=_[_0xce46('0xc')](config[_0xce46('0xb')],{'host':_0xce46('0xd'),'port':0x18eb});var socket=require(_0xce46('0xe'))(new Redis(config[_0xce46('0xb')]));require(_0xce46('0xf'))[_0xce46('0x10')](socket);function respondWithRpcPromise(_0x422d6b,_0x58413a,_0x2bdf05){return new BPromise(function(_0x25cbb4,_0x32d1b7){return client[_0xce46('0x11')](_0x422d6b,_0x2bdf05)[_0xce46('0x12')](function(_0x31f996){logger[_0xce46('0x13')]('SmsQueue,\x20%s,\x20%s',_0x58413a,'request\x20sent');logger[_0xce46('0x14')](_0xce46('0x15'),_0x58413a,_0xce46('0x16'),JSON[_0xce46('0x17')](_0x31f996));if(_0x31f996[_0xce46('0x18')]){if(_0x31f996[_0xce46('0x18')][_0xce46('0x19')]===0x1f4){logger[_0xce46('0x18')](_0xce46('0x1a'),_0x58413a,_0x31f996[_0xce46('0x18')][_0xce46('0x1b')]);return _0x32d1b7(_0x31f996[_0xce46('0x18')][_0xce46('0x1b')]);}logger['error'](_0xce46('0x1a'),_0x58413a,_0x31f996[_0xce46('0x18')][_0xce46('0x1b')]);return _0x25cbb4(_0x31f996[_0xce46('0x18')][_0xce46('0x1b')]);}else{logger[_0xce46('0x13')]('SmsQueue,\x20%s,\x20%s',_0x58413a,_0xce46('0x16'));_0x25cbb4(_0x31f996['result'][_0xce46('0x1b')]);}})[_0xce46('0x1c')](function(_0x102724){logger[_0xce46('0x18')](_0xce46('0x1a'),_0x58413a,_0x102724);_0x32d1b7(_0x102724);});});}exports['GetSmsQueue']=function(_0xbf13d2){var _0x14e8bb=this;return new Promise(function(_0x3733a5,_0x43ed75){return db[_0xce46('0x1d')][_0xce46('0x1e')]({'raw':_0xbf13d2['options']?_0xbf13d2['options'][_0xce46('0x1f')]===undefined?!![]:![]:!![],'where':_0xbf13d2[_0xce46('0x20')]?_0xbf13d2['options'][_0xce46('0x21')]||null:null,'attributes':_0xbf13d2[_0xce46('0x20')]?_0xbf13d2[_0xce46('0x20')][_0xce46('0x22')]||null:null,'limit':_0xbf13d2[_0xce46('0x20')]?_0xbf13d2['options']['limit']||null:null,'include':_0xbf13d2[_0xce46('0x20')]?_0xbf13d2[_0xce46('0x20')]['include']?_['map'](_0xbf13d2[_0xce46('0x20')][_0xce46('0x23')],function(_0x3e3ed6){return{'model':db[_0x3e3ed6[_0xce46('0x24')]],'as':_0x3e3ed6['as'],'attributes':_0x3e3ed6[_0xce46('0x22')],'include':_0x3e3ed6[_0xce46('0x23')]?_['map'](_0x3e3ed6[_0xce46('0x23')],function(_0x199126){return{'model':db[_0x199126['model']],'as':_0x199126['as'],'attributes':_0x199126['attributes'],'include':_0x199126['include']?_[_0xce46('0x25')](_0x199126[_0xce46('0x23')],function(_0xf0af25){return{'model':db[_0xf0af25[_0xce46('0x24')]],'as':_0xf0af25['as'],'attributes':_0xf0af25[_0xce46('0x22')]};}):[]};}):[]};}):[]:[]})[_0xce46('0x12')](function(_0x4c6405){logger[_0xce46('0x13')](_0xce46('0x26'),_0xbf13d2);logger['debug'](_0xce46('0x26'),_0xbf13d2,JSON[_0xce46('0x17')](_0x4c6405));_0x3733a5(_0x4c6405);})[_0xce46('0x1c')](function(_0x38a9c8){logger['error'](_0xce46('0x26'),_0x38a9c8[_0xce46('0x1b')],_0xbf13d2);_0x43ed75(_0x14e8bb[_0xce46('0x18')](0x1f4,_0x38a9c8['message']));});});};exports[_0xce46('0x27')]=function(_0x356d80){var _0x136fa9=this;return new Promise(function(_0x1aab51,_0x3517eb){return db[_0xce46('0x1d')][_0xce46('0x28')]({'raw':_0x356d80[_0xce46('0x20')]?_0x356d80[_0xce46('0x20')][_0xce46('0x1f')]===undefined?!![]:![]:!![],'where':_0x356d80[_0xce46('0x20')]?_0x356d80[_0xce46('0x20')]['where']||null:null,'attributes':_0x356d80[_0xce46('0x20')]?_0x356d80['options']['attributes']||null:null,'include':_0x356d80[_0xce46('0x20')]?_0x356d80[_0xce46('0x20')][_0xce46('0x23')]?_[_0xce46('0x25')](_0x356d80[_0xce46('0x20')][_0xce46('0x23')],function(_0x3e213d){return{'model':db[_0x3e213d['model']],'as':_0x3e213d['as'],'attributes':_0x3e213d[_0xce46('0x22')],'include':_0x3e213d['include']?_[_0xce46('0x25')](_0x3e213d['include'],function(_0x57b618){return{'model':db[_0x57b618[_0xce46('0x24')]],'as':_0x57b618['as'],'attributes':_0x57b618[_0xce46('0x22')],'include':_0x57b618['include']?_[_0xce46('0x25')](_0x57b618['include'],function(_0x3ddfeb){return{'model':db[_0x3ddfeb['model']],'as':_0x3ddfeb['as'],'attributes':_0x3ddfeb[_0xce46('0x22')]};}):[]};}):[]};}):[]:[]})[_0xce46('0x12')](function(_0x4f5548){logger['info'](_0xce46('0x27'),_0x356d80);logger['debug'](_0xce46('0x27'),_0x356d80,JSON[_0xce46('0x17')](_0x4f5548));_0x1aab51(_0x4f5548);})[_0xce46('0x1c')](function(_0x27b5f9){logger[_0xce46('0x18')]('ShowSmsQueue',_0x27b5f9['message'],_0x356d80);_0x3517eb(_0x136fa9[_0xce46('0x18')](0x1f4,_0x27b5f9[_0xce46('0x1b')]));});});}; \ No newline at end of file +var _0x173f=['request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','where','limit','include','map','model','attributes','ShowSmsQueue','raw','debug','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x173f,0x17c));var _0xf173=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x173f[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require('lodash');var util=require(_0xf173('0x0'));var moment=require(_0xf173('0x1'));var BPromise=require('bluebird');var rs=require(_0xf173('0x2'));var fs=require('fs');var Redis=require(_0xf173('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf173('0x4'));var config=require(_0xf173('0x5'));var jayson=require(_0xf173('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xf173('0x7')]=_[_0xf173('0x8')](config[_0xf173('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xf173('0x9'))(new Redis(config[_0xf173('0x7')]));require(_0xf173('0xa'))[_0xf173('0xb')](socket);function respondWithRpcPromise(_0x56962b,_0x6bbe82,_0x2c5b35){return new BPromise(function(_0x41ed0d,_0x4b7560){return client[_0xf173('0xc')](_0x56962b,_0x2c5b35)[_0xf173('0xd')](function(_0x1c2a0d){logger[_0xf173('0xe')](_0xf173('0xf'),_0x6bbe82,_0xf173('0x10'));logger['debug'](_0xf173('0x11'),_0x6bbe82,'request\x20sent',JSON[_0xf173('0x12')](_0x1c2a0d));if(_0x1c2a0d[_0xf173('0x13')]){if(_0x1c2a0d[_0xf173('0x13')][_0xf173('0x14')]===0x1f4){logger[_0xf173('0x13')](_0xf173('0xf'),_0x6bbe82,_0x1c2a0d[_0xf173('0x13')]['message']);return _0x4b7560(_0x1c2a0d[_0xf173('0x13')]['message']);}logger[_0xf173('0x13')](_0xf173('0xf'),_0x6bbe82,_0x1c2a0d[_0xf173('0x13')][_0xf173('0x15')]);return _0x41ed0d(_0x1c2a0d[_0xf173('0x13')][_0xf173('0x15')]);}else{logger[_0xf173('0xe')](_0xf173('0xf'),_0x6bbe82,_0xf173('0x10'));_0x41ed0d(_0x1c2a0d['result'][_0xf173('0x15')]);}})[_0xf173('0x16')](function(_0x12e0ca){logger[_0xf173('0x13')]('SmsQueue,\x20%s,\x20%s',_0x6bbe82,_0x12e0ca);_0x4b7560(_0x12e0ca);});});}exports[_0xf173('0x17')]=function(_0xbf1333){var _0x1cd0b8=this;return new Promise(function(_0x6e59ff,_0x317f8f){return db[_0xf173('0x18')][_0xf173('0x19')]({'raw':_0xbf1333[_0xf173('0x1a')]?_0xbf1333[_0xf173('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xbf1333['options']?_0xbf1333[_0xf173('0x1a')][_0xf173('0x1b')]||null:null,'attributes':_0xbf1333[_0xf173('0x1a')]?_0xbf1333[_0xf173('0x1a')]['attributes']||null:null,'limit':_0xbf1333[_0xf173('0x1a')]?_0xbf1333[_0xf173('0x1a')][_0xf173('0x1c')]||null:null,'include':_0xbf1333[_0xf173('0x1a')]?_0xbf1333[_0xf173('0x1a')][_0xf173('0x1d')]?_[_0xf173('0x1e')](_0xbf1333[_0xf173('0x1a')][_0xf173('0x1d')],function(_0xa0c844){return{'model':db[_0xa0c844[_0xf173('0x1f')]],'as':_0xa0c844['as'],'attributes':_0xa0c844['attributes'],'include':_0xa0c844['include']?_[_0xf173('0x1e')](_0xa0c844[_0xf173('0x1d')],function(_0x16e4eb){return{'model':db[_0x16e4eb[_0xf173('0x1f')]],'as':_0x16e4eb['as'],'attributes':_0x16e4eb[_0xf173('0x20')],'include':_0x16e4eb[_0xf173('0x1d')]?_[_0xf173('0x1e')](_0x16e4eb['include'],function(_0x40651d){return{'model':db[_0x40651d['model']],'as':_0x40651d['as'],'attributes':_0x40651d[_0xf173('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf173('0xd')](function(_0x75e923){logger[_0xf173('0xe')]('GetSmsQueue',_0xbf1333);logger['debug']('GetSmsQueue',_0xbf1333,JSON[_0xf173('0x12')](_0x75e923));_0x6e59ff(_0x75e923);})[_0xf173('0x16')](function(_0x348a0e){logger[_0xf173('0x13')](_0xf173('0x17'),_0x348a0e[_0xf173('0x15')],_0xbf1333);_0x317f8f(_0x1cd0b8[_0xf173('0x13')](0x1f4,_0x348a0e['message']));});});};exports[_0xf173('0x21')]=function(_0x24f5f4){var _0x72d5b=this;return new Promise(function(_0x297369,_0x1454ea){return db[_0xf173('0x18')]['find']({'raw':_0x24f5f4['options']?_0x24f5f4[_0xf173('0x1a')][_0xf173('0x22')]===undefined?!![]:![]:!![],'where':_0x24f5f4[_0xf173('0x1a')]?_0x24f5f4[_0xf173('0x1a')][_0xf173('0x1b')]||null:null,'attributes':_0x24f5f4[_0xf173('0x1a')]?_0x24f5f4[_0xf173('0x1a')]['attributes']||null:null,'include':_0x24f5f4['options']?_0x24f5f4[_0xf173('0x1a')][_0xf173('0x1d')]?_[_0xf173('0x1e')](_0x24f5f4['options'][_0xf173('0x1d')],function(_0x3a07ee){return{'model':db[_0x3a07ee[_0xf173('0x1f')]],'as':_0x3a07ee['as'],'attributes':_0x3a07ee[_0xf173('0x20')],'include':_0x3a07ee['include']?_[_0xf173('0x1e')](_0x3a07ee[_0xf173('0x1d')],function(_0x3e3af0){return{'model':db[_0x3e3af0['model']],'as':_0x3e3af0['as'],'attributes':_0x3e3af0[_0xf173('0x20')],'include':_0x3e3af0['include']?_[_0xf173('0x1e')](_0x3e3af0[_0xf173('0x1d')],function(_0x2f28a2){return{'model':db[_0x2f28a2['model']],'as':_0x2f28a2['as'],'attributes':_0x2f28a2['attributes']};}):[]};}):[]};}):[]:[]})[_0xf173('0xd')](function(_0x3900be){logger[_0xf173('0xe')](_0xf173('0x21'),_0x24f5f4);logger[_0xf173('0x23')]('ShowSmsQueue',_0x24f5f4,JSON[_0xf173('0x12')](_0x3900be));_0x297369(_0x3900be);})['catch'](function(_0x4e7674){logger[_0xf173('0x13')]('ShowSmsQueue',_0x4e7674[_0xf173('0x15')],_0x24f5f4);_0x1454ea(_0x72d5b[_0xf173('0x13')](0x1f4,_0x4e7674[_0xf173('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 946a699..0ff0af2 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 _0xf874=['register','length','./smsQueue.events','remove','update','removeListener'];(function(_0xb1b7b,_0x13eaa0){var _0x339c3b=function(_0x5ca153){while(--_0x5ca153){_0xb1b7b['push'](_0xb1b7b['shift']());}};_0x339c3b(++_0x13eaa0);}(_0xf874,0x158));var _0x4f87=function(_0x172c62,_0x2afd0a){_0x172c62=_0x172c62-0x0;var _0x37a5cc=_0xf874[_0x172c62];return _0x37a5cc;};'use strict';var SmsQueueEvents=require(_0x4f87('0x0'));var events=['save',_0x4f87('0x1'),_0x4f87('0x2')];function createListener(_0x3c3299,_0x10c618){return function(_0x34a351){_0x10c618['emit'](_0x3c3299,_0x34a351);};}function removeListener(_0x1f2667,_0x1fc9c8){return function(){SmsQueueEvents[_0x4f87('0x3')](_0x1f2667,_0x1fc9c8);};}exports[_0x4f87('0x4')]=function(_0x55a576){for(var _0x4017a1=0x0,_0x5bff2c=events[_0x4f87('0x5')];_0x4017a1<_0x5bff2c;_0x4017a1++){var _0x32d4d8=events[_0x4017a1];var _0x4899fd=createListener('smsQueue:'+_0x32d4d8,_0x55a576);SmsQueueEvents['on'](_0x32d4d8,_0x4899fd);}}; \ No newline at end of file +var _0x0dea=['save','update','emit','register','length','smsQueue:','./smsQueue.events'];(function(_0x24c99e,_0x13a39b){var _0xfffd89=function(_0x59cfa4){while(--_0x59cfa4){_0x24c99e['push'](_0x24c99e['shift']());}};_0xfffd89(++_0x13a39b);}(_0x0dea,0x13a));var _0xa0de=function(_0x205e83,_0x2df5a4){_0x205e83=_0x205e83-0x0;var _0x10bb19=_0x0dea[_0x205e83];return _0x10bb19;};'use strict';var SmsQueueEvents=require(_0xa0de('0x0'));var events=[_0xa0de('0x1'),'remove',_0xa0de('0x2')];function createListener(_0x157486,_0x3e41fc){return function(_0x43ac20){_0x3e41fc[_0xa0de('0x3')](_0x157486,_0x43ac20);};}function removeListener(_0x5747ac,_0x49a9fa){return function(){SmsQueueEvents['removeListener'](_0x5747ac,_0x49a9fa);};}exports[_0xa0de('0x4')]=function(_0x4f0bbf){for(var _0x3e3915=0x0,_0x1aec69=events[_0xa0de('0x5')];_0x3e3915<_0x1aec69;_0x3e3915++){var _0x1ce6d0=events[_0x3e3915];var _0xe4c723=createListener(_0xa0de('0x6')+_0x1ce6d0,_0x4f0bbf);SmsQueueEvents['on'](_0x1ce6d0,_0xe4c723);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 2788d13..a8ceff2 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 _0xfb45=['destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','update','delete'];(function(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_0xfb45,0x1a1));var _0x5fb4=function(_0xc97e0f,_0x1162a8){_0xc97e0f=_0xc97e0f-0x0;var _0x2f7556=_0xfb45[_0xc97e0f];return _0x2f7556;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5fb4('0x0'));var timeout=require('connect-timeout');var express=require(_0x5fb4('0x1'));var router=express[_0x5fb4('0x2')]();var auth=require(_0x5fb4('0x3'));var interaction=require(_0x5fb4('0x4'));var config=require(_0x5fb4('0x5'));var controller=require(_0x5fb4('0x6'));router[_0x5fb4('0x7')]('/',auth[_0x5fb4('0x8')](),controller['index']);router['get']('/describe',auth[_0x5fb4('0x8')](),controller[_0x5fb4('0x9')]);router[_0x5fb4('0x7')](_0x5fb4('0xa'),auth[_0x5fb4('0x8')](),controller['show']);router[_0x5fb4('0xb')]('/',auth[_0x5fb4('0x8')](),controller[_0x5fb4('0xc')]);router['put']('/:id',auth[_0x5fb4('0x8')](),controller[_0x5fb4('0xd')]);router[_0x5fb4('0xe')](_0x5fb4('0xa'),auth[_0x5fb4('0x8')](),controller[_0x5fb4('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc141=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc141,0x1dd));var _0x1c14=function(_0x3af76b,_0x3ff964){_0x3af76b=_0x3af76b-0x0;var _0x441064=_0xc141[_0x3af76b];return _0x441064;};'use strict';var multer=require(_0x1c14('0x0'));var util=require(_0x1c14('0x1'));var path=require('path');var timeout=require(_0x1c14('0x2'));var express=require(_0x1c14('0x3'));var router=express['Router']();var auth=require(_0x1c14('0x4'));var interaction=require(_0x1c14('0x5'));var config=require(_0x1c14('0x6'));var controller=require(_0x1c14('0x7'));router['get']('/',auth[_0x1c14('0x8')](),controller[_0x1c14('0x9')]);router[_0x1c14('0xa')]('/describe',auth[_0x1c14('0x8')](),controller[_0x1c14('0xb')]);router[_0x1c14('0xa')](_0x1c14('0xc'),auth[_0x1c14('0x8')](),controller[_0x1c14('0xd')]);router[_0x1c14('0xe')]('/',auth[_0x1c14('0x8')](),controller[_0x1c14('0xf')]);router[_0x1c14('0x10')](_0x1c14('0xc'),auth[_0x1c14('0x8')](),controller[_0x1c14('0x11')]);router['delete'](_0x1c14('0xc'),auth[_0x1c14('0x8')](),controller[_0x1c14('0x12')]);module[_0x1c14('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ad864c8..c593f2e 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 _0x4b54=['STRING','DATE','sequelize','exports'];(function(_0x14b627,_0x1061c1){var _0x182d5e=function(_0x302826){while(--_0x302826){_0x14b627['push'](_0x14b627['shift']());}};_0x182d5e(++_0x1061c1);}(_0x4b54,0x1a2));var _0x44b5=function(_0xeb3257,_0xfa4e63){_0xeb3257=_0xeb3257-0x0;var _0x426c59=_0x4b54[_0xeb3257];return _0x426c59;};'use strict';var moment=require('moment');var Sequelize=require(_0x44b5('0x0'));module[_0x44b5('0x1')]={'uniqueid':{'type':Sequelize[_0x44b5('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x44b5('0x2')]},'joinAt':{'type':Sequelize[_0x44b5('0x3')]},'leaveAt':{'type':Sequelize[_0x44b5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x44b5('0x3')]},'reason':{'type':Sequelize[_0x44b5('0x2')]}}; \ No newline at end of file +var _0xeae3=['sequelize','exports','STRING','DATE','moment'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0xeae3,0x12b));var _0x3eae=function(_0x4b8fc7,_0x5022fc){_0x4b8fc7=_0x4b8fc7-0x0;var _0x249f4a=_0xeae3[_0x4b8fc7];return _0x249f4a;};'use strict';var moment=require(_0x3eae('0x0'));var Sequelize=require(_0x3eae('0x1'));module[_0x3eae('0x2')]={'uniqueid':{'type':Sequelize[_0x3eae('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3eae('0x3')]},'joinAt':{'type':Sequelize[_0x3eae('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3eae('0x4')]},'reason':{'type':Sequelize[_0x3eae('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 32717b1..ee08920 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 _0xd75e=['count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','show','params','includeAll','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','status','json'];(function(_0x15ef0e,_0x5b728b){var _0x500fc6=function(_0x4e64d9){while(--_0x4e64d9){_0x15ef0e['push'](_0x15ef0e['shift']());}};_0x500fc6(++_0x5b728b);}(_0xd75e,0x16e));var _0xed75=function(_0x1fef4a,_0x66135a){_0x1fef4a=_0x1fef4a-0x0;var _0x29c5cc=_0xd75e[_0x1fef4a];return _0x29c5cc;};'use strict';var pdf=require(_0xed75('0x0'));var emlformat=require(_0xed75('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xed75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xed75('0x3'));var BPromise=require(_0xed75('0x4'));var Mustache=require(_0xed75('0x5'));var util=require(_0xed75('0x6'));var path=require(_0xed75('0x7'));var sox=require(_0xed75('0x8'));var csv=require(_0xed75('0x9'));var ejs=require(_0xed75('0xa'));var fs=require('fs');var _=require(_0xed75('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xed75('0xc'));var deskjs=require(_0xed75('0xd'));var toCsv=require(_0xed75('0x9'));var querystring=require(_0xed75('0xe'));var Papa=require(_0xed75('0xf'));var Redis=require(_0xed75('0x10'));var authService=require(_0xed75('0x11'));var qs=require(_0xed75('0x12'));var as=require(_0xed75('0x13'));var hardwareService=require(_0xed75('0x14'));var logger=require(_0xed75('0x15'))(_0xed75('0x16'));var utils=require(_0xed75('0x17'));var config=require(_0xed75('0x18'));var licenseUtil=require(_0xed75('0x19'));var db=require(_0xed75('0x1a'))['db'];function respondWithStatusCode(_0x26eb79,_0x2ab5c3){_0x2ab5c3=_0x2ab5c3||0xcc;return function(_0x40f405){if(_0x40f405){return _0x26eb79['sendStatus'](_0x2ab5c3);}return _0x26eb79[_0xed75('0x1b')](_0x2ab5c3)['end']();};}function respondWithResult(_0x1601bb,_0x5e49a7){_0x5e49a7=_0x5e49a7||0xc8;return function(_0x34adbe){if(_0x34adbe){return _0x1601bb[_0xed75('0x1b')](_0x5e49a7)[_0xed75('0x1c')](_0x34adbe);}};}function respondWithFilteredResult(_0x43bec3,_0x444d71){return function(_0x28ab1b){if(_0x28ab1b){var _0x192bac=_0x28ab1b[_0xed75('0x1d')],_0x410303=_0x444d71[_0xed75('0x1e')],_0xbbd51=_0x444d71[_0xed75('0x1e')]+_0x444d71[_0xed75('0x1f')],_0xde35f9;if(_0xbbd51>=_0x192bac){_0xbbd51=_0x192bac;_0xde35f9=0xc8;}else{_0xde35f9=0xce;}_0x43bec3[_0xed75('0x1b')](_0xde35f9);return _0x43bec3[_0xed75('0x20')](_0xed75('0x21'),_0x410303+'-'+_0xbbd51+'/'+_0x192bac)['json'](_0x28ab1b);}return null;};}function patchUpdates(_0x2fb9d1){return function(_0x4318cd){try{jsonpatch[_0xed75('0x22')](_0x4318cd,_0x2fb9d1,!![]);}catch(_0x1f670d){return BPromise[_0xed75('0x23')](_0x1f670d);}return _0x4318cd[_0xed75('0x24')]();};}function saveUpdates(_0x58c3ae,_0x240534){return function(_0xaebee0){if(_0xaebee0){return _0xaebee0[_0xed75('0x25')](_0x58c3ae)[_0xed75('0x26')](function(_0x994e63){return _0x994e63;});}return null;};}function removeEntity(_0x2e9585,_0x5a4b43){return function(_0x20d882){if(_0x20d882){return _0x20d882[_0xed75('0x27')]()['then'](function(){_0x2e9585[_0xed75('0x1b')](0xcc)[_0xed75('0x28')]();});}};}function handleEntityNotFound(_0x26d25b,_0xafe91c){return function(_0x4b66e2){if(!_0x4b66e2){_0x26d25b['sendStatus'](0x194);}return _0x4b66e2;};}function handleError(_0xe7a89b,_0x3f75e4){_0x3f75e4=_0x3f75e4||0x1f4;return function(_0x31bb47){logger['error'](_0x31bb47[_0xed75('0x29')]);if(_0x31bb47[_0xed75('0x2a')]){delete _0x31bb47[_0xed75('0x2a')];}_0xe7a89b[_0xed75('0x1b')](_0x3f75e4)[_0xed75('0x2b')](_0x31bb47);};}exports[_0xed75('0x2c')]=function(_0x49b7ea,_0x2ec7b5){var _0x3ca06c={},_0x5ef36f={},_0x4a3bf9={'count':0x0,'rows':[]};var _0x38aded=_[_0xed75('0x2d')](db[_0xed75('0x2e')][_0xed75('0x2f')],function(_0x204842){return{'name':_0x204842[_0xed75('0x30')],'type':_0x204842[_0xed75('0x31')][_0xed75('0x32')]};});_0x5ef36f[_0xed75('0x33')]=_[_0xed75('0x2d')](_0x38aded,_0xed75('0x2a'));_0x5ef36f[_0xed75('0x34')]=_[_0xed75('0x35')](_0x49b7ea[_0xed75('0x34')]);_0x5ef36f[_0xed75('0x36')]=_[_0xed75('0x37')](_0x5ef36f['model'],_0x5ef36f['query']);_0x3ca06c[_0xed75('0x38')]=_[_0xed75('0x37')](_0x5ef36f[_0xed75('0x33')],qs[_0xed75('0x39')](_0x49b7ea[_0xed75('0x34')][_0xed75('0x39')]));_0x3ca06c['attributes']=_0x3ca06c[_0xed75('0x38')][_0xed75('0x3a')]?_0x3ca06c[_0xed75('0x38')]:_0x5ef36f[_0xed75('0x33')];if(!_0x49b7ea[_0xed75('0x34')][_0xed75('0x3b')](_0xed75('0x3c'))){_0x3ca06c[_0xed75('0x1f')]=qs[_0xed75('0x1f')](_0x49b7ea[_0xed75('0x34')][_0xed75('0x1f')]);_0x3ca06c['offset']=qs[_0xed75('0x1e')](_0x49b7ea[_0xed75('0x34')][_0xed75('0x1e')]);}_0x3ca06c[_0xed75('0x3d')]=qs['sort'](_0x49b7ea['query'][_0xed75('0x3e')]);_0x3ca06c[_0xed75('0x3f')]=qs[_0xed75('0x36')](_[_0xed75('0x40')](_0x49b7ea[_0xed75('0x34')],_0x5ef36f[_0xed75('0x36')]),_0x38aded);if(_0x49b7ea[_0xed75('0x34')]['filter']){_0x3ca06c['where']=_[_0xed75('0x41')](_0x3ca06c[_0xed75('0x3f')],{'$or':_['map'](_0x38aded,function(_0x5c1af5){if(_0x5c1af5[_0xed75('0x31')]!==_0xed75('0x42')){var _0x1e87df={};_0x1e87df[_0x5c1af5[_0xed75('0x2a')]]={'$like':'%'+_0x49b7ea['query'][_0xed75('0x43')]+'%'};return _0x1e87df;}})});}_0x3ca06c=_[_0xed75('0x41')]({},_0x3ca06c,_0x49b7ea[_0xed75('0x44')]);var _0x392010={'where':_0x3ca06c[_0xed75('0x3f')]};return db[_0xed75('0x2e')][_0xed75('0x1d')](_0x392010)[_0xed75('0x26')](function(_0x2c8910){_0x4a3bf9['count']=_0x2c8910;if(_0x49b7ea['query']['includeAll']){_0x3ca06c[_0xed75('0x45')]=[{'all':!![]}];}return db[_0xed75('0x2e')]['findAll'](_0x3ca06c);})[_0xed75('0x26')](function(_0x2deb94){_0x4a3bf9[_0xed75('0x46')]=_0x2deb94;return _0x4a3bf9;})[_0xed75('0x26')](respondWithFilteredResult(_0x2ec7b5,_0x3ca06c))['catch'](handleError(_0x2ec7b5,null));};exports[_0xed75('0x47')]=function(_0x5da413,_0x46105a){var _0x37b6ab={'raw':!![],'where':{'id':_0x5da413[_0xed75('0x48')]['id']}},_0x587cdc={};_0x587cdc['model']=_[_0xed75('0x35')](db['SmsQueueReport'][_0xed75('0x2f')]);_0x587cdc[_0xed75('0x34')]=_[_0xed75('0x35')](_0x5da413['query']);_0x587cdc[_0xed75('0x36')]=_[_0xed75('0x37')](_0x587cdc['model'],_0x587cdc[_0xed75('0x34')]);_0x37b6ab[_0xed75('0x38')]=_['intersection'](_0x587cdc[_0xed75('0x33')],qs['fields'](_0x5da413[_0xed75('0x34')][_0xed75('0x39')]));_0x37b6ab['attributes']=_0x37b6ab[_0xed75('0x38')][_0xed75('0x3a')]?_0x37b6ab[_0xed75('0x38')]:_0x587cdc[_0xed75('0x33')];if(_0x5da413[_0xed75('0x34')][_0xed75('0x49')]){_0x37b6ab[_0xed75('0x45')]=[{'all':!![]}];}_0x37b6ab=_[_0xed75('0x41')]({},_0x37b6ab,_0x5da413[_0xed75('0x44')]);return db[_0xed75('0x2e')][_0xed75('0x4a')](_0x37b6ab)['then'](handleEntityNotFound(_0x46105a,null))['then'](respondWithResult(_0x46105a,null))[_0xed75('0x4b')](handleError(_0x46105a,null));};exports['create']=function(_0xafceb7,_0x2dc74c){return db[_0xed75('0x2e')][_0xed75('0x4c')](_0xafceb7['body'],{})[_0xed75('0x26')](respondWithResult(_0x2dc74c,0xc9))[_0xed75('0x4b')](handleError(_0x2dc74c,null));};exports[_0xed75('0x25')]=function(_0x203dd4,_0x5b0097){if(_0x203dd4[_0xed75('0x4d')]['id']){delete _0x203dd4[_0xed75('0x4d')]['id'];}return db[_0xed75('0x2e')][_0xed75('0x4a')]({'where':{'id':_0x203dd4[_0xed75('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b0097,null))[_0xed75('0x26')](saveUpdates(_0x203dd4['body'],null))[_0xed75('0x26')](respondWithResult(_0x5b0097,null))['catch'](handleError(_0x5b0097,null));};exports['destroy']=function(_0x937f5c,_0x2fa497){return db[_0xed75('0x2e')][_0xed75('0x4a')]({'where':{'id':_0x937f5c[_0xed75('0x48')]['id']}})[_0xed75('0x26')](handleEntityNotFound(_0x2fa497,null))['then'](removeEntity(_0x2fa497,null))[_0xed75('0x4b')](handleError(_0x2fa497,null));};exports[_0xed75('0x4e')]=function(_0xaa6398,_0x1b4244){return db[_0xed75('0x2e')][_0xed75('0x4e')]()['then'](respondWithResult(_0x1b4244,null))[_0xed75('0x4b')](handleError(_0x1b4244,null));}; \ No newline at end of file +var _0xb87c=['body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','merge','catch','create'];(function(_0x1fa785,_0x53d0ec){var _0x2cca61=function(_0x4e1346){while(--_0x4e1346){_0x1fa785['push'](_0x1fa785['shift']());}};_0x2cca61(++_0x53d0ec);}(_0xb87c,0x99));var _0xcb87=function(_0x183eee,_0x70cf96){_0x183eee=_0x183eee-0x0;var _0x1a54a7=_0xb87c[_0x183eee];return _0x1a54a7;};'use strict';var pdf=require(_0xcb87('0x0'));var emlformat=require(_0xcb87('0x1'));var rimraf=require(_0xcb87('0x2'));var zipdir=require(_0xcb87('0x3'));var jsonpatch=require(_0xcb87('0x4'));var rp=require(_0xcb87('0x5'));var moment=require(_0xcb87('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xcb87('0x7'));var util=require(_0xcb87('0x8'));var path=require(_0xcb87('0x9'));var sox=require('sox');var csv=require(_0xcb87('0xa'));var ejs=require(_0xcb87('0xb'));var fs=require('fs');var _=require(_0xcb87('0xc'));var squel=require('squel');var crypto=require(_0xcb87('0xd'));var jsforce=require(_0xcb87('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcb87('0xa'));var querystring=require(_0xcb87('0xf'));var Papa=require(_0xcb87('0x10'));var Redis=require(_0xcb87('0x11'));var authService=require(_0xcb87('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcb87('0x13'));var hardwareService=require(_0xcb87('0x14'));var logger=require(_0xcb87('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xcb87('0x16'));var licenseUtil=require(_0xcb87('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b7092,_0x198843){_0x198843=_0x198843||0xcc;return function(_0x413fcf){if(_0x413fcf){return _0x2b7092[_0xcb87('0x18')](_0x198843);}return _0x2b7092[_0xcb87('0x19')](_0x198843)[_0xcb87('0x1a')]();};}function respondWithResult(_0x53ed0b,_0x11e9d9){_0x11e9d9=_0x11e9d9||0xc8;return function(_0x81bed4){if(_0x81bed4){return _0x53ed0b[_0xcb87('0x19')](_0x11e9d9)['json'](_0x81bed4);}};}function respondWithFilteredResult(_0x25dd7b,_0x40414d){return function(_0x177dd2){if(_0x177dd2){var _0x5578c2=_0x177dd2[_0xcb87('0x1b')],_0x2b4628=_0x40414d['offset'],_0x378836=_0x40414d['offset']+_0x40414d['limit'],_0x3e881a;if(_0x378836>=_0x5578c2){_0x378836=_0x5578c2;_0x3e881a=0xc8;}else{_0x3e881a=0xce;}_0x25dd7b[_0xcb87('0x19')](_0x3e881a);return _0x25dd7b[_0xcb87('0x1c')](_0xcb87('0x1d'),_0x2b4628+'-'+_0x378836+'/'+_0x5578c2)[_0xcb87('0x1e')](_0x177dd2);}return null;};}function patchUpdates(_0x519ef6){return function(_0x2b0244){try{jsonpatch[_0xcb87('0x1f')](_0x2b0244,_0x519ef6,!![]);}catch(_0x46e827){return BPromise[_0xcb87('0x20')](_0x46e827);}return _0x2b0244[_0xcb87('0x21')]();};}function saveUpdates(_0x571d93,_0x2cab4f){return function(_0x3cce5a){if(_0x3cce5a){return _0x3cce5a[_0xcb87('0x22')](_0x571d93)[_0xcb87('0x23')](function(_0x233262){return _0x233262;});}return null;};}function removeEntity(_0x23ba12,_0x35a8f5){return function(_0x326a25){if(_0x326a25){return _0x326a25[_0xcb87('0x24')]()['then'](function(){_0x23ba12[_0xcb87('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x684528,_0x549390){return function(_0x5b2760){if(!_0x5b2760){_0x684528[_0xcb87('0x18')](0x194);}return _0x5b2760;};}function handleError(_0x5b71ab,_0x2953ec){_0x2953ec=_0x2953ec||0x1f4;return function(_0x3f9fd9){logger[_0xcb87('0x25')](_0x3f9fd9[_0xcb87('0x26')]);if(_0x3f9fd9[_0xcb87('0x27')]){delete _0x3f9fd9[_0xcb87('0x27')];}_0x5b71ab['status'](_0x2953ec)[_0xcb87('0x28')](_0x3f9fd9);};}exports[_0xcb87('0x29')]=function(_0x13557a,_0x410343){var _0x210346={},_0x410947={},_0xf95aae={'count':0x0,'rows':[]};var _0x2eec7b=_[_0xcb87('0x2a')](db[_0xcb87('0x2b')][_0xcb87('0x2c')],function(_0xa8a66e){return{'name':_0xa8a66e['fieldName'],'type':_0xa8a66e[_0xcb87('0x2d')]['key']};});_0x410947['model']=_[_0xcb87('0x2a')](_0x2eec7b,_0xcb87('0x27'));_0x410947[_0xcb87('0x2e')]=_[_0xcb87('0x2f')](_0x13557a['query']);_0x410947[_0xcb87('0x30')]=_[_0xcb87('0x31')](_0x410947[_0xcb87('0x32')],_0x410947[_0xcb87('0x2e')]);_0x210346[_0xcb87('0x33')]=_[_0xcb87('0x31')](_0x410947['model'],qs[_0xcb87('0x34')](_0x13557a[_0xcb87('0x2e')][_0xcb87('0x34')]));_0x210346['attributes']=_0x210346[_0xcb87('0x33')][_0xcb87('0x35')]?_0x210346[_0xcb87('0x33')]:_0x410947[_0xcb87('0x32')];if(!_0x13557a[_0xcb87('0x2e')][_0xcb87('0x36')](_0xcb87('0x37'))){_0x210346[_0xcb87('0x38')]=qs[_0xcb87('0x38')](_0x13557a['query'][_0xcb87('0x38')]);_0x210346['offset']=qs[_0xcb87('0x39')](_0x13557a[_0xcb87('0x2e')]['offset']);}_0x210346[_0xcb87('0x3a')]=qs[_0xcb87('0x3b')](_0x13557a[_0xcb87('0x2e')][_0xcb87('0x3b')]);_0x210346[_0xcb87('0x3c')]=qs[_0xcb87('0x30')](_['pick'](_0x13557a[_0xcb87('0x2e')],_0x410947[_0xcb87('0x30')]),_0x2eec7b);if(_0x13557a[_0xcb87('0x2e')][_0xcb87('0x3d')]){_0x210346[_0xcb87('0x3c')]=_['merge'](_0x210346[_0xcb87('0x3c')],{'$or':_['map'](_0x2eec7b,function(_0x34afd9){if(_0x34afd9[_0xcb87('0x2d')]!==_0xcb87('0x3e')){var _0x4082cf={};_0x4082cf[_0x34afd9[_0xcb87('0x27')]]={'$like':'%'+_0x13557a[_0xcb87('0x2e')]['filter']+'%'};return _0x4082cf;}})});}_0x210346=_['merge']({},_0x210346,_0x13557a[_0xcb87('0x3f')]);var _0x54bc59={'where':_0x210346[_0xcb87('0x3c')]};return db[_0xcb87('0x2b')][_0xcb87('0x1b')](_0x54bc59)[_0xcb87('0x23')](function(_0x5c38eb){_0xf95aae['count']=_0x5c38eb;if(_0x13557a['query'][_0xcb87('0x40')]){_0x210346['include']=[{'all':!![]}];}return db[_0xcb87('0x2b')][_0xcb87('0x41')](_0x210346);})[_0xcb87('0x23')](function(_0x335dbf){_0xf95aae[_0xcb87('0x42')]=_0x335dbf;return _0xf95aae;})[_0xcb87('0x23')](respondWithFilteredResult(_0x410343,_0x210346))['catch'](handleError(_0x410343,null));};exports[_0xcb87('0x43')]=function(_0x26cf3d,_0x41915d){var _0xc1299e={'raw':!![],'where':{'id':_0x26cf3d[_0xcb87('0x44')]['id']}},_0x5ee43f={};_0x5ee43f[_0xcb87('0x32')]=_['keys'](db[_0xcb87('0x2b')]['rawAttributes']);_0x5ee43f[_0xcb87('0x2e')]=_['keys'](_0x26cf3d[_0xcb87('0x2e')]);_0x5ee43f[_0xcb87('0x30')]=_[_0xcb87('0x31')](_0x5ee43f['model'],_0x5ee43f[_0xcb87('0x2e')]);_0xc1299e[_0xcb87('0x33')]=_[_0xcb87('0x31')](_0x5ee43f[_0xcb87('0x32')],qs['fields'](_0x26cf3d['query'][_0xcb87('0x34')]));_0xc1299e[_0xcb87('0x33')]=_0xc1299e[_0xcb87('0x33')][_0xcb87('0x35')]?_0xc1299e[_0xcb87('0x33')]:_0x5ee43f[_0xcb87('0x32')];if(_0x26cf3d[_0xcb87('0x2e')]['includeAll']){_0xc1299e['include']=[{'all':!![]}];}_0xc1299e=_[_0xcb87('0x45')]({},_0xc1299e,_0x26cf3d[_0xcb87('0x3f')]);return db[_0xcb87('0x2b')]['find'](_0xc1299e)[_0xcb87('0x23')](handleEntityNotFound(_0x41915d,null))[_0xcb87('0x23')](respondWithResult(_0x41915d,null))[_0xcb87('0x46')](handleError(_0x41915d,null));};exports[_0xcb87('0x47')]=function(_0x2002a0,_0x42efc1){return db[_0xcb87('0x2b')][_0xcb87('0x47')](_0x2002a0['body'],{})[_0xcb87('0x23')](respondWithResult(_0x42efc1,0xc9))[_0xcb87('0x46')](handleError(_0x42efc1,null));};exports[_0xcb87('0x22')]=function(_0x2d6f6f,_0x10cbb1){if(_0x2d6f6f[_0xcb87('0x48')]['id']){delete _0x2d6f6f[_0xcb87('0x48')]['id'];}return db[_0xcb87('0x2b')][_0xcb87('0x49')]({'where':{'id':_0x2d6f6f[_0xcb87('0x44')]['id']}})[_0xcb87('0x23')](handleEntityNotFound(_0x10cbb1,null))[_0xcb87('0x23')](saveUpdates(_0x2d6f6f['body'],null))[_0xcb87('0x23')](respondWithResult(_0x10cbb1,null))[_0xcb87('0x46')](handleError(_0x10cbb1,null));};exports[_0xcb87('0x24')]=function(_0x20795e,_0x332125){return db[_0xcb87('0x2b')]['find']({'where':{'id':_0x20795e['params']['id']}})[_0xcb87('0x23')](handleEntityNotFound(_0x332125,null))[_0xcb87('0x23')](removeEntity(_0x332125,null))['catch'](handleError(_0x332125,null));};exports[_0xcb87('0x4a')]=function(_0xafd843,_0x11e3b3){return db[_0xcb87('0x2b')][_0xcb87('0x4a')]()['then'](respondWithResult(_0x11e3b3,null))[_0xcb87('0x46')](handleError(_0x11e3b3,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 7e52512..f48fdd9 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 _0xca5a=['moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','report_sms_queue','uniqueid','util','api'];(function(_0x40088d,_0x1d6c98){var _0x5d70f5=function(_0x13c3de){while(--_0x13c3de){_0x40088d['push'](_0x40088d['shift']());}};_0x5d70f5(++_0x1d6c98);}(_0xca5a,0x82));var _0xaca5=function(_0x1429c7,_0x5a19f5){_0x1429c7=_0x1429c7-0x0;var _0x188e1f=_0xca5a[_0x1429c7];return _0x188e1f;};'use strict';var _=require('lodash');var util=require(_0xaca5('0x0'));var logger=require('../../config/logger')(_0xaca5('0x1'));var moment=require(_0xaca5('0x2'));var BPromise=require(_0xaca5('0x3'));var rp=require(_0xaca5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaca5('0x5'));var config=require(_0xaca5('0x6'));var attributes=require(_0xaca5('0x7'));module['exports']=function(_0x46904a,_0x273091){return _0x46904a[_0xaca5('0x8')](_0xaca5('0x9'),attributes,{'tableName':_0xaca5('0xa'),'paranoid':![],'indexes':[{'name':_0xaca5('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd66e=['util','../../config/logger','api','moment','path','rimraf','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xd66e,0x1ce));var _0xed66=function(_0x2e2ce8,_0x436b78){_0x2e2ce8=_0x2e2ce8-0x0;var _0x1d92a7=_0xd66e[_0x2e2ce8];return _0x1d92a7;};'use strict';var _=require('lodash');var util=require(_0xed66('0x0'));var logger=require(_0xed66('0x1'))(_0xed66('0x2'));var moment=require(_0xed66('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xed66('0x4'));var rimraf=require(_0xed66('0x5'));var config=require('../../config/environment');var attributes=require('./smsQueueReport.attributes');module[_0xed66('0x6')]=function(_0x32a681,_0x22844e){return _0x32a681[_0xed66('0x7')](_0xed66('0x8'),attributes,{'tableName':_0xed66('0x9'),'paranoid':![],'indexes':[{'name':_0xed66('0xa'),'fields':[_0xed66('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 7c0f206..6c26c7f 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 _0xe5b5=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','UpdateSmsQueueReport','update','attributes'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xe5b5,0x12a));var _0x5e5b=function(_0x28d7b5,_0x1305a4){_0x28d7b5=_0x28d7b5-0x0;var _0x1ed035=_0xe5b5[_0x28d7b5];return _0x1ed035;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e5b('0x7'))(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var jayson=require(_0x5e5b('0xa'));var client=jayson[_0x5e5b('0xb')][_0x5e5b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31a299,_0x1df60f,_0x439a45){return new BPromise(function(_0x177e55,_0x275fe7){return client[_0x5e5b('0xd')](_0x31a299,_0x439a45)[_0x5e5b('0xe')](function(_0x4cabb5){logger['info'](_0x5e5b('0xf'),_0x1df60f,_0x5e5b('0x10'));logger[_0x5e5b('0x11')](_0x5e5b('0x12'),_0x1df60f,'request\x20sent',JSON[_0x5e5b('0x13')](_0x4cabb5));if(_0x4cabb5[_0x5e5b('0x14')]){if(_0x4cabb5[_0x5e5b('0x14')]['code']===0x1f4){logger['error'](_0x5e5b('0xf'),_0x1df60f,_0x4cabb5['error']['message']);return _0x275fe7(_0x4cabb5[_0x5e5b('0x14')]['message']);}logger[_0x5e5b('0x14')](_0x5e5b('0xf'),_0x1df60f,_0x4cabb5[_0x5e5b('0x14')][_0x5e5b('0x15')]);return _0x177e55(_0x4cabb5[_0x5e5b('0x14')][_0x5e5b('0x15')]);}else{logger[_0x5e5b('0x16')](_0x5e5b('0xf'),_0x1df60f,'request\x20sent');_0x177e55(_0x4cabb5[_0x5e5b('0x17')][_0x5e5b('0x15')]);}})[_0x5e5b('0x18')](function(_0x4da9ca){logger[_0x5e5b('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x1df60f,_0x4da9ca);_0x275fe7(_0x4da9ca);});});}exports[_0x5e5b('0x19')]=function(_0x1cbf39){var _0x150f85=this;return new Promise(function(_0x29061f,_0x2e596a){return db[_0x5e5b('0x1a')]['create'](_0x1cbf39[_0x5e5b('0x1b')],{'raw':_0x1cbf39[_0x5e5b('0x1c')]?_0x1cbf39[_0x5e5b('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x5e5b('0xe')](function(_0xc76e0){logger[_0x5e5b('0x16')]('CreateSmsQueueReport',_0x1cbf39);logger['debug']('CreateSmsQueueReport',_0x1cbf39,JSON[_0x5e5b('0x13')](_0xc76e0));_0x29061f(_0xc76e0);})[_0x5e5b('0x18')](function(_0x3ec6de){logger[_0x5e5b('0x14')](_0x5e5b('0x19'),_0x3ec6de[_0x5e5b('0x15')],_0x1cbf39);_0x2e596a(_0x150f85[_0x5e5b('0x14')](0x1f4,_0x3ec6de[_0x5e5b('0x15')]));});});};exports[_0x5e5b('0x1d')]=function(_0x8bc006){var _0x495731=this;return new Promise(function(_0x27a323,_0x11f59b){return db['SmsQueueReport'][_0x5e5b('0x1e')](_0x8bc006[_0x5e5b('0x1b')],{'raw':_0x8bc006[_0x5e5b('0x1c')]?_0x8bc006[_0x5e5b('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8bc006[_0x5e5b('0x1c')]?_0x8bc006[_0x5e5b('0x1c')]['where']||null:null,'attributes':_0x8bc006['options']?_0x8bc006['options'][_0x5e5b('0x1f')]||null:null,'limit':_0x8bc006[_0x5e5b('0x1c')]?_0x8bc006['options'][_0x5e5b('0x20')]||null:null})[_0x5e5b('0xe')](function(_0x547233){logger[_0x5e5b('0x16')]('UpdateSmsQueueReport',_0x8bc006);logger[_0x5e5b('0x11')](_0x5e5b('0x1d'),_0x8bc006,JSON[_0x5e5b('0x13')](_0x547233));_0x27a323(_0x547233);})[_0x5e5b('0x18')](function(_0x1c50b1){logger[_0x5e5b('0x14')](_0x5e5b('0x1d'),_0x1c50b1[_0x5e5b('0x15')],_0x8bc006);_0x11f59b(_0x495731[_0x5e5b('0x14')](0x1f4,_0x1c50b1[_0x5e5b('0x15')]));});});}; \ No newline at end of file +var _0xd3f4=['request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','SmsQueueReport','body','options','CreateSmsQueueReport','UpdateSmsQueueReport','update','raw','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s'];(function(_0x4ad37e,_0x2419a3){var _0x44af98=function(_0x51528e){while(--_0x51528e){_0x4ad37e['push'](_0x4ad37e['shift']());}};_0x44af98(++_0x2419a3);}(_0xd3f4,0x129));var _0x4d3f=function(_0x82a2a4,_0x5b57cb){_0x82a2a4=_0x82a2a4-0x0;var _0xb6084e=_0xd3f4[_0x82a2a4];return _0xb6084e;};'use strict';var _=require('lodash');var util=require(_0x4d3f('0x0'));var moment=require(_0x4d3f('0x1'));var BPromise=require('bluebird');var rs=require(_0x4d3f('0x2'));var fs=require('fs');var Redis=require(_0x4d3f('0x3'));var db=require(_0x4d3f('0x4'))['db'];var utils=require(_0x4d3f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4d3f('0x6'));var jayson=require(_0x4d3f('0x7'));var client=jayson[_0x4d3f('0x8')][_0x4d3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ec911,_0x48d4d0,_0xe3fb90){return new BPromise(function(_0x1142e8,_0x517aca){return client[_0x4d3f('0xa')](_0x2ec911,_0xe3fb90)[_0x4d3f('0xb')](function(_0x433a4d){logger['info'](_0x4d3f('0xc'),_0x48d4d0,_0x4d3f('0xd'));logger[_0x4d3f('0xe')](_0x4d3f('0xf'),_0x48d4d0,_0x4d3f('0xd'),JSON[_0x4d3f('0x10')](_0x433a4d));if(_0x433a4d[_0x4d3f('0x11')]){if(_0x433a4d['error']['code']===0x1f4){logger[_0x4d3f('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x48d4d0,_0x433a4d[_0x4d3f('0x11')][_0x4d3f('0x12')]);return _0x517aca(_0x433a4d['error']['message']);}logger[_0x4d3f('0x11')](_0x4d3f('0xc'),_0x48d4d0,_0x433a4d[_0x4d3f('0x11')][_0x4d3f('0x12')]);return _0x1142e8(_0x433a4d['error'][_0x4d3f('0x12')]);}else{logger[_0x4d3f('0x13')](_0x4d3f('0xc'),_0x48d4d0,_0x4d3f('0xd'));_0x1142e8(_0x433a4d['result'][_0x4d3f('0x12')]);}})[_0x4d3f('0x14')](function(_0x80a29b){logger['error'](_0x4d3f('0xc'),_0x48d4d0,_0x80a29b);_0x517aca(_0x80a29b);});});}exports['CreateSmsQueueReport']=function(_0x37eae4){var _0x982cdc=this;return new Promise(function(_0x51d7eb,_0x1b0105){return db[_0x4d3f('0x15')]['create'](_0x37eae4[_0x4d3f('0x16')],{'raw':_0x37eae4[_0x4d3f('0x17')]?_0x37eae4[_0x4d3f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x4d3f('0xb')](function(_0x5e9738){logger[_0x4d3f('0x13')]('CreateSmsQueueReport',_0x37eae4);logger[_0x4d3f('0xe')](_0x4d3f('0x18'),_0x37eae4,JSON[_0x4d3f('0x10')](_0x5e9738));_0x51d7eb(_0x5e9738);})[_0x4d3f('0x14')](function(_0xd3b2bf){logger[_0x4d3f('0x11')](_0x4d3f('0x18'),_0xd3b2bf[_0x4d3f('0x12')],_0x37eae4);_0x1b0105(_0x982cdc[_0x4d3f('0x11')](0x1f4,_0xd3b2bf['message']));});});};exports[_0x4d3f('0x19')]=function(_0x4b91f0){var _0x1596a1=this;return new Promise(function(_0x5936bb,_0x9942c7){return db[_0x4d3f('0x15')][_0x4d3f('0x1a')](_0x4b91f0[_0x4d3f('0x16')],{'raw':_0x4b91f0[_0x4d3f('0x17')]?_0x4b91f0['options'][_0x4d3f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b91f0[_0x4d3f('0x17')]?_0x4b91f0[_0x4d3f('0x17')][_0x4d3f('0x1c')]||null:null,'attributes':_0x4b91f0['options']?_0x4b91f0[_0x4d3f('0x17')][_0x4d3f('0x1d')]||null:null,'limit':_0x4b91f0[_0x4d3f('0x17')]?_0x4b91f0[_0x4d3f('0x17')][_0x4d3f('0x1e')]||null:null})[_0x4d3f('0xb')](function(_0x118ab1){logger['info'](_0x4d3f('0x19'),_0x4b91f0);logger[_0x4d3f('0xe')](_0x4d3f('0x19'),_0x4b91f0,JSON[_0x4d3f('0x10')](_0x118ab1));_0x5936bb(_0x118ab1);})['catch'](function(_0x2e81c9){logger['error']('UpdateSmsQueueReport',_0x2e81c9[_0x4d3f('0x12')],_0x4b91f0);_0x9942c7(_0x1596a1['error'](0x1f4,_0x2e81c9[_0x4d3f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 06a7b49..38e1034 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 _0xe605=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','multer'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe605,0x92));var _0x5e60=function(_0x29a70a,_0x26b3c9){_0x29a70a=_0x29a70a-0x0;var _0x182069=_0xe605[_0x29a70a];return _0x182069;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var auth=require(_0x5e60('0x5'));var interaction=require(_0x5e60('0x6'));var config=require(_0x5e60('0x7'));var controller=require(_0x5e60('0x8'));router[_0x5e60('0x9')]('/',auth[_0x5e60('0xa')](),controller[_0x5e60('0xb')]);router[_0x5e60('0x9')](_0x5e60('0xc'),auth['isAuthenticated'](),controller[_0x5e60('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5e60('0xe')]);router[_0x5e60('0xf')]('/',auth[_0x5e60('0xa')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')](_0x5e60('0x12'),auth['isAuthenticated'](),controller[_0x5e60('0x13')]);router['delete'](_0x5e60('0x12'),auth[_0x5e60('0xa')](),controller[_0x5e60('0x14')]);module['exports']=router; \ No newline at end of file +var _0xac4a=['Router','../../config/environment','./smsTransferReport.controller','get','index','/describe','describe','show','isAuthenticated','/:id','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x1ac140,_0x70c6d1){var _0x280a94=function(_0x1cfd59){while(--_0x1cfd59){_0x1ac140['push'](_0x1ac140['shift']());}};_0x280a94(++_0x70c6d1);}(_0xac4a,0x13f));var _0xaac4=function(_0x5c2502,_0x5f42fc){_0x5c2502=_0x5c2502-0x0;var _0xb6b963=_0xac4a[_0x5c2502];return _0xb6b963;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaac4('0x6'));var controller=require(_0xaac4('0x7'));router[_0xaac4('0x8')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x9')]);router['get'](_0xaac4('0xa'),auth['isAuthenticated'](),controller[_0xaac4('0xb')]);router[_0xaac4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['post']('/',auth[_0xaac4('0xd')](),controller['create']);router['put'](_0xaac4('0xe'),auth[_0xaac4('0xd')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')](_0xaac4('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xaac4('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ab2d67d..26753b1 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 _0xa7cb=['STRING','ENUM','account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x246d05,_0x2af448){var _0x1218e4=function(_0x530ec3){while(--_0x530ec3){_0x246d05['push'](_0x246d05['shift']());}};_0x1218e4(++_0x2af448);}(_0xa7cb,0x189));var _0xba7c=function(_0x39bc80,_0x18f609){_0x39bc80=_0x39bc80-0x0;var _0x350050=_0xa7cb[_0x39bc80];return _0x350050;};'use strict';var moment=require(_0xba7c('0x0'));var Sequelize=require(_0xba7c('0x1'));module[_0xba7c('0x2')]={'uniqueid':{'type':Sequelize[_0xba7c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xba7c('0x4')](_0xba7c('0x5'),'agent',_0xba7c('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xba7c('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xba7c('0x8')]}}; \ No newline at end of file +var _0xf397=['moment','sequelize','exports','STRING','ENUM','account','agent','queue','NOW'];(function(_0xf4fc1a,_0x2c0ca5){var _0x8b2d6e=function(_0x96e162){while(--_0x96e162){_0xf4fc1a['push'](_0xf4fc1a['shift']());}};_0x8b2d6e(++_0x2c0ca5);}(_0xf397,0x1b9));var _0x7f39=function(_0xcdac83,_0x1e6093){_0xcdac83=_0xcdac83-0x0;var _0x349aff=_0xf397[_0xcdac83];return _0x349aff;};'use strict';var moment=require(_0x7f39('0x0'));var Sequelize=require(_0x7f39('0x1'));module[_0x7f39('0x2')]={'uniqueid':{'type':Sequelize[_0x7f39('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7f39('0x4')](_0x7f39('0x5'),_0x7f39('0x6'),_0x7f39('0x7')),'allowNull':![],'defaultValue':_0x7f39('0x7')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x7f39('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e6f1fb5..a74b8de 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 _0x4bd1=['sort','where','filters','filter','merge','includeAll','include','catch','params','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','save','update','then','destroy','error','stack','name','send','map','SmsTransferReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','limit'];(function(_0x214d8c,_0x242dc3){var _0x5a5060=function(_0x3dc1e0){while(--_0x3dc1e0){_0x214d8c['push'](_0x214d8c['shift']());}};_0x5a5060(++_0x242dc3);}(_0x4bd1,0x90));var _0x14bd=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x4bd1[_0x5e28c2];return _0x1a8cc6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x14bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x14bd('0x1'));var jsonpatch=require(_0x14bd('0x2'));var rp=require('request-promise');var moment=require(_0x14bd('0x3'));var BPromise=require(_0x14bd('0x4'));var Mustache=require('mustache');var util=require(_0x14bd('0x5'));var path=require(_0x14bd('0x6'));var sox=require(_0x14bd('0x7'));var csv=require(_0x14bd('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x14bd('0x9'));var squel=require(_0x14bd('0xa'));var crypto=require(_0x14bd('0xb'));var jsforce=require(_0x14bd('0xc'));var deskjs=require(_0x14bd('0xd'));var toCsv=require(_0x14bd('0x8'));var querystring=require(_0x14bd('0xe'));var Papa=require(_0x14bd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x14bd('0x10'));var hardwareService=require(_0x14bd('0x11'));var logger=require(_0x14bd('0x12'))('api');var utils=require(_0x14bd('0x13'));var config=require(_0x14bd('0x14'));var licenseUtil=require(_0x14bd('0x15'));var db=require(_0x14bd('0x16'))['db'];function respondWithStatusCode(_0x29475f,_0x316e4e){_0x316e4e=_0x316e4e||0xcc;return function(_0x12f60a){if(_0x12f60a){return _0x29475f[_0x14bd('0x17')](_0x316e4e);}return _0x29475f['status'](_0x316e4e)[_0x14bd('0x18')]();};}function respondWithResult(_0x567356,_0x3ee1b9){_0x3ee1b9=_0x3ee1b9||0xc8;return function(_0x47e495){if(_0x47e495){return _0x567356[_0x14bd('0x19')](_0x3ee1b9)[_0x14bd('0x1a')](_0x47e495);}};}function respondWithFilteredResult(_0x5b9470,_0x3797d9){return function(_0x49ed59){if(_0x49ed59){var _0x10e47e=_0x49ed59[_0x14bd('0x1b')],_0x6579a9=_0x3797d9[_0x14bd('0x1c')],_0x3833ed=_0x3797d9['offset']+_0x3797d9['limit'],_0x1853ba;if(_0x3833ed>=_0x10e47e){_0x3833ed=_0x10e47e;_0x1853ba=0xc8;}else{_0x1853ba=0xce;}_0x5b9470[_0x14bd('0x19')](_0x1853ba);return _0x5b9470[_0x14bd('0x1d')]('Content-Range',_0x6579a9+'-'+_0x3833ed+'/'+_0x10e47e)['json'](_0x49ed59);}return null;};}function patchUpdates(_0x1f09fa){return function(_0x24a5a3){try{jsonpatch['apply'](_0x24a5a3,_0x1f09fa,!![]);}catch(_0x338962){return BPromise['reject'](_0x338962);}return _0x24a5a3[_0x14bd('0x1e')]();};}function saveUpdates(_0x568a21,_0x792fdb){return function(_0x5cf869){if(_0x5cf869){return _0x5cf869[_0x14bd('0x1f')](_0x568a21)[_0x14bd('0x20')](function(_0x38eac5){return _0x38eac5;});}return null;};}function removeEntity(_0x521e3d,_0x253e93){return function(_0x28b06c){if(_0x28b06c){return _0x28b06c[_0x14bd('0x21')]()['then'](function(){_0x521e3d[_0x14bd('0x19')](0xcc)[_0x14bd('0x18')]();});}};}function handleEntityNotFound(_0xe011b3,_0x4afb0e){return function(_0x58a44c){if(!_0x58a44c){_0xe011b3['sendStatus'](0x194);}return _0x58a44c;};}function handleError(_0x2495d2,_0x2dd5fe){_0x2dd5fe=_0x2dd5fe||0x1f4;return function(_0x67d318){logger[_0x14bd('0x22')](_0x67d318[_0x14bd('0x23')]);if(_0x67d318[_0x14bd('0x24')]){delete _0x67d318[_0x14bd('0x24')];}_0x2495d2[_0x14bd('0x19')](_0x2dd5fe)[_0x14bd('0x25')](_0x67d318);};}exports['index']=function(_0x1112f0,_0x424c74){var _0x4be185={},_0x18d834={},_0x5e4306={'count':0x0,'rows':[]};var _0x4d5760=_[_0x14bd('0x26')](db[_0x14bd('0x27')][_0x14bd('0x28')],function(_0x1c51ac){return{'name':_0x1c51ac['fieldName'],'type':_0x1c51ac[_0x14bd('0x29')][_0x14bd('0x2a')]};});_0x18d834[_0x14bd('0x2b')]=_[_0x14bd('0x26')](_0x4d5760,_0x14bd('0x24'));_0x18d834[_0x14bd('0x2c')]=_['keys'](_0x1112f0[_0x14bd('0x2c')]);_0x18d834['filters']=_[_0x14bd('0x2d')](_0x18d834[_0x14bd('0x2b')],_0x18d834[_0x14bd('0x2c')]);_0x4be185[_0x14bd('0x2e')]=_[_0x14bd('0x2d')](_0x18d834[_0x14bd('0x2b')],qs[_0x14bd('0x2f')](_0x1112f0[_0x14bd('0x2c')][_0x14bd('0x2f')]));_0x4be185[_0x14bd('0x2e')]=_0x4be185[_0x14bd('0x2e')][_0x14bd('0x30')]?_0x4be185[_0x14bd('0x2e')]:_0x18d834[_0x14bd('0x2b')];if(!_0x1112f0[_0x14bd('0x2c')]['hasOwnProperty'](_0x14bd('0x31'))){_0x4be185['limit']=qs[_0x14bd('0x32')](_0x1112f0[_0x14bd('0x2c')][_0x14bd('0x32')]);_0x4be185[_0x14bd('0x1c')]=qs[_0x14bd('0x1c')](_0x1112f0[_0x14bd('0x2c')][_0x14bd('0x1c')]);}_0x4be185['order']=qs[_0x14bd('0x33')](_0x1112f0[_0x14bd('0x2c')]['sort']);_0x4be185[_0x14bd('0x34')]=qs[_0x14bd('0x35')](_['pick'](_0x1112f0['query'],_0x18d834[_0x14bd('0x35')]),_0x4d5760);if(_0x1112f0['query'][_0x14bd('0x36')]){_0x4be185[_0x14bd('0x34')]=_[_0x14bd('0x37')](_0x4be185[_0x14bd('0x34')],{'$or':_[_0x14bd('0x26')](_0x4d5760,function(_0x58d4c5){if(_0x58d4c5[_0x14bd('0x29')]!=='VIRTUAL'){var _0x3204d5={};_0x3204d5[_0x58d4c5['name']]={'$like':'%'+_0x1112f0[_0x14bd('0x2c')]['filter']+'%'};return _0x3204d5;}})});}_0x4be185=_[_0x14bd('0x37')]({},_0x4be185,_0x1112f0['options']);var _0x44ee87={'where':_0x4be185[_0x14bd('0x34')]};return db[_0x14bd('0x27')][_0x14bd('0x1b')](_0x44ee87)[_0x14bd('0x20')](function(_0xe913b1){_0x5e4306[_0x14bd('0x1b')]=_0xe913b1;if(_0x1112f0[_0x14bd('0x2c')][_0x14bd('0x38')]){_0x4be185[_0x14bd('0x39')]=[{'all':!![]}];}return db[_0x14bd('0x27')]['findAll'](_0x4be185);})['then'](function(_0x5c4f69){_0x5e4306['rows']=_0x5c4f69;return _0x5e4306;})[_0x14bd('0x20')](respondWithFilteredResult(_0x424c74,_0x4be185))[_0x14bd('0x3a')](handleError(_0x424c74,null));};exports['show']=function(_0x3456c1,_0x1b4159){var _0x5ca724={'raw':!![],'where':{'id':_0x3456c1[_0x14bd('0x3b')]['id']}},_0x20fa19={};_0x20fa19['model']=_['keys'](db['SmsTransferReport'][_0x14bd('0x28')]);_0x20fa19[_0x14bd('0x2c')]=_['keys'](_0x3456c1[_0x14bd('0x2c')]);_0x20fa19['filters']=_['intersection'](_0x20fa19[_0x14bd('0x2b')],_0x20fa19[_0x14bd('0x2c')]);_0x5ca724[_0x14bd('0x2e')]=_['intersection'](_0x20fa19[_0x14bd('0x2b')],qs[_0x14bd('0x2f')](_0x3456c1['query'][_0x14bd('0x2f')]));_0x5ca724[_0x14bd('0x2e')]=_0x5ca724[_0x14bd('0x2e')]['length']?_0x5ca724[_0x14bd('0x2e')]:_0x20fa19[_0x14bd('0x2b')];if(_0x3456c1[_0x14bd('0x2c')][_0x14bd('0x38')]){_0x5ca724['include']=[{'all':!![]}];}_0x5ca724=_[_0x14bd('0x37')]({},_0x5ca724,_0x3456c1[_0x14bd('0x3c')]);return db[_0x14bd('0x27')]['find'](_0x5ca724)[_0x14bd('0x20')](handleEntityNotFound(_0x1b4159,null))[_0x14bd('0x20')](respondWithResult(_0x1b4159,null))[_0x14bd('0x3a')](handleError(_0x1b4159,null));};exports[_0x14bd('0x3d')]=function(_0x3dcf14,_0x33d2cc){return db[_0x14bd('0x27')][_0x14bd('0x3d')](_0x3dcf14[_0x14bd('0x3e')],{})[_0x14bd('0x20')](respondWithResult(_0x33d2cc,0xc9))[_0x14bd('0x3a')](handleError(_0x33d2cc,null));};exports['update']=function(_0x595093,_0x47cba4){if(_0x595093[_0x14bd('0x3e')]['id']){delete _0x595093[_0x14bd('0x3e')]['id'];}return db[_0x14bd('0x27')]['find']({'where':{'id':_0x595093[_0x14bd('0x3b')]['id']}})[_0x14bd('0x20')](handleEntityNotFound(_0x47cba4,null))['then'](saveUpdates(_0x595093['body'],null))[_0x14bd('0x20')](respondWithResult(_0x47cba4,null))[_0x14bd('0x3a')](handleError(_0x47cba4,null));};exports['destroy']=function(_0x5966ac,_0x1b85ab){return db[_0x14bd('0x27')][_0x14bd('0x3f')]({'where':{'id':_0x5966ac[_0x14bd('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1b85ab,null))[_0x14bd('0x20')](removeEntity(_0x1b85ab,null))['catch'](handleError(_0x1b85ab,null));};exports[_0x14bd('0x40')]=function(_0x442614,_0x2c0064){return db[_0x14bd('0x27')][_0x14bd('0x40')]()[_0x14bd('0x20')](respondWithResult(_0x2c0064,null))[_0x14bd('0x3a')](handleError(_0x2c0064,null));}; \ No newline at end of file +var _0xf1e1=['count','offset','set','save','update','then','end','error','stack','name','send','map','SmsTransferReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','limit','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','rawAttributes','fields','find','create','body','destroy','describe','html-pdf','rimraf','fast-json-patch','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/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x1b98a6,_0x359cea){var _0x306cf5=function(_0x494fa5){while(--_0x494fa5){_0x1b98a6['push'](_0x1b98a6['shift']());}};_0x306cf5(++_0x359cea);}(_0xf1e1,0x102));var _0x1f1e=function(_0x371d15,_0xd98587){_0x371d15=_0x371d15-0x0;var _0x32afdf=_0xf1e1[_0x371d15];return _0x32afdf;};'use strict';var pdf=require(_0x1f1e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1f1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f1e('0x2'));var rp=require('request-promise');var moment=require(_0x1f1e('0x3'));var BPromise=require(_0x1f1e('0x4'));var Mustache=require(_0x1f1e('0x5'));var util=require(_0x1f1e('0x6'));var path=require(_0x1f1e('0x7'));var sox=require(_0x1f1e('0x8'));var csv=require(_0x1f1e('0x9'));var ejs=require(_0x1f1e('0xa'));var fs=require('fs');var _=require(_0x1f1e('0xb'));var squel=require(_0x1f1e('0xc'));var crypto=require(_0x1f1e('0xd'));var jsforce=require(_0x1f1e('0xe'));var deskjs=require(_0x1f1e('0xf'));var toCsv=require(_0x1f1e('0x9'));var querystring=require('querystring');var Papa=require(_0x1f1e('0x10'));var Redis=require(_0x1f1e('0x11'));var authService=require(_0x1f1e('0x12'));var qs=require(_0x1f1e('0x13'));var as=require(_0x1f1e('0x14'));var hardwareService=require(_0x1f1e('0x15'));var logger=require(_0x1f1e('0x16'))(_0x1f1e('0x17'));var utils=require(_0x1f1e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1f1e('0x19'));var db=require(_0x1f1e('0x1a'))['db'];function respondWithStatusCode(_0x1cfe77,_0x3f5ade){_0x3f5ade=_0x3f5ade||0xcc;return function(_0x11a6c8){if(_0x11a6c8){return _0x1cfe77[_0x1f1e('0x1b')](_0x3f5ade);}return _0x1cfe77[_0x1f1e('0x1c')](_0x3f5ade)['end']();};}function respondWithResult(_0x3ff746,_0x4609c4){_0x4609c4=_0x4609c4||0xc8;return function(_0x53c5e1){if(_0x53c5e1){return _0x3ff746[_0x1f1e('0x1c')](_0x4609c4)[_0x1f1e('0x1d')](_0x53c5e1);}};}function respondWithFilteredResult(_0x5b075c,_0x1553d){return function(_0x21da96){if(_0x21da96){var _0xe4cef0=_0x21da96[_0x1f1e('0x1e')],_0x2b0a44=_0x1553d[_0x1f1e('0x1f')],_0x47d1b9=_0x1553d[_0x1f1e('0x1f')]+_0x1553d['limit'],_0x3f978f;if(_0x47d1b9>=_0xe4cef0){_0x47d1b9=_0xe4cef0;_0x3f978f=0xc8;}else{_0x3f978f=0xce;}_0x5b075c[_0x1f1e('0x1c')](_0x3f978f);return _0x5b075c[_0x1f1e('0x20')]('Content-Range',_0x2b0a44+'-'+_0x47d1b9+'/'+_0xe4cef0)[_0x1f1e('0x1d')](_0x21da96);}return null;};}function patchUpdates(_0x219532){return function(_0xb1f54f){try{jsonpatch['apply'](_0xb1f54f,_0x219532,!![]);}catch(_0x553367){return BPromise['reject'](_0x553367);}return _0xb1f54f[_0x1f1e('0x21')]();};}function saveUpdates(_0x226f45,_0xed547a){return function(_0x2642b3){if(_0x2642b3){return _0x2642b3[_0x1f1e('0x22')](_0x226f45)[_0x1f1e('0x23')](function(_0x39636c){return _0x39636c;});}return null;};}function removeEntity(_0x262f91,_0x5c777e){return function(_0x497c57){if(_0x497c57){return _0x497c57['destroy']()[_0x1f1e('0x23')](function(){_0x262f91[_0x1f1e('0x1c')](0xcc)[_0x1f1e('0x24')]();});}};}function handleEntityNotFound(_0x4268ed,_0x5b9a47){return function(_0x79c4db){if(!_0x79c4db){_0x4268ed[_0x1f1e('0x1b')](0x194);}return _0x79c4db;};}function handleError(_0x3d7c6a,_0x4be237){_0x4be237=_0x4be237||0x1f4;return function(_0x5b2394){logger[_0x1f1e('0x25')](_0x5b2394[_0x1f1e('0x26')]);if(_0x5b2394[_0x1f1e('0x27')]){delete _0x5b2394['name'];}_0x3d7c6a[_0x1f1e('0x1c')](_0x4be237)[_0x1f1e('0x28')](_0x5b2394);};}exports['index']=function(_0x3689fc,_0x518c2d){var _0x46cc43={},_0xe84434={},_0x19659c={'count':0x0,'rows':[]};var _0x3967e6=_[_0x1f1e('0x29')](db[_0x1f1e('0x2a')]['rawAttributes'],function(_0x2b24a6){return{'name':_0x2b24a6[_0x1f1e('0x2b')],'type':_0x2b24a6[_0x1f1e('0x2c')][_0x1f1e('0x2d')]};});_0xe84434[_0x1f1e('0x2e')]=_[_0x1f1e('0x29')](_0x3967e6,_0x1f1e('0x27'));_0xe84434['query']=_[_0x1f1e('0x2f')](_0x3689fc[_0x1f1e('0x30')]);_0xe84434[_0x1f1e('0x31')]=_[_0x1f1e('0x32')](_0xe84434[_0x1f1e('0x2e')],_0xe84434[_0x1f1e('0x30')]);_0x46cc43[_0x1f1e('0x33')]=_[_0x1f1e('0x32')](_0xe84434['model'],qs['fields'](_0x3689fc[_0x1f1e('0x30')]['fields']));_0x46cc43['attributes']=_0x46cc43[_0x1f1e('0x33')][_0x1f1e('0x34')]?_0x46cc43[_0x1f1e('0x33')]:_0xe84434[_0x1f1e('0x2e')];if(!_0x3689fc[_0x1f1e('0x30')][_0x1f1e('0x35')]('nolimit')){_0x46cc43[_0x1f1e('0x36')]=qs[_0x1f1e('0x36')](_0x3689fc[_0x1f1e('0x30')]['limit']);_0x46cc43[_0x1f1e('0x1f')]=qs[_0x1f1e('0x1f')](_0x3689fc['query']['offset']);}_0x46cc43['order']=qs['sort'](_0x3689fc[_0x1f1e('0x30')]['sort']);_0x46cc43[_0x1f1e('0x37')]=qs[_0x1f1e('0x31')](_['pick'](_0x3689fc[_0x1f1e('0x30')],_0xe84434['filters']),_0x3967e6);if(_0x3689fc[_0x1f1e('0x30')]['filter']){_0x46cc43[_0x1f1e('0x37')]=_[_0x1f1e('0x38')](_0x46cc43[_0x1f1e('0x37')],{'$or':_[_0x1f1e('0x29')](_0x3967e6,function(_0x25e591){if(_0x25e591[_0x1f1e('0x2c')]!==_0x1f1e('0x39')){var _0x588d58={};_0x588d58[_0x25e591[_0x1f1e('0x27')]]={'$like':'%'+_0x3689fc['query'][_0x1f1e('0x3a')]+'%'};return _0x588d58;}})});}_0x46cc43=_['merge']({},_0x46cc43,_0x3689fc['options']);var _0x30fabd={'where':_0x46cc43['where']};return db[_0x1f1e('0x2a')][_0x1f1e('0x1e')](_0x30fabd)[_0x1f1e('0x23')](function(_0x437d28){_0x19659c[_0x1f1e('0x1e')]=_0x437d28;if(_0x3689fc['query'][_0x1f1e('0x3b')]){_0x46cc43[_0x1f1e('0x3c')]=[{'all':!![]}];}return db[_0x1f1e('0x2a')][_0x1f1e('0x3d')](_0x46cc43);})[_0x1f1e('0x23')](function(_0x34003f){_0x19659c['rows']=_0x34003f;return _0x19659c;})['then'](respondWithFilteredResult(_0x518c2d,_0x46cc43))[_0x1f1e('0x3e')](handleError(_0x518c2d,null));};exports[_0x1f1e('0x3f')]=function(_0x4d904a,_0x596c82){var _0x111919={'raw':!![],'where':{'id':_0x4d904a[_0x1f1e('0x40')]['id']}},_0x56cda5={};_0x56cda5[_0x1f1e('0x2e')]=_[_0x1f1e('0x2f')](db[_0x1f1e('0x2a')][_0x1f1e('0x41')]);_0x56cda5['query']=_[_0x1f1e('0x2f')](_0x4d904a[_0x1f1e('0x30')]);_0x56cda5[_0x1f1e('0x31')]=_[_0x1f1e('0x32')](_0x56cda5[_0x1f1e('0x2e')],_0x56cda5[_0x1f1e('0x30')]);_0x111919[_0x1f1e('0x33')]=_[_0x1f1e('0x32')](_0x56cda5[_0x1f1e('0x2e')],qs[_0x1f1e('0x42')](_0x4d904a[_0x1f1e('0x30')][_0x1f1e('0x42')]));_0x111919[_0x1f1e('0x33')]=_0x111919[_0x1f1e('0x33')][_0x1f1e('0x34')]?_0x111919[_0x1f1e('0x33')]:_0x56cda5[_0x1f1e('0x2e')];if(_0x4d904a['query']['includeAll']){_0x111919['include']=[{'all':!![]}];}_0x111919=_[_0x1f1e('0x38')]({},_0x111919,_0x4d904a['options']);return db[_0x1f1e('0x2a')][_0x1f1e('0x43')](_0x111919)[_0x1f1e('0x23')](handleEntityNotFound(_0x596c82,null))[_0x1f1e('0x23')](respondWithResult(_0x596c82,null))[_0x1f1e('0x3e')](handleError(_0x596c82,null));};exports['create']=function(_0x4f91cb,_0x3e2a8c){return db[_0x1f1e('0x2a')][_0x1f1e('0x44')](_0x4f91cb['body'],{})[_0x1f1e('0x23')](respondWithResult(_0x3e2a8c,0xc9))['catch'](handleError(_0x3e2a8c,null));};exports[_0x1f1e('0x22')]=function(_0x207744,_0x40546c){if(_0x207744['body']['id']){delete _0x207744['body']['id'];}return db[_0x1f1e('0x2a')]['find']({'where':{'id':_0x207744[_0x1f1e('0x40')]['id']}})[_0x1f1e('0x23')](handleEntityNotFound(_0x40546c,null))[_0x1f1e('0x23')](saveUpdates(_0x207744[_0x1f1e('0x45')],null))[_0x1f1e('0x23')](respondWithResult(_0x40546c,null))['catch'](handleError(_0x40546c,null));};exports[_0x1f1e('0x46')]=function(_0x5a1bc5,_0x283295){return db['SmsTransferReport'][_0x1f1e('0x43')]({'where':{'id':_0x5a1bc5[_0x1f1e('0x40')]['id']}})['then'](handleEntityNotFound(_0x283295,null))[_0x1f1e('0x23')](removeEntity(_0x283295,null))['catch'](handleError(_0x283295,null));};exports[_0x1f1e('0x47')]=function(_0x423146,_0x5f2a68){return db[_0x1f1e('0x2a')]['describe']()[_0x1f1e('0x23')](respondWithResult(_0x5f2a68,null))[_0x1f1e('0x3e')](handleError(_0x5f2a68,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 1810b7b..a348996 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 _0x0a6b=['report_sms_transfer','uniqueid','lodash','moment','request-promise','path','rimraf','./smsTransferReport.attributes','SmsTransferReport'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x4d11be,_0x4de066){_0x4d11be=_0x4d11be-0x0;var _0x2e5ac7=_0x0a6b[_0x4d11be];return _0x2e5ac7;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0a6('0x1'));var BPromise=require('bluebird');var rp=require(_0xb0a6('0x2'));var fs=require('fs');var path=require(_0xb0a6('0x3'));var rimraf=require(_0xb0a6('0x4'));var config=require('../../config/environment');var attributes=require(_0xb0a6('0x5'));module['exports']=function(_0xbbdf89,_0x415e9e){return _0xbbdf89['define'](_0xb0a6('0x6'),attributes,{'tableName':_0xb0a6('0x7'),'paranoid':![],'indexes':[{'name':_0xb0a6('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9536=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x9536,0x179));var _0x6953=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0x9536[_0x3132e8];return _0x43eb8c;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[{'name':_0x6953('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index f9c6a5f..fd605fe 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 _0xda73=['info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0xf948b5,_0x57dbd9){var _0x8fa79c=function(_0x3e57ff){while(--_0x3e57ff){_0xf948b5['push'](_0xf948b5['shift']());}};_0x8fa79c(++_0x57dbd9);}(_0xda73,0x79));var _0x3da7=function(_0x522915,_0x252f71){_0x522915=_0x522915-0x0;var _0x575768=_0xda73[_0x522915];return _0x575768;};'use strict';var _=require(_0x3da7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3da7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3da7('0x2'));var db=require(_0x3da7('0x3'))['db'];var utils=require(_0x3da7('0x4'));var logger=require(_0x3da7('0x5'))(_0x3da7('0x6'));var config=require(_0x3da7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3da7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c00ad,_0x59aae6,_0x2df94d){return new BPromise(function(_0x195499,_0x29dab5){return client[_0x3da7('0x9')](_0x3c00ad,_0x2df94d)[_0x3da7('0xa')](function(_0x1d6c3f){logger[_0x3da7('0xb')](_0x3da7('0xc'),_0x59aae6,_0x3da7('0xd'));logger[_0x3da7('0xe')](_0x3da7('0xf'),_0x59aae6,_0x3da7('0xd'),JSON[_0x3da7('0x10')](_0x1d6c3f));if(_0x1d6c3f[_0x3da7('0x11')]){if(_0x1d6c3f[_0x3da7('0x11')][_0x3da7('0x12')]===0x1f4){logger[_0x3da7('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x59aae6,_0x1d6c3f['error'][_0x3da7('0x13')]);return _0x29dab5(_0x1d6c3f['error'][_0x3da7('0x13')]);}logger[_0x3da7('0x11')](_0x3da7('0xc'),_0x59aae6,_0x1d6c3f[_0x3da7('0x11')][_0x3da7('0x13')]);return _0x195499(_0x1d6c3f[_0x3da7('0x11')]['message']);}else{logger['info'](_0x3da7('0xc'),_0x59aae6,'request\x20sent');_0x195499(_0x1d6c3f[_0x3da7('0x14')][_0x3da7('0x13')]);}})[_0x3da7('0x15')](function(_0x2bb699){logger[_0x3da7('0x11')](_0x3da7('0xc'),_0x59aae6,_0x2bb699);_0x29dab5(_0x2bb699);});});} \ No newline at end of file +var _0x4623=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x2a8182,_0xe6ef88){var _0x49ee91=function(_0x43d09c){while(--_0x43d09c){_0x2a8182['push'](_0x2a8182['shift']());}};_0x49ee91(++_0xe6ef88);}(_0x4623,0x134));var _0x3462=function(_0x581750,_0x1e0bd2){_0x581750=_0x581750-0x0;var _0x3ad5c4=_0x4623[_0x581750];return _0x3ad5c4;};'use strict';var _=require(_0x3462('0x0'));var util=require('util');var moment=require(_0x3462('0x1'));var BPromise=require(_0x3462('0x2'));var rs=require(_0x3462('0x3'));var fs=require('fs');var Redis=require(_0x3462('0x4'));var db=require(_0x3462('0x5'))['db'];var utils=require(_0x3462('0x6'));var logger=require(_0x3462('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44eb4e,_0x4c6f8a,_0x1641eb){return new BPromise(function(_0x4800d8,_0x2f8322){return client[_0x3462('0x8')](_0x44eb4e,_0x1641eb)[_0x3462('0x9')](function(_0x79bf5f){logger[_0x3462('0xa')](_0x3462('0xb'),_0x4c6f8a,_0x3462('0xc'));logger[_0x3462('0xd')](_0x3462('0xe'),_0x4c6f8a,_0x3462('0xc'),JSON['stringify'](_0x79bf5f));if(_0x79bf5f['error']){if(_0x79bf5f['error']['code']===0x1f4){logger[_0x3462('0xf')](_0x3462('0xb'),_0x4c6f8a,_0x79bf5f[_0x3462('0xf')]['message']);return _0x2f8322(_0x79bf5f['error'][_0x3462('0x10')]);}logger[_0x3462('0xf')](_0x3462('0xb'),_0x4c6f8a,_0x79bf5f['error'][_0x3462('0x10')]);return _0x4800d8(_0x79bf5f[_0x3462('0xf')]['message']);}else{logger[_0x3462('0xa')](_0x3462('0xb'),_0x4c6f8a,_0x3462('0xc'));_0x4800d8(_0x79bf5f[_0x3462('0x11')][_0x3462('0x10')]);}})[_0x3462('0x12')](function(_0x37f2ee){logger[_0x3462('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x4c6f8a,_0x37f2ee);_0x2f8322(_0x37f2ee);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 7dd15b8..a7e461d 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 _0x3eb5=['delete','exports','multer','util','path','express','../../config/environment','./sound.controller','isAuthenticated','get','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','format','%s-%s%s','basename','originalname','extname','now','post','file','create','update'];(function(_0x43f61e,_0x58d881){var _0x16d462=function(_0x1f945f){while(--_0x1f945f){_0x43f61e['push'](_0x43f61e['shift']());}};_0x16d462(++_0x58d881);}(_0x3eb5,0xf5));var _0x53eb=function(_0x4e00d4,_0xdb24a3){_0x4e00d4=_0x4e00d4-0x0;var _0x335d2c=_0x3eb5[_0x4e00d4];return _0x335d2c;};'use strict';var multer=require(_0x53eb('0x0'));var util=require(_0x53eb('0x1'));var path=require(_0x53eb('0x2'));var timeout=require('connect-timeout');var express=require(_0x53eb('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x53eb('0x4'));var controller=require(_0x53eb('0x5'));router['get']('/',auth[_0x53eb('0x6')](),controller['index']);router[_0x53eb('0x7')](_0x53eb('0x8'),auth['isAuthenticated'](),controller['show']);router['get'](_0x53eb('0x9'),auth[_0x53eb('0x6')](),controller[_0x53eb('0xa')]);var upload=multer({'storage':multer[_0x53eb('0xb')]({'destination':function(_0xdd4460,_0x436b62,_0xf237ec){_0xf237ec(null,path[_0x53eb('0xc')](config[_0x53eb('0xd')],_0x53eb('0xe')));},'filename':function(_0x2ef698,_0x4786d3,_0x3f5bbb){_0x4786d3['originalname']=_0x4786d3['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3f5bbb(null,util[_0x53eb('0xf')](_0x53eb('0x10'),path[_0x53eb('0x11')](_0x4786d3[_0x53eb('0x12')],path[_0x53eb('0x13')](_0x4786d3[_0x53eb('0x12')])),Date[_0x53eb('0x14')](),path[_0x53eb('0x13')](_0x4786d3[_0x53eb('0x12')])));}})});router[_0x53eb('0x15')]('/',upload['single'](_0x53eb('0x16')),controller[_0x53eb('0x17')]);router['put'](_0x53eb('0x8'),auth['isAuthenticated'](),controller[_0x53eb('0x18')]);router[_0x53eb('0x19')](_0x53eb('0x8'),auth[_0x53eb('0x6')](),controller[_0x53eb('0x19')]);module[_0x53eb('0x1a')]=router; \ No newline at end of file +var _0xd928=['show','/:id/download','download','diskStorage','server/files/sounds/original/','replace','format','%s-%s%s','basename','extname','originalname','post','single','file','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd928,0x18b));var _0x8d92=function(_0x1f6f48,_0x94b9e7){_0x1f6f48=_0x1f6f48-0x0;var _0x17aef7=_0xd928[_0x1f6f48];return _0x17aef7;};'use strict';var multer=require(_0x8d92('0x0'));var util=require(_0x8d92('0x1'));var path=require('path');var timeout=require(_0x8d92('0x2'));var express=require(_0x8d92('0x3'));var router=express['Router']();var auth=require(_0x8d92('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8d92('0x5'));var controller=require(_0x8d92('0x6'));router[_0x8d92('0x7')]('/',auth[_0x8d92('0x8')](),controller[_0x8d92('0x9')]);router[_0x8d92('0x7')](_0x8d92('0xa'),auth[_0x8d92('0x8')](),controller[_0x8d92('0xb')]);router[_0x8d92('0x7')](_0x8d92('0xc'),auth[_0x8d92('0x8')](),controller[_0x8d92('0xd')]);var upload=multer({'storage':multer[_0x8d92('0xe')]({'destination':function(_0xc9d0aa,_0x4c8f9f,_0x2c921b){_0x2c921b(null,path['join'](config['root'],_0x8d92('0xf')));},'filename':function(_0x2efa9a,_0x3f370a,_0x302ce2){_0x3f370a['originalname']=_0x3f370a['originalname'][_0x8d92('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x302ce2(null,util[_0x8d92('0x11')](_0x8d92('0x12'),path[_0x8d92('0x13')](_0x3f370a['originalname'],path[_0x8d92('0x14')](_0x3f370a[_0x8d92('0x15')])),Date['now'](),path[_0x8d92('0x14')](_0x3f370a['originalname'])));}})});router[_0x8d92('0x16')]('/',upload[_0x8d92('0x17')](_0x8d92('0x18')),controller['create']);router[_0x8d92('0x19')](_0x8d92('0xa'),auth[_0x8d92('0x8')](),controller[_0x8d92('0x1a')]);router[_0x8d92('0x1b')](_0x8d92('0xa'),auth[_0x8d92('0x8')](),controller[_0x8d92('0x1b')]);module[_0x8d92('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 5e89efe..86ab4e6 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 _0x98d5=['name','BIGINT','INTEGER','exports','STRING'];(function(_0x184abd,_0x3bf822){var _0x48e2e0=function(_0x51ebd9){while(--_0x51ebd9){_0x184abd['push'](_0x184abd['shift']());}};_0x48e2e0(++_0x3bf822);}(_0x98d5,0x7b));var _0x598d=function(_0xb97ba,_0x2d2933){_0xb97ba=_0xb97ba-0x0;var _0x1fd77b=_0x98d5[_0xb97ba];return _0x1fd77b;};'use strict';var Sequelize=require('sequelize');module[_0x598d('0x0')]={'name':{'type':Sequelize[_0x598d('0x1')],'unique':_0x598d('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x598d('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x598d('0x1')]},'original_format':{'type':Sequelize[_0x598d('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x598d('0x3')]},'original_channelCount':{'type':Sequelize[_0x598d('0x4')]},'original_bitRate':{'type':Sequelize[_0x598d('0x3')]},'original_sampleRate':{'type':Sequelize[_0x598d('0x4')]},'converted_format':{'type':Sequelize[_0x598d('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x598d('0x3')]},'converted_channelCount':{'type':Sequelize[_0x598d('0x4')]},'converted_bitRate':{'type':Sequelize[_0x598d('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x598d('0x4')]}}; \ No newline at end of file +var _0x85a3=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x2f6dfe,_0x115dab){var _0x5e5c9c=function(_0x502840){while(--_0x502840){_0x2f6dfe['push'](_0x2f6dfe['shift']());}};_0x5e5c9c(++_0x115dab);}(_0x85a3,0x1ce));var _0x385a=function(_0x3765f5,_0x25d43b){_0x3765f5=_0x3765f5-0x0;var _0x3234a1=_0x85a3[_0x3765f5];return _0x3234a1;};'use strict';var Sequelize=require(_0x385a('0x0'));module[_0x385a('0x1')]={'name':{'type':Sequelize[_0x385a('0x2')],'unique':_0x385a('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x385a('0x2')]},'display_name':{'type':Sequelize[_0x385a('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x385a('0x2')]},'original_duration':{'type':Sequelize[_0x385a('0x4')]},'original_sampleCount':{'type':Sequelize[_0x385a('0x5')]},'original_channelCount':{'type':Sequelize[_0x385a('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x385a('0x2')]},'converted_duration':{'type':Sequelize[_0x385a('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x385a('0x5')]},'converted_channelCount':{'type':Sequelize[_0x385a('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index fbb0c83..aa832d5 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 _0xe9da=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','get','destroy','error','name','index','map','Sound','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','download','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','%s.%s','format','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Sounds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','pick','description','delete','original_format','unlinkSync','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x69a1bf,_0x445ad2){var _0xe1a455=function(_0x276587){while(--_0x276587){_0x69a1bf['push'](_0x69a1bf['shift']());}};_0xe1a455(++_0x445ad2);}(_0xe9da,0x16e));var _0xae9d=function(_0x45df26,_0x3a430c){_0x45df26=_0x45df26-0x0;var _0x420dc3=_0xe9da[_0x45df26];return _0x420dc3;};'use strict';var pdf=require(_0xae9d('0x0'));var emlformat=require(_0xae9d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xae9d('0x2'));var rp=require('request-promise');var moment=require(_0xae9d('0x3'));var BPromise=require(_0xae9d('0x4'));var Mustache=require(_0xae9d('0x5'));var util=require(_0xae9d('0x6'));var path=require(_0xae9d('0x7'));var sox=require(_0xae9d('0x8'));var csv=require(_0xae9d('0x9'));var ejs=require(_0xae9d('0xa'));var fs=require('fs');var _=require(_0xae9d('0xb'));var squel=require('squel');var crypto=require(_0xae9d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xae9d('0xd'));var toCsv=require(_0xae9d('0x9'));var querystring=require(_0xae9d('0xe'));var Papa=require('papaparse');var Redis=require(_0xae9d('0xf'));var authService=require(_0xae9d('0x10'));var qs=require(_0xae9d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae9d('0x12'));var logger=require(_0xae9d('0x13'))(_0xae9d('0x14'));var utils=require(_0xae9d('0x15'));var config=require(_0xae9d('0x16'));var licenseUtil=require(_0xae9d('0x17'));var db=require(_0xae9d('0x18'))['db'];function respondWithStatusCode(_0x3c5203,_0x37ecb4){_0x37ecb4=_0x37ecb4||0xcc;return function(_0x24eb79){if(_0x24eb79){return _0x3c5203[_0xae9d('0x19')](_0x37ecb4);}return _0x3c5203[_0xae9d('0x1a')](_0x37ecb4)[_0xae9d('0x1b')]();};}function respondWithResult(_0xa3afcc,_0x471a99){_0x471a99=_0x471a99||0xc8;return function(_0x1ea39c){if(_0x1ea39c){return _0xa3afcc[_0xae9d('0x1a')](_0x471a99)[_0xae9d('0x1c')](_0x1ea39c);}};}function respondWithFilteredResult(_0x5d3d7e,_0x271332){return function(_0x2c058b){if(_0x2c058b){var _0x30fbc8=_0x2c058b['count'],_0x50cd00=_0x271332[_0xae9d('0x1d')],_0x48dae1=_0x271332[_0xae9d('0x1d')]+_0x271332[_0xae9d('0x1e')],_0x48ebdf;if(_0x48dae1>=_0x30fbc8){_0x48dae1=_0x30fbc8;_0x48ebdf=0xc8;}else{_0x48ebdf=0xce;}_0x5d3d7e[_0xae9d('0x1a')](_0x48ebdf);return _0x5d3d7e[_0xae9d('0x1f')](_0xae9d('0x20'),_0x50cd00+'-'+_0x48dae1+'/'+_0x30fbc8)[_0xae9d('0x1c')](_0x2c058b);}return null;};}function patchUpdates(_0x11b10e){return function(_0x222b6d){try{jsonpatch[_0xae9d('0x21')](_0x222b6d,_0x11b10e,!![]);}catch(_0x6da77c){return BPromise[_0xae9d('0x22')](_0x6da77c);}return _0x222b6d[_0xae9d('0x23')]();};}function saveUpdates(_0x35c469,_0x5bf156){return function(_0x11a25b){if(_0x11a25b){return _0x11a25b['update'](_0x35c469)[_0xae9d('0x24')](function(_0x34ae94){return _0x34ae94;});}return null;};}function removeEntity(_0x469da2,_0x2f8669){return function(_0x93b00){if(_0x93b00){return _0x93b00['destroy']()[_0xae9d('0x24')](function(){var _0x577497=_0x93b00[_0xae9d('0x25')]({'plain':!![]});var _0x31e9e5='Sounds';return db['UserProfileResource'][_0xae9d('0x26')]({'where':{'type':_0x31e9e5,'resourceId':_0x577497['id']}})['then'](function(){return _0x93b00;});})[_0xae9d('0x24')](function(){_0x469da2[_0xae9d('0x1a')](0xcc)[_0xae9d('0x1b')]();});}};}function handleEntityNotFound(_0x336227,_0x187e16){return function(_0x3851ca){if(!_0x3851ca){_0x336227['sendStatus'](0x194);}return _0x3851ca;};}function handleError(_0x540ea4,_0x57e764){_0x57e764=_0x57e764||0x1f4;return function(_0x154af7){logger[_0xae9d('0x27')](_0x154af7['stack']);if(_0x154af7['name']){delete _0x154af7[_0xae9d('0x28')];}_0x540ea4[_0xae9d('0x1a')](_0x57e764)['send'](_0x154af7);};}exports[_0xae9d('0x29')]=function(_0x5b5377,_0x47a146){var _0x3e43f3={},_0x1308e7={},_0x502f69={'count':0x0,'rows':[]};var _0x2f448e=_[_0xae9d('0x2a')](db[_0xae9d('0x2b')]['rawAttributes'],function(_0x3c70e1){return{'name':_0x3c70e1[_0xae9d('0x2c')],'type':_0x3c70e1[_0xae9d('0x2d')]['key']};});_0x1308e7[_0xae9d('0x2e')]=_[_0xae9d('0x2a')](_0x2f448e,_0xae9d('0x28'));_0x1308e7[_0xae9d('0x2f')]=_[_0xae9d('0x30')](_0x5b5377[_0xae9d('0x2f')]);_0x1308e7[_0xae9d('0x31')]=_[_0xae9d('0x32')](_0x1308e7[_0xae9d('0x2e')],_0x1308e7[_0xae9d('0x2f')]);_0x3e43f3['attributes']=_['intersection'](_0x1308e7[_0xae9d('0x2e')],qs[_0xae9d('0x33')](_0x5b5377[_0xae9d('0x2f')]['fields']));_0x3e43f3['attributes']=_0x3e43f3[_0xae9d('0x34')][_0xae9d('0x35')]?_0x3e43f3[_0xae9d('0x34')]:_0x1308e7[_0xae9d('0x2e')];if(!_0x5b5377[_0xae9d('0x2f')][_0xae9d('0x36')](_0xae9d('0x37'))){_0x3e43f3[_0xae9d('0x1e')]=qs[_0xae9d('0x1e')](_0x5b5377['query'][_0xae9d('0x1e')]);_0x3e43f3[_0xae9d('0x1d')]=qs[_0xae9d('0x1d')](_0x5b5377[_0xae9d('0x2f')][_0xae9d('0x1d')]);}_0x3e43f3[_0xae9d('0x38')]=qs['sort'](_0x5b5377[_0xae9d('0x2f')][_0xae9d('0x39')]);_0x3e43f3[_0xae9d('0x3a')]=qs[_0xae9d('0x31')](_['pick'](_0x5b5377[_0xae9d('0x2f')],_0x1308e7[_0xae9d('0x31')]),_0x2f448e);if(_0x5b5377[_0xae9d('0x2f')][_0xae9d('0x3b')]){_0x3e43f3[_0xae9d('0x3a')]=_[_0xae9d('0x3c')](_0x3e43f3[_0xae9d('0x3a')],{'$or':_[_0xae9d('0x2a')](_0x2f448e,function(_0x2dbc7e){if(_0x2dbc7e[_0xae9d('0x2d')]!==_0xae9d('0x3d')){var _0x41f7af={};_0x41f7af[_0x2dbc7e['name']]={'$like':'%'+_0x5b5377[_0xae9d('0x2f')][_0xae9d('0x3b')]+'%'};return _0x41f7af;}})});}_0x3e43f3=_['merge']({},_0x3e43f3,_0x5b5377[_0xae9d('0x3e')]);var _0x4eb157={'where':_0x3e43f3[_0xae9d('0x3a')]};return db[_0xae9d('0x2b')][_0xae9d('0x3f')](_0x4eb157)[_0xae9d('0x24')](function(_0x44f7d6){_0x502f69[_0xae9d('0x3f')]=_0x44f7d6;if(_0x5b5377[_0xae9d('0x2f')]['includeAll']){_0x3e43f3[_0xae9d('0x40')]=[{'all':!![]}];}return db[_0xae9d('0x2b')][_0xae9d('0x41')](_0x3e43f3);})[_0xae9d('0x24')](function(_0x483276){_0x502f69[_0xae9d('0x42')]=_0x483276;return _0x502f69;})['then'](respondWithFilteredResult(_0x47a146,_0x3e43f3))[_0xae9d('0x43')](handleError(_0x47a146,null));};exports[_0xae9d('0x44')]=function(_0x2a6c23,_0x4b8d7b){var _0x35b349={'raw':!![],'where':{'id':_0x2a6c23[_0xae9d('0x45')]['id']}},_0x14b905={};_0x14b905['model']=_[_0xae9d('0x30')](db['Sound'][_0xae9d('0x46')]);_0x14b905[_0xae9d('0x2f')]=_[_0xae9d('0x30')](_0x2a6c23[_0xae9d('0x2f')]);_0x14b905[_0xae9d('0x31')]=_[_0xae9d('0x32')](_0x14b905[_0xae9d('0x2e')],_0x14b905['query']);_0x35b349[_0xae9d('0x34')]=_[_0xae9d('0x32')](_0x14b905[_0xae9d('0x2e')],qs[_0xae9d('0x33')](_0x2a6c23['query'][_0xae9d('0x33')]));_0x35b349[_0xae9d('0x34')]=_0x35b349['attributes'][_0xae9d('0x35')]?_0x35b349[_0xae9d('0x34')]:_0x14b905[_0xae9d('0x2e')];if(_0x2a6c23['query'][_0xae9d('0x47')]){_0x35b349[_0xae9d('0x40')]=[{'all':!![]}];}_0x35b349=_['merge']({},_0x35b349,_0x2a6c23[_0xae9d('0x3e')]);return db[_0xae9d('0x2b')][_0xae9d('0x48')](_0x35b349)['then'](handleEntityNotFound(_0x4b8d7b,null))['then'](respondWithResult(_0x4b8d7b,null))['catch'](handleError(_0x4b8d7b,null));};exports[_0xae9d('0x49')]=function(_0x3d10de,_0x51b3f4,_0xa5c2e6){return db['Sound']['find']({'where':{'id':_0x3d10de[_0xae9d('0x45')]['id']},'attributes':[_0xae9d('0x28'),_0xae9d('0x4a'),_0xae9d('0x4b')],'raw':!![]})[_0xae9d('0x24')](handleEntityNotFound(_0x51b3f4,null))[_0xae9d('0x24')](function(_0x58d336){if(_0x58d336){if(!fs[_0xae9d('0x4c')](path[_0xae9d('0x4d')](config['root'],_0xae9d('0x4e'),_0x58d336['save_name']+'.'+_0x58d336[_0xae9d('0x4b')]))){throw new db[(_0xae9d('0x4f'))][(_0xae9d('0x50'))](_0xae9d('0x51'));}return _0x51b3f4[_0xae9d('0x49')](path['join'](config[_0xae9d('0x52')],_0xae9d('0x4e'),util['format'](_0xae9d('0x53'),_0x58d336[_0xae9d('0x4a')],_0x58d336[_0xae9d('0x4b')])),util[_0xae9d('0x54')](_0xae9d('0x53'),_0x58d336[_0xae9d('0x28')],_0x58d336[_0xae9d('0x4b')]));}return null;})[_0xae9d('0x43')](handleError(_0x51b3f4,null));};exports[_0xae9d('0x55')]=function(_0x208ef9,_0x55fa49,_0x378362){var _0x1ba8cb={'name':path[_0xae9d('0x56')](_0x208ef9[_0xae9d('0x57')][_0xae9d('0x58')],path['extname'](_0x208ef9[_0xae9d('0x57')]['originalname'])),'save_name':path[_0xae9d('0x56')](_0x208ef9[_0xae9d('0x57')][_0xae9d('0x59')],path[_0xae9d('0x5a')](_0x208ef9[_0xae9d('0x57')][_0xae9d('0x59')])),'original_format':path[_0xae9d('0x5a')](_0x208ef9[_0xae9d('0x57')][_0xae9d('0x58')])[_0xae9d('0x5b')](0x1),'converted_format':_0xae9d('0x5c')};var _0x304164=path[_0xae9d('0x4d')](config[_0xae9d('0x52')],_0xae9d('0x5d'),_0x208ef9[_0xae9d('0x57')][_0xae9d('0x59')]);var _0x29fc17=path[_0xae9d('0x4d')](config['root'],_0xae9d('0x4e'),util[_0xae9d('0x54')]('%s.%s',path[_0xae9d('0x56')](_0x208ef9['file']['filename'],path[_0xae9d('0x5a')](_0x208ef9[_0xae9d('0x57')][_0xae9d('0x59')])),_0x1ba8cb[_0xae9d('0x4b')]));logger[_0xae9d('0x5e')](_0xae9d('0x5f'),_0x304164);logger[_0xae9d('0x5e')](_0xae9d('0x60'),_0x29fc17);try{fs[_0xae9d('0x61')](_0x304164,parseInt('0777',0x8));var _0x55c8dc=sox[_0xae9d('0x62')](_0x304164,_0x29fc17,{'sampleRate':0x1f40,'format':_0xae9d('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x55c8dc['on'](_0xae9d('0x27'),function(_0x4ff187){fs['unlinkSync'](_0x304164);_0x55fa49[_0xae9d('0x1a')](0x1f4)['send'](_0x4ff187);});_0x55c8dc['on'](_0xae9d('0x63'),function(_0xb51ed0){_0x1ba8cb[_0xae9d('0x64')]=isNaN(_0xb51ed0[_0xae9d('0x65')])?null:_0xb51ed0[_0xae9d('0x65')]*0x3e8;_0x1ba8cb['original_sampleCount']=isNaN(_0xb51ed0[_0xae9d('0x66')])?null:_0xb51ed0['sampleCount'];_0x1ba8cb[_0xae9d('0x67')]=isNaN(_0xb51ed0[_0xae9d('0x68')])?null:_0xb51ed0['channelCount'];_0x1ba8cb[_0xae9d('0x69')]=isNaN(_0xb51ed0[_0xae9d('0x6a')])?null:_0xb51ed0[_0xae9d('0x6a')];_0x1ba8cb[_0xae9d('0x6b')]=isNaN(_0xb51ed0[_0xae9d('0x6c')])?null:_0xb51ed0[_0xae9d('0x6c')];});_0x55c8dc['on'](_0xae9d('0x6d'),function(_0x4b83e2){_0x1ba8cb[_0xae9d('0x6e')]=isNaN(_0x4b83e2[_0xae9d('0x65')])?null:_0x4b83e2['duration']*0x3e8;_0x1ba8cb[_0xae9d('0x6f')]=isNaN(_0x4b83e2[_0xae9d('0x66')])?null:_0x4b83e2[_0xae9d('0x66')];_0x1ba8cb['converted_channelCount']=isNaN(_0x4b83e2[_0xae9d('0x68')])?null:_0x4b83e2['channelCount'];_0x1ba8cb[_0xae9d('0x70')]=isNaN(_0x4b83e2[_0xae9d('0x6a')])?null:_0x4b83e2['bitRate'];_0x1ba8cb[_0xae9d('0x71')]=isNaN(_0x4b83e2['sampleRate'])?null:_0x4b83e2['sampleRate'];});_0x55c8dc['on'](_0xae9d('0x1b'),function(){fs[_0xae9d('0x61')](_0x29fc17,parseInt('0777',0x8));return db[_0xae9d('0x2b')][_0xae9d('0x55')](_0x1ba8cb)['then'](function(_0x386c99){var _0x30da9e={'role':_0x208ef9['body']['role'],'userProfileId':_0x208ef9[_0xae9d('0x72')][_0xae9d('0x73')]};if(!_0x30da9e)throw new Error(_0xae9d('0x74'));if(_0x30da9e[_0xae9d('0x75')]===_0xae9d('0x76')){var _0x49db86=_0x386c99['get']({'plain':!![]});return db[_0xae9d('0x77')]['find']({'where':{'name':_0xae9d('0x78'),'userProfileId':_0x30da9e[_0xae9d('0x73')]},'raw':!![]})['then'](function(_0x241dda){if(_0x241dda&&_0x241dda['autoAssociation']===0x0){return db['UserProfileResource'][_0xae9d('0x55')]({'name':_0x49db86[_0xae9d('0x28')],'resourceId':_0x49db86['id'],'type':_0x241dda[_0xae9d('0x28')],'sectionId':_0x241dda['id']},{})[_0xae9d('0x24')](function(){return _0x386c99;});}else{return _0x386c99;}})[_0xae9d('0x43')](function(_0x492d0e){logger['error'](_0xae9d('0x79'),_0x492d0e);throw _0x492d0e;});}return _0x386c99;})[_0xae9d('0x24')](respondWithResult(_0x55fa49,null))[_0xae9d('0x43')](handleError(_0x55fa49,null));});_0x55c8dc[_0xae9d('0x7a')]();}catch(_0x431792){_0x55fa49[_0xae9d('0x1a')](0x1f4)['send'](_0x431792);}};exports[_0xae9d('0x7b')]=function(_0x2cd65a,_0x3e28e6,_0xfe20d){return db[_0xae9d('0x2b')][_0xae9d('0x48')]({'where':{'id':_0x2cd65a[_0xae9d('0x45')]['id']}})[_0xae9d('0x24')](handleEntityNotFound(_0x3e28e6,null))['then'](saveUpdates(_[_0xae9d('0x7c')](_0x2cd65a['body'],['name',_0xae9d('0x7d')]),null))[_0xae9d('0x24')](respondWithResult(_0x3e28e6,null))[_0xae9d('0x43')](handleError(_0x3e28e6,null));};exports[_0xae9d('0x7e')]=function(_0x8b0bca,_0x856dbf,_0x2db227){return db[_0xae9d('0x2b')][_0xae9d('0x48')]({'where':{'id':_0x8b0bca[_0xae9d('0x45')]['id']}})['then'](function(_0x5d4e2a){if(_0x5d4e2a){return _0x5d4e2a[_0xae9d('0x26')]();}})[_0xae9d('0x24')](function(_0x20ca2e){var _0x1f5f96=path[_0xae9d('0x4d')](config[_0xae9d('0x52')],_0xae9d('0x5d'),util[_0xae9d('0x54')](_0xae9d('0x53'),_0x20ca2e[_0xae9d('0x4a')],_0x20ca2e[_0xae9d('0x7f')]));var _0xd4e1a7=path[_0xae9d('0x4d')](config[_0xae9d('0x52')],'server/files/sounds/converted',util[_0xae9d('0x54')](_0xae9d('0x53'),_0x20ca2e[_0xae9d('0x4a')],_0x20ca2e[_0xae9d('0x4b')]));fs[_0xae9d('0x80')](_0x1f5f96);fs[_0xae9d('0x80')](_0xd4e1a7);return _0x20ca2e;})[_0xae9d('0x24')](function(_0x3c480c){if(_0x3c480c){return _0x856dbf[_0xae9d('0x1a')](0xcc)[_0xae9d('0x1b')]();}})['then'](handleEntityNotFound(_0x856dbf,null))[_0xae9d('0x43')](handleError(_0x856dbf,null));}; \ No newline at end of file +var _0xdb1b=['duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','server/files/sounds/converted','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','jsforce','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','offset','limit','json','apply','update','then','Sounds','UserProfileResource','destroy','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','Sound','count','includeAll','include','rows','catch','find','params','save_name','converted_format','existsSync','root','Sequelize','ValidationError','download','join','format','%s.%s','create','originalname','extname','file','basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','error','unlinkSync','send','original_duration'];(function(_0x943f51,_0x49be73){var _0x4acb0e=function(_0x4b2cca){while(--_0x4b2cca){_0x943f51['push'](_0x943f51['shift']());}};_0x4acb0e(++_0x49be73);}(_0xdb1b,0x8e));var _0xbdb1=function(_0x246314,_0x2ded4f){_0x246314=_0x246314-0x0;var _0x3cb029=_0xdb1b[_0x246314];return _0x3cb029;};'use strict';var pdf=require(_0xbdb1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbdb1('0x1'));var zipdir=require(_0xbdb1('0x2'));var jsonpatch=require(_0xbdb1('0x3'));var rp=require(_0xbdb1('0x4'));var moment=require(_0xbdb1('0x5'));var BPromise=require(_0xbdb1('0x6'));var Mustache=require(_0xbdb1('0x7'));var util=require(_0xbdb1('0x8'));var path=require(_0xbdb1('0x9'));var sox=require(_0xbdb1('0xa'));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(_0xbdb1('0xb'));var deskjs=require(_0xbdb1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbdb1('0xd'));var Papa=require('papaparse');var Redis=require(_0xbdb1('0xe'));var authService=require(_0xbdb1('0xf'));var qs=require(_0xbdb1('0x10'));var as=require(_0xbdb1('0x11'));var hardwareService=require(_0xbdb1('0x12'));var logger=require(_0xbdb1('0x13'))(_0xbdb1('0x14'));var utils=require(_0xbdb1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbdb1('0x16'));var db=require(_0xbdb1('0x17'))['db'];function respondWithStatusCode(_0x592d12,_0x52cb48){_0x52cb48=_0x52cb48||0xcc;return function(_0x5a531e){if(_0x5a531e){return _0x592d12[_0xbdb1('0x18')](_0x52cb48);}return _0x592d12[_0xbdb1('0x19')](_0x52cb48)[_0xbdb1('0x1a')]();};}function respondWithResult(_0x2a1acb,_0x3429b4){_0x3429b4=_0x3429b4||0xc8;return function(_0x375114){if(_0x375114){return _0x2a1acb[_0xbdb1('0x19')](_0x3429b4)['json'](_0x375114);}};}function respondWithFilteredResult(_0x320cae,_0x295560){return function(_0x335fce){if(_0x335fce){var _0x55cfe2=_0x335fce['count'],_0x17f7ee=_0x295560[_0xbdb1('0x1b')],_0x414f65=_0x295560[_0xbdb1('0x1b')]+_0x295560[_0xbdb1('0x1c')],_0x1c96d9;if(_0x414f65>=_0x55cfe2){_0x414f65=_0x55cfe2;_0x1c96d9=0xc8;}else{_0x1c96d9=0xce;}_0x320cae[_0xbdb1('0x19')](_0x1c96d9);return _0x320cae['set']('Content-Range',_0x17f7ee+'-'+_0x414f65+'/'+_0x55cfe2)[_0xbdb1('0x1d')](_0x335fce);}return null;};}function patchUpdates(_0x2d965b){return function(_0x1da5fe){try{jsonpatch[_0xbdb1('0x1e')](_0x1da5fe,_0x2d965b,!![]);}catch(_0x20d522){return BPromise['reject'](_0x20d522);}return _0x1da5fe['save']();};}function saveUpdates(_0x9e2e30,_0x5dc328){return function(_0x4ded30){if(_0x4ded30){return _0x4ded30[_0xbdb1('0x1f')](_0x9e2e30)[_0xbdb1('0x20')](function(_0x1383a6){return _0x1383a6;});}return null;};}function removeEntity(_0x2dd5cb,_0x361e45){return function(_0x408b17){if(_0x408b17){return _0x408b17['destroy']()[_0xbdb1('0x20')](function(){var _0x3d50cb=_0x408b17['get']({'plain':!![]});var _0x82aec4=_0xbdb1('0x21');return db[_0xbdb1('0x22')][_0xbdb1('0x23')]({'where':{'type':_0x82aec4,'resourceId':_0x3d50cb['id']}})[_0xbdb1('0x20')](function(){return _0x408b17;});})['then'](function(){_0x2dd5cb[_0xbdb1('0x19')](0xcc)[_0xbdb1('0x1a')]();});}};}function handleEntityNotFound(_0x4f6db1,_0x5f58d9){return function(_0x41dfcf){if(!_0x41dfcf){_0x4f6db1[_0xbdb1('0x18')](0x194);}return _0x41dfcf;};}function handleError(_0x1f907c,_0x45281e){_0x45281e=_0x45281e||0x1f4;return function(_0x2b54b9){logger['error'](_0x2b54b9[_0xbdb1('0x24')]);if(_0x2b54b9['name']){delete _0x2b54b9[_0xbdb1('0x25')];}_0x1f907c['status'](_0x45281e)['send'](_0x2b54b9);};}exports[_0xbdb1('0x26')]=function(_0x562068,_0x3be408){var _0x4b7495={},_0x5e1983={},_0x4ea358={'count':0x0,'rows':[]};var _0x5527e9=_[_0xbdb1('0x27')](db['Sound'][_0xbdb1('0x28')],function(_0xa9af1e){return{'name':_0xa9af1e['fieldName'],'type':_0xa9af1e['type'][_0xbdb1('0x29')]};});_0x5e1983[_0xbdb1('0x2a')]=_[_0xbdb1('0x27')](_0x5527e9,_0xbdb1('0x25'));_0x5e1983[_0xbdb1('0x2b')]=_[_0xbdb1('0x2c')](_0x562068['query']);_0x5e1983[_0xbdb1('0x2d')]=_[_0xbdb1('0x2e')](_0x5e1983[_0xbdb1('0x2a')],_0x5e1983['query']);_0x4b7495[_0xbdb1('0x2f')]=_[_0xbdb1('0x2e')](_0x5e1983['model'],qs[_0xbdb1('0x30')](_0x562068[_0xbdb1('0x2b')][_0xbdb1('0x30')]));_0x4b7495[_0xbdb1('0x2f')]=_0x4b7495[_0xbdb1('0x2f')][_0xbdb1('0x31')]?_0x4b7495[_0xbdb1('0x2f')]:_0x5e1983[_0xbdb1('0x2a')];if(!_0x562068[_0xbdb1('0x2b')][_0xbdb1('0x32')](_0xbdb1('0x33'))){_0x4b7495[_0xbdb1('0x1c')]=qs[_0xbdb1('0x1c')](_0x562068[_0xbdb1('0x2b')][_0xbdb1('0x1c')]);_0x4b7495[_0xbdb1('0x1b')]=qs[_0xbdb1('0x1b')](_0x562068[_0xbdb1('0x2b')]['offset']);}_0x4b7495['order']=qs['sort'](_0x562068[_0xbdb1('0x2b')][_0xbdb1('0x34')]);_0x4b7495[_0xbdb1('0x35')]=qs[_0xbdb1('0x2d')](_[_0xbdb1('0x36')](_0x562068['query'],_0x5e1983[_0xbdb1('0x2d')]),_0x5527e9);if(_0x562068[_0xbdb1('0x2b')][_0xbdb1('0x37')]){_0x4b7495[_0xbdb1('0x35')]=_['merge'](_0x4b7495[_0xbdb1('0x35')],{'$or':_[_0xbdb1('0x27')](_0x5527e9,function(_0x29f1f5){if(_0x29f1f5[_0xbdb1('0x38')]!==_0xbdb1('0x39')){var _0x4099de={};_0x4099de[_0x29f1f5['name']]={'$like':'%'+_0x562068[_0xbdb1('0x2b')]['filter']+'%'};return _0x4099de;}})});}_0x4b7495=_[_0xbdb1('0x3a')]({},_0x4b7495,_0x562068[_0xbdb1('0x3b')]);var _0x2a66f9={'where':_0x4b7495[_0xbdb1('0x35')]};return db[_0xbdb1('0x3c')]['count'](_0x2a66f9)['then'](function(_0x3bf8db){_0x4ea358[_0xbdb1('0x3d')]=_0x3bf8db;if(_0x562068[_0xbdb1('0x2b')][_0xbdb1('0x3e')]){_0x4b7495[_0xbdb1('0x3f')]=[{'all':!![]}];}return db[_0xbdb1('0x3c')]['findAll'](_0x4b7495);})['then'](function(_0x2f9399){_0x4ea358[_0xbdb1('0x40')]=_0x2f9399;return _0x4ea358;})['then'](respondWithFilteredResult(_0x3be408,_0x4b7495))[_0xbdb1('0x41')](handleError(_0x3be408,null));};exports['show']=function(_0x966325,_0x18fd0a){var _0x5b77fa={'raw':!![],'where':{'id':_0x966325['params']['id']}},_0x28ec3b={};_0x28ec3b[_0xbdb1('0x2a')]=_['keys'](db[_0xbdb1('0x3c')][_0xbdb1('0x28')]);_0x28ec3b['query']=_[_0xbdb1('0x2c')](_0x966325[_0xbdb1('0x2b')]);_0x28ec3b[_0xbdb1('0x2d')]=_[_0xbdb1('0x2e')](_0x28ec3b['model'],_0x28ec3b[_0xbdb1('0x2b')]);_0x5b77fa[_0xbdb1('0x2f')]=_[_0xbdb1('0x2e')](_0x28ec3b[_0xbdb1('0x2a')],qs[_0xbdb1('0x30')](_0x966325[_0xbdb1('0x2b')][_0xbdb1('0x30')]));_0x5b77fa[_0xbdb1('0x2f')]=_0x5b77fa[_0xbdb1('0x2f')]['length']?_0x5b77fa['attributes']:_0x28ec3b['model'];if(_0x966325[_0xbdb1('0x2b')][_0xbdb1('0x3e')]){_0x5b77fa[_0xbdb1('0x3f')]=[{'all':!![]}];}_0x5b77fa=_[_0xbdb1('0x3a')]({},_0x5b77fa,_0x966325[_0xbdb1('0x3b')]);return db[_0xbdb1('0x3c')][_0xbdb1('0x42')](_0x5b77fa)['then'](handleEntityNotFound(_0x18fd0a,null))['then'](respondWithResult(_0x18fd0a,null))[_0xbdb1('0x41')](handleError(_0x18fd0a,null));};exports['download']=function(_0x5d4f12,_0x33a48a,_0x70e39d){return db[_0xbdb1('0x3c')][_0xbdb1('0x42')]({'where':{'id':_0x5d4f12[_0xbdb1('0x43')]['id']},'attributes':[_0xbdb1('0x25'),_0xbdb1('0x44'),_0xbdb1('0x45')],'raw':!![]})[_0xbdb1('0x20')](handleEntityNotFound(_0x33a48a,null))[_0xbdb1('0x20')](function(_0x5cab31){if(_0x5cab31){if(!fs[_0xbdb1('0x46')](path['join'](config[_0xbdb1('0x47')],'server/files/sounds/converted',_0x5cab31[_0xbdb1('0x44')]+'.'+_0x5cab31[_0xbdb1('0x45')]))){throw new db[(_0xbdb1('0x48'))][(_0xbdb1('0x49'))]('Sound\x20not\x20found');}return _0x33a48a[_0xbdb1('0x4a')](path[_0xbdb1('0x4b')](config[_0xbdb1('0x47')],'server/files/sounds/converted',util[_0xbdb1('0x4c')](_0xbdb1('0x4d'),_0x5cab31['save_name'],_0x5cab31[_0xbdb1('0x45')])),util[_0xbdb1('0x4c')](_0xbdb1('0x4d'),_0x5cab31['name'],_0x5cab31[_0xbdb1('0x45')]));}return null;})[_0xbdb1('0x41')](handleError(_0x33a48a,null));};exports[_0xbdb1('0x4e')]=function(_0x5d96a6,_0x50fe6a,_0x4105a8){var _0x18ff04={'name':path['basename'](_0x5d96a6['file'][_0xbdb1('0x4f')],path[_0xbdb1('0x50')](_0x5d96a6[_0xbdb1('0x51')]['originalname'])),'save_name':path[_0xbdb1('0x52')](_0x5d96a6[_0xbdb1('0x51')][_0xbdb1('0x53')],path[_0xbdb1('0x50')](_0x5d96a6[_0xbdb1('0x51')]['filename'])),'original_format':path[_0xbdb1('0x50')](_0x5d96a6[_0xbdb1('0x51')][_0xbdb1('0x4f')])[_0xbdb1('0x54')](0x1),'converted_format':_0xbdb1('0x55')};var _0x233127=path[_0xbdb1('0x4b')](config[_0xbdb1('0x47')],_0xbdb1('0x56'),_0x5d96a6[_0xbdb1('0x51')][_0xbdb1('0x53')]);var _0x415995=path[_0xbdb1('0x4b')](config[_0xbdb1('0x47')],'server/files/sounds/converted',util[_0xbdb1('0x4c')]('%s.%s',path[_0xbdb1('0x52')](_0x5d96a6[_0xbdb1('0x51')]['filename'],path[_0xbdb1('0x50')](_0x5d96a6['file'][_0xbdb1('0x53')])),_0x18ff04[_0xbdb1('0x45')]));logger[_0xbdb1('0x57')](_0xbdb1('0x58'),_0x233127);logger['info'](_0xbdb1('0x59'),_0x415995);try{fs[_0xbdb1('0x5a')](_0x233127,parseInt('0777',0x8));var _0x4dac1e=sox[_0xbdb1('0x5b')](_0x233127,_0x415995,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4dac1e['on'](_0xbdb1('0x5c'),function(_0x71317b){fs[_0xbdb1('0x5d')](_0x233127);_0x50fe6a['status'](0x1f4)[_0xbdb1('0x5e')](_0x71317b);});_0x4dac1e['on']('src',function(_0xfb88cf){_0x18ff04[_0xbdb1('0x5f')]=isNaN(_0xfb88cf[_0xbdb1('0x60')])?null:_0xfb88cf[_0xbdb1('0x60')]*0x3e8;_0x18ff04['original_sampleCount']=isNaN(_0xfb88cf[_0xbdb1('0x61')])?null:_0xfb88cf[_0xbdb1('0x61')];_0x18ff04[_0xbdb1('0x62')]=isNaN(_0xfb88cf['channelCount'])?null:_0xfb88cf[_0xbdb1('0x63')];_0x18ff04[_0xbdb1('0x64')]=isNaN(_0xfb88cf['bitRate'])?null:_0xfb88cf[_0xbdb1('0x65')];_0x18ff04[_0xbdb1('0x66')]=isNaN(_0xfb88cf[_0xbdb1('0x67')])?null:_0xfb88cf[_0xbdb1('0x67')];});_0x4dac1e['on'](_0xbdb1('0x68'),function(_0x487806){_0x18ff04[_0xbdb1('0x69')]=isNaN(_0x487806[_0xbdb1('0x60')])?null:_0x487806['duration']*0x3e8;_0x18ff04[_0xbdb1('0x6a')]=isNaN(_0x487806[_0xbdb1('0x61')])?null:_0x487806['sampleCount'];_0x18ff04[_0xbdb1('0x6b')]=isNaN(_0x487806[_0xbdb1('0x63')])?null:_0x487806[_0xbdb1('0x63')];_0x18ff04['converted_bitRate']=isNaN(_0x487806[_0xbdb1('0x65')])?null:_0x487806[_0xbdb1('0x65')];_0x18ff04[_0xbdb1('0x6c')]=isNaN(_0x487806[_0xbdb1('0x67')])?null:_0x487806['sampleRate'];});_0x4dac1e['on'](_0xbdb1('0x1a'),function(){fs[_0xbdb1('0x5a')](_0x415995,parseInt('0777',0x8));return db['Sound'][_0xbdb1('0x4e')](_0x18ff04)[_0xbdb1('0x20')](function(_0x427143){var _0x1d5a44={'role':_0x5d96a6['body']['role'],'userProfileId':_0x5d96a6[_0xbdb1('0x6d')][_0xbdb1('0x6e')]};if(!_0x1d5a44)throw new Error(_0xbdb1('0x6f'));if(_0x1d5a44['role']==='user'){var _0x52807b=_0x427143['get']({'plain':!![]});return db[_0xbdb1('0x70')][_0xbdb1('0x42')]({'where':{'name':'Sounds','userProfileId':_0x1d5a44['userProfileId']},'raw':!![]})[_0xbdb1('0x20')](function(_0x477706){if(_0x477706&&_0x477706[_0xbdb1('0x71')]===0x0){return db[_0xbdb1('0x22')][_0xbdb1('0x4e')]({'name':_0x52807b[_0xbdb1('0x25')],'resourceId':_0x52807b['id'],'type':_0x477706[_0xbdb1('0x25')],'sectionId':_0x477706['id']},{})[_0xbdb1('0x20')](function(){return _0x427143;});}else{return _0x427143;}})['catch'](function(_0x43ed30){logger[_0xbdb1('0x5c')](_0xbdb1('0x72'),_0x43ed30);throw _0x43ed30;});}return _0x427143;})[_0xbdb1('0x20')](respondWithResult(_0x50fe6a,null))['catch'](handleError(_0x50fe6a,null));});_0x4dac1e['start']();}catch(_0x22baa8){_0x50fe6a[_0xbdb1('0x19')](0x1f4)['send'](_0x22baa8);}};exports[_0xbdb1('0x1f')]=function(_0x299b56,_0x2a6d37,_0x4177ed){return db[_0xbdb1('0x3c')][_0xbdb1('0x42')]({'where':{'id':_0x299b56[_0xbdb1('0x43')]['id']}})[_0xbdb1('0x20')](handleEntityNotFound(_0x2a6d37,null))[_0xbdb1('0x20')](saveUpdates(_[_0xbdb1('0x36')](_0x299b56[_0xbdb1('0x6d')],[_0xbdb1('0x25'),_0xbdb1('0x73')]),null))['then'](respondWithResult(_0x2a6d37,null))[_0xbdb1('0x41')](handleError(_0x2a6d37,null));};exports[_0xbdb1('0x74')]=function(_0x52d3be,_0x152965,_0x231c6e){return db['Sound'][_0xbdb1('0x42')]({'where':{'id':_0x52d3be[_0xbdb1('0x43')]['id']}})['then'](function(_0x14641c){if(_0x14641c){return _0x14641c[_0xbdb1('0x23')]();}})[_0xbdb1('0x20')](function(_0x2e3f64){var _0xc74767=path['join'](config[_0xbdb1('0x47')],'server/files/sounds/original',util[_0xbdb1('0x4c')](_0xbdb1('0x4d'),_0x2e3f64[_0xbdb1('0x44')],_0x2e3f64[_0xbdb1('0x75')]));var _0x271547=path[_0xbdb1('0x4b')](config['root'],_0xbdb1('0x76'),util[_0xbdb1('0x4c')](_0xbdb1('0x4d'),_0x2e3f64[_0xbdb1('0x44')],_0x2e3f64['converted_format']));fs[_0xbdb1('0x5d')](_0xc74767);fs[_0xbdb1('0x5d')](_0x271547);return _0x2e3f64;})[_0xbdb1('0x20')](function(_0x4747de){if(_0x4747de){return _0x152965[_0xbdb1('0x19')](0xcc)[_0xbdb1('0x1a')]();}})['then'](handleEntityNotFound(_0x152965,null))[_0xbdb1('0x41')](handleError(_0x152965,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 44647f3..40e622c 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 _0xac2d=['path','../../config/environment','./sound.attributes','define','tools_sounds','lodash','../../config/logger','api','moment','request-promise'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xac2d,0x127));var _0xdac2=function(_0x492f11,_0xb2afdd){_0x492f11=_0x492f11-0x0;var _0x3cf6a9=_0xac2d[_0x492f11];return _0x3cf6a9;};'use strict';var _=require(_0xdac2('0x0'));var util=require('util');var logger=require(_0xdac2('0x1'))(_0xdac2('0x2'));var moment=require(_0xdac2('0x3'));var BPromise=require('bluebird');var rp=require(_0xdac2('0x4'));var fs=require('fs');var path=require(_0xdac2('0x5'));var rimraf=require('rimraf');var config=require(_0xdac2('0x6'));var attributes=require(_0xdac2('0x7'));module['exports']=function(_0x142483,_0x28e948){return _0x142483[_0xdac2('0x8')]('Sound',attributes,{'tableName':_0xdac2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97f9=['./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1ca1bd,_0x3a5f09){var _0x5b7db6=function(_0x7b9d2){while(--_0x7b9d2){_0x1ca1bd['push'](_0x1ca1bd['shift']());}};_0x5b7db6(++_0x3a5f09);}(_0x97f9,0xbb));var _0x997f=function(_0x527279,_0x5b60c2){_0x527279=_0x527279-0x0;var _0x2e3bec=_0x97f9[_0x527279];return _0x2e3bec;};'use strict';var _=require(_0x997f('0x0'));var util=require(_0x997f('0x1'));var logger=require(_0x997f('0x2'))(_0x997f('0x3'));var moment=require('moment');var BPromise=require(_0x997f('0x4'));var rp=require(_0x997f('0x5'));var fs=require('fs');var path=require(_0x997f('0x6'));var rimraf=require(_0x997f('0x7'));var config=require(_0x997f('0x8'));var attributes=require(_0x997f('0x9'));module[_0x997f('0xa')]=function(_0x4edc93,_0x1ca916){return _0x4edc93[_0x997f('0xb')](_0x997f('0xc'),attributes,{'tableName':_0x997f('0xd'),'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 56b613d..1ca140e 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 _0x8095=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','Sound,\x20%s,\x20%s','message','result','catch','options','raw','where','attributes','map','include','model','ShowSound','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x11bdc4,_0x61012f){var _0x4d4da7=function(_0x921fd6){while(--_0x921fd6){_0x11bdc4['push'](_0x11bdc4['shift']());}};_0x4d4da7(++_0x61012f);}(_0x8095,0xdf));var _0x5809=function(_0x477f58,_0x1f3467){_0x477f58=_0x477f58-0x0;var _0x2afce5=_0x8095[_0x477f58];return _0x2afce5;};'use strict';var _=require(_0x5809('0x0'));var util=require(_0x5809('0x1'));var moment=require(_0x5809('0x2'));var BPromise=require(_0x5809('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5809('0x4'));var db=require(_0x5809('0x5'))['db'];var utils=require(_0x5809('0x6'));var logger=require(_0x5809('0x7'))(_0x5809('0x8'));var config=require(_0x5809('0x9'));var jayson=require(_0x5809('0xa'));var client=jayson[_0x5809('0xb')][_0x5809('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a7c84,_0x33d691,_0x45310a){return new BPromise(function(_0x3c336c,_0x388b22){return client[_0x5809('0xd')](_0x5a7c84,_0x45310a)[_0x5809('0xe')](function(_0x14fc07){logger[_0x5809('0xf')]('Sound,\x20%s,\x20%s',_0x33d691,_0x5809('0x10'));logger[_0x5809('0x11')](_0x5809('0x12'),_0x33d691,_0x5809('0x10'),JSON[_0x5809('0x13')](_0x14fc07));if(_0x14fc07[_0x5809('0x14')]){if(_0x14fc07[_0x5809('0x14')]['code']===0x1f4){logger[_0x5809('0x14')](_0x5809('0x15'),_0x33d691,_0x14fc07[_0x5809('0x14')][_0x5809('0x16')]);return _0x388b22(_0x14fc07['error'][_0x5809('0x16')]);}logger[_0x5809('0x14')](_0x5809('0x15'),_0x33d691,_0x14fc07['error'][_0x5809('0x16')]);return _0x3c336c(_0x14fc07[_0x5809('0x14')][_0x5809('0x16')]);}else{logger[_0x5809('0xf')](_0x5809('0x15'),_0x33d691,'request\x20sent');_0x3c336c(_0x14fc07[_0x5809('0x17')][_0x5809('0x16')]);}})[_0x5809('0x18')](function(_0x21dcf8){logger[_0x5809('0x14')](_0x5809('0x15'),_0x33d691,_0x21dcf8);_0x388b22(_0x21dcf8);});});}exports['ShowSound']=function(_0x24ec23){var _0x4e2f5b=this;return new Promise(function(_0x2c8a16,_0x19aeae){return db['Sound']['find']({'raw':_0x24ec23[_0x5809('0x19')]?_0x24ec23['options'][_0x5809('0x1a')]===undefined?!![]:![]:!![],'where':_0x24ec23['options']?_0x24ec23[_0x5809('0x19')][_0x5809('0x1b')]||null:null,'attributes':_0x24ec23['options']?_0x24ec23[_0x5809('0x19')][_0x5809('0x1c')]||null:null,'include':_0x24ec23[_0x5809('0x19')]?_0x24ec23['options']['include']?_[_0x5809('0x1d')](_0x24ec23[_0x5809('0x19')][_0x5809('0x1e')],function(_0x1480f9){return{'model':db[_0x1480f9[_0x5809('0x1f')]],'as':_0x1480f9['as'],'attributes':_0x1480f9[_0x5809('0x1c')],'include':_0x1480f9[_0x5809('0x1e')]?_[_0x5809('0x1d')](_0x1480f9[_0x5809('0x1e')],function(_0x436386){return{'model':db[_0x436386[_0x5809('0x1f')]],'as':_0x436386['as'],'attributes':_0x436386[_0x5809('0x1c')],'include':_0x436386[_0x5809('0x1e')]?_['map'](_0x436386[_0x5809('0x1e')],function(_0xdf812d){return{'model':db[_0xdf812d[_0x5809('0x1f')]],'as':_0xdf812d['as'],'attributes':_0xdf812d[_0x5809('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5809('0xe')](function(_0x308d06){logger[_0x5809('0xf')]('ShowSound',_0x24ec23);logger['debug'](_0x5809('0x20'),_0x24ec23,JSON[_0x5809('0x13')](_0x308d06));_0x2c8a16(_0x308d06);})[_0x5809('0x18')](function(_0x30096b){logger['error']('ShowSound',_0x30096b[_0x5809('0x16')],_0x24ec23);_0x19aeae(_0x4e2f5b['error'](0x1f4,_0x30096b['message']));});});}; \ No newline at end of file +var _0x403f=['jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment'];(function(_0x430dc8,_0x98cd37){var _0x388a26=function(_0x248d08){while(--_0x248d08){_0x430dc8['push'](_0x430dc8['shift']());}};_0x388a26(++_0x98cd37);}(_0x403f,0xc4));var _0xf403=function(_0x1df584,_0x505751){_0x1df584=_0x1df584-0x0;var _0x15f1d7=_0x403f[_0x1df584];return _0x15f1d7;};'use strict';var _=require(_0xf403('0x0'));var util=require(_0xf403('0x1'));var moment=require(_0xf403('0x2'));var BPromise=require(_0xf403('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf403('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf403('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf403('0x6'));var jayson=require(_0xf403('0x7'));var client=jayson[_0xf403('0x8')][_0xf403('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x443255,_0x2fa8e1,_0x3ca294){return new BPromise(function(_0x1684bf,_0x2e6be5){return client['request'](_0x443255,_0x3ca294)[_0xf403('0xa')](function(_0x2b9e36){logger[_0xf403('0xb')]('Sound,\x20%s,\x20%s',_0x2fa8e1,_0xf403('0xc'));logger[_0xf403('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x2fa8e1,_0xf403('0xc'),JSON[_0xf403('0xe')](_0x2b9e36));if(_0x2b9e36[_0xf403('0xf')]){if(_0x2b9e36[_0xf403('0xf')]['code']===0x1f4){logger['error'](_0xf403('0x10'),_0x2fa8e1,_0x2b9e36[_0xf403('0xf')][_0xf403('0x11')]);return _0x2e6be5(_0x2b9e36[_0xf403('0xf')][_0xf403('0x11')]);}logger['error'](_0xf403('0x10'),_0x2fa8e1,_0x2b9e36[_0xf403('0xf')]['message']);return _0x1684bf(_0x2b9e36[_0xf403('0xf')]['message']);}else{logger['info'](_0xf403('0x10'),_0x2fa8e1,'request\x20sent');_0x1684bf(_0x2b9e36[_0xf403('0x12')]['message']);}})[_0xf403('0x13')](function(_0x5eb09b){logger['error'](_0xf403('0x10'),_0x2fa8e1,_0x5eb09b);_0x2e6be5(_0x5eb09b);});});}exports[_0xf403('0x14')]=function(_0x427a90){var _0x2175c7=this;return new Promise(function(_0x46d20b,_0x1f4849){return db[_0xf403('0x15')]['find']({'raw':_0x427a90[_0xf403('0x16')]?_0x427a90[_0xf403('0x16')][_0xf403('0x17')]===undefined?!![]:![]:!![],'where':_0x427a90[_0xf403('0x16')]?_0x427a90[_0xf403('0x16')][_0xf403('0x18')]||null:null,'attributes':_0x427a90[_0xf403('0x16')]?_0x427a90[_0xf403('0x16')]['attributes']||null:null,'include':_0x427a90[_0xf403('0x16')]?_0x427a90['options'][_0xf403('0x19')]?_[_0xf403('0x1a')](_0x427a90['options'][_0xf403('0x19')],function(_0x11249f){return{'model':db[_0x11249f[_0xf403('0x1b')]],'as':_0x11249f['as'],'attributes':_0x11249f[_0xf403('0x1c')],'include':_0x11249f[_0xf403('0x19')]?_[_0xf403('0x1a')](_0x11249f['include'],function(_0x5d8e33){return{'model':db[_0x5d8e33[_0xf403('0x1b')]],'as':_0x5d8e33['as'],'attributes':_0x5d8e33[_0xf403('0x1c')],'include':_0x5d8e33[_0xf403('0x19')]?_['map'](_0x5d8e33[_0xf403('0x19')],function(_0x4f038c){return{'model':db[_0x4f038c[_0xf403('0x1b')]],'as':_0x4f038c['as'],'attributes':_0x4f038c[_0xf403('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf403('0xa')](function(_0x5362dd){logger[_0xf403('0xb')](_0xf403('0x14'),_0x427a90);logger['debug'](_0xf403('0x14'),_0x427a90,JSON[_0xf403('0xe')](_0x5362dd));_0x46d20b(_0x5362dd);})[_0xf403('0x13')](function(_0x4bd8f2){logger[_0xf403('0xf')](_0xf403('0x14'),_0x4bd8f2[_0xf403('0x11')],_0x427a90);_0x1f4849(_0x2175c7['error'](0x1f4,_0x4bd8f2[_0xf403('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 5dc723f..8529232 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 _0xfa45=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xfa45,0x11b));var _0x5fa4=function(_0x309c84,_0x131f30){_0x309c84=_0x309c84-0x0;var _0x307429=_0xfa45[_0x309c84];return _0x307429;};'use strict';var multer=require(_0x5fa4('0x0'));var util=require(_0x5fa4('0x1'));var path=require(_0x5fa4('0x2'));var timeout=require(_0x5fa4('0x3'));var express=require(_0x5fa4('0x4'));var router=express[_0x5fa4('0x5')]();var auth=require(_0x5fa4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5fa4('0x7'));var controller=require('./squareMessage.controller');router[_0x5fa4('0x8')]('/',auth[_0x5fa4('0x9')](),controller[_0x5fa4('0xa')]);router[_0x5fa4('0x8')](_0x5fa4('0xb'),auth[_0x5fa4('0x9')](),controller[_0x5fa4('0xc')]);router[_0x5fa4('0xd')]('/',auth[_0x5fa4('0x9')](),controller[_0x5fa4('0xe')]);router['put'](_0x5fa4('0xb'),auth['isAuthenticated'](),controller[_0x5fa4('0xf')]);router[_0x5fa4('0x10')](_0x5fa4('0xb'),auth[_0x5fa4('0x9')](),controller[_0x5fa4('0x11')]);module[_0x5fa4('0x12')]=router; \ No newline at end of file +var _0x31b3=['put','update','delete','destroy','exports','multer','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31b3,0x1d3));var _0x331b=function(_0x6d6f7,_0x4ba1a9){_0x6d6f7=_0x6d6f7-0x0;var _0x2a6afe=_0x31b3[_0x6d6f7];return _0x2a6afe;};'use strict';var multer=require(_0x331b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x331b('0x1'));var router=express[_0x331b('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x331b('0x3'));var controller=require('./squareMessage.controller');router[_0x331b('0x4')]('/',auth[_0x331b('0x5')](),controller[_0x331b('0x6')]);router['get'](_0x331b('0x7'),auth[_0x331b('0x5')](),controller[_0x331b('0x8')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x331b('0x9')](_0x331b('0x7'),auth[_0x331b('0x5')](),controller[_0x331b('0xa')]);router[_0x331b('0xb')](_0x331b('0x7'),auth[_0x331b('0x5')](),controller[_0x331b('0xc')]);module[_0x331b('0xd')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e02776c..d5c0ff4 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 _0x0fda=['ENUM','out','sequelize','STRING','TEXT','medium'];(function(_0x31b0da,_0x5ba110){var _0x378994=function(_0x37a976){while(--_0x37a976){_0x31b0da['push'](_0x31b0da['shift']());}};_0x378994(++_0x5ba110);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x16aa04,_0x51f452){_0x16aa04=_0x16aa04-0x0;var _0x6e942d=_0x0fda[_0x16aa04];return _0x6e942d;};'use strict';var Sequelize=require(_0xa0fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa0fd('0x1')]},'body':{'type':Sequelize[_0xa0fd('0x2')](_0xa0fd('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xa0fd('0x4')]('in',_0xa0fd('0x5')),'defaultValue':_0xa0fd('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xa0fd('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe015=['ENUM','out','TEXT','sequelize','exports','STRING'];(function(_0x40fcda,_0x2e8598){var _0x38e739=function(_0x16d71a){while(--_0x16d71a){_0x40fcda['push'](_0x40fcda['shift']());}};_0x38e739(++_0x2e8598);}(_0xe015,0x13b));var _0x5e01=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe015[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x5e01('0x0'));module[_0x5e01('0x1')]={'uniqueid':{'type':Sequelize[_0x5e01('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x5e01('0x3')]('in','out'),'defaultValue':_0x5e01('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x5e01('0x2')]},'providerResponse':{'type':Sequelize[_0x5e01('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 2e3ae97..1b41c5d 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 _0x4371=['order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','end','stack','name','index','SquareMessage','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x32f845,_0x335cb9){var _0x3c0de4=function(_0x44c308){while(--_0x44c308){_0x32f845['push'](_0x32f845['shift']());}};_0x3c0de4(++_0x335cb9);}(_0x4371,0x9f));var _0x1437=function(_0x12d0bb,_0x56430a){_0x12d0bb=_0x12d0bb-0x0;var _0x44e5af=_0x4371[_0x12d0bb];return _0x44e5af;};'use strict';var pdf=require(_0x1437('0x0'));var emlformat=require(_0x1437('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1437('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1437('0x3'));var moment=require('moment');var BPromise=require(_0x1437('0x4'));var Mustache=require(_0x1437('0x5'));var util=require(_0x1437('0x6'));var path=require('path');var sox=require(_0x1437('0x7'));var csv=require(_0x1437('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1437('0x9'));var squel=require('squel');var crypto=require(_0x1437('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1437('0xb'));var toCsv=require(_0x1437('0x8'));var querystring=require(_0x1437('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1437('0xd'));var qs=require(_0x1437('0xe'));var as=require(_0x1437('0xf'));var hardwareService=require(_0x1437('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x1437('0x11'));var config=require(_0x1437('0x12'));var licenseUtil=require(_0x1437('0x13'));var db=require(_0x1437('0x14'))['db'];function respondWithStatusCode(_0x2185a4,_0x17721d){_0x17721d=_0x17721d||0xcc;return function(_0x13f540){if(_0x13f540){return _0x2185a4[_0x1437('0x15')](_0x17721d);}return _0x2185a4[_0x1437('0x16')](_0x17721d)['end']();};}function respondWithResult(_0x58fdba,_0x16f9f1){_0x16f9f1=_0x16f9f1||0xc8;return function(_0x31f93a){if(_0x31f93a){return _0x58fdba[_0x1437('0x16')](_0x16f9f1)['json'](_0x31f93a);}};}function respondWithFilteredResult(_0x436dfb,_0x5ed3fb){return function(_0x28fb0b){if(_0x28fb0b){var _0x42e0db=_0x28fb0b[_0x1437('0x17')],_0x19f1cb=_0x5ed3fb[_0x1437('0x18')],_0x8d6077=_0x5ed3fb[_0x1437('0x18')]+_0x5ed3fb[_0x1437('0x19')],_0x325825;if(_0x8d6077>=_0x42e0db){_0x8d6077=_0x42e0db;_0x325825=0xc8;}else{_0x325825=0xce;}_0x436dfb[_0x1437('0x16')](_0x325825);return _0x436dfb[_0x1437('0x1a')](_0x1437('0x1b'),_0x19f1cb+'-'+_0x8d6077+'/'+_0x42e0db)[_0x1437('0x1c')](_0x28fb0b);}return null;};}function patchUpdates(_0x3f892c){return function(_0x27f360){try{jsonpatch[_0x1437('0x1d')](_0x27f360,_0x3f892c,!![]);}catch(_0x20399f){return BPromise['reject'](_0x20399f);}return _0x27f360[_0x1437('0x1e')]();};}function saveUpdates(_0x3055b6,_0x48c308){return function(_0x222b50){if(_0x222b50){return _0x222b50[_0x1437('0x1f')](_0x3055b6)[_0x1437('0x20')](function(_0x1b985e){return _0x1b985e;});}return null;};}function removeEntity(_0x2b81ce,_0x19c6ea){return function(_0x3284e9){if(_0x3284e9){return _0x3284e9[_0x1437('0x21')]()[_0x1437('0x20')](function(){_0x2b81ce[_0x1437('0x16')](0xcc)[_0x1437('0x22')]();});}};}function handleEntityNotFound(_0x280e1b,_0x32daae){return function(_0x5fc6a6){if(!_0x5fc6a6){_0x280e1b[_0x1437('0x15')](0x194);}return _0x5fc6a6;};}function handleError(_0x8d643a,_0x230d93){_0x230d93=_0x230d93||0x1f4;return function(_0x80be1e){logger['error'](_0x80be1e[_0x1437('0x23')]);if(_0x80be1e['name']){delete _0x80be1e[_0x1437('0x24')];}_0x8d643a[_0x1437('0x16')](_0x230d93)['send'](_0x80be1e);};}exports[_0x1437('0x25')]=function(_0x31a56f,_0x53fe91){var _0x1621bb={},_0x58b7f9={},_0x39ee54={'count':0x0,'rows':[]};var _0x4f2737=_['map'](db[_0x1437('0x26')][_0x1437('0x27')],function(_0x2f0be2){return{'name':_0x2f0be2[_0x1437('0x28')],'type':_0x2f0be2['type'][_0x1437('0x29')]};});_0x58b7f9[_0x1437('0x2a')]=_[_0x1437('0x2b')](_0x4f2737,_0x1437('0x24'));_0x58b7f9[_0x1437('0x2c')]=_[_0x1437('0x2d')](_0x31a56f['query']);_0x58b7f9['filters']=_[_0x1437('0x2e')](_0x58b7f9[_0x1437('0x2a')],_0x58b7f9[_0x1437('0x2c')]);_0x1621bb['attributes']=_[_0x1437('0x2e')](_0x58b7f9[_0x1437('0x2a')],qs[_0x1437('0x2f')](_0x31a56f[_0x1437('0x2c')][_0x1437('0x2f')]));_0x1621bb[_0x1437('0x30')]=_0x1621bb[_0x1437('0x30')]['length']?_0x1621bb[_0x1437('0x30')]:_0x58b7f9['model'];if(!_0x31a56f['query'][_0x1437('0x31')](_0x1437('0x32'))){_0x1621bb[_0x1437('0x19')]=qs[_0x1437('0x19')](_0x31a56f[_0x1437('0x2c')][_0x1437('0x19')]);_0x1621bb[_0x1437('0x18')]=qs['offset'](_0x31a56f[_0x1437('0x2c')][_0x1437('0x18')]);}_0x1621bb[_0x1437('0x33')]=qs[_0x1437('0x34')](_0x31a56f[_0x1437('0x2c')]['sort']);_0x1621bb[_0x1437('0x35')]=qs[_0x1437('0x36')](_[_0x1437('0x37')](_0x31a56f['query'],_0x58b7f9[_0x1437('0x36')]),_0x4f2737);if(_0x31a56f[_0x1437('0x2c')][_0x1437('0x38')]){_0x1621bb[_0x1437('0x35')]=_['merge'](_0x1621bb[_0x1437('0x35')],{'$or':_['map'](_0x4f2737,function(_0x48c175){if(_0x48c175['type']!==_0x1437('0x39')){var _0x17c8e2={};_0x17c8e2[_0x48c175[_0x1437('0x24')]]={'$like':'%'+_0x31a56f['query'][_0x1437('0x38')]+'%'};return _0x17c8e2;}})});}_0x1621bb=_[_0x1437('0x3a')]({},_0x1621bb,_0x31a56f[_0x1437('0x3b')]);var _0x1c88fc={'where':_0x1621bb[_0x1437('0x35')]};return db[_0x1437('0x26')][_0x1437('0x17')](_0x1c88fc)[_0x1437('0x20')](function(_0x28ef96){_0x39ee54[_0x1437('0x17')]=_0x28ef96;if(_0x31a56f[_0x1437('0x2c')]['includeAll']){_0x1621bb[_0x1437('0x3c')]=[{'all':!![]}];}return db[_0x1437('0x26')][_0x1437('0x3d')](_0x1621bb);})[_0x1437('0x20')](function(_0x36ee0a){_0x39ee54[_0x1437('0x3e')]=_0x36ee0a;return _0x39ee54;})[_0x1437('0x20')](respondWithFilteredResult(_0x53fe91,_0x1621bb))[_0x1437('0x3f')](handleError(_0x53fe91,null));};exports[_0x1437('0x40')]=function(_0x2bfb67,_0x59ca8f){var _0x364d25={'raw':!![],'where':{'id':_0x2bfb67[_0x1437('0x41')]['id']}},_0x2ad4b9={};_0x2ad4b9[_0x1437('0x2a')]=_[_0x1437('0x2d')](db['SquareMessage'][_0x1437('0x27')]);_0x2ad4b9[_0x1437('0x2c')]=_[_0x1437('0x2d')](_0x2bfb67['query']);_0x2ad4b9['filters']=_[_0x1437('0x2e')](_0x2ad4b9[_0x1437('0x2a')],_0x2ad4b9[_0x1437('0x2c')]);_0x364d25[_0x1437('0x30')]=_[_0x1437('0x2e')](_0x2ad4b9['model'],qs[_0x1437('0x2f')](_0x2bfb67['query']['fields']));_0x364d25[_0x1437('0x30')]=_0x364d25['attributes']['length']?_0x364d25[_0x1437('0x30')]:_0x2ad4b9['model'];if(_0x2bfb67['query'][_0x1437('0x42')]){_0x364d25[_0x1437('0x3c')]=[{'all':!![]}];}_0x364d25=_[_0x1437('0x3a')]({},_0x364d25,_0x2bfb67[_0x1437('0x3b')]);return db['SquareMessage'][_0x1437('0x43')](_0x364d25)[_0x1437('0x20')](handleEntityNotFound(_0x59ca8f,null))[_0x1437('0x20')](respondWithResult(_0x59ca8f,null))['catch'](handleError(_0x59ca8f,null));};exports[_0x1437('0x44')]=function(_0x2a5ace,_0x115f33){return db['SquareMessage'][_0x1437('0x44')](_0x2a5ace[_0x1437('0x45')],{})[_0x1437('0x20')](respondWithResult(_0x115f33,0xc9))[_0x1437('0x3f')](handleError(_0x115f33,null));};exports['update']=function(_0x5d3a42,_0x3a8d2d){if(_0x5d3a42['body']['id']){delete _0x5d3a42[_0x1437('0x45')]['id'];}return db['SquareMessage'][_0x1437('0x43')]({'where':{'id':_0x5d3a42['params']['id']}})[_0x1437('0x20')](handleEntityNotFound(_0x3a8d2d,null))[_0x1437('0x20')](saveUpdates(_0x5d3a42['body'],null))[_0x1437('0x20')](respondWithResult(_0x3a8d2d,null))['catch'](handleError(_0x3a8d2d,null));};exports[_0x1437('0x21')]=function(_0x4861f0,_0x589d05){return db[_0x1437('0x26')][_0x1437('0x43')]({'where':{'id':_0x4861f0[_0x1437('0x41')]['id']}})[_0x1437('0x20')](handleEntityNotFound(_0x589d05,null))[_0x1437('0x20')](removeEntity(_0x589d05,null))[_0x1437('0x3f')](handleError(_0x589d05,null));}; \ No newline at end of file +var _0x4617=['set','Content-Range','apply','save','then','destroy','end','sendStatus','error','stack','name','index','map','SquareMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count','limit'];(function(_0x2370bc,_0x5d3b47){var _0x20e1a2=function(_0x287af9){while(--_0x287af9){_0x2370bc['push'](_0x2370bc['shift']());}};_0x20e1a2(++_0x5d3b47);}(_0x4617,0x1ea));var _0x7461=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x4617[_0x40a825];return _0x273a54;};'use strict';var pdf=require(_0x7461('0x0'));var emlformat=require(_0x7461('0x1'));var rimraf=require(_0x7461('0x2'));var zipdir=require(_0x7461('0x3'));var jsonpatch=require(_0x7461('0x4'));var rp=require(_0x7461('0x5'));var moment=require(_0x7461('0x6'));var BPromise=require(_0x7461('0x7'));var Mustache=require(_0x7461('0x8'));var util=require('util');var path=require(_0x7461('0x9'));var sox=require('sox');var csv=require(_0x7461('0xa'));var ejs=require(_0x7461('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7461('0xc'));var crypto=require('crypto');var jsforce=require(_0x7461('0xd'));var deskjs=require(_0x7461('0xe'));var toCsv=require(_0x7461('0xa'));var querystring=require('querystring');var Papa=require(_0x7461('0xf'));var Redis=require(_0x7461('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7461('0x11'));var as=require(_0x7461('0x12'));var hardwareService=require(_0x7461('0x13'));var logger=require(_0x7461('0x14'))('api');var utils=require(_0x7461('0x15'));var config=require(_0x7461('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7461('0x17'))['db'];function respondWithStatusCode(_0x131892,_0x363052){_0x363052=_0x363052||0xcc;return function(_0x8a3a07){if(_0x8a3a07){return _0x131892['sendStatus'](_0x363052);}return _0x131892['status'](_0x363052)['end']();};}function respondWithResult(_0x229274,_0x174ded){_0x174ded=_0x174ded||0xc8;return function(_0x44d047){if(_0x44d047){return _0x229274[_0x7461('0x18')](_0x174ded)[_0x7461('0x19')](_0x44d047);}};}function respondWithFilteredResult(_0x411254,_0x34ed72){return function(_0x36e119){if(_0x36e119){var _0x53b423=_0x36e119[_0x7461('0x1a')],_0x2b539d=_0x34ed72['offset'],_0x4654e0=_0x34ed72['offset']+_0x34ed72[_0x7461('0x1b')],_0x44e095;if(_0x4654e0>=_0x53b423){_0x4654e0=_0x53b423;_0x44e095=0xc8;}else{_0x44e095=0xce;}_0x411254[_0x7461('0x18')](_0x44e095);return _0x411254[_0x7461('0x1c')](_0x7461('0x1d'),_0x2b539d+'-'+_0x4654e0+'/'+_0x53b423)['json'](_0x36e119);}return null;};}function patchUpdates(_0x31d7b4){return function(_0x470589){try{jsonpatch[_0x7461('0x1e')](_0x470589,_0x31d7b4,!![]);}catch(_0x3944a4){return BPromise['reject'](_0x3944a4);}return _0x470589[_0x7461('0x1f')]();};}function saveUpdates(_0x45f75a,_0x355b46){return function(_0x537df7){if(_0x537df7){return _0x537df7['update'](_0x45f75a)[_0x7461('0x20')](function(_0x45f15d){return _0x45f15d;});}return null;};}function removeEntity(_0x271494,_0x8d086b){return function(_0x5a33a9){if(_0x5a33a9){return _0x5a33a9[_0x7461('0x21')]()[_0x7461('0x20')](function(){_0x271494[_0x7461('0x18')](0xcc)[_0x7461('0x22')]();});}};}function handleEntityNotFound(_0x4e722d,_0x49c426){return function(_0x41cbbd){if(!_0x41cbbd){_0x4e722d[_0x7461('0x23')](0x194);}return _0x41cbbd;};}function handleError(_0x5b7278,_0x57b5a8){_0x57b5a8=_0x57b5a8||0x1f4;return function(_0x18d02d){logger[_0x7461('0x24')](_0x18d02d[_0x7461('0x25')]);if(_0x18d02d[_0x7461('0x26')]){delete _0x18d02d[_0x7461('0x26')];}_0x5b7278[_0x7461('0x18')](_0x57b5a8)['send'](_0x18d02d);};}exports[_0x7461('0x27')]=function(_0x4e23b8,_0x3df6e2){var _0x197ddc={},_0x21e8fb={},_0xae3214={'count':0x0,'rows':[]};var _0x2872c0=_[_0x7461('0x28')](db[_0x7461('0x29')][_0x7461('0x2a')],function(_0x404e4b){return{'name':_0x404e4b['fieldName'],'type':_0x404e4b[_0x7461('0x2b')]['key']};});_0x21e8fb[_0x7461('0x2c')]=_[_0x7461('0x28')](_0x2872c0,_0x7461('0x26'));_0x21e8fb[_0x7461('0x2d')]=_[_0x7461('0x2e')](_0x4e23b8['query']);_0x21e8fb[_0x7461('0x2f')]=_[_0x7461('0x30')](_0x21e8fb[_0x7461('0x2c')],_0x21e8fb[_0x7461('0x2d')]);_0x197ddc[_0x7461('0x31')]=_[_0x7461('0x30')](_0x21e8fb[_0x7461('0x2c')],qs[_0x7461('0x32')](_0x4e23b8['query'][_0x7461('0x32')]));_0x197ddc[_0x7461('0x31')]=_0x197ddc[_0x7461('0x31')][_0x7461('0x33')]?_0x197ddc['attributes']:_0x21e8fb[_0x7461('0x2c')];if(!_0x4e23b8[_0x7461('0x2d')][_0x7461('0x34')](_0x7461('0x35'))){_0x197ddc[_0x7461('0x1b')]=qs[_0x7461('0x1b')](_0x4e23b8['query'][_0x7461('0x1b')]);_0x197ddc[_0x7461('0x36')]=qs[_0x7461('0x36')](_0x4e23b8[_0x7461('0x2d')][_0x7461('0x36')]);}_0x197ddc[_0x7461('0x37')]=qs[_0x7461('0x38')](_0x4e23b8['query']['sort']);_0x197ddc[_0x7461('0x39')]=qs[_0x7461('0x2f')](_[_0x7461('0x3a')](_0x4e23b8[_0x7461('0x2d')],_0x21e8fb[_0x7461('0x2f')]),_0x2872c0);if(_0x4e23b8[_0x7461('0x2d')][_0x7461('0x3b')]){_0x197ddc[_0x7461('0x39')]=_[_0x7461('0x3c')](_0x197ddc[_0x7461('0x39')],{'$or':_[_0x7461('0x28')](_0x2872c0,function(_0x521897){if(_0x521897[_0x7461('0x2b')]!==_0x7461('0x3d')){var _0x7f6836={};_0x7f6836[_0x521897[_0x7461('0x26')]]={'$like':'%'+_0x4e23b8[_0x7461('0x2d')][_0x7461('0x3b')]+'%'};return _0x7f6836;}})});}_0x197ddc=_[_0x7461('0x3c')]({},_0x197ddc,_0x4e23b8[_0x7461('0x3e')]);var _0x1ec8d9={'where':_0x197ddc['where']};return db[_0x7461('0x29')][_0x7461('0x1a')](_0x1ec8d9)[_0x7461('0x20')](function(_0x5d67e6){_0xae3214[_0x7461('0x1a')]=_0x5d67e6;if(_0x4e23b8[_0x7461('0x2d')][_0x7461('0x3f')]){_0x197ddc['include']=[{'all':!![]}];}return db[_0x7461('0x29')][_0x7461('0x40')](_0x197ddc);})[_0x7461('0x20')](function(_0x46ab9b){_0xae3214[_0x7461('0x41')]=_0x46ab9b;return _0xae3214;})[_0x7461('0x20')](respondWithFilteredResult(_0x3df6e2,_0x197ddc))[_0x7461('0x42')](handleError(_0x3df6e2,null));};exports[_0x7461('0x43')]=function(_0x2224b7,_0x32c0d5){var _0xcaff3c={'raw':!![],'where':{'id':_0x2224b7[_0x7461('0x44')]['id']}},_0x4ad51b={};_0x4ad51b[_0x7461('0x2c')]=_[_0x7461('0x2e')](db[_0x7461('0x29')]['rawAttributes']);_0x4ad51b[_0x7461('0x2d')]=_[_0x7461('0x2e')](_0x2224b7[_0x7461('0x2d')]);_0x4ad51b['filters']=_['intersection'](_0x4ad51b[_0x7461('0x2c')],_0x4ad51b['query']);_0xcaff3c[_0x7461('0x31')]=_[_0x7461('0x30')](_0x4ad51b[_0x7461('0x2c')],qs[_0x7461('0x32')](_0x2224b7[_0x7461('0x2d')][_0x7461('0x32')]));_0xcaff3c[_0x7461('0x31')]=_0xcaff3c[_0x7461('0x31')]['length']?_0xcaff3c[_0x7461('0x31')]:_0x4ad51b[_0x7461('0x2c')];if(_0x2224b7[_0x7461('0x2d')]['includeAll']){_0xcaff3c[_0x7461('0x45')]=[{'all':!![]}];}_0xcaff3c=_['merge']({},_0xcaff3c,_0x2224b7[_0x7461('0x3e')]);return db[_0x7461('0x29')][_0x7461('0x46')](_0xcaff3c)[_0x7461('0x20')](handleEntityNotFound(_0x32c0d5,null))[_0x7461('0x20')](respondWithResult(_0x32c0d5,null))[_0x7461('0x42')](handleError(_0x32c0d5,null));};exports[_0x7461('0x47')]=function(_0x30dfa1,_0x47295d){return db[_0x7461('0x29')]['create'](_0x30dfa1[_0x7461('0x48')],{})[_0x7461('0x20')](respondWithResult(_0x47295d,0xc9))[_0x7461('0x42')](handleError(_0x47295d,null));};exports[_0x7461('0x49')]=function(_0x42529b,_0x1fb947){if(_0x42529b['body']['id']){delete _0x42529b[_0x7461('0x48')]['id'];}return db['SquareMessage'][_0x7461('0x46')]({'where':{'id':_0x42529b[_0x7461('0x44')]['id']}})[_0x7461('0x20')](handleEntityNotFound(_0x1fb947,null))[_0x7461('0x20')](saveUpdates(_0x42529b['body'],null))[_0x7461('0x20')](respondWithResult(_0x1fb947,null))[_0x7461('0x42')](handleError(_0x1fb947,null));};exports['destroy']=function(_0x462785,_0x4f2a5f){return db[_0x7461('0x29')][_0x7461('0x46')]({'where':{'id':_0x462785[_0x7461('0x44')]['id']}})[_0x7461('0x20')](handleEntityNotFound(_0x4f2a5f,null))[_0x7461('0x20')](removeEntity(_0x4f2a5f,null))['catch'](handleError(_0x4f2a5f,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 475d698..3ba9c82 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 _0x9ec6=['define','square_messages','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9ec6,0x178));var _0x69ec=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x9ec6[_0x5b3950];return _0x41e436;};'use strict';var _=require(_0x69ec('0x0'));var util=require('util');var logger=require(_0x69ec('0x1'))(_0x69ec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x69ec('0x3'));var fs=require('fs');var path=require(_0x69ec('0x4'));var rimraf=require(_0x69ec('0x5'));var config=require(_0x69ec('0x6'));var attributes=require(_0x69ec('0x7'));module[_0x69ec('0x8')]=function(_0x3584f4,_0x4a9635){return _0x3584f4[_0x69ec('0x9')]('SquareMessage',attributes,{'tableName':_0x69ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4714=['SquareMessage','square_messages','util','api','path','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x55d3c2,_0x3991e7){var _0x355980=function(_0x2a5143){while(--_0x2a5143){_0x55d3c2['push'](_0x55d3c2['shift']());}};_0x355980(++_0x3991e7);}(_0x4714,0x1c2));var _0x4471=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4714[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x4471('0x0'));var logger=require('../../config/logger')(_0x4471('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4471('0x2'));var rimraf=require(_0x4471('0x3'));var config=require(_0x4471('0x4'));var attributes=require(_0x4471('0x5'));module['exports']=function(_0x37e1a7,_0x313dc7){return _0x37e1a7['define'](_0x4471('0x6'),attributes,{'tableName':_0x4471('0x7'),'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 f00f05d..99943c5 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(_0x5b40da,_0x84ad5c){var _0x4b685f=function(_0x5a1606){while(--_0x5a1606){_0x5b40da['push'](_0x5b40da['shift']());}};_0x4b685f(++_0x84ad5c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x2f9f0d,_0x33d2c1){var _0x238904=function(_0x3a995d){while(--_0x3a995d){_0x2f9f0d['push'](_0x2f9f0d['shift']());}};_0x238904(++_0x33d2c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 8b8fc09..8b682bb 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 _0xfd13=['/:id','show','/:id/test','15s','test','post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x14b4b2,_0x42aed0){var _0x2710fd=function(_0x2bb074){while(--_0x2bb074){_0x14b4b2['push'](_0x14b4b2['shift']());}};_0x2710fd(++_0x42aed0);}(_0xfd13,0x13a));var _0x3fd1=function(_0x172732,_0x4af316){_0x172732=_0x172732-0x0;var _0x41522b=_0xfd13[_0x172732];return _0x41522b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3fd1('0x0'));var timeout=require(_0x3fd1('0x1'));var express=require(_0x3fd1('0x2'));var router=express[_0x3fd1('0x3')]();var auth=require(_0x3fd1('0x4'));var interaction=require(_0x3fd1('0x5'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x3fd1('0x6')]('/',auth[_0x3fd1('0x7')](),controller[_0x3fd1('0x8')]);router['get'](_0x3fd1('0x9'),auth['isAuthenticated'](),controller[_0x3fd1('0xa')]);router[_0x3fd1('0x6')](_0x3fd1('0xb'),auth[_0x3fd1('0x7')](),timeout(_0x3fd1('0xc')),controller[_0x3fd1('0xd')]);router[_0x3fd1('0xe')]('/',auth['isAuthenticated'](),controller[_0x3fd1('0xf')]);router['put'](_0x3fd1('0x9'),auth[_0x3fd1('0x7')](),controller[_0x3fd1('0x10')]);router[_0x3fd1('0x11')](_0x3fd1('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x3fd1('0x12')]=router; \ No newline at end of file +var _0x1dd4=['create','put','update','delete','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','/:id/test','15s','test','post'];(function(_0x12f4af,_0x4a2bb9){var _0x4c4d50=function(_0x25a7f7){while(--_0x25a7f7){_0x12f4af['push'](_0x12f4af['shift']());}};_0x4c4d50(++_0x4a2bb9);}(_0x1dd4,0x1a9));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x41dd('0x0'));var express=require(_0x41dd('0x1'));var router=express[_0x41dd('0x2')]();var auth=require(_0x41dd('0x3'));var interaction=require(_0x41dd('0x4'));var config=require(_0x41dd('0x5'));var controller=require(_0x41dd('0x6'));router['get']('/',auth[_0x41dd('0x7')](),controller[_0x41dd('0x8')]);router[_0x41dd('0x9')](_0x41dd('0xa'),auth[_0x41dd('0x7')](),controller[_0x41dd('0xb')]);router['get'](_0x41dd('0xc'),auth[_0x41dd('0x7')](),timeout(_0x41dd('0xd')),controller[_0x41dd('0xe')]);router[_0x41dd('0xf')]('/',auth[_0x41dd('0x7')](),controller[_0x41dd('0x10')]);router[_0x41dd('0x11')](_0x41dd('0xa'),auth[_0x41dd('0x7')](),controller[_0x41dd('0x12')]);router[_0x41dd('0x13')]('/:id',auth[_0x41dd('0x7')](),controller['destroy']);module[_0x41dd('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 8a28753..628a67f 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 _0x33f4=['exports','STRING'];(function(_0x4709c3,_0x3598bb){var _0x574944=function(_0x153e47){while(--_0x153e47){_0x4709c3['push'](_0x4709c3['shift']());}};_0x574944(++_0x3598bb);}(_0x33f4,0x170));var _0x433f=function(_0x67b3ed,_0xcb385e){_0x67b3ed=_0x67b3ed-0x0;var _0x14d0f6=_0x33f4[_0x67b3ed];return _0x14d0f6;};'use strict';var Sequelize=require('sequelize');module[_0x433f('0x0')]={'name':{'type':Sequelize[_0x433f('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x433f('0x1')]},'description':{'type':Sequelize[_0x433f('0x1')]}}; \ No newline at end of file +var _0x82ed=['exports','STRING','name','sequelize'];(function(_0xe5afb7,_0x37246d){var _0x24101c=function(_0x33f163){while(--_0x33f163){_0xe5afb7['push'](_0xe5afb7['shift']());}};_0x24101c(++_0x37246d);}(_0x82ed,0xc3));var _0xd82e=function(_0x3db140,_0x88e7d0){_0x3db140=_0x3db140-0x0;var _0x5c88cf=_0x82ed[_0x3db140];return _0x5c88cf;};'use strict';var Sequelize=require(_0xd82e('0x0'));module[_0xd82e('0x1')]={'name':{'type':Sequelize[_0xd82e('0x2')],'unique':_0xd82e('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd82e('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 624651e..6df7189 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 _0xd2f0=['end','json','count','offset','limit','status','Content-Range','reject','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','role','ODBC','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','openSync','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5da7aa,_0x5968b7){var _0x4fc6a1=function(_0x449edc){while(--_0x449edc){_0x5da7aa['push'](_0x5da7aa['shift']());}};_0x4fc6a1(++_0x5968b7);}(_0xd2f0,0x186));var _0x0d2f=function(_0x23803b,_0x310c3c){_0x23803b=_0x23803b-0x0;var _0x379d77=_0xd2f0[_0x23803b];return _0x379d77;};'use strict';var pdf=require(_0x0d2f('0x0'));var emlformat=require(_0x0d2f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d2f('0x2'));var moment=require(_0x0d2f('0x3'));var BPromise=require(_0x0d2f('0x4'));var Mustache=require(_0x0d2f('0x5'));var util=require(_0x0d2f('0x6'));var path=require('path');var sox=require(_0x0d2f('0x7'));var csv=require(_0x0d2f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0d2f('0x9'));var crypto=require(_0x0d2f('0xa'));var jsforce=require(_0x0d2f('0xb'));var deskjs=require(_0x0d2f('0xc'));var toCsv=require(_0x0d2f('0x8'));var querystring=require(_0x0d2f('0xd'));var Papa=require(_0x0d2f('0xe'));var Redis=require(_0x0d2f('0xf'));var authService=require(_0x0d2f('0x10'));var qs=require(_0x0d2f('0x11'));var as=require(_0x0d2f('0x12'));var hardwareService=require(_0x0d2f('0x13'));var logger=require('../../config/logger')(_0x0d2f('0x14'));var utils=require(_0x0d2f('0x15'));var config=require(_0x0d2f('0x16'));var licenseUtil=require(_0x0d2f('0x17'));var db=require(_0x0d2f('0x18'))['db'];function respondWithStatusCode(_0x4d0dac,_0x364479){_0x364479=_0x364479||0xcc;return function(_0x30cc73){if(_0x30cc73){return _0x4d0dac['sendStatus'](_0x364479);}return _0x4d0dac['status'](_0x364479)[_0x0d2f('0x19')]();};}function respondWithResult(_0x5837b6,_0x44430c){_0x44430c=_0x44430c||0xc8;return function(_0x49c182){if(_0x49c182){return _0x5837b6['status'](_0x44430c)[_0x0d2f('0x1a')](_0x49c182);}};}function respondWithFilteredResult(_0x458b43,_0x41c192){return function(_0x16572c){if(_0x16572c){var _0x5d1c7b=_0x16572c[_0x0d2f('0x1b')],_0x2602a0=_0x41c192['offset'],_0xd1f62d=_0x41c192[_0x0d2f('0x1c')]+_0x41c192[_0x0d2f('0x1d')],_0x798884;if(_0xd1f62d>=_0x5d1c7b){_0xd1f62d=_0x5d1c7b;_0x798884=0xc8;}else{_0x798884=0xce;}_0x458b43[_0x0d2f('0x1e')](_0x798884);return _0x458b43['set'](_0x0d2f('0x1f'),_0x2602a0+'-'+_0xd1f62d+'/'+_0x5d1c7b)['json'](_0x16572c);}return null;};}function patchUpdates(_0xa82ae2){return function(_0x564373){try{jsonpatch['apply'](_0x564373,_0xa82ae2,!![]);}catch(_0x239901){return BPromise[_0x0d2f('0x20')](_0x239901);}return _0x564373['save']();};}function saveUpdates(_0x46717a,_0x11dc7d){return function(_0x393e7e){if(_0x393e7e){return _0x393e7e['update'](_0x46717a)[_0x0d2f('0x21')](function(_0x14a07c){return _0x14a07c;});}return null;};}function removeEntity(_0x2f284c,_0x34fd10){return function(_0x3a937c){if(_0x3a937c){return _0x3a937c[_0x0d2f('0x22')]()[_0x0d2f('0x21')](function(){var _0x3e8a78=_0x3a937c[_0x0d2f('0x23')]({'plain':!![]});var _0x546e69='ODBC';return db[_0x0d2f('0x24')][_0x0d2f('0x22')]({'where':{'type':_0x546e69,'resourceId':_0x3e8a78['id']}})[_0x0d2f('0x21')](function(){return _0x3a937c;});})[_0x0d2f('0x21')](function(){_0x2f284c[_0x0d2f('0x1e')](0xcc)[_0x0d2f('0x19')]();});}};}function handleEntityNotFound(_0x5039c6,_0x2a78e4){return function(_0x7015a0){if(!_0x7015a0){_0x5039c6[_0x0d2f('0x25')](0x194);}return _0x7015a0;};}function handleError(_0x590f75,_0x60e988){_0x60e988=_0x60e988||0x1f4;return function(_0x1099e2){logger[_0x0d2f('0x26')](_0x1099e2[_0x0d2f('0x27')]);if(_0x1099e2[_0x0d2f('0x28')]){delete _0x1099e2[_0x0d2f('0x28')];}_0x590f75['status'](_0x60e988)[_0x0d2f('0x29')](_0x1099e2);};}exports[_0x0d2f('0x2a')]=function(_0x1cb0d2,_0xef7ff6){var _0x59b4e5={},_0x13a4a2={},_0x264b4a={'count':0x0,'rows':[]};var _0x1c3495=_['map'](db[_0x0d2f('0x2b')][_0x0d2f('0x2c')],function(_0x4c105c){return{'name':_0x4c105c[_0x0d2f('0x2d')],'type':_0x4c105c[_0x0d2f('0x2e')][_0x0d2f('0x2f')]};});_0x13a4a2[_0x0d2f('0x30')]=_[_0x0d2f('0x31')](_0x1c3495,_0x0d2f('0x28'));_0x13a4a2[_0x0d2f('0x32')]=_['keys'](_0x1cb0d2[_0x0d2f('0x32')]);_0x13a4a2[_0x0d2f('0x33')]=_[_0x0d2f('0x34')](_0x13a4a2['model'],_0x13a4a2['query']);_0x59b4e5[_0x0d2f('0x35')]=_[_0x0d2f('0x34')](_0x13a4a2[_0x0d2f('0x30')],qs[_0x0d2f('0x36')](_0x1cb0d2[_0x0d2f('0x32')][_0x0d2f('0x36')]));_0x59b4e5[_0x0d2f('0x35')]=_0x59b4e5[_0x0d2f('0x35')][_0x0d2f('0x37')]?_0x59b4e5[_0x0d2f('0x35')]:_0x13a4a2[_0x0d2f('0x30')];if(!_0x1cb0d2[_0x0d2f('0x32')][_0x0d2f('0x38')](_0x0d2f('0x39'))){_0x59b4e5[_0x0d2f('0x1d')]=qs['limit'](_0x1cb0d2[_0x0d2f('0x32')][_0x0d2f('0x1d')]);_0x59b4e5[_0x0d2f('0x1c')]=qs[_0x0d2f('0x1c')](_0x1cb0d2['query']['offset']);}_0x59b4e5['order']=qs[_0x0d2f('0x3a')](_0x1cb0d2[_0x0d2f('0x32')][_0x0d2f('0x3a')]);_0x59b4e5[_0x0d2f('0x3b')]=qs[_0x0d2f('0x33')](_['pick'](_0x1cb0d2[_0x0d2f('0x32')],_0x13a4a2[_0x0d2f('0x33')]),_0x1c3495);if(_0x1cb0d2[_0x0d2f('0x32')][_0x0d2f('0x3c')]){_0x59b4e5[_0x0d2f('0x3b')]=_['merge'](_0x59b4e5[_0x0d2f('0x3b')],{'$or':_[_0x0d2f('0x31')](_0x1c3495,function(_0x35cec3){if(_0x35cec3[_0x0d2f('0x2e')]!==_0x0d2f('0x3d')){var _0x360ac7={};_0x360ac7[_0x35cec3[_0x0d2f('0x28')]]={'$like':'%'+_0x1cb0d2[_0x0d2f('0x32')][_0x0d2f('0x3c')]+'%'};return _0x360ac7;}})});}_0x59b4e5=_['merge']({},_0x59b4e5,_0x1cb0d2['options']);var _0x34000d={'where':_0x59b4e5[_0x0d2f('0x3b')]};return db[_0x0d2f('0x2b')][_0x0d2f('0x1b')](_0x34000d)['then'](function(_0x51c4f8){_0x264b4a['count']=_0x51c4f8;if(_0x1cb0d2[_0x0d2f('0x32')][_0x0d2f('0x3e')]){_0x59b4e5[_0x0d2f('0x3f')]=[{'all':!![]}];}return db[_0x0d2f('0x2b')][_0x0d2f('0x40')](_0x59b4e5);})[_0x0d2f('0x21')](function(_0x2c5aac){_0x264b4a[_0x0d2f('0x41')]=_0x2c5aac;return _0x264b4a;})[_0x0d2f('0x21')](respondWithFilteredResult(_0xef7ff6,_0x59b4e5))[_0x0d2f('0x42')](handleError(_0xef7ff6,null));};exports[_0x0d2f('0x43')]=function(_0x1857c3,_0x404a11){var _0x3a18c5={'raw':!![],'where':{'id':_0x1857c3[_0x0d2f('0x44')]['id']}},_0x3ef08f={};_0x3ef08f[_0x0d2f('0x30')]=_[_0x0d2f('0x45')](db[_0x0d2f('0x2b')][_0x0d2f('0x2c')]);_0x3ef08f[_0x0d2f('0x32')]=_[_0x0d2f('0x45')](_0x1857c3['query']);_0x3ef08f['filters']=_[_0x0d2f('0x34')](_0x3ef08f[_0x0d2f('0x30')],_0x3ef08f['query']);_0x3a18c5['attributes']=_[_0x0d2f('0x34')](_0x3ef08f['model'],qs[_0x0d2f('0x36')](_0x1857c3['query']['fields']));_0x3a18c5[_0x0d2f('0x35')]=_0x3a18c5[_0x0d2f('0x35')][_0x0d2f('0x37')]?_0x3a18c5[_0x0d2f('0x35')]:_0x3ef08f['model'];if(_0x1857c3[_0x0d2f('0x32')][_0x0d2f('0x3e')]){_0x3a18c5['include']=[{'all':!![]}];}_0x3a18c5=_['merge']({},_0x3a18c5,_0x1857c3[_0x0d2f('0x46')]);return db[_0x0d2f('0x2b')][_0x0d2f('0x47')](_0x3a18c5)['then'](handleEntityNotFound(_0x404a11,null))[_0x0d2f('0x21')](respondWithResult(_0x404a11,null))[_0x0d2f('0x42')](handleError(_0x404a11,null));};exports[_0x0d2f('0x48')]=function(_0x2b2337,_0xabb3a7){return db[_0x0d2f('0x2b')][_0x0d2f('0x48')](_0x2b2337[_0x0d2f('0x49')],{})[_0x0d2f('0x21')](function(_0x4a4604){var _0x44c049=_0x2b2337[_0x0d2f('0x4a')][_0x0d2f('0x23')]({'plain':!![]});if(!_0x44c049)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44c049[_0x0d2f('0x4b')]===_0x0d2f('0x4a')){var _0x55a207=_0x4a4604[_0x0d2f('0x23')]({'plain':!![]});var _0x268c91=_0x0d2f('0x4c');return db[_0x0d2f('0x4d')]['find']({'where':{'name':_0x268c91,'userProfileId':_0x44c049['userProfileId']},'raw':!![]})['then'](function(_0xbeb110){if(_0xbeb110&&_0xbeb110[_0x0d2f('0x4e')]===0x0){return db[_0x0d2f('0x24')]['create']({'name':_0x55a207[_0x0d2f('0x28')],'resourceId':_0x55a207['id'],'type':_0xbeb110[_0x0d2f('0x28')],'sectionId':_0xbeb110['id']},{})['then'](function(){return _0x4a4604;});}else{return _0x4a4604;}})[_0x0d2f('0x42')](function(_0x37c6f4){logger[_0x0d2f('0x26')](_0x0d2f('0x4f'),_0x37c6f4);throw _0x37c6f4;});}return _0x4a4604;})[_0x0d2f('0x21')](respondWithResult(_0xabb3a7,0xc9))[_0x0d2f('0x42')](handleError(_0xabb3a7,null));};exports[_0x0d2f('0x50')]=function(_0x3c7483,_0x36fd8d){if(_0x3c7483[_0x0d2f('0x49')]['id']){delete _0x3c7483[_0x0d2f('0x49')]['id'];}return db[_0x0d2f('0x2b')][_0x0d2f('0x47')]({'where':{'id':_0x3c7483[_0x0d2f('0x44')]['id']}})['then'](handleEntityNotFound(_0x36fd8d,null))[_0x0d2f('0x21')](saveUpdates(_0x3c7483[_0x0d2f('0x49')],null))['then'](respondWithResult(_0x36fd8d,null))[_0x0d2f('0x42')](handleError(_0x36fd8d,null));};exports[_0x0d2f('0x22')]=function(_0x4a418d,_0x27f3eb){return db[_0x0d2f('0x2b')][_0x0d2f('0x47')]({'where':{'id':_0x4a418d[_0x0d2f('0x44')]['id']}})[_0x0d2f('0x21')](handleEntityNotFound(_0x27f3eb,null))[_0x0d2f('0x21')](removeEntity(_0x27f3eb,null))['catch'](handleError(_0x27f3eb,null));};exports[_0x0d2f('0x51')]=function(_0x1db745,_0x3134ac,_0x267dd0){var _0x14daa0;return db['SquareOdbc'][_0x0d2f('0x47')]({'where':{'id':_0x1db745[_0x0d2f('0x44')]['id']},'attributes':['id','dsn']})[_0x0d2f('0x21')](handleEntityNotFound(_0x3134ac,null))[_0x0d2f('0x21')](function(_0x5320d8){if(_0x5320d8){var _0xf7a856=require('odbc')();_0xf7a856[_0x0d2f('0x52')](_0x5320d8['dsn']);_0xf7a856['closeSync']();return _0x5320d8;}})['then'](respondWithResult(_0x3134ac,null))['catch'](handleError(_0x3134ac,null));}; \ No newline at end of file +var _0x40c1=['to-csv','ejs','lodash','squel','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','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ODBC','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','intersection','include','create','user','role','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40c1,0x104));var _0x140c=function(_0x57fc3c,_0x3035a8){_0x57fc3c=_0x57fc3c-0x0;var _0x49b4c4=_0x40c1[_0x57fc3c];return _0x49b4c4;};'use strict';var pdf=require(_0x140c('0x0'));var emlformat=require(_0x140c('0x1'));var rimraf=require(_0x140c('0x2'));var zipdir=require(_0x140c('0x3'));var jsonpatch=require(_0x140c('0x4'));var rp=require(_0x140c('0x5'));var moment=require(_0x140c('0x6'));var BPromise=require(_0x140c('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x140c('0x8'));var sox=require(_0x140c('0x9'));var csv=require(_0x140c('0xa'));var ejs=require(_0x140c('0xb'));var fs=require('fs');var _=require(_0x140c('0xc'));var squel=require(_0x140c('0xd'));var crypto=require(_0x140c('0xe'));var jsforce=require(_0x140c('0xf'));var deskjs=require(_0x140c('0x10'));var toCsv=require(_0x140c('0xa'));var querystring=require(_0x140c('0x11'));var Papa=require(_0x140c('0x12'));var Redis=require('ioredis');var authService=require(_0x140c('0x13'));var qs=require(_0x140c('0x14'));var as=require(_0x140c('0x15'));var hardwareService=require(_0x140c('0x16'));var logger=require('../../config/logger')(_0x140c('0x17'));var utils=require(_0x140c('0x18'));var config=require(_0x140c('0x19'));var licenseUtil=require(_0x140c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47f9fb,_0x47f4e8){_0x47f4e8=_0x47f4e8||0xcc;return function(_0x5b4daf){if(_0x5b4daf){return _0x47f9fb[_0x140c('0x1b')](_0x47f4e8);}return _0x47f9fb[_0x140c('0x1c')](_0x47f4e8)[_0x140c('0x1d')]();};}function respondWithResult(_0x10f5dc,_0x196922){_0x196922=_0x196922||0xc8;return function(_0x27059a){if(_0x27059a){return _0x10f5dc[_0x140c('0x1c')](_0x196922)['json'](_0x27059a);}};}function respondWithFilteredResult(_0x161b4d,_0x5c587f){return function(_0x127f2c){if(_0x127f2c){var _0x2fcda8=_0x127f2c[_0x140c('0x1e')],_0x3517e4=_0x5c587f['offset'],_0x500231=_0x5c587f[_0x140c('0x1f')]+_0x5c587f[_0x140c('0x20')],_0x4f6a51;if(_0x500231>=_0x2fcda8){_0x500231=_0x2fcda8;_0x4f6a51=0xc8;}else{_0x4f6a51=0xce;}_0x161b4d[_0x140c('0x1c')](_0x4f6a51);return _0x161b4d[_0x140c('0x21')](_0x140c('0x22'),_0x3517e4+'-'+_0x500231+'/'+_0x2fcda8)[_0x140c('0x23')](_0x127f2c);}return null;};}function patchUpdates(_0x154ffd){return function(_0x96fd36){try{jsonpatch[_0x140c('0x24')](_0x96fd36,_0x154ffd,!![]);}catch(_0x255639){return BPromise[_0x140c('0x25')](_0x255639);}return _0x96fd36[_0x140c('0x26')]();};}function saveUpdates(_0x4684b3,_0x32cd90){return function(_0x3f1e3c){if(_0x3f1e3c){return _0x3f1e3c[_0x140c('0x27')](_0x4684b3)[_0x140c('0x28')](function(_0xe712a8){return _0xe712a8;});}return null;};}function removeEntity(_0x370cef,_0x5b10d9){return function(_0x104f84){if(_0x104f84){return _0x104f84[_0x140c('0x29')]()[_0x140c('0x28')](function(){var _0x2b6e22=_0x104f84[_0x140c('0x2a')]({'plain':!![]});var _0x37134f=_0x140c('0x2b');return db['UserProfileResource'][_0x140c('0x29')]({'where':{'type':_0x37134f,'resourceId':_0x2b6e22['id']}})[_0x140c('0x28')](function(){return _0x104f84;});})['then'](function(){_0x370cef[_0x140c('0x1c')](0xcc)[_0x140c('0x1d')]();});}};}function handleEntityNotFound(_0x104941,_0x348cc5){return function(_0xeb4df4){if(!_0xeb4df4){_0x104941['sendStatus'](0x194);}return _0xeb4df4;};}function handleError(_0x2fc332,_0x10565f){_0x10565f=_0x10565f||0x1f4;return function(_0xbb1113){logger['error'](_0xbb1113[_0x140c('0x2c')]);if(_0xbb1113[_0x140c('0x2d')]){delete _0xbb1113['name'];}_0x2fc332[_0x140c('0x1c')](_0x10565f)[_0x140c('0x2e')](_0xbb1113);};}exports[_0x140c('0x2f')]=function(_0x4b4c3c,_0x262c04){var _0x5bfdb5={},_0x3be16c={},_0x3f43b8={'count':0x0,'rows':[]};var _0x8fd7fb=_[_0x140c('0x30')](db[_0x140c('0x31')][_0x140c('0x32')],function(_0x76eeb0){return{'name':_0x76eeb0[_0x140c('0x33')],'type':_0x76eeb0['type'][_0x140c('0x34')]};});_0x3be16c['model']=_[_0x140c('0x30')](_0x8fd7fb,_0x140c('0x2d'));_0x3be16c[_0x140c('0x35')]=_[_0x140c('0x36')](_0x4b4c3c['query']);_0x3be16c['filters']=_['intersection'](_0x3be16c[_0x140c('0x37')],_0x3be16c[_0x140c('0x35')]);_0x5bfdb5[_0x140c('0x38')]=_['intersection'](_0x3be16c[_0x140c('0x37')],qs[_0x140c('0x39')](_0x4b4c3c['query'][_0x140c('0x39')]));_0x5bfdb5[_0x140c('0x38')]=_0x5bfdb5[_0x140c('0x38')][_0x140c('0x3a')]?_0x5bfdb5[_0x140c('0x38')]:_0x3be16c[_0x140c('0x37')];if(!_0x4b4c3c[_0x140c('0x35')][_0x140c('0x3b')](_0x140c('0x3c'))){_0x5bfdb5[_0x140c('0x20')]=qs[_0x140c('0x20')](_0x4b4c3c[_0x140c('0x35')]['limit']);_0x5bfdb5[_0x140c('0x1f')]=qs[_0x140c('0x1f')](_0x4b4c3c[_0x140c('0x35')][_0x140c('0x1f')]);}_0x5bfdb5[_0x140c('0x3d')]=qs[_0x140c('0x3e')](_0x4b4c3c[_0x140c('0x35')][_0x140c('0x3e')]);_0x5bfdb5[_0x140c('0x3f')]=qs[_0x140c('0x40')](_[_0x140c('0x41')](_0x4b4c3c[_0x140c('0x35')],_0x3be16c[_0x140c('0x40')]),_0x8fd7fb);if(_0x4b4c3c[_0x140c('0x35')][_0x140c('0x42')]){_0x5bfdb5[_0x140c('0x3f')]=_[_0x140c('0x43')](_0x5bfdb5[_0x140c('0x3f')],{'$or':_['map'](_0x8fd7fb,function(_0xb9c2c2){if(_0xb9c2c2[_0x140c('0x44')]!==_0x140c('0x45')){var _0x27c313={};_0x27c313[_0xb9c2c2[_0x140c('0x2d')]]={'$like':'%'+_0x4b4c3c[_0x140c('0x35')][_0x140c('0x42')]+'%'};return _0x27c313;}})});}_0x5bfdb5=_[_0x140c('0x43')]({},_0x5bfdb5,_0x4b4c3c[_0x140c('0x46')]);var _0x597b3a={'where':_0x5bfdb5[_0x140c('0x3f')]};return db['SquareOdbc'][_0x140c('0x1e')](_0x597b3a)[_0x140c('0x28')](function(_0x53f893){_0x3f43b8[_0x140c('0x1e')]=_0x53f893;if(_0x4b4c3c[_0x140c('0x35')]['includeAll']){_0x5bfdb5['include']=[{'all':!![]}];}return db[_0x140c('0x31')][_0x140c('0x47')](_0x5bfdb5);})['then'](function(_0x17bc2a){_0x3f43b8['rows']=_0x17bc2a;return _0x3f43b8;})[_0x140c('0x28')](respondWithFilteredResult(_0x262c04,_0x5bfdb5))[_0x140c('0x48')](handleError(_0x262c04,null));};exports[_0x140c('0x49')]=function(_0x33d1ab,_0xaa5639){var _0x38f0c2={'raw':!![],'where':{'id':_0x33d1ab[_0x140c('0x4a')]['id']}},_0x17b55e={};_0x17b55e[_0x140c('0x37')]=_[_0x140c('0x36')](db['SquareOdbc'][_0x140c('0x32')]);_0x17b55e['query']=_[_0x140c('0x36')](_0x33d1ab[_0x140c('0x35')]);_0x17b55e['filters']=_[_0x140c('0x4b')](_0x17b55e[_0x140c('0x37')],_0x17b55e[_0x140c('0x35')]);_0x38f0c2[_0x140c('0x38')]=_[_0x140c('0x4b')](_0x17b55e[_0x140c('0x37')],qs[_0x140c('0x39')](_0x33d1ab['query'][_0x140c('0x39')]));_0x38f0c2[_0x140c('0x38')]=_0x38f0c2[_0x140c('0x38')]['length']?_0x38f0c2[_0x140c('0x38')]:_0x17b55e[_0x140c('0x37')];if(_0x33d1ab[_0x140c('0x35')]['includeAll']){_0x38f0c2[_0x140c('0x4c')]=[{'all':!![]}];}_0x38f0c2=_[_0x140c('0x43')]({},_0x38f0c2,_0x33d1ab[_0x140c('0x46')]);return db[_0x140c('0x31')]['find'](_0x38f0c2)[_0x140c('0x28')](handleEntityNotFound(_0xaa5639,null))['then'](respondWithResult(_0xaa5639,null))['catch'](handleError(_0xaa5639,null));};exports[_0x140c('0x4d')]=function(_0x12e914,_0x49496f){return db[_0x140c('0x31')][_0x140c('0x4d')](_0x12e914['body'],{})['then'](function(_0x3deecb){var _0x31c744=_0x12e914[_0x140c('0x4e')][_0x140c('0x2a')]({'plain':!![]});if(!_0x31c744)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31c744[_0x140c('0x4f')]===_0x140c('0x4e')){var _0x1d4b16=_0x3deecb[_0x140c('0x2a')]({'plain':!![]});var _0xf137c=_0x140c('0x2b');return db[_0x140c('0x50')][_0x140c('0x51')]({'where':{'name':_0xf137c,'userProfileId':_0x31c744['userProfileId']},'raw':!![]})[_0x140c('0x28')](function(_0xf995f5){if(_0xf995f5&&_0xf995f5[_0x140c('0x52')]===0x0){return db[_0x140c('0x53')][_0x140c('0x4d')]({'name':_0x1d4b16['name'],'resourceId':_0x1d4b16['id'],'type':_0xf995f5['name'],'sectionId':_0xf995f5['id']},{})[_0x140c('0x28')](function(){return _0x3deecb;});}else{return _0x3deecb;}})[_0x140c('0x48')](function(_0x39c866){logger[_0x140c('0x54')](_0x140c('0x55'),_0x39c866);throw _0x39c866;});}return _0x3deecb;})[_0x140c('0x28')](respondWithResult(_0x49496f,0xc9))[_0x140c('0x48')](handleError(_0x49496f,null));};exports['update']=function(_0xc305ce,_0x33b414){if(_0xc305ce[_0x140c('0x56')]['id']){delete _0xc305ce[_0x140c('0x56')]['id'];}return db[_0x140c('0x31')]['find']({'where':{'id':_0xc305ce[_0x140c('0x4a')]['id']}})[_0x140c('0x28')](handleEntityNotFound(_0x33b414,null))['then'](saveUpdates(_0xc305ce[_0x140c('0x56')],null))[_0x140c('0x28')](respondWithResult(_0x33b414,null))[_0x140c('0x48')](handleError(_0x33b414,null));};exports[_0x140c('0x29')]=function(_0x59bbec,_0xcc243b){return db[_0x140c('0x31')][_0x140c('0x51')]({'where':{'id':_0x59bbec[_0x140c('0x4a')]['id']}})[_0x140c('0x28')](handleEntityNotFound(_0xcc243b,null))['then'](removeEntity(_0xcc243b,null))[_0x140c('0x48')](handleError(_0xcc243b,null));};exports[_0x140c('0x57')]=function(_0x1e0571,_0x2df4f2,_0x5b9775){var _0x31329a;return db[_0x140c('0x31')]['find']({'where':{'id':_0x1e0571[_0x140c('0x4a')]['id']},'attributes':['id',_0x140c('0x58')]})[_0x140c('0x28')](handleEntityNotFound(_0x2df4f2,null))[_0x140c('0x28')](function(_0x576ef9){if(_0x576ef9){var _0x5f12ff=require(_0x140c('0x59'))();_0x5f12ff['openSync'](_0x576ef9['dsn']);_0x5f12ff['closeSync']();return _0x576ef9;}})[_0x140c('0x28')](respondWithResult(_0x2df4f2,null))[_0x140c('0x48')](handleError(_0x2df4f2,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index a5b3e34..e59bc5a 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 _0xd3d3=['../../config/environment','exports','define','SquareOdbc','square_odbc','../../config/logger','api','path','rimraf'];(function(_0x164162,_0x200cfd){var _0x12ec24=function(_0x2b6791){while(--_0x2b6791){_0x164162['push'](_0x164162['shift']());}};_0x12ec24(++_0x200cfd);}(_0xd3d3,0x19a));var _0x3d3d=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xd3d3[_0x10004e];return _0x5af990;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3d3d('0x0'))(_0x3d3d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d3d('0x2'));var rimraf=require(_0x3d3d('0x3'));var config=require(_0x3d3d('0x4'));var attributes=require('./squareOdbc.attributes');module[_0x3d3d('0x5')]=function(_0x5de1f8,_0x228033){return _0x5de1f8[_0x3d3d('0x6')](_0x3d3d('0x7'),attributes,{'tableName':_0x3d3d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72fa=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc'];(function(_0xb0be8e,_0x3a1258){var _0x4ee710=function(_0x57f288){while(--_0x57f288){_0xb0be8e['push'](_0xb0be8e['shift']());}};_0x4ee710(++_0x3a1258);}(_0x72fa,0x78));var _0xa72f=function(_0x31bfee,_0x5e7b65){_0x31bfee=_0x31bfee-0x0;var _0x4fe58e=_0x72fa[_0x31bfee];return _0x4fe58e;};'use strict';var _=require(_0xa72f('0x0'));var util=require(_0xa72f('0x1'));var logger=require('../../config/logger')(_0xa72f('0x2'));var moment=require(_0xa72f('0x3'));var BPromise=require(_0xa72f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa72f('0x5'));var config=require(_0xa72f('0x6'));var attributes=require(_0xa72f('0x7'));module[_0xa72f('0x8')]=function(_0x649c2d,_0x411f02){return _0x649c2d[_0xa72f('0x9')](_0xa72f('0xa'),attributes,{'tableName':_0xa72f('0xb'),'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 4e4c74e..e4c3225 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 _0x3e74=['catch','SquareOdbc','find','options','raw','where','attributes','include','map','model','then','ShowSquareOdbc','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SquareOdbc,\x20%s,\x20%s','message','info'];(function(_0x2608cc,_0x550602){var _0x671ece=function(_0x35a8ee){while(--_0x35a8ee){_0x2608cc['push'](_0x2608cc['shift']());}};_0x671ece(++_0x550602);}(_0x3e74,0x175));var _0x43e7=function(_0x405495,_0x51072e){_0x405495=_0x405495-0x0;var _0xf52ff2=_0x3e74[_0x405495];return _0xf52ff2;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowSquareOdbc']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ 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(_0x22b2be,_0x4b164c){var _0x213c31=function(_0x475528){while(--_0x475528){_0x22b2be['push'](_0x22b2be['shift']());}};_0x213c31(++_0x4b164c);}(_0xe14b,0x93));var _0xbe14=function(_0x741019,_0x327041){_0x741019=_0x741019-0x0;var _0x10094f=_0xe14b[_0x741019];return _0x10094f;};'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 11c9205..c9522c7 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 _0x323a=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','create','addUsers','destroy'];(function(_0x20f14e,_0x45cf2f){var _0x4fa76c=function(_0xb28085){while(--_0xb28085){_0x20f14e['push'](_0x20f14e['shift']());}};_0x4fa76c(++_0x45cf2f);}(_0x323a,0x75));var _0xa323=function(_0x29d693,_0x2daadb){_0x29d693=_0x29d693-0x0;var _0x1210c6=_0x323a[_0x29d693];return _0x1210c6;};'use strict';var multer=require(_0xa323('0x0'));var util=require(_0xa323('0x1'));var path=require(_0xa323('0x2'));var timeout=require(_0xa323('0x3'));var express=require(_0xa323('0x4'));var router=express[_0xa323('0x5')]();var auth=require(_0xa323('0x6'));var interaction=require(_0xa323('0x7'));var config=require(_0xa323('0x8'));var controller=require(_0xa323('0x9'));router[_0xa323('0xa')]('/',auth[_0xa323('0xb')](),controller[_0xa323('0xc')]);router[_0xa323('0xa')](_0xa323('0xd'),auth[_0xa323('0xb')](),controller[_0xa323('0xe')]);router[_0xa323('0xa')](_0xa323('0xf'),auth['isAuthenticated'](),controller[_0xa323('0x10')]);router[_0xa323('0x11')]('/',auth[_0xa323('0xb')](),controller[_0xa323('0x12')]);router[_0xa323('0x11')](_0xa323('0xf'),auth[_0xa323('0xb')](),controller[_0xa323('0x13')]);router['put'](_0xa323('0xd'),auth[_0xa323('0xb')](),controller['update']);router['delete']('/:id',auth[_0xa323('0xb')](),controller[_0xa323('0x14')]);router[_0xa323('0x15')](_0xa323('0xf'),auth[_0xa323('0xb')](),controller['removeUsers']);module[_0xa323('0x16')]=router; \ No newline at end of file +var _0xf7df=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','show','/:id/users','post','create','update','/:id','delete','removeUsers'];(function(_0xf8bba8,_0x3a46d3){var _0x31dadd=function(_0x4eac2d){while(--_0x4eac2d){_0xf8bba8['push'](_0xf8bba8['shift']());}};_0x31dadd(++_0x3a46d3);}(_0xf7df,0xf0));var _0xff7d=function(_0x48bb28,_0x27c94e){_0x48bb28=_0x48bb28-0x0;var _0x444613=_0xf7df[_0x48bb28];return _0x444613;};'use strict';var multer=require(_0xff7d('0x0'));var util=require(_0xff7d('0x1'));var path=require(_0xff7d('0x2'));var timeout=require(_0xff7d('0x3'));var express=require(_0xff7d('0x4'));var router=express[_0xff7d('0x5')]();var auth=require(_0xff7d('0x6'));var interaction=require(_0xff7d('0x7'));var config=require(_0xff7d('0x8'));var controller=require(_0xff7d('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xff7d('0xa')]('/:id',auth[_0xff7d('0xb')](),controller[_0xff7d('0xc')]);router[_0xff7d('0xa')](_0xff7d('0xd'),auth[_0xff7d('0xb')](),controller['getUsers']);router[_0xff7d('0xe')]('/',auth['isAuthenticated'](),controller[_0xff7d('0xf')]);router[_0xff7d('0xe')](_0xff7d('0xd'),auth['isAuthenticated'](),controller['addUsers']);router['put']('/:id',auth[_0xff7d('0xb')](),controller[_0xff7d('0x10')]);router['delete'](_0xff7d('0x11'),auth[_0xff7d('0xb')](),controller['destroy']);router[_0xff7d('0x12')](_0xff7d('0xd'),auth[_0xff7d('0xb')](),controller[_0xff7d('0x13')]);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 99c9156..117c471 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 _0xb4b4=['TEXT','BLOB','long','preproduction','getDataValue','toString','production','utf8','DATE','sequelize','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb4b4,0xb1));var _0x4b4b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xb4b4[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x4b4b('0x0'));module[_0x4b4b('0x1')]={'name':{'type':Sequelize[_0x4b4b('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x4b4b('0x2')]},'notes':{'type':Sequelize[_0x4b4b('0x3')]},'preproduction':{'type':Sequelize[_0x4b4b('0x4')](_0x4b4b('0x5')),'get':function(){if(this['getDataValue'](_0x4b4b('0x6'))){return this[_0x4b4b('0x7')](_0x4b4b('0x6'))[_0x4b4b('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x4b4b('0x4')](_0x4b4b('0x5')),'get':function(){if(this[_0x4b4b('0x7')](_0x4b4b('0x9'))){return this[_0x4b4b('0x7')](_0x4b4b('0x9'))['toString'](_0x4b4b('0xa'));}}},'savedAt':{'type':Sequelize[_0x4b4b('0xb')]},'publishedAt':{'type':Sequelize[_0x4b4b('0xb')]}}; \ No newline at end of file +var _0x2234=['exports','STRING','name','TEXT','long','getDataValue','preproduction','toString','utf8','BLOB','production','DATE'];(function(_0x419d0b,_0x1f14dd){var _0x3b2ffc=function(_0x269d68){while(--_0x269d68){_0x419d0b['push'](_0x419d0b['shift']());}};_0x3b2ffc(++_0x1f14dd);}(_0x2234,0x18c));var _0x4223=function(_0x174e6b,_0x124a26){_0x174e6b=_0x174e6b-0x0;var _0x10ab0e=_0x2234[_0x174e6b];return _0x10ab0e;};'use strict';var Sequelize=require('sequelize');module[_0x4223('0x0')]={'name':{'type':Sequelize[_0x4223('0x1')],'unique':_0x4223('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x4223('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x4223('0x4')),'get':function(){if(this[_0x4223('0x5')](_0x4223('0x6'))){return this[_0x4223('0x5')](_0x4223('0x6'))[_0x4223('0x7')](_0x4223('0x8'));}}},'production':{'type':Sequelize[_0x4223('0x9')](_0x4223('0x4')),'get':function(){if(this[_0x4223('0x5')](_0x4223('0xa'))){return this[_0x4223('0x5')](_0x4223('0xa'))[_0x4223('0x7')](_0x4223('0x8'));}}},'savedAt':{'type':Sequelize[_0x4223('0xb')]},'publishedAt':{'type':Sequelize[_0x4223('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5cbe9a2..aa0d70c 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 _0x3f47=['filters','pick','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','send','index','SquareProject','rawAttributes','fieldName','type','model','map','name','keys','query','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User'];(function(_0x3e9042,_0x3381ca){var _0x158ba1=function(_0x427e3b){while(--_0x427e3b){_0x3e9042['push'](_0x3e9042['shift']());}};_0x158ba1(++_0x3381ca);}(_0x3f47,0x68));var _0x73f4=function(_0x5a0c03,_0x5757d8){_0x5a0c03=_0x5a0c03-0x0;var _0x2879d6=_0x3f47[_0x5a0c03];return _0x2879d6;};'use strict';var pdf=require(_0x73f4('0x0'));var emlformat=require(_0x73f4('0x1'));var rimraf=require(_0x73f4('0x2'));var zipdir=require(_0x73f4('0x3'));var jsonpatch=require(_0x73f4('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x73f4('0x5'));var util=require(_0x73f4('0x6'));var path=require('path');var sox=require(_0x73f4('0x7'));var csv=require(_0x73f4('0x8'));var ejs=require(_0x73f4('0x9'));var fs=require('fs');var _=require(_0x73f4('0xa'));var squel=require(_0x73f4('0xb'));var crypto=require('crypto');var jsforce=require(_0x73f4('0xc'));var deskjs=require(_0x73f4('0xd'));var toCsv=require(_0x73f4('0x8'));var querystring=require(_0x73f4('0xe'));var Papa=require(_0x73f4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x73f4('0x10'));var hardwareService=require(_0x73f4('0x11'));var logger=require(_0x73f4('0x12'))('api');var utils=require(_0x73f4('0x13'));var config=require(_0x73f4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x73f4('0x15'))['db'];config[_0x73f4('0x16')]=_[_0x73f4('0x17')](config[_0x73f4('0x16')],{'host':_0x73f4('0x18'),'port':0x18eb});var socket=require(_0x73f4('0x19'))(new Redis(config[_0x73f4('0x16')]));require(_0x73f4('0x1a'))[_0x73f4('0x1b')](socket);function respondWithStatusCode(_0x40fc71,_0x9f0156){_0x9f0156=_0x9f0156||0xcc;return function(_0x2c91c0){if(_0x2c91c0){return _0x40fc71[_0x73f4('0x1c')](_0x9f0156);}return _0x40fc71[_0x73f4('0x1d')](_0x9f0156)[_0x73f4('0x1e')]();};}function respondWithResult(_0x5a9421,_0x4c2aa7){_0x4c2aa7=_0x4c2aa7||0xc8;return function(_0x1790c7){if(_0x1790c7){return _0x5a9421['status'](_0x4c2aa7)['json'](_0x1790c7);}};}function respondWithFilteredResult(_0x2c3606,_0x16b502){return function(_0x253fde){if(_0x253fde){var _0x41db2c=_0x253fde[_0x73f4('0x1f')],_0x2101a6=_0x16b502['offset'],_0x14bd97=_0x16b502[_0x73f4('0x20')]+_0x16b502[_0x73f4('0x21')],_0x327f37;if(_0x14bd97>=_0x41db2c){_0x14bd97=_0x41db2c;_0x327f37=0xc8;}else{_0x327f37=0xce;}_0x2c3606[_0x73f4('0x1d')](_0x327f37);return _0x2c3606[_0x73f4('0x22')](_0x73f4('0x23'),_0x2101a6+'-'+_0x14bd97+'/'+_0x41db2c)[_0x73f4('0x24')](_0x253fde);}return null;};}function patchUpdates(_0xe40455){return function(_0x534350){try{jsonpatch[_0x73f4('0x25')](_0x534350,_0xe40455,!![]);}catch(_0x10b12e){return BPromise[_0x73f4('0x26')](_0x10b12e);}return _0x534350[_0x73f4('0x27')]();};}function saveUpdates(_0x47a2b3,_0xc60379){return function(_0x2f6ffc){if(_0x2f6ffc){return _0x2f6ffc[_0x73f4('0x28')](_0x47a2b3)[_0x73f4('0x29')](function(_0xe328ce){return _0xe328ce;});}return null;};}function removeEntity(_0x3af6c9,_0x3461fc){return function(_0x3be348){if(_0x3be348){return _0x3be348[_0x73f4('0x2a')]()['then'](function(){var _0x185088=_0x3be348[_0x73f4('0x2b')]({'plain':!![]});var _0x37a0c0=_0x73f4('0x2c');return db[_0x73f4('0x2d')]['destroy']({'where':{'type':_0x37a0c0,'resourceId':_0x185088['id']}})[_0x73f4('0x29')](function(){return _0x3be348;});})['then'](function(){_0x3af6c9[_0x73f4('0x1d')](0xcc)[_0x73f4('0x1e')]();});}};}function handleEntityNotFound(_0x21b09d,_0x45852c){return function(_0x3fbc26){if(!_0x3fbc26){_0x21b09d[_0x73f4('0x1c')](0x194);}return _0x3fbc26;};}function handleError(_0x53292a,_0x1d31d0){_0x1d31d0=_0x1d31d0||0x1f4;return function(_0x2079f3){logger[_0x73f4('0x2e')](_0x2079f3[_0x73f4('0x2f')]);if(_0x2079f3['name']){delete _0x2079f3['name'];}_0x53292a['status'](_0x1d31d0)[_0x73f4('0x30')](_0x2079f3);};}exports[_0x73f4('0x31')]=function(_0x602ddb,_0x529ebd){var _0x3f948a={},_0x2e1142={},_0x3d703={'count':0x0,'rows':[]};var _0x4cefc3=_['map'](db[_0x73f4('0x32')][_0x73f4('0x33')],function(_0x505190){return{'name':_0x505190[_0x73f4('0x34')],'type':_0x505190[_0x73f4('0x35')]['key']};});_0x2e1142[_0x73f4('0x36')]=_[_0x73f4('0x37')](_0x4cefc3,_0x73f4('0x38'));_0x2e1142['query']=_[_0x73f4('0x39')](_0x602ddb[_0x73f4('0x3a')]);_0x2e1142['filters']=_['intersection'](_0x2e1142[_0x73f4('0x36')],_0x2e1142['query']);_0x3f948a['attributes']=_['intersection'](_0x2e1142[_0x73f4('0x36')],qs[_0x73f4('0x3b')](_0x602ddb[_0x73f4('0x3a')]['fields']));_0x3f948a[_0x73f4('0x3c')]=_0x3f948a[_0x73f4('0x3c')][_0x73f4('0x3d')]?_0x3f948a['attributes']:_0x2e1142[_0x73f4('0x36')];if(!_0x602ddb[_0x73f4('0x3a')]['hasOwnProperty']('nolimit')){_0x3f948a['limit']=qs[_0x73f4('0x21')](_0x602ddb[_0x73f4('0x3a')][_0x73f4('0x21')]);_0x3f948a[_0x73f4('0x20')]=qs[_0x73f4('0x20')](_0x602ddb[_0x73f4('0x3a')][_0x73f4('0x20')]);}_0x3f948a[_0x73f4('0x3e')]=qs[_0x73f4('0x3f')](_0x602ddb[_0x73f4('0x3a')]['sort']);_0x3f948a[_0x73f4('0x40')]=qs['filters'](_['pick'](_0x602ddb[_0x73f4('0x3a')],_0x2e1142['filters']),_0x4cefc3);if(_0x602ddb[_0x73f4('0x3a')][_0x73f4('0x41')]){_0x3f948a['where']=_[_0x73f4('0x42')](_0x3f948a[_0x73f4('0x40')],{'$or':_['map'](_0x4cefc3,function(_0x36e668){if(_0x36e668['type']!==_0x73f4('0x43')){var _0x1e2a55={};_0x1e2a55[_0x36e668[_0x73f4('0x38')]]={'$like':'%'+_0x602ddb[_0x73f4('0x3a')]['filter']+'%'};return _0x1e2a55;}})});}_0x3f948a=_[_0x73f4('0x42')]({},_0x3f948a,_0x602ddb[_0x73f4('0x44')]);var _0x40d252={'where':_0x3f948a[_0x73f4('0x40')]};return db['SquareProject'][_0x73f4('0x1f')](_0x40d252)['then'](function(_0x1f98e0){_0x3d703['count']=_0x1f98e0;if(_0x602ddb[_0x73f4('0x3a')][_0x73f4('0x45')]){_0x3f948a[_0x73f4('0x46')]=[{'all':!![]}];}return db[_0x73f4('0x32')][_0x73f4('0x47')](_0x3f948a);})[_0x73f4('0x29')](function(_0x566245){_0x3d703[_0x73f4('0x48')]=_0x566245;return _0x3d703;})[_0x73f4('0x29')](respondWithFilteredResult(_0x529ebd,_0x3f948a))[_0x73f4('0x49')](handleError(_0x529ebd,null));};exports[_0x73f4('0x4a')]=function(_0x3f224c,_0x2510f9){var _0x47d4c1={'raw':![],'where':{'id':_0x3f224c[_0x73f4('0x4b')]['id']}},_0x4b284b={};_0x4b284b[_0x73f4('0x36')]=_[_0x73f4('0x39')](db[_0x73f4('0x32')]['rawAttributes']);_0x4b284b['query']=_[_0x73f4('0x39')](_0x3f224c[_0x73f4('0x3a')]);_0x4b284b['filters']=_[_0x73f4('0x4c')](_0x4b284b[_0x73f4('0x36')],_0x4b284b[_0x73f4('0x3a')]);_0x47d4c1[_0x73f4('0x3c')]=_[_0x73f4('0x4c')](_0x4b284b['model'],qs[_0x73f4('0x3b')](_0x3f224c['query']['fields']));_0x47d4c1['attributes']=_0x47d4c1[_0x73f4('0x3c')][_0x73f4('0x3d')]?_0x47d4c1[_0x73f4('0x3c')]:_0x4b284b[_0x73f4('0x36')];if(_0x3f224c[_0x73f4('0x3a')][_0x73f4('0x45')]){_0x47d4c1['include']=[{'all':!![]}];}_0x47d4c1=_[_0x73f4('0x42')]({},_0x47d4c1,_0x3f224c[_0x73f4('0x44')]);return db[_0x73f4('0x32')][_0x73f4('0x4d')](_0x47d4c1)[_0x73f4('0x29')](handleEntityNotFound(_0x2510f9,null))[_0x73f4('0x29')](respondWithResult(_0x2510f9,null))['catch'](handleError(_0x2510f9,null));};exports[_0x73f4('0x4e')]=function(_0xcb1863,_0x24b312){return db[_0x73f4('0x32')][_0x73f4('0x4e')](_0xcb1863[_0x73f4('0x4f')],{})[_0x73f4('0x29')](function(_0x359976){var _0x25c5d6=_0xcb1863[_0x73f4('0x50')]['get']({'plain':!![]});if(!_0x25c5d6)throw new Error(_0x73f4('0x51'));if(_0x25c5d6[_0x73f4('0x52')]===_0x73f4('0x50')){var _0xb86300=_0x359976[_0x73f4('0x2b')]({'plain':!![]});var _0x43a9cb=_0x73f4('0x2c');return db[_0x73f4('0x53')][_0x73f4('0x4d')]({'where':{'name':_0x43a9cb,'userProfileId':_0x25c5d6['userProfileId']},'raw':!![]})[_0x73f4('0x29')](function(_0x547b50){if(_0x547b50&&_0x547b50[_0x73f4('0x54')]===0x0){return db['UserProfileResource'][_0x73f4('0x4e')]({'name':_0xb86300['name'],'resourceId':_0xb86300['id'],'type':_0x547b50['name'],'sectionId':_0x547b50['id']},{})[_0x73f4('0x29')](function(){return _0x359976;});}else{return _0x359976;}})[_0x73f4('0x49')](function(_0x55f3ee){logger[_0x73f4('0x2e')](_0x73f4('0x55'),_0x55f3ee);throw _0x55f3ee;});}return _0x359976;})[_0x73f4('0x29')](respondWithResult(_0x24b312,0xc9))[_0x73f4('0x49')](handleError(_0x24b312,null));};exports['update']=function(_0x557c98,_0x11c4fc){if(_0x557c98[_0x73f4('0x4f')]['id']){delete _0x557c98[_0x73f4('0x4f')]['id'];}return db['SquareProject'][_0x73f4('0x4d')]({'where':{'id':_0x557c98[_0x73f4('0x4b')]['id']}})[_0x73f4('0x29')](handleEntityNotFound(_0x11c4fc,null))[_0x73f4('0x29')](saveUpdates(_0x557c98[_0x73f4('0x4f')],null))[_0x73f4('0x29')](respondWithResult(_0x11c4fc,null))[_0x73f4('0x49')](handleError(_0x11c4fc,null));};exports[_0x73f4('0x2a')]=function(_0x2271a1,_0x22ff0c){return db[_0x73f4('0x32')][_0x73f4('0x4d')]({'where':{'id':_0x2271a1['params']['id']}})[_0x73f4('0x29')](handleEntityNotFound(_0x22ff0c,null))[_0x73f4('0x29')](removeEntity(_0x22ff0c,null))[_0x73f4('0x49')](handleError(_0x22ff0c,null));};exports[_0x73f4('0x56')]=function(_0x376cad,_0x5ae7ef,_0x20a4ac){return db[_0x73f4('0x32')][_0x73f4('0x4d')]({'where':{'id':_0x376cad['params']['id']}})[_0x73f4('0x29')](handleEntityNotFound(_0x5ae7ef,null))['then'](function(_0x47674b){if(_0x47674b){return _0x47674b[_0x73f4('0x56')](_0x376cad[_0x73f4('0x4f')][_0x73f4('0x57')],_[_0x73f4('0x58')](_0x376cad[_0x73f4('0x4f')],[_0x73f4('0x57'),'id'])||{});}})['then'](respondWithResult(_0x5ae7ef,null))['catch'](handleError(_0x5ae7ef,null));};exports[_0x73f4('0x59')]=function(_0x4fa63c,_0x235bca,_0xda8d45){return db[_0x73f4('0x32')][_0x73f4('0x4d')]({'where':{'id':_0x4fa63c[_0x73f4('0x4b')]['id']}})[_0x73f4('0x29')](handleEntityNotFound(_0x235bca,null))[_0x73f4('0x29')](function(_0x1e7725){if(_0x1e7725){return _0x1e7725[_0x73f4('0x59')](_0x4fa63c[_0x73f4('0x3a')]['ids'])['then'](function(){if(_[_0x73f4('0x5a')](_0x4fa63c[_0x73f4('0x3a')]['ids'])){for(var _0x3b5589=0x0;_0x3b5589<_0x4fa63c['query'][_0x73f4('0x57')][_0x73f4('0x3d')];_0x3b5589+=0x1){socket['emit'](_0x73f4('0x5b'),{'UserId':Number(_0x4fa63c[_0x73f4('0x3a')]['ids'][_0x3b5589]),'SquareProjectId':Number(_0x4fa63c[_0x73f4('0x4b')]['id'])});}}else{socket[_0x73f4('0x5c')]('userSquareProject:remove',{'UserId':Number(_0x4fa63c[_0x73f4('0x3a')][_0x73f4('0x57')]),'SquareProjectId':Number(_0x4fa63c['params']['id'])});}});}})[_0x73f4('0x29')](respondWithStatusCode(_0x235bca,null))['catch'](handleError(_0x235bca,null));};exports[_0x73f4('0x5d')]=function(_0x3f3723,_0x2857ea,_0x46fe5f){var _0x3a172f={};var _0x152701={};var _0x35214c;var _0x8b2c58;return db[_0x73f4('0x32')][_0x73f4('0x5e')]({'where':{'id':_0x3f3723[_0x73f4('0x4b')]['id']}})[_0x73f4('0x29')](handleEntityNotFound(_0x2857ea,null))[_0x73f4('0x29')](function(_0x236bbb){if(_0x236bbb){_0x35214c=_0x236bbb;_0x152701[_0x73f4('0x36')]=_['keys'](db[_0x73f4('0x5f')][_0x73f4('0x33')]);_0x152701[_0x73f4('0x3a')]=_[_0x73f4('0x39')](_0x3f3723[_0x73f4('0x3a')]);_0x152701[_0x73f4('0x60')]=_[_0x73f4('0x4c')](_0x152701['model'],_0x152701[_0x73f4('0x3a')]);_0x3a172f[_0x73f4('0x3c')]=_[_0x73f4('0x4c')](_0x152701[_0x73f4('0x36')],qs[_0x73f4('0x3b')](_0x3f3723[_0x73f4('0x3a')]['fields']));_0x3a172f[_0x73f4('0x3c')]=_0x3a172f['attributes'][_0x73f4('0x3d')]?_0x3a172f[_0x73f4('0x3c')]:_0x152701[_0x73f4('0x36')];_0x3a172f[_0x73f4('0x3e')]=qs[_0x73f4('0x3f')](_0x3f3723['query']['sort']);_0x3a172f[_0x73f4('0x40')]=qs[_0x73f4('0x60')](_[_0x73f4('0x61')](_0x3f3723[_0x73f4('0x3a')],_0x152701[_0x73f4('0x60')]));if(_0x3f3723[_0x73f4('0x3a')][_0x73f4('0x41')]){_0x3a172f[_0x73f4('0x40')]=_['merge'](_0x3a172f[_0x73f4('0x40')],{'$or':_[_0x73f4('0x37')](_0x3a172f[_0x73f4('0x3c')],function(_0x3f777){var _0x474a88={};_0x474a88[_0x3f777]={'$like':'%'+_0x3f3723[_0x73f4('0x3a')][_0x73f4('0x41')]+'%'};return _0x474a88;})});}_0x3a172f=_[_0x73f4('0x42')]({},_0x3a172f,_0x3f3723[_0x73f4('0x44')]);return _0x35214c[_0x73f4('0x5d')](_0x3a172f);}})['then'](function(_0x2244b8){if(_0x2244b8){_0x8b2c58=_0x2244b8[_0x73f4('0x3d')];if(!_0x3f3723[_0x73f4('0x3a')][_0x73f4('0x62')](_0x73f4('0x63'))){_0x3a172f[_0x73f4('0x21')]=qs[_0x73f4('0x21')](_0x3f3723[_0x73f4('0x3a')]['limit']);_0x3a172f[_0x73f4('0x20')]=qs[_0x73f4('0x20')](_0x3f3723['query'][_0x73f4('0x20')]);}return _0x35214c[_0x73f4('0x5d')](_0x3a172f);}})['then'](function(_0x4a9fcd){if(_0x4a9fcd){return _0x4a9fcd?{'count':_0x8b2c58,'rows':_0x4a9fcd}:null;}})[_0x73f4('0x29')](respondWithResult(_0x2857ea,null))[_0x73f4('0x49')](handleError(_0x2857ea,null));}; \ No newline at end of file +var _0xfb7d=['length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','findAll','catch','show','filters','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','eml-format','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','json','offset','limit','status','set','apply','reject','then','destroy','get','SquareProjects','UserProfileResource','end','error','name','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfb7d,0xe1));var _0xdfb7=function(_0x2b2187,_0x4491c1){_0x2b2187=_0x2b2187-0x0;var _0x51ea93=_0xfb7d[_0x2b2187];return _0x51ea93;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdfb7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdfb7('0x1'));var rp=require(_0xdfb7('0x2'));var moment=require(_0xdfb7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdfb7('0x4'));var path=require(_0xdfb7('0x5'));var sox=require(_0xdfb7('0x6'));var csv=require('to-csv');var ejs=require(_0xdfb7('0x7'));var fs=require('fs');var _=require(_0xdfb7('0x8'));var squel=require(_0xdfb7('0x9'));var crypto=require(_0xdfb7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdfb7('0xb'));var toCsv=require(_0xdfb7('0xc'));var querystring=require(_0xdfb7('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdfb7('0xe'));var qs=require(_0xdfb7('0xf'));var as=require(_0xdfb7('0x10'));var hardwareService=require(_0xdfb7('0x11'));var logger=require(_0xdfb7('0x12'))(_0xdfb7('0x13'));var utils=require('../../config/utils');var config=require(_0xdfb7('0x14'));var licenseUtil=require(_0xdfb7('0x15'));var db=require(_0xdfb7('0x16'))['db'];config['redis']=_[_0xdfb7('0x17')](config[_0xdfb7('0x18')],{'host':_0xdfb7('0x19'),'port':0x18eb});var socket=require(_0xdfb7('0x1a'))(new Redis(config[_0xdfb7('0x18')]));require(_0xdfb7('0x1b'))[_0xdfb7('0x1c')](socket);function respondWithStatusCode(_0x450283,_0x203eed){_0x203eed=_0x203eed||0xcc;return function(_0x40455d){if(_0x40455d){return _0x450283[_0xdfb7('0x1d')](_0x203eed);}return _0x450283['status'](_0x203eed)['end']();};}function respondWithResult(_0x324392,_0x373f52){_0x373f52=_0x373f52||0xc8;return function(_0x204f95){if(_0x204f95){return _0x324392['status'](_0x373f52)[_0xdfb7('0x1e')](_0x204f95);}};}function respondWithFilteredResult(_0x24fe65,_0x1b8561){return function(_0x384419){if(_0x384419){var _0x2601c6=_0x384419['count'],_0x1b560c=_0x1b8561['offset'],_0x3750c9=_0x1b8561[_0xdfb7('0x1f')]+_0x1b8561[_0xdfb7('0x20')],_0x24f5f5;if(_0x3750c9>=_0x2601c6){_0x3750c9=_0x2601c6;_0x24f5f5=0xc8;}else{_0x24f5f5=0xce;}_0x24fe65[_0xdfb7('0x21')](_0x24f5f5);return _0x24fe65[_0xdfb7('0x22')]('Content-Range',_0x1b560c+'-'+_0x3750c9+'/'+_0x2601c6)['json'](_0x384419);}return null;};}function patchUpdates(_0x230e6e){return function(_0x43d86b){try{jsonpatch[_0xdfb7('0x23')](_0x43d86b,_0x230e6e,!![]);}catch(_0x2ee359){return BPromise[_0xdfb7('0x24')](_0x2ee359);}return _0x43d86b['save']();};}function saveUpdates(_0x4875df,_0x282848){return function(_0x4558db){if(_0x4558db){return _0x4558db['update'](_0x4875df)[_0xdfb7('0x25')](function(_0x5f5ac3){return _0x5f5ac3;});}return null;};}function removeEntity(_0x3f556f,_0x451ff5){return function(_0xfdae4e){if(_0xfdae4e){return _0xfdae4e[_0xdfb7('0x26')]()[_0xdfb7('0x25')](function(){var _0x5ecdfa=_0xfdae4e[_0xdfb7('0x27')]({'plain':!![]});var _0x1410e0=_0xdfb7('0x28');return db[_0xdfb7('0x29')]['destroy']({'where':{'type':_0x1410e0,'resourceId':_0x5ecdfa['id']}})['then'](function(){return _0xfdae4e;});})[_0xdfb7('0x25')](function(){_0x3f556f[_0xdfb7('0x21')](0xcc)[_0xdfb7('0x2a')]();});}};}function handleEntityNotFound(_0x51978e,_0x5458c4){return function(_0x580f73){if(!_0x580f73){_0x51978e[_0xdfb7('0x1d')](0x194);}return _0x580f73;};}function handleError(_0x1461af,_0x4b375c){_0x4b375c=_0x4b375c||0x1f4;return function(_0xd90e8c){logger[_0xdfb7('0x2b')](_0xd90e8c['stack']);if(_0xd90e8c[_0xdfb7('0x2c')]){delete _0xd90e8c[_0xdfb7('0x2c')];}_0x1461af[_0xdfb7('0x21')](_0x4b375c)['send'](_0xd90e8c);};}exports['index']=function(_0x1d003c,_0x1c8112){var _0x4e955c={},_0x1531b1={},_0x4ff018={'count':0x0,'rows':[]};var _0x564cab=_[_0xdfb7('0x2d')](db[_0xdfb7('0x2e')][_0xdfb7('0x2f')],function(_0x581fb6){return{'name':_0x581fb6[_0xdfb7('0x30')],'type':_0x581fb6[_0xdfb7('0x31')][_0xdfb7('0x32')]};});_0x1531b1[_0xdfb7('0x33')]=_[_0xdfb7('0x2d')](_0x564cab,_0xdfb7('0x2c'));_0x1531b1[_0xdfb7('0x34')]=_[_0xdfb7('0x35')](_0x1d003c[_0xdfb7('0x34')]);_0x1531b1['filters']=_[_0xdfb7('0x36')](_0x1531b1[_0xdfb7('0x33')],_0x1531b1[_0xdfb7('0x34')]);_0x4e955c[_0xdfb7('0x37')]=_[_0xdfb7('0x36')](_0x1531b1[_0xdfb7('0x33')],qs[_0xdfb7('0x38')](_0x1d003c[_0xdfb7('0x34')][_0xdfb7('0x38')]));_0x4e955c[_0xdfb7('0x37')]=_0x4e955c['attributes'][_0xdfb7('0x39')]?_0x4e955c[_0xdfb7('0x37')]:_0x1531b1['model'];if(!_0x1d003c['query'][_0xdfb7('0x3a')](_0xdfb7('0x3b'))){_0x4e955c['limit']=qs[_0xdfb7('0x20')](_0x1d003c[_0xdfb7('0x34')][_0xdfb7('0x20')]);_0x4e955c['offset']=qs[_0xdfb7('0x1f')](_0x1d003c[_0xdfb7('0x34')]['offset']);}_0x4e955c[_0xdfb7('0x3c')]=qs[_0xdfb7('0x3d')](_0x1d003c['query']['sort']);_0x4e955c[_0xdfb7('0x3e')]=qs['filters'](_['pick'](_0x1d003c[_0xdfb7('0x34')],_0x1531b1['filters']),_0x564cab);if(_0x1d003c[_0xdfb7('0x34')][_0xdfb7('0x3f')]){_0x4e955c[_0xdfb7('0x3e')]=_[_0xdfb7('0x40')](_0x4e955c[_0xdfb7('0x3e')],{'$or':_[_0xdfb7('0x2d')](_0x564cab,function(_0x12cf00){if(_0x12cf00[_0xdfb7('0x31')]!==_0xdfb7('0x41')){var _0x5e4c3b={};_0x5e4c3b[_0x12cf00['name']]={'$like':'%'+_0x1d003c[_0xdfb7('0x34')][_0xdfb7('0x3f')]+'%'};return _0x5e4c3b;}})});}_0x4e955c=_['merge']({},_0x4e955c,_0x1d003c[_0xdfb7('0x42')]);var _0x2be16a={'where':_0x4e955c[_0xdfb7('0x3e')]};return db[_0xdfb7('0x2e')][_0xdfb7('0x43')](_0x2be16a)[_0xdfb7('0x25')](function(_0x296ba6){_0x4ff018[_0xdfb7('0x43')]=_0x296ba6;if(_0x1d003c['query']['includeAll']){_0x4e955c['include']=[{'all':!![]}];}return db[_0xdfb7('0x2e')][_0xdfb7('0x44')](_0x4e955c);})[_0xdfb7('0x25')](function(_0x2617bc){_0x4ff018['rows']=_0x2617bc;return _0x4ff018;})[_0xdfb7('0x25')](respondWithFilteredResult(_0x1c8112,_0x4e955c))[_0xdfb7('0x45')](handleError(_0x1c8112,null));};exports[_0xdfb7('0x46')]=function(_0x1779ad,_0x45c899){var _0x235faa={'raw':![],'where':{'id':_0x1779ad['params']['id']}},_0x284901={};_0x284901[_0xdfb7('0x33')]=_[_0xdfb7('0x35')](db[_0xdfb7('0x2e')][_0xdfb7('0x2f')]);_0x284901[_0xdfb7('0x34')]=_[_0xdfb7('0x35')](_0x1779ad['query']);_0x284901[_0xdfb7('0x47')]=_[_0xdfb7('0x36')](_0x284901[_0xdfb7('0x33')],_0x284901['query']);_0x235faa[_0xdfb7('0x37')]=_['intersection'](_0x284901[_0xdfb7('0x33')],qs[_0xdfb7('0x38')](_0x1779ad[_0xdfb7('0x34')][_0xdfb7('0x38')]));_0x235faa[_0xdfb7('0x37')]=_0x235faa[_0xdfb7('0x37')][_0xdfb7('0x39')]?_0x235faa[_0xdfb7('0x37')]:_0x284901[_0xdfb7('0x33')];if(_0x1779ad[_0xdfb7('0x34')][_0xdfb7('0x48')]){_0x235faa[_0xdfb7('0x49')]=[{'all':!![]}];}_0x235faa=_[_0xdfb7('0x40')]({},_0x235faa,_0x1779ad['options']);return db[_0xdfb7('0x2e')]['find'](_0x235faa)[_0xdfb7('0x25')](handleEntityNotFound(_0x45c899,null))[_0xdfb7('0x25')](respondWithResult(_0x45c899,null))[_0xdfb7('0x45')](handleError(_0x45c899,null));};exports[_0xdfb7('0x4a')]=function(_0x5ed50b,_0x30abd9){return db[_0xdfb7('0x2e')][_0xdfb7('0x4a')](_0x5ed50b[_0xdfb7('0x4b')],{})[_0xdfb7('0x25')](function(_0x128810){var _0x27db30=_0x5ed50b[_0xdfb7('0x4c')][_0xdfb7('0x27')]({'plain':!![]});if(!_0x27db30)throw new Error(_0xdfb7('0x4d'));if(_0x27db30[_0xdfb7('0x4e')]===_0xdfb7('0x4c')){var _0x2ff3e4=_0x128810[_0xdfb7('0x27')]({'plain':!![]});var _0x2e3fec=_0xdfb7('0x28');return db[_0xdfb7('0x4f')][_0xdfb7('0x50')]({'where':{'name':_0x2e3fec,'userProfileId':_0x27db30[_0xdfb7('0x51')]},'raw':!![]})[_0xdfb7('0x25')](function(_0x4401a4){if(_0x4401a4&&_0x4401a4['autoAssociation']===0x0){return db[_0xdfb7('0x29')][_0xdfb7('0x4a')]({'name':_0x2ff3e4['name'],'resourceId':_0x2ff3e4['id'],'type':_0x4401a4[_0xdfb7('0x2c')],'sectionId':_0x4401a4['id']},{})[_0xdfb7('0x25')](function(){return _0x128810;});}else{return _0x128810;}})[_0xdfb7('0x45')](function(_0x27cdd7){logger[_0xdfb7('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27cdd7);throw _0x27cdd7;});}return _0x128810;})['then'](respondWithResult(_0x30abd9,0xc9))[_0xdfb7('0x45')](handleError(_0x30abd9,null));};exports[_0xdfb7('0x52')]=function(_0x30d8d8,_0x446bf9){if(_0x30d8d8['body']['id']){delete _0x30d8d8[_0xdfb7('0x4b')]['id'];}return db[_0xdfb7('0x2e')][_0xdfb7('0x50')]({'where':{'id':_0x30d8d8[_0xdfb7('0x53')]['id']}})[_0xdfb7('0x25')](handleEntityNotFound(_0x446bf9,null))['then'](saveUpdates(_0x30d8d8[_0xdfb7('0x4b')],null))['then'](respondWithResult(_0x446bf9,null))['catch'](handleError(_0x446bf9,null));};exports[_0xdfb7('0x26')]=function(_0x408bf9,_0x3d0e93){return db['SquareProject']['find']({'where':{'id':_0x408bf9[_0xdfb7('0x53')]['id']}})[_0xdfb7('0x25')](handleEntityNotFound(_0x3d0e93,null))[_0xdfb7('0x25')](removeEntity(_0x3d0e93,null))[_0xdfb7('0x45')](handleError(_0x3d0e93,null));};exports[_0xdfb7('0x54')]=function(_0x474d63,_0x19744f,_0x1c8c77){return db[_0xdfb7('0x2e')][_0xdfb7('0x50')]({'where':{'id':_0x474d63[_0xdfb7('0x53')]['id']}})[_0xdfb7('0x25')](handleEntityNotFound(_0x19744f,null))['then'](function(_0x42b503){if(_0x42b503){return _0x42b503['addUsers'](_0x474d63['body'][_0xdfb7('0x55')],_[_0xdfb7('0x56')](_0x474d63[_0xdfb7('0x4b')],[_0xdfb7('0x55'),'id'])||{});}})[_0xdfb7('0x25')](respondWithResult(_0x19744f,null))[_0xdfb7('0x45')](handleError(_0x19744f,null));};exports[_0xdfb7('0x57')]=function(_0x2e9b67,_0x284be6,_0x51f140){return db[_0xdfb7('0x2e')]['find']({'where':{'id':_0x2e9b67[_0xdfb7('0x53')]['id']}})[_0xdfb7('0x25')](handleEntityNotFound(_0x284be6,null))['then'](function(_0x428aea){if(_0x428aea){return _0x428aea[_0xdfb7('0x57')](_0x2e9b67[_0xdfb7('0x34')][_0xdfb7('0x55')])[_0xdfb7('0x25')](function(){if(_[_0xdfb7('0x58')](_0x2e9b67[_0xdfb7('0x34')][_0xdfb7('0x55')])){for(var _0xf9b63b=0x0;_0xf9b63b<_0x2e9b67[_0xdfb7('0x34')][_0xdfb7('0x55')]['length'];_0xf9b63b+=0x1){socket[_0xdfb7('0x59')]('userSquareProject:remove',{'UserId':Number(_0x2e9b67['query'][_0xdfb7('0x55')][_0xf9b63b]),'SquareProjectId':Number(_0x2e9b67[_0xdfb7('0x53')]['id'])});}}else{socket[_0xdfb7('0x59')](_0xdfb7('0x5a'),{'UserId':Number(_0x2e9b67[_0xdfb7('0x34')][_0xdfb7('0x55')]),'SquareProjectId':Number(_0x2e9b67['params']['id'])});}});}})[_0xdfb7('0x25')](respondWithStatusCode(_0x284be6,null))[_0xdfb7('0x45')](handleError(_0x284be6,null));};exports[_0xdfb7('0x5b')]=function(_0x47bdb8,_0x56b418,_0x458e54){var _0x9c8314={};var _0xcf07da={};var _0x46ff9c;var _0x1aa3cc;return db[_0xdfb7('0x2e')][_0xdfb7('0x5c')]({'where':{'id':_0x47bdb8[_0xdfb7('0x53')]['id']}})[_0xdfb7('0x25')](handleEntityNotFound(_0x56b418,null))[_0xdfb7('0x25')](function(_0x2a29a2){if(_0x2a29a2){_0x46ff9c=_0x2a29a2;_0xcf07da[_0xdfb7('0x33')]=_[_0xdfb7('0x35')](db[_0xdfb7('0x5d')][_0xdfb7('0x2f')]);_0xcf07da[_0xdfb7('0x34')]=_[_0xdfb7('0x35')](_0x47bdb8[_0xdfb7('0x34')]);_0xcf07da['filters']=_[_0xdfb7('0x36')](_0xcf07da[_0xdfb7('0x33')],_0xcf07da[_0xdfb7('0x34')]);_0x9c8314[_0xdfb7('0x37')]=_['intersection'](_0xcf07da[_0xdfb7('0x33')],qs[_0xdfb7('0x38')](_0x47bdb8[_0xdfb7('0x34')][_0xdfb7('0x38')]));_0x9c8314[_0xdfb7('0x37')]=_0x9c8314[_0xdfb7('0x37')]['length']?_0x9c8314['attributes']:_0xcf07da[_0xdfb7('0x33')];_0x9c8314[_0xdfb7('0x3c')]=qs[_0xdfb7('0x3d')](_0x47bdb8['query'][_0xdfb7('0x3d')]);_0x9c8314[_0xdfb7('0x3e')]=qs['filters'](_['pick'](_0x47bdb8[_0xdfb7('0x34')],_0xcf07da[_0xdfb7('0x47')]));if(_0x47bdb8[_0xdfb7('0x34')][_0xdfb7('0x3f')]){_0x9c8314[_0xdfb7('0x3e')]=_[_0xdfb7('0x40')](_0x9c8314[_0xdfb7('0x3e')],{'$or':_[_0xdfb7('0x2d')](_0x9c8314[_0xdfb7('0x37')],function(_0x269b93){var _0x1dc6f8={};_0x1dc6f8[_0x269b93]={'$like':'%'+_0x47bdb8[_0xdfb7('0x34')][_0xdfb7('0x3f')]+'%'};return _0x1dc6f8;})});}_0x9c8314=_['merge']({},_0x9c8314,_0x47bdb8[_0xdfb7('0x42')]);return _0x46ff9c[_0xdfb7('0x5b')](_0x9c8314);}})['then'](function(_0x119cc4){if(_0x119cc4){_0x1aa3cc=_0x119cc4['length'];if(!_0x47bdb8[_0xdfb7('0x34')]['hasOwnProperty'](_0xdfb7('0x3b'))){_0x9c8314['limit']=qs['limit'](_0x47bdb8[_0xdfb7('0x34')][_0xdfb7('0x20')]);_0x9c8314[_0xdfb7('0x1f')]=qs[_0xdfb7('0x1f')](_0x47bdb8[_0xdfb7('0x34')][_0xdfb7('0x1f')]);}return _0x46ff9c['getUsers'](_0x9c8314);}})[_0xdfb7('0x25')](function(_0x530cd9){if(_0x530cd9){return _0x530cd9?{'count':_0x1aa3cc,'rows':_0x530cd9}:null;}})[_0xdfb7('0x25')](respondWithResult(_0x56b418,null))[_0xdfb7('0x45')](handleError(_0x56b418,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 2d5a73e..22eaa99 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 _0x4036=['events','../../mysqldb','SquareProject','setMaxListeners','update','remove','emit','exports'];(function(_0x48adbe,_0x532caa){var _0x2842fb=function(_0x4eff3c){while(--_0x4eff3c){_0x48adbe['push'](_0x48adbe['shift']());}};_0x2842fb(++_0x532caa);}(_0x4036,0x160));var _0x6403=function(_0x58d456,_0x2084e1){_0x58d456=_0x58d456-0x0;var _0x144336=_0x4036[_0x58d456];return _0x144336;};'use strict';var EventEmitter=require(_0x6403('0x0'));var SquareProject=require(_0x6403('0x1'))['db'][_0x6403('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6403('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6403('0x4'),'afterDestroy':_0x6403('0x5')};function emitEvent(_0x4e97d9){return function(_0x388159,_0xb1257d,_0x41a51e){SquareProjectEvents[_0x6403('0x6')](_0x4e97d9+':'+_0x388159['id'],_0x388159);SquareProjectEvents[_0x6403('0x6')](_0x4e97d9,_0x388159);_0x41a51e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x6403('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x3a42=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0xd62e75,_0x47c7e9){var _0x21c947=function(_0x1a8c56){while(--_0x1a8c56){_0xd62e75['push'](_0xd62e75['shift']());}};_0x21c947(++_0x47c7e9);}(_0x3a42,0x19c));var _0x23a4=function(_0x54fdf5,_0x227605){_0x54fdf5=_0x54fdf5-0x0;var _0x4999c5=_0x3a42[_0x54fdf5];return _0x4999c5;};'use strict';var EventEmitter=require(_0x23a4('0x0'));var SquareProject=require(_0x23a4('0x1'))['db'][_0x23a4('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x23a4('0x3')](0x0);var events={'afterCreate':_0x23a4('0x4'),'afterUpdate':_0x23a4('0x5'),'afterDestroy':_0x23a4('0x6')};function emitEvent(_0x57e566){return function(_0x319922,_0x585c8f,_0x498d18){SquareProjectEvents[_0x23a4('0x7')](_0x57e566+':'+_0x319922['id'],_0x319922);SquareProjectEvents['emit'](_0x57e566,_0x319922);_0x498d18(null);};}for(var e in events){if(events[_0x23a4('0x8')](e)){var event=events[e];SquareProject[_0x23a4('0x9')](e,emitEvent(event));}}module[_0x23a4('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index df8de83..1d8da66 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 _0xf842=['../../config/environment','exports','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4cbe98,_0x576f7b){var _0x49c755=function(_0x1e0487){while(--_0x1e0487){_0x4cbe98['push'](_0x4cbe98['shift']());}};_0x49c755(++_0x576f7b);}(_0xf842,0x172));var _0x2f84=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xf842[_0x382e89];return _0x3a1318;};'use strict';var _=require(_0x2f84('0x0'));var util=require(_0x2f84('0x1'));var logger=require(_0x2f84('0x2'))(_0x2f84('0x3'));var moment=require('moment');var BPromise=require(_0x2f84('0x4'));var rp=require(_0x2f84('0x5'));var fs=require('fs');var path=require(_0x2f84('0x6'));var rimraf=require(_0x2f84('0x7'));var config=require(_0x2f84('0x8'));var attributes=require('./squareProject.attributes');module[_0x2f84('0x9')]=function(_0x20e773,_0x88a4cb){return _0x20e773['define'](_0x2f84('0xa'),attributes,{'tableName':_0x2f84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3458a1,_0x319d1f,_0x186888){if(_0x3458a1[_0x2f84('0xc')](_0x2f84('0xd'))){_0x3458a1[_0x2f84('0xe')]=moment()[_0x2f84('0xf')](_0x2f84('0x10'));}if(_0x3458a1['changed'](_0x2f84('0x11'))){_0x3458a1['publishedAt']=moment()[_0x2f84('0xf')](_0x2f84('0x10'));}_0x186888(null,_0x3458a1);}}});}; \ No newline at end of file +var _0xd4d1=['YYYY-MM-DD\x20HH:mm:ss','production','format','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./squareProject.attributes','define','square_projects','changed','preproduction','savedAt'];(function(_0x4f03d7,_0x4fe0fd){var _0x4347c3=function(_0x39229b){while(--_0x39229b){_0x4f03d7['push'](_0x4f03d7['shift']());}};_0x4347c3(++_0x4fe0fd);}(_0xd4d1,0x123));var _0x1d4d=function(_0x418e50,_0x3b24b8){_0x418e50=_0x418e50-0x0;var _0x5907c8=_0xd4d1[_0x418e50];return _0x5907c8;};'use strict';var _=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var logger=require(_0x1d4d('0x2'))(_0x1d4d('0x3'));var moment=require(_0x1d4d('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d4d('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d4d('0x7'));module['exports']=function(_0x2bc295,_0x184978){return _0x2bc295[_0x1d4d('0x8')]('SquareProject',attributes,{'tableName':_0x1d4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x515887,_0x2415d7,_0x4dc910){if(_0x515887[_0x1d4d('0xa')](_0x1d4d('0xb'))){_0x515887[_0x1d4d('0xc')]=moment()['format'](_0x1d4d('0xd'));}if(_0x515887[_0x1d4d('0xa')](_0x1d4d('0xe'))){_0x515887['publishedAt']=moment()[_0x1d4d('0xf')](_0x1d4d('0xd'));}_0x4dc910(null,_0x515887);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a24f863..9f7efcc 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 _0x88b4=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareProject,\x20%s,\x20%s','catch','ShowSquareProject','SquareProject','find','options','raw','map','include','model','attributes','lodash'];(function(_0x274f14,_0x27dd7f){var _0x13b97e=function(_0x7d9432){while(--_0x7d9432){_0x274f14['push'](_0x274f14['shift']());}};_0x13b97e(++_0x27dd7f);}(_0x88b4,0x65));var _0x488b=function(_0x466e57,_0x21b819){_0x466e57=_0x466e57-0x0;var _0x34df42=_0x88b4[_0x466e57];return _0x34df42;};'use strict';var _=require(_0x488b('0x0'));var util=require('util');var moment=require(_0x488b('0x1'));var BPromise=require('bluebird');var rs=require(_0x488b('0x2'));var fs=require('fs');var Redis=require(_0x488b('0x3'));var db=require(_0x488b('0x4'))['db'];var utils=require(_0x488b('0x5'));var logger=require(_0x488b('0x6'))(_0x488b('0x7'));var config=require('../../config/environment');var jayson=require(_0x488b('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x488b('0x9')]=_['defaults'](config['redis'],{'host':_0x488b('0xa'),'port':0x18eb});var socket=require(_0x488b('0xb'))(new Redis(config['redis']));require('./squareProject.socket')[_0x488b('0xc')](socket);function respondWithRpcPromise(_0x2c99b2,_0x276756,_0x266004){return new BPromise(function(_0x32a161,_0x19a6fb){return client[_0x488b('0xd')](_0x2c99b2,_0x266004)[_0x488b('0xe')](function(_0x333d58){logger[_0x488b('0xf')]('SquareProject,\x20%s,\x20%s',_0x276756,_0x488b('0x10'));logger[_0x488b('0x11')](_0x488b('0x12'),_0x276756,'request\x20sent',JSON[_0x488b('0x13')](_0x333d58));if(_0x333d58[_0x488b('0x14')]){if(_0x333d58['error'][_0x488b('0x15')]===0x1f4){logger[_0x488b('0x14')]('SquareProject,\x20%s,\x20%s',_0x276756,_0x333d58[_0x488b('0x14')]['message']);return _0x19a6fb(_0x333d58[_0x488b('0x14')][_0x488b('0x16')]);}logger[_0x488b('0x14')](_0x488b('0x17'),_0x276756,_0x333d58[_0x488b('0x14')][_0x488b('0x16')]);return _0x32a161(_0x333d58[_0x488b('0x14')][_0x488b('0x16')]);}else{logger[_0x488b('0xf')](_0x488b('0x17'),_0x276756,_0x488b('0x10'));_0x32a161(_0x333d58['result']['message']);}})[_0x488b('0x18')](function(_0x2a8d70){logger[_0x488b('0x14')](_0x488b('0x17'),_0x276756,_0x2a8d70);_0x19a6fb(_0x2a8d70);});});}exports[_0x488b('0x19')]=function(_0x209685){var _0xa76ae2=this;return new Promise(function(_0x5c1a69,_0xd1f888){return db[_0x488b('0x1a')][_0x488b('0x1b')]({'raw':_0x209685['options']?_0x209685[_0x488b('0x1c')][_0x488b('0x1d')]===undefined?!![]:![]:!![],'where':_0x209685[_0x488b('0x1c')]?_0x209685[_0x488b('0x1c')]['where']||null:null,'attributes':_0x209685[_0x488b('0x1c')]?_0x209685['options']['attributes']||null:null,'include':_0x209685[_0x488b('0x1c')]?_0x209685[_0x488b('0x1c')]['include']?_[_0x488b('0x1e')](_0x209685[_0x488b('0x1c')][_0x488b('0x1f')],function(_0x5ef024){return{'model':db[_0x5ef024[_0x488b('0x20')]],'as':_0x5ef024['as'],'attributes':_0x5ef024[_0x488b('0x21')],'include':_0x5ef024[_0x488b('0x1f')]?_['map'](_0x5ef024[_0x488b('0x1f')],function(_0x36713c){return{'model':db[_0x36713c['model']],'as':_0x36713c['as'],'attributes':_0x36713c['attributes'],'include':_0x36713c[_0x488b('0x1f')]?_[_0x488b('0x1e')](_0x36713c[_0x488b('0x1f')],function(_0x1bbbf8){return{'model':db[_0x1bbbf8['model']],'as':_0x1bbbf8['as'],'attributes':_0x1bbbf8['attributes']};}):[]};}):[]};}):[]:[]})[_0x488b('0xe')](function(_0x5a01fe){logger[_0x488b('0xf')](_0x488b('0x19'),_0x209685);logger[_0x488b('0x11')](_0x488b('0x19'),_0x209685,JSON[_0x488b('0x13')](_0x5a01fe));_0x5c1a69(_0x5a01fe);})[_0x488b('0x18')](function(_0x1ad215){logger[_0x488b('0x14')](_0x488b('0x19'),_0x1ad215['message'],_0x209685);_0xd1f888(_0xa76ae2['error'](0x1f4,_0x1ad215['message']));});});}; \ No newline at end of file +var _0xe6eb=['SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','attributes','include','model','map','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','debug'];(function(_0x290e5d,_0x22d515){var _0x48aa22=function(_0x17cb55){while(--_0x17cb55){_0x290e5d['push'](_0x290e5d['shift']());}};_0x48aa22(++_0x22d515);}(_0xe6eb,0x19c));var _0xbe6e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe6eb[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xbe6e('0x0'));var moment=require('moment');var BPromise=require(_0xbe6e('0x1'));var rs=require(_0xbe6e('0x2'));var fs=require('fs');var Redis=require(_0xbe6e('0x3'));var db=require(_0xbe6e('0x4'))['db'];var utils=require(_0xbe6e('0x5'));var logger=require(_0xbe6e('0x6'))('rpc');var config=require(_0xbe6e('0x7'));var jayson=require(_0xbe6e('0x8'));var client=jayson['client'][_0xbe6e('0x9')]({'port':0x232a});config[_0xbe6e('0xa')]=_[_0xbe6e('0xb')](config[_0xbe6e('0xa')],{'host':_0xbe6e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbe6e('0xd'))[_0xbe6e('0xe')](socket);function respondWithRpcPromise(_0x1414fb,_0x3436e7,_0x167646){return new BPromise(function(_0x512426,_0x5dc86c){return client[_0xbe6e('0xf')](_0x1414fb,_0x167646)[_0xbe6e('0x10')](function(_0x40ac6d){logger[_0xbe6e('0x11')](_0xbe6e('0x12'),_0x3436e7,'request\x20sent');logger[_0xbe6e('0x13')](_0xbe6e('0x14'),_0x3436e7,_0xbe6e('0x15'),JSON[_0xbe6e('0x16')](_0x40ac6d));if(_0x40ac6d[_0xbe6e('0x17')]){if(_0x40ac6d[_0xbe6e('0x17')]['code']===0x1f4){logger[_0xbe6e('0x17')](_0xbe6e('0x12'),_0x3436e7,_0x40ac6d[_0xbe6e('0x17')]['message']);return _0x5dc86c(_0x40ac6d[_0xbe6e('0x17')][_0xbe6e('0x18')]);}logger['error'](_0xbe6e('0x12'),_0x3436e7,_0x40ac6d[_0xbe6e('0x17')][_0xbe6e('0x18')]);return _0x512426(_0x40ac6d[_0xbe6e('0x17')]['message']);}else{logger[_0xbe6e('0x11')](_0xbe6e('0x12'),_0x3436e7,'request\x20sent');_0x512426(_0x40ac6d[_0xbe6e('0x19')][_0xbe6e('0x18')]);}})[_0xbe6e('0x1a')](function(_0x11bd87){logger['error']('SquareProject,\x20%s,\x20%s',_0x3436e7,_0x11bd87);_0x5dc86c(_0x11bd87);});});}exports[_0xbe6e('0x1b')]=function(_0x5517be){var _0x4aac0b=this;return new Promise(function(_0x74bc83,_0x2e8a2d){return db[_0xbe6e('0x1c')][_0xbe6e('0x1d')]({'raw':_0x5517be[_0xbe6e('0x1e')]?_0x5517be[_0xbe6e('0x1e')][_0xbe6e('0x1f')]===undefined?!![]:![]:!![],'where':_0x5517be[_0xbe6e('0x1e')]?_0x5517be[_0xbe6e('0x1e')]['where']||null:null,'attributes':_0x5517be[_0xbe6e('0x1e')]?_0x5517be[_0xbe6e('0x1e')][_0xbe6e('0x20')]||null:null,'include':_0x5517be[_0xbe6e('0x1e')]?_0x5517be['options'][_0xbe6e('0x21')]?_['map'](_0x5517be[_0xbe6e('0x1e')][_0xbe6e('0x21')],function(_0x4d7644){return{'model':db[_0x4d7644[_0xbe6e('0x22')]],'as':_0x4d7644['as'],'attributes':_0x4d7644['attributes'],'include':_0x4d7644[_0xbe6e('0x21')]?_['map'](_0x4d7644[_0xbe6e('0x21')],function(_0xdce627){return{'model':db[_0xdce627['model']],'as':_0xdce627['as'],'attributes':_0xdce627[_0xbe6e('0x20')],'include':_0xdce627[_0xbe6e('0x21')]?_[_0xbe6e('0x23')](_0xdce627[_0xbe6e('0x21')],function(_0x84b602){return{'model':db[_0x84b602[_0xbe6e('0x22')]],'as':_0x84b602['as'],'attributes':_0x84b602['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe6e('0x10')](function(_0x2f4b02){logger[_0xbe6e('0x11')](_0xbe6e('0x1b'),_0x5517be);logger[_0xbe6e('0x13')]('ShowSquareProject',_0x5517be,JSON['stringify'](_0x2f4b02));_0x74bc83(_0x2f4b02);})[_0xbe6e('0x1a')](function(_0x40e8f8){logger[_0xbe6e('0x17')](_0xbe6e('0x1b'),_0x40e8f8[_0xbe6e('0x18')],_0x5517be);_0x2e8a2d(_0x4aac0b[_0xbe6e('0x17')](0x1f4,_0x40e8f8[_0xbe6e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index ca69563..dc95756 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 _0x7a54=['remove','emit','removeListener','register','length','squareProject:','./squareProject.events','save'];(function(_0xcd6a2d,_0x2f4dc7){var _0x48a76a=function(_0x309503){while(--_0x309503){_0xcd6a2d['push'](_0xcd6a2d['shift']());}};_0x48a76a(++_0x2f4dc7);}(_0x7a54,0x106));var _0x47a5=function(_0x182c9e,_0x812174){_0x182c9e=_0x182c9e-0x0;var _0x4c08d2=_0x7a54[_0x182c9e];return _0x4c08d2;};'use strict';var SquareProjectEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){SquareProjectEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);SquareProjectEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x430c=['register','length','squareProject:','./squareProject.events','update','removeListener'];(function(_0x2c8c24,_0x311d37){var _0x5ed00d=function(_0x2dbf10){while(--_0x2dbf10){_0x2c8c24['push'](_0x2c8c24['shift']());}};_0x5ed00d(++_0x311d37);}(_0x430c,0x1a1));var _0xc430=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x430c[_0x456a4b];return _0x42957c;};'use strict';var SquareProjectEvents=require(_0xc430('0x0'));var events=['save','remove',_0xc430('0x1')];function createListener(_0xe2d084,_0x1d5b5e){return function(_0x503988){_0x1d5b5e['emit'](_0xe2d084,_0x503988);};}function removeListener(_0x5ccda6,_0x47d8b9){return function(){SquareProjectEvents[_0xc430('0x2')](_0x5ccda6,_0x47d8b9);};}exports[_0xc430('0x3')]=function(_0x50b256){for(var _0x42aa9c=0x0,_0x4de44f=events[_0xc430('0x4')];_0x42aa9c<_0x4de44f;_0x42aa9c++){var _0x2e51c6=events[_0x42aa9c];var _0x814a90=createListener(_0xc430('0x5')+_0x2e51c6,_0x50b256);SquareProjectEvents['on'](_0x2e51c6,_0x814a90);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ec01830..b10493c 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 _0xaddb=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','delete','/:id/delete','destroy','exports','multer','util','path','express'];(function(_0x26939d,_0x308741){var _0x25639b=function(_0x50afa8){while(--_0x50afa8){_0x26939d['push'](_0x26939d['shift']());}};_0x25639b(++_0x308741);}(_0xaddb,0x10d));var _0xbadd=function(_0x50e3fa,_0x4f15ac){_0x50e3fa=_0x50e3fa-0x0;var _0x1f8c44=_0xaddb[_0x50e3fa];return _0x1f8c44;};'use strict';var multer=require(_0xbadd('0x0'));var util=require(_0xbadd('0x1'));var path=require(_0xbadd('0x2'));var timeout=require('connect-timeout');var express=require(_0xbadd('0x3'));var router=express[_0xbadd('0x4')]();var auth=require(_0xbadd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbadd('0x6'));router[_0xbadd('0x7')]('/',auth[_0xbadd('0x8')](),controller['index']);router['get'](_0xbadd('0x9'),auth['isAuthenticated'](),controller[_0xbadd('0xa')]);router[_0xbadd('0x7')](_0xbadd('0xb'),auth[_0xbadd('0x8')](),controller[_0xbadd('0xc')]);router[_0xbadd('0xd')]('/',auth[_0xbadd('0x8')](),controller[_0xbadd('0xe')]);router[_0xbadd('0xf')](_0xbadd('0x9'),auth[_0xbadd('0x8')](),controller[_0xbadd('0x10')]);router[_0xbadd('0x11')](_0xbadd('0x12'),auth[_0xbadd('0x8')](),controller[_0xbadd('0x13')]);module[_0xbadd('0x14')]=router; \ No newline at end of file +var _0x6ebb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2072e0,_0x5de94b){var _0x407607=function(_0x3b0b29){while(--_0x3b0b29){_0x2072e0['push'](_0x2072e0['shift']());}};_0x407607(++_0x5de94b);}(_0x6ebb,0x1ef));var _0xb6eb=function(_0x138ab0,_0x18f1fa){_0x138ab0=_0x138ab0-0x0;var _0x2f217f=_0x6ebb[_0x138ab0];return _0x2f217f;};'use strict';var multer=require(_0xb6eb('0x0'));var util=require(_0xb6eb('0x1'));var path=require(_0xb6eb('0x2'));var timeout=require(_0xb6eb('0x3'));var express=require(_0xb6eb('0x4'));var router=express[_0xb6eb('0x5')]();var auth=require(_0xb6eb('0x6'));var interaction=require(_0xb6eb('0x7'));var config=require(_0xb6eb('0x8'));var controller=require(_0xb6eb('0x9'));router['get']('/',auth[_0xb6eb('0xa')](),controller['index']);router[_0xb6eb('0xb')](_0xb6eb('0xc'),auth[_0xb6eb('0xa')](),controller[_0xb6eb('0xd')]);router[_0xb6eb('0xb')]('/:id/download',auth[_0xb6eb('0xa')](),controller['download']);router[_0xb6eb('0xe')]('/',auth[_0xb6eb('0xa')](),controller['create']);router[_0xb6eb('0xf')]('/:id',auth[_0xb6eb('0xa')](),controller[_0xb6eb('0x10')]);router[_0xb6eb('0x11')]('/:id/delete',auth[_0xb6eb('0xa')](),controller[_0xb6eb('0x12')]);module[_0xb6eb('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 5df3029..a8cc99f 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 _0xeb38=['savePath','substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xeb38,0x15b));var _0x8eb3=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xeb38[_0x5a9c0c];return _0x53c77d;};'use strict';var Sequelize=require(_0x8eb3('0x0'));module[_0x8eb3('0x1')]={'uniqueid':{'type':Sequelize[_0x8eb3('0x2')]},'callerid':{'type':Sequelize[_0x8eb3('0x2')]},'calleridname':{'type':Sequelize[_0x8eb3('0x2')]},'context':{'type':Sequelize[_0x8eb3('0x2')]},'extension':{'type':Sequelize[_0x8eb3('0x2')]},'priority':{'type':Sequelize[_0x8eb3('0x2')]},'accountcode':{'type':Sequelize[_0x8eb3('0x2')]},'dnid':{'type':Sequelize[_0x8eb3('0x2')]},'projectName':{'type':Sequelize[_0x8eb3('0x2')]},'saveName':{'type':Sequelize[_0x8eb3('0x2')]},'filename':{'type':Sequelize[_0x8eb3('0x2')]},'savePath':{'type':Sequelize[_0x8eb3('0x2')]},'format':{'type':Sequelize[_0x8eb3('0x3')],'get':function(){var _0x4a1836='';var _0x313341=this[_0x8eb3('0x4')](_0x8eb3('0x5'));if(_0x313341){_0x4a1836=_0x313341[_0x8eb3('0x6')](_0x313341[_0x8eb3('0x7')]('.'));}return _0x4a1836;}}}; \ No newline at end of file +var _0x5d44=['savePath','substring','lastIndexOf','sequelize','exports','STRING','getDataValue'];(function(_0x5fbeb0,_0x3eb180){var _0x502a3a=function(_0x4c66ef){while(--_0x4c66ef){_0x5fbeb0['push'](_0x5fbeb0['shift']());}};_0x502a3a(++_0x3eb180);}(_0x5d44,0x6c));var _0x45d4=function(_0x19c14a,_0x19f5d6){_0x19c14a=_0x19c14a-0x0;var _0x182b77=_0x5d44[_0x19c14a];return _0x182b77;};'use strict';var Sequelize=require(_0x45d4('0x0'));module[_0x45d4('0x1')]={'uniqueid':{'type':Sequelize[_0x45d4('0x2')]},'callerid':{'type':Sequelize[_0x45d4('0x2')]},'calleridname':{'type':Sequelize[_0x45d4('0x2')]},'context':{'type':Sequelize[_0x45d4('0x2')]},'extension':{'type':Sequelize[_0x45d4('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x45d4('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x45d4('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x41188d='';var _0x67b599=this[_0x45d4('0x3')](_0x45d4('0x4'));if(_0x67b599){_0x41188d=_0x67b599[_0x45d4('0x5')](_0x67b599[_0x45d4('0x6')]('.'));}return _0x41188d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index ed03c9f..76ca320 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 _0x94cc=['offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','map','SquareRecording','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','intersection','find','catch','create','body','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','recording','Sequelize','download','extname','unlink','message','SquareRecording\x20not\x20found','Entity\x20not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x94cc,0xf5));var _0xc94c=function(_0x1db6e8,_0x5ed53b){_0x1db6e8=_0x1db6e8-0x0;var _0x4b3269=_0x94cc[_0x1db6e8];return _0x4b3269;};'use strict';var pdf=require(_0xc94c('0x0'));var emlformat=require(_0xc94c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc94c('0x2'));var rp=require(_0xc94c('0x3'));var moment=require('moment');var BPromise=require(_0xc94c('0x4'));var Mustache=require('mustache');var util=require(_0xc94c('0x5'));var path=require('path');var sox=require(_0xc94c('0x6'));var csv=require(_0xc94c('0x7'));var ejs=require(_0xc94c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc94c('0x9'));var crypto=require(_0xc94c('0xa'));var jsforce=require(_0xc94c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc94c('0x7'));var querystring=require(_0xc94c('0xc'));var Papa=require(_0xc94c('0xd'));var Redis=require(_0xc94c('0xe'));var authService=require(_0xc94c('0xf'));var qs=require(_0xc94c('0x10'));var as=require(_0xc94c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc94c('0x12'))(_0xc94c('0x13'));var utils=require('../../config/utils');var config=require(_0xc94c('0x14'));var licenseUtil=require(_0xc94c('0x15'));var db=require(_0xc94c('0x16'))['db'];function respondWithStatusCode(_0x2e9e02,_0xd2f6dc){_0xd2f6dc=_0xd2f6dc||0xcc;return function(_0x49b45a){if(_0x49b45a){return _0x2e9e02[_0xc94c('0x17')](_0xd2f6dc);}return _0x2e9e02[_0xc94c('0x18')](_0xd2f6dc)[_0xc94c('0x19')]();};}function respondWithResult(_0x70ad29,_0x5b8f10){_0x5b8f10=_0x5b8f10||0xc8;return function(_0x484044){if(_0x484044){return _0x70ad29[_0xc94c('0x18')](_0x5b8f10)[_0xc94c('0x1a')](_0x484044);}};}function respondWithFilteredResult(_0x2c9e8f,_0x151704){return function(_0x50a416){if(_0x50a416){var _0x17abac=_0x50a416[_0xc94c('0x1b')],_0x84d47e=_0x151704[_0xc94c('0x1c')],_0x48e45a=_0x151704[_0xc94c('0x1c')]+_0x151704[_0xc94c('0x1d')],_0x21034d;if(_0x48e45a>=_0x17abac){_0x48e45a=_0x17abac;_0x21034d=0xc8;}else{_0x21034d=0xce;}_0x2c9e8f['status'](_0x21034d);return _0x2c9e8f[_0xc94c('0x1e')]('Content-Range',_0x84d47e+'-'+_0x48e45a+'/'+_0x17abac)[_0xc94c('0x1a')](_0x50a416);}return null;};}function patchUpdates(_0x21021c){return function(_0x461a1a){try{jsonpatch[_0xc94c('0x1f')](_0x461a1a,_0x21021c,!![]);}catch(_0xad9ff9){return BPromise[_0xc94c('0x20')](_0xad9ff9);}return _0x461a1a[_0xc94c('0x21')]();};}function saveUpdates(_0x1d0002,_0x408948){return function(_0x4becf0){if(_0x4becf0){return _0x4becf0[_0xc94c('0x22')](_0x1d0002)[_0xc94c('0x23')](function(_0x55e7c2){return _0x55e7c2;});}return null;};}function removeEntity(_0x579b66,_0x13550c){return function(_0x3e42c4){if(_0x3e42c4){return _0x3e42c4[_0xc94c('0x24')]()[_0xc94c('0x23')](function(){_0x579b66[_0xc94c('0x18')](0xcc)[_0xc94c('0x19')]();});}};}function handleEntityNotFound(_0x1c2e47,_0x158c99){return function(_0x44d1bb){if(!_0x44d1bb){_0x1c2e47[_0xc94c('0x17')](0x194);}return _0x44d1bb;};}function handleError(_0x3536a6,_0x4715e4){_0x4715e4=_0x4715e4||0x1f4;return function(_0x1a7003){logger[_0xc94c('0x25')](_0x1a7003['stack']);if(_0x1a7003[_0xc94c('0x26')]){delete _0x1a7003['name'];}_0x3536a6['status'](_0x4715e4)[_0xc94c('0x27')](_0x1a7003);};}exports['index']=function(_0x349659,_0x3ac6ca){var _0x493136={},_0x50ae39={},_0x109956={'count':0x0,'rows':[]};var _0x5e23af=_[_0xc94c('0x28')](db[_0xc94c('0x29')][_0xc94c('0x2a')],function(_0x454d87){return{'name':_0x454d87['fieldName'],'type':_0x454d87[_0xc94c('0x2b')][_0xc94c('0x2c')]};});_0x50ae39[_0xc94c('0x2d')]=_[_0xc94c('0x28')](_0x5e23af,_0xc94c('0x26'));_0x50ae39[_0xc94c('0x2e')]=_[_0xc94c('0x2f')](_0x349659[_0xc94c('0x2e')]);_0x50ae39[_0xc94c('0x30')]=_['intersection'](_0x50ae39[_0xc94c('0x2d')],_0x50ae39[_0xc94c('0x2e')]);_0x493136[_0xc94c('0x31')]=_['intersection'](_0x50ae39['model'],qs['fields'](_0x349659[_0xc94c('0x2e')][_0xc94c('0x32')]));_0x493136[_0xc94c('0x31')]=_0x493136['attributes'][_0xc94c('0x33')]?_0x493136[_0xc94c('0x31')]:_0x50ae39['model'];if(!_0x349659[_0xc94c('0x2e')][_0xc94c('0x34')]('nolimit')){_0x493136[_0xc94c('0x1d')]=qs['limit'](_0x349659[_0xc94c('0x2e')][_0xc94c('0x1d')]);_0x493136[_0xc94c('0x1c')]=qs[_0xc94c('0x1c')](_0x349659['query'][_0xc94c('0x1c')]);}_0x493136[_0xc94c('0x35')]=qs[_0xc94c('0x36')](_0x349659['query'][_0xc94c('0x36')]);_0x493136[_0xc94c('0x37')]=qs[_0xc94c('0x30')](_[_0xc94c('0x38')](_0x349659[_0xc94c('0x2e')],_0x50ae39[_0xc94c('0x30')]),_0x5e23af);if(_0x349659[_0xc94c('0x2e')][_0xc94c('0x39')]){_0x493136[_0xc94c('0x37')]=_[_0xc94c('0x3a')](_0x493136[_0xc94c('0x37')],{'$or':_[_0xc94c('0x28')](_0x5e23af,function(_0x46b6b4){if(_0x46b6b4['type']!==_0xc94c('0x3b')){var _0x2ceb58={};_0x2ceb58[_0x46b6b4[_0xc94c('0x26')]]={'$like':'%'+_0x349659[_0xc94c('0x2e')][_0xc94c('0x39')]+'%'};return _0x2ceb58;}})});}_0x493136=_[_0xc94c('0x3a')]({},_0x493136,_0x349659[_0xc94c('0x3c')]);var _0x55b920={'where':_0x493136['where']};return db['SquareRecording'][_0xc94c('0x1b')](_0x55b920)[_0xc94c('0x23')](function(_0x5a6c30){_0x109956['count']=_0x5a6c30;if(_0x349659['query'][_0xc94c('0x3d')]){_0x493136[_0xc94c('0x3e')]=[{'all':!![]}];}return db[_0xc94c('0x29')]['findAll'](_0x493136);})[_0xc94c('0x23')](function(_0x4e6634){_0x109956[_0xc94c('0x3f')]=_0x4e6634;return _0x109956;})['then'](respondWithFilteredResult(_0x3ac6ca,_0x493136))['catch'](handleError(_0x3ac6ca,null));};exports[_0xc94c('0x40')]=function(_0x3ea526,_0x350557){var _0x58fce0={'raw':!![],'where':{'id':_0x3ea526[_0xc94c('0x41')]['id']}},_0x5a3e64={};_0x5a3e64[_0xc94c('0x2d')]=_['keys'](db[_0xc94c('0x29')][_0xc94c('0x2a')]);_0x5a3e64[_0xc94c('0x2e')]=_['keys'](_0x3ea526[_0xc94c('0x2e')]);_0x5a3e64[_0xc94c('0x30')]=_[_0xc94c('0x42')](_0x5a3e64[_0xc94c('0x2d')],_0x5a3e64[_0xc94c('0x2e')]);_0x58fce0[_0xc94c('0x31')]=_[_0xc94c('0x42')](_0x5a3e64['model'],qs[_0xc94c('0x32')](_0x3ea526[_0xc94c('0x2e')][_0xc94c('0x32')]));_0x58fce0['attributes']=_0x58fce0[_0xc94c('0x31')]['length']?_0x58fce0['attributes']:_0x5a3e64[_0xc94c('0x2d')];if(_0x3ea526[_0xc94c('0x2e')][_0xc94c('0x3d')]){_0x58fce0['include']=[{'all':!![]}];}_0x58fce0=_[_0xc94c('0x3a')]({},_0x58fce0,_0x3ea526[_0xc94c('0x3c')]);return db[_0xc94c('0x29')][_0xc94c('0x43')](_0x58fce0)[_0xc94c('0x23')](handleEntityNotFound(_0x350557,null))[_0xc94c('0x23')](respondWithResult(_0x350557,null))[_0xc94c('0x44')](handleError(_0x350557,null));};exports['create']=function(_0x2bb77d,_0x4ea9e7){return db[_0xc94c('0x29')][_0xc94c('0x45')](_0x2bb77d['body'],{})[_0xc94c('0x23')](respondWithResult(_0x4ea9e7,0xc9))['catch'](handleError(_0x4ea9e7,null));};exports[_0xc94c('0x22')]=function(_0x49dd6a,_0x183cec){if(_0x49dd6a[_0xc94c('0x46')]['id']){delete _0x49dd6a[_0xc94c('0x46')]['id'];}return db[_0xc94c('0x29')][_0xc94c('0x43')]({'where':{'id':_0x49dd6a[_0xc94c('0x41')]['id']}})[_0xc94c('0x23')](handleEntityNotFound(_0x183cec,null))['then'](saveUpdates(_0x49dd6a[_0xc94c('0x46')],null))[_0xc94c('0x23')](respondWithResult(_0x183cec,null))['catch'](handleError(_0x183cec,null));};exports['download']=function(_0x202bf2,_0x3b327f,_0x144d2f){var _0x4161a2=require(_0xc94c('0x47'));var _0x390d65=![];var _0x454237={};if(_0x202bf2['query']['type']&&_0x202bf2[_0xc94c('0x2e')][_0xc94c('0x2b')]===_0xc94c('0x48')){_0x454237['uniqueid']=_0x202bf2['params']['id'];}else{_0x454237['id']=_0x202bf2['params']['id'];}return db['SquareRecording'][_0xc94c('0x43')]({'where':_0x454237,'attributes':['id',_0xc94c('0x49'),_0xc94c('0x4a')],'raw':!![]})[_0xc94c('0x23')](handleEntityNotFound(_0x3b327f,null))[_0xc94c('0x23')](function(_0x1be87d){if(_0x1be87d){var _0x3c3da4=_0x1be87d[_0xc94c('0x49')];var _0x501dc8=util[_0xc94c('0x4b')]('%s.cypher',_0x3c3da4);if(fs[_0xc94c('0x4c')](_0x501dc8)){_0x390d65=!![];return _0x4161a2[_0xc94c('0x4d')](_0x501dc8,_0x3c3da4,config['secrets'][_0xc94c('0x4e')])[_0xc94c('0x23')](function(){return _0x1be87d;});}return _0x1be87d;}})['then'](function(_0x235a07){if(_0x235a07){var _0x1b4c7e=_0x235a07[_0xc94c('0x49')];if(!fs[_0xc94c('0x4c')](_0x1b4c7e)){throw new db[(_0xc94c('0x4f'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x235a07[_0xc94c('0x4a')]){return _0x3b327f[_0xc94c('0x50')](_0x1b4c7e,_0x235a07[_0xc94c('0x4a')]+path[_0xc94c('0x51')](_0x1b4c7e),function(){if(_0x390d65){fs[_0xc94c('0x52')](_0x1b4c7e);}});}else{return _0x3b327f[_0xc94c('0x50')](_0x1b4c7e,function(_0x192967){if(_0x390d65){fs[_0xc94c('0x52')](_0x1b4c7e);}});}}})[_0xc94c('0x44')](function(_0x2b8af4){if(_0x2b8af4[_0xc94c('0x53')]===_0xc94c('0x54')){_0x3b327f['status'](0x194)[_0xc94c('0x27')]('Not\x20found');}else{return handleError(_0x3b327f,null);}});};exports[_0xc94c('0x24')]=function(_0x4fcb7e,_0x33ce76){return db[_0xc94c('0x29')]['find']({'where':{'id':_0x4fcb7e['params']['id']}})['then'](function(_0x15e185){if(!_0x15e185)throw new ReferenceError(_0xc94c('0x55'));return _0x15e185;})[_0xc94c('0x23')](function(_0x141916){var _0x79a54e=_0x141916['savePath'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x79a54e);if(!_[_0xc94c('0x56')](_0x141916['savePath'])&&fs[_0xc94c('0x4c')](_0x79a54e)){logger[_0xc94c('0x57')](_0xc94c('0x58')+_0x79a54e+_0xc94c('0x59'));fs[_0xc94c('0x5a')](_0x79a54e);}_0x79a54e=_0x79a54e+'.cypher';if(!_['isNil'](_0x141916['savePath'])&&fs[_0xc94c('0x4c')](_0x79a54e)){logger['info'](_0xc94c('0x58')+_0x79a54e+_0xc94c('0x59'));fs[_0xc94c('0x5a')](_0x79a54e);}return _0x141916;})[_0xc94c('0x23')](function(_0x582c75){if(!_0x582c75)throw new InternalError();return _0x582c75['destroy']();})[_0xc94c('0x23')](function(){_0x33ce76[_0xc94c('0x18')](0xcc)[_0xc94c('0x19')]();})[_0xc94c('0x44')](handleError(_0x33ce76,null));}; \ No newline at end of file +var _0x7b59=['decryptFile','recording','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','destroy','isNil','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','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','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','count','findAll','rows','catch','show','params','includeAll','include','find','create','body','uniqueid','savePath','filename','format','%s.cypher','existsSync'];(function(_0x111692,_0x19f8a9){var _0x11836f=function(_0x2f2714){while(--_0x2f2714){_0x111692['push'](_0x111692['shift']());}};_0x11836f(++_0x19f8a9);}(_0x7b59,0x1ef));var _0x97b5=function(_0x2f3dbe,_0x2f0c6d){_0x2f3dbe=_0x2f3dbe-0x0;var _0x3fb0df=_0x7b59[_0x2f3dbe];return _0x3fb0df;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x97b5('0x0'));var rimraf=require(_0x97b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x97b5('0x2'));var rp=require(_0x97b5('0x3'));var moment=require('moment');var BPromise=require(_0x97b5('0x4'));var Mustache=require(_0x97b5('0x5'));var util=require(_0x97b5('0x6'));var path=require(_0x97b5('0x7'));var sox=require(_0x97b5('0x8'));var csv=require('to-csv');var ejs=require(_0x97b5('0x9'));var fs=require('fs');var _=require(_0x97b5('0xa'));var squel=require(_0x97b5('0xb'));var crypto=require(_0x97b5('0xc'));var jsforce=require(_0x97b5('0xd'));var deskjs=require(_0x97b5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x97b5('0xf'));var Papa=require(_0x97b5('0x10'));var Redis=require(_0x97b5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x97b5('0x12'));var as=require(_0x97b5('0x13'));var hardwareService=require(_0x97b5('0x14'));var logger=require(_0x97b5('0x15'))(_0x97b5('0x16'));var utils=require(_0x97b5('0x17'));var config=require(_0x97b5('0x18'));var licenseUtil=require(_0x97b5('0x19'));var db=require(_0x97b5('0x1a'))['db'];function respondWithStatusCode(_0x3d4601,_0x53bc32){_0x53bc32=_0x53bc32||0xcc;return function(_0x176956){if(_0x176956){return _0x3d4601[_0x97b5('0x1b')](_0x53bc32);}return _0x3d4601[_0x97b5('0x1c')](_0x53bc32)[_0x97b5('0x1d')]();};}function respondWithResult(_0x287a5d,_0x50b5d9){_0x50b5d9=_0x50b5d9||0xc8;return function(_0x41db1c){if(_0x41db1c){return _0x287a5d[_0x97b5('0x1c')](_0x50b5d9)[_0x97b5('0x1e')](_0x41db1c);}};}function respondWithFilteredResult(_0x5d69a4,_0x477b89){return function(_0x55fad4){if(_0x55fad4){var _0x16074e=_0x55fad4['count'],_0x554cf0=_0x477b89[_0x97b5('0x1f')],_0x76b69a=_0x477b89[_0x97b5('0x1f')]+_0x477b89[_0x97b5('0x20')],_0x34c865;if(_0x76b69a>=_0x16074e){_0x76b69a=_0x16074e;_0x34c865=0xc8;}else{_0x34c865=0xce;}_0x5d69a4[_0x97b5('0x1c')](_0x34c865);return _0x5d69a4['set'](_0x97b5('0x21'),_0x554cf0+'-'+_0x76b69a+'/'+_0x16074e)['json'](_0x55fad4);}return null;};}function patchUpdates(_0x21b10b){return function(_0xb70949){try{jsonpatch[_0x97b5('0x22')](_0xb70949,_0x21b10b,!![]);}catch(_0x2a97cb){return BPromise[_0x97b5('0x23')](_0x2a97cb);}return _0xb70949[_0x97b5('0x24')]();};}function saveUpdates(_0x351fde,_0x45e7c0){return function(_0x13d702){if(_0x13d702){return _0x13d702[_0x97b5('0x25')](_0x351fde)[_0x97b5('0x26')](function(_0x286e79){return _0x286e79;});}return null;};}function removeEntity(_0x33133e,_0x41e7f1){return function(_0x511e3e){if(_0x511e3e){return _0x511e3e['destroy']()['then'](function(){_0x33133e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50e834,_0x11ae8f){return function(_0x176d5a){if(!_0x176d5a){_0x50e834['sendStatus'](0x194);}return _0x176d5a;};}function handleError(_0x117740,_0x24f0ba){_0x24f0ba=_0x24f0ba||0x1f4;return function(_0x16514c){logger['error'](_0x16514c['stack']);if(_0x16514c[_0x97b5('0x27')]){delete _0x16514c[_0x97b5('0x27')];}_0x117740[_0x97b5('0x1c')](_0x24f0ba)[_0x97b5('0x28')](_0x16514c);};}exports[_0x97b5('0x29')]=function(_0x21a5f0,_0xc3a78a){var _0x34bdb5={},_0x4c1645={},_0x3588e0={'count':0x0,'rows':[]};var _0x10c664=_[_0x97b5('0x2a')](db[_0x97b5('0x2b')][_0x97b5('0x2c')],function(_0x3bc689){return{'name':_0x3bc689[_0x97b5('0x2d')],'type':_0x3bc689[_0x97b5('0x2e')][_0x97b5('0x2f')]};});_0x4c1645['model']=_[_0x97b5('0x2a')](_0x10c664,_0x97b5('0x27'));_0x4c1645['query']=_[_0x97b5('0x30')](_0x21a5f0[_0x97b5('0x31')]);_0x4c1645[_0x97b5('0x32')]=_[_0x97b5('0x33')](_0x4c1645[_0x97b5('0x34')],_0x4c1645[_0x97b5('0x31')]);_0x34bdb5[_0x97b5('0x35')]=_[_0x97b5('0x33')](_0x4c1645[_0x97b5('0x34')],qs[_0x97b5('0x36')](_0x21a5f0['query'][_0x97b5('0x36')]));_0x34bdb5[_0x97b5('0x35')]=_0x34bdb5[_0x97b5('0x35')][_0x97b5('0x37')]?_0x34bdb5[_0x97b5('0x35')]:_0x4c1645[_0x97b5('0x34')];if(!_0x21a5f0[_0x97b5('0x31')][_0x97b5('0x38')](_0x97b5('0x39'))){_0x34bdb5[_0x97b5('0x20')]=qs[_0x97b5('0x20')](_0x21a5f0[_0x97b5('0x31')]['limit']);_0x34bdb5['offset']=qs['offset'](_0x21a5f0[_0x97b5('0x31')][_0x97b5('0x1f')]);}_0x34bdb5['order']=qs[_0x97b5('0x3a')](_0x21a5f0['query'][_0x97b5('0x3a')]);_0x34bdb5[_0x97b5('0x3b')]=qs['filters'](_[_0x97b5('0x3c')](_0x21a5f0[_0x97b5('0x31')],_0x4c1645[_0x97b5('0x32')]),_0x10c664);if(_0x21a5f0[_0x97b5('0x31')][_0x97b5('0x3d')]){_0x34bdb5['where']=_['merge'](_0x34bdb5[_0x97b5('0x3b')],{'$or':_['map'](_0x10c664,function(_0x492c89){if(_0x492c89[_0x97b5('0x2e')]!=='VIRTUAL'){var _0x59c2b1={};_0x59c2b1[_0x492c89['name']]={'$like':'%'+_0x21a5f0[_0x97b5('0x31')][_0x97b5('0x3d')]+'%'};return _0x59c2b1;}})});}_0x34bdb5=_[_0x97b5('0x3e')]({},_0x34bdb5,_0x21a5f0[_0x97b5('0x3f')]);var _0x196b8b={'where':_0x34bdb5['where']};return db['SquareRecording'][_0x97b5('0x40')](_0x196b8b)[_0x97b5('0x26')](function(_0x2cc963){_0x3588e0[_0x97b5('0x40')]=_0x2cc963;if(_0x21a5f0['query']['includeAll']){_0x34bdb5['include']=[{'all':!![]}];}return db[_0x97b5('0x2b')][_0x97b5('0x41')](_0x34bdb5);})[_0x97b5('0x26')](function(_0x1b8658){_0x3588e0[_0x97b5('0x42')]=_0x1b8658;return _0x3588e0;})[_0x97b5('0x26')](respondWithFilteredResult(_0xc3a78a,_0x34bdb5))[_0x97b5('0x43')](handleError(_0xc3a78a,null));};exports[_0x97b5('0x44')]=function(_0x5b35f9,_0x671818){var _0x2a6233={'raw':!![],'where':{'id':_0x5b35f9[_0x97b5('0x45')]['id']}},_0x3f2f2a={};_0x3f2f2a[_0x97b5('0x34')]=_['keys'](db[_0x97b5('0x2b')][_0x97b5('0x2c')]);_0x3f2f2a['query']=_[_0x97b5('0x30')](_0x5b35f9['query']);_0x3f2f2a['filters']=_[_0x97b5('0x33')](_0x3f2f2a[_0x97b5('0x34')],_0x3f2f2a[_0x97b5('0x31')]);_0x2a6233['attributes']=_[_0x97b5('0x33')](_0x3f2f2a[_0x97b5('0x34')],qs[_0x97b5('0x36')](_0x5b35f9[_0x97b5('0x31')][_0x97b5('0x36')]));_0x2a6233[_0x97b5('0x35')]=_0x2a6233[_0x97b5('0x35')][_0x97b5('0x37')]?_0x2a6233[_0x97b5('0x35')]:_0x3f2f2a[_0x97b5('0x34')];if(_0x5b35f9['query'][_0x97b5('0x46')]){_0x2a6233[_0x97b5('0x47')]=[{'all':!![]}];}_0x2a6233=_['merge']({},_0x2a6233,_0x5b35f9[_0x97b5('0x3f')]);return db['SquareRecording'][_0x97b5('0x48')](_0x2a6233)[_0x97b5('0x26')](handleEntityNotFound(_0x671818,null))['then'](respondWithResult(_0x671818,null))['catch'](handleError(_0x671818,null));};exports['create']=function(_0xd31625,_0x5a1f0f){return db[_0x97b5('0x2b')][_0x97b5('0x49')](_0xd31625[_0x97b5('0x4a')],{})[_0x97b5('0x26')](respondWithResult(_0x5a1f0f,0xc9))[_0x97b5('0x43')](handleError(_0x5a1f0f,null));};exports[_0x97b5('0x25')]=function(_0x112c38,_0x59a667){if(_0x112c38[_0x97b5('0x4a')]['id']){delete _0x112c38['body']['id'];}return db[_0x97b5('0x2b')][_0x97b5('0x48')]({'where':{'id':_0x112c38['params']['id']}})[_0x97b5('0x26')](handleEntityNotFound(_0x59a667,null))[_0x97b5('0x26')](saveUpdates(_0x112c38[_0x97b5('0x4a')],null))[_0x97b5('0x26')](respondWithResult(_0x59a667,null))['catch'](handleError(_0x59a667,null));};exports['download']=function(_0x5d15d1,_0x1a7f99,_0x54371f){var _0x20bee6=require('../../components/encryptor');var _0x5183b6=![];var _0x2b8154={};if(_0x5d15d1['query'][_0x97b5('0x2e')]&&_0x5d15d1['query']['type']==='uniqueid'){_0x2b8154[_0x97b5('0x4b')]=_0x5d15d1[_0x97b5('0x45')]['id'];}else{_0x2b8154['id']=_0x5d15d1['params']['id'];}return db[_0x97b5('0x2b')]['find']({'where':_0x2b8154,'attributes':['id',_0x97b5('0x4c'),_0x97b5('0x4d')],'raw':!![]})[_0x97b5('0x26')](handleEntityNotFound(_0x1a7f99,null))[_0x97b5('0x26')](function(_0x3856f2){if(_0x3856f2){var _0x2ee427=_0x3856f2[_0x97b5('0x4c')];var _0x8274de=util[_0x97b5('0x4e')](_0x97b5('0x4f'),_0x2ee427);if(fs[_0x97b5('0x50')](_0x8274de)){_0x5183b6=!![];return _0x20bee6[_0x97b5('0x51')](_0x8274de,_0x2ee427,config['secrets'][_0x97b5('0x52')])[_0x97b5('0x26')](function(){return _0x3856f2;});}return _0x3856f2;}})[_0x97b5('0x26')](function(_0x3c1044){if(_0x3c1044){var _0x4f7db9=_0x3c1044[_0x97b5('0x4c')];if(!fs['existsSync'](_0x4f7db9)){throw new db['Sequelize'][(_0x97b5('0x53'))](_0x97b5('0x54'));}if(_0x3c1044[_0x97b5('0x4d')]){return _0x1a7f99[_0x97b5('0x55')](_0x4f7db9,_0x3c1044[_0x97b5('0x4d')]+path[_0x97b5('0x56')](_0x4f7db9),function(){if(_0x5183b6){fs['unlink'](_0x4f7db9);}});}else{return _0x1a7f99['download'](_0x4f7db9,function(_0x4a1ccb){if(_0x5183b6){fs[_0x97b5('0x57')](_0x4f7db9);}});}}})[_0x97b5('0x43')](function(_0x4121d1){if(_0x4121d1[_0x97b5('0x58')]===_0x97b5('0x54')){_0x1a7f99[_0x97b5('0x1c')](0x194)[_0x97b5('0x28')](_0x97b5('0x59'));}else{return handleError(_0x1a7f99,null);}});};exports[_0x97b5('0x5a')]=function(_0x1e7bf8,_0xbc6309){return db[_0x97b5('0x2b')][_0x97b5('0x48')]({'where':{'id':_0x1e7bf8[_0x97b5('0x45')]['id']}})[_0x97b5('0x26')](function(_0x103d2e){if(!_0x103d2e)throw new ReferenceError('Entity\x20not\x20found');return _0x103d2e;})['then'](function(_0xd4126c){var _0x1892a4=_0xd4126c[_0x97b5('0x4c')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x1892a4);if(!_[_0x97b5('0x5b')](_0xd4126c['savePath'])&&fs[_0x97b5('0x50')](_0x1892a4)){logger[_0x97b5('0x5c')](_0x97b5('0x5d')+_0x1892a4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x97b5('0x5e')](_0x1892a4);}_0x1892a4=_0x1892a4+'.cypher';if(!_[_0x97b5('0x5b')](_0xd4126c[_0x97b5('0x4c')])&&fs[_0x97b5('0x50')](_0x1892a4)){logger['info'](_0x97b5('0x5d')+_0x1892a4+_0x97b5('0x5f'));fs['unlinkSync'](_0x1892a4);}return _0xd4126c;})[_0x97b5('0x26')](function(_0x55111b){if(!_0x55111b)throw new InternalError();return _0x55111b[_0x97b5('0x5a')]();})[_0x97b5('0x26')](function(){_0xbc6309['status'](0xcc)['end']();})[_0x97b5('0x43')](handleError(_0xbc6309,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index d156dc7..800ac76 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 _0xf846=['SquareRecording','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareRecording.attributes','exports','define'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xf846,0x85));var _0x6f84=function(_0x2160ad,_0x2def38){_0x2160ad=_0x2160ad-0x0;var _0x37cf2b=_0xf846[_0x2160ad];return _0x37cf2b;};'use strict';var _=require(_0x6f84('0x0'));var util=require(_0x6f84('0x1'));var logger=require(_0x6f84('0x2'))(_0x6f84('0x3'));var moment=require('moment');var BPromise=require(_0x6f84('0x4'));var rp=require(_0x6f84('0x5'));var fs=require('fs');var path=require(_0x6f84('0x6'));var rimraf=require(_0x6f84('0x7'));var config=require('../../config/environment');var attributes=require(_0x6f84('0x8'));module[_0x6f84('0x9')]=function(_0x2963cd,_0x25e3c2){return _0x2963cd[_0x6f84('0xa')](_0x6f84('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba37=['SquareRecording','square_recordings','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x565625,_0x3fcb2c){var _0x260f6b=function(_0x453486){while(--_0x453486){_0x565625['push'](_0x565625['shift']());}};_0x260f6b(++_0x3fcb2c);}(_0xba37,0xb6));var _0x7ba3=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xba37[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x7ba3('0x0'));var util=require('util');var logger=require(_0x7ba3('0x1'))('api');var moment=require(_0x7ba3('0x2'));var BPromise=require('bluebird');var rp=require(_0x7ba3('0x3'));var fs=require('fs');var path=require(_0x7ba3('0x4'));var rimraf=require(_0x7ba3('0x5'));var config=require(_0x7ba3('0x6'));var attributes=require(_0x7ba3('0x7'));module['exports']=function(_0x401c33,_0x47b38c){return _0x401c33['define'](_0x7ba3('0x8'),attributes,{'tableName':_0x7ba3('0x9'),'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 40a94e4..9761f64 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 _0xf79d=['catch','CreateSquareRecording','create','body','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1929c8,_0x3eb19f){var _0x3076ad=function(_0x14c5af){while(--_0x14c5af){_0x1929c8['push'](_0x1929c8['shift']());}};_0x3076ad(++_0x3eb19f);}(_0xf79d,0x1e2));var _0xdf79=function(_0x48be7b,_0x382db7){_0x48be7b=_0x48be7b-0x0;var _0x2eb316=_0xf79d[_0x48be7b];return _0x2eb316;};'use strict';var _=require(_0xdf79('0x0'));var util=require(_0xdf79('0x1'));var moment=require('moment');var BPromise=require(_0xdf79('0x2'));var rs=require(_0xdf79('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf79('0x4'))['db'];var utils=require(_0xdf79('0x5'));var logger=require(_0xdf79('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdf79('0x7'));var client=jayson[_0xdf79('0x8')][_0xdf79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c683c,_0x2d2130,_0x49d0cc){return new BPromise(function(_0x1137e4,_0x110b81){return client[_0xdf79('0xa')](_0x5c683c,_0x49d0cc)[_0xdf79('0xb')](function(_0x2ac2e2){logger[_0xdf79('0xc')](_0xdf79('0xd'),_0x2d2130,_0xdf79('0xe'));logger[_0xdf79('0xf')](_0xdf79('0x10'),_0x2d2130,_0xdf79('0xe'),JSON[_0xdf79('0x11')](_0x2ac2e2));if(_0x2ac2e2[_0xdf79('0x12')]){if(_0x2ac2e2[_0xdf79('0x12')][_0xdf79('0x13')]===0x1f4){logger[_0xdf79('0x12')](_0xdf79('0xd'),_0x2d2130,_0x2ac2e2[_0xdf79('0x12')][_0xdf79('0x14')]);return _0x110b81(_0x2ac2e2[_0xdf79('0x12')][_0xdf79('0x14')]);}logger[_0xdf79('0x12')](_0xdf79('0xd'),_0x2d2130,_0x2ac2e2[_0xdf79('0x12')][_0xdf79('0x14')]);return _0x1137e4(_0x2ac2e2[_0xdf79('0x12')][_0xdf79('0x14')]);}else{logger[_0xdf79('0xc')]('SquareRecording,\x20%s,\x20%s',_0x2d2130,_0xdf79('0xe'));_0x1137e4(_0x2ac2e2[_0xdf79('0x15')]['message']);}})[_0xdf79('0x16')](function(_0x2eced6){logger[_0xdf79('0x12')](_0xdf79('0xd'),_0x2d2130,_0x2eced6);_0x110b81(_0x2eced6);});});}exports[_0xdf79('0x17')]=function(_0x19fdb1){var _0x143f95=this;return new Promise(function(_0x2141f1,_0x2ab64a){return db['SquareRecording'][_0xdf79('0x18')](_0x19fdb1[_0xdf79('0x19')],{'raw':_0x19fdb1[_0xdf79('0x1a')]?_0x19fdb1[_0xdf79('0x1a')][_0xdf79('0x1b')]===undefined?!![]:![]:!![]})[_0xdf79('0xb')](function(_0x252445){logger[_0xdf79('0xc')](_0xdf79('0x17'),_0x19fdb1);logger[_0xdf79('0xf')](_0xdf79('0x17'),_0x19fdb1,JSON['stringify'](_0x252445));_0x2141f1(_0x252445);})[_0xdf79('0x16')](function(_0x41d291){logger['error'](_0xdf79('0x17'),_0x41d291['message'],_0x19fdb1);_0x2ab64a(_0x143f95['error'](0x1f4,_0x41d291[_0xdf79('0x14')]));});});}; \ No newline at end of file +var _0xa1eb=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','SquareRecording','body','options','raw','debug','lodash','util','moment','bluebird','randomstring'];(function(_0x464fe8,_0x2b2863){var _0x53b58b=function(_0x21772e){while(--_0x21772e){_0x464fe8['push'](_0x464fe8['shift']());}};_0x53b58b(++_0x2b2863);}(_0xa1eb,0xee));var _0xba1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1eb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba1e('0x0'));var util=require(_0xba1e('0x1'));var moment=require(_0xba1e('0x2'));var BPromise=require(_0xba1e('0x3'));var rs=require(_0xba1e('0x4'));var fs=require('fs');var Redis=require(_0xba1e('0x5'));var db=require(_0xba1e('0x6'))['db'];var utils=require(_0xba1e('0x7'));var logger=require('../../config/logger')(_0xba1e('0x8'));var config=require(_0xba1e('0x9'));var jayson=require(_0xba1e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39cd90,_0x136945,_0x1b7710){return new BPromise(function(_0x186490,_0x49d720){return client[_0xba1e('0xb')](_0x39cd90,_0x1b7710)[_0xba1e('0xc')](function(_0x2d5dd6){logger[_0xba1e('0xd')]('SquareRecording,\x20%s,\x20%s',_0x136945,_0xba1e('0xe'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x136945,_0xba1e('0xe'),JSON[_0xba1e('0xf')](_0x2d5dd6));if(_0x2d5dd6[_0xba1e('0x10')]){if(_0x2d5dd6[_0xba1e('0x10')][_0xba1e('0x11')]===0x1f4){logger[_0xba1e('0x10')](_0xba1e('0x12'),_0x136945,_0x2d5dd6[_0xba1e('0x10')][_0xba1e('0x13')]);return _0x49d720(_0x2d5dd6['error'][_0xba1e('0x13')]);}logger[_0xba1e('0x10')]('SquareRecording,\x20%s,\x20%s',_0x136945,_0x2d5dd6['error'][_0xba1e('0x13')]);return _0x186490(_0x2d5dd6[_0xba1e('0x10')][_0xba1e('0x13')]);}else{logger[_0xba1e('0xd')](_0xba1e('0x12'),_0x136945,_0xba1e('0xe'));_0x186490(_0x2d5dd6['result'][_0xba1e('0x13')]);}})[_0xba1e('0x14')](function(_0x470c89){logger[_0xba1e('0x10')]('SquareRecording,\x20%s,\x20%s',_0x136945,_0x470c89);_0x49d720(_0x470c89);});});}exports[_0xba1e('0x15')]=function(_0x36f635){var _0x20c7b4=this;return new Promise(function(_0x313b69,_0x1c1e81){return db[_0xba1e('0x16')]['create'](_0x36f635[_0xba1e('0x17')],{'raw':_0x36f635[_0xba1e('0x18')]?_0x36f635[_0xba1e('0x18')][_0xba1e('0x19')]===undefined?!![]:![]:!![]})[_0xba1e('0xc')](function(_0x54c4c3){logger[_0xba1e('0xd')]('CreateSquareRecording',_0x36f635);logger[_0xba1e('0x1a')](_0xba1e('0x15'),_0x36f635,JSON['stringify'](_0x54c4c3));_0x313b69(_0x54c4c3);})[_0xba1e('0x14')](function(_0x24e22c){logger[_0xba1e('0x10')](_0xba1e('0x15'),_0x24e22c['message'],_0x36f635);_0x1c1e81(_0x20c7b4[_0xba1e('0x10')](0x1f4,_0x24e22c[_0xba1e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index d874be9..1fdd2a3 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 _0x467d=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','util','path'];(function(_0x29bf4,_0x578ae1){var _0x5132d6=function(_0x7b057b){while(--_0x7b057b){_0x29bf4['push'](_0x29bf4['shift']());}};_0x5132d6(++_0x578ae1);}(_0x467d,0x15e));var _0xd467=function(_0x37a2d2,_0x152ee4){_0x37a2d2=_0x37a2d2-0x0;var _0x5a73bd=_0x467d[_0x37a2d2];return _0x5a73bd;};'use strict';var multer=require('multer');var util=require(_0xd467('0x0'));var path=require(_0xd467('0x1'));var timeout=require(_0xd467('0x2'));var express=require(_0xd467('0x3'));var router=express[_0xd467('0x4')]();var auth=require(_0xd467('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd467('0x6'));var controller=require('./squareReport.controller');router[_0xd467('0x7')]('/',auth[_0xd467('0x8')](),controller[_0xd467('0x9')]);router[_0xd467('0x7')](_0xd467('0xa'),auth['isAuthenticated'](),controller[_0xd467('0xb')]);router[_0xd467('0x7')](_0xd467('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd467('0xd')]('/',auth[_0xd467('0x8')](),controller['create']);router[_0xd467('0xe')]('/:id',auth[_0xd467('0x8')](),controller[_0xd467('0xf')]);router['delete'](_0xd467('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcc23=['delete','destroy','exports','multer','path','Router','../../components/auth/service','../../config/environment','./squareReport.controller','get','index','describe','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xcc23,0x75));var _0x3cc2=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xcc23[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x3cc2('0x0'));var util=require('util');var path=require(_0x3cc2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3cc2('0x2')]();var auth=require(_0x3cc2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3cc2('0x4'));var controller=require(_0x3cc2('0x5'));router[_0x3cc2('0x6')]('/',auth['isAuthenticated'](),controller[_0x3cc2('0x7')]);router[_0x3cc2('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x3cc2('0x8')]);router[_0x3cc2('0x6')](_0x3cc2('0x9'),auth[_0x3cc2('0xa')](),controller[_0x3cc2('0xb')]);router[_0x3cc2('0xc')]('/',auth[_0x3cc2('0xa')](),controller[_0x3cc2('0xd')]);router[_0x3cc2('0xe')](_0x3cc2('0x9'),auth[_0x3cc2('0xa')](),controller[_0x3cc2('0xf')]);router[_0x3cc2('0x10')](_0x3cc2('0x9'),auth['isAuthenticated'](),controller[_0x3cc2('0x11')]);module[_0x3cc2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 7e02b11..c794a62 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 _0xc4fd=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x4b94b7,_0x4e8983){var _0x4a1bc7=function(_0x4984bb){while(--_0x4984bb){_0x4b94b7['push'](_0x4b94b7['shift']());}};_0x4a1bc7(++_0x4e8983);}(_0xc4fd,0x9b));var _0xdc4f=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0xc4fd[_0x323d87];return _0x5e8f74;};'use strict';var Sequelize=require(_0xdc4f('0x0'));module[_0xdc4f('0x1')]={'network':{'type':Sequelize[_0xdc4f('0x2')]},'network_script':{'type':Sequelize[_0xdc4f('0x2')]},'request':{'type':Sequelize[_0xdc4f('0x2')]},'channel':{'type':Sequelize[_0xdc4f('0x2')]},'language':{'type':Sequelize[_0xdc4f('0x2')]},'type':{'type':Sequelize[_0xdc4f('0x2')]},'uniqueid':{'type':Sequelize[_0xdc4f('0x2')]},'version':{'type':Sequelize[_0xdc4f('0x2')]},'callerid':{'type':Sequelize[_0xdc4f('0x2')]},'calleridname':{'type':Sequelize[_0xdc4f('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xdc4f('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xdc4f('0x2')]},'dnid':{'type':Sequelize[_0xdc4f('0x2')]},'rdnis':{'type':Sequelize[_0xdc4f('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xdc4f('0x2')]},'enhanced':{'type':Sequelize[_0xdc4f('0x2')]},'accountcode':{'type':Sequelize[_0xdc4f('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xdc4f('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xdc4f('0x3')]},'bot':{'type':Sequelize[_0xdc4f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe879=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x59a302,_0x37a4f6){var _0x51a9d4=function(_0x554221){while(--_0x554221){_0x59a302['push'](_0x59a302['shift']());}};_0x51a9d4(++_0x37a4f6);}(_0xe879,0x17c));var _0x9e87=function(_0x6ec95c,_0x4baa31){_0x6ec95c=_0x6ec95c-0x0;var _0x128857=_0xe879[_0x6ec95c];return _0x128857;};'use strict';var Sequelize=require(_0x9e87('0x0'));module[_0x9e87('0x1')]={'network':{'type':Sequelize[_0x9e87('0x2')]},'network_script':{'type':Sequelize[_0x9e87('0x2')]},'request':{'type':Sequelize[_0x9e87('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9e87('0x2')]},'type':{'type':Sequelize[_0x9e87('0x2')]},'uniqueid':{'type':Sequelize[_0x9e87('0x2')]},'version':{'type':Sequelize[_0x9e87('0x2')]},'callerid':{'type':Sequelize[_0x9e87('0x2')]},'calleridname':{'type':Sequelize[_0x9e87('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x9e87('0x2')]},'callington':{'type':Sequelize[_0x9e87('0x2')]},'callingtns':{'type':Sequelize[_0x9e87('0x2')]},'dnid':{'type':Sequelize[_0x9e87('0x2')]},'rdnis':{'type':Sequelize[_0x9e87('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9e87('0x2')]},'priority':{'type':Sequelize[_0x9e87('0x2')]},'enhanced':{'type':Sequelize[_0x9e87('0x2')]},'accountcode':{'type':Sequelize[_0x9e87('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9e87('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x9e87('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 235ccda..3fd46e3 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 _0xdfa0=['fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','SquareReport','rawAttributes'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xdfa0,0x69));var _0x0dfa=function(_0x2899e8,_0x114698){_0x2899e8=_0x2899e8-0x0;var _0x2021df=_0xdfa0[_0x2899e8];return _0x2021df;};'use strict';var pdf=require(_0x0dfa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0dfa('0x1'));var zipdir=require(_0x0dfa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0dfa('0x3'));var moment=require(_0x0dfa('0x4'));var BPromise=require(_0x0dfa('0x5'));var Mustache=require('mustache');var util=require(_0x0dfa('0x6'));var path=require('path');var sox=require(_0x0dfa('0x7'));var csv=require(_0x0dfa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0dfa('0x9'));var squel=require(_0x0dfa('0xa'));var crypto=require(_0x0dfa('0xb'));var jsforce=require(_0x0dfa('0xc'));var deskjs=require(_0x0dfa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0dfa('0xe'));var Papa=require(_0x0dfa('0xf'));var Redis=require(_0x0dfa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0dfa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0dfa('0x12'));var logger=require(_0x0dfa('0x13'))(_0x0dfa('0x14'));var utils=require('../../config/utils');var config=require(_0x0dfa('0x15'));var licenseUtil=require(_0x0dfa('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x169483,_0x96198){_0x96198=_0x96198||0xcc;return function(_0x47c37c){if(_0x47c37c){return _0x169483[_0x0dfa('0x17')](_0x96198);}return _0x169483[_0x0dfa('0x18')](_0x96198)[_0x0dfa('0x19')]();};}function respondWithResult(_0x3b0f4a,_0x416ce3){_0x416ce3=_0x416ce3||0xc8;return function(_0x433241){if(_0x433241){return _0x3b0f4a['status'](_0x416ce3)[_0x0dfa('0x1a')](_0x433241);}};}function respondWithFilteredResult(_0x3ef3e3,_0x2d8a69){return function(_0x14e818){if(_0x14e818){var _0x334ae2=_0x14e818[_0x0dfa('0x1b')],_0x30cb88=_0x2d8a69[_0x0dfa('0x1c')],_0x37cfe8=_0x2d8a69[_0x0dfa('0x1c')]+_0x2d8a69[_0x0dfa('0x1d')],_0x3c79f0;if(_0x37cfe8>=_0x334ae2){_0x37cfe8=_0x334ae2;_0x3c79f0=0xc8;}else{_0x3c79f0=0xce;}_0x3ef3e3[_0x0dfa('0x18')](_0x3c79f0);return _0x3ef3e3[_0x0dfa('0x1e')](_0x0dfa('0x1f'),_0x30cb88+'-'+_0x37cfe8+'/'+_0x334ae2)['json'](_0x14e818);}return null;};}function patchUpdates(_0xd21935){return function(_0x22ff4e){try{jsonpatch[_0x0dfa('0x20')](_0x22ff4e,_0xd21935,!![]);}catch(_0x1bb2a){return BPromise[_0x0dfa('0x21')](_0x1bb2a);}return _0x22ff4e['save']();};}function saveUpdates(_0x4c8f11,_0x1ac31c){return function(_0x41c31a){if(_0x41c31a){return _0x41c31a[_0x0dfa('0x22')](_0x4c8f11)['then'](function(_0x32d87a){return _0x32d87a;});}return null;};}function removeEntity(_0x53b8f0,_0x363788){return function(_0x5693a0){if(_0x5693a0){return _0x5693a0[_0x0dfa('0x23')]()[_0x0dfa('0x24')](function(){_0x53b8f0[_0x0dfa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e1566,_0x70ff72){return function(_0x269686){if(!_0x269686){_0x2e1566[_0x0dfa('0x17')](0x194);}return _0x269686;};}function handleError(_0x1dfbea,_0x12bd2a){_0x12bd2a=_0x12bd2a||0x1f4;return function(_0x13005a){logger[_0x0dfa('0x25')](_0x13005a[_0x0dfa('0x26')]);if(_0x13005a[_0x0dfa('0x27')]){delete _0x13005a['name'];}_0x1dfbea['status'](_0x12bd2a)[_0x0dfa('0x28')](_0x13005a);};}exports[_0x0dfa('0x29')]=function(_0x4992b8,_0x14ae2f){var _0x3be821={},_0x39125a={},_0x4e4172={'count':0x0,'rows':[]};var _0x1f690c=_[_0x0dfa('0x2a')](db[_0x0dfa('0x2b')][_0x0dfa('0x2c')],function(_0x194790){return{'name':_0x194790[_0x0dfa('0x2d')],'type':_0x194790['type'][_0x0dfa('0x2e')]};});_0x39125a[_0x0dfa('0x2f')]=_['map'](_0x1f690c,_0x0dfa('0x27'));_0x39125a[_0x0dfa('0x30')]=_[_0x0dfa('0x31')](_0x4992b8[_0x0dfa('0x30')]);_0x39125a['filters']=_[_0x0dfa('0x32')](_0x39125a[_0x0dfa('0x2f')],_0x39125a[_0x0dfa('0x30')]);_0x3be821['attributes']=_['intersection'](_0x39125a[_0x0dfa('0x2f')],qs[_0x0dfa('0x33')](_0x4992b8['query']['fields']));_0x3be821['attributes']=_0x3be821[_0x0dfa('0x34')][_0x0dfa('0x35')]?_0x3be821[_0x0dfa('0x34')]:_0x39125a[_0x0dfa('0x2f')];if(!_0x4992b8['query'][_0x0dfa('0x36')](_0x0dfa('0x37'))){_0x3be821[_0x0dfa('0x1d')]=qs[_0x0dfa('0x1d')](_0x4992b8[_0x0dfa('0x30')][_0x0dfa('0x1d')]);_0x3be821[_0x0dfa('0x1c')]=qs[_0x0dfa('0x1c')](_0x4992b8[_0x0dfa('0x30')][_0x0dfa('0x1c')]);}_0x3be821['order']=qs['sort'](_0x4992b8[_0x0dfa('0x30')][_0x0dfa('0x38')]);_0x3be821[_0x0dfa('0x39')]=qs[_0x0dfa('0x3a')](_[_0x0dfa('0x3b')](_0x4992b8['query'],_0x39125a[_0x0dfa('0x3a')]),_0x1f690c);if(_0x4992b8['query'][_0x0dfa('0x3c')]){_0x3be821[_0x0dfa('0x39')]=_[_0x0dfa('0x3d')](_0x3be821['where'],{'$or':_['map'](_0x1f690c,function(_0x243dd0){if(_0x243dd0[_0x0dfa('0x3e')]!==_0x0dfa('0x3f')){var _0x4f1e32={};_0x4f1e32[_0x243dd0[_0x0dfa('0x27')]]={'$like':'%'+_0x4992b8['query'][_0x0dfa('0x3c')]+'%'};return _0x4f1e32;}})});}_0x3be821=_[_0x0dfa('0x3d')]({},_0x3be821,_0x4992b8['options']);var _0x3a06d0={'where':_0x3be821[_0x0dfa('0x39')]};return db[_0x0dfa('0x2b')][_0x0dfa('0x1b')](_0x3a06d0)[_0x0dfa('0x24')](function(_0x45b094){_0x4e4172['count']=_0x45b094;if(_0x4992b8[_0x0dfa('0x30')][_0x0dfa('0x40')]){_0x3be821[_0x0dfa('0x41')]=[{'all':!![]}];}return db[_0x0dfa('0x2b')][_0x0dfa('0x42')](_0x3be821);})[_0x0dfa('0x24')](function(_0x3fc677){_0x4e4172[_0x0dfa('0x43')]=_0x3fc677;return _0x4e4172;})[_0x0dfa('0x24')](respondWithFilteredResult(_0x14ae2f,_0x3be821))[_0x0dfa('0x44')](handleError(_0x14ae2f,null));};exports[_0x0dfa('0x45')]=function(_0x5119d1,_0x479a4a){var _0x1b57aa={'raw':!![],'where':{'id':_0x5119d1['params']['id']}},_0x1d7750={};_0x1d7750['model']=_['keys'](db[_0x0dfa('0x2b')]['rawAttributes']);_0x1d7750[_0x0dfa('0x30')]=_[_0x0dfa('0x31')](_0x5119d1[_0x0dfa('0x30')]);_0x1d7750[_0x0dfa('0x3a')]=_[_0x0dfa('0x32')](_0x1d7750[_0x0dfa('0x2f')],_0x1d7750[_0x0dfa('0x30')]);_0x1b57aa[_0x0dfa('0x34')]=_['intersection'](_0x1d7750[_0x0dfa('0x2f')],qs[_0x0dfa('0x33')](_0x5119d1['query'][_0x0dfa('0x33')]));_0x1b57aa[_0x0dfa('0x34')]=_0x1b57aa['attributes'][_0x0dfa('0x35')]?_0x1b57aa[_0x0dfa('0x34')]:_0x1d7750[_0x0dfa('0x2f')];if(_0x5119d1[_0x0dfa('0x30')]['includeAll']){_0x1b57aa[_0x0dfa('0x41')]=[{'all':!![]}];}_0x1b57aa=_[_0x0dfa('0x3d')]({},_0x1b57aa,_0x5119d1['options']);return db[_0x0dfa('0x2b')][_0x0dfa('0x46')](_0x1b57aa)[_0x0dfa('0x24')](handleEntityNotFound(_0x479a4a,null))[_0x0dfa('0x24')](respondWithResult(_0x479a4a,null))[_0x0dfa('0x44')](handleError(_0x479a4a,null));};exports[_0x0dfa('0x47')]=function(_0x33c17b,_0x289568){return db[_0x0dfa('0x2b')]['create'](_0x33c17b[_0x0dfa('0x48')],{})[_0x0dfa('0x24')](respondWithResult(_0x289568,0xc9))['catch'](handleError(_0x289568,null));};exports[_0x0dfa('0x22')]=function(_0x26c8e8,_0x3be07a){if(_0x26c8e8[_0x0dfa('0x48')]['id']){delete _0x26c8e8['body']['id'];}return db['SquareReport']['find']({'where':{'id':_0x26c8e8[_0x0dfa('0x49')]['id']}})[_0x0dfa('0x24')](handleEntityNotFound(_0x3be07a,null))[_0x0dfa('0x24')](saveUpdates(_0x26c8e8[_0x0dfa('0x48')],null))[_0x0dfa('0x24')](respondWithResult(_0x3be07a,null))[_0x0dfa('0x44')](handleError(_0x3be07a,null));};exports['destroy']=function(_0x595ba5,_0x2c7978){return db[_0x0dfa('0x2b')][_0x0dfa('0x46')]({'where':{'id':_0x595ba5[_0x0dfa('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c7978,null))['then'](removeEntity(_0x2c7978,null))['catch'](handleError(_0x2c7978,null));};exports[_0x0dfa('0x4a')]=function(_0x323d4c,_0x3d06ca){return db[_0x0dfa('0x2b')][_0x0dfa('0x4a')]()[_0x0dfa('0x24')](respondWithResult(_0x3d06ca,null))[_0x0dfa('0x44')](handleError(_0x3d06ca,null));}; \ No newline at end of file +var _0xd663=['send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareReport','includeAll','include','findAll','rows','catch','filters','options','create','update','body','find','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','lodash','jsforce','desk.js','to-csv','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','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd663,0x1ed));var _0x3d66=function(_0x5c9702,_0x5e35e7){_0x5c9702=_0x5c9702-0x0;var _0x474f61=_0xd663[_0x5c9702];return _0x474f61;};'use strict';var pdf=require(_0x3d66('0x0'));var emlformat=require(_0x3d66('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3d66('0x2'));var jsonpatch=require(_0x3d66('0x3'));var rp=require(_0x3d66('0x4'));var moment=require(_0x3d66('0x5'));var BPromise=require(_0x3d66('0x6'));var Mustache=require('mustache');var util=require(_0x3d66('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3d66('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3d66('0x9'));var deskjs=require(_0x3d66('0xa'));var toCsv=require(_0x3d66('0xb'));var querystring=require(_0x3d66('0xc'));var Papa=require(_0x3d66('0xd'));var Redis=require(_0x3d66('0xe'));var authService=require(_0x3d66('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3d66('0x10'));var hardwareService=require(_0x3d66('0x11'));var logger=require(_0x3d66('0x12'))('api');var utils=require(_0x3d66('0x13'));var config=require(_0x3d66('0x14'));var licenseUtil=require(_0x3d66('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207712,_0x223de6){_0x223de6=_0x223de6||0xcc;return function(_0x288693){if(_0x288693){return _0x207712[_0x3d66('0x16')](_0x223de6);}return _0x207712['status'](_0x223de6)[_0x3d66('0x17')]();};}function respondWithResult(_0x5a940c,_0x15bba0){_0x15bba0=_0x15bba0||0xc8;return function(_0x290f29){if(_0x290f29){return _0x5a940c[_0x3d66('0x18')](_0x15bba0)[_0x3d66('0x19')](_0x290f29);}};}function respondWithFilteredResult(_0x30260d,_0x153b88){return function(_0x5628ae){if(_0x5628ae){var _0x5eba7e=_0x5628ae[_0x3d66('0x1a')],_0xe5bf8f=_0x153b88[_0x3d66('0x1b')],_0x4651b8=_0x153b88[_0x3d66('0x1b')]+_0x153b88[_0x3d66('0x1c')],_0x4bd10f;if(_0x4651b8>=_0x5eba7e){_0x4651b8=_0x5eba7e;_0x4bd10f=0xc8;}else{_0x4bd10f=0xce;}_0x30260d[_0x3d66('0x18')](_0x4bd10f);return _0x30260d[_0x3d66('0x1d')](_0x3d66('0x1e'),_0xe5bf8f+'-'+_0x4651b8+'/'+_0x5eba7e)[_0x3d66('0x19')](_0x5628ae);}return null;};}function patchUpdates(_0x1accfb){return function(_0x3902f1){try{jsonpatch[_0x3d66('0x1f')](_0x3902f1,_0x1accfb,!![]);}catch(_0x353c5f){return BPromise[_0x3d66('0x20')](_0x353c5f);}return _0x3902f1[_0x3d66('0x21')]();};}function saveUpdates(_0x21cfd7,_0x4c61ee){return function(_0xac3d17){if(_0xac3d17){return _0xac3d17['update'](_0x21cfd7)[_0x3d66('0x22')](function(_0x26b404){return _0x26b404;});}return null;};}function removeEntity(_0x4486f5,_0x37ed73){return function(_0x11be7f){if(_0x11be7f){return _0x11be7f[_0x3d66('0x23')]()[_0x3d66('0x22')](function(){_0x4486f5[_0x3d66('0x18')](0xcc)[_0x3d66('0x17')]();});}};}function handleEntityNotFound(_0x4e2c42,_0x151364){return function(_0x1a970c){if(!_0x1a970c){_0x4e2c42[_0x3d66('0x16')](0x194);}return _0x1a970c;};}function handleError(_0x1cbf89,_0x47c6f1){_0x47c6f1=_0x47c6f1||0x1f4;return function(_0x59fe0a){logger[_0x3d66('0x24')](_0x59fe0a[_0x3d66('0x25')]);if(_0x59fe0a[_0x3d66('0x26')]){delete _0x59fe0a['name'];}_0x1cbf89[_0x3d66('0x18')](_0x47c6f1)[_0x3d66('0x27')](_0x59fe0a);};}exports[_0x3d66('0x28')]=function(_0x7350d8,_0x3ff9c5){var _0x77dc85={},_0x45ee47={},_0x4565a6={'count':0x0,'rows':[]};var _0x325de1=_[_0x3d66('0x29')](db['SquareReport'][_0x3d66('0x2a')],function(_0x1dff3b){return{'name':_0x1dff3b[_0x3d66('0x2b')],'type':_0x1dff3b[_0x3d66('0x2c')][_0x3d66('0x2d')]};});_0x45ee47[_0x3d66('0x2e')]=_[_0x3d66('0x29')](_0x325de1,_0x3d66('0x26'));_0x45ee47[_0x3d66('0x2f')]=_[_0x3d66('0x30')](_0x7350d8[_0x3d66('0x2f')]);_0x45ee47['filters']=_['intersection'](_0x45ee47[_0x3d66('0x2e')],_0x45ee47[_0x3d66('0x2f')]);_0x77dc85[_0x3d66('0x31')]=_[_0x3d66('0x32')](_0x45ee47[_0x3d66('0x2e')],qs[_0x3d66('0x33')](_0x7350d8[_0x3d66('0x2f')][_0x3d66('0x33')]));_0x77dc85[_0x3d66('0x31')]=_0x77dc85[_0x3d66('0x31')][_0x3d66('0x34')]?_0x77dc85[_0x3d66('0x31')]:_0x45ee47[_0x3d66('0x2e')];if(!_0x7350d8[_0x3d66('0x2f')][_0x3d66('0x35')](_0x3d66('0x36'))){_0x77dc85[_0x3d66('0x1c')]=qs[_0x3d66('0x1c')](_0x7350d8[_0x3d66('0x2f')][_0x3d66('0x1c')]);_0x77dc85[_0x3d66('0x1b')]=qs[_0x3d66('0x1b')](_0x7350d8[_0x3d66('0x2f')]['offset']);}_0x77dc85[_0x3d66('0x37')]=qs[_0x3d66('0x38')](_0x7350d8[_0x3d66('0x2f')]['sort']);_0x77dc85[_0x3d66('0x39')]=qs['filters'](_[_0x3d66('0x3a')](_0x7350d8[_0x3d66('0x2f')],_0x45ee47['filters']),_0x325de1);if(_0x7350d8[_0x3d66('0x2f')][_0x3d66('0x3b')]){_0x77dc85['where']=_[_0x3d66('0x3c')](_0x77dc85[_0x3d66('0x39')],{'$or':_['map'](_0x325de1,function(_0x1827b0){if(_0x1827b0[_0x3d66('0x2c')]!==_0x3d66('0x3d')){var _0x2ea871={};_0x2ea871[_0x1827b0['name']]={'$like':'%'+_0x7350d8[_0x3d66('0x2f')]['filter']+'%'};return _0x2ea871;}})});}_0x77dc85=_[_0x3d66('0x3c')]({},_0x77dc85,_0x7350d8['options']);var _0xc77eb5={'where':_0x77dc85[_0x3d66('0x39')]};return db[_0x3d66('0x3e')]['count'](_0xc77eb5)[_0x3d66('0x22')](function(_0xc07e61){_0x4565a6[_0x3d66('0x1a')]=_0xc07e61;if(_0x7350d8[_0x3d66('0x2f')][_0x3d66('0x3f')]){_0x77dc85[_0x3d66('0x40')]=[{'all':!![]}];}return db[_0x3d66('0x3e')][_0x3d66('0x41')](_0x77dc85);})[_0x3d66('0x22')](function(_0xa1a5f2){_0x4565a6[_0x3d66('0x42')]=_0xa1a5f2;return _0x4565a6;})[_0x3d66('0x22')](respondWithFilteredResult(_0x3ff9c5,_0x77dc85))[_0x3d66('0x43')](handleError(_0x3ff9c5,null));};exports['show']=function(_0x3f9010,_0x4482a3){var _0x31234c={'raw':!![],'where':{'id':_0x3f9010['params']['id']}},_0x4c980e={};_0x4c980e[_0x3d66('0x2e')]=_[_0x3d66('0x30')](db[_0x3d66('0x3e')][_0x3d66('0x2a')]);_0x4c980e[_0x3d66('0x2f')]=_[_0x3d66('0x30')](_0x3f9010[_0x3d66('0x2f')]);_0x4c980e[_0x3d66('0x44')]=_['intersection'](_0x4c980e[_0x3d66('0x2e')],_0x4c980e[_0x3d66('0x2f')]);_0x31234c[_0x3d66('0x31')]=_['intersection'](_0x4c980e['model'],qs[_0x3d66('0x33')](_0x3f9010[_0x3d66('0x2f')][_0x3d66('0x33')]));_0x31234c[_0x3d66('0x31')]=_0x31234c[_0x3d66('0x31')][_0x3d66('0x34')]?_0x31234c[_0x3d66('0x31')]:_0x4c980e[_0x3d66('0x2e')];if(_0x3f9010['query'][_0x3d66('0x3f')]){_0x31234c['include']=[{'all':!![]}];}_0x31234c=_[_0x3d66('0x3c')]({},_0x31234c,_0x3f9010[_0x3d66('0x45')]);return db[_0x3d66('0x3e')]['find'](_0x31234c)[_0x3d66('0x22')](handleEntityNotFound(_0x4482a3,null))[_0x3d66('0x22')](respondWithResult(_0x4482a3,null))[_0x3d66('0x43')](handleError(_0x4482a3,null));};exports[_0x3d66('0x46')]=function(_0x4c8c2d,_0x5cb410){return db[_0x3d66('0x3e')]['create'](_0x4c8c2d['body'],{})[_0x3d66('0x22')](respondWithResult(_0x5cb410,0xc9))[_0x3d66('0x43')](handleError(_0x5cb410,null));};exports[_0x3d66('0x47')]=function(_0xa576e2,_0x1636f6){if(_0xa576e2[_0x3d66('0x48')]['id']){delete _0xa576e2[_0x3d66('0x48')]['id'];}return db['SquareReport'][_0x3d66('0x49')]({'where':{'id':_0xa576e2[_0x3d66('0x4a')]['id']}})[_0x3d66('0x22')](handleEntityNotFound(_0x1636f6,null))[_0x3d66('0x22')](saveUpdates(_0xa576e2[_0x3d66('0x48')],null))['then'](respondWithResult(_0x1636f6,null))[_0x3d66('0x43')](handleError(_0x1636f6,null));};exports[_0x3d66('0x23')]=function(_0xa67d58,_0x433c32){return db[_0x3d66('0x3e')][_0x3d66('0x49')]({'where':{'id':_0xa67d58[_0x3d66('0x4a')]['id']}})['then'](handleEntityNotFound(_0x433c32,null))['then'](removeEntity(_0x433c32,null))['catch'](handleError(_0x433c32,null));};exports[_0x3d66('0x4b')]=function(_0x161d0a,_0x5bb0c5){return db[_0x3d66('0x3e')][_0x3d66('0x4b')]()[_0x3d66('0x22')](respondWithResult(_0x5bb0c5,null))[_0x3d66('0x43')](handleError(_0x5bb0c5,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a45c8a9..b4af41e 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 _0x6d03=['SquareReport','report_square','uid_pname','uniqueid','project_name','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define'];(function(_0x2e14e3,_0x1175fa){var _0x466342=function(_0x290379){while(--_0x290379){_0x2e14e3['push'](_0x2e14e3['shift']());}};_0x466342(++_0x1175fa);}(_0x6d03,0x105));var _0x36d0=function(_0x595154,_0x197350){_0x595154=_0x595154-0x0;var _0x551e14=_0x6d03[_0x595154];return _0x551e14;};'use strict';var _=require(_0x36d0('0x0'));var util=require(_0x36d0('0x1'));var logger=require('../../config/logger')(_0x36d0('0x2'));var moment=require(_0x36d0('0x3'));var BPromise=require(_0x36d0('0x4'));var rp=require(_0x36d0('0x5'));var fs=require('fs');var path=require(_0x36d0('0x6'));var rimraf=require(_0x36d0('0x7'));var config=require(_0x36d0('0x8'));var attributes=require(_0x36d0('0x9'));module['exports']=function(_0x45a753,_0x483c7e){return _0x45a753[_0x36d0('0xa')](_0x36d0('0xb'),attributes,{'tableName':_0x36d0('0xc'),'paranoid':![],'indexes':[{'name':_0x36d0('0xd'),'fields':[_0x36d0('0xe'),_0x36d0('0xf')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x021c=['project_name','leaveAt','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x021c,0x1d2));var _0xc021=function(_0x4cef57,_0x4da0e4){_0x4cef57=_0x4cef57-0x0;var _0x3bf7dd=_0x021c[_0x4cef57];return _0x3bf7dd;};'use strict';var _=require('lodash');var util=require(_0xc021('0x0'));var logger=require('../../config/logger')(_0xc021('0x1'));var moment=require(_0xc021('0x2'));var BPromise=require(_0xc021('0x3'));var rp=require(_0xc021('0x4'));var fs=require('fs');var path=require(_0xc021('0x5'));var rimraf=require(_0xc021('0x6'));var config=require(_0xc021('0x7'));var attributes=require(_0xc021('0x8'));module[_0xc021('0x9')]=function(_0x3c96ac,_0x5bf001){return _0x3c96ac[_0xc021('0xa')]('SquareReport',attributes,{'tableName':_0xc021('0xb'),'paranoid':![],'indexes':[{'name':_0xc021('0xc'),'fields':[_0xc021('0xd'),_0xc021('0xe')]},{'name':_0xc021('0xf'),'fields':[_0xc021('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d583490..03ca4f5 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 _0x6aa7=['client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x33271a,_0x4f26de){var _0x2693e8=function(_0x351713){while(--_0x351713){_0x33271a['push'](_0x33271a['shift']());}};_0x2693e8(++_0x4f26de);}(_0x6aa7,0x178));var _0x76aa=function(_0x4cdb38,_0x17ef33){_0x4cdb38=_0x4cdb38-0x0;var _0x45093d=_0x6aa7[_0x4cdb38];return _0x45093d;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['SquareReport'][_0x76aa('0x17')](_0x21c16d[_0x76aa('0x18')],{'raw':_0x21c16d[_0x76aa('0x19')]?_0x21c16d[_0x76aa('0x19')][_0x76aa('0x1a')]===undefined?!![]:![]:!![]})[_0x76aa('0xa')](function(_0x19af92){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger['debug'](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0x19af92));_0x3ead3f(_0x19af92);})[_0x76aa('0x15')](function(_0x5b3f55){logger[_0x76aa('0x11')](_0x76aa('0x16'),_0x5b3f55[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x5b3f55[_0x76aa('0x13')]));});});};exports[_0x76aa('0x1b')]=function(_0x3cd039){var _0x3363b3=this;return new Promise(function(_0x32bf9f,_0x2cba6d){return db[_0x76aa('0x1c')][_0x76aa('0x1d')](_0x3cd039[_0x76aa('0x18')],{'raw':_0x3cd039['options']?_0x3cd039[_0x76aa('0x19')][_0x76aa('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cd039[_0x76aa('0x19')]?_0x3cd039[_0x76aa('0x19')][_0x76aa('0x1e')]||null:null,'attributes':_0x3cd039[_0x76aa('0x19')]?_0x3cd039[_0x76aa('0x19')][_0x76aa('0x1f')]||null:null,'limit':_0x3cd039[_0x76aa('0x19')]?_0x3cd039[_0x76aa('0x19')]['limit']||null:null})[_0x76aa('0xa')](function(_0x5a8030){logger[_0x76aa('0xb')](_0x76aa('0x1b'),_0x3cd039);logger[_0x76aa('0xe')](_0x76aa('0x1b'),_0x3cd039,JSON[_0x76aa('0x10')](_0x5a8030));_0x32bf9f(_0x5a8030);})[_0x76aa('0x15')](function(_0x2ee0f9){logger[_0x76aa('0x11')](_0x76aa('0x1b'),_0x2ee0f9[_0x76aa('0x13')],_0x3cd039);_0x2cba6d(_0x3363b3['error'](0x1f4,_0x2ee0f9[_0x76aa('0x13')]));});});}; \ No newline at end of file +var _0x84ab=['rpc','../../config/environment','jayson/promise','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','debug','UpdateSquareReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x25380e,_0x4dddb4){var _0x3161c2=function(_0x4687f5){while(--_0x4687f5){_0x25380e['push'](_0x25380e['shift']());}};_0x3161c2(++_0x4dddb4);}(_0x84ab,0x12f));var _0xb84a=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0x84ab[_0xf34109];return _0x570bfc;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('SquareReport,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});}exports[_0xb84a('0x14')]=function(_0x34d82f){var _0x28fe46=this;return new Promise(function(_0x3f7437,_0x11d5a0){return db[_0xb84a('0x15')][_0xb84a('0x16')](_0x34d82f[_0xb84a('0x17')],{'raw':_0x34d82f['options']?_0x34d82f[_0xb84a('0x18')][_0xb84a('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xac76d3){logger[_0xb84a('0xb')](_0xb84a('0x14'),_0x34d82f);logger[_0xb84a('0x1a')]('CreateSquareReport',_0x34d82f,JSON['stringify'](_0xac76d3));_0x3f7437(_0xac76d3);})[_0xb84a('0x13')](function(_0x19097d){logger[_0xb84a('0xf')](_0xb84a('0x14'),_0x19097d[_0xb84a('0x11')],_0x34d82f);_0x11d5a0(_0x28fe46[_0xb84a('0xf')](0x1f4,_0x19097d[_0xb84a('0x11')]));});});};exports[_0xb84a('0x1b')]=function(_0x3aa06f){var _0x26fe42=this;return new Promise(function(_0x10d860,_0x1aab7d){return db[_0xb84a('0x15')][_0xb84a('0x1c')](_0x3aa06f[_0xb84a('0x17')],{'raw':_0x3aa06f[_0xb84a('0x18')]?_0x3aa06f[_0xb84a('0x18')][_0xb84a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aa06f[_0xb84a('0x18')]?_0x3aa06f[_0xb84a('0x18')][_0xb84a('0x1d')]||null:null,'attributes':_0x3aa06f[_0xb84a('0x18')]?_0x3aa06f[_0xb84a('0x18')][_0xb84a('0x1e')]||null:null,'limit':_0x3aa06f[_0xb84a('0x18')]?_0x3aa06f[_0xb84a('0x18')]['limit']||null:null})['then'](function(_0x4608ce){logger[_0xb84a('0xb')]('UpdateSquareReport',_0x3aa06f);logger[_0xb84a('0x1a')](_0xb84a('0x1b'),_0x3aa06f,JSON['stringify'](_0x4608ce));_0x10d860(_0x4608ce);})['catch'](function(_0x28f2e7){logger[_0xb84a('0xf')]('UpdateSquareReport',_0x28f2e7[_0xb84a('0x11')],_0x3aa06f);_0x1aab7d(_0x26fe42[_0xb84a('0xf')](0x1f4,_0x28f2e7[_0xb84a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 37a3912..8e2c99e 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(_0x208c91,_0x258cc4){var _0x21a77c=function(_0x22c982){while(--_0x22c982){_0x208c91['push'](_0x208c91['shift']());}};_0x21a77c(++_0x258cc4);}(_0x7a54,0x106));var _0x47a5=function(_0xf6d3b4,_0x46332d){_0xf6d3b4=_0xf6d3b4-0x0;var _0x113aa6=_0x7a54[_0xf6d3b4];return _0x113aa6;};'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(_0x491730,_0x1b67e5){var _0x48811e=function(_0x5918b9){while(--_0x5918b9){_0x491730['push'](_0x491730['shift']());}};_0x48811e(++_0x1b67e5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x16238e,_0x55e577){_0x16238e=_0x16238e-0x0;var _0x1cc346=_0x5f2f[_0x16238e];return _0x1cc346;};'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 812eb86..16521a0 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 _0x3708=['TEXT','sequelize','STRING'];(function(_0x2ca9f1,_0xff9bd3){var _0x73f4a7=function(_0x26d4a8){while(--_0x26d4a8){_0x2ca9f1['push'](_0x2ca9f1['shift']());}};_0x73f4a7(++_0xff9bd3);}(_0x3708,0x88));var _0x8370=function(_0x442ff9,_0x143c18){_0x442ff9=_0x442ff9-0x0;var _0x2d0ed4=_0x3708[_0x442ff9];return _0x2d0ed4;};'use strict';var Sequelize=require(_0x8370('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x8370('0x1')]},'application':{'type':Sequelize[_0x8370('0x1')]},'data':{'type':Sequelize[_0x8370('0x2')]},'project_name':{'type':Sequelize[_0x8370('0x1')]},'callerid':{'type':Sequelize[_0x8370('0x1')]}}; \ No newline at end of file +var _0x4afc=['STRING','TEXT','sequelize','exports'];(function(_0x46a1cf,_0x3e707b){var _0x270320=function(_0x30837b){while(--_0x30837b){_0x46a1cf['push'](_0x46a1cf['shift']());}};_0x270320(++_0x3e707b);}(_0x4afc,0x1be));var _0xc4af=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x4afc[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0xc4af('0x0'));module[_0xc4af('0x1')]={'uniqueid':{'type':Sequelize[_0xc4af('0x2')]},'node':{'type':Sequelize[_0xc4af('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xc4af('0x3')]},'project_name':{'type':Sequelize[_0xc4af('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 504c218..3e4971e 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 _0x13ac=['desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','error','stack','name','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','options','then','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','lodash','squel','crypto','jsforce'];(function(_0x35da78,_0x5074e3){var _0x4f8399=function(_0x5a0a33){while(--_0x5a0a33){_0x35da78['push'](_0x35da78['shift']());}};_0x4f8399(++_0x5074e3);}(_0x13ac,0x120));var _0xc13a=function(_0x142002,_0x3fa53d){_0x142002=_0x142002-0x0;var _0xa6d60=_0x13ac[_0x142002];return _0xa6d60;};'use strict';var pdf=require(_0xc13a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc13a('0x1'));var zipdir=require(_0xc13a('0x2'));var jsonpatch=require(_0xc13a('0x3'));var rp=require('request-promise');var moment=require(_0xc13a('0x4'));var BPromise=require(_0xc13a('0x5'));var Mustache=require(_0xc13a('0x6'));var util=require('util');var path=require(_0xc13a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc13a('0x8'));var squel=require(_0xc13a('0x9'));var crypto=require(_0xc13a('0xa'));var jsforce=require(_0xc13a('0xb'));var deskjs=require(_0xc13a('0xc'));var toCsv=require(_0xc13a('0xd'));var querystring=require(_0xc13a('0xe'));var Papa=require('papaparse');var Redis=require(_0xc13a('0xf'));var authService=require(_0xc13a('0x10'));var qs=require(_0xc13a('0x11'));var as=require(_0xc13a('0x12'));var hardwareService=require(_0xc13a('0x13'));var logger=require(_0xc13a('0x14'))(_0xc13a('0x15'));var utils=require(_0xc13a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc13a('0x17'));var db=require(_0xc13a('0x18'))['db'];function respondWithStatusCode(_0x47e7fa,_0x1e4794){_0x1e4794=_0x1e4794||0xcc;return function(_0x1212d6){if(_0x1212d6){return _0x47e7fa[_0xc13a('0x19')](_0x1e4794);}return _0x47e7fa['status'](_0x1e4794)[_0xc13a('0x1a')]();};}function respondWithResult(_0x2521bd,_0x5d58bf){_0x5d58bf=_0x5d58bf||0xc8;return function(_0x1def41){if(_0x1def41){return _0x2521bd[_0xc13a('0x1b')](_0x5d58bf)[_0xc13a('0x1c')](_0x1def41);}};}function respondWithFilteredResult(_0x351a4a,_0x5bef6b){return function(_0x23348e){if(_0x23348e){var _0x36cd58=_0x23348e[_0xc13a('0x1d')],_0x311b5e=_0x5bef6b[_0xc13a('0x1e')],_0x1b54a0=_0x5bef6b[_0xc13a('0x1e')]+_0x5bef6b[_0xc13a('0x1f')],_0x5b20bd;if(_0x1b54a0>=_0x36cd58){_0x1b54a0=_0x36cd58;_0x5b20bd=0xc8;}else{_0x5b20bd=0xce;}_0x351a4a[_0xc13a('0x1b')](_0x5b20bd);return _0x351a4a[_0xc13a('0x20')](_0xc13a('0x21'),_0x311b5e+'-'+_0x1b54a0+'/'+_0x36cd58)['json'](_0x23348e);}return null;};}function patchUpdates(_0x178222){return function(_0x14fe21){try{jsonpatch['apply'](_0x14fe21,_0x178222,!![]);}catch(_0xa31287){return BPromise[_0xc13a('0x22')](_0xa31287);}return _0x14fe21[_0xc13a('0x23')]();};}function saveUpdates(_0x15161c,_0x4c17bb){return function(_0x444822){if(_0x444822){return _0x444822['update'](_0x15161c)['then'](function(_0x2194a4){return _0x2194a4;});}return null;};}function removeEntity(_0x2f5ed2,_0x522032){return function(_0x4e96ae){if(_0x4e96ae){return _0x4e96ae[_0xc13a('0x24')]()['then'](function(){_0x2f5ed2[_0xc13a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e83a,_0x489209){return function(_0x5a7d7b){if(!_0x5a7d7b){_0x15e83a[_0xc13a('0x19')](0x194);}return _0x5a7d7b;};}function handleError(_0x55d077,_0x5786c3){_0x5786c3=_0x5786c3||0x1f4;return function(_0x47c761){logger[_0xc13a('0x25')](_0x47c761[_0xc13a('0x26')]);if(_0x47c761[_0xc13a('0x27')]){delete _0x47c761[_0xc13a('0x27')];}_0x55d077[_0xc13a('0x1b')](_0x5786c3)['send'](_0x47c761);};}exports['index']=function(_0x4ea2f5,_0x161520){var _0x3c62bd={},_0x2c02d8={},_0x468f59={'count':0x0,'rows':[]};var _0x4e0055=_[_0xc13a('0x28')](db[_0xc13a('0x29')][_0xc13a('0x2a')],function(_0xa7758a){return{'name':_0xa7758a[_0xc13a('0x2b')],'type':_0xa7758a[_0xc13a('0x2c')][_0xc13a('0x2d')]};});_0x2c02d8['model']=_['map'](_0x4e0055,'name');_0x2c02d8[_0xc13a('0x2e')]=_[_0xc13a('0x2f')](_0x4ea2f5[_0xc13a('0x2e')]);_0x2c02d8['filters']=_['intersection'](_0x2c02d8[_0xc13a('0x30')],_0x2c02d8[_0xc13a('0x2e')]);_0x3c62bd[_0xc13a('0x31')]=_[_0xc13a('0x32')](_0x2c02d8[_0xc13a('0x30')],qs[_0xc13a('0x33')](_0x4ea2f5[_0xc13a('0x2e')]['fields']));_0x3c62bd[_0xc13a('0x31')]=_0x3c62bd['attributes'][_0xc13a('0x34')]?_0x3c62bd[_0xc13a('0x31')]:_0x2c02d8[_0xc13a('0x30')];if(!_0x4ea2f5[_0xc13a('0x2e')][_0xc13a('0x35')](_0xc13a('0x36'))){_0x3c62bd['limit']=qs['limit'](_0x4ea2f5['query'][_0xc13a('0x1f')]);_0x3c62bd[_0xc13a('0x1e')]=qs[_0xc13a('0x1e')](_0x4ea2f5['query'][_0xc13a('0x1e')]);}_0x3c62bd[_0xc13a('0x37')]=qs[_0xc13a('0x38')](_0x4ea2f5[_0xc13a('0x2e')][_0xc13a('0x38')]);_0x3c62bd['where']=qs[_0xc13a('0x39')](_[_0xc13a('0x3a')](_0x4ea2f5['query'],_0x2c02d8[_0xc13a('0x39')]),_0x4e0055);if(_0x4ea2f5[_0xc13a('0x2e')][_0xc13a('0x3b')]){_0x3c62bd['where']=_[_0xc13a('0x3c')](_0x3c62bd[_0xc13a('0x3d')],{'$or':_[_0xc13a('0x28')](_0x4e0055,function(_0x1e0b11){if(_0x1e0b11[_0xc13a('0x2c')]!=='VIRTUAL'){var _0x3d7e70={};_0x3d7e70[_0x1e0b11[_0xc13a('0x27')]]={'$like':'%'+_0x4ea2f5['query'][_0xc13a('0x3b')]+'%'};return _0x3d7e70;}})});}_0x3c62bd=_[_0xc13a('0x3c')]({},_0x3c62bd,_0x4ea2f5[_0xc13a('0x3e')]);var _0x39ea4d={'where':_0x3c62bd['where']};return db[_0xc13a('0x29')][_0xc13a('0x1d')](_0x39ea4d)[_0xc13a('0x3f')](function(_0x5e83cc){_0x468f59[_0xc13a('0x1d')]=_0x5e83cc;if(_0x4ea2f5[_0xc13a('0x2e')][_0xc13a('0x40')]){_0x3c62bd[_0xc13a('0x41')]=[{'all':!![]}];}return db[_0xc13a('0x29')][_0xc13a('0x42')](_0x3c62bd);})['then'](function(_0x27b76f){_0x468f59[_0xc13a('0x43')]=_0x27b76f;return _0x468f59;})[_0xc13a('0x3f')](respondWithFilteredResult(_0x161520,_0x3c62bd))[_0xc13a('0x44')](handleError(_0x161520,null));};exports['show']=function(_0x51bab8,_0x12828e){var _0x1c6d75={'raw':!![],'where':{'id':_0x51bab8[_0xc13a('0x45')]['id']}},_0x3539cd={};_0x3539cd['model']=_['keys'](db[_0xc13a('0x29')]['rawAttributes']);_0x3539cd[_0xc13a('0x2e')]=_[_0xc13a('0x2f')](_0x51bab8['query']);_0x3539cd[_0xc13a('0x39')]=_[_0xc13a('0x32')](_0x3539cd['model'],_0x3539cd[_0xc13a('0x2e')]);_0x1c6d75[_0xc13a('0x31')]=_[_0xc13a('0x32')](_0x3539cd[_0xc13a('0x30')],qs[_0xc13a('0x33')](_0x51bab8[_0xc13a('0x2e')][_0xc13a('0x33')]));_0x1c6d75[_0xc13a('0x31')]=_0x1c6d75[_0xc13a('0x31')][_0xc13a('0x34')]?_0x1c6d75[_0xc13a('0x31')]:_0x3539cd['model'];if(_0x51bab8[_0xc13a('0x2e')][_0xc13a('0x40')]){_0x1c6d75['include']=[{'all':!![]}];}_0x1c6d75=_['merge']({},_0x1c6d75,_0x51bab8[_0xc13a('0x3e')]);return db['SquareDetailsReport'][_0xc13a('0x46')](_0x1c6d75)['then'](handleEntityNotFound(_0x12828e,null))[_0xc13a('0x3f')](respondWithResult(_0x12828e,null))[_0xc13a('0x44')](handleError(_0x12828e,null));};exports['create']=function(_0x20e61f,_0x5be2f7){return db[_0xc13a('0x29')][_0xc13a('0x47')](_0x20e61f[_0xc13a('0x48')],{})[_0xc13a('0x3f')](respondWithResult(_0x5be2f7,0xc9))['catch'](handleError(_0x5be2f7,null));};exports[_0xc13a('0x49')]=function(_0x51b472,_0x27d30b){if(_0x51b472[_0xc13a('0x48')]['id']){delete _0x51b472[_0xc13a('0x48')]['id'];}return db['SquareDetailsReport'][_0xc13a('0x46')]({'where':{'id':_0x51b472[_0xc13a('0x45')]['id']}})['then'](handleEntityNotFound(_0x27d30b,null))['then'](saveUpdates(_0x51b472['body'],null))[_0xc13a('0x3f')](respondWithResult(_0x27d30b,null))[_0xc13a('0x44')](handleError(_0x27d30b,null));};exports['destroy']=function(_0x1b5b7c,_0x30808e){return db[_0xc13a('0x29')]['find']({'where':{'id':_0x1b5b7c[_0xc13a('0x45')]['id']}})['then'](handleEntityNotFound(_0x30808e,null))[_0xc13a('0x3f')](removeEntity(_0x30808e,null))['catch'](handleError(_0x30808e,null));};exports['describe']=function(_0x56369f,_0x529c8e){return db[_0xc13a('0x29')][_0xc13a('0x4a')]()['then'](respondWithResult(_0x529c8e,null))['catch'](handleError(_0x529c8e,null));}; \ No newline at end of file +var _0xbbcd=['jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','save','update','then','error','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','lodash','squel'];(function(_0x48f1fe,_0x16e69c){var _0x5adabd=function(_0xf22fde){while(--_0xf22fde){_0x48f1fe['push'](_0x48f1fe['shift']());}};_0x5adabd(++_0x16e69c);}(_0xbbcd,0x13c));var _0xdbbc=function(_0x2ebbf4,_0x2cf31d){_0x2ebbf4=_0x2ebbf4-0x0;var _0x282fec=_0xbbcd[_0x2ebbf4];return _0x282fec;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdbbc('0x0'));var rimraf=require(_0xdbbc('0x1'));var zipdir=require(_0xdbbc('0x2'));var jsonpatch=require(_0xdbbc('0x3'));var rp=require('request-promise');var moment=require(_0xdbbc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbbc('0x5'));var path=require(_0xdbbc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdbbc('0x7'));var squel=require(_0xdbbc('0x8'));var crypto=require('crypto');var jsforce=require(_0xdbbc('0x9'));var deskjs=require(_0xdbbc('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdbbc('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdbbc('0xc'));var as=require(_0xdbbc('0xd'));var hardwareService=require(_0xdbbc('0xe'));var logger=require(_0xdbbc('0xf'))('api');var utils=require(_0xdbbc('0x10'));var config=require(_0xdbbc('0x11'));var licenseUtil=require(_0xdbbc('0x12'));var db=require(_0xdbbc('0x13'))['db'];function respondWithStatusCode(_0x3fa821,_0x52a6bc){_0x52a6bc=_0x52a6bc||0xcc;return function(_0x57708d){if(_0x57708d){return _0x3fa821[_0xdbbc('0x14')](_0x52a6bc);}return _0x3fa821[_0xdbbc('0x15')](_0x52a6bc)[_0xdbbc('0x16')]();};}function respondWithResult(_0x4b6ab7,_0x7715ea){_0x7715ea=_0x7715ea||0xc8;return function(_0x1bd49f){if(_0x1bd49f){return _0x4b6ab7[_0xdbbc('0x15')](_0x7715ea)['json'](_0x1bd49f);}};}function respondWithFilteredResult(_0x22a3c3,_0x588fe0){return function(_0x5daa97){if(_0x5daa97){var _0x560b5a=_0x5daa97[_0xdbbc('0x17')],_0x4d75b8=_0x588fe0[_0xdbbc('0x18')],_0x3c2989=_0x588fe0[_0xdbbc('0x18')]+_0x588fe0[_0xdbbc('0x19')],_0x53c2b3;if(_0x3c2989>=_0x560b5a){_0x3c2989=_0x560b5a;_0x53c2b3=0xc8;}else{_0x53c2b3=0xce;}_0x22a3c3[_0xdbbc('0x15')](_0x53c2b3);return _0x22a3c3[_0xdbbc('0x1a')]('Content-Range',_0x4d75b8+'-'+_0x3c2989+'/'+_0x560b5a)['json'](_0x5daa97);}return null;};}function patchUpdates(_0x1b4949){return function(_0x595a81){try{jsonpatch['apply'](_0x595a81,_0x1b4949,!![]);}catch(_0x158a77){return BPromise['reject'](_0x158a77);}return _0x595a81[_0xdbbc('0x1b')]();};}function saveUpdates(_0x2e3dbc,_0x290757){return function(_0xe70969){if(_0xe70969){return _0xe70969[_0xdbbc('0x1c')](_0x2e3dbc)['then'](function(_0x2d43d6){return _0x2d43d6;});}return null;};}function removeEntity(_0x12b240,_0x18b6cd){return function(_0x42aba7){if(_0x42aba7){return _0x42aba7['destroy']()[_0xdbbc('0x1d')](function(){_0x12b240['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x291f7e,_0x11d16e){return function(_0x157813){if(!_0x157813){_0x291f7e[_0xdbbc('0x14')](0x194);}return _0x157813;};}function handleError(_0x28a909,_0x481bd0){_0x481bd0=_0x481bd0||0x1f4;return function(_0x4f1c7c){logger[_0xdbbc('0x1e')](_0x4f1c7c['stack']);if(_0x4f1c7c[_0xdbbc('0x1f')]){delete _0x4f1c7c['name'];}_0x28a909['status'](_0x481bd0)[_0xdbbc('0x20')](_0x4f1c7c);};}exports['index']=function(_0x34e5d7,_0x44c0ba){var _0x5b3e3d={},_0x35c1a9={},_0x5abc5e={'count':0x0,'rows':[]};var _0x323f0c=_[_0xdbbc('0x21')](db[_0xdbbc('0x22')][_0xdbbc('0x23')],function(_0x3f648f){return{'name':_0x3f648f[_0xdbbc('0x24')],'type':_0x3f648f[_0xdbbc('0x25')][_0xdbbc('0x26')]};});_0x35c1a9[_0xdbbc('0x27')]=_[_0xdbbc('0x21')](_0x323f0c,_0xdbbc('0x1f'));_0x35c1a9[_0xdbbc('0x28')]=_[_0xdbbc('0x29')](_0x34e5d7['query']);_0x35c1a9['filters']=_[_0xdbbc('0x2a')](_0x35c1a9[_0xdbbc('0x27')],_0x35c1a9[_0xdbbc('0x28')]);_0x5b3e3d[_0xdbbc('0x2b')]=_[_0xdbbc('0x2a')](_0x35c1a9[_0xdbbc('0x27')],qs[_0xdbbc('0x2c')](_0x34e5d7[_0xdbbc('0x28')][_0xdbbc('0x2c')]));_0x5b3e3d[_0xdbbc('0x2b')]=_0x5b3e3d[_0xdbbc('0x2b')]['length']?_0x5b3e3d[_0xdbbc('0x2b')]:_0x35c1a9[_0xdbbc('0x27')];if(!_0x34e5d7[_0xdbbc('0x28')][_0xdbbc('0x2d')]('nolimit')){_0x5b3e3d['limit']=qs[_0xdbbc('0x19')](_0x34e5d7['query'][_0xdbbc('0x19')]);_0x5b3e3d[_0xdbbc('0x18')]=qs[_0xdbbc('0x18')](_0x34e5d7['query'][_0xdbbc('0x18')]);}_0x5b3e3d[_0xdbbc('0x2e')]=qs['sort'](_0x34e5d7[_0xdbbc('0x28')][_0xdbbc('0x2f')]);_0x5b3e3d[_0xdbbc('0x30')]=qs[_0xdbbc('0x31')](_['pick'](_0x34e5d7[_0xdbbc('0x28')],_0x35c1a9['filters']),_0x323f0c);if(_0x34e5d7['query'][_0xdbbc('0x32')]){_0x5b3e3d[_0xdbbc('0x30')]=_[_0xdbbc('0x33')](_0x5b3e3d['where'],{'$or':_['map'](_0x323f0c,function(_0x48924b){if(_0x48924b[_0xdbbc('0x25')]!==_0xdbbc('0x34')){var _0x256561={};_0x256561[_0x48924b[_0xdbbc('0x1f')]]={'$like':'%'+_0x34e5d7[_0xdbbc('0x28')]['filter']+'%'};return _0x256561;}})});}_0x5b3e3d=_[_0xdbbc('0x33')]({},_0x5b3e3d,_0x34e5d7[_0xdbbc('0x35')]);var _0x497ce0={'where':_0x5b3e3d[_0xdbbc('0x30')]};return db[_0xdbbc('0x22')][_0xdbbc('0x17')](_0x497ce0)[_0xdbbc('0x1d')](function(_0x37f996){_0x5abc5e[_0xdbbc('0x17')]=_0x37f996;if(_0x34e5d7[_0xdbbc('0x28')][_0xdbbc('0x36')]){_0x5b3e3d[_0xdbbc('0x37')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xdbbc('0x38')](_0x5b3e3d);})[_0xdbbc('0x1d')](function(_0x30dc64){_0x5abc5e['rows']=_0x30dc64;return _0x5abc5e;})[_0xdbbc('0x1d')](respondWithFilteredResult(_0x44c0ba,_0x5b3e3d))['catch'](handleError(_0x44c0ba,null));};exports[_0xdbbc('0x39')]=function(_0xb46fbb,_0x48acc8){var _0x5b609b={'raw':!![],'where':{'id':_0xb46fbb[_0xdbbc('0x3a')]['id']}},_0x2d8908={};_0x2d8908[_0xdbbc('0x27')]=_[_0xdbbc('0x29')](db[_0xdbbc('0x22')][_0xdbbc('0x23')]);_0x2d8908[_0xdbbc('0x28')]=_[_0xdbbc('0x29')](_0xb46fbb[_0xdbbc('0x28')]);_0x2d8908['filters']=_[_0xdbbc('0x2a')](_0x2d8908[_0xdbbc('0x27')],_0x2d8908[_0xdbbc('0x28')]);_0x5b609b[_0xdbbc('0x2b')]=_[_0xdbbc('0x2a')](_0x2d8908[_0xdbbc('0x27')],qs[_0xdbbc('0x2c')](_0xb46fbb['query'][_0xdbbc('0x2c')]));_0x5b609b['attributes']=_0x5b609b['attributes'][_0xdbbc('0x3b')]?_0x5b609b['attributes']:_0x2d8908[_0xdbbc('0x27')];if(_0xb46fbb[_0xdbbc('0x28')][_0xdbbc('0x36')]){_0x5b609b[_0xdbbc('0x37')]=[{'all':!![]}];}_0x5b609b=_[_0xdbbc('0x33')]({},_0x5b609b,_0xb46fbb['options']);return db[_0xdbbc('0x22')][_0xdbbc('0x3c')](_0x5b609b)[_0xdbbc('0x1d')](handleEntityNotFound(_0x48acc8,null))[_0xdbbc('0x1d')](respondWithResult(_0x48acc8,null))[_0xdbbc('0x3d')](handleError(_0x48acc8,null));};exports[_0xdbbc('0x3e')]=function(_0x5d6b14,_0x406712){return db[_0xdbbc('0x22')][_0xdbbc('0x3e')](_0x5d6b14['body'],{})[_0xdbbc('0x1d')](respondWithResult(_0x406712,0xc9))[_0xdbbc('0x3d')](handleError(_0x406712,null));};exports[_0xdbbc('0x1c')]=function(_0x4ac656,_0x1a35a7){if(_0x4ac656[_0xdbbc('0x3f')]['id']){delete _0x4ac656[_0xdbbc('0x3f')]['id'];}return db[_0xdbbc('0x22')][_0xdbbc('0x3c')]({'where':{'id':_0x4ac656[_0xdbbc('0x3a')]['id']}})[_0xdbbc('0x1d')](handleEntityNotFound(_0x1a35a7,null))[_0xdbbc('0x1d')](saveUpdates(_0x4ac656[_0xdbbc('0x3f')],null))[_0xdbbc('0x1d')](respondWithResult(_0x1a35a7,null))[_0xdbbc('0x3d')](handleError(_0x1a35a7,null));};exports['destroy']=function(_0x2f8a8a,_0x544077){return db[_0xdbbc('0x22')][_0xdbbc('0x3c')]({'where':{'id':_0x2f8a8a[_0xdbbc('0x3a')]['id']}})[_0xdbbc('0x1d')](handleEntityNotFound(_0x544077,null))[_0xdbbc('0x1d')](removeEntity(_0x544077,null))['catch'](handleError(_0x544077,null));};exports[_0xdbbc('0x40')]=function(_0x1a2437,_0x29a18b){return db['SquareDetailsReport'][_0xdbbc('0x40')]()[_0xdbbc('0x1d')](respondWithResult(_0x29a18b,null))['catch'](handleError(_0x29a18b,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 47acac1..a7cdace 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 _0xc2b4=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x1bc1cd,_0x3d7658){var _0x533035=function(_0x5039d2){while(--_0x5039d2){_0x1bc1cd['push'](_0x1bc1cd['shift']());}};_0x533035(++_0x3d7658);}(_0xc2b4,0xc5));var _0x4c2b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc2b4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4c2b('0x0'));var util=require(_0x4c2b('0x1'));var logger=require(_0x4c2b('0x2'))(_0x4c2b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4c2b('0x4'));var fs=require('fs');var path=require(_0x4c2b('0x5'));var rimraf=require(_0x4c2b('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c2b('0x7'));module[_0x4c2b('0x8')]=function(_0x5ebefb,_0x23fb00){return _0x5ebefb[_0x4c2b('0x9')](_0x4c2b('0xa'),attributes,{'tableName':_0x4c2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1337=['./squareReportDetail.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x148262,_0x46b871){var _0x589faf=function(_0x447ad4){while(--_0x447ad4){_0x148262['push'](_0x148262['shift']());}};_0x589faf(++_0x46b871);}(_0x1337,0x1ce));var _0x7133=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0x1337[_0x40b2ed];return _0x18397d;};'use strict';var _=require(_0x7133('0x0'));var util=require('util');var logger=require(_0x7133('0x1'))(_0x7133('0x2'));var moment=require(_0x7133('0x3'));var BPromise=require(_0x7133('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7133('0x5'));var config=require('../../config/environment');var attributes=require(_0x7133('0x6'));module[_0x7133('0x7')]=function(_0x44107e,_0x1f5c62){return _0x44107e[_0x7133('0x8')]('SquareDetailsReport',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 72d2e32..0d264ca 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 _0x0d83=['http','then','info','request\x20sent','debug','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s','result','catch','CreateSquareDetailsReport','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0x0d83,0x19e));var _0x30d8=function(_0x51642d,_0x7226d1){_0x51642d=_0x51642d-0x0;var _0x5a0218=_0x0d83[_0x51642d];return _0x5a0218;};'use strict';var _=require(_0x30d8('0x0'));var util=require(_0x30d8('0x1'));var moment=require(_0x30d8('0x2'));var BPromise=require(_0x30d8('0x3'));var rs=require(_0x30d8('0x4'));var fs=require('fs');var Redis=require(_0x30d8('0x5'));var db=require(_0x30d8('0x6'))['db'];var utils=require(_0x30d8('0x7'));var logger=require('../../config/logger')(_0x30d8('0x8'));var config=require(_0x30d8('0x9'));var jayson=require(_0x30d8('0xa'));var client=jayson['client'][_0x30d8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f1a79,_0x251d55,_0xffe3bc){return new BPromise(function(_0x3166bb,_0x36d877){return client['request'](_0x4f1a79,_0xffe3bc)[_0x30d8('0xc')](function(_0x3f0f32){logger[_0x30d8('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x251d55,_0x30d8('0xe'));logger[_0x30d8('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x251d55,_0x30d8('0xe'),JSON[_0x30d8('0x10')](_0x3f0f32));if(_0x3f0f32['error']){if(_0x3f0f32[_0x30d8('0x11')][_0x30d8('0x12')]===0x1f4){logger[_0x30d8('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x251d55,_0x3f0f32[_0x30d8('0x11')][_0x30d8('0x13')]);return _0x36d877(_0x3f0f32[_0x30d8('0x11')]['message']);}logger[_0x30d8('0x11')](_0x30d8('0x14'),_0x251d55,_0x3f0f32[_0x30d8('0x11')]['message']);return _0x3166bb(_0x3f0f32['error'][_0x30d8('0x13')]);}else{logger[_0x30d8('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x251d55,_0x30d8('0xe'));_0x3166bb(_0x3f0f32[_0x30d8('0x15')][_0x30d8('0x13')]);}})[_0x30d8('0x16')](function(_0x1a4308){logger[_0x30d8('0x11')](_0x30d8('0x14'),_0x251d55,_0x1a4308);_0x36d877(_0x1a4308);});});}exports[_0x30d8('0x17')]=function(_0x51620a){var _0x3dac67=this;return new Promise(function(_0x370d10,_0x3e42e6){return db['SquareDetailsReport']['create'](_0x51620a['body'],{'raw':_0x51620a[_0x30d8('0x18')]?_0x51620a['options']['raw']===undefined?!![]:![]:!![]})[_0x30d8('0xc')](function(_0x16a700){logger[_0x30d8('0xd')]('CreateSquareDetailsReport',_0x51620a);logger[_0x30d8('0xf')](_0x30d8('0x17'),_0x51620a,JSON[_0x30d8('0x10')](_0x16a700));_0x370d10(_0x16a700);})[_0x30d8('0x16')](function(_0x28263c){logger[_0x30d8('0x11')](_0x30d8('0x17'),_0x28263c[_0x30d8('0x13')],_0x51620a);_0x3e42e6(_0x3dac67[_0x30d8('0x11')](0x1f4,_0x28263c[_0x30d8('0x13')]));});});}; \ No newline at end of file +var _0xe791=['then','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xe791,0x110));var _0x1e79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe791[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e79('0x0'));var util=require(_0x1e79('0x1'));var moment=require('moment');var BPromise=require(_0x1e79('0x2'));var rs=require(_0x1e79('0x3'));var fs=require('fs');var Redis=require(_0x1e79('0x4'));var db=require(_0x1e79('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e79('0x6'))(_0x1e79('0x7'));var config=require(_0x1e79('0x8'));var jayson=require(_0x1e79('0x9'));var client=jayson[_0x1e79('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x269044,_0x53987b,_0x2bd3d6){return new BPromise(function(_0x27beb7,_0x1c38f7){return client['request'](_0x269044,_0x2bd3d6)['then'](function(_0x3e9e2c){logger['info'](_0x1e79('0xb'),_0x53987b,_0x1e79('0xc'));logger[_0x1e79('0xd')](_0x1e79('0xe'),_0x53987b,_0x1e79('0xc'),JSON[_0x1e79('0xf')](_0x3e9e2c));if(_0x3e9e2c[_0x1e79('0x10')]){if(_0x3e9e2c[_0x1e79('0x10')]['code']===0x1f4){logger[_0x1e79('0x10')](_0x1e79('0xb'),_0x53987b,_0x3e9e2c[_0x1e79('0x10')][_0x1e79('0x11')]);return _0x1c38f7(_0x3e9e2c[_0x1e79('0x10')]['message']);}logger['error'](_0x1e79('0xb'),_0x53987b,_0x3e9e2c[_0x1e79('0x10')][_0x1e79('0x11')]);return _0x27beb7(_0x3e9e2c[_0x1e79('0x10')][_0x1e79('0x11')]);}else{logger['info'](_0x1e79('0xb'),_0x53987b,'request\x20sent');_0x27beb7(_0x3e9e2c[_0x1e79('0x12')][_0x1e79('0x11')]);}})[_0x1e79('0x13')](function(_0x4bb38c){logger['error'](_0x1e79('0xb'),_0x53987b,_0x4bb38c);_0x1c38f7(_0x4bb38c);});});}exports[_0x1e79('0x14')]=function(_0x2af827){var _0x599de9=this;return new Promise(function(_0x4b38d0,_0x4660e0){return db[_0x1e79('0x15')][_0x1e79('0x16')](_0x2af827[_0x1e79('0x17')],{'raw':_0x2af827[_0x1e79('0x18')]?_0x2af827[_0x1e79('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x1e79('0x19')](function(_0x435ae9){logger[_0x1e79('0x1a')](_0x1e79('0x14'),_0x2af827);logger[_0x1e79('0xd')](_0x1e79('0x14'),_0x2af827,JSON[_0x1e79('0xf')](_0x435ae9));_0x4b38d0(_0x435ae9);})[_0x1e79('0x13')](function(_0xc17c18){logger['error'](_0x1e79('0x14'),_0xc17c18[_0x1e79('0x11')],_0x2af827);_0x4660e0(_0x599de9['error'](0x1f4,_0xc17c18['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 9dd2daa..e5a635e 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 _0xdc30=['index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x4161c2,_0x1daec7){var _0x5bf9df=function(_0x12c04c){while(--_0x12c04c){_0x4161c2['push'](_0x4161c2['shift']());}};_0x5bf9df(++_0x1daec7);}(_0xdc30,0x194));var _0x0dc3=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0xdc30[_0x3ee1fe];return _0x1ae57a;};'use strict';var express=require(_0x0dc3('0x0'));var router=express[_0x0dc3('0x1')]();var auth=require(_0x0dc3('0x2'));var controller=require(_0x0dc3('0x3'));router[_0x0dc3('0x4')]('/',auth[_0x0dc3('0x5')](),controller[_0x0dc3('0x6')]);router[_0x0dc3('0x4')](_0x0dc3('0x7'),auth[_0x0dc3('0x5')](),controller[_0x0dc3('0x8')]);module[_0x0dc3('0x9')]=router; \ No newline at end of file +var _0x0cef=['express','../../components/auth/service','./system.controller','get','isAuthenticated','index','killProcess','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0cef,0xe0));var _0xf0ce=function(_0x2a1465,_0x8bf785){_0x2a1465=_0x2a1465-0x0;var _0x128933=_0x0cef[_0x2a1465];return _0x128933;};'use strict';var express=require(_0xf0ce('0x0'));var router=express['Router']();var auth=require(_0xf0ce('0x1'));var controller=require(_0xf0ce('0x2'));router[_0xf0ce('0x3')]('/',auth[_0xf0ce('0x4')](),controller[_0xf0ce('0x5')]);router[_0xf0ce('0x3')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0xf0ce('0x6')]);module[_0xf0ce('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 7e88833..015878d 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 _0xf2c5=['params','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','index','getAllData','then','status','json','killProcess','components/import/cm','format','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2c5,0x6d));var _0x5f2c=function(_0x52afe4,_0x1a3ee4){_0x52afe4=_0x52afe4-0x0;var _0x32744d=_0xf2c5[_0x52afe4];return _0x32744d;};'use strict';var info=require(_0x5f2c('0x0'));var exec=require(_0x5f2c('0x1'))[_0x5f2c('0x2')];var logger=require('../../config/logger')(_0x5f2c('0x3'));var util=require(_0x5f2c('0x4'));var BPromise=require(_0x5f2c('0x5'));var _=require(_0x5f2c('0x6'));function handleError(_0x2e9738,_0x2cfade,_0x1b553d){_0x2cfade=_0x2cfade||0x1f4;return function(_0x2678d7){logger[_0x5f2c('0x7')](_0x5f2c('0x8'),_0x1b553d,_0x2cfade,util['inspect'](_0x2678d7,{'showHidden':![],'depth':null}));delete _0x2678d7[_0x5f2c('0x9')];_0x2e9738['status'](_0x2cfade)['send'](_0x2678d7);};}exports[_0x5f2c('0xa')]=function(_0x12c7da,_0x3bff76){return info[_0x5f2c('0xb')]()[_0x5f2c('0xc')](function(_0x1e1142){return _0x3bff76[_0x5f2c('0xd')](0xc8)[_0x5f2c('0xe')](_0x1e1142);})['catch'](function(_0x3646ef){return _0x3bff76['status'](0x1f4)[_0x5f2c('0xe')](_0x3646ef);});};exports[_0x5f2c('0xf')]=function(_0x5bc211,_0x389495){var _0x394e2b=[_0x5f2c('0x10')];return new BPromise(function(_0x8812ef,_0x49d301){return exec(util[_0x5f2c('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x5bc211['params']['pid']),function(_0xf23f20,_0x597c34,_0x30bf15){if(_0xf23f20){return _0x49d301(_0xf23f20);}return _0x8812ef(_0x597c34);});})['then'](function(_0x275190){var _0x4b3c74=![];var _0xee7444=_0x275190['split'](/\n/);for(var _0x5e0232=0x0,_0x3fa123=_0x394e2b[_0x5f2c('0x12')];_0x5e0232<_0x3fa123,_0x4b3c74===![];_0x5e0232+=0x1){if(_0x275190[_0x5f2c('0x13')](_0x394e2b[_0x5e0232])>=0x0){_0x4b3c74=!![];}}if(!_0x4b3c74){throw new Error(util[_0x5f2c('0x11')](_0x5f2c('0x14'),_0x5bc211[_0x5f2c('0x15')][_0x5f2c('0x16')]));}process[_0x5f2c('0x17')](_0x5bc211['params'][_0x5f2c('0x16')],_0x5f2c('0x18'));return _0x389495[_0x5f2c('0xd')](0xc8)['json']({'message':util['format'](_0x5f2c('0x19'),_0x5bc211[_0x5f2c('0x15')][_0x5f2c('0x16')])});})['catch'](handleError(_0x389495,null,_0x5f2c('0xf')));}; \ No newline at end of file +var _0xafc8=['kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','bluebird','lodash','error','inspect','name','status','index','getAllData','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x281524,_0x5bf46d){var _0x5da78e=function(_0x41f228){while(--_0x41f228){_0x281524['push'](_0x281524['shift']());}};_0x5da78e(++_0x5bf46d);}(_0xafc8,0x7a));var _0x8afc=function(_0x51e678,_0x11cf14){_0x51e678=_0x51e678-0x0;var _0x2444da=_0xafc8[_0x51e678];return _0x2444da;};'use strict';var info=require(_0x8afc('0x0'));var exec=require('child_process')[_0x8afc('0x1')];var logger=require('../../config/logger')(_0x8afc('0x2'));var util=require('util');var BPromise=require(_0x8afc('0x3'));var _=require(_0x8afc('0x4'));function handleError(_0xdae86f,_0x59a9b3,_0x55742f){_0x59a9b3=_0x59a9b3||0x1f4;return function(_0x3009f8){logger[_0x8afc('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x55742f,_0x59a9b3,util[_0x8afc('0x6')](_0x3009f8,{'showHidden':![],'depth':null}));delete _0x3009f8[_0x8afc('0x7')];_0xdae86f[_0x8afc('0x8')](_0x59a9b3)['send'](_0x3009f8);};}exports[_0x8afc('0x9')]=function(_0x1120a9,_0x616c4a){return info[_0x8afc('0xa')]()[_0x8afc('0xb')](function(_0x3f152f){return _0x616c4a['status'](0xc8)[_0x8afc('0xc')](_0x3f152f);})[_0x8afc('0xd')](function(_0x43d725){return _0x616c4a[_0x8afc('0x8')](0x1f4)['json'](_0x43d725);});};exports[_0x8afc('0xe')]=function(_0x5ddac6,_0x132e38){var _0x375853=['components/import/cm'];return new BPromise(function(_0x33a83b,_0x3d5507){return exec(util[_0x8afc('0xf')](_0x8afc('0x10'),_0x5ddac6[_0x8afc('0x11')][_0x8afc('0x12')]),function(_0x597e15,_0x497750,_0x101866){if(_0x597e15){return _0x3d5507(_0x597e15);}return _0x33a83b(_0x497750);});})[_0x8afc('0xb')](function(_0x971a42){var _0x78a77e=![];var _0x457c2b=_0x971a42[_0x8afc('0x13')](/\n/);for(var _0x646e67=0x0,_0x51e5f5=_0x375853[_0x8afc('0x14')];_0x646e67<_0x51e5f5,_0x78a77e===![];_0x646e67+=0x1){if(_0x971a42['indexOf'](_0x375853[_0x646e67])>=0x0){_0x78a77e=!![];}}if(!_0x78a77e){throw new Error(util[_0x8afc('0xf')](_0x8afc('0x15'),_0x5ddac6[_0x8afc('0x11')][_0x8afc('0x12')]));}process[_0x8afc('0x16')](_0x5ddac6[_0x8afc('0x11')][_0x8afc('0x12')],'SIGINT');return _0x132e38[_0x8afc('0x8')](0xc8)['json']({'message':util[_0x8afc('0xf')](_0x8afc('0x17'),_0x5ddac6[_0x8afc('0x11')][_0x8afc('0x12')])});})[_0x8afc('0xd')](handleError(_0x132e38,null,_0x8afc('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 1f955a1..f2f0250 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 _0xdace=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','exports','multer'];(function(_0x12d436,_0x5d25b2){var _0x1be2ed=function(_0x467a2c){while(--_0x467a2c){_0x12d436['push'](_0x12d436['shift']());}};_0x1be2ed(++_0x5d25b2);}(_0xdace,0xc5));var _0xedac=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0xdace[_0x29d623];return _0x242e59;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var auth=require(_0xedac('0x4'));var interaction=require(_0xedac('0x5'));var config=require(_0xedac('0x6'));var controller=require(_0xedac('0x7'));router['get']('/',auth[_0xedac('0x8')](),controller[_0xedac('0x9')]);router[_0xedac('0xa')]('/:id',auth[_0xedac('0x8')](),controller[_0xedac('0xb')]);router[_0xedac('0xc')]('/',auth['isAuthenticated'](),controller[_0xedac('0xd')]);router[_0xedac('0xe')](_0xedac('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xedac('0x10')](_0xedac('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xedac('0x11')]=router; \ No newline at end of file +var _0x878f=['update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','create'];(function(_0x5919be,_0x546dc2){var _0x4a63ff=function(_0xc4702e){while(--_0xc4702e){_0x5919be['push'](_0x5919be['shift']());}};_0x4a63ff(++_0x546dc2);}(_0x878f,0x173));var _0xf878=function(_0x2ce77e,_0x4ccce9){_0x2ce77e=_0x2ce77e-0x0;var _0x430058=_0x878f[_0x2ce77e];return _0x430058;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var auth=require(_0xf878('0x5'));var interaction=require(_0xf878('0x6'));var config=require(_0xf878('0x7'));var controller=require(_0xf878('0x8'));router[_0xf878('0x9')]('/',auth[_0xf878('0xa')](),controller['index']);router['get'](_0xf878('0xb'),auth[_0xf878('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf878('0xc')]);router['put']('/:id',auth[_0xf878('0xa')](),controller[_0xf878('0xd')]);router[_0xf878('0xe')]('/:id',auth[_0xf878('0xa')](),controller[_0xf878('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index ff99a53..30ab184 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 _0xd8b0=['STRING','sequelize','exports','#0091EA'];(function(_0x16d1b6,_0x5912db){var _0x2ca1f5=function(_0x219bda){while(--_0x219bda){_0x16d1b6['push'](_0x16d1b6['shift']());}};_0x2ca1f5(++_0x5912db);}(_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')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x2')},'description':{'type':Sequelize[_0x0d8b('0x3')]}}; \ No newline at end of file +var _0x4483=['exports','STRING','#0091EA','sequelize'];(function(_0x335520,_0x891d7d){var _0x2fc639=function(_0x3c505a){while(--_0x3c505a){_0x335520['push'](_0x335520['shift']());}};_0x2fc639(++_0x891d7d);}(_0x4483,0x1a3));var _0x3448=function(_0x7e672a,_0x50081d){_0x7e672a=_0x7e672a-0x0;var _0x2d42a2=_0x4483[_0x7e672a];return _0x2d42a2;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'name':{'type':Sequelize[_0x3448('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3448('0x2')],'defaultValue':_0x3448('0x3')},'description':{'type':Sequelize[_0x3448('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 4dec0d2..e2f7417 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 _0xc760=['rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','squel','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','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','Tags','UserProfileResource','destroy','end','error','stack','index','map','Tag'];(function(_0x264863,_0x2566d6){var _0x8f3004=function(_0x1461b3){while(--_0x1461b3){_0x264863['push'](_0x264863['shift']());}};_0x8f3004(++_0x2566d6);}(_0xc760,0x76));var _0x0c76=function(_0xd6babd,_0x2a3104){_0xd6babd=_0xd6babd-0x0;var _0x1dcee4=_0xc760[_0xd6babd];return _0x1dcee4;};'use strict';var pdf=require(_0x0c76('0x0'));var emlformat=require(_0x0c76('0x1'));var rimraf=require(_0x0c76('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c76('0x3'));var rp=require(_0x0c76('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0c76('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0c76('0x6'));var csv=require(_0x0c76('0x7'));var ejs=require(_0x0c76('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0c76('0x9'));var crypto=require('crypto');var jsforce=require(_0x0c76('0xa'));var deskjs=require(_0x0c76('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0c76('0xc'));var Papa=require(_0x0c76('0xd'));var Redis=require('ioredis');var authService=require(_0x0c76('0xe'));var qs=require(_0x0c76('0xf'));var as=require(_0x0c76('0x10'));var hardwareService=require(_0x0c76('0x11'));var logger=require(_0x0c76('0x12'))('api');var utils=require(_0x0c76('0x13'));var config=require(_0x0c76('0x14'));var licenseUtil=require(_0x0c76('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56ea75,_0x3a82ad){_0x3a82ad=_0x3a82ad||0xcc;return function(_0x26a179){if(_0x26a179){return _0x56ea75[_0x0c76('0x16')](_0x3a82ad);}return _0x56ea75[_0x0c76('0x17')](_0x3a82ad)['end']();};}function respondWithResult(_0xae88b7,_0x13a000){_0x13a000=_0x13a000||0xc8;return function(_0x50e27e){if(_0x50e27e){return _0xae88b7[_0x0c76('0x17')](_0x13a000)[_0x0c76('0x18')](_0x50e27e);}};}function respondWithFilteredResult(_0x50e8b7,_0x4f103c){return function(_0x10fccd){if(_0x10fccd){var _0x24bf02=_0x10fccd[_0x0c76('0x19')],_0x1b8836=_0x4f103c[_0x0c76('0x1a')],_0x5df6d7=_0x4f103c[_0x0c76('0x1a')]+_0x4f103c[_0x0c76('0x1b')],_0x58d838;if(_0x5df6d7>=_0x24bf02){_0x5df6d7=_0x24bf02;_0x58d838=0xc8;}else{_0x58d838=0xce;}_0x50e8b7[_0x0c76('0x17')](_0x58d838);return _0x50e8b7[_0x0c76('0x1c')](_0x0c76('0x1d'),_0x1b8836+'-'+_0x5df6d7+'/'+_0x24bf02)[_0x0c76('0x18')](_0x10fccd);}return null;};}function patchUpdates(_0x45f15e){return function(_0x154140){try{jsonpatch[_0x0c76('0x1e')](_0x154140,_0x45f15e,!![]);}catch(_0x5979e6){return BPromise[_0x0c76('0x1f')](_0x5979e6);}return _0x154140[_0x0c76('0x20')]();};}function saveUpdates(_0xd9fcc2,_0x287b06){return function(_0x2b408c){if(_0x2b408c){return _0x2b408c['update'](_0xd9fcc2)[_0x0c76('0x21')](function(_0x1bfce3){return _0x1bfce3;});}return null;};}function removeEntity(_0x4798b1,_0x30c270){return function(_0x106e07){if(_0x106e07){return _0x106e07['destroy']()[_0x0c76('0x21')](function(){var _0x43086d=_0x106e07[_0x0c76('0x22')]({'plain':!![]});var _0x5f5858=_0x0c76('0x23');return db[_0x0c76('0x24')][_0x0c76('0x25')]({'where':{'type':_0x5f5858,'resourceId':_0x43086d['id']}})[_0x0c76('0x21')](function(){return _0x106e07;});})[_0x0c76('0x21')](function(){_0x4798b1[_0x0c76('0x17')](0xcc)[_0x0c76('0x26')]();});}};}function handleEntityNotFound(_0xb9ac7c,_0x35cddd){return function(_0x17cc0c){if(!_0x17cc0c){_0xb9ac7c[_0x0c76('0x16')](0x194);}return _0x17cc0c;};}function handleError(_0x28cf3d,_0x47012c){_0x47012c=_0x47012c||0x1f4;return function(_0x13ee56){logger[_0x0c76('0x27')](_0x13ee56[_0x0c76('0x28')]);if(_0x13ee56['name']){delete _0x13ee56['name'];}_0x28cf3d['status'](_0x47012c)['send'](_0x13ee56);};}exports[_0x0c76('0x29')]=function(_0x59b082,_0x1b3218){var _0x1330f5={},_0x5925e5={},_0x4d8ac9={'count':0x0,'rows':[]};var _0x4d0cd1=_[_0x0c76('0x2a')](db[_0x0c76('0x2b')][_0x0c76('0x2c')],function(_0x2bfa25){return{'name':_0x2bfa25['fieldName'],'type':_0x2bfa25[_0x0c76('0x2d')][_0x0c76('0x2e')]};});_0x5925e5[_0x0c76('0x2f')]=_[_0x0c76('0x2a')](_0x4d0cd1,_0x0c76('0x30'));_0x5925e5[_0x0c76('0x31')]=_[_0x0c76('0x32')](_0x59b082[_0x0c76('0x31')]);_0x5925e5[_0x0c76('0x33')]=_[_0x0c76('0x34')](_0x5925e5[_0x0c76('0x2f')],_0x5925e5[_0x0c76('0x31')]);_0x1330f5[_0x0c76('0x35')]=_['intersection'](_0x5925e5[_0x0c76('0x2f')],qs[_0x0c76('0x36')](_0x59b082[_0x0c76('0x31')][_0x0c76('0x36')]));_0x1330f5[_0x0c76('0x35')]=_0x1330f5['attributes'][_0x0c76('0x37')]?_0x1330f5[_0x0c76('0x35')]:_0x5925e5['model'];if(!_0x59b082[_0x0c76('0x31')]['hasOwnProperty'](_0x0c76('0x38'))){_0x1330f5[_0x0c76('0x1b')]=qs[_0x0c76('0x1b')](_0x59b082[_0x0c76('0x31')][_0x0c76('0x1b')]);_0x1330f5[_0x0c76('0x1a')]=qs[_0x0c76('0x1a')](_0x59b082[_0x0c76('0x31')]['offset']);}_0x1330f5[_0x0c76('0x39')]=qs[_0x0c76('0x3a')](_0x59b082[_0x0c76('0x31')][_0x0c76('0x3a')]);_0x1330f5['where']=qs[_0x0c76('0x33')](_['pick'](_0x59b082[_0x0c76('0x31')],_0x5925e5['filters']),_0x4d0cd1);if(_0x59b082[_0x0c76('0x31')][_0x0c76('0x3b')]){_0x1330f5[_0x0c76('0x3c')]=_[_0x0c76('0x3d')](_0x1330f5[_0x0c76('0x3c')],{'$or':_[_0x0c76('0x2a')](_0x4d0cd1,function(_0x24a533){if(_0x24a533[_0x0c76('0x2d')]!==_0x0c76('0x3e')){var _0x3a0daf={};_0x3a0daf[_0x24a533[_0x0c76('0x30')]]={'$like':'%'+_0x59b082['query'][_0x0c76('0x3b')]+'%'};return _0x3a0daf;}})});}_0x1330f5=_[_0x0c76('0x3d')]({},_0x1330f5,_0x59b082[_0x0c76('0x3f')]);var _0x5c893f={'where':_0x1330f5[_0x0c76('0x3c')]};return db['Tag'][_0x0c76('0x19')](_0x5c893f)[_0x0c76('0x21')](function(_0x22c64c){_0x4d8ac9['count']=_0x22c64c;if(_0x59b082['query']['includeAll']){_0x1330f5['include']=[{'all':!![]}];}return db['Tag'][_0x0c76('0x40')](_0x1330f5);})[_0x0c76('0x21')](function(_0x463646){_0x4d8ac9[_0x0c76('0x41')]=_0x463646;return _0x4d8ac9;})[_0x0c76('0x21')](respondWithFilteredResult(_0x1b3218,_0x1330f5))[_0x0c76('0x42')](handleError(_0x1b3218,null));};exports[_0x0c76('0x43')]=function(_0x59b680,_0x4d24fe){var _0x39ca3b={'raw':!![],'where':{'id':_0x59b680['params']['id']}},_0x53a5e2={};_0x53a5e2['model']=_[_0x0c76('0x32')](db[_0x0c76('0x2b')][_0x0c76('0x2c')]);_0x53a5e2[_0x0c76('0x31')]=_[_0x0c76('0x32')](_0x59b680[_0x0c76('0x31')]);_0x53a5e2['filters']=_['intersection'](_0x53a5e2[_0x0c76('0x2f')],_0x53a5e2[_0x0c76('0x31')]);_0x39ca3b[_0x0c76('0x35')]=_[_0x0c76('0x34')](_0x53a5e2[_0x0c76('0x2f')],qs[_0x0c76('0x36')](_0x59b680['query'][_0x0c76('0x36')]));_0x39ca3b[_0x0c76('0x35')]=_0x39ca3b['attributes'][_0x0c76('0x37')]?_0x39ca3b[_0x0c76('0x35')]:_0x53a5e2['model'];if(_0x59b680['query'][_0x0c76('0x44')]){_0x39ca3b[_0x0c76('0x45')]=[{'all':!![]}];}_0x39ca3b=_['merge']({},_0x39ca3b,_0x59b680[_0x0c76('0x3f')]);return db[_0x0c76('0x2b')][_0x0c76('0x46')](_0x39ca3b)[_0x0c76('0x21')](handleEntityNotFound(_0x4d24fe,null))[_0x0c76('0x21')](respondWithResult(_0x4d24fe,null))[_0x0c76('0x42')](handleError(_0x4d24fe,null));};exports[_0x0c76('0x47')]=function(_0x4da0d1,_0x1fc4e8){return db[_0x0c76('0x2b')][_0x0c76('0x47')](_0x4da0d1['body'],{})[_0x0c76('0x21')](function(_0x545a67){var _0x2e7931=_0x4da0d1['user']['get']({'plain':!![]});if(!_0x2e7931)throw new Error(_0x0c76('0x48'));if(_0x2e7931[_0x0c76('0x49')]===_0x0c76('0x4a')){var _0x593430=_0x545a67[_0x0c76('0x22')]({'plain':!![]});var _0x40e05b=_0x0c76('0x23');return db[_0x0c76('0x4b')][_0x0c76('0x46')]({'where':{'name':_0x40e05b,'userProfileId':_0x2e7931[_0x0c76('0x4c')]},'raw':!![]})[_0x0c76('0x21')](function(_0x16e181){if(_0x16e181&&_0x16e181['autoAssociation']===0x0){return db[_0x0c76('0x24')][_0x0c76('0x47')]({'name':_0x593430[_0x0c76('0x30')],'resourceId':_0x593430['id'],'type':_0x16e181[_0x0c76('0x30')],'sectionId':_0x16e181['id']},{})[_0x0c76('0x21')](function(){return _0x545a67;});}else{return _0x545a67;}})[_0x0c76('0x42')](function(_0x41a8d7){logger[_0x0c76('0x27')](_0x0c76('0x4d'),_0x41a8d7);throw _0x41a8d7;});}return _0x545a67;})[_0x0c76('0x21')](respondWithResult(_0x1fc4e8,0xc9))[_0x0c76('0x42')](handleError(_0x1fc4e8,null));};exports[_0x0c76('0x4e')]=function(_0x5280c2,_0xc55f8b){if(_0x5280c2[_0x0c76('0x4f')]['id']){delete _0x5280c2['body']['id'];}return db['Tag'][_0x0c76('0x46')]({'where':{'id':_0x5280c2[_0x0c76('0x50')]['id']}})[_0x0c76('0x21')](handleEntityNotFound(_0xc55f8b,null))[_0x0c76('0x21')](saveUpdates(_0x5280c2['body'],null))['then'](respondWithResult(_0xc55f8b,null))[_0x0c76('0x42')](handleError(_0xc55f8b,null));};exports['destroy']=function(_0x336c24,_0xe67ffe){return db[_0x0c76('0x2b')][_0x0c76('0x46')]({'where':{'id':_0x336c24['params']['id']}})[_0x0c76('0x21')](handleEntityNotFound(_0xe67ffe,null))[_0x0c76('0x21')](removeEntity(_0xe67ffe,null))[_0x0c76('0x42')](handleError(_0xe67ffe,null));}; \ No newline at end of file +var _0x3425=['limit','set','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Tag','type','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','autoAssociation','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x566342,_0x4a8a5d){var _0x1271e6=function(_0x294661){while(--_0x294661){_0x566342['push'](_0x566342['shift']());}};_0x1271e6(++_0x4a8a5d);}(_0x3425,0x17e));var _0x5342=function(_0x4b8805,_0x56d7f1){_0x4b8805=_0x4b8805-0x0;var _0x527223=_0x3425[_0x4b8805];return _0x527223;};'use strict';var pdf=require(_0x5342('0x0'));var emlformat=require(_0x5342('0x1'));var rimraf=require(_0x5342('0x2'));var zipdir=require(_0x5342('0x3'));var jsonpatch=require(_0x5342('0x4'));var rp=require(_0x5342('0x5'));var moment=require(_0x5342('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5342('0x7'));var util=require(_0x5342('0x8'));var path=require(_0x5342('0x9'));var sox=require(_0x5342('0xa'));var csv=require(_0x5342('0xb'));var ejs=require(_0x5342('0xc'));var fs=require('fs');var _=require(_0x5342('0xd'));var squel=require(_0x5342('0xe'));var crypto=require(_0x5342('0xf'));var jsforce=require(_0x5342('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5342('0xb'));var querystring=require(_0x5342('0x11'));var Papa=require('papaparse');var Redis=require(_0x5342('0x12'));var authService=require(_0x5342('0x13'));var qs=require(_0x5342('0x14'));var as=require(_0x5342('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5342('0x16'))('api');var utils=require(_0x5342('0x17'));var config=require(_0x5342('0x18'));var licenseUtil=require(_0x5342('0x19'));var db=require(_0x5342('0x1a'))['db'];function respondWithStatusCode(_0x1ef312,_0x1fc53f){_0x1fc53f=_0x1fc53f||0xcc;return function(_0x3ca98e){if(_0x3ca98e){return _0x1ef312[_0x5342('0x1b')](_0x1fc53f);}return _0x1ef312[_0x5342('0x1c')](_0x1fc53f)[_0x5342('0x1d')]();};}function respondWithResult(_0x50d7bb,_0x206ec4){_0x206ec4=_0x206ec4||0xc8;return function(_0x39856b){if(_0x39856b){return _0x50d7bb['status'](_0x206ec4)[_0x5342('0x1e')](_0x39856b);}};}function respondWithFilteredResult(_0x4a11ec,_0x5a057e){return function(_0x9a3a0c){if(_0x9a3a0c){var _0x738c6b=_0x9a3a0c[_0x5342('0x1f')],_0x38fdbb=_0x5a057e['offset'],_0x51a3d1=_0x5a057e[_0x5342('0x20')]+_0x5a057e[_0x5342('0x21')],_0x329a99;if(_0x51a3d1>=_0x738c6b){_0x51a3d1=_0x738c6b;_0x329a99=0xc8;}else{_0x329a99=0xce;}_0x4a11ec[_0x5342('0x1c')](_0x329a99);return _0x4a11ec[_0x5342('0x22')]('Content-Range',_0x38fdbb+'-'+_0x51a3d1+'/'+_0x738c6b)[_0x5342('0x1e')](_0x9a3a0c);}return null;};}function patchUpdates(_0x217e9e){return function(_0x1d3dae){try{jsonpatch['apply'](_0x1d3dae,_0x217e9e,!![]);}catch(_0x462ce0){return BPromise[_0x5342('0x23')](_0x462ce0);}return _0x1d3dae[_0x5342('0x24')]();};}function saveUpdates(_0x5f6a5c,_0x1e7940){return function(_0x3f7bca){if(_0x3f7bca){return _0x3f7bca[_0x5342('0x25')](_0x5f6a5c)[_0x5342('0x26')](function(_0x42ba0f){return _0x42ba0f;});}return null;};}function removeEntity(_0x2418ef,_0x295a30){return function(_0x179a28){if(_0x179a28){return _0x179a28[_0x5342('0x27')]()['then'](function(){var _0x195aab=_0x179a28[_0x5342('0x28')]({'plain':!![]});var _0x56f863='Tags';return db[_0x5342('0x29')][_0x5342('0x27')]({'where':{'type':_0x56f863,'resourceId':_0x195aab['id']}})[_0x5342('0x26')](function(){return _0x179a28;});})['then'](function(){_0x2418ef[_0x5342('0x1c')](0xcc)[_0x5342('0x1d')]();});}};}function handleEntityNotFound(_0x6cf76,_0x1683dd){return function(_0x252fa6){if(!_0x252fa6){_0x6cf76[_0x5342('0x1b')](0x194);}return _0x252fa6;};}function handleError(_0x2e21f4,_0x46ce0d){_0x46ce0d=_0x46ce0d||0x1f4;return function(_0x9a046e){logger[_0x5342('0x2a')](_0x9a046e[_0x5342('0x2b')]);if(_0x9a046e[_0x5342('0x2c')]){delete _0x9a046e[_0x5342('0x2c')];}_0x2e21f4[_0x5342('0x1c')](_0x46ce0d)[_0x5342('0x2d')](_0x9a046e);};}exports[_0x5342('0x2e')]=function(_0x3fbceb,_0x2f409c){var _0x13d570={},_0x4c563b={},_0x3d151e={'count':0x0,'rows':[]};var _0x47cd81=_['map'](db[_0x5342('0x2f')]['rawAttributes'],function(_0x4d94e2){return{'name':_0x4d94e2['fieldName'],'type':_0x4d94e2[_0x5342('0x30')][_0x5342('0x31')]};});_0x4c563b[_0x5342('0x32')]=_[_0x5342('0x33')](_0x47cd81,'name');_0x4c563b['query']=_[_0x5342('0x34')](_0x3fbceb['query']);_0x4c563b['filters']=_[_0x5342('0x35')](_0x4c563b[_0x5342('0x32')],_0x4c563b[_0x5342('0x36')]);_0x13d570[_0x5342('0x37')]=_['intersection'](_0x4c563b[_0x5342('0x32')],qs[_0x5342('0x38')](_0x3fbceb[_0x5342('0x36')][_0x5342('0x38')]));_0x13d570[_0x5342('0x37')]=_0x13d570['attributes']['length']?_0x13d570['attributes']:_0x4c563b[_0x5342('0x32')];if(!_0x3fbceb[_0x5342('0x36')][_0x5342('0x39')]('nolimit')){_0x13d570[_0x5342('0x21')]=qs[_0x5342('0x21')](_0x3fbceb['query']['limit']);_0x13d570['offset']=qs[_0x5342('0x20')](_0x3fbceb[_0x5342('0x36')][_0x5342('0x20')]);}_0x13d570[_0x5342('0x3a')]=qs['sort'](_0x3fbceb[_0x5342('0x36')][_0x5342('0x3b')]);_0x13d570[_0x5342('0x3c')]=qs[_0x5342('0x3d')](_[_0x5342('0x3e')](_0x3fbceb[_0x5342('0x36')],_0x4c563b[_0x5342('0x3d')]),_0x47cd81);if(_0x3fbceb[_0x5342('0x36')][_0x5342('0x3f')]){_0x13d570['where']=_[_0x5342('0x40')](_0x13d570[_0x5342('0x3c')],{'$or':_['map'](_0x47cd81,function(_0x10a587){if(_0x10a587[_0x5342('0x30')]!=='VIRTUAL'){var _0x550dd8={};_0x550dd8[_0x10a587[_0x5342('0x2c')]]={'$like':'%'+_0x3fbceb[_0x5342('0x36')][_0x5342('0x3f')]+'%'};return _0x550dd8;}})});}_0x13d570=_[_0x5342('0x40')]({},_0x13d570,_0x3fbceb[_0x5342('0x41')]);var _0x4a9459={'where':_0x13d570['where']};return db[_0x5342('0x2f')][_0x5342('0x1f')](_0x4a9459)['then'](function(_0x59931e){_0x3d151e[_0x5342('0x1f')]=_0x59931e;if(_0x3fbceb[_0x5342('0x36')][_0x5342('0x42')]){_0x13d570['include']=[{'all':!![]}];}return db['Tag'][_0x5342('0x43')](_0x13d570);})[_0x5342('0x26')](function(_0x15e1d3){_0x3d151e[_0x5342('0x44')]=_0x15e1d3;return _0x3d151e;})[_0x5342('0x26')](respondWithFilteredResult(_0x2f409c,_0x13d570))['catch'](handleError(_0x2f409c,null));};exports['show']=function(_0x4eedcb,_0x5b5157){var _0x1eb821={'raw':!![],'where':{'id':_0x4eedcb['params']['id']}},_0x5b9a37={};_0x5b9a37[_0x5342('0x32')]=_[_0x5342('0x34')](db[_0x5342('0x2f')][_0x5342('0x45')]);_0x5b9a37[_0x5342('0x36')]=_[_0x5342('0x34')](_0x4eedcb[_0x5342('0x36')]);_0x5b9a37['filters']=_[_0x5342('0x35')](_0x5b9a37[_0x5342('0x32')],_0x5b9a37[_0x5342('0x36')]);_0x1eb821['attributes']=_[_0x5342('0x35')](_0x5b9a37[_0x5342('0x32')],qs[_0x5342('0x38')](_0x4eedcb[_0x5342('0x36')][_0x5342('0x38')]));_0x1eb821[_0x5342('0x37')]=_0x1eb821[_0x5342('0x37')][_0x5342('0x46')]?_0x1eb821[_0x5342('0x37')]:_0x5b9a37[_0x5342('0x32')];if(_0x4eedcb[_0x5342('0x36')][_0x5342('0x42')]){_0x1eb821[_0x5342('0x47')]=[{'all':!![]}];}_0x1eb821=_[_0x5342('0x40')]({},_0x1eb821,_0x4eedcb[_0x5342('0x41')]);return db[_0x5342('0x2f')][_0x5342('0x48')](_0x1eb821)[_0x5342('0x26')](handleEntityNotFound(_0x5b5157,null))[_0x5342('0x26')](respondWithResult(_0x5b5157,null))[_0x5342('0x49')](handleError(_0x5b5157,null));};exports[_0x5342('0x4a')]=function(_0x3d9ce3,_0x131393){return db[_0x5342('0x2f')][_0x5342('0x4a')](_0x3d9ce3[_0x5342('0x4b')],{})[_0x5342('0x26')](function(_0x5b4e1a){var _0x341778=_0x3d9ce3[_0x5342('0x4c')][_0x5342('0x28')]({'plain':!![]});if(!_0x341778)throw new Error(_0x5342('0x4d'));if(_0x341778[_0x5342('0x4e')]===_0x5342('0x4c')){var _0x140edc=_0x5b4e1a['get']({'plain':!![]});var _0x436ec7=_0x5342('0x4f');return db[_0x5342('0x50')][_0x5342('0x48')]({'where':{'name':_0x436ec7,'userProfileId':_0x341778['userProfileId']},'raw':!![]})[_0x5342('0x26')](function(_0x1cbf4c){if(_0x1cbf4c&&_0x1cbf4c[_0x5342('0x51')]===0x0){return db[_0x5342('0x29')][_0x5342('0x4a')]({'name':_0x140edc['name'],'resourceId':_0x140edc['id'],'type':_0x1cbf4c[_0x5342('0x2c')],'sectionId':_0x1cbf4c['id']},{})[_0x5342('0x26')](function(){return _0x5b4e1a;});}else{return _0x5b4e1a;}})['catch'](function(_0x583593){logger[_0x5342('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x583593);throw _0x583593;});}return _0x5b4e1a;})['then'](respondWithResult(_0x131393,0xc9))['catch'](handleError(_0x131393,null));};exports[_0x5342('0x25')]=function(_0xed6e8e,_0x3ff70a){if(_0xed6e8e[_0x5342('0x4b')]['id']){delete _0xed6e8e['body']['id'];}return db[_0x5342('0x2f')][_0x5342('0x48')]({'where':{'id':_0xed6e8e[_0x5342('0x52')]['id']}})[_0x5342('0x26')](handleEntityNotFound(_0x3ff70a,null))[_0x5342('0x26')](saveUpdates(_0xed6e8e['body'],null))[_0x5342('0x26')](respondWithResult(_0x3ff70a,null))[_0x5342('0x49')](handleError(_0x3ff70a,null));};exports['destroy']=function(_0x377295,_0x1c7e6e){return db[_0x5342('0x2f')]['find']({'where':{'id':_0x377295[_0x5342('0x52')]['id']}})[_0x5342('0x26')](handleEntityNotFound(_0x1c7e6e,null))['then'](removeEntity(_0x1c7e6e,null))['catch'](handleError(_0x1c7e6e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 7e33780..f83a81d 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 _0xd0d5=['Tag','tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x29a07f,_0x1249fe){var _0x5431fe=function(_0x5354b9){while(--_0x5354b9){_0x29a07f['push'](_0x29a07f['shift']());}};_0x5431fe(++_0x1249fe);}(_0xd0d5,0x1e3));var _0x5d0d=function(_0x52d6c3,_0x5ae27b){_0x52d6c3=_0x52d6c3-0x0;var _0x34c1b2=_0xd0d5[_0x52d6c3];return _0x34c1b2;};'use strict';var _=require(_0x5d0d('0x0'));var util=require('util');var logger=require(_0x5d0d('0x1'))(_0x5d0d('0x2'));var moment=require(_0x5d0d('0x3'));var BPromise=require(_0x5d0d('0x4'));var rp=require(_0x5d0d('0x5'));var fs=require('fs');var path=require(_0x5d0d('0x6'));var rimraf=require(_0x5d0d('0x7'));var config=require(_0x5d0d('0x8'));var attributes=require(_0x5d0d('0x9'));module[_0x5d0d('0xa')]=function(_0x3df555,_0x247dc1){return _0x3df555['define'](_0x5d0d('0xb'),attributes,{'tableName':_0x5d0d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc613=['../../config/environment','exports','define','Tag','tools_tags','../../config/logger','api','bluebird','path','rimraf'];(function(_0x3fb637,_0x31a65c){var _0x2b17e5=function(_0x41ce02){while(--_0x41ce02){_0x3fb637['push'](_0x3fb637['shift']());}};_0x2b17e5(++_0x31a65c);}(_0xc613,0x1b3));var _0x3c61=function(_0x463a90,_0x42bda7){_0x463a90=_0x463a90-0x0;var _0x3e22a9=_0xc613[_0x463a90];return _0x3e22a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c61('0x0'))(_0x3c61('0x1'));var moment=require('moment');var BPromise=require(_0x3c61('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c61('0x3'));var rimraf=require(_0x3c61('0x4'));var config=require(_0x3c61('0x5'));var attributes=require('./tag.attributes');module[_0x3c61('0x6')]=function(_0xb842a,_0x2dff73){return _0xb842a[_0x3c61('0x7')](_0x3c61('0x8'),attributes,{'tableName':_0x3c61('0x9'),'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 bd2f798..f25f8b9 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 _0xca66=['http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x16370d,_0x277a6a){var _0xe69628=function(_0x454552){while(--_0x454552){_0x16370d['push'](_0x16370d['shift']());}};_0xe69628(++_0x277a6a);}(_0xca66,0x8b));var _0x6ca6=function(_0x4d36bd,_0x48e1e6){_0x4d36bd=_0x4d36bd-0x0;var _0x8eb90e=_0xca66[_0x4d36bd];return _0x8eb90e;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ca6('0x1'));var rs=require(_0x6ca6('0x2'));var fs=require('fs');var Redis=require(_0x6ca6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ca6('0x4'));var logger=require('../../config/logger')(_0x6ca6('0x5'));var config=require('../../config/environment');var jayson=require(_0x6ca6('0x6'));var client=jayson[_0x6ca6('0x7')][_0x6ca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44019c,_0x407e66,_0x27a210){return new BPromise(function(_0x27d280,_0x4f5651){return client[_0x6ca6('0x9')](_0x44019c,_0x27a210)[_0x6ca6('0xa')](function(_0x34b71b){logger[_0x6ca6('0xb')](_0x6ca6('0xc'),_0x407e66,_0x6ca6('0xd'));logger[_0x6ca6('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'),JSON[_0x6ca6('0xf')](_0x34b71b));if(_0x34b71b[_0x6ca6('0x10')]){if(_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x11')]===0x1f4){logger[_0x6ca6('0x10')]('Tag,\x20%s,\x20%s',_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x4f5651(_0x34b71b['error'][_0x6ca6('0x12')]);}logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x27d280(_0x34b71b[_0x6ca6('0x10')]['message']);}else{logger['info']('Tag,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'));_0x27d280(_0x34b71b[_0x6ca6('0x13')][_0x6ca6('0x12')]);}})[_0x6ca6('0x14')](function(_0x2c4a5c){logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x2c4a5c);_0x4f5651(_0x2c4a5c);});});} \ No newline at end of file +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(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0x2bc6,0x163));var _0x62bc=function(_0x39b587,_0x11febe){_0x39b587=_0x39b587-0x0;var _0x66c894=_0x2bc6[_0x39b587];return _0x66c894;};'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 diff --git a/server/api/team/index.js b/server/api/team/index.js index bfeb497..14fc61e 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 _0x3891=['getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','put','update','delete','removeQueues','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/queues'];(function(_0x12098a,_0x102b6e){var _0x4027cd=function(_0x2a3437){while(--_0x2a3437){_0x12098a['push'](_0x12098a['shift']());}};_0x4027cd(++_0x102b6e);}(_0x3891,0xc3));var _0x1389=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x3891[_0x45b034];return _0x509cb0;};'use strict';var multer=require('multer');var util=require(_0x1389('0x0'));var path=require(_0x1389('0x1'));var timeout=require(_0x1389('0x2'));var express=require(_0x1389('0x3'));var router=express[_0x1389('0x4')]();var auth=require(_0x1389('0x5'));var interaction=require(_0x1389('0x6'));var config=require(_0x1389('0x7'));var controller=require('./team.controller');router[_0x1389('0x8')]('/',auth[_0x1389('0x9')](),controller['index']);router[_0x1389('0x8')](_0x1389('0xa'),auth[_0x1389('0x9')](),controller[_0x1389('0xb')]);router[_0x1389('0x8')](_0x1389('0xc'),auth['isAuthenticated'](),controller[_0x1389('0xd')]);router[_0x1389('0x8')](_0x1389('0xe'),auth[_0x1389('0x9')](),controller[_0x1389('0xf')]);router[_0x1389('0x10')]('/',auth['isAuthenticated'](),controller[_0x1389('0x11')]);router[_0x1389('0x10')]('/:id/queues',auth[_0x1389('0x9')](),controller[_0x1389('0x12')]);router['post']('/:id/users',auth[_0x1389('0x9')](),controller[_0x1389('0x13')]);router[_0x1389('0x14')](_0x1389('0xa'),auth[_0x1389('0x9')](),controller[_0x1389('0x15')]);router[_0x1389('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/queues',auth[_0x1389('0x9')](),controller[_0x1389('0x17')]);router[_0x1389('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x1389('0x18')]);module[_0x1389('0x19')]=router; \ No newline at end of file +var _0xc622=['../../config/environment','./team.controller','isAuthenticated','get','/:id','show','getQueues','/:id/users','getAgents','post','create','/:id/queues','addQueues','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xbc5a19,_0x544769){var _0x4f8f5b=function(_0x52eca3){while(--_0x52eca3){_0xbc5a19['push'](_0xbc5a19['shift']());}};_0x4f8f5b(++_0x544769);}(_0xc622,0x1ce));var _0x2c62=function(_0x5db96a,_0x60039){_0x5db96a=_0x5db96a-0x0;var _0x13fdb0=_0xc622[_0x5db96a];return _0x13fdb0;};'use strict';var multer=require(_0x2c62('0x0'));var util=require(_0x2c62('0x1'));var path=require(_0x2c62('0x2'));var timeout=require(_0x2c62('0x3'));var express=require(_0x2c62('0x4'));var router=express[_0x2c62('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2c62('0x6'));var controller=require(_0x2c62('0x7'));router['get']('/',auth[_0x2c62('0x8')](),controller['index']);router[_0x2c62('0x9')](_0x2c62('0xa'),auth[_0x2c62('0x8')](),controller[_0x2c62('0xb')]);router[_0x2c62('0x9')]('/:id/queues',auth[_0x2c62('0x8')](),controller[_0x2c62('0xc')]);router[_0x2c62('0x9')](_0x2c62('0xd'),auth[_0x2c62('0x8')](),controller[_0x2c62('0xe')]);router[_0x2c62('0xf')]('/',auth[_0x2c62('0x8')](),controller[_0x2c62('0x10')]);router[_0x2c62('0xf')](_0x2c62('0x11'),auth[_0x2c62('0x8')](),controller[_0x2c62('0x12')]);router[_0x2c62('0xf')](_0x2c62('0xd'),auth[_0x2c62('0x8')](),controller[_0x2c62('0x13')]);router[_0x2c62('0x14')](_0x2c62('0xa'),auth[_0x2c62('0x8')](),controller[_0x2c62('0x15')]);router[_0x2c62('0x16')]('/:id',auth[_0x2c62('0x8')](),controller[_0x2c62('0x17')]);router[_0x2c62('0x16')]('/:id/queues',auth[_0x2c62('0x8')](),controller['removeQueues']);router[_0x2c62('0x16')](_0x2c62('0xd'),auth['isAuthenticated'](),controller[_0x2c62('0x18')]);module[_0x2c62('0x19')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index fca3a56..b87b95a 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 _0xb15e=['exports','STRING','name','sequelize'];(function(_0x3f712a,_0x763710){var _0x2fde9e=function(_0xf5e5ba){while(--_0xf5e5ba){_0x3f712a['push'](_0x3f712a['shift']());}};_0x2fde9e(++_0x763710);}(_0xb15e,0x1bf));var _0xeb15=function(_0x1faa22,_0x5af905){_0x1faa22=_0x1faa22-0x0;var _0x4bf7da=_0xb15e[_0x1faa22];return _0x4bf7da;};'use strict';var Sequelize=require(_0xeb15('0x0'));module[_0xeb15('0x1')]={'name':{'type':Sequelize[_0xeb15('0x2')],'allowNull':![],'unique':_0xeb15('0x3')},'description':{'type':Sequelize[_0xeb15('0x2')]}}; \ No newline at end of file +var _0xb496=['STRING','name','sequelize'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xb496,0x1cd));var _0x6b49=function(_0x1ade18,_0x2d7001){_0x1ade18=_0x1ade18-0x0;var _0x1f89a5=_0xb496[_0x1ade18];return _0x1f89a5;};'use strict';var Sequelize=require(_0x6b49('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b49('0x1')],'allowNull':![],'unique':_0x6b49('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a4569aa..1a5154a 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 _0x137f=['ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','sendStatus','error','stack','name','send','index','map','Team','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','autoAssociation','update','params','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','addQueues','ids','removeQueues','remove','addAgents','Chat','Mail','Fax','Openchannel','Whatsapp','each','Voice','User','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','omit','emit','userTeam:save','voice','chat','sms','fax','openchannel','whatsapp','removeAgents','isArray','userTeam:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x137f,0x7b));var _0xf137=function(_0x1156ea,_0x38ca4f){_0x1156ea=_0x1156ea-0x0;var _0x377970=_0x137f[_0x1156ea];return _0x377970;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf137('0x0'));var rimraf=require(_0xf137('0x1'));var zipdir=require(_0xf137('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf137('0x3'));var moment=require(_0xf137('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf137('0x5'));var util=require(_0xf137('0x6'));var path=require(_0xf137('0x7'));var sox=require(_0xf137('0x8'));var csv=require('to-csv');var ejs=require(_0xf137('0x9'));var fs=require('fs');var _=require(_0xf137('0xa'));var squel=require(_0xf137('0xb'));var crypto=require(_0xf137('0xc'));var jsforce=require(_0xf137('0xd'));var deskjs=require(_0xf137('0xe'));var toCsv=require(_0xf137('0xf'));var querystring=require('querystring');var Papa=require(_0xf137('0x10'));var Redis=require(_0xf137('0x11'));var authService=require(_0xf137('0x12'));var qs=require(_0xf137('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf137('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xf137('0x15'));var config=require(_0xf137('0x16'));var licenseUtil=require(_0xf137('0x17'));var db=require(_0xf137('0x18'))['db'];config[_0xf137('0x19')]=_[_0xf137('0x1a')](config[_0xf137('0x19')],{'host':_0xf137('0x1b'),'port':0x18eb});var socket=require(_0xf137('0x1c'))(new Redis(config[_0xf137('0x19')]));require(_0xf137('0x1d'))[_0xf137('0x1e')](socket);function respondWithStatusCode(_0xbdf33b,_0x5b5f3d){_0x5b5f3d=_0x5b5f3d||0xcc;return function(_0x4c02d7){if(_0x4c02d7){return _0xbdf33b['sendStatus'](_0x5b5f3d);}return _0xbdf33b[_0xf137('0x1f')](_0x5b5f3d)[_0xf137('0x20')]();};}function respondWithResult(_0x222991,_0x2f9b6f){_0x2f9b6f=_0x2f9b6f||0xc8;return function(_0x599d9e){if(_0x599d9e){return _0x222991[_0xf137('0x1f')](_0x2f9b6f)[_0xf137('0x21')](_0x599d9e);}};}function respondWithFilteredResult(_0x5becc3,_0x1b23c4){return function(_0x500002){if(_0x500002){var _0xfefcd7=_0x500002[_0xf137('0x22')],_0x272e58=_0x1b23c4[_0xf137('0x23')],_0x393242=_0x1b23c4['offset']+_0x1b23c4[_0xf137('0x24')],_0x3b5084;if(_0x393242>=_0xfefcd7){_0x393242=_0xfefcd7;_0x3b5084=0xc8;}else{_0x3b5084=0xce;}_0x5becc3[_0xf137('0x1f')](_0x3b5084);return _0x5becc3[_0xf137('0x25')](_0xf137('0x26'),_0x272e58+'-'+_0x393242+'/'+_0xfefcd7)[_0xf137('0x21')](_0x500002);}return null;};}function patchUpdates(_0x251a78){return function(_0x3996ca){try{jsonpatch[_0xf137('0x27')](_0x3996ca,_0x251a78,!![]);}catch(_0x3891ca){return BPromise['reject'](_0x3891ca);}return _0x3996ca[_0xf137('0x28')]();};}function saveUpdates(_0x40181e,_0x4b14f8){return function(_0x39ace6){if(_0x39ace6){return _0x39ace6['update'](_0x40181e)[_0xf137('0x29')](function(_0x3d9e79){return _0x3d9e79;});}return null;};}function removeEntity(_0x594d9a,_0xd3b764){return function(_0x1d9d67){if(_0x1d9d67){return _0x1d9d67[_0xf137('0x2a')]()[_0xf137('0x29')](function(){var _0x5c824f=_0x1d9d67[_0xf137('0x2b')]({'plain':!![]});var _0x44dfb4='Teams';return db['UserProfileResource'][_0xf137('0x2a')]({'where':{'type':_0x44dfb4,'resourceId':_0x5c824f['id']}})[_0xf137('0x29')](function(){return _0x1d9d67;});})[_0xf137('0x29')](function(){_0x594d9a[_0xf137('0x1f')](0xcc)[_0xf137('0x20')]();});}};}function handleEntityNotFound(_0x48f53d,_0x579f30){return function(_0x418ea9){if(!_0x418ea9){_0x48f53d[_0xf137('0x2c')](0x194);}return _0x418ea9;};}function handleError(_0x233c69,_0x4b7adc){_0x4b7adc=_0x4b7adc||0x1f4;return function(_0x33932b){logger[_0xf137('0x2d')](_0x33932b[_0xf137('0x2e')]);if(_0x33932b[_0xf137('0x2f')]){delete _0x33932b[_0xf137('0x2f')];}_0x233c69[_0xf137('0x1f')](_0x4b7adc)[_0xf137('0x30')](_0x33932b);};}exports[_0xf137('0x31')]=function(_0x50f7a4,_0x1d365a){var _0x4433df={},_0x188bde={},_0x267ca4={'count':0x0,'rows':[]};var _0x5f4717=_[_0xf137('0x32')](db[_0xf137('0x33')]['rawAttributes'],function(_0x5c71d0){return{'name':_0x5c71d0[_0xf137('0x34')],'type':_0x5c71d0[_0xf137('0x35')]['key']};});_0x188bde[_0xf137('0x36')]=_['map'](_0x5f4717,_0xf137('0x2f'));_0x188bde[_0xf137('0x37')]=_[_0xf137('0x38')](_0x50f7a4[_0xf137('0x37')]);_0x188bde[_0xf137('0x39')]=_[_0xf137('0x3a')](_0x188bde[_0xf137('0x36')],_0x188bde['query']);_0x4433df[_0xf137('0x3b')]=_[_0xf137('0x3a')](_0x188bde[_0xf137('0x36')],qs[_0xf137('0x3c')](_0x50f7a4['query'][_0xf137('0x3c')]));_0x4433df[_0xf137('0x3b')]=_0x4433df[_0xf137('0x3b')][_0xf137('0x3d')]?_0x4433df['attributes']:_0x188bde[_0xf137('0x36')];if(!_0x50f7a4[_0xf137('0x37')][_0xf137('0x3e')](_0xf137('0x3f'))){_0x4433df[_0xf137('0x24')]=qs[_0xf137('0x24')](_0x50f7a4['query'][_0xf137('0x24')]);_0x4433df[_0xf137('0x23')]=qs[_0xf137('0x23')](_0x50f7a4[_0xf137('0x37')][_0xf137('0x23')]);}_0x4433df[_0xf137('0x40')]=qs[_0xf137('0x41')](_0x50f7a4[_0xf137('0x37')][_0xf137('0x41')]);_0x4433df[_0xf137('0x42')]=qs['filters'](_[_0xf137('0x43')](_0x50f7a4[_0xf137('0x37')],_0x188bde[_0xf137('0x39')]),_0x5f4717);if(_0x50f7a4[_0xf137('0x37')][_0xf137('0x44')]){_0x4433df['where']=_['merge'](_0x4433df[_0xf137('0x42')],{'$or':_['map'](_0x5f4717,function(_0x18130c){if(_0x18130c[_0xf137('0x35')]!==_0xf137('0x45')){var _0x12e8db={};_0x12e8db[_0x18130c[_0xf137('0x2f')]]={'$like':'%'+_0x50f7a4[_0xf137('0x37')]['filter']+'%'};return _0x12e8db;}})});}_0x4433df=_[_0xf137('0x46')]({},_0x4433df,_0x50f7a4[_0xf137('0x47')]);var _0xc62bd0={'where':_0x4433df[_0xf137('0x42')]};return db[_0xf137('0x33')][_0xf137('0x22')](_0xc62bd0)[_0xf137('0x29')](function(_0x4d3ee0){_0x267ca4['count']=_0x4d3ee0;if(_0x50f7a4['query'][_0xf137('0x48')]){_0x4433df['include']=[{'all':!![]}];}return db['Team'][_0xf137('0x49')](_0x4433df);})[_0xf137('0x29')](function(_0x702e11){_0x267ca4[_0xf137('0x4a')]=_0x702e11;return _0x267ca4;})[_0xf137('0x29')](respondWithFilteredResult(_0x1d365a,_0x4433df))[_0xf137('0x4b')](handleError(_0x1d365a,null));};exports['show']=function(_0x9e7e0d,_0x5a82d1){var _0x4a6583={'raw':![],'where':{'id':_0x9e7e0d['params']['id']}},_0x355a66={};_0x355a66[_0xf137('0x36')]=_[_0xf137('0x38')](db[_0xf137('0x33')][_0xf137('0x4c')]);_0x355a66['query']=_[_0xf137('0x38')](_0x9e7e0d[_0xf137('0x37')]);_0x355a66['filters']=_[_0xf137('0x3a')](_0x355a66[_0xf137('0x36')],_0x355a66[_0xf137('0x37')]);_0x4a6583['attributes']=_[_0xf137('0x3a')](_0x355a66['model'],qs['fields'](_0x9e7e0d['query'][_0xf137('0x3c')]));_0x4a6583[_0xf137('0x3b')]=_0x4a6583[_0xf137('0x3b')][_0xf137('0x3d')]?_0x4a6583[_0xf137('0x3b')]:_0x355a66[_0xf137('0x36')];if(_0x9e7e0d[_0xf137('0x37')][_0xf137('0x48')]){_0x4a6583[_0xf137('0x4d')]=[{'all':!![]}];}_0x4a6583=_[_0xf137('0x46')]({},_0x4a6583,_0x9e7e0d[_0xf137('0x47')]);return db[_0xf137('0x33')]['find'](_0x4a6583)['then'](handleEntityNotFound(_0x5a82d1,null))['then'](respondWithResult(_0x5a82d1,null))['catch'](handleError(_0x5a82d1,null));};exports[_0xf137('0x4e')]=function(_0x3c582a,_0x2c4b82){return db[_0xf137('0x33')][_0xf137('0x4e')](_0x3c582a[_0xf137('0x4f')],{})[_0xf137('0x29')](function(_0x16c4d2){var _0x1b2ed9=_0x3c582a[_0xf137('0x50')][_0xf137('0x2b')]({'plain':!![]});if(!_0x1b2ed9)throw new Error(_0xf137('0x51'));if(_0x1b2ed9[_0xf137('0x52')]==='user'){var _0x22d3af=_0x16c4d2[_0xf137('0x2b')]({'plain':!![]});var _0x1ab92e=_0xf137('0x53');return db[_0xf137('0x54')][_0xf137('0x55')]({'where':{'name':_0x1ab92e,'userProfileId':_0x1b2ed9['userProfileId']},'raw':!![]})[_0xf137('0x29')](function(_0x541cc4){if(_0x541cc4&&_0x541cc4[_0xf137('0x56')]===0x0){return db['UserProfileResource'][_0xf137('0x4e')]({'name':_0x22d3af[_0xf137('0x2f')],'resourceId':_0x22d3af['id'],'type':_0x541cc4['name'],'sectionId':_0x541cc4['id']},{})[_0xf137('0x29')](function(){return _0x16c4d2;});}else{return _0x16c4d2;}})[_0xf137('0x4b')](function(_0x433600){logger[_0xf137('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x433600);throw _0x433600;});}return _0x16c4d2;})[_0xf137('0x29')](respondWithResult(_0x2c4b82,0xc9))[_0xf137('0x4b')](handleError(_0x2c4b82,null));};exports[_0xf137('0x57')]=function(_0x52c979,_0x1e687c){if(_0x52c979[_0xf137('0x4f')]['id']){delete _0x52c979[_0xf137('0x4f')]['id'];}return db[_0xf137('0x33')]['find']({'where':{'id':_0x52c979[_0xf137('0x58')]['id']}})[_0xf137('0x29')](handleEntityNotFound(_0x1e687c,null))[_0xf137('0x29')](saveUpdates(_0x52c979[_0xf137('0x4f')],null))['then'](respondWithResult(_0x1e687c,null))[_0xf137('0x4b')](handleError(_0x1e687c,null));};exports[_0xf137('0x2a')]=function(_0x2f7bf8,_0x435b47){return db[_0xf137('0x33')][_0xf137('0x55')]({'where':{'id':_0x2f7bf8[_0xf137('0x58')]['id']}})[_0xf137('0x29')](handleEntityNotFound(_0x435b47,null))[_0xf137('0x29')](removeEntity(_0x435b47,null))[_0xf137('0x4b')](handleError(_0x435b47,null));};exports[_0xf137('0x59')]=function(_0x28be90,_0x396eb3,_0x45ef30){return db[_0xf137('0x33')][_0xf137('0x5a')]({'where':{'id':_0x28be90[_0xf137('0x58')]['id']}})[_0xf137('0x29')](handleEntityNotFound(_0x396eb3,null))[_0xf137('0x29')](function(_0x205349){if(!_0x28be90[_0xf137('0x37')][_0xf137('0x5b')]||!utils[_0xf137('0x5c')](_0x28be90[_0xf137('0x37')]['channel'])){throw new db[(_0xf137('0x5d'))][(_0xf137('0x5e'))](_0xf137('0x5f'));}var _0x9af8cf={};var _0x4735b6={};_0x4735b6[_0xf137('0x36')]=_[_0xf137('0x38')](db[_[_0xf137('0x60')](_0x28be90[_0xf137('0x37')][_0xf137('0x5b')]['toLowerCase']())+'Queue'][_0xf137('0x4c')]);_0x4735b6[_0xf137('0x37')]=_[_0xf137('0x38')](_0x28be90[_0xf137('0x37')]);_0x4735b6['filters']=_[_0xf137('0x3a')](_0x4735b6[_0xf137('0x36')],_0x4735b6['query']);_0x9af8cf[_0xf137('0x3b')]=_['intersection'](_0x4735b6[_0xf137('0x36')],qs[_0xf137('0x3c')](_0x28be90[_0xf137('0x37')][_0xf137('0x3c')]));_0x9af8cf[_0xf137('0x3b')]=_0x9af8cf[_0xf137('0x3b')][_0xf137('0x3d')]?_0x9af8cf[_0xf137('0x3b')]:_0x4735b6['model'];_0x9af8cf[_0xf137('0x24')]=qs['limit'](_0x28be90[_0xf137('0x37')]['limit']);_0x9af8cf[_0xf137('0x23')]=qs[_0xf137('0x23')](_0x28be90[_0xf137('0x37')][_0xf137('0x23')]);_0x9af8cf[_0xf137('0x40')]=qs['sort'](_0x28be90[_0xf137('0x37')][_0xf137('0x41')]);_0x9af8cf[_0xf137('0x42')]=qs['filters'](_[_0xf137('0x43')](_0x28be90[_0xf137('0x37')],_0x4735b6['filters']));_0x9af8cf=_[_0xf137('0x46')]({},_0x9af8cf,_0x28be90['options']);return _0x205349['get'+_[_0xf137('0x60')](_0x28be90[_0xf137('0x37')][_0xf137('0x5b')][_0xf137('0x61')]())+_0xf137('0x62')](_0x9af8cf);})[_0xf137('0x29')](respondWithResult(_0x396eb3,null))[_0xf137('0x4b')](handleError(_0x396eb3,null));};exports[_0xf137('0x63')]=function(_0xb55060,_0xf71047,_0x61f8b){return db[_0xf137('0x33')][_0xf137('0x5a')]({'where':{'id':_0xb55060[_0xf137('0x58')]['id']}})[_0xf137('0x29')](function(_0x35d264){if(_0x35d264){if(!_0xb55060['body'][_0xf137('0x5b')]||!utils['isValidChannel'](_0xb55060[_0xf137('0x4f')][_0xf137('0x5b')])){throw new db[(_0xf137('0x5d'))][(_0xf137('0x5e'))](_0xf137('0x5f'));}return _0x35d264['add'+_[_0xf137('0x60')](_0xb55060[_0xf137('0x4f')]['channel'][_0xf137('0x61')]())+'Queues'](_0xb55060['body'][_0xf137('0x64')]);}return null;})[_0xf137('0x29')](handleEntityNotFound(_0xf71047,null))['then'](respondWithStatusCode(_0xf71047,null))[_0xf137('0x4b')](handleError(_0xf71047,null));};exports[_0xf137('0x65')]=function(_0x5e4515,_0x56d6f8,_0x4cff1f){return db[_0xf137('0x33')]['findOne']({'where':{'id':_0x5e4515[_0xf137('0x58')]['id']}})[_0xf137('0x29')](function(_0x4d8cbb){if(_0x4d8cbb){if(!_0x5e4515[_0xf137('0x37')][_0xf137('0x5b')]||!utils['isValidChannel'](_0x5e4515[_0xf137('0x37')][_0xf137('0x5b')])){throw new db[(_0xf137('0x5d'))][(_0xf137('0x5e'))](_0xf137('0x5f'));}return _0x4d8cbb[_0xf137('0x66')+_['capitalize'](_0x5e4515[_0xf137('0x37')][_0xf137('0x5b')][_0xf137('0x61')]())+_0xf137('0x62')](_0x5e4515['query']['ids']);}return null;})[_0xf137('0x29')](handleEntityNotFound(_0x56d6f8,null))[_0xf137('0x29')](respondWithStatusCode(_0x56d6f8,null))[_0xf137('0x4b')](handleError(_0x56d6f8,null));};exports[_0xf137('0x67')]=function(_0x18da8d,_0x31ae44,_0x27e97c){return db[_0xf137('0x33')][_0xf137('0x55')]({'where':{'id':_0x18da8d[_0xf137('0x58')]['id']}})[_0xf137('0x29')](handleEntityNotFound(_0x31ae44,null))[_0xf137('0x29')](function(_0x22aa72){if(_0x22aa72){var _0x2c42a7=['Voice',_0xf137('0x68'),_0xf137('0x69'),'Sms',_0xf137('0x6a'),_0xf137('0x6b'),_0xf137('0x6c')];return BPromise['each'](_0x2c42a7,function(_0x15a9b5){return _0x22aa72[_0xf137('0x2b')+_0x15a9b5+_0xf137('0x62')]({'attributes':['id',_0xf137('0x2f')]})[_0xf137('0x29')](function(_0x9871a5){return BPromise[_0xf137('0x6d')](_0x9871a5,function(_0x403e30){return _0x403e30[_0xf137('0x67')](_0x18da8d[_0xf137('0x4f')][_0xf137('0x64')])['then'](function(){if(_0x15a9b5===_0xf137('0x6e')){return db[_0xf137('0x6f')][_0xf137('0x49')]({'where':{'id':_0x18da8d['body']['ids']},'attributes':['id',_0xf137('0x2f'),_0xf137('0x70'),_0xf137('0x71'),'interface'],'raw':!![]})[_0xf137('0x29')](function(_0x5f4e8a){return BPromise[_0xf137('0x6d')](_[_0xf137('0x44')](_0x5f4e8a,{'online':0x1}),function(_0x49d26e){return db[_0xf137('0x72')][_0xf137('0x73')]({'membername':_0x49d26e[_0xf137('0x2f')],'UserId':_0x49d26e['id'],'queue_name':_0x403e30[_0xf137('0x2f')],'VoiceQueueId':_0x403e30['id'],'interface':_[_0xf137('0x74')](_0x49d26e[_0xf137('0x75')])?util[_0xf137('0x76')]('SIP/%s',_0x49d26e[_0xf137('0x2f')]):_0x49d26e['interface'],'paused':_0x49d26e[_0xf137('0x71')]||![],'penalty':0x0});});});}});});})[_0xf137('0x29')](function(){return _0x22aa72;});})['then'](function(){return _0x22aa72;});}})[_0xf137('0x29')](function(_0x2fe243){if(_0x2fe243){return _0x2fe243[_0xf137('0x67')](_0x18da8d[_0xf137('0x4f')][_0xf137('0x64')],_[_0xf137('0x77')](_0x18da8d[_0xf137('0x4f')],[_0xf137('0x64'),'id'])||{})['spread'](function(_0x392851){for(var _0x2cdf92=0x0;_0x2cdf92<_0x18da8d[_0xf137('0x4f')][_0xf137('0x64')][_0xf137('0x3d')];_0x2cdf92+=0x1){socket[_0xf137('0x78')](_0xf137('0x79'),{'UserId':_0x18da8d[_0xf137('0x4f')][_0xf137('0x64')][_0x2cdf92],'TeamId':_0x18da8d['params']['id']});}return _0x392851;});}})[_0xf137('0x29')](respondWithResult(_0x31ae44,null))[_0xf137('0x4b')](handleError(_0x31ae44,null));};exports['removeAgents']=function(_0x261f21,_0x46952f,_0x4573c8){return db[_0xf137('0x33')][_0xf137('0x55')]({'where':{'id':_0x261f21[_0xf137('0x58')]['id']}})[_0xf137('0x29')](handleEntityNotFound(_0x46952f,null))[_0xf137('0x29')](function(_0x51dce9){if(_0x51dce9){return BPromise[_0xf137('0x6d')]([_0xf137('0x7a'),_0xf137('0x7b'),'mail',_0xf137('0x7c'),_0xf137('0x7d'),_0xf137('0x7e'),_0xf137('0x7f')],function(_0x2f38ec){return _0x51dce9['get'+_[_0xf137('0x60')](_0x2f38ec)+'Queues']({'attributes':['id',_0xf137('0x2f')]})[_0xf137('0x29')](function(_0x5fad22){return BPromise[_0xf137('0x6d')](_0x5fad22,function(_0x35cbf0){return _0x35cbf0[_0xf137('0x80')](_0x261f21[_0xf137('0x37')][_0xf137('0x64')])[_0xf137('0x29')](function(){if(_0x2f38ec===_0xf137('0x7a')){return db[_0xf137('0x72')][_0xf137('0x2a')]({'where':{'VoiceQueueId':_0x35cbf0['id'],'UserId':_0x261f21[_0xf137('0x37')]['ids']}});}});});})['then'](function(){return _0x51dce9;});})['then'](function(){return _0x51dce9;});}})[_0xf137('0x29')](function(_0x53450d){if(_0x53450d){return _0x53450d[_0xf137('0x80')](_0x261f21[_0xf137('0x37')][_0xf137('0x64')])['then'](function(){if(_[_0xf137('0x81')](_0x261f21[_0xf137('0x37')][_0xf137('0x64')])){for(var _0x3b0cf3=0x0;_0x3b0cf3<_0x261f21[_0xf137('0x37')][_0xf137('0x64')]['length'];_0x3b0cf3+=0x1){socket[_0xf137('0x78')](_0xf137('0x82'),{'UserId':Number(_0x261f21[_0xf137('0x37')]['ids'][_0x3b0cf3]),'TeamId':Number(_0x261f21[_0xf137('0x58')]['id'])});}}else{socket[_0xf137('0x78')](_0xf137('0x82'),{'UserId':Number(_0x261f21[_0xf137('0x37')]['ids']),'TeamId':Number(_0x261f21['params']['id'])});}});}})[_0xf137('0x29')](respondWithStatusCode(_0x46952f,null))[_0xf137('0x4b')](handleError(_0x46952f,null));};exports['getAgents']=function(_0x283732,_0x5c697b,_0x72768e){var _0x6721b0={};var _0x1a9b9f={};var _0x3e9518;var _0x33c161;return db[_0xf137('0x33')][_0xf137('0x5a')]({'where':{'id':_0x283732['params']['id']}})['then'](handleEntityNotFound(_0x5c697b,null))[_0xf137('0x29')](function(_0x237a42){if(_0x237a42){_0x3e9518=_0x237a42;_0x1a9b9f[_0xf137('0x36')]=_[_0xf137('0x38')](db[_0xf137('0x6f')][_0xf137('0x4c')]);_0x1a9b9f[_0xf137('0x37')]=_[_0xf137('0x38')](_0x283732['query']);_0x1a9b9f[_0xf137('0x39')]=_['intersection'](_0x1a9b9f[_0xf137('0x36')],_0x1a9b9f[_0xf137('0x37')]);_0x6721b0[_0xf137('0x3b')]=_[_0xf137('0x3a')](_0x1a9b9f[_0xf137('0x36')],qs['fields'](_0x283732['query'][_0xf137('0x3c')]));_0x6721b0[_0xf137('0x3b')]=_0x6721b0[_0xf137('0x3b')]['length']?_0x6721b0[_0xf137('0x3b')]:_0x1a9b9f[_0xf137('0x36')];_0x6721b0[_0xf137('0x40')]=qs['sort'](_0x283732['query'][_0xf137('0x41')]);_0x6721b0[_0xf137('0x42')]=qs['filters'](_[_0xf137('0x43')](_0x283732['query'],_0x1a9b9f[_0xf137('0x39')]));if(_0x283732[_0xf137('0x37')]['filter']){_0x6721b0['where']=_['merge'](_0x6721b0[_0xf137('0x42')],{'$or':_[_0xf137('0x32')](_0x6721b0['attributes'],function(_0x584abb){var _0x3a789e={};_0x3a789e[_0x584abb]={'$like':'%'+_0x283732['query'][_0xf137('0x44')]+'%'};return _0x3a789e;})});}_0x6721b0=_[_0xf137('0x46')]({},_0x6721b0,_0x283732[_0xf137('0x47')]);return _0x3e9518['getAgents'](_0x6721b0);}})['then'](function(_0x132cef){if(_0x132cef){_0x33c161=_0x132cef[_0xf137('0x3d')];if(!_0x283732['query'][_0xf137('0x3e')](_0xf137('0x3f'))){_0x6721b0[_0xf137('0x24')]=qs['limit'](_0x283732['query'][_0xf137('0x24')]);_0x6721b0[_0xf137('0x23')]=qs[_0xf137('0x23')](_0x283732[_0xf137('0x37')][_0xf137('0x23')]);}return _0x3e9518[_0xf137('0x83')](_0x6721b0);}})[_0xf137('0x29')](function(_0x436fbd){if(_0x436fbd){return _0x436fbd?{'count':_0x33c161,'rows':_0x436fbd}:null;}})[_0xf137('0x29')](respondWithResult(_0x5c697b,null))['catch'](handleError(_0x5c697b,null));}; \ No newline at end of file +var _0x51d8=['attributes','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','Queue','order','toLowerCase','addQueues','Sequelize','add','Queues','ids','remove','addAgents','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','each','User','online','voicePause','interface','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','voice','chat','sms','openchannel','whatsapp','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./team.socket','register','end','status','json','count','offset','set','Content-Range','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','map','Team','rawAttributes','type','key','model','keys','query','filters','intersection','fields'];(function(_0x2075da,_0x4d723e){var _0x1f37eb=function(_0x43e2d1){while(--_0x43e2d1){_0x2075da['push'](_0x2075da['shift']());}};_0x1f37eb(++_0x4d723e);}(_0x51d8,0xc8));var _0x851d=function(_0x5c3cd5,_0x49c342){_0x5c3cd5=_0x5c3cd5-0x0;var _0xee1bd4=_0x51d8[_0x5c3cd5];return _0xee1bd4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x851d('0x0'));var rimraf=require(_0x851d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x851d('0x2'));var rp=require(_0x851d('0x3'));var moment=require(_0x851d('0x4'));var BPromise=require(_0x851d('0x5'));var Mustache=require(_0x851d('0x6'));var util=require('util');var path=require(_0x851d('0x7'));var sox=require(_0x851d('0x8'));var csv=require(_0x851d('0x9'));var ejs=require(_0x851d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x851d('0xb'));var crypto=require(_0x851d('0xc'));var jsforce=require(_0x851d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x851d('0x9'));var querystring=require(_0x851d('0xe'));var Papa=require(_0x851d('0xf'));var Redis=require('ioredis');var authService=require(_0x851d('0x10'));var qs=require(_0x851d('0x11'));var as=require(_0x851d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x851d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x851d('0x14'));var licenseUtil=require(_0x851d('0x15'));var db=require(_0x851d('0x16'))['db'];config['redis']=_[_0x851d('0x17')](config['redis'],{'host':_0x851d('0x18'),'port':0x18eb});var socket=require(_0x851d('0x19'))(new Redis(config[_0x851d('0x1a')]));require(_0x851d('0x1b'))[_0x851d('0x1c')](socket);function respondWithStatusCode(_0x11ea39,_0xe8a83b){_0xe8a83b=_0xe8a83b||0xcc;return function(_0x43b50e){if(_0x43b50e){return _0x11ea39['sendStatus'](_0xe8a83b);}return _0x11ea39['status'](_0xe8a83b)[_0x851d('0x1d')]();};}function respondWithResult(_0xb3eca5,_0x39107b){_0x39107b=_0x39107b||0xc8;return function(_0x251f34){if(_0x251f34){return _0xb3eca5[_0x851d('0x1e')](_0x39107b)[_0x851d('0x1f')](_0x251f34);}};}function respondWithFilteredResult(_0x5351e4,_0x1faa3f){return function(_0x233233){if(_0x233233){var _0x3a470e=_0x233233[_0x851d('0x20')],_0x2e469f=_0x1faa3f[_0x851d('0x21')],_0x274c24=_0x1faa3f[_0x851d('0x21')]+_0x1faa3f['limit'],_0x5c8172;if(_0x274c24>=_0x3a470e){_0x274c24=_0x3a470e;_0x5c8172=0xc8;}else{_0x5c8172=0xce;}_0x5351e4[_0x851d('0x1e')](_0x5c8172);return _0x5351e4[_0x851d('0x22')](_0x851d('0x23'),_0x2e469f+'-'+_0x274c24+'/'+_0x3a470e)['json'](_0x233233);}return null;};}function patchUpdates(_0x2f8888){return function(_0x498675){try{jsonpatch['apply'](_0x498675,_0x2f8888,!![]);}catch(_0x17f87a){return BPromise['reject'](_0x17f87a);}return _0x498675[_0x851d('0x24')]();};}function saveUpdates(_0x41c932,_0x19b4f4){return function(_0x3c0191){if(_0x3c0191){return _0x3c0191[_0x851d('0x25')](_0x41c932)[_0x851d('0x26')](function(_0x49075a){return _0x49075a;});}return null;};}function removeEntity(_0x35b7cf,_0x5948e2){return function(_0x4b891e){if(_0x4b891e){return _0x4b891e[_0x851d('0x27')]()['then'](function(){var _0x16144d=_0x4b891e[_0x851d('0x28')]({'plain':!![]});var _0x422c35='Teams';return db[_0x851d('0x29')][_0x851d('0x27')]({'where':{'type':_0x422c35,'resourceId':_0x16144d['id']}})['then'](function(){return _0x4b891e;});})[_0x851d('0x26')](function(){_0x35b7cf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10caa8,_0x3c862f){return function(_0x13840e){if(!_0x13840e){_0x10caa8[_0x851d('0x2a')](0x194);}return _0x13840e;};}function handleError(_0x2d001c,_0x27a155){_0x27a155=_0x27a155||0x1f4;return function(_0x395c4c){logger['error'](_0x395c4c[_0x851d('0x2b')]);if(_0x395c4c[_0x851d('0x2c')]){delete _0x395c4c[_0x851d('0x2c')];}_0x2d001c[_0x851d('0x1e')](_0x27a155)['send'](_0x395c4c);};}exports['index']=function(_0x29c159,_0x470251){var _0x5bf707={},_0x73fb16={},_0x310f4c={'count':0x0,'rows':[]};var _0xb4d250=_[_0x851d('0x2d')](db[_0x851d('0x2e')][_0x851d('0x2f')],function(_0x36af3f){return{'name':_0x36af3f['fieldName'],'type':_0x36af3f[_0x851d('0x30')][_0x851d('0x31')]};});_0x73fb16[_0x851d('0x32')]=_[_0x851d('0x2d')](_0xb4d250,_0x851d('0x2c'));_0x73fb16['query']=_[_0x851d('0x33')](_0x29c159[_0x851d('0x34')]);_0x73fb16[_0x851d('0x35')]=_[_0x851d('0x36')](_0x73fb16['model'],_0x73fb16[_0x851d('0x34')]);_0x5bf707['attributes']=_['intersection'](_0x73fb16['model'],qs[_0x851d('0x37')](_0x29c159[_0x851d('0x34')][_0x851d('0x37')]));_0x5bf707[_0x851d('0x38')]=_0x5bf707['attributes'][_0x851d('0x39')]?_0x5bf707[_0x851d('0x38')]:_0x73fb16[_0x851d('0x32')];if(!_0x29c159[_0x851d('0x34')][_0x851d('0x3a')]('nolimit')){_0x5bf707[_0x851d('0x3b')]=qs[_0x851d('0x3b')](_0x29c159[_0x851d('0x34')][_0x851d('0x3b')]);_0x5bf707[_0x851d('0x21')]=qs[_0x851d('0x21')](_0x29c159[_0x851d('0x34')][_0x851d('0x21')]);}_0x5bf707['order']=qs[_0x851d('0x3c')](_0x29c159[_0x851d('0x34')][_0x851d('0x3c')]);_0x5bf707[_0x851d('0x3d')]=qs['filters'](_[_0x851d('0x3e')](_0x29c159['query'],_0x73fb16[_0x851d('0x35')]),_0xb4d250);if(_0x29c159[_0x851d('0x34')][_0x851d('0x3f')]){_0x5bf707[_0x851d('0x3d')]=_['merge'](_0x5bf707[_0x851d('0x3d')],{'$or':_['map'](_0xb4d250,function(_0x169e93){if(_0x169e93['type']!==_0x851d('0x40')){var _0x48b2d9={};_0x48b2d9[_0x169e93['name']]={'$like':'%'+_0x29c159[_0x851d('0x34')]['filter']+'%'};return _0x48b2d9;}})});}_0x5bf707=_[_0x851d('0x41')]({},_0x5bf707,_0x29c159[_0x851d('0x42')]);var _0x396e19={'where':_0x5bf707['where']};return db[_0x851d('0x2e')][_0x851d('0x20')](_0x396e19)[_0x851d('0x26')](function(_0x34ed89){_0x310f4c[_0x851d('0x20')]=_0x34ed89;if(_0x29c159[_0x851d('0x34')][_0x851d('0x43')]){_0x5bf707[_0x851d('0x44')]=[{'all':!![]}];}return db[_0x851d('0x2e')][_0x851d('0x45')](_0x5bf707);})[_0x851d('0x26')](function(_0x40dd8a){_0x310f4c[_0x851d('0x46')]=_0x40dd8a;return _0x310f4c;})[_0x851d('0x26')](respondWithFilteredResult(_0x470251,_0x5bf707))[_0x851d('0x47')](handleError(_0x470251,null));};exports[_0x851d('0x48')]=function(_0x488f3e,_0x2fa57d){var _0x41315e={'raw':![],'where':{'id':_0x488f3e[_0x851d('0x49')]['id']}},_0x36f75a={};_0x36f75a[_0x851d('0x32')]=_['keys'](db[_0x851d('0x2e')][_0x851d('0x2f')]);_0x36f75a[_0x851d('0x34')]=_[_0x851d('0x33')](_0x488f3e[_0x851d('0x34')]);_0x36f75a[_0x851d('0x35')]=_[_0x851d('0x36')](_0x36f75a[_0x851d('0x32')],_0x36f75a[_0x851d('0x34')]);_0x41315e[_0x851d('0x38')]=_[_0x851d('0x36')](_0x36f75a[_0x851d('0x32')],qs[_0x851d('0x37')](_0x488f3e[_0x851d('0x34')]['fields']));_0x41315e['attributes']=_0x41315e[_0x851d('0x38')][_0x851d('0x39')]?_0x41315e['attributes']:_0x36f75a[_0x851d('0x32')];if(_0x488f3e[_0x851d('0x34')][_0x851d('0x43')]){_0x41315e['include']=[{'all':!![]}];}_0x41315e=_['merge']({},_0x41315e,_0x488f3e[_0x851d('0x42')]);return db[_0x851d('0x2e')][_0x851d('0x4a')](_0x41315e)[_0x851d('0x26')](handleEntityNotFound(_0x2fa57d,null))[_0x851d('0x26')](respondWithResult(_0x2fa57d,null))[_0x851d('0x47')](handleError(_0x2fa57d,null));};exports['create']=function(_0x253409,_0x508cbb){return db[_0x851d('0x2e')][_0x851d('0x4b')](_0x253409[_0x851d('0x4c')],{})[_0x851d('0x26')](function(_0x170356){var _0x2727c4=_0x253409[_0x851d('0x4d')]['get']({'plain':!![]});if(!_0x2727c4)throw new Error(_0x851d('0x4e'));if(_0x2727c4[_0x851d('0x4f')]===_0x851d('0x4d')){var _0x27bd3c=_0x170356['get']({'plain':!![]});var _0x47a4bc='Teams';return db[_0x851d('0x50')][_0x851d('0x4a')]({'where':{'name':_0x47a4bc,'userProfileId':_0x2727c4[_0x851d('0x51')]},'raw':!![]})[_0x851d('0x26')](function(_0x1737b7){if(_0x1737b7&&_0x1737b7['autoAssociation']===0x0){return db['UserProfileResource'][_0x851d('0x4b')]({'name':_0x27bd3c[_0x851d('0x2c')],'resourceId':_0x27bd3c['id'],'type':_0x1737b7[_0x851d('0x2c')],'sectionId':_0x1737b7['id']},{})['then'](function(){return _0x170356;});}else{return _0x170356;}})['catch'](function(_0x211b13){logger[_0x851d('0x52')](_0x851d('0x53'),_0x211b13);throw _0x211b13;});}return _0x170356;})[_0x851d('0x26')](respondWithResult(_0x508cbb,0xc9))[_0x851d('0x47')](handleError(_0x508cbb,null));};exports[_0x851d('0x25')]=function(_0x36c764,_0x19d3fe){if(_0x36c764[_0x851d('0x4c')]['id']){delete _0x36c764[_0x851d('0x4c')]['id'];}return db['Team'][_0x851d('0x4a')]({'where':{'id':_0x36c764[_0x851d('0x49')]['id']}})[_0x851d('0x26')](handleEntityNotFound(_0x19d3fe,null))[_0x851d('0x26')](saveUpdates(_0x36c764[_0x851d('0x4c')],null))['then'](respondWithResult(_0x19d3fe,null))['catch'](handleError(_0x19d3fe,null));};exports[_0x851d('0x27')]=function(_0x545d3c,_0x3afc8b){return db['Team'][_0x851d('0x4a')]({'where':{'id':_0x545d3c['params']['id']}})['then'](handleEntityNotFound(_0x3afc8b,null))[_0x851d('0x26')](removeEntity(_0x3afc8b,null))[_0x851d('0x47')](handleError(_0x3afc8b,null));};exports[_0x851d('0x54')]=function(_0x5bfb09,_0x57e592,_0x4ea5ae){return db['Team'][_0x851d('0x55')]({'where':{'id':_0x5bfb09[_0x851d('0x49')]['id']}})['then'](handleEntityNotFound(_0x57e592,null))['then'](function(_0x195c63){if(!_0x5bfb09[_0x851d('0x34')][_0x851d('0x56')]||!utils[_0x851d('0x57')](_0x5bfb09[_0x851d('0x34')]['channel'])){throw new db['Sequelize']['ValidationError'](_0x851d('0x58'));}var _0x5419c9={};var _0x174d9c={};_0x174d9c[_0x851d('0x32')]=_[_0x851d('0x33')](db[_[_0x851d('0x59')](_0x5bfb09[_0x851d('0x34')][_0x851d('0x56')]['toLowerCase']())+_0x851d('0x5a')][_0x851d('0x2f')]);_0x174d9c[_0x851d('0x34')]=_[_0x851d('0x33')](_0x5bfb09['query']);_0x174d9c[_0x851d('0x35')]=_['intersection'](_0x174d9c[_0x851d('0x32')],_0x174d9c['query']);_0x5419c9[_0x851d('0x38')]=_['intersection'](_0x174d9c[_0x851d('0x32')],qs['fields'](_0x5bfb09['query']['fields']));_0x5419c9[_0x851d('0x38')]=_0x5419c9[_0x851d('0x38')][_0x851d('0x39')]?_0x5419c9[_0x851d('0x38')]:_0x174d9c[_0x851d('0x32')];_0x5419c9[_0x851d('0x3b')]=qs[_0x851d('0x3b')](_0x5bfb09[_0x851d('0x34')][_0x851d('0x3b')]);_0x5419c9[_0x851d('0x21')]=qs[_0x851d('0x21')](_0x5bfb09[_0x851d('0x34')][_0x851d('0x21')]);_0x5419c9[_0x851d('0x5b')]=qs[_0x851d('0x3c')](_0x5bfb09[_0x851d('0x34')][_0x851d('0x3c')]);_0x5419c9[_0x851d('0x3d')]=qs[_0x851d('0x35')](_[_0x851d('0x3e')](_0x5bfb09['query'],_0x174d9c[_0x851d('0x35')]));_0x5419c9=_[_0x851d('0x41')]({},_0x5419c9,_0x5bfb09[_0x851d('0x42')]);return _0x195c63['get'+_[_0x851d('0x59')](_0x5bfb09['query'][_0x851d('0x56')][_0x851d('0x5c')]())+'Queues'](_0x5419c9);})[_0x851d('0x26')](respondWithResult(_0x57e592,null))[_0x851d('0x47')](handleError(_0x57e592,null));};exports[_0x851d('0x5d')]=function(_0x17abdd,_0x5ecc08,_0x29ecad){return db[_0x851d('0x2e')][_0x851d('0x55')]({'where':{'id':_0x17abdd['params']['id']}})[_0x851d('0x26')](function(_0x967f9){if(_0x967f9){if(!_0x17abdd['body'][_0x851d('0x56')]||!utils[_0x851d('0x57')](_0x17abdd['body'][_0x851d('0x56')])){throw new db[(_0x851d('0x5e'))]['ValidationError'](_0x851d('0x58'));}return _0x967f9[_0x851d('0x5f')+_[_0x851d('0x59')](_0x17abdd[_0x851d('0x4c')][_0x851d('0x56')][_0x851d('0x5c')]())+_0x851d('0x60')](_0x17abdd[_0x851d('0x4c')][_0x851d('0x61')]);}return null;})[_0x851d('0x26')](handleEntityNotFound(_0x5ecc08,null))[_0x851d('0x26')](respondWithStatusCode(_0x5ecc08,null))[_0x851d('0x47')](handleError(_0x5ecc08,null));};exports['removeQueues']=function(_0x18c725,_0xc91e07,_0x1d6459){return db[_0x851d('0x2e')][_0x851d('0x55')]({'where':{'id':_0x18c725[_0x851d('0x49')]['id']}})[_0x851d('0x26')](function(_0x51885b){if(_0x51885b){if(!_0x18c725['query']['channel']||!utils[_0x851d('0x57')](_0x18c725['query']['channel'])){throw new db[(_0x851d('0x5e'))]['ValidationError'](_0x851d('0x58'));}return _0x51885b[_0x851d('0x62')+_[_0x851d('0x59')](_0x18c725[_0x851d('0x34')][_0x851d('0x56')]['toLowerCase']())+_0x851d('0x60')](_0x18c725[_0x851d('0x34')][_0x851d('0x61')]);}return null;})['then'](handleEntityNotFound(_0xc91e07,null))[_0x851d('0x26')](respondWithStatusCode(_0xc91e07,null))['catch'](handleError(_0xc91e07,null));};exports[_0x851d('0x63')]=function(_0x20b0c2,_0x1b48bd,_0xc0a901){return db['Team'][_0x851d('0x4a')]({'where':{'id':_0x20b0c2[_0x851d('0x49')]['id']}})[_0x851d('0x26')](handleEntityNotFound(_0x1b48bd,null))[_0x851d('0x26')](function(_0x5b100){if(_0x5b100){var _0x445946=[_0x851d('0x64'),_0x851d('0x65'),'Mail',_0x851d('0x66'),_0x851d('0x67'),_0x851d('0x68'),_0x851d('0x69')];return BPromise[_0x851d('0x6a')](_0x445946,function(_0x3f4246){return _0x5b100[_0x851d('0x28')+_0x3f4246+_0x851d('0x60')]({'attributes':['id',_0x851d('0x2c')]})[_0x851d('0x26')](function(_0x4f9588){return BPromise['each'](_0x4f9588,function(_0x4f9bcf){return _0x4f9bcf[_0x851d('0x63')](_0x20b0c2[_0x851d('0x4c')][_0x851d('0x61')])[_0x851d('0x26')](function(){if(_0x3f4246===_0x851d('0x64')){return db[_0x851d('0x6b')][_0x851d('0x45')]({'where':{'id':_0x20b0c2[_0x851d('0x4c')][_0x851d('0x61')]},'attributes':['id',_0x851d('0x2c'),_0x851d('0x6c'),_0x851d('0x6d'),_0x851d('0x6e')],'raw':!![]})[_0x851d('0x26')](function(_0x7bbca8){return BPromise[_0x851d('0x6a')](_[_0x851d('0x3f')](_0x7bbca8,{'online':0x1}),function(_0x14a485){return db['UserVoiceQueueRt']['upsert']({'membername':_0x14a485[_0x851d('0x2c')],'UserId':_0x14a485['id'],'queue_name':_0x4f9bcf[_0x851d('0x2c')],'VoiceQueueId':_0x4f9bcf['id'],'interface':_[_0x851d('0x6f')](_0x14a485[_0x851d('0x6e')])?util[_0x851d('0x70')](_0x851d('0x71'),_0x14a485[_0x851d('0x2c')]):_0x14a485[_0x851d('0x6e')],'paused':_0x14a485['voicePause']||![],'penalty':0x0});});});}});});})[_0x851d('0x26')](function(){return _0x5b100;});})['then'](function(){return _0x5b100;});}})[_0x851d('0x26')](function(_0x1cc1c7){if(_0x1cc1c7){return _0x1cc1c7[_0x851d('0x63')](_0x20b0c2['body'][_0x851d('0x61')],_[_0x851d('0x72')](_0x20b0c2[_0x851d('0x4c')],[_0x851d('0x61'),'id'])||{})[_0x851d('0x73')](function(_0x406df0){for(var _0x39e79f=0x0;_0x39e79f<_0x20b0c2[_0x851d('0x4c')][_0x851d('0x61')]['length'];_0x39e79f+=0x1){socket[_0x851d('0x74')](_0x851d('0x75'),{'UserId':_0x20b0c2[_0x851d('0x4c')]['ids'][_0x39e79f],'TeamId':_0x20b0c2[_0x851d('0x49')]['id']});}return _0x406df0;});}})[_0x851d('0x26')](respondWithResult(_0x1b48bd,null))[_0x851d('0x47')](handleError(_0x1b48bd,null));};exports[_0x851d('0x76')]=function(_0x2ee6e5,_0x558446,_0x2ac3bc){return db[_0x851d('0x2e')][_0x851d('0x4a')]({'where':{'id':_0x2ee6e5[_0x851d('0x49')]['id']}})[_0x851d('0x26')](handleEntityNotFound(_0x558446,null))['then'](function(_0x51dd94){if(_0x51dd94){return BPromise[_0x851d('0x6a')]([_0x851d('0x77'),_0x851d('0x78'),'mail',_0x851d('0x79'),'fax',_0x851d('0x7a'),_0x851d('0x7b')],function(_0x51a3a2){return _0x51dd94[_0x851d('0x28')+_[_0x851d('0x59')](_0x51a3a2)+'Queues']({'attributes':['id',_0x851d('0x2c')]})[_0x851d('0x26')](function(_0x42136a){return BPromise[_0x851d('0x6a')](_0x42136a,function(_0x3c0564){return _0x3c0564[_0x851d('0x76')](_0x2ee6e5['query'][_0x851d('0x61')])[_0x851d('0x26')](function(){if(_0x51a3a2==='voice'){return db[_0x851d('0x7c')][_0x851d('0x27')]({'where':{'VoiceQueueId':_0x3c0564['id'],'UserId':_0x2ee6e5[_0x851d('0x34')][_0x851d('0x61')]}});}});});})[_0x851d('0x26')](function(){return _0x51dd94;});})[_0x851d('0x26')](function(){return _0x51dd94;});}})['then'](function(_0x4835f1){if(_0x4835f1){return _0x4835f1['removeAgents'](_0x2ee6e5['query'][_0x851d('0x61')])[_0x851d('0x26')](function(){if(_[_0x851d('0x7d')](_0x2ee6e5[_0x851d('0x34')][_0x851d('0x61')])){for(var _0x328cc9=0x0;_0x328cc9<_0x2ee6e5[_0x851d('0x34')][_0x851d('0x61')][_0x851d('0x39')];_0x328cc9+=0x1){socket[_0x851d('0x74')](_0x851d('0x7e'),{'UserId':Number(_0x2ee6e5['query'][_0x851d('0x61')][_0x328cc9]),'TeamId':Number(_0x2ee6e5['params']['id'])});}}else{socket['emit'](_0x851d('0x7e'),{'UserId':Number(_0x2ee6e5[_0x851d('0x34')]['ids']),'TeamId':Number(_0x2ee6e5[_0x851d('0x49')]['id'])});}});}})[_0x851d('0x26')](respondWithStatusCode(_0x558446,null))[_0x851d('0x47')](handleError(_0x558446,null));};exports[_0x851d('0x7f')]=function(_0x28dfa9,_0x1d3ce0,_0x4a3255){var _0x4c678f={};var _0x40087a={};var _0x5f1faf;var _0x4210d7;return db[_0x851d('0x2e')][_0x851d('0x55')]({'where':{'id':_0x28dfa9[_0x851d('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d3ce0,null))['then'](function(_0x1ec173){if(_0x1ec173){_0x5f1faf=_0x1ec173;_0x40087a[_0x851d('0x32')]=_['keys'](db[_0x851d('0x6b')]['rawAttributes']);_0x40087a[_0x851d('0x34')]=_['keys'](_0x28dfa9[_0x851d('0x34')]);_0x40087a[_0x851d('0x35')]=_[_0x851d('0x36')](_0x40087a['model'],_0x40087a[_0x851d('0x34')]);_0x4c678f[_0x851d('0x38')]=_[_0x851d('0x36')](_0x40087a['model'],qs[_0x851d('0x37')](_0x28dfa9[_0x851d('0x34')]['fields']));_0x4c678f[_0x851d('0x38')]=_0x4c678f[_0x851d('0x38')][_0x851d('0x39')]?_0x4c678f[_0x851d('0x38')]:_0x40087a[_0x851d('0x32')];_0x4c678f[_0x851d('0x5b')]=qs[_0x851d('0x3c')](_0x28dfa9[_0x851d('0x34')][_0x851d('0x3c')]);_0x4c678f[_0x851d('0x3d')]=qs[_0x851d('0x35')](_[_0x851d('0x3e')](_0x28dfa9['query'],_0x40087a[_0x851d('0x35')]));if(_0x28dfa9[_0x851d('0x34')][_0x851d('0x3f')]){_0x4c678f[_0x851d('0x3d')]=_[_0x851d('0x41')](_0x4c678f[_0x851d('0x3d')],{'$or':_[_0x851d('0x2d')](_0x4c678f[_0x851d('0x38')],function(_0x1edbf3){var _0x5e23c1={};_0x5e23c1[_0x1edbf3]={'$like':'%'+_0x28dfa9[_0x851d('0x34')][_0x851d('0x3f')]+'%'};return _0x5e23c1;})});}_0x4c678f=_['merge']({},_0x4c678f,_0x28dfa9[_0x851d('0x42')]);return _0x5f1faf[_0x851d('0x7f')](_0x4c678f);}})[_0x851d('0x26')](function(_0x158495){if(_0x158495){_0x4210d7=_0x158495[_0x851d('0x39')];if(!_0x28dfa9[_0x851d('0x34')][_0x851d('0x3a')]('nolimit')){_0x4c678f[_0x851d('0x3b')]=qs[_0x851d('0x3b')](_0x28dfa9[_0x851d('0x34')][_0x851d('0x3b')]);_0x4c678f[_0x851d('0x21')]=qs[_0x851d('0x21')](_0x28dfa9[_0x851d('0x34')][_0x851d('0x21')]);}return _0x5f1faf[_0x851d('0x7f')](_0x4c678f);}})[_0x851d('0x26')](function(_0x5c9df3){if(_0x5c9df3){return _0x5c9df3?{'count':_0x4210d7,'rows':_0x5c9df3}:null;}})['then'](respondWithResult(_0x1d3ce0,null))['catch'](handleError(_0x1d3ce0,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 21c83b0..69aa1e8 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 _0x6b69=['hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit'];(function(_0x4814b6,_0x41d62c){var _0x139ad4=function(_0x182e39){while(--_0x182e39){_0x4814b6['push'](_0x4814b6['shift']());}};_0x139ad4(++_0x41d62c);}(_0x6b69,0x1d1));var _0x96b6=function(_0x34929d,_0x4c49ad){_0x34929d=_0x34929d-0x0;var _0x17b1ee=_0x6b69[_0x34929d];return _0x17b1ee;};'use strict';var EventEmitter=require(_0x96b6('0x0'));var Team=require(_0x96b6('0x1'))['db'][_0x96b6('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x96b6('0x3')](0x0);var events={'afterCreate':_0x96b6('0x4'),'afterUpdate':_0x96b6('0x5'),'afterDestroy':_0x96b6('0x6')};function emitEvent(_0x452109){return function(_0x230c78,_0x7ada10,_0x39640b){TeamEvents[_0x96b6('0x7')](_0x452109+':'+_0x230c78['id'],_0x230c78);TeamEvents[_0x96b6('0x7')](_0x452109,_0x230c78);_0x39640b(null);};}for(var e in events){if(events[_0x96b6('0x8')](e)){var event=events[e];Team[_0x96b6('0x9')](e,emitEvent(event));}}module[_0x96b6('0xa')]=TeamEvents; \ No newline at end of file +var _0xcbcb=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x17d46b,_0x45ffeb){var _0x49539a=function(_0x1021b6){while(--_0x1021b6){_0x17d46b['push'](_0x17d46b['shift']());}};_0x49539a(++_0x45ffeb);}(_0xcbcb,0xba));var _0xbcbc=function(_0x576b2e,_0x3f3fa5){_0x576b2e=_0x576b2e-0x0;var _0x68c78c=_0xcbcb[_0x576b2e];return _0x68c78c;};'use strict';var EventEmitter=require(_0xbcbc('0x0'));var Team=require(_0xbcbc('0x1'))['db'][_0xbcbc('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xbcbc('0x3')](0x0);var events={'afterCreate':_0xbcbc('0x4'),'afterUpdate':'update','afterDestroy':_0xbcbc('0x5')};function emitEvent(_0x1df310){return function(_0xd2248,_0x3cafa9,_0x247df3){TeamEvents[_0xbcbc('0x6')](_0x1df310+':'+_0xd2248['id'],_0xd2248);TeamEvents[_0xbcbc('0x6')](_0x1df310,_0xd2248);_0x247df3(null);};}for(var e in events){if(events[_0xbcbc('0x7')](e)){var event=events[e];Team[_0xbcbc('0x8')](e,emitEvent(event));}}module[_0xbcbc('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 3c968db..2b26104 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 _0x54bc=['path','../../config/environment','./team.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x54bc,0x7e));var _0xc54b=function(_0x280aec,_0x6cb2ba){_0x280aec=_0x280aec-0x0;var _0x89f9f6=_0x54bc[_0x280aec];return _0x89f9f6;};'use strict';var _=require(_0xc54b('0x0'));var util=require(_0xc54b('0x1'));var logger=require(_0xc54b('0x2'))('api');var moment=require(_0xc54b('0x3'));var BPromise=require(_0xc54b('0x4'));var rp=require(_0xc54b('0x5'));var fs=require('fs');var path=require(_0xc54b('0x6'));var rimraf=require('rimraf');var config=require(_0xc54b('0x7'));var attributes=require(_0xc54b('0x8'));module[_0xc54b('0x9')]=function(_0x1b6768,_0x2df2c8){return _0x1b6768[_0xc54b('0xa')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cc6=['lodash','util','../../config/logger','api','bluebird','path','./team.attributes','exports','define','Team'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x2cc6,0x168));var _0x62cc=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x2cc6[_0x4ce028];return _0x583d0c;};'use strict';var _=require(_0x62cc('0x0'));var util=require(_0x62cc('0x1'));var logger=require(_0x62cc('0x2'))(_0x62cc('0x3'));var moment=require('moment');var BPromise=require(_0x62cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62cc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62cc('0x6'));module[_0x62cc('0x7')]=function(_0x464c5d,_0x45597e){return _0x464c5d[_0x62cc('0x8')](_0x62cc('0x9'),attributes,{'tableName':'teams','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 186035d..682d4c3 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 _0x7e40=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x3fbb11,_0x55866a){var _0x3dac1e=function(_0x32933f){while(--_0x32933f){_0x3fbb11['push'](_0x3fbb11['shift']());}};_0x3dac1e(++_0x55866a);}(_0x7e40,0x14e));var _0x07e4=function(_0x5c06b,_0x20564c){_0x5c06b=_0x5c06b-0x0;var _0x34c54c=_0x7e40[_0x5c06b];return _0x34c54c;};'use strict';var _=require(_0x07e4('0x0'));var util=require(_0x07e4('0x1'));var moment=require('moment');var BPromise=require(_0x07e4('0x2'));var rs=require(_0x07e4('0x3'));var fs=require('fs');var Redis=require(_0x07e4('0x4'));var db=require(_0x07e4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x07e4('0x6'))(_0x07e4('0x7'));var config=require(_0x07e4('0x8'));var jayson=require(_0x07e4('0x9'));var client=jayson[_0x07e4('0xa')]['http']({'port':0x232a});config[_0x07e4('0xb')]=_[_0x07e4('0xc')](config[_0x07e4('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x07e4('0xd'))[_0x07e4('0xe')](socket);function respondWithRpcPromise(_0x4cac53,_0x33da6d,_0x2e2108){return new BPromise(function(_0x53df55,_0x11945f){return client[_0x07e4('0xf')](_0x4cac53,_0x2e2108)[_0x07e4('0x10')](function(_0x3bf910){logger[_0x07e4('0x11')](_0x07e4('0x12'),_0x33da6d,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x33da6d,_0x07e4('0x13'),JSON[_0x07e4('0x14')](_0x3bf910));if(_0x3bf910[_0x07e4('0x15')]){if(_0x3bf910['error'][_0x07e4('0x16')]===0x1f4){logger[_0x07e4('0x15')]('Team,\x20%s,\x20%s',_0x33da6d,_0x3bf910['error'][_0x07e4('0x17')]);return _0x11945f(_0x3bf910[_0x07e4('0x15')][_0x07e4('0x17')]);}logger[_0x07e4('0x15')](_0x07e4('0x12'),_0x33da6d,_0x3bf910[_0x07e4('0x15')][_0x07e4('0x17')]);return _0x53df55(_0x3bf910[_0x07e4('0x15')][_0x07e4('0x17')]);}else{logger[_0x07e4('0x11')]('Team,\x20%s,\x20%s',_0x33da6d,'request\x20sent');_0x53df55(_0x3bf910[_0x07e4('0x18')][_0x07e4('0x17')]);}})[_0x07e4('0x19')](function(_0x536abb){logger[_0x07e4('0x15')](_0x07e4('0x12'),_0x33da6d,_0x536abb);_0x11945f(_0x536abb);});});} \ No newline at end of file +var _0xfe14=['request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','info','Team,\x20%s,\x20%s'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xfe14,0x19f));var _0x4fe1=function(_0x4f74ac,_0x17d4f1){_0x4f74ac=_0x4f74ac-0x0;var _0x27d8d0=_0xfe14[_0x4f74ac];return _0x27d8d0;};'use strict';var _=require(_0x4fe1('0x0'));var util=require(_0x4fe1('0x1'));var moment=require(_0x4fe1('0x2'));var BPromise=require(_0x4fe1('0x3'));var rs=require(_0x4fe1('0x4'));var fs=require('fs');var Redis=require(_0x4fe1('0x5'));var db=require(_0x4fe1('0x6'))['db'];var utils=require(_0x4fe1('0x7'));var logger=require(_0x4fe1('0x8'))('rpc');var config=require(_0x4fe1('0x9'));var jayson=require(_0x4fe1('0xa'));var client=jayson[_0x4fe1('0xb')]['http']({'port':0x232a});config[_0x4fe1('0xc')]=_[_0x4fe1('0xd')](config[_0x4fe1('0xc')],{'host':_0x4fe1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4fe1('0xc')]));require('./team.socket')[_0x4fe1('0xf')](socket);function respondWithRpcPromise(_0x247147,_0x7c36b5,_0x780f93){return new BPromise(function(_0x295fcb,_0x35cf00){return client[_0x4fe1('0x10')](_0x247147,_0x780f93)[_0x4fe1('0x11')](function(_0x2141e7){logger[_0x4fe1('0x12')](_0x4fe1('0x13'),_0x7c36b5,_0x4fe1('0x14'));logger[_0x4fe1('0x15')](_0x4fe1('0x16'),_0x7c36b5,_0x4fe1('0x14'),JSON[_0x4fe1('0x17')](_0x2141e7));if(_0x2141e7[_0x4fe1('0x18')]){if(_0x2141e7['error'][_0x4fe1('0x19')]===0x1f4){logger[_0x4fe1('0x18')](_0x4fe1('0x13'),_0x7c36b5,_0x2141e7[_0x4fe1('0x18')][_0x4fe1('0x1a')]);return _0x35cf00(_0x2141e7[_0x4fe1('0x18')][_0x4fe1('0x1a')]);}logger['error'](_0x4fe1('0x13'),_0x7c36b5,_0x2141e7['error'][_0x4fe1('0x1a')]);return _0x295fcb(_0x2141e7[_0x4fe1('0x18')][_0x4fe1('0x1a')]);}else{logger[_0x4fe1('0x12')](_0x4fe1('0x13'),_0x7c36b5,_0x4fe1('0x14'));_0x295fcb(_0x2141e7[_0x4fe1('0x1b')][_0x4fe1('0x1a')]);}})[_0x4fe1('0x1c')](function(_0xa60243){logger[_0x4fe1('0x18')](_0x4fe1('0x13'),_0x7c36b5,_0xa60243);_0x35cf00(_0xa60243);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 70214bb..f5ca4c0 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 _0xffb1=['./team.events','save','remove','update','emit','register','length'];(function(_0xb5f0fa,_0x503af7){var _0x18d0fb=function(_0x4965a1){while(--_0x4965a1){_0xb5f0fa['push'](_0xb5f0fa['shift']());}};_0x18d0fb(++_0x503af7);}(_0xffb1,0x93));var _0x1ffb=function(_0x113a6c,_0x10df30){_0x113a6c=_0x113a6c-0x0;var _0x1ac632=_0xffb1[_0x113a6c];return _0x1ac632;};'use strict';var TeamEvents=require(_0x1ffb('0x0'));var events=[_0x1ffb('0x1'),_0x1ffb('0x2'),_0x1ffb('0x3')];function createListener(_0x19bb43,_0x24d6be){return function(_0x4e3800){_0x24d6be[_0x1ffb('0x4')](_0x19bb43,_0x4e3800);};}function removeListener(_0x41a84c,_0xc36826){return function(){TeamEvents['removeListener'](_0x41a84c,_0xc36826);};}exports[_0x1ffb('0x5')]=function(_0x677ad0){for(var _0x3fc606=0x0,_0x2bfa98=events[_0x1ffb('0x6')];_0x3fc606<_0x2bfa98;_0x3fc606++){var _0x5bae77=events[_0x3fc606];var _0x1787b1=createListener('team:'+_0x5bae77,_0x677ad0);TeamEvents['on'](_0x5bae77,_0x1787b1);}}; \ No newline at end of file +var _0x94ba=['remove','update','length','team:','./team.events','save'];(function(_0x1eb591,_0x2098b6){var _0x3724ba=function(_0x44f164){while(--_0x44f164){_0x1eb591['push'](_0x1eb591['shift']());}};_0x3724ba(++_0x2098b6);}(_0x94ba,0xbe));var _0xa94b=function(_0x77e7e8,_0x5a319f){_0x77e7e8=_0x77e7e8-0x0;var _0x205a3e=_0x94ba[_0x77e7e8];return _0x205a3e;};'use strict';var TeamEvents=require(_0xa94b('0x0'));var events=[_0xa94b('0x1'),_0xa94b('0x2'),_0xa94b('0x3')];function createListener(_0x2275a0,_0x552bca){return function(_0xf515c0){_0x552bca['emit'](_0x2275a0,_0xf515c0);};}function removeListener(_0x3041fd,_0xd72e72){return function(){TeamEvents['removeListener'](_0x3041fd,_0xd72e72);};}exports['register']=function(_0x76f30f){for(var _0x2daeef=0x0,_0x363129=events[_0xa94b('0x4')];_0x2daeef<_0x363129;_0x2daeef++){var _0x54c158=events[_0x2daeef];var _0x41aca1=createListener(_0xa94b('0x5')+_0x54c158,_0x76f30f);TeamEvents['on'](_0x54c158,_0x41aca1);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index ef330ae..d562912 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 _0x5078=['/:id','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','show','post','create'];(function(_0xc51494,_0x1c14a0){var _0x15704d=function(_0x1763dd){while(--_0x1763dd){_0xc51494['push'](_0xc51494['shift']());}};_0x15704d(++_0x1c14a0);}(_0x5078,0x125));var _0x8507=function(_0x2969a3,_0x801e59){_0x2969a3=_0x2969a3-0x0;var _0x40f909=_0x5078[_0x2969a3];return _0x40f909;};'use strict';var multer=require('multer');var util=require(_0x8507('0x0'));var path=require(_0x8507('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8507('0x2')]();var auth=require(_0x8507('0x3'));var interaction=require(_0x8507('0x4'));var config=require('../../config/environment');var controller=require(_0x8507('0x5'));router[_0x8507('0x6')]('/',auth[_0x8507('0x7')](),controller['index']);router['get']('/:id',auth[_0x8507('0x7')](),controller[_0x8507('0x8')]);router[_0x8507('0x9')]('/',auth[_0x8507('0x7')](),controller[_0x8507('0xa')]);router['put'](_0x8507('0xb'),auth[_0x8507('0x7')](),controller[_0x8507('0xc')]);router[_0x8507('0xd')](_0x8507('0xb'),auth[_0x8507('0x7')](),controller[_0x8507('0xe')]);module[_0x8507('0xf')]=router; \ No newline at end of file +var _0x1c1a=['../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','/:id','post','create','update','delete','destroy','util','express','Router','../../components/auth/service'];(function(_0x4908a4,_0x4aad15){var _0x5c133d=function(_0x33e4b4){while(--_0x33e4b4){_0x4908a4['push'](_0x4908a4['shift']());}};_0x5c133d(++_0x4aad15);}(_0x1c1a,0x155));var _0xa1c1=function(_0x179f14,_0x256d88){_0x179f14=_0x179f14-0x0;var _0x56afc2=_0x1c1a[_0x179f14];return _0x56afc2;};'use strict';var multer=require('multer');var util=require(_0xa1c1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa1c1('0x1'));var router=express[_0xa1c1('0x2')]();var auth=require(_0xa1c1('0x3'));var interaction=require(_0xa1c1('0x4'));var config=require(_0xa1c1('0x5'));var controller=require(_0xa1c1('0x6'));router['get']('/',auth[_0xa1c1('0x7')](),controller[_0xa1c1('0x8')]);router['get'](_0xa1c1('0x9'),auth[_0xa1c1('0x7')](),controller['show']);router[_0xa1c1('0xa')]('/',auth[_0xa1c1('0x7')](),controller[_0xa1c1('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa1c1('0xc')]);router[_0xa1c1('0xd')](_0xa1c1('0x9'),auth['isAuthenticated'](),controller[_0xa1c1('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index a3f0e74..d41b0ad 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 _0x11c2=['TEXT','sequelize','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x11c2,0x1b1));var _0x211c=function(_0x527c81,_0x4e2a64){_0x527c81=_0x527c81-0x0;var _0x5b56c3=_0x11c2[_0x527c81];return _0x5b56c3;};'use strict';var Sequelize=require(_0x211c('0x0'));module['exports']={'name':{'type':Sequelize[_0x211c('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x211c('0x2')]}}; \ No newline at end of file +var _0x0001=['TEXT','sequelize','STRING'];(function(_0x1209a1,_0x54cf7b){var _0x4a845e=function(_0xf4d045){while(--_0xf4d045){_0x1209a1['push'](_0x1209a1['shift']());}};_0x4a845e(++_0x54cf7b);}(_0x0001,0x154));var _0x1000=function(_0x565511,_0x582632){_0x565511=_0x565511-0x0;var _0x44379a=_0x0001[_0x565511];return _0x44379a;};'use strict';var Sequelize=require(_0x1000('0x0'));module['exports']={'name':{'type':Sequelize[_0x1000('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x1000('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 98a5d11..06a05cc 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 _0x814b=['filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','Template','includeAll','include','rows','catch','keys','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','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','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','index','map','rawAttributes','type','model','query'];(function(_0x2a9d1d,_0x3fa3fc){var _0x41e45d=function(_0x25c1de){while(--_0x25c1de){_0x2a9d1d['push'](_0x2a9d1d['shift']());}};_0x41e45d(++_0x3fa3fc);}(_0x814b,0x1a2));var _0xb814=function(_0x5e6d65,_0x5db89c){_0x5e6d65=_0x5e6d65-0x0;var _0x5e1f75=_0x814b[_0x5e6d65];return _0x5e1f75;};'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'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){var _0x594470=_0x27352e[_0xb814('0x26')]({'plain':!![]});var _0x52b7a3=_0xb814('0x27');return db[_0xb814('0x28')][_0xb814('0x25')]({'where':{'type':_0x52b7a3,'resourceId':_0x594470['id']}})[_0xb814('0x24')](function(){return _0x27352e;});})[_0xb814('0x24')](function(){_0x3b267e[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x5755ea,_0x392222){return function(_0xc0ef66){if(!_0xc0ef66){_0x5755ea[_0xb814('0x1b')](0x194);}return _0xc0ef66;};}function handleError(_0x349394,_0x32ed56){_0x32ed56=_0x32ed56||0x1f4;return function(_0x1d5965){logger[_0xb814('0x29')](_0x1d5965[_0xb814('0x2a')]);if(_0x1d5965['name']){delete _0x1d5965[_0xb814('0x2b')];}_0x349394[_0xb814('0x1c')](_0x32ed56)['send'](_0x1d5965);};}exports[_0xb814('0x2c')]=function(_0x37d24d,_0x530744){var _0x499f22={},_0x20577b={},_0x2051d0={'count':0x0,'rows':[]};var _0x58c3ca=_[_0xb814('0x2d')](db['Template'][_0xb814('0x2e')],function(_0x5f3e9b){return{'name':_0x5f3e9b['fieldName'],'type':_0x5f3e9b[_0xb814('0x2f')]['key']};});_0x20577b[_0xb814('0x30')]=_[_0xb814('0x2d')](_0x58c3ca,_0xb814('0x2b'));_0x20577b['query']=_['keys'](_0x37d24d[_0xb814('0x31')]);_0x20577b[_0xb814('0x32')]=_['intersection'](_0x20577b[_0xb814('0x30')],_0x20577b[_0xb814('0x31')]);_0x499f22[_0xb814('0x33')]=_[_0xb814('0x34')](_0x20577b[_0xb814('0x30')],qs[_0xb814('0x35')](_0x37d24d[_0xb814('0x31')]['fields']));_0x499f22[_0xb814('0x33')]=_0x499f22[_0xb814('0x33')][_0xb814('0x36')]?_0x499f22[_0xb814('0x33')]:_0x20577b[_0xb814('0x30')];if(!_0x37d24d['query'][_0xb814('0x37')]('nolimit')){_0x499f22[_0xb814('0x38')]=qs[_0xb814('0x38')](_0x37d24d[_0xb814('0x31')]['limit']);_0x499f22[_0xb814('0x20')]=qs[_0xb814('0x20')](_0x37d24d['query'][_0xb814('0x20')]);}_0x499f22[_0xb814('0x39')]=qs[_0xb814('0x3a')](_0x37d24d[_0xb814('0x31')][_0xb814('0x3a')]);_0x499f22[_0xb814('0x3b')]=qs['filters'](_[_0xb814('0x3c')](_0x37d24d['query'],_0x20577b[_0xb814('0x32')]),_0x58c3ca);if(_0x37d24d['query'][_0xb814('0x3d')]){_0x499f22['where']=_[_0xb814('0x3e')](_0x499f22[_0xb814('0x3b')],{'$or':_['map'](_0x58c3ca,function(_0x4d308a){if(_0x4d308a['type']!=='VIRTUAL'){var _0x17549e={};_0x17549e[_0x4d308a[_0xb814('0x2b')]]={'$like':'%'+_0x37d24d[_0xb814('0x31')][_0xb814('0x3d')]+'%'};return _0x17549e;}})});}_0x499f22=_['merge']({},_0x499f22,_0x37d24d['options']);var _0x6f15d3={'where':_0x499f22['where']};return db[_0xb814('0x3f')][_0xb814('0x1f')](_0x6f15d3)[_0xb814('0x24')](function(_0x3063bf){_0x2051d0[_0xb814('0x1f')]=_0x3063bf;if(_0x37d24d[_0xb814('0x31')][_0xb814('0x40')]){_0x499f22[_0xb814('0x41')]=[{'all':!![]}];}return db[_0xb814('0x3f')]['findAll'](_0x499f22);})['then'](function(_0x5d26be){_0x2051d0[_0xb814('0x42')]=_0x5d26be;return _0x2051d0;})['then'](respondWithFilteredResult(_0x530744,_0x499f22))[_0xb814('0x43')](handleError(_0x530744,null));};exports['show']=function(_0x411723,_0x44ff56){var _0x9ef639={'raw':!![],'where':{'id':_0x411723['params']['id']}},_0x2e97cc={};_0x2e97cc[_0xb814('0x30')]=_[_0xb814('0x44')](db[_0xb814('0x3f')][_0xb814('0x2e')]);_0x2e97cc[_0xb814('0x31')]=_[_0xb814('0x44')](_0x411723['query']);_0x2e97cc[_0xb814('0x32')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],_0x2e97cc[_0xb814('0x31')]);_0x9ef639[_0xb814('0x33')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],qs['fields'](_0x411723['query'][_0xb814('0x35')]));_0x9ef639[_0xb814('0x33')]=_0x9ef639[_0xb814('0x33')][_0xb814('0x36')]?_0x9ef639[_0xb814('0x33')]:_0x2e97cc[_0xb814('0x30')];if(_0x411723[_0xb814('0x31')][_0xb814('0x40')]){_0x9ef639[_0xb814('0x41')]=[{'all':!![]}];}_0x9ef639=_[_0xb814('0x3e')]({},_0x9ef639,_0x411723[_0xb814('0x45')]);return db['Template'][_0xb814('0x46')](_0x9ef639)[_0xb814('0x24')](handleEntityNotFound(_0x44ff56,null))['then'](respondWithResult(_0x44ff56,null))[_0xb814('0x43')](handleError(_0x44ff56,null));};exports['create']=function(_0x2fb0f7,_0x37866f){return db[_0xb814('0x3f')][_0xb814('0x47')](_0x2fb0f7[_0xb814('0x48')],{})[_0xb814('0x24')](function(_0x2cc806){var _0x45480e=_0x2fb0f7[_0xb814('0x49')][_0xb814('0x26')]({'plain':!![]});if(!_0x45480e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45480e['role']===_0xb814('0x49')){var _0x30f07b=_0x2cc806[_0xb814('0x26')]({'plain':!![]});var _0x3f8e29=_0xb814('0x27');return db[_0xb814('0x4a')][_0xb814('0x46')]({'where':{'name':_0x3f8e29,'userProfileId':_0x45480e['userProfileId']},'raw':!![]})[_0xb814('0x24')](function(_0x388324){if(_0x388324&&_0x388324[_0xb814('0x4b')]===0x0){return db['UserProfileResource'][_0xb814('0x47')]({'name':_0x30f07b['name'],'resourceId':_0x30f07b['id'],'type':_0x388324[_0xb814('0x2b')],'sectionId':_0x388324['id']},{})['then'](function(){return _0x2cc806;});}else{return _0x2cc806;}})[_0xb814('0x43')](function(_0x3cf8f8){logger['error'](_0xb814('0x4c'),_0x3cf8f8);throw _0x3cf8f8;});}return _0x2cc806;})[_0xb814('0x24')](respondWithResult(_0x37866f,0xc9))[_0xb814('0x43')](handleError(_0x37866f,null));};exports['update']=function(_0x3da050,_0x5f0e58){if(_0x3da050[_0xb814('0x48')]['id']){delete _0x3da050[_0xb814('0x48')]['id'];}return db['Template'][_0xb814('0x46')]({'where':{'id':_0x3da050['params']['id']}})['then'](handleEntityNotFound(_0x5f0e58,null))[_0xb814('0x24')](saveUpdates(_0x3da050[_0xb814('0x48')],null))[_0xb814('0x24')](respondWithResult(_0x5f0e58,null))['catch'](handleError(_0x5f0e58,null));};exports[_0xb814('0x25')]=function(_0x538b0f,_0xf88d23){return db[_0xb814('0x3f')]['find']({'where':{'id':_0x538b0f[_0xb814('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf88d23,null))[_0xb814('0x24')](removeEntity(_0xf88d23,null))[_0xb814('0x43')](handleError(_0xf88d23,null));}; \ No newline at end of file +var _0xe14b=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','get','Templates','then','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','fields','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x341053,_0x310529){var _0x1a6af4=function(_0x24c4bf){while(--_0x24c4bf){_0x341053['push'](_0x341053['shift']());}};_0x1a6af4(++_0x310529);}(_0xe14b,0x93));var _0xbe14=function(_0x2fe4c3,_0x255739){_0x2fe4c3=_0x2fe4c3-0x0;var _0x1bb8d2=_0xe14b[_0x2fe4c3];return _0x1bb8d2;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=_0xf4ac9[_0xbe14('0x19')],_0x4e8f34=_0x3dc4a9[_0xbe14('0x1a')],_0x21c789=_0x3dc4a9[_0xbe14('0x1a')]+_0x3dc4a9[_0xbe14('0x1b')],_0xe9c3ec;if(_0x21c789>=_0x37ce4e){_0x21c789=_0x37ce4e;_0xe9c3ec=0xc8;}else{_0xe9c3ec=0xce;}_0x3f58f5[_0xbe14('0x17')](_0xe9c3ec);return _0x3f58f5['set'](_0xbe14('0x1c'),_0x4e8f34+'-'+_0x21c789+'/'+_0x37ce4e)[_0xbe14('0x1d')](_0xf4ac9);}return null;};}function patchUpdates(_0x329588){return function(_0x433459){try{jsonpatch[_0xbe14('0x1e')](_0x433459,_0x329588,!![]);}catch(_0x37e4c1){return BPromise['reject'](_0x37e4c1);}return _0x433459[_0xbe14('0x1f')]();};}function saveUpdates(_0x4a1bbd,_0x417c8d){return function(_0xc12977){if(_0xc12977){return _0xc12977[_0xbe14('0x20')](_0x4a1bbd)['then'](function(_0xe60f42){return _0xe60f42;});}return null;};}function removeEntity(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')]()['then'](function(){var _0x274018=_0x56e80c[_0xbe14('0x22')]({'plain':!![]});var _0x505dbd=_0xbe14('0x23');return db['UserProfileResource'][_0xbe14('0x21')]({'where':{'type':_0x505dbd,'resourceId':_0x274018['id']}})['then'](function(){return _0x56e80c;});})[_0xbe14('0x24')](function(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x39cc81,_0x15ef02){return function(_0x2703f5){if(!_0x2703f5){_0x39cc81['sendStatus'](0x194);}return _0x2703f5;};}function handleError(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0x1f4;return function(_0x391556){logger[_0xbe14('0x25')](_0x391556['stack']);if(_0x391556[_0xbe14('0x26')]){delete _0x391556[_0xbe14('0x26')];}_0x1822e0['status'](_0x1ba46a)[_0xbe14('0x27')](_0x391556);};}exports[_0xbe14('0x28')]=function(_0x1c7cc7,_0x19252f){var _0x34d648={},_0x36d4b2={},_0x31a664={'count':0x0,'rows':[]};var _0x2b05cb=_[_0xbe14('0x29')](db[_0xbe14('0x2a')][_0xbe14('0x2b')],function(_0x3bf43c){return{'name':_0x3bf43c[_0xbe14('0x2c')],'type':_0x3bf43c[_0xbe14('0x2d')][_0xbe14('0x2e')]};});_0x36d4b2[_0xbe14('0x2f')]=_[_0xbe14('0x29')](_0x2b05cb,_0xbe14('0x26'));_0x36d4b2[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x1c7cc7['query']);_0x36d4b2[_0xbe14('0x32')]=_['intersection'](_0x36d4b2['model'],_0x36d4b2[_0xbe14('0x30')]);_0x34d648['attributes']=_[_0xbe14('0x33')](_0x36d4b2[_0xbe14('0x2f')],qs['fields'](_0x1c7cc7['query']['fields']));_0x34d648[_0xbe14('0x34')]=_0x34d648[_0xbe14('0x34')]['length']?_0x34d648[_0xbe14('0x34')]:_0x36d4b2[_0xbe14('0x2f')];if(!_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x34d648['limit']=qs['limit'](_0x1c7cc7[_0xbe14('0x30')]['limit']);_0x34d648['offset']=qs['offset'](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x1a')]);}_0x34d648[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x38')]);_0x34d648[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x1c7cc7[_0xbe14('0x30')],_0x36d4b2[_0xbe14('0x32')]),_0x2b05cb);if(_0x1c7cc7[_0xbe14('0x30')]['filter']){_0x34d648['where']=_[_0xbe14('0x3b')](_0x34d648[_0xbe14('0x39')],{'$or':_[_0xbe14('0x29')](_0x2b05cb,function(_0x520e09){if(_0x520e09[_0xbe14('0x2d')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x26')]]={'$like':'%'+_0x1c7cc7[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x34d648=_[_0xbe14('0x3b')]({},_0x34d648,_0x1c7cc7[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x34d648['where']};return db[_0xbe14('0x2a')][_0xbe14('0x19')](_0x1b2608)[_0xbe14('0x24')](function(_0x1b3118){_0x31a664[_0xbe14('0x19')]=_0x1b3118;if(_0x1c7cc7[_0xbe14('0x30')]['includeAll']){_0x34d648[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2a')][_0xbe14('0x40')](_0x34d648);})[_0xbe14('0x24')](function(_0x5cf713){_0x31a664['rows']=_0x5cf713;return _0x31a664;})[_0xbe14('0x24')](respondWithFilteredResult(_0x19252f,_0x34d648))[_0xbe14('0x41')](handleError(_0x19252f,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':!![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2f')]=_[_0xbe14('0x31')](db[_0xbe14('0x2a')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2f')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['Template'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x24')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['Template']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x24')](function(_0x4a1a37){var _0x5acf90=_0x2d6ee8[_0xbe14('0x49')][_0xbe14('0x22')]({'plain':!![]});if(!_0x5acf90)throw new Error(_0xbe14('0x4a'));if(_0x5acf90[_0xbe14('0x4b')]===_0xbe14('0x49')){var _0xd04fd5=_0x4a1a37[_0xbe14('0x22')]({'plain':!![]});var _0x5a4068=_0xbe14('0x23');return db[_0xbe14('0x4c')][_0xbe14('0x46')]({'where':{'name':_0x5a4068,'userProfileId':_0x5acf90[_0xbe14('0x4d')]},'raw':!![]})[_0xbe14('0x24')](function(_0x494c32){if(_0x494c32&&_0x494c32[_0xbe14('0x4e')]===0x0){return db[_0xbe14('0x4f')][_0xbe14('0x47')]({'name':_0xd04fd5[_0xbe14('0x26')],'resourceId':_0xd04fd5['id'],'type':_0x494c32[_0xbe14('0x26')],'sectionId':_0x494c32['id']},{})[_0xbe14('0x24')](function(){return _0x4a1a37;});}else{return _0x4a1a37;}})['catch'](function(_0x5aeea9){logger[_0xbe14('0x25')](_0xbe14('0x50'),_0x5aeea9);throw _0x5aeea9;});}return _0x4a1a37;})[_0xbe14('0x24')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0x44fe0d,_0x134878){if(_0x44fe0d['body']['id']){delete _0x44fe0d[_0xbe14('0x48')]['id'];}return db[_0xbe14('0x2a')]['find']({'where':{'id':_0x44fe0d[_0xbe14('0x51')]['id']}})['then'](handleEntityNotFound(_0x134878,null))[_0xbe14('0x24')](saveUpdates(_0x44fe0d[_0xbe14('0x48')],null))[_0xbe14('0x24')](respondWithResult(_0x134878,null))['catch'](handleError(_0x134878,null));};exports[_0xbe14('0x21')]=function(_0x404212,_0x5dc78a){return db[_0xbe14('0x2a')][_0xbe14('0x46')]({'where':{'id':_0x404212[_0xbe14('0x51')]['id']}})[_0xbe14('0x24')](handleEntityNotFound(_0x5dc78a,null))[_0xbe14('0x24')](removeEntity(_0x5dc78a,null))['catch'](handleError(_0x5dc78a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index aaf7f02..c2570d7 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 _0xe510=['api','moment','bluebird','request-promise','rimraf','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x3eaa0b,_0x13e590){var _0x4db919=function(_0x57c3c9){while(--_0x57c3c9){_0x3eaa0b['push'](_0x3eaa0b['shift']());}};_0x4db919(++_0x13e590);}(_0xe510,0xc0));var _0x0e51=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xe510[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x0e51('0x0'));var util=require(_0x0e51('0x1'));var logger=require(_0x0e51('0x2'))(_0x0e51('0x3'));var moment=require(_0x0e51('0x4'));var BPromise=require(_0x0e51('0x5'));var rp=require(_0x0e51('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e51('0x7'));var config=require('../../config/environment');var attributes=require(_0x0e51('0x8'));module[_0x0e51('0x9')]=function(_0x52eb3b,_0x52ed76){return _0x52eb3b[_0x0e51('0xa')](_0x0e51('0xb'),attributes,{'tableName':_0x0e51('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8da1=['exports','define','Template','tools_templates','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./template.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8da1,0x1a8));var _0x18da=function(_0x53f005,_0xfae300){_0x53f005=_0x53f005-0x0;var _0x3c3464=_0x8da1[_0x53f005];return _0x3c3464;};'use strict';var _=require(_0x18da('0x0'));var util=require(_0x18da('0x1'));var logger=require(_0x18da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x18da('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x18da('0x4'));var rimraf=require(_0x18da('0x5'));var config=require(_0x18da('0x6'));var attributes=require(_0x18da('0x7'));module[_0x18da('0x8')]=function(_0x2d8b64,_0x17d749){return _0x2d8b64[_0x18da('0x9')](_0x18da('0xa'),attributes,{'tableName':_0x18da('0xb'),'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 2cbc59c..52a92dc 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 _0x2cdd=['ioredis','../../config/utils','rpc','../../config/environment','client','request','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','Template','options','raw','where','attributes','limit','include','map','model','then','GetTemplate','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x255ac0,_0x3f6645){var _0x437bf1=function(_0x5baff0){while(--_0x5baff0){_0x255ac0['push'](_0x255ac0['shift']());}};_0x437bf1(++_0x3f6645);}(_0x2cdd,0x124));var _0xd2cd=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x2cdd[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xd2cd('0x0'));var util=require(_0xd2cd('0x1'));var moment=require(_0xd2cd('0x2'));var BPromise=require(_0xd2cd('0x3'));var rs=require(_0xd2cd('0x4'));var fs=require('fs');var Redis=require(_0xd2cd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd2cd('0x6'));var logger=require('../../config/logger')(_0xd2cd('0x7'));var config=require(_0xd2cd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd2cd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13471e,_0x3b2673,_0x39bc31){return new BPromise(function(_0x247069,_0x2bc97f){return client[_0xd2cd('0xa')](_0x13471e,_0x39bc31)['then'](function(_0x20bafe){logger['info'](_0xd2cd('0xb'),_0x3b2673,_0xd2cd('0xc'));logger[_0xd2cd('0xd')](_0xd2cd('0xe'),_0x3b2673,_0xd2cd('0xc'),JSON['stringify'](_0x20bafe));if(_0x20bafe[_0xd2cd('0xf')]){if(_0x20bafe['error'][_0xd2cd('0x10')]===0x1f4){logger[_0xd2cd('0xf')](_0xd2cd('0xb'),_0x3b2673,_0x20bafe[_0xd2cd('0xf')][_0xd2cd('0x11')]);return _0x2bc97f(_0x20bafe[_0xd2cd('0xf')][_0xd2cd('0x11')]);}logger[_0xd2cd('0xf')](_0xd2cd('0xb'),_0x3b2673,_0x20bafe['error'][_0xd2cd('0x11')]);return _0x247069(_0x20bafe[_0xd2cd('0xf')][_0xd2cd('0x11')]);}else{logger[_0xd2cd('0x12')](_0xd2cd('0xb'),_0x3b2673,_0xd2cd('0xc'));_0x247069(_0x20bafe[_0xd2cd('0x13')][_0xd2cd('0x11')]);}})[_0xd2cd('0x14')](function(_0xbb582a){logger['error'](_0xd2cd('0xb'),_0x3b2673,_0xbb582a);_0x2bc97f(_0xbb582a);});});}exports['GetTemplate']=function(_0x4b5650){var _0x40d478=this;return new Promise(function(_0x4dac72,_0x324447){return db[_0xd2cd('0x15')]['findAll']({'raw':_0x4b5650['options']?_0x4b5650[_0xd2cd('0x16')][_0xd2cd('0x17')]===undefined?!![]:![]:!![],'where':_0x4b5650['options']?_0x4b5650['options'][_0xd2cd('0x18')]||null:null,'attributes':_0x4b5650['options']?_0x4b5650['options'][_0xd2cd('0x19')]||null:null,'limit':_0x4b5650[_0xd2cd('0x16')]?_0x4b5650[_0xd2cd('0x16')][_0xd2cd('0x1a')]||null:null,'include':_0x4b5650[_0xd2cd('0x16')]?_0x4b5650[_0xd2cd('0x16')][_0xd2cd('0x1b')]?_[_0xd2cd('0x1c')](_0x4b5650[_0xd2cd('0x16')][_0xd2cd('0x1b')],function(_0x3958e4){return{'model':db[_0x3958e4[_0xd2cd('0x1d')]],'as':_0x3958e4['as'],'attributes':_0x3958e4[_0xd2cd('0x19')],'include':_0x3958e4[_0xd2cd('0x1b')]?_['map'](_0x3958e4[_0xd2cd('0x1b')],function(_0x174c67){return{'model':db[_0x174c67[_0xd2cd('0x1d')]],'as':_0x174c67['as'],'attributes':_0x174c67[_0xd2cd('0x19')],'include':_0x174c67[_0xd2cd('0x1b')]?_[_0xd2cd('0x1c')](_0x174c67[_0xd2cd('0x1b')],function(_0x3f3cb4){return{'model':db[_0x3f3cb4[_0xd2cd('0x1d')]],'as':_0x3f3cb4['as'],'attributes':_0x3f3cb4[_0xd2cd('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd2cd('0x1e')](function(_0x10ded8){logger[_0xd2cd('0x12')](_0xd2cd('0x1f'),_0x4b5650);logger[_0xd2cd('0xd')](_0xd2cd('0x1f'),_0x4b5650,JSON[_0xd2cd('0x20')](_0x10ded8));_0x4dac72(_0x10ded8);})[_0xd2cd('0x14')](function(_0x487696){logger[_0xd2cd('0xf')](_0xd2cd('0x1f'),_0x487696['message'],_0x4b5650);_0x324447(_0x40d478[_0xd2cd('0xf')](0x1f4,_0x487696[_0xd2cd('0x11')]));});});}; \ No newline at end of file +var _0xd2af=['attributes','map','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','findAll','options','where','include','model'];(function(_0x220540,_0x534c70){var _0x2b8b99=function(_0xc49724){while(--_0xc49724){_0x220540['push'](_0x220540['shift']());}};_0x2b8b99(++_0x534c70);}(_0xd2af,0xfb));var _0xfd2a=function(_0x4001ad,_0x1e22dd){_0x4001ad=_0x4001ad-0x0;var _0x4c7ec2=_0xd2af[_0x4001ad];return _0x4c7ec2;};'use strict';var _=require(_0xfd2a('0x0'));var util=require(_0xfd2a('0x1'));var moment=require(_0xfd2a('0x2'));var BPromise=require('bluebird');var rs=require(_0xfd2a('0x3'));var fs=require('fs');var Redis=require(_0xfd2a('0x4'));var db=require(_0xfd2a('0x5'))['db'];var utils=require(_0xfd2a('0x6'));var logger=require('../../config/logger')(_0xfd2a('0x7'));var config=require(_0xfd2a('0x8'));var jayson=require(_0xfd2a('0x9'));var client=jayson[_0xfd2a('0xa')][_0xfd2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x278be3,_0x4e9fdf,_0x32ae9e){return new BPromise(function(_0x2aa8cd,_0x4de222){return client['request'](_0x278be3,_0x32ae9e)[_0xfd2a('0xc')](function(_0x12ef3e){logger['info'](_0xfd2a('0xd'),_0x4e9fdf,_0xfd2a('0xe'));logger[_0xfd2a('0xf')](_0xfd2a('0x10'),_0x4e9fdf,_0xfd2a('0xe'),JSON[_0xfd2a('0x11')](_0x12ef3e));if(_0x12ef3e[_0xfd2a('0x12')]){if(_0x12ef3e[_0xfd2a('0x12')][_0xfd2a('0x13')]===0x1f4){logger[_0xfd2a('0x12')](_0xfd2a('0xd'),_0x4e9fdf,_0x12ef3e[_0xfd2a('0x12')][_0xfd2a('0x14')]);return _0x4de222(_0x12ef3e['error'][_0xfd2a('0x14')]);}logger['error'](_0xfd2a('0xd'),_0x4e9fdf,_0x12ef3e[_0xfd2a('0x12')][_0xfd2a('0x14')]);return _0x2aa8cd(_0x12ef3e[_0xfd2a('0x12')][_0xfd2a('0x14')]);}else{logger['info'](_0xfd2a('0xd'),_0x4e9fdf,_0xfd2a('0xe'));_0x2aa8cd(_0x12ef3e['result']['message']);}})[_0xfd2a('0x15')](function(_0x113339){logger['error'](_0xfd2a('0xd'),_0x4e9fdf,_0x113339);_0x4de222(_0x113339);});});}exports[_0xfd2a('0x16')]=function(_0x341165){var _0x39ccab=this;return new Promise(function(_0x2fe992,_0xbece3a){return db['Template'][_0xfd2a('0x17')]({'raw':_0x341165[_0xfd2a('0x18')]?_0x341165[_0xfd2a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x341165[_0xfd2a('0x18')]?_0x341165[_0xfd2a('0x18')][_0xfd2a('0x19')]||null:null,'attributes':_0x341165[_0xfd2a('0x18')]?_0x341165[_0xfd2a('0x18')]['attributes']||null:null,'limit':_0x341165[_0xfd2a('0x18')]?_0x341165['options']['limit']||null:null,'include':_0x341165[_0xfd2a('0x18')]?_0x341165[_0xfd2a('0x18')][_0xfd2a('0x1a')]?_['map'](_0x341165['options']['include'],function(_0x4b4d88){return{'model':db[_0x4b4d88[_0xfd2a('0x1b')]],'as':_0x4b4d88['as'],'attributes':_0x4b4d88[_0xfd2a('0x1c')],'include':_0x4b4d88[_0xfd2a('0x1a')]?_['map'](_0x4b4d88[_0xfd2a('0x1a')],function(_0x5b793a){return{'model':db[_0x5b793a[_0xfd2a('0x1b')]],'as':_0x5b793a['as'],'attributes':_0x5b793a[_0xfd2a('0x1c')],'include':_0x5b793a[_0xfd2a('0x1a')]?_[_0xfd2a('0x1d')](_0x5b793a[_0xfd2a('0x1a')],function(_0x578f98){return{'model':db[_0x578f98['model']],'as':_0x578f98['as'],'attributes':_0x578f98[_0xfd2a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfd2a('0xc')](function(_0x1019b0){logger[_0xfd2a('0x1e')](_0xfd2a('0x16'),_0x341165);logger[_0xfd2a('0xf')]('GetTemplate',_0x341165,JSON['stringify'](_0x1019b0));_0x2fe992(_0x1019b0);})[_0xfd2a('0x15')](function(_0x4c3f5e){logger[_0xfd2a('0x12')](_0xfd2a('0x16'),_0x4c3f5e['message'],_0x341165);_0xbece3a(_0x39ccab['error'](0x1f4,_0x4c3f5e[_0xfd2a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 8fc4f43..837d5c2 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 _0x2c76=['getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAnyCondition','addAction','put','update','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions'];(function(_0x517c97,_0x3fd275){var _0x244ef3=function(_0x2a858d){while(--_0x2a858d){_0x517c97['push'](_0x517c97['shift']());}};_0x244ef3(++_0x3fd275);}(_0x2c76,0x6e));var _0x62c7=function(_0x10dcf6,_0x11f29b){_0x10dcf6=_0x10dcf6-0x0;var _0x5cf8e5=_0x2c76[_0x10dcf6];return _0x5cf8e5;};'use strict';var multer=require(_0x62c7('0x0'));var util=require(_0x62c7('0x1'));var path=require(_0x62c7('0x2'));var timeout=require(_0x62c7('0x3'));var express=require('express');var router=express[_0x62c7('0x4')]();var auth=require(_0x62c7('0x5'));var interaction=require(_0x62c7('0x6'));var config=require(_0x62c7('0x7'));var controller=require(_0x62c7('0x8'));router[_0x62c7('0x9')]('/',auth[_0x62c7('0xa')](),controller[_0x62c7('0xb')]);router[_0x62c7('0x9')](_0x62c7('0xc'),auth[_0x62c7('0xa')](),controller[_0x62c7('0xd')]);router['get'](_0x62c7('0xe'),auth[_0x62c7('0xa')](),controller[_0x62c7('0xf')]);router['get'](_0x62c7('0x10'),auth[_0x62c7('0xa')](),controller[_0x62c7('0x11')]);router[_0x62c7('0x9')](_0x62c7('0x12'),auth[_0x62c7('0xa')](),controller['getActions']);router[_0x62c7('0x13')]('/',auth[_0x62c7('0xa')](),controller[_0x62c7('0x14')]);router[_0x62c7('0x13')](_0x62c7('0xe'),auth['isAuthenticated'](),controller['addAllCondition']);router['post'](_0x62c7('0x10'),auth[_0x62c7('0xa')](),controller[_0x62c7('0x15')]);router[_0x62c7('0x13')](_0x62c7('0x12'),auth[_0x62c7('0xa')](),controller[_0x62c7('0x16')]);router[_0x62c7('0x17')](_0x62c7('0xc'),auth[_0x62c7('0xa')](),controller[_0x62c7('0x18')]);router['delete'](_0x62c7('0xc'),auth[_0x62c7('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x72e1=['getAnyConditions','/:id/actions','post','create','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/all_conditions','/:id/any_conditions'];(function(_0x30d112,_0x4a7808){var _0x593f20=function(_0x519525){while(--_0x519525){_0x30d112['push'](_0x30d112['shift']());}};_0x593f20(++_0x4a7808);}(_0x72e1,0x174));var _0x172e=function(_0x28d32a,_0x38098a){_0x28d32a=_0x28d32a-0x0;var _0x438b67=_0x72e1[_0x28d32a];return _0x438b67;};'use strict';var multer=require(_0x172e('0x0'));var util=require(_0x172e('0x1'));var path=require('path');var timeout=require(_0x172e('0x2'));var express=require(_0x172e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x172e('0x4'));var config=require(_0x172e('0x5'));var controller=require('./trigger.controller');router[_0x172e('0x6')]('/',auth[_0x172e('0x7')](),controller['index']);router['get'](_0x172e('0x8'),auth[_0x172e('0x7')](),controller[_0x172e('0x9')]);router[_0x172e('0x6')](_0x172e('0xa'),auth[_0x172e('0x7')](),controller['getAllConditions']);router[_0x172e('0x6')](_0x172e('0xb'),auth[_0x172e('0x7')](),controller[_0x172e('0xc')]);router[_0x172e('0x6')](_0x172e('0xd'),auth[_0x172e('0x7')](),controller['getActions']);router[_0x172e('0xe')]('/',auth[_0x172e('0x7')](),controller[_0x172e('0xf')]);router[_0x172e('0xe')]('/:id/all_conditions',auth[_0x172e('0x7')](),controller[_0x172e('0x10')]);router[_0x172e('0xe')](_0x172e('0xb'),auth[_0x172e('0x7')](),controller[_0x172e('0x11')]);router[_0x172e('0xe')](_0x172e('0xd'),auth[_0x172e('0x7')](),controller[_0x172e('0x12')]);router[_0x172e('0x13')](_0x172e('0x8'),auth[_0x172e('0x7')](),controller[_0x172e('0x14')]);router[_0x172e('0x15')](_0x172e('0x8'),auth[_0x172e('0x7')](),controller[_0x172e('0x16')]);module[_0x172e('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 3dba9b1..017a208 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 _0xd02f=['STRING','BOOLEAN','sequelize','exports'];(function(_0x620f48,_0x3cad18){var _0x3a7a25=function(_0x3fa550){while(--_0x3fa550){_0x620f48['push'](_0x620f48['shift']());}};_0x3a7a25(++_0x3cad18);}(_0xd02f,0x1e6));var _0xfd02=function(_0x70588,_0x2e21dd){_0x70588=_0x70588-0x0;var _0x1981d8=_0xd02f[_0x70588];return _0x1981d8;};'use strict';var Sequelize=require(_0xfd02('0x0'));module[_0xfd02('0x1')]={'name':{'type':Sequelize[_0xfd02('0x2')]},'channel':{'type':Sequelize[_0xfd02('0x2')]},'description':{'type':Sequelize[_0xfd02('0x2')]},'status':{'type':Sequelize[_0xfd02('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5e58=['BOOLEAN','sequelize','exports','STRING'];(function(_0xd1349a,_0x338e04){var _0x22d181=function(_0x4488f1){while(--_0x4488f1){_0xd1349a['push'](_0xd1349a['shift']());}};_0x22d181(++_0x338e04);}(_0x5e58,0x7d));var _0x85e5=function(_0x4e808c,_0x3ebb84){_0x4e808c=_0x4e808c-0x0;var _0x1db4c6=_0x5e58[_0x4e808c];return _0x1db4c6;};'use strict';var Sequelize=require(_0x85e5('0x0'));module[_0x85e5('0x1')]={'name':{'type':Sequelize[_0x85e5('0x2')]},'channel':{'type':Sequelize[_0x85e5('0x2')]},'description':{'type':Sequelize[_0x85e5('0x2')]},'status':{'type':Sequelize[_0x85e5('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 5d685b9..7c578c7 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 _0xac4f=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','rawAttributes','pick','getAnyConditions','TriggerId','Action','getActions','html-pdf','rimraf','fast-json-patch','bluebird','mustache','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','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','update','then','destroy','get','UserProfileResource','error','name','send','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','Trigger','includeAll','include','findAll','rows','catch','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Triggers','UserProfileSection'];(function(_0x166fa3,_0x35f581){var _0x32458a=function(_0x4a28d8){while(--_0x4a28d8){_0x166fa3['push'](_0x166fa3['shift']());}};_0x32458a(++_0x35f581);}(_0xac4f,0x122));var _0xfac4=function(_0x345087,_0x53b1e6){_0x345087=_0x345087-0x0;var _0x453863=_0xac4f[_0x345087];return _0x453863;};'use strict';var pdf=require(_0xfac4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfac4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfac4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfac4('0x3'));var Mustache=require(_0xfac4('0x4'));var util=require('util');var path=require(_0xfac4('0x5'));var sox=require(_0xfac4('0x6'));var csv=require(_0xfac4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfac4('0x8'));var squel=require(_0xfac4('0x9'));var crypto=require(_0xfac4('0xa'));var jsforce=require(_0xfac4('0xb'));var deskjs=require(_0xfac4('0xc'));var toCsv=require(_0xfac4('0x7'));var querystring=require('querystring');var Papa=require(_0xfac4('0xd'));var Redis=require(_0xfac4('0xe'));var authService=require(_0xfac4('0xf'));var qs=require(_0xfac4('0x10'));var as=require(_0xfac4('0x11'));var hardwareService=require(_0xfac4('0x12'));var logger=require(_0xfac4('0x13'))(_0xfac4('0x14'));var utils=require(_0xfac4('0x15'));var config=require(_0xfac4('0x16'));var licenseUtil=require(_0xfac4('0x17'));var db=require(_0xfac4('0x18'))['db'];function respondWithStatusCode(_0x5e374a,_0x2f9c87){_0x2f9c87=_0x2f9c87||0xcc;return function(_0x5bcc16){if(_0x5bcc16){return _0x5e374a[_0xfac4('0x19')](_0x2f9c87);}return _0x5e374a[_0xfac4('0x1a')](_0x2f9c87)[_0xfac4('0x1b')]();};}function respondWithResult(_0x4599cc,_0x114653){_0x114653=_0x114653||0xc8;return function(_0xcde790){if(_0xcde790){return _0x4599cc[_0xfac4('0x1a')](_0x114653)[_0xfac4('0x1c')](_0xcde790);}};}function respondWithFilteredResult(_0x48a42b,_0x3d529f){return function(_0x40fe62){if(_0x40fe62){var _0x3be3c1=_0x40fe62[_0xfac4('0x1d')],_0xcf7e40=_0x3d529f[_0xfac4('0x1e')],_0x2c8c6f=_0x3d529f[_0xfac4('0x1e')]+_0x3d529f['limit'],_0x3ce345;if(_0x2c8c6f>=_0x3be3c1){_0x2c8c6f=_0x3be3c1;_0x3ce345=0xc8;}else{_0x3ce345=0xce;}_0x48a42b['status'](_0x3ce345);return _0x48a42b['set'](_0xfac4('0x1f'),_0xcf7e40+'-'+_0x2c8c6f+'/'+_0x3be3c1)[_0xfac4('0x1c')](_0x40fe62);}return null;};}function patchUpdates(_0x4aec9e){return function(_0x5d75c2){try{jsonpatch['apply'](_0x5d75c2,_0x4aec9e,!![]);}catch(_0x15fcc7){return BPromise[_0xfac4('0x20')](_0x15fcc7);}return _0x5d75c2['save']();};}function saveUpdates(_0x227f7e,_0xb69d66){return function(_0x347499){if(_0x347499){return _0x347499[_0xfac4('0x21')](_0x227f7e)[_0xfac4('0x22')](function(_0x3392d7){return _0x3392d7;});}return null;};}function removeEntity(_0x41ac63,_0x6b08a2){return function(_0x238895){if(_0x238895){return _0x238895[_0xfac4('0x23')]()[_0xfac4('0x22')](function(){var _0x54d294=_0x238895[_0xfac4('0x24')]({'plain':!![]});var _0x1b09d2='Triggers';return db[_0xfac4('0x25')][_0xfac4('0x23')]({'where':{'type':_0x1b09d2,'resourceId':_0x54d294['id']}})[_0xfac4('0x22')](function(){return _0x238895;});})['then'](function(){_0x41ac63[_0xfac4('0x1a')](0xcc)[_0xfac4('0x1b')]();});}};}function handleEntityNotFound(_0x58bb4b,_0xc5a38f){return function(_0x41c8c6){if(!_0x41c8c6){_0x58bb4b[_0xfac4('0x19')](0x194);}return _0x41c8c6;};}function handleError(_0x3b54e4,_0x62c6bd){_0x62c6bd=_0x62c6bd||0x1f4;return function(_0x528844){logger[_0xfac4('0x26')](_0x528844['stack']);if(_0x528844[_0xfac4('0x27')]){delete _0x528844[_0xfac4('0x27')];}_0x3b54e4['status'](_0x62c6bd)[_0xfac4('0x28')](_0x528844);};}exports['index']=function(_0xe6e21c,_0x59c386){var _0x598504={},_0x15f768={},_0x536fb2={'count':0x0,'rows':[]};var _0x1703cd=_[_0xfac4('0x29')](db['Trigger']['rawAttributes'],function(_0xec16da){return{'name':_0xec16da['fieldName'],'type':_0xec16da[_0xfac4('0x2a')][_0xfac4('0x2b')]};});_0x15f768[_0xfac4('0x2c')]=_[_0xfac4('0x29')](_0x1703cd,_0xfac4('0x27'));_0x15f768[_0xfac4('0x2d')]=_['keys'](_0xe6e21c['query']);_0x15f768[_0xfac4('0x2e')]=_[_0xfac4('0x2f')](_0x15f768[_0xfac4('0x2c')],_0x15f768[_0xfac4('0x2d')]);_0x598504[_0xfac4('0x30')]=_[_0xfac4('0x2f')](_0x15f768[_0xfac4('0x2c')],qs[_0xfac4('0x31')](_0xe6e21c[_0xfac4('0x2d')][_0xfac4('0x31')]));_0x598504['attributes']=_0x598504['attributes'][_0xfac4('0x32')]?_0x598504[_0xfac4('0x30')]:_0x15f768[_0xfac4('0x2c')];if(!_0xe6e21c[_0xfac4('0x2d')][_0xfac4('0x33')](_0xfac4('0x34'))){_0x598504[_0xfac4('0x35')]=qs[_0xfac4('0x35')](_0xe6e21c[_0xfac4('0x2d')][_0xfac4('0x35')]);_0x598504[_0xfac4('0x1e')]=qs[_0xfac4('0x1e')](_0xe6e21c['query'][_0xfac4('0x1e')]);}_0x598504[_0xfac4('0x36')]=qs[_0xfac4('0x37')](_0xe6e21c[_0xfac4('0x2d')][_0xfac4('0x37')]);_0x598504[_0xfac4('0x38')]=qs['filters'](_['pick'](_0xe6e21c[_0xfac4('0x2d')],_0x15f768[_0xfac4('0x2e')]),_0x1703cd);if(_0xe6e21c[_0xfac4('0x2d')]['filter']){_0x598504[_0xfac4('0x38')]=_[_0xfac4('0x39')](_0x598504[_0xfac4('0x38')],{'$or':_[_0xfac4('0x29')](_0x1703cd,function(_0x1be2c6){if(_0x1be2c6['type']!==_0xfac4('0x3a')){var _0x3bffd1={};_0x3bffd1[_0x1be2c6[_0xfac4('0x27')]]={'$like':'%'+_0xe6e21c[_0xfac4('0x2d')][_0xfac4('0x3b')]+'%'};return _0x3bffd1;}})});}_0x598504=_[_0xfac4('0x39')]({},_0x598504,_0xe6e21c[_0xfac4('0x3c')]);var _0x3cf4f8={'where':_0x598504['where']};return db[_0xfac4('0x3d')][_0xfac4('0x1d')](_0x3cf4f8)[_0xfac4('0x22')](function(_0x2c0207){_0x536fb2[_0xfac4('0x1d')]=_0x2c0207;if(_0xe6e21c[_0xfac4('0x2d')][_0xfac4('0x3e')]){_0x598504[_0xfac4('0x3f')]=[{'all':!![]}];}return db[_0xfac4('0x3d')][_0xfac4('0x40')](_0x598504);})[_0xfac4('0x22')](function(_0x27847f){_0x536fb2[_0xfac4('0x41')]=_0x27847f;return _0x536fb2;})[_0xfac4('0x22')](respondWithFilteredResult(_0x59c386,_0x598504))[_0xfac4('0x42')](handleError(_0x59c386,null));};exports['show']=function(_0x4d2d3f,_0x5c4de3){var _0x2a807f={'raw':![],'where':{'id':_0x4d2d3f[_0xfac4('0x43')]['id']}},_0x1a63b3={};_0x1a63b3[_0xfac4('0x2c')]=_[_0xfac4('0x44')](db[_0xfac4('0x3d')]['rawAttributes']);_0x1a63b3['query']=_['keys'](_0x4d2d3f[_0xfac4('0x2d')]);_0x1a63b3['filters']=_[_0xfac4('0x2f')](_0x1a63b3[_0xfac4('0x2c')],_0x1a63b3[_0xfac4('0x2d')]);_0x2a807f[_0xfac4('0x30')]=_[_0xfac4('0x2f')](_0x1a63b3[_0xfac4('0x2c')],qs[_0xfac4('0x31')](_0x4d2d3f[_0xfac4('0x2d')]['fields']));_0x2a807f[_0xfac4('0x30')]=_0x2a807f[_0xfac4('0x30')]['length']?_0x2a807f[_0xfac4('0x30')]:_0x1a63b3['model'];if(_0x4d2d3f[_0xfac4('0x2d')][_0xfac4('0x3e')]){_0x2a807f[_0xfac4('0x3f')]=[{'all':!![]}];}_0x2a807f=_[_0xfac4('0x39')]({},_0x2a807f,_0x4d2d3f[_0xfac4('0x3c')]);return db[_0xfac4('0x3d')]['find'](_0x2a807f)[_0xfac4('0x22')](handleEntityNotFound(_0x5c4de3,null))[_0xfac4('0x22')](respondWithResult(_0x5c4de3,null))[_0xfac4('0x42')](handleError(_0x5c4de3,null));};exports[_0xfac4('0x45')]=function(_0x559cea,_0x274db6){return db[_0xfac4('0x3d')][_0xfac4('0x45')](_0x559cea['body'],{})[_0xfac4('0x22')](function(_0x8c8d9a){var _0x32c735=_0x559cea[_0xfac4('0x46')]['get']({'plain':!![]});if(!_0x32c735)throw new Error(_0xfac4('0x47'));if(_0x32c735['role']===_0xfac4('0x46')){var _0x54d735=_0x8c8d9a[_0xfac4('0x24')]({'plain':!![]});var _0x33afda=_0xfac4('0x48');return db[_0xfac4('0x49')]['find']({'where':{'name':_0x33afda,'userProfileId':_0x32c735[_0xfac4('0x4a')]},'raw':!![]})['then'](function(_0x528419){if(_0x528419&&_0x528419['autoAssociation']===0x0){return db[_0xfac4('0x25')][_0xfac4('0x45')]({'name':_0x54d735[_0xfac4('0x27')],'resourceId':_0x54d735['id'],'type':_0x528419[_0xfac4('0x27')],'sectionId':_0x528419['id']},{})[_0xfac4('0x22')](function(){return _0x8c8d9a;});}else{return _0x8c8d9a;}})[_0xfac4('0x42')](function(_0x10ae52){logger[_0xfac4('0x26')](_0xfac4('0x4b'),_0x10ae52);throw _0x10ae52;});}return _0x8c8d9a;})['then'](respondWithResult(_0x274db6,0xc9))[_0xfac4('0x42')](handleError(_0x274db6,null));};exports[_0xfac4('0x21')]=function(_0x135f2e,_0xa25ef0){if(_0x135f2e['body']['id']){delete _0x135f2e[_0xfac4('0x4c')]['id'];}return db[_0xfac4('0x3d')][_0xfac4('0x4d')]({'where':{'id':_0x135f2e[_0xfac4('0x43')]['id']}})['then'](handleEntityNotFound(_0xa25ef0,null))[_0xfac4('0x22')](saveUpdates(_0x135f2e['body'],null))[_0xfac4('0x22')](respondWithResult(_0xa25ef0,null))[_0xfac4('0x42')](handleError(_0xa25ef0,null));};exports[_0xfac4('0x23')]=function(_0x4f90cd,_0x383f8c){return db[_0xfac4('0x3d')][_0xfac4('0x4d')]({'where':{'id':_0x4f90cd[_0xfac4('0x43')]['id']}})[_0xfac4('0x22')](handleEntityNotFound(_0x383f8c,null))[_0xfac4('0x22')](removeEntity(_0x383f8c,null))['catch'](handleError(_0x383f8c,null));};exports[_0xfac4('0x4e')]=function(_0x9c4efb,_0x417ce4,_0x261943){if(_0x9c4efb[_0xfac4('0x4c')]['id']){delete _0x9c4efb[_0xfac4('0x4c')]['id'];}return db[_0xfac4('0x3d')]['find']({'where':{'id':_0x9c4efb['params']['id']}})[_0xfac4('0x22')](handleEntityNotFound(_0x417ce4,null))[_0xfac4('0x22')](function(_0xbecb90){if(_0xbecb90){_0x9c4efb['body'][_0xfac4('0x4f')]=_0xbecb90['id'];return db[_0xfac4('0x50')][_0xfac4('0x45')](_0x9c4efb['body']);}})['then'](respondWithResult(_0x417ce4,null))[_0xfac4('0x42')](handleError(_0x417ce4,null));};exports[_0xfac4('0x51')]=function(_0x3e7931,_0x20dde9,_0x5ea747){if(_0x3e7931[_0xfac4('0x4c')]['id']){delete _0x3e7931[_0xfac4('0x4c')]['id'];}return db[_0xfac4('0x3d')][_0xfac4('0x4d')]({'where':{'id':_0x3e7931['params']['id']}})[_0xfac4('0x22')](handleEntityNotFound(_0x20dde9,null))[_0xfac4('0x22')](function(_0x1455e8){if(_0x1455e8){_0x3e7931[_0xfac4('0x4c')][_0xfac4('0x52')]=_0x1455e8['id'];return db['Condition']['create'](_0x3e7931['body']);}})[_0xfac4('0x22')](respondWithResult(_0x20dde9,null))[_0xfac4('0x42')](handleError(_0x20dde9,null));};exports[_0xfac4('0x53')]=function(_0x38d411,_0x1914b8,_0x51e7a3){var _0x4ba58c={};var _0x1be0ee={};var _0x361aee;var _0x57c5b9;return db[_0xfac4('0x3d')][_0xfac4('0x54')]({'where':{'id':_0x38d411[_0xfac4('0x43')]['id']}})[_0xfac4('0x22')](handleEntityNotFound(_0x1914b8,null))[_0xfac4('0x22')](function(_0x235797){if(_0x235797){_0x361aee=_0x235797;_0x1be0ee[_0xfac4('0x2c')]=_[_0xfac4('0x44')](db[_0xfac4('0x50')][_0xfac4('0x55')]);_0x1be0ee['query']=_[_0xfac4('0x44')](_0x38d411['query']);_0x1be0ee['filters']=_['intersection'](_0x1be0ee[_0xfac4('0x2c')],_0x1be0ee[_0xfac4('0x2d')]);_0x4ba58c[_0xfac4('0x30')]=_[_0xfac4('0x2f')](_0x1be0ee[_0xfac4('0x2c')],qs[_0xfac4('0x31')](_0x38d411[_0xfac4('0x2d')][_0xfac4('0x31')]));_0x4ba58c[_0xfac4('0x30')]=_0x4ba58c['attributes'][_0xfac4('0x32')]?_0x4ba58c[_0xfac4('0x30')]:_0x1be0ee['model'];_0x4ba58c[_0xfac4('0x36')]=qs[_0xfac4('0x37')](_0x38d411['query']['sort']);_0x4ba58c[_0xfac4('0x38')]=qs[_0xfac4('0x2e')](_[_0xfac4('0x56')](_0x38d411['query'],_0x1be0ee['filters']));if(_0x38d411[_0xfac4('0x2d')][_0xfac4('0x3b')]){_0x4ba58c['where']=_[_0xfac4('0x39')](_0x4ba58c[_0xfac4('0x38')],{'$or':_['map'](_0x4ba58c[_0xfac4('0x30')],function(_0x870399){var _0x58d32c={};_0x58d32c[_0x870399]={'$like':'%'+_0x38d411[_0xfac4('0x2d')][_0xfac4('0x3b')]+'%'};return _0x58d32c;})});}_0x4ba58c=_['merge']({},_0x4ba58c,_0x38d411[_0xfac4('0x3c')]);return _0x361aee[_0xfac4('0x53')](_0x4ba58c);}})[_0xfac4('0x22')](function(_0x29f9d3){if(_0x29f9d3){_0x57c5b9=_0x29f9d3[_0xfac4('0x32')];if(!_0x38d411[_0xfac4('0x2d')]['hasOwnProperty'](_0xfac4('0x34'))){_0x4ba58c['limit']=qs[_0xfac4('0x35')](_0x38d411['query'][_0xfac4('0x35')]);_0x4ba58c[_0xfac4('0x1e')]=qs[_0xfac4('0x1e')](_0x38d411[_0xfac4('0x2d')][_0xfac4('0x1e')]);}return _0x361aee['getAllConditions'](_0x4ba58c);}})[_0xfac4('0x22')](function(_0x1e41b6){if(_0x1e41b6){return _0x1e41b6?{'count':_0x57c5b9,'rows':_0x1e41b6}:null;}})[_0xfac4('0x22')](respondWithResult(_0x1914b8,null))[_0xfac4('0x42')](handleError(_0x1914b8,null));};exports[_0xfac4('0x57')]=function(_0x464a3f,_0x35a33a,_0x1ac5fd){var _0x4af3bb={};var _0x2327a8={};var _0x36ed73;var _0x2ff9d1;return db[_0xfac4('0x3d')]['findOne']({'where':{'id':_0x464a3f[_0xfac4('0x43')]['id']}})[_0xfac4('0x22')](handleEntityNotFound(_0x35a33a,null))[_0xfac4('0x22')](function(_0x4b4040){if(_0x4b4040){_0x36ed73=_0x4b4040;_0x2327a8[_0xfac4('0x2c')]=_['keys'](db[_0xfac4('0x50')][_0xfac4('0x55')]);_0x2327a8['query']=_[_0xfac4('0x44')](_0x464a3f[_0xfac4('0x2d')]);_0x2327a8[_0xfac4('0x2e')]=_[_0xfac4('0x2f')](_0x2327a8['model'],_0x2327a8['query']);_0x4af3bb[_0xfac4('0x30')]=_[_0xfac4('0x2f')](_0x2327a8[_0xfac4('0x2c')],qs[_0xfac4('0x31')](_0x464a3f[_0xfac4('0x2d')][_0xfac4('0x31')]));_0x4af3bb[_0xfac4('0x30')]=_0x4af3bb[_0xfac4('0x30')][_0xfac4('0x32')]?_0x4af3bb[_0xfac4('0x30')]:_0x2327a8[_0xfac4('0x2c')];_0x4af3bb[_0xfac4('0x36')]=qs[_0xfac4('0x37')](_0x464a3f[_0xfac4('0x2d')][_0xfac4('0x37')]);_0x4af3bb[_0xfac4('0x38')]=qs['filters'](_[_0xfac4('0x56')](_0x464a3f[_0xfac4('0x2d')],_0x2327a8[_0xfac4('0x2e')]));if(_0x464a3f[_0xfac4('0x2d')][_0xfac4('0x3b')]){_0x4af3bb['where']=_[_0xfac4('0x39')](_0x4af3bb[_0xfac4('0x38')],{'$or':_[_0xfac4('0x29')](_0x4af3bb[_0xfac4('0x30')],function(_0x3eb4d5){var _0x21d390={};_0x21d390[_0x3eb4d5]={'$like':'%'+_0x464a3f[_0xfac4('0x2d')][_0xfac4('0x3b')]+'%'};return _0x21d390;})});}_0x4af3bb=_[_0xfac4('0x39')]({},_0x4af3bb,_0x464a3f[_0xfac4('0x3c')]);return _0x36ed73[_0xfac4('0x57')](_0x4af3bb);}})[_0xfac4('0x22')](function(_0xaaca71){if(_0xaaca71){_0x2ff9d1=_0xaaca71[_0xfac4('0x32')];if(!_0x464a3f[_0xfac4('0x2d')][_0xfac4('0x33')]('nolimit')){_0x4af3bb['limit']=qs['limit'](_0x464a3f[_0xfac4('0x2d')][_0xfac4('0x35')]);_0x4af3bb[_0xfac4('0x1e')]=qs[_0xfac4('0x1e')](_0x464a3f['query']['offset']);}return _0x36ed73[_0xfac4('0x57')](_0x4af3bb);}})[_0xfac4('0x22')](function(_0x57b595){if(_0x57b595){return _0x57b595?{'count':_0x2ff9d1,'rows':_0x57b595}:null;}})[_0xfac4('0x22')](respondWithResult(_0x35a33a,null))['catch'](handleError(_0x35a33a,null));};exports['addAction']=function(_0x14fcb1,_0x18d23d,_0x32bd12){if(_0x14fcb1[_0xfac4('0x4c')]['id']){delete _0x14fcb1[_0xfac4('0x4c')]['id'];}return db[_0xfac4('0x3d')][_0xfac4('0x4d')]({'where':{'id':_0x14fcb1['params']['id']}})['then'](handleEntityNotFound(_0x18d23d,null))[_0xfac4('0x22')](function(_0x611fe9){if(_0x611fe9){_0x14fcb1['body'][_0xfac4('0x58')]=_0x611fe9['id'];return db['Action'][_0xfac4('0x45')](_0x14fcb1[_0xfac4('0x4c')]);}})[_0xfac4('0x22')](respondWithResult(_0x18d23d,null))['catch'](handleError(_0x18d23d,null));};exports['getActions']=function(_0x16e2f1,_0x5c387c,_0x36a246){var _0xf6105d={};var _0x5862f7={};var _0x11bde9;var _0x3f198f;return db[_0xfac4('0x3d')][_0xfac4('0x54')]({'where':{'id':_0x16e2f1[_0xfac4('0x43')]['id']}})[_0xfac4('0x22')](handleEntityNotFound(_0x5c387c,null))[_0xfac4('0x22')](function(_0x34b3ff){if(_0x34b3ff){_0x11bde9=_0x34b3ff;_0x5862f7[_0xfac4('0x2c')]=_[_0xfac4('0x44')](db[_0xfac4('0x59')][_0xfac4('0x55')]);_0x5862f7['query']=_[_0xfac4('0x44')](_0x16e2f1[_0xfac4('0x2d')]);_0x5862f7[_0xfac4('0x2e')]=_['intersection'](_0x5862f7[_0xfac4('0x2c')],_0x5862f7[_0xfac4('0x2d')]);_0xf6105d['attributes']=_[_0xfac4('0x2f')](_0x5862f7['model'],qs[_0xfac4('0x31')](_0x16e2f1['query']['fields']));_0xf6105d[_0xfac4('0x30')]=_0xf6105d['attributes'][_0xfac4('0x32')]?_0xf6105d[_0xfac4('0x30')]:_0x5862f7[_0xfac4('0x2c')];_0xf6105d[_0xfac4('0x36')]=qs[_0xfac4('0x37')](_0x16e2f1[_0xfac4('0x2d')][_0xfac4('0x37')]);_0xf6105d[_0xfac4('0x38')]=qs[_0xfac4('0x2e')](_[_0xfac4('0x56')](_0x16e2f1['query'],_0x5862f7[_0xfac4('0x2e')]));if(_0x16e2f1['query']['filter']){_0xf6105d[_0xfac4('0x38')]=_[_0xfac4('0x39')](_0xf6105d[_0xfac4('0x38')],{'$or':_['map'](_0xf6105d['attributes'],function(_0x47bf61){var _0x195cb0={};_0x195cb0[_0x47bf61]={'$like':'%'+_0x16e2f1[_0xfac4('0x2d')][_0xfac4('0x3b')]+'%'};return _0x195cb0;})});}_0xf6105d=_[_0xfac4('0x39')]({},_0xf6105d,_0x16e2f1[_0xfac4('0x3c')]);return _0x11bde9[_0xfac4('0x5a')](_0xf6105d);}})[_0xfac4('0x22')](function(_0x54e771){if(_0x54e771){_0x3f198f=_0x54e771[_0xfac4('0x32')];if(!_0x16e2f1[_0xfac4('0x2d')][_0xfac4('0x33')]('nolimit')){_0xf6105d[_0xfac4('0x35')]=qs[_0xfac4('0x35')](_0x16e2f1[_0xfac4('0x2d')][_0xfac4('0x35')]);_0xf6105d['offset']=qs[_0xfac4('0x1e')](_0x16e2f1[_0xfac4('0x2d')][_0xfac4('0x1e')]);}return _0x11bde9[_0xfac4('0x5a')](_0xf6105d);}})['then'](function(_0x5e95cd){if(_0x5e95cd){return _0x5e95cd?{'count':_0x3f198f,'rows':_0x5e95cd}:null;}})['then'](respondWithResult(_0x5c387c,null))[_0xfac4('0x42')](handleError(_0x5c387c,null));}; \ No newline at end of file +var _0xb7a8=['fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','count','offset','limit','Content-Range','json','reject','save','update','destroy','get','Triggers','UserProfileResource','then','end','stack','name','send','index','map','Trigger','rawAttributes'];(function(_0x490d15,_0x4bd596){var _0xb04f4=function(_0xe9c539){while(--_0xe9c539){_0x490d15['push'](_0x490d15['shift']());}};_0xb04f4(++_0x4bd596);}(_0xb7a8,0xec));var _0x8b7a=function(_0x5ee965,_0x372972){_0x5ee965=_0x5ee965-0x0;var _0x156b10=_0xb7a8[_0x5ee965];return _0x156b10;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b7a('0x0'));var rimraf=require(_0x8b7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b7a('0x2'));var rp=require(_0x8b7a('0x3'));var moment=require(_0x8b7a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b7a('0x5'));var util=require(_0x8b7a('0x6'));var path=require(_0x8b7a('0x7'));var sox=require(_0x8b7a('0x8'));var csv=require(_0x8b7a('0x9'));var ejs=require(_0x8b7a('0xa'));var fs=require('fs');var _=require(_0x8b7a('0xb'));var squel=require(_0x8b7a('0xc'));var crypto=require(_0x8b7a('0xd'));var jsforce=require(_0x8b7a('0xe'));var deskjs=require(_0x8b7a('0xf'));var toCsv=require(_0x8b7a('0x9'));var querystring=require('querystring');var Papa=require(_0x8b7a('0x10'));var Redis=require('ioredis');var authService=require(_0x8b7a('0x11'));var qs=require(_0x8b7a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b7a('0x13'));var logger=require(_0x8b7a('0x14'))(_0x8b7a('0x15'));var utils=require('../../config/utils');var config=require(_0x8b7a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b7a('0x17'))['db'];function respondWithStatusCode(_0xec9743,_0x231cac){_0x231cac=_0x231cac||0xcc;return function(_0x348c54){if(_0x348c54){return _0xec9743['sendStatus'](_0x231cac);}return _0xec9743[_0x8b7a('0x18')](_0x231cac)['end']();};}function respondWithResult(_0x39c91f,_0x1ca7fd){_0x1ca7fd=_0x1ca7fd||0xc8;return function(_0xe5796d){if(_0xe5796d){return _0x39c91f['status'](_0x1ca7fd)['json'](_0xe5796d);}};}function respondWithFilteredResult(_0x570134,_0x2bee4c){return function(_0x4b5bb2){if(_0x4b5bb2){var _0xf8214a=_0x4b5bb2[_0x8b7a('0x19')],_0x3f23c4=_0x2bee4c['offset'],_0x226bce=_0x2bee4c[_0x8b7a('0x1a')]+_0x2bee4c[_0x8b7a('0x1b')],_0x21a0be;if(_0x226bce>=_0xf8214a){_0x226bce=_0xf8214a;_0x21a0be=0xc8;}else{_0x21a0be=0xce;}_0x570134[_0x8b7a('0x18')](_0x21a0be);return _0x570134['set'](_0x8b7a('0x1c'),_0x3f23c4+'-'+_0x226bce+'/'+_0xf8214a)[_0x8b7a('0x1d')](_0x4b5bb2);}return null;};}function patchUpdates(_0x538fc3){return function(_0x48fe65){try{jsonpatch['apply'](_0x48fe65,_0x538fc3,!![]);}catch(_0x163466){return BPromise[_0x8b7a('0x1e')](_0x163466);}return _0x48fe65[_0x8b7a('0x1f')]();};}function saveUpdates(_0x2da603,_0x14f4bb){return function(_0x35e426){if(_0x35e426){return _0x35e426[_0x8b7a('0x20')](_0x2da603)['then'](function(_0x10cb69){return _0x10cb69;});}return null;};}function removeEntity(_0x2b5051,_0x97dbe0){return function(_0x31780){if(_0x31780){return _0x31780[_0x8b7a('0x21')]()['then'](function(){var _0x26fa01=_0x31780[_0x8b7a('0x22')]({'plain':!![]});var _0xf26e93=_0x8b7a('0x23');return db[_0x8b7a('0x24')][_0x8b7a('0x21')]({'where':{'type':_0xf26e93,'resourceId':_0x26fa01['id']}})[_0x8b7a('0x25')](function(){return _0x31780;});})[_0x8b7a('0x25')](function(){_0x2b5051['status'](0xcc)[_0x8b7a('0x26')]();});}};}function handleEntityNotFound(_0x513d65,_0x374fdb){return function(_0x21d759){if(!_0x21d759){_0x513d65['sendStatus'](0x194);}return _0x21d759;};}function handleError(_0x99ac3e,_0x111a2e){_0x111a2e=_0x111a2e||0x1f4;return function(_0x49f9c7){logger['error'](_0x49f9c7[_0x8b7a('0x27')]);if(_0x49f9c7[_0x8b7a('0x28')]){delete _0x49f9c7[_0x8b7a('0x28')];}_0x99ac3e[_0x8b7a('0x18')](_0x111a2e)[_0x8b7a('0x29')](_0x49f9c7);};}exports[_0x8b7a('0x2a')]=function(_0x2bdd4d,_0x5b6f6a){var _0xc09bd7={},_0x31aa1a={},_0x1706eb={'count':0x0,'rows':[]};var _0x4f5575=_[_0x8b7a('0x2b')](db[_0x8b7a('0x2c')][_0x8b7a('0x2d')],function(_0x558f49){return{'name':_0x558f49[_0x8b7a('0x2e')],'type':_0x558f49[_0x8b7a('0x2f')][_0x8b7a('0x30')]};});_0x31aa1a['model']=_[_0x8b7a('0x2b')](_0x4f5575,_0x8b7a('0x28'));_0x31aa1a[_0x8b7a('0x31')]=_[_0x8b7a('0x32')](_0x2bdd4d['query']);_0x31aa1a[_0x8b7a('0x33')]=_[_0x8b7a('0x34')](_0x31aa1a['model'],_0x31aa1a[_0x8b7a('0x31')]);_0xc09bd7[_0x8b7a('0x35')]=_[_0x8b7a('0x34')](_0x31aa1a[_0x8b7a('0x36')],qs[_0x8b7a('0x37')](_0x2bdd4d[_0x8b7a('0x31')][_0x8b7a('0x37')]));_0xc09bd7[_0x8b7a('0x35')]=_0xc09bd7[_0x8b7a('0x35')][_0x8b7a('0x38')]?_0xc09bd7[_0x8b7a('0x35')]:_0x31aa1a[_0x8b7a('0x36')];if(!_0x2bdd4d['query'][_0x8b7a('0x39')](_0x8b7a('0x3a'))){_0xc09bd7[_0x8b7a('0x1b')]=qs['limit'](_0x2bdd4d[_0x8b7a('0x31')][_0x8b7a('0x1b')]);_0xc09bd7[_0x8b7a('0x1a')]=qs['offset'](_0x2bdd4d[_0x8b7a('0x31')]['offset']);}_0xc09bd7[_0x8b7a('0x3b')]=qs[_0x8b7a('0x3c')](_0x2bdd4d['query'][_0x8b7a('0x3c')]);_0xc09bd7[_0x8b7a('0x3d')]=qs['filters'](_[_0x8b7a('0x3e')](_0x2bdd4d[_0x8b7a('0x31')],_0x31aa1a[_0x8b7a('0x33')]),_0x4f5575);if(_0x2bdd4d['query'][_0x8b7a('0x3f')]){_0xc09bd7['where']=_[_0x8b7a('0x40')](_0xc09bd7[_0x8b7a('0x3d')],{'$or':_[_0x8b7a('0x2b')](_0x4f5575,function(_0x1a12d3){if(_0x1a12d3[_0x8b7a('0x2f')]!==_0x8b7a('0x41')){var _0x3d1c46={};_0x3d1c46[_0x1a12d3['name']]={'$like':'%'+_0x2bdd4d[_0x8b7a('0x31')][_0x8b7a('0x3f')]+'%'};return _0x3d1c46;}})});}_0xc09bd7=_['merge']({},_0xc09bd7,_0x2bdd4d['options']);var _0x55bac7={'where':_0xc09bd7[_0x8b7a('0x3d')]};return db['Trigger'][_0x8b7a('0x19')](_0x55bac7)[_0x8b7a('0x25')](function(_0x424c3c){_0x1706eb[_0x8b7a('0x19')]=_0x424c3c;if(_0x2bdd4d['query'][_0x8b7a('0x42')]){_0xc09bd7['include']=[{'all':!![]}];}return db[_0x8b7a('0x2c')][_0x8b7a('0x43')](_0xc09bd7);})['then'](function(_0x5b7acd){_0x1706eb[_0x8b7a('0x44')]=_0x5b7acd;return _0x1706eb;})[_0x8b7a('0x25')](respondWithFilteredResult(_0x5b6f6a,_0xc09bd7))[_0x8b7a('0x45')](handleError(_0x5b6f6a,null));};exports[_0x8b7a('0x46')]=function(_0x2e8b37,_0x4e6a77){var _0x4b5d7c={'raw':![],'where':{'id':_0x2e8b37[_0x8b7a('0x47')]['id']}},_0x3e1752={};_0x3e1752[_0x8b7a('0x36')]=_['keys'](db[_0x8b7a('0x2c')][_0x8b7a('0x2d')]);_0x3e1752[_0x8b7a('0x31')]=_['keys'](_0x2e8b37['query']);_0x3e1752[_0x8b7a('0x33')]=_[_0x8b7a('0x34')](_0x3e1752[_0x8b7a('0x36')],_0x3e1752['query']);_0x4b5d7c[_0x8b7a('0x35')]=_['intersection'](_0x3e1752[_0x8b7a('0x36')],qs[_0x8b7a('0x37')](_0x2e8b37[_0x8b7a('0x31')][_0x8b7a('0x37')]));_0x4b5d7c[_0x8b7a('0x35')]=_0x4b5d7c[_0x8b7a('0x35')][_0x8b7a('0x38')]?_0x4b5d7c[_0x8b7a('0x35')]:_0x3e1752[_0x8b7a('0x36')];if(_0x2e8b37['query'][_0x8b7a('0x42')]){_0x4b5d7c['include']=[{'all':!![]}];}_0x4b5d7c=_[_0x8b7a('0x40')]({},_0x4b5d7c,_0x2e8b37[_0x8b7a('0x48')]);return db[_0x8b7a('0x2c')]['find'](_0x4b5d7c)[_0x8b7a('0x25')](handleEntityNotFound(_0x4e6a77,null))[_0x8b7a('0x25')](respondWithResult(_0x4e6a77,null))[_0x8b7a('0x45')](handleError(_0x4e6a77,null));};exports[_0x8b7a('0x49')]=function(_0x40cbe9,_0x3b9aee){return db['Trigger'][_0x8b7a('0x49')](_0x40cbe9['body'],{})[_0x8b7a('0x25')](function(_0x962c80){var _0x3b071d=_0x40cbe9[_0x8b7a('0x4a')][_0x8b7a('0x22')]({'plain':!![]});if(!_0x3b071d)throw new Error(_0x8b7a('0x4b'));if(_0x3b071d[_0x8b7a('0x4c')]===_0x8b7a('0x4a')){var _0x49eb93=_0x962c80[_0x8b7a('0x22')]({'plain':!![]});var _0x503b4f=_0x8b7a('0x23');return db[_0x8b7a('0x4d')][_0x8b7a('0x4e')]({'where':{'name':_0x503b4f,'userProfileId':_0x3b071d['userProfileId']},'raw':!![]})['then'](function(_0x957140){if(_0x957140&&_0x957140[_0x8b7a('0x4f')]===0x0){return db[_0x8b7a('0x24')][_0x8b7a('0x49')]({'name':_0x49eb93[_0x8b7a('0x28')],'resourceId':_0x49eb93['id'],'type':_0x957140['name'],'sectionId':_0x957140['id']},{})[_0x8b7a('0x25')](function(){return _0x962c80;});}else{return _0x962c80;}})[_0x8b7a('0x45')](function(_0x26b6d1){logger[_0x8b7a('0x50')](_0x8b7a('0x51'),_0x26b6d1);throw _0x26b6d1;});}return _0x962c80;})[_0x8b7a('0x25')](respondWithResult(_0x3b9aee,0xc9))['catch'](handleError(_0x3b9aee,null));};exports['update']=function(_0x3d5879,_0x5d1176){if(_0x3d5879[_0x8b7a('0x52')]['id']){delete _0x3d5879[_0x8b7a('0x52')]['id'];}return db[_0x8b7a('0x2c')][_0x8b7a('0x4e')]({'where':{'id':_0x3d5879[_0x8b7a('0x47')]['id']}})[_0x8b7a('0x25')](handleEntityNotFound(_0x5d1176,null))[_0x8b7a('0x25')](saveUpdates(_0x3d5879[_0x8b7a('0x52')],null))[_0x8b7a('0x25')](respondWithResult(_0x5d1176,null))['catch'](handleError(_0x5d1176,null));};exports[_0x8b7a('0x21')]=function(_0x3a7c7a,_0x1b84a4){return db['Trigger'][_0x8b7a('0x4e')]({'where':{'id':_0x3a7c7a[_0x8b7a('0x47')]['id']}})[_0x8b7a('0x25')](handleEntityNotFound(_0x1b84a4,null))['then'](removeEntity(_0x1b84a4,null))[_0x8b7a('0x45')](handleError(_0x1b84a4,null));};exports[_0x8b7a('0x53')]=function(_0x207564,_0x21d3da,_0x10c713){if(_0x207564[_0x8b7a('0x52')]['id']){delete _0x207564[_0x8b7a('0x52')]['id'];}return db[_0x8b7a('0x2c')]['find']({'where':{'id':_0x207564['params']['id']}})[_0x8b7a('0x25')](handleEntityNotFound(_0x21d3da,null))['then'](function(_0x219b8e){if(_0x219b8e){_0x207564[_0x8b7a('0x52')]['TriggerAllId']=_0x219b8e['id'];return db[_0x8b7a('0x54')][_0x8b7a('0x49')](_0x207564[_0x8b7a('0x52')]);}})[_0x8b7a('0x25')](respondWithResult(_0x21d3da,null))[_0x8b7a('0x45')](handleError(_0x21d3da,null));};exports[_0x8b7a('0x55')]=function(_0x37974d,_0x35d482,_0x58120c){if(_0x37974d[_0x8b7a('0x52')]['id']){delete _0x37974d[_0x8b7a('0x52')]['id'];}return db[_0x8b7a('0x2c')]['find']({'where':{'id':_0x37974d[_0x8b7a('0x47')]['id']}})[_0x8b7a('0x25')](handleEntityNotFound(_0x35d482,null))[_0x8b7a('0x25')](function(_0x15b4ee){if(_0x15b4ee){_0x37974d[_0x8b7a('0x52')][_0x8b7a('0x56')]=_0x15b4ee['id'];return db['Condition'][_0x8b7a('0x49')](_0x37974d[_0x8b7a('0x52')]);}})[_0x8b7a('0x25')](respondWithResult(_0x35d482,null))[_0x8b7a('0x45')](handleError(_0x35d482,null));};exports[_0x8b7a('0x57')]=function(_0x400833,_0xe1df19,_0x8e73e4){var _0x89000a={};var _0x16a8f9={};var _0x4293c2;var _0x1baaa6;return db[_0x8b7a('0x2c')]['findOne']({'where':{'id':_0x400833[_0x8b7a('0x47')]['id']}})['then'](handleEntityNotFound(_0xe1df19,null))['then'](function(_0x20463e){if(_0x20463e){_0x4293c2=_0x20463e;_0x16a8f9[_0x8b7a('0x36')]=_[_0x8b7a('0x32')](db[_0x8b7a('0x54')][_0x8b7a('0x2d')]);_0x16a8f9[_0x8b7a('0x31')]=_['keys'](_0x400833[_0x8b7a('0x31')]);_0x16a8f9[_0x8b7a('0x33')]=_['intersection'](_0x16a8f9['model'],_0x16a8f9[_0x8b7a('0x31')]);_0x89000a['attributes']=_[_0x8b7a('0x34')](_0x16a8f9[_0x8b7a('0x36')],qs[_0x8b7a('0x37')](_0x400833['query']['fields']));_0x89000a['attributes']=_0x89000a[_0x8b7a('0x35')][_0x8b7a('0x38')]?_0x89000a['attributes']:_0x16a8f9[_0x8b7a('0x36')];_0x89000a[_0x8b7a('0x3b')]=qs[_0x8b7a('0x3c')](_0x400833[_0x8b7a('0x31')][_0x8b7a('0x3c')]);_0x89000a[_0x8b7a('0x3d')]=qs[_0x8b7a('0x33')](_[_0x8b7a('0x3e')](_0x400833['query'],_0x16a8f9[_0x8b7a('0x33')]));if(_0x400833['query'][_0x8b7a('0x3f')]){_0x89000a['where']=_['merge'](_0x89000a[_0x8b7a('0x3d')],{'$or':_[_0x8b7a('0x2b')](_0x89000a[_0x8b7a('0x35')],function(_0x1f65ba){var _0x2bae97={};_0x2bae97[_0x1f65ba]={'$like':'%'+_0x400833[_0x8b7a('0x31')]['filter']+'%'};return _0x2bae97;})});}_0x89000a=_['merge']({},_0x89000a,_0x400833['options']);return _0x4293c2[_0x8b7a('0x57')](_0x89000a);}})[_0x8b7a('0x25')](function(_0x3adb75){if(_0x3adb75){_0x1baaa6=_0x3adb75[_0x8b7a('0x38')];if(!_0x400833[_0x8b7a('0x31')][_0x8b7a('0x39')](_0x8b7a('0x3a'))){_0x89000a[_0x8b7a('0x1b')]=qs[_0x8b7a('0x1b')](_0x400833['query'][_0x8b7a('0x1b')]);_0x89000a['offset']=qs['offset'](_0x400833[_0x8b7a('0x31')][_0x8b7a('0x1a')]);}return _0x4293c2[_0x8b7a('0x57')](_0x89000a);}})[_0x8b7a('0x25')](function(_0x403494){if(_0x403494){return _0x403494?{'count':_0x1baaa6,'rows':_0x403494}:null;}})[_0x8b7a('0x25')](respondWithResult(_0xe1df19,null))[_0x8b7a('0x45')](handleError(_0xe1df19,null));};exports[_0x8b7a('0x58')]=function(_0x1cbaa9,_0xaead7b,_0x42ef78){var _0x56228e={};var _0x476cea={};var _0x351f31;var _0x3d130e;return db['Trigger'][_0x8b7a('0x59')]({'where':{'id':_0x1cbaa9['params']['id']}})[_0x8b7a('0x25')](handleEntityNotFound(_0xaead7b,null))[_0x8b7a('0x25')](function(_0x2068b1){if(_0x2068b1){_0x351f31=_0x2068b1;_0x476cea[_0x8b7a('0x36')]=_['keys'](db[_0x8b7a('0x54')][_0x8b7a('0x2d')]);_0x476cea['query']=_[_0x8b7a('0x32')](_0x1cbaa9[_0x8b7a('0x31')]);_0x476cea['filters']=_[_0x8b7a('0x34')](_0x476cea[_0x8b7a('0x36')],_0x476cea[_0x8b7a('0x31')]);_0x56228e['attributes']=_[_0x8b7a('0x34')](_0x476cea['model'],qs['fields'](_0x1cbaa9['query'][_0x8b7a('0x37')]));_0x56228e['attributes']=_0x56228e[_0x8b7a('0x35')][_0x8b7a('0x38')]?_0x56228e[_0x8b7a('0x35')]:_0x476cea[_0x8b7a('0x36')];_0x56228e[_0x8b7a('0x3b')]=qs[_0x8b7a('0x3c')](_0x1cbaa9[_0x8b7a('0x31')]['sort']);_0x56228e[_0x8b7a('0x3d')]=qs['filters'](_[_0x8b7a('0x3e')](_0x1cbaa9[_0x8b7a('0x31')],_0x476cea[_0x8b7a('0x33')]));if(_0x1cbaa9[_0x8b7a('0x31')][_0x8b7a('0x3f')]){_0x56228e[_0x8b7a('0x3d')]=_[_0x8b7a('0x40')](_0x56228e[_0x8b7a('0x3d')],{'$or':_[_0x8b7a('0x2b')](_0x56228e[_0x8b7a('0x35')],function(_0x19ce9c){var _0x23222a={};_0x23222a[_0x19ce9c]={'$like':'%'+_0x1cbaa9['query'][_0x8b7a('0x3f')]+'%'};return _0x23222a;})});}_0x56228e=_['merge']({},_0x56228e,_0x1cbaa9[_0x8b7a('0x48')]);return _0x351f31[_0x8b7a('0x58')](_0x56228e);}})[_0x8b7a('0x25')](function(_0x5376b5){if(_0x5376b5){_0x3d130e=_0x5376b5[_0x8b7a('0x38')];if(!_0x1cbaa9[_0x8b7a('0x31')][_0x8b7a('0x39')](_0x8b7a('0x3a'))){_0x56228e[_0x8b7a('0x1b')]=qs[_0x8b7a('0x1b')](_0x1cbaa9[_0x8b7a('0x31')][_0x8b7a('0x1b')]);_0x56228e[_0x8b7a('0x1a')]=qs[_0x8b7a('0x1a')](_0x1cbaa9[_0x8b7a('0x31')][_0x8b7a('0x1a')]);}return _0x351f31[_0x8b7a('0x58')](_0x56228e);}})[_0x8b7a('0x25')](function(_0xcd2a6c){if(_0xcd2a6c){return _0xcd2a6c?{'count':_0x3d130e,'rows':_0xcd2a6c}:null;}})[_0x8b7a('0x25')](respondWithResult(_0xaead7b,null))[_0x8b7a('0x45')](handleError(_0xaead7b,null));};exports[_0x8b7a('0x5a')]=function(_0x28af6f,_0x33214d,_0x982866){if(_0x28af6f['body']['id']){delete _0x28af6f['body']['id'];}return db[_0x8b7a('0x2c')][_0x8b7a('0x4e')]({'where':{'id':_0x28af6f[_0x8b7a('0x47')]['id']}})[_0x8b7a('0x25')](handleEntityNotFound(_0x33214d,null))['then'](function(_0x144d1f){if(_0x144d1f){_0x28af6f[_0x8b7a('0x52')][_0x8b7a('0x5b')]=_0x144d1f['id'];return db[_0x8b7a('0x5c')][_0x8b7a('0x49')](_0x28af6f[_0x8b7a('0x52')]);}})[_0x8b7a('0x25')](respondWithResult(_0x33214d,null))[_0x8b7a('0x45')](handleError(_0x33214d,null));};exports[_0x8b7a('0x5d')]=function(_0x20454d,_0x5b6f73,_0x3041c3){var _0x5d93c5={};var _0x35b46a={};var _0xe4de13;var _0x336464;return db[_0x8b7a('0x2c')][_0x8b7a('0x59')]({'where':{'id':_0x20454d[_0x8b7a('0x47')]['id']}})[_0x8b7a('0x25')](handleEntityNotFound(_0x5b6f73,null))[_0x8b7a('0x25')](function(_0xac0b1f){if(_0xac0b1f){_0xe4de13=_0xac0b1f;_0x35b46a[_0x8b7a('0x36')]=_[_0x8b7a('0x32')](db['Action'][_0x8b7a('0x2d')]);_0x35b46a[_0x8b7a('0x31')]=_[_0x8b7a('0x32')](_0x20454d[_0x8b7a('0x31')]);_0x35b46a[_0x8b7a('0x33')]=_[_0x8b7a('0x34')](_0x35b46a[_0x8b7a('0x36')],_0x35b46a[_0x8b7a('0x31')]);_0x5d93c5[_0x8b7a('0x35')]=_['intersection'](_0x35b46a[_0x8b7a('0x36')],qs[_0x8b7a('0x37')](_0x20454d['query']['fields']));_0x5d93c5['attributes']=_0x5d93c5['attributes'][_0x8b7a('0x38')]?_0x5d93c5[_0x8b7a('0x35')]:_0x35b46a[_0x8b7a('0x36')];_0x5d93c5[_0x8b7a('0x3b')]=qs[_0x8b7a('0x3c')](_0x20454d['query'][_0x8b7a('0x3c')]);_0x5d93c5['where']=qs['filters'](_[_0x8b7a('0x3e')](_0x20454d[_0x8b7a('0x31')],_0x35b46a['filters']));if(_0x20454d['query'][_0x8b7a('0x3f')]){_0x5d93c5[_0x8b7a('0x3d')]=_['merge'](_0x5d93c5['where'],{'$or':_[_0x8b7a('0x2b')](_0x5d93c5[_0x8b7a('0x35')],function(_0x510459){var _0x2224c8={};_0x2224c8[_0x510459]={'$like':'%'+_0x20454d[_0x8b7a('0x31')]['filter']+'%'};return _0x2224c8;})});}_0x5d93c5=_[_0x8b7a('0x40')]({},_0x5d93c5,_0x20454d[_0x8b7a('0x48')]);return _0xe4de13[_0x8b7a('0x5d')](_0x5d93c5);}})[_0x8b7a('0x25')](function(_0xa11582){if(_0xa11582){_0x336464=_0xa11582[_0x8b7a('0x38')];if(!_0x20454d['query']['hasOwnProperty'](_0x8b7a('0x3a'))){_0x5d93c5[_0x8b7a('0x1b')]=qs[_0x8b7a('0x1b')](_0x20454d[_0x8b7a('0x31')]['limit']);_0x5d93c5['offset']=qs['offset'](_0x20454d[_0x8b7a('0x31')][_0x8b7a('0x1a')]);}return _0xe4de13[_0x8b7a('0x5d')](_0x5d93c5);}})['then'](function(_0x2d8888){if(_0x2d8888){return _0x2d8888?{'count':_0x336464,'rows':_0x2d8888}:null;}})[_0x8b7a('0x25')](respondWithResult(_0x5b6f73,null))['catch'](handleError(_0x5b6f73,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 0c4659b..e913be9 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 _0xacdd=['define','Trigger','tools_triggers','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./trigger.attributes','exports'];(function(_0x319d0a,_0x3ec5f4){var _0x5c07fa=function(_0x58eaaf){while(--_0x58eaaf){_0x319d0a['push'](_0x319d0a['shift']());}};_0x5c07fa(++_0x3ec5f4);}(_0xacdd,0x12f));var _0xdacd=function(_0x17df16,_0x84c577){_0x17df16=_0x17df16-0x0;var _0x1ba549=_0xacdd[_0x17df16];return _0x1ba549;};'use strict';var _=require(_0xdacd('0x0'));var util=require(_0xdacd('0x1'));var logger=require(_0xdacd('0x2'))('api');var moment=require(_0xdacd('0x3'));var BPromise=require(_0xdacd('0x4'));var rp=require(_0xdacd('0x5'));var fs=require('fs');var path=require(_0xdacd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdacd('0x7'));module[_0xdacd('0x8')]=function(_0xeb4ba2,_0x4a9e7c){return _0xeb4ba2[_0xdacd('0x9')](_0xdacd('0xa'),attributes,{'tableName':_0xdacd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccef=['path','rimraf','exports','define','Trigger','tools_triggers','util','api','moment','bluebird','request-promise'];(function(_0x18c666,_0x1fdaa1){var _0x3374cb=function(_0x368153){while(--_0x368153){_0x18c666['push'](_0x18c666['shift']());}};_0x3374cb(++_0x1fdaa1);}(_0xccef,0x1d4));var _0xfcce=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xccef[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xfcce('0x0'));var logger=require('../../config/logger')(_0xfcce('0x1'));var moment=require(_0xfcce('0x2'));var BPromise=require(_0xfcce('0x3'));var rp=require(_0xfcce('0x4'));var fs=require('fs');var path=require(_0xfcce('0x5'));var rimraf=require(_0xfcce('0x6'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0xfcce('0x7')]=function(_0x4f6cae,_0x96ac52){return _0x4f6cae[_0xfcce('0x8')](_0xfcce('0x9'),attributes,{'tableName':_0xfcce('0xa'),'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 9d53fd0..13a75c7 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 _0xd8b0=['raw','where','include','map','model','attributes','ShowTrigger','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','options'];(function(_0x53e9ed,_0x1282e5){var _0x54990a=function(_0x4a4db4){while(--_0x4a4db4){_0x53e9ed['push'](_0x53e9ed['shift']());}};_0x54990a(++_0x1282e5);}(_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')]('GetTrigger',_0x5fecbd);logger[_0x0d8b('0xe')]('GetTrigger',_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['Trigger'][_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']('ShowTrigger',_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 _0xfff0=['model','info','GetTrigger','catch','ShowTrigger','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Trigger','findAll','options','raw','attributes','include','map'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xfff0,0x139));var _0x0fff=function(_0x42d8b8,_0x5d6bdd){_0x42d8b8=_0x42d8b8-0x0;var _0x38f778=_0xfff0[_0x42d8b8];return _0x38f778;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f1d2b,_0x586dc5,_0x24cfb0){return new BPromise(function(_0x5e9672,_0x1f2658){return client['request'](_0x2f1d2b,_0x24cfb0)[_0x0fff('0xa')](function(_0x3db6f6){logger['info'](_0x0fff('0xb'),_0x586dc5,_0x0fff('0xc'));logger[_0x0fff('0xd')](_0x0fff('0xe'),_0x586dc5,_0x0fff('0xc'),JSON[_0x0fff('0xf')](_0x3db6f6));if(_0x3db6f6[_0x0fff('0x10')]){if(_0x3db6f6[_0x0fff('0x10')][_0x0fff('0x11')]===0x1f4){logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6['error'][_0x0fff('0x12')]);return _0x1f2658(_0x3db6f6['error'][_0x0fff('0x12')]);}logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6[_0x0fff('0x10')]['message']);return _0x5e9672(_0x3db6f6['error'][_0x0fff('0x12')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x586dc5,'request\x20sent');_0x5e9672(_0x3db6f6[_0x0fff('0x13')][_0x0fff('0x12')]);}})['catch'](function(_0x431b33){logger[_0x0fff('0x10')]('Trigger,\x20%s,\x20%s',_0x586dc5,_0x431b33);_0x1f2658(_0x431b33);});});}exports['GetTrigger']=function(_0x48f36d){var _0x2337f=this;return new Promise(function(_0x606792,_0x46a02d){return db[_0x0fff('0x14')][_0x0fff('0x15')]({'raw':_0x48f36d[_0x0fff('0x16')]?_0x48f36d['options'][_0x0fff('0x17')]===undefined?!![]:![]:!![],'where':_0x48f36d[_0x0fff('0x16')]?_0x48f36d[_0x0fff('0x16')]['where']||null:null,'attributes':_0x48f36d['options']?_0x48f36d[_0x0fff('0x16')][_0x0fff('0x18')]||null:null,'limit':_0x48f36d[_0x0fff('0x16')]?_0x48f36d[_0x0fff('0x16')]['limit']||null:null,'include':_0x48f36d[_0x0fff('0x16')]?_0x48f36d[_0x0fff('0x16')][_0x0fff('0x19')]?_[_0x0fff('0x1a')](_0x48f36d[_0x0fff('0x16')][_0x0fff('0x19')],function(_0x580b8e){return{'model':db[_0x580b8e[_0x0fff('0x1b')]],'as':_0x580b8e['as'],'attributes':_0x580b8e[_0x0fff('0x18')],'include':_0x580b8e[_0x0fff('0x19')]?_[_0x0fff('0x1a')](_0x580b8e[_0x0fff('0x19')],function(_0x23d9f8){return{'model':db[_0x23d9f8['model']],'as':_0x23d9f8['as'],'attributes':_0x23d9f8[_0x0fff('0x18')],'include':_0x23d9f8[_0x0fff('0x19')]?_[_0x0fff('0x1a')](_0x23d9f8[_0x0fff('0x19')],function(_0x36d268){return{'model':db[_0x36d268[_0x0fff('0x1b')]],'as':_0x36d268['as'],'attributes':_0x36d268[_0x0fff('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0fff('0xa')](function(_0x44e54a){logger[_0x0fff('0x1c')](_0x0fff('0x1d'),_0x48f36d);logger[_0x0fff('0xd')]('GetTrigger',_0x48f36d,JSON[_0x0fff('0xf')](_0x44e54a));_0x606792(_0x44e54a);})[_0x0fff('0x1e')](function(_0x17ab6f){logger[_0x0fff('0x10')](_0x0fff('0x1d'),_0x17ab6f[_0x0fff('0x12')],_0x48f36d);_0x46a02d(_0x2337f['error'](0x1f4,_0x17ab6f[_0x0fff('0x12')]));});});};exports[_0x0fff('0x1f')]=function(_0x351102){var _0x48f1d1=this;return new Promise(function(_0x1016fa,_0x3fa6fc){return db['Trigger'][_0x0fff('0x20')]({'raw':_0x351102[_0x0fff('0x16')]?_0x351102[_0x0fff('0x16')][_0x0fff('0x17')]===undefined?!![]:![]:!![],'where':_0x351102[_0x0fff('0x16')]?_0x351102[_0x0fff('0x16')][_0x0fff('0x21')]||null:null,'attributes':_0x351102[_0x0fff('0x16')]?_0x351102[_0x0fff('0x16')][_0x0fff('0x18')]||null:null,'include':_0x351102['options']?_0x351102[_0x0fff('0x16')][_0x0fff('0x19')]?_[_0x0fff('0x1a')](_0x351102[_0x0fff('0x16')][_0x0fff('0x19')],function(_0x5967dc){return{'model':db[_0x5967dc['model']],'as':_0x5967dc['as'],'attributes':_0x5967dc[_0x0fff('0x18')],'include':_0x5967dc[_0x0fff('0x19')]?_[_0x0fff('0x1a')](_0x5967dc[_0x0fff('0x19')],function(_0x5c1797){return{'model':db[_0x5c1797[_0x0fff('0x1b')]],'as':_0x5c1797['as'],'attributes':_0x5c1797[_0x0fff('0x18')],'include':_0x5c1797[_0x0fff('0x19')]?_[_0x0fff('0x1a')](_0x5c1797['include'],function(_0x36a233){return{'model':db[_0x36a233[_0x0fff('0x1b')]],'as':_0x36a233['as'],'attributes':_0x36a233[_0x0fff('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0fff('0xa')](function(_0x191369){logger[_0x0fff('0x1c')](_0x0fff('0x1f'),_0x351102);logger[_0x0fff('0xd')](_0x0fff('0x1f'),_0x351102,JSON[_0x0fff('0xf')](_0x191369));_0x1016fa(_0x191369);})[_0x0fff('0x1e')](function(_0xeea9a7){logger['error'](_0x0fff('0x1f'),_0xeea9a7[_0x0fff('0x12')],_0x351102);_0x3fa6fc(_0x48f1d1[_0x0fff('0x10')](0x1f4,_0xeea9a7[_0x0fff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 07e919c..aa6a360 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 _0x7217=['./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1e9f47,_0x21fe40){var _0x26cfe0=function(_0xe706aa){while(--_0xe706aa){_0x1e9f47['push'](_0x1e9f47['shift']());}};_0x26cfe0(++_0x21fe40);}(_0x7217,0x19e));var _0x7721=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7217[_0x1facfa];return _0x9ec701;};'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('0xc')](_0x7721('0xd'),auth[_0x7721('0x8')](),controller[_0x7721('0xe')]);router[_0x7721('0xc')]('/',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 +var _0x9f62=['create','update','util','connect-timeout','express','Router','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show','post'];(function(_0x16b8a8,_0x235c30){var _0x153450=function(_0x6ece8a){while(--_0x6ece8a){_0x16b8a8['push'](_0x16b8a8['shift']());}};_0x153450(++_0x235c30);}(_0x9f62,0x154));var _0x29f6=function(_0x2a6b9a,_0xfb1cf){_0x2a6b9a=_0x2a6b9a-0x0;var _0x1a954f=_0x9f62[_0x2a6b9a];return _0x1a954f;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29f6('0x4'));var controller=require(_0x29f6('0x5'));router[_0x29f6('0x6')]('/',auth[_0x29f6('0x7')](),controller['index']);router[_0x29f6('0x6')](_0x29f6('0x8'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x9')]);router[_0x29f6('0xa')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router['post']('/',auth[_0x29f6('0x7')](),controller[_0x29f6('0xb')]);router['put']('/:id',auth[_0x29f6('0x7')](),controller[_0x29f6('0xc')]);router['delete'](_0x29f6('0x8'),auth[_0x29f6('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index fa15ab9..5fd1131 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 _0x0a89=['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\x22alaw\x22]','port,invite','insecure','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','rfc2833','nonat','update','yes','force_rport,comedia'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0a89,0x1a8));var _0x90a8=function(_0x540b6c,_0x4e7e4f){_0x540b6c=_0x540b6c-0x0;var _0x596458=_0x0a89[_0x540b6c];return _0x596458;};'use strict';var Sequelize=require(_0x90a8('0x0'));module['exports']={'name':{'type':Sequelize[_0x90a8('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x3'),_0x90a8('0x4'),_0x90a8('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x90a8('0x1')],'allowNull':![],'defaultValue':_0x90a8('0x6')},'callingpres':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x7'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED',_0x90a8('0x8'),_0x90a8('0x9'),'PROHIB_FAILED_SCREEN',_0x90a8('0xa'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x90a8('0x1')]},'secret':{'type':Sequelize[_0x90a8('0x1')]},'md5secret':{'type':Sequelize[_0x90a8('0x1')]},'remotesecret':{'type':Sequelize[_0x90a8('0x1')]},'transport':{'type':Sequelize[_0x90a8('0x1')],'defaultValue':_0x90a8('0xb'),'set':function(_0x4787a2){this[_0x90a8('0xc')](_0x90a8('0xd'),_0x4787a2?_0x4787a2[_0x90a8('0xe')](','):null);},'get':function(){return this[_0x90a8('0xf')]('transport')?this[_0x90a8('0xf')]('transport')[_0x90a8('0x10')](','):null;},'comment':_0x90a8('0x11')},'dtmfmode':{'type':Sequelize[_0x90a8('0x2')]('rfc2833',_0x90a8('0x12'),_0x90a8('0x13'),_0x90a8('0x14'),'auto'),'defaultValue':_0x90a8('0x15')},'directmedia':{'type':Sequelize[_0x90a8('0x2')]('yes','no',_0x90a8('0x16'),_0x90a8('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x90a8('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x90a8('0x1')]},'directmediadeny':{'type':Sequelize[_0x90a8('0x1')]},'nat':{'type':Sequelize[_0x90a8('0x1')],'defaultValue':_0x90a8('0x19'),'set':function(_0x3e46eb){this[_0x90a8('0xc')]('nat',_0x3e46eb?_0x3e46eb[_0x90a8('0xe')](','):null);},'get':function(){return this[_0x90a8('0xf')](_0x90a8('0x1a'))?this[_0x90a8('0xf')](_0x90a8('0x1a'))[_0x90a8('0x10')](','):null;},'comment':_0x90a8('0x1b')},'callgroup':{'type':Sequelize[_0x90a8('0x1')]},'namedcallgroup':{'type':Sequelize[_0x90a8('0x1')]},'pickupgroup':{'type':Sequelize[_0x90a8('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x90a8('0x1')]},'language':{'type':Sequelize[_0x90a8('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x90a8('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x90a8('0x1')],'defaultValue':_0x90a8('0x1c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x90a8('0x1d'),'set':function(_0x2670b5){this[_0x90a8('0xc')]('allow',_0x2670b5?_0x2670b5['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x90a8('0xf')](_0x90a8('0x1e'))?this[_0x90a8('0xf')](_0x90a8('0x1e'))[_0x90a8('0x10')](';'):null;},'comment':_0x90a8('0x1f')},'autoframing':{'type':Sequelize[_0x90a8('0x2')]('yes','no')},'insecure':{'type':Sequelize[_0x90a8('0x1')],'defaultValue':_0x90a8('0x20'),'set':function(_0xabe8f9){this[_0x90a8('0xc')](_0x90a8('0x21'),_0xabe8f9?_0xabe8f9[_0x90a8('0xe')](','):null);},'get':function(){return this[_0x90a8('0xf')]('insecure')?this[_0x90a8('0xf')](_0x90a8('0x21'))[_0x90a8('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x90a8('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x90a8('0x2')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x90a8('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no')},'accountcode':{'type':Sequelize[_0x90a8('0x22')](0xb)},'setvar':{'type':Sequelize[_0x90a8('0x1')]},'callerid':{'type':Sequelize[_0x90a8('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x90a8('0x1')]},'callcounter':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no'),'defaultValue':_0x90a8('0x18')},'busylevel':{'type':Sequelize[_0x90a8('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x90a8('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no',_0x90a8('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x90a8('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0x90a8('0x24'),_0x90a8('0x25'),_0x90a8('0x26'))},'session_expires':{'type':Sequelize[_0x90a8('0x22')](0xb)},'session_minse':{'type':Sequelize[_0x90a8('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x27'),_0x90a8('0x28')),'defaultValue':_0x90a8('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x90a8('0x1')]},'regexten':{'type':Sequelize[_0x90a8('0x1')]},'fromdomain':{'type':Sequelize[_0x90a8('0x1')]},'fromuser':{'type':Sequelize[_0x90a8('0x1')]},'port':{'type':Sequelize[_0x90a8('0x22')](0x5)},'qualify':{'type':Sequelize[_0x90a8('0x2')]('yes','no'),'defaultValue':_0x90a8('0x18')},'keepalive':{'type':Sequelize[_0x90a8('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x90a8('0x1')]},'defaultuser':{'type':Sequelize[_0x90a8('0x1')]},'rtptimeout':{'type':Sequelize[_0x90a8('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x90a8('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x90a8('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no',_0x90a8('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x90a8('0x1')]},'callbackextension':{'type':Sequelize[_0x90a8('0x1')]},'timert1':{'type':Sequelize[_0x90a8('0x22')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x90a8('0x22')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x90a8('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x90a8('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x90a8('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no')},'icesupport':{'type':Sequelize[_0x90a8('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x90a8('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x90a8('0x18'),'no',_0x90a8('0x2a'),_0x90a8('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x90a8('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x90a8('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x90a8('0x1')]},'dtlscipher':{'type':Sequelize[_0x90a8('0x1')]},'dtlscafile':{'type':Sequelize[_0x90a8('0x1')]},'dtlscapath':{'type':Sequelize[_0x90a8('0x1')]},'dtlssetup':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x2c'),_0x90a8('0x2d'),_0x90a8('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x90a8('0x1')]},'usereqphone':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x90a8('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x90a8('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x90a8('0x2')](_0x90a8('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x90a8('0x2')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x90a8('0x1')]},'mohsuggest':{'type':Sequelize[_0x90a8('0x1')]},'parkinglot':{'type':Sequelize[_0x90a8('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x90a8('0x1')],'defaultValue':_0x90a8('0x2f')},'canreinvite':{'type':Sequelize[_0x90a8('0x2')]('yes','no',_0x90a8('0x16'),_0x90a8('0x17'),_0x90a8('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x90a8('0x1')]},'otherFields':{'type':Sequelize[_0x90a8('0x1')]},'active':{'type':Sequelize[_0x90a8('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x90a8('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x5f16=['fingerprint','actpass','dynamic','nonat','update,nonat','name','ENUM','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','STRING','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','update','outgoing','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai'];(function(_0x239247,_0x1eed65){var _0x3ffccd=function(_0x143c05){while(--_0x143c05){_0x239247['push'](_0x239247['shift']());}};_0x3ffccd(++_0x1eed65);}(_0x5f16,0x165));var _0x65f1=function(_0x41cfbc,_0x3a079e){_0x41cfbc=_0x41cfbc-0x0;var _0x526851=_0x5f16[_0x41cfbc];return _0x526851;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x65f1('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x2'),'user','peer'),'allowNull':![],'defaultValue':_0x65f1('0x2')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x65f1('0x3')},'callingpres':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x4'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x65f1('0x5'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x65f1('0x6'),_0x65f1('0x7'))},'deny':{'type':Sequelize[_0x65f1('0x8')]},'permit':{'type':Sequelize[_0x65f1('0x8')]},'secret':{'type':Sequelize[_0x65f1('0x8')]},'md5secret':{'type':Sequelize[_0x65f1('0x8')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x65f1('0x8')],'defaultValue':'udp','set':function(_0xdcb97c){this['setDataValue'](_0x65f1('0x9'),_0xdcb97c?_0xdcb97c[_0x65f1('0xa')](','):null);},'get':function(){return this[_0x65f1('0xb')](_0x65f1('0x9'))?this[_0x65f1('0xb')](_0x65f1('0x9'))[_0x65f1('0xc')](','):null;},'comment':_0x65f1('0xd')},'dtmfmode':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0xe'),'info','shortinfo',_0x65f1('0xf'),_0x65f1('0x10')),'defaultValue':_0x65f1('0xe')},'directmedia':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no','nonat',_0x65f1('0x12'),_0x65f1('0x13')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x65f1('0x8')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x438f98){this[_0x65f1('0x14')](_0x65f1('0x15'),_0x438f98?_0x438f98[_0x65f1('0xa')](','):null);},'get':function(){return this[_0x65f1('0xb')](_0x65f1('0x15'))?this[_0x65f1('0xb')](_0x65f1('0x15'))[_0x65f1('0xc')](','):null;},'comment':_0x65f1('0x16')},'callgroup':{'type':Sequelize[_0x65f1('0x8')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x65f1('0x8')]},'namedpickupgroup':{'type':Sequelize[_0x65f1('0x8')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x65f1('0x8')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x65f1('0x8')],'defaultValue':_0x65f1('0x17')},'allow':{'type':Sequelize[_0x65f1('0x8')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1921d9){this[_0x65f1('0x14')](_0x65f1('0x18'),_0x1921d9?_0x1921d9['join'](';'):_0x65f1('0x19'));},'get':function(){return this[_0x65f1('0xb')](_0x65f1('0x18'))?this[_0x65f1('0xb')]('allow')[_0x65f1('0xc')](';'):null;},'comment':_0x65f1('0x1a')},'autoframing':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no')},'insecure':{'type':Sequelize[_0x65f1('0x8')],'defaultValue':_0x65f1('0x1b'),'set':function(_0x47a4fb){this[_0x65f1('0x14')]('insecure',_0x47a4fb?_0x47a4fb['join'](','):null);},'get':function(){return this[_0x65f1('0xb')]('insecure')?this[_0x65f1('0xb')](_0x65f1('0x1c'))['split'](','):null;},'comment':_0x65f1('0x1d')},'trustrpid':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x65f1('0x1')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no',_0x65f1('0x1e'))},'promiscredir':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no')},'useclientcode':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no')},'accountcode':{'type':Sequelize[_0x65f1('0x1f')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x65f1('0x8')],'defaultValue':_0x65f1('0x20')},'amaflags':{'type':Sequelize[_0x65f1('0x8')]},'callcounter':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no'),'defaultValue':_0x65f1('0x11')},'busylevel':{'type':Sequelize[_0x65f1('0x1f')](0xb)},'allowoverlap':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no')},'allowsubscribe':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no')},'allowtransfer':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no')},'ignoresdpversion':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no')},'subscribecontext':{'type':Sequelize[_0x65f1('0x8')]},'template':{'type':Sequelize[_0x65f1('0x8')]},'videosupport':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no',_0x65f1('0x21')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x65f1('0x1f')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0x65f1('0x8')]},'session_timers':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x22'),_0x65f1('0x23'),_0x65f1('0x24'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x65f1('0x1')]('uac',_0x65f1('0x25')),'defaultValue':_0x65f1('0x25')},'t38pt_usertpsource':{'type':Sequelize[_0x65f1('0x8')]},'regexten':{'type':Sequelize[_0x65f1('0x8')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x65f1('0x8')]},'port':{'type':Sequelize[_0x65f1('0x1f')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x65f1('0x11'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x65f1('0x8')]},'defaultuser':{'type':Sequelize[_0x65f1('0x8')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x65f1('0x1f')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x65f1('0x1f')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x65f1('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x65f1('0x8')]},'callbackextension':{'type':Sequelize[_0x65f1('0x8')]},'timert1':{'type':Sequelize[_0x65f1('0x1f')](0xb)},'timerb':{'type':Sequelize[_0x65f1('0x1f')](0xb)},'qualifyfreq':{'type':Sequelize[_0x65f1('0x1f')](0xb)},'contactpermit':{'type':Sequelize[_0x65f1('0x8')]},'contactdeny':{'type':Sequelize[_0x65f1('0x8')]},'contactacl':{'type':Sequelize[_0x65f1('0x8')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x65f1('0x8')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x65f1('0x11'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x65f1('0x1')]('yes','no')},'force_avp':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no')},'icesupport':{'type':Sequelize[_0x65f1('0x1')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no')},'dtlsverify':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no',_0x65f1('0x27'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x65f1('0x8')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x65f1('0x8')]},'dtlssetup':{'type':Sequelize[_0x65f1('0x1')]('active','passive',_0x65f1('0x28')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x65f1('0x8')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x65f1('0x1')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x65f1('0x8')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x65f1('0x8')]},'parkinglot':{'type':Sequelize[_0x65f1('0x8')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x65f1('0x8')],'defaultValue':_0x65f1('0x29')},'canreinvite':{'type':Sequelize[_0x65f1('0x1')](_0x65f1('0x11'),'no',_0x65f1('0x2a'),_0x65f1('0x12'),_0x65f1('0x2b')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x65f1('0x8')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x65f1('0x8')],'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 b85c6b7..2b1e967 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 _0xb585=['client','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','destroy','get','Trunks','UserProfileResource','stack','name','send','index','Trunk','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','show','params','rawAttributes','fields','find','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise'];(function(_0xcaf54d,_0x327efe){var _0x271a0d=function(_0x40c2f5){while(--_0x40c2f5){_0xcaf54d['push'](_0xcaf54d['shift']());}};_0x271a0d(++_0x327efe);}(_0xb585,0x12b));var _0x5b58=function(_0x5c528f,_0x41fced){_0x5c528f=_0x5c528f-0x0;var _0xc48914=_0xb585[_0x5c528f];return _0xc48914;};'use strict';var pdf=require(_0x5b58('0x0'));var emlformat=require(_0x5b58('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5b58('0x2'));var jsonpatch=require(_0x5b58('0x3'));var rp=require(_0x5b58('0x4'));var moment=require('moment');var BPromise=require(_0x5b58('0x5'));var Mustache=require(_0x5b58('0x6'));var util=require(_0x5b58('0x7'));var path=require(_0x5b58('0x8'));var sox=require(_0x5b58('0x9'));var csv=require(_0x5b58('0xa'));var ejs=require(_0x5b58('0xb'));var fs=require('fs');var _=require(_0x5b58('0xc'));var squel=require(_0x5b58('0xd'));var crypto=require('crypto');var jsforce=require(_0x5b58('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5b58('0xa'));var querystring=require(_0x5b58('0xf'));var Papa=require('papaparse');var Redis=require(_0x5b58('0x10'));var authService=require(_0x5b58('0x11'));var qs=require(_0x5b58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b58('0x13'));var logger=require(_0x5b58('0x14'))(_0x5b58('0x15'));var utils=require(_0x5b58('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5b58('0x17'))['db'];var jayson=require(_0x5b58('0x18'));var client=jayson[_0x5b58('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x288a6b,_0x3c55b9,_0x338dca,_0x46be11){return new BPromise(function(_0x4bae3e,_0x45582f){var _0x1e6679=_0x46be11||client;return _0x1e6679[_0x5b58('0x1a')](_0x288a6b,_0x338dca)[_0x5b58('0x1b')](function(_0x108e4c){logger[_0x5b58('0x1c')]('Trunk,\x20%s,\x20%s',_0x3c55b9,_0x5b58('0x1d'));logger['debug'](_0x5b58('0x1e'),_0x3c55b9,_0x5b58('0x1d'),JSON[_0x5b58('0x1f')](_0x108e4c));if(_0x108e4c[_0x5b58('0x20')]){if(_0x108e4c[_0x5b58('0x20')][_0x5b58('0x21')]===0x1f4){logger[_0x5b58('0x20')]('Trunk,\x20%s,\x20%s',_0x3c55b9,_0x108e4c[_0x5b58('0x20')]['message']);return _0x45582f(_0x108e4c[_0x5b58('0x20')]['message']);}logger[_0x5b58('0x20')]('Trunk,\x20%s,\x20%s',_0x3c55b9,_0x108e4c[_0x5b58('0x20')][_0x5b58('0x22')]);return _0x4bae3e(_0x108e4c[_0x5b58('0x20')][_0x5b58('0x22')]);}else{logger[_0x5b58('0x1c')](_0x5b58('0x23'),_0x3c55b9,_0x5b58('0x1d'));_0x4bae3e(_0x108e4c['result'][_0x5b58('0x22')]);}})[_0x5b58('0x24')](function(_0x170069){logger[_0x5b58('0x20')](_0x5b58('0x23'),_0x3c55b9,_0x170069);_0x45582f(_0x170069);});});}function respondWithStatusCode(_0x4aa3cf,_0x1bea60){_0x1bea60=_0x1bea60||0xcc;return function(_0x1001af){if(_0x1001af){return _0x4aa3cf[_0x5b58('0x25')](_0x1bea60);}return _0x4aa3cf[_0x5b58('0x26')](_0x1bea60)[_0x5b58('0x27')]();};}function respondWithResult(_0x41c1a7,_0x3db1aa){_0x3db1aa=_0x3db1aa||0xc8;return function(_0x24e896){if(_0x24e896){return _0x41c1a7[_0x5b58('0x26')](_0x3db1aa)[_0x5b58('0x28')](_0x24e896);}};}function respondWithFilteredResult(_0x846abd,_0x58341b){return function(_0x484520){if(_0x484520){var _0x1c0e47=_0x484520[_0x5b58('0x29')],_0x11b8a3=_0x58341b[_0x5b58('0x2a')],_0x2c0708=_0x58341b['offset']+_0x58341b['limit'],_0x36b422;if(_0x2c0708>=_0x1c0e47){_0x2c0708=_0x1c0e47;_0x36b422=0xc8;}else{_0x36b422=0xce;}_0x846abd[_0x5b58('0x26')](_0x36b422);return _0x846abd[_0x5b58('0x2b')](_0x5b58('0x2c'),_0x11b8a3+'-'+_0x2c0708+'/'+_0x1c0e47)[_0x5b58('0x28')](_0x484520);}return null;};}function patchUpdates(_0x5b2a51){return function(_0xb669e9){try{jsonpatch['apply'](_0xb669e9,_0x5b2a51,!![]);}catch(_0x18f2ff){return BPromise[_0x5b58('0x2d')](_0x18f2ff);}return _0xb669e9['save']();};}function saveUpdates(_0x457801,_0x48048c){return function(_0x3d9d5){if(_0x3d9d5){return _0x3d9d5['update'](_0x457801)[_0x5b58('0x1b')](function(_0x47eda8){return _0x47eda8;});}return null;};}function removeEntity(_0x3faac7,_0x289b4b){return function(_0x28965e){if(_0x28965e){return _0x28965e[_0x5b58('0x2e')]()['then'](function(){var _0x11fee8=_0x28965e[_0x5b58('0x2f')]({'plain':!![]});var _0x3531d=_0x5b58('0x30');return db[_0x5b58('0x31')][_0x5b58('0x2e')]({'where':{'type':_0x3531d,'resourceId':_0x11fee8['id']}})[_0x5b58('0x1b')](function(){return _0x28965e;});})['then'](function(){_0x3faac7[_0x5b58('0x26')](0xcc)[_0x5b58('0x27')]();});}};}function handleEntityNotFound(_0x25b9cf,_0x2a78a9){return function(_0x46e018){if(!_0x46e018){_0x25b9cf['sendStatus'](0x194);}return _0x46e018;};}function handleError(_0x625a2f,_0x3112ef){_0x3112ef=_0x3112ef||0x1f4;return function(_0x45b9c6){logger[_0x5b58('0x20')](_0x45b9c6[_0x5b58('0x32')]);if(_0x45b9c6[_0x5b58('0x33')]){delete _0x45b9c6[_0x5b58('0x33')];}_0x625a2f['status'](_0x3112ef)[_0x5b58('0x34')](_0x45b9c6);};}exports[_0x5b58('0x35')]=function(_0x1eae20,_0x2c189f){var _0x90be86={},_0xae224a={},_0x19e265={'count':0x0,'rows':[]};var _0x3a3223=_['map'](db[_0x5b58('0x36')]['rawAttributes'],function(_0x1b0b51){return{'name':_0x1b0b51[_0x5b58('0x37')],'type':_0x1b0b51[_0x5b58('0x38')][_0x5b58('0x39')]};});_0xae224a[_0x5b58('0x3a')]=_['map'](_0x3a3223,'name');_0xae224a['query']=_[_0x5b58('0x3b')](_0x1eae20[_0x5b58('0x3c')]);_0xae224a[_0x5b58('0x3d')]=_[_0x5b58('0x3e')](_0xae224a[_0x5b58('0x3a')],_0xae224a[_0x5b58('0x3c')]);_0x90be86[_0x5b58('0x3f')]=_[_0x5b58('0x3e')](_0xae224a['model'],qs['fields'](_0x1eae20[_0x5b58('0x3c')]['fields']));_0x90be86[_0x5b58('0x3f')]=_0x90be86[_0x5b58('0x3f')][_0x5b58('0x40')]?_0x90be86[_0x5b58('0x3f')]:_0xae224a[_0x5b58('0x3a')];if(!_0x1eae20['query'][_0x5b58('0x41')]('nolimit')){_0x90be86[_0x5b58('0x42')]=qs[_0x5b58('0x42')](_0x1eae20[_0x5b58('0x3c')][_0x5b58('0x42')]);_0x90be86[_0x5b58('0x2a')]=qs[_0x5b58('0x2a')](_0x1eae20[_0x5b58('0x3c')][_0x5b58('0x2a')]);}_0x90be86['order']=qs[_0x5b58('0x43')](_0x1eae20[_0x5b58('0x3c')]['sort']);_0x90be86[_0x5b58('0x44')]=qs[_0x5b58('0x3d')](_[_0x5b58('0x45')](_0x1eae20[_0x5b58('0x3c')],_0xae224a[_0x5b58('0x3d')]),_0x3a3223);if(_0x1eae20[_0x5b58('0x3c')][_0x5b58('0x46')]){_0x90be86[_0x5b58('0x44')]=_[_0x5b58('0x47')](_0x90be86['where'],{'$or':_[_0x5b58('0x48')](_0x3a3223,function(_0x24feb4){if(_0x24feb4[_0x5b58('0x38')]!==_0x5b58('0x49')){var _0x2c41b4={};_0x2c41b4[_0x24feb4[_0x5b58('0x33')]]={'$like':'%'+_0x1eae20['query']['filter']+'%'};return _0x2c41b4;}})});}_0x90be86=_[_0x5b58('0x47')]({},_0x90be86,_0x1eae20['options']);var _0x135fdb={'where':_0x90be86[_0x5b58('0x44')]};return db['Trunk'][_0x5b58('0x29')](_0x135fdb)['then'](function(_0x5acbb0){_0x19e265[_0x5b58('0x29')]=_0x5acbb0;if(_0x1eae20['query'][_0x5b58('0x4a')]){_0x90be86[_0x5b58('0x4b')]=[{'all':!![]}];}return db[_0x5b58('0x36')]['findAll'](_0x90be86);})[_0x5b58('0x1b')](function(_0x1d3344){_0x19e265['rows']=_0x1d3344;return _0x19e265;})[_0x5b58('0x1b')](respondWithFilteredResult(_0x2c189f,_0x90be86))[_0x5b58('0x24')](handleError(_0x2c189f,null));};exports[_0x5b58('0x4c')]=function(_0xfa098e,_0x218b49){var _0x1003fc={'raw':![],'where':{'id':_0xfa098e[_0x5b58('0x4d')]['id']}},_0x50aa63={};_0x50aa63[_0x5b58('0x3a')]=_[_0x5b58('0x3b')](db['Trunk'][_0x5b58('0x4e')]);_0x50aa63[_0x5b58('0x3c')]=_[_0x5b58('0x3b')](_0xfa098e['query']);_0x50aa63[_0x5b58('0x3d')]=_[_0x5b58('0x3e')](_0x50aa63[_0x5b58('0x3a')],_0x50aa63[_0x5b58('0x3c')]);_0x1003fc[_0x5b58('0x3f')]=_[_0x5b58('0x3e')](_0x50aa63[_0x5b58('0x3a')],qs[_0x5b58('0x4f')](_0xfa098e[_0x5b58('0x3c')][_0x5b58('0x4f')]));_0x1003fc['attributes']=_0x1003fc['attributes'][_0x5b58('0x40')]?_0x1003fc[_0x5b58('0x3f')]:_0x50aa63[_0x5b58('0x3a')];if(_0xfa098e[_0x5b58('0x3c')]['includeAll']){_0x1003fc[_0x5b58('0x4b')]=[{'all':!![]}];}_0x1003fc=_['merge']({},_0x1003fc,_0xfa098e['options']);return db[_0x5b58('0x36')]['find'](_0x1003fc)[_0x5b58('0x1b')](handleEntityNotFound(_0x218b49,null))['then'](respondWithResult(_0x218b49,null))[_0x5b58('0x24')](handleError(_0x218b49,null));};exports['clone']=function(_0x424dbb,_0x25b8e9){var _0x43b085={'where':{'id':_0x424dbb[_0x5b58('0x4d')]['id']}},_0x1a9b6f={};_0x1a9b6f[_0x5b58('0x3a')]=_['keys'](db[_0x5b58('0x36')][_0x5b58('0x4e')]);_0x43b085['attributes']=_[_0x5b58('0x3e')](_0x1a9b6f['model'],qs['fields'](_0x424dbb[_0x5b58('0x3c')][_0x5b58('0x4f')]));_0x43b085[_0x5b58('0x3f')]=_0x43b085['attributes'][_0x5b58('0x40')]?_0x43b085[_0x5b58('0x3f')]:_0x1a9b6f[_0x5b58('0x3a')];if(_0x424dbb[_0x5b58('0x3c')]['includeAll']){_0x43b085['include']=[{'all':!![]}];}_0x43b085=_[_0x5b58('0x47')]({},_0x43b085,_0x424dbb['options']);return db[_0x5b58('0x36')][_0x5b58('0x50')](_0x43b085)[_0x5b58('0x1b')](handleEntityNotFound(_0x25b8e9,null))[_0x5b58('0x1b')](function(_0x372b54){if(_0x372b54){var _0x4f75f9=_0x372b54[_0x5b58('0x2f')]({'plain':!![]});_0x4f75f9=qs[_0x5b58('0x51')](_0x4f75f9,['id',_0x5b58('0x52'),_0x5b58('0x53')]);_0x424dbb[_0x5b58('0x54')]=_[_0x5b58('0x51')](_0x424dbb['body'],['id','createdAt',_0x5b58('0x53')]);return db[_0x5b58('0x36')][_0x5b58('0x55')](_[_0x5b58('0x47')](_0x4f75f9,_0x424dbb[_0x5b58('0x54')]),{'include':_0x424dbb[_0x5b58('0x3c')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4c7615){var _0x443ced=_0x424dbb[_0x5b58('0x56')][_0x5b58('0x2f')]({'plain':!![]});if(!_0x443ced)throw new Error(_0x5b58('0x57'));if(_0x443ced[_0x5b58('0x58')]===_0x5b58('0x56')){var _0x112a4d=_0x4c7615['get']({'plain':!![]});var _0x30218e=_0x5b58('0x30');return db[_0x5b58('0x59')]['find']({'where':{'name':_0x30218e,'userProfileId':_0x443ced[_0x5b58('0x5a')]},'raw':!![]})[_0x5b58('0x1b')](function(_0x420cd8){if(_0x420cd8&&_0x420cd8[_0x5b58('0x5b')]===0x0){return db[_0x5b58('0x31')]['create']({'name':_0x112a4d[_0x5b58('0x33')],'resourceId':_0x112a4d['id'],'type':_0x420cd8['name'],'sectionId':_0x420cd8['id']},{})[_0x5b58('0x1b')](function(){return _0x4c7615;});}else{return _0x4c7615;}})['catch'](function(_0x4fe422){logger['error'](_0x5b58('0x5c'),_0x4fe422);throw _0x4fe422;});}return _0x4c7615;});}})[_0x5b58('0x1b')](respondWithResult(_0x25b8e9,0xc9))[_0x5b58('0x24')](handleError(_0x25b8e9,null));};exports[_0x5b58('0x55')]=function(_0xa76b93,_0x44ce71,_0x3fba57){var _0x375219;return db[_0x5b58('0x36')]['create'](_0xa76b93[_0x5b58('0x54')],{'raw':!![]})[_0x5b58('0x1b')](function(_0x30f5ed){_0x375219=_0x30f5ed;return db[_0x5b58('0x36')][_0x5b58('0x5d')]({'raw':!![]});})[_0x5b58('0x1b')](function(_0x7d1480){var _0x50d192=fs['readFileSync'](path[_0x5b58('0x5e')](config[_0x5b58('0x5f')],_0x5b58('0x60')),'utf8');var _0x5d26fc=fs[_0x5b58('0x61')](path[_0x5b58('0x5e')](config[_0x5b58('0x5f')],_0x5b58('0x62')),_0x5b58('0x63'));var _0x2c60d4=ejs[_0x5b58('0x64')](_0x50d192,{'trunks':_0x7d1480||[]});fs['writeFileSync'](_0x5b58('0x65'),_0x2c60d4);if(_0x375219[_0x5b58('0x66')]){var _0x268134=ejs['render'](_0x5d26fc,{'trunks':_0x7d1480||[]});fs[_0x5b58('0x67')](_0x5b58('0x68'),_0x268134);}})[_0x5b58('0x1b')](function(){return respondWithRpcPromise(_0x5b58('0x69'),_0x5b58('0x55'),{'module':_0x5b58('0x6a')});})[_0x5b58('0x1b')](function(){var _0x1011dc=_0xa76b93[_0x5b58('0x56')][_0x5b58('0x2f')]({'plain':!![]});if(!_0x1011dc)throw new Error(_0x5b58('0x57'));if(_0x1011dc[_0x5b58('0x58')]===_0x5b58('0x56')){var _0xae4973=_0x375219[_0x5b58('0x2f')]({'plain':!![]});return db[_0x5b58('0x59')]['find']({'where':{'name':_0x5b58('0x30'),'userProfileId':_0x1011dc[_0x5b58('0x5a')]},'raw':!![]})[_0x5b58('0x1b')](function(_0x4915b7){if(_0x4915b7&&_0x4915b7[_0x5b58('0x5b')]===0x0){return db[_0x5b58('0x31')][_0x5b58('0x55')]({'name':_0xae4973['name'],'resourceId':_0xae4973['id'],'type':_0x4915b7[_0x5b58('0x33')],'sectionId':_0x4915b7['id']},{})[_0x5b58('0x1b')](function(){return _0x375219;});}else{return _0x375219;}})[_0x5b58('0x24')](function(_0x252fd3){logger[_0x5b58('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x252fd3);throw _0x252fd3;});}return _0x375219;})['then'](respondWithResult(_0x44ce71,0xc9))[_0x5b58('0x24')](handleError(_0x44ce71,null));};exports['update']=function(_0x53f438,_0x93b5d6,_0x2bb35e){var _0x4e3d3a;return db['Trunk'][_0x5b58('0x50')]({'where':{'id':_0x53f438[_0x5b58('0x4d')]['id']}})['then'](handleEntityNotFound(_0x93b5d6,null))[_0x5b58('0x1b')](saveUpdates(_0x53f438[_0x5b58('0x54')],null))[_0x5b58('0x1b')](function(_0x53d47f){if(_0x53d47f){_0x4e3d3a=_0x53d47f;return db[_0x5b58('0x36')][_0x5b58('0x5d')]({'raw':!![]});}})['then'](function(_0x4f6f66){if(_0x4f6f66){var _0x18469b=fs[_0x5b58('0x61')](path[_0x5b58('0x5e')](config[_0x5b58('0x5f')],_0x5b58('0x60')),_0x5b58('0x63'));var _0x3a7cc1=fs['readFileSync'](path[_0x5b58('0x5e')](config[_0x5b58('0x5f')],_0x5b58('0x62')),_0x5b58('0x63'));var _0x1ad775=ejs[_0x5b58('0x64')](_0x18469b,{'trunks':_0x4f6f66||[]});fs[_0x5b58('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ad775);var _0x52cb69=ejs['render'](_0x3a7cc1,{'trunks':_0x4f6f66||[]});fs[_0x5b58('0x67')](_0x5b58('0x68'),_0x52cb69);return respondWithRpcPromise(_0x5b58('0x69'),_0x5b58('0x6b'),{'module':'chan_sip.so'});}return null;})[_0x5b58('0x1b')](function(_0x4b2fd1){if(_0x4b2fd1){return _0x4e3d3a;}})[_0x5b58('0x1b')](respondWithResult(_0x93b5d6,null))['catch'](handleError(_0x93b5d6,null));};exports[_0x5b58('0x2e')]=function(_0x503e3c,_0x702937,_0xc74594){var _0x5d7f5c;return db[_0x5b58('0x36')][_0x5b58('0x50')]({'where':{'id':_0x503e3c['params']['id']}})[_0x5b58('0x1b')](handleEntityNotFound(_0x702937,null))[_0x5b58('0x1b')](removeEntity(_0x702937,null))[_0x5b58('0x1b')](function(){return db[_0x5b58('0x36')][_0x5b58('0x5d')]({'raw':!![]});})['then'](function(_0x2eb656){var _0x341b0e=fs['readFileSync'](path[_0x5b58('0x5e')](config[_0x5b58('0x5f')],_0x5b58('0x60')),_0x5b58('0x63'));var _0x26949a=fs[_0x5b58('0x61')](path[_0x5b58('0x5e')](config['root'],_0x5b58('0x62')),_0x5b58('0x63'));var _0x218a0c=ejs[_0x5b58('0x64')](_0x341b0e,{'trunks':_0x2eb656});var _0x143805=ejs[_0x5b58('0x64')](_0x26949a,{'trunks':_0x2eb656});fs[_0x5b58('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x218a0c);fs[_0x5b58('0x67')](_0x5b58('0x68'),_0x143805);return respondWithRpcPromise(_0x5b58('0x69'),_0x5b58('0x2e'),{'module':_0x5b58('0x6a')});})[_0x5b58('0x24')](handleError(_0x702937,null));}; \ No newline at end of file +var _0x9844=['Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','UserProfileResource','destroy','then','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','merge','find','get','createdAt','updatedAt','omit','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','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/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info'];(function(_0x583676,_0x5731dc){var _0x2e1415=function(_0x4dce63){while(--_0x4dce63){_0x583676['push'](_0x583676['shift']());}};_0x2e1415(++_0x5731dc);}(_0x9844,0xc4));var _0x4984=function(_0x2a6dee,_0x5e6bae){_0x2a6dee=_0x2a6dee-0x0;var _0x5e7332=_0x9844[_0x2a6dee];return _0x5e7332;};'use strict';var pdf=require(_0x4984('0x0'));var emlformat=require(_0x4984('0x1'));var rimraf=require(_0x4984('0x2'));var zipdir=require(_0x4984('0x3'));var jsonpatch=require(_0x4984('0x4'));var rp=require(_0x4984('0x5'));var moment=require(_0x4984('0x6'));var BPromise=require(_0x4984('0x7'));var Mustache=require(_0x4984('0x8'));var util=require(_0x4984('0x9'));var path=require(_0x4984('0xa'));var sox=require(_0x4984('0xb'));var csv=require(_0x4984('0xc'));var ejs=require(_0x4984('0xd'));var fs=require('fs');var _=require(_0x4984('0xe'));var squel=require(_0x4984('0xf'));var crypto=require(_0x4984('0x10'));var jsforce=require(_0x4984('0x11'));var deskjs=require(_0x4984('0x12'));var toCsv=require(_0x4984('0xc'));var querystring=require('querystring');var Papa=require(_0x4984('0x13'));var Redis=require(_0x4984('0x14'));var authService=require(_0x4984('0x15'));var qs=require(_0x4984('0x16'));var as=require(_0x4984('0x17'));var hardwareService=require(_0x4984('0x18'));var logger=require('../../config/logger')(_0x4984('0x19'));var utils=require(_0x4984('0x1a'));var config=require(_0x4984('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x4984('0x1c'))['db'];var jayson=require(_0x4984('0x1d'));var client=jayson[_0x4984('0x1e')][_0x4984('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5ee1d8,_0x475e7d,_0x2374bc,_0x3e82e1){return new BPromise(function(_0x448bd6,_0x4454ef){var _0x1a78d3=_0x3e82e1||client;return _0x1a78d3[_0x4984('0x20')](_0x5ee1d8,_0x2374bc)['then'](function(_0x2fa8bf){logger[_0x4984('0x21')](_0x4984('0x22'),_0x475e7d,_0x4984('0x23'));logger['debug'](_0x4984('0x24'),_0x475e7d,_0x4984('0x23'),JSON[_0x4984('0x25')](_0x2fa8bf));if(_0x2fa8bf[_0x4984('0x26')]){if(_0x2fa8bf[_0x4984('0x26')][_0x4984('0x27')]===0x1f4){logger['error'](_0x4984('0x22'),_0x475e7d,_0x2fa8bf[_0x4984('0x26')][_0x4984('0x28')]);return _0x4454ef(_0x2fa8bf[_0x4984('0x26')][_0x4984('0x28')]);}logger[_0x4984('0x26')](_0x4984('0x22'),_0x475e7d,_0x2fa8bf['error'][_0x4984('0x28')]);return _0x448bd6(_0x2fa8bf[_0x4984('0x26')][_0x4984('0x28')]);}else{logger[_0x4984('0x21')](_0x4984('0x22'),_0x475e7d,_0x4984('0x23'));_0x448bd6(_0x2fa8bf[_0x4984('0x29')]['message']);}})[_0x4984('0x2a')](function(_0x557aca){logger['error'](_0x4984('0x22'),_0x475e7d,_0x557aca);_0x4454ef(_0x557aca);});});}function respondWithStatusCode(_0x259db4,_0x46464e){_0x46464e=_0x46464e||0xcc;return function(_0x10a7d6){if(_0x10a7d6){return _0x259db4[_0x4984('0x2b')](_0x46464e);}return _0x259db4[_0x4984('0x2c')](_0x46464e)[_0x4984('0x2d')]();};}function respondWithResult(_0x4fb87d,_0x363e17){_0x363e17=_0x363e17||0xc8;return function(_0xa04d0a){if(_0xa04d0a){return _0x4fb87d[_0x4984('0x2c')](_0x363e17)[_0x4984('0x2e')](_0xa04d0a);}};}function respondWithFilteredResult(_0x545c4a,_0x1e0fe8){return function(_0x41c0bc){if(_0x41c0bc){var _0x586557=_0x41c0bc[_0x4984('0x2f')],_0x2b0401=_0x1e0fe8[_0x4984('0x30')],_0x235db0=_0x1e0fe8[_0x4984('0x30')]+_0x1e0fe8['limit'],_0x250918;if(_0x235db0>=_0x586557){_0x235db0=_0x586557;_0x250918=0xc8;}else{_0x250918=0xce;}_0x545c4a[_0x4984('0x2c')](_0x250918);return _0x545c4a[_0x4984('0x31')](_0x4984('0x32'),_0x2b0401+'-'+_0x235db0+'/'+_0x586557)[_0x4984('0x2e')](_0x41c0bc);}return null;};}function patchUpdates(_0x3b133b){return function(_0x4ee0c1){try{jsonpatch[_0x4984('0x33')](_0x4ee0c1,_0x3b133b,!![]);}catch(_0x40cb6c){return BPromise[_0x4984('0x34')](_0x40cb6c);}return _0x4ee0c1[_0x4984('0x35')]();};}function saveUpdates(_0x32e377,_0x5e3bce){return function(_0x2f64fa){if(_0x2f64fa){return _0x2f64fa['update'](_0x32e377)['then'](function(_0x1ef49d){return _0x1ef49d;});}return null;};}function removeEntity(_0x3afe16,_0x25c926){return function(_0x46360f){if(_0x46360f){return _0x46360f['destroy']()['then'](function(){var _0x4f9396=_0x46360f['get']({'plain':!![]});var _0x57501f='Trunks';return db[_0x4984('0x36')][_0x4984('0x37')]({'where':{'type':_0x57501f,'resourceId':_0x4f9396['id']}})[_0x4984('0x38')](function(){return _0x46360f;});})[_0x4984('0x38')](function(){_0x3afe16[_0x4984('0x2c')](0xcc)[_0x4984('0x2d')]();});}};}function handleEntityNotFound(_0x456dd0,_0x5c6664){return function(_0x99550f){if(!_0x99550f){_0x456dd0[_0x4984('0x2b')](0x194);}return _0x99550f;};}function handleError(_0x345888,_0x14298d){_0x14298d=_0x14298d||0x1f4;return function(_0x1e2f78){logger[_0x4984('0x26')](_0x1e2f78['stack']);if(_0x1e2f78[_0x4984('0x39')]){delete _0x1e2f78['name'];}_0x345888[_0x4984('0x2c')](_0x14298d)[_0x4984('0x3a')](_0x1e2f78);};}exports[_0x4984('0x3b')]=function(_0x3a860c,_0x2d51b6){var _0x9068e4={},_0xece776={},_0x2b56e4={'count':0x0,'rows':[]};var _0xfdd449=_['map'](db[_0x4984('0x3c')][_0x4984('0x3d')],function(_0x18ea8d){return{'name':_0x18ea8d[_0x4984('0x3e')],'type':_0x18ea8d[_0x4984('0x3f')][_0x4984('0x40')]};});_0xece776[_0x4984('0x41')]=_[_0x4984('0x42')](_0xfdd449,_0x4984('0x39'));_0xece776[_0x4984('0x43')]=_[_0x4984('0x44')](_0x3a860c[_0x4984('0x43')]);_0xece776[_0x4984('0x45')]=_[_0x4984('0x46')](_0xece776[_0x4984('0x41')],_0xece776[_0x4984('0x43')]);_0x9068e4[_0x4984('0x47')]=_[_0x4984('0x46')](_0xece776[_0x4984('0x41')],qs[_0x4984('0x48')](_0x3a860c[_0x4984('0x43')][_0x4984('0x48')]));_0x9068e4[_0x4984('0x47')]=_0x9068e4[_0x4984('0x47')][_0x4984('0x49')]?_0x9068e4[_0x4984('0x47')]:_0xece776[_0x4984('0x41')];if(!_0x3a860c[_0x4984('0x43')]['hasOwnProperty']('nolimit')){_0x9068e4[_0x4984('0x4a')]=qs[_0x4984('0x4a')](_0x3a860c[_0x4984('0x43')]['limit']);_0x9068e4[_0x4984('0x30')]=qs['offset'](_0x3a860c[_0x4984('0x43')]['offset']);}_0x9068e4[_0x4984('0x4b')]=qs[_0x4984('0x4c')](_0x3a860c[_0x4984('0x43')]['sort']);_0x9068e4[_0x4984('0x4d')]=qs[_0x4984('0x45')](_['pick'](_0x3a860c[_0x4984('0x43')],_0xece776[_0x4984('0x45')]),_0xfdd449);if(_0x3a860c[_0x4984('0x43')][_0x4984('0x4e')]){_0x9068e4['where']=_['merge'](_0x9068e4[_0x4984('0x4d')],{'$or':_[_0x4984('0x42')](_0xfdd449,function(_0x20b8bd){if(_0x20b8bd[_0x4984('0x3f')]!==_0x4984('0x4f')){var _0x5c8957={};_0x5c8957[_0x20b8bd[_0x4984('0x39')]]={'$like':'%'+_0x3a860c[_0x4984('0x43')][_0x4984('0x4e')]+'%'};return _0x5c8957;}})});}_0x9068e4=_['merge']({},_0x9068e4,_0x3a860c[_0x4984('0x50')]);var _0x33f197={'where':_0x9068e4[_0x4984('0x4d')]};return db[_0x4984('0x3c')][_0x4984('0x2f')](_0x33f197)[_0x4984('0x38')](function(_0x29886c){_0x2b56e4['count']=_0x29886c;if(_0x3a860c[_0x4984('0x43')][_0x4984('0x51')]){_0x9068e4[_0x4984('0x52')]=[{'all':!![]}];}return db['Trunk'][_0x4984('0x53')](_0x9068e4);})[_0x4984('0x38')](function(_0x1fe3c3){_0x2b56e4[_0x4984('0x54')]=_0x1fe3c3;return _0x2b56e4;})[_0x4984('0x38')](respondWithFilteredResult(_0x2d51b6,_0x9068e4))[_0x4984('0x2a')](handleError(_0x2d51b6,null));};exports['show']=function(_0x2a9834,_0x8714f0){var _0x545cb9={'raw':![],'where':{'id':_0x2a9834[_0x4984('0x55')]['id']}},_0x46254d={};_0x46254d['model']=_[_0x4984('0x44')](db[_0x4984('0x3c')][_0x4984('0x3d')]);_0x46254d[_0x4984('0x43')]=_[_0x4984('0x44')](_0x2a9834[_0x4984('0x43')]);_0x46254d[_0x4984('0x45')]=_[_0x4984('0x46')](_0x46254d['model'],_0x46254d['query']);_0x545cb9['attributes']=_['intersection'](_0x46254d[_0x4984('0x41')],qs[_0x4984('0x48')](_0x2a9834[_0x4984('0x43')][_0x4984('0x48')]));_0x545cb9[_0x4984('0x47')]=_0x545cb9[_0x4984('0x47')][_0x4984('0x49')]?_0x545cb9['attributes']:_0x46254d[_0x4984('0x41')];if(_0x2a9834[_0x4984('0x43')][_0x4984('0x51')]){_0x545cb9[_0x4984('0x52')]=[{'all':!![]}];}_0x545cb9=_[_0x4984('0x56')]({},_0x545cb9,_0x2a9834[_0x4984('0x50')]);return db[_0x4984('0x3c')][_0x4984('0x57')](_0x545cb9)[_0x4984('0x38')](handleEntityNotFound(_0x8714f0,null))[_0x4984('0x38')](respondWithResult(_0x8714f0,null))['catch'](handleError(_0x8714f0,null));};exports['clone']=function(_0x435ef7,_0x45ffca){var _0x29b8e9={'where':{'id':_0x435ef7['params']['id']}},_0x352a27={};_0x352a27[_0x4984('0x41')]=_[_0x4984('0x44')](db[_0x4984('0x3c')][_0x4984('0x3d')]);_0x29b8e9[_0x4984('0x47')]=_[_0x4984('0x46')](_0x352a27[_0x4984('0x41')],qs[_0x4984('0x48')](_0x435ef7['query']['fields']));_0x29b8e9[_0x4984('0x47')]=_0x29b8e9[_0x4984('0x47')]['length']?_0x29b8e9[_0x4984('0x47')]:_0x352a27['model'];if(_0x435ef7[_0x4984('0x43')]['includeAll']){_0x29b8e9['include']=[{'all':!![]}];}_0x29b8e9=_[_0x4984('0x56')]({},_0x29b8e9,_0x435ef7[_0x4984('0x50')]);return db['Trunk']['find'](_0x29b8e9)[_0x4984('0x38')](handleEntityNotFound(_0x45ffca,null))[_0x4984('0x38')](function(_0xf0606a){if(_0xf0606a){var _0x3d3e66=_0xf0606a[_0x4984('0x58')]({'plain':!![]});_0x3d3e66=qs['omit'](_0x3d3e66,['id',_0x4984('0x59'),_0x4984('0x5a')]);_0x435ef7['body']=_[_0x4984('0x5b')](_0x435ef7[_0x4984('0x5c')],['id',_0x4984('0x59'),_0x4984('0x5a')]);return db['Trunk'][_0x4984('0x5d')](_[_0x4984('0x56')](_0x3d3e66,_0x435ef7[_0x4984('0x5c')]),{'include':_0x435ef7[_0x4984('0x43')][_0x4984('0x51')]?[{'all':!![]}]:undefined})[_0x4984('0x38')](function(_0x58edf2){var _0x134c86=_0x435ef7[_0x4984('0x5e')][_0x4984('0x58')]({'plain':!![]});if(!_0x134c86)throw new Error(_0x4984('0x5f'));if(_0x134c86[_0x4984('0x60')]==='user'){var _0x6d61b8=_0x58edf2[_0x4984('0x58')]({'plain':!![]});var _0xccc307=_0x4984('0x61');return db[_0x4984('0x62')]['find']({'where':{'name':_0xccc307,'userProfileId':_0x134c86[_0x4984('0x63')]},'raw':!![]})[_0x4984('0x38')](function(_0x2d8c6b){if(_0x2d8c6b&&_0x2d8c6b[_0x4984('0x64')]===0x0){return db[_0x4984('0x36')][_0x4984('0x5d')]({'name':_0x6d61b8[_0x4984('0x39')],'resourceId':_0x6d61b8['id'],'type':_0x2d8c6b[_0x4984('0x39')],'sectionId':_0x2d8c6b['id']},{})[_0x4984('0x38')](function(){return _0x58edf2;});}else{return _0x58edf2;}})[_0x4984('0x2a')](function(_0x321bb9){logger[_0x4984('0x26')](_0x4984('0x65'),_0x321bb9);throw _0x321bb9;});}return _0x58edf2;});}})[_0x4984('0x38')](respondWithResult(_0x45ffca,0xc9))[_0x4984('0x2a')](handleError(_0x45ffca,null));};exports[_0x4984('0x5d')]=function(_0x4795d2,_0x9ca5d2,_0x3a841f){var _0x4d4e02;return db[_0x4984('0x3c')][_0x4984('0x5d')](_0x4795d2[_0x4984('0x5c')],{'raw':!![]})[_0x4984('0x38')](function(_0x3fee00){_0x4d4e02=_0x3fee00;return db[_0x4984('0x3c')][_0x4984('0x53')]({'raw':!![]});})[_0x4984('0x38')](function(_0x1b8ad7){var _0x1e0100=fs[_0x4984('0x66')](path[_0x4984('0x67')](config[_0x4984('0x68')],_0x4984('0x69')),_0x4984('0x6a'));var _0x251c0d=fs[_0x4984('0x66')](path['join'](config[_0x4984('0x68')],_0x4984('0x6b')),_0x4984('0x6a'));var _0x20bde5=ejs['render'](_0x1e0100,{'trunks':_0x1b8ad7||[]});fs[_0x4984('0x6c')](_0x4984('0x6d'),_0x20bde5);if(_0x4d4e02[_0x4984('0x6e')]){var _0x1e70ba=ejs[_0x4984('0x6f')](_0x251c0d,{'trunks':_0x1b8ad7||[]});fs[_0x4984('0x6c')](_0x4984('0x70'),_0x1e70ba);}})[_0x4984('0x38')](function(){return respondWithRpcPromise(_0x4984('0x71'),_0x4984('0x5d'),{'module':_0x4984('0x72')});})[_0x4984('0x38')](function(){var _0x424492=_0x4795d2['user'][_0x4984('0x58')]({'plain':!![]});if(!_0x424492)throw new Error(_0x4984('0x5f'));if(_0x424492[_0x4984('0x60')]==='user'){var _0x1d167f=_0x4d4e02['get']({'plain':!![]});return db[_0x4984('0x62')]['find']({'where':{'name':'Trunks','userProfileId':_0x424492[_0x4984('0x63')]},'raw':!![]})[_0x4984('0x38')](function(_0x219293){if(_0x219293&&_0x219293['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1d167f[_0x4984('0x39')],'resourceId':_0x1d167f['id'],'type':_0x219293[_0x4984('0x39')],'sectionId':_0x219293['id']},{})[_0x4984('0x38')](function(){return _0x4d4e02;});}else{return _0x4d4e02;}})[_0x4984('0x2a')](function(_0x9c5a02){logger[_0x4984('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9c5a02);throw _0x9c5a02;});}return _0x4d4e02;})['then'](respondWithResult(_0x9ca5d2,0xc9))[_0x4984('0x2a')](handleError(_0x9ca5d2,null));};exports['update']=function(_0x1c0fcd,_0x551c38,_0x53b80e){var _0x1d9b23;return db[_0x4984('0x3c')]['find']({'where':{'id':_0x1c0fcd[_0x4984('0x55')]['id']}})[_0x4984('0x38')](handleEntityNotFound(_0x551c38,null))[_0x4984('0x38')](saveUpdates(_0x1c0fcd[_0x4984('0x5c')],null))[_0x4984('0x38')](function(_0x24ee70){if(_0x24ee70){_0x1d9b23=_0x24ee70;return db[_0x4984('0x3c')][_0x4984('0x53')]({'raw':!![]});}})[_0x4984('0x38')](function(_0x3bf3ab){if(_0x3bf3ab){var _0xf9f02f=fs['readFileSync'](path[_0x4984('0x67')](config[_0x4984('0x68')],_0x4984('0x69')),_0x4984('0x6a'));var _0x58d393=fs['readFileSync'](path[_0x4984('0x67')](config[_0x4984('0x68')],_0x4984('0x6b')),_0x4984('0x6a'));var _0x3a6909=ejs[_0x4984('0x6f')](_0xf9f02f,{'trunks':_0x3bf3ab||[]});fs[_0x4984('0x6c')](_0x4984('0x6d'),_0x3a6909);var _0x4ad2be=ejs['render'](_0x58d393,{'trunks':_0x3bf3ab||[]});fs[_0x4984('0x6c')](_0x4984('0x70'),_0x4ad2be);return respondWithRpcPromise(_0x4984('0x71'),'update',{'module':_0x4984('0x72')});}return null;})[_0x4984('0x38')](function(_0x55f6cf){if(_0x55f6cf){return _0x1d9b23;}})[_0x4984('0x38')](respondWithResult(_0x551c38,null))['catch'](handleError(_0x551c38,null));};exports['destroy']=function(_0x385011,_0x47316c,_0x86173){var _0x432642;return db['Trunk']['find']({'where':{'id':_0x385011[_0x4984('0x55')]['id']}})[_0x4984('0x38')](handleEntityNotFound(_0x47316c,null))[_0x4984('0x38')](removeEntity(_0x47316c,null))[_0x4984('0x38')](function(){return db[_0x4984('0x3c')][_0x4984('0x53')]({'raw':!![]});})[_0x4984('0x38')](function(_0xcbb177){var _0x5ca1af=fs[_0x4984('0x66')](path['join'](config[_0x4984('0x68')],'server/files/templates/trunk.ejs'),_0x4984('0x6a'));var _0x5b40d3=fs[_0x4984('0x66')](path[_0x4984('0x67')](config['root'],_0x4984('0x6b')),_0x4984('0x6a'));var _0x4cd82a=ejs[_0x4984('0x6f')](_0x5ca1af,{'trunks':_0xcbb177});var _0xe14d0c=ejs[_0x4984('0x6f')](_0x5b40d3,{'trunks':_0xcbb177});fs[_0x4984('0x6c')](_0x4984('0x6d'),_0x4cd82a);fs['writeFileSync'](_0x4984('0x70'),_0xe14d0c);return respondWithRpcPromise(_0x4984('0x71'),_0x4984('0x37'),{'module':_0x4984('0x72')});})[_0x4984('0x2a')](handleError(_0x47316c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index fddee5d..49b20f9 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 _0xb9ad=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','tools_trunks'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xb9ad,0x1a2));var _0xdb9a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb9ad[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xdb9a('0x0'));var util=require(_0xdb9a('0x1'));var logger=require(_0xdb9a('0x2'))(_0xdb9a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb9a('0x4'));var fs=require('fs');var path=require(_0xdb9a('0x5'));var rimraf=require(_0xdb9a('0x6'));var config=require(_0xdb9a('0x7'));var attributes=require(_0xdb9a('0x8'));module[_0xdb9a('0x9')]=function(_0x50fdc8,_0x1c9a60){return _0x50fdc8['define']('Trunk',attributes,{'tableName':_0xdb9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x793a=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','Trunk'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x793a,0xab));var _0xa793=function(_0x3ece31,_0xe7644e){_0x3ece31=_0x3ece31-0x0;var _0x3f6371=_0x793a[_0x3ece31];return _0x3f6371;};'use strict';var _=require('lodash');var util=require(_0xa793('0x0'));var logger=require(_0xa793('0x1'))(_0xa793('0x2'));var moment=require(_0xa793('0x3'));var BPromise=require(_0xa793('0x4'));var rp=require(_0xa793('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa793('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x1106f3,_0x4245b3){return _0x1106f3[_0xa793('0x7')](_0xa793('0x8'),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 655cc2a..094d6d7 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 _0x757a=['stringify','error','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s'];(function(_0x5e876b,_0x593285){var _0x656701=function(_0x1b0bb7){while(--_0x1b0bb7){_0x5e876b['push'](_0x5e876b['shift']());}};_0x656701(++_0x593285);}(_0x757a,0xde));var _0xa757=function(_0x3b9f3a,_0x5ecb73){_0x3b9f3a=_0x3b9f3a-0x0;var _0x257a16=_0x757a[_0x3b9f3a];return _0x257a16;};'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']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trunk,\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']('GetTrunk',_0x4d9f58);logger['debug']('GetTrunk',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrunk',_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 +var _0x757a=['stringify','error','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s'];(function(_0x41fbcf,_0x14c228){var _0x118376=function(_0xee2852){while(--_0xee2852){_0x41fbcf['push'](_0x41fbcf['shift']());}};_0x118376(++_0x14c228);}(_0x757a,0xde));var _0xa757=function(_0xb05db0,_0x219a0a){_0xb05db0=_0xb05db0-0x0;var _0x33aaeb=_0x757a[_0xb05db0];return _0x33aaeb;};'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']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trunk,\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']('GetTrunk',_0x4d9f58);logger['debug']('GetTrunk',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrunk',_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/user/index.js b/server/api/user/index.js index 7f1d697..775ad27 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 _0xf847=['addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addSquareProjects','createApiKey','put','/:id','update','changePassword','delete','destroy','/:id/chat_interactions','removeChatInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/square_projects','removeApiKey','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','show','/:id/avatar','/:id/contacts','getContacts','/:id/queues','getGroups','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','single','login','/:id/logout','logout','pause','unpause','addTeams'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0xf847,0xea));var _0x7f84=function(_0x18af24,_0xd963da){_0x18af24=_0x18af24-0x0;var _0x3f9b02=_0xf847[_0x18af24];return _0x3f9b02;};'use strict';var multer=require(_0x7f84('0x0'));var util=require(_0x7f84('0x1'));var path=require(_0x7f84('0x2'));var timeout=require(_0x7f84('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7f84('0x4'));var interaction=require(_0x7f84('0x5'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x7f84('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7f84('0x6')](_0x7f84('0x7'),auth[_0x7f84('0x8')](),controller['describe']);router[_0x7f84('0x6')]('/whoami',auth[_0x7f84('0x8')](),controller['whoami']);router[_0x7f84('0x6')]('/:id',auth[_0x7f84('0x8')](),controller[_0x7f84('0x9')]);router[_0x7f84('0x6')](_0x7f84('0xa'),controller['getAvatar']);router[_0x7f84('0x6')](_0x7f84('0xb'),auth[_0x7f84('0x8')](),controller[_0x7f84('0xc')]);router[_0x7f84('0x6')](_0x7f84('0xd'),auth[_0x7f84('0x8')](),controller['getQueues']);router[_0x7f84('0x6')]('/:id/queues_rt',auth[_0x7f84('0x8')](),controller['getVoiceQueuesRt']);router[_0x7f84('0x6')]('/:id/groups',auth[_0x7f84('0x8')](),controller[_0x7f84('0xe')]);router[_0x7f84('0x6')]('/:id/recordings',auth[_0x7f84('0x8')](),controller[_0x7f84('0xf')]);router[_0x7f84('0x6')]('/:id/screen_recordings',auth[_0x7f84('0x8')](),controller[_0x7f84('0x10')]);router['get'](_0x7f84('0x11'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x12')]);router[_0x7f84('0x6')](_0x7f84('0x13'),auth['isAuthenticated'](),controller[_0x7f84('0x14')]);router[_0x7f84('0x6')](_0x7f84('0x15'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x16')]);router[_0x7f84('0x6')](_0x7f84('0x17'),auth[_0x7f84('0x8')](),controller['getSmsInteractions']);router[_0x7f84('0x6')](_0x7f84('0x18'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x19')]);router[_0x7f84('0x6')](_0x7f84('0x1a'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x1b')]);router[_0x7f84('0x6')](_0x7f84('0x1c'),auth['isAuthenticated'](),controller[_0x7f84('0x1d')]);router['get']('/:id/lists',auth[_0x7f84('0x8')](),controller[_0x7f84('0x1e')]);router[_0x7f84('0x6')](_0x7f84('0x1f'),auth['isAuthenticated'](),controller[_0x7f84('0x20')]);router[_0x7f84('0x6')](_0x7f84('0x21'),auth[_0x7f84('0x8')](),controller['getVoicePrefixes']);router[_0x7f84('0x6')](_0x7f84('0x22'),auth[_0x7f84('0x8')](),controller['getFaxAccounts']);router[_0x7f84('0x6')](_0x7f84('0x23'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x24')]);router[_0x7f84('0x6')]('/:id/openchannel_accounts',auth[_0x7f84('0x8')](),controller[_0x7f84('0x25')]);router[_0x7f84('0x6')](_0x7f84('0x26'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x27')]);router[_0x7f84('0x6')]('/:id/chat_websites',auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x7f84('0x6')](_0x7f84('0x28'),auth[_0x7f84('0x8')](),controller['getWhatsappAccounts']);router['get']('/:id/square_projects',auth[_0x7f84('0x8')](),controller['getSquareProjects']);router['get'](_0x7f84('0x29'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x2a')]);router[_0x7f84('0x6')](_0x7f84('0x2b'),auth[_0x7f84('0x8')](),controller['getApiKey']);router[_0x7f84('0x2c')](_0x7f84('0xb'),auth['isAuthenticated'](),controller[_0x7f84('0x2d')]);router['post']('/',auth[_0x7f84('0x8')](),controller[_0x7f84('0x2e')]);router['post']('/create_many',auth['isAuthenticated'](),controller[_0x7f84('0x2f')]);router[_0x7f84('0x2c')]('/:id/queues',auth[_0x7f84('0x8')](),controller[_0x7f84('0x30')]);var upload=multer({'storage':multer[_0x7f84('0x31')]({'destination':function(_0x65c670,_0x1dc5e7,_0xe4d5f){_0xe4d5f(null,path[_0x7f84('0x32')](config['root'],_0x7f84('0x33')));},'filename':function(_0xd35204,_0x8c1d43,_0x5b79c7){_0x5b79c7(null,util[_0x7f84('0x34')](_0x7f84('0x35'),Date[_0x7f84('0x36')](),_0x8c1d43[_0x7f84('0x37')]));}})});router['post'](_0x7f84('0xa'),upload[_0x7f84('0x38')]('file'),controller['addAvatar']);router[_0x7f84('0x2c')]('/:id/login',auth[_0x7f84('0x8')](),controller[_0x7f84('0x39')]);router[_0x7f84('0x2c')](_0x7f84('0x3a'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x3b')]);router[_0x7f84('0x2c')]('/:id/pause',auth[_0x7f84('0x8')](),controller[_0x7f84('0x3c')]);router[_0x7f84('0x2c')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x7f84('0x3d')]);router[_0x7f84('0x2c')](_0x7f84('0x1c'),auth['isAuthenticated'](),controller[_0x7f84('0x3e')]);router[_0x7f84('0x2c')]('/:id/chat_interactions',auth[_0x7f84('0x8')](),controller[_0x7f84('0x3f')]);router[_0x7f84('0x2c')](_0x7f84('0x40'),auth['isAuthenticated'](),controller[_0x7f84('0x41')]);router[_0x7f84('0x2c')](_0x7f84('0x42'),auth['isAuthenticated'](),controller[_0x7f84('0x43')]);router[_0x7f84('0x2c')](_0x7f84('0x44'),auth['isAuthenticated'](),controller[_0x7f84('0x45')]);router[_0x7f84('0x2c')](_0x7f84('0x46'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x47')]);router[_0x7f84('0x2c')](_0x7f84('0x48'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x7f84('0x2c')](_0x7f84('0x22'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x49')]);router['post'](_0x7f84('0x23'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x4a')]);router['post'](_0x7f84('0x4b'),auth['isAuthenticated'](),controller[_0x7f84('0x4c')]);router[_0x7f84('0x2c')](_0x7f84('0x26'),auth['isAuthenticated'](),controller[_0x7f84('0x4d')]);router['post'](_0x7f84('0x4e'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x4f')]);router['post'](_0x7f84('0x28'),auth[_0x7f84('0x8')](),controller['addWhatsappAccounts']);router[_0x7f84('0x2c')]('/:id/square_projects',auth[_0x7f84('0x8')](),controller[_0x7f84('0x50')]);router['post'](_0x7f84('0x2b'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x51')]);router[_0x7f84('0x52')](_0x7f84('0x53'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x54')]);router[_0x7f84('0x52')]('/:id/password',auth[_0x7f84('0x8')](),controller[_0x7f84('0x55')]);router[_0x7f84('0x56')](_0x7f84('0xd'),auth[_0x7f84('0x8')](),controller['removeQueues']);router['delete'](_0x7f84('0x1c'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x7f84('0x56')](_0x7f84('0x53'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x57')]);router[_0x7f84('0x56')](_0x7f84('0x58'),auth['isAuthenticated'](),controller[_0x7f84('0x59')]);router[_0x7f84('0x56')]('/:id/mail_interactions',auth[_0x7f84('0x8')](),controller['removeMailInteractions']);router[_0x7f84('0x56')](_0x7f84('0x42'),auth[_0x7f84('0x8')](),controller['removeFaxInteractions']);router[_0x7f84('0x56')](_0x7f84('0x44'),auth[_0x7f84('0x8')](),controller['removeSmsInteractions']);router[_0x7f84('0x56')](_0x7f84('0x46'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x5a')]);router[_0x7f84('0x56')](_0x7f84('0x48'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x7f84('0x56')](_0x7f84('0x22'),auth['isAuthenticated'](),controller[_0x7f84('0x5b')]);router['delete'](_0x7f84('0x23'),auth[_0x7f84('0x8')](),controller['removeMailAccounts']);router[_0x7f84('0x56')](_0x7f84('0x4b'),auth['isAuthenticated'](),controller[_0x7f84('0x5c')]);router[_0x7f84('0x56')]('/:id/sms_accounts',auth[_0x7f84('0x8')](),controller[_0x7f84('0x5d')]);router[_0x7f84('0x56')](_0x7f84('0x4e'),auth['isAuthenticated'](),controller[_0x7f84('0x5e')]);router[_0x7f84('0x56')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x7f84('0x5f')]);router['delete'](_0x7f84('0x60'),auth[_0x7f84('0x8')](),controller['removeSquareProjects']);router[_0x7f84('0x56')](_0x7f84('0x2b'),auth[_0x7f84('0x8')](),controller[_0x7f84('0x61')]);module[_0x7f84('0x62')]=router; \ No newline at end of file +var _0xbe64=['removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','join','root','server/files/images/','format','%s-%s','now','single','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/openchannel_accounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','update','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions'];(function(_0x23d48c,_0x199265){var _0x24cb49=function(_0x4bf8d8){while(--_0x4bf8d8){_0x23d48c['push'](_0x23d48c['shift']());}};_0x24cb49(++_0x199265);}(_0xbe64,0x76));var _0x4be6=function(_0x44454f,_0x4bfbe8){_0x44454f=_0x44454f-0x0;var _0x475150=_0xbe64[_0x44454f];return _0x475150;};'use strict';var multer=require(_0x4be6('0x0'));var util=require(_0x4be6('0x1'));var path=require(_0x4be6('0x2'));var timeout=require(_0x4be6('0x3'));var express=require(_0x4be6('0x4'));var router=express['Router']();var auth=require(_0x4be6('0x5'));var interaction=require(_0x4be6('0x6'));var config=require(_0x4be6('0x7'));var controller=require(_0x4be6('0x8'));router[_0x4be6('0x9')]('/',auth[_0x4be6('0xa')](),controller['index']);router[_0x4be6('0x9')](_0x4be6('0xb'),auth['isAuthenticated'](),controller[_0x4be6('0xc')]);router[_0x4be6('0x9')](_0x4be6('0xd'),auth[_0x4be6('0xa')](),controller['whoami']);router[_0x4be6('0x9')](_0x4be6('0xe'),auth[_0x4be6('0xa')](),controller[_0x4be6('0xf')]);router['get'](_0x4be6('0x10'),controller[_0x4be6('0x11')]);router[_0x4be6('0x9')](_0x4be6('0x12'),auth[_0x4be6('0xa')](),controller['getContacts']);router[_0x4be6('0x9')](_0x4be6('0x13'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x14')]);router['get'](_0x4be6('0x15'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x16')]);router[_0x4be6('0x9')]('/:id/groups',auth['isAuthenticated'](),controller['getGroups']);router[_0x4be6('0x9')](_0x4be6('0x17'),auth[_0x4be6('0xa')](),controller['getRecordings']);router[_0x4be6('0x9')]('/:id/screen_recordings',auth[_0x4be6('0xa')](),controller[_0x4be6('0x18')]);router['get'](_0x4be6('0x19'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x1a')]);router[_0x4be6('0x9')](_0x4be6('0x1b'),auth[_0x4be6('0xa')](),controller['getOpenchannelInteractions']);router[_0x4be6('0x9')](_0x4be6('0x1c'),auth['isAuthenticated'](),controller[_0x4be6('0x1d')]);router[_0x4be6('0x9')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x4be6('0x1e')]);router[_0x4be6('0x9')](_0x4be6('0x1f'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x20')]);router[_0x4be6('0x9')]('/:id/whatsapp/interactions',auth[_0x4be6('0xa')](),controller[_0x4be6('0x21')]);router['get']('/:id/teams',auth[_0x4be6('0xa')](),controller[_0x4be6('0x22')]);router[_0x4be6('0x9')](_0x4be6('0x23'),auth['isAuthenticated'](),controller[_0x4be6('0x24')]);router[_0x4be6('0x9')](_0x4be6('0x25'),auth[_0x4be6('0xa')](),controller['getAgents']);router['get'](_0x4be6('0x26'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x27')]);router[_0x4be6('0x9')](_0x4be6('0x28'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x29')]);router['get'](_0x4be6('0x2a'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x2b')]);router[_0x4be6('0x9')]('/:id/openchannel_accounts',auth[_0x4be6('0xa')](),controller[_0x4be6('0x2c')]);router['get'](_0x4be6('0x2d'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x2e')]);router['get'](_0x4be6('0x2f'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x30')]);router[_0x4be6('0x9')](_0x4be6('0x31'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x32')]);router[_0x4be6('0x9')](_0x4be6('0x33'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x34')]);router[_0x4be6('0x9')](_0x4be6('0x35'),auth[_0x4be6('0xa')](),controller['getScheduledCalls']);router['get'](_0x4be6('0x36'),auth['isAuthenticated'](),controller[_0x4be6('0x37')]);router[_0x4be6('0x38')](_0x4be6('0x12'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x39')]);router[_0x4be6('0x38')]('/',auth[_0x4be6('0xa')](),controller[_0x4be6('0x3a')]);router[_0x4be6('0x38')](_0x4be6('0x3b'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x3c')]);router[_0x4be6('0x38')](_0x4be6('0x13'),auth[_0x4be6('0xa')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ede8a,_0x8208a6,_0x11c38f){_0x11c38f(null,path[_0x4be6('0x3d')](config[_0x4be6('0x3e')],_0x4be6('0x3f')));},'filename':function(_0x41afb9,_0x4afd9b,_0x33080a){_0x33080a(null,util[_0x4be6('0x40')](_0x4be6('0x41'),Date[_0x4be6('0x42')](),_0x4afd9b['originalname']));}})});router[_0x4be6('0x38')](_0x4be6('0x10'),upload[_0x4be6('0x43')](_0x4be6('0x44')),controller[_0x4be6('0x45')]);router[_0x4be6('0x38')](_0x4be6('0x46'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x47')]);router['post']('/:id/logout',auth[_0x4be6('0xa')](),controller[_0x4be6('0x48')]);router['post'](_0x4be6('0x49'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x4a')]);router['post'](_0x4be6('0x4b'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x4c')]);router['post'](_0x4be6('0x4d'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x4e')]);router[_0x4be6('0x38')](_0x4be6('0x4f'),auth[_0x4be6('0xa')](),controller['addChatInteractions']);router[_0x4be6('0x38')](_0x4be6('0x50'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x51')]);router['post']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x4be6('0x52')]);router[_0x4be6('0x38')](_0x4be6('0x53'),auth[_0x4be6('0xa')](),controller['addSmsInteractions']);router[_0x4be6('0x38')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x4be6('0x54')]);router[_0x4be6('0x38')](_0x4be6('0x55'),auth['isAuthenticated'](),controller[_0x4be6('0x56')]);router[_0x4be6('0x38')](_0x4be6('0x28'),auth[_0x4be6('0xa')](),controller['addFaxAccounts']);router[_0x4be6('0x38')](_0x4be6('0x2a'),auth['isAuthenticated'](),controller[_0x4be6('0x57')]);router[_0x4be6('0x38')](_0x4be6('0x58'),auth[_0x4be6('0xa')](),controller['addOpenchannelAccounts']);router[_0x4be6('0x38')](_0x4be6('0x2d'),auth[_0x4be6('0xa')](),controller['addSmsAccounts']);router[_0x4be6('0x38')](_0x4be6('0x2f'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x59')]);router[_0x4be6('0x38')](_0x4be6('0x31'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x5a')]);router['post'](_0x4be6('0x33'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x5b')]);router[_0x4be6('0x38')](_0x4be6('0x36'),auth[_0x4be6('0xa')](),controller['createApiKey']);router[_0x4be6('0x5c')](_0x4be6('0xe'),auth['isAuthenticated'](),controller[_0x4be6('0x5d')]);router[_0x4be6('0x5c')]('/:id/password',auth['isAuthenticated'](),controller['changePassword']);router[_0x4be6('0x5e')](_0x4be6('0x13'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x5f')]);router[_0x4be6('0x5e')]('/:id/teams',auth[_0x4be6('0xa')](),controller['removeTeams']);router['delete']('/:id',auth[_0x4be6('0xa')](),controller[_0x4be6('0x60')]);router[_0x4be6('0x5e')](_0x4be6('0x4f'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x61')]);router['delete'](_0x4be6('0x50'),auth['isAuthenticated'](),controller[_0x4be6('0x62')]);router[_0x4be6('0x5e')](_0x4be6('0x63'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x64')]);router['delete'](_0x4be6('0x53'),auth[_0x4be6('0xa')](),controller['removeSmsInteractions']);router['delete'](_0x4be6('0x65'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x66')]);router['delete']('/:id/whatsapp_interactions',auth[_0x4be6('0xa')](),controller[_0x4be6('0x67')]);router[_0x4be6('0x5e')](_0x4be6('0x28'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x68')]);router[_0x4be6('0x5e')](_0x4be6('0x2a'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x69')]);router[_0x4be6('0x5e')](_0x4be6('0x58'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x6a')]);router[_0x4be6('0x5e')](_0x4be6('0x2d'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x6b')]);router[_0x4be6('0x5e')](_0x4be6('0x2f'),auth[_0x4be6('0xa')](),controller[_0x4be6('0x6c')]);router['delete'](_0x4be6('0x31'),auth[_0x4be6('0xa')](),controller['removeWhatsappAccounts']);router[_0x4be6('0x5e')](_0x4be6('0x33'),auth[_0x4be6('0xa')](),controller['removeSquareProjects']);router[_0x4be6('0x5e')](_0x4be6('0x36'),auth['isAuthenticated'](),controller[_0x4be6('0x6d')]);module[_0x4be6('0x6e')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 3212fef..b0b2005 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 _0x1543=['setDataValue','The\x20name\x20of\x20the\x20user','callerid','getDataValue','internal','email','toLowerCase','ENUM','admin','user','telephone','local','accountcode','format','\x22%s\x22\x20<%s>','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','nonat','yes','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','refuse','originate','uas','fingerprint','active','passive','update','update,nonat','get','wss','udp','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','icesupport','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','map','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','moment','lodash','exports','STRING','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1543,0xfd));var _0x3154=function(_0x34c10b,_0x15d827){_0x34c10b=_0x34c10b-0x0;var _0x49bbac=_0x1543[_0x34c10b];return _0x49bbac;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3154('0x0'));var util=require('util');var _=require(_0x3154('0x1'));module[_0x3154('0x2')]={'name':{'type':Sequelize[_0x3154('0x3')],'allowNull':![],'unique':_0x3154('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3f03ad){this[_0x3154('0x5')](_0x3154('0x4'),_0x3f03ad);this['setDataValue']('defaultuser',_0x3f03ad);},'comment':_0x3154('0x6')},'fullname':{'type':Sequelize[_0x3154('0x3')],'allowNull':![],'set':function(_0x179424){this[_0x3154('0x5')]('fullname',_0x179424);this[_0x3154('0x5')](_0x3154('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x179424,this[_0x3154('0x8')](_0x3154('0x9'))));}},'alias':{'type':Sequelize[_0x3154('0x3')]},'email':{'type':Sequelize[_0x3154('0x3')],'allowNull':![],'unique':_0x3154('0xa'),'validate':{'isEmail':!![]},'set':function(_0x56729){if(_0x56729){this[_0x3154('0x5')](_0x3154('0xa'),_0x56729[_0x3154('0xb')]());}}},'role':{'type':Sequelize[_0x3154('0xc')](_0x3154('0xd'),_0x3154('0xe'),'agent',_0x3154('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x3154('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3154('0x3')],'defaultValue':_0x3154('0x10')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x3154('0x9'),'set':function(_0xa86bdb){this['setDataValue'](_0x3154('0x9'),_0xa86bdb);this[_0x3154('0x5')](_0x3154('0x11'),_0xa86bdb);this[_0x3154('0x5')](_0x3154('0x7'),util[_0x3154('0x12')](_0x3154('0x13'),this[_0x3154('0x8')](_0x3154('0x14')),_0xa86bdb));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x3154('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x3154('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x3154('0x3')]},'city':{'type':Sequelize[_0x3154('0x3')]},'country':{'type':Sequelize[_0x3154('0x3')]},'online':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3154('0x16')]},'voicePause':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x3154('0x3')],'defaultValue':_0x3154('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x3154('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x3154('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x3154('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x3154('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3154('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3154('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3154('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x3154('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3154('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x3154('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x3154('0x1a'),_0x3154('0xe'),_0x3154('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![],'defaultValue':_0x3154('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x3154('0x1d'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x3154('0x1e'),_0x3154('0x1f'),_0x3154('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x33b492){this[_0x3154('0x5')]('transport',_0x33b492?_0x33b492[_0x3154('0x21')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x3154('0x8')](_0x3154('0x22'))['split'](','):null;},'comment':_0x3154('0x23')},'dtmfmode':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x24'),'info','shortinfo',_0x3154('0x25'),_0x3154('0x26')),'allowNull':!![],'defaultValue':_0x3154('0x24')},'directmedia':{'type':Sequelize[_0x3154('0xc')]('yes','no',_0x3154('0x27'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3154('0x29'),'set':function(_0x17b82f){this['setDataValue'](_0x3154('0x2a'),_0x17b82f?_0x17b82f['join'](','):null);},'get':function(){return this['getDataValue'](_0x3154('0x2a'))?this[_0x3154('0x8')](_0x3154('0x2a'))[_0x3154('0x2b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x3154('0x3')]},'pickupgroup':{'type':Sequelize[_0x3154('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x3154('0x3')]},'language':{'type':Sequelize[_0x3154('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3154('0x3')]},'disallow':{'type':Sequelize[_0x3154('0x3')],'allowNull':![],'defaultValue':_0x3154('0x2c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3154('0x2d'),'set':function(_0x3728fd){this[_0x3154('0x5')](_0x3154('0x2e'),_0x3728fd?_0x3728fd[_0x3154('0x21')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue']('allow')?this['getDataValue'](_0x3154('0x2e'))[_0x3154('0x2b')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x1a9bb7){this[_0x3154('0x5')](_0x3154('0x2f'),_0x1a9bb7?_0x1a9bb7[_0x3154('0x21')](','):null);},'get':function(){return this[_0x3154('0x8')]('insecure')?this[_0x3154('0x8')](_0x3154('0x2f'))['split'](','):null;},'comment':_0x3154('0x30')},'trustrpid':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no',_0x3154('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![],'defaultValue':_0x3154('0x32')},'amaflags':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3154('0xc')]('yes','no'),'allowNull':!![],'defaultValue':_0x3154('0x28')},'busylevel':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x3154('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3154('0xc')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x33'),_0x3154('0x34'),_0x3154('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x3154('0x36')),'allowNull':!![],'defaultValue':_0x3154('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![],'defaultValue':_0x3154('0x28')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x3154('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3154('0xc')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x3154('0x28'),'no',_0x3154('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x3154('0x38'),_0x3154('0x39'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3154('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x3154('0x28'),'no',_0x3154('0x27'),_0x3154('0x3a'),_0x3154('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x3154('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x3154('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x3154('0x3')]},'showWebBar':{'type':Sequelize[_0x3154('0x18')],'defaultValue':0x0,'set':function(_0x485b94){this[_0x3154('0x5')]('showWebBar',_0x485b94);var _0x4b130f=this[_0x3154('0x3c')]({'plain':!![]});switch(_0x485b94){case 0x0:case 0x1:var _0x13009a=_0x4b130f[_0x3154('0x22')]?_['isArray'](_0x4b130f[_0x3154('0x22')])?_0x4b130f['transport'][_0x3154('0x21')]():_0x4b130f['transport']:'udp';if(_0x13009a===_0x3154('0x3d')){_0x13009a=_0x3154('0x3e');}this[_0x3154('0x5')](_0x3154('0x22'),_0x13009a);this['setDataValue'](_0x3154('0x3f'),'no');this[_0x3154('0x5')](_0x3154('0x40'),null);this[_0x3154('0x5')](_0x3154('0x41'),null);this[_0x3154('0x5')]('icesupport',null);this[_0x3154('0x5')](_0x3154('0x42'),null);this['setDataValue'](_0x3154('0x43'),null);this[_0x3154('0x5')](_0x3154('0x44'),null);this[_0x3154('0x5')](_0x3154('0x45'),null);this[_0x3154('0x5')](_0x3154('0x46'),null);this[_0x3154('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x3154('0x22'),'wss');this['setDataValue'](_0x3154('0x3f'),_0x3154('0x28'));this[_0x3154('0x5')](_0x3154('0x40'),_0x3154('0x28'));this[_0x3154('0x5')](_0x3154('0x41'),'yes');this[_0x3154('0x5')](_0x3154('0x47'),'yes');this[_0x3154('0x5')](_0x3154('0x42'),_0x3154('0x28'));this[_0x3154('0x5')]('dtlsverify','no');this[_0x3154('0x5')](_0x3154('0x44'),_0x3154('0x48'));this['setDataValue']('dtlscertfile',_0x4b130f['dtlscertfile']||_0x3154('0x49'));this[_0x3154('0x5')](_0x3154('0x46'),_0x4b130f[_0x3154('0x46')]||_0x3154('0x4a'));this[_0x3154('0x5')]('rtcp_mux',_0x3154('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x3154('0x4b')],'set':function(_0x566216){this[_0x3154('0x5')]('permissions',_0x566216?_0x566216[_0x3154('0x21')](','):[]);},'get':function(){return this[_0x3154('0x8')]('permissions')?_[_0x3154('0x4c')](this[_0x3154('0x8')](_0x3154('0x4d'))[_0x3154('0x2b')](','),function(_0x55ae33){return parseInt(_0x55ae33,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3154('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x3154('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x3154('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x3154('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x3154('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3154('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3154('0xc')](_0x3154('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3154('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3154('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3154('0x4e')],'get':function(){return this[_0x3154('0x8')](_0x3154('0x4f'))?this[_0x3154('0x8')](_0x3154('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x3154('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x3154('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x137ad0){if(typeof _0x137ad0===_0x3154('0x50')){var _0x3af808=_0x137ad0==='1'?!![]:_0x137ad0==='0'?![]:_0x137ad0===_0x3154('0x51')?!![]:_0x137ad0===_0x3154('0x52')?![]:![];this[_0x3154('0x5')](_0x3154('0x53'),_0x3af808);}else{this[_0x3154('0x5')](_0x3154('0x53'),_0x137ad0);}}},'blocked':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![],'set':function(_0x59cd52){this[_0x3154('0x5')](_0x3154('0x54'),_0x59cd52);if(_0x59cd52===!![]){this[_0x3154('0x5')]('blockedAt',moment());this[_0x3154('0x5')](_0x3154('0x55'),0x0);}else{this[_0x3154('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3154('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x283e=['lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','accountcode','format','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','ENUM','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','update','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','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','uas','fingerprint','certificate','active','passive','actpass','update,nonat','get','isArray','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlsprivatekey','wss','icesupport','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','blocked','blockedAt','loginAttempts','sequelize','moment','util'];(function(_0x156bad,_0x3a1457){var _0x477486=function(_0x1498df){while(--_0x1498df){_0x156bad['push'](_0x156bad['shift']());}};_0x477486(++_0x3a1457);}(_0x283e,0x111));var _0xe283=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x283e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe283('0x0'));var moment=require(_0xe283('0x1'));var util=require(_0xe283('0x2'));var _=require(_0xe283('0x3'));module[_0xe283('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe283('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xd76c0d){this['setDataValue'](_0xe283('0x5'),_0xd76c0d);this[_0xe283('0x6')](_0xe283('0x7'),_0xd76c0d);},'comment':_0xe283('0x8')},'fullname':{'type':Sequelize[_0xe283('0x9')],'allowNull':![],'set':function(_0x405fe3){this[_0xe283('0x6')]('fullname',_0x405fe3);this[_0xe283('0x6')](_0xe283('0xa'),util['format'](_0xe283('0xb'),_0x405fe3,this[_0xe283('0xc')](_0xe283('0xd'))));}},'alias':{'type':Sequelize[_0xe283('0x9')]},'email':{'type':Sequelize[_0xe283('0x9')],'allowNull':![],'unique':_0xe283('0xe'),'validate':{'isEmail':!![]},'set':function(_0x2c2bdb){if(_0x2c2bdb){this[_0xe283('0x6')](_0xe283('0xe'),_0x2c2bdb[_0xe283('0xf')]());}}},'role':{'type':Sequelize['ENUM'](_0xe283('0x10'),_0xe283('0x11'),_0xe283('0x12'),_0xe283('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe283('0x9')],'defaultValue':_0xe283('0x14')},'internal':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':![],'unique':_0xe283('0xd'),'set':function(_0x2e53da){this[_0xe283('0x6')]('internal',_0x2e53da);this['setDataValue'](_0xe283('0x16'),_0x2e53da);this[_0xe283('0x6')](_0xe283('0xa'),util[_0xe283('0x17')](_0xe283('0xb'),this['getDataValue'](_0xe283('0x18')),_0x2e53da));}},'salt':{'type':Sequelize[_0xe283('0x9')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xe283('0x9')]},'userpic':{'type':Sequelize[_0xe283('0x9')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xe283('0x1a')},'lastPauseAt':{'type':Sequelize[_0xe283('0x1b')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe283('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe283('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xe283('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe283('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe283('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xe283('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe283('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'description':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'host':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![],'defaultValue':_0xe283('0x1c')},'ipaddr':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'port':{'type':Sequelize[_0xe283('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xe283('0x1d')]('friend',_0xe283('0x11'),'peer'),'allowNull':!![],'defaultValue':_0xe283('0x1e')},'context':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x1f'),_0xe283('0x20'),_0xe283('0x21'),_0xe283('0x22'),_0xe283('0x23'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0xe283('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe283('0x25'),'set':function(_0x277c7a){this[_0xe283('0x6')](_0xe283('0x26'),_0x277c7a?_0x277c7a[_0xe283('0x27')](','):null);},'get':function(){return this[_0xe283('0xc')]('transport')?this[_0xe283('0xc')]('transport')[_0xe283('0x28')](','):null;},'comment':_0xe283('0x29')},'dtmfmode':{'type':Sequelize['ENUM'](_0xe283('0x2a'),'info',_0xe283('0x2b'),_0xe283('0x2c'),_0xe283('0x2d')),'allowNull':!![],'defaultValue':_0xe283('0x2a')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0xe283('0x2e'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'nat':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![],'defaultValue':_0xe283('0x30'),'set':function(_0xbd2fd8){this[_0xe283('0x6')]('nat',_0xbd2fd8?_0xbd2fd8[_0xe283('0x27')](','):null);},'get':function(){return this[_0xe283('0xc')](_0xe283('0x31'))?this[_0xe283('0xc')]('nat')[_0xe283('0x28')](','):null;},'comment':_0xe283('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xe283('0x9')]},'pickupgroup':{'type':Sequelize[_0xe283('0x9')]},'namedpickupgroup':{'type':Sequelize[_0xe283('0x9')]},'language':{'type':Sequelize[_0xe283('0x9')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe283('0x9')]},'disallow':{'type':Sequelize[_0xe283('0x9')],'allowNull':![],'defaultValue':_0xe283('0x33')},'allow':{'type':Sequelize[_0xe283('0x9')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1ba35b){this[_0xe283('0x6')](_0xe283('0x34'),_0x1ba35b?_0x1ba35b['join'](';'):_0xe283('0x35'));},'get':function(){return this[_0xe283('0xc')]('allow')?this['getDataValue'](_0xe283('0x34'))[_0xe283('0x28')](';'):null;},'comment':_0xe283('0x36')},'autoframing':{'type':Sequelize[_0xe283('0x1d')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![],'set':function(_0x24d969){this[_0xe283('0x6')](_0xe283('0x37'),_0x24d969?_0x24d969[_0xe283('0x27')](','):null);},'get':function(){return this[_0xe283('0xc')](_0xe283('0x37'))?this[_0xe283('0xc')]('insecure')[_0xe283('0x28')](','):null;},'comment':_0xe283('0x38')},'trustrpid':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xe283('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xe283('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xe283('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![],'defaultValue':_0xe283('0x39')},'amaflags':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![],'defaultValue':_0xe283('0x2f')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xe283('0x1d')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xe283('0x1d')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'template':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no',_0xe283('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xe283('0x1d')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xe283('0x3b'),'refuse',_0xe283('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x3d'),_0xe283('0x3e')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe283('0x1d')]('yes','no'),'allowNull':!![],'defaultValue':_0xe283('0x2f')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xe283('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe283('0x1d')]('yes','no',_0xe283('0x3f'),_0xe283('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe283('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x41'),_0xe283('0x42'),_0xe283('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no','nonat',_0xe283('0x2e'),_0xe283('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe283('0x9')]},'resetPasswordExpires':{'type':Sequelize[_0xe283('0x1b')]},'passwordResetAt':{'type':Sequelize[_0xe283('0x1b')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xe283('0x9')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x5adb32){this[_0xe283('0x6')]('showWebBar',_0x5adb32);var _0x3e6a9c=this[_0xe283('0x45')]({'plain':!![]});switch(_0x5adb32){case 0x0:case 0x1:var _0x5ceac2=_0x3e6a9c[_0xe283('0x26')]?_[_0xe283('0x46')](_0x3e6a9c['transport'])?_0x3e6a9c[_0xe283('0x26')][_0xe283('0x27')]():_0x3e6a9c['transport']:_0xe283('0x25');if(_0x5ceac2==='wss'){_0x5ceac2=_0xe283('0x25');}this[_0xe283('0x6')](_0xe283('0x26'),_0x5ceac2);this[_0xe283('0x6')](_0xe283('0x47'),'no');this[_0xe283('0x6')](_0xe283('0x48'),null);this[_0xe283('0x6')](_0xe283('0x49'),null);this['setDataValue']('icesupport',null);this['setDataValue'](_0xe283('0x4a'),null);this[_0xe283('0x6')](_0xe283('0x4b'),null);this[_0xe283('0x6')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0xe283('0x6')](_0xe283('0x4c'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xe283('0x6')]('transport',_0xe283('0x4d'));this[_0xe283('0x6')](_0xe283('0x47'),_0xe283('0x2f'));this[_0xe283('0x6')]('avpf',_0xe283('0x2f'));this[_0xe283('0x6')](_0xe283('0x49'),'yes');this[_0xe283('0x6')](_0xe283('0x4e'),_0xe283('0x2f'));this[_0xe283('0x6')]('dtlsenable',_0xe283('0x2f'));this[_0xe283('0x6')](_0xe283('0x4b'),'no');this['setDataValue'](_0xe283('0x4f'),_0xe283('0x43'));this[_0xe283('0x6')]('dtlscertfile',_0x3e6a9c['dtlscertfile']||_0xe283('0x50'));this[_0xe283('0x6')](_0xe283('0x4c'),_0x3e6a9c['dtlsprivatekey']||_0xe283('0x51'));this[_0xe283('0x6')](_0xe283('0x52'),_0xe283('0x2f'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x32df43){this['setDataValue'](_0xe283('0x53'),_0x32df43?_0x32df43[_0xe283('0x27')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0xe283('0xc')](_0xe283('0x53'))[_0xe283('0x28')](','),function(_0x3a0aa5){return parseInt(_0x3a0aa5,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe283('0x9')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xe283('0x19')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe283('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe283('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xe283('0x1d')](_0xe283('0x2f'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe283('0x54')],'get':function(){return this[_0xe283('0xc')](_0xe283('0x55'))?this['getDataValue'](_0xe283('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xe283('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x56e152){if(typeof _0x56e152===_0xe283('0x56')){var _0x1f5c80=_0x56e152==='1'?!![]:_0x56e152==='0'?![]:_0x56e152===_0xe283('0x57')?!![]:_0x56e152===_0xe283('0x58')?![]:![];this['setDataValue']('screenrecording',_0x1f5c80);}else{this[_0xe283('0x6')]('screenrecording',_0x56e152);}}},'blocked':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![],'set':function(_0x238a05){this[_0xe283('0x6')](_0xe283('0x59'),_0x238a05);if(_0x238a05===!![]){this[_0xe283('0x6')](_0xe283('0x5a'),moment());this[_0xe283('0x6')](_0xe283('0x5b'),0x0);}else{this[_0xe283('0x6')](_0xe283('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0xe283('0x1b')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xe283('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xe283('0x19')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xe283('0x19')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index d119aed..70c4e8b 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 _0x9a18=['Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','penalty','spread','QueueId','emit','Queue:save','voice','format','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','remove','Queue:remove','addAvatar','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','join','server/files/images/','getContacts','findOne','CmContact','options','CmList','List','Tag','Tags','color','tag','getQueues','Queue','Unknown\x20role','Queues','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','includeAll','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','destroy','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','whatsapppause','lastPauseAt','manual','mail','chat','fax','sms','whatsapp','openchannel','%s%s','Pause','getTeams','Team','addTeams','omit','setDataValue','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','Fax','getOpenchannelQueues','flatten','transaction','getDataValue','removeTeams','getVoiceQueues','getChatQueues','getFaxQueues','removeAgent','Voice','getLists','addChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','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','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./user.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','User,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','set','Content-Range','reject','update','get','role','admin','Users','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','send','index','rawAttributes','fieldName','type','key','model','differenceBy','password','salt','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','sequelize','lower','col','User','count','findAll','rows','catch','show','keys','include','body','params','describe','addContacts','ids','internal','Setting','securePassword','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)','from','voicemail','mailbox','permissions','101','102','103','113','104','105','107','108','109','111','114','create','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','VoiceMail','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','push','all','each','isEmpty','changePassword','oldPassword','newPassword','Sequelize'];(function(_0x595c68,_0x481582){var _0x579a3c=function(_0x5d4dd7){while(--_0x5d4dd7){_0x595c68['push'](_0x595c68['shift']());}};_0x579a3c(++_0x481582);}(_0x9a18,0xe6));var _0x89a1=function(_0x19f1a5,_0x12f130){_0x19f1a5=_0x19f1a5-0x0;var _0x297be6=_0x9a18[_0x19f1a5];return _0x297be6;};'use strict';var pdf=require(_0x89a1('0x0'));var emlformat=require(_0x89a1('0x1'));var rimraf=require(_0x89a1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89a1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x89a1('0x4'));var Mustache=require(_0x89a1('0x5'));var util=require(_0x89a1('0x6'));var path=require(_0x89a1('0x7'));var sox=require(_0x89a1('0x8'));var csv=require(_0x89a1('0x9'));var ejs=require(_0x89a1('0xa'));var fs=require('fs');var _=require(_0x89a1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x89a1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x89a1('0x9'));var querystring=require('querystring');var Papa=require(_0x89a1('0xd'));var Redis=require(_0x89a1('0xe'));var authService=require(_0x89a1('0xf'));var qs=require(_0x89a1('0x10'));var as=require(_0x89a1('0x11'));var hardwareService=require(_0x89a1('0x12'));var logger=require(_0x89a1('0x13'))(_0x89a1('0x14'));var utils=require(_0x89a1('0x15'));var config=require(_0x89a1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x89a1('0x17'))['db'];config[_0x89a1('0x18')]=_[_0x89a1('0x19')](config[_0x89a1('0x18')],{'host':_0x89a1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x89a1('0x18')]));require(_0x89a1('0x1b'))[_0x89a1('0x1c')](socket);var jayson=require(_0x89a1('0x1d'));var client=jayson[_0x89a1('0x1e')][_0x89a1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5c8741,_0xf60db8,_0x2f1e0b,_0x493440){return new BPromise(function(_0x8e4242,_0x3cbf8c){var _0x12a881=_0x493440||client;return _0x12a881[_0x89a1('0x20')](_0x5c8741,_0x2f1e0b)[_0x89a1('0x21')](function(_0x1ed75e){logger[_0x89a1('0x22')]('User,\x20%s,\x20%s',_0xf60db8,_0x89a1('0x23'));logger[_0x89a1('0x24')]('User,\x20%s,\x20%s,\x20%s',_0xf60db8,_0x89a1('0x23'),JSON[_0x89a1('0x25')](_0x1ed75e));if(_0x1ed75e['error']){if(_0x1ed75e[_0x89a1('0x26')][_0x89a1('0x27')]===0x1f4){logger['error'](_0x89a1('0x28'),_0xf60db8,_0x1ed75e[_0x89a1('0x26')][_0x89a1('0x29')]);return _0x3cbf8c(_0x1ed75e[_0x89a1('0x26')][_0x89a1('0x29')]);}logger['error']('User,\x20%s,\x20%s',_0xf60db8,_0x1ed75e['error']['message']);return _0x8e4242(_0x1ed75e[_0x89a1('0x26')][_0x89a1('0x29')]);}else{logger[_0x89a1('0x22')](_0x89a1('0x28'),_0xf60db8,_0x89a1('0x23'));_0x8e4242(_0x1ed75e[_0x89a1('0x2a')][_0x89a1('0x29')]);}})['catch'](function(_0x528e7b){logger[_0x89a1('0x26')](_0x89a1('0x28'),_0xf60db8,_0x528e7b);_0x3cbf8c(_0x528e7b);});});}function respondWithStatusCode(_0x4824a3,_0x539071){_0x539071=_0x539071||0xcc;return function(_0x544db5){if(_0x544db5){return _0x4824a3[_0x89a1('0x2b')](_0x539071);}return _0x4824a3[_0x89a1('0x2c')](_0x539071)['end']();};}function respondWithResult(_0xa408de,_0x5b9a62){_0x5b9a62=_0x5b9a62||0xc8;return function(_0x593293){if(_0x593293){return _0xa408de[_0x89a1('0x2c')](_0x5b9a62)[_0x89a1('0x2d')](_0x593293);}};}function respondWithFilteredResult(_0x2a77de,_0x27e192){return function(_0x8a7034){if(_0x8a7034){var _0x5e92de=_0x8a7034['count'],_0x56589d=_0x27e192[_0x89a1('0x2e')],_0x2ff628=_0x27e192[_0x89a1('0x2e')]+_0x27e192['limit'],_0x5aec5c;if(_0x2ff628>=_0x5e92de){_0x2ff628=_0x5e92de;_0x5aec5c=0xc8;}else{_0x5aec5c=0xce;}_0x2a77de[_0x89a1('0x2c')](_0x5aec5c);return _0x2a77de[_0x89a1('0x2f')](_0x89a1('0x30'),_0x56589d+'-'+_0x2ff628+'/'+_0x5e92de)[_0x89a1('0x2d')](_0x8a7034);}return null;};}function patchUpdates(_0x218edd){return function(_0x4b44eb){try{jsonpatch['apply'](_0x4b44eb,_0x218edd,!![]);}catch(_0x1f7c9d){return BPromise[_0x89a1('0x31')](_0x1f7c9d);}return _0x4b44eb['save']();};}function saveUpdates(_0x2633e9,_0x3ea3dd){return function(_0x823d6a){if(_0x823d6a){return _0x823d6a[_0x89a1('0x32')](_0x2633e9)[_0x89a1('0x21')](function(_0x3a22ed){return _0x3a22ed;});}return null;};}function removeEntity(_0x3ec11d,_0x374444){return function(_0x584fc6){if(_0x584fc6){return _0x584fc6['destroy']()[_0x89a1('0x21')](function(){var _0x24239d=_0x584fc6[_0x89a1('0x33')]({'plain':!![]});if(_0x24239d[_0x89a1('0x34')]===_0x89a1('0x35'))return;var _0xf53e6b=[{'name':_0x89a1('0x36'),'value':_0x89a1('0x37'),'ignore':!![]},{'name':_0x89a1('0x38'),'value':_0x89a1('0x39'),'ignore':![]},{'name':_0x89a1('0x3a'),'value':_0x89a1('0x3b'),'ignore':![]}];var _0x37265d=_(_0xf53e6b)[_0x89a1('0x3c')](_0x89a1('0x3d'))[_0x89a1('0x3e')](_0x89a1('0x3f'))['value']();if(_[_0x89a1('0x40')](_0x37265d,_0x24239d[_0x89a1('0x34')])){return;}var _0x2fe8ca=_[_0x89a1('0x41')](_0xf53e6b,['value',_0x24239d['role']])[_0x89a1('0x42')];return db[_0x89a1('0x43')]['destroy']({'where':{'type':_0x2fe8ca,'resourceId':_0x24239d['id']}})[_0x89a1('0x21')](function(){return _0x584fc6;});})[_0x89a1('0x21')](function(){_0x3ec11d[_0x89a1('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e2fba,_0x489419){return function(_0x1c00ad){if(!_0x1c00ad){_0x4e2fba[_0x89a1('0x2b')](0x194);}return _0x1c00ad;};}function handleError(_0x56c1b1,_0x7b18e){_0x7b18e=_0x7b18e||0x1f4;return function(_0x362da1){logger[_0x89a1('0x26')](_0x362da1['stack']);if(_0x362da1['name']){delete _0x362da1[_0x89a1('0x42')];}_0x56c1b1[_0x89a1('0x2c')](_0x7b18e)[_0x89a1('0x44')](_0x362da1);};}exports[_0x89a1('0x45')]=function(_0x1b35d3,_0x4c04f0){var _0xbbc6e1={},_0x3cd8c0={},_0x445d30={'count':0x0,'rows':[]};var _0x584401=_[_0x89a1('0x3e')](db['User'][_0x89a1('0x46')],function(_0x7d037a){return{'name':_0x7d037a[_0x89a1('0x47')],'type':_0x7d037a[_0x89a1('0x48')][_0x89a1('0x49')]};});_0x3cd8c0[_0x89a1('0x4a')]=_[_0x89a1('0x4b')](_['map'](_0x584401,_0x89a1('0x42')),[_0x89a1('0x4c'),_0x89a1('0x4d')]);_0x3cd8c0[_0x89a1('0x4e')]=_['keys'](_0x1b35d3[_0x89a1('0x4e')]);_0x3cd8c0[_0x89a1('0x4f')]=_['intersection'](_0x3cd8c0['model'],_0x3cd8c0[_0x89a1('0x4e')]);_0xbbc6e1[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x3cd8c0[_0x89a1('0x4a')],qs[_0x89a1('0x52')](_0x1b35d3[_0x89a1('0x4e')][_0x89a1('0x52')]));_0xbbc6e1[_0x89a1('0x50')]=_0xbbc6e1['attributes'][_0x89a1('0x53')]?_0xbbc6e1[_0x89a1('0x50')]:_0x3cd8c0[_0x89a1('0x4a')];if(!_0x1b35d3[_0x89a1('0x4e')][_0x89a1('0x54')](_0x89a1('0x55'))){_0xbbc6e1['limit']=qs['limit'](_0x1b35d3[_0x89a1('0x4e')][_0x89a1('0x56')]);_0xbbc6e1[_0x89a1('0x2e')]=qs[_0x89a1('0x2e')](_0x1b35d3['query']['offset']);}_0xbbc6e1[_0x89a1('0x57')]=qs[_0x89a1('0x58')](_0x1b35d3[_0x89a1('0x4e')][_0x89a1('0x58')]);_0xbbc6e1['where']=qs[_0x89a1('0x4f')](_[_0x89a1('0x59')](_0x1b35d3[_0x89a1('0x4e')],_0x3cd8c0['filters']),_0x584401);if(_0x1b35d3['query'][_0x89a1('0x3c')]){_0xbbc6e1[_0x89a1('0x5a')]=_[_0x89a1('0x5b')](_0xbbc6e1['where'],{'$or':_[_0x89a1('0x3e')](_0x584401,function(_0x1f87bf){if(_0x1f87bf[_0x89a1('0x48')]!==_0x89a1('0x5c')){return db[_0x89a1('0x5d')][_0x89a1('0x5a')](db[_0x89a1('0x5d')]['fn'](_0x89a1('0x5e'),db[_0x89a1('0x5d')][_0x89a1('0x5f')](_0x1f87bf[_0x89a1('0x42')])),{'$like':db['sequelize']['fn']('lower','%'+_0x1b35d3[_0x89a1('0x4e')][_0x89a1('0x3c')]+'%')});}})});}_0xbbc6e1=_[_0x89a1('0x5b')]({},_0xbbc6e1,_0x1b35d3['options']);var _0x291a32={'where':_0xbbc6e1[_0x89a1('0x5a')]};return db[_0x89a1('0x60')]['count'](_0x291a32)[_0x89a1('0x21')](function(_0x3fc80a){_0x445d30[_0x89a1('0x61')]=_0x3fc80a;if(_0x1b35d3[_0x89a1('0x4e')]['includeAll']){_0xbbc6e1['include']=[{'all':!![]}];}return db['User'][_0x89a1('0x62')](_0xbbc6e1);})[_0x89a1('0x21')](function(_0x4f1eb9){_0x445d30[_0x89a1('0x63')]=_0x4f1eb9;return _0x445d30;})['then'](respondWithFilteredResult(_0x4c04f0,_0xbbc6e1))[_0x89a1('0x64')](handleError(_0x4c04f0,null));};exports[_0x89a1('0x65')]=function(_0x50eb60,_0x2f2c08){var _0xf20f49={'raw':![],'where':{'id':_0x50eb60['params']['id']}},_0x7a4e13={};_0x7a4e13[_0x89a1('0x4a')]=_[_0x89a1('0x4b')](_[_0x89a1('0x66')](db[_0x89a1('0x60')]['rawAttributes']),['password',_0x89a1('0x4d')]);_0x7a4e13[_0x89a1('0x4e')]=_[_0x89a1('0x66')](_0x50eb60[_0x89a1('0x4e')]);_0x7a4e13[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x7a4e13['model'],_0x7a4e13[_0x89a1('0x4e')]);_0xf20f49[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x7a4e13['model'],qs[_0x89a1('0x52')](_0x50eb60[_0x89a1('0x4e')][_0x89a1('0x52')]));_0xf20f49['attributes']=_0xf20f49[_0x89a1('0x50')][_0x89a1('0x53')]?_0xf20f49[_0x89a1('0x50')]:_0x7a4e13['model'];if(_0x50eb60['query']['includeAll']){_0xf20f49[_0x89a1('0x67')]=[{'all':!![]}];}_0xf20f49=_[_0x89a1('0x5b')]({},_0xf20f49,_0x50eb60['options']);return db[_0x89a1('0x60')][_0x89a1('0x41')](_0xf20f49)[_0x89a1('0x21')](handleEntityNotFound(_0x2f2c08,null))[_0x89a1('0x21')](respondWithResult(_0x2f2c08,null))[_0x89a1('0x64')](handleError(_0x2f2c08,null));};exports[_0x89a1('0x32')]=function(_0x3dd9b6,_0x489dca){if(_0x3dd9b6[_0x89a1('0x68')]['id']){delete _0x3dd9b6[_0x89a1('0x68')]['id'];}delete _0x3dd9b6[_0x89a1('0x68')][_0x89a1('0x34')];return db[_0x89a1('0x60')][_0x89a1('0x41')]({'where':{'id':_0x3dd9b6[_0x89a1('0x69')]['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0x489dca,null))[_0x89a1('0x21')](saveUpdates(_0x3dd9b6[_0x89a1('0x68')],null))[_0x89a1('0x21')](respondWithResult(_0x489dca,null))['catch'](handleError(_0x489dca,null));};exports['describe']=function(_0x3ed325,_0x2fe47a){return db[_0x89a1('0x60')][_0x89a1('0x6a')]()['then'](respondWithResult(_0x2fe47a,null))[_0x89a1('0x64')](handleError(_0x2fe47a,null));};exports[_0x89a1('0x6b')]=function(_0x4dfa14,_0x534f08,_0x35883d){return db[_0x89a1('0x60')][_0x89a1('0x41')]({'where':{'id':_0x4dfa14[_0x89a1('0x69')]['id']}})['then'](handleEntityNotFound(_0x534f08,null))[_0x89a1('0x21')](function(_0x3aa46f){if(_0x3aa46f){return _0x3aa46f['addContacts'](_0x4dfa14[_0x89a1('0x68')]['ids'],_['omit'](_0x4dfa14[_0x89a1('0x68')],[_0x89a1('0x6c'),'id'])||{});}})[_0x89a1('0x21')](respondWithResult(_0x534f08,null))[_0x89a1('0x64')](handleError(_0x534f08,null));};function validateUser(_0x517e94){return new BPromise(function(_0x3b9aca,_0x3921c7){if(_0x517e94[_0x89a1('0x6d')])return _0x3b9aca(_0x517e94);return db[_0x89a1('0x6e')]['findById'](0x1)[_0x89a1('0x21')](function(_0x5b5fd8){if(_0x5b5fd8[_0x89a1('0x6f')])authService['validatePasswordPattern'](_0x517e94[_0x89a1('0x4c')]);db[_0x89a1('0x60')][_0x89a1('0x70')](_0x89a1('0x6d'))[_0x89a1('0x21')](function(_0x2f5c3a){if(_[_0x89a1('0x71')](_0x2f5c3a)){_0x517e94['internal']=_0x5b5fd8[_0x89a1('0x72')]||0x1;return;}if(_['isNil'](_0x5b5fd8['min_internal'])||_0x5b5fd8[_0x89a1('0x72')]===_0x2f5c3a){_0x517e94[_0x89a1('0x6d')]=_0x2f5c3a+0x1;return;}if(_0x5b5fd8[_0x89a1('0x72')]>_0x2f5c3a){_0x517e94[_0x89a1('0x6d')]=_0x5b5fd8[_0x89a1('0x72')];return;}return db[_0x89a1('0x5d')]['query'](_0x89a1('0x73'),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x89a1('0x21')](function(_0x4cb802){if(_0x4cb802&&_0x4cb802[_0x89a1('0x53')]){for(var _0x4debe7=0x0,_0x246f94=_0x4cb802['length'];_0x4debe7<_0x246f94&&_[_0x89a1('0x71')](_0x517e94[_0x89a1('0x6d')]);_0x4debe7++){if(_0x5b5fd8[_0x89a1('0x72')]<=_0x4cb802[_0x4debe7]['from']){_0x517e94['internal']=_0x4cb802[_0x4debe7][_0x89a1('0x74')];}else if(_0x5b5fd8['min_internal']>_0x4cb802[_0x4debe7]['from']&&_0x5b5fd8['min_internal']<=_0x4cb802[_0x4debe7]['to']){_0x517e94['internal']=_0x5b5fd8['min_internal'];}}}if(_[_0x89a1('0x71')](_0x517e94[_0x89a1('0x6d')])){_0x517e94['internal']=_0x2f5c3a+0x1;}return _0x3b9aca(_0x517e94);});});})[_0x89a1('0x64')](function(_0x5ae59d){_0x3921c7(_0x5ae59d);});});}function updateUser(_0x43c06e){return new BPromise(function(_0x5285a4,_0x479a5e){try{if(_0x43c06e[_0x89a1('0x75')]){_0x43c06e[_0x89a1('0x76')]=_0x43c06e[_0x89a1('0x6d')];_0x43c06e['VoiceMail']={'mailbox':_0x43c06e['internal'],'password':_0x43c06e[_0x89a1('0x4c')],'fullname':_0x43c06e['fullname'],'email':_0x43c06e['email']};}if(_0x43c06e[_0x89a1('0x34')]===_0x89a1('0x39')){if(!_0x43c06e[_0x89a1('0x77')])_0x43c06e['permissions']=[_0x89a1('0x78'),_0x89a1('0x79'),_0x89a1('0x7a'),_0x89a1('0x7b'),'110',_0x89a1('0x7c'),_0x89a1('0x7d'),'106',_0x89a1('0x7e'),_0x89a1('0x7f'),_0x89a1('0x80'),'100',_0x89a1('0x81'),_0x89a1('0x82')];}_0x5285a4(_0x43c06e);}catch(_0x4e63f6){_0x479a5e(_0x4e63f6);}});}exports[_0x89a1('0x83')]=function(_0x2f0a3a,_0x2be52d){if(_0x2f0a3a['user'][_0x89a1('0x34')]===_0x89a1('0x39'))throw new Error('Unauthorized');if(_0x2f0a3a[_0x89a1('0x68')]['role']===_0x89a1('0x37')&&_0x2f0a3a[_0x89a1('0x37')]['role']!==_0x89a1('0x35')){throw new Error(_0x89a1('0x84'));}if(_0x2f0a3a['body'][_0x89a1('0x34')]===_0x89a1('0x35')&&_0x2f0a3a['user'][_0x89a1('0x34')]!==_0x89a1('0x35')){throw new Error(_0x89a1('0x85'));}return licenseUtil[_0x89a1('0x86')]([_0x2f0a3a[_0x89a1('0x68')]])['then'](function(){return validateUser(_0x2f0a3a[_0x89a1('0x68')]);})['then'](function(_0x5c89fe){return updateUser(_0x5c89fe)['then'](function(_0x3963c4){if(_0x3963c4[_0x89a1('0x34')]===_0x89a1('0x35')){_0x3963c4[_0x89a1('0x87')]=_0x2f0a3a['user'][_0x89a1('0x87')];delete _0x3963c4[_0x89a1('0x88')];}return _0x3963c4;});})[_0x89a1('0x21')](function(_0x3138c2){return db[_0x89a1('0x60')][_0x89a1('0x83')](_0x3138c2,{'include':[{'model':db[_0x89a1('0x89')],'as':_0x89a1('0x89')}]});})[_0x89a1('0x21')](function(_0x408cbd){if(_0x2f0a3a[_0x89a1('0x68')][_0x89a1('0x34')]===_0x89a1('0x37'))return _0x408cbd;if(_0x2f0a3a[_0x89a1('0x37')][_0x89a1('0x34')]!==_0x89a1('0x37'))return _0x408cbd;return db[_0x89a1('0x8a')][_0x89a1('0x41')]({'where':{'name':_0x408cbd[_0x89a1('0x34')]===_0x89a1('0x39')?'Agents':_0x89a1('0x3a'),'userProfileId':_0x2f0a3a['user'][_0x89a1('0x88')]},'raw':!![]})[_0x89a1('0x21')](function(_0xe993c0){if(!_0xe993c0||_0xe993c0[_0x89a1('0x8b')]!=0x0)return _0x408cbd;return db[_0x89a1('0x43')]['create']({'name':_0x408cbd[_0x89a1('0x42')],'resourceId':_0x408cbd['id'],'type':_0xe993c0[_0x89a1('0x42')],'sectionId':_0xe993c0['id']},{})[_0x89a1('0x21')](function(){return _0x408cbd;});})[_0x89a1('0x64')](function(_0x39da42){logger[_0x89a1('0x26')](_0x89a1('0x8c'),_0x39da42);throw _0x39da42;});})['then'](respondWithResult(_0x2be52d,0xc9))[_0x89a1('0x64')](handleError(_0x2be52d,null));};exports[_0x89a1('0x8d')]=function(_0xa1f947,_0x5909b8){var _0x3b1a17=_0xa1f947['body'];var _0x548141=[];if(_0xa1f947[_0x89a1('0x37')]['role']===_0x89a1('0x39'))throw new Error('Unauthorized');if(_[_0x89a1('0x8e')](_0x3b1a17,[_0x89a1('0x34'),_0x89a1('0x37')])&&_0xa1f947[_0x89a1('0x37')][_0x89a1('0x34')]!==_0x89a1('0x35')){throw new Error(_0x89a1('0x84'));}if(_['some'](_0x3b1a17,[_0x89a1('0x34'),_0x89a1('0x35')])&&_0xa1f947[_0x89a1('0x37')]['role']!==_0x89a1('0x35')){throw new Error(_0x89a1('0x8f'));}return licenseUtil[_0x89a1('0x86')](_0x3b1a17)[_0x89a1('0x21')](function(){return validateUser(_0x3b1a17[0x0]);})[_0x89a1('0x21')](function(){for(var _0x41bb06=0x1;_0x41bb06<_0x3b1a17[_0x89a1('0x53')];_0x41bb06++){var _0xa475d2=_0x3b1a17[_0x41bb06-0x1][_0x89a1('0x6d')];if(!_0x3b1a17[_0x41bb06][_0x89a1('0x6d')])_0x3b1a17[_0x41bb06]['internal']=_0xa475d2+0x1;_0x548141[_0x89a1('0x90')](validateUser(_0x3b1a17[_0x41bb06]));}return BPromise[_0x89a1('0x91')](_0x548141);})[_0x89a1('0x21')](function(){_0x548141=[];for(var _0x3b5e55=0x0;_0x3b5e55<_0x3b1a17['length'];_0x3b5e55++){_0x548141[_0x89a1('0x90')](updateUser(_0x3b1a17[_0x3b5e55]));}return BPromise['all'](_0x548141);})['then'](function(){return BPromise[_0x89a1('0x92')](_0x3b1a17,function(_0x5b4494){return db[_0x89a1('0x60')][_0x89a1('0x83')](_0x5b4494,{'include':[{'model':db[_0x89a1('0x89')],'as':_0x89a1('0x89')}]})[_0x89a1('0x21')](function(_0x2d5811){_0x5b4494['id']=_0x2d5811['id'];return _0x5b4494;});});})[_0x89a1('0x21')](function(_0x1a7456){if(_0xa1f947[_0x89a1('0x68')][_0x89a1('0x34')]==='user')return _0x1a7456;if(_0xa1f947[_0x89a1('0x37')]['role']!==_0x89a1('0x37'))return _0x1a7456;var _0x32b40a=_['some'](_0x1a7456,function(_0x4a2176){return _0x4a2176[_0x89a1('0x34')]==='agent'||_0x4a2176[_0x89a1('0x34')]===_0x89a1('0x3b');});if(!_0x32b40a)return _0x1a7456;return db[_0x89a1('0x8a')][_0x89a1('0x62')]({'where':{'name':{'$or':['Agents',_0x89a1('0x3a')]},'userProfileId':_0xa1f947[_0x89a1('0x37')][_0x89a1('0x88')]},'raw':!![]})[_0x89a1('0x21')](function(_0x3e6b77){if(_[_0x89a1('0x93')](_0x3e6b77)||!_[_0x89a1('0x8e')](_0x3e6b77,[_0x89a1('0x8b'),0x0]))return _0x1a7456;_0x548141=[];var _0xf0368f=_(_0x3e6b77)[_0x89a1('0x3e')](function(_0x235d0a){if(_0x235d0a['autoAssociation']===0x1)return;return _0x235d0a[_0x89a1('0x42')]===_0x89a1('0x38')?_0x89a1('0x39'):_0x89a1('0x3b');})['compact']()[_0x89a1('0x3f')]();for(var _0x6004ad=0x0;_0x6004ad<_0x1a7456[_0x89a1('0x53')];_0x6004ad++){if(!_[_0x89a1('0x40')](_0xf0368f,_0x1a7456[_0x6004ad][_0x89a1('0x34')]))return;var _0x151663=_0x1a7456[_0x6004ad][_0x89a1('0x34')]===_0x89a1('0x39')?_0x89a1('0x38'):'Telephones';_0x548141[_0x89a1('0x90')](db[_0x89a1('0x43')][_0x89a1('0x83')]({'name':_0x1a7456[_0x6004ad][_0x89a1('0x42')],'resourceId':_0x1a7456[_0x6004ad]['id'],'type':_0x151663,'sectionId':_[_0x89a1('0x41')](_0x3e6b77,[_0x89a1('0x42'),_0x151663])['id']},{}));}return BPromise['all'](_0x548141);})[_0x89a1('0x21')](respondWithResult(_0x5909b8,0xc9))[_0x89a1('0x64')](handleError(_0x5909b8,null));});};exports[_0x89a1('0x94')]=function(_0xd4a605,_0x1e55a7,_0x4cebd9){if(_0xd4a605[_0x89a1('0x68')]['id']){delete _0xd4a605[_0x89a1('0x68')]['id'];}return db['User'][_0x89a1('0x41')]({'where':{'id':_0xd4a605['params']['id']}})[_0x89a1('0x21')](function(_0x5def31){if(!_0x5def31)return null;if(_0x5def31['id']===_0xd4a605[_0x89a1('0x37')]['id']){if(!_0xd4a605[_0x89a1('0x68')][_0x89a1('0x95')]||!_0xd4a605[_0x89a1('0x68')][_0x89a1('0x96')]){throw new db[(_0x89a1('0x97'))]['ValidationError'](_0x89a1('0x98'));}if(!_0x5def31['authenticate'](_0xd4a605['body'][_0x89a1('0x95')])){throw new db[(_0x89a1('0x97'))]['ValidationError'](_0x89a1('0x99'));}if(_0xd4a605[_0x89a1('0x68')]['oldPassword']===_0xd4a605[_0x89a1('0x68')]['newPassword']){throw new db['Sequelize'][(_0x89a1('0x9a'))](_0x89a1('0x9b'));}}else if(_0xd4a605[_0x89a1('0x37')][_0x89a1('0x34')]===_0x89a1('0x35')){if(!_0xd4a605[_0x89a1('0x68')][_0x89a1('0x96')]){throw new db[(_0x89a1('0x97'))][(_0x89a1('0x9a'))](_0x89a1('0x9c'));}}else if(_0xd4a605[_0x89a1('0x37')][_0x89a1('0x34')]==='user'){if(!_0xd4a605[_0x89a1('0x68')][_0x89a1('0x96')]){throw new db['Sequelize'][(_0x89a1('0x9a'))](_0x89a1('0x9c'));}if(_0x5def31['role']!==_0x89a1('0x39')){throw new db[(_0x89a1('0x97'))][(_0x89a1('0x9a'))](_0x89a1('0x9d'));}}else{throw new db[(_0x89a1('0x97'))][(_0x89a1('0x9a'))](_0x89a1('0x9d'));}return _0x5def31;})[_0x89a1('0x21')](handleEntityNotFound(_0x1e55a7,null))['then'](function(_0x201e01){return db[_0x89a1('0x6e')]['findOne']({'attributes':['id',_0x89a1('0x6f'),_0x89a1('0x9e'),_0x89a1('0x9f')]})[_0x89a1('0x21')](function(_0x55156f){if(_0x55156f[_0x89a1('0x6f')])authService[_0x89a1('0xa0')](_0xd4a605[_0x89a1('0x68')][_0x89a1('0x96')]);if(!_0x55156f['enforcePasswordHistory']||!_0x201e01[_0x89a1('0xa1')])return _0x201e01;authService['validatePasswordHistory'](_0xd4a605[_0x89a1('0x68')][_0x89a1('0x96')],_0x201e01['previousPasswords'],_0x55156f['passwordHistoryLimit']);return _0x201e01;})[_0x89a1('0x21')](saveUpdates({'password':_0xd4a605[_0x89a1('0x68')]['newPassword'],'passwordResetAt':_0xd4a605['user']['id']==_0xd4a605[_0x89a1('0x69')]['id']?moment():null,'previousPasswords':authService[_0x89a1('0xa2')](_0xd4a605[_0x89a1('0x68')][_0x89a1('0x96')],_0x201e01[_0x89a1('0xa1')])},null));})[_0x89a1('0x21')](respondWithResult(_0x1e55a7,null))[_0x89a1('0x64')](handleError(_0x1e55a7,null));};exports[_0x89a1('0xa3')]=function(_0x17f17a,_0x8da2ac,_0x4cfa6c){var _0x220ba1=_0x17f17a[_0x89a1('0x68')][_0x89a1('0xa4')];return db[_0x89a1('0x60')][_0x89a1('0x41')]({'where':{'id':_0x17f17a[_0x89a1('0x69')]['id']},'attributes':['id',_0x89a1('0x42'),_0x89a1('0x34'),_0x89a1('0xa5'),_0x89a1('0xa6'),_0x89a1('0xa7'),_0x89a1('0xa8')]})['then'](handleEntityNotFound(_0x8da2ac,null))[_0x89a1('0x21')](function(_0x3226a6){if(_0x3226a6){if(!utils[_0x89a1('0xa9')](_0x220ba1)){throw new db[(_0x89a1('0x97'))][(_0x89a1('0x9a'))]('Unknown\x20channel');}return _0x3226a6[_0x89a1('0xaa')+_[_0x89a1('0xab')](_0x220ba1[_0x89a1('0xac')]())+'Queues'](_0x17f17a[_0x89a1('0x68')][_0x89a1('0x6c')],{'penalty':_0x17f17a[_0x89a1('0x68')][_0x89a1('0xad')]||0x0})[_0x89a1('0xae')](function(_0x3d2fe9){for(var _0x63c18d=0x0;_0x63c18d<_0x17f17a[_0x89a1('0x68')]['ids'][_0x89a1('0x53')];_0x63c18d+=0x1){var _0x3a26a4={'UserId':_0x17f17a[_0x89a1('0x69')]['id']};_0x3a26a4[_['capitalize'](_0x220ba1[_0x89a1('0xac')]())+_0x89a1('0xaf')]=_0x17f17a[_0x89a1('0x68')][_0x89a1('0x6c')][_0x63c18d];socket[_0x89a1('0xb0')](_0x89a1('0x37')+_[_0x89a1('0xab')](_0x220ba1['toLowerCase']())+_0x89a1('0xb1'),_0x3a26a4);}return _0x3d2fe9;})[_0x89a1('0x21')](function(){if(_0x220ba1==='voice'){return db['VoiceQueue'][_0x89a1('0x62')]({'where':{'id':_0x17f17a[_0x89a1('0x68')][_0x89a1('0x6c')]||[]},'raw':!![],'attributes':['id',_0x89a1('0x42')]});}})[_0x89a1('0x21')](function(_0xa74991){var _0x3bdd28=_0x3226a6[_0x89a1('0x33')]({'plain':!![]});var _0x909da=[];if(_0x220ba1===_0x89a1('0xb2')&&_0x3bdd28[_0x89a1('0x34')]===_0x89a1('0x39')&&_0x3bdd28['online']){for(var _0x143bbd=0x0;_0x143bbd<_0xa74991['length'];_0x143bbd+=0x1){_0x909da[_0x89a1('0x90')]({'membername':_0x3bdd28['name'],'UserId':_0x3bdd28['id'],'queue_name':_0xa74991[_0x143bbd][_0x89a1('0x42')],'VoiceQueueId':_0xa74991[_0x143bbd]['id'],'interface':_[_0x89a1('0x71')](_0x3bdd28[_0x89a1('0xa8')])?util[_0x89a1('0xb3')]('SIP/%s',_0x3bdd28['name']):_0x3bdd28['interface'],'paused':_0x3bdd28['voicePause']||![],'penalty':_0x17f17a['body'][_0x89a1('0xad')]||0x0});}return BPromise[_0x89a1('0x92')](_0x909da,function(_0x2ecb34){return db[_0x89a1('0xb4')][_0x89a1('0xb5')](_0x2ecb34);});}return _0x3226a6;});}})[_0x89a1('0x21')](respondWithStatusCode(_0x8da2ac,null))[_0x89a1('0x64')](handleError(_0x8da2ac,null));};exports[_0x89a1('0xb6')]=function(_0x262f03,_0x4d098f,_0x2b3f33){var _0x54a6ba;return db[_0x89a1('0x60')]['find']({'where':{'id':_0x262f03[_0x89a1('0x69')]['id']},'attributes':['id',_0x89a1('0x42'),'role']})[_0x89a1('0x21')](handleEntityNotFound(_0x4d098f,null))['then'](function(_0x373973){if(_0x373973){_0x54a6ba=_0x373973;if(!_0x262f03['query']['channel']||!utils[_0x89a1('0xa9')](_0x262f03['query'][_0x89a1('0xa4')])){throw new db['Sequelize'][(_0x89a1('0x9a'))](_0x89a1('0xb7'));}return _0x373973[_0x89a1('0xb8')+_['capitalize'](_0x262f03[_0x89a1('0x4e')][_0x89a1('0xa4')][_0x89a1('0xac')]())+'Queues'](_0x262f03['query'][_0x89a1('0x6c')]);}})[_0x89a1('0x21')](function(_0x3c27de){for(var _0x8dfa1f=0x0;_0x8dfa1f<_0x262f03['query'][_0x89a1('0x6c')]['length'];_0x8dfa1f+=0x1){var _0x20072d={'UserId':_0x262f03[_0x89a1('0x69')]['id']};_0x20072d[_['capitalize'](_0x262f03[_0x89a1('0x4e')][_0x89a1('0xa4')]['toLowerCase']())+_0x89a1('0xaf')]=_0x262f03[_0x89a1('0x4e')]['ids'][_0x8dfa1f];socket[_0x89a1('0xb0')](_0x89a1('0x37')+_[_0x89a1('0xab')](_0x262f03[_0x89a1('0x4e')][_0x89a1('0xa4')][_0x89a1('0xac')]())+_0x89a1('0xb9'),_0x20072d);}return _0x3c27de;})[_0x89a1('0x21')](function(){if(_0x262f03[_0x89a1('0x4e')]['channel']===_0x89a1('0xb2')){return db[_0x89a1('0xb4')]['destroy']({'where':{'UserId':_0x262f03['params']['id'],'VoiceQueueId':_0x262f03['query'][_0x89a1('0x6c')]},'individualHooks':!![]})[_0x89a1('0x21')](function(){return _0x54a6ba;});}return _0x54a6ba;})[_0x89a1('0x21')](respondWithStatusCode(_0x4d098f,null))[_0x89a1('0x64')](handleError(_0x4d098f,null));};exports[_0x89a1('0xba')]=function(_0x12d53b,_0xf24521,_0x206b82){_0x12d53b['body']['userpic']=_0x12d53b[_0x89a1('0xbb')][_0x89a1('0xbc')];return db[_0x89a1('0x60')][_0x89a1('0x41')]({'where':{'id':_0x12d53b['params']['id']}})['then'](handleEntityNotFound(_0xf24521,null))[_0x89a1('0x21')](saveUpdates(_0x12d53b[_0x89a1('0x68')],null))[_0x89a1('0x21')](respondWithResult(_0xf24521,null))[_0x89a1('0x64')](handleError(_0xf24521,null));};exports[_0x89a1('0xbd')]=function(_0x55080d,_0x1b83ff,_0x5b2b9b){var _0x1b38ed=path['join'](config[_0x89a1('0xbe')],_0x89a1('0xbf'));return db[_0x89a1('0x60')][_0x89a1('0x41')]({'where':{'id':_0x55080d[_0x89a1('0x69')]['id']},'attributes':['id',_0x89a1('0xc0')],'raw':!![]})[_0x89a1('0x21')](handleEntityNotFound(_0x1b83ff,null))[_0x89a1('0x21')](function(_0x37cdc5){if(_0x37cdc5){if(_[_0x89a1('0x71')](_0x37cdc5[_0x89a1('0xc0')])){return _0x1b83ff[_0x89a1('0xc1')](_0x1b38ed);}else{if(!fs[_0x89a1('0xc2')](path[_0x89a1('0xc3')](config[_0x89a1('0xbe')],_0x89a1('0xc4'),_0x37cdc5[_0x89a1('0xc0')]))){return _0x1b83ff[_0x89a1('0xc1')](_0x1b38ed);}return _0x1b83ff['download'](path['join'](config[_0x89a1('0xbe')],_0x89a1('0xc4'),_0x37cdc5[_0x89a1('0xc0')]));}}})[_0x89a1('0x64')](handleError(_0x1b83ff,null));};exports[_0x89a1('0xc5')]=function(_0x261bb1,_0x5c7d35,_0x6a3d31){var _0x226edc={};var _0x2e0b93={};var _0x2dbe67;var _0x433a57;return db[_0x89a1('0x60')][_0x89a1('0xc6')]({'where':{'id':_0x261bb1[_0x89a1('0x69')]['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0x5c7d35,null))[_0x89a1('0x21')](function(_0x3f72cf){if(_0x3f72cf){_0x2dbe67=_0x3f72cf;_0x2e0b93[_0x89a1('0x4a')]=_['keys'](db[_0x89a1('0xc7')][_0x89a1('0x46')]);_0x2e0b93[_0x89a1('0x4e')]=_[_0x89a1('0x66')](_0x261bb1[_0x89a1('0x4e')]);_0x2e0b93[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x2e0b93[_0x89a1('0x4a')],_0x2e0b93[_0x89a1('0x4e')]);_0x226edc[_0x89a1('0x50')]=_['intersection'](_0x2e0b93[_0x89a1('0x4a')],qs[_0x89a1('0x52')](_0x261bb1['query']['fields']));_0x226edc[_0x89a1('0x50')]=_0x226edc[_0x89a1('0x50')][_0x89a1('0x53')]?_0x226edc[_0x89a1('0x50')]:_0x2e0b93[_0x89a1('0x4a')];_0x226edc[_0x89a1('0x57')]=qs['sort'](_0x261bb1['query'][_0x89a1('0x58')]);_0x226edc[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_[_0x89a1('0x59')](_0x261bb1[_0x89a1('0x4e')],_0x2e0b93[_0x89a1('0x4f')]));if(_0x261bb1[_0x89a1('0x4e')][_0x89a1('0x3c')]){_0x226edc['where']=_[_0x89a1('0x5b')](_0x226edc['where'],{'$or':_[_0x89a1('0x3e')](_0x226edc['attributes'],function(_0x2c072c){var _0x522005={};_0x522005[_0x2c072c]={'$like':'%'+_0x261bb1[_0x89a1('0x4e')][_0x89a1('0x3c')]+'%'};return _0x522005;})});}_0x226edc=_[_0x89a1('0x5b')]({},_0x226edc,_0x261bb1[_0x89a1('0xc8')]);return _0x2dbe67[_0x89a1('0xc5')](_0x226edc);}})['then'](function(_0x5a879a){if(_0x5a879a){_0x433a57=_0x5a879a['length'];if(_0x261bb1[_0x89a1('0x4e')]['hasOwnProperty']('includeAll')){_0x226edc['include']=[{'model':db[_0x89a1('0xc9')],'as':_0x89a1('0xca'),'required':![]},{'model':db[_0x89a1('0xcb')],'as':_0x89a1('0xcc'),'attributes':['id',_0x89a1('0x42'),_0x89a1('0xcd')],'where':_0x261bb1[_0x89a1('0x4e')]['tag']?{'id':_0x261bb1['query'][_0x89a1('0xce')]}:undefined,'required':_0x261bb1[_0x89a1('0x4e')][_0x89a1('0xce')]?!![]:![]}];}if(!_0x261bb1['query'][_0x89a1('0x54')](_0x89a1('0x55'))){_0x226edc[_0x89a1('0x56')]=qs['limit'](_0x261bb1[_0x89a1('0x4e')]['limit']);_0x226edc[_0x89a1('0x2e')]=qs['offset'](_0x261bb1['query'][_0x89a1('0x2e')]);}return _0x2dbe67[_0x89a1('0xc5')](_0x226edc);}})[_0x89a1('0x21')](function(_0x11c027){if(_0x11c027){return _0x11c027?{'count':_0x433a57,'rows':_0x11c027}:null;}})['then'](respondWithResult(_0x5c7d35,null))[_0x89a1('0x64')](handleError(_0x5c7d35,null));};exports[_0x89a1('0xcf')]=function(_0x300f11,_0x346000,_0x3415fc){var _0x206710;var _0xdc5d1b;var _0x1dc1a0={};var _0x3b71b6;return db[_0x89a1('0x60')]['findOne']({'where':{'id':_0x300f11[_0x89a1('0x69')]['id']},'attributes':['id',_0x89a1('0x42'),_0x89a1('0x34')]})['then'](handleEntityNotFound(_0x346000,null))['then'](function(_0x51aea9){if(!utils[_0x89a1('0xa9')](_0x300f11[_0x89a1('0x4e')]['channel'])){throw new db[(_0x89a1('0x97'))][(_0x89a1('0x9a'))](_0x89a1('0xb7'));}_0x206710=_0x51aea9;var _0x4092e5={};_0x4092e5['model']=_['keys'](db[_[_0x89a1('0xab')](_0x300f11[_0x89a1('0x4e')]['channel'])+_0x89a1('0xd0')]['rawAttributes']);_0x4092e5[_0x89a1('0x4e')]=_['keys'](_0x300f11[_0x89a1('0x4e')]);_0x4092e5[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x4092e5['model'],_0x4092e5[_0x89a1('0x4e')]);_0x1dc1a0[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x4092e5[_0x89a1('0x4a')],qs['fields'](_0x300f11[_0x89a1('0x4e')][_0x89a1('0x52')]));_0x1dc1a0[_0x89a1('0x50')]=_0x1dc1a0[_0x89a1('0x50')]['length']?_0x1dc1a0[_0x89a1('0x50')]:_0x4092e5[_0x89a1('0x4a')];_0x1dc1a0[_0x89a1('0x57')]=qs[_0x89a1('0x58')](_0x300f11['query'][_0x89a1('0x58')]);_0x1dc1a0[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_['pick'](_0x300f11[_0x89a1('0x4e')],_0x4092e5[_0x89a1('0x4f')]));if(_0x300f11['query'][_0x89a1('0x3c')]){_0x1dc1a0[_0x89a1('0x5a')]=_[_0x89a1('0x5b')](_0x1dc1a0['where'],{'$or':_['map'](_0x1dc1a0[_0x89a1('0x50')],function(_0x4ca128){var _0x102e9c={};_0x102e9c[_0x4ca128]={'$like':'%'+_0x300f11[_0x89a1('0x4e')][_0x89a1('0x3c')]+'%'};return _0x102e9c;})});}_0x1dc1a0=_[_0x89a1('0x5b')]({},_0x1dc1a0,_0x300f11[_0x89a1('0xc8')]);switch(_0x206710[_0x89a1('0x34')]){case _0x89a1('0x35'):return db[_[_0x89a1('0xab')](_0x300f11[_0x89a1('0x4e')][_0x89a1('0xa4')])+_0x89a1('0xd0')][_0x89a1('0x62')](_0x1dc1a0);case'user':case'agent':return _0x206710[_0x89a1('0x33')+_[_0x89a1('0xab')](_0x300f11[_0x89a1('0x4e')][_0x89a1('0xa4')])+'Queues'](_0x1dc1a0);default:throw new db[(_0x89a1('0x97'))]['ValidationError'](_0x89a1('0xd1'));}})[_0x89a1('0x21')](function(_0x4246f3){_0x3b71b6=_0x4246f3[_0x89a1('0x53')];if(!_0x300f11['query'][_0x89a1('0x54')](_0x89a1('0x55'))){_0x1dc1a0[_0x89a1('0x56')]=qs[_0x89a1('0x56')](_0x300f11['query'][_0x89a1('0x56')]);_0x1dc1a0[_0x89a1('0x2e')]=qs[_0x89a1('0x2e')](_0x300f11['query'][_0x89a1('0x2e')]);}switch(_0x206710[_0x89a1('0x34')]){case _0x89a1('0x35'):return db[_[_0x89a1('0xab')](_0x300f11['query'][_0x89a1('0xa4')])+_0x89a1('0xd0')][_0x89a1('0x62')](_0x1dc1a0);case'user':case _0x89a1('0x39'):return _0x206710[_0x89a1('0x33')+_['capitalize'](_0x300f11[_0x89a1('0x4e')]['channel'])+_0x89a1('0xd2')](_0x1dc1a0);}})['then'](function(_0x174244){return{'count':_0x3b71b6,'rows':_0x174244};})[_0x89a1('0x21')](respondWithResult(_0x346000,null))[_0x89a1('0x64')](handleError(_0x346000,null));};exports['getVoiceQueuesRt']=function(_0x310faf,_0xa8d194,_0x2ce55f){var _0x33b690={};var _0x808fec={};var _0x4a8b89;var _0x3c4b16;return db['User'][_0x89a1('0xc6')]({'where':{'id':_0x310faf[_0x89a1('0x69')]['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0xa8d194,null))[_0x89a1('0x21')](function(_0x31fd9a){if(_0x31fd9a){_0x4a8b89=_0x31fd9a;_0x808fec[_0x89a1('0x4a')]=_[_0x89a1('0x66')](db['UserVoiceQueueRt']['rawAttributes']);_0x808fec['query']=_[_0x89a1('0x66')](_0x310faf[_0x89a1('0x4e')]);_0x808fec[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x808fec[_0x89a1('0x4a')],_0x808fec['query']);_0x33b690[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x808fec[_0x89a1('0x4a')],qs[_0x89a1('0x52')](_0x310faf['query'][_0x89a1('0x52')]));_0x33b690[_0x89a1('0x50')]=_0x33b690['attributes'][_0x89a1('0x53')]?_0x33b690[_0x89a1('0x50')]:_0x808fec['model'];_0x33b690['order']=qs['sort'](_0x310faf[_0x89a1('0x4e')][_0x89a1('0x58')]);_0x33b690['where']=qs[_0x89a1('0x4f')](_['pick'](_0x310faf[_0x89a1('0x4e')],_0x808fec['filters']));if(_0x310faf[_0x89a1('0x4e')][_0x89a1('0x3c')]){_0x33b690[_0x89a1('0x5a')]=_[_0x89a1('0x5b')](_0x33b690[_0x89a1('0x5a')],{'$or':_[_0x89a1('0x3e')](_0x33b690[_0x89a1('0x50')],function(_0x6fd5b5){var _0x3fc63b={};_0x3fc63b[_0x6fd5b5]={'$like':'%'+_0x310faf[_0x89a1('0x4e')][_0x89a1('0x3c')]+'%'};return _0x3fc63b;})});}_0x33b690=_[_0x89a1('0x5b')]({},_0x33b690,_0x310faf[_0x89a1('0xc8')]);return _0x4a8b89[_0x89a1('0xd3')](_0x33b690);}})[_0x89a1('0x21')](function(_0x5d2ef9){if(_0x5d2ef9){_0x3c4b16=_0x5d2ef9[_0x89a1('0x53')];if(!_0x310faf[_0x89a1('0x4e')][_0x89a1('0x54')](_0x89a1('0x55'))){_0x33b690[_0x89a1('0x56')]=qs[_0x89a1('0x56')](_0x310faf[_0x89a1('0x4e')]['limit']);_0x33b690['offset']=qs[_0x89a1('0x2e')](_0x310faf[_0x89a1('0x4e')][_0x89a1('0x2e')]);}return _0x4a8b89[_0x89a1('0xd3')](_0x33b690);}})[_0x89a1('0x21')](function(_0x37a452){if(_0x37a452){return _0x37a452?{'count':_0x3c4b16,'rows':_0x37a452}:null;}})['then'](respondWithResult(_0xa8d194,null))[_0x89a1('0x64')](handleError(_0xa8d194,null));};exports[_0x89a1('0xd4')]=function(_0x561f42,_0x5ebd80,_0x14f617){var _0x58551e={};var _0x2a4ae0={};var _0x5634ed;var _0xe78726;return db[_0x89a1('0x60')][_0x89a1('0xc6')]({'where':{'id':_0x561f42[_0x89a1('0x69')]['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0x5ebd80,null))['then'](function(_0x45b5f6){if(_0x45b5f6){_0x5634ed=_0x45b5f6;_0x2a4ae0[_0x89a1('0x4a')]=_[_0x89a1('0x66')](db[_0x89a1('0xd5')][_0x89a1('0x46')]);_0x2a4ae0[_0x89a1('0x4e')]=_[_0x89a1('0x66')](_0x561f42['query']);_0x2a4ae0[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x2a4ae0[_0x89a1('0x4a')],_0x2a4ae0[_0x89a1('0x4e')]);_0x58551e['attributes']=_['intersection'](_0x2a4ae0[_0x89a1('0x4a')],qs[_0x89a1('0x52')](_0x561f42[_0x89a1('0x4e')][_0x89a1('0x52')]));_0x58551e[_0x89a1('0x50')]=_0x58551e['attributes'][_0x89a1('0x53')]?_0x58551e[_0x89a1('0x50')]:_0x2a4ae0[_0x89a1('0x4a')];_0x58551e[_0x89a1('0x57')]=qs[_0x89a1('0x58')](_0x561f42['query'][_0x89a1('0x58')]);_0x58551e[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_[_0x89a1('0x59')](_0x561f42[_0x89a1('0x4e')],_0x2a4ae0[_0x89a1('0x4f')]));if(_0x561f42[_0x89a1('0x4e')][_0x89a1('0x3c')]){_0x58551e[_0x89a1('0x5a')]=_[_0x89a1('0x5b')](_0x58551e[_0x89a1('0x5a')],{'$or':_[_0x89a1('0x3e')](_0x58551e[_0x89a1('0x50')],function(_0x24817c){var _0x3b3c97={};_0x3b3c97[_0x24817c]={'$like':'%'+_0x561f42[_0x89a1('0x4e')][_0x89a1('0x3c')]+'%'};return _0x3b3c97;})});}_0x58551e=_[_0x89a1('0x5b')]({},_0x58551e,_0x561f42[_0x89a1('0xc8')]);return _0x5634ed[_0x89a1('0xd4')](_0x58551e);}})[_0x89a1('0x21')](function(_0x523302){if(_0x523302){_0xe78726=_0x523302[_0x89a1('0x53')];if(!_0x561f42[_0x89a1('0x4e')]['hasOwnProperty']('nolimit')){_0x58551e['limit']=qs['limit'](_0x561f42[_0x89a1('0x4e')]['limit']);_0x58551e['offset']=qs[_0x89a1('0x2e')](_0x561f42[_0x89a1('0x4e')][_0x89a1('0x2e')]);}return _0x5634ed[_0x89a1('0xd4')](_0x58551e);}})[_0x89a1('0x21')](function(_0x543686){if(_0x543686){return _0x543686?{'count':_0xe78726,'rows':_0x543686}:null;}})[_0x89a1('0x21')](respondWithResult(_0x5ebd80,null))['catch'](handleError(_0x5ebd80,null));};exports[_0x89a1('0xd6')]=function(_0x30c1ba,_0x5b534e,_0x483fbc){var _0x2a5b3c={'raw':!![],'where':{}};var _0x46c7fc={};var _0x58b4ee={'count':0x0,'rows':[]};return db[_0x89a1('0x60')][_0x89a1('0xc6')]({'where':{'id':_0x30c1ba[_0x89a1('0x69')]['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0x5b534e,null))[_0x89a1('0x21')](function(_0x3a1fe7){if(_0x3a1fe7){_0x46c7fc[_0x89a1('0x4a')]=_[_0x89a1('0x66')](db['VoiceRecording'][_0x89a1('0x46')]);_0x46c7fc[_0x89a1('0x4e')]=_[_0x89a1('0x66')](_0x30c1ba['query']);_0x46c7fc[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x46c7fc['model'],_0x46c7fc[_0x89a1('0x4e')]);_0x2a5b3c[_0x89a1('0x50')]=_['intersection'](_0x46c7fc[_0x89a1('0x4a')],qs[_0x89a1('0x52')](_0x30c1ba['query'][_0x89a1('0x52')]));_0x2a5b3c[_0x89a1('0x50')]=_0x2a5b3c[_0x89a1('0x50')][_0x89a1('0x53')]?_0x2a5b3c['attributes']:_0x46c7fc[_0x89a1('0x4a')];if(!_0x30c1ba['query'][_0x89a1('0x54')](_0x89a1('0x55'))){_0x2a5b3c[_0x89a1('0x56')]=qs[_0x89a1('0x56')](_0x30c1ba['query']['limit']);_0x2a5b3c[_0x89a1('0x2e')]=qs[_0x89a1('0x2e')](_0x30c1ba[_0x89a1('0x4e')][_0x89a1('0x2e')]);}_0x2a5b3c[_0x89a1('0x57')]=qs[_0x89a1('0x58')](_0x30c1ba['query'][_0x89a1('0x58')]);_0x2a5b3c[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_['pick'](_0x30c1ba[_0x89a1('0x4e')],_0x46c7fc['filters']));_0x2a5b3c['where'][_0x89a1('0xd7')]=_0x3a1fe7['id'];if(_0x30c1ba[_0x89a1('0x4e')][_0x89a1('0x3c')]){_0x2a5b3c[_0x89a1('0x5a')]=_[_0x89a1('0x5b')](_0x2a5b3c['where'],{'$or':_[_0x89a1('0x3e')](_0x2a5b3c[_0x89a1('0x50')],function(_0x541c52){var _0x369b53={};_0x369b53[_0x541c52]={'$like':'%'+_0x30c1ba[_0x89a1('0x4e')][_0x89a1('0x3c')]+'%'};return _0x369b53;})});}_0x2a5b3c=_[_0x89a1('0x5b')]({},_0x2a5b3c,_0x30c1ba[_0x89a1('0xc8')]);return db[_0x89a1('0xd8')][_0x89a1('0x61')]({'where':_0x2a5b3c[_0x89a1('0x5a')]})['then'](function(_0x4ee59a){_0x58b4ee[_0x89a1('0x61')]=_0x4ee59a;if(_0x30c1ba[_0x89a1('0x4e')][_0x89a1('0xd9')]){_0x2a5b3c[_0x89a1('0x67')]=[{'all':!![]}];}return db[_0x89a1('0xd8')]['findAll'](_0x2a5b3c);})[_0x89a1('0x21')](function(_0x46d45c){_0x58b4ee[_0x89a1('0x63')]=_0x46d45c;return _0x58b4ee;});}})[_0x89a1('0x21')](respondWithFilteredResult(_0x5b534e,_0x2a5b3c))[_0x89a1('0x64')](handleError(_0x5b534e,null));};exports[_0x89a1('0xda')]=function(_0x183754,_0x535d60,_0x1d6576){var _0x2ad970={'raw':!![],'where':{}};var _0x385025={};var _0x4c640e={'count':0x0,'rows':[]};return db['User'][_0x89a1('0xc6')]({'where':{'id':_0x183754[_0x89a1('0x69')]['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0x535d60,null))[_0x89a1('0x21')](function(_0x4b64a0){if(_0x4b64a0){_0x385025[_0x89a1('0x4a')]=_[_0x89a1('0x66')](db['ScreenRecording'][_0x89a1('0x46')]);_0x385025[_0x89a1('0x4e')]=_[_0x89a1('0x66')](_0x183754[_0x89a1('0x4e')]);_0x385025[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x385025[_0x89a1('0x4a')],_0x385025[_0x89a1('0x4e')]);_0x2ad970[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x385025['model'],qs['fields'](_0x183754[_0x89a1('0x4e')][_0x89a1('0x52')]));_0x2ad970[_0x89a1('0x50')]=_0x2ad970[_0x89a1('0x50')][_0x89a1('0x53')]?_0x2ad970[_0x89a1('0x50')]:_0x385025[_0x89a1('0x4a')];if(!_0x183754['query']['hasOwnProperty'](_0x89a1('0x55'))){_0x2ad970['limit']=qs[_0x89a1('0x56')](_0x183754[_0x89a1('0x4e')][_0x89a1('0x56')]);_0x2ad970[_0x89a1('0x2e')]=qs['offset'](_0x183754[_0x89a1('0x4e')]['offset']);}_0x2ad970[_0x89a1('0x57')]=qs[_0x89a1('0x58')](_0x183754[_0x89a1('0x4e')][_0x89a1('0x58')]);_0x2ad970[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_['pick'](_0x183754[_0x89a1('0x4e')],_0x385025[_0x89a1('0x4f')]));_0x2ad970[_0x89a1('0x5a')]['UserId']=_0x4b64a0['id'];if(_0x183754[_0x89a1('0x4e')][_0x89a1('0x3c')]){_0x2ad970['where']=_['merge'](_0x2ad970[_0x89a1('0x5a')],{'$or':_[_0x89a1('0x3e')](_0x2ad970[_0x89a1('0x50')],function(_0x1a06ec){var _0x59a7e1={};_0x59a7e1[_0x1a06ec]={'$like':'%'+_0x183754[_0x89a1('0x4e')][_0x89a1('0x3c')]+'%'};return _0x59a7e1;})});}_0x2ad970=_[_0x89a1('0x5b')]({},_0x2ad970,_0x183754['options']);return db[_0x89a1('0xdb')][_0x89a1('0x61')]({'where':_0x2ad970['where']})['then'](function(_0x2668f){_0x4c640e[_0x89a1('0x61')]=_0x2668f;if(_0x183754[_0x89a1('0x4e')][_0x89a1('0xd9')]){_0x2ad970[_0x89a1('0x67')]=[{'all':!![]}];}return db[_0x89a1('0xdb')][_0x89a1('0x62')](_0x2ad970);})[_0x89a1('0x21')](function(_0x497af4){_0x4c640e[_0x89a1('0x63')]=_0x497af4;return _0x4c640e;});}})[_0x89a1('0x21')](respondWithFilteredResult(_0x535d60,_0x2ad970))[_0x89a1('0x64')](handleError(_0x535d60,null));};exports['getChatInteractions']=function(_0x2feaa5,_0x523dcd,_0x1afff2){var _0x4fdb34={};var _0x53f2a2={};var _0x43e30a;var _0x2daba5;return db[_0x89a1('0x60')]['findOne']({'where':{'id':_0x2feaa5[_0x89a1('0x69')]['id']}})['then'](handleEntityNotFound(_0x523dcd,null))[_0x89a1('0x21')](function(_0x412fed){if(_0x412fed){_0x43e30a=_0x412fed;_0x53f2a2['model']=_[_0x89a1('0x66')](db[_0x89a1('0xdc')][_0x89a1('0x46')]);_0x53f2a2[_0x89a1('0x4e')]=_[_0x89a1('0x66')](_0x2feaa5[_0x89a1('0x4e')]);_0x53f2a2[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x53f2a2[_0x89a1('0x4a')],_0x53f2a2[_0x89a1('0x4e')]);_0x4fdb34[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x53f2a2[_0x89a1('0x4a')],qs['fields'](_0x2feaa5[_0x89a1('0x4e')][_0x89a1('0x52')]));_0x4fdb34[_0x89a1('0x50')]=_0x4fdb34[_0x89a1('0x50')][_0x89a1('0x53')]?_0x4fdb34['attributes']:_0x53f2a2[_0x89a1('0x4a')];_0x4fdb34[_0x89a1('0x57')]=qs[_0x89a1('0x58')](_0x2feaa5[_0x89a1('0x4e')][_0x89a1('0x58')]);_0x4fdb34[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_[_0x89a1('0x59')](_0x2feaa5[_0x89a1('0x4e')],_0x53f2a2[_0x89a1('0x4f')]));if(_0x2feaa5[_0x89a1('0x4e')]['filter']){_0x4fdb34[_0x89a1('0x5a')]=_[_0x89a1('0x5b')](_0x4fdb34['where'],{'$or':_[_0x89a1('0x3e')](_0x4fdb34[_0x89a1('0x50')],function(_0x2a7233){var _0x582825={};_0x582825[_0x2a7233]={'$like':'%'+_0x2feaa5[_0x89a1('0x4e')][_0x89a1('0x3c')]+'%'};return _0x582825;})});}_0x4fdb34=_[_0x89a1('0x5b')]({},_0x4fdb34,_0x2feaa5[_0x89a1('0xc8')]);return _0x43e30a[_0x89a1('0xdd')](_0x4fdb34);}})[_0x89a1('0x21')](function(_0x282b52){if(_0x282b52){_0x2daba5=_0x282b52['length'];if(!_0x2feaa5[_0x89a1('0x4e')][_0x89a1('0x54')](_0x89a1('0x55'))){_0x4fdb34[_0x89a1('0x56')]=qs[_0x89a1('0x56')](_0x2feaa5[_0x89a1('0x4e')]['limit']);_0x4fdb34[_0x89a1('0x2e')]=qs[_0x89a1('0x2e')](_0x2feaa5[_0x89a1('0x4e')][_0x89a1('0x2e')]);}return _0x43e30a[_0x89a1('0xdd')](_0x4fdb34);}})[_0x89a1('0x21')](function(_0x1ab0a0){if(_0x1ab0a0){return _0x1ab0a0?{'count':_0x2daba5,'rows':_0x1ab0a0}:null;}})['then'](respondWithResult(_0x523dcd,null))[_0x89a1('0x64')](handleError(_0x523dcd,null));};exports[_0x89a1('0xde')]=function(_0x4dab95,_0x445347,_0xbf59e1){var _0x469200={};var _0x5d8d21={};var _0x14abdc;var _0x545a85;return db['User'][_0x89a1('0xc6')]({'where':{'id':_0x4dab95[_0x89a1('0x69')]['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0x445347,null))['then'](function(_0x52decc){if(_0x52decc){_0x14abdc=_0x52decc;_0x5d8d21[_0x89a1('0x4a')]=_[_0x89a1('0x66')](db[_0x89a1('0xdf')]['rawAttributes']);_0x5d8d21[_0x89a1('0x4e')]=_['keys'](_0x4dab95[_0x89a1('0x4e')]);_0x5d8d21[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x5d8d21[_0x89a1('0x4a')],_0x5d8d21[_0x89a1('0x4e')]);_0x469200[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x5d8d21[_0x89a1('0x4a')],qs[_0x89a1('0x52')](_0x4dab95[_0x89a1('0x4e')][_0x89a1('0x52')]));_0x469200[_0x89a1('0x50')]=_0x469200['attributes'][_0x89a1('0x53')]?_0x469200['attributes']:_0x5d8d21[_0x89a1('0x4a')];_0x469200[_0x89a1('0x57')]=qs[_0x89a1('0x58')](_0x4dab95[_0x89a1('0x4e')][_0x89a1('0x58')]);_0x469200[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_[_0x89a1('0x59')](_0x4dab95[_0x89a1('0x4e')],_0x5d8d21[_0x89a1('0x4f')]));if(_0x4dab95[_0x89a1('0x4e')]['filter']){_0x469200[_0x89a1('0x5a')]=_[_0x89a1('0x5b')](_0x469200[_0x89a1('0x5a')],{'$or':_[_0x89a1('0x3e')](_0x469200['attributes'],function(_0x49f8d6){var _0x34564d={};_0x34564d[_0x49f8d6]={'$like':'%'+_0x4dab95[_0x89a1('0x4e')]['filter']+'%'};return _0x34564d;})});}_0x469200=_[_0x89a1('0x5b')]({},_0x469200,_0x4dab95['options']);return _0x14abdc['getOpenchannelInteractions'](_0x469200);}})['then'](function(_0x1fe634){if(_0x1fe634){_0x545a85=_0x1fe634[_0x89a1('0x53')];if(!_0x4dab95[_0x89a1('0x4e')]['hasOwnProperty'](_0x89a1('0x55'))){_0x469200[_0x89a1('0x56')]=qs[_0x89a1('0x56')](_0x4dab95[_0x89a1('0x4e')][_0x89a1('0x56')]);_0x469200[_0x89a1('0x2e')]=qs[_0x89a1('0x2e')](_0x4dab95[_0x89a1('0x4e')][_0x89a1('0x2e')]);}return _0x14abdc['getOpenchannelInteractions'](_0x469200);}})[_0x89a1('0x21')](function(_0x2a6b10){if(_0x2a6b10){return _0x2a6b10?{'count':_0x545a85,'rows':_0x2a6b10}:null;}})[_0x89a1('0x21')](respondWithResult(_0x445347,null))['catch'](handleError(_0x445347,null));};exports[_0x89a1('0xe0')]=function(_0x4e2bf5,_0x32c8e0,_0x45f696){var _0x1fafd6={'raw':!![],'where':{}};var _0x45261d={};var _0x17fb2d={'count':0x0,'rows':[]};return db[_0x89a1('0x60')][_0x89a1('0xc6')]({'where':{'id':_0x4e2bf5['params']['id']}})['then'](handleEntityNotFound(_0x32c8e0,null))[_0x89a1('0x21')](function(_0x5d3ecf){if(_0x5d3ecf){_0x45261d[_0x89a1('0x4a')]=_[_0x89a1('0x66')](db[_0x89a1('0xe1')]['rawAttributes']);_0x45261d['query']=_['keys'](_0x4e2bf5[_0x89a1('0x4e')]);_0x45261d[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x45261d[_0x89a1('0x4a')],_0x45261d[_0x89a1('0x4e')]);_0x1fafd6[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x45261d['model'],qs[_0x89a1('0x52')](_0x4e2bf5['query'][_0x89a1('0x52')]));_0x1fafd6['attributes']=_0x1fafd6[_0x89a1('0x50')]['length']?_0x1fafd6[_0x89a1('0x50')]:_0x45261d[_0x89a1('0x4a')];if(!_0x4e2bf5[_0x89a1('0x4e')][_0x89a1('0x54')]('nolimit')){_0x1fafd6['limit']=qs['limit'](_0x4e2bf5['query'][_0x89a1('0x56')]);_0x1fafd6[_0x89a1('0x2e')]=qs[_0x89a1('0x2e')](_0x4e2bf5['query']['offset']);}_0x1fafd6[_0x89a1('0x57')]=qs[_0x89a1('0x58')](_0x4e2bf5[_0x89a1('0x4e')]['sort']);_0x1fafd6[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_[_0x89a1('0x59')](_0x4e2bf5[_0x89a1('0x4e')],_0x45261d[_0x89a1('0x4f')]));_0x1fafd6[_0x89a1('0x5a')]['UserId']=_0x5d3ecf['id'];if(_0x4e2bf5[_0x89a1('0x4e')][_0x89a1('0x3c')]){_0x1fafd6[_0x89a1('0x5a')]=_[_0x89a1('0x5b')](_0x1fafd6[_0x89a1('0x5a')],{'$or':_['map'](_0x1fafd6['attributes'],function(_0x1ade06){var _0x190c95={};_0x190c95[_0x1ade06]={'$like':'%'+_0x4e2bf5[_0x89a1('0x4e')][_0x89a1('0x3c')]+'%'};return _0x190c95;})});}_0x1fafd6=_['merge']({},_0x1fafd6,_0x4e2bf5['options']);return db[_0x89a1('0xe1')][_0x89a1('0x61')]({'where':_0x1fafd6[_0x89a1('0x5a')]})[_0x89a1('0x21')](function(_0x22a505){_0x17fb2d['count']=_0x22a505;if(_0x4e2bf5[_0x89a1('0x4e')]['includeAll']){_0x1fafd6[_0x89a1('0x67')]=[{'all':!![]}];}return db['MailInteraction'][_0x89a1('0x62')](_0x1fafd6);})[_0x89a1('0x21')](function(_0x59cedd){_0x17fb2d['rows']=_0x59cedd;return _0x17fb2d;});}})['then'](respondWithFilteredResult(_0x32c8e0,_0x1fafd6))['catch'](handleError(_0x32c8e0,null));};exports[_0x89a1('0xe2')]=function(_0x283c39,_0x136a72,_0x537049){var _0x286923={};var _0x3ae7d2={};var _0x48bae4;var _0x323072;return db[_0x89a1('0x60')][_0x89a1('0xc6')]({'where':{'id':_0x283c39[_0x89a1('0x69')]['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0x136a72,null))['then'](function(_0xed9f83){if(_0xed9f83){_0x48bae4=_0xed9f83;_0x3ae7d2[_0x89a1('0x4a')]=_['keys'](db[_0x89a1('0xe3')][_0x89a1('0x46')]);_0x3ae7d2[_0x89a1('0x4e')]=_[_0x89a1('0x66')](_0x283c39[_0x89a1('0x4e')]);_0x3ae7d2[_0x89a1('0x4f')]=_['intersection'](_0x3ae7d2[_0x89a1('0x4a')],_0x3ae7d2['query']);_0x286923[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x3ae7d2['model'],qs[_0x89a1('0x52')](_0x283c39['query'][_0x89a1('0x52')]));_0x286923['attributes']=_0x286923['attributes'][_0x89a1('0x53')]?_0x286923[_0x89a1('0x50')]:_0x3ae7d2[_0x89a1('0x4a')];_0x286923[_0x89a1('0x57')]=qs['sort'](_0x283c39['query'][_0x89a1('0x58')]);_0x286923[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_['pick'](_0x283c39['query'],_0x3ae7d2[_0x89a1('0x4f')]));if(_0x283c39[_0x89a1('0x4e')][_0x89a1('0x3c')]){_0x286923[_0x89a1('0x5a')]=_['merge'](_0x286923['where'],{'$or':_['map'](_0x286923[_0x89a1('0x50')],function(_0x531b15){var _0xfc75f4={};_0xfc75f4[_0x531b15]={'$like':'%'+_0x283c39[_0x89a1('0x4e')]['filter']+'%'};return _0xfc75f4;})});}_0x286923=_[_0x89a1('0x5b')]({},_0x286923,_0x283c39[_0x89a1('0xc8')]);return _0x48bae4[_0x89a1('0xe2')](_0x286923);}})['then'](function(_0x5b2e1d){if(_0x5b2e1d){_0x323072=_0x5b2e1d['length'];if(!_0x283c39[_0x89a1('0x4e')][_0x89a1('0x54')](_0x89a1('0x55'))){_0x286923[_0x89a1('0x56')]=qs[_0x89a1('0x56')](_0x283c39[_0x89a1('0x4e')][_0x89a1('0x56')]);_0x286923[_0x89a1('0x2e')]=qs[_0x89a1('0x2e')](_0x283c39[_0x89a1('0x4e')]['offset']);}return _0x48bae4[_0x89a1('0xe2')](_0x286923);}})[_0x89a1('0x21')](function(_0x5b98bb){if(_0x5b98bb){return _0x5b98bb?{'count':_0x323072,'rows':_0x5b98bb}:null;}})[_0x89a1('0x21')](respondWithResult(_0x136a72,null))[_0x89a1('0x64')](handleError(_0x136a72,null));};exports[_0x89a1('0xe4')]=function(_0x48fcb5,_0x5f2fd3,_0x3d1dca){var _0xadab1e={};var _0x4e2c9e={};var _0x3fb79b;var _0x48b594;return db[_0x89a1('0x60')][_0x89a1('0xc6')]({'where':{'id':_0x48fcb5['params']['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0x5f2fd3,null))[_0x89a1('0x21')](function(_0x5ba65c){if(_0x5ba65c){_0x3fb79b=_0x5ba65c;_0x4e2c9e['model']=_[_0x89a1('0x66')](db['FaxInteraction'][_0x89a1('0x46')]);_0x4e2c9e[_0x89a1('0x4e')]=_['keys'](_0x48fcb5[_0x89a1('0x4e')]);_0x4e2c9e[_0x89a1('0x4f')]=_['intersection'](_0x4e2c9e[_0x89a1('0x4a')],_0x4e2c9e[_0x89a1('0x4e')]);_0xadab1e[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x4e2c9e['model'],qs['fields'](_0x48fcb5[_0x89a1('0x4e')][_0x89a1('0x52')]));_0xadab1e[_0x89a1('0x50')]=_0xadab1e[_0x89a1('0x50')][_0x89a1('0x53')]?_0xadab1e['attributes']:_0x4e2c9e[_0x89a1('0x4a')];_0xadab1e[_0x89a1('0x57')]=qs['sort'](_0x48fcb5['query'][_0x89a1('0x58')]);_0xadab1e[_0x89a1('0x5a')]=qs['filters'](_['pick'](_0x48fcb5[_0x89a1('0x4e')],_0x4e2c9e['filters']));if(_0x48fcb5['query']['filter']){_0xadab1e[_0x89a1('0x5a')]=_[_0x89a1('0x5b')](_0xadab1e[_0x89a1('0x5a')],{'$or':_[_0x89a1('0x3e')](_0xadab1e[_0x89a1('0x50')],function(_0x3d648b){var _0x206f8f={};_0x206f8f[_0x3d648b]={'$like':'%'+_0x48fcb5[_0x89a1('0x4e')][_0x89a1('0x3c')]+'%'};return _0x206f8f;})});}_0xadab1e=_[_0x89a1('0x5b')]({},_0xadab1e,_0x48fcb5[_0x89a1('0xc8')]);return _0x3fb79b['getFaxInteractions'](_0xadab1e);}})[_0x89a1('0x21')](function(_0x57036b){if(_0x57036b){_0x48b594=_0x57036b['length'];if(!_0x48fcb5[_0x89a1('0x4e')]['hasOwnProperty'](_0x89a1('0x55'))){_0xadab1e['limit']=qs['limit'](_0x48fcb5[_0x89a1('0x4e')][_0x89a1('0x56')]);_0xadab1e[_0x89a1('0x2e')]=qs[_0x89a1('0x2e')](_0x48fcb5[_0x89a1('0x4e')]['offset']);}return _0x3fb79b[_0x89a1('0xe4')](_0xadab1e);}})[_0x89a1('0x21')](function(_0x108911){if(_0x108911){return _0x108911?{'count':_0x48b594,'rows':_0x108911}:null;}})[_0x89a1('0x21')](respondWithResult(_0x5f2fd3,null))[_0x89a1('0x64')](handleError(_0x5f2fd3,null));};exports[_0x89a1('0xe5')]=function(_0x4e8e5d,_0x4b5134,_0x36dd8b){var _0x3d23d0={};var _0x5651aa={};var _0x2543cc;var _0x1455e0;return db[_0x89a1('0x60')][_0x89a1('0xc6')]({'where':{'id':_0x4e8e5d[_0x89a1('0x69')]['id']}})['then'](handleEntityNotFound(_0x4b5134,null))['then'](function(_0x415e80){if(_0x415e80){_0x2543cc=_0x415e80;_0x5651aa[_0x89a1('0x4a')]=_[_0x89a1('0x66')](db[_0x89a1('0xe6')][_0x89a1('0x46')]);_0x5651aa['query']=_[_0x89a1('0x66')](_0x4e8e5d[_0x89a1('0x4e')]);_0x5651aa[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x5651aa[_0x89a1('0x4a')],_0x5651aa['query']);_0x3d23d0[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x5651aa[_0x89a1('0x4a')],qs[_0x89a1('0x52')](_0x4e8e5d[_0x89a1('0x4e')]['fields']));_0x3d23d0[_0x89a1('0x50')]=_0x3d23d0['attributes'][_0x89a1('0x53')]?_0x3d23d0[_0x89a1('0x50')]:_0x5651aa['model'];_0x3d23d0[_0x89a1('0x57')]=qs[_0x89a1('0x58')](_0x4e8e5d[_0x89a1('0x4e')][_0x89a1('0x58')]);_0x3d23d0[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_[_0x89a1('0x59')](_0x4e8e5d[_0x89a1('0x4e')],_0x5651aa['filters']));if(_0x4e8e5d['query'][_0x89a1('0x3c')]){_0x3d23d0['where']=_[_0x89a1('0x5b')](_0x3d23d0[_0x89a1('0x5a')],{'$or':_['map'](_0x3d23d0[_0x89a1('0x50')],function(_0x5b45c7){var _0x1dc2d8={};_0x1dc2d8[_0x5b45c7]={'$like':'%'+_0x4e8e5d['query']['filter']+'%'};return _0x1dc2d8;})});}_0x3d23d0=_[_0x89a1('0x5b')]({},_0x3d23d0,_0x4e8e5d[_0x89a1('0xc8')]);return _0x2543cc[_0x89a1('0xe5')](_0x3d23d0);}})[_0x89a1('0x21')](function(_0x13af18){if(_0x13af18){_0x1455e0=_0x13af18[_0x89a1('0x53')];if(!_0x4e8e5d['query'][_0x89a1('0x54')]('nolimit')){_0x3d23d0[_0x89a1('0x56')]=qs[_0x89a1('0x56')](_0x4e8e5d[_0x89a1('0x4e')][_0x89a1('0x56')]);_0x3d23d0[_0x89a1('0x2e')]=qs[_0x89a1('0x2e')](_0x4e8e5d[_0x89a1('0x4e')][_0x89a1('0x2e')]);}return _0x2543cc[_0x89a1('0xe5')](_0x3d23d0);}})['then'](function(_0x32b4b7){if(_0x32b4b7){return _0x32b4b7?{'count':_0x1455e0,'rows':_0x32b4b7}:null;}})[_0x89a1('0x21')](respondWithResult(_0x4b5134,null))[_0x89a1('0x64')](handleError(_0x4b5134,null));};exports[_0x89a1('0xe7')]=function(_0x2af1ad,_0x5ee8e2,_0x680151){var _0x49a2b2;var _0x5519a4;var _0x465e27;var _0x2ee981=!_[_0x89a1('0x71')](_0x2af1ad[_0x89a1('0x69')]['id'])?_0x2af1ad[_0x89a1('0x69')]['id']:!_[_0x89a1('0x71')](_0x2af1ad[_0x89a1('0x37')]['id'])?_0x2af1ad[_0x89a1('0x37')]['id']:null;return db['User'][_0x89a1('0x41')]({'where':{'id':_0x2ee981,'role':{'$or':[_0x89a1('0x35'),_0x89a1('0x37'),_0x89a1('0x39')]}},'attributes':['id',_0x89a1('0x42'),_0x89a1('0xe8'),_0x89a1('0xe9'),_0x89a1('0x34'),_0x89a1('0x6d'),'loginInPause']})[_0x89a1('0x21')](function(_0x56b336){if(_0x56b336){if(_0x56b336[_0x89a1('0x34')]===_0x89a1('0x39')){_0x49a2b2=_0x56b336;if(_0x2af1ad['body'][_0x89a1('0xa8')]){_0x465e27=util[_0x89a1('0xb3')](_0x89a1('0xea'),_0x49a2b2[_0x2af1ad[_0x89a1('0x68')]['interface']]);}else if(_0x2af1ad[_0x89a1('0x68')][_0x89a1('0xeb')]){_0x465e27=util[_0x89a1('0xb3')](_0x89a1('0xec'),_0x2af1ad[_0x89a1('0x68')][_0x89a1('0xeb')]);}else{_0x465e27=util[_0x89a1('0xb3')](_0x89a1('0xec'),_0x49a2b2[_0x89a1('0x42')]);}socket['to'](util[_0x89a1('0xb3')](_0x89a1('0xed'),_0x49a2b2[_0x89a1('0x42')]))['emit'](_0x89a1('0xee'),{'ip':_0x2af1ad['headers'][_0x89a1('0xef')]||_0x2af1ad[_0x89a1('0xf0')][_0x89a1('0xf1')]||_0x2af1ad[_0x89a1('0xf2')][_0x89a1('0xf1')]||_0x2af1ad[_0x89a1('0xf0')]['socket'][_0x89a1('0xf1')]});return db[_0x89a1('0xb4')]['destroy']({'where':{'membername':_0x49a2b2[_0x89a1('0x42')]},'individualHooks':!![]});}}else{throw new db[(_0x89a1('0x97'))]['ValidationError'](_0x89a1('0xf3'));}})[_0x89a1('0x21')](function(){if(_0x49a2b2){return _0x49a2b2['getVoiceQueues']({'raw':!![]});}})[_0x89a1('0x21')](function(_0x4013a0){if(_0x49a2b2){var _0x5c3e1e=[];if(_0x4013a0){_0x5519a4=_0x4013a0;if(_0x5519a4['length']){for(var _0x19eeeb=0x0;_0x19eeeb<_0x5519a4['length'];_0x19eeeb++){_0x5c3e1e[_0x89a1('0x90')]({'membername':_0x49a2b2[_0x89a1('0x42')],'UserId':_0x49a2b2['id'],'queue_name':_0x5519a4[_0x19eeeb][_0x89a1('0x42')],'VoiceQueueId':_0x5519a4[_0x19eeeb]['id'],'interface':_0x465e27,'paused':_0x49a2b2[_0x89a1('0xa6')]||![],'penalty':_0x5519a4[_0x19eeeb][_0x89a1('0xf4')]||0x0});}return BPromise[_0x89a1('0x92')](_0x5c3e1e,function(_0x16c9c5){return db[_0x89a1('0xb4')][_0x89a1('0xb5')](_0x16c9c5);});}}}})[_0x89a1('0x21')](function(){if(_0x49a2b2){return db[_0x89a1('0xf5')][_0x89a1('0x62')]({'where':{'membername':_0x49a2b2[_0x89a1('0x42')],'exitAt':null}});}})[_0x89a1('0x21')](function(_0x58aab2){if(_0x49a2b2){var _0x1e1c39=[];_0x58aab2[_0x89a1('0xf6')](function(_0x5e2508){_0x1e1c39[_0x89a1('0x90')](_0x5e2508[_0x89a1('0x32')]({'exitAt':moment()[_0x89a1('0xb3')](_0x89a1('0xf7'))}));});return BPromise['all'](_0x1e1c39);}})[_0x89a1('0x21')](function(){if(_0x49a2b2){var _0x686faf=[];var _0xd3d9d7=[];var _0x503f8b=utils[_0x89a1('0xf8')]();var _0x3f9007={'membername':_0x49a2b2['name'],'interface':_0x465e27,'enterAt':moment()['format'](_0x89a1('0xf7')),'role':_0x49a2b2[_0x89a1('0x34')],'internal':_0x49a2b2[_0x89a1('0x6d')]};_0x503f8b[_0x89a1('0xf6')](function(_0x56971a){_0x686faf[_0x89a1('0x90')](_[_0x89a1('0x5b')]({'channel':_0x56971a,'type':_0x89a1('0xf9'),'data1':_0x2af1ad[_0x89a1('0x68')]['device'],'data2':_0x465e27},_0x3f9007));if(_0x49a2b2[_0x89a1('0xa6')]){_0xd3d9d7[_0x89a1('0x90')](_[_0x89a1('0x5b')]({'channel':_0x56971a,'type':_0x89a1('0xfa'),'data1':_0x89a1('0xfb')},_0x3f9007));}});return db['MemberReport'][_0x89a1('0x8d')](_0x686faf[_0x89a1('0xfc')](_0xd3d9d7),{'individualHooks':!![]});}})[_0x89a1('0x21')](function(){if(_0x49a2b2){return _0x49a2b2[_0x89a1('0x32')]({'online':!![],'lastLoginAt':moment()[_0x89a1('0xb3')](_0x89a1('0xf7')),'voicePause':_0x49a2b2['loginInPause']||![],'mailPause':_0x49a2b2['loginInPause']||![],'chatPause':_0x49a2b2[_0x89a1('0xa6')]||![],'faxPause':_0x49a2b2[_0x89a1('0xa6')]||![],'smsPause':_0x49a2b2['loginInPause']||![],'openchannelPause':_0x49a2b2[_0x89a1('0xa6')]||![],'whatsappPause':_0x49a2b2[_0x89a1('0xa6')]||![],'pauseType':_0x49a2b2[_0x89a1('0xa6')]?_0x89a1('0xfb'):null,'interface':_0x465e27,'lastPauseAt':moment()['format'](_0x89a1('0xf7'))});}})[_0x89a1('0x21')](function(_0x1a0ac3){if(_0x2af1ad[_0x89a1('0xfd')]){return _0x680151();}else{return BPromise[_0x89a1('0xfe')](_0x1a0ac3)[_0x89a1('0x21')](respondWithResult(_0x5ee8e2,null));}})[_0x89a1('0x64')](handleError(_0x5ee8e2,null));};exports['logout']=function(_0x5657ac,_0x1e6855,_0x252fc7){var _0x4b5d75;return db[_0x89a1('0x60')][_0x89a1('0x41')]({'where':{'id':_0x5657ac[_0x89a1('0x69')]['id'],'role':'agent'},'attributes':['id',_0x89a1('0x42'),_0x89a1('0x34')]})[_0x89a1('0x21')](handleEntityNotFound(_0x1e6855,null))[_0x89a1('0x21')](function(_0x1d7c16){if(_0x1d7c16){_0x4b5d75=_0x1d7c16;return db['UserVoiceQueueRt'][_0x89a1('0xff')]({'where':{'membername':_0x4b5d75['name']},'individualHooks':!![]});}})[_0x89a1('0x21')](function(){return db[_0x89a1('0xf5')]['findAll']({'where':{'membername':_0x4b5d75[_0x89a1('0x42')],'exitAt':null}});})['then'](function(_0x455e6d){var _0x1949aa=[];_0x455e6d[_0x89a1('0xf6')](function(_0x3cd20d){_0x1949aa[_0x89a1('0x90')](_0x3cd20d[_0x89a1('0x32')]({'exitAt':moment()[_0x89a1('0xb3')](_0x89a1('0xf7'))}));});return BPromise[_0x89a1('0x91')](_0x1949aa);})[_0x89a1('0x21')](function(){return _0x4b5d75['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x89a1('0x21')](respondWithResult(_0x1e6855,null))[_0x89a1('0x64')](handleError(_0x1e6855,null));};exports[_0x89a1('0x100')]=function(_0x30a9bc,_0x588860,_0x465def){var _0x266fc1;return db[_0x89a1('0xb4')]['update']({'paused':0x1},{'where':{'UserId':_0x30a9bc[_0x89a1('0x69')]['id']},'individualHooks':!![]})[_0x89a1('0x21')](function(){return db['User'][_0x89a1('0x41')]({'where':{'id':_0x30a9bc[_0x89a1('0x69')]['id'],'role':'agent'},'attributes':['id','name',_0x89a1('0x34'),_0x89a1('0x6d'),_0x89a1('0xa8')]});})[_0x89a1('0x21')](handleEntityNotFound(_0x588860,null))[_0x89a1('0x21')](function(_0x2269a1){if(_0x2269a1){_0x266fc1=_0x2269a1;return respondWithRpcPromise(_0x89a1('0x101'),'pause',{'id':_0x266fc1['id'],'name':_0x266fc1['name'],'pause':!![]});}})[_0x89a1('0x21')](function(){if(_0x266fc1){return db[_0x89a1('0xf5')][_0x89a1('0x62')]({'where':{'membername':_0x266fc1[_0x89a1('0x42')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x475694){if(_0x475694[_0x89a1('0x53')]){var _0x13565f=moment()[_0x89a1('0xb3')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x51b288=0x0,_0x174fe3=_0x475694[_0x89a1('0x53')];_0x51b288<_0x174fe3;_0x51b288++){_0x475694[_0x51b288][_0x89a1('0x102')]({'exitAt':_0x13565f});}}})[_0x89a1('0x21')](function(){var _0x44e109=[];var _0x581938=utils[_0x89a1('0xf8')]();_0x581938[_0x89a1('0xf6')](function(_0x18bbfe){_0x44e109[_0x89a1('0x90')]({'channel':_0x18bbfe,'membername':_0x266fc1[_0x89a1('0x42')],'interface':_[_0x89a1('0x71')](_0x266fc1[_0x89a1('0xa8')])?util[_0x89a1('0xb3')](_0x89a1('0xec'),_0x266fc1[_0x89a1('0x42')]):_0x266fc1['interface'],'type':_0x89a1('0xfa'),'enterAt':moment()[_0x89a1('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x30a9bc[_0x89a1('0x68')][_0x89a1('0x48')]||_0x89a1('0x103'),'role':_0x266fc1['role'],'internal':_0x266fc1['internal']});});return db[_0x89a1('0xf5')][_0x89a1('0x8d')](_0x44e109,{'individualHooks':!![]});})['then'](function(){return _0x266fc1[_0x89a1('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x30a9bc[_0x89a1('0x68')][_0x89a1('0x48')]||_0x89a1('0x103'),'lastPauseAt':moment()[_0x89a1('0xb3')](_0x89a1('0xf7'))});})[_0x89a1('0x21')](respondWithResult(_0x588860,null))[_0x89a1('0x64')](handleError(_0x588860,null));};exports[_0x89a1('0x104')]=function(_0xd353c3,_0x3d77b2,_0x628b23){var _0x50c323;return db[_0x89a1('0x60')][_0x89a1('0x41')]({'where':{'id':_0xd353c3[_0x89a1('0x69')]['id']},'attributes':['id',_0x89a1('0x42'),_0x89a1('0x34'),_0x89a1('0xa7'),'mailPause',_0x89a1('0x105'),_0x89a1('0x106'),_0x89a1('0x107'),'smsPause',_0x89a1('0x108'),'pauseType',_0x89a1('0x109')]})[_0x89a1('0x21')](handleEntityNotFound(_0x3d77b2,null))[_0x89a1('0x21')](function(_0x2af5a){if(_0x2af5a){_0x50c323=_0x2af5a;if(_0xd353c3[_0x89a1('0x68')][_0x89a1('0xa4')]&&!utils[_0x89a1('0xa9')](_0xd353c3['body']['channel'])){throw new db['Sequelize'][(_0x89a1('0x9a'))](_0x89a1('0xb7'));}switch(_0xd353c3['body']['channel']){case _0x89a1('0xb2'):return respondWithRpcPromise('QueuePause',_0x89a1('0x104'),{'id':_0x50c323['id'],'name':_0x50c323[_0x89a1('0x42')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x89a1('0x32')]({'paused':0x0},{'where':{'UserId':_0x50c323['id']},'individualHooks':!![]});})[_0x89a1('0x21')](function(){return db[_0x89a1('0xf5')][_0x89a1('0x41')]({'where':{'channel':_0xd353c3['body'][_0x89a1('0xa4')],'membername':_0x50c323[_0x89a1('0x42')],'type':_0x89a1('0xfa'),'exitAt':null}});})[_0x89a1('0x21')](function(_0x22df9e){if(_0x22df9e){return _0x22df9e[_0x89a1('0x32')]({'exitAt':moment()[_0x89a1('0xb3')](_0x89a1('0xf7')),'data2':_0x89a1('0x10a')},{'individualHooks':!![]});}return null;})[_0x89a1('0x21')](function(){return _0x50c323[_0x89a1('0x32')]({'voicePause':![]});});case _0x89a1('0x10b'):case _0x89a1('0x10c'):case _0x89a1('0x10d'):case _0x89a1('0x10e'):case _0x89a1('0x10f'):case _0x89a1('0x110'):return db[_0x89a1('0xf5')][_0x89a1('0x41')]({'where':{'channel':_0xd353c3[_0x89a1('0x68')]['channel'],'membername':_0x50c323[_0x89a1('0x42')],'type':_0x89a1('0xfa'),'exitAt':null}})['then'](function(_0x4f174d){if(_0x4f174d){return _0x4f174d[_0x89a1('0x32')]({'exitAt':moment()['format'](_0x89a1('0xf7')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x89a1('0x21')](function(){var _0x374705={};_[_0x89a1('0x2f')](_0x374705,util[_0x89a1('0xb3')](_0x89a1('0x111'),_0xd353c3[_0x89a1('0x68')][_0x89a1('0xa4')],_0x89a1('0x112')),![]);return _0x50c323['update'](_0x374705);});default:return respondWithRpcPromise(_0x89a1('0x101'),_0x89a1('0x104'),{'id':_0x50c323['id'],'name':_0x50c323[_0x89a1('0x42')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x89a1('0x32')]({'paused':0x0},{'where':{'UserId':_0x50c323['id']}});})[_0x89a1('0x21')](function(){return db[_0x89a1('0xf5')][_0x89a1('0x62')]({'where':{'membername':_0x50c323[_0x89a1('0x42')],'type':_0x89a1('0xfa'),'exitAt':null}});})['then'](function(_0xf42df5){var _0x900ff0=[];_0xf42df5['forEach'](function(_0x190cd4){_0x900ff0[_0x89a1('0x90')](_0x190cd4[_0x89a1('0x32')]({'exitAt':moment()[_0x89a1('0xb3')](_0x89a1('0xf7')),'data2':_0x89a1('0x10a')}));});return BPromise[_0x89a1('0x91')](_0x900ff0);})[_0x89a1('0x21')](function(){return _0x50c323[_0x89a1('0x32')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x89a1('0x21')](respondWithResult(_0x3d77b2,null))[_0x89a1('0x64')](handleError(_0x3d77b2,null));};exports[_0x89a1('0x113')]=function(_0x584840,_0x17c5b7,_0x3a1b1d){var _0xee1b90={};var _0x69a2e4={};var _0x69464c;var _0x104cfa;return db['User']['findOne']({'where':{'id':_0x584840[_0x89a1('0x69')]['id']}})['then'](handleEntityNotFound(_0x17c5b7,null))[_0x89a1('0x21')](function(_0xdc0c5){if(_0xdc0c5){_0x69464c=_0xdc0c5;_0x69a2e4['model']=_[_0x89a1('0x66')](db[_0x89a1('0x114')]['rawAttributes']);_0x69a2e4[_0x89a1('0x4e')]=_['keys'](_0x584840[_0x89a1('0x4e')]);_0x69a2e4[_0x89a1('0x4f')]=_['intersection'](_0x69a2e4[_0x89a1('0x4a')],_0x69a2e4[_0x89a1('0x4e')]);_0xee1b90[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x69a2e4[_0x89a1('0x4a')],qs[_0x89a1('0x52')](_0x584840[_0x89a1('0x4e')][_0x89a1('0x52')]));_0xee1b90[_0x89a1('0x50')]=_0xee1b90[_0x89a1('0x50')][_0x89a1('0x53')]?_0xee1b90[_0x89a1('0x50')]:_0x69a2e4[_0x89a1('0x4a')];_0xee1b90[_0x89a1('0x57')]=qs[_0x89a1('0x58')](_0x584840[_0x89a1('0x4e')]['sort']);_0xee1b90[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_[_0x89a1('0x59')](_0x584840[_0x89a1('0x4e')],_0x69a2e4[_0x89a1('0x4f')]));if(_0x584840[_0x89a1('0x4e')][_0x89a1('0x3c')]){_0xee1b90[_0x89a1('0x5a')]=_[_0x89a1('0x5b')](_0xee1b90['where'],{'$or':_[_0x89a1('0x3e')](_0xee1b90[_0x89a1('0x50')],function(_0xf9776c){var _0x4afdbf={};_0x4afdbf[_0xf9776c]={'$like':'%'+_0x584840[_0x89a1('0x4e')][_0x89a1('0x3c')]+'%'};return _0x4afdbf;})});}_0xee1b90=_[_0x89a1('0x5b')]({},_0xee1b90,_0x584840['options']);return _0x69464c['getTeams'](_0xee1b90);}})[_0x89a1('0x21')](function(_0x40962d){if(_0x40962d){_0x104cfa=_0x40962d['length'];if(!_0x584840[_0x89a1('0x4e')][_0x89a1('0x54')]('nolimit')){_0xee1b90[_0x89a1('0x56')]=qs[_0x89a1('0x56')](_0x584840['query']['limit']);_0xee1b90[_0x89a1('0x2e')]=qs[_0x89a1('0x2e')](_0x584840[_0x89a1('0x4e')][_0x89a1('0x2e')]);}return _0x69464c[_0x89a1('0x113')](_0xee1b90);}})['then'](function(_0x110946){if(_0x110946){return _0x110946?{'count':_0x104cfa,'rows':_0x110946}:null;}})[_0x89a1('0x21')](respondWithResult(_0x17c5b7,null))[_0x89a1('0x64')](handleError(_0x17c5b7,null));};exports[_0x89a1('0x115')]=function(_0x3de163,_0x4e233d){return db[_0x89a1('0x60')][_0x89a1('0x41')]({'where':{'id':_0x3de163['params']['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0x4e233d,null))[_0x89a1('0x21')](function(_0x50b0de){if(_0x50b0de){var _0x2df186=_0x50b0de[_0x89a1('0x33')]({'plain':!![]});return _0x50b0de[_0x89a1('0x115')](_0x3de163[_0x89a1('0x68')][_0x89a1('0x6c')],_[_0x89a1('0x116')](_0x3de163['body'],['ids','id'])||{})['then'](function(){for(var _0x28dc6f=0x0;_0x28dc6f<_0x3de163[_0x89a1('0x68')][_0x89a1('0x6c')]['length'];_0x28dc6f++){var _0x23490a=[];db[_0x89a1('0x114')][_0x89a1('0xc6')]({'where':{'id':_0x3de163['body'][_0x89a1('0x6c')][_0x28dc6f]}})[_0x89a1('0x21')](function(_0x2f0b20){_0x23490a[_0x89a1('0x90')](_0x2f0b20['getVoiceQueues']()['then'](function(_0x5f3ebd){for(var _0x558af3=0x0;_0x558af3<_0x5f3ebd[_0x89a1('0x53')];_0x558af3++){_0x5f3ebd[_0x558af3][_0x89a1('0x117')](_0x89a1('0xa4'),'Voice');}return _0x5f3ebd;}));_0x23490a[_0x89a1('0x90')](_0x2f0b20['getChatQueues']()['then'](function(_0x351eb5){for(var _0x2fa670=0x0;_0x2fa670<_0x351eb5[_0x89a1('0x53')];_0x2fa670++){_0x351eb5[_0x2fa670][_0x89a1('0x117')](_0x89a1('0xa4'),_0x89a1('0x118'));}return _0x351eb5;}));_0x23490a[_0x89a1('0x90')](_0x2f0b20[_0x89a1('0x119')]()['then'](function(_0xba7347){for(var _0x3354f5=0x0;_0x3354f5<_0xba7347[_0x89a1('0x53')];_0x3354f5++){_0xba7347[_0x3354f5][_0x89a1('0x117')](_0x89a1('0xa4'),_0x89a1('0x11a'));}return _0xba7347;}));_0x23490a[_0x89a1('0x90')](_0x2f0b20[_0x89a1('0x11b')]()['then'](function(_0x1c18f6){for(var _0x5b4e44=0x0;_0x5b4e44<_0x1c18f6[_0x89a1('0x53')];_0x5b4e44++){_0x1c18f6[_0x5b4e44]['setDataValue'](_0x89a1('0xa4'),_0x89a1('0x11c'));}return _0x1c18f6;}));_0x23490a[_0x89a1('0x90')](_0x2f0b20[_0x89a1('0x11d')]()['then'](function(_0x2a86dd){for(var _0x2f0624=0x0;_0x2f0624<_0x2a86dd[_0x89a1('0x53')];_0x2f0624++){_0x2a86dd[_0x2f0624]['setDataValue']('channel',_0x89a1('0x11e'));}return _0x2a86dd;}));_0x23490a[_0x89a1('0x90')](_0x2f0b20['getFaxQueues']()[_0x89a1('0x21')](function(_0x108b7b){for(var _0x368a94=0x0;_0x368a94<_0x108b7b[_0x89a1('0x53')];_0x368a94++){_0x108b7b[_0x368a94][_0x89a1('0x117')]('channel',_0x89a1('0x11f'));}return _0x108b7b;}));_0x23490a[_0x89a1('0x90')](_0x2f0b20[_0x89a1('0x120')]()['then'](function(_0x59ad4b){for(var _0x3583fd=0x0;_0x3583fd<_0x59ad4b[_0x89a1('0x53')];_0x3583fd++){_0x59ad4b[_0x3583fd][_0x89a1('0x117')](_0x89a1('0xa4'),'Openchannel');}return _0x59ad4b;}));return BPromise[_0x89a1('0x91')](_0x23490a);})[_0x89a1('0x21')](function(_0x16ecb1){var _0x52437d=_[_0x89a1('0x121')](_0x16ecb1);_0x23490a=[];return db[_0x89a1('0x5d')][_0x89a1('0x122')](function(_0x257c7c){for(var _0x30ba9c=0x0;_0x30ba9c<_0x52437d[_0x89a1('0x53')];_0x30ba9c++){_0x23490a[_0x89a1('0x90')](_0x52437d[_0x30ba9c]['addAgent'](_0x2df186['id']),{'transaction':_0x257c7c});}return BPromise[_0x89a1('0x91')](_0x23490a)[_0x89a1('0x21')](function(){if(_0x2df186[_0x89a1('0xa5')]){return BPromise[_0x89a1('0x92')](_[_0x89a1('0x3c')](_0x52437d,function(_0xaebd4){return _0xaebd4['getDataValue']('channel')==='Voice';}),function(_0x5ba910){return db[_0x89a1('0xb4')]['upsert']({'membername':_0x2df186[_0x89a1('0x42')],'UserId':_0x2df186['id'],'queue_name':_0x5ba910['name'],'VoiceQueueId':_0x5ba910['id'],'interface':_[_0x89a1('0x71')](_0x2df186[_0x89a1('0xa8')])?util[_0x89a1('0xb3')]('SIP/%s',_0x2df186[_0x89a1('0x42')]):_0x2df186[_0x89a1('0xa8')],'paused':_0x2df186[_0x89a1('0xa7')]||![],'penalty':_0x2df186['penalty']},{'transaction':_0x257c7c});});}else{return;}})[_0x89a1('0x21')](function(){for(var _0x570b7e=0x0;_0x570b7e<_0x52437d[_0x89a1('0x53')];_0x570b7e++){var _0x184452=_0x52437d[_0x570b7e][_0x89a1('0x123')](_0x89a1('0xa4'));var _0xdf0483=_0x184452+_0x89a1('0xaf');socket[_0x89a1('0xb0')](_0x89a1('0x37')+_0x184452+_0x89a1('0xb1'),{'UserId':_0x2df186['id'],['queueField']:_0x52437d[_0x570b7e]['id']});}});});});}});}})[_0x89a1('0x21')](respondWithStatusCode(_0x4e233d,null))[_0x89a1('0x64')](handleError(_0x4e233d,null));};exports[_0x89a1('0x124')]=function(_0x3f91a0,_0xc179a1){return db[_0x89a1('0x60')][_0x89a1('0xc6')]({'where':{'id':_0x3f91a0[_0x89a1('0x69')]['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0xc179a1,null))[_0x89a1('0x21')](function(_0x42ce12){if(_0x42ce12){var _0x24a585=_0x42ce12[_0x89a1('0x33')]({'plain':!![]});var _0xbf33a0=_0x3f91a0[_0x89a1('0x4e')][_0x89a1('0x6c')];return _0x42ce12['removeTeams'](_0xbf33a0)[_0x89a1('0x21')](function(){for(var _0x160b0d=0x0;_0x160b0d<_0xbf33a0[_0x89a1('0x53')];_0x160b0d++){var _0xfbca84=[];db[_0x89a1('0x114')][_0x89a1('0xc6')]({'where':{'id':_0xbf33a0[_0x160b0d]}})['then'](function(_0x38c89a){_0xfbca84[_0x89a1('0x90')](_0x38c89a[_0x89a1('0x125')]()[_0x89a1('0x21')](function(_0x2093a7){for(var _0x170b72=0x0;_0x170b72<_0x2093a7[_0x89a1('0x53')];_0x170b72++){_0x2093a7[_0x170b72][_0x89a1('0x117')](_0x89a1('0xa4'),'Voice');}return _0x2093a7;}));_0xfbca84[_0x89a1('0x90')](_0x38c89a[_0x89a1('0x126')]()[_0x89a1('0x21')](function(_0x2fb3e3){for(var _0x54403b=0x0;_0x54403b<_0x2fb3e3[_0x89a1('0x53')];_0x54403b++){_0x2fb3e3[_0x54403b][_0x89a1('0x117')](_0x89a1('0xa4'),_0x89a1('0x118'));}return _0x2fb3e3;}));_0xfbca84[_0x89a1('0x90')](_0x38c89a[_0x89a1('0x119')]()[_0x89a1('0x21')](function(_0x4151cd){for(var _0x47c4a4=0x0;_0x47c4a4<_0x4151cd[_0x89a1('0x53')];_0x47c4a4++){_0x4151cd[_0x47c4a4][_0x89a1('0x117')](_0x89a1('0xa4'),'Mail');}return _0x4151cd;}));_0xfbca84[_0x89a1('0x90')](_0x38c89a[_0x89a1('0x11b')]()[_0x89a1('0x21')](function(_0x251793){for(var _0x3e3359=0x0;_0x3e3359<_0x251793[_0x89a1('0x53')];_0x3e3359++){_0x251793[_0x3e3359][_0x89a1('0x117')]('channel','Sms');}return _0x251793;}));_0xfbca84['push'](_0x38c89a['getWhatsappQueues']()['then'](function(_0x13bc9b){for(var _0x58ceaf=0x0;_0x58ceaf<_0x13bc9b[_0x89a1('0x53')];_0x58ceaf++){_0x13bc9b[_0x58ceaf]['setDataValue'](_0x89a1('0xa4'),_0x89a1('0x11e'));}return _0x13bc9b;}));_0xfbca84[_0x89a1('0x90')](_0x38c89a[_0x89a1('0x127')]()[_0x89a1('0x21')](function(_0x5977af){for(var _0x1aa80e=0x0;_0x1aa80e<_0x5977af[_0x89a1('0x53')];_0x1aa80e++){_0x5977af[_0x1aa80e]['setDataValue'](_0x89a1('0xa4'),_0x89a1('0x11f'));}return _0x5977af;}));_0xfbca84[_0x89a1('0x90')](_0x38c89a[_0x89a1('0x120')]()[_0x89a1('0x21')](function(_0x47fc83){for(var _0x5d99c4=0x0;_0x5d99c4<_0x47fc83[_0x89a1('0x53')];_0x5d99c4++){_0x47fc83[_0x5d99c4]['setDataValue'](_0x89a1('0xa4'),'Openchannel');}return _0x47fc83;}));return BPromise['all'](_0xfbca84);})[_0x89a1('0x21')](function(_0x51b37f){var _0x34117=_[_0x89a1('0x121')](_0x51b37f);_0xfbca84=[];return db[_0x89a1('0x5d')][_0x89a1('0x122')](function(_0x2fa10b){for(var _0x283905=0x0;_0x283905<_0x34117[_0x89a1('0x53')];_0x283905++){_0xfbca84['push'](_0x34117[_0x283905][_0x89a1('0x128')](_0x24a585['id']),{'transaction':_0x2fa10b});}return BPromise[_0x89a1('0x91')](_0xfbca84)['then'](function(){if(_0x24a585['online']){return BPromise[_0x89a1('0x92')](_[_0x89a1('0x3c')](_0x34117,function(_0x3e2bac){return _0x3e2bac[_0x89a1('0x123')](_0x89a1('0xa4'))===_0x89a1('0x129');}),function(_0x1dd0e8){return db[_0x89a1('0xb4')][_0x89a1('0xff')]({'where':{'VoiceQueueId':_0x1dd0e8['id'],'UserId':_0x24a585['id']},'transaction':_0x2fa10b});});}else{return;}})[_0x89a1('0x21')](function(){for(var _0xa88138=0x0;_0xa88138<_0x34117['length'];_0xa88138++){var _0x57b0d4=_0x34117[_0xa88138][_0x89a1('0x123')](_0x89a1('0xa4'));var _0x1560cf=_0x57b0d4+_0x89a1('0xaf');socket[_0x89a1('0xb0')]('user'+_0x57b0d4+'Queue:remove',{'UserId':_0x24a585['id'],['queueField']:_0x34117[_0xa88138]['id']});}});});});}});}})[_0x89a1('0x21')](respondWithStatusCode(_0xc179a1,null))[_0x89a1('0x64')](handleError(_0xc179a1,null));};exports[_0x89a1('0x12a')]=function(_0x10da83,_0x1eb629,_0x9d8525){var _0x8bec65={};var _0x1c529e={};var _0x5186d0;var _0x2e47e7;return db[_0x89a1('0x60')][_0x89a1('0xc6')]({'where':{'id':_0x10da83[_0x89a1('0x69')]['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0x1eb629,null))[_0x89a1('0x21')](function(_0x51433d){if(_0x51433d){_0x5186d0=_0x51433d;_0x1c529e[_0x89a1('0x4a')]=_['keys'](db[_0x89a1('0xc9')][_0x89a1('0x46')]);_0x1c529e[_0x89a1('0x4e')]=_['keys'](_0x10da83[_0x89a1('0x4e')]);_0x1c529e[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x1c529e[_0x89a1('0x4a')],_0x1c529e[_0x89a1('0x4e')]);_0x8bec65[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x1c529e[_0x89a1('0x4a')],qs[_0x89a1('0x52')](_0x10da83[_0x89a1('0x4e')]['fields']));_0x8bec65[_0x89a1('0x50')]=_0x8bec65[_0x89a1('0x50')]['length']?_0x8bec65[_0x89a1('0x50')]:_0x1c529e[_0x89a1('0x4a')];_0x8bec65['order']=qs[_0x89a1('0x58')](_0x10da83['query'][_0x89a1('0x58')]);_0x8bec65[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_[_0x89a1('0x59')](_0x10da83[_0x89a1('0x4e')],_0x1c529e[_0x89a1('0x4f')]));if(_0x10da83['query'][_0x89a1('0x3c')]){_0x8bec65[_0x89a1('0x5a')]=_[_0x89a1('0x5b')](_0x8bec65[_0x89a1('0x5a')],{'$or':_[_0x89a1('0x3e')](_0x8bec65[_0x89a1('0x50')],function(_0x4068ee){var _0x1cbaca={};_0x1cbaca[_0x4068ee]={'$like':'%'+_0x10da83[_0x89a1('0x4e')]['filter']+'%'};return _0x1cbaca;})});}_0x8bec65=_[_0x89a1('0x5b')]({},_0x8bec65,_0x10da83[_0x89a1('0xc8')]);return _0x5186d0[_0x89a1('0x12a')](_0x8bec65);}})['then'](function(_0x1f6604){if(_0x1f6604){_0x2e47e7=_0x1f6604[_0x89a1('0x53')];if(!_0x10da83[_0x89a1('0x4e')][_0x89a1('0x54')]('nolimit')){_0x8bec65[_0x89a1('0x56')]=qs[_0x89a1('0x56')](_0x10da83[_0x89a1('0x4e')][_0x89a1('0x56')]);_0x8bec65[_0x89a1('0x2e')]=qs['offset'](_0x10da83[_0x89a1('0x4e')][_0x89a1('0x2e')]);}return _0x5186d0[_0x89a1('0x12a')](_0x8bec65);}})[_0x89a1('0x21')](function(_0x4c4ae8){if(_0x4c4ae8){return _0x4c4ae8?{'count':_0x2e47e7,'rows':_0x4c4ae8}:null;}})[_0x89a1('0x21')](respondWithResult(_0x1eb629,null))['catch'](handleError(_0x1eb629,null));};exports['getAgents']=function(_0x237885,_0x944891,_0x1093b3){var _0x259635={};var _0x3b1e4c={};var _0x409992;var _0x55f6bd;return db[_0x89a1('0x60')]['findOne']({'where':{'id':_0x237885[_0x89a1('0x69')]['id']}})[_0x89a1('0x21')](handleEntityNotFound(_0x944891,null))[_0x89a1('0x21')](function(_0x11316e){if(_0x11316e){_0x409992=_0x11316e;_0x3b1e4c[_0x89a1('0x4a')]=_[_0x89a1('0x66')](db['User']['rawAttributes']);_0x3b1e4c['query']=_[_0x89a1('0x66')](_0x237885[_0x89a1('0x4e')]);_0x3b1e4c[_0x89a1('0x4f')]=_[_0x89a1('0x51')](_0x3b1e4c['model'],_0x3b1e4c[_0x89a1('0x4e')]);_0x259635[_0x89a1('0x50')]=_[_0x89a1('0x51')](_0x3b1e4c[_0x89a1('0x4a')],qs['fields'](_0x237885[_0x89a1('0x4e')][_0x89a1('0x52')]));_0x259635[_0x89a1('0x50')]=_0x259635['attributes'][_0x89a1('0x53')]?_0x259635[_0x89a1('0x50')]:_0x3b1e4c[_0x89a1('0x4a')];_0x259635[_0x89a1('0x57')]=qs[_0x89a1('0x58')](_0x237885[_0x89a1('0x4e')][_0x89a1('0x58')]);_0x259635[_0x89a1('0x5a')]=qs[_0x89a1('0x4f')](_[_0x89a1('0x59')](_0x237885[_0x89a1('0x4e')],_0x3b1e4c[_0x89a1('0x4f')]));if(_0x237885[_0x89a1('0x4e')][_0x89a1('0x3c')]){_0x259635[_0x89a1('0x5a')]=_[_0x89a1('0x5b')](_0x259635[_0x89a1('0x5a')],{'$or':_[_0x89a1('0x3e')](_0x259635[_0x89a1('0x50')],function(_0x533542){var _0x34abed={};_0x34abed[_0x533542]={'$like':'%'+_0x237885[_0x89a1('0x4e')][_0x89a1('0x3c')]+'%'};return _0x34abed;})});}_0x259635[_0x89a1('0x4a')]=db[_0x89a1('0x60')];_0x259635['as']=_0x89a1('0x38');_0x259635=_[_0x89a1('0x5b')]({},_0x259635,_0x237885[_0x89a1('0xc8')]);return _0x409992[_0x89a1('0x125')]({'include':[_0x259635]});}})[_0x89a1('0x21')](function(_0x11a216){if(_0x11a216){var _0x22b326={},_0xc2038e=[],_0x2952a7=0x0;for(var _0x5f30b4=0x0;_0x5f30b4<_0x11a216[_0x89a1('0x53')];_0x5f30b4+=0x1){for(var _0x180269=0x0,_0x1f8917;_0x180269<_0x11a216[_0x5f30b4][_0x89a1('0x38')][_0x89a1('0x53')];_0x180269+=0x1){_0x1f8917=_0x11a216[_0x5f30b4][_0x89a1('0x38')][_0x180269][_0x89a1('0x33')]({'plain':!![]});_0x22b326[_0x1f8917['id']]=_0x1f8917;}}_0x22b326=_['values'](_0x22b326);for(var _0x31ed86=qs[_0x89a1('0x2e')](_0x237885[_0x89a1('0x4e')][_0x89a1('0x2e')]);_0x31ed86<_0x22b326[_0x89a1('0x53')]&&_0xc2038e['length']=_0x114a21){_0x26c22f=_0x114a21;_0x12445f=0xc8;}else{_0x12445f=0xce;}_0x10551e[_0xe00e('0x27')](_0x12445f);return _0x10551e['set'](_0xe00e('0x2b'),_0x275adb+'-'+_0x26c22f+'/'+_0x114a21)[_0xe00e('0x2c')](_0x38d8eb);}return null;};}function patchUpdates(_0x4d9209){return function(_0x3b661f){try{jsonpatch['apply'](_0x3b661f,_0x4d9209,!![]);}catch(_0x169b8d){return BPromise[_0xe00e('0x2d')](_0x169b8d);}return _0x3b661f[_0xe00e('0x2e')]();};}function saveUpdates(_0x500472,_0x399b6d){return function(_0x179b0d){if(_0x179b0d){return _0x179b0d['update'](_0x500472)[_0xe00e('0x2f')](function(_0x33ea3e){return _0x33ea3e;});}return null;};}function removeEntity(_0x345ddc,_0x52aaf7){return function(_0x1e7985){if(_0x1e7985){return _0x1e7985[_0xe00e('0x30')]()[_0xe00e('0x2f')](function(){var _0x51b188=_0x1e7985['get']({'plain':!![]});if(_0x51b188[_0xe00e('0x31')]==='admin')return;var _0x4c1f48=[{'name':'Users','value':_0xe00e('0x32'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0xe00e('0x33'),'value':_0xe00e('0x34'),'ignore':![]}];var _0x49de36=_(_0x4c1f48)[_0xe00e('0x35')](_0xe00e('0x36'))[_0xe00e('0x37')]('value')[_0xe00e('0x38')]();if(_[_0xe00e('0x39')](_0x49de36,_0x51b188[_0xe00e('0x31')])){return;}var _0x35b8b2=_[_0xe00e('0x3a')](_0x4c1f48,['value',_0x51b188[_0xe00e('0x31')]])['name'];return db[_0xe00e('0x3b')][_0xe00e('0x30')]({'where':{'type':_0x35b8b2,'resourceId':_0x51b188['id']}})[_0xe00e('0x2f')](function(){return _0x1e7985;});})['then'](function(){_0x345ddc[_0xe00e('0x27')](0xcc)[_0xe00e('0x28')]();});}};}function handleEntityNotFound(_0x588124,_0x370ced){return function(_0x28ddc1){if(!_0x28ddc1){_0x588124[_0xe00e('0x26')](0x194);}return _0x28ddc1;};}function handleError(_0x4a373c,_0x131e7e){_0x131e7e=_0x131e7e||0x1f4;return function(_0x332a10){logger['error'](_0x332a10[_0xe00e('0x3c')]);if(_0x332a10[_0xe00e('0x3d')]){delete _0x332a10[_0xe00e('0x3d')];}_0x4a373c[_0xe00e('0x27')](_0x131e7e)[_0xe00e('0x3e')](_0x332a10);};}exports[_0xe00e('0x3f')]=function(_0x5d7249,_0x449694){var _0x333796={},_0x35d98e={},_0x5237eb={'count':0x0,'rows':[]};var _0x3eb1dd=_[_0xe00e('0x37')](db[_0xe00e('0x40')][_0xe00e('0x41')],function(_0x270cb3){return{'name':_0x270cb3[_0xe00e('0x42')],'type':_0x270cb3[_0xe00e('0x43')][_0xe00e('0x44')]};});_0x35d98e[_0xe00e('0x45')]=_['differenceBy'](_['map'](_0x3eb1dd,'name'),['password',_0xe00e('0x46')]);_0x35d98e[_0xe00e('0x47')]=_[_0xe00e('0x48')](_0x5d7249[_0xe00e('0x47')]);_0x35d98e[_0xe00e('0x49')]=_['intersection'](_0x35d98e[_0xe00e('0x45')],_0x35d98e[_0xe00e('0x47')]);_0x333796[_0xe00e('0x4a')]=_['intersection'](_0x35d98e[_0xe00e('0x45')],qs[_0xe00e('0x4b')](_0x5d7249[_0xe00e('0x47')][_0xe00e('0x4b')]));_0x333796[_0xe00e('0x4a')]=_0x333796['attributes']['length']?_0x333796[_0xe00e('0x4a')]:_0x35d98e[_0xe00e('0x45')];if(!_0x5d7249[_0xe00e('0x47')][_0xe00e('0x4c')](_0xe00e('0x4d'))){_0x333796[_0xe00e('0x2a')]=qs[_0xe00e('0x2a')](_0x5d7249[_0xe00e('0x47')][_0xe00e('0x2a')]);_0x333796[_0xe00e('0x29')]=qs['offset'](_0x5d7249[_0xe00e('0x47')][_0xe00e('0x29')]);}_0x333796['order']=qs['sort'](_0x5d7249[_0xe00e('0x47')][_0xe00e('0x4e')]);_0x333796[_0xe00e('0x4f')]=qs[_0xe00e('0x49')](_[_0xe00e('0x50')](_0x5d7249['query'],_0x35d98e[_0xe00e('0x49')]),_0x3eb1dd);if(_0x5d7249[_0xe00e('0x47')][_0xe00e('0x35')]){_0x333796[_0xe00e('0x4f')]=_[_0xe00e('0x51')](_0x333796[_0xe00e('0x4f')],{'$or':_[_0xe00e('0x37')](_0x3eb1dd,function(_0x544be0){if(_0x544be0['type']!==_0xe00e('0x52')){return db[_0xe00e('0x53')][_0xe00e('0x4f')](db[_0xe00e('0x53')]['fn'](_0xe00e('0x54'),db[_0xe00e('0x53')][_0xe00e('0x55')](_0x544be0[_0xe00e('0x3d')])),{'$like':db[_0xe00e('0x53')]['fn'](_0xe00e('0x54'),'%'+_0x5d7249[_0xe00e('0x47')][_0xe00e('0x35')]+'%')});}})});}_0x333796=_[_0xe00e('0x51')]({},_0x333796,_0x5d7249[_0xe00e('0x56')]);var _0x4e1cf9={'where':_0x333796[_0xe00e('0x4f')]};return db['User'][_0xe00e('0x57')](_0x4e1cf9)['then'](function(_0x5259bc){_0x5237eb['count']=_0x5259bc;if(_0x5d7249[_0xe00e('0x47')][_0xe00e('0x58')]){_0x333796[_0xe00e('0x59')]=[{'all':!![]}];}return db[_0xe00e('0x40')]['findAll'](_0x333796);})[_0xe00e('0x2f')](function(_0x32dc35){_0x5237eb[_0xe00e('0x5a')]=_0x32dc35;return _0x5237eb;})[_0xe00e('0x2f')](respondWithFilteredResult(_0x449694,_0x333796))[_0xe00e('0x25')](handleError(_0x449694,null));};exports[_0xe00e('0x5b')]=function(_0xd060ab,_0x7051b2){var _0x227897={'raw':![],'where':{'id':_0xd060ab[_0xe00e('0x5c')]['id']}},_0x50391c={};_0x50391c[_0xe00e('0x45')]=_[_0xe00e('0x5d')](_['keys'](db[_0xe00e('0x40')][_0xe00e('0x41')]),[_0xe00e('0x5e'),_0xe00e('0x46')]);_0x50391c[_0xe00e('0x47')]=_[_0xe00e('0x48')](_0xd060ab[_0xe00e('0x47')]);_0x50391c[_0xe00e('0x49')]=_[_0xe00e('0x5f')](_0x50391c[_0xe00e('0x45')],_0x50391c['query']);_0x227897[_0xe00e('0x4a')]=_[_0xe00e('0x5f')](_0x50391c['model'],qs[_0xe00e('0x4b')](_0xd060ab[_0xe00e('0x47')]['fields']));_0x227897['attributes']=_0x227897[_0xe00e('0x4a')]['length']?_0x227897[_0xe00e('0x4a')]:_0x50391c[_0xe00e('0x45')];if(_0xd060ab[_0xe00e('0x47')]['includeAll']){_0x227897['include']=[{'all':!![]}];}_0x227897=_[_0xe00e('0x51')]({},_0x227897,_0xd060ab[_0xe00e('0x56')]);return db[_0xe00e('0x40')][_0xe00e('0x3a')](_0x227897)[_0xe00e('0x2f')](handleEntityNotFound(_0x7051b2,null))['then'](respondWithResult(_0x7051b2,null))[_0xe00e('0x25')](handleError(_0x7051b2,null));};exports[_0xe00e('0x60')]=function(_0x1d6c19,_0x5e2cab){if(_0x1d6c19['body']['id']){delete _0x1d6c19[_0xe00e('0x61')]['id'];}delete _0x1d6c19[_0xe00e('0x61')]['role'];return db[_0xe00e('0x40')][_0xe00e('0x3a')]({'where':{'id':_0x1d6c19[_0xe00e('0x5c')]['id']}})[_0xe00e('0x2f')](handleEntityNotFound(_0x5e2cab,null))['then'](saveUpdates(_0x1d6c19[_0xe00e('0x61')],null))[_0xe00e('0x2f')](respondWithResult(_0x5e2cab,null))[_0xe00e('0x25')](handleError(_0x5e2cab,null));};exports[_0xe00e('0x62')]=function(_0x31ab29,_0x246ceb){return db[_0xe00e('0x40')][_0xe00e('0x62')]()['then'](respondWithResult(_0x246ceb,null))['catch'](handleError(_0x246ceb,null));};exports[_0xe00e('0x63')]=function(_0x311a40,_0x889dcb,_0x4077ea){return db[_0xe00e('0x40')][_0xe00e('0x3a')]({'where':{'id':_0x311a40[_0xe00e('0x5c')]['id']}})[_0xe00e('0x2f')](handleEntityNotFound(_0x889dcb,null))[_0xe00e('0x2f')](function(_0x5636be){if(_0x5636be){return _0x5636be[_0xe00e('0x63')](_0x311a40[_0xe00e('0x61')][_0xe00e('0x64')],_[_0xe00e('0x65')](_0x311a40[_0xe00e('0x61')],[_0xe00e('0x64'),'id'])||{});}})[_0xe00e('0x2f')](respondWithResult(_0x889dcb,null))[_0xe00e('0x25')](handleError(_0x889dcb,null));};function validateUser(_0x3f4b47){return new BPromise(function(_0x199672,_0x505b4e){if(_0x3f4b47[_0xe00e('0x66')])return _0x199672(_0x3f4b47);return db[_0xe00e('0x67')]['findById'](0x1)[_0xe00e('0x2f')](function(_0x2d31c0){if(_0x2d31c0[_0xe00e('0x68')])authService[_0xe00e('0x69')](_0x3f4b47['password']);db['User'][_0xe00e('0x6a')](_0xe00e('0x66'))[_0xe00e('0x2f')](function(_0xc9d4a8){if(_[_0xe00e('0x6b')](_0xc9d4a8)){_0x3f4b47[_0xe00e('0x66')]=_0x2d31c0[_0xe00e('0x6c')]||0x1;return;}if(_[_0xe00e('0x6b')](_0x2d31c0[_0xe00e('0x6c')])||_0x2d31c0[_0xe00e('0x6c')]===_0xc9d4a8){_0x3f4b47[_0xe00e('0x66')]=_0xc9d4a8+0x1;return;}if(_0x2d31c0[_0xe00e('0x6c')]>_0xc9d4a8){_0x3f4b47[_0xe00e('0x66')]=_0x2d31c0[_0xe00e('0x6c')];return;}return db['sequelize'][_0xe00e('0x47')](_0xe00e('0x6d'),{'type':db[_0xe00e('0x53')][_0xe00e('0x6e')]['SELECT']})[_0xe00e('0x2f')](function(_0x294b1c){if(_0x294b1c&&_0x294b1c[_0xe00e('0x6f')]){for(var _0x1c42a3=0x0,_0x104148=_0x294b1c[_0xe00e('0x6f')];_0x1c42a3<_0x104148&&_['isNil'](_0x3f4b47[_0xe00e('0x66')]);_0x1c42a3++){if(_0x2d31c0[_0xe00e('0x6c')]<=_0x294b1c[_0x1c42a3][_0xe00e('0x70')]){_0x3f4b47[_0xe00e('0x66')]=_0x294b1c[_0x1c42a3][_0xe00e('0x70')];}else if(_0x2d31c0['min_internal']>_0x294b1c[_0x1c42a3][_0xe00e('0x70')]&&_0x2d31c0[_0xe00e('0x6c')]<=_0x294b1c[_0x1c42a3]['to']){_0x3f4b47['internal']=_0x2d31c0['min_internal'];}}}if(_[_0xe00e('0x6b')](_0x3f4b47[_0xe00e('0x66')])){_0x3f4b47[_0xe00e('0x66')]=_0xc9d4a8+0x1;}return _0x199672(_0x3f4b47);});});})[_0xe00e('0x25')](function(_0x7c1e16){_0x505b4e(_0x7c1e16);});});}function updateUser(_0x53ba9e){return new BPromise(function(_0x2b51f3,_0x592da7){try{if(_0x53ba9e[_0xe00e('0x71')]){_0x53ba9e[_0xe00e('0x72')]=_0x53ba9e[_0xe00e('0x66')];_0x53ba9e[_0xe00e('0x73')]={'mailbox':_0x53ba9e[_0xe00e('0x66')],'password':_0x53ba9e[_0xe00e('0x5e')],'fullname':_0x53ba9e[_0xe00e('0x74')],'email':_0x53ba9e['email']};}if(_0x53ba9e[_0xe00e('0x31')]===_0xe00e('0x75')){if(!_0x53ba9e[_0xe00e('0x76')])_0x53ba9e[_0xe00e('0x76')]=[_0xe00e('0x77'),_0xe00e('0x78'),'103','113',_0xe00e('0x79'),'104','105',_0xe00e('0x7a'),_0xe00e('0x7b'),_0xe00e('0x7c'),'109',_0xe00e('0x7d'),_0xe00e('0x7e'),_0xe00e('0x7f')];}_0x2b51f3(_0x53ba9e);}catch(_0x503e02){_0x592da7(_0x503e02);}});}exports[_0xe00e('0x80')]=function(_0x9643af,_0x37af74){if(_0x9643af['user'][_0xe00e('0x31')]===_0xe00e('0x75'))throw new Error(_0xe00e('0x81'));if(_0x9643af[_0xe00e('0x61')][_0xe00e('0x31')]===_0xe00e('0x32')&&_0x9643af['user'][_0xe00e('0x31')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x9643af[_0xe00e('0x61')][_0xe00e('0x31')]===_0xe00e('0x82')&&_0x9643af['user'][_0xe00e('0x31')]!=='admin'){throw new Error(_0xe00e('0x83'));}return licenseUtil[_0xe00e('0x84')]([_0x9643af[_0xe00e('0x61')]])[_0xe00e('0x2f')](function(){return validateUser(_0x9643af[_0xe00e('0x61')]);})[_0xe00e('0x2f')](function(_0x58f380){return updateUser(_0x58f380)[_0xe00e('0x2f')](function(_0x5f14ee){if(_0x5f14ee['role']==='admin'){_0x5f14ee['settingsEnabled']=_0x9643af[_0xe00e('0x32')][_0xe00e('0x85')];delete _0x5f14ee[_0xe00e('0x86')];}return _0x5f14ee;});})['then'](function(_0x428ea0){return db[_0xe00e('0x40')][_0xe00e('0x80')](_0x428ea0,{'include':[{'model':db['VoiceMail'],'as':_0xe00e('0x73')}]});})['then'](function(_0x360672){if(_0x9643af['body'][_0xe00e('0x31')]===_0xe00e('0x32'))return _0x360672;if(_0x9643af[_0xe00e('0x32')][_0xe00e('0x31')]!==_0xe00e('0x32'))return _0x360672;return db[_0xe00e('0x87')][_0xe00e('0x3a')]({'where':{'name':_0x360672[_0xe00e('0x31')]==='agent'?'Agents':_0xe00e('0x33'),'userProfileId':_0x9643af[_0xe00e('0x32')]['userProfileId']},'raw':!![]})[_0xe00e('0x2f')](function(_0x42b0e0){if(!_0x42b0e0||_0x42b0e0[_0xe00e('0x88')]!=0x0)return _0x360672;return db[_0xe00e('0x3b')][_0xe00e('0x80')]({'name':_0x360672[_0xe00e('0x3d')],'resourceId':_0x360672['id'],'type':_0x42b0e0['name'],'sectionId':_0x42b0e0['id']},{})[_0xe00e('0x2f')](function(){return _0x360672;});})[_0xe00e('0x25')](function(_0x20a086){logger[_0xe00e('0x22')](_0xe00e('0x89'),_0x20a086);throw _0x20a086;});})[_0xe00e('0x2f')](respondWithResult(_0x37af74,0xc9))[_0xe00e('0x25')](handleError(_0x37af74,null));};exports[_0xe00e('0x8a')]=function(_0x4bbfd1,_0xc3852b){var _0x3217fa=_0x4bbfd1[_0xe00e('0x61')];var _0x566803=[];if(_0x4bbfd1[_0xe00e('0x32')][_0xe00e('0x31')]===_0xe00e('0x75'))throw new Error(_0xe00e('0x81'));if(_[_0xe00e('0x8b')](_0x3217fa,['role',_0xe00e('0x32')])&&_0x4bbfd1[_0xe00e('0x32')][_0xe00e('0x31')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xe00e('0x8b')](_0x3217fa,[_0xe00e('0x31'),_0xe00e('0x82')])&&_0x4bbfd1[_0xe00e('0x32')]['role']!==_0xe00e('0x82')){throw new Error(_0xe00e('0x8c'));}return licenseUtil[_0xe00e('0x84')](_0x3217fa)[_0xe00e('0x2f')](function(){return validateUser(_0x3217fa[0x0]);})['then'](function(){for(var _0x258df2=0x1;_0x258df2<_0x3217fa['length'];_0x258df2++){var _0x1a9be8=_0x3217fa[_0x258df2-0x1][_0xe00e('0x66')];if(!_0x3217fa[_0x258df2][_0xe00e('0x66')])_0x3217fa[_0x258df2]['internal']=_0x1a9be8+0x1;_0x566803[_0xe00e('0x8d')](validateUser(_0x3217fa[_0x258df2]));}return BPromise[_0xe00e('0x8e')](_0x566803);})[_0xe00e('0x2f')](function(){_0x566803=[];for(var _0x150ce8=0x0;_0x150ce8<_0x3217fa[_0xe00e('0x6f')];_0x150ce8++){_0x566803[_0xe00e('0x8d')](updateUser(_0x3217fa[_0x150ce8]));}return BPromise[_0xe00e('0x8e')](_0x566803);})['then'](function(){return BPromise[_0xe00e('0x8f')](_0x3217fa,function(_0x183efc){return db[_0xe00e('0x40')][_0xe00e('0x80')](_0x183efc,{'include':[{'model':db[_0xe00e('0x73')],'as':_0xe00e('0x73')}]})['then'](function(_0x1c5600){_0x183efc['id']=_0x1c5600['id'];return _0x183efc;});});})[_0xe00e('0x2f')](function(_0x279f2c){if(_0x4bbfd1['body'][_0xe00e('0x31')]===_0xe00e('0x32'))return _0x279f2c;if(_0x4bbfd1[_0xe00e('0x32')][_0xe00e('0x31')]!=='user')return _0x279f2c;var _0x517960=_['some'](_0x279f2c,function(_0x316fb8){return _0x316fb8['role']===_0xe00e('0x75')||_0x316fb8['role']==='telephone';});if(!_0x517960)return _0x279f2c;return db['UserProfileSection'][_0xe00e('0x90')]({'where':{'name':{'$or':['Agents',_0xe00e('0x33')]},'userProfileId':_0x4bbfd1['user'][_0xe00e('0x86')]},'raw':!![]})[_0xe00e('0x2f')](function(_0x306fd7){if(_[_0xe00e('0x91')](_0x306fd7)||!_['some'](_0x306fd7,[_0xe00e('0x88'),0x0]))return _0x279f2c;_0x566803=[];var _0x1c0f73=_(_0x306fd7)[_0xe00e('0x37')](function(_0x3cf238){if(_0x3cf238[_0xe00e('0x88')]===0x1)return;return _0x3cf238[_0xe00e('0x3d')]===_0xe00e('0x92')?_0xe00e('0x75'):'telephone';})[_0xe00e('0x93')]()[_0xe00e('0x38')]();for(var _0x4ba794=0x0;_0x4ba794<_0x279f2c['length'];_0x4ba794++){if(!_['includes'](_0x1c0f73,_0x279f2c[_0x4ba794][_0xe00e('0x31')]))return;var _0x4a1dad=_0x279f2c[_0x4ba794]['role']===_0xe00e('0x75')?_0xe00e('0x92'):_0xe00e('0x33');_0x566803['push'](db[_0xe00e('0x3b')][_0xe00e('0x80')]({'name':_0x279f2c[_0x4ba794][_0xe00e('0x3d')],'resourceId':_0x279f2c[_0x4ba794]['id'],'type':_0x4a1dad,'sectionId':_['find'](_0x306fd7,[_0xe00e('0x3d'),_0x4a1dad])['id']},{}));}return BPromise['all'](_0x566803);})[_0xe00e('0x2f')](respondWithResult(_0xc3852b,0xc9))[_0xe00e('0x25')](handleError(_0xc3852b,null));});};exports['changePassword']=function(_0x10d692,_0x5ec302,_0x58b3fc){if(_0x10d692[_0xe00e('0x61')]['id']){delete _0x10d692[_0xe00e('0x61')]['id'];}return db['User'][_0xe00e('0x3a')]({'where':{'id':_0x10d692[_0xe00e('0x5c')]['id']}})[_0xe00e('0x2f')](function(_0x149518){if(!_0x149518)return null;if(_0x149518['id']===_0x10d692[_0xe00e('0x32')]['id']){if(!_0x10d692[_0xe00e('0x61')][_0xe00e('0x94')]||!_0x10d692['body'][_0xe00e('0x95')]){throw new db[(_0xe00e('0x96'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x149518[_0xe00e('0x97')](_0x10d692[_0xe00e('0x61')][_0xe00e('0x94')])){throw new db[(_0xe00e('0x96'))][(_0xe00e('0x98'))](_0xe00e('0x99'));}if(_0x10d692[_0xe00e('0x61')][_0xe00e('0x94')]===_0x10d692[_0xe00e('0x61')][_0xe00e('0x95')]){throw new db[(_0xe00e('0x96'))][(_0xe00e('0x98'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x10d692[_0xe00e('0x32')][_0xe00e('0x31')]===_0xe00e('0x82')){if(!_0x10d692['body'][_0xe00e('0x95')]){throw new db[(_0xe00e('0x96'))][(_0xe00e('0x98'))](_0xe00e('0x9a'));}}else if(_0x10d692[_0xe00e('0x32')][_0xe00e('0x31')]===_0xe00e('0x32')){if(!_0x10d692[_0xe00e('0x61')][_0xe00e('0x95')]){throw new db[(_0xe00e('0x96'))]['ValidationError'](_0xe00e('0x9a'));}if(_0x149518[_0xe00e('0x31')]!==_0xe00e('0x75')){throw new db['Sequelize'][(_0xe00e('0x98'))]('Unauthorized');}}else{throw new db[(_0xe00e('0x96'))]['ValidationError'](_0xe00e('0x81'));}return _0x149518;})[_0xe00e('0x2f')](handleEntityNotFound(_0x5ec302,null))[_0xe00e('0x2f')](function(_0xb2254a){return db['Setting'][_0xe00e('0x9b')]({'attributes':['id',_0xe00e('0x68'),_0xe00e('0x9c'),_0xe00e('0x9d')]})[_0xe00e('0x2f')](function(_0x29d3e0){if(_0x29d3e0[_0xe00e('0x68')])authService[_0xe00e('0x69')](_0x10d692['body'][_0xe00e('0x95')]);if(!_0x29d3e0[_0xe00e('0x9c')]||!_0xb2254a[_0xe00e('0x9e')])return _0xb2254a;authService[_0xe00e('0x9f')](_0x10d692[_0xe00e('0x61')]['newPassword'],_0xb2254a[_0xe00e('0x9e')],_0x29d3e0[_0xe00e('0x9d')]);return _0xb2254a;})[_0xe00e('0x2f')](saveUpdates({'password':_0x10d692[_0xe00e('0x61')][_0xe00e('0x95')],'passwordResetAt':_0x10d692[_0xe00e('0x32')]['id']==_0x10d692[_0xe00e('0x5c')]['id']?moment():null,'previousPasswords':authService[_0xe00e('0xa0')](_0x10d692[_0xe00e('0x61')][_0xe00e('0x95')],_0xb2254a[_0xe00e('0x9e')])},null));})['then'](respondWithResult(_0x5ec302,null))[_0xe00e('0x25')](handleError(_0x5ec302,null));};exports[_0xe00e('0xa1')]=function(_0x25c6f0,_0x367a30,_0x24b40c){var _0xffe9c8=_0x25c6f0[_0xe00e('0x61')]['channel'];return db[_0xe00e('0x40')][_0xe00e('0x3a')]({'where':{'id':_0x25c6f0[_0xe00e('0x5c')]['id']},'attributes':['id',_0xe00e('0x3d'),_0xe00e('0x31'),'online',_0xe00e('0xa2'),_0xe00e('0xa3'),_0xe00e('0xa4')]})['then'](handleEntityNotFound(_0x367a30,null))['then'](function(_0x462457){if(_0x462457){if(!utils[_0xe00e('0xa5')](_0xffe9c8)){throw new db[(_0xe00e('0x96'))][(_0xe00e('0x98'))](_0xe00e('0xa6'));}return _0x462457[_0xe00e('0xa7')+_['capitalize'](_0xffe9c8[_0xe00e('0xa8')]())+_0xe00e('0xa9')](_0x25c6f0[_0xe00e('0x61')]['ids'],{'penalty':_0x25c6f0['body'][_0xe00e('0xaa')]||0x0})[_0xe00e('0xab')](function(_0x1dd981){for(var _0x2ddb62=0x0;_0x2ddb62<_0x25c6f0['body']['ids']['length'];_0x2ddb62+=0x1){var _0x2762ff={'UserId':_0x25c6f0['params']['id']};_0x2762ff[_[_0xe00e('0xac')](_0xffe9c8[_0xe00e('0xa8')]())+'QueueId']=_0x25c6f0[_0xe00e('0x61')][_0xe00e('0x64')][_0x2ddb62];socket[_0xe00e('0xad')](_0xe00e('0x32')+_[_0xe00e('0xac')](_0xffe9c8[_0xe00e('0xa8')]())+_0xe00e('0xae'),_0x2762ff);}return _0x1dd981;})[_0xe00e('0x2f')](function(){if(_0xffe9c8===_0xe00e('0xaf')){return db['VoiceQueue'][_0xe00e('0x90')]({'where':{'id':_0x25c6f0[_0xe00e('0x61')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0xe00e('0x2f')](function(_0x20a20d){var _0x2ffc23=_0x462457[_0xe00e('0xb0')]({'plain':!![]});var _0x5125ad=[];if(_0xffe9c8===_0xe00e('0xaf')&&_0x2ffc23[_0xe00e('0x31')]===_0xe00e('0x75')&&_0x2ffc23['online']){for(var _0x52846=0x0;_0x52846<_0x20a20d[_0xe00e('0x6f')];_0x52846+=0x1){_0x5125ad[_0xe00e('0x8d')]({'membername':_0x2ffc23['name'],'UserId':_0x2ffc23['id'],'queue_name':_0x20a20d[_0x52846][_0xe00e('0x3d')],'VoiceQueueId':_0x20a20d[_0x52846]['id'],'interface':_['isNil'](_0x2ffc23['interface'])?util[_0xe00e('0xb1')](_0xe00e('0xb2'),_0x2ffc23[_0xe00e('0x3d')]):_0x2ffc23[_0xe00e('0xa4')],'paused':_0x2ffc23[_0xe00e('0xa3')]||![],'penalty':_0x25c6f0[_0xe00e('0x61')]['penalty']||0x0});}return BPromise['each'](_0x5125ad,function(_0x1fa1ac){return db[_0xe00e('0xb3')][_0xe00e('0xb4')](_0x1fa1ac);});}return _0x462457;});}})['then'](respondWithStatusCode(_0x367a30,null))[_0xe00e('0x25')](handleError(_0x367a30,null));};exports[_0xe00e('0xb5')]=function(_0x3032df,_0x488874,_0x46f27e){var _0x1a9fbb;return db['User']['find']({'where':{'id':_0x3032df[_0xe00e('0x5c')]['id']},'attributes':['id',_0xe00e('0x3d'),_0xe00e('0x31')]})[_0xe00e('0x2f')](handleEntityNotFound(_0x488874,null))[_0xe00e('0x2f')](function(_0x515928){if(_0x515928){_0x1a9fbb=_0x515928;if(!_0x3032df[_0xe00e('0x47')][_0xe00e('0xb6')]||!utils[_0xe00e('0xa5')](_0x3032df[_0xe00e('0x47')][_0xe00e('0xb6')])){throw new db[(_0xe00e('0x96'))][(_0xe00e('0x98'))](_0xe00e('0xa6'));}return _0x515928[_0xe00e('0xb7')+_['capitalize'](_0x3032df['query'][_0xe00e('0xb6')][_0xe00e('0xa8')]())+'Queues'](_0x3032df[_0xe00e('0x47')]['ids']);}})[_0xe00e('0x2f')](function(_0x4d90e3){for(var _0x30d0ff=0x0;_0x30d0ff<_0x3032df[_0xe00e('0x47')][_0xe00e('0x64')]['length'];_0x30d0ff+=0x1){var _0x2df802={'UserId':_0x3032df[_0xe00e('0x5c')]['id']};_0x2df802[_['capitalize'](_0x3032df[_0xe00e('0x47')][_0xe00e('0xb6')]['toLowerCase']())+_0xe00e('0xb8')]=_0x3032df['query'][_0xe00e('0x64')][_0x30d0ff];socket[_0xe00e('0xad')](_0xe00e('0x32')+_[_0xe00e('0xac')](_0x3032df[_0xe00e('0x47')][_0xe00e('0xb6')][_0xe00e('0xa8')]())+'Queue:remove',_0x2df802);}return _0x4d90e3;})['then'](function(){if(_0x3032df[_0xe00e('0x47')][_0xe00e('0xb6')]===_0xe00e('0xaf')){return db[_0xe00e('0xb3')][_0xe00e('0x30')]({'where':{'UserId':_0x3032df[_0xe00e('0x5c')]['id'],'VoiceQueueId':_0x3032df[_0xe00e('0x47')][_0xe00e('0x64')]},'individualHooks':!![]})[_0xe00e('0x2f')](function(){return _0x1a9fbb;});}return _0x1a9fbb;})[_0xe00e('0x2f')](respondWithStatusCode(_0x488874,null))[_0xe00e('0x25')](handleError(_0x488874,null));};exports['addAvatar']=function(_0x1f3f2b,_0x225531,_0x42cf65){_0x1f3f2b[_0xe00e('0x61')][_0xe00e('0xb9')]=_0x1f3f2b['file'][_0xe00e('0xba')];return db[_0xe00e('0x40')]['find']({'where':{'id':_0x1f3f2b[_0xe00e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x225531,null))[_0xe00e('0x2f')](saveUpdates(_0x1f3f2b[_0xe00e('0x61')],null))['then'](respondWithResult(_0x225531,null))['catch'](handleError(_0x225531,null));};exports[_0xe00e('0xbb')]=function(_0x3db4b9,_0x6503ef,_0x111844){var _0x531540=path[_0xe00e('0xbc')](config['root'],_0xe00e('0xbd'));return db[_0xe00e('0x40')][_0xe00e('0x3a')]({'where':{'id':_0x3db4b9['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0xe00e('0x2f')](handleEntityNotFound(_0x6503ef,null))[_0xe00e('0x2f')](function(_0x323c60){if(_0x323c60){if(_[_0xe00e('0x6b')](_0x323c60[_0xe00e('0xb9')])){return _0x6503ef[_0xe00e('0xbe')](_0x531540);}else{if(!fs[_0xe00e('0xbf')](path[_0xe00e('0xbc')](config[_0xe00e('0xc0')],'server/files/images/',_0x323c60['userpic']))){return _0x6503ef[_0xe00e('0xbe')](_0x531540);}return _0x6503ef['download'](path['join'](config[_0xe00e('0xc0')],_0xe00e('0xc1'),_0x323c60[_0xe00e('0xb9')]));}}})[_0xe00e('0x25')](handleError(_0x6503ef,null));};exports['getContacts']=function(_0x1ca571,_0x3d6b38,_0xb34161){var _0x596005={};var _0x3a359a={};var _0x249431;var _0x53893c;return db['User'][_0xe00e('0x9b')]({'where':{'id':_0x1ca571[_0xe00e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3d6b38,null))[_0xe00e('0x2f')](function(_0x513ce9){if(_0x513ce9){_0x249431=_0x513ce9;_0x3a359a[_0xe00e('0x45')]=_['keys'](db[_0xe00e('0xc2')][_0xe00e('0x41')]);_0x3a359a[_0xe00e('0x47')]=_[_0xe00e('0x48')](_0x1ca571[_0xe00e('0x47')]);_0x3a359a[_0xe00e('0x49')]=_[_0xe00e('0x5f')](_0x3a359a[_0xe00e('0x45')],_0x3a359a[_0xe00e('0x47')]);_0x596005[_0xe00e('0x4a')]=_[_0xe00e('0x5f')](_0x3a359a[_0xe00e('0x45')],qs[_0xe00e('0x4b')](_0x1ca571[_0xe00e('0x47')][_0xe00e('0x4b')]));_0x596005[_0xe00e('0x4a')]=_0x596005['attributes'][_0xe00e('0x6f')]?_0x596005[_0xe00e('0x4a')]:_0x3a359a['model'];_0x596005[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x1ca571[_0xe00e('0x47')][_0xe00e('0x4e')]);_0x596005[_0xe00e('0x4f')]=qs['filters'](_[_0xe00e('0x50')](_0x1ca571[_0xe00e('0x47')],_0x3a359a[_0xe00e('0x49')]));if(_0x1ca571[_0xe00e('0x47')][_0xe00e('0x35')]){_0x596005[_0xe00e('0x4f')]=_[_0xe00e('0x51')](_0x596005['where'],{'$or':_['map'](_0x596005[_0xe00e('0x4a')],function(_0x31ce4b){var _0x35592c={};_0x35592c[_0x31ce4b]={'$like':'%'+_0x1ca571['query'][_0xe00e('0x35')]+'%'};return _0x35592c;})});}_0x596005=_[_0xe00e('0x51')]({},_0x596005,_0x1ca571['options']);return _0x249431[_0xe00e('0xc4')](_0x596005);}})[_0xe00e('0x2f')](function(_0x114022){if(_0x114022){_0x53893c=_0x114022['length'];if(_0x1ca571[_0xe00e('0x47')]['hasOwnProperty']('includeAll')){_0x596005[_0xe00e('0x59')]=[{'model':db[_0xe00e('0xc5')],'as':'List','required':![]},{'model':db['Tag'],'as':_0xe00e('0xc6'),'attributes':['id',_0xe00e('0x3d'),_0xe00e('0xc7')],'where':_0x1ca571[_0xe00e('0x47')][_0xe00e('0xc8')]?{'id':_0x1ca571[_0xe00e('0x47')][_0xe00e('0xc8')]}:undefined,'required':_0x1ca571['query'][_0xe00e('0xc8')]?!![]:![]}];}if(!_0x1ca571[_0xe00e('0x47')][_0xe00e('0x4c')](_0xe00e('0x4d'))){_0x596005[_0xe00e('0x2a')]=qs[_0xe00e('0x2a')](_0x1ca571[_0xe00e('0x47')][_0xe00e('0x2a')]);_0x596005[_0xe00e('0x29')]=qs[_0xe00e('0x29')](_0x1ca571[_0xe00e('0x47')][_0xe00e('0x29')]);}return _0x249431[_0xe00e('0xc4')](_0x596005);}})[_0xe00e('0x2f')](function(_0x34b39f){if(_0x34b39f){return _0x34b39f?{'count':_0x53893c,'rows':_0x34b39f}:null;}})[_0xe00e('0x2f')](respondWithResult(_0x3d6b38,null))[_0xe00e('0x25')](handleError(_0x3d6b38,null));};exports['getQueues']=function(_0x11fa3a,_0xce230d,_0x12cd25){var _0x375477;var _0x5ae627;var _0x32f2e8={};var _0x3805de;return db[_0xe00e('0x40')]['findOne']({'where':{'id':_0x11fa3a[_0xe00e('0x5c')]['id']},'attributes':['id',_0xe00e('0x3d'),'role']})[_0xe00e('0x2f')](handleEntityNotFound(_0xce230d,null))['then'](function(_0x4028fa){if(!utils[_0xe00e('0xa5')](_0x11fa3a[_0xe00e('0x47')][_0xe00e('0xb6')])){throw new db[(_0xe00e('0x96'))][(_0xe00e('0x98'))](_0xe00e('0xa6'));}_0x375477=_0x4028fa;var _0x20ea13={};_0x20ea13['model']=_[_0xe00e('0x48')](db[_[_0xe00e('0xac')](_0x11fa3a[_0xe00e('0x47')][_0xe00e('0xb6')])+'Queue']['rawAttributes']);_0x20ea13[_0xe00e('0x47')]=_[_0xe00e('0x48')](_0x11fa3a['query']);_0x20ea13[_0xe00e('0x49')]=_[_0xe00e('0x5f')](_0x20ea13[_0xe00e('0x45')],_0x20ea13[_0xe00e('0x47')]);_0x32f2e8[_0xe00e('0x4a')]=_[_0xe00e('0x5f')](_0x20ea13[_0xe00e('0x45')],qs['fields'](_0x11fa3a['query']['fields']));_0x32f2e8[_0xe00e('0x4a')]=_0x32f2e8['attributes'][_0xe00e('0x6f')]?_0x32f2e8[_0xe00e('0x4a')]:_0x20ea13[_0xe00e('0x45')];_0x32f2e8[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x11fa3a[_0xe00e('0x47')][_0xe00e('0x4e')]);_0x32f2e8[_0xe00e('0x4f')]=qs[_0xe00e('0x49')](_[_0xe00e('0x50')](_0x11fa3a[_0xe00e('0x47')],_0x20ea13['filters']));if(_0x11fa3a[_0xe00e('0x47')]['filter']){_0x32f2e8[_0xe00e('0x4f')]=_[_0xe00e('0x51')](_0x32f2e8['where'],{'$or':_[_0xe00e('0x37')](_0x32f2e8[_0xe00e('0x4a')],function(_0x27d83e){var _0x30cf59={};_0x30cf59[_0x27d83e]={'$like':'%'+_0x11fa3a[_0xe00e('0x47')][_0xe00e('0x35')]+'%'};return _0x30cf59;})});}_0x32f2e8=_[_0xe00e('0x51')]({},_0x32f2e8,_0x11fa3a['options']);switch(_0x375477['role']){case _0xe00e('0x82'):return db[_[_0xe00e('0xac')](_0x11fa3a['query'][_0xe00e('0xb6')])+_0xe00e('0xc9')][_0xe00e('0x90')](_0x32f2e8);case _0xe00e('0x32'):case'agent':return _0x375477[_0xe00e('0xb0')+_[_0xe00e('0xac')](_0x11fa3a[_0xe00e('0x47')][_0xe00e('0xb6')])+'Queues'](_0x32f2e8);default:throw new db['Sequelize'][(_0xe00e('0x98'))](_0xe00e('0xca'));}})[_0xe00e('0x2f')](function(_0x5654a8){_0x3805de=_0x5654a8[_0xe00e('0x6f')];if(!_0x11fa3a[_0xe00e('0x47')][_0xe00e('0x4c')](_0xe00e('0x4d'))){_0x32f2e8[_0xe00e('0x2a')]=qs[_0xe00e('0x2a')](_0x11fa3a[_0xe00e('0x47')][_0xe00e('0x2a')]);_0x32f2e8[_0xe00e('0x29')]=qs[_0xe00e('0x29')](_0x11fa3a['query'][_0xe00e('0x29')]);}switch(_0x375477[_0xe00e('0x31')]){case _0xe00e('0x82'):return db[_[_0xe00e('0xac')](_0x11fa3a['query'][_0xe00e('0xb6')])+_0xe00e('0xc9')][_0xe00e('0x90')](_0x32f2e8);case _0xe00e('0x32'):case _0xe00e('0x75'):return _0x375477[_0xe00e('0xb0')+_[_0xe00e('0xac')](_0x11fa3a['query'][_0xe00e('0xb6')])+_0xe00e('0xa9')](_0x32f2e8);}})[_0xe00e('0x2f')](function(_0x4ca1fc){return{'count':_0x3805de,'rows':_0x4ca1fc};})['then'](respondWithResult(_0xce230d,null))[_0xe00e('0x25')](handleError(_0xce230d,null));};exports[_0xe00e('0xcb')]=function(_0x4fc1d4,_0xd2ee9,_0x4b189a){var _0x490192={};var _0x120264={};var _0x48c30f;var _0x2f9f52;return db[_0xe00e('0x40')][_0xe00e('0x9b')]({'where':{'id':_0x4fc1d4[_0xe00e('0x5c')]['id']}})[_0xe00e('0x2f')](handleEntityNotFound(_0xd2ee9,null))[_0xe00e('0x2f')](function(_0x2c98b1){if(_0x2c98b1){_0x48c30f=_0x2c98b1;_0x120264[_0xe00e('0x45')]=_[_0xe00e('0x48')](db[_0xe00e('0xb3')][_0xe00e('0x41')]);_0x120264[_0xe00e('0x47')]=_['keys'](_0x4fc1d4[_0xe00e('0x47')]);_0x120264[_0xe00e('0x49')]=_[_0xe00e('0x5f')](_0x120264[_0xe00e('0x45')],_0x120264[_0xe00e('0x47')]);_0x490192[_0xe00e('0x4a')]=_[_0xe00e('0x5f')](_0x120264[_0xe00e('0x45')],qs['fields'](_0x4fc1d4[_0xe00e('0x47')][_0xe00e('0x4b')]));_0x490192['attributes']=_0x490192[_0xe00e('0x4a')][_0xe00e('0x6f')]?_0x490192[_0xe00e('0x4a')]:_0x120264[_0xe00e('0x45')];_0x490192[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x4fc1d4['query'][_0xe00e('0x4e')]);_0x490192['where']=qs[_0xe00e('0x49')](_[_0xe00e('0x50')](_0x4fc1d4['query'],_0x120264[_0xe00e('0x49')]));if(_0x4fc1d4['query'][_0xe00e('0x35')]){_0x490192['where']=_[_0xe00e('0x51')](_0x490192['where'],{'$or':_['map'](_0x490192[_0xe00e('0x4a')],function(_0x4bee01){var _0x1309c3={};_0x1309c3[_0x4bee01]={'$like':'%'+_0x4fc1d4[_0xe00e('0x47')][_0xe00e('0x35')]+'%'};return _0x1309c3;})});}_0x490192=_['merge']({},_0x490192,_0x4fc1d4[_0xe00e('0x56')]);return _0x48c30f[_0xe00e('0xcb')](_0x490192);}})['then'](function(_0x5ce4cc){if(_0x5ce4cc){_0x2f9f52=_0x5ce4cc[_0xe00e('0x6f')];if(!_0x4fc1d4['query'][_0xe00e('0x4c')]('nolimit')){_0x490192[_0xe00e('0x2a')]=qs[_0xe00e('0x2a')](_0x4fc1d4['query'][_0xe00e('0x2a')]);_0x490192[_0xe00e('0x29')]=qs[_0xe00e('0x29')](_0x4fc1d4[_0xe00e('0x47')][_0xe00e('0x29')]);}return _0x48c30f[_0xe00e('0xcb')](_0x490192);}})[_0xe00e('0x2f')](function(_0x14675c){if(_0x14675c){return _0x14675c?{'count':_0x2f9f52,'rows':_0x14675c}:null;}})[_0xe00e('0x2f')](respondWithResult(_0xd2ee9,null))[_0xe00e('0x25')](handleError(_0xd2ee9,null));};exports[_0xe00e('0xcc')]=function(_0x3dbaf6,_0x326839,_0x56c446){var _0x322dfe={};var _0x9664a1={};var _0x36137d;var _0x464ee4;return db['User']['findOne']({'where':{'id':_0x3dbaf6[_0xe00e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x326839,null))[_0xe00e('0x2f')](function(_0x1e715d){if(_0x1e715d){_0x36137d=_0x1e715d;_0x9664a1[_0xe00e('0x45')]=_[_0xe00e('0x48')](db['ChatGroup'][_0xe00e('0x41')]);_0x9664a1['query']=_[_0xe00e('0x48')](_0x3dbaf6['query']);_0x9664a1[_0xe00e('0x49')]=_[_0xe00e('0x5f')](_0x9664a1['model'],_0x9664a1[_0xe00e('0x47')]);_0x322dfe[_0xe00e('0x4a')]=_[_0xe00e('0x5f')](_0x9664a1['model'],qs[_0xe00e('0x4b')](_0x3dbaf6[_0xe00e('0x47')][_0xe00e('0x4b')]));_0x322dfe[_0xe00e('0x4a')]=_0x322dfe[_0xe00e('0x4a')][_0xe00e('0x6f')]?_0x322dfe['attributes']:_0x9664a1[_0xe00e('0x45')];_0x322dfe[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x3dbaf6['query'][_0xe00e('0x4e')]);_0x322dfe[_0xe00e('0x4f')]=qs[_0xe00e('0x49')](_[_0xe00e('0x50')](_0x3dbaf6[_0xe00e('0x47')],_0x9664a1[_0xe00e('0x49')]));if(_0x3dbaf6[_0xe00e('0x47')]['filter']){_0x322dfe[_0xe00e('0x4f')]=_[_0xe00e('0x51')](_0x322dfe['where'],{'$or':_[_0xe00e('0x37')](_0x322dfe[_0xe00e('0x4a')],function(_0x1827a9){var _0x58f7b4={};_0x58f7b4[_0x1827a9]={'$like':'%'+_0x3dbaf6[_0xe00e('0x47')]['filter']+'%'};return _0x58f7b4;})});}_0x322dfe=_[_0xe00e('0x51')]({},_0x322dfe,_0x3dbaf6[_0xe00e('0x56')]);return _0x36137d[_0xe00e('0xcc')](_0x322dfe);}})[_0xe00e('0x2f')](function(_0xa1b16a){if(_0xa1b16a){_0x464ee4=_0xa1b16a[_0xe00e('0x6f')];if(!_0x3dbaf6['query']['hasOwnProperty']('nolimit')){_0x322dfe[_0xe00e('0x2a')]=qs[_0xe00e('0x2a')](_0x3dbaf6[_0xe00e('0x47')][_0xe00e('0x2a')]);_0x322dfe[_0xe00e('0x29')]=qs[_0xe00e('0x29')](_0x3dbaf6[_0xe00e('0x47')][_0xe00e('0x29')]);}return _0x36137d[_0xe00e('0xcc')](_0x322dfe);}})[_0xe00e('0x2f')](function(_0x374f1b){if(_0x374f1b){return _0x374f1b?{'count':_0x464ee4,'rows':_0x374f1b}:null;}})[_0xe00e('0x2f')](respondWithResult(_0x326839,null))[_0xe00e('0x25')](handleError(_0x326839,null));};exports[_0xe00e('0xcd')]=function(_0x4f97e8,_0x4bcd0f,_0x406824){var _0xc5ce01={'raw':!![],'where':{}};var _0x54b99f={};var _0x1200ec={'count':0x0,'rows':[]};return db['User'][_0xe00e('0x9b')]({'where':{'id':_0x4f97e8[_0xe00e('0x5c')]['id']}})[_0xe00e('0x2f')](handleEntityNotFound(_0x4bcd0f,null))[_0xe00e('0x2f')](function(_0x243853){if(_0x243853){_0x54b99f['model']=_['keys'](db[_0xe00e('0xce')]['rawAttributes']);_0x54b99f[_0xe00e('0x47')]=_[_0xe00e('0x48')](_0x4f97e8[_0xe00e('0x47')]);_0x54b99f[_0xe00e('0x49')]=_[_0xe00e('0x5f')](_0x54b99f[_0xe00e('0x45')],_0x54b99f[_0xe00e('0x47')]);_0xc5ce01[_0xe00e('0x4a')]=_[_0xe00e('0x5f')](_0x54b99f[_0xe00e('0x45')],qs['fields'](_0x4f97e8[_0xe00e('0x47')][_0xe00e('0x4b')]));_0xc5ce01[_0xe00e('0x4a')]=_0xc5ce01['attributes'][_0xe00e('0x6f')]?_0xc5ce01[_0xe00e('0x4a')]:_0x54b99f['model'];if(!_0x4f97e8[_0xe00e('0x47')]['hasOwnProperty'](_0xe00e('0x4d'))){_0xc5ce01[_0xe00e('0x2a')]=qs[_0xe00e('0x2a')](_0x4f97e8[_0xe00e('0x47')][_0xe00e('0x2a')]);_0xc5ce01[_0xe00e('0x29')]=qs[_0xe00e('0x29')](_0x4f97e8[_0xe00e('0x47')]['offset']);}_0xc5ce01[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x4f97e8[_0xe00e('0x47')][_0xe00e('0x4e')]);_0xc5ce01[_0xe00e('0x4f')]=qs[_0xe00e('0x49')](_[_0xe00e('0x50')](_0x4f97e8['query'],_0x54b99f[_0xe00e('0x49')]));_0xc5ce01[_0xe00e('0x4f')][_0xe00e('0xcf')]=_0x243853['id'];if(_0x4f97e8[_0xe00e('0x47')][_0xe00e('0x35')]){_0xc5ce01[_0xe00e('0x4f')]=_['merge'](_0xc5ce01[_0xe00e('0x4f')],{'$or':_[_0xe00e('0x37')](_0xc5ce01['attributes'],function(_0x348303){var _0x33e1c2={};_0x33e1c2[_0x348303]={'$like':'%'+_0x4f97e8[_0xe00e('0x47')][_0xe00e('0x35')]+'%'};return _0x33e1c2;})});}_0xc5ce01=_['merge']({},_0xc5ce01,_0x4f97e8['options']);return db[_0xe00e('0xce')]['count']({'where':_0xc5ce01['where']})['then'](function(_0x455c23){_0x1200ec[_0xe00e('0x57')]=_0x455c23;if(_0x4f97e8[_0xe00e('0x47')][_0xe00e('0x58')]){_0xc5ce01[_0xe00e('0x59')]=[{'all':!![]}];}return db[_0xe00e('0xce')]['findAll'](_0xc5ce01);})['then'](function(_0xd0c651){_0x1200ec[_0xe00e('0x5a')]=_0xd0c651;return _0x1200ec;});}})[_0xe00e('0x2f')](respondWithFilteredResult(_0x4bcd0f,_0xc5ce01))[_0xe00e('0x25')](handleError(_0x4bcd0f,null));};exports[_0xe00e('0xd0')]=function(_0x4605c5,_0x2c9ee3,_0x2054c6){var _0x3e8691={'raw':!![],'where':{}};var _0xdc9c11={};var _0x9b3cc4={'count':0x0,'rows':[]};return db[_0xe00e('0x40')]['findOne']({'where':{'id':_0x4605c5['params']['id']}})[_0xe00e('0x2f')](handleEntityNotFound(_0x2c9ee3,null))[_0xe00e('0x2f')](function(_0x29e499){if(_0x29e499){_0xdc9c11[_0xe00e('0x45')]=_[_0xe00e('0x48')](db['ScreenRecording'][_0xe00e('0x41')]);_0xdc9c11['query']=_[_0xe00e('0x48')](_0x4605c5[_0xe00e('0x47')]);_0xdc9c11['filters']=_['intersection'](_0xdc9c11[_0xe00e('0x45')],_0xdc9c11[_0xe00e('0x47')]);_0x3e8691[_0xe00e('0x4a')]=_['intersection'](_0xdc9c11[_0xe00e('0x45')],qs[_0xe00e('0x4b')](_0x4605c5[_0xe00e('0x47')][_0xe00e('0x4b')]));_0x3e8691[_0xe00e('0x4a')]=_0x3e8691[_0xe00e('0x4a')][_0xe00e('0x6f')]?_0x3e8691['attributes']:_0xdc9c11[_0xe00e('0x45')];if(!_0x4605c5[_0xe00e('0x47')][_0xe00e('0x4c')](_0xe00e('0x4d'))){_0x3e8691[_0xe00e('0x2a')]=qs[_0xe00e('0x2a')](_0x4605c5[_0xe00e('0x47')][_0xe00e('0x2a')]);_0x3e8691[_0xe00e('0x29')]=qs[_0xe00e('0x29')](_0x4605c5[_0xe00e('0x47')][_0xe00e('0x29')]);}_0x3e8691[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x4605c5[_0xe00e('0x47')][_0xe00e('0x4e')]);_0x3e8691['where']=qs[_0xe00e('0x49')](_[_0xe00e('0x50')](_0x4605c5['query'],_0xdc9c11['filters']));_0x3e8691[_0xe00e('0x4f')][_0xe00e('0xcf')]=_0x29e499['id'];if(_0x4605c5[_0xe00e('0x47')][_0xe00e('0x35')]){_0x3e8691[_0xe00e('0x4f')]=_[_0xe00e('0x51')](_0x3e8691[_0xe00e('0x4f')],{'$or':_[_0xe00e('0x37')](_0x3e8691[_0xe00e('0x4a')],function(_0x164629){var _0x4c22cd={};_0x4c22cd[_0x164629]={'$like':'%'+_0x4605c5[_0xe00e('0x47')][_0xe00e('0x35')]+'%'};return _0x4c22cd;})});}_0x3e8691=_[_0xe00e('0x51')]({},_0x3e8691,_0x4605c5[_0xe00e('0x56')]);return db['ScreenRecording'][_0xe00e('0x57')]({'where':_0x3e8691[_0xe00e('0x4f')]})[_0xe00e('0x2f')](function(_0x47e6f9){_0x9b3cc4[_0xe00e('0x57')]=_0x47e6f9;if(_0x4605c5['query'][_0xe00e('0x58')]){_0x3e8691[_0xe00e('0x59')]=[{'all':!![]}];}return db[_0xe00e('0xd1')][_0xe00e('0x90')](_0x3e8691);})[_0xe00e('0x2f')](function(_0x39da28){_0x9b3cc4[_0xe00e('0x5a')]=_0x39da28;return _0x9b3cc4;});}})[_0xe00e('0x2f')](respondWithFilteredResult(_0x2c9ee3,_0x3e8691))[_0xe00e('0x25')](handleError(_0x2c9ee3,null));};exports[_0xe00e('0xd2')]=function(_0x541282,_0x566a29,_0x748710){var _0x1c9457={};var _0x2ac48e={};var _0x28f4c2;var _0x63debd;return db[_0xe00e('0x40')][_0xe00e('0x9b')]({'where':{'id':_0x541282[_0xe00e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x566a29,null))[_0xe00e('0x2f')](function(_0x5c57be){if(_0x5c57be){_0x28f4c2=_0x5c57be;_0x2ac48e[_0xe00e('0x45')]=_[_0xe00e('0x48')](db[_0xe00e('0xd3')][_0xe00e('0x41')]);_0x2ac48e[_0xe00e('0x47')]=_[_0xe00e('0x48')](_0x541282[_0xe00e('0x47')]);_0x2ac48e['filters']=_[_0xe00e('0x5f')](_0x2ac48e[_0xe00e('0x45')],_0x2ac48e[_0xe00e('0x47')]);_0x1c9457[_0xe00e('0x4a')]=_[_0xe00e('0x5f')](_0x2ac48e[_0xe00e('0x45')],qs[_0xe00e('0x4b')](_0x541282[_0xe00e('0x47')][_0xe00e('0x4b')]));_0x1c9457[_0xe00e('0x4a')]=_0x1c9457[_0xe00e('0x4a')]['length']?_0x1c9457[_0xe00e('0x4a')]:_0x2ac48e['model'];_0x1c9457[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x541282['query']['sort']);_0x1c9457[_0xe00e('0x4f')]=qs['filters'](_['pick'](_0x541282[_0xe00e('0x47')],_0x2ac48e[_0xe00e('0x49')]));if(_0x541282['query'][_0xe00e('0x35')]){_0x1c9457[_0xe00e('0x4f')]=_[_0xe00e('0x51')](_0x1c9457[_0xe00e('0x4f')],{'$or':_['map'](_0x1c9457[_0xe00e('0x4a')],function(_0x1f0b26){var _0x366eb5={};_0x366eb5[_0x1f0b26]={'$like':'%'+_0x541282[_0xe00e('0x47')]['filter']+'%'};return _0x366eb5;})});}_0x1c9457=_['merge']({},_0x1c9457,_0x541282[_0xe00e('0x56')]);return _0x28f4c2['getChatInteractions'](_0x1c9457);}})[_0xe00e('0x2f')](function(_0x84c2e5){if(_0x84c2e5){_0x63debd=_0x84c2e5['length'];if(!_0x541282[_0xe00e('0x47')][_0xe00e('0x4c')](_0xe00e('0x4d'))){_0x1c9457[_0xe00e('0x2a')]=qs[_0xe00e('0x2a')](_0x541282[_0xe00e('0x47')][_0xe00e('0x2a')]);_0x1c9457['offset']=qs[_0xe00e('0x29')](_0x541282[_0xe00e('0x47')][_0xe00e('0x29')]);}return _0x28f4c2['getChatInteractions'](_0x1c9457);}})[_0xe00e('0x2f')](function(_0x5f0859){if(_0x5f0859){return _0x5f0859?{'count':_0x63debd,'rows':_0x5f0859}:null;}})[_0xe00e('0x2f')](respondWithResult(_0x566a29,null))[_0xe00e('0x25')](handleError(_0x566a29,null));};exports[_0xe00e('0xd4')]=function(_0x594834,_0x471e98,_0x5da819){var _0x34aa04={};var _0xee8159={};var _0x4f6673;var _0x18cae5;return db['User'][_0xe00e('0x9b')]({'where':{'id':_0x594834[_0xe00e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x471e98,null))['then'](function(_0x2b7261){if(_0x2b7261){_0x4f6673=_0x2b7261;_0xee8159[_0xe00e('0x45')]=_[_0xe00e('0x48')](db[_0xe00e('0xd5')][_0xe00e('0x41')]);_0xee8159[_0xe00e('0x47')]=_['keys'](_0x594834['query']);_0xee8159[_0xe00e('0x49')]=_['intersection'](_0xee8159[_0xe00e('0x45')],_0xee8159[_0xe00e('0x47')]);_0x34aa04['attributes']=_['intersection'](_0xee8159[_0xe00e('0x45')],qs['fields'](_0x594834['query'][_0xe00e('0x4b')]));_0x34aa04[_0xe00e('0x4a')]=_0x34aa04[_0xe00e('0x4a')][_0xe00e('0x6f')]?_0x34aa04[_0xe00e('0x4a')]:_0xee8159[_0xe00e('0x45')];_0x34aa04[_0xe00e('0xc3')]=qs['sort'](_0x594834[_0xe00e('0x47')][_0xe00e('0x4e')]);_0x34aa04[_0xe00e('0x4f')]=qs['filters'](_['pick'](_0x594834['query'],_0xee8159[_0xe00e('0x49')]));if(_0x594834[_0xe00e('0x47')][_0xe00e('0x35')]){_0x34aa04['where']=_['merge'](_0x34aa04['where'],{'$or':_[_0xe00e('0x37')](_0x34aa04[_0xe00e('0x4a')],function(_0x343b0a){var _0xc2e82a={};_0xc2e82a[_0x343b0a]={'$like':'%'+_0x594834['query'][_0xe00e('0x35')]+'%'};return _0xc2e82a;})});}_0x34aa04=_[_0xe00e('0x51')]({},_0x34aa04,_0x594834['options']);return _0x4f6673[_0xe00e('0xd4')](_0x34aa04);}})[_0xe00e('0x2f')](function(_0x519456){if(_0x519456){_0x18cae5=_0x519456[_0xe00e('0x6f')];if(!_0x594834[_0xe00e('0x47')][_0xe00e('0x4c')]('nolimit')){_0x34aa04['limit']=qs['limit'](_0x594834['query']['limit']);_0x34aa04['offset']=qs['offset'](_0x594834[_0xe00e('0x47')]['offset']);}return _0x4f6673[_0xe00e('0xd4')](_0x34aa04);}})[_0xe00e('0x2f')](function(_0x4df472){if(_0x4df472){return _0x4df472?{'count':_0x18cae5,'rows':_0x4df472}:null;}})[_0xe00e('0x2f')](respondWithResult(_0x471e98,null))['catch'](handleError(_0x471e98,null));};exports[_0xe00e('0xd6')]=function(_0x3e153b,_0x262a23,_0x4102e4){var _0xf71bb4={'raw':!![],'where':{}};var _0x4077dd={};var _0x182b2e={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x3e153b[_0xe00e('0x5c')]['id']}})[_0xe00e('0x2f')](handleEntityNotFound(_0x262a23,null))[_0xe00e('0x2f')](function(_0x517f6e){if(_0x517f6e){_0x4077dd[_0xe00e('0x45')]=_[_0xe00e('0x48')](db['MailInteraction'][_0xe00e('0x41')]);_0x4077dd[_0xe00e('0x47')]=_[_0xe00e('0x48')](_0x3e153b['query']);_0x4077dd[_0xe00e('0x49')]=_[_0xe00e('0x5f')](_0x4077dd[_0xe00e('0x45')],_0x4077dd[_0xe00e('0x47')]);_0xf71bb4[_0xe00e('0x4a')]=_[_0xe00e('0x5f')](_0x4077dd['model'],qs[_0xe00e('0x4b')](_0x3e153b[_0xe00e('0x47')]['fields']));_0xf71bb4['attributes']=_0xf71bb4[_0xe00e('0x4a')][_0xe00e('0x6f')]?_0xf71bb4['attributes']:_0x4077dd[_0xe00e('0x45')];if(!_0x3e153b[_0xe00e('0x47')]['hasOwnProperty']('nolimit')){_0xf71bb4[_0xe00e('0x2a')]=qs['limit'](_0x3e153b[_0xe00e('0x47')][_0xe00e('0x2a')]);_0xf71bb4[_0xe00e('0x29')]=qs['offset'](_0x3e153b[_0xe00e('0x47')]['offset']);}_0xf71bb4[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x3e153b[_0xe00e('0x47')]['sort']);_0xf71bb4[_0xe00e('0x4f')]=qs[_0xe00e('0x49')](_['pick'](_0x3e153b[_0xe00e('0x47')],_0x4077dd['filters']));_0xf71bb4[_0xe00e('0x4f')][_0xe00e('0xcf')]=_0x517f6e['id'];if(_0x3e153b[_0xe00e('0x47')][_0xe00e('0x35')]){_0xf71bb4[_0xe00e('0x4f')]=_[_0xe00e('0x51')](_0xf71bb4['where'],{'$or':_[_0xe00e('0x37')](_0xf71bb4[_0xe00e('0x4a')],function(_0x4f62cc){var _0x18c4b4={};_0x18c4b4[_0x4f62cc]={'$like':'%'+_0x3e153b[_0xe00e('0x47')][_0xe00e('0x35')]+'%'};return _0x18c4b4;})});}_0xf71bb4=_[_0xe00e('0x51')]({},_0xf71bb4,_0x3e153b[_0xe00e('0x56')]);return db[_0xe00e('0xd7')][_0xe00e('0x57')]({'where':_0xf71bb4['where']})[_0xe00e('0x2f')](function(_0x106d42){_0x182b2e['count']=_0x106d42;if(_0x3e153b['query'][_0xe00e('0x58')]){_0xf71bb4[_0xe00e('0x59')]=[{'all':!![]}];}return db[_0xe00e('0xd7')][_0xe00e('0x90')](_0xf71bb4);})['then'](function(_0x46489d){_0x182b2e['rows']=_0x46489d;return _0x182b2e;});}})[_0xe00e('0x2f')](respondWithFilteredResult(_0x262a23,_0xf71bb4))[_0xe00e('0x25')](handleError(_0x262a23,null));};exports['getSmsInteractions']=function(_0x574696,_0x32e9d,_0x4ee258){var _0x4cb813={};var _0x154dab={};var _0xf311;var _0x41897a;return db['User']['findOne']({'where':{'id':_0x574696[_0xe00e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x32e9d,null))[_0xe00e('0x2f')](function(_0x593972){if(_0x593972){_0xf311=_0x593972;_0x154dab[_0xe00e('0x45')]=_[_0xe00e('0x48')](db[_0xe00e('0xd8')]['rawAttributes']);_0x154dab[_0xe00e('0x47')]=_[_0xe00e('0x48')](_0x574696[_0xe00e('0x47')]);_0x154dab[_0xe00e('0x49')]=_[_0xe00e('0x5f')](_0x154dab[_0xe00e('0x45')],_0x154dab[_0xe00e('0x47')]);_0x4cb813['attributes']=_['intersection'](_0x154dab[_0xe00e('0x45')],qs[_0xe00e('0x4b')](_0x574696['query']['fields']));_0x4cb813['attributes']=_0x4cb813[_0xe00e('0x4a')][_0xe00e('0x6f')]?_0x4cb813[_0xe00e('0x4a')]:_0x154dab[_0xe00e('0x45')];_0x4cb813[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x574696[_0xe00e('0x47')]['sort']);_0x4cb813[_0xe00e('0x4f')]=qs[_0xe00e('0x49')](_[_0xe00e('0x50')](_0x574696['query'],_0x154dab[_0xe00e('0x49')]));if(_0x574696['query'][_0xe00e('0x35')]){_0x4cb813[_0xe00e('0x4f')]=_[_0xe00e('0x51')](_0x4cb813['where'],{'$or':_['map'](_0x4cb813[_0xe00e('0x4a')],function(_0x1c19b5){var _0x568c09={};_0x568c09[_0x1c19b5]={'$like':'%'+_0x574696[_0xe00e('0x47')][_0xe00e('0x35')]+'%'};return _0x568c09;})});}_0x4cb813=_[_0xe00e('0x51')]({},_0x4cb813,_0x574696[_0xe00e('0x56')]);return _0xf311[_0xe00e('0xd9')](_0x4cb813);}})['then'](function(_0x206443){if(_0x206443){_0x41897a=_0x206443[_0xe00e('0x6f')];if(!_0x574696[_0xe00e('0x47')][_0xe00e('0x4c')](_0xe00e('0x4d'))){_0x4cb813[_0xe00e('0x2a')]=qs[_0xe00e('0x2a')](_0x574696[_0xe00e('0x47')][_0xe00e('0x2a')]);_0x4cb813['offset']=qs[_0xe00e('0x29')](_0x574696['query'][_0xe00e('0x29')]);}return _0xf311[_0xe00e('0xd9')](_0x4cb813);}})[_0xe00e('0x2f')](function(_0x8c0936){if(_0x8c0936){return _0x8c0936?{'count':_0x41897a,'rows':_0x8c0936}:null;}})[_0xe00e('0x2f')](respondWithResult(_0x32e9d,null))[_0xe00e('0x25')](handleError(_0x32e9d,null));};exports[_0xe00e('0xda')]=function(_0x1b301e,_0x1d0ec8,_0x3975a9){var _0x203a7c={};var _0x4e09da={};var _0x298874;var _0x2b55c1;return db['User'][_0xe00e('0x9b')]({'where':{'id':_0x1b301e[_0xe00e('0x5c')]['id']}})[_0xe00e('0x2f')](handleEntityNotFound(_0x1d0ec8,null))['then'](function(_0x2a7a04){if(_0x2a7a04){_0x298874=_0x2a7a04;_0x4e09da[_0xe00e('0x45')]=_[_0xe00e('0x48')](db[_0xe00e('0xdb')]['rawAttributes']);_0x4e09da['query']=_[_0xe00e('0x48')](_0x1b301e[_0xe00e('0x47')]);_0x4e09da[_0xe00e('0x49')]=_[_0xe00e('0x5f')](_0x4e09da[_0xe00e('0x45')],_0x4e09da[_0xe00e('0x47')]);_0x203a7c[_0xe00e('0x4a')]=_[_0xe00e('0x5f')](_0x4e09da[_0xe00e('0x45')],qs['fields'](_0x1b301e[_0xe00e('0x47')][_0xe00e('0x4b')]));_0x203a7c[_0xe00e('0x4a')]=_0x203a7c[_0xe00e('0x4a')]['length']?_0x203a7c[_0xe00e('0x4a')]:_0x4e09da[_0xe00e('0x45')];_0x203a7c[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x1b301e[_0xe00e('0x47')]['sort']);_0x203a7c[_0xe00e('0x4f')]=qs[_0xe00e('0x49')](_[_0xe00e('0x50')](_0x1b301e[_0xe00e('0x47')],_0x4e09da[_0xe00e('0x49')]));if(_0x1b301e[_0xe00e('0x47')][_0xe00e('0x35')]){_0x203a7c[_0xe00e('0x4f')]=_[_0xe00e('0x51')](_0x203a7c[_0xe00e('0x4f')],{'$or':_[_0xe00e('0x37')](_0x203a7c['attributes'],function(_0x315889){var _0x2b1cbc={};_0x2b1cbc[_0x315889]={'$like':'%'+_0x1b301e['query'][_0xe00e('0x35')]+'%'};return _0x2b1cbc;})});}_0x203a7c=_[_0xe00e('0x51')]({},_0x203a7c,_0x1b301e[_0xe00e('0x56')]);return _0x298874[_0xe00e('0xda')](_0x203a7c);}})[_0xe00e('0x2f')](function(_0x418510){if(_0x418510){_0x2b55c1=_0x418510[_0xe00e('0x6f')];if(!_0x1b301e[_0xe00e('0x47')][_0xe00e('0x4c')](_0xe00e('0x4d'))){_0x203a7c['limit']=qs[_0xe00e('0x2a')](_0x1b301e[_0xe00e('0x47')][_0xe00e('0x2a')]);_0x203a7c[_0xe00e('0x29')]=qs[_0xe00e('0x29')](_0x1b301e[_0xe00e('0x47')][_0xe00e('0x29')]);}return _0x298874[_0xe00e('0xda')](_0x203a7c);}})[_0xe00e('0x2f')](function(_0x272bb4){if(_0x272bb4){return _0x272bb4?{'count':_0x2b55c1,'rows':_0x272bb4}:null;}})[_0xe00e('0x2f')](respondWithResult(_0x1d0ec8,null))['catch'](handleError(_0x1d0ec8,null));};exports[_0xe00e('0xdc')]=function(_0x48cb5a,_0x3781fd,_0x4c33f0){var _0x356da9={};var _0x17300a={};var _0x26ded5;var _0x1afc46;return db[_0xe00e('0x40')][_0xe00e('0x9b')]({'where':{'id':_0x48cb5a[_0xe00e('0x5c')]['id']}})[_0xe00e('0x2f')](handleEntityNotFound(_0x3781fd,null))[_0xe00e('0x2f')](function(_0x33b78c){if(_0x33b78c){_0x26ded5=_0x33b78c;_0x17300a['model']=_[_0xe00e('0x48')](db[_0xe00e('0xdd')][_0xe00e('0x41')]);_0x17300a[_0xe00e('0x47')]=_[_0xe00e('0x48')](_0x48cb5a[_0xe00e('0x47')]);_0x17300a[_0xe00e('0x49')]=_[_0xe00e('0x5f')](_0x17300a[_0xe00e('0x45')],_0x17300a[_0xe00e('0x47')]);_0x356da9[_0xe00e('0x4a')]=_['intersection'](_0x17300a[_0xe00e('0x45')],qs[_0xe00e('0x4b')](_0x48cb5a[_0xe00e('0x47')][_0xe00e('0x4b')]));_0x356da9[_0xe00e('0x4a')]=_0x356da9['attributes'][_0xe00e('0x6f')]?_0x356da9[_0xe00e('0x4a')]:_0x17300a['model'];_0x356da9[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x48cb5a[_0xe00e('0x47')][_0xe00e('0x4e')]);_0x356da9[_0xe00e('0x4f')]=qs[_0xe00e('0x49')](_[_0xe00e('0x50')](_0x48cb5a[_0xe00e('0x47')],_0x17300a[_0xe00e('0x49')]));if(_0x48cb5a['query']['filter']){_0x356da9['where']=_['merge'](_0x356da9['where'],{'$or':_[_0xe00e('0x37')](_0x356da9[_0xe00e('0x4a')],function(_0x38736d){var _0x328cd3={};_0x328cd3[_0x38736d]={'$like':'%'+_0x48cb5a[_0xe00e('0x47')][_0xe00e('0x35')]+'%'};return _0x328cd3;})});}_0x356da9=_[_0xe00e('0x51')]({},_0x356da9,_0x48cb5a['options']);return _0x26ded5[_0xe00e('0xdc')](_0x356da9);}})[_0xe00e('0x2f')](function(_0x635e32){if(_0x635e32){_0x1afc46=_0x635e32[_0xe00e('0x6f')];if(!_0x48cb5a['query'][_0xe00e('0x4c')](_0xe00e('0x4d'))){_0x356da9[_0xe00e('0x2a')]=qs['limit'](_0x48cb5a[_0xe00e('0x47')]['limit']);_0x356da9[_0xe00e('0x29')]=qs[_0xe00e('0x29')](_0x48cb5a[_0xe00e('0x47')][_0xe00e('0x29')]);}return _0x26ded5[_0xe00e('0xdc')](_0x356da9);}})[_0xe00e('0x2f')](function(_0xff7b9e){if(_0xff7b9e){return _0xff7b9e?{'count':_0x1afc46,'rows':_0xff7b9e}:null;}})[_0xe00e('0x2f')](respondWithResult(_0x3781fd,null))[_0xe00e('0x25')](handleError(_0x3781fd,null));};exports[_0xe00e('0xde')]=function(_0x4e6439,_0x58e5d1,_0x4cdb40){var _0x4d0946;var _0x18cfa3;var _0x1e8ed4;var _0x2264bd=!_[_0xe00e('0x6b')](_0x4e6439[_0xe00e('0x5c')]['id'])?_0x4e6439[_0xe00e('0x5c')]['id']:!_['isNil'](_0x4e6439[_0xe00e('0x32')]['id'])?_0x4e6439[_0xe00e('0x32')]['id']:null;return db[_0xe00e('0x40')][_0xe00e('0x3a')]({'where':{'id':_0x2264bd,'role':{'$or':[_0xe00e('0x82'),_0xe00e('0x32'),_0xe00e('0x75')]}},'attributes':['id',_0xe00e('0x3d'),_0xe00e('0xdf'),'mobile',_0xe00e('0x31'),_0xe00e('0x66'),'loginInPause']})['then'](function(_0x5b8c0f){if(_0x5b8c0f){if(_0x5b8c0f[_0xe00e('0x31')]===_0xe00e('0x75')){_0x4d0946=_0x5b8c0f;if(_0x4e6439[_0xe00e('0x61')][_0xe00e('0xa4')]){_0x1e8ed4=util[_0xe00e('0xb1')]('LOCAL/%s@from-sip/n',_0x4d0946[_0x4e6439[_0xe00e('0x61')][_0xe00e('0xa4')]]);}else if(_0x4e6439['body'][_0xe00e('0xe0')]){_0x1e8ed4=util[_0xe00e('0xb1')](_0xe00e('0xb2'),_0x4e6439[_0xe00e('0x61')]['intrf']);}else{_0x1e8ed4=util[_0xe00e('0xb1')](_0xe00e('0xb2'),_0x4d0946[_0xe00e('0x3d')]);}socket['to'](util[_0xe00e('0xb1')](_0xe00e('0xe1'),_0x4d0946[_0xe00e('0x3d')]))[_0xe00e('0xad')](_0xe00e('0xe2'),{'ip':_0x4e6439[_0xe00e('0xe3')][_0xe00e('0xe4')]||_0x4e6439['connection'][_0xe00e('0xe5')]||_0x4e6439[_0xe00e('0xe6')][_0xe00e('0xe5')]||_0x4e6439[_0xe00e('0xe7')][_0xe00e('0xe6')][_0xe00e('0xe5')]});return db[_0xe00e('0xb3')]['destroy']({'where':{'membername':_0x4d0946[_0xe00e('0x3d')]},'individualHooks':!![]});}}else{throw new db[(_0xe00e('0x96'))][(_0xe00e('0x98'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x4d0946){return _0x4d0946['getVoiceQueues']({'raw':!![]});}})[_0xe00e('0x2f')](function(_0x33f604){if(_0x4d0946){var _0x44af07=[];if(_0x33f604){_0x18cfa3=_0x33f604;if(_0x18cfa3['length']){for(var _0x445a5d=0x0;_0x445a5d<_0x18cfa3[_0xe00e('0x6f')];_0x445a5d++){_0x44af07[_0xe00e('0x8d')]({'membername':_0x4d0946['name'],'UserId':_0x4d0946['id'],'queue_name':_0x18cfa3[_0x445a5d][_0xe00e('0x3d')],'VoiceQueueId':_0x18cfa3[_0x445a5d]['id'],'interface':_0x1e8ed4,'paused':_0x4d0946[_0xe00e('0xa2')]||![],'penalty':_0x18cfa3[_0x445a5d]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0xe00e('0x8f')](_0x44af07,function(_0x4a3d78){return db['UserVoiceQueueRt']['upsert'](_0x4a3d78);});}}}})['then'](function(){if(_0x4d0946){return db[_0xe00e('0xe8')]['findAll']({'where':{'membername':_0x4d0946[_0xe00e('0x3d')],'exitAt':null}});}})['then'](function(_0x478c45){if(_0x4d0946){var _0x4a4aca=[];_0x478c45[_0xe00e('0xe9')](function(_0x454bb4){_0x4a4aca['push'](_0x454bb4[_0xe00e('0x60')]({'exitAt':moment()['format'](_0xe00e('0xea'))}));});return BPromise[_0xe00e('0x8e')](_0x4a4aca);}})[_0xe00e('0x2f')](function(){if(_0x4d0946){var _0x7400cc=[];var _0x894075=[];var _0x3b3a6f=utils[_0xe00e('0xeb')]();var _0x1e250f={'membername':_0x4d0946['name'],'interface':_0x1e8ed4,'enterAt':moment()[_0xe00e('0xb1')](_0xe00e('0xea')),'role':_0x4d0946[_0xe00e('0x31')],'internal':_0x4d0946[_0xe00e('0x66')]};_0x3b3a6f[_0xe00e('0xe9')](function(_0x512b61){_0x7400cc[_0xe00e('0x8d')](_['merge']({'channel':_0x512b61,'type':_0xe00e('0xec'),'data1':_0x4e6439[_0xe00e('0x61')][_0xe00e('0xed')],'data2':_0x1e8ed4},_0x1e250f));if(_0x4d0946[_0xe00e('0xa2')]){_0x894075[_0xe00e('0x8d')](_[_0xe00e('0x51')]({'channel':_0x512b61,'type':_0xe00e('0xee'),'data1':'LOGININPAUSE'},_0x1e250f));}});return db[_0xe00e('0xe8')][_0xe00e('0x8a')](_0x7400cc[_0xe00e('0xef')](_0x894075),{'individualHooks':!![]});}})[_0xe00e('0x2f')](function(){if(_0x4d0946){return _0x4d0946[_0xe00e('0x60')]({'online':!![],'lastLoginAt':moment()[_0xe00e('0xb1')](_0xe00e('0xea')),'voicePause':_0x4d0946[_0xe00e('0xa2')]||![],'mailPause':_0x4d0946[_0xe00e('0xa2')]||![],'chatPause':_0x4d0946['loginInPause']||![],'faxPause':_0x4d0946[_0xe00e('0xa2')]||![],'smsPause':_0x4d0946['loginInPause']||![],'openchannelPause':_0x4d0946[_0xe00e('0xa2')]||![],'whatsappPause':_0x4d0946[_0xe00e('0xa2')]||![],'pauseType':_0x4d0946['loginInPause']?_0xe00e('0xf0'):null,'interface':_0x1e8ed4,'lastPauseAt':moment()[_0xe00e('0xb1')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xe00e('0x2f')](function(_0x5e5f5e){if(_0x4e6439[_0xe00e('0xf1')]){return _0x4cdb40();}else{return BPromise[_0xe00e('0xf2')](_0x5e5f5e)[_0xe00e('0x2f')](respondWithResult(_0x58e5d1,null));}})[_0xe00e('0x25')](handleError(_0x58e5d1,null));};exports['logout']=function(_0x2edd24,_0x58c85d,_0x39f7d2){var _0x3299de;return db[_0xe00e('0x40')]['find']({'where':{'id':_0x2edd24[_0xe00e('0x5c')]['id'],'role':_0xe00e('0x75')},'attributes':['id',_0xe00e('0x3d'),_0xe00e('0x31')]})[_0xe00e('0x2f')](handleEntityNotFound(_0x58c85d,null))[_0xe00e('0x2f')](function(_0x1b7409){if(_0x1b7409){_0x3299de=_0x1b7409;return db['UserVoiceQueueRt'][_0xe00e('0x30')]({'where':{'membername':_0x3299de['name']},'individualHooks':!![]});}})[_0xe00e('0x2f')](function(){return db['MemberReport'][_0xe00e('0x90')]({'where':{'membername':_0x3299de[_0xe00e('0x3d')],'exitAt':null}});})[_0xe00e('0x2f')](function(_0x4201e1){var _0x35aabc=[];_0x4201e1[_0xe00e('0xe9')](function(_0x5cfc9d){_0x35aabc[_0xe00e('0x8d')](_0x5cfc9d[_0xe00e('0x60')]({'exitAt':moment()[_0xe00e('0xb1')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x35aabc);})[_0xe00e('0x2f')](function(){return _0x3299de[_0xe00e('0x60')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xe00e('0x2f')](respondWithResult(_0x58c85d,null))['catch'](handleError(_0x58c85d,null));};exports[_0xe00e('0xf3')]=function(_0x22a3ac,_0x45eb7f,_0x11ccee){var _0x49584d;return db[_0xe00e('0xb3')][_0xe00e('0x60')]({'paused':0x1},{'where':{'UserId':_0x22a3ac['params']['id']},'individualHooks':!![]})[_0xe00e('0x2f')](function(){return db[_0xe00e('0x40')][_0xe00e('0x3a')]({'where':{'id':_0x22a3ac[_0xe00e('0x5c')]['id'],'role':_0xe00e('0x75')},'attributes':['id',_0xe00e('0x3d'),_0xe00e('0x31'),_0xe00e('0x66'),_0xe00e('0xa4')]});})[_0xe00e('0x2f')](handleEntityNotFound(_0x45eb7f,null))[_0xe00e('0x2f')](function(_0x3313d6){if(_0x3313d6){_0x49584d=_0x3313d6;return respondWithRpcPromise('QueuePause',_0xe00e('0xf3'),{'id':_0x49584d['id'],'name':_0x49584d[_0xe00e('0x3d')],'pause':!![]});}})[_0xe00e('0x2f')](function(){if(_0x49584d){return db['MemberReport'][_0xe00e('0x90')]({'where':{'membername':_0x49584d['name'],'type':_0xe00e('0xee'),'exitAt':null}});}})[_0xe00e('0x2f')](function(_0x3e6f1c){if(_0x3e6f1c['length']){var _0x472720=moment()[_0xe00e('0xb1')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x11bfb1=0x0,_0x86f79=_0x3e6f1c[_0xe00e('0x6f')];_0x11bfb1<_0x86f79;_0x11bfb1++){_0x3e6f1c[_0x11bfb1][_0xe00e('0xf4')]({'exitAt':_0x472720});}}})['then'](function(){var _0x4c80c7=[];var _0x48dfb4=utils[_0xe00e('0xeb')]();_0x48dfb4[_0xe00e('0xe9')](function(_0x2d9d12){_0x4c80c7[_0xe00e('0x8d')]({'channel':_0x2d9d12,'membername':_0x49584d[_0xe00e('0x3d')],'interface':_[_0xe00e('0x6b')](_0x49584d['interface'])?util[_0xe00e('0xb1')]('SIP/%s',_0x49584d[_0xe00e('0x3d')]):_0x49584d[_0xe00e('0xa4')],'type':_0xe00e('0xee'),'enterAt':moment()[_0xe00e('0xb1')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x22a3ac[_0xe00e('0x61')]['type']||_0xe00e('0xf5'),'role':_0x49584d[_0xe00e('0x31')],'internal':_0x49584d[_0xe00e('0x66')]});});return db[_0xe00e('0xe8')]['bulkCreate'](_0x4c80c7,{'individualHooks':!![]});})[_0xe00e('0x2f')](function(){return _0x49584d[_0xe00e('0x60')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x22a3ac['body']['type']||_0xe00e('0xf5'),'lastPauseAt':moment()['format'](_0xe00e('0xea'))});})[_0xe00e('0x2f')](respondWithResult(_0x45eb7f,null))[_0xe00e('0x25')](handleError(_0x45eb7f,null));};exports[_0xe00e('0xf6')]=function(_0x4b92ab,_0x5a446b,_0x1824dc){var _0x24005d;return db[_0xe00e('0x40')][_0xe00e('0x3a')]({'where':{'id':_0x4b92ab['params']['id']},'attributes':['id',_0xe00e('0x3d'),_0xe00e('0x31'),_0xe00e('0xa3'),_0xe00e('0xf7'),'chatPause',_0xe00e('0xf8'),_0xe00e('0xf9'),_0xe00e('0xfa'),_0xe00e('0xfb'),'pauseType',_0xe00e('0xfc')]})[_0xe00e('0x2f')](handleEntityNotFound(_0x5a446b,null))[_0xe00e('0x2f')](function(_0x8c276){if(_0x8c276){_0x24005d=_0x8c276;if(_0x4b92ab[_0xe00e('0x61')][_0xe00e('0xb6')]&&!utils['isValidChannel'](_0x4b92ab[_0xe00e('0x61')][_0xe00e('0xb6')])){throw new db[(_0xe00e('0x96'))][(_0xe00e('0x98'))]('Unknown\x20channel');}switch(_0x4b92ab[_0xe00e('0x61')][_0xe00e('0xb6')]){case'voice':return respondWithRpcPromise(_0xe00e('0xfd'),_0xe00e('0xf6'),{'id':_0x24005d['id'],'name':_0x24005d['name'],'pause':![]})[_0xe00e('0x2f')](function(){return db['UserVoiceQueueRt'][_0xe00e('0x60')]({'paused':0x0},{'where':{'UserId':_0x24005d['id']},'individualHooks':!![]});})[_0xe00e('0x2f')](function(){return db['MemberReport'][_0xe00e('0x3a')]({'where':{'channel':_0x4b92ab[_0xe00e('0x61')][_0xe00e('0xb6')],'membername':_0x24005d['name'],'type':_0xe00e('0xee'),'exitAt':null}});})[_0xe00e('0x2f')](function(_0x1ea02e){if(_0x1ea02e){return _0x1ea02e['update']({'exitAt':moment()[_0xe00e('0xb1')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x24005d[_0xe00e('0x60')]({'voicePause':![]});});case _0xe00e('0xfe'):case _0xe00e('0xff'):case _0xe00e('0x100'):case _0xe00e('0x101'):case _0xe00e('0x102'):case _0xe00e('0x103'):return db['MemberReport'][_0xe00e('0x3a')]({'where':{'channel':_0x4b92ab['body'][_0xe00e('0xb6')],'membername':_0x24005d['name'],'type':_0xe00e('0xee'),'exitAt':null}})[_0xe00e('0x2f')](function(_0x3ed27b){if(_0x3ed27b){return _0x3ed27b[_0xe00e('0x60')]({'exitAt':moment()[_0xe00e('0xb1')](_0xe00e('0xea')),'data2':_0xe00e('0x104')},{'individualHooks':!![]});}return null;})[_0xe00e('0x2f')](function(){var _0x2b5ca5={};_[_0xe00e('0x105')](_0x2b5ca5,util[_0xe00e('0xb1')](_0xe00e('0x106'),_0x4b92ab[_0xe00e('0x61')][_0xe00e('0xb6')],_0xe00e('0x107')),![]);return _0x24005d[_0xe00e('0x60')](_0x2b5ca5);});default:return respondWithRpcPromise(_0xe00e('0xfd'),_0xe00e('0xf6'),{'id':_0x24005d['id'],'name':_0x24005d[_0xe00e('0x3d')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0xe00e('0x60')]({'paused':0x0},{'where':{'UserId':_0x24005d['id']}});})[_0xe00e('0x2f')](function(){return db[_0xe00e('0xe8')]['findAll']({'where':{'membername':_0x24005d[_0xe00e('0x3d')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x1d5007){var _0x1650ba=[];_0x1d5007[_0xe00e('0xe9')](function(_0x2929ae){_0x1650ba[_0xe00e('0x8d')](_0x2929ae[_0xe00e('0x60')]({'exitAt':moment()[_0xe00e('0xb1')](_0xe00e('0xea')),'data2':'manual'}));});return BPromise['all'](_0x1650ba);})[_0xe00e('0x2f')](function(){return _0x24005d[_0xe00e('0x60')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x5a446b,null))[_0xe00e('0x25')](handleError(_0x5a446b,null));};exports[_0xe00e('0x108')]=function(_0x19451f,_0x1d238c,_0x23999c){var _0x36d813={};var _0x89382b={};var _0x53b983;var _0x1b1016;return db[_0xe00e('0x40')][_0xe00e('0x9b')]({'where':{'id':_0x19451f[_0xe00e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1d238c,null))[_0xe00e('0x2f')](function(_0x171d67){if(_0x171d67){_0x53b983=_0x171d67;_0x89382b[_0xe00e('0x45')]=_[_0xe00e('0x48')](db[_0xe00e('0x109')][_0xe00e('0x41')]);_0x89382b[_0xe00e('0x47')]=_['keys'](_0x19451f['query']);_0x89382b[_0xe00e('0x49')]=_['intersection'](_0x89382b[_0xe00e('0x45')],_0x89382b['query']);_0x36d813['attributes']=_['intersection'](_0x89382b['model'],qs[_0xe00e('0x4b')](_0x19451f[_0xe00e('0x47')]['fields']));_0x36d813[_0xe00e('0x4a')]=_0x36d813['attributes']['length']?_0x36d813[_0xe00e('0x4a')]:_0x89382b[_0xe00e('0x45')];_0x36d813[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x19451f[_0xe00e('0x47')][_0xe00e('0x4e')]);_0x36d813[_0xe00e('0x4f')]=qs['filters'](_[_0xe00e('0x50')](_0x19451f['query'],_0x89382b['filters']));if(_0x19451f[_0xe00e('0x47')][_0xe00e('0x35')]){_0x36d813[_0xe00e('0x4f')]=_[_0xe00e('0x51')](_0x36d813[_0xe00e('0x4f')],{'$or':_[_0xe00e('0x37')](_0x36d813['attributes'],function(_0x311f5f){var _0x311f00={};_0x311f00[_0x311f5f]={'$like':'%'+_0x19451f[_0xe00e('0x47')]['filter']+'%'};return _0x311f00;})});}_0x36d813=_['merge']({},_0x36d813,_0x19451f[_0xe00e('0x56')]);return _0x53b983['getTeams'](_0x36d813);}})['then'](function(_0x4d4e36){if(_0x4d4e36){_0x1b1016=_0x4d4e36[_0xe00e('0x6f')];if(!_0x19451f['query']['hasOwnProperty'](_0xe00e('0x4d'))){_0x36d813[_0xe00e('0x2a')]=qs[_0xe00e('0x2a')](_0x19451f['query'][_0xe00e('0x2a')]);_0x36d813[_0xe00e('0x29')]=qs[_0xe00e('0x29')](_0x19451f[_0xe00e('0x47')][_0xe00e('0x29')]);}return _0x53b983[_0xe00e('0x108')](_0x36d813);}})[_0xe00e('0x2f')](function(_0x5c62f5){if(_0x5c62f5){return _0x5c62f5?{'count':_0x1b1016,'rows':_0x5c62f5}:null;}})[_0xe00e('0x2f')](respondWithResult(_0x1d238c,null))[_0xe00e('0x25')](handleError(_0x1d238c,null));};exports[_0xe00e('0x10a')]=function(_0x96bd53,_0x4e5a68){return db[_0xe00e('0x40')][_0xe00e('0x3a')]({'where':{'id':_0x96bd53[_0xe00e('0x5c')]['id']}})[_0xe00e('0x2f')](handleEntityNotFound(_0x4e5a68,null))[_0xe00e('0x2f')](function(_0x463b9f){if(_0x463b9f){var _0xcfc48e=_0x463b9f[_0xe00e('0xb0')]({'plain':!![]});return _0x463b9f[_0xe00e('0x10a')](_0x96bd53[_0xe00e('0x61')][_0xe00e('0x64')],_['omit'](_0x96bd53[_0xe00e('0x61')],[_0xe00e('0x64'),'id'])||{})[_0xe00e('0x2f')](function(){for(var _0x29ff49=0x0;_0x29ff49<_0x96bd53['body'][_0xe00e('0x64')][_0xe00e('0x6f')];_0x29ff49++){var _0xb3c6fc=[];db[_0xe00e('0x109')][_0xe00e('0x9b')]({'where':{'id':_0x96bd53['body'][_0xe00e('0x64')][_0x29ff49]}})[_0xe00e('0x2f')](function(_0x4faa91){_0xb3c6fc['push'](_0x4faa91['getVoiceQueues']()[_0xe00e('0x2f')](function(_0x8d68ed){for(var _0x5b4bb9=0x0;_0x5b4bb9<_0x8d68ed[_0xe00e('0x6f')];_0x5b4bb9++){_0x8d68ed[_0x5b4bb9][_0xe00e('0x10b')](_0xe00e('0xb6'),_0xe00e('0x10c'));}return _0x8d68ed;}));_0xb3c6fc[_0xe00e('0x8d')](_0x4faa91[_0xe00e('0x10d')]()[_0xe00e('0x2f')](function(_0x465b77){for(var _0xc23a4=0x0;_0xc23a4<_0x465b77['length'];_0xc23a4++){_0x465b77[_0xc23a4][_0xe00e('0x10b')](_0xe00e('0xb6'),_0xe00e('0x10e'));}return _0x465b77;}));_0xb3c6fc['push'](_0x4faa91[_0xe00e('0x10f')]()[_0xe00e('0x2f')](function(_0xedee2e){for(var _0x4ced3b=0x0;_0x4ced3b<_0xedee2e[_0xe00e('0x6f')];_0x4ced3b++){_0xedee2e[_0x4ced3b]['setDataValue'](_0xe00e('0xb6'),'Mail');}return _0xedee2e;}));_0xb3c6fc[_0xe00e('0x8d')](_0x4faa91[_0xe00e('0x110')]()['then'](function(_0x4e3a79){for(var _0x5b81e8=0x0;_0x5b81e8<_0x4e3a79['length'];_0x5b81e8++){_0x4e3a79[_0x5b81e8]['setDataValue'](_0xe00e('0xb6'),_0xe00e('0x111'));}return _0x4e3a79;}));_0xb3c6fc[_0xe00e('0x8d')](_0x4faa91[_0xe00e('0x112')]()[_0xe00e('0x2f')](function(_0x50d4d7){for(var _0x40892d=0x0;_0x40892d<_0x50d4d7[_0xe00e('0x6f')];_0x40892d++){_0x50d4d7[_0x40892d][_0xe00e('0x10b')](_0xe00e('0xb6'),'Whatsapp');}return _0x50d4d7;}));_0xb3c6fc[_0xe00e('0x8d')](_0x4faa91['getFaxQueues']()[_0xe00e('0x2f')](function(_0x1b31b0){for(var _0x1472cf=0x0;_0x1472cf<_0x1b31b0['length'];_0x1472cf++){_0x1b31b0[_0x1472cf][_0xe00e('0x10b')](_0xe00e('0xb6'),'Fax');}return _0x1b31b0;}));_0xb3c6fc[_0xe00e('0x8d')](_0x4faa91[_0xe00e('0x113')]()[_0xe00e('0x2f')](function(_0x2a7302){for(var _0x4879ee=0x0;_0x4879ee<_0x2a7302[_0xe00e('0x6f')];_0x4879ee++){_0x2a7302[_0x4879ee]['setDataValue'](_0xe00e('0xb6'),_0xe00e('0x114'));}return _0x2a7302;}));return BPromise[_0xe00e('0x8e')](_0xb3c6fc);})[_0xe00e('0x2f')](function(_0x4a3354){var _0x7820df=_[_0xe00e('0x115')](_0x4a3354);_0xb3c6fc=[];return db[_0xe00e('0x53')]['transaction'](function(_0x5ecb2e){for(var _0x2819ce=0x0;_0x2819ce<_0x7820df[_0xe00e('0x6f')];_0x2819ce++){_0xb3c6fc[_0xe00e('0x8d')](_0x7820df[_0x2819ce][_0xe00e('0x116')](_0xcfc48e['id']),{'transaction':_0x5ecb2e});}return BPromise['all'](_0xb3c6fc)[_0xe00e('0x2f')](function(){if(_0xcfc48e[_0xe00e('0x117')]){return BPromise[_0xe00e('0x8f')](_[_0xe00e('0x35')](_0x7820df,function(_0x49f3b5){return _0x49f3b5['getDataValue'](_0xe00e('0xb6'))==='Voice';}),function(_0x58fd98){return db[_0xe00e('0xb3')][_0xe00e('0xb4')]({'membername':_0xcfc48e[_0xe00e('0x3d')],'UserId':_0xcfc48e['id'],'queue_name':_0x58fd98[_0xe00e('0x3d')],'VoiceQueueId':_0x58fd98['id'],'interface':_[_0xe00e('0x6b')](_0xcfc48e['interface'])?util['format'](_0xe00e('0xb2'),_0xcfc48e['name']):_0xcfc48e['interface'],'paused':_0xcfc48e[_0xe00e('0xa3')]||![],'penalty':_0xcfc48e[_0xe00e('0xaa')]},{'transaction':_0x5ecb2e});});}else{return;}})['then'](function(){for(var _0x42137c=0x0;_0x42137c<_0x7820df[_0xe00e('0x6f')];_0x42137c++){var _0x1118c5=_0x7820df[_0x42137c][_0xe00e('0x118')]('channel');var _0x93ff29=_0x1118c5+_0xe00e('0xb8');socket[_0xe00e('0xad')](_0xe00e('0x32')+_0x1118c5+_0xe00e('0xae'),{'UserId':_0xcfc48e['id'],['queueField']:_0x7820df[_0x42137c]['id']});}});});});}});}})[_0xe00e('0x2f')](respondWithStatusCode(_0x4e5a68,null))['catch'](handleError(_0x4e5a68,null));};exports[_0xe00e('0x119')]=function(_0xf398bf,_0x5d7619){return db[_0xe00e('0x40')][_0xe00e('0x9b')]({'where':{'id':_0xf398bf[_0xe00e('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5d7619,null))[_0xe00e('0x2f')](function(_0x4a332c){if(_0x4a332c){var _0xae2ef0=_0x4a332c[_0xe00e('0xb0')]({'plain':!![]});var _0x725c95=_0xf398bf[_0xe00e('0x47')][_0xe00e('0x64')];return _0x4a332c[_0xe00e('0x119')](_0x725c95)[_0xe00e('0x2f')](function(){for(var _0x2f6887=0x0;_0x2f6887<_0x725c95['length'];_0x2f6887++){var _0x1c61be=[];db[_0xe00e('0x109')]['findOne']({'where':{'id':_0x725c95[_0x2f6887]}})['then'](function(_0x446bb0){_0x1c61be[_0xe00e('0x8d')](_0x446bb0[_0xe00e('0x11a')]()[_0xe00e('0x2f')](function(_0x4e10d4){for(var _0xda78c7=0x0;_0xda78c7<_0x4e10d4['length'];_0xda78c7++){_0x4e10d4[_0xda78c7][_0xe00e('0x10b')](_0xe00e('0xb6'),_0xe00e('0x10c'));}return _0x4e10d4;}));_0x1c61be[_0xe00e('0x8d')](_0x446bb0[_0xe00e('0x10d')]()[_0xe00e('0x2f')](function(_0x526880){for(var _0x5347d5=0x0;_0x5347d5<_0x526880[_0xe00e('0x6f')];_0x5347d5++){_0x526880[_0x5347d5]['setDataValue'](_0xe00e('0xb6'),_0xe00e('0x10e'));}return _0x526880;}));_0x1c61be[_0xe00e('0x8d')](_0x446bb0['getMailQueues']()['then'](function(_0x5bc9d9){for(var _0x38c8af=0x0;_0x38c8af<_0x5bc9d9['length'];_0x38c8af++){_0x5bc9d9[_0x38c8af][_0xe00e('0x10b')]('channel',_0xe00e('0x11b'));}return _0x5bc9d9;}));_0x1c61be['push'](_0x446bb0[_0xe00e('0x110')]()[_0xe00e('0x2f')](function(_0x3015a2){for(var _0x92aa47=0x0;_0x92aa47<_0x3015a2[_0xe00e('0x6f')];_0x92aa47++){_0x3015a2[_0x92aa47]['setDataValue']('channel',_0xe00e('0x111'));}return _0x3015a2;}));_0x1c61be[_0xe00e('0x8d')](_0x446bb0[_0xe00e('0x112')]()[_0xe00e('0x2f')](function(_0x3cbfd5){for(var _0x16b0d0=0x0;_0x16b0d0<_0x3cbfd5[_0xe00e('0x6f')];_0x16b0d0++){_0x3cbfd5[_0x16b0d0]['setDataValue'](_0xe00e('0xb6'),_0xe00e('0x11c'));}return _0x3cbfd5;}));_0x1c61be['push'](_0x446bb0[_0xe00e('0x11d')]()[_0xe00e('0x2f')](function(_0x4b1426){for(var _0x47ac99=0x0;_0x47ac99<_0x4b1426[_0xe00e('0x6f')];_0x47ac99++){_0x4b1426[_0x47ac99][_0xe00e('0x10b')](_0xe00e('0xb6'),'Fax');}return _0x4b1426;}));_0x1c61be[_0xe00e('0x8d')](_0x446bb0['getOpenchannelQueues']()[_0xe00e('0x2f')](function(_0x1d1a12){for(var _0x406427=0x0;_0x406427<_0x1d1a12['length'];_0x406427++){_0x1d1a12[_0x406427][_0xe00e('0x10b')]('channel','Openchannel');}return _0x1d1a12;}));return BPromise[_0xe00e('0x8e')](_0x1c61be);})[_0xe00e('0x2f')](function(_0x314d59){var _0x34aca7=_['flatten'](_0x314d59);_0x1c61be=[];return db[_0xe00e('0x53')]['transaction'](function(_0x45071e){for(var _0x9634ef=0x0;_0x9634ef<_0x34aca7[_0xe00e('0x6f')];_0x9634ef++){_0x1c61be['push'](_0x34aca7[_0x9634ef][_0xe00e('0x11e')](_0xae2ef0['id']),{'transaction':_0x45071e});}return BPromise['all'](_0x1c61be)[_0xe00e('0x2f')](function(){if(_0xae2ef0[_0xe00e('0x117')]){return BPromise[_0xe00e('0x8f')](_['filter'](_0x34aca7,function(_0x1208d6){return _0x1208d6[_0xe00e('0x118')](_0xe00e('0xb6'))===_0xe00e('0x10c');}),function(_0xe1de3b){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xe1de3b['id'],'UserId':_0xae2ef0['id']},'transaction':_0x45071e});});}else{return;}})[_0xe00e('0x2f')](function(){for(var _0x5a5c29=0x0;_0x5a5c29<_0x34aca7[_0xe00e('0x6f')];_0x5a5c29++){var _0x202a8=_0x34aca7[_0x5a5c29][_0xe00e('0x118')](_0xe00e('0xb6'));var _0x207560=_0x202a8+_0xe00e('0xb8');socket[_0xe00e('0xad')](_0xe00e('0x32')+_0x202a8+_0xe00e('0x11f'),{'UserId':_0xae2ef0['id'],['queueField']:_0x34aca7[_0x5a5c29]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x5d7619,null))[_0xe00e('0x25')](handleError(_0x5d7619,null));};exports[_0xe00e('0x120')]=function(_0x18f458,_0x399c63,_0x210fa6){var _0x24eb96={};var _0x5c008e={};var _0x3b4755;var _0x31983a;return db[_0xe00e('0x40')]['findOne']({'where':{'id':_0x18f458[_0xe00e('0x5c')]['id']}})[_0xe00e('0x2f')](handleEntityNotFound(_0x399c63,null))['then'](function(_0x349ce7){if(_0x349ce7){_0x3b4755=_0x349ce7;_0x5c008e[_0xe00e('0x45')]=_[_0xe00e('0x48')](db[_0xe00e('0xc5')][_0xe00e('0x41')]);_0x5c008e[_0xe00e('0x47')]=_[_0xe00e('0x48')](_0x18f458[_0xe00e('0x47')]);_0x5c008e[_0xe00e('0x49')]=_['intersection'](_0x5c008e[_0xe00e('0x45')],_0x5c008e[_0xe00e('0x47')]);_0x24eb96[_0xe00e('0x4a')]=_[_0xe00e('0x5f')](_0x5c008e[_0xe00e('0x45')],qs[_0xe00e('0x4b')](_0x18f458[_0xe00e('0x47')][_0xe00e('0x4b')]));_0x24eb96[_0xe00e('0x4a')]=_0x24eb96[_0xe00e('0x4a')][_0xe00e('0x6f')]?_0x24eb96[_0xe00e('0x4a')]:_0x5c008e[_0xe00e('0x45')];_0x24eb96[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x18f458['query'][_0xe00e('0x4e')]);_0x24eb96['where']=qs[_0xe00e('0x49')](_['pick'](_0x18f458[_0xe00e('0x47')],_0x5c008e['filters']));if(_0x18f458[_0xe00e('0x47')][_0xe00e('0x35')]){_0x24eb96[_0xe00e('0x4f')]=_[_0xe00e('0x51')](_0x24eb96['where'],{'$or':_[_0xe00e('0x37')](_0x24eb96['attributes'],function(_0x4d8b27){var _0x3adf46={};_0x3adf46[_0x4d8b27]={'$like':'%'+_0x18f458[_0xe00e('0x47')]['filter']+'%'};return _0x3adf46;})});}_0x24eb96=_[_0xe00e('0x51')]({},_0x24eb96,_0x18f458[_0xe00e('0x56')]);return _0x3b4755[_0xe00e('0x120')](_0x24eb96);}})['then'](function(_0x1842dd){if(_0x1842dd){_0x31983a=_0x1842dd[_0xe00e('0x6f')];if(!_0x18f458[_0xe00e('0x47')][_0xe00e('0x4c')](_0xe00e('0x4d'))){_0x24eb96[_0xe00e('0x2a')]=qs[_0xe00e('0x2a')](_0x18f458[_0xe00e('0x47')][_0xe00e('0x2a')]);_0x24eb96[_0xe00e('0x29')]=qs['offset'](_0x18f458[_0xe00e('0x47')][_0xe00e('0x29')]);}return _0x3b4755[_0xe00e('0x120')](_0x24eb96);}})['then'](function(_0x463c22){if(_0x463c22){return _0x463c22?{'count':_0x31983a,'rows':_0x463c22}:null;}})['then'](respondWithResult(_0x399c63,null))[_0xe00e('0x25')](handleError(_0x399c63,null));};exports[_0xe00e('0x121')]=function(_0x4abd92,_0xa05ec2,_0x570610){var _0x8b1f2c={};var _0x256f40={};var _0x4d8aeb;var _0x39a6f3;return db[_0xe00e('0x40')]['findOne']({'where':{'id':_0x4abd92[_0xe00e('0x5c')]['id']}})[_0xe00e('0x2f')](handleEntityNotFound(_0xa05ec2,null))[_0xe00e('0x2f')](function(_0xd6a456){if(_0xd6a456){_0x4d8aeb=_0xd6a456;_0x256f40[_0xe00e('0x45')]=_[_0xe00e('0x48')](db[_0xe00e('0x40')][_0xe00e('0x41')]);_0x256f40[_0xe00e('0x47')]=_[_0xe00e('0x48')](_0x4abd92['query']);_0x256f40[_0xe00e('0x49')]=_['intersection'](_0x256f40[_0xe00e('0x45')],_0x256f40[_0xe00e('0x47')]);_0x8b1f2c[_0xe00e('0x4a')]=_[_0xe00e('0x5f')](_0x256f40['model'],qs['fields'](_0x4abd92[_0xe00e('0x47')][_0xe00e('0x4b')]));_0x8b1f2c[_0xe00e('0x4a')]=_0x8b1f2c[_0xe00e('0x4a')][_0xe00e('0x6f')]?_0x8b1f2c[_0xe00e('0x4a')]:_0x256f40[_0xe00e('0x45')];_0x8b1f2c[_0xe00e('0xc3')]=qs[_0xe00e('0x4e')](_0x4abd92[_0xe00e('0x47')][_0xe00e('0x4e')]);_0x8b1f2c[_0xe00e('0x4f')]=qs[_0xe00e('0x49')](_[_0xe00e('0x50')](_0x4abd92['query'],_0x256f40[_0xe00e('0x49')]));if(_0x4abd92[_0xe00e('0x47')][_0xe00e('0x35')]){_0x8b1f2c['where']=_[_0xe00e('0x51')](_0x8b1f2c[_0xe00e('0x4f')],{'$or':_[_0xe00e('0x37')](_0x8b1f2c[_0xe00e('0x4a')],function(_0x3ddd41){var _0x311f19={};_0x311f19[_0x3ddd41]={'$like':'%'+_0x4abd92[_0xe00e('0x47')][_0xe00e('0x35')]+'%'};return _0x311f19;})});}_0x8b1f2c[_0xe00e('0x45')]=db[_0xe00e('0x40')];_0x8b1f2c['as']=_0xe00e('0x92');_0x8b1f2c=_['merge']({},_0x8b1f2c,_0x4abd92['options']);return _0x4d8aeb[_0xe00e('0x11a')]({'include':[_0x8b1f2c]});}})[_0xe00e('0x2f')](function(_0x51659b){if(_0x51659b){var _0x14233e={},_0x21b8a3=[],_0x340d33=0x0;for(var _0x1a5748=0x0;_0x1a5748<_0x51659b[_0xe00e('0x6f')];_0x1a5748+=0x1){for(var _0x5bfcfa=0x0,_0x3cf171;_0x5bfcfa<_0x51659b[_0x1a5748][_0xe00e('0x92')][_0xe00e('0x6f')];_0x5bfcfa+=0x1){_0x3cf171=_0x51659b[_0x1a5748][_0xe00e('0x92')][_0x5bfcfa][_0xe00e('0xb0')]({'plain':!![]});_0x14233e[_0x3cf171['id']]=_0x3cf171;}}_0x14233e=_[_0xe00e('0x122')](_0x14233e);for(var _0x547faf=qs[_0xe00e('0x29')](_0x4abd92[_0xe00e('0x47')][_0xe00e('0x29')]);_0x547faf<_0x14233e[_0xe00e('0x6f')]&&_0x21b8a3[_0xe00e('0x6f')]=_0x42e5fe[_0xb282('0x50')]){throw new Error(_0xb282('0x51'));}})[_0xb282('0x11')](function(){if(_0x2c7986){return db[_0xb282('0x2e')]['destroy']({'where':{'membername':_0x2c7986[_0xb282('0x2a')]},'individualHooks':!![]});}})[_0xb282('0x11')](function(){if(_0x2c7986){return _0x2c7986[_0xb282('0x52')]({'raw':!![]});}})[_0xb282('0x11')](function(_0x257535){if(_0x2c7986){if(_0x257535){var _0x1aa818=[];_0x3cf767=_0x257535;if(_0x3cf767[_0xb282('0x33')]){for(var _0x3c37e0=0x0;_0x3c37e0<_0x3cf767[_0xb282('0x33')];_0x3c37e0++){_0x1aa818[_0xb282('0x38')](db['UserVoiceQueueRt'][_0xb282('0x53')]({'membername':_0x2c7986[_0xb282('0x2a')],'UserId':_0x2c7986['id'],'queue_name':_0x3cf767[_0x3c37e0][_0xb282('0x2a')],'VoiceQueueId':_0x3cf767[_0x3c37e0]['id'],'interface':_0x277769,'paused':_0x2c7986[_0xb282('0x4f')]||![],'penalty':_0x3cf767[_0x3c37e0][_0xb282('0x54')]||0x0}));}return BPromise[_0xb282('0x4a')](_0x1aa818);}}}})[_0xb282('0x11')](function(){if(_0x2c7986){return db[_0xb282('0x30')]['findAll']({'where':{'membername':_0x2c7986[_0xb282('0x2a')],'exitAt':null}});}})[_0xb282('0x11')](function(_0x458886){if(_0x2c7986){if(_0x458886&&_0x458886[_0xb282('0x33')]){var _0x314183=[];_0x458886[_0xb282('0x37')](function(_0x4e5f15){_0x314183[_0xb282('0x38')](_0x4e5f15[_0xb282('0x2f')]({'exitAt':moment()[_0xb282('0x34')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb282('0x4a')](_0x314183);}}})[_0xb282('0x11')](function(_0x4e894e){if(_0x2c7986){var _0xf68bd1=[];var _0x69bddd=[];var _0xd4fb06=utils[_0xb282('0x55')]();var _0x3cd921={'membername':_0x2c7986[_0xb282('0x2a')],'interface':_0x277769,'enterAt':moment()[_0xb282('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2c7986['role'],'internal':_0x2c7986[_0xb282('0x2c')]};_0xd4fb06['forEach'](function(_0x174db3){_0xf68bd1[_0xb282('0x38')](_[_0xb282('0x56')]({'channel':_0x174db3,'type':_0xb282('0x57'),'data1':_0xb282('0x58'),'data2':_0x277769},_0x3cd921));if(_0x2c7986['loginInPause']){_0x69bddd[_0xb282('0x38')](_[_0xb282('0x56')]({'channel':_0x174db3,'type':_0xb282('0x32'),'data1':'LOGININPAUSE'},_0x3cd921));}});return db[_0xb282('0x30')][_0xb282('0x59')](_0xf68bd1[_0xb282('0x5a')](_0x69bddd),{'individualHooks':!![]});}})[_0xb282('0x11')](function(){if(_0x2c7986){return _0x2c7986[_0xb282('0x2f')]({'online':!![],'lastLoginAt':moment()[_0xb282('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2c7986[_0xb282('0x4f')]||![],'mailPause':_0x2c7986[_0xb282('0x4f')]||![],'chatPause':_0x2c7986[_0xb282('0x4f')]||![],'faxPause':_0x2c7986[_0xb282('0x4f')]||![],'smsPause':_0x2c7986['loginInPause']||![],'openchannelPause':_0x2c7986[_0xb282('0x4f')]||![],'pauseType':_0x2c7986[_0xb282('0x4f')]?_0xb282('0x5b'):null,'lastPauseAt':moment()[_0xb282('0x34')](_0xb282('0x35')),'interface':_0x277769});}})[_0xb282('0x11')](function(_0x157b97){_0x4ccef5(_0x157b97);})[_0xb282('0x26')](function(_0xb6fc20){_0x2cffa2(_0x3a87ce[_0xb282('0x17')](0x1f4,_0xb6fc20[_0xb282('0x1a')]));});});}; \ No newline at end of file +var _0x0447=['GetUser','ShowUser','find','raw','PauseUser','name','role','internal','interface','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','isNil','PAUSE','body','type','uniqueid','bulkCreate','update','findOne','channel','isValidChannel','voice','UserVoiceQueueRt','mail','chat','fax','sms','whatsapp','system','set','all','LogoutUser','destroy','phone','loginInPause','SIP/%s','count','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','callysquare','merge','concat','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','User,\x20%s,\x20%s','info','result','catch','User','findAll','options','where','attributes','limit','map','include','model','then'];(function(_0x54f865,_0x264bc2){var _0x29a3f6=function(_0x102c12){while(--_0x102c12){_0x54f865['push'](_0x54f865['shift']());}};_0x29a3f6(++_0x264bc2);}(_0x0447,0x8b));var _0x7044=function(_0x7b68cc,_0x3f522e){_0x7b68cc=_0x7b68cc-0x0;var _0x36470e=_0x0447[_0x7b68cc];return _0x36470e;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var moment=require(_0x7044('0x2'));var BPromise=require(_0x7044('0x3'));var rs=require(_0x7044('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7044('0x5'))['db'];var utils=require(_0x7044('0x6'));var logger=require(_0x7044('0x7'))(_0x7044('0x8'));var config=require(_0x7044('0x9'));var jayson=require(_0x7044('0xa'));var client=jayson[_0x7044('0xb')][_0x7044('0xc')]({'port':0x232a});config[_0x7044('0xd')]=_['defaults'](config[_0x7044('0xd')],{'host':_0x7044('0xe'),'port':0x18eb});var socket=require(_0x7044('0xf'))(new Redis(config[_0x7044('0xd')]));require('./user.socket')[_0x7044('0x10')](socket);function respondWithRpcPromise(_0x1d1881,_0x47945d,_0x1a180c){return new BPromise(function(_0xf38837,_0x87a156){return client[_0x7044('0x11')](_0x1d1881,_0x1a180c)['then'](function(_0xdbbb18){logger['info']('User,\x20%s,\x20%s',_0x47945d,'request\x20sent');logger[_0x7044('0x12')](_0x7044('0x13'),_0x47945d,_0x7044('0x14'),JSON[_0x7044('0x15')](_0xdbbb18));if(_0xdbbb18['error']){if(_0xdbbb18['error'][_0x7044('0x16')]===0x1f4){logger[_0x7044('0x17')]('User,\x20%s,\x20%s',_0x47945d,_0xdbbb18['error'][_0x7044('0x18')]);return _0x87a156(_0xdbbb18[_0x7044('0x17')][_0x7044('0x18')]);}logger[_0x7044('0x17')](_0x7044('0x19'),_0x47945d,_0xdbbb18[_0x7044('0x17')]['message']);return _0xf38837(_0xdbbb18[_0x7044('0x17')][_0x7044('0x18')]);}else{logger[_0x7044('0x1a')](_0x7044('0x19'),_0x47945d,_0x7044('0x14'));_0xf38837(_0xdbbb18[_0x7044('0x1b')]['message']);}})[_0x7044('0x1c')](function(_0x227bcd){logger[_0x7044('0x17')]('User,\x20%s,\x20%s',_0x47945d,_0x227bcd);_0x87a156(_0x227bcd);});});}exports['GetUser']=function(_0x543be8){var _0xced6e4=this;return new Promise(function(_0x3292f8,_0x2c5dcb){return db[_0x7044('0x1d')][_0x7044('0x1e')]({'raw':_0x543be8['options']?_0x543be8[_0x7044('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x543be8['options']?_0x543be8[_0x7044('0x1f')][_0x7044('0x20')]||null:null,'attributes':_0x543be8[_0x7044('0x1f')]?_0x543be8[_0x7044('0x1f')][_0x7044('0x21')]||null:null,'limit':_0x543be8[_0x7044('0x1f')]?_0x543be8[_0x7044('0x1f')][_0x7044('0x22')]||null:null,'include':_0x543be8[_0x7044('0x1f')]?_0x543be8['options']['include']?_[_0x7044('0x23')](_0x543be8[_0x7044('0x1f')][_0x7044('0x24')],function(_0x29caa4){return{'model':db[_0x29caa4[_0x7044('0x25')]],'as':_0x29caa4['as'],'attributes':_0x29caa4[_0x7044('0x21')],'include':_0x29caa4[_0x7044('0x24')]?_[_0x7044('0x23')](_0x29caa4[_0x7044('0x24')],function(_0x2826bf){return{'model':db[_0x2826bf[_0x7044('0x25')]],'as':_0x2826bf['as'],'attributes':_0x2826bf[_0x7044('0x21')],'include':_0x2826bf['include']?_[_0x7044('0x23')](_0x2826bf[_0x7044('0x24')],function(_0x2614a3){return{'model':db[_0x2614a3[_0x7044('0x25')]],'as':_0x2614a3['as'],'attributes':_0x2614a3['attributes']};}):[]};}):[]};}):[]:[]})[_0x7044('0x26')](function(_0x5dd28c){logger['info']('GetUser',_0x543be8);logger[_0x7044('0x12')]('GetUser',_0x543be8,JSON[_0x7044('0x15')](_0x5dd28c));_0x3292f8(_0x5dd28c);})[_0x7044('0x1c')](function(_0x5849fd){logger['error'](_0x7044('0x27'),_0x5849fd['message'],_0x543be8);_0x2c5dcb(_0xced6e4['error'](0x1f4,_0x5849fd['message']));});});};exports[_0x7044('0x28')]=function(_0x175405){var _0x5f42fe=this;return new Promise(function(_0x1a0aa6,_0x1e3f5c){return db[_0x7044('0x1d')][_0x7044('0x29')]({'raw':_0x175405[_0x7044('0x1f')]?_0x175405['options'][_0x7044('0x2a')]===undefined?!![]:![]:!![],'where':_0x175405[_0x7044('0x1f')]?_0x175405[_0x7044('0x1f')][_0x7044('0x20')]||null:null,'attributes':_0x175405[_0x7044('0x1f')]?_0x175405['options'][_0x7044('0x21')]||null:null,'include':_0x175405[_0x7044('0x1f')]?_0x175405['options'][_0x7044('0x24')]?_[_0x7044('0x23')](_0x175405[_0x7044('0x1f')][_0x7044('0x24')],function(_0x2a7da2){return{'model':db[_0x2a7da2[_0x7044('0x25')]],'as':_0x2a7da2['as'],'attributes':_0x2a7da2['attributes'],'include':_0x2a7da2['include']?_[_0x7044('0x23')](_0x2a7da2[_0x7044('0x24')],function(_0x4f92b7){return{'model':db[_0x4f92b7[_0x7044('0x25')]],'as':_0x4f92b7['as'],'attributes':_0x4f92b7[_0x7044('0x21')],'include':_0x4f92b7[_0x7044('0x24')]?_[_0x7044('0x23')](_0x4f92b7[_0x7044('0x24')],function(_0x564972){return{'model':db[_0x564972[_0x7044('0x25')]],'as':_0x564972['as'],'attributes':_0x564972[_0x7044('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d8650){logger[_0x7044('0x1a')](_0x7044('0x28'),_0x175405);logger[_0x7044('0x12')](_0x7044('0x28'),_0x175405,JSON[_0x7044('0x15')](_0x4d8650));_0x1a0aa6(_0x4d8650);})[_0x7044('0x1c')](function(_0x478756){logger['error'](_0x7044('0x28'),_0x478756[_0x7044('0x18')],_0x175405);_0x1e3f5c(_0x5f42fe[_0x7044('0x17')](0x1f4,_0x478756['message']));});});};exports[_0x7044('0x2b')]=function(_0x5ce758){var _0x53056c=this;return new Promise(function(_0x30c663,_0x49dbe5){var _0x221a67;return db[_0x7044('0x1d')][_0x7044('0x29')]({'where':_0x5ce758[_0x7044('0x1f')][_0x7044('0x20')]||{},'attributes':['id',_0x7044('0x2c'),_0x7044('0x2d'),_0x7044('0x2e'),_0x7044('0x2f')]})[_0x7044('0x26')](function(_0x485a0e){if(_0x485a0e){_0x221a67=_0x485a0e;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x221a67['id']},'individualHooks':!![]});}})[_0x7044('0x26')](function(){if(_0x221a67){return db[_0x7044('0x30')][_0x7044('0x1e')]({'where':{'membername':_0x221a67[_0x7044('0x2c')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x4dad9f){if(_0x221a67){if(_0x4dad9f&&_0x4dad9f[_0x7044('0x31')]){var _0x20ef6d=moment()[_0x7044('0x32')](_0x7044('0x33'));for(var _0x12af59=0x0,_0xa5d25b=_0x4dad9f[_0x7044('0x31')];_0x12af59<_0xa5d25b;_0x12af59++){_0x4dad9f[_0x12af59][_0x7044('0x34')]({'exitAt':_0x20ef6d});}}}})[_0x7044('0x26')](function(){if(_0x221a67){var _0x542083=[];var _0x4d0c31=utils['getChannels']();_0x4d0c31[_0x7044('0x35')](function(_0x1bf364){_0x542083[_0x7044('0x36')]({'channel':_0x1bf364,'membername':_0x221a67[_0x7044('0x2c')],'interface':_[_0x7044('0x37')](_0x221a67[_0x7044('0x2f')])?util[_0x7044('0x32')]('SIP/%s',_0x221a67['name']):_0x221a67[_0x7044('0x2f')],'type':_0x7044('0x38'),'enterAt':moment()[_0x7044('0x32')](_0x7044('0x33')),'data1':_0x5ce758[_0x7044('0x39')][_0x7044('0x3a')]||'DEFAULT\x20PAUSE','role':_0x221a67['role'],'internal':_0x221a67['internal'],'uniqueid':_0x5ce758[_0x7044('0x39')][_0x7044('0x3b')]||null});});return db[_0x7044('0x30')][_0x7044('0x3c')](_0x542083,{'individualHooks':!![]});}})['then'](function(){if(_0x221a67){return _0x221a67[_0x7044('0x3d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5ce758[_0x7044('0x39')][_0x7044('0x3a')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x7044('0x32')](_0x7044('0x33'))});}})[_0x7044('0x26')](function(_0x5d85bf){_0x30c663(_0x5d85bf);})[_0x7044('0x1c')](function(_0x2380cc){_0x49dbe5(_0x53056c[_0x7044('0x17')](0x1f4,_0x2380cc[_0x7044('0x18')]));});});};exports['UnpauseUser']=function(_0x1d579e){var _0x1ca821=this;return new Promise(function(_0x5acd8f,_0x342049){var _0x4220ff;return db[_0x7044('0x1d')][_0x7044('0x3e')]({'where':_0x1d579e[_0x7044('0x1f')]['where']||{},'attributes':['id',_0x7044('0x2c')]})[_0x7044('0x26')](function(_0x57ba7f){if(_0x57ba7f){_0x4220ff=_0x57ba7f;if(_0x1d579e['body'][_0x7044('0x3f')]&&!utils[_0x7044('0x40')](_0x1d579e[_0x7044('0x39')][_0x7044('0x3f')])){throw new Error('Unknown\x20channel');}switch(_0x1d579e[_0x7044('0x39')][_0x7044('0x3f')]){case _0x7044('0x41'):return db[_0x7044('0x42')][_0x7044('0x3d')]({'paused':0x0},{'where':{'UserId':_0x4220ff['id']}})[_0x7044('0x26')](function(){return db[_0x7044('0x30')][_0x7044('0x29')]({'where':{'channel':_0x1d579e[_0x7044('0x39')][_0x7044('0x3f')],'membername':_0x4220ff[_0x7044('0x2c')],'type':_0x7044('0x38'),'exitAt':null}});})[_0x7044('0x26')](function(_0x3bd7dd){if(_0x3bd7dd){return _0x3bd7dd[_0x7044('0x3d')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x7044('0x26')](function(){return _0x4220ff[_0x7044('0x3d')]({'voicePause':![]});});case _0x7044('0x43'):case _0x7044('0x44'):case _0x7044('0x45'):case _0x7044('0x46'):case'openchannel':case _0x7044('0x47'):return db['MemberReport'][_0x7044('0x29')]({'where':{'channel':_0x1d579e[_0x7044('0x39')][_0x7044('0x3f')],'membername':_0x4220ff[_0x7044('0x2c')],'type':_0x7044('0x38'),'exitAt':null}})[_0x7044('0x26')](function(_0x505d42){return _0x505d42['update']({'exitAt':moment()[_0x7044('0x32')](_0x7044('0x33')),'data2':_0x7044('0x48')},{'individualHooks':!![]});})[_0x7044('0x26')](function(){var _0x1346a0={};_[_0x7044('0x49')](_0x1346a0,util[_0x7044('0x32')]('%s%s',_0x1d579e[_0x7044('0x39')][_0x7044('0x3f')],'Pause'),![]);return _0x4220ff[_0x7044('0x3d')](_0x1346a0);});default:return db[_0x7044('0x42')][_0x7044('0x3d')]({'paused':0x0},{'where':{'UserId':_0x4220ff['id']}})[_0x7044('0x26')](function(){return db[_0x7044('0x30')]['findAll']({'where':{'membername':_0x4220ff['name'],'type':_0x7044('0x38'),'exitAt':null}});})[_0x7044('0x26')](function(_0x5b076e){var _0x1d6f3b=[];_0x5b076e[_0x7044('0x35')](function(_0x2ad749){_0x1d6f3b[_0x7044('0x36')](_0x2ad749[_0x7044('0x3d')]({'exitAt':moment()[_0x7044('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x7044('0x48')}));});return BPromise[_0x7044('0x4a')](_0x1d6f3b);})[_0x7044('0x26')](function(){return _0x4220ff[_0x7044('0x3d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x37485b){_0x5acd8f(_0x37485b);})['catch'](function(_0x304bdd){_0x342049(_0x1ca821[_0x7044('0x17')](0x1f4,_0x304bdd['message']));});});};exports[_0x7044('0x4b')]=function(_0x6f785b){var _0x3e48da=this;return new Promise(function(_0x2b06d5,_0x185fff){var _0x84d79b;return db[_0x7044('0x1d')][_0x7044('0x3e')]({'where':_0x6f785b[_0x7044('0x1f')][_0x7044('0x20')]||{},'attributes':['id',_0x7044('0x2c')]})[_0x7044('0x26')](function(_0x194c28){if(_0x194c28){_0x84d79b=_0x194c28;return db[_0x7044('0x42')][_0x7044('0x4c')]({'where':{'membername':_0x84d79b['name']},'individualHooks':!![]});}})['then'](function(){if(_0x84d79b){return db[_0x7044('0x30')]['findAll']({'where':{'membername':_0x84d79b['name'],'exitAt':null}});}})[_0x7044('0x26')](function(_0x318b4e){if(_0x84d79b){if(_0x318b4e&&_0x318b4e['length']){var _0x253ab9=[];_0x318b4e['forEach'](function(_0x4219a3){_0x253ab9[_0x7044('0x36')](_0x4219a3[_0x7044('0x3d')]({'exitAt':moment()[_0x7044('0x32')](_0x7044('0x33'))}));});return BPromise[_0x7044('0x4a')](_0x253ab9);}}})[_0x7044('0x26')](function(){if(_0x84d79b){return _0x84d79b[_0x7044('0x3d')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x15f055){_0x2b06d5(_0x15f055);})[_0x7044('0x1c')](function(_0x296c26){_0x185fff(_0x3e48da[_0x7044('0x17')](0x1f4,_0x296c26[_0x7044('0x18')]));});});};exports['LoginUser']=function(_0x31cf08){var _0x16d2bb=this;return new Promise(function(_0x26f391,_0x51f586){var _0x4977c8;var _0x325f6a;var _0xb7e0b4;var _0x29a120;return db[_0x7044('0x1d')][_0x7044('0x3e')]({'where':_0x31cf08['options'][_0x7044('0x20')]||{},'attributes':['id',_0x7044('0x2c'),_0x7044('0x2d'),'mobile',_0x7044('0x4d'),'internal',_0x7044('0x4e'),_0x7044('0x2f')]})['then'](function(_0x48c21c){if(_0x48c21c){_0x4977c8=_0x48c21c;_0x29a120=_0x31cf08[_0x7044('0x39')][_0x7044('0x2f')]?_0x31cf08[_0x7044('0x39')][_0x7044('0x2f')]:util[_0x7044('0x32')](_0x7044('0x4f'),_0x4977c8[_0x7044('0x2c')]);return db[_0x7044('0x1d')][_0x7044('0x50')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4977c8['id']}}});}})['then'](function(_0x9996c5){if(_0x9996c5){_0xb7e0b4=_0x9996c5;return require('../../config/license/util')['getLicense']();}})[_0x7044('0x26')](function(_0x3e821c){if(_0x3e821c&&_0x3e821c[_0x7044('0x51')]&&_0xb7e0b4>=_0x3e821c[_0x7044('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x7044('0x26')](function(){if(_0x4977c8){return db['UserVoiceQueueRt'][_0x7044('0x4c')]({'where':{'membername':_0x4977c8[_0x7044('0x2c')]},'individualHooks':!![]});}})[_0x7044('0x26')](function(){if(_0x4977c8){return _0x4977c8[_0x7044('0x52')]({'raw':!![]});}})[_0x7044('0x26')](function(_0x57d8d5){if(_0x4977c8){if(_0x57d8d5){var _0x29c40e=[];_0x325f6a=_0x57d8d5;if(_0x325f6a[_0x7044('0x31')]){for(var _0x505632=0x0;_0x505632<_0x325f6a[_0x7044('0x31')];_0x505632++){_0x29c40e[_0x7044('0x36')](db[_0x7044('0x42')][_0x7044('0x53')]({'membername':_0x4977c8['name'],'UserId':_0x4977c8['id'],'queue_name':_0x325f6a[_0x505632]['name'],'VoiceQueueId':_0x325f6a[_0x505632]['id'],'interface':_0x29a120,'paused':_0x4977c8['loginInPause']||![],'penalty':_0x325f6a[_0x505632][_0x7044('0x54')]||0x0}));}return BPromise[_0x7044('0x4a')](_0x29c40e);}}}})[_0x7044('0x26')](function(){if(_0x4977c8){return db[_0x7044('0x30')][_0x7044('0x1e')]({'where':{'membername':_0x4977c8['name'],'exitAt':null}});}})[_0x7044('0x26')](function(_0x57e1cd){if(_0x4977c8){if(_0x57e1cd&&_0x57e1cd[_0x7044('0x31')]){var _0x321662=[];_0x57e1cd[_0x7044('0x35')](function(_0x22c4b8){_0x321662[_0x7044('0x36')](_0x22c4b8[_0x7044('0x3d')]({'exitAt':moment()[_0x7044('0x32')](_0x7044('0x33'))}));});return BPromise['all'](_0x321662);}}})[_0x7044('0x26')](function(_0x19e276){if(_0x4977c8){var _0x320f39=[];var _0x34ea6c=[];var _0xd7e30e=utils[_0x7044('0x55')]();var _0x57608f={'membername':_0x4977c8[_0x7044('0x2c')],'interface':_0x29a120,'enterAt':moment()['format'](_0x7044('0x33')),'role':_0x4977c8[_0x7044('0x2d')],'internal':_0x4977c8[_0x7044('0x2e')]};_0xd7e30e[_0x7044('0x35')](function(_0x2c3ead){_0x320f39[_0x7044('0x36')](_['merge']({'channel':_0x2c3ead,'type':'LOGIN','data1':_0x7044('0x56'),'data2':_0x29a120},_0x57608f));if(_0x4977c8[_0x7044('0x4e')]){_0x34ea6c[_0x7044('0x36')](_[_0x7044('0x57')]({'channel':_0x2c3ead,'type':'PAUSE','data1':'LOGININPAUSE'},_0x57608f));}});return db[_0x7044('0x30')][_0x7044('0x3c')](_0x320f39[_0x7044('0x58')](_0x34ea6c),{'individualHooks':!![]});}})['then'](function(){if(_0x4977c8){return _0x4977c8['update']({'online':!![],'lastLoginAt':moment()[_0x7044('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4977c8['loginInPause']||![],'mailPause':_0x4977c8[_0x7044('0x4e')]||![],'chatPause':_0x4977c8[_0x7044('0x4e')]||![],'faxPause':_0x4977c8[_0x7044('0x4e')]||![],'smsPause':_0x4977c8[_0x7044('0x4e')]||![],'openchannelPause':_0x4977c8[_0x7044('0x4e')]||![],'pauseType':_0x4977c8[_0x7044('0x4e')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x7044('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x29a120});}})['then'](function(_0x1fe5e4){_0x26f391(_0x1fe5e4);})[_0x7044('0x1c')](function(_0x43ea3b){_0x51f586(_0x16d2bb[_0x7044('0x17')](0x1f4,_0x43ea3b[_0x7044('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index a015862..c5bb7e9 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 _0xf1cb=['user:','./user.events','save','remove','update','emit','removeListener','register','length'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0xf1cb,0x76));var _0xbf1c=function(_0x42e565,_0x1f4df4){_0x42e565=_0x42e565-0x0;var _0x3dbf30=_0xf1cb[_0x42e565];return _0x3dbf30;};'use strict';var UserEvents=require(_0xbf1c('0x0'));var events=[_0xbf1c('0x1'),_0xbf1c('0x2'),_0xbf1c('0x3')];function createListener(_0x1c95db,_0x17a21d){return function(_0x1793f1){_0x17a21d[_0xbf1c('0x4')](_0x1c95db,_0x1793f1);};}function removeListener(_0x11c7ff,_0x32c2d0){return function(){UserEvents[_0xbf1c('0x5')](_0x11c7ff,_0x32c2d0);};}exports[_0xbf1c('0x6')]=function(_0x5b5fec){for(var _0x468254=0x0,_0x450d7f=events[_0xbf1c('0x7')];_0x468254<_0x450d7f;_0x468254++){var _0x894f77=events[_0x468254];var _0x1c0490=createListener(_0xbf1c('0x8')+_0x894f77,_0x5b5fec);UserEvents['on'](_0x894f77,_0x1c0490);}}; \ No newline at end of file +var _0xc940=['remove','update','emit','removeListener','register','length','user:','save'];(function(_0x235fc4,_0x509427){var _0x58631e=function(_0x166a7d){while(--_0x166a7d){_0x235fc4['push'](_0x235fc4['shift']());}};_0x58631e(++_0x509427);}(_0xc940,0x77));var _0x0c94=function(_0x4c6407,_0xc94b95){_0x4c6407=_0x4c6407-0x0;var _0x5641ff=_0xc940[_0x4c6407];return _0x5641ff;};'use strict';var UserEvents=require('./user.events');var events=[_0x0c94('0x0'),_0x0c94('0x1'),_0x0c94('0x2')];function createListener(_0x3eac9c,_0x160693){return function(_0xe9c8c8){_0x160693[_0x0c94('0x3')](_0x3eac9c,_0xe9c8c8);};}function removeListener(_0x4d19d9,_0x1da815){return function(){UserEvents[_0x0c94('0x4')](_0x4d19d9,_0x1da815);};}exports[_0x0c94('0x5')]=function(_0x1c9deb){for(var _0x191863=0x0,_0x5684bc=events[_0x0c94('0x6')];_0x191863<_0x5684bc;_0x191863++){var _0x2a6b77=events[_0x191863];var _0x5db370=createListener(_0x0c94('0x7')+_0x2a6b77,_0x1c9deb);UserEvents['on'](_0x2a6b77,_0x5db370);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 7c70a79..f1fca28 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 _0x5104=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util','path','express'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x5104,0x14d));var _0x4510=function(_0x3667a4,_0x1ff999){_0x3667a4=_0x3667a4-0x0;var _0x5c8e56=_0x5104[_0x3667a4];return _0x5c8e56;};'use strict';var multer=require('multer');var util=require(_0x4510('0x0'));var path=require(_0x4510('0x1'));var timeout=require('connect-timeout');var express=require(_0x4510('0x2'));var router=express[_0x4510('0x3')]();var auth=require(_0x4510('0x4'));var interaction=require(_0x4510('0x5'));var config=require(_0x4510('0x6'));module['exports']=router; \ No newline at end of file +var _0x4ff2=['../../config/environment','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x515275,_0x13454b){var _0x15ff38=function(_0x1bdafb){while(--_0x1bdafb){_0x515275['push'](_0x515275['shift']());}};_0x15ff38(++_0x13454b);}(_0x4ff2,0xba));var _0x24ff=function(_0x4e0c67,_0x5bc8e3){_0x4e0c67=_0x4e0c67-0x0;var _0x3455e5=_0x4ff2[_0x4e0c67];return _0x3455e5;};'use strict';var multer=require(_0x24ff('0x0'));var util=require(_0x24ff('0x1'));var path=require(_0x24ff('0x2'));var timeout=require(_0x24ff('0x3'));var express=require(_0x24ff('0x4'));var router=express['Router']();var auth=require(_0x24ff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x24ff('0x6'));module[_0x24ff('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index e519084..c69886e 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x5341cd,_0x4d5246){var _0x5884b0=function(_0x20b671){while(--_0x20b671){_0x5341cd['push'](_0x5341cd['shift']());}};_0x5884b0(++_0x4d5246);}(_0xe706,0xa3));var _0x6e70=function(_0x133990,_0x334b7a){_0x133990=_0x133990-0x0;var _0x176242=_0xe706[_0x133990];return _0x176242;};'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(_0x3f3bad,_0x193f06){var _0x4f0801=function(_0x5cfd32){while(--_0x5cfd32){_0x3f3bad['push'](_0x3f3bad['shift']());}};_0x4f0801(++_0x193f06);}(_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 diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 331f5ab..400bc5c 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 _0xf41c=['moment','bluebird','rimraf','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0xf41c,0x7f));var _0xcf41=function(_0x3d894a,_0x50aaec){_0x3d894a=_0x3d894a-0x0;var _0x2f8e2f=_0xf41c[_0x3d894a];return _0x2f8e2f;};'use strict';var _=require(_0xcf41('0x0'));var util=require('util');var logger=require(_0xcf41('0x1'))(_0xcf41('0x2'));var moment=require(_0xcf41('0x3'));var BPromise=require(_0xcf41('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcf41('0x5'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0xcf41('0x6')]=function(_0x50da2c,_0x533437){return _0x50da2c[_0xcf41('0x7')](_0xcf41('0x8'),attributes,{'tableName':_0xcf41('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bab=['bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','util','../../config/logger','api','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4bab,0xc8));var _0xb4ba=function(_0x824aac,_0x1ee358){_0x824aac=_0x824aac-0x0;var _0x17418e=_0x4bab[_0x824aac];return _0x17418e;};'use strict';var _=require('lodash');var util=require(_0xb4ba('0x0'));var logger=require(_0xb4ba('0x1'))(_0xb4ba('0x2'));var moment=require(_0xb4ba('0x3'));var BPromise=require(_0xb4ba('0x4'));var rp=require(_0xb4ba('0x5'));var fs=require('fs');var path=require(_0xb4ba('0x6'));var rimraf=require(_0xb4ba('0x7'));var config=require('../../config/environment');var attributes=require(_0xb4ba('0x8'));module[_0xb4ba('0x9')]=function(_0x1621cc,_0x53a860){return _0x1621cc[_0xb4ba('0xa')](_0xb4ba('0xb'),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 8a70fec..cd2b2e7 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 _0xe5ba=['then','info','UserChatQueue,\x20%s,\x20%s','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x6bd7b5,_0x50a64b){var _0x3af34d=function(_0x224b56){while(--_0x224b56){_0x6bd7b5['push'](_0x6bd7b5['shift']());}};_0x3af34d(++_0x50a64b);}(_0xe5ba,0xe3));var _0xae5b=function(_0x15abbf,_0x48a1b7){_0x15abbf=_0x15abbf-0x0;var _0x48ca61=_0xe5ba[_0x15abbf];return _0x48ca61;};'use strict';var _=require(_0xae5b('0x0'));var util=require(_0xae5b('0x1'));var moment=require(_0xae5b('0x2'));var BPromise=require(_0xae5b('0x3'));var rs=require(_0xae5b('0x4'));var fs=require('fs');var Redis=require(_0xae5b('0x5'));var db=require(_0xae5b('0x6'))['db'];var utils=require(_0xae5b('0x7'));var logger=require(_0xae5b('0x8'))(_0xae5b('0x9'));var config=require(_0xae5b('0xa'));var jayson=require(_0xae5b('0xb'));var client=jayson[_0xae5b('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eb212,_0x38a468,_0x21f1ec){return new BPromise(function(_0x150df9,_0x319f87){return client['request'](_0x5eb212,_0x21f1ec)[_0xae5b('0xd')](function(_0x21af33){logger[_0xae5b('0xe')](_0xae5b('0xf'),_0x38a468,'request\x20sent');logger['debug'](_0xae5b('0x10'),_0x38a468,'request\x20sent',JSON[_0xae5b('0x11')](_0x21af33));if(_0x21af33[_0xae5b('0x12')]){if(_0x21af33[_0xae5b('0x12')][_0xae5b('0x13')]===0x1f4){logger[_0xae5b('0x12')](_0xae5b('0xf'),_0x38a468,_0x21af33[_0xae5b('0x12')]['message']);return _0x319f87(_0x21af33[_0xae5b('0x12')][_0xae5b('0x14')]);}logger[_0xae5b('0x12')](_0xae5b('0xf'),_0x38a468,_0x21af33['error'][_0xae5b('0x14')]);return _0x150df9(_0x21af33[_0xae5b('0x12')][_0xae5b('0x14')]);}else{logger[_0xae5b('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x38a468,_0xae5b('0x15'));_0x150df9(_0x21af33[_0xae5b('0x16')][_0xae5b('0x14')]);}})[_0xae5b('0x17')](function(_0xb01084){logger[_0xae5b('0x12')](_0xae5b('0xf'),_0x38a468,_0xb01084);_0x319f87(_0xb01084);});});} \ No newline at end of file +var _0xb800=['bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','http','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x112d20,_0x4bd3b6){var _0x48c4ce=function(_0x4715da){while(--_0x4715da){_0x112d20['push'](_0x112d20['shift']());}};_0x48c4ce(++_0x4bd3b6);}(_0xb800,0x96));var _0x0b80=function(_0x2e4ac7,_0x1b4ecb){_0x2e4ac7=_0x2e4ac7-0x0;var _0x2ecd62=_0xb800[_0x2e4ac7];return _0x2ecd62;};'use strict';var _=require(_0x0b80('0x0'));var util=require(_0x0b80('0x1'));var moment=require(_0x0b80('0x2'));var BPromise=require(_0x0b80('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0b80('0x4'));var logger=require(_0x0b80('0x5'))(_0x0b80('0x6'));var config=require(_0x0b80('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0b80('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1cd35b,_0xd40f3a,_0x54d2ce){return new BPromise(function(_0x2fc965,_0x44269c){return client['request'](_0x1cd35b,_0x54d2ce)['then'](function(_0x2af0a9){logger['info'](_0x0b80('0x9'),_0xd40f3a,_0x0b80('0xa'));logger['debug'](_0x0b80('0xb'),_0xd40f3a,_0x0b80('0xa'),JSON['stringify'](_0x2af0a9));if(_0x2af0a9[_0x0b80('0xc')]){if(_0x2af0a9[_0x0b80('0xc')][_0x0b80('0xd')]===0x1f4){logger[_0x0b80('0xc')]('UserChatQueue,\x20%s,\x20%s',_0xd40f3a,_0x2af0a9[_0x0b80('0xc')][_0x0b80('0xe')]);return _0x44269c(_0x2af0a9[_0x0b80('0xc')]['message']);}logger[_0x0b80('0xc')]('UserChatQueue,\x20%s,\x20%s',_0xd40f3a,_0x2af0a9[_0x0b80('0xc')]['message']);return _0x2fc965(_0x2af0a9[_0x0b80('0xc')][_0x0b80('0xe')]);}else{logger['info'](_0x0b80('0x9'),_0xd40f3a,'request\x20sent');_0x2fc965(_0x2af0a9[_0x0b80('0xf')][_0x0b80('0xe')]);}})[_0x0b80('0x10')](function(_0x2d14bd){logger[_0x0b80('0xc')]('UserChatQueue,\x20%s,\x20%s',_0xd40f3a,_0x2d14bd);_0x44269c(_0x2d14bd);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 04459f0..98da7d3 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 _0x4ea2=['Router','util','path','connect-timeout','express'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x4ea2,0x1b4));var _0x24ea=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0x4ea2[_0x2962b4];return _0x411b7d;};'use strict';var multer=require('multer');var util=require(_0x24ea('0x0'));var path=require(_0x24ea('0x1'));var timeout=require(_0x24ea('0x2'));var express=require(_0x24ea('0x3'));var router=express[_0x24ea('0x4')]();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 _0x6d34=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','multer','util'];(function(_0xebf32b,_0xd5f201){var _0x38ccaf=function(_0x11e343){while(--_0x11e343){_0xebf32b['push'](_0xebf32b['shift']());}};_0x38ccaf(++_0xd5f201);}(_0x6d34,0xa6));var _0x46d3=function(_0xc15b22,_0x321682){_0xc15b22=_0xc15b22-0x0;var _0x4025f2=_0x6d34[_0xc15b22];return _0x4025f2;};'use strict';var multer=require(_0x46d3('0x0'));var util=require(_0x46d3('0x1'));var path=require('path');var timeout=require(_0x46d3('0x2'));var express=require(_0x46d3('0x3'));var router=express[_0x46d3('0x4')]();var auth=require(_0x46d3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x46d3('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 5bd8655..cf9c953 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 _0x80ed=['INTEGER','STRING','sequelize'];(function(_0x4ec937,_0xfc25e0){var _0x249650=function(_0x50a9fd){while(--_0x50a9fd){_0x4ec937['push'](_0x4ec937['shift']());}};_0x249650(++_0xfc25e0);}(_0x80ed,0x11c));var _0xd80e=function(_0x107adb,_0x558f0a){_0x107adb=_0x107adb-0x0;var _0x5a7e5d=_0x80ed[_0x107adb];return _0x5a7e5d;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd80e('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xd80e('0x2')]}}; \ No newline at end of file +var _0x8e3f=['STRING','sequelize','exports','INTEGER'];(function(_0xa5e3bc,_0xee1e98){var _0x41cd71=function(_0x12a953){while(--_0x12a953){_0xa5e3bc['push'](_0xa5e3bc['shift']());}};_0x41cd71(++_0xee1e98);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'penalty':{'type':Sequelize[_0xf8e3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf8e3('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 3a0ffad..d1b7e8d 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 _0x6dcd=['../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x12ef45,_0x183adf){var _0x2928e4=function(_0x2579e8){while(--_0x2579e8){_0x12ef45['push'](_0x12ef45['shift']());}};_0x2928e4(++_0x183adf);}(_0x6dcd,0xa2));var _0xd6dc=function(_0xae4bcc,_0x4885d5){_0xae4bcc=_0xae4bcc-0x0;var _0x3e86cb=_0x6dcd[_0xae4bcc];return _0x3e86cb;};'use strict';var _=require('lodash');var util=require(_0xd6dc('0x0'));var logger=require('../../config/logger')(_0xd6dc('0x1'));var moment=require(_0xd6dc('0x2'));var BPromise=require(_0xd6dc('0x3'));var rp=require(_0xd6dc('0x4'));var fs=require('fs');var path=require(_0xd6dc('0x5'));var rimraf=require(_0xd6dc('0x6'));var config=require(_0xd6dc('0x7'));var attributes=require(_0xd6dc('0x8'));module[_0xd6dc('0x9')]=function(_0x18277f,_0x311f22){return _0x18277f[_0xd6dc('0xa')](_0xd6dc('0xb'),attributes,{'tableName':_0xd6dc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48b1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','api'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x48b1,0x197));var _0x148b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x148b('0x0'));var moment=require(_0x148b('0x1'));var BPromise=require(_0x148b('0x2'));var rp=require(_0x148b('0x3'));var fs=require('fs');var path=require(_0x148b('0x4'));var rimraf=require(_0x148b('0x5'));var config=require(_0x148b('0x6'));var attributes=require(_0x148b('0x7'));module[_0x148b('0x8')]=function(_0x48ab76,_0x51d487){return _0x48ab76[_0x148b('0x9')](_0x148b('0xa'),attributes,{'tableName':_0x148b('0xb'),'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 2a72ff9..48a3445 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 _0x0991=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x4f2684,_0x41d9e7){var _0x562e7f=function(_0x385cc9){while(--_0x385cc9){_0x4f2684['push'](_0x4f2684['shift']());}};_0x562e7f(++_0x41d9e7);}(_0x0991,0x175));var _0x1099=function(_0x2ffc1,_0x2fa638){_0x2ffc1=_0x2ffc1-0x0;var _0x2db08b=_0x0991[_0x2ffc1];return _0x2db08b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1099('0x0'));var BPromise=require(_0x1099('0x1'));var rs=require(_0x1099('0x2'));var fs=require('fs');var Redis=require(_0x1099('0x3'));var db=require(_0x1099('0x4'))['db'];var utils=require(_0x1099('0x5'));var logger=require('../../config/logger')(_0x1099('0x6'));var config=require(_0x1099('0x7'));var jayson=require(_0x1099('0x8'));var client=jayson[_0x1099('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34f23d,_0x322679,_0x11cf69){return new BPromise(function(_0x39024a,_0x36cf10){return client[_0x1099('0xa')](_0x34f23d,_0x11cf69)['then'](function(_0x455757){logger[_0x1099('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x322679,_0x1099('0xc'));logger[_0x1099('0xd')](_0x1099('0xe'),_0x322679,_0x1099('0xc'),JSON[_0x1099('0xf')](_0x455757));if(_0x455757['error']){if(_0x455757[_0x1099('0x10')][_0x1099('0x11')]===0x1f4){logger[_0x1099('0x10')](_0x1099('0x12'),_0x322679,_0x455757[_0x1099('0x10')][_0x1099('0x13')]);return _0x36cf10(_0x455757[_0x1099('0x10')]['message']);}logger[_0x1099('0x10')](_0x1099('0x12'),_0x322679,_0x455757[_0x1099('0x10')][_0x1099('0x13')]);return _0x39024a(_0x455757[_0x1099('0x10')]['message']);}else{logger[_0x1099('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x322679,_0x1099('0xc'));_0x39024a(_0x455757[_0x1099('0x14')][_0x1099('0x13')]);}})[_0x1099('0x15')](function(_0x4a3bde){logger[_0x1099('0x10')](_0x1099('0x12'),_0x322679,_0x4a3bde);_0x36cf10(_0x4a3bde);});});} \ No newline at end of file +var _0x25b7=['debug','stringify','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3c8e36,_0x422420){var _0x31d8a5=function(_0x5c5912){while(--_0x5c5912){_0x3c8e36['push'](_0x3c8e36['shift']());}};_0x31d8a5(++_0x422420);}(_0x25b7,0x1d4));var _0x725b=function(_0x229dea,_0x108755){_0x229dea=_0x229dea-0x0;var _0x4763a7=_0x25b7[_0x229dea];return _0x4763a7;};'use strict';var _=require(_0x725b('0x0'));var util=require('util');var moment=require(_0x725b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x725b('0x2'));var db=require(_0x725b('0x3'))['db'];var utils=require(_0x725b('0x4'));var logger=require(_0x725b('0x5'))(_0x725b('0x6'));var config=require(_0x725b('0x7'));var jayson=require(_0x725b('0x8'));var client=jayson[_0x725b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2997d2,_0xcd7a40,_0x1dffa2){return new BPromise(function(_0x19280e,_0x408c2b){return client[_0x725b('0xa')](_0x2997d2,_0x1dffa2)[_0x725b('0xb')](function(_0x2e7466){logger[_0x725b('0xc')](_0x725b('0xd'),_0xcd7a40,_0x725b('0xe'));logger[_0x725b('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0xcd7a40,_0x725b('0xe'),JSON[_0x725b('0x10')](_0x2e7466));if(_0x2e7466[_0x725b('0x11')]){if(_0x2e7466[_0x725b('0x11')][_0x725b('0x12')]===0x1f4){logger[_0x725b('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0xcd7a40,_0x2e7466[_0x725b('0x11')][_0x725b('0x13')]);return _0x408c2b(_0x2e7466['error']['message']);}logger[_0x725b('0x11')](_0x725b('0xd'),_0xcd7a40,_0x2e7466['error'][_0x725b('0x13')]);return _0x19280e(_0x2e7466[_0x725b('0x11')][_0x725b('0x13')]);}else{logger[_0x725b('0xc')](_0x725b('0xd'),_0xcd7a40,'request\x20sent');_0x19280e(_0x2e7466['result'][_0x725b('0x13')]);}})[_0x725b('0x14')](function(_0x3bd867){logger[_0x725b('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0xcd7a40,_0x3bd867);_0x408c2b(_0x3bd867);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 5eaabde..8d614ed 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 _0x390b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','connect-timeout'];(function(_0xb4cc12,_0x41436e){var _0x8593b5=function(_0x13b840){while(--_0x13b840){_0xb4cc12['push'](_0xb4cc12['shift']());}};_0x8593b5(++_0x41436e);}(_0x390b,0x132));var _0xb390=function(_0x27a39f,_0x365f12){_0x27a39f=_0x27a39f-0x0;var _0x2ed946=_0x390b[_0x27a39f];return _0x2ed946;};'use strict';var multer=require('multer');var util=require(_0xb390('0x0'));var path=require('path');var timeout=require(_0xb390('0x1'));var express=require('express');var router=express[_0xb390('0x2')]();var auth=require(_0xb390('0x3'));var interaction=require(_0xb390('0x4'));var config=require(_0xb390('0x5'));module[_0xb390('0x6')]=router; \ No newline at end of file +var _0x4dbc=['../../components/interaction/service','../../config/environment','exports','multer','path','Router'];(function(_0x25865d,_0x2ffb6b){var _0x13927c=function(_0x1e069a){while(--_0x1e069a){_0x25865d['push'](_0x25865d['shift']());}};_0x13927c(++_0x2ffb6b);}(_0x4dbc,0x6f));var _0xc4db=function(_0x29fe42,_0xfce7a2){_0x29fe42=_0x29fe42-0x0;var _0x2123c5=_0x4dbc[_0x29fe42];return _0x2123c5;};'use strict';var multer=require(_0xc4db('0x0'));var util=require('util');var path=require(_0xc4db('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc4db('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xc4db('0x3'));var config=require(_0xc4db('0x4'));module[_0xc4db('0x5')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 8c7bf0c..e82f04c 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x14599f,_0x467506){var _0x39df78=function(_0x7369cb){while(--_0x7369cb){_0x14599f['push'](_0x14599f['shift']());}};_0x39df78(++_0x467506);}(_0xe706,0xa3));var _0x6e70=function(_0x187f4b,_0x12fd52){_0x187f4b=_0x187f4b-0x0;var _0x132087=_0xe706[_0x187f4b];return _0x132087;};'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(_0x5bafd3,_0x474626){var _0x4aeb83=function(_0x4ab61a){while(--_0x4ab61a){_0x5bafd3['push'](_0x5bafd3['shift']());}};_0x4aeb83(++_0x474626);}(_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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 1923b8b..832ff54 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 _0x757a=['define','user_has_mail_queues','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0x757a,0xde));var _0xa757=function(_0x47db1e,_0x7dfcbb){_0x47db1e=_0x47db1e-0x0;var _0x1f3573=_0x757a[_0x47db1e];return _0x1f3573;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('UserMailQueue',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x1d5d93,_0x4847cb){var _0x5659d0=function(_0x1e485f){while(--_0x1e485f){_0x1d5d93['push'](_0x1d5d93['shift']());}};_0x5659d0(++_0x4847cb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xb7e7[_0x68ee8b];return _0x5148f7;};'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':'user_has_mail_queues','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 19e9ff7..1392c70 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 _0x7ae8=['jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0x7ae8,0x142));var _0x87ae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ae8[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x87ae('0x0'));var moment=require('moment');var BPromise=require(_0x87ae('0x1'));var rs=require(_0x87ae('0x2'));var fs=require('fs');var Redis=require(_0x87ae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x87ae('0x4'));var logger=require(_0x87ae('0x5'))(_0x87ae('0x6'));var config=require(_0x87ae('0x7'));var jayson=require(_0x87ae('0x8'));var client=jayson[_0x87ae('0x9')][_0x87ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22bb85,_0x18f38b,_0x4c9b61){return new BPromise(function(_0x2ee482,_0x4c6ab1){return client[_0x87ae('0xb')](_0x22bb85,_0x4c9b61)[_0x87ae('0xc')](function(_0x2bd586){logger[_0x87ae('0xd')](_0x87ae('0xe'),_0x18f38b,'request\x20sent');logger[_0x87ae('0xf')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x18f38b,_0x87ae('0x10'),JSON[_0x87ae('0x11')](_0x2bd586));if(_0x2bd586['error']){if(_0x2bd586[_0x87ae('0x12')]['code']===0x1f4){logger[_0x87ae('0x12')](_0x87ae('0xe'),_0x18f38b,_0x2bd586[_0x87ae('0x12')][_0x87ae('0x13')]);return _0x4c6ab1(_0x2bd586[_0x87ae('0x12')][_0x87ae('0x13')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x18f38b,_0x2bd586[_0x87ae('0x12')]['message']);return _0x2ee482(_0x2bd586['error']['message']);}else{logger[_0x87ae('0xd')](_0x87ae('0xe'),_0x18f38b,_0x87ae('0x10'));_0x2ee482(_0x2bd586[_0x87ae('0x14')]['message']);}})[_0x87ae('0x15')](function(_0x3e7143){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x18f38b,_0x3e7143);_0x4c6ab1(_0x3e7143);});});} \ No newline at end of file +var _0x6dec=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2994ad,_0x4b699a){var _0x568906=function(_0x5da0c5){while(--_0x5da0c5){_0x2994ad['push'](_0x2994ad['shift']());}};_0x568906(++_0x4b699a);}(_0x6dec,0x10e));var _0xc6de=function(_0x4a8d52,_0x249072){_0x4a8d52=_0x4a8d52-0x0;var _0x59fc41=_0x6dec[_0x4a8d52];return _0x59fc41;};'use strict';var _=require(_0xc6de('0x0'));var util=require('util');var moment=require(_0xc6de('0x1'));var BPromise=require(_0xc6de('0x2'));var rs=require(_0xc6de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6de('0x4'));var logger=require(_0xc6de('0x5'))(_0xc6de('0x6'));var config=require(_0xc6de('0x7'));var jayson=require(_0xc6de('0x8'));var client=jayson[_0xc6de('0x9')][_0xc6de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40d494,_0x2468e3,_0x41ced9){return new BPromise(function(_0x12d686,_0x285117){return client[_0xc6de('0xb')](_0x40d494,_0x41ced9)[_0xc6de('0xc')](function(_0x3e57a1){logger[_0xc6de('0xd')](_0xc6de('0xe'),_0x2468e3,'request\x20sent');logger[_0xc6de('0xf')](_0xc6de('0x10'),_0x2468e3,_0xc6de('0x11'),JSON[_0xc6de('0x12')](_0x3e57a1));if(_0x3e57a1[_0xc6de('0x13')]){if(_0x3e57a1['error'][_0xc6de('0x14')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x2468e3,_0x3e57a1[_0xc6de('0x13')][_0xc6de('0x15')]);return _0x285117(_0x3e57a1[_0xc6de('0x13')][_0xc6de('0x15')]);}logger[_0xc6de('0x13')](_0xc6de('0xe'),_0x2468e3,_0x3e57a1[_0xc6de('0x13')]['message']);return _0x12d686(_0x3e57a1[_0xc6de('0x13')][_0xc6de('0x15')]);}else{logger[_0xc6de('0xd')](_0xc6de('0xe'),_0x2468e3,'request\x20sent');_0x12d686(_0x3e57a1[_0xc6de('0x16')][_0xc6de('0x15')]);}})[_0xc6de('0x17')](function(_0x3173c5){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x2468e3,_0x3173c5);_0x285117(_0x3173c5);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index c54eb7d..b05478a 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2b0=['sendUserNotification','exports','Router','../../config/environment','post'];(function(_0x568ada,_0x528f0d){var _0xad83a3=function(_0x31a820){while(--_0x31a820){_0x568ada['push'](_0x568ada['shift']());}};_0xad83a3(++_0x528f0d);}(_0xe2b0,0xe8));var _0x0e2b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe2b0[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e2b('0x0')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e2b('0x1'));var controller=require('./userNotification.controller');router[_0x0e2b('0x2')]('/',auth['isAuthenticated'](),controller[_0x0e2b('0x3')]);module[_0x0e2b('0x4')]=router; \ No newline at end of file +var _0x6443=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','exports'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0x6443,0x150));var _0x3644=function(_0xee2e7a,_0x58354d){_0xee2e7a=_0xee2e7a-0x0;var _0x319dd3=_0x6443[_0xee2e7a];return _0x319dd3;};'use strict';var multer=require(_0x3644('0x0'));var util=require(_0x3644('0x1'));var path=require(_0x3644('0x2'));var timeout=require(_0x3644('0x3'));var express=require(_0x3644('0x4'));var router=express['Router']();var auth=require(_0x3644('0x5'));var interaction=require(_0x3644('0x6'));var config=require(_0x3644('0x7'));var controller=require(_0x3644('0x8'));router[_0x3644('0x9')]('/',auth[_0x3644('0xa')](),controller['sendUserNotification']);module[_0x3644('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 70c20bb..073f222 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95f1=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x4db11d,_0x379a8f){var _0x2eedf3=function(_0x46c0bb){while(--_0x46c0bb){_0x4db11d['push'](_0x4db11d['shift']());}};_0x2eedf3(++_0x379a8f);}(_0x95f1,0x117));var _0x195f=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x95f1[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0x195f('0x0'));module[_0x195f('0x1')]={'body':{'type':Sequelize[_0x195f('0x2')]},'senderName':{'type':Sequelize[_0x195f('0x3')]},'recipientsId':{'type':Sequelize[_0x195f('0x2')]},'recipientsDescription':{'type':Sequelize[_0x195f('0x3')]},'beep':{'type':Sequelize[_0x195f('0x4')]}}; \ No newline at end of file +var _0xb6cd=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x5b6074,_0x450867){var _0xcadf37=function(_0x134c0a){while(--_0x134c0a){_0x5b6074['push'](_0x5b6074['shift']());}};_0xcadf37(++_0x450867);}(_0xb6cd,0xab));var _0xdb6c=function(_0x2292e1,_0x2e8920){_0x2292e1=_0x2292e1-0x0;var _0x284dc0=_0xb6cd[_0x2292e1];return _0x284dc0;};'use strict';var Sequelize=require(_0xdb6c('0x0'));module[_0xdb6c('0x1')]={'body':{'type':Sequelize[_0xdb6c('0x2')]},'senderName':{'type':Sequelize[_0xdb6c('0x3')]},'recipientsId':{'type':Sequelize[_0xdb6c('0x2')]},'recipientsDescription':{'type':Sequelize[_0xdb6c('0x3')]},'beep':{'type':Sequelize[_0xdb6c('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 709acb7..61c0744 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6091=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','count','offset','limit','status','set','Content-Range','json','reject','save','update','then','end','error','stack','name','sendUserNotification','hasOwnProperty','text','body','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','smsqueue','voicequeue','team','some','includes','model','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','user','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','catch','startCase','toLowerCase','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring'];(function(_0x44aae1,_0x225e5b){var _0x3d312f=function(_0x22998a){while(--_0x22998a){_0x44aae1['push'](_0x44aae1['shift']());}};_0x3d312f(++_0x225e5b);}(_0x6091,0xb7));var _0x1609=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6091[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x1609('0x0'));var emlformat=require(_0x1609('0x1'));var rimraf=require(_0x1609('0x2'));var zipdir=require(_0x1609('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1609('0x4'));var moment=require(_0x1609('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1609('0x6'));var util=require(_0x1609('0x7'));var path=require(_0x1609('0x8'));var sox=require(_0x1609('0x9'));var csv=require(_0x1609('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1609('0xb'));var squel=require(_0x1609('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1609('0xd'));var toCsv=require(_0x1609('0xa'));var querystring=require(_0x1609('0xe'));var Papa=require('papaparse');var Redis=require(_0x1609('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1609('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1609('0x11'));var logger=require(_0x1609('0x12'))(_0x1609('0x13'));var utils=require(_0x1609('0x14'));var config=require(_0x1609('0x15'));var licenseUtil=require(_0x1609('0x16'));var db=require(_0x1609('0x17'))['db'];config[_0x1609('0x18')]=_[_0x1609('0x19')](config[_0x1609('0x18')],{'host':_0x1609('0x1a'),'port':0x18eb});var socket=require(_0x1609('0x1b'))(new Redis(config['redis']));require(_0x1609('0x1c'))['register'](socket);function respondWithStatusCode(_0x8a3910,_0x1d366b){_0x1d366b=_0x1d366b||0xcc;return function(_0x55aa97){if(_0x55aa97){return _0x8a3910[_0x1609('0x1d')](_0x1d366b);}return _0x8a3910['status'](_0x1d366b)['end']();};}function respondWithResult(_0x57b6ec,_0x352f98){_0x352f98=_0x352f98||0xc8;return function(_0x5ad354){if(_0x5ad354){return _0x57b6ec['status'](_0x352f98)['json'](_0x5ad354);}};}function respondWithFilteredResult(_0x123323,_0x386f74){return function(_0x990986){if(_0x990986){var _0x3e59e4=_0x990986[_0x1609('0x1e')],_0x140d50=_0x386f74[_0x1609('0x1f')],_0x3c86bf=_0x386f74[_0x1609('0x1f')]+_0x386f74[_0x1609('0x20')],_0x3f114a;if(_0x3c86bf>=_0x3e59e4){_0x3c86bf=_0x3e59e4;_0x3f114a=0xc8;}else{_0x3f114a=0xce;}_0x123323[_0x1609('0x21')](_0x3f114a);return _0x123323[_0x1609('0x22')](_0x1609('0x23'),_0x140d50+'-'+_0x3c86bf+'/'+_0x3e59e4)[_0x1609('0x24')](_0x990986);}return null;};}function patchUpdates(_0x1335c7){return function(_0x5967c2){try{jsonpatch['apply'](_0x5967c2,_0x1335c7,!![]);}catch(_0x5af4d3){return BPromise[_0x1609('0x25')](_0x5af4d3);}return _0x5967c2[_0x1609('0x26')]();};}function saveUpdates(_0x715af,_0xa24316){return function(_0x4457c0){if(_0x4457c0){return _0x4457c0[_0x1609('0x27')](_0x715af)[_0x1609('0x28')](function(_0x4bb064){return _0x4bb064;});}return null;};}function removeEntity(_0x34a86a,_0x3b1fe7){return function(_0x2c546e){if(_0x2c546e){return _0x2c546e['destroy']()[_0x1609('0x28')](function(){_0x34a86a[_0x1609('0x21')](0xcc)[_0x1609('0x29')]();});}};}function handleEntityNotFound(_0x46ced3,_0x5caca4){return function(_0x54fa12){if(!_0x54fa12){_0x46ced3[_0x1609('0x1d')](0x194);}return _0x54fa12;};}function handleError(_0x4f84b5,_0x56234e){_0x56234e=_0x56234e||0x1f4;return function(_0x23ca6c){logger[_0x1609('0x2a')](_0x23ca6c[_0x1609('0x2b')]);if(_0x23ca6c[_0x1609('0x2c')]){delete _0x23ca6c[_0x1609('0x2c')];}_0x4f84b5[_0x1609('0x21')](_0x56234e)['send'](_0x23ca6c);};}exports[_0x1609('0x2d')]=function(_0xc4f92,_0x3c05a5,_0x3bd8f9){if(!_0xc4f92['body'][_0x1609('0x2e')](_0x1609('0x2f'))&&!_0xc4f92[_0x1609('0x30')][_0x1609('0x2e')]('TemplateId')){throw new db[(_0x1609('0x31'))][(_0x1609('0x32'))](_0x1609('0x33'));}else{if(_0xc4f92[_0x1609('0x30')][_0x1609('0x2e')](_0x1609('0x34'))&&!_0xc4f92[_0x1609('0x30')]['hasOwnProperty'](_0x1609('0x35'))){throw new db[(_0x1609('0x31'))][(_0x1609('0x32'))](_0x1609('0x36'));}if(!_0xc4f92['body'][_0x1609('0x2e')](_0x1609('0x37'))){throw new db[(_0x1609('0x31'))][(_0x1609('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x24ef7f=JSON[_0x1609('0x38')](_0xc4f92[_0x1609('0x30')]['recipients']);}catch(_0x52b2e7){logger[_0x1609('0x2a')](_0x52b2e7);throw new db['Sequelize']['ValidationError'](_0x1609('0x39'));}var _0x1cf73c=[_0x1609('0x3a'),'faxqueue','mailqueue',_0x1609('0x3b'),_0x1609('0x3c'),_0x1609('0x3d'),'whatsappqueue',_0x1609('0x3e'),'user'];if(_[_0x1609('0x3f')](_0x24ef7f,function(_0x155ed2){return!_[_0x1609('0x40')](_0x1cf73c,_0x155ed2[_0x1609('0x41')]['toLowerCase']());})){throw new db[(_0x1609('0x31'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x564e6c={};_0x564e6c[_0x1609('0x42')]=_0xc4f92['body']['hasOwnProperty'](_0x1609('0x42'))?_0xc4f92[_0x1609('0x30')][_0x1609('0x42')]:_0xc4f92['user'][_0x1609('0x43')];_0x564e6c['recipientsDescription']=_[_0x1609('0x44')](_0xc4f92[_0x1609('0x30')][_0x1609('0x45')])?null:_0xc4f92['body'][_0x1609('0x45')];_0x564e6c[_0x1609('0x46')]=_0xc4f92['body'][_0x1609('0x46')]||![];_0x564e6c[_0x1609('0x47')]=_0xc4f92[_0x1609('0x48')]['id'];return getContent(_0xc4f92[_0x1609('0x30')])['then'](function(_0x41f381){_0x564e6c[_0x1609('0x30')]=_0x41f381;return getRecipients(_0x24ef7f);})[_0x1609('0x28')](function(_0x2e0f0a){_0x564e6c['recipientsId']=_[_0x1609('0x49')](_0x2e0f0a)[_0x1609('0x4a')](',');return db[_0x1609('0x4b')][_0x1609('0x4c')](function(_0x352e59){return db[_0x1609('0x4d')][_0x1609('0x4e')](_0x564e6c,{'raw':!![],'transaction':_0x352e59})[_0x1609('0x28')](function(_0x17b9ea){var _0x426cf2={'sender':_0x564e6c['senderName'],'description':_0x564e6c[_0x1609('0x45')],'content':_0x564e6c[_0x1609('0x30')],'beep':_0x564e6c[_0x1609('0x46')]};_0x2e0f0a[_0x1609('0x4f')](function(_0x5e08a8){_0x426cf2[_0x1609('0x50')]=_0x5e08a8;socket[_0x1609('0x51')]('userNotification:send',_0x426cf2);});return _0x17b9ea;});});})[_0x1609('0x28')](respondWithResult(_0x3c05a5,0xc9))['catch'](handleError(_0x3c05a5,null));};function getContent(_0x5946e7){return new BPromise(function(_0x1a2187,_0x2ef31e){if(_0x5946e7[_0x1609('0x2f')]){_0x1a2187(_0x5946e7[_0x1609('0x2f')]);return;}return db[_0x1609('0x52')][_0x1609('0x53')]({'attributes':['html'],'where':{'id':_0x5946e7['TemplateId']},'raw':!![]})[_0x1609('0x28')](function(_0xbbc604){if(!_0xbbc604)throw new db[(_0x1609('0x31'))]['ValidationError'](_0x1609('0x54'));var _0x18d775=Mustache['render'](_0xbbc604[_0x1609('0x55')],_0x5946e7[_0x1609('0x35')]);_0x1a2187(_0x18d775);})[_0x1609('0x56')](function(_0x248060){_0x2ef31e(_0x248060);});});}function getRecipients(_0x41580a){return new BPromise(function(_0x367a67,_0x4e7b90){var _0x487787=[];var _0x50b3ac=[];_0x41580a[_0x1609('0x4f')](function(_0x5ac736){var _0x59c83c=_[_0x1609('0x57')](_0x5ac736[_0x1609('0x41')][_0x1609('0x58')]());if(_0x59c83c===_0x1609('0x59')){_0x487787=_[_0x1609('0x5a')](_0x487787,_0x5ac736[_0x1609('0x5b')]);}else{if(_['includes'](_0x59c83c,_0x1609('0x5c')))_0x59c83c=_0x59c83c[_0x1609('0x5d')]('queue',_0x1609('0x5e'));_0x5ac736[_0x1609('0x5b')][_0x1609('0x4f')](function(_0x2ecdc2){_0x50b3ac[_0x1609('0x5f')](getAgents(_0x59c83c,_0x2ecdc2));});}});return BPromise[_0x1609('0x60')](_0x50b3ac)[_0x1609('0x28')](function(_0x28e9a9){_0x487787=_[_0x1609('0x5a')](_0x487787,_[_0x1609('0x61')](_0x28e9a9));_0x367a67(_0x487787);})[_0x1609('0x56')](function(_0x3518ac){_0x4e7b90(_0x3518ac);});});}function getAgents(_0x345e26,_0x40a886){return new BPromise(function(_0x597059,_0x4a5841){return db[_0x345e26][_0x1609('0x53')]({'where':{'id':_0x40a886}})[_0x1609('0x28')](function(_0x5a24da){return _0x5a24da[_0x1609('0x62')]({'attributes':['id'],'raw':!![]})[_0x1609('0x28')](function(_0x516c74){var _0x4986a8=_['map'](_0x516c74,'id');_0x597059(_0x4986a8);});})['catch'](function(_0x39330c){_0x4a5841(_0x39330c);});});} \ No newline at end of file +var _0x33e8=['TemplateId','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','parse','error','ValidationError','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','ids','replace','queue','Queue','push','all','union','flatten','getAgents','map','eml-format','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','sendUserNotification','body','hasOwnProperty','text','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x33e8,0x9c));var _0x833e=function(_0xee1eae,_0x1a60d1){_0xee1eae=_0xee1eae-0x0;var _0x5161a3=_0x33e8[_0xee1eae];return _0x5161a3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x833e('0x0'));var rimraf=require(_0x833e('0x1'));var zipdir=require(_0x833e('0x2'));var jsonpatch=require(_0x833e('0x3'));var rp=require(_0x833e('0x4'));var moment=require(_0x833e('0x5'));var BPromise=require(_0x833e('0x6'));var Mustache=require(_0x833e('0x7'));var util=require('util');var path=require('path');var sox=require(_0x833e('0x8'));var csv=require(_0x833e('0x9'));var ejs=require(_0x833e('0xa'));var fs=require('fs');var _=require(_0x833e('0xb'));var squel=require('squel');var crypto=require(_0x833e('0xc'));var jsforce=require(_0x833e('0xd'));var deskjs=require(_0x833e('0xe'));var toCsv=require(_0x833e('0x9'));var querystring=require(_0x833e('0xf'));var Papa=require(_0x833e('0x10'));var Redis=require(_0x833e('0x11'));var authService=require(_0x833e('0x12'));var qs=require(_0x833e('0x13'));var as=require(_0x833e('0x14'));var hardwareService=require(_0x833e('0x15'));var logger=require(_0x833e('0x16'))(_0x833e('0x17'));var utils=require(_0x833e('0x18'));var config=require(_0x833e('0x19'));var licenseUtil=require(_0x833e('0x1a'));var db=require(_0x833e('0x1b'))['db'];config[_0x833e('0x1c')]=_['defaults'](config['redis'],{'host':_0x833e('0x1d'),'port':0x18eb});var socket=require(_0x833e('0x1e'))(new Redis(config[_0x833e('0x1c')]));require('./userNotification.socket')[_0x833e('0x1f')](socket);function respondWithStatusCode(_0xc302f8,_0x26022f){_0x26022f=_0x26022f||0xcc;return function(_0x474277){if(_0x474277){return _0xc302f8[_0x833e('0x20')](_0x26022f);}return _0xc302f8[_0x833e('0x21')](_0x26022f)[_0x833e('0x22')]();};}function respondWithResult(_0x32474d,_0x490186){_0x490186=_0x490186||0xc8;return function(_0x3213de){if(_0x3213de){return _0x32474d['status'](_0x490186)[_0x833e('0x23')](_0x3213de);}};}function respondWithFilteredResult(_0x3cc17b,_0x342d03){return function(_0x194471){if(_0x194471){var _0x924f7=_0x194471[_0x833e('0x24')],_0x10c703=_0x342d03[_0x833e('0x25')],_0xb9c2e2=_0x342d03['offset']+_0x342d03['limit'],_0x111fb0;if(_0xb9c2e2>=_0x924f7){_0xb9c2e2=_0x924f7;_0x111fb0=0xc8;}else{_0x111fb0=0xce;}_0x3cc17b[_0x833e('0x21')](_0x111fb0);return _0x3cc17b[_0x833e('0x26')](_0x833e('0x27'),_0x10c703+'-'+_0xb9c2e2+'/'+_0x924f7)[_0x833e('0x23')](_0x194471);}return null;};}function patchUpdates(_0x43c462){return function(_0xdb4f8e){try{jsonpatch[_0x833e('0x28')](_0xdb4f8e,_0x43c462,!![]);}catch(_0x5a1eb7){return BPromise[_0x833e('0x29')](_0x5a1eb7);}return _0xdb4f8e[_0x833e('0x2a')]();};}function saveUpdates(_0x5a498c,_0x2c26a2){return function(_0x19f7c0){if(_0x19f7c0){return _0x19f7c0[_0x833e('0x2b')](_0x5a498c)[_0x833e('0x2c')](function(_0x962b3d){return _0x962b3d;});}return null;};}function removeEntity(_0x121615,_0x3eff18){return function(_0x3fc8b7){if(_0x3fc8b7){return _0x3fc8b7[_0x833e('0x2d')]()['then'](function(){_0x121615[_0x833e('0x21')](0xcc)[_0x833e('0x22')]();});}};}function handleEntityNotFound(_0xee8545,_0x19ae20){return function(_0x43d4dd){if(!_0x43d4dd){_0xee8545[_0x833e('0x20')](0x194);}return _0x43d4dd;};}function handleError(_0x328715,_0x261add){_0x261add=_0x261add||0x1f4;return function(_0x1ae1f7){logger['error'](_0x1ae1f7[_0x833e('0x2e')]);if(_0x1ae1f7[_0x833e('0x2f')]){delete _0x1ae1f7[_0x833e('0x2f')];}_0x328715[_0x833e('0x21')](_0x261add)[_0x833e('0x30')](_0x1ae1f7);};}exports[_0x833e('0x31')]=function(_0xb4094e,_0x306565,_0x3bd4a9){if(!_0xb4094e[_0x833e('0x32')][_0x833e('0x33')](_0x833e('0x34'))&&!_0xb4094e[_0x833e('0x32')][_0x833e('0x33')]('TemplateId')){throw new db['Sequelize']['ValidationError'](_0x833e('0x35'));}else{if(_0xb4094e[_0x833e('0x32')]['hasOwnProperty'](_0x833e('0x36'))&&!_0xb4094e[_0x833e('0x32')]['hasOwnProperty'](_0x833e('0x37'))){throw new db[(_0x833e('0x38'))]['ValidationError'](_0x833e('0x39'));}if(!_0xb4094e[_0x833e('0x32')][_0x833e('0x33')](_0x833e('0x3a'))){throw new db[(_0x833e('0x38'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x1dea7e=JSON[_0x833e('0x3b')](_0xb4094e['body'][_0x833e('0x3a')]);}catch(_0x12a519){logger[_0x833e('0x3c')](_0x12a519);throw new db[(_0x833e('0x38'))][(_0x833e('0x3d'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x41d529=[_0x833e('0x3e'),_0x833e('0x3f'),'mailqueue',_0x833e('0x40'),_0x833e('0x41'),_0x833e('0x42'),_0x833e('0x43'),_0x833e('0x44'),_0x833e('0x45')];if(_[_0x833e('0x46')](_0x1dea7e,function(_0x45f7ca){return!_[_0x833e('0x47')](_0x41d529,_0x45f7ca[_0x833e('0x48')][_0x833e('0x49')]());})){throw new db[(_0x833e('0x38'))][(_0x833e('0x3d'))](_0x833e('0x4a'));}}}var _0x18b644={};_0x18b644[_0x833e('0x4b')]=_0xb4094e['body'][_0x833e('0x33')](_0x833e('0x4b'))?_0xb4094e[_0x833e('0x32')][_0x833e('0x4b')]:_0xb4094e[_0x833e('0x45')][_0x833e('0x4c')];_0x18b644[_0x833e('0x4d')]=_[_0x833e('0x4e')](_0xb4094e[_0x833e('0x32')][_0x833e('0x4d')])?null:_0xb4094e[_0x833e('0x32')][_0x833e('0x4d')];_0x18b644[_0x833e('0x4f')]=_0xb4094e[_0x833e('0x32')][_0x833e('0x4f')]||![];_0x18b644[_0x833e('0x50')]=_0xb4094e[_0x833e('0x45')]['id'];return getContent(_0xb4094e[_0x833e('0x32')])[_0x833e('0x2c')](function(_0x1400de){_0x18b644['body']=_0x1400de;return getRecipients(_0x1dea7e);})['then'](function(_0x3fac55){_0x18b644['recipientsId']=_[_0x833e('0x51')](_0x3fac55)[_0x833e('0x52')](',');return db[_0x833e('0x53')][_0x833e('0x54')](function(_0x2752a0){return db['UserNotification']['create'](_0x18b644,{'raw':!![],'transaction':_0x2752a0})[_0x833e('0x2c')](function(_0x2972a1){var _0x508827={'sender':_0x18b644[_0x833e('0x4b')],'description':_0x18b644['recipientsDescription'],'content':_0x18b644[_0x833e('0x32')],'beep':_0x18b644[_0x833e('0x4f')]};_0x3fac55[_0x833e('0x55')](function(_0x14e338){_0x508827[_0x833e('0x56')]=_0x14e338;socket[_0x833e('0x57')](_0x833e('0x58'),_0x508827);});return _0x2972a1;});});})['then'](respondWithResult(_0x306565,0xc9))[_0x833e('0x59')](handleError(_0x306565,null));};function getContent(_0x5eae3e){return new BPromise(function(_0x5203ad,_0x35687b){if(_0x5eae3e['text']){_0x5203ad(_0x5eae3e['text']);return;}return db[_0x833e('0x5a')][_0x833e('0x5b')]({'attributes':[_0x833e('0x5c')],'where':{'id':_0x5eae3e[_0x833e('0x36')]},'raw':!![]})['then'](function(_0x42e9ef){if(!_0x42e9ef)throw new db[(_0x833e('0x38'))][(_0x833e('0x3d'))](_0x833e('0x5d'));var _0x53e55d=Mustache[_0x833e('0x5e')](_0x42e9ef['html'],_0x5eae3e['view']);_0x5203ad(_0x53e55d);})['catch'](function(_0x41b123){_0x35687b(_0x41b123);});});}function getRecipients(_0x4178f3){return new BPromise(function(_0x107c4a,_0x5728ec){var _0x8eebdb=[];var _0x59848b=[];_0x4178f3[_0x833e('0x55')](function(_0x117a2e){var _0x3d77e2=_['startCase'](_0x117a2e[_0x833e('0x48')][_0x833e('0x49')]());if(_0x3d77e2==='User'){_0x8eebdb=_['union'](_0x8eebdb,_0x117a2e[_0x833e('0x5f')]);}else{if(_['includes'](_0x3d77e2,'queue'))_0x3d77e2=_0x3d77e2[_0x833e('0x60')](_0x833e('0x61'),_0x833e('0x62'));_0x117a2e[_0x833e('0x5f')][_0x833e('0x55')](function(_0x2422e4){_0x59848b[_0x833e('0x63')](getAgents(_0x3d77e2,_0x2422e4));});}});return BPromise[_0x833e('0x64')](_0x59848b)['then'](function(_0x939d9f){_0x8eebdb=_[_0x833e('0x65')](_0x8eebdb,_[_0x833e('0x66')](_0x939d9f));_0x107c4a(_0x8eebdb);})[_0x833e('0x59')](function(_0x86cf83){_0x5728ec(_0x86cf83);});});}function getAgents(_0xab8996,_0x4bfc0c){return new BPromise(function(_0x4ac8e8,_0x55c24){return db[_0xab8996][_0x833e('0x5b')]({'where':{'id':_0x4bfc0c}})[_0x833e('0x2c')](function(_0xbfa782){return _0xbfa782[_0x833e('0x67')]({'attributes':['id'],'raw':!![]})['then'](function(_0xc933cf){var _0x5eb8cc=_[_0x833e('0x68')](_0xc933cf,'id');_0x4ac8e8(_0x5eb8cc);});})[_0x833e('0x59')](function(_0x2035fe){_0x55c24(_0x2035fe);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index d3af6eb..b283836 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8a8=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x16d9a5,_0x4b9380){var _0x3e0457=function(_0x66485f){while(--_0x66485f){_0x16d9a5['push'](_0x16d9a5['shift']());}};_0x3e0457(++_0x4b9380);}(_0xa8a8,0xec));var _0x8a8a=function(_0x551d32,_0x5f173d){_0x551d32=_0x551d32-0x0;var _0x1ba8a3=_0xa8a8[_0x551d32];return _0x1ba8a3;};'use strict';var EventEmitter=require(_0x8a8a('0x0'));var UserNotification=require(_0x8a8a('0x1'))['db'][_0x8a8a('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x8a8a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8a8a('0x4'),'afterDestroy':_0x8a8a('0x5')};function emitEvent(_0xf11a08){return function(_0x3ed1de,_0x45515d,_0x1cecd4){UserNotificationEvents[_0x8a8a('0x6')](_0xf11a08+':'+_0x3ed1de['id'],_0x3ed1de);UserNotificationEvents[_0x8a8a('0x6')](_0xf11a08,_0x3ed1de);_0x1cecd4(null);};}for(var e in events){if(events[_0x8a8a('0x7')](e)){var event=events[e];UserNotification[_0x8a8a('0x8')](e,emitEvent(event));}}module[_0x8a8a('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0xf2ca=['hasOwnProperty','hook','events','../../mysqldb','UserNotification','save','update','remove','emit'];(function(_0x5182ea,_0x2bd893){var _0x272482=function(_0x2fee49){while(--_0x2fee49){_0x5182ea['push'](_0x5182ea['shift']());}};_0x272482(++_0x2bd893);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0xf2ca[_0x1ad926];return _0x1b81dc;};'use strict';var EventEmitter=require(_0xaf2c('0x0'));var UserNotification=require(_0xaf2c('0x1'))['db'][_0xaf2c('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf2c('0x3'),'afterUpdate':_0xaf2c('0x4'),'afterDestroy':_0xaf2c('0x5')};function emitEvent(_0x219511){return function(_0x3a724c,_0x10c910,_0x5b8c81){UserNotificationEvents[_0xaf2c('0x6')](_0x219511+':'+_0x3a724c['id'],_0x3a724c);UserNotificationEvents[_0xaf2c('0x6')](_0x219511,_0x3a724c);_0x5b8c81(null);};}for(var e in events){if(events[_0xaf2c('0x7')](e)){var event=events[e];UserNotification[_0xaf2c('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f55f66f..9dc30be 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5fb=['bluebird','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x160477,_0x397cf1){var _0x4c32fe=function(_0x372c86){while(--_0x372c86){_0x160477['push'](_0x160477['shift']());}};_0x4c32fe(++_0x397cf1);}(_0xe5fb,0xce));var _0xbe5f=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0xe5fb[_0x5c38cd];return _0xc985ef;};'use strict';var _=require(_0xbe5f('0x0'));var util=require(_0xbe5f('0x1'));var logger=require('../../config/logger')(_0xbe5f('0x2'));var moment=require(_0xbe5f('0x3'));var BPromise=require(_0xbe5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe5f('0x5'));var rimraf=require(_0xbe5f('0x6'));var config=require(_0xbe5f('0x7'));var attributes=require(_0xbe5f('0x8'));module[_0xbe5f('0x9')]=function(_0x5b0452,_0x26347a){return _0x5b0452[_0xbe5f('0xa')](_0xbe5f('0xb'),attributes,{'tableName':_0xbe5f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe5f('0xd'),'collate':_0xbe5f('0xe')});}; \ No newline at end of file +var _0xd624=['UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','path','rimraf','../../config/environment','./userNotification.attributes','exports'];(function(_0x4b4844,_0x2f0dfb){var _0x575192=function(_0x13ee1b){while(--_0x13ee1b){_0x4b4844['push'](_0x4b4844['shift']());}};_0x575192(++_0x2f0dfb);}(_0xd624,0x124));var _0x4d62=function(_0x1e2295,_0x170dd2){_0x1e2295=_0x1e2295-0x0;var _0x2cda25=_0xd624[_0x1e2295];return _0x2cda25;};'use strict';var _=require(_0x4d62('0x0'));var util=require(_0x4d62('0x1'));var logger=require('../../config/logger')(_0x4d62('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d62('0x3'));var rimraf=require(_0x4d62('0x4'));var config=require(_0x4d62('0x5'));var attributes=require(_0x4d62('0x6'));module[_0x4d62('0x7')]=function(_0x2582df,_0x4f934c){return _0x2582df['define'](_0x4d62('0x8'),attributes,{'tableName':_0x4d62('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4d62('0xa'),'collate':_0x4d62('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 5f81da0..808c6db 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d55=['redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x328fe8,_0x3959b4){var _0x28eab1=function(_0x5b2053){while(--_0x5b2053){_0x328fe8['push'](_0x328fe8['shift']());}};_0x28eab1(++_0x3959b4);}(_0x2d55,0xa2));var _0x52d5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2d55[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x52d5('0x0'));var util=require('util');var moment=require(_0x52d5('0x1'));var BPromise=require(_0x52d5('0x2'));var rs=require(_0x52d5('0x3'));var fs=require('fs');var Redis=require(_0x52d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x52d5('0x5'));var logger=require(_0x52d5('0x6'))(_0x52d5('0x7'));var config=require(_0x52d5('0x8'));var jayson=require(_0x52d5('0x9'));var client=jayson[_0x52d5('0xa')][_0x52d5('0xb')]({'port':0x232a});config[_0x52d5('0xc')]=_[_0x52d5('0xd')](config[_0x52d5('0xc')],{'host':_0x52d5('0xe'),'port':0x18eb});var socket=require(_0x52d5('0xf'))(new Redis(config['redis']));require(_0x52d5('0x10'))[_0x52d5('0x11')](socket);function respondWithRpcPromise(_0x452e72,_0x2c75f9,_0x5e49a){return new BPromise(function(_0x4cd0d3,_0x129587){return client['request'](_0x452e72,_0x5e49a)['then'](function(_0x4f577f){logger['info']('UserNotification,\x20%s,\x20%s',_0x2c75f9,_0x52d5('0x12'));logger[_0x52d5('0x13')](_0x52d5('0x14'),_0x2c75f9,_0x52d5('0x12'),JSON[_0x52d5('0x15')](_0x4f577f));if(_0x4f577f['error']){if(_0x4f577f[_0x52d5('0x16')][_0x52d5('0x17')]===0x1f4){logger[_0x52d5('0x16')](_0x52d5('0x18'),_0x2c75f9,_0x4f577f[_0x52d5('0x16')][_0x52d5('0x19')]);return _0x129587(_0x4f577f[_0x52d5('0x16')]['message']);}logger[_0x52d5('0x16')](_0x52d5('0x18'),_0x2c75f9,_0x4f577f[_0x52d5('0x16')][_0x52d5('0x19')]);return _0x4cd0d3(_0x4f577f[_0x52d5('0x16')][_0x52d5('0x19')]);}else{logger[_0x52d5('0x1a')](_0x52d5('0x18'),_0x2c75f9,_0x52d5('0x12'));_0x4cd0d3(_0x4f577f[_0x52d5('0x1b')][_0x52d5('0x19')]);}})[_0x52d5('0x1c')](function(_0x4d514e){logger[_0x52d5('0x16')](_0x52d5('0x18'),_0x2c75f9,_0x4d514e);_0x129587(_0x4d514e);});});} \ No newline at end of file +var _0x8e61=['request','info','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register'];(function(_0x3dac6e,_0x1efffb){var _0x485d1d=function(_0x53cf9b){while(--_0x53cf9b){_0x3dac6e['push'](_0x3dac6e['shift']());}};_0x485d1d(++_0x1efffb);}(_0x8e61,0xb1));var _0x18e6=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x8e61[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x18e6('0x0'));var util=require(_0x18e6('0x1'));var moment=require(_0x18e6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18e6('0x3'));var db=require(_0x18e6('0x4'))['db'];var utils=require(_0x18e6('0x5'));var logger=require(_0x18e6('0x6'))(_0x18e6('0x7'));var config=require('../../config/environment');var jayson=require(_0x18e6('0x8'));var client=jayson[_0x18e6('0x9')][_0x18e6('0xa')]({'port':0x232a});config[_0x18e6('0xb')]=_['defaults'](config[_0x18e6('0xb')],{'host':_0x18e6('0xc'),'port':0x18eb});var socket=require(_0x18e6('0xd'))(new Redis(config[_0x18e6('0xb')]));require('./userNotification.socket')[_0x18e6('0xe')](socket);function respondWithRpcPromise(_0x2f8b3b,_0x366a14,_0x19d4b5){return new BPromise(function(_0x1ca353,_0x560db3){return client[_0x18e6('0xf')](_0x2f8b3b,_0x19d4b5)['then'](function(_0x1c480a){logger[_0x18e6('0x10')](_0x18e6('0x11'),_0x366a14,'request\x20sent');logger['debug'](_0x18e6('0x12'),_0x366a14,_0x18e6('0x13'),JSON['stringify'](_0x1c480a));if(_0x1c480a[_0x18e6('0x14')]){if(_0x1c480a[_0x18e6('0x14')][_0x18e6('0x15')]===0x1f4){logger['error'](_0x18e6('0x11'),_0x366a14,_0x1c480a['error'][_0x18e6('0x16')]);return _0x560db3(_0x1c480a[_0x18e6('0x14')][_0x18e6('0x16')]);}logger[_0x18e6('0x14')]('UserNotification,\x20%s,\x20%s',_0x366a14,_0x1c480a[_0x18e6('0x14')][_0x18e6('0x16')]);return _0x1ca353(_0x1c480a[_0x18e6('0x14')]['message']);}else{logger[_0x18e6('0x10')](_0x18e6('0x11'),_0x366a14,_0x18e6('0x13'));_0x1ca353(_0x1c480a['result'][_0x18e6('0x16')]);}})[_0x18e6('0x17')](function(_0x3cf17e){logger[_0x18e6('0x14')](_0x18e6('0x11'),_0x366a14,_0x3cf17e);_0x560db3(_0x3cf17e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index bbaaa37..b768b69 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfe7=['length','userNotification:','save','remove','emit','removeListener'];(function(_0x5df071,_0x47621e){var _0x46f17c=function(_0x48961e){while(--_0x48961e){_0x5df071['push'](_0x5df071['shift']());}};_0x46f17c(++_0x47621e);}(_0xdfe7,0xc8));var _0x7dfe=function(_0x16cd29,_0x58895a){_0x16cd29=_0x16cd29-0x0;var _0x3b29f3=_0xdfe7[_0x16cd29];return _0x3b29f3;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x7dfe('0x0'),_0x7dfe('0x1'),'update'];function createListener(_0x162e75,_0x36c721){return function(_0x388848){_0x36c721[_0x7dfe('0x2')](_0x162e75,_0x388848);};}function removeListener(_0x527490,_0x2c07d2){return function(){UserNotificationEvents[_0x7dfe('0x3')](_0x527490,_0x2c07d2);};}exports['register']=function(_0x262561){for(var _0x3d8220=0x0,_0x23d0c1=events[_0x7dfe('0x4')];_0x3d8220<_0x23d0c1;_0x3d8220++){var _0x56d67e=events[_0x3d8220];var _0x3fc0a0=createListener(_0x7dfe('0x5')+_0x56d67e,_0x262561);UserNotificationEvents['on'](_0x56d67e,_0x3fc0a0);}}; \ No newline at end of file +var _0xc21c=['update','removeListener','register','userNotification:','./userNotification.events','save'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0xc21c,0x166));var _0xcc21=function(_0xbe186c,_0x414086){_0xbe186c=_0xbe186c-0x0;var _0x2d57f6=_0xc21c[_0xbe186c];return _0x2d57f6;};'use strict';var UserNotificationEvents=require(_0xcc21('0x0'));var events=[_0xcc21('0x1'),'remove',_0xcc21('0x2')];function createListener(_0x16faaa,_0x298fd5){return function(_0x3f2c61){_0x298fd5['emit'](_0x16faaa,_0x3f2c61);};}function removeListener(_0x3e29df,_0x31bf8b){return function(){UserNotificationEvents[_0xcc21('0x3')](_0x3e29df,_0x31bf8b);};}exports[_0xcc21('0x4')]=function(_0x1ff108){for(var _0x2409e5=0x0,_0x33604a=events['length'];_0x2409e5<_0x33604a;_0x2409e5++){var _0x2676fe=events[_0x2409e5];var _0xff4686=createListener(_0xcc21('0x5')+_0x2676fe,_0x1ff108);UserNotificationEvents['on'](_0x2676fe,_0xff4686);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 4818df2..54ebc08 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 _0x13fb=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x13fb,0x134));var _0xb13f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x13fb[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0xb13f('0x0'));var path=require(_0xb13f('0x1'));var timeout=require('connect-timeout');var express=require(_0xb13f('0x2'));var router=express['Router']();var auth=require(_0xb13f('0x3'));var interaction=require(_0xb13f('0x4'));var config=require(_0xb13f('0x5'));module[_0xb13f('0x6')]=router; \ No newline at end of file +var _0x72a8=['path','Router','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x24dc1f,_0x3f69ce){var _0xbd3ad2=function(_0x5af0ee){while(--_0x5af0ee){_0x24dc1f['push'](_0x24dc1f['shift']());}};_0xbd3ad2(++_0x3f69ce);}(_0x72a8,0x12b));var _0x872a=function(_0x3adc20,_0x448f46){_0x3adc20=_0x3adc20-0x0;var _0x4a4620=_0x72a8[_0x3adc20];return _0x4a4620;};'use strict';var multer=require(_0x872a('0x0'));var util=require('util');var path=require(_0x872a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x872a('0x2')]();var auth=require(_0x872a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x872a('0x4'));module[_0x872a('0x5')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 8b8560a..5548a30 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(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'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(_0x467b5d,_0x22ca71){var _0x3a64da=function(_0x2709b7){while(--_0x2709b7){_0x467b5d['push'](_0x467b5d['shift']());}};_0x3a64da(++_0x22ca71);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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 001f526..f0d4579 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 _0x0d49=['request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d49,0x9f));var _0x90d4=function(_0x2e3178,_0x3020c7){_0x2e3178=_0x2e3178-0x0;var _0x4647c4=_0x0d49[_0x2e3178];return _0x4647c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x90d4('0x0'))('api');var moment=require(_0x90d4('0x1'));var BPromise=require(_0x90d4('0x2'));var rp=require(_0x90d4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x90d4('0x4'));var config=require(_0x90d4('0x5'));var attributes=require(_0x90d4('0x6'));module[_0x90d4('0x7')]=function(_0x6a273c,_0x1eafd1){return _0x6a273c['define'](_0x90d4('0x8'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1ed=['user_has_openchannel_queues','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports','define'];(function(_0x1c491c,_0x41f9bc){var _0x44ee84=function(_0xb969c3){while(--_0xb969c3){_0x1c491c['push'](_0x1c491c['shift']());}};_0x44ee84(++_0x41f9bc);}(_0xf1ed,0xb1));var _0xdf1e=function(_0x42d793,_0x1ac22d){_0x42d793=_0x42d793-0x0;var _0x59414a=_0xf1ed[_0x42d793];return _0x59414a;};'use strict';var _=require(_0xdf1e('0x0'));var util=require('util');var logger=require(_0xdf1e('0x1'))(_0xdf1e('0x2'));var moment=require(_0xdf1e('0x3'));var BPromise=require('bluebird');var rp=require(_0xdf1e('0x4'));var fs=require('fs');var path=require(_0xdf1e('0x5'));var rimraf=require('rimraf');var config=require(_0xdf1e('0x6'));var attributes=require(_0xdf1e('0x7'));module[_0xdf1e('0x8')]=function(_0x577604,_0x2a5008){return _0x577604[_0xdf1e('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xdf1e('0xa'),'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 7f7f10f..b667030 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 _0x14b3=['error','code','message','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa76c2c,_0x32bd9d){var _0x1e8653=function(_0x3ca12c){while(--_0x3ca12c){_0xa76c2c['push'](_0xa76c2c['shift']());}};_0x1e8653(++_0x32bd9d);}(_0x14b3,0x12f));var _0x314b=function(_0x8f270,_0x2f435f){_0x8f270=_0x8f270-0x0;var _0x5446cb=_0x14b3[_0x8f270];return _0x5446cb;};'use strict';var _=require(_0x314b('0x0'));var util=require('util');var moment=require(_0x314b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x314b('0x2'));var db=require(_0x314b('0x3'))['db'];var utils=require(_0x314b('0x4'));var logger=require(_0x314b('0x5'))(_0x314b('0x6'));var config=require(_0x314b('0x7'));var jayson=require(_0x314b('0x8'));var client=jayson['client'][_0x314b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d0704,_0x1ef738,_0x4b2cef){return new BPromise(function(_0x3e72ec,_0x2b59bc){return client[_0x314b('0xa')](_0x3d0704,_0x4b2cef)['then'](function(_0x4076c9){logger[_0x314b('0xb')](_0x314b('0xc'),_0x1ef738,_0x314b('0xd'));logger[_0x314b('0xe')](_0x314b('0xf'),_0x1ef738,_0x314b('0xd'),JSON[_0x314b('0x10')](_0x4076c9));if(_0x4076c9[_0x314b('0x11')]){if(_0x4076c9['error'][_0x314b('0x12')]===0x1f4){logger[_0x314b('0x11')](_0x314b('0xc'),_0x1ef738,_0x4076c9['error'][_0x314b('0x13')]);return _0x2b59bc(_0x4076c9[_0x314b('0x11')][_0x314b('0x13')]);}logger[_0x314b('0x11')](_0x314b('0xc'),_0x1ef738,_0x4076c9[_0x314b('0x11')]['message']);return _0x3e72ec(_0x4076c9[_0x314b('0x11')][_0x314b('0x13')]);}else{logger[_0x314b('0xb')](_0x314b('0xc'),_0x1ef738,_0x314b('0xd'));_0x3e72ec(_0x4076c9['result']['message']);}})['catch'](function(_0x3dd6b3){logger['error'](_0x314b('0xc'),_0x1ef738,_0x3dd6b3);_0x2b59bc(_0x3dd6b3);});});} \ No newline at end of file +var _0xc93f=['client','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x1f515e,_0x2cc5a5){var _0x14b803=function(_0x2cf56c){while(--_0x2cf56c){_0x1f515e['push'](_0x1f515e['shift']());}};_0x14b803(++_0x2cc5a5);}(_0xc93f,0x104));var _0xfc93=function(_0x11e93b,_0x402c5d){_0x11e93b=_0x11e93b-0x0;var _0xef4ce1=_0xc93f[_0x11e93b];return _0xef4ce1;};'use strict';var _=require('lodash');var util=require(_0xfc93('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfc93('0x1'));var fs=require('fs');var Redis=require(_0xfc93('0x2'));var db=require(_0xfc93('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfc93('0x4'));var jayson=require(_0xfc93('0x5'));var client=jayson[_0xfc93('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x548061,_0x14a1d2,_0x3187e1){return new BPromise(function(_0x396ae3,_0x5044f3){return client[_0xfc93('0x7')](_0x548061,_0x3187e1)[_0xfc93('0x8')](function(_0x30e2c9){logger['info'](_0xfc93('0x9'),_0x14a1d2,_0xfc93('0xa'));logger['debug'](_0xfc93('0xb'),_0x14a1d2,_0xfc93('0xa'),JSON[_0xfc93('0xc')](_0x30e2c9));if(_0x30e2c9['error']){if(_0x30e2c9[_0xfc93('0xd')][_0xfc93('0xe')]===0x1f4){logger[_0xfc93('0xd')](_0xfc93('0x9'),_0x14a1d2,_0x30e2c9[_0xfc93('0xd')]['message']);return _0x5044f3(_0x30e2c9[_0xfc93('0xd')][_0xfc93('0xf')]);}logger[_0xfc93('0xd')](_0xfc93('0x9'),_0x14a1d2,_0x30e2c9[_0xfc93('0xd')]['message']);return _0x396ae3(_0x30e2c9[_0xfc93('0xd')]['message']);}else{logger[_0xfc93('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x14a1d2,_0xfc93('0xa'));_0x396ae3(_0x30e2c9[_0xfc93('0x11')][_0xfc93('0xf')]);}})[_0xfc93('0x12')](function(_0x231b2a){logger[_0xfc93('0xd')](_0xfc93('0x9'),_0x14a1d2,_0x231b2a);_0x5044f3(_0x231b2a);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 8209bb7..f9f350e 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 _0xea37=['/:id','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put'];(function(_0x3773ca,_0x4d4db5){var _0x4a7b25=function(_0x14ad72){while(--_0x14ad72){_0x3773ca['push'](_0x3773ca['shift']());}};_0x4a7b25(++_0x4d4db5);}(_0xea37,0x13c));var _0x7ea3=function(_0x2e1d7c,_0x1742f0){_0x2e1d7c=_0x2e1d7c-0x0;var _0x4508b9=_0xea37[_0x2e1d7c];return _0x4508b9;};'use strict';var multer=require(_0x7ea3('0x0'));var util=require(_0x7ea3('0x1'));var path=require('path');var timeout=require(_0x7ea3('0x2'));var express=require('express');var router=express[_0x7ea3('0x3')]();var auth=require(_0x7ea3('0x4'));var interaction=require(_0x7ea3('0x5'));var config=require(_0x7ea3('0x6'));var controller=require(_0x7ea3('0x7'));router['get']('/',auth[_0x7ea3('0x8')](),controller[_0x7ea3('0x9')]);router[_0x7ea3('0xa')](_0x7ea3('0xb'),auth['isAuthenticated'](),controller[_0x7ea3('0xc')]);router['get']('/:id',auth[_0x7ea3('0x8')](),controller['show']);router[_0x7ea3('0xa')]('/:id/sections',auth[_0x7ea3('0x8')](),controller['getSections']);router[_0x7ea3('0xa')](_0x7ea3('0xd'),auth[_0x7ea3('0x8')](),controller[_0x7ea3('0xe')]);router[_0x7ea3('0xf')]('/',auth[_0x7ea3('0x8')](),controller[_0x7ea3('0x10')]);router[_0x7ea3('0xf')](_0x7ea3('0x11'),auth[_0x7ea3('0x8')](),controller[_0x7ea3('0x12')]);router[_0x7ea3('0xf')]('/:id/sections',auth[_0x7ea3('0x8')](),controller[_0x7ea3('0x13')]);router[_0x7ea3('0xf')](_0x7ea3('0xd'),auth[_0x7ea3('0x8')](),controller[_0x7ea3('0x14')]);router[_0x7ea3('0x15')](_0x7ea3('0x16'),auth[_0x7ea3('0x8')](),controller[_0x7ea3('0x17')]);router[_0x7ea3('0x18')](_0x7ea3('0x16'),auth[_0x7ea3('0x8')](),controller['destroy']);router[_0x7ea3('0x18')]('/:id/sections',auth['isAuthenticated'](),controller['removeSections']);router[_0x7ea3('0x18')](_0x7ea3('0xd'),auth[_0x7ea3('0x8')](),controller['removeResources']);module[_0x7ea3('0x19')]=router; \ No newline at end of file +var _0x8b30=['getSections','/:id/resources','post','create','clone','addSections','addResources','put','delete','removeResources','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections'];(function(_0x421d1f,_0x103891){var _0x4228bf=function(_0x4e30fc){while(--_0x4e30fc){_0x421d1f['push'](_0x421d1f['shift']());}};_0x4228bf(++_0x103891);}(_0x8b30,0x96));var _0x08b3=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x8b30[_0x2555d0];return _0x3bb486;};'use strict';var multer=require(_0x08b3('0x0'));var util=require(_0x08b3('0x1'));var path=require(_0x08b3('0x2'));var timeout=require(_0x08b3('0x3'));var express=require(_0x08b3('0x4'));var router=express[_0x08b3('0x5')]();var auth=require(_0x08b3('0x6'));var interaction=require(_0x08b3('0x7'));var config=require(_0x08b3('0x8'));var controller=require(_0x08b3('0x9'));router[_0x08b3('0xa')]('/',auth[_0x08b3('0xb')](),controller[_0x08b3('0xc')]);router['get'](_0x08b3('0xd'),auth[_0x08b3('0xb')](),controller[_0x08b3('0xe')]);router[_0x08b3('0xa')](_0x08b3('0xf'),auth[_0x08b3('0xb')](),controller[_0x08b3('0x10')]);router['get'](_0x08b3('0x11'),auth['isAuthenticated'](),controller[_0x08b3('0x12')]);router['get'](_0x08b3('0x13'),auth[_0x08b3('0xb')](),controller['getResources']);router[_0x08b3('0x14')]('/',auth[_0x08b3('0xb')](),controller[_0x08b3('0x15')]);router['post']('/:id/clone',auth[_0x08b3('0xb')](),controller[_0x08b3('0x16')]);router[_0x08b3('0x14')](_0x08b3('0x11'),auth['isAuthenticated'](),controller[_0x08b3('0x17')]);router['post'](_0x08b3('0x13'),auth[_0x08b3('0xb')](),controller[_0x08b3('0x18')]);router[_0x08b3('0x19')](_0x08b3('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x08b3('0x1a')](_0x08b3('0xf'),auth[_0x08b3('0xb')](),controller['destroy']);router[_0x08b3('0x1a')](_0x08b3('0x11'),auth[_0x08b3('0xb')](),controller['removeSections']);router['delete']('/:id/resources',auth[_0x08b3('0xb')](),controller[_0x08b3('0x1b')]);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 7979e1f..bdeef2a 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 _0xe56e=['sequelize','STRING','setDataValue','join','getDataValue','crudPermissions'];(function(_0x2d2623,_0x1aaea0){var _0x28f6c1=function(_0x599d40){while(--_0x599d40){_0x2d2623['push'](_0x2d2623['shift']());}};_0x28f6c1(++_0x1aaea0);}(_0xe56e,0xd8));var _0xee56=function(_0x202967,_0x2052fc){_0x202967=_0x202967-0x0;var _0x43776c=_0xe56e[_0x202967];return _0x43776c;};'use strict';var Sequelize=require(_0xee56('0x0'));module['exports']={'name':{'type':Sequelize[_0xee56('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xee56('0x1')],'set':function(_0x2349fb){this[_0xee56('0x2')]('crudPermissions',_0x2349fb?_0x2349fb[_0xee56('0x3')](''):[]);},'get':function(){return this[_0xee56('0x4')](_0xee56('0x5'))?this[_0xee56('0x4')](_0xee56('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xee56('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x9c53=['crudPermissions','split','STRING','setDataValue','join','getDataValue'];(function(_0x20c718,_0x98e475){var _0x376c26=function(_0x443d86){while(--_0x443d86){_0x20c718['push'](_0x20c718['shift']());}};_0x376c26(++_0x98e475);}(_0x9c53,0x1f4));var _0x39c5=function(_0x4dd506,_0xc22299){_0x4dd506=_0x4dd506-0x0;var _0x515c9f=_0x9c53[_0x4dd506];return _0x515c9f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x39c5('0x0')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x39c5('0x0')],'set':function(_0x1e5535){this[_0x39c5('0x1')]('crudPermissions',_0x1e5535?_0x1e5535[_0x39c5('0x2')](''):[]);},'get':function(){return this[_0x39c5('0x3')](_0x39c5('0x4'))?this[_0x39c5('0x3')](_0x39c5('0x4'))[_0x39c5('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x39c5('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 047a72e..80e359f 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 _0x0f82=['./userProfile.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','then','destroy','error','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','params','intersection','includeAll','create','clone','find','get','updatedAt','crudPermissions','body','omit','createdAt','UserProfileSection','findAll','each','autoAssociation','sectionId','userProfileId','UserProfileResource','describe','addSections','sequelize','transaction','Resources','push','ids','getSections','enabled','includes','isEmpty','subsections','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','parentSections','findOne','all','ignore','union','nolimit','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','default','reportId','DefaultReports','custom','CustomReports','count','CmContact','Tag','Tags','tag','ThroughTags','color','value','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','projectName','projects','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','VoiceQueue','inbound','queue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','VoiceQueues','QueueCampaigns','users','agents','telephones','Users','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Interval','Pause','scheduler','sounds','Sound','tags','templates','Template','triggers','trunks','variables','Variable','Reports','metrics','WhatsappAccount','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','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'];(function(_0x279f0f,_0x569056){var _0x1f494d=function(_0x4f2194){while(--_0x4f2194){_0x279f0f['push'](_0x279f0f['shift']());}};_0x1f494d(++_0x569056);}(_0x0f82,0x1c6));var _0x20f8=function(_0x8e8f89,_0x4254f3){_0x8e8f89=_0x8e8f89-0x0;var _0x151938=_0x0f82[_0x8e8f89];return _0x151938;};'use strict';var pdf=require(_0x20f8('0x0'));var emlformat=require(_0x20f8('0x1'));var rimraf=require(_0x20f8('0x2'));var zipdir=require(_0x20f8('0x3'));var jsonpatch=require(_0x20f8('0x4'));var rp=require(_0x20f8('0x5'));var moment=require('moment');var BPromise=require(_0x20f8('0x6'));var Mustache=require(_0x20f8('0x7'));var util=require(_0x20f8('0x8'));var path=require(_0x20f8('0x9'));var sox=require(_0x20f8('0xa'));var csv=require(_0x20f8('0xb'));var ejs=require(_0x20f8('0xc'));var fs=require('fs');var _=require(_0x20f8('0xd'));var squel=require(_0x20f8('0xe'));var crypto=require(_0x20f8('0xf'));var jsforce=require(_0x20f8('0x10'));var deskjs=require(_0x20f8('0x11'));var toCsv=require(_0x20f8('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x20f8('0x12'));var authService=require(_0x20f8('0x13'));var qs=require(_0x20f8('0x14'));var as=require(_0x20f8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20f8('0x16'))(_0x20f8('0x17'));var utils=require(_0x20f8('0x18'));var config=require(_0x20f8('0x19'));var licenseUtil=require(_0x20f8('0x1a'));var db=require(_0x20f8('0x1b'))['db'];config[_0x20f8('0x1c')]=_[_0x20f8('0x1d')](config[_0x20f8('0x1c')],{'host':_0x20f8('0x1e'),'port':0x18eb});var socket=require(_0x20f8('0x1f'))(new Redis(config['redis']));require(_0x20f8('0x20'))[_0x20f8('0x21')](socket);function respondWithStatusCode(_0x4cf20a,_0x2a4589){_0x2a4589=_0x2a4589||0xcc;return function(_0x175b44){if(_0x175b44){return _0x4cf20a[_0x20f8('0x22')](_0x2a4589);}return _0x4cf20a[_0x20f8('0x23')](_0x2a4589)[_0x20f8('0x24')]();};}function respondWithResult(_0x10aecb,_0xa8ea40){_0xa8ea40=_0xa8ea40||0xc8;return function(_0x22a927){if(_0x22a927){return _0x10aecb['status'](_0xa8ea40)[_0x20f8('0x25')](_0x22a927);}};}function respondWithFilteredResult(_0x7e1573,_0xf6fa49){return function(_0x150660){if(_0x150660){var _0x2697a7=_0x150660['count'],_0x468bb1=_0xf6fa49[_0x20f8('0x26')],_0x47f9de=_0xf6fa49[_0x20f8('0x26')]+_0xf6fa49[_0x20f8('0x27')],_0x5b02ea;if(_0x47f9de>=_0x2697a7){_0x47f9de=_0x2697a7;_0x5b02ea=0xc8;}else{_0x5b02ea=0xce;}_0x7e1573[_0x20f8('0x23')](_0x5b02ea);return _0x7e1573[_0x20f8('0x28')](_0x20f8('0x29'),_0x468bb1+'-'+_0x47f9de+'/'+_0x2697a7)[_0x20f8('0x25')](_0x150660);}return null;};}function patchUpdates(_0x5e91ee){return function(_0x2c7068){try{jsonpatch['apply'](_0x2c7068,_0x5e91ee,!![]);}catch(_0x5b56ff){return BPromise[_0x20f8('0x2a')](_0x5b56ff);}return _0x2c7068['save']();};}function saveUpdates(_0xb634b0,_0x1646cf){return function(_0x4c4728){if(_0x4c4728){return _0x4c4728[_0x20f8('0x2b')](_0xb634b0)[_0x20f8('0x2c')](function(_0x957c7e){return _0x957c7e;});}return null;};}function removeEntity(_0x377b6a,_0xbaa18b){return function(_0x144596){if(_0x144596){return _0x144596[_0x20f8('0x2d')]()['then'](function(){_0x377b6a[_0x20f8('0x23')](0xcc)[_0x20f8('0x24')]();});}};}function handleEntityNotFound(_0x24a509,_0x121a6a){return function(_0x5ad7d2){if(!_0x5ad7d2){_0x24a509['sendStatus'](0x194);}return _0x5ad7d2;};}function handleError(_0x39e328,_0x1a9b91){_0x1a9b91=_0x1a9b91||0x1f4;return function(_0x1a75da){logger[_0x20f8('0x2e')](_0x1a75da['stack']);if(_0x1a75da[_0x20f8('0x2f')]){delete _0x1a75da[_0x20f8('0x2f')];}_0x39e328['status'](_0x1a9b91)[_0x20f8('0x30')](_0x1a75da);};}exports['index']=function(_0x27866b,_0x416daa){var _0x54332d={},_0x285dc9={},_0x4a3c60={'count':0x0,'rows':[]};var _0x141130=_[_0x20f8('0x31')](db[_0x20f8('0x32')][_0x20f8('0x33')],function(_0x1d9595){return{'name':_0x1d9595[_0x20f8('0x34')],'type':_0x1d9595[_0x20f8('0x35')][_0x20f8('0x36')]};});_0x285dc9[_0x20f8('0x37')]=_['map'](_0x141130,_0x20f8('0x2f'));_0x285dc9[_0x20f8('0x38')]=_[_0x20f8('0x39')](_0x27866b['query']);_0x285dc9['filters']=_['intersection'](_0x285dc9[_0x20f8('0x37')],_0x285dc9[_0x20f8('0x38')]);_0x54332d[_0x20f8('0x3a')]=_['intersection'](_0x285dc9['model'],qs[_0x20f8('0x3b')](_0x27866b[_0x20f8('0x38')][_0x20f8('0x3b')]));_0x54332d['attributes']=_0x54332d[_0x20f8('0x3a')][_0x20f8('0x3c')]?_0x54332d['attributes']:_0x285dc9[_0x20f8('0x37')];if(!_0x27866b['query']['hasOwnProperty']('nolimit')){_0x54332d['limit']=qs[_0x20f8('0x27')](_0x27866b[_0x20f8('0x38')][_0x20f8('0x27')]);_0x54332d[_0x20f8('0x26')]=qs[_0x20f8('0x26')](_0x27866b[_0x20f8('0x38')][_0x20f8('0x26')]);}_0x54332d[_0x20f8('0x3d')]=qs[_0x20f8('0x3e')](_0x27866b[_0x20f8('0x38')]['sort']);_0x54332d[_0x20f8('0x3f')]=qs[_0x20f8('0x40')](_['pick'](_0x27866b['query'],_0x285dc9[_0x20f8('0x40')]),_0x141130);if(_0x27866b[_0x20f8('0x38')][_0x20f8('0x41')]){_0x54332d[_0x20f8('0x3f')]=_[_0x20f8('0x42')](_0x54332d[_0x20f8('0x3f')],{'$or':_[_0x20f8('0x31')](_0x141130,function(_0x5299aa){if(_0x5299aa[_0x20f8('0x35')]!==_0x20f8('0x43')){var _0x320cd5={};_0x320cd5[_0x5299aa['name']]={'$like':'%'+_0x27866b[_0x20f8('0x38')][_0x20f8('0x41')]+'%'};return _0x320cd5;}})});}_0x54332d=_[_0x20f8('0x42')]({},_0x54332d,_0x27866b[_0x20f8('0x44')]);var _0xcb86be={'where':_0x54332d[_0x20f8('0x3f')]};return db[_0x20f8('0x32')]['count'](_0xcb86be)['then'](function(_0x4601a6){_0x4a3c60['count']=_0x4601a6;if(_0x27866b[_0x20f8('0x38')]['includeAll']){_0x54332d[_0x20f8('0x45')]=[{'all':!![]}];}return db[_0x20f8('0x32')]['findAll'](_0x54332d);})[_0x20f8('0x2c')](function(_0x3a3a51){_0x4a3c60[_0x20f8('0x46')]=_0x3a3a51;return _0x4a3c60;})[_0x20f8('0x2c')](respondWithFilteredResult(_0x416daa,_0x54332d))[_0x20f8('0x47')](handleError(_0x416daa,null));};exports['show']=function(_0x395f6b,_0x2a87e1){var _0x416413={'raw':![],'where':{'id':_0x395f6b[_0x20f8('0x48')]['id']}},_0xdba9c9={};_0xdba9c9[_0x20f8('0x37')]=_[_0x20f8('0x39')](db['UserProfile'][_0x20f8('0x33')]);_0xdba9c9['query']=_[_0x20f8('0x39')](_0x395f6b[_0x20f8('0x38')]);_0xdba9c9['filters']=_['intersection'](_0xdba9c9[_0x20f8('0x37')],_0xdba9c9[_0x20f8('0x38')]);_0x416413[_0x20f8('0x3a')]=_[_0x20f8('0x49')](_0xdba9c9[_0x20f8('0x37')],qs['fields'](_0x395f6b[_0x20f8('0x38')][_0x20f8('0x3b')]));_0x416413[_0x20f8('0x3a')]=_0x416413[_0x20f8('0x3a')][_0x20f8('0x3c')]?_0x416413[_0x20f8('0x3a')]:_0xdba9c9[_0x20f8('0x37')];if(_0x395f6b['query'][_0x20f8('0x4a')]){_0x416413[_0x20f8('0x45')]=[{'all':!![]}];}_0x416413=_['merge']({},_0x416413,_0x395f6b[_0x20f8('0x44')]);return db['UserProfile']['find'](_0x416413)[_0x20f8('0x2c')](handleEntityNotFound(_0x2a87e1,null))[_0x20f8('0x2c')](respondWithResult(_0x2a87e1,null))[_0x20f8('0x47')](handleError(_0x2a87e1,null));};exports[_0x20f8('0x4b')]=function(_0x1f6b4a,_0x5ecfa2){return db['UserProfile'][_0x20f8('0x4b')](_0x1f6b4a['body'],{})[_0x20f8('0x2c')](respondWithResult(_0x5ecfa2,0xc9))[_0x20f8('0x47')](handleError(_0x5ecfa2,null));};exports[_0x20f8('0x4c')]=function(_0x5ad1fa,_0x47e1f8){var _0x4fe634={'where':{'id':_0x5ad1fa[_0x20f8('0x48')]['id']}},_0x374b22={};_0x374b22['model']=_['keys'](db[_0x20f8('0x32')][_0x20f8('0x33')]);_0x4fe634[_0x20f8('0x3a')]=_[_0x20f8('0x49')](_0x374b22[_0x20f8('0x37')],qs[_0x20f8('0x3b')](_0x5ad1fa[_0x20f8('0x38')][_0x20f8('0x3b')]));_0x4fe634['attributes']=_0x4fe634[_0x20f8('0x3a')][_0x20f8('0x3c')]?_0x4fe634[_0x20f8('0x3a')]:_0x374b22[_0x20f8('0x37')];if(_0x5ad1fa[_0x20f8('0x38')][_0x20f8('0x4a')]){_0x4fe634[_0x20f8('0x45')]=[{'all':!![]}];}_0x4fe634=_[_0x20f8('0x42')]({},_0x4fe634,_0x5ad1fa[_0x20f8('0x44')]);return db[_0x20f8('0x32')][_0x20f8('0x4d')](_0x4fe634)[_0x20f8('0x2c')](handleEntityNotFound(_0x47e1f8,null))[_0x20f8('0x2c')](function(_0x553a99){if(_0x553a99){var _0x41320a=_0x553a99[_0x20f8('0x4e')]({'plain':!![]});_0x41320a=qs['omit'](_0x41320a,['id','createdAt',_0x20f8('0x4f'),_0x20f8('0x50')]);_0x5ad1fa[_0x20f8('0x51')]=_[_0x20f8('0x52')](_0x5ad1fa[_0x20f8('0x51')],['id',_0x20f8('0x53'),_0x20f8('0x4f')]);return db['sequelize']['transaction'](function(_0x2884af){return db[_0x20f8('0x32')]['create'](_[_0x20f8('0x42')](_0x41320a,_0x5ad1fa[_0x20f8('0x51')]),{'include':_0x5ad1fa['query'][_0x20f8('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0x2884af})[_0x20f8('0x2c')](function(_0x269216){var _0x2d4f06=_0x269216[_0x20f8('0x4e')]({'plain':!![]});return db[_0x20f8('0x54')][_0x20f8('0x55')]({'where':{'userProfileId':_0x5ad1fa[_0x20f8('0x48')]['id']},'raw':!![]})['then'](function(_0x32b103){if(_0x32b103){return BPromise[_0x20f8('0x56')](_0x32b103,function(_0xd9369c){return new BPromise(function(_0x233c7d,_0x77ecf1){if(_0xd9369c[_0x20f8('0x57')]===null||_0xd9369c[_0x20f8('0x57')]===0x1)_0x233c7d(null);return db['UserProfileResource'][_0x20f8('0x55')]({'where':{'sectionId':_0xd9369c['id']},'raw':!![]})[_0x20f8('0x2c')](function(_0x123c89){var _0x37892f=_[_0x20f8('0x31')](_0x123c89,function(_0xf129f4){return qs[_0x20f8('0x52')](_0xf129f4,['id','createdAt','updatedAt',_0x20f8('0x58')]);});_0x233c7d(_0x37892f);})['catch'](function(_0x3f8df1){_0x77ecf1(_0x3f8df1);});})['then'](function(_0x1e5450){var _0x42138c=qs[_0x20f8('0x52')](_0xd9369c,['id','createdAt',_0x20f8('0x4f')]);_0x42138c[_0x20f8('0x59')]=_0x2d4f06['id'];if(_0x1e5450)_0x42138c['Resources']=_0x1e5450;return _0x42138c;})[_0x20f8('0x2c')](function(_0x1e4b23){return db[_0x20f8('0x54')][_0x20f8('0x4b')](_0x1e4b23,{'include':[{'model':db[_0x20f8('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x2884af});});})[_0x20f8('0x2c')](function(){return _0x2d4f06;});}});});});}})[_0x20f8('0x2c')](respondWithResult(_0x47e1f8,0xc9))[_0x20f8('0x47')](handleError(_0x47e1f8,null));};exports[_0x20f8('0x2b')]=function(_0x3e5c6f,_0x13b009){if(_0x3e5c6f[_0x20f8('0x51')]['id']){delete _0x3e5c6f['body']['id'];}return db['UserProfile'][_0x20f8('0x4d')]({'where':{'id':_0x3e5c6f[_0x20f8('0x48')]['id']}})[_0x20f8('0x2c')](handleEntityNotFound(_0x13b009,null))['then'](saveUpdates(_0x3e5c6f[_0x20f8('0x51')],null))['then'](respondWithResult(_0x13b009,null))['catch'](handleError(_0x13b009,null));};exports['destroy']=function(_0x517f91,_0x303405){return db[_0x20f8('0x32')]['find']({'where':{'id':_0x517f91[_0x20f8('0x48')]['id']}})['then'](handleEntityNotFound(_0x303405,null))[_0x20f8('0x2c')](removeEntity(_0x303405,null))[_0x20f8('0x47')](handleError(_0x303405,null));};exports[_0x20f8('0x5b')]=function(_0xc6c3ec,_0x838003){return db[_0x20f8('0x32')][_0x20f8('0x5b')]()['then'](respondWithResult(_0x838003,null))[_0x20f8('0x47')](handleError(_0x838003,null));};exports[_0x20f8('0x5c')]=function(_0x54bf43,_0xcb8b2d){var _0x10ef1b=_0x54bf43[_0x20f8('0x51')];return db['UserProfile'][_0x20f8('0x4d')]({'where':{'id':_0x54bf43[_0x20f8('0x48')]['id']}})['then'](handleEntityNotFound(_0xcb8b2d,null))[_0x20f8('0x2c')](function(_0x5fa4c3){if(_0x5fa4c3){return db[_0x20f8('0x5d')][_0x20f8('0x5e')](function(_0x345ac3){return db[_0x20f8('0x54')]['destroy']({'where':{'userProfileId':_0x54bf43['params']['id'],'sectionId':_['map'](_0x10ef1b,function(_0x57645d){return _0x57645d[_0x20f8('0x58')];})},'transaction':_0x345ac3})[_0x20f8('0x2c')](function(){var _0x93b1a1=_['map'](_0x10ef1b,function(_0x4b2882){_0x4b2882[_0x20f8('0x59')]=_0x54bf43[_0x20f8('0x48')]['id'];return _0x4b2882;});var _0x575732=[];return BPromise[_0x20f8('0x56')](_0x93b1a1,function(_0x2ad6e2){return db[_0x20f8('0x54')][_0x20f8('0x4b')](_0x2ad6e2,{'include':[{'model':db[_0x20f8('0x5a')],'as':_0x20f8('0x5f')}],'raw':!![],'transaction':_0x345ac3})[_0x20f8('0x2c')](function(_0xfd84e5){_0x575732[_0x20f8('0x60')](_0xfd84e5[_0x20f8('0x4e')]({'plain':!![]}));});})[_0x20f8('0x2c')](function(){return _0x575732;});});});}})[_0x20f8('0x2c')](function(_0x4539a4){return _0x4539a4;})[_0x20f8('0x2c')](respondWithResult(_0xcb8b2d,null))['catch'](handleError(_0xcb8b2d,null));};exports['removeSections']=function(_0x5dc48d,_0x46b4e4){var _0x1655f4;return db['UserProfile']['find']({'where':{'id':_0x5dc48d[_0x20f8('0x48')]['id']},'attributes':['id',_0x20f8('0x2f')]})['then'](handleEntityNotFound(_0x46b4e4,null))['then'](function(_0x1ed133){if(_0x1ed133){_0x1655f4=_0x1ed133;return db[_0x20f8('0x54')]['destroy']({'where':{'userProfileId':_0x5dc48d['params']['id'],'sectionId':_0x5dc48d[_0x20f8('0x38')][_0x20f8('0x61')]}});}})['then'](function(){return _0x1655f4;})[_0x20f8('0x2c')](respondWithStatusCode(_0x46b4e4,null))[_0x20f8('0x47')](handleError(_0x46b4e4,null));};exports[_0x20f8('0x62')]=function(_0x1834e6,_0x2e9dee){var _0x4e3b5e=[];var _0x111e8f=[];return db['UserProfileSection'][_0x20f8('0x55')]({'where':{'userProfileId':_0x1834e6['params']['id']},'raw':!![]})[_0x20f8('0x2c')](function(_0x2c71be){_0x4e3b5e=_['filter'](_0x2c71be,function(_0x1939dd){return _0x1939dd[_0x20f8('0x63')]===0x1||_[_0x20f8('0x64')]([0x3eb,0x709],_0x1939dd['sectionId']);});if(!_[_0x20f8('0x65')](_0x4e3b5e)){return _[_0x20f8('0x31')](_0x4e3b5e,function(_0x59a984){return _0x59a984[_0x20f8('0x58')];});}else{return;}})[_0x20f8('0x2c')](function(_0x13445e){if(_0x13445e)_0x111e8f=_0x13445e;if(_[_0x20f8('0x64')](_0x111e8f,0x64)){var _0x261245=_[_0x20f8('0x4d')](_0x4e3b5e,{'sectionId':0x64});return hasDefaultDashboard(_0x261245)[_0x20f8('0x2c')](function(_0xf41bcc){return _[_0x20f8('0x31')](_0x4e3b5e,function(_0x397717){if(_0x397717['sectionId']===0x64){_0x397717[_0x20f8('0x66')]=_0xf41bcc;}return _0x397717;});});}else{return;}})[_0x20f8('0x2c')](function(_0x570b66){if(_0x570b66)_0x4e3b5e=_0x570b66;if(_['includes'](_0x111e8f,0x3eb)){var _0x17762b=_[_0x20f8('0x4d')](_0x4e3b5e,{'sectionId':0x3eb});return getCustomDashboards(_0x17762b)['then'](function(_0x35f54b){return _[_0x20f8('0x31')](_0x4e3b5e,function(_0xb6b18){if(_0x17762b[_0x20f8('0x63')]){if(_0xb6b18[_0x20f8('0x58')]===0x3eb){_0xb6b18[_0x20f8('0x66')]=_0x35f54b;}}else{if(_0xb6b18[_0x20f8('0x58')]===0x64){_0xb6b18[_0x20f8('0x66')]=_0x35f54b;}}return _0xb6b18;});});}else{return;}})[_0x20f8('0x2c')](function(_0x531799){if(_0x531799)_0x4e3b5e=_0x531799;if(_['includes'](_0x111e8f,0x709)){var _0x2bef09=_[_0x20f8('0x4d')](_0x4e3b5e,{'sectionId':0x709});return getPlugins(_0x2bef09)[_0x20f8('0x2c')](function(_0x4e1e48){if(_0x2bef09[_0x20f8('0x63')]){return _['map'](_0x4e3b5e,function(_0x35283c){if(_0x35283c[_0x20f8('0x58')]===0x709){_0x35283c['subsections']=_0x4e1e48;}return _0x35283c;});}else{var _0x331de9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4e1e48};var _0x324d36=_['map'](_0x4e3b5e);_0x324d36[_0x20f8('0x60')](_0x331de9);return _0x324d36;}});}else{return;}})[_0x20f8('0x2c')](function(_0x86bdd1){if(_0x86bdd1)_0x4e3b5e=_0x86bdd1;return _['filter'](_0x4e3b5e,[_0x20f8('0x63'),0x1]);})[_0x20f8('0x2c')](respondWithResult(_0x2e9dee,null))[_0x20f8('0x47')](handleError(_0x2e9dee,null));};function hasDefaultDashboard(_0x4fb4c1){var _0x29e72e=[0x65];return new BPromise(function(_0x24671d,_0x2fc717){try{if(_0x4fb4c1[_0x20f8('0x57')]){_0x24671d(_0x29e72e);}else{return db[_0x20f8('0x5a')]['findOne']({'where':{'sectionId':_0x4fb4c1['id']},'raw':!![]})[_0x20f8('0x2c')](function(_0x3775e4){_0x3775e4?_0x24671d(_0x29e72e):_0x24671d();});}}catch(_0x5886c6){_0x2fc717(_0x5886c6);}});}function getCustomDashboards(_0x282002){var _0x5b76a4=[];return new BPromise(function(_0x2ff3c5,_0x34aa3c){try{if(_0x282002[_0x20f8('0x57')]){return db[_0x20f8('0x67')][_0x20f8('0x55')]({'raw':!![]})[_0x20f8('0x2c')](function(_0x32e7f5){_0x32e7f5[_0x20f8('0x68')](function(_0x58eaa3){_0x5b76a4[_0x20f8('0x60')](_0x58eaa3['id']+0x1869f);});_0x2ff3c5(_0x5b76a4);});}else{return db[_0x20f8('0x5a')]['findAll']({'where':{'sectionId':_0x282002['id']},'raw':!![]})[_0x20f8('0x2c')](function(_0x3e6780){_0x3e6780[_0x20f8('0x68')](function(_0x4617a6){_0x5b76a4[_0x20f8('0x60')](_0x4617a6[_0x20f8('0x69')]+0x1869f);});_0x2ff3c5(_0x5b76a4);});}}catch(_0x3476c2){_0x34aa3c(_0x3476c2);}});}function getPlugins(_0x4e0c00){var _0x4e6070=[];return new BPromise(function(_0xa4aed,_0x3333f9){try{if(_0x4e0c00['autoAssociation']){return db[_0x20f8('0x6a')][_0x20f8('0x55')]({'raw':!![]})[_0x20f8('0x2c')](function(_0x5b861b){_0x5b861b['forEach'](function(_0x3e772f){_0x4e6070['push'](_0x3e772f['id']+0x15b38);});_0xa4aed(_0x4e6070);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x4e0c00['id']},'raw':!![]})[_0x20f8('0x2c')](function(_0x37eb19){_0x37eb19[_0x20f8('0x68')](function(_0x20c059){_0x4e6070[_0x20f8('0x60')](_0x20c059[_0x20f8('0x69')]+0x15b38);});_0xa4aed(_0x4e6070);});}}catch(_0x5707f1){_0x3333f9(_0x5707f1);}});}exports[_0x20f8('0x6b')]=function(_0x59504b,_0x104784){return db[_0x20f8('0x32')][_0x20f8('0x4d')]({'where':{'id':_0x59504b[_0x20f8('0x48')]['id']}})[_0x20f8('0x2c')](handleEntityNotFound(_0x104784,null))['then'](function(_0x18bab8){if(_0x18bab8){return db[_0x20f8('0x5d')]['transaction'](function(_0x4272da){return db[_0x20f8('0x54')][_0x20f8('0x55')]({'where':{'userProfileId':_0x59504b[_0x20f8('0x48')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xa41a2c){if(_0xa41a2c){return db[_0x20f8('0x54')][_0x20f8('0x2d')]({'where':{'userProfileId':_0x59504b['params']['id'],'id':_[_0x20f8('0x31')](_0xa41a2c,function(_0x35d77b){return _0x35d77b['id'];})},'transaction':_0x4272da});}})[_0x20f8('0x2c')](function(_0x30d449){var _0x1fb304=_['map'](_0x59504b['body'],function(_0x213b56){_0x213b56[_0x20f8('0x59')]=_0x59504b[_0x20f8('0x48')]['id'];return _0x213b56;});return db[_0x20f8('0x54')][_0x20f8('0x6c')](_0x1fb304,{'raw':!![],'transaction':_0x4272da});})[_0x20f8('0x2c')](function(_0x570e21){var _0x33ee39=_[_0x20f8('0x41')](_[_0x20f8('0x31')](_0x570e21,function(_0x1736f7){return _0x1736f7[_0x20f8('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x33ee39){return db[_0x20f8('0x54')][_0x20f8('0x55')]({'where':{'userProfileId':_0x59504b['params']['id'],'sectionId':_['map'](_0x33ee39,function(_0x28d7cc){return _0x28d7cc[_0x20f8('0x58')];})},'attributes':['id',_0x20f8('0x58')],'raw':!![]})[_0x20f8('0x2c')](function(_0x1ef314){var _0x180804=_[_0x20f8('0x31')](_0x59504b[_0x20f8('0x51')],function(_0x5eb879){_0x5eb879[_0x20f8('0x59')]=_0x59504b['params']['id'];return _0x5eb879;});return db[_0x20f8('0x5a')][_0x20f8('0x6c')](_0x180804,{'raw':!![],'transaction':_0x4272da});});}})[_0x20f8('0x47')](handleError(_0x104784,null));});}})[_0x20f8('0x2c')](function(_0x5747b4){var _0x596405=_[_0x20f8('0x31')](_0x5747b4,function(_0x4cc183){return _0x4cc183['get']({'plain':!![]});});})[_0x20f8('0x2c')](respondWithResult(_0x104784,null))['catch'](handleError(_0x104784,null));};exports[_0x20f8('0x6d')]=function(_0x1b8180,_0x4a4d6b,_0x26de89){return db[_0x20f8('0x32')][_0x20f8('0x4d')]({'where':{'id':_0x1b8180[_0x20f8('0x48')]['id']}})[_0x20f8('0x2c')](handleEntityNotFound(_0x4a4d6b,null))[_0x20f8('0x2c')](function(_0x52c9d0){if(_0x52c9d0){return _0x52c9d0[_0x20f8('0x6d')](_0x1b8180[_0x20f8('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x4a4d6b,null))[_0x20f8('0x47')](handleError(_0x4a4d6b,null));};exports['getResources']=function(_0x3cb6d3,_0x2bb08c){var _0x170342={'raw':![],'where':{}};var _0x4c0595={};var _0x112fa4={'count':0x0,'rows':[]};var _0x51e121=_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x6e')];if(typeof _0x51e121==='undefined'){throw new db[(_0x20f8('0x6f'))][(_0x20f8('0x70'))](_0x20f8('0x71'));}var _0x46d911=_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x72')]||![];var _0x32a11f=getQueryModels(_0x51e121,_0x46d911);if(typeof _0x32a11f[_0x20f8('0x73')]===_0x20f8('0x74')){throw new db[(_0x20f8('0x6f'))][(_0x20f8('0x70'))]('Invalid\x20section\x20\x27'+_0x51e121+'\x27');}var _0x2c6b32=[];if(!_[_0x20f8('0x65')](_0x32a11f[_0x20f8('0x75')])){_0x2c6b32=_0x32a11f[_0x20f8('0x75')];}else{_0x2c6b32=[{'name':_0x51e121}];}return db['UserProfile'][_0x20f8('0x76')]({'where':{'id':_0x3cb6d3['params']['id']}})['then'](handleEntityNotFound(_0x2bb08c,null))['then'](function(_0x4a399f){if(_0x4a399f){var _0x577edc=[];for(var _0x1093bb=0x0;_0x1093bb<_0x2c6b32[_0x20f8('0x3c')];_0x1093bb++){_0x577edc[_0x20f8('0x60')](db[_0x20f8('0x54')][_0x20f8('0x76')]({'where':{'userProfileId':_0x4a399f['id'],'name':_0x2c6b32[_0x1093bb][_0x20f8('0x2f')]},'raw':!![]}));}return BPromise[_0x20f8('0x77')](_0x577edc);}})[_0x20f8('0x2c')](function(_0x17f0bd){var _0x3c10be=_[_0x20f8('0x41')](_0x17f0bd,function(_0x2a53b6){return _0x2a53b6?_0x2a53b6:undefined;});var _0x40b3d7=_[_0x20f8('0x41')](_0x2c6b32,[_0x20f8('0x78'),!![]]);var _0x59457f=_[_0x20f8('0x65')](_0x3c10be)&&_['isEmpty'](_0x40b3d7)?null:_[_0x20f8('0x79')](_0x40b3d7,_0x3c10be);if(_0x59457f){var _0x19d525=[];for(var _0x1559ba=0x0;_0x1559ba<_0x59457f[_0x20f8('0x3c')];_0x1559ba++){var _0x4b6d32=_[_0x20f8('0x4d')](_0x2c6b32,function(_0x22d2aa){return _0x59457f[_0x1559ba]?_0x22d2aa[_0x20f8('0x2f')]===_0x59457f[_0x1559ba][_0x20f8('0x2f')]:null;});if(_0x4b6d32){if(_0x59457f[_0x1559ba][_0x20f8('0x78')]){_0x19d525[_0x20f8('0x60')](getAllResources(_0x32a11f[_0x20f8('0x73')],_0x59457f[_0x1559ba]));}else{if(!_0x59457f[_0x1559ba][_0x20f8('0x57')]){_0x19d525[_0x20f8('0x60')](getAllowedResources(_0x4b6d32,_0x59457f[_0x1559ba],_0x32a11f['childModel']));}else{if(_0x4b6d32['model']){_0x19d525[_0x20f8('0x60')](getAllFilteredResources(_0x4b6d32,_0x59457f[_0x1559ba]));}}}}}return BPromise[_0x20f8('0x77')](_0x19d525);}else{return null;}})['then'](function(_0x43514b){var _0x145d7a=_0x43514b;var _0x5da3e7=null;if(_0x145d7a){_0x5da3e7=_0x145d7a[_0x20f8('0x3c')]===0x1?_0x145d7a[0x0]:null;}if(_0x5da3e7||_0x145d7a){var _0x187608=db[_0x32a11f[_0x20f8('0x73')]]['rawAttributes'];_0x4c0595[_0x20f8('0x37')]=_[_0x20f8('0x39')](_0x187608);_0x4c0595[_0x20f8('0x38')]=_[_0x20f8('0x39')](_0x3cb6d3['query']);_0x4c0595[_0x20f8('0x40')]=_['intersection'](_0x4c0595['model'],_0x4c0595[_0x20f8('0x38')]);_0x170342['attributes']=_['intersection'](_0x4c0595[_0x20f8('0x37')],qs[_0x20f8('0x3b')](_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x3b')]));_0x170342[_0x20f8('0x3a')]=_0x170342[_0x20f8('0x3a')][_0x20f8('0x3c')]?_0x170342[_0x20f8('0x3a')]:_0x4c0595[_0x20f8('0x37')];if(!_0x3cb6d3[_0x20f8('0x38')]['hasOwnProperty'](_0x20f8('0x7a'))){_0x170342['limit']=qs[_0x20f8('0x27')](_0x3cb6d3[_0x20f8('0x38')]['limit']);_0x170342[_0x20f8('0x26')]=qs[_0x20f8('0x26')](_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x26')]);}_0x170342[_0x20f8('0x3d')]=qs[_0x20f8('0x3e')](_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x3e')]);_0x170342[_0x20f8('0x3f')]=qs[_0x20f8('0x40')](_[_0x20f8('0x7b')](_0x3cb6d3[_0x20f8('0x38')],_0x4c0595['filters']));if(_0x3cb6d3['query'][_0x20f8('0x41')]){_0x170342[_0x20f8('0x3f')]=_['merge'](_0x170342[_0x20f8('0x3f')],{'$or':_['map'](_0x187608,function(_0x41fe28){if(_0x41fe28[_0x20f8('0x35')][_0x20f8('0x36')]!==_0x20f8('0x43')){var _0x3a64c8={};_0x3a64c8[_0x41fe28['field']]={'$like':'%'+_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x41')]+'%'};return _0x3a64c8;}})});}var _0x1d742d=[];if(_0x5da3e7){var _0x5dc2b0=_[_0x20f8('0x4d')](_0x2c6b32,[_0x20f8('0x2f'),_0x5da3e7[_0x20f8('0x2f')]]);if(_0x5dc2b0[_0x20f8('0x7c')]){var _0x5bc105={};if(_0x32a11f[_0x20f8('0x73')]===_0x20f8('0x7d')){_0x5bc105[_0x5dc2b0[_0x20f8('0x7e')]]=_[_0x20f8('0x31')](_0x5da3e7['associatedResources'],'id');}else{_0x5bc105[_0x5dc2b0[_0x20f8('0x7e')]]=_0x5da3e7[_0x20f8('0x7f')];}_0x1d742d['push'](_0x5bc105);}else{_0x170342['where']['id']=_0x5da3e7[_0x20f8('0x7f')];}}else{for(var _0x299dd3=0x0;_0x299dd3<_0x145d7a[_0x20f8('0x3c')];_0x299dd3++){var _0x5dc2b0=_[_0x20f8('0x4d')](_0x2c6b32,[_0x20f8('0x2f'),_0x145d7a[_0x299dd3][_0x20f8('0x2f')]]);if(_0x5dc2b0[_0x20f8('0x7c')]){var _0x5bc105={};_0x5bc105[_0x5dc2b0[_0x20f8('0x7e')]]=_0x145d7a[_0x299dd3][_0x20f8('0x7f')];_0x1d742d[_0x20f8('0x60')](_0x5bc105);}else{if(!_0x170342[_0x20f8('0x3f')]['id'])_0x170342[_0x20f8('0x3f')]['id']=[];_0x145d7a[_0x299dd3][_0x20f8('0x7f')][_0x20f8('0x68')](function(_0x52d03c){_0x170342[_0x20f8('0x3f')]['id'][_0x20f8('0x60')](_0x52d03c);});}}}if(!_[_0x20f8('0x65')](_0x1d742d)){_0x170342[_0x20f8('0x3f')]=_[_0x20f8('0x42')](_0x170342[_0x20f8('0x3f')],{'$and':{'$or':_0x1d742d}});}_0x170342=_[_0x20f8('0x42')]({},_0x170342,_0x3cb6d3[_0x20f8('0x44')]);if(_0x5da3e7&&!_0x5da3e7[_0x20f8('0x57')]&&_0x32a11f['childModel']===_0x20f8('0x7d')){if(_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x4a')]){_0x170342[_0x20f8('0x45')]=[{'all':!![]}];}return db[_0x32a11f[_0x20f8('0x73')]][_0x20f8('0x55')](_0x170342)[_0x20f8('0x2c')](function(_0x3e23b5){var _0xae1ee7=[];_0x3e23b5[_0x20f8('0x68')](function(_0x3fb7e0){var _0x23b03f;switch(_0x3fb7e0['reportType']){case _0x20f8('0x80'):_0x23b03f=_[_0x20f8('0x4d')](_0x5da3e7[_0x20f8('0x7f')],function(_0x44d76e){return _0x44d76e['id']===_0x3fb7e0[_0x20f8('0x81')]&&_0x44d76e[_0x20f8('0x35')]===_0x20f8('0x82');});break;case _0x20f8('0x83'):_0x23b03f=_['find'](_0x5da3e7['associatedResources'],function(_0x5d9eb2){return _0x5d9eb2['id']===_0x3fb7e0[_0x20f8('0x81')]&&_0x5d9eb2[_0x20f8('0x35')]===_0x20f8('0x84');});break;}if(_0x23b03f)_0xae1ee7[_0x20f8('0x60')](_0x3fb7e0);});_0x112fa4['count']=_0xae1ee7[_0x20f8('0x3c')];_0x112fa4[_0x20f8('0x46')]=_0xae1ee7;return _0x112fa4;});}else{return db[_0x32a11f['childModel']][_0x20f8('0x85')]({'where':_0x170342[_0x20f8('0x3f')]})[_0x20f8('0x2c')](function(_0x37c330){_0x112fa4[_0x20f8('0x85')]=_0x37c330;if(_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x4a')]){if(_0x32a11f['childModel']===_0x20f8('0x86')){_0x170342['include']=[{'model':db[_0x20f8('0x87')],'as':_0x20f8('0x88'),'attributes':['id',_0x20f8('0x2f'),'color'],'required':_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x89')]?!![]:![]},{'model':db[_0x20f8('0x87')],'as':_0x20f8('0x8a'),'attributes':['id','name',_0x20f8('0x8b')],'through':_0x3cb6d3['query']['tag']?{'attributes':[],'where':{'TagId':_0x3cb6d3[_0x20f8('0x38')][_0x20f8('0x89')]||undefined}}:{},'required':_0x3cb6d3['query'][_0x20f8('0x89')]?!![]:![]}];}else{_0x170342[_0x20f8('0x45')]=[{'all':!![]}];}}return db[_0x32a11f[_0x20f8('0x73')]][_0x20f8('0x55')](_0x170342);})[_0x20f8('0x2c')](function(_0x4837b0){_0x112fa4[_0x20f8('0x46')]=_0x4837b0;return _0x112fa4;});}}else{return _0x112fa4;}})[_0x20f8('0x2c')](respondWithFilteredResult(_0x2bb08c,_0x170342))[_0x20f8('0x47')](handleError(_0x2bb08c,null));};function getAllResources(_0x43ac72,_0x2eb847){return new BPromise(function(_0x2b49d0,_0x26bfc1){if(_0x2eb847){var _0x29a2f8=_0x2eb847[_0x20f8('0x41')]?{[_0x2eb847[_0x20f8('0x41')][_0x20f8('0x7c')]]:_0x2eb847[_0x20f8('0x41')][_0x20f8('0x8c')]}:undefined;return db[_0x43ac72][_0x20f8('0x55')]({'where':_0x29a2f8,'raw':!![]})['then'](function(_0x5aaae5){_0x2eb847['associatedResources']=_[_0x20f8('0x31')](_0x5aaae5,'id');_0x2b49d0(_0x2eb847);})['catch'](function(_0x1dd9b6){_0x26bfc1(_0x1dd9b6);});}else{_0x2b49d0(null);}});}function getAllFilteredResources(_0x32bdaf,_0xe6ff13){return new BPromise(function(_0x1eadb,_0x5b88e2){var _0x15cf24=_0x32bdaf['filter']?{[_0x32bdaf[_0x20f8('0x41')][_0x20f8('0x7c')]]:_0x32bdaf['filter'][_0x20f8('0x8c')]}:undefined;return db[_0x32bdaf[_0x20f8('0x37')]]['findAll']({'where':_0x15cf24,'raw':!![]})[_0x20f8('0x2c')](function(_0x3bec30){_0xe6ff13[_0x20f8('0x7f')]=_[_0x20f8('0x31')](_0x3bec30,function(_0x3d69dd){return _0x3d69dd['name'];});_0x1eadb(_0xe6ff13);})['catch'](function(_0x119cd7){_0x5b88e2(_0x119cd7);});});}function getAllowedResources(_0xcd4f70,_0x3ef8a0,_0x4095f6){return new BPromise(function(_0x42d57f,_0x55ffc2){if(_0x3ef8a0){return db[_0x20f8('0x5a')][_0x20f8('0x55')]({'where':{'sectionId':_0x3ef8a0['id']},'raw':!![]})[_0x20f8('0x2c')](function(_0x598a95){if(_0xcd4f70['field']&&_0xcd4f70[_0x20f8('0x7c')]!=='id'){_0x3ef8a0[_0x20f8('0x7f')]=_[_0x20f8('0x31')](_0x598a95,function(_0x816fbb){return _0x816fbb[_0xcd4f70['field']];});}else{if(_0x4095f6===_0x20f8('0x7d')){_0x3ef8a0['associatedResources']=_['map'](_0x598a95,function(_0x6e13db){return{'id':_0x6e13db[_0x20f8('0x69')],'type':_0x6e13db[_0x20f8('0x35')]};});}else{_0x3ef8a0[_0x20f8('0x7f')]=_[_0x20f8('0x31')](_0x598a95,function(_0xfa5b01){return _0xfa5b01[_0x20f8('0x69')];});}}_0x42d57f(_0x3ef8a0);})[_0x20f8('0x47')](function(_0x44611d){_0x55ffc2(_0x44611d);});}else{_0x42d57f(null);}});}function getQueryModels(_0x5e06d1,_0x590532){var _0x15b31c=_0x5e06d1[_0x20f8('0x8d')]();var _0x3caeeb={'childModel':undefined,'parentSections':[]};switch(_0x15b31c){case'squareprojects':_0x3caeeb['childModel']=_0x20f8('0x8e');break;case _0x20f8('0x8f'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0x90');break;case _0x20f8('0x91'):_0x3caeeb[_0x20f8('0x73')]='SquareRecording';_0x3caeeb[_0x20f8('0x75')]=[{'name':'SquareProjects','field':_0x20f8('0x2f'),'foreignKey':_0x20f8('0x92')}];break;case _0x20f8('0x93'):_0x3caeeb['childModel']=_0x20f8('0x94');break;case _0x20f8('0x95'):_0x3caeeb['childModel']='CmContact';_0x3caeeb[_0x20f8('0x75')]=[{'name':_0x20f8('0x96'),'field':'id','foreignKey':'ListId'}];break;case _0x20f8('0x97'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0x98');break;case _0x20f8('0x99'):_0x3caeeb['childModel']=_0x20f8('0x9a');break;case _0x20f8('0x9b'):_0x3caeeb[_0x20f8('0x73')]='CmCustomField';break;case'chatqueues':_0x3caeeb['childModel']='ChatQueue';break;case _0x20f8('0x9c'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0x9d');break;case _0x20f8('0x9e'):_0x3caeeb['childModel']=_0x20f8('0x9f');break;case _0x20f8('0xa0'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xa1');break;case'inboundroutes':case _0x20f8('0xa2'):case _0x20f8('0xa3'):_0x3caeeb['childModel']='VoiceExtension';break;case _0x20f8('0xa4'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xa5');break;case _0x20f8('0xa6'):_0x3caeeb['childModel']=_0x20f8('0xa7');break;case _0x20f8('0xa8'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xa9');_0x3caeeb['parentSections']=[{'name':_0x20f8('0xaa'),'field':'name','foreignKey':_0x20f8('0xab'),'model':_0x20f8('0xac'),'filter':{'field':_0x20f8('0xad'),'value':[_0x20f8('0xae')]}},{'name':_0x20f8('0xaf'),'field':_0x20f8('0x2f'),'foreignKey':_0x20f8('0xab'),'model':'User','filter':{'field':_0x20f8('0xad'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x20f8('0x2f'),'foreignKey':'queue','model':_0x20f8('0xb0'),'filter':{'field':'type','value':[_0x20f8('0xb1')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x20f8('0xb2'),'model':'VoiceQueue','filter':{'field':_0x20f8('0x35'),'value':[_0x20f8('0xb3')]}}];break;case'musiconholds':_0x3caeeb['childModel']=_0x20f8('0xb4');break;case _0x20f8('0xb5'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xb6');break;case _0x20f8('0xb7'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xb8');break;case _0x20f8('0xb9'):_0x3caeeb['childModel']='Campaign';break;case _0x20f8('0xba'):_0x3caeeb['childModel']=_0x20f8('0xbb');break;case _0x20f8('0xbc'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xbd');break;case _0x20f8('0xbe'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xbf');break;case _0x20f8('0xc0'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xc1');break;case _0x20f8('0xc2'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xc3');break;case _0x20f8('0xc4'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xc5');break;case _0x20f8('0xc6'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xc7');break;case _0x20f8('0xc8'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xc9');break;case _0x20f8('0xca'):_0x3caeeb[_0x20f8('0x73')]='WhatsappAccount';break;case _0x20f8('0xcb'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xcc');break;case _0x20f8('0xcd'):case _0x20f8('0xce'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xb0');if(_0x590532){_0x3caeeb['parentSections']=[{'name':_0x20f8('0xcf')},{'name':_0x20f8('0xd0')}];}break;case _0x20f8('0xd1'):case _0x20f8('0xd2'):case _0x20f8('0xd3'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xac');if(_0x590532){_0x3caeeb['parentSections']=[{'name':_0x20f8('0xd4'),'filter':{'field':_0x20f8('0xad'),'value':['admin',_0x20f8('0xd5')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x20f8('0xd6'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xd7');break;case _0x20f8('0xd8'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xd9');break;case'freshdeskaccounts':_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xda');break;case'sugarcrmaccounts':_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xdb');break;case _0x20f8('0xdc'):_0x3caeeb[_0x20f8('0x73')]='DeskAccount';break;case _0x20f8('0xdd'):_0x3caeeb['childModel']=_0x20f8('0xde');break;case _0x20f8('0xdf'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xac');break;case _0x20f8('0xe0'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xe1');break;case'dispositions':_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xe2');break;case _0x20f8('0xe3'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0x67');break;case'intervals':_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xe4');break;case'pauses':_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xe5');break;case _0x20f8('0xe6'):_0x3caeeb['childModel']='Schedule';break;case _0x20f8('0xe7'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xe8');break;case _0x20f8('0xe9'):_0x3caeeb[_0x20f8('0x73')]='Tag';break;case _0x20f8('0xea'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xeb');break;case _0x20f8('0xec'):_0x3caeeb[_0x20f8('0x73')]='Trigger';break;case _0x20f8('0xed'):_0x3caeeb[_0x20f8('0x73')]='Trunk';break;case _0x20f8('0xee'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xef');break;case'plugins':_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0x6a');break;case'extractedreports':_0x3caeeb[_0x20f8('0x73')]='AnalyticExtractedReport';_0x3caeeb[_0x20f8('0x75')]=[{'name':_0x20f8('0xf0'),'field':'id','foreignKey':_0x20f8('0x81')}];break;case _0x20f8('0xf1'):_0x3caeeb[_0x20f8('0x73')]='AnalyticMetric';break;case _0x20f8('0xca'):_0x3caeeb[_0x20f8('0x73')]=_0x20f8('0xf2');break;default:return _0x3caeeb;}return _0x3caeeb;} \ No newline at end of file +var _0x0404=['Template','Trigger','trunks','Trunk','variables','Variable','plugins','Reports','AnalyticMetric','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','index','map','UserProfile','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','filter','options','count','then','includeAll','findAll','rows','catch','show','params','find','create','body','include','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','push','get','removeSections','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','parentSections','all','ignore','union','nolimit','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','faxqueues','inboundroutes','internalroutes','outboundroutes','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','users','agents','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','intervals','pauses','Pause','sounds','Sound','templates'];(function(_0x450689,_0x3b857c){var _0x46ffb0=function(_0x5d3679){while(--_0x5d3679){_0x450689['push'](_0x450689['shift']());}};_0x46ffb0(++_0x3b857c);}(_0x0404,0xf4));var _0x4040=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0404[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4040('0x0'));var rimraf=require(_0x4040('0x1'));var zipdir=require(_0x4040('0x2'));var jsonpatch=require(_0x4040('0x3'));var rp=require(_0x4040('0x4'));var moment=require(_0x4040('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4040('0x6'));var util=require(_0x4040('0x7'));var path=require(_0x4040('0x8'));var sox=require(_0x4040('0x9'));var csv=require('to-csv');var ejs=require(_0x4040('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4040('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4040('0xc'));var toCsv=require(_0x4040('0xd'));var querystring=require(_0x4040('0xe'));var Papa=require('papaparse');var Redis=require(_0x4040('0xf'));var authService=require(_0x4040('0x10'));var qs=require(_0x4040('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4040('0x12'));var logger=require(_0x4040('0x13'))('api');var utils=require(_0x4040('0x14'));var config=require(_0x4040('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4040('0x16'))['db'];config[_0x4040('0x17')]=_[_0x4040('0x18')](config['redis'],{'host':_0x4040('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4040('0x17')]));require(_0x4040('0x1a'))[_0x4040('0x1b')](socket);function respondWithStatusCode(_0x4d0771,_0x1f5361){_0x1f5361=_0x1f5361||0xcc;return function(_0x20cc90){if(_0x20cc90){return _0x4d0771['sendStatus'](_0x1f5361);}return _0x4d0771['status'](_0x1f5361)['end']();};}function respondWithResult(_0x2a49f4,_0x458537){_0x458537=_0x458537||0xc8;return function(_0x439a20){if(_0x439a20){return _0x2a49f4[_0x4040('0x1c')](_0x458537)[_0x4040('0x1d')](_0x439a20);}};}function respondWithFilteredResult(_0x1135cd,_0x2b388f){return function(_0x23b6a6){if(_0x23b6a6){var _0xca7988=_0x23b6a6['count'],_0x307d8e=_0x2b388f[_0x4040('0x1e')],_0x470e12=_0x2b388f[_0x4040('0x1e')]+_0x2b388f[_0x4040('0x1f')],_0x52f988;if(_0x470e12>=_0xca7988){_0x470e12=_0xca7988;_0x52f988=0xc8;}else{_0x52f988=0xce;}_0x1135cd['status'](_0x52f988);return _0x1135cd[_0x4040('0x20')](_0x4040('0x21'),_0x307d8e+'-'+_0x470e12+'/'+_0xca7988)[_0x4040('0x1d')](_0x23b6a6);}return null;};}function patchUpdates(_0x3a3ddc){return function(_0x230295){try{jsonpatch[_0x4040('0x22')](_0x230295,_0x3a3ddc,!![]);}catch(_0xec1f81){return BPromise[_0x4040('0x23')](_0xec1f81);}return _0x230295[_0x4040('0x24')]();};}function saveUpdates(_0x3cb9a9,_0x39a825){return function(_0xa1e25d){if(_0xa1e25d){return _0xa1e25d[_0x4040('0x25')](_0x3cb9a9)['then'](function(_0x429c77){return _0x429c77;});}return null;};}function removeEntity(_0x5686c2,_0x152e67){return function(_0x585914){if(_0x585914){return _0x585914[_0x4040('0x26')]()['then'](function(){_0x5686c2[_0x4040('0x1c')](0xcc)[_0x4040('0x27')]();});}};}function handleEntityNotFound(_0x155d47,_0x480c21){return function(_0x2667b2){if(!_0x2667b2){_0x155d47[_0x4040('0x28')](0x194);}return _0x2667b2;};}function handleError(_0x2b61b7,_0x2980d3){_0x2980d3=_0x2980d3||0x1f4;return function(_0x1d670f){logger[_0x4040('0x29')](_0x1d670f[_0x4040('0x2a')]);if(_0x1d670f[_0x4040('0x2b')]){delete _0x1d670f[_0x4040('0x2b')];}_0x2b61b7[_0x4040('0x1c')](_0x2980d3)['send'](_0x1d670f);};}exports[_0x4040('0x2c')]=function(_0x2f787b,_0xa72be){var _0x2acf39={},_0x21e760={},_0x1cb926={'count':0x0,'rows':[]};var _0x33f25c=_[_0x4040('0x2d')](db[_0x4040('0x2e')][_0x4040('0x2f')],function(_0xa75126){return{'name':_0xa75126['fieldName'],'type':_0xa75126[_0x4040('0x30')][_0x4040('0x31')]};});_0x21e760[_0x4040('0x32')]=_[_0x4040('0x2d')](_0x33f25c,_0x4040('0x2b'));_0x21e760['query']=_[_0x4040('0x33')](_0x2f787b[_0x4040('0x34')]);_0x21e760[_0x4040('0x35')]=_[_0x4040('0x36')](_0x21e760[_0x4040('0x32')],_0x21e760[_0x4040('0x34')]);_0x2acf39['attributes']=_[_0x4040('0x36')](_0x21e760[_0x4040('0x32')],qs[_0x4040('0x37')](_0x2f787b[_0x4040('0x34')]['fields']));_0x2acf39[_0x4040('0x38')]=_0x2acf39[_0x4040('0x38')][_0x4040('0x39')]?_0x2acf39[_0x4040('0x38')]:_0x21e760[_0x4040('0x32')];if(!_0x2f787b[_0x4040('0x34')][_0x4040('0x3a')]('nolimit')){_0x2acf39[_0x4040('0x1f')]=qs[_0x4040('0x1f')](_0x2f787b[_0x4040('0x34')][_0x4040('0x1f')]);_0x2acf39[_0x4040('0x1e')]=qs[_0x4040('0x1e')](_0x2f787b[_0x4040('0x34')][_0x4040('0x1e')]);}_0x2acf39[_0x4040('0x3b')]=qs[_0x4040('0x3c')](_0x2f787b[_0x4040('0x34')][_0x4040('0x3c')]);_0x2acf39[_0x4040('0x3d')]=qs[_0x4040('0x35')](_['pick'](_0x2f787b[_0x4040('0x34')],_0x21e760[_0x4040('0x35')]),_0x33f25c);if(_0x2f787b['query']['filter']){_0x2acf39[_0x4040('0x3d')]=_[_0x4040('0x3e')](_0x2acf39[_0x4040('0x3d')],{'$or':_[_0x4040('0x2d')](_0x33f25c,function(_0x3a2f28){if(_0x3a2f28['type']!=='VIRTUAL'){var _0xea11d7={};_0xea11d7[_0x3a2f28[_0x4040('0x2b')]]={'$like':'%'+_0x2f787b[_0x4040('0x34')][_0x4040('0x3f')]+'%'};return _0xea11d7;}})});}_0x2acf39=_['merge']({},_0x2acf39,_0x2f787b[_0x4040('0x40')]);var _0x23d18c={'where':_0x2acf39[_0x4040('0x3d')]};return db[_0x4040('0x2e')][_0x4040('0x41')](_0x23d18c)[_0x4040('0x42')](function(_0x4ceffe){_0x1cb926[_0x4040('0x41')]=_0x4ceffe;if(_0x2f787b[_0x4040('0x34')][_0x4040('0x43')]){_0x2acf39['include']=[{'all':!![]}];}return db[_0x4040('0x2e')][_0x4040('0x44')](_0x2acf39);})[_0x4040('0x42')](function(_0x4de8fc){_0x1cb926[_0x4040('0x45')]=_0x4de8fc;return _0x1cb926;})[_0x4040('0x42')](respondWithFilteredResult(_0xa72be,_0x2acf39))[_0x4040('0x46')](handleError(_0xa72be,null));};exports[_0x4040('0x47')]=function(_0x4c272c,_0x134c17){var _0xfc3c72={'raw':![],'where':{'id':_0x4c272c[_0x4040('0x48')]['id']}},_0x4959c4={};_0x4959c4[_0x4040('0x32')]=_[_0x4040('0x33')](db[_0x4040('0x2e')][_0x4040('0x2f')]);_0x4959c4['query']=_['keys'](_0x4c272c[_0x4040('0x34')]);_0x4959c4['filters']=_[_0x4040('0x36')](_0x4959c4[_0x4040('0x32')],_0x4959c4[_0x4040('0x34')]);_0xfc3c72[_0x4040('0x38')]=_[_0x4040('0x36')](_0x4959c4['model'],qs['fields'](_0x4c272c['query'][_0x4040('0x37')]));_0xfc3c72[_0x4040('0x38')]=_0xfc3c72['attributes']['length']?_0xfc3c72[_0x4040('0x38')]:_0x4959c4[_0x4040('0x32')];if(_0x4c272c[_0x4040('0x34')]['includeAll']){_0xfc3c72['include']=[{'all':!![]}];}_0xfc3c72=_[_0x4040('0x3e')]({},_0xfc3c72,_0x4c272c['options']);return db[_0x4040('0x2e')][_0x4040('0x49')](_0xfc3c72)[_0x4040('0x42')](handleEntityNotFound(_0x134c17,null))['then'](respondWithResult(_0x134c17,null))[_0x4040('0x46')](handleError(_0x134c17,null));};exports[_0x4040('0x4a')]=function(_0x17f021,_0x3149c0){return db[_0x4040('0x2e')]['create'](_0x17f021[_0x4040('0x4b')],{})[_0x4040('0x42')](respondWithResult(_0x3149c0,0xc9))[_0x4040('0x46')](handleError(_0x3149c0,null));};exports['clone']=function(_0x1d7b16,_0x5a833a){var _0x46ceb4={'where':{'id':_0x1d7b16[_0x4040('0x48')]['id']}},_0x502c59={};_0x502c59[_0x4040('0x32')]=_['keys'](db[_0x4040('0x2e')][_0x4040('0x2f')]);_0x46ceb4['attributes']=_[_0x4040('0x36')](_0x502c59[_0x4040('0x32')],qs[_0x4040('0x37')](_0x1d7b16[_0x4040('0x34')][_0x4040('0x37')]));_0x46ceb4[_0x4040('0x38')]=_0x46ceb4[_0x4040('0x38')][_0x4040('0x39')]?_0x46ceb4[_0x4040('0x38')]:_0x502c59[_0x4040('0x32')];if(_0x1d7b16[_0x4040('0x34')][_0x4040('0x43')]){_0x46ceb4[_0x4040('0x4c')]=[{'all':!![]}];}_0x46ceb4=_[_0x4040('0x3e')]({},_0x46ceb4,_0x1d7b16[_0x4040('0x40')]);return db['UserProfile']['find'](_0x46ceb4)[_0x4040('0x42')](handleEntityNotFound(_0x5a833a,null))[_0x4040('0x42')](function(_0xeb1bec){if(_0xeb1bec){var _0x57a85a=_0xeb1bec['get']({'plain':!![]});_0x57a85a=qs[_0x4040('0x4d')](_0x57a85a,['id',_0x4040('0x4e'),_0x4040('0x4f'),_0x4040('0x50')]);_0x1d7b16[_0x4040('0x4b')]=_['omit'](_0x1d7b16[_0x4040('0x4b')],['id',_0x4040('0x4e'),'updatedAt']);return db[_0x4040('0x51')][_0x4040('0x52')](function(_0x45a668){return db[_0x4040('0x2e')][_0x4040('0x4a')](_['merge'](_0x57a85a,_0x1d7b16['body']),{'include':_0x1d7b16[_0x4040('0x34')][_0x4040('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x45a668})[_0x4040('0x42')](function(_0x486b36){var _0x10334d=_0x486b36['get']({'plain':!![]});return db[_0x4040('0x53')][_0x4040('0x44')]({'where':{'userProfileId':_0x1d7b16[_0x4040('0x48')]['id']},'raw':!![]})[_0x4040('0x42')](function(_0x2746bd){if(_0x2746bd){return BPromise[_0x4040('0x54')](_0x2746bd,function(_0x57c143){return new BPromise(function(_0x345322,_0x42b426){if(_0x57c143[_0x4040('0x55')]===null||_0x57c143[_0x4040('0x55')]===0x1)_0x345322(null);return db[_0x4040('0x56')][_0x4040('0x44')]({'where':{'sectionId':_0x57c143['id']},'raw':!![]})['then'](function(_0x2a9ed3){var _0x58a8eb=_[_0x4040('0x2d')](_0x2a9ed3,function(_0x64056b){return qs[_0x4040('0x4d')](_0x64056b,['id',_0x4040('0x4e'),'updatedAt',_0x4040('0x57')]);});_0x345322(_0x58a8eb);})[_0x4040('0x46')](function(_0x23189d){_0x42b426(_0x23189d);});})[_0x4040('0x42')](function(_0x49d320){var _0x1ef781=qs[_0x4040('0x4d')](_0x57c143,['id',_0x4040('0x4e'),_0x4040('0x4f')]);_0x1ef781['userProfileId']=_0x10334d['id'];if(_0x49d320)_0x1ef781[_0x4040('0x58')]=_0x49d320;return _0x1ef781;})[_0x4040('0x42')](function(_0x3c4a71){return db[_0x4040('0x53')][_0x4040('0x4a')](_0x3c4a71,{'include':[{'model':db[_0x4040('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x45a668});});})['then'](function(){return _0x10334d;});}});});});}})['then'](respondWithResult(_0x5a833a,0xc9))[_0x4040('0x46')](handleError(_0x5a833a,null));};exports[_0x4040('0x25')]=function(_0xe16260,_0x9406f2){if(_0xe16260[_0x4040('0x4b')]['id']){delete _0xe16260[_0x4040('0x4b')]['id'];}return db[_0x4040('0x2e')][_0x4040('0x49')]({'where':{'id':_0xe16260[_0x4040('0x48')]['id']}})[_0x4040('0x42')](handleEntityNotFound(_0x9406f2,null))[_0x4040('0x42')](saveUpdates(_0xe16260[_0x4040('0x4b')],null))[_0x4040('0x42')](respondWithResult(_0x9406f2,null))[_0x4040('0x46')](handleError(_0x9406f2,null));};exports[_0x4040('0x26')]=function(_0x6fd9df,_0x6b2688){return db[_0x4040('0x2e')][_0x4040('0x49')]({'where':{'id':_0x6fd9df['params']['id']}})[_0x4040('0x42')](handleEntityNotFound(_0x6b2688,null))[_0x4040('0x42')](removeEntity(_0x6b2688,null))['catch'](handleError(_0x6b2688,null));};exports[_0x4040('0x59')]=function(_0x36d49f,_0x3eff38){return db['UserProfile'][_0x4040('0x59')]()[_0x4040('0x42')](respondWithResult(_0x3eff38,null))[_0x4040('0x46')](handleError(_0x3eff38,null));};exports[_0x4040('0x5a')]=function(_0x464edb,_0x23d0fa){var _0xdc76d2=_0x464edb[_0x4040('0x4b')];return db['UserProfile']['find']({'where':{'id':_0x464edb['params']['id']}})[_0x4040('0x42')](handleEntityNotFound(_0x23d0fa,null))[_0x4040('0x42')](function(_0x1c07e6){if(_0x1c07e6){return db[_0x4040('0x51')][_0x4040('0x52')](function(_0x28b8f9){return db['UserProfileSection'][_0x4040('0x26')]({'where':{'userProfileId':_0x464edb[_0x4040('0x48')]['id'],'sectionId':_[_0x4040('0x2d')](_0xdc76d2,function(_0x491daf){return _0x491daf[_0x4040('0x57')];})},'transaction':_0x28b8f9})[_0x4040('0x42')](function(){var _0x2ea9c4=_[_0x4040('0x2d')](_0xdc76d2,function(_0x4d9167){_0x4d9167[_0x4040('0x5b')]=_0x464edb[_0x4040('0x48')]['id'];return _0x4d9167;});var _0x4b98ad=[];return BPromise[_0x4040('0x54')](_0x2ea9c4,function(_0x3cb505){return db['UserProfileSection'][_0x4040('0x4a')](_0x3cb505,{'include':[{'model':db[_0x4040('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x28b8f9})['then'](function(_0x3e0288){_0x4b98ad[_0x4040('0x5c')](_0x3e0288[_0x4040('0x5d')]({'plain':!![]}));});})[_0x4040('0x42')](function(){return _0x4b98ad;});});});}})[_0x4040('0x42')](function(_0xec10e1){return _0xec10e1;})[_0x4040('0x42')](respondWithResult(_0x23d0fa,null))['catch'](handleError(_0x23d0fa,null));};exports[_0x4040('0x5e')]=function(_0x2a3dd1,_0x36bd8e){var _0x452f9e;return db[_0x4040('0x2e')][_0x4040('0x49')]({'where':{'id':_0x2a3dd1['params']['id']},'attributes':['id',_0x4040('0x2b')]})[_0x4040('0x42')](handleEntityNotFound(_0x36bd8e,null))[_0x4040('0x42')](function(_0x32ecd7){if(_0x32ecd7){_0x452f9e=_0x32ecd7;return db[_0x4040('0x53')][_0x4040('0x26')]({'where':{'userProfileId':_0x2a3dd1['params']['id'],'sectionId':_0x2a3dd1[_0x4040('0x34')]['ids']}});}})[_0x4040('0x42')](function(){return _0x452f9e;})['then'](respondWithStatusCode(_0x36bd8e,null))['catch'](handleError(_0x36bd8e,null));};exports[_0x4040('0x5f')]=function(_0x8cc036,_0x2b0328){var _0xd67c3e=[];var _0x29434b=[];return db[_0x4040('0x53')][_0x4040('0x44')]({'where':{'userProfileId':_0x8cc036[_0x4040('0x48')]['id']},'raw':!![]})[_0x4040('0x42')](function(_0x2c44f7){_0xd67c3e=_[_0x4040('0x3f')](_0x2c44f7,function(_0x17ad7b){return _0x17ad7b['enabled']===0x1||_[_0x4040('0x60')]([0x3eb,0x709],_0x17ad7b[_0x4040('0x57')]);});if(!_[_0x4040('0x61')](_0xd67c3e)){return _[_0x4040('0x2d')](_0xd67c3e,function(_0x20a193){return _0x20a193[_0x4040('0x57')];});}else{return;}})[_0x4040('0x42')](function(_0x2f1262){if(_0x2f1262)_0x29434b=_0x2f1262;if(_[_0x4040('0x60')](_0x29434b,0x64)){var _0xfdeef0=_[_0x4040('0x49')](_0xd67c3e,{'sectionId':0x64});return hasDefaultDashboard(_0xfdeef0)[_0x4040('0x42')](function(_0x590cc5){return _['map'](_0xd67c3e,function(_0xa5e511){if(_0xa5e511[_0x4040('0x57')]===0x64){_0xa5e511[_0x4040('0x62')]=_0x590cc5;}return _0xa5e511;});});}else{return;}})['then'](function(_0x5f0d3b){if(_0x5f0d3b)_0xd67c3e=_0x5f0d3b;if(_[_0x4040('0x60')](_0x29434b,0x3eb)){var _0x3b7772=_[_0x4040('0x49')](_0xd67c3e,{'sectionId':0x3eb});return getCustomDashboards(_0x3b7772)['then'](function(_0x31579b){return _[_0x4040('0x2d')](_0xd67c3e,function(_0x27c86a){if(_0x3b7772[_0x4040('0x63')]){if(_0x27c86a['sectionId']===0x3eb){_0x27c86a[_0x4040('0x62')]=_0x31579b;}}else{if(_0x27c86a['sectionId']===0x64){_0x27c86a[_0x4040('0x62')]=_0x31579b;}}return _0x27c86a;});});}else{return;}})[_0x4040('0x42')](function(_0x1d175d){if(_0x1d175d)_0xd67c3e=_0x1d175d;if(_['includes'](_0x29434b,0x709)){var _0x242837=_[_0x4040('0x49')](_0xd67c3e,{'sectionId':0x709});return getPlugins(_0x242837)[_0x4040('0x42')](function(_0xeeea32){if(_0x242837[_0x4040('0x63')]){return _['map'](_0xd67c3e,function(_0x53fa79){if(_0x53fa79[_0x4040('0x57')]===0x709){_0x53fa79['subsections']=_0xeeea32;}return _0x53fa79;});}else{var _0x4cfc31={'sectionId':0x76c,'enabled':0x1,'subsections':_0xeeea32};var _0x20a32c=_[_0x4040('0x2d')](_0xd67c3e);_0x20a32c['push'](_0x4cfc31);return _0x20a32c;}});}else{return;}})['then'](function(_0x53b7e8){if(_0x53b7e8)_0xd67c3e=_0x53b7e8;return _['filter'](_0xd67c3e,[_0x4040('0x63'),0x1]);})[_0x4040('0x42')](respondWithResult(_0x2b0328,null))[_0x4040('0x46')](handleError(_0x2b0328,null));};function hasDefaultDashboard(_0x32329d){var _0x39ec1b=[0x65];return new BPromise(function(_0x1ea137,_0x5bc347){try{if(_0x32329d[_0x4040('0x55')]){_0x1ea137(_0x39ec1b);}else{return db[_0x4040('0x56')][_0x4040('0x64')]({'where':{'sectionId':_0x32329d['id']},'raw':!![]})[_0x4040('0x42')](function(_0x492399){_0x492399?_0x1ea137(_0x39ec1b):_0x1ea137();});}}catch(_0x2fea36){_0x5bc347(_0x2fea36);}});}function getCustomDashboards(_0x2bea05){var _0x39f8bc=[];return new BPromise(function(_0x1d874e,_0x17afe7){try{if(_0x2bea05['autoAssociation']){return db[_0x4040('0x65')]['findAll']({'raw':!![]})['then'](function(_0x460bc0){_0x460bc0['forEach'](function(_0x4f9ac5){_0x39f8bc[_0x4040('0x5c')](_0x4f9ac5['id']+0x1869f);});_0x1d874e(_0x39f8bc);});}else{return db[_0x4040('0x56')][_0x4040('0x44')]({'where':{'sectionId':_0x2bea05['id']},'raw':!![]})[_0x4040('0x42')](function(_0x35a78a){_0x35a78a[_0x4040('0x66')](function(_0x81bd56){_0x39f8bc[_0x4040('0x5c')](_0x81bd56[_0x4040('0x67')]+0x1869f);});_0x1d874e(_0x39f8bc);});}}catch(_0xd067c6){_0x17afe7(_0xd067c6);}});}function getPlugins(_0x5a84a3){var _0x1e99bc=[];return new BPromise(function(_0x263be6,_0x3a974c){try{if(_0x5a84a3['autoAssociation']){return db[_0x4040('0x68')][_0x4040('0x44')]({'raw':!![]})['then'](function(_0x18403a){_0x18403a['forEach'](function(_0x15d79c){_0x1e99bc[_0x4040('0x5c')](_0x15d79c['id']+0x15b38);});_0x263be6(_0x1e99bc);});}else{return db[_0x4040('0x56')][_0x4040('0x44')]({'where':{'sectionId':_0x5a84a3['id']},'raw':!![]})[_0x4040('0x42')](function(_0x5898c7){_0x5898c7[_0x4040('0x66')](function(_0x5f1380){_0x1e99bc[_0x4040('0x5c')](_0x5f1380[_0x4040('0x67')]+0x15b38);});_0x263be6(_0x1e99bc);});}}catch(_0x193323){_0x3a974c(_0x193323);}});}exports['addResources']=function(_0x1abf3a,_0x573b4f){return db[_0x4040('0x2e')][_0x4040('0x49')]({'where':{'id':_0x1abf3a[_0x4040('0x48')]['id']}})[_0x4040('0x42')](handleEntityNotFound(_0x573b4f,null))[_0x4040('0x42')](function(_0x376846){if(_0x376846){return db[_0x4040('0x51')][_0x4040('0x52')](function(_0x5bed17){return db[_0x4040('0x53')]['findAll']({'where':{'userProfileId':_0x1abf3a[_0x4040('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x4040('0x42')](function(_0x42c84e){if(_0x42c84e){return db[_0x4040('0x53')][_0x4040('0x26')]({'where':{'userProfileId':_0x1abf3a[_0x4040('0x48')]['id'],'id':_[_0x4040('0x2d')](_0x42c84e,function(_0x18732e){return _0x18732e['id'];})},'transaction':_0x5bed17});}})[_0x4040('0x42')](function(_0x100b25){var _0xd4618b=_[_0x4040('0x2d')](_0x1abf3a[_0x4040('0x4b')],function(_0x1ed922){_0x1ed922[_0x4040('0x5b')]=_0x1abf3a[_0x4040('0x48')]['id'];return _0x1ed922;});return db[_0x4040('0x53')][_0x4040('0x69')](_0xd4618b,{'raw':!![],'transaction':_0x5bed17});})[_0x4040('0x42')](function(_0x2bd5db){var _0x3b48ab=_[_0x4040('0x3f')](_['map'](_0x2bd5db,function(_0x495fed){return _0x495fed['get']({'plain':!![]});}),{'includeAll':![]});if(_0x3b48ab){return db[_0x4040('0x53')][_0x4040('0x44')]({'where':{'userProfileId':_0x1abf3a[_0x4040('0x48')]['id'],'sectionId':_['map'](_0x3b48ab,function(_0x3f12bb){return _0x3f12bb[_0x4040('0x57')];})},'attributes':['id',_0x4040('0x57')],'raw':!![]})[_0x4040('0x42')](function(_0x87e07f){var _0x320e6a=_[_0x4040('0x2d')](_0x1abf3a['body'],function(_0x519586){_0x519586[_0x4040('0x5b')]=_0x1abf3a[_0x4040('0x48')]['id'];return _0x519586;});return db[_0x4040('0x56')]['bulkCreate'](_0x320e6a,{'raw':!![],'transaction':_0x5bed17});});}})[_0x4040('0x46')](handleError(_0x573b4f,null));});}})['then'](function(_0x153b7b){var _0xd10af5=_[_0x4040('0x2d')](_0x153b7b,function(_0x5032be){return _0x5032be['get']({'plain':!![]});});})[_0x4040('0x42')](respondWithResult(_0x573b4f,null))['catch'](handleError(_0x573b4f,null));};exports[_0x4040('0x6a')]=function(_0x584ff2,_0x3ac77,_0x167215){return db['UserProfile'][_0x4040('0x49')]({'where':{'id':_0x584ff2[_0x4040('0x48')]['id']}})[_0x4040('0x42')](handleEntityNotFound(_0x3ac77,null))[_0x4040('0x42')](function(_0x10a8aa){if(_0x10a8aa){return _0x10a8aa[_0x4040('0x6a')](_0x584ff2['query'][_0x4040('0x6b')]);}})['then'](respondWithStatusCode(_0x3ac77,null))[_0x4040('0x46')](handleError(_0x3ac77,null));};exports[_0x4040('0x6c')]=function(_0x330a2b,_0x417646){var _0x3d324b={'raw':![],'where':{}};var _0x3a243f={};var _0xf0161c={'count':0x0,'rows':[]};var _0x11ccba=_0x330a2b[_0x4040('0x34')][_0x4040('0x6d')];if(typeof _0x11ccba==='undefined'){throw new db[(_0x4040('0x6e'))][(_0x4040('0x6f'))](_0x4040('0x70'));}var _0x432112=_0x330a2b['query'][_0x4040('0x71')]||![];var _0x4c6dcb=getQueryModels(_0x11ccba,_0x432112);if(typeof _0x4c6dcb[_0x4040('0x72')]==='undefined'){throw new db[(_0x4040('0x6e'))][(_0x4040('0x6f'))]('Invalid\x20section\x20\x27'+_0x11ccba+'\x27');}var _0x23c3a2=[];if(!_[_0x4040('0x61')](_0x4c6dcb[_0x4040('0x73')])){_0x23c3a2=_0x4c6dcb[_0x4040('0x73')];}else{_0x23c3a2=[{'name':_0x11ccba}];}return db[_0x4040('0x2e')]['findOne']({'where':{'id':_0x330a2b['params']['id']}})['then'](handleEntityNotFound(_0x417646,null))['then'](function(_0x5acc34){if(_0x5acc34){var _0x56913e=[];for(var _0x4afada=0x0;_0x4afada<_0x23c3a2[_0x4040('0x39')];_0x4afada++){_0x56913e[_0x4040('0x5c')](db[_0x4040('0x53')][_0x4040('0x64')]({'where':{'userProfileId':_0x5acc34['id'],'name':_0x23c3a2[_0x4afada][_0x4040('0x2b')]},'raw':!![]}));}return BPromise[_0x4040('0x74')](_0x56913e);}})['then'](function(_0x2bc856){var _0x427081=_[_0x4040('0x3f')](_0x2bc856,function(_0x13f3db){return _0x13f3db?_0x13f3db:undefined;});var _0x417eef=_[_0x4040('0x3f')](_0x23c3a2,[_0x4040('0x75'),!![]]);var _0x489160=_[_0x4040('0x61')](_0x427081)&&_[_0x4040('0x61')](_0x417eef)?null:_[_0x4040('0x76')](_0x417eef,_0x427081);if(_0x489160){var _0x27ed3a=[];for(var _0x27a9c8=0x0;_0x27a9c8<_0x489160['length'];_0x27a9c8++){var _0x208223=_['find'](_0x23c3a2,function(_0x4ae3ab){return _0x489160[_0x27a9c8]?_0x4ae3ab[_0x4040('0x2b')]===_0x489160[_0x27a9c8][_0x4040('0x2b')]:null;});if(_0x208223){if(_0x489160[_0x27a9c8]['ignore']){_0x27ed3a[_0x4040('0x5c')](getAllResources(_0x4c6dcb[_0x4040('0x72')],_0x489160[_0x27a9c8]));}else{if(!_0x489160[_0x27a9c8][_0x4040('0x55')]){_0x27ed3a[_0x4040('0x5c')](getAllowedResources(_0x208223,_0x489160[_0x27a9c8],_0x4c6dcb[_0x4040('0x72')]));}else{if(_0x208223[_0x4040('0x32')]){_0x27ed3a['push'](getAllFilteredResources(_0x208223,_0x489160[_0x27a9c8]));}}}}}return BPromise[_0x4040('0x74')](_0x27ed3a);}else{return null;}})[_0x4040('0x42')](function(_0x3a4313){var _0x3bb8fa=_0x3a4313;var _0x224fbb=null;if(_0x3bb8fa){_0x224fbb=_0x3bb8fa[_0x4040('0x39')]===0x1?_0x3bb8fa[0x0]:null;}if(_0x224fbb||_0x3bb8fa){var _0x1389b2=db[_0x4c6dcb[_0x4040('0x72')]][_0x4040('0x2f')];_0x3a243f[_0x4040('0x32')]=_[_0x4040('0x33')](_0x1389b2);_0x3a243f[_0x4040('0x34')]=_['keys'](_0x330a2b[_0x4040('0x34')]);_0x3a243f[_0x4040('0x35')]=_[_0x4040('0x36')](_0x3a243f[_0x4040('0x32')],_0x3a243f['query']);_0x3d324b[_0x4040('0x38')]=_['intersection'](_0x3a243f['model'],qs[_0x4040('0x37')](_0x330a2b[_0x4040('0x34')][_0x4040('0x37')]));_0x3d324b[_0x4040('0x38')]=_0x3d324b['attributes']['length']?_0x3d324b[_0x4040('0x38')]:_0x3a243f[_0x4040('0x32')];if(!_0x330a2b[_0x4040('0x34')]['hasOwnProperty'](_0x4040('0x77'))){_0x3d324b[_0x4040('0x1f')]=qs['limit'](_0x330a2b[_0x4040('0x34')][_0x4040('0x1f')]);_0x3d324b[_0x4040('0x1e')]=qs[_0x4040('0x1e')](_0x330a2b['query'][_0x4040('0x1e')]);}_0x3d324b[_0x4040('0x3b')]=qs[_0x4040('0x3c')](_0x330a2b[_0x4040('0x34')]['sort']);_0x3d324b[_0x4040('0x3d')]=qs[_0x4040('0x35')](_['pick'](_0x330a2b[_0x4040('0x34')],_0x3a243f[_0x4040('0x35')]));if(_0x330a2b[_0x4040('0x34')][_0x4040('0x3f')]){_0x3d324b['where']=_['merge'](_0x3d324b['where'],{'$or':_[_0x4040('0x2d')](_0x1389b2,function(_0x4c13ca){if(_0x4c13ca[_0x4040('0x30')][_0x4040('0x31')]!==_0x4040('0x78')){var _0x395bc5={};_0x395bc5[_0x4c13ca[_0x4040('0x79')]]={'$like':'%'+_0x330a2b[_0x4040('0x34')][_0x4040('0x3f')]+'%'};return _0x395bc5;}})});}var _0x208869=[];if(_0x224fbb){var _0x5beaf4=_[_0x4040('0x49')](_0x23c3a2,['name',_0x224fbb[_0x4040('0x2b')]]);if(_0x5beaf4[_0x4040('0x79')]){var _0x1cdbd3={};if(_0x4c6dcb['childModel']===_0x4040('0x7a')){_0x1cdbd3[_0x5beaf4[_0x4040('0x7b')]]=_[_0x4040('0x2d')](_0x224fbb[_0x4040('0x7c')],'id');}else{_0x1cdbd3[_0x5beaf4[_0x4040('0x7b')]]=_0x224fbb['associatedResources'];}_0x208869[_0x4040('0x5c')](_0x1cdbd3);}else{_0x3d324b['where']['id']=_0x224fbb[_0x4040('0x7c')];}}else{for(var _0x4cc434=0x0;_0x4cc434<_0x3bb8fa[_0x4040('0x39')];_0x4cc434++){var _0x5beaf4=_[_0x4040('0x49')](_0x23c3a2,['name',_0x3bb8fa[_0x4cc434][_0x4040('0x2b')]]);if(_0x5beaf4[_0x4040('0x79')]){var _0x1cdbd3={};_0x1cdbd3[_0x5beaf4[_0x4040('0x7b')]]=_0x3bb8fa[_0x4cc434][_0x4040('0x7c')];_0x208869[_0x4040('0x5c')](_0x1cdbd3);}else{if(!_0x3d324b[_0x4040('0x3d')]['id'])_0x3d324b[_0x4040('0x3d')]['id']=[];_0x3bb8fa[_0x4cc434][_0x4040('0x7c')][_0x4040('0x66')](function(_0xdd5716){_0x3d324b['where']['id'][_0x4040('0x5c')](_0xdd5716);});}}}if(!_['isEmpty'](_0x208869)){_0x3d324b['where']=_[_0x4040('0x3e')](_0x3d324b[_0x4040('0x3d')],{'$and':{'$or':_0x208869}});}_0x3d324b=_[_0x4040('0x3e')]({},_0x3d324b,_0x330a2b[_0x4040('0x40')]);if(_0x224fbb&&!_0x224fbb[_0x4040('0x55')]&&_0x4c6dcb[_0x4040('0x72')]===_0x4040('0x7a')){if(_0x330a2b[_0x4040('0x34')]['includeAll']){_0x3d324b[_0x4040('0x4c')]=[{'all':!![]}];}return db[_0x4c6dcb[_0x4040('0x72')]][_0x4040('0x44')](_0x3d324b)['then'](function(_0x4ee87b){var _0x38d6eb=[];_0x4ee87b['forEach'](function(_0x1009db){var _0x3ea4c;switch(_0x1009db[_0x4040('0x7d')]){case _0x4040('0x7e'):_0x3ea4c=_[_0x4040('0x49')](_0x224fbb[_0x4040('0x7c')],function(_0x37f582){return _0x37f582['id']===_0x1009db[_0x4040('0x7f')]&&_0x37f582['type']===_0x4040('0x80');});break;case _0x4040('0x81'):_0x3ea4c=_[_0x4040('0x49')](_0x224fbb[_0x4040('0x7c')],function(_0x34e64a){return _0x34e64a['id']===_0x1009db[_0x4040('0x7f')]&&_0x34e64a['type']===_0x4040('0x82');});break;}if(_0x3ea4c)_0x38d6eb[_0x4040('0x5c')](_0x1009db);});_0xf0161c[_0x4040('0x41')]=_0x38d6eb[_0x4040('0x39')];_0xf0161c[_0x4040('0x45')]=_0x38d6eb;return _0xf0161c;});}else{return db[_0x4c6dcb[_0x4040('0x72')]][_0x4040('0x41')]({'where':_0x3d324b[_0x4040('0x3d')]})[_0x4040('0x42')](function(_0x4395ac){_0xf0161c[_0x4040('0x41')]=_0x4395ac;if(_0x330a2b[_0x4040('0x34')]['includeAll']){if(_0x4c6dcb[_0x4040('0x72')]===_0x4040('0x83')){_0x3d324b['include']=[{'model':db[_0x4040('0x84')],'as':_0x4040('0x85'),'attributes':['id',_0x4040('0x2b'),_0x4040('0x86')],'required':_0x330a2b[_0x4040('0x34')][_0x4040('0x87')]?!![]:![]},{'model':db[_0x4040('0x84')],'as':_0x4040('0x88'),'attributes':['id','name',_0x4040('0x86')],'through':_0x330a2b[_0x4040('0x34')]['tag']?{'attributes':[],'where':{'TagId':_0x330a2b[_0x4040('0x34')][_0x4040('0x87')]||undefined}}:{},'required':_0x330a2b[_0x4040('0x34')]['tag']?!![]:![]}];}else{_0x3d324b[_0x4040('0x4c')]=[{'all':!![]}];}}return db[_0x4c6dcb['childModel']]['findAll'](_0x3d324b);})[_0x4040('0x42')](function(_0x38c6c3){_0xf0161c[_0x4040('0x45')]=_0x38c6c3;return _0xf0161c;});}}else{return _0xf0161c;}})['then'](respondWithFilteredResult(_0x417646,_0x3d324b))[_0x4040('0x46')](handleError(_0x417646,null));};function getAllResources(_0x5813cb,_0x2ffc7a){return new BPromise(function(_0x28b777,_0x1e2aed){if(_0x2ffc7a){var _0x324afa=_0x2ffc7a[_0x4040('0x3f')]?{[_0x2ffc7a[_0x4040('0x3f')]['field']]:_0x2ffc7a[_0x4040('0x3f')][_0x4040('0x89')]}:undefined;return db[_0x5813cb]['findAll']({'where':_0x324afa,'raw':!![]})[_0x4040('0x42')](function(_0x4b39ae){_0x2ffc7a[_0x4040('0x7c')]=_[_0x4040('0x2d')](_0x4b39ae,'id');_0x28b777(_0x2ffc7a);})[_0x4040('0x46')](function(_0x3c8ba6){_0x1e2aed(_0x3c8ba6);});}else{_0x28b777(null);}});}function getAllFilteredResources(_0x26bcf1,_0x470f0c){return new BPromise(function(_0x3ff472,_0xdd963e){var _0xea58a6=_0x26bcf1[_0x4040('0x3f')]?{[_0x26bcf1[_0x4040('0x3f')][_0x4040('0x79')]]:_0x26bcf1[_0x4040('0x3f')][_0x4040('0x89')]}:undefined;return db[_0x26bcf1[_0x4040('0x32')]][_0x4040('0x44')]({'where':_0xea58a6,'raw':!![]})[_0x4040('0x42')](function(_0x5b747f){_0x470f0c['associatedResources']=_[_0x4040('0x2d')](_0x5b747f,function(_0x3c57d5){return _0x3c57d5['name'];});_0x3ff472(_0x470f0c);})['catch'](function(_0x1c6dfe){_0xdd963e(_0x1c6dfe);});});}function getAllowedResources(_0x5c4819,_0x4d5608,_0x8acd40){return new BPromise(function(_0x1d4a98,_0x4bdfa3){if(_0x4d5608){return db['UserProfileResource'][_0x4040('0x44')]({'where':{'sectionId':_0x4d5608['id']},'raw':!![]})[_0x4040('0x42')](function(_0x4c7ee3){if(_0x5c4819[_0x4040('0x79')]&&_0x5c4819[_0x4040('0x79')]!=='id'){_0x4d5608[_0x4040('0x7c')]=_[_0x4040('0x2d')](_0x4c7ee3,function(_0x4b1d08){return _0x4b1d08[_0x5c4819[_0x4040('0x79')]];});}else{if(_0x8acd40===_0x4040('0x7a')){_0x4d5608['associatedResources']=_['map'](_0x4c7ee3,function(_0x2cccf7){return{'id':_0x2cccf7[_0x4040('0x67')],'type':_0x2cccf7[_0x4040('0x30')]};});}else{_0x4d5608['associatedResources']=_['map'](_0x4c7ee3,function(_0x53523f){return _0x53523f[_0x4040('0x67')];});}}_0x1d4a98(_0x4d5608);})['catch'](function(_0x328f2b){_0x4bdfa3(_0x328f2b);});}else{_0x1d4a98(null);}});}function getQueryModels(_0x4fffef,_0x2b013a){var _0xfc9128=_0x4fffef['toLowerCase']();var _0x42df80={'childModel':undefined,'parentSections':[]};switch(_0xfc9128){case _0x4040('0x8a'):_0x42df80[_0x4040('0x72')]=_0x4040('0x8b');break;case _0x4040('0x8c'):_0x42df80['childModel']=_0x4040('0x8d');break;case _0x4040('0x8e'):_0x42df80[_0x4040('0x72')]=_0x4040('0x8f');_0x42df80[_0x4040('0x73')]=[{'name':_0x4040('0x90'),'field':_0x4040('0x2b'),'foreignKey':_0x4040('0x91')}];break;case _0x4040('0x92'):_0x42df80[_0x4040('0x72')]=_0x4040('0x93');break;case _0x4040('0x94'):_0x42df80[_0x4040('0x72')]=_0x4040('0x83');_0x42df80[_0x4040('0x73')]=[{'name':'Lists','field':'id','foreignKey':_0x4040('0x95')}];break;case'lists':_0x42df80[_0x4040('0x72')]=_0x4040('0x96');break;case _0x4040('0x97'):_0x42df80[_0x4040('0x72')]=_0x4040('0x98');break;case _0x4040('0x99'):_0x42df80['childModel']='CmCustomField';break;case _0x4040('0x9a'):_0x42df80[_0x4040('0x72')]=_0x4040('0x9b');break;case _0x4040('0x9c'):_0x42df80[_0x4040('0x72')]='ChatWebsite';break;case _0x4040('0x9d'):_0x42df80[_0x4040('0x72')]='FaxQueue';break;case'faxaccounts':_0x42df80[_0x4040('0x72')]='FaxAccount';break;case _0x4040('0x9e'):case _0x4040('0x9f'):case _0x4040('0xa0'):_0x42df80[_0x4040('0x72')]='VoiceExtension';break;case'contexts':_0x42df80['childModel']=_0x4040('0xa1');break;case _0x4040('0xa2'):_0x42df80['childModel']=_0x4040('0xa3');break;case'voicerecordings':_0x42df80[_0x4040('0x72')]=_0x4040('0xa4');_0x42df80[_0x4040('0x73')]=[{'name':_0x4040('0xa5'),'field':_0x4040('0x2b'),'foreignKey':_0x4040('0xa6'),'model':_0x4040('0xa7'),'filter':{'field':_0x4040('0xa8'),'value':[_0x4040('0xa9')]}},{'name':'Telephones','field':_0x4040('0x2b'),'foreignKey':_0x4040('0xa6'),'model':'User','filter':{'field':_0x4040('0xa8'),'value':['telephone']}},{'name':_0x4040('0xaa'),'field':_0x4040('0x2b'),'foreignKey':_0x4040('0xab'),'model':_0x4040('0xac'),'filter':{'field':_0x4040('0x30'),'value':['inbound']}},{'name':_0x4040('0xad'),'field':'name','foreignKey':_0x4040('0xab'),'model':_0x4040('0xac'),'filter':{'field':_0x4040('0x30'),'value':[_0x4040('0xae')]}}];break;case _0x4040('0xaf'):_0x42df80[_0x4040('0x72')]=_0x4040('0xb0');break;case _0x4040('0xb1'):_0x42df80[_0x4040('0x72')]=_0x4040('0xb2');break;case'voiceprefixes':_0x42df80[_0x4040('0x72')]=_0x4040('0xb3');break;case _0x4040('0xb4'):_0x42df80['childModel']=_0x4040('0xb5');break;case _0x4040('0xb6'):_0x42df80[_0x4040('0x72')]=_0x4040('0xb7');break;case _0x4040('0xb8'):_0x42df80[_0x4040('0x72')]=_0x4040('0xb9');break;case _0x4040('0xba'):_0x42df80['childModel']=_0x4040('0xbb');break;case _0x4040('0xbc'):_0x42df80[_0x4040('0x72')]=_0x4040('0xbd');break;case'openchannelaccounts':_0x42df80[_0x4040('0x72')]='OpenchannelAccount';break;case'smsqueues':_0x42df80[_0x4040('0x72')]=_0x4040('0xbe');break;case _0x4040('0xbf'):_0x42df80[_0x4040('0x72')]=_0x4040('0xc0');break;case _0x4040('0xc1'):_0x42df80[_0x4040('0x72')]=_0x4040('0xc2');break;case _0x4040('0xc3'):_0x42df80[_0x4040('0x72')]=_0x4040('0xc4');break;case _0x4040('0xc5'):_0x42df80[_0x4040('0x72')]='Team';break;case'voicequeues':case _0x4040('0xc6'):_0x42df80[_0x4040('0x72')]=_0x4040('0xac');if(_0x2b013a){_0x42df80[_0x4040('0x73')]=[{'name':_0x4040('0xaa')},{'name':_0x4040('0xad')}];}break;case _0x4040('0xc7'):case _0x4040('0xc8'):case _0x4040('0xc9'):_0x42df80[_0x4040('0x72')]=_0x4040('0xa7');if(_0x2b013a){_0x42df80[_0x4040('0x73')]=[{'name':_0x4040('0xca'),'filter':{'field':_0x4040('0xa8'),'value':[_0x4040('0xcb'),_0x4040('0xcc')]},'ignore':!![]},{'name':'Agents'},{'name':_0x4040('0xcd')}];}break;case _0x4040('0xce'):_0x42df80[_0x4040('0x72')]=_0x4040('0xcf');break;case _0x4040('0xd0'):_0x42df80[_0x4040('0x72')]='SalesforceAccount';break;case _0x4040('0xd1'):_0x42df80[_0x4040('0x72')]='FreshdeskAccount';break;case _0x4040('0xd2'):_0x42df80[_0x4040('0x72')]=_0x4040('0xd3');break;case _0x4040('0xd4'):_0x42df80[_0x4040('0x72')]=_0x4040('0xd5');break;case'zohoaccounts':_0x42df80[_0x4040('0x72')]=_0x4040('0xd6');break;case _0x4040('0xd7'):_0x42df80['childModel']='User';break;case _0x4040('0xd8'):_0x42df80[_0x4040('0x72')]=_0x4040('0xd9');break;case _0x4040('0xda'):_0x42df80['childModel']=_0x4040('0xdb');break;case'customdashboards':_0x42df80[_0x4040('0x72')]=_0x4040('0x65');break;case _0x4040('0xdc'):_0x42df80['childModel']='Interval';break;case _0x4040('0xdd'):_0x42df80['childModel']=_0x4040('0xde');break;case'scheduler':_0x42df80['childModel']='Schedule';break;case _0x4040('0xdf'):_0x42df80['childModel']=_0x4040('0xe0');break;case'tags':_0x42df80[_0x4040('0x72')]=_0x4040('0x84');break;case _0x4040('0xe1'):_0x42df80['childModel']=_0x4040('0xe2');break;case'triggers':_0x42df80[_0x4040('0x72')]=_0x4040('0xe3');break;case _0x4040('0xe4'):_0x42df80[_0x4040('0x72')]=_0x4040('0xe5');break;case _0x4040('0xe6'):_0x42df80[_0x4040('0x72')]=_0x4040('0xe7');break;case _0x4040('0xe8'):_0x42df80['childModel']='Plugin';break;case'extractedreports':_0x42df80[_0x4040('0x72')]=_0x4040('0x7a');_0x42df80[_0x4040('0x73')]=[{'name':_0x4040('0xe9'),'field':'id','foreignKey':_0x4040('0x7f')}];break;case'metrics':_0x42df80[_0x4040('0x72')]=_0x4040('0xea');break;case _0x4040('0xc3'):_0x42df80[_0x4040('0x72')]=_0x4040('0xc4');break;default:return _0x42df80;}return _0x42df80;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 6a87355..9ae8ead 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 _0x98ad=['UserProfile','setMaxListeners','update','emit','exports','events','../../mysqldb'];(function(_0x3be6ad,_0x3cd79b){var _0x3c2e8b=function(_0xbfbb7f){while(--_0xbfbb7f){_0x3be6ad['push'](_0x3be6ad['shift']());}};_0x3c2e8b(++_0x3cd79b);}(_0x98ad,0x91));var _0xd98a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x98ad[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xd98a('0x0'));var UserProfile=require(_0xd98a('0x1'))['db'][_0xd98a('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd98a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd98a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2700bb){return function(_0x383dcd,_0x5ac774,_0x418433){UserProfileEvents[_0xd98a('0x5')](_0x2700bb+':'+_0x383dcd['id'],_0x383dcd);UserProfileEvents['emit'](_0x2700bb,_0x383dcd);_0x418433(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xd98a('0x6')]=UserProfileEvents; \ No newline at end of file +var _0x61bc=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x5b710b,_0x103f64){var _0x40ccbe=function(_0x1b46d6){while(--_0x1b46d6){_0x5b710b['push'](_0x5b710b['shift']());}};_0x40ccbe(++_0x103f64);}(_0x61bc,0x6a));var _0xc61b=function(_0x4eef64,_0x37c7a0){_0x4eef64=_0x4eef64-0x0;var _0x4c3c2f=_0x61bc[_0x4eef64];return _0x4c3c2f;};'use strict';var EventEmitter=require(_0xc61b('0x0'));var UserProfile=require(_0xc61b('0x1'))['db'][_0xc61b('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc61b('0x3')](0x0);var events={'afterCreate':_0xc61b('0x4'),'afterUpdate':_0xc61b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x584c84){return function(_0x396301,_0x4f33e3,_0x1dbc7c){UserProfileEvents['emit'](_0x584c84+':'+_0x396301['id'],_0x396301);UserProfileEvents[_0xc61b('0x6')](_0x584c84,_0x396301);_0x1dbc7c(null);};}for(var e in events){if(events[_0xc61b('0x7')](e)){var event=events[e];UserProfile[_0xc61b('0x8')](e,emitEvent(event));}}module[_0xc61b('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2a7d79d..2c9ed3d 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 _0x2ef3=['bluebird','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','lodash','util','api','moment'];(function(_0x3b8363,_0x17bc8){var _0x4d8289=function(_0x520c1d){while(--_0x520c1d){_0x3b8363['push'](_0x3b8363['shift']());}};_0x4d8289(++_0x17bc8);}(_0x2ef3,0x1b4));var _0x32ef=function(_0x1553b5,_0x57be16){_0x1553b5=_0x1553b5-0x0;var _0x3e5353=_0x2ef3[_0x1553b5];return _0x3e5353;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require('../../config/logger')(_0x32ef('0x2'));var moment=require(_0x32ef('0x3'));var BPromise=require(_0x32ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x5'));var rimraf=require(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x5c3493,_0x5884d6){return _0x5c3493[_0x32ef('0xa')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f34=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','../../config/logger','api','moment'];(function(_0x31d101,_0x596664){var _0x40d519=function(_0x44df0b){while(--_0x44df0b){_0x31d101['push'](_0x31d101['shift']());}};_0x40d519(++_0x596664);}(_0x3f34,0x114));var _0x43f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f34[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x43f3('0x0'));var util=require('util');var logger=require(_0x43f3('0x1'))(_0x43f3('0x2'));var moment=require(_0x43f3('0x3'));var BPromise=require(_0x43f3('0x4'));var rp=require(_0x43f3('0x5'));var fs=require('fs');var path=require(_0x43f3('0x6'));var rimraf=require(_0x43f3('0x7'));var config=require(_0x43f3('0x8'));var attributes=require(_0x43f3('0x9'));module[_0x43f3('0xa')]=function(_0x4f879c,_0x4a1d1f){return _0x4f879c[_0x43f3('0xb')](_0x43f3('0xc'),attributes,{'tableName':_0x43f3('0xd'),'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 900d59d..c767947 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 _0xd8fb=['http','defaults','localhost','socket.io-emitter','register','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5728e1,_0x55b3f0){var _0x114519=function(_0x466bb6){while(--_0x466bb6){_0x5728e1['push'](_0x5728e1['shift']());}};_0x114519(++_0x55b3f0);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1e3c86,_0x485059){_0x1e3c86=_0x1e3c86-0x0;var _0xfe76da=_0xd8fb[_0x1e3c86];return _0xfe76da;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});config['redis']=_[_0xbd8f('0x9')](config['redis'],{'host':_0xbd8f('0xa'),'port':0x18eb});var socket=require(_0xbd8f('0xb'))(new Redis(config['redis']));require('./userProfile.socket')[_0xbd8f('0xc')](socket);function respondWithRpcPromise(_0x2393a9,_0x2a55b5,_0x53a2c6){return new BPromise(function(_0x255af3,_0x42ae20){return client['request'](_0x2393a9,_0x53a2c6)['then'](function(_0x342bcb){logger[_0xbd8f('0xd')](_0xbd8f('0xe'),_0x2a55b5,'request\x20sent');logger[_0xbd8f('0xf')](_0xbd8f('0x10'),_0x2a55b5,_0xbd8f('0x11'),JSON[_0xbd8f('0x12')](_0x342bcb));if(_0x342bcb[_0xbd8f('0x13')]){if(_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x14')]===0x1f4){logger[_0xbd8f('0x13')](_0xbd8f('0xe'),_0x2a55b5,_0x342bcb['error'][_0xbd8f('0x15')]);return _0x42ae20(_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x15')]);}logger[_0xbd8f('0x13')]('UserProfile,\x20%s,\x20%s',_0x2a55b5,_0x342bcb[_0xbd8f('0x13')][_0xbd8f('0x15')]);return _0x255af3(_0x342bcb['error'][_0xbd8f('0x15')]);}else{logger[_0xbd8f('0xd')]('UserProfile,\x20%s,\x20%s',_0x2a55b5,_0xbd8f('0x11'));_0x255af3(_0x342bcb[_0xbd8f('0x16')]['message']);}})['catch'](function(_0x33f77c){logger['error']('UserProfile,\x20%s,\x20%s',_0x2a55b5,_0x33f77c);_0x42ae20(_0x33f77c);});});} \ No newline at end of file +var _0x2eb2=['../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5d86dd,_0x19f614){var _0x226032=function(_0x659b8c){while(--_0x659b8c){_0x5d86dd['push'](_0x5d86dd['shift']());}};_0x226032(++_0x19f614);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x2eb2[_0x4d07cc];return _0x42de3b;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});config[_0x22eb('0xa')]=_[_0x22eb('0xb')](config[_0x22eb('0xa')],{'host':_0x22eb('0xc'),'port':0x18eb});var socket=require(_0x22eb('0xd'))(new Redis(config[_0x22eb('0xa')]));require(_0x22eb('0xe'))[_0x22eb('0xf')](socket);function respondWithRpcPromise(_0x3008e0,_0x489260,_0x46c197){return new BPromise(function(_0x54342e,_0x4ce9fb){return client[_0x22eb('0x10')](_0x3008e0,_0x46c197)['then'](function(_0x17b668){logger[_0x22eb('0x11')]('UserProfile,\x20%s,\x20%s',_0x489260,'request\x20sent');logger[_0x22eb('0x12')](_0x22eb('0x13'),_0x489260,_0x22eb('0x14'),JSON[_0x22eb('0x15')](_0x17b668));if(_0x17b668[_0x22eb('0x16')]){if(_0x17b668['error'][_0x22eb('0x17')]===0x1f4){logger['error'](_0x22eb('0x18'),_0x489260,_0x17b668['error'][_0x22eb('0x19')]);return _0x4ce9fb(_0x17b668[_0x22eb('0x16')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x489260,_0x17b668[_0x22eb('0x16')]['message']);return _0x54342e(_0x17b668['error'][_0x22eb('0x19')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x489260,_0x22eb('0x14'));_0x54342e(_0x17b668[_0x22eb('0x1a')][_0x22eb('0x19')]);}})[_0x22eb('0x1b')](function(_0x3b0940){logger['error'](_0x22eb('0x18'),_0x489260,_0x3b0940);_0x4ce9fb(_0x3b0940);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index fc684f7..22b0be5 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 _0x8022=['removeListener','register','length','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x38b0a1,_0x29da11){var _0x27d217=function(_0x6cf605){while(--_0x6cf605){_0x38b0a1['push'](_0x38b0a1['shift']());}};_0x27d217(++_0x29da11);}(_0x8022,0xee));var _0x2802=function(_0x5e59a8,_0x425fc0){_0x5e59a8=_0x5e59a8-0x0;var _0x4bf6be=_0x8022[_0x5e59a8];return _0x4bf6be;};'use strict';var UserProfileEvents=require(_0x2802('0x0'));var events=[_0x2802('0x1'),_0x2802('0x2'),_0x2802('0x3')];function createListener(_0x3f6dd4,_0x3931bf){return function(_0x369176){_0x3931bf[_0x2802('0x4')](_0x3f6dd4,_0x369176);};}function removeListener(_0x5d126f,_0x1d38df){return function(){UserProfileEvents[_0x2802('0x5')](_0x5d126f,_0x1d38df);};}exports[_0x2802('0x6')]=function(_0x5a1be2){for(var _0x79e6af=0x0,_0x9cef8c=events[_0x2802('0x7')];_0x79e6af<_0x9cef8c;_0x79e6af++){var _0x5d605e=events[_0x79e6af];var _0x32be12=createListener(_0x2802('0x8')+_0x5d605e,_0x5a1be2);UserProfileEvents['on'](_0x5d605e,_0x32be12);}}; \ No newline at end of file +var _0x98ee=['userProfile:','./userProfile.events','save','update','emit','removeListener','register'];(function(_0x1856af,_0x268a14){var _0x369b69=function(_0x1726c8){while(--_0x1726c8){_0x1856af['push'](_0x1856af['shift']());}};_0x369b69(++_0x268a14);}(_0x98ee,0x12e));var _0xe98e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x98ee[_0x3947c9];return _0x2e7871;};'use strict';var UserProfileEvents=require(_0xe98e('0x0'));var events=[_0xe98e('0x1'),'remove',_0xe98e('0x2')];function createListener(_0x2a47f9,_0x176ffa){return function(_0x4339f3){_0x176ffa[_0xe98e('0x3')](_0x2a47f9,_0x4339f3);};}function removeListener(_0x5b377c,_0x1dd8a5){return function(){UserProfileEvents[_0xe98e('0x4')](_0x5b377c,_0x1dd8a5);};}exports[_0xe98e('0x5')]=function(_0x34f8af){for(var _0x57bd98=0x0,_0x54cb7b=events['length'];_0x57bd98<_0x54cb7b;_0x57bd98++){var _0x34d4a2=events[_0x57bd98];var _0x34081f=createListener(_0xe98e('0x6')+_0x34d4a2,_0x34f8af);UserProfileEvents['on'](_0x34d4a2,_0x34081f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 37e10fb..e4350b4 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 _0xa2bf=['./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xa2bf,0xa8));var _0xfa2b=function(_0x4a190d,_0x5b7cf7){_0x4a190d=_0x4a190d-0x0;var _0x3f2262=_0xa2bf[_0x4a190d];return _0x3f2262;};'use strict';var multer=require(_0xfa2b('0x0'));var util=require(_0xfa2b('0x1'));var path=require(_0xfa2b('0x2'));var timeout=require(_0xfa2b('0x3'));var express=require('express');var router=express[_0xfa2b('0x4')]();var auth=require(_0xfa2b('0x5'));var interaction=require(_0xfa2b('0x6'));var config=require(_0xfa2b('0x7'));var controller=require(_0xfa2b('0x8'));router[_0xfa2b('0x9')]('/',auth[_0xfa2b('0xa')](),controller[_0xfa2b('0xb')]);router[_0xfa2b('0x9')](_0xfa2b('0xc'),auth[_0xfa2b('0xa')](),controller[_0xfa2b('0xd')]);router[_0xfa2b('0x9')](_0xfa2b('0xe'),auth['isAuthenticated'](),controller[_0xfa2b('0xf')]);router[_0xfa2b('0x10')]('/',auth['isAuthenticated'](),controller[_0xfa2b('0x11')]);router[_0xfa2b('0x12')](_0xfa2b('0xe'),auth[_0xfa2b('0xa')](),controller[_0xfa2b('0x13')]);router[_0xfa2b('0x14')](_0xfa2b('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xfa2b('0x15')]=router; \ No newline at end of file +var _0x4134=['get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','util','path','../../components/interaction/service','./userProfileResource.controller'];(function(_0x352d08,_0x308842){var _0x209dd6=function(_0x21d13a){while(--_0x21d13a){_0x352d08['push'](_0x352d08['shift']());}};_0x209dd6(++_0x308842);}(_0x4134,0x17c));var _0x4413=function(_0x16c894,_0x50a4fa){_0x16c894=_0x16c894-0x0;var _0x4ceaef=_0x4134[_0x16c894];return _0x4ceaef;};'use strict';var multer=require('multer');var util=require(_0x4413('0x0'));var path=require(_0x4413('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4413('0x2'));var config=require('../../config/environment');var controller=require(_0x4413('0x3'));router[_0x4413('0x4')]('/',auth['isAuthenticated'](),controller[_0x4413('0x5')]);router[_0x4413('0x4')](_0x4413('0x6'),auth[_0x4413('0x7')](),controller[_0x4413('0x8')]);router[_0x4413('0x4')](_0x4413('0x9'),auth[_0x4413('0x7')](),controller['show']);router[_0x4413('0xa')]('/',auth[_0x4413('0x7')](),controller[_0x4413('0xb')]);router[_0x4413('0xc')]('/:id',auth[_0x4413('0x7')](),controller[_0x4413('0xd')]);router[_0x4413('0xe')]('/:id',auth[_0x4413('0x7')](),controller[_0x4413('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index de63a5f..88aa5eb 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 _0xb011=['INTEGER','sequelize','exports','STRING'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0xb011,0x119));var _0x1b01=function(_0x301ce0,_0x3968cd){_0x301ce0=_0x301ce0-0x0;var _0x2ec89d=_0xb011[_0x301ce0];return _0x2ec89d;};'use strict';var Sequelize=require(_0x1b01('0x0'));module[_0x1b01('0x1')]={'name':{'type':Sequelize[_0x1b01('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1b01('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1b01('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4bf2=['exports','STRING','INTEGER','sequelize'];(function(_0x45a61d,_0x497b81){var _0x391ed3=function(_0x34ce3d){while(--_0x34ce3d){_0x45a61d['push'](_0x45a61d['shift']());}};_0x391ed3(++_0x497b81);}(_0x4bf2,0x127));var _0x24bf=function(_0x16818d,_0x444d74){_0x16818d=_0x16818d-0x0;var _0x433b14=_0x4bf2[_0x16818d];return _0x433b14;};'use strict';var Sequelize=require(_0x24bf('0x0'));module[_0x24bf('0x1')]={'name':{'type':Sequelize[_0x24bf('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x24bf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x24bf('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 75b0f3d..38967b3 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 _0x425d=['includeAll','find','catch','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','show','params'];(function(_0x54b2fc,_0x43ca61){var _0x48443f=function(_0x484923){while(--_0x484923){_0x54b2fc['push'](_0x54b2fc['shift']());}};_0x48443f(++_0x43ca61);}(_0x425d,0x1e0));var _0xd425=function(_0x25cc6d,_0x3359d5){_0x25cc6d=_0x25cc6d-0x0;var _0x5188dd=_0x425d[_0x25cc6d];return _0x5188dd;};'use strict';var pdf=require(_0xd425('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd425('0x1'));var zipdir=require(_0xd425('0x2'));var jsonpatch=require(_0xd425('0x3'));var rp=require(_0xd425('0x4'));var moment=require(_0xd425('0x5'));var BPromise=require(_0xd425('0x6'));var Mustache=require(_0xd425('0x7'));var util=require('util');var path=require(_0xd425('0x8'));var sox=require(_0xd425('0x9'));var csv=require(_0xd425('0xa'));var ejs=require(_0xd425('0xb'));var fs=require('fs');var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0xa'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=_0x1fc822[_0xd425('0x21')],_0x278626=_0x41f34d['offset'],_0x471267=_0x41f34d[_0xd425('0x22')]+_0x41f34d[_0xd425('0x23')],_0x7e267e;if(_0x471267>=_0x538a0a){_0x471267=_0x538a0a;_0x7e267e=0xc8;}else{_0x7e267e=0xce;}_0x643fd2[_0xd425('0x1f')](_0x7e267e);return _0x643fd2[_0xd425('0x24')]('Content-Range',_0x278626+'-'+_0x471267+'/'+_0x538a0a)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x5debc3){return function(_0x4b293a){try{jsonpatch[_0xd425('0x25')](_0x4b293a,_0x5debc3,!![]);}catch(_0xb92870){return BPromise[_0xd425('0x26')](_0xb92870);}return _0x4b293a['save']();};}function saveUpdates(_0x355af0,_0x7e982e){return function(_0x5f1e7e){if(_0x5f1e7e){return _0x5f1e7e[_0xd425('0x27')](_0x355af0)[_0xd425('0x28')](function(_0x249a2b){return _0x249a2b;});}return null;};}function removeEntity(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')]()[_0xd425('0x28')](function(){_0x1d3fc0[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x151ad9,_0x40e84b){return function(_0x47f44a){if(!_0x47f44a){_0x151ad9[_0xd425('0x1d')](0x194);}return _0x47f44a;};}function handleError(_0x264b0e,_0x398985){_0x398985=_0x398985||0x1f4;return function(_0x1908a5){logger[_0xd425('0x2a')](_0x1908a5[_0xd425('0x2b')]);if(_0x1908a5[_0xd425('0x2c')]){delete _0x1908a5['name'];}_0x264b0e[_0xd425('0x1f')](_0x398985)[_0xd425('0x2d')](_0x1908a5);};}exports[_0xd425('0x2e')]=function(_0x57c950,_0x27ef8a){var _0x3ad9bd={},_0x433189={},_0x999fb9={'count':0x0,'rows':[]};var _0x27d29a=_[_0xd425('0x2f')](db[_0xd425('0x30')][_0xd425('0x31')],function(_0x24da23){return{'name':_0x24da23[_0xd425('0x32')],'type':_0x24da23['type'][_0xd425('0x33')]};});_0x433189[_0xd425('0x34')]=_[_0xd425('0x2f')](_0x27d29a,_0xd425('0x2c'));_0x433189[_0xd425('0x35')]=_[_0xd425('0x36')](_0x57c950[_0xd425('0x35')]);_0x433189[_0xd425('0x37')]=_[_0xd425('0x38')](_0x433189[_0xd425('0x34')],_0x433189[_0xd425('0x35')]);_0x3ad9bd['attributes']=_[_0xd425('0x38')](_0x433189[_0xd425('0x34')],qs[_0xd425('0x39')](_0x57c950[_0xd425('0x35')][_0xd425('0x39')]));_0x3ad9bd['attributes']=_0x3ad9bd[_0xd425('0x3a')][_0xd425('0x3b')]?_0x3ad9bd['attributes']:_0x433189['model'];if(!_0x57c950['query'][_0xd425('0x3c')](_0xd425('0x3d'))){_0x3ad9bd[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x57c950['query'][_0xd425('0x23')]);_0x3ad9bd[_0xd425('0x22')]=qs[_0xd425('0x22')](_0x57c950[_0xd425('0x35')][_0xd425('0x22')]);}_0x3ad9bd[_0xd425('0x3e')]=qs[_0xd425('0x3f')](_0x57c950['query'][_0xd425('0x3f')]);_0x3ad9bd['where']=qs[_0xd425('0x37')](_[_0xd425('0x40')](_0x57c950[_0xd425('0x35')],_0x433189['filters']),_0x27d29a);if(_0x57c950[_0xd425('0x35')][_0xd425('0x41')]){_0x3ad9bd[_0xd425('0x42')]=_[_0xd425('0x43')](_0x3ad9bd['where'],{'$or':_[_0xd425('0x2f')](_0x27d29a,function(_0x3cf540){if(_0x3cf540['type']!=='VIRTUAL'){var _0x48fc85={};_0x48fc85[_0x3cf540[_0xd425('0x2c')]]={'$like':'%'+_0x57c950[_0xd425('0x35')][_0xd425('0x41')]+'%'};return _0x48fc85;}})});}_0x3ad9bd=_['merge']({},_0x3ad9bd,_0x57c950['options']);var _0x58ebb1={'where':_0x3ad9bd[_0xd425('0x42')]};return db[_0xd425('0x30')][_0xd425('0x21')](_0x58ebb1)[_0xd425('0x28')](function(_0xa9fd7c){_0x999fb9[_0xd425('0x21')]=_0xa9fd7c;if(_0x57c950[_0xd425('0x35')]['includeAll']){_0x3ad9bd[_0xd425('0x44')]=[{'all':!![]}];}return db[_0xd425('0x30')][_0xd425('0x45')](_0x3ad9bd);})['then'](function(_0x3adc67){_0x999fb9[_0xd425('0x46')]=_0x3adc67;return _0x999fb9;})[_0xd425('0x28')](respondWithFilteredResult(_0x27ef8a,_0x3ad9bd))['catch'](handleError(_0x27ef8a,null));};exports[_0xd425('0x47')]=function(_0x12b970,_0x1c5ba6){var _0x2d7a2f={'raw':![],'where':{'id':_0x12b970[_0xd425('0x48')]['id']}},_0x5afd62={};_0x5afd62[_0xd425('0x34')]=_[_0xd425('0x36')](db[_0xd425('0x30')][_0xd425('0x31')]);_0x5afd62[_0xd425('0x35')]=_[_0xd425('0x36')](_0x12b970['query']);_0x5afd62[_0xd425('0x37')]=_[_0xd425('0x38')](_0x5afd62['model'],_0x5afd62[_0xd425('0x35')]);_0x2d7a2f['attributes']=_['intersection'](_0x5afd62[_0xd425('0x34')],qs['fields'](_0x12b970[_0xd425('0x35')]['fields']));_0x2d7a2f[_0xd425('0x3a')]=_0x2d7a2f[_0xd425('0x3a')][_0xd425('0x3b')]?_0x2d7a2f[_0xd425('0x3a')]:_0x5afd62[_0xd425('0x34')];if(_0x12b970['query'][_0xd425('0x49')]){_0x2d7a2f['include']=[{'all':!![]}];}_0x2d7a2f=_[_0xd425('0x43')]({},_0x2d7a2f,_0x12b970['options']);return db[_0xd425('0x30')][_0xd425('0x4a')](_0x2d7a2f)[_0xd425('0x28')](handleEntityNotFound(_0x1c5ba6,null))[_0xd425('0x28')](respondWithResult(_0x1c5ba6,null))[_0xd425('0x4b')](handleError(_0x1c5ba6,null));};exports['create']=function(_0x231955,_0x433777){return db[_0xd425('0x30')][_0xd425('0x4c')](_0x231955[_0xd425('0x4d')],{})['then'](respondWithResult(_0x433777,0xc9))[_0xd425('0x4b')](handleError(_0x433777,null));};exports[_0xd425('0x27')]=function(_0x1450f2,_0x2a2ab4){if(_0x1450f2[_0xd425('0x4d')]['id']){delete _0x1450f2[_0xd425('0x4d')]['id'];}return db['UserProfileResource'][_0xd425('0x4a')]({'where':{'id':_0x1450f2[_0xd425('0x48')]['id']}})['then'](handleEntityNotFound(_0x2a2ab4,null))[_0xd425('0x28')](saveUpdates(_0x1450f2[_0xd425('0x4d')],null))[_0xd425('0x28')](respondWithResult(_0x2a2ab4,null))[_0xd425('0x4b')](handleError(_0x2a2ab4,null));};exports['destroy']=function(_0x54f1d,_0x2b8882){return db[_0xd425('0x30')][_0xd425('0x4a')]({'where':{'id':_0x54f1d[_0xd425('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b8882,null))['then'](removeEntity(_0x2b8882,null))[_0xd425('0x4b')](handleError(_0x2b8882,null));};exports['describe']=function(_0x3e5728,_0x1072bf){return db['UserProfileResource'][_0xd425('0x4e')]()['then'](respondWithResult(_0x1072bf,null))['catch'](handleError(_0x1072bf,null));}; \ No newline at end of file +var _0xda19=['moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','json','apply','reject','save','update','then','destroy','end','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','UserProfileResource','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xda19,0xd5));var _0x9da1=function(_0xee7018,_0x35df61){_0xee7018=_0xee7018-0x0;var _0x4bc203=_0xda19[_0xee7018];return _0x4bc203;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9da1('0x0'));var rimraf=require(_0x9da1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9da1('0x2'));var rp=require('request-promise');var moment=require(_0x9da1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9da1('0x4'));var util=require(_0x9da1('0x5'));var path=require(_0x9da1('0x6'));var sox=require(_0x9da1('0x7'));var csv=require(_0x9da1('0x8'));var ejs=require(_0x9da1('0x9'));var fs=require('fs');var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];function respondWithStatusCode(_0x596b6b,_0x4735c7){_0x4735c7=_0x4735c7||0xcc;return function(_0x1d93f8){if(_0x1d93f8){return _0x596b6b[_0x9da1('0x17')](_0x4735c7);}return _0x596b6b[_0x9da1('0x18')](_0x4735c7)['end']();};}function respondWithResult(_0x2837e3,_0x535a13){_0x535a13=_0x535a13||0xc8;return function(_0x4d17e1){if(_0x4d17e1){return _0x2837e3[_0x9da1('0x18')](_0x535a13)['json'](_0x4d17e1);}};}function respondWithFilteredResult(_0x433ff4,_0x43c093){return function(_0x37653d){if(_0x37653d){var _0x1a1a6b=_0x37653d[_0x9da1('0x19')],_0x7f1a64=_0x43c093[_0x9da1('0x1a')],_0x514d8e=_0x43c093[_0x9da1('0x1a')]+_0x43c093[_0x9da1('0x1b')],_0x16f75a;if(_0x514d8e>=_0x1a1a6b){_0x514d8e=_0x1a1a6b;_0x16f75a=0xc8;}else{_0x16f75a=0xce;}_0x433ff4[_0x9da1('0x18')](_0x16f75a);return _0x433ff4['set']('Content-Range',_0x7f1a64+'-'+_0x514d8e+'/'+_0x1a1a6b)[_0x9da1('0x1c')](_0x37653d);}return null;};}function patchUpdates(_0x8da712){return function(_0x1b0e7f){try{jsonpatch[_0x9da1('0x1d')](_0x1b0e7f,_0x8da712,!![]);}catch(_0x40a967){return BPromise[_0x9da1('0x1e')](_0x40a967);}return _0x1b0e7f[_0x9da1('0x1f')]();};}function saveUpdates(_0x47e5cf,_0x1a459c){return function(_0x554845){if(_0x554845){return _0x554845[_0x9da1('0x20')](_0x47e5cf)[_0x9da1('0x21')](function(_0x1fc065){return _0x1fc065;});}return null;};}function removeEntity(_0x4e9d7d,_0x5454d3){return function(_0x14793b){if(_0x14793b){return _0x14793b[_0x9da1('0x22')]()[_0x9da1('0x21')](function(){_0x4e9d7d[_0x9da1('0x18')](0xcc)[_0x9da1('0x23')]();});}};}function handleEntityNotFound(_0x165b73,_0x4c60aa){return function(_0x2413fe){if(!_0x2413fe){_0x165b73[_0x9da1('0x17')](0x194);}return _0x2413fe;};}function handleError(_0x4fd25a,_0x45fcce){_0x45fcce=_0x45fcce||0x1f4;return function(_0x3f5680){logger['error'](_0x3f5680[_0x9da1('0x24')]);if(_0x3f5680[_0x9da1('0x25')]){delete _0x3f5680['name'];}_0x4fd25a[_0x9da1('0x18')](_0x45fcce)[_0x9da1('0x26')](_0x3f5680);};}exports['index']=function(_0x5c09ed,_0x67dbc8){var _0x47055e={},_0x5eca5b={},_0x27c6e2={'count':0x0,'rows':[]};var _0x5db5c2=_['map'](db['UserProfileResource'][_0x9da1('0x27')],function(_0x404b86){return{'name':_0x404b86[_0x9da1('0x28')],'type':_0x404b86[_0x9da1('0x29')][_0x9da1('0x2a')]};});_0x5eca5b['model']=_[_0x9da1('0x2b')](_0x5db5c2,'name');_0x5eca5b[_0x9da1('0x2c')]=_[_0x9da1('0x2d')](_0x5c09ed['query']);_0x5eca5b[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x5eca5b['model'],_0x5eca5b[_0x9da1('0x2c')]);_0x47055e[_0x9da1('0x30')]=_[_0x9da1('0x2f')](_0x5eca5b[_0x9da1('0x31')],qs['fields'](_0x5c09ed['query'][_0x9da1('0x32')]));_0x47055e[_0x9da1('0x30')]=_0x47055e[_0x9da1('0x30')][_0x9da1('0x33')]?_0x47055e[_0x9da1('0x30')]:_0x5eca5b['model'];if(!_0x5c09ed[_0x9da1('0x2c')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x47055e[_0x9da1('0x1b')]=qs[_0x9da1('0x1b')](_0x5c09ed[_0x9da1('0x2c')]['limit']);_0x47055e[_0x9da1('0x1a')]=qs['offset'](_0x5c09ed['query'][_0x9da1('0x1a')]);}_0x47055e['order']=qs[_0x9da1('0x36')](_0x5c09ed[_0x9da1('0x2c')][_0x9da1('0x36')]);_0x47055e[_0x9da1('0x37')]=qs[_0x9da1('0x2e')](_[_0x9da1('0x38')](_0x5c09ed[_0x9da1('0x2c')],_0x5eca5b[_0x9da1('0x2e')]),_0x5db5c2);if(_0x5c09ed['query'][_0x9da1('0x39')]){_0x47055e['where']=_[_0x9da1('0x3a')](_0x47055e['where'],{'$or':_['map'](_0x5db5c2,function(_0x1ce0f8){if(_0x1ce0f8['type']!==_0x9da1('0x3b')){var _0x227a1c={};_0x227a1c[_0x1ce0f8['name']]={'$like':'%'+_0x5c09ed[_0x9da1('0x2c')][_0x9da1('0x39')]+'%'};return _0x227a1c;}})});}_0x47055e=_[_0x9da1('0x3a')]({},_0x47055e,_0x5c09ed[_0x9da1('0x3c')]);var _0x56bd49={'where':_0x47055e[_0x9da1('0x37')]};return db['UserProfileResource'][_0x9da1('0x19')](_0x56bd49)['then'](function(_0x26e8d3){_0x27c6e2[_0x9da1('0x19')]=_0x26e8d3;if(_0x5c09ed['query'][_0x9da1('0x3d')]){_0x47055e[_0x9da1('0x3e')]=[{'all':!![]}];}return db[_0x9da1('0x3f')]['findAll'](_0x47055e);})['then'](function(_0x53fc15){_0x27c6e2[_0x9da1('0x40')]=_0x53fc15;return _0x27c6e2;})['then'](respondWithFilteredResult(_0x67dbc8,_0x47055e))[_0x9da1('0x41')](handleError(_0x67dbc8,null));};exports[_0x9da1('0x42')]=function(_0x118be7,_0x43c064){var _0x54f188={'raw':![],'where':{'id':_0x118be7[_0x9da1('0x43')]['id']}},_0x42dbd8={};_0x42dbd8[_0x9da1('0x31')]=_[_0x9da1('0x2d')](db[_0x9da1('0x3f')][_0x9da1('0x27')]);_0x42dbd8[_0x9da1('0x2c')]=_['keys'](_0x118be7[_0x9da1('0x2c')]);_0x42dbd8['filters']=_[_0x9da1('0x2f')](_0x42dbd8['model'],_0x42dbd8[_0x9da1('0x2c')]);_0x54f188[_0x9da1('0x30')]=_['intersection'](_0x42dbd8[_0x9da1('0x31')],qs[_0x9da1('0x32')](_0x118be7['query'][_0x9da1('0x32')]));_0x54f188['attributes']=_0x54f188[_0x9da1('0x30')][_0x9da1('0x33')]?_0x54f188['attributes']:_0x42dbd8['model'];if(_0x118be7[_0x9da1('0x2c')][_0x9da1('0x3d')]){_0x54f188[_0x9da1('0x3e')]=[{'all':!![]}];}_0x54f188=_[_0x9da1('0x3a')]({},_0x54f188,_0x118be7[_0x9da1('0x3c')]);return db[_0x9da1('0x3f')][_0x9da1('0x44')](_0x54f188)[_0x9da1('0x21')](handleEntityNotFound(_0x43c064,null))['then'](respondWithResult(_0x43c064,null))[_0x9da1('0x41')](handleError(_0x43c064,null));};exports[_0x9da1('0x45')]=function(_0x1eebc5,_0x5cf7ef){return db[_0x9da1('0x3f')][_0x9da1('0x45')](_0x1eebc5[_0x9da1('0x46')],{})['then'](respondWithResult(_0x5cf7ef,0xc9))[_0x9da1('0x41')](handleError(_0x5cf7ef,null));};exports[_0x9da1('0x20')]=function(_0x28b1b0,_0x516bdd){if(_0x28b1b0[_0x9da1('0x46')]['id']){delete _0x28b1b0['body']['id'];}return db['UserProfileResource'][_0x9da1('0x44')]({'where':{'id':_0x28b1b0[_0x9da1('0x43')]['id']}})['then'](handleEntityNotFound(_0x516bdd,null))[_0x9da1('0x21')](saveUpdates(_0x28b1b0[_0x9da1('0x46')],null))['then'](respondWithResult(_0x516bdd,null))[_0x9da1('0x41')](handleError(_0x516bdd,null));};exports[_0x9da1('0x22')]=function(_0x1984f7,_0x3a529d){return db[_0x9da1('0x3f')][_0x9da1('0x44')]({'where':{'id':_0x1984f7[_0x9da1('0x43')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x3a529d,null))[_0x9da1('0x21')](removeEntity(_0x3a529d,null))['catch'](handleError(_0x3a529d,null));};exports[_0x9da1('0x47')]=function(_0xe6c667,_0x34a203){return db[_0x9da1('0x3f')]['describe']()['then'](respondWithResult(_0x34a203,null))[_0x9da1('0x41')](handleError(_0x34a203,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index f3dad5c..ed23861 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 _0x3a55=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x3a55,0x1ab));var _0x53a5=function(_0x2ceb94,_0x126d66){_0x2ceb94=_0x2ceb94-0x0;var _0x490899=_0x3a55[_0x2ceb94];return _0x490899;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x53a5('0x0'))('api');var moment=require(_0x53a5('0x1'));var BPromise=require(_0x53a5('0x2'));var rp=require(_0x53a5('0x3'));var fs=require('fs');var path=require(_0x53a5('0x4'));var rimraf=require(_0x53a5('0x5'));var config=require(_0x53a5('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x53a5('0x7')]=function(_0x885a25,_0x36ea82){return _0x885a25[_0x53a5('0x8')](_0x53a5('0x9'),attributes,{'tableName':_0x53a5('0xa'),'paranoid':![],'indexes':[{'name':_0x53a5('0xb'),'fields':[_0x53a5('0xc'),_0x53a5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc28f=['compositeIndex','resourceId','sectionId','lodash','util','api','moment','bluebird','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0x5a4372,_0x280f40){var _0x47c2ea=function(_0x3ebc18){while(--_0x3ebc18){_0x5a4372['push'](_0x5a4372['shift']());}};_0x47c2ea(++_0x280f40);}(_0xc28f,0x1d1));var _0xfc28=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xc28f[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0xfc28('0x0'));var util=require(_0xfc28('0x1'));var logger=require('../../config/logger')(_0xfc28('0x2'));var moment=require(_0xfc28('0x3'));var BPromise=require(_0xfc28('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc28('0x5'));var config=require('../../config/environment');var attributes=require(_0xfc28('0x6'));module[_0xfc28('0x7')]=function(_0x4f5c88,_0x4589d5){return _0x4f5c88[_0xfc28('0x8')](_0xfc28('0x9'),attributes,{'tableName':_0xfc28('0xa'),'paranoid':![],'indexes':[{'name':_0xfc28('0xb'),'fields':[_0xfc28('0xc'),_0xfc28('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index d27f178..6600584 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 _0x46cb=['../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1470ad,_0x2ce16b){var _0x3dcdda=function(_0x103b4f){while(--_0x103b4f){_0x1470ad['push'](_0x1470ad['shift']());}};_0x3dcdda(++_0x2ce16b);}(_0x46cb,0x6c));var _0xb46c=function(_0x363f05,_0x4b6f15){_0x363f05=_0x363f05-0x0;var _0x2f86d3=_0x46cb[_0x363f05];return _0x2f86d3;};'use strict';var _=require(_0xb46c('0x0'));var util=require(_0xb46c('0x1'));var moment=require(_0xb46c('0x2'));var BPromise=require('bluebird');var rs=require(_0xb46c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb46c('0x4'))['db'];var utils=require(_0xb46c('0x5'));var logger=require(_0xb46c('0x6'))('rpc');var config=require(_0xb46c('0x7'));var jayson=require(_0xb46c('0x8'));var client=jayson[_0xb46c('0x9')][_0xb46c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f53f4,_0x5ca341,_0x5cf868){return new BPromise(function(_0x36ae99,_0x25b34d){return client['request'](_0x1f53f4,_0x5cf868)[_0xb46c('0xb')](function(_0x59e729){logger[_0xb46c('0xc')](_0xb46c('0xd'),_0x5ca341,'request\x20sent');logger[_0xb46c('0xe')](_0xb46c('0xf'),_0x5ca341,'request\x20sent',JSON[_0xb46c('0x10')](_0x59e729));if(_0x59e729[_0xb46c('0x11')]){if(_0x59e729[_0xb46c('0x11')][_0xb46c('0x12')]===0x1f4){logger[_0xb46c('0x11')](_0xb46c('0xd'),_0x5ca341,_0x59e729[_0xb46c('0x11')][_0xb46c('0x13')]);return _0x25b34d(_0x59e729['error'][_0xb46c('0x13')]);}logger[_0xb46c('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x5ca341,_0x59e729[_0xb46c('0x11')][_0xb46c('0x13')]);return _0x36ae99(_0x59e729[_0xb46c('0x11')][_0xb46c('0x13')]);}else{logger[_0xb46c('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x5ca341,_0xb46c('0x14'));_0x36ae99(_0x59e729[_0xb46c('0x15')][_0xb46c('0x13')]);}})[_0xb46c('0x16')](function(_0x21bf88){logger[_0xb46c('0x11')](_0xb46c('0xd'),_0x5ca341,_0x21bf88);_0x25b34d(_0x21bf88);});});} \ No newline at end of file +var _0xe48a=['message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s'];(function(_0x46c848,_0x4ec356){var _0xa1f737=function(_0x4fa248){while(--_0x4fa248){_0x46c848['push'](_0x46c848['shift']());}};_0xa1f737(++_0x4ec356);}(_0xe48a,0xad));var _0xae48=function(_0x1b3a09,_0x20c774){_0x1b3a09=_0x1b3a09-0x0;var _0x357bb8=_0xe48a[_0x1b3a09];return _0x357bb8;};'use strict';var _=require(_0xae48('0x0'));var util=require('util');var moment=require(_0xae48('0x1'));var BPromise=require('bluebird');var rs=require(_0xae48('0x2'));var fs=require('fs');var Redis=require(_0xae48('0x3'));var db=require(_0xae48('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xae48('0x5'))(_0xae48('0x6'));var config=require(_0xae48('0x7'));var jayson=require(_0xae48('0x8'));var client=jayson['client'][_0xae48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x382b6d,_0x5c1cd6,_0xda8b60){return new BPromise(function(_0x4503ca,_0x25b85b){return client[_0xae48('0xa')](_0x382b6d,_0xda8b60)['then'](function(_0x279b5d){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x5c1cd6,_0xae48('0xb'));logger['debug'](_0xae48('0xc'),_0x5c1cd6,_0xae48('0xb'),JSON[_0xae48('0xd')](_0x279b5d));if(_0x279b5d['error']){if(_0x279b5d[_0xae48('0xe')][_0xae48('0xf')]===0x1f4){logger[_0xae48('0xe')](_0xae48('0x10'),_0x5c1cd6,_0x279b5d['error'][_0xae48('0x11')]);return _0x25b85b(_0x279b5d[_0xae48('0xe')][_0xae48('0x11')]);}logger['error'](_0xae48('0x10'),_0x5c1cd6,_0x279b5d[_0xae48('0xe')][_0xae48('0x11')]);return _0x4503ca(_0x279b5d[_0xae48('0xe')][_0xae48('0x11')]);}else{logger['info'](_0xae48('0x10'),_0x5c1cd6,'request\x20sent');_0x4503ca(_0x279b5d[_0xae48('0x12')]['message']);}})['catch'](function(_0x10f592){logger[_0xae48('0xe')](_0xae48('0x10'),_0x5c1cd6,_0x10f592);_0x25b85b(_0x10f592);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index decc9be..3d385c3 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 _0xcf33=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','/describe','get','show','post','put','delete','/:id','destroy','multer'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcf33,0x10d));var _0x3cf3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xcf33[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x3cf3('0x0'));var util=require(_0x3cf3('0x1'));var path=require(_0x3cf3('0x2'));var timeout=require(_0x3cf3('0x3'));var express=require('express');var router=express[_0x3cf3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3cf3('0x5'));var config=require(_0x3cf3('0x6'));var controller=require(_0x3cf3('0x7'));router['get']('/',auth[_0x3cf3('0x8')](),controller[_0x3cf3('0x9')]);router['get'](_0x3cf3('0xa'),auth[_0x3cf3('0x8')](),controller['describe']);router[_0x3cf3('0xb')]('/:id',auth[_0x3cf3('0x8')](),controller[_0x3cf3('0xc')]);router[_0x3cf3('0xd')]('/',auth[_0x3cf3('0x8')](),controller['create']);router[_0x3cf3('0xe')]('/:id',auth[_0x3cf3('0x8')](),controller['update']);router[_0x3cf3('0xf')](_0x3cf3('0x10'),auth[_0x3cf3('0x8')](),controller[_0x3cf3('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6b9e=['update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x332086,_0x5b34f2){var _0xbf53c0=function(_0xc2827d){while(--_0xc2827d){_0x332086['push'](_0x332086['shift']());}};_0xbf53c0(++_0x5b34f2);}(_0x6b9e,0x16b));var _0xe6b9=function(_0x59a63d,_0x9d3e96){_0x59a63d=_0x59a63d-0x0;var _0x52108e=_0x6b9e[_0x59a63d];return _0x52108e;};'use strict';var multer=require('multer');var util=require(_0xe6b9('0x0'));var path=require(_0xe6b9('0x1'));var timeout=require(_0xe6b9('0x2'));var express=require('express');var router=express[_0xe6b9('0x3')]();var auth=require(_0xe6b9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe6b9('0x5'));var controller=require(_0xe6b9('0x6'));router['get']('/',auth[_0xe6b9('0x7')](),controller[_0xe6b9('0x8')]);router[_0xe6b9('0x9')](_0xe6b9('0xa'),auth['isAuthenticated'](),controller[_0xe6b9('0xb')]);router[_0xe6b9('0x9')](_0xe6b9('0xc'),auth[_0xe6b9('0x7')](),controller[_0xe6b9('0xd')]);router[_0xe6b9('0xe')]('/',auth[_0xe6b9('0x7')](),controller[_0xe6b9('0xf')]);router[_0xe6b9('0x10')](_0xe6b9('0xc'),auth['isAuthenticated'](),controller[_0xe6b9('0x11')]);router[_0xe6b9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe6b9('0x13')]);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 8040638..f7db2ea 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 _0xfaba=['sequelize','exports','STRING','BOOLEAN','crudPermissions','getDataValue'];(function(_0x2de4b8,_0x43cc7e){var _0x2af84e=function(_0x4fff60){while(--_0x4fff60){_0x2de4b8['push'](_0x2de4b8['shift']());}};_0x2af84e(++_0x43cc7e);}(_0xfaba,0xa2));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xafab('0x0'));module[_0xafab('0x1')]={'name':{'type':Sequelize[_0xafab('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xafab('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xafab('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x464830){this['setDataValue'](_0xafab('0x4'),_0x464830?_0x464830['join'](''):[]);},'get':function(){return this[_0xafab('0x5')]('crudPermissions')?this[_0xafab('0x5')](_0xafab('0x4'))['split'](''):[];}}}; \ No newline at end of file +var _0xe489=['INTEGER','BOOLEAN','crudPermissions','getDataValue','sequelize','exports','STRING'];(function(_0x27cdd5,_0x300f2d){var _0x5ff701=function(_0x328587){while(--_0x328587){_0x27cdd5['push'](_0x27cdd5['shift']());}};_0x5ff701(++_0x300f2d);}(_0xe489,0x9e));var _0x9e48=function(_0x10de08,_0x22e459){_0x10de08=_0x10de08-0x0;var _0x1ee56b=_0xe489[_0x10de08];return _0x1ee56b;};'use strict';var Sequelize=require(_0x9e48('0x0'));module[_0x9e48('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x9e48('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x9e48('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x9e48('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x9e48('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x9e48('0x2')],'set':function(_0x5f372b){this['setDataValue'](_0x9e48('0x5'),_0x5f372b?_0x5f372b['join'](''):[]);},'get':function(){return this[_0x9e48('0x6')](_0x9e48('0x5'))?this[_0x9e48('0x6')](_0x9e48('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index d8fd23d..086cb3c 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 _0x112a=['model','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','keys','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','to-csv','ejs','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','status','end','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','query','intersection','attributes','fields','length'];(function(_0x6d2e72,_0x914cb3){var _0x554c49=function(_0x1e64dc){while(--_0x1e64dc){_0x6d2e72['push'](_0x6d2e72['shift']());}};_0x554c49(++_0x914cb3);}(_0x112a,0x1c4));var _0xa112=function(_0x4cc1f8,_0x1eca3d){_0x4cc1f8=_0x4cc1f8-0x0;var _0xe0f1a7=_0x112a[_0x4cc1f8];return _0xe0f1a7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa112('0x0'));var rimraf=require(_0xa112('0x1'));var zipdir=require(_0xa112('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa112('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa112('0x4'));var util=require('util');var path=require(_0xa112('0x5'));var sox=require('sox');var csv=require(_0xa112('0x6'));var ejs=require(_0xa112('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa112('0x8'));var jsforce=require(_0xa112('0x9'));var deskjs=require(_0xa112('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa112('0xb'));var Papa=require(_0xa112('0xc'));var Redis=require(_0xa112('0xd'));var authService=require(_0xa112('0xe'));var qs=require(_0xa112('0xf'));var as=require(_0xa112('0x10'));var hardwareService=require(_0xa112('0x11'));var logger=require(_0xa112('0x12'))(_0xa112('0x13'));var utils=require(_0xa112('0x14'));var config=require(_0xa112('0x15'));var licenseUtil=require(_0xa112('0x16'));var db=require(_0xa112('0x17'))['db'];function respondWithStatusCode(_0x43c18b,_0x4318ba){_0x4318ba=_0x4318ba||0xcc;return function(_0xce945a){if(_0xce945a){return _0x43c18b['sendStatus'](_0x4318ba);}return _0x43c18b[_0xa112('0x18')](_0x4318ba)[_0xa112('0x19')]();};}function respondWithResult(_0x2a591e,_0x515715){_0x515715=_0x515715||0xc8;return function(_0x3cd533){if(_0x3cd533){return _0x2a591e[_0xa112('0x18')](_0x515715)['json'](_0x3cd533);}};}function respondWithFilteredResult(_0x2e58d7,_0xdef25d){return function(_0xcb4cdc){if(_0xcb4cdc){var _0x2f0185=_0xcb4cdc['count'],_0x41a359=_0xdef25d[_0xa112('0x1a')],_0x80af46=_0xdef25d['offset']+_0xdef25d[_0xa112('0x1b')],_0x42afe3;if(_0x80af46>=_0x2f0185){_0x80af46=_0x2f0185;_0x42afe3=0xc8;}else{_0x42afe3=0xce;}_0x2e58d7[_0xa112('0x18')](_0x42afe3);return _0x2e58d7[_0xa112('0x1c')](_0xa112('0x1d'),_0x41a359+'-'+_0x80af46+'/'+_0x2f0185)['json'](_0xcb4cdc);}return null;};}function patchUpdates(_0x1a01e8){return function(_0x2e18b2){try{jsonpatch[_0xa112('0x1e')](_0x2e18b2,_0x1a01e8,!![]);}catch(_0x5b0c7b){return BPromise['reject'](_0x5b0c7b);}return _0x2e18b2[_0xa112('0x1f')]();};}function saveUpdates(_0x5819a6,_0x5850f5){return function(_0x2f5b5e){if(_0x2f5b5e){return _0x2f5b5e[_0xa112('0x20')](_0x5819a6)[_0xa112('0x21')](function(_0x57eba5){return _0x57eba5;});}return null;};}function removeEntity(_0x26608f,_0x3d10ed){return function(_0x40f137){if(_0x40f137){return _0x40f137[_0xa112('0x22')]()[_0xa112('0x21')](function(){_0x26608f[_0xa112('0x18')](0xcc)[_0xa112('0x19')]();});}};}function handleEntityNotFound(_0x4efd92,_0x34ccbf){return function(_0x1f05fb){if(!_0x1f05fb){_0x4efd92[_0xa112('0x23')](0x194);}return _0x1f05fb;};}function handleError(_0x58a3f4,_0x1c0b9b){_0x1c0b9b=_0x1c0b9b||0x1f4;return function(_0x570070){logger[_0xa112('0x24')](_0x570070[_0xa112('0x25')]);if(_0x570070[_0xa112('0x26')]){delete _0x570070[_0xa112('0x26')];}_0x58a3f4[_0xa112('0x18')](_0x1c0b9b)[_0xa112('0x27')](_0x570070);};}exports[_0xa112('0x28')]=function(_0x1699c1,_0x2fddd9){var _0x13a215={},_0x384a82={},_0x9e7a88={'count':0x0,'rows':[]};var _0x342edb=_[_0xa112('0x29')](db[_0xa112('0x2a')][_0xa112('0x2b')],function(_0x394abd){return{'name':_0x394abd[_0xa112('0x2c')],'type':_0x394abd[_0xa112('0x2d')][_0xa112('0x2e')]};});_0x384a82['model']=_[_0xa112('0x29')](_0x342edb,_0xa112('0x26'));_0x384a82[_0xa112('0x2f')]=_['keys'](_0x1699c1[_0xa112('0x2f')]);_0x384a82['filters']=_[_0xa112('0x30')](_0x384a82['model'],_0x384a82[_0xa112('0x2f')]);_0x13a215[_0xa112('0x31')]=_[_0xa112('0x30')](_0x384a82['model'],qs['fields'](_0x1699c1[_0xa112('0x2f')][_0xa112('0x32')]));_0x13a215[_0xa112('0x31')]=_0x13a215[_0xa112('0x31')][_0xa112('0x33')]?_0x13a215['attributes']:_0x384a82[_0xa112('0x34')];if(!_0x1699c1['query']['hasOwnProperty'](_0xa112('0x35'))){_0x13a215[_0xa112('0x1b')]=qs[_0xa112('0x1b')](_0x1699c1[_0xa112('0x2f')][_0xa112('0x1b')]);_0x13a215[_0xa112('0x1a')]=qs[_0xa112('0x1a')](_0x1699c1[_0xa112('0x2f')][_0xa112('0x1a')]);}_0x13a215[_0xa112('0x36')]=qs[_0xa112('0x37')](_0x1699c1['query'][_0xa112('0x37')]);_0x13a215[_0xa112('0x38')]=qs[_0xa112('0x39')](_[_0xa112('0x3a')](_0x1699c1[_0xa112('0x2f')],_0x384a82['filters']),_0x342edb);if(_0x1699c1['query'][_0xa112('0x3b')]){_0x13a215[_0xa112('0x38')]=_['merge'](_0x13a215[_0xa112('0x38')],{'$or':_[_0xa112('0x29')](_0x342edb,function(_0x123c18){if(_0x123c18[_0xa112('0x2d')]!=='VIRTUAL'){var _0x5066ed={};_0x5066ed[_0x123c18[_0xa112('0x26')]]={'$like':'%'+_0x1699c1[_0xa112('0x2f')][_0xa112('0x3b')]+'%'};return _0x5066ed;}})});}_0x13a215=_[_0xa112('0x3c')]({},_0x13a215,_0x1699c1[_0xa112('0x3d')]);var _0x3e0ef9={'where':_0x13a215['where']};return db[_0xa112('0x2a')]['count'](_0x3e0ef9)[_0xa112('0x21')](function(_0x43fdff){_0x9e7a88['count']=_0x43fdff;if(_0x1699c1['query'][_0xa112('0x3e')]){_0x13a215[_0xa112('0x3f')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x13a215);})[_0xa112('0x21')](function(_0x49d3f7){_0x9e7a88[_0xa112('0x40')]=_0x49d3f7;return _0x9e7a88;})[_0xa112('0x21')](respondWithFilteredResult(_0x2fddd9,_0x13a215))[_0xa112('0x41')](handleError(_0x2fddd9,null));};exports['show']=function(_0x13f70f,_0x5ecbaa){var _0x9dd5b6={'raw':![],'where':{'id':_0x13f70f['params']['id']}},_0x12073f={};_0x12073f['model']=_[_0xa112('0x42')](db[_0xa112('0x2a')][_0xa112('0x2b')]);_0x12073f['query']=_['keys'](_0x13f70f[_0xa112('0x2f')]);_0x12073f[_0xa112('0x39')]=_[_0xa112('0x30')](_0x12073f[_0xa112('0x34')],_0x12073f[_0xa112('0x2f')]);_0x9dd5b6[_0xa112('0x31')]=_['intersection'](_0x12073f[_0xa112('0x34')],qs['fields'](_0x13f70f[_0xa112('0x2f')][_0xa112('0x32')]));_0x9dd5b6[_0xa112('0x31')]=_0x9dd5b6[_0xa112('0x31')]['length']?_0x9dd5b6[_0xa112('0x31')]:_0x12073f['model'];if(_0x13f70f[_0xa112('0x2f')][_0xa112('0x3e')]){_0x9dd5b6[_0xa112('0x3f')]=[{'all':!![]}];}_0x9dd5b6=_[_0xa112('0x3c')]({},_0x9dd5b6,_0x13f70f[_0xa112('0x3d')]);return db[_0xa112('0x2a')]['find'](_0x9dd5b6)[_0xa112('0x21')](handleEntityNotFound(_0x5ecbaa,null))[_0xa112('0x21')](respondWithResult(_0x5ecbaa,null))['catch'](handleError(_0x5ecbaa,null));};exports[_0xa112('0x43')]=function(_0x2b8d05,_0x25651c){return db['UserProfileSection']['create'](_0x2b8d05[_0xa112('0x44')],{})[_0xa112('0x21')](respondWithResult(_0x25651c,0xc9))[_0xa112('0x41')](handleError(_0x25651c,null));};exports[_0xa112('0x20')]=function(_0x151e91,_0x4445e8){if(_0x151e91[_0xa112('0x44')]['id']){delete _0x151e91[_0xa112('0x44')]['id'];}return db[_0xa112('0x2a')][_0xa112('0x45')]({'where':{'id':_0x151e91['params']['id']}})[_0xa112('0x21')](handleEntityNotFound(_0x4445e8,null))[_0xa112('0x21')](saveUpdates(_0x151e91[_0xa112('0x44')],null))[_0xa112('0x21')](respondWithResult(_0x4445e8,null))[_0xa112('0x41')](handleError(_0x4445e8,null));};exports[_0xa112('0x22')]=function(_0x28f7e1,_0x7d458d){return db[_0xa112('0x2a')][_0xa112('0x45')]({'where':{'id':_0x28f7e1[_0xa112('0x46')]['id']}})['then'](handleEntityNotFound(_0x7d458d,null))[_0xa112('0x21')](removeEntity(_0x7d458d,null))[_0xa112('0x41')](handleError(_0x7d458d,null));};exports[_0xa112('0x47')]=function(_0x1e96c8,_0x36f59c){return db[_0xa112('0x2a')][_0xa112('0x47')]()[_0xa112('0x21')](respondWithResult(_0x36f59c,null))['catch'](handleError(_0x36f59c,null));}; \ No newline at end of file +var _0x2a30=['length','nolimit','limit','order','sort','where','pick','filter','merge','options','UserProfileSection','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','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','count','offset','set','json','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x33ca22,_0xbcc94){var _0x1790c3=function(_0x448b06){while(--_0x448b06){_0x33ca22['push'](_0x33ca22['shift']());}};_0x1790c3(++_0xbcc94);}(_0x2a30,0x1d8));var _0x02a3=function(_0x3636bd,_0x5b4d32){_0x3636bd=_0x3636bd-0x0;var _0x2d76da=_0x2a30[_0x3636bd];return _0x2d76da;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x02a3('0x0'));var rimraf=require(_0x02a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x02a3('0x2'));var moment=require(_0x02a3('0x3'));var BPromise=require(_0x02a3('0x4'));var Mustache=require(_0x02a3('0x5'));var util=require(_0x02a3('0x6'));var path=require(_0x02a3('0x7'));var sox=require(_0x02a3('0x8'));var csv=require(_0x02a3('0x9'));var ejs=require(_0x02a3('0xa'));var fs=require('fs');var _=require(_0x02a3('0xb'));var squel=require(_0x02a3('0xc'));var crypto=require('crypto');var jsforce=require(_0x02a3('0xd'));var deskjs=require(_0x02a3('0xe'));var toCsv=require(_0x02a3('0x9'));var querystring=require(_0x02a3('0xf'));var Papa=require('papaparse');var Redis=require(_0x02a3('0x10'));var authService=require(_0x02a3('0x11'));var qs=require(_0x02a3('0x12'));var as=require(_0x02a3('0x13'));var hardwareService=require(_0x02a3('0x14'));var logger=require('../../config/logger')(_0x02a3('0x15'));var utils=require(_0x02a3('0x16'));var config=require(_0x02a3('0x17'));var licenseUtil=require(_0x02a3('0x18'));var db=require(_0x02a3('0x19'))['db'];function respondWithStatusCode(_0x12b40c,_0x58b34b){_0x58b34b=_0x58b34b||0xcc;return function(_0x40cb95){if(_0x40cb95){return _0x12b40c[_0x02a3('0x1a')](_0x58b34b);}return _0x12b40c[_0x02a3('0x1b')](_0x58b34b)[_0x02a3('0x1c')]();};}function respondWithResult(_0x5a3309,_0x5d243e){_0x5d243e=_0x5d243e||0xc8;return function(_0xa07856){if(_0xa07856){return _0x5a3309[_0x02a3('0x1b')](_0x5d243e)['json'](_0xa07856);}};}function respondWithFilteredResult(_0x3eaa85,_0x395f0e){return function(_0x324e15){if(_0x324e15){var _0x46370a=_0x324e15[_0x02a3('0x1d')],_0xa496d2=_0x395f0e[_0x02a3('0x1e')],_0x2895ac=_0x395f0e[_0x02a3('0x1e')]+_0x395f0e['limit'],_0x4c8c54;if(_0x2895ac>=_0x46370a){_0x2895ac=_0x46370a;_0x4c8c54=0xc8;}else{_0x4c8c54=0xce;}_0x3eaa85[_0x02a3('0x1b')](_0x4c8c54);return _0x3eaa85[_0x02a3('0x1f')]('Content-Range',_0xa496d2+'-'+_0x2895ac+'/'+_0x46370a)[_0x02a3('0x20')](_0x324e15);}return null;};}function patchUpdates(_0xceb3ec){return function(_0x361403){try{jsonpatch['apply'](_0x361403,_0xceb3ec,!![]);}catch(_0x14c84b){return BPromise[_0x02a3('0x21')](_0x14c84b);}return _0x361403[_0x02a3('0x22')]();};}function saveUpdates(_0x5f3253,_0x9ca424){return function(_0x2cac34){if(_0x2cac34){return _0x2cac34['update'](_0x5f3253)[_0x02a3('0x23')](function(_0x1591b8){return _0x1591b8;});}return null;};}function removeEntity(_0x5d1833,_0x582b3b){return function(_0x4e82de){if(_0x4e82de){return _0x4e82de[_0x02a3('0x24')]()[_0x02a3('0x23')](function(){_0x5d1833[_0x02a3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313c76,_0x3da486){return function(_0x44a9ca){if(!_0x44a9ca){_0x313c76[_0x02a3('0x1a')](0x194);}return _0x44a9ca;};}function handleError(_0x53ae64,_0x290d9e){_0x290d9e=_0x290d9e||0x1f4;return function(_0x3411da){logger['error'](_0x3411da[_0x02a3('0x25')]);if(_0x3411da[_0x02a3('0x26')]){delete _0x3411da['name'];}_0x53ae64[_0x02a3('0x1b')](_0x290d9e)[_0x02a3('0x27')](_0x3411da);};}exports[_0x02a3('0x28')]=function(_0x54fda1,_0x320748){var _0x1904db={},_0x23693f={},_0xbc6bca={'count':0x0,'rows':[]};var _0x53c9c4=_[_0x02a3('0x29')](db['UserProfileSection'][_0x02a3('0x2a')],function(_0x50d0b0){return{'name':_0x50d0b0[_0x02a3('0x2b')],'type':_0x50d0b0[_0x02a3('0x2c')][_0x02a3('0x2d')]};});_0x23693f[_0x02a3('0x2e')]=_[_0x02a3('0x29')](_0x53c9c4,'name');_0x23693f[_0x02a3('0x2f')]=_[_0x02a3('0x30')](_0x54fda1[_0x02a3('0x2f')]);_0x23693f[_0x02a3('0x31')]=_[_0x02a3('0x32')](_0x23693f[_0x02a3('0x2e')],_0x23693f[_0x02a3('0x2f')]);_0x1904db[_0x02a3('0x33')]=_[_0x02a3('0x32')](_0x23693f['model'],qs['fields'](_0x54fda1[_0x02a3('0x2f')][_0x02a3('0x34')]));_0x1904db[_0x02a3('0x33')]=_0x1904db[_0x02a3('0x33')][_0x02a3('0x35')]?_0x1904db[_0x02a3('0x33')]:_0x23693f[_0x02a3('0x2e')];if(!_0x54fda1[_0x02a3('0x2f')]['hasOwnProperty'](_0x02a3('0x36'))){_0x1904db[_0x02a3('0x37')]=qs[_0x02a3('0x37')](_0x54fda1['query'][_0x02a3('0x37')]);_0x1904db[_0x02a3('0x1e')]=qs['offset'](_0x54fda1['query'][_0x02a3('0x1e')]);}_0x1904db[_0x02a3('0x38')]=qs[_0x02a3('0x39')](_0x54fda1[_0x02a3('0x2f')][_0x02a3('0x39')]);_0x1904db[_0x02a3('0x3a')]=qs[_0x02a3('0x31')](_[_0x02a3('0x3b')](_0x54fda1[_0x02a3('0x2f')],_0x23693f[_0x02a3('0x31')]),_0x53c9c4);if(_0x54fda1[_0x02a3('0x2f')][_0x02a3('0x3c')]){_0x1904db[_0x02a3('0x3a')]=_[_0x02a3('0x3d')](_0x1904db[_0x02a3('0x3a')],{'$or':_['map'](_0x53c9c4,function(_0xdba00d){if(_0xdba00d[_0x02a3('0x2c')]!=='VIRTUAL'){var _0x51912c={};_0x51912c[_0xdba00d['name']]={'$like':'%'+_0x54fda1['query'][_0x02a3('0x3c')]+'%'};return _0x51912c;}})});}_0x1904db=_[_0x02a3('0x3d')]({},_0x1904db,_0x54fda1[_0x02a3('0x3e')]);var _0x228f0c={'where':_0x1904db['where']};return db[_0x02a3('0x3f')]['count'](_0x228f0c)['then'](function(_0x395d0e){_0xbc6bca['count']=_0x395d0e;if(_0x54fda1[_0x02a3('0x2f')][_0x02a3('0x40')]){_0x1904db[_0x02a3('0x41')]=[{'all':!![]}];}return db[_0x02a3('0x3f')][_0x02a3('0x42')](_0x1904db);})[_0x02a3('0x23')](function(_0x45c340){_0xbc6bca[_0x02a3('0x43')]=_0x45c340;return _0xbc6bca;})[_0x02a3('0x23')](respondWithFilteredResult(_0x320748,_0x1904db))[_0x02a3('0x44')](handleError(_0x320748,null));};exports[_0x02a3('0x45')]=function(_0x4dd19a,_0x354e25){var _0x2e4006={'raw':![],'where':{'id':_0x4dd19a[_0x02a3('0x46')]['id']}},_0x1257ff={};_0x1257ff[_0x02a3('0x2e')]=_['keys'](db[_0x02a3('0x3f')][_0x02a3('0x2a')]);_0x1257ff[_0x02a3('0x2f')]=_[_0x02a3('0x30')](_0x4dd19a[_0x02a3('0x2f')]);_0x1257ff[_0x02a3('0x31')]=_['intersection'](_0x1257ff[_0x02a3('0x2e')],_0x1257ff[_0x02a3('0x2f')]);_0x2e4006[_0x02a3('0x33')]=_['intersection'](_0x1257ff[_0x02a3('0x2e')],qs['fields'](_0x4dd19a[_0x02a3('0x2f')][_0x02a3('0x34')]));_0x2e4006[_0x02a3('0x33')]=_0x2e4006[_0x02a3('0x33')][_0x02a3('0x35')]?_0x2e4006[_0x02a3('0x33')]:_0x1257ff[_0x02a3('0x2e')];if(_0x4dd19a[_0x02a3('0x2f')][_0x02a3('0x40')]){_0x2e4006[_0x02a3('0x41')]=[{'all':!![]}];}_0x2e4006=_[_0x02a3('0x3d')]({},_0x2e4006,_0x4dd19a[_0x02a3('0x3e')]);return db[_0x02a3('0x3f')][_0x02a3('0x47')](_0x2e4006)[_0x02a3('0x23')](handleEntityNotFound(_0x354e25,null))[_0x02a3('0x23')](respondWithResult(_0x354e25,null))['catch'](handleError(_0x354e25,null));};exports['create']=function(_0x730443,_0x4b4456){return db['UserProfileSection'][_0x02a3('0x48')](_0x730443[_0x02a3('0x49')],{})['then'](respondWithResult(_0x4b4456,0xc9))[_0x02a3('0x44')](handleError(_0x4b4456,null));};exports['update']=function(_0x72a8ea,_0x485425){if(_0x72a8ea[_0x02a3('0x49')]['id']){delete _0x72a8ea[_0x02a3('0x49')]['id'];}return db[_0x02a3('0x3f')]['find']({'where':{'id':_0x72a8ea['params']['id']}})[_0x02a3('0x23')](handleEntityNotFound(_0x485425,null))[_0x02a3('0x23')](saveUpdates(_0x72a8ea[_0x02a3('0x49')],null))[_0x02a3('0x23')](respondWithResult(_0x485425,null))[_0x02a3('0x44')](handleError(_0x485425,null));};exports[_0x02a3('0x24')]=function(_0x451db8,_0x16dd22){return db['UserProfileSection']['find']({'where':{'id':_0x451db8[_0x02a3('0x46')]['id']}})['then'](handleEntityNotFound(_0x16dd22,null))['then'](removeEntity(_0x16dd22,null))[_0x02a3('0x44')](handleError(_0x16dd22,null));};exports['describe']=function(_0x563e3d,_0x2dce3d){return db[_0x02a3('0x3f')][_0x02a3('0x4a')]()[_0x02a3('0x23')](respondWithResult(_0x2dce3d,null))[_0x02a3('0x44')](handleError(_0x2dce3d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index b21b24e..08e7ea7 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 _0x1333=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','api'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_0x1333,0xb5));var _0x3133=function(_0x527230,_0xdc83e8){_0x527230=_0x527230-0x0;var _0x2f6870=_0x1333[_0x527230];return _0x2f6870;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3133('0x0'));var moment=require(_0x3133('0x1'));var BPromise=require(_0x3133('0x2'));var rp=require(_0x3133('0x3'));var fs=require('fs');var path=require(_0x3133('0x4'));var rimraf=require(_0x3133('0x5'));var config=require(_0x3133('0x6'));var attributes=require(_0x3133('0x7'));module[_0x3133('0x8')]=function(_0xb59937,_0x581cf3){return _0xb59937[_0x3133('0x9')](_0x3133('0xa'),attributes,{'tableName':_0x3133('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x3133('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9122=['compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections'];(function(_0x5713c6,_0x183b25){var _0x265282=function(_0x5702d2){while(--_0x5702d2){_0x5713c6['push'](_0x5713c6['shift']());}};_0x265282(++_0x183b25);}(_0x9122,0xa5));var _0x2912=function(_0x57d1e8,_0x504b56){_0x57d1e8=_0x57d1e8-0x0;var _0x24a689=_0x9122[_0x57d1e8];return _0x24a689;};'use strict';var _=require(_0x2912('0x0'));var util=require(_0x2912('0x1'));var logger=require(_0x2912('0x2'))(_0x2912('0x3'));var moment=require(_0x2912('0x4'));var BPromise=require(_0x2912('0x5'));var rp=require(_0x2912('0x6'));var fs=require('fs');var path=require(_0x2912('0x7'));var rimraf=require(_0x2912('0x8'));var config=require(_0x2912('0x9'));var attributes=require(_0x2912('0xa'));module[_0x2912('0xb')]=function(_0x3a4ae3,_0x419a4f){return _0x3a4ae3[_0x2912('0xc')](_0x2912('0xd'),attributes,{'tableName':_0x2912('0xe'),'paranoid':![],'indexes':[{'name':_0x2912('0xf'),'fields':[_0x2912('0x10'),_0x2912('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 509f91a..ddf3230 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 _0xd470=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util'];(function(_0x279183,_0x269688){var _0xd28a7a=function(_0x97205){while(--_0x97205){_0x279183['push'](_0x279183['shift']());}};_0xd28a7a(++_0x269688);}(_0xd470,0x1b4));var _0x0d47=function(_0x19d8c0,_0x465716){_0x19d8c0=_0x19d8c0-0x0;var _0xbe7bc9=_0xd470[_0x19d8c0];return _0xbe7bc9;};'use strict';var _=require('lodash');var util=require(_0x0d47('0x0'));var moment=require(_0x0d47('0x1'));var BPromise=require(_0x0d47('0x2'));var rs=require(_0x0d47('0x3'));var fs=require('fs');var Redis=require(_0x0d47('0x4'));var db=require(_0x0d47('0x5'))['db'];var utils=require(_0x0d47('0x6'));var logger=require(_0x0d47('0x7'))('rpc');var config=require(_0x0d47('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0d47('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f881b,_0x82004,_0x4dc8e3){return new BPromise(function(_0x2558d1,_0x6f0f2){return client['request'](_0x2f881b,_0x4dc8e3)['then'](function(_0x1c76b6){logger[_0x0d47('0xa')](_0x0d47('0xb'),_0x82004,'request\x20sent');logger[_0x0d47('0xc')](_0x0d47('0xd'),_0x82004,_0x0d47('0xe'),JSON['stringify'](_0x1c76b6));if(_0x1c76b6[_0x0d47('0xf')]){if(_0x1c76b6[_0x0d47('0xf')][_0x0d47('0x10')]===0x1f4){logger[_0x0d47('0xf')](_0x0d47('0xb'),_0x82004,_0x1c76b6[_0x0d47('0xf')][_0x0d47('0x11')]);return _0x6f0f2(_0x1c76b6[_0x0d47('0xf')][_0x0d47('0x11')]);}logger['error'](_0x0d47('0xb'),_0x82004,_0x1c76b6[_0x0d47('0xf')][_0x0d47('0x11')]);return _0x2558d1(_0x1c76b6[_0x0d47('0xf')][_0x0d47('0x11')]);}else{logger[_0x0d47('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x82004,_0x0d47('0xe'));_0x2558d1(_0x1c76b6['result'][_0x0d47('0x11')]);}})[_0x0d47('0x12')](function(_0x2831e8){logger[_0x0d47('0xf')](_0x0d47('0xb'),_0x82004,_0x2831e8);_0x6f0f2(_0x2831e8);});});} \ No newline at end of file +var _0xe581=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','request','then','info','UserProfileSection,\x20%s,\x20%s'];(function(_0x55c947,_0x5e20a8){var _0x2556b3=function(_0x239288){while(--_0x239288){_0x55c947['push'](_0x55c947['shift']());}};_0x2556b3(++_0x5e20a8);}(_0xe581,0x80));var _0x1e58=function(_0xc92bcb,_0x4b941e){_0xc92bcb=_0xc92bcb-0x0;var _0x510392=_0xe581[_0xc92bcb];return _0x510392;};'use strict';var _=require(_0x1e58('0x0'));var util=require(_0x1e58('0x1'));var moment=require('moment');var BPromise=require(_0x1e58('0x2'));var rs=require(_0x1e58('0x3'));var fs=require('fs');var Redis=require(_0x1e58('0x4'));var db=require(_0x1e58('0x5'))['db'];var utils=require(_0x1e58('0x6'));var logger=require(_0x1e58('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1df949,_0x36734e,_0x2e3658){return new BPromise(function(_0x528276,_0x377ae8){return client[_0x1e58('0x8')](_0x1df949,_0x2e3658)[_0x1e58('0x9')](function(_0x590667){logger[_0x1e58('0xa')](_0x1e58('0xb'),_0x36734e,_0x1e58('0xc'));logger[_0x1e58('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x36734e,_0x1e58('0xc'),JSON[_0x1e58('0xe')](_0x590667));if(_0x590667[_0x1e58('0xf')]){if(_0x590667[_0x1e58('0xf')][_0x1e58('0x10')]===0x1f4){logger[_0x1e58('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x36734e,_0x590667[_0x1e58('0xf')][_0x1e58('0x11')]);return _0x377ae8(_0x590667[_0x1e58('0xf')][_0x1e58('0x11')]);}logger[_0x1e58('0xf')](_0x1e58('0xb'),_0x36734e,_0x590667['error']['message']);return _0x528276(_0x590667['error'][_0x1e58('0x11')]);}else{logger[_0x1e58('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x36734e,'request\x20sent');_0x528276(_0x590667[_0x1e58('0x12')]['message']);}})[_0x1e58('0x13')](function(_0x27b493){logger['error'](_0x1e58('0xb'),_0x36734e,_0x27b493);_0x377ae8(_0x27b493);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index d821bfd..84af18c 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 _0x2990=['../../config/environment','exports','util','express','Router'];(function(_0x4cb670,_0x1f1f33){var _0xd2614b=function(_0x3c9b86){while(--_0x3c9b86){_0x4cb670['push'](_0x4cb670['shift']());}};_0xd2614b(++_0x1f1f33);}(_0x2990,0xe8));var _0x0299=function(_0xc85772,_0x2cb236){_0xc85772=_0xc85772-0x0;var _0x5bdfe0=_0x2990[_0xc85772];return _0x5bdfe0;};'use strict';var multer=require('multer');var util=require(_0x0299('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0299('0x1'));var router=express[_0x0299('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0299('0x3'));module[_0x0299('0x4')]=router; \ No newline at end of file +var _0xd60b=['path','express','Router','../../components/auth/service','../../components/interaction/service','util'];(function(_0x4e7f14,_0x1d8966){var _0x421cf7=function(_0x2cf0c4){while(--_0x2cf0c4){_0x4e7f14['push'](_0x4e7f14['shift']());}};_0x421cf7(++_0x1d8966);}(_0xd60b,0x137));var _0xbd60=function(_0x1bed3b,_0x3d22d5){_0x1bed3b=_0x1bed3b-0x0;var _0xf6cea3=_0xd60b[_0x1bed3b];return _0xf6cea3;};'use strict';var multer=require('multer');var util=require(_0xbd60('0x0'));var path=require(_0xbd60('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd60('0x2'));var router=express[_0xbd60('0x3')]();var auth=require(_0xbd60('0x4'));var interaction=require(_0xbd60('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 4d7c547..b95d725 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x48cb69,_0x583eef){var _0x248a11=function(_0x5cc495){while(--_0x5cc495){_0x48cb69['push'](_0x48cb69['shift']());}};_0x248a11(++_0x583eef);}(_0xe706,0xa3));var _0x6e70=function(_0x329ba0,_0x2e889b){_0x329ba0=_0x329ba0-0x0;var _0x526123=_0xe706[_0x329ba0];return _0x526123;};'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(_0x12f9e3,_0x3fadc1){var _0x2de0c8=function(_0x31b5c5){while(--_0x31b5c5){_0x12f9e3['push'](_0x12f9e3['shift']());}};_0x2de0c8(++_0x3fadc1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'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 333506d..c4f019e 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 _0xd5b0=['./userSmsQueue.attributes','define','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0xd5b0,0x12f));var _0x0d5b=function(_0xf2fa8d,_0x23fa73){_0xf2fa8d=_0xf2fa8d-0x0;var _0x32c410=_0xd5b0[_0xf2fa8d];return _0x32c410;};'use strict';var _=require(_0x0d5b('0x0'));var util=require(_0x0d5b('0x1'));var logger=require(_0x0d5b('0x2'))(_0x0d5b('0x3'));var moment=require('moment');var BPromise=require(_0x0d5b('0x4'));var rp=require(_0x0d5b('0x5'));var fs=require('fs');var path=require(_0x0d5b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0d5b('0x7'));module['exports']=function(_0x12e661,_0x178c31){return _0x12e661[_0x0d5b('0x8')]('UserSmsQueue',attributes,{'tableName':_0x0d5b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca66=['../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','api','moment','bluebird','request-promise','path'];(function(_0x10eec8,_0x215b87){var _0x58592b=function(_0xa66a43){while(--_0xa66a43){_0x10eec8['push'](_0x10eec8['shift']());}};_0x58592b(++_0x215b87);}(_0xca66,0x16d));var _0x6ca6=function(_0x481fbb,_0x2fbbbb){_0x481fbb=_0x481fbb-0x0;var _0x517e49=_0xca66[_0x481fbb];return _0x517e49;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6ca6('0x0'));var moment=require(_0x6ca6('0x1'));var BPromise=require(_0x6ca6('0x2'));var rp=require(_0x6ca6('0x3'));var fs=require('fs');var path=require(_0x6ca6('0x4'));var rimraf=require('rimraf');var config=require(_0x6ca6('0x5'));var attributes=require(_0x6ca6('0x6'));module['exports']=function(_0x1c99de,_0x5574aa){return _0x1c99de[_0x6ca6('0x7')](_0x6ca6('0x8'),attributes,{'tableName':_0x6ca6('0x9'),'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 1b6dadf..7e5c6d8 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 _0xca47=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xca47,0x194));var _0x7ca4=function(_0x56dc9a,_0xde3f79){_0x56dc9a=_0x56dc9a-0x0;var _0x173231=_0xca47[_0x56dc9a];return _0x173231;};'use strict';var _=require(_0x7ca4('0x0'));var util=require(_0x7ca4('0x1'));var moment=require(_0x7ca4('0x2'));var BPromise=require(_0x7ca4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ca4('0x4'));var db=require(_0x7ca4('0x5'))['db'];var utils=require(_0x7ca4('0x6'));var logger=require(_0x7ca4('0x7'))(_0x7ca4('0x8'));var config=require(_0x7ca4('0x9'));var jayson=require(_0x7ca4('0xa'));var client=jayson[_0x7ca4('0xb')][_0x7ca4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x411449,_0x10570e,_0x554752){return new BPromise(function(_0x38a327,_0x337edb){return client[_0x7ca4('0xd')](_0x411449,_0x554752)[_0x7ca4('0xe')](function(_0x1785c5){logger[_0x7ca4('0xf')](_0x7ca4('0x10'),_0x10570e,_0x7ca4('0x11'));logger[_0x7ca4('0x12')](_0x7ca4('0x13'),_0x10570e,_0x7ca4('0x11'),JSON['stringify'](_0x1785c5));if(_0x1785c5[_0x7ca4('0x14')]){if(_0x1785c5[_0x7ca4('0x14')]['code']===0x1f4){logger[_0x7ca4('0x14')](_0x7ca4('0x10'),_0x10570e,_0x1785c5[_0x7ca4('0x14')][_0x7ca4('0x15')]);return _0x337edb(_0x1785c5[_0x7ca4('0x14')][_0x7ca4('0x15')]);}logger[_0x7ca4('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x10570e,_0x1785c5['error'][_0x7ca4('0x15')]);return _0x38a327(_0x1785c5[_0x7ca4('0x14')][_0x7ca4('0x15')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x10570e,_0x7ca4('0x11'));_0x38a327(_0x1785c5[_0x7ca4('0x16')][_0x7ca4('0x15')]);}})[_0x7ca4('0x17')](function(_0x348cce){logger[_0x7ca4('0x14')](_0x7ca4('0x10'),_0x10570e,_0x348cce);_0x337edb(_0x348cce);});});} \ No newline at end of file +var _0xbb15=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0xbb15,0x92));var _0x5bb1=function(_0x18b148,_0x14ef19){_0x18b148=_0x18b148-0x0;var _0x718076=_0xbb15[_0x18b148];return _0x718076;};'use strict';var _=require(_0x5bb1('0x0'));var util=require(_0x5bb1('0x1'));var moment=require(_0x5bb1('0x2'));var BPromise=require(_0x5bb1('0x3'));var rs=require(_0x5bb1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5bb1('0x5'));var logger=require('../../config/logger')(_0x5bb1('0x6'));var config=require(_0x5bb1('0x7'));var jayson=require(_0x5bb1('0x8'));var client=jayson[_0x5bb1('0x9')][_0x5bb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0c9b,_0x252d0a,_0x13091a){return new BPromise(function(_0x1541ff,_0x27b1e5){return client['request'](_0x2f0c9b,_0x13091a)['then'](function(_0xc596b){logger['info'](_0x5bb1('0xb'),_0x252d0a,_0x5bb1('0xc'));logger[_0x5bb1('0xd')](_0x5bb1('0xe'),_0x252d0a,_0x5bb1('0xc'),JSON[_0x5bb1('0xf')](_0xc596b));if(_0xc596b['error']){if(_0xc596b[_0x5bb1('0x10')]['code']===0x1f4){logger[_0x5bb1('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x252d0a,_0xc596b[_0x5bb1('0x10')][_0x5bb1('0x11')]);return _0x27b1e5(_0xc596b['error']['message']);}logger['error'](_0x5bb1('0xb'),_0x252d0a,_0xc596b[_0x5bb1('0x10')]['message']);return _0x1541ff(_0xc596b['error'][_0x5bb1('0x11')]);}else{logger['info'](_0x5bb1('0xb'),_0x252d0a,_0x5bb1('0xc'));_0x1541ff(_0xc596b[_0x5bb1('0x12')][_0x5bb1('0x11')]);}})[_0x5bb1('0x13')](function(_0x3c2e4f){logger['error'](_0x5bb1('0xb'),_0x252d0a,_0x3c2e4f);_0x27b1e5(_0x3c2e4f);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 0872089..d3f2477 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 _0xe289=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x1127bf,_0x542714){var _0x5bdfce=function(_0x29b766){while(--_0x29b766){_0x1127bf['push'](_0x1127bf['shift']());}};_0x5bdfce(++_0x542714);}(_0xe289,0xc6));var _0x9e28=function(_0x58e66f,_0x8b4c4e){_0x58e66f=_0x58e66f-0x0;var _0x56db9c=_0xe289[_0x58e66f];return _0x56db9c;};'use strict';var multer=require(_0x9e28('0x0'));var util=require(_0x9e28('0x1'));var path=require(_0x9e28('0x2'));var timeout=require(_0x9e28('0x3'));var express=require(_0x9e28('0x4'));var router=express[_0x9e28('0x5')]();var auth=require(_0x9e28('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9e28('0x7'));module[_0x9e28('0x8')]=router; \ No newline at end of file +var _0x78da=['multer','util','connect-timeout','Router','../../components/interaction/service'];(function(_0x3db1e5,_0x506101){var _0x3f71e7=function(_0x5013db){while(--_0x5013db){_0x3db1e5['push'](_0x3db1e5['shift']());}};_0x3f71e7(++_0x506101);}(_0x78da,0x1ef));var _0xa78d=function(_0x1fc51c,_0x35f495){_0x1fc51c=_0x1fc51c-0x0;var _0x2c7e43=_0x78da[_0x1fc51c];return _0x2c7e43;};'use strict';var multer=require(_0xa78d('0x0'));var util=require(_0xa78d('0x1'));var path=require('path');var timeout=require(_0xa78d('0x2'));var express=require('express');var router=express[_0xa78d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa78d('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 39fc571..e39b3c0 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 _0xbaf0=['exports','INTEGER'];(function(_0x59c683,_0x209444){var _0x47251b=function(_0x4db046){while(--_0x4db046){_0x59c683['push'](_0x59c683['shift']());}};_0x47251b(++_0x209444);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x335fa8,_0x1773b6){var _0x2e6259=function(_0x590539){while(--_0x590539){_0x335fa8['push'](_0x335fa8['shift']());}};_0x2e6259(++_0x1773b6);}(_0xe706,0xa3));var _0x6e70=function(_0x1ba29c,_0x5833e0){_0x1ba29c=_0x1ba29c-0x0;var _0x5d3243=_0xe706[_0x1ba29c];return _0x5d3243;};'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/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index bfa8ab5..5b2cd2a 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 _0x5c12=['./userVoiceQueue.attributes','define','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x30a640,_0x300254){var _0x21f6b4=function(_0x5f330d){while(--_0x5f330d){_0x30a640['push'](_0x30a640['shift']());}};_0x21f6b4(++_0x300254);}(_0x5c12,0x188));var _0x25c1=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x5c12[_0x3c22e0];return _0x215811;};'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')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2123=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xcefbbc,_0x3cd305){var _0x18831f=function(_0x800dbc){while(--_0x800dbc){_0xcefbbc['push'](_0xcefbbc['shift']());}};_0x18831f(++_0x3cd305);}(_0x2123,0x190));var _0x3212=function(_0x173fed,_0x199fea){_0x173fed=_0x173fed-0x0;var _0x367ab5=_0x2123[_0x173fed];return _0x367ab5;};'use strict';var _=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var logger=require(_0x3212('0x2'))(_0x3212('0x3'));var moment=require(_0x3212('0x4'));var BPromise=require(_0x3212('0x5'));var rp=require(_0x3212('0x6'));var fs=require('fs');var path=require(_0x3212('0x7'));var rimraf=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var attributes=require(_0x3212('0xa'));module[_0x3212('0xb')]=function(_0x5d9d36,_0x3859e4){return _0x5d9d36[_0x3212('0xc')](_0x3212('0xd'),attributes,{'tableName':'user_has_voice_queues','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 20fb98c..9c89495 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 _0x4053=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xa8fbb7,_0x4bd8a9){var _0x416d77=function(_0x122ebb){while(--_0x122ebb){_0xa8fbb7['push'](_0xa8fbb7['shift']());}};_0x416d77(++_0x4bd8a9);}(_0x4053,0xd7));var _0x3405=function(_0xd8a8af,_0x1e93f0){_0xd8a8af=_0xd8a8af-0x0;var _0x5b7278=_0x4053[_0xd8a8af];return _0x5b7278;};'use strict';var _=require(_0x3405('0x0'));var util=require(_0x3405('0x1'));var moment=require(_0x3405('0x2'));var BPromise=require(_0x3405('0x3'));var rs=require(_0x3405('0x4'));var fs=require('fs');var Redis=require(_0x3405('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3405('0x6'));var logger=require(_0x3405('0x7'))(_0x3405('0x8'));var config=require(_0x3405('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3405('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x76d3ce,_0x4691e6,_0x1ef8b){return new BPromise(function(_0x1f5e42,_0x3e1211){return client[_0x3405('0xb')](_0x76d3ce,_0x1ef8b)['then'](function(_0x260379){logger[_0x3405('0xc')](_0x3405('0xd'),_0x4691e6,_0x3405('0xe'));logger[_0x3405('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4691e6,_0x3405('0xe'),JSON['stringify'](_0x260379));if(_0x260379[_0x3405('0x10')]){if(_0x260379[_0x3405('0x10')][_0x3405('0x11')]===0x1f4){logger[_0x3405('0x10')](_0x3405('0xd'),_0x4691e6,_0x260379[_0x3405('0x10')][_0x3405('0x12')]);return _0x3e1211(_0x260379[_0x3405('0x10')][_0x3405('0x12')]);}logger[_0x3405('0x10')](_0x3405('0xd'),_0x4691e6,_0x260379['error'][_0x3405('0x12')]);return _0x1f5e42(_0x260379[_0x3405('0x10')][_0x3405('0x12')]);}else{logger['info'](_0x3405('0xd'),_0x4691e6,_0x3405('0xe'));_0x1f5e42(_0x260379[_0x3405('0x13')][_0x3405('0x12')]);}})[_0x3405('0x14')](function(_0x28a854){logger[_0x3405('0x10')](_0x3405('0xd'),_0x4691e6,_0x28a854);_0x3e1211(_0x28a854);});});} \ No newline at end of file +var _0x2695=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x52f1f9,_0x171046){var _0x178fc2=function(_0x170f57){while(--_0x170f57){_0x52f1f9['push'](_0x52f1f9['shift']());}};_0x178fc2(++_0x171046);}(_0x2695,0x1de));var _0x5269=function(_0x829e59,_0x3c36b4){_0x829e59=_0x829e59-0x0;var _0x4dcfe5=_0x2695[_0x829e59];return _0x4dcfe5;};'use strict';var _=require('lodash');var util=require(_0x5269('0x0'));var moment=require(_0x5269('0x1'));var BPromise=require(_0x5269('0x2'));var rs=require(_0x5269('0x3'));var fs=require('fs');var Redis=require(_0x5269('0x4'));var db=require(_0x5269('0x5'))['db'];var utils=require(_0x5269('0x6'));var logger=require(_0x5269('0x7'))(_0x5269('0x8'));var config=require(_0x5269('0x9'));var jayson=require(_0x5269('0xa'));var client=jayson[_0x5269('0xb')][_0x5269('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x235c38,_0x24b05e,_0xd1b0e3){return new BPromise(function(_0x68ef91,_0xab61){return client[_0x5269('0xd')](_0x235c38,_0xd1b0e3)[_0x5269('0xe')](function(_0x4fba2c){logger[_0x5269('0xf')](_0x5269('0x10'),_0x24b05e,_0x5269('0x11'));logger['debug'](_0x5269('0x12'),_0x24b05e,'request\x20sent',JSON[_0x5269('0x13')](_0x4fba2c));if(_0x4fba2c[_0x5269('0x14')]){if(_0x4fba2c[_0x5269('0x14')][_0x5269('0x15')]===0x1f4){logger[_0x5269('0x14')](_0x5269('0x10'),_0x24b05e,_0x4fba2c[_0x5269('0x14')][_0x5269('0x16')]);return _0xab61(_0x4fba2c[_0x5269('0x14')][_0x5269('0x16')]);}logger[_0x5269('0x14')](_0x5269('0x10'),_0x24b05e,_0x4fba2c[_0x5269('0x14')][_0x5269('0x16')]);return _0x68ef91(_0x4fba2c[_0x5269('0x14')][_0x5269('0x16')]);}else{logger[_0x5269('0xf')](_0x5269('0x10'),_0x24b05e,_0x5269('0x11'));_0x68ef91(_0x4fba2c[_0x5269('0x17')][_0x5269('0x16')]);}})[_0x5269('0x18')](function(_0x221054){logger[_0x5269('0x14')](_0x5269('0x10'),_0x24b05e,_0x221054);_0xab61(_0x221054);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 9519f37..c1c3818 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 _0x86be=['exports','multer','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x86be,0xd9));var _0xe86b=function(_0x46ed07,_0x34e286){_0x46ed07=_0x46ed07-0x0;var _0x3de219=_0x86be[_0x46ed07];return _0x3de219;};'use strict';var multer=require(_0xe86b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe86b('0x1'));var router=express[_0xe86b('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe86b('0x3'));var config=require(_0xe86b('0x4'));module[_0xe86b('0x5')]=router; \ No newline at end of file +var _0x7f1d=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x2573ec,_0x57f9d1){var _0x45d98f=function(_0x18a5d3){while(--_0x18a5d3){_0x2573ec['push'](_0x2573ec['shift']());}};_0x45d98f(++_0x57f9d1);}(_0x7f1d,0x11d));var _0xd7f1=function(_0x4c55c2,_0x5dde7e){_0x4c55c2=_0x4c55c2-0x0;var _0x469bab=_0x7f1d[_0x4c55c2];return _0x469bab;};'use strict';var multer=require(_0xd7f1('0x0'));var util=require(_0xd7f1('0x1'));var path=require(_0xd7f1('0x2'));var timeout=require('connect-timeout');var express=require(_0xd7f1('0x3'));var router=express[_0xd7f1('0x4')]();var auth=require(_0xd7f1('0x5'));var interaction=require(_0xd7f1('0x6'));var config=require(_0xd7f1('0x7'));module[_0xd7f1('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5e61488..582cea1 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 _0x9477=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x9477,0x110));var _0x7947=function(_0x2ee3e2,_0x371a9b){_0x2ee3e2=_0x2ee3e2-0x0;var _0x40c591=_0x9477[_0x2ee3e2];return _0x40c591;};'use strict';var Sequelize=require('sequelize');module[_0x7947('0x0')]={'uniqueid':{'type':Sequelize[_0x7947('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7947('0x2')},'membername':{'type':Sequelize[_0x7947('0x3')],'allowNull':![],'comment':_0x7947('0x2')},'UserId':{'type':Sequelize[_0x7947('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7947('0x3')],'allowNull':![],'unique':_0x7947('0x4'),'comment':_0x7947('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x7947('0x3')],'allowNull':![],'unique':_0x7947('0x4'),'comment':_0x7947('0x2')},'penalty':{'type':Sequelize[_0x7947('0x1')](0xb),'defaultValue':0x0,'comment':_0x7947('0x2')},'paused':{'type':Sequelize[_0x7947('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x4acc=['STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports','INTEGER'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4acc,0x153));var _0xc4ac=function(_0x145ca3,_0x481b50){_0x145ca3=_0x145ca3-0x0;var _0xac5005=_0x4acc[_0x145ca3];return _0xac5005;};'use strict';var Sequelize=require(_0xc4ac('0x0'));module[_0xc4ac('0x1')]={'uniqueid':{'type':Sequelize[_0xc4ac('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xc4ac('0x3')],'allowNull':![],'comment':_0xc4ac('0x4')},'UserId':{'type':Sequelize[_0xc4ac('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc4ac('0x5'),'comment':_0xc4ac('0x4')},'VoiceQueueId':{'type':Sequelize[_0xc4ac('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xc4ac('0x3')],'allowNull':![],'unique':_0xc4ac('0x5'),'comment':_0xc4ac('0x4')},'penalty':{'type':Sequelize[_0xc4ac('0x2')](0xb),'defaultValue':0x0,'comment':_0xc4ac('0x4')},'paused':{'type':Sequelize[_0xc4ac('0x2')](0xb),'defaultValue':0x0,'comment':_0xc4ac('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index dbb16cd..df74f9c 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 _0x148f=['events','UserVoiceQueueRt','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5c2719,_0x2b0c43){var _0x34825e=function(_0x2750fb){while(--_0x2750fb){_0x5c2719['push'](_0x5c2719['shift']());}};_0x34825e(++_0x2b0c43);}(_0x148f,0x14d));var _0xf148=function(_0x3e3130,_0x174aca){_0x3e3130=_0x3e3130-0x0;var _0x2610b8=_0x148f[_0x3e3130];return _0x2610b8;};'use strict';var EventEmitter=require(_0xf148('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xf148('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf148('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf148('0x3'),'afterDestroy':_0xf148('0x4')};function emitEvent(_0x34ae9a){return function(_0x12d7a2,_0x24f15c,_0x20abb2){UserVoiceQueueRtEvents[_0xf148('0x5')](_0x34ae9a+':'+_0x12d7a2['id'],_0x12d7a2);UserVoiceQueueRtEvents[_0xf148('0x5')](_0x34ae9a,_0x12d7a2);_0x20abb2(null);};}for(var e in events){if(events[_0xf148('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xf148('0x7')](e,emitEvent(event));}}module[_0xf148('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xc7fa=['save','update','emit','hook','exports'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0xc7fa,0xaa));var _0xac7f=function(_0x3883fd,_0x28ebd5){_0x3883fd=_0x3883fd-0x0;var _0x4732f0=_0xc7fa[_0x3883fd];return _0x4732f0;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xac7f('0x0'),'afterUpdate':_0xac7f('0x1'),'afterDestroy':'remove'};function emitEvent(_0x33f54b){return function(_0x214845,_0x3a583c,_0x194916){UserVoiceQueueRtEvents[_0xac7f('0x2')](_0x33f54b+':'+_0x214845['id'],_0x214845);UserVoiceQueueRtEvents['emit'](_0x33f54b,_0x214845);_0x194916(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xac7f('0x3')](e,emitEvent(event));}}module[_0xac7f('0x4')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8ae244c..4e20337 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 _0x15c7=['path','rimraf','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xeb6f8d,_0x1138f1){var _0x41f045=function(_0x2e8f0e){while(--_0x2e8f0e){_0xeb6f8d['push'](_0xeb6f8d['shift']());}};_0x41f045(++_0x1138f1);}(_0x15c7,0x117));var _0x715c=function(_0xd0d0d6,_0x599467){_0xd0d0d6=_0xd0d0d6-0x0;var _0xaf201f=_0x15c7[_0xd0d0d6];return _0xaf201f;};'use strict';var _=require(_0x715c('0x0'));var util=require(_0x715c('0x1'));var logger=require(_0x715c('0x2'))(_0x715c('0x3'));var moment=require(_0x715c('0x4'));var BPromise=require(_0x715c('0x5'));var rp=require(_0x715c('0x6'));var fs=require('fs');var path=require(_0x715c('0x7'));var rimraf=require(_0x715c('0x8'));var config=require('../../config/environment');var attributes=require(_0x715c('0x9'));module[_0x715c('0xa')]=function(_0x992068,_0xa464a1){return _0x992068[_0x715c('0xb')]('UserVoiceQueueRt',attributes,{'tableName':_0x715c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf71f=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4521e3,_0x10a8a4){var _0x46a272=function(_0x2f4c64){while(--_0x2f4c64){_0x4521e3['push'](_0x4521e3['shift']());}};_0x46a272(++_0x10a8a4);}(_0xf71f,0xfb));var _0xff71=function(_0x5e3fa5,_0x29df00){_0x5e3fa5=_0x5e3fa5-0x0;var _0x432ba1=_0xf71f[_0x5e3fa5];return _0x432ba1;};'use strict';var _=require(_0xff71('0x0'));var util=require(_0xff71('0x1'));var logger=require(_0xff71('0x2'))(_0xff71('0x3'));var moment=require(_0xff71('0x4'));var BPromise=require(_0xff71('0x5'));var rp=require(_0xff71('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff71('0x7'));var config=require(_0xff71('0x8'));var attributes=require(_0xff71('0x9'));module[_0xff71('0xa')]=function(_0x30b6d7,_0x5cbaad){return _0x30b6d7[_0xff71('0xb')](_0xff71('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 1ff8880..b55d590 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 _0x8931=['redis','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter'];(function(_0x575e50,_0xa1c92d){var _0x1057b1=function(_0x12ac8d){while(--_0x12ac8d){_0x575e50['push'](_0x575e50['shift']());}};_0x1057b1(++_0xa1c92d);}(_0x8931,0x67));var _0x1893=function(_0x5694e4,_0x191519){_0x5694e4=_0x5694e4-0x0;var _0x2f221a=_0x8931[_0x5694e4];return _0x2f221a;};'use strict';var _=require(_0x1893('0x0'));var util=require('util');var moment=require(_0x1893('0x1'));var BPromise=require(_0x1893('0x2'));var rs=require(_0x1893('0x3'));var fs=require('fs');var Redis=require(_0x1893('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1893('0x5'))(_0x1893('0x6'));var config=require(_0x1893('0x7'));var jayson=require(_0x1893('0x8'));var client=jayson[_0x1893('0x9')][_0x1893('0xa')]({'port':0x232a});config['redis']=_[_0x1893('0xb')](config['redis'],{'host':_0x1893('0xc'),'port':0x18eb});var socket=require(_0x1893('0xd'))(new Redis(config[_0x1893('0xe')]));require(_0x1893('0xf'))[_0x1893('0x10')](socket);function respondWithRpcPromise(_0x4c6e65,_0x348c96,_0x3b4f7f){return new BPromise(function(_0x5aef53,_0x21e6e2){return client[_0x1893('0x11')](_0x4c6e65,_0x3b4f7f)[_0x1893('0x12')](function(_0x2bd919){logger['info'](_0x1893('0x13'),_0x348c96,_0x1893('0x14'));logger['debug'](_0x1893('0x15'),_0x348c96,_0x1893('0x14'),JSON[_0x1893('0x16')](_0x2bd919));if(_0x2bd919[_0x1893('0x17')]){if(_0x2bd919[_0x1893('0x17')][_0x1893('0x18')]===0x1f4){logger[_0x1893('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x348c96,_0x2bd919[_0x1893('0x17')][_0x1893('0x19')]);return _0x21e6e2(_0x2bd919[_0x1893('0x17')][_0x1893('0x19')]);}logger[_0x1893('0x17')](_0x1893('0x13'),_0x348c96,_0x2bd919[_0x1893('0x17')][_0x1893('0x19')]);return _0x5aef53(_0x2bd919[_0x1893('0x17')]['message']);}else{logger[_0x1893('0x1a')](_0x1893('0x13'),_0x348c96,_0x1893('0x14'));_0x5aef53(_0x2bd919[_0x1893('0x1b')]['message']);}})[_0x1893('0x1c')](function(_0x5cfc33){logger[_0x1893('0x17')](_0x1893('0x13'),_0x348c96,_0x5cfc33);_0x21e6e2(_0x5cfc33);});});}exports[_0x1893('0x1d')]=function(_0x1541bf){var _0x168bb6=this;return new Promise(function(_0x437fa2,_0x4a1b08){return db[_0x1893('0x1e')]['findAll']({'raw':_0x1541bf[_0x1893('0x1f')]?_0x1541bf[_0x1893('0x1f')][_0x1893('0x20')]===undefined?!![]:![]:!![],'where':_0x1541bf[_0x1893('0x1f')]?_0x1541bf[_0x1893('0x1f')][_0x1893('0x21')]||null:null,'attributes':[[db[_0x1893('0x22')]['fn'](_0x1893('0x23'),db['sequelize']['fn']('IF',db[_0x1893('0x22')][_0x1893('0x24')](_0x1893('0x25')))),_0x1893('0x26')]]})[_0x1893('0x12')](function(_0x36f59c){logger['info'](_0x1893('0x1d'),_0x1541bf);logger['debug'](_0x1893('0x1d'),_0x1541bf,JSON[_0x1893('0x16')](_0x36f59c));_0x437fa2(_0x36f59c);})[_0x1893('0x1c')](function(_0x580a4f){logger[_0x1893('0x17')](_0x1893('0x1d'),_0x580a4f[_0x1893('0x19')],_0x1541bf);_0x4a1b08(_0x168bb6['error'](0x1f4,_0x580a4f[_0x1893('0x19')]));});});}; \ No newline at end of file +var _0xd21a=['code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','raw','options','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1a40f2,_0x1a5fc9){var _0x3e5eee=function(_0x5c542b){while(--_0x5c542b){_0x1a40f2['push'](_0x1a40f2['shift']());}};_0x3e5eee(++_0x1a5fc9);}(_0xd21a,0xd2));var _0xad21=function(_0x442f5b,_0x39d79d){_0x442f5b=_0x442f5b-0x0;var _0x19fd96=_0xd21a[_0x442f5b];return _0x19fd96;};'use strict';var _=require(_0xad21('0x0'));var util=require(_0xad21('0x1'));var moment=require('moment');var BPromise=require(_0xad21('0x2'));var rs=require(_0xad21('0x3'));var fs=require('fs');var Redis=require(_0xad21('0x4'));var db=require(_0xad21('0x5'))['db'];var utils=require(_0xad21('0x6'));var logger=require(_0xad21('0x7'))(_0xad21('0x8'));var config=require(_0xad21('0x9'));var jayson=require(_0xad21('0xa'));var client=jayson[_0xad21('0xb')][_0xad21('0xc')]({'port':0x232a});config[_0xad21('0xd')]=_[_0xad21('0xe')](config[_0xad21('0xd')],{'host':_0xad21('0xf'),'port':0x18eb});var socket=require(_0xad21('0x10'))(new Redis(config[_0xad21('0xd')]));require(_0xad21('0x11'))[_0xad21('0x12')](socket);function respondWithRpcPromise(_0x518246,_0x51775f,_0x5f5be2){return new BPromise(function(_0x3b0be3,_0x54a07e){return client['request'](_0x518246,_0x5f5be2)['then'](function(_0x4a10e7){logger[_0xad21('0x13')](_0xad21('0x14'),_0x51775f,_0xad21('0x15'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x51775f,_0xad21('0x15'),JSON[_0xad21('0x16')](_0x4a10e7));if(_0x4a10e7[_0xad21('0x17')]){if(_0x4a10e7[_0xad21('0x17')][_0xad21('0x18')]===0x1f4){logger[_0xad21('0x17')](_0xad21('0x14'),_0x51775f,_0x4a10e7[_0xad21('0x17')][_0xad21('0x19')]);return _0x54a07e(_0x4a10e7[_0xad21('0x17')][_0xad21('0x19')]);}logger['error'](_0xad21('0x14'),_0x51775f,_0x4a10e7[_0xad21('0x17')][_0xad21('0x19')]);return _0x3b0be3(_0x4a10e7[_0xad21('0x17')]['message']);}else{logger[_0xad21('0x13')](_0xad21('0x14'),_0x51775f,_0xad21('0x15'));_0x3b0be3(_0x4a10e7[_0xad21('0x1a')][_0xad21('0x19')]);}})['catch'](function(_0x1e437d){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x51775f,_0x1e437d);_0x54a07e(_0x1e437d);});});}exports[_0xad21('0x1b')]=function(_0x53e552){var _0x2b5929=this;return new Promise(function(_0x3b92e8,_0xcb9e1){return db[_0xad21('0x1c')][_0xad21('0x1d')]({'raw':_0x53e552['options']?_0x53e552['options'][_0xad21('0x1e')]===undefined?!![]:![]:!![],'where':_0x53e552[_0xad21('0x1f')]?_0x53e552[_0xad21('0x1f')][_0xad21('0x20')]||null:null,'attributes':[[db[_0xad21('0x21')]['fn']('COUNT',db[_0xad21('0x21')]['fn']('IF',db[_0xad21('0x21')][_0xad21('0x22')](_0xad21('0x23')))),_0xad21('0x24')]]})['then'](function(_0x215f74){logger[_0xad21('0x13')](_0xad21('0x1b'),_0x53e552);logger[_0xad21('0x25')]('GetVoiceQueueRtPauses',_0x53e552,JSON[_0xad21('0x16')](_0x215f74));_0x3b92e8(_0x215f74);})[_0xad21('0x26')](function(_0xa7b1e2){logger[_0xad21('0x17')](_0xad21('0x1b'),_0xa7b1e2[_0xad21('0x19')],_0x53e552);_0xcb9e1(_0x2b5929['error'](0x1f4,_0xa7b1e2['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index a536c44..6997fee 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 _0x634c=['./userVoiceQueueRt.events','save','update','emit','register','userVoiceQueueRt:'];(function(_0x4ce0fd,_0x2deabc){var _0x38527e=function(_0x9ec110){while(--_0x9ec110){_0x4ce0fd['push'](_0x4ce0fd['shift']());}};_0x38527e(++_0x2deabc);}(_0x634c,0x72));var _0xc634=function(_0x3a9bd7,_0x1de4f1){_0x3a9bd7=_0x3a9bd7-0x0;var _0x4feb8f=_0x634c[_0x3a9bd7];return _0x4feb8f;};'use strict';var UserVoiceQueueRtEvents=require(_0xc634('0x0'));var events=[_0xc634('0x1'),'remove',_0xc634('0x2')];function createListener(_0x374ac7,_0x28640a){return function(_0x23502a){_0x28640a[_0xc634('0x3')](_0x374ac7,_0x23502a);};}function removeListener(_0x4280d2,_0x1f4e4d){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4280d2,_0x1f4e4d);};}exports[_0xc634('0x4')]=function(_0x36fa8f){for(var _0x4aa19f=0x0,_0x4a79e8=events['length'];_0x4aa19f<_0x4a79e8;_0x4aa19f++){var _0x2b3a47=events[_0x4aa19f];var _0x1e3d29=createListener(_0xc634('0x5')+_0x2b3a47,_0x36fa8f);UserVoiceQueueRtEvents['on'](_0x2b3a47,_0x1e3d29);}}; \ No newline at end of file +var _0x0aea=['userVoiceQueueRt:','save','remove','update','emit','removeListener'];(function(_0x5248d2,_0x1ab9b4){var _0x43164f=function(_0x5cfd0d){while(--_0x5cfd0d){_0x5248d2['push'](_0x5248d2['shift']());}};_0x43164f(++_0x1ab9b4);}(_0x0aea,0x139));var _0xa0ae=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x0aea[_0x3227c1];return _0x31fd48;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xa0ae('0x0'),_0xa0ae('0x1'),_0xa0ae('0x2')];function createListener(_0x41be76,_0x2e2685){return function(_0x3b73f2){_0x2e2685[_0xa0ae('0x3')](_0x41be76,_0x3b73f2);};}function removeListener(_0x574874,_0x48645e){return function(){UserVoiceQueueRtEvents[_0xa0ae('0x4')](_0x574874,_0x48645e);};}exports['register']=function(_0xe3043d){for(var _0x209bdb=0x0,_0x5cb655=events['length'];_0x209bdb<_0x5cb655;_0x209bdb++){var _0x5d4dcc=events[_0x209bdb];var _0x4cbbbb=createListener(_0xa0ae('0x5')+_0x5d4dcc,_0xe3043d);UserVoiceQueueRtEvents['on'](_0x5d4dcc,_0x4cbbbb);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index a7164ca..d00f3b6 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 _0xc927=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x52f9c4,_0x180957){var _0x4a6c07=function(_0x28873c){while(--_0x28873c){_0x52f9c4['push'](_0x52f9c4['shift']());}};_0x4a6c07(++_0x180957);}(_0xc927,0x1e9));var _0x7c92=function(_0x230d62,_0x456053){_0x230d62=_0x230d62-0x0;var _0x65f0c2=_0xc927[_0x230d62];return _0x65f0c2;};'use strict';var multer=require(_0x7c92('0x0'));var util=require('util');var path=require(_0x7c92('0x1'));var timeout=require(_0x7c92('0x2'));var express=require(_0x7c92('0x3'));var router=express['Router']();var auth=require(_0x7c92('0x4'));var interaction=require(_0x7c92('0x5'));var config=require(_0x7c92('0x6'));module[_0x7c92('0x7')]=router; \ No newline at end of file +var _0x16c4=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5b9259,_0x198473){var _0x5bbf28=function(_0x392f8e){while(--_0x392f8e){_0x5b9259['push'](_0x5b9259['shift']());}};_0x5bbf28(++_0x198473);}(_0x16c4,0x100));var _0x416c=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x16c4[_0x24061a];return _0x82054e;};'use strict';var multer=require(_0x416c('0x0'));var util=require(_0x416c('0x1'));var path=require(_0x416c('0x2'));var timeout=require(_0x416c('0x3'));var express=require(_0x416c('0x4'));var router=express['Router']();var auth=require(_0x416c('0x5'));var interaction=require(_0x416c('0x6'));var config=require('../../config/environment');module[_0x416c('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index a241b9b..f39433d 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 _0xbaf0=['exports','INTEGER'];(function(_0xcaf223,_0xd39f07){var _0x17e00d=function(_0xe2852e){while(--_0xe2852e){_0xcaf223['push'](_0xcaf223['shift']());}};_0x17e00d(++_0xd39f07);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x19ca80,_0x21f33b){var _0x28b954=function(_0x15091f){while(--_0x15091f){_0x19ca80['push'](_0x19ca80['shift']());}};_0x28b954(++_0x21f33b);}(_0xe706,0xa3));var _0x6e70=function(_0x362d6a,_0x253e0d){_0x362d6a=_0x362d6a-0x0;var _0x2af49e=_0xe706[_0x362d6a];return _0x2af49e;};'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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 9d49730..0e209ea 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 _0x58a4=['bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0x5097da,_0x4029c9){var _0x144590=function(_0x2e17f6){while(--_0x2e17f6){_0x5097da['push'](_0x5097da['shift']());}};_0x144590(++_0x4029c9);}(_0x58a4,0xbf));var _0x458a=function(_0x10cac9,_0x5a16fe){_0x10cac9=_0x10cac9-0x0;var _0x422a09=_0x58a4[_0x10cac9];return _0x422a09;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var logger=require(_0x458a('0x2'))(_0x458a('0x3'));var moment=require(_0x458a('0x4'));var BPromise=require(_0x458a('0x5'));var rp=require(_0x458a('0x6'));var fs=require('fs');var path=require(_0x458a('0x7'));var rimraf=require(_0x458a('0x8'));var config=require(_0x458a('0x9'));var attributes=require(_0x458a('0xa'));module[_0x458a('0xb')]=function(_0x2f5d44,_0x57de3c){return _0x2f5d44['define'](_0x458a('0xc'),attributes,{'tableName':_0x458a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7334=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x34fc32,_0x1b372f){var _0x567758=function(_0x54ca0f){while(--_0x54ca0f){_0x34fc32['push'](_0x34fc32['shift']());}};_0x567758(++_0x1b372f);}(_0x7334,0x184));var _0x4733=function(_0x561b8b,_0x17b1c3){_0x561b8b=_0x561b8b-0x0;var _0x44338d=_0x7334[_0x561b8b];return _0x44338d;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var logger=require(_0x4733('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4733('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4733('0x4'));var rimraf=require(_0x4733('0x5'));var config=require(_0x4733('0x6'));var attributes=require(_0x4733('0x7'));module[_0x4733('0x8')]=function(_0x449ead,_0x16d7cc){return _0x449ead[_0x4733('0x9')](_0x4733('0xa'),attributes,{'tableName':_0x4733('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 2767e36..0b15b10 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(_0x532d07,_0x3b77cd){var _0x38f97a=function(_0x3c80dc){while(--_0x3c80dc){_0x532d07['push'](_0x532d07['shift']());}};_0x38f97a(++_0x3b77cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x4d878a,_0x4360ab){var _0x35e95a=function(_0x50b785){while(--_0x50b785){_0x4d878a['push'](_0x4d878a['shift']());}};_0x35e95a(++_0x4360ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 1c84106..1af8db6 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 _0xdbb0=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','post','create','put','update'];(function(_0x369fd0,_0x1b4ea9){var _0x519b15=function(_0x42b84e){while(--_0x42b84e){_0x369fd0['push'](_0x369fd0['shift']());}};_0x519b15(++_0x1b4ea9);}(_0xdbb0,0x168));var _0x0dbb=function(_0x50767d,_0x1fa7d4){_0x50767d=_0x50767d-0x0;var _0x476fb5=_0xdbb0[_0x50767d];return _0x476fb5;};'use strict';var multer=require(_0x0dbb('0x0'));var util=require(_0x0dbb('0x1'));var path=require(_0x0dbb('0x2'));var timeout=require(_0x0dbb('0x3'));var express=require(_0x0dbb('0x4'));var router=express['Router']();var auth=require(_0x0dbb('0x5'));var interaction=require(_0x0dbb('0x6'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0x0dbb('0x7')]('/',auth[_0x0dbb('0x8')](),controller['index']);router[_0x0dbb('0x7')](_0x0dbb('0x9'),auth[_0x0dbb('0x8')](),controller['show']);router[_0x0dbb('0xa')]('/',auth[_0x0dbb('0x8')](),controller[_0x0dbb('0xb')]);router[_0x0dbb('0xc')](_0x0dbb('0x9'),auth[_0x0dbb('0x8')](),controller[_0x0dbb('0xd')]);router[_0x0dbb('0xe')](_0x0dbb('0x9'),auth[_0x0dbb('0x8')](),controller[_0x0dbb('0xf')]);module[_0x0dbb('0x10')]=router; \ No newline at end of file +var _0xfec0=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x56d7b3,_0x18b28c){var _0x366b54=function(_0x2513cf){while(--_0x2513cf){_0x56d7b3['push'](_0x56d7b3['shift']());}};_0x366b54(++_0x18b28c);}(_0xfec0,0x136));var _0x0fec=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xfec0[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x0fec('0x0'));var util=require(_0x0fec('0x1'));var path=require('path');var timeout=require(_0x0fec('0x2'));var express=require(_0x0fec('0x3'));var router=express[_0x0fec('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0fec('0x5'));var config=require('../../config/environment');var controller=require(_0x0fec('0x6'));router[_0x0fec('0x7')]('/',auth[_0x0fec('0x8')](),controller[_0x0fec('0x9')]);router['get'](_0x0fec('0xa'),auth[_0x0fec('0x8')](),controller[_0x0fec('0xb')]);router[_0x0fec('0xc')]('/',auth[_0x0fec('0x8')](),controller[_0x0fec('0xd')]);router[_0x0fec('0xe')](_0x0fec('0xa'),auth['isAuthenticated'](),controller[_0x0fec('0xf')]);router[_0x0fec('0x10')](_0x0fec('0xa'),auth[_0x0fec('0x8')](),controller[_0x0fec('0x11')]);module[_0x0fec('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index f221f00..6195be3 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 _0x00c1=['name','exports','STRING'];(function(_0x44d463,_0xb868e4){var _0x67f9fe=function(_0x38dfa1){while(--_0x38dfa1){_0x44d463['push'](_0x44d463['shift']());}};_0x67f9fe(++_0xb868e4);}(_0x00c1,0x199));var _0x100c=function(_0x13a972,_0x5a48be){_0x13a972=_0x13a972-0x0;var _0x250efc=_0x00c1[_0x13a972];return _0x250efc;};'use strict';var Sequelize=require('sequelize');module[_0x100c('0x0')]={'name':{'type':Sequelize[_0x100c('0x1')],'unique':_0x100c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x100c('0x1')]}}; \ No newline at end of file +var _0xf751=['STRING','sequelize'];(function(_0x58a8ce,_0x4c8e1f){var _0x1fff85=function(_0x578b7f){while(--_0x578b7f){_0x58a8ce['push'](_0x58a8ce['shift']());}};_0x1fff85(++_0x4c8e1f);}(_0xf751,0xc9));var _0x1f75=function(_0x32a6ff,_0x3d46f2){_0x32a6ff=_0x32a6ff-0x0;var _0x326df7=_0xf751[_0x32a6ff];return _0x326df7;};'use strict';var Sequelize=require(_0x1f75('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1f75('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 3bb9107..58fc0f6 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 _0xa295=['Content-Range','apply','save','update','destroy','get','Variables','UserProfileResource','then','error','stack','name','send','map','Variable','fieldName','type','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','find','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','end','json','count','offset','status','set'];(function(_0x1dd89b,_0x53ab93){var _0x1b1232=function(_0x506d4b){while(--_0x506d4b){_0x1dd89b['push'](_0x1dd89b['shift']());}};_0x1b1232(++_0x53ab93);}(_0xa295,0x179));var _0x5a29=function(_0x1583cf,_0x18a85d){_0x1583cf=_0x1583cf-0x0;var _0x2e69f=_0xa295[_0x1583cf];return _0x2e69f;};'use strict';var pdf=require(_0x5a29('0x0'));var emlformat=require(_0x5a29('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5a29('0x2'));var jsonpatch=require(_0x5a29('0x3'));var rp=require(_0x5a29('0x4'));var moment=require(_0x5a29('0x5'));var BPromise=require(_0x5a29('0x6'));var Mustache=require(_0x5a29('0x7'));var util=require(_0x5a29('0x8'));var path=require('path');var sox=require(_0x5a29('0x9'));var csv=require(_0x5a29('0xa'));var ejs=require(_0x5a29('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5a29('0xc'));var crypto=require(_0x5a29('0xd'));var jsforce=require(_0x5a29('0xe'));var deskjs=require(_0x5a29('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5a29('0x10'));var Papa=require(_0x5a29('0x11'));var Redis=require(_0x5a29('0x12'));var authService=require(_0x5a29('0x13'));var qs=require(_0x5a29('0x14'));var as=require(_0x5a29('0x15'));var hardwareService=require(_0x5a29('0x16'));var logger=require(_0x5a29('0x17'))('api');var utils=require(_0x5a29('0x18'));var config=require(_0x5a29('0x19'));var licenseUtil=require(_0x5a29('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39d465,_0x1b2566){_0x1b2566=_0x1b2566||0xcc;return function(_0x1a53be){if(_0x1a53be){return _0x39d465['sendStatus'](_0x1b2566);}return _0x39d465['status'](_0x1b2566)[_0x5a29('0x1b')]();};}function respondWithResult(_0x894c83,_0x1a8b82){_0x1a8b82=_0x1a8b82||0xc8;return function(_0x47cf92){if(_0x47cf92){return _0x894c83['status'](_0x1a8b82)[_0x5a29('0x1c')](_0x47cf92);}};}function respondWithFilteredResult(_0x132f70,_0x25d389){return function(_0x16c80d){if(_0x16c80d){var _0x5bce8c=_0x16c80d[_0x5a29('0x1d')],_0x4f8504=_0x25d389[_0x5a29('0x1e')],_0x150282=_0x25d389[_0x5a29('0x1e')]+_0x25d389['limit'],_0x23a07b;if(_0x150282>=_0x5bce8c){_0x150282=_0x5bce8c;_0x23a07b=0xc8;}else{_0x23a07b=0xce;}_0x132f70[_0x5a29('0x1f')](_0x23a07b);return _0x132f70[_0x5a29('0x20')](_0x5a29('0x21'),_0x4f8504+'-'+_0x150282+'/'+_0x5bce8c)[_0x5a29('0x1c')](_0x16c80d);}return null;};}function patchUpdates(_0x37039c){return function(_0x401811){try{jsonpatch[_0x5a29('0x22')](_0x401811,_0x37039c,!![]);}catch(_0x34661b){return BPromise['reject'](_0x34661b);}return _0x401811[_0x5a29('0x23')]();};}function saveUpdates(_0x2886f5,_0xd6ec01){return function(_0x19178d){if(_0x19178d){return _0x19178d[_0x5a29('0x24')](_0x2886f5)['then'](function(_0x227134){return _0x227134;});}return null;};}function removeEntity(_0xdcb9de,_0x397f47){return function(_0x120da1){if(_0x120da1){return _0x120da1[_0x5a29('0x25')]()['then'](function(){var _0x4852af=_0x120da1[_0x5a29('0x26')]({'plain':!![]});var _0x3484ba=_0x5a29('0x27');return db[_0x5a29('0x28')][_0x5a29('0x25')]({'where':{'type':_0x3484ba,'resourceId':_0x4852af['id']}})[_0x5a29('0x29')](function(){return _0x120da1;});})[_0x5a29('0x29')](function(){_0xdcb9de[_0x5a29('0x1f')](0xcc)[_0x5a29('0x1b')]();});}};}function handleEntityNotFound(_0x5b1a1b,_0x411eaf){return function(_0xf1870b){if(!_0xf1870b){_0x5b1a1b['sendStatus'](0x194);}return _0xf1870b;};}function handleError(_0x25f793,_0x2fd5df){_0x2fd5df=_0x2fd5df||0x1f4;return function(_0x2562c4){logger[_0x5a29('0x2a')](_0x2562c4[_0x5a29('0x2b')]);if(_0x2562c4[_0x5a29('0x2c')]){delete _0x2562c4[_0x5a29('0x2c')];}_0x25f793[_0x5a29('0x1f')](_0x2fd5df)[_0x5a29('0x2d')](_0x2562c4);};}exports['index']=function(_0x5d7263,_0x52d3bf){var _0x1c3fa2={},_0x83b235={},_0xe3f5de={'count':0x0,'rows':[]};var _0x168cf0=_[_0x5a29('0x2e')](db[_0x5a29('0x2f')]['rawAttributes'],function(_0x37cb11){return{'name':_0x37cb11[_0x5a29('0x30')],'type':_0x37cb11[_0x5a29('0x31')]['key']};});_0x83b235[_0x5a29('0x32')]=_[_0x5a29('0x2e')](_0x168cf0,_0x5a29('0x2c'));_0x83b235[_0x5a29('0x33')]=_['keys'](_0x5d7263['query']);_0x83b235['filters']=_['intersection'](_0x83b235['model'],_0x83b235['query']);_0x1c3fa2[_0x5a29('0x34')]=_[_0x5a29('0x35')](_0x83b235[_0x5a29('0x32')],qs[_0x5a29('0x36')](_0x5d7263[_0x5a29('0x33')][_0x5a29('0x36')]));_0x1c3fa2['attributes']=_0x1c3fa2[_0x5a29('0x34')]['length']?_0x1c3fa2[_0x5a29('0x34')]:_0x83b235['model'];if(!_0x5d7263[_0x5a29('0x33')][_0x5a29('0x37')](_0x5a29('0x38'))){_0x1c3fa2['limit']=qs[_0x5a29('0x39')](_0x5d7263['query'][_0x5a29('0x39')]);_0x1c3fa2[_0x5a29('0x1e')]=qs[_0x5a29('0x1e')](_0x5d7263[_0x5a29('0x33')]['offset']);}_0x1c3fa2['order']=qs['sort'](_0x5d7263[_0x5a29('0x33')][_0x5a29('0x3a')]);_0x1c3fa2[_0x5a29('0x3b')]=qs[_0x5a29('0x3c')](_[_0x5a29('0x3d')](_0x5d7263[_0x5a29('0x33')],_0x83b235[_0x5a29('0x3c')]),_0x168cf0);if(_0x5d7263[_0x5a29('0x33')][_0x5a29('0x3e')]){_0x1c3fa2[_0x5a29('0x3b')]=_['merge'](_0x1c3fa2[_0x5a29('0x3b')],{'$or':_[_0x5a29('0x2e')](_0x168cf0,function(_0x308c1e){if(_0x308c1e['type']!==_0x5a29('0x3f')){var _0x366964={};_0x366964[_0x308c1e['name']]={'$like':'%'+_0x5d7263[_0x5a29('0x33')][_0x5a29('0x3e')]+'%'};return _0x366964;}})});}_0x1c3fa2=_[_0x5a29('0x40')]({},_0x1c3fa2,_0x5d7263[_0x5a29('0x41')]);var _0xf0e66f={'where':_0x1c3fa2[_0x5a29('0x3b')]};return db['Variable'][_0x5a29('0x1d')](_0xf0e66f)['then'](function(_0x3c556d){_0xe3f5de['count']=_0x3c556d;if(_0x5d7263[_0x5a29('0x33')][_0x5a29('0x42')]){_0x1c3fa2[_0x5a29('0x43')]=[{'all':!![]}];}return db[_0x5a29('0x2f')][_0x5a29('0x44')](_0x1c3fa2);})[_0x5a29('0x29')](function(_0x17cb91){_0xe3f5de['rows']=_0x17cb91;return _0xe3f5de;})[_0x5a29('0x29')](respondWithFilteredResult(_0x52d3bf,_0x1c3fa2))[_0x5a29('0x45')](handleError(_0x52d3bf,null));};exports[_0x5a29('0x46')]=function(_0x5b4dd4,_0xd10e7){var _0x3d4d01={'raw':!![],'where':{'id':_0x5b4dd4[_0x5a29('0x47')]['id']}},_0x2e8048={};_0x2e8048[_0x5a29('0x32')]=_[_0x5a29('0x48')](db[_0x5a29('0x2f')][_0x5a29('0x49')]);_0x2e8048['query']=_['keys'](_0x5b4dd4['query']);_0x2e8048[_0x5a29('0x3c')]=_[_0x5a29('0x35')](_0x2e8048[_0x5a29('0x32')],_0x2e8048['query']);_0x3d4d01['attributes']=_[_0x5a29('0x35')](_0x2e8048[_0x5a29('0x32')],qs['fields'](_0x5b4dd4['query'][_0x5a29('0x36')]));_0x3d4d01[_0x5a29('0x34')]=_0x3d4d01[_0x5a29('0x34')][_0x5a29('0x4a')]?_0x3d4d01['attributes']:_0x2e8048['model'];if(_0x5b4dd4[_0x5a29('0x33')][_0x5a29('0x42')]){_0x3d4d01[_0x5a29('0x43')]=[{'all':!![]}];}_0x3d4d01=_['merge']({},_0x3d4d01,_0x5b4dd4[_0x5a29('0x41')]);return db[_0x5a29('0x2f')][_0x5a29('0x4b')](_0x3d4d01)[_0x5a29('0x29')](handleEntityNotFound(_0xd10e7,null))[_0x5a29('0x29')](respondWithResult(_0xd10e7,null))[_0x5a29('0x45')](handleError(_0xd10e7,null));};exports['create']=function(_0x5d810a,_0x3ed1f0){return db['Variable'][_0x5a29('0x4c')](_0x5d810a['body'],{})[_0x5a29('0x29')](function(_0x9b8432){var _0x328eb7=_0x5d810a[_0x5a29('0x4d')]['get']({'plain':!![]});if(!_0x328eb7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x328eb7[_0x5a29('0x4e')]===_0x5a29('0x4d')){var _0x4e1a8e=_0x9b8432[_0x5a29('0x26')]({'plain':!![]});var _0x3d24f8=_0x5a29('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x3d24f8,'userProfileId':_0x328eb7['userProfileId']},'raw':!![]})[_0x5a29('0x29')](function(_0x4b943a){if(_0x4b943a&&_0x4b943a[_0x5a29('0x4f')]===0x0){return db[_0x5a29('0x28')][_0x5a29('0x4c')]({'name':_0x4e1a8e[_0x5a29('0x2c')],'resourceId':_0x4e1a8e['id'],'type':_0x4b943a['name'],'sectionId':_0x4b943a['id']},{})['then'](function(){return _0x9b8432;});}else{return _0x9b8432;}})['catch'](function(_0x480432){logger[_0x5a29('0x2a')](_0x5a29('0x50'),_0x480432);throw _0x480432;});}return _0x9b8432;})[_0x5a29('0x29')](respondWithResult(_0x3ed1f0,0xc9))['catch'](handleError(_0x3ed1f0,null));};exports['update']=function(_0x5bd41b,_0x78b26f){if(_0x5bd41b[_0x5a29('0x51')]['id']){delete _0x5bd41b['body']['id'];}return db[_0x5a29('0x2f')][_0x5a29('0x4b')]({'where':{'id':_0x5bd41b['params']['id']}})[_0x5a29('0x29')](handleEntityNotFound(_0x78b26f,null))[_0x5a29('0x29')](saveUpdates(_0x5bd41b[_0x5a29('0x51')],null))[_0x5a29('0x29')](respondWithResult(_0x78b26f,null))[_0x5a29('0x45')](handleError(_0x78b26f,null));};exports['destroy']=function(_0xa8a9fb,_0x3adc24){return db[_0x5a29('0x2f')]['find']({'where':{'id':_0xa8a9fb[_0x5a29('0x47')]['id']}})[_0x5a29('0x29')](handleEntityNotFound(_0x3adc24,null))[_0x5a29('0x29')](removeEntity(_0x3adc24,null))[_0x5a29('0x45')](handleError(_0x3adc24,null));}; \ No newline at end of file +var _0x1165=['catch','show','params','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','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','path','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','Variable','count','includeAll','include','findAll','rows'];(function(_0x25ff4a,_0x423dd3){var _0x5a689b=function(_0x5b6f90){while(--_0x5b6f90){_0x25ff4a['push'](_0x25ff4a['shift']());}};_0x5a689b(++_0x423dd3);}(_0x1165,0xba));var _0x5116=function(_0x3c41bc,_0x45ae18){_0x3c41bc=_0x3c41bc-0x0;var _0x34a60c=_0x1165[_0x3c41bc];return _0x34a60c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5116('0x0'));var rimraf=require(_0x5116('0x1'));var zipdir=require(_0x5116('0x2'));var jsonpatch=require(_0x5116('0x3'));var rp=require(_0x5116('0x4'));var moment=require(_0x5116('0x5'));var BPromise=require(_0x5116('0x6'));var Mustache=require(_0x5116('0x7'));var util=require(_0x5116('0x8'));var path=require(_0x5116('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5116('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5116('0xb'));var crypto=require(_0x5116('0xc'));var jsforce=require(_0x5116('0xd'));var deskjs=require(_0x5116('0xe'));var toCsv=require(_0x5116('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5116('0x10'));var authService=require(_0x5116('0x11'));var qs=require(_0x5116('0x12'));var as=require(_0x5116('0x13'));var hardwareService=require(_0x5116('0x14'));var logger=require(_0x5116('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5116('0x16'));var licenseUtil=require(_0x5116('0x17'));var db=require(_0x5116('0x18'))['db'];function respondWithStatusCode(_0x2bcc61,_0x2746db){_0x2746db=_0x2746db||0xcc;return function(_0x1d2b79){if(_0x1d2b79){return _0x2bcc61[_0x5116('0x19')](_0x2746db);}return _0x2bcc61[_0x5116('0x1a')](_0x2746db)['end']();};}function respondWithResult(_0x5ad3b1,_0x8db42a){_0x8db42a=_0x8db42a||0xc8;return function(_0x4355ae){if(_0x4355ae){return _0x5ad3b1['status'](_0x8db42a)[_0x5116('0x1b')](_0x4355ae);}};}function respondWithFilteredResult(_0x5caa17,_0x436be8){return function(_0x3c801f){if(_0x3c801f){var _0x18762e=_0x3c801f['count'],_0xe04973=_0x436be8['offset'],_0x3b2937=_0x436be8[_0x5116('0x1c')]+_0x436be8[_0x5116('0x1d')],_0x301a4d;if(_0x3b2937>=_0x18762e){_0x3b2937=_0x18762e;_0x301a4d=0xc8;}else{_0x301a4d=0xce;}_0x5caa17[_0x5116('0x1a')](_0x301a4d);return _0x5caa17[_0x5116('0x1e')]('Content-Range',_0xe04973+'-'+_0x3b2937+'/'+_0x18762e)[_0x5116('0x1b')](_0x3c801f);}return null;};}function patchUpdates(_0xf7f186){return function(_0x3aaf57){try{jsonpatch[_0x5116('0x1f')](_0x3aaf57,_0xf7f186,!![]);}catch(_0x5de23c){return BPromise[_0x5116('0x20')](_0x5de23c);}return _0x3aaf57[_0x5116('0x21')]();};}function saveUpdates(_0x2a1437,_0x4b9dcd){return function(_0x3a1c82){if(_0x3a1c82){return _0x3a1c82[_0x5116('0x22')](_0x2a1437)[_0x5116('0x23')](function(_0x5a2f29){return _0x5a2f29;});}return null;};}function removeEntity(_0xa858d9,_0x1447f8){return function(_0x322d42){if(_0x322d42){return _0x322d42['destroy']()['then'](function(){var _0x3cd73e=_0x322d42[_0x5116('0x24')]({'plain':!![]});var _0x323c95=_0x5116('0x25');return db[_0x5116('0x26')][_0x5116('0x27')]({'where':{'type':_0x323c95,'resourceId':_0x3cd73e['id']}})['then'](function(){return _0x322d42;});})[_0x5116('0x23')](function(){_0xa858d9['status'](0xcc)[_0x5116('0x28')]();});}};}function handleEntityNotFound(_0x51885d,_0x4adbb0){return function(_0x2cb980){if(!_0x2cb980){_0x51885d['sendStatus'](0x194);}return _0x2cb980;};}function handleError(_0x3844be,_0x1ae709){_0x1ae709=_0x1ae709||0x1f4;return function(_0x108b5a){logger[_0x5116('0x29')](_0x108b5a[_0x5116('0x2a')]);if(_0x108b5a[_0x5116('0x2b')]){delete _0x108b5a[_0x5116('0x2b')];}_0x3844be['status'](_0x1ae709)[_0x5116('0x2c')](_0x108b5a);};}exports[_0x5116('0x2d')]=function(_0x269dc3,_0x54b695){var _0x19c704={},_0x5a4657={},_0x7858c6={'count':0x0,'rows':[]};var _0x54c5ff=_[_0x5116('0x2e')](db['Variable'][_0x5116('0x2f')],function(_0x19b667){return{'name':_0x19b667[_0x5116('0x30')],'type':_0x19b667[_0x5116('0x31')][_0x5116('0x32')]};});_0x5a4657[_0x5116('0x33')]=_[_0x5116('0x2e')](_0x54c5ff,_0x5116('0x2b'));_0x5a4657[_0x5116('0x34')]=_[_0x5116('0x35')](_0x269dc3[_0x5116('0x34')]);_0x5a4657['filters']=_['intersection'](_0x5a4657[_0x5116('0x33')],_0x5a4657[_0x5116('0x34')]);_0x19c704['attributes']=_[_0x5116('0x36')](_0x5a4657[_0x5116('0x33')],qs[_0x5116('0x37')](_0x269dc3['query'][_0x5116('0x37')]));_0x19c704['attributes']=_0x19c704[_0x5116('0x38')]['length']?_0x19c704['attributes']:_0x5a4657[_0x5116('0x33')];if(!_0x269dc3[_0x5116('0x34')][_0x5116('0x39')](_0x5116('0x3a'))){_0x19c704['limit']=qs[_0x5116('0x1d')](_0x269dc3[_0x5116('0x34')][_0x5116('0x1d')]);_0x19c704[_0x5116('0x1c')]=qs['offset'](_0x269dc3[_0x5116('0x34')][_0x5116('0x1c')]);}_0x19c704[_0x5116('0x3b')]=qs[_0x5116('0x3c')](_0x269dc3[_0x5116('0x34')]['sort']);_0x19c704[_0x5116('0x3d')]=qs['filters'](_['pick'](_0x269dc3[_0x5116('0x34')],_0x5a4657[_0x5116('0x3e')]),_0x54c5ff);if(_0x269dc3[_0x5116('0x34')][_0x5116('0x3f')]){_0x19c704[_0x5116('0x3d')]=_['merge'](_0x19c704[_0x5116('0x3d')],{'$or':_[_0x5116('0x2e')](_0x54c5ff,function(_0x3da814){if(_0x3da814[_0x5116('0x31')]!==_0x5116('0x40')){var _0x90d05f={};_0x90d05f[_0x3da814[_0x5116('0x2b')]]={'$like':'%'+_0x269dc3[_0x5116('0x34')]['filter']+'%'};return _0x90d05f;}})});}_0x19c704=_['merge']({},_0x19c704,_0x269dc3[_0x5116('0x41')]);var _0x5523ec={'where':_0x19c704['where']};return db[_0x5116('0x42')][_0x5116('0x43')](_0x5523ec)[_0x5116('0x23')](function(_0x4b15ff){_0x7858c6[_0x5116('0x43')]=_0x4b15ff;if(_0x269dc3[_0x5116('0x34')][_0x5116('0x44')]){_0x19c704[_0x5116('0x45')]=[{'all':!![]}];}return db[_0x5116('0x42')][_0x5116('0x46')](_0x19c704);})['then'](function(_0x4c3773){_0x7858c6[_0x5116('0x47')]=_0x4c3773;return _0x7858c6;})[_0x5116('0x23')](respondWithFilteredResult(_0x54b695,_0x19c704))[_0x5116('0x48')](handleError(_0x54b695,null));};exports[_0x5116('0x49')]=function(_0x481d6c,_0x1f5fd9){var _0xb3ba1e={'raw':!![],'where':{'id':_0x481d6c[_0x5116('0x4a')]['id']}},_0x52167f={};_0x52167f[_0x5116('0x33')]=_[_0x5116('0x35')](db[_0x5116('0x42')][_0x5116('0x2f')]);_0x52167f['query']=_[_0x5116('0x35')](_0x481d6c[_0x5116('0x34')]);_0x52167f[_0x5116('0x3e')]=_[_0x5116('0x36')](_0x52167f[_0x5116('0x33')],_0x52167f[_0x5116('0x34')]);_0xb3ba1e[_0x5116('0x38')]=_[_0x5116('0x36')](_0x52167f[_0x5116('0x33')],qs[_0x5116('0x37')](_0x481d6c[_0x5116('0x34')][_0x5116('0x37')]));_0xb3ba1e[_0x5116('0x38')]=_0xb3ba1e[_0x5116('0x38')][_0x5116('0x4b')]?_0xb3ba1e[_0x5116('0x38')]:_0x52167f[_0x5116('0x33')];if(_0x481d6c[_0x5116('0x34')][_0x5116('0x44')]){_0xb3ba1e[_0x5116('0x45')]=[{'all':!![]}];}_0xb3ba1e=_[_0x5116('0x4c')]({},_0xb3ba1e,_0x481d6c['options']);return db['Variable'][_0x5116('0x4d')](_0xb3ba1e)[_0x5116('0x23')](handleEntityNotFound(_0x1f5fd9,null))[_0x5116('0x23')](respondWithResult(_0x1f5fd9,null))[_0x5116('0x48')](handleError(_0x1f5fd9,null));};exports[_0x5116('0x4e')]=function(_0x2cfd48,_0x441fcf){return db[_0x5116('0x42')][_0x5116('0x4e')](_0x2cfd48[_0x5116('0x4f')],{})[_0x5116('0x23')](function(_0x313151){var _0x11f0f4=_0x2cfd48[_0x5116('0x50')][_0x5116('0x24')]({'plain':!![]});if(!_0x11f0f4)throw new Error(_0x5116('0x51'));if(_0x11f0f4[_0x5116('0x52')]==='user'){var _0x2650cd=_0x313151[_0x5116('0x24')]({'plain':!![]});var _0x1a667f=_0x5116('0x25');return db[_0x5116('0x53')][_0x5116('0x4d')]({'where':{'name':_0x1a667f,'userProfileId':_0x11f0f4['userProfileId']},'raw':!![]})[_0x5116('0x23')](function(_0x58b9b2){if(_0x58b9b2&&_0x58b9b2[_0x5116('0x54')]===0x0){return db[_0x5116('0x26')][_0x5116('0x4e')]({'name':_0x2650cd[_0x5116('0x2b')],'resourceId':_0x2650cd['id'],'type':_0x58b9b2[_0x5116('0x2b')],'sectionId':_0x58b9b2['id']},{})['then'](function(){return _0x313151;});}else{return _0x313151;}})[_0x5116('0x48')](function(_0x2b5ac6){logger[_0x5116('0x29')](_0x5116('0x55'),_0x2b5ac6);throw _0x2b5ac6;});}return _0x313151;})['then'](respondWithResult(_0x441fcf,0xc9))[_0x5116('0x48')](handleError(_0x441fcf,null));};exports[_0x5116('0x22')]=function(_0x3a34fe,_0xc70619){if(_0x3a34fe[_0x5116('0x4f')]['id']){delete _0x3a34fe[_0x5116('0x4f')]['id'];}return db[_0x5116('0x42')][_0x5116('0x4d')]({'where':{'id':_0x3a34fe['params']['id']}})[_0x5116('0x23')](handleEntityNotFound(_0xc70619,null))['then'](saveUpdates(_0x3a34fe[_0x5116('0x4f')],null))[_0x5116('0x23')](respondWithResult(_0xc70619,null))[_0x5116('0x48')](handleError(_0xc70619,null));};exports[_0x5116('0x27')]=function(_0x57b2bc,_0x3f8a8c){return db[_0x5116('0x42')][_0x5116('0x4d')]({'where':{'id':_0x57b2bc['params']['id']}})[_0x5116('0x23')](handleEntityNotFound(_0x3f8a8c,null))['then'](removeEntity(_0x3f8a8c,null))[_0x5116('0x48')](handleError(_0x3f8a8c,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 0f77e7d..473b205 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 _0xdd64=['tools_variables','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x5aeaa5,_0xa37654){var _0xae1de3=function(_0x22c4c2){while(--_0x22c4c2){_0x5aeaa5['push'](_0x5aeaa5['shift']());}};_0xae1de3(++_0xa37654);}(_0xdd64,0xd3));var _0x4dd6=function(_0xd6e4b3,_0x18fda7){_0xd6e4b3=_0xd6e4b3-0x0;var _0xcd20d3=_0xdd64[_0xd6e4b3];return _0xcd20d3;};'use strict';var _=require(_0x4dd6('0x0'));var util=require(_0x4dd6('0x1'));var logger=require(_0x4dd6('0x2'))(_0x4dd6('0x3'));var moment=require('moment');var BPromise=require(_0x4dd6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dd6('0x5'));var rimraf=require(_0x4dd6('0x6'));var config=require(_0x4dd6('0x7'));var attributes=require('./variable.attributes');module[_0x4dd6('0x8')]=function(_0x118ec2,_0x33f99d){return _0x118ec2['define']('Variable',attributes,{'tableName':_0x4dd6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0d9=['exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1f6079,_0x45631d){var _0x2dca33=function(_0x9641f1){while(--_0x9641f1){_0x1f6079['push'](_0x1f6079['shift']());}};_0x2dca33(++_0x45631d);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x18a18e,_0x72b31e){_0x18a18e=_0x18a18e-0x0;var _0x2241cb=_0xb0d9[_0x18a18e];return _0x2241cb;};'use strict';var _=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var logger=require(_0x9b0d('0x2'))(_0x9b0d('0x3'));var moment=require(_0x9b0d('0x4'));var BPromise=require(_0x9b0d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b0d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x9b0d('0x7')]=function(_0x3994a1,_0x584dde){return _0x3994a1[_0x9b0d('0x8')](_0x9b0d('0x9'),attributes,{'tableName':_0x9b0d('0xa'),'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 f0dd510..32fb301 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 _0x782e=['error','code','message','info','result','ShowVariable','Variable','find','options','raw','attributes','map','model','include','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x782e,0x194));var _0xe782=function(_0x4c4417,_0x1daa5e){_0x4c4417=_0x4c4417-0x0;var _0x814532=_0x782e[_0x4c4417];return _0x814532;};'use strict';var _=require('lodash');var util=require(_0xe782('0x0'));var moment=require(_0xe782('0x1'));var BPromise=require(_0xe782('0x2'));var rs=require(_0xe782('0x3'));var fs=require('fs');var Redis=require(_0xe782('0x4'));var db=require(_0xe782('0x5'))['db'];var utils=require(_0xe782('0x6'));var logger=require('../../config/logger')(_0xe782('0x7'));var config=require(_0xe782('0x8'));var jayson=require(_0xe782('0x9'));var client=jayson[_0xe782('0xa')][_0xe782('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37404f,_0x5d8de8,_0x27b3c8){return new BPromise(function(_0x58d5a4,_0x11bcfa){return client['request'](_0x37404f,_0x27b3c8)['then'](function(_0x12f5b5){logger['info'](_0xe782('0xc'),_0x5d8de8,_0xe782('0xd'));logger[_0xe782('0xe')](_0xe782('0xf'),_0x5d8de8,_0xe782('0xd'),JSON['stringify'](_0x12f5b5));if(_0x12f5b5[_0xe782('0x10')]){if(_0x12f5b5[_0xe782('0x10')][_0xe782('0x11')]===0x1f4){logger[_0xe782('0x10')](_0xe782('0xc'),_0x5d8de8,_0x12f5b5['error'][_0xe782('0x12')]);return _0x11bcfa(_0x12f5b5[_0xe782('0x10')][_0xe782('0x12')]);}logger[_0xe782('0x10')](_0xe782('0xc'),_0x5d8de8,_0x12f5b5['error'][_0xe782('0x12')]);return _0x58d5a4(_0x12f5b5['error']['message']);}else{logger[_0xe782('0x13')](_0xe782('0xc'),_0x5d8de8,_0xe782('0xd'));_0x58d5a4(_0x12f5b5[_0xe782('0x14')]['message']);}})['catch'](function(_0x43d25d){logger[_0xe782('0x10')](_0xe782('0xc'),_0x5d8de8,_0x43d25d);_0x11bcfa(_0x43d25d);});});}exports[_0xe782('0x15')]=function(_0x3b8348){var _0x1aaac8=this;return new Promise(function(_0x28808b,_0x5b0efa){return db[_0xe782('0x16')][_0xe782('0x17')]({'raw':_0x3b8348[_0xe782('0x18')]?_0x3b8348[_0xe782('0x18')][_0xe782('0x19')]===undefined?!![]:![]:!![],'where':_0x3b8348[_0xe782('0x18')]?_0x3b8348[_0xe782('0x18')]['where']||null:null,'attributes':_0x3b8348[_0xe782('0x18')]?_0x3b8348[_0xe782('0x18')][_0xe782('0x1a')]||null:null,'include':_0x3b8348[_0xe782('0x18')]?_0x3b8348['options']['include']?_[_0xe782('0x1b')](_0x3b8348[_0xe782('0x18')]['include'],function(_0xcfafa3){return{'model':db[_0xcfafa3['model']],'as':_0xcfafa3['as'],'attributes':_0xcfafa3[_0xe782('0x1a')],'include':_0xcfafa3['include']?_[_0xe782('0x1b')](_0xcfafa3['include'],function(_0x588b9c){return{'model':db[_0x588b9c[_0xe782('0x1c')]],'as':_0x588b9c['as'],'attributes':_0x588b9c[_0xe782('0x1a')],'include':_0x588b9c[_0xe782('0x1d')]?_[_0xe782('0x1b')](_0x588b9c[_0xe782('0x1d')],function(_0x461bc7){return{'model':db[_0x461bc7[_0xe782('0x1c')]],'as':_0x461bc7['as'],'attributes':_0x461bc7[_0xe782('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57d64a){logger['info'](_0xe782('0x15'),_0x3b8348);logger[_0xe782('0xe')](_0xe782('0x15'),_0x3b8348,JSON['stringify'](_0x57d64a));_0x28808b(_0x57d64a);})['catch'](function(_0x50b9b2){logger[_0xe782('0x10')](_0xe782('0x15'),_0x50b9b2[_0xe782('0x12')],_0x3b8348);_0x5b0efa(_0x1aaac8['error'](0x1f4,_0x50b9b2['message']));});});}; \ No newline at end of file +var _0x85cf=['options','where','attributes','include','map','model','ShowVariable','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','Variable'];(function(_0xaba8f8,_0x489b00){var _0x2770a4=function(_0x686760){while(--_0x686760){_0xaba8f8['push'](_0xaba8f8['shift']());}};_0x2770a4(++_0x489b00);}(_0x85cf,0x1e7));var _0xf85c=function(_0x19fe09,_0x47cc7c){_0x19fe09=_0x19fe09-0x0;var _0x514472=_0x85cf[_0x19fe09];return _0x514472;};'use strict';var _=require(_0xf85c('0x0'));var util=require(_0xf85c('0x1'));var moment=require(_0xf85c('0x2'));var BPromise=require(_0xf85c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf85c('0x4'));var db=require(_0xf85c('0x5'))['db'];var utils=require(_0xf85c('0x6'));var logger=require('../../config/logger')(_0xf85c('0x7'));var config=require('../../config/environment');var jayson=require(_0xf85c('0x8'));var client=jayson[_0xf85c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x532318,_0x2820da,_0x5b17f2){return new BPromise(function(_0x3aa4b1,_0x286cf1){return client['request'](_0x532318,_0x5b17f2)[_0xf85c('0xa')](function(_0x236262){logger[_0xf85c('0xb')]('Variable,\x20%s,\x20%s',_0x2820da,'request\x20sent');logger[_0xf85c('0xc')](_0xf85c('0xd'),_0x2820da,_0xf85c('0xe'),JSON[_0xf85c('0xf')](_0x236262));if(_0x236262[_0xf85c('0x10')]){if(_0x236262[_0xf85c('0x10')][_0xf85c('0x11')]===0x1f4){logger[_0xf85c('0x10')]('Variable,\x20%s,\x20%s',_0x2820da,_0x236262[_0xf85c('0x10')][_0xf85c('0x12')]);return _0x286cf1(_0x236262[_0xf85c('0x10')][_0xf85c('0x12')]);}logger[_0xf85c('0x10')]('Variable,\x20%s,\x20%s',_0x2820da,_0x236262['error'][_0xf85c('0x12')]);return _0x3aa4b1(_0x236262['error'][_0xf85c('0x12')]);}else{logger[_0xf85c('0xb')](_0xf85c('0x13'),_0x2820da,_0xf85c('0xe'));_0x3aa4b1(_0x236262[_0xf85c('0x14')][_0xf85c('0x12')]);}})[_0xf85c('0x15')](function(_0x38b65c){logger[_0xf85c('0x10')](_0xf85c('0x13'),_0x2820da,_0x38b65c);_0x286cf1(_0x38b65c);});});}exports['ShowVariable']=function(_0x156551){var _0x213eda=this;return new Promise(function(_0xccd2c4,_0x584ad0){return db[_0xf85c('0x16')]['find']({'raw':_0x156551['options']?_0x156551[_0xf85c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x156551[_0xf85c('0x17')]?_0x156551[_0xf85c('0x17')][_0xf85c('0x18')]||null:null,'attributes':_0x156551['options']?_0x156551[_0xf85c('0x17')][_0xf85c('0x19')]||null:null,'include':_0x156551[_0xf85c('0x17')]?_0x156551[_0xf85c('0x17')][_0xf85c('0x1a')]?_[_0xf85c('0x1b')](_0x156551[_0xf85c('0x17')]['include'],function(_0x1d39ca){return{'model':db[_0x1d39ca[_0xf85c('0x1c')]],'as':_0x1d39ca['as'],'attributes':_0x1d39ca[_0xf85c('0x19')],'include':_0x1d39ca[_0xf85c('0x1a')]?_[_0xf85c('0x1b')](_0x1d39ca['include'],function(_0xcd67f6){return{'model':db[_0xcd67f6[_0xf85c('0x1c')]],'as':_0xcd67f6['as'],'attributes':_0xcd67f6[_0xf85c('0x19')],'include':_0xcd67f6[_0xf85c('0x1a')]?_[_0xf85c('0x1b')](_0xcd67f6[_0xf85c('0x1a')],function(_0x4afe5d){return{'model':db[_0x4afe5d[_0xf85c('0x1c')]],'as':_0x4afe5d['as'],'attributes':_0x4afe5d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf85c('0xa')](function(_0x2f76de){logger['info'](_0xf85c('0x1d'),_0x156551);logger[_0xf85c('0xc')](_0xf85c('0x1d'),_0x156551,JSON[_0xf85c('0xf')](_0x2f76de));_0xccd2c4(_0x2f76de);})[_0xf85c('0x15')](function(_0x31ad74){logger[_0xf85c('0x10')](_0xf85c('0x1d'),_0x31ad74[_0xf85c('0x12')],_0x156551);_0x584ad0(_0x213eda[_0xf85c('0x10')](0x1f4,_0x31ad74[_0xf85c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 6f8e26e..54bd975 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 _0xcb16=['isAuthenticated','canUpdate','/reset','reset','/pull','pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0x55eddc,_0x5cd2cc){var _0x3aba8c=function(_0x145c6e){while(--_0x145c6e){_0x55eddc['push'](_0x55eddc['shift']());}};_0x3aba8c(++_0x5cd2cc);}(_0xcb16,0x109));var _0x6cb1=function(_0x580893,_0x1d32cc){_0x580893=_0x580893-0x0;var _0x399f34=_0xcb16[_0x580893];return _0x399f34;};'use strict';var express=require(_0x6cb1('0x0'));var router=express[_0x6cb1('0x1')]();var auth=require(_0x6cb1('0x2'));var controller=require(_0x6cb1('0x3'));router[_0x6cb1('0x4')]('/',controller[_0x6cb1('0x5')]);router[_0x6cb1('0x4')](_0x6cb1('0x6'),auth[_0x6cb1('0x7')](),auth[_0x6cb1('0x8')](),controller['fetch']);router['get'](_0x6cb1('0x9'),auth[_0x6cb1('0x7')](),auth[_0x6cb1('0x8')](),controller[_0x6cb1('0xa')]);router[_0x6cb1('0x4')](_0x6cb1('0xb'),auth[_0x6cb1('0x7')](),auth[_0x6cb1('0x8')](),controller[_0x6cb1('0xc')]);router[_0x6cb1('0x4')](_0x6cb1('0xd'),auth[_0x6cb1('0x7')](),controller[_0x6cb1('0xe')]);router[_0x6cb1('0x4')](_0x6cb1('0xf'),controller['migrations']);module[_0x6cb1('0x10')]=router; \ No newline at end of file +var _0xe51c=['fetch','/reset','canUpdate','reset','/pull','pull','/restart','/migrations','migrations','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated'];(function(_0x3177aa,_0xfb8803){var _0x269174=function(_0x458220){while(--_0x458220){_0x3177aa['push'](_0x3177aa['shift']());}};_0x269174(++_0xfb8803);}(_0xe51c,0x1bb));var _0xce51=function(_0x394b23,_0x36d244){_0x394b23=_0x394b23-0x0;var _0xccfc8b=_0xe51c[_0x394b23];return _0xccfc8b;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xce51('0x0'));var controller=require(_0xce51('0x1'));router[_0xce51('0x2')]('/',controller['index']);router[_0xce51('0x2')](_0xce51('0x3'),auth[_0xce51('0x4')](),auth['canUpdate'](),controller[_0xce51('0x5')]);router['get'](_0xce51('0x6'),auth[_0xce51('0x4')](),auth[_0xce51('0x7')](),controller[_0xce51('0x8')]);router['get'](_0xce51('0x9'),auth[_0xce51('0x4')](),auth[_0xce51('0x7')](),controller[_0xce51('0xa')]);router[_0xce51('0x2')](_0xce51('0xb'),auth[_0xce51('0x4')](),controller['restart']);router['get'](_0xce51('0xc'),controller[_0xce51('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 0e9ab83..2b01822 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 _0xd943=['../../config/environment','update','version','query','fetch','exports','latest','2.0.0','status','json','origin','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','server','migrations','length','replace','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb'];(function(_0x4e64d2,_0x1a2912){var _0x547f43=function(_0x3d70ae){while(--_0x3d70ae){_0x4e64d2['push'](_0x4e64d2['shift']());}};_0x547f43(++_0x1a2912);}(_0xd943,0x15d));var _0x3d94=function(_0x180a6a,_0x7feee2){_0x180a6a=_0x180a6a-0x0;var _0x4d893c=_0xd943[_0x180a6a];return _0x4d893c;};'use strict';var Umzug=require(_0x3d94('0x0'));var path=require(_0x3d94('0x1'));var fs=require('fs');var _=require(_0x3d94('0x2'));var pkginfo=require(_0x3d94('0x3'))(module,'version');var compareVersions=require(_0x3d94('0x4'));var exec=require(_0x3d94('0x5'))[_0x3d94('0x6')];var db=require(_0x3d94('0x7'))['db'];var config=require(_0x3d94('0x8'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x3d94('0x9'));var git=require('simple-git')(config['root']);exports['index']=function(_0x20f4d1,_0x35d36a){var _0x5244c3={'current':module['exports'][_0x3d94('0xa')],'phonebar':0x2};if(_0x20f4d1[_0x3d94('0xb')]&&_0x20f4d1[_0x3d94('0xb')]['latest']){return git[_0x3d94('0xc')]()['tags'](function(_0x39e2fa,_0x301536){_0x5244c3['latest']=(_0x39e2fa?module[_0x3d94('0xd')][_0x3d94('0xa')]:_0x301536[_0x3d94('0xe')])||_0x3d94('0xf');return _0x35d36a[_0x3d94('0x10')](0xc8)['json'](_0x5244c3);});}else{return _0x35d36a[_0x3d94('0x10')](0xc8)[_0x3d94('0x11')](_0x5244c3);}};exports[_0x3d94('0xc')]=function(_0x4c167c,_0x24e8b9){return git[_0x3d94('0xc')]([_0x3d94('0x12'),'master'],function(_0x14ea5f){if(_0x14ea5f){logger[_0x3d94('0x13')](_0x14ea5f);return _0x24e8b9[_0x3d94('0x10')](0x1f4)[_0x3d94('0x11')](_0x14ea5f);}logger[_0x3d94('0x14')](_0x3d94('0x15'));return _0x24e8b9[_0x3d94('0x10')](0xc8)[_0x3d94('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x3d94('0x16')]=function(_0x1a9315,_0x2acee3){return git[_0x3d94('0x16')]([_0x3d94('0x17'),_0x3d94('0x18')],function(_0xef8b3){if(_0xef8b3){logger['error'](_0xef8b3);return _0x2acee3[_0x3d94('0x10')](0x1f4)['json'](_0xef8b3);}logger[_0x3d94('0x14')](_0x3d94('0x19'));return _0x2acee3[_0x3d94('0x10')](0xc8)[_0x3d94('0x11')]({'output':_0x3d94('0x1a')});});};exports['pull']=function(_0x578002,_0x1406e9){exec(_0x3d94('0x1b'),function(_0x9c2f2c,_0x4edee4,_0x30af25){logger[_0x3d94('0x14')](_0x4edee4);logger[_0x3d94('0x14')](_0x30af25);if(_0x9c2f2c){logger[_0x3d94('0x13')](_0x9c2f2c);return _0x1406e9[_0x3d94('0x10')](0x1f4)[_0x3d94('0x11')](_0x9c2f2c);}return _0x1406e9[_0x3d94('0x10')](0xc8)[_0x3d94('0x11')]({'output':_0x4edee4});});};exports[_0x3d94('0x1c')]=function(_0x18f58c,_0x30368c){return pm2[_0x3d94('0x1c')](_0x3d94('0x1d'))[_0x3d94('0x1e')](function(_0x2945d2){logger['info'](_0x3d94('0x1f'),_0x2945d2);return _0x30368c['status'](0xc8)[_0x3d94('0x11')]({'output':_0x3d94('0x20')});})[_0x3d94('0x21')](function(_0x439173){logger[_0x3d94('0x13')](_0x439173);return _0x30368c[_0x3d94('0x10')](0x1f4)[_0x3d94('0x11')](_0x439173);});};exports['migrations']=function(_0x584c4a,_0x362642){var _0x4813e1=fs['readdirSync'](path[_0x3d94('0x22')](config['root'],_0x3d94('0x23'),_0x3d94('0x24')));var _0x32403a=[];for(var _0x4cef9c=0x0;_0x4cef9c<_0x4813e1[_0x3d94('0x25')];_0x4cef9c++){var _0x4c1237=_0x4813e1[_0x4cef9c][_0x3d94('0x26')]('.js','');if(compareVersions(module[_0x3d94('0xd')][_0x3d94('0xa')],_0x4c1237)===-0x1){_0x32403a[_0x3d94('0x27')](_0x4c1237);}}if(_0x32403a[_0x3d94('0x25')]){var _0x50560c=_0x32403a[_0x3d94('0x28')](compareVersions);var _0x51f634=new Umzug({'storage':_0x3d94('0x29'),'storageOptions':{'model':db[_0x3d94('0x2a')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0x3d94('0x29')][_0x3d94('0x2b')](),db[_0x3d94('0x29')]['constructor'],function(){throw new Error(_0x3d94('0x2c'));}],'path':path[_0x3d94('0x22')](config['root'],_0x3d94('0x23'),_0x3d94('0x24')),'pattern':/\.js$/}});_0x51f634['up']({'migrations':_[_0x3d94('0x2d')](_0x50560c,function(_0xbda334){return _0xbda334+_0x3d94('0x2e');})})['then'](function(){return _0x362642[_0x3d94('0x10')](0xc8)[_0x3d94('0x11')]({'output':_0x3d94('0x2f')+module[_0x3d94('0xd')][_0x3d94('0xa')]+_0x3d94('0x30')+_['last'](_0x50560c),'migrations':_['join'](_0x50560c)});})[_0x3d94('0x21')](function(_0x3e4d64){if(_0x3e4d64 instanceof db[_0x3d94('0x29')][_0x3d94('0x31')]){return _0x362642[_0x3d94('0x10')](0xc8)[_0x3d94('0x11')]({'output':_0x3d94('0x32')});}else{return _0x362642[_0x3d94('0x10')](0x1f4)[_0x3d94('0x11')](_0x3e4d64);}});}else{return _0x362642[_0x3d94('0x10')](0xc8)['json']({'output':_0x3d94('0x32')});}}; \ No newline at end of file +var _0x7b84=['compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','join','root','migrations','length','replace','push','Migration','sequelize','getQueryInterface','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','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version'];(function(_0x3890c7,_0x2ededb){var _0x538f38=function(_0x3c2574){while(--_0x3c2574){_0x3890c7['push'](_0x3890c7['shift']());}};_0x538f38(++_0x2ededb);}(_0x7b84,0x17c));var _0x47b8=function(_0x41bc06,_0xf5304e){_0x41bc06=_0x41bc06-0x0;var _0x1ce564=_0x7b84[_0x41bc06];return _0x1ce564;};'use strict';var Umzug=require(_0x47b8('0x0'));var path=require(_0x47b8('0x1'));var fs=require('fs');var _=require(_0x47b8('0x2'));var pkginfo=require(_0x47b8('0x3'))(module,_0x47b8('0x4'));var compareVersions=require(_0x47b8('0x5'));var exec=require(_0x47b8('0x6'))['exec'];var db=require(_0x47b8('0x7'))['db'];var config=require(_0x47b8('0x8'));var pm2=require(_0x47b8('0x9'));var logger=require(_0x47b8('0xa'))(_0x47b8('0xb'));var git=require(_0x47b8('0xc'))(config['root']);exports[_0x47b8('0xd')]=function(_0x3ce846,_0x46245a){var _0xb845c9={'current':module[_0x47b8('0xe')][_0x47b8('0x4')],'phonebar':0x2};if(_0x3ce846[_0x47b8('0xf')]&&_0x3ce846[_0x47b8('0xf')][_0x47b8('0x10')]){return git[_0x47b8('0x11')]()[_0x47b8('0x12')](function(_0x1a0a6a,_0x26a7b4){_0xb845c9[_0x47b8('0x10')]=(_0x1a0a6a?module[_0x47b8('0xe')][_0x47b8('0x4')]:_0x26a7b4[_0x47b8('0x10')])||_0x47b8('0x13');return _0x46245a[_0x47b8('0x14')](0xc8)[_0x47b8('0x15')](_0xb845c9);});}else{return _0x46245a[_0x47b8('0x14')](0xc8)[_0x47b8('0x15')](_0xb845c9);}};exports[_0x47b8('0x11')]=function(_0x268440,_0x173015){return git[_0x47b8('0x11')]([_0x47b8('0x16'),'master'],function(_0x1fe3b7){if(_0x1fe3b7){logger[_0x47b8('0x17')](_0x1fe3b7);return _0x173015[_0x47b8('0x14')](0x1f4)[_0x47b8('0x15')](_0x1fe3b7);}logger[_0x47b8('0x18')](_0x47b8('0x19'));return _0x173015[_0x47b8('0x14')](0xc8)['json']({'output':_0x47b8('0x1a')});});};exports['reset']=function(_0x525fd6,_0x4f7317){return git[_0x47b8('0x1b')]([_0x47b8('0x1c'),_0x47b8('0x1d')],function(_0x5b3e8e){if(_0x5b3e8e){logger['error'](_0x5b3e8e);return _0x4f7317['status'](0x1f4)[_0x47b8('0x15')](_0x5b3e8e);}logger['info'](_0x47b8('0x1e'));return _0x4f7317[_0x47b8('0x14')](0xc8)[_0x47b8('0x15')]({'output':_0x47b8('0x1f')});});};exports['pull']=function(_0xc20df1,_0x2d0205){exec(_0x47b8('0x20'),function(_0x2f75d2,_0x168cde,_0x232708){logger['info'](_0x168cde);logger[_0x47b8('0x18')](_0x232708);if(_0x2f75d2){logger[_0x47b8('0x17')](_0x2f75d2);return _0x2d0205['status'](0x1f4)[_0x47b8('0x15')](_0x2f75d2);}return _0x2d0205[_0x47b8('0x14')](0xc8)[_0x47b8('0x15')]({'output':_0x168cde});});};exports[_0x47b8('0x21')]=function(_0x5604c9,_0x35b327){return pm2[_0x47b8('0x21')](_0x47b8('0x22'))[_0x47b8('0x23')](function(_0x28499d){logger[_0x47b8('0x18')](_0x47b8('0x24'),_0x28499d);return _0x35b327['status'](0xc8)[_0x47b8('0x15')]({'output':_0x47b8('0x25')});})['catch'](function(_0x195a66){logger[_0x47b8('0x17')](_0x195a66);return _0x35b327[_0x47b8('0x14')](0x1f4)[_0x47b8('0x15')](_0x195a66);});};exports['migrations']=function(_0x162d96,_0x5c347f){var _0x2c89fc=fs[_0x47b8('0x26')](path[_0x47b8('0x27')](config[_0x47b8('0x28')],'server',_0x47b8('0x29')));var _0x264dd9=[];for(var _0x402e7c=0x0;_0x402e7c<_0x2c89fc[_0x47b8('0x2a')];_0x402e7c++){var _0x132f37=_0x2c89fc[_0x402e7c][_0x47b8('0x2b')]('.js','');if(compareVersions(module['exports']['version'],_0x132f37)===-0x1){_0x264dd9[_0x47b8('0x2c')](_0x132f37);}}if(_0x264dd9[_0x47b8('0x2a')]){var _0x2767ee=_0x264dd9['sort'](compareVersions);var _0x4d915e=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x47b8('0x2d'),'columnName':_0x47b8('0x4')},'migrations':{'params':[db[_0x47b8('0x2e')][_0x47b8('0x2f')](),db[_0x47b8('0x2e')][_0x47b8('0x30')],function(){throw new Error(_0x47b8('0x31'));}],'path':path[_0x47b8('0x27')](config[_0x47b8('0x28')],'server','migrations'),'pattern':/\.js$/}});_0x4d915e['up']({'migrations':_[_0x47b8('0x32')](_0x2767ee,function(_0x23a386){return _0x23a386+'.js';})})['then'](function(){return _0x5c347f[_0x47b8('0x14')](0xc8)[_0x47b8('0x15')]({'output':_0x47b8('0x33')+module['exports'][_0x47b8('0x4')]+_0x47b8('0x34')+_['last'](_0x2767ee),'migrations':_['join'](_0x2767ee)});})['catch'](function(_0x5133e1){if(_0x5133e1 instanceof db[_0x47b8('0x2e')][_0x47b8('0x35')]){return _0x5c347f[_0x47b8('0x14')](0xc8)[_0x47b8('0x15')]({'output':_0x47b8('0x36')});}else{return _0x5c347f[_0x47b8('0x14')](0x1f4)['json'](_0x5133e1);}});}else{return _0x5c347f['status'](0xc8)[_0x47b8('0x15')]({'output':_0x47b8('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index fe74859..4ae58f7 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 _0xc2e6=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/:id','post','delete','destroy','exports','multer'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0xc2e6,0xdc));var _0x6c2e=function(_0x33f6ff,_0x8f1ce){_0x33f6ff=_0x33f6ff-0x0;var _0x5ac2e6=_0xc2e6[_0x33f6ff];return _0x5ac2e6;};'use strict';var multer=require(_0x6c2e('0x0'));var util=require(_0x6c2e('0x1'));var path=require(_0x6c2e('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c2e('0x3'));var router=express[_0x6c2e('0x4')]();var auth=require(_0x6c2e('0x5'));var interaction=require(_0x6c2e('0x6'));var config=require(_0x6c2e('0x7'));var controller=require(_0x6c2e('0x8'));router[_0x6c2e('0x9')]('/',auth[_0x6c2e('0xa')](),controller[_0x6c2e('0xb')]);router[_0x6c2e('0x9')]('/describe',auth[_0x6c2e('0xa')](),controller['describe']);router[_0x6c2e('0x9')](_0x6c2e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6c2e('0xd')]('/',auth[_0x6c2e('0xa')](),controller['create']);router['put'](_0x6c2e('0xc'),auth[_0x6c2e('0xa')](),controller['update']);router[_0x6c2e('0xe')](_0x6c2e('0xc'),auth[_0x6c2e('0xa')](),controller[_0x6c2e('0xf')]);module[_0x6c2e('0x10')]=router; \ No newline at end of file +var _0xd5ac=['express','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x3ff332,_0x145564){var _0x5a2264=function(_0x36e730){while(--_0x36e730){_0x3ff332['push'](_0x3ff332['shift']());}};_0x5a2264(++_0x145564);}(_0xd5ac,0x19f));var _0xcd5a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd5ac[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xcd5a('0x0'));var util=require(_0xcd5a('0x1'));var path=require(_0xcd5a('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd5a('0x3'));var router=express[_0xcd5a('0x4')]();var auth=require(_0xcd5a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcd5a('0x6'));var controller=require(_0xcd5a('0x7'));router['get']('/',auth[_0xcd5a('0x8')](),controller[_0xcd5a('0x9')]);router['get'](_0xcd5a('0xa'),auth[_0xcd5a('0x8')](),controller[_0xcd5a('0xb')]);router['get'](_0xcd5a('0xc'),auth[_0xcd5a('0x8')](),controller['show']);router[_0xcd5a('0xd')]('/',auth['isAuthenticated'](),controller[_0xcd5a('0xe')]);router[_0xcd5a('0xf')](_0xcd5a('0xc'),auth[_0xcd5a('0x8')](),controller[_0xcd5a('0x10')]);router[_0xcd5a('0x11')]('/:id',auth[_0xcd5a('0x8')](),controller[_0xcd5a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 07d5255..848c91a 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 _0x2eb2=['exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2eb2,0x19f));var _0x22eb=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x2eb2[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'type':{'type':Sequelize[_0x22eb('0x1')]},'uniqueid':{'type':Sequelize[_0x22eb('0x1')]},'calleridnum':{'type':Sequelize[_0x22eb('0x1')]},'calleridname':{'type':Sequelize[_0x22eb('0x1')]},'queue':{'type':Sequelize[_0x22eb('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x22eb('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x22eb('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x22eb('0x2')]},'agentdumpAt':{'type':Sequelize[_0x22eb('0x2')]},'holdtime':{'type':Sequelize[_0x22eb('0x3')]},'agentcomplete':{'type':Sequelize[_0x22eb('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x22eb('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x22eb('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x22eb('0x3')]},'agentacw':{'type':Sequelize[_0x22eb('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x22eb('0x3')]},'reason':{'type':Sequelize[_0x22eb('0x1')]},'lastevent':{'type':Sequelize[_0x22eb('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x22eb('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x22eb('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x22eb('0x1')]},'context':{'type':Sequelize[_0x22eb('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x22eb('0x1')]},'destchannelstate':{'type':Sequelize[_0x22eb('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x22eb('0x1')]},'destcalleridnum':{'type':Sequelize[_0x22eb('0x1')]},'destcalleridname':{'type':Sequelize[_0x22eb('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x22eb('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x22eb('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x22eb('0x1')]},'destpriority':{'type':Sequelize[_0x22eb('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x22eb('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x22eb('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8d0e=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x3d8371,_0x2097f3){var _0x254c83=function(_0x159ad0){while(--_0x159ad0){_0x3d8371['push'](_0x3d8371['shift']());}};_0x254c83(++_0x2097f3);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2bd788,_0x4e47ee){_0x2bd788=_0x2bd788-0x0;var _0x5c6086=_0x8d0e[_0x2bd788];return _0x5c6086;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'type':{'type':Sequelize[_0xe8d0('0x2')]},'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'calleridnum':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'queue':{'type':Sequelize[_0xe8d0('0x2')]},'interface':{'type':Sequelize[_0xe8d0('0x2')]},'membername':{'type':Sequelize[_0xe8d0('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xe8d0('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xe8d0('0x3')]},'holdtime':{'type':Sequelize[_0xe8d0('0x4')]},'agentcomplete':{'type':Sequelize[_0xe8d0('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe8d0('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe8d0('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe8d0('0x4')]},'agentacw':{'type':Sequelize[_0xe8d0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe8d0('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xe8d0('0x2')]},'channel':{'type':Sequelize[_0xe8d0('0x2')]},'channelstate':{'type':Sequelize[_0xe8d0('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe8d0('0x2')]},'language':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize[_0xe8d0('0x2')]},'context':{'type':Sequelize[_0xe8d0('0x2')]},'exten':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe8d0('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xe8d0('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xe8d0('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xe8d0('0x2')]},'destaccountcode':{'type':Sequelize[_0xe8d0('0x2')]},'destcontext':{'type':Sequelize[_0xe8d0('0x2')]},'destexten':{'type':Sequelize[_0xe8d0('0x2')]},'destpriority':{'type':Sequelize[_0xe8d0('0x2')]},'destuniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xe8d0('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe8d0('0x2')],'comment':_0xe8d0('0x6')},'transferexten':{'type':Sequelize[_0xe8d0('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'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 3796657..b6cb6d9 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 _0x6c0f=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys','include','catch','create','body','params','html-pdf'];(function(_0x276c9b,_0x2a4bff){var _0x534224=function(_0x4cd6c3){while(--_0x4cd6c3){_0x276c9b['push'](_0x276c9b['shift']());}};_0x534224(++_0x2a4bff);}(_0x6c0f,0x113));var _0xf6c0=function(_0xe593fe,_0x587956){_0xe593fe=_0xe593fe-0x0;var _0x49fe42=_0x6c0f[_0xe593fe];return _0x49fe42;};'use strict';var pdf=require(_0xf6c0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf6c0('0x1'));var jsonpatch=require(_0xf6c0('0x2'));var rp=require(_0xf6c0('0x3'));var moment=require(_0xf6c0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf6c0('0x5'));var util=require(_0xf6c0('0x6'));var path=require(_0xf6c0('0x7'));var sox=require('sox');var csv=require(_0xf6c0('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf6c0('0x9'));var jsforce=require(_0xf6c0('0xa'));var deskjs=require(_0xf6c0('0xb'));var toCsv=require(_0xf6c0('0x8'));var querystring=require(_0xf6c0('0xc'));var Papa=require('papaparse');var Redis=require(_0xf6c0('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6c0('0xe'));var logger=require(_0xf6c0('0xf'))(_0xf6c0('0x10'));var utils=require('../../config/utils');var config=require(_0xf6c0('0x11'));var licenseUtil=require(_0xf6c0('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f0ab5,_0x242fd7){_0x242fd7=_0x242fd7||0xcc;return function(_0x571691){if(_0x571691){return _0x2f0ab5[_0xf6c0('0x13')](_0x242fd7);}return _0x2f0ab5[_0xf6c0('0x14')](_0x242fd7)[_0xf6c0('0x15')]();};}function respondWithResult(_0x2377ba,_0x572b8a){_0x572b8a=_0x572b8a||0xc8;return function(_0x24b953){if(_0x24b953){return _0x2377ba[_0xf6c0('0x14')](_0x572b8a)[_0xf6c0('0x16')](_0x24b953);}};}function respondWithFilteredResult(_0x391dd3,_0x8bbbde){return function(_0x138e02){if(_0x138e02){var _0x5341ee=_0x138e02[_0xf6c0('0x17')],_0x4da7d1=_0x8bbbde[_0xf6c0('0x18')],_0x128547=_0x8bbbde[_0xf6c0('0x18')]+_0x8bbbde[_0xf6c0('0x19')],_0x18f626;if(_0x128547>=_0x5341ee){_0x128547=_0x5341ee;_0x18f626=0xc8;}else{_0x18f626=0xce;}_0x391dd3[_0xf6c0('0x14')](_0x18f626);return _0x391dd3['set']('Content-Range',_0x4da7d1+'-'+_0x128547+'/'+_0x5341ee)['json'](_0x138e02);}return null;};}function patchUpdates(_0x242e04){return function(_0x2fe6be){try{jsonpatch[_0xf6c0('0x1a')](_0x2fe6be,_0x242e04,!![]);}catch(_0x495f7b){return BPromise[_0xf6c0('0x1b')](_0x495f7b);}return _0x2fe6be[_0xf6c0('0x1c')]();};}function saveUpdates(_0xfca0a6,_0x219870){return function(_0x364cbc){if(_0x364cbc){return _0x364cbc[_0xf6c0('0x1d')](_0xfca0a6)[_0xf6c0('0x1e')](function(_0xa4db45){return _0xa4db45;});}return null;};}function removeEntity(_0x358d0d,_0x61f4a){return function(_0x299790){if(_0x299790){return _0x299790[_0xf6c0('0x1f')]()[_0xf6c0('0x1e')](function(){_0x358d0d[_0xf6c0('0x14')](0xcc)[_0xf6c0('0x15')]();});}};}function handleEntityNotFound(_0x5f149d,_0x3d08a3){return function(_0x2e4c6b){if(!_0x2e4c6b){_0x5f149d[_0xf6c0('0x13')](0x194);}return _0x2e4c6b;};}function handleError(_0x2f3828,_0x1cf890){_0x1cf890=_0x1cf890||0x1f4;return function(_0x4c4925){logger[_0xf6c0('0x20')](_0x4c4925[_0xf6c0('0x21')]);if(_0x4c4925[_0xf6c0('0x22')]){delete _0x4c4925['name'];}_0x2f3828[_0xf6c0('0x14')](_0x1cf890)['send'](_0x4c4925);};}exports[_0xf6c0('0x23')]=function(_0x7e8ff,_0x4fd8cc){var _0x674537={},_0x205ffe={},_0x117e4d={'count':0x0,'rows':[]};var _0xbe3e31=_[_0xf6c0('0x24')](db[_0xf6c0('0x25')][_0xf6c0('0x26')],function(_0x29f93f){return{'name':_0x29f93f[_0xf6c0('0x27')],'type':_0x29f93f[_0xf6c0('0x28')][_0xf6c0('0x29')]};});_0x205ffe[_0xf6c0('0x2a')]=_[_0xf6c0('0x24')](_0xbe3e31,_0xf6c0('0x22'));_0x205ffe[_0xf6c0('0x2b')]=_['keys'](_0x7e8ff[_0xf6c0('0x2b')]);_0x205ffe[_0xf6c0('0x2c')]=_[_0xf6c0('0x2d')](_0x205ffe[_0xf6c0('0x2a')],_0x205ffe[_0xf6c0('0x2b')]);_0x674537['attributes']=_['intersection'](_0x205ffe[_0xf6c0('0x2a')],qs['fields'](_0x7e8ff['query'][_0xf6c0('0x2e')]));_0x674537[_0xf6c0('0x2f')]=_0x674537[_0xf6c0('0x2f')][_0xf6c0('0x30')]?_0x674537[_0xf6c0('0x2f')]:_0x205ffe[_0xf6c0('0x2a')];if(!_0x7e8ff['query'][_0xf6c0('0x31')](_0xf6c0('0x32'))){_0x674537[_0xf6c0('0x19')]=qs[_0xf6c0('0x19')](_0x7e8ff[_0xf6c0('0x2b')][_0xf6c0('0x19')]);_0x674537[_0xf6c0('0x18')]=qs[_0xf6c0('0x18')](_0x7e8ff[_0xf6c0('0x2b')][_0xf6c0('0x18')]);}_0x674537[_0xf6c0('0x33')]=qs[_0xf6c0('0x34')](_0x7e8ff[_0xf6c0('0x2b')][_0xf6c0('0x34')]);_0x674537[_0xf6c0('0x35')]=qs['filters'](_[_0xf6c0('0x36')](_0x7e8ff[_0xf6c0('0x2b')],_0x205ffe[_0xf6c0('0x2c')]),_0xbe3e31);if(_0x7e8ff[_0xf6c0('0x2b')][_0xf6c0('0x37')]){_0x674537[_0xf6c0('0x35')]=_[_0xf6c0('0x38')](_0x674537['where'],{'$or':_[_0xf6c0('0x24')](_0xbe3e31,function(_0x3cc0ae){if(_0x3cc0ae[_0xf6c0('0x28')]!==_0xf6c0('0x39')){var _0x56ea99={};_0x56ea99[_0x3cc0ae[_0xf6c0('0x22')]]={'$like':'%'+_0x7e8ff['query'][_0xf6c0('0x37')]+'%'};return _0x56ea99;}})});}_0x674537=_['merge']({},_0x674537,_0x7e8ff[_0xf6c0('0x3a')]);var _0x1175fb={'where':_0x674537[_0xf6c0('0x35')]};return db[_0xf6c0('0x25')][_0xf6c0('0x17')](_0x1175fb)[_0xf6c0('0x1e')](function(_0x21269a){_0x117e4d[_0xf6c0('0x17')]=_0x21269a;if(_0x7e8ff[_0xf6c0('0x2b')][_0xf6c0('0x3b')]){_0x674537['include']=[{'all':!![]}];}return db[_0xf6c0('0x25')][_0xf6c0('0x3c')](_0x674537);})[_0xf6c0('0x1e')](function(_0x26c51c){_0x117e4d[_0xf6c0('0x3d')]=_0x26c51c;return _0x117e4d;})[_0xf6c0('0x1e')](respondWithFilteredResult(_0x4fd8cc,_0x674537))['catch'](handleError(_0x4fd8cc,null));};exports[_0xf6c0('0x3e')]=function(_0xd565fe,_0x14bc01){var _0xcf8aa={'raw':![],'where':{'id':_0xd565fe['params']['id']}},_0x2319be={};_0x2319be[_0xf6c0('0x2a')]=_[_0xf6c0('0x3f')](db['VoiceAgentReport'][_0xf6c0('0x26')]);_0x2319be[_0xf6c0('0x2b')]=_['keys'](_0xd565fe['query']);_0x2319be[_0xf6c0('0x2c')]=_['intersection'](_0x2319be['model'],_0x2319be[_0xf6c0('0x2b')]);_0xcf8aa[_0xf6c0('0x2f')]=_[_0xf6c0('0x2d')](_0x2319be[_0xf6c0('0x2a')],qs[_0xf6c0('0x2e')](_0xd565fe[_0xf6c0('0x2b')]['fields']));_0xcf8aa[_0xf6c0('0x2f')]=_0xcf8aa['attributes'][_0xf6c0('0x30')]?_0xcf8aa[_0xf6c0('0x2f')]:_0x2319be[_0xf6c0('0x2a')];if(_0xd565fe[_0xf6c0('0x2b')][_0xf6c0('0x3b')]){_0xcf8aa[_0xf6c0('0x40')]=[{'all':!![]}];}_0xcf8aa=_['merge']({},_0xcf8aa,_0xd565fe[_0xf6c0('0x3a')]);return db['VoiceAgentReport']['find'](_0xcf8aa)[_0xf6c0('0x1e')](handleEntityNotFound(_0x14bc01,null))[_0xf6c0('0x1e')](respondWithResult(_0x14bc01,null))[_0xf6c0('0x41')](handleError(_0x14bc01,null));};exports[_0xf6c0('0x42')]=function(_0x1f6fbb,_0x38440f){return db[_0xf6c0('0x25')][_0xf6c0('0x42')](_0x1f6fbb[_0xf6c0('0x43')],{})[_0xf6c0('0x1e')](respondWithResult(_0x38440f,0xc9))['catch'](handleError(_0x38440f,null));};exports[_0xf6c0('0x1d')]=function(_0x44930b,_0x3067e2){if(_0x44930b['body']['id']){delete _0x44930b[_0xf6c0('0x43')]['id'];}return db[_0xf6c0('0x25')]['find']({'where':{'id':_0x44930b['params']['id']}})[_0xf6c0('0x1e')](handleEntityNotFound(_0x3067e2,null))[_0xf6c0('0x1e')](saveUpdates(_0x44930b[_0xf6c0('0x43')],null))[_0xf6c0('0x1e')](respondWithResult(_0x3067e2,null))[_0xf6c0('0x41')](handleError(_0x3067e2,null));};exports['destroy']=function(_0x349c32,_0x98120f){return db['VoiceAgentReport']['find']({'where':{'id':_0x349c32[_0xf6c0('0x44')]['id']}})[_0xf6c0('0x1e')](handleEntityNotFound(_0x98120f,null))[_0xf6c0('0x1e')](removeEntity(_0x98120f,null))[_0xf6c0('0x41')](handleError(_0x98120f,null));};exports['describe']=function(_0x16238e,_0x1bb5fb){return db[_0xf6c0('0x25')]['describe']()[_0xf6c0('0x1e')](respondWithResult(_0x1bb5fb,null))[_0xf6c0('0x41')](handleError(_0x1bb5fb,null));}; \ No newline at end of file +var _0xd42e=['type','VIRTUAL','merge','options','VoiceAgentReport','includeAll','include','show','keys','length','find','catch','create','body','update','params','describe','html-pdf','eml-format','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','attributes','intersection','model','fields','where','pick','filter'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xd42e,0x11d));var _0xed42=function(_0xc7348b,_0x145880){_0xc7348b=_0xc7348b-0x0;var _0x307cec=_0xd42e[_0xc7348b];return _0x307cec;};'use strict';var pdf=require(_0xed42('0x0'));var emlformat=require(_0xed42('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xed42('0x2'));var moment=require(_0xed42('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xed42('0x4'));var util=require('util');var path=require(_0xed42('0x5'));var sox=require(_0xed42('0x6'));var csv=require(_0xed42('0x7'));var ejs=require(_0xed42('0x8'));var fs=require('fs');var _=require(_0xed42('0x9'));var squel=require(_0xed42('0xa'));var crypto=require(_0xed42('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xed42('0x7'));var querystring=require('querystring');var Papa=require(_0xed42('0xc'));var Redis=require(_0xed42('0xd'));var authService=require(_0xed42('0xe'));var qs=require(_0xed42('0xf'));var as=require(_0xed42('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed42('0x11'))(_0xed42('0x12'));var utils=require(_0xed42('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xed42('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d509a,_0x3b8bdd){_0x3b8bdd=_0x3b8bdd||0xcc;return function(_0x264f58){if(_0x264f58){return _0x2d509a[_0xed42('0x15')](_0x3b8bdd);}return _0x2d509a[_0xed42('0x16')](_0x3b8bdd)[_0xed42('0x17')]();};}function respondWithResult(_0x1c28de,_0x334431){_0x334431=_0x334431||0xc8;return function(_0x3f7b4d){if(_0x3f7b4d){return _0x1c28de[_0xed42('0x16')](_0x334431)[_0xed42('0x18')](_0x3f7b4d);}};}function respondWithFilteredResult(_0x148b5a,_0x9b2733){return function(_0x4afb0e){if(_0x4afb0e){var _0x394946=_0x4afb0e[_0xed42('0x19')],_0x4dafb0=_0x9b2733[_0xed42('0x1a')],_0x112927=_0x9b2733['offset']+_0x9b2733[_0xed42('0x1b')],_0x3f9453;if(_0x112927>=_0x394946){_0x112927=_0x394946;_0x3f9453=0xc8;}else{_0x3f9453=0xce;}_0x148b5a['status'](_0x3f9453);return _0x148b5a['set'](_0xed42('0x1c'),_0x4dafb0+'-'+_0x112927+'/'+_0x394946)[_0xed42('0x18')](_0x4afb0e);}return null;};}function patchUpdates(_0xca4b57){return function(_0x4673ca){try{jsonpatch['apply'](_0x4673ca,_0xca4b57,!![]);}catch(_0xbecb00){return BPromise[_0xed42('0x1d')](_0xbecb00);}return _0x4673ca[_0xed42('0x1e')]();};}function saveUpdates(_0x19a62c,_0x559b83){return function(_0x81c1f8){if(_0x81c1f8){return _0x81c1f8['update'](_0x19a62c)[_0xed42('0x1f')](function(_0x506b73){return _0x506b73;});}return null;};}function removeEntity(_0x4c9977,_0x505ae3){return function(_0x4353e2){if(_0x4353e2){return _0x4353e2[_0xed42('0x20')]()['then'](function(){_0x4c9977['status'](0xcc)[_0xed42('0x17')]();});}};}function handleEntityNotFound(_0x2b6646,_0x50264a){return function(_0x1cc4c0){if(!_0x1cc4c0){_0x2b6646[_0xed42('0x15')](0x194);}return _0x1cc4c0;};}function handleError(_0x2e5b60,_0x52f0fb){_0x52f0fb=_0x52f0fb||0x1f4;return function(_0x569831){logger['error'](_0x569831[_0xed42('0x21')]);if(_0x569831[_0xed42('0x22')]){delete _0x569831[_0xed42('0x22')];}_0x2e5b60['status'](_0x52f0fb)[_0xed42('0x23')](_0x569831);};}exports[_0xed42('0x24')]=function(_0x3e66a2,_0x156978){var _0x5de9f4={},_0x5d2efa={},_0x8445a6={'count':0x0,'rows':[]};var _0x10d6e2=_[_0xed42('0x25')](db['VoiceAgentReport'][_0xed42('0x26')],function(_0x37f630){return{'name':_0x37f630[_0xed42('0x27')],'type':_0x37f630['type'][_0xed42('0x28')]};});_0x5d2efa['model']=_[_0xed42('0x25')](_0x10d6e2,_0xed42('0x22'));_0x5d2efa[_0xed42('0x29')]=_['keys'](_0x3e66a2[_0xed42('0x29')]);_0x5d2efa[_0xed42('0x2a')]=_['intersection'](_0x5d2efa['model'],_0x5d2efa[_0xed42('0x29')]);_0x5de9f4[_0xed42('0x2b')]=_[_0xed42('0x2c')](_0x5d2efa[_0xed42('0x2d')],qs[_0xed42('0x2e')](_0x3e66a2[_0xed42('0x29')][_0xed42('0x2e')]));_0x5de9f4[_0xed42('0x2b')]=_0x5de9f4[_0xed42('0x2b')]['length']?_0x5de9f4['attributes']:_0x5d2efa[_0xed42('0x2d')];if(!_0x3e66a2['query']['hasOwnProperty']('nolimit')){_0x5de9f4[_0xed42('0x1b')]=qs[_0xed42('0x1b')](_0x3e66a2[_0xed42('0x29')][_0xed42('0x1b')]);_0x5de9f4[_0xed42('0x1a')]=qs[_0xed42('0x1a')](_0x3e66a2[_0xed42('0x29')]['offset']);}_0x5de9f4['order']=qs['sort'](_0x3e66a2[_0xed42('0x29')]['sort']);_0x5de9f4[_0xed42('0x2f')]=qs['filters'](_[_0xed42('0x30')](_0x3e66a2['query'],_0x5d2efa[_0xed42('0x2a')]),_0x10d6e2);if(_0x3e66a2[_0xed42('0x29')][_0xed42('0x31')]){_0x5de9f4[_0xed42('0x2f')]=_['merge'](_0x5de9f4[_0xed42('0x2f')],{'$or':_['map'](_0x10d6e2,function(_0x9a8286){if(_0x9a8286[_0xed42('0x32')]!==_0xed42('0x33')){var _0x955557={};_0x955557[_0x9a8286[_0xed42('0x22')]]={'$like':'%'+_0x3e66a2[_0xed42('0x29')][_0xed42('0x31')]+'%'};return _0x955557;}})});}_0x5de9f4=_[_0xed42('0x34')]({},_0x5de9f4,_0x3e66a2[_0xed42('0x35')]);var _0x2f4ea0={'where':_0x5de9f4['where']};return db[_0xed42('0x36')][_0xed42('0x19')](_0x2f4ea0)[_0xed42('0x1f')](function(_0x333914){_0x8445a6[_0xed42('0x19')]=_0x333914;if(_0x3e66a2['query'][_0xed42('0x37')]){_0x5de9f4[_0xed42('0x38')]=[{'all':!![]}];}return db[_0xed42('0x36')]['findAll'](_0x5de9f4);})[_0xed42('0x1f')](function(_0x4a483f){_0x8445a6['rows']=_0x4a483f;return _0x8445a6;})[_0xed42('0x1f')](respondWithFilteredResult(_0x156978,_0x5de9f4))['catch'](handleError(_0x156978,null));};exports[_0xed42('0x39')]=function(_0x295c79,_0x50171b){var _0xcfe50={'raw':![],'where':{'id':_0x295c79['params']['id']}},_0x2e5d59={};_0x2e5d59[_0xed42('0x2d')]=_[_0xed42('0x3a')](db['VoiceAgentReport'][_0xed42('0x26')]);_0x2e5d59[_0xed42('0x29')]=_[_0xed42('0x3a')](_0x295c79[_0xed42('0x29')]);_0x2e5d59[_0xed42('0x2a')]=_['intersection'](_0x2e5d59[_0xed42('0x2d')],_0x2e5d59[_0xed42('0x29')]);_0xcfe50[_0xed42('0x2b')]=_[_0xed42('0x2c')](_0x2e5d59[_0xed42('0x2d')],qs['fields'](_0x295c79[_0xed42('0x29')][_0xed42('0x2e')]));_0xcfe50['attributes']=_0xcfe50[_0xed42('0x2b')][_0xed42('0x3b')]?_0xcfe50[_0xed42('0x2b')]:_0x2e5d59[_0xed42('0x2d')];if(_0x295c79['query'][_0xed42('0x37')]){_0xcfe50[_0xed42('0x38')]=[{'all':!![]}];}_0xcfe50=_['merge']({},_0xcfe50,_0x295c79[_0xed42('0x35')]);return db[_0xed42('0x36')][_0xed42('0x3c')](_0xcfe50)['then'](handleEntityNotFound(_0x50171b,null))['then'](respondWithResult(_0x50171b,null))[_0xed42('0x3d')](handleError(_0x50171b,null));};exports[_0xed42('0x3e')]=function(_0x109886,_0x2c696e){return db[_0xed42('0x36')]['create'](_0x109886[_0xed42('0x3f')],{})[_0xed42('0x1f')](respondWithResult(_0x2c696e,0xc9))['catch'](handleError(_0x2c696e,null));};exports[_0xed42('0x40')]=function(_0x3d5a4e,_0x2e6924){if(_0x3d5a4e[_0xed42('0x3f')]['id']){delete _0x3d5a4e[_0xed42('0x3f')]['id'];}return db['VoiceAgentReport'][_0xed42('0x3c')]({'where':{'id':_0x3d5a4e['params']['id']}})[_0xed42('0x1f')](handleEntityNotFound(_0x2e6924,null))[_0xed42('0x1f')](saveUpdates(_0x3d5a4e[_0xed42('0x3f')],null))['then'](respondWithResult(_0x2e6924,null))[_0xed42('0x3d')](handleError(_0x2e6924,null));};exports[_0xed42('0x20')]=function(_0x1d81f3,_0x530e36){return db[_0xed42('0x36')][_0xed42('0x3c')]({'where':{'id':_0x1d81f3[_0xed42('0x41')]['id']}})[_0xed42('0x1f')](handleEntityNotFound(_0x530e36,null))[_0xed42('0x1f')](removeEntity(_0x530e36,null))[_0xed42('0x3d')](handleError(_0x530e36,null));};exports['describe']=function(_0x8411e9,_0x3848ed){return db[_0xed42('0x36')][_0xed42('0x42')]()[_0xed42('0x1f')](respondWithResult(_0x3848ed,null))[_0xed42('0x3d')](handleError(_0x3848ed,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index f4326c0..12e7fcb 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 _0xc669=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','util','../../config/logger','api'];(function(_0x3f560e,_0x289aa8){var _0x5bf213=function(_0xcc2f71){while(--_0xcc2f71){_0x3f560e['push'](_0x3f560e['shift']());}};_0x5bf213(++_0x289aa8);}(_0xc669,0xcf));var _0x9c66=function(_0x5c6631,_0x4a31b7){_0x5c6631=_0x5c6631-0x0;var _0x2f9445=_0xc669[_0x5c6631];return _0x2f9445;};'use strict';var _=require('lodash');var util=require(_0x9c66('0x0'));var logger=require(_0x9c66('0x1'))(_0x9c66('0x2'));var moment=require(_0x9c66('0x3'));var BPromise=require(_0x9c66('0x4'));var rp=require(_0x9c66('0x5'));var fs=require('fs');var path=require(_0x9c66('0x6'));var rimraf=require(_0x9c66('0x7'));var config=require(_0x9c66('0x8'));var attributes=require(_0x9c66('0x9'));module[_0x9c66('0xa')]=function(_0xdfc2f4,_0x1cb8a3){return _0xdfc2f4[_0x9c66('0xb')](_0x9c66('0xc'),attributes,{'tableName':_0x9c66('0xd'),'paranoid':![],'indexes':[{'fields':[_0x9c66('0xe'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe899=['../../config/environment','./voiceAgentReport.attributes','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe899,0x1cc));var _0x9e89=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0xe899[_0x456b57];return _0x18f49f;};'use strict';var _=require(_0x9e89('0x0'));var util=require(_0x9e89('0x1'));var logger=require(_0x9e89('0x2'))(_0x9e89('0x3'));var moment=require(_0x9e89('0x4'));var BPromise=require(_0x9e89('0x5'));var rp=require(_0x9e89('0x6'));var fs=require('fs');var path=require(_0x9e89('0x7'));var rimraf=require('rimraf');var config=require(_0x9e89('0x8'));var attributes=require(_0x9e89('0x9'));module['exports']=function(_0x2da56b,_0x473fe9){return _0x2da56b['define']('VoiceAgentReport',attributes,{'tableName':_0x9e89('0xa'),'paranoid':![],'indexes':[{'fields':[_0x9e89('0xb'),_0x9e89('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 6ab1112..a7e0bda 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 _0x5bd7=['debug','stringify','code','error','message','info','result','catch','VoiceAgentReport','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','limit','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1e64cd,_0x35f441){var _0x2423ae=function(_0x24b8e3){while(--_0x24b8e3){_0x1e64cd['push'](_0x1e64cd['shift']());}};_0x2423ae(++_0x35f441);}(_0x5bd7,0x9c));var _0x75bd=function(_0x4080e5,_0x2e6a7a){_0x4080e5=_0x4080e5-0x0;var _0x1312c8=_0x5bd7[_0x4080e5];return _0x1312c8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x75bd('0x0'));var BPromise=require(_0x75bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x75bd('0x2'));var logger=require('../../config/logger')(_0x75bd('0x3'));var config=require(_0x75bd('0x4'));var jayson=require(_0x75bd('0x5'));var client=jayson[_0x75bd('0x6')][_0x75bd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x498a5e,_0x175981,_0x553844){return new BPromise(function(_0x26179d,_0xd61630){return client[_0x75bd('0x8')](_0x498a5e,_0x553844)[_0x75bd('0x9')](function(_0x3b7fc1){logger['info'](_0x75bd('0xa'),_0x175981,_0x75bd('0xb'));logger[_0x75bd('0xc')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x175981,_0x75bd('0xb'),JSON[_0x75bd('0xd')](_0x3b7fc1));if(_0x3b7fc1['error']){if(_0x3b7fc1['error'][_0x75bd('0xe')]===0x1f4){logger[_0x75bd('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x175981,_0x3b7fc1[_0x75bd('0xf')]['message']);return _0xd61630(_0x3b7fc1[_0x75bd('0xf')][_0x75bd('0x10')]);}logger[_0x75bd('0xf')](_0x75bd('0xa'),_0x175981,_0x3b7fc1['error']['message']);return _0x26179d(_0x3b7fc1['error'][_0x75bd('0x10')]);}else{logger[_0x75bd('0x11')](_0x75bd('0xa'),_0x175981,_0x75bd('0xb'));_0x26179d(_0x3b7fc1[_0x75bd('0x12')][_0x75bd('0x10')]);}})[_0x75bd('0x13')](function(_0x34b9fc){logger[_0x75bd('0xf')](_0x75bd('0xa'),_0x175981,_0x34b9fc);_0xd61630(_0x34b9fc);});});}exports['CreateVoiceAgentReport']=function(_0x562b92){var _0x4ba879=this;return new Promise(function(_0x45b54b,_0x3c0388){return db[_0x75bd('0x14')]['create'](_0x562b92[_0x75bd('0x15')],{'raw':_0x562b92[_0x75bd('0x16')]?_0x562b92['options']['raw']===undefined?!![]:![]:!![]})[_0x75bd('0x9')](function(_0x256138){logger[_0x75bd('0x11')](_0x75bd('0x17'),_0x562b92);logger['debug'](_0x75bd('0x17'),_0x562b92,JSON[_0x75bd('0xd')](_0x256138));_0x45b54b(_0x256138);})[_0x75bd('0x13')](function(_0x18056e){logger['error'](_0x75bd('0x17'),_0x18056e['message'],_0x562b92);_0x3c0388(_0x4ba879['error'](0x1f4,_0x18056e[_0x75bd('0x10')]));});});};exports[_0x75bd('0x18')]=function(_0x989996){var _0x1e81c6=this;return new Promise(function(_0x2cbe18,_0x58dd63){return db[_0x75bd('0x14')][_0x75bd('0x19')](_0x989996[_0x75bd('0x15')],{'raw':_0x989996['options']?_0x989996[_0x75bd('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x989996[_0x75bd('0x16')]?_0x989996['options'][_0x75bd('0x1a')]||null:null,'attributes':_0x989996['options']?_0x989996[_0x75bd('0x16')]['attributes']||null:null,'limit':_0x989996[_0x75bd('0x16')]?_0x989996[_0x75bd('0x16')][_0x75bd('0x1b')]||null:null})[_0x75bd('0x9')](function(_0x5761e0){logger['info'](_0x75bd('0x18'),_0x989996);logger[_0x75bd('0xc')](_0x75bd('0x18'),_0x989996,JSON['stringify'](_0x5761e0));_0x2cbe18(_0x5761e0);})['catch'](function(_0x798c8d){logger[_0x75bd('0xf')](_0x75bd('0x18'),_0x798c8d[_0x75bd('0x10')],_0x989996);_0x58dd63(_0x1e81c6['error'](0x1f4,_0x798c8d[_0x75bd('0x10')]));});});}; \ No newline at end of file +var _0x1899=['error','code','message','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','catch','update','where','attributes','limit','then','UpdateVoiceAgentReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x26dd81,_0x2f6ce7){var _0x34b345=function(_0x11527c){while(--_0x11527c){_0x26dd81['push'](_0x26dd81['shift']());}};_0x34b345(++_0x2f6ce7);}(_0x1899,0x95));var _0x9189=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x1899[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x9189('0x0'));var util=require(_0x9189('0x1'));var moment=require(_0x9189('0x2'));var BPromise=require(_0x9189('0x3'));var rs=require(_0x9189('0x4'));var fs=require('fs');var Redis=require(_0x9189('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9189('0x6'));var logger=require(_0x9189('0x7'))(_0x9189('0x8'));var config=require('../../config/environment');var jayson=require(_0x9189('0x9'));var client=jayson[_0x9189('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24d25e,_0x9a436,_0x4cad9e){return new BPromise(function(_0x364ce0,_0x1fa03c){return client[_0x9189('0xb')](_0x24d25e,_0x4cad9e)['then'](function(_0x19ac4b){logger[_0x9189('0xc')](_0x9189('0xd'),_0x9a436,_0x9189('0xe'));logger[_0x9189('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x9a436,_0x9189('0xe'),JSON['stringify'](_0x19ac4b));if(_0x19ac4b[_0x9189('0x10')]){if(_0x19ac4b['error'][_0x9189('0x11')]===0x1f4){logger['error'](_0x9189('0xd'),_0x9a436,_0x19ac4b[_0x9189('0x10')][_0x9189('0x12')]);return _0x1fa03c(_0x19ac4b['error'][_0x9189('0x12')]);}logger[_0x9189('0x10')](_0x9189('0xd'),_0x9a436,_0x19ac4b[_0x9189('0x10')]['message']);return _0x364ce0(_0x19ac4b[_0x9189('0x10')]['message']);}else{logger[_0x9189('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x9a436,_0x9189('0xe'));_0x364ce0(_0x19ac4b['result'][_0x9189('0x12')]);}})['catch'](function(_0x2c3969){logger[_0x9189('0x10')](_0x9189('0xd'),_0x9a436,_0x2c3969);_0x1fa03c(_0x2c3969);});});}exports['CreateVoiceAgentReport']=function(_0x31393d){var _0x45c0cd=this;return new Promise(function(_0x5a259d,_0x4f3231){return db[_0x9189('0x13')][_0x9189('0x14')](_0x31393d[_0x9189('0x15')],{'raw':_0x31393d[_0x9189('0x16')]?_0x31393d['options'][_0x9189('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x245f9c){logger[_0x9189('0xc')](_0x9189('0x18'),_0x31393d);logger[_0x9189('0xf')](_0x9189('0x18'),_0x31393d,JSON['stringify'](_0x245f9c));_0x5a259d(_0x245f9c);})[_0x9189('0x19')](function(_0x5e39a1){logger[_0x9189('0x10')](_0x9189('0x18'),_0x5e39a1[_0x9189('0x12')],_0x31393d);_0x4f3231(_0x45c0cd[_0x9189('0x10')](0x1f4,_0x5e39a1[_0x9189('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x226183){var _0x4db5ed=this;return new Promise(function(_0x3330b8,_0x3dd46d){return db[_0x9189('0x13')][_0x9189('0x1a')](_0x226183[_0x9189('0x15')],{'raw':_0x226183[_0x9189('0x16')]?_0x226183[_0x9189('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x226183[_0x9189('0x16')]?_0x226183[_0x9189('0x16')][_0x9189('0x1b')]||null:null,'attributes':_0x226183['options']?_0x226183[_0x9189('0x16')][_0x9189('0x1c')]||null:null,'limit':_0x226183[_0x9189('0x16')]?_0x226183[_0x9189('0x16')][_0x9189('0x1d')]||null:null})[_0x9189('0x1e')](function(_0x38b03a){logger[_0x9189('0xc')](_0x9189('0x1f'),_0x226183);logger[_0x9189('0xf')](_0x9189('0x1f'),_0x226183,JSON[_0x9189('0x20')](_0x38b03a));_0x3330b8(_0x38b03a);})[_0x9189('0x19')](function(_0x433e42){logger[_0x9189('0x10')](_0x9189('0x1f'),_0x433e42[_0x9189('0x12')],_0x226183);_0x3dd46d(_0x4db5ed[_0x9189('0x10')](0x1f4,_0x433e42['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 9078333..e1bd056 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 _0xa00c=['destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x58e408,_0x246451){var _0x119dfb=function(_0x1bca7b){while(--_0x1bca7b){_0x58e408['push'](_0x58e408['shift']());}};_0x119dfb(++_0x246451);}(_0xa00c,0x127));var _0xca00=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xa00c[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xca00('0x0'));var timeout=require(_0xca00('0x1'));var express=require(_0xca00('0x2'));var router=express[_0xca00('0x3')]();var auth=require(_0xca00('0x4'));var interaction=require(_0xca00('0x5'));var config=require(_0xca00('0x6'));var controller=require(_0xca00('0x7'));router[_0xca00('0x8')]('/',auth[_0xca00('0x9')](),controller[_0xca00('0xa')]);router[_0xca00('0x8')](_0xca00('0xb'),auth[_0xca00('0x9')](),controller[_0xca00('0xc')]);router[_0xca00('0x8')](_0xca00('0xd'),auth[_0xca00('0x9')](),controller[_0xca00('0xe')]);router[_0xca00('0xf')]('/',auth[_0xca00('0x9')](),controller[_0xca00('0x10')]);router[_0xca00('0x11')]('/:id',auth[_0xca00('0x9')](),controller[_0xca00('0x12')]);router[_0xca00('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xca00('0x14')]);module['exports']=router; \ No newline at end of file +var _0x23ed=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','destroy','multer','path','connect-timeout','express'];(function(_0x244862,_0x3da79e){var _0x2bce23=function(_0x235ae5){while(--_0x235ae5){_0x244862['push'](_0x244862['shift']());}};_0x2bce23(++_0x3da79e);}(_0x23ed,0x9e));var _0xd23e=function(_0xcdd3dd,_0x39f009){_0xcdd3dd=_0xcdd3dd-0x0;var _0x5d9394=_0x23ed[_0xcdd3dd];return _0x5d9394;};'use strict';var multer=require(_0xd23e('0x0'));var util=require('util');var path=require(_0xd23e('0x1'));var timeout=require(_0xd23e('0x2'));var express=require(_0xd23e('0x3'));var router=express[_0xd23e('0x4')]();var auth=require(_0xd23e('0x5'));var interaction=require(_0xd23e('0x6'));var config=require(_0xd23e('0x7'));var controller=require('./voiceCallReport.controller');router[_0xd23e('0x8')]('/',auth[_0xd23e('0x9')](),controller[_0xd23e('0xa')]);router[_0xd23e('0x8')](_0xd23e('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd23e('0x8')](_0xd23e('0xc'),auth[_0xd23e('0x9')](),controller[_0xd23e('0xd')]);router['post']('/',auth[_0xd23e('0x9')](),controller[_0xd23e('0xe')]);router[_0xd23e('0xf')](_0xd23e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd23e('0x10')](_0xd23e('0xc'),auth['isAuthenticated'](),controller[_0xd23e('0x11')]);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 2b5ecea..4d62ef3 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 _0x2675=['inbound-fax','outbound-fax','STRING','DATE','INTEGER','sequelize','inbound','internal'];(function(_0x46c8fb,_0x253501){var _0x48f9eb=function(_0x5d5b03){while(--_0x5d5b03){_0x46c8fb['push'](_0x46c8fb['shift']());}};_0x48f9eb(++_0x253501);}(_0x2675,0x75));var _0x5267=function(_0x4a215f,_0x5f4e2b){_0x4a215f=_0x4a215f-0x0;var _0x410319=_0x2675[_0x4a215f];return _0x410319;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x5267('0x1'),_0x5267('0x2'),'outbound',_0x5267('0x3'),_0x5267('0x4'),'dialer')},'tag':{'type':Sequelize[_0x5267('0x5')]},'accountcode':{'type':Sequelize[_0x5267('0x5')]},'source':{'type':Sequelize[_0x5267('0x5')]},'destination':{'type':Sequelize[_0x5267('0x5')]},'destinationcontext':{'type':Sequelize[_0x5267('0x5')]},'callerid':{'type':Sequelize[_0x5267('0x5')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x5267('0x5')]},'lastapplication':{'type':Sequelize[_0x5267('0x5')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x5267('0x6')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x5267('0x6')]},'endtime':{'type':Sequelize[_0x5267('0x6')]},'duration':{'type':Sequelize[_0x5267('0x7')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x5267('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x5267('0x5')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x5267('0x5')]},'userSecondDisposition':{'type':Sequelize[_0x5267('0x5')]},'userThirdDisposition':{'type':Sequelize[_0x5267('0x5')]},'note':{'type':Sequelize[_0x5267('0x5')]},'prefix':{'type':Sequelize[_0x5267('0x5')]},'routeid':{'type':Sequelize[_0x5267('0x7')]},'sipcallid':{'type':Sequelize[_0x5267('0x5')]}}; \ No newline at end of file +var _0x24ca=['sequelize','ENUM','internal','outbound','inbound-fax','dialer','STRING','TEXT','DATE','INTEGER'];(function(_0xc2ba6e,_0x1df020){var _0x849f1c=function(_0xc9ac5d){while(--_0xc9ac5d){_0xc2ba6e['push'](_0xc2ba6e['shift']());}};_0x849f1c(++_0x1df020);}(_0x24ca,0x8c));var _0xa24c=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0x24ca[_0x1ebeea];return _0x576465;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa24c('0x1')]('inbound',_0xa24c('0x2'),_0xa24c('0x3'),_0xa24c('0x4'),'outbound-fax',_0xa24c('0x5'))},'tag':{'type':Sequelize[_0xa24c('0x6')]},'accountcode':{'type':Sequelize[_0xa24c('0x6')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa24c('0x6')]},'channel':{'type':Sequelize[_0xa24c('0x6')]},'destinationchannel':{'type':Sequelize[_0xa24c('0x6')]},'lastapplication':{'type':Sequelize[_0xa24c('0x6')]},'lastdata':{'type':Sequelize[_0xa24c('0x7')]},'starttime':{'type':Sequelize[_0xa24c('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa24c('0x8')]},'endtime':{'type':Sequelize[_0xa24c('0x8')]},'duration':{'type':Sequelize[_0xa24c('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa24c('0x6')]},'amaflags':{'type':Sequelize[_0xa24c('0x6')]},'userfield':{'type':Sequelize[_0xa24c('0x6')]},'userDisposition':{'type':Sequelize[_0xa24c('0x6')]},'userSecondDisposition':{'type':Sequelize[_0xa24c('0x6')]},'userThirdDisposition':{'type':Sequelize[_0xa24c('0x6')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xa24c('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 92973f2..3f8c3ee 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 e455ba0..7bb74b8 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 _0x3a8c=['define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x9c250e,_0x5bdb1a){var _0x35fc0=function(_0x25b102){while(--_0x25b102){_0x9c250e['push'](_0x9c250e['shift']());}};_0x35fc0(++_0x5bdb1a);}(_0x3a8c,0x18a));var _0xc3a8=function(_0x10da50,_0x204f60){_0x10da50=_0x10da50-0x0;var _0x499a36=_0x3a8c[_0x10da50];return _0x499a36;};'use strict';var _=require(_0xc3a8('0x0'));var util=require(_0xc3a8('0x1'));var logger=require(_0xc3a8('0x2'))(_0xc3a8('0x3'));var moment=require('moment');var BPromise=require(_0xc3a8('0x4'));var rp=require(_0xc3a8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3a8('0x6'));var config=require(_0xc3a8('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0xc3a8('0x8')]=function(_0x37acb1,_0x234d15){return _0x37acb1[_0xc3a8('0x9')](_0xc3a8('0xa'),attributes,{'tableName':_0xc3a8('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc3a8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x52df=['path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x26cbdc,_0x381cbb){var _0x404b7b=function(_0x3a0656){while(--_0x3a0656){_0x26cbdc['push'](_0x26cbdc['shift']());}};_0x404b7b(++_0x381cbb);}(_0x52df,0x189));var _0xf52d=function(_0x1beae1,_0x1981ac){_0x1beae1=_0x1beae1-0x0;var _0x99ab21=_0x52df[_0x1beae1];return _0x99ab21;};'use strict';var _=require(_0xf52d('0x0'));var util=require(_0xf52d('0x1'));var logger=require(_0xf52d('0x2'))(_0xf52d('0x3'));var moment=require(_0xf52d('0x4'));var BPromise=require(_0xf52d('0x5'));var rp=require(_0xf52d('0x6'));var fs=require('fs');var path=require(_0xf52d('0x7'));var rimraf=require(_0xf52d('0x8'));var config=require(_0xf52d('0x9'));var attributes=require(_0xf52d('0xa'));module[_0xf52d('0xb')]=function(_0x1bbbc6,_0x46b6b7){return _0x1bbbc6[_0xf52d('0xc')](_0xf52d('0xd'),attributes,{'tableName':_0xf52d('0xe'),'paranoid':![],'indexes':[{'fields':[_0xf52d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 56ccc12..3ea2d78 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 _0xda12=['client','http','then','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','catch','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b2d57,_0x4fccb7){var _0x5d46dd=function(_0x43616b){while(--_0x43616b){_0x1b2d57['push'](_0x1b2d57['shift']());}};_0x5d46dd(++_0x4fccb7);}(_0xda12,0x12e));var _0x2da1=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xda12[_0x59d89e];return _0x554e93;};'use strict';var _=require(_0x2da1('0x0'));var util=require(_0x2da1('0x1'));var moment=require(_0x2da1('0x2'));var BPromise=require(_0x2da1('0x3'));var rs=require(_0x2da1('0x4'));var fs=require('fs');var Redis=require(_0x2da1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2da1('0x6'))(_0x2da1('0x7'));var config=require(_0x2da1('0x8'));var jayson=require(_0x2da1('0x9'));var client=jayson[_0x2da1('0xa')][_0x2da1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43fe98,_0x5cf59c,_0x4e7d31){return new BPromise(function(_0x8af1a9,_0x1fccae){return client['request'](_0x43fe98,_0x4e7d31)[_0x2da1('0xc')](function(_0x5e3474){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x5cf59c,'request\x20sent');logger[_0x2da1('0xd')](_0x2da1('0xe'),_0x5cf59c,_0x2da1('0xf'),JSON[_0x2da1('0x10')](_0x5e3474));if(_0x5e3474[_0x2da1('0x11')]){if(_0x5e3474[_0x2da1('0x11')][_0x2da1('0x12')]===0x1f4){logger[_0x2da1('0x11')](_0x2da1('0x13'),_0x5cf59c,_0x5e3474[_0x2da1('0x11')][_0x2da1('0x14')]);return _0x1fccae(_0x5e3474[_0x2da1('0x11')][_0x2da1('0x14')]);}logger[_0x2da1('0x11')](_0x2da1('0x13'),_0x5cf59c,_0x5e3474['error']['message']);return _0x8af1a9(_0x5e3474['error'][_0x2da1('0x14')]);}else{logger[_0x2da1('0x15')](_0x2da1('0x13'),_0x5cf59c,_0x2da1('0xf'));_0x8af1a9(_0x5e3474[_0x2da1('0x16')][_0x2da1('0x14')]);}})['catch'](function(_0x5eaccb){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5cf59c,_0x5eaccb);_0x1fccae(_0x5eaccb);});});}exports[_0x2da1('0x17')]=function(_0xdeb13c){var _0x16f837=this;return new Promise(function(_0x37b763,_0x384354){return db[_0x2da1('0x18')][_0x2da1('0x19')]({'raw':_0xdeb13c['options']?_0xdeb13c[_0x2da1('0x1a')][_0x2da1('0x1b')]===undefined?!![]:![]:!![],'where':_0xdeb13c['options']?_0xdeb13c[_0x2da1('0x1a')][_0x2da1('0x1c')]||null:null,'attributes':_0xdeb13c[_0x2da1('0x1a')]?_0xdeb13c[_0x2da1('0x1a')][_0x2da1('0x1d')]||null:null,'limit':_0xdeb13c[_0x2da1('0x1a')]?_0xdeb13c[_0x2da1('0x1a')][_0x2da1('0x1e')]||null:null,'include':_0xdeb13c['options']?_0xdeb13c[_0x2da1('0x1a')]['include']?_[_0x2da1('0x1f')](_0xdeb13c[_0x2da1('0x1a')][_0x2da1('0x20')],function(_0x1459cb){return{'model':db[_0x1459cb[_0x2da1('0x21')]],'as':_0x1459cb['as'],'attributes':_0x1459cb[_0x2da1('0x1d')],'include':_0x1459cb[_0x2da1('0x20')]?_[_0x2da1('0x1f')](_0x1459cb[_0x2da1('0x20')],function(_0x54b6a7){return{'model':db[_0x54b6a7[_0x2da1('0x21')]],'as':_0x54b6a7['as'],'attributes':_0x54b6a7[_0x2da1('0x1d')],'include':_0x54b6a7[_0x2da1('0x20')]?_[_0x2da1('0x1f')](_0x54b6a7[_0x2da1('0x20')],function(_0x22d3e3){return{'model':db[_0x22d3e3[_0x2da1('0x21')]],'as':_0x22d3e3['as'],'attributes':_0x22d3e3[_0x2da1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2da1('0xc')](function(_0x4cadd3){logger[_0x2da1('0x15')](_0x2da1('0x17'),_0xdeb13c);logger[_0x2da1('0xd')](_0x2da1('0x17'),_0xdeb13c,JSON[_0x2da1('0x10')](_0x4cadd3));_0x37b763(_0x4cadd3);})[_0x2da1('0x22')](function(_0x1b20bd){logger['error'](_0x2da1('0x17'),_0x1b20bd['message'],_0xdeb13c);_0x384354(_0x16f837[_0x2da1('0x11')](0x1f4,_0x1b20bd['message']));});});};exports[_0x2da1('0x23')]=function(_0x331bd4){var _0x29235b=this;return new Promise(function(_0xda3182,_0x370589){return db['VoiceCallReport']['create'](_0x331bd4[_0x2da1('0x24')],{'raw':_0x331bd4[_0x2da1('0x1a')]?_0x331bd4[_0x2da1('0x1a')][_0x2da1('0x1b')]===undefined?!![]:![]:!![]})[_0x2da1('0xc')](function(_0x2a07ae){logger[_0x2da1('0x15')](_0x2da1('0x23'),_0x331bd4);logger[_0x2da1('0xd')](_0x2da1('0x23'),_0x331bd4,JSON[_0x2da1('0x10')](_0x2a07ae));_0xda3182(_0x2a07ae);})['catch'](function(_0x26194e){logger[_0x2da1('0x11')](_0x2da1('0x23'),_0x26194e[_0x2da1('0x14')],_0x331bd4);_0x370589(_0x29235b[_0x2da1('0x11')](0x1f4,_0x26194e[_0x2da1('0x14')]));});});};exports[_0x2da1('0x25')]=function(_0x53e30b){var _0x243fb4=this;return new Promise(function(_0x2b5bd1,_0x278d40){return db[_0x2da1('0x18')][_0x2da1('0x26')](_0x53e30b[_0x2da1('0x24')],{'raw':_0x53e30b[_0x2da1('0x1a')]?_0x53e30b['options'][_0x2da1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53e30b[_0x2da1('0x1a')]?_0x53e30b[_0x2da1('0x1a')][_0x2da1('0x1c')]||null:null,'attributes':_0x53e30b[_0x2da1('0x1a')]?_0x53e30b[_0x2da1('0x1a')][_0x2da1('0x1d')]||null:null,'limit':_0x53e30b['options']?_0x53e30b[_0x2da1('0x1a')][_0x2da1('0x1e')]||null:null})['then'](function(_0x107e70){logger[_0x2da1('0x15')](_0x2da1('0x25'),_0x53e30b);logger['debug']('UpdateVoiceCallReport',_0x53e30b,JSON[_0x2da1('0x10')](_0x107e70));_0x2b5bd1(_0x107e70);})['catch'](function(_0xdd598){logger['error'](_0x2da1('0x25'),_0xdd598[_0x2da1('0x14')],_0x53e30b);_0x278d40(_0x243fb4['error'](0x1f4,_0xdd598[_0x2da1('0x14')]));});});}; \ No newline at end of file +var _0xd8e7=['model','GetVoiceCallReport','catch','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x59291f,_0x2777cd){var _0x5a562e=function(_0x3dd482){while(--_0x3dd482){_0x59291f['push'](_0x59291f['shift']());}};_0x5a562e(++_0x2777cd);}(_0xd8e7,0x10b));var _0x7d8e=function(_0x5a3cee,_0x3f5e94){_0x5a3cee=_0x5a3cee-0x0;var _0x42d95e=_0xd8e7[_0x5a3cee];return _0x42d95e;};'use strict';var _=require(_0x7d8e('0x0'));var util=require('util');var moment=require(_0x7d8e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7d8e('0x2'));var fs=require('fs');var Redis=require(_0x7d8e('0x3'));var db=require(_0x7d8e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d8e('0x5'))(_0x7d8e('0x6'));var config=require(_0x7d8e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7d8e('0x8')][_0x7d8e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf0db8e,_0x5b0ae2,_0x60b2cf){return new BPromise(function(_0x5024e9,_0x386729){return client['request'](_0xf0db8e,_0x60b2cf)[_0x7d8e('0xa')](function(_0x2b7f9e){logger[_0x7d8e('0xb')](_0x7d8e('0xc'),_0x5b0ae2,_0x7d8e('0xd'));logger[_0x7d8e('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5b0ae2,_0x7d8e('0xd'),JSON[_0x7d8e('0xf')](_0x2b7f9e));if(_0x2b7f9e[_0x7d8e('0x10')]){if(_0x2b7f9e[_0x7d8e('0x10')][_0x7d8e('0x11')]===0x1f4){logger[_0x7d8e('0x10')](_0x7d8e('0xc'),_0x5b0ae2,_0x2b7f9e[_0x7d8e('0x10')]['message']);return _0x386729(_0x2b7f9e[_0x7d8e('0x10')][_0x7d8e('0x12')]);}logger[_0x7d8e('0x10')](_0x7d8e('0xc'),_0x5b0ae2,_0x2b7f9e[_0x7d8e('0x10')][_0x7d8e('0x12')]);return _0x5024e9(_0x2b7f9e['error'][_0x7d8e('0x12')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x5b0ae2,_0x7d8e('0xd'));_0x5024e9(_0x2b7f9e[_0x7d8e('0x13')][_0x7d8e('0x12')]);}})['catch'](function(_0x2393fa){logger[_0x7d8e('0x10')](_0x7d8e('0xc'),_0x5b0ae2,_0x2393fa);_0x386729(_0x2393fa);});});}exports['GetVoiceCallReport']=function(_0x48dc29){var _0x46a7fe=this;return new Promise(function(_0x5646b8,_0x4200d1){return db[_0x7d8e('0x14')][_0x7d8e('0x15')]({'raw':_0x48dc29[_0x7d8e('0x16')]?_0x48dc29[_0x7d8e('0x16')][_0x7d8e('0x17')]===undefined?!![]:![]:!![],'where':_0x48dc29[_0x7d8e('0x16')]?_0x48dc29[_0x7d8e('0x16')][_0x7d8e('0x18')]||null:null,'attributes':_0x48dc29[_0x7d8e('0x16')]?_0x48dc29[_0x7d8e('0x16')][_0x7d8e('0x19')]||null:null,'limit':_0x48dc29[_0x7d8e('0x16')]?_0x48dc29[_0x7d8e('0x16')][_0x7d8e('0x1a')]||null:null,'include':_0x48dc29[_0x7d8e('0x16')]?_0x48dc29[_0x7d8e('0x16')][_0x7d8e('0x1b')]?_[_0x7d8e('0x1c')](_0x48dc29['options'][_0x7d8e('0x1b')],function(_0x449b95){return{'model':db[_0x449b95['model']],'as':_0x449b95['as'],'attributes':_0x449b95[_0x7d8e('0x19')],'include':_0x449b95[_0x7d8e('0x1b')]?_['map'](_0x449b95[_0x7d8e('0x1b')],function(_0x2bc749){return{'model':db[_0x2bc749[_0x7d8e('0x1d')]],'as':_0x2bc749['as'],'attributes':_0x2bc749[_0x7d8e('0x19')],'include':_0x2bc749[_0x7d8e('0x1b')]?_[_0x7d8e('0x1c')](_0x2bc749[_0x7d8e('0x1b')],function(_0xfad787){return{'model':db[_0xfad787[_0x7d8e('0x1d')]],'as':_0xfad787['as'],'attributes':_0xfad787[_0x7d8e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7d8e('0xa')](function(_0x237cd6){logger[_0x7d8e('0xb')]('GetVoiceCallReport',_0x48dc29);logger[_0x7d8e('0xe')](_0x7d8e('0x1e'),_0x48dc29,JSON[_0x7d8e('0xf')](_0x237cd6));_0x5646b8(_0x237cd6);})[_0x7d8e('0x1f')](function(_0x6127fa){logger['error'](_0x7d8e('0x1e'),_0x6127fa[_0x7d8e('0x12')],_0x48dc29);_0x4200d1(_0x46a7fe[_0x7d8e('0x10')](0x1f4,_0x6127fa['message']));});});};exports[_0x7d8e('0x20')]=function(_0x54d931){var _0x4e804f=this;return new Promise(function(_0x4e60db,_0x37c147){return db[_0x7d8e('0x14')][_0x7d8e('0x21')](_0x54d931[_0x7d8e('0x22')],{'raw':_0x54d931[_0x7d8e('0x16')]?_0x54d931[_0x7d8e('0x16')][_0x7d8e('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1492b1){logger[_0x7d8e('0xb')]('CreateVoiceCallReport',_0x54d931);logger['debug']('CreateVoiceCallReport',_0x54d931,JSON[_0x7d8e('0xf')](_0x1492b1));_0x4e60db(_0x1492b1);})[_0x7d8e('0x1f')](function(_0x3e768f){logger['error'](_0x7d8e('0x20'),_0x3e768f[_0x7d8e('0x12')],_0x54d931);_0x37c147(_0x4e804f[_0x7d8e('0x10')](0x1f4,_0x3e768f[_0x7d8e('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x4086ff){var _0x59da18=this;return new Promise(function(_0x1ec958,_0x3e1db4){return db[_0x7d8e('0x14')][_0x7d8e('0x23')](_0x4086ff['body'],{'raw':_0x4086ff[_0x7d8e('0x16')]?_0x4086ff[_0x7d8e('0x16')][_0x7d8e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4086ff['options']?_0x4086ff[_0x7d8e('0x16')][_0x7d8e('0x18')]||null:null,'attributes':_0x4086ff['options']?_0x4086ff[_0x7d8e('0x16')][_0x7d8e('0x19')]||null:null,'limit':_0x4086ff['options']?_0x4086ff['options']['limit']||null:null})['then'](function(_0x3c7e19){logger[_0x7d8e('0xb')](_0x7d8e('0x24'),_0x4086ff);logger[_0x7d8e('0xe')](_0x7d8e('0x24'),_0x4086ff,JSON[_0x7d8e('0xf')](_0x3c7e19));_0x1ec958(_0x3c7e19);})[_0x7d8e('0x1f')](function(_0x29f820){logger[_0x7d8e('0x10')](_0x7d8e('0x24'),_0x29f820[_0x7d8e('0x12')],_0x4086ff);_0x3e1db4(_0x59da18[_0x7d8e('0x10')](0x1f4,_0x29f820[_0x7d8e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index e6f4150..ebe20c2 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 _0x5d58=['./voiceChanSpy.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2fbcd3,_0xbb2e27){var _0x201573=function(_0x4846b9){while(--_0x4846b9){_0x2fbcd3['push'](_0x2fbcd3['shift']());}};_0x201573(++_0xbb2e27);}(_0x5d58,0x173));var _0x85d5=function(_0x2d6b12,_0x3ab01d){_0x2d6b12=_0x2d6b12-0x0;var _0x5ed03a=_0x5d58[_0x2d6b12];return _0x5ed03a;};'use strict';var multer=require(_0x85d5('0x0'));var util=require(_0x85d5('0x1'));var path=require('path');var timeout=require(_0x85d5('0x2'));var express=require('express');var router=express[_0x85d5('0x3')]();var auth=require(_0x85d5('0x4'));var interaction=require(_0x85d5('0x5'));var config=require(_0x85d5('0x6'));var controller=require(_0x85d5('0x7'));router[_0x85d5('0x8')]('/',auth[_0x85d5('0x9')](),controller[_0x85d5('0xa')]);router[_0x85d5('0x8')](_0x85d5('0xb'),auth[_0x85d5('0x9')](),controller['show']);router['post']('/',auth[_0x85d5('0x9')](),controller[_0x85d5('0xc')]);router[_0x85d5('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x85d5('0xe')]);router[_0x85d5('0xf')](_0x85d5('0xb'),auth[_0x85d5('0x9')](),controller[_0x85d5('0x10')]);module[_0x85d5('0x11')]=router; \ No newline at end of file +var _0x6688=['put','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','isAuthenticated','show','post','create'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x6688,0x10e));var _0x8668=function(_0x576451,_0x4d2fec){_0x576451=_0x576451-0x0;var _0x1c5743=_0x6688[_0x576451];return _0x1c5743;};'use strict';var multer=require(_0x8668('0x0'));var util=require(_0x8668('0x1'));var path=require(_0x8668('0x2'));var timeout=require('connect-timeout');var express=require(_0x8668('0x3'));var router=express[_0x8668('0x4')]();var auth=require(_0x8668('0x5'));var interaction=require(_0x8668('0x6'));var config=require(_0x8668('0x7'));var controller=require(_0x8668('0x8'));router[_0x8668('0x9')]('/',auth['isAuthenticated'](),controller[_0x8668('0xa')]);router[_0x8668('0x9')]('/:id',auth[_0x8668('0xb')](),controller[_0x8668('0xc')]);router[_0x8668('0xd')]('/',auth[_0x8668('0xb')](),controller[_0x8668('0xe')]);router[_0x8668('0xf')](_0x8668('0x10'),auth[_0x8668('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8668('0x11')]);module[_0x8668('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 5c7ccf0..ce849b2 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 _0xf9f8=['name','setDataValue','options','join','getDataValue','BOOLEAN','sequelize','exports','STRING'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0xf9f8,0x141));var _0x8f9f=function(_0x2a3088,_0xc70278){_0x2a3088=_0x2a3088-0x0;var _0x8a3b8c=_0xf9f8[_0x2a3088];return _0x8a3b8c;};'use strict';var Sequelize=require(_0x8f9f('0x0'));module[_0x8f9f('0x1')]={'name':{'type':Sequelize[_0x8f9f('0x2')]},'prefix':{'type':Sequelize[_0x8f9f('0x2')],'unique':_0x8f9f('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x1c2807){this[_0x8f9f('0x4')](_0x8f9f('0x5'),_0x1c2807?_0x1c2807[_0x8f9f('0x6')](''):[]);},'get':function(){return this[_0x8f9f('0x7')]('options')?this[_0x8f9f('0x7')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x8f9f('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x8f9f('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8f9f('0x2')]},'description':{'type':Sequelize[_0x8f9f('0x2')]}}; \ No newline at end of file +var _0x3282=['BOOLEAN','sequelize','exports','STRING','getDataValue','options','split'];(function(_0x5af454,_0x54c172){var _0x41f3f6=function(_0x44fb16){while(--_0x44fb16){_0x5af454['push'](_0x5af454['shift']());}};_0x41f3f6(++_0x54c172);}(_0x3282,0x1d6));var _0x2328=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x3282[_0x1c8c28];return _0x1f59b4;};'use strict';var Sequelize=require(_0x2328('0x0'));module[_0x2328('0x1')]={'name':{'type':Sequelize[_0x2328('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x2328('0x2')],'set':function(_0x52404c){this['setDataValue']('options',_0x52404c?_0x52404c['join'](''):[]);},'get':function(){return this[_0x2328('0x3')]('options')?this[_0x2328('0x3')](_0x2328('0x4'))[_0x2328('0x5')](''):[];}},'auth':{'type':Sequelize[_0x2328('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x2328('0x2')]},'record':{'type':Sequelize[_0x2328('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2328('0x2')]},'description':{'type':Sequelize[_0x2328('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index c8a35b7..4dcaaf2 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 _0xe772=['intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','filter','options','count','includeAll','include','VoiceChanSpy','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters'];(function(_0x485594,_0xe83d77){var _0x469d6a=function(_0x42f390){while(--_0x42f390){_0x485594['push'](_0x485594['shift']());}};_0x469d6a(++_0xe83d77);}(_0xe772,0xc9));var _0x2e77=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0xe772[_0x143a91];return _0x1906f5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2e77('0x0'));var rimraf=require(_0x2e77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e77('0x2'));var rp=require(_0x2e77('0x3'));var moment=require(_0x2e77('0x4'));var BPromise=require(_0x2e77('0x5'));var Mustache=require(_0x2e77('0x6'));var util=require(_0x2e77('0x7'));var path=require(_0x2e77('0x8'));var sox=require(_0x2e77('0x9'));var csv=require(_0x2e77('0xa'));var ejs=require(_0x2e77('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2e77('0xc'));var crypto=require(_0x2e77('0xd'));var jsforce=require(_0x2e77('0xe'));var deskjs=require(_0x2e77('0xf'));var toCsv=require(_0x2e77('0xa'));var querystring=require(_0x2e77('0x10'));var Papa=require(_0x2e77('0x11'));var Redis=require(_0x2e77('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2e77('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e77('0x14'));var logger=require(_0x2e77('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2e77('0x16'));var licenseUtil=require(_0x2e77('0x17'));var db=require(_0x2e77('0x18'))['db'];function respondWithStatusCode(_0x4c3414,_0x3be196){_0x3be196=_0x3be196||0xcc;return function(_0x15c7da){if(_0x15c7da){return _0x4c3414[_0x2e77('0x19')](_0x3be196);}return _0x4c3414[_0x2e77('0x1a')](_0x3be196)[_0x2e77('0x1b')]();};}function respondWithResult(_0x286baa,_0x17d6d3){_0x17d6d3=_0x17d6d3||0xc8;return function(_0x1b08fd){if(_0x1b08fd){return _0x286baa[_0x2e77('0x1a')](_0x17d6d3)[_0x2e77('0x1c')](_0x1b08fd);}};}function respondWithFilteredResult(_0x4b01f8,_0x397109){return function(_0x121759){if(_0x121759){var _0x20f7c9=_0x121759['count'],_0x45facc=_0x397109[_0x2e77('0x1d')],_0x55c97b=_0x397109['offset']+_0x397109['limit'],_0x5ed90b;if(_0x55c97b>=_0x20f7c9){_0x55c97b=_0x20f7c9;_0x5ed90b=0xc8;}else{_0x5ed90b=0xce;}_0x4b01f8[_0x2e77('0x1a')](_0x5ed90b);return _0x4b01f8[_0x2e77('0x1e')](_0x2e77('0x1f'),_0x45facc+'-'+_0x55c97b+'/'+_0x20f7c9)[_0x2e77('0x1c')](_0x121759);}return null;};}function patchUpdates(_0x2aedbc){return function(_0x55864f){try{jsonpatch[_0x2e77('0x20')](_0x55864f,_0x2aedbc,!![]);}catch(_0x1f34b1){return BPromise[_0x2e77('0x21')](_0x1f34b1);}return _0x55864f[_0x2e77('0x22')]();};}function saveUpdates(_0x8ca4a5,_0x4b9129){return function(_0x520741){if(_0x520741){return _0x520741[_0x2e77('0x23')](_0x8ca4a5)[_0x2e77('0x24')](function(_0x8d9367){return _0x8d9367;});}return null;};}function removeEntity(_0x78fcb3,_0x2b87db){return function(_0x594995){if(_0x594995){return _0x594995[_0x2e77('0x25')]()[_0x2e77('0x24')](function(){var _0x4996da=_0x594995[_0x2e77('0x26')]({'plain':!![]});var _0x1997f2=_0x2e77('0x27');return db[_0x2e77('0x28')]['destroy']({'where':{'type':_0x1997f2,'resourceId':_0x4996da['id']}})[_0x2e77('0x24')](function(){return _0x594995;});})[_0x2e77('0x24')](function(){_0x78fcb3[_0x2e77('0x1a')](0xcc)[_0x2e77('0x1b')]();});}};}function handleEntityNotFound(_0x13f4ed,_0x52edbd){return function(_0xcc3e87){if(!_0xcc3e87){_0x13f4ed[_0x2e77('0x19')](0x194);}return _0xcc3e87;};}function handleError(_0x42098e,_0x10ef1b){_0x10ef1b=_0x10ef1b||0x1f4;return function(_0x3a1531){logger['error'](_0x3a1531[_0x2e77('0x29')]);if(_0x3a1531['name']){delete _0x3a1531[_0x2e77('0x2a')];}_0x42098e['status'](_0x10ef1b)[_0x2e77('0x2b')](_0x3a1531);};}exports[_0x2e77('0x2c')]=function(_0x1d9880,_0x106fea){var _0x223942={},_0x4f4748={},_0x43d751={'count':0x0,'rows':[]};var _0x54b1b0=_[_0x2e77('0x2d')](db['VoiceChanSpy'][_0x2e77('0x2e')],function(_0x8cab44){return{'name':_0x8cab44[_0x2e77('0x2f')],'type':_0x8cab44[_0x2e77('0x30')][_0x2e77('0x31')]};});_0x4f4748[_0x2e77('0x32')]=_[_0x2e77('0x2d')](_0x54b1b0,'name');_0x4f4748['query']=_[_0x2e77('0x33')](_0x1d9880[_0x2e77('0x34')]);_0x4f4748[_0x2e77('0x35')]=_['intersection'](_0x4f4748['model'],_0x4f4748[_0x2e77('0x34')]);_0x223942['attributes']=_[_0x2e77('0x36')](_0x4f4748[_0x2e77('0x32')],qs[_0x2e77('0x37')](_0x1d9880[_0x2e77('0x34')][_0x2e77('0x37')]));_0x223942[_0x2e77('0x38')]=_0x223942[_0x2e77('0x38')][_0x2e77('0x39')]?_0x223942[_0x2e77('0x38')]:_0x4f4748[_0x2e77('0x32')];if(!_0x1d9880[_0x2e77('0x34')][_0x2e77('0x3a')](_0x2e77('0x3b'))){_0x223942['limit']=qs[_0x2e77('0x3c')](_0x1d9880[_0x2e77('0x34')][_0x2e77('0x3c')]);_0x223942[_0x2e77('0x1d')]=qs[_0x2e77('0x1d')](_0x1d9880[_0x2e77('0x34')][_0x2e77('0x1d')]);}_0x223942[_0x2e77('0x3d')]=qs['sort'](_0x1d9880['query'][_0x2e77('0x3e')]);_0x223942[_0x2e77('0x3f')]=qs['filters'](_['pick'](_0x1d9880[_0x2e77('0x34')],_0x4f4748[_0x2e77('0x35')]),_0x54b1b0);if(_0x1d9880[_0x2e77('0x34')]['filter']){_0x223942[_0x2e77('0x3f')]=_[_0x2e77('0x40')](_0x223942[_0x2e77('0x3f')],{'$or':_[_0x2e77('0x2d')](_0x54b1b0,function(_0x4fffd8){if(_0x4fffd8[_0x2e77('0x30')]!=='VIRTUAL'){var _0x3c453d={};_0x3c453d[_0x4fffd8[_0x2e77('0x2a')]]={'$like':'%'+_0x1d9880['query'][_0x2e77('0x41')]+'%'};return _0x3c453d;}})});}_0x223942=_['merge']({},_0x223942,_0x1d9880[_0x2e77('0x42')]);var _0x141064={'where':_0x223942['where']};return db['VoiceChanSpy'][_0x2e77('0x43')](_0x141064)[_0x2e77('0x24')](function(_0x3d55e0){_0x43d751[_0x2e77('0x43')]=_0x3d55e0;if(_0x1d9880['query'][_0x2e77('0x44')]){_0x223942[_0x2e77('0x45')]=[{'all':!![]}];}return db[_0x2e77('0x46')]['findAll'](_0x223942);})[_0x2e77('0x24')](function(_0x54e27f){_0x43d751[_0x2e77('0x47')]=_0x54e27f;return _0x43d751;})[_0x2e77('0x24')](respondWithFilteredResult(_0x106fea,_0x223942))[_0x2e77('0x48')](handleError(_0x106fea,null));};exports[_0x2e77('0x49')]=function(_0x3aaec8,_0x500660){var _0x33786a={'raw':![],'where':{'id':_0x3aaec8[_0x2e77('0x4a')]['id']}},_0x30bf2f={};_0x30bf2f['model']=_[_0x2e77('0x33')](db[_0x2e77('0x46')][_0x2e77('0x2e')]);_0x30bf2f[_0x2e77('0x34')]=_[_0x2e77('0x33')](_0x3aaec8[_0x2e77('0x34')]);_0x30bf2f['filters']=_[_0x2e77('0x36')](_0x30bf2f['model'],_0x30bf2f['query']);_0x33786a[_0x2e77('0x38')]=_[_0x2e77('0x36')](_0x30bf2f[_0x2e77('0x32')],qs['fields'](_0x3aaec8[_0x2e77('0x34')][_0x2e77('0x37')]));_0x33786a[_0x2e77('0x38')]=_0x33786a[_0x2e77('0x38')][_0x2e77('0x39')]?_0x33786a[_0x2e77('0x38')]:_0x30bf2f['model'];if(_0x3aaec8[_0x2e77('0x34')][_0x2e77('0x44')]){_0x33786a[_0x2e77('0x45')]=[{'all':!![]}];}_0x33786a=_[_0x2e77('0x40')]({},_0x33786a,_0x3aaec8[_0x2e77('0x42')]);return db['VoiceChanSpy'][_0x2e77('0x4b')](_0x33786a)[_0x2e77('0x24')](handleEntityNotFound(_0x500660,null))['then'](respondWithResult(_0x500660,null))[_0x2e77('0x48')](handleError(_0x500660,null));};exports[_0x2e77('0x4c')]=function(_0x53a65b,_0x49fa45){return db[_0x2e77('0x46')][_0x2e77('0x4c')](_0x53a65b['body'],{})[_0x2e77('0x24')](function(_0x80cd68){var _0x511a67=_0x53a65b[_0x2e77('0x4d')][_0x2e77('0x26')]({'plain':!![]});if(!_0x511a67)throw new Error(_0x2e77('0x4e'));if(_0x511a67[_0x2e77('0x4f')]==='user'){var _0x1b7b4d=_0x80cd68[_0x2e77('0x26')]({'plain':!![]});var _0x511254=_0x2e77('0x27');return db[_0x2e77('0x50')][_0x2e77('0x4b')]({'where':{'name':_0x511254,'userProfileId':_0x511a67[_0x2e77('0x51')]},'raw':!![]})['then'](function(_0x1817af){if(_0x1817af&&_0x1817af[_0x2e77('0x52')]===0x0){return db[_0x2e77('0x28')][_0x2e77('0x4c')]({'name':_0x1b7b4d[_0x2e77('0x2a')],'resourceId':_0x1b7b4d['id'],'type':_0x1817af[_0x2e77('0x2a')],'sectionId':_0x1817af['id']},{})[_0x2e77('0x24')](function(){return _0x80cd68;});}else{return _0x80cd68;}})[_0x2e77('0x48')](function(_0x4253a1){logger[_0x2e77('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4253a1);throw _0x4253a1;});}return _0x80cd68;})[_0x2e77('0x24')](respondWithResult(_0x49fa45,0xc9))[_0x2e77('0x48')](handleError(_0x49fa45,null));};exports[_0x2e77('0x23')]=function(_0x561a10,_0x3d699b){if(_0x561a10['body']['id']){delete _0x561a10[_0x2e77('0x54')]['id'];}return db[_0x2e77('0x46')][_0x2e77('0x4b')]({'where':{'id':_0x561a10['params']['id']}})['then'](handleEntityNotFound(_0x3d699b,null))[_0x2e77('0x24')](saveUpdates(_0x561a10[_0x2e77('0x54')],null))['then'](respondWithResult(_0x3d699b,null))[_0x2e77('0x48')](handleError(_0x3d699b,null));};exports['destroy']=function(_0x1dc493,_0x5be4aa){return db['VoiceChanSpy'][_0x2e77('0x4b')]({'where':{'id':_0x1dc493[_0x2e77('0x4a')]['id']}})[_0x2e77('0x24')](handleEntityNotFound(_0x5be4aa,null))[_0x2e77('0x24')](removeEntity(_0x5be4aa,null))[_0x2e77('0x48')](handleError(_0x5be4aa,null));}; \ No newline at end of file +var _0xb9f9=['filters','filter','where','merge','count','include','findAll','rows','show','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','params','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','stack','name','index','VoiceChanSpy','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x21f2d7,_0x1c828a){var _0x17691e=function(_0x53ae55){while(--_0x53ae55){_0x21f2d7['push'](_0x21f2d7['shift']());}};_0x17691e(++_0x1c828a);}(_0xb9f9,0x6b));var _0x9b9f=function(_0xb4e052,_0x1d3cb6){_0xb4e052=_0xb4e052-0x0;var _0x5197e7=_0xb9f9[_0xb4e052];return _0x5197e7;};'use strict';var pdf=require(_0x9b9f('0x0'));var emlformat=require(_0x9b9f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9b9f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b9f('0x3'));var moment=require(_0x9b9f('0x4'));var BPromise=require(_0x9b9f('0x5'));var Mustache=require(_0x9b9f('0x6'));var util=require(_0x9b9f('0x7'));var path=require(_0x9b9f('0x8'));var sox=require('sox');var csv=require(_0x9b9f('0x9'));var ejs=require(_0x9b9f('0xa'));var fs=require('fs');var _=require(_0x9b9f('0xb'));var squel=require(_0x9b9f('0xc'));var crypto=require(_0x9b9f('0xd'));var jsforce=require(_0x9b9f('0xe'));var deskjs=require(_0x9b9f('0xf'));var toCsv=require(_0x9b9f('0x9'));var querystring=require(_0x9b9f('0x10'));var Papa=require('papaparse');var Redis=require(_0x9b9f('0x11'));var authService=require(_0x9b9f('0x12'));var qs=require(_0x9b9f('0x13'));var as=require(_0x9b9f('0x14'));var hardwareService=require(_0x9b9f('0x15'));var logger=require(_0x9b9f('0x16'))('api');var utils=require(_0x9b9f('0x17'));var config=require(_0x9b9f('0x18'));var licenseUtil=require(_0x9b9f('0x19'));var db=require(_0x9b9f('0x1a'))['db'];function respondWithStatusCode(_0x5e4683,_0x437a0c){_0x437a0c=_0x437a0c||0xcc;return function(_0x28245a){if(_0x28245a){return _0x5e4683[_0x9b9f('0x1b')](_0x437a0c);}return _0x5e4683[_0x9b9f('0x1c')](_0x437a0c)[_0x9b9f('0x1d')]();};}function respondWithResult(_0x11630a,_0x1282b2){_0x1282b2=_0x1282b2||0xc8;return function(_0x12526e){if(_0x12526e){return _0x11630a[_0x9b9f('0x1c')](_0x1282b2)[_0x9b9f('0x1e')](_0x12526e);}};}function respondWithFilteredResult(_0x4a2156,_0x3fc89b){return function(_0x330bae){if(_0x330bae){var _0x321328=_0x330bae['count'],_0x2312ff=_0x3fc89b[_0x9b9f('0x1f')],_0x1673f9=_0x3fc89b[_0x9b9f('0x1f')]+_0x3fc89b['limit'],_0x2bae6a;if(_0x1673f9>=_0x321328){_0x1673f9=_0x321328;_0x2bae6a=0xc8;}else{_0x2bae6a=0xce;}_0x4a2156[_0x9b9f('0x1c')](_0x2bae6a);return _0x4a2156[_0x9b9f('0x20')](_0x9b9f('0x21'),_0x2312ff+'-'+_0x1673f9+'/'+_0x321328)[_0x9b9f('0x1e')](_0x330bae);}return null;};}function patchUpdates(_0x56af22){return function(_0x3e16e1){try{jsonpatch['apply'](_0x3e16e1,_0x56af22,!![]);}catch(_0x1adeef){return BPromise[_0x9b9f('0x22')](_0x1adeef);}return _0x3e16e1[_0x9b9f('0x23')]();};}function saveUpdates(_0x3e509e,_0x5171f4){return function(_0x4eb60b){if(_0x4eb60b){return _0x4eb60b[_0x9b9f('0x24')](_0x3e509e)[_0x9b9f('0x25')](function(_0x322da6){return _0x322da6;});}return null;};}function removeEntity(_0x41501c,_0x31d766){return function(_0xfed8ed){if(_0xfed8ed){return _0xfed8ed[_0x9b9f('0x26')]()[_0x9b9f('0x25')](function(){var _0x61dfdf=_0xfed8ed['get']({'plain':!![]});var _0x2a80a5='ChanSpies';return db[_0x9b9f('0x27')]['destroy']({'where':{'type':_0x2a80a5,'resourceId':_0x61dfdf['id']}})[_0x9b9f('0x25')](function(){return _0xfed8ed;});})[_0x9b9f('0x25')](function(){_0x41501c[_0x9b9f('0x1c')](0xcc)[_0x9b9f('0x1d')]();});}};}function handleEntityNotFound(_0x58e2bf,_0x342a0d){return function(_0x37d934){if(!_0x37d934){_0x58e2bf[_0x9b9f('0x1b')](0x194);}return _0x37d934;};}function handleError(_0x4402bf,_0x12d7e1){_0x12d7e1=_0x12d7e1||0x1f4;return function(_0x4614d1){logger['error'](_0x4614d1[_0x9b9f('0x28')]);if(_0x4614d1[_0x9b9f('0x29')]){delete _0x4614d1[_0x9b9f('0x29')];}_0x4402bf[_0x9b9f('0x1c')](_0x12d7e1)['send'](_0x4614d1);};}exports[_0x9b9f('0x2a')]=function(_0xdfc103,_0x2c2063){var _0x4d8301={},_0x1b1d1a={},_0x284227={'count':0x0,'rows':[]};var _0x120589=_['map'](db[_0x9b9f('0x2b')][_0x9b9f('0x2c')],function(_0x5e4c98){return{'name':_0x5e4c98['fieldName'],'type':_0x5e4c98[_0x9b9f('0x2d')][_0x9b9f('0x2e')]};});_0x1b1d1a[_0x9b9f('0x2f')]=_[_0x9b9f('0x30')](_0x120589,_0x9b9f('0x29'));_0x1b1d1a[_0x9b9f('0x31')]=_[_0x9b9f('0x32')](_0xdfc103[_0x9b9f('0x31')]);_0x1b1d1a['filters']=_[_0x9b9f('0x33')](_0x1b1d1a[_0x9b9f('0x2f')],_0x1b1d1a[_0x9b9f('0x31')]);_0x4d8301[_0x9b9f('0x34')]=_[_0x9b9f('0x33')](_0x1b1d1a[_0x9b9f('0x2f')],qs[_0x9b9f('0x35')](_0xdfc103['query'][_0x9b9f('0x35')]));_0x4d8301['attributes']=_0x4d8301[_0x9b9f('0x34')][_0x9b9f('0x36')]?_0x4d8301[_0x9b9f('0x34')]:_0x1b1d1a[_0x9b9f('0x2f')];if(!_0xdfc103[_0x9b9f('0x31')][_0x9b9f('0x37')](_0x9b9f('0x38'))){_0x4d8301['limit']=qs['limit'](_0xdfc103['query']['limit']);_0x4d8301[_0x9b9f('0x1f')]=qs[_0x9b9f('0x1f')](_0xdfc103[_0x9b9f('0x31')][_0x9b9f('0x1f')]);}_0x4d8301[_0x9b9f('0x39')]=qs[_0x9b9f('0x3a')](_0xdfc103[_0x9b9f('0x31')]['sort']);_0x4d8301['where']=qs[_0x9b9f('0x3b')](_['pick'](_0xdfc103['query'],_0x1b1d1a[_0x9b9f('0x3b')]),_0x120589);if(_0xdfc103[_0x9b9f('0x31')][_0x9b9f('0x3c')]){_0x4d8301[_0x9b9f('0x3d')]=_[_0x9b9f('0x3e')](_0x4d8301[_0x9b9f('0x3d')],{'$or':_[_0x9b9f('0x30')](_0x120589,function(_0x4527db){if(_0x4527db[_0x9b9f('0x2d')]!=='VIRTUAL'){var _0x247e09={};_0x247e09[_0x4527db[_0x9b9f('0x29')]]={'$like':'%'+_0xdfc103[_0x9b9f('0x31')]['filter']+'%'};return _0x247e09;}})});}_0x4d8301=_[_0x9b9f('0x3e')]({},_0x4d8301,_0xdfc103['options']);var _0x5a4b27={'where':_0x4d8301['where']};return db[_0x9b9f('0x2b')][_0x9b9f('0x3f')](_0x5a4b27)['then'](function(_0xcb2de0){_0x284227[_0x9b9f('0x3f')]=_0xcb2de0;if(_0xdfc103[_0x9b9f('0x31')]['includeAll']){_0x4d8301[_0x9b9f('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x9b9f('0x41')](_0x4d8301);})[_0x9b9f('0x25')](function(_0x197d95){_0x284227[_0x9b9f('0x42')]=_0x197d95;return _0x284227;})['then'](respondWithFilteredResult(_0x2c2063,_0x4d8301))['catch'](handleError(_0x2c2063,null));};exports[_0x9b9f('0x43')]=function(_0x1db30d,_0x2f0c36){var _0x6ee818={'raw':![],'where':{'id':_0x1db30d['params']['id']}},_0x284388={};_0x284388['model']=_[_0x9b9f('0x32')](db[_0x9b9f('0x2b')][_0x9b9f('0x2c')]);_0x284388[_0x9b9f('0x31')]=_[_0x9b9f('0x32')](_0x1db30d[_0x9b9f('0x31')]);_0x284388[_0x9b9f('0x3b')]=_[_0x9b9f('0x33')](_0x284388[_0x9b9f('0x2f')],_0x284388['query']);_0x6ee818[_0x9b9f('0x34')]=_['intersection'](_0x284388[_0x9b9f('0x2f')],qs[_0x9b9f('0x35')](_0x1db30d[_0x9b9f('0x31')][_0x9b9f('0x35')]));_0x6ee818[_0x9b9f('0x34')]=_0x6ee818[_0x9b9f('0x34')][_0x9b9f('0x36')]?_0x6ee818[_0x9b9f('0x34')]:_0x284388[_0x9b9f('0x2f')];if(_0x1db30d[_0x9b9f('0x31')][_0x9b9f('0x44')]){_0x6ee818[_0x9b9f('0x40')]=[{'all':!![]}];}_0x6ee818=_[_0x9b9f('0x3e')]({},_0x6ee818,_0x1db30d[_0x9b9f('0x45')]);return db['VoiceChanSpy'][_0x9b9f('0x46')](_0x6ee818)[_0x9b9f('0x25')](handleEntityNotFound(_0x2f0c36,null))[_0x9b9f('0x25')](respondWithResult(_0x2f0c36,null))['catch'](handleError(_0x2f0c36,null));};exports[_0x9b9f('0x47')]=function(_0x54caec,_0x58ec46){return db[_0x9b9f('0x2b')][_0x9b9f('0x47')](_0x54caec[_0x9b9f('0x48')],{})[_0x9b9f('0x25')](function(_0x4bcd4c){var _0x2d18d2=_0x54caec[_0x9b9f('0x49')][_0x9b9f('0x4a')]({'plain':!![]});if(!_0x2d18d2)throw new Error(_0x9b9f('0x4b'));if(_0x2d18d2[_0x9b9f('0x4c')]===_0x9b9f('0x49')){var _0x19a738=_0x4bcd4c[_0x9b9f('0x4a')]({'plain':!![]});var _0x101d86=_0x9b9f('0x4d');return db[_0x9b9f('0x4e')][_0x9b9f('0x46')]({'where':{'name':_0x101d86,'userProfileId':_0x2d18d2['userProfileId']},'raw':!![]})[_0x9b9f('0x25')](function(_0x205425){if(_0x205425&&_0x205425[_0x9b9f('0x4f')]===0x0){return db[_0x9b9f('0x27')][_0x9b9f('0x47')]({'name':_0x19a738[_0x9b9f('0x29')],'resourceId':_0x19a738['id'],'type':_0x205425[_0x9b9f('0x29')],'sectionId':_0x205425['id']},{})[_0x9b9f('0x25')](function(){return _0x4bcd4c;});}else{return _0x4bcd4c;}})['catch'](function(_0x55c023){logger['error'](_0x9b9f('0x50'),_0x55c023);throw _0x55c023;});}return _0x4bcd4c;})['then'](respondWithResult(_0x58ec46,0xc9))[_0x9b9f('0x51')](handleError(_0x58ec46,null));};exports[_0x9b9f('0x24')]=function(_0x4ca67b,_0x4b99c1){if(_0x4ca67b[_0x9b9f('0x48')]['id']){delete _0x4ca67b['body']['id'];}return db[_0x9b9f('0x2b')][_0x9b9f('0x46')]({'where':{'id':_0x4ca67b['params']['id']}})[_0x9b9f('0x25')](handleEntityNotFound(_0x4b99c1,null))[_0x9b9f('0x25')](saveUpdates(_0x4ca67b[_0x9b9f('0x48')],null))['then'](respondWithResult(_0x4b99c1,null))['catch'](handleError(_0x4b99c1,null));};exports[_0x9b9f('0x26')]=function(_0xebbb04,_0x438602){return db[_0x9b9f('0x2b')][_0x9b9f('0x46')]({'where':{'id':_0xebbb04[_0x9b9f('0x52')]['id']}})[_0x9b9f('0x25')](handleEntityNotFound(_0x438602,null))[_0x9b9f('0x25')](removeEntity(_0x438602,null))[_0x9b9f('0x51')](handleError(_0x438602,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 91b272b..5d5d2a1 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 _0xed7a=['ChanSpy','SIP/%s,%s','name','options','length','internal','concat','User','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','push','format','CDR(type)=%s','chanspy','record','merge','${UNIQUEID}.%s,a','recordingFormat','password'];(function(_0x1dcf25,_0x3541b7){var _0x51e6a5=function(_0x51932f){while(--_0x51932f){_0x1dcf25['push'](_0x1dcf25['shift']());}};_0x51e6a5(++_0x3541b7);}(_0xed7a,0x9f));var _0xaed7=function(_0x1b88f6,_0x1a5c00){_0x1b88f6=_0x1b88f6-0x0;var _0x1280fe=_0xed7a[_0x1b88f6];return _0x1280fe;};'use strict';var _=require(_0xaed7('0x0'));var util=require(_0xaed7('0x1'));var BPromise=require('bluebird');var attributes=require(_0xaed7('0x2'));var getUserApplications=function(_0x5c17a6,_0xb1bcff,_0x348990){var _0x2af673=0x1;var _0x4d194b=[];var _0x107fe4={'context':_0xb1bcff[_0xaed7('0x3')]||_0xaed7('0x4'),'exten':util['format'](_0xaed7('0x5'),_0x5c17a6[_0xaed7('0x6')],_0x348990),'type':'system','isApp':![],'ChanSpyId':_0x5c17a6['id'],'UserId':_0xb1bcff['id']};_0x4d194b[_0xaed7('0x7')](_['merge']({'app':'Set','appdata':util[_0xaed7('0x8')](_0xaed7('0x9'),_0xaed7('0xa')),'priority':_0x2af673++},_0x107fe4));if(_0x5c17a6[_0xaed7('0xb')]){_0x4d194b[_0xaed7('0x7')](_[_0xaed7('0xc')]({'app':'MixMonitor','appdata':util[_0xaed7('0x8')](_0xaed7('0xd'),_0x5c17a6[_0xaed7('0xe')]),'priority':_0x2af673++},_0x107fe4));}if(_0x5c17a6['auth']){_0x4d194b[_0xaed7('0x7')](_['merge']({'app':'Authenticate','appdata':_0x5c17a6[_0xaed7('0xf')],'priority':_0x2af673++},_0x107fe4));}_0x4d194b['push'](_['merge']({'app':_0xaed7('0x10'),'appdata':util[_0xaed7('0x8')](_0xaed7('0x11'),_0xb1bcff[_0xaed7('0x12')],_0x5c17a6[_0xaed7('0x13')]?_0x5c17a6[_0xaed7('0x13')]['join'](''):''),'priority':_0x2af673++},_0x107fe4));if(_0x5c17a6[_0xaed7('0xb')]){_0x4d194b[_0xaed7('0x7')](_[_0xaed7('0xc')]({'app':'StopMixMonitor','priority':_0x2af673++},_0x107fe4));}return _0x4d194b;};var getChanSpyApplications=function(_0x793d1a,_0x2eb038){var _0x1e3890=[];for(var _0x3b9a3c=0x0,_0x1a16e1=0x1;_0x3b9a3c<_0x2eb038[_0xaed7('0x14')];_0x3b9a3c++,_0x1a16e1=0x1){_0x1e3890=_0x1e3890['concat'](getUserApplications(_0x793d1a,_0x2eb038[_0x3b9a3c],_0x2eb038[_0x3b9a3c][_0xaed7('0x15')]));if(_0x2eb038[_0x3b9a3c][_0xaed7('0x15')]!=_0x2eb038[_0x3b9a3c][_0xaed7('0x12')]){_0x1e3890=_0x1e3890[_0xaed7('0x16')](getUserApplications(_0x793d1a,_0x2eb038[_0x3b9a3c],_0x2eb038[_0x3b9a3c][_0xaed7('0x12')]));}}return _0x1e3890;};var getChanSpyPromise=function(_0xb00ed4,_0x809daf){return new BPromise(function(_0x33edf6,_0x36e775){return _0xb00ed4[_0xaed7('0x17')]['findAll']({'attributes':['id',_0xaed7('0x12'),_0xaed7('0x15')],'where':{'role':_0xaed7('0x18'),'chanspy':!![]},'raw':!![]})['then'](function(_0x1f525a){if(_0x1f525a){return _0x33edf6(getChanSpyApplications(_0x809daf,_0x1f525a));}return _0x33edf6([]);})[_0xaed7('0x19')](function(_0x26bf1f){_0x36e775(_0x26bf1f);});});};module[_0xaed7('0x1a')]=function(_0x10f123,_0x659d12){var _0x1573fc=_0x10f123[_0xaed7('0x1b')];return _0x10f123[_0xaed7('0x1c')](_0xaed7('0x1d'),attributes,{'tableName':_0xaed7('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x69591f,_0x1b5c97,_0x24448e){return getChanSpyPromise(_0x1573fc,_0x69591f)[_0xaed7('0x1f')](function(_0x12ca40){if(_0x12ca40&&_0x12ca40[_0xaed7('0x14')]){return _0x1573fc[_0xaed7('0x20')][_0xaed7('0x21')](_0x12ca40);}})['then'](function(){_0x24448e();})['catch'](function(_0x4d3a90){_0x24448e(_0x4d3a90);});},'afterUpdate':function(_0xec00db,_0x3e05f5,_0x454444){return _0x1573fc['VoiceExtension'][_0xaed7('0x22')]({'where':{'ChanSpyId':_0xec00db['id']}})[_0xaed7('0x1f')](function(){return getChanSpyPromise(_0x1573fc,_0xec00db);})['then'](function(_0x49e06d){if(_0x49e06d&&_0x49e06d['length']){return _0x1573fc['VoiceExtension'][_0xaed7('0x21')](_0x49e06d);}})['then'](function(){_0x454444();})[_0xaed7('0x19')](function(_0x252cb1){_0x454444(_0x252cb1);});},'afterDestroy':function(_0x2f010d,_0x2523aa,_0x16fdb4){return _0x1573fc['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x2f010d['id']}})[_0xaed7('0x1f')](function(){_0x16fdb4();})[_0xaed7('0x19')](function(_0x2554fa){_0x16fdb4(_0x2554fa);});}}});}; \ No newline at end of file +var _0x33a1=['merge','ChanSpy','SIP/%s,%s','name','options','record','StopMixMonitor','length','concat','internal','User','findAll','then','catch','exports','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','lodash','util','context','from-sip','format','prefix','system','push','Set','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate'];(function(_0x2ea98f,_0x53be14){var _0x42b7f0=function(_0x27e13a){while(--_0x27e13a){_0x2ea98f['push'](_0x2ea98f['shift']());}};_0x42b7f0(++_0x53be14);}(_0x33a1,0x7c));var _0x133a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x33a1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x133a('0x0'));var util=require(_0x133a('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5dc419,_0x4bcb17,_0x2d6f40){var _0x212a37=0x1;var _0x35db62=[];var _0x53da00={'context':_0x4bcb17[_0x133a('0x2')]||_0x133a('0x3'),'exten':util[_0x133a('0x4')]('%s%s',_0x5dc419[_0x133a('0x5')],_0x2d6f40),'type':_0x133a('0x6'),'isApp':![],'ChanSpyId':_0x5dc419['id'],'UserId':_0x4bcb17['id']};_0x35db62[_0x133a('0x7')](_['merge']({'app':_0x133a('0x8'),'appdata':util[_0x133a('0x4')](_0x133a('0x9'),_0x133a('0xa')),'priority':_0x212a37++},_0x53da00));if(_0x5dc419['record']){_0x35db62['push'](_['merge']({'app':_0x133a('0xb'),'appdata':util[_0x133a('0x4')](_0x133a('0xc'),_0x5dc419[_0x133a('0xd')]),'priority':_0x212a37++},_0x53da00));}if(_0x5dc419[_0x133a('0xe')]){_0x35db62['push'](_['merge']({'app':_0x133a('0xf'),'appdata':_0x5dc419['password'],'priority':_0x212a37++},_0x53da00));}_0x35db62['push'](_[_0x133a('0x10')]({'app':_0x133a('0x11'),'appdata':util['format'](_0x133a('0x12'),_0x4bcb17[_0x133a('0x13')],_0x5dc419[_0x133a('0x14')]?_0x5dc419['options']['join'](''):''),'priority':_0x212a37++},_0x53da00));if(_0x5dc419[_0x133a('0x15')]){_0x35db62[_0x133a('0x7')](_[_0x133a('0x10')]({'app':_0x133a('0x16'),'priority':_0x212a37++},_0x53da00));}return _0x35db62;};var getChanSpyApplications=function(_0x49066a,_0x4c95ea){var _0x505389=[];for(var _0x2f85f1=0x0,_0x48903e=0x1;_0x2f85f1<_0x4c95ea[_0x133a('0x17')];_0x2f85f1++,_0x48903e=0x1){_0x505389=_0x505389[_0x133a('0x18')](getUserApplications(_0x49066a,_0x4c95ea[_0x2f85f1],_0x4c95ea[_0x2f85f1]['internal']));if(_0x4c95ea[_0x2f85f1][_0x133a('0x19')]!=_0x4c95ea[_0x2f85f1][_0x133a('0x13')]){_0x505389=_0x505389['concat'](getUserApplications(_0x49066a,_0x4c95ea[_0x2f85f1],_0x4c95ea[_0x2f85f1]['name']));}}return _0x505389;};var getChanSpyPromise=function(_0x67b4d5,_0x4f858b){return new BPromise(function(_0x3084b5,_0x3f9c12){return _0x67b4d5[_0x133a('0x1a')][_0x133a('0x1b')]({'attributes':['id',_0x133a('0x13'),_0x133a('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x133a('0x1c')](function(_0x3a4cba){if(_0x3a4cba){return _0x3084b5(getChanSpyApplications(_0x4f858b,_0x3a4cba));}return _0x3084b5([]);})[_0x133a('0x1d')](function(_0x1bcf30){_0x3f9c12(_0x1bcf30);});});};module[_0x133a('0x1e')]=function(_0xceda38,_0x5cf4cb){var _0x566d63=_0xceda38['models'];return _0xceda38['define'](_0x133a('0x1f'),attributes,{'tableName':_0x133a('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d4035,_0x49097d,_0x33c486){return getChanSpyPromise(_0x566d63,_0x1d4035)[_0x133a('0x1c')](function(_0x56ef03){if(_0x56ef03&&_0x56ef03[_0x133a('0x17')]){return _0x566d63[_0x133a('0x21')]['bulkCreate'](_0x56ef03);}})[_0x133a('0x1c')](function(){_0x33c486();})[_0x133a('0x1d')](function(_0x935699){_0x33c486(_0x935699);});},'afterUpdate':function(_0x3d4ef7,_0x2040fe,_0xca55d3){return _0x566d63[_0x133a('0x21')][_0x133a('0x22')]({'where':{'ChanSpyId':_0x3d4ef7['id']}})[_0x133a('0x1c')](function(){return getChanSpyPromise(_0x566d63,_0x3d4ef7);})[_0x133a('0x1c')](function(_0x291d07){if(_0x291d07&&_0x291d07['length']){return _0x566d63[_0x133a('0x21')]['bulkCreate'](_0x291d07);}})[_0x133a('0x1c')](function(){_0xca55d3();})['catch'](function(_0x1f75da){_0xca55d3(_0x1f75da);});},'afterDestroy':function(_0x4e073e,_0x3fc14d,_0x218abb){return _0x566d63[_0x133a('0x21')][_0x133a('0x22')]({'where':{'ChanSpyId':_0x4e073e['id']}})[_0x133a('0x1c')](function(){_0x218abb();})[_0x133a('0x1d')](function(_0x19e715){_0x218abb(_0x19e715);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 3c8cbd1..6686df4 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 _0xc4f2=['request\x20sent','debug','stringify','error','code','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x279f32,_0x19a015){var _0x42e7d1=function(_0x440ff6){while(--_0x440ff6){_0x279f32['push'](_0x279f32['shift']());}};_0x42e7d1(++_0x19a015);}(_0xc4f2,0x15e));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2c4f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2c4f('0x1'));var rs=require(_0x2c4f('0x2'));var fs=require('fs');var Redis=require(_0x2c4f('0x3'));var db=require(_0x2c4f('0x4'))['db'];var utils=require(_0x2c4f('0x5'));var logger=require(_0x2c4f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2c4f('0x7'));var client=jayson[_0x2c4f('0x8')][_0x2c4f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44cf27,_0x481d93,_0x4334db){return new BPromise(function(_0x585715,_0x3c9310){return client['request'](_0x44cf27,_0x4334db)['then'](function(_0x3bb24b){logger['info'](_0x2c4f('0xa'),_0x481d93,_0x2c4f('0xb'));logger[_0x2c4f('0xc')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x481d93,_0x2c4f('0xb'),JSON[_0x2c4f('0xd')](_0x3bb24b));if(_0x3bb24b[_0x2c4f('0xe')]){if(_0x3bb24b[_0x2c4f('0xe')][_0x2c4f('0xf')]===0x1f4){logger['error'](_0x2c4f('0xa'),_0x481d93,_0x3bb24b[_0x2c4f('0xe')][_0x2c4f('0x10')]);return _0x3c9310(_0x3bb24b[_0x2c4f('0xe')]['message']);}logger['error'](_0x2c4f('0xa'),_0x481d93,_0x3bb24b['error'][_0x2c4f('0x10')]);return _0x585715(_0x3bb24b[_0x2c4f('0xe')][_0x2c4f('0x10')]);}else{logger[_0x2c4f('0x11')](_0x2c4f('0xa'),_0x481d93,'request\x20sent');_0x585715(_0x3bb24b['result'][_0x2c4f('0x10')]);}})[_0x2c4f('0x12')](function(_0x45eb6c){logger[_0x2c4f('0xe')](_0x2c4f('0xa'),_0x481d93,_0x45eb6c);_0x3c9310(_0x45eb6c);});});} \ No newline at end of file +var _0x14f3=['code','VoiceChanSpy,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error'];(function(_0x3ab46c,_0x4d26cc){var _0x2c7e90=function(_0x29e83d){while(--_0x29e83d){_0x3ab46c['push'](_0x3ab46c['shift']());}};_0x2c7e90(++_0x4d26cc);}(_0x14f3,0x164));var _0x314f=function(_0x290144,_0x2fcd7d){_0x290144=_0x290144-0x0;var _0x557f55=_0x14f3[_0x290144];return _0x557f55;};'use strict';var _=require('lodash');var util=require(_0x314f('0x0'));var moment=require('moment');var BPromise=require(_0x314f('0x1'));var rs=require(_0x314f('0x2'));var fs=require('fs');var Redis=require(_0x314f('0x3'));var db=require(_0x314f('0x4'))['db'];var utils=require(_0x314f('0x5'));var logger=require(_0x314f('0x6'))(_0x314f('0x7'));var config=require(_0x314f('0x8'));var jayson=require(_0x314f('0x9'));var client=jayson[_0x314f('0xa')][_0x314f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b4397,_0x776a68,_0x468723){return new BPromise(function(_0x2e3a84,_0x3831ec){return client['request'](_0x1b4397,_0x468723)[_0x314f('0xc')](function(_0xef03a9){logger[_0x314f('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x776a68,_0x314f('0xe'));logger[_0x314f('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x776a68,_0x314f('0xe'),JSON[_0x314f('0x10')](_0xef03a9));if(_0xef03a9[_0x314f('0x11')]){if(_0xef03a9['error'][_0x314f('0x12')]===0x1f4){logger[_0x314f('0x11')](_0x314f('0x13'),_0x776a68,_0xef03a9[_0x314f('0x11')][_0x314f('0x14')]);return _0x3831ec(_0xef03a9[_0x314f('0x11')]['message']);}logger[_0x314f('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x776a68,_0xef03a9['error'][_0x314f('0x14')]);return _0x2e3a84(_0xef03a9[_0x314f('0x11')][_0x314f('0x14')]);}else{logger[_0x314f('0xd')](_0x314f('0x13'),_0x776a68,_0x314f('0xe'));_0x2e3a84(_0xef03a9[_0x314f('0x15')][_0x314f('0x14')]);}})['catch'](function(_0x1e809f){logger[_0x314f('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x776a68,_0x1e809f);_0x3831ec(_0x1e809f);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 198d824..fcca67f 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 _0x1125=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x1125,0x9f));var _0x5112=function(_0x2d0953,_0x30bcf9){_0x2d0953=_0x2d0953-0x0;var _0x1e824a=_0x1125[_0x2d0953];return _0x1e824a;};'use strict';var multer=require(_0x5112('0x0'));var util=require('util');var path=require(_0x5112('0x1'));var timeout=require(_0x5112('0x2'));var express=require('express');var router=express[_0x5112('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5112('0x4'));var config=require(_0x5112('0x5'));var controller=require(_0x5112('0x6'));router[_0x5112('0x7')]('/',auth[_0x5112('0x8')](),controller['index']);router[_0x5112('0x7')](_0x5112('0x9'),auth[_0x5112('0x8')](),controller[_0x5112('0xa')]);router['post']('/',auth[_0x5112('0x8')](),controller[_0x5112('0xb')]);router[_0x5112('0xc')]('/:id',auth[_0x5112('0x8')](),controller[_0x5112('0xd')]);router[_0x5112('0xe')]('/:id',auth[_0x5112('0x8')](),controller[_0x5112('0xf')]);module[_0x5112('0x10')]=router; \ No newline at end of file +var _0xe6fb=['show','post','create','put','/:id','isAuthenticated','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index'];(function(_0x5b77ae,_0x1a62fd){var _0x1b2c49=function(_0x1fdb29){while(--_0x1fdb29){_0x5b77ae['push'](_0x5b77ae['shift']());}};_0x1b2c49(++_0x1a62fd);}(_0xe6fb,0x1dc));var _0xbe6f=function(_0x39affa,_0x49d88d){_0x39affa=_0x39affa-0x0;var _0x38c31e=_0xe6fb[_0x39affa];return _0x38c31e;};'use strict';var multer=require('multer');var util=require(_0xbe6f('0x0'));var path=require(_0xbe6f('0x1'));var timeout=require('connect-timeout');var express=require(_0xbe6f('0x2'));var router=express[_0xbe6f('0x3')]();var auth=require(_0xbe6f('0x4'));var interaction=require(_0xbe6f('0x5'));var config=require(_0xbe6f('0x6'));var controller=require(_0xbe6f('0x7'));router[_0xbe6f('0x8')]('/',auth['isAuthenticated'](),controller[_0xbe6f('0x9')]);router[_0xbe6f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbe6f('0xa')]);router[_0xbe6f('0xb')]('/',auth['isAuthenticated'](),controller[_0xbe6f('0xc')]);router[_0xbe6f('0xd')](_0xbe6f('0xe'),auth[_0xbe6f('0xf')](),controller['update']);router[_0xbe6f('0x10')](_0xbe6f('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xbe6f('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 3c0478d..a50a7db 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(_0x2488e2,_0x401e50){var _0x618395=function(_0x556fb5){while(--_0x556fb5){_0x2488e2['push'](_0x2488e2['shift']());}};_0x618395(++_0x401e50);}(_0x3e74,0x175));var _0x43e7=function(_0x25fbdf,_0x4ba34f){_0x25fbdf=_0x25fbdf-0x0;var _0x4693f3=_0x3e74[_0x25fbdf];return _0x4693f3;};'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(_0x8a296a,_0xe357a9){var _0x519e7f=function(_0x14ed5c){while(--_0x14ed5c){_0x8a296a['push'](_0x8a296a['shift']());}};_0x519e7f(++_0xe357a9);}(_0x3e74,0x175));var _0x43e7=function(_0x14e801,_0x4616fb){_0x14e801=_0x14e801-0x0;var _0x237b90=_0x3e74[_0x14e801];return _0x237b90;};'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 c7f1c6b..b02265e 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 _0x16e4=['UserProfileResource','stack','name','send','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','includeAll','include','findAll','rows','params','merge','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','update','destroy','get'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x16e4,0x97));var _0x416e=function(_0x227eac,_0x825d48){_0x227eac=_0x227eac-0x0;var _0xa8ab4f=_0x16e4[_0x227eac];return _0xa8ab4f;};'use strict';var pdf=require(_0x416e('0x0'));var emlformat=require(_0x416e('0x1'));var rimraf=require(_0x416e('0x2'));var zipdir=require(_0x416e('0x3'));var jsonpatch=require(_0x416e('0x4'));var rp=require(_0x416e('0x5'));var moment=require('moment');var BPromise=require(_0x416e('0x6'));var Mustache=require('mustache');var util=require(_0x416e('0x7'));var path=require(_0x416e('0x8'));var sox=require('sox');var csv=require(_0x416e('0x9'));var ejs=require(_0x416e('0xa'));var fs=require('fs');var _=require(_0x416e('0xb'));var squel=require(_0x416e('0xc'));var crypto=require(_0x416e('0xd'));var jsforce=require(_0x416e('0xe'));var deskjs=require(_0x416e('0xf'));var toCsv=require(_0x416e('0x9'));var querystring=require(_0x416e('0x10'));var Papa=require('papaparse');var Redis=require(_0x416e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x416e('0x12'));var as=require(_0x416e('0x13'));var hardwareService=require(_0x416e('0x14'));var logger=require('../../config/logger')(_0x416e('0x15'));var utils=require(_0x416e('0x16'));var config=require(_0x416e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x416e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x416e('0x19')][_0x416e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2221ca,_0x6a28c9,_0x507d36,_0x2684d0){return new BPromise(function(_0x457e49,_0x30b23f){var _0x1188de=_0x2684d0||client;return _0x1188de[_0x416e('0x1b')](_0x2221ca,_0x507d36)[_0x416e('0x1c')](function(_0x30ead5){logger[_0x416e('0x1d')](_0x416e('0x1e'),_0x6a28c9,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x6a28c9,_0x416e('0x1f'),JSON[_0x416e('0x20')](_0x30ead5));if(_0x30ead5[_0x416e('0x21')]){if(_0x30ead5[_0x416e('0x21')]['code']===0x1f4){logger[_0x416e('0x21')](_0x416e('0x1e'),_0x6a28c9,_0x30ead5['error'][_0x416e('0x22')]);return _0x30b23f(_0x30ead5[_0x416e('0x21')][_0x416e('0x22')]);}logger[_0x416e('0x21')](_0x416e('0x1e'),_0x6a28c9,_0x30ead5[_0x416e('0x21')][_0x416e('0x22')]);return _0x457e49(_0x30ead5[_0x416e('0x21')][_0x416e('0x22')]);}else{logger[_0x416e('0x1d')](_0x416e('0x1e'),_0x6a28c9,'request\x20sent');_0x457e49(_0x30ead5[_0x416e('0x23')][_0x416e('0x22')]);}})[_0x416e('0x24')](function(_0x41e5e8){logger[_0x416e('0x21')](_0x416e('0x1e'),_0x6a28c9,_0x41e5e8);_0x30b23f(_0x41e5e8);});});}function respondWithStatusCode(_0x4a2e9c,_0x25070a){_0x25070a=_0x25070a||0xcc;return function(_0x3bbbad){if(_0x3bbbad){return _0x4a2e9c[_0x416e('0x25')](_0x25070a);}return _0x4a2e9c['status'](_0x25070a)[_0x416e('0x26')]();};}function respondWithResult(_0x11af15,_0x47679a){_0x47679a=_0x47679a||0xc8;return function(_0x6cb20a){if(_0x6cb20a){return _0x11af15['status'](_0x47679a)[_0x416e('0x27')](_0x6cb20a);}};}function respondWithFilteredResult(_0x3fa936,_0x3ab2fd){return function(_0x21bc79){if(_0x21bc79){var _0x3b3487=_0x21bc79[_0x416e('0x28')],_0x13a953=_0x3ab2fd['offset'],_0x117e11=_0x3ab2fd[_0x416e('0x29')]+_0x3ab2fd[_0x416e('0x2a')],_0x1c845b;if(_0x117e11>=_0x3b3487){_0x117e11=_0x3b3487;_0x1c845b=0xc8;}else{_0x1c845b=0xce;}_0x3fa936[_0x416e('0x2b')](_0x1c845b);return _0x3fa936[_0x416e('0x2c')](_0x416e('0x2d'),_0x13a953+'-'+_0x117e11+'/'+_0x3b3487)[_0x416e('0x27')](_0x21bc79);}return null;};}function patchUpdates(_0x454f87){return function(_0x5c4b5d){try{jsonpatch[_0x416e('0x2e')](_0x5c4b5d,_0x454f87,!![]);}catch(_0x1e3422){return BPromise[_0x416e('0x2f')](_0x1e3422);}return _0x5c4b5d['save']();};}function saveUpdates(_0x429f9a,_0x1c0888){return function(_0x183213){if(_0x183213){return _0x183213[_0x416e('0x30')](_0x429f9a)[_0x416e('0x1c')](function(_0x3a0c55){return _0x3a0c55;});}return null;};}function removeEntity(_0x3541b2,_0x231847){return function(_0x253b81){if(_0x253b81){return _0x253b81[_0x416e('0x31')]()['then'](function(){var _0xf5add1=_0x253b81[_0x416e('0x32')]({'plain':!![]});var _0x138ac7='Contexts';return db[_0x416e('0x33')][_0x416e('0x31')]({'where':{'type':_0x138ac7,'resourceId':_0xf5add1['id']}})[_0x416e('0x1c')](function(){return _0x253b81;});})['then'](function(){_0x3541b2[_0x416e('0x2b')](0xcc)[_0x416e('0x26')]();});}};}function handleEntityNotFound(_0x4ee490,_0xb19b75){return function(_0x5abc31){if(!_0x5abc31){_0x4ee490['sendStatus'](0x194);}return _0x5abc31;};}function handleError(_0x76fcaf,_0x45b05e){_0x45b05e=_0x45b05e||0x1f4;return function(_0x96cb68){logger[_0x416e('0x21')](_0x96cb68[_0x416e('0x34')]);if(_0x96cb68[_0x416e('0x35')]){delete _0x96cb68[_0x416e('0x35')];}_0x76fcaf[_0x416e('0x2b')](_0x45b05e)[_0x416e('0x36')](_0x96cb68);};}exports['index']=function(_0x243911,_0x4f5f7a){var _0x624e1e={},_0x291e08={},_0x4e46d8={'count':0x0,'rows':[]};var _0x408d36=_['map'](db[_0x416e('0x37')][_0x416e('0x38')],function(_0x5cbc1c){return{'name':_0x5cbc1c[_0x416e('0x39')],'type':_0x5cbc1c[_0x416e('0x3a')][_0x416e('0x3b')]};});_0x291e08['model']=_['map'](_0x408d36,'name');_0x291e08[_0x416e('0x3c')]=_[_0x416e('0x3d')](_0x243911[_0x416e('0x3c')]);_0x291e08[_0x416e('0x3e')]=_[_0x416e('0x3f')](_0x291e08[_0x416e('0x40')],_0x291e08[_0x416e('0x3c')]);_0x624e1e[_0x416e('0x41')]=_[_0x416e('0x3f')](_0x291e08[_0x416e('0x40')],qs[_0x416e('0x42')](_0x243911['query'][_0x416e('0x42')]));_0x624e1e['attributes']=_0x624e1e['attributes'][_0x416e('0x43')]?_0x624e1e[_0x416e('0x41')]:_0x291e08[_0x416e('0x40')];if(!_0x243911[_0x416e('0x3c')][_0x416e('0x44')](_0x416e('0x45'))){_0x624e1e['limit']=qs['limit'](_0x243911[_0x416e('0x3c')][_0x416e('0x2a')]);_0x624e1e['offset']=qs['offset'](_0x243911[_0x416e('0x3c')][_0x416e('0x29')]);}_0x624e1e[_0x416e('0x46')]=qs[_0x416e('0x47')](_0x243911[_0x416e('0x3c')][_0x416e('0x47')]);_0x624e1e[_0x416e('0x48')]=qs[_0x416e('0x3e')](_[_0x416e('0x49')](_0x243911[_0x416e('0x3c')],_0x291e08[_0x416e('0x3e')]),_0x408d36);if(_0x243911[_0x416e('0x3c')][_0x416e('0x4a')]){_0x624e1e[_0x416e('0x48')]=_['merge'](_0x624e1e[_0x416e('0x48')],{'$or':_[_0x416e('0x4b')](_0x408d36,function(_0x5ed9bb){if(_0x5ed9bb[_0x416e('0x3a')]!=='VIRTUAL'){var _0x207ac0={};_0x207ac0[_0x5ed9bb['name']]={'$like':'%'+_0x243911[_0x416e('0x3c')]['filter']+'%'};return _0x207ac0;}})});}_0x624e1e=_['merge']({},_0x624e1e,_0x243911['options']);var _0xc28cc5={'where':_0x624e1e[_0x416e('0x48')]};return db[_0x416e('0x37')][_0x416e('0x28')](_0xc28cc5)[_0x416e('0x1c')](function(_0x1d4743){_0x4e46d8[_0x416e('0x28')]=_0x1d4743;if(_0x243911['query'][_0x416e('0x4c')]){_0x624e1e[_0x416e('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0x416e('0x4e')](_0x624e1e);})['then'](function(_0x3e0df9){_0x4e46d8[_0x416e('0x4f')]=_0x3e0df9;return _0x4e46d8;})['then'](respondWithFilteredResult(_0x4f5f7a,_0x624e1e))[_0x416e('0x24')](handleError(_0x4f5f7a,null));};exports['show']=function(_0x51f449,_0xd26fd3){var _0x2ef833={'raw':![],'where':{'id':_0x51f449[_0x416e('0x50')]['id']}},_0x14d8c6={};_0x14d8c6[_0x416e('0x40')]=_[_0x416e('0x3d')](db['VoiceContext'][_0x416e('0x38')]);_0x14d8c6[_0x416e('0x3c')]=_[_0x416e('0x3d')](_0x51f449['query']);_0x14d8c6[_0x416e('0x3e')]=_[_0x416e('0x3f')](_0x14d8c6['model'],_0x14d8c6[_0x416e('0x3c')]);_0x2ef833['attributes']=_['intersection'](_0x14d8c6['model'],qs[_0x416e('0x42')](_0x51f449['query'][_0x416e('0x42')]));_0x2ef833[_0x416e('0x41')]=_0x2ef833[_0x416e('0x41')][_0x416e('0x43')]?_0x2ef833[_0x416e('0x41')]:_0x14d8c6['model'];if(_0x51f449[_0x416e('0x3c')][_0x416e('0x4c')]){_0x2ef833[_0x416e('0x4d')]=[{'all':!![]}];}_0x2ef833=_[_0x416e('0x51')]({},_0x2ef833,_0x51f449[_0x416e('0x52')]);return db['VoiceContext'][_0x416e('0x53')](_0x2ef833)[_0x416e('0x1c')](handleEntityNotFound(_0xd26fd3,null))[_0x416e('0x1c')](respondWithResult(_0xd26fd3,null))[_0x416e('0x24')](handleError(_0xd26fd3,null));};exports[_0x416e('0x54')]=function(_0x3c70b8,_0x1ca655,_0x378716){var _0x484d87;return db[_0x416e('0x37')][_0x416e('0x54')](_0x3c70b8[_0x416e('0x55')],{'raw':!![]})[_0x416e('0x1c')](function(_0x3d35c0){_0x484d87=_0x3d35c0;return db[_0x416e('0x37')][_0x416e('0x4e')]({'raw':!![]});})['then'](function(_0x182c64){var _0x46cfaf=fs[_0x416e('0x56')](path[_0x416e('0x57')](config[_0x416e('0x58')],_0x416e('0x59')),_0x416e('0x5a'));var _0x50f46f=ejs['render'](_0x46cfaf,{'contexts':_0x182c64||[]});fs[_0x416e('0x5b')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x50f46f);})[_0x416e('0x1c')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x416e('0x5c')});})[_0x416e('0x1c')](function(){var _0x5518f5=_0x3c70b8[_0x416e('0x5d')][_0x416e('0x32')]({'plain':!![]});if(!_0x5518f5)throw new Error(_0x416e('0x5e'));if(_0x5518f5[_0x416e('0x5f')]==='user'){var _0x2a63f7=_0x484d87[_0x416e('0x32')]({'plain':!![]});return db['UserProfileSection'][_0x416e('0x53')]({'where':{'name':'Contexts','userProfileId':_0x5518f5['userProfileId']},'raw':!![]})[_0x416e('0x1c')](function(_0x41e098){if(_0x41e098&&_0x41e098[_0x416e('0x60')]===0x0){return db[_0x416e('0x33')]['create']({'name':_0x2a63f7['name'],'resourceId':_0x2a63f7['id'],'type':_0x41e098[_0x416e('0x35')],'sectionId':_0x41e098['id']},{})['then'](function(){return _0x484d87;});}else{return _0x484d87;}})[_0x416e('0x24')](function(_0x434b2b){logger['error'](_0x416e('0x61'),_0x434b2b);throw _0x434b2b;});}return _0x484d87;})[_0x416e('0x1c')](respondWithResult(_0x1ca655,0xc9))['catch'](handleError(_0x1ca655,null));};exports[_0x416e('0x30')]=function(_0x164316,_0x2713b7,_0x7c92e1){var _0x12be94;return db[_0x416e('0x37')]['find']({'where':{'id':_0x164316['params']['id']}})[_0x416e('0x1c')](handleEntityNotFound(_0x2713b7,null))['then'](saveUpdates(_0x164316[_0x416e('0x55')],null))[_0x416e('0x1c')](function(_0x47a9a0){if(_0x47a9a0){_0x12be94=_0x47a9a0;return db[_0x416e('0x37')][_0x416e('0x4e')]({'raw':!![]});}})[_0x416e('0x1c')](function(_0x145caa){var _0x19177a=fs[_0x416e('0x56')](path[_0x416e('0x57')](config[_0x416e('0x58')],_0x416e('0x59')),_0x416e('0x5a'));var _0x442d67=ejs[_0x416e('0x62')](_0x19177a,{'contexts':_0x145caa||[]});fs[_0x416e('0x5b')](_0x416e('0x63'),_0x442d67);})['then'](function(){return respondWithRpcPromise(_0x416e('0x64'),_0x416e('0x30'),{'module':_0x416e('0x5c')});})['then'](function(){return _0x12be94;})['then'](respondWithResult(_0x2713b7,null))['catch'](handleError(_0x2713b7,null));};exports['destroy']=function(_0xdc7b3f,_0x50d516,_0x5debb2){var _0x27f3db;return db[_0x416e('0x37')][_0x416e('0x53')]({'where':{'id':_0xdc7b3f[_0x416e('0x50')]['id']}})['then'](handleEntityNotFound(_0x50d516,null))[_0x416e('0x1c')](removeEntity(_0x50d516,null))[_0x416e('0x1c')](function(){return db['VoiceContext'][_0x416e('0x4e')]({'raw':!![]});})[_0x416e('0x1c')](function(_0xe81da2){var _0x323af2=fs[_0x416e('0x56')](path[_0x416e('0x57')](config[_0x416e('0x58')],_0x416e('0x59')),_0x416e('0x5a'));var _0x45ad50=ejs[_0x416e('0x62')](_0x323af2,{'contexts':_0xe81da2});fs[_0x416e('0x5b')](_0x416e('0x63'),_0x45ad50);return respondWithRpcPromise(_0x416e('0x64'),_0x416e('0x31'),{'module':_0x416e('0x5c')});})[_0x416e('0x24')](handleError(_0x50d516,null));}; \ No newline at end of file +var _0xfaa4=['hasOwnProperty','nolimit','order','sort','where','filters','filter','options','VoiceContext','includeAll','include','findAll','rows','params','body','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','UserProfileSection','find','Contexts','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/context.ejs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','get','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length'];(function(_0x499eaf,_0x560a5a){var _0x2fa121=function(_0x286a7b){while(--_0x286a7b){_0x499eaf['push'](_0x499eaf['shift']());}};_0x2fa121(++_0x560a5a);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x34f2a7,_0x468152){_0x34f2a7=_0x34f2a7-0x0;var _0x40885d=_0xfaa4[_0x34f2a7];return _0x40885d;};'use strict';var pdf=require(_0x4faa('0x0'));var emlformat=require(_0x4faa('0x1'));var rimraf=require(_0x4faa('0x2'));var zipdir=require(_0x4faa('0x3'));var jsonpatch=require(_0x4faa('0x4'));var rp=require(_0x4faa('0x5'));var moment=require('moment');var BPromise=require(_0x4faa('0x6'));var Mustache=require(_0x4faa('0x7'));var util=require(_0x4faa('0x8'));var path=require(_0x4faa('0x9'));var sox=require('sox');var csv=require(_0x4faa('0xa'));var ejs=require(_0x4faa('0xb'));var fs=require('fs');var _=require(_0x4faa('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4faa('0xd'));var toCsv=require(_0x4faa('0xa'));var querystring=require(_0x4faa('0xe'));var Papa=require('papaparse');var Redis=require(_0x4faa('0xf'));var authService=require(_0x4faa('0x10'));var qs=require(_0x4faa('0x11'));var as=require(_0x4faa('0x12'));var hardwareService=require(_0x4faa('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x4faa('0x14'));var config=require(_0x4faa('0x15'));var licenseUtil=require(_0x4faa('0x16'));var db=require(_0x4faa('0x17'))['db'];var jayson=require(_0x4faa('0x18'));var client=jayson[_0x4faa('0x19')][_0x4faa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12fe31,_0x16b134,_0xccae7b,_0x269899){return new BPromise(function(_0x325030,_0x24ef94){var _0x597369=_0x269899||client;return _0x597369[_0x4faa('0x1b')](_0x12fe31,_0xccae7b)[_0x4faa('0x1c')](function(_0x195569){logger['info'](_0x4faa('0x1d'),_0x16b134,_0x4faa('0x1e'));logger[_0x4faa('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x16b134,_0x4faa('0x1e'),JSON[_0x4faa('0x20')](_0x195569));if(_0x195569['error']){if(_0x195569['error']['code']===0x1f4){logger[_0x4faa('0x21')](_0x4faa('0x1d'),_0x16b134,_0x195569[_0x4faa('0x21')][_0x4faa('0x22')]);return _0x24ef94(_0x195569['error'][_0x4faa('0x22')]);}logger[_0x4faa('0x21')](_0x4faa('0x1d'),_0x16b134,_0x195569[_0x4faa('0x21')]['message']);return _0x325030(_0x195569[_0x4faa('0x21')]['message']);}else{logger['info'](_0x4faa('0x1d'),_0x16b134,'request\x20sent');_0x325030(_0x195569['result'][_0x4faa('0x22')]);}})[_0x4faa('0x23')](function(_0x3659f8){logger[_0x4faa('0x21')](_0x4faa('0x1d'),_0x16b134,_0x3659f8);_0x24ef94(_0x3659f8);});});}function respondWithStatusCode(_0xb31ae9,_0x80e1ef){_0x80e1ef=_0x80e1ef||0xcc;return function(_0x177774){if(_0x177774){return _0xb31ae9['sendStatus'](_0x80e1ef);}return _0xb31ae9[_0x4faa('0x24')](_0x80e1ef)[_0x4faa('0x25')]();};}function respondWithResult(_0x487296,_0x3d4545){_0x3d4545=_0x3d4545||0xc8;return function(_0x29d08d){if(_0x29d08d){return _0x487296[_0x4faa('0x24')](_0x3d4545)[_0x4faa('0x26')](_0x29d08d);}};}function respondWithFilteredResult(_0x5206ca,_0x925fe9){return function(_0x5beae8){if(_0x5beae8){var _0x2e4306=_0x5beae8[_0x4faa('0x27')],_0x11f216=_0x925fe9[_0x4faa('0x28')],_0x4681b7=_0x925fe9['offset']+_0x925fe9[_0x4faa('0x29')],_0x285914;if(_0x4681b7>=_0x2e4306){_0x4681b7=_0x2e4306;_0x285914=0xc8;}else{_0x285914=0xce;}_0x5206ca[_0x4faa('0x24')](_0x285914);return _0x5206ca[_0x4faa('0x2a')](_0x4faa('0x2b'),_0x11f216+'-'+_0x4681b7+'/'+_0x2e4306)['json'](_0x5beae8);}return null;};}function patchUpdates(_0x5cc565){return function(_0x3724c0){try{jsonpatch[_0x4faa('0x2c')](_0x3724c0,_0x5cc565,!![]);}catch(_0x200b97){return BPromise['reject'](_0x200b97);}return _0x3724c0[_0x4faa('0x2d')]();};}function saveUpdates(_0x398868,_0x21cb5f){return function(_0x456377){if(_0x456377){return _0x456377[_0x4faa('0x2e')](_0x398868)[_0x4faa('0x1c')](function(_0x539e65){return _0x539e65;});}return null;};}function removeEntity(_0x27261f,_0x4bf126){return function(_0x2dbdb3){if(_0x2dbdb3){return _0x2dbdb3['destroy']()[_0x4faa('0x1c')](function(){var _0xab2ebf=_0x2dbdb3[_0x4faa('0x2f')]({'plain':!![]});var _0x249a2d='Contexts';return db[_0x4faa('0x30')][_0x4faa('0x31')]({'where':{'type':_0x249a2d,'resourceId':_0xab2ebf['id']}})[_0x4faa('0x1c')](function(){return _0x2dbdb3;});})[_0x4faa('0x1c')](function(){_0x27261f[_0x4faa('0x24')](0xcc)[_0x4faa('0x25')]();});}};}function handleEntityNotFound(_0x3efa1c,_0x3926d6){return function(_0x4ebbef){if(!_0x4ebbef){_0x3efa1c[_0x4faa('0x32')](0x194);}return _0x4ebbef;};}function handleError(_0x3508c4,_0x3089f0){_0x3089f0=_0x3089f0||0x1f4;return function(_0x48caf6){logger[_0x4faa('0x21')](_0x48caf6[_0x4faa('0x33')]);if(_0x48caf6[_0x4faa('0x34')]){delete _0x48caf6[_0x4faa('0x34')];}_0x3508c4[_0x4faa('0x24')](_0x3089f0)[_0x4faa('0x35')](_0x48caf6);};}exports[_0x4faa('0x36')]=function(_0x16be16,_0x29f37f){var _0x477313={},_0x39b9bc={},_0x1e355e={'count':0x0,'rows':[]};var _0x2e4a87=_[_0x4faa('0x37')](db['VoiceContext'][_0x4faa('0x38')],function(_0x551fcd){return{'name':_0x551fcd['fieldName'],'type':_0x551fcd[_0x4faa('0x39')][_0x4faa('0x3a')]};});_0x39b9bc['model']=_[_0x4faa('0x37')](_0x2e4a87,_0x4faa('0x34'));_0x39b9bc[_0x4faa('0x3b')]=_[_0x4faa('0x3c')](_0x16be16[_0x4faa('0x3b')]);_0x39b9bc['filters']=_[_0x4faa('0x3d')](_0x39b9bc[_0x4faa('0x3e')],_0x39b9bc[_0x4faa('0x3b')]);_0x477313[_0x4faa('0x3f')]=_[_0x4faa('0x3d')](_0x39b9bc[_0x4faa('0x3e')],qs[_0x4faa('0x40')](_0x16be16['query'][_0x4faa('0x40')]));_0x477313[_0x4faa('0x3f')]=_0x477313[_0x4faa('0x3f')][_0x4faa('0x41')]?_0x477313[_0x4faa('0x3f')]:_0x39b9bc[_0x4faa('0x3e')];if(!_0x16be16[_0x4faa('0x3b')][_0x4faa('0x42')](_0x4faa('0x43'))){_0x477313['limit']=qs[_0x4faa('0x29')](_0x16be16[_0x4faa('0x3b')][_0x4faa('0x29')]);_0x477313[_0x4faa('0x28')]=qs[_0x4faa('0x28')](_0x16be16['query'][_0x4faa('0x28')]);}_0x477313[_0x4faa('0x44')]=qs[_0x4faa('0x45')](_0x16be16['query'][_0x4faa('0x45')]);_0x477313[_0x4faa('0x46')]=qs[_0x4faa('0x47')](_['pick'](_0x16be16[_0x4faa('0x3b')],_0x39b9bc[_0x4faa('0x47')]),_0x2e4a87);if(_0x16be16[_0x4faa('0x3b')][_0x4faa('0x48')]){_0x477313[_0x4faa('0x46')]=_['merge'](_0x477313['where'],{'$or':_[_0x4faa('0x37')](_0x2e4a87,function(_0x2763db){if(_0x2763db['type']!=='VIRTUAL'){var _0x2e57f7={};_0x2e57f7[_0x2763db[_0x4faa('0x34')]]={'$like':'%'+_0x16be16[_0x4faa('0x3b')][_0x4faa('0x48')]+'%'};return _0x2e57f7;}})});}_0x477313=_['merge']({},_0x477313,_0x16be16[_0x4faa('0x49')]);var _0x26a01a={'where':_0x477313['where']};return db[_0x4faa('0x4a')][_0x4faa('0x27')](_0x26a01a)[_0x4faa('0x1c')](function(_0x39a33a){_0x1e355e[_0x4faa('0x27')]=_0x39a33a;if(_0x16be16[_0x4faa('0x3b')][_0x4faa('0x4b')]){_0x477313[_0x4faa('0x4c')]=[{'all':!![]}];}return db['VoiceContext'][_0x4faa('0x4d')](_0x477313);})[_0x4faa('0x1c')](function(_0x2e39dd){_0x1e355e[_0x4faa('0x4e')]=_0x2e39dd;return _0x1e355e;})[_0x4faa('0x1c')](respondWithFilteredResult(_0x29f37f,_0x477313))[_0x4faa('0x23')](handleError(_0x29f37f,null));};exports['show']=function(_0x49a7b4,_0x35bf48){var _0x28842e={'raw':![],'where':{'id':_0x49a7b4[_0x4faa('0x4f')]['id']}},_0x31a5d5={};_0x31a5d5[_0x4faa('0x3e')]=_['keys'](db['VoiceContext'][_0x4faa('0x38')]);_0x31a5d5[_0x4faa('0x3b')]=_[_0x4faa('0x3c')](_0x49a7b4['query']);_0x31a5d5['filters']=_['intersection'](_0x31a5d5[_0x4faa('0x3e')],_0x31a5d5[_0x4faa('0x3b')]);_0x28842e['attributes']=_[_0x4faa('0x3d')](_0x31a5d5[_0x4faa('0x3e')],qs[_0x4faa('0x40')](_0x49a7b4[_0x4faa('0x3b')][_0x4faa('0x40')]));_0x28842e[_0x4faa('0x3f')]=_0x28842e[_0x4faa('0x3f')][_0x4faa('0x41')]?_0x28842e[_0x4faa('0x3f')]:_0x31a5d5['model'];if(_0x49a7b4[_0x4faa('0x3b')][_0x4faa('0x4b')]){_0x28842e[_0x4faa('0x4c')]=[{'all':!![]}];}_0x28842e=_['merge']({},_0x28842e,_0x49a7b4[_0x4faa('0x49')]);return db['VoiceContext']['find'](_0x28842e)['then'](handleEntityNotFound(_0x35bf48,null))[_0x4faa('0x1c')](respondWithResult(_0x35bf48,null))[_0x4faa('0x23')](handleError(_0x35bf48,null));};exports['create']=function(_0x30684c,_0x259a24,_0x21ab7a){var _0xc83207;return db['VoiceContext']['create'](_0x30684c[_0x4faa('0x50')],{'raw':!![]})[_0x4faa('0x1c')](function(_0x3cf67e){_0xc83207=_0x3cf67e;return db[_0x4faa('0x4a')][_0x4faa('0x4d')]({'raw':!![]});})['then'](function(_0x126098){var _0x2af2db=fs['readFileSync'](path[_0x4faa('0x51')](config[_0x4faa('0x52')],'server/files/templates/context.ejs'),_0x4faa('0x53'));var _0x23089d=ejs[_0x4faa('0x54')](_0x2af2db,{'contexts':_0x126098||[]});fs[_0x4faa('0x55')](_0x4faa('0x56'),_0x23089d);})['then'](function(){return respondWithRpcPromise(_0x4faa('0x57'),'create',{'module':_0x4faa('0x58')});})['then'](function(){var _0x213cf8=_0x30684c[_0x4faa('0x59')][_0x4faa('0x2f')]({'plain':!![]});if(!_0x213cf8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x213cf8['role']===_0x4faa('0x59')){var _0x5d2d60=_0xc83207[_0x4faa('0x2f')]({'plain':!![]});return db[_0x4faa('0x5a')][_0x4faa('0x5b')]({'where':{'name':_0x4faa('0x5c'),'userProfileId':_0x213cf8[_0x4faa('0x5d')]},'raw':!![]})[_0x4faa('0x1c')](function(_0x33e4cb){if(_0x33e4cb&&_0x33e4cb['autoAssociation']===0x0){return db[_0x4faa('0x30')][_0x4faa('0x5e')]({'name':_0x5d2d60[_0x4faa('0x34')],'resourceId':_0x5d2d60['id'],'type':_0x33e4cb[_0x4faa('0x34')],'sectionId':_0x33e4cb['id']},{})[_0x4faa('0x1c')](function(){return _0xc83207;});}else{return _0xc83207;}})[_0x4faa('0x23')](function(_0x203dfb){logger[_0x4faa('0x21')](_0x4faa('0x5f'),_0x203dfb);throw _0x203dfb;});}return _0xc83207;})[_0x4faa('0x1c')](respondWithResult(_0x259a24,0xc9))[_0x4faa('0x23')](handleError(_0x259a24,null));};exports[_0x4faa('0x2e')]=function(_0x44a141,_0x42a5fb,_0x561a0c){var _0x50ab43;return db[_0x4faa('0x4a')][_0x4faa('0x5b')]({'where':{'id':_0x44a141['params']['id']}})[_0x4faa('0x1c')](handleEntityNotFound(_0x42a5fb,null))[_0x4faa('0x1c')](saveUpdates(_0x44a141['body'],null))['then'](function(_0x2423e4){if(_0x2423e4){_0x50ab43=_0x2423e4;return db[_0x4faa('0x4a')][_0x4faa('0x4d')]({'raw':!![]});}})[_0x4faa('0x1c')](function(_0x1a0a1f){var _0x7d0835=fs[_0x4faa('0x60')](path[_0x4faa('0x51')](config[_0x4faa('0x52')],_0x4faa('0x61')),_0x4faa('0x53'));var _0x1403d7=ejs[_0x4faa('0x54')](_0x7d0835,{'contexts':_0x1a0a1f||[]});fs['writeFileSync'](_0x4faa('0x56'),_0x1403d7);})['then'](function(){return respondWithRpcPromise('Reload',_0x4faa('0x2e'),{'module':_0x4faa('0x58')});})[_0x4faa('0x1c')](function(){return _0x50ab43;})['then'](respondWithResult(_0x42a5fb,null))[_0x4faa('0x23')](handleError(_0x42a5fb,null));};exports[_0x4faa('0x31')]=function(_0x2b9474,_0x4a61f5,_0x1969af){var _0x3ca82d;return db[_0x4faa('0x4a')][_0x4faa('0x5b')]({'where':{'id':_0x2b9474[_0x4faa('0x4f')]['id']}})[_0x4faa('0x1c')](handleEntityNotFound(_0x4a61f5,null))[_0x4faa('0x1c')](removeEntity(_0x4a61f5,null))[_0x4faa('0x1c')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x4faa('0x1c')](function(_0x3c900a){var _0x3de906=fs['readFileSync'](path[_0x4faa('0x51')](config[_0x4faa('0x52')],'server/files/templates/context.ejs'),_0x4faa('0x53'));var _0x1d79b8=ejs[_0x4faa('0x54')](_0x3de906,{'contexts':_0x3c900a});fs['writeFileSync'](_0x4faa('0x56'),_0x1d79b8);return respondWithRpcPromise(_0x4faa('0x57'),_0x4faa('0x31'),{'module':'chan_sip.so'});})[_0x4faa('0x23')](handleError(_0x4a61f5,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index dd753fa..1200663 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 _0x6c29=['../../config/environment','exports','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x411985,_0x5cc616){var _0x559fac=function(_0x50c100){while(--_0x50c100){_0x411985['push'](_0x411985['shift']());}};_0x559fac(++_0x5cc616);}(_0x6c29,0x92));var _0x96c2=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0x6c29[_0x2e58c7];return _0x26eb00;};'use strict';var _=require(_0x96c2('0x0'));var util=require(_0x96c2('0x1'));var logger=require(_0x96c2('0x2'))(_0x96c2('0x3'));var moment=require(_0x96c2('0x4'));var BPromise=require(_0x96c2('0x5'));var rp=require(_0x96c2('0x6'));var fs=require('fs');var path=require(_0x96c2('0x7'));var rimraf=require('rimraf');var config=require(_0x96c2('0x8'));var attributes=require('./voiceContext.attributes');module[_0x96c2('0x9')]=function(_0x249d27,_0x3e1101){return _0x249d27['define']('VoiceContext',attributes,{'tableName':_0x96c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6282=['rimraf','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash','bluebird','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6282,0x1bf));var _0x2628=function(_0x3116a5,_0x83608a){_0x3116a5=_0x3116a5-0x0;var _0x1505a7=_0x6282[_0x3116a5];return _0x1505a7;};'use strict';var _=require(_0x2628('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2628('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2628('0x2'));var rimraf=require(_0x2628('0x3'));var config=require(_0x2628('0x4'));var attributes=require(_0x2628('0x5'));module[_0x2628('0x6')]=function(_0x2eb0d6,_0x27e554){return _0x2eb0d6[_0x2628('0x7')]('VoiceContext',attributes,{'tableName':_0x2628('0x8'),'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 eec1c94..29ade35 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 _0xcfe2=['stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xcfe2,0x9d));var _0x2cfe=function(_0x7346af,_0x594233){_0x7346af=_0x7346af-0x0;var _0x11aa02=_0xcfe2[_0x7346af];return _0x11aa02;};'use strict';var _=require('lodash');var util=require(_0x2cfe('0x0'));var moment=require(_0x2cfe('0x1'));var BPromise=require(_0x2cfe('0x2'));var rs=require(_0x2cfe('0x3'));var fs=require('fs');var Redis=require(_0x2cfe('0x4'));var db=require(_0x2cfe('0x5'))['db'];var utils=require(_0x2cfe('0x6'));var logger=require('../../config/logger')(_0x2cfe('0x7'));var config=require(_0x2cfe('0x8'));var jayson=require(_0x2cfe('0x9'));var client=jayson[_0x2cfe('0xa')][_0x2cfe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1009ce,_0x1affa2,_0x44befc){return new BPromise(function(_0x4a7e1a,_0x2ff626){return client[_0x2cfe('0xc')](_0x1009ce,_0x44befc)[_0x2cfe('0xd')](function(_0x47eeaa){logger[_0x2cfe('0xe')]('VoiceContext,\x20%s,\x20%s',_0x1affa2,_0x2cfe('0xf'));logger[_0x2cfe('0x10')](_0x2cfe('0x11'),_0x1affa2,_0x2cfe('0xf'),JSON[_0x2cfe('0x12')](_0x47eeaa));if(_0x47eeaa[_0x2cfe('0x13')]){if(_0x47eeaa[_0x2cfe('0x13')][_0x2cfe('0x14')]===0x1f4){logger[_0x2cfe('0x13')](_0x2cfe('0x15'),_0x1affa2,_0x47eeaa[_0x2cfe('0x13')][_0x2cfe('0x16')]);return _0x2ff626(_0x47eeaa[_0x2cfe('0x13')][_0x2cfe('0x16')]);}logger['error'](_0x2cfe('0x15'),_0x1affa2,_0x47eeaa[_0x2cfe('0x13')]['message']);return _0x4a7e1a(_0x47eeaa[_0x2cfe('0x13')][_0x2cfe('0x16')]);}else{logger[_0x2cfe('0xe')](_0x2cfe('0x15'),_0x1affa2,_0x2cfe('0xf'));_0x4a7e1a(_0x47eeaa[_0x2cfe('0x17')]['message']);}})[_0x2cfe('0x18')](function(_0x6baa4c){logger['error'](_0x2cfe('0x15'),_0x1affa2,_0x6baa4c);_0x2ff626(_0x6baa4c);});});} \ No newline at end of file +var _0x0ca3=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x16011c,_0x30e150){var _0x12451d=function(_0x238d60){while(--_0x238d60){_0x16011c['push'](_0x16011c['shift']());}};_0x12451d(++_0x30e150);}(_0x0ca3,0x1b5));var _0x30ca=function(_0x5c619e,_0x1bccdf){_0x5c619e=_0x5c619e-0x0;var _0x445cf8=_0x0ca3[_0x5c619e];return _0x445cf8;};'use strict';var _=require(_0x30ca('0x0'));var util=require(_0x30ca('0x1'));var moment=require(_0x30ca('0x2'));var BPromise=require(_0x30ca('0x3'));var rs=require(_0x30ca('0x4'));var fs=require('fs');var Redis=require(_0x30ca('0x5'));var db=require(_0x30ca('0x6'))['db'];var utils=require(_0x30ca('0x7'));var logger=require(_0x30ca('0x8'))(_0x30ca('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x30ca('0xa')][_0x30ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56db1d,_0x57ec75,_0x4ee93d){return new BPromise(function(_0x467d2e,_0x180ccc){return client[_0x30ca('0xc')](_0x56db1d,_0x4ee93d)['then'](function(_0x4a2d4f){logger[_0x30ca('0xd')](_0x30ca('0xe'),_0x57ec75,_0x30ca('0xf'));logger[_0x30ca('0x10')](_0x30ca('0x11'),_0x57ec75,_0x30ca('0xf'),JSON['stringify'](_0x4a2d4f));if(_0x4a2d4f[_0x30ca('0x12')]){if(_0x4a2d4f[_0x30ca('0x12')][_0x30ca('0x13')]===0x1f4){logger['error'](_0x30ca('0xe'),_0x57ec75,_0x4a2d4f[_0x30ca('0x12')]['message']);return _0x180ccc(_0x4a2d4f[_0x30ca('0x12')]['message']);}logger[_0x30ca('0x12')](_0x30ca('0xe'),_0x57ec75,_0x4a2d4f[_0x30ca('0x12')][_0x30ca('0x14')]);return _0x467d2e(_0x4a2d4f[_0x30ca('0x12')]['message']);}else{logger[_0x30ca('0xd')](_0x30ca('0xe'),_0x57ec75,_0x30ca('0xf'));_0x467d2e(_0x4a2d4f[_0x30ca('0x15')][_0x30ca('0x14')]);}})[_0x30ca('0x16')](function(_0x108a1a){logger[_0x30ca('0x12')](_0x30ca('0xe'),_0x57ec75,_0x108a1a);_0x180ccc(_0x108a1a);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 0bad779..fb71464 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 _0x4bc5=['index','describe','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated'];(function(_0x324dbc,_0x4cf8a6){var _0x57fd1d=function(_0x3ebd0d){while(--_0x3ebd0d){_0x324dbc['push'](_0x324dbc['shift']());}};_0x57fd1d(++_0x4cf8a6);}(_0x4bc5,0xb2));var _0x54bc=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x4bc5[_0x346737];return _0x1ade2e;};'use strict';var multer=require('multer');var util=require(_0x54bc('0x0'));var path=require(_0x54bc('0x1'));var timeout=require(_0x54bc('0x2'));var express=require(_0x54bc('0x3'));var router=express[_0x54bc('0x4')]();var auth=require(_0x54bc('0x5'));var interaction=require(_0x54bc('0x6'));var config=require(_0x54bc('0x7'));var controller=require(_0x54bc('0x8'));router[_0x54bc('0x9')]('/',auth[_0x54bc('0xa')](),controller[_0x54bc('0xb')]);router[_0x54bc('0x9')]('/describe',auth[_0x54bc('0xa')](),controller[_0x54bc('0xc')]);router['get']('/:id',auth[_0x54bc('0xa')](),controller[_0x54bc('0xd')]);router[_0x54bc('0xe')]('/',auth['isAuthenticated'](),controller[_0x54bc('0xf')]);router[_0x54bc('0x10')](_0x54bc('0x11'),auth[_0x54bc('0xa')](),controller[_0x54bc('0x12')]);router[_0x54bc('0x13')]('/:id',auth[_0x54bc('0xa')](),controller[_0x54bc('0x14')]);module['exports']=router; \ No newline at end of file +var _0x60f6=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','describe','/:id','show','post','create'];(function(_0x538182,_0x585352){var _0xc794e0=function(_0x55ff9e){while(--_0x55ff9e){_0x538182['push'](_0x538182['shift']());}};_0xc794e0(++_0x585352);}(_0x60f6,0x100));var _0x660f=function(_0x2ff2d2,_0x337f62){_0x2ff2d2=_0x2ff2d2-0x0;var _0x4dfda1=_0x60f6[_0x2ff2d2];return _0x4dfda1;};'use strict';var multer=require(_0x660f('0x0'));var util=require(_0x660f('0x1'));var path=require(_0x660f('0x2'));var timeout=require(_0x660f('0x3'));var express=require(_0x660f('0x4'));var router=express[_0x660f('0x5')]();var auth=require(_0x660f('0x6'));var interaction=require(_0x660f('0x7'));var config=require(_0x660f('0x8'));var controller=require(_0x660f('0x9'));router[_0x660f('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x660f('0xa')]('/describe',auth[_0x660f('0xb')](),controller[_0x660f('0xc')]);router['get'](_0x660f('0xd'),auth[_0x660f('0xb')](),controller[_0x660f('0xe')]);router[_0x660f('0xf')]('/',auth[_0x660f('0xb')](),controller[_0x660f('0x10')]);router[_0x660f('0x11')]('/:id',auth[_0x660f('0xb')](),controller[_0x660f('0x12')]);router['delete'](_0x660f('0xd'),auth[_0x660f('0xb')](),controller[_0x660f('0x13')]);module[_0x660f('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7824483..08bd5ca 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 _0xe93c=['DATE','called,connect,complete','sequelize','STRING','INTEGER'];(function(_0x3b4b70,_0x314ae7){var _0x111841=function(_0x33df38){while(--_0x33df38){_0x3b4b70['push'](_0x3b4b70['shift']());}};_0x111841(++_0x314ae7);}(_0xe93c,0x192));var _0xce93=function(_0x3a095c,_0x146ff8){_0x3a095c=_0x3a095c-0x0;var _0x15d829=_0xe93c[_0x3a095c];return _0x15d829;};'use strict';var Sequelize=require(_0xce93('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xce93('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xce93('0x1')]},'calleridnum':{'type':Sequelize[_0xce93('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xce93('0x1')]},'language':{'type':Sequelize[_0xce93('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xce93('0x1')]},'exten':{'type':Sequelize[_0xce93('0x1')]},'priority':{'type':Sequelize[_0xce93('0x2')]},'uniqueid':{'type':Sequelize[_0xce93('0x1')]},'linkedid':{'type':Sequelize[_0xce93('0x1')]},'destchannel':{'type':Sequelize[_0xce93('0x1')]},'destchannelstate':{'type':Sequelize[_0xce93('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xce93('0x1')]},'destcalleridnum':{'type':Sequelize[_0xce93('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xce93('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xce93('0x1')]},'destlanguage':{'type':Sequelize[_0xce93('0x1')]},'destaccountcode':{'type':Sequelize[_0xce93('0x1')]},'destcontext':{'type':Sequelize[_0xce93('0x1')]},'destexten':{'type':Sequelize[_0xce93('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xce93('0x1')]},'destlinkedid':{'type':Sequelize[_0xce93('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xce93('0x1')]},'starttime':{'type':Sequelize[_0xce93('0x3')]},'answertime':{'type':Sequelize[_0xce93('0x3')]},'endtime':{'type':Sequelize[_0xce93('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xce93('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xce93('0x2')]},'holdtime':{'type':Sequelize[_0xce93('0x2')]},'billableseconds':{'type':Sequelize[_0xce93('0x2')]}}; \ No newline at end of file +var _0x0a07=['called,connect,complete','exports','INTEGER','STRING','DATE'];(function(_0x2ea087,_0x17f324){var _0x23ebac=function(_0x5575d8){while(--_0x5575d8){_0x2ea087['push'](_0x2ea087['shift']());}};_0x23ebac(++_0x17f324);}(_0x0a07,0xab));var _0x70a0=function(_0x4de43b,_0x252bed){_0x4de43b=_0x4de43b-0x0;var _0x4f0b96=_0x0a07[_0x4de43b];return _0x4f0b96;};'use strict';var Sequelize=require('sequelize');module[_0x70a0('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x70a0('0x1')]},'channelstatedesc':{'type':Sequelize[_0x70a0('0x2')]},'calleridnum':{'type':Sequelize[_0x70a0('0x2')]},'calleridname':{'type':Sequelize[_0x70a0('0x2')]},'connectedlinenum':{'type':Sequelize[_0x70a0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x70a0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x70a0('0x2')]},'priority':{'type':Sequelize[_0x70a0('0x1')]},'uniqueid':{'type':Sequelize[_0x70a0('0x2')]},'linkedid':{'type':Sequelize[_0x70a0('0x2')]},'destchannel':{'type':Sequelize[_0x70a0('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x70a0('0x2')]},'destcalleridnum':{'type':Sequelize[_0x70a0('0x2')]},'destcalleridname':{'type':Sequelize[_0x70a0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x70a0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x70a0('0x2')]},'destlanguage':{'type':Sequelize[_0x70a0('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x70a0('0x2')]},'destexten':{'type':Sequelize[_0x70a0('0x2')]},'destpriority':{'type':Sequelize[_0x70a0('0x1')]},'destuniqueid':{'type':Sequelize[_0x70a0('0x2')]},'destlinkedid':{'type':Sequelize[_0x70a0('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x70a0('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x70a0('0x3')]},'endtime':{'type':Sequelize[_0x70a0('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x70a0('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x70a0('0x1')]},'holdtime':{'type':Sequelize[_0x70a0('0x1')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 2a6e602..59f5e8a 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 _0x1a4d=['filters','filter','merge','type','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','VoiceDialReport','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2e9658,_0x42e905){var _0x2c96a0=function(_0x33a8bd){while(--_0x33a8bd){_0x2e9658['push'](_0x2e9658['shift']());}};_0x2c96a0(++_0x42e905);}(_0x1a4d,0xa8));var _0xd1a4=function(_0x5ac68f,_0xe243f9){_0x5ac68f=_0x5ac68f-0x0;var _0x383065=_0x1a4d[_0x5ac68f];return _0x383065;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd1a4('0x0'));var rimraf=require(_0xd1a4('0x1'));var zipdir=require(_0xd1a4('0x2'));var jsonpatch=require(_0xd1a4('0x3'));var rp=require(_0xd1a4('0x4'));var moment=require('moment');var BPromise=require(_0xd1a4('0x5'));var Mustache=require(_0xd1a4('0x6'));var util=require(_0xd1a4('0x7'));var path=require(_0xd1a4('0x8'));var sox=require(_0xd1a4('0x9'));var csv=require(_0xd1a4('0xa'));var ejs=require(_0xd1a4('0xb'));var fs=require('fs');var _=require(_0xd1a4('0xc'));var squel=require(_0xd1a4('0xd'));var crypto=require(_0xd1a4('0xe'));var jsforce=require(_0xd1a4('0xf'));var deskjs=require(_0xd1a4('0x10'));var toCsv=require(_0xd1a4('0xa'));var querystring=require(_0xd1a4('0x11'));var Papa=require(_0xd1a4('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd1a4('0x13'));var as=require(_0xd1a4('0x14'));var hardwareService=require(_0xd1a4('0x15'));var logger=require(_0xd1a4('0x16'))('api');var utils=require(_0xd1a4('0x17'));var config=require(_0xd1a4('0x18'));var licenseUtil=require(_0xd1a4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x488e65,_0x5497c5){_0x5497c5=_0x5497c5||0xcc;return function(_0x3ca953){if(_0x3ca953){return _0x488e65[_0xd1a4('0x1a')](_0x5497c5);}return _0x488e65['status'](_0x5497c5)['end']();};}function respondWithResult(_0x1f524b,_0x43cef8){_0x43cef8=_0x43cef8||0xc8;return function(_0x11a9cb){if(_0x11a9cb){return _0x1f524b[_0xd1a4('0x1b')](_0x43cef8)['json'](_0x11a9cb);}};}function respondWithFilteredResult(_0x35cdc6,_0x44b0c5){return function(_0x1a2ec7){if(_0x1a2ec7){var _0x16ed7a=_0x1a2ec7[_0xd1a4('0x1c')],_0x563519=_0x44b0c5[_0xd1a4('0x1d')],_0x584867=_0x44b0c5[_0xd1a4('0x1d')]+_0x44b0c5[_0xd1a4('0x1e')],_0xbe2e1f;if(_0x584867>=_0x16ed7a){_0x584867=_0x16ed7a;_0xbe2e1f=0xc8;}else{_0xbe2e1f=0xce;}_0x35cdc6[_0xd1a4('0x1b')](_0xbe2e1f);return _0x35cdc6['set'](_0xd1a4('0x1f'),_0x563519+'-'+_0x584867+'/'+_0x16ed7a)[_0xd1a4('0x20')](_0x1a2ec7);}return null;};}function patchUpdates(_0x51fabb){return function(_0x37786b){try{jsonpatch[_0xd1a4('0x21')](_0x37786b,_0x51fabb,!![]);}catch(_0x33d2ea){return BPromise[_0xd1a4('0x22')](_0x33d2ea);}return _0x37786b[_0xd1a4('0x23')]();};}function saveUpdates(_0x5b8a34,_0x544206){return function(_0x39ceda){if(_0x39ceda){return _0x39ceda[_0xd1a4('0x24')](_0x5b8a34)['then'](function(_0x18423e){return _0x18423e;});}return null;};}function removeEntity(_0x2d6daf,_0x59c740){return function(_0x57e635){if(_0x57e635){return _0x57e635[_0xd1a4('0x25')]()[_0xd1a4('0x26')](function(){_0x2d6daf[_0xd1a4('0x1b')](0xcc)[_0xd1a4('0x27')]();});}};}function handleEntityNotFound(_0x540af4,_0x43681b){return function(_0x1b0ca1){if(!_0x1b0ca1){_0x540af4[_0xd1a4('0x1a')](0x194);}return _0x1b0ca1;};}function handleError(_0x2e3320,_0x41e7eb){_0x41e7eb=_0x41e7eb||0x1f4;return function(_0x3fb540){logger['error'](_0x3fb540[_0xd1a4('0x28')]);if(_0x3fb540[_0xd1a4('0x29')]){delete _0x3fb540[_0xd1a4('0x29')];}_0x2e3320[_0xd1a4('0x1b')](_0x41e7eb)[_0xd1a4('0x2a')](_0x3fb540);};}exports[_0xd1a4('0x2b')]=function(_0x373486,_0x35f1e1){var _0x4badf4={},_0x1c1c29={},_0x522d1a={'count':0x0,'rows':[]};var _0x535ad6=_[_0xd1a4('0x2c')](db[_0xd1a4('0x2d')][_0xd1a4('0x2e')],function(_0x199cf1){return{'name':_0x199cf1['fieldName'],'type':_0x199cf1['type'][_0xd1a4('0x2f')]};});_0x1c1c29['model']=_[_0xd1a4('0x2c')](_0x535ad6,_0xd1a4('0x29'));_0x1c1c29[_0xd1a4('0x30')]=_[_0xd1a4('0x31')](_0x373486[_0xd1a4('0x30')]);_0x1c1c29['filters']=_[_0xd1a4('0x32')](_0x1c1c29[_0xd1a4('0x33')],_0x1c1c29['query']);_0x4badf4[_0xd1a4('0x34')]=_[_0xd1a4('0x32')](_0x1c1c29[_0xd1a4('0x33')],qs[_0xd1a4('0x35')](_0x373486['query']['fields']));_0x4badf4[_0xd1a4('0x34')]=_0x4badf4[_0xd1a4('0x34')][_0xd1a4('0x36')]?_0x4badf4[_0xd1a4('0x34')]:_0x1c1c29['model'];if(!_0x373486[_0xd1a4('0x30')][_0xd1a4('0x37')](_0xd1a4('0x38'))){_0x4badf4[_0xd1a4('0x1e')]=qs[_0xd1a4('0x1e')](_0x373486[_0xd1a4('0x30')]['limit']);_0x4badf4[_0xd1a4('0x1d')]=qs['offset'](_0x373486[_0xd1a4('0x30')][_0xd1a4('0x1d')]);}_0x4badf4[_0xd1a4('0x39')]=qs['sort'](_0x373486[_0xd1a4('0x30')][_0xd1a4('0x3a')]);_0x4badf4[_0xd1a4('0x3b')]=qs[_0xd1a4('0x3c')](_['pick'](_0x373486[_0xd1a4('0x30')],_0x1c1c29['filters']),_0x535ad6);if(_0x373486[_0xd1a4('0x30')][_0xd1a4('0x3d')]){_0x4badf4['where']=_[_0xd1a4('0x3e')](_0x4badf4[_0xd1a4('0x3b')],{'$or':_[_0xd1a4('0x2c')](_0x535ad6,function(_0x3778a8){if(_0x3778a8[_0xd1a4('0x3f')]!=='VIRTUAL'){var _0x2212e9={};_0x2212e9[_0x3778a8[_0xd1a4('0x29')]]={'$like':'%'+_0x373486[_0xd1a4('0x30')][_0xd1a4('0x3d')]+'%'};return _0x2212e9;}})});}_0x4badf4=_[_0xd1a4('0x3e')]({},_0x4badf4,_0x373486[_0xd1a4('0x40')]);var _0x22d607={'where':_0x4badf4[_0xd1a4('0x3b')]};return db[_0xd1a4('0x2d')][_0xd1a4('0x1c')](_0x22d607)[_0xd1a4('0x26')](function(_0x577618){_0x522d1a[_0xd1a4('0x1c')]=_0x577618;if(_0x373486[_0xd1a4('0x30')][_0xd1a4('0x41')]){_0x4badf4['include']=[{'all':!![]}];}return db[_0xd1a4('0x2d')][_0xd1a4('0x42')](_0x4badf4);})['then'](function(_0x46cfd9){_0x522d1a[_0xd1a4('0x43')]=_0x46cfd9;return _0x522d1a;})[_0xd1a4('0x26')](respondWithFilteredResult(_0x35f1e1,_0x4badf4))['catch'](handleError(_0x35f1e1,null));};exports[_0xd1a4('0x44')]=function(_0x30afb7,_0x54990b){var _0x4d3250={'raw':!![],'where':{'id':_0x30afb7[_0xd1a4('0x45')]['id']}},_0x27d5d7={};_0x27d5d7[_0xd1a4('0x33')]=_[_0xd1a4('0x31')](db['VoiceDialReport'][_0xd1a4('0x2e')]);_0x27d5d7['query']=_[_0xd1a4('0x31')](_0x30afb7[_0xd1a4('0x30')]);_0x27d5d7[_0xd1a4('0x3c')]=_[_0xd1a4('0x32')](_0x27d5d7[_0xd1a4('0x33')],_0x27d5d7[_0xd1a4('0x30')]);_0x4d3250[_0xd1a4('0x34')]=_[_0xd1a4('0x32')](_0x27d5d7[_0xd1a4('0x33')],qs[_0xd1a4('0x35')](_0x30afb7[_0xd1a4('0x30')][_0xd1a4('0x35')]));_0x4d3250['attributes']=_0x4d3250['attributes'][_0xd1a4('0x36')]?_0x4d3250[_0xd1a4('0x34')]:_0x27d5d7[_0xd1a4('0x33')];if(_0x30afb7[_0xd1a4('0x30')][_0xd1a4('0x41')]){_0x4d3250[_0xd1a4('0x46')]=[{'all':!![]}];}_0x4d3250=_['merge']({},_0x4d3250,_0x30afb7['options']);return db[_0xd1a4('0x2d')][_0xd1a4('0x47')](_0x4d3250)[_0xd1a4('0x26')](handleEntityNotFound(_0x54990b,null))['then'](respondWithResult(_0x54990b,null))[_0xd1a4('0x48')](handleError(_0x54990b,null));};exports[_0xd1a4('0x49')]=function(_0x55d8c5,_0x54c551){return db[_0xd1a4('0x2d')][_0xd1a4('0x49')](_0x55d8c5[_0xd1a4('0x4a')],{})[_0xd1a4('0x26')](respondWithResult(_0x54c551,0xc9))[_0xd1a4('0x48')](handleError(_0x54c551,null));};exports['update']=function(_0x2995ee,_0x5a155c){if(_0x2995ee[_0xd1a4('0x4a')]['id']){delete _0x2995ee[_0xd1a4('0x4a')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x2995ee[_0xd1a4('0x45')]['id']}})[_0xd1a4('0x26')](handleEntityNotFound(_0x5a155c,null))['then'](saveUpdates(_0x2995ee[_0xd1a4('0x4a')],null))['then'](respondWithResult(_0x5a155c,null))[_0xd1a4('0x48')](handleError(_0x5a155c,null));};exports[_0xd1a4('0x25')]=function(_0x130f5c,_0x2a0729){return db[_0xd1a4('0x2d')][_0xd1a4('0x47')]({'where':{'id':_0x130f5c['params']['id']}})[_0xd1a4('0x26')](handleEntityNotFound(_0x2a0729,null))[_0xd1a4('0x26')](removeEntity(_0x2a0729,null))[_0xd1a4('0x48')](handleError(_0x2a0729,null));};exports[_0xd1a4('0x4b')]=function(_0x2d0d96,_0xc58444){return db[_0xd1a4('0x2d')][_0xd1a4('0x4b')]()[_0xd1a4('0x26')](respondWithResult(_0xc58444,null))[_0xd1a4('0x48')](handleError(_0xc58444,null));}; \ No newline at end of file +var _0x8455=['describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','catch'];(function(_0x4880db,_0x3159de){var _0x3810cc=function(_0x5e404d){while(--_0x5e404d){_0x4880db['push'](_0x4880db['shift']());}};_0x3810cc(++_0x3159de);}(_0x8455,0x16e));var _0x5845=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8455[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5845('0x0'));var emlformat=require(_0x5845('0x1'));var rimraf=require(_0x5845('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5845('0x3'));var moment=require(_0x5845('0x4'));var BPromise=require(_0x5845('0x5'));var Mustache=require('mustache');var util=require(_0x5845('0x6'));var path=require(_0x5845('0x7'));var sox=require(_0x5845('0x8'));var csv=require(_0x5845('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5845('0xa'));var squel=require(_0x5845('0xb'));var crypto=require(_0x5845('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5845('0x9'));var querystring=require(_0x5845('0xd'));var Papa=require(_0x5845('0xe'));var Redis=require('ioredis');var authService=require(_0x5845('0xf'));var qs=require(_0x5845('0x10'));var as=require(_0x5845('0x11'));var hardwareService=require(_0x5845('0x12'));var logger=require('../../config/logger')(_0x5845('0x13'));var utils=require(_0x5845('0x14'));var config=require(_0x5845('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5845('0x16'))['db'];function respondWithStatusCode(_0x4c45a8,_0x306145){_0x306145=_0x306145||0xcc;return function(_0x286d6c){if(_0x286d6c){return _0x4c45a8[_0x5845('0x17')](_0x306145);}return _0x4c45a8[_0x5845('0x18')](_0x306145)[_0x5845('0x19')]();};}function respondWithResult(_0x398a75,_0x392fea){_0x392fea=_0x392fea||0xc8;return function(_0x494c0a){if(_0x494c0a){return _0x398a75[_0x5845('0x18')](_0x392fea)[_0x5845('0x1a')](_0x494c0a);}};}function respondWithFilteredResult(_0xe53d15,_0x4e43ef){return function(_0x5edf3b){if(_0x5edf3b){var _0x251876=_0x5edf3b[_0x5845('0x1b')],_0xa9c372=_0x4e43ef[_0x5845('0x1c')],_0x5bf393=_0x4e43ef[_0x5845('0x1c')]+_0x4e43ef[_0x5845('0x1d')],_0x138f91;if(_0x5bf393>=_0x251876){_0x5bf393=_0x251876;_0x138f91=0xc8;}else{_0x138f91=0xce;}_0xe53d15['status'](_0x138f91);return _0xe53d15[_0x5845('0x1e')](_0x5845('0x1f'),_0xa9c372+'-'+_0x5bf393+'/'+_0x251876)[_0x5845('0x1a')](_0x5edf3b);}return null;};}function patchUpdates(_0x21794d){return function(_0x11a499){try{jsonpatch['apply'](_0x11a499,_0x21794d,!![]);}catch(_0x4023a9){return BPromise['reject'](_0x4023a9);}return _0x11a499[_0x5845('0x20')]();};}function saveUpdates(_0x110b56,_0x4c886b){return function(_0x12fe9a){if(_0x12fe9a){return _0x12fe9a[_0x5845('0x21')](_0x110b56)[_0x5845('0x22')](function(_0x1f8dda){return _0x1f8dda;});}return null;};}function removeEntity(_0x52c3a8,_0x99f8c9){return function(_0x40ac81){if(_0x40ac81){return _0x40ac81[_0x5845('0x23')]()[_0x5845('0x22')](function(){_0x52c3a8[_0x5845('0x18')](0xcc)[_0x5845('0x19')]();});}};}function handleEntityNotFound(_0x53e0b5,_0x2661b9){return function(_0x5f50c8){if(!_0x5f50c8){_0x53e0b5[_0x5845('0x17')](0x194);}return _0x5f50c8;};}function handleError(_0x5323e2,_0x3d558f){_0x3d558f=_0x3d558f||0x1f4;return function(_0x2ca1ec){logger['error'](_0x2ca1ec[_0x5845('0x24')]);if(_0x2ca1ec[_0x5845('0x25')]){delete _0x2ca1ec[_0x5845('0x25')];}_0x5323e2['status'](_0x3d558f)[_0x5845('0x26')](_0x2ca1ec);};}exports['index']=function(_0x4046c1,_0x16a663){var _0x782d6b={},_0x1e1f18={},_0x4d1a27={'count':0x0,'rows':[]};var _0x48cd44=_[_0x5845('0x27')](db[_0x5845('0x28')][_0x5845('0x29')],function(_0x2b0168){return{'name':_0x2b0168[_0x5845('0x2a')],'type':_0x2b0168[_0x5845('0x2b')][_0x5845('0x2c')]};});_0x1e1f18[_0x5845('0x2d')]=_[_0x5845('0x27')](_0x48cd44,_0x5845('0x25'));_0x1e1f18[_0x5845('0x2e')]=_[_0x5845('0x2f')](_0x4046c1[_0x5845('0x2e')]);_0x1e1f18[_0x5845('0x30')]=_[_0x5845('0x31')](_0x1e1f18['model'],_0x1e1f18[_0x5845('0x2e')]);_0x782d6b[_0x5845('0x32')]=_[_0x5845('0x31')](_0x1e1f18[_0x5845('0x2d')],qs[_0x5845('0x33')](_0x4046c1[_0x5845('0x2e')]['fields']));_0x782d6b[_0x5845('0x32')]=_0x782d6b[_0x5845('0x32')][_0x5845('0x34')]?_0x782d6b[_0x5845('0x32')]:_0x1e1f18[_0x5845('0x2d')];if(!_0x4046c1[_0x5845('0x2e')][_0x5845('0x35')](_0x5845('0x36'))){_0x782d6b['limit']=qs[_0x5845('0x1d')](_0x4046c1[_0x5845('0x2e')][_0x5845('0x1d')]);_0x782d6b[_0x5845('0x1c')]=qs[_0x5845('0x1c')](_0x4046c1[_0x5845('0x2e')][_0x5845('0x1c')]);}_0x782d6b['order']=qs[_0x5845('0x37')](_0x4046c1[_0x5845('0x2e')][_0x5845('0x37')]);_0x782d6b[_0x5845('0x38')]=qs[_0x5845('0x30')](_[_0x5845('0x39')](_0x4046c1['query'],_0x1e1f18[_0x5845('0x30')]),_0x48cd44);if(_0x4046c1[_0x5845('0x2e')][_0x5845('0x3a')]){_0x782d6b[_0x5845('0x38')]=_[_0x5845('0x3b')](_0x782d6b[_0x5845('0x38')],{'$or':_['map'](_0x48cd44,function(_0x2929b2){if(_0x2929b2[_0x5845('0x2b')]!==_0x5845('0x3c')){var _0x14a98e={};_0x14a98e[_0x2929b2['name']]={'$like':'%'+_0x4046c1[_0x5845('0x2e')][_0x5845('0x3a')]+'%'};return _0x14a98e;}})});}_0x782d6b=_['merge']({},_0x782d6b,_0x4046c1[_0x5845('0x3d')]);var _0x187cb1={'where':_0x782d6b[_0x5845('0x38')]};return db[_0x5845('0x28')][_0x5845('0x1b')](_0x187cb1)[_0x5845('0x22')](function(_0x524075){_0x4d1a27[_0x5845('0x1b')]=_0x524075;if(_0x4046c1['query'][_0x5845('0x3e')]){_0x782d6b[_0x5845('0x3f')]=[{'all':!![]}];}return db[_0x5845('0x28')][_0x5845('0x40')](_0x782d6b);})[_0x5845('0x22')](function(_0x271f93){_0x4d1a27[_0x5845('0x41')]=_0x271f93;return _0x4d1a27;})['then'](respondWithFilteredResult(_0x16a663,_0x782d6b))['catch'](handleError(_0x16a663,null));};exports[_0x5845('0x42')]=function(_0x4b7b59,_0x2f25b2){var _0x2b9ae7={'raw':!![],'where':{'id':_0x4b7b59[_0x5845('0x43')]['id']}},_0x2678fc={};_0x2678fc[_0x5845('0x2d')]=_[_0x5845('0x2f')](db[_0x5845('0x28')][_0x5845('0x29')]);_0x2678fc[_0x5845('0x2e')]=_[_0x5845('0x2f')](_0x4b7b59[_0x5845('0x2e')]);_0x2678fc['filters']=_[_0x5845('0x31')](_0x2678fc[_0x5845('0x2d')],_0x2678fc['query']);_0x2b9ae7['attributes']=_[_0x5845('0x31')](_0x2678fc['model'],qs[_0x5845('0x33')](_0x4b7b59[_0x5845('0x2e')]['fields']));_0x2b9ae7[_0x5845('0x32')]=_0x2b9ae7[_0x5845('0x32')][_0x5845('0x34')]?_0x2b9ae7[_0x5845('0x32')]:_0x2678fc[_0x5845('0x2d')];if(_0x4b7b59['query'][_0x5845('0x3e')]){_0x2b9ae7[_0x5845('0x3f')]=[{'all':!![]}];}_0x2b9ae7=_[_0x5845('0x3b')]({},_0x2b9ae7,_0x4b7b59[_0x5845('0x3d')]);return db[_0x5845('0x28')][_0x5845('0x44')](_0x2b9ae7)[_0x5845('0x22')](handleEntityNotFound(_0x2f25b2,null))[_0x5845('0x22')](respondWithResult(_0x2f25b2,null))['catch'](handleError(_0x2f25b2,null));};exports[_0x5845('0x45')]=function(_0x2ea112,_0x33ca91){return db['VoiceDialReport']['create'](_0x2ea112[_0x5845('0x46')],{})[_0x5845('0x22')](respondWithResult(_0x33ca91,0xc9))[_0x5845('0x47')](handleError(_0x33ca91,null));};exports[_0x5845('0x21')]=function(_0x21c83b,_0x3586a4){if(_0x21c83b['body']['id']){delete _0x21c83b[_0x5845('0x46')]['id'];}return db['VoiceDialReport'][_0x5845('0x44')]({'where':{'id':_0x21c83b[_0x5845('0x43')]['id']}})[_0x5845('0x22')](handleEntityNotFound(_0x3586a4,null))[_0x5845('0x22')](saveUpdates(_0x21c83b[_0x5845('0x46')],null))[_0x5845('0x22')](respondWithResult(_0x3586a4,null))[_0x5845('0x47')](handleError(_0x3586a4,null));};exports[_0x5845('0x23')]=function(_0x5a0d20,_0x128477){return db['VoiceDialReport']['find']({'where':{'id':_0x5a0d20['params']['id']}})[_0x5845('0x22')](handleEntityNotFound(_0x128477,null))['then'](removeEntity(_0x128477,null))['catch'](handleError(_0x128477,null));};exports[_0x5845('0x48')]=function(_0x2187cd,_0x59da11){return db[_0x5845('0x28')]['describe']()[_0x5845('0x22')](respondWithResult(_0x59da11,null))[_0x5845('0x47')](handleError(_0x59da11,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 139aa78..675f69c 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 _0x1684=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x5bb207,_0x157700){var _0x4b198e=function(_0x4d6c36){while(--_0x4d6c36){_0x5bb207['push'](_0x5bb207['shift']());}};_0x4b198e(++_0x157700);}(_0x1684,0x168));var _0x4168=function(_0x269d55,_0x457bed){_0x269d55=_0x269d55-0x0;var _0x23f17b=_0x1684[_0x269d55];return _0x23f17b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4168('0x0'))(_0x4168('0x1'));var moment=require(_0x4168('0x2'));var BPromise=require(_0x4168('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4168('0x4'));var config=require(_0x4168('0x5'));var attributes=require(_0x4168('0x6'));module[_0x4168('0x7')]=function(_0x4f6327,_0x2679fd){return _0x4f6327[_0x4168('0x8')](_0x4168('0x9'),attributes,{'tableName':_0x4168('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4168('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf6e=['path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5011a5,_0x3643c8){var _0x1b3bba=function(_0x4cc94d){while(--_0x4cc94d){_0x5011a5['push'](_0x5011a5['shift']());}};_0x1b3bba(++_0x3643c8);}(_0xaf6e,0x1ba));var _0xeaf6=function(_0x1c6107,_0x22b8b9){_0x1c6107=_0x1c6107-0x0;var _0x246ed3=_0xaf6e[_0x1c6107];return _0x246ed3;};'use strict';var _=require(_0xeaf6('0x0'));var util=require(_0xeaf6('0x1'));var logger=require(_0xeaf6('0x2'))(_0xeaf6('0x3'));var moment=require('moment');var BPromise=require(_0xeaf6('0x4'));var rp=require(_0xeaf6('0x5'));var fs=require('fs');var path=require(_0xeaf6('0x6'));var rimraf=require(_0xeaf6('0x7'));var config=require(_0xeaf6('0x8'));var attributes=require(_0xeaf6('0x9'));module[_0xeaf6('0xa')]=function(_0x4068ae,_0x2ebe00){return _0x4068ae[_0xeaf6('0xb')](_0xeaf6('0xc'),attributes,{'tableName':_0xeaf6('0xd'),'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 0857367..a9a39f9 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 _0x9a25=['VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','raw','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x503ebe,_0xc4ae8){var _0x2e1593=function(_0x18300f){while(--_0x18300f){_0x503ebe['push'](_0x503ebe['shift']());}};_0x2e1593(++_0xc4ae8);}(_0x9a25,0x142));var _0x59a2=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9a25[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x59a2('0x0'));var moment=require(_0x59a2('0x1'));var BPromise=require('bluebird');var rs=require(_0x59a2('0x2'));var fs=require('fs');var Redis=require(_0x59a2('0x3'));var db=require(_0x59a2('0x4'))['db'];var utils=require(_0x59a2('0x5'));var logger=require(_0x59a2('0x6'))(_0x59a2('0x7'));var config=require(_0x59a2('0x8'));var jayson=require(_0x59a2('0x9'));var client=jayson[_0x59a2('0xa')][_0x59a2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b995e,_0x4dc89a,_0x522fde){return new BPromise(function(_0x56032e,_0x5e0258){return client[_0x59a2('0xc')](_0x2b995e,_0x522fde)[_0x59a2('0xd')](function(_0x212bff){logger[_0x59a2('0xe')](_0x59a2('0xf'),_0x4dc89a,_0x59a2('0x10'));logger[_0x59a2('0x11')](_0x59a2('0x12'),_0x4dc89a,_0x59a2('0x10'),JSON[_0x59a2('0x13')](_0x212bff));if(_0x212bff[_0x59a2('0x14')]){if(_0x212bff[_0x59a2('0x14')][_0x59a2('0x15')]===0x1f4){logger[_0x59a2('0x14')](_0x59a2('0xf'),_0x4dc89a,_0x212bff['error']['message']);return _0x5e0258(_0x212bff['error'][_0x59a2('0x16')]);}logger['error'](_0x59a2('0xf'),_0x4dc89a,_0x212bff['error'][_0x59a2('0x16')]);return _0x56032e(_0x212bff[_0x59a2('0x14')]['message']);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x4dc89a,_0x59a2('0x10'));_0x56032e(_0x212bff['result'][_0x59a2('0x16')]);}})[_0x59a2('0x17')](function(_0x4fa7e8){logger[_0x59a2('0x14')](_0x59a2('0xf'),_0x4dc89a,_0x4fa7e8);_0x5e0258(_0x4fa7e8);});});}exports[_0x59a2('0x18')]=function(_0x131448){var _0x32eb5d=this;return new Promise(function(_0x5543a1,_0x472b6c){return db[_0x59a2('0x19')][_0x59a2('0x1a')](_0x131448[_0x59a2('0x1b')],{'raw':_0x131448[_0x59a2('0x1c')]?_0x131448['options']['raw']===undefined?!![]:![]:!![]})[_0x59a2('0xd')](function(_0x457538){logger[_0x59a2('0xe')](_0x59a2('0x18'),_0x131448);logger[_0x59a2('0x11')](_0x59a2('0x18'),_0x131448,JSON[_0x59a2('0x13')](_0x457538));_0x5543a1(_0x457538);})[_0x59a2('0x17')](function(_0xc5973f){logger[_0x59a2('0x14')](_0x59a2('0x18'),_0xc5973f['message'],_0x131448);_0x472b6c(_0x32eb5d[_0x59a2('0x14')](0x1f4,_0xc5973f['message']));});});};exports[_0x59a2('0x1d')]=function(_0x590be8){var _0x25fc1e=this;return new Promise(function(_0x55b8cf,_0x43c493){return db['VoiceDialReport'][_0x59a2('0x1e')](_0x590be8[_0x59a2('0x1b')],{'raw':_0x590be8[_0x59a2('0x1c')]?_0x590be8[_0x59a2('0x1c')][_0x59a2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x590be8[_0x59a2('0x1c')]?_0x590be8[_0x59a2('0x1c')]['where']||null:null,'attributes':_0x590be8[_0x59a2('0x1c')]?_0x590be8[_0x59a2('0x1c')][_0x59a2('0x20')]||null:null,'limit':_0x590be8[_0x59a2('0x1c')]?_0x590be8['options'][_0x59a2('0x21')]||null:null})[_0x59a2('0xd')](function(_0xf7d045){logger[_0x59a2('0xe')](_0x59a2('0x1d'),_0x590be8);logger[_0x59a2('0x11')](_0x59a2('0x1d'),_0x590be8,JSON[_0x59a2('0x13')](_0xf7d045));_0x55b8cf(_0xf7d045);})['catch'](function(_0x4ae903){logger['error'](_0x59a2('0x1d'),_0x4ae903[_0x59a2('0x16')],_0x590be8);_0x43c493(_0x25fc1e[_0x59a2('0x14')](0x1f4,_0x4ae903[_0x59a2('0x16')]));});});}; \ No newline at end of file +var _0xc45c=['limit','UpdateVoiceDialReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','debug','catch','update','where','attributes'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xc45c,0xa2));var _0xcc45=function(_0x15131d,_0x436a9b){_0x15131d=_0x15131d-0x0;var _0x17f153=_0xc45c[_0x15131d];return _0x17f153;};'use strict';var _=require('lodash');var util=require(_0xcc45('0x0'));var moment=require(_0xcc45('0x1'));var BPromise=require(_0xcc45('0x2'));var rs=require(_0xcc45('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc45('0x4'))['db'];var utils=require(_0xcc45('0x5'));var logger=require(_0xcc45('0x6'))(_0xcc45('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcc45('0x8')][_0xcc45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c6fa8,_0x1b2cd8,_0x2ffb7d){return new BPromise(function(_0x325f8a,_0xd0ceb5){return client['request'](_0x1c6fa8,_0x2ffb7d)[_0xcc45('0xa')](function(_0x371fc1){logger[_0xcc45('0xb')](_0xcc45('0xc'),_0x1b2cd8,_0xcc45('0xd'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x1b2cd8,_0xcc45('0xd'),JSON[_0xcc45('0xe')](_0x371fc1));if(_0x371fc1['error']){if(_0x371fc1[_0xcc45('0xf')][_0xcc45('0x10')]===0x1f4){logger[_0xcc45('0xf')](_0xcc45('0xc'),_0x1b2cd8,_0x371fc1[_0xcc45('0xf')][_0xcc45('0x11')]);return _0xd0ceb5(_0x371fc1[_0xcc45('0xf')]['message']);}logger[_0xcc45('0xf')](_0xcc45('0xc'),_0x1b2cd8,_0x371fc1[_0xcc45('0xf')][_0xcc45('0x11')]);return _0x325f8a(_0x371fc1[_0xcc45('0xf')][_0xcc45('0x11')]);}else{logger[_0xcc45('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x1b2cd8,'request\x20sent');_0x325f8a(_0x371fc1[_0xcc45('0x12')][_0xcc45('0x11')]);}})['catch'](function(_0x4dc796){logger[_0xcc45('0xf')](_0xcc45('0xc'),_0x1b2cd8,_0x4dc796);_0xd0ceb5(_0x4dc796);});});}exports['CreateVoiceDialReport']=function(_0x3e178b){var _0x3af036=this;return new Promise(function(_0x49e9ba,_0x2c4649){return db[_0xcc45('0x13')][_0xcc45('0x14')](_0x3e178b[_0xcc45('0x15')],{'raw':_0x3e178b[_0xcc45('0x16')]?_0x3e178b['options'][_0xcc45('0x17')]===undefined?!![]:![]:!![]})[_0xcc45('0xa')](function(_0x29c071){logger['info'](_0xcc45('0x18'),_0x3e178b);logger[_0xcc45('0x19')](_0xcc45('0x18'),_0x3e178b,JSON[_0xcc45('0xe')](_0x29c071));_0x49e9ba(_0x29c071);})[_0xcc45('0x1a')](function(_0x43b0f8){logger[_0xcc45('0xf')](_0xcc45('0x18'),_0x43b0f8[_0xcc45('0x11')],_0x3e178b);_0x2c4649(_0x3af036[_0xcc45('0xf')](0x1f4,_0x43b0f8['message']));});});};exports['UpdateVoiceDialReport']=function(_0x18c26c){var _0x47c644=this;return new Promise(function(_0x1165fc,_0x162b1c){return db[_0xcc45('0x13')][_0xcc45('0x1b')](_0x18c26c[_0xcc45('0x15')],{'raw':_0x18c26c[_0xcc45('0x16')]?_0x18c26c[_0xcc45('0x16')][_0xcc45('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18c26c[_0xcc45('0x16')]?_0x18c26c[_0xcc45('0x16')][_0xcc45('0x1c')]||null:null,'attributes':_0x18c26c[_0xcc45('0x16')]?_0x18c26c['options'][_0xcc45('0x1d')]||null:null,'limit':_0x18c26c[_0xcc45('0x16')]?_0x18c26c[_0xcc45('0x16')][_0xcc45('0x1e')]||null:null})[_0xcc45('0xa')](function(_0x3adbe2){logger[_0xcc45('0xb')]('UpdateVoiceDialReport',_0x18c26c);logger[_0xcc45('0x19')](_0xcc45('0x1f'),_0x18c26c,JSON['stringify'](_0x3adbe2));_0x1165fc(_0x3adbe2);})[_0xcc45('0x1a')](function(_0x4cbd29){logger[_0xcc45('0xf')](_0xcc45('0x1f'),_0x4cbd29[_0xcc45('0x11')],_0x18c26c);_0x162b1c(_0x47c644[_0xcc45('0xf')](0x1f4,_0x4cbd29[_0xcc45('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index e56a3c4..088d234 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 _0xf2a0=['put','/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','index','get','isAuthenticated','show','post','/:id/applications','addApplications'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xf2a0,0x88));var _0x0f2a=function(_0x240d8c,_0x979f5){_0x240d8c=_0x240d8c-0x0;var _0x4e0720=_0xf2a0[_0x240d8c];return _0x4e0720;};'use strict';var multer=require('multer');var util=require(_0x0f2a('0x0'));var path=require(_0x0f2a('0x1'));var timeout=require(_0x0f2a('0x2'));var express=require(_0x0f2a('0x3'));var router=express[_0x0f2a('0x4')]();var auth=require(_0x0f2a('0x5'));var interaction=require(_0x0f2a('0x6'));var config=require(_0x0f2a('0x7'));var controller=require(_0x0f2a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0f2a('0x9')]);router[_0x0f2a('0xa')]('/:id',auth[_0x0f2a('0xb')](),controller[_0x0f2a('0xc')]);router[_0x0f2a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0f2a('0xd')](_0x0f2a('0xe'),auth[_0x0f2a('0xb')](),controller[_0x0f2a('0xf')]);router[_0x0f2a('0x10')](_0x0f2a('0x11'),auth[_0x0f2a('0xb')](),controller['update']);router['delete']('/:id',auth[_0x0f2a('0xb')](),controller[_0x0f2a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1bf9=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4b5c62,_0x46693a){var _0x1496c3=function(_0x262aa7){while(--_0x262aa7){_0x4b5c62['push'](_0x4b5c62['shift']());}};_0x1496c3(++_0x46693a);}(_0x1bf9,0x188));var _0x91bf=function(_0x3f83f8,_0x1e5a49){_0x3f83f8=_0x3f83f8-0x0;var _0x56dd4c=_0x1bf9[_0x3f83f8];return _0x56dd4c;};'use strict';var multer=require(_0x91bf('0x0'));var util=require('util');var path=require(_0x91bf('0x1'));var timeout=require(_0x91bf('0x2'));var express=require(_0x91bf('0x3'));var router=express[_0x91bf('0x4')]();var auth=require(_0x91bf('0x5'));var interaction=require(_0x91bf('0x6'));var config=require(_0x91bf('0x7'));var controller=require('./voiceExtension.controller');router[_0x91bf('0x8')]('/',auth[_0x91bf('0x9')](),controller['index']);router[_0x91bf('0x8')](_0x91bf('0xa'),auth[_0x91bf('0x9')](),controller[_0x91bf('0xb')]);router[_0x91bf('0xc')]('/',auth['isAuthenticated'](),controller[_0x91bf('0xd')]);router[_0x91bf('0xc')]('/:id/applications',auth[_0x91bf('0x9')](),controller['addApplications']);router[_0x91bf('0xe')](_0x91bf('0xa'),auth[_0x91bf('0x9')](),controller[_0x91bf('0xf')]);router[_0x91bf('0x10')](_0x91bf('0xa'),auth[_0x91bf('0x9')](),controller[_0x91bf('0x11')]);module[_0x91bf('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index bd539e6..5b83c90 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(_0x5ca3ee,_0x3bad99){var _0x2f1b75=function(_0x183b04){while(--_0x183b04){_0x5ca3ee['push'](_0x5ca3ee['shift']());}};_0x2f1b75(++_0x3bad99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x4fadee,_0x1c3db8){var _0x4d6a8b=function(_0x53b614){while(--_0x53b614){_0x4fadee['push'](_0x4fadee['shift']());}};_0x4d6a8b(++_0x1c3db8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 891bd41..d274d36 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 _0x2089=['keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','merge','where','filter','options','VoiceExtension','then','includeAll','findAll','rows','catch','show','rawAttributes','length','include','destroy','params','create','body','outbound','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','description','cutdigits','mandatoryDisposition','context','addApplications','findOne','sequelize','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','map','value','includes','type','find','name','UserProfileResource','error','send','index','fieldName','model','query'];(function(_0x1972a6,_0x305fe9){var _0x402cca=function(_0x407f4f){while(--_0x407f4f){_0x1972a6['push'](_0x1972a6['shift']());}};_0x402cca(++_0x305fe9);}(_0x2089,0x16c));var _0x9208=function(_0x29ffe2,_0x1cd7ee){_0x29ffe2=_0x29ffe2-0x0;var _0x54e2ad=_0x2089[_0x29ffe2];return _0x54e2ad;};'use strict';var pdf=require(_0x9208('0x0'));var emlformat=require(_0x9208('0x1'));var rimraf=require(_0x9208('0x2'));var zipdir=require(_0x9208('0x3'));var jsonpatch=require(_0x9208('0x4'));var rp=require(_0x9208('0x5'));var moment=require(_0x9208('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x9208('0x7'));var util=require(_0x9208('0x8'));var path=require(_0x9208('0x9'));var sox=require('sox');var csv=require(_0x9208('0xa'));var ejs=require(_0x9208('0xb'));var fs=require('fs');var _=require(_0x9208('0xc'));var squel=require(_0x9208('0xd'));var crypto=require('crypto');var jsforce=require(_0x9208('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9208('0xa'));var querystring=require('querystring');var Papa=require(_0x9208('0xf'));var Redis=require(_0x9208('0x10'));var authService=require(_0x9208('0x11'));var qs=require(_0x9208('0x12'));var as=require(_0x9208('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9208('0x14'))(_0x9208('0x15'));var utils=require(_0x9208('0x16'));var config=require(_0x9208('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9208('0x18')]=_[_0x9208('0x19')](config[_0x9208('0x18')],{'host':_0x9208('0x1a'),'port':0x18eb});var socket=require(_0x9208('0x1b'))(new Redis(config[_0x9208('0x18')]));require(_0x9208('0x1c'))['register'](socket);function respondWithStatusCode(_0x5c6cbd,_0x100171){_0x100171=_0x100171||0xcc;return function(_0x1ec4bc){if(_0x1ec4bc){return _0x5c6cbd[_0x9208('0x1d')](_0x100171);}return _0x5c6cbd[_0x9208('0x1e')](_0x100171)[_0x9208('0x1f')]();};}function respondWithResult(_0x411ab0,_0x2ed572){_0x2ed572=_0x2ed572||0xc8;return function(_0x3f9481){if(_0x3f9481){return _0x411ab0[_0x9208('0x1e')](_0x2ed572)[_0x9208('0x20')](_0x3f9481);}};}function respondWithFilteredResult(_0x39edbb,_0x29c6e1){return function(_0x103442){if(_0x103442){var _0x143f8c=_0x103442[_0x9208('0x21')],_0x414098=_0x29c6e1[_0x9208('0x22')],_0x9a1e71=_0x29c6e1[_0x9208('0x22')]+_0x29c6e1[_0x9208('0x23')],_0x4914d7;if(_0x9a1e71>=_0x143f8c){_0x9a1e71=_0x143f8c;_0x4914d7=0xc8;}else{_0x4914d7=0xce;}_0x39edbb[_0x9208('0x1e')](_0x4914d7);return _0x39edbb[_0x9208('0x24')](_0x9208('0x25'),_0x414098+'-'+_0x9a1e71+'/'+_0x143f8c)['json'](_0x103442);}return null;};}function patchUpdates(_0x1b4a60){return function(_0x2ae906){try{jsonpatch['apply'](_0x2ae906,_0x1b4a60,!![]);}catch(_0x1baeaa){return BPromise[_0x9208('0x26')](_0x1baeaa);}return _0x2ae906[_0x9208('0x27')]();};}function saveUpdates(_0x34f88d,_0x1843ba){return function(_0x177343){if(_0x177343){return _0x177343[_0x9208('0x28')](_0x34f88d)['then'](function(_0x3a9bd5){return _0x3a9bd5;});}return null;};}function removeEntity(_0x2eb350,_0x24bb21){return function(_0x4e2dc8){if(_0x4e2dc8){return _0x4e2dc8['destroy']()['then'](function(){var _0x9d65ef=_0x4e2dc8[_0x9208('0x29')]({'plain':!![]});var _0x339902=[{'name':_0x9208('0x2a'),'value':_0x9208('0x2b'),'ignore':![]},{'name':_0x9208('0x2c'),'value':'outbound','ignore':![]},{'name':_0x9208('0x2d'),'value':_0x9208('0x2e'),'ignore':![]}];var _0x7227be=_(_0x339902)['filter']('ignore')[_0x9208('0x2f')](_0x9208('0x30'))[_0x9208('0x30')]();if(_[_0x9208('0x31')](_0x7227be,_0x9d65ef[_0x9208('0x32')])){return;}var _0x59716f=_[_0x9208('0x33')](_0x339902,['value',_0x9d65ef[_0x9208('0x32')]])[_0x9208('0x34')];return db[_0x9208('0x35')]['destroy']({'where':{'type':_0x59716f,'resourceId':_0x9d65ef['id']}})['then'](function(){return _0x4e2dc8;});})['then'](function(){_0x2eb350[_0x9208('0x1e')](0xcc)[_0x9208('0x1f')]();});}};}function handleEntityNotFound(_0x49a65b,_0x5a9a31){return function(_0x2c1306){if(!_0x2c1306){_0x49a65b['sendStatus'](0x194);}return _0x2c1306;};}function handleError(_0xd2d10a,_0x154ac9){_0x154ac9=_0x154ac9||0x1f4;return function(_0x2e0a2a){logger[_0x9208('0x36')](_0x2e0a2a['stack']);if(_0x2e0a2a[_0x9208('0x34')]){delete _0x2e0a2a[_0x9208('0x34')];}_0xd2d10a[_0x9208('0x1e')](_0x154ac9)[_0x9208('0x37')](_0x2e0a2a);};}exports[_0x9208('0x38')]=function(_0x5832c9,_0x590c2d){var _0x243371={},_0x3f3df0={},_0xb4b79a={'count':0x0,'rows':[]};var _0x5724e9=_[_0x9208('0x2f')](db['VoiceExtension']['rawAttributes'],function(_0x211f9c){return{'name':_0x211f9c[_0x9208('0x39')],'type':_0x211f9c[_0x9208('0x32')]['key']};});_0x3f3df0[_0x9208('0x3a')]=_[_0x9208('0x2f')](_0x5724e9,'name');_0x3f3df0[_0x9208('0x3b')]=_[_0x9208('0x3c')](_0x5832c9[_0x9208('0x3b')]);_0x3f3df0[_0x9208('0x3d')]=_[_0x9208('0x3e')](_0x3f3df0[_0x9208('0x3a')],_0x3f3df0['query']);_0x243371[_0x9208('0x3f')]=_[_0x9208('0x3e')](_0x3f3df0[_0x9208('0x3a')],qs[_0x9208('0x40')](_0x5832c9[_0x9208('0x3b')][_0x9208('0x40')]));_0x243371[_0x9208('0x3f')]=_0x243371[_0x9208('0x3f')]['length']?_0x243371[_0x9208('0x3f')]:_0x3f3df0[_0x9208('0x3a')];if(!_0x5832c9[_0x9208('0x3b')]['hasOwnProperty'](_0x9208('0x41'))){_0x243371[_0x9208('0x23')]=qs[_0x9208('0x23')](_0x5832c9[_0x9208('0x3b')][_0x9208('0x23')]);_0x243371[_0x9208('0x22')]=qs[_0x9208('0x22')](_0x5832c9['query'][_0x9208('0x22')]);}_0x243371[_0x9208('0x42')]=qs[_0x9208('0x43')](_0x5832c9['query'][_0x9208('0x43')]);_0x243371['where']=qs[_0x9208('0x3d')](_[_0x9208('0x44')](_0x5832c9[_0x9208('0x3b')],_0x3f3df0[_0x9208('0x3d')]),_0x5724e9);if(_0x5832c9[_0x9208('0x3b')]['filter']){_0x243371['where']=_[_0x9208('0x45')](_0x243371[_0x9208('0x46')],{'$or':_[_0x9208('0x2f')](_0x5724e9,function(_0x1d034e){if(_0x1d034e[_0x9208('0x32')]!=='VIRTUAL'){var _0xd27af6={};_0xd27af6[_0x1d034e['name']]={'$like':'%'+_0x5832c9[_0x9208('0x3b')][_0x9208('0x47')]+'%'};return _0xd27af6;}})});}_0x243371=_[_0x9208('0x45')]({},_0x243371,_0x5832c9[_0x9208('0x48')]);var _0x33dbb1={'where':_0x243371[_0x9208('0x46')]};return db[_0x9208('0x49')][_0x9208('0x21')](_0x33dbb1)[_0x9208('0x4a')](function(_0x5825f2){_0xb4b79a[_0x9208('0x21')]=_0x5825f2;if(_0x5832c9[_0x9208('0x3b')][_0x9208('0x4b')]){_0x243371['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x9208('0x4c')](_0x243371);})[_0x9208('0x4a')](function(_0x52f0f7){_0xb4b79a[_0x9208('0x4d')]=_0x52f0f7;return _0xb4b79a;})[_0x9208('0x4a')](respondWithFilteredResult(_0x590c2d,_0x243371))[_0x9208('0x4e')](handleError(_0x590c2d,null));};exports[_0x9208('0x4f')]=function(_0x184102,_0x172e3a){var _0x583567={'raw':![],'where':{'id':_0x184102['params']['id']}},_0x20ed34={};_0x20ed34[_0x9208('0x3a')]=_[_0x9208('0x3c')](db['VoiceExtension'][_0x9208('0x50')]);_0x20ed34[_0x9208('0x3b')]=_[_0x9208('0x3c')](_0x184102[_0x9208('0x3b')]);_0x20ed34[_0x9208('0x3d')]=_['intersection'](_0x20ed34[_0x9208('0x3a')],_0x20ed34[_0x9208('0x3b')]);_0x583567[_0x9208('0x3f')]=_[_0x9208('0x3e')](_0x20ed34[_0x9208('0x3a')],qs[_0x9208('0x40')](_0x184102[_0x9208('0x3b')][_0x9208('0x40')]));_0x583567[_0x9208('0x3f')]=_0x583567['attributes'][_0x9208('0x51')]?_0x583567[_0x9208('0x3f')]:_0x20ed34['model'];if(_0x184102[_0x9208('0x3b')][_0x9208('0x4b')]){_0x583567[_0x9208('0x52')]=[{'all':!![]}];}_0x583567=_[_0x9208('0x45')]({},_0x583567,_0x184102[_0x9208('0x48')]);return db[_0x9208('0x49')][_0x9208('0x33')](_0x583567)[_0x9208('0x4a')](handleEntityNotFound(_0x172e3a,null))[_0x9208('0x4a')](respondWithResult(_0x172e3a,null))[_0x9208('0x4e')](handleError(_0x172e3a,null));};exports[_0x9208('0x53')]=function(_0x46a6d0,_0x46cdd0){return db[_0x9208('0x49')][_0x9208('0x33')]({'where':{'id':_0x46a6d0[_0x9208('0x54')]['id']}})['then'](handleEntityNotFound(_0x46cdd0,null))[_0x9208('0x4a')](removeEntity(_0x46cdd0,null))[_0x9208('0x4e')](handleError(_0x46cdd0,null));};exports[_0x9208('0x55')]=function(_0x534d43,_0x398b1){if(_0x534d43[_0x9208('0x56')][_0x9208('0x32')]===_0x9208('0x57')&&!_['startsWith'](_0x534d43['body']['exten'],'_')){_0x534d43[_0x9208('0x56')][_0x9208('0x58')]='_'[_0x9208('0x59')](_0x534d43[_0x9208('0x56')][_0x9208('0x58')]);}return db[_0x9208('0x49')][_0x9208('0x55')](_0x534d43[_0x9208('0x56')],{'raw':![]})[_0x9208('0x4a')](function(_0xb9d160){var _0x2c87ce=_0x534d43[_0x9208('0x5a')]['get']({'plain':!![]});if(!_0x2c87ce)throw new Error(_0x9208('0x5b'));if(_0x2c87ce[_0x9208('0x5c')]===_0x9208('0x5a')){var _0x39a0ea=_0xb9d160['get']({'plain':!![]});var _0x198458=[{'name':_0x9208('0x2a'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x9208('0x57')},{'name':_0x9208('0x2d'),'value':_0x9208('0x2e')}];var _0x25a29d=_[_0x9208('0x33')](_0x198458,[_0x9208('0x30'),_0x39a0ea[_0x9208('0x32')]])[_0x9208('0x34')];return db[_0x9208('0x5d')]['find']({'where':{'name':_0x25a29d,'userProfileId':_0x2c87ce[_0x9208('0x5e')]},'raw':!![]})['then'](function(_0x4bd896){if(_0x4bd896&&_0x4bd896[_0x9208('0x5f')]===0x0){return db[_0x9208('0x35')][_0x9208('0x55')]({'name':_0x39a0ea[_0x9208('0x34')],'resourceId':_0x39a0ea['id'],'type':_0x4bd896['name'],'sectionId':_0x4bd896['id']},{})[_0x9208('0x4a')](function(){return _0xb9d160;});}else{return _0xb9d160;}})[_0x9208('0x4e')](function(_0x476112){logger[_0x9208('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x476112);throw _0x476112;});}return _0xb9d160;})['then'](respondWithResult(_0x398b1,0xc9))[_0x9208('0x4e')](handleError(_0x398b1,null));};exports[_0x9208('0x28')]=function(_0x44a9d8,_0x4cb042){if(_0x44a9d8[_0x9208('0x56')]['id']){delete _0x44a9d8[_0x9208('0x56')]['id'];}return db[_0x9208('0x49')][_0x9208('0x33')]({'where':{'id':_0x44a9d8[_0x9208('0x54')]['id']}})[_0x9208('0x4a')](handleEntityNotFound(_0x4cb042,null))['then'](function(_0x559dc3){if(_0x559dc3){return db[_0x9208('0x49')][_0x9208('0x28')](_[_0x9208('0x44')](_0x44a9d8[_0x9208('0x56')],[_0x9208('0x58'),'context',_0x9208('0x60'),'recordingFormat',_0x9208('0x61'),_0x9208('0x62')]),{'where':{'context':_0x559dc3[_0x9208('0x63')],'exten':_0x559dc3[_0x9208('0x58')]},'individualHooks':!![]})[_0x9208('0x4a')](function(_0x34e8de){return _0x34e8de;});}return null;})['then'](respondWithStatusCode(_0x4cb042,null))['catch'](handleError(_0x4cb042,null));};exports[_0x9208('0x64')]=function(_0x55382b,_0x5e164b,_0x3b4a21){return db[_0x9208('0x49')][_0x9208('0x65')]({'where':{'id':_0x55382b[_0x9208('0x54')]['id']}})[_0x9208('0x4a')](handleEntityNotFound(_0x5e164b,null))[_0x9208('0x4a')](function(_0x34e514){if(_0x34e514){return db[_0x9208('0x66')]['transaction'](function(_0x3e8f78){return db['VoiceExtension'][_0x9208('0x53')]({'where':{'VoiceExtensionId':_0x55382b['params']['id']},'transaction':_0x3e8f78})[_0x9208('0x4a')](function(_0x1af0b0){var _0xb1b95d=_['map'](_0x55382b[_0x9208('0x56')],function(_0x8fc46a){_0x8fc46a['VoiceExtensionId']=_0x55382b['params']['id'];return _0x8fc46a;});return db[_0x9208('0x49')][_0x9208('0x67')](_0xb1b95d,{'transaction':_0x3e8f78});});})['then'](function(){return db['VoiceExtension'][_0x9208('0x68')]({'where':{'isApp':!![],'VoiceExtensionId':_0x55382b[_0x9208('0x54')]['id']},'order':_0x9208('0x69')});});}})[_0x9208('0x4a')](respondWithResult(_0x5e164b,null))[_0x9208('0x4e')](handleError(_0x5e164b,null));}; \ No newline at end of file +var _0x3270=['rows','catch','show','find','params','create','body','startsWith','concat','exten','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','internal','userProfileId','autoAssociation','error','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','VoiceExtensionId','findAndCountAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','filter','ignore','value','includes','type','UserProfileResource','end','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','options','includeAll','include','findAll'];(function(_0x174061,_0x2cac5f){var _0x26fd54=function(_0x35996b){while(--_0x35996b){_0x174061['push'](_0x174061['shift']());}};_0x26fd54(++_0x2cac5f);}(_0x3270,0x84));var _0x0327=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x3270[_0x17b6e3];return _0x3906f3;};'use strict';var pdf=require(_0x0327('0x0'));var emlformat=require(_0x0327('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0327('0x2'));var jsonpatch=require(_0x0327('0x3'));var rp=require(_0x0327('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0327('0x5'));var util=require(_0x0327('0x6'));var path=require(_0x0327('0x7'));var sox=require('sox');var csv=require(_0x0327('0x8'));var ejs=require(_0x0327('0x9'));var fs=require('fs');var _=require(_0x0327('0xa'));var squel=require(_0x0327('0xb'));var crypto=require('crypto');var jsforce=require(_0x0327('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0327('0x8'));var querystring=require(_0x0327('0xd'));var Papa=require('papaparse');var Redis=require(_0x0327('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0327('0xf'));var as=require(_0x0327('0x10'));var hardwareService=require(_0x0327('0x11'));var logger=require('../../config/logger')(_0x0327('0x12'));var utils=require('../../config/utils');var config=require(_0x0327('0x13'));var licenseUtil=require(_0x0327('0x14'));var db=require('../../mysqldb')['db'];config[_0x0327('0x15')]=_[_0x0327('0x16')](config[_0x0327('0x15')],{'host':_0x0327('0x17'),'port':0x18eb});var socket=require(_0x0327('0x18'))(new Redis(config[_0x0327('0x15')]));require(_0x0327('0x19'))['register'](socket);function respondWithStatusCode(_0x3696a0,_0x1e7a78){_0x1e7a78=_0x1e7a78||0xcc;return function(_0x5acb7c){if(_0x5acb7c){return _0x3696a0[_0x0327('0x1a')](_0x1e7a78);}return _0x3696a0[_0x0327('0x1b')](_0x1e7a78)['end']();};}function respondWithResult(_0x222906,_0x573d12){_0x573d12=_0x573d12||0xc8;return function(_0x19cf45){if(_0x19cf45){return _0x222906[_0x0327('0x1b')](_0x573d12)['json'](_0x19cf45);}};}function respondWithFilteredResult(_0xb937df,_0x366de4){return function(_0x2f378a){if(_0x2f378a){var _0x3593b1=_0x2f378a[_0x0327('0x1c')],_0x24bf3a=_0x366de4[_0x0327('0x1d')],_0x26bad1=_0x366de4['offset']+_0x366de4[_0x0327('0x1e')],_0x1f53b1;if(_0x26bad1>=_0x3593b1){_0x26bad1=_0x3593b1;_0x1f53b1=0xc8;}else{_0x1f53b1=0xce;}_0xb937df[_0x0327('0x1b')](_0x1f53b1);return _0xb937df[_0x0327('0x1f')](_0x0327('0x20'),_0x24bf3a+'-'+_0x26bad1+'/'+_0x3593b1)[_0x0327('0x21')](_0x2f378a);}return null;};}function patchUpdates(_0x4ee244){return function(_0x4256b6){try{jsonpatch[_0x0327('0x22')](_0x4256b6,_0x4ee244,!![]);}catch(_0x14c759){return BPromise[_0x0327('0x23')](_0x14c759);}return _0x4256b6[_0x0327('0x24')]();};}function saveUpdates(_0x80f113,_0x268cf8){return function(_0x2c39b3){if(_0x2c39b3){return _0x2c39b3[_0x0327('0x25')](_0x80f113)[_0x0327('0x26')](function(_0x2f9e32){return _0x2f9e32;});}return null;};}function removeEntity(_0x5e31e9,_0x4477bc){return function(_0x5d1c2b){if(_0x5d1c2b){return _0x5d1c2b[_0x0327('0x27')]()[_0x0327('0x26')](function(){var _0x31dca6=_0x5d1c2b['get']({'plain':!![]});var _0x4e4fd6=[{'name':_0x0327('0x28'),'value':'inbound','ignore':![]},{'name':_0x0327('0x29'),'value':_0x0327('0x2a'),'ignore':![]},{'name':_0x0327('0x2b'),'value':'internal','ignore':![]}];var _0x16d1c0=_(_0x4e4fd6)[_0x0327('0x2c')](_0x0327('0x2d'))['map'](_0x0327('0x2e'))[_0x0327('0x2e')]();if(_[_0x0327('0x2f')](_0x16d1c0,_0x31dca6[_0x0327('0x30')])){return;}var _0x26b9e9=_['find'](_0x4e4fd6,[_0x0327('0x2e'),_0x31dca6[_0x0327('0x30')]])['name'];return db[_0x0327('0x31')][_0x0327('0x27')]({'where':{'type':_0x26b9e9,'resourceId':_0x31dca6['id']}})[_0x0327('0x26')](function(){return _0x5d1c2b;});})[_0x0327('0x26')](function(){_0x5e31e9['status'](0xcc)[_0x0327('0x32')]();});}};}function handleEntityNotFound(_0x5de8ee,_0x132552){return function(_0x53bb3e){if(!_0x53bb3e){_0x5de8ee[_0x0327('0x1a')](0x194);}return _0x53bb3e;};}function handleError(_0x32c751,_0x4c591f){_0x4c591f=_0x4c591f||0x1f4;return function(_0x29e8c4){logger['error'](_0x29e8c4[_0x0327('0x33')]);if(_0x29e8c4[_0x0327('0x34')]){delete _0x29e8c4[_0x0327('0x34')];}_0x32c751[_0x0327('0x1b')](_0x4c591f)[_0x0327('0x35')](_0x29e8c4);};}exports[_0x0327('0x36')]=function(_0x6a96d5,_0x54e7aa){var _0x2cf094={},_0x2c476e={},_0x1961a8={'count':0x0,'rows':[]};var _0x20534c=_['map'](db[_0x0327('0x37')][_0x0327('0x38')],function(_0x9e544b){return{'name':_0x9e544b[_0x0327('0x39')],'type':_0x9e544b[_0x0327('0x30')][_0x0327('0x3a')]};});_0x2c476e[_0x0327('0x3b')]=_[_0x0327('0x3c')](_0x20534c,_0x0327('0x34'));_0x2c476e[_0x0327('0x3d')]=_[_0x0327('0x3e')](_0x6a96d5['query']);_0x2c476e[_0x0327('0x3f')]=_[_0x0327('0x40')](_0x2c476e[_0x0327('0x3b')],_0x2c476e[_0x0327('0x3d')]);_0x2cf094['attributes']=_['intersection'](_0x2c476e[_0x0327('0x3b')],qs['fields'](_0x6a96d5[_0x0327('0x3d')][_0x0327('0x41')]));_0x2cf094[_0x0327('0x42')]=_0x2cf094['attributes'][_0x0327('0x43')]?_0x2cf094[_0x0327('0x42')]:_0x2c476e[_0x0327('0x3b')];if(!_0x6a96d5['query'][_0x0327('0x44')](_0x0327('0x45'))){_0x2cf094[_0x0327('0x1e')]=qs[_0x0327('0x1e')](_0x6a96d5[_0x0327('0x3d')][_0x0327('0x1e')]);_0x2cf094[_0x0327('0x1d')]=qs[_0x0327('0x1d')](_0x6a96d5[_0x0327('0x3d')][_0x0327('0x1d')]);}_0x2cf094['order']=qs[_0x0327('0x46')](_0x6a96d5[_0x0327('0x3d')][_0x0327('0x46')]);_0x2cf094['where']=qs[_0x0327('0x3f')](_[_0x0327('0x47')](_0x6a96d5[_0x0327('0x3d')],_0x2c476e[_0x0327('0x3f')]),_0x20534c);if(_0x6a96d5[_0x0327('0x3d')][_0x0327('0x2c')]){_0x2cf094[_0x0327('0x48')]=_[_0x0327('0x49')](_0x2cf094['where'],{'$or':_[_0x0327('0x3c')](_0x20534c,function(_0x384a0a){if(_0x384a0a[_0x0327('0x30')]!=='VIRTUAL'){var _0x55004b={};_0x55004b[_0x384a0a['name']]={'$like':'%'+_0x6a96d5[_0x0327('0x3d')]['filter']+'%'};return _0x55004b;}})});}_0x2cf094=_[_0x0327('0x49')]({},_0x2cf094,_0x6a96d5[_0x0327('0x4a')]);var _0x47235e={'where':_0x2cf094[_0x0327('0x48')]};return db['VoiceExtension'][_0x0327('0x1c')](_0x47235e)[_0x0327('0x26')](function(_0x47b774){_0x1961a8['count']=_0x47b774;if(_0x6a96d5[_0x0327('0x3d')][_0x0327('0x4b')]){_0x2cf094[_0x0327('0x4c')]=[{'all':!![]}];}return db[_0x0327('0x37')][_0x0327('0x4d')](_0x2cf094);})[_0x0327('0x26')](function(_0x3a3d21){_0x1961a8[_0x0327('0x4e')]=_0x3a3d21;return _0x1961a8;})[_0x0327('0x26')](respondWithFilteredResult(_0x54e7aa,_0x2cf094))[_0x0327('0x4f')](handleError(_0x54e7aa,null));};exports[_0x0327('0x50')]=function(_0x4efe53,_0x5122ef){var _0x41f5d4={'raw':![],'where':{'id':_0x4efe53['params']['id']}},_0x574049={};_0x574049[_0x0327('0x3b')]=_[_0x0327('0x3e')](db[_0x0327('0x37')][_0x0327('0x38')]);_0x574049[_0x0327('0x3d')]=_[_0x0327('0x3e')](_0x4efe53[_0x0327('0x3d')]);_0x574049['filters']=_[_0x0327('0x40')](_0x574049[_0x0327('0x3b')],_0x574049[_0x0327('0x3d')]);_0x41f5d4[_0x0327('0x42')]=_['intersection'](_0x574049[_0x0327('0x3b')],qs[_0x0327('0x41')](_0x4efe53[_0x0327('0x3d')][_0x0327('0x41')]));_0x41f5d4[_0x0327('0x42')]=_0x41f5d4[_0x0327('0x42')][_0x0327('0x43')]?_0x41f5d4[_0x0327('0x42')]:_0x574049[_0x0327('0x3b')];if(_0x4efe53[_0x0327('0x3d')][_0x0327('0x4b')]){_0x41f5d4[_0x0327('0x4c')]=[{'all':!![]}];}_0x41f5d4=_[_0x0327('0x49')]({},_0x41f5d4,_0x4efe53[_0x0327('0x4a')]);return db[_0x0327('0x37')][_0x0327('0x51')](_0x41f5d4)[_0x0327('0x26')](handleEntityNotFound(_0x5122ef,null))[_0x0327('0x26')](respondWithResult(_0x5122ef,null))['catch'](handleError(_0x5122ef,null));};exports[_0x0327('0x27')]=function(_0x420f2f,_0x581416){return db['VoiceExtension'][_0x0327('0x51')]({'where':{'id':_0x420f2f[_0x0327('0x52')]['id']}})[_0x0327('0x26')](handleEntityNotFound(_0x581416,null))[_0x0327('0x26')](removeEntity(_0x581416,null))['catch'](handleError(_0x581416,null));};exports[_0x0327('0x53')]=function(_0x2d08d3,_0x313170){if(_0x2d08d3[_0x0327('0x54')][_0x0327('0x30')]===_0x0327('0x2a')&&!_[_0x0327('0x55')](_0x2d08d3['body']['exten'],'_')){_0x2d08d3['body']['exten']='_'[_0x0327('0x56')](_0x2d08d3[_0x0327('0x54')][_0x0327('0x57')]);}return db['VoiceExtension'][_0x0327('0x53')](_0x2d08d3['body'],{'raw':![]})['then'](function(_0x43d7f3){var _0x221ead=_0x2d08d3[_0x0327('0x58')][_0x0327('0x59')]({'plain':!![]});if(!_0x221ead)throw new Error(_0x0327('0x5a'));if(_0x221ead[_0x0327('0x5b')]==='user'){var _0x4baba6=_0x43d7f3[_0x0327('0x59')]({'plain':!![]});var _0x2c5988=[{'name':_0x0327('0x28'),'value':_0x0327('0x5c')},{'name':_0x0327('0x29'),'value':'outbound'},{'name':_0x0327('0x2b'),'value':_0x0327('0x5d')}];var _0x3951d6=_['find'](_0x2c5988,[_0x0327('0x2e'),_0x4baba6[_0x0327('0x30')]])[_0x0327('0x34')];return db['UserProfileSection'][_0x0327('0x51')]({'where':{'name':_0x3951d6,'userProfileId':_0x221ead[_0x0327('0x5e')]},'raw':!![]})[_0x0327('0x26')](function(_0x15406c){if(_0x15406c&&_0x15406c[_0x0327('0x5f')]===0x0){return db['UserProfileResource'][_0x0327('0x53')]({'name':_0x4baba6[_0x0327('0x34')],'resourceId':_0x4baba6['id'],'type':_0x15406c[_0x0327('0x34')],'sectionId':_0x15406c['id']},{})[_0x0327('0x26')](function(){return _0x43d7f3;});}else{return _0x43d7f3;}})['catch'](function(_0x9b4891){logger[_0x0327('0x60')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9b4891);throw _0x9b4891;});}return _0x43d7f3;})[_0x0327('0x26')](respondWithResult(_0x313170,0xc9))['catch'](handleError(_0x313170,null));};exports[_0x0327('0x25')]=function(_0x192cb4,_0x5bee8f){if(_0x192cb4[_0x0327('0x54')]['id']){delete _0x192cb4[_0x0327('0x54')]['id'];}return db[_0x0327('0x37')]['find']({'where':{'id':_0x192cb4[_0x0327('0x52')]['id']}})[_0x0327('0x26')](handleEntityNotFound(_0x5bee8f,null))[_0x0327('0x26')](function(_0x13e214){if(_0x13e214){return db[_0x0327('0x37')][_0x0327('0x25')](_[_0x0327('0x47')](_0x192cb4[_0x0327('0x54')],['exten','context',_0x0327('0x61'),_0x0327('0x62'),_0x0327('0x63'),_0x0327('0x64')]),{'where':{'context':_0x13e214['context'],'exten':_0x13e214[_0x0327('0x57')]},'individualHooks':!![]})['then'](function(_0x45be98){return _0x45be98;});}return null;})[_0x0327('0x26')](respondWithStatusCode(_0x5bee8f,null))['catch'](handleError(_0x5bee8f,null));};exports[_0x0327('0x65')]=function(_0x12f7e5,_0x575775,_0x4c728a){return db[_0x0327('0x37')][_0x0327('0x66')]({'where':{'id':_0x12f7e5[_0x0327('0x52')]['id']}})['then'](handleEntityNotFound(_0x575775,null))[_0x0327('0x26')](function(_0x233bfa){if(_0x233bfa){return db['sequelize']['transaction'](function(_0x2566c6){return db[_0x0327('0x37')]['destroy']({'where':{'VoiceExtensionId':_0x12f7e5[_0x0327('0x52')]['id']},'transaction':_0x2566c6})[_0x0327('0x26')](function(_0x4bbdb8){var _0x60d1fb=_[_0x0327('0x3c')](_0x12f7e5['body'],function(_0x3d9f83){_0x3d9f83[_0x0327('0x67')]=_0x12f7e5[_0x0327('0x52')]['id'];return _0x3d9f83;});return db['VoiceExtension']['bulkCreate'](_0x60d1fb,{'transaction':_0x2566c6});});})[_0x0327('0x26')](function(){return db[_0x0327('0x37')][_0x0327('0x68')]({'where':{'isApp':!![],'VoiceExtensionId':_0x12f7e5[_0x0327('0x52')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x0327('0x26')](respondWithResult(_0x575775,null))['catch'](handleError(_0x575775,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4df63fb..81ea6ae 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 _0x4e2e=['../../mysqldb','VoiceExtension','setMaxListeners','remove','emit','hasOwnProperty','exports','events'];(function(_0x148a66,_0x1f1764){var _0x42c23e=function(_0x3d4599){while(--_0x3d4599){_0x148a66['push'](_0x148a66['shift']());}};_0x42c23e(++_0x1f1764);}(_0x4e2e,0x14f));var _0xe4e2=function(_0x1d8362,_0x4392f4){_0x1d8362=_0x1d8362-0x0;var _0x223be4=_0x4e2e[_0x1d8362];return _0x223be4;};'use strict';var EventEmitter=require(_0xe4e2('0x0'));var VoiceExtension=require(_0xe4e2('0x1'))['db'][_0xe4e2('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe4e2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe4e2('0x4')};function emitEvent(_0x3423f3){return function(_0x2e57f5,_0x427f6c,_0x1f6787){VoiceExtensionEvents['emit'](_0x3423f3+':'+_0x2e57f5['id'],_0x2e57f5);VoiceExtensionEvents[_0xe4e2('0x5')](_0x3423f3,_0x2e57f5);_0x1f6787(null);};}for(var e in events){if(events[_0xe4e2('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xe4e2('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x2229=['exports','events','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x11a5df,_0x2dd78e){var _0x33447a=function(_0x564e0e){while(--_0x564e0e){_0x11a5df['push'](_0x11a5df['shift']());}};_0x33447a(++_0x2dd78e);}(_0x2229,0xb5));var _0x9222=function(_0x392dc7,_0x2b5c91){_0x392dc7=_0x392dc7-0x0;var _0x440de9=_0x2229[_0x392dc7];return _0x440de9;};'use strict';var EventEmitter=require(_0x9222('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x9222('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9222('0x2')](0x0);var events={'afterCreate':_0x9222('0x3'),'afterUpdate':_0x9222('0x4'),'afterDestroy':_0x9222('0x5')};function emitEvent(_0x177fa8){return function(_0x646df9,_0x1fffd7,_0x5e632b){VoiceExtensionEvents[_0x9222('0x6')](_0x177fa8+':'+_0x646df9['id'],_0x646df9);VoiceExtensionEvents[_0x9222('0x6')](_0x177fa8,_0x646df9);_0x5e632b(null);};}for(var e in events){if(events[_0x9222('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x9222('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 d0a13a3..fcd1446 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 _0x0295=['../../config/environment','exports','define','VoiceExtension','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4abcf4,_0x4d80bc){var _0x24c066=function(_0x52ef99){while(--_0x52ef99){_0x4abcf4['push'](_0x4abcf4['shift']());}};_0x24c066(++_0x4d80bc);}(_0x0295,0x1d0));var _0x5029=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0x0295[_0x26d386];return _0x4ef9a8;};'use strict';var _=require(_0x5029('0x0'));var util=require(_0x5029('0x1'));var logger=require(_0x5029('0x2'))(_0x5029('0x3'));var moment=require(_0x5029('0x4'));var BPromise=require('bluebird');var rp=require(_0x5029('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5029('0x6'));var attributes=require('./voiceExtension.attributes');module[_0x5029('0x7')]=function(_0x12634d,_0x5308b8){return _0x12634d[_0x5029('0x8')](_0x5029('0x9'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf1d=['path','rimraf','../../config/environment','./voiceExtension.attributes','define','VoiceExtension','voice_extensions','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1249e6,_0x269ca6){var _0x423334=function(_0x2ccf7d){while(--_0x2ccf7d){_0x1249e6['push'](_0x1249e6['shift']());}};_0x423334(++_0x269ca6);}(_0xbf1d,0x6f));var _0xdbf1=function(_0x31cec9,_0x134300){_0x31cec9=_0x31cec9-0x0;var _0x5356a1=_0xbf1d[_0x31cec9];return _0x5356a1;};'use strict';var _=require(_0xdbf1('0x0'));var util=require('util');var logger=require(_0xdbf1('0x1'))(_0xdbf1('0x2'));var moment=require(_0xdbf1('0x3'));var BPromise=require(_0xdbf1('0x4'));var rp=require(_0xdbf1('0x5'));var fs=require('fs');var path=require(_0xdbf1('0x6'));var rimraf=require(_0xdbf1('0x7'));var config=require(_0xdbf1('0x8'));var attributes=require(_0xdbf1('0x9'));module['exports']=function(_0x1d2179,_0x97079c){return _0x1d2179[_0xdbf1('0xa')](_0xdbf1('0xb'),attributes,{'tableName':_0xdbf1('0xc'),'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 6dad9fc..74634bc 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 _0xe9d9=['attributes','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceExtension','VoiceExtension','options','raw','limit','include','model'];(function(_0x271607,_0x1cdaf2){var _0x2e87c1=function(_0x3186b2){while(--_0x3186b2){_0x271607['push'](_0x271607['shift']());}};_0x2e87c1(++_0x1cdaf2);}(_0xe9d9,0x1d6));var _0x9e9d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe9d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9e9d('0x0'));var util=require(_0x9e9d('0x1'));var moment=require(_0x9e9d('0x2'));var BPromise=require(_0x9e9d('0x3'));var rs=require(_0x9e9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e9d('0x5'))['db'];var utils=require(_0x9e9d('0x6'));var logger=require('../../config/logger')(_0x9e9d('0x7'));var config=require(_0x9e9d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9e9d('0x9')][_0x9e9d('0xa')]({'port':0x232a});config[_0x9e9d('0xb')]=_['defaults'](config[_0x9e9d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e9d('0xb')]));require(_0x9e9d('0xc'))[_0x9e9d('0xd')](socket);function respondWithRpcPromise(_0x24b07d,_0x36ff98,_0x263664){return new BPromise(function(_0x597b42,_0x8f8fd7){return client[_0x9e9d('0xe')](_0x24b07d,_0x263664)[_0x9e9d('0xf')](function(_0x4ac5c0){logger['info'](_0x9e9d('0x10'),_0x36ff98,_0x9e9d('0x11'));logger[_0x9e9d('0x12')](_0x9e9d('0x13'),_0x36ff98,'request\x20sent',JSON[_0x9e9d('0x14')](_0x4ac5c0));if(_0x4ac5c0[_0x9e9d('0x15')]){if(_0x4ac5c0[_0x9e9d('0x15')][_0x9e9d('0x16')]===0x1f4){logger[_0x9e9d('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x36ff98,_0x4ac5c0[_0x9e9d('0x15')]['message']);return _0x8f8fd7(_0x4ac5c0[_0x9e9d('0x15')]['message']);}logger['error'](_0x9e9d('0x10'),_0x36ff98,_0x4ac5c0[_0x9e9d('0x15')][_0x9e9d('0x17')]);return _0x597b42(_0x4ac5c0['error'][_0x9e9d('0x17')]);}else{logger[_0x9e9d('0x18')](_0x9e9d('0x10'),_0x36ff98,_0x9e9d('0x11'));_0x597b42(_0x4ac5c0[_0x9e9d('0x19')][_0x9e9d('0x17')]);}})[_0x9e9d('0x1a')](function(_0x24ecce){logger[_0x9e9d('0x15')](_0x9e9d('0x10'),_0x36ff98,_0x24ecce);_0x8f8fd7(_0x24ecce);});});}exports[_0x9e9d('0x1b')]=function(_0xeb994c){var _0x1c574e=this;return new Promise(function(_0x1b54ee,_0x3fc91a){return db[_0x9e9d('0x1c')]['findAll']({'raw':_0xeb994c['options']?_0xeb994c[_0x9e9d('0x1d')][_0x9e9d('0x1e')]===undefined?!![]:![]:!![],'where':_0xeb994c[_0x9e9d('0x1d')]?_0xeb994c[_0x9e9d('0x1d')]['where']||null:null,'attributes':_0xeb994c[_0x9e9d('0x1d')]?_0xeb994c['options']['attributes']||null:null,'limit':_0xeb994c[_0x9e9d('0x1d')]?_0xeb994c['options'][_0x9e9d('0x1f')]||null:null,'include':_0xeb994c[_0x9e9d('0x1d')]?_0xeb994c[_0x9e9d('0x1d')][_0x9e9d('0x20')]?_['map'](_0xeb994c[_0x9e9d('0x1d')]['include'],function(_0x21aa49){return{'model':db[_0x21aa49[_0x9e9d('0x21')]],'as':_0x21aa49['as'],'attributes':_0x21aa49[_0x9e9d('0x22')],'include':_0x21aa49[_0x9e9d('0x20')]?_[_0x9e9d('0x23')](_0x21aa49[_0x9e9d('0x20')],function(_0x2c3729){return{'model':db[_0x2c3729[_0x9e9d('0x21')]],'as':_0x2c3729['as'],'attributes':_0x2c3729[_0x9e9d('0x22')],'include':_0x2c3729['include']?_[_0x9e9d('0x23')](_0x2c3729['include'],function(_0x15f888){return{'model':db[_0x15f888[_0x9e9d('0x21')]],'as':_0x15f888['as'],'attributes':_0x15f888[_0x9e9d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9e9d('0xf')](function(_0x421864){logger[_0x9e9d('0x18')]('GetVoiceExtension',_0xeb994c);logger['debug']('GetVoiceExtension',_0xeb994c,JSON[_0x9e9d('0x14')](_0x421864));_0x1b54ee(_0x421864);})[_0x9e9d('0x1a')](function(_0x191529){logger[_0x9e9d('0x15')]('GetVoiceExtension',_0x191529[_0x9e9d('0x17')],_0xeb994c);_0x3fc91a(_0x1c574e[_0x9e9d('0x15')](0x1f4,_0x191529[_0x9e9d('0x17')]));});});}; \ No newline at end of file +var _0x9da9=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','attributes','model','map','then','lodash','bluebird'];(function(_0x4ac266,_0x197dab){var _0x3c8fe3=function(_0x500837){while(--_0x500837){_0x4ac266['push'](_0x4ac266['shift']());}};_0x3c8fe3(++_0x197dab);}(_0x9da9,0x14b));var _0x99da=function(_0x533381,_0x8a69fa){_0x533381=_0x533381-0x0;var _0x2877ed=_0x9da9[_0x533381];return _0x2877ed;};'use strict';var _=require(_0x99da('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x99da('0x1'));var rs=require(_0x99da('0x2'));var fs=require('fs');var Redis=require(_0x99da('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x99da('0x4'))('rpc');var config=require(_0x99da('0x5'));var jayson=require(_0x99da('0x6'));var client=jayson[_0x99da('0x7')][_0x99da('0x8')]({'port':0x232a});config[_0x99da('0x9')]=_[_0x99da('0xa')](config[_0x99da('0x9')],{'host':_0x99da('0xb'),'port':0x18eb});var socket=require(_0x99da('0xc'))(new Redis(config[_0x99da('0x9')]));require('./voiceExtension.socket')[_0x99da('0xd')](socket);function respondWithRpcPromise(_0x1a9d7d,_0x410cfb,_0x186f9a){return new BPromise(function(_0x462bb5,_0x4144dd){return client['request'](_0x1a9d7d,_0x186f9a)['then'](function(_0x5122a2){logger[_0x99da('0xe')](_0x99da('0xf'),_0x410cfb,'request\x20sent');logger[_0x99da('0x10')](_0x99da('0x11'),_0x410cfb,_0x99da('0x12'),JSON[_0x99da('0x13')](_0x5122a2));if(_0x5122a2[_0x99da('0x14')]){if(_0x5122a2[_0x99da('0x14')][_0x99da('0x15')]===0x1f4){logger[_0x99da('0x14')](_0x99da('0xf'),_0x410cfb,_0x5122a2[_0x99da('0x14')][_0x99da('0x16')]);return _0x4144dd(_0x5122a2[_0x99da('0x14')]['message']);}logger[_0x99da('0x14')](_0x99da('0xf'),_0x410cfb,_0x5122a2[_0x99da('0x14')][_0x99da('0x16')]);return _0x462bb5(_0x5122a2[_0x99da('0x14')][_0x99da('0x16')]);}else{logger['info'](_0x99da('0xf'),_0x410cfb,'request\x20sent');_0x462bb5(_0x5122a2[_0x99da('0x17')][_0x99da('0x16')]);}})[_0x99da('0x18')](function(_0x34e4fb){logger['error'](_0x99da('0xf'),_0x410cfb,_0x34e4fb);_0x4144dd(_0x34e4fb);});});}exports[_0x99da('0x19')]=function(_0x33f1b5){var _0xaa6acf=this;return new Promise(function(_0x3627a8,_0x14d64b){return db[_0x99da('0x1a')][_0x99da('0x1b')]({'raw':_0x33f1b5['options']?_0x33f1b5[_0x99da('0x1c')][_0x99da('0x1d')]===undefined?!![]:![]:!![],'where':_0x33f1b5[_0x99da('0x1c')]?_0x33f1b5[_0x99da('0x1c')][_0x99da('0x1e')]||null:null,'attributes':_0x33f1b5['options']?_0x33f1b5[_0x99da('0x1c')]['attributes']||null:null,'limit':_0x33f1b5[_0x99da('0x1c')]?_0x33f1b5[_0x99da('0x1c')][_0x99da('0x1f')]||null:null,'include':_0x33f1b5[_0x99da('0x1c')]?_0x33f1b5[_0x99da('0x1c')]['include']?_['map'](_0x33f1b5[_0x99da('0x1c')][_0x99da('0x20')],function(_0x52b8a3){return{'model':db[_0x52b8a3['model']],'as':_0x52b8a3['as'],'attributes':_0x52b8a3[_0x99da('0x21')],'include':_0x52b8a3[_0x99da('0x20')]?_['map'](_0x52b8a3[_0x99da('0x20')],function(_0x3c9820){return{'model':db[_0x3c9820[_0x99da('0x22')]],'as':_0x3c9820['as'],'attributes':_0x3c9820[_0x99da('0x21')],'include':_0x3c9820['include']?_[_0x99da('0x23')](_0x3c9820[_0x99da('0x20')],function(_0x1ba5a9){return{'model':db[_0x1ba5a9[_0x99da('0x22')]],'as':_0x1ba5a9['as'],'attributes':_0x1ba5a9[_0x99da('0x21')]};}):[]};}):[]};}):[]:[]})[_0x99da('0x24')](function(_0x309757){logger[_0x99da('0xe')](_0x99da('0x19'),_0x33f1b5);logger[_0x99da('0x10')](_0x99da('0x19'),_0x33f1b5,JSON[_0x99da('0x13')](_0x309757));_0x3627a8(_0x309757);})[_0x99da('0x18')](function(_0x564f20){logger[_0x99da('0x14')](_0x99da('0x19'),_0x564f20[_0x99da('0x16')],_0x33f1b5);_0x14d64b(_0xaa6acf[_0x99da('0x14')](0x1f4,_0x564f20[_0x99da('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index b194c4f..8a35a41 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 _0xb704=['./voiceExtension.events','save','remove','update','length'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xb704,0x18b));var _0x4b70=function(_0x453789,_0x5e6891){_0x453789=_0x453789-0x0;var _0x17758e=_0xb704[_0x453789];return _0x17758e;};'use strict';var VoiceExtensionEvents=require(_0x4b70('0x0'));var events=[_0x4b70('0x1'),_0x4b70('0x2'),_0x4b70('0x3')];function createListener(_0x20ce09,_0xa3c045){return function(_0x4e78e2){_0xa3c045['emit'](_0x20ce09,_0x4e78e2);};}function removeListener(_0x3b8f9d,_0xebb8d4){return function(){VoiceExtensionEvents['removeListener'](_0x3b8f9d,_0xebb8d4);};}exports['register']=function(_0x47a53d){for(var _0x1839d6=0x0,_0x48fff6=events[_0x4b70('0x4')];_0x1839d6<_0x48fff6;_0x1839d6++){var _0x4d28e4=events[_0x1839d6];var _0x168552=createListener('voiceExtension:'+_0x4d28e4,_0x47a53d);VoiceExtensionEvents['on'](_0x4d28e4,_0x168552);}}; \ No newline at end of file +var _0x6517=['save','remove','update','emit','removeListener','register','./voiceExtension.events'];(function(_0x2002a6,_0x2b870f){var _0x5e605e=function(_0x270382){while(--_0x270382){_0x2002a6['push'](_0x2002a6['shift']());}};_0x5e605e(++_0x2b870f);}(_0x6517,0x102));var _0x7651=function(_0x236066,_0x4c4716){_0x236066=_0x236066-0x0;var _0x14cd4f=_0x6517[_0x236066];return _0x14cd4f;};'use strict';var VoiceExtensionEvents=require(_0x7651('0x0'));var events=[_0x7651('0x1'),_0x7651('0x2'),_0x7651('0x3')];function createListener(_0x298eb9,_0x2817e7){return function(_0x123452){_0x2817e7[_0x7651('0x4')](_0x298eb9,_0x123452);};}function removeListener(_0x2196d7,_0x40e15a){return function(){VoiceExtensionEvents[_0x7651('0x5')](_0x2196d7,_0x40e15a);};}exports[_0x7651('0x6')]=function(_0x3f26c7){for(var _0xdcf1c2=0x0,_0xc63096=events['length'];_0xdcf1c2<_0xc63096;_0xdcf1c2++){var _0x47c0e5=events[_0xdcf1c2];var _0x2caf5b=createListener('voiceExtension:'+_0x47c0e5,_0x3f26c7);VoiceExtensionEvents['on'](_0x47c0e5,_0x2caf5b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 645f8f3..5756453 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 _0x79d6=['connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x79d6,0x166));var _0x679d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x79d6[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x679d('0x0'));var path=require(_0x679d('0x1'));var timeout=require(_0x679d('0x2'));var express=require(_0x679d('0x3'));var router=express[_0x679d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x679d('0x5'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router['get']('/',auth[_0x679d('0x6')](),controller[_0x679d('0x7')]);router[_0x679d('0x8')](_0x679d('0x9'),auth[_0x679d('0x6')](),controller[_0x679d('0xa')]);router[_0x679d('0x8')](_0x679d('0xb'),auth['isAuthenticated'](),controller[_0x679d('0xc')]);router[_0x679d('0xd')]('/',auth[_0x679d('0x6')](),controller[_0x679d('0xe')]);router[_0x679d('0xf')](_0x679d('0x9'),auth[_0x679d('0x6')](),controller[_0x679d('0x10')]);router[_0x679d('0x11')](_0x679d('0x9'),auth[_0x679d('0x6')](),controller[_0x679d('0x12')]);module[_0x679d('0x13')]=router; \ No newline at end of file +var _0xd826=['Router','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x157e98,_0x8b5c7e){var _0x253d7f=function(_0x84ede9){while(--_0x84ede9){_0x157e98['push'](_0x157e98['shift']());}};_0x253d7f(++_0x8b5c7e);}(_0xd826,0x13e));var _0x6d82=function(_0x44a288,_0xe03409){_0x44a288=_0x44a288-0x0;var _0x533f85=_0xd826[_0x44a288];return _0x533f85;};'use strict';var multer=require(_0x6d82('0x0'));var util=require(_0x6d82('0x1'));var path=require(_0x6d82('0x2'));var timeout=require(_0x6d82('0x3'));var express=require(_0x6d82('0x4'));var router=express[_0x6d82('0x5')]();var auth=require(_0x6d82('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6d82('0x7'));router[_0x6d82('0x8')]('/',auth[_0x6d82('0x9')](),controller[_0x6d82('0xa')]);router[_0x6d82('0x8')](_0x6d82('0xb'),auth[_0x6d82('0x9')](),controller[_0x6d82('0xc')]);router[_0x6d82('0x8')]('/:id/messages',auth[_0x6d82('0x9')](),controller[_0x6d82('0xd')]);router['post']('/',auth[_0x6d82('0x9')](),controller[_0x6d82('0xe')]);router[_0x6d82('0xf')](_0x6d82('0xb'),auth[_0x6d82('0x9')](),controller[_0x6d82('0x10')]);router['delete'](_0x6d82('0xb'),auth[_0x6d82('0x9')](),controller[_0x6d82('0x11')]);module[_0x6d82('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 11cf797..eb2d880 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 _0x7916=['\x20-\x20','mailbox','sequelize','STRING','contest_mailbox','setDataValue','email','trim','ENUM','yes','TINYINT(4)','INTEGER','getDataValue','fullname'];(function(_0x40d775,_0x1daf01){var _0x3b709d=function(_0x37fb54){while(--_0x37fb54){_0x40d775['push'](_0x40d775['shift']());}};_0x3b709d(++_0x1daf01);}(_0x7916,0x128));var _0x6791=function(_0x361227,_0xe30d55){_0x361227=_0x361227-0x0;var _0x16192b=_0x7916[_0x361227];return _0x16192b;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x6791('0x1')]},'context':{'type':Sequelize[_0x6791('0x1')],'defaultValue':'from-voicemail','unique':_0x6791('0x2')},'mailbox':{'type':Sequelize[_0x6791('0x1')],'defaultValue':'','allowNull':![],'unique':_0x6791('0x2')},'password':{'type':Sequelize[_0x6791('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6791('0x1')],'validate':{'isEmail':!![]},'set':function(_0x5a5726){this[_0x6791('0x3')](_0x6791('0x4'),typeof _0x5a5726==='string'&&_0x5a5726[_0x6791('0x5')]()?_0x5a5726['trim']():null);}},'pager':{'type':Sequelize[_0x6791('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':_0x6791('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x6791('0x1')]},'review':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x6791('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x6791('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x6791('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x6791('0x7'),'no'),'defaultValue':_0x6791('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x6791('0x1')]},'emailbody':{'type':Sequelize[_0x6791('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x6791('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6791('0xa')](_0x6791('0xb'))+_0x6791('0xc')+this[_0x6791('0xa')](_0x6791('0xd'));}}}; \ No newline at end of file +var _0x878f=['contest_mailbox','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail'];(function(_0x4f96d4,_0x241b81){var _0x55531b=function(_0xc4c2c5){while(--_0xc4c2c5){_0x4f96d4['push'](_0x4f96d4['shift']());}};_0x55531b(++_0x241b81);}(_0x878f,0x173));var _0xf878=function(_0x471d7b,_0xcce7a8){_0x471d7b=_0x471d7b-0x0;var _0xafa6ce=_0x878f[_0x471d7b];return _0xafa6ce;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'customer_id':{'type':Sequelize[_0xf878('0x1')]},'context':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x2'),'unique':_0xf878('0x3')},'mailbox':{'type':Sequelize[_0xf878('0x1')],'defaultValue':'','allowNull':![],'unique':_0xf878('0x3')},'password':{'type':Sequelize[_0xf878('0x1')]},'fullname':{'type':Sequelize[_0xf878('0x1')]},'email':{'type':Sequelize[_0xf878('0x1')],'validate':{'isEmail':!![]},'set':function(_0x27ae4d){this['setDataValue']('email',typeof _0x27ae4d===_0xf878('0x4')&&_0x27ae4d[_0xf878('0x5')]()?_0x27ae4d['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xf878('0x6')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf878('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xf878('0x1')]},'callback':{'type':Sequelize[_0xf878('0x1')]},'review':{'type':Sequelize['ENUM'](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf878('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf878('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf878('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf878('0x8')](_0xf878('0x7'),'no'),'defaultValue':_0xf878('0x7'),'allowNull':![]},'stamp':{'type':_0xf878('0xa')},'emailsubject':{'type':Sequelize[_0xf878('0x1')]},'emailbody':{'type':Sequelize[_0xf878('0x1')]},'maxsecs':{'type':Sequelize[_0xf878('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf878('0xc')],'get':function(){return this[_0xf878('0xd')](_0xf878('0xe'))+_0xf878('0xf')+this[_0xf878('0xd')](_0xf878('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index fda9e01..2029da5 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 _0x46cb=['name','send','index','rawAttributes','fieldName','type','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','VoiceMail','findAll','rows','catch','show','params','options','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','getMessages','findOne','mailbox','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','update','then','destroy','get','Voicemails','error','stack'];(function(_0x813c01,_0x47e96b){var _0x3668f7=function(_0x13f972){while(--_0x13f972){_0x813c01['push'](_0x813c01['shift']());}};_0x3668f7(++_0x47e96b);}(_0x46cb,0x84));var _0xb46c=function(_0x3951ff,_0x4a06e0){_0x3951ff=_0x3951ff-0x0;var _0x487314=_0x46cb[_0x3951ff];return _0x487314;};'use strict';var pdf=require(_0xb46c('0x0'));var emlformat=require(_0xb46c('0x1'));var rimraf=require(_0xb46c('0x2'));var zipdir=require(_0xb46c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb46c('0x4'));var moment=require(_0xb46c('0x5'));var BPromise=require(_0xb46c('0x6'));var Mustache=require(_0xb46c('0x7'));var util=require('util');var path=require(_0xb46c('0x8'));var sox=require(_0xb46c('0x9'));var csv=require(_0xb46c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb46c('0xb'));var squel=require('squel');var crypto=require(_0xb46c('0xc'));var jsforce=require(_0xb46c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb46c('0xe'));var Papa=require(_0xb46c('0xf'));var Redis=require(_0xb46c('0x10'));var authService=require(_0xb46c('0x11'));var qs=require(_0xb46c('0x12'));var as=require(_0xb46c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb46c('0x14'))(_0xb46c('0x15'));var utils=require(_0xb46c('0x16'));var config=require(_0xb46c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb46c('0x18'))['db'];function respondWithStatusCode(_0x3059da,_0x1dd251){_0x1dd251=_0x1dd251||0xcc;return function(_0x4a3399){if(_0x4a3399){return _0x3059da[_0xb46c('0x19')](_0x1dd251);}return _0x3059da[_0xb46c('0x1a')](_0x1dd251)['end']();};}function respondWithResult(_0x18f1d0,_0x213f4a){_0x213f4a=_0x213f4a||0xc8;return function(_0x967278){if(_0x967278){return _0x18f1d0[_0xb46c('0x1a')](_0x213f4a)[_0xb46c('0x1b')](_0x967278);}};}function respondWithFilteredResult(_0x45c3e1,_0x172bb8){return function(_0x5d431b){if(_0x5d431b){var _0xe4261a=_0x5d431b[_0xb46c('0x1c')],_0x2d9c4d=_0x172bb8[_0xb46c('0x1d')],_0x89c6a8=_0x172bb8['offset']+_0x172bb8['limit'],_0x118f95;if(_0x89c6a8>=_0xe4261a){_0x89c6a8=_0xe4261a;_0x118f95=0xc8;}else{_0x118f95=0xce;}_0x45c3e1[_0xb46c('0x1a')](_0x118f95);return _0x45c3e1['set'](_0xb46c('0x1e'),_0x2d9c4d+'-'+_0x89c6a8+'/'+_0xe4261a)[_0xb46c('0x1b')](_0x5d431b);}return null;};}function patchUpdates(_0xcebe61){return function(_0x32ade3){try{jsonpatch['apply'](_0x32ade3,_0xcebe61,!![]);}catch(_0x200091){return BPromise['reject'](_0x200091);}return _0x32ade3['save']();};}function saveUpdates(_0x87d31d,_0x1b8c8d){return function(_0x41467a){if(_0x41467a){return _0x41467a[_0xb46c('0x1f')](_0x87d31d)[_0xb46c('0x20')](function(_0x3bda01){return _0x3bda01;});}return null;};}function removeEntity(_0x5f3cfb,_0x4d68b1){return function(_0x184038){if(_0x184038){return _0x184038[_0xb46c('0x21')]()[_0xb46c('0x20')](function(){var _0x11b121=_0x184038[_0xb46c('0x22')]({'plain':!![]});var _0x2b4412=_0xb46c('0x23');return db['UserProfileResource'][_0xb46c('0x21')]({'where':{'type':_0x2b4412,'resourceId':_0x11b121['id']}})[_0xb46c('0x20')](function(){return _0x184038;});})[_0xb46c('0x20')](function(){_0x5f3cfb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20fc36,_0x377a32){return function(_0x3ff2a6){if(!_0x3ff2a6){_0x20fc36[_0xb46c('0x19')](0x194);}return _0x3ff2a6;};}function handleError(_0x463a71,_0x48266){_0x48266=_0x48266||0x1f4;return function(_0x3332ee){logger[_0xb46c('0x24')](_0x3332ee[_0xb46c('0x25')]);if(_0x3332ee[_0xb46c('0x26')]){delete _0x3332ee[_0xb46c('0x26')];}_0x463a71[_0xb46c('0x1a')](_0x48266)[_0xb46c('0x27')](_0x3332ee);};}exports[_0xb46c('0x28')]=function(_0x3cd6e0,_0x3fab04){var _0x56310b={},_0x2412a7={},_0x493baa={'count':0x0,'rows':[]};var _0x477228=_['map'](db['VoiceMail'][_0xb46c('0x29')],function(_0x2831e0){return{'name':_0x2831e0[_0xb46c('0x2a')],'type':_0x2831e0[_0xb46c('0x2b')]['key']};});_0x2412a7[_0xb46c('0x2c')]=_[_0xb46c('0x2d')](_0x477228,_0xb46c('0x26'));_0x2412a7['query']=_[_0xb46c('0x2e')](_0x3cd6e0['query']);_0x2412a7[_0xb46c('0x2f')]=_['intersection'](_0x2412a7[_0xb46c('0x2c')],_0x2412a7[_0xb46c('0x30')]);_0x56310b[_0xb46c('0x31')]=_[_0xb46c('0x32')](_0x2412a7[_0xb46c('0x2c')],qs[_0xb46c('0x33')](_0x3cd6e0[_0xb46c('0x30')][_0xb46c('0x33')]));_0x56310b[_0xb46c('0x31')]=_0x56310b[_0xb46c('0x31')][_0xb46c('0x34')]?_0x56310b[_0xb46c('0x31')]:_0x2412a7['model'];if(!_0x3cd6e0[_0xb46c('0x30')][_0xb46c('0x35')]('nolimit')){_0x56310b['limit']=qs['limit'](_0x3cd6e0['query'][_0xb46c('0x36')]);_0x56310b['offset']=qs[_0xb46c('0x1d')](_0x3cd6e0[_0xb46c('0x30')][_0xb46c('0x1d')]);}_0x56310b[_0xb46c('0x37')]=qs['sort'](_0x3cd6e0[_0xb46c('0x30')][_0xb46c('0x38')]);_0x56310b['where']=qs[_0xb46c('0x2f')](_[_0xb46c('0x39')](_0x3cd6e0['query'],_0x2412a7[_0xb46c('0x2f')]),_0x477228);if(_0x3cd6e0['query'][_0xb46c('0x3a')]){_0x56310b[_0xb46c('0x3b')]=_[_0xb46c('0x3c')](_0x56310b[_0xb46c('0x3b')],{'$or':_['map'](_0x477228,function(_0x2f9856){if(_0x2f9856['type']!==_0xb46c('0x3d')){var _0x3d3b7b={};_0x3d3b7b[_0x2f9856['name']]={'$like':'%'+_0x3cd6e0[_0xb46c('0x30')][_0xb46c('0x3a')]+'%'};return _0x3d3b7b;}})});}_0x56310b=_[_0xb46c('0x3c')]({},_0x56310b,_0x3cd6e0['options']);var _0x5a77ee={'where':_0x56310b[_0xb46c('0x3b')]};return db[_0xb46c('0x3e')]['count'](_0x5a77ee)[_0xb46c('0x20')](function(_0x58461e){_0x493baa[_0xb46c('0x1c')]=_0x58461e;if(_0x3cd6e0[_0xb46c('0x30')]['includeAll']){_0x56310b['include']=[{'all':!![]}];}return db[_0xb46c('0x3e')][_0xb46c('0x3f')](_0x56310b);})[_0xb46c('0x20')](function(_0x18441e){_0x493baa[_0xb46c('0x40')]=_0x18441e;return _0x493baa;})['then'](respondWithFilteredResult(_0x3fab04,_0x56310b))[_0xb46c('0x41')](handleError(_0x3fab04,null));};exports[_0xb46c('0x42')]=function(_0x4fd0d9,_0x20d2e5){var _0x537f6f={'raw':!![],'where':{'id':_0x4fd0d9[_0xb46c('0x43')]['id']}},_0x7db35d={};_0x7db35d[_0xb46c('0x2c')]=_['keys'](db[_0xb46c('0x3e')]['rawAttributes']);_0x7db35d[_0xb46c('0x30')]=_[_0xb46c('0x2e')](_0x4fd0d9[_0xb46c('0x30')]);_0x7db35d[_0xb46c('0x2f')]=_[_0xb46c('0x32')](_0x7db35d[_0xb46c('0x2c')],_0x7db35d[_0xb46c('0x30')]);_0x537f6f['attributes']=_[_0xb46c('0x32')](_0x7db35d['model'],qs[_0xb46c('0x33')](_0x4fd0d9[_0xb46c('0x30')]['fields']));_0x537f6f[_0xb46c('0x31')]=_0x537f6f[_0xb46c('0x31')][_0xb46c('0x34')]?_0x537f6f['attributes']:_0x7db35d['model'];if(_0x4fd0d9['query']['includeAll']){_0x537f6f['include']=[{'all':!![]}];}_0x537f6f=_[_0xb46c('0x3c')]({},_0x537f6f,_0x4fd0d9[_0xb46c('0x44')]);return db[_0xb46c('0x3e')][_0xb46c('0x45')](_0x537f6f)[_0xb46c('0x20')](handleEntityNotFound(_0x20d2e5,null))[_0xb46c('0x20')](respondWithResult(_0x20d2e5,null))[_0xb46c('0x41')](handleError(_0x20d2e5,null));};exports[_0xb46c('0x46')]=function(_0x258210,_0x111d55){return db['VoiceMail'][_0xb46c('0x46')](_0x258210[_0xb46c('0x47')],{})['then'](function(_0x4db28a){var _0x63d0d6=_0x258210['user'][_0xb46c('0x22')]({'plain':!![]});if(!_0x63d0d6)throw new Error(_0xb46c('0x48'));if(_0x63d0d6[_0xb46c('0x49')]===_0xb46c('0x4a')){var _0x32ad41=_0x4db28a[_0xb46c('0x22')]({'plain':!![]});var _0x306c37=_0xb46c('0x23');return db[_0xb46c('0x4b')]['find']({'where':{'name':_0x306c37,'userProfileId':_0x63d0d6[_0xb46c('0x4c')]},'raw':!![]})[_0xb46c('0x20')](function(_0x15721d){if(_0x15721d&&_0x15721d[_0xb46c('0x4d')]===0x0){return db[_0xb46c('0x4e')][_0xb46c('0x46')]({'name':_0x32ad41[_0xb46c('0x26')],'resourceId':_0x32ad41['id'],'type':_0x15721d[_0xb46c('0x26')],'sectionId':_0x15721d['id']},{})[_0xb46c('0x20')](function(){return _0x4db28a;});}else{return _0x4db28a;}})[_0xb46c('0x41')](function(_0x191054){logger['error'](_0xb46c('0x4f'),_0x191054);throw _0x191054;});}return _0x4db28a;})[_0xb46c('0x20')](respondWithResult(_0x111d55,0xc9))['catch'](handleError(_0x111d55,null));};exports[_0xb46c('0x1f')]=function(_0x4ed367,_0x2d054b){if(_0x4ed367[_0xb46c('0x47')]['id']){delete _0x4ed367[_0xb46c('0x47')]['id'];}return db[_0xb46c('0x3e')][_0xb46c('0x45')]({'where':{'id':_0x4ed367[_0xb46c('0x43')]['id']}})[_0xb46c('0x20')](handleEntityNotFound(_0x2d054b,null))['then'](saveUpdates(_0x4ed367[_0xb46c('0x47')],null))[_0xb46c('0x20')](respondWithResult(_0x2d054b,null))[_0xb46c('0x41')](handleError(_0x2d054b,null));};exports[_0xb46c('0x21')]=function(_0x259642,_0x5e3baa){return db[_0xb46c('0x3e')][_0xb46c('0x45')]({'where':{'id':_0x259642[_0xb46c('0x43')]['id']}})[_0xb46c('0x20')](handleEntityNotFound(_0x5e3baa,null))[_0xb46c('0x20')](removeEntity(_0x5e3baa,null))['catch'](handleError(_0x5e3baa,null));};exports[_0xb46c('0x50')]=function(_0x35ed5c,_0x4b38eb,_0xbd2ea4){return db[_0xb46c('0x3e')][_0xb46c('0x51')]({'where':{'id':_0x35ed5c[_0xb46c('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b38eb,null))[_0xb46c('0x20')](function(_0x5cfc54){var _0x20291a;var _0x433530={},_0x15a80b={};_0x15a80b['model']=_[_0xb46c('0x2e')](db['VoiceMailMessage'][_0xb46c('0x29')]);_0x15a80b[_0xb46c('0x30')]=_['keys'](_0x35ed5c['query']);_0x15a80b['filters']=_[_0xb46c('0x32')](_0x15a80b[_0xb46c('0x2c')],_0x15a80b[_0xb46c('0x30')]);_0x433530[_0xb46c('0x31')]=_[_0xb46c('0x32')](_0x15a80b[_0xb46c('0x2c')],qs[_0xb46c('0x33')](_0x35ed5c['query'][_0xb46c('0x33')]));_0x433530[_0xb46c('0x31')]=_0x433530['attributes'][_0xb46c('0x34')]?_0x433530['attributes']:_0x15a80b[_0xb46c('0x2c')];if(!_0x35ed5c[_0xb46c('0x30')][_0xb46c('0x35')]('nolimit')){_0x433530[_0xb46c('0x36')]=qs[_0xb46c('0x36')](_0x35ed5c[_0xb46c('0x30')][_0xb46c('0x36')]);_0x433530[_0xb46c('0x1d')]=qs[_0xb46c('0x1d')](_0x35ed5c[_0xb46c('0x30')][_0xb46c('0x1d')]);}_0x433530['order']=qs[_0xb46c('0x38')](_0x35ed5c[_0xb46c('0x30')][_0xb46c('0x38')]);_0x433530['where']=qs[_0xb46c('0x2f')](_[_0xb46c('0x39')](_0x35ed5c[_0xb46c('0x30')],_0x15a80b[_0xb46c('0x2f')]));if(_0x35ed5c[_0xb46c('0x30')]['filter']){_0x433530[_0xb46c('0x3b')]=_['merge'](_0x433530['where'],{'$or':_[_0xb46c('0x2d')](_0x433530[_0xb46c('0x31')],function(_0x2c110c){var _0x107c87={};_0x107c87[_0x2c110c]={'$like':'%'+_0x35ed5c['query'][_0xb46c('0x3a')]+'%'};return _0x107c87;})});}_0x433530[_0xb46c('0x3b')]=_[_0xb46c('0x3c')](_0x433530['where'],{'mailboxuser':_0x5cfc54[_0xb46c('0x52')]});_0x433530=_[_0xb46c('0x3c')]({},_0x433530,_0x35ed5c[_0xb46c('0x44')]);return db[_0xb46c('0x53')][_0xb46c('0x54')](_0x433530)['then'](respondWithFilteredResult(_0x4b38eb,_0x433530));})['catch'](handleError(_0x4b38eb,null));}; \ No newline at end of file +var _0xf4f4=['apply','reject','save','update','then','destroy','Voicemails','end','sendStatus','error','name','VoiceMail','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','keys','length','find','create','body','user','get','role','UserProfileSection','autoAssociation','UserProfileResource','params','getMessages','VoiceMailMessage','mailbox','findAndCountAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/logger','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','json'];(function(_0x163beb,_0x4de43b){var _0x53cb8a=function(_0x142972){while(--_0x142972){_0x163beb['push'](_0x163beb['shift']());}};_0x53cb8a(++_0x4de43b);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x5032c2,_0x159065){_0x5032c2=_0x5032c2-0x0;var _0x28a563=_0xf4f4[_0x5032c2];return _0x28a563;};'use strict';var pdf=require(_0x4f4f('0x0'));var emlformat=require(_0x4f4f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4f4f('0x2'));var jsonpatch=require(_0x4f4f('0x3'));var rp=require(_0x4f4f('0x4'));var moment=require(_0x4f4f('0x5'));var BPromise=require(_0x4f4f('0x6'));var Mustache=require('mustache');var util=require(_0x4f4f('0x7'));var path=require('path');var sox=require(_0x4f4f('0x8'));var csv=require(_0x4f4f('0x9'));var ejs=require(_0x4f4f('0xa'));var fs=require('fs');var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];function respondWithStatusCode(_0x1b54b0,_0x282031){_0x282031=_0x282031||0xcc;return function(_0x1d7575){if(_0x1d7575){return _0x1b54b0['sendStatus'](_0x282031);}return _0x1b54b0[_0x4f4f('0x1b')](_0x282031)['end']();};}function respondWithResult(_0x216ba8,_0xe7c2d5){_0xe7c2d5=_0xe7c2d5||0xc8;return function(_0x3e16e9){if(_0x3e16e9){return _0x216ba8[_0x4f4f('0x1b')](_0xe7c2d5)['json'](_0x3e16e9);}};}function respondWithFilteredResult(_0x19f2fd,_0x4c68f4){return function(_0x47ab66){if(_0x47ab66){var _0x58de77=_0x47ab66[_0x4f4f('0x1c')],_0x422894=_0x4c68f4[_0x4f4f('0x1d')],_0x8d65a2=_0x4c68f4[_0x4f4f('0x1d')]+_0x4c68f4[_0x4f4f('0x1e')],_0x2d21ed;if(_0x8d65a2>=_0x58de77){_0x8d65a2=_0x58de77;_0x2d21ed=0xc8;}else{_0x2d21ed=0xce;}_0x19f2fd[_0x4f4f('0x1b')](_0x2d21ed);return _0x19f2fd[_0x4f4f('0x1f')](_0x4f4f('0x20'),_0x422894+'-'+_0x8d65a2+'/'+_0x58de77)[_0x4f4f('0x21')](_0x47ab66);}return null;};}function patchUpdates(_0x43f43b){return function(_0x499277){try{jsonpatch[_0x4f4f('0x22')](_0x499277,_0x43f43b,!![]);}catch(_0x4622c2){return BPromise[_0x4f4f('0x23')](_0x4622c2);}return _0x499277[_0x4f4f('0x24')]();};}function saveUpdates(_0x302a79,_0x460b4d){return function(_0x2eedcc){if(_0x2eedcc){return _0x2eedcc[_0x4f4f('0x25')](_0x302a79)[_0x4f4f('0x26')](function(_0x2509a8){return _0x2509a8;});}return null;};}function removeEntity(_0x469a1d,_0x17832f){return function(_0x17984d){if(_0x17984d){return _0x17984d[_0x4f4f('0x27')]()['then'](function(){var _0x4f7261=_0x17984d['get']({'plain':!![]});var _0x272125=_0x4f4f('0x28');return db['UserProfileResource'][_0x4f4f('0x27')]({'where':{'type':_0x272125,'resourceId':_0x4f7261['id']}})[_0x4f4f('0x26')](function(){return _0x17984d;});})[_0x4f4f('0x26')](function(){_0x469a1d[_0x4f4f('0x1b')](0xcc)[_0x4f4f('0x29')]();});}};}function handleEntityNotFound(_0x31b30e,_0xa6371b){return function(_0x50a8ce){if(!_0x50a8ce){_0x31b30e[_0x4f4f('0x2a')](0x194);}return _0x50a8ce;};}function handleError(_0x237cf9,_0x18e718){_0x18e718=_0x18e718||0x1f4;return function(_0x15c79c){logger[_0x4f4f('0x2b')](_0x15c79c['stack']);if(_0x15c79c[_0x4f4f('0x2c')]){delete _0x15c79c[_0x4f4f('0x2c')];}_0x237cf9[_0x4f4f('0x1b')](_0x18e718)['send'](_0x15c79c);};}exports['index']=function(_0x4c2490,_0x73b8bb){var _0x5b4f6a={},_0x354266={},_0x39c1a8={'count':0x0,'rows':[]};var _0x2e688a=_['map'](db[_0x4f4f('0x2d')][_0x4f4f('0x2e')],function(_0x5dd5a3){return{'name':_0x5dd5a3[_0x4f4f('0x2f')],'type':_0x5dd5a3[_0x4f4f('0x30')][_0x4f4f('0x31')]};});_0x354266['model']=_[_0x4f4f('0x32')](_0x2e688a,_0x4f4f('0x2c'));_0x354266['query']=_['keys'](_0x4c2490[_0x4f4f('0x33')]);_0x354266[_0x4f4f('0x34')]=_[_0x4f4f('0x35')](_0x354266[_0x4f4f('0x36')],_0x354266[_0x4f4f('0x33')]);_0x5b4f6a[_0x4f4f('0x37')]=_[_0x4f4f('0x35')](_0x354266[_0x4f4f('0x36')],qs[_0x4f4f('0x38')](_0x4c2490[_0x4f4f('0x33')]['fields']));_0x5b4f6a['attributes']=_0x5b4f6a[_0x4f4f('0x37')]['length']?_0x5b4f6a[_0x4f4f('0x37')]:_0x354266[_0x4f4f('0x36')];if(!_0x4c2490[_0x4f4f('0x33')][_0x4f4f('0x39')](_0x4f4f('0x3a'))){_0x5b4f6a[_0x4f4f('0x1e')]=qs[_0x4f4f('0x1e')](_0x4c2490[_0x4f4f('0x33')][_0x4f4f('0x1e')]);_0x5b4f6a[_0x4f4f('0x1d')]=qs[_0x4f4f('0x1d')](_0x4c2490[_0x4f4f('0x33')]['offset']);}_0x5b4f6a[_0x4f4f('0x3b')]=qs[_0x4f4f('0x3c')](_0x4c2490[_0x4f4f('0x33')][_0x4f4f('0x3c')]);_0x5b4f6a[_0x4f4f('0x3d')]=qs[_0x4f4f('0x34')](_[_0x4f4f('0x3e')](_0x4c2490[_0x4f4f('0x33')],_0x354266[_0x4f4f('0x34')]),_0x2e688a);if(_0x4c2490['query'][_0x4f4f('0x3f')]){_0x5b4f6a[_0x4f4f('0x3d')]=_[_0x4f4f('0x40')](_0x5b4f6a['where'],{'$or':_['map'](_0x2e688a,function(_0xc2bc33){if(_0xc2bc33[_0x4f4f('0x30')]!==_0x4f4f('0x41')){var _0x1fd3d9={};_0x1fd3d9[_0xc2bc33[_0x4f4f('0x2c')]]={'$like':'%'+_0x4c2490[_0x4f4f('0x33')][_0x4f4f('0x3f')]+'%'};return _0x1fd3d9;}})});}_0x5b4f6a=_[_0x4f4f('0x40')]({},_0x5b4f6a,_0x4c2490[_0x4f4f('0x42')]);var _0x455aa0={'where':_0x5b4f6a[_0x4f4f('0x3d')]};return db[_0x4f4f('0x2d')]['count'](_0x455aa0)[_0x4f4f('0x26')](function(_0x1b031e){_0x39c1a8[_0x4f4f('0x1c')]=_0x1b031e;if(_0x4c2490[_0x4f4f('0x33')][_0x4f4f('0x43')]){_0x5b4f6a['include']=[{'all':!![]}];}return db['VoiceMail'][_0x4f4f('0x44')](_0x5b4f6a);})[_0x4f4f('0x26')](function(_0x2064e9){_0x39c1a8[_0x4f4f('0x45')]=_0x2064e9;return _0x39c1a8;})['then'](respondWithFilteredResult(_0x73b8bb,_0x5b4f6a))[_0x4f4f('0x46')](handleError(_0x73b8bb,null));};exports['show']=function(_0x10de24,_0x5a7c94){var _0x56c539={'raw':!![],'where':{'id':_0x10de24['params']['id']}},_0x399023={};_0x399023[_0x4f4f('0x36')]=_[_0x4f4f('0x47')](db['VoiceMail'][_0x4f4f('0x2e')]);_0x399023[_0x4f4f('0x33')]=_['keys'](_0x10de24[_0x4f4f('0x33')]);_0x399023[_0x4f4f('0x34')]=_[_0x4f4f('0x35')](_0x399023[_0x4f4f('0x36')],_0x399023[_0x4f4f('0x33')]);_0x56c539[_0x4f4f('0x37')]=_[_0x4f4f('0x35')](_0x399023[_0x4f4f('0x36')],qs[_0x4f4f('0x38')](_0x10de24[_0x4f4f('0x33')][_0x4f4f('0x38')]));_0x56c539[_0x4f4f('0x37')]=_0x56c539[_0x4f4f('0x37')][_0x4f4f('0x48')]?_0x56c539[_0x4f4f('0x37')]:_0x399023['model'];if(_0x10de24[_0x4f4f('0x33')]['includeAll']){_0x56c539['include']=[{'all':!![]}];}_0x56c539=_[_0x4f4f('0x40')]({},_0x56c539,_0x10de24[_0x4f4f('0x42')]);return db['VoiceMail'][_0x4f4f('0x49')](_0x56c539)[_0x4f4f('0x26')](handleEntityNotFound(_0x5a7c94,null))[_0x4f4f('0x26')](respondWithResult(_0x5a7c94,null))[_0x4f4f('0x46')](handleError(_0x5a7c94,null));};exports[_0x4f4f('0x4a')]=function(_0x545dd6,_0xd4625a){return db[_0x4f4f('0x2d')][_0x4f4f('0x4a')](_0x545dd6[_0x4f4f('0x4b')],{})[_0x4f4f('0x26')](function(_0x433787){var _0x29314b=_0x545dd6[_0x4f4f('0x4c')][_0x4f4f('0x4d')]({'plain':!![]});if(!_0x29314b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29314b[_0x4f4f('0x4e')]===_0x4f4f('0x4c')){var _0x4b33a5=_0x433787['get']({'plain':!![]});var _0x5941ac=_0x4f4f('0x28');return db[_0x4f4f('0x4f')][_0x4f4f('0x49')]({'where':{'name':_0x5941ac,'userProfileId':_0x29314b['userProfileId']},'raw':!![]})[_0x4f4f('0x26')](function(_0x5db92e){if(_0x5db92e&&_0x5db92e[_0x4f4f('0x50')]===0x0){return db[_0x4f4f('0x51')][_0x4f4f('0x4a')]({'name':_0x4b33a5[_0x4f4f('0x2c')],'resourceId':_0x4b33a5['id'],'type':_0x5db92e[_0x4f4f('0x2c')],'sectionId':_0x5db92e['id']},{})[_0x4f4f('0x26')](function(){return _0x433787;});}else{return _0x433787;}})[_0x4f4f('0x46')](function(_0x88054a){logger[_0x4f4f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x88054a);throw _0x88054a;});}return _0x433787;})['then'](respondWithResult(_0xd4625a,0xc9))[_0x4f4f('0x46')](handleError(_0xd4625a,null));};exports[_0x4f4f('0x25')]=function(_0x4c04eb,_0x557ba3){if(_0x4c04eb[_0x4f4f('0x4b')]['id']){delete _0x4c04eb[_0x4f4f('0x4b')]['id'];}return db[_0x4f4f('0x2d')]['find']({'where':{'id':_0x4c04eb['params']['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0x557ba3,null))[_0x4f4f('0x26')](saveUpdates(_0x4c04eb[_0x4f4f('0x4b')],null))[_0x4f4f('0x26')](respondWithResult(_0x557ba3,null))[_0x4f4f('0x46')](handleError(_0x557ba3,null));};exports[_0x4f4f('0x27')]=function(_0xe66fc,_0x26a879){return db[_0x4f4f('0x2d')][_0x4f4f('0x49')]({'where':{'id':_0xe66fc[_0x4f4f('0x52')]['id']}})['then'](handleEntityNotFound(_0x26a879,null))['then'](removeEntity(_0x26a879,null))[_0x4f4f('0x46')](handleError(_0x26a879,null));};exports[_0x4f4f('0x53')]=function(_0x161943,_0x58f349,_0x4b4e7e){return db[_0x4f4f('0x2d')]['findOne']({'where':{'id':_0x161943[_0x4f4f('0x52')]['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0x58f349,null))[_0x4f4f('0x26')](function(_0x4901f5){var _0x550342;var _0xf18746={},_0x23e9a9={};_0x23e9a9['model']=_[_0x4f4f('0x47')](db[_0x4f4f('0x54')][_0x4f4f('0x2e')]);_0x23e9a9['query']=_[_0x4f4f('0x47')](_0x161943[_0x4f4f('0x33')]);_0x23e9a9[_0x4f4f('0x34')]=_['intersection'](_0x23e9a9[_0x4f4f('0x36')],_0x23e9a9['query']);_0xf18746[_0x4f4f('0x37')]=_[_0x4f4f('0x35')](_0x23e9a9[_0x4f4f('0x36')],qs[_0x4f4f('0x38')](_0x161943[_0x4f4f('0x33')][_0x4f4f('0x38')]));_0xf18746[_0x4f4f('0x37')]=_0xf18746[_0x4f4f('0x37')][_0x4f4f('0x48')]?_0xf18746[_0x4f4f('0x37')]:_0x23e9a9[_0x4f4f('0x36')];if(!_0x161943['query'][_0x4f4f('0x39')](_0x4f4f('0x3a'))){_0xf18746[_0x4f4f('0x1e')]=qs['limit'](_0x161943[_0x4f4f('0x33')][_0x4f4f('0x1e')]);_0xf18746[_0x4f4f('0x1d')]=qs[_0x4f4f('0x1d')](_0x161943['query'][_0x4f4f('0x1d')]);}_0xf18746[_0x4f4f('0x3b')]=qs[_0x4f4f('0x3c')](_0x161943[_0x4f4f('0x33')][_0x4f4f('0x3c')]);_0xf18746['where']=qs[_0x4f4f('0x34')](_['pick'](_0x161943[_0x4f4f('0x33')],_0x23e9a9[_0x4f4f('0x34')]));if(_0x161943[_0x4f4f('0x33')][_0x4f4f('0x3f')]){_0xf18746[_0x4f4f('0x3d')]=_[_0x4f4f('0x40')](_0xf18746['where'],{'$or':_['map'](_0xf18746[_0x4f4f('0x37')],function(_0x4c42fd){var _0x4252fa={};_0x4252fa[_0x4c42fd]={'$like':'%'+_0x161943[_0x4f4f('0x33')][_0x4f4f('0x3f')]+'%'};return _0x4252fa;})});}_0xf18746[_0x4f4f('0x3d')]=_[_0x4f4f('0x40')](_0xf18746[_0x4f4f('0x3d')],{'mailboxuser':_0x4901f5[_0x4f4f('0x55')]});_0xf18746=_[_0x4f4f('0x40')]({},_0xf18746,_0x161943[_0x4f4f('0x42')]);return db[_0x4f4f('0x54')][_0x4f4f('0x56')](_0xf18746)['then'](respondWithFilteredResult(_0x58f349,_0xf18746));})['catch'](handleError(_0x58f349,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 7ca1ba3..1a93812 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 _0xd763=['./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3f2195,_0x1aabbb){var _0x4f2be6=function(_0x3d5e99){while(--_0x3d5e99){_0x3f2195['push'](_0x3f2195['shift']());}};_0x4f2be6(++_0x1aabbb);}(_0xd763,0xda));var _0x3d76=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xd763[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x3d76('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3d76('0x1'));var moment=require(_0x3d76('0x2'));var BPromise=require(_0x3d76('0x3'));var rp=require(_0x3d76('0x4'));var fs=require('fs');var path=require(_0x3d76('0x5'));var rimraf=require(_0x3d76('0x6'));var config=require('../../config/environment');var attributes=require(_0x3d76('0x7'));module[_0x3d76('0x8')]=function(_0x1b713a,_0x5ac033){return _0x1b713a[_0x3d76('0x9')](_0x3d76('0xa'),attributes,{'tableName':_0x3d76('0xb'),'paranoid':![],'indexes':[{'name':_0x3d76('0xc'),'fields':[_0x3d76('0xd'),_0x3d76('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x080e=['mailbox_context','mailbox','context','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail'];(function(_0x331b08,_0x2c5937){var _0x5034d9=function(_0x2c916a){while(--_0x2c916a){_0x331b08['push'](_0x331b08['shift']());}};_0x5034d9(++_0x2c5937);}(_0x080e,0x123));var _0xe080=function(_0x2de482,_0x54cc18){_0x2de482=_0x2de482-0x0;var _0xddcce6=_0x080e[_0x2de482];return _0xddcce6;};'use strict';var _=require(_0xe080('0x0'));var util=require(_0xe080('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe080('0x2'));var BPromise=require(_0xe080('0x3'));var rp=require(_0xe080('0x4'));var fs=require('fs');var path=require(_0xe080('0x5'));var rimraf=require(_0xe080('0x6'));var config=require(_0xe080('0x7'));var attributes=require(_0xe080('0x8'));module[_0xe080('0x9')]=function(_0x56180,_0x5e80f1){return _0x56180[_0xe080('0xa')](_0xe080('0xb'),attributes,{'tableName':_0xe080('0xc'),'paranoid':![],'indexes':[{'name':_0xe080('0xd'),'fields':[_0xe080('0xe'),_0xe080('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index ff023e0..0ce9f97 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 _0x4d8a=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','catch','lodash','bluebird'];(function(_0x470711,_0x415ae0){var _0x33b3aa=function(_0x4fb7c0){while(--_0x4fb7c0){_0x470711['push'](_0x470711['shift']());}};_0x33b3aa(++_0x415ae0);}(_0x4d8a,0x1a0));var _0xa4d8=function(_0x2db8d7,_0x5bea96){_0x2db8d7=_0x2db8d7-0x0;var _0x2826bd=_0x4d8a[_0x2db8d7];return _0x2826bd;};'use strict';var _=require(_0xa4d8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa4d8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4d8('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4d8('0x3'))(_0xa4d8('0x4'));var config=require(_0xa4d8('0x5'));var jayson=require(_0xa4d8('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb3f7ac,_0x5f44a1,_0x5b023d){return new BPromise(function(_0x1d8037,_0xe2b57){return client[_0xa4d8('0x7')](_0xb3f7ac,_0x5b023d)[_0xa4d8('0x8')](function(_0x5349c5){logger[_0xa4d8('0x9')]('VoiceMail,\x20%s,\x20%s',_0x5f44a1,_0xa4d8('0xa'));logger[_0xa4d8('0xb')](_0xa4d8('0xc'),_0x5f44a1,_0xa4d8('0xa'),JSON[_0xa4d8('0xd')](_0x5349c5));if(_0x5349c5['error']){if(_0x5349c5[_0xa4d8('0xe')][_0xa4d8('0xf')]===0x1f4){logger['error'](_0xa4d8('0x10'),_0x5f44a1,_0x5349c5[_0xa4d8('0xe')][_0xa4d8('0x11')]);return _0xe2b57(_0x5349c5[_0xa4d8('0xe')][_0xa4d8('0x11')]);}logger[_0xa4d8('0xe')](_0xa4d8('0x10'),_0x5f44a1,_0x5349c5['error'][_0xa4d8('0x11')]);return _0x1d8037(_0x5349c5[_0xa4d8('0xe')]['message']);}else{logger[_0xa4d8('0x9')]('VoiceMail,\x20%s,\x20%s',_0x5f44a1,'request\x20sent');_0x1d8037(_0x5349c5['result']['message']);}})[_0xa4d8('0x12')](function(_0x2cf67d){logger['error'](_0xa4d8('0x10'),_0x5f44a1,_0x2cf67d);_0xe2b57(_0x2cf67d);});});} \ No newline at end of file +var _0xdb34=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash'];(function(_0x40979e,_0x202a54){var _0x4bb0b9=function(_0x19551b){while(--_0x19551b){_0x40979e['push'](_0x40979e['shift']());}};_0x4bb0b9(++_0x202a54);}(_0xdb34,0x68));var _0x4db3=function(_0x48d0b7,_0x3aa1dd){_0x48d0b7=_0x48d0b7-0x0;var _0x455670=_0xdb34[_0x48d0b7];return _0x455670;};'use strict';var _=require(_0x4db3('0x0'));var util=require(_0x4db3('0x1'));var moment=require(_0x4db3('0x2'));var BPromise=require(_0x4db3('0x3'));var rs=require(_0x4db3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4db3('0x5'))['db'];var utils=require(_0x4db3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4db3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4db3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfc4a5d,_0x337128,_0x17f4c5){return new BPromise(function(_0x38af95,_0x200847){return client[_0x4db3('0x9')](_0xfc4a5d,_0x17f4c5)[_0x4db3('0xa')](function(_0x5ed5ab){logger[_0x4db3('0xb')]('VoiceMail,\x20%s,\x20%s',_0x337128,_0x4db3('0xc'));logger[_0x4db3('0xd')](_0x4db3('0xe'),_0x337128,_0x4db3('0xc'),JSON['stringify'](_0x5ed5ab));if(_0x5ed5ab['error']){if(_0x5ed5ab[_0x4db3('0xf')][_0x4db3('0x10')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x337128,_0x5ed5ab[_0x4db3('0xf')][_0x4db3('0x11')]);return _0x200847(_0x5ed5ab[_0x4db3('0xf')][_0x4db3('0x11')]);}logger[_0x4db3('0xf')](_0x4db3('0x12'),_0x337128,_0x5ed5ab[_0x4db3('0xf')][_0x4db3('0x11')]);return _0x38af95(_0x5ed5ab['error'][_0x4db3('0x11')]);}else{logger['info'](_0x4db3('0x12'),_0x337128,'request\x20sent');_0x38af95(_0x5ed5ab[_0x4db3('0x13')]['message']);}})[_0x4db3('0x14')](function(_0xa909ee){logger[_0x4db3('0xf')](_0x4db3('0x12'),_0x337128,_0xa909ee);_0x200847(_0xa909ee);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d89d77f..703c3e6 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 _0x46ed=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','create','update','delete','exports'];(function(_0x4a5c62,_0x3489a7){var _0x3451f6=function(_0x55dd8a){while(--_0x55dd8a){_0x4a5c62['push'](_0x4a5c62['shift']());}};_0x3451f6(++_0x3489a7);}(_0x46ed,0x168));var _0xd46e=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x46ed[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd46e('0x5'));var config=require(_0xd46e('0x6'));var controller=require('./voiceMailMessage.controller');router[_0xd46e('0x7')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0x9')]);router[_0xd46e('0x7')](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xb')]);router[_0xd46e('0x7')](_0xd46e('0xc'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xd')]);router['post']('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0xe')]);router['put'](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xf')]);router[_0xd46e('0x10')](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller['destroy']);module[_0xd46e('0x11')]=router; \ No newline at end of file +var _0xabce=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','index','/:id','show','get','/:id/download','download','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x464636,_0x26b034){var _0x1f20de=function(_0x1807b4){while(--_0x1807b4){_0x464636['push'](_0x464636['shift']());}};_0x1f20de(++_0x26b034);}(_0xabce,0x103));var _0xeabc=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xabce[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeabc('0x5'));var config=require(_0xeabc('0x6'));var controller=require(_0xeabc('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xeabc('0x8')]);router['get'](_0xeabc('0x9'),auth['isAuthenticated'](),controller[_0xeabc('0xa')]);router[_0xeabc('0xb')](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')]('/',auth[_0xeabc('0xf')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0x9'),auth[_0xeabc('0xf')](),controller[_0xeabc('0x12')]);router[_0xeabc('0x13')](_0xeabc('0x9'),auth[_0xeabc('0xf')](),controller[_0xeabc('0x14')]);module[_0xeabc('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 2b996be..1592a14 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 _0xd843=['getDataValue','INTEGER','STRING','long','exports','VIRTUAL'];(function(_0x534deb,_0x1c59ac){var _0x25a9c6=function(_0x2f6848){while(--_0x2f6848){_0x534deb['push'](_0x534deb['shift']());}};_0x25a9c6(++_0x1c59ac);}(_0xd843,0x9a));var _0x3d84=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0xd843[_0x5c6022];return _0x4ab5af;};'use strict';var Sequelize=require('sequelize');module[_0x3d84('0x0')]={'name':{'type':Sequelize[_0x3d84('0x1')],'get':function(_0x2cef8a){return this[_0x3d84('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x3d84('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3d84('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x3d84('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x3d84('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x3d84('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3d84('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x3d84('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x3d84('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0xe7c5=['getDataValue','STRING','BLOB','long','sequelize','exports','VIRTUAL'];(function(_0x519c82,_0x1d19b2){var _0x2da612=function(_0x47bc80){while(--_0x47bc80){_0x519c82['push'](_0x519c82['shift']());}};_0x2da612(++_0x1d19b2);}(_0xe7c5,0x1af));var _0x5e7c=function(_0x518d5e,_0x17b17d){_0x518d5e=_0x518d5e-0x0;var _0x146f16=_0xe7c5[_0x518d5e];return _0x146f16;};'use strict';var Sequelize=require(_0x5e7c('0x0'));module[_0x5e7c('0x1')]={'name':{'type':Sequelize[_0x5e7c('0x2')],'get':function(_0x50858e){return this[_0x5e7c('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5e7c('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x5e7c('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5e7c('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5e7c('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5e7c('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x5e7c('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5e7c('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5e7c('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x5e7c('0x5')](_0x5e7c('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x5e7c('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'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 1a55c0a..059f0ee 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 _0xc78c=['where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','include','catch','create','body','find','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','sendStatus','error','stack','name','index','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order'];(function(_0x559d28,_0x29d086){var _0x15adf4=function(_0x1cc8f4){while(--_0x1cc8f4){_0x559d28['push'](_0x559d28['shift']());}};_0x15adf4(++_0x29d086);}(_0xc78c,0x165));var _0xcc78=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc78c[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcc78('0x0'));var rimraf=require(_0xcc78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc78('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc78('0x3'));var util=require(_0xcc78('0x4'));var path=require(_0xcc78('0x5'));var sox=require(_0xcc78('0x6'));var csv=require(_0xcc78('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcc78('0x8'));var squel=require(_0xcc78('0x9'));var crypto=require(_0xcc78('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcc78('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcc78('0xc'));var Papa=require('papaparse');var Redis=require(_0xcc78('0xd'));var authService=require(_0xcc78('0xe'));var qs=require(_0xcc78('0xf'));var as=require(_0xcc78('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc78('0x11'))(_0xcc78('0x12'));var utils=require(_0xcc78('0x13'));var config=require(_0xcc78('0x14'));var licenseUtil=require(_0xcc78('0x15'));var db=require(_0xcc78('0x16'))['db'];function respondWithStatusCode(_0x23870d,_0x3a8e2c){_0x3a8e2c=_0x3a8e2c||0xcc;return function(_0x5c7875){if(_0x5c7875){return _0x23870d['sendStatus'](_0x3a8e2c);}return _0x23870d[_0xcc78('0x17')](_0x3a8e2c)[_0xcc78('0x18')]();};}function respondWithResult(_0x196aaa,_0x488a0f){_0x488a0f=_0x488a0f||0xc8;return function(_0x498191){if(_0x498191){return _0x196aaa['status'](_0x488a0f)[_0xcc78('0x19')](_0x498191);}};}function respondWithFilteredResult(_0x61c4de,_0x310666){return function(_0x58cbaf){if(_0x58cbaf){var _0x3481ab=_0x58cbaf['count'],_0x34068b=_0x310666[_0xcc78('0x1a')],_0x48ec4c=_0x310666[_0xcc78('0x1a')]+_0x310666[_0xcc78('0x1b')],_0x102d60;if(_0x48ec4c>=_0x3481ab){_0x48ec4c=_0x3481ab;_0x102d60=0xc8;}else{_0x102d60=0xce;}_0x61c4de['status'](_0x102d60);return _0x61c4de[_0xcc78('0x1c')](_0xcc78('0x1d'),_0x34068b+'-'+_0x48ec4c+'/'+_0x3481ab)[_0xcc78('0x19')](_0x58cbaf);}return null;};}function patchUpdates(_0x347b4b){return function(_0x1316f8){try{jsonpatch[_0xcc78('0x1e')](_0x1316f8,_0x347b4b,!![]);}catch(_0x1d9b1f){return BPromise[_0xcc78('0x1f')](_0x1d9b1f);}return _0x1316f8[_0xcc78('0x20')]();};}function saveUpdates(_0x22e493,_0x1d86b5){return function(_0x237a22){if(_0x237a22){return _0x237a22[_0xcc78('0x21')](_0x22e493)[_0xcc78('0x22')](function(_0x4b29f2){return _0x4b29f2;});}return null;};}function removeEntity(_0x3cd444,_0x517613){return function(_0x1d2ff1){if(_0x1d2ff1){return _0x1d2ff1[_0xcc78('0x23')]()[_0xcc78('0x22')](function(){_0x3cd444[_0xcc78('0x17')](0xcc)[_0xcc78('0x18')]();});}};}function handleEntityNotFound(_0x352856,_0x300e2b){return function(_0x570b46){if(!_0x570b46){_0x352856[_0xcc78('0x24')](0x194);}return _0x570b46;};}function handleError(_0x47e883,_0x44bae9){_0x44bae9=_0x44bae9||0x1f4;return function(_0xbcb3a6){logger[_0xcc78('0x25')](_0xbcb3a6[_0xcc78('0x26')]);if(_0xbcb3a6[_0xcc78('0x27')]){delete _0xbcb3a6[_0xcc78('0x27')];}_0x47e883[_0xcc78('0x17')](_0x44bae9)['send'](_0xbcb3a6);};}exports[_0xcc78('0x28')]=function(_0x2126f3,_0x5b2502){var _0x31657d={},_0x3889c3={},_0x5c1fa6={'count':0x0,'rows':[]};var _0x121530=_['map'](db[_0xcc78('0x29')][_0xcc78('0x2a')],function(_0x52e54a){return{'name':_0x52e54a[_0xcc78('0x2b')],'type':_0x52e54a[_0xcc78('0x2c')][_0xcc78('0x2d')]};});_0x3889c3['model']=_[_0xcc78('0x2e')](_[_0xcc78('0x2f')](_0x121530,'name'),[_0xcc78('0x27')]);_0x3889c3[_0xcc78('0x30')]=_[_0xcc78('0x31')](_0x2126f3['query']);_0x3889c3[_0xcc78('0x32')]=_[_0xcc78('0x33')](_0x3889c3[_0xcc78('0x34')],_0x3889c3[_0xcc78('0x30')]);_0x31657d[_0xcc78('0x35')]=_['intersection'](_0x3889c3[_0xcc78('0x34')],qs['fields'](_0x2126f3[_0xcc78('0x30')][_0xcc78('0x36')]));_0x31657d[_0xcc78('0x35')]=_0x31657d[_0xcc78('0x35')][_0xcc78('0x37')]?_0x31657d[_0xcc78('0x35')]:_0x3889c3[_0xcc78('0x34')];if(!_0x2126f3[_0xcc78('0x30')][_0xcc78('0x38')]('nolimit')){_0x31657d['limit']=qs[_0xcc78('0x1b')](_0x2126f3[_0xcc78('0x30')]['limit']);_0x31657d[_0xcc78('0x1a')]=qs[_0xcc78('0x1a')](_0x2126f3[_0xcc78('0x30')][_0xcc78('0x1a')]);}_0x31657d[_0xcc78('0x39')]=qs['sort'](_0x2126f3[_0xcc78('0x30')]['sort']);_0x31657d[_0xcc78('0x3a')]=qs[_0xcc78('0x32')](_[_0xcc78('0x3b')](_0x2126f3[_0xcc78('0x30')],_0x3889c3[_0xcc78('0x32')]),_0x121530);if(_0x2126f3[_0xcc78('0x30')][_0xcc78('0x3c')]){_0x31657d[_0xcc78('0x3a')]=_[_0xcc78('0x3d')](_0x31657d['where'],{'$or':_[_0xcc78('0x2f')](_0x121530,function(_0x33d433){if(_0x33d433[_0xcc78('0x2c')]!==_0xcc78('0x3e')){var _0x256793={};_0x256793[_0x33d433[_0xcc78('0x27')]]={'$like':'%'+_0x2126f3[_0xcc78('0x30')][_0xcc78('0x3c')]+'%'};return _0x256793;}})});}_0x31657d=_['merge']({},_0x31657d,_0x2126f3[_0xcc78('0x3f')]);var _0x18744f={'where':_0x31657d[_0xcc78('0x3a')]};return db[_0xcc78('0x29')][_0xcc78('0x40')](_0x18744f)[_0xcc78('0x22')](function(_0x1e49ad){_0x5c1fa6['count']=_0x1e49ad;if(_0x2126f3[_0xcc78('0x30')][_0xcc78('0x41')]){_0x31657d['include']=[{'all':!![]}];}return db[_0xcc78('0x29')][_0xcc78('0x42')](_0x31657d);})[_0xcc78('0x22')](function(_0x4abd5b){_0x5c1fa6[_0xcc78('0x43')]=_0x4abd5b;return _0x5c1fa6;})[_0xcc78('0x22')](respondWithFilteredResult(_0x5b2502,_0x31657d))['catch'](handleError(_0x5b2502,null));};exports[_0xcc78('0x44')]=function(_0x2229cb,_0x514df1){var _0x266711={'raw':!![],'where':{'id':_0x2229cb[_0xcc78('0x45')]['id']}},_0x270b72={};_0x270b72[_0xcc78('0x34')]=_['keys'](db[_0xcc78('0x29')]['rawAttributes']);_0x270b72[_0xcc78('0x30')]=_[_0xcc78('0x31')](_0x2229cb[_0xcc78('0x30')]);_0x270b72[_0xcc78('0x32')]=_[_0xcc78('0x33')](_0x270b72[_0xcc78('0x34')],_0x270b72[_0xcc78('0x30')]);_0x266711['attributes']=_[_0xcc78('0x33')](_0x270b72[_0xcc78('0x34')],qs[_0xcc78('0x36')](_0x2229cb['query'][_0xcc78('0x36')]));_0x266711[_0xcc78('0x35')]=_0x266711[_0xcc78('0x35')][_0xcc78('0x37')]?_0x266711['attributes']:_0x270b72[_0xcc78('0x34')];if(_0x2229cb[_0xcc78('0x30')][_0xcc78('0x41')]){_0x266711[_0xcc78('0x46')]=[{'all':!![]}];}_0x266711=_[_0xcc78('0x3d')]({},_0x266711,_0x2229cb[_0xcc78('0x3f')]);return db[_0xcc78('0x29')]['find'](_0x266711)[_0xcc78('0x22')](handleEntityNotFound(_0x514df1,null))[_0xcc78('0x22')](respondWithResult(_0x514df1,null))[_0xcc78('0x47')](handleError(_0x514df1,null));};exports[_0xcc78('0x48')]=function(_0x41f545,_0xbc3927){return db[_0xcc78('0x29')][_0xcc78('0x48')](_0x41f545[_0xcc78('0x49')],{})[_0xcc78('0x22')](respondWithResult(_0xbc3927,0xc9))['catch'](handleError(_0xbc3927,null));};exports[_0xcc78('0x21')]=function(_0x20bc6e,_0x3adc85){if(_0x20bc6e[_0xcc78('0x49')]['id']){delete _0x20bc6e[_0xcc78('0x49')]['id'];}return db[_0xcc78('0x29')]['find']({'where':{'id':_0x20bc6e[_0xcc78('0x45')]['id']}})[_0xcc78('0x22')](handleEntityNotFound(_0x3adc85,null))[_0xcc78('0x22')](saveUpdates(_0x20bc6e['body'],null))[_0xcc78('0x22')](respondWithResult(_0x3adc85,null))[_0xcc78('0x47')](handleError(_0x3adc85,null));};exports[_0xcc78('0x23')]=function(_0x2402d0,_0x4fd3d7){return db[_0xcc78('0x29')][_0xcc78('0x4a')]({'where':{'id':_0x2402d0['params']['id']}})[_0xcc78('0x22')](handleEntityNotFound(_0x4fd3d7,null))[_0xcc78('0x22')](removeEntity(_0x4fd3d7,null))['catch'](handleError(_0x4fd3d7,null));};exports[_0xcc78('0x4b')]=function(_0x61327d,_0x17e22c,_0x20b970){return db[_0xcc78('0x29')][_0xcc78('0x4a')]({'where':{'id':_0x61327d[_0xcc78('0x45')]['id']},'attributes':['id',_0xcc78('0x4c'),_0xcc78('0x4d')]})[_0xcc78('0x22')](handleEntityNotFound(_0x17e22c,null))[_0xcc78('0x22')](function(_0x4efcb7){if(_0x4efcb7){if(!_0x4efcb7['recording']){throw new db[(_0xcc78('0x4e'))]['ValidationError'](_0xcc78('0x4f'));}var _0x3da260={'Content-Type':'audio/wav','Content-Disposition':_0xcc78('0x50')};if(_0x4efcb7[_0xcc78('0x4d')]){_0x3da260[_0xcc78('0x51')]=_0xcc78('0x52')+_0x4efcb7[_0xcc78('0x4d')]+'.wav\x22';}_0x17e22c[_0xcc78('0x1c')](_0x3da260);return _0x17e22c['send'](new Buffer(_0x4efcb7[_0xcc78('0x4c')]));}})['catch'](handleError(_0x17e22c,null));}; \ No newline at end of file +var _0x2be8=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','set','apply','save','then','destroy','end','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash'];(function(_0x25f6ef,_0x14e7d3){var _0x432675=function(_0x9fce51){while(--_0x9fce51){_0x25f6ef['push'](_0x25f6ef['shift']());}};_0x432675(++_0x14e7d3);}(_0x2be8,0x1a8));var _0x82be=function(_0x95e21d,_0x36861e){_0x95e21d=_0x95e21d-0x0;var _0x3fd266=_0x2be8[_0x95e21d];return _0x3fd266;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x82be('0x0'));var rimraf=require(_0x82be('0x1'));var zipdir=require(_0x82be('0x2'));var jsonpatch=require(_0x82be('0x3'));var rp=require(_0x82be('0x4'));var moment=require('moment');var BPromise=require(_0x82be('0x5'));var Mustache=require(_0x82be('0x6'));var util=require('util');var path=require(_0x82be('0x7'));var sox=require(_0x82be('0x8'));var csv=require('to-csv');var ejs=require(_0x82be('0x9'));var fs=require('fs');var _=require(_0x82be('0xa'));var squel=require(_0x82be('0xb'));var crypto=require(_0x82be('0xc'));var jsforce=require(_0x82be('0xd'));var deskjs=require(_0x82be('0xe'));var toCsv=require(_0x82be('0xf'));var querystring=require(_0x82be('0x10'));var Papa=require(_0x82be('0x11'));var Redis=require(_0x82be('0x12'));var authService=require(_0x82be('0x13'));var qs=require(_0x82be('0x14'));var as=require(_0x82be('0x15'));var hardwareService=require(_0x82be('0x16'));var logger=require(_0x82be('0x17'))(_0x82be('0x18'));var utils=require('../../config/utils');var config=require(_0x82be('0x19'));var licenseUtil=require(_0x82be('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45bcec,_0x48f77e){_0x48f77e=_0x48f77e||0xcc;return function(_0x5e637a){if(_0x5e637a){return _0x45bcec[_0x82be('0x1b')](_0x48f77e);}return _0x45bcec[_0x82be('0x1c')](_0x48f77e)['end']();};}function respondWithResult(_0x3b4d37,_0xe9334f){_0xe9334f=_0xe9334f||0xc8;return function(_0xd25358){if(_0xd25358){return _0x3b4d37[_0x82be('0x1c')](_0xe9334f)[_0x82be('0x1d')](_0xd25358);}};}function respondWithFilteredResult(_0x2e5d5d,_0x1d63b7){return function(_0x1ff830){if(_0x1ff830){var _0x58455c=_0x1ff830[_0x82be('0x1e')],_0x23dc49=_0x1d63b7[_0x82be('0x1f')],_0x41cd69=_0x1d63b7[_0x82be('0x1f')]+_0x1d63b7['limit'],_0x5376f8;if(_0x41cd69>=_0x58455c){_0x41cd69=_0x58455c;_0x5376f8=0xc8;}else{_0x5376f8=0xce;}_0x2e5d5d[_0x82be('0x1c')](_0x5376f8);return _0x2e5d5d[_0x82be('0x20')]('Content-Range',_0x23dc49+'-'+_0x41cd69+'/'+_0x58455c)[_0x82be('0x1d')](_0x1ff830);}return null;};}function patchUpdates(_0x42b1d2){return function(_0xe619da){try{jsonpatch[_0x82be('0x21')](_0xe619da,_0x42b1d2,!![]);}catch(_0x4240ad){return BPromise['reject'](_0x4240ad);}return _0xe619da[_0x82be('0x22')]();};}function saveUpdates(_0x2fdf55,_0x20c6d9){return function(_0x505b2f){if(_0x505b2f){return _0x505b2f['update'](_0x2fdf55)[_0x82be('0x23')](function(_0x2b7d53){return _0x2b7d53;});}return null;};}function removeEntity(_0x120784,_0x3d45aa){return function(_0x574e0f){if(_0x574e0f){return _0x574e0f[_0x82be('0x24')]()[_0x82be('0x23')](function(){_0x120784[_0x82be('0x1c')](0xcc)[_0x82be('0x25')]();});}};}function handleEntityNotFound(_0x2210b9,_0x570192){return function(_0x44d735){if(!_0x44d735){_0x2210b9['sendStatus'](0x194);}return _0x44d735;};}function handleError(_0x207365,_0x4e6c4b){_0x4e6c4b=_0x4e6c4b||0x1f4;return function(_0x1b57fa){logger[_0x82be('0x26')](_0x1b57fa[_0x82be('0x27')]);if(_0x1b57fa['name']){delete _0x1b57fa[_0x82be('0x28')];}_0x207365[_0x82be('0x1c')](_0x4e6c4b)[_0x82be('0x29')](_0x1b57fa);};}exports[_0x82be('0x2a')]=function(_0x350dda,_0x55fed6){var _0x8e0198={},_0x1717dd={},_0x291de9={'count':0x0,'rows':[]};var _0x4e9fd7=_[_0x82be('0x2b')](db[_0x82be('0x2c')][_0x82be('0x2d')],function(_0xe11025){return{'name':_0xe11025['fieldName'],'type':_0xe11025[_0x82be('0x2e')][_0x82be('0x2f')]};});_0x1717dd[_0x82be('0x30')]=_[_0x82be('0x31')](_[_0x82be('0x2b')](_0x4e9fd7,'name'),[_0x82be('0x28')]);_0x1717dd['query']=_[_0x82be('0x32')](_0x350dda[_0x82be('0x33')]);_0x1717dd[_0x82be('0x34')]=_[_0x82be('0x35')](_0x1717dd[_0x82be('0x30')],_0x1717dd['query']);_0x8e0198['attributes']=_[_0x82be('0x35')](_0x1717dd['model'],qs[_0x82be('0x36')](_0x350dda[_0x82be('0x33')][_0x82be('0x36')]));_0x8e0198[_0x82be('0x37')]=_0x8e0198[_0x82be('0x37')][_0x82be('0x38')]?_0x8e0198[_0x82be('0x37')]:_0x1717dd[_0x82be('0x30')];if(!_0x350dda[_0x82be('0x33')][_0x82be('0x39')](_0x82be('0x3a'))){_0x8e0198['limit']=qs[_0x82be('0x3b')](_0x350dda[_0x82be('0x33')][_0x82be('0x3b')]);_0x8e0198['offset']=qs[_0x82be('0x1f')](_0x350dda[_0x82be('0x33')][_0x82be('0x1f')]);}_0x8e0198[_0x82be('0x3c')]=qs[_0x82be('0x3d')](_0x350dda[_0x82be('0x33')]['sort']);_0x8e0198[_0x82be('0x3e')]=qs[_0x82be('0x34')](_[_0x82be('0x3f')](_0x350dda[_0x82be('0x33')],_0x1717dd['filters']),_0x4e9fd7);if(_0x350dda['query'][_0x82be('0x40')]){_0x8e0198[_0x82be('0x3e')]=_[_0x82be('0x41')](_0x8e0198[_0x82be('0x3e')],{'$or':_['map'](_0x4e9fd7,function(_0x4ff059){if(_0x4ff059[_0x82be('0x2e')]!==_0x82be('0x42')){var _0x2dcb57={};_0x2dcb57[_0x4ff059[_0x82be('0x28')]]={'$like':'%'+_0x350dda[_0x82be('0x33')][_0x82be('0x40')]+'%'};return _0x2dcb57;}})});}_0x8e0198=_[_0x82be('0x41')]({},_0x8e0198,_0x350dda['options']);var _0x1d60c3={'where':_0x8e0198['where']};return db['VoiceMailMessage'][_0x82be('0x1e')](_0x1d60c3)[_0x82be('0x23')](function(_0x2002e7){_0x291de9[_0x82be('0x1e')]=_0x2002e7;if(_0x350dda[_0x82be('0x33')][_0x82be('0x43')]){_0x8e0198['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0x82be('0x44')](_0x8e0198);})['then'](function(_0x10fb7d){_0x291de9[_0x82be('0x45')]=_0x10fb7d;return _0x291de9;})[_0x82be('0x23')](respondWithFilteredResult(_0x55fed6,_0x8e0198))[_0x82be('0x46')](handleError(_0x55fed6,null));};exports[_0x82be('0x47')]=function(_0x577e30,_0x307195){var _0x267064={'raw':!![],'where':{'id':_0x577e30[_0x82be('0x48')]['id']}},_0x47ee02={};_0x47ee02[_0x82be('0x30')]=_['keys'](db['VoiceMailMessage'][_0x82be('0x2d')]);_0x47ee02[_0x82be('0x33')]=_[_0x82be('0x32')](_0x577e30[_0x82be('0x33')]);_0x47ee02[_0x82be('0x34')]=_[_0x82be('0x35')](_0x47ee02[_0x82be('0x30')],_0x47ee02[_0x82be('0x33')]);_0x267064[_0x82be('0x37')]=_[_0x82be('0x35')](_0x47ee02[_0x82be('0x30')],qs['fields'](_0x577e30[_0x82be('0x33')][_0x82be('0x36')]));_0x267064[_0x82be('0x37')]=_0x267064['attributes'][_0x82be('0x38')]?_0x267064['attributes']:_0x47ee02['model'];if(_0x577e30['query'][_0x82be('0x43')]){_0x267064[_0x82be('0x49')]=[{'all':!![]}];}_0x267064=_[_0x82be('0x41')]({},_0x267064,_0x577e30[_0x82be('0x4a')]);return db[_0x82be('0x2c')][_0x82be('0x4b')](_0x267064)[_0x82be('0x23')](handleEntityNotFound(_0x307195,null))['then'](respondWithResult(_0x307195,null))[_0x82be('0x46')](handleError(_0x307195,null));};exports[_0x82be('0x4c')]=function(_0x407e3b,_0xf74055){return db['VoiceMailMessage'][_0x82be('0x4c')](_0x407e3b[_0x82be('0x4d')],{})['then'](respondWithResult(_0xf74055,0xc9))[_0x82be('0x46')](handleError(_0xf74055,null));};exports['update']=function(_0xdf467d,_0x21cd39){if(_0xdf467d[_0x82be('0x4d')]['id']){delete _0xdf467d[_0x82be('0x4d')]['id'];}return db['VoiceMailMessage'][_0x82be('0x4b')]({'where':{'id':_0xdf467d['params']['id']}})['then'](handleEntityNotFound(_0x21cd39,null))['then'](saveUpdates(_0xdf467d[_0x82be('0x4d')],null))['then'](respondWithResult(_0x21cd39,null))['catch'](handleError(_0x21cd39,null));};exports[_0x82be('0x24')]=function(_0x1297bc,_0x33c7ac){return db['VoiceMailMessage'][_0x82be('0x4b')]({'where':{'id':_0x1297bc[_0x82be('0x48')]['id']}})[_0x82be('0x23')](handleEntityNotFound(_0x33c7ac,null))[_0x82be('0x23')](removeEntity(_0x33c7ac,null))['catch'](handleError(_0x33c7ac,null));};exports[_0x82be('0x4e')]=function(_0x36a7f4,_0x105aec,_0x2d49d2){return db[_0x82be('0x2c')][_0x82be('0x4b')]({'where':{'id':_0x36a7f4['params']['id']},'attributes':['id',_0x82be('0x4f'),_0x82be('0x50')]})[_0x82be('0x23')](handleEntityNotFound(_0x105aec,null))['then'](function(_0xf312a8){if(_0xf312a8){if(!_0xf312a8[_0x82be('0x4f')]){throw new db[(_0x82be('0x51'))][(_0x82be('0x52'))](_0x82be('0x53'));}var _0x45a82c={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0xf312a8[_0x82be('0x50')]){_0x45a82c[_0x82be('0x54')]=_0x82be('0x55')+_0xf312a8[_0x82be('0x50')]+_0x82be('0x56');}_0x105aec[_0x82be('0x20')](_0x45a82c);return _0x105aec[_0x82be('0x29')](new Buffer(_0xf312a8[_0x82be('0x4f')]));}})[_0x82be('0x46')](handleError(_0x105aec,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index b58996b..90cd846 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 _0xf05f=['../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x490da3,_0x3063fb){var _0x591c2b=function(_0x271341){while(--_0x271341){_0x490da3['push'](_0x490da3['shift']());}};_0x591c2b(++_0x3063fb);}(_0xf05f,0xb0));var _0xff05=function(_0x288af5,_0x4e3144){_0x288af5=_0x288af5-0x0;var _0x4bb749=_0xf05f[_0x288af5];return _0x4bb749;};'use strict';var _=require('lodash');var util=require(_0xff05('0x0'));var logger=require(_0xff05('0x1'))(_0xff05('0x2'));var moment=require('moment');var BPromise=require(_0xff05('0x3'));var rp=require(_0xff05('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff05('0x5'));var config=require(_0xff05('0x6'));var attributes=require(_0xff05('0x7'));module[_0xff05('0x8')]=function(_0x488802,_0x2e05be){return _0x488802[_0xff05('0x9')](_0xff05('0xa'),attributes,{'tableName':_0xff05('0xb'),'paranoid':![],'indexes':[{'name':_0xff05('0xc'),'fields':[_0xff05('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x58e8=['request-promise','path','rimraf','../../config/environment','define','voice_voicemail_messages','dir','util','../../config/logger','moment','bluebird'];(function(_0x2dfe85,_0x147f2d){var _0x10b8c2=function(_0x4d7baf){while(--_0x4d7baf){_0x2dfe85['push'](_0x2dfe85['shift']());}};_0x10b8c2(++_0x147f2d);}(_0x58e8,0x17d));var _0x858e=function(_0x4ab352,_0x35e043){_0x4ab352=_0x4ab352-0x0;var _0x5babeb=_0x58e8[_0x4ab352];return _0x5babeb;};'use strict';var _=require('lodash');var util=require(_0x858e('0x0'));var logger=require(_0x858e('0x1'))('api');var moment=require(_0x858e('0x2'));var BPromise=require(_0x858e('0x3'));var rp=require(_0x858e('0x4'));var fs=require('fs');var path=require(_0x858e('0x5'));var rimraf=require(_0x858e('0x6'));var config=require(_0x858e('0x7'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x434a06,_0x782d8){return _0x434a06[_0x858e('0x8')]('VoiceMailMessage',attributes,{'tableName':_0x858e('0x9'),'paranoid':![],'indexes':[{'name':_0x858e('0xa'),'fields':[_0x858e('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d94cd1c..7bce106 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x5463c2,_0x22c4cc){var _0x5a7da7=function(_0x4c16b5){while(--_0x4c16b5){_0x5463c2['push'](_0x5463c2['shift']());}};_0x5a7da7(++_0x22c4cc);}(_0xda2d,0x102));var _0xdda2=function(_0x1a1207,_0x211e3d){_0x1a1207=_0x1a1207-0x0;var _0x4c991c=_0xda2d[_0x1a1207];return _0x4c991c;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x107209,_0x1cd59b){var _0x46eb1e=function(_0x1e76e5){while(--_0x1e76e5){_0x107209['push'](_0x107209['shift']());}};_0x46eb1e(++_0x1cd59b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'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});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index fe8762a..9b57592 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 _0x3c57=['../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','show','/:id/sounds','getSounds','post','create','addSound','put','/:id','update','delete','destroy','removeSound','multer','util','express','Router','../../components/auth/service'];(function(_0x28e45a,_0x1d6b3b){var _0xdf8725=function(_0x22fd7a){while(--_0x22fd7a){_0x28e45a['push'](_0x28e45a['shift']());}};_0xdf8725(++_0x1d6b3b);}(_0x3c57,0x187));var _0x73c5=function(_0x106e13,_0x43fde1){_0x106e13=_0x106e13-0x0;var _0x1bb148=_0x3c57[_0x106e13];return _0x1bb148;};'use strict';var multer=require(_0x73c5('0x0'));var util=require(_0x73c5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x73c5('0x2'));var router=express[_0x73c5('0x3')]();var auth=require(_0x73c5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x73c5('0x5'));var controller=require(_0x73c5('0x6'));router['get']('/',auth[_0x73c5('0x7')](),controller[_0x73c5('0x8')]);router[_0x73c5('0x9')]('/:id',auth[_0x73c5('0x7')](),controller[_0x73c5('0xa')]);router['get'](_0x73c5('0xb'),auth[_0x73c5('0x7')](),controller[_0x73c5('0xc')]);router[_0x73c5('0xd')]('/',auth[_0x73c5('0x7')](),controller[_0x73c5('0xe')]);router[_0x73c5('0xd')](_0x73c5('0xb'),auth['isAuthenticated'](),controller[_0x73c5('0xf')]);router[_0x73c5('0x10')](_0x73c5('0x11'),auth[_0x73c5('0x7')](),controller[_0x73c5('0x12')]);router[_0x73c5('0x13')](_0x73c5('0x11'),auth[_0x73c5('0x7')](),controller[_0x73c5('0x14')]);router[_0x73c5('0x13')]('/:id/sounds/:id2',auth[_0x73c5('0x7')](),controller[_0x73c5('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2660=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0x2660,0x1b5));var _0x0266=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0x2660[_0x4b6778];return _0x22dbb9;};'use strict';var multer=require(_0x0266('0x0'));var util=require(_0x0266('0x1'));var path=require(_0x0266('0x2'));var timeout=require(_0x0266('0x3'));var express=require(_0x0266('0x4'));var router=express[_0x0266('0x5')]();var auth=require(_0x0266('0x6'));var interaction=require(_0x0266('0x7'));var config=require(_0x0266('0x8'));var controller=require(_0x0266('0x9'));router[_0x0266('0xa')]('/',auth['isAuthenticated'](),controller[_0x0266('0xb')]);router[_0x0266('0xa')](_0x0266('0xc'),auth[_0x0266('0xd')](),controller['show']);router[_0x0266('0xa')](_0x0266('0xe'),auth[_0x0266('0xd')](),controller[_0x0266('0xf')]);router[_0x0266('0x10')]('/',auth['isAuthenticated'](),controller[_0x0266('0x11')]);router[_0x0266('0x10')](_0x0266('0xe'),auth[_0x0266('0xd')](),controller[_0x0266('0x12')]);router[_0x0266('0x13')](_0x0266('0xc'),auth['isAuthenticated'](),controller[_0x0266('0x14')]);router[_0x0266('0x15')](_0x0266('0xc'),auth[_0x0266('0xd')](),controller[_0x0266('0x16')]);router[_0x0266('0x15')]('/:id/sounds/:id2',auth[_0x0266('0xd')](),controller['removeSound']);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 f692e8b..26f82f9 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 _0x01f4=['sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP'];(function(_0x54f675,_0x3410c2){var _0x4d57db=function(_0x22b658){while(--_0x22b658){_0x54f675['push'](_0x54f675['shift']());}};_0x4d57db(++_0x3410c2);}(_0x01f4,0xd8));var _0x401f=function(_0x211b2a,_0x11ed5d){_0x211b2a=_0x211b2a-0x0;var _0x4c0d69=_0x01f4[_0x211b2a];return _0x4c0d69;};'use strict';var Sequelize=require(_0x401f('0x0'));module[_0x401f('0x1')]={'name':{'type':Sequelize[_0x401f('0x2')],'allowNull':![],'unique':_0x401f('0x3')},'mode':{'type':Sequelize[_0x401f('0x4')](_0x401f('0x5'),_0x401f('0x6'),_0x401f('0x7'),_0x401f('0x8'),'quietmp3',_0x401f('0x9')),'allowNull':!![],'defaultValue':_0x401f('0x6')},'directory':{'type':Sequelize[_0x401f('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x401f('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x401f('0x2')],'allowNull':!![],'defaultValue':_0x401f('0xa')},'format':{'type':Sequelize[_0x401f('0x2')],'allowNull':!![]},'stamp':{'type':_0x401f('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1cc8=['files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','exports','STRING','ENUM','custom'];(function(_0x124c54,_0x2ee025){var _0x908128=function(_0x560573){while(--_0x560573){_0x124c54['push'](_0x124c54['shift']());}};_0x908128(++_0x2ee025);}(_0x1cc8,0x130));var _0x81cc=function(_0x1da00d,_0x298b4e){_0x1da00d=_0x1da00d-0x0;var _0x4c791b=_0x1cc8[_0x1da00d];return _0x4c791b;};'use strict';var Sequelize=require('sequelize');module[_0x81cc('0x0')]={'name':{'type':Sequelize[_0x81cc('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x81cc('0x2')](_0x81cc('0x3'),_0x81cc('0x4'),_0x81cc('0x5'),_0x81cc('0x6'),_0x81cc('0x7'),_0x81cc('0x8')),'allowNull':!![],'defaultValue':_0x81cc('0x4')},'directory':{'type':Sequelize[_0x81cc('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x81cc('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x81cc('0x1')],'allowNull':!![],'defaultValue':_0x81cc('0x9')},'format':{'type':Sequelize[_0x81cc('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x81cc('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 81dfe81..900cc02 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 _0xc9cd=['Content-Range','json','apply','reject','save','update','destroy','then','MusicOnHolds','UserProfileResource','error','stack','name','map','VoiceMusicOnHold','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','rows','params','keys','rawAttributes','find','catch','body','sequelize','mode','files','directory','root','server/files/moh','create','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','join','removeSound','id2','createdAt','pick','getSounds','html-pdf','eml-format','zip-dir','request-promise','moment','to-csv','ejs','lodash','crypto','jsforce','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','count','offset','limit','set'];(function(_0x1e039c,_0xf5a151){var _0x2ec1e1=function(_0x176b6b){while(--_0x176b6b){_0x1e039c['push'](_0x1e039c['shift']());}};_0x2ec1e1(++_0xf5a151);}(_0xc9cd,0x124));var _0xdc9c=function(_0x21a0cb,_0x5a4cc5){_0x21a0cb=_0x21a0cb-0x0;var _0x2e9bb4=_0xc9cd[_0x21a0cb];return _0x2e9bb4;};'use strict';var pdf=require(_0xdc9c('0x0'));var emlformat=require(_0xdc9c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdc9c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc9c('0x3'));var moment=require(_0xdc9c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdc9c('0x5'));var ejs=require(_0xdc9c('0x6'));var fs=require('fs');var _=require(_0xdc9c('0x7'));var squel=require('squel');var crypto=require(_0xdc9c('0x8'));var jsforce=require(_0xdc9c('0x9'));var deskjs=require(_0xdc9c('0xa'));var toCsv=require(_0xdc9c('0x5'));var querystring=require(_0xdc9c('0xb'));var Papa=require('papaparse');var Redis=require(_0xdc9c('0xc'));var authService=require(_0xdc9c('0xd'));var qs=require(_0xdc9c('0xe'));var as=require(_0xdc9c('0xf'));var hardwareService=require(_0xdc9c('0x10'));var logger=require(_0xdc9c('0x11'))(_0xdc9c('0x12'));var utils=require(_0xdc9c('0x13'));var config=require(_0xdc9c('0x14'));var licenseUtil=require(_0xdc9c('0x15'));var db=require(_0xdc9c('0x16'))['db'];function respondWithStatusCode(_0x13957a,_0x44ffb1){_0x44ffb1=_0x44ffb1||0xcc;return function(_0x1e6438){if(_0x1e6438){return _0x13957a[_0xdc9c('0x17')](_0x44ffb1);}return _0x13957a[_0xdc9c('0x18')](_0x44ffb1)['end']();};}function respondWithResult(_0x2512d0,_0x1ce7c5){_0x1ce7c5=_0x1ce7c5||0xc8;return function(_0xee3f2f){if(_0xee3f2f){return _0x2512d0[_0xdc9c('0x18')](_0x1ce7c5)['json'](_0xee3f2f);}};}function respondWithFilteredResult(_0x2cda3e,_0x29c647){return function(_0xa162b9){if(_0xa162b9){var _0x485768=_0xa162b9[_0xdc9c('0x19')],_0x2585a1=_0x29c647['offset'],_0x28dfb8=_0x29c647[_0xdc9c('0x1a')]+_0x29c647[_0xdc9c('0x1b')],_0x5a09c2;if(_0x28dfb8>=_0x485768){_0x28dfb8=_0x485768;_0x5a09c2=0xc8;}else{_0x5a09c2=0xce;}_0x2cda3e[_0xdc9c('0x18')](_0x5a09c2);return _0x2cda3e[_0xdc9c('0x1c')](_0xdc9c('0x1d'),_0x2585a1+'-'+_0x28dfb8+'/'+_0x485768)[_0xdc9c('0x1e')](_0xa162b9);}return null;};}function patchUpdates(_0x3dda60){return function(_0x38ac35){try{jsonpatch[_0xdc9c('0x1f')](_0x38ac35,_0x3dda60,!![]);}catch(_0x46b48a){return BPromise[_0xdc9c('0x20')](_0x46b48a);}return _0x38ac35[_0xdc9c('0x21')]();};}function saveUpdates(_0x502856,_0x4f156e){return function(_0x19475e){if(_0x19475e){return _0x19475e[_0xdc9c('0x22')](_0x502856)['then'](function(_0x137d02){return _0x137d02;});}return null;};}function removeEntity(_0x288718,_0x27dfb3){return function(_0x1f7f94){if(_0x1f7f94){return _0x1f7f94[_0xdc9c('0x23')]()[_0xdc9c('0x24')](function(){var _0x53dce3=_0x1f7f94['get']({'plain':!![]});var _0xa42de0=_0xdc9c('0x25');return db[_0xdc9c('0x26')][_0xdc9c('0x23')]({'where':{'type':_0xa42de0,'resourceId':_0x53dce3['id']}})[_0xdc9c('0x24')](function(){return _0x1f7f94;});})[_0xdc9c('0x24')](function(){_0x288718[_0xdc9c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dd740,_0x55a1bf){return function(_0x41682c){if(!_0x41682c){_0x5dd740[_0xdc9c('0x17')](0x194);}return _0x41682c;};}function handleError(_0x492a2e,_0x124c4c){_0x124c4c=_0x124c4c||0x1f4;return function(_0x4d4247){logger[_0xdc9c('0x27')](_0x4d4247[_0xdc9c('0x28')]);if(_0x4d4247['name']){delete _0x4d4247[_0xdc9c('0x29')];}_0x492a2e['status'](_0x124c4c)['send'](_0x4d4247);};}exports['index']=function(_0x1214f2,_0x562329){var _0x3495fb={},_0x30a73f={},_0x38759b={'count':0x0,'rows':[]};var _0x16e1c4=_[_0xdc9c('0x2a')](db[_0xdc9c('0x2b')]['rawAttributes'],function(_0x3dd235){return{'name':_0x3dd235[_0xdc9c('0x2c')],'type':_0x3dd235[_0xdc9c('0x2d')]['key']};});_0x30a73f[_0xdc9c('0x2e')]=_[_0xdc9c('0x2a')](_0x16e1c4,_0xdc9c('0x29'));_0x30a73f[_0xdc9c('0x2f')]=_['keys'](_0x1214f2[_0xdc9c('0x2f')]);_0x30a73f[_0xdc9c('0x30')]=_[_0xdc9c('0x31')](_0x30a73f[_0xdc9c('0x2e')],_0x30a73f[_0xdc9c('0x2f')]);_0x3495fb[_0xdc9c('0x32')]=_[_0xdc9c('0x31')](_0x30a73f[_0xdc9c('0x2e')],qs[_0xdc9c('0x33')](_0x1214f2[_0xdc9c('0x2f')]['fields']));_0x3495fb[_0xdc9c('0x32')]=_0x3495fb[_0xdc9c('0x32')][_0xdc9c('0x34')]?_0x3495fb[_0xdc9c('0x32')]:_0x30a73f[_0xdc9c('0x2e')];if(!_0x1214f2[_0xdc9c('0x2f')][_0xdc9c('0x35')](_0xdc9c('0x36'))){_0x3495fb[_0xdc9c('0x1b')]=qs['limit'](_0x1214f2[_0xdc9c('0x2f')][_0xdc9c('0x1b')]);_0x3495fb[_0xdc9c('0x1a')]=qs[_0xdc9c('0x1a')](_0x1214f2[_0xdc9c('0x2f')][_0xdc9c('0x1a')]);}_0x3495fb[_0xdc9c('0x37')]=qs[_0xdc9c('0x38')](_0x1214f2['query'][_0xdc9c('0x38')]);_0x3495fb['where']=qs['filters'](_['pick'](_0x1214f2[_0xdc9c('0x2f')],_0x30a73f[_0xdc9c('0x30')]),_0x16e1c4);if(_0x1214f2[_0xdc9c('0x2f')][_0xdc9c('0x39')]){_0x3495fb[_0xdc9c('0x3a')]=_['merge'](_0x3495fb[_0xdc9c('0x3a')],{'$or':_[_0xdc9c('0x2a')](_0x16e1c4,function(_0x18cd52){if(_0x18cd52['type']!=='VIRTUAL'){var _0x1b903c={};_0x1b903c[_0x18cd52[_0xdc9c('0x29')]]={'$like':'%'+_0x1214f2['query'][_0xdc9c('0x39')]+'%'};return _0x1b903c;}})});}_0x3495fb=_[_0xdc9c('0x3b')]({},_0x3495fb,_0x1214f2[_0xdc9c('0x3c')]);var _0x6c6fb6={'where':_0x3495fb[_0xdc9c('0x3a')]};return db[_0xdc9c('0x2b')]['count'](_0x6c6fb6)[_0xdc9c('0x24')](function(_0x597321){_0x38759b['count']=_0x597321;if(_0x1214f2['query'][_0xdc9c('0x3d')]){_0x3495fb[_0xdc9c('0x3e')]=[{'all':!![]}];}return db[_0xdc9c('0x2b')]['findAll'](_0x3495fb);})[_0xdc9c('0x24')](function(_0x3b3b51){_0x38759b[_0xdc9c('0x3f')]=_0x3b3b51;return _0x38759b;})[_0xdc9c('0x24')](respondWithFilteredResult(_0x562329,_0x3495fb))['catch'](handleError(_0x562329,null));};exports['show']=function(_0x199078,_0x400a14){var _0x42bf7b={'raw':![],'where':{'id':_0x199078[_0xdc9c('0x40')]['id']}},_0x39c3bf={};_0x39c3bf['model']=_[_0xdc9c('0x41')](db[_0xdc9c('0x2b')][_0xdc9c('0x42')]);_0x39c3bf[_0xdc9c('0x2f')]=_['keys'](_0x199078['query']);_0x39c3bf[_0xdc9c('0x30')]=_[_0xdc9c('0x31')](_0x39c3bf[_0xdc9c('0x2e')],_0x39c3bf['query']);_0x42bf7b[_0xdc9c('0x32')]=_[_0xdc9c('0x31')](_0x39c3bf[_0xdc9c('0x2e')],qs[_0xdc9c('0x33')](_0x199078['query'][_0xdc9c('0x33')]));_0x42bf7b['attributes']=_0x42bf7b['attributes'][_0xdc9c('0x34')]?_0x42bf7b[_0xdc9c('0x32')]:_0x39c3bf[_0xdc9c('0x2e')];if(_0x199078['query']['includeAll']){_0x42bf7b[_0xdc9c('0x3e')]=[{'all':!![]}];}_0x42bf7b=_[_0xdc9c('0x3b')]({},_0x42bf7b,_0x199078[_0xdc9c('0x3c')]);return db[_0xdc9c('0x2b')][_0xdc9c('0x43')](_0x42bf7b)['then'](handleEntityNotFound(_0x400a14,null))[_0xdc9c('0x24')](respondWithResult(_0x400a14,null))[_0xdc9c('0x44')](handleError(_0x400a14,null));};exports[_0xdc9c('0x22')]=function(_0x15f369,_0x40f8a7){if(_0x15f369[_0xdc9c('0x45')]['id']){delete _0x15f369[_0xdc9c('0x45')]['id'];}return db[_0xdc9c('0x2b')][_0xdc9c('0x43')]({'where':{'id':_0x15f369[_0xdc9c('0x40')]['id']}})[_0xdc9c('0x24')](handleEntityNotFound(_0x40f8a7,null))[_0xdc9c('0x24')](saveUpdates(_0x15f369['body'],null))[_0xdc9c('0x24')](respondWithResult(_0x40f8a7,null))[_0xdc9c('0x44')](handleError(_0x40f8a7,null));};exports['create']=function(_0x24cb49,_0x571211,_0x59b654){return db[_0xdc9c('0x46')]['transaction'](function(_0x288118){if(_0x24cb49[_0xdc9c('0x45')][_0xdc9c('0x47')]===_0xdc9c('0x48')){_0x24cb49['body'][_0xdc9c('0x49')]=path['join'](config[_0xdc9c('0x4a')],_0xdc9c('0x4b'),_0x24cb49[_0xdc9c('0x45')][_0xdc9c('0x29')]);}return db[_0xdc9c('0x2b')][_0xdc9c('0x4c')](_0x24cb49[_0xdc9c('0x45')],{'transaction':_0x288118})[_0xdc9c('0x24')](function(_0x2bc50d){if(_0x24cb49[_0xdc9c('0x45')]['mode']===_0xdc9c('0x48')){fs[_0xdc9c('0x4d')](_0x2bc50d['directory'],parseInt(_0xdc9c('0x4e'),0x8));}var _0x57401f=_0x24cb49[_0xdc9c('0x4f')]['get']({'plain':!![]});if(!_0x57401f)throw new Error(_0xdc9c('0x50'));if(_0x57401f[_0xdc9c('0x51')]===_0xdc9c('0x4f')){var _0x162919=_0x2bc50d[_0xdc9c('0x52')]({'plain':!![]});return db[_0xdc9c('0x53')][_0xdc9c('0x43')]({'where':{'name':_0xdc9c('0x25'),'userProfileId':_0x57401f[_0xdc9c('0x54')]},'raw':!![]})[_0xdc9c('0x24')](function(_0x20b587){if(_0x20b587&&_0x20b587[_0xdc9c('0x55')]===0x0){return db[_0xdc9c('0x26')][_0xdc9c('0x4c')]({'name':_0x162919[_0xdc9c('0x29')],'resourceId':_0x162919['id'],'type':_0x20b587['name'],'sectionId':_0x20b587['id']},{})[_0xdc9c('0x24')](function(){return _0x2bc50d;});}else{return _0x2bc50d;}})[_0xdc9c('0x44')](function(_0x41718f){logger['error'](_0xdc9c('0x56'),_0x41718f);});}return _0x2bc50d;});})[_0xdc9c('0x24')](respondWithResult(_0x571211,0xc9))[_0xdc9c('0x44')](handleError(_0x571211,null));};exports[_0xdc9c('0x23')]=function(_0x35529b,_0x1fc440,_0x268c05){var _0x2607ce;return db[_0xdc9c('0x2b')][_0xdc9c('0x43')]({'where':{'id':_0x35529b[_0xdc9c('0x40')]['id']}})['then'](function(_0x2788c2){if(_0x2788c2){return db[_0xdc9c('0x46')][_0xdc9c('0x57')](function(_0x334e61){return _0x2788c2[_0xdc9c('0x23')]({'transaction':_0x334e61,'raw':!![]})['then'](function(_0x4671cd){if(_0x4671cd['directory']){fs[_0xdc9c('0x58')](_0x4671cd[_0xdc9c('0x49')])['forEach'](function(_0x4cf94a){fs[_0xdc9c('0x59')](path['join'](_0x4671cd[_0xdc9c('0x49')],_0x4cf94a));});fs['rmdirSync'](_0x4671cd[_0xdc9c('0x49')]);}return _0x4671cd;});})[_0xdc9c('0x44')](function(_0x14327b){throw new db[(_0xdc9c('0x5a'))][(_0xdc9c('0x5b'))](_0x14327b[_0xdc9c('0x5c')]);});}})[_0xdc9c('0x24')](handleEntityNotFound(_0x1fc440,null))['then'](removeEntity(_0x1fc440,null))[_0xdc9c('0x44')](handleError(_0x1fc440,null));};exports['addSound']=function(_0x3bba69,_0x13e256,_0xef85ce){return db['sequelize'][_0xdc9c('0x57')](function(_0x5b6d39){var _0x40091b;return db['VoiceMusicOnHold'][_0xdc9c('0x43')]({'where':{'id':_0x3bba69[_0xdc9c('0x40')]['id']}})[_0xdc9c('0x24')](function(_0x411989){if(_0x411989){_0x40091b=_0x411989;return _0x411989[_0xdc9c('0x5d')](_0x3bba69[_0xdc9c('0x45')]['id'],{'transaction':_0x5b6d39});}})['then'](function(_0x587a02){if(_0x587a02){return db[_0xdc9c('0x5e')][_0xdc9c('0x5f')]({'where':{'id':_0x3bba69[_0xdc9c('0x45')]['id']},'attributes':['id','name',_0xdc9c('0x60'),_0xdc9c('0x61'),'createdAt'],'raw':!![]});}})['then'](function(_0x3f3d64){if(_0x3f3d64){var _0x407d87=path['join'](config[_0xdc9c('0x4a')],_0xdc9c('0x62'),util[_0xdc9c('0x63')](_0xdc9c('0x64'),path['basename'](_0x3f3d64['save_name'],path['extname'](_0x3f3d64['save_name'])),_0x3f3d64['converted_format']));var _0x2577fd=path[_0xdc9c('0x65')](config[_0xdc9c('0x4a')],_0xdc9c('0x4b'),_0x40091b[_0xdc9c('0x29')],util['format'](_0xdc9c('0x64'),_0x3f3d64[_0xdc9c('0x29')],_0x3f3d64[_0xdc9c('0x61')]));fs['symlinkSync'](_0x407d87,_0x2577fd);return _0x3f3d64;}})[_0xdc9c('0x44')](function(_0x5b4ed4){throw new db['Sequelize']['ValidationError'](_0x5b4ed4[_0xdc9c('0x5c')]);});})[_0xdc9c('0x24')](handleEntityNotFound(_0x13e256,null))[_0xdc9c('0x24')](respondWithResult(_0x13e256,0xc9))['catch'](handleError(_0x13e256,null));};exports[_0xdc9c('0x66')]=function(_0x4e17dd,_0x25a72a,_0x43666d){return db[_0xdc9c('0x46')][_0xdc9c('0x57')](function(_0x4b79a0){var _0x5d6281;return db['VoiceMusicOnHold'][_0xdc9c('0x5f')]({'where':{'id':_0x4e17dd[_0xdc9c('0x40')]['id']}})['then'](handleEntityNotFound(_0x25a72a,null))['then'](function(_0xdb4923){if(_0xdb4923){_0x5d6281=_0xdb4923;return _0xdb4923[_0xdc9c('0x66')](_0x4e17dd[_0xdc9c('0x40')][_0xdc9c('0x67')]);}})[_0xdc9c('0x24')](function(_0xe6e147){if(_0xe6e147){return db['Sound']['findOne']({'where':{'id':_0x4e17dd[_0xdc9c('0x40')][_0xdc9c('0x67')]},'attributes':['id','name',_0xdc9c('0x60'),_0xdc9c('0x61'),_0xdc9c('0x68')],'raw':!![]});}})[_0xdc9c('0x24')](function(_0x5e0c3c){if(_0x5e0c3c){fs[_0xdc9c('0x59')](path['join'](_0x5d6281['directory'],util['format'](_0xdc9c('0x64'),_0x5e0c3c[_0xdc9c('0x29')],_0x5e0c3c[_0xdc9c('0x61')])));return _0x5e0c3c;}})[_0xdc9c('0x44')](function(_0x321bde){throw new db['Sequelize'][(_0xdc9c('0x5b'))](_0x321bde[_0xdc9c('0x5c')]);});})[_0xdc9c('0x24')](handleEntityNotFound(_0x25a72a,null))[_0xdc9c('0x24')](respondWithStatusCode(_0x25a72a,0xcc))[_0xdc9c('0x44')](handleError(_0x25a72a,null));};exports['getSounds']=function(_0x1c00ba,_0x5068f4,_0x301543){var _0x7a05aa={};var _0x3b0ae9={};var _0x4221b3;var _0x22570a;return db[_0xdc9c('0x2b')][_0xdc9c('0x5f')]({'where':{'id':_0x1c00ba[_0xdc9c('0x40')]['id']}})[_0xdc9c('0x24')](handleEntityNotFound(_0x5068f4,null))[_0xdc9c('0x24')](function(_0x3e058d){if(_0x3e058d){_0x4221b3=_0x3e058d;_0x3b0ae9[_0xdc9c('0x2e')]=_[_0xdc9c('0x41')](db[_0xdc9c('0x5e')][_0xdc9c('0x42')]);_0x3b0ae9['query']=_[_0xdc9c('0x41')](_0x1c00ba[_0xdc9c('0x2f')]);_0x3b0ae9['filters']=_[_0xdc9c('0x31')](_0x3b0ae9[_0xdc9c('0x2e')],_0x3b0ae9[_0xdc9c('0x2f')]);_0x7a05aa[_0xdc9c('0x32')]=_[_0xdc9c('0x31')](_0x3b0ae9[_0xdc9c('0x2e')],qs['fields'](_0x1c00ba[_0xdc9c('0x2f')][_0xdc9c('0x33')]));_0x7a05aa[_0xdc9c('0x32')]=_0x7a05aa[_0xdc9c('0x32')]['length']?_0x7a05aa['attributes']:_0x3b0ae9['model'];_0x7a05aa['order']=qs[_0xdc9c('0x38')](_0x1c00ba[_0xdc9c('0x2f')][_0xdc9c('0x38')]);_0x7a05aa[_0xdc9c('0x3a')]=qs[_0xdc9c('0x30')](_[_0xdc9c('0x69')](_0x1c00ba[_0xdc9c('0x2f')],_0x3b0ae9[_0xdc9c('0x30')]));if(_0x1c00ba[_0xdc9c('0x2f')][_0xdc9c('0x39')]){_0x7a05aa[_0xdc9c('0x3a')]=_['merge'](_0x7a05aa[_0xdc9c('0x3a')],{'$or':_[_0xdc9c('0x2a')](_0x7a05aa['attributes'],function(_0x16ae9){var _0x3952ef={};_0x3952ef[_0x16ae9]={'$like':'%'+_0x1c00ba[_0xdc9c('0x2f')][_0xdc9c('0x39')]+'%'};return _0x3952ef;})});}_0x7a05aa=_[_0xdc9c('0x3b')]({},_0x7a05aa,_0x1c00ba['options']);return _0x4221b3[_0xdc9c('0x6a')](_0x7a05aa);}})['then'](function(_0x3f0a61){if(_0x3f0a61){_0x22570a=_0x3f0a61['length'];if(!_0x1c00ba[_0xdc9c('0x2f')][_0xdc9c('0x35')](_0xdc9c('0x36'))){_0x7a05aa['limit']=qs[_0xdc9c('0x1b')](_0x1c00ba[_0xdc9c('0x2f')][_0xdc9c('0x1b')]);_0x7a05aa['offset']=qs[_0xdc9c('0x1a')](_0x1c00ba['query'][_0xdc9c('0x1a')]);}return _0x4221b3['getSounds'](_0x7a05aa);}})[_0xdc9c('0x24')](function(_0x55ffa7){if(_0x55ffa7){return _0x55ffa7?{'count':_0x22570a,'rows':_0x55ffa7}:null;}})['then'](respondWithResult(_0x5068f4,null))[_0xdc9c('0x44')](handleError(_0x5068f4,null));}; \ No newline at end of file +var _0xc435=['send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','count','include','findAll','rows','catch','show','keys','includeAll','find','body','params','create','sequelize','transaction','directory','join','server/files/moh','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','ValidationError','removeSound','id2','getSounds','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','set','apply','reject','save','update','then','get','MusicOnHolds','destroy','error','name'];(function(_0x254abd,_0x1ab7f0){var _0x31bf1b=function(_0x447fd8){while(--_0x447fd8){_0x254abd['push'](_0x254abd['shift']());}};_0x31bf1b(++_0x1ab7f0);}(_0xc435,0x124));var _0x5c43=function(_0xb3aa90,_0xd46111){_0xb3aa90=_0xb3aa90-0x0;var _0x43988b=_0xc435[_0xb3aa90];return _0x43988b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5c43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c43('0x1'));var jsonpatch=require(_0x5c43('0x2'));var rp=require(_0x5c43('0x3'));var moment=require(_0x5c43('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5c43('0x5'));var sox=require(_0x5c43('0x6'));var csv=require('to-csv');var ejs=require(_0x5c43('0x7'));var fs=require('fs');var _=require(_0x5c43('0x8'));var squel=require(_0x5c43('0x9'));var crypto=require(_0x5c43('0xa'));var jsforce=require(_0x5c43('0xb'));var deskjs=require(_0x5c43('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5c43('0xd'));var Papa=require(_0x5c43('0xe'));var Redis=require('ioredis');var authService=require(_0x5c43('0xf'));var qs=require(_0x5c43('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c43('0x11'));var logger=require(_0x5c43('0x12'))('api');var utils=require(_0x5c43('0x13'));var config=require(_0x5c43('0x14'));var licenseUtil=require(_0x5c43('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a008b,_0x337063){_0x337063=_0x337063||0xcc;return function(_0x685334){if(_0x685334){return _0x1a008b['sendStatus'](_0x337063);}return _0x1a008b[_0x5c43('0x16')](_0x337063)[_0x5c43('0x17')]();};}function respondWithResult(_0x49028e,_0x4cf449){_0x4cf449=_0x4cf449||0xc8;return function(_0x54ac00){if(_0x54ac00){return _0x49028e[_0x5c43('0x16')](_0x4cf449)[_0x5c43('0x18')](_0x54ac00);}};}function respondWithFilteredResult(_0x497470,_0x51b621){return function(_0x7418f){if(_0x7418f){var _0xd7b7b0=_0x7418f['count'],_0x298ad8=_0x51b621[_0x5c43('0x19')],_0x2026f5=_0x51b621['offset']+_0x51b621[_0x5c43('0x1a')],_0xba8888;if(_0x2026f5>=_0xd7b7b0){_0x2026f5=_0xd7b7b0;_0xba8888=0xc8;}else{_0xba8888=0xce;}_0x497470[_0x5c43('0x16')](_0xba8888);return _0x497470[_0x5c43('0x1b')]('Content-Range',_0x298ad8+'-'+_0x2026f5+'/'+_0xd7b7b0)[_0x5c43('0x18')](_0x7418f);}return null;};}function patchUpdates(_0x5ee6df){return function(_0xb0c637){try{jsonpatch[_0x5c43('0x1c')](_0xb0c637,_0x5ee6df,!![]);}catch(_0x51aa75){return BPromise[_0x5c43('0x1d')](_0x51aa75);}return _0xb0c637[_0x5c43('0x1e')]();};}function saveUpdates(_0x18d556,_0x29871f){return function(_0x20c455){if(_0x20c455){return _0x20c455[_0x5c43('0x1f')](_0x18d556)[_0x5c43('0x20')](function(_0x5052cd){return _0x5052cd;});}return null;};}function removeEntity(_0x266cec,_0x316e2c){return function(_0x5c4ffe){if(_0x5c4ffe){return _0x5c4ffe['destroy']()['then'](function(){var _0x2da2d8=_0x5c4ffe[_0x5c43('0x21')]({'plain':!![]});var _0x17b211=_0x5c43('0x22');return db['UserProfileResource'][_0x5c43('0x23')]({'where':{'type':_0x17b211,'resourceId':_0x2da2d8['id']}})[_0x5c43('0x20')](function(){return _0x5c4ffe;});})[_0x5c43('0x20')](function(){_0x266cec['status'](0xcc)[_0x5c43('0x17')]();});}};}function handleEntityNotFound(_0x11cd9d,_0x47c3be){return function(_0x402e3d){if(!_0x402e3d){_0x11cd9d['sendStatus'](0x194);}return _0x402e3d;};}function handleError(_0x41a2d7,_0x140b02){_0x140b02=_0x140b02||0x1f4;return function(_0x1c59a9){logger[_0x5c43('0x24')](_0x1c59a9['stack']);if(_0x1c59a9[_0x5c43('0x25')]){delete _0x1c59a9[_0x5c43('0x25')];}_0x41a2d7[_0x5c43('0x16')](_0x140b02)[_0x5c43('0x26')](_0x1c59a9);};}exports[_0x5c43('0x27')]=function(_0x2c6ef7,_0x47d513){var _0x243767={},_0x1b308e={},_0x58e1bc={'count':0x0,'rows':[]};var _0x4f6531=_[_0x5c43('0x28')](db[_0x5c43('0x29')][_0x5c43('0x2a')],function(_0x404505){return{'name':_0x404505[_0x5c43('0x2b')],'type':_0x404505['type'][_0x5c43('0x2c')]};});_0x1b308e[_0x5c43('0x2d')]=_[_0x5c43('0x28')](_0x4f6531,_0x5c43('0x25'));_0x1b308e[_0x5c43('0x2e')]=_['keys'](_0x2c6ef7[_0x5c43('0x2e')]);_0x1b308e[_0x5c43('0x2f')]=_[_0x5c43('0x30')](_0x1b308e[_0x5c43('0x2d')],_0x1b308e['query']);_0x243767['attributes']=_['intersection'](_0x1b308e[_0x5c43('0x2d')],qs[_0x5c43('0x31')](_0x2c6ef7[_0x5c43('0x2e')]['fields']));_0x243767[_0x5c43('0x32')]=_0x243767['attributes'][_0x5c43('0x33')]?_0x243767[_0x5c43('0x32')]:_0x1b308e['model'];if(!_0x2c6ef7[_0x5c43('0x2e')][_0x5c43('0x34')](_0x5c43('0x35'))){_0x243767[_0x5c43('0x1a')]=qs['limit'](_0x2c6ef7[_0x5c43('0x2e')]['limit']);_0x243767[_0x5c43('0x19')]=qs['offset'](_0x2c6ef7[_0x5c43('0x2e')][_0x5c43('0x19')]);}_0x243767[_0x5c43('0x36')]=qs[_0x5c43('0x37')](_0x2c6ef7[_0x5c43('0x2e')][_0x5c43('0x37')]);_0x243767[_0x5c43('0x38')]=qs[_0x5c43('0x2f')](_[_0x5c43('0x39')](_0x2c6ef7['query'],_0x1b308e[_0x5c43('0x2f')]),_0x4f6531);if(_0x2c6ef7['query']['filter']){_0x243767[_0x5c43('0x38')]=_[_0x5c43('0x3a')](_0x243767[_0x5c43('0x38')],{'$or':_[_0x5c43('0x28')](_0x4f6531,function(_0x571459){if(_0x571459[_0x5c43('0x3b')]!=='VIRTUAL'){var _0x36438a={};_0x36438a[_0x571459[_0x5c43('0x25')]]={'$like':'%'+_0x2c6ef7[_0x5c43('0x2e')][_0x5c43('0x3c')]+'%'};return _0x36438a;}})});}_0x243767=_[_0x5c43('0x3a')]({},_0x243767,_0x2c6ef7[_0x5c43('0x3d')]);var _0xa742d6={'where':_0x243767[_0x5c43('0x38')]};return db[_0x5c43('0x29')]['count'](_0xa742d6)[_0x5c43('0x20')](function(_0x1fe7a3){_0x58e1bc[_0x5c43('0x3e')]=_0x1fe7a3;if(_0x2c6ef7['query']['includeAll']){_0x243767[_0x5c43('0x3f')]=[{'all':!![]}];}return db[_0x5c43('0x29')][_0x5c43('0x40')](_0x243767);})[_0x5c43('0x20')](function(_0x390d6a){_0x58e1bc[_0x5c43('0x41')]=_0x390d6a;return _0x58e1bc;})[_0x5c43('0x20')](respondWithFilteredResult(_0x47d513,_0x243767))[_0x5c43('0x42')](handleError(_0x47d513,null));};exports[_0x5c43('0x43')]=function(_0x4d1b06,_0x4cb90d){var _0x35d1e8={'raw':![],'where':{'id':_0x4d1b06['params']['id']}},_0x2ae9cb={};_0x2ae9cb['model']=_[_0x5c43('0x44')](db[_0x5c43('0x29')][_0x5c43('0x2a')]);_0x2ae9cb['query']=_[_0x5c43('0x44')](_0x4d1b06['query']);_0x2ae9cb[_0x5c43('0x2f')]=_[_0x5c43('0x30')](_0x2ae9cb[_0x5c43('0x2d')],_0x2ae9cb[_0x5c43('0x2e')]);_0x35d1e8[_0x5c43('0x32')]=_[_0x5c43('0x30')](_0x2ae9cb['model'],qs[_0x5c43('0x31')](_0x4d1b06['query'][_0x5c43('0x31')]));_0x35d1e8[_0x5c43('0x32')]=_0x35d1e8['attributes'][_0x5c43('0x33')]?_0x35d1e8[_0x5c43('0x32')]:_0x2ae9cb[_0x5c43('0x2d')];if(_0x4d1b06['query'][_0x5c43('0x45')]){_0x35d1e8[_0x5c43('0x3f')]=[{'all':!![]}];}_0x35d1e8=_[_0x5c43('0x3a')]({},_0x35d1e8,_0x4d1b06['options']);return db[_0x5c43('0x29')][_0x5c43('0x46')](_0x35d1e8)[_0x5c43('0x20')](handleEntityNotFound(_0x4cb90d,null))[_0x5c43('0x20')](respondWithResult(_0x4cb90d,null))[_0x5c43('0x42')](handleError(_0x4cb90d,null));};exports[_0x5c43('0x1f')]=function(_0x141111,_0x274d87){if(_0x141111[_0x5c43('0x47')]['id']){delete _0x141111['body']['id'];}return db[_0x5c43('0x29')][_0x5c43('0x46')]({'where':{'id':_0x141111[_0x5c43('0x48')]['id']}})['then'](handleEntityNotFound(_0x274d87,null))['then'](saveUpdates(_0x141111[_0x5c43('0x47')],null))[_0x5c43('0x20')](respondWithResult(_0x274d87,null))[_0x5c43('0x42')](handleError(_0x274d87,null));};exports[_0x5c43('0x49')]=function(_0x112824,_0x5086b2,_0x31adb5){return db[_0x5c43('0x4a')][_0x5c43('0x4b')](function(_0x893364){if(_0x112824['body']['mode']==='files'){_0x112824[_0x5c43('0x47')][_0x5c43('0x4c')]=path[_0x5c43('0x4d')](config['root'],_0x5c43('0x4e'),_0x112824[_0x5c43('0x47')][_0x5c43('0x25')]);}return db[_0x5c43('0x29')]['create'](_0x112824[_0x5c43('0x47')],{'transaction':_0x893364})[_0x5c43('0x20')](function(_0x58c7e3){if(_0x112824[_0x5c43('0x47')]['mode']===_0x5c43('0x4f')){fs[_0x5c43('0x50')](_0x58c7e3[_0x5c43('0x4c')],parseInt(_0x5c43('0x51'),0x8));}var _0x478075=_0x112824[_0x5c43('0x52')]['get']({'plain':!![]});if(!_0x478075)throw new Error(_0x5c43('0x53'));if(_0x478075[_0x5c43('0x54')]===_0x5c43('0x52')){var _0x572451=_0x58c7e3['get']({'plain':!![]});return db['UserProfileSection'][_0x5c43('0x46')]({'where':{'name':_0x5c43('0x22'),'userProfileId':_0x478075[_0x5c43('0x55')]},'raw':!![]})[_0x5c43('0x20')](function(_0x148106){if(_0x148106&&_0x148106[_0x5c43('0x56')]===0x0){return db[_0x5c43('0x57')][_0x5c43('0x49')]({'name':_0x572451[_0x5c43('0x25')],'resourceId':_0x572451['id'],'type':_0x148106[_0x5c43('0x25')],'sectionId':_0x148106['id']},{})[_0x5c43('0x20')](function(){return _0x58c7e3;});}else{return _0x58c7e3;}})[_0x5c43('0x42')](function(_0x3799c9){logger[_0x5c43('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3799c9);});}return _0x58c7e3;});})['then'](respondWithResult(_0x5086b2,0xc9))[_0x5c43('0x42')](handleError(_0x5086b2,null));};exports[_0x5c43('0x23')]=function(_0x5e9937,_0x11c4a9,_0x496560){var _0x2bb192;return db[_0x5c43('0x29')][_0x5c43('0x46')]({'where':{'id':_0x5e9937['params']['id']}})[_0x5c43('0x20')](function(_0x20acf0){if(_0x20acf0){return db['sequelize'][_0x5c43('0x4b')](function(_0x359d72){return _0x20acf0['destroy']({'transaction':_0x359d72,'raw':!![]})[_0x5c43('0x20')](function(_0x2790df){if(_0x2790df['directory']){fs[_0x5c43('0x58')](_0x2790df[_0x5c43('0x4c')])[_0x5c43('0x59')](function(_0x431fcf){fs[_0x5c43('0x5a')](path[_0x5c43('0x4d')](_0x2790df[_0x5c43('0x4c')],_0x431fcf));});fs[_0x5c43('0x5b')](_0x2790df[_0x5c43('0x4c')]);}return _0x2790df;});})['catch'](function(_0x2a846d){throw new db[(_0x5c43('0x5c'))]['ValidationError'](_0x2a846d[_0x5c43('0x5d')]);});}})[_0x5c43('0x20')](handleEntityNotFound(_0x11c4a9,null))['then'](removeEntity(_0x11c4a9,null))[_0x5c43('0x42')](handleError(_0x11c4a9,null));};exports[_0x5c43('0x5e')]=function(_0xff5dc9,_0x5cc7bd,_0x5f5051){return db[_0x5c43('0x4a')][_0x5c43('0x4b')](function(_0x23dd09){var _0x4aba78;return db['VoiceMusicOnHold'][_0x5c43('0x46')]({'where':{'id':_0xff5dc9[_0x5c43('0x48')]['id']}})[_0x5c43('0x20')](function(_0x22c176){if(_0x22c176){_0x4aba78=_0x22c176;return _0x22c176[_0x5c43('0x5e')](_0xff5dc9['body']['id'],{'transaction':_0x23dd09});}})[_0x5c43('0x20')](function(_0xf947cb){if(_0xf947cb){return db[_0x5c43('0x5f')][_0x5c43('0x60')]({'where':{'id':_0xff5dc9[_0x5c43('0x47')]['id']},'attributes':['id','name',_0x5c43('0x61'),_0x5c43('0x62'),_0x5c43('0x63')],'raw':!![]});}})[_0x5c43('0x20')](function(_0x3e11a9){if(_0x3e11a9){var _0x5ae14d=path['join'](config[_0x5c43('0x64')],_0x5c43('0x65'),util[_0x5c43('0x66')](_0x5c43('0x67'),path[_0x5c43('0x68')](_0x3e11a9[_0x5c43('0x61')],path[_0x5c43('0x69')](_0x3e11a9['save_name'])),_0x3e11a9[_0x5c43('0x62')]));var _0x2078b6=path['join'](config[_0x5c43('0x64')],_0x5c43('0x4e'),_0x4aba78[_0x5c43('0x25')],util[_0x5c43('0x66')](_0x5c43('0x67'),_0x3e11a9[_0x5c43('0x25')],_0x3e11a9[_0x5c43('0x62')]));fs['symlinkSync'](_0x5ae14d,_0x2078b6);return _0x3e11a9;}})[_0x5c43('0x42')](function(_0x1d7387){throw new db['Sequelize'][(_0x5c43('0x6a'))](_0x1d7387[_0x5c43('0x5d')]);});})[_0x5c43('0x20')](handleEntityNotFound(_0x5cc7bd,null))[_0x5c43('0x20')](respondWithResult(_0x5cc7bd,0xc9))[_0x5c43('0x42')](handleError(_0x5cc7bd,null));};exports[_0x5c43('0x6b')]=function(_0x9aadf0,_0x4703b7,_0x5f04a5){return db[_0x5c43('0x4a')][_0x5c43('0x4b')](function(_0x3ad3fc){var _0x1aecc;return db['VoiceMusicOnHold'][_0x5c43('0x60')]({'where':{'id':_0x9aadf0[_0x5c43('0x48')]['id']}})[_0x5c43('0x20')](handleEntityNotFound(_0x4703b7,null))[_0x5c43('0x20')](function(_0x438172){if(_0x438172){_0x1aecc=_0x438172;return _0x438172[_0x5c43('0x6b')](_0x9aadf0['params'][_0x5c43('0x6c')]);}})['then'](function(_0x5d6a3b){if(_0x5d6a3b){return db['Sound']['findOne']({'where':{'id':_0x9aadf0[_0x5c43('0x48')][_0x5c43('0x6c')]},'attributes':['id',_0x5c43('0x25'),'save_name','converted_format',_0x5c43('0x63')],'raw':!![]});}})[_0x5c43('0x20')](function(_0x53727e){if(_0x53727e){fs[_0x5c43('0x5a')](path[_0x5c43('0x4d')](_0x1aecc[_0x5c43('0x4c')],util[_0x5c43('0x66')]('%s.%s',_0x53727e[_0x5c43('0x25')],_0x53727e[_0x5c43('0x62')])));return _0x53727e;}})[_0x5c43('0x42')](function(_0xe9df27){throw new db['Sequelize'][(_0x5c43('0x6a'))](_0xe9df27['message']);});})['then'](handleEntityNotFound(_0x4703b7,null))[_0x5c43('0x20')](respondWithStatusCode(_0x4703b7,0xcc))[_0x5c43('0x42')](handleError(_0x4703b7,null));};exports[_0x5c43('0x6d')]=function(_0x516f17,_0x3f5347,_0x3ba6ca){var _0x346550={};var _0xb82826={};var _0x75aba2;var _0x1e7162;return db[_0x5c43('0x29')][_0x5c43('0x60')]({'where':{'id':_0x516f17[_0x5c43('0x48')]['id']}})[_0x5c43('0x20')](handleEntityNotFound(_0x3f5347,null))['then'](function(_0x5f2d6c){if(_0x5f2d6c){_0x75aba2=_0x5f2d6c;_0xb82826[_0x5c43('0x2d')]=_[_0x5c43('0x44')](db[_0x5c43('0x5f')][_0x5c43('0x2a')]);_0xb82826[_0x5c43('0x2e')]=_[_0x5c43('0x44')](_0x516f17['query']);_0xb82826[_0x5c43('0x2f')]=_[_0x5c43('0x30')](_0xb82826[_0x5c43('0x2d')],_0xb82826[_0x5c43('0x2e')]);_0x346550[_0x5c43('0x32')]=_[_0x5c43('0x30')](_0xb82826[_0x5c43('0x2d')],qs['fields'](_0x516f17[_0x5c43('0x2e')][_0x5c43('0x31')]));_0x346550[_0x5c43('0x32')]=_0x346550[_0x5c43('0x32')][_0x5c43('0x33')]?_0x346550[_0x5c43('0x32')]:_0xb82826[_0x5c43('0x2d')];_0x346550['order']=qs[_0x5c43('0x37')](_0x516f17['query'][_0x5c43('0x37')]);_0x346550[_0x5c43('0x38')]=qs[_0x5c43('0x2f')](_[_0x5c43('0x39')](_0x516f17['query'],_0xb82826[_0x5c43('0x2f')]));if(_0x516f17[_0x5c43('0x2e')]['filter']){_0x346550[_0x5c43('0x38')]=_['merge'](_0x346550[_0x5c43('0x38')],{'$or':_['map'](_0x346550[_0x5c43('0x32')],function(_0x4989da){var _0x5f11cb={};_0x5f11cb[_0x4989da]={'$like':'%'+_0x516f17['query'][_0x5c43('0x3c')]+'%'};return _0x5f11cb;})});}_0x346550=_[_0x5c43('0x3a')]({},_0x346550,_0x516f17[_0x5c43('0x3d')]);return _0x75aba2['getSounds'](_0x346550);}})['then'](function(_0x8c65b7){if(_0x8c65b7){_0x1e7162=_0x8c65b7['length'];if(!_0x516f17['query'][_0x5c43('0x34')](_0x5c43('0x35'))){_0x346550[_0x5c43('0x1a')]=qs[_0x5c43('0x1a')](_0x516f17[_0x5c43('0x2e')]['limit']);_0x346550['offset']=qs[_0x5c43('0x19')](_0x516f17[_0x5c43('0x2e')][_0x5c43('0x19')]);}return _0x75aba2[_0x5c43('0x6d')](_0x346550);}})['then'](function(_0x255bd1){if(_0x255bd1){return _0x255bd1?{'count':_0x1e7162,'rows':_0x255bd1}:null;}})[_0x5c43('0x20')](respondWithResult(_0x3f5347,null))[_0x5c43('0x42')](handleError(_0x3f5347,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2325940..e60d0b0 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 _0x94b6=['rimraf','../../config/environment','define','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x47a6a3,_0x50033c){var _0x237581=function(_0x32b13d){while(--_0x32b13d){_0x47a6a3['push'](_0x47a6a3['shift']());}};_0x237581(++_0x50033c);}(_0x94b6,0x16c));var _0x694b=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x94b6[_0x46361e];return _0x14e302;};'use strict';var _=require(_0x694b('0x0'));var util=require(_0x694b('0x1'));var logger=require(_0x694b('0x2'))(_0x694b('0x3'));var moment=require(_0x694b('0x4'));var BPromise=require(_0x694b('0x5'));var rp=require(_0x694b('0x6'));var fs=require('fs');var path=require(_0x694b('0x7'));var rimraf=require(_0x694b('0x8'));var config=require(_0x694b('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x3cf629,_0x1d15f8){return _0x3cf629[_0x694b('0xa')](_0x694b('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa287=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa287,0x10e));var _0x7a28=function(_0x2e63e8,_0xed68f5){_0x2e63e8=_0x2e63e8-0x0;var _0x3fe904=_0xa287[_0x2e63e8];return _0x3fe904;};'use strict';var _=require(_0x7a28('0x0'));var util=require(_0x7a28('0x1'));var logger=require(_0x7a28('0x2'))(_0x7a28('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a28('0x4'));var rimraf=require(_0x7a28('0x5'));var config=require(_0x7a28('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x7a28('0x7')]=function(_0x5e310f,_0x21b795){return _0x5e310f[_0x7a28('0x8')](_0x7a28('0x9'),attributes,{'tableName':'voice_musiconhold','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 b68e994..a228b12 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 _0xc125=['../../config/utils','../../config/environment','jayson/promise','client','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','randomstring','ioredis'];(function(_0x117587,_0x3c8971){var _0x3a7247=function(_0x52d26a){while(--_0x52d26a){_0x117587['push'](_0x117587['shift']());}};_0x3a7247(++_0x3c8971);}(_0xc125,0x7d));var _0x5c12=function(_0x4d7e31,_0x420719){_0x4d7e31=_0x4d7e31-0x0;var _0x24c361=_0xc125[_0x4d7e31];return _0x24c361;};'use strict';var _=require('lodash');var util=require(_0x5c12('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5c12('0x1'));var fs=require('fs');var Redis=require(_0x5c12('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c12('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x5c12('0x4'));var jayson=require(_0x5c12('0x5'));var client=jayson[_0x5c12('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bf261,_0x38df97,_0x1cc96b){return new BPromise(function(_0x4443a0,_0x295f6e){return client[_0x5c12('0x7')](_0x5bf261,_0x1cc96b)['then'](function(_0x2547ac){logger[_0x5c12('0x8')](_0x5c12('0x9'),_0x38df97,_0x5c12('0xa'));logger['debug'](_0x5c12('0xb'),_0x38df97,_0x5c12('0xa'),JSON[_0x5c12('0xc')](_0x2547ac));if(_0x2547ac[_0x5c12('0xd')]){if(_0x2547ac[_0x5c12('0xd')][_0x5c12('0xe')]===0x1f4){logger[_0x5c12('0xd')](_0x5c12('0x9'),_0x38df97,_0x2547ac[_0x5c12('0xd')][_0x5c12('0xf')]);return _0x295f6e(_0x2547ac[_0x5c12('0xd')]['message']);}logger[_0x5c12('0xd')](_0x5c12('0x9'),_0x38df97,_0x2547ac['error'][_0x5c12('0xf')]);return _0x4443a0(_0x2547ac[_0x5c12('0xd')]['message']);}else{logger[_0x5c12('0x8')](_0x5c12('0x9'),_0x38df97,'request\x20sent');_0x4443a0(_0x2547ac['result']['message']);}})['catch'](function(_0xfe4b58){logger[_0x5c12('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x38df97,_0xfe4b58);_0x295f6e(_0xfe4b58);});});} \ No newline at end of file +var _0x0d5e=['request\x20sent','stringify','code','error','result','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','VoiceMusicOnHold,\x20%s,\x20%s','debug'];(function(_0x41c81a,_0x4d88a5){var _0x5e42dd=function(_0x5b7e8f){while(--_0x5b7e8f){_0x41c81a['push'](_0x41c81a['shift']());}};_0x5e42dd(++_0x4d88a5);}(_0x0d5e,0xb2));var _0xe0d5=function(_0x5ecd67,_0x49447a){_0x5ecd67=_0x5ecd67-0x0;var _0x275ae7=_0x0d5e[_0x5ecd67];return _0x275ae7;};'use strict';var _=require(_0xe0d5('0x0'));var util=require(_0xe0d5('0x1'));var moment=require(_0xe0d5('0x2'));var BPromise=require(_0xe0d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0d5('0x4'))['db'];var utils=require(_0xe0d5('0x5'));var logger=require('../../config/logger')(_0xe0d5('0x6'));var config=require('../../config/environment');var jayson=require(_0xe0d5('0x7'));var client=jayson[_0xe0d5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbddcab,_0x4ef55b,_0x22a868){return new BPromise(function(_0x22add2,_0x7a2d19){return client[_0xe0d5('0x9')](_0xbddcab,_0x22a868)['then'](function(_0x575126){logger['info'](_0xe0d5('0xa'),_0x4ef55b,'request\x20sent');logger[_0xe0d5('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x4ef55b,_0xe0d5('0xc'),JSON[_0xe0d5('0xd')](_0x575126));if(_0x575126['error']){if(_0x575126['error'][_0xe0d5('0xe')]===0x1f4){logger[_0xe0d5('0xf')](_0xe0d5('0xa'),_0x4ef55b,_0x575126[_0xe0d5('0xf')]['message']);return _0x7a2d19(_0x575126[_0xe0d5('0xf')]['message']);}logger[_0xe0d5('0xf')](_0xe0d5('0xa'),_0x4ef55b,_0x575126['error']['message']);return _0x22add2(_0x575126['error']['message']);}else{logger['info'](_0xe0d5('0xa'),_0x4ef55b,_0xe0d5('0xc'));_0x22add2(_0x575126[_0xe0d5('0x10')][_0xe0d5('0x11')]);}})[_0xe0d5('0x12')](function(_0xe0f06){logger['error'](_0xe0d5('0xa'),_0x4ef55b,_0xe0f06);_0x7a2d19(_0xe0f06);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 902e3cf..1f7a10f 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 _0x8803=['removeAgents','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/:id','show','post','/:id/users','addAgents','delete'];(function(_0x4d16f2,_0x4ec028){var _0x282cd6=function(_0x38f0c5){while(--_0x38f0c5){_0x4d16f2['push'](_0x4d16f2['shift']());}};_0x282cd6(++_0x4ec028);}(_0x8803,0x1d2));var _0x3880=function(_0x338518,_0x52b4a8){_0x338518=_0x338518-0x0;var _0x100a40=_0x8803[_0x338518];return _0x100a40;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3880('0x0'));var timeout=require('connect-timeout');var express=require(_0x3880('0x1'));var router=express['Router']();var auth=require(_0x3880('0x2'));var interaction=require(_0x3880('0x3'));var config=require(_0x3880('0x4'));var controller=require(_0x3880('0x5'));router[_0x3880('0x6')]('/',auth[_0x3880('0x7')](),controller['index']);router[_0x3880('0x6')]('/describe',auth[_0x3880('0x7')](),controller['describe']);router['get'](_0x3880('0x8'),auth['isAuthenticated'](),controller[_0x3880('0x9')]);router[_0x3880('0x6')]('/:id/users',auth[_0x3880('0x7')](),controller['getAgents']);router[_0x3880('0xa')]('/',auth[_0x3880('0x7')](),controller['create']);router[_0x3880('0xa')](_0x3880('0xb'),auth[_0x3880('0x7')](),controller[_0x3880('0xc')]);router['put'](_0x3880('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x3880('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x3880('0xd')](_0x3880('0xb'),auth['isAuthenticated'](),controller[_0x3880('0xe')]);module[_0x3880('0xf')]=router; \ No newline at end of file +var _0xb23f=['/:id/users','addAgents','put','/:id','delete','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','show','getAgents','post','create'];(function(_0xe56641,_0x30044d){var _0x171ff5=function(_0x2e1570){while(--_0x2e1570){_0xe56641['push'](_0xe56641['shift']());}};_0x171ff5(++_0x30044d);}(_0xb23f,0x90));var _0xfb23=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb23f[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xfb23('0x0'));var util=require(_0xfb23('0x1'));var path=require(_0xfb23('0x2'));var timeout=require(_0xfb23('0x3'));var express=require(_0xfb23('0x4'));var router=express[_0xfb23('0x5')]();var auth=require(_0xfb23('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb23('0x7'));var controller=require(_0xfb23('0x8'));router[_0xfb23('0x9')]('/',auth[_0xfb23('0xa')](),controller[_0xfb23('0xb')]);router[_0xfb23('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xfb23('0xc')]);router[_0xfb23('0x9')]('/:id',auth[_0xfb23('0xa')](),controller[_0xfb23('0xd')]);router[_0xfb23('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xfb23('0xe')]);router[_0xfb23('0xf')]('/',auth[_0xfb23('0xa')](),controller[_0xfb23('0x10')]);router[_0xfb23('0xf')](_0xfb23('0x11'),auth[_0xfb23('0xa')](),controller[_0xfb23('0x12')]);router[_0xfb23('0x13')](_0xfb23('0x14'),auth[_0xfb23('0xa')](),controller['update']);router[_0xfb23('0x15')]('/:id',auth[_0xfb23('0xa')](),controller['destroy']);router[_0xfb23('0x15')](_0xfb23('0x11'),auth[_0xfb23('0xa')](),controller[_0xfb23('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 233400d..bba8c55 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 _0x36b2=['sequelize','exports','STRING','name','VIRTUAL','getDataValue','INTEGER'];(function(_0x2aed21,_0xce0478){var _0x5bbbcc=function(_0x462bf4){while(--_0x462bf4){_0x2aed21['push'](_0x2aed21['shift']());}};_0x5bbbcc(++_0xce0478);}(_0x36b2,0x181));var _0x236b=function(_0x57193f,_0x5b2548){_0x57193f=_0x57193f-0x0;var _0x58d205=_0x36b2[_0x57193f];return _0x58d205;};'use strict';var Sequelize=require(_0x236b('0x0'));module[_0x236b('0x1')]={'name':{'type':Sequelize[_0x236b('0x2')],'allowNull':![],'unique':_0x236b('0x3')},'prefix':{'type':Sequelize[_0x236b('0x4')],'get':function(_0x28bf98){return'system-'+this[_0x236b('0x5')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x236b('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x236b('0x6')]}}; \ No newline at end of file +var _0xf707=['STRING','name','VIRTUAL','system-','getDataValue','sequelize','exports'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0xf707,0xde));var _0x7f70=function(_0x392bed,_0x5236df){_0x392bed=_0x392bed-0x0;var _0xde1ebe=_0xf707[_0x392bed];return _0xde1ebe;};'use strict';var Sequelize=require(_0x7f70('0x0'));module[_0x7f70('0x1')]={'name':{'type':Sequelize[_0x7f70('0x2')],'allowNull':![],'unique':_0x7f70('0x3')},'prefix':{'type':Sequelize[_0x7f70('0x4')],'get':function(_0x4e8999){return _0x7f70('0x5')+this[_0x7f70('0x6')](_0x7f70('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x7f70('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 2ddb87d..3a024d5 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 _0x2581=['VoicePrefix','rawAttributes','fieldName','model','query','keys','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','type','merge','options','includeAll','include','rows','catch','show','params','intersection','find','describe','sequelize','transaction','create','VoiceExtension','VoiceExtensionId','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','getAgents','nolimit','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','map'];(function(_0x3ecd45,_0x5e1e3d){var _0x41e8f0=function(_0xeabf05){while(--_0xeabf05){_0x3ecd45['push'](_0x3ecd45['shift']());}};_0x41e8f0(++_0x5e1e3d);}(_0x2581,0xcb));var _0x1258=function(_0xf56fb3,_0x5b08c4){_0xf56fb3=_0xf56fb3-0x0;var _0x246b7a=_0x2581[_0xf56fb3];return _0x246b7a;};'use strict';var pdf=require(_0x1258('0x0'));var emlformat=require(_0x1258('0x1'));var rimraf=require(_0x1258('0x2'));var zipdir=require(_0x1258('0x3'));var jsonpatch=require(_0x1258('0x4'));var rp=require('request-promise');var moment=require(_0x1258('0x5'));var BPromise=require(_0x1258('0x6'));var Mustache=require(_0x1258('0x7'));var util=require(_0x1258('0x8'));var path=require(_0x1258('0x9'));var sox=require(_0x1258('0xa'));var csv=require(_0x1258('0xb'));var ejs=require(_0x1258('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1258('0xd'));var crypto=require(_0x1258('0xe'));var jsforce=require(_0x1258('0xf'));var deskjs=require(_0x1258('0x10'));var toCsv=require(_0x1258('0xb'));var querystring=require(_0x1258('0x11'));var Papa=require(_0x1258('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1258('0x13'));var as=require(_0x1258('0x14'));var hardwareService=require(_0x1258('0x15'));var logger=require(_0x1258('0x16'))('api');var utils=require(_0x1258('0x17'));var config=require(_0x1258('0x18'));var licenseUtil=require(_0x1258('0x19'));var db=require(_0x1258('0x1a'))['db'];config['redis']=_[_0x1258('0x1b')](config[_0x1258('0x1c')],{'host':_0x1258('0x1d'),'port':0x18eb});var socket=require(_0x1258('0x1e'))(new Redis(config[_0x1258('0x1c')]));require(_0x1258('0x1f'))[_0x1258('0x20')](socket);function respondWithStatusCode(_0x562286,_0x77d12c){_0x77d12c=_0x77d12c||0xcc;return function(_0x56bd82){if(_0x56bd82){return _0x562286[_0x1258('0x21')](_0x77d12c);}return _0x562286[_0x1258('0x22')](_0x77d12c)[_0x1258('0x23')]();};}function respondWithResult(_0x26e676,_0x313717){_0x313717=_0x313717||0xc8;return function(_0x4a85e4){if(_0x4a85e4){return _0x26e676[_0x1258('0x22')](_0x313717)[_0x1258('0x24')](_0x4a85e4);}};}function respondWithFilteredResult(_0x38d6e9,_0x55f1dc){return function(_0x97c02e){if(_0x97c02e){var _0xf234e8=_0x97c02e[_0x1258('0x25')],_0x55c458=_0x55f1dc[_0x1258('0x26')],_0x2dd7fd=_0x55f1dc[_0x1258('0x26')]+_0x55f1dc[_0x1258('0x27')],_0x2432b2;if(_0x2dd7fd>=_0xf234e8){_0x2dd7fd=_0xf234e8;_0x2432b2=0xc8;}else{_0x2432b2=0xce;}_0x38d6e9[_0x1258('0x22')](_0x2432b2);return _0x38d6e9[_0x1258('0x28')](_0x1258('0x29'),_0x55c458+'-'+_0x2dd7fd+'/'+_0xf234e8)[_0x1258('0x24')](_0x97c02e);}return null;};}function patchUpdates(_0x181c8c){return function(_0x7ce367){try{jsonpatch[_0x1258('0x2a')](_0x7ce367,_0x181c8c,!![]);}catch(_0x1d270b){return BPromise[_0x1258('0x2b')](_0x1d270b);}return _0x7ce367['save']();};}function saveUpdates(_0x282ef1,_0x528a62){return function(_0x569f65){if(_0x569f65){return _0x569f65[_0x1258('0x2c')](_0x282ef1)[_0x1258('0x2d')](function(_0x3e3a57){return _0x3e3a57;});}return null;};}function removeEntity(_0x2a61f2,_0x437fce){return function(_0xdf6639){if(_0xdf6639){return _0xdf6639[_0x1258('0x2e')]()['then'](function(){var _0x3ec562=_0xdf6639[_0x1258('0x2f')]({'plain':!![]});var _0x1cbfd1=_0x1258('0x30');return db[_0x1258('0x31')][_0x1258('0x2e')]({'where':{'type':_0x1cbfd1,'resourceId':_0x3ec562['id']}})[_0x1258('0x2d')](function(){return _0xdf6639;});})[_0x1258('0x2d')](function(){_0x2a61f2[_0x1258('0x22')](0xcc)[_0x1258('0x23')]();});}};}function handleEntityNotFound(_0x2edb84,_0x42a3b4){return function(_0x17b6b2){if(!_0x17b6b2){_0x2edb84['sendStatus'](0x194);}return _0x17b6b2;};}function handleError(_0x5a6365,_0x18ab7a){_0x18ab7a=_0x18ab7a||0x1f4;return function(_0x4fa3cf){logger[_0x1258('0x32')](_0x4fa3cf[_0x1258('0x33')]);if(_0x4fa3cf['name']){delete _0x4fa3cf[_0x1258('0x34')];}_0x5a6365[_0x1258('0x22')](_0x18ab7a)[_0x1258('0x35')](_0x4fa3cf);};}exports['index']=function(_0x58e7be,_0x1b46bf){var _0x2598a6={},_0x4a9642={},_0xa93e0b={'count':0x0,'rows':[]};var _0x5d059f=_[_0x1258('0x36')](db[_0x1258('0x37')][_0x1258('0x38')],function(_0x3c384c){return{'name':_0x3c384c[_0x1258('0x39')],'type':_0x3c384c['type']['key']};});_0x4a9642[_0x1258('0x3a')]=_[_0x1258('0x36')](_0x5d059f,_0x1258('0x34'));_0x4a9642[_0x1258('0x3b')]=_[_0x1258('0x3c')](_0x58e7be[_0x1258('0x3b')]);_0x4a9642['filters']=_['intersection'](_0x4a9642[_0x1258('0x3a')],_0x4a9642[_0x1258('0x3b')]);_0x2598a6['attributes']=_['intersection'](_0x4a9642['model'],qs['fields'](_0x58e7be[_0x1258('0x3b')][_0x1258('0x3d')]));_0x2598a6[_0x1258('0x3e')]=_0x2598a6[_0x1258('0x3e')][_0x1258('0x3f')]?_0x2598a6[_0x1258('0x3e')]:_0x4a9642[_0x1258('0x3a')];if(!_0x58e7be[_0x1258('0x3b')][_0x1258('0x40')]('nolimit')){_0x2598a6['limit']=qs[_0x1258('0x27')](_0x58e7be['query'][_0x1258('0x27')]);_0x2598a6['offset']=qs[_0x1258('0x26')](_0x58e7be[_0x1258('0x3b')][_0x1258('0x26')]);}_0x2598a6[_0x1258('0x41')]=qs[_0x1258('0x42')](_0x58e7be[_0x1258('0x3b')][_0x1258('0x42')]);_0x2598a6[_0x1258('0x43')]=qs['filters'](_[_0x1258('0x44')](_0x58e7be[_0x1258('0x3b')],_0x4a9642[_0x1258('0x45')]),_0x5d059f);if(_0x58e7be[_0x1258('0x3b')][_0x1258('0x46')]){_0x2598a6[_0x1258('0x43')]=_['merge'](_0x2598a6['where'],{'$or':_[_0x1258('0x36')](_0x5d059f,function(_0x24851a){if(_0x24851a[_0x1258('0x47')]!=='VIRTUAL'){var _0x3e63d3={};_0x3e63d3[_0x24851a['name']]={'$like':'%'+_0x58e7be['query'][_0x1258('0x46')]+'%'};return _0x3e63d3;}})});}_0x2598a6=_[_0x1258('0x48')]({},_0x2598a6,_0x58e7be[_0x1258('0x49')]);var _0x3f8e87={'where':_0x2598a6[_0x1258('0x43')]};return db[_0x1258('0x37')][_0x1258('0x25')](_0x3f8e87)[_0x1258('0x2d')](function(_0x121f55){_0xa93e0b[_0x1258('0x25')]=_0x121f55;if(_0x58e7be[_0x1258('0x3b')][_0x1258('0x4a')]){_0x2598a6[_0x1258('0x4b')]=[{'all':!![]}];}return db[_0x1258('0x37')]['findAll'](_0x2598a6);})[_0x1258('0x2d')](function(_0x2d8111){_0xa93e0b[_0x1258('0x4c')]=_0x2d8111;return _0xa93e0b;})[_0x1258('0x2d')](respondWithFilteredResult(_0x1b46bf,_0x2598a6))[_0x1258('0x4d')](handleError(_0x1b46bf,null));};exports[_0x1258('0x4e')]=function(_0x1d11c5,_0x563484){var _0x237544={'raw':![],'where':{'id':_0x1d11c5[_0x1258('0x4f')]['id']}},_0x318563={};_0x318563[_0x1258('0x3a')]=_[_0x1258('0x3c')](db[_0x1258('0x37')][_0x1258('0x38')]);_0x318563[_0x1258('0x3b')]=_[_0x1258('0x3c')](_0x1d11c5[_0x1258('0x3b')]);_0x318563[_0x1258('0x45')]=_[_0x1258('0x50')](_0x318563[_0x1258('0x3a')],_0x318563[_0x1258('0x3b')]);_0x237544[_0x1258('0x3e')]=_[_0x1258('0x50')](_0x318563[_0x1258('0x3a')],qs[_0x1258('0x3d')](_0x1d11c5[_0x1258('0x3b')]['fields']));_0x237544[_0x1258('0x3e')]=_0x237544[_0x1258('0x3e')]['length']?_0x237544['attributes']:_0x318563[_0x1258('0x3a')];if(_0x1d11c5[_0x1258('0x3b')][_0x1258('0x4a')]){_0x237544['include']=[{'all':!![]}];}_0x237544=_[_0x1258('0x48')]({},_0x237544,_0x1d11c5[_0x1258('0x49')]);return db[_0x1258('0x37')]['find'](_0x237544)[_0x1258('0x2d')](handleEntityNotFound(_0x563484,null))[_0x1258('0x2d')](respondWithResult(_0x563484,null))[_0x1258('0x4d')](handleError(_0x563484,null));};exports[_0x1258('0x2e')]=function(_0x48789e,_0x579662){return db['VoicePrefix'][_0x1258('0x51')]({'where':{'id':_0x48789e[_0x1258('0x4f')]['id']}})['then'](handleEntityNotFound(_0x579662,null))[_0x1258('0x2d')](removeEntity(_0x579662,null))[_0x1258('0x4d')](handleError(_0x579662,null));};exports[_0x1258('0x52')]=function(_0x377152,_0x51e396){return db[_0x1258('0x37')][_0x1258('0x52')]()[_0x1258('0x2d')](respondWithResult(_0x51e396,null))[_0x1258('0x4d')](handleError(_0x51e396,null));};exports['create']=function(_0x404380,_0xb341ba){var _0x29f588;return db[_0x1258('0x53')][_0x1258('0x54')](function(_0x1bd016){return db[_0x1258('0x37')][_0x1258('0x55')](_0x404380['body'],{'transaction':_0x1bd016})['then'](function(_0x3d698b){_0x29f588=_0x3d698b[_0x1258('0x2f')]({'plain':!![]});return db[_0x1258('0x56')][_0x1258('0x51')]({'where':{'id':_0x29f588[_0x1258('0x57')]},'raw':!![]})['then'](function(_0x1ae8fc){return createVoicePrefixExtensions(_0x29f588,_0x1ae8fc,_0x1bd016);});});})[_0x1258('0x2d')](function(){var _0x2adc55=_0x404380['user']['get']({'plain':!![]});if(!_0x2adc55)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2adc55[_0x1258('0x58')]===_0x1258('0x59')){var _0x2de959=_0x29f588;return db[_0x1258('0x5a')][_0x1258('0x51')]({'where':{'name':'VoicePrefixes','userProfileId':_0x2adc55[_0x1258('0x5b')]},'raw':!![]})[_0x1258('0x2d')](function(_0x153d4f){if(_0x153d4f&&_0x153d4f[_0x1258('0x5c')]===0x0){return db[_0x1258('0x31')][_0x1258('0x55')]({'name':_0x2de959[_0x1258('0x34')],'resourceId':_0x2de959['id'],'type':_0x153d4f[_0x1258('0x34')],'sectionId':_0x153d4f['id']},{})[_0x1258('0x2d')](function(){return _0x29f588;});}else{return _0x29f588;}})['catch'](function(_0x10e186){logger[_0x1258('0x32')](_0x1258('0x5d'),_0x10e186);throw _0x10e186;});}return _0x29f588;})['then'](respondWithResult(_0xb341ba,null))[_0x1258('0x4d')](handleError(_0xb341ba,null));};function Extension(_0x25dee8,_0x661202,_0x43dd5b,_0x2744ef){this[_0x1258('0x5e')]=_0x1258('0x5f');this[_0x1258('0x60')]=_0x25dee8;this[_0x1258('0x61')]=_0x43dd5b;this[_0x1258('0x47')]=_0x1258('0x62');this[_0x1258('0x63')]=_0x1258('0x64');this['priority']=_0x661202;this[_0x1258('0x65')]=_0x2744ef;}function createVoicePrefixExtensions(_0xae040,_0x41be7d,_0x31bc30){return new BPromise(function(_0x11aa96,_0x37ac7b){var _0x5553b4=new Extension(formatPrefixName(_0xae040[_0x1258('0x66')]),0x1,_0x1258('0x67'),_0x1258('0x68'));_0x5553b4[_0x1258('0x69')]=_0xae040['id'];return db[_0x1258('0x56')][_0x1258('0x55')](_0x5553b4,{'transaction':_0x31bc30})['then'](function(_0x279eb5){var _0x584d15=_0x279eb5[_0x1258('0x2f')]({'plain':!![]});var _0x2dd4d7=_[_0x1258('0x36')](addVoicePrefixExtensions(_0xae040,_0x41be7d),function(_0x18bdeb){_0x18bdeb[_0x1258('0x57')]=_0x584d15['id'];_0x18bdeb[_0x1258('0x69')]=_0xae040['id'];return _0x18bdeb;});return db[_0x1258('0x56')][_0x1258('0x6a')](_0x2dd4d7,{'transaction':_0x31bc30})[_0x1258('0x2d')](function(_0x201b1f){if(!_0x201b1f){return _0x37ac7b('Extensions\x20creation\x20failed');}else{return _0x11aa96(_0x201b1f);}})[_0x1258('0x4d')](function(_0x38c9eb){return _0x37ac7b(_0x38c9eb);});});;});};function addVoicePrefixExtensions(_0x52f510,_0x146522){var _0x4905db=[];var _0x3fc8a4=formatPrefixName(_0x52f510['prefix']);_0x4905db[_0x1258('0x6b')](new Extension(_0x3fc8a4,0x2,_0x1258('0x6c'),_0x1258('0x6d')+_0x52f510[_0x1258('0x34')]));if(_0x52f510[_0x1258('0x6e')]){_0x4905db[_0x1258('0x6b')](new Extension(_0x3fc8a4,0x3,_0x1258('0x6c'),_0x1258('0x6f')+_0x52f510[_0x1258('0x6e')]));}else{_0x4905db[_0x1258('0x6b')](new Extension(_0x3fc8a4,0x3,_0x1258('0x67'),_0x1258('0x70')));}_0x4905db[_0x1258('0x6b')](new Extension(_0x3fc8a4,0x4,_0x1258('0x71'),_0x146522[_0x1258('0x5e')]+','+_0x1258('0x72')+(0x8+_0x52f510[_0x1258('0x34')][_0x1258('0x3f')])+'}'+','+0x1));return _0x4905db;}function formatPrefixName(_0x48c020){var _0x4b9b26='_';for(var _0x2940f5=0x0;_0x2940f5<_0x48c020[_0x1258('0x3f')];_0x2940f5++){if(_0x48c020[_0x1258('0x73')](_0x2940f5)=='-'){_0x4b9b26+=_0x48c020[_0x1258('0x73')](_0x2940f5);}else{_0x4b9b26+='['+_0x48c020[_0x1258('0x73')](_0x2940f5)+']';}}_0x4b9b26+='.';return _0x4b9b26;}exports[_0x1258('0x2c')]=function(_0x157b8e,_0x2279a1,_0x19ae08){var _0x2455f8=_0x157b8e[_0x1258('0x74')];_0x2455f8[_0x1258('0x66')]='system-'+_0x2455f8[_0x1258('0x34')]+'-';return db['sequelize'][_0x1258('0x54')](function(_0x16ae31){return db[_0x1258('0x37')][_0x1258('0x2c')](_0x2455f8,{'where':{'id':_0x2455f8['id']},'transaction':_0x16ae31})[_0x1258('0x2d')](function(){return db[_0x1258('0x56')][_0x1258('0x2e')]({'where':{'VoicePrefixId':_0x2455f8['id']},'transaction':_0x16ae31})[_0x1258('0x2d')](function(){return db['VoiceExtension'][_0x1258('0x51')]({'where':{'id':_0x2455f8['VoiceExtensionId']},'raw':!![]})[_0x1258('0x2d')](function(_0x1c8347){return createVoicePrefixExtensions(_0x2455f8,_0x1c8347,_0x16ae31);});});});})['then'](function(){return db['VoicePrefix'][_0x1258('0x75')](_0x2455f8['id']);})[_0x1258('0x2d')](respondWithResult(_0x2279a1,null))[_0x1258('0x4d')](handleError(_0x2279a1,null));};exports[_0x1258('0x76')]=function(_0x36619b,_0x3a96d0,_0x25e5f9){return db[_0x1258('0x37')][_0x1258('0x51')]({'where':{'id':_0x36619b[_0x1258('0x4f')]['id']}})[_0x1258('0x2d')](handleEntityNotFound(_0x3a96d0,null))[_0x1258('0x2d')](function(_0x5a13a8){if(_0x5a13a8){return _0x5a13a8[_0x1258('0x76')](_0x36619b[_0x1258('0x74')][_0x1258('0x77')],_[_0x1258('0x78')](_0x36619b[_0x1258('0x74')],[_0x1258('0x77'),'id'])||{})['spread'](function(_0x1214ac){for(var _0x4fa126=0x0;_0x4fa126<_0x36619b[_0x1258('0x74')][_0x1258('0x77')]['length'];_0x4fa126+=0x1){socket[_0x1258('0x79')](_0x1258('0x7a'),{'UserId':_0x36619b[_0x1258('0x74')][_0x1258('0x77')][_0x4fa126],'VoicePrefixId':_0x36619b[_0x1258('0x4f')]['id']});}return _0x1214ac;});}})[_0x1258('0x2d')](respondWithResult(_0x3a96d0,null))['catch'](handleError(_0x3a96d0,null));};exports['removeAgents']=function(_0x1278b1,_0x2b8a48,_0x3eecbb){return db['VoicePrefix'][_0x1258('0x51')]({'where':{'id':_0x1278b1['params']['id']}})[_0x1258('0x2d')](handleEntityNotFound(_0x2b8a48,null))['then'](function(_0xd0fea9){if(_0xd0fea9){return _0xd0fea9[_0x1258('0x7b')](_0x1278b1[_0x1258('0x3b')]['ids'])['then'](function(){if(_[_0x1258('0x7c')](_0x1278b1[_0x1258('0x3b')][_0x1258('0x77')])){for(var _0x5ac9cf=0x0;_0x5ac9cf<_0x1278b1[_0x1258('0x3b')]['ids'][_0x1258('0x3f')];_0x5ac9cf+=0x1){socket[_0x1258('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x1278b1[_0x1258('0x3b')][_0x1258('0x77')][_0x5ac9cf]),'VoicePrefixId':Number(_0x1278b1['params']['id'])});}}else{socket[_0x1258('0x79')](_0x1258('0x7d'),{'UserId':Number(_0x1278b1[_0x1258('0x3b')][_0x1258('0x77')]),'VoicePrefixId':Number(_0x1278b1[_0x1258('0x4f')]['id'])});}});}})[_0x1258('0x2d')](respondWithStatusCode(_0x2b8a48,null))[_0x1258('0x4d')](handleError(_0x2b8a48,null));};exports['getAgents']=function(_0x67c5f8,_0x21b920,_0x452ad0){var _0xc8a3c8={};var _0x1b6316={};var _0x394c2a;var _0x2c044f;return db[_0x1258('0x37')]['findOne']({'where':{'id':_0x67c5f8['params']['id']}})[_0x1258('0x2d')](handleEntityNotFound(_0x21b920,null))[_0x1258('0x2d')](function(_0x419e66){if(_0x419e66){_0x394c2a=_0x419e66;_0x1b6316['model']=_['keys'](db[_0x1258('0x7e')][_0x1258('0x38')]);_0x1b6316['query']=_['keys'](_0x67c5f8['query']);_0x1b6316[_0x1258('0x45')]=_['intersection'](_0x1b6316[_0x1258('0x3a')],_0x1b6316[_0x1258('0x3b')]);_0xc8a3c8[_0x1258('0x3e')]=_[_0x1258('0x50')](_0x1b6316[_0x1258('0x3a')],qs[_0x1258('0x3d')](_0x67c5f8[_0x1258('0x3b')][_0x1258('0x3d')]));_0xc8a3c8[_0x1258('0x3e')]=_0xc8a3c8['attributes'][_0x1258('0x3f')]?_0xc8a3c8[_0x1258('0x3e')]:_0x1b6316[_0x1258('0x3a')];_0xc8a3c8[_0x1258('0x41')]=qs[_0x1258('0x42')](_0x67c5f8['query']['sort']);_0xc8a3c8[_0x1258('0x43')]=qs[_0x1258('0x45')](_[_0x1258('0x44')](_0x67c5f8[_0x1258('0x3b')],_0x1b6316[_0x1258('0x45')]));if(_0x67c5f8['query'][_0x1258('0x46')]){_0xc8a3c8[_0x1258('0x43')]=_['merge'](_0xc8a3c8[_0x1258('0x43')],{'$or':_[_0x1258('0x36')](_0xc8a3c8[_0x1258('0x3e')],function(_0x581231){var _0x5ac5c5={};_0x5ac5c5[_0x581231]={'$like':'%'+_0x67c5f8['query'][_0x1258('0x46')]+'%'};return _0x5ac5c5;})});}_0xc8a3c8=_[_0x1258('0x48')]({},_0xc8a3c8,_0x67c5f8[_0x1258('0x49')]);return _0x394c2a[_0x1258('0x7f')](_0xc8a3c8);}})[_0x1258('0x2d')](function(_0x326ffa){if(_0x326ffa){_0x2c044f=_0x326ffa[_0x1258('0x3f')];if(!_0x67c5f8[_0x1258('0x3b')][_0x1258('0x40')](_0x1258('0x80'))){_0xc8a3c8[_0x1258('0x27')]=qs[_0x1258('0x27')](_0x67c5f8[_0x1258('0x3b')][_0x1258('0x27')]);_0xc8a3c8[_0x1258('0x26')]=qs[_0x1258('0x26')](_0x67c5f8[_0x1258('0x3b')][_0x1258('0x26')]);}return _0x394c2a['getAgents'](_0xc8a3c8);}})[_0x1258('0x2d')](function(_0xf3ede5){if(_0xf3ede5){return _0xf3ede5?{'count':_0x2c044f,'rows':_0xf3ede5}:null;}})[_0x1258('0x2d')](respondWithResult(_0x21b920,null))[_0x1258('0x4d')](handleError(_0x21b920,null));}; \ No newline at end of file +var _0x4744=['context','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','pick','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','error','stack','name','index','map','VoicePrefix','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','destroy','find','describe','create','sequelize','transaction','body','VoiceExtensionId','user','role','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto'];(function(_0x518f71,_0x1b7085){var _0x4de80a=function(_0x5910b4){while(--_0x5910b4){_0x518f71['push'](_0x518f71['shift']());}};_0x4de80a(++_0x1b7085);}(_0x4744,0x107));var _0x4474=function(_0x2643df,_0x29047a){_0x2643df=_0x2643df-0x0;var _0x5ae98e=_0x4744[_0x2643df];return _0x5ae98e;};'use strict';var pdf=require(_0x4474('0x0'));var emlformat=require(_0x4474('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4474('0x2'));var jsonpatch=require(_0x4474('0x3'));var rp=require(_0x4474('0x4'));var moment=require(_0x4474('0x5'));var BPromise=require(_0x4474('0x6'));var Mustache=require(_0x4474('0x7'));var util=require(_0x4474('0x8'));var path=require(_0x4474('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4474('0xa'));var fs=require('fs');var _=require(_0x4474('0xb'));var squel=require(_0x4474('0xc'));var crypto=require(_0x4474('0xd'));var jsforce=require(_0x4474('0xe'));var deskjs=require(_0x4474('0xf'));var toCsv=require(_0x4474('0x10'));var querystring=require('querystring');var Papa=require(_0x4474('0x11'));var Redis=require(_0x4474('0x12'));var authService=require(_0x4474('0x13'));var qs=require(_0x4474('0x14'));var as=require(_0x4474('0x15'));var hardwareService=require(_0x4474('0x16'));var logger=require(_0x4474('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4474('0x18'))['db'];config[_0x4474('0x19')]=_['defaults'](config[_0x4474('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x4474('0x1a'))(new Redis(config[_0x4474('0x19')]));require(_0x4474('0x1b'))[_0x4474('0x1c')](socket);function respondWithStatusCode(_0x248c99,_0xccfdbd){_0xccfdbd=_0xccfdbd||0xcc;return function(_0x55d71b){if(_0x55d71b){return _0x248c99[_0x4474('0x1d')](_0xccfdbd);}return _0x248c99[_0x4474('0x1e')](_0xccfdbd)['end']();};}function respondWithResult(_0x1cbdb6,_0x490a59){_0x490a59=_0x490a59||0xc8;return function(_0x488fcd){if(_0x488fcd){return _0x1cbdb6[_0x4474('0x1e')](_0x490a59)[_0x4474('0x1f')](_0x488fcd);}};}function respondWithFilteredResult(_0x4b2783,_0xb18e3c){return function(_0x356a37){if(_0x356a37){var _0x1dc845=_0x356a37['count'],_0x22ed33=_0xb18e3c[_0x4474('0x20')],_0x21debd=_0xb18e3c['offset']+_0xb18e3c[_0x4474('0x21')],_0x249ae0;if(_0x21debd>=_0x1dc845){_0x21debd=_0x1dc845;_0x249ae0=0xc8;}else{_0x249ae0=0xce;}_0x4b2783[_0x4474('0x1e')](_0x249ae0);return _0x4b2783[_0x4474('0x22')](_0x4474('0x23'),_0x22ed33+'-'+_0x21debd+'/'+_0x1dc845)['json'](_0x356a37);}return null;};}function patchUpdates(_0x596aa9){return function(_0x24ae2e){try{jsonpatch[_0x4474('0x24')](_0x24ae2e,_0x596aa9,!![]);}catch(_0x4a5be8){return BPromise[_0x4474('0x25')](_0x4a5be8);}return _0x24ae2e[_0x4474('0x26')]();};}function saveUpdates(_0xaaa01a,_0x3d3ea5){return function(_0x2ffca1){if(_0x2ffca1){return _0x2ffca1[_0x4474('0x27')](_0xaaa01a)[_0x4474('0x28')](function(_0x3009d8){return _0x3009d8;});}return null;};}function removeEntity(_0x2f67c0,_0x10b2d2){return function(_0x37d761){if(_0x37d761){return _0x37d761['destroy']()[_0x4474('0x28')](function(){var _0xd34139=_0x37d761[_0x4474('0x29')]({'plain':!![]});var _0x5881a2='VoicePrefixes';return db['UserProfileResource']['destroy']({'where':{'type':_0x5881a2,'resourceId':_0xd34139['id']}})['then'](function(){return _0x37d761;});})[_0x4474('0x28')](function(){_0x2f67c0[_0x4474('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37e58d,_0x352982){return function(_0x21e51c){if(!_0x21e51c){_0x37e58d[_0x4474('0x1d')](0x194);}return _0x21e51c;};}function handleError(_0xae958b,_0x33d4ad){_0x33d4ad=_0x33d4ad||0x1f4;return function(_0x238f8c){logger[_0x4474('0x2a')](_0x238f8c[_0x4474('0x2b')]);if(_0x238f8c[_0x4474('0x2c')]){delete _0x238f8c[_0x4474('0x2c')];}_0xae958b[_0x4474('0x1e')](_0x33d4ad)['send'](_0x238f8c);};}exports[_0x4474('0x2d')]=function(_0x19f048,_0x283963){var _0x49b381={},_0xc1b736={},_0x1fcd62={'count':0x0,'rows':[]};var _0x53757f=_[_0x4474('0x2e')](db[_0x4474('0x2f')][_0x4474('0x30')],function(_0x3f0871){return{'name':_0x3f0871['fieldName'],'type':_0x3f0871[_0x4474('0x31')]['key']};});_0xc1b736[_0x4474('0x32')]=_[_0x4474('0x2e')](_0x53757f,'name');_0xc1b736['query']=_['keys'](_0x19f048[_0x4474('0x33')]);_0xc1b736[_0x4474('0x34')]=_[_0x4474('0x35')](_0xc1b736[_0x4474('0x32')],_0xc1b736[_0x4474('0x33')]);_0x49b381[_0x4474('0x36')]=_[_0x4474('0x35')](_0xc1b736[_0x4474('0x32')],qs[_0x4474('0x37')](_0x19f048['query']['fields']));_0x49b381['attributes']=_0x49b381[_0x4474('0x36')][_0x4474('0x38')]?_0x49b381[_0x4474('0x36')]:_0xc1b736[_0x4474('0x32')];if(!_0x19f048[_0x4474('0x33')][_0x4474('0x39')](_0x4474('0x3a'))){_0x49b381[_0x4474('0x21')]=qs['limit'](_0x19f048['query'][_0x4474('0x21')]);_0x49b381[_0x4474('0x20')]=qs['offset'](_0x19f048[_0x4474('0x33')]['offset']);}_0x49b381[_0x4474('0x3b')]=qs['sort'](_0x19f048[_0x4474('0x33')][_0x4474('0x3c')]);_0x49b381[_0x4474('0x3d')]=qs[_0x4474('0x34')](_['pick'](_0x19f048['query'],_0xc1b736[_0x4474('0x34')]),_0x53757f);if(_0x19f048[_0x4474('0x33')][_0x4474('0x3e')]){_0x49b381[_0x4474('0x3d')]=_[_0x4474('0x3f')](_0x49b381[_0x4474('0x3d')],{'$or':_[_0x4474('0x2e')](_0x53757f,function(_0x49e1ed){if(_0x49e1ed[_0x4474('0x31')]!==_0x4474('0x40')){var _0x46b9bf={};_0x46b9bf[_0x49e1ed['name']]={'$like':'%'+_0x19f048[_0x4474('0x33')][_0x4474('0x3e')]+'%'};return _0x46b9bf;}})});}_0x49b381=_[_0x4474('0x3f')]({},_0x49b381,_0x19f048[_0x4474('0x41')]);var _0x3d7359={'where':_0x49b381[_0x4474('0x3d')]};return db[_0x4474('0x2f')][_0x4474('0x42')](_0x3d7359)[_0x4474('0x28')](function(_0xb2e355){_0x1fcd62[_0x4474('0x42')]=_0xb2e355;if(_0x19f048['query'][_0x4474('0x43')]){_0x49b381[_0x4474('0x44')]=[{'all':!![]}];}return db['VoicePrefix'][_0x4474('0x45')](_0x49b381);})['then'](function(_0x2c16d0){_0x1fcd62[_0x4474('0x46')]=_0x2c16d0;return _0x1fcd62;})['then'](respondWithFilteredResult(_0x283963,_0x49b381))[_0x4474('0x47')](handleError(_0x283963,null));};exports[_0x4474('0x48')]=function(_0x5a52b5,_0x48be55){var _0x177b2c={'raw':![],'where':{'id':_0x5a52b5[_0x4474('0x49')]['id']}},_0xd8b08f={};_0xd8b08f['model']=_[_0x4474('0x4a')](db['VoicePrefix'][_0x4474('0x30')]);_0xd8b08f[_0x4474('0x33')]=_['keys'](_0x5a52b5[_0x4474('0x33')]);_0xd8b08f[_0x4474('0x34')]=_['intersection'](_0xd8b08f[_0x4474('0x32')],_0xd8b08f[_0x4474('0x33')]);_0x177b2c[_0x4474('0x36')]=_['intersection'](_0xd8b08f[_0x4474('0x32')],qs[_0x4474('0x37')](_0x5a52b5[_0x4474('0x33')][_0x4474('0x37')]));_0x177b2c[_0x4474('0x36')]=_0x177b2c[_0x4474('0x36')][_0x4474('0x38')]?_0x177b2c['attributes']:_0xd8b08f['model'];if(_0x5a52b5[_0x4474('0x33')]['includeAll']){_0x177b2c['include']=[{'all':!![]}];}_0x177b2c=_[_0x4474('0x3f')]({},_0x177b2c,_0x5a52b5[_0x4474('0x41')]);return db[_0x4474('0x2f')]['find'](_0x177b2c)[_0x4474('0x28')](handleEntityNotFound(_0x48be55,null))[_0x4474('0x28')](respondWithResult(_0x48be55,null))['catch'](handleError(_0x48be55,null));};exports[_0x4474('0x4b')]=function(_0x3c166a,_0x34a7ee){return db[_0x4474('0x2f')][_0x4474('0x4c')]({'where':{'id':_0x3c166a[_0x4474('0x49')]['id']}})[_0x4474('0x28')](handleEntityNotFound(_0x34a7ee,null))[_0x4474('0x28')](removeEntity(_0x34a7ee,null))[_0x4474('0x47')](handleError(_0x34a7ee,null));};exports[_0x4474('0x4d')]=function(_0x403f97,_0x1f8f7e){return db[_0x4474('0x2f')][_0x4474('0x4d')]()[_0x4474('0x28')](respondWithResult(_0x1f8f7e,null))['catch'](handleError(_0x1f8f7e,null));};exports[_0x4474('0x4e')]=function(_0x3a3a3d,_0x2df076){var _0x434615;return db[_0x4474('0x4f')][_0x4474('0x50')](function(_0x21b6a4){return db[_0x4474('0x2f')]['create'](_0x3a3a3d[_0x4474('0x51')],{'transaction':_0x21b6a4})[_0x4474('0x28')](function(_0x4d4ca0){_0x434615=_0x4d4ca0[_0x4474('0x29')]({'plain':!![]});return db['VoiceExtension'][_0x4474('0x4c')]({'where':{'id':_0x434615[_0x4474('0x52')]},'raw':!![]})['then'](function(_0x59686c){return createVoicePrefixExtensions(_0x434615,_0x59686c,_0x21b6a4);});});})[_0x4474('0x28')](function(){var _0x3aecf2=_0x3a3a3d[_0x4474('0x53')]['get']({'plain':!![]});if(!_0x3aecf2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3aecf2[_0x4474('0x54')]==='user'){var _0x375cf9=_0x434615;return db['UserProfileSection']['find']({'where':{'name':_0x4474('0x55'),'userProfileId':_0x3aecf2[_0x4474('0x56')]},'raw':!![]})[_0x4474('0x28')](function(_0xe13b93){if(_0xe13b93&&_0xe13b93[_0x4474('0x57')]===0x0){return db['UserProfileResource'][_0x4474('0x4e')]({'name':_0x375cf9[_0x4474('0x2c')],'resourceId':_0x375cf9['id'],'type':_0xe13b93[_0x4474('0x2c')],'sectionId':_0xe13b93['id']},{})[_0x4474('0x28')](function(){return _0x434615;});}else{return _0x434615;}})['catch'](function(_0x9abffa){logger[_0x4474('0x2a')](_0x4474('0x58'),_0x9abffa);throw _0x9abffa;});}return _0x434615;})[_0x4474('0x28')](respondWithResult(_0x2df076,null))[_0x4474('0x47')](handleError(_0x2df076,null));};function Extension(_0x47fa82,_0x28a03c,_0x56c860,_0x1d597b){this['context']=_0x4474('0x59');this['exten']=_0x47fa82;this[_0x4474('0x5a')]=_0x56c860;this[_0x4474('0x31')]=_0x4474('0x5b');this['description']=_0x4474('0x5c');this[_0x4474('0x5d')]=_0x28a03c;this[_0x4474('0x5e')]=_0x1d597b;}function createVoicePrefixExtensions(_0x22b009,_0x19d96b,_0x46abfb){return new BPromise(function(_0x51c9cb,_0x434aca){var _0x14821b=new Extension(formatPrefixName(_0x22b009[_0x4474('0x5f')]),0x1,_0x4474('0x60'),_0x4474('0x61'));_0x14821b[_0x4474('0x62')]=_0x22b009['id'];return db[_0x4474('0x63')][_0x4474('0x4e')](_0x14821b,{'transaction':_0x46abfb})[_0x4474('0x28')](function(_0x1efa9f){var _0x2b98e5=_0x1efa9f['get']({'plain':!![]});var _0x5428cd=_[_0x4474('0x2e')](addVoicePrefixExtensions(_0x22b009,_0x19d96b),function(_0x114e7f){_0x114e7f['VoiceExtensionId']=_0x2b98e5['id'];_0x114e7f[_0x4474('0x62')]=_0x22b009['id'];return _0x114e7f;});return db[_0x4474('0x63')]['bulkCreate'](_0x5428cd,{'transaction':_0x46abfb})[_0x4474('0x28')](function(_0x4be538){if(!_0x4be538){return _0x434aca('Extensions\x20creation\x20failed');}else{return _0x51c9cb(_0x4be538);}})[_0x4474('0x47')](function(_0x331de4){return _0x434aca(_0x331de4);});});;});};function addVoicePrefixExtensions(_0x4a33b7,_0x59e12d){var _0x1d7e0e=[];var _0x26fe38=formatPrefixName(_0x4a33b7['prefix']);_0x1d7e0e[_0x4474('0x64')](new Extension(_0x26fe38,0x2,_0x4474('0x65'),_0x4474('0x66')+_0x4a33b7[_0x4474('0x2c')]));if(_0x4a33b7['callerIdAll']){_0x1d7e0e[_0x4474('0x64')](new Extension(_0x26fe38,0x3,_0x4474('0x65'),_0x4474('0x67')+_0x4a33b7['callerIdAll']));}else{_0x1d7e0e[_0x4474('0x64')](new Extension(_0x26fe38,0x3,_0x4474('0x60'),_0x4474('0x68')));}_0x1d7e0e[_0x4474('0x64')](new Extension(_0x26fe38,0x4,_0x4474('0x69'),_0x59e12d[_0x4474('0x6a')]+','+_0x4474('0x6b')+(0x8+_0x4a33b7['name'][_0x4474('0x38')])+'}'+','+0x1));return _0x1d7e0e;}function formatPrefixName(_0x2d2d6f){var _0x1ac501='_';for(var _0x380151=0x0;_0x380151<_0x2d2d6f['length'];_0x380151++){if(_0x2d2d6f[_0x4474('0x6c')](_0x380151)=='-'){_0x1ac501+=_0x2d2d6f[_0x4474('0x6c')](_0x380151);}else{_0x1ac501+='['+_0x2d2d6f[_0x4474('0x6c')](_0x380151)+']';}}_0x1ac501+='.';return _0x1ac501;}exports[_0x4474('0x27')]=function(_0x8495d4,_0x9a4ad9,_0x553492){var _0x56b23b=_0x8495d4[_0x4474('0x51')];_0x56b23b[_0x4474('0x5f')]=_0x4474('0x6d')+_0x56b23b[_0x4474('0x2c')]+'-';return db['sequelize'][_0x4474('0x50')](function(_0x161686){return db[_0x4474('0x2f')][_0x4474('0x27')](_0x56b23b,{'where':{'id':_0x56b23b['id']},'transaction':_0x161686})['then'](function(){return db[_0x4474('0x63')]['destroy']({'where':{'VoicePrefixId':_0x56b23b['id']},'transaction':_0x161686})[_0x4474('0x28')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x56b23b[_0x4474('0x52')]},'raw':!![]})[_0x4474('0x28')](function(_0x19ee76){return createVoicePrefixExtensions(_0x56b23b,_0x19ee76,_0x161686);});});});})[_0x4474('0x28')](function(){return db[_0x4474('0x2f')][_0x4474('0x6e')](_0x56b23b['id']);})[_0x4474('0x28')](respondWithResult(_0x9a4ad9,null))[_0x4474('0x47')](handleError(_0x9a4ad9,null));};exports[_0x4474('0x6f')]=function(_0x487efa,_0xf315e2,_0x504e28){return db[_0x4474('0x2f')][_0x4474('0x4c')]({'where':{'id':_0x487efa[_0x4474('0x49')]['id']}})[_0x4474('0x28')](handleEntityNotFound(_0xf315e2,null))[_0x4474('0x28')](function(_0x2b27ad){if(_0x2b27ad){return _0x2b27ad[_0x4474('0x6f')](_0x487efa[_0x4474('0x51')][_0x4474('0x70')],_[_0x4474('0x71')](_0x487efa['body'],[_0x4474('0x70'),'id'])||{})[_0x4474('0x72')](function(_0x536912){for(var _0x5bec48=0x0;_0x5bec48<_0x487efa[_0x4474('0x51')][_0x4474('0x70')][_0x4474('0x38')];_0x5bec48+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x487efa[_0x4474('0x51')][_0x4474('0x70')][_0x5bec48],'VoicePrefixId':_0x487efa[_0x4474('0x49')]['id']});}return _0x536912;});}})['then'](respondWithResult(_0xf315e2,null))['catch'](handleError(_0xf315e2,null));};exports[_0x4474('0x73')]=function(_0x17f14e,_0x487eb8,_0x31c01a){return db[_0x4474('0x2f')][_0x4474('0x4c')]({'where':{'id':_0x17f14e[_0x4474('0x49')]['id']}})[_0x4474('0x28')](handleEntityNotFound(_0x487eb8,null))['then'](function(_0x49dd5e){if(_0x49dd5e){return _0x49dd5e[_0x4474('0x73')](_0x17f14e[_0x4474('0x33')][_0x4474('0x70')])[_0x4474('0x28')](function(){if(_[_0x4474('0x74')](_0x17f14e[_0x4474('0x33')][_0x4474('0x70')])){for(var _0x48c385=0x0;_0x48c385<_0x17f14e[_0x4474('0x33')][_0x4474('0x70')]['length'];_0x48c385+=0x1){socket[_0x4474('0x75')](_0x4474('0x76'),{'UserId':Number(_0x17f14e[_0x4474('0x33')]['ids'][_0x48c385]),'VoicePrefixId':Number(_0x17f14e[_0x4474('0x49')]['id'])});}}else{socket[_0x4474('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x17f14e[_0x4474('0x33')][_0x4474('0x70')]),'VoicePrefixId':Number(_0x17f14e[_0x4474('0x49')]['id'])});}});}})[_0x4474('0x28')](respondWithStatusCode(_0x487eb8,null))['catch'](handleError(_0x487eb8,null));};exports[_0x4474('0x77')]=function(_0x4711c6,_0x4e3700,_0x2021c6){var _0x3deb26={};var _0x4fbc88={};var _0x174383;var _0x5bbf2e;return db[_0x4474('0x2f')][_0x4474('0x78')]({'where':{'id':_0x4711c6['params']['id']}})['then'](handleEntityNotFound(_0x4e3700,null))['then'](function(_0x4d314f){if(_0x4d314f){_0x174383=_0x4d314f;_0x4fbc88[_0x4474('0x32')]=_[_0x4474('0x4a')](db[_0x4474('0x79')][_0x4474('0x30')]);_0x4fbc88[_0x4474('0x33')]=_[_0x4474('0x4a')](_0x4711c6[_0x4474('0x33')]);_0x4fbc88[_0x4474('0x34')]=_[_0x4474('0x35')](_0x4fbc88[_0x4474('0x32')],_0x4fbc88['query']);_0x3deb26[_0x4474('0x36')]=_[_0x4474('0x35')](_0x4fbc88[_0x4474('0x32')],qs[_0x4474('0x37')](_0x4711c6[_0x4474('0x33')][_0x4474('0x37')]));_0x3deb26['attributes']=_0x3deb26['attributes'][_0x4474('0x38')]?_0x3deb26[_0x4474('0x36')]:_0x4fbc88[_0x4474('0x32')];_0x3deb26[_0x4474('0x3b')]=qs['sort'](_0x4711c6[_0x4474('0x33')]['sort']);_0x3deb26[_0x4474('0x3d')]=qs[_0x4474('0x34')](_[_0x4474('0x7a')](_0x4711c6[_0x4474('0x33')],_0x4fbc88[_0x4474('0x34')]));if(_0x4711c6[_0x4474('0x33')][_0x4474('0x3e')]){_0x3deb26[_0x4474('0x3d')]=_[_0x4474('0x3f')](_0x3deb26[_0x4474('0x3d')],{'$or':_[_0x4474('0x2e')](_0x3deb26[_0x4474('0x36')],function(_0x441c0a){var _0x5ef428={};_0x5ef428[_0x441c0a]={'$like':'%'+_0x4711c6[_0x4474('0x33')][_0x4474('0x3e')]+'%'};return _0x5ef428;})});}_0x3deb26=_[_0x4474('0x3f')]({},_0x3deb26,_0x4711c6[_0x4474('0x41')]);return _0x174383[_0x4474('0x77')](_0x3deb26);}})['then'](function(_0x1c5074){if(_0x1c5074){_0x5bbf2e=_0x1c5074[_0x4474('0x38')];if(!_0x4711c6[_0x4474('0x33')][_0x4474('0x39')]('nolimit')){_0x3deb26[_0x4474('0x21')]=qs[_0x4474('0x21')](_0x4711c6[_0x4474('0x33')]['limit']);_0x3deb26[_0x4474('0x20')]=qs['offset'](_0x4711c6[_0x4474('0x33')][_0x4474('0x20')]);}return _0x174383[_0x4474('0x77')](_0x3deb26);}})[_0x4474('0x28')](function(_0x5447e0){if(_0x5447e0){return _0x5447e0?{'count':_0x5bbf2e,'rows':_0x5447e0}:null;}})['then'](respondWithResult(_0x4e3700,null))['catch'](handleError(_0x4e3700,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 727160e..c1e2aae 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 _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xedd9,0xfc));var _0x9edd=function(_0x102511,_0x3a3278){_0x102511=_0x102511-0x0;var _0x545f78=_0xedd9[_0x102511];return _0x545f78;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xedd9,0xfc));var _0x9edd=function(_0x346942,_0x3912bd){_0x346942=_0x346942-0x0;var _0x2c026c=_0xedd9[_0x346942];return _0x2c026c;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 3f7d50b..95b14fb 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 _0xa0e7=['VoicePrefix','voice_prefixes','lodash','moment','bluebird','path','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0xe39824,_0xbdf61f){var _0x4bc31e=function(_0x594760){while(--_0x594760){_0xe39824['push'](_0xe39824['shift']());}};_0x4bc31e(++_0xbdf61f);}(_0xa0e7,0x17e));var _0x7a0e=function(_0xcbde29,_0x56c414){_0xcbde29=_0xcbde29-0x0;var _0x5887b4=_0xa0e7[_0xcbde29];return _0x5887b4;};'use strict';var _=require(_0x7a0e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7a0e('0x1'));var BPromise=require(_0x7a0e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a0e('0x3'));var rimraf=require('rimraf');var config=require(_0x7a0e('0x4'));var attributes=require(_0x7a0e('0x5'));module[_0x7a0e('0x6')]=function(_0x3b5270,_0x293c17){return _0x3b5270[_0x7a0e('0x7')](_0x7a0e('0x8'),attributes,{'tableName':_0x7a0e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb3=['bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes','lodash','../../config/logger','api','moment'];(function(_0x10746d,_0x706dc9){var _0x1e8902=function(_0x33f964){while(--_0x33f964){_0x10746d['push'](_0x10746d['shift']());}};_0x1e8902(++_0x706dc9);}(_0x1cb3,0x170));var _0x31cb=function(_0xa05426,_0x21d5b9){_0xa05426=_0xa05426-0x0;var _0x35e958=_0x1cb3[_0xa05426];return _0x35e958;};'use strict';var _=require(_0x31cb('0x0'));var util=require('util');var logger=require(_0x31cb('0x1'))(_0x31cb('0x2'));var moment=require(_0x31cb('0x3'));var BPromise=require(_0x31cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31cb('0x5'));var rimraf=require(_0x31cb('0x6'));var config=require(_0x31cb('0x7'));var attributes=require(_0x31cb('0x8'));module[_0x31cb('0x9')]=function(_0x5e7560,_0x216c2e){return _0x5e7560[_0x31cb('0xa')]('VoicePrefix',attributes,{'tableName':_0x31cb('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 18d4fa2..21bcbce 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 _0xcde7=['stringify','error','code','message','result','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x4f2e8c,_0x41bf27){var _0x47219f=function(_0x5a8cd7){while(--_0x5a8cd7){_0x4f2e8c['push'](_0x4f2e8c['shift']());}};_0x47219f(++_0x41bf27);}(_0xcde7,0x65));var _0x7cde=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xcde7[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7cde('0x0'));var BPromise=require(_0x7cde('0x1'));var rs=require(_0x7cde('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7cde('0x3'));var logger=require('../../config/logger')(_0x7cde('0x4'));var config=require(_0x7cde('0x5'));var jayson=require(_0x7cde('0x6'));var client=jayson[_0x7cde('0x7')][_0x7cde('0x8')]({'port':0x232a});config[_0x7cde('0x9')]=_['defaults'](config[_0x7cde('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7cde('0xa'))(new Redis(config[_0x7cde('0x9')]));require(_0x7cde('0xb'))[_0x7cde('0xc')](socket);function respondWithRpcPromise(_0x4e7b87,_0x1cc16f,_0x5e590a){return new BPromise(function(_0x15ed09,_0x13d4f6){return client[_0x7cde('0xd')](_0x4e7b87,_0x5e590a)[_0x7cde('0xe')](function(_0x174446){logger[_0x7cde('0xf')](_0x7cde('0x10'),_0x1cc16f,_0x7cde('0x11'));logger['debug'](_0x7cde('0x12'),_0x1cc16f,_0x7cde('0x11'),JSON[_0x7cde('0x13')](_0x174446));if(_0x174446[_0x7cde('0x14')]){if(_0x174446[_0x7cde('0x14')][_0x7cde('0x15')]===0x1f4){logger[_0x7cde('0x14')](_0x7cde('0x10'),_0x1cc16f,_0x174446[_0x7cde('0x14')]['message']);return _0x13d4f6(_0x174446[_0x7cde('0x14')][_0x7cde('0x16')]);}logger[_0x7cde('0x14')](_0x7cde('0x10'),_0x1cc16f,_0x174446[_0x7cde('0x14')][_0x7cde('0x16')]);return _0x15ed09(_0x174446[_0x7cde('0x14')][_0x7cde('0x16')]);}else{logger[_0x7cde('0xf')](_0x7cde('0x10'),_0x1cc16f,_0x7cde('0x11'));_0x15ed09(_0x174446[_0x7cde('0x17')][_0x7cde('0x16')]);}})['catch'](function(_0x1199f5){logger[_0x7cde('0x14')](_0x7cde('0x10'),_0x1cc16f,_0x1199f5);_0x13d4f6(_0x1199f5);});});} \ No newline at end of file +var _0x4ee5=['defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','info','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b140a,_0x5dbd61){var _0x165142=function(_0x44feb5){while(--_0x44feb5){_0x5b140a['push'](_0x5b140a['shift']());}};_0x165142(++_0x5dbd61);}(_0x4ee5,0xd4));var _0x54ee=function(_0x3ff572,_0x29b34a){_0x3ff572=_0x3ff572-0x0;var _0x124a96=_0x4ee5[_0x3ff572];return _0x124a96;};'use strict';var _=require(_0x54ee('0x0'));var util=require('util');var moment=require(_0x54ee('0x1'));var BPromise=require(_0x54ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54ee('0x3'));var db=require(_0x54ee('0x4'))['db'];var utils=require(_0x54ee('0x5'));var logger=require(_0x54ee('0x6'))(_0x54ee('0x7'));var config=require(_0x54ee('0x8'));var jayson=require(_0x54ee('0x9'));var client=jayson[_0x54ee('0xa')][_0x54ee('0xb')]({'port':0x232a});config['redis']=_[_0x54ee('0xc')](config[_0x54ee('0xd')],{'host':_0x54ee('0xe'),'port':0x18eb});var socket=require(_0x54ee('0xf'))(new Redis(config[_0x54ee('0xd')]));require(_0x54ee('0x10'))[_0x54ee('0x11')](socket);function respondWithRpcPromise(_0x412ef1,_0x3baaa0,_0x1aac31){return new BPromise(function(_0x165e99,_0x58dd47){return client['request'](_0x412ef1,_0x1aac31)['then'](function(_0x123576){logger[_0x54ee('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x3baaa0,'request\x20sent');logger['debug'](_0x54ee('0x13'),_0x3baaa0,'request\x20sent',JSON[_0x54ee('0x14')](_0x123576));if(_0x123576['error']){if(_0x123576[_0x54ee('0x15')][_0x54ee('0x16')]===0x1f4){logger['error'](_0x54ee('0x17'),_0x3baaa0,_0x123576[_0x54ee('0x15')][_0x54ee('0x18')]);return _0x58dd47(_0x123576['error'][_0x54ee('0x18')]);}logger[_0x54ee('0x15')](_0x54ee('0x17'),_0x3baaa0,_0x123576['error'][_0x54ee('0x18')]);return _0x165e99(_0x123576['error']['message']);}else{logger[_0x54ee('0x12')](_0x54ee('0x17'),_0x3baaa0,_0x54ee('0x19'));_0x165e99(_0x123576[_0x54ee('0x1a')][_0x54ee('0x18')]);}})[_0x54ee('0x1b')](function(_0x17efec){logger['error'](_0x54ee('0x17'),_0x3baaa0,_0x17efec);_0x58dd47(_0x17efec);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 34ce5d3..3757b8c 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 _0x49c5=['removeListener','length','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x152c94,_0x1b9c39){var _0x4c46e8=function(_0xc758f1){while(--_0xc758f1){_0x152c94['push'](_0x152c94['shift']());}};_0x4c46e8(++_0x1b9c39);}(_0x49c5,0xd5));var _0x549c=function(_0x5cfeeb,_0x2af3c4){_0x5cfeeb=_0x5cfeeb-0x0;var _0x43fd28=_0x49c5[_0x5cfeeb];return _0x43fd28;};'use strict';var VoicePrefixEvents=require(_0x549c('0x0'));var events=[_0x549c('0x1'),_0x549c('0x2'),_0x549c('0x3')];function createListener(_0x299395,_0x2434b7){return function(_0x3c6a77){_0x2434b7['emit'](_0x299395,_0x3c6a77);};}function removeListener(_0x3de067,_0x260a45){return function(){VoicePrefixEvents[_0x549c('0x4')](_0x3de067,_0x260a45);};}exports['register']=function(_0x46ada7){for(var _0x14671e=0x0,_0x258430=events[_0x549c('0x5')];_0x14671e<_0x258430;_0x14671e++){var _0x1b1a9b=events[_0x14671e];var _0x4392b8=createListener(_0x549c('0x6')+_0x1b1a9b,_0x46ada7);VoicePrefixEvents['on'](_0x1b1a9b,_0x4392b8);}}; \ No newline at end of file +var _0xdffc=['register','length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xdffc,0xa5));var _0xcdff=function(_0x21e18c,_0x59cfd3){_0x21e18c=_0x21e18c-0x0;var _0x3b095e=_0xdffc[_0x21e18c];return _0x3b095e;};'use strict';var VoicePrefixEvents=require(_0xcdff('0x0'));var events=[_0xcdff('0x1'),_0xcdff('0x2'),_0xcdff('0x3')];function createListener(_0x14d5ed,_0x335fbc){return function(_0x11a358){_0x335fbc[_0xcdff('0x4')](_0x14d5ed,_0x11a358);};}function removeListener(_0x91721c,_0x3468d8){return function(){VoicePrefixEvents[_0xcdff('0x5')](_0x91721c,_0x3468d8);};}exports[_0xcdff('0x6')]=function(_0x37e6c8){for(var _0x26bee1=0x0,_0x515fdd=events[_0xcdff('0x7')];_0x26bee1<_0x515fdd;_0x26bee1++){var _0x39cd3f=events[_0x26bee1];var _0x507d9a=createListener(_0xcdff('0x8')+_0x39cd3f,_0x37e6c8);VoicePrefixEvents['on'](_0x39cd3f,_0x507d9a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index df973d7..26e8ec5 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 _0xd30c=['destroy','delete','removeTeams','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./voiceQueue.controller','get','isAuthenticated','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/lists','/:id/blacklists','getBlackLists','create','post','/:id/clone','addLists','addBlackLists','put','update'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xd30c,0x1cd));var _0xcd30=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xd30c[_0x45783c];return _0x1161da;};'use strict';var multer=require(_0xcd30('0x0'));var util=require('util');var path=require(_0xcd30('0x1'));var timeout=require(_0xcd30('0x2'));var express=require(_0xcd30('0x3'));var router=express[_0xcd30('0x4')]();var auth=require(_0xcd30('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcd30('0x6'));router[_0xcd30('0x7')]('/',auth[_0xcd30('0x8')](),controller['index']);router['get'](_0xcd30('0x9'),auth[_0xcd30('0x8')](),controller['show']);router[_0xcd30('0x7')](_0xcd30('0xa'),auth[_0xcd30('0x8')](),controller['getHoppers']);router[_0xcd30('0x7')](_0xcd30('0xb'),auth[_0xcd30('0x8')](),controller[_0xcd30('0xc')]);router[_0xcd30('0x7')](_0xcd30('0xd'),auth[_0xcd30('0x8')](),controller['getHopperFinals']);router[_0xcd30('0x7')]('/:id/hopper_black',auth[_0xcd30('0x8')](),controller[_0xcd30('0xe')]);router[_0xcd30('0x7')](_0xcd30('0xf'),auth[_0xcd30('0x8')](),controller[_0xcd30('0x10')]);router[_0xcd30('0x7')](_0xcd30('0x11'),auth[_0xcd30('0x8')](),controller[_0xcd30('0x12')]);router['get']('/:id/members',auth[_0xcd30('0x8')](),controller['getMembers']);router[_0xcd30('0x7')](_0xcd30('0x13'),auth[_0xcd30('0x8')](),controller['getLists']);router[_0xcd30('0x7')](_0xcd30('0x14'),auth[_0xcd30('0x8')](),controller[_0xcd30('0x15')]);router['post']('/',auth[_0xcd30('0x8')](),controller[_0xcd30('0x16')]);router[_0xcd30('0x17')](_0xcd30('0x18'),auth[_0xcd30('0x8')](),controller['clone']);router['post']('/:id/teams',auth[_0xcd30('0x8')](),controller['addTeams']);router[_0xcd30('0x17')](_0xcd30('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0xcd30('0x17')](_0xcd30('0x13'),auth[_0xcd30('0x8')](),controller[_0xcd30('0x19')]);router['post'](_0xcd30('0x14'),auth[_0xcd30('0x8')](),controller[_0xcd30('0x1a')]);router[_0xcd30('0x1b')](_0xcd30('0x9'),auth['isAuthenticated'](),controller[_0xcd30('0x1c')]);router['delete']('/:id',auth[_0xcd30('0x8')](),controller[_0xcd30('0x1d')]);router[_0xcd30('0x1e')](_0xcd30('0xf'),auth[_0xcd30('0x8')](),controller[_0xcd30('0x1f')]);router['delete'](_0xcd30('0x11'),auth[_0xcd30('0x8')](),controller['removeAgents']);router[_0xcd30('0x1e')](_0xcd30('0x13'),auth['isAuthenticated'](),controller[_0xcd30('0x20')]);router[_0xcd30('0x1e')]('/:id/blacklists',auth[_0xcd30('0x8')](),controller[_0xcd30('0x21')]);module[_0xcd30('0x22')]=router; \ No newline at end of file +var _0x2b0a=['getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/teams','addTeams','addLists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories'];(function(_0x590a25,_0x2bb1ae){var _0x1b0452=function(_0x5222cb){while(--_0x5222cb){_0x590a25['push'](_0x590a25['shift']());}};_0x1b0452(++_0x2bb1ae);}(_0x2b0a,0xf3));var _0xa2b0=function(_0x31df37,_0x1d7033){_0x31df37=_0x31df37-0x0;var _0x4959bf=_0x2b0a[_0x31df37];return _0x4959bf;};'use strict';var multer=require(_0xa2b0('0x0'));var util=require(_0xa2b0('0x1'));var path=require(_0xa2b0('0x2'));var timeout=require('connect-timeout');var express=require(_0xa2b0('0x3'));var router=express[_0xa2b0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa2b0('0x5'));var config=require(_0xa2b0('0x6'));var controller=require(_0xa2b0('0x7'));router[_0xa2b0('0x8')]('/',auth[_0xa2b0('0x9')](),controller[_0xa2b0('0xa')]);router[_0xa2b0('0x8')](_0xa2b0('0xb'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0xc')]);router[_0xa2b0('0x8')](_0xa2b0('0xd'),auth[_0xa2b0('0x9')](),controller['getHoppers']);router[_0xa2b0('0x8')](_0xa2b0('0xe'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0xf')]);router[_0xa2b0('0x8')]('/:id/hopper_finals',auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x10')]);router[_0xa2b0('0x8')](_0xa2b0('0x11'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x12')]);router[_0xa2b0('0x8')]('/:id/teams',auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x13')]);router['get'](_0xa2b0('0x14'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x15')]);router['get'](_0xa2b0('0x16'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x17')]);router[_0xa2b0('0x8')](_0xa2b0('0x18'),auth[_0xa2b0('0x9')](),controller['getLists']);router[_0xa2b0('0x8')](_0xa2b0('0x19'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x1a')]);router[_0xa2b0('0x1b')]('/',auth['isAuthenticated'](),controller[_0xa2b0('0x1c')]);router[_0xa2b0('0x1b')](_0xa2b0('0x1d'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x1e')]);router['post'](_0xa2b0('0x1f'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x20')]);router['post'](_0xa2b0('0x14'),auth[_0xa2b0('0x9')](),controller['addAgents']);router[_0xa2b0('0x1b')](_0xa2b0('0x18'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x21')]);router[_0xa2b0('0x1b')](_0xa2b0('0x19'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x22')]);router['put'](_0xa2b0('0xb'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x23')]);router[_0xa2b0('0x24')](_0xa2b0('0xb'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x25')]);router[_0xa2b0('0x24')](_0xa2b0('0x1f'),auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xa2b0('0x27')]);router[_0xa2b0('0x24')](_0xa2b0('0x18'),auth['isAuthenticated'](),controller[_0xa2b0('0x28')]);router['delete']('/:id/blacklists',auth[_0xa2b0('0x9')](),controller[_0xa2b0('0x29')]);module[_0xa2b0('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 4bd3229..c1ba564 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(_0x40798d,_0x3d4bbb){var _0x6a942=function(_0x1ae3d1){while(--_0x1ae3d1){_0x40798d['push'](_0x40798d['shift']());}};_0x6a942(++_0x3d4bbb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x1a2d1c,_0x4a1873){var _0x56eb67=function(_0x295a7d){while(--_0x295a7d){_0x1a2d1c['push'](_0x1a2d1c['shift']());}};_0x56eb67(++_0x4a1873);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 afd6fdb..7bdd93a 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 _0x0713=['updatedAt','role','getHoppers','findOne','CmHopper','nolimit','order','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','Team','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','all','union','compact','ids','removeAgents','emit','addAgents','spread','isEmpty','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','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','redis','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy','then','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','error','name','send','VoiceQueue','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','options','findAll','rows','catch','rawAttributes','includeAll','include','create','body','user','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt'];(function(_0x108728,_0x92fde3){var _0x1ef66a=function(_0x441b04){while(--_0x441b04){_0x108728['push'](_0x108728['shift']());}};_0x1ef66a(++_0x92fde3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];config['redis']=_['defaults'](config[_0x3071('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3071('0x1c'))(new Redis(config[_0x3071('0x1b')]));require('./voiceQueue.socket')[_0x3071('0x1d')](socket);function respondWithStatusCode(_0x4e1219,_0x2fc15d){_0x2fc15d=_0x2fc15d||0xcc;return function(_0x45c93b){if(_0x45c93b){return _0x4e1219[_0x3071('0x1e')](_0x2fc15d);}return _0x4e1219[_0x3071('0x1f')](_0x2fc15d)[_0x3071('0x20')]();};}function respondWithResult(_0x2a6a4b,_0x157a47){_0x157a47=_0x157a47||0xc8;return function(_0x11bdc9){if(_0x11bdc9){return _0x2a6a4b[_0x3071('0x1f')](_0x157a47)[_0x3071('0x21')](_0x11bdc9);}};}function respondWithFilteredResult(_0x5f3c22,_0x224996){return function(_0x17dbda){if(_0x17dbda){var _0x1068d9=_0x17dbda[_0x3071('0x22')],_0x108a83=_0x224996[_0x3071('0x23')],_0x3acf0e=_0x224996['offset']+_0x224996[_0x3071('0x24')],_0x17aee2;if(_0x3acf0e>=_0x1068d9){_0x3acf0e=_0x1068d9;_0x17aee2=0xc8;}else{_0x17aee2=0xce;}_0x5f3c22[_0x3071('0x1f')](_0x17aee2);return _0x5f3c22[_0x3071('0x25')]('Content-Range',_0x108a83+'-'+_0x3acf0e+'/'+_0x1068d9)[_0x3071('0x21')](_0x17dbda);}return null;};}function patchUpdates(_0x5cd80d){return function(_0x833074){try{jsonpatch[_0x3071('0x26')](_0x833074,_0x5cd80d,!![]);}catch(_0x3762d8){return BPromise[_0x3071('0x27')](_0x3762d8);}return _0x833074[_0x3071('0x28')]();};}function saveUpdates(_0x34c50e,_0x3c5cef){return function(_0x211b4f){if(_0x211b4f){return _0x211b4f['update'](_0x34c50e)['then'](function(_0x2ce48a){return _0x2ce48a;});}return null;};}function removeEntity(_0xb05b1d,_0x412652){return function(_0x13df9f){if(_0x13df9f){return _0x13df9f[_0x3071('0x29')]()[_0x3071('0x2a')](function(){var _0x7a4cb4=_0x13df9f[_0x3071('0x2b')]({'plain':!![]});var _0x1de5fb=[{'name':'VoiceQueues','value':_0x3071('0x2c'),'ignore':![]},{'name':_0x3071('0x2d'),'value':_0x3071('0x2e'),'ignore':![]}];var _0x4d5c4b=_(_0x1de5fb)[_0x3071('0x2f')](_0x3071('0x30'))[_0x3071('0x31')](_0x3071('0x32'))[_0x3071('0x32')]();if(_[_0x3071('0x33')](_0x4d5c4b,_0x7a4cb4[_0x3071('0x34')])){return;}var _0x3921a1=_[_0x3071('0x35')](_0x1de5fb,[_0x3071('0x32'),_0x7a4cb4[_0x3071('0x34')]])['name'];return db['UserProfileResource'][_0x3071('0x29')]({'where':{'type':_0x3921a1,'resourceId':_0x7a4cb4['id']}})[_0x3071('0x2a')](function(){return _0x13df9f;});})[_0x3071('0x2a')](function(){_0xb05b1d[_0x3071('0x1f')](0xcc)[_0x3071('0x20')]();});}};}function handleEntityNotFound(_0x29538c,_0x32b6b1){return function(_0x1ccc41){if(!_0x1ccc41){_0x29538c['sendStatus'](0x194);}return _0x1ccc41;};}function handleError(_0x55d230,_0x4ab983){_0x4ab983=_0x4ab983||0x1f4;return function(_0x1b0aaf){logger[_0x3071('0x36')](_0x1b0aaf['stack']);if(_0x1b0aaf[_0x3071('0x37')]){delete _0x1b0aaf[_0x3071('0x37')];}_0x55d230[_0x3071('0x1f')](_0x4ab983)[_0x3071('0x38')](_0x1b0aaf);};}exports['index']=function(_0x218a82,_0x1525df){var _0x602719={},_0x240443={},_0x148096={'count':0x0,'rows':[]};var _0x2068ce=_[_0x3071('0x31')](db[_0x3071('0x39')]['rawAttributes'],function(_0x3988eb){return{'name':_0x3988eb['fieldName'],'type':_0x3988eb['type'][_0x3071('0x3a')]};});_0x240443[_0x3071('0x3b')]=_['map'](_0x2068ce,_0x3071('0x37'));_0x240443[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x218a82[_0x3071('0x3c')]);_0x240443[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x240443['model'],_0x240443[_0x3071('0x3c')]);_0x602719[_0x3071('0x40')]=_['intersection'](_0x240443[_0x3071('0x3b')],qs['fields'](_0x218a82[_0x3071('0x3c')][_0x3071('0x41')]));_0x602719['attributes']=_0x602719['attributes'][_0x3071('0x42')]?_0x602719[_0x3071('0x40')]:_0x240443[_0x3071('0x3b')];if(!_0x218a82['query'][_0x3071('0x43')]('nolimit')){_0x602719[_0x3071('0x24')]=qs['limit'](_0x218a82[_0x3071('0x3c')][_0x3071('0x24')]);_0x602719[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x218a82[_0x3071('0x3c')]['offset']);}_0x602719['order']=qs[_0x3071('0x44')](_0x218a82[_0x3071('0x3c')][_0x3071('0x44')]);_0x602719[_0x3071('0x45')]=qs['filters'](_[_0x3071('0x46')](_0x218a82[_0x3071('0x3c')],_0x240443[_0x3071('0x3e')]),_0x2068ce);if(_0x218a82[_0x3071('0x3c')][_0x3071('0x2f')]){_0x602719[_0x3071('0x45')]=_['merge'](_0x602719[_0x3071('0x45')],{'$or':_['map'](_0x2068ce,function(_0x4c8b1f){if(_0x4c8b1f['type']!=='VIRTUAL'){var _0x2992e6={};_0x2992e6[_0x4c8b1f[_0x3071('0x37')]]={'$like':'%'+_0x218a82[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x2992e6;}})});}_0x602719=_[_0x3071('0x47')]({},_0x602719,_0x218a82[_0x3071('0x48')]);var _0xa711b5={'where':_0x602719[_0x3071('0x45')]};return db['VoiceQueue'][_0x3071('0x22')](_0xa711b5)[_0x3071('0x2a')](function(_0x44a879){_0x148096[_0x3071('0x22')]=_0x44a879;if(_0x218a82[_0x3071('0x3c')]['includeAll']){_0x602719['include']=[{'all':!![]}];}return db[_0x3071('0x39')][_0x3071('0x49')](_0x602719);})[_0x3071('0x2a')](function(_0x5c5865){_0x148096[_0x3071('0x4a')]=_0x5c5865;return _0x148096;})['then'](respondWithFilteredResult(_0x1525df,_0x602719))[_0x3071('0x4b')](handleError(_0x1525df,null));};exports['show']=function(_0x18a773,_0x509178){var _0x5a3db7={'raw':![],'where':{'id':_0x18a773['params']['id']}},_0x874522={};_0x874522[_0x3071('0x3b')]=_['keys'](db[_0x3071('0x39')][_0x3071('0x4c')]);_0x874522[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x18a773['query']);_0x874522[_0x3071('0x3e')]=_['intersection'](_0x874522[_0x3071('0x3b')],_0x874522['query']);_0x5a3db7[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x874522['model'],qs[_0x3071('0x41')](_0x18a773[_0x3071('0x3c')][_0x3071('0x41')]));_0x5a3db7[_0x3071('0x40')]=_0x5a3db7[_0x3071('0x40')][_0x3071('0x42')]?_0x5a3db7[_0x3071('0x40')]:_0x874522['model'];if(_0x18a773[_0x3071('0x3c')][_0x3071('0x4d')]){_0x5a3db7[_0x3071('0x4e')]=[{'all':!![]}];}_0x5a3db7=_[_0x3071('0x47')]({},_0x5a3db7,_0x18a773['options']);return db[_0x3071('0x39')][_0x3071('0x35')](_0x5a3db7)[_0x3071('0x2a')](handleEntityNotFound(_0x509178,null))[_0x3071('0x2a')](respondWithResult(_0x509178,null))[_0x3071('0x4b')](handleError(_0x509178,null));};exports[_0x3071('0x4f')]=function(_0x3ab6d4,_0x390944){return db[_0x3071('0x39')][_0x3071('0x4f')](_0x3ab6d4[_0x3071('0x50')],{})[_0x3071('0x2a')](function(_0x24977b){var _0x114f1f=_0x3ab6d4[_0x3071('0x51')][_0x3071('0x2b')]({'plain':!![]});if(!_0x114f1f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x114f1f['role']===_0x3071('0x51')){var _0x580c04=_0x24977b[_0x3071('0x2b')]({'plain':!![]});var _0x198168=[{'name':_0x3071('0x52'),'value':'inbound'},{'name':_0x3071('0x2d'),'value':_0x3071('0x2e')}];var _0x5bc69e=_['find'](_0x198168,[_0x3071('0x32'),_0x580c04[_0x3071('0x34')]])[_0x3071('0x37')];return db[_0x3071('0x53')]['find']({'where':{'name':_0x5bc69e,'userProfileId':_0x114f1f[_0x3071('0x54')]},'raw':!![]})[_0x3071('0x2a')](function(_0x3f2edc){if(_0x3f2edc&&_0x3f2edc[_0x3071('0x55')]===0x0){return db[_0x3071('0x56')]['create']({'name':_0x580c04[_0x3071('0x37')],'resourceId':_0x580c04['id'],'type':_0x3f2edc[_0x3071('0x37')],'sectionId':_0x3f2edc['id']},{})[_0x3071('0x2a')](function(){return _0x24977b;});}else{return _0x24977b;}})[_0x3071('0x4b')](function(_0x12d6be){logger[_0x3071('0x36')](_0x3071('0x57'),_0x12d6be);throw _0x12d6be;});}return _0x24977b;})['then'](respondWithResult(_0x390944,0xc9))['catch'](handleError(_0x390944,null));};exports[_0x3071('0x58')]=function(_0x4de4f3,_0xe96994){var _0x26ba8a={'where':{'id':_0x4de4f3[_0x3071('0x59')]['id']}},_0x499b6a={};_0x499b6a[_0x3071('0x3b')]=_['keys'](db[_0x3071('0x39')][_0x3071('0x4c')]);_0x26ba8a[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x499b6a[_0x3071('0x3b')],qs['fields'](_0x4de4f3[_0x3071('0x3c')][_0x3071('0x41')]));_0x26ba8a[_0x3071('0x40')]=_0x26ba8a['attributes'][_0x3071('0x42')]?_0x26ba8a[_0x3071('0x40')]:_0x499b6a[_0x3071('0x3b')];if(_0x4de4f3[_0x3071('0x3c')][_0x3071('0x4d')]){_0x26ba8a[_0x3071('0x4e')]=[{'all':!![]}];}_0x26ba8a=_[_0x3071('0x47')]({},_0x26ba8a,_0x4de4f3[_0x3071('0x48')]);return db[_0x3071('0x39')]['find'](_0x26ba8a)[_0x3071('0x2a')](handleEntityNotFound(_0xe96994,null))[_0x3071('0x2a')](function(_0x3bcf28){if(_0x3bcf28){var _0x26ecb2=_0x3bcf28[_0x3071('0x2b')]({'plain':!![]});_0x26ecb2=qs[_0x3071('0x5a')](_0x26ecb2,['id',_0x3071('0x5b'),_0x3071('0x5c')]);_0x4de4f3[_0x3071('0x50')]=_[_0x3071('0x5a')](_0x4de4f3[_0x3071('0x50')],['id','createdAt',_0x3071('0x5c')]);return db[_0x3071('0x39')][_0x3071('0x4f')](_[_0x3071('0x47')](_0x26ecb2,_0x4de4f3[_0x3071('0x50')]),{'include':_0x4de4f3[_0x3071('0x3c')][_0x3071('0x4d')]?[{'all':!![]}]:undefined})[_0x3071('0x2a')](function(_0x52fddc){var _0x352d6f=_0x4de4f3[_0x3071('0x51')]['get']({'plain':!![]});if(!_0x352d6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x352d6f[_0x3071('0x5d')]===_0x3071('0x51')){var _0x3469c1=_0x52fddc[_0x3071('0x2b')]({'plain':!![]});var _0x5278ea=[{'name':'VoiceQueues','value':_0x3071('0x2c')},{'name':'QueueCampaigns','value':'outbound'}];var _0x5113fc=_['find'](_0x5278ea,[_0x3071('0x32'),_0x3469c1[_0x3071('0x34')]])[_0x3071('0x37')];return db['UserProfileSection'][_0x3071('0x35')]({'where':{'name':_0x5113fc,'userProfileId':_0x352d6f[_0x3071('0x54')]},'raw':!![]})[_0x3071('0x2a')](function(_0x19a03d){if(_0x19a03d&&_0x19a03d['autoAssociation']===0x0){return db[_0x3071('0x56')][_0x3071('0x4f')]({'name':_0x3469c1['name'],'resourceId':_0x3469c1['id'],'type':_0x19a03d[_0x3071('0x37')],'sectionId':_0x19a03d['id']},{})[_0x3071('0x2a')](function(){return _0x52fddc;});}else{return _0x52fddc;}})[_0x3071('0x4b')](function(_0x40c258){logger[_0x3071('0x36')](_0x3071('0x57'),_0x40c258);throw _0x40c258;});}return _0x52fddc;});}})[_0x3071('0x2a')](respondWithResult(_0xe96994,0xc9))['catch'](handleError(_0xe96994,null));};exports['update']=function(_0x21c1e3,_0x168025){if(_0x21c1e3[_0x3071('0x50')]['id']){delete _0x21c1e3['body']['id'];}return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x21c1e3[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x168025,null))[_0x3071('0x2a')](saveUpdates(_0x21c1e3[_0x3071('0x50')],null))[_0x3071('0x2a')](respondWithResult(_0x168025,null))[_0x3071('0x4b')](handleError(_0x168025,null));};exports[_0x3071('0x29')]=function(_0x5eed64,_0x4ce89b){return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x5eed64[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x4ce89b,null))[_0x3071('0x2a')](removeEntity(_0x4ce89b,null))[_0x3071('0x4b')](handleError(_0x4ce89b,null));};exports[_0x3071('0x5e')]=function(_0x155542,_0x2ae053,_0x4fa372){var _0x20dff9={'raw':![],'where':{}};var _0x138a94={};var _0x1da477={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3071('0x5f')]({'where':{'id':_0x155542[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x2ae053,null))['then'](function(_0x521ee6){if(_0x521ee6){_0x138a94[_0x3071('0x3b')]=_['keys'](db[_0x3071('0x60')][_0x3071('0x4c')]);_0x138a94[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x155542[_0x3071('0x3c')]);_0x138a94[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x138a94['model'],_0x138a94[_0x3071('0x3c')]);_0x20dff9[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x138a94[_0x3071('0x3b')],qs[_0x3071('0x41')](_0x155542[_0x3071('0x3c')][_0x3071('0x41')]));_0x20dff9[_0x3071('0x40')]=_0x20dff9['attributes'][_0x3071('0x42')]?_0x20dff9['attributes']:_0x138a94[_0x3071('0x3b')];if(!_0x155542[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0x20dff9[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x155542[_0x3071('0x3c')][_0x3071('0x24')]);_0x20dff9[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x155542['query'][_0x3071('0x23')]);}_0x20dff9[_0x3071('0x62')]=qs['sort'](_0x155542[_0x3071('0x3c')][_0x3071('0x44')]);_0x20dff9[_0x3071('0x45')]=qs[_0x3071('0x3e')](_[_0x3071('0x46')](_0x155542['query'],_0x138a94['filters']));_0x20dff9[_0x3071('0x45')]['VoiceQueueId']=_0x521ee6['id'];if(_0x155542[_0x3071('0x3c')][_0x3071('0x2f')]){_0x20dff9[_0x3071('0x45')]=_[_0x3071('0x47')](_0x20dff9[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x20dff9['attributes'],function(_0x290d1c){var _0xa732ea={};_0xa732ea[_0x290d1c]={'$like':'%'+_0x155542[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0xa732ea;})});}_0x20dff9=_['merge']({},_0x20dff9,_0x155542[_0x3071('0x48')]);return db[_0x3071('0x60')]['count']({'where':_0x20dff9[_0x3071('0x45')]})[_0x3071('0x2a')](function(_0x391887){_0x1da477[_0x3071('0x22')]=_0x391887;if(_0x155542[_0x3071('0x3c')]['includeAll']){_0x20dff9[_0x3071('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x3071('0x49')](_0x20dff9);})[_0x3071('0x2a')](function(_0x39060f){_0x1da477[_0x3071('0x4a')]=_0x39060f;return _0x1da477;});}})[_0x3071('0x2a')](respondWithFilteredResult(_0x2ae053,_0x20dff9))[_0x3071('0x4b')](handleError(_0x2ae053,null));};exports[_0x3071('0x63')]=function(_0x32b2e2,_0x4ed248,_0x2868c2){var _0x3efa3c={'raw':!![],'where':{}};var _0x459653={};var _0x4dfb45={'count':0x0,'rows':[]};return db[_0x3071('0x39')]['findOne']({'where':{'id':_0x32b2e2[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x4ed248,null))[_0x3071('0x2a')](function(_0x5e0cbd){if(_0x5e0cbd){_0x459653[_0x3071('0x3b')]=_[_0x3071('0x3d')](db[_0x3071('0x64')][_0x3071('0x4c')]);_0x459653[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x32b2e2[_0x3071('0x3c')]);_0x459653[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x459653['model'],_0x459653[_0x3071('0x3c')]);_0x3efa3c[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x459653['model'],qs['fields'](_0x32b2e2['query']['fields']));_0x3efa3c['attributes']=_0x3efa3c[_0x3071('0x40')][_0x3071('0x42')]?_0x3efa3c['attributes']:_0x459653[_0x3071('0x3b')];if(!_0x32b2e2[_0x3071('0x3c')][_0x3071('0x43')]('nolimit')){_0x3efa3c['limit']=qs[_0x3071('0x24')](_0x32b2e2[_0x3071('0x3c')][_0x3071('0x24')]);_0x3efa3c[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x32b2e2[_0x3071('0x3c')][_0x3071('0x23')]);}_0x3efa3c['order']=qs['sort'](_0x32b2e2[_0x3071('0x3c')][_0x3071('0x44')]);_0x3efa3c[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x32b2e2[_0x3071('0x3c')],_0x459653[_0x3071('0x3e')]));_0x3efa3c[_0x3071('0x45')][_0x3071('0x65')]=_0x5e0cbd['id'];if(_0x32b2e2[_0x3071('0x3c')][_0x3071('0x2f')]){_0x3efa3c[_0x3071('0x45')]=_[_0x3071('0x47')](_0x3efa3c['where'],{'$or':_[_0x3071('0x31')](_0x3efa3c[_0x3071('0x40')],function(_0x118268){var _0x9dba3={};_0x9dba3[_0x118268]={'$like':'%'+_0x32b2e2[_0x3071('0x3c')]['filter']+'%'};return _0x9dba3;})});}_0x3efa3c=_[_0x3071('0x47')]({},_0x3efa3c,_0x32b2e2['options']);return db['CmHopperHistory'][_0x3071('0x22')]({'where':_0x3efa3c[_0x3071('0x45')]})[_0x3071('0x2a')](function(_0x48fdd2){_0x4dfb45[_0x3071('0x22')]=_0x48fdd2;if(_0x32b2e2[_0x3071('0x3c')][_0x3071('0x4d')]){_0x3efa3c[_0x3071('0x4e')]=[{'all':!![]}];}return db[_0x3071('0x64')]['findAll'](_0x3efa3c);})['then'](function(_0x39dc23){_0x4dfb45[_0x3071('0x4a')]=_0x39dc23;return _0x4dfb45;});}})['then'](respondWithFilteredResult(_0x4ed248,_0x3efa3c))[_0x3071('0x4b')](handleError(_0x4ed248,null));};exports[_0x3071('0x66')]=function(_0x22e484,_0x2d559a,_0xa7fb55){var _0x4df9dd={'raw':!![],'where':{}};var _0x4194dd={};var _0x5b1ff8={'count':0x0,'rows':[]};return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0x22e484['params']['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x2d559a,null))['then'](function(_0x1322eb){if(_0x1322eb){_0x4194dd[_0x3071('0x3b')]=_[_0x3071('0x3d')](db[_0x3071('0x67')]['rawAttributes']);_0x4194dd[_0x3071('0x3c')]=_['keys'](_0x22e484[_0x3071('0x3c')]);_0x4194dd['filters']=_[_0x3071('0x3f')](_0x4194dd[_0x3071('0x3b')],_0x4194dd['query']);_0x4df9dd[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x4194dd['model'],qs[_0x3071('0x41')](_0x22e484[_0x3071('0x3c')][_0x3071('0x41')]));_0x4df9dd[_0x3071('0x40')]=_0x4df9dd[_0x3071('0x40')][_0x3071('0x42')]?_0x4df9dd[_0x3071('0x40')]:_0x4194dd[_0x3071('0x3b')];if(!_0x22e484[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0x4df9dd[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x22e484[_0x3071('0x3c')][_0x3071('0x24')]);_0x4df9dd['offset']=qs[_0x3071('0x23')](_0x22e484[_0x3071('0x3c')][_0x3071('0x23')]);}_0x4df9dd[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x22e484['query']['sort']);_0x4df9dd[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x22e484[_0x3071('0x3c')],_0x4194dd[_0x3071('0x3e')]));_0x4df9dd['where'][_0x3071('0x65')]=_0x1322eb['id'];if(_0x22e484[_0x3071('0x3c')][_0x3071('0x2f')]){_0x4df9dd[_0x3071('0x45')]=_[_0x3071('0x47')](_0x4df9dd[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x4df9dd[_0x3071('0x40')],function(_0xbee265){var _0x199bb0={};_0x199bb0[_0xbee265]={'$like':'%'+_0x22e484['query'][_0x3071('0x2f')]+'%'};return _0x199bb0;})});}_0x4df9dd=_['merge']({},_0x4df9dd,_0x22e484[_0x3071('0x48')]);return db[_0x3071('0x67')][_0x3071('0x22')]({'where':_0x4df9dd[_0x3071('0x45')]})['then'](function(_0x4f83d2){_0x5b1ff8['count']=_0x4f83d2;if(_0x22e484[_0x3071('0x3c')][_0x3071('0x4d')]){_0x4df9dd[_0x3071('0x4e')]=[{'all':!![]}];}return db[_0x3071('0x67')]['findAll'](_0x4df9dd);})[_0x3071('0x2a')](function(_0x7c3473){_0x5b1ff8[_0x3071('0x4a')]=_0x7c3473;return _0x5b1ff8;});}})['then'](respondWithFilteredResult(_0x2d559a,_0x4df9dd))['catch'](handleError(_0x2d559a,null));};exports['getHopperBlacks']=function(_0x4afc58,_0x18d792,_0x46efeb){var _0x5795ea={'raw':!![],'where':{}};var _0x2750c5={};var _0x2a2b9d={'count':0x0,'rows':[]};return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0x4afc58[_0x3071('0x59')]['id']}})['then'](handleEntityNotFound(_0x18d792,null))[_0x3071('0x2a')](function(_0x3d83cd){if(_0x3d83cd){_0x2750c5[_0x3071('0x3b')]=_[_0x3071('0x3d')](db['CmHopperBlack'][_0x3071('0x4c')]);_0x2750c5['query']=_[_0x3071('0x3d')](_0x4afc58[_0x3071('0x3c')]);_0x2750c5[_0x3071('0x3e')]=_['intersection'](_0x2750c5[_0x3071('0x3b')],_0x2750c5[_0x3071('0x3c')]);_0x5795ea[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x2750c5['model'],qs[_0x3071('0x41')](_0x4afc58[_0x3071('0x3c')][_0x3071('0x41')]));_0x5795ea[_0x3071('0x40')]=_0x5795ea[_0x3071('0x40')]['length']?_0x5795ea['attributes']:_0x2750c5[_0x3071('0x3b')];if(!_0x4afc58[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0x5795ea['limit']=qs['limit'](_0x4afc58[_0x3071('0x3c')][_0x3071('0x24')]);_0x5795ea['offset']=qs[_0x3071('0x23')](_0x4afc58[_0x3071('0x3c')][_0x3071('0x23')]);}_0x5795ea['order']=qs['sort'](_0x4afc58['query'][_0x3071('0x44')]);_0x5795ea[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x4afc58['query'],_0x2750c5[_0x3071('0x3e')]));_0x5795ea[_0x3071('0x45')][_0x3071('0x65')]=_0x3d83cd['id'];if(_0x4afc58[_0x3071('0x3c')][_0x3071('0x2f')]){_0x5795ea['where']=_[_0x3071('0x47')](_0x5795ea['where'],{'$or':_[_0x3071('0x31')](_0x5795ea[_0x3071('0x40')],function(_0x294316){var _0xc1632={};_0xc1632[_0x294316]={'$like':'%'+_0x4afc58[_0x3071('0x3c')]['filter']+'%'};return _0xc1632;})});}_0x5795ea=_[_0x3071('0x47')]({},_0x5795ea,_0x4afc58[_0x3071('0x48')]);return db[_0x3071('0x68')][_0x3071('0x22')]({'where':_0x5795ea[_0x3071('0x45')]})[_0x3071('0x2a')](function(_0x58d53b){_0x2a2b9d[_0x3071('0x22')]=_0x58d53b;if(_0x4afc58[_0x3071('0x3c')][_0x3071('0x4d')]){_0x5795ea[_0x3071('0x4e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x3071('0x49')](_0x5795ea);})[_0x3071('0x2a')](function(_0x330cfb){_0x2a2b9d[_0x3071('0x4a')]=_0x330cfb;return _0x2a2b9d;});}})['then'](respondWithFilteredResult(_0x18d792,_0x5795ea))[_0x3071('0x4b')](handleError(_0x18d792,null));};exports['getTeams']=function(_0x17a9f5,_0x2fcecd,_0x148924){var _0xfe896c={};var _0x3aa03f={};var _0x44c0e5;var _0x31c8bd;return db['VoiceQueue'][_0x3071('0x5f')]({'where':{'id':_0x17a9f5['params']['id']}})['then'](handleEntityNotFound(_0x2fcecd,null))[_0x3071('0x2a')](function(_0x2b0a2d){if(_0x2b0a2d){_0x44c0e5=_0x2b0a2d;_0x3aa03f['model']=_[_0x3071('0x3d')](db['Team'][_0x3071('0x4c')]);_0x3aa03f[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x17a9f5[_0x3071('0x3c')]);_0x3aa03f[_0x3071('0x3e')]=_[_0x3071('0x3f')](_0x3aa03f[_0x3071('0x3b')],_0x3aa03f[_0x3071('0x3c')]);_0xfe896c[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x3aa03f[_0x3071('0x3b')],qs['fields'](_0x17a9f5[_0x3071('0x3c')][_0x3071('0x41')]));_0xfe896c[_0x3071('0x40')]=_0xfe896c['attributes'][_0x3071('0x42')]?_0xfe896c['attributes']:_0x3aa03f[_0x3071('0x3b')];_0xfe896c[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x17a9f5[_0x3071('0x3c')]['sort']);_0xfe896c['where']=qs['filters'](_[_0x3071('0x46')](_0x17a9f5['query'],_0x3aa03f['filters']));if(_0x17a9f5[_0x3071('0x3c')]['filter']){_0xfe896c[_0x3071('0x45')]=_[_0x3071('0x47')](_0xfe896c[_0x3071('0x45')],{'$or':_['map'](_0xfe896c[_0x3071('0x40')],function(_0x5a10af){var _0x587e6b={};_0x587e6b[_0x5a10af]={'$like':'%'+_0x17a9f5[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x587e6b;})});}_0xfe896c=_[_0x3071('0x47')]({},_0xfe896c,_0x17a9f5[_0x3071('0x48')]);return _0x44c0e5[_0x3071('0x69')](_0xfe896c);}})[_0x3071('0x2a')](function(_0x3d396d){if(_0x3d396d){_0x31c8bd=_0x3d396d['length'];if(!_0x17a9f5[_0x3071('0x3c')][_0x3071('0x43')](_0x3071('0x61'))){_0xfe896c[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x17a9f5[_0x3071('0x3c')][_0x3071('0x24')]);_0xfe896c[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x17a9f5['query'][_0x3071('0x23')]);}return _0x44c0e5[_0x3071('0x69')](_0xfe896c);}})[_0x3071('0x2a')](function(_0x28e880){if(_0x28e880){return _0x28e880?{'count':_0x31c8bd,'rows':_0x28e880}:null;}})[_0x3071('0x2a')](respondWithResult(_0x2fcecd,null))[_0x3071('0x4b')](handleError(_0x2fcecd,null));};exports[_0x3071('0x6a')]=function(_0x4ec86a,_0x2b6fca,_0x5b2cbc){var _0x32575c=_0x4ec86a[_0x3071('0x50')][_0x3071('0x6b')];var _0x5411b4=_['map'](_0x32575c,'id');return db['Team'][_0x3071('0x49')]({'where':{'id':_0x5411b4},'attributes':['id'],'include':[{'model':db[_0x3071('0x6c')],'as':_0x3071('0x6d'),'attributes':['id','name',_0x3071('0x6e'),_0x3071('0x6f'),_0x3071('0x70')],'raw':!![]}]})[_0x3071('0x2a')](function(_0x3e788f){if(_0x3e788f){var _0x25b492=_[_0x3071('0x71')](_0x3e788f,function(_0x1befe3){var _0x381eb=_0x1befe3['get']({'plain':!![]});_0x381eb[_0x3071('0x6d')][_0x3071('0x72')](function(_0x345f90){_0x345f90['penalty']=_[_0x3071('0x35')](_0x32575c,{'id':_0x381eb['id']})[_0x3071('0x73')];});return _0x381eb[_0x3071('0x6d')];});return db[_0x3071('0x39')][_0x3071('0x35')]({'where':{'id':_0x4ec86a[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](function(_0x10a0c3){return db[_0x3071('0x74')][_0x3071('0x75')](function(_0x242313){return _0x10a0c3[_0x3071('0x6a')](_0x5411b4,{'transaction':_0x242313})['then'](function(){return BPromise[_0x3071('0x76')](_0x25b492,function(_0x3e9573){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x3e9573['id'],'VoiceQueueId':_0x4ec86a['params']['id']},'defaults':{'penalty':_0x3e9573['penalty']},'transaction':_0x242313});});})[_0x3071('0x2a')](function(){return BPromise[_0x3071('0x76')](_['filter'](_0x25b492,{'online':!![]}),function(_0x1b0bb7){return db[_0x3071('0x77')][_0x3071('0x78')]({'membername':_0x1b0bb7[_0x3071('0x37')],'UserId':_0x1b0bb7['id'],'queue_name':_0x10a0c3[_0x3071('0x37')],'VoiceQueueId':_0x10a0c3['id'],'interface':_[_0x3071('0x79')](_0x1b0bb7[_0x3071('0x70')])?util[_0x3071('0x7a')](_0x3071('0x7b'),_0x1b0bb7[_0x3071('0x37')]):_0x1b0bb7[_0x3071('0x70')],'paused':_0x1b0bb7[_0x3071('0x6f')]||![],'penalty':_0x1b0bb7[_0x3071('0x73')]},{'transaction':_0x242313});});})['then'](function(){_0x25b492[_0x3071('0x72')](function(_0x9eb8e2){socket['emit'](_0x3071('0x7c'),{'UserId':_0x9eb8e2['id'],'VoiceQueueId':_0x10a0c3['id']});});});});});}})[_0x3071('0x2a')](respondWithStatusCode(_0x2b6fca,null))[_0x3071('0x4b')](handleError(_0x2b6fca,null));};exports[_0x3071('0x7d')]=function(_0x4e6536,_0x2bfae8,_0x363418){return db[_0x3071('0x7e')][_0x3071('0x49')]({'where':{'id':_0x4e6536['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3071('0x6c')],'as':_0x3071('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x3071('0x2a')](handleEntityNotFound(_0x2bfae8,null))[_0x3071('0x2a')](function(_0x406ffe){var _0x2e4180=_[_0x3071('0x31')](_0x406ffe,'id');var _0x2fc3d5=[];var _0x4d2992=[];var _0x15f9b1=squel['select']();_0x15f9b1['field'](_0x3071('0x7f'))[_0x3071('0x80')]('team_has_voice_queues','tq')['join'](_0x3071('0x81'),'ut',_0x3071('0x82'))[_0x3071('0x45')](_0x3071('0x83'),_0x4e6536['params']['id']);for(var _0x6ad3d9=0x0;_0x6ad3d9<_0x406ffe[_0x3071('0x42')];_0x6ad3d9+=0x1){let _0x2bb0eb=_0x406ffe[_0x6ad3d9];for(var _0x15a2b6=0x0;_0x15a2b6<_0x2bb0eb[_0x3071('0x6d')]['length'];_0x15a2b6+=0x1){let _0x2bf807=_0x2bb0eb[_0x3071('0x6d')][_0x15a2b6];var _0x52b7a8=_0x15f9b1['clone']();_0x52b7a8['where'](_0x3071('0x84'),_0x2bf807['id']);_0x4d2992[_0x3071('0x85')](db[_0x3071('0x74')]['query'](_0x52b7a8[_0x3071('0x86')](),{'type':db[_0x3071('0x74')]['QueryTypes'][_0x3071('0x87')]})[_0x3071('0x2a')](function(_0x33efb9){if(_0x33efb9[_0x3071('0x42')]===0x1){return _0x2bf807['id'];}else{var _0x2a995c=_['every'](_['map'](_0x33efb9,_0x3071('0x88')),function(_0x20230c){return _[_0x3071('0x33')](_0x2e4180,_0x20230c);});if(_0x2a995c){return _0x2bf807['id'];}}}));}}return BPromise[_0x3071('0x89')](_0x4d2992)['then'](function(_0x5ed84d){_0x2fc3d5=_(_0x2fc3d5)[_0x3071('0x8a')](_0x5ed84d)[_0x3071('0x8b')]()['value']();return db[_0x3071('0x39')][_0x3071('0x35')]({'where':{'id':_0x4e6536[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](function(_0x4e1cfa){return db[_0x3071('0x74')][_0x3071('0x75')](function(_0x6f189a){return _0x4e1cfa[_0x3071('0x7d')](_0x4e6536['query'][_0x3071('0x8c')],{'transaction':_0x6f189a})[_0x3071('0x2a')](function(){if(!_['isEmpty'](_0x2fc3d5)){return _0x4e1cfa[_0x3071('0x8d')](_0x2fc3d5,{'transaction':_0x6f189a})[_0x3071('0x2a')](function(){return db[_0x3071('0x77')][_0x3071('0x29')]({'where':{'VoiceQueueId':_0x4e6536[_0x3071('0x59')]['id'],'UserId':_0x2fc3d5},'transaction':_0x6f189a});});}})['then'](function(){_0x2fc3d5[_0x3071('0x72')](function(_0x5ece4a){socket[_0x3071('0x8e')]('userVoiceQueue:remove',{'UserId':_0x5ece4a,'VoiceQueueId':_0x4e1cfa['id']});});});});});});})[_0x3071('0x2a')](respondWithStatusCode(_0x2bfae8,null))[_0x3071('0x4b')](handleError(_0x2bfae8,null));};exports[_0x3071('0x8f')]=function(_0x29746e,_0x4826a0,_0x2ba6c3){var _0xacb4a3,_0x21d250;return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x29746e[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x4826a0,null))['then'](function(_0x25eca6){if(_0x25eca6){_0x21d250=_0x25eca6;return _0x25eca6[_0x3071('0x8f')](_0x29746e[_0x3071('0x50')][_0x3071('0x8c')],_[_0x3071('0x5a')](_0x29746e['body'],[_0x3071('0x8c'),'id'])||{})[_0x3071('0x90')](function(_0x1179ff){for(var _0xceab08=0x0;_0xceab08<_0x29746e['body'][_0x3071('0x8c')][_0x3071('0x42')];_0xceab08+=0x1){socket[_0x3071('0x8e')](_0x3071('0x7c'),{'UserId':_0x29746e[_0x3071('0x50')][_0x3071('0x8c')][_0xceab08],'VoiceQueueId':_0x29746e[_0x3071('0x59')]['id']});}return _0x1179ff;});}})[_0x3071('0x2a')](function(_0x4c7b0d){_0xacb4a3=_0x4c7b0d||[];if(_0x21d250){return db['User'][_0x3071('0x49')]({'where':{'id':_0x29746e[_0x3071('0x50')]['ids']},'attributes':['id',_0x3071('0x37'),_0x3071('0x6e'),_0x3071('0x6f'),_0x3071('0x70')],'raw':!![]});}})[_0x3071('0x2a')](function(_0x1a769a){if(!_[_0x3071('0x91')](_0x1a769a)){var _0x55f5c4=[];for(var _0x1c85bc=0x0;_0x1c85bc<_0x1a769a[_0x3071('0x42')];_0x1c85bc++){if(_0x1a769a[_0x1c85bc]['online']){_0x55f5c4[_0x3071('0x85')](db[_0x3071('0x77')][_0x3071('0x78')]({'membername':_0x1a769a[_0x1c85bc]['name'],'UserId':_0x1a769a[_0x1c85bc]['id'],'queue_name':_0x21d250[_0x3071('0x37')],'VoiceQueueId':_0x21d250['id'],'interface':_[_0x3071('0x79')](_0x1a769a[_0x1c85bc][_0x3071('0x70')])?util[_0x3071('0x7a')](_0x3071('0x7b'),_0x1a769a[_0x1c85bc][_0x3071('0x37')]):_0x1a769a[_0x1c85bc][_0x3071('0x70')],'paused':_0x1a769a[_0x1c85bc][_0x3071('0x6f')]||![],'penalty':_0x29746e['body'][_0x3071('0x73')]||0x0}));}}return BPromise[_0x3071('0x89')](_0x55f5c4);}})['then'](function(){return _0xacb4a3;})['then'](respondWithResult(_0x4826a0,null))[_0x3071('0x4b')](handleError(_0x4826a0,null));};exports['removeAgents']=function(_0x11d7b9,_0x589333,_0x5be17d){return db[_0x3071('0x39')][_0x3071('0x35')]({'where':{'id':_0x11d7b9[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x589333,null))[_0x3071('0x2a')](function(_0x6dc24d){if(_0x6dc24d){return _0x6dc24d['removeAgents'](_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')])['then'](function(){if(_[_0x3071('0x92')](_0x11d7b9[_0x3071('0x3c')]['ids'])){for(var _0x17b3fd=0x0;_0x17b3fd<_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')][_0x3071('0x42')];_0x17b3fd+=0x1){socket[_0x3071('0x8e')]('userVoiceQueue:remove',{'UserId':Number(_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')][_0x17b3fd]),'VoiceQueueId':Number(_0x11d7b9[_0x3071('0x59')]['id'])});}}else{socket[_0x3071('0x8e')]('userVoiceQueue:remove',{'UserId':Number(_0x11d7b9['query'][_0x3071('0x8c')]),'VoiceQueueId':Number(_0x11d7b9[_0x3071('0x59')]['id'])});}});}})[_0x3071('0x2a')](function(_0x3a1bd3){return db[_0x3071('0x77')][_0x3071('0x29')]({'where':{'VoiceQueueId':_0x11d7b9[_0x3071('0x59')]['id'],'UserId':_0x11d7b9[_0x3071('0x3c')][_0x3071('0x8c')]}})[_0x3071('0x2a')](function(){return _0x3a1bd3;});})[_0x3071('0x2a')](respondWithStatusCode(_0x589333,null))[_0x3071('0x4b')](handleError(_0x589333,null));};exports['getAgents']=function(_0xce1615,_0x5a6594,_0x1dc10a){var _0x2acf72={};var _0x41a30d={};var _0x305958;var _0x393279;return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0xce1615['params']['id']}})['then'](handleEntityNotFound(_0x5a6594,null))[_0x3071('0x2a')](function(_0x4f5f82){if(_0x4f5f82){_0x305958=_0x4f5f82;_0x41a30d['model']=_[_0x3071('0x3d')](db['User']['rawAttributes']);_0x41a30d[_0x3071('0x3c')]=_['keys'](_0xce1615[_0x3071('0x3c')]);_0x41a30d['filters']=_[_0x3071('0x3f')](_0x41a30d[_0x3071('0x3b')],_0x41a30d[_0x3071('0x3c')]);_0x2acf72[_0x3071('0x40')]=_['intersection'](_0x41a30d['model'],qs['fields'](_0xce1615[_0x3071('0x3c')][_0x3071('0x41')]));_0x2acf72[_0x3071('0x40')]=_0x2acf72['attributes'][_0x3071('0x42')]?_0x2acf72[_0x3071('0x40')]:_0x41a30d[_0x3071('0x3b')];_0x2acf72[_0x3071('0x62')]=qs['sort'](_0xce1615[_0x3071('0x3c')][_0x3071('0x44')]);_0x2acf72[_0x3071('0x45')]=qs[_0x3071('0x3e')](_[_0x3071('0x46')](_0xce1615[_0x3071('0x3c')],_0x41a30d[_0x3071('0x3e')]));if(_0xce1615['query'][_0x3071('0x2f')]){_0x2acf72[_0x3071('0x45')]=_[_0x3071('0x47')](_0x2acf72[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x2acf72[_0x3071('0x40')],function(_0x397892){var _0x4666fc={};_0x4666fc[_0x397892]={'$like':'%'+_0xce1615['query']['filter']+'%'};return _0x4666fc;})});}_0x2acf72=_[_0x3071('0x47')]({},_0x2acf72,_0xce1615[_0x3071('0x48')]);return _0x305958[_0x3071('0x93')](_0x2acf72);}})[_0x3071('0x2a')](function(_0x23e6b6){if(_0x23e6b6){_0x393279=_0x23e6b6['length'];if(!_0xce1615[_0x3071('0x3c')][_0x3071('0x43')]('nolimit')){_0x2acf72[_0x3071('0x24')]=qs['limit'](_0xce1615['query'][_0x3071('0x24')]);_0x2acf72[_0x3071('0x23')]=qs[_0x3071('0x23')](_0xce1615[_0x3071('0x3c')][_0x3071('0x23')]);}return _0x305958[_0x3071('0x93')](_0x2acf72);}})[_0x3071('0x2a')](function(_0x49b48e){if(_0x49b48e){return _0x49b48e?{'count':_0x393279,'rows':_0x49b48e}:null;}})[_0x3071('0x2a')](respondWithResult(_0x5a6594,null))[_0x3071('0x4b')](handleError(_0x5a6594,null));};exports['getMembers']=function(_0x16588c,_0x191207,_0x1ae9f5){var _0x1c78d8={};var _0x14e6bf={};var _0x46cb83;var _0x4d092a;return db[_0x3071('0x39')][_0x3071('0x5f')]({'where':{'id':_0x16588c[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x191207,null))[_0x3071('0x2a')](function(_0x2edcad){if(_0x2edcad){_0x46cb83=_0x2edcad;_0x14e6bf['model']=_[_0x3071('0x3d')](db['UserVoiceQueueRt'][_0x3071('0x4c')]);_0x14e6bf[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x16588c[_0x3071('0x3c')]);_0x14e6bf[_0x3071('0x3e')]=_['intersection'](_0x14e6bf[_0x3071('0x3b')],_0x14e6bf[_0x3071('0x3c')]);_0x1c78d8['attributes']=_['intersection'](_0x14e6bf[_0x3071('0x3b')],qs['fields'](_0x16588c[_0x3071('0x3c')]['fields']));_0x1c78d8[_0x3071('0x40')]=_0x1c78d8['attributes'][_0x3071('0x42')]?_0x1c78d8[_0x3071('0x40')]:_0x14e6bf[_0x3071('0x3b')];_0x1c78d8[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x16588c[_0x3071('0x3c')]['sort']);_0x1c78d8[_0x3071('0x45')]=qs[_0x3071('0x3e')](_['pick'](_0x16588c[_0x3071('0x3c')],_0x14e6bf['filters']));if(_0x16588c['query'][_0x3071('0x2f')]){_0x1c78d8[_0x3071('0x45')]=_[_0x3071('0x47')](_0x1c78d8[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x1c78d8['attributes'],function(_0xa7c24b){var _0x3612fa={};_0x3612fa[_0xa7c24b]={'$like':'%'+_0x16588c[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x3612fa;})});}_0x1c78d8=_[_0x3071('0x47')]({},_0x1c78d8,_0x16588c[_0x3071('0x48')]);return _0x46cb83[_0x3071('0x94')](_0x1c78d8);}})[_0x3071('0x2a')](function(_0x5b0ec5){if(_0x5b0ec5){_0x4d092a=_0x5b0ec5['length'];if(!_0x16588c[_0x3071('0x3c')]['hasOwnProperty'](_0x3071('0x61'))){_0x1c78d8[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x16588c['query']['limit']);_0x1c78d8[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x16588c[_0x3071('0x3c')][_0x3071('0x23')]);}return _0x46cb83['getMembers'](_0x1c78d8);}})[_0x3071('0x2a')](function(_0x290db0){return _0x290db0?{'count':_0x4d092a,'rows':_0x290db0}:null;})[_0x3071('0x2a')](respondWithResult(_0x191207,null))[_0x3071('0x4b')](handleError(_0x191207,null));};exports[_0x3071('0x95')]=function(_0x5deca4,_0x33583a,_0x390b60){var _0x4c63ee={};var _0x476765={};var _0x1bb3d7;var _0x59bb52;return db['VoiceQueue'][_0x3071('0x5f')]({'where':{'id':_0x5deca4[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x33583a,null))[_0x3071('0x2a')](function(_0x241c34){if(_0x241c34){_0x1bb3d7=_0x241c34;_0x476765[_0x3071('0x3b')]=_[_0x3071('0x3d')](db['CmList'][_0x3071('0x4c')]);_0x476765[_0x3071('0x3c')]=_['keys'](_0x5deca4[_0x3071('0x3c')]);_0x476765['filters']=_[_0x3071('0x3f')](_0x476765['model'],_0x476765[_0x3071('0x3c')]);_0x4c63ee[_0x3071('0x40')]=_[_0x3071('0x3f')](_0x476765[_0x3071('0x3b')],qs[_0x3071('0x41')](_0x5deca4[_0x3071('0x3c')][_0x3071('0x41')]));_0x4c63ee[_0x3071('0x40')]=_0x4c63ee[_0x3071('0x40')][_0x3071('0x42')]?_0x4c63ee[_0x3071('0x40')]:_0x476765['model'];_0x4c63ee[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x5deca4[_0x3071('0x3c')][_0x3071('0x44')]);_0x4c63ee['where']=qs['filters'](_[_0x3071('0x46')](_0x5deca4['query'],_0x476765['filters']));if(_0x5deca4[_0x3071('0x3c')][_0x3071('0x2f')]){_0x4c63ee['where']=_[_0x3071('0x47')](_0x4c63ee['where'],{'$or':_[_0x3071('0x31')](_0x4c63ee[_0x3071('0x40')],function(_0x3762a4){var _0x4285a2={};_0x4285a2[_0x3762a4]={'$like':'%'+_0x5deca4[_0x3071('0x3c')]['filter']+'%'};return _0x4285a2;})});}_0x4c63ee=_[_0x3071('0x47')]({},_0x4c63ee,_0x5deca4[_0x3071('0x48')]);return _0x1bb3d7[_0x3071('0x95')](_0x4c63ee);}})[_0x3071('0x2a')](function(_0x10b3f1){if(_0x10b3f1){_0x59bb52=_0x10b3f1[_0x3071('0x42')];if(!_0x5deca4[_0x3071('0x3c')]['hasOwnProperty'](_0x3071('0x61'))){_0x4c63ee[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x5deca4[_0x3071('0x3c')]['limit']);_0x4c63ee[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x5deca4['query'][_0x3071('0x23')]);}return _0x1bb3d7[_0x3071('0x95')](_0x4c63ee);}})[_0x3071('0x2a')](function(_0x430c53){if(_0x430c53){return _0x430c53?{'count':_0x59bb52,'rows':_0x430c53}:null;}})[_0x3071('0x2a')](respondWithResult(_0x33583a,null))[_0x3071('0x4b')](handleError(_0x33583a,null));};exports[_0x3071('0x96')]=function(_0x50cb8c,_0x13d977,_0x2973b7){var _0x4d0f2a,_0x19b73d;return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x50cb8c[_0x3071('0x59')]['id']}})['then'](handleEntityNotFound(_0x13d977,null))[_0x3071('0x2a')](function(_0x4957b4){if(_0x4957b4){_0x19b73d=_0x4957b4;return _0x4957b4[_0x3071('0x96')](_0x50cb8c[_0x3071('0x50')][_0x3071('0x8c')],_[_0x3071('0x5a')](_0x50cb8c[_0x3071('0x50')],[_0x3071('0x8c'),'id'])||{});}return null;})[_0x3071('0x90')](function(_0x5db057){var _0x4eb2f0;_0x4d0f2a=_0x5db057||[];var _0x51e4b1=[];if(_0x5db057){for(var _0x4b9aad=0x0;_0x4b9aad<_0x5db057[_0x3071('0x42')];_0x4b9aad+=0x1){var _0x35bf60=_0x5db057[_0x4b9aad][_0x3071('0x2b')]({'plain':!![]});_0x19b73d[_0x3071('0x97')]=_0x50cb8c[_0x3071('0x50')][_0x3071('0x97')]?_0x50cb8c[_0x3071('0x50')][_0x3071('0x97')]:_0x19b73d[_0x3071('0x97')];switch(_0x19b73d[_0x3071('0x97')]){case _0x3071('0x98'):_0x4eb2f0=squel[_0x3071('0x99')]()[_0x3071('0x9a')]('cm_hopper')['fromQuery']([_0x3071('0x9b'),_0x3071('0x9c'),_0x3071('0x9d'),_0x3071('0x9e'),_0x3071('0x65'),_0x3071('0x5b'),'updatedAt'],squel[_0x3071('0x9f')]()[_0x3071('0xa0')](_0x3071('0x9b'),_0x3071('0x9b'))[_0x3071('0xa0')](_0x3071('0xa1'),'scheduledAt')[_0x3071('0xa0')]('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')](),_0x3071('0x9e'))['field'](_0x50cb8c['params']['id'][_0x3071('0x86')](),_0x3071('0x65'))['field'](_0x3071('0xa1'),_0x3071('0x5b'))[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x5c'))[_0x3071('0x80')](_0x3071('0xa3'))[_0x3071('0x45')](_0x3071('0xa4'))[_0x3071('0x45')](_0x3071('0xa5'),_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x3071('0x45')](_0x3071('0xa6'),squel[_0x3071('0x9f')]()[_0x3071('0xa0')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x3071('0xa7'))[_0x3071('0x45')](_0x3071('0x83'),_0x50cb8c[_0x3071('0x59')]['id']['toString']()))['where'](_0x3071('0xa6'),squel['select']()[_0x3071('0xa0')](_0x3071('0xa8'))[_0x3071('0x80')](_0x3071('0xa9'))[_0x3071('0x45')](_0x3071('0x83'),_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')]())))[_0x3071('0x86')]();break;case _0x3071('0xaa'):_0x4eb2f0=squel[_0x3071('0x99')]()[_0x3071('0x9a')](_0x3071('0xa9'))[_0x3071('0xab')](['phone',_0x3071('0x9c'),_0x3071('0x9d'),_0x3071('0x9e'),_0x3071('0x65'),_0x3071('0x5b'),_0x3071('0x5c')],squel['select']()[_0x3071('0xa0')]('phone',_0x3071('0x9b'))[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x9c'))['field']('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')](),_0x3071('0x9e'))[_0x3071('0xa0')](_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')](),'VoiceQueueId')[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x5b'))['field'](_0x3071('0xa1'),'updatedAt')[_0x3071('0x80')](_0x3071('0xa3'))[_0x3071('0x45')]('deletedAt\x20IS\x20NULL')['where'](_0x3071('0xa5'),_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')]())[_0x3071('0x45')](_0x3071('0xac'))[_0x3071('0x45')](_0x3071('0xa6'),squel[_0x3071('0x9f')]()[_0x3071('0xa0')](_0x3071('0xa8'))[_0x3071('0x80')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')]())))['toString']();break;default:_0x4eb2f0=squel[_0x3071('0x99')]()[_0x3071('0x9a')](_0x3071('0xa9'))[_0x3071('0xab')]([_0x3071('0x9b'),_0x3071('0x9c'),_0x3071('0x9d'),_0x3071('0x9e'),'VoiceQueueId',_0x3071('0x5b'),_0x3071('0x5c')],squel[_0x3071('0x9f')]()['field'](_0x3071('0x9b'),_0x3071('0x9b'))[_0x3071('0xa0')](_0x3071('0xa1'),_0x3071('0x9c'))['field']('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x35bf60[_0x3071('0xa2')][_0x3071('0x86')](),'ListId')[_0x3071('0xa0')](_0x50cb8c[_0x3071('0x59')]['id'][_0x3071('0x86')](),_0x3071('0x65'))[_0x3071('0xa0')]('NOW()',_0x3071('0x5b'))['field']('NOW()',_0x3071('0x5c'))[_0x3071('0x80')](_0x3071('0xa3'))['where'](_0x3071('0xa4'))['where'](_0x3071('0xa5'),_0x35bf60[_0x3071('0xa2')]['toString']())[_0x3071('0x45')](_0x3071('0xac')))[_0x3071('0x86')]();}_0x51e4b1['push'](db[_0x3071('0x74')][_0x3071('0x3c')](_0x4eb2f0));}return BPromise[_0x3071('0x89')](_0x51e4b1);}})[_0x3071('0x2a')](function(){return _0x4d0f2a;})[_0x3071('0x2a')](respondWithResult(_0x13d977,null))[_0x3071('0x4b')](handleError(_0x13d977,null));};exports[_0x3071('0xad')]=function(_0x41f46a,_0x453fa6,_0x80af16){return db['VoiceQueue'][_0x3071('0x35')]({'where':{'id':_0x41f46a[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x453fa6,null))[_0x3071('0x2a')](function(_0x18fbc3){if(_0x18fbc3){return _0x18fbc3[_0x3071('0xad')](_0x41f46a[_0x3071('0x3c')][_0x3071('0x8c')]);}})[_0x3071('0x2a')](function(_0x2673a5){if(_0x2673a5){return db['CmHopper'][_0x3071('0x29')]({'where':{'ListId':_0x41f46a[_0x3071('0x3c')]['ids'],'VoiceQueueId':_0x41f46a['params']['id']}})[_0x3071('0x2a')](function(){return _0x2673a5;});}})[_0x3071('0x2a')](respondWithStatusCode(_0x453fa6,null))[_0x3071('0x4b')](handleError(_0x453fa6,null));};exports[_0x3071('0xae')]=function(_0x3d957e,_0x401cc5,_0xb08066){var _0x2f5966={};var _0x58557e={};var _0xc3f6f9;var _0x21f445;return db[_0x3071('0x39')]['findOne']({'where':{'id':_0x3d957e[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x401cc5,null))['then'](function(_0x46f138){if(_0x46f138){_0xc3f6f9=_0x46f138;_0x58557e[_0x3071('0x3b')]=_[_0x3071('0x3d')](db[_0x3071('0xaf')][_0x3071('0x4c')]);_0x58557e[_0x3071('0x3c')]=_[_0x3071('0x3d')](_0x3d957e[_0x3071('0x3c')]);_0x58557e[_0x3071('0x3e')]=_['intersection'](_0x58557e['model'],_0x58557e[_0x3071('0x3c')]);_0x2f5966['attributes']=_['intersection'](_0x58557e[_0x3071('0x3b')],qs[_0x3071('0x41')](_0x3d957e[_0x3071('0x3c')][_0x3071('0x41')]));_0x2f5966['attributes']=_0x2f5966['attributes']['length']?_0x2f5966[_0x3071('0x40')]:_0x58557e[_0x3071('0x3b')];_0x2f5966[_0x3071('0x62')]=qs[_0x3071('0x44')](_0x3d957e['query'][_0x3071('0x44')]);_0x2f5966[_0x3071('0x45')]=qs['filters'](_[_0x3071('0x46')](_0x3d957e['query'],_0x58557e['filters']));if(_0x3d957e[_0x3071('0x3c')][_0x3071('0x2f')]){_0x2f5966[_0x3071('0x45')]=_[_0x3071('0x47')](_0x2f5966[_0x3071('0x45')],{'$or':_[_0x3071('0x31')](_0x2f5966['attributes'],function(_0x39bf1d){var _0x1e703b={};_0x1e703b[_0x39bf1d]={'$like':'%'+_0x3d957e[_0x3071('0x3c')][_0x3071('0x2f')]+'%'};return _0x1e703b;})});}_0x2f5966=_[_0x3071('0x47')]({},_0x2f5966,_0x3d957e[_0x3071('0x48')]);return _0xc3f6f9[_0x3071('0xae')](_0x2f5966);}})[_0x3071('0x2a')](function(_0x56642a){if(_0x56642a){_0x21f445=_0x56642a[_0x3071('0x42')];if(!_0x3d957e['query'][_0x3071('0x43')](_0x3071('0x61'))){_0x2f5966[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x3d957e['query'][_0x3071('0x24')]);_0x2f5966[_0x3071('0x23')]=qs['offset'](_0x3d957e[_0x3071('0x3c')][_0x3071('0x23')]);}return _0xc3f6f9[_0x3071('0xae')](_0x2f5966);}})[_0x3071('0x2a')](function(_0x46f8cf){if(_0x46f8cf){return _0x46f8cf?{'count':_0x21f445,'rows':_0x46f8cf}:null;}})[_0x3071('0x2a')](respondWithResult(_0x401cc5,null))[_0x3071('0x4b')](handleError(_0x401cc5,null));};exports[_0x3071('0xb0')]=function(_0x2b92f5,_0x369200,_0x4287b4){var _0x43860c,_0x185fef;return db[_0x3071('0x39')]['find']({'where':{'id':_0x2b92f5[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x369200,null))['then'](function(_0x3543bb){if(_0x3543bb){_0x185fef=_0x3543bb;return _0x3543bb[_0x3071('0xb0')](_0x2b92f5['body'][_0x3071('0x8c')],_[_0x3071('0x5a')](_0x2b92f5[_0x3071('0x50')],[_0x3071('0x8c'),'id'])||{});}return null;})[_0x3071('0x90')](function(_0x27a834){var _0x624078;_0x43860c=_0x27a834||[];var _0x911c8c=[];if(_0x27a834){for(var _0x32776b=0x0;_0x32776b<_0x27a834[_0x3071('0x42')];_0x32776b+=0x1){var _0x5a98c7=_0x27a834[_0x32776b]['get']({'plain':!![]});_0x624078=squel[_0x3071('0x99')]()[_0x3071('0x9a')]('cm_hopper_black')[_0x3071('0xab')]([_0x3071('0x9b'),_0x3071('0x9d'),'ListId','VoiceQueueId',_0x3071('0x5b'),_0x3071('0x5c')],squel[_0x3071('0x9f')]()[_0x3071('0xa0')]('phone',_0x3071('0x9b'))['field']('id',_0x3071('0x9d'))[_0x3071('0xa0')](_0x5a98c7[_0x3071('0xa2')][_0x3071('0x86')](),'ListId')['field'](_0x2b92f5[_0x3071('0x59')]['id'][_0x3071('0x86')](),_0x3071('0x65'))[_0x3071('0xa0')]('NOW()','createdAt')['field']('NOW()',_0x3071('0x5c'))[_0x3071('0x80')](_0x3071('0xa3'))[_0x3071('0x45')](_0x3071('0xa4'))[_0x3071('0x45')]('ListId\x20=\x20?',_0x5a98c7[_0x3071('0xa2')][_0x3071('0x86')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x3071('0x86')]();_0x911c8c[_0x3071('0x85')](db[_0x3071('0x74')][_0x3071('0x3c')](_0x624078));}return BPromise[_0x3071('0x89')](_0x911c8c);}})['then'](function(){return _0x43860c;})[_0x3071('0x2a')](respondWithResult(_0x369200,null))[_0x3071('0x4b')](handleError(_0x369200,null));};exports['removeBlackLists']=function(_0x2c9ebe,_0x16f73b,_0xb628a){return db[_0x3071('0x39')]['find']({'where':{'id':_0x2c9ebe[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x16f73b,null))[_0x3071('0x2a')](function(_0x57dc29){if(_0x57dc29){return _0x57dc29[_0x3071('0xb1')](_0x2c9ebe[_0x3071('0x3c')][_0x3071('0x8c')]);}})[_0x3071('0x2a')](function(_0x41fb16){if(_0x41fb16){return db[_0x3071('0x68')]['destroy']({'where':{'ListId':_0x2c9ebe[_0x3071('0x3c')]['ids'],'VoiceQueueId':_0x2c9ebe[_0x3071('0x59')]['id']}})[_0x3071('0x2a')](function(){return _0x41fb16;});}})[_0x3071('0x2a')](respondWithStatusCode(_0x16f73b,null))[_0x3071('0x4b')](handleError(_0x16f73b,null));}; \ No newline at end of file +var _0xcb91=['field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','userVoiceQueue:save','push','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','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','localhost','socket.io-emitter','redis','./voiceQueue.socket','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','get','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','UserProfileResource','end','error','name','send','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','rows','catch','show','params','length','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','outbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','role','UserProfileSection','getHoppers','findOne','VoiceQueueId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','removeTeams','ids','select'];(function(_0x2496da,_0x3fe1fc){var _0x4caae0=function(_0x378012){while(--_0x378012){_0x2496da['push'](_0x2496da['shift']());}};_0x4caae0(++_0x3fe1fc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4da356,_0x5235e1){_0x4da356=_0x4da356-0x0;var _0x321b07=_0xcb91[_0x4da356];return _0x321b07;};'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'];config['redis']=_['defaults'](config['redis'],{'host':_0x1cb9('0x17'),'port':0x18eb});var socket=require(_0x1cb9('0x18'))(new Redis(config[_0x1cb9('0x19')]));require(_0x1cb9('0x1a'))['register'](socket);function respondWithStatusCode(_0x397727,_0x6ef389){_0x6ef389=_0x6ef389||0xcc;return function(_0x1b3cd7){if(_0x1b3cd7){return _0x397727[_0x1cb9('0x1b')](_0x6ef389);}return _0x397727[_0x1cb9('0x1c')](_0x6ef389)['end']();};}function respondWithResult(_0x5572cb,_0xd446a3){_0xd446a3=_0xd446a3||0xc8;return function(_0x3cc765){if(_0x3cc765){return _0x5572cb[_0x1cb9('0x1c')](_0xd446a3)[_0x1cb9('0x1d')](_0x3cc765);}};}function respondWithFilteredResult(_0x3e21e0,_0xf22920){return function(_0x23d3a9){if(_0x23d3a9){var _0x4e1340=_0x23d3a9[_0x1cb9('0x1e')],_0x479d43=_0xf22920[_0x1cb9('0x1f')],_0x1b2fa6=_0xf22920[_0x1cb9('0x1f')]+_0xf22920[_0x1cb9('0x20')],_0x41ac41;if(_0x1b2fa6>=_0x4e1340){_0x1b2fa6=_0x4e1340;_0x41ac41=0xc8;}else{_0x41ac41=0xce;}_0x3e21e0[_0x1cb9('0x1c')](_0x41ac41);return _0x3e21e0['set']('Content-Range',_0x479d43+'-'+_0x1b2fa6+'/'+_0x4e1340)[_0x1cb9('0x1d')](_0x23d3a9);}return null;};}function patchUpdates(_0x5dbfae){return function(_0x4750b1){try{jsonpatch[_0x1cb9('0x21')](_0x4750b1,_0x5dbfae,!![]);}catch(_0x523b26){return BPromise['reject'](_0x523b26);}return _0x4750b1[_0x1cb9('0x22')]();};}function saveUpdates(_0x325637,_0x103a63){return function(_0x4601b8){if(_0x4601b8){return _0x4601b8[_0x1cb9('0x23')](_0x325637)[_0x1cb9('0x24')](function(_0x59ebea){return _0x59ebea;});}return null;};}function removeEntity(_0x55b232,_0x6c6f61){return function(_0x557199){if(_0x557199){return _0x557199[_0x1cb9('0x25')]()[_0x1cb9('0x24')](function(){var _0x69b4c8=_0x557199[_0x1cb9('0x26')]({'plain':!![]});var _0x43a100=[{'name':'VoiceQueues','value':_0x1cb9('0x27'),'ignore':![]},{'name':_0x1cb9('0x28'),'value':'outbound','ignore':![]}];var _0xd6891c=_(_0x43a100)[_0x1cb9('0x29')](_0x1cb9('0x2a'))[_0x1cb9('0x2b')](_0x1cb9('0x2c'))[_0x1cb9('0x2c')]();if(_[_0x1cb9('0x2d')](_0xd6891c,_0x69b4c8[_0x1cb9('0x2e')])){return;}var _0x41e5c2=_[_0x1cb9('0x2f')](_0x43a100,['value',_0x69b4c8[_0x1cb9('0x2e')]])['name'];return db[_0x1cb9('0x30')]['destroy']({'where':{'type':_0x41e5c2,'resourceId':_0x69b4c8['id']}})[_0x1cb9('0x24')](function(){return _0x557199;});})[_0x1cb9('0x24')](function(){_0x55b232[_0x1cb9('0x1c')](0xcc)[_0x1cb9('0x31')]();});}};}function handleEntityNotFound(_0x561d89,_0x1c701f){return function(_0x4eba82){if(!_0x4eba82){_0x561d89[_0x1cb9('0x1b')](0x194);}return _0x4eba82;};}function handleError(_0x336a98,_0x4220d7){_0x4220d7=_0x4220d7||0x1f4;return function(_0x5d8793){logger[_0x1cb9('0x32')](_0x5d8793['stack']);if(_0x5d8793[_0x1cb9('0x33')]){delete _0x5d8793['name'];}_0x336a98[_0x1cb9('0x1c')](_0x4220d7)[_0x1cb9('0x34')](_0x5d8793);};}exports[_0x1cb9('0x35')]=function(_0xae910,_0x56c3e0){var _0x2114a4={},_0xf71b9a={},_0x3467d5={'count':0x0,'rows':[]};var _0x91a1db=_[_0x1cb9('0x2b')](db[_0x1cb9('0x36')][_0x1cb9('0x37')],function(_0x1ed5ad){return{'name':_0x1ed5ad[_0x1cb9('0x38')],'type':_0x1ed5ad[_0x1cb9('0x2e')][_0x1cb9('0x39')]};});_0xf71b9a[_0x1cb9('0x3a')]=_[_0x1cb9('0x2b')](_0x91a1db,'name');_0xf71b9a['query']=_[_0x1cb9('0x3b')](_0xae910[_0x1cb9('0x3c')]);_0xf71b9a[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0xf71b9a[_0x1cb9('0x3a')],_0xf71b9a[_0x1cb9('0x3c')]);_0x2114a4[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0xf71b9a['model'],qs[_0x1cb9('0x40')](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x2114a4['attributes']=_0x2114a4[_0x1cb9('0x3f')]['length']?_0x2114a4[_0x1cb9('0x3f')]:_0xf71b9a['model'];if(!_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0x2114a4[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x2114a4['offset']=qs['offset'](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0x2114a4[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x2114a4[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x46')](_0xae910['query'],_0xf71b9a['filters']),_0x91a1db);if(_0xae910['query'][_0x1cb9('0x29')]){_0x2114a4[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x2114a4[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x91a1db,function(_0x4f551f){if(_0x4f551f[_0x1cb9('0x2e')]!=='VIRTUAL'){var _0x91121={};_0x91121[_0x4f551f[_0x1cb9('0x33')]]={'$like':'%'+_0xae910[_0x1cb9('0x3c')]['filter']+'%'};return _0x91121;}})});}_0x2114a4=_[_0x1cb9('0x47')]({},_0x2114a4,_0xae910['options']);var _0xda1a44={'where':_0x2114a4[_0x1cb9('0x45')]};return db['VoiceQueue']['count'](_0xda1a44)[_0x1cb9('0x24')](function(_0x339829){_0x3467d5[_0x1cb9('0x1e')]=_0x339829;if(_0xae910[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x2114a4['include']=[{'all':!![]}];}return db[_0x1cb9('0x36')]['findAll'](_0x2114a4);})['then'](function(_0x495335){_0x3467d5[_0x1cb9('0x49')]=_0x495335;return _0x3467d5;})[_0x1cb9('0x24')](respondWithFilteredResult(_0x56c3e0,_0x2114a4))[_0x1cb9('0x4a')](handleError(_0x56c3e0,null));};exports[_0x1cb9('0x4b')]=function(_0x116c05,_0x2a8b7f){var _0x40ca68={'raw':![],'where':{'id':_0x116c05[_0x1cb9('0x4c')]['id']}},_0x409b89={};_0x409b89[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db['VoiceQueue'][_0x1cb9('0x37')]);_0x409b89[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x116c05['query']);_0x409b89[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x409b89[_0x1cb9('0x3a')],_0x409b89[_0x1cb9('0x3c')]);_0x40ca68[_0x1cb9('0x3f')]=_['intersection'](_0x409b89[_0x1cb9('0x3a')],qs['fields'](_0x116c05[_0x1cb9('0x3c')]['fields']));_0x40ca68[_0x1cb9('0x3f')]=_0x40ca68[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x40ca68[_0x1cb9('0x3f')]:_0x409b89['model'];if(_0x116c05[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x40ca68[_0x1cb9('0x4e')]=[{'all':!![]}];}_0x40ca68=_[_0x1cb9('0x47')]({},_0x40ca68,_0x116c05[_0x1cb9('0x4f')]);return db[_0x1cb9('0x36')][_0x1cb9('0x2f')](_0x40ca68)[_0x1cb9('0x24')](handleEntityNotFound(_0x2a8b7f,null))[_0x1cb9('0x24')](respondWithResult(_0x2a8b7f,null))[_0x1cb9('0x4a')](handleError(_0x2a8b7f,null));};exports['create']=function(_0x5092a6,_0x28c65d){return db[_0x1cb9('0x36')][_0x1cb9('0x50')](_0x5092a6[_0x1cb9('0x51')],{})[_0x1cb9('0x24')](function(_0x2d076b){var _0x367dd7=_0x5092a6[_0x1cb9('0x52')][_0x1cb9('0x26')]({'plain':!![]});if(!_0x367dd7)throw new Error(_0x1cb9('0x53'));if(_0x367dd7['role']===_0x1cb9('0x52')){var _0x5e773d=_0x2d076b[_0x1cb9('0x26')]({'plain':!![]});var _0x5201e8=[{'name':_0x1cb9('0x54'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x1cb9('0x55')}];var _0x3b0c2e=_[_0x1cb9('0x2f')](_0x5201e8,['value',_0x5e773d[_0x1cb9('0x2e')]])[_0x1cb9('0x33')];return db['UserProfileSection']['find']({'where':{'name':_0x3b0c2e,'userProfileId':_0x367dd7[_0x1cb9('0x56')]},'raw':!![]})[_0x1cb9('0x24')](function(_0x3e70fc){if(_0x3e70fc&&_0x3e70fc[_0x1cb9('0x57')]===0x0){return db[_0x1cb9('0x30')][_0x1cb9('0x50')]({'name':_0x5e773d[_0x1cb9('0x33')],'resourceId':_0x5e773d['id'],'type':_0x3e70fc['name'],'sectionId':_0x3e70fc['id']},{})[_0x1cb9('0x24')](function(){return _0x2d076b;});}else{return _0x2d076b;}})[_0x1cb9('0x4a')](function(_0x108551){logger['error'](_0x1cb9('0x58'),_0x108551);throw _0x108551;});}return _0x2d076b;})[_0x1cb9('0x24')](respondWithResult(_0x28c65d,0xc9))[_0x1cb9('0x4a')](handleError(_0x28c65d,null));};exports[_0x1cb9('0x59')]=function(_0x12d283,_0x3c4681){var _0x5ae762={'where':{'id':_0x12d283[_0x1cb9('0x4c')]['id']}},_0x37ceb5={};_0x37ceb5[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x36')][_0x1cb9('0x37')]);_0x5ae762[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x37ceb5[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x12d283[_0x1cb9('0x3c')]['fields']));_0x5ae762[_0x1cb9('0x3f')]=_0x5ae762[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x5ae762[_0x1cb9('0x3f')]:_0x37ceb5['model'];if(_0x12d283['query'][_0x1cb9('0x48')]){_0x5ae762[_0x1cb9('0x4e')]=[{'all':!![]}];}_0x5ae762=_[_0x1cb9('0x47')]({},_0x5ae762,_0x12d283[_0x1cb9('0x4f')]);return db[_0x1cb9('0x36')][_0x1cb9('0x2f')](_0x5ae762)[_0x1cb9('0x24')](handleEntityNotFound(_0x3c4681,null))[_0x1cb9('0x24')](function(_0x478bba){if(_0x478bba){var _0x49f74c=_0x478bba[_0x1cb9('0x26')]({'plain':!![]});_0x49f74c=qs['omit'](_0x49f74c,['id','createdAt','updatedAt']);_0x12d283['body']=_['omit'](_0x12d283[_0x1cb9('0x51')],['id',_0x1cb9('0x5a'),_0x1cb9('0x5b')]);return db[_0x1cb9('0x36')][_0x1cb9('0x50')](_[_0x1cb9('0x47')](_0x49f74c,_0x12d283['body']),{'include':_0x12d283[_0x1cb9('0x3c')][_0x1cb9('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x58c7ed){var _0x150441=_0x12d283[_0x1cb9('0x52')][_0x1cb9('0x26')]({'plain':!![]});if(!_0x150441)throw new Error(_0x1cb9('0x53'));if(_0x150441[_0x1cb9('0x5c')]==='user'){var _0x538ff0=_0x58c7ed['get']({'plain':!![]});var _0x270282=[{'name':_0x1cb9('0x54'),'value':_0x1cb9('0x27')},{'name':_0x1cb9('0x28'),'value':_0x1cb9('0x55')}];var _0x59bad0=_[_0x1cb9('0x2f')](_0x270282,[_0x1cb9('0x2c'),_0x538ff0['type']])['name'];return db[_0x1cb9('0x5d')]['find']({'where':{'name':_0x59bad0,'userProfileId':_0x150441[_0x1cb9('0x56')]},'raw':!![]})[_0x1cb9('0x24')](function(_0x2c54ea){if(_0x2c54ea&&_0x2c54ea[_0x1cb9('0x57')]===0x0){return db[_0x1cb9('0x30')][_0x1cb9('0x50')]({'name':_0x538ff0['name'],'resourceId':_0x538ff0['id'],'type':_0x2c54ea[_0x1cb9('0x33')],'sectionId':_0x2c54ea['id']},{})[_0x1cb9('0x24')](function(){return _0x58c7ed;});}else{return _0x58c7ed;}})[_0x1cb9('0x4a')](function(_0x17c361){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17c361);throw _0x17c361;});}return _0x58c7ed;});}})[_0x1cb9('0x24')](respondWithResult(_0x3c4681,0xc9))[_0x1cb9('0x4a')](handleError(_0x3c4681,null));};exports[_0x1cb9('0x23')]=function(_0x1ee140,_0x210b0b){if(_0x1ee140[_0x1cb9('0x51')]['id']){delete _0x1ee140['body']['id'];}return db[_0x1cb9('0x36')]['find']({'where':{'id':_0x1ee140[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x210b0b,null))['then'](saveUpdates(_0x1ee140[_0x1cb9('0x51')],null))[_0x1cb9('0x24')](respondWithResult(_0x210b0b,null))[_0x1cb9('0x4a')](handleError(_0x210b0b,null));};exports['destroy']=function(_0x1b4878,_0x95be29){return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x1b4878[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x95be29,null))['then'](removeEntity(_0x95be29,null))[_0x1cb9('0x4a')](handleError(_0x95be29,null));};exports[_0x1cb9('0x5e')]=function(_0x38d6a7,_0x4398dc,_0x3d3c1a){var _0x1da41c={'raw':![],'where':{}};var _0x128a41={};var _0x37bcd9={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x1cb9('0x5f')]({'where':{'id':_0x38d6a7[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4398dc,null))[_0x1cb9('0x24')](function(_0x5415fa){if(_0x5415fa){_0x128a41[_0x1cb9('0x3a')]=_['keys'](db['CmHopper'][_0x1cb9('0x37')]);_0x128a41[_0x1cb9('0x3c')]=_['keys'](_0x38d6a7[_0x1cb9('0x3c')]);_0x128a41['filters']=_[_0x1cb9('0x3e')](_0x128a41[_0x1cb9('0x3a')],_0x128a41[_0x1cb9('0x3c')]);_0x1da41c[_0x1cb9('0x3f')]=_['intersection'](_0x128a41[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x1da41c[_0x1cb9('0x3f')]=_0x1da41c[_0x1cb9('0x3f')]['length']?_0x1da41c[_0x1cb9('0x3f')]:_0x128a41[_0x1cb9('0x3a')];if(!_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0x1da41c[_0x1cb9('0x20')]=qs['limit'](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x1da41c['offset']=qs[_0x1cb9('0x1f')](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0x1da41c[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x1da41c['where']=qs[_0x1cb9('0x3d')](_['pick'](_0x38d6a7[_0x1cb9('0x3c')],_0x128a41[_0x1cb9('0x3d')]));_0x1da41c['where'][_0x1cb9('0x60')]=_0x5415fa['id'];if(_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x1da41c[_0x1cb9('0x45')]=_['merge'](_0x1da41c[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x1da41c[_0x1cb9('0x3f')],function(_0x5d0e8c){var _0x10f13e={};_0x10f13e[_0x5d0e8c]={'$like':'%'+_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x10f13e;})});}_0x1da41c=_[_0x1cb9('0x47')]({},_0x1da41c,_0x38d6a7[_0x1cb9('0x4f')]);return db[_0x1cb9('0x61')][_0x1cb9('0x1e')]({'where':_0x1da41c['where']})[_0x1cb9('0x24')](function(_0x4b15a4){_0x37bcd9[_0x1cb9('0x1e')]=_0x4b15a4;if(_0x38d6a7[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x1da41c[_0x1cb9('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x1cb9('0x62')](_0x1da41c);})[_0x1cb9('0x24')](function(_0x5e68a1){_0x37bcd9[_0x1cb9('0x49')]=_0x5e68a1;return _0x37bcd9;});}})[_0x1cb9('0x24')](respondWithFilteredResult(_0x4398dc,_0x1da41c))[_0x1cb9('0x4a')](handleError(_0x4398dc,null));};exports[_0x1cb9('0x63')]=function(_0x453fa3,_0x52a3f1,_0x5e0e56){var _0x544d2d={'raw':!![],'where':{}};var _0x5ad853={};var _0x19daa1={'count':0x0,'rows':[]};return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x453fa3[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x52a3f1,null))[_0x1cb9('0x24')](function(_0x1e6402){if(_0x1e6402){_0x5ad853[_0x1cb9('0x3a')]=_['keys'](db[_0x1cb9('0x64')][_0x1cb9('0x37')]);_0x5ad853[_0x1cb9('0x3c')]=_['keys'](_0x453fa3[_0x1cb9('0x3c')]);_0x5ad853[_0x1cb9('0x3d')]=_['intersection'](_0x5ad853[_0x1cb9('0x3a')],_0x5ad853[_0x1cb9('0x3c')]);_0x544d2d[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x5ad853['model'],qs[_0x1cb9('0x40')](_0x453fa3[_0x1cb9('0x3c')]['fields']));_0x544d2d['attributes']=_0x544d2d[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x544d2d['attributes']:_0x5ad853['model'];if(!_0x453fa3[_0x1cb9('0x3c')][_0x1cb9('0x41')]('nolimit')){_0x544d2d['limit']=qs[_0x1cb9('0x20')](_0x453fa3['query']['limit']);_0x544d2d['offset']=qs[_0x1cb9('0x1f')](_0x453fa3['query'][_0x1cb9('0x1f')]);}_0x544d2d[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x453fa3['query'][_0x1cb9('0x44')]);_0x544d2d[_0x1cb9('0x45')]=qs[_0x1cb9('0x3d')](_['pick'](_0x453fa3[_0x1cb9('0x3c')],_0x5ad853[_0x1cb9('0x3d')]));_0x544d2d[_0x1cb9('0x45')][_0x1cb9('0x60')]=_0x1e6402['id'];if(_0x453fa3[_0x1cb9('0x3c')]['filter']){_0x544d2d[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x544d2d[_0x1cb9('0x45')],{'$or':_['map'](_0x544d2d[_0x1cb9('0x3f')],function(_0x81962d){var _0x534378={};_0x534378[_0x81962d]={'$like':'%'+_0x453fa3[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x534378;})});}_0x544d2d=_['merge']({},_0x544d2d,_0x453fa3[_0x1cb9('0x4f')]);return db[_0x1cb9('0x64')][_0x1cb9('0x1e')]({'where':_0x544d2d[_0x1cb9('0x45')]})[_0x1cb9('0x24')](function(_0x1768b8){_0x19daa1[_0x1cb9('0x1e')]=_0x1768b8;if(_0x453fa3[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0x544d2d[_0x1cb9('0x4e')]=[{'all':!![]}];}return db[_0x1cb9('0x64')][_0x1cb9('0x62')](_0x544d2d);})[_0x1cb9('0x24')](function(_0x1b2b1c){_0x19daa1[_0x1cb9('0x49')]=_0x1b2b1c;return _0x19daa1;});}})[_0x1cb9('0x24')](respondWithFilteredResult(_0x52a3f1,_0x544d2d))[_0x1cb9('0x4a')](handleError(_0x52a3f1,null));};exports[_0x1cb9('0x65')]=function(_0x48e879,_0x508a75,_0x13ba32){var _0x94d2c2={'raw':!![],'where':{}};var _0x20af42={};var _0x35f64f={'count':0x0,'rows':[]};return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x48e879[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x508a75,null))['then'](function(_0x1d14a4){if(_0x1d14a4){_0x20af42[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x66')][_0x1cb9('0x37')]);_0x20af42['query']=_[_0x1cb9('0x3b')](_0x48e879[_0x1cb9('0x3c')]);_0x20af42[_0x1cb9('0x3d')]=_['intersection'](_0x20af42[_0x1cb9('0x3a')],_0x20af42[_0x1cb9('0x3c')]);_0x94d2c2[_0x1cb9('0x3f')]=_['intersection'](_0x20af42[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x48e879[_0x1cb9('0x3c')]['fields']));_0x94d2c2['attributes']=_0x94d2c2['attributes'][_0x1cb9('0x4d')]?_0x94d2c2[_0x1cb9('0x3f')]:_0x20af42[_0x1cb9('0x3a')];if(!_0x48e879['query'][_0x1cb9('0x41')]('nolimit')){_0x94d2c2['limit']=qs[_0x1cb9('0x20')](_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x94d2c2[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0x94d2c2[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x48e879[_0x1cb9('0x3c')]['sort']);_0x94d2c2['where']=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x48e879['query'],_0x20af42['filters']));_0x94d2c2['where']['VoiceQueueId']=_0x1d14a4['id'];if(_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x94d2c2['where']=_[_0x1cb9('0x47')](_0x94d2c2[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x94d2c2[_0x1cb9('0x3f')],function(_0x169b0f){var _0x5218ea={};_0x5218ea[_0x169b0f]={'$like':'%'+_0x48e879[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x5218ea;})});}_0x94d2c2=_[_0x1cb9('0x47')]({},_0x94d2c2,_0x48e879[_0x1cb9('0x4f')]);return db['CmHopperFinal'][_0x1cb9('0x1e')]({'where':_0x94d2c2[_0x1cb9('0x45')]})['then'](function(_0x5ee95a){_0x35f64f['count']=_0x5ee95a;if(_0x48e879[_0x1cb9('0x3c')]['includeAll']){_0x94d2c2[_0x1cb9('0x4e')]=[{'all':!![]}];}return db[_0x1cb9('0x66')][_0x1cb9('0x62')](_0x94d2c2);})[_0x1cb9('0x24')](function(_0x31d1e5){_0x35f64f[_0x1cb9('0x49')]=_0x31d1e5;return _0x35f64f;});}})['then'](respondWithFilteredResult(_0x508a75,_0x94d2c2))[_0x1cb9('0x4a')](handleError(_0x508a75,null));};exports[_0x1cb9('0x67')]=function(_0x3726ba,_0x242cad,_0x699d37){var _0xf8e83f={'raw':!![],'where':{}};var _0x237e3b={};var _0x21e3fb={'count':0x0,'rows':[]};return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x3726ba[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x242cad,null))[_0x1cb9('0x24')](function(_0x1022d8){if(_0x1022d8){_0x237e3b[_0x1cb9('0x3a')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x237e3b[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x3726ba['query']);_0x237e3b[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x237e3b[_0x1cb9('0x3a')],_0x237e3b['query']);_0xf8e83f[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x237e3b[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x3726ba[_0x1cb9('0x3c')]['fields']));_0xf8e83f[_0x1cb9('0x3f')]=_0xf8e83f['attributes']['length']?_0xf8e83f[_0x1cb9('0x3f')]:_0x237e3b[_0x1cb9('0x3a')];if(!_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0xf8e83f[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x3726ba[_0x1cb9('0x3c')]['limit']);_0xf8e83f[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}_0xf8e83f[_0x1cb9('0x43')]=qs['sort'](_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0xf8e83f[_0x1cb9('0x45')]=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x3726ba['query'],_0x237e3b[_0x1cb9('0x3d')]));_0xf8e83f[_0x1cb9('0x45')][_0x1cb9('0x60')]=_0x1022d8['id'];if(_0x3726ba['query'][_0x1cb9('0x29')]){_0xf8e83f[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0xf8e83f[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0xf8e83f[_0x1cb9('0x3f')],function(_0x4e3ad0){var _0x45dc8c={};_0x45dc8c[_0x4e3ad0]={'$like':'%'+_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x45dc8c;})});}_0xf8e83f=_['merge']({},_0xf8e83f,_0x3726ba[_0x1cb9('0x4f')]);return db[_0x1cb9('0x68')]['count']({'where':_0xf8e83f['where']})[_0x1cb9('0x24')](function(_0x3fc823){_0x21e3fb[_0x1cb9('0x1e')]=_0x3fc823;if(_0x3726ba[_0x1cb9('0x3c')][_0x1cb9('0x48')]){_0xf8e83f['include']=[{'all':!![]}];}return db[_0x1cb9('0x68')][_0x1cb9('0x62')](_0xf8e83f);})[_0x1cb9('0x24')](function(_0x3180dd){_0x21e3fb[_0x1cb9('0x49')]=_0x3180dd;return _0x21e3fb;});}})['then'](respondWithFilteredResult(_0x242cad,_0xf8e83f))['catch'](handleError(_0x242cad,null));};exports[_0x1cb9('0x69')]=function(_0x35383b,_0x9f2cb1,_0x4f7cc8){var _0x53c35a={};var _0x40d403={};var _0x3c4b2b;var _0x33d06a;return db['VoiceQueue']['findOne']({'where':{'id':_0x35383b['params']['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x9f2cb1,null))[_0x1cb9('0x24')](function(_0x27995f){if(_0x27995f){_0x3c4b2b=_0x27995f;_0x40d403['model']=_[_0x1cb9('0x3b')](db['Team'][_0x1cb9('0x37')]);_0x40d403[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x35383b[_0x1cb9('0x3c')]);_0x40d403[_0x1cb9('0x3d')]=_['intersection'](_0x40d403[_0x1cb9('0x3a')],_0x40d403['query']);_0x53c35a[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x40d403[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x35383b[_0x1cb9('0x3c')]['fields']));_0x53c35a[_0x1cb9('0x3f')]=_0x53c35a[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x53c35a[_0x1cb9('0x3f')]:_0x40d403[_0x1cb9('0x3a')];_0x53c35a[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x35383b['query']['sort']);_0x53c35a[_0x1cb9('0x45')]=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x35383b[_0x1cb9('0x3c')],_0x40d403[_0x1cb9('0x3d')]));if(_0x35383b['query'][_0x1cb9('0x29')]){_0x53c35a[_0x1cb9('0x45')]=_['merge'](_0x53c35a['where'],{'$or':_[_0x1cb9('0x2b')](_0x53c35a['attributes'],function(_0x2f5a5f){var _0x4af9bb={};_0x4af9bb[_0x2f5a5f]={'$like':'%'+_0x35383b[_0x1cb9('0x3c')][_0x1cb9('0x29')]+'%'};return _0x4af9bb;})});}_0x53c35a=_[_0x1cb9('0x47')]({},_0x53c35a,_0x35383b[_0x1cb9('0x4f')]);return _0x3c4b2b[_0x1cb9('0x69')](_0x53c35a);}})[_0x1cb9('0x24')](function(_0x2c7326){if(_0x2c7326){_0x33d06a=_0x2c7326[_0x1cb9('0x4d')];if(!_0x35383b[_0x1cb9('0x3c')][_0x1cb9('0x41')](_0x1cb9('0x42'))){_0x53c35a[_0x1cb9('0x20')]=qs['limit'](_0x35383b['query']['limit']);_0x53c35a['offset']=qs[_0x1cb9('0x1f')](_0x35383b[_0x1cb9('0x3c')]['offset']);}return _0x3c4b2b['getTeams'](_0x53c35a);}})['then'](function(_0x3cf4ff){if(_0x3cf4ff){return _0x3cf4ff?{'count':_0x33d06a,'rows':_0x3cf4ff}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x9f2cb1,null))[_0x1cb9('0x4a')](handleError(_0x9f2cb1,null));};exports[_0x1cb9('0x6a')]=function(_0x4d66d3,_0x178cba,_0x2492a0){var _0x436364=_0x4d66d3['body'][_0x1cb9('0x6b')];var _0x2d9fcb=_['map'](_0x436364,'id');return db[_0x1cb9('0x6c')]['findAll']({'where':{'id':_0x2d9fcb},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x6d')],'as':_0x1cb9('0x6e'),'attributes':['id',_0x1cb9('0x33'),_0x1cb9('0x6f'),_0x1cb9('0x70'),_0x1cb9('0x71')],'raw':!![]}]})[_0x1cb9('0x24')](function(_0x4ea5ae){if(_0x4ea5ae){var _0x183bdb=_[_0x1cb9('0x72')](_0x4ea5ae,function(_0x21c0ab){var _0x384183=_0x21c0ab[_0x1cb9('0x26')]({'plain':!![]});_0x384183[_0x1cb9('0x6e')][_0x1cb9('0x73')](function(_0xd171b9){_0xd171b9[_0x1cb9('0x74')]=_[_0x1cb9('0x2f')](_0x436364,{'id':_0x384183['id']})['penalty'];});return _0x384183[_0x1cb9('0x6e')];});return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x4d66d3[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](function(_0x523fdb){return db[_0x1cb9('0x75')]['transaction'](function(_0x51770e){return _0x523fdb[_0x1cb9('0x6a')](_0x2d9fcb,{'transaction':_0x51770e})[_0x1cb9('0x24')](function(){return BPromise[_0x1cb9('0x76')](_0x183bdb,function(_0x182e0d){return db[_0x1cb9('0x77')][_0x1cb9('0x78')]({'where':{'UserId':_0x182e0d['id'],'VoiceQueueId':_0x4d66d3[_0x1cb9('0x4c')]['id']},'defaults':{'penalty':_0x182e0d[_0x1cb9('0x74')]},'transaction':_0x51770e});});})[_0x1cb9('0x24')](function(){return BPromise['each'](_['filter'](_0x183bdb,{'online':!![]}),function(_0x98f5cf){return db[_0x1cb9('0x79')][_0x1cb9('0x7a')]({'membername':_0x98f5cf[_0x1cb9('0x33')],'UserId':_0x98f5cf['id'],'queue_name':_0x523fdb[_0x1cb9('0x33')],'VoiceQueueId':_0x523fdb['id'],'interface':_[_0x1cb9('0x7b')](_0x98f5cf[_0x1cb9('0x71')])?util[_0x1cb9('0x7c')](_0x1cb9('0x7d'),_0x98f5cf[_0x1cb9('0x33')]):_0x98f5cf['interface'],'paused':_0x98f5cf[_0x1cb9('0x70')]||![],'penalty':_0x98f5cf[_0x1cb9('0x74')]},{'transaction':_0x51770e});});})[_0x1cb9('0x24')](function(){_0x183bdb[_0x1cb9('0x73')](function(_0xd38514){socket[_0x1cb9('0x7e')]('userVoiceQueue:save',{'UserId':_0xd38514['id'],'VoiceQueueId':_0x523fdb['id']});});});});});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x178cba,null))[_0x1cb9('0x4a')](handleError(_0x178cba,null));};exports[_0x1cb9('0x7f')]=function(_0x40f1e3,_0x3d72d7,_0x1bf6a4){return db[_0x1cb9('0x6c')]['findAll']({'where':{'id':_0x40f1e3[_0x1cb9('0x3c')][_0x1cb9('0x80')]},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x6d')],'as':_0x1cb9('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x1cb9('0x24')](handleEntityNotFound(_0x3d72d7,null))[_0x1cb9('0x24')](function(_0x399537){var _0x1ad996=_[_0x1cb9('0x2b')](_0x399537,'id');var _0x42622e=[];var _0x27390a=[];var _0x36761a=squel[_0x1cb9('0x81')]();_0x36761a[_0x1cb9('0x82')](_0x1cb9('0x83'))[_0x1cb9('0x84')](_0x1cb9('0x85'),'tq')[_0x1cb9('0x86')](_0x1cb9('0x87'),'ut',_0x1cb9('0x88'))[_0x1cb9('0x45')](_0x1cb9('0x89'),_0x40f1e3['params']['id']);for(var _0x11a83c=0x0;_0x11a83c<_0x399537[_0x1cb9('0x4d')];_0x11a83c+=0x1){let _0x16ec06=_0x399537[_0x11a83c];for(var _0x9ab004=0x0;_0x9ab004<_0x16ec06[_0x1cb9('0x6e')][_0x1cb9('0x4d')];_0x9ab004+=0x1){let _0x4cd6fc=_0x16ec06[_0x1cb9('0x6e')][_0x9ab004];var _0x56e26b=_0x36761a[_0x1cb9('0x59')]();_0x56e26b[_0x1cb9('0x45')](_0x1cb9('0x8a'),_0x4cd6fc['id']);_0x27390a['push'](db[_0x1cb9('0x75')][_0x1cb9('0x3c')](_0x56e26b[_0x1cb9('0x8b')](),{'type':db[_0x1cb9('0x75')]['QueryTypes'][_0x1cb9('0x8c')]})[_0x1cb9('0x24')](function(_0x3557bd){if(_0x3557bd[_0x1cb9('0x4d')]===0x1){return _0x4cd6fc['id'];}else{var _0x4f0c63=_[_0x1cb9('0x8d')](_[_0x1cb9('0x2b')](_0x3557bd,'TeamId'),function(_0x21d844){return _[_0x1cb9('0x2d')](_0x1ad996,_0x21d844);});if(_0x4f0c63){return _0x4cd6fc['id'];}}}));}}return BPromise[_0x1cb9('0x8e')](_0x27390a)[_0x1cb9('0x24')](function(_0x196350){_0x42622e=_(_0x42622e)[_0x1cb9('0x8f')](_0x196350)[_0x1cb9('0x90')]()[_0x1cb9('0x2c')]();return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x40f1e3[_0x1cb9('0x4c')]['id']}})['then'](function(_0x2d2180){return db['sequelize'][_0x1cb9('0x91')](function(_0x328e5a){return _0x2d2180[_0x1cb9('0x7f')](_0x40f1e3[_0x1cb9('0x3c')][_0x1cb9('0x80')],{'transaction':_0x328e5a})[_0x1cb9('0x24')](function(){if(!_[_0x1cb9('0x92')](_0x42622e)){return _0x2d2180[_0x1cb9('0x93')](_0x42622e,{'transaction':_0x328e5a})[_0x1cb9('0x24')](function(){return db[_0x1cb9('0x79')][_0x1cb9('0x25')]({'where':{'VoiceQueueId':_0x40f1e3[_0x1cb9('0x4c')]['id'],'UserId':_0x42622e},'transaction':_0x328e5a});});}})[_0x1cb9('0x24')](function(){_0x42622e['forEach'](function(_0x44b50d){socket[_0x1cb9('0x7e')](_0x1cb9('0x94'),{'UserId':_0x44b50d,'VoiceQueueId':_0x2d2180['id']});});});});});});})['then'](respondWithStatusCode(_0x3d72d7,null))['catch'](handleError(_0x3d72d7,null));};exports['addAgents']=function(_0x46e35d,_0x2dd501,_0x5018c5){var _0x47d696,_0x31627f;return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x46e35d[_0x1cb9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2dd501,null))[_0x1cb9('0x24')](function(_0x149b0c){if(_0x149b0c){_0x31627f=_0x149b0c;return _0x149b0c[_0x1cb9('0x95')](_0x46e35d[_0x1cb9('0x51')]['ids'],_[_0x1cb9('0x96')](_0x46e35d[_0x1cb9('0x51')],[_0x1cb9('0x80'),'id'])||{})[_0x1cb9('0x97')](function(_0x463d1c){for(var _0x3908a8=0x0;_0x3908a8<_0x46e35d['body'][_0x1cb9('0x80')][_0x1cb9('0x4d')];_0x3908a8+=0x1){socket[_0x1cb9('0x7e')](_0x1cb9('0x98'),{'UserId':_0x46e35d[_0x1cb9('0x51')][_0x1cb9('0x80')][_0x3908a8],'VoiceQueueId':_0x46e35d[_0x1cb9('0x4c')]['id']});}return _0x463d1c;});}})[_0x1cb9('0x24')](function(_0xa43246){_0x47d696=_0xa43246||[];if(_0x31627f){return db[_0x1cb9('0x6d')][_0x1cb9('0x62')]({'where':{'id':_0x46e35d['body'][_0x1cb9('0x80')]},'attributes':['id',_0x1cb9('0x33'),'online',_0x1cb9('0x70'),'interface'],'raw':!![]});}})[_0x1cb9('0x24')](function(_0x28f70a){if(!_[_0x1cb9('0x92')](_0x28f70a)){var _0x46fb97=[];for(var _0x193c14=0x0;_0x193c14<_0x28f70a[_0x1cb9('0x4d')];_0x193c14++){if(_0x28f70a[_0x193c14][_0x1cb9('0x6f')]){_0x46fb97[_0x1cb9('0x99')](db[_0x1cb9('0x79')]['upsert']({'membername':_0x28f70a[_0x193c14]['name'],'UserId':_0x28f70a[_0x193c14]['id'],'queue_name':_0x31627f['name'],'VoiceQueueId':_0x31627f['id'],'interface':_[_0x1cb9('0x7b')](_0x28f70a[_0x193c14][_0x1cb9('0x71')])?util[_0x1cb9('0x7c')]('SIP/%s',_0x28f70a[_0x193c14][_0x1cb9('0x33')]):_0x28f70a[_0x193c14][_0x1cb9('0x71')],'paused':_0x28f70a[_0x193c14][_0x1cb9('0x70')]||![],'penalty':_0x46e35d[_0x1cb9('0x51')]['penalty']||0x0}));}}return BPromise['all'](_0x46fb97);}})[_0x1cb9('0x24')](function(){return _0x47d696;})[_0x1cb9('0x24')](respondWithResult(_0x2dd501,null))['catch'](handleError(_0x2dd501,null));};exports[_0x1cb9('0x93')]=function(_0x3b7e24,_0x5c58a7,_0x18132b){return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x3b7e24['params']['id']}})['then'](handleEntityNotFound(_0x5c58a7,null))[_0x1cb9('0x24')](function(_0x73fc01){if(_0x73fc01){return _0x73fc01['removeAgents'](_0x3b7e24[_0x1cb9('0x3c')][_0x1cb9('0x80')])[_0x1cb9('0x24')](function(){if(_[_0x1cb9('0x9a')](_0x3b7e24['query'][_0x1cb9('0x80')])){for(var _0xb76fc2=0x0;_0xb76fc2<_0x3b7e24[_0x1cb9('0x3c')][_0x1cb9('0x80')][_0x1cb9('0x4d')];_0xb76fc2+=0x1){socket['emit'](_0x1cb9('0x94'),{'UserId':Number(_0x3b7e24['query'][_0x1cb9('0x80')][_0xb76fc2]),'VoiceQueueId':Number(_0x3b7e24['params']['id'])});}}else{socket[_0x1cb9('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x3b7e24[_0x1cb9('0x3c')][_0x1cb9('0x80')]),'VoiceQueueId':Number(_0x3b7e24[_0x1cb9('0x4c')]['id'])});}});}})[_0x1cb9('0x24')](function(_0x3f54a8){return db[_0x1cb9('0x79')][_0x1cb9('0x25')]({'where':{'VoiceQueueId':_0x3b7e24[_0x1cb9('0x4c')]['id'],'UserId':_0x3b7e24['query'][_0x1cb9('0x80')]}})[_0x1cb9('0x24')](function(){return _0x3f54a8;});})[_0x1cb9('0x24')](respondWithStatusCode(_0x5c58a7,null))[_0x1cb9('0x4a')](handleError(_0x5c58a7,null));};exports[_0x1cb9('0x9b')]=function(_0x42f11b,_0x55fa4a,_0x4e85b0){var _0x335df3={};var _0x155ee5={};var _0x40ad48;var _0x17a6a2;return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x42f11b['params']['id']}})['then'](handleEntityNotFound(_0x55fa4a,null))[_0x1cb9('0x24')](function(_0x416300){if(_0x416300){_0x40ad48=_0x416300;_0x155ee5[_0x1cb9('0x3a')]=_['keys'](db[_0x1cb9('0x6d')][_0x1cb9('0x37')]);_0x155ee5[_0x1cb9('0x3c')]=_['keys'](_0x42f11b[_0x1cb9('0x3c')]);_0x155ee5[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x155ee5[_0x1cb9('0x3a')],_0x155ee5[_0x1cb9('0x3c')]);_0x335df3[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x155ee5[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x335df3[_0x1cb9('0x3f')]=_0x335df3['attributes'][_0x1cb9('0x4d')]?_0x335df3['attributes']:_0x155ee5['model'];_0x335df3['order']=qs['sort'](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x335df3['where']=qs[_0x1cb9('0x3d')](_['pick'](_0x42f11b[_0x1cb9('0x3c')],_0x155ee5[_0x1cb9('0x3d')]));if(_0x42f11b[_0x1cb9('0x3c')]['filter']){_0x335df3[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x335df3[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x335df3[_0x1cb9('0x3f')],function(_0x27064d){var _0x2ddb5f={};_0x2ddb5f[_0x27064d]={'$like':'%'+_0x42f11b[_0x1cb9('0x3c')]['filter']+'%'};return _0x2ddb5f;})});}_0x335df3=_[_0x1cb9('0x47')]({},_0x335df3,_0x42f11b['options']);return _0x40ad48[_0x1cb9('0x9b')](_0x335df3);}})['then'](function(_0xb75f4d){if(_0xb75f4d){_0x17a6a2=_0xb75f4d[_0x1cb9('0x4d')];if(!_0x42f11b[_0x1cb9('0x3c')]['hasOwnProperty'](_0x1cb9('0x42'))){_0x335df3[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x335df3['offset']=qs[_0x1cb9('0x1f')](_0x42f11b[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}return _0x40ad48['getAgents'](_0x335df3);}})[_0x1cb9('0x24')](function(_0x1978d3){if(_0x1978d3){return _0x1978d3?{'count':_0x17a6a2,'rows':_0x1978d3}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x55fa4a,null))[_0x1cb9('0x4a')](handleError(_0x55fa4a,null));};exports['getMembers']=function(_0x25486c,_0x4ee661,_0x4e7706){var _0x327071={};var _0x48afe4={};var _0x209ba0;var _0x57685a;return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x25486c['params']['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x4ee661,null))[_0x1cb9('0x24')](function(_0x14cfb9){if(_0x14cfb9){_0x209ba0=_0x14cfb9;_0x48afe4[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x79')]['rawAttributes']);_0x48afe4[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x25486c[_0x1cb9('0x3c')]);_0x48afe4[_0x1cb9('0x3d')]=_[_0x1cb9('0x3e')](_0x48afe4[_0x1cb9('0x3a')],_0x48afe4['query']);_0x327071['attributes']=_[_0x1cb9('0x3e')](_0x48afe4[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x25486c[_0x1cb9('0x3c')]['fields']));_0x327071[_0x1cb9('0x3f')]=_0x327071[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x327071['attributes']:_0x48afe4[_0x1cb9('0x3a')];_0x327071[_0x1cb9('0x43')]=qs['sort'](_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x44')]);_0x327071['where']=qs[_0x1cb9('0x3d')](_[_0x1cb9('0x46')](_0x25486c[_0x1cb9('0x3c')],_0x48afe4[_0x1cb9('0x3d')]));if(_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x327071[_0x1cb9('0x45')]=_['merge'](_0x327071[_0x1cb9('0x45')],{'$or':_['map'](_0x327071[_0x1cb9('0x3f')],function(_0x1bb6e2){var _0x11869b={};_0x11869b[_0x1bb6e2]={'$like':'%'+_0x25486c[_0x1cb9('0x3c')]['filter']+'%'};return _0x11869b;})});}_0x327071=_[_0x1cb9('0x47')]({},_0x327071,_0x25486c[_0x1cb9('0x4f')]);return _0x209ba0[_0x1cb9('0x9c')](_0x327071);}})['then'](function(_0x3acaf7){if(_0x3acaf7){_0x57685a=_0x3acaf7['length'];if(!_0x25486c['query'][_0x1cb9('0x41')]('nolimit')){_0x327071[_0x1cb9('0x20')]=qs['limit'](_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x327071[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x25486c[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}return _0x209ba0[_0x1cb9('0x9c')](_0x327071);}})[_0x1cb9('0x24')](function(_0x1a4b8c){return _0x1a4b8c?{'count':_0x57685a,'rows':_0x1a4b8c}:null;})[_0x1cb9('0x24')](respondWithResult(_0x4ee661,null))[_0x1cb9('0x4a')](handleError(_0x4ee661,null));};exports[_0x1cb9('0x9d')]=function(_0x1b40ed,_0x50c592,_0x362ccf){var _0x183798={};var _0x572f51={};var _0x530922;var _0xc2f0cc;return db[_0x1cb9('0x36')][_0x1cb9('0x5f')]({'where':{'id':_0x1b40ed['params']['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x50c592,null))[_0x1cb9('0x24')](function(_0x55d14f){if(_0x55d14f){_0x530922=_0x55d14f;_0x572f51[_0x1cb9('0x3a')]=_[_0x1cb9('0x3b')](db[_0x1cb9('0x9e')][_0x1cb9('0x37')]);_0x572f51[_0x1cb9('0x3c')]=_[_0x1cb9('0x3b')](_0x1b40ed['query']);_0x572f51[_0x1cb9('0x3d')]=_['intersection'](_0x572f51[_0x1cb9('0x3a')],_0x572f51['query']);_0x183798[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x572f51[_0x1cb9('0x3a')],qs[_0x1cb9('0x40')](_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x183798['attributes']=_0x183798[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x183798[_0x1cb9('0x3f')]:_0x572f51['model'];_0x183798['order']=qs[_0x1cb9('0x44')](_0x1b40ed['query'][_0x1cb9('0x44')]);_0x183798[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x46')](_0x1b40ed[_0x1cb9('0x3c')],_0x572f51[_0x1cb9('0x3d')]));if(_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x183798[_0x1cb9('0x45')]=_[_0x1cb9('0x47')](_0x183798[_0x1cb9('0x45')],{'$or':_[_0x1cb9('0x2b')](_0x183798[_0x1cb9('0x3f')],function(_0x31f74e){var _0x209a74={};_0x209a74[_0x31f74e]={'$like':'%'+_0x1b40ed['query'][_0x1cb9('0x29')]+'%'};return _0x209a74;})});}_0x183798=_[_0x1cb9('0x47')]({},_0x183798,_0x1b40ed[_0x1cb9('0x4f')]);return _0x530922[_0x1cb9('0x9d')](_0x183798);}})[_0x1cb9('0x24')](function(_0x5d0cd8){if(_0x5d0cd8){_0xc2f0cc=_0x5d0cd8[_0x1cb9('0x4d')];if(!_0x1b40ed[_0x1cb9('0x3c')]['hasOwnProperty'](_0x1cb9('0x42'))){_0x183798[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x183798[_0x1cb9('0x1f')]=qs['offset'](_0x1b40ed[_0x1cb9('0x3c')][_0x1cb9('0x1f')]);}return _0x530922['getLists'](_0x183798);}})[_0x1cb9('0x24')](function(_0x16aaad){if(_0x16aaad){return _0x16aaad?{'count':_0xc2f0cc,'rows':_0x16aaad}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x50c592,null))['catch'](handleError(_0x50c592,null));};exports['addLists']=function(_0x465b41,_0x1ee133,_0x1c4e81){var _0x43b7b1,_0x26368f;return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x465b41['params']['id']}})['then'](handleEntityNotFound(_0x1ee133,null))['then'](function(_0x272cbc){if(_0x272cbc){_0x26368f=_0x272cbc;return _0x272cbc['addLists'](_0x465b41[_0x1cb9('0x51')][_0x1cb9('0x80')],_[_0x1cb9('0x96')](_0x465b41[_0x1cb9('0x51')],[_0x1cb9('0x80'),'id'])||{});}return null;})['spread'](function(_0x46ae55){var _0x590374;_0x43b7b1=_0x46ae55||[];var _0x4ecf13=[];if(_0x46ae55){for(var _0x2a4878=0x0;_0x2a4878<_0x46ae55[_0x1cb9('0x4d')];_0x2a4878+=0x1){var _0x267b06=_0x46ae55[_0x2a4878]['get']({'plain':!![]});_0x26368f[_0x1cb9('0x9f')]=_0x465b41[_0x1cb9('0x51')][_0x1cb9('0x9f')]?_0x465b41[_0x1cb9('0x51')][_0x1cb9('0x9f')]:_0x26368f[_0x1cb9('0x9f')];switch(_0x26368f[_0x1cb9('0x9f')]){case _0x1cb9('0xa0'):_0x590374=squel[_0x1cb9('0xa1')]()[_0x1cb9('0xa2')](_0x1cb9('0xa3'))[_0x1cb9('0xa4')]([_0x1cb9('0xa5'),_0x1cb9('0xa6'),_0x1cb9('0xa7'),'ListId',_0x1cb9('0x60'),'createdAt','updatedAt'],squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xa5'),_0x1cb9('0xa5'))[_0x1cb9('0x82')](_0x1cb9('0xa8'),_0x1cb9('0xa6'))['field']('id','ContactId')['field'](_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),'ListId')['field'](_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')](),_0x1cb9('0x60'))['field'](_0x1cb9('0xa8'),_0x1cb9('0x5a'))['field'](_0x1cb9('0xa8'),_0x1cb9('0x5b'))[_0x1cb9('0x84')](_0x1cb9('0xaa'))[_0x1cb9('0x45')](_0x1cb9('0xab'))['where']('ListId\x20=\x20?',_0x267b06['CmListId'][_0x1cb9('0x8b')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x81')]()['field'](_0x1cb9('0xac'))['from'](_0x1cb9('0xad'))['where'](_0x1cb9('0x89'),_0x465b41[_0x1cb9('0x4c')]['id']['toString']()))[_0x1cb9('0x45')](_0x1cb9('0xae'),squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xaf'))['from'](_0x1cb9('0xa3'))['where'](_0x1cb9('0x89'),_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')]())))[_0x1cb9('0x8b')]();break;case _0x1cb9('0xb0'):_0x590374=squel[_0x1cb9('0xa1')]()[_0x1cb9('0xa2')](_0x1cb9('0xa3'))['fromQuery'](['phone','scheduledAt',_0x1cb9('0xa7'),_0x1cb9('0xb1'),_0x1cb9('0x60'),_0x1cb9('0x5a'),_0x1cb9('0x5b')],squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xa5'),_0x1cb9('0xa5'))['field']('NOW()',_0x1cb9('0xa6'))[_0x1cb9('0x82')]('id',_0x1cb9('0xa7'))[_0x1cb9('0x82')](_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),_0x1cb9('0xb1'))[_0x1cb9('0x82')](_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')](),'VoiceQueueId')[_0x1cb9('0x82')](_0x1cb9('0xa8'),_0x1cb9('0x5a'))[_0x1cb9('0x82')]('NOW()',_0x1cb9('0x5b'))[_0x1cb9('0x84')](_0x1cb9('0xaa'))[_0x1cb9('0x45')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x45')](_0x1cb9('0xb2'),_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')]())[_0x1cb9('0x45')](_0x1cb9('0xb3'))[_0x1cb9('0x45')](_0x1cb9('0xae'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x1cb9('0x84')]('cm_hopper')['where'](_0x1cb9('0x89'),_0x465b41[_0x1cb9('0x4c')]['id']['toString']())))[_0x1cb9('0x8b')]();break;default:_0x590374=squel[_0x1cb9('0xa1')]()['into'](_0x1cb9('0xa3'))[_0x1cb9('0xa4')](['phone',_0x1cb9('0xa6'),_0x1cb9('0xa7'),_0x1cb9('0xb1'),_0x1cb9('0x60'),_0x1cb9('0x5a'),_0x1cb9('0x5b')],squel['select']()['field'](_0x1cb9('0xa5'),_0x1cb9('0xa5'))['field'](_0x1cb9('0xa8'),_0x1cb9('0xa6'))[_0x1cb9('0x82')]('id','ContactId')['field'](_0x267b06[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),'ListId')[_0x1cb9('0x82')](_0x465b41[_0x1cb9('0x4c')]['id'][_0x1cb9('0x8b')](),'VoiceQueueId')['field'](_0x1cb9('0xa8'),_0x1cb9('0x5a'))[_0x1cb9('0x82')](_0x1cb9('0xa8'),'updatedAt')[_0x1cb9('0x84')](_0x1cb9('0xaa'))[_0x1cb9('0x45')](_0x1cb9('0xab'))[_0x1cb9('0x45')]('ListId\x20=\x20?',_0x267b06['CmListId'][_0x1cb9('0x8b')]())[_0x1cb9('0x45')](_0x1cb9('0xb3')))[_0x1cb9('0x8b')]();}_0x4ecf13[_0x1cb9('0x99')](db[_0x1cb9('0x75')]['query'](_0x590374));}return BPromise[_0x1cb9('0x8e')](_0x4ecf13);}})['then'](function(){return _0x43b7b1;})[_0x1cb9('0x24')](respondWithResult(_0x1ee133,null))[_0x1cb9('0x4a')](handleError(_0x1ee133,null));};exports['removeLists']=function(_0x49444a,_0x1f3976,_0x3fb70a){return db['VoiceQueue'][_0x1cb9('0x2f')]({'where':{'id':_0x49444a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x1f3976,null))[_0x1cb9('0x24')](function(_0x3ea026){if(_0x3ea026){return _0x3ea026[_0x1cb9('0xb4')](_0x49444a[_0x1cb9('0x3c')][_0x1cb9('0x80')]);}})[_0x1cb9('0x24')](function(_0x2db8b9){if(_0x2db8b9){return db[_0x1cb9('0x61')][_0x1cb9('0x25')]({'where':{'ListId':_0x49444a[_0x1cb9('0x3c')]['ids'],'VoiceQueueId':_0x49444a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](function(){return _0x2db8b9;});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x1f3976,null))[_0x1cb9('0x4a')](handleError(_0x1f3976,null));};exports[_0x1cb9('0xb5')]=function(_0x355c3a,_0x5c9814,_0xd4ba25){var _0x1a6c4c={};var _0x4f4e04={};var _0x209197;var _0x35e3f4;return db['VoiceQueue'][_0x1cb9('0x5f')]({'where':{'id':_0x355c3a[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x5c9814,null))[_0x1cb9('0x24')](function(_0x2a799f){if(_0x2a799f){_0x209197=_0x2a799f;_0x4f4e04[_0x1cb9('0x3a')]=_['keys'](db[_0x1cb9('0x9e')][_0x1cb9('0x37')]);_0x4f4e04[_0x1cb9('0x3c')]=_['keys'](_0x355c3a[_0x1cb9('0x3c')]);_0x4f4e04['filters']=_['intersection'](_0x4f4e04[_0x1cb9('0x3a')],_0x4f4e04[_0x1cb9('0x3c')]);_0x1a6c4c[_0x1cb9('0x3f')]=_[_0x1cb9('0x3e')](_0x4f4e04['model'],qs[_0x1cb9('0x40')](_0x355c3a[_0x1cb9('0x3c')][_0x1cb9('0x40')]));_0x1a6c4c[_0x1cb9('0x3f')]=_0x1a6c4c[_0x1cb9('0x3f')][_0x1cb9('0x4d')]?_0x1a6c4c[_0x1cb9('0x3f')]:_0x4f4e04['model'];_0x1a6c4c[_0x1cb9('0x43')]=qs[_0x1cb9('0x44')](_0x355c3a[_0x1cb9('0x3c')]['sort']);_0x1a6c4c[_0x1cb9('0x45')]=qs['filters'](_[_0x1cb9('0x46')](_0x355c3a[_0x1cb9('0x3c')],_0x4f4e04[_0x1cb9('0x3d')]));if(_0x355c3a[_0x1cb9('0x3c')][_0x1cb9('0x29')]){_0x1a6c4c['where']=_['merge'](_0x1a6c4c['where'],{'$or':_['map'](_0x1a6c4c[_0x1cb9('0x3f')],function(_0x48fa02){var _0x35302e={};_0x35302e[_0x48fa02]={'$like':'%'+_0x355c3a['query'][_0x1cb9('0x29')]+'%'};return _0x35302e;})});}_0x1a6c4c=_[_0x1cb9('0x47')]({},_0x1a6c4c,_0x355c3a[_0x1cb9('0x4f')]);return _0x209197[_0x1cb9('0xb5')](_0x1a6c4c);}})[_0x1cb9('0x24')](function(_0x138763){if(_0x138763){_0x35e3f4=_0x138763[_0x1cb9('0x4d')];if(!_0x355c3a[_0x1cb9('0x3c')]['hasOwnProperty'](_0x1cb9('0x42'))){_0x1a6c4c[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x355c3a[_0x1cb9('0x3c')][_0x1cb9('0x20')]);_0x1a6c4c['offset']=qs['offset'](_0x355c3a[_0x1cb9('0x3c')]['offset']);}return _0x209197['getBlackLists'](_0x1a6c4c);}})['then'](function(_0x331c18){if(_0x331c18){return _0x331c18?{'count':_0x35e3f4,'rows':_0x331c18}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x5c9814,null))[_0x1cb9('0x4a')](handleError(_0x5c9814,null));};exports[_0x1cb9('0xb6')]=function(_0x836ef4,_0x5a407f,_0x19ac33){var _0x12e221,_0x5cd228;return db[_0x1cb9('0x36')][_0x1cb9('0x2f')]({'where':{'id':_0x836ef4[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x5a407f,null))[_0x1cb9('0x24')](function(_0x74cb14){if(_0x74cb14){_0x5cd228=_0x74cb14;return _0x74cb14[_0x1cb9('0xb6')](_0x836ef4['body'][_0x1cb9('0x80')],_['omit'](_0x836ef4['body'],[_0x1cb9('0x80'),'id'])||{});}return null;})['spread'](function(_0x2c9609){var _0x169e38;_0x12e221=_0x2c9609||[];var _0x2b4f5c=[];if(_0x2c9609){for(var _0x50bed6=0x0;_0x50bed6<_0x2c9609[_0x1cb9('0x4d')];_0x50bed6+=0x1){var _0x290bb3=_0x2c9609[_0x50bed6][_0x1cb9('0x26')]({'plain':!![]});_0x169e38=squel[_0x1cb9('0xa1')]()[_0x1cb9('0xa2')](_0x1cb9('0xb7'))['fromQuery']([_0x1cb9('0xa5'),_0x1cb9('0xa7'),'ListId','VoiceQueueId',_0x1cb9('0x5a'),_0x1cb9('0x5b')],squel[_0x1cb9('0x81')]()[_0x1cb9('0x82')](_0x1cb9('0xa5'),'phone')[_0x1cb9('0x82')]('id','ContactId')[_0x1cb9('0x82')](_0x290bb3[_0x1cb9('0xa9')][_0x1cb9('0x8b')](),_0x1cb9('0xb1'))[_0x1cb9('0x82')](_0x836ef4['params']['id'][_0x1cb9('0x8b')](),'VoiceQueueId')[_0x1cb9('0x82')]('NOW()',_0x1cb9('0x5a'))[_0x1cb9('0x82')]('NOW()',_0x1cb9('0x5b'))['from'](_0x1cb9('0xaa'))[_0x1cb9('0x45')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x45')](_0x1cb9('0xb2'),_0x290bb3[_0x1cb9('0xa9')][_0x1cb9('0x8b')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x8b')]();_0x2b4f5c[_0x1cb9('0x99')](db[_0x1cb9('0x75')][_0x1cb9('0x3c')](_0x169e38));}return BPromise['all'](_0x2b4f5c);}})[_0x1cb9('0x24')](function(){return _0x12e221;})[_0x1cb9('0x24')](respondWithResult(_0x5a407f,null))['catch'](handleError(_0x5a407f,null));};exports[_0x1cb9('0xb8')]=function(_0x18a18f,_0x202c3a,_0x5b39f7){return db[_0x1cb9('0x36')]['find']({'where':{'id':_0x18a18f[_0x1cb9('0x4c')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x202c3a,null))['then'](function(_0x10f6f6){if(_0x10f6f6){return _0x10f6f6[_0x1cb9('0xb8')](_0x18a18f[_0x1cb9('0x3c')]['ids']);}})[_0x1cb9('0x24')](function(_0x3d4a83){if(_0x3d4a83){return db['CmHopperBlack'][_0x1cb9('0x25')]({'where':{'ListId':_0x18a18f[_0x1cb9('0x3c')][_0x1cb9('0x80')],'VoiceQueueId':_0x18a18f[_0x1cb9('0x4c')]['id']}})['then'](function(){return _0x3d4a83;});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x202c3a,null))['catch'](handleError(_0x202c3a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e04c99a..5af9749 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 _0xe5d5=['update','remove','emit','hook','exports','../../mysqldb','save'];(function(_0x52c1e1,_0x5d4e83){var _0x25d937=function(_0x5ca63b){while(--_0x5ca63b){_0x52c1e1['push'](_0x52c1e1['shift']());}};_0x25d937(++_0x5d4e83);}(_0xe5d5,0x1ef));var _0x5e5d=function(_0x4d1cba,_0x37d7ab){_0x4d1cba=_0x4d1cba-0x0;var _0x16d31f=_0xe5d5[_0x4d1cba];return _0x16d31f;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x5e5d('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e5d('0x1'),'afterUpdate':_0x5e5d('0x2'),'afterDestroy':_0x5e5d('0x3')};function emitEvent(_0x3df3a3){return function(_0x568647,_0x3ea8c6,_0xbe1b1){VoiceQueueEvents[_0x5e5d('0x4')](_0x3df3a3+':'+_0x568647['id'],_0x568647);VoiceQueueEvents['emit'](_0x3df3a3,_0x568647);_0xbe1b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x5e5d('0x5')](e,emitEvent(event));}}module[_0x5e5d('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0xd564=['setMaxListeners','save','emit','hook','exports','events','../../mysqldb','VoiceQueue'];(function(_0x4d201f,_0x1e7617){var _0x65976d=function(_0x1e2775){while(--_0x1e2775){_0x4d201f['push'](_0x4d201f['shift']());}};_0x65976d(++_0x1e7617);}(_0xd564,0x13d));var _0x4d56=function(_0x41d89b,_0x271b20){_0x41d89b=_0x41d89b-0x0;var _0x13e704=_0xd564[_0x41d89b];return _0x13e704;};'use strict';var EventEmitter=require(_0x4d56('0x0'));var VoiceQueue=require(_0x4d56('0x1'))['db'][_0x4d56('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4d56('0x3')](0x0);var events={'afterCreate':_0x4d56('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4f117d){return function(_0x2fb2fb,_0x33af7f,_0x3b2ed6){VoiceQueueEvents['emit'](_0x4f117d+':'+_0x2fb2fb['id'],_0x2fb2fb);VoiceQueueEvents[_0x4d56('0x5')](_0x4f117d,_0x2fb2fb);_0x3b2ed6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x4d56('0x6')](e,emitEvent(event));}}module[_0x4d56('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 134a0c8..847d0f5 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 _0x0550=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0550,0x180));var _0x0055=function(_0x151553,_0x295f9c){_0x151553=_0x151553-0x0;var _0x1a0ad6=_0x0550[_0x151553];return _0x1a0ad6;};'use strict';var _=require('lodash');var util=require(_0x0055('0x0'));var logger=require(_0x0055('0x1'))(_0x0055('0x2'));var moment=require('moment');var BPromise=require(_0x0055('0x3'));var rp=require(_0x0055('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0055('0x5'));var config=require(_0x0055('0x6'));var attributes=require(_0x0055('0x7'));module[_0x0055('0x8')]=function(_0x1b7614,_0x14c1e2){return _0x1b7614[_0x0055('0x9')](_0x0055('0xa'),attributes,{'tableName':_0x0055('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e5f=['VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','request-promise','./voiceQueue.attributes','exports','define'];(function(_0x39780c,_0x5782c9){var _0x53c19b=function(_0x594f01){while(--_0x594f01){_0x39780c['push'](_0x39780c['shift']());}};_0x53c19b(++_0x5782c9);}(_0x2e5f,0x124));var _0xf2e5=function(_0x482429,_0x28a377){_0x482429=_0x482429-0x0;var _0x4fa305=_0x2e5f[_0x482429];return _0x4fa305;};'use strict';var _=require(_0xf2e5('0x0'));var util=require('util');var logger=require(_0xf2e5('0x1'))(_0xf2e5('0x2'));var moment=require(_0xf2e5('0x3'));var BPromise=require('bluebird');var rp=require(_0xf2e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf2e5('0x5'));module[_0xf2e5('0x6')]=function(_0x1ebf83,_0x1a61fb){return _0x1ebf83[_0xf2e5('0x7')](_0xf2e5('0x8'),attributes,{'tableName':_0xf2e5('0x9'),'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 ef3eb92..758c629 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 _0x2a7d=['result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','map','include','model','attributes','find','ShowVoiceQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2431d6,_0x25189a){var _0x4d0f9b=function(_0x52cd84){while(--_0x52cd84){_0x2431d6['push'](_0x2431d6['shift']());}};_0x4d0f9b(++_0x25189a);}(_0x2a7d,0x1d5));var _0xd2a7=function(_0x5205aa,_0x5af85c){_0x5205aa=_0x5205aa-0x0;var _0x312590=_0x2a7d[_0x5205aa];return _0x312590;};'use strict';var _=require(_0xd2a7('0x0'));var util=require(_0xd2a7('0x1'));var moment=require(_0xd2a7('0x2'));var BPromise=require(_0xd2a7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd2a7('0x4'));var db=require(_0xd2a7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd2a7('0x6'))(_0xd2a7('0x7'));var config=require(_0xd2a7('0x8'));var jayson=require(_0xd2a7('0x9'));var client=jayson[_0xd2a7('0xa')]['http']({'port':0x232a});config[_0xd2a7('0xb')]=_[_0xd2a7('0xc')](config[_0xd2a7('0xb')],{'host':_0xd2a7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2a7('0xb')]));require('./voiceQueue.socket')[_0xd2a7('0xe')](socket);function respondWithRpcPromise(_0x563595,_0x40c3a0,_0x549e64){return new BPromise(function(_0x2a0465,_0x3cd623){return client['request'](_0x563595,_0x549e64)[_0xd2a7('0xf')](function(_0x350a09){logger[_0xd2a7('0x10')](_0xd2a7('0x11'),_0x40c3a0,_0xd2a7('0x12'));logger[_0xd2a7('0x13')](_0xd2a7('0x14'),_0x40c3a0,'request\x20sent',JSON[_0xd2a7('0x15')](_0x350a09));if(_0x350a09['error']){if(_0x350a09[_0xd2a7('0x16')][_0xd2a7('0x17')]===0x1f4){logger[_0xd2a7('0x16')](_0xd2a7('0x11'),_0x40c3a0,_0x350a09[_0xd2a7('0x16')][_0xd2a7('0x18')]);return _0x3cd623(_0x350a09[_0xd2a7('0x16')][_0xd2a7('0x18')]);}logger[_0xd2a7('0x16')](_0xd2a7('0x11'),_0x40c3a0,_0x350a09[_0xd2a7('0x16')][_0xd2a7('0x18')]);return _0x2a0465(_0x350a09[_0xd2a7('0x16')]['message']);}else{logger[_0xd2a7('0x10')](_0xd2a7('0x11'),_0x40c3a0,_0xd2a7('0x12'));_0x2a0465(_0x350a09[_0xd2a7('0x19')][_0xd2a7('0x18')]);}})[_0xd2a7('0x1a')](function(_0x33a393){logger[_0xd2a7('0x16')](_0xd2a7('0x11'),_0x40c3a0,_0x33a393);_0x3cd623(_0x33a393);});});}exports[_0xd2a7('0x1b')]=function(_0x5c5250){var _0xf9558b=this;return new Promise(function(_0x5bb0ba,_0xf8c5c5){return db[_0xd2a7('0x1c')][_0xd2a7('0x1d')]({'raw':_0x5c5250[_0xd2a7('0x1e')]?_0x5c5250[_0xd2a7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5c5250[_0xd2a7('0x1e')]?_0x5c5250['options'][_0xd2a7('0x1f')]||null:null,'attributes':_0x5c5250[_0xd2a7('0x1e')]?_0x5c5250['options']['attributes']||null:null,'limit':_0x5c5250['options']?_0x5c5250[_0xd2a7('0x1e')]['limit']||null:null,'include':_0x5c5250[_0xd2a7('0x1e')]?_0x5c5250[_0xd2a7('0x1e')]['include']?_[_0xd2a7('0x20')](_0x5c5250[_0xd2a7('0x1e')][_0xd2a7('0x21')],function(_0x4e9447){return{'model':db[_0x4e9447[_0xd2a7('0x22')]],'as':_0x4e9447['as'],'attributes':_0x4e9447[_0xd2a7('0x23')],'include':_0x4e9447[_0xd2a7('0x21')]?_[_0xd2a7('0x20')](_0x4e9447[_0xd2a7('0x21')],function(_0x5d21af){return{'model':db[_0x5d21af[_0xd2a7('0x22')]],'as':_0x5d21af['as'],'attributes':_0x5d21af[_0xd2a7('0x23')],'include':_0x5d21af[_0xd2a7('0x21')]?_[_0xd2a7('0x20')](_0x5d21af[_0xd2a7('0x21')],function(_0x170fbe){return{'model':db[_0x170fbe[_0xd2a7('0x22')]],'as':_0x170fbe['as'],'attributes':_0x170fbe['attributes']};}):[]};}):[]};}):[]:[]})[_0xd2a7('0xf')](function(_0x93de6b){logger[_0xd2a7('0x10')](_0xd2a7('0x1b'),_0x5c5250);logger[_0xd2a7('0x13')](_0xd2a7('0x1b'),_0x5c5250,JSON[_0xd2a7('0x15')](_0x93de6b));_0x5bb0ba(_0x93de6b);})[_0xd2a7('0x1a')](function(_0x123ccf){logger[_0xd2a7('0x16')](_0xd2a7('0x1b'),_0x123ccf[_0xd2a7('0x18')],_0x5c5250);_0xf8c5c5(_0xf9558b['error'](0x1f4,_0x123ccf[_0xd2a7('0x18')]));});});};exports['ShowVoiceQueue']=function(_0xf79b7d){var _0x1792a7=this;return new Promise(function(_0x183e06,_0x2c1e24){return db[_0xd2a7('0x1c')][_0xd2a7('0x24')]({'raw':_0xf79b7d[_0xd2a7('0x1e')]?_0xf79b7d[_0xd2a7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xf79b7d[_0xd2a7('0x1e')]?_0xf79b7d[_0xd2a7('0x1e')][_0xd2a7('0x1f')]||null:null,'attributes':_0xf79b7d[_0xd2a7('0x1e')]?_0xf79b7d[_0xd2a7('0x1e')][_0xd2a7('0x23')]||null:null,'include':_0xf79b7d['options']?_0xf79b7d[_0xd2a7('0x1e')][_0xd2a7('0x21')]?_['map'](_0xf79b7d[_0xd2a7('0x1e')][_0xd2a7('0x21')],function(_0x51eee4){return{'model':db[_0x51eee4[_0xd2a7('0x22')]],'as':_0x51eee4['as'],'attributes':_0x51eee4[_0xd2a7('0x23')],'include':_0x51eee4['include']?_[_0xd2a7('0x20')](_0x51eee4[_0xd2a7('0x21')],function(_0x42d8ac){return{'model':db[_0x42d8ac[_0xd2a7('0x22')]],'as':_0x42d8ac['as'],'attributes':_0x42d8ac[_0xd2a7('0x23')],'include':_0x42d8ac[_0xd2a7('0x21')]?_[_0xd2a7('0x20')](_0x42d8ac['include'],function(_0x5804fc){return{'model':db[_0x5804fc[_0xd2a7('0x22')]],'as':_0x5804fc['as'],'attributes':_0x5804fc[_0xd2a7('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd2a7('0xf')](function(_0x2516c7){logger['info'](_0xd2a7('0x25'),_0xf79b7d);logger['debug'](_0xd2a7('0x25'),_0xf79b7d,JSON['stringify'](_0x2516c7));_0x183e06(_0x2516c7);})[_0xd2a7('0x1a')](function(_0x3faa74){logger[_0xd2a7('0x16')](_0xd2a7('0x25'),_0x3faa74['message'],_0xf79b7d);_0x2c1e24(_0x1792a7[_0xd2a7('0x16')](0x1f4,_0x3faa74[_0xd2a7('0x18')]));});});}; \ No newline at end of file +var _0xf0c0=['find','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','model','map','then','catch','ShowVoiceQueue'];(function(_0x3a9f78,_0x45a77b){var _0x415fb2=function(_0x7faa13){while(--_0x7faa13){_0x3a9f78['push'](_0x3a9f78['shift']());}};_0x415fb2(++_0x45a77b);}(_0xf0c0,0x160));var _0x0f0c=function(_0x316853,_0x41b963){_0x316853=_0x316853-0x0;var _0x1329ee=_0xf0c0[_0x316853];return _0x1329ee;};'use strict';var _=require(_0x0f0c('0x0'));var util=require(_0x0f0c('0x1'));var moment=require(_0x0f0c('0x2'));var BPromise=require(_0x0f0c('0x3'));var rs=require(_0x0f0c('0x4'));var fs=require('fs');var Redis=require(_0x0f0c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0f0c('0x6'));var config=require(_0x0f0c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0f0c('0x8')]({'port':0x232a});config[_0x0f0c('0x9')]=_[_0x0f0c('0xa')](config[_0x0f0c('0x9')],{'host':_0x0f0c('0xb'),'port':0x18eb});var socket=require(_0x0f0c('0xc'))(new Redis(config[_0x0f0c('0x9')]));require('./voiceQueue.socket')[_0x0f0c('0xd')](socket);function respondWithRpcPromise(_0x5d522e,_0x1d1ad9,_0x30085f){return new BPromise(function(_0x35ddc,_0x2d19bf){return client[_0x0f0c('0xe')](_0x5d522e,_0x30085f)['then'](function(_0x54df3c){logger['info'](_0x0f0c('0xf'),_0x1d1ad9,_0x0f0c('0x10'));logger[_0x0f0c('0x11')](_0x0f0c('0x12'),_0x1d1ad9,_0x0f0c('0x10'),JSON[_0x0f0c('0x13')](_0x54df3c));if(_0x54df3c[_0x0f0c('0x14')]){if(_0x54df3c[_0x0f0c('0x14')][_0x0f0c('0x15')]===0x1f4){logger[_0x0f0c('0x14')](_0x0f0c('0xf'),_0x1d1ad9,_0x54df3c['error'][_0x0f0c('0x16')]);return _0x2d19bf(_0x54df3c[_0x0f0c('0x14')][_0x0f0c('0x16')]);}logger['error'](_0x0f0c('0xf'),_0x1d1ad9,_0x54df3c[_0x0f0c('0x14')][_0x0f0c('0x16')]);return _0x35ddc(_0x54df3c[_0x0f0c('0x14')][_0x0f0c('0x16')]);}else{logger[_0x0f0c('0x17')](_0x0f0c('0xf'),_0x1d1ad9,_0x0f0c('0x10'));_0x35ddc(_0x54df3c[_0x0f0c('0x18')][_0x0f0c('0x16')]);}})['catch'](function(_0x36b711){logger[_0x0f0c('0x14')](_0x0f0c('0xf'),_0x1d1ad9,_0x36b711);_0x2d19bf(_0x36b711);});});}exports[_0x0f0c('0x19')]=function(_0x285baf){var _0x5b6777=this;return new Promise(function(_0x4c80ec,_0x370872){return db[_0x0f0c('0x1a')][_0x0f0c('0x1b')]({'raw':_0x285baf[_0x0f0c('0x1c')]?_0x285baf['options'][_0x0f0c('0x1d')]===undefined?!![]:![]:!![],'where':_0x285baf[_0x0f0c('0x1c')]?_0x285baf[_0x0f0c('0x1c')]['where']||null:null,'attributes':_0x285baf[_0x0f0c('0x1c')]?_0x285baf[_0x0f0c('0x1c')][_0x0f0c('0x1e')]||null:null,'limit':_0x285baf['options']?_0x285baf[_0x0f0c('0x1c')][_0x0f0c('0x1f')]||null:null,'include':_0x285baf['options']?_0x285baf['options'][_0x0f0c('0x20')]?_['map'](_0x285baf['options']['include'],function(_0x54de22){return{'model':db[_0x54de22[_0x0f0c('0x21')]],'as':_0x54de22['as'],'attributes':_0x54de22[_0x0f0c('0x1e')],'include':_0x54de22['include']?_[_0x0f0c('0x22')](_0x54de22[_0x0f0c('0x20')],function(_0x2ae795){return{'model':db[_0x2ae795[_0x0f0c('0x21')]],'as':_0x2ae795['as'],'attributes':_0x2ae795[_0x0f0c('0x1e')],'include':_0x2ae795['include']?_[_0x0f0c('0x22')](_0x2ae795[_0x0f0c('0x20')],function(_0x1a0217){return{'model':db[_0x1a0217[_0x0f0c('0x21')]],'as':_0x1a0217['as'],'attributes':_0x1a0217[_0x0f0c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0f0c('0x23')](function(_0x149e6d){logger[_0x0f0c('0x17')]('GetVoiceQueue',_0x285baf);logger[_0x0f0c('0x11')](_0x0f0c('0x19'),_0x285baf,JSON[_0x0f0c('0x13')](_0x149e6d));_0x4c80ec(_0x149e6d);})[_0x0f0c('0x24')](function(_0x275417){logger[_0x0f0c('0x14')]('GetVoiceQueue',_0x275417[_0x0f0c('0x16')],_0x285baf);_0x370872(_0x5b6777['error'](0x1f4,_0x275417[_0x0f0c('0x16')]));});});};exports[_0x0f0c('0x25')]=function(_0xf43366){var _0x2e9226=this;return new Promise(function(_0x2a33c1,_0x146f81){return db[_0x0f0c('0x1a')][_0x0f0c('0x26')]({'raw':_0xf43366[_0x0f0c('0x1c')]?_0xf43366[_0x0f0c('0x1c')][_0x0f0c('0x1d')]===undefined?!![]:![]:!![],'where':_0xf43366[_0x0f0c('0x1c')]?_0xf43366[_0x0f0c('0x1c')]['where']||null:null,'attributes':_0xf43366[_0x0f0c('0x1c')]?_0xf43366[_0x0f0c('0x1c')][_0x0f0c('0x1e')]||null:null,'include':_0xf43366[_0x0f0c('0x1c')]?_0xf43366[_0x0f0c('0x1c')][_0x0f0c('0x20')]?_[_0x0f0c('0x22')](_0xf43366[_0x0f0c('0x1c')][_0x0f0c('0x20')],function(_0x26de86){return{'model':db[_0x26de86['model']],'as':_0x26de86['as'],'attributes':_0x26de86[_0x0f0c('0x1e')],'include':_0x26de86[_0x0f0c('0x20')]?_[_0x0f0c('0x22')](_0x26de86[_0x0f0c('0x20')],function(_0x5a927c){return{'model':db[_0x5a927c[_0x0f0c('0x21')]],'as':_0x5a927c['as'],'attributes':_0x5a927c['attributes'],'include':_0x5a927c[_0x0f0c('0x20')]?_[_0x0f0c('0x22')](_0x5a927c[_0x0f0c('0x20')],function(_0x109336){return{'model':db[_0x109336[_0x0f0c('0x21')]],'as':_0x109336['as'],'attributes':_0x109336[_0x0f0c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0f0c('0x23')](function(_0x21789a){logger[_0x0f0c('0x17')](_0x0f0c('0x25'),_0xf43366);logger[_0x0f0c('0x11')](_0x0f0c('0x25'),_0xf43366,JSON[_0x0f0c('0x13')](_0x21789a));_0x2a33c1(_0x21789a);})['catch'](function(_0x252643){logger[_0x0f0c('0x14')](_0x0f0c('0x25'),_0x252643[_0x0f0c('0x16')],_0xf43366);_0x146f81(_0x2e9226[_0x0f0c('0x14')](0x1f4,_0x252643[_0x0f0c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4aa67dc..6a4201c 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 _0x624e=['remove','update','emit','removeListener','register','./voiceQueue.events','save'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x624e,0x171));var _0xe624=function(_0x136c94,_0x5167ac){_0x136c94=_0x136c94-0x0;var _0x822259=_0x624e[_0x136c94];return _0x822259;};'use strict';var VoiceQueueEvents=require(_0xe624('0x0'));var events=[_0xe624('0x1'),_0xe624('0x2'),_0xe624('0x3')];function createListener(_0x12f567,_0x582133){return function(_0x4943ae){_0x582133[_0xe624('0x4')](_0x12f567,_0x4943ae);};}function removeListener(_0x5acdad,_0x19f428){return function(){VoiceQueueEvents[_0xe624('0x5')](_0x5acdad,_0x19f428);};}exports[_0xe624('0x6')]=function(_0x2d6239){for(var _0x554678=0x0,_0x5e9fd1=events['length'];_0x554678<_0x5e9fd1;_0x554678++){var _0x357d30=events[_0x554678];var _0x37cb23=createListener('voiceQueue:'+_0x357d30,_0x2d6239);VoiceQueueEvents['on'](_0x357d30,_0x37cb23);}}; \ No newline at end of file +var _0x3eca=['voiceQueue:','save','remove','update','emit','removeListener','length'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x3eca,0x1a5));var _0xa3ec=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0x3eca[_0x3a19d4];return _0x5b858b;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xa3ec('0x0'),_0xa3ec('0x1'),_0xa3ec('0x2')];function createListener(_0xb110f6,_0x141d34){return function(_0xa77491){_0x141d34[_0xa3ec('0x3')](_0xb110f6,_0xa77491);};}function removeListener(_0x42f8b2,_0x551b46){return function(){VoiceQueueEvents[_0xa3ec('0x4')](_0x42f8b2,_0x551b46);};}exports['register']=function(_0x168a33){for(var _0x3210dc=0x0,_0x4f7272=events[_0xa3ec('0x5')];_0x3210dc<_0x4f7272;_0x3210dc++){var _0x4ea9f6=events[_0x3210dc];var _0x3945e3=createListener(_0xa3ec('0x6')+_0x4ea9f6,_0x168a33);VoiceQueueEvents['on'](_0x4ea9f6,_0x3945e3);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index e5fe989..391698a 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 _0x6b1b=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','getVoiceQueuesReport','/:id','create','put','destroy'];(function(_0x46a4e8,_0x956394){var _0x1c4f11=function(_0x2f20eb){while(--_0x2f20eb){_0x46a4e8['push'](_0x46a4e8['shift']());}};_0x1c4f11(++_0x956394);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6b1b[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0xb6b1('0x0'));var path=require(_0xb6b1('0x1'));var timeout=require(_0xb6b1('0x2'));var express=require('express');var router=express[_0xb6b1('0x3')]();var auth=require(_0xb6b1('0x4'));var interaction=require(_0xb6b1('0x5'));var config=require(_0xb6b1('0x6'));var controller=require(_0xb6b1('0x7'));router[_0xb6b1('0x8')]('/',auth[_0xb6b1('0x9')](),controller[_0xb6b1('0xa')]);router[_0xb6b1('0x8')](_0xb6b1('0xb'),auth[_0xb6b1('0x9')](),controller['describe']);router[_0xb6b1('0x8')]('/index',auth['isAuthenticated'](),controller[_0xb6b1('0xc')]);router['get'](_0xb6b1('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xb6b1('0xe')]);router[_0xb6b1('0xf')]('/:id',auth[_0xb6b1('0x9')](),controller['update']);router['delete'](_0xb6b1('0xd'),auth[_0xb6b1('0x9')](),controller[_0xb6b1('0x10')]);module[_0xb6b1('0x11')]=router; \ No newline at end of file +var _0xafb9=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/index','getVoiceQueuesReport','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xafb9,0x68));var _0x9afb=function(_0x589252,_0x4a31dc){_0x589252=_0x589252-0x0;var _0xdfd740=_0xafb9[_0x589252];return _0xdfd740;};'use strict';var multer=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var path=require(_0x9afb('0x2'));var timeout=require(_0x9afb('0x3'));var express=require(_0x9afb('0x4'));var router=express[_0x9afb('0x5')]();var auth=require(_0x9afb('0x6'));var interaction=require(_0x9afb('0x7'));var config=require(_0x9afb('0x8'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x9afb('0x9')](),controller['index']);router[_0x9afb('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x9afb('0xb')]);router[_0x9afb('0xa')](_0x9afb('0xc'),auth['isAuthenticated'](),controller[_0x9afb('0xd')]);router[_0x9afb('0xa')](_0x9afb('0xe'),auth[_0x9afb('0x9')](),controller[_0x9afb('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9afb('0x10')]);router[_0x9afb('0x11')](_0x9afb('0xe'),auth[_0x9afb('0x9')](),controller[_0x9afb('0x12')]);router[_0x9afb('0x13')](_0x9afb('0xe'),auth[_0x9afb('0x9')](),controller[_0x9afb('0x14')]);module[_0x9afb('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 73b39b0..a8de4fa 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 _0xcb91=['setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xcb91[_0x2d89ce];return _0x3fad10;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1cb9('0x0')]={'type':{'type':Sequelize[_0x1cb9('0x1')]},'uniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'calleridnum':{'type':Sequelize[_0x1cb9('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x13d5fd){var _0x1b26cd=moment(_0x13d5fd);var _0x53ffbd=moment(this[_0x1cb9('0x3')](_0x1cb9('0x4')))['format'](_0x1cb9('0x5'));var _0x12567c=_0x1b26cd['diff'](_0x53ffbd,_0x1cb9('0x6'));this['setDataValue']('queuecallerleaveAt',_0x13d5fd);this[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x12567c||null);}},'position':{'type':Sequelize[_0x1cb9('0x9')]},'count':{'type':Sequelize[_0x1cb9('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexit':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1cb9('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x1cb9('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1cb9('0x1')]},'connectedlinename':{'type':Sequelize[_0x1cb9('0x1')]},'accountcode':{'type':Sequelize[_0x1cb9('0x1')]},'context':{'type':Sequelize[_0x1cb9('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1cb9('0x1')]},'holdtime':{'type':Sequelize[_0x1cb9('0x9')]},'mohtime':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1cb9('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1cb9('0xb')},'transferexten':{'type':Sequelize[_0x1cb9('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1cb9('0x1')]},'disposition':{'type':Sequelize[_0x1cb9('0x1')]},'secondDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'thirdDisposition':{'type':Sequelize[_0x1cb9('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x1cb9('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x78b281,_0x502a65){var _0x397a05=function(_0x1e0946){while(--_0x1e0946){_0x78b281['push'](_0x78b281['shift']());}};_0x397a05(++_0x502a65);}(_0x70e0,0x17b));var _0x070e=function(_0xb644c7,_0x5f1241){_0xb644c7=_0xb644c7-0x0;var _0x320124=_0x70e0[_0xb644c7];return _0x320124;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));module[_0x070e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x070e('0x3')]},'calleridname':{'type':Sequelize[_0x070e('0x3')]},'queue':{'type':Sequelize[_0x070e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x7bce9b){var _0x579a6b=moment(_0x7bce9b);var _0x46fe68=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x070e('0x5'));var _0x1e11f0=_0x579a6b[_0x070e('0x6')](_0x46fe68,_0x070e('0x7'));this[_0x070e('0x8')](_0x070e('0x9'),_0x7bce9b);this[_0x070e('0x8')]('holdtime',_0x1e11f0||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x070e('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexit':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xc')},'originalposition':{'type':Sequelize[_0x070e('0xa')]},'channel':{'type':Sequelize[_0x070e('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x070e('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x070e('0xa')]},'mohtime':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xd')},'transferexten':{'type':Sequelize[_0x070e('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x070e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x070e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x070e('0xa')],'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 fe1d784..48ad98d 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(_0x1648aa,_0x49d619){var _0x23a1ae=function(_0x564bff){while(--_0x564bff){_0x1648aa['push'](_0x1648aa['shift']());}};_0x23a1ae(++_0x49d619);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x7227bc,_0x293459){var _0x591deb=function(_0x35d3fb){while(--_0x35d3fb){_0x7227bc['push'](_0x7227bc['shift']());}};_0x591deb(++_0x293459);}(_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'];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 dbe2c32..2cb5164 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 _0x73c4=['hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73c4,0x8e));var _0x473c=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x73c4[_0x46361e];return _0x14e302;};'use strict';var EventEmitter=require(_0x473c('0x0'));var VoiceQueueReport=require(_0x473c('0x1'))['db'][_0x473c('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x473c('0x3')](0x0);var events={'afterCreate':_0x473c('0x4'),'afterUpdate':_0x473c('0x5'),'afterDestroy':_0x473c('0x6')};function emitEvent(_0x50c12c){return function(_0x535adb,_0x5ac921,_0x148200){VoiceQueueReportEvents[_0x473c('0x7')](_0x50c12c+':'+_0x535adb['id'],_0x535adb);VoiceQueueReportEvents[_0x473c('0x7')](_0x50c12c,_0x535adb);_0x148200(null);};}for(var e in events){if(events[_0x473c('0x8')](e)){var event=events[e];VoiceQueueReport[_0x473c('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xed2d=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit'];(function(_0x2bd88d,_0x2d5dc3){var _0x5516d4=function(_0x1272c8){while(--_0x1272c8){_0x2bd88d['push'](_0x2bd88d['shift']());}};_0x5516d4(++_0x2d5dc3);}(_0xed2d,0x1bb));var _0xded2=function(_0x794207,_0x54a989){_0x794207=_0x794207-0x0;var _0x4ee1c9=_0xed2d[_0x794207];return _0x4ee1c9;};'use strict';var EventEmitter=require(_0xded2('0x0'));var VoiceQueueReport=require(_0xded2('0x1'))['db'][_0xded2('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xded2('0x3')](0x0);var events={'afterCreate':_0xded2('0x4'),'afterUpdate':_0xded2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x347e73){return function(_0x7a5b84,_0x2b9bc1,_0x5929e6){VoiceQueueReportEvents['emit'](_0x347e73+':'+_0x7a5b84['id'],_0x7a5b84);VoiceQueueReportEvents[_0xded2('0x6')](_0x347e73,_0x7a5b84);_0x5929e6(null);};}for(var e in events){if(events[_0xded2('0x7')](e)){var event=events[e];VoiceQueueReport[_0xded2('0x8')](e,emitEvent(event));}}module[_0xded2('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index dd14ccd..1b84821 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 _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0x2c526d,_0x284ef7){var _0x1a6e7c=function(_0x34df61){while(--_0x34df61){_0x2c526d['push'](_0x2c526d['shift']());}};_0x1a6e7c(++_0x284ef7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0x5f2f[_0x111e94];return _0x3de107;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf5f2('0xc')]},{'fields':[_0xf5f2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0x34a3b6,_0x3c2267){var _0x18a616=function(_0x8dc9f6){while(--_0x8dc9f6){_0x34a3b6['push'](_0x34a3b6['shift']());}};_0x18a616(++_0x3c2267);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 3ded6d0..df4d5ae 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 _0x3575=['debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','findAll','options','raw','attributes','limit','map','model','include','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','body','VoiceQueueReport','where','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','request\x20sent'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x3575,0x69));var _0x5357=function(_0x16a930,_0x55526f){_0x16a930=_0x16a930-0x0;var _0x4a34d6=_0x3575[_0x16a930];return _0x4a34d6;};'use strict';var _=require(_0x5357('0x0'));var util=require(_0x5357('0x1'));var moment=require(_0x5357('0x2'));var BPromise=require(_0x5357('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5357('0x4'));var db=require(_0x5357('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5357('0x6'))(_0x5357('0x7'));var config=require(_0x5357('0x8'));var jayson=require(_0x5357('0x9'));var client=jayson[_0x5357('0xa')][_0x5357('0xb')]({'port':0x232a});config[_0x5357('0xc')]=_['defaults'](config[_0x5357('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5357('0xd'))(new Redis(config[_0x5357('0xc')]));require('./voiceQueueReport.socket')[_0x5357('0xe')](socket);function respondWithRpcPromise(_0x291c29,_0x187fc0,_0x32a221){return new BPromise(function(_0x27be98,_0x2108ec){return client[_0x5357('0xf')](_0x291c29,_0x32a221)[_0x5357('0x10')](function(_0x53863d){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x187fc0,_0x5357('0x11'));logger[_0x5357('0x12')](_0x5357('0x13'),_0x187fc0,'request\x20sent',JSON['stringify'](_0x53863d));if(_0x53863d['error']){if(_0x53863d[_0x5357('0x14')]['code']===0x1f4){logger[_0x5357('0x14')](_0x5357('0x15'),_0x187fc0,_0x53863d[_0x5357('0x14')][_0x5357('0x16')]);return _0x2108ec(_0x53863d[_0x5357('0x14')][_0x5357('0x16')]);}logger[_0x5357('0x14')](_0x5357('0x15'),_0x187fc0,_0x53863d[_0x5357('0x14')]['message']);return _0x27be98(_0x53863d[_0x5357('0x14')][_0x5357('0x16')]);}else{logger[_0x5357('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x187fc0,'request\x20sent');_0x27be98(_0x53863d[_0x5357('0x18')][_0x5357('0x16')]);}})[_0x5357('0x19')](function(_0x1f584a){logger[_0x5357('0x14')](_0x5357('0x15'),_0x187fc0,_0x1f584a);_0x2108ec(_0x1f584a);});});}exports['GetVoiceQueueReport']=function(_0x3a0198){var _0x354db6=this;return new Promise(function(_0x1d9f73,_0x446184){return db['VoiceQueueReport'][_0x5357('0x1a')]({'raw':_0x3a0198['options']?_0x3a0198[_0x5357('0x1b')][_0x5357('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a0198[_0x5357('0x1b')]?_0x3a0198['options']['where']||null:null,'attributes':_0x3a0198[_0x5357('0x1b')]?_0x3a0198['options'][_0x5357('0x1d')]||null:null,'limit':_0x3a0198[_0x5357('0x1b')]?_0x3a0198[_0x5357('0x1b')][_0x5357('0x1e')]||null:null,'include':_0x3a0198[_0x5357('0x1b')]?_0x3a0198['options']['include']?_[_0x5357('0x1f')](_0x3a0198[_0x5357('0x1b')]['include'],function(_0x246c74){return{'model':db[_0x246c74[_0x5357('0x20')]],'as':_0x246c74['as'],'attributes':_0x246c74[_0x5357('0x1d')],'include':_0x246c74['include']?_[_0x5357('0x1f')](_0x246c74[_0x5357('0x21')],function(_0x1fc381){return{'model':db[_0x1fc381['model']],'as':_0x1fc381['as'],'attributes':_0x1fc381[_0x5357('0x1d')],'include':_0x1fc381['include']?_['map'](_0x1fc381[_0x5357('0x21')],function(_0x476152){return{'model':db[_0x476152[_0x5357('0x20')]],'as':_0x476152['as'],'attributes':_0x476152['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xef35c6){logger[_0x5357('0x17')](_0x5357('0x22'),_0x3a0198);logger[_0x5357('0x12')](_0x5357('0x22'),_0x3a0198,JSON[_0x5357('0x23')](_0xef35c6));_0x1d9f73(_0xef35c6);})[_0x5357('0x19')](function(_0x17f5c0){logger[_0x5357('0x14')](_0x5357('0x22'),_0x17f5c0[_0x5357('0x16')],_0x3a0198);_0x446184(_0x354db6[_0x5357('0x14')](0x1f4,_0x17f5c0[_0x5357('0x16')]));});});};exports[_0x5357('0x24')]=function(_0x4f961d){var _0x4fc19a=this;return new Promise(function(_0x59d31d,_0x923781){return db['VoiceQueueReport']['create'](_0x4f961d[_0x5357('0x25')],{'raw':_0x4f961d[_0x5357('0x1b')]?_0x4f961d[_0x5357('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x18d4f0){logger[_0x5357('0x17')](_0x5357('0x24'),_0x4f961d);logger[_0x5357('0x12')]('CreateVoiceQueueReport',_0x4f961d,JSON[_0x5357('0x23')](_0x18d4f0));_0x59d31d(_0x18d4f0);})[_0x5357('0x19')](function(_0x535f8b){logger[_0x5357('0x14')]('CreateVoiceQueueReport',_0x535f8b[_0x5357('0x16')],_0x4f961d);_0x923781(_0x4fc19a['error'](0x1f4,_0x535f8b[_0x5357('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x2cfbf2){var _0x4f5c8e=this;return new Promise(function(_0x9aab87,_0x17fe85){return db[_0x5357('0x26')]['update'](_0x2cfbf2[_0x5357('0x25')],{'raw':_0x2cfbf2[_0x5357('0x1b')]?_0x2cfbf2[_0x5357('0x1b')][_0x5357('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cfbf2[_0x5357('0x1b')]?_0x2cfbf2[_0x5357('0x1b')][_0x5357('0x27')]||null:null,'attributes':_0x2cfbf2[_0x5357('0x1b')]?_0x2cfbf2[_0x5357('0x1b')][_0x5357('0x1d')]||null:null,'limit':_0x2cfbf2['options']?_0x2cfbf2[_0x5357('0x1b')][_0x5357('0x1e')]||null:null})['then'](function(_0x950d7f){logger[_0x5357('0x17')](_0x5357('0x28'),_0x2cfbf2);logger[_0x5357('0x12')]('UpdateVoiceQueueReport',_0x2cfbf2,JSON[_0x5357('0x23')](_0x950d7f));_0x9aab87(_0x950d7f);})[_0x5357('0x19')](function(_0x192dd4){logger[_0x5357('0x14')](_0x5357('0x28'),_0x192dd4[_0x5357('0x16')],_0x2cfbf2);_0x17fe85(_0x4f5c8e[_0x5357('0x14')](0x1f4,_0x192dd4[_0x5357('0x16')]));});});}; \ No newline at end of file +var _0x0938=['raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','VoiceQueueReport','findAll','options','where','attributes','limit','map','include','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update'];(function(_0xd76edb,_0x1583c4){var _0x528c9b=function(_0x2ef8c2){while(--_0x2ef8c2){_0xd76edb['push'](_0xd76edb['shift']());}};_0x528c9b(++_0x1583c4);}(_0x0938,0x184));var _0x8093=function(_0x4b8fee,_0x13f97b){_0x4b8fee=_0x4b8fee-0x0;var _0x56828b=_0x0938[_0x4b8fee];return _0x56828b;};'use strict';var _=require('lodash');var util=require(_0x8093('0x0'));var moment=require(_0x8093('0x1'));var BPromise=require(_0x8093('0x2'));var rs=require(_0x8093('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8093('0x4'))['db'];var utils=require(_0x8093('0x5'));var logger=require(_0x8093('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8093('0x7'));var client=jayson[_0x8093('0x8')]['http']({'port':0x232a});config[_0x8093('0x9')]=_[_0x8093('0xa')](config['redis'],{'host':_0x8093('0xb'),'port':0x18eb});var socket=require(_0x8093('0xc'))(new Redis(config['redis']));require(_0x8093('0xd'))[_0x8093('0xe')](socket);function respondWithRpcPromise(_0x519cd1,_0x612227,_0x2fef11){return new BPromise(function(_0x514676,_0x77d25f){return client[_0x8093('0xf')](_0x519cd1,_0x2fef11)[_0x8093('0x10')](function(_0x462a1d){logger['info'](_0x8093('0x11'),_0x612227,'request\x20sent');logger[_0x8093('0x12')](_0x8093('0x13'),_0x612227,_0x8093('0x14'),JSON[_0x8093('0x15')](_0x462a1d));if(_0x462a1d[_0x8093('0x16')]){if(_0x462a1d['error'][_0x8093('0x17')]===0x1f4){logger[_0x8093('0x16')](_0x8093('0x11'),_0x612227,_0x462a1d[_0x8093('0x16')][_0x8093('0x18')]);return _0x77d25f(_0x462a1d['error']['message']);}logger[_0x8093('0x16')](_0x8093('0x11'),_0x612227,_0x462a1d['error']['message']);return _0x514676(_0x462a1d[_0x8093('0x16')][_0x8093('0x18')]);}else{logger[_0x8093('0x19')](_0x8093('0x11'),_0x612227,_0x8093('0x14'));_0x514676(_0x462a1d[_0x8093('0x1a')][_0x8093('0x18')]);}})[_0x8093('0x1b')](function(_0xd6563f){logger[_0x8093('0x16')](_0x8093('0x11'),_0x612227,_0xd6563f);_0x77d25f(_0xd6563f);});});}exports['GetVoiceQueueReport']=function(_0x2ef9ef){var _0x4c358c=this;return new Promise(function(_0x10c59f,_0x3ff0bf){return db[_0x8093('0x1c')][_0x8093('0x1d')]({'raw':_0x2ef9ef[_0x8093('0x1e')]?_0x2ef9ef['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ef9ef[_0x8093('0x1e')]?_0x2ef9ef['options'][_0x8093('0x1f')]||null:null,'attributes':_0x2ef9ef['options']?_0x2ef9ef['options'][_0x8093('0x20')]||null:null,'limit':_0x2ef9ef['options']?_0x2ef9ef[_0x8093('0x1e')][_0x8093('0x21')]||null:null,'include':_0x2ef9ef['options']?_0x2ef9ef[_0x8093('0x1e')]['include']?_[_0x8093('0x22')](_0x2ef9ef[_0x8093('0x1e')][_0x8093('0x23')],function(_0x50b809){return{'model':db[_0x50b809[_0x8093('0x24')]],'as':_0x50b809['as'],'attributes':_0x50b809[_0x8093('0x20')],'include':_0x50b809[_0x8093('0x23')]?_[_0x8093('0x22')](_0x50b809[_0x8093('0x23')],function(_0xf7350d){return{'model':db[_0xf7350d['model']],'as':_0xf7350d['as'],'attributes':_0xf7350d['attributes'],'include':_0xf7350d[_0x8093('0x23')]?_['map'](_0xf7350d[_0x8093('0x23')],function(_0x1521ef){return{'model':db[_0x1521ef[_0x8093('0x24')]],'as':_0x1521ef['as'],'attributes':_0x1521ef[_0x8093('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a56a5){logger[_0x8093('0x19')](_0x8093('0x25'),_0x2ef9ef);logger[_0x8093('0x12')](_0x8093('0x25'),_0x2ef9ef,JSON['stringify'](_0x5a56a5));_0x10c59f(_0x5a56a5);})[_0x8093('0x1b')](function(_0xb600d3){logger[_0x8093('0x16')](_0x8093('0x25'),_0xb600d3[_0x8093('0x18')],_0x2ef9ef);_0x3ff0bf(_0x4c358c[_0x8093('0x16')](0x1f4,_0xb600d3[_0x8093('0x18')]));});});};exports[_0x8093('0x26')]=function(_0x349146){var _0x3fbf03=this;return new Promise(function(_0x3a5daf,_0x189f5e){return db[_0x8093('0x1c')][_0x8093('0x27')](_0x349146['body'],{'raw':_0x349146[_0x8093('0x1e')]?_0x349146[_0x8093('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x8093('0x10')](function(_0x42d0ed){logger[_0x8093('0x19')]('CreateVoiceQueueReport',_0x349146);logger[_0x8093('0x12')](_0x8093('0x26'),_0x349146,JSON[_0x8093('0x15')](_0x42d0ed));_0x3a5daf(_0x42d0ed);})[_0x8093('0x1b')](function(_0x2e4789){logger['error'](_0x8093('0x26'),_0x2e4789[_0x8093('0x18')],_0x349146);_0x189f5e(_0x3fbf03[_0x8093('0x16')](0x1f4,_0x2e4789[_0x8093('0x18')]));});});};exports[_0x8093('0x28')]=function(_0x3432f7){var _0x3d71ff=this;return new Promise(function(_0x2f30fa,_0x2c9e74){return db[_0x8093('0x1c')][_0x8093('0x29')](_0x3432f7['body'],{'raw':_0x3432f7['options']?_0x3432f7[_0x8093('0x1e')][_0x8093('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3432f7[_0x8093('0x1e')]?_0x3432f7[_0x8093('0x1e')]['where']||null:null,'attributes':_0x3432f7[_0x8093('0x1e')]?_0x3432f7[_0x8093('0x1e')]['attributes']||null:null,'limit':_0x3432f7[_0x8093('0x1e')]?_0x3432f7[_0x8093('0x1e')][_0x8093('0x21')]||null:null})[_0x8093('0x10')](function(_0x144b5a){logger[_0x8093('0x19')](_0x8093('0x28'),_0x3432f7);logger[_0x8093('0x12')](_0x8093('0x28'),_0x3432f7,JSON['stringify'](_0x144b5a));_0x2f30fa(_0x144b5a);})[_0x8093('0x1b')](function(_0x1214ce){logger[_0x8093('0x16')](_0x8093('0x28'),_0x1214ce[_0x8093('0x18')],_0x3432f7);_0x2c9e74(_0x3d71ff['error'](0x1f4,_0x1214ce[_0x8093('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index e2fca27..df9f3c5 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 _0x6054=['./voiceQueueReport.events','remove','removeListener','register','length'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x6054,0x127));var _0x4605=function(_0x2ad5ac,_0x3ce592){_0x2ad5ac=_0x2ad5ac-0x0;var _0x5151d0=_0x6054[_0x2ad5ac];return _0x5151d0;};'use strict';var VoiceQueueReportEvents=require(_0x4605('0x0'));var events=['save',_0x4605('0x1'),'update'];function createListener(_0xee67d3,_0x2ca517){return function(_0x4b0c25){_0x2ca517['emit'](_0xee67d3,_0x4b0c25);};}function removeListener(_0x216beb,_0x166281){return function(){VoiceQueueReportEvents[_0x4605('0x2')](_0x216beb,_0x166281);};}exports[_0x4605('0x3')]=function(_0x575f2b){for(var _0x80a2e0=0x0,_0x36605a=events[_0x4605('0x4')];_0x80a2e0<_0x36605a;_0x80a2e0++){var _0x2c8cc2=events[_0x80a2e0];var _0x2358ca=createListener('voiceQueueReport:'+_0x2c8cc2,_0x575f2b);VoiceQueueReportEvents['on'](_0x2c8cc2,_0x2358ca);}}; \ No newline at end of file +var _0x25c7=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','emit','removeListener'];(function(_0x5b7cee,_0x7e010f){var _0x490f4a=function(_0x582689){while(--_0x582689){_0x5b7cee['push'](_0x5b7cee['shift']());}};_0x490f4a(++_0x7e010f);}(_0x25c7,0xdc));var _0x725c=function(_0x354826,_0x1b4969){_0x354826=_0x354826-0x0;var _0x4e2eb0=_0x25c7[_0x354826];return _0x4e2eb0;};'use strict';var VoiceQueueReportEvents=require(_0x725c('0x0'));var events=[_0x725c('0x1'),'remove','update'];function createListener(_0x21617e,_0xd9decf){return function(_0x54ac03){_0xd9decf[_0x725c('0x2')](_0x21617e,_0x54ac03);};}function removeListener(_0x5aa77b,_0x16f724){return function(){VoiceQueueReportEvents[_0x725c('0x3')](_0x5aa77b,_0x16f724);};}exports[_0x725c('0x4')]=function(_0x2202c3){for(var _0xcf1e7a=0x0,_0xe30fa4=events[_0x725c('0x5')];_0xcf1e7a<_0xe30fa4;_0xcf1e7a++){var _0x2c85e3=events[_0xcf1e7a];var _0x53119c=createListener(_0x725c('0x6')+_0x2c85e3,_0x2202c3);VoiceQueueReportEvents['on'](_0x2c85e3,_0x53119c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 4440174..8d5ce10 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 _0x1135=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1135,0x119));var _0x5113=function(_0x5e5b6b,_0x338667){_0x5e5b6b=_0x5e5b6b-0x0;var _0x3a5e84=_0x1135[_0x5e5b6b];return _0x3a5e84;};'use strict';var multer=require(_0x5113('0x0'));var util=require('util');var path=require(_0x5113('0x1'));var timeout=require(_0x5113('0x2'));var express=require(_0x5113('0x3'));var router=express[_0x5113('0x4')]();var auth=require(_0x5113('0x5'));var interaction=require(_0x5113('0x6'));var config=require(_0x5113('0x7'));var controller=require(_0x5113('0x8'));router[_0x5113('0x9')]('/',auth[_0x5113('0xa')](),controller[_0x5113('0xb')]);router[_0x5113('0x9')](_0x5113('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5113('0xd')]('/',auth[_0x5113('0xa')](),controller[_0x5113('0xe')]);router[_0x5113('0xf')]('/:id',auth[_0x5113('0xa')](),controller[_0x5113('0x10')]);router[_0x5113('0x11')](_0x5113('0xc'),auth[_0x5113('0xa')](),controller[_0x5113('0x12')]);module[_0x5113('0x13')]=router; \ No newline at end of file +var _0x054b=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x440f1c,_0x3a22cd){var _0x12f7b6=function(_0x24d709){while(--_0x24d709){_0x440f1c['push'](_0x440f1c['shift']());}};_0x12f7b6(++_0x3a22cd);}(_0x054b,0xcb));var _0xb054=function(_0x1a1cab,_0x450a44){_0x1a1cab=_0x1a1cab-0x0;var _0xb24cbf=_0x054b[_0x1a1cab];return _0xb24cbf;};'use strict';var multer=require(_0xb054('0x0'));var util=require(_0xb054('0x1'));var path=require(_0xb054('0x2'));var timeout=require('connect-timeout');var express=require(_0xb054('0x3'));var router=express[_0xb054('0x4')]();var auth=require(_0xb054('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb054('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0xb054('0x7')]('/',auth[_0xb054('0x8')](),controller[_0xb054('0x9')]);router[_0xb054('0x7')](_0xb054('0xa'),auth['isAuthenticated'](),controller[_0xb054('0xb')]);router[_0xb054('0xc')]('/',auth[_0xb054('0x8')](),controller[_0xb054('0xd')]);router[_0xb054('0xe')]('/:id',auth[_0xb054('0x8')](),controller[_0xb054('0xf')]);router[_0xb054('0x10')](_0xb054('0xa'),auth[_0xb054('0x8')](),controller[_0xb054('0x11')]);module[_0xb054('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index b29d855..d25ca6c 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 _0xc2bf=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports'];(function(_0x4bed2d,_0x4ebe20){var _0xe82d9f=function(_0x54d1af){while(--_0x54d1af){_0x4bed2d['push'](_0x4bed2d['shift']());}};_0xe82d9f(++_0x4ebe20);}(_0xc2bf,0x12f));var _0xfc2b=function(_0x2dd2db,_0x415d98){_0x2dd2db=_0x2dd2db-0x0;var _0x4174d3=_0xc2bf[_0x2dd2db];return _0x4174d3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfc2b('0x0'));module[_0xfc2b('0x1')]={'time':{'type':Sequelize[_0xfc2b('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xfc2b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xfc2b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfc2b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfc2b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfc2b('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfc2b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfc2b('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfc2b('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xfc2b('0x3')](_0xfc2b('0x4'))}}; \ No newline at end of file +var _0xd531=['moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xd531,0x1eb));var _0x1d53=function(_0x5d9ecc,_0x55d21a){_0x5d9ecc=_0x5d9ecc-0x0;var _0x30baea=_0xd531[_0x5d9ecc];return _0x30baea;};'use strict';var Sequelize=require(_0x1d53('0x0'));var moment=require(_0x1d53('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x1d53('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x1d53('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1d53('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1d53('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1d53('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x1d53('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x1d53('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1d53('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1d53('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x1d53('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x1d53('0x3')],'allowNull':![],'defaultValue':moment()[_0x1d53('0x4')](_0x1d53('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 497035d..0bc00f8 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 _0xf16a=['show','params','keys','rawAttributes','length','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','ejs','lodash','squel','crypto','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','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','VoiceQueuesLog','fieldName','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch'];(function(_0xa9671b,_0x11378d){var _0x205591=function(_0x5dc88d){while(--_0x5dc88d){_0xa9671b['push'](_0xa9671b['shift']());}};_0x205591(++_0x11378d);}(_0xf16a,0xe0));var _0xaf16=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0xf16a[_0x695b76];return _0x1dc21f;};'use strict';var pdf=require(_0xaf16('0x0'));var emlformat=require(_0xaf16('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaf16('0x2'));var jsonpatch=require(_0xaf16('0x3'));var rp=require(_0xaf16('0x4'));var moment=require(_0xaf16('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaf16('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf16('0x7'));var fs=require('fs');var _=require(_0xaf16('0x8'));var squel=require(_0xaf16('0x9'));var crypto=require(_0xaf16('0xa'));var jsforce=require(_0xaf16('0xb'));var deskjs=require(_0xaf16('0xc'));var toCsv=require(_0xaf16('0xd'));var querystring=require(_0xaf16('0xe'));var Papa=require(_0xaf16('0xf'));var Redis=require('ioredis');var authService=require(_0xaf16('0x10'));var qs=require(_0xaf16('0x11'));var as=require(_0xaf16('0x12'));var hardwareService=require(_0xaf16('0x13'));var logger=require('../../config/logger')(_0xaf16('0x14'));var utils=require(_0xaf16('0x15'));var config=require(_0xaf16('0x16'));var licenseUtil=require(_0xaf16('0x17'));var db=require(_0xaf16('0x18'))['db'];function respondWithStatusCode(_0x3291a1,_0x502e02){_0x502e02=_0x502e02||0xcc;return function(_0x533cad){if(_0x533cad){return _0x3291a1[_0xaf16('0x19')](_0x502e02);}return _0x3291a1[_0xaf16('0x1a')](_0x502e02)[_0xaf16('0x1b')]();};}function respondWithResult(_0x5b0e2c,_0x596eb2){_0x596eb2=_0x596eb2||0xc8;return function(_0x5aa3e4){if(_0x5aa3e4){return _0x5b0e2c[_0xaf16('0x1a')](_0x596eb2)['json'](_0x5aa3e4);}};}function respondWithFilteredResult(_0x140586,_0x49a1b4){return function(_0x1636aa){if(_0x1636aa){var _0x46fbb8=_0x1636aa[_0xaf16('0x1c')],_0x3b5469=_0x49a1b4[_0xaf16('0x1d')],_0x2bc02c=_0x49a1b4[_0xaf16('0x1d')]+_0x49a1b4[_0xaf16('0x1e')],_0x5651aa;if(_0x2bc02c>=_0x46fbb8){_0x2bc02c=_0x46fbb8;_0x5651aa=0xc8;}else{_0x5651aa=0xce;}_0x140586['status'](_0x5651aa);return _0x140586[_0xaf16('0x1f')](_0xaf16('0x20'),_0x3b5469+'-'+_0x2bc02c+'/'+_0x46fbb8)['json'](_0x1636aa);}return null;};}function patchUpdates(_0x1e2ed9){return function(_0x5dd6f7){try{jsonpatch[_0xaf16('0x21')](_0x5dd6f7,_0x1e2ed9,!![]);}catch(_0xdeb10e){return BPromise[_0xaf16('0x22')](_0xdeb10e);}return _0x5dd6f7[_0xaf16('0x23')]();};}function saveUpdates(_0x305ae7,_0x58fe0d){return function(_0x28713b){if(_0x28713b){return _0x28713b[_0xaf16('0x24')](_0x305ae7)[_0xaf16('0x25')](function(_0x4ac26c){return _0x4ac26c;});}return null;};}function removeEntity(_0x2b3362,_0x31e03d){return function(_0x44cab6){if(_0x44cab6){return _0x44cab6['destroy']()['then'](function(){_0x2b3362[_0xaf16('0x1a')](0xcc)[_0xaf16('0x1b')]();});}};}function handleEntityNotFound(_0x15e7ba,_0x28b000){return function(_0x1ea39d){if(!_0x1ea39d){_0x15e7ba[_0xaf16('0x19')](0x194);}return _0x1ea39d;};}function handleError(_0x555872,_0x56dcea){_0x56dcea=_0x56dcea||0x1f4;return function(_0x5c653a){logger[_0xaf16('0x26')](_0x5c653a[_0xaf16('0x27')]);if(_0x5c653a[_0xaf16('0x28')]){delete _0x5c653a[_0xaf16('0x28')];}_0x555872[_0xaf16('0x1a')](_0x56dcea)[_0xaf16('0x29')](_0x5c653a);};}exports[_0xaf16('0x2a')]=function(_0x352ace,_0x346b78){var _0x4ba808={},_0x1a5a68={},_0x44ecb3={'count':0x0,'rows':[]};var _0x48b5d5=_['map'](db[_0xaf16('0x2b')]['rawAttributes'],function(_0x1100ed){return{'name':_0x1100ed[_0xaf16('0x2c')],'type':_0x1100ed['type']['key']};});_0x1a5a68[_0xaf16('0x2d')]=_['map'](_0x48b5d5,_0xaf16('0x28'));_0x1a5a68[_0xaf16('0x2e')]=_['keys'](_0x352ace['query']);_0x1a5a68[_0xaf16('0x2f')]=_[_0xaf16('0x30')](_0x1a5a68[_0xaf16('0x2d')],_0x1a5a68[_0xaf16('0x2e')]);_0x4ba808['attributes']=_[_0xaf16('0x30')](_0x1a5a68[_0xaf16('0x2d')],qs[_0xaf16('0x31')](_0x352ace[_0xaf16('0x2e')][_0xaf16('0x31')]));_0x4ba808['attributes']=_0x4ba808[_0xaf16('0x32')]['length']?_0x4ba808['attributes']:_0x1a5a68[_0xaf16('0x2d')];if(!_0x352ace[_0xaf16('0x2e')][_0xaf16('0x33')]('nolimit')){_0x4ba808[_0xaf16('0x1e')]=qs['limit'](_0x352ace[_0xaf16('0x2e')][_0xaf16('0x1e')]);_0x4ba808[_0xaf16('0x1d')]=qs[_0xaf16('0x1d')](_0x352ace['query'][_0xaf16('0x1d')]);}_0x4ba808[_0xaf16('0x34')]=qs[_0xaf16('0x35')](_0x352ace[_0xaf16('0x2e')][_0xaf16('0x35')]);_0x4ba808[_0xaf16('0x36')]=qs[_0xaf16('0x2f')](_[_0xaf16('0x37')](_0x352ace[_0xaf16('0x2e')],_0x1a5a68[_0xaf16('0x2f')]),_0x48b5d5);if(_0x352ace['query'][_0xaf16('0x38')]){_0x4ba808[_0xaf16('0x36')]=_[_0xaf16('0x39')](_0x4ba808[_0xaf16('0x36')],{'$or':_['map'](_0x48b5d5,function(_0x4ef543){if(_0x4ef543[_0xaf16('0x3a')]!=='VIRTUAL'){var _0x3f5edb={};_0x3f5edb[_0x4ef543['name']]={'$like':'%'+_0x352ace[_0xaf16('0x2e')]['filter']+'%'};return _0x3f5edb;}})});}_0x4ba808=_[_0xaf16('0x39')]({},_0x4ba808,_0x352ace[_0xaf16('0x3b')]);var _0x463af8={'where':_0x4ba808['where']};return db[_0xaf16('0x2b')][_0xaf16('0x1c')](_0x463af8)['then'](function(_0x405f0a){_0x44ecb3[_0xaf16('0x1c')]=_0x405f0a;if(_0x352ace[_0xaf16('0x2e')][_0xaf16('0x3c')]){_0x4ba808[_0xaf16('0x3d')]=[{'all':!![]}];}return db[_0xaf16('0x2b')][_0xaf16('0x3e')](_0x4ba808);})[_0xaf16('0x25')](function(_0x3be94d){_0x44ecb3['rows']=_0x3be94d;return _0x44ecb3;})[_0xaf16('0x25')](respondWithFilteredResult(_0x346b78,_0x4ba808))[_0xaf16('0x3f')](handleError(_0x346b78,null));};exports[_0xaf16('0x40')]=function(_0x5deb1d,_0x3316f8){var _0x35a998={'raw':!![],'where':{'id':_0x5deb1d[_0xaf16('0x41')]['id']}},_0x415471={};_0x415471[_0xaf16('0x2d')]=_[_0xaf16('0x42')](db[_0xaf16('0x2b')][_0xaf16('0x43')]);_0x415471[_0xaf16('0x2e')]=_[_0xaf16('0x42')](_0x5deb1d[_0xaf16('0x2e')]);_0x415471[_0xaf16('0x2f')]=_[_0xaf16('0x30')](_0x415471[_0xaf16('0x2d')],_0x415471[_0xaf16('0x2e')]);_0x35a998[_0xaf16('0x32')]=_[_0xaf16('0x30')](_0x415471[_0xaf16('0x2d')],qs[_0xaf16('0x31')](_0x5deb1d[_0xaf16('0x2e')][_0xaf16('0x31')]));_0x35a998['attributes']=_0x35a998[_0xaf16('0x32')][_0xaf16('0x44')]?_0x35a998['attributes']:_0x415471[_0xaf16('0x2d')];if(_0x5deb1d[_0xaf16('0x2e')][_0xaf16('0x3c')]){_0x35a998['include']=[{'all':!![]}];}_0x35a998=_[_0xaf16('0x39')]({},_0x35a998,_0x5deb1d[_0xaf16('0x3b')]);return db['VoiceQueuesLog'][_0xaf16('0x45')](_0x35a998)[_0xaf16('0x25')](handleEntityNotFound(_0x3316f8,null))[_0xaf16('0x25')](respondWithResult(_0x3316f8,null))['catch'](handleError(_0x3316f8,null));};exports[_0xaf16('0x46')]=function(_0x29af5a,_0x2dac8d){return db[_0xaf16('0x2b')][_0xaf16('0x46')](_0x29af5a[_0xaf16('0x47')],{})[_0xaf16('0x25')](respondWithResult(_0x2dac8d,0xc9))[_0xaf16('0x3f')](handleError(_0x2dac8d,null));};exports['update']=function(_0x24e38e,_0x2d538b){if(_0x24e38e[_0xaf16('0x47')]['id']){delete _0x24e38e['body']['id'];}return db[_0xaf16('0x2b')]['find']({'where':{'id':_0x24e38e[_0xaf16('0x41')]['id']}})[_0xaf16('0x25')](handleEntityNotFound(_0x2d538b,null))['then'](saveUpdates(_0x24e38e[_0xaf16('0x47')],null))[_0xaf16('0x25')](respondWithResult(_0x2d538b,null))[_0xaf16('0x3f')](handleError(_0x2d538b,null));};exports['destroy']=function(_0x38bc1f,_0x271591){return db[_0xaf16('0x2b')][_0xaf16('0x45')]({'where':{'id':_0x38bc1f[_0xaf16('0x41')]['id']}})[_0xaf16('0x25')](handleEntityNotFound(_0x271591,null))['then'](removeEntity(_0x271591,null))[_0xaf16('0x3f')](handleError(_0x271591,null));}; \ No newline at end of file +var _0x66dd=['find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','rows','catch','show','create','body','params'];(function(_0x39e6f4,_0x2dc3a5){var _0x1b5970=function(_0x3489a1){while(--_0x3489a1){_0x39e6f4['push'](_0x39e6f4['shift']());}};_0x1b5970(++_0x2dc3a5);}(_0x66dd,0x1ab));var _0xd66d=function(_0x39b42c,_0x17111b){_0x39b42c=_0x39b42c-0x0;var _0x5db2dd=_0x66dd[_0x39b42c];return _0x5db2dd;};'use strict';var pdf=require(_0xd66d('0x0'));var emlformat=require(_0xd66d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd66d('0x2'));var jsonpatch=require(_0xd66d('0x3'));var rp=require(_0xd66d('0x4'));var moment=require('moment');var BPromise=require(_0xd66d('0x5'));var Mustache=require('mustache');var util=require(_0xd66d('0x6'));var path=require(_0xd66d('0x7'));var sox=require(_0xd66d('0x8'));var csv=require('to-csv');var ejs=require(_0xd66d('0x9'));var fs=require('fs');var _=require(_0xd66d('0xa'));var squel=require('squel');var crypto=require(_0xd66d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd66d('0xc'));var Redis=require('ioredis');var authService=require(_0xd66d('0xd'));var qs=require(_0xd66d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd66d('0xf'));var logger=require('../../config/logger')(_0xd66d('0x10'));var utils=require('../../config/utils');var config=require(_0xd66d('0x11'));var licenseUtil=require(_0xd66d('0x12'));var db=require(_0xd66d('0x13'))['db'];function respondWithStatusCode(_0x4d5e03,_0x13868d){_0x13868d=_0x13868d||0xcc;return function(_0x3a1973){if(_0x3a1973){return _0x4d5e03[_0xd66d('0x14')](_0x13868d);}return _0x4d5e03[_0xd66d('0x15')](_0x13868d)[_0xd66d('0x16')]();};}function respondWithResult(_0x2b92fd,_0x1df005){_0x1df005=_0x1df005||0xc8;return function(_0x5e6555){if(_0x5e6555){return _0x2b92fd[_0xd66d('0x15')](_0x1df005)[_0xd66d('0x17')](_0x5e6555);}};}function respondWithFilteredResult(_0x26082d,_0x454fc3){return function(_0x197a5a){if(_0x197a5a){var _0x555b4f=_0x197a5a['count'],_0x2cd6cc=_0x454fc3[_0xd66d('0x18')],_0x2fba88=_0x454fc3[_0xd66d('0x18')]+_0x454fc3['limit'],_0x63e61d;if(_0x2fba88>=_0x555b4f){_0x2fba88=_0x555b4f;_0x63e61d=0xc8;}else{_0x63e61d=0xce;}_0x26082d[_0xd66d('0x15')](_0x63e61d);return _0x26082d[_0xd66d('0x19')](_0xd66d('0x1a'),_0x2cd6cc+'-'+_0x2fba88+'/'+_0x555b4f)[_0xd66d('0x17')](_0x197a5a);}return null;};}function patchUpdates(_0x2143bc){return function(_0x18cd8f){try{jsonpatch[_0xd66d('0x1b')](_0x18cd8f,_0x2143bc,!![]);}catch(_0x3d275e){return BPromise[_0xd66d('0x1c')](_0x3d275e);}return _0x18cd8f[_0xd66d('0x1d')]();};}function saveUpdates(_0x3a477e,_0x5618f2){return function(_0x1e5185){if(_0x1e5185){return _0x1e5185[_0xd66d('0x1e')](_0x3a477e)[_0xd66d('0x1f')](function(_0x167684){return _0x167684;});}return null;};}function removeEntity(_0x205518,_0x30b5d1){return function(_0x416286){if(_0x416286){return _0x416286[_0xd66d('0x20')]()[_0xd66d('0x1f')](function(){_0x205518[_0xd66d('0x15')](0xcc)[_0xd66d('0x16')]();});}};}function handleEntityNotFound(_0x4c407b,_0x74ad6d){return function(_0x5eabbe){if(!_0x5eabbe){_0x4c407b[_0xd66d('0x14')](0x194);}return _0x5eabbe;};}function handleError(_0x4a8988,_0x16db52){_0x16db52=_0x16db52||0x1f4;return function(_0x20c413){logger['error'](_0x20c413[_0xd66d('0x21')]);if(_0x20c413[_0xd66d('0x22')]){delete _0x20c413[_0xd66d('0x22')];}_0x4a8988[_0xd66d('0x15')](_0x16db52)[_0xd66d('0x23')](_0x20c413);};}exports[_0xd66d('0x24')]=function(_0x23d91c,_0x5439fe){var _0x35506f={},_0x48a5cc={},_0x428245={'count':0x0,'rows':[]};var _0x547bf0=_[_0xd66d('0x25')](db[_0xd66d('0x26')][_0xd66d('0x27')],function(_0x4d4d5b){return{'name':_0x4d4d5b[_0xd66d('0x28')],'type':_0x4d4d5b['type'][_0xd66d('0x29')]};});_0x48a5cc[_0xd66d('0x2a')]=_[_0xd66d('0x25')](_0x547bf0,_0xd66d('0x22'));_0x48a5cc[_0xd66d('0x2b')]=_[_0xd66d('0x2c')](_0x23d91c['query']);_0x48a5cc[_0xd66d('0x2d')]=_['intersection'](_0x48a5cc[_0xd66d('0x2a')],_0x48a5cc[_0xd66d('0x2b')]);_0x35506f[_0xd66d('0x2e')]=_[_0xd66d('0x2f')](_0x48a5cc['model'],qs[_0xd66d('0x30')](_0x23d91c[_0xd66d('0x2b')][_0xd66d('0x30')]));_0x35506f[_0xd66d('0x2e')]=_0x35506f[_0xd66d('0x2e')][_0xd66d('0x31')]?_0x35506f['attributes']:_0x48a5cc[_0xd66d('0x2a')];if(!_0x23d91c[_0xd66d('0x2b')][_0xd66d('0x32')](_0xd66d('0x33'))){_0x35506f[_0xd66d('0x34')]=qs[_0xd66d('0x34')](_0x23d91c[_0xd66d('0x2b')][_0xd66d('0x34')]);_0x35506f[_0xd66d('0x18')]=qs[_0xd66d('0x18')](_0x23d91c[_0xd66d('0x2b')][_0xd66d('0x18')]);}_0x35506f[_0xd66d('0x35')]=qs[_0xd66d('0x36')](_0x23d91c[_0xd66d('0x2b')]['sort']);_0x35506f[_0xd66d('0x37')]=qs[_0xd66d('0x2d')](_[_0xd66d('0x38')](_0x23d91c[_0xd66d('0x2b')],_0x48a5cc[_0xd66d('0x2d')]),_0x547bf0);if(_0x23d91c[_0xd66d('0x2b')][_0xd66d('0x39')]){_0x35506f['where']=_[_0xd66d('0x3a')](_0x35506f[_0xd66d('0x37')],{'$or':_['map'](_0x547bf0,function(_0xd3f1ee){if(_0xd3f1ee[_0xd66d('0x3b')]!=='VIRTUAL'){var _0x16d4a9={};_0x16d4a9[_0xd3f1ee['name']]={'$like':'%'+_0x23d91c['query'][_0xd66d('0x39')]+'%'};return _0x16d4a9;}})});}_0x35506f=_['merge']({},_0x35506f,_0x23d91c[_0xd66d('0x3c')]);var _0x392eaa={'where':_0x35506f[_0xd66d('0x37')]};return db[_0xd66d('0x26')][_0xd66d('0x3d')](_0x392eaa)['then'](function(_0x239cfe){_0x428245[_0xd66d('0x3d')]=_0x239cfe;if(_0x23d91c['query'][_0xd66d('0x3e')]){_0x35506f[_0xd66d('0x3f')]=[{'all':!![]}];}return db[_0xd66d('0x26')]['findAll'](_0x35506f);})[_0xd66d('0x1f')](function(_0x14c0cd){_0x428245[_0xd66d('0x40')]=_0x14c0cd;return _0x428245;})[_0xd66d('0x1f')](respondWithFilteredResult(_0x5439fe,_0x35506f))[_0xd66d('0x41')](handleError(_0x5439fe,null));};exports[_0xd66d('0x42')]=function(_0x2d3bc1,_0x21f2fe){var _0x3ccb5c={'raw':!![],'where':{'id':_0x2d3bc1['params']['id']}},_0x1f3a29={};_0x1f3a29[_0xd66d('0x2a')]=_[_0xd66d('0x2c')](db[_0xd66d('0x26')][_0xd66d('0x27')]);_0x1f3a29[_0xd66d('0x2b')]=_[_0xd66d('0x2c')](_0x2d3bc1[_0xd66d('0x2b')]);_0x1f3a29['filters']=_[_0xd66d('0x2f')](_0x1f3a29[_0xd66d('0x2a')],_0x1f3a29[_0xd66d('0x2b')]);_0x3ccb5c['attributes']=_[_0xd66d('0x2f')](_0x1f3a29[_0xd66d('0x2a')],qs[_0xd66d('0x30')](_0x2d3bc1[_0xd66d('0x2b')][_0xd66d('0x30')]));_0x3ccb5c[_0xd66d('0x2e')]=_0x3ccb5c[_0xd66d('0x2e')]['length']?_0x3ccb5c[_0xd66d('0x2e')]:_0x1f3a29[_0xd66d('0x2a')];if(_0x2d3bc1[_0xd66d('0x2b')][_0xd66d('0x3e')]){_0x3ccb5c[_0xd66d('0x3f')]=[{'all':!![]}];}_0x3ccb5c=_['merge']({},_0x3ccb5c,_0x2d3bc1['options']);return db[_0xd66d('0x26')]['find'](_0x3ccb5c)[_0xd66d('0x1f')](handleEntityNotFound(_0x21f2fe,null))[_0xd66d('0x1f')](respondWithResult(_0x21f2fe,null))['catch'](handleError(_0x21f2fe,null));};exports[_0xd66d('0x43')]=function(_0x2134be,_0x5a8955){return db['VoiceQueuesLog']['create'](_0x2134be[_0xd66d('0x44')],{})[_0xd66d('0x1f')](respondWithResult(_0x5a8955,0xc9))[_0xd66d('0x41')](handleError(_0x5a8955,null));};exports[_0xd66d('0x1e')]=function(_0x43f569,_0x5a6dc4){if(_0x43f569['body']['id']){delete _0x43f569[_0xd66d('0x44')]['id'];}return db[_0xd66d('0x26')]['find']({'where':{'id':_0x43f569[_0xd66d('0x45')]['id']}})[_0xd66d('0x1f')](handleEntityNotFound(_0x5a6dc4,null))[_0xd66d('0x1f')](saveUpdates(_0x43f569[_0xd66d('0x44')],null))['then'](respondWithResult(_0x5a6dc4,null))[_0xd66d('0x41')](handleError(_0x5a6dc4,null));};exports['destroy']=function(_0x3e3ed4,_0x413d15){return db[_0xd66d('0x26')][_0xd66d('0x46')]({'where':{'id':_0x3e3ed4[_0xd66d('0x45')]['id']}})[_0xd66d('0x1f')](handleEntityNotFound(_0x413d15,null))[_0xd66d('0x1f')](removeEntity(_0x413d15,null))['catch'](handleError(_0x413d15,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 2230c70..d181017 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 _0x275a=['../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','api','bluebird','request-promise','rimraf'];(function(_0x542fec,_0x2d053b){var _0xe1d84d=function(_0x35537b){while(--_0x35537b){_0x542fec['push'](_0x542fec['shift']());}};_0xe1d84d(++_0x2d053b);}(_0x275a,0x193));var _0xa275=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x275a[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0xa275('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa275('0x1'));var moment=require('moment');var BPromise=require(_0xa275('0x2'));var rp=require(_0xa275('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa275('0x4'));var config=require(_0xa275('0x5'));var attributes=require(_0xa275('0x6'));module[_0xa275('0x7')]=function(_0x2fdb5e,_0x4ed9e7){return _0x2fdb5e['define'](_0xa275('0x8'),attributes,{'tableName':_0xa275('0x9'),'paranoid':![],'indexes':[{'name':_0xa275('0xa'),'fields':[_0xa275('0xb'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xb2ef=['rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xb2ef,0x158));var _0xfb2e=function(_0x113b71,_0x11684a){_0x113b71=_0x113b71-0x0;var _0xf680f5=_0xb2ef[_0x113b71];return _0xf680f5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfb2e('0x0'))(_0xfb2e('0x1'));var moment=require(_0xfb2e('0x2'));var BPromise=require(_0xfb2e('0x3'));var rp=require(_0xfb2e('0x4'));var fs=require('fs');var path=require(_0xfb2e('0x5'));var rimraf=require(_0xfb2e('0x6'));var config=require(_0xfb2e('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0xfb2e('0x8')]=function(_0x1c072f,_0x286a46){return _0x1c072f[_0xfb2e('0x9')](_0xfb2e('0xa'),attributes,{'tableName':_0xfb2e('0xb'),'paranoid':![],'indexes':[{'name':_0xfb2e('0xc'),'fields':[_0xfb2e('0xd'),'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 73947d3..187ac98 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 _0xb688=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2b12f3,_0x56cdb2){var _0x3a8d7d=function(_0x59fe6e){while(--_0x59fe6e){_0x2b12f3['push'](_0x2b12f3['shift']());}};_0x3a8d7d(++_0x56cdb2);}(_0xb688,0xcf));var _0x8b68=function(_0x1f5089,_0x299b98){_0x1f5089=_0x1f5089-0x0;var _0x557380=_0xb688[_0x1f5089];return _0x557380;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var moment=require(_0x8b68('0x1'));var BPromise=require(_0x8b68('0x2'));var rs=require(_0x8b68('0x3'));var fs=require('fs');var Redis=require(_0x8b68('0x4'));var db=require(_0x8b68('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b68('0x6'))(_0x8b68('0x7'));var config=require(_0x8b68('0x8'));var jayson=require(_0x8b68('0x9'));var client=jayson['client'][_0x8b68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ee56,_0x37677d,_0x2bbffd){return new BPromise(function(_0x130892,_0xa5571b){return client[_0x8b68('0xb')](_0x57ee56,_0x2bbffd)[_0x8b68('0xc')](function(_0x261753){logger[_0x8b68('0xd')](_0x8b68('0xe'),_0x37677d,_0x8b68('0xf'));logger[_0x8b68('0x10')](_0x8b68('0x11'),_0x37677d,_0x8b68('0xf'),JSON['stringify'](_0x261753));if(_0x261753[_0x8b68('0x12')]){if(_0x261753[_0x8b68('0x12')][_0x8b68('0x13')]===0x1f4){logger[_0x8b68('0x12')](_0x8b68('0xe'),_0x37677d,_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);return _0xa5571b(_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);}logger['error'](_0x8b68('0xe'),_0x37677d,_0x261753['error']['message']);return _0x130892(_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);}else{logger[_0x8b68('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x37677d,'request\x20sent');_0x130892(_0x261753[_0x8b68('0x15')]['message']);}})[_0x8b68('0x16')](function(_0xb44923){logger[_0x8b68('0x12')](_0x8b68('0xe'),_0x37677d,_0xb44923);_0xa5571b(_0xb44923);});});} \ No newline at end of file +var _0x94df=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x17b8a9,_0x3bbf58){var _0x4add80=function(_0x683126){while(--_0x683126){_0x17b8a9['push'](_0x17b8a9['shift']());}};_0x4add80(++_0x3bbf58);}(_0x94df,0xa3));var _0xf94d=function(_0x48dcbb,_0x71640e){_0x48dcbb=_0x48dcbb-0x0;var _0xe91fe9=_0x94df[_0x48dcbb];return _0xe91fe9;};'use strict';var _=require(_0xf94d('0x0'));var util=require(_0xf94d('0x1'));var moment=require(_0xf94d('0x2'));var BPromise=require(_0xf94d('0x3'));var rs=require(_0xf94d('0x4'));var fs=require('fs');var Redis=require(_0xf94d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf94d('0x6'));var logger=require(_0xf94d('0x7'))(_0xf94d('0x8'));var config=require(_0xf94d('0x9'));var jayson=require(_0xf94d('0xa'));var client=jayson[_0xf94d('0xb')][_0xf94d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18a11a,_0x1ebc19,_0xf285b5){return new BPromise(function(_0x1832e9,_0x504670){return client[_0xf94d('0xd')](_0x18a11a,_0xf285b5)[_0xf94d('0xe')](function(_0x145f5b){logger[_0xf94d('0xf')](_0xf94d('0x10'),_0x1ebc19,_0xf94d('0x11'));logger['debug'](_0xf94d('0x12'),_0x1ebc19,_0xf94d('0x11'),JSON[_0xf94d('0x13')](_0x145f5b));if(_0x145f5b[_0xf94d('0x14')]){if(_0x145f5b[_0xf94d('0x14')]['code']===0x1f4){logger['error'](_0xf94d('0x10'),_0x1ebc19,_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);return _0x504670(_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);}logger[_0xf94d('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1ebc19,_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);return _0x1832e9(_0x145f5b[_0xf94d('0x14')][_0xf94d('0x15')]);}else{logger[_0xf94d('0xf')](_0xf94d('0x10'),_0x1ebc19,_0xf94d('0x11'));_0x1832e9(_0x145f5b[_0xf94d('0x16')]['message']);}})[_0xf94d('0x17')](function(_0x5cd967){logger[_0xf94d('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1ebc19,_0x5cd967);_0x504670(_0x5cd967);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 5872c06..033b68a 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 _0x7eac=['runTranscribe','put','update','delete','multer','util','path','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create'];(function(_0x555069,_0x23d66a){var _0x100af7=function(_0x1606bd){while(--_0x1606bd){_0x555069['push'](_0x555069['shift']());}};_0x100af7(++_0x23d66a);}(_0x7eac,0x64));var _0xc7ea=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7eac[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0xc7ea('0x0'));var util=require(_0xc7ea('0x1'));var path=require(_0xc7ea('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xc7ea('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc7ea('0x4'));var controller=require(_0xc7ea('0x5'));router[_0xc7ea('0x6')]('/',auth[_0xc7ea('0x7')](),controller[_0xc7ea('0x8')]);router['get'](_0xc7ea('0x9'),auth[_0xc7ea('0x7')](),controller[_0xc7ea('0xa')]);router[_0xc7ea('0x6')](_0xc7ea('0xb'),auth[_0xc7ea('0x7')](),controller[_0xc7ea('0xc')]);router[_0xc7ea('0x6')](_0xc7ea('0xd'),auth['isAuthenticated'](),controller['download']);router[_0xc7ea('0x6')](_0xc7ea('0xe'),controller[_0xc7ea('0xf')]);router[_0xc7ea('0x6')](_0xc7ea('0x10'),auth[_0xc7ea('0x7')](),controller[_0xc7ea('0x11')]);router[_0xc7ea('0x12')]('/',auth['isAuthenticated'](),controller[_0xc7ea('0x13')]);router['post'](_0xc7ea('0x10'),auth[_0xc7ea('0x7')](),controller[_0xc7ea('0x14')]);router[_0xc7ea('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xc7ea('0x16')]);router[_0xc7ea('0x17')]('/:id',auth[_0xc7ea('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd54a=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','/:id/downloads','downloads','post','/:id/transcribe','runTranscribe','update','delete','destroy','exports','multer'];(function(_0x1e4caa,_0x294b51){var _0x4bd61a=function(_0x39ec8b){while(--_0x39ec8b){_0x1e4caa['push'](_0x1e4caa['shift']());}};_0x4bd61a(++_0x294b51);}(_0xd54a,0xbf));var _0xad54=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xd54a[_0x3b0731];return _0x4204d7;};'use strict';var multer=require(_0xad54('0x0'));var util=require(_0xad54('0x1'));var path=require(_0xad54('0x2'));var timeout=require(_0xad54('0x3'));var express=require('express');var router=express[_0xad54('0x4')]();var auth=require(_0xad54('0x5'));var interaction=require(_0xad54('0x6'));var config=require('../../config/environment');var controller=require(_0xad54('0x7'));router[_0xad54('0x8')]('/',auth[_0xad54('0x9')](),controller[_0xad54('0xa')]);router[_0xad54('0x8')](_0xad54('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xad54('0x8')](_0xad54('0xc'),auth['isAuthenticated'](),controller[_0xad54('0xd')]);router['get'](_0xad54('0xe'),auth['isAuthenticated'](),controller['download']);router['get'](_0xad54('0xf'),controller[_0xad54('0x10')]);router[_0xad54('0x8')]('/:id/transcribe',auth[_0xad54('0x9')](),controller['downloadTranscribe']);router[_0xad54('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xad54('0x12'),auth[_0xad54('0x9')](),controller[_0xad54('0x13')]);router['put'](_0xad54('0xc'),auth[_0xad54('0x9')](),controller[_0xad54('0x14')]);router[_0xad54('0x15')](_0xad54('0xc'),auth['isAuthenticated'](),controller[_0xad54('0x16')]);module[_0xad54('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 0066663..647cdca 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 _0xe0eb=['VIRTUAL','value','getDataValue','STRING','setDataValue','INTEGER','TEXT','NEW','FLOAT','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe0eb,0xd4));var _0xbe0e=function(_0x4369ef,_0x55cfbc){_0x4369ef=_0x4369ef-0x0;var _0x5b6913=_0xe0eb[_0x4369ef];return _0x5b6913;};'use strict';var Sequelize=require(_0xbe0e('0x0'));var moment=require(_0xbe0e('0x1'));var path=require(_0xbe0e('0x2'));module[_0xbe0e('0x3')]={'format':{'type':Sequelize[_0xbe0e('0x4')],'get':function(){return this['getDataValue'](_0xbe0e('0x5'))?path['extname'](this[_0xbe0e('0x6')](_0xbe0e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0xbe0e('0x7')]},'channel':{'type':Sequelize[_0xbe0e('0x7')],'set':function(_0x2a27c8){if(_0x2a27c8){this[_0xbe0e('0x8')]('channel',_0x2a27c8);this[_0xbe0e('0x8')]('membername',_0x2a27c8['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xbe0e('0x7')]},'calleridnum':{'type':Sequelize[_0xbe0e('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xbe0e('0x7')]},'connectedlinename':{'type':Sequelize[_0xbe0e('0x7')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xbe0e('0x7')]},'exten':{'type':Sequelize[_0xbe0e('0x7')]},'value':{'type':Sequelize[_0xbe0e('0x7')]},'type':{'type':Sequelize[_0xbe0e('0x7')]},'rating':{'type':Sequelize[_0xbe0e('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xbe0e('0x7')]},'userDisposition':{'type':Sequelize[_0xbe0e('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xbe0e('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xbe0e('0x7')]},'location':{'type':Sequelize[_0xbe0e('0xa')]},'transcribeName':{'type':Sequelize[_0xbe0e('0x7')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0xbe0e('0xb')},'fileUri':{'type':Sequelize[_0xbe0e('0xa')]},'fileText':{'type':Sequelize[_0xbe0e('0xa')]},'failureReason':{'type':Sequelize[_0xbe0e('0xa')]},'sentiment':{'type':Sequelize[_0xbe0e('0x7')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0xbe0e('0xc')]},'sNeutral':{'type':Sequelize[_0xbe0e('0xc')]},'sMixed':{'type':Sequelize[_0xbe0e('0xc')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xbe0e('0xd')],'get':function(){return moment(this[_0xbe0e('0x6')]('createdAt'))[_0xbe0e('0xe')](_0xbe0e('0xf'))[_0xbe0e('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xbe0e('0x6')](_0xbe0e('0x11')))['format']('MM-DD-YYYY\x20HH:mm')[_0xbe0e('0x10')]();}}}; \ No newline at end of file +var _0x8032=['getDataValue','value','extname','STRING','setDataValue','channel','split','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','moment','path','exports','VIRTUAL'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x8032,0xe0));var _0x2803=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0x8032[_0x3db122];return _0x325b67;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2803('0x0'));var path=require(_0x2803('0x1'));module[_0x2803('0x2')]={'format':{'type':Sequelize[_0x2803('0x3')],'get':function(){return this[_0x2803('0x4')](_0x2803('0x5'))?path[_0x2803('0x6')](this[_0x2803('0x4')](_0x2803('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x2803('0x7')]},'channel':{'type':Sequelize[_0x2803('0x7')],'set':function(_0x54fa74){if(_0x54fa74){this[_0x2803('0x8')](_0x2803('0x9'),_0x54fa74);this[_0x2803('0x8')]('membername',_0x54fa74[_0x2803('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x2803('0x7')]},'calleridnum':{'type':Sequelize[_0x2803('0x7')]},'calleridname':{'type':Sequelize[_0x2803('0x7')]},'connectedlinenum':{'type':Sequelize[_0x2803('0x7')]},'connectedlinename':{'type':Sequelize[_0x2803('0x7')]},'accountcode':{'type':Sequelize[_0x2803('0x7')]},'context':{'type':Sequelize[_0x2803('0x7')]},'exten':{'type':Sequelize[_0x2803('0x7')]},'value':{'type':Sequelize[_0x2803('0x7')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x2803('0x7')]},'userDisposition':{'type':Sequelize[_0x2803('0x7')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x2803('0xb')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x2803('0x7')],'defaultValue':_0x2803('0xc')},'fileUri':{'type':Sequelize[_0x2803('0xb')]},'fileText':{'type':Sequelize[_0x2803('0xb')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x2803('0x7')]},'sPositive':{'type':Sequelize[_0x2803('0xd')]},'sNegative':{'type':Sequelize[_0x2803('0xd')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x2803('0xd')]},'tempSentiment':{'type':Sequelize[_0x2803('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x2803('0xf')],'get':function(){return moment(this['getDataValue'](_0x2803('0x10')))['format'](_0x2803('0x11'))[_0x2803('0x12')]();}},'updatedAt':{'type':Sequelize[_0x2803('0xf')],'get':function(){return moment(this[_0x2803('0x4')]('updatedAt'))['format'](_0x2803('0x11'))[_0x2803('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index e8f9164..3e5b282 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 _0x4e8c=['[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../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','save','update','then','destroy','end','stack','name','index','VoiceRecording','rawAttributes','type','key','model','differenceBy','map','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','show','params','keys','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','sequelize','MD5','$and','push','%s.cypher','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','runTranscribe','decryptFile','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets'];(function(_0x1e4b45,_0x45e261){var _0x320889=function(_0x48261c){while(--_0x48261c){_0x1e4b45['push'](_0x1e4b45['shift']());}};_0x320889(++_0x45e261);}(_0x4e8c,0xa2));var _0xc4e8=function(_0xd89cec,_0x4e3c06){_0xd89cec=_0xd89cec-0x0;var _0x2d5bb3=_0x4e8c[_0xd89cec];return _0x2d5bb3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc4e8('0x0'));var rimraf=require(_0xc4e8('0x1'));var zipdir=require(_0xc4e8('0x2'));var jsonpatch=require(_0xc4e8('0x3'));var rp=require(_0xc4e8('0x4'));var moment=require(_0xc4e8('0x5'));var BPromise=require(_0xc4e8('0x6'));var Mustache=require(_0xc4e8('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc4e8('0x8'));var csv=require(_0xc4e8('0x9'));var ejs=require(_0xc4e8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc4e8('0xb'));var crypto=require(_0xc4e8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc4e8('0xd'));var toCsv=require(_0xc4e8('0x9'));var querystring=require(_0xc4e8('0xe'));var Papa=require(_0xc4e8('0xf'));var AWS=require(_0xc4e8('0x10'));var uuidv4=require(_0xc4e8('0x11'));var Redis=require(_0xc4e8('0x12'));var authService=require(_0xc4e8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc4e8('0x14'));var hardwareService=require(_0xc4e8('0x15'));var logger=require(_0xc4e8('0x16'))(_0xc4e8('0x17'));var utils=require(_0xc4e8('0x18'));var config=require(_0xc4e8('0x19'));var licenseUtil=require(_0xc4e8('0x1a'));var db=require(_0xc4e8('0x1b'))['db'];function respondWithStatusCode(_0x2bf9f3,_0x48a484){_0x48a484=_0x48a484||0xcc;return function(_0x4dbd3a){if(_0x4dbd3a){return _0x2bf9f3[_0xc4e8('0x1c')](_0x48a484);}return _0x2bf9f3['status'](_0x48a484)['end']();};}function respondWithResult(_0x38eb22,_0x13ad3a){_0x13ad3a=_0x13ad3a||0xc8;return function(_0xaf797){if(_0xaf797){return _0x38eb22[_0xc4e8('0x1d')](_0x13ad3a)[_0xc4e8('0x1e')](_0xaf797);}};}function respondWithFilteredResult(_0x18eb12,_0x5d7cce){return function(_0x448ea9){if(_0x448ea9){var _0x656d7c=_0x448ea9[_0xc4e8('0x1f')],_0x1bded5=_0x5d7cce[_0xc4e8('0x20')],_0x2d30b2=_0x5d7cce[_0xc4e8('0x20')]+_0x5d7cce[_0xc4e8('0x21')],_0x42cabe;if(_0x2d30b2>=_0x656d7c){_0x2d30b2=_0x656d7c;_0x42cabe=0xc8;}else{_0x42cabe=0xce;}_0x18eb12[_0xc4e8('0x1d')](_0x42cabe);return _0x18eb12[_0xc4e8('0x22')](_0xc4e8('0x23'),_0x1bded5+'-'+_0x2d30b2+'/'+_0x656d7c)['json'](_0x448ea9);}return null;};}function patchUpdates(_0x2727db){return function(_0x19876d){try{jsonpatch[_0xc4e8('0x24')](_0x19876d,_0x2727db,!![]);}catch(_0x26c599){return BPromise[_0xc4e8('0x25')](_0x26c599);}return _0x19876d[_0xc4e8('0x26')]();};}function saveUpdates(_0x593f12,_0x381921){return function(_0x5b4860){if(_0x5b4860){return _0x5b4860[_0xc4e8('0x27')](_0x593f12)[_0xc4e8('0x28')](function(_0x2f8210){return _0x2f8210;});}return null;};}function removeEntity(_0x4b60ae,_0x20add2){return function(_0x4c963c){if(_0x4c963c){return _0x4c963c[_0xc4e8('0x29')]()['then'](function(){_0x4b60ae[_0xc4e8('0x1d')](0xcc)[_0xc4e8('0x2a')]();});}};}function handleEntityNotFound(_0x4b47c4,_0x95c271){return function(_0x44fe30){if(!_0x44fe30){_0x4b47c4['sendStatus'](0x194);}return _0x44fe30;};}function handleError(_0x1f8cec,_0x22eb1c){_0x22eb1c=_0x22eb1c||0x1f4;return function(_0x22d8c1){logger['error'](_0x22d8c1[_0xc4e8('0x2b')]);if(_0x22d8c1['name']){delete _0x22d8c1[_0xc4e8('0x2c')];}_0x1f8cec[_0xc4e8('0x1d')](_0x22eb1c)['send'](_0x22d8c1);};}exports[_0xc4e8('0x2d')]=function(_0x1ad13a,_0x3161bd){var _0x3f4feb={},_0x31f9c5={},_0x494875={'count':0x0,'rows':[]};var _0x43ba06=_['map'](db[_0xc4e8('0x2e')][_0xc4e8('0x2f')],function(_0x30cfe4){return{'name':_0x30cfe4['fieldName'],'type':_0x30cfe4[_0xc4e8('0x30')][_0xc4e8('0x31')]};});_0x31f9c5[_0xc4e8('0x32')]=_[_0xc4e8('0x33')](_[_0xc4e8('0x34')](_0x43ba06,'name'),[_0xc4e8('0x35')]);_0x31f9c5[_0xc4e8('0x36')]=_['keys'](_0x1ad13a[_0xc4e8('0x36')]);_0x31f9c5[_0xc4e8('0x37')]=_[_0xc4e8('0x38')](_0x31f9c5[_0xc4e8('0x32')],_0x31f9c5[_0xc4e8('0x36')]);_0x3f4feb[_0xc4e8('0x39')]=_[_0xc4e8('0x38')](_0x31f9c5[_0xc4e8('0x32')],qs[_0xc4e8('0x3a')](_0x1ad13a[_0xc4e8('0x36')]['fields']));_0x3f4feb[_0xc4e8('0x39')]=_0x3f4feb['attributes'][_0xc4e8('0x3b')]?_0x3f4feb[_0xc4e8('0x39')]:_0x31f9c5[_0xc4e8('0x32')];if(!_0x1ad13a['query'][_0xc4e8('0x3c')](_0xc4e8('0x3d'))){_0x3f4feb[_0xc4e8('0x21')]=qs[_0xc4e8('0x21')](_0x1ad13a[_0xc4e8('0x36')]['limit']);_0x3f4feb[_0xc4e8('0x20')]=qs[_0xc4e8('0x20')](_0x1ad13a[_0xc4e8('0x36')][_0xc4e8('0x20')]);}_0x3f4feb['order']=qs[_0xc4e8('0x3e')](_0x1ad13a[_0xc4e8('0x36')][_0xc4e8('0x3e')]);_0x3f4feb['where']=qs['filters'](_[_0xc4e8('0x3f')](_0x1ad13a[_0xc4e8('0x36')],_0x31f9c5[_0xc4e8('0x37')]),_0x43ba06);if(_0x1ad13a[_0xc4e8('0x36')]['filter']){_0x3f4feb[_0xc4e8('0x40')]=_['merge'](_0x3f4feb[_0xc4e8('0x40')],{'$or':_[_0xc4e8('0x34')](_0x43ba06,function(_0x28d133){if(_0x28d133['type']!==_0xc4e8('0x41')){var _0x5a9601={};_0x5a9601[_0x28d133[_0xc4e8('0x2c')]]={'$like':'%'+_0x1ad13a[_0xc4e8('0x36')][_0xc4e8('0x42')]+'%'};return _0x5a9601;}})});}_0x3f4feb=_[_0xc4e8('0x43')]({},_0x3f4feb,_0x1ad13a['options']);var _0x4d5745={'where':_0x3f4feb[_0xc4e8('0x40')]};return db['VoiceRecording']['count'](_0x4d5745)[_0xc4e8('0x28')](function(_0x45406f){_0x494875[_0xc4e8('0x1f')]=_0x45406f;if(_0x1ad13a[_0xc4e8('0x36')][_0xc4e8('0x44')]){_0x3f4feb[_0xc4e8('0x45')]=[{'all':!![]}];}return db[_0xc4e8('0x2e')]['findAll'](_0x3f4feb);})[_0xc4e8('0x28')](function(_0x45111){_0x494875[_0xc4e8('0x46')]=_0x45111;return _0x494875;})['then'](respondWithFilteredResult(_0x3161bd,_0x3f4feb))[_0xc4e8('0x47')](handleError(_0x3161bd,null));};exports[_0xc4e8('0x48')]=function(_0x2f098e,_0x1b1ef6){var _0x1d2712={'raw':![],'where':{'id':_0x2f098e[_0xc4e8('0x49')]['id']}},_0x251c21={};_0x251c21['model']=_[_0xc4e8('0x4a')](db[_0xc4e8('0x2e')][_0xc4e8('0x2f')]);_0x251c21[_0xc4e8('0x36')]=_[_0xc4e8('0x4a')](_0x2f098e[_0xc4e8('0x36')]);_0x251c21['filters']=_[_0xc4e8('0x38')](_0x251c21[_0xc4e8('0x32')],_0x251c21[_0xc4e8('0x36')]);_0x1d2712[_0xc4e8('0x39')]=_['intersection'](_0x251c21[_0xc4e8('0x32')],qs[_0xc4e8('0x3a')](_0x2f098e[_0xc4e8('0x36')][_0xc4e8('0x3a')]));_0x1d2712[_0xc4e8('0x39')]=_0x1d2712[_0xc4e8('0x39')]['length']?_0x1d2712[_0xc4e8('0x39')]:_0x251c21[_0xc4e8('0x32')];if(_0x2f098e[_0xc4e8('0x36')][_0xc4e8('0x44')]){_0x1d2712[_0xc4e8('0x45')]=[{'all':!![]}];}_0x1d2712=_[_0xc4e8('0x43')]({},_0x1d2712,_0x2f098e[_0xc4e8('0x4b')]);return db[_0xc4e8('0x2e')][_0xc4e8('0x4c')](_0x1d2712)[_0xc4e8('0x28')](handleEntityNotFound(_0x1b1ef6,null))['then'](respondWithResult(_0x1b1ef6,null))['catch'](handleError(_0x1b1ef6,null));};exports[_0xc4e8('0x4d')]=function(_0x22376b,_0x2f63aa){return db['VoiceRecording'][_0xc4e8('0x4d')](_0x22376b[_0xc4e8('0x4e')],{})[_0xc4e8('0x28')](respondWithResult(_0x2f63aa,0xc9))['catch'](handleError(_0x2f63aa,null));};exports[_0xc4e8('0x27')]=function(_0x253b71,_0x140db1){if(_0x253b71['body']['id']){delete _0x253b71[_0xc4e8('0x4e')]['id'];}return db[_0xc4e8('0x2e')][_0xc4e8('0x4c')]({'where':{'id':_0x253b71['params']['id']}})[_0xc4e8('0x28')](handleEntityNotFound(_0x140db1,null))[_0xc4e8('0x28')](saveUpdates(_0x253b71['body'],null))[_0xc4e8('0x28')](respondWithResult(_0x140db1,null))['catch'](handleError(_0x140db1,null));};exports[_0xc4e8('0x4f')]=function(_0x36df46,_0x32e981){return db[_0xc4e8('0x2e')][_0xc4e8('0x4f')]()['then'](respondWithResult(_0x32e981,null))['catch'](handleError(_0x32e981,null));};exports[_0xc4e8('0x50')]=function(_0x1e04d6,_0x1f4241,_0x1be85f){var _0x4a903f=require(_0xc4e8('0x51'));var _0x4cfde1=![];var _0x3b3020={};if(_0x1e04d6[_0xc4e8('0x36')][_0xc4e8('0x30')]&&_0x1e04d6['query'][_0xc4e8('0x30')]===_0xc4e8('0x52')){_0x3b3020[_0xc4e8('0x52')]=_0x1e04d6[_0xc4e8('0x49')]['id'];}else{_0x3b3020['id']=_0x1e04d6[_0xc4e8('0x49')]['id'];}return db[_0xc4e8('0x2e')][_0xc4e8('0x4c')]({'where':_0x3b3020,'attributes':['id',_0xc4e8('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x1f4241,null))[_0xc4e8('0x28')](function(_0x1a75fb){if(_0x1a75fb){var _0x1d8871=_0x1a75fb[_0xc4e8('0x53')];var _0x428727=util[_0xc4e8('0x35')]('%s.cypher',_0x1d8871);if(fs[_0xc4e8('0x54')](_0x428727)){_0x4cfde1=!![];return _0x4a903f['decryptFile'](_0x428727,_0x1d8871,config[_0xc4e8('0x55')][_0xc4e8('0x56')])[_0xc4e8('0x28')](function(){return _0x1a75fb;});}return _0x1a75fb;}})['then'](function(_0x1dda99){if(_0x1dda99){var _0x5cf028=_0x1dda99[_0xc4e8('0x53')];if(!fs[_0xc4e8('0x54')](_0x5cf028)){throw new db[(_0xc4e8('0x57'))][(_0xc4e8('0x58'))]('VoiceRecording\x20not\x20found');}if(_0x1dda99[_0xc4e8('0x59')]){return _0x1f4241[_0xc4e8('0x50')](_0x5cf028,_0x1dda99['filename']+path[_0xc4e8('0x5a')](_0x5cf028),function(){if(_0x4cfde1){fs[_0xc4e8('0x5b')](_0x5cf028);}});}else{return _0x1f4241['download'](_0x5cf028,function(_0x1ff62a){if(_0x4cfde1){fs[_0xc4e8('0x5b')](_0x5cf028);}});}}})['catch'](function(_0xac9db0){if(_0xac9db0['message']===_0xc4e8('0x5c')){_0x1f4241[_0xc4e8('0x1d')](0x194)[_0xc4e8('0x5d')](_0xc4e8('0x5e'));}else{return handleError(_0x1f4241,null);}});};exports[_0xc4e8('0x5f')]=function(_0x255581,_0x489f23,_0x4f6fb2){var _0x5eb5e8=require(_0xc4e8('0x51'));var _0x2c064a=![];var _0x5693f6={'$and':[db[_0xc4e8('0x60')][_0xc4e8('0x40')](db['sequelize']['fn'](_0xc4e8('0x61'),db[_0xc4e8('0x60')]['col'](_0xc4e8('0x52'))),_0x255581[_0xc4e8('0x36')]['token'])]};if(_0x255581[_0xc4e8('0x36')][_0xc4e8('0x30')]&&_0x255581[_0xc4e8('0x36')]['type']===_0xc4e8('0x52')){_0x5693f6[_0xc4e8('0x62')]['push']({'uniqueid':_0x255581[_0xc4e8('0x49')]['id']});}else{_0x5693f6[_0xc4e8('0x62')][_0xc4e8('0x63')]({'id':_0x255581[_0xc4e8('0x49')]['id']});}return db[_0xc4e8('0x2e')][_0xc4e8('0x4c')]({'where':_0x5693f6,'attributes':['id',_0xc4e8('0x53')],'raw':!![]})[_0xc4e8('0x28')](handleEntityNotFound(_0x489f23,null))[_0xc4e8('0x28')](function(_0x12bc10){if(_0x12bc10){var _0x460715=util[_0xc4e8('0x35')](_0xc4e8('0x64'),_0x12bc10[_0xc4e8('0x53')]);if(fs[_0xc4e8('0x54')](_0x460715)){_0x2c064a=!![];return _0x5eb5e8['decryptFile'](_0x460715,_0x12bc10[_0xc4e8('0x53')],config['secrets'][_0xc4e8('0x56')])[_0xc4e8('0x28')](function(){return _0x12bc10;});}return _0x12bc10;}})[_0xc4e8('0x28')](function(_0x194c30){if(_0x194c30){if(!fs[_0xc4e8('0x54')](_0x194c30['value'])){throw new db[(_0xc4e8('0x57'))][(_0xc4e8('0x58'))]('VoiceRecording\x20not\x20found');}if(_0x194c30[_0xc4e8('0x59')]){return _0x489f23[_0xc4e8('0x50')](_0x194c30['value'],_0x194c30[_0xc4e8('0x59')]+path[_0xc4e8('0x5a')](_0x194c30['value']),function(){if(_0x2c064a){fs[_0xc4e8('0x5b')](_0x194c30[_0xc4e8('0x53')]);}});}else{return _0x489f23[_0xc4e8('0x50')](_0x194c30[_0xc4e8('0x53')],function(_0x4652f9){if(_0x2c064a){fs[_0xc4e8('0x5b')](_0x194c30[_0xc4e8('0x53')]);}});}}})[_0xc4e8('0x47')](handleError(_0x489f23,null));};exports[_0xc4e8('0x29')]=function(_0x29bc1e,_0x1a831b){return db['VoiceRecording']['find']({'where':{'id':_0x29bc1e[_0xc4e8('0x49')]['id']}})[_0xc4e8('0x28')](function(_0x333b41){if(!_0x333b41)throw new ReferenceError(_0xc4e8('0x65'));return _0x333b41;})[_0xc4e8('0x28')](function(_0x3eac02){var _0x362b02=_0x3eac02[_0xc4e8('0x53')];logger[_0xc4e8('0x66')](_0xc4e8('0x67'),_0x362b02);if(!_['isNil'](_0x3eac02['value'])&&fs[_0xc4e8('0x54')](_0x362b02)){logger[_0xc4e8('0x66')](_0xc4e8('0x68')+_0x362b02+_0xc4e8('0x69'));fs[_0xc4e8('0x6a')](_0x362b02);}_0x362b02=_0x362b02+'.cypher';if(!_['isNil'](_0x3eac02[_0xc4e8('0x53')])&&fs['existsSync'](_0x362b02)){logger[_0xc4e8('0x66')](_0xc4e8('0x68')+_0x362b02+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc4e8('0x6a')](_0x362b02);}return _0x3eac02;})[_0xc4e8('0x28')](function(_0xfec19f){if(!_0xfec19f)throw new InternalError();return _0xfec19f[_0xc4e8('0x29')]();})[_0xc4e8('0x28')](function(){_0x1a831b[_0xc4e8('0x1d')](0xcc)[_0xc4e8('0x2a')]();})['catch'](handleError(_0x1a831b,null));};function getBucketslist(_0x4168e6,_0x170523,_0x4b7a9a){return new Promise(function(_0x3f0230,_0x27e657){var _0x319f90=new AWS['S3']({'accessKeyId':_0x170523,'secretAccessKey':_0x4168e6,'region':_0x4b7a9a});_0x319f90[_0xc4e8('0x6b')]({},function(_0x3f758a,_0x53140f){if(_0x3f758a){return _0x27e657(_0x3f758a);}else{return _0x3f0230(_0x53140f);}});});}function createBucket(_0x2697b3,_0x318155,_0x51ac9c,_0x3b60ed){return new Promise(function(_0x47f27b,_0x5857e9){var _0x32727c=new AWS['S3']({'accessKeyId':_0x318155,'secretAccessKey':_0x2697b3,'region':_0x51ac9c});_0x32727c[_0xc4e8('0x6c')]({'Bucket':_0x3b60ed},function(_0x4722ab,_0x35b7b6){if(_0x4722ab){return _0x5857e9(_0x4722ab);}else{return _0x47f27b(_0x35b7b6);}});});}function uploadFile(_0x33389d,_0x4b0eeb,_0x8d6861,_0x430166,_0x860600,_0x5837c9){return new Promise(function(_0x49104d,_0x40be12){var _0x10e918=new AWS['S3']({'accessKeyId':_0x4b0eeb,'secretAccessKey':_0x33389d,'region':_0x8d6861});_0x10e918[_0xc4e8('0x6d')]({'Bucket':_0x430166,'Key':_0x860600,'Body':_0x5837c9},function(_0x1bd938,_0xbfe746){if(_0x1bd938){return _0x40be12(_0x1bd938);}else{return _0x49104d(_0xbfe746);}});});}function startTranscribe(_0x197034,_0xa4f664,_0x144721,_0xedfba9,_0x5835f4,_0x236c1a){return new Promise(function(_0x1353e9,_0x568609){var _0x11261e=new AWS[(_0xc4e8('0x6e'))]({'accessKeyId':_0xa4f664,'secretAccessKey':_0x197034,'region':_0x144721});_0x11261e['startTranscriptionJob']({'TranscriptionJobName':_0xedfba9,'LanguageCode':_0x5835f4,'Media':{'MediaFileUri':_0x236c1a}},function(_0x38eebf,_0x5be91d){if(_0x38eebf){return _0x568609(_0x38eebf);}else{return _0x1353e9(_0x5be91d);}});});}function transcribe(_0x47d91c,_0x3be0ba,_0xb0b659,_0x19e1bb,_0x1123bc,_0x22c746,_0x3dce3f){return new Promise(function(_0x325f80,_0x2c1bd6){var _0x11d5e2={};logger['info'](util['format'](_0xc4e8('0x6f'),_0x47d91c,_0x1123bc));return uploadFile(_0x3be0ba,_0xb0b659,_0x19e1bb,_0x1123bc,path['basename'](_0x22c746),fs[_0xc4e8('0x70')](_0x22c746))[_0xc4e8('0x28')](function(_0x251da2){logger[_0xc4e8('0x66')](util[_0xc4e8('0x35')](_0xc4e8('0x71'),_0x47d91c,_0x1123bc,_0x251da2[_0xc4e8('0x72')]));_0x11d5e2[_0xc4e8('0x73')]=_0x251da2[_0xc4e8('0x74')];_0x11d5e2[_0xc4e8('0x75')]=_0x251da2[_0xc4e8('0x72')];logger[_0xc4e8('0x66')](util[_0xc4e8('0x35')](_0xc4e8('0x76'),_0x47d91c));return startTranscribe(_0x3be0ba,_0xb0b659,_0x19e1bb,uuidv4(),_0x3dce3f,_0x251da2[_0xc4e8('0x72')]);})[_0xc4e8('0x28')](function(_0x43ed36){logger['info'](util['format'](_0xc4e8('0x77'),_0x47d91c,_0x43ed36[_0xc4e8('0x78')][_0xc4e8('0x79')]));_0x11d5e2['transcribeName']=_0x43ed36[_0xc4e8('0x78')][_0xc4e8('0x79')];_0x11d5e2['transcribeStatus']=_0x43ed36['TranscriptionJob']['TranscriptionJobStatus'];return _0x325f80(_0x11d5e2);})['catch'](function(_0x4a8b4d){return _0x2c1bd6(_0x4a8b4d);});});}exports[_0xc4e8('0x7a')]=function(_0x3203d2,_0x53bbc5,_0x21a998){var _0x356242;var _0x365218;var _0x344aa3;var _0x160c8b=require(_0xc4e8('0x51'));return db[_0xc4e8('0x2e')]['findOne']({'where':{'id':_0x3203d2[_0xc4e8('0x49')]['id']}})['then'](function(_0x38666b){if(_0x38666b){var _0x5df3c0=util[_0xc4e8('0x35')](_0xc4e8('0x64'),_0x38666b[_0xc4e8('0x53')]);if(fs['existsSync'](_0x5df3c0)){cypher=!![];return _0x160c8b[_0xc4e8('0x7b')](_0x5df3c0,_0x38666b['value'],config['secrets'][_0xc4e8('0x56')])['then'](function(){return _0x38666b;});}return _0x38666b;}})['then'](function(_0x5c3b9e){if(!_0x5c3b9e){throw new db['Sequelize'][(_0xc4e8('0x58'))]('Voice\x20Recording\x20not\x20found');}_0x365218=_0x5c3b9e;return db[_0xc4e8('0x7c')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x53bbc5,null))['then'](function(_0xc34b6b){if(_0xc34b6b){_0x356242=_0xc34b6b;if(!_0x356242[_0xc4e8('0x7d')]||!_0x356242[_0xc4e8('0x7e')]||!_0x356242[_0xc4e8('0x7f')]||!_0x356242[_0xc4e8('0x80')]||!_0x356242[_0xc4e8('0x73')]){throw new db[(_0xc4e8('0x57'))][(_0xc4e8('0x58'))](_0xc4e8('0x81'));}if(_0x3203d2['body'][_0xc4e8('0x82')]&&(!_0x356242[_0xc4e8('0x83')]||!_0x356242[_0xc4e8('0x84')]||!_0x356242[_0xc4e8('0x85')]||!_0x356242[_0xc4e8('0x80')]||!_0x356242[_0xc4e8('0x73')])){throw new db['Sequelize'][(_0xc4e8('0x58'))](_0xc4e8('0x86'));}return db[_0xc4e8('0x87')][_0xc4e8('0x88')]({'where':{'id':_0x356242[_0xc4e8('0x7e')]}});}})[_0xc4e8('0x28')](function(_0x16b288){if(!_0x16b288){throw new db[(_0xc4e8('0x57'))]['ValidationError'](_0xc4e8('0x89'));}if(!_0x16b288[_0xc4e8('0x8a')]||!_0x16b288['data2']){throw new db[(_0xc4e8('0x57'))][(_0xc4e8('0x58'))](_0xc4e8('0x8b'));}_0x344aa3=_0x16b288;return getBucketslist(_0x344aa3[_0xc4e8('0x8a')],_0x344aa3[_0xc4e8('0x8c')],_0x356242[_0xc4e8('0x7f')]);})[_0xc4e8('0x28')](function(_0x170edb){if(_0x170edb&&_0x170edb['Buckets']){var _0x481de6=_[_0xc4e8('0x4c')](_0x170edb[_0xc4e8('0x8d')],function(_0xa89f90){return _0xa89f90['Name']===_0x356242['bucket'];});if(!_0x481de6){logger[_0xc4e8('0x66')](util[_0xc4e8('0x35')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x3203d2[_0xc4e8('0x49')]['id'],_0x356242[_0xc4e8('0x73')]));return createBucket(_0x344aa3[_0xc4e8('0x8a')],_0x344aa3[_0xc4e8('0x8c')],_0x356242[_0xc4e8('0x7f')],_0x356242[_0xc4e8('0x73')]);}logger['info'](util['format'](_0xc4e8('0x8e'),_0x3203d2['params']['id'],_0x356242[_0xc4e8('0x73')]));return;}})[_0xc4e8('0x28')](function(_0x4c661f){if(_0x365218[_0xc4e8('0x8f')]===_0xc4e8('0x90')){return transcribe(_0x3203d2[_0xc4e8('0x49')]['id'],_0x344aa3[_0xc4e8('0x8a')],_0x344aa3[_0xc4e8('0x8c')],_0x356242[_0xc4e8('0x7f')],_0x356242[_0xc4e8('0x73')],_0x365218[_0xc4e8('0x53')],_0x356242[_0xc4e8('0x80')]);}else{logger['info'](util[_0xc4e8('0x35')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3203d2[_0xc4e8('0x49')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x93bc19){if(_0x93bc19){_0x93bc19[_0xc4e8('0x91')]=_0x3203d2[_0xc4e8('0x4e')]['runSentiment'];return _0x365218[_0xc4e8('0x92')](_0x93bc19);}})[_0xc4e8('0x28')](respondWithResult(_0x53bbc5,null))[_0xc4e8('0x47')](handleError(_0x53bbc5,null));};function writeFile(_0x3acc22,_0x254c0f){return new Promise(function(_0x3d55fd,_0x51515b){fs[_0xc4e8('0x93')](_0x254c0f,_0x3acc22,function(_0x49469d,_0x2e9553){if(_0x49469d){return _0x51515b(_0x49469d);}else{return _0x3d55fd(_0x2e9553);}});});}exports['downloadTranscribe']=function(_0x2f948e,_0x48d089,_0x9a2c89){return db[_0xc4e8('0x2e')]['findOne']({'where':{'id':_0x2f948e[_0xc4e8('0x49')]['id']}})[_0xc4e8('0x28')](handleEntityNotFound(_0x48d089))['then'](function(_0x224e66){if(_0x224e66&&_0x224e66[_0xc4e8('0x94')]){var _0x3150f1=_0x224e66[_0xc4e8('0x94')];var _0x13df5e=config[_0xc4e8('0x95')]+_0xc4e8('0x96')+_0x224e66['id']+_0xc4e8('0x97');if(fs['existsSync'](_0x13df5e)){return _0x13df5e;}return writeFile(_0x3150f1,_0x13df5e)[_0xc4e8('0x28')](function(){return _0x13df5e;});}else{throw new db[(_0xc4e8('0x57'))][(_0xc4e8('0x58'))]('Transcript\x20not\x20available');}})[_0xc4e8('0x28')](function(_0x2f3538){return _0x48d089['download'](_0x2f3538);})[_0xc4e8('0x47')](handleError(_0x48d089));}; \ No newline at end of file +var _0x721d=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','filters','options','find','create','body','describe','download','uniqueid','value','%s.cypher','decryptFile','secrets','existsSync','Sequelize','ValidationError','filename','message','VoiceRecording\x20not\x20found','downloads','../../components/encryptor','sequelize','MD5','token','$and','push','recording','unlink','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','transcribeName','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','jsforce','desk.js','to-csv','papaparse','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','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','attributes','fields','length'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_0x721d,0xf5));var _0xd721=function(_0x20e79f,_0x1633b6){_0x20e79f=_0x20e79f-0x0;var _0x1a846b=_0x721d[_0x20e79f];return _0x1a846b;};'use strict';var pdf=require(_0xd721('0x0'));var emlformat=require(_0xd721('0x1'));var rimraf=require(_0xd721('0x2'));var zipdir=require(_0xd721('0x3'));var jsonpatch=require(_0xd721('0x4'));var rp=require(_0xd721('0x5'));var moment=require('moment');var BPromise=require(_0xd721('0x6'));var Mustache=require(_0xd721('0x7'));var util=require('util');var path=require(_0xd721('0x8'));var sox=require(_0xd721('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd721('0xa'));var squel=require(_0xd721('0xb'));var crypto=require('crypto');var jsforce=require(_0xd721('0xc'));var deskjs=require(_0xd721('0xd'));var toCsv=require(_0xd721('0xe'));var querystring=require('querystring');var Papa=require(_0xd721('0xf'));var AWS=require(_0xd721('0x10'));var uuidv4=require(_0xd721('0x11'));var Redis=require(_0xd721('0x12'));var authService=require(_0xd721('0x13'));var qs=require(_0xd721('0x14'));var as=require(_0xd721('0x15'));var hardwareService=require(_0xd721('0x16'));var logger=require(_0xd721('0x17'))(_0xd721('0x18'));var utils=require(_0xd721('0x19'));var config=require(_0xd721('0x1a'));var licenseUtil=require(_0xd721('0x1b'));var db=require(_0xd721('0x1c'))['db'];function respondWithStatusCode(_0x1955c3,_0x4e0cc4){_0x4e0cc4=_0x4e0cc4||0xcc;return function(_0x685edb){if(_0x685edb){return _0x1955c3['sendStatus'](_0x4e0cc4);}return _0x1955c3[_0xd721('0x1d')](_0x4e0cc4)[_0xd721('0x1e')]();};}function respondWithResult(_0x447f9e,_0xbcee09){_0xbcee09=_0xbcee09||0xc8;return function(_0x544e2a){if(_0x544e2a){return _0x447f9e[_0xd721('0x1d')](_0xbcee09)['json'](_0x544e2a);}};}function respondWithFilteredResult(_0x35de54,_0x8b8faa){return function(_0x40f2ee){if(_0x40f2ee){var _0x455d30=_0x40f2ee[_0xd721('0x1f')],_0x2f4fee=_0x8b8faa['offset'],_0x417cc7=_0x8b8faa[_0xd721('0x20')]+_0x8b8faa[_0xd721('0x21')],_0x3164fd;if(_0x417cc7>=_0x455d30){_0x417cc7=_0x455d30;_0x3164fd=0xc8;}else{_0x3164fd=0xce;}_0x35de54[_0xd721('0x1d')](_0x3164fd);return _0x35de54[_0xd721('0x22')](_0xd721('0x23'),_0x2f4fee+'-'+_0x417cc7+'/'+_0x455d30)[_0xd721('0x24')](_0x40f2ee);}return null;};}function patchUpdates(_0x4c0bf6){return function(_0x1315e1){try{jsonpatch['apply'](_0x1315e1,_0x4c0bf6,!![]);}catch(_0x53d35c){return BPromise[_0xd721('0x25')](_0x53d35c);}return _0x1315e1[_0xd721('0x26')]();};}function saveUpdates(_0x24b076,_0x36d996){return function(_0x2a3808){if(_0x2a3808){return _0x2a3808[_0xd721('0x27')](_0x24b076)[_0xd721('0x28')](function(_0x4f5d08){return _0x4f5d08;});}return null;};}function removeEntity(_0x270a9d,_0x476315){return function(_0x36a7b0){if(_0x36a7b0){return _0x36a7b0[_0xd721('0x29')]()[_0xd721('0x28')](function(){_0x270a9d[_0xd721('0x1d')](0xcc)[_0xd721('0x1e')]();});}};}function handleEntityNotFound(_0x4ed9d6,_0x16269d){return function(_0x271f93){if(!_0x271f93){_0x4ed9d6[_0xd721('0x2a')](0x194);}return _0x271f93;};}function handleError(_0x14b2f2,_0x4f6a0b){_0x4f6a0b=_0x4f6a0b||0x1f4;return function(_0xe0f0d4){logger[_0xd721('0x2b')](_0xe0f0d4['stack']);if(_0xe0f0d4[_0xd721('0x2c')]){delete _0xe0f0d4[_0xd721('0x2c')];}_0x14b2f2[_0xd721('0x1d')](_0x4f6a0b)[_0xd721('0x2d')](_0xe0f0d4);};}exports[_0xd721('0x2e')]=function(_0x383e1f,_0x44b8c8){var _0x141ff7={},_0x46e9a0={},_0x19e9a2={'count':0x0,'rows':[]};var _0x5a2064=_[_0xd721('0x2f')](db[_0xd721('0x30')][_0xd721('0x31')],function(_0x1fe9ef){return{'name':_0x1fe9ef[_0xd721('0x32')],'type':_0x1fe9ef[_0xd721('0x33')][_0xd721('0x34')]};});_0x46e9a0[_0xd721('0x35')]=_['differenceBy'](_[_0xd721('0x2f')](_0x5a2064,_0xd721('0x2c')),[_0xd721('0x36')]);_0x46e9a0[_0xd721('0x37')]=_[_0xd721('0x38')](_0x383e1f[_0xd721('0x37')]);_0x46e9a0['filters']=_[_0xd721('0x39')](_0x46e9a0['model'],_0x46e9a0[_0xd721('0x37')]);_0x141ff7[_0xd721('0x3a')]=_['intersection'](_0x46e9a0[_0xd721('0x35')],qs[_0xd721('0x3b')](_0x383e1f[_0xd721('0x37')][_0xd721('0x3b')]));_0x141ff7[_0xd721('0x3a')]=_0x141ff7[_0xd721('0x3a')][_0xd721('0x3c')]?_0x141ff7[_0xd721('0x3a')]:_0x46e9a0['model'];if(!_0x383e1f[_0xd721('0x37')][_0xd721('0x3d')](_0xd721('0x3e'))){_0x141ff7[_0xd721('0x21')]=qs[_0xd721('0x21')](_0x383e1f[_0xd721('0x37')]['limit']);_0x141ff7[_0xd721('0x20')]=qs['offset'](_0x383e1f[_0xd721('0x37')][_0xd721('0x20')]);}_0x141ff7[_0xd721('0x3f')]=qs[_0xd721('0x40')](_0x383e1f[_0xd721('0x37')][_0xd721('0x40')]);_0x141ff7[_0xd721('0x41')]=qs['filters'](_['pick'](_0x383e1f[_0xd721('0x37')],_0x46e9a0['filters']),_0x5a2064);if(_0x383e1f[_0xd721('0x37')][_0xd721('0x42')]){_0x141ff7['where']=_[_0xd721('0x43')](_0x141ff7['where'],{'$or':_[_0xd721('0x2f')](_0x5a2064,function(_0x313ef6){if(_0x313ef6[_0xd721('0x33')]!==_0xd721('0x44')){var _0x41f2e0={};_0x41f2e0[_0x313ef6[_0xd721('0x2c')]]={'$like':'%'+_0x383e1f['query'][_0xd721('0x42')]+'%'};return _0x41f2e0;}})});}_0x141ff7=_[_0xd721('0x43')]({},_0x141ff7,_0x383e1f['options']);var _0xdffb36={'where':_0x141ff7[_0xd721('0x41')]};return db['VoiceRecording'][_0xd721('0x1f')](_0xdffb36)[_0xd721('0x28')](function(_0x2f5954){_0x19e9a2[_0xd721('0x1f')]=_0x2f5954;if(_0x383e1f[_0xd721('0x37')][_0xd721('0x45')]){_0x141ff7[_0xd721('0x46')]=[{'all':!![]}];}return db[_0xd721('0x30')][_0xd721('0x47')](_0x141ff7);})[_0xd721('0x28')](function(_0x5a3b17){_0x19e9a2['rows']=_0x5a3b17;return _0x19e9a2;})[_0xd721('0x28')](respondWithFilteredResult(_0x44b8c8,_0x141ff7))[_0xd721('0x48')](handleError(_0x44b8c8,null));};exports[_0xd721('0x49')]=function(_0x703327,_0x1b92a4){var _0x5b57a3={'raw':![],'where':{'id':_0x703327[_0xd721('0x4a')]['id']}},_0x8c4579={};_0x8c4579[_0xd721('0x35')]=_[_0xd721('0x38')](db['VoiceRecording'][_0xd721('0x31')]);_0x8c4579[_0xd721('0x37')]=_['keys'](_0x703327[_0xd721('0x37')]);_0x8c4579[_0xd721('0x4b')]=_[_0xd721('0x39')](_0x8c4579['model'],_0x8c4579['query']);_0x5b57a3[_0xd721('0x3a')]=_[_0xd721('0x39')](_0x8c4579[_0xd721('0x35')],qs[_0xd721('0x3b')](_0x703327['query'][_0xd721('0x3b')]));_0x5b57a3[_0xd721('0x3a')]=_0x5b57a3[_0xd721('0x3a')][_0xd721('0x3c')]?_0x5b57a3[_0xd721('0x3a')]:_0x8c4579[_0xd721('0x35')];if(_0x703327[_0xd721('0x37')][_0xd721('0x45')]){_0x5b57a3['include']=[{'all':!![]}];}_0x5b57a3=_[_0xd721('0x43')]({},_0x5b57a3,_0x703327[_0xd721('0x4c')]);return db[_0xd721('0x30')][_0xd721('0x4d')](_0x5b57a3)[_0xd721('0x28')](handleEntityNotFound(_0x1b92a4,null))[_0xd721('0x28')](respondWithResult(_0x1b92a4,null))[_0xd721('0x48')](handleError(_0x1b92a4,null));};exports[_0xd721('0x4e')]=function(_0x1faf67,_0x27835d){return db['VoiceRecording'][_0xd721('0x4e')](_0x1faf67[_0xd721('0x4f')],{})[_0xd721('0x28')](respondWithResult(_0x27835d,0xc9))['catch'](handleError(_0x27835d,null));};exports[_0xd721('0x27')]=function(_0x4e795a,_0x4371d4){if(_0x4e795a[_0xd721('0x4f')]['id']){delete _0x4e795a[_0xd721('0x4f')]['id'];}return db[_0xd721('0x30')][_0xd721('0x4d')]({'where':{'id':_0x4e795a[_0xd721('0x4a')]['id']}})[_0xd721('0x28')](handleEntityNotFound(_0x4371d4,null))[_0xd721('0x28')](saveUpdates(_0x4e795a['body'],null))['then'](respondWithResult(_0x4371d4,null))['catch'](handleError(_0x4371d4,null));};exports[_0xd721('0x50')]=function(_0x255f84,_0x25ea27){return db[_0xd721('0x30')][_0xd721('0x50')]()[_0xd721('0x28')](respondWithResult(_0x25ea27,null))[_0xd721('0x48')](handleError(_0x25ea27,null));};exports[_0xd721('0x51')]=function(_0x2b7ac8,_0x4f04b9,_0x3bb101){var _0x7b6afe=require('../../components/encryptor');var _0x1d606e=![];var _0x1495d6={};if(_0x2b7ac8[_0xd721('0x37')][_0xd721('0x33')]&&_0x2b7ac8[_0xd721('0x37')]['type']===_0xd721('0x52')){_0x1495d6['uniqueid']=_0x2b7ac8['params']['id'];}else{_0x1495d6['id']=_0x2b7ac8[_0xd721('0x4a')]['id'];}return db['VoiceRecording'][_0xd721('0x4d')]({'where':_0x1495d6,'attributes':['id',_0xd721('0x53')],'raw':!![]})[_0xd721('0x28')](handleEntityNotFound(_0x4f04b9,null))['then'](function(_0x47f113){if(_0x47f113){var _0x448b22=_0x47f113[_0xd721('0x53')];var _0x25377a=util[_0xd721('0x36')](_0xd721('0x54'),_0x448b22);if(fs['existsSync'](_0x25377a)){_0x1d606e=!![];return _0x7b6afe[_0xd721('0x55')](_0x25377a,_0x448b22,config[_0xd721('0x56')]['recording'])[_0xd721('0x28')](function(){return _0x47f113;});}return _0x47f113;}})[_0xd721('0x28')](function(_0x51ad42){if(_0x51ad42){var _0x38c31e=_0x51ad42[_0xd721('0x53')];if(!fs[_0xd721('0x57')](_0x38c31e)){throw new db[(_0xd721('0x58'))][(_0xd721('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x51ad42[_0xd721('0x5a')]){return _0x4f04b9[_0xd721('0x51')](_0x38c31e,_0x51ad42[_0xd721('0x5a')]+path['extname'](_0x38c31e),function(){if(_0x1d606e){fs['unlink'](_0x38c31e);}});}else{return _0x4f04b9[_0xd721('0x51')](_0x38c31e,function(_0x2de354){if(_0x1d606e){fs['unlink'](_0x38c31e);}});}}})['catch'](function(_0x3b2795){if(_0x3b2795[_0xd721('0x5b')]===_0xd721('0x5c')){_0x4f04b9['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x4f04b9,null);}});};exports[_0xd721('0x5d')]=function(_0x3756b4,_0x1e208a,_0x74a6b1){var _0x106e55=require(_0xd721('0x5e'));var _0x2e41ba=![];var _0x3cff09={'$and':[db[_0xd721('0x5f')][_0xd721('0x41')](db[_0xd721('0x5f')]['fn'](_0xd721('0x60'),db[_0xd721('0x5f')]['col'](_0xd721('0x52'))),_0x3756b4[_0xd721('0x37')][_0xd721('0x61')])]};if(_0x3756b4[_0xd721('0x37')]['type']&&_0x3756b4[_0xd721('0x37')]['type']==='uniqueid'){_0x3cff09[_0xd721('0x62')]['push']({'uniqueid':_0x3756b4[_0xd721('0x4a')]['id']});}else{_0x3cff09[_0xd721('0x62')][_0xd721('0x63')]({'id':_0x3756b4[_0xd721('0x4a')]['id']});}return db[_0xd721('0x30')][_0xd721('0x4d')]({'where':_0x3cff09,'attributes':['id',_0xd721('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x1e208a,null))['then'](function(_0x1e0ad4){if(_0x1e0ad4){var _0x1ad5f6=util[_0xd721('0x36')](_0xd721('0x54'),_0x1e0ad4[_0xd721('0x53')]);if(fs[_0xd721('0x57')](_0x1ad5f6)){_0x2e41ba=!![];return _0x106e55[_0xd721('0x55')](_0x1ad5f6,_0x1e0ad4[_0xd721('0x53')],config['secrets'][_0xd721('0x64')])[_0xd721('0x28')](function(){return _0x1e0ad4;});}return _0x1e0ad4;}})[_0xd721('0x28')](function(_0x55ca1e){if(_0x55ca1e){if(!fs[_0xd721('0x57')](_0x55ca1e[_0xd721('0x53')])){throw new db[(_0xd721('0x58'))]['ValidationError'](_0xd721('0x5c'));}if(_0x55ca1e[_0xd721('0x5a')]){return _0x1e208a['download'](_0x55ca1e[_0xd721('0x53')],_0x55ca1e[_0xd721('0x5a')]+path['extname'](_0x55ca1e[_0xd721('0x53')]),function(){if(_0x2e41ba){fs[_0xd721('0x65')](_0x55ca1e[_0xd721('0x53')]);}});}else{return _0x1e208a[_0xd721('0x51')](_0x55ca1e[_0xd721('0x53')],function(_0xc913ee){if(_0x2e41ba){fs[_0xd721('0x65')](_0x55ca1e['value']);}});}}})[_0xd721('0x48')](handleError(_0x1e208a,null));};exports[_0xd721('0x29')]=function(_0x21e12a,_0x2263fa){return db['VoiceRecording'][_0xd721('0x4d')]({'where':{'id':_0x21e12a[_0xd721('0x4a')]['id']}})[_0xd721('0x28')](function(_0x4f6f9c){if(!_0x4f6f9c)throw new ReferenceError(_0xd721('0x66'));return _0x4f6f9c;})[_0xd721('0x28')](function(_0x5a9271){var _0x434787=_0x5a9271[_0xd721('0x53')];logger[_0xd721('0x67')](_0xd721('0x68'),_0x434787);if(!_['isNil'](_0x5a9271['value'])&&fs[_0xd721('0x57')](_0x434787)){logger[_0xd721('0x67')](_0xd721('0x69')+_0x434787+_0xd721('0x6a'));fs[_0xd721('0x6b')](_0x434787);}_0x434787=_0x434787+_0xd721('0x6c');if(!_['isNil'](_0x5a9271[_0xd721('0x53')])&&fs[_0xd721('0x57')](_0x434787)){logger[_0xd721('0x67')](_0xd721('0x69')+_0x434787+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd721('0x6b')](_0x434787);}return _0x5a9271;})['then'](function(_0x355391){if(!_0x355391)throw new InternalError();return _0x355391['destroy']();})[_0xd721('0x28')](function(){_0x2263fa[_0xd721('0x1d')](0xcc)[_0xd721('0x1e')]();})[_0xd721('0x48')](handleError(_0x2263fa,null));};function getBucketslist(_0x122e52,_0x526f16,_0x2076d1){return new Promise(function(_0x15aaa0,_0x919ed2){var _0x5a9440=new AWS['S3']({'accessKeyId':_0x526f16,'secretAccessKey':_0x122e52,'region':_0x2076d1});_0x5a9440[_0xd721('0x6d')]({},function(_0x25ae92,_0x3c6326){if(_0x25ae92){return _0x919ed2(_0x25ae92);}else{return _0x15aaa0(_0x3c6326);}});});}function createBucket(_0x6d7a06,_0x578c25,_0x303dbc,_0x3b7546){return new Promise(function(_0xb9cdb6,_0x317a4c){var _0x346788=new AWS['S3']({'accessKeyId':_0x578c25,'secretAccessKey':_0x6d7a06,'region':_0x303dbc});_0x346788[_0xd721('0x6e')]({'Bucket':_0x3b7546},function(_0x4e0ae5,_0x51ec10){if(_0x4e0ae5){return _0x317a4c(_0x4e0ae5);}else{return _0xb9cdb6(_0x51ec10);}});});}function uploadFile(_0x75c4c6,_0x3bcb00,_0x53e2b7,_0xdb1bbb,_0x55e3a4,_0x411450){return new Promise(function(_0x1424f1,_0x59dc2d){var _0x1179d7=new AWS['S3']({'accessKeyId':_0x3bcb00,'secretAccessKey':_0x75c4c6,'region':_0x53e2b7});_0x1179d7[_0xd721('0x6f')]({'Bucket':_0xdb1bbb,'Key':_0x55e3a4,'Body':_0x411450},function(_0x47e7f6,_0x29596e){if(_0x47e7f6){return _0x59dc2d(_0x47e7f6);}else{return _0x1424f1(_0x29596e);}});});}function startTranscribe(_0x316590,_0x4f6112,_0x1a4b61,_0x607d04,_0x15ca57,_0x43d161){return new Promise(function(_0x157ea9,_0x130c7c){var _0x4688fe=new AWS[(_0xd721('0x70'))]({'accessKeyId':_0x4f6112,'secretAccessKey':_0x316590,'region':_0x1a4b61});_0x4688fe[_0xd721('0x71')]({'TranscriptionJobName':_0x607d04,'LanguageCode':_0x15ca57,'Media':{'MediaFileUri':_0x43d161}},function(_0x522705,_0x591a1f){if(_0x522705){return _0x130c7c(_0x522705);}else{return _0x157ea9(_0x591a1f);}});});}function transcribe(_0x415e6e,_0x5b40d4,_0x105802,_0x1bb220,_0x15eb3e,_0x1494c9,_0x5bf69a){return new Promise(function(_0x52633f,_0x4c089c){var _0x42699b={};logger[_0xd721('0x67')](util[_0xd721('0x36')](_0xd721('0x72'),_0x415e6e,_0x15eb3e));return uploadFile(_0x5b40d4,_0x105802,_0x1bb220,_0x15eb3e,path[_0xd721('0x73')](_0x1494c9),fs['readFileSync'](_0x1494c9))[_0xd721('0x28')](function(_0x2757bf){logger[_0xd721('0x67')](util[_0xd721('0x36')](_0xd721('0x74'),_0x415e6e,_0x15eb3e,_0x2757bf[_0xd721('0x75')]));_0x42699b[_0xd721('0x76')]=_0x2757bf[_0xd721('0x77')];_0x42699b[_0xd721('0x78')]=_0x2757bf[_0xd721('0x75')];logger['info'](util[_0xd721('0x36')](_0xd721('0x79'),_0x415e6e));return startTranscribe(_0x5b40d4,_0x105802,_0x1bb220,uuidv4(),_0x5bf69a,_0x2757bf['Location']);})['then'](function(_0x291a99){logger[_0xd721('0x67')](util[_0xd721('0x36')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x415e6e,_0x291a99['TranscriptionJob']['TranscriptionJobName']));_0x42699b[_0xd721('0x7a')]=_0x291a99[_0xd721('0x7b')][_0xd721('0x7c')];_0x42699b['transcribeStatus']=_0x291a99[_0xd721('0x7b')][_0xd721('0x7d')];return _0x52633f(_0x42699b);})[_0xd721('0x48')](function(_0x64b64d){return _0x4c089c(_0x64b64d);});});}exports[_0xd721('0x7e')]=function(_0x29fcfa,_0x1b0d03,_0x4e8a39){var _0x1082b4;var _0x5012a3;var _0x3b05cc;var _0x597022=require(_0xd721('0x5e'));return db[_0xd721('0x30')][_0xd721('0x7f')]({'where':{'id':_0x29fcfa[_0xd721('0x4a')]['id']}})[_0xd721('0x28')](function(_0x5c9a80){if(_0x5c9a80){var _0x9852fe=util[_0xd721('0x36')](_0xd721('0x54'),_0x5c9a80[_0xd721('0x53')]);if(fs[_0xd721('0x57')](_0x9852fe)){cypher=!![];return _0x597022[_0xd721('0x55')](_0x9852fe,_0x5c9a80[_0xd721('0x53')],config[_0xd721('0x56')]['recording'])[_0xd721('0x28')](function(){return _0x5c9a80;});}return _0x5c9a80;}})[_0xd721('0x28')](function(_0x4c01fe){if(!_0x4c01fe){throw new db[(_0xd721('0x58'))][(_0xd721('0x59'))]('Voice\x20Recording\x20not\x20found');}_0x5012a3=_0x4c01fe;return db[_0xd721('0x80')][_0xd721('0x7f')]({'where':{'id':0x1}});})[_0xd721('0x28')](handleEntityNotFound(_0x1b0d03,null))['then'](function(_0x85dc92){if(_0x85dc92){_0x1082b4=_0x85dc92;if(!_0x1082b4[_0xd721('0x81')]||!_0x1082b4[_0xd721('0x82')]||!_0x1082b4[_0xd721('0x83')]||!_0x1082b4[_0xd721('0x84')]||!_0x1082b4[_0xd721('0x76')]){throw new db['Sequelize'][(_0xd721('0x59'))](_0xd721('0x85'));}if(_0x29fcfa[_0xd721('0x4f')][_0xd721('0x86')]&&(!_0x1082b4['sentiment']||!_0x1082b4[_0xd721('0x87')]||!_0x1082b4[_0xd721('0x88')]||!_0x1082b4[_0xd721('0x84')]||!_0x1082b4['bucket'])){throw new db[(_0xd721('0x58'))][(_0xd721('0x59'))](_0xd721('0x89'));}return db['CloudProvider'][_0xd721('0x7f')]({'where':{'id':_0x1082b4[_0xd721('0x82')]}});}})['then'](function(_0x2acd9b){if(!_0x2acd9b){throw new db[(_0xd721('0x58'))][(_0xd721('0x59'))](_0xd721('0x8a'));}if(!_0x2acd9b[_0xd721('0x8b')]||!_0x2acd9b[_0xd721('0x8c')]){throw new db[(_0xd721('0x58'))][(_0xd721('0x59'))](_0xd721('0x8d'));}_0x3b05cc=_0x2acd9b;return getBucketslist(_0x3b05cc['data1'],_0x3b05cc[_0xd721('0x8c')],_0x1082b4[_0xd721('0x83')]);})[_0xd721('0x28')](function(_0x4c6dac){if(_0x4c6dac&&_0x4c6dac[_0xd721('0x8e')]){var _0x57701d=_[_0xd721('0x4d')](_0x4c6dac[_0xd721('0x8e')],function(_0x1c69dd){return _0x1c69dd['Name']===_0x1082b4[_0xd721('0x76')];});if(!_0x57701d){logger[_0xd721('0x67')](util[_0xd721('0x36')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x29fcfa[_0xd721('0x4a')]['id'],_0x1082b4[_0xd721('0x76')]));return createBucket(_0x3b05cc[_0xd721('0x8b')],_0x3b05cc['data2'],_0x1082b4[_0xd721('0x83')],_0x1082b4[_0xd721('0x76')]);}logger[_0xd721('0x67')](util[_0xd721('0x36')](_0xd721('0x8f'),_0x29fcfa['params']['id'],_0x1082b4[_0xd721('0x76')]));return;}})['then'](function(_0x1036d4){if(_0x5012a3[_0xd721('0x90')]===_0xd721('0x91')){return transcribe(_0x29fcfa[_0xd721('0x4a')]['id'],_0x3b05cc[_0xd721('0x8b')],_0x3b05cc['data2'],_0x1082b4['transcribeRegion'],_0x1082b4[_0xd721('0x76')],_0x5012a3[_0xd721('0x53')],_0x1082b4['language']);}else{logger[_0xd721('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x29fcfa[_0xd721('0x4a')]['id']));return{'transcribeStatus':_0xd721('0x92')};}})[_0xd721('0x28')](function(_0x27bd16){if(_0x27bd16){_0x27bd16['tempSentiment']=_0x29fcfa['body'][_0xd721('0x86')];return _0x5012a3['updateAttributes'](_0x27bd16);}})[_0xd721('0x28')](respondWithResult(_0x1b0d03,null))[_0xd721('0x48')](handleError(_0x1b0d03,null));};function writeFile(_0x1e7a55,_0x20a619){return new Promise(function(_0x21a5db,_0x4409c0){fs[_0xd721('0x93')](_0x20a619,_0x1e7a55,function(_0x2aad83,_0x3538a8){if(_0x2aad83){return _0x4409c0(_0x2aad83);}else{return _0x21a5db(_0x3538a8);}});});}exports[_0xd721('0x94')]=function(_0xe49911,_0x1ef824,_0x110f6b){return db[_0xd721('0x30')]['findOne']({'where':{'id':_0xe49911[_0xd721('0x4a')]['id']}})[_0xd721('0x28')](handleEntityNotFound(_0x1ef824))[_0xd721('0x28')](function(_0x3d1527){if(_0x3d1527&&_0x3d1527[_0xd721('0x95')]){var _0x30047b=_0x3d1527[_0xd721('0x95')];var _0x33dc91=config[_0xd721('0x96')]+_0xd721('0x97')+_0x3d1527['id']+_0xd721('0x98');if(fs['existsSync'](_0x33dc91)){return _0x33dc91;}return writeFile(_0x30047b,_0x33dc91)[_0xd721('0x28')](function(){return _0x33dc91;});}else{throw new db[(_0xd721('0x58'))]['ValidationError']('Transcript\x20not\x20available');}})[_0xd721('0x28')](function(_0x979296){return _0x1ef824[_0xd721('0x51')](_0x979296);})[_0xd721('0x48')](handleError(_0x1ef824));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 02a091e..70506a3 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 _0x1bd3=['exports','define','VoiceRecording','voice_recordings','uniqueid','util','moment','request-promise','path','../../config/environment','./voiceRecording.attributes'];(function(_0x50ea65,_0x105218){var _0x9adae=function(_0x5c9563){while(--_0x5c9563){_0x50ea65['push'](_0x50ea65['shift']());}};_0x9adae(++_0x105218);}(_0x1bd3,0x9f));var _0x31bd=function(_0x762b27,_0x1af80e){_0x762b27=_0x762b27-0x0;var _0x36292b=_0x1bd3[_0x762b27];return _0x36292b;};'use strict';var _=require('lodash');var util=require(_0x31bd('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x31bd('0x1'));var BPromise=require('bluebird');var rp=require(_0x31bd('0x2'));var fs=require('fs');var path=require(_0x31bd('0x3'));var rimraf=require('rimraf');var config=require(_0x31bd('0x4'));var attributes=require(_0x31bd('0x5'));module[_0x31bd('0x6')]=function(_0x42a038,_0x154d3e){return _0x42a038[_0x31bd('0x7')](_0x31bd('0x8'),attributes,{'tableName':_0x31bd('0x9'),'paranoid':![],'indexes':[{'name':_0x31bd('0xa'),'fields':[_0x31bd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8e1=['./voiceRecording.attributes','exports','voice_recordings','uniqueid','util','api','moment','request-promise','path','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb8e1,0x7c));var _0x1b8e=function(_0x4114dd,_0x32617a){_0x4114dd=_0x4114dd-0x0;var _0x21d147=_0xb8e1[_0x4114dd];return _0x21d147;};'use strict';var _=require('lodash');var util=require(_0x1b8e('0x0'));var logger=require('../../config/logger')(_0x1b8e('0x1'));var moment=require(_0x1b8e('0x2'));var BPromise=require('bluebird');var rp=require(_0x1b8e('0x3'));var fs=require('fs');var path=require(_0x1b8e('0x4'));var rimraf=require('rimraf');var config=require(_0x1b8e('0x5'));var attributes=require(_0x1b8e('0x6'));module[_0x1b8e('0x7')]=function(_0x2d6515,_0x708348){return _0x2d6515['define']('VoiceRecording',attributes,{'tableName':_0x1b8e('0x8'),'paranoid':![],'indexes':[{'name':_0x1b8e('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index ffa13ed..5b622fc 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(_0x31a4fd,_0x4e25ab){var _0x529fb2=function(_0x29e0f3){while(--_0x29e0f3){_0x31a4fd['push'](_0x31a4fd['shift']());}};_0x529fb2(++_0x4e25ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x5da398,_0x13a526){var _0x4db43a=function(_0x377646){while(--_0x377646){_0x5da398['push'](_0x5da398['shift']());}};_0x4db43a(++_0x13a526);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 052f1b1..2187114 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 _0xaba4=['path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','create','update','delete','destroy','exports','multer','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xaba4,0x75));var _0x4aba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaba4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4aba('0x0'));var util=require(_0x4aba('0x1'));var path=require(_0x4aba('0x2'));var timeout=require(_0x4aba('0x3'));var express=require(_0x4aba('0x4'));var router=express[_0x4aba('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x4aba('0x6')]('/',auth[_0x4aba('0x7')](),controller[_0x4aba('0x8')]);router[_0x4aba('0x6')](_0x4aba('0x9'),auth[_0x4aba('0x7')](),controller[_0x4aba('0xa')]);router[_0x4aba('0x6')](_0x4aba('0xb'),auth[_0x4aba('0x7')](),controller['show']);router['post']('/',auth[_0x4aba('0x7')](),controller[_0x4aba('0xc')]);router['put'](_0x4aba('0xb'),auth[_0x4aba('0x7')](),controller[_0x4aba('0xd')]);router[_0x4aba('0xe')](_0x4aba('0xb'),auth['isAuthenticated'](),controller[_0x4aba('0xf')]);module[_0x4aba('0x10')]=router; \ No newline at end of file +var _0xf486=['create','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x5ed001,_0x4be09c){var _0x1a6853=function(_0x2c7e58){while(--_0x2c7e58){_0x5ed001['push'](_0x5ed001['shift']());}};_0x1a6853(++_0x4be09c);}(_0xf486,0x190));var _0x6f48=function(_0x3e7edb,_0x2b7425){_0x3e7edb=_0x3e7edb-0x0;var _0x439382=_0xf486[_0x3e7edb];return _0x439382;};'use strict';var multer=require(_0x6f48('0x0'));var util=require(_0x6f48('0x1'));var path=require('path');var timeout=require(_0x6f48('0x2'));var express=require(_0x6f48('0x3'));var router=express[_0x6f48('0x4')]();var auth=require(_0x6f48('0x5'));var interaction=require(_0x6f48('0x6'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x6f48('0x7')]('/',auth[_0x6f48('0x8')](),controller[_0x6f48('0x9')]);router[_0x6f48('0x7')](_0x6f48('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x6f48('0x7')](_0x6f48('0xb'),auth[_0x6f48('0x8')](),controller[_0x6f48('0xc')]);router[_0x6f48('0xd')]('/',auth['isAuthenticated'](),controller[_0x6f48('0xe')]);router['put'](_0x6f48('0xb'),auth[_0x6f48('0x8')](),controller['update']);router[_0x6f48('0xf')](_0x6f48('0xb'),auth['isAuthenticated'](),controller[_0x6f48('0x10')]);module[_0x6f48('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 26edc15..db03be4 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 _0xee08=['moment','exports','blind','attended','STRING','Yes','sequelize'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0xee08,0x102));var _0x8ee0=function(_0x5eb98c,_0x47e531){_0x5eb98c=_0x5eb98c-0x0;var _0x2b1615=_0xee08[_0x5eb98c];return _0x2b1615;};'use strict';var Sequelize=require(_0x8ee0('0x0'));var moment=require(_0x8ee0('0x1'));module[_0x8ee0('0x2')]={'type':{'type':Sequelize['ENUM'](_0x8ee0('0x3'),_0x8ee0('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x8ee0('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x8ee0('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x8ee0('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x8ee0('0x5')]},'transferercontext':{'type':Sequelize[_0x8ee0('0x5')]},'transfererexten':{'type':Sequelize[_0x8ee0('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x8ee0('0x5')]},'transfereechannel':{'type':Sequelize[_0x8ee0('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8ee0('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x8ee0('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8ee0('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8ee0('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x8ee0('0x5')]},'transfereecontext':{'type':Sequelize[_0x8ee0('0x5')]},'transfereeexten':{'type':Sequelize[_0x8ee0('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x8ee0('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x8ee0('0x6'),'No')},'context':{'type':Sequelize[_0x8ee0('0x5')]},'extension':{'type':Sequelize[_0x8ee0('0x5')]}}; \ No newline at end of file +var _0x4ba9=['exports','attended','STRING','ENUM','Yes','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ba9,0x101));var _0x94ba=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0x4ba9[_0x4fbb15];return _0x436338;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x94ba('0x0'));module[_0x94ba('0x1')]={'type':{'type':Sequelize['ENUM']('blind',_0x94ba('0x2'))},'result':{'type':Sequelize[_0x94ba('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x94ba('0x3')]},'transferercalleridname':{'type':Sequelize[_0x94ba('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x94ba('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x94ba('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x94ba('0x3')]},'transferercontext':{'type':Sequelize[_0x94ba('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x94ba('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x94ba('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x94ba('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x94ba('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x94ba('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x94ba('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x94ba('0x3')]},'isexternal':{'type':Sequelize[_0x94ba('0x4')](_0x94ba('0x5'),'No')},'context':{'type':Sequelize[_0x94ba('0x3')]},'extension':{'type':Sequelize[_0x94ba('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 3b5838e..fe38534 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 _0x397b=['findAll','rows','catch','show','params','options','find','create','body','describe','html-pdf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','VoiceTransferReport'];(function(_0x513d1f,_0x7a0227){var _0xcd7138=function(_0x3f3111){while(--_0x3f3111){_0x513d1f['push'](_0x513d1f['shift']());}};_0xcd7138(++_0x7a0227);}(_0x397b,0x168));var _0xb397=function(_0x574c4f,_0x5a0b01){_0x574c4f=_0x574c4f-0x0;var _0x14801e=_0x397b[_0x574c4f];return _0x14801e;};'use strict';var pdf=require(_0xb397('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb397('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb397('0x2'));var BPromise=require(_0xb397('0x3'));var Mustache=require(_0xb397('0x4'));var util=require(_0xb397('0x5'));var path=require('path');var sox=require(_0xb397('0x6'));var csv=require(_0xb397('0x7'));var ejs=require(_0xb397('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb397('0x9'));var crypto=require(_0xb397('0xa'));var jsforce=require(_0xb397('0xb'));var deskjs=require(_0xb397('0xc'));var toCsv=require(_0xb397('0x7'));var querystring=require(_0xb397('0xd'));var Papa=require(_0xb397('0xe'));var Redis=require(_0xb397('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb397('0x10'));var as=require(_0xb397('0x11'));var hardwareService=require(_0xb397('0x12'));var logger=require('../../config/logger')(_0xb397('0x13'));var utils=require('../../config/utils');var config=require(_0xb397('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb397('0x15'))['db'];function respondWithStatusCode(_0x49b4f3,_0x8458e7){_0x8458e7=_0x8458e7||0xcc;return function(_0x2453a8){if(_0x2453a8){return _0x49b4f3[_0xb397('0x16')](_0x8458e7);}return _0x49b4f3[_0xb397('0x17')](_0x8458e7)[_0xb397('0x18')]();};}function respondWithResult(_0x208d9d,_0x777111){_0x777111=_0x777111||0xc8;return function(_0x194cd6){if(_0x194cd6){return _0x208d9d[_0xb397('0x17')](_0x777111)[_0xb397('0x19')](_0x194cd6);}};}function respondWithFilteredResult(_0x5083a0,_0x5dbfe0){return function(_0x2f8b7f){if(_0x2f8b7f){var _0x5bf4e2=_0x2f8b7f[_0xb397('0x1a')],_0x45c432=_0x5dbfe0[_0xb397('0x1b')],_0x59e823=_0x5dbfe0[_0xb397('0x1b')]+_0x5dbfe0[_0xb397('0x1c')],_0x494397;if(_0x59e823>=_0x5bf4e2){_0x59e823=_0x5bf4e2;_0x494397=0xc8;}else{_0x494397=0xce;}_0x5083a0[_0xb397('0x17')](_0x494397);return _0x5083a0[_0xb397('0x1d')]('Content-Range',_0x45c432+'-'+_0x59e823+'/'+_0x5bf4e2)[_0xb397('0x19')](_0x2f8b7f);}return null;};}function patchUpdates(_0x46c7a4){return function(_0x45310c){try{jsonpatch[_0xb397('0x1e')](_0x45310c,_0x46c7a4,!![]);}catch(_0x589d39){return BPromise[_0xb397('0x1f')](_0x589d39);}return _0x45310c[_0xb397('0x20')]();};}function saveUpdates(_0x4e2382,_0xfd48a6){return function(_0x11e656){if(_0x11e656){return _0x11e656[_0xb397('0x21')](_0x4e2382)[_0xb397('0x22')](function(_0x775dc1){return _0x775dc1;});}return null;};}function removeEntity(_0x17269f,_0x5e1a10){return function(_0x377016){if(_0x377016){return _0x377016[_0xb397('0x23')]()['then'](function(){_0x17269f[_0xb397('0x17')](0xcc)[_0xb397('0x18')]();});}};}function handleEntityNotFound(_0x35f18f,_0x39ea24){return function(_0x173664){if(!_0x173664){_0x35f18f[_0xb397('0x16')](0x194);}return _0x173664;};}function handleError(_0x3e0287,_0x4a8427){_0x4a8427=_0x4a8427||0x1f4;return function(_0x2ebc95){logger['error'](_0x2ebc95['stack']);if(_0x2ebc95[_0xb397('0x24')]){delete _0x2ebc95[_0xb397('0x24')];}_0x3e0287['status'](_0x4a8427)[_0xb397('0x25')](_0x2ebc95);};}exports[_0xb397('0x26')]=function(_0x5f4e36,_0x401c29){var _0x4789f7={},_0x4670b9={},_0x5c9029={'count':0x0,'rows':[]};var _0x57ef6d=_[_0xb397('0x27')](db['VoiceTransferReport'][_0xb397('0x28')],function(_0x2a1be0){return{'name':_0x2a1be0[_0xb397('0x29')],'type':_0x2a1be0[_0xb397('0x2a')]['key']};});_0x4670b9['model']=_[_0xb397('0x27')](_0x57ef6d,_0xb397('0x24'));_0x4670b9[_0xb397('0x2b')]=_[_0xb397('0x2c')](_0x5f4e36[_0xb397('0x2b')]);_0x4670b9[_0xb397('0x2d')]=_['intersection'](_0x4670b9[_0xb397('0x2e')],_0x4670b9['query']);_0x4789f7[_0xb397('0x2f')]=_[_0xb397('0x30')](_0x4670b9['model'],qs[_0xb397('0x31')](_0x5f4e36[_0xb397('0x2b')][_0xb397('0x31')]));_0x4789f7['attributes']=_0x4789f7[_0xb397('0x2f')][_0xb397('0x32')]?_0x4789f7[_0xb397('0x2f')]:_0x4670b9['model'];if(!_0x5f4e36[_0xb397('0x2b')]['hasOwnProperty'](_0xb397('0x33'))){_0x4789f7['limit']=qs['limit'](_0x5f4e36['query']['limit']);_0x4789f7[_0xb397('0x1b')]=qs[_0xb397('0x1b')](_0x5f4e36[_0xb397('0x2b')][_0xb397('0x1b')]);}_0x4789f7['order']=qs[_0xb397('0x34')](_0x5f4e36[_0xb397('0x2b')][_0xb397('0x34')]);_0x4789f7[_0xb397('0x35')]=qs[_0xb397('0x2d')](_[_0xb397('0x36')](_0x5f4e36['query'],_0x4670b9[_0xb397('0x2d')]),_0x57ef6d);if(_0x5f4e36['query'][_0xb397('0x37')]){_0x4789f7[_0xb397('0x35')]=_['merge'](_0x4789f7[_0xb397('0x35')],{'$or':_['map'](_0x57ef6d,function(_0x50f762){if(_0x50f762['type']!==_0xb397('0x38')){var _0x178cc9={};_0x178cc9[_0x50f762['name']]={'$like':'%'+_0x5f4e36[_0xb397('0x2b')][_0xb397('0x37')]+'%'};return _0x178cc9;}})});}_0x4789f7=_['merge']({},_0x4789f7,_0x5f4e36['options']);var _0x513760={'where':_0x4789f7[_0xb397('0x35')]};return db['VoiceTransferReport']['count'](_0x513760)[_0xb397('0x22')](function(_0x49c0dd){_0x5c9029[_0xb397('0x1a')]=_0x49c0dd;if(_0x5f4e36['query'][_0xb397('0x39')]){_0x4789f7[_0xb397('0x3a')]=[{'all':!![]}];}return db[_0xb397('0x3b')][_0xb397('0x3c')](_0x4789f7);})[_0xb397('0x22')](function(_0x56b87f){_0x5c9029[_0xb397('0x3d')]=_0x56b87f;return _0x5c9029;})[_0xb397('0x22')](respondWithFilteredResult(_0x401c29,_0x4789f7))[_0xb397('0x3e')](handleError(_0x401c29,null));};exports[_0xb397('0x3f')]=function(_0x4e5f1c,_0x4fca34){var _0x5577d1={'raw':!![],'where':{'id':_0x4e5f1c[_0xb397('0x40')]['id']}},_0x32fe53={};_0x32fe53[_0xb397('0x2e')]=_[_0xb397('0x2c')](db[_0xb397('0x3b')][_0xb397('0x28')]);_0x32fe53[_0xb397('0x2b')]=_['keys'](_0x4e5f1c[_0xb397('0x2b')]);_0x32fe53[_0xb397('0x2d')]=_[_0xb397('0x30')](_0x32fe53[_0xb397('0x2e')],_0x32fe53[_0xb397('0x2b')]);_0x5577d1[_0xb397('0x2f')]=_[_0xb397('0x30')](_0x32fe53[_0xb397('0x2e')],qs[_0xb397('0x31')](_0x4e5f1c[_0xb397('0x2b')][_0xb397('0x31')]));_0x5577d1[_0xb397('0x2f')]=_0x5577d1[_0xb397('0x2f')][_0xb397('0x32')]?_0x5577d1[_0xb397('0x2f')]:_0x32fe53['model'];if(_0x4e5f1c['query'][_0xb397('0x39')]){_0x5577d1[_0xb397('0x3a')]=[{'all':!![]}];}_0x5577d1=_['merge']({},_0x5577d1,_0x4e5f1c[_0xb397('0x41')]);return db[_0xb397('0x3b')][_0xb397('0x42')](_0x5577d1)['then'](handleEntityNotFound(_0x4fca34,null))[_0xb397('0x22')](respondWithResult(_0x4fca34,null))['catch'](handleError(_0x4fca34,null));};exports[_0xb397('0x43')]=function(_0x1f1653,_0xb75f9f){return db[_0xb397('0x3b')][_0xb397('0x43')](_0x1f1653[_0xb397('0x44')],{})[_0xb397('0x22')](respondWithResult(_0xb75f9f,0xc9))['catch'](handleError(_0xb75f9f,null));};exports['update']=function(_0x55ed67,_0x4451b6){if(_0x55ed67[_0xb397('0x44')]['id']){delete _0x55ed67[_0xb397('0x44')]['id'];}return db[_0xb397('0x3b')][_0xb397('0x42')]({'where':{'id':_0x55ed67[_0xb397('0x40')]['id']}})[_0xb397('0x22')](handleEntityNotFound(_0x4451b6,null))[_0xb397('0x22')](saveUpdates(_0x55ed67[_0xb397('0x44')],null))['then'](respondWithResult(_0x4451b6,null))[_0xb397('0x3e')](handleError(_0x4451b6,null));};exports[_0xb397('0x23')]=function(_0x6efcfd,_0x3cb59a){return db[_0xb397('0x3b')][_0xb397('0x42')]({'where':{'id':_0x6efcfd[_0xb397('0x40')]['id']}})[_0xb397('0x22')](handleEntityNotFound(_0x3cb59a,null))[_0xb397('0x22')](removeEntity(_0x3cb59a,null))[_0xb397('0x3e')](handleError(_0x3cb59a,null));};exports[_0xb397('0x45')]=function(_0x4a02e7,_0x2cd084){return db[_0xb397('0x3b')][_0xb397('0x45')]()[_0xb397('0x22')](respondWithResult(_0x2cd084,null))[_0xb397('0x3e')](handleError(_0x2cd084,null));}; \ No newline at end of file +var _0xab3d=['offset','set','Content-Range','json','apply','reject','update','then','destroy','end','stack','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3b8139,_0x459b80){var _0x5143a4=function(_0x452ffe){while(--_0x452ffe){_0x3b8139['push'](_0x3b8139['shift']());}};_0x5143a4(++_0x459b80);}(_0xab3d,0x82));var _0xdab3=function(_0x28e423,_0xc4dbc1){_0x28e423=_0x28e423-0x0;var _0x399e47=_0xab3d[_0x28e423];return _0x399e47;};'use strict';var pdf=require(_0xdab3('0x0'));var emlformat=require(_0xdab3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdab3('0x2'));var jsonpatch=require(_0xdab3('0x3'));var rp=require(_0xdab3('0x4'));var moment=require(_0xdab3('0x5'));var BPromise=require(_0xdab3('0x6'));var Mustache=require(_0xdab3('0x7'));var util=require(_0xdab3('0x8'));var path=require(_0xdab3('0x9'));var sox=require(_0xdab3('0xa'));var csv=require(_0xdab3('0xb'));var ejs=require(_0xdab3('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdab3('0xd'));var crypto=require(_0xdab3('0xe'));var jsforce=require(_0xdab3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdab3('0xb'));var querystring=require(_0xdab3('0x10'));var Papa=require(_0xdab3('0x11'));var Redis=require(_0xdab3('0x12'));var authService=require(_0xdab3('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdab3('0x14'))(_0xdab3('0x15'));var utils=require(_0xdab3('0x16'));var config=require(_0xdab3('0x17'));var licenseUtil=require(_0xdab3('0x18'));var db=require(_0xdab3('0x19'))['db'];function respondWithStatusCode(_0x4632e0,_0x2bfaa7){_0x2bfaa7=_0x2bfaa7||0xcc;return function(_0xd20c28){if(_0xd20c28){return _0x4632e0[_0xdab3('0x1a')](_0x2bfaa7);}return _0x4632e0['status'](_0x2bfaa7)['end']();};}function respondWithResult(_0x214871,_0x358e6d){_0x358e6d=_0x358e6d||0xc8;return function(_0x5f424e){if(_0x5f424e){return _0x214871[_0xdab3('0x1b')](_0x358e6d)['json'](_0x5f424e);}};}function respondWithFilteredResult(_0x3a5230,_0x1b6f32){return function(_0x444ded){if(_0x444ded){var _0x1d030a=_0x444ded['count'],_0x4973c1=_0x1b6f32[_0xdab3('0x1c')],_0x49dcc2=_0x1b6f32['offset']+_0x1b6f32['limit'],_0x2dc8a4;if(_0x49dcc2>=_0x1d030a){_0x49dcc2=_0x1d030a;_0x2dc8a4=0xc8;}else{_0x2dc8a4=0xce;}_0x3a5230['status'](_0x2dc8a4);return _0x3a5230[_0xdab3('0x1d')](_0xdab3('0x1e'),_0x4973c1+'-'+_0x49dcc2+'/'+_0x1d030a)[_0xdab3('0x1f')](_0x444ded);}return null;};}function patchUpdates(_0x4fb8b6){return function(_0x15d205){try{jsonpatch[_0xdab3('0x20')](_0x15d205,_0x4fb8b6,!![]);}catch(_0x5574f8){return BPromise[_0xdab3('0x21')](_0x5574f8);}return _0x15d205['save']();};}function saveUpdates(_0x535efa,_0x3bef2d){return function(_0x59fdf2){if(_0x59fdf2){return _0x59fdf2[_0xdab3('0x22')](_0x535efa)[_0xdab3('0x23')](function(_0x2378dd){return _0x2378dd;});}return null;};}function removeEntity(_0x1551fc,_0x3700be){return function(_0x531e31){if(_0x531e31){return _0x531e31[_0xdab3('0x24')]()[_0xdab3('0x23')](function(){_0x1551fc[_0xdab3('0x1b')](0xcc)[_0xdab3('0x25')]();});}};}function handleEntityNotFound(_0x43087e,_0x4631be){return function(_0x91dd92){if(!_0x91dd92){_0x43087e[_0xdab3('0x1a')](0x194);}return _0x91dd92;};}function handleError(_0x4e48c4,_0x2bee4f){_0x2bee4f=_0x2bee4f||0x1f4;return function(_0x3fad3a){logger['error'](_0x3fad3a[_0xdab3('0x26')]);if(_0x3fad3a['name']){delete _0x3fad3a['name'];}_0x4e48c4['status'](_0x2bee4f)[_0xdab3('0x27')](_0x3fad3a);};}exports[_0xdab3('0x28')]=function(_0x1222c4,_0x112b6c){var _0xad9a11={},_0x1d956b={},_0x237923={'count':0x0,'rows':[]};var _0x17e55b=_[_0xdab3('0x29')](db[_0xdab3('0x2a')][_0xdab3('0x2b')],function(_0x9933cd){return{'name':_0x9933cd[_0xdab3('0x2c')],'type':_0x9933cd[_0xdab3('0x2d')][_0xdab3('0x2e')]};});_0x1d956b[_0xdab3('0x2f')]=_[_0xdab3('0x29')](_0x17e55b,_0xdab3('0x30'));_0x1d956b[_0xdab3('0x31')]=_['keys'](_0x1222c4['query']);_0x1d956b['filters']=_[_0xdab3('0x32')](_0x1d956b[_0xdab3('0x2f')],_0x1d956b['query']);_0xad9a11[_0xdab3('0x33')]=_[_0xdab3('0x32')](_0x1d956b[_0xdab3('0x2f')],qs[_0xdab3('0x34')](_0x1222c4['query'][_0xdab3('0x34')]));_0xad9a11[_0xdab3('0x33')]=_0xad9a11[_0xdab3('0x33')][_0xdab3('0x35')]?_0xad9a11[_0xdab3('0x33')]:_0x1d956b[_0xdab3('0x2f')];if(!_0x1222c4[_0xdab3('0x31')][_0xdab3('0x36')](_0xdab3('0x37'))){_0xad9a11[_0xdab3('0x38')]=qs['limit'](_0x1222c4[_0xdab3('0x31')][_0xdab3('0x38')]);_0xad9a11[_0xdab3('0x1c')]=qs['offset'](_0x1222c4[_0xdab3('0x31')][_0xdab3('0x1c')]);}_0xad9a11[_0xdab3('0x39')]=qs[_0xdab3('0x3a')](_0x1222c4['query'][_0xdab3('0x3a')]);_0xad9a11[_0xdab3('0x3b')]=qs[_0xdab3('0x3c')](_[_0xdab3('0x3d')](_0x1222c4[_0xdab3('0x31')],_0x1d956b[_0xdab3('0x3c')]),_0x17e55b);if(_0x1222c4['query'][_0xdab3('0x3e')]){_0xad9a11[_0xdab3('0x3b')]=_[_0xdab3('0x3f')](_0xad9a11[_0xdab3('0x3b')],{'$or':_[_0xdab3('0x29')](_0x17e55b,function(_0xcbb418){if(_0xcbb418[_0xdab3('0x2d')]!==_0xdab3('0x40')){var _0x5ca21e={};_0x5ca21e[_0xcbb418['name']]={'$like':'%'+_0x1222c4[_0xdab3('0x31')][_0xdab3('0x3e')]+'%'};return _0x5ca21e;}})});}_0xad9a11=_[_0xdab3('0x3f')]({},_0xad9a11,_0x1222c4['options']);var _0x12e28a={'where':_0xad9a11['where']};return db[_0xdab3('0x2a')][_0xdab3('0x41')](_0x12e28a)[_0xdab3('0x23')](function(_0x3412f8){_0x237923[_0xdab3('0x41')]=_0x3412f8;if(_0x1222c4[_0xdab3('0x31')][_0xdab3('0x42')]){_0xad9a11[_0xdab3('0x43')]=[{'all':!![]}];}return db[_0xdab3('0x2a')][_0xdab3('0x44')](_0xad9a11);})[_0xdab3('0x23')](function(_0x530cd0){_0x237923[_0xdab3('0x45')]=_0x530cd0;return _0x237923;})[_0xdab3('0x23')](respondWithFilteredResult(_0x112b6c,_0xad9a11))[_0xdab3('0x46')](handleError(_0x112b6c,null));};exports[_0xdab3('0x47')]=function(_0x3fd7c6,_0x344c9d){var _0x4c9584={'raw':!![],'where':{'id':_0x3fd7c6[_0xdab3('0x48')]['id']}},_0x229512={};_0x229512[_0xdab3('0x2f')]=_[_0xdab3('0x49')](db[_0xdab3('0x2a')][_0xdab3('0x2b')]);_0x229512[_0xdab3('0x31')]=_['keys'](_0x3fd7c6[_0xdab3('0x31')]);_0x229512['filters']=_[_0xdab3('0x32')](_0x229512[_0xdab3('0x2f')],_0x229512[_0xdab3('0x31')]);_0x4c9584['attributes']=_[_0xdab3('0x32')](_0x229512[_0xdab3('0x2f')],qs['fields'](_0x3fd7c6['query'][_0xdab3('0x34')]));_0x4c9584[_0xdab3('0x33')]=_0x4c9584[_0xdab3('0x33')][_0xdab3('0x35')]?_0x4c9584[_0xdab3('0x33')]:_0x229512[_0xdab3('0x2f')];if(_0x3fd7c6[_0xdab3('0x31')][_0xdab3('0x42')]){_0x4c9584['include']=[{'all':!![]}];}_0x4c9584=_[_0xdab3('0x3f')]({},_0x4c9584,_0x3fd7c6[_0xdab3('0x4a')]);return db['VoiceTransferReport'][_0xdab3('0x4b')](_0x4c9584)[_0xdab3('0x23')](handleEntityNotFound(_0x344c9d,null))[_0xdab3('0x23')](respondWithResult(_0x344c9d,null))[_0xdab3('0x46')](handleError(_0x344c9d,null));};exports['create']=function(_0xb3fa5d,_0x12f118){return db[_0xdab3('0x2a')][_0xdab3('0x4c')](_0xb3fa5d[_0xdab3('0x4d')],{})['then'](respondWithResult(_0x12f118,0xc9))[_0xdab3('0x46')](handleError(_0x12f118,null));};exports[_0xdab3('0x22')]=function(_0x10c2d4,_0x4a5e6e){if(_0x10c2d4[_0xdab3('0x4d')]['id']){delete _0x10c2d4[_0xdab3('0x4d')]['id'];}return db[_0xdab3('0x2a')][_0xdab3('0x4b')]({'where':{'id':_0x10c2d4[_0xdab3('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a5e6e,null))['then'](saveUpdates(_0x10c2d4[_0xdab3('0x4d')],null))[_0xdab3('0x23')](respondWithResult(_0x4a5e6e,null))[_0xdab3('0x46')](handleError(_0x4a5e6e,null));};exports[_0xdab3('0x24')]=function(_0x15ebdf,_0x2ddbc7){return db['VoiceTransferReport'][_0xdab3('0x4b')]({'where':{'id':_0x15ebdf[_0xdab3('0x48')]['id']}})[_0xdab3('0x23')](handleEntityNotFound(_0x2ddbc7,null))[_0xdab3('0x23')](removeEntity(_0x2ddbc7,null))[_0xdab3('0x46')](handleError(_0x2ddbc7,null));};exports[_0xdab3('0x4e')]=function(_0x5ca759,_0x1b45cb){return db[_0xdab3('0x2a')][_0xdab3('0x4e')]()[_0xdab3('0x23')](respondWithResult(_0x1b45cb,null))[_0xdab3('0x46')](handleError(_0x1b45cb,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 063e915..fee137f 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 _0x0a17=['exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0x0a17,0x1a6));var _0x70a1=function(_0x41e464,_0x351d99){_0x41e464=_0x41e464-0x0;var _0x51ca56=_0x0a17[_0x41e464];return _0x51ca56;};'use strict';var _=require(_0x70a1('0x0'));var util=require('util');var logger=require(_0x70a1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x70a1('0x2'));var rp=require(_0x70a1('0x3'));var fs=require('fs');var path=require(_0x70a1('0x4'));var rimraf=require(_0x70a1('0x5'));var config=require('../../config/environment');var attributes=require(_0x70a1('0x6'));module[_0x70a1('0x7')]=function(_0x100797,_0x30c87b){return _0x100797[_0x70a1('0x8')](_0x70a1('0x9'),attributes,{'tableName':_0x70a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x092f=['moment','request-promise','path','rimraf','./voiceTransferReport.attributes','VoiceTransferReport','lodash','util','../../config/logger','api'];(function(_0x26bb3c,_0x1bb491){var _0x460854=function(_0x2c7561){while(--_0x2c7561){_0x26bb3c['push'](_0x26bb3c['shift']());}};_0x460854(++_0x1bb491);}(_0x092f,0x1dc));var _0xf092=function(_0x1d3577,_0x17a32e){_0x1d3577=_0x1d3577-0x0;var _0x277d9a=_0x092f[_0x1d3577];return _0x277d9a;};'use strict';var _=require(_0xf092('0x0'));var util=require(_0xf092('0x1'));var logger=require(_0xf092('0x2'))(_0xf092('0x3'));var moment=require(_0xf092('0x4'));var BPromise=require('bluebird');var rp=require(_0xf092('0x5'));var fs=require('fs');var path=require(_0xf092('0x6'));var rimraf=require(_0xf092('0x7'));var config=require('../../config/environment');var attributes=require(_0xf092('0x8'));module['exports']=function(_0x2b50a9,_0x31c77a){return _0x2b50a9['define'](_0xf092('0x9'),attributes,{'tableName':'report_call_transfer','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 e9beb8f..3b16e51 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 _0xad36=['VoiceTransferReport','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport'];(function(_0x15abba,_0x30ef6c){var _0x14696b=function(_0x483633){while(--_0x483633){_0x15abba['push'](_0x15abba['shift']());}};_0x14696b(++_0x30ef6c);}(_0xad36,0x1c6));var _0x6ad3=function(_0x407444,_0x9f7c4c){_0x407444=_0x407444-0x0;var _0x1ba581=_0xad36[_0x407444];return _0x1ba581;};'use strict';var _=require(_0x6ad3('0x0'));var util=require(_0x6ad3('0x1'));var moment=require(_0x6ad3('0x2'));var BPromise=require(_0x6ad3('0x3'));var rs=require(_0x6ad3('0x4'));var fs=require('fs');var Redis=require(_0x6ad3('0x5'));var db=require(_0x6ad3('0x6'))['db'];var utils=require(_0x6ad3('0x7'));var logger=require(_0x6ad3('0x8'))(_0x6ad3('0x9'));var config=require('../../config/environment');var jayson=require(_0x6ad3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x118c7f,_0x4056ba,_0x904fc6){return new BPromise(function(_0x386e71,_0x36e256){return client['request'](_0x118c7f,_0x904fc6)['then'](function(_0x53cc18){logger[_0x6ad3('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x4056ba,'request\x20sent');logger[_0x6ad3('0xc')](_0x6ad3('0xd'),_0x4056ba,_0x6ad3('0xe'),JSON['stringify'](_0x53cc18));if(_0x53cc18['error']){if(_0x53cc18['error'][_0x6ad3('0xf')]===0x1f4){logger[_0x6ad3('0x10')](_0x6ad3('0x11'),_0x4056ba,_0x53cc18[_0x6ad3('0x10')][_0x6ad3('0x12')]);return _0x36e256(_0x53cc18[_0x6ad3('0x10')][_0x6ad3('0x12')]);}logger[_0x6ad3('0x10')](_0x6ad3('0x11'),_0x4056ba,_0x53cc18['error'][_0x6ad3('0x12')]);return _0x386e71(_0x53cc18[_0x6ad3('0x10')][_0x6ad3('0x12')]);}else{logger['info'](_0x6ad3('0x11'),_0x4056ba,_0x6ad3('0xe'));_0x386e71(_0x53cc18[_0x6ad3('0x13')][_0x6ad3('0x12')]);}})[_0x6ad3('0x14')](function(_0x88bd5f){logger[_0x6ad3('0x10')](_0x6ad3('0x11'),_0x4056ba,_0x88bd5f);_0x36e256(_0x88bd5f);});});}exports[_0x6ad3('0x15')]=function(_0x3ecf8e){var _0x147649=this;return new Promise(function(_0x18d648,_0x16e55c){return db[_0x6ad3('0x16')][_0x6ad3('0x17')](_0x3ecf8e[_0x6ad3('0x18')],{'raw':_0x3ecf8e[_0x6ad3('0x19')]?_0x3ecf8e[_0x6ad3('0x19')][_0x6ad3('0x1a')]===undefined?!![]:![]:!![]})[_0x6ad3('0x1b')](function(_0x222761){logger[_0x6ad3('0xb')](_0x6ad3('0x15'),_0x3ecf8e);logger[_0x6ad3('0xc')]('CreateVoiceTransferReport',_0x3ecf8e,JSON['stringify'](_0x222761));_0x18d648(_0x222761);})['catch'](function(_0x186283){logger['error']('CreateVoiceTransferReport',_0x186283['message'],_0x3ecf8e);_0x16e55c(_0x147649[_0x6ad3('0x10')](0x1f4,_0x186283[_0x6ad3('0x12')]));});});}; \ No newline at end of file +var _0x0ade=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','result','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','debug','lodash','util','bluebird'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x0ade,0xab));var _0xe0ad=function(_0x1031b8,_0x1c8f00){_0x1031b8=_0x1031b8-0x0;var _0x28a143=_0x0ade[_0x1031b8];return _0x28a143;};'use strict';var _=require(_0xe0ad('0x0'));var util=require(_0xe0ad('0x1'));var moment=require('moment');var BPromise=require(_0xe0ad('0x2'));var rs=require(_0xe0ad('0x3'));var fs=require('fs');var Redis=require(_0xe0ad('0x4'));var db=require(_0xe0ad('0x5'))['db'];var utils=require(_0xe0ad('0x6'));var logger=require(_0xe0ad('0x7'))('rpc');var config=require(_0xe0ad('0x8'));var jayson=require(_0xe0ad('0x9'));var client=jayson[_0xe0ad('0xa')][_0xe0ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4426eb,_0x18828e,_0x5b21f7){return new BPromise(function(_0x448d,_0x1add4e){return client['request'](_0x4426eb,_0x5b21f7)[_0xe0ad('0xc')](function(_0x1bbe93){logger[_0xe0ad('0xd')](_0xe0ad('0xe'),_0x18828e,_0xe0ad('0xf'));logger['debug'](_0xe0ad('0x10'),_0x18828e,_0xe0ad('0xf'),JSON[_0xe0ad('0x11')](_0x1bbe93));if(_0x1bbe93['error']){if(_0x1bbe93['error']['code']===0x1f4){logger[_0xe0ad('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x18828e,_0x1bbe93[_0xe0ad('0x12')]['message']);return _0x1add4e(_0x1bbe93[_0xe0ad('0x12')]['message']);}logger[_0xe0ad('0x12')](_0xe0ad('0xe'),_0x18828e,_0x1bbe93[_0xe0ad('0x12')]['message']);return _0x448d(_0x1bbe93['error']['message']);}else{logger['info'](_0xe0ad('0xe'),_0x18828e,_0xe0ad('0xf'));_0x448d(_0x1bbe93[_0xe0ad('0x13')][_0xe0ad('0x14')]);}})[_0xe0ad('0x15')](function(_0x2f71a3){logger[_0xe0ad('0x12')](_0xe0ad('0xe'),_0x18828e,_0x2f71a3);_0x1add4e(_0x2f71a3);});});}exports[_0xe0ad('0x16')]=function(_0x8f36d8){var _0x341e5c=this;return new Promise(function(_0x250ce8,_0x1360f5){return db[_0xe0ad('0x17')][_0xe0ad('0x18')](_0x8f36d8[_0xe0ad('0x19')],{'raw':_0x8f36d8[_0xe0ad('0x1a')]?_0x8f36d8['options'][_0xe0ad('0x1b')]===undefined?!![]:![]:!![]})[_0xe0ad('0xc')](function(_0x1cbc3f){logger[_0xe0ad('0xd')](_0xe0ad('0x16'),_0x8f36d8);logger[_0xe0ad('0x1c')](_0xe0ad('0x16'),_0x8f36d8,JSON[_0xe0ad('0x11')](_0x1cbc3f));_0x250ce8(_0x1cbc3f);})[_0xe0ad('0x15')](function(_0x3eecaa){logger['error'](_0xe0ad('0x16'),_0x3eecaa[_0xe0ad('0x14')],_0x8f36d8);_0x1360f5(_0x341e5c[_0xe0ad('0x12')](0x1f4,_0x3eecaa[_0xe0ad('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 69abfa6..d1d166d 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 _0x7d86=['canUpdate','originate','/hangup','hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x7d86,0x86));var _0x67d8=function(_0x497e5a,_0x29cf43){_0x497e5a=_0x497e5a-0x0;var _0x4580f3=_0x7d86[_0x497e5a];return _0x4580f3;};'use strict';var express=require(_0x67d8('0x0'));var router=express['Router']();var auth=require(_0x67d8('0x1'));var controller=require(_0x67d8('0x2'));router[_0x67d8('0x3')](_0x67d8('0x4'),auth[_0x67d8('0x5')](),auth[_0x67d8('0x6')](),controller[_0x67d8('0x7')]);router['post'](_0x67d8('0x8'),auth[_0x67d8('0x5')](),auth[_0x67d8('0x6')](),controller[_0x67d8('0x9')]);router[_0x67d8('0x3')](_0x67d8('0xa'),auth[_0x67d8('0x5')](),auth[_0x67d8('0x6')](),controller[_0x67d8('0xb')]);router[_0x67d8('0x3')](_0x67d8('0xc'),auth[_0x67d8('0x5')](),auth[_0x67d8('0x6')](),controller[_0x67d8('0xd')]);router[_0x67d8('0x3')](_0x67d8('0xe'),auth[_0x67d8('0x5')](),auth[_0x67d8('0x6')](),controller[_0x67d8('0xf')]);router[_0x67d8('0x3')](_0x67d8('0x10'),auth['isAuthenticated'](),auth[_0x67d8('0x6')](),controller[_0x67d8('0x11')]);router[_0x67d8('0x3')]('/transfer',auth[_0x67d8('0x5')](),auth[_0x67d8('0x6')](),controller[_0x67d8('0x12')]);module[_0x67d8('0x13')]=router; \ No newline at end of file +var _0x4627=['answer','/hold','hold','unhold','/calls','calls','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup','/answer'];(function(_0x2c3aa5,_0x50e0a9){var _0x4613d2=function(_0x4496f3){while(--_0x4496f3){_0x2c3aa5['push'](_0x2c3aa5['shift']());}};_0x4613d2(++_0x50e0a9);}(_0x4627,0x115));var _0x7462=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x4627[_0x4de586];return _0x46baf5;};'use strict';var express=require(_0x7462('0x0'));var router=express[_0x7462('0x1')]();var auth=require(_0x7462('0x2'));var controller=require(_0x7462('0x3'));router[_0x7462('0x4')](_0x7462('0x5'),auth[_0x7462('0x6')](),auth[_0x7462('0x7')](),controller[_0x7462('0x8')]);router[_0x7462('0x4')](_0x7462('0x9'),auth[_0x7462('0x6')](),auth[_0x7462('0x7')](),controller['hangup']);router[_0x7462('0x4')](_0x7462('0xa'),auth[_0x7462('0x6')](),auth[_0x7462('0x7')](),controller[_0x7462('0xb')]);router[_0x7462('0x4')](_0x7462('0xc'),auth[_0x7462('0x6')](),auth[_0x7462('0x7')](),controller[_0x7462('0xd')]);router[_0x7462('0x4')]('/unhold',auth['isAuthenticated'](),auth[_0x7462('0x7')](),controller[_0x7462('0xe')]);router[_0x7462('0x4')](_0x7462('0xf'),auth[_0x7462('0x6')](),auth[_0x7462('0x7')](),controller[_0x7462('0x10')]);router['post']('/transfer',auth['isAuthenticated'](),auth[_0x7462('0x7')](),controller['transfer']);module[_0x7462('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 039cddf..2ba6e06 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 _0x6183=['info','body','length','json','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','hangup\x20executed!','answer','answer\x20fired:','userId','webbar:answer','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','stringify','emit','log','error','stack','name','status','send','NotFound','code','catch','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20'];(function(_0x334884,_0x55835a){var _0x923ee3=function(_0x120431){while(--_0x120431){_0x334884['push'](_0x334884['shift']());}};_0x923ee3(++_0x55835a);}(_0x6183,0x1e2));var _0x3618=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x6183[_0x22b68a];return _0x1ac67a;};'use strict';var path=require(_0x3618('0x0'));var fs=require('fs');var _=require(_0x3618('0x1'));var db=require(_0x3618('0x2'))['db'];var config=require(_0x3618('0x3'));var util=require(_0x3618('0x4'));var BPromise=require(_0x3618('0x5'));var jayson=require(_0x3618('0x6'));var amiClient=jayson[_0x3618('0x7')][_0x3618('0x8')]({'port':0x232a});var logger=require(_0x3618('0x9'))(_0x3618('0xa'));var Redis=require(_0x3618('0xb'));config[_0x3618('0xc')]=_[_0x3618('0xd')](config['redis'],{'host':_0x3618('0xe'),'port':0x18eb});var io=require(_0x3618('0xf'))(new Redis(config['redis']));var Schema=require(_0x3618('0x10'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3618('0x11')]},'callNumber':{'type':_0x3618('0x12'),'required':[!![],_0x3618('0x13')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x3618('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x3618('0x14'),'required':[!![],_0x3618('0x11')]},'sessionId':{'type':_0x3618('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3618('0x11')]},'sessionId':{'type':_0x3618('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3618('0x14'),'required':[!![],_0x3618('0x11')]},'sessionId':{'type':_0x3618('0x12'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x3618('0x12'),'required':[!![],_0x3618('0x15')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3618('0x11')]},'sessionId':{'type':_0x3618('0x12'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3618('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3618('0x14'),'required':[!![],_0x3618('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x3618('0x14'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x4c3be8,_0x493bda,_0x3c1777){logger['info'](_0x4c3be8,_0x493bda,JSON[_0x3618('0x16')](_0x3c1777));io['to'](_0x4c3be8)[_0x3618('0x17')](_0x493bda,_0x3c1777);}function handleError(_0x5a3dcf){return function(_0x37f707){console[_0x3618('0x18')]('handleError:',_0x37f707,_0x37f707 instanceof RangeError);logger[_0x3618('0x19')](_0x37f707[_0x3618('0x1a')]);if(_0x37f707 instanceof RangeError){if(_0x37f707[_0x3618('0x1b')]){delete _0x37f707['name'];}_0x5a3dcf[_0x3618('0x1c')](0x194)[_0x3618('0x1d')](_0x37f707);}else{if(_0x37f707[_0x3618('0x1b')]){delete _0x37f707[_0x3618('0x1b')];}_0x5a3dcf[_0x3618('0x1c')](0x1f4)['send'](_0x37f707);}};}function checkError(){return function(_0x5e8344){if(!_0x5e8344){throw new RangeError(_0x3618('0x1e'));}return _0x5e8344;};}function respondWithRpcPromise(_0x215c14,_0x339b92){return new BPromise(function(_0x2a0683,_0x182ea6){var _0x1dd3d7=amiClient;return _0x1dd3d7['request'](_0x215c14,_0x339b92)['then'](function(_0x5a5e02){if(_0x5a5e02[_0x3618('0x19')]){if(_0x5a5e02['error'][_0x3618('0x1f')]===0x1f4){return _0x182ea6(_0x5a5e02[_0x3618('0x19')]['message']);}return _0x2a0683(_0x5a5e02[_0x3618('0x19')]['message']);}else{_0x2a0683(_0x5a5e02['result']);}})[_0x3618('0x20')](function(_0x25977b){_0x182ea6(_0x25977b);});});}function getAgent(_0x56ee75){return db['User'][_0x3618('0x21')]({'where':{'id':_0x56ee75,'role':_0x3618('0x22')}})[_0x3618('0x23')](checkError());}function getAgentCheckSession(_0x52ea30,_0x37d7ca){return new BPromise(function(_0xa13dca,_0x537838){var _0x32d4ae=respondWithRpcPromise(_0x3618('0x24'));var _0x3ab734=getAgent(_0x52ea30);Promise[_0x3618('0x25')]([_0x32d4ae,_0x3ab734])[_0x3618('0x23')](function(_0x1343bf){var _0x405731=_0x1343bf[0x0];var _0x353a30=_0x1343bf[0x1];var _0x33eaed=_[_0x3618('0x26')](_0x405731[_0x3618('0x27')],function(_0xfaf738){return _0xfaf738[_0x3618('0x28')]==_0x353a30['id']&&_0xfaf738[_0x3618('0x29')]==_0x37d7ca;});if(_0x33eaed['length']==0x1){_0xa13dca(_0x353a30);}else{_0x537838(new RangeError(_0x3618('0x2a')+_0x37d7ca+'\x20not\x20found!'));}});});}exports['originate']=function(_0x3b0625,_0x240ee1){logger[_0x3618('0x2b')]('originate\x20fired:',_0x3b0625['body']);var _0x143677=originateValidation['validate'](_0x3b0625[_0x3618('0x2c')]);if(_0x143677[_0x3618('0x2d')]>0x0){return _0x240ee1[_0x3618('0x1c')](0x190)[_0x3618('0x2e')](_0x143677);}var _0x55b123=_0x3b0625[_0x3618('0x2c')]['userId'];var _0x47abe1=_0x3b0625[_0x3618('0x2c')][_0x3618('0x2f')];var _0x42c64e=_0x3b0625['body'][_0x3618('0x30')];var _0x454217=_0x3b0625[_0x3618('0x2c')][_0x3618('0x31')];return getAgent(_0x55b123)[_0x3618('0x23')](function(_0x27ce29){logger['info'](_0x3618('0x32'),_0x27ce29['name']);emit(util[_0x3618('0x33')](_0x3618('0x34'),_0x27ce29[_0x3618('0x1b')]),_0x3618('0x35'),{'callNumber':_0x47abe1,'callerId':_0x42c64e,'callbackUrl':_0x454217});return _0x240ee1[_0x3618('0x1c')](0xc8)[_0x3618('0x2e')]({'error':![],'message':_0x3618('0x36')});})[_0x3618('0x20')](handleError(_0x240ee1));};exports['hangup']=function(_0xdecf51,_0x344dd9){logger[_0x3618('0x2b')](_0x3618('0x37'),_0xdecf51[_0x3618('0x2c')]);var _0x43f943=hangupValidation[_0x3618('0x10')](_0xdecf51['body']);if(_0x43f943['length']>0x0){return _0x344dd9[_0x3618('0x1c')](0x190)[_0x3618('0x2e')](_0x43f943);}var _0x4aefb3=_0xdecf51[_0x3618('0x2c')]['userId'];var _0x3184d5=_0xdecf51[_0x3618('0x2c')][_0x3618('0x29')];return getAgent(_0x4aefb3)[_0x3618('0x23')](function(_0x4c4a09){logger['info']('entityFound:',_0x4c4a09[_0x3618('0x1b')]);emit(util[_0x3618('0x33')]('user:%s',_0x4c4a09[_0x3618('0x1b')]),'webbar:hangup',{'sessionId':_0x3184d5});return _0x344dd9[_0x3618('0x1c')](0xc8)[_0x3618('0x2e')]({'error':![],'message':_0x3618('0x38')});})[_0x3618('0x20')](handleError(_0x344dd9));};exports[_0x3618('0x39')]=function(_0x146698,_0x1ba861){logger['info'](_0x3618('0x3a'),_0x146698['body']);var _0x3fde78=answerValidation[_0x3618('0x10')](_0x146698['body']);if(_0x3fde78[_0x3618('0x2d')]>0x0){return _0x1ba861[_0x3618('0x1c')](0x190)[_0x3618('0x2e')](_0x3fde78);}var _0x50be2f=_0x146698[_0x3618('0x2c')][_0x3618('0x3b')];var _0x2c7833=_0x146698[_0x3618('0x2c')][_0x3618('0x29')];return getAgent(_0x50be2f)['then'](function(_0x463124){logger['info']('entityFound:',_0x463124[_0x3618('0x1b')]);emit(util[_0x3618('0x33')](_0x3618('0x34'),_0x463124[_0x3618('0x1b')]),_0x3618('0x3c'),{'sessionId':_0x2c7833});return _0x1ba861[_0x3618('0x1c')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x3618('0x20')](handleError(_0x1ba861));};exports['hold']=function(_0x1da847,_0x54e806){logger[_0x3618('0x2b')](_0x3618('0x3d'),_0x1da847['body']);var _0x355216=holdValidation[_0x3618('0x10')](_0x1da847[_0x3618('0x2c')]);if(_0x355216['length']>0x0){return _0x54e806[_0x3618('0x1c')](0x190)[_0x3618('0x2e')](_0x355216);}var _0x5a9d2e=_0x1da847[_0x3618('0x2c')][_0x3618('0x3b')];var _0x19c784=_0x1da847[_0x3618('0x2c')][_0x3618('0x29')];return getAgent(_0x5a9d2e)[_0x3618('0x23')](function(_0x223b4b){logger['info'](_0x3618('0x32'),_0x223b4b['name']);emit(util[_0x3618('0x33')](_0x3618('0x34'),_0x223b4b[_0x3618('0x1b')]),_0x3618('0x3e'),{'sessionId':_0x19c784});return _0x54e806[_0x3618('0x1c')](0xc8)[_0x3618('0x2e')]({'error':![],'message':_0x3618('0x3f')});})[_0x3618('0x20')](handleError(_0x54e806));};exports[_0x3618('0x40')]=function(_0x509835,_0x26469d){logger['info'](_0x3618('0x41'),_0x509835['body']);var _0x48bbd5=unholdValidation['validate'](_0x509835[_0x3618('0x2c')]);if(_0x48bbd5[_0x3618('0x2d')]>0x0){return _0x26469d[_0x3618('0x1c')](0x190)[_0x3618('0x2e')](_0x48bbd5);}var _0x4231c1=_0x509835[_0x3618('0x2c')][_0x3618('0x3b')];var _0x5de2fb=_0x509835[_0x3618('0x2c')][_0x3618('0x29')];return getAgent(_0x4231c1)[_0x3618('0x23')](function(_0xea4abd){logger['info'](_0x3618('0x32'),_0xea4abd[_0x3618('0x1b')]);emit(util[_0x3618('0x33')](_0x3618('0x34'),_0xea4abd['name']),_0x3618('0x42'),{'sessionId':_0x5de2fb});return _0x26469d['status'](0xc8)[_0x3618('0x2e')]({'error':![],'message':_0x3618('0x43')});})[_0x3618('0x20')](handleError(_0x26469d));};exports['calls']=function(_0x47a488,_0x2ebb8c){logger[_0x3618('0x2b')]('calls\x20fired:',_0x2ebb8c[_0x3618('0x2c')]);var _0x3998a3=callsValidation['validate'](_0x47a488[_0x3618('0x2c')]);if(_0x3998a3[_0x3618('0x2d')]>0x0){return _0x2ebb8c['status'](0x190)[_0x3618('0x2e')](_0x3998a3);}var _0x404262=_0x47a488['body'][_0x3618('0x3b')];var _0x1c3069=respondWithRpcPromise(_0x3618('0x24'));var _0x224565=getAgent(_0x404262);return Promise['all']([_0x1c3069,_0x224565])['then'](function(_0xf74e3d){var _0x52c20d=_0xf74e3d[0x0];var _0x368ba0=_0xf74e3d[0x1];var _0x122b52=_[_0x3618('0x26')](_0x52c20d[_0x3618('0x27')],function(_0x3b4f64){return _0x3b4f64['UserId']==_0x368ba0['id'];});return _0x2ebb8c[_0x3618('0x1c')](0xc8)[_0x3618('0x2e')]({'count':_0x122b52[_0x3618('0x2d')],'rows':_0x122b52});})[_0x3618('0x20')](handleError(_0x2ebb8c));};exports[_0x3618('0x44')]=function(_0x25935a,_0x3a304e){logger[_0x3618('0x2b')]('conference\x20fired:',_0x25935a[_0x3618('0x2c')]);var _0x67e9d4=conferenceValidation[_0x3618('0x10')](_0x25935a['body']);if(_0x67e9d4[_0x3618('0x2d')]>0x0){return _0x3a304e[_0x3618('0x1c')](0x190)['json'](_0x67e9d4);}var _0x572afc=_0x25935a[_0x3618('0x2c')][_0x3618('0x3b')];return getAgent(_0x572afc)['then'](function(_0x5a55fb){logger['info'](_0x3618('0x32'),_0x5a55fb['name']);emit(util[_0x3618('0x33')]('user:%s',_0x5a55fb[_0x3618('0x1b')]),_0x3618('0x45'));return _0x3a304e[_0x3618('0x1c')](0xc8)[_0x3618('0x2e')]({'error':![],'message':_0x3618('0x46')});})['catch'](handleError(_0x3a304e));};exports[_0x3618('0x47')]=function(_0x27dc6c,_0x5dd15a){logger[_0x3618('0x2b')](_0x3618('0x48'),_0x27dc6c[_0x3618('0x2c')]);var _0x1c72a5=transferValidation[_0x3618('0x10')](_0x27dc6c['body']);if(_0x1c72a5['length']>0x0){return _0x5dd15a[_0x3618('0x1c')](0x190)[_0x3618('0x2e')](_0x1c72a5);}var _0x453114=_0x27dc6c[_0x3618('0x2c')]['userId'];var _0x34430a=_0x27dc6c[_0x3618('0x2c')]['sessionId'];var _0x234d5e=_0x27dc6c[_0x3618('0x2c')][_0x3618('0x49')];return getAgent(_0x453114)['then'](function(_0x55309e){logger[_0x3618('0x2b')](_0x3618('0x32'),_0x55309e[_0x3618('0x1b')]);emit(util[_0x3618('0x33')](_0x3618('0x34'),_0x55309e['name']),_0x3618('0x4a'),{'sessionId':_0x34430a,'transferNumber':_0x234d5e});return _0x5dd15a[_0x3618('0x1c')](0xc8)[_0x3618('0x2e')]({'error':![],'message':'transfer\x20executed!'});})[_0x3618('0x20')](handleError(_0x5dd15a));}; \ No newline at end of file +var _0xe9e8=['transferNumber\x20is\x20required','info','stringify','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','catch','User','findOne','agent','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','format','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required'];(function(_0x5a401e,_0x2de782){var _0x2aa2cc=function(_0x1150e7){while(--_0x1150e7){_0x5a401e['push'](_0x5a401e['shift']());}};_0x2aa2cc(++_0x2de782);}(_0xe9e8,0x179));var _0x8e9e=function(_0x207b15,_0x23e7fd){_0x207b15=_0x207b15-0x0;var _0xc66739=_0xe9e8[_0x207b15];return _0xc66739;};'use strict';var path=require(_0x8e9e('0x0'));var fs=require('fs');var _=require(_0x8e9e('0x1'));var db=require(_0x8e9e('0x2'))['db'];var config=require(_0x8e9e('0x3'));var util=require(_0x8e9e('0x4'));var BPromise=require(_0x8e9e('0x5'));var jayson=require(_0x8e9e('0x6'));var amiClient=jayson['client'][_0x8e9e('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0x8e9e('0x8'));var Redis=require(_0x8e9e('0x9'));config[_0x8e9e('0xa')]=_['defaults'](config['redis'],{'host':_0x8e9e('0xb'),'port':0x18eb});var io=require(_0x8e9e('0xc'))(new Redis(config[_0x8e9e('0xa')]));var Schema=require(_0x8e9e('0xd'));var originateValidation=new Schema({'userId':{'type':_0x8e9e('0xe'),'required':[!![],_0x8e9e('0xf')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x8e9e('0x10')},'callbackUrl':{'type':_0x8e9e('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x8e9e('0xe'),'required':[!![],_0x8e9e('0xf')]},'sessionId':{'type':_0x8e9e('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8e9e('0xe'),'required':[!![],_0x8e9e('0xf')]},'sessionId':{'type':_0x8e9e('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8e9e('0xe'),'required':[!![],_0x8e9e('0xf')]},'sessionId':{'type':_0x8e9e('0x10'),'required':[!![],_0x8e9e('0x11')]},'transferNumber':{'type':_0x8e9e('0x10'),'required':[!![],_0x8e9e('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8e9e('0xf')]},'sessionId':{'type':_0x8e9e('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8e9e('0xe'),'required':[!![],_0x8e9e('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8e9e('0xe'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x8e9e('0xe'),'required':[!![],_0x8e9e('0xf')]}});function emit(_0x462cf9,_0x5c76f0,_0x5dd738){logger[_0x8e9e('0x13')](_0x462cf9,_0x5c76f0,JSON[_0x8e9e('0x14')](_0x5dd738));io['to'](_0x462cf9)['emit'](_0x5c76f0,_0x5dd738);}function handleError(_0x1bddc7){return function(_0x428bb3){console[_0x8e9e('0x15')](_0x8e9e('0x16'),_0x428bb3,_0x428bb3 instanceof RangeError);logger['error'](_0x428bb3[_0x8e9e('0x17')]);if(_0x428bb3 instanceof RangeError){if(_0x428bb3['name']){delete _0x428bb3[_0x8e9e('0x18')];}_0x1bddc7[_0x8e9e('0x19')](0x194)[_0x8e9e('0x1a')](_0x428bb3);}else{if(_0x428bb3[_0x8e9e('0x18')]){delete _0x428bb3['name'];}_0x1bddc7['status'](0x1f4)['send'](_0x428bb3);}};}function checkError(){return function(_0x825c76){if(!_0x825c76){throw new RangeError(_0x8e9e('0x1b'));}return _0x825c76;};}function respondWithRpcPromise(_0x9e61e7,_0x30e264){return new BPromise(function(_0x2786e2,_0x3643e6){var _0x2cb0c1=amiClient;return _0x2cb0c1[_0x8e9e('0x1c')](_0x9e61e7,_0x30e264)[_0x8e9e('0x1d')](function(_0x12d89d){if(_0x12d89d[_0x8e9e('0x1e')]){if(_0x12d89d[_0x8e9e('0x1e')][_0x8e9e('0x1f')]===0x1f4){return _0x3643e6(_0x12d89d[_0x8e9e('0x1e')][_0x8e9e('0x20')]);}return _0x2786e2(_0x12d89d['error'][_0x8e9e('0x20')]);}else{_0x2786e2(_0x12d89d['result']);}})[_0x8e9e('0x21')](function(_0xa2df9f){_0x3643e6(_0xa2df9f);});});}function getAgent(_0x38c361){return db[_0x8e9e('0x22')][_0x8e9e('0x23')]({'where':{'id':_0x38c361,'role':_0x8e9e('0x24')}})[_0x8e9e('0x1d')](checkError());}function getAgentCheckSession(_0x51e299,_0x426f2c){return new BPromise(function(_0x11b7fc,_0x1d13d0){var _0x3ce2f5=respondWithRpcPromise(_0x8e9e('0x25'));var _0x4ebb22=getAgent(_0x51e299);Promise[_0x8e9e('0x26')]([_0x3ce2f5,_0x4ebb22])[_0x8e9e('0x1d')](function(_0x26779d){var _0x4c0f2a=_0x26779d[0x0];var _0x2d9048=_0x26779d[0x1];var _0x573580=_['filter'](_0x4c0f2a[_0x8e9e('0x27')],function(_0xfb822e){return _0xfb822e[_0x8e9e('0x28')]==_0x2d9048['id']&&_0xfb822e[_0x8e9e('0x29')]==_0x426f2c;});if(_0x573580[_0x8e9e('0x2a')]==0x1){_0x11b7fc(_0x2d9048);}else{_0x1d13d0(new RangeError(_0x8e9e('0x2b')+_0x426f2c+'\x20not\x20found!'));}});});}exports[_0x8e9e('0x2c')]=function(_0x31ee40,_0x3ef94){logger[_0x8e9e('0x13')](_0x8e9e('0x2d'),_0x31ee40[_0x8e9e('0x2e')]);var _0x5d68b1=originateValidation['validate'](_0x31ee40[_0x8e9e('0x2e')]);if(_0x5d68b1[_0x8e9e('0x2a')]>0x0){return _0x3ef94[_0x8e9e('0x19')](0x190)[_0x8e9e('0x2f')](_0x5d68b1);}var _0x295eb1=_0x31ee40['body'][_0x8e9e('0x30')];var _0x41cf04=_0x31ee40[_0x8e9e('0x2e')][_0x8e9e('0x31')];var _0x1f2021=_0x31ee40[_0x8e9e('0x2e')][_0x8e9e('0x32')];var _0x3f6caa=_0x31ee40['body']['callbackUrl'];return getAgent(_0x295eb1)['then'](function(_0x1b5edf){logger[_0x8e9e('0x13')](_0x8e9e('0x33'),_0x1b5edf[_0x8e9e('0x18')]);emit(util['format'](_0x8e9e('0x34'),_0x1b5edf[_0x8e9e('0x18')]),_0x8e9e('0x35'),{'callNumber':_0x41cf04,'callerId':_0x1f2021,'callbackUrl':_0x3f6caa});return _0x3ef94[_0x8e9e('0x19')](0xc8)[_0x8e9e('0x2f')]({'error':![],'message':_0x8e9e('0x36')});})[_0x8e9e('0x21')](handleError(_0x3ef94));};exports['hangup']=function(_0xd6075d,_0x3463f5){logger[_0x8e9e('0x13')](_0x8e9e('0x37'),_0xd6075d['body']);var _0x40bde2=hangupValidation[_0x8e9e('0xd')](_0xd6075d[_0x8e9e('0x2e')]);if(_0x40bde2[_0x8e9e('0x2a')]>0x0){return _0x3463f5['status'](0x190)[_0x8e9e('0x2f')](_0x40bde2);}var _0xf054a5=_0xd6075d[_0x8e9e('0x2e')][_0x8e9e('0x30')];var _0x18291c=_0xd6075d['body']['sessionId'];return getAgent(_0xf054a5)[_0x8e9e('0x1d')](function(_0x3b840d){logger['info'](_0x8e9e('0x33'),_0x3b840d['name']);emit(util[_0x8e9e('0x38')](_0x8e9e('0x34'),_0x3b840d[_0x8e9e('0x18')]),_0x8e9e('0x39'),{'sessionId':_0x18291c});return _0x3463f5['status'](0xc8)[_0x8e9e('0x2f')]({'error':![],'message':'hangup\x20executed!'});})[_0x8e9e('0x21')](handleError(_0x3463f5));};exports[_0x8e9e('0x3a')]=function(_0xd5a9c7,_0x320451){logger[_0x8e9e('0x13')](_0x8e9e('0x3b'),_0xd5a9c7[_0x8e9e('0x2e')]);var _0x1cf6b2=answerValidation['validate'](_0xd5a9c7['body']);if(_0x1cf6b2['length']>0x0){return _0x320451[_0x8e9e('0x19')](0x190)['json'](_0x1cf6b2);}var _0x1d5d79=_0xd5a9c7[_0x8e9e('0x2e')]['userId'];var _0x2bb2f2=_0xd5a9c7['body'][_0x8e9e('0x29')];return getAgent(_0x1d5d79)[_0x8e9e('0x1d')](function(_0x2497a9){logger[_0x8e9e('0x13')](_0x8e9e('0x33'),_0x2497a9[_0x8e9e('0x18')]);emit(util[_0x8e9e('0x38')](_0x8e9e('0x34'),_0x2497a9[_0x8e9e('0x18')]),_0x8e9e('0x3c'),{'sessionId':_0x2bb2f2});return _0x320451[_0x8e9e('0x19')](0xc8)['json']({'error':![],'message':_0x8e9e('0x3d')});})[_0x8e9e('0x21')](handleError(_0x320451));};exports[_0x8e9e('0x3e')]=function(_0x2872c1,_0x409c34){logger['info'](_0x8e9e('0x3f'),_0x2872c1[_0x8e9e('0x2e')]);var _0x50992f=holdValidation[_0x8e9e('0xd')](_0x2872c1[_0x8e9e('0x2e')]);if(_0x50992f['length']>0x0){return _0x409c34[_0x8e9e('0x19')](0x190)[_0x8e9e('0x2f')](_0x50992f);}var _0x2a5923=_0x2872c1[_0x8e9e('0x2e')]['userId'];var _0x1cea48=_0x2872c1['body']['sessionId'];return getAgent(_0x2a5923)[_0x8e9e('0x1d')](function(_0x5afab5){logger[_0x8e9e('0x13')]('entityFound:',_0x5afab5['name']);emit(util[_0x8e9e('0x38')](_0x8e9e('0x34'),_0x5afab5[_0x8e9e('0x18')]),_0x8e9e('0x40'),{'sessionId':_0x1cea48});return _0x409c34[_0x8e9e('0x19')](0xc8)[_0x8e9e('0x2f')]({'error':![],'message':_0x8e9e('0x41')});})[_0x8e9e('0x21')](handleError(_0x409c34));};exports['unhold']=function(_0x3a87aa,_0x33cae0){logger[_0x8e9e('0x13')](_0x8e9e('0x42'),_0x3a87aa['body']);var _0x1eb27c=unholdValidation[_0x8e9e('0xd')](_0x3a87aa[_0x8e9e('0x2e')]);if(_0x1eb27c['length']>0x0){return _0x33cae0[_0x8e9e('0x19')](0x190)[_0x8e9e('0x2f')](_0x1eb27c);}var _0x1d752b=_0x3a87aa[_0x8e9e('0x2e')]['userId'];var _0x17e6c6=_0x3a87aa[_0x8e9e('0x2e')][_0x8e9e('0x29')];return getAgent(_0x1d752b)[_0x8e9e('0x1d')](function(_0x551769){logger[_0x8e9e('0x13')](_0x8e9e('0x33'),_0x551769[_0x8e9e('0x18')]);emit(util[_0x8e9e('0x38')](_0x8e9e('0x34'),_0x551769['name']),'webbar:unhold',{'sessionId':_0x17e6c6});return _0x33cae0['status'](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x8e9e('0x21')](handleError(_0x33cae0));};exports[_0x8e9e('0x43')]=function(_0x145728,_0x562cae){logger['info'](_0x8e9e('0x44'),_0x562cae[_0x8e9e('0x2e')]);var _0x2cd5cb=callsValidation[_0x8e9e('0xd')](_0x145728[_0x8e9e('0x2e')]);if(_0x2cd5cb['length']>0x0){return _0x562cae[_0x8e9e('0x19')](0x190)['json'](_0x2cd5cb);}var _0x4d8d1a=_0x145728[_0x8e9e('0x2e')]['userId'];var _0x555852=respondWithRpcPromise(_0x8e9e('0x25'));var _0xde23b=getAgent(_0x4d8d1a);return Promise[_0x8e9e('0x26')]([_0x555852,_0xde23b])[_0x8e9e('0x1d')](function(_0x273ec0){var _0x240847=_0x273ec0[0x0];var _0x56e23e=_0x273ec0[0x1];var _0x5a80c6=_[_0x8e9e('0x45')](_0x240847[_0x8e9e('0x27')],function(_0xfa3187){return _0xfa3187[_0x8e9e('0x28')]==_0x56e23e['id'];});return _0x562cae[_0x8e9e('0x19')](0xc8)['json']({'count':_0x5a80c6[_0x8e9e('0x2a')],'rows':_0x5a80c6});})['catch'](handleError(_0x562cae));};exports[_0x8e9e('0x46')]=function(_0x425eff,_0x4239b5){logger[_0x8e9e('0x13')](_0x8e9e('0x47'),_0x425eff['body']);var _0x5e55d9=conferenceValidation[_0x8e9e('0xd')](_0x425eff['body']);if(_0x5e55d9['length']>0x0){return _0x4239b5[_0x8e9e('0x19')](0x190)[_0x8e9e('0x2f')](_0x5e55d9);}var _0x39aa35=_0x425eff[_0x8e9e('0x2e')]['userId'];return getAgent(_0x39aa35)['then'](function(_0x4c5af3){logger[_0x8e9e('0x13')](_0x8e9e('0x33'),_0x4c5af3[_0x8e9e('0x18')]);emit(util['format'](_0x8e9e('0x34'),_0x4c5af3[_0x8e9e('0x18')]),_0x8e9e('0x48'));return _0x4239b5['status'](0xc8)[_0x8e9e('0x2f')]({'error':![],'message':_0x8e9e('0x49')});})[_0x8e9e('0x21')](handleError(_0x4239b5));};exports[_0x8e9e('0x4a')]=function(_0x2336f1,_0x3750d8){logger[_0x8e9e('0x13')](_0x8e9e('0x4b'),_0x2336f1[_0x8e9e('0x2e')]);var _0x4b3687=transferValidation[_0x8e9e('0xd')](_0x2336f1[_0x8e9e('0x2e')]);if(_0x4b3687[_0x8e9e('0x2a')]>0x0){return _0x3750d8[_0x8e9e('0x19')](0x190)['json'](_0x4b3687);}var _0x2a1ab1=_0x2336f1[_0x8e9e('0x2e')][_0x8e9e('0x30')];var _0x1189ad=_0x2336f1[_0x8e9e('0x2e')][_0x8e9e('0x29')];var _0x471946=_0x2336f1['body'][_0x8e9e('0x4c')];return getAgent(_0x2a1ab1)['then'](function(_0x4d7151){logger[_0x8e9e('0x13')](_0x8e9e('0x33'),_0x4d7151[_0x8e9e('0x18')]);emit(util[_0x8e9e('0x38')]('user:%s',_0x4d7151[_0x8e9e('0x18')]),_0x8e9e('0x4d'),{'sessionId':_0x1189ad,'transferNumber':_0x471946});return _0x3750d8[_0x8e9e('0x19')](0xc8)[_0x8e9e('0x2f')]({'error':![],'message':_0x8e9e('0x4e')});})[_0x8e9e('0x21')](handleError(_0x3750d8));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 60854ed..4d8b09b 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 _0x4325=['connect-timeout','express','Router','../../config/environment','./whatsappAccount.controller','get','index','isAuthenticated','/:id','show','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeDispositions','removeAgents','exports','multer','util'];(function(_0x155839,_0x3f679d){var _0x51d322=function(_0xf96e28){while(--_0xf96e28){_0x155839['push'](_0x155839['shift']());}};_0x51d322(++_0x3f679d);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var path=require('path');var timeout=require(_0x5432('0x2'));var express=require(_0x5432('0x3'));var router=express[_0x5432('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5432('0x5'));var controller=require(_0x5432('0x6'));router[_0x5432('0x7')]('/',auth['isAuthenticated'](),controller[_0x5432('0x8')]);router[_0x5432('0x7')]('/describe',auth[_0x5432('0x9')](),controller['describe']);router[_0x5432('0x7')](_0x5432('0xa'),auth[_0x5432('0x9')](),controller[_0x5432('0xb')]);router[_0x5432('0x7')]('/:id/dispositions',auth[_0x5432('0x9')](),controller['getDispositions']);router[_0x5432('0x7')](_0x5432('0xc'),auth[_0x5432('0x9')](),controller[_0x5432('0xd')]);router['get']('/:id/users',auth[_0x5432('0x9')](),controller[_0x5432('0xe')]);router['get'](_0x5432('0xf'),auth[_0x5432('0x9')](),controller[_0x5432('0x10')]);router[_0x5432('0x11')]('/',auth[_0x5432('0x9')](),controller[_0x5432('0x12')]);router['post']('/:id/dispositions',auth[_0x5432('0x9')](),controller[_0x5432('0x13')]);router[_0x5432('0x11')](_0x5432('0xc'),auth[_0x5432('0x9')](),controller[_0x5432('0x14')]);router['post'](_0x5432('0x15'),auth['isAuthenticated'](),controller[_0x5432('0x16')]);router[_0x5432('0x11')](_0x5432('0xf'),auth[_0x5432('0x9')](),controller[_0x5432('0x17')]);router['post'](_0x5432('0x18'),controller[_0x5432('0x19')]);router[_0x5432('0x11')](_0x5432('0x1a'),auth[_0x5432('0x9')](),controller[_0x5432('0x1b')]);router[_0x5432('0x1c')]('/:id',auth[_0x5432('0x9')](),controller[_0x5432('0x1d')]);router[_0x5432('0x1e')](_0x5432('0xa'),auth[_0x5432('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x5432('0x9')](),controller[_0x5432('0x1f')]);router[_0x5432('0x1e')](_0x5432('0xc'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x5432('0x1e')](_0x5432('0x15'),auth['isAuthenticated'](),controller[_0x5432('0x20')]);module[_0x5432('0x21')]=router; \ No newline at end of file +var _0x0b0e=['addApplications','send','update','delete','destroy','removeAnswers','removeAgents','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addAnswer','addAgents'];(function(_0x2d7842,_0x5e1932){var _0x35485d=function(_0x56843a){while(--_0x56843a){_0x2d7842['push'](_0x2d7842['shift']());}};_0x35485d(++_0x5e1932);}(_0x0b0e,0x187));var _0xe0b0=function(_0x8ce506,_0x517f30){_0x8ce506=_0x8ce506-0x0;var _0x23c8e5=_0x0b0e[_0x8ce506];return _0x23c8e5;};'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['getDispositions']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x8')](_0xe0b0('0x13'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router['post']('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x16')](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['addDisposition']);router[_0xe0b0('0x16')]('/:id/canned_answers',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['post'](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x16')]('/:id/applications',auth['isAuthenticated'](),controller[_0xe0b0('0x19')]);router['post']('/:id/notify',controller['notify']);router[_0xe0b0('0x16')]('/:id/send',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['put'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);router[_0xe0b0('0x1c')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x1d')]);router['delete']('/:id/dispositions',auth[_0xe0b0('0x9')](),controller['removeDispositions']);router[_0xe0b0('0x1c')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x1e')]);router['delete'](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 075929c..b6f5753 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 _0xbd3a=['setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x4df476,_0x5af263){var _0x2b2bd7=function(_0x3c2ae0){while(--_0x3c2ae0){_0x4df476['push'](_0x4df476['shift']());}};_0x2b2bd7(++_0x5af263);}(_0xbd3a,0x1f0));var _0xabd3=function(_0x15ac1b,_0x4a313e){_0x15ac1b=_0x15ac1b-0x0;var _0x158f91=_0xbd3a[_0x15ac1b];return _0x158f91;};'use strict';var Sequelize=require(_0xabd3('0x0'));var rs=require('randomstring');module[_0xabd3('0x1')]={'name':{'type':Sequelize[_0xabd3('0x2')],'unique':_0xabd3('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xabd3('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xabd3('0x2')],'defaultValue':function(){return rs[_0xabd3('0x4')]();}},'phone':{'type':Sequelize[_0xabd3('0x2')]},'type':{'type':Sequelize[_0xabd3('0x5')](_0xabd3('0x6'))},'accountSid':{'type':Sequelize[_0xabd3('0x2')]},'authToken':{'type':Sequelize[_0xabd3('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xabd3('0x7');}},'notificationSound':{'type':Sequelize[_0xabd3('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xabd3('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xabd3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xabd3('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xabd3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xabd3('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xabd3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xabd3('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xabd3('0x8')],'defaultValue':![],'comment':_0xabd3('0xa'),'set':function(_0xc6b50f){if(!_0xc6b50f){this[_0xabd3('0xb')]('mandatoryDispositionPauseId',null);}this[_0xabd3('0xb')](_0xabd3('0xc'),_0xc6b50f);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x29c4=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29c4,0x139));var _0x429c=function(_0x43f513,_0x55a175){_0x43f513=_0x43f513-0x0;var _0x43f18f=_0x29c4[_0x43f513];return _0x43f18f;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x429c('0x0')]={'name':{'type':Sequelize[_0x429c('0x1')],'unique':_0x429c('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x429c('0x1')],'defaultValue':function(){return rs[_0x429c('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x429c('0x4')](_0x429c('0x5'))},'accountSid':{'type':Sequelize[_0x429c('0x1')]},'authToken':{'type':Sequelize[_0x429c('0x1')]},'notificationTemplate':{'type':Sequelize[_0x429c('0x6')],'defaultValue':function(){return _0x429c('0x7');}},'notificationSound':{'type':Sequelize[_0x429c('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x429c('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x429c('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x429c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x429c('0x9')],'comment':_0x429c('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x429c('0x8')],'defaultValue':![],'comment':_0x429c('0xb'),'set':function(_0x38a84d){if(!_0x38a84d){this[_0x429c('0xc')]('mandatoryDispositionPauseId',null);}this[_0x429c('0xc')](_0x429c('0xd'),_0x38a84d);}},'description':{'type':Sequelize[_0x429c('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 4c8ceeb..a32eaab 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 _0xf411=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','WhatsappAccount','include','rows','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','order','filter','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','sequelize','transaction','WhatsappApplication','bulkCreate','getApplications','notify','whatsapp','Applications','account','applications','asc','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','whatsapp:','Body','messageId','isNil','ValidationError','from\x20is\x20mandatory','mapKey','includes','CmList','Contacts','list','WhatsappInteraction','spread','interaction','autoclose','push','created','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','send','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','DESC','List','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x532edf,_0x35080b){var _0x17b547=function(_0x448467){while(--_0x448467){_0x532edf['push'](_0x532edf['shift']());}};_0x17b547(++_0x35080b);}(_0xf411,0x1de));var _0x1f41=function(_0x39a885,_0x317185){_0x39a885=_0x39a885-0x0;var _0x5e3797=_0xf411[_0x39a885];return _0x5e3797;};'use strict';var pdf=require(_0x1f41('0x0'));var emlformat=require(_0x1f41('0x1'));var rimraf=require(_0x1f41('0x2'));var zipdir=require(_0x1f41('0x3'));var jsonpatch=require(_0x1f41('0x4'));var rp=require(_0x1f41('0x5'));var moment=require(_0x1f41('0x6'));var BPromise=require(_0x1f41('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1f41('0x8'));var sox=require(_0x1f41('0x9'));var csv=require(_0x1f41('0xa'));var ejs=require(_0x1f41('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1f41('0xc'));var crypto=require('crypto');var jsforce=require(_0x1f41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1f41('0xa'));var querystring=require('querystring');var Papa=require(_0x1f41('0xe'));var Redis=require(_0x1f41('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1f41('0x10'));var hardwareService=require(_0x1f41('0x11'));var logger=require(_0x1f41('0x12'))(_0x1f41('0x13'));var utils=require(_0x1f41('0x14'));var config=require(_0x1f41('0x15'));var licenseUtil=require(_0x1f41('0x16'));var db=require(_0x1f41('0x17'))['db'];config[_0x1f41('0x18')]=_[_0x1f41('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1f41('0x1a'))(new Redis(config['redis']));require(_0x1f41('0x1b'))[_0x1f41('0x1c')](socket);var jayson=require(_0x1f41('0x1d'));var client=jayson[_0x1f41('0x1e')][_0x1f41('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x2e053b,_0x4e38fb,_0x34d54c,_0x33a7b2){return new BPromise(function(_0x282db3,_0x472423){var _0x141810=_0x33a7b2||client;return _0x141810[_0x1f41('0x20')](_0x2e053b,_0x34d54c)[_0x1f41('0x21')](function(_0x2aab03){logger[_0x1f41('0x22')](_0x1f41('0x23'),_0x4e38fb,'request\x20sent');logger[_0x1f41('0x24')](_0x1f41('0x25'),_0x4e38fb,_0x1f41('0x26'),JSON['stringify'](_0x2aab03));if(_0x2aab03[_0x1f41('0x27')]){if(_0x2aab03[_0x1f41('0x27')][_0x1f41('0x28')]===0x1f4){logger['error'](_0x1f41('0x23'),_0x4e38fb,_0x2aab03[_0x1f41('0x27')][_0x1f41('0x29')]);return _0x472423(_0x2aab03[_0x1f41('0x27')]['message']);}logger['error'](_0x1f41('0x23'),_0x4e38fb,_0x2aab03[_0x1f41('0x27')][_0x1f41('0x29')]);return _0x282db3(_0x2aab03[_0x1f41('0x27')][_0x1f41('0x29')]);}else{logger[_0x1f41('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x4e38fb,'request\x20sent');_0x282db3(_0x2aab03[_0x1f41('0x2a')][_0x1f41('0x29')]);}})[_0x1f41('0x2b')](function(_0x25fda1){logger[_0x1f41('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x4e38fb,_0x25fda1);_0x472423(_0x25fda1);});});}function respondWithStatusCode(_0x49096b,_0x2a81d3){_0x2a81d3=_0x2a81d3||0xcc;return function(_0x3e79b9){if(_0x3e79b9){return _0x49096b[_0x1f41('0x2c')](_0x2a81d3);}return _0x49096b['status'](_0x2a81d3)[_0x1f41('0x2d')]();};}function respondWithResult(_0x377a70,_0x6e81ee){_0x6e81ee=_0x6e81ee||0xc8;return function(_0x285960){if(_0x285960){return _0x377a70[_0x1f41('0x2e')](_0x6e81ee)[_0x1f41('0x2f')](_0x285960);}};}function respondWithFilteredResult(_0x4a74ce,_0x4e9d61){return function(_0x587bdb){if(_0x587bdb){var _0x438903=_0x587bdb[_0x1f41('0x30')],_0x25ffff=_0x4e9d61[_0x1f41('0x31')],_0x11c169=_0x4e9d61[_0x1f41('0x31')]+_0x4e9d61[_0x1f41('0x32')],_0x4f3a1b;if(_0x11c169>=_0x438903){_0x11c169=_0x438903;_0x4f3a1b=0xc8;}else{_0x4f3a1b=0xce;}_0x4a74ce[_0x1f41('0x2e')](_0x4f3a1b);return _0x4a74ce[_0x1f41('0x33')](_0x1f41('0x34'),_0x25ffff+'-'+_0x11c169+'/'+_0x438903)[_0x1f41('0x2f')](_0x587bdb);}return null;};}function patchUpdates(_0x1747a3){return function(_0x3a5b3d){try{jsonpatch[_0x1f41('0x35')](_0x3a5b3d,_0x1747a3,!![]);}catch(_0x27ee5b){return BPromise[_0x1f41('0x36')](_0x27ee5b);}return _0x3a5b3d[_0x1f41('0x37')]();};}function saveUpdates(_0x489287,_0x29d315){return function(_0x4202b1){if(_0x4202b1){return _0x4202b1[_0x1f41('0x38')](_0x489287)['then'](function(_0x2e78c2){return _0x2e78c2;});}return null;};}function removeEntity(_0x273d6d,_0x21ce53){return function(_0x107a6d){if(_0x107a6d){return _0x107a6d[_0x1f41('0x39')]()[_0x1f41('0x21')](function(){var _0x21ee57=_0x107a6d[_0x1f41('0x3a')]({'plain':!![]});var _0x36a4e6=_0x1f41('0x3b');return db[_0x1f41('0x3c')]['destroy']({'where':{'type':_0x36a4e6,'resourceId':_0x21ee57['id']}})[_0x1f41('0x21')](function(){return _0x107a6d;});})[_0x1f41('0x21')](function(){_0x273d6d[_0x1f41('0x2e')](0xcc)[_0x1f41('0x2d')]();});}};}function handleEntityNotFound(_0x36c385,_0x208b6c){return function(_0x2f2bf3){if(!_0x2f2bf3){_0x36c385[_0x1f41('0x2c')](0x194);}return _0x2f2bf3;};}function handleError(_0x14c283,_0x5f3b81){_0x5f3b81=_0x5f3b81||0x1f4;return function(_0x5cafaa){logger[_0x1f41('0x27')](_0x5cafaa[_0x1f41('0x3d')]);if(_0x5cafaa[_0x1f41('0x3e')]){delete _0x5cafaa['name'];}_0x14c283[_0x1f41('0x2e')](_0x5f3b81)['send'](_0x5cafaa);};}exports[_0x1f41('0x3f')]=function(_0x139209,_0x5dc8f6){var _0x5b7b53={'include':[{'model':db[_0x1f41('0x40')],'as':_0x1f41('0x41')}]},_0x106959={},_0x2d0e85={'count':0x0,'rows':[]};var _0x1710b8=_[_0x1f41('0x42')](db['WhatsappAccount'][_0x1f41('0x43')],function(_0x53b628){return{'name':_0x53b628[_0x1f41('0x44')],'type':_0x53b628[_0x1f41('0x45')]['key']};});_0x106959[_0x1f41('0x46')]=_[_0x1f41('0x42')](_0x1710b8,'name');_0x106959[_0x1f41('0x47')]=_[_0x1f41('0x48')](_0x139209[_0x1f41('0x47')]);_0x106959[_0x1f41('0x49')]=_[_0x1f41('0x4a')](_0x106959[_0x1f41('0x46')],_0x106959[_0x1f41('0x47')]);_0x5b7b53[_0x1f41('0x4b')]=_[_0x1f41('0x4a')](_0x106959['model'],qs[_0x1f41('0x4c')](_0x139209[_0x1f41('0x47')][_0x1f41('0x4c')]));_0x5b7b53[_0x1f41('0x4b')]=_0x5b7b53[_0x1f41('0x4b')][_0x1f41('0x4d')]?_0x5b7b53[_0x1f41('0x4b')]:_0x106959[_0x1f41('0x46')];if(!_0x139209[_0x1f41('0x47')][_0x1f41('0x4e')](_0x1f41('0x4f'))){_0x5b7b53[_0x1f41('0x32')]=qs[_0x1f41('0x32')](_0x139209[_0x1f41('0x47')][_0x1f41('0x32')]);_0x5b7b53['offset']=qs[_0x1f41('0x31')](_0x139209[_0x1f41('0x47')][_0x1f41('0x31')]);}_0x5b7b53['order']=qs['sort'](_0x139209['query'][_0x1f41('0x50')]);_0x5b7b53[_0x1f41('0x51')]=qs['filters'](_[_0x1f41('0x52')](_0x139209['query'],_0x106959[_0x1f41('0x49')]),_0x1710b8);if(_0x139209[_0x1f41('0x47')]['filter']){_0x5b7b53[_0x1f41('0x51')]=_[_0x1f41('0x53')](_0x5b7b53[_0x1f41('0x51')],{'$or':_[_0x1f41('0x42')](_0x1710b8,function(_0x2a34cb){if(_0x2a34cb['type']!==_0x1f41('0x54')){var _0x31cd49={};_0x31cd49[_0x2a34cb[_0x1f41('0x3e')]]={'$like':'%'+_0x139209[_0x1f41('0x47')]['filter']+'%'};return _0x31cd49;}})});}_0x5b7b53=_['merge']({},_0x5b7b53,_0x139209[_0x1f41('0x55')]);var _0x4f9d4c={'where':_0x5b7b53[_0x1f41('0x51')]};return db[_0x1f41('0x56')][_0x1f41('0x30')](_0x4f9d4c)[_0x1f41('0x21')](function(_0xa02dfb){_0x2d0e85[_0x1f41('0x30')]=_0xa02dfb;if(_0x139209[_0x1f41('0x47')]['includeAll']){_0x5b7b53[_0x1f41('0x57')]=[{'all':!![]}];}return db[_0x1f41('0x56')]['findAll'](_0x5b7b53);})[_0x1f41('0x21')](function(_0xe2015c){_0x2d0e85[_0x1f41('0x58')]=_0xe2015c;return _0x2d0e85;})[_0x1f41('0x21')](respondWithFilteredResult(_0x5dc8f6,_0x5b7b53))[_0x1f41('0x2b')](handleError(_0x5dc8f6,null));};exports[_0x1f41('0x59')]=function(_0x321f27,_0x5f51ac){var _0x228cb9={'raw':![],'where':{'id':_0x321f27['params']['id']},'include':[{'model':db['Pause'],'as':_0x1f41('0x41')}]},_0x544c49={};_0x544c49[_0x1f41('0x46')]=_[_0x1f41('0x48')](db[_0x1f41('0x56')][_0x1f41('0x43')]);_0x544c49[_0x1f41('0x47')]=_['keys'](_0x321f27['query']);_0x544c49[_0x1f41('0x49')]=_[_0x1f41('0x4a')](_0x544c49[_0x1f41('0x46')],_0x544c49[_0x1f41('0x47')]);_0x228cb9['attributes']=_[_0x1f41('0x4a')](_0x544c49[_0x1f41('0x46')],qs[_0x1f41('0x4c')](_0x321f27['query'][_0x1f41('0x4c')]));_0x228cb9['attributes']=_0x228cb9[_0x1f41('0x4b')][_0x1f41('0x4d')]?_0x228cb9[_0x1f41('0x4b')]:_0x544c49[_0x1f41('0x46')];if(_0x321f27['query'][_0x1f41('0x5a')]){_0x228cb9['include']=[{'all':!![]}];}_0x228cb9=_[_0x1f41('0x53')]({},_0x228cb9,_0x321f27['options']);return db[_0x1f41('0x56')][_0x1f41('0x5b')](_0x228cb9)[_0x1f41('0x21')](handleEntityNotFound(_0x5f51ac,null))['then'](respondWithResult(_0x5f51ac,null))['catch'](handleError(_0x5f51ac,null));};exports[_0x1f41('0x5c')]=function(_0x13ac1d,_0x31aa67){return db['WhatsappAccount']['create'](_0x13ac1d[_0x1f41('0x5d')],{})[_0x1f41('0x21')](function(_0x5675b3){var _0x583d44=_0x13ac1d[_0x1f41('0x5e')][_0x1f41('0x3a')]({'plain':!![]});if(!_0x583d44)throw new Error(_0x1f41('0x5f'));if(_0x583d44[_0x1f41('0x60')]===_0x1f41('0x5e')){var _0x102409=_0x5675b3['get']({'plain':!![]});var _0xc83757=_0x1f41('0x3b');return db[_0x1f41('0x61')][_0x1f41('0x5b')]({'where':{'name':_0xc83757,'userProfileId':_0x583d44[_0x1f41('0x62')]},'raw':!![]})[_0x1f41('0x21')](function(_0x28b56a){if(_0x28b56a&&_0x28b56a[_0x1f41('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x102409[_0x1f41('0x3e')],'resourceId':_0x102409['id'],'type':_0x28b56a[_0x1f41('0x3e')],'sectionId':_0x28b56a['id']},{})[_0x1f41('0x21')](function(){return _0x5675b3;});}else{return _0x5675b3;}})[_0x1f41('0x2b')](function(_0x1ad365){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ad365);throw _0x1ad365;});}return _0x5675b3;})[_0x1f41('0x21')](respondWithResult(_0x31aa67,0xc9))[_0x1f41('0x2b')](handleError(_0x31aa67,null));};exports[_0x1f41('0x38')]=function(_0x35d6e0,_0x1b1f92){if(_0x35d6e0[_0x1f41('0x5d')]['id']){delete _0x35d6e0[_0x1f41('0x5d')]['id'];}return db['WhatsappAccount'][_0x1f41('0x5b')]({'where':{'id':_0x35d6e0['params']['id']},'include':[{'model':db['Pause'],'as':_0x1f41('0x41')}]})['then'](handleEntityNotFound(_0x1b1f92,null))[_0x1f41('0x21')](saveUpdates(_0x35d6e0[_0x1f41('0x5d')],null))[_0x1f41('0x21')](respondWithResult(_0x1b1f92,null))[_0x1f41('0x2b')](handleError(_0x1b1f92,null));};exports[_0x1f41('0x39')]=function(_0x2f0292,_0x56f330){return db[_0x1f41('0x56')][_0x1f41('0x5b')]({'where':{'id':_0x2f0292[_0x1f41('0x64')]['id']}})[_0x1f41('0x21')](handleEntityNotFound(_0x56f330,null))[_0x1f41('0x21')](removeEntity(_0x56f330,null))[_0x1f41('0x2b')](handleError(_0x56f330,null));};exports[_0x1f41('0x65')]=function(_0x480d15,_0x47ad4a){return db['WhatsappAccount'][_0x1f41('0x65')]()['then'](respondWithResult(_0x47ad4a,null))['catch'](handleError(_0x47ad4a,null));};exports[_0x1f41('0x66')]=function(_0x438f8f,_0x4bf774,_0x26a5e0){if(_0x438f8f[_0x1f41('0x5d')]['id']){delete _0x438f8f[_0x1f41('0x5d')]['id'];}return db['WhatsappAccount'][_0x1f41('0x5b')]({'where':{'id':_0x438f8f[_0x1f41('0x64')]['id']}})['then'](handleEntityNotFound(_0x4bf774,null))['then'](function(_0x33c7e5){if(_0x33c7e5){_0x438f8f[_0x1f41('0x5d')][_0x1f41('0x67')]=_0x33c7e5['id'];return db[_0x1f41('0x68')][_0x1f41('0x5c')](_0x438f8f['body']);}})['then'](respondWithResult(_0x4bf774,null))[_0x1f41('0x2b')](handleError(_0x4bf774,null));};exports[_0x1f41('0x69')]=function(_0x5df799,_0x26149e,_0x2873ab){var _0x19a98e={'raw':![],'where':{}};var _0x5baef7={};var _0x59373c={'count':0x0,'rows':[]};return db[_0x1f41('0x56')]['findOne']({'where':{'id':_0x5df799[_0x1f41('0x64')]['id']}})['then'](handleEntityNotFound(_0x26149e,null))[_0x1f41('0x21')](function(_0x1b9915){if(_0x1b9915){_0x5baef7[_0x1f41('0x46')]=_[_0x1f41('0x48')](db[_0x1f41('0x68')][_0x1f41('0x43')]);_0x5baef7[_0x1f41('0x47')]=_[_0x1f41('0x48')](_0x5df799[_0x1f41('0x47')]);_0x5baef7[_0x1f41('0x49')]=_[_0x1f41('0x4a')](_0x5baef7[_0x1f41('0x46')],_0x5baef7['query']);_0x19a98e[_0x1f41('0x4b')]=_[_0x1f41('0x4a')](_0x5baef7['model'],qs[_0x1f41('0x4c')](_0x5df799[_0x1f41('0x47')][_0x1f41('0x4c')]));_0x19a98e['attributes']=_0x19a98e[_0x1f41('0x4b')]['length']?_0x19a98e[_0x1f41('0x4b')]:_0x5baef7[_0x1f41('0x46')];if(!_0x5df799[_0x1f41('0x47')][_0x1f41('0x4e')](_0x1f41('0x4f'))){_0x19a98e['limit']=qs[_0x1f41('0x32')](_0x5df799[_0x1f41('0x47')][_0x1f41('0x32')]);_0x19a98e[_0x1f41('0x31')]=qs[_0x1f41('0x31')](_0x5df799[_0x1f41('0x47')]['offset']);}_0x19a98e[_0x1f41('0x6a')]=qs[_0x1f41('0x50')](_0x5df799[_0x1f41('0x47')][_0x1f41('0x50')]);_0x19a98e['where']=qs[_0x1f41('0x49')](_['pick'](_0x5df799[_0x1f41('0x47')],_0x5baef7['filters']));_0x19a98e[_0x1f41('0x51')]['WhatsappAccountId']=_0x1b9915['id'];if(_0x5df799['query']['filter']){_0x19a98e[_0x1f41('0x51')]=_[_0x1f41('0x53')](_0x19a98e[_0x1f41('0x51')],{'$or':_[_0x1f41('0x42')](_0x19a98e['attributes'],function(_0xc56862){var _0x442154={};_0x442154[_0xc56862]={'$like':'%'+_0x5df799['query'][_0x1f41('0x6b')]+'%'};return _0x442154;})});}_0x19a98e=_[_0x1f41('0x53')]({},_0x19a98e,_0x5df799[_0x1f41('0x55')]);return db[_0x1f41('0x68')][_0x1f41('0x30')]({'where':_0x19a98e[_0x1f41('0x51')]})[_0x1f41('0x21')](function(_0x711093){_0x59373c[_0x1f41('0x30')]=_0x711093;if(_0x5df799[_0x1f41('0x47')]['includeAll']){_0x19a98e[_0x1f41('0x57')]=[{'all':!![]}];}return db[_0x1f41('0x68')][_0x1f41('0x6c')](_0x19a98e);})[_0x1f41('0x21')](function(_0x1c4b6d){_0x59373c[_0x1f41('0x58')]=_0x1c4b6d;return _0x59373c;});}})['then'](respondWithFilteredResult(_0x26149e,_0x19a98e))[_0x1f41('0x2b')](handleError(_0x26149e,null));};exports[_0x1f41('0x6d')]=function(_0x25d3d2,_0x590b21,_0x264294){return db[_0x1f41('0x56')][_0x1f41('0x5b')]({'where':{'id':_0x25d3d2[_0x1f41('0x64')]['id']}})[_0x1f41('0x21')](handleEntityNotFound(_0x590b21,null))[_0x1f41('0x21')](function(_0x56b08f){if(_0x56b08f){return _0x56b08f[_0x1f41('0x6d')](_0x25d3d2[_0x1f41('0x47')][_0x1f41('0x6e')]);}})['then'](respondWithStatusCode(_0x590b21,null))[_0x1f41('0x2b')](handleError(_0x590b21,null));};exports[_0x1f41('0x6f')]=function(_0x429d5c,_0x25f407,_0x2394d7){if(_0x429d5c[_0x1f41('0x5d')]['id']){delete _0x429d5c[_0x1f41('0x5d')]['id'];}return db[_0x1f41('0x56')]['find']({'where':{'id':_0x429d5c[_0x1f41('0x64')]['id']}})['then'](handleEntityNotFound(_0x25f407,null))['then'](function(_0x2459d4){if(_0x2459d4){_0x429d5c[_0x1f41('0x5d')][_0x1f41('0x67')]=_0x2459d4['id'];return db[_0x1f41('0x70')][_0x1f41('0x5c')](_0x429d5c[_0x1f41('0x5d')]);}})[_0x1f41('0x21')](respondWithResult(_0x25f407,null))[_0x1f41('0x2b')](handleError(_0x25f407,null));};exports[_0x1f41('0x71')]=function(_0x5e70da,_0x11d304,_0x497b54){var _0x26a1a3={'raw':![],'where':{}};var _0x5baf41={};var _0x5d14c2={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x1f41('0x72')]({'where':{'id':_0x5e70da[_0x1f41('0x64')]['id']}})['then'](handleEntityNotFound(_0x11d304,null))[_0x1f41('0x21')](function(_0x12fc77){if(_0x12fc77){_0x5baf41['model']=_[_0x1f41('0x48')](db[_0x1f41('0x70')]['rawAttributes']);_0x5baf41[_0x1f41('0x47')]=_[_0x1f41('0x48')](_0x5e70da['query']);_0x5baf41[_0x1f41('0x49')]=_[_0x1f41('0x4a')](_0x5baf41[_0x1f41('0x46')],_0x5baf41[_0x1f41('0x47')]);_0x26a1a3['attributes']=_[_0x1f41('0x4a')](_0x5baf41[_0x1f41('0x46')],qs[_0x1f41('0x4c')](_0x5e70da['query'][_0x1f41('0x4c')]));_0x26a1a3['attributes']=_0x26a1a3[_0x1f41('0x4b')][_0x1f41('0x4d')]?_0x26a1a3[_0x1f41('0x4b')]:_0x5baf41['model'];if(!_0x5e70da[_0x1f41('0x47')][_0x1f41('0x4e')](_0x1f41('0x4f'))){_0x26a1a3[_0x1f41('0x32')]=qs[_0x1f41('0x32')](_0x5e70da[_0x1f41('0x47')][_0x1f41('0x32')]);_0x26a1a3[_0x1f41('0x31')]=qs[_0x1f41('0x31')](_0x5e70da[_0x1f41('0x47')][_0x1f41('0x31')]);}_0x26a1a3['order']=qs['sort'](_0x5e70da[_0x1f41('0x47')][_0x1f41('0x50')]);_0x26a1a3['where']=qs[_0x1f41('0x49')](_[_0x1f41('0x52')](_0x5e70da['query'],_0x5baf41[_0x1f41('0x49')]));_0x26a1a3[_0x1f41('0x51')][_0x1f41('0x67')]=_0x12fc77['id'];if(_0x5e70da[_0x1f41('0x47')]['filter']){_0x26a1a3[_0x1f41('0x51')]=_[_0x1f41('0x53')](_0x26a1a3['where'],{'$or':_[_0x1f41('0x42')](_0x26a1a3['attributes'],function(_0x5d8bc2){var _0x376800={};_0x376800[_0x5d8bc2]={'$like':'%'+_0x5e70da[_0x1f41('0x47')][_0x1f41('0x6b')]+'%'};return _0x376800;})});}_0x26a1a3=_[_0x1f41('0x53')]({},_0x26a1a3,_0x5e70da[_0x1f41('0x55')]);return db[_0x1f41('0x70')][_0x1f41('0x30')]({'where':_0x26a1a3[_0x1f41('0x51')]})[_0x1f41('0x21')](function(_0x4b040d){_0x5d14c2[_0x1f41('0x30')]=_0x4b040d;if(_0x5e70da[_0x1f41('0x47')][_0x1f41('0x5a')]){_0x26a1a3[_0x1f41('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1f41('0x6c')](_0x26a1a3);})[_0x1f41('0x21')](function(_0x162f75){_0x5d14c2[_0x1f41('0x58')]=_0x162f75;return _0x5d14c2;});}})[_0x1f41('0x21')](respondWithFilteredResult(_0x11d304,_0x26a1a3))[_0x1f41('0x2b')](handleError(_0x11d304,null));};exports[_0x1f41('0x73')]=function(_0x46faa3,_0x318d87,_0xb874e1){return db[_0x1f41('0x56')][_0x1f41('0x5b')]({'where':{'id':_0x46faa3['params']['id']}})[_0x1f41('0x21')](handleEntityNotFound(_0x318d87,null))['then'](function(_0x424d15){if(_0x424d15){return _0x424d15[_0x1f41('0x73')](_0x46faa3[_0x1f41('0x47')][_0x1f41('0x6e')]);}})[_0x1f41('0x21')](respondWithStatusCode(_0x318d87,null))['catch'](handleError(_0x318d87,null));};exports[_0x1f41('0x74')]=function(_0x245a16,_0x1290bb,_0x1b999f){return db[_0x1f41('0x56')]['find']({'where':{'id':_0x245a16['params']['id']}})['then'](handleEntityNotFound(_0x1290bb,null))[_0x1f41('0x21')](function(_0x11093a){if(_0x11093a){return _0x11093a[_0x1f41('0x74')](_0x245a16[_0x1f41('0x5d')][_0x1f41('0x6e')],_[_0x1f41('0x75')](_0x245a16[_0x1f41('0x5d')],['ids','id'])||{})['spread'](function(_0x1b0fb3){for(var _0x38e41b=0x0;_0x38e41b<_0x245a16['body'][_0x1f41('0x6e')]['length'];_0x38e41b+=0x1){socket[_0x1f41('0x76')](_0x1f41('0x77'),{'UserId':_0x245a16['body'][_0x1f41('0x6e')][_0x38e41b],'WhatsappAccountId':_0x245a16[_0x1f41('0x64')]['id']});}return _0x1b0fb3;});}})['then'](respondWithResult(_0x1290bb,null))[_0x1f41('0x2b')](handleError(_0x1290bb,null));};exports[_0x1f41('0x78')]=function(_0x29a138,_0x36c980,_0x2e88e5){return db[_0x1f41('0x56')][_0x1f41('0x5b')]({'where':{'id':_0x29a138[_0x1f41('0x64')]['id']}})['then'](handleEntityNotFound(_0x36c980,null))[_0x1f41('0x21')](function(_0x3faae2){if(_0x3faae2){return _0x3faae2['removeAgents'](_0x29a138[_0x1f41('0x47')][_0x1f41('0x6e')])[_0x1f41('0x21')](function(){if(_[_0x1f41('0x79')](_0x29a138[_0x1f41('0x47')][_0x1f41('0x6e')])){for(var _0x2ffbe6=0x0;_0x2ffbe6<_0x29a138[_0x1f41('0x47')][_0x1f41('0x6e')][_0x1f41('0x4d')];_0x2ffbe6+=0x1){socket[_0x1f41('0x76')](_0x1f41('0x7a'),{'UserId':Number(_0x29a138[_0x1f41('0x47')][_0x1f41('0x6e')][_0x2ffbe6]),'WhatsappAccountId':Number(_0x29a138[_0x1f41('0x64')]['id'])});}}else{socket[_0x1f41('0x76')](_0x1f41('0x7a'),{'UserId':Number(_0x29a138[_0x1f41('0x47')][_0x1f41('0x6e')]),'WhatsappAccountId':Number(_0x29a138[_0x1f41('0x64')]['id'])});}});}})[_0x1f41('0x21')](respondWithStatusCode(_0x36c980,null))['catch'](handleError(_0x36c980,null));};exports['getAgents']=function(_0x3f8cf0,_0x4362ee,_0x1e64ba){var _0x38ffa1={};var _0x38b072={};var _0x5bbcc0;var _0x1948d9;return db[_0x1f41('0x56')][_0x1f41('0x72')]({'where':{'id':_0x3f8cf0[_0x1f41('0x64')]['id']}})[_0x1f41('0x21')](handleEntityNotFound(_0x4362ee,null))[_0x1f41('0x21')](function(_0x701529){if(_0x701529){_0x5bbcc0=_0x701529;_0x38b072['model']=_[_0x1f41('0x48')](db[_0x1f41('0x7b')]['rawAttributes']);_0x38b072[_0x1f41('0x47')]=_[_0x1f41('0x48')](_0x3f8cf0['query']);_0x38b072['filters']=_['intersection'](_0x38b072['model'],_0x38b072[_0x1f41('0x47')]);_0x38ffa1[_0x1f41('0x4b')]=_[_0x1f41('0x4a')](_0x38b072[_0x1f41('0x46')],qs[_0x1f41('0x4c')](_0x3f8cf0[_0x1f41('0x47')]['fields']));_0x38ffa1[_0x1f41('0x4b')]=_0x38ffa1[_0x1f41('0x4b')][_0x1f41('0x4d')]?_0x38ffa1[_0x1f41('0x4b')]:_0x38b072[_0x1f41('0x46')];_0x38ffa1[_0x1f41('0x6a')]=qs[_0x1f41('0x50')](_0x3f8cf0['query'][_0x1f41('0x50')]);_0x38ffa1['where']=qs[_0x1f41('0x49')](_['pick'](_0x3f8cf0['query'],_0x38b072[_0x1f41('0x49')]));if(_0x3f8cf0[_0x1f41('0x47')][_0x1f41('0x6b')]){_0x38ffa1[_0x1f41('0x51')]=_[_0x1f41('0x53')](_0x38ffa1['where'],{'$or':_[_0x1f41('0x42')](_0x38ffa1[_0x1f41('0x4b')],function(_0x564371){var _0x1d94b6={};_0x1d94b6[_0x564371]={'$like':'%'+_0x3f8cf0[_0x1f41('0x47')][_0x1f41('0x6b')]+'%'};return _0x1d94b6;})});}_0x38ffa1=_[_0x1f41('0x53')]({},_0x38ffa1,_0x3f8cf0[_0x1f41('0x55')]);return _0x5bbcc0[_0x1f41('0x7c')](_0x38ffa1);}})['then'](function(_0x3b6cf6){if(_0x3b6cf6){_0x1948d9=_0x3b6cf6[_0x1f41('0x4d')];if(!_0x3f8cf0[_0x1f41('0x47')][_0x1f41('0x4e')]('nolimit')){_0x38ffa1[_0x1f41('0x32')]=qs[_0x1f41('0x32')](_0x3f8cf0[_0x1f41('0x47')]['limit']);_0x38ffa1['offset']=qs[_0x1f41('0x31')](_0x3f8cf0[_0x1f41('0x47')]['offset']);}return _0x5bbcc0[_0x1f41('0x7c')](_0x38ffa1);}})[_0x1f41('0x21')](function(_0x2a30a0){if(_0x2a30a0){return _0x2a30a0?{'count':_0x1948d9,'rows':_0x2a30a0}:null;}})[_0x1f41('0x21')](respondWithResult(_0x4362ee,null))[_0x1f41('0x2b')](handleError(_0x4362ee,null));};exports['addApplications']=function(_0x10432a,_0x13f474,_0x3384b1){return db[_0x1f41('0x56')][_0x1f41('0x72')]({'where':{'id':_0x10432a['params']['id']}})[_0x1f41('0x21')](handleEntityNotFound(_0x13f474,null))[_0x1f41('0x21')](function(_0x3057ec){if(_0x3057ec){return db[_0x1f41('0x7d')][_0x1f41('0x7e')](function(_0x2add54){return db[_0x1f41('0x7f')][_0x1f41('0x39')]({'where':{'WhatsappAccountId':_0x10432a['params']['id']},'transaction':_0x2add54})['then'](function(_0xce4acb){var _0x5396ee=_['map'](_0x10432a[_0x1f41('0x5d')],function(_0xcd075){_0xcd075[_0x1f41('0x67')]=_0x10432a[_0x1f41('0x64')]['id'];return _0xcd075;});return db['WhatsappApplication'][_0x1f41('0x80')](_0x5396ee,{'transaction':_0x2add54});});})['then'](function(){return db[_0x1f41('0x7f')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x10432a[_0x1f41('0x64')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x13f474,null))[_0x1f41('0x2b')](handleError(_0x13f474,null));};exports[_0x1f41('0x81')]=function(_0x4f3f1e,_0x4f4c1f,_0x113d03){var _0x20db83={};var _0x2b50fd={};var _0x4e22a7;var _0x47af86;return db[_0x1f41('0x56')]['findOne']({'where':{'id':_0x4f3f1e[_0x1f41('0x64')]['id']}})[_0x1f41('0x21')](handleEntityNotFound(_0x4f4c1f,null))[_0x1f41('0x21')](function(_0x2ad470){if(_0x2ad470){_0x4e22a7=_0x2ad470;_0x2b50fd['model']=_[_0x1f41('0x48')](db[_0x1f41('0x7f')]['rawAttributes']);_0x2b50fd[_0x1f41('0x47')]=_[_0x1f41('0x48')](_0x4f3f1e['query']);_0x2b50fd[_0x1f41('0x49')]=_[_0x1f41('0x4a')](_0x2b50fd['model'],_0x2b50fd['query']);_0x20db83['attributes']=_[_0x1f41('0x4a')](_0x2b50fd[_0x1f41('0x46')],qs['fields'](_0x4f3f1e[_0x1f41('0x47')][_0x1f41('0x4c')]));_0x20db83['attributes']=_0x20db83[_0x1f41('0x4b')]['length']?_0x20db83[_0x1f41('0x4b')]:_0x2b50fd[_0x1f41('0x46')];_0x20db83['order']=qs[_0x1f41('0x50')](_0x4f3f1e['query'][_0x1f41('0x50')]);_0x20db83[_0x1f41('0x51')]=qs[_0x1f41('0x49')](_[_0x1f41('0x52')](_0x4f3f1e[_0x1f41('0x47')],_0x2b50fd[_0x1f41('0x49')]));if(_0x4f3f1e['query'][_0x1f41('0x6b')]){_0x20db83[_0x1f41('0x51')]=_['merge'](_0x20db83[_0x1f41('0x51')],{'$or':_['map'](_0x20db83[_0x1f41('0x4b')],function(_0x5bf886){var _0x3009c9={};_0x3009c9[_0x5bf886]={'$like':'%'+_0x4f3f1e[_0x1f41('0x47')]['filter']+'%'};return _0x3009c9;})});}_0x20db83=_[_0x1f41('0x53')]({},_0x20db83,_0x4f3f1e[_0x1f41('0x55')]);return _0x4e22a7['getApplications'](_0x20db83);}})[_0x1f41('0x21')](function(_0x7a3b81){if(_0x7a3b81){_0x47af86=_0x7a3b81[_0x1f41('0x4d')];if(!_0x4f3f1e['query'][_0x1f41('0x4e')](_0x1f41('0x4f'))){_0x20db83[_0x1f41('0x32')]=qs['limit'](_0x4f3f1e[_0x1f41('0x47')][_0x1f41('0x32')]);_0x20db83['offset']=qs['offset'](_0x4f3f1e[_0x1f41('0x47')][_0x1f41('0x31')]);}return _0x4e22a7[_0x1f41('0x81')](_0x20db83);}})[_0x1f41('0x21')](function(_0x1afc30){if(_0x1afc30){return _0x1afc30?{'count':_0x47af86,'rows':_0x1afc30}:null;}})['then'](respondWithResult(_0x4f4c1f,null))[_0x1f41('0x2b')](handleError(_0x4f4c1f,null));};exports[_0x1f41('0x82')]=function(_0x2de5e7,_0x1ac504,_0x490dcc){var _0x26cd0b={'channel':_0x1f41('0x83')};var _0x3e5043=[];var _0x3d45f9=[];var _0x5449c7={};return db[_0x1f41('0x56')][_0x1f41('0x5b')]({'where':{'id':_0x2de5e7[_0x1f41('0x64')]['id']},'include':[{'model':db[_0x1f41('0x7f')],'as':_0x1f41('0x84')}]})[_0x1f41('0x21')](handleEntityNotFound(_0x1ac504,null))['then'](function(_0x32250d){_0x26cd0b[_0x1f41('0x85')]=_0x32250d;_0x26cd0b[_0x1f41('0x86')]=_['orderBy'](_0x32250d[_0x1f41('0x84')],['priority'],[_0x1f41('0x87')]);if(_0x26cd0b[_0x1f41('0x85')]['Applications']){delete _0x26cd0b[_0x1f41('0x85')][_0x1f41('0x84')];}return db[_0x1f41('0x88')][_0x1f41('0x65')]();})[_0x1f41('0x21')](function(_0x5e73e6){if(!_0x5e73e6){throw new db[(_0x1f41('0x89'))]['ValidationError']('no\x20available\x20attributes');}_0x3e5043=_[_0x1f41('0x8a')](_['keys'](_0x5e73e6),[_0x1f41('0x8b'),'updatedAt']);_0x3d45f9=_['difference'](_['keys'](_0x5e73e6),[_0x1f41('0x8b'),_0x1f41('0x8c'),_0x1f41('0x8d'),_0x1f41('0x8e')]);_0x26cd0b[_0x1f41('0x5d')]={'mapKey':'mobile'};if(_0x26cd0b[_0x1f41('0x85')][_0x1f41('0x45')]&&_0x26cd0b['account'][_0x1f41('0x45')]===_0x1f41('0x8f')){_0x26cd0b['body'][_0x1f41('0x90')]=_0x2de5e7[_0x1f41('0x5d')]['From']['replace'](_0x1f41('0x91'),'');_0x26cd0b['body'][_0x1f41('0x5d')]=_0x2de5e7[_0x1f41('0x5d')][_0x1f41('0x92')];_0x26cd0b['body'][_0x1f41('0x93')]=_0x2de5e7[_0x1f41('0x5d')]['MessageSid'];}if(_0x26cd0b[_0x1f41('0x5d')]['id']){delete _0x26cd0b[_0x1f41('0x5d')]['id'];}if(_[_0x1f41('0x94')](_0x26cd0b[_0x1f41('0x5d')][_0x1f41('0x90')])){throw new db[(_0x1f41('0x89'))][(_0x1f41('0x95'))](_0x1f41('0x96'));}if(_[_0x1f41('0x94')](_0x26cd0b[_0x1f41('0x5d')]['body'])||_0x26cd0b[_0x1f41('0x5d')]['body']===''){throw new db['Sequelize'][(_0x1f41('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1f41('0x94')](_0x26cd0b[_0x1f41('0x5d')][_0x1f41('0x97')])){throw new db[(_0x1f41('0x89'))][(_0x1f41('0x95'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d45f9);}if(!_[_0x1f41('0x98')](_0x3d45f9,_0x26cd0b[_0x1f41('0x5d')][_0x1f41('0x97')])){throw new db[(_0x1f41('0x89'))][(_0x1f41('0x95'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d45f9);}_0x5449c7[_0x26cd0b[_0x1f41('0x5d')][_0x1f41('0x97')]]=_0x26cd0b[_0x1f41('0x5d')][_0x1f41('0x90')];return db[_0x1f41('0x99')]['find']({'where':{'id':_0x26cd0b[_0x1f41('0x85')]['ListId']},'include':[{'model':db[_0x1f41('0x88')],'as':_0x1f41('0x9a'),'where':_0x5449c7,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x1f41('0x21')](handleEntityNotFound(_0x1ac504,null))[_0x1f41('0x21')](function(_0x9e1966){if(_0x9e1966){_0x26cd0b[_0x1f41('0x9b')]=_[_0x1f41('0x75')](_0x9e1966,[_0x1f41('0x9a')]);if(_0x9e1966['Contacts'][_0x1f41('0x4d')]){return _0x9e1966[_0x1f41('0x9a')][0x0];}var _0x38bfa0=_[_0x1f41('0x19')](_0x26cd0b['body'],{'firstName':_0x26cd0b['body'][_0x1f41('0x90')],'ListId':_0x9e1966['id']});_0x38bfa0[_0x26cd0b[_0x1f41('0x5d')][_0x1f41('0x97')]]=_0x26cd0b[_0x1f41('0x5d')][_0x1f41('0x90')];return db[_0x1f41('0x88')][_0x1f41('0x5c')](_0x38bfa0,{'fields':_0x3e5043,'raw':!![]});}})['then'](handleEntityNotFound(_0x1ac504,null))[_0x1f41('0x21')](function(_0x438f9a){if(_0x438f9a){_0x26cd0b['contact']=_0x438f9a;var _0x26d78e={'ContactId':_0x438f9a['id'],'phone':_0x26cd0b[_0x1f41('0x5d')][_0x1f41('0x90')],'WhatsappAccountId':_0x2de5e7[_0x1f41('0x64')]['id']};var _0x28819d={'ContactId':_0x438f9a['id'],'WhatsappAccountId':_0x2de5e7['params']['id'],'closed':![]};return db[_0x1f41('0x9c')][_0x1f41('0x5b')]({'where':_0x28819d})[_0x1f41('0x21')](function(_0x2be0d0){if(_0x2be0d0){return[_0x2be0d0,![]];}return db['WhatsappInteraction'][_0x1f41('0x5c')](_0x26d78e)[_0x1f41('0x21')](function(_0x2329d1){return[_0x2329d1,!![]];});});}})[_0x1f41('0x9d')](function(_0x382904,_0x1d3e85){_0x26cd0b[_0x1f41('0x9e')]=_0x382904['get']({'plain':!![]});_0x26cd0b[_0x1f41('0x9e')]['created']=![];if(_0x1d3e85){if(_0x26cd0b[_0x1f41('0x85')][_0x1f41('0x9f')]){_0x26cd0b[_0x1f41('0x86')][_0x1f41('0xa0')]({'id':0x0,'priority':_0x26cd0b[_0x1f41('0x86')][_0x1f41('0x4d')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x26cd0b[_0x1f41('0x9e')][_0x1f41('0xa1')]=!![];}return db[_0x1f41('0xa2')][_0x1f41('0x5c')]({'phone':_0x26cd0b['body'][_0x1f41('0x90')],'messageId':_0x26cd0b[_0x1f41('0x5d')][_0x1f41('0x93')],'body':_0x26cd0b[_0x1f41('0x5d')][_0x1f41('0x5d')],'WhatsappAccountId':_0x2de5e7[_0x1f41('0x64')]['id'],'WhatsappInteractionId':_0x382904['id'],'direction':'in','ContactId':_0x382904[_0x1f41('0xa3')],'AttachmentId':_0x26cd0b[_0x1f41('0x5d')][_0x1f41('0xa4')]});})[_0x1f41('0x21')](function(_0x3e2167){_0x26cd0b['message']=_0x3e2167;if(_0x26cd0b[_0x1f41('0x9e')][_0x1f41('0xa5')]){return db[_0x1f41('0x7b')][_0x1f41('0x5b')]({'attributes':['id',_0x1f41('0x3e')],'where':{'id':_0x26cd0b[_0x1f41('0x9e')][_0x1f41('0xa5')]}})[_0x1f41('0x21')](function(_0x513c38){if(_0x513c38){_0x26cd0b[_0x1f41('0x86')][_0x1f41('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x513c38[_0x1f41('0x3e')]+','+(_0x26cd0b[_0x1f41('0x85')][_0x1f41('0xa7')]||0xa),'interval':_0x1f41('0xa8')});}return respondWithRpcPromise(_0x1f41('0xa9'),_0x1f41('0xaa'),_0x26cd0b);});}return respondWithRpcPromise(_0x1f41('0xa9'),_0x1f41('0xaa'),_0x26cd0b);})['then'](function(_0x2dc1d1){if(_0x2dc1d1){var _0x2ebf79=0xc8;var _0x440bad=_0x1f41('0xab');logger[_0x1f41('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x440bad,_0x2ebf79,_0x1f41('0xac'));logger[_0x1f41('0x24')](_0x1f41('0xad'),_0x440bad,_0x2ebf79,_0x1f41('0xac'),JSON[_0x1f41('0xae')](_0x2dc1d1));if(_0x26cd0b['account'][_0x1f41('0x45')]===_0x1f41('0x8f')){return _0x1ac504[_0x1f41('0x2e')](_0x2ebf79)[_0x1f41('0x33')](_0x1f41('0xaf'),'text/xml')[_0x1f41('0xb0')]('\x0a');}else{return _0x1ac504[_0x1f41('0x2e')](_0x2ebf79)['json'](_0x2dc1d1);}}})[_0x1f41('0x2b')](handleError(_0x1ac504,null));};exports[_0x1f41('0xb0')]=function(_0x2d78cf,_0x3f3ed9,_0x54779d){var _0x4b90e0,_0x32c9ec,_0x164b56;if(_[_0x1f41('0x94')](_0x2d78cf[_0x1f41('0x5d')]['body'])||_0x2d78cf['body'][_0x1f41('0x5d')]===''){throw new db[(_0x1f41('0x89'))][(_0x1f41('0x95'))](_0x1f41('0xb1'));}if(_[_0x1f41('0x94')](_0x2d78cf[_0x1f41('0x5d')]['to'])){throw new db[(_0x1f41('0x89'))][(_0x1f41('0x95'))](_0x1f41('0xb2'));}_0x4b90e0=_0x2d78cf['body']['to'];return db[_0x1f41('0x56')][_0x1f41('0x5b')]({'where':{'id':_0x2d78cf[_0x1f41('0x64')]['id']},'include':[{'model':db[_0x1f41('0x99')],'as':'List','include':[{'model':db['CmContact'],'as':_0x1f41('0x9a'),'where':{'mobile':_0x4b90e0},'limit':0x1,'order':[[_0x1f41('0x8c'),_0x1f41('0xb3')]]}]}]})[_0x1f41('0x21')](handleEntityNotFound(_0x3f3ed9,null))[_0x1f41('0x21')](function(_0x41eb82){if(_0x41eb82&&_0x41eb82['List']){_0x32c9ec=_0x41eb82['get']({'plain':!![]});if(_0x32c9ec['List']&&_0x32c9ec[_0x1f41('0xb4')][_0x1f41('0x9a')][_0x1f41('0x4d')]){return _0x32c9ec[_0x1f41('0xb4')]['Contacts'][0x0];}return db['CmContact'][_0x1f41('0x5c')](_[_0x1f41('0x19')](_0x2d78cf['body'],{'firstName':_0x4b90e0,'mobile':_0x4b90e0,'phone':_0x4b90e0,'ListId':_0x32c9ec['ListId']}));}})[_0x1f41('0x21')](handleEntityNotFound(_0x3f3ed9,null))['then'](function(_0x2be4fa){if(_0x2be4fa){_0x164b56=_0x2be4fa;return db[_0x1f41('0x9c')][_0x1f41('0x5b')]({'where':{'ContactId':_0x164b56['id'],'closed':![],'WhatsappAccountId':_0x32c9ec['id']}})['then'](function(_0x39866f){if(_0x39866f){return[_0x39866f,![]];}return db['WhatsappInteraction'][_0x1f41('0x5c')]({'UserId':_0x2d78cf[_0x1f41('0x5e')]['id'],'ContactId':_0x164b56['id'],'WhatsappAccountId':_0x32c9ec['id'],'phone':_0x4b90e0,'firstMsgDirection':_0x1f41('0xb5'),'Messages':[_[_0x1f41('0x53')](_0x2d78cf['body'],{'read':![],'body':_0x2d78cf['body'][_0x1f41('0x5d')],'phone':_0x4b90e0,'WhatsappAccountId':_0x32c9ec['id'],'UserId':_0x2d78cf['user']['id'],'ContactId':_0x164b56['id']})]},{'include':[{'model':db[_0x1f41('0xa2')],'as':_0x1f41('0xb6')}]})[_0x1f41('0x21')](function(_0x1b3291){return[_0x1b3291,!![]];});});}})['spread'](function(_0x568979,_0x410371){if(_0x410371){return _0x568979;}return db[_0x1f41('0xa2')]['create'](_[_0x1f41('0x53')](_0x2d78cf[_0x1f41('0x5d')],{'read':![],'body':_0x2d78cf[_0x1f41('0x5d')][_0x1f41('0x5d')],'phone':_0x4b90e0,'WhatsappAccountId':_0x32c9ec['id'],'WhatsappInteractionId':_0x568979['id'],'UserId':_0x2d78cf[_0x1f41('0x5e')]['id'],'ContactId':_0x164b56['id']}))[_0x1f41('0x21')](function(_0x4ef56f){_0x568979[_0x1f41('0xb7')][_0x1f41('0xb6')]=[];_0x568979[_0x1f41('0xb7')]['Messages'][_0x1f41('0xa0')](_0x4ef56f['dataValues']);return _0x568979;});})[_0x1f41('0x21')](respondWithResult(_0x3f3ed9,null))['catch'](handleError(_0x3f3ed9,null));}; \ No newline at end of file +var _0xaab3=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','then','stack','name','send','index','WhatsappAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','map','options','count','includeAll','include','findAll','params','Pause','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','mandatoryDispositionPause','describe','addDisposition','WhatsappAccountId','Disposition','findOne','hasOwnProperty','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','WhatsappApplication','bulkCreate','getApplications','whatsapp','Applications','account','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','Contacts','DESC','list','WhatsappInteraction','created','applications','push','close','unmanaged','*,*,*,*','interaction','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','isNil','List','out','Messages','dataValues','html-pdf','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x4d9f8d,_0x5db597){var _0xa5d415=function(_0x2ea732){while(--_0x2ea732){_0x4d9f8d['push'](_0x4d9f8d['shift']());}};_0xa5d415(++_0x5db597);}(_0xaab3,0xb1));var _0x3aab=function(_0x14d87d,_0x1a28cb){_0x14d87d=_0x14d87d-0x0;var _0xc8f208=_0xaab3[_0x14d87d];return _0xc8f208;};'use strict';var pdf=require(_0x3aab('0x0'));var emlformat=require(_0x3aab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3aab('0x2'));var jsonpatch=require(_0x3aab('0x3'));var rp=require('request-promise');var moment=require(_0x3aab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3aab('0x5'));var util=require(_0x3aab('0x6'));var path=require(_0x3aab('0x7'));var sox=require(_0x3aab('0x8'));var csv=require(_0x3aab('0x9'));var ejs=require(_0x3aab('0xa'));var fs=require('fs');var _=require(_0x3aab('0xb'));var squel=require(_0x3aab('0xc'));var crypto=require(_0x3aab('0xd'));var jsforce=require(_0x3aab('0xe'));var deskjs=require(_0x3aab('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3aab('0x10'));var Papa=require(_0x3aab('0x11'));var Redis=require(_0x3aab('0x12'));var authService=require(_0x3aab('0x13'));var qs=require(_0x3aab('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3aab('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x3aab('0x16'));var config=require(_0x3aab('0x17'));var licenseUtil=require(_0x3aab('0x18'));var db=require('../../mysqldb')['db'];config[_0x3aab('0x19')]=_[_0x3aab('0x1a')](config['redis'],{'host':_0x3aab('0x1b'),'port':0x18eb});var socket=require(_0x3aab('0x1c'))(new Redis(config[_0x3aab('0x19')]));require(_0x3aab('0x1d'))['register'](socket);var jayson=require(_0x3aab('0x1e'));var client=jayson[_0x3aab('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2f5743,_0x5c67bc,_0x319e99,_0xc81b2c){return new BPromise(function(_0x2d8819,_0x5cb62f){var _0x247512=_0xc81b2c||client;return _0x247512[_0x3aab('0x20')](_0x2f5743,_0x319e99)['then'](function(_0x4b2975){logger[_0x3aab('0x21')](_0x3aab('0x22'),_0x5c67bc,_0x3aab('0x23'));logger[_0x3aab('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5c67bc,'request\x20sent',JSON[_0x3aab('0x25')](_0x4b2975));if(_0x4b2975[_0x3aab('0x26')]){if(_0x4b2975['error'][_0x3aab('0x27')]===0x1f4){logger[_0x3aab('0x26')](_0x3aab('0x22'),_0x5c67bc,_0x4b2975[_0x3aab('0x26')][_0x3aab('0x28')]);return _0x5cb62f(_0x4b2975['error']['message']);}logger[_0x3aab('0x26')](_0x3aab('0x22'),_0x5c67bc,_0x4b2975['error'][_0x3aab('0x28')]);return _0x2d8819(_0x4b2975[_0x3aab('0x26')][_0x3aab('0x28')]);}else{logger[_0x3aab('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x5c67bc,_0x3aab('0x23'));_0x2d8819(_0x4b2975[_0x3aab('0x29')]['message']);}})[_0x3aab('0x2a')](function(_0x3261b1){logger[_0x3aab('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x5c67bc,_0x3261b1);_0x5cb62f(_0x3261b1);});});}function respondWithStatusCode(_0x33f72c,_0x275c5d){_0x275c5d=_0x275c5d||0xcc;return function(_0x407da3){if(_0x407da3){return _0x33f72c[_0x3aab('0x2b')](_0x275c5d);}return _0x33f72c[_0x3aab('0x2c')](_0x275c5d)[_0x3aab('0x2d')]();};}function respondWithResult(_0x10af13,_0x324e40){_0x324e40=_0x324e40||0xc8;return function(_0x16e864){if(_0x16e864){return _0x10af13['status'](_0x324e40)[_0x3aab('0x2e')](_0x16e864);}};}function respondWithFilteredResult(_0x19929a,_0x380808){return function(_0x5ea442){if(_0x5ea442){var _0x16773d=_0x5ea442['count'],_0x49be21=_0x380808[_0x3aab('0x2f')],_0xcd11f9=_0x380808[_0x3aab('0x2f')]+_0x380808[_0x3aab('0x30')],_0x53fbe9;if(_0xcd11f9>=_0x16773d){_0xcd11f9=_0x16773d;_0x53fbe9=0xc8;}else{_0x53fbe9=0xce;}_0x19929a[_0x3aab('0x2c')](_0x53fbe9);return _0x19929a['set']('Content-Range',_0x49be21+'-'+_0xcd11f9+'/'+_0x16773d)[_0x3aab('0x2e')](_0x5ea442);}return null;};}function patchUpdates(_0x306269){return function(_0x496678){try{jsonpatch[_0x3aab('0x31')](_0x496678,_0x306269,!![]);}catch(_0x2e2637){return BPromise[_0x3aab('0x32')](_0x2e2637);}return _0x496678[_0x3aab('0x33')]();};}function saveUpdates(_0x3acb36,_0x4c61f9){return function(_0x18693b){if(_0x18693b){return _0x18693b[_0x3aab('0x34')](_0x3acb36)['then'](function(_0x33acce){return _0x33acce;});}return null;};}function removeEntity(_0xe1d7d3,_0x98bd66){return function(_0x28de2a){if(_0x28de2a){return _0x28de2a[_0x3aab('0x35')]()['then'](function(){var _0x5a553b=_0x28de2a[_0x3aab('0x36')]({'plain':!![]});var _0x4d8a43=_0x3aab('0x37');return db[_0x3aab('0x38')][_0x3aab('0x35')]({'where':{'type':_0x4d8a43,'resourceId':_0x5a553b['id']}})[_0x3aab('0x39')](function(){return _0x28de2a;});})[_0x3aab('0x39')](function(){_0xe1d7d3['status'](0xcc)[_0x3aab('0x2d')]();});}};}function handleEntityNotFound(_0x585974,_0x479029){return function(_0xf70f8b){if(!_0xf70f8b){_0x585974[_0x3aab('0x2b')](0x194);}return _0xf70f8b;};}function handleError(_0x3d8240,_0x415fc7){_0x415fc7=_0x415fc7||0x1f4;return function(_0x33ca88){logger[_0x3aab('0x26')](_0x33ca88[_0x3aab('0x3a')]);if(_0x33ca88[_0x3aab('0x3b')]){delete _0x33ca88[_0x3aab('0x3b')];}_0x3d8240[_0x3aab('0x2c')](_0x415fc7)[_0x3aab('0x3c')](_0x33ca88);};}exports[_0x3aab('0x3d')]=function(_0x3f3a40,_0x4b2c7){var _0x55da12={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x19fb1d={},_0x2bb657={'count':0x0,'rows':[]};var _0x4d8bdf=_['map'](db[_0x3aab('0x3e')][_0x3aab('0x3f')],function(_0x4e54d6){return{'name':_0x4e54d6[_0x3aab('0x40')],'type':_0x4e54d6[_0x3aab('0x41')]['key']};});_0x19fb1d[_0x3aab('0x42')]=_['map'](_0x4d8bdf,_0x3aab('0x3b'));_0x19fb1d[_0x3aab('0x43')]=_[_0x3aab('0x44')](_0x3f3a40[_0x3aab('0x43')]);_0x19fb1d[_0x3aab('0x45')]=_['intersection'](_0x19fb1d[_0x3aab('0x42')],_0x19fb1d[_0x3aab('0x43')]);_0x55da12['attributes']=_[_0x3aab('0x46')](_0x19fb1d[_0x3aab('0x42')],qs['fields'](_0x3f3a40[_0x3aab('0x43')]['fields']));_0x55da12[_0x3aab('0x47')]=_0x55da12[_0x3aab('0x47')][_0x3aab('0x48')]?_0x55da12['attributes']:_0x19fb1d[_0x3aab('0x42')];if(!_0x3f3a40[_0x3aab('0x43')]['hasOwnProperty'](_0x3aab('0x49'))){_0x55da12['limit']=qs[_0x3aab('0x30')](_0x3f3a40['query'][_0x3aab('0x30')]);_0x55da12[_0x3aab('0x2f')]=qs[_0x3aab('0x2f')](_0x3f3a40[_0x3aab('0x43')][_0x3aab('0x2f')]);}_0x55da12[_0x3aab('0x4a')]=qs[_0x3aab('0x4b')](_0x3f3a40[_0x3aab('0x43')][_0x3aab('0x4b')]);_0x55da12[_0x3aab('0x4c')]=qs['filters'](_['pick'](_0x3f3a40[_0x3aab('0x43')],_0x19fb1d[_0x3aab('0x45')]),_0x4d8bdf);if(_0x3f3a40[_0x3aab('0x43')][_0x3aab('0x4d')]){_0x55da12[_0x3aab('0x4c')]=_[_0x3aab('0x4e')](_0x55da12['where'],{'$or':_[_0x3aab('0x4f')](_0x4d8bdf,function(_0x36d141){if(_0x36d141[_0x3aab('0x41')]!=='VIRTUAL'){var _0x22acfd={};_0x22acfd[_0x36d141[_0x3aab('0x3b')]]={'$like':'%'+_0x3f3a40[_0x3aab('0x43')]['filter']+'%'};return _0x22acfd;}})});}_0x55da12=_[_0x3aab('0x4e')]({},_0x55da12,_0x3f3a40[_0x3aab('0x50')]);var _0x356c4b={'where':_0x55da12['where']};return db[_0x3aab('0x3e')][_0x3aab('0x51')](_0x356c4b)[_0x3aab('0x39')](function(_0x40903e){_0x2bb657[_0x3aab('0x51')]=_0x40903e;if(_0x3f3a40[_0x3aab('0x43')][_0x3aab('0x52')]){_0x55da12[_0x3aab('0x53')]=[{'all':!![]}];}return db[_0x3aab('0x3e')][_0x3aab('0x54')](_0x55da12);})[_0x3aab('0x39')](function(_0x845ac2){_0x2bb657['rows']=_0x845ac2;return _0x2bb657;})['then'](respondWithFilteredResult(_0x4b2c7,_0x55da12))['catch'](handleError(_0x4b2c7,null));};exports['show']=function(_0x4a7b36,_0x6188a2){var _0x21aa95={'raw':![],'where':{'id':_0x4a7b36[_0x3aab('0x55')]['id']},'include':[{'model':db[_0x3aab('0x56')],'as':'mandatoryDispositionPause'}]},_0x465eb4={};_0x465eb4[_0x3aab('0x42')]=_[_0x3aab('0x44')](db[_0x3aab('0x3e')][_0x3aab('0x3f')]);_0x465eb4[_0x3aab('0x43')]=_[_0x3aab('0x44')](_0x4a7b36[_0x3aab('0x43')]);_0x465eb4['filters']=_['intersection'](_0x465eb4[_0x3aab('0x42')],_0x465eb4[_0x3aab('0x43')]);_0x21aa95['attributes']=_[_0x3aab('0x46')](_0x465eb4['model'],qs[_0x3aab('0x57')](_0x4a7b36[_0x3aab('0x43')]['fields']));_0x21aa95['attributes']=_0x21aa95[_0x3aab('0x47')][_0x3aab('0x48')]?_0x21aa95[_0x3aab('0x47')]:_0x465eb4[_0x3aab('0x42')];if(_0x4a7b36[_0x3aab('0x43')][_0x3aab('0x52')]){_0x21aa95[_0x3aab('0x53')]=[{'all':!![]}];}_0x21aa95=_[_0x3aab('0x4e')]({},_0x21aa95,_0x4a7b36['options']);return db[_0x3aab('0x3e')][_0x3aab('0x58')](_0x21aa95)[_0x3aab('0x39')](handleEntityNotFound(_0x6188a2,null))['then'](respondWithResult(_0x6188a2,null))[_0x3aab('0x2a')](handleError(_0x6188a2,null));};exports[_0x3aab('0x59')]=function(_0x4c571c,_0x43c523){return db['WhatsappAccount'][_0x3aab('0x59')](_0x4c571c['body'],{})[_0x3aab('0x39')](function(_0x1291d4){var _0x4b5d1c=_0x4c571c[_0x3aab('0x5a')][_0x3aab('0x36')]({'plain':!![]});if(!_0x4b5d1c)throw new Error(_0x3aab('0x5b'));if(_0x4b5d1c['role']==='user'){var _0x34cbb0=_0x1291d4['get']({'plain':!![]});var _0x5dce5b=_0x3aab('0x37');return db[_0x3aab('0x5c')]['find']({'where':{'name':_0x5dce5b,'userProfileId':_0x4b5d1c[_0x3aab('0x5d')]},'raw':!![]})[_0x3aab('0x39')](function(_0x5b10df){if(_0x5b10df&&_0x5b10df[_0x3aab('0x5e')]===0x0){return db[_0x3aab('0x38')]['create']({'name':_0x34cbb0['name'],'resourceId':_0x34cbb0['id'],'type':_0x5b10df[_0x3aab('0x3b')],'sectionId':_0x5b10df['id']},{})['then'](function(){return _0x1291d4;});}else{return _0x1291d4;}})[_0x3aab('0x2a')](function(_0x2e9734){logger['error'](_0x3aab('0x5f'),_0x2e9734);throw _0x2e9734;});}return _0x1291d4;})[_0x3aab('0x39')](respondWithResult(_0x43c523,0xc9))[_0x3aab('0x2a')](handleError(_0x43c523,null));};exports[_0x3aab('0x34')]=function(_0xcfdd08,_0x1ecc9b){if(_0xcfdd08[_0x3aab('0x60')]['id']){delete _0xcfdd08[_0x3aab('0x60')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0xcfdd08['params']['id']},'include':[{'model':db[_0x3aab('0x56')],'as':_0x3aab('0x61')}]})[_0x3aab('0x39')](handleEntityNotFound(_0x1ecc9b,null))[_0x3aab('0x39')](saveUpdates(_0xcfdd08[_0x3aab('0x60')],null))[_0x3aab('0x39')](respondWithResult(_0x1ecc9b,null))[_0x3aab('0x2a')](handleError(_0x1ecc9b,null));};exports['destroy']=function(_0x3f76ba,_0x501e91){return db[_0x3aab('0x3e')][_0x3aab('0x58')]({'where':{'id':_0x3f76ba[_0x3aab('0x55')]['id']}})[_0x3aab('0x39')](handleEntityNotFound(_0x501e91,null))['then'](removeEntity(_0x501e91,null))['catch'](handleError(_0x501e91,null));};exports[_0x3aab('0x62')]=function(_0x4e26d5,_0x34324c){return db['WhatsappAccount'][_0x3aab('0x62')]()['then'](respondWithResult(_0x34324c,null))[_0x3aab('0x2a')](handleError(_0x34324c,null));};exports[_0x3aab('0x63')]=function(_0x4fa215,_0x127ff5,_0x287a6c){if(_0x4fa215[_0x3aab('0x60')]['id']){delete _0x4fa215[_0x3aab('0x60')]['id'];}return db[_0x3aab('0x3e')]['find']({'where':{'id':_0x4fa215[_0x3aab('0x55')]['id']}})['then'](handleEntityNotFound(_0x127ff5,null))[_0x3aab('0x39')](function(_0x4fac47){if(_0x4fac47){_0x4fa215[_0x3aab('0x60')][_0x3aab('0x64')]=_0x4fac47['id'];return db[_0x3aab('0x65')]['create'](_0x4fa215[_0x3aab('0x60')]);}})[_0x3aab('0x39')](respondWithResult(_0x127ff5,null))['catch'](handleError(_0x127ff5,null));};exports['getDispositions']=function(_0x14ad7d,_0x5ab87e,_0x50d745){var _0x64161={'raw':![],'where':{}};var _0x241388={};var _0x4ba742={'count':0x0,'rows':[]};return db[_0x3aab('0x3e')][_0x3aab('0x66')]({'where':{'id':_0x14ad7d[_0x3aab('0x55')]['id']}})['then'](handleEntityNotFound(_0x5ab87e,null))[_0x3aab('0x39')](function(_0x53a0fe){if(_0x53a0fe){_0x241388[_0x3aab('0x42')]=_['keys'](db[_0x3aab('0x65')][_0x3aab('0x3f')]);_0x241388[_0x3aab('0x43')]=_[_0x3aab('0x44')](_0x14ad7d[_0x3aab('0x43')]);_0x241388[_0x3aab('0x45')]=_[_0x3aab('0x46')](_0x241388[_0x3aab('0x42')],_0x241388['query']);_0x64161[_0x3aab('0x47')]=_['intersection'](_0x241388[_0x3aab('0x42')],qs[_0x3aab('0x57')](_0x14ad7d[_0x3aab('0x43')][_0x3aab('0x57')]));_0x64161[_0x3aab('0x47')]=_0x64161[_0x3aab('0x47')]['length']?_0x64161['attributes']:_0x241388[_0x3aab('0x42')];if(!_0x14ad7d['query'][_0x3aab('0x67')]('nolimit')){_0x64161[_0x3aab('0x30')]=qs['limit'](_0x14ad7d['query'][_0x3aab('0x30')]);_0x64161[_0x3aab('0x2f')]=qs['offset'](_0x14ad7d['query']['offset']);}_0x64161['order']=qs[_0x3aab('0x4b')](_0x14ad7d[_0x3aab('0x43')][_0x3aab('0x4b')]);_0x64161['where']=qs['filters'](_[_0x3aab('0x68')](_0x14ad7d[_0x3aab('0x43')],_0x241388[_0x3aab('0x45')]));_0x64161['where'][_0x3aab('0x64')]=_0x53a0fe['id'];if(_0x14ad7d[_0x3aab('0x43')][_0x3aab('0x4d')]){_0x64161[_0x3aab('0x4c')]=_[_0x3aab('0x4e')](_0x64161[_0x3aab('0x4c')],{'$or':_[_0x3aab('0x4f')](_0x64161['attributes'],function(_0x492660){var _0x3fb844={};_0x3fb844[_0x492660]={'$like':'%'+_0x14ad7d[_0x3aab('0x43')][_0x3aab('0x4d')]+'%'};return _0x3fb844;})});}_0x64161=_[_0x3aab('0x4e')]({},_0x64161,_0x14ad7d[_0x3aab('0x50')]);return db[_0x3aab('0x65')]['count']({'where':_0x64161[_0x3aab('0x4c')]})[_0x3aab('0x39')](function(_0x3cb58b){_0x4ba742[_0x3aab('0x51')]=_0x3cb58b;if(_0x14ad7d['query']['includeAll']){_0x64161['include']=[{'all':!![]}];}return db[_0x3aab('0x65')][_0x3aab('0x54')](_0x64161);})['then'](function(_0xfcdf0d){_0x4ba742[_0x3aab('0x69')]=_0xfcdf0d;return _0x4ba742;});}})[_0x3aab('0x39')](respondWithFilteredResult(_0x5ab87e,_0x64161))['catch'](handleError(_0x5ab87e,null));};exports[_0x3aab('0x6a')]=function(_0x463092,_0x324344,_0x39f3a3){return db['WhatsappAccount'][_0x3aab('0x58')]({'where':{'id':_0x463092['params']['id']}})[_0x3aab('0x39')](handleEntityNotFound(_0x324344,null))[_0x3aab('0x39')](function(_0x1b02f0){if(_0x1b02f0){return _0x1b02f0['removeDispositions'](_0x463092[_0x3aab('0x43')][_0x3aab('0x6b')]);}})[_0x3aab('0x39')](respondWithStatusCode(_0x324344,null))['catch'](handleError(_0x324344,null));};exports[_0x3aab('0x6c')]=function(_0x34dafa,_0x3d59b1,_0x4b3ce1){if(_0x34dafa[_0x3aab('0x60')]['id']){delete _0x34dafa[_0x3aab('0x60')]['id'];}return db[_0x3aab('0x3e')][_0x3aab('0x58')]({'where':{'id':_0x34dafa['params']['id']}})['then'](handleEntityNotFound(_0x3d59b1,null))['then'](function(_0x2e294b){if(_0x2e294b){_0x34dafa[_0x3aab('0x60')][_0x3aab('0x64')]=_0x2e294b['id'];return db[_0x3aab('0x6d')][_0x3aab('0x59')](_0x34dafa[_0x3aab('0x60')]);}})[_0x3aab('0x39')](respondWithResult(_0x3d59b1,null))[_0x3aab('0x2a')](handleError(_0x3d59b1,null));};exports[_0x3aab('0x6e')]=function(_0x5a7508,_0x17967a,_0x33228b){var _0x5be3e8={'raw':![],'where':{}};var _0x17ea08={};var _0xf3e129={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3aab('0x66')]({'where':{'id':_0x5a7508[_0x3aab('0x55')]['id']}})[_0x3aab('0x39')](handleEntityNotFound(_0x17967a,null))['then'](function(_0x299888){if(_0x299888){_0x17ea08[_0x3aab('0x42')]=_[_0x3aab('0x44')](db[_0x3aab('0x6d')][_0x3aab('0x3f')]);_0x17ea08[_0x3aab('0x43')]=_[_0x3aab('0x44')](_0x5a7508[_0x3aab('0x43')]);_0x17ea08[_0x3aab('0x45')]=_[_0x3aab('0x46')](_0x17ea08[_0x3aab('0x42')],_0x17ea08[_0x3aab('0x43')]);_0x5be3e8[_0x3aab('0x47')]=_[_0x3aab('0x46')](_0x17ea08[_0x3aab('0x42')],qs[_0x3aab('0x57')](_0x5a7508['query'][_0x3aab('0x57')]));_0x5be3e8[_0x3aab('0x47')]=_0x5be3e8[_0x3aab('0x47')][_0x3aab('0x48')]?_0x5be3e8[_0x3aab('0x47')]:_0x17ea08['model'];if(!_0x5a7508[_0x3aab('0x43')][_0x3aab('0x67')](_0x3aab('0x49'))){_0x5be3e8[_0x3aab('0x30')]=qs['limit'](_0x5a7508[_0x3aab('0x43')][_0x3aab('0x30')]);_0x5be3e8['offset']=qs[_0x3aab('0x2f')](_0x5a7508[_0x3aab('0x43')][_0x3aab('0x2f')]);}_0x5be3e8[_0x3aab('0x4a')]=qs[_0x3aab('0x4b')](_0x5a7508['query'][_0x3aab('0x4b')]);_0x5be3e8[_0x3aab('0x4c')]=qs['filters'](_[_0x3aab('0x68')](_0x5a7508[_0x3aab('0x43')],_0x17ea08[_0x3aab('0x45')]));_0x5be3e8[_0x3aab('0x4c')][_0x3aab('0x64')]=_0x299888['id'];if(_0x5a7508[_0x3aab('0x43')][_0x3aab('0x4d')]){_0x5be3e8[_0x3aab('0x4c')]=_[_0x3aab('0x4e')](_0x5be3e8['where'],{'$or':_[_0x3aab('0x4f')](_0x5be3e8[_0x3aab('0x47')],function(_0x496c36){var _0x11f4c0={};_0x11f4c0[_0x496c36]={'$like':'%'+_0x5a7508[_0x3aab('0x43')]['filter']+'%'};return _0x11f4c0;})});}_0x5be3e8=_['merge']({},_0x5be3e8,_0x5a7508[_0x3aab('0x50')]);return db[_0x3aab('0x6d')][_0x3aab('0x51')]({'where':_0x5be3e8[_0x3aab('0x4c')]})[_0x3aab('0x39')](function(_0x34089c){_0xf3e129['count']=_0x34089c;if(_0x5a7508[_0x3aab('0x43')]['includeAll']){_0x5be3e8['include']=[{'all':!![]}];}return db[_0x3aab('0x6d')]['findAll'](_0x5be3e8);})['then'](function(_0xcd033a){_0xf3e129['rows']=_0xcd033a;return _0xf3e129;});}})[_0x3aab('0x39')](respondWithFilteredResult(_0x17967a,_0x5be3e8))[_0x3aab('0x2a')](handleError(_0x17967a,null));};exports[_0x3aab('0x6f')]=function(_0x144c0c,_0x3dc777,_0x13d91a){return db[_0x3aab('0x3e')][_0x3aab('0x58')]({'where':{'id':_0x144c0c['params']['id']}})[_0x3aab('0x39')](handleEntityNotFound(_0x3dc777,null))['then'](function(_0x37be46){if(_0x37be46){return _0x37be46[_0x3aab('0x6f')](_0x144c0c[_0x3aab('0x43')][_0x3aab('0x6b')]);}})[_0x3aab('0x39')](respondWithStatusCode(_0x3dc777,null))[_0x3aab('0x2a')](handleError(_0x3dc777,null));};exports['addAgents']=function(_0x246efe,_0x31b764,_0x3036db){return db[_0x3aab('0x3e')]['find']({'where':{'id':_0x246efe[_0x3aab('0x55')]['id']}})['then'](handleEntityNotFound(_0x31b764,null))['then'](function(_0x2cab08){if(_0x2cab08){return _0x2cab08[_0x3aab('0x70')](_0x246efe[_0x3aab('0x60')]['ids'],_['omit'](_0x246efe[_0x3aab('0x60')],['ids','id'])||{})[_0x3aab('0x71')](function(_0x54d9b5){for(var _0xf7a7b5=0x0;_0xf7a7b5<_0x246efe['body'][_0x3aab('0x6b')][_0x3aab('0x48')];_0xf7a7b5+=0x1){socket[_0x3aab('0x72')](_0x3aab('0x73'),{'UserId':_0x246efe[_0x3aab('0x60')]['ids'][_0xf7a7b5],'WhatsappAccountId':_0x246efe[_0x3aab('0x55')]['id']});}return _0x54d9b5;});}})[_0x3aab('0x39')](respondWithResult(_0x31b764,null))[_0x3aab('0x2a')](handleError(_0x31b764,null));};exports['removeAgents']=function(_0x37135c,_0x53183f,_0x106a9f){return db[_0x3aab('0x3e')]['find']({'where':{'id':_0x37135c[_0x3aab('0x55')]['id']}})[_0x3aab('0x39')](handleEntityNotFound(_0x53183f,null))[_0x3aab('0x39')](function(_0x11ce74){if(_0x11ce74){return _0x11ce74[_0x3aab('0x74')](_0x37135c[_0x3aab('0x43')][_0x3aab('0x6b')])[_0x3aab('0x39')](function(){if(_[_0x3aab('0x75')](_0x37135c['query'][_0x3aab('0x6b')])){for(var _0x2c0077=0x0;_0x2c0077<_0x37135c[_0x3aab('0x43')][_0x3aab('0x6b')]['length'];_0x2c0077+=0x1){socket['emit'](_0x3aab('0x76'),{'UserId':Number(_0x37135c[_0x3aab('0x43')][_0x3aab('0x6b')][_0x2c0077]),'WhatsappAccountId':Number(_0x37135c['params']['id'])});}}else{socket[_0x3aab('0x72')](_0x3aab('0x76'),{'UserId':Number(_0x37135c[_0x3aab('0x43')][_0x3aab('0x6b')]),'WhatsappAccountId':Number(_0x37135c['params']['id'])});}});}})[_0x3aab('0x39')](respondWithStatusCode(_0x53183f,null))['catch'](handleError(_0x53183f,null));};exports[_0x3aab('0x77')]=function(_0x2fb71f,_0x149d8b,_0x188c98){var _0x3a597b={};var _0x3a07f5={};var _0x44e011;var _0x4cc2e8;return db[_0x3aab('0x3e')][_0x3aab('0x66')]({'where':{'id':_0x2fb71f['params']['id']}})[_0x3aab('0x39')](handleEntityNotFound(_0x149d8b,null))[_0x3aab('0x39')](function(_0x599fae){if(_0x599fae){_0x44e011=_0x599fae;_0x3a07f5[_0x3aab('0x42')]=_[_0x3aab('0x44')](db[_0x3aab('0x78')]['rawAttributes']);_0x3a07f5['query']=_['keys'](_0x2fb71f[_0x3aab('0x43')]);_0x3a07f5[_0x3aab('0x45')]=_[_0x3aab('0x46')](_0x3a07f5[_0x3aab('0x42')],_0x3a07f5[_0x3aab('0x43')]);_0x3a597b[_0x3aab('0x47')]=_[_0x3aab('0x46')](_0x3a07f5[_0x3aab('0x42')],qs[_0x3aab('0x57')](_0x2fb71f[_0x3aab('0x43')]['fields']));_0x3a597b['attributes']=_0x3a597b[_0x3aab('0x47')]['length']?_0x3a597b[_0x3aab('0x47')]:_0x3a07f5['model'];_0x3a597b['order']=qs[_0x3aab('0x4b')](_0x2fb71f[_0x3aab('0x43')][_0x3aab('0x4b')]);_0x3a597b[_0x3aab('0x4c')]=qs['filters'](_['pick'](_0x2fb71f[_0x3aab('0x43')],_0x3a07f5[_0x3aab('0x45')]));if(_0x2fb71f['query']['filter']){_0x3a597b[_0x3aab('0x4c')]=_[_0x3aab('0x4e')](_0x3a597b[_0x3aab('0x4c')],{'$or':_[_0x3aab('0x4f')](_0x3a597b['attributes'],function(_0x1450eb){var _0x27d6bc={};_0x27d6bc[_0x1450eb]={'$like':'%'+_0x2fb71f[_0x3aab('0x43')][_0x3aab('0x4d')]+'%'};return _0x27d6bc;})});}_0x3a597b=_[_0x3aab('0x4e')]({},_0x3a597b,_0x2fb71f[_0x3aab('0x50')]);return _0x44e011[_0x3aab('0x77')](_0x3a597b);}})['then'](function(_0x53272f){if(_0x53272f){_0x4cc2e8=_0x53272f[_0x3aab('0x48')];if(!_0x2fb71f[_0x3aab('0x43')][_0x3aab('0x67')](_0x3aab('0x49'))){_0x3a597b[_0x3aab('0x30')]=qs[_0x3aab('0x30')](_0x2fb71f[_0x3aab('0x43')][_0x3aab('0x30')]);_0x3a597b['offset']=qs[_0x3aab('0x2f')](_0x2fb71f[_0x3aab('0x43')]['offset']);}return _0x44e011['getAgents'](_0x3a597b);}})[_0x3aab('0x39')](function(_0x369524){if(_0x369524){return _0x369524?{'count':_0x4cc2e8,'rows':_0x369524}:null;}})[_0x3aab('0x39')](respondWithResult(_0x149d8b,null))['catch'](handleError(_0x149d8b,null));};exports[_0x3aab('0x79')]=function(_0xf5d4c,_0xbde4c,_0x41afb2){return db['WhatsappAccount'][_0x3aab('0x66')]({'where':{'id':_0xf5d4c[_0x3aab('0x55')]['id']}})['then'](handleEntityNotFound(_0xbde4c,null))[_0x3aab('0x39')](function(_0x4e97a8){if(_0x4e97a8){return db['sequelize'][_0x3aab('0x7a')](function(_0x2eadd7){return db[_0x3aab('0x7b')][_0x3aab('0x35')]({'where':{'WhatsappAccountId':_0xf5d4c[_0x3aab('0x55')]['id']},'transaction':_0x2eadd7})[_0x3aab('0x39')](function(_0x5d8046){var _0x4a7e90=_['map'](_0xf5d4c[_0x3aab('0x60')],function(_0x2e617f){_0x2e617f[_0x3aab('0x64')]=_0xf5d4c['params']['id'];return _0x2e617f;});return db[_0x3aab('0x7b')][_0x3aab('0x7c')](_0x4a7e90,{'transaction':_0x2eadd7});});})['then'](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0xf5d4c['params']['id']},'order':'priority'});});}})[_0x3aab('0x39')](respondWithResult(_0xbde4c,null))[_0x3aab('0x2a')](handleError(_0xbde4c,null));};exports[_0x3aab('0x7d')]=function(_0x2bc9d4,_0x1a41b3,_0x5c823d){var _0x3fde8f={};var _0x5addf4={};var _0x31caff;var _0x2485c7;return db[_0x3aab('0x3e')][_0x3aab('0x66')]({'where':{'id':_0x2bc9d4[_0x3aab('0x55')]['id']}})[_0x3aab('0x39')](handleEntityNotFound(_0x1a41b3,null))[_0x3aab('0x39')](function(_0x358a39){if(_0x358a39){_0x31caff=_0x358a39;_0x5addf4[_0x3aab('0x42')]=_[_0x3aab('0x44')](db[_0x3aab('0x7b')][_0x3aab('0x3f')]);_0x5addf4['query']=_[_0x3aab('0x44')](_0x2bc9d4[_0x3aab('0x43')]);_0x5addf4[_0x3aab('0x45')]=_[_0x3aab('0x46')](_0x5addf4['model'],_0x5addf4[_0x3aab('0x43')]);_0x3fde8f['attributes']=_[_0x3aab('0x46')](_0x5addf4[_0x3aab('0x42')],qs['fields'](_0x2bc9d4[_0x3aab('0x43')][_0x3aab('0x57')]));_0x3fde8f[_0x3aab('0x47')]=_0x3fde8f[_0x3aab('0x47')][_0x3aab('0x48')]?_0x3fde8f[_0x3aab('0x47')]:_0x5addf4['model'];_0x3fde8f[_0x3aab('0x4a')]=qs[_0x3aab('0x4b')](_0x2bc9d4['query'][_0x3aab('0x4b')]);_0x3fde8f[_0x3aab('0x4c')]=qs[_0x3aab('0x45')](_[_0x3aab('0x68')](_0x2bc9d4['query'],_0x5addf4[_0x3aab('0x45')]));if(_0x2bc9d4[_0x3aab('0x43')][_0x3aab('0x4d')]){_0x3fde8f[_0x3aab('0x4c')]=_[_0x3aab('0x4e')](_0x3fde8f['where'],{'$or':_[_0x3aab('0x4f')](_0x3fde8f[_0x3aab('0x47')],function(_0x578430){var _0x495d52={};_0x495d52[_0x578430]={'$like':'%'+_0x2bc9d4['query'][_0x3aab('0x4d')]+'%'};return _0x495d52;})});}_0x3fde8f=_['merge']({},_0x3fde8f,_0x2bc9d4[_0x3aab('0x50')]);return _0x31caff[_0x3aab('0x7d')](_0x3fde8f);}})[_0x3aab('0x39')](function(_0x33b20a){if(_0x33b20a){_0x2485c7=_0x33b20a['length'];if(!_0x2bc9d4[_0x3aab('0x43')]['hasOwnProperty']('nolimit')){_0x3fde8f['limit']=qs[_0x3aab('0x30')](_0x2bc9d4[_0x3aab('0x43')][_0x3aab('0x30')]);_0x3fde8f[_0x3aab('0x2f')]=qs[_0x3aab('0x2f')](_0x2bc9d4[_0x3aab('0x43')][_0x3aab('0x2f')]);}return _0x31caff[_0x3aab('0x7d')](_0x3fde8f);}})[_0x3aab('0x39')](function(_0x950a77){if(_0x950a77){return _0x950a77?{'count':_0x2485c7,'rows':_0x950a77}:null;}})[_0x3aab('0x39')](respondWithResult(_0x1a41b3,null))[_0x3aab('0x2a')](handleError(_0x1a41b3,null));};exports['notify']=function(_0x1ab603,_0x59cc2f,_0xfda68f){var _0x59b1c1={'channel':_0x3aab('0x7e')};var _0x53431f=[];var _0xc194eb=[];var _0x5a5708={};return db[_0x3aab('0x3e')]['find']({'where':{'id':_0x1ab603[_0x3aab('0x55')]['id']},'include':[{'model':db[_0x3aab('0x7b')],'as':_0x3aab('0x7f')}]})[_0x3aab('0x39')](handleEntityNotFound(_0x59cc2f,null))[_0x3aab('0x39')](function(_0x67aa4e){_0x59b1c1[_0x3aab('0x80')]=_0x67aa4e;_0x59b1c1['applications']=_['orderBy'](_0x67aa4e[_0x3aab('0x7f')],[_0x3aab('0x81')],[_0x3aab('0x82')]);if(_0x59b1c1['account']['Applications']){delete _0x59b1c1[_0x3aab('0x80')][_0x3aab('0x7f')];}return db[_0x3aab('0x83')]['describe']();})[_0x3aab('0x39')](function(_0x385254){if(!_0x385254){throw new db[(_0x3aab('0x84'))][(_0x3aab('0x85'))](_0x3aab('0x86'));}_0x53431f=_['difference'](_[_0x3aab('0x44')](_0x385254),[_0x3aab('0x87'),_0x3aab('0x88')]);_0xc194eb=_[_0x3aab('0x89')](_[_0x3aab('0x44')](_0x385254),[_0x3aab('0x87'),_0x3aab('0x88'),'CompanyId',_0x3aab('0x8a')]);_0x59b1c1[_0x3aab('0x60')]={'mapKey':'mobile'};if(_0x59b1c1[_0x3aab('0x80')][_0x3aab('0x41')]&&_0x59b1c1[_0x3aab('0x80')][_0x3aab('0x41')]===_0x3aab('0x8b')){_0x59b1c1['body'][_0x3aab('0x8c')]=_0x1ab603[_0x3aab('0x60')][_0x3aab('0x8d')][_0x3aab('0x8e')](_0x3aab('0x8f'),'');_0x59b1c1[_0x3aab('0x60')][_0x3aab('0x60')]=_0x1ab603[_0x3aab('0x60')][_0x3aab('0x90')];_0x59b1c1['body'][_0x3aab('0x91')]=_0x1ab603[_0x3aab('0x60')][_0x3aab('0x92')];}if(_0x59b1c1[_0x3aab('0x60')]['id']){delete _0x59b1c1[_0x3aab('0x60')]['id'];}if(_['isNil'](_0x59b1c1[_0x3aab('0x60')][_0x3aab('0x8c')])){throw new db[(_0x3aab('0x84'))]['ValidationError'](_0x3aab('0x93'));}if(_['isNil'](_0x59b1c1[_0x3aab('0x60')][_0x3aab('0x60')])||_0x59b1c1[_0x3aab('0x60')][_0x3aab('0x60')]===''){throw new db[(_0x3aab('0x84'))][(_0x3aab('0x85'))](_0x3aab('0x94'));}if(_['isNil'](_0x59b1c1[_0x3aab('0x60')][_0x3aab('0x95')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xc194eb);}if(!_['includes'](_0xc194eb,_0x59b1c1[_0x3aab('0x60')][_0x3aab('0x95')])){throw new db[(_0x3aab('0x84'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xc194eb);}_0x5a5708[_0x59b1c1[_0x3aab('0x60')]['mapKey']]=_0x59b1c1[_0x3aab('0x60')][_0x3aab('0x8c')];return db[_0x3aab('0x96')][_0x3aab('0x58')]({'where':{'id':_0x59b1c1['account'][_0x3aab('0x8a')]},'include':[{'model':db['CmContact'],'as':_0x3aab('0x97'),'where':_0x5a5708,'limit':0x1,'order':[[_0x3aab('0x88'),_0x3aab('0x98')]]}]});})[_0x3aab('0x39')](handleEntityNotFound(_0x59cc2f,null))[_0x3aab('0x39')](function(_0x13b59e){if(_0x13b59e){_0x59b1c1[_0x3aab('0x99')]=_['omit'](_0x13b59e,[_0x3aab('0x97')]);if(_0x13b59e[_0x3aab('0x97')][_0x3aab('0x48')]){return _0x13b59e[_0x3aab('0x97')][0x0];}var _0x297455=_[_0x3aab('0x1a')](_0x59b1c1['body'],{'firstName':_0x59b1c1['body']['from'],'ListId':_0x13b59e['id']});_0x297455[_0x59b1c1[_0x3aab('0x60')]['mapKey']]=_0x59b1c1[_0x3aab('0x60')][_0x3aab('0x8c')];return db[_0x3aab('0x83')][_0x3aab('0x59')](_0x297455,{'fields':_0x53431f,'raw':!![]});}})[_0x3aab('0x39')](handleEntityNotFound(_0x59cc2f,null))[_0x3aab('0x39')](function(_0x15694a){if(_0x15694a){_0x59b1c1['contact']=_0x15694a;var _0x9f1ec0={'ContactId':_0x15694a['id'],'phone':_0x59b1c1[_0x3aab('0x60')][_0x3aab('0x8c')],'WhatsappAccountId':_0x1ab603[_0x3aab('0x55')]['id']};var _0x44402d={'ContactId':_0x15694a['id'],'WhatsappAccountId':_0x1ab603[_0x3aab('0x55')]['id'],'closed':![]};return db[_0x3aab('0x9a')][_0x3aab('0x58')]({'where':_0x44402d})['then'](function(_0x1bb54){if(_0x1bb54){return[_0x1bb54,![]];}return db[_0x3aab('0x9a')]['create'](_0x9f1ec0)[_0x3aab('0x39')](function(_0x35727a){return[_0x35727a,!![]];});});}})[_0x3aab('0x71')](function(_0xb6ac64,_0x17dfa2){_0x59b1c1['interaction']=_0xb6ac64[_0x3aab('0x36')]({'plain':!![]});_0x59b1c1['interaction'][_0x3aab('0x9b')]=![];if(_0x17dfa2){if(_0x59b1c1[_0x3aab('0x80')]['autoclose']){_0x59b1c1[_0x3aab('0x9c')][_0x3aab('0x9d')]({'id':0x0,'priority':_0x59b1c1[_0x3aab('0x9c')][_0x3aab('0x48')]+0x1,'app':_0x3aab('0x9e'),'appdata':_0x3aab('0x9f'),'interval':_0x3aab('0xa0')});}_0x59b1c1[_0x3aab('0xa1')][_0x3aab('0x9b')]=!![];}return db[_0x3aab('0xa2')][_0x3aab('0x59')]({'phone':_0x59b1c1[_0x3aab('0x60')][_0x3aab('0x8c')],'messageId':_0x59b1c1[_0x3aab('0x60')][_0x3aab('0x91')],'body':_0x59b1c1[_0x3aab('0x60')][_0x3aab('0x60')],'WhatsappAccountId':_0x1ab603[_0x3aab('0x55')]['id'],'WhatsappInteractionId':_0xb6ac64['id'],'direction':'in','ContactId':_0xb6ac64[_0x3aab('0xa3')],'AttachmentId':_0x59b1c1[_0x3aab('0x60')][_0x3aab('0xa4')]});})['then'](function(_0x485386){_0x59b1c1[_0x3aab('0x28')]=_0x485386;if(_0x59b1c1[_0x3aab('0xa1')][_0x3aab('0xa5')]){return db[_0x3aab('0x78')][_0x3aab('0x58')]({'attributes':['id',_0x3aab('0x3b')],'where':{'id':_0x59b1c1[_0x3aab('0xa1')][_0x3aab('0xa5')]}})[_0x3aab('0x39')](function(_0x3aec9b){if(_0x3aec9b){_0x59b1c1[_0x3aab('0x9c')][_0x3aab('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3aec9b[_0x3aab('0x3b')]+','+(_0x59b1c1['account'][_0x3aab('0xa7')]||0xa),'interval':_0x3aab('0xa0')});}return respondWithRpcPromise(_0x3aab('0xa8'),'startRouting',_0x59b1c1);});}return respondWithRpcPromise(_0x3aab('0xa8'),_0x3aab('0xa9'),_0x59b1c1);})[_0x3aab('0x39')](function(_0xd7e896){if(_0xd7e896){var _0x49b610=0xc8;var _0x3eadca=_0x3aab('0xaa');logger[_0x3aab('0x21')](_0x3aab('0xab'),_0x3eadca,_0x49b610,'entity\x20found');logger[_0x3aab('0x24')](_0x3aab('0xac'),_0x3eadca,_0x49b610,_0x3aab('0xad'),JSON[_0x3aab('0x25')](_0xd7e896));if(_0x59b1c1['account'][_0x3aab('0x41')]==='twilio'){return _0x59cc2f['status'](_0x49b610)['set'](_0x3aab('0xae'),_0x3aab('0xaf'))['send'](_0x3aab('0xb0'));}else{return _0x59cc2f['status'](_0x49b610)[_0x3aab('0x2e')](_0xd7e896);}}})[_0x3aab('0x2a')](handleError(_0x59cc2f,null));};exports['send']=function(_0x1fe875,_0xa7ae08,_0x4f357){var _0x39e2e5,_0x4a7bb3,_0x2cc187;if(_[_0x3aab('0xb1')](_0x1fe875[_0x3aab('0x60')][_0x3aab('0x60')])||_0x1fe875[_0x3aab('0x60')][_0x3aab('0x60')]===''){throw new db['Sequelize'][(_0x3aab('0x85'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3aab('0xb1')](_0x1fe875[_0x3aab('0x60')]['to'])){throw new db[(_0x3aab('0x84'))][(_0x3aab('0x85'))]('to\x20is\x20mandatory');}_0x39e2e5=_0x1fe875[_0x3aab('0x60')]['to'];return db['WhatsappAccount'][_0x3aab('0x58')]({'where':{'id':_0x1fe875['params']['id']},'include':[{'model':db[_0x3aab('0x96')],'as':'List','include':[{'model':db[_0x3aab('0x83')],'as':'Contacts','where':{'mobile':_0x39e2e5},'limit':0x1,'order':[[_0x3aab('0x88'),_0x3aab('0x98')]]}]}]})[_0x3aab('0x39')](handleEntityNotFound(_0xa7ae08,null))[_0x3aab('0x39')](function(_0x1e0f50){if(_0x1e0f50&&_0x1e0f50[_0x3aab('0xb2')]){_0x4a7bb3=_0x1e0f50['get']({'plain':!![]});if(_0x4a7bb3[_0x3aab('0xb2')]&&_0x4a7bb3[_0x3aab('0xb2')][_0x3aab('0x97')][_0x3aab('0x48')]){return _0x4a7bb3[_0x3aab('0xb2')][_0x3aab('0x97')][0x0];}return db[_0x3aab('0x83')][_0x3aab('0x59')](_['defaults'](_0x1fe875[_0x3aab('0x60')],{'firstName':_0x39e2e5,'mobile':_0x39e2e5,'phone':_0x39e2e5,'ListId':_0x4a7bb3['ListId']}));}})[_0x3aab('0x39')](handleEntityNotFound(_0xa7ae08,null))[_0x3aab('0x39')](function(_0x5c3968){if(_0x5c3968){_0x2cc187=_0x5c3968;return db[_0x3aab('0x9a')]['find']({'where':{'ContactId':_0x2cc187['id'],'closed':![],'WhatsappAccountId':_0x4a7bb3['id']}})[_0x3aab('0x39')](function(_0x149651){if(_0x149651){return[_0x149651,![]];}return db['WhatsappInteraction'][_0x3aab('0x59')]({'UserId':_0x1fe875[_0x3aab('0x5a')]['id'],'ContactId':_0x2cc187['id'],'WhatsappAccountId':_0x4a7bb3['id'],'phone':_0x39e2e5,'firstMsgDirection':_0x3aab('0xb3'),'Messages':[_[_0x3aab('0x4e')](_0x1fe875[_0x3aab('0x60')],{'read':![],'body':_0x1fe875[_0x3aab('0x60')][_0x3aab('0x60')],'phone':_0x39e2e5,'WhatsappAccountId':_0x4a7bb3['id'],'UserId':_0x1fe875[_0x3aab('0x5a')]['id'],'ContactId':_0x2cc187['id']})]},{'include':[{'model':db[_0x3aab('0xa2')],'as':_0x3aab('0xb4')}]})['then'](function(_0x19d1f6){return[_0x19d1f6,!![]];});});}})[_0x3aab('0x71')](function(_0xd902a3,_0x741f9b){if(_0x741f9b){return _0xd902a3;}return db[_0x3aab('0xa2')]['create'](_['merge'](_0x1fe875['body'],{'read':![],'body':_0x1fe875[_0x3aab('0x60')][_0x3aab('0x60')],'phone':_0x39e2e5,'WhatsappAccountId':_0x4a7bb3['id'],'WhatsappInteractionId':_0xd902a3['id'],'UserId':_0x1fe875[_0x3aab('0x5a')]['id'],'ContactId':_0x2cc187['id']}))[_0x3aab('0x39')](function(_0x2ce218){_0xd902a3[_0x3aab('0xb5')][_0x3aab('0xb4')]=[];_0xd902a3['dataValues'][_0x3aab('0xb4')]['push'](_0x2ce218[_0x3aab('0xb5')]);return _0xd902a3;});})[_0x3aab('0x39')](respondWithResult(_0xa7ae08,null))[_0x3aab('0x2a')](handleError(_0xa7ae08,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 294158a..e1bbeec 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 _0x3f8a=['../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x24ae77,_0x1fcf25){var _0x8e7cd5=function(_0x302fe9){while(--_0x302fe9){_0x24ae77['push'](_0x24ae77['shift']());}};_0x8e7cd5(++_0x1fcf25);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x32cffa,_0x1efa93){_0x32cffa=_0x32cffa-0x0;var _0x3e1b1a=_0x3f8a[_0x32cffa];return _0x3e1b1a;};'use strict';var EventEmitter=require(_0xa3f8('0x0'));var WhatsappAccount=require(_0xa3f8('0x1'))['db'][_0xa3f8('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa3f8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa3f8('0x4'),'afterDestroy':_0xa3f8('0x5')};function emitEvent(_0x928738){return function(_0x15b6aa,_0x2553fd,_0x2847b4){WhatsappAccountEvents[_0xa3f8('0x6')](_0x928738+':'+_0x15b6aa['id'],_0x15b6aa);WhatsappAccountEvents[_0xa3f8('0x6')](_0x928738,_0x15b6aa);_0x2847b4(null);};}for(var e in events){if(events[_0xa3f8('0x7')](e)){var event=events[e];WhatsappAccount[_0xa3f8('0x8')](e,emitEvent(event));}}module[_0xa3f8('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x6f44=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x6f44,0x1ea));var _0x46f4=function(_0x394e75,_0x5ce1ea){_0x394e75=_0x394e75-0x0;var _0x5b0768=_0x6f44[_0x394e75];return _0x5b0768;};'use strict';var EventEmitter=require(_0x46f4('0x0'));var WhatsappAccount=require(_0x46f4('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x46f4('0x2')](0x0);var events={'afterCreate':_0x46f4('0x3'),'afterUpdate':_0x46f4('0x4'),'afterDestroy':_0x46f4('0x5')};function emitEvent(_0x4099a9){return function(_0x1e2554,_0x26f749,_0x200f8b){WhatsappAccountEvents[_0x46f4('0x6')](_0x4099a9+':'+_0x1e2554['id'],_0x1e2554);WhatsappAccountEvents['emit'](_0x4099a9,_0x1e2554);_0x200f8b(null);};}for(var e in events){if(events[_0x46f4('0x7')](e)){var event=events[e];WhatsappAccount[_0x46f4('0x8')](e,emitEvent(event));}}module[_0x46f4('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index cbf53de..9ed8cfd 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 _0xe17b=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe17b,0xa6));var _0xbe17=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xe17b[_0x1b64dd];return _0xeb464c;};'use strict';var _=require(_0xbe17('0x0'));var util=require(_0xbe17('0x1'));var logger=require(_0xbe17('0x2'))(_0xbe17('0x3'));var moment=require('moment');var BPromise=require(_0xbe17('0x4'));var rp=require(_0xbe17('0x5'));var fs=require('fs');var path=require(_0xbe17('0x6'));var rimraf=require(_0xbe17('0x7'));var config=require(_0xbe17('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0xbe17('0x9')]=function(_0x2ba0c6,_0x2c5e45){return _0x2ba0c6[_0xbe17('0xa')](_0xbe17('0xb'),attributes,{'tableName':_0xbe17('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60ba=['./whatsappAccount.attributes','define','util','../../config/logger','moment','request-promise','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x60ba,0x16e));var _0xa60b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x60ba[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xa60b('0x0'));var logger=require(_0xa60b('0x1'))('api');var moment=require(_0xa60b('0x2'));var BPromise=require('bluebird');var rp=require(_0xa60b('0x3'));var fs=require('fs');var path=require(_0xa60b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa60b('0x5'));module['exports']=function(_0x1e9133,_0x1140c3){return _0x1e9133[_0xa60b('0x6')]('WhatsappAccount',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 0e449fa..693e132 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 _0x81a5=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','model','map','debug'];(function(_0xa06950,_0x11c8ad){var _0x1ddee6=function(_0xa98ad4){while(--_0xa98ad4){_0xa06950['push'](_0xa06950['shift']());}};_0x1ddee6(++_0x11c8ad);}(_0x81a5,0x1c8));var _0x581a=function(_0x2d9425,_0x3f9e94){_0x2d9425=_0x2d9425-0x0;var _0x1d6a84=_0x81a5[_0x2d9425];return _0x1d6a84;};'use strict';var _=require(_0x581a('0x0'));var util=require(_0x581a('0x1'));var moment=require(_0x581a('0x2'));var BPromise=require(_0x581a('0x3'));var rs=require(_0x581a('0x4'));var fs=require('fs');var Redis=require(_0x581a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x581a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x581a('0x7')]['http']({'port':0x232a});config[_0x581a('0x8')]=_[_0x581a('0x9')](config[_0x581a('0x8')],{'host':_0x581a('0xa'),'port':0x18eb});var socket=require(_0x581a('0xb'))(new Redis(config[_0x581a('0x8')]));require(_0x581a('0xc'))[_0x581a('0xd')](socket);function respondWithRpcPromise(_0x524948,_0x1c9869,_0x493493){return new BPromise(function(_0x1541f1,_0x8e2264){return client[_0x581a('0xe')](_0x524948,_0x493493)[_0x581a('0xf')](function(_0x538d9b){logger[_0x581a('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x1c9869,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1c9869,_0x581a('0x11'),JSON[_0x581a('0x12')](_0x538d9b));if(_0x538d9b['error']){if(_0x538d9b[_0x581a('0x13')][_0x581a('0x14')]===0x1f4){logger[_0x581a('0x13')](_0x581a('0x15'),_0x1c9869,_0x538d9b[_0x581a('0x13')][_0x581a('0x16')]);return _0x8e2264(_0x538d9b[_0x581a('0x13')][_0x581a('0x16')]);}logger['error'](_0x581a('0x15'),_0x1c9869,_0x538d9b[_0x581a('0x13')]['message']);return _0x1541f1(_0x538d9b[_0x581a('0x13')][_0x581a('0x16')]);}else{logger[_0x581a('0x10')](_0x581a('0x15'),_0x1c9869,'request\x20sent');_0x1541f1(_0x538d9b[_0x581a('0x17')][_0x581a('0x16')]);}})['catch'](function(_0x4bdc1a){logger[_0x581a('0x13')](_0x581a('0x15'),_0x1c9869,_0x4bdc1a);_0x8e2264(_0x4bdc1a);});});}exports[_0x581a('0x18')]=function(_0x28036f){var _0xeef3d7=this;return new Promise(function(_0x2ad551,_0x19e468){return db[_0x581a('0x19')]['find']({'raw':_0x28036f[_0x581a('0x1a')]?_0x28036f[_0x581a('0x1a')][_0x581a('0x1b')]===undefined?!![]:![]:!![],'where':_0x28036f['options']?_0x28036f['options'][_0x581a('0x1c')]||null:null,'attributes':_0x28036f[_0x581a('0x1a')]?_0x28036f[_0x581a('0x1a')][_0x581a('0x1d')]||null:null,'include':_0x28036f['options']?_0x28036f[_0x581a('0x1a')][_0x581a('0x1e')]?_['map'](_0x28036f[_0x581a('0x1a')][_0x581a('0x1e')],function(_0x5d95a5){return{'model':db[_0x5d95a5[_0x581a('0x1f')]],'as':_0x5d95a5['as'],'attributes':_0x5d95a5[_0x581a('0x1d')],'include':_0x5d95a5['include']?_['map'](_0x5d95a5[_0x581a('0x1e')],function(_0x56262f){return{'model':db[_0x56262f['model']],'as':_0x56262f['as'],'attributes':_0x56262f[_0x581a('0x1d')],'include':_0x56262f[_0x581a('0x1e')]?_[_0x581a('0x20')](_0x56262f['include'],function(_0x1b96bb){return{'model':db[_0x1b96bb[_0x581a('0x1f')]],'as':_0x1b96bb['as'],'attributes':_0x1b96bb[_0x581a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x581a('0xf')](function(_0x4832e2){logger[_0x581a('0x10')](_0x581a('0x18'),_0x28036f);logger[_0x581a('0x21')](_0x581a('0x18'),_0x28036f,JSON[_0x581a('0x12')](_0x4832e2));_0x2ad551(_0x4832e2);})[_0x581a('0x22')](function(_0x1ac86e){logger[_0x581a('0x13')](_0x581a('0x18'),_0x1ac86e[_0x581a('0x16')],_0x28036f);_0x19e468(_0xeef3d7['error'](0x1f4,_0x1ac86e[_0x581a('0x16')]));});});}; \ No newline at end of file +var _0x159b=['include','model','attributes','map','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw'];(function(_0x4c6b67,_0x132fe1){var _0x5a8a5a=function(_0x234a20){while(--_0x234a20){_0x4c6b67['push'](_0x4c6b67['shift']());}};_0x5a8a5a(++_0x132fe1);}(_0x159b,0x181));var _0xb159=function(_0x23433b,_0x25b1ec){_0x23433b=_0x23433b-0x0;var _0x213a9e=_0x159b[_0x23433b];return _0x213a9e;};'use strict';var _=require(_0xb159('0x0'));var util=require(_0xb159('0x1'));var moment=require(_0xb159('0x2'));var BPromise=require(_0xb159('0x3'));var rs=require(_0xb159('0x4'));var fs=require('fs');var Redis=require(_0xb159('0x5'));var db=require(_0xb159('0x6'))['db'];var utils=require(_0xb159('0x7'));var logger=require('../../config/logger')(_0xb159('0x8'));var config=require(_0xb159('0x9'));var jayson=require(_0xb159('0xa'));var client=jayson[_0xb159('0xb')]['http']({'port':0x232a});config[_0xb159('0xc')]=_[_0xb159('0xd')](config[_0xb159('0xc')],{'host':_0xb159('0xe'),'port':0x18eb});var socket=require(_0xb159('0xf'))(new Redis(config[_0xb159('0xc')]));require(_0xb159('0x10'))[_0xb159('0x11')](socket);function respondWithRpcPromise(_0x2df975,_0x130e72,_0x26b16a){return new BPromise(function(_0x45a7c9,_0x424e93){return client['request'](_0x2df975,_0x26b16a)['then'](function(_0x36386e){logger[_0xb159('0x12')](_0xb159('0x13'),_0x130e72,_0xb159('0x14'));logger[_0xb159('0x15')](_0xb159('0x16'),_0x130e72,'request\x20sent',JSON[_0xb159('0x17')](_0x36386e));if(_0x36386e['error']){if(_0x36386e[_0xb159('0x18')][_0xb159('0x19')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x130e72,_0x36386e[_0xb159('0x18')][_0xb159('0x1a')]);return _0x424e93(_0x36386e[_0xb159('0x18')]['message']);}logger[_0xb159('0x18')](_0xb159('0x13'),_0x130e72,_0x36386e['error'][_0xb159('0x1a')]);return _0x45a7c9(_0x36386e[_0xb159('0x18')]['message']);}else{logger[_0xb159('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x130e72,_0xb159('0x14'));_0x45a7c9(_0x36386e[_0xb159('0x1b')][_0xb159('0x1a')]);}})['catch'](function(_0x320679){logger['error'](_0xb159('0x13'),_0x130e72,_0x320679);_0x424e93(_0x320679);});});}exports[_0xb159('0x1c')]=function(_0x287554){var _0x172694=this;return new Promise(function(_0x1e0996,_0x3127d9){return db[_0xb159('0x1d')][_0xb159('0x1e')]({'raw':_0x287554[_0xb159('0x1f')]?_0x287554[_0xb159('0x1f')][_0xb159('0x20')]===undefined?!![]:![]:!![],'where':_0x287554[_0xb159('0x1f')]?_0x287554[_0xb159('0x1f')]['where']||null:null,'attributes':_0x287554[_0xb159('0x1f')]?_0x287554['options']['attributes']||null:null,'include':_0x287554[_0xb159('0x1f')]?_0x287554[_0xb159('0x1f')][_0xb159('0x21')]?_['map'](_0x287554[_0xb159('0x1f')][_0xb159('0x21')],function(_0x57c9b0){return{'model':db[_0x57c9b0[_0xb159('0x22')]],'as':_0x57c9b0['as'],'attributes':_0x57c9b0[_0xb159('0x23')],'include':_0x57c9b0[_0xb159('0x21')]?_[_0xb159('0x24')](_0x57c9b0[_0xb159('0x21')],function(_0x2716b3){return{'model':db[_0x2716b3[_0xb159('0x22')]],'as':_0x2716b3['as'],'attributes':_0x2716b3[_0xb159('0x23')],'include':_0x2716b3['include']?_[_0xb159('0x24')](_0x2716b3[_0xb159('0x21')],function(_0x478dd6){return{'model':db[_0x478dd6[_0xb159('0x22')]],'as':_0x478dd6['as'],'attributes':_0x478dd6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x591ba9){logger[_0xb159('0x12')]('ShowWhatsappAccount',_0x287554);logger[_0xb159('0x15')](_0xb159('0x1c'),_0x287554,JSON[_0xb159('0x17')](_0x591ba9));_0x1e0996(_0x591ba9);})[_0xb159('0x25')](function(_0x5b8895){logger[_0xb159('0x18')](_0xb159('0x1c'),_0x5b8895[_0xb159('0x1a')],_0x287554);_0x3127d9(_0x172694[_0xb159('0x18')](0x1f4,_0x5b8895['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index a94e9e9..b693230 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 _0x06b4=['whatsappAccount:','./whatsappAccount.events','save','remove','update','removeListener','register'];(function(_0xf48e32,_0x5193b1){var _0x65b3a4=function(_0x1db8ab){while(--_0x1db8ab){_0xf48e32['push'](_0xf48e32['shift']());}};_0x65b3a4(++_0x5193b1);}(_0x06b4,0xb0));var _0x406b=function(_0x5c712c,_0x1c69f6){_0x5c712c=_0x5c712c-0x0;var _0x1e6a82=_0x06b4[_0x5c712c];return _0x1e6a82;};'use strict';var WhatsappAccountEvents=require(_0x406b('0x0'));var events=[_0x406b('0x1'),_0x406b('0x2'),_0x406b('0x3')];function createListener(_0x159313,_0x2b6dca){return function(_0x2d5362){_0x2b6dca['emit'](_0x159313,_0x2d5362);};}function removeListener(_0x41b512,_0x59f016){return function(){WhatsappAccountEvents[_0x406b('0x4')](_0x41b512,_0x59f016);};}exports[_0x406b('0x5')]=function(_0x853c81){for(var _0x233300=0x0,_0x4b6783=events['length'];_0x233300<_0x4b6783;_0x233300++){var _0x3f58b6=events[_0x233300];var _0x236c68=createListener(_0x406b('0x6')+_0x3f58b6,_0x853c81);WhatsappAccountEvents['on'](_0x3f58b6,_0x236c68);}}; \ No newline at end of file +var _0x6e6a=['./whatsappAccount.events','remove','update','emit','removeListener','register','length','whatsappAccount:'];(function(_0x4b5d8d,_0x450720){var _0x5d3ae3=function(_0x28aa23){while(--_0x28aa23){_0x4b5d8d['push'](_0x4b5d8d['shift']());}};_0x5d3ae3(++_0x450720);}(_0x6e6a,0xd8));var _0xa6e6=function(_0x243a47,_0x4389ea){_0x243a47=_0x243a47-0x0;var _0x106696=_0x6e6a[_0x243a47];return _0x106696;};'use strict';var WhatsappAccountEvents=require(_0xa6e6('0x0'));var events=['save',_0xa6e6('0x1'),_0xa6e6('0x2')];function createListener(_0x52fe1a,_0xddb8ea){return function(_0x5b42f0){_0xddb8ea[_0xa6e6('0x3')](_0x52fe1a,_0x5b42f0);};}function removeListener(_0x4f1aa5,_0x115a7d){return function(){WhatsappAccountEvents[_0xa6e6('0x4')](_0x4f1aa5,_0x115a7d);};}exports[_0xa6e6('0x5')]=function(_0x3aacf2){for(var _0x37e372=0x0,_0xb9de8f=events[_0xa6e6('0x6')];_0x37e372<_0xb9de8f;_0x37e372++){var _0xb48ba9=events[_0x37e372];var _0x164dce=createListener(_0xa6e6('0x7')+_0xb48ba9,_0x3aacf2);WhatsappAccountEvents['on'](_0xb48ba9,_0x164dce);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 486ee4b..8d0a45e 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 _0xf91f=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','get','/:id','show','post','create','put'];(function(_0x3f6490,_0x42d72c){var _0x1a8ca1=function(_0x4f5d11){while(--_0x4f5d11){_0x3f6490['push'](_0x3f6490['shift']());}};_0x1a8ca1(++_0x42d72c);}(_0xf91f,0x148));var _0xff91=function(_0x39149c,_0x4f74c1){_0x39149c=_0x39149c-0x0;var _0x1f1801=_0xf91f[_0x39149c];return _0x1f1801;};'use strict';var multer=require(_0xff91('0x0'));var util=require(_0xff91('0x1'));var path=require(_0xff91('0x2'));var timeout=require('connect-timeout');var express=require(_0xff91('0x3'));var router=express[_0xff91('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xff91('0x5'));var config=require('../../config/environment');var controller=require(_0xff91('0x6'));router['get']('/',auth[_0xff91('0x7')](),controller['index']);router[_0xff91('0x8')](_0xff91('0x9'),auth[_0xff91('0x7')](),controller[_0xff91('0xa')]);router[_0xff91('0xb')]('/',auth[_0xff91('0x7')](),controller[_0xff91('0xc')]);router[_0xff91('0xd')](_0xff91('0x9'),auth[_0xff91('0x7')](),controller[_0xff91('0xe')]);router[_0xff91('0xf')](_0xff91('0x9'),auth[_0xff91('0x7')](),controller[_0xff91('0x10')]);module[_0xff91('0x11')]=router; \ No newline at end of file +var _0x2dee=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout'];(function(_0x30b41c,_0x27775e){var _0x3e260d=function(_0x1a080c){while(--_0x1a080c){_0x30b41c['push'](_0x30b41c['shift']());}};_0x3e260d(++_0x27775e);}(_0x2dee,0x19e));var _0xe2de=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x2dee[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe2de('0x0'));var timeout=require(_0xe2de('0x1'));var express=require('express');var router=express[_0xe2de('0x2')]();var auth=require(_0xe2de('0x3'));var interaction=require(_0xe2de('0x4'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0xe2de('0x5')]('/',auth[_0xe2de('0x6')](),controller[_0xe2de('0x7')]);router[_0xe2de('0x5')](_0xe2de('0x8'),auth[_0xe2de('0x6')](),controller[_0xe2de('0x9')]);router[_0xe2de('0xa')]('/',auth[_0xe2de('0x6')](),controller[_0xe2de('0xb')]);router[_0xe2de('0xc')](_0xe2de('0x8'),auth[_0xe2de('0x6')](),controller[_0xe2de('0xd')]);router['delete'](_0xe2de('0x8'),auth[_0xe2de('0x6')](),controller[_0xe2de('0xe')]);module[_0xe2de('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index cfb9ab5..9568aa0 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 _0x734f=['noop','sequelize','exports','INTEGER','STRING'];(function(_0x17a255,_0x408471){var _0x469442=function(_0x4ad04a){while(--_0x4ad04a){_0x17a255['push'](_0x17a255['shift']());}};_0x469442(++_0x408471);}(_0x734f,0x155));var _0xf734=function(_0x351af1,_0x2770f7){_0x351af1=_0x351af1-0x0;var _0x2aaafd=_0x734f[_0x351af1];return _0x2aaafd;};'use strict';var Sequelize=require(_0xf734('0x0'));module[_0xf734('0x1')]={'priority':{'type':Sequelize[_0xf734('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf734('0x3')],'allowNull':![],'defaultValue':_0xf734('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf734('0x3')]},'interval':{'type':Sequelize[_0xf734('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5b9d=['TEXT','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5b9d,0x182));var _0xd5b9=function(_0x4d141e,_0x53d617){_0x4d141e=_0x4d141e-0x0;var _0x228e1a=_0x5b9d[_0x4d141e];return _0x228e1a;};'use strict';var Sequelize=require(_0xd5b9('0x0'));module[_0xd5b9('0x1')]={'priority':{'type':Sequelize[_0xd5b9('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd5b9('0x3')},'appdata':{'type':Sequelize[_0xd5b9('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd5b9('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index d3c63d7..34fd08e 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 _0xafbd=['error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','count','includeAll','findAll','catch','show','params','keys','intersection','include','options','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x7dabec,_0x4c5084){var _0x39cbe6=function(_0x5dfb27){while(--_0x5dfb27){_0x7dabec['push'](_0x7dabec['shift']());}};_0x39cbe6(++_0x4c5084);}(_0xafbd,0xfd));var _0xdafb=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xafbd[_0x2db12b];return _0x20990b;};'use strict';var pdf=require(_0xdafb('0x0'));var emlformat=require(_0xdafb('0x1'));var rimraf=require(_0xdafb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdafb('0x3'));var rp=require(_0xdafb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdafb('0x5'));var util=require(_0xdafb('0x6'));var path=require(_0xdafb('0x7'));var sox=require(_0xdafb('0x8'));var csv=require(_0xdafb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdafb('0xa'));var squel=require(_0xdafb('0xb'));var crypto=require(_0xdafb('0xc'));var jsforce=require(_0xdafb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdafb('0xe'));var Redis=require('ioredis');var authService=require(_0xdafb('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdafb('0x10'));var logger=require(_0xdafb('0x11'))('api');var utils=require(_0xdafb('0x12'));var config=require(_0xdafb('0x13'));var licenseUtil=require(_0xdafb('0x14'));var db=require(_0xdafb('0x15'))['db'];function respondWithStatusCode(_0x1b8987,_0x318dfc){_0x318dfc=_0x318dfc||0xcc;return function(_0x8acf7f){if(_0x8acf7f){return _0x1b8987[_0xdafb('0x16')](_0x318dfc);}return _0x1b8987[_0xdafb('0x17')](_0x318dfc)[_0xdafb('0x18')]();};}function respondWithResult(_0x160530,_0x29e357){_0x29e357=_0x29e357||0xc8;return function(_0x26e8b3){if(_0x26e8b3){return _0x160530['status'](_0x29e357)[_0xdafb('0x19')](_0x26e8b3);}};}function respondWithFilteredResult(_0x53f812,_0x7098d){return function(_0x516444){if(_0x516444){var _0x2354a1=_0x516444['count'],_0x133912=_0x7098d[_0xdafb('0x1a')],_0x251d25=_0x7098d[_0xdafb('0x1a')]+_0x7098d[_0xdafb('0x1b')],_0x7ba167;if(_0x251d25>=_0x2354a1){_0x251d25=_0x2354a1;_0x7ba167=0xc8;}else{_0x7ba167=0xce;}_0x53f812[_0xdafb('0x17')](_0x7ba167);return _0x53f812['set'](_0xdafb('0x1c'),_0x133912+'-'+_0x251d25+'/'+_0x2354a1)[_0xdafb('0x19')](_0x516444);}return null;};}function patchUpdates(_0x77d15a){return function(_0x4eedf8){try{jsonpatch[_0xdafb('0x1d')](_0x4eedf8,_0x77d15a,!![]);}catch(_0xb8e63b){return BPromise[_0xdafb('0x1e')](_0xb8e63b);}return _0x4eedf8[_0xdafb('0x1f')]();};}function saveUpdates(_0x57a9d8,_0x518700){return function(_0x123052){if(_0x123052){return _0x123052[_0xdafb('0x20')](_0x57a9d8)[_0xdafb('0x21')](function(_0x21c7ae){return _0x21c7ae;});}return null;};}function removeEntity(_0x27e538,_0x4f6d9c){return function(_0x341780){if(_0x341780){return _0x341780[_0xdafb('0x22')]()[_0xdafb('0x21')](function(){_0x27e538[_0xdafb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10289c,_0x3289ef){return function(_0x15a39a){if(!_0x15a39a){_0x10289c[_0xdafb('0x16')](0x194);}return _0x15a39a;};}function handleError(_0x45e9df,_0x467f3e){_0x467f3e=_0x467f3e||0x1f4;return function(_0x45712b){logger[_0xdafb('0x23')](_0x45712b[_0xdafb('0x24')]);if(_0x45712b[_0xdafb('0x25')]){delete _0x45712b['name'];}_0x45e9df[_0xdafb('0x17')](_0x467f3e)[_0xdafb('0x26')](_0x45712b);};}exports[_0xdafb('0x27')]=function(_0x51a77e,_0x4aa25e){var _0x3a494c={},_0x102c91={},_0x3bdd2a={'count':0x0,'rows':[]};var _0x2211d4=_[_0xdafb('0x28')](db[_0xdafb('0x29')][_0xdafb('0x2a')],function(_0x4da387){return{'name':_0x4da387[_0xdafb('0x2b')],'type':_0x4da387[_0xdafb('0x2c')]['key']};});_0x102c91[_0xdafb('0x2d')]=_['map'](_0x2211d4,_0xdafb('0x25'));_0x102c91['query']=_['keys'](_0x51a77e['query']);_0x102c91[_0xdafb('0x2e')]=_['intersection'](_0x102c91['model'],_0x102c91[_0xdafb('0x2f')]);_0x3a494c[_0xdafb('0x30')]=_['intersection'](_0x102c91['model'],qs[_0xdafb('0x31')](_0x51a77e[_0xdafb('0x2f')][_0xdafb('0x31')]));_0x3a494c[_0xdafb('0x30')]=_0x3a494c[_0xdafb('0x30')][_0xdafb('0x32')]?_0x3a494c[_0xdafb('0x30')]:_0x102c91[_0xdafb('0x2d')];if(!_0x51a77e[_0xdafb('0x2f')][_0xdafb('0x33')](_0xdafb('0x34'))){_0x3a494c[_0xdafb('0x1b')]=qs['limit'](_0x51a77e['query'][_0xdafb('0x1b')]);_0x3a494c[_0xdafb('0x1a')]=qs[_0xdafb('0x1a')](_0x51a77e['query'][_0xdafb('0x1a')]);}_0x3a494c[_0xdafb('0x35')]=qs['sort'](_0x51a77e[_0xdafb('0x2f')][_0xdafb('0x36')]);_0x3a494c[_0xdafb('0x37')]=qs[_0xdafb('0x2e')](_['pick'](_0x51a77e[_0xdafb('0x2f')],_0x102c91[_0xdafb('0x2e')]),_0x2211d4);if(_0x51a77e[_0xdafb('0x2f')]['filter']){_0x3a494c['where']=_['merge'](_0x3a494c[_0xdafb('0x37')],{'$or':_[_0xdafb('0x28')](_0x2211d4,function(_0x447b39){if(_0x447b39[_0xdafb('0x2c')]!==_0xdafb('0x38')){var _0x2637e5={};_0x2637e5[_0x447b39[_0xdafb('0x25')]]={'$like':'%'+_0x51a77e['query'][_0xdafb('0x39')]+'%'};return _0x2637e5;}})});}_0x3a494c=_[_0xdafb('0x3a')]({},_0x3a494c,_0x51a77e['options']);var _0x693786={'where':_0x3a494c['where']};return db[_0xdafb('0x29')][_0xdafb('0x3b')](_0x693786)[_0xdafb('0x21')](function(_0x8a5ac2){_0x3bdd2a[_0xdafb('0x3b')]=_0x8a5ac2;if(_0x51a77e[_0xdafb('0x2f')][_0xdafb('0x3c')]){_0x3a494c['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0xdafb('0x3d')](_0x3a494c);})['then'](function(_0x180f1b){_0x3bdd2a['rows']=_0x180f1b;return _0x3bdd2a;})[_0xdafb('0x21')](respondWithFilteredResult(_0x4aa25e,_0x3a494c))[_0xdafb('0x3e')](handleError(_0x4aa25e,null));};exports[_0xdafb('0x3f')]=function(_0xebafdd,_0x59bf57){var _0x596b0b={'raw':!![],'where':{'id':_0xebafdd[_0xdafb('0x40')]['id']}},_0x2fa3ac={};_0x2fa3ac['model']=_[_0xdafb('0x41')](db[_0xdafb('0x29')]['rawAttributes']);_0x2fa3ac['query']=_[_0xdafb('0x41')](_0xebafdd[_0xdafb('0x2f')]);_0x2fa3ac[_0xdafb('0x2e')]=_[_0xdafb('0x42')](_0x2fa3ac[_0xdafb('0x2d')],_0x2fa3ac[_0xdafb('0x2f')]);_0x596b0b[_0xdafb('0x30')]=_[_0xdafb('0x42')](_0x2fa3ac['model'],qs[_0xdafb('0x31')](_0xebafdd['query'][_0xdafb('0x31')]));_0x596b0b['attributes']=_0x596b0b[_0xdafb('0x30')][_0xdafb('0x32')]?_0x596b0b['attributes']:_0x2fa3ac[_0xdafb('0x2d')];if(_0xebafdd[_0xdafb('0x2f')]['includeAll']){_0x596b0b[_0xdafb('0x43')]=[{'all':!![]}];}_0x596b0b=_['merge']({},_0x596b0b,_0xebafdd[_0xdafb('0x44')]);return db[_0xdafb('0x29')][_0xdafb('0x45')](_0x596b0b)[_0xdafb('0x21')](handleEntityNotFound(_0x59bf57,null))[_0xdafb('0x21')](respondWithResult(_0x59bf57,null))[_0xdafb('0x3e')](handleError(_0x59bf57,null));};exports[_0xdafb('0x46')]=function(_0x2a2738,_0x1658b8){return db['WhatsappApplication'][_0xdafb('0x46')](_0x2a2738[_0xdafb('0x47')],{})[_0xdafb('0x21')](respondWithResult(_0x1658b8,0xc9))[_0xdafb('0x3e')](handleError(_0x1658b8,null));};exports[_0xdafb('0x20')]=function(_0x2136fe,_0x54a3ad){if(_0x2136fe['body']['id']){delete _0x2136fe[_0xdafb('0x47')]['id'];}return db[_0xdafb('0x29')][_0xdafb('0x45')]({'where':{'id':_0x2136fe['params']['id']}})[_0xdafb('0x21')](handleEntityNotFound(_0x54a3ad,null))['then'](saveUpdates(_0x2136fe[_0xdafb('0x47')],null))['then'](respondWithResult(_0x54a3ad,null))[_0xdafb('0x3e')](handleError(_0x54a3ad,null));};exports[_0xdafb('0x22')]=function(_0x413553,_0x26dc81){return db[_0xdafb('0x29')][_0xdafb('0x45')]({'where':{'id':_0x413553[_0xdafb('0x40')]['id']}})[_0xdafb('0x21')](handleEntityNotFound(_0x26dc81,null))[_0xdafb('0x21')](removeEntity(_0x26dc81,null))['catch'](handleError(_0x26dc81,null));}; \ No newline at end of file +var _0x32d4=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','update','then','sendStatus','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','body','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x304d54,_0xe4c8b9){var _0x5f23a9=function(_0x3e7a06){while(--_0x3e7a06){_0x304d54['push'](_0x304d54['shift']());}};_0x5f23a9(++_0xe4c8b9);}(_0x32d4,0x197));var _0x432d=function(_0x8f1cee,_0x426ef0){_0x8f1cee=_0x8f1cee-0x0;var _0x13b10a=_0x32d4[_0x8f1cee];return _0x13b10a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x432d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x432d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x432d('0x2'));var moment=require(_0x432d('0x3'));var BPromise=require(_0x432d('0x4'));var Mustache=require(_0x432d('0x5'));var util=require('util');var path=require(_0x432d('0x6'));var sox=require('sox');var csv=require(_0x432d('0x7'));var ejs=require(_0x432d('0x8'));var fs=require('fs');var _=require(_0x432d('0x9'));var squel=require(_0x432d('0xa'));var crypto=require('crypto');var jsforce=require(_0x432d('0xb'));var deskjs=require(_0x432d('0xc'));var toCsv=require(_0x432d('0x7'));var querystring=require(_0x432d('0xd'));var Papa=require(_0x432d('0xe'));var Redis=require(_0x432d('0xf'));var authService=require(_0x432d('0x10'));var qs=require(_0x432d('0x11'));var as=require(_0x432d('0x12'));var hardwareService=require(_0x432d('0x13'));var logger=require('../../config/logger')(_0x432d('0x14'));var utils=require(_0x432d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x432d('0x16'));var db=require(_0x432d('0x17'))['db'];function respondWithStatusCode(_0x57671f,_0x11a1d9){_0x11a1d9=_0x11a1d9||0xcc;return function(_0x28a64f){if(_0x28a64f){return _0x57671f['sendStatus'](_0x11a1d9);}return _0x57671f[_0x432d('0x18')](_0x11a1d9)[_0x432d('0x19')]();};}function respondWithResult(_0x5edaf1,_0x4131cd){_0x4131cd=_0x4131cd||0xc8;return function(_0x59af9b){if(_0x59af9b){return _0x5edaf1[_0x432d('0x18')](_0x4131cd)['json'](_0x59af9b);}};}function respondWithFilteredResult(_0x32d168,_0x2e566b){return function(_0x312bbf){if(_0x312bbf){var _0x105126=_0x312bbf['count'],_0x2566ec=_0x2e566b[_0x432d('0x1a')],_0x412dc8=_0x2e566b[_0x432d('0x1a')]+_0x2e566b[_0x432d('0x1b')],_0x4a37f4;if(_0x412dc8>=_0x105126){_0x412dc8=_0x105126;_0x4a37f4=0xc8;}else{_0x4a37f4=0xce;}_0x32d168['status'](_0x4a37f4);return _0x32d168[_0x432d('0x1c')](_0x432d('0x1d'),_0x2566ec+'-'+_0x412dc8+'/'+_0x105126)[_0x432d('0x1e')](_0x312bbf);}return null;};}function patchUpdates(_0x17ec23){return function(_0x49f7c4){try{jsonpatch[_0x432d('0x1f')](_0x49f7c4,_0x17ec23,!![]);}catch(_0x50f135){return BPromise[_0x432d('0x20')](_0x50f135);}return _0x49f7c4['save']();};}function saveUpdates(_0x38ef78,_0xe46afa){return function(_0x40a5dc){if(_0x40a5dc){return _0x40a5dc[_0x432d('0x21')](_0x38ef78)[_0x432d('0x22')](function(_0x5e0a66){return _0x5e0a66;});}return null;};}function removeEntity(_0xd7bd26,_0x37cfb6){return function(_0x2fa85e){if(_0x2fa85e){return _0x2fa85e['destroy']()[_0x432d('0x22')](function(){_0xd7bd26[_0x432d('0x18')](0xcc)[_0x432d('0x19')]();});}};}function handleEntityNotFound(_0xb8a24a,_0x2379ea){return function(_0x3b705f){if(!_0x3b705f){_0xb8a24a[_0x432d('0x23')](0x194);}return _0x3b705f;};}function handleError(_0x45a93f,_0x3f42e5){_0x3f42e5=_0x3f42e5||0x1f4;return function(_0x1870d4){logger[_0x432d('0x24')](_0x1870d4['stack']);if(_0x1870d4[_0x432d('0x25')]){delete _0x1870d4[_0x432d('0x25')];}_0x45a93f[_0x432d('0x18')](_0x3f42e5)[_0x432d('0x26')](_0x1870d4);};}exports[_0x432d('0x27')]=function(_0x55701d,_0xe1fa10){var _0x3c1589={},_0x219f91={},_0x3dde4d={'count':0x0,'rows':[]};var _0x2db103=_[_0x432d('0x28')](db[_0x432d('0x29')][_0x432d('0x2a')],function(_0x2fd06a){return{'name':_0x2fd06a[_0x432d('0x2b')],'type':_0x2fd06a[_0x432d('0x2c')]['key']};});_0x219f91[_0x432d('0x2d')]=_[_0x432d('0x28')](_0x2db103,_0x432d('0x25'));_0x219f91['query']=_[_0x432d('0x2e')](_0x55701d[_0x432d('0x2f')]);_0x219f91['filters']=_[_0x432d('0x30')](_0x219f91[_0x432d('0x2d')],_0x219f91[_0x432d('0x2f')]);_0x3c1589[_0x432d('0x31')]=_[_0x432d('0x30')](_0x219f91[_0x432d('0x2d')],qs[_0x432d('0x32')](_0x55701d[_0x432d('0x2f')][_0x432d('0x32')]));_0x3c1589[_0x432d('0x31')]=_0x3c1589[_0x432d('0x31')][_0x432d('0x33')]?_0x3c1589[_0x432d('0x31')]:_0x219f91[_0x432d('0x2d')];if(!_0x55701d[_0x432d('0x2f')]['hasOwnProperty'](_0x432d('0x34'))){_0x3c1589[_0x432d('0x1b')]=qs[_0x432d('0x1b')](_0x55701d['query']['limit']);_0x3c1589['offset']=qs[_0x432d('0x1a')](_0x55701d[_0x432d('0x2f')][_0x432d('0x1a')]);}_0x3c1589['order']=qs[_0x432d('0x35')](_0x55701d['query'][_0x432d('0x35')]);_0x3c1589['where']=qs[_0x432d('0x36')](_['pick'](_0x55701d['query'],_0x219f91[_0x432d('0x36')]),_0x2db103);if(_0x55701d[_0x432d('0x2f')][_0x432d('0x37')]){_0x3c1589[_0x432d('0x38')]=_[_0x432d('0x39')](_0x3c1589[_0x432d('0x38')],{'$or':_[_0x432d('0x28')](_0x2db103,function(_0x574fbd){if(_0x574fbd[_0x432d('0x2c')]!==_0x432d('0x3a')){var _0x193fff={};_0x193fff[_0x574fbd[_0x432d('0x25')]]={'$like':'%'+_0x55701d[_0x432d('0x2f')][_0x432d('0x37')]+'%'};return _0x193fff;}})});}_0x3c1589=_['merge']({},_0x3c1589,_0x55701d[_0x432d('0x3b')]);var _0x5bdcc4={'where':_0x3c1589[_0x432d('0x38')]};return db[_0x432d('0x29')][_0x432d('0x3c')](_0x5bdcc4)[_0x432d('0x22')](function(_0x12a29d){_0x3dde4d[_0x432d('0x3c')]=_0x12a29d;if(_0x55701d[_0x432d('0x2f')][_0x432d('0x3d')]){_0x3c1589[_0x432d('0x3e')]=[{'all':!![]}];}return db[_0x432d('0x29')][_0x432d('0x3f')](_0x3c1589);})[_0x432d('0x22')](function(_0x299fc0){_0x3dde4d['rows']=_0x299fc0;return _0x3dde4d;})[_0x432d('0x22')](respondWithFilteredResult(_0xe1fa10,_0x3c1589))[_0x432d('0x40')](handleError(_0xe1fa10,null));};exports[_0x432d('0x41')]=function(_0x85fd98,_0x1392ef){var _0x13355b={'raw':!![],'where':{'id':_0x85fd98[_0x432d('0x42')]['id']}},_0x313a50={};_0x313a50[_0x432d('0x2d')]=_['keys'](db[_0x432d('0x29')][_0x432d('0x2a')]);_0x313a50[_0x432d('0x2f')]=_[_0x432d('0x2e')](_0x85fd98['query']);_0x313a50[_0x432d('0x36')]=_[_0x432d('0x30')](_0x313a50[_0x432d('0x2d')],_0x313a50[_0x432d('0x2f')]);_0x13355b[_0x432d('0x31')]=_['intersection'](_0x313a50[_0x432d('0x2d')],qs[_0x432d('0x32')](_0x85fd98['query'][_0x432d('0x32')]));_0x13355b['attributes']=_0x13355b[_0x432d('0x31')]['length']?_0x13355b[_0x432d('0x31')]:_0x313a50[_0x432d('0x2d')];if(_0x85fd98[_0x432d('0x2f')][_0x432d('0x3d')]){_0x13355b[_0x432d('0x3e')]=[{'all':!![]}];}_0x13355b=_['merge']({},_0x13355b,_0x85fd98[_0x432d('0x3b')]);return db[_0x432d('0x29')][_0x432d('0x43')](_0x13355b)[_0x432d('0x22')](handleEntityNotFound(_0x1392ef,null))[_0x432d('0x22')](respondWithResult(_0x1392ef,null))['catch'](handleError(_0x1392ef,null));};exports['create']=function(_0x483235,_0x1a8de2){return db[_0x432d('0x29')]['create'](_0x483235[_0x432d('0x44')],{})[_0x432d('0x22')](respondWithResult(_0x1a8de2,0xc9))[_0x432d('0x40')](handleError(_0x1a8de2,null));};exports[_0x432d('0x21')]=function(_0x5de7a7,_0x1a5224){if(_0x5de7a7['body']['id']){delete _0x5de7a7['body']['id'];}return db['WhatsappApplication'][_0x432d('0x43')]({'where':{'id':_0x5de7a7[_0x432d('0x42')]['id']}})[_0x432d('0x22')](handleEntityNotFound(_0x1a5224,null))['then'](saveUpdates(_0x5de7a7[_0x432d('0x44')],null))['then'](respondWithResult(_0x1a5224,null))['catch'](handleError(_0x1a5224,null));};exports[_0x432d('0x45')]=function(_0x242810,_0x17a348){return db[_0x432d('0x29')][_0x432d('0x43')]({'where':{'id':_0x242810[_0x432d('0x42')]['id']}})[_0x432d('0x22')](handleEntityNotFound(_0x17a348,null))[_0x432d('0x22')](removeEntity(_0x17a348,null))[_0x432d('0x40')](handleError(_0x17a348,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5f2b363..7ba51ae 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 _0x59d7=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x267ed6,_0x2a2991){var _0x196876=function(_0x11d037){while(--_0x11d037){_0x267ed6['push'](_0x267ed6['shift']());}};_0x196876(++_0x2a2991);}(_0x59d7,0xec));var _0x759d=function(_0x186222,_0x3bdfb0){_0x186222=_0x186222-0x0;var _0x226a38=_0x59d7[_0x186222];return _0x226a38;};'use strict';var _=require(_0x759d('0x0'));var util=require(_0x759d('0x1'));var logger=require(_0x759d('0x2'))(_0x759d('0x3'));var moment=require('moment');var BPromise=require(_0x759d('0x4'));var rp=require(_0x759d('0x5'));var fs=require('fs');var path=require(_0x759d('0x6'));var rimraf=require(_0x759d('0x7'));var config=require(_0x759d('0x8'));var attributes=require(_0x759d('0x9'));module[_0x759d('0xa')]=function(_0x4b6a05,_0xe7ad3e){return _0x4b6a05[_0x759d('0xb')](_0x759d('0xc'),attributes,{'tableName':_0x759d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x759d('0xe'),'collate':_0x759d('0xf')});}; \ No newline at end of file +var _0x7383=['../../config/logger','api','moment','bluebird','path','rimraf','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x12def7,_0x25b3f9){var _0x2e024d=function(_0x367e2b){while(--_0x367e2b){_0x12def7['push'](_0x12def7['shift']());}};_0x2e024d(++_0x25b3f9);}(_0x7383,0x17f));var _0x3738=function(_0x30fd82,_0x54c496){_0x30fd82=_0x30fd82-0x0;var _0x2a6457=_0x7383[_0x30fd82];return _0x2a6457;};'use strict';var _=require(_0x3738('0x0'));var util=require('util');var logger=require(_0x3738('0x1'))(_0x3738('0x2'));var moment=require(_0x3738('0x3'));var BPromise=require(_0x3738('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3738('0x5'));var rimraf=require(_0x3738('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x3986bc,_0x247337){return _0x3986bc[_0x3738('0x7')](_0x3738('0x8'),attributes,{'tableName':_0x3738('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3738('0xa'),'collate':_0x3738('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b5d40b8..7723d0d 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 _0x8b8e=['message','info','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3dacb8,_0x48eab5){var _0x16d5a0=function(_0x1397bf){while(--_0x1397bf){_0x3dacb8['push'](_0x3dacb8['shift']());}};_0x16d5a0(++_0x48eab5);}(_0x8b8e,0x108));var _0xe8b8=function(_0x57d162,_0x43e734){_0x57d162=_0x57d162-0x0;var _0x39db67=_0x8b8e[_0x57d162];return _0x39db67;};'use strict';var _=require(_0xe8b8('0x0'));var util=require('util');var moment=require(_0xe8b8('0x1'));var BPromise=require('bluebird');var rs=require(_0xe8b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8b8('0x3'));var logger=require(_0xe8b8('0x4'))(_0xe8b8('0x5'));var config=require(_0xe8b8('0x6'));var jayson=require(_0xe8b8('0x7'));var client=jayson[_0xe8b8('0x8')][_0xe8b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b3269,_0x229e0b,_0x2540e3){return new BPromise(function(_0x4ce796,_0x2a4ccd){return client['request'](_0x2b3269,_0x2540e3)[_0xe8b8('0xa')](function(_0x4ea70a){logger['info'](_0xe8b8('0xb'),_0x229e0b,_0xe8b8('0xc'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x229e0b,_0xe8b8('0xc'),JSON[_0xe8b8('0xd')](_0x4ea70a));if(_0x4ea70a[_0xe8b8('0xe')]){if(_0x4ea70a[_0xe8b8('0xe')][_0xe8b8('0xf')]===0x1f4){logger[_0xe8b8('0xe')](_0xe8b8('0xb'),_0x229e0b,_0x4ea70a[_0xe8b8('0xe')][_0xe8b8('0x10')]);return _0x2a4ccd(_0x4ea70a[_0xe8b8('0xe')][_0xe8b8('0x10')]);}logger[_0xe8b8('0xe')](_0xe8b8('0xb'),_0x229e0b,_0x4ea70a[_0xe8b8('0xe')]['message']);return _0x4ce796(_0x4ea70a[_0xe8b8('0xe')]['message']);}else{logger[_0xe8b8('0x11')](_0xe8b8('0xb'),_0x229e0b,_0xe8b8('0xc'));_0x4ce796(_0x4ea70a[_0xe8b8('0x12')][_0xe8b8('0x10')]);}})[_0xe8b8('0x13')](function(_0x3f0e52){logger[_0xe8b8('0xe')](_0xe8b8('0xb'),_0x229e0b,_0x3f0e52);_0x2a4ccd(_0x3f0e52);});});} \ No newline at end of file +var _0x46ed=['WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x46ed,0x168));var _0xd46e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x46ed[_0x5d6456];return _0x4d66c1;};'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')]('WhatsappApplication,\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);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 795bd5d..a776fd5 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 _0x00b0=['update','tracked','whatsappinteraction:destroy','destroy','delete','removeTags','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','whatsappinteraction:update'];(function(_0x11d5a9,_0xcc465a){var _0x13018c=function(_0xd6d7f0){while(--_0xd6d7f0){_0x11d5a9['push'](_0x11d5a9['shift']());}};_0x13018c(++_0xcc465a);}(_0x00b0,0x67));var _0x000b=function(_0x3cae9f,_0x5bcb00){_0x3cae9f=_0x3cae9f-0x0;var _0x43bc23=_0x00b0[_0x3cae9f];return _0x43bc23;};'use strict';var multer=require('multer');var util=require(_0x000b('0x0'));var path=require(_0x000b('0x1'));var timeout=require(_0x000b('0x2'));var express=require(_0x000b('0x3'));var router=express['Router']();var auth=require(_0x000b('0x4'));var interaction=require(_0x000b('0x5'));var config=require(_0x000b('0x6'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x000b('0x7')]);router[_0x000b('0x8')](_0x000b('0x9'),auth[_0x000b('0xa')](),controller[_0x000b('0xb')]);router[_0x000b('0x8')](_0x000b('0xc'),auth['isAuthenticated'](),controller[_0x000b('0xd')]);router['get'](_0x000b('0xe'),auth['isAuthenticated'](),controller[_0x000b('0xf')]);router['get'](_0x000b('0x10'),auth[_0x000b('0xa')](),controller[_0x000b('0x11')]);router['post']('/',auth[_0x000b('0xa')](),controller[_0x000b('0x12')]);router[_0x000b('0x13')](_0x000b('0xe'),auth[_0x000b('0xa')](),controller[_0x000b('0x14')]);router[_0x000b('0x13')](_0x000b('0x15'),auth[_0x000b('0xa')](),interaction['tracked'](_0x000b('0x16'),_0x000b('0x17')),controller['addTags']);router['put'](_0x000b('0xc'),auth[_0x000b('0xa')](),interaction['tracked'](_0x000b('0x16'),_0x000b('0x18')),controller[_0x000b('0x19')]);router['delete'](_0x000b('0xc'),auth[_0x000b('0xa')](),interaction[_0x000b('0x1a')](_0x000b('0x16'),_0x000b('0x1b')),controller[_0x000b('0x1c')]);router[_0x000b('0x1d')](_0x000b('0x15'),auth[_0x000b('0xa')](),controller[_0x000b('0x1e')]);module[_0x000b('0x1f')]=router; \ No newline at end of file +var _0x0efb=['util','connect-timeout','express','Router','../../components/auth/service','get','describe','/:id','isAuthenticated','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports'];(function(_0x4fabde,_0x1b9cf0){var _0x3fdb85=function(_0x2b17c4){while(--_0x2b17c4){_0x4fabde['push'](_0x4fabde['shift']());}};_0x3fdb85(++_0x1b9cf0);}(_0x0efb,0x1e6));var _0xb0ef=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x0efb[_0x326e79];return _0x37eb89;};'use strict';var multer=require('multer');var util=require(_0xb0ef('0x0'));var path=require('path');var timeout=require(_0xb0ef('0x1'));var express=require(_0xb0ef('0x2'));var router=express[_0xb0ef('0x3')]();var auth=require(_0xb0ef('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0xb0ef('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb0ef('0x6')]);router[_0xb0ef('0x5')](_0xb0ef('0x7'),auth[_0xb0ef('0x8')](),controller[_0xb0ef('0x9')]);router[_0xb0ef('0x5')](_0xb0ef('0xa'),auth[_0xb0ef('0x8')](),controller['getMessages']);router[_0xb0ef('0x5')]('/:id/download',auth['isAuthenticated'](),controller[_0xb0ef('0xb')]);router[_0xb0ef('0xc')]('/',auth['isAuthenticated'](),controller[_0xb0ef('0xd')]);router[_0xb0ef('0xc')](_0xb0ef('0xa'),auth[_0xb0ef('0x8')](),controller[_0xb0ef('0xe')]);router[_0xb0ef('0xc')](_0xb0ef('0xf'),auth['isAuthenticated'](),interaction[_0xb0ef('0x10')](_0xb0ef('0x11'),'whatsappinteraction:addtags'),controller[_0xb0ef('0x12')]);router[_0xb0ef('0x13')]('/:id',auth[_0xb0ef('0x8')](),interaction['tracked'](_0xb0ef('0x11'),_0xb0ef('0x14')),controller[_0xb0ef('0x15')]);router[_0xb0ef('0x16')](_0xb0ef('0x7'),auth[_0xb0ef('0x8')](),interaction[_0xb0ef('0x10')](_0xb0ef('0x11'),_0xb0ef('0x17')),controller[_0xb0ef('0x18')]);router[_0xb0ef('0x16')](_0xb0ef('0xf'),auth[_0xb0ef('0x8')](),controller[_0xb0ef('0x19')]);module[_0xb0ef('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 873c9f5..7ad7567 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 _0x4808=['DATE','STRING','out','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x4808,0x1cc));var _0x8480=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x4808[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require(_0x8480('0x0'));var moment=require(_0x8480('0x1'));module[_0x8480('0x2')]={'closed':{'type':Sequelize[_0x8480('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8480('0x4')]},'disposition':{'type':Sequelize[_0x8480('0x5')]},'secondDisposition':{'type':Sequelize[_0x8480('0x5')]},'thirdDisposition':{'type':Sequelize[_0x8480('0x5')]},'note':{'type':Sequelize[_0x8480('0x5')]},'phone':{'type':Sequelize[_0x8480('0x5')]},'read1stAt':{'type':Sequelize[_0x8480('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8480('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8480('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8480('0x7')]('in',_0x8480('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x55b5=['STRING','ENUM','sequelize','moment','DATE'];(function(_0x2775f5,_0x1de259){var _0x4e8374=function(_0x12c20a){while(--_0x12c20a){_0x2775f5['push'](_0x2775f5['shift']());}};_0x4e8374(++_0x1de259);}(_0x55b5,0x11a));var _0x555b=function(_0x576ed4,_0x168a06){_0x576ed4=_0x576ed4-0x0;var _0x424bbc=_0x55b5[_0x576ed4];return _0x424bbc;};'use strict';var Sequelize=require(_0x555b('0x0'));var moment=require(_0x555b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x555b('0x2')]},'disposition':{'type':Sequelize[_0x555b('0x3')]},'secondDisposition':{'type':Sequelize[_0x555b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x555b('0x3')]},'note':{'type':Sequelize[_0x555b('0x3')]},'phone':{'type':Sequelize[_0x555b('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x555b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x555b('0x4')]('in','out'),'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 826ed3c..3d141aa 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 _0xc6ac=['getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','WhatsappAccountId','sequelize','toString','keyBy','merge','unreadMessages','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','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','catch','show','params','includeAll','include','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','firstName','Attachment','direction','secret','WhatsappAccount','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','\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.','createdAt','closed','closedAt','disposition','Messages','existsSync','createReadStream','createWriteStream','out','System','lastName','basename','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','field','from','select','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','where','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','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','Sequelize','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role'];(function(_0x5243bd,_0x41ebca){var _0x204713=function(_0x305d6){while(--_0x305d6){_0x5243bd['push'](_0x5243bd['shift']());}};_0x204713(++_0x41ebca);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x3559ec,_0x3c30e8){_0x3559ec=_0x3559ec-0x0;var _0x214fe8=_0xc6ac[_0x3559ec];return _0x214fe8;};'use strict';var pdf=require(_0xcc6a('0x0'));var emlformat=require(_0xcc6a('0x1'));var rimraf=require(_0xcc6a('0x2'));var zipdir=require(_0xcc6a('0x3'));var jsonpatch=require(_0xcc6a('0x4'));var rp=require(_0xcc6a('0x5'));var moment=require(_0xcc6a('0x6'));var BPromise=require(_0xcc6a('0x7'));var Mustache=require(_0xcc6a('0x8'));var util=require(_0xcc6a('0x9'));var path=require(_0xcc6a('0xa'));var sox=require(_0xcc6a('0xb'));var csv=require(_0xcc6a('0xc'));var ejs=require(_0xcc6a('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xc'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xcc6a('0x1b')](config[_0xcc6a('0x1c')],{'host':_0xcc6a('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcc6a('0x1e'))[_0xcc6a('0x1f')](socket);function respondWithStatusCode(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xcc;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x20')](_0x348af7);}return _0x43710d[_0xcc6a('0x21')](_0x348af7)[_0xcc6a('0x22')]();};}function respondWithResult(_0x56ffb0,_0x4e628f){_0x4e628f=_0x4e628f||0xc8;return function(_0x4d021a){if(_0x4d021a){return _0x56ffb0[_0xcc6a('0x21')](_0x4e628f)[_0xcc6a('0x23')](_0x4d021a);}};}function respondWithFilteredResult(_0x307f2a,_0x3e63d9){return function(_0x33079c){if(_0x33079c){var _0x12ef33=_0x33079c[_0xcc6a('0x24')],_0x2d9585=_0x3e63d9[_0xcc6a('0x25')],_0x412bc7=_0x3e63d9['offset']+_0x3e63d9[_0xcc6a('0x26')],_0x374e51;if(_0x412bc7>=_0x12ef33){_0x412bc7=_0x12ef33;_0x374e51=0xc8;}else{_0x374e51=0xce;}_0x307f2a[_0xcc6a('0x21')](_0x374e51);return _0x307f2a[_0xcc6a('0x27')](_0xcc6a('0x28'),_0x2d9585+'-'+_0x412bc7+'/'+_0x12ef33)[_0xcc6a('0x23')](_0x33079c);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x29')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x2a')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x2b')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x2c')](_0x845088)[_0xcc6a('0x2d')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2e')]()[_0xcc6a('0x2d')](function(){_0x10016a[_0xcc6a('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26def8,_0x29d8be){return function(_0x3514f3){if(!_0x3514f3){_0x26def8['sendStatus'](0x194);}return _0x3514f3;};}function handleError(_0x3afb3a,_0x3dad72){_0x3dad72=_0x3dad72||0x1f4;return function(_0x4da301){logger[_0xcc6a('0x2f')](_0x4da301[_0xcc6a('0x30')]);if(_0x4da301[_0xcc6a('0x31')]){delete _0x4da301[_0xcc6a('0x31')];}_0x3afb3a['status'](_0x3dad72)[_0xcc6a('0x32')](_0x4da301);};}function getInteractionUsers(_0x3cf14c,_0x2c6d88){return new BPromise(function(_0x4f176b,_0x2590a2){try{if(_0x2c6d88[_0x3cf14c['id']]){_0x3cf14c['Users']=_['map'](_0x2c6d88[_0x3cf14c['id']],function(_0x33b72b){return{'id':_0x33b72b['id'],'fullname':_0x33b72b[_0xcc6a('0x33')]};});}}catch(_0x3aa315){_0x2590a2(_0x3aa315);}_0x4f176b(_0x3cf14c);});}function getInteractionTags(_0x11b481,_0x2b575d){return new BPromise(function(_0x131138,_0x4e2de4){try{if(_0x11b481[_0xcc6a('0x34')]){_0x11b481[_0xcc6a('0x35')]=[];_0x11b481[_0xcc6a('0x34')][_0xcc6a('0x36')](',')[_0xcc6a('0x37')](function(_0x152ebd){_0x11b481[_0xcc6a('0x35')][_0xcc6a('0x38')](_0x2b575d[_0x152ebd]);});}delete _0x11b481['TagIds'];}catch(_0x36fc25){_0x4e2de4(_0x36fc25);}_0x131138(_0x11b481);});}function updateWhatsappInteraction(_0xc8c90c,_0x3769b2,_0x1538bc){return new BPromise(function(_0x30d6e1,_0x711a58){return getInteractionUsers(_0xc8c90c,_0x1538bc)[_0xcc6a('0x2d')](function(_0x5afbbc){return getInteractionTags(_0x5afbbc,_0x3769b2);})[_0xcc6a('0x2d')](function(_0x5a41b4){_0x30d6e1(_0x5a41b4);})['catch'](function(_0x50cfe0){_0x711a58(_0x50cfe0);});});}exports[_0xcc6a('0x39')]=function(_0x2a3e93,_0x1101ec){var _0xe213b3={},_0x1dc64f={},_0x5856af={'count':0x0,'rows':[]};var _0x58f6ee=_[_0xcc6a('0x3a')](db[_0xcc6a('0x3b')][_0xcc6a('0x3c')],function(_0x538ea5){return{'name':_0x538ea5[_0xcc6a('0x3d')],'type':_0x538ea5[_0xcc6a('0x3e')][_0xcc6a('0x3f')]};});_0x1dc64f[_0xcc6a('0x40')]=_[_0xcc6a('0x3a')](_0x58f6ee,_0xcc6a('0x31'));_0x1dc64f[_0xcc6a('0x41')]=_[_0xcc6a('0x42')](_0x2a3e93[_0xcc6a('0x41')]);_0x1dc64f[_0xcc6a('0x43')]=_[_0xcc6a('0x44')](_0x1dc64f[_0xcc6a('0x40')],_0x1dc64f[_0xcc6a('0x41')]);_0xe213b3[_0xcc6a('0x45')]=_[_0xcc6a('0x44')](_0x1dc64f[_0xcc6a('0x40')],qs[_0xcc6a('0x46')](_0x2a3e93[_0xcc6a('0x41')]['fields']));_0xe213b3['attributes']=_0xe213b3[_0xcc6a('0x45')][_0xcc6a('0x47')]?_0xe213b3[_0xcc6a('0x45')]:_0x1dc64f[_0xcc6a('0x40')];if(!_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x48')](_0xcc6a('0x49'))){_0xe213b3[_0xcc6a('0x26')]=qs['limit'](_0x2a3e93['query'][_0xcc6a('0x26')]);_0xe213b3['offset']=qs['offset'](_0x2a3e93['query'][_0xcc6a('0x25')]);}_0xe213b3[_0xcc6a('0x4a')]=qs[_0xcc6a('0x4b')](_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x4b')]);_0xe213b3['where']=qs[_0xcc6a('0x43')](_[_0xcc6a('0x4c')](_0x2a3e93[_0xcc6a('0x41')],_0x1dc64f[_0xcc6a('0x43')]),_0x58f6ee);var _0x14ca90=[];var _0x2235e0=squel['select']()[_0xcc6a('0x4d')]('id')[_0xcc6a('0x4d')](_0xcc6a('0x31'))[_0xcc6a('0x4d')]('color')[_0xcc6a('0x4e')]('tools_tags');var _0x351529=squel[_0xcc6a('0x4f')]()[_0xcc6a('0x4d')]('u.id')[_0xcc6a('0x4d')](_0xcc6a('0x50'))[_0xcc6a('0x4d')]('ui.WhatsappInteractionId')['from'](_0xcc6a('0x51'),'ui')[_0xcc6a('0x52')](_0xcc6a('0x53'),'u',_0xcc6a('0x54'));var _0x345e94=squel['select']()[_0xcc6a('0x4e')](_0xcc6a('0x55'),'i')['left_join'](_0xcc6a('0x56'),'c',_0xcc6a('0x57'))[_0xcc6a('0x52')](_0xcc6a('0x53'),'o',_0xcc6a('0x58'))[_0xcc6a('0x52')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')['left_join'](_0xcc6a('0x59'),'me',_0xcc6a('0x5a'))[_0xcc6a('0x52')](_0xcc6a('0x5b'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xcc6a('0x52')]('tools_tags','t',_0xcc6a('0x5c'));var _0x4299ca=squel[_0xcc6a('0x5d')]();var _0x321b74=[];var _0x41be6d=squel[_0xcc6a('0x5d')]();var _0x47b175;if(_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x5e')]){_0x47b175=as[_0xcc6a('0x5f')](_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x5e')]);var _0x362bf6=_0x47b175[_0xcc6a('0x60')];for(var _0x392805=0x0;_0x392805<_0x47b175[_0xcc6a('0x61')][_0xcc6a('0x47')];_0x392805++){var _0x486072=_0x47b175[_0xcc6a('0x61')][_0x392805];var _0x3197b5='i';var _0xbed299=_[_0xcc6a('0x62')](_0x58f6ee,[_0xcc6a('0x31'),_0x486072[_0xcc6a('0x4d')]]);if(!_0xbed299){switch(_0x486072['field']){case'unreadMessages':if(_0x486072[_0xcc6a('0x63')]==0x1){_0x345e94['having']('`'+_0x486072[_0xcc6a('0x4d')]+_0xcc6a('0x64'));}else{_0x345e94[_0xcc6a('0x65')]('`'+_0x486072[_0xcc6a('0x4d')]+_0xcc6a('0x66'));}break;case _0xcc6a('0x67'):if(_0x486072[_0xcc6a('0x68')]===_0xcc6a('0x69')){if(_0x486072[_0xcc6a('0x63')][_0xcc6a('0x36')]('\x20')[_0xcc6a('0x47')]>0x1){_0x4299ca[_0x362bf6]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcc6a('0x6a')](_0x486072['value']),null);}else{var _0x378679='%'+_0x486072[_0xcc6a('0x63')]+'%';_0x4299ca[_0x362bf6](_0xcc6a('0x6b'),_0x378679,_0x378679,_0x378679);}}else{_0xbed299=_['find'](_0x58f6ee,[_0xcc6a('0x31'),'ContactId']);_0x486072[_0xcc6a('0x4d')]='ContactId';_0x247188=as[_0xcc6a('0x6c')](_0x3197b5,_0xbed299[_0xcc6a('0x3e')],_0x486072);_0x4299ca[_0x362bf6](_0x247188[_0xcc6a('0x6d')],_0x247188[_0xcc6a('0x63')][_0xcc6a('0x6e')],_0x247188[_0xcc6a('0x63')][_0xcc6a('0x22')]);}break;case _0xcc6a('0x6f'):var _0x506311=_0x486072[_0xcc6a('0x63')]['split'](',')[_0xcc6a('0x3a')](function(_0x49dd51){return Number(_0x49dd51);});_0x506311[_0xcc6a('0x37')](function(_0x242892){_0x41be6d['or'](_0xcc6a('0x70'),'%,'+_0x242892+',%');});_0x321b74=_['union'](_0x321b74,_0x506311);break;case _0xcc6a('0x71'):if(_0x486072['operator']==='$substring'){_0x4299ca[_0x362bf6](_0xcc6a('0x72'),'%'+_0x486072[_0xcc6a('0x63')]+'%',null);}else{_0xbed299=_[_0xcc6a('0x62')](_0x58f6ee,[_0xcc6a('0x31'),_0xcc6a('0x73')]);_0x486072[_0xcc6a('0x4d')]=_0xcc6a('0x73');_0x247188=as[_0xcc6a('0x6c')](_0x3197b5,_0xbed299[_0xcc6a('0x3e')],_0x486072);_0x4299ca[_0x362bf6](_0x247188[_0xcc6a('0x6d')],_0x247188[_0xcc6a('0x63')][_0xcc6a('0x6e')],_0x247188[_0xcc6a('0x63')]['end']);}break;case _0xcc6a('0x74'):_0x247188=as[_0xcc6a('0x6c')]('me',null,_0x486072);_0x4299ca[_0x362bf6](_0x247188[_0xcc6a('0x6d')],_0x247188[_0xcc6a('0x63')]['start'],_0x247188[_0xcc6a('0x63')][_0xcc6a('0x22')]);break;}}else{var _0x247188=as[_0xcc6a('0x6c')](_0x3197b5,_0xbed299[_0xcc6a('0x3e')],_0x486072);_0x4299ca[_0x362bf6](_0x247188[_0xcc6a('0x6d')],_0x247188[_0xcc6a('0x63')][_0xcc6a('0x6e')],_0x247188[_0xcc6a('0x63')][_0xcc6a('0x22')]);}}}else{var _0x4c5e4e=_(_0x2a3e93['query'])['keys']()[_0xcc6a('0x3a')](function(_0x332c20){return _[_0xcc6a('0x75')](_0x58f6ee,['name',_0x332c20])?_0x332c20:undefined;})[_0xcc6a('0x76')]()[_0xcc6a('0x63')]();if(!_[_0xcc6a('0x77')](_0x4c5e4e)){_0x4c5e4e[_0xcc6a('0x37')](function(_0x5e1c69){if(_0x5e1c69==='WhatsappAccountId'){_0x345e94[_0xcc6a('0x78')](_0xcc6a('0x79'),[][_0xcc6a('0x7a')](_0x2a3e93[_0xcc6a('0x41')][_0x5e1c69]));}else if(_0x5e1c69==='createdAt'){var _0x33cd69=JSON[_0xcc6a('0x7b')](_0x2a3e93[_0xcc6a('0x41')][_0x5e1c69])[_0xcc6a('0x7c')];var _0x3a0d36=JSON['parse'](_0x2a3e93['query'][_0x5e1c69])[_0xcc6a('0x7d')];_0x345e94[_0xcc6a('0x78')](_0xcc6a('0x7e'),_0x33cd69,_0x3a0d36);}else{if(_0x2a3e93[_0xcc6a('0x41')][_0x5e1c69]==='null'){_0x345e94['where']('i.'+_0x5e1c69+_0xcc6a('0x7f'));}else{_0x345e94[_0xcc6a('0x78')]('i.'+_0x5e1c69+_0xcc6a('0x80'),_0x2a3e93[_0xcc6a('0x41')][_0x5e1c69]);}}});}if(_0x2a3e93['query']['read']){if(_0x2a3e93['query'][_0xcc6a('0x81')]==0x1){_0x345e94[_0xcc6a('0x65')](_0xcc6a('0x82'));}else{_0x345e94[_0xcc6a('0x65')]('`unreadMessages`\x20>\x200');}}if(_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x83')]){_0x321b74=_['isArray'](_0x2a3e93[_0xcc6a('0x41')]['tag'])?_0x2a3e93[_0xcc6a('0x41')]['tag']:new Array(_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x83')]);_0x321b74[_0xcc6a('0x37')](function(_0x4da2bc){_0x41be6d['or'](_0xcc6a('0x70'),'%,'+_0x4da2bc+',%');});}if(_0x2a3e93['query'][_0xcc6a('0x84')]){var _0x54ab25=_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x84')][_0xcc6a('0x85')]('\x5c','\x5c\x5c')[_0xcc6a('0x85')](/'/g,'\x27\x27');if(qs[_0xcc6a('0x86')](_0x54ab25)){_0x4299ca['or'](_0xcc6a('0x87'),_0x54ab25+'%')['or']('i.phone\x20LIKE\x20?',_0x54ab25+'%');}else{_0x4299ca['or'](_0xcc6a('0x88'),qs[_0xcc6a('0x6a')](_0x54ab25))['or'](_0xcc6a('0x89'),_0x54ab25+'%');}}}_0x345e94[_0xcc6a('0x78')](_0x4299ca);_0x345e94[_0xcc6a('0x8a')]('i.id');var _0xcc68cf={'type':db[_0xcc6a('0x8b')]['QueryTypes']['SELECT'],'raw':!![]};var _0x2fbdce=_0x345e94[_0xcc6a('0x8c')]();_0x2fbdce[_0xcc6a('0x4d')](_0xcc6a('0x8d'));_0x2fbdce[_0xcc6a('0x4d')](_0xcc6a('0x8e'),'unreadMessages');if(_0xe213b3[_0xcc6a('0x4a')]){_0xe213b3[_0xcc6a('0x4a')][_0xcc6a('0x37')](function(_0x3e31bd){var _0x19a582=_0x3e31bd[0x0]===_0xcc6a('0x8f')?_0x3e31bd[0x0]:'i.'+_0x3e31bd[0x0];_0x345e94['order'](_0x19a582,_0x3e31bd[0x1]==='DESC'?![]:!![]);});}if(!_[_0xcc6a('0x77')](_0x321b74)){_0x345e94[_0xcc6a('0x65')](_0x41be6d);_0x2fbdce[_0xcc6a('0x78')](_0xcc6a('0x90'),_0x321b74);}BPromise[_0xcc6a('0x91')]()[_0xcc6a('0x2d')](function(){if(!_0x47b175){if(_0x2a3e93[_0xcc6a('0x41')]['WhatsappAccountId'])return;_0x2fbdce[_0xcc6a('0x78')](_0xcc6a('0x92'));_0x345e94[_0xcc6a('0x78')](_0xcc6a('0x92'));return;}if(_0x2a3e93[_0xcc6a('0x93')][_0xcc6a('0x94')]!=='agent')return;return _0x2a3e93[_0xcc6a('0x93')][_0xcc6a('0x95')]({'attributes':['id'],'raw':!![]})[_0xcc6a('0x2d')](function(_0x5ad57c){if(_[_0xcc6a('0x77')](_0x5ad57c)){_0x2fbdce[_0xcc6a('0x78')](_0xcc6a('0x96'));_0x345e94[_0xcc6a('0x78')](_0xcc6a('0x96'));}else{_0x2fbdce[_0xcc6a('0x78')]('i.WhatsappAccountId\x20IN\x20?',_[_0xcc6a('0x3a')](_0x5ad57c,'id'));_0x345e94[_0xcc6a('0x78')]('i.WhatsappAccountId\x20IN\x20?',_[_0xcc6a('0x3a')](_0x5ad57c,'id'));}});})[_0xcc6a('0x2d')](function(){if(_0x2a3e93[_0xcc6a('0x93')][_0xcc6a('0x94')]===_0xcc6a('0x97')&&!_0x47b175&&!_0x2a3e93['query'][_0xcc6a('0x98')])return[];return db[_0xcc6a('0x99')][_0xcc6a('0x41')](_0x2fbdce[_0xcc6a('0x9a')](),_0xcc68cf);})[_0xcc6a('0x2d')](function(_0xaa0da6){_0x5856af['count']=_0xaa0da6['length'];if(_0x5856af[_0xcc6a('0x24')]===0x0)return[];return db['sequelize'][_0xcc6a('0x41')](_0x2235e0[_0xcc6a('0x9a')](),_0xcc68cf)[_0xcc6a('0x2d')](function(_0x1b8d31){_0x14ca90=_[_0xcc6a('0x9b')](_0x1b8d31,'id');_0xcc68cf=_[_0xcc6a('0x9c')](_0xcc68cf,{'model':db[_0xcc6a('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2a3e93[_0xcc6a('0x41')][_0xcc6a('0x46')]){_0xe213b3[_0xcc6a('0x45')][_0xcc6a('0x37')](function(_0x383b1b){_0x345e94['field']('i.'+_0x383b1b);});}else{_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0x8e'),_0xcc6a('0x9d'));_0x345e94[_0xcc6a('0x4d')]('a.key',_0xcc6a('0x9e'));_0x345e94['field'](_0xcc6a('0x9f'),_0xcc6a('0xa0'));_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xa1'),_0xcc6a('0x8f'));_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xa2'));_0x345e94['field'](_0xcc6a('0xa3'),_0xcc6a('0xa4'));_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xa5'),_0xcc6a('0xa6'));_0x345e94[_0xcc6a('0x4d')]('c.email',_0xcc6a('0xa7'));_0x345e94[_0xcc6a('0x4d')]('c.phone','Contact.phone');_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xa8'),_0xcc6a('0xa9'));_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xaa'),'Contact.fax');_0x345e94[_0xcc6a('0x4d')]('o.fullname',_0xcc6a('0xab'));_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xac'),_0xcc6a('0xad'));_0x345e94[_0xcc6a('0x4d')](_0xcc6a('0xae'),_0xcc6a('0x34'));}if(_0xe213b3[_0xcc6a('0x26')])_0x345e94['limit'](_0xe213b3[_0xcc6a('0x26')]);if(_0xe213b3[_0xcc6a('0x25')])_0x345e94[_0xcc6a('0x25')](_0xe213b3['offset']);return db[_0xcc6a('0x99')][_0xcc6a('0x41')](_0x345e94[_0xcc6a('0x9a')](),_0xcc68cf);})[_0xcc6a('0x2d')](function(_0xadeca6){_0x351529[_0xcc6a('0x78')](_0xcc6a('0xaf'),_['map'](_0xadeca6,'id'));return db[_0xcc6a('0x99')][_0xcc6a('0x41')](_0x351529[_0xcc6a('0x9a')](),_0xcc68cf)[_0xcc6a('0x2d')](function(_0x192117){var _0xc42043=_[_0xcc6a('0xb0')](_0x192117,_0xcc6a('0xb1'));var _0x5e3be3=[];_0xadeca6['forEach'](function(_0x5cd73e){_0x5e3be3['push'](updateWhatsappInteraction(_0x5cd73e,_0x14ca90,_0xc42043));});return BPromise[_0xcc6a('0xb2')](_0x5e3be3);});});})[_0xcc6a('0x2d')](function(_0x9bb85c){_0x5856af[_0xcc6a('0xb3')]=_0x9bb85c;return _0x5856af;})[_0xcc6a('0x2d')](respondWithFilteredResult(_0x1101ec,_0xe213b3))[_0xcc6a('0xb4')](handleError(_0x1101ec,null));};exports[_0xcc6a('0xb5')]=function(_0x48b6e3,_0x10d731){var _0x537e2b={'raw':![],'where':{'id':_0x48b6e3[_0xcc6a('0xb6')]['id']}},_0x5eb00a={};_0x5eb00a['model']=_[_0xcc6a('0x42')](db[_0xcc6a('0x3b')]['rawAttributes']);_0x5eb00a['query']=_[_0xcc6a('0x42')](_0x48b6e3['query']);_0x5eb00a[_0xcc6a('0x43')]=_[_0xcc6a('0x44')](_0x5eb00a[_0xcc6a('0x40')],_0x5eb00a[_0xcc6a('0x41')]);_0x537e2b[_0xcc6a('0x45')]=_[_0xcc6a('0x44')](_0x5eb00a['model'],qs[_0xcc6a('0x46')](_0x48b6e3[_0xcc6a('0x41')][_0xcc6a('0x46')]));_0x537e2b[_0xcc6a('0x45')]=_0x537e2b['attributes'][_0xcc6a('0x47')]?_0x537e2b[_0xcc6a('0x45')]:_0x5eb00a[_0xcc6a('0x40')];if(_0x48b6e3[_0xcc6a('0x41')][_0xcc6a('0xb7')]){_0x537e2b[_0xcc6a('0xb8')]=[{'all':!![]}];}_0x537e2b=_[_0xcc6a('0x9c')]({},_0x537e2b,_0x48b6e3['options']);return db[_0xcc6a('0x3b')][_0xcc6a('0x62')](_0x537e2b)['then'](handleEntityNotFound(_0x10d731,null))[_0xcc6a('0x2d')](respondWithResult(_0x10d731,null))[_0xcc6a('0xb4')](handleError(_0x10d731,null));};exports[_0xcc6a('0xb9')]=function(_0x2297ea,_0xc4ed84){return db[_0xcc6a('0x3b')][_0xcc6a('0xb9')](_0x2297ea[_0xcc6a('0x74')],{})[_0xcc6a('0x2d')](respondWithResult(_0xc4ed84,0xc9))[_0xcc6a('0xb4')](handleError(_0xc4ed84,null));};exports[_0xcc6a('0x2c')]=function(_0x18e20d,_0x2768b6){if(_0x18e20d[_0xcc6a('0x74')]['id']){delete _0x18e20d['body']['id'];}return db['WhatsappInteraction'][_0xcc6a('0x62')]({'where':{'id':_0x18e20d[_0xcc6a('0xb6')]['id']}})['then'](handleEntityNotFound(_0x2768b6,null))[_0xcc6a('0x2d')](saveUpdates(_0x18e20d[_0xcc6a('0x74')],null))[_0xcc6a('0x2d')](respondWithResult(_0x2768b6,null))['catch'](handleError(_0x2768b6,null));};exports[_0xcc6a('0x2e')]=function(_0x5c531a,_0x1ced4b){return db[_0xcc6a('0x3b')]['find']({'where':{'id':_0x5c531a[_0xcc6a('0xb6')]['id']}})['then'](handleEntityNotFound(_0x1ced4b,null))[_0xcc6a('0x2d')](removeEntity(_0x1ced4b,null))[_0xcc6a('0xb4')](handleError(_0x1ced4b,null));};exports[_0xcc6a('0xba')]=function(_0x3a69a2,_0x32098d){return db[_0xcc6a('0x3b')]['describe']()['then'](respondWithResult(_0x32098d,null))[_0xcc6a('0xb4')](handleError(_0x32098d,null));};exports[_0xcc6a('0xbb')]=function(_0x3eef43,_0x5d00fb,_0x1f8ec5){return db[_0xcc6a('0xbc')][_0xcc6a('0x62')]({'where':{'id':_0x3eef43[_0xcc6a('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5d00fb,null))[_0xcc6a('0x2d')](function(_0x32f3b8){if(_0x32f3b8){return _0x32f3b8[_0xcc6a('0xbb')](_0x3eef43['body'][_0xcc6a('0xbd')],_['omit'](_0x3eef43[_0xcc6a('0x74')],[_0xcc6a('0xbd'),'id'])||{});}})['then'](respondWithResult(_0x5d00fb,null))[_0xcc6a('0xb4')](handleError(_0x5d00fb,null));};exports[_0xcc6a('0xbe')]=function(_0x31698d,_0x25ce7b,_0x20581c){var _0x125dba={'raw':![],'where':{}};var _0x36df40={};var _0x15146c={'count':0x0,'rows':[]};return db[_0xcc6a('0x3b')][_0xcc6a('0xbf')]({'where':{'id':_0x31698d[_0xcc6a('0xb6')]['id']}})['then'](handleEntityNotFound(_0x25ce7b,null))['then'](function(_0x3cb6bf){if(_0x3cb6bf){_0x36df40['model']=_[_0xcc6a('0x42')](db['WhatsappMessage']['rawAttributes']);_0x36df40[_0xcc6a('0x41')]=_[_0xcc6a('0x42')](_0x31698d[_0xcc6a('0x41')]);_0x36df40[_0xcc6a('0x43')]=_['intersection'](_0x36df40[_0xcc6a('0x40')],_0x36df40['query']);_0x125dba['attributes']=_[_0xcc6a('0x44')](_0x36df40[_0xcc6a('0x40')],qs[_0xcc6a('0x46')](_0x31698d[_0xcc6a('0x41')][_0xcc6a('0x46')]));_0x125dba[_0xcc6a('0x45')]=_0x125dba[_0xcc6a('0x45')]['length']?_0x125dba[_0xcc6a('0x45')]:_0x36df40[_0xcc6a('0x40')];if(!_0x31698d[_0xcc6a('0x41')]['hasOwnProperty'](_0xcc6a('0x49'))){_0x125dba['limit']=qs[_0xcc6a('0x26')](_0x31698d['query']['limit']);_0x125dba[_0xcc6a('0x25')]=qs[_0xcc6a('0x25')](_0x31698d[_0xcc6a('0x41')][_0xcc6a('0x25')]);}_0x125dba[_0xcc6a('0x4a')]=qs['sort'](_0x31698d['query']['sort']);_0x125dba[_0xcc6a('0x78')]=qs[_0xcc6a('0x43')](_[_0xcc6a('0x4c')](_0x31698d[_0xcc6a('0x41')],_0x36df40[_0xcc6a('0x43')]));_0x125dba[_0xcc6a('0x78')]['WhatsappInteractionId']=_0x3cb6bf['id'];if(_0x31698d[_0xcc6a('0x41')]['filter']){_0x125dba[_0xcc6a('0x78')]=_[_0xcc6a('0x9c')](_0x125dba[_0xcc6a('0x78')],{'$or':_[_0xcc6a('0x3a')](_0x125dba[_0xcc6a('0x45')],function(_0x48746a){var _0x58d868={};_0x58d868[_0x48746a]={'$like':'%'+_0x31698d[_0xcc6a('0x41')][_0xcc6a('0x84')]+'%'};return _0x58d868;})});}if(_0x31698d['query'][_0xcc6a('0x7c')]){var _0x307113=_0x31698d[_0xcc6a('0x41')][_0xcc6a('0x7c')][_0xcc6a('0x36')](',');var _0x2c8fbd={};_0x2c8fbd[_0x307113[0x0]]={'$gte':moment(_0x307113[0x1])['format'](_0xcc6a('0xc0'))};_0x125dba[_0xcc6a('0x78')]=_[_0xcc6a('0x9c')](_0x125dba['where'],_0x2c8fbd);}_0x125dba=_['merge']({},_0x125dba,_0x31698d['options']);return db['WhatsappMessage'][_0xcc6a('0x24')]({'where':_0x125dba['where']})[_0xcc6a('0x2d')](function(_0x4a767c){_0x15146c['count']=_0x4a767c;if(_0x31698d[_0xcc6a('0x41')]['includeAll']){_0x125dba[_0xcc6a('0xb8')]=[{'all':!![]}];}return db[_0xcc6a('0xbc')][_0xcc6a('0xc1')](_0x125dba);})[_0xcc6a('0x2d')](function(_0x65280b){_0x15146c[_0xcc6a('0xb3')]=_0x65280b;return _0x15146c;});}})[_0xcc6a('0x2d')](respondWithFilteredResult(_0x25ce7b,_0x125dba))[_0xcc6a('0xb4')](handleError(_0x25ce7b,null));};exports[_0xcc6a('0xc2')]=function(_0x365aac,_0x353442,_0x258397){return db[_0xcc6a('0x3b')][_0xcc6a('0x62')]({'where':{'id':_0x365aac[_0xcc6a('0xb6')]['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x353442,null))[_0xcc6a('0x2d')](function(_0x335748){if(_0x335748){return _0x335748[_0xcc6a('0xc3')](_0x365aac[_0xcc6a('0x74')][_0xcc6a('0xbd')],_[_0xcc6a('0xc4')](_0x365aac['body'],[_0xcc6a('0xbd'),'id'])||{})[_0xcc6a('0xc5')](function(){return db[_0xcc6a('0x6f')]['findAll']({'attributes':['id',_0xcc6a('0x31'),_0xcc6a('0xc6')],'where':{'id':_0x365aac['body'][_0xcc6a('0xbd')]}});})[_0xcc6a('0x2d')](function(_0x58a8a7){socket[_0xcc6a('0xc7')](_0xcc6a('0xc8'),{'id':Number(_0x365aac[_0xcc6a('0xb6')]['id']),'tags':_0x58a8a7||[]});return{'id':Number(_0x365aac[_0xcc6a('0xb6')]['id']),'tags':_0x58a8a7||[]};});}})[_0xcc6a('0x2d')](respondWithResult(_0x353442,null))[_0xcc6a('0xb4')](handleError(_0x353442,null));};exports['removeTags']=function(_0x505170,_0x1e436d,_0x331efb){return db['WhatsappInteraction'][_0xcc6a('0x62')]({'where':{'id':_0x505170['params']['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x1e436d,null))['then'](function(_0x24a5d0){if(_0x24a5d0){return _0x24a5d0[_0xcc6a('0xc9')](_0x505170[_0xcc6a('0x41')]['ids']);}})[_0xcc6a('0x2d')](respondWithStatusCode(_0x1e436d,null))[_0xcc6a('0xb4')](handleError(_0x1e436d,null));};exports[_0xcc6a('0xca')]=function(_0x48f019,_0x4fb270){var _0x4cd822=moment()[_0xcc6a('0xcb')]()[_0xcc6a('0x9a')]();var _0x34eb38=path[_0xcc6a('0xcc')](config[_0xcc6a('0xcd')],_0xcc6a('0xce'),_0xcc6a('0xcf'),_0xcc6a('0xd0'));var _0x14a817=path[_0xcc6a('0xcc')](config[_0xcc6a('0xcd')],_0xcc6a('0xce'),'files',_0xcc6a('0xd1'));var _0x38ffe2=path[_0xcc6a('0xcc')](_0x34eb38,_0x4cd822);var _0x5a494f=util[_0xcc6a('0xd2')](_0xcc6a('0xd3'),_0x48f019[_0xcc6a('0xb6')]['id'],_0x4cd822);var _0x4d7fc1=path[_0xcc6a('0xcc')](_0x34eb38,_0x5a494f);var _0x30b49f=[];_0x30b49f[_0xcc6a('0x38')]({'model':db[_0xcc6a('0x71')],'as':'User','attributes':['id',_0xcc6a('0x33')],'raw':!![]});_0x30b49f['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xcc6a('0xd4'),'lastName'],'raw':!![]});if(_0x48f019['query'][_0xcc6a('0xd1')]){_0x30b49f[_0xcc6a('0x38')]({'model':db[_0xcc6a('0xd5')],'as':_0xcc6a('0xd5'),'raw':!![]});}var _0xe5f8b4=[{'model':db[_0xcc6a('0xbc')],'as':'Messages','attributes':['id','body','createdAt',_0xcc6a('0xd6'),_0xcc6a('0xd7'),_0xcc6a('0x81')],'include':_0x30b49f}];_0xe5f8b4[_0xcc6a('0x38')]({'model':db[_0xcc6a('0xd8')],'as':_0xcc6a('0xd9'),'attributes':['id','name']});_0xe5f8b4['push']({'model':db[_0xcc6a('0x71')],'as':_0xcc6a('0xda'),'attributes':['id',_0xcc6a('0x33')]});return db[_0xcc6a('0x3b')]['find']({'where':{'id':_0x48f019[_0xcc6a('0xb6')]['id']},'include':_0xe5f8b4})['then'](handleEntityNotFound(_0x4fb270,null))[_0xcc6a('0x2d')](function(_0x1c2115){if(_0x1c2115){var _0x8fa195=_0x1c2115[_0xcc6a('0xdb')]({'plain':!![]});fs[_0xcc6a('0xdc')](_0x38ffe2);var _0x51619f={'format':'A4','border':'10px','header':{'height':_0xcc6a('0xdd'),'contents':{'first':_0xcc6a('0xde')}},'footer':{'height':'30px','contents':{'default':util[_0xcc6a('0xd2')](_0xcc6a('0xdf'),util[_0xcc6a('0xd2')](_0xcc6a('0xe0'),_0xcc6a('0xe1'),_0x8fa195['id']),moment()[_0xcc6a('0xd2')](_0xcc6a('0xe2'))[_0xcc6a('0x9a')]())}}};var _0x9255b2={'channel':_0xcc6a('0xe1'),'account':_0x8fa195['Account']['name'],'agent':_0x8fa195[_0xcc6a('0xda')]?_0x8fa195['Owner'][_0xcc6a('0x33')]:_0xcc6a('0xe3'),'createdAt':moment(_0x8fa195[_0xcc6a('0xe4')])['format'](_0xcc6a('0xc0'))['toString'](),'closedAt':_0x8fa195[_0xcc6a('0xe5')]?moment(_0x8fa195[_0xcc6a('0xe6')])[_0xcc6a('0xd2')](_0xcc6a('0xc0'))['toString']():'','disposition':_0x8fa195[_0xcc6a('0xe7')],'messages':_(_0x8fa195[_0xcc6a('0xe8')])[_0xcc6a('0x84')]({'secret':![]})[_0xcc6a('0x3a')](function(_0x10777a){if(_0x10777a[_0xcc6a('0xd5')]){var _0x3b84f6=path['join'](_0x14a817,_0x10777a['Attachment']['basename']);if(fs[_0xcc6a('0xe9')](_0x3b84f6)){fs[_0xcc6a('0xea')](_0x3b84f6)['pipe'](fs[_0xcc6a('0xeb')](path[_0xcc6a('0xcc')](_0x38ffe2,_0x10777a[_0xcc6a('0xd5')]['basename'])));}}return{'date':moment(_0x10777a[_0xcc6a('0xe4')])['format'](_0xcc6a('0xc0'))['toString'](),'sender':_0x10777a[_0xcc6a('0xd6')]===_0xcc6a('0xec')?_0x10777a[_0xcc6a('0x71')]?_0x10777a[_0xcc6a('0x71')]['fullname']:_0xcc6a('0xed'):_0x10777a[_0xcc6a('0x67')][_0xcc6a('0xd4')]+(_0x10777a['Contact']['lastName']?'\x20'+_0x10777a['Contact'][_0xcc6a('0xee')]:''),'body':_0x10777a[_0xcc6a('0xd5')]?_0x10777a[_0xcc6a('0xd5')][_0xcc6a('0xef')]:_0x10777a[_0xcc6a('0x74')],'direction':_0x10777a[_0xcc6a('0xd6')]===_0xcc6a('0xec')?'A':'C','secret':_0x10777a[_0xcc6a('0xd7')],'read':_0x10777a[_0xcc6a('0x81')],'attachment':_0x10777a[_0xcc6a('0xd5')]};})[_0xcc6a('0x63')]()};return ejs[_0xcc6a('0xf0')](path['join'](config[_0xcc6a('0xcd')],_0xcc6a('0xce'),_0xcc6a('0xf1'),_0xcc6a('0xf2')),{'interaction':_0x9255b2})[_0xcc6a('0x2d')](function(_0x2dfa97){return new BPromise(function(_0x24ded7,_0x4efdd9){pdf[_0xcc6a('0xb9')](_0x2dfa97,_0x51619f)[_0xcc6a('0xf3')](path[_0xcc6a('0xcc')](_0x38ffe2,_0xcc6a('0xf4')+_0x8fa195['id']+'-'+_0x4cd822+_0xcc6a('0xf5')),function(_0x4f197e,_0x132834){if(_0x4f197e)return _0x4efdd9(_0x4f197e);_0x24ded7(_0x132834);});});})['then'](function(){return new BPromise(function(_0x30c5d5,_0x132f83){zipdir(_0x38ffe2,{'saveTo':_0x4d7fc1},function(_0x10ebdf,_0x371639){if(_0x10ebdf)return _0x132f83(_0x10ebdf);return _0x30c5d5(_0x371639);});})['then'](function(){return new BPromise(function(_0x186e38,_0x2955fb){rimraf(_0x38ffe2,function(_0x2e8c0a){if(_0x2e8c0a)_0x2955fb(_0x2e8c0a);return _0x186e38();});});})[_0xcc6a('0x2d')](function(){return _0x4fb270[_0xcc6a('0xca')](_0x4d7fc1,_0x5a494f,function(_0x53242e){if(_0x53242e){console['log'](_0xcc6a('0xf6'),_0x53242e);}else{fs[_0xcc6a('0xf7')](_0x4d7fc1);}});});});}else{return _0x4fb270[_0xcc6a('0x20')](0xc8);}})[_0xcc6a('0xb4')](handleError(_0x4fb270,null));}; \ No newline at end of file +var _0x2542=['\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','contactName','DESC','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','options','create','update','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','Tag','emit','removeTags','download','unix','join','server','files','tmp','root','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','createdAt','direction','WhatsappAccount','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','%s\x20#%d','Whatsapp','N.A.','closed','disposition','basename','existsSync','pipe','createWriteStream','out','System','secret','renderFile','views','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','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','./whatsappInteraction.socket','sendStatus','status','end','json','count','offset','limit','set','save','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','value','`\x20=\x200','having','`\x20>\x200','Contact','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','type','text','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','start','some','isEmpty','WhatsappAccountId','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL'];(function(_0x3795f1,_0x6e8aa1){var _0x4e9b2c=function(_0x10d356){while(--_0x10d356){_0x3795f1['push'](_0x3795f1['shift']());}};_0x4e9b2c(++_0x6e8aa1);}(_0x2542,0x169));var _0x2254=function(_0x325322,_0x1a49d0){_0x325322=_0x325322-0x0;var _0x280798=_0x2542[_0x325322];return _0x280798;};'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(){_0x5e5edb[_0x2254('0x20')](0xcc)[_0x2254('0x21')]();});}};}function handleEntityNotFound(_0x1349c9,_0x51b578){return function(_0x4a8274){if(!_0x4a8274){_0x1349c9[_0x2254('0x1f')](0x194);}return _0x4a8274;};}function handleError(_0x4f6877,_0x35608a){_0x35608a=_0x35608a||0x1f4;return function(_0x141dc5){logger[_0x2254('0x2a')](_0x141dc5[_0x2254('0x2b')]);if(_0x141dc5[_0x2254('0x2c')]){delete _0x141dc5['name'];}_0x4f6877[_0x2254('0x20')](_0x35608a)[_0x2254('0x2d')](_0x141dc5);};}function getInteractionUsers(_0x21285d,_0x37af8b){return new BPromise(function(_0x13366a,_0x377c41){try{if(_0x37af8b[_0x21285d['id']]){_0x21285d[_0x2254('0x2e')]=_[_0x2254('0x2f')](_0x37af8b[_0x21285d['id']],function(_0x29975f){return{'id':_0x29975f['id'],'fullname':_0x29975f[_0x2254('0x30')]};});}}catch(_0x21c641){_0x377c41(_0x21c641);}_0x13366a(_0x21285d);});}function getInteractionTags(_0xad7774,_0x220f2a){return new BPromise(function(_0x27d30a,_0x4577f4){try{if(_0xad7774[_0x2254('0x31')]){_0xad7774[_0x2254('0x32')]=[];_0xad7774[_0x2254('0x31')][_0x2254('0x33')](',')['forEach'](function(_0xe29526){_0xad7774[_0x2254('0x32')][_0x2254('0x34')](_0x220f2a[_0xe29526]);});}delete _0xad7774[_0x2254('0x31')];}catch(_0xdddb4a){_0x4577f4(_0xdddb4a);}_0x27d30a(_0xad7774);});}function updateWhatsappInteraction(_0x1d275b,_0x2cfc9c,_0x3ed00e){return new BPromise(function(_0x5b84ce,_0x59c6c9){return getInteractionUsers(_0x1d275b,_0x3ed00e)[_0x2254('0x29')](function(_0x3aa0bb){return getInteractionTags(_0x3aa0bb,_0x2cfc9c);})['then'](function(_0x240d4e){_0x5b84ce(_0x240d4e);})[_0x2254('0x35')](function(_0x21df8c){_0x59c6c9(_0x21df8c);});});}exports[_0x2254('0x36')]=function(_0x538e7b,_0x4a2df0){var _0x20409d={},_0x4e2035={},_0x3d620a={'count':0x0,'rows':[]};var _0x10d749=_[_0x2254('0x2f')](db[_0x2254('0x37')][_0x2254('0x38')],function(_0x2707f4){return{'name':_0x2707f4[_0x2254('0x39')],'type':_0x2707f4['type'][_0x2254('0x3a')]};});_0x4e2035[_0x2254('0x3b')]=_[_0x2254('0x2f')](_0x10d749,_0x2254('0x2c'));_0x4e2035[_0x2254('0x3c')]=_[_0x2254('0x3d')](_0x538e7b[_0x2254('0x3c')]);_0x4e2035[_0x2254('0x3e')]=_[_0x2254('0x3f')](_0x4e2035[_0x2254('0x3b')],_0x4e2035['query']);_0x20409d[_0x2254('0x40')]=_[_0x2254('0x3f')](_0x4e2035[_0x2254('0x3b')],qs[_0x2254('0x41')](_0x538e7b['query'][_0x2254('0x41')]));_0x20409d[_0x2254('0x40')]=_0x20409d[_0x2254('0x40')][_0x2254('0x42')]?_0x20409d[_0x2254('0x40')]:_0x4e2035[_0x2254('0x3b')];if(!_0x538e7b[_0x2254('0x3c')][_0x2254('0x43')]('nolimit')){_0x20409d[_0x2254('0x25')]=qs['limit'](_0x538e7b[_0x2254('0x3c')][_0x2254('0x25')]);_0x20409d[_0x2254('0x24')]=qs[_0x2254('0x24')](_0x538e7b[_0x2254('0x3c')][_0x2254('0x24')]);}_0x20409d[_0x2254('0x44')]=qs['sort'](_0x538e7b[_0x2254('0x3c')][_0x2254('0x45')]);_0x20409d[_0x2254('0x46')]=qs[_0x2254('0x3e')](_[_0x2254('0x47')](_0x538e7b['query'],_0x4e2035[_0x2254('0x3e')]),_0x10d749);var _0x1dec43=[];var _0x5720a5=squel[_0x2254('0x48')]()[_0x2254('0x49')]('id')['field'](_0x2254('0x2c'))['field'](_0x2254('0x4a'))[_0x2254('0x4b')](_0x2254('0x4c'));var _0x31c31e=squel[_0x2254('0x48')]()[_0x2254('0x49')](_0x2254('0x4d'))[_0x2254('0x49')](_0x2254('0x4e'))[_0x2254('0x49')](_0x2254('0x4f'))[_0x2254('0x4b')](_0x2254('0x50'),'ui')['left_join'](_0x2254('0x51'),'u',_0x2254('0x52'));var _0x2c5609=squel['select']()[_0x2254('0x4b')](_0x2254('0x53'),'i')[_0x2254('0x54')](_0x2254('0x55'),'c',_0x2254('0x56'))[_0x2254('0x54')](_0x2254('0x51'),'o',_0x2254('0x57'))[_0x2254('0x54')]('whatsapp_accounts','a',_0x2254('0x58'))[_0x2254('0x54')](_0x2254('0x59'),'me',_0x2254('0x5a'))[_0x2254('0x54')](_0x2254('0x5b'),'it',_0x2254('0x5c'))[_0x2254('0x54')](_0x2254('0x4c'),'t',_0x2254('0x5d'));var _0x5b14c5=squel[_0x2254('0x5e')]();var _0x35fa64=[];var _0x5235b7=squel[_0x2254('0x5e')]();var _0x143bd2;if(_0x538e7b[_0x2254('0x3c')][_0x2254('0x5f')]){_0x143bd2=as['parseSearch'](_0x538e7b[_0x2254('0x3c')][_0x2254('0x5f')]);var _0x4d2c96=_0x143bd2[_0x2254('0x60')];for(var _0x3f0670=0x0;_0x3f0670<_0x143bd2[_0x2254('0x61')][_0x2254('0x42')];_0x3f0670++){var _0x48abd5=_0x143bd2[_0x2254('0x61')][_0x3f0670];var _0x106282='i';var _0x222a4e=_['find'](_0x10d749,['name',_0x48abd5[_0x2254('0x49')]]);if(!_0x222a4e){switch(_0x48abd5[_0x2254('0x49')]){case'unreadMessages':if(_0x48abd5[_0x2254('0x62')]==0x1){_0x2c5609['having']('`'+_0x48abd5['field']+_0x2254('0x63'));}else{_0x2c5609[_0x2254('0x64')]('`'+_0x48abd5[_0x2254('0x49')]+_0x2254('0x65'));}break;case _0x2254('0x66'):if(_0x48abd5['operator']==='$substring'){if(_0x48abd5[_0x2254('0x62')]['split']('\x20')[_0x2254('0x42')]>0x1){_0x5b14c5[_0x4d2c96](_0x2254('0x67'),qs[_0x2254('0x68')](_0x48abd5[_0x2254('0x62')]),null);}else{var _0x49c60d='%'+_0x48abd5[_0x2254('0x62')]+'%';_0x5b14c5[_0x4d2c96](_0x2254('0x69'),_0x49c60d,_0x49c60d,_0x49c60d);}}else{_0x222a4e=_['find'](_0x10d749,['name',_0x2254('0x6a')]);_0x48abd5['field']=_0x2254('0x6a');_0x2eb345=as[_0x2254('0x6b')](_0x106282,_0x222a4e[_0x2254('0x6c')],_0x48abd5);_0x5b14c5[_0x4d2c96](_0x2eb345[_0x2254('0x6d')],_0x2eb345[_0x2254('0x62')]['start'],_0x2eb345['value'][_0x2254('0x21')]);}break;case'Tag':var _0x335c66=_0x48abd5['value']['split'](',')['map'](function(_0x2c0063){return Number(_0x2c0063);});_0x335c66[_0x2254('0x6e')](function(_0x1d4b90){_0x5235b7['or'](_0x2254('0x6f'),'%,'+_0x1d4b90+',%');});_0x35fa64=_[_0x2254('0x70')](_0x35fa64,_0x335c66);break;case _0x2254('0x71'):if(_0x48abd5[_0x2254('0x72')]===_0x2254('0x73')){_0x5b14c5[_0x4d2c96](_0x2254('0x74'),'%'+_0x48abd5[_0x2254('0x62')]+'%',null);}else{_0x222a4e=_[_0x2254('0x75')](_0x10d749,[_0x2254('0x2c'),_0x2254('0x76')]);_0x48abd5[_0x2254('0x49')]=_0x2254('0x76');_0x2eb345=as[_0x2254('0x6b')](_0x106282,_0x222a4e[_0x2254('0x6c')],_0x48abd5);_0x5b14c5[_0x4d2c96](_0x2eb345[_0x2254('0x6d')],_0x2eb345[_0x2254('0x62')]['start'],_0x2eb345[_0x2254('0x62')][_0x2254('0x21')]);}break;case _0x2254('0x77'):_0x2eb345=as[_0x2254('0x6b')]('me',null,_0x48abd5);_0x5b14c5[_0x4d2c96](_0x2eb345['text'],_0x2eb345['value'][_0x2254('0x78')],_0x2eb345[_0x2254('0x62')][_0x2254('0x21')]);break;}}else{var _0x2eb345=as[_0x2254('0x6b')](_0x106282,_0x222a4e['type'],_0x48abd5);_0x5b14c5[_0x4d2c96](_0x2eb345[_0x2254('0x6d')],_0x2eb345[_0x2254('0x62')][_0x2254('0x78')],_0x2eb345['value']['end']);}}}else{var _0x21bcd4=_(_0x538e7b['query'])[_0x2254('0x3d')]()[_0x2254('0x2f')](function(_0x5b269d){return _[_0x2254('0x79')](_0x10d749,[_0x2254('0x2c'),_0x5b269d])?_0x5b269d:undefined;})['compact']()[_0x2254('0x62')]();if(!_[_0x2254('0x7a')](_0x21bcd4)){_0x21bcd4['forEach'](function(_0x5cc6bd){if(_0x5cc6bd===_0x2254('0x7b')){_0x2c5609[_0x2254('0x46')]('i.WhatsappAccountId\x20IN\x20?',[]['concat'](_0x538e7b[_0x2254('0x3c')][_0x5cc6bd]));}else if(_0x5cc6bd==='createdAt'){var _0x1d880f=JSON['parse'](_0x538e7b[_0x2254('0x3c')][_0x5cc6bd])[_0x2254('0x7c')];var _0xaa9767=JSON[_0x2254('0x7d')](_0x538e7b['query'][_0x5cc6bd])[_0x2254('0x7e')];_0x2c5609['where'](_0x2254('0x7f'),_0x1d880f,_0xaa9767);}else{if(_0x538e7b[_0x2254('0x3c')][_0x5cc6bd]==='null'){_0x2c5609[_0x2254('0x46')]('i.'+_0x5cc6bd+_0x2254('0x80'));}else{_0x2c5609['where']('i.'+_0x5cc6bd+_0x2254('0x81'),_0x538e7b[_0x2254('0x3c')][_0x5cc6bd]);}}});}if(_0x538e7b[_0x2254('0x3c')][_0x2254('0x82')]){if(_0x538e7b['query'][_0x2254('0x82')]==0x1){_0x2c5609[_0x2254('0x64')]('`unreadMessages`\x20=\x200');}else{_0x2c5609[_0x2254('0x64')](_0x2254('0x83'));}}if(_0x538e7b['query'][_0x2254('0x84')]){_0x35fa64=_['isArray'](_0x538e7b[_0x2254('0x3c')]['tag'])?_0x538e7b[_0x2254('0x3c')][_0x2254('0x84')]:new Array(_0x538e7b['query'][_0x2254('0x84')]);_0x35fa64['forEach'](function(_0x2ad17c){_0x5235b7['or'](_0x2254('0x6f'),'%,'+_0x2ad17c+',%');});}if(_0x538e7b[_0x2254('0x3c')]['filter']){var _0x14c384=_0x538e7b['query'][_0x2254('0x85')][_0x2254('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x14c384)){_0x5b14c5['or'](_0x2254('0x87'),_0x14c384+'%')['or'](_0x2254('0x88'),_0x14c384+'%');}else{_0x5b14c5['or'](_0x2254('0x89'),qs[_0x2254('0x68')](_0x14c384))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x14c384+'%');}}}_0x2c5609[_0x2254('0x46')](_0x5b14c5);_0x2c5609[_0x2254('0x8a')](_0x2254('0x8b'));var _0x403a4b={'type':db['Sequelize'][_0x2254('0x8c')][_0x2254('0x8d')],'raw':!![]};var _0x5cddb0=_0x2c5609[_0x2254('0x8e')]();_0x5cddb0['field'](_0x2254('0x8b'));_0x5cddb0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x20409d[_0x2254('0x44')]){_0x20409d['order'][_0x2254('0x6e')](function(_0x13dba2){var _0x5b7f68=_0x13dba2[0x0]===_0x2254('0x8f')?_0x13dba2[0x0]:'i.'+_0x13dba2[0x0];_0x2c5609[_0x2254('0x44')](_0x5b7f68,_0x13dba2[0x1]===_0x2254('0x90')?![]:!![]);});}if(!_[_0x2254('0x7a')](_0x35fa64)){_0x2c5609[_0x2254('0x64')](_0x5235b7);_0x5cddb0[_0x2254('0x46')]('t.id\x20IN\x20?',_0x35fa64);}BPromise['resolve']()[_0x2254('0x29')](function(){if(!_0x143bd2){if(_0x538e7b[_0x2254('0x3c')][_0x2254('0x7b')])return;_0x5cddb0[_0x2254('0x46')](_0x2254('0x91'));_0x2c5609[_0x2254('0x46')](_0x2254('0x91'));return;}if(_0x538e7b[_0x2254('0x92')][_0x2254('0x93')]!==_0x2254('0x94'))return;return _0x538e7b['user'][_0x2254('0x95')]({'attributes':['id'],'raw':!![]})[_0x2254('0x29')](function(_0x53cf03){if(_[_0x2254('0x7a')](_0x53cf03)){_0x5cddb0['where'](_0x2254('0x96'));_0x2c5609[_0x2254('0x46')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x5cddb0[_0x2254('0x46')]('i.WhatsappAccountId\x20IN\x20?',_[_0x2254('0x2f')](_0x53cf03,'id'));_0x2c5609[_0x2254('0x46')](_0x2254('0x97'),_[_0x2254('0x2f')](_0x53cf03,'id'));}});})['then'](function(){if(_0x538e7b[_0x2254('0x92')][_0x2254('0x93')]===_0x2254('0x94')&&!_0x143bd2&&!_0x538e7b[_0x2254('0x3c')]['WhatsappAccountId'])return[];return db[_0x2254('0x98')][_0x2254('0x3c')](_0x5cddb0['toString'](),_0x403a4b);})[_0x2254('0x29')](function(_0x240c68){_0x3d620a['count']=_0x240c68['length'];if(_0x3d620a[_0x2254('0x23')]===0x0)return[];return db[_0x2254('0x98')][_0x2254('0x3c')](_0x5720a5[_0x2254('0x99')](),_0x403a4b)[_0x2254('0x29')](function(_0x335c69){_0x1dec43=_[_0x2254('0x9a')](_0x335c69,'id');_0x403a4b=_[_0x2254('0x9b')](_0x403a4b,{'model':db[_0x2254('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x538e7b['query'][_0x2254('0x41')]){_0x20409d['attributes'][_0x2254('0x6e')](function(_0x555f0e){_0x2c5609[_0x2254('0x49')]('i.'+_0x555f0e);});}else{_0x2c5609[_0x2254('0x49')](_0x2254('0x9c'),'unreadMessages');_0x2c5609[_0x2254('0x49')](_0x2254('0x9d'),_0x2254('0x9e'));_0x2c5609[_0x2254('0x49')](_0x2254('0x9f'),_0x2254('0xa0'));_0x2c5609[_0x2254('0x49')](_0x2254('0xa1'),_0x2254('0x8f'));_0x2c5609[_0x2254('0x49')](_0x2254('0xa2'));_0x2c5609[_0x2254('0x49')](_0x2254('0xa3'),'Contact.firstName');_0x2c5609[_0x2254('0x49')]('c.lastName',_0x2254('0xa4'));_0x2c5609[_0x2254('0x49')](_0x2254('0xa5'),_0x2254('0xa6'));_0x2c5609[_0x2254('0x49')](_0x2254('0xa7'),_0x2254('0xa8'));_0x2c5609['field'](_0x2254('0xa9'),'Contact.mobile');_0x2c5609[_0x2254('0x49')]('c.fax',_0x2254('0xaa'));_0x2c5609[_0x2254('0x49')](_0x2254('0xab'),'Owner.fullname');_0x2c5609[_0x2254('0x49')](_0x2254('0xac'),_0x2254('0xad'));_0x2c5609[_0x2254('0x49')](_0x2254('0xae'),_0x2254('0x31'));}if(_0x20409d[_0x2254('0x25')])_0x2c5609[_0x2254('0x25')](_0x20409d['limit']);if(_0x20409d['offset'])_0x2c5609[_0x2254('0x24')](_0x20409d['offset']);return db[_0x2254('0x98')][_0x2254('0x3c')](_0x2c5609[_0x2254('0x99')](),_0x403a4b);})[_0x2254('0x29')](function(_0x39006c){_0x31c31e[_0x2254('0x46')](_0x2254('0xaf'),_['map'](_0x39006c,'id'));return db[_0x2254('0x98')][_0x2254('0x3c')](_0x31c31e[_0x2254('0x99')](),_0x403a4b)['then'](function(_0x3bbb35){var _0x11b2bb=_[_0x2254('0xb0')](_0x3bbb35,_0x2254('0xb1'));var _0x2733b2=[];_0x39006c[_0x2254('0x6e')](function(_0x461017){_0x2733b2[_0x2254('0x34')](updateWhatsappInteraction(_0x461017,_0x1dec43,_0x11b2bb));});return BPromise[_0x2254('0xb2')](_0x2733b2);});});})['then'](function(_0x2cb797){_0x3d620a[_0x2254('0xb3')]=_0x2cb797;return _0x3d620a;})['then'](respondWithFilteredResult(_0x4a2df0,_0x20409d))['catch'](handleError(_0x4a2df0,null));};exports[_0x2254('0xb4')]=function(_0x54339e,_0x226c19){var _0x10645f={'raw':![],'where':{'id':_0x54339e[_0x2254('0xb5')]['id']}},_0x124622={};_0x124622[_0x2254('0x3b')]=_[_0x2254('0x3d')](db[_0x2254('0x37')][_0x2254('0x38')]);_0x124622['query']=_['keys'](_0x54339e[_0x2254('0x3c')]);_0x124622[_0x2254('0x3e')]=_[_0x2254('0x3f')](_0x124622[_0x2254('0x3b')],_0x124622[_0x2254('0x3c')]);_0x10645f['attributes']=_['intersection'](_0x124622[_0x2254('0x3b')],qs['fields'](_0x54339e[_0x2254('0x3c')][_0x2254('0x41')]));_0x10645f[_0x2254('0x40')]=_0x10645f[_0x2254('0x40')][_0x2254('0x42')]?_0x10645f[_0x2254('0x40')]:_0x124622[_0x2254('0x3b')];if(_0x54339e['query'][_0x2254('0xb6')]){_0x10645f[_0x2254('0xb7')]=[{'all':!![]}];}_0x10645f=_['merge']({},_0x10645f,_0x54339e[_0x2254('0xb8')]);return db[_0x2254('0x37')][_0x2254('0x75')](_0x10645f)[_0x2254('0x29')](handleEntityNotFound(_0x226c19,null))[_0x2254('0x29')](respondWithResult(_0x226c19,null))[_0x2254('0x35')](handleError(_0x226c19,null));};exports[_0x2254('0xb9')]=function(_0x38e2df,_0x2597d3){return db[_0x2254('0x37')][_0x2254('0xb9')](_0x38e2df['body'],{})[_0x2254('0x29')](respondWithResult(_0x2597d3,0xc9))[_0x2254('0x35')](handleError(_0x2597d3,null));};exports[_0x2254('0xba')]=function(_0x16fd22,_0x346400){if(_0x16fd22[_0x2254('0x77')]['id']){delete _0x16fd22[_0x2254('0x77')]['id'];}return db['WhatsappInteraction'][_0x2254('0x75')]({'where':{'id':_0x16fd22[_0x2254('0xb5')]['id']}})[_0x2254('0x29')](handleEntityNotFound(_0x346400,null))['then'](saveUpdates(_0x16fd22[_0x2254('0x77')],null))[_0x2254('0x29')](respondWithResult(_0x346400,null))[_0x2254('0x35')](handleError(_0x346400,null));};exports[_0x2254('0x28')]=function(_0x2ea3db,_0x45bf54){return db['WhatsappInteraction'][_0x2254('0x75')]({'where':{'id':_0x2ea3db[_0x2254('0xb5')]['id']}})[_0x2254('0x29')](handleEntityNotFound(_0x45bf54,null))[_0x2254('0x29')](removeEntity(_0x45bf54,null))[_0x2254('0x35')](handleError(_0x45bf54,null));};exports['describe']=function(_0x4d6135,_0x12f353){return db['WhatsappInteraction'][_0x2254('0xbb')]()[_0x2254('0x29')](respondWithResult(_0x12f353,null))[_0x2254('0x35')](handleError(_0x12f353,null));};exports[_0x2254('0xbc')]=function(_0x41281f,_0x3a41b6,_0x585bf4){return db['WhatsappMessage'][_0x2254('0x75')]({'where':{'id':_0x41281f[_0x2254('0xb5')]['id']}})[_0x2254('0x29')](handleEntityNotFound(_0x3a41b6,null))[_0x2254('0x29')](function(_0x53a855){if(_0x53a855){return _0x53a855[_0x2254('0xbc')](_0x41281f[_0x2254('0x77')][_0x2254('0xbd')],_[_0x2254('0xbe')](_0x41281f[_0x2254('0x77')],[_0x2254('0xbd'),'id'])||{});}})[_0x2254('0x29')](respondWithResult(_0x3a41b6,null))[_0x2254('0x35')](handleError(_0x3a41b6,null));};exports[_0x2254('0xbf')]=function(_0x5032de,_0xabb97a,_0x1f1aa0){var _0x135fee={'raw':![],'where':{}};var _0x5d97c9={};var _0xfe2227={'count':0x0,'rows':[]};return db[_0x2254('0x37')][_0x2254('0xc0')]({'where':{'id':_0x5032de['params']['id']}})['then'](handleEntityNotFound(_0xabb97a,null))[_0x2254('0x29')](function(_0x45eca2){if(_0x45eca2){_0x5d97c9[_0x2254('0x3b')]=_[_0x2254('0x3d')](db[_0x2254('0xc1')][_0x2254('0x38')]);_0x5d97c9[_0x2254('0x3c')]=_[_0x2254('0x3d')](_0x5032de['query']);_0x5d97c9[_0x2254('0x3e')]=_[_0x2254('0x3f')](_0x5d97c9[_0x2254('0x3b')],_0x5d97c9[_0x2254('0x3c')]);_0x135fee[_0x2254('0x40')]=_[_0x2254('0x3f')](_0x5d97c9['model'],qs['fields'](_0x5032de[_0x2254('0x3c')]['fields']));_0x135fee['attributes']=_0x135fee[_0x2254('0x40')][_0x2254('0x42')]?_0x135fee[_0x2254('0x40')]:_0x5d97c9[_0x2254('0x3b')];if(!_0x5032de['query']['hasOwnProperty'](_0x2254('0xc2'))){_0x135fee[_0x2254('0x25')]=qs[_0x2254('0x25')](_0x5032de['query'][_0x2254('0x25')]);_0x135fee[_0x2254('0x24')]=qs[_0x2254('0x24')](_0x5032de[_0x2254('0x3c')][_0x2254('0x24')]);}_0x135fee[_0x2254('0x44')]=qs[_0x2254('0x45')](_0x5032de['query'][_0x2254('0x45')]);_0x135fee[_0x2254('0x46')]=qs[_0x2254('0x3e')](_[_0x2254('0x47')](_0x5032de[_0x2254('0x3c')],_0x5d97c9[_0x2254('0x3e')]));_0x135fee[_0x2254('0x46')][_0x2254('0xb1')]=_0x45eca2['id'];if(_0x5032de[_0x2254('0x3c')]['filter']){_0x135fee[_0x2254('0x46')]=_[_0x2254('0x9b')](_0x135fee[_0x2254('0x46')],{'$or':_[_0x2254('0x2f')](_0x135fee[_0x2254('0x40')],function(_0x315add){var _0x57b467={};_0x57b467[_0x315add]={'$like':'%'+_0x5032de['query'][_0x2254('0x85')]+'%'};return _0x57b467;})});}if(_0x5032de['query'][_0x2254('0x7c')]){var _0x1ebf1f=_0x5032de[_0x2254('0x3c')][_0x2254('0x7c')]['split'](',');var _0x3cba5c={};_0x3cba5c[_0x1ebf1f[0x0]]={'$gte':moment(_0x1ebf1f[0x1])[_0x2254('0xc3')](_0x2254('0xc4'))};_0x135fee['where']=_['merge'](_0x135fee[_0x2254('0x46')],_0x3cba5c);}_0x135fee=_['merge']({},_0x135fee,_0x5032de[_0x2254('0xb8')]);return db[_0x2254('0xc1')][_0x2254('0x23')]({'where':_0x135fee['where']})['then'](function(_0x1d31db){_0xfe2227[_0x2254('0x23')]=_0x1d31db;if(_0x5032de[_0x2254('0x3c')][_0x2254('0xb6')]){_0x135fee[_0x2254('0xb7')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x2254('0xc5')](_0x135fee);})[_0x2254('0x29')](function(_0x10d356){_0xfe2227[_0x2254('0xb3')]=_0x10d356;return _0xfe2227;});}})[_0x2254('0x29')](respondWithFilteredResult(_0xabb97a,_0x135fee))[_0x2254('0x35')](handleError(_0xabb97a,null));};exports['addTags']=function(_0xd1e1f4,_0x1b96d4,_0x4fb8bd){return db[_0x2254('0x37')]['find']({'where':{'id':_0xd1e1f4[_0x2254('0xb5')]['id']}})[_0x2254('0x29')](handleEntityNotFound(_0x1b96d4,null))['then'](function(_0x3cc231){if(_0x3cc231){return _0x3cc231[_0x2254('0xc6')](_0xd1e1f4[_0x2254('0x77')][_0x2254('0xbd')],_[_0x2254('0xbe')](_0xd1e1f4[_0x2254('0x77')],[_0x2254('0xbd'),'id'])||{})[_0x2254('0xc7')](function(){return db[_0x2254('0xc8')][_0x2254('0xc5')]({'attributes':['id',_0x2254('0x2c'),_0x2254('0x4a')],'where':{'id':_0xd1e1f4[_0x2254('0x77')][_0x2254('0xbd')]}});})['then'](function(_0x220929){socket[_0x2254('0xc9')]('whatsappInteractionTags:save',{'id':Number(_0xd1e1f4['params']['id']),'tags':_0x220929||[]});return{'id':Number(_0xd1e1f4[_0x2254('0xb5')]['id']),'tags':_0x220929||[]};});}})[_0x2254('0x29')](respondWithResult(_0x1b96d4,null))[_0x2254('0x35')](handleError(_0x1b96d4,null));};exports[_0x2254('0xca')]=function(_0x4f8a38,_0x25a3bf,_0x4aef28){return db['WhatsappInteraction'][_0x2254('0x75')]({'where':{'id':_0x4f8a38[_0x2254('0xb5')]['id']}})[_0x2254('0x29')](handleEntityNotFound(_0x25a3bf,null))[_0x2254('0x29')](function(_0x53f829){if(_0x53f829){return _0x53f829[_0x2254('0xca')](_0x4f8a38['query'][_0x2254('0xbd')]);}})[_0x2254('0x29')](respondWithStatusCode(_0x25a3bf,null))[_0x2254('0x35')](handleError(_0x25a3bf,null));};exports[_0x2254('0xcb')]=function(_0x474583,_0x42476e){var _0x125822=moment()[_0x2254('0xcc')]()[_0x2254('0x99')]();var _0x1be01d=path[_0x2254('0xcd')](config['root'],_0x2254('0xce'),_0x2254('0xcf'),_0x2254('0xd0'));var _0x302f89=path[_0x2254('0xcd')](config[_0x2254('0xd1')],_0x2254('0xce'),_0x2254('0xcf'),'attachments');var _0x2a8f55=path[_0x2254('0xcd')](_0x1be01d,_0x125822);var _0x237ddb=util[_0x2254('0xc3')](_0x2254('0xd2'),_0x474583['params']['id'],_0x125822);var _0x33390d=path[_0x2254('0xcd')](_0x1be01d,_0x237ddb);var _0x4cb534=[];_0x4cb534[_0x2254('0x34')]({'model':db[_0x2254('0x71')],'as':_0x2254('0x71'),'attributes':['id','fullname'],'raw':!![]});_0x4cb534[_0x2254('0x34')]({'model':db[_0x2254('0xd3')],'as':'Contact','attributes':['id',_0x2254('0xd4'),_0x2254('0xd5')],'raw':!![]});if(_0x474583[_0x2254('0x3c')][_0x2254('0xd6')]){_0x4cb534['push']({'model':db[_0x2254('0xd7')],'as':_0x2254('0xd7'),'raw':!![]});}var _0x391b8b=[{'model':db[_0x2254('0xc1')],'as':'Messages','attributes':['id',_0x2254('0x77'),_0x2254('0xd8'),_0x2254('0xd9'),'secret',_0x2254('0x82')],'include':_0x4cb534}];_0x391b8b[_0x2254('0x34')]({'model':db[_0x2254('0xda')],'as':_0x2254('0xdb'),'attributes':['id',_0x2254('0x2c')]});_0x391b8b[_0x2254('0x34')]({'model':db[_0x2254('0x71')],'as':_0x2254('0xdc'),'attributes':['id','fullname']});return db[_0x2254('0x37')][_0x2254('0x75')]({'where':{'id':_0x474583['params']['id']},'include':_0x391b8b})[_0x2254('0x29')](handleEntityNotFound(_0x42476e,null))[_0x2254('0x29')](function(_0x135d4d){if(_0x135d4d){var _0x330cc3=_0x135d4d[_0x2254('0xdd')]({'plain':!![]});fs[_0x2254('0xde')](_0x2a8f55);var _0x3a6bd4={'format':'A4','border':'10px','header':{'height':_0x2254('0xdf'),'contents':{'first':_0x2254('0xe0')}},'footer':{'height':_0x2254('0xe1'),'contents':{'default':util[_0x2254('0xc3')]('\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[_0x2254('0xc3')](_0x2254('0xe2'),_0x2254('0xe3'),_0x330cc3['id']),moment()['format']('YYYY-MM-DD')[_0x2254('0x99')]())}}};var _0x118edb={'channel':_0x2254('0xe3'),'account':_0x330cc3[_0x2254('0xdb')][_0x2254('0x2c')],'agent':_0x330cc3[_0x2254('0xdc')]?_0x330cc3[_0x2254('0xdc')][_0x2254('0x30')]:_0x2254('0xe4'),'createdAt':moment(_0x330cc3[_0x2254('0xd8')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x2254('0x99')](),'closedAt':_0x330cc3[_0x2254('0xe5')]?moment(_0x330cc3['closedAt'])['format'](_0x2254('0xc4'))[_0x2254('0x99')]():'','disposition':_0x330cc3[_0x2254('0xe6')],'messages':_(_0x330cc3['Messages'])['filter']({'secret':![]})[_0x2254('0x2f')](function(_0x512f8d){if(_0x512f8d[_0x2254('0xd7')]){var _0x32d728=path[_0x2254('0xcd')](_0x302f89,_0x512f8d[_0x2254('0xd7')][_0x2254('0xe7')]);if(fs[_0x2254('0xe8')](_0x32d728)){fs['createReadStream'](_0x32d728)[_0x2254('0xe9')](fs[_0x2254('0xea')](path[_0x2254('0xcd')](_0x2a8f55,_0x512f8d[_0x2254('0xd7')]['basename'])));}}return{'date':moment(_0x512f8d[_0x2254('0xd8')])[_0x2254('0xc3')](_0x2254('0xc4'))['toString'](),'sender':_0x512f8d['direction']===_0x2254('0xeb')?_0x512f8d[_0x2254('0x71')]?_0x512f8d[_0x2254('0x71')][_0x2254('0x30')]:_0x2254('0xec'):_0x512f8d[_0x2254('0x66')][_0x2254('0xd4')]+(_0x512f8d[_0x2254('0x66')][_0x2254('0xd5')]?'\x20'+_0x512f8d[_0x2254('0x66')][_0x2254('0xd5')]:''),'body':_0x512f8d[_0x2254('0xd7')]?_0x512f8d[_0x2254('0xd7')][_0x2254('0xe7')]:_0x512f8d['body'],'direction':_0x512f8d[_0x2254('0xd9')]===_0x2254('0xeb')?'A':'C','secret':_0x512f8d[_0x2254('0xed')],'read':_0x512f8d[_0x2254('0x82')],'attachment':_0x512f8d[_0x2254('0xd7')]};})[_0x2254('0x62')]()};return ejs[_0x2254('0xee')](path[_0x2254('0xcd')](config[_0x2254('0xd1')],'server',_0x2254('0xef'),'downloadInteraction.html'),{'interaction':_0x118edb})[_0x2254('0x29')](function(_0x15b094){return new BPromise(function(_0x2024f9,_0x33963c){pdf['create'](_0x15b094,_0x3a6bd4)[_0x2254('0xf0')](path[_0x2254('0xcd')](_0x2a8f55,_0x2254('0xf1')+_0x330cc3['id']+'-'+_0x125822+_0x2254('0xf2')),function(_0x285664,_0x578b22){if(_0x285664)return _0x33963c(_0x285664);_0x2024f9(_0x578b22);});});})[_0x2254('0x29')](function(){return new BPromise(function(_0x2e7c73,_0x1d7c19){zipdir(_0x2a8f55,{'saveTo':_0x33390d},function(_0x111d45,_0x1ce2e3){if(_0x111d45)return _0x1d7c19(_0x111d45);return _0x2e7c73(_0x1ce2e3);});})[_0x2254('0x29')](function(){return new BPromise(function(_0x3de5a0,_0x37ea1e){rimraf(_0x2a8f55,function(_0x2990c3){if(_0x2990c3)_0x37ea1e(_0x2990c3);return _0x3de5a0();});});})['then'](function(){return _0x42476e[_0x2254('0xcb')](_0x33390d,_0x237ddb,function(_0x43dcfa){if(_0x43dcfa){console['log'](_0x2254('0xf3'),_0x43dcfa);}else{fs[_0x2254('0xf4')](_0x33390d);}});});});}else{return _0x42476e[_0x2254('0x1f')](0xc8);}})[_0x2254('0x35')](handleError(_0x42476e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 7615daf..c3b6b0e 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 _0xbb4b=['hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','remove','setDataValue','Users','map','unreadMessages','length','emit'];(function(_0x3e25ba,_0x4d5399){var _0x393fb8=function(_0x4fc023){while(--_0x4fc023){_0x3e25ba['push'](_0x3e25ba['shift']());}};_0x393fb8(++_0x4d5399);}(_0xbb4b,0x1b4));var _0xbbb4=function(_0x395a72,_0x458780){_0x395a72=_0x395a72-0x0;var _0x4d1644=_0xbb4b[_0x395a72];return _0x4d1644;};'use strict';var EventEmitter=require(_0xbbb4('0x0'));var WhatsappInteraction=require(_0xbbb4('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0xbbb4('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbbb4('0x3')](0x0);var events={'afterCreate':_0xbbb4('0x4'),'afterUpdate':'update','afterDestroy':_0xbbb4('0x5')};function emitEvent(_0x13a31f){return function(_0x237f7e,_0x90c455,_0x27a6f4){_0x237f7e['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x12fcbd){_0x237f7e[_0xbbb4('0x6')](_0xbbb4('0x7'),_0x12fcbd[_0xbbb4('0x8')](function(_0xd0ebf0){return{'id':_0xd0ebf0['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x237f7e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5196e5){_0x237f7e['setDataValue'](_0xbbb4('0x9'),_0x5196e5[_0xbbb4('0xa')]);WhatsappInteractionEvents[_0xbbb4('0xb')](_0x13a31f+':'+_0x237f7e['id'],_0x237f7e);WhatsappInteractionEvents['emit'](_0x13a31f,_0x237f7e);_0x27a6f4(null);})['catch'](_0x27a6f4(null));};}for(var e in events){if(events[_0xbbb4('0xc')](e)){var event=events[e];WhatsappInteraction[_0xbbb4('0xd')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xcd22=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','getUsers'];(function(_0x57488b,_0x39a6e2){var _0x523b18=function(_0x134f85){while(--_0x134f85){_0x57488b['push'](_0x57488b['shift']());}};_0x523b18(++_0x39a6e2);}(_0xcd22,0x1f2));var _0x2cd2=function(_0x34bc94,_0x74f0fd){_0x34bc94=_0x34bc94-0x0;var _0xee41e7=_0xcd22[_0x34bc94];return _0xee41e7;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x2cd2('0x0'))['db'][_0x2cd2('0x1')];var WhatsappMessage=require(_0x2cd2('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x2cd2('0x2')](0x0);var events={'afterCreate':_0x2cd2('0x3'),'afterUpdate':_0x2cd2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4d620){return function(_0x2f5547,_0xfd5b66,_0x2071de){_0x2f5547[_0x2cd2('0x5')]({'attributes':['id'],'raw':!![]})[_0x2cd2('0x6')](function(_0x29edcc){_0x2f5547[_0x2cd2('0x7')](_0x2cd2('0x8'),_0x29edcc[_0x2cd2('0x9')](function(_0x1c6978){return{'id':_0x1c6978['id']};}));return WhatsappMessage[_0x2cd2('0xa')]({'where':{'WhatsappInteractionId':_0x2f5547['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x31188a){_0x2f5547[_0x2cd2('0x7')](_0x2cd2('0xb'),_0x31188a[_0x2cd2('0xc')]);WhatsappInteractionEvents[_0x2cd2('0xd')](_0x4d620+':'+_0x2f5547['id'],_0x2f5547);WhatsappInteractionEvents['emit'](_0x4d620,_0x2f5547);_0x2071de(null);})[_0x2cd2('0xe')](_0x2071de(null));};}for(var e in events){if(events[_0x2cd2('0xf')](e)){var event=events[e];WhatsappInteraction[_0x2cd2('0x10')](e,emitEvent(event));}}module[_0x2cd2('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 9cc67f7..5dc0bfb 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 _0xe22c=['../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','lodash','util','api','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe22c,0x181));var _0xce22=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe22c[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xce22('0x0'));var util=require(_0xce22('0x1'));var logger=require('../../config/logger')(_0xce22('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xce22('0x3'));var rimraf=require(_0xce22('0x4'));var config=require(_0xce22('0x5'));var attributes=require(_0xce22('0x6'));module[_0xce22('0x7')]=function(_0x2c8736,_0x2909eb){return _0x2c8736[_0xce22('0x8')](_0xce22('0x9'),attributes,{'tableName':_0xce22('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe32d39,_0x2de5e8,_0x2b4ec3){if(_0xe32d39[_0xce22('0xb')](_0xce22('0xc'))){_0xe32d39['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2b4ec3(null,_0xe32d39);}}});}; \ No newline at end of file +var _0x0a7e=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','WhatsappInteraction','whatsapp_interactions'];(function(_0x456d5d,_0x234205){var _0x22b740=function(_0x7a6711){while(--_0x7a6711){_0x456d5d['push'](_0x456d5d['shift']());}};_0x22b740(++_0x234205);}(_0x0a7e,0x115));var _0xe0a7=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0a7e[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xe0a7('0x0'));var util=require(_0xe0a7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe0a7('0x2'));var fs=require('fs');var path=require(_0xe0a7('0x3'));var rimraf=require(_0xe0a7('0x4'));var config=require(_0xe0a7('0x5'));var attributes=require(_0xe0a7('0x6'));module['exports']=function(_0x2a697a,_0x2fc8e5){return _0x2a697a['define'](_0xe0a7('0x7'),attributes,{'tableName':_0xe0a7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x17d945,_0x5f4860,_0x36f8f8){if(_0x17d945['changed'](_0xe0a7('0x9'))){_0x17d945[_0xe0a7('0xa')]=moment()[_0xe0a7('0xb')](_0xe0a7('0xc'));}_0x36f8f8(null,_0x17d945);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index d1e44dd..a83b51a 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 _0xb084=['UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','AddTagsToWhatsappInteraction','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x5e43de,_0x4e6bb2){var _0x58ad18=function(_0x52872f){while(--_0x52872f){_0x5e43de['push'](_0x5e43de['shift']());}};_0x58ad18(++_0x4e6bb2);}(_0xb084,0xd5));var _0x4b08=function(_0x231253,_0x5dd43f){_0x231253=_0x231253-0x0;var _0xa2fe2b=_0xb084[_0x231253];return _0xa2fe2b;};'use strict';var _=require(_0x4b08('0x0'));var util=require('util');var moment=require(_0x4b08('0x1'));var BPromise=require(_0x4b08('0x2'));var rs=require(_0x4b08('0x3'));var fs=require('fs');var Redis=require(_0x4b08('0x4'));var db=require(_0x4b08('0x5'))['db'];var utils=require(_0x4b08('0x6'));var logger=require(_0x4b08('0x7'))(_0x4b08('0x8'));var config=require('../../config/environment');var jayson=require(_0x4b08('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x4b08('0xa')]=_[_0x4b08('0xb')](config[_0x4b08('0xa')],{'host':_0x4b08('0xc'),'port':0x18eb});var socket=require(_0x4b08('0xd'))(new Redis(config[_0x4b08('0xa')]));require('./whatsappInteraction.socket')[_0x4b08('0xe')](socket);function respondWithRpcPromise(_0x144d46,_0x4d3564,_0x4906a5){return new BPromise(function(_0x4add17,_0x4296da){return client[_0x4b08('0xf')](_0x144d46,_0x4906a5)[_0x4b08('0x10')](function(_0x4d2a49){logger[_0x4b08('0x11')](_0x4b08('0x12'),_0x4d3564,'request\x20sent');logger[_0x4b08('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4d3564,_0x4b08('0x14'),JSON[_0x4b08('0x15')](_0x4d2a49));if(_0x4d2a49[_0x4b08('0x16')]){if(_0x4d2a49['error'][_0x4b08('0x17')]===0x1f4){logger[_0x4b08('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x4d3564,_0x4d2a49[_0x4b08('0x16')][_0x4b08('0x18')]);return _0x4296da(_0x4d2a49[_0x4b08('0x16')][_0x4b08('0x18')]);}logger[_0x4b08('0x16')](_0x4b08('0x12'),_0x4d3564,_0x4d2a49[_0x4b08('0x16')][_0x4b08('0x18')]);return _0x4add17(_0x4d2a49[_0x4b08('0x16')][_0x4b08('0x18')]);}else{logger[_0x4b08('0x11')](_0x4b08('0x12'),_0x4d3564,'request\x20sent');_0x4add17(_0x4d2a49[_0x4b08('0x19')][_0x4b08('0x18')]);}})[_0x4b08('0x1a')](function(_0x17c74d){logger[_0x4b08('0x16')](_0x4b08('0x12'),_0x4d3564,_0x17c74d);_0x4296da(_0x17c74d);});});}exports[_0x4b08('0x1b')]=function(_0x20fed1){var _0x167b71=this;return new Promise(function(_0x2f73b0,_0x3a6a98){return db[_0x4b08('0x1c')][_0x4b08('0x1d')](_0x20fed1[_0x4b08('0x1e')],{'raw':_0x20fed1[_0x4b08('0x1f')]?_0x20fed1[_0x4b08('0x1f')][_0x4b08('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fed1[_0x4b08('0x1f')]?_0x20fed1[_0x4b08('0x1f')][_0x4b08('0x21')]||null:null,'attributes':_0x20fed1['options']?_0x20fed1['options'][_0x4b08('0x22')]||null:null,'limit':_0x20fed1[_0x4b08('0x1f')]?_0x20fed1[_0x4b08('0x1f')]['limit']||null:null})[_0x4b08('0x10')](function(_0x488b9c){logger['info'](_0x4b08('0x1b'),_0x20fed1);logger['debug']('UpdateWhatsappInteraction',_0x20fed1,JSON[_0x4b08('0x15')](_0x488b9c));_0x2f73b0(_0x488b9c);})[_0x4b08('0x1a')](function(_0x10de17){logger[_0x4b08('0x16')]('UpdateWhatsappInteraction',_0x10de17[_0x4b08('0x18')],_0x20fed1);_0x3a6a98(_0x167b71['error'](0x1f4,_0x10de17['message']));});});};exports[_0x4b08('0x23')]=function(_0x59d156){return new Promise(function(_0x14f349,_0x315de4){return db[_0x4b08('0x1c')]['find']({'where':_0x59d156[_0x4b08('0x1f')]?_0x59d156[_0x4b08('0x1f')][_0x4b08('0x21')]||null:null})['then'](function(_0x5acaf4){if(_0x5acaf4){return _0x5acaf4[_0x4b08('0x24')](_0x59d156[_0x4b08('0x1e')][_0x4b08('0x25')],_['omit'](_0x59d156[_0x4b08('0x1e')],[_0x4b08('0x25'),'id'])||{});}})[_0x4b08('0x26')](function(_0x5b5919){logger['info'](_0x4b08('0x27'),_0x59d156);logger[_0x4b08('0x13')](_0x4b08('0x27'),_0x59d156,JSON[_0x4b08('0x15')](_0x5b5919));_0x14f349(_0x5b5919);})[_0x4b08('0x1a')](function(_0x3b777e){logger[_0x4b08('0x16')](_0x4b08('0x27'),_0x3b777e[_0x4b08('0x18')],_0x59d156);_0x315de4(_this[_0x4b08('0x16')](0x1f4,_0x3b777e[_0x4b08('0x18')]));});});}; \ No newline at end of file +var _0x276b=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s'];(function(_0x4ce6ba,_0x209b75){var _0x5ef3ac=function(_0x5cfef2){while(--_0x5cfef2){_0x4ce6ba['push'](_0x4ce6ba['shift']());}};_0x5ef3ac(++_0x209b75);}(_0x276b,0x1dc));var _0xb276=function(_0x5cc127,_0x54416a){_0x5cc127=_0x5cc127-0x0;var _0x2ed59b=_0x276b[_0x5cc127];return _0x2ed59b;};'use strict';var _=require(_0xb276('0x0'));var util=require('util');var moment=require(_0xb276('0x1'));var BPromise=require(_0xb276('0x2'));var rs=require(_0xb276('0x3'));var fs=require('fs');var Redis=require(_0xb276('0x4'));var db=require(_0xb276('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb276('0x6'))(_0xb276('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb276('0x8')][_0xb276('0x9')]({'port':0x232a});config[_0xb276('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb276('0xa')]));require(_0xb276('0xb'))[_0xb276('0xc')](socket);function respondWithRpcPromise(_0x42d037,_0x2353d3,_0x279a37){return new BPromise(function(_0x3abb61,_0x2cd1a9){return client[_0xb276('0xd')](_0x42d037,_0x279a37)[_0xb276('0xe')](function(_0x2007c4){logger['info'](_0xb276('0xf'),_0x2353d3,'request\x20sent');logger[_0xb276('0x10')](_0xb276('0x11'),_0x2353d3,_0xb276('0x12'),JSON[_0xb276('0x13')](_0x2007c4));if(_0x2007c4[_0xb276('0x14')]){if(_0x2007c4[_0xb276('0x14')][_0xb276('0x15')]===0x1f4){logger[_0xb276('0x14')](_0xb276('0xf'),_0x2353d3,_0x2007c4['error'][_0xb276('0x16')]);return _0x2cd1a9(_0x2007c4[_0xb276('0x14')][_0xb276('0x16')]);}logger[_0xb276('0x14')](_0xb276('0xf'),_0x2353d3,_0x2007c4['error']['message']);return _0x3abb61(_0x2007c4[_0xb276('0x14')][_0xb276('0x16')]);}else{logger[_0xb276('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x2353d3,_0xb276('0x12'));_0x3abb61(_0x2007c4[_0xb276('0x18')][_0xb276('0x16')]);}})[_0xb276('0x19')](function(_0x35b22f){logger[_0xb276('0x14')](_0xb276('0xf'),_0x2353d3,_0x35b22f);_0x2cd1a9(_0x35b22f);});});}exports[_0xb276('0x1a')]=function(_0x434cc7){var _0x2db6f6=this;return new Promise(function(_0x28a8a0,_0x20988a){return db[_0xb276('0x1b')][_0xb276('0x1c')](_0x434cc7[_0xb276('0x1d')],{'raw':_0x434cc7[_0xb276('0x1e')]?_0x434cc7[_0xb276('0x1e')][_0xb276('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x434cc7[_0xb276('0x1e')]?_0x434cc7[_0xb276('0x1e')][_0xb276('0x20')]||null:null,'attributes':_0x434cc7[_0xb276('0x1e')]?_0x434cc7['options'][_0xb276('0x21')]||null:null,'limit':_0x434cc7[_0xb276('0x1e')]?_0x434cc7['options'][_0xb276('0x22')]||null:null})[_0xb276('0xe')](function(_0x17a2e5){logger[_0xb276('0x17')](_0xb276('0x1a'),_0x434cc7);logger['debug'](_0xb276('0x1a'),_0x434cc7,JSON[_0xb276('0x13')](_0x17a2e5));_0x28a8a0(_0x17a2e5);})[_0xb276('0x19')](function(_0x38c9e3){logger[_0xb276('0x14')](_0xb276('0x1a'),_0x38c9e3[_0xb276('0x16')],_0x434cc7);_0x20988a(_0x2db6f6[_0xb276('0x14')](0x1f4,_0x38c9e3[_0xb276('0x16')]));});});};exports[_0xb276('0x23')]=function(_0x2c3eb4){return new Promise(function(_0x1f9e5f,_0x4abe6f){return db[_0xb276('0x1b')][_0xb276('0x24')]({'where':_0x2c3eb4['options']?_0x2c3eb4[_0xb276('0x1e')][_0xb276('0x20')]||null:null})[_0xb276('0xe')](function(_0x5b6cb9){if(_0x5b6cb9){return _0x5b6cb9[_0xb276('0x25')](_0x2c3eb4[_0xb276('0x1d')][_0xb276('0x26')],_[_0xb276('0x27')](_0x2c3eb4[_0xb276('0x1d')],['ids','id'])||{});}})['spread'](function(_0x5886f2){logger[_0xb276('0x17')]('AddTags',_0x2c3eb4);logger['debug']('AddTags',_0x2c3eb4,JSON['stringify'](_0x5886f2));_0x1f9e5f(_0x5886f2);})[_0xb276('0x19')](function(_0x14fa4d){logger['error'](_0xb276('0x28'),_0x14fa4d['message'],_0x2c3eb4);_0x4abe6f(_this[_0xb276('0x14')](0x1f4,_0x14fa4d[_0xb276('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index e92a2d9..2d4dba2 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 _0xff4e=['remove','update','register','whatsappInteraction:','save'];(function(_0x1d58d6,_0x2694c6){var _0x3315d7=function(_0x41d6f5){while(--_0x41d6f5){_0x1d58d6['push'](_0x1d58d6['shift']());}};_0x3315d7(++_0x2694c6);}(_0xff4e,0x1f3));var _0xeff4=function(_0x3c2c1f,_0x4d93d3){_0x3c2c1f=_0x3c2c1f-0x0;var _0x5adf10=_0xff4e[_0x3c2c1f];return _0x5adf10;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xeff4('0x0'),_0xeff4('0x1'),_0xeff4('0x2')];function createListener(_0x57f9de,_0xe10929){return function(_0x12ff6e){_0xe10929['emit'](_0x57f9de,_0x12ff6e);};}function removeListener(_0x38a69e,_0x3477a4){return function(){WhatsappInteractionEvents['removeListener'](_0x38a69e,_0x3477a4);};}exports[_0xeff4('0x3')]=function(_0x276dc0){for(var _0x2cdfa9=0x0,_0x1fff23=events['length'];_0x2cdfa9<_0x1fff23;_0x2cdfa9++){var _0x362f32=events[_0x2cdfa9];var _0x62c912=createListener(_0xeff4('0x4')+_0x362f32,_0x276dc0);WhatsappInteractionEvents['on'](_0x362f32,_0x62c912);}}; \ No newline at end of file +var _0x5ee6=['length','whatsappInteraction:','save','remove','emit','register'];(function(_0x38ebd0,_0x11bf98){var _0x68aa4c=function(_0x5cbf77){while(--_0x5cbf77){_0x38ebd0['push'](_0x38ebd0['shift']());}};_0x68aa4c(++_0x11bf98);}(_0x5ee6,0x1e8));var _0x65ee=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x5ee6[_0x46698a];return _0x356db0;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x65ee('0x0'),_0x65ee('0x1'),'update'];function createListener(_0x5d96d0,_0x5eb1ef){return function(_0x2f5704){_0x5eb1ef[_0x65ee('0x2')](_0x5d96d0,_0x2f5704);};}function removeListener(_0x44afbc,_0x5407b4){return function(){WhatsappInteractionEvents['removeListener'](_0x44afbc,_0x5407b4);};}exports[_0x65ee('0x3')]=function(_0x142ddc){for(var _0x243bc8=0x0,_0x59c4db=events[_0x65ee('0x4')];_0x243bc8<_0x59c4db;_0x243bc8++){var _0x56e50d=events[_0x243bc8];var _0x59738c=createListener(_0x65ee('0x5')+_0x56e50d,_0x142ddc);WhatsappInteractionEvents['on'](_0x56e50d,_0x59738c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5f2bfa4..a8ef3b8 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 _0x0485=['delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0485,0xcd));var _0x5048=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0x0485[_0x36bff5];return _0x80ade5;};'use strict';var multer=require('multer');var util=require(_0x5048('0x0'));var path=require(_0x5048('0x1'));var timeout=require(_0x5048('0x2'));var express=require(_0x5048('0x3'));var router=express[_0x5048('0x4')]();var auth=require(_0x5048('0x5'));var interaction=require(_0x5048('0x6'));var config=require(_0x5048('0x7'));var controller=require(_0x5048('0x8'));router[_0x5048('0x9')]('/',auth[_0x5048('0xa')](),controller[_0x5048('0xb')]);router[_0x5048('0x9')](_0x5048('0xc'),auth[_0x5048('0xa')](),controller[_0x5048('0xd')]);router[_0x5048('0x9')](_0x5048('0xe'),auth[_0x5048('0xa')](),controller[_0x5048('0xf')]);router[_0x5048('0x10')]('/',auth[_0x5048('0xa')](),interaction[_0x5048('0x11')](_0x5048('0x12'),_0x5048('0x13')),controller[_0x5048('0x14')]);router[_0x5048('0x10')](_0x5048('0x15'),controller['status']);router[_0x5048('0x16')](_0x5048('0xe'),auth[_0x5048('0xa')](),controller[_0x5048('0x17')]);router[_0x5048('0x16')](_0x5048('0x18'),auth[_0x5048('0xa')](),controller[_0x5048('0x19')]);router[_0x5048('0x16')](_0x5048('0x1a'),auth[_0x5048('0xa')](),controller['reject']);router[_0x5048('0x1b')](_0x5048('0xe'),auth[_0x5048('0xa')](),controller['destroy']);module[_0x5048('0x1c')]=router; \ No newline at end of file +var _0xc2fe=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','reject','delete','destroy'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc2fe,0x123));var _0xec2f=function(_0x5f4eea,_0x378e55){_0x5f4eea=_0x5f4eea-0x0;var _0x37901d=_0xc2fe[_0x5f4eea];return _0x37901d;};'use strict';var multer=require(_0xec2f('0x0'));var util=require(_0xec2f('0x1'));var path=require(_0xec2f('0x2'));var timeout=require(_0xec2f('0x3'));var express=require(_0xec2f('0x4'));var router=express[_0xec2f('0x5')]();var auth=require(_0xec2f('0x6'));var interaction=require(_0xec2f('0x7'));var config=require(_0xec2f('0x8'));var controller=require(_0xec2f('0x9'));router[_0xec2f('0xa')]('/',auth[_0xec2f('0xb')](),controller['index']);router[_0xec2f('0xa')]('/describe',auth[_0xec2f('0xb')](),controller['describe']);router[_0xec2f('0xa')](_0xec2f('0xc'),auth[_0xec2f('0xb')](),controller[_0xec2f('0xd')]);router[_0xec2f('0xe')]('/',auth[_0xec2f('0xb')](),interaction[_0xec2f('0xf')](_0xec2f('0x10'),_0xec2f('0x11')),controller[_0xec2f('0x12')]);router[_0xec2f('0xe')](_0xec2f('0x13'),controller[_0xec2f('0x14')]);router[_0xec2f('0x15')](_0xec2f('0xc'),auth[_0xec2f('0xb')](),controller[_0xec2f('0x16')]);router[_0xec2f('0x15')](_0xec2f('0x17'),auth['isAuthenticated'](),controller[_0xec2f('0x18')]);router[_0xec2f('0x15')]('/:id/reject',auth[_0xec2f('0xb')](),controller[_0xec2f('0x19')]);router[_0xec2f('0x1a')](_0xec2f('0xc'),auth[_0xec2f('0xb')](),controller[_0xec2f('0x1b')]);module[_0xec2f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 8c6c943..1215b5c 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 _0xc11b=['out','STRING','DATE','TEXT','sequelize','exports','BOOLEAN'];(function(_0x26d3f8,_0x5cc7f2){var _0xe84269=function(_0x22ad25){while(--_0x22ad25){_0x26d3f8['push'](_0x26d3f8['shift']());}};_0xe84269(++_0x5cc7f2);}(_0xc11b,0x146));var _0xbc11=function(_0x2759cf,_0x1bdc35){_0x2759cf=_0x2759cf-0x0;var _0x31731a=_0xc11b[_0x2759cf];return _0x31731a;};'use strict';var Sequelize=require(_0xbc11('0x0'));module[_0xbc11('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbc11('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbc11('0x3')),'defaultValue':_0xbc11('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xbc11('0x4')]},'readAt':{'type':Sequelize[_0xbc11('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbc11('0x4')]},'providerResponse':{'type':Sequelize[_0xbc11('0x6')]}}; \ No newline at end of file +var _0x0054=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x3a66fa,_0x399904){var _0x388cf9=function(_0x39be41){while(--_0x39be41){_0x3a66fa['push'](_0x3a66fa['shift']());}};_0x388cf9(++_0x399904);}(_0x0054,0xb6));var _0x4005=function(_0x3a7ed5,_0xda1d0){_0x3a7ed5=_0x3a7ed5-0x0;var _0x332b07=_0x0054[_0x3a7ed5];return _0x332b07;};'use strict';var Sequelize=require(_0x4005('0x0'));module[_0x4005('0x1')]={'body':{'type':Sequelize[_0x4005('0x2')](_0x4005('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4005('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4005('0x5')]('in',_0x4005('0x6')),'defaultValue':_0x4005('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4005('0x7')](0xbe)},'phone':{'type':Sequelize[_0x4005('0x7')]},'readAt':{'type':Sequelize[_0x4005('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4005('0x7')]},'providerResponse':{'type':Sequelize[_0x4005('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index a1c7ee8..935b2a4 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 _0x2da6=['then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','destroy','stack','name','send','index','WhatsappMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','create','body','describe','whatsapp-interactions','accept','read','UserId','agent','Contact','WhatsappInteractionId','update','format','YYYY-MM-DD\x20HH:mm:ss','interaction','get','user','null','AcceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','whatsapp','WhatsappInteraction','role','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','redis','defaults','./whatsappMessage.socket','register','jayson/promise','client','http'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x2da6,0x1dd));var _0x62da=function(_0x11eb05,_0x32f86f){_0x11eb05=_0x11eb05-0x0;var _0x5539e3=_0x2da6[_0x11eb05];return _0x5539e3;};'use strict';var pdf=require(_0x62da('0x0'));var emlformat=require(_0x62da('0x1'));var rimraf=require(_0x62da('0x2'));var zipdir=require(_0x62da('0x3'));var jsonpatch=require(_0x62da('0x4'));var rp=require(_0x62da('0x5'));var moment=require(_0x62da('0x6'));var BPromise=require(_0x62da('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x62da('0x8'));var sox=require(_0x62da('0x9'));var csv=require(_0x62da('0xa'));var ejs=require(_0x62da('0xb'));var fs=require('fs');var _=require(_0x62da('0xc'));var squel=require(_0x62da('0xd'));var crypto=require(_0x62da('0xe'));var jsforce=require(_0x62da('0xf'));var deskjs=require(_0x62da('0x10'));var toCsv=require('to-csv');var querystring=require(_0x62da('0x11'));var Papa=require(_0x62da('0x12'));var Redis=require(_0x62da('0x13'));var authService=require(_0x62da('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x62da('0x15'));var hardwareService=require(_0x62da('0x16'));var logger=require(_0x62da('0x17'))(_0x62da('0x18'));var utils=require(_0x62da('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x62da('0x1a'));var db=require(_0x62da('0x1b'))['db'];config[_0x62da('0x1c')]=_[_0x62da('0x1d')](config[_0x62da('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62da('0x1c')]));require(_0x62da('0x1e'))[_0x62da('0x1f')](socket);var jayson=require(_0x62da('0x20'));var client=jayson[_0x62da('0x21')][_0x62da('0x22')]({'port':0x232c});var client9002=jayson[_0x62da('0x21')][_0x62da('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2cbdf6,_0xcc1a25,_0x33ec53,_0x27ab5f){return new BPromise(function(_0x1f6bc8,_0x1aa4f3){var _0x4bdab9=_0x27ab5f||client;return _0x4bdab9['request'](_0x2cbdf6,_0x33ec53)[_0x62da('0x23')](function(_0x4ae4fb){logger[_0x62da('0x24')](_0x62da('0x25'),_0xcc1a25,_0x62da('0x26'));logger['debug'](_0x62da('0x27'),_0xcc1a25,'request\x20sent',JSON[_0x62da('0x28')](_0x4ae4fb));if(_0x4ae4fb[_0x62da('0x29')]){if(_0x4ae4fb[_0x62da('0x29')][_0x62da('0x2a')]===0x1f4){logger[_0x62da('0x29')](_0x62da('0x25'),_0xcc1a25,_0x4ae4fb[_0x62da('0x29')][_0x62da('0x2b')]);return _0x1aa4f3(_0x4ae4fb[_0x62da('0x29')]['message']);}logger[_0x62da('0x29')](_0x62da('0x25'),_0xcc1a25,_0x4ae4fb[_0x62da('0x29')][_0x62da('0x2b')]);return _0x1f6bc8(_0x4ae4fb[_0x62da('0x29')][_0x62da('0x2b')]);}else{logger[_0x62da('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0xcc1a25,'request\x20sent');_0x1f6bc8(_0x4ae4fb['result'][_0x62da('0x2b')]);}})[_0x62da('0x2c')](function(_0x14897c){logger[_0x62da('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0xcc1a25,_0x14897c);_0x1aa4f3(_0x14897c);});});}function respondWithStatusCode(_0x2b7daa,_0x3b9c06){_0x3b9c06=_0x3b9c06||0xcc;return function(_0x5f0a9c){if(_0x5f0a9c){return _0x2b7daa[_0x62da('0x2d')](_0x3b9c06);}return _0x2b7daa[_0x62da('0x2e')](_0x3b9c06)[_0x62da('0x2f')]();};}function respondWithResult(_0x5b7d26,_0x41de3a){_0x41de3a=_0x41de3a||0xc8;return function(_0x87f92b){if(_0x87f92b){return _0x5b7d26[_0x62da('0x2e')](_0x41de3a)['json'](_0x87f92b);}};}function respondWithFilteredResult(_0x4f5657,_0x3c6274){return function(_0x301e3d){if(_0x301e3d){var _0x220ffc=_0x301e3d[_0x62da('0x30')],_0x594c5a=_0x3c6274[_0x62da('0x31')],_0x45f67a=_0x3c6274[_0x62da('0x31')]+_0x3c6274[_0x62da('0x32')],_0x2a4681;if(_0x45f67a>=_0x220ffc){_0x45f67a=_0x220ffc;_0x2a4681=0xc8;}else{_0x2a4681=0xce;}_0x4f5657['status'](_0x2a4681);return _0x4f5657[_0x62da('0x33')]('Content-Range',_0x594c5a+'-'+_0x45f67a+'/'+_0x220ffc)[_0x62da('0x34')](_0x301e3d);}return null;};}function patchUpdates(_0x14ffbe){return function(_0x231a52){try{jsonpatch[_0x62da('0x35')](_0x231a52,_0x14ffbe,!![]);}catch(_0x10dd0d){return BPromise[_0x62da('0x36')](_0x10dd0d);}return _0x231a52['save']();};}function saveUpdates(_0x204f7b,_0x25dc6d){return function(_0x3b392b){if(_0x3b392b){return _0x3b392b['update'](_0x204f7b)[_0x62da('0x23')](function(_0x47c900){return _0x47c900;});}return null;};}function removeEntity(_0x3dd06e,_0x5ba89a){return function(_0x3a65dc){if(_0x3a65dc){return _0x3a65dc[_0x62da('0x37')]()['then'](function(){_0x3dd06e[_0x62da('0x2e')](0xcc)[_0x62da('0x2f')]();});}};}function handleEntityNotFound(_0x5dde2a,_0x440f1e){return function(_0x210e15){if(!_0x210e15){_0x5dde2a[_0x62da('0x2d')](0x194);}return _0x210e15;};}function handleError(_0x2541b9,_0x557b6a){_0x557b6a=_0x557b6a||0x1f4;return function(_0x35aa2e){logger[_0x62da('0x29')](_0x35aa2e[_0x62da('0x38')]);if(_0x35aa2e[_0x62da('0x39')]){delete _0x35aa2e[_0x62da('0x39')];}_0x2541b9[_0x62da('0x2e')](_0x557b6a)[_0x62da('0x3a')](_0x35aa2e);};}exports[_0x62da('0x3b')]=function(_0x2b6b56,_0x4bd7b7){var _0x2b8487={},_0x3c37b6={},_0x555556={'count':0x0,'rows':[]};var _0x44c3dc=_['map'](db[_0x62da('0x3c')][_0x62da('0x3d')],function(_0x30c908){return{'name':_0x30c908['fieldName'],'type':_0x30c908[_0x62da('0x3e')][_0x62da('0x3f')]};});_0x3c37b6[_0x62da('0x40')]=_[_0x62da('0x41')](_0x44c3dc,'name');_0x3c37b6[_0x62da('0x42')]=_[_0x62da('0x43')](_0x2b6b56[_0x62da('0x42')]);_0x3c37b6[_0x62da('0x44')]=_[_0x62da('0x45')](_0x3c37b6[_0x62da('0x40')],_0x3c37b6[_0x62da('0x42')]);_0x2b8487[_0x62da('0x46')]=_[_0x62da('0x45')](_0x3c37b6['model'],qs[_0x62da('0x47')](_0x2b6b56[_0x62da('0x42')]['fields']));_0x2b8487[_0x62da('0x46')]=_0x2b8487[_0x62da('0x46')][_0x62da('0x48')]?_0x2b8487[_0x62da('0x46')]:_0x3c37b6[_0x62da('0x40')];if(!_0x2b6b56[_0x62da('0x42')][_0x62da('0x49')](_0x62da('0x4a'))){_0x2b8487['limit']=qs['limit'](_0x2b6b56['query'][_0x62da('0x32')]);_0x2b8487['offset']=qs[_0x62da('0x31')](_0x2b6b56['query']['offset']);}_0x2b8487['order']=qs[_0x62da('0x4b')](_0x2b6b56[_0x62da('0x42')]['sort']);_0x2b8487[_0x62da('0x4c')]=qs['filters'](_[_0x62da('0x4d')](_0x2b6b56['query'],_0x3c37b6['filters']),_0x44c3dc);if(_0x2b6b56[_0x62da('0x42')][_0x62da('0x4e')]){_0x2b8487[_0x62da('0x4c')]=_['merge'](_0x2b8487[_0x62da('0x4c')],{'$or':_[_0x62da('0x41')](_0x44c3dc,function(_0xbe8215){if(_0xbe8215[_0x62da('0x3e')]!==_0x62da('0x4f')){var _0x4ac65d={};_0x4ac65d[_0xbe8215['name']]={'$like':'%'+_0x2b6b56[_0x62da('0x42')][_0x62da('0x4e')]+'%'};return _0x4ac65d;}})});}_0x2b8487=_[_0x62da('0x50')]({},_0x2b8487,_0x2b6b56[_0x62da('0x51')]);var _0x401cb2={'where':_0x2b8487['where']};return db['WhatsappMessage'][_0x62da('0x30')](_0x401cb2)[_0x62da('0x23')](function(_0x4ce46c){_0x555556[_0x62da('0x30')]=_0x4ce46c;if(_0x2b6b56[_0x62da('0x42')][_0x62da('0x52')]){_0x2b8487[_0x62da('0x53')]=[{'all':!![]}];}return db[_0x62da('0x3c')]['findAll'](_0x2b8487);})[_0x62da('0x23')](function(_0x3b2291){_0x555556[_0x62da('0x54')]=_0x3b2291;return _0x555556;})[_0x62da('0x23')](respondWithFilteredResult(_0x4bd7b7,_0x2b8487))[_0x62da('0x2c')](handleError(_0x4bd7b7,null));};exports[_0x62da('0x55')]=function(_0x209a9e,_0x294bfc){var _0x2e7f05={'raw':!![],'where':{'id':_0x209a9e[_0x62da('0x56')]['id']}},_0x4be558={};_0x4be558[_0x62da('0x40')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x4be558[_0x62da('0x42')]=_[_0x62da('0x43')](_0x209a9e[_0x62da('0x42')]);_0x4be558['filters']=_[_0x62da('0x45')](_0x4be558[_0x62da('0x40')],_0x4be558[_0x62da('0x42')]);_0x2e7f05['attributes']=_[_0x62da('0x45')](_0x4be558[_0x62da('0x40')],qs[_0x62da('0x47')](_0x209a9e[_0x62da('0x42')]['fields']));_0x2e7f05[_0x62da('0x46')]=_0x2e7f05[_0x62da('0x46')][_0x62da('0x48')]?_0x2e7f05[_0x62da('0x46')]:_0x4be558[_0x62da('0x40')];if(_0x209a9e[_0x62da('0x42')][_0x62da('0x52')]){_0x2e7f05[_0x62da('0x53')]=[{'all':!![]}];}_0x2e7f05=_[_0x62da('0x50')]({},_0x2e7f05,_0x209a9e['options']);return db['WhatsappMessage'][_0x62da('0x57')](_0x2e7f05)['then'](handleEntityNotFound(_0x294bfc,null))['then'](respondWithResult(_0x294bfc,null))['catch'](handleError(_0x294bfc,null));};exports[_0x62da('0x58')]=function(_0x14473c,_0x30e0d6){return db['WhatsappMessage'][_0x62da('0x58')](_0x14473c[_0x62da('0x59')],{})[_0x62da('0x23')](respondWithResult(_0x30e0d6,0xc9))[_0x62da('0x2c')](handleError(_0x30e0d6,null));};exports['update']=function(_0x1cb3b2,_0x30e05c){if(_0x1cb3b2[_0x62da('0x59')]['id']){delete _0x1cb3b2['body']['id'];}return db[_0x62da('0x3c')]['find']({'where':{'id':_0x1cb3b2[_0x62da('0x56')]['id']}})['then'](handleEntityNotFound(_0x30e05c,null))[_0x62da('0x23')](saveUpdates(_0x1cb3b2[_0x62da('0x59')],null))[_0x62da('0x23')](respondWithResult(_0x30e05c,null))[_0x62da('0x2c')](handleError(_0x30e05c,null));};exports[_0x62da('0x37')]=function(_0x2774a2,_0x2b62ad){return db['WhatsappMessage'][_0x62da('0x57')]({'where':{'id':_0x2774a2[_0x62da('0x56')]['id']}})['then'](handleEntityNotFound(_0x2b62ad,null))['then'](removeEntity(_0x2b62ad,null))[_0x62da('0x2c')](handleError(_0x2b62ad,null));};exports['describe']=function(_0x5c7f93,_0x426628){return db[_0x62da('0x3c')][_0x62da('0x5a')]()[_0x62da('0x23')](respondWithResult(_0x426628,null))[_0x62da('0x2c')](handleError(_0x426628,null));};var interaction_log=require(_0x62da('0x17'))(_0x62da('0x5b'));exports[_0x62da('0x5c')]=function(_0x1f17f2,_0x329d66,_0x3abdd3){var _0x57cb15={'agent':{},'channel':'whatsapp'};if(_0x1f17f2[_0x62da('0x59')]['id']){delete _0x1f17f2[_0x62da('0x59')]['id'];}_0x1f17f2['body'][_0x62da('0x5d')]=!![];_0x1f17f2[_0x62da('0x59')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1f17f2[_0x62da('0x59')][_0x62da('0x5e')]=_0x1f17f2['body'][_0x62da('0x5e')]||_0x1f17f2['user']['id'];_0x57cb15[_0x62da('0x5f')]['id']=_0x1f17f2[_0x62da('0x59')][_0x62da('0x5e')];return db[_0x62da('0x3c')][_0x62da('0x57')]({'where':{'id':_0x1f17f2['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x62da('0x60')}]})['then'](handleEntityNotFound(_0x329d66,null))[_0x62da('0x23')](saveUpdates(_0x1f17f2[_0x62da('0x59')],null))['then'](function(_0x2a1186){if(_0x2a1186){_0x57cb15['message']=_0x2a1186['get']({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x2a1186[_0x62da('0x61')]}});}return null;})[_0x62da('0x23')](handleEntityNotFound(_0x329d66,null))[_0x62da('0x23')](function(_0x2debcc){if(_0x2debcc){return _0x2debcc[_0x62da('0x62')]({'UserId':_0x1f17f2[_0x62da('0x59')][_0x62da('0x5e')],'read1stAt':_['isNil'](_0x2debcc['read1stAt'])?moment()[_0x62da('0x63')](_0x62da('0x64')):undefined});}return null;})[_0x62da('0x23')](function(_0x5e1cf5){if(_0x5e1cf5){_0x57cb15[_0x62da('0x65')]=_0x5e1cf5[_0x62da('0x66')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f17f2[_0x62da('0x67')]['id'],_0x1f17f2[_0x62da('0x67')][_0x62da('0x39')],_0x1f17f2['user']['role'],_0x57cb15[_0x62da('0x65')]['id'],_0x1f17f2[_0x62da('0x59')]?JSON[_0x62da('0x28')](_0x1f17f2['body']):_0x62da('0x68'));return respondWithRpcPromise(_0x62da('0x69'),'acceptMessage',_0x57cb15);}return null;})[_0x62da('0x23')](function(_0xb63f71){if(_0xb63f71){if(_0x1f17f2[_0x62da('0x59')][_0x62da('0x6a')]){_0x57cb15[_0x62da('0x2b')][_0x62da('0x6b')]=util[_0x62da('0x63')](_0x62da('0x6c'),_0x1f17f2[_0x62da('0x67')][_0x62da('0x39')]);_0x57cb15['message'][_0x62da('0x6d')]=_0x57cb15[_0x62da('0x6d')];_0x57cb15['message']['event']=_0x62da('0x5c');return respondWithRpcPromise(_0x62da('0x6e'),'EventManager',{'event':_0x62da('0x6f'),'message':_0x57cb15[_0x62da('0x2b')]},client9002)[_0x62da('0x23')](function(){return _0x57cb15;});}return _0x57cb15;}return null;})[_0x62da('0x23')](respondWithResult(_0x329d66,null))['catch'](handleError(_0x329d66,null));};var interaction_log=require(_0x62da('0x17'))(_0x62da('0x5b'));exports[_0x62da('0x36')]=function(_0x301036,_0x3c6479,_0x12e56a){var _0x3bfc1d={'agent':{},'channel':_0x62da('0x70')};if(_0x301036[_0x62da('0x59')]['id']){delete _0x301036[_0x62da('0x59')]['id'];}_0x301036[_0x62da('0x59')][_0x62da('0x5e')]=_0x301036[_0x62da('0x59')][_0x62da('0x5e')]||_0x301036[_0x62da('0x67')]['id'];_0x3bfc1d[_0x62da('0x5f')]['id']=_0x301036[_0x62da('0x59')][_0x62da('0x5e')];return db['WhatsappMessage']['find']({'where':{'id':_0x301036[_0x62da('0x56')]['id'],'UserId':null}})[_0x62da('0x23')](handleEntityNotFound(_0x3c6479,null))[_0x62da('0x23')](function(_0x3c56bf){if(_0x3c56bf){_0x3bfc1d['message']=_0x3c56bf['get']({'plain':!![]});return db[_0x62da('0x71')][_0x62da('0x57')]({'where':{'id':_0x3c56bf[_0x62da('0x61')]}});}return null;})[_0x62da('0x23')](handleEntityNotFound(_0x3c6479,null))[_0x62da('0x23')](function(_0x2de434){if(_0x2de434){_0x3bfc1d[_0x62da('0x65')]=_0x2de434[_0x62da('0x66')]({'plain':!![]});interaction_log[_0x62da('0x24')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x301036[_0x62da('0x67')]['id'],_0x301036[_0x62da('0x67')][_0x62da('0x39')],_0x301036[_0x62da('0x67')][_0x62da('0x72')],_0x3bfc1d['interaction']['id'],_0x301036[_0x62da('0x59')]?JSON['stringify'](_0x301036['body']):'null');return respondWithRpcPromise(_0x62da('0x73'),_0x62da('0x74'),_0x3bfc1d);}return null;})['then'](function(_0x46156a){if(_0x46156a){_0x46156a[_0x62da('0x2b')]['interface']=util['format']('SIP/%s',_0x301036[_0x62da('0x67')][_0x62da('0x39')]);_0x46156a[_0x62da('0x2b')][_0x62da('0x6d')]=_0x3bfc1d[_0x62da('0x6d')];_0x46156a['message']['event']='reject';respondWithRpcPromise(_0x62da('0x6e'),_0x62da('0x6e'),{'event':_0x62da('0x75'),'message':_0x46156a[_0x62da('0x2b')]},client9002);return _0x3bfc1d;}return null;})[_0x62da('0x23')](respondWithResult(_0x3c6479,null))[_0x62da('0x2c')](handleError(_0x3c6479,null));};exports[_0x62da('0x2e')]=function(_0x3103fc,_0xc072ab,_0x52ee7e){if(_0x3103fc[_0x62da('0x59')]['id']){delete _0x3103fc['body']['id'];}var _0x1f0420;return db[_0x62da('0x3c')][_0x62da('0x57')]({'where':{'id':_0x3103fc[_0x62da('0x56')]['id']}})[_0x62da('0x23')](handleEntityNotFound(_0xc072ab,null))[_0x62da('0x23')](function(_0x74900e){if(_0x74900e){_0x1f0420=_0x74900e;return db[_0x62da('0x76')]['find']({'where':{'id':_0x74900e[_0x62da('0x77')]}});}})[_0x62da('0x23')](handleEntityNotFound(_0xc072ab,null))['then'](function(_0x5b295b){if(_0x5b295b){logger[_0x62da('0x78')](_0x62da('0x79'),_0x62da('0x2e'),'received\x20delivery\x20report\x20from',_0x5b295b[_0x62da('0x3e')],util[_0x62da('0x7a')](_0x3103fc[_0x62da('0x59')],{'showHidden':![],'depth':null}));switch(_0x5b295b[_0x62da('0x3e')]){case _0x62da('0x7b'):if(_0x3103fc[_0x62da('0x59')]['MessageSid']&&_0x3103fc[_0x62da('0x59')][_0x62da('0x7c')]===_0x1f0420[_0x62da('0x7d')]&&_0x3103fc[_0x62da('0x59')][_0x62da('0x7e')]&&_0x3103fc[_0x62da('0x59')][_0x62da('0x7e')]===_0x62da('0x5d')){return _0x1f0420['update']({'read':!![]});}else{logger[_0x62da('0x29')](_0x62da('0x7f'),_0x62da('0x2e'),_0x62da('0x7b'),util[_0x62da('0x7a')](_0x3103fc[_0x62da('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x1f0420;}})[_0x62da('0x23')](respondWithResult(_0xc072ab,null))['catch'](handleError(_0xc072ab,null));}; \ No newline at end of file +var _0x6372=['whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','params','include','options','create','body','find','destroy','describe'];(function(_0x33a7b3,_0x563f0c){var _0x3e9d3d=function(_0x4acf86){while(--_0x4acf86){_0x33a7b3['push'](_0x33a7b3['shift']());}};_0x3e9d3d(++_0x563f0c);}(_0x6372,0x1b8));var _0x2637=function(_0x4ffcda,_0x3fd619){_0x4ffcda=_0x4ffcda-0x0;var _0xbc5f88=_0x6372[_0x4ffcda];return _0xbc5f88;};'use strict';var pdf=require(_0x2637('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2637('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2637('0x2'));var rp=require(_0x2637('0x3'));var moment=require('moment');var BPromise=require(_0x2637('0x4'));var Mustache=require(_0x2637('0x5'));var util=require(_0x2637('0x6'));var path=require(_0x2637('0x7'));var sox=require(_0x2637('0x8'));var csv=require('to-csv');var ejs=require(_0x2637('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2637('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2637('0xb'));var Papa=require(_0x2637('0xc'));var Redis=require(_0x2637('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2637('0xe'));var hardwareService=require(_0x2637('0xf'));var logger=require(_0x2637('0x10'))(_0x2637('0x11'));var utils=require(_0x2637('0x12'));var config=require(_0x2637('0x13'));var licenseUtil=require(_0x2637('0x14'));var db=require(_0x2637('0x15'))['db'];config[_0x2637('0x16')]=_['defaults'](config[_0x2637('0x16')],{'host':_0x2637('0x17'),'port':0x18eb});var socket=require(_0x2637('0x18'))(new Redis(config['redis']));require(_0x2637('0x19'))[_0x2637('0x1a')](socket);var jayson=require(_0x2637('0x1b'));var client=jayson[_0x2637('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x2637('0x1c')][_0x2637('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3f69d9,_0xcf9bb3,_0x19c502,_0x453127){return new BPromise(function(_0x567d3c,_0x4868f4){var _0x2bc8d9=_0x453127||client;return _0x2bc8d9['request'](_0x3f69d9,_0x19c502)[_0x2637('0x1e')](function(_0x3dcb2e){logger[_0x2637('0x1f')]('WhatsappMessage,\x20%s,\x20%s',_0xcf9bb3,_0x2637('0x20'));logger[_0x2637('0x21')](_0x2637('0x22'),_0xcf9bb3,'request\x20sent',JSON[_0x2637('0x23')](_0x3dcb2e));if(_0x3dcb2e[_0x2637('0x24')]){if(_0x3dcb2e[_0x2637('0x24')]['code']===0x1f4){logger[_0x2637('0x24')](_0x2637('0x25'),_0xcf9bb3,_0x3dcb2e[_0x2637('0x24')]['message']);return _0x4868f4(_0x3dcb2e[_0x2637('0x24')]['message']);}logger[_0x2637('0x24')](_0x2637('0x25'),_0xcf9bb3,_0x3dcb2e[_0x2637('0x24')]['message']);return _0x567d3c(_0x3dcb2e['error'][_0x2637('0x26')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xcf9bb3,'request\x20sent');_0x567d3c(_0x3dcb2e[_0x2637('0x27')][_0x2637('0x26')]);}})[_0x2637('0x28')](function(_0x3d3bd9){logger[_0x2637('0x24')](_0x2637('0x25'),_0xcf9bb3,_0x3d3bd9);_0x4868f4(_0x3d3bd9);});});}function respondWithStatusCode(_0x29b632,_0x46a36f){_0x46a36f=_0x46a36f||0xcc;return function(_0x59a93a){if(_0x59a93a){return _0x29b632[_0x2637('0x29')](_0x46a36f);}return _0x29b632[_0x2637('0x2a')](_0x46a36f)['end']();};}function respondWithResult(_0x34497d,_0x2d3f28){_0x2d3f28=_0x2d3f28||0xc8;return function(_0x2d3e00){if(_0x2d3e00){return _0x34497d[_0x2637('0x2a')](_0x2d3f28)['json'](_0x2d3e00);}};}function respondWithFilteredResult(_0xe3c5e2,_0x15e4b6){return function(_0x257edc){if(_0x257edc){var _0x27f326=_0x257edc[_0x2637('0x2b')],_0x44065e=_0x15e4b6['offset'],_0x5ab29f=_0x15e4b6[_0x2637('0x2c')]+_0x15e4b6[_0x2637('0x2d')],_0x5c84d7;if(_0x5ab29f>=_0x27f326){_0x5ab29f=_0x27f326;_0x5c84d7=0xc8;}else{_0x5c84d7=0xce;}_0xe3c5e2[_0x2637('0x2a')](_0x5c84d7);return _0xe3c5e2[_0x2637('0x2e')](_0x2637('0x2f'),_0x44065e+'-'+_0x5ab29f+'/'+_0x27f326)[_0x2637('0x30')](_0x257edc);}return null;};}function patchUpdates(_0x29ea79){return function(_0x3ad0fa){try{jsonpatch[_0x2637('0x31')](_0x3ad0fa,_0x29ea79,!![]);}catch(_0x14735d){return BPromise[_0x2637('0x32')](_0x14735d);}return _0x3ad0fa[_0x2637('0x33')]();};}function saveUpdates(_0x43d458,_0x2b477a){return function(_0x2fbf4d){if(_0x2fbf4d){return _0x2fbf4d[_0x2637('0x34')](_0x43d458)[_0x2637('0x1e')](function(_0x5db7d2){return _0x5db7d2;});}return null;};}function removeEntity(_0xf4d86f,_0x13a123){return function(_0x5713be){if(_0x5713be){return _0x5713be['destroy']()[_0x2637('0x1e')](function(){_0xf4d86f[_0x2637('0x2a')](0xcc)[_0x2637('0x35')]();});}};}function handleEntityNotFound(_0xa4faa3,_0xc9c243){return function(_0x337c84){if(!_0x337c84){_0xa4faa3[_0x2637('0x29')](0x194);}return _0x337c84;};}function handleError(_0x41c480,_0x39e321){_0x39e321=_0x39e321||0x1f4;return function(_0x7ce609){logger[_0x2637('0x24')](_0x7ce609[_0x2637('0x36')]);if(_0x7ce609['name']){delete _0x7ce609[_0x2637('0x37')];}_0x41c480['status'](_0x39e321)[_0x2637('0x38')](_0x7ce609);};}exports[_0x2637('0x39')]=function(_0x1268de,_0x1e12c3){var _0x4774c3={},_0x2aee3e={},_0x98fd88={'count':0x0,'rows':[]};var _0x14b022=_[_0x2637('0x3a')](db[_0x2637('0x3b')][_0x2637('0x3c')],function(_0x34cc06){return{'name':_0x34cc06[_0x2637('0x3d')],'type':_0x34cc06[_0x2637('0x3e')][_0x2637('0x3f')]};});_0x2aee3e[_0x2637('0x40')]=_[_0x2637('0x3a')](_0x14b022,'name');_0x2aee3e[_0x2637('0x41')]=_[_0x2637('0x42')](_0x1268de[_0x2637('0x41')]);_0x2aee3e[_0x2637('0x43')]=_[_0x2637('0x44')](_0x2aee3e[_0x2637('0x40')],_0x2aee3e[_0x2637('0x41')]);_0x4774c3['attributes']=_[_0x2637('0x44')](_0x2aee3e[_0x2637('0x40')],qs[_0x2637('0x45')](_0x1268de['query']['fields']));_0x4774c3[_0x2637('0x46')]=_0x4774c3[_0x2637('0x46')][_0x2637('0x47')]?_0x4774c3[_0x2637('0x46')]:_0x2aee3e[_0x2637('0x40')];if(!_0x1268de['query'][_0x2637('0x48')](_0x2637('0x49'))){_0x4774c3[_0x2637('0x2d')]=qs[_0x2637('0x2d')](_0x1268de['query'][_0x2637('0x2d')]);_0x4774c3['offset']=qs[_0x2637('0x2c')](_0x1268de[_0x2637('0x41')][_0x2637('0x2c')]);}_0x4774c3[_0x2637('0x4a')]=qs[_0x2637('0x4b')](_0x1268de['query'][_0x2637('0x4b')]);_0x4774c3[_0x2637('0x4c')]=qs[_0x2637('0x43')](_[_0x2637('0x4d')](_0x1268de[_0x2637('0x41')],_0x2aee3e[_0x2637('0x43')]),_0x14b022);if(_0x1268de['query'][_0x2637('0x4e')]){_0x4774c3[_0x2637('0x4c')]=_[_0x2637('0x4f')](_0x4774c3[_0x2637('0x4c')],{'$or':_[_0x2637('0x3a')](_0x14b022,function(_0xbaefef){if(_0xbaefef[_0x2637('0x3e')]!==_0x2637('0x50')){var _0x123ed3={};_0x123ed3[_0xbaefef[_0x2637('0x37')]]={'$like':'%'+_0x1268de[_0x2637('0x41')][_0x2637('0x4e')]+'%'};return _0x123ed3;}})});}_0x4774c3=_[_0x2637('0x4f')]({},_0x4774c3,_0x1268de['options']);var _0x2a8e9a={'where':_0x4774c3[_0x2637('0x4c')]};return db[_0x2637('0x3b')][_0x2637('0x2b')](_0x2a8e9a)[_0x2637('0x1e')](function(_0x2471c9){_0x98fd88['count']=_0x2471c9;if(_0x1268de[_0x2637('0x41')][_0x2637('0x51')]){_0x4774c3['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x2637('0x52')](_0x4774c3);})[_0x2637('0x1e')](function(_0x1de58c){_0x98fd88['rows']=_0x1de58c;return _0x98fd88;})[_0x2637('0x1e')](respondWithFilteredResult(_0x1e12c3,_0x4774c3))[_0x2637('0x28')](handleError(_0x1e12c3,null));};exports[_0x2637('0x53')]=function(_0x5b1cae,_0x3d8fe2){var _0x2951f9={'raw':!![],'where':{'id':_0x5b1cae[_0x2637('0x54')]['id']}},_0x126cda={};_0x126cda[_0x2637('0x40')]=_[_0x2637('0x42')](db[_0x2637('0x3b')][_0x2637('0x3c')]);_0x126cda[_0x2637('0x41')]=_[_0x2637('0x42')](_0x5b1cae[_0x2637('0x41')]);_0x126cda[_0x2637('0x43')]=_[_0x2637('0x44')](_0x126cda[_0x2637('0x40')],_0x126cda[_0x2637('0x41')]);_0x2951f9[_0x2637('0x46')]=_[_0x2637('0x44')](_0x126cda[_0x2637('0x40')],qs[_0x2637('0x45')](_0x5b1cae[_0x2637('0x41')][_0x2637('0x45')]));_0x2951f9[_0x2637('0x46')]=_0x2951f9[_0x2637('0x46')][_0x2637('0x47')]?_0x2951f9[_0x2637('0x46')]:_0x126cda[_0x2637('0x40')];if(_0x5b1cae[_0x2637('0x41')][_0x2637('0x51')]){_0x2951f9[_0x2637('0x55')]=[{'all':!![]}];}_0x2951f9=_[_0x2637('0x4f')]({},_0x2951f9,_0x5b1cae[_0x2637('0x56')]);return db[_0x2637('0x3b')]['find'](_0x2951f9)['then'](handleEntityNotFound(_0x3d8fe2,null))['then'](respondWithResult(_0x3d8fe2,null))[_0x2637('0x28')](handleError(_0x3d8fe2,null));};exports[_0x2637('0x57')]=function(_0x305eb6,_0x52f54d){return db[_0x2637('0x3b')][_0x2637('0x57')](_0x305eb6[_0x2637('0x58')],{})[_0x2637('0x1e')](respondWithResult(_0x52f54d,0xc9))[_0x2637('0x28')](handleError(_0x52f54d,null));};exports[_0x2637('0x34')]=function(_0x46173d,_0xb3e606){if(_0x46173d[_0x2637('0x58')]['id']){delete _0x46173d[_0x2637('0x58')]['id'];}return db['WhatsappMessage'][_0x2637('0x59')]({'where':{'id':_0x46173d[_0x2637('0x54')]['id']}})['then'](handleEntityNotFound(_0xb3e606,null))['then'](saveUpdates(_0x46173d[_0x2637('0x58')],null))[_0x2637('0x1e')](respondWithResult(_0xb3e606,null))[_0x2637('0x28')](handleError(_0xb3e606,null));};exports[_0x2637('0x5a')]=function(_0x59653d,_0x34cf66){return db[_0x2637('0x3b')][_0x2637('0x59')]({'where':{'id':_0x59653d[_0x2637('0x54')]['id']}})[_0x2637('0x1e')](handleEntityNotFound(_0x34cf66,null))['then'](removeEntity(_0x34cf66,null))['catch'](handleError(_0x34cf66,null));};exports[_0x2637('0x5b')]=function(_0x5e008d,_0x405b80){return db[_0x2637('0x3b')]['describe']()['then'](respondWithResult(_0x405b80,null))[_0x2637('0x28')](handleError(_0x405b80,null));};var interaction_log=require('../../config/logger')(_0x2637('0x5c'));exports[_0x2637('0x5d')]=function(_0xabf7f5,_0x16eebb,_0x31aa31){var _0x1d6e8e={'agent':{},'channel':_0x2637('0x5e')};if(_0xabf7f5[_0x2637('0x58')]['id']){delete _0xabf7f5['body']['id'];}_0xabf7f5[_0x2637('0x58')][_0x2637('0x5f')]=!![];_0xabf7f5[_0x2637('0x58')][_0x2637('0x60')]=moment()[_0x2637('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0xabf7f5[_0x2637('0x58')][_0x2637('0x62')]=_0xabf7f5[_0x2637('0x58')][_0x2637('0x62')]||_0xabf7f5[_0x2637('0x63')]['id'];_0x1d6e8e[_0x2637('0x64')]['id']=_0xabf7f5[_0x2637('0x58')][_0x2637('0x62')];return db[_0x2637('0x3b')][_0x2637('0x59')]({'where':{'id':_0xabf7f5[_0x2637('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x2637('0x65')],'as':_0x2637('0x66')}]})[_0x2637('0x1e')](handleEntityNotFound(_0x16eebb,null))[_0x2637('0x1e')](saveUpdates(_0xabf7f5[_0x2637('0x58')],null))['then'](function(_0xc61ed9){if(_0xc61ed9){_0x1d6e8e[_0x2637('0x26')]=_0xc61ed9[_0x2637('0x67')]({'plain':!![]});return db[_0x2637('0x68')][_0x2637('0x59')]({'where':{'id':_0xc61ed9[_0x2637('0x69')]}});}return null;})[_0x2637('0x1e')](handleEntityNotFound(_0x16eebb,null))['then'](function(_0x12dc4a){if(_0x12dc4a){return _0x12dc4a[_0x2637('0x34')]({'UserId':_0xabf7f5['body'][_0x2637('0x62')],'read1stAt':_[_0x2637('0x6a')](_0x12dc4a[_0x2637('0x6b')])?moment()[_0x2637('0x61')](_0x2637('0x6c')):undefined});}return null;})[_0x2637('0x1e')](function(_0x27aa88){if(_0x27aa88){_0x1d6e8e[_0x2637('0x6d')]=_0x27aa88[_0x2637('0x67')]({'plain':!![]});interaction_log[_0x2637('0x1f')](_0x2637('0x6e'),_0xabf7f5['user']['id'],_0xabf7f5['user'][_0x2637('0x37')],_0xabf7f5['user'][_0x2637('0x6f')],_0x1d6e8e['interaction']['id'],_0xabf7f5['body']?JSON[_0x2637('0x23')](_0xabf7f5['body']):'null');return respondWithRpcPromise(_0x2637('0x70'),_0x2637('0x71'),_0x1d6e8e);}return null;})[_0x2637('0x1e')](function(_0x11d8f9){if(_0x11d8f9){if(_0xabf7f5[_0x2637('0x58')][_0x2637('0x72')]){_0x1d6e8e['message'][_0x2637('0x73')]=util[_0x2637('0x61')]('SIP/%s',_0xabf7f5[_0x2637('0x63')][_0x2637('0x37')]);_0x1d6e8e['message']['channel']=_0x1d6e8e[_0x2637('0x74')];_0x1d6e8e[_0x2637('0x26')][_0x2637('0x75')]=_0x2637('0x5d');return respondWithRpcPromise(_0x2637('0x76'),_0x2637('0x76'),{'event':_0x2637('0x77'),'message':_0x1d6e8e[_0x2637('0x26')]},client9002)['then'](function(){return _0x1d6e8e;});}return _0x1d6e8e;}return null;})[_0x2637('0x1e')](respondWithResult(_0x16eebb,null))[_0x2637('0x28')](handleError(_0x16eebb,null));};var interaction_log=require(_0x2637('0x10'))(_0x2637('0x5c'));exports['reject']=function(_0x50c118,_0x514649,_0x35fbe1){var _0x4fbb64={'agent':{},'channel':_0x2637('0x5e')};if(_0x50c118[_0x2637('0x58')]['id']){delete _0x50c118[_0x2637('0x58')]['id'];}_0x50c118['body'][_0x2637('0x62')]=_0x50c118[_0x2637('0x58')][_0x2637('0x62')]||_0x50c118['user']['id'];_0x4fbb64[_0x2637('0x64')]['id']=_0x50c118[_0x2637('0x58')][_0x2637('0x62')];return db[_0x2637('0x3b')][_0x2637('0x59')]({'where':{'id':_0x50c118[_0x2637('0x54')]['id'],'UserId':null}})[_0x2637('0x1e')](handleEntityNotFound(_0x514649,null))[_0x2637('0x1e')](function(_0x39318b){if(_0x39318b){_0x4fbb64['message']=_0x39318b['get']({'plain':!![]});return db[_0x2637('0x68')][_0x2637('0x59')]({'where':{'id':_0x39318b['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x514649,null))[_0x2637('0x1e')](function(_0x19edd6){if(_0x19edd6){_0x4fbb64[_0x2637('0x6d')]=_0x19edd6[_0x2637('0x67')]({'plain':!![]});interaction_log[_0x2637('0x1f')](_0x2637('0x78'),_0x50c118[_0x2637('0x63')]['id'],_0x50c118[_0x2637('0x63')]['name'],_0x50c118['user'][_0x2637('0x6f')],_0x4fbb64[_0x2637('0x6d')]['id'],_0x50c118[_0x2637('0x58')]?JSON[_0x2637('0x23')](_0x50c118[_0x2637('0x58')]):'null');return respondWithRpcPromise(_0x2637('0x79'),_0x2637('0x7a'),_0x4fbb64);}return null;})['then'](function(_0x494e85){if(_0x494e85){_0x494e85['message'][_0x2637('0x73')]=util['format'](_0x2637('0x7b'),_0x50c118[_0x2637('0x63')][_0x2637('0x37')]);_0x494e85[_0x2637('0x26')][_0x2637('0x74')]=_0x4fbb64['channel'];_0x494e85['message'][_0x2637('0x75')]=_0x2637('0x32');respondWithRpcPromise(_0x2637('0x76'),'EventManager',{'event':_0x2637('0x7c'),'message':_0x494e85[_0x2637('0x26')]},client9002);return _0x4fbb64;}return null;})[_0x2637('0x1e')](respondWithResult(_0x514649,null))[_0x2637('0x28')](handleError(_0x514649,null));};exports[_0x2637('0x2a')]=function(_0x2a9631,_0x32ca4a,_0x4b3849){if(_0x2a9631[_0x2637('0x58')]['id']){delete _0x2a9631[_0x2637('0x58')]['id'];}var _0x3f6536;return db[_0x2637('0x3b')][_0x2637('0x59')]({'where':{'id':_0x2a9631['params']['id']}})[_0x2637('0x1e')](handleEntityNotFound(_0x32ca4a,null))[_0x2637('0x1e')](function(_0x3f37bf){if(_0x3f37bf){_0x3f6536=_0x3f37bf;return db[_0x2637('0x7d')][_0x2637('0x59')]({'where':{'id':_0x3f37bf['WhatsappAccountId']}});}})[_0x2637('0x1e')](handleEntityNotFound(_0x32ca4a,null))[_0x2637('0x1e')](function(_0x929d45){if(_0x929d45){logger['debug'](_0x2637('0x7e'),'status',_0x2637('0x7f'),_0x929d45['type'],util[_0x2637('0x80')](_0x2a9631[_0x2637('0x58')],{'showHidden':![],'depth':null}));switch(_0x929d45[_0x2637('0x3e')]){case _0x2637('0x81'):if(_0x2a9631[_0x2637('0x58')]['MessageSid']&&_0x2a9631[_0x2637('0x58')][_0x2637('0x82')]===_0x3f6536[_0x2637('0x83')]&&_0x2a9631['body'][_0x2637('0x84')]&&_0x2a9631[_0x2637('0x58')]['MessageStatus']==='read'){return _0x3f6536[_0x2637('0x34')]({'read':!![]});}else{logger[_0x2637('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2637('0x2a'),_0x2637('0x81'),util[_0x2637('0x80')](_0x2a9631[_0x2637('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3f6536;}})[_0x2637('0x1e')](respondWithResult(_0x32ca4a,null))[_0x2637('0x28')](handleError(_0x32ca4a,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index c45e95a..d007da9 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 _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0xd4c47,_0x5af489){var _0x19414d=function(_0x21e1c9){while(--_0x21e1c9){_0xd4c47['push'](_0xd4c47['shift']());}};_0x19414d(++_0x5af489);}(_0xb10b,0x12a));var _0xbb10=function(_0x45423e,_0x4cc862){_0x45423e=_0x45423e-0x0;var _0x3157c1=_0xb10b[_0x45423e];return _0x3157c1;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x7bea2c,_0x3aca0c){var _0x50553a=function(_0x1f8d6){while(--_0x1f8d6){_0x7bea2c['push'](_0x7bea2c['shift']());}};_0x50553a(++_0x3aca0c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4dd64b,_0x3b6289){_0x4dd64b=_0x4dd64b-0x0;var _0x1af70d=_0x5f2f[_0x4dd64b];return _0x1af70d;};'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 51bf7c0..6a414f4 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 _0x21a1=['afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','catch','error','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4cebcc,_0x56253e){var _0x4d1669=function(_0x89e326){while(--_0x89e326){_0x4cebcc['push'](_0x4cebcc['shift']());}};_0x4d1669(++_0x56253e);}(_0x21a1,0xe6));var _0x121a=function(_0xbf3b47,_0x3daf6a){_0xbf3b47=_0xbf3b47-0x0;var _0x5d1247=_0x21a1[_0xbf3b47];return _0x5d1247;};'use strict';var _=require(_0x121a('0x0'));var util=require(_0x121a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x121a('0x2'));var BPromise=require(_0x121a('0x3'));var rp=require(_0x121a('0x4'));var fs=require('fs');var path=require(_0x121a('0x5'));var rimraf=require(_0x121a('0x6'));var config=require(_0x121a('0x7'));var attributes=require(_0x121a('0x8'));module[_0x121a('0x9')]=function(_0x26b0bc,_0x1a8ec3){return _0x26b0bc['define'](_0x121a('0xa'),attributes,{'tableName':_0x121a('0xb'),'paranoid':![],'indexes':[{'name':_0x121a('0xc'),'fields':[_0x121a('0xc')]},{'name':_0x121a('0xd'),'fields':[_0x121a('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x535d11,_0x108a66,_0x218073){var _0xffdc75=_0x26b0bc['models'];var _0x351529=_0x535d11[_0x121a('0xf')]({'plain':!![]});if(_0x351529['direction']['toLowerCase']()==='in'||_0x351529[_0x121a('0x10')][_0x121a('0x11')]()===_0x121a('0x12')&&!_0x351529[_0x121a('0x13')]&&!_[_0x121a('0x14')](_0x351529[_0x121a('0x15')])){_0xffdc75[_0x121a('0x16')]['findOne']({'where':{'id':_0x351529[_0x121a('0x17')]}})[_0x121a('0x18')](function(_0x1c7a30){if(_0x1c7a30){_0x1c7a30[_0x121a('0x19')]({'lastMsgAt':_0x351529['createdAt'],'lastMsgDirection':_0x351529[_0x121a('0x10')][_0x121a('0x11')]()});}})[_0x121a('0x1a')](function(_0x3d1acf){console[_0x121a('0x1b')](_0x3d1acf);});}if(_0x351529[_0x121a('0x10')]===_0x121a('0x12')&&!_0x351529['secret']){var _0x31897c;_0xffdc75['WhatsappAccount']['find']({'where':{'id':_0x351529['WhatsappAccountId']},'raw':!![]})['then'](function(_0xf2ae7){_0x31897c=_0xf2ae7;if(_0x31897c&&_0x31897c['type']){switch(_0x31897c[_0x121a('0x1c')]){case'twilio':var _0x1a1958=require(_0x121a('0x1d'));if(_0x31897c[_0x121a('0x1e')]&&_0x31897c[_0x121a('0x1f')]&&_0x31897c['phone']){var _0x2d3671=new _0x1a1958(_0x31897c[_0x121a('0x1e')],_0x31897c['authToken']);_0x2d3671[_0x121a('0x20')][_0x121a('0x21')]({'body':_0x351529[_0x121a('0xe')],'to':_0x121a('0x22')+_0x351529[_0x121a('0x23')],'from':_0x121a('0x22')+_0x31897c[_0x121a('0x23')],'statusCallback':_0x31897c[_0x121a('0x24')]+_0x121a('0x25')+_0x351529['id']+_0x121a('0x26')+_0x31897c['token']})[_0x121a('0x18')](function(_0x34dd4d){if(_0x34dd4d['sid']){return _0x535d11[_0x121a('0x19')]({'messageId':_0x34dd4d['sid']});}})[_0x121a('0x1a')](function(_0x2f7a71){logger[_0x121a('0x1b')](_0x121a('0x27'),_0x121a('0x28'),_0x121a('0x1d'),util[_0x121a('0x29')](_0x2f7a71,{'showHidden':![],'depth':null}));});}else{logger[_0x121a('0x1b')](_0x121a('0x27'),_0x121a('0x28'),_0x121a('0x1d'),_0x121a('0x2a'));}break;}}})['finally'](function(){_0x218073();});}else{_0x218073();}}},'charset':_0x121a('0x2b'),'collate':_0x121a('0x2c')});}; \ No newline at end of file +var _0xc106=['bluebird','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','error','WhatsappAccount','find','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','api'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc106,0x118));var _0x6c10=function(_0x2b6628,_0x4056cf){_0x2b6628=_0x2b6628-0x0;var _0x47d0ce=_0xc106[_0x2b6628];return _0x47d0ce;};'use strict';var _=require(_0x6c10('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6c10('0x1'));var moment=require('moment');var BPromise=require(_0x6c10('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6c10('0x3'));var config=require(_0x6c10('0x4'));var attributes=require(_0x6c10('0x5'));module[_0x6c10('0x6')]=function(_0x1c7428,_0x1e21e3){return _0x1c7428[_0x6c10('0x7')](_0x6c10('0x8'),attributes,{'tableName':_0x6c10('0x9'),'paranoid':![],'indexes':[{'name':_0x6c10('0xa'),'fields':[_0x6c10('0xa')]},{'name':'fti_whatsapp_messages','fields':[_0x6c10('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x100a84,_0x521655,_0xfabb6e){var _0x12c1ad=_0x1c7428['models'];var _0x448286=_0x100a84[_0x6c10('0xc')]({'plain':!![]});if(_0x448286[_0x6c10('0xd')][_0x6c10('0xe')]()==='in'||_0x448286[_0x6c10('0xd')][_0x6c10('0xe')]()===_0x6c10('0xf')&&!_0x448286[_0x6c10('0x10')]&&!_[_0x6c10('0x11')](_0x448286[_0x6c10('0x12')])){_0x12c1ad[_0x6c10('0x13')][_0x6c10('0x14')]({'where':{'id':_0x448286[_0x6c10('0x15')]}})['then'](function(_0x5882fe){if(_0x5882fe){_0x5882fe[_0x6c10('0x16')]({'lastMsgAt':_0x448286[_0x6c10('0x17')],'lastMsgDirection':_0x448286['direction']['toLowerCase']()});}})['catch'](function(_0x455381){console[_0x6c10('0x18')](_0x455381);});}if(_0x448286[_0x6c10('0xd')]===_0x6c10('0xf')&&!_0x448286[_0x6c10('0x10')]){var _0x81620b;_0x12c1ad[_0x6c10('0x19')][_0x6c10('0x1a')]({'where':{'id':_0x448286['WhatsappAccountId']},'raw':!![]})[_0x6c10('0x1b')](function(_0x9e3995){_0x81620b=_0x9e3995;if(_0x81620b&&_0x81620b['type']){switch(_0x81620b[_0x6c10('0x1c')]){case _0x6c10('0x1d'):var _0x5c8c9e=require(_0x6c10('0x1d'));if(_0x81620b[_0x6c10('0x1e')]&&_0x81620b[_0x6c10('0x1f')]&&_0x81620b[_0x6c10('0x20')]){var _0x3d3157=new _0x5c8c9e(_0x81620b[_0x6c10('0x1e')],_0x81620b[_0x6c10('0x1f')]);_0x3d3157[_0x6c10('0x21')][_0x6c10('0x22')]({'body':_0x448286[_0x6c10('0xb')],'to':_0x6c10('0x23')+_0x448286['phone'],'from':_0x6c10('0x23')+_0x81620b['phone'],'statusCallback':_0x81620b[_0x6c10('0x24')]+_0x6c10('0x25')+_0x448286['id']+_0x6c10('0x26')+_0x81620b[_0x6c10('0x27')]})[_0x6c10('0x1b')](function(_0x5f56cd){if(_0x5f56cd[_0x6c10('0x28')]){return _0x100a84['update']({'messageId':_0x5f56cd[_0x6c10('0x28')]});}})['catch'](function(_0xbda11b){logger[_0x6c10('0x18')](_0x6c10('0x29'),_0x6c10('0x2a'),'twilio',util[_0x6c10('0x2b')](_0xbda11b,{'showHidden':![],'depth':null}));});}else{logger[_0x6c10('0x18')](_0x6c10('0x29'),_0x6c10('0x2a'),_0x6c10('0x1d'),_0x6c10('0x2c'));}break;}}})[_0x6c10('0x2d')](function(){_0xfabb6e();});}else{_0xfabb6e();}}},'charset':_0x6c10('0x2e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index d3b254c..29ee10e 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 _0x8ff4=['then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw'];(function(_0x526d6c,_0x1cc58a){var _0x43b854=function(_0x2768d5){while(--_0x2768d5){_0x526d6c['push'](_0x526d6c['shift']());}};_0x43b854(++_0x1cc58a);}(_0x8ff4,0x121));var _0x48ff=function(_0xeea5ca,_0x2d569b){_0xeea5ca=_0xeea5ca-0x0;var _0x1fdf07=_0x8ff4[_0xeea5ca];return _0x1fdf07;};'use strict';var _=require(_0x48ff('0x0'));var util=require(_0x48ff('0x1'));var moment=require(_0x48ff('0x2'));var BPromise=require(_0x48ff('0x3'));var rs=require(_0x48ff('0x4'));var fs=require('fs');var Redis=require(_0x48ff('0x5'));var db=require(_0x48ff('0x6'))['db'];var utils=require(_0x48ff('0x7'));var logger=require(_0x48ff('0x8'))(_0x48ff('0x9'));var config=require('../../config/environment');var jayson=require(_0x48ff('0xa'));var client=jayson['client'][_0x48ff('0xb')]({'port':0x232a});config['redis']=_[_0x48ff('0xc')](config[_0x48ff('0xd')],{'host':_0x48ff('0xe'),'port':0x18eb});var socket=require(_0x48ff('0xf'))(new Redis(config[_0x48ff('0xd')]));require(_0x48ff('0x10'))[_0x48ff('0x11')](socket);function respondWithRpcPromise(_0x5c4fd7,_0x511409,_0x321187){return new BPromise(function(_0x2d19b6,_0x1f608a){return client['request'](_0x5c4fd7,_0x321187)['then'](function(_0x14427b){logger[_0x48ff('0x12')](_0x48ff('0x13'),_0x511409,_0x48ff('0x14'));logger[_0x48ff('0x15')](_0x48ff('0x16'),_0x511409,'request\x20sent',JSON[_0x48ff('0x17')](_0x14427b));if(_0x14427b[_0x48ff('0x18')]){if(_0x14427b[_0x48ff('0x18')][_0x48ff('0x19')]===0x1f4){logger[_0x48ff('0x18')](_0x48ff('0x13'),_0x511409,_0x14427b['error']['message']);return _0x1f608a(_0x14427b['error'][_0x48ff('0x1a')]);}logger['error'](_0x48ff('0x13'),_0x511409,_0x14427b['error']['message']);return _0x2d19b6(_0x14427b[_0x48ff('0x18')][_0x48ff('0x1a')]);}else{logger['info'](_0x48ff('0x13'),_0x511409,_0x48ff('0x14'));_0x2d19b6(_0x14427b[_0x48ff('0x1b')]['message']);}})[_0x48ff('0x1c')](function(_0x3f91f2){logger[_0x48ff('0x18')](_0x48ff('0x13'),_0x511409,_0x3f91f2);_0x1f608a(_0x3f91f2);});});}exports[_0x48ff('0x1d')]=function(_0x399537){var _0x2eb442=this;return new Promise(function(_0x3eea70,_0x100861){return db[_0x48ff('0x1e')][_0x48ff('0x1f')](_0x399537[_0x48ff('0x20')],{'raw':_0x399537[_0x48ff('0x21')]?_0x399537[_0x48ff('0x21')][_0x48ff('0x22')]===undefined?!![]:![]:!![]})[_0x48ff('0x23')](function(_0xbbf4c){logger[_0x48ff('0x12')]('CreateWhatsappMessage',_0x399537);logger['debug'](_0x48ff('0x1d'),_0x399537,JSON[_0x48ff('0x17')](_0xbbf4c));_0x3eea70(_0xbbf4c);})['catch'](function(_0x255d37){logger['error'](_0x48ff('0x1d'),_0x255d37[_0x48ff('0x1a')],_0x399537);_0x100861(_0x2eb442[_0x48ff('0x18')](0x1f4,_0x255d37['message']));});});}; \ No newline at end of file +var _0x5162=['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','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0xd8e6a5,_0x1b1e33){var _0x248f29=function(_0x17600f){while(--_0x17600f){_0xd8e6a5['push'](_0xd8e6a5['shift']());}};_0x248f29(++_0x1b1e33);}(_0x5162,0x15f));var _0x2516=function(_0x49f72d,_0x315dc6){_0x49f72d=_0x49f72d-0x0;var _0x4e1123=_0x5162[_0x49f72d];return _0x4e1123;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var moment=require(_0x2516('0x1'));var BPromise=require(_0x2516('0x2'));var rs=require(_0x2516('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2516('0x4'))['db'];var utils=require(_0x2516('0x5'));var logger=require('../../config/logger')(_0x2516('0x6'));var config=require(_0x2516('0x7'));var jayson=require(_0x2516('0x8'));var client=jayson['client'][_0x2516('0x9')]({'port':0x232a});config[_0x2516('0xa')]=_[_0x2516('0xb')](config[_0x2516('0xa')],{'host':_0x2516('0xc'),'port':0x18eb});var socket=require(_0x2516('0xd'))(new Redis(config['redis']));require(_0x2516('0xe'))[_0x2516('0xf')](socket);function respondWithRpcPromise(_0x2923c9,_0x2cbd4f,_0x458432){return new BPromise(function(_0x101770,_0x2ae991){return client[_0x2516('0x10')](_0x2923c9,_0x458432)[_0x2516('0x11')](function(_0x4ddbb7){logger[_0x2516('0x12')](_0x2516('0x13'),_0x2cbd4f,_0x2516('0x14'));logger['debug'](_0x2516('0x15'),_0x2cbd4f,_0x2516('0x14'),JSON[_0x2516('0x16')](_0x4ddbb7));if(_0x4ddbb7['error']){if(_0x4ddbb7[_0x2516('0x17')][_0x2516('0x18')]===0x1f4){logger['error'](_0x2516('0x13'),_0x2cbd4f,_0x4ddbb7[_0x2516('0x17')][_0x2516('0x19')]);return _0x2ae991(_0x4ddbb7[_0x2516('0x17')]['message']);}logger[_0x2516('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x2cbd4f,_0x4ddbb7[_0x2516('0x17')][_0x2516('0x19')]);return _0x101770(_0x4ddbb7[_0x2516('0x17')]['message']);}else{logger['info'](_0x2516('0x13'),_0x2cbd4f,_0x2516('0x14'));_0x101770(_0x4ddbb7[_0x2516('0x1a')]['message']);}})[_0x2516('0x1b')](function(_0x462332){logger[_0x2516('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x2cbd4f,_0x462332);_0x2ae991(_0x462332);});});}exports[_0x2516('0x1c')]=function(_0x12c1c6){var _0x1ccc1f=this;return new Promise(function(_0x48ac81,_0x38aa6c){return db[_0x2516('0x1d')][_0x2516('0x1e')](_0x12c1c6['body'],{'raw':_0x12c1c6['options']?_0x12c1c6[_0x2516('0x1f')][_0x2516('0x20')]===undefined?!![]:![]:!![]})[_0x2516('0x11')](function(_0x43c544){logger['info']('CreateWhatsappMessage',_0x12c1c6);logger['debug']('CreateWhatsappMessage',_0x12c1c6,JSON[_0x2516('0x16')](_0x43c544));_0x48ac81(_0x43c544);})['catch'](function(_0x2c71c5){logger[_0x2516('0x17')](_0x2516('0x1c'),_0x2c71c5['message'],_0x12c1c6);_0x38aa6c(_0x1ccc1f['error'](0x1f4,_0x2c71c5[_0x2516('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 16f50d0..c866d53 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 _0x0207=['emit','removeListener','length','whatsappMessage:','save'];(function(_0x5126e7,_0x4b3dad){var _0x395c01=function(_0x42fc6c){while(--_0x42fc6c){_0x5126e7['push'](_0x5126e7['shift']());}};_0x395c01(++_0x4b3dad);}(_0x0207,0x162));var _0x7020=function(_0x566438,_0x3abb6a){_0x566438=_0x566438-0x0;var _0x2d8c26=_0x0207[_0x566438];return _0x2d8c26;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x7020('0x0'),'remove','update'];function createListener(_0x1a481c,_0x28ab1d){return function(_0x2213ca){_0x28ab1d[_0x7020('0x1')](_0x1a481c,_0x2213ca);};}function removeListener(_0x2e62fd,_0x25174b){return function(){WhatsappMessageEvents[_0x7020('0x2')](_0x2e62fd,_0x25174b);};}exports['register']=function(_0x5074d7){for(var _0x38c320=0x0,_0x39263c=events[_0x7020('0x3')];_0x38c320<_0x39263c;_0x38c320++){var _0x17deac=events[_0x38c320];var _0x42bc79=createListener(_0x7020('0x4')+_0x17deac,_0x5074d7);WhatsappMessageEvents['on'](_0x17deac,_0x42bc79);}}; \ No newline at end of file +var _0x26ed=['length','whatsappMessage:','save','update','emit','removeListener','register'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x26ed,0x17c));var _0xd26e=function(_0x5e1f4b,_0x50b208){_0x5e1f4b=_0x5e1f4b-0x0;var _0x5ce7b4=_0x26ed[_0x5e1f4b];return _0x5ce7b4;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xd26e('0x0'),'remove',_0xd26e('0x1')];function createListener(_0x522f42,_0x20b85f){return function(_0x2d95e9){_0x20b85f[_0xd26e('0x2')](_0x522f42,_0x2d95e9);};}function removeListener(_0x5b410f,_0x41bc84){return function(){WhatsappMessageEvents[_0xd26e('0x3')](_0x5b410f,_0x41bc84);};}exports[_0xd26e('0x4')]=function(_0x20d67d){for(var _0x10072d=0x0,_0x3c32df=events[_0xd26e('0x5')];_0x10072d<_0x3c32df;_0x10072d++){var _0x5b8430=events[_0x10072d];var _0x820d88=createListener(_0xd26e('0x6')+_0x5b8430,_0x20d67d);WhatsappMessageEvents['on'](_0x5b8430,_0x820d88);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index a6ff2db..977225a 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 _0x4363=['isAuthenticated','index','describe','get','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller'];(function(_0x23ca4d,_0x5c2a32){var _0x435432=function(_0xe1a5e5){while(--_0xe1a5e5){_0x23ca4d['push'](_0x23ca4d['shift']());}};_0x435432(++_0x5c2a32);}(_0x4363,0x111));var _0x3436=function(_0x35dcca,_0x14e01d){_0x35dcca=_0x35dcca-0x0;var _0x4d843c=_0x4363[_0x35dcca];return _0x4d843c;};'use strict';var multer=require('multer');var util=require(_0x3436('0x0'));var path=require(_0x3436('0x1'));var timeout=require(_0x3436('0x2'));var express=require('express');var router=express[_0x3436('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3436('0x4'));var config=require(_0x3436('0x5'));var controller=require(_0x3436('0x6'));router['get']('/',auth[_0x3436('0x7')](),controller[_0x3436('0x8')]);router['get']('/describe',auth[_0x3436('0x7')](),controller[_0x3436('0x9')]);router[_0x3436('0xa')](_0x3436('0xb'),auth[_0x3436('0x7')](),controller[_0x3436('0xc')]);router[_0x3436('0xa')](_0x3436('0xd'),auth[_0x3436('0x7')](),controller[_0x3436('0xe')]);router[_0x3436('0xa')](_0x3436('0xf'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x3436('0x10'),auth[_0x3436('0x7')](),controller[_0x3436('0x11')]);router[_0x3436('0x12')]('/',auth[_0x3436('0x7')](),controller[_0x3436('0x13')]);router['post'](_0x3436('0xf'),auth[_0x3436('0x7')](),controller[_0x3436('0x14')]);router[_0x3436('0x12')](_0x3436('0x10'),auth[_0x3436('0x7')](),controller[_0x3436('0x15')]);router[_0x3436('0x16')](_0x3436('0xb'),auth['isAuthenticated'](),controller[_0x3436('0x17')]);router[_0x3436('0x18')](_0x3436('0xb'),auth[_0x3436('0x7')](),controller[_0x3436('0x19')]);router[_0x3436('0x18')](_0x3436('0xf'),auth[_0x3436('0x7')](),controller['removeTeams']);router[_0x3436('0x18')](_0x3436('0x10'),auth[_0x3436('0x7')](),controller[_0x3436('0x1a')]);module[_0x3436('0x1b')]=router; \ No newline at end of file +var _0xaad7=['show','get','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','/describe','describe','/:id'];(function(_0xaa65bc,_0x439a58){var _0x23d144=function(_0x6ba39f){while(--_0x6ba39f){_0xaa65bc['push'](_0xaa65bc['shift']());}};_0x23d144(++_0x439a58);}(_0xaad7,0x89));var _0x7aad=function(_0x344cc0,_0x38a44e){_0x344cc0=_0x344cc0-0x0;var _0x227cdd=_0xaad7[_0x344cc0];return _0x227cdd;};'use strict';var multer=require(_0x7aad('0x0'));var util=require(_0x7aad('0x1'));var path=require('path');var timeout=require(_0x7aad('0x2'));var express=require(_0x7aad('0x3'));var router=express[_0x7aad('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7aad('0x5'));var config=require(_0x7aad('0x6'));var controller=require(_0x7aad('0x7'));router['get']('/',auth[_0x7aad('0x8')](),controller[_0x7aad('0x9')]);router['get'](_0x7aad('0xa'),auth[_0x7aad('0x8')](),controller[_0x7aad('0xb')]);router['get'](_0x7aad('0xc'),auth[_0x7aad('0x8')](),controller[_0x7aad('0xd')]);router[_0x7aad('0xe')]('/:id/members',auth[_0x7aad('0x8')](),controller[_0x7aad('0xf')]);router[_0x7aad('0xe')](_0x7aad('0x10'),auth[_0x7aad('0x8')](),controller[_0x7aad('0x11')]);router['get'](_0x7aad('0x12'),auth[_0x7aad('0x8')](),controller[_0x7aad('0x13')]);router['post']('/',auth[_0x7aad('0x8')](),controller[_0x7aad('0x14')]);router[_0x7aad('0x15')](_0x7aad('0x10'),auth[_0x7aad('0x8')](),controller[_0x7aad('0x16')]);router[_0x7aad('0x15')](_0x7aad('0x12'),auth[_0x7aad('0x8')](),controller[_0x7aad('0x17')]);router[_0x7aad('0x18')](_0x7aad('0xc'),auth['isAuthenticated'](),controller[_0x7aad('0x19')]);router[_0x7aad('0x1a')](_0x7aad('0xc'),auth[_0x7aad('0x8')](),controller['destroy']);router[_0x7aad('0x1a')](_0x7aad('0x10'),auth[_0x7aad('0x8')](),controller[_0x7aad('0x1b')]);router[_0x7aad('0x1a')](_0x7aad('0x12'),auth[_0x7aad('0x8')](),controller[_0x7aad('0x1c')]);module[_0x7aad('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d2801cd..3bf54a0 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 _0x305c=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x5d2f74,_0x1c52f6){var _0x499378=function(_0x24631a){while(--_0x24631a){_0x5d2f74['push'](_0x5d2f74['shift']());}};_0x499378(++_0x1c52f6);}(_0x305c,0x1b8));var _0xc305=function(_0x2c7ff5,_0x504abe){_0x2c7ff5=_0x2c7ff5-0x0;var _0x42fef4=_0x305c[_0x2c7ff5];return _0x42fef4;};'use strict';var Sequelize=require(_0xc305('0x0'));module[_0xc305('0x1')]={'name':{'type':Sequelize[_0xc305('0x2')],'unique':_0xc305('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc305('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc305('0x5')](_0xc305('0x6'),_0xc305('0x7'),_0xc305('0x8'))},'description':{'type':Sequelize[_0xc305('0x2')]}}; \ No newline at end of file +var _0x7374=['sequelize','exports','STRING','INTEGER','ENUM','roundrobin'];(function(_0x21c20f,_0x4eae36){var _0xbf268f=function(_0xc5cee6){while(--_0xc5cee6){_0x21c20f['push'](_0x21c20f['shift']());}};_0xbf268f(++_0x4eae36);}(_0x7374,0x90));var _0x4737=function(_0x30a8fa,_0x3e78fa){_0x30a8fa=_0x30a8fa-0x0;var _0x2048f9=_0x7374[_0x30a8fa];return _0x2048f9;};'use strict';var Sequelize=require(_0x4737('0x0'));module[_0x4737('0x1')]={'name':{'type':Sequelize[_0x4737('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4737('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4737('0x4')]('rrmemory','beepall',_0x4737('0x5'))},'description':{'type':Sequelize[_0x4737('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index d7ac62b..7f9731f 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 _0xdc2c=['get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','index','map','WhatsappQueue','fieldName','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','filters','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','whatsappPause','getTeams','Team','pick','addTeams','ids','Agents','online','interface','transaction','each','UserWhatsappQueue','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','apply','save','update','then'];(function(_0x154cb5,_0x1a8d5a){var _0x3f574f=function(_0x597a52){while(--_0x597a52){_0x154cb5['push'](_0x154cb5['shift']());}};_0x3f574f(++_0x1a8d5a);}(_0xdc2c,0x179));var _0xcdc2=function(_0x557ea6,_0x12b064){_0x557ea6=_0x557ea6-0x0;var _0xf2e7a1=_0xdc2c[_0x557ea6];return _0xf2e7a1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcdc2('0x0'));var rimraf=require(_0xcdc2('0x1'));var zipdir=require(_0xcdc2('0x2'));var jsonpatch=require(_0xcdc2('0x3'));var rp=require(_0xcdc2('0x4'));var moment=require(_0xcdc2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcdc2('0x6'));var path=require(_0xcdc2('0x7'));var sox=require(_0xcdc2('0x8'));var csv=require('to-csv');var ejs=require(_0xcdc2('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcdc2('0xa'));var toCsv=require(_0xcdc2('0xb'));var querystring=require('querystring');var Papa=require(_0xcdc2('0xc'));var Redis=require('ioredis');var authService=require(_0xcdc2('0xd'));var qs=require(_0xcdc2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdc2('0xf'));var logger=require(_0xcdc2('0x10'))(_0xcdc2('0x11'));var utils=require('../../config/utils');var config=require(_0xcdc2('0x12'));var licenseUtil=require(_0xcdc2('0x13'));var db=require(_0xcdc2('0x14'))['db'];config['redis']=_[_0xcdc2('0x15')](config['redis'],{'host':_0xcdc2('0x16'),'port':0x18eb});var socket=require(_0xcdc2('0x17'))(new Redis(config[_0xcdc2('0x18')]));require(_0xcdc2('0x19'))[_0xcdc2('0x1a')](socket);function respondWithStatusCode(_0x2e9730,_0x4a612c){_0x4a612c=_0x4a612c||0xcc;return function(_0x51d5ea){if(_0x51d5ea){return _0x2e9730[_0xcdc2('0x1b')](_0x4a612c);}return _0x2e9730[_0xcdc2('0x1c')](_0x4a612c)[_0xcdc2('0x1d')]();};}function respondWithResult(_0x3964c3,_0x5201ea){_0x5201ea=_0x5201ea||0xc8;return function(_0x1b9a13){if(_0x1b9a13){return _0x3964c3[_0xcdc2('0x1c')](_0x5201ea)[_0xcdc2('0x1e')](_0x1b9a13);}};}function respondWithFilteredResult(_0x2027fa,_0x43fd25){return function(_0x35ae2f){if(_0x35ae2f){var _0x5eb72c=_0x35ae2f[_0xcdc2('0x1f')],_0x2cbfab=_0x43fd25[_0xcdc2('0x20')],_0x4f94f6=_0x43fd25[_0xcdc2('0x20')]+_0x43fd25['limit'],_0x1b21bb;if(_0x4f94f6>=_0x5eb72c){_0x4f94f6=_0x5eb72c;_0x1b21bb=0xc8;}else{_0x1b21bb=0xce;}_0x2027fa[_0xcdc2('0x1c')](_0x1b21bb);return _0x2027fa['set']('Content-Range',_0x2cbfab+'-'+_0x4f94f6+'/'+_0x5eb72c)[_0xcdc2('0x1e')](_0x35ae2f);}return null;};}function patchUpdates(_0xb23eb8){return function(_0x138482){try{jsonpatch[_0xcdc2('0x21')](_0x138482,_0xb23eb8,!![]);}catch(_0x3a1be8){return BPromise['reject'](_0x3a1be8);}return _0x138482[_0xcdc2('0x22')]();};}function saveUpdates(_0x1d61d6,_0x10f282){return function(_0x532158){if(_0x532158){return _0x532158[_0xcdc2('0x23')](_0x1d61d6)['then'](function(_0x67fc5){return _0x67fc5;});}return null;};}function removeEntity(_0x5f0e93,_0x5ac323){return function(_0x429dc2){if(_0x429dc2){return _0x429dc2['destroy']()[_0xcdc2('0x24')](function(){var _0x306dc8=_0x429dc2[_0xcdc2('0x25')]({'plain':!![]});var _0xc54994=_0xcdc2('0x26');return db[_0xcdc2('0x27')][_0xcdc2('0x28')]({'where':{'type':_0xc54994,'resourceId':_0x306dc8['id']}})[_0xcdc2('0x24')](function(){return _0x429dc2;});})[_0xcdc2('0x24')](function(){_0x5f0e93[_0xcdc2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b41c6,_0x273ae9){return function(_0x2f5e54){if(!_0x2f5e54){_0x3b41c6[_0xcdc2('0x1b')](0x194);}return _0x2f5e54;};}function handleError(_0x4af957,_0x123a38){_0x123a38=_0x123a38||0x1f4;return function(_0x311b1b){logger[_0xcdc2('0x29')](_0x311b1b[_0xcdc2('0x2a')]);if(_0x311b1b['name']){delete _0x311b1b[_0xcdc2('0x2b')];}_0x4af957['status'](_0x123a38)['send'](_0x311b1b);};}exports[_0xcdc2('0x2c')]=function(_0x7d22de,_0x513e2a){var _0x908305={},_0xa9c383={},_0x2f5bfc={'count':0x0,'rows':[]};var _0xeb6c76=_[_0xcdc2('0x2d')](db[_0xcdc2('0x2e')]['rawAttributes'],function(_0xb3dccc){return{'name':_0xb3dccc[_0xcdc2('0x2f')],'type':_0xb3dccc['type']['key']};});_0xa9c383['model']=_[_0xcdc2('0x2d')](_0xeb6c76,_0xcdc2('0x2b'));_0xa9c383[_0xcdc2('0x30')]=_[_0xcdc2('0x31')](_0x7d22de[_0xcdc2('0x30')]);_0xa9c383['filters']=_['intersection'](_0xa9c383[_0xcdc2('0x32')],_0xa9c383[_0xcdc2('0x30')]);_0x908305[_0xcdc2('0x33')]=_[_0xcdc2('0x34')](_0xa9c383[_0xcdc2('0x32')],qs[_0xcdc2('0x35')](_0x7d22de['query'][_0xcdc2('0x35')]));_0x908305[_0xcdc2('0x33')]=_0x908305[_0xcdc2('0x33')][_0xcdc2('0x36')]?_0x908305['attributes']:_0xa9c383['model'];if(!_0x7d22de[_0xcdc2('0x30')][_0xcdc2('0x37')](_0xcdc2('0x38'))){_0x908305[_0xcdc2('0x39')]=qs[_0xcdc2('0x39')](_0x7d22de[_0xcdc2('0x30')][_0xcdc2('0x39')]);_0x908305[_0xcdc2('0x20')]=qs[_0xcdc2('0x20')](_0x7d22de[_0xcdc2('0x30')][_0xcdc2('0x20')]);}_0x908305[_0xcdc2('0x3a')]=qs[_0xcdc2('0x3b')](_0x7d22de[_0xcdc2('0x30')][_0xcdc2('0x3b')]);_0x908305[_0xcdc2('0x3c')]=qs['filters'](_['pick'](_0x7d22de[_0xcdc2('0x30')],_0xa9c383['filters']),_0xeb6c76);if(_0x7d22de[_0xcdc2('0x30')]['filter']){_0x908305[_0xcdc2('0x3c')]=_[_0xcdc2('0x3d')](_0x908305[_0xcdc2('0x3c')],{'$or':_['map'](_0xeb6c76,function(_0x2c05cf){if(_0x2c05cf['type']!=='VIRTUAL'){var _0x56e680={};_0x56e680[_0x2c05cf['name']]={'$like':'%'+_0x7d22de[_0xcdc2('0x30')]['filter']+'%'};return _0x56e680;}})});}_0x908305=_[_0xcdc2('0x3d')]({},_0x908305,_0x7d22de[_0xcdc2('0x3e')]);var _0x18c2a3={'where':_0x908305[_0xcdc2('0x3c')]};return db[_0xcdc2('0x2e')][_0xcdc2('0x1f')](_0x18c2a3)[_0xcdc2('0x24')](function(_0x45b230){_0x2f5bfc[_0xcdc2('0x1f')]=_0x45b230;if(_0x7d22de[_0xcdc2('0x30')][_0xcdc2('0x3f')]){_0x908305[_0xcdc2('0x40')]=[{'all':!![]}];}return db[_0xcdc2('0x2e')][_0xcdc2('0x41')](_0x908305);})[_0xcdc2('0x24')](function(_0x45ee91){_0x2f5bfc[_0xcdc2('0x42')]=_0x45ee91;return _0x2f5bfc;})[_0xcdc2('0x24')](respondWithFilteredResult(_0x513e2a,_0x908305))[_0xcdc2('0x43')](handleError(_0x513e2a,null));};exports['show']=function(_0x3f72fb,_0xdbdc0a){var _0x12979b={'raw':!![],'where':{'id':_0x3f72fb['params']['id']}},_0x1eae85={};_0x1eae85['model']=_[_0xcdc2('0x31')](db[_0xcdc2('0x2e')][_0xcdc2('0x44')]);_0x1eae85[_0xcdc2('0x30')]=_[_0xcdc2('0x31')](_0x3f72fb[_0xcdc2('0x30')]);_0x1eae85['filters']=_[_0xcdc2('0x34')](_0x1eae85[_0xcdc2('0x32')],_0x1eae85[_0xcdc2('0x30')]);_0x12979b[_0xcdc2('0x33')]=_[_0xcdc2('0x34')](_0x1eae85[_0xcdc2('0x32')],qs[_0xcdc2('0x35')](_0x3f72fb[_0xcdc2('0x30')][_0xcdc2('0x35')]));_0x12979b['attributes']=_0x12979b[_0xcdc2('0x33')][_0xcdc2('0x36')]?_0x12979b['attributes']:_0x1eae85[_0xcdc2('0x32')];if(_0x3f72fb[_0xcdc2('0x30')][_0xcdc2('0x3f')]){_0x12979b[_0xcdc2('0x40')]=[{'all':!![]}];}_0x12979b=_[_0xcdc2('0x3d')]({},_0x12979b,_0x3f72fb[_0xcdc2('0x3e')]);return db[_0xcdc2('0x2e')]['find'](_0x12979b)[_0xcdc2('0x24')](handleEntityNotFound(_0xdbdc0a,null))[_0xcdc2('0x24')](respondWithResult(_0xdbdc0a,null))[_0xcdc2('0x43')](handleError(_0xdbdc0a,null));};exports['create']=function(_0x256bf3,_0x1c88c4){return db[_0xcdc2('0x2e')][_0xcdc2('0x45')](_0x256bf3['body'],{})['then'](function(_0x771c18){var _0xe1bfa6=_0x256bf3[_0xcdc2('0x46')][_0xcdc2('0x25')]({'plain':!![]});if(!_0xe1bfa6)throw new Error(_0xcdc2('0x47'));if(_0xe1bfa6[_0xcdc2('0x48')]===_0xcdc2('0x46')){var _0x4ece36=_0x771c18[_0xcdc2('0x25')]({'plain':!![]});var _0x4a30c0='WhatsappQueues';return db[_0xcdc2('0x49')][_0xcdc2('0x4a')]({'where':{'name':_0x4a30c0,'userProfileId':_0xe1bfa6[_0xcdc2('0x4b')]},'raw':!![]})[_0xcdc2('0x24')](function(_0x3fe0fd){if(_0x3fe0fd&&_0x3fe0fd['autoAssociation']===0x0){return db[_0xcdc2('0x27')][_0xcdc2('0x45')]({'name':_0x4ece36[_0xcdc2('0x2b')],'resourceId':_0x4ece36['id'],'type':_0x3fe0fd['name'],'sectionId':_0x3fe0fd['id']},{})['then'](function(){return _0x771c18;});}else{return _0x771c18;}})[_0xcdc2('0x43')](function(_0x1cdeb9){logger[_0xcdc2('0x29')](_0xcdc2('0x4c'),_0x1cdeb9);throw _0x1cdeb9;});}return _0x771c18;})[_0xcdc2('0x24')](respondWithResult(_0x1c88c4,0xc9))['catch'](handleError(_0x1c88c4,null));};exports['update']=function(_0x17a8c9,_0x4d1ead){if(_0x17a8c9[_0xcdc2('0x4d')]['id']){delete _0x17a8c9[_0xcdc2('0x4d')]['id'];}return db['WhatsappQueue'][_0xcdc2('0x4a')]({'where':{'id':_0x17a8c9['params']['id']}})[_0xcdc2('0x24')](handleEntityNotFound(_0x4d1ead,null))[_0xcdc2('0x24')](saveUpdates(_0x17a8c9['body'],null))[_0xcdc2('0x24')](respondWithResult(_0x4d1ead,null))[_0xcdc2('0x43')](handleError(_0x4d1ead,null));};exports[_0xcdc2('0x28')]=function(_0x11f19f,_0x48c1b8){return db['WhatsappQueue'][_0xcdc2('0x4a')]({'where':{'id':_0x11f19f[_0xcdc2('0x4e')]['id']}})[_0xcdc2('0x24')](handleEntityNotFound(_0x48c1b8,null))[_0xcdc2('0x24')](removeEntity(_0x48c1b8,null))[_0xcdc2('0x43')](handleError(_0x48c1b8,null));};exports[_0xcdc2('0x4f')]=function(_0xed2eed,_0x5bb012){return db[_0xcdc2('0x2e')][_0xcdc2('0x4f')]()[_0xcdc2('0x24')](respondWithResult(_0x5bb012,null))['catch'](handleError(_0x5bb012,null));};exports[_0xcdc2('0x50')]=function(_0x96932,_0x442c1a,_0x10c7f4){var _0x3a24b7={'raw':!![],'where':{}},_0x241382={},_0x137325;return db[_0xcdc2('0x2e')][_0xcdc2('0x51')]({'where':{'id':_0x96932[_0xcdc2('0x4e')]['id']}})[_0xcdc2('0x24')](handleEntityNotFound(_0x442c1a,null))[_0xcdc2('0x24')](function(_0x11ea93){if(_0x11ea93){_0x137325=_0x11ea93[_0xcdc2('0x25')]({'plain':!![]});_0x241382[_0xcdc2('0x32')]=_['keys'](db['UserWhatsappQueue']['rawAttributes']);_0x241382[_0xcdc2('0x30')]=_[_0xcdc2('0x31')](_0x96932['query']);_0x241382['filters']=_[_0xcdc2('0x34')](_0x241382[_0xcdc2('0x32')],_0x241382[_0xcdc2('0x30')]);_0x3a24b7[_0xcdc2('0x33')]=_[_0xcdc2('0x34')](_0x241382[_0xcdc2('0x32')],qs[_0xcdc2('0x35')](_0x96932[_0xcdc2('0x30')][_0xcdc2('0x35')]));_0x3a24b7[_0xcdc2('0x33')]=_0x3a24b7['attributes'][_0xcdc2('0x36')]?_0x3a24b7['attributes']:_0x241382['model'];if(!_0x96932[_0xcdc2('0x30')][_0xcdc2('0x37')](_0xcdc2('0x38'))){_0x3a24b7[_0xcdc2('0x39')]=qs[_0xcdc2('0x39')](_0x96932['query'][_0xcdc2('0x39')]);_0x3a24b7[_0xcdc2('0x20')]=qs[_0xcdc2('0x20')](_0x96932[_0xcdc2('0x30')][_0xcdc2('0x20')]);}_0x3a24b7['order']=qs[_0xcdc2('0x3b')](_0x96932[_0xcdc2('0x30')]['sort']);_0x3a24b7['where']=qs['filters'](_['pick'](_0x96932[_0xcdc2('0x30')],_0x241382[_0xcdc2('0x52')]));_0x3a24b7[_0xcdc2('0x3c')][_0xcdc2('0x53')]=_0x11ea93['id'];if(_0x96932[_0xcdc2('0x30')]['filter']){_0x3a24b7[_0xcdc2('0x3c')]=_[_0xcdc2('0x3d')](_0x3a24b7['where'],{'$or':_[_0xcdc2('0x2d')](_0x3a24b7['attributes'],function(_0xabb19b){var _0x4cf435={};_0x4cf435[_0xabb19b]={'$like':'%'+_0x96932[_0xcdc2('0x30')][_0xcdc2('0x54')]+'%'};return _0x4cf435;})});}_0x3a24b7=_[_0xcdc2('0x3d')]({},_0x3a24b7,_0x96932[_0xcdc2('0x3e')]);return db['UserWhatsappQueue'][_0xcdc2('0x41')](_0x3a24b7);}})[_0xcdc2('0x24')](function(_0x17e968){if(_0x17e968){return db[_0xcdc2('0x55')][_0xcdc2('0x56')]({'where':{'id':_[_0xcdc2('0x2d')](_0x17e968,_0xcdc2('0x57')),'role':_0xcdc2('0x58')},'attributes':['id',_0xcdc2('0x2b'),'whatsappPause',_0xcdc2('0x59'),_0xcdc2('0x5a')]});}})[_0xcdc2('0x24')](function(_0xebf803){if(_0xebf803){return{'count':_0xebf803['count'],'rows':_[_0xcdc2('0x2d')](_0xebf803[_0xcdc2('0x42')],function(_0x4c08ae){return{'membername':_0x4c08ae['name'],'UserId':_0x4c08ae['id'],'queue_name':_0x137325[_0xcdc2('0x2b')],'WhatsappQueueId':_0x137325['id'],'interface':util['format'](_0xcdc2('0x5b'),_0xcdc2('0x5c'),_0x4c08ae[_0xcdc2('0x2b')]),'penalty':0x0,'paused':_0x4c08ae[_0xcdc2('0x5d')],'createdAt':_0x4c08ae[_0xcdc2('0x5a')],'updatedAt':_0x4c08ae[_0xcdc2('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcdc2('0x24')](respondWithFilteredResult(_0x442c1a,_0x3a24b7))[_0xcdc2('0x43')](handleError(_0x442c1a,null));};exports[_0xcdc2('0x5e')]=function(_0x2a175e,_0x4a049d,_0x4d3560){var _0x24670c={};var _0x5a78ef={};var _0x13d921;var _0x2539ee;return db[_0xcdc2('0x2e')][_0xcdc2('0x51')]({'where':{'id':_0x2a175e[_0xcdc2('0x4e')]['id']}})[_0xcdc2('0x24')](handleEntityNotFound(_0x4a049d,null))[_0xcdc2('0x24')](function(_0x2a921c){if(_0x2a921c){_0x13d921=_0x2a921c;_0x5a78ef['model']=_['keys'](db[_0xcdc2('0x5f')][_0xcdc2('0x44')]);_0x5a78ef[_0xcdc2('0x30')]=_[_0xcdc2('0x31')](_0x2a175e[_0xcdc2('0x30')]);_0x5a78ef[_0xcdc2('0x52')]=_[_0xcdc2('0x34')](_0x5a78ef[_0xcdc2('0x32')],_0x5a78ef['query']);_0x24670c['attributes']=_['intersection'](_0x5a78ef[_0xcdc2('0x32')],qs[_0xcdc2('0x35')](_0x2a175e[_0xcdc2('0x30')][_0xcdc2('0x35')]));_0x24670c['attributes']=_0x24670c[_0xcdc2('0x33')][_0xcdc2('0x36')]?_0x24670c[_0xcdc2('0x33')]:_0x5a78ef[_0xcdc2('0x32')];_0x24670c[_0xcdc2('0x3a')]=qs['sort'](_0x2a175e[_0xcdc2('0x30')][_0xcdc2('0x3b')]);_0x24670c[_0xcdc2('0x3c')]=qs[_0xcdc2('0x52')](_[_0xcdc2('0x60')](_0x2a175e[_0xcdc2('0x30')],_0x5a78ef[_0xcdc2('0x52')]));if(_0x2a175e['query'][_0xcdc2('0x54')]){_0x24670c[_0xcdc2('0x3c')]=_[_0xcdc2('0x3d')](_0x24670c['where'],{'$or':_[_0xcdc2('0x2d')](_0x24670c['attributes'],function(_0x356fcc){var _0x3d3756={};_0x3d3756[_0x356fcc]={'$like':'%'+_0x2a175e['query'][_0xcdc2('0x54')]+'%'};return _0x3d3756;})});}_0x24670c=_[_0xcdc2('0x3d')]({},_0x24670c,_0x2a175e[_0xcdc2('0x3e')]);return _0x13d921['getTeams'](_0x24670c);}})[_0xcdc2('0x24')](function(_0x518036){if(_0x518036){_0x2539ee=_0x518036['length'];if(!_0x2a175e[_0xcdc2('0x30')][_0xcdc2('0x37')]('nolimit')){_0x24670c[_0xcdc2('0x39')]=qs[_0xcdc2('0x39')](_0x2a175e[_0xcdc2('0x30')][_0xcdc2('0x39')]);_0x24670c[_0xcdc2('0x20')]=qs[_0xcdc2('0x20')](_0x2a175e['query'][_0xcdc2('0x20')]);}return _0x13d921['getTeams'](_0x24670c);}})[_0xcdc2('0x24')](function(_0x32a233){if(_0x32a233){return _0x32a233?{'count':_0x2539ee,'rows':_0x32a233}:null;}})['then'](respondWithResult(_0x4a049d,null))[_0xcdc2('0x43')](handleError(_0x4a049d,null));};exports[_0xcdc2('0x61')]=function(_0x20b517,_0x573975,_0x377eb0){var _0x1e534d=_0x20b517[_0xcdc2('0x4d')][_0xcdc2('0x62')];return db[_0xcdc2('0x5f')][_0xcdc2('0x41')]({'where':{'id':_0x1e534d},'attributes':['id'],'include':[{'model':db[_0xcdc2('0x55')],'as':_0xcdc2('0x63'),'attributes':['id','name',_0xcdc2('0x64'),'voicePause',_0xcdc2('0x65')],'raw':!![]}]})[_0xcdc2('0x24')](function(_0x2a561a){if(_0x2a561a){var _0x205b3f=_['flatMap'](_0x2a561a,function(_0x5bf546){var _0x5b29e2=_0x5bf546['get']({'plain':!![]});return _0x5b29e2[_0xcdc2('0x63')];});return db[_0xcdc2('0x2e')][_0xcdc2('0x4a')]({'where':{'id':_0x20b517['params']['id']}})[_0xcdc2('0x24')](function(_0x57f8f6){return db['sequelize'][_0xcdc2('0x66')](function(_0x8ed1a0){return _0x57f8f6[_0xcdc2('0x61')](_0x1e534d,{'transaction':_0x8ed1a0})[_0xcdc2('0x24')](function(){return BPromise[_0xcdc2('0x67')](_0x205b3f,function(_0x590f12){return db[_0xcdc2('0x68')][_0xcdc2('0x69')]({'where':{'UserId':_0x590f12['id'],'WhatsappQueueId':_0x20b517[_0xcdc2('0x4e')]['id']},'transaction':_0x8ed1a0});});})[_0xcdc2('0x24')](function(){_0x205b3f[_0xcdc2('0x6a')](function(_0x3b05d3){socket[_0xcdc2('0x6b')](_0xcdc2('0x6c'),{'UserId':_0x3b05d3['id'],'WhatsappQueueId':_0x57f8f6['id']});});});});});}})[_0xcdc2('0x24')](respondWithStatusCode(_0x573975,null))[_0xcdc2('0x43')](handleError(_0x573975,null));};exports[_0xcdc2('0x6d')]=function(_0x52387a,_0x27b160,_0x498c93){return db[_0xcdc2('0x5f')][_0xcdc2('0x41')]({'where':{'id':_0x52387a[_0xcdc2('0x30')]['ids']},'attributes':['id'],'include':[{'model':db[_0xcdc2('0x55')],'as':_0xcdc2('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x27b160,null))[_0xcdc2('0x24')](function(_0x46732e){var _0x590c39=_[_0xcdc2('0x2d')](_0x46732e,'id');var _0x280c87=[];var _0x49005d=[];var _0x320eaa=squel[_0xcdc2('0x6e')]();_0x320eaa[_0xcdc2('0x6f')]('tq.TeamId')[_0xcdc2('0x70')]('team_has_whatsapp_queues','tq')[_0xcdc2('0x71')](_0xcdc2('0x72'),'ut',_0xcdc2('0x73'))[_0xcdc2('0x3c')](_0xcdc2('0x74'),_0x52387a[_0xcdc2('0x4e')]['id']);for(var _0x4196b7=0x0;_0x4196b7<_0x46732e[_0xcdc2('0x36')];_0x4196b7+=0x1){let _0x299cd6=_0x46732e[_0x4196b7];for(var _0x41bf8e=0x0;_0x41bf8e<_0x299cd6['Agents']['length'];_0x41bf8e+=0x1){let _0x5424d8=_0x299cd6['Agents'][_0x41bf8e];var _0x2828f2=_0x320eaa[_0xcdc2('0x75')]();_0x2828f2[_0xcdc2('0x3c')](_0xcdc2('0x76'),_0x5424d8['id']);_0x49005d[_0xcdc2('0x77')](db[_0xcdc2('0x78')]['query'](_0x2828f2[_0xcdc2('0x79')](),{'type':db[_0xcdc2('0x78')][_0xcdc2('0x7a')][_0xcdc2('0x7b')]})[_0xcdc2('0x24')](function(_0x440345){if(_0x440345['length']===0x1){return _0x5424d8['id'];}else{var _0x42ec4d=_[_0xcdc2('0x7c')](_[_0xcdc2('0x2d')](_0x440345,_0xcdc2('0x7d')),function(_0x8c9568){return _[_0xcdc2('0x7e')](_0x590c39,_0x8c9568);});if(_0x42ec4d){return _0x5424d8['id'];}}}));}}return BPromise[_0xcdc2('0x7f')](_0x49005d)[_0xcdc2('0x24')](function(_0x52bfe0){_0x280c87=_(_0x280c87)[_0xcdc2('0x80')](_0x52bfe0)[_0xcdc2('0x81')]()['value']();return db[_0xcdc2('0x2e')]['find']({'where':{'id':_0x52387a['params']['id']}})[_0xcdc2('0x24')](function(_0x12965a){return db[_0xcdc2('0x78')][_0xcdc2('0x66')](function(_0x3cfe9e){return _0x12965a['removeTeams'](_0x52387a[_0xcdc2('0x30')][_0xcdc2('0x62')],{'transaction':_0x3cfe9e})[_0xcdc2('0x24')](function(){if(!_[_0xcdc2('0x82')](_0x280c87)){return _0x12965a[_0xcdc2('0x83')](_0x280c87,{'transaction':_0x3cfe9e});}})[_0xcdc2('0x24')](function(){_0x280c87[_0xcdc2('0x6a')](function(_0x3cfae9){socket[_0xcdc2('0x6b')](_0xcdc2('0x84'),{'UserId':_0x3cfae9,'WhatsappQueueId':_0x12965a['id']});});});});});});})['then'](respondWithStatusCode(_0x27b160,null))[_0xcdc2('0x43')](handleError(_0x27b160,null));};exports[_0xcdc2('0x85')]=function(_0x1c5869,_0x48189c,_0x18114d){return db[_0xcdc2('0x2e')][_0xcdc2('0x4a')]({'where':{'id':_0x1c5869[_0xcdc2('0x4e')]['id']}})[_0xcdc2('0x24')](handleEntityNotFound(_0x48189c,null))[_0xcdc2('0x24')](function(_0xe23950){if(_0xe23950){return _0xe23950['addAgents'](_0x1c5869[_0xcdc2('0x4d')][_0xcdc2('0x62')],_[_0xcdc2('0x86')](_0x1c5869[_0xcdc2('0x4d')],[_0xcdc2('0x62'),'id'])||{})[_0xcdc2('0x87')](function(_0xec902c){for(var _0x4f2b94=0x0;_0x4f2b94<_0x1c5869[_0xcdc2('0x4d')][_0xcdc2('0x62')][_0xcdc2('0x36')];_0x4f2b94+=0x1){socket[_0xcdc2('0x6b')]('userWhatsappQueue:save',{'UserId':_0x1c5869['body'][_0xcdc2('0x62')][_0x4f2b94],'WhatsappQueueId':_0x1c5869[_0xcdc2('0x4e')]['id']});}return _0xec902c;});}})['then'](respondWithResult(_0x48189c,null))[_0xcdc2('0x43')](handleError(_0x48189c,null));};exports['removeAgents']=function(_0x16fed8,_0x5cc9e9,_0x5e5e6a){return db['WhatsappQueue']['find']({'where':{'id':_0x16fed8[_0xcdc2('0x4e')]['id']}})[_0xcdc2('0x24')](handleEntityNotFound(_0x5cc9e9,null))[_0xcdc2('0x24')](function(_0x588321){if(_0x588321){return _0x588321[_0xcdc2('0x83')](_0x16fed8[_0xcdc2('0x30')][_0xcdc2('0x62')])[_0xcdc2('0x24')](function(){if(_[_0xcdc2('0x88')](_0x16fed8[_0xcdc2('0x30')][_0xcdc2('0x62')])){for(var _0x539c05=0x0;_0x539c05<_0x16fed8[_0xcdc2('0x30')][_0xcdc2('0x62')][_0xcdc2('0x36')];_0x539c05+=0x1){socket['emit'](_0xcdc2('0x84'),{'UserId':Number(_0x16fed8[_0xcdc2('0x30')][_0xcdc2('0x62')][_0x539c05]),'WhatsappQueueId':Number(_0x16fed8[_0xcdc2('0x4e')]['id'])});}}else{socket['emit'](_0xcdc2('0x84'),{'UserId':Number(_0x16fed8[_0xcdc2('0x30')][_0xcdc2('0x62')]),'WhatsappQueueId':Number(_0x16fed8[_0xcdc2('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x5cc9e9,null))[_0xcdc2('0x43')](handleError(_0x5cc9e9,null));};exports[_0xcdc2('0x89')]=function(_0x8ec356,_0x51952d,_0x1cc086){var _0x4c31c0={};var _0x2a8d6d={};var _0x349e93;var _0x26c416;return db['WhatsappQueue'][_0xcdc2('0x51')]({'where':{'id':_0x8ec356[_0xcdc2('0x4e')]['id']}})[_0xcdc2('0x24')](handleEntityNotFound(_0x51952d,null))['then'](function(_0x4ad707){if(_0x4ad707){_0x349e93=_0x4ad707;_0x2a8d6d[_0xcdc2('0x32')]=_[_0xcdc2('0x31')](db[_0xcdc2('0x55')][_0xcdc2('0x44')]);_0x2a8d6d['query']=_[_0xcdc2('0x31')](_0x8ec356[_0xcdc2('0x30')]);_0x2a8d6d['filters']=_[_0xcdc2('0x34')](_0x2a8d6d[_0xcdc2('0x32')],_0x2a8d6d[_0xcdc2('0x30')]);_0x4c31c0[_0xcdc2('0x33')]=_['intersection'](_0x2a8d6d[_0xcdc2('0x32')],qs[_0xcdc2('0x35')](_0x8ec356[_0xcdc2('0x30')]['fields']));_0x4c31c0[_0xcdc2('0x33')]=_0x4c31c0[_0xcdc2('0x33')][_0xcdc2('0x36')]?_0x4c31c0['attributes']:_0x2a8d6d[_0xcdc2('0x32')];_0x4c31c0[_0xcdc2('0x3a')]=qs[_0xcdc2('0x3b')](_0x8ec356[_0xcdc2('0x30')]['sort']);_0x4c31c0[_0xcdc2('0x3c')]=qs['filters'](_[_0xcdc2('0x60')](_0x8ec356['query'],_0x2a8d6d[_0xcdc2('0x52')]));if(_0x8ec356[_0xcdc2('0x30')][_0xcdc2('0x54')]){_0x4c31c0[_0xcdc2('0x3c')]=_['merge'](_0x4c31c0[_0xcdc2('0x3c')],{'$or':_[_0xcdc2('0x2d')](_0x4c31c0[_0xcdc2('0x33')],function(_0x1bda60){var _0x2a90ae={};_0x2a90ae[_0x1bda60]={'$like':'%'+_0x8ec356['query'][_0xcdc2('0x54')]+'%'};return _0x2a90ae;})});}_0x4c31c0=_['merge']({},_0x4c31c0,_0x8ec356['options']);return _0x349e93[_0xcdc2('0x89')](_0x4c31c0);}})[_0xcdc2('0x24')](function(_0x3342b5){if(_0x3342b5){_0x26c416=_0x3342b5['length'];if(!_0x8ec356[_0xcdc2('0x30')][_0xcdc2('0x37')](_0xcdc2('0x38'))){_0x4c31c0[_0xcdc2('0x39')]=qs[_0xcdc2('0x39')](_0x8ec356[_0xcdc2('0x30')][_0xcdc2('0x39')]);_0x4c31c0[_0xcdc2('0x20')]=qs[_0xcdc2('0x20')](_0x8ec356['query']['offset']);}return _0x349e93['getAgents'](_0x4c31c0);}})[_0xcdc2('0x24')](function(_0x2a4ab4){if(_0x2a4ab4){return _0x2a4ab4?{'count':_0x26c416,'rows':_0x2a4ab4}:null;}})[_0xcdc2('0x24')](respondWithResult(_0x51952d,null))[_0xcdc2('0x43')](handleError(_0x51952d,null));}; \ No newline at end of file +var _0x40ba=['whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','ids','online','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','Agents','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','status','end','json','count','limit','set','Content-Range','reject','save','update','then','destroy','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','options','WhatsappQueue','includeAll','include','findAll','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll'];(function(_0x3d6df6,_0x38e19a){var _0x5a858c=function(_0x116919){while(--_0x116919){_0x3d6df6['push'](_0x3d6df6['shift']());}};_0x5a858c(++_0x38e19a);}(_0x40ba,0x1d1));var _0xa40b=function(_0x1d5a32,_0x47974a){_0x1d5a32=_0x1d5a32-0x0;var _0x361ca0=_0x40ba[_0x1d5a32];return _0x361ca0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa40b('0x0'));var rimraf=require(_0xa40b('0x1'));var zipdir=require(_0xa40b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa40b('0x3'));var moment=require(_0xa40b('0x4'));var BPromise=require(_0xa40b('0x5'));var Mustache=require(_0xa40b('0x6'));var util=require(_0xa40b('0x7'));var path=require(_0xa40b('0x8'));var sox=require(_0xa40b('0x9'));var csv=require(_0xa40b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa40b('0xb'));var squel=require(_0xa40b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa40b('0xd'));var toCsv=require(_0xa40b('0xa'));var querystring=require(_0xa40b('0xe'));var Papa=require(_0xa40b('0xf'));var Redis=require(_0xa40b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa40b('0x11'));var as=require(_0xa40b('0x12'));var hardwareService=require(_0xa40b('0x13'));var logger=require('../../config/logger')(_0xa40b('0x14'));var utils=require(_0xa40b('0x15'));var config=require(_0xa40b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa40b('0x17'))['db'];config[_0xa40b('0x18')]=_[_0xa40b('0x19')](config['redis'],{'host':_0xa40b('0x1a'),'port':0x18eb});var socket=require(_0xa40b('0x1b'))(new Redis(config['redis']));require(_0xa40b('0x1c'))['register'](socket);function respondWithStatusCode(_0x4e072d,_0x59a266){_0x59a266=_0x59a266||0xcc;return function(_0x1d8aa4){if(_0x1d8aa4){return _0x4e072d['sendStatus'](_0x59a266);}return _0x4e072d[_0xa40b('0x1d')](_0x59a266)[_0xa40b('0x1e')]();};}function respondWithResult(_0x1d027b,_0x4798be){_0x4798be=_0x4798be||0xc8;return function(_0x4e9977){if(_0x4e9977){return _0x1d027b[_0xa40b('0x1d')](_0x4798be)[_0xa40b('0x1f')](_0x4e9977);}};}function respondWithFilteredResult(_0x12e7f7,_0x51e82b){return function(_0x4b3795){if(_0x4b3795){var _0x373004=_0x4b3795[_0xa40b('0x20')],_0x16e7e8=_0x51e82b['offset'],_0x5e331e=_0x51e82b['offset']+_0x51e82b[_0xa40b('0x21')],_0x20d667;if(_0x5e331e>=_0x373004){_0x5e331e=_0x373004;_0x20d667=0xc8;}else{_0x20d667=0xce;}_0x12e7f7[_0xa40b('0x1d')](_0x20d667);return _0x12e7f7[_0xa40b('0x22')](_0xa40b('0x23'),_0x16e7e8+'-'+_0x5e331e+'/'+_0x373004)[_0xa40b('0x1f')](_0x4b3795);}return null;};}function patchUpdates(_0x5c54c9){return function(_0xe8454){try{jsonpatch['apply'](_0xe8454,_0x5c54c9,!![]);}catch(_0x2fdc7c){return BPromise[_0xa40b('0x24')](_0x2fdc7c);}return _0xe8454[_0xa40b('0x25')]();};}function saveUpdates(_0x5c6798,_0x56b68e){return function(_0x2517ee){if(_0x2517ee){return _0x2517ee[_0xa40b('0x26')](_0x5c6798)[_0xa40b('0x27')](function(_0x2ff467){return _0x2ff467;});}return null;};}function removeEntity(_0x2c325a,_0x394828){return function(_0x40c62b){if(_0x40c62b){return _0x40c62b[_0xa40b('0x28')]()[_0xa40b('0x27')](function(){var _0x4b76f9=_0x40c62b['get']({'plain':!![]});var _0x5b6cee=_0xa40b('0x29');return db[_0xa40b('0x2a')][_0xa40b('0x28')]({'where':{'type':_0x5b6cee,'resourceId':_0x4b76f9['id']}})['then'](function(){return _0x40c62b;});})[_0xa40b('0x27')](function(){_0x2c325a[_0xa40b('0x1d')](0xcc)[_0xa40b('0x1e')]();});}};}function handleEntityNotFound(_0x268772,_0x3f8795){return function(_0x3dca3d){if(!_0x3dca3d){_0x268772[_0xa40b('0x2b')](0x194);}return _0x3dca3d;};}function handleError(_0xdd2b65,_0x5a27f9){_0x5a27f9=_0x5a27f9||0x1f4;return function(_0x304a1f){logger[_0xa40b('0x2c')](_0x304a1f[_0xa40b('0x2d')]);if(_0x304a1f[_0xa40b('0x2e')]){delete _0x304a1f[_0xa40b('0x2e')];}_0xdd2b65[_0xa40b('0x1d')](_0x5a27f9)[_0xa40b('0x2f')](_0x304a1f);};}exports[_0xa40b('0x30')]=function(_0x2b9665,_0x55ab04){var _0x4895ef={},_0x388a54={},_0x4cf20f={'count':0x0,'rows':[]};var _0x50bfc6=_[_0xa40b('0x31')](db['WhatsappQueue'][_0xa40b('0x32')],function(_0x2f7d96){return{'name':_0x2f7d96[_0xa40b('0x33')],'type':_0x2f7d96[_0xa40b('0x34')][_0xa40b('0x35')]};});_0x388a54[_0xa40b('0x36')]=_[_0xa40b('0x31')](_0x50bfc6,_0xa40b('0x2e'));_0x388a54[_0xa40b('0x37')]=_[_0xa40b('0x38')](_0x2b9665[_0xa40b('0x37')]);_0x388a54[_0xa40b('0x39')]=_[_0xa40b('0x3a')](_0x388a54[_0xa40b('0x36')],_0x388a54[_0xa40b('0x37')]);_0x4895ef[_0xa40b('0x3b')]=_[_0xa40b('0x3a')](_0x388a54[_0xa40b('0x36')],qs['fields'](_0x2b9665[_0xa40b('0x37')][_0xa40b('0x3c')]));_0x4895ef[_0xa40b('0x3b')]=_0x4895ef[_0xa40b('0x3b')][_0xa40b('0x3d')]?_0x4895ef['attributes']:_0x388a54['model'];if(!_0x2b9665['query'][_0xa40b('0x3e')](_0xa40b('0x3f'))){_0x4895ef['limit']=qs[_0xa40b('0x21')](_0x2b9665[_0xa40b('0x37')][_0xa40b('0x21')]);_0x4895ef[_0xa40b('0x40')]=qs['offset'](_0x2b9665['query'][_0xa40b('0x40')]);}_0x4895ef[_0xa40b('0x41')]=qs[_0xa40b('0x42')](_0x2b9665[_0xa40b('0x37')][_0xa40b('0x42')]);_0x4895ef[_0xa40b('0x43')]=qs['filters'](_[_0xa40b('0x44')](_0x2b9665[_0xa40b('0x37')],_0x388a54[_0xa40b('0x39')]),_0x50bfc6);if(_0x2b9665[_0xa40b('0x37')]['filter']){_0x4895ef['where']=_[_0xa40b('0x45')](_0x4895ef[_0xa40b('0x43')],{'$or':_[_0xa40b('0x31')](_0x50bfc6,function(_0x7a3da9){if(_0x7a3da9[_0xa40b('0x34')]!=='VIRTUAL'){var _0x283b1a={};_0x283b1a[_0x7a3da9[_0xa40b('0x2e')]]={'$like':'%'+_0x2b9665[_0xa40b('0x37')][_0xa40b('0x46')]+'%'};return _0x283b1a;}})});}_0x4895ef=_['merge']({},_0x4895ef,_0x2b9665[_0xa40b('0x47')]);var _0x47c46d={'where':_0x4895ef[_0xa40b('0x43')]};return db[_0xa40b('0x48')][_0xa40b('0x20')](_0x47c46d)['then'](function(_0x20c897){_0x4cf20f[_0xa40b('0x20')]=_0x20c897;if(_0x2b9665[_0xa40b('0x37')][_0xa40b('0x49')]){_0x4895ef[_0xa40b('0x4a')]=[{'all':!![]}];}return db[_0xa40b('0x48')][_0xa40b('0x4b')](_0x4895ef);})['then'](function(_0x538763){_0x4cf20f['rows']=_0x538763;return _0x4cf20f;})[_0xa40b('0x27')](respondWithFilteredResult(_0x55ab04,_0x4895ef))[_0xa40b('0x4c')](handleError(_0x55ab04,null));};exports[_0xa40b('0x4d')]=function(_0x5dd6b9,_0x501d4e){var _0x270460={'raw':!![],'where':{'id':_0x5dd6b9[_0xa40b('0x4e')]['id']}},_0x72157e={};_0x72157e[_0xa40b('0x36')]=_[_0xa40b('0x38')](db[_0xa40b('0x48')][_0xa40b('0x32')]);_0x72157e[_0xa40b('0x37')]=_[_0xa40b('0x38')](_0x5dd6b9[_0xa40b('0x37')]);_0x72157e[_0xa40b('0x39')]=_[_0xa40b('0x3a')](_0x72157e[_0xa40b('0x36')],_0x72157e[_0xa40b('0x37')]);_0x270460[_0xa40b('0x3b')]=_[_0xa40b('0x3a')](_0x72157e[_0xa40b('0x36')],qs[_0xa40b('0x3c')](_0x5dd6b9[_0xa40b('0x37')][_0xa40b('0x3c')]));_0x270460['attributes']=_0x270460[_0xa40b('0x3b')][_0xa40b('0x3d')]?_0x270460[_0xa40b('0x3b')]:_0x72157e['model'];if(_0x5dd6b9['query'][_0xa40b('0x49')]){_0x270460[_0xa40b('0x4a')]=[{'all':!![]}];}_0x270460=_[_0xa40b('0x45')]({},_0x270460,_0x5dd6b9['options']);return db[_0xa40b('0x48')]['find'](_0x270460)['then'](handleEntityNotFound(_0x501d4e,null))[_0xa40b('0x27')](respondWithResult(_0x501d4e,null))[_0xa40b('0x4c')](handleError(_0x501d4e,null));};exports[_0xa40b('0x4f')]=function(_0x216c7c,_0x1e7381){return db[_0xa40b('0x48')]['create'](_0x216c7c[_0xa40b('0x50')],{})[_0xa40b('0x27')](function(_0x2f07cc){var _0x55937e=_0x216c7c[_0xa40b('0x51')][_0xa40b('0x52')]({'plain':!![]});if(!_0x55937e)throw new Error(_0xa40b('0x53'));if(_0x55937e['role']===_0xa40b('0x51')){var _0x101eb1=_0x2f07cc['get']({'plain':!![]});var _0x53221e=_0xa40b('0x29');return db[_0xa40b('0x54')][_0xa40b('0x55')]({'where':{'name':_0x53221e,'userProfileId':_0x55937e[_0xa40b('0x56')]},'raw':!![]})[_0xa40b('0x27')](function(_0x2648b5){if(_0x2648b5&&_0x2648b5['autoAssociation']===0x0){return db[_0xa40b('0x2a')][_0xa40b('0x4f')]({'name':_0x101eb1['name'],'resourceId':_0x101eb1['id'],'type':_0x2648b5[_0xa40b('0x2e')],'sectionId':_0x2648b5['id']},{})[_0xa40b('0x27')](function(){return _0x2f07cc;});}else{return _0x2f07cc;}})[_0xa40b('0x4c')](function(_0x97ce9b){logger[_0xa40b('0x2c')](_0xa40b('0x57'),_0x97ce9b);throw _0x97ce9b;});}return _0x2f07cc;})[_0xa40b('0x27')](respondWithResult(_0x1e7381,0xc9))['catch'](handleError(_0x1e7381,null));};exports['update']=function(_0x1e12be,_0x440d3d){if(_0x1e12be[_0xa40b('0x50')]['id']){delete _0x1e12be[_0xa40b('0x50')]['id'];}return db[_0xa40b('0x48')][_0xa40b('0x55')]({'where':{'id':_0x1e12be[_0xa40b('0x4e')]['id']}})[_0xa40b('0x27')](handleEntityNotFound(_0x440d3d,null))[_0xa40b('0x27')](saveUpdates(_0x1e12be[_0xa40b('0x50')],null))['then'](respondWithResult(_0x440d3d,null))['catch'](handleError(_0x440d3d,null));};exports[_0xa40b('0x28')]=function(_0x46bc8b,_0x490db5){return db[_0xa40b('0x48')][_0xa40b('0x55')]({'where':{'id':_0x46bc8b['params']['id']}})[_0xa40b('0x27')](handleEntityNotFound(_0x490db5,null))[_0xa40b('0x27')](removeEntity(_0x490db5,null))[_0xa40b('0x4c')](handleError(_0x490db5,null));};exports['describe']=function(_0x9fa18e,_0x4ade49){return db[_0xa40b('0x48')][_0xa40b('0x58')]()['then'](respondWithResult(_0x4ade49,null))['catch'](handleError(_0x4ade49,null));};exports[_0xa40b('0x59')]=function(_0x2c85e9,_0x48ebe4,_0x35c6f6){var _0x4c6fc9={'raw':!![],'where':{}},_0x468c9d={},_0x3b9174;return db[_0xa40b('0x48')][_0xa40b('0x5a')]({'where':{'id':_0x2c85e9[_0xa40b('0x4e')]['id']}})[_0xa40b('0x27')](handleEntityNotFound(_0x48ebe4,null))['then'](function(_0x2d8237){if(_0x2d8237){_0x3b9174=_0x2d8237['get']({'plain':!![]});_0x468c9d['model']=_['keys'](db[_0xa40b('0x5b')]['rawAttributes']);_0x468c9d['query']=_[_0xa40b('0x38')](_0x2c85e9[_0xa40b('0x37')]);_0x468c9d[_0xa40b('0x39')]=_[_0xa40b('0x3a')](_0x468c9d['model'],_0x468c9d[_0xa40b('0x37')]);_0x4c6fc9[_0xa40b('0x3b')]=_[_0xa40b('0x3a')](_0x468c9d[_0xa40b('0x36')],qs[_0xa40b('0x3c')](_0x2c85e9[_0xa40b('0x37')][_0xa40b('0x3c')]));_0x4c6fc9['attributes']=_0x4c6fc9[_0xa40b('0x3b')][_0xa40b('0x3d')]?_0x4c6fc9[_0xa40b('0x3b')]:_0x468c9d[_0xa40b('0x36')];if(!_0x2c85e9[_0xa40b('0x37')]['hasOwnProperty'](_0xa40b('0x3f'))){_0x4c6fc9[_0xa40b('0x21')]=qs[_0xa40b('0x21')](_0x2c85e9['query']['limit']);_0x4c6fc9[_0xa40b('0x40')]=qs[_0xa40b('0x40')](_0x2c85e9[_0xa40b('0x37')]['offset']);}_0x4c6fc9[_0xa40b('0x41')]=qs['sort'](_0x2c85e9[_0xa40b('0x37')][_0xa40b('0x42')]);_0x4c6fc9['where']=qs[_0xa40b('0x39')](_['pick'](_0x2c85e9['query'],_0x468c9d[_0xa40b('0x39')]));_0x4c6fc9[_0xa40b('0x43')][_0xa40b('0x5c')]=_0x2d8237['id'];if(_0x2c85e9['query'][_0xa40b('0x46')]){_0x4c6fc9['where']=_[_0xa40b('0x45')](_0x4c6fc9[_0xa40b('0x43')],{'$or':_[_0xa40b('0x31')](_0x4c6fc9[_0xa40b('0x3b')],function(_0x50a846){var _0x4da7f1={};_0x4da7f1[_0x50a846]={'$like':'%'+_0x2c85e9[_0xa40b('0x37')]['filter']+'%'};return _0x4da7f1;})});}_0x4c6fc9=_[_0xa40b('0x45')]({},_0x4c6fc9,_0x2c85e9[_0xa40b('0x47')]);return db[_0xa40b('0x5b')][_0xa40b('0x4b')](_0x4c6fc9);}})[_0xa40b('0x27')](function(_0x4bde22){if(_0x4bde22){return db[_0xa40b('0x5d')][_0xa40b('0x5e')]({'where':{'id':_[_0xa40b('0x31')](_0x4bde22,'UserId'),'role':'agent'},'attributes':['id',_0xa40b('0x2e'),_0xa40b('0x5f'),_0xa40b('0x60'),_0xa40b('0x61')]});}})['then'](function(_0x3f96c3){if(_0x3f96c3){return{'count':_0x3f96c3[_0xa40b('0x20')],'rows':_[_0xa40b('0x31')](_0x3f96c3[_0xa40b('0x62')],function(_0x5d3a04){return{'membername':_0x5d3a04['name'],'UserId':_0x5d3a04['id'],'queue_name':_0x3b9174[_0xa40b('0x2e')],'WhatsappQueueId':_0x3b9174['id'],'interface':util[_0xa40b('0x63')](_0xa40b('0x64'),_0xa40b('0x65'),_0x5d3a04[_0xa40b('0x2e')]),'penalty':0x0,'paused':_0x5d3a04[_0xa40b('0x5f')],'createdAt':_0x5d3a04[_0xa40b('0x61')],'updatedAt':_0x5d3a04[_0xa40b('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa40b('0x27')](respondWithFilteredResult(_0x48ebe4,_0x4c6fc9))[_0xa40b('0x4c')](handleError(_0x48ebe4,null));};exports[_0xa40b('0x66')]=function(_0x28f4d7,_0x595329,_0x1b61ea){var _0x2fcfce={};var _0x1ca6b5={};var _0x39b23e;var _0xef8e0c;return db[_0xa40b('0x48')][_0xa40b('0x5a')]({'where':{'id':_0x28f4d7[_0xa40b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x595329,null))[_0xa40b('0x27')](function(_0x171e3b){if(_0x171e3b){_0x39b23e=_0x171e3b;_0x1ca6b5[_0xa40b('0x36')]=_[_0xa40b('0x38')](db[_0xa40b('0x67')][_0xa40b('0x32')]);_0x1ca6b5['query']=_[_0xa40b('0x38')](_0x28f4d7[_0xa40b('0x37')]);_0x1ca6b5[_0xa40b('0x39')]=_[_0xa40b('0x3a')](_0x1ca6b5[_0xa40b('0x36')],_0x1ca6b5['query']);_0x2fcfce['attributes']=_[_0xa40b('0x3a')](_0x1ca6b5['model'],qs[_0xa40b('0x3c')](_0x28f4d7[_0xa40b('0x37')][_0xa40b('0x3c')]));_0x2fcfce['attributes']=_0x2fcfce['attributes']['length']?_0x2fcfce['attributes']:_0x1ca6b5[_0xa40b('0x36')];_0x2fcfce[_0xa40b('0x41')]=qs['sort'](_0x28f4d7['query'][_0xa40b('0x42')]);_0x2fcfce['where']=qs[_0xa40b('0x39')](_[_0xa40b('0x44')](_0x28f4d7['query'],_0x1ca6b5['filters']));if(_0x28f4d7[_0xa40b('0x37')][_0xa40b('0x46')]){_0x2fcfce[_0xa40b('0x43')]=_[_0xa40b('0x45')](_0x2fcfce[_0xa40b('0x43')],{'$or':_[_0xa40b('0x31')](_0x2fcfce[_0xa40b('0x3b')],function(_0x55a0c3){var _0x2d23b2={};_0x2d23b2[_0x55a0c3]={'$like':'%'+_0x28f4d7[_0xa40b('0x37')]['filter']+'%'};return _0x2d23b2;})});}_0x2fcfce=_[_0xa40b('0x45')]({},_0x2fcfce,_0x28f4d7[_0xa40b('0x47')]);return _0x39b23e[_0xa40b('0x66')](_0x2fcfce);}})[_0xa40b('0x27')](function(_0xf6cd2f){if(_0xf6cd2f){_0xef8e0c=_0xf6cd2f[_0xa40b('0x3d')];if(!_0x28f4d7[_0xa40b('0x37')][_0xa40b('0x3e')](_0xa40b('0x3f'))){_0x2fcfce[_0xa40b('0x21')]=qs[_0xa40b('0x21')](_0x28f4d7[_0xa40b('0x37')]['limit']);_0x2fcfce[_0xa40b('0x40')]=qs[_0xa40b('0x40')](_0x28f4d7['query'][_0xa40b('0x40')]);}return _0x39b23e['getTeams'](_0x2fcfce);}})[_0xa40b('0x27')](function(_0x4e4d53){if(_0x4e4d53){return _0x4e4d53?{'count':_0xef8e0c,'rows':_0x4e4d53}:null;}})[_0xa40b('0x27')](respondWithResult(_0x595329,null))['catch'](handleError(_0x595329,null));};exports['addTeams']=function(_0x428c09,_0x4b6e75,_0x1e6914){var _0x1d317e=_0x428c09[_0xa40b('0x50')][_0xa40b('0x68')];return db[_0xa40b('0x67')][_0xa40b('0x4b')]({'where':{'id':_0x1d317e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa40b('0x2e'),_0xa40b('0x69'),'voicePause',_0xa40b('0x6a')],'raw':!![]}]})[_0xa40b('0x27')](function(_0x2fe897){if(_0x2fe897){var _0x1a3817=_['flatMap'](_0x2fe897,function(_0x3a2bc8){var _0x1aebce=_0x3a2bc8['get']({'plain':!![]});return _0x1aebce['Agents'];});return db['WhatsappQueue']['find']({'where':{'id':_0x428c09[_0xa40b('0x4e')]['id']}})[_0xa40b('0x27')](function(_0x4f3f9e){return db[_0xa40b('0x6b')][_0xa40b('0x6c')](function(_0x3c4130){return _0x4f3f9e[_0xa40b('0x6d')](_0x1d317e,{'transaction':_0x3c4130})[_0xa40b('0x27')](function(){return BPromise[_0xa40b('0x6e')](_0x1a3817,function(_0x5f5987){return db['UserWhatsappQueue'][_0xa40b('0x6f')]({'where':{'UserId':_0x5f5987['id'],'WhatsappQueueId':_0x428c09['params']['id']},'transaction':_0x3c4130});});})[_0xa40b('0x27')](function(){_0x1a3817[_0xa40b('0x70')](function(_0x1640fe){socket[_0xa40b('0x71')](_0xa40b('0x72'),{'UserId':_0x1640fe['id'],'WhatsappQueueId':_0x4f3f9e['id']});});});});});}})[_0xa40b('0x27')](respondWithStatusCode(_0x4b6e75,null))[_0xa40b('0x4c')](handleError(_0x4b6e75,null));};exports[_0xa40b('0x73')]=function(_0x5acad9,_0x384045,_0x357ad2){return db[_0xa40b('0x67')][_0xa40b('0x4b')]({'where':{'id':_0x5acad9[_0xa40b('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa40b('0x74'),'attributes':['id'],'raw':!![]}]})[_0xa40b('0x27')](handleEntityNotFound(_0x384045,null))[_0xa40b('0x27')](function(_0xddd99a){var _0xd5be5d=_['map'](_0xddd99a,'id');var _0xf851fa=[];var _0x2418f9=[];var _0x46f2b3=squel['select']();_0x46f2b3[_0xa40b('0x75')](_0xa40b('0x76'))[_0xa40b('0x77')](_0xa40b('0x78'),'tq')['join'](_0xa40b('0x79'),'ut',_0xa40b('0x7a'))[_0xa40b('0x43')](_0xa40b('0x7b'),_0x5acad9[_0xa40b('0x4e')]['id']);for(var _0x42f477=0x0;_0x42f477<_0xddd99a[_0xa40b('0x3d')];_0x42f477+=0x1){let _0xcdaab7=_0xddd99a[_0x42f477];for(var _0x335280=0x0;_0x335280<_0xcdaab7[_0xa40b('0x74')][_0xa40b('0x3d')];_0x335280+=0x1){let _0x4f5f6e=_0xcdaab7['Agents'][_0x335280];var _0x12cec3=_0x46f2b3[_0xa40b('0x7c')]();_0x12cec3[_0xa40b('0x43')]('ut.UserId\x20=\x20?',_0x4f5f6e['id']);_0x2418f9['push'](db[_0xa40b('0x6b')][_0xa40b('0x37')](_0x12cec3['toString'](),{'type':db[_0xa40b('0x6b')][_0xa40b('0x7d')][_0xa40b('0x7e')]})[_0xa40b('0x27')](function(_0x2c7b4b){if(_0x2c7b4b[_0xa40b('0x3d')]===0x1){return _0x4f5f6e['id'];}else{var _0x1075a3=_[_0xa40b('0x7f')](_[_0xa40b('0x31')](_0x2c7b4b,'TeamId'),function(_0x4f2520){return _[_0xa40b('0x80')](_0xd5be5d,_0x4f2520);});if(_0x1075a3){return _0x4f5f6e['id'];}}}));}}return BPromise[_0xa40b('0x81')](_0x2418f9)[_0xa40b('0x27')](function(_0x1d68f0){_0xf851fa=_(_0xf851fa)[_0xa40b('0x82')](_0x1d68f0)[_0xa40b('0x83')]()[_0xa40b('0x84')]();return db[_0xa40b('0x48')][_0xa40b('0x55')]({'where':{'id':_0x5acad9['params']['id']}})[_0xa40b('0x27')](function(_0xd8879){return db[_0xa40b('0x6b')][_0xa40b('0x6c')](function(_0xca64b6){return _0xd8879[_0xa40b('0x73')](_0x5acad9[_0xa40b('0x37')][_0xa40b('0x68')],{'transaction':_0xca64b6})['then'](function(){if(!_[_0xa40b('0x85')](_0xf851fa)){return _0xd8879[_0xa40b('0x86')](_0xf851fa,{'transaction':_0xca64b6});}})['then'](function(){_0xf851fa[_0xa40b('0x70')](function(_0x1c30af){socket[_0xa40b('0x71')](_0xa40b('0x87'),{'UserId':_0x1c30af,'WhatsappQueueId':_0xd8879['id']});});});});});});})['then'](respondWithStatusCode(_0x384045,null))[_0xa40b('0x4c')](handleError(_0x384045,null));};exports[_0xa40b('0x88')]=function(_0x28ad4a,_0x259da7,_0x267e02){return db[_0xa40b('0x48')]['find']({'where':{'id':_0x28ad4a[_0xa40b('0x4e')]['id']}})[_0xa40b('0x27')](handleEntityNotFound(_0x259da7,null))[_0xa40b('0x27')](function(_0x545172){if(_0x545172){return _0x545172[_0xa40b('0x88')](_0x28ad4a[_0xa40b('0x50')]['ids'],_[_0xa40b('0x89')](_0x28ad4a[_0xa40b('0x50')],['ids','id'])||{})['spread'](function(_0x510842){for(var _0x212a4d=0x0;_0x212a4d<_0x28ad4a[_0xa40b('0x50')][_0xa40b('0x68')][_0xa40b('0x3d')];_0x212a4d+=0x1){socket[_0xa40b('0x71')](_0xa40b('0x72'),{'UserId':_0x28ad4a[_0xa40b('0x50')][_0xa40b('0x68')][_0x212a4d],'WhatsappQueueId':_0x28ad4a['params']['id']});}return _0x510842;});}})[_0xa40b('0x27')](respondWithResult(_0x259da7,null))['catch'](handleError(_0x259da7,null));};exports[_0xa40b('0x86')]=function(_0x6120e0,_0x3cc24b,_0x3d8ea2){return db['WhatsappQueue'][_0xa40b('0x55')]({'where':{'id':_0x6120e0['params']['id']}})['then'](handleEntityNotFound(_0x3cc24b,null))[_0xa40b('0x27')](function(_0x431fe1){if(_0x431fe1){return _0x431fe1[_0xa40b('0x86')](_0x6120e0['query'][_0xa40b('0x68')])[_0xa40b('0x27')](function(){if(_[_0xa40b('0x8a')](_0x6120e0[_0xa40b('0x37')][_0xa40b('0x68')])){for(var _0x497d69=0x0;_0x497d69<_0x6120e0['query']['ids'][_0xa40b('0x3d')];_0x497d69+=0x1){socket[_0xa40b('0x71')](_0xa40b('0x87'),{'UserId':Number(_0x6120e0['query']['ids'][_0x497d69]),'WhatsappQueueId':Number(_0x6120e0[_0xa40b('0x4e')]['id'])});}}else{socket[_0xa40b('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x6120e0[_0xa40b('0x37')][_0xa40b('0x68')]),'WhatsappQueueId':Number(_0x6120e0['params']['id'])});}});}})[_0xa40b('0x27')](respondWithStatusCode(_0x3cc24b,null))['catch'](handleError(_0x3cc24b,null));};exports[_0xa40b('0x8b')]=function(_0x1921f7,_0x1de9a0,_0xf972bf){var _0x27a067={};var _0x5c0a1d={};var _0x2f4fcd;var _0x1845b4;return db['WhatsappQueue'][_0xa40b('0x5a')]({'where':{'id':_0x1921f7[_0xa40b('0x4e')]['id']}})[_0xa40b('0x27')](handleEntityNotFound(_0x1de9a0,null))[_0xa40b('0x27')](function(_0x447a3a){if(_0x447a3a){_0x2f4fcd=_0x447a3a;_0x5c0a1d[_0xa40b('0x36')]=_[_0xa40b('0x38')](db[_0xa40b('0x5d')][_0xa40b('0x32')]);_0x5c0a1d[_0xa40b('0x37')]=_['keys'](_0x1921f7[_0xa40b('0x37')]);_0x5c0a1d[_0xa40b('0x39')]=_[_0xa40b('0x3a')](_0x5c0a1d['model'],_0x5c0a1d['query']);_0x27a067[_0xa40b('0x3b')]=_[_0xa40b('0x3a')](_0x5c0a1d['model'],qs[_0xa40b('0x3c')](_0x1921f7['query']['fields']));_0x27a067['attributes']=_0x27a067[_0xa40b('0x3b')][_0xa40b('0x3d')]?_0x27a067[_0xa40b('0x3b')]:_0x5c0a1d[_0xa40b('0x36')];_0x27a067[_0xa40b('0x41')]=qs['sort'](_0x1921f7['query'][_0xa40b('0x42')]);_0x27a067['where']=qs[_0xa40b('0x39')](_[_0xa40b('0x44')](_0x1921f7[_0xa40b('0x37')],_0x5c0a1d[_0xa40b('0x39')]));if(_0x1921f7[_0xa40b('0x37')][_0xa40b('0x46')]){_0x27a067[_0xa40b('0x43')]=_['merge'](_0x27a067[_0xa40b('0x43')],{'$or':_[_0xa40b('0x31')](_0x27a067[_0xa40b('0x3b')],function(_0x1ac392){var _0x560267={};_0x560267[_0x1ac392]={'$like':'%'+_0x1921f7[_0xa40b('0x37')][_0xa40b('0x46')]+'%'};return _0x560267;})});}_0x27a067=_['merge']({},_0x27a067,_0x1921f7['options']);return _0x2f4fcd[_0xa40b('0x8b')](_0x27a067);}})[_0xa40b('0x27')](function(_0x4619bf){if(_0x4619bf){_0x1845b4=_0x4619bf[_0xa40b('0x3d')];if(!_0x1921f7['query'][_0xa40b('0x3e')](_0xa40b('0x3f'))){_0x27a067[_0xa40b('0x21')]=qs[_0xa40b('0x21')](_0x1921f7[_0xa40b('0x37')][_0xa40b('0x21')]);_0x27a067['offset']=qs[_0xa40b('0x40')](_0x1921f7[_0xa40b('0x37')][_0xa40b('0x40')]);}return _0x2f4fcd['getAgents'](_0x27a067);}})[_0xa40b('0x27')](function(_0x2b42ff){if(_0x2b42ff){return _0x2b42ff?{'count':_0x1845b4,'rows':_0x2b42ff}:null;}})['then'](respondWithResult(_0x1de9a0,null))[_0xa40b('0x4c')](handleError(_0x1de9a0,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 9a8ade4..96b4d42 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 _0xee05=['events','../../mysqldb','WhatsappQueue','setMaxListeners','remove','emit','hook','exports'];(function(_0x4787f3,_0x35ba4f){var _0x462dbc=function(_0x32ef9b){while(--_0x32ef9b){_0x4787f3['push'](_0x4787f3['shift']());}};_0x462dbc(++_0x35ba4f);}(_0xee05,0x130));var _0x5ee0=function(_0x208e70,_0xaa76d2){_0x208e70=_0x208e70-0x0;var _0x32c05b=_0xee05[_0x208e70];return _0x32c05b;};'use strict';var EventEmitter=require(_0x5ee0('0x0'));var WhatsappQueue=require(_0x5ee0('0x1'))['db'][_0x5ee0('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5ee0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5ee0('0x4')};function emitEvent(_0x26494e){return function(_0x2d139f,_0x2acb16,_0x2aed75){WhatsappQueueEvents[_0x5ee0('0x5')](_0x26494e+':'+_0x2d139f['id'],_0x2d139f);WhatsappQueueEvents[_0x5ee0('0x5')](_0x26494e,_0x2d139f);_0x2aed75(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x5ee0('0x6')](e,emitEvent(event));}}module[_0x5ee0('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x5633=['../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x198700,_0x8119c7){var _0x1c5267=function(_0x212b8c){while(--_0x212b8c){_0x198700['push'](_0x198700['shift']());}};_0x1c5267(++_0x8119c7);}(_0x5633,0x18b));var _0x3563=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x5633[_0x174ef5];return _0x1cc379;};'use strict';var EventEmitter=require(_0x3563('0x0'));var WhatsappQueue=require(_0x3563('0x1'))['db'][_0x3563('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x3563('0x3')](0x0);var events={'afterCreate':_0x3563('0x4'),'afterUpdate':_0x3563('0x5'),'afterDestroy':_0x3563('0x6')};function emitEvent(_0x32bf79){return function(_0x2c8086,_0x46b88b,_0x1bb734){WhatsappQueueEvents[_0x3563('0x7')](_0x32bf79+':'+_0x2c8086['id'],_0x2c8086);WhatsappQueueEvents[_0x3563('0x7')](_0x32bf79,_0x2c8086);_0x1bb734(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x3563('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 17bb15c..76b826d 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 _0x26d8=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','lodash'];(function(_0x1f70df,_0x12d171){var _0x3a3081=function(_0x224258){while(--_0x224258){_0x1f70df['push'](_0x1f70df['shift']());}};_0x3a3081(++_0x12d171);}(_0x26d8,0x83));var _0x826d=function(_0x4f4a0d,_0x5c1a72){_0x4f4a0d=_0x4f4a0d-0x0;var _0x2c5115=_0x26d8[_0x4f4a0d];return _0x2c5115;};'use strict';var _=require(_0x826d('0x0'));var util=require(_0x826d('0x1'));var logger=require(_0x826d('0x2'))(_0x826d('0x3'));var moment=require('moment');var BPromise=require(_0x826d('0x4'));var rp=require(_0x826d('0x5'));var fs=require('fs');var path=require(_0x826d('0x6'));var rimraf=require(_0x826d('0x7'));var config=require(_0x826d('0x8'));var attributes=require(_0x826d('0x9'));module['exports']=function(_0x1a3240,_0x35b93f){return _0x1a3240[_0x826d('0xa')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21a5=['exports','define','WhatsappQueue','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x21a5,0x1dc));var _0x521a=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x21a5[_0x1d1d09];return _0x8827e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x521a('0x0'))(_0x521a('0x1'));var moment=require(_0x521a('0x2'));var BPromise=require(_0x521a('0x3'));var rp=require(_0x521a('0x4'));var fs=require('fs');var path=require(_0x521a('0x5'));var rimraf=require(_0x521a('0x6'));var config=require(_0x521a('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x521a('0x8')]=function(_0x1a3029,_0x2246cb){return _0x1a3029[_0x521a('0x9')](_0x521a('0xa'),attributes,{'tableName':'whatsapp_queues','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 d85fce0..183d690 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 _0xc2f9=['../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','include','model','map','then','ShowWhatsappQueue','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0xc2f9,0xfd));var _0x9c2f=function(_0x404da9,_0x5ee68b){_0x404da9=_0x404da9-0x0;var _0x15f216=_0xc2f9[_0x404da9];return _0x15f216;};'use strict';var _=require(_0x9c2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9c2f('0x1'));var rs=require(_0x9c2f('0x2'));var fs=require('fs');var Redis=require(_0x9c2f('0x3'));var db=require(_0x9c2f('0x4'))['db'];var utils=require(_0x9c2f('0x5'));var logger=require(_0x9c2f('0x6'))('rpc');var config=require(_0x9c2f('0x7'));var jayson=require(_0x9c2f('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x9c2f('0x9')]=_['defaults'](config['redis'],{'host':_0x9c2f('0xa'),'port':0x18eb});var socket=require(_0x9c2f('0xb'))(new Redis(config[_0x9c2f('0x9')]));require('./whatsappQueue.socket')[_0x9c2f('0xc')](socket);function respondWithRpcPromise(_0x290008,_0x139cde,_0x34c9c7){return new BPromise(function(_0x2bbe98,_0x188144){return client[_0x9c2f('0xd')](_0x290008,_0x34c9c7)['then'](function(_0x19ef54){logger[_0x9c2f('0xe')](_0x9c2f('0xf'),_0x139cde,_0x9c2f('0x10'));logger[_0x9c2f('0x11')](_0x9c2f('0x12'),_0x139cde,'request\x20sent',JSON['stringify'](_0x19ef54));if(_0x19ef54['error']){if(_0x19ef54['error'][_0x9c2f('0x13')]===0x1f4){logger[_0x9c2f('0x14')](_0x9c2f('0xf'),_0x139cde,_0x19ef54[_0x9c2f('0x14')]['message']);return _0x188144(_0x19ef54[_0x9c2f('0x14')][_0x9c2f('0x15')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x139cde,_0x19ef54[_0x9c2f('0x14')][_0x9c2f('0x15')]);return _0x2bbe98(_0x19ef54['error'][_0x9c2f('0x15')]);}else{logger[_0x9c2f('0xe')]('WhatsappQueue,\x20%s,\x20%s',_0x139cde,_0x9c2f('0x10'));_0x2bbe98(_0x19ef54[_0x9c2f('0x16')][_0x9c2f('0x15')]);}})[_0x9c2f('0x17')](function(_0x1787f9){logger[_0x9c2f('0x14')](_0x9c2f('0xf'),_0x139cde,_0x1787f9);_0x188144(_0x1787f9);});});}exports[_0x9c2f('0x18')]=function(_0x396ba3){var _0x43d517=this;return new Promise(function(_0x277f46,_0x210f47){return db[_0x9c2f('0x19')][_0x9c2f('0x1a')]({'raw':_0x396ba3[_0x9c2f('0x1b')]?_0x396ba3[_0x9c2f('0x1b')][_0x9c2f('0x1c')]===undefined?!![]:![]:!![],'where':_0x396ba3['options']?_0x396ba3[_0x9c2f('0x1b')][_0x9c2f('0x1d')]||null:null,'attributes':_0x396ba3[_0x9c2f('0x1b')]?_0x396ba3[_0x9c2f('0x1b')][_0x9c2f('0x1e')]||null:null,'limit':_0x396ba3[_0x9c2f('0x1b')]?_0x396ba3[_0x9c2f('0x1b')]['limit']||null:null,'include':_0x396ba3['options']?_0x396ba3[_0x9c2f('0x1b')][_0x9c2f('0x1f')]?_['map'](_0x396ba3['options']['include'],function(_0x343b50){return{'model':db[_0x343b50[_0x9c2f('0x20')]],'as':_0x343b50['as'],'attributes':_0x343b50[_0x9c2f('0x1e')],'include':_0x343b50[_0x9c2f('0x1f')]?_[_0x9c2f('0x21')](_0x343b50['include'],function(_0x2fb574){return{'model':db[_0x2fb574['model']],'as':_0x2fb574['as'],'attributes':_0x2fb574[_0x9c2f('0x1e')],'include':_0x2fb574[_0x9c2f('0x1f')]?_[_0x9c2f('0x21')](_0x2fb574[_0x9c2f('0x1f')],function(_0x5e5a8d){return{'model':db[_0x5e5a8d['model']],'as':_0x5e5a8d['as'],'attributes':_0x5e5a8d[_0x9c2f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9c2f('0x22')](function(_0x5099c6){logger['info']('GetWhatsappQueue',_0x396ba3);logger[_0x9c2f('0x11')](_0x9c2f('0x18'),_0x396ba3,JSON['stringify'](_0x5099c6));_0x277f46(_0x5099c6);})[_0x9c2f('0x17')](function(_0x3b8e60){logger[_0x9c2f('0x14')](_0x9c2f('0x18'),_0x3b8e60[_0x9c2f('0x15')],_0x396ba3);_0x210f47(_0x43d517['error'](0x1f4,_0x3b8e60['message']));});});};exports[_0x9c2f('0x23')]=function(_0x1b1b86){var _0xd5f9b5=this;return new Promise(function(_0x3b73c2,_0x3d18a6){return db[_0x9c2f('0x19')]['find']({'raw':_0x1b1b86[_0x9c2f('0x1b')]?_0x1b1b86[_0x9c2f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1b1b86['options']?_0x1b1b86[_0x9c2f('0x1b')][_0x9c2f('0x1d')]||null:null,'attributes':_0x1b1b86[_0x9c2f('0x1b')]?_0x1b1b86['options'][_0x9c2f('0x1e')]||null:null,'include':_0x1b1b86['options']?_0x1b1b86[_0x9c2f('0x1b')]['include']?_[_0x9c2f('0x21')](_0x1b1b86[_0x9c2f('0x1b')][_0x9c2f('0x1f')],function(_0x3376f6){return{'model':db[_0x3376f6[_0x9c2f('0x20')]],'as':_0x3376f6['as'],'attributes':_0x3376f6[_0x9c2f('0x1e')],'include':_0x3376f6[_0x9c2f('0x1f')]?_[_0x9c2f('0x21')](_0x3376f6[_0x9c2f('0x1f')],function(_0x1e3a78){return{'model':db[_0x1e3a78[_0x9c2f('0x20')]],'as':_0x1e3a78['as'],'attributes':_0x1e3a78['attributes'],'include':_0x1e3a78[_0x9c2f('0x1f')]?_[_0x9c2f('0x21')](_0x1e3a78[_0x9c2f('0x1f')],function(_0x523244){return{'model':db[_0x523244[_0x9c2f('0x20')]],'as':_0x523244['as'],'attributes':_0x523244[_0x9c2f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bf0f4){logger[_0x9c2f('0xe')](_0x9c2f('0x23'),_0x1b1b86);logger[_0x9c2f('0x11')](_0x9c2f('0x23'),_0x1b1b86,JSON[_0x9c2f('0x24')](_0x5bf0f4));_0x3b73c2(_0x5bf0f4);})[_0x9c2f('0x17')](function(_0x3947a4){logger[_0x9c2f('0x14')](_0x9c2f('0x23'),_0x3947a4[_0x9c2f('0x15')],_0x1b1b86);_0x3d18a6(_0xd5f9b5[_0x9c2f('0x14')](0x1f4,_0x3947a4['message']));});});}; \ No newline at end of file +var _0xa660=['model','include','debug','ShowWhatsappQueue','WhatsappQueue','lodash','util','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','map'];(function(_0x134448,_0x591d7b){var _0x2d52a1=function(_0x56b840){while(--_0x56b840){_0x134448['push'](_0x134448['shift']());}};_0x2d52a1(++_0x591d7b);}(_0xa660,0xb4));var _0x0a66=function(_0x4207ab,_0x47b21a){_0x4207ab=_0x4207ab-0x0;var _0x127f6f=_0xa660[_0x4207ab];return _0x127f6f;};'use strict';var _=require(_0x0a66('0x0'));var util=require(_0x0a66('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a66('0x2'))['db'];var utils=require(_0x0a66('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a66('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x0a66('0x5')][_0x0a66('0x6')]({'port':0x232a});config[_0x0a66('0x7')]=_[_0x0a66('0x8')](config[_0x0a66('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a66('0x7')]));require(_0x0a66('0x9'))[_0x0a66('0xa')](socket);function respondWithRpcPromise(_0x28ab35,_0x49f49f,_0x436c89){return new BPromise(function(_0x544acb,_0x3ff3e9){return client[_0x0a66('0xb')](_0x28ab35,_0x436c89)[_0x0a66('0xc')](function(_0x5af1d7){logger[_0x0a66('0xd')](_0x0a66('0xe'),_0x49f49f,_0x0a66('0xf'));logger['debug'](_0x0a66('0x10'),_0x49f49f,_0x0a66('0xf'),JSON[_0x0a66('0x11')](_0x5af1d7));if(_0x5af1d7[_0x0a66('0x12')]){if(_0x5af1d7[_0x0a66('0x12')][_0x0a66('0x13')]===0x1f4){logger[_0x0a66('0x12')](_0x0a66('0xe'),_0x49f49f,_0x5af1d7['error'][_0x0a66('0x14')]);return _0x3ff3e9(_0x5af1d7[_0x0a66('0x12')][_0x0a66('0x14')]);}logger[_0x0a66('0x12')](_0x0a66('0xe'),_0x49f49f,_0x5af1d7[_0x0a66('0x12')][_0x0a66('0x14')]);return _0x544acb(_0x5af1d7[_0x0a66('0x12')]['message']);}else{logger['info'](_0x0a66('0xe'),_0x49f49f,_0x0a66('0xf'));_0x544acb(_0x5af1d7['result'][_0x0a66('0x14')]);}})[_0x0a66('0x15')](function(_0x4be55b){logger[_0x0a66('0x12')](_0x0a66('0xe'),_0x49f49f,_0x4be55b);_0x3ff3e9(_0x4be55b);});});}exports[_0x0a66('0x16')]=function(_0x511dc2){var _0xba9d89=this;return new Promise(function(_0x3dc7c7,_0x4b8099){return db['WhatsappQueue'][_0x0a66('0x17')]({'raw':_0x511dc2['options']?_0x511dc2[_0x0a66('0x18')][_0x0a66('0x19')]===undefined?!![]:![]:!![],'where':_0x511dc2[_0x0a66('0x18')]?_0x511dc2[_0x0a66('0x18')][_0x0a66('0x1a')]||null:null,'attributes':_0x511dc2[_0x0a66('0x18')]?_0x511dc2['options'][_0x0a66('0x1b')]||null:null,'limit':_0x511dc2[_0x0a66('0x18')]?_0x511dc2[_0x0a66('0x18')][_0x0a66('0x1c')]||null:null,'include':_0x511dc2[_0x0a66('0x18')]?_0x511dc2[_0x0a66('0x18')]['include']?_[_0x0a66('0x1d')](_0x511dc2[_0x0a66('0x18')]['include'],function(_0x1c6512){return{'model':db[_0x1c6512[_0x0a66('0x1e')]],'as':_0x1c6512['as'],'attributes':_0x1c6512[_0x0a66('0x1b')],'include':_0x1c6512[_0x0a66('0x1f')]?_[_0x0a66('0x1d')](_0x1c6512['include'],function(_0x5d1af6){return{'model':db[_0x5d1af6[_0x0a66('0x1e')]],'as':_0x5d1af6['as'],'attributes':_0x5d1af6[_0x0a66('0x1b')],'include':_0x5d1af6['include']?_[_0x0a66('0x1d')](_0x5d1af6['include'],function(_0x34124b){return{'model':db[_0x34124b[_0x0a66('0x1e')]],'as':_0x34124b['as'],'attributes':_0x34124b[_0x0a66('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0a66('0xc')](function(_0x2f3c0b){logger[_0x0a66('0xd')](_0x0a66('0x16'),_0x511dc2);logger[_0x0a66('0x20')](_0x0a66('0x16'),_0x511dc2,JSON[_0x0a66('0x11')](_0x2f3c0b));_0x3dc7c7(_0x2f3c0b);})[_0x0a66('0x15')](function(_0x1ae6d6){logger['error']('GetWhatsappQueue',_0x1ae6d6[_0x0a66('0x14')],_0x511dc2);_0x4b8099(_0xba9d89['error'](0x1f4,_0x1ae6d6[_0x0a66('0x14')]));});});};exports[_0x0a66('0x21')]=function(_0xa13a19){var _0x424462=this;return new Promise(function(_0x47827b,_0x5c7811){return db[_0x0a66('0x22')]['find']({'raw':_0xa13a19[_0x0a66('0x18')]?_0xa13a19[_0x0a66('0x18')][_0x0a66('0x19')]===undefined?!![]:![]:!![],'where':_0xa13a19[_0x0a66('0x18')]?_0xa13a19[_0x0a66('0x18')]['where']||null:null,'attributes':_0xa13a19[_0x0a66('0x18')]?_0xa13a19[_0x0a66('0x18')]['attributes']||null:null,'include':_0xa13a19['options']?_0xa13a19['options']['include']?_['map'](_0xa13a19['options'][_0x0a66('0x1f')],function(_0x41652b){return{'model':db[_0x41652b[_0x0a66('0x1e')]],'as':_0x41652b['as'],'attributes':_0x41652b[_0x0a66('0x1b')],'include':_0x41652b[_0x0a66('0x1f')]?_[_0x0a66('0x1d')](_0x41652b[_0x0a66('0x1f')],function(_0x10da55){return{'model':db[_0x10da55[_0x0a66('0x1e')]],'as':_0x10da55['as'],'attributes':_0x10da55[_0x0a66('0x1b')],'include':_0x10da55[_0x0a66('0x1f')]?_[_0x0a66('0x1d')](_0x10da55[_0x0a66('0x1f')],function(_0x1db60c){return{'model':db[_0x1db60c['model']],'as':_0x1db60c['as'],'attributes':_0x1db60c[_0x0a66('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x358d77){logger[_0x0a66('0xd')](_0x0a66('0x21'),_0xa13a19);logger[_0x0a66('0x20')](_0x0a66('0x21'),_0xa13a19,JSON[_0x0a66('0x11')](_0x358d77));_0x47827b(_0x358d77);})['catch'](function(_0x24d355){logger[_0x0a66('0x12')](_0x0a66('0x21'),_0x24d355[_0x0a66('0x14')],_0xa13a19);_0x5c7811(_0x424462[_0x0a66('0x12')](0x1f4,_0x24d355[_0x0a66('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index dd09b85..e1cf76d 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 _0x8162=['./whatsappQueue.events','save','remove','update','emit','removeListener','register','length','whatsappQueue:'];(function(_0x5f30a2,_0x1b51db){var _0x367e48=function(_0x3008d4){while(--_0x3008d4){_0x5f30a2['push'](_0x5f30a2['shift']());}};_0x367e48(++_0x1b51db);}(_0x8162,0x117));var _0x2816=function(_0x1e6537,_0x2c51b8){_0x1e6537=_0x1e6537-0x0;var _0x2835cf=_0x8162[_0x1e6537];return _0x2835cf;};'use strict';var WhatsappQueueEvents=require(_0x2816('0x0'));var events=[_0x2816('0x1'),_0x2816('0x2'),_0x2816('0x3')];function createListener(_0x1944c4,_0x581c95){return function(_0x1ac14b){_0x581c95[_0x2816('0x4')](_0x1944c4,_0x1ac14b);};}function removeListener(_0x372391,_0x5694d5){return function(){WhatsappQueueEvents[_0x2816('0x5')](_0x372391,_0x5694d5);};}exports[_0x2816('0x6')]=function(_0x567c6a){for(var _0x33026f=0x0,_0x17773c=events[_0x2816('0x7')];_0x33026f<_0x17773c;_0x33026f++){var _0x1205f4=events[_0x33026f];var _0x407089=createListener(_0x2816('0x8')+_0x1205f4,_0x567c6a);WhatsappQueueEvents['on'](_0x1205f4,_0x407089);}}; \ No newline at end of file +var _0x599f=['update','emit','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x7c68b6,_0x445ecc){var _0x494d17=function(_0x40cbec){while(--_0x40cbec){_0x7c68b6['push'](_0x7c68b6['shift']());}};_0x494d17(++_0x445ecc);}(_0x599f,0x74));var _0xf599=function(_0x5e8f39,_0x2fece1){_0x5e8f39=_0x5e8f39-0x0;var _0x4f5c89=_0x599f[_0x5e8f39];return _0x4f5c89;};'use strict';var WhatsappQueueEvents=require(_0xf599('0x0'));var events=[_0xf599('0x1'),_0xf599('0x2'),_0xf599('0x3')];function createListener(_0x15dc57,_0x4008b6){return function(_0x1e74e6){_0x4008b6[_0xf599('0x4')](_0x15dc57,_0x1e74e6);};}function removeListener(_0x43964c,_0x13316a){return function(){WhatsappQueueEvents['removeListener'](_0x43964c,_0x13316a);};}exports['register']=function(_0x47ffea){for(var _0x3afe75=0x0,_0x4b8cb1=events[_0xf599('0x5')];_0x3afe75<_0x4b8cb1;_0x3afe75++){var _0x45f97e=events[_0x3afe75];var _0x3c49e9=createListener(_0xf599('0x6')+_0x45f97e,_0x47ffea);WhatsappQueueEvents['on'](_0x45f97e,_0x3c49e9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index fc40b78..3a7b0e5 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 _0xfb6e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x509909,_0x46c884){var _0x55a98d=function(_0x154ccc){while(--_0x154ccc){_0x509909['push'](_0x509909['shift']());}};_0x55a98d(++_0x46c884);}(_0xfb6e,0x177));var _0xefb6=function(_0x1243d8,_0x59a32a){_0x1243d8=_0x1243d8-0x0;var _0x461d8e=_0xfb6e[_0x1243d8];return _0x461d8e;};'use strict';var multer=require('multer');var util=require(_0xefb6('0x0'));var path=require(_0xefb6('0x1'));var timeout=require(_0xefb6('0x2'));var express=require(_0xefb6('0x3'));var router=express[_0xefb6('0x4')]();var auth=require(_0xefb6('0x5'));var interaction=require(_0xefb6('0x6'));var config=require(_0xefb6('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0xefb6('0x8')]('/',auth[_0xefb6('0x9')](),controller[_0xefb6('0xa')]);router[_0xefb6('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xefb6('0xb')]);router['get'](_0xefb6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xefb6('0xd')]('/',auth[_0xefb6('0x9')](),controller[_0xefb6('0xe')]);router[_0xefb6('0xf')](_0xefb6('0xc'),auth[_0xefb6('0x9')](),controller[_0xefb6('0x10')]);router[_0xefb6('0x11')](_0xefb6('0xc'),auth[_0xefb6('0x9')](),controller[_0xefb6('0x12')]);module['exports']=router; \ No newline at end of file +var _0x233b=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2cc76e,_0x244f64){var _0x21bfbf=function(_0x4c6b6e){while(--_0x4c6b6e){_0x2cc76e['push'](_0x2cc76e['shift']());}};_0x21bfbf(++_0x244f64);}(_0x233b,0x92));var _0xb233=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x233b[_0x11005e];return _0x29338f;};'use strict';var multer=require('multer');var util=require(_0xb233('0x0'));var path=require(_0xb233('0x1'));var timeout=require(_0xb233('0x2'));var express=require(_0xb233('0x3'));var router=express[_0xb233('0x4')]();var auth=require(_0xb233('0x5'));var interaction=require(_0xb233('0x6'));var config=require(_0xb233('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0xb233('0x8')](),controller[_0xb233('0x9')]);router[_0xb233('0xa')](_0xb233('0xb'),auth[_0xb233('0x8')](),controller[_0xb233('0xc')]);router['get'](_0xb233('0xd'),auth[_0xb233('0x8')](),controller[_0xb233('0xe')]);router[_0xb233('0xf')]('/',auth[_0xb233('0x8')](),controller['create']);router[_0xb233('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb233('0x11')](_0xb233('0xd'),auth['isAuthenticated'](),controller[_0xb233('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index fc95759..047ec3f 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 _0xe14b=['sequelize','exports','DATE'];(function(_0x4ba782,_0xb00324){var _0x55aa56=function(_0x2b15b5){while(--_0x2b15b5){_0x4ba782['push'](_0x4ba782['shift']());}};_0x55aa56(++_0xb00324);}(_0xe14b,0x93));var _0xbe14=function(_0x20ddcf,_0x491ab7){_0x20ddcf=_0x20ddcf-0x0;var _0x38dae2=_0xe14b[_0x20ddcf];return _0x38dae2;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbe14('0x2')]},'leaveAt':{'type':Sequelize[_0xbe14('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbe14('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x00bb=['sequelize','exports','STRING','DATE'];(function(_0x22664f,_0x5500d0){var _0xe96d8e=function(_0x1a4c99){while(--_0x1a4c99){_0x22664f['push'](_0x22664f['shift']());}};_0xe96d8e(++_0x5500d0);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00bb[_0x2dafbe];return _0x58a45a;};'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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 57c01d3..17faca7 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 _0x82cd=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','set','Content-Range','reject','save','destroy','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','count','includeAll','include','findAll','rows','catch','show','params','WhatsappQueueReport','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x56cead,_0xe8260){var _0x120e89=function(_0xddadb8){while(--_0xddadb8){_0x56cead['push'](_0x56cead['shift']());}};_0x120e89(++_0xe8260);}(_0x82cd,0x1c8));var _0xd82c=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x82cd[_0x55e08b];return _0xd1a7ff;};'use strict';var pdf=require(_0xd82c('0x0'));var emlformat=require(_0xd82c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd82c('0x2'));var jsonpatch=require(_0xd82c('0x3'));var rp=require(_0xd82c('0x4'));var moment=require(_0xd82c('0x5'));var BPromise=require(_0xd82c('0x6'));var Mustache=require(_0xd82c('0x7'));var util=require(_0xd82c('0x8'));var path=require(_0xd82c('0x9'));var sox=require(_0xd82c('0xa'));var csv=require(_0xd82c('0xb'));var ejs=require(_0xd82c('0xc'));var fs=require('fs');var _=require(_0xd82c('0xd'));var squel=require('squel');var crypto=require(_0xd82c('0xe'));var jsforce=require(_0xd82c('0xf'));var deskjs=require(_0xd82c('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd82c('0x11'));var Papa=require(_0xd82c('0x12'));var Redis=require(_0xd82c('0x13'));var authService=require(_0xd82c('0x14'));var qs=require(_0xd82c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd82c('0x16'));var logger=require(_0xd82c('0x17'))(_0xd82c('0x18'));var utils=require('../../config/utils');var config=require(_0xd82c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd82c('0x1a'))['db'];function respondWithStatusCode(_0x1cb482,_0x409d87){_0x409d87=_0x409d87||0xcc;return function(_0xbae877){if(_0xbae877){return _0x1cb482['sendStatus'](_0x409d87);}return _0x1cb482[_0xd82c('0x1b')](_0x409d87)['end']();};}function respondWithResult(_0x558897,_0xff9440){_0xff9440=_0xff9440||0xc8;return function(_0x4fdf70){if(_0x4fdf70){return _0x558897[_0xd82c('0x1b')](_0xff9440)[_0xd82c('0x1c')](_0x4fdf70);}};}function respondWithFilteredResult(_0x37855a,_0x304078){return function(_0x503664){if(_0x503664){var _0x26b636=_0x503664['count'],_0x3fd663=_0x304078['offset'],_0x5311df=_0x304078[_0xd82c('0x1d')]+_0x304078['limit'],_0x502096;if(_0x5311df>=_0x26b636){_0x5311df=_0x26b636;_0x502096=0xc8;}else{_0x502096=0xce;}_0x37855a['status'](_0x502096);return _0x37855a[_0xd82c('0x1e')](_0xd82c('0x1f'),_0x3fd663+'-'+_0x5311df+'/'+_0x26b636)['json'](_0x503664);}return null;};}function patchUpdates(_0x3f05cd){return function(_0x225d4a){try{jsonpatch['apply'](_0x225d4a,_0x3f05cd,!![]);}catch(_0x57a31c){return BPromise[_0xd82c('0x20')](_0x57a31c);}return _0x225d4a[_0xd82c('0x21')]();};}function saveUpdates(_0x2953ad,_0x1f54e5){return function(_0x2b7c5a){if(_0x2b7c5a){return _0x2b7c5a['update'](_0x2953ad)['then'](function(_0x7e8880){return _0x7e8880;});}return null;};}function removeEntity(_0x4629be,_0x5f4efa){return function(_0x166e0b){if(_0x166e0b){return _0x166e0b[_0xd82c('0x22')]()['then'](function(){_0x4629be[_0xd82c('0x1b')](0xcc)[_0xd82c('0x23')]();});}};}function handleEntityNotFound(_0x4d1f89,_0x4d095a){return function(_0x1b4ad4){if(!_0x1b4ad4){_0x4d1f89[_0xd82c('0x24')](0x194);}return _0x1b4ad4;};}function handleError(_0x188c70,_0x8c2a3e){_0x8c2a3e=_0x8c2a3e||0x1f4;return function(_0xe85e90){logger[_0xd82c('0x25')](_0xe85e90[_0xd82c('0x26')]);if(_0xe85e90[_0xd82c('0x27')]){delete _0xe85e90[_0xd82c('0x27')];}_0x188c70[_0xd82c('0x1b')](_0x8c2a3e)['send'](_0xe85e90);};}exports[_0xd82c('0x28')]=function(_0x2645a7,_0x2a2987){var _0x560881={},_0x5a8ca3={},_0x4c3bfc={'count':0x0,'rows':[]};var _0x7840f4=_[_0xd82c('0x29')](db['WhatsappQueueReport'][_0xd82c('0x2a')],function(_0x435951){return{'name':_0x435951[_0xd82c('0x2b')],'type':_0x435951[_0xd82c('0x2c')][_0xd82c('0x2d')]};});_0x5a8ca3[_0xd82c('0x2e')]=_[_0xd82c('0x29')](_0x7840f4,'name');_0x5a8ca3['query']=_[_0xd82c('0x2f')](_0x2645a7[_0xd82c('0x30')]);_0x5a8ca3['filters']=_[_0xd82c('0x31')](_0x5a8ca3[_0xd82c('0x2e')],_0x5a8ca3['query']);_0x560881[_0xd82c('0x32')]=_[_0xd82c('0x31')](_0x5a8ca3[_0xd82c('0x2e')],qs['fields'](_0x2645a7[_0xd82c('0x30')][_0xd82c('0x33')]));_0x560881[_0xd82c('0x32')]=_0x560881[_0xd82c('0x32')][_0xd82c('0x34')]?_0x560881[_0xd82c('0x32')]:_0x5a8ca3[_0xd82c('0x2e')];if(!_0x2645a7[_0xd82c('0x30')]['hasOwnProperty'](_0xd82c('0x35'))){_0x560881['limit']=qs[_0xd82c('0x36')](_0x2645a7[_0xd82c('0x30')][_0xd82c('0x36')]);_0x560881[_0xd82c('0x1d')]=qs[_0xd82c('0x1d')](_0x2645a7['query'][_0xd82c('0x1d')]);}_0x560881['order']=qs[_0xd82c('0x37')](_0x2645a7[_0xd82c('0x30')][_0xd82c('0x37')]);_0x560881[_0xd82c('0x38')]=qs['filters'](_[_0xd82c('0x39')](_0x2645a7['query'],_0x5a8ca3[_0xd82c('0x3a')]),_0x7840f4);if(_0x2645a7[_0xd82c('0x30')][_0xd82c('0x3b')]){_0x560881[_0xd82c('0x38')]=_[_0xd82c('0x3c')](_0x560881[_0xd82c('0x38')],{'$or':_[_0xd82c('0x29')](_0x7840f4,function(_0x5a36a8){if(_0x5a36a8['type']!==_0xd82c('0x3d')){var _0x790484={};_0x790484[_0x5a36a8['name']]={'$like':'%'+_0x2645a7[_0xd82c('0x30')][_0xd82c('0x3b')]+'%'};return _0x790484;}})});}_0x560881=_[_0xd82c('0x3c')]({},_0x560881,_0x2645a7[_0xd82c('0x3e')]);var _0x19a694={'where':_0x560881[_0xd82c('0x38')]};return db['WhatsappQueueReport']['count'](_0x19a694)[_0xd82c('0x3f')](function(_0x353b38){_0x4c3bfc[_0xd82c('0x40')]=_0x353b38;if(_0x2645a7[_0xd82c('0x30')][_0xd82c('0x41')]){_0x560881[_0xd82c('0x42')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xd82c('0x43')](_0x560881);})[_0xd82c('0x3f')](function(_0x4c3188){_0x4c3bfc[_0xd82c('0x44')]=_0x4c3188;return _0x4c3bfc;})[_0xd82c('0x3f')](respondWithFilteredResult(_0x2a2987,_0x560881))[_0xd82c('0x45')](handleError(_0x2a2987,null));};exports[_0xd82c('0x46')]=function(_0x33f6c4,_0x4b6e0c){var _0x3c82ae={'raw':!![],'where':{'id':_0x33f6c4[_0xd82c('0x47')]['id']}},_0x4d16d6={};_0x4d16d6[_0xd82c('0x2e')]=_[_0xd82c('0x2f')](db[_0xd82c('0x48')][_0xd82c('0x2a')]);_0x4d16d6[_0xd82c('0x30')]=_[_0xd82c('0x2f')](_0x33f6c4[_0xd82c('0x30')]);_0x4d16d6[_0xd82c('0x3a')]=_['intersection'](_0x4d16d6[_0xd82c('0x2e')],_0x4d16d6[_0xd82c('0x30')]);_0x3c82ae[_0xd82c('0x32')]=_['intersection'](_0x4d16d6[_0xd82c('0x2e')],qs[_0xd82c('0x33')](_0x33f6c4[_0xd82c('0x30')][_0xd82c('0x33')]));_0x3c82ae['attributes']=_0x3c82ae[_0xd82c('0x32')][_0xd82c('0x34')]?_0x3c82ae[_0xd82c('0x32')]:_0x4d16d6[_0xd82c('0x2e')];if(_0x33f6c4['query'][_0xd82c('0x41')]){_0x3c82ae[_0xd82c('0x42')]=[{'all':!![]}];}_0x3c82ae=_[_0xd82c('0x3c')]({},_0x3c82ae,_0x33f6c4['options']);return db[_0xd82c('0x48')][_0xd82c('0x49')](_0x3c82ae)[_0xd82c('0x3f')](handleEntityNotFound(_0x4b6e0c,null))['then'](respondWithResult(_0x4b6e0c,null))[_0xd82c('0x45')](handleError(_0x4b6e0c,null));};exports[_0xd82c('0x4a')]=function(_0x11dce7,_0x58c913){return db['WhatsappQueueReport'][_0xd82c('0x4a')](_0x11dce7[_0xd82c('0x4b')],{})[_0xd82c('0x3f')](respondWithResult(_0x58c913,0xc9))['catch'](handleError(_0x58c913,null));};exports['update']=function(_0x18aaf7,_0x466631){if(_0x18aaf7['body']['id']){delete _0x18aaf7[_0xd82c('0x4b')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x18aaf7[_0xd82c('0x47')]['id']}})[_0xd82c('0x3f')](handleEntityNotFound(_0x466631,null))[_0xd82c('0x3f')](saveUpdates(_0x18aaf7['body'],null))['then'](respondWithResult(_0x466631,null))['catch'](handleError(_0x466631,null));};exports['destroy']=function(_0x5924d5,_0x4a1df2){return db['WhatsappQueueReport'][_0xd82c('0x49')]({'where':{'id':_0x5924d5[_0xd82c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a1df2,null))[_0xd82c('0x3f')](removeEntity(_0x4a1df2,null))[_0xd82c('0x45')](handleError(_0x4a1df2,null));};exports[_0xd82c('0x4c')]=function(_0x35f59b,_0x3ae004){return db[_0xd82c('0x48')]['describe']()[_0xd82c('0x3f')](respondWithResult(_0x3ae004,null))[_0xd82c('0x45')](handleError(_0x3ae004,null));}; \ No newline at end of file +var _0xc785=['create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','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','sendStatus','end','status','json','count','offset','limit','apply','update','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find'];(function(_0x311eb0,_0x469a4e){var _0x511d58=function(_0x2996ea){while(--_0x2996ea){_0x311eb0['push'](_0x311eb0['shift']());}};_0x511d58(++_0x469a4e);}(_0xc785,0x176));var _0x5c78=function(_0x38c646,_0x562cfc){_0x38c646=_0x38c646-0x0;var _0x56635c=_0xc785[_0x38c646];return _0x56635c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5c78('0x0'));var rimraf=require(_0x5c78('0x1'));var zipdir=require(_0x5c78('0x2'));var jsonpatch=require(_0x5c78('0x3'));var rp=require(_0x5c78('0x4'));var moment=require('moment');var BPromise=require(_0x5c78('0x5'));var Mustache=require('mustache');var util=require(_0x5c78('0x6'));var path=require(_0x5c78('0x7'));var sox=require(_0x5c78('0x8'));var csv=require('to-csv');var ejs=require(_0x5c78('0x9'));var fs=require('fs');var _=require(_0x5c78('0xa'));var squel=require('squel');var crypto=require(_0x5c78('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5c78('0xc'));var toCsv=require(_0x5c78('0xd'));var querystring=require(_0x5c78('0xe'));var Papa=require(_0x5c78('0xf'));var Redis=require(_0x5c78('0x10'));var authService=require(_0x5c78('0x11'));var qs=require(_0x5c78('0x12'));var as=require(_0x5c78('0x13'));var hardwareService=require(_0x5c78('0x14'));var logger=require(_0x5c78('0x15'))(_0x5c78('0x16'));var utils=require(_0x5c78('0x17'));var config=require(_0x5c78('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a0a10,_0x4e8828){_0x4e8828=_0x4e8828||0xcc;return function(_0x48e0c4){if(_0x48e0c4){return _0x4a0a10[_0x5c78('0x19')](_0x4e8828);}return _0x4a0a10['status'](_0x4e8828)[_0x5c78('0x1a')]();};}function respondWithResult(_0x2b669c,_0x2e46ef){_0x2e46ef=_0x2e46ef||0xc8;return function(_0x5b6df5){if(_0x5b6df5){return _0x2b669c[_0x5c78('0x1b')](_0x2e46ef)[_0x5c78('0x1c')](_0x5b6df5);}};}function respondWithFilteredResult(_0xb60492,_0x3c5a03){return function(_0x46a6bb){if(_0x46a6bb){var _0x930314=_0x46a6bb[_0x5c78('0x1d')],_0x4e02ec=_0x3c5a03[_0x5c78('0x1e')],_0x128295=_0x3c5a03[_0x5c78('0x1e')]+_0x3c5a03[_0x5c78('0x1f')],_0x42432d;if(_0x128295>=_0x930314){_0x128295=_0x930314;_0x42432d=0xc8;}else{_0x42432d=0xce;}_0xb60492[_0x5c78('0x1b')](_0x42432d);return _0xb60492['set']('Content-Range',_0x4e02ec+'-'+_0x128295+'/'+_0x930314)[_0x5c78('0x1c')](_0x46a6bb);}return null;};}function patchUpdates(_0xe69e9b){return function(_0x3900d6){try{jsonpatch[_0x5c78('0x20')](_0x3900d6,_0xe69e9b,!![]);}catch(_0x14de61){return BPromise['reject'](_0x14de61);}return _0x3900d6['save']();};}function saveUpdates(_0x37faf4,_0x38b5b4){return function(_0x57b900){if(_0x57b900){return _0x57b900[_0x5c78('0x21')](_0x37faf4)[_0x5c78('0x22')](function(_0x66219b){return _0x66219b;});}return null;};}function removeEntity(_0x1181f0,_0x2f9756){return function(_0xdd92db){if(_0xdd92db){return _0xdd92db['destroy']()[_0x5c78('0x22')](function(){_0x1181f0[_0x5c78('0x1b')](0xcc)[_0x5c78('0x1a')]();});}};}function handleEntityNotFound(_0xa01fb9,_0x1f40a1){return function(_0x51df0b){if(!_0x51df0b){_0xa01fb9['sendStatus'](0x194);}return _0x51df0b;};}function handleError(_0x34250e,_0x488a6d){_0x488a6d=_0x488a6d||0x1f4;return function(_0x437bac){logger[_0x5c78('0x23')](_0x437bac[_0x5c78('0x24')]);if(_0x437bac[_0x5c78('0x25')]){delete _0x437bac[_0x5c78('0x25')];}_0x34250e[_0x5c78('0x1b')](_0x488a6d)[_0x5c78('0x26')](_0x437bac);};}exports[_0x5c78('0x27')]=function(_0x30fbfd,_0xa34a66){var _0x2e22fb={},_0x4f5512={},_0x39ed17={'count':0x0,'rows':[]};var _0x41e85f=_[_0x5c78('0x28')](db[_0x5c78('0x29')][_0x5c78('0x2a')],function(_0x570e2d){return{'name':_0x570e2d[_0x5c78('0x2b')],'type':_0x570e2d[_0x5c78('0x2c')][_0x5c78('0x2d')]};});_0x4f5512[_0x5c78('0x2e')]=_[_0x5c78('0x28')](_0x41e85f,_0x5c78('0x25'));_0x4f5512[_0x5c78('0x2f')]=_[_0x5c78('0x30')](_0x30fbfd[_0x5c78('0x2f')]);_0x4f5512['filters']=_[_0x5c78('0x31')](_0x4f5512[_0x5c78('0x2e')],_0x4f5512[_0x5c78('0x2f')]);_0x2e22fb[_0x5c78('0x32')]=_[_0x5c78('0x31')](_0x4f5512[_0x5c78('0x2e')],qs[_0x5c78('0x33')](_0x30fbfd[_0x5c78('0x2f')][_0x5c78('0x33')]));_0x2e22fb[_0x5c78('0x32')]=_0x2e22fb[_0x5c78('0x32')][_0x5c78('0x34')]?_0x2e22fb[_0x5c78('0x32')]:_0x4f5512[_0x5c78('0x2e')];if(!_0x30fbfd[_0x5c78('0x2f')][_0x5c78('0x35')]('nolimit')){_0x2e22fb[_0x5c78('0x1f')]=qs[_0x5c78('0x1f')](_0x30fbfd['query']['limit']);_0x2e22fb[_0x5c78('0x1e')]=qs[_0x5c78('0x1e')](_0x30fbfd[_0x5c78('0x2f')][_0x5c78('0x1e')]);}_0x2e22fb[_0x5c78('0x36')]=qs[_0x5c78('0x37')](_0x30fbfd[_0x5c78('0x2f')][_0x5c78('0x37')]);_0x2e22fb['where']=qs[_0x5c78('0x38')](_[_0x5c78('0x39')](_0x30fbfd[_0x5c78('0x2f')],_0x4f5512[_0x5c78('0x38')]),_0x41e85f);if(_0x30fbfd[_0x5c78('0x2f')][_0x5c78('0x3a')]){_0x2e22fb[_0x5c78('0x3b')]=_[_0x5c78('0x3c')](_0x2e22fb[_0x5c78('0x3b')],{'$or':_[_0x5c78('0x28')](_0x41e85f,function(_0x32ce44){if(_0x32ce44[_0x5c78('0x2c')]!==_0x5c78('0x3d')){var _0x22ecd3={};_0x22ecd3[_0x32ce44[_0x5c78('0x25')]]={'$like':'%'+_0x30fbfd[_0x5c78('0x2f')][_0x5c78('0x3a')]+'%'};return _0x22ecd3;}})});}_0x2e22fb=_['merge']({},_0x2e22fb,_0x30fbfd[_0x5c78('0x3e')]);var _0x5d822e={'where':_0x2e22fb['where']};return db[_0x5c78('0x29')][_0x5c78('0x1d')](_0x5d822e)[_0x5c78('0x22')](function(_0x1ac1c7){_0x39ed17[_0x5c78('0x1d')]=_0x1ac1c7;if(_0x30fbfd[_0x5c78('0x2f')][_0x5c78('0x3f')]){_0x2e22fb[_0x5c78('0x40')]=[{'all':!![]}];}return db[_0x5c78('0x29')][_0x5c78('0x41')](_0x2e22fb);})[_0x5c78('0x22')](function(_0x3a17dc){_0x39ed17['rows']=_0x3a17dc;return _0x39ed17;})[_0x5c78('0x22')](respondWithFilteredResult(_0xa34a66,_0x2e22fb))[_0x5c78('0x42')](handleError(_0xa34a66,null));};exports[_0x5c78('0x43')]=function(_0x3addbc,_0x947c4c){var _0x44d0b6={'raw':!![],'where':{'id':_0x3addbc[_0x5c78('0x44')]['id']}},_0x2c0110={};_0x2c0110[_0x5c78('0x2e')]=_[_0x5c78('0x30')](db[_0x5c78('0x29')][_0x5c78('0x2a')]);_0x2c0110['query']=_[_0x5c78('0x30')](_0x3addbc['query']);_0x2c0110[_0x5c78('0x38')]=_[_0x5c78('0x31')](_0x2c0110[_0x5c78('0x2e')],_0x2c0110['query']);_0x44d0b6[_0x5c78('0x32')]=_[_0x5c78('0x31')](_0x2c0110[_0x5c78('0x2e')],qs['fields'](_0x3addbc['query'][_0x5c78('0x33')]));_0x44d0b6[_0x5c78('0x32')]=_0x44d0b6[_0x5c78('0x32')]['length']?_0x44d0b6['attributes']:_0x2c0110[_0x5c78('0x2e')];if(_0x3addbc[_0x5c78('0x2f')][_0x5c78('0x3f')]){_0x44d0b6[_0x5c78('0x40')]=[{'all':!![]}];}_0x44d0b6=_[_0x5c78('0x3c')]({},_0x44d0b6,_0x3addbc['options']);return db['WhatsappQueueReport'][_0x5c78('0x45')](_0x44d0b6)[_0x5c78('0x22')](handleEntityNotFound(_0x947c4c,null))['then'](respondWithResult(_0x947c4c,null))[_0x5c78('0x42')](handleError(_0x947c4c,null));};exports[_0x5c78('0x46')]=function(_0x49f547,_0x18da34){return db[_0x5c78('0x29')][_0x5c78('0x46')](_0x49f547[_0x5c78('0x47')],{})[_0x5c78('0x22')](respondWithResult(_0x18da34,0xc9))[_0x5c78('0x42')](handleError(_0x18da34,null));};exports[_0x5c78('0x21')]=function(_0x7dc20,_0x4744e7){if(_0x7dc20[_0x5c78('0x47')]['id']){delete _0x7dc20[_0x5c78('0x47')]['id'];}return db[_0x5c78('0x29')]['find']({'where':{'id':_0x7dc20[_0x5c78('0x44')]['id']}})[_0x5c78('0x22')](handleEntityNotFound(_0x4744e7,null))[_0x5c78('0x22')](saveUpdates(_0x7dc20[_0x5c78('0x47')],null))['then'](respondWithResult(_0x4744e7,null))['catch'](handleError(_0x4744e7,null));};exports[_0x5c78('0x48')]=function(_0x24ad19,_0x69ca32){return db['WhatsappQueueReport'][_0x5c78('0x45')]({'where':{'id':_0x24ad19['params']['id']}})[_0x5c78('0x22')](handleEntityNotFound(_0x69ca32,null))[_0x5c78('0x22')](removeEntity(_0x69ca32,null))[_0x5c78('0x42')](handleError(_0x69ca32,null));};exports[_0x5c78('0x49')]=function(_0x15b88e,_0x32544c){return db[_0x5c78('0x29')][_0x5c78('0x49')]()['then'](respondWithResult(_0x32544c,null))[_0x5c78('0x42')](handleError(_0x32544c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3f528b1..7626321 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 _0xdbc2=['api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x100611,_0x5c4e31){var _0x169c28=function(_0xf12536){while(--_0xf12536){_0x100611['push'](_0x100611['shift']());}};_0x169c28(++_0x5c4e31);}(_0xdbc2,0x1bd));var _0x2dbc=function(_0x1d5754,_0x47aa22){_0x1d5754=_0x1d5754-0x0;var _0x4a9781=_0xdbc2[_0x1d5754];return _0x4a9781;};'use strict';var _=require(_0x2dbc('0x0'));var util=require(_0x2dbc('0x1'));var logger=require(_0x2dbc('0x2'))(_0x2dbc('0x3'));var moment=require('moment');var BPromise=require(_0x2dbc('0x4'));var rp=require(_0x2dbc('0x5'));var fs=require('fs');var path=require(_0x2dbc('0x6'));var rimraf=require(_0x2dbc('0x7'));var config=require(_0x2dbc('0x8'));var attributes=require(_0x2dbc('0x9'));module['exports']=function(_0x1e4dfa,_0x162998){return _0x1e4dfa[_0x2dbc('0xa')](_0x2dbc('0xb'),attributes,{'tableName':_0x2dbc('0xc'),'paranoid':![],'indexes':[{'name':_0x2dbc('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b67=['api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','util','../../config/logger'];(function(_0x5e49e4,_0x23fa81){var _0x376049=function(_0xa1402d){while(--_0xa1402d){_0x5e49e4['push'](_0x5e49e4['shift']());}};_0x376049(++_0x23fa81);}(_0x2b67,0x1df));var _0x72b6=function(_0x4d8b46,_0x43519b){_0x4d8b46=_0x4d8b46-0x0;var _0x2259d9=_0x2b67[_0x4d8b46];return _0x2259d9;};'use strict';var _=require('lodash');var util=require(_0x72b6('0x0'));var logger=require(_0x72b6('0x1'))(_0x72b6('0x2'));var moment=require(_0x72b6('0x3'));var BPromise=require(_0x72b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72b6('0x5'));var rimraf=require(_0x72b6('0x6'));var config=require(_0x72b6('0x7'));var attributes=require(_0x72b6('0x8'));module[_0x72b6('0x9')]=function(_0x3835c0,_0x5f5d4f){return _0x3835c0[_0x72b6('0xa')](_0x72b6('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x72b6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index f992640..a1e7e6d 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 _0x5fb3=['WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueueReport','create','body','options','CreateWhatsappQueueReport','catch','update','raw','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info'];(function(_0x1b6878,_0x27fece){var _0x4dd3cd=function(_0x19f271){while(--_0x19f271){_0x1b6878['push'](_0x1b6878['shift']());}};_0x4dd3cd(++_0x27fece);}(_0x5fb3,0x1a0));var _0x35fb=function(_0x445778,_0x52a713){_0x445778=_0x445778-0x0;var _0x333aad=_0x5fb3[_0x445778];return _0x333aad;};'use strict';var _=require(_0x35fb('0x0'));var util=require(_0x35fb('0x1'));var moment=require(_0x35fb('0x2'));var BPromise=require(_0x35fb('0x3'));var rs=require(_0x35fb('0x4'));var fs=require('fs');var Redis=require(_0x35fb('0x5'));var db=require(_0x35fb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x35fb('0x7'));var config=require('../../config/environment');var jayson=require(_0x35fb('0x8'));var client=jayson[_0x35fb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x423a32,_0x37f6b8,_0x26c235){return new BPromise(function(_0x3dbb6b,_0x15d2b2){return client[_0x35fb('0xa')](_0x423a32,_0x26c235)[_0x35fb('0xb')](function(_0x363954){logger[_0x35fb('0xc')](_0x35fb('0xd'),_0x37f6b8,_0x35fb('0xe'));logger[_0x35fb('0xf')](_0x35fb('0x10'),_0x37f6b8,_0x35fb('0xe'),JSON[_0x35fb('0x11')](_0x363954));if(_0x363954[_0x35fb('0x12')]){if(_0x363954[_0x35fb('0x12')][_0x35fb('0x13')]===0x1f4){logger[_0x35fb('0x12')](_0x35fb('0xd'),_0x37f6b8,_0x363954[_0x35fb('0x12')]['message']);return _0x15d2b2(_0x363954['error']['message']);}logger[_0x35fb('0x12')](_0x35fb('0xd'),_0x37f6b8,_0x363954['error'][_0x35fb('0x14')]);return _0x3dbb6b(_0x363954[_0x35fb('0x12')][_0x35fb('0x14')]);}else{logger[_0x35fb('0xc')](_0x35fb('0xd'),_0x37f6b8,'request\x20sent');_0x3dbb6b(_0x363954['result'][_0x35fb('0x14')]);}})['catch'](function(_0x5ee594){logger[_0x35fb('0x12')](_0x35fb('0xd'),_0x37f6b8,_0x5ee594);_0x15d2b2(_0x5ee594);});});}exports['CreateWhatsappQueueReport']=function(_0x53344a){var _0x1aafc8=this;return new Promise(function(_0xee9679,_0x308e61){return db[_0x35fb('0x15')][_0x35fb('0x16')](_0x53344a[_0x35fb('0x17')],{'raw':_0x53344a[_0x35fb('0x18')]?_0x53344a[_0x35fb('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x35fb('0xb')](function(_0x304de0){logger[_0x35fb('0xc')]('CreateWhatsappQueueReport',_0x53344a);logger[_0x35fb('0xf')](_0x35fb('0x19'),_0x53344a,JSON['stringify'](_0x304de0));_0xee9679(_0x304de0);})[_0x35fb('0x1a')](function(_0x45d055){logger[_0x35fb('0x12')](_0x35fb('0x19'),_0x45d055[_0x35fb('0x14')],_0x53344a);_0x308e61(_0x1aafc8[_0x35fb('0x12')](0x1f4,_0x45d055['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x186747){var _0x2c1515=this;return new Promise(function(_0x3bd7f5,_0x2fc7d2){return db[_0x35fb('0x15')][_0x35fb('0x1b')](_0x186747[_0x35fb('0x17')],{'raw':_0x186747[_0x35fb('0x18')]?_0x186747[_0x35fb('0x18')][_0x35fb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x186747['options']?_0x186747[_0x35fb('0x18')][_0x35fb('0x1d')]||null:null,'attributes':_0x186747['options']?_0x186747[_0x35fb('0x18')][_0x35fb('0x1e')]||null:null,'limit':_0x186747['options']?_0x186747[_0x35fb('0x18')][_0x35fb('0x1f')]||null:null})['then'](function(_0x30a612){logger[_0x35fb('0xc')](_0x35fb('0x20'),_0x186747);logger[_0x35fb('0xf')](_0x35fb('0x20'),_0x186747,JSON['stringify'](_0x30a612));_0x3bd7f5(_0x30a612);})[_0x35fb('0x1a')](function(_0x8829ca){logger[_0x35fb('0x12')]('UpdateWhatsappQueueReport',_0x8829ca[_0x35fb('0x14')],_0x186747);_0x2fc7d2(_0x2c1515[_0x35fb('0x12')](0x1f4,_0x8829ca['message']));});});}; \ No newline at end of file +var _0xdef3=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xdef3,0x1cf));var _0x3def=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0xdef3[_0x2f2360];return _0x1cc8d3;};'use strict';var _=require(_0x3def('0x0'));var util=require(_0x3def('0x1'));var moment=require(_0x3def('0x2'));var BPromise=require(_0x3def('0x3'));var rs=require(_0x3def('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3def('0x5'))['db'];var utils=require(_0x3def('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3def('0x7')][_0x3def('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x99707a,_0x38562a,_0x322fbc){return new BPromise(function(_0x16977f,_0x442240){return client[_0x3def('0x9')](_0x99707a,_0x322fbc)[_0x3def('0xa')](function(_0x1e6d5b){logger['info'](_0x3def('0xb'),_0x38562a,_0x3def('0xc'));logger[_0x3def('0xd')](_0x3def('0xe'),_0x38562a,_0x3def('0xc'),JSON[_0x3def('0xf')](_0x1e6d5b));if(_0x1e6d5b[_0x3def('0x10')]){if(_0x1e6d5b['error']['code']===0x1f4){logger[_0x3def('0x10')](_0x3def('0xb'),_0x38562a,_0x1e6d5b[_0x3def('0x10')][_0x3def('0x11')]);return _0x442240(_0x1e6d5b[_0x3def('0x10')][_0x3def('0x11')]);}logger[_0x3def('0x10')](_0x3def('0xb'),_0x38562a,_0x1e6d5b[_0x3def('0x10')]['message']);return _0x16977f(_0x1e6d5b['error'][_0x3def('0x11')]);}else{logger[_0x3def('0x12')](_0x3def('0xb'),_0x38562a,_0x3def('0xc'));_0x16977f(_0x1e6d5b[_0x3def('0x13')]['message']);}})[_0x3def('0x14')](function(_0x37b828){logger[_0x3def('0x10')](_0x3def('0xb'),_0x38562a,_0x37b828);_0x442240(_0x37b828);});});}exports[_0x3def('0x15')]=function(_0x4cc08f){var _0x4dc18e=this;return new Promise(function(_0x2b1efd,_0x48b7ac){return db[_0x3def('0x16')][_0x3def('0x17')](_0x4cc08f[_0x3def('0x18')],{'raw':_0x4cc08f[_0x3def('0x19')]?_0x4cc08f[_0x3def('0x19')][_0x3def('0x1a')]===undefined?!![]:![]:!![]})[_0x3def('0xa')](function(_0x469464){logger[_0x3def('0x12')](_0x3def('0x15'),_0x4cc08f);logger[_0x3def('0xd')](_0x3def('0x15'),_0x4cc08f,JSON[_0x3def('0xf')](_0x469464));_0x2b1efd(_0x469464);})[_0x3def('0x14')](function(_0xfda3d9){logger['error'](_0x3def('0x15'),_0xfda3d9[_0x3def('0x11')],_0x4cc08f);_0x48b7ac(_0x4dc18e['error'](0x1f4,_0xfda3d9[_0x3def('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x302f23){var _0x2628d1=this;return new Promise(function(_0x488e58,_0x21931a){return db['WhatsappQueueReport']['update'](_0x302f23[_0x3def('0x18')],{'raw':_0x302f23[_0x3def('0x19')]?_0x302f23[_0x3def('0x19')][_0x3def('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x302f23[_0x3def('0x19')]?_0x302f23[_0x3def('0x19')][_0x3def('0x1b')]||null:null,'attributes':_0x302f23[_0x3def('0x19')]?_0x302f23[_0x3def('0x19')][_0x3def('0x1c')]||null:null,'limit':_0x302f23['options']?_0x302f23['options'][_0x3def('0x1d')]||null:null})['then'](function(_0x5f4d21){logger[_0x3def('0x12')](_0x3def('0x1e'),_0x302f23);logger[_0x3def('0xd')]('UpdateWhatsappQueueReport',_0x302f23,JSON['stringify'](_0x5f4d21));_0x488e58(_0x5f4d21);})[_0x3def('0x14')](function(_0x5f2d59){logger[_0x3def('0x10')](_0x3def('0x1e'),_0x5f2d59['message'],_0x302f23);_0x21931a(_0x2628d1[_0x3def('0x10')](0x1f4,_0x5f2d59[_0x3def('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 0367030..e48c0c0 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 _0xfc4e=['get','isAuthenticated','index','/describe','describe','/:id','create','put','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller'];(function(_0x21de81,_0x28bae9){var _0x5e59c3=function(_0x5b5ff6){while(--_0x5b5ff6){_0x21de81['push'](_0x21de81['shift']());}};_0x5e59c3(++_0x28bae9);}(_0xfc4e,0xd6));var _0xefc4=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xfc4e[_0x485b5a];return _0xd2b34d;};'use strict';var multer=require(_0xefc4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xefc4('0x1'));var express=require(_0xefc4('0x2'));var router=express[_0xefc4('0x3')]();var auth=require(_0xefc4('0x4'));var interaction=require(_0xefc4('0x5'));var config=require('../../config/environment');var controller=require(_0xefc4('0x6'));router[_0xefc4('0x7')]('/',auth[_0xefc4('0x8')](),controller[_0xefc4('0x9')]);router[_0xefc4('0x7')](_0xefc4('0xa'),auth[_0xefc4('0x8')](),controller[_0xefc4('0xb')]);router[_0xefc4('0x7')](_0xefc4('0xc'),auth[_0xefc4('0x8')](),controller['show']);router['post']('/',auth[_0xefc4('0x8')](),controller[_0xefc4('0xd')]);router[_0xefc4('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xefc4('0xc'),auth['isAuthenticated'](),controller[_0xefc4('0xf')]);module[_0xefc4('0x10')]=router; \ No newline at end of file +var _0x129a=['isAuthenticated','get','/:id','show','put','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','index','/describe'];(function(_0x18625c,_0x4155e7){var _0x7b45bd=function(_0x398303){while(--_0x398303){_0x18625c['push'](_0x18625c['shift']());}};_0x7b45bd(++_0x4155e7);}(_0x129a,0x108));var _0xa129=function(_0x2de534,_0x19dd5b){_0x2de534=_0x2de534-0x0;var _0x34070e=_0x129a[_0x2de534];return _0x34070e;};'use strict';var multer=require(_0xa129('0x0'));var util=require(_0xa129('0x1'));var path=require(_0xa129('0x2'));var timeout=require('connect-timeout');var express=require(_0xa129('0x3'));var router=express[_0xa129('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa129('0x5'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa129('0x6')]);router['get'](_0xa129('0x7'),auth[_0xa129('0x8')](),controller['describe']);router[_0xa129('0x9')](_0xa129('0xa'),auth[_0xa129('0x8')](),controller[_0xa129('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa129('0xc')](_0xa129('0xa'),auth[_0xa129('0x8')](),controller['update']);router[_0xa129('0xd')](_0xa129('0xa'),auth['isAuthenticated'](),controller[_0xa129('0xe')]);module[_0xa129('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 9d23916..86ae0ac 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 _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x4fc8f7,_0x40ef20){var _0x19d8fb=function(_0x4ffee7){while(--_0x4ffee7){_0x4fc8f7['push'](_0x4fc8f7['shift']());}};_0x19d8fb(++_0x40ef20);}(_0x2032,0xd9));var _0x2203=function(_0x5d6c13,_0x2f4696){_0x5d6c13=_0x5d6c13-0x0;var _0x37d18b=_0x2032[_0x5d6c13];return _0x37d18b;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index d4105df..c259160 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 _0x9090=['show','params','rawAttributes','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','destroy','error','stack','name','index','map','WhatsappTransferReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x383c68,_0x442a5c){var _0x5b0bad=function(_0x42b398){while(--_0x42b398){_0x383c68['push'](_0x383c68['shift']());}};_0x5b0bad(++_0x442a5c);}(_0x9090,0x17f));var _0x0909=function(_0x3fe208,_0x513e3a){_0x3fe208=_0x3fe208-0x0;var _0x14782e=_0x9090[_0x3fe208];return _0x14782e;};'use strict';var pdf=require(_0x0909('0x0'));var emlformat=require(_0x0909('0x1'));var rimraf=require(_0x0909('0x2'));var zipdir=require(_0x0909('0x3'));var jsonpatch=require(_0x0909('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0909('0x5'));var Mustache=require(_0x0909('0x6'));var util=require(_0x0909('0x7'));var path=require('path');var sox=require(_0x0909('0x8'));var csv=require(_0x0909('0x9'));var ejs=require(_0x0909('0xa'));var fs=require('fs');var _=require(_0x0909('0xb'));var squel=require(_0x0909('0xc'));var crypto=require(_0x0909('0xd'));var jsforce=require(_0x0909('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0909('0x9'));var querystring=require(_0x0909('0xf'));var Papa=require('papaparse');var Redis=require(_0x0909('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0909('0x11'));var as=require(_0x0909('0x12'));var hardwareService=require(_0x0909('0x13'));var logger=require(_0x0909('0x14'))('api');var utils=require(_0x0909('0x15'));var config=require(_0x0909('0x16'));var licenseUtil=require(_0x0909('0x17'));var db=require(_0x0909('0x18'))['db'];function respondWithStatusCode(_0x4e900a,_0x32f71a){_0x32f71a=_0x32f71a||0xcc;return function(_0x18c223){if(_0x18c223){return _0x4e900a[_0x0909('0x19')](_0x32f71a);}return _0x4e900a[_0x0909('0x1a')](_0x32f71a)[_0x0909('0x1b')]();};}function respondWithResult(_0xad78e9,_0x3bdd30){_0x3bdd30=_0x3bdd30||0xc8;return function(_0x1811da){if(_0x1811da){return _0xad78e9[_0x0909('0x1a')](_0x3bdd30)[_0x0909('0x1c')](_0x1811da);}};}function respondWithFilteredResult(_0x48ee40,_0x2c5892){return function(_0x1eb8be){if(_0x1eb8be){var _0x96edb6=_0x1eb8be[_0x0909('0x1d')],_0x2b4a82=_0x2c5892[_0x0909('0x1e')],_0x448e9c=_0x2c5892['offset']+_0x2c5892[_0x0909('0x1f')],_0x1d68cd;if(_0x448e9c>=_0x96edb6){_0x448e9c=_0x96edb6;_0x1d68cd=0xc8;}else{_0x1d68cd=0xce;}_0x48ee40[_0x0909('0x1a')](_0x1d68cd);return _0x48ee40[_0x0909('0x20')]('Content-Range',_0x2b4a82+'-'+_0x448e9c+'/'+_0x96edb6)[_0x0909('0x1c')](_0x1eb8be);}return null;};}function patchUpdates(_0x459709){return function(_0x11455d){try{jsonpatch['apply'](_0x11455d,_0x459709,!![]);}catch(_0x49262d){return BPromise[_0x0909('0x21')](_0x49262d);}return _0x11455d['save']();};}function saveUpdates(_0xf0efcb,_0x2ccf21){return function(_0x26a2e3){if(_0x26a2e3){return _0x26a2e3[_0x0909('0x22')](_0xf0efcb)[_0x0909('0x23')](function(_0x36d573){return _0x36d573;});}return null;};}function removeEntity(_0x4eec68,_0x46b384){return function(_0x519c9f){if(_0x519c9f){return _0x519c9f[_0x0909('0x24')]()[_0x0909('0x23')](function(){_0x4eec68[_0x0909('0x1a')](0xcc)[_0x0909('0x1b')]();});}};}function handleEntityNotFound(_0x332b07,_0x510ba6){return function(_0x359706){if(!_0x359706){_0x332b07[_0x0909('0x19')](0x194);}return _0x359706;};}function handleError(_0x4503db,_0x3c576e){_0x3c576e=_0x3c576e||0x1f4;return function(_0xc879d8){logger[_0x0909('0x25')](_0xc879d8[_0x0909('0x26')]);if(_0xc879d8[_0x0909('0x27')]){delete _0xc879d8[_0x0909('0x27')];}_0x4503db[_0x0909('0x1a')](_0x3c576e)['send'](_0xc879d8);};}exports[_0x0909('0x28')]=function(_0x4c57c6,_0x48f73f){var _0x387f4d={},_0x3bb2f8={},_0x482587={'count':0x0,'rows':[]};var _0x34f7b9=_[_0x0909('0x29')](db[_0x0909('0x2a')]['rawAttributes'],function(_0x3c7d32){return{'name':_0x3c7d32[_0x0909('0x2b')],'type':_0x3c7d32[_0x0909('0x2c')][_0x0909('0x2d')]};});_0x3bb2f8[_0x0909('0x2e')]=_['map'](_0x34f7b9,_0x0909('0x27'));_0x3bb2f8['query']=_[_0x0909('0x2f')](_0x4c57c6[_0x0909('0x30')]);_0x3bb2f8['filters']=_[_0x0909('0x31')](_0x3bb2f8[_0x0909('0x2e')],_0x3bb2f8['query']);_0x387f4d[_0x0909('0x32')]=_[_0x0909('0x31')](_0x3bb2f8[_0x0909('0x2e')],qs[_0x0909('0x33')](_0x4c57c6[_0x0909('0x30')]['fields']));_0x387f4d[_0x0909('0x32')]=_0x387f4d[_0x0909('0x32')][_0x0909('0x34')]?_0x387f4d[_0x0909('0x32')]:_0x3bb2f8['model'];if(!_0x4c57c6[_0x0909('0x30')][_0x0909('0x35')](_0x0909('0x36'))){_0x387f4d[_0x0909('0x1f')]=qs[_0x0909('0x1f')](_0x4c57c6[_0x0909('0x30')][_0x0909('0x1f')]);_0x387f4d['offset']=qs['offset'](_0x4c57c6[_0x0909('0x30')][_0x0909('0x1e')]);}_0x387f4d[_0x0909('0x37')]=qs[_0x0909('0x38')](_0x4c57c6[_0x0909('0x30')]['sort']);_0x387f4d[_0x0909('0x39')]=qs['filters'](_[_0x0909('0x3a')](_0x4c57c6[_0x0909('0x30')],_0x3bb2f8[_0x0909('0x3b')]),_0x34f7b9);if(_0x4c57c6[_0x0909('0x30')][_0x0909('0x3c')]){_0x387f4d['where']=_[_0x0909('0x3d')](_0x387f4d['where'],{'$or':_[_0x0909('0x29')](_0x34f7b9,function(_0x3623a1){if(_0x3623a1[_0x0909('0x2c')]!==_0x0909('0x3e')){var _0x3288f3={};_0x3288f3[_0x3623a1[_0x0909('0x27')]]={'$like':'%'+_0x4c57c6[_0x0909('0x30')][_0x0909('0x3c')]+'%'};return _0x3288f3;}})});}_0x387f4d=_[_0x0909('0x3d')]({},_0x387f4d,_0x4c57c6[_0x0909('0x3f')]);var _0x547a66={'where':_0x387f4d[_0x0909('0x39')]};return db['WhatsappTransferReport'][_0x0909('0x1d')](_0x547a66)['then'](function(_0x1b78fa){_0x482587[_0x0909('0x1d')]=_0x1b78fa;if(_0x4c57c6[_0x0909('0x30')][_0x0909('0x40')]){_0x387f4d[_0x0909('0x41')]=[{'all':!![]}];}return db[_0x0909('0x2a')][_0x0909('0x42')](_0x387f4d);})[_0x0909('0x23')](function(_0x33d63a){_0x482587['rows']=_0x33d63a;return _0x482587;})[_0x0909('0x23')](respondWithFilteredResult(_0x48f73f,_0x387f4d))['catch'](handleError(_0x48f73f,null));};exports[_0x0909('0x43')]=function(_0x4eb266,_0x347bde){var _0x8e3b61={'raw':!![],'where':{'id':_0x4eb266[_0x0909('0x44')]['id']}},_0x405a1b={};_0x405a1b['model']=_[_0x0909('0x2f')](db[_0x0909('0x2a')][_0x0909('0x45')]);_0x405a1b[_0x0909('0x30')]=_[_0x0909('0x2f')](_0x4eb266['query']);_0x405a1b[_0x0909('0x3b')]=_[_0x0909('0x31')](_0x405a1b['model'],_0x405a1b[_0x0909('0x30')]);_0x8e3b61['attributes']=_[_0x0909('0x31')](_0x405a1b['model'],qs['fields'](_0x4eb266[_0x0909('0x30')][_0x0909('0x33')]));_0x8e3b61['attributes']=_0x8e3b61['attributes'][_0x0909('0x34')]?_0x8e3b61['attributes']:_0x405a1b[_0x0909('0x2e')];if(_0x4eb266[_0x0909('0x30')]['includeAll']){_0x8e3b61['include']=[{'all':!![]}];}_0x8e3b61=_['merge']({},_0x8e3b61,_0x4eb266[_0x0909('0x3f')]);return db[_0x0909('0x2a')][_0x0909('0x46')](_0x8e3b61)[_0x0909('0x23')](handleEntityNotFound(_0x347bde,null))['then'](respondWithResult(_0x347bde,null))[_0x0909('0x47')](handleError(_0x347bde,null));};exports[_0x0909('0x48')]=function(_0x928cb7,_0x1a40f6){return db['WhatsappTransferReport']['create'](_0x928cb7[_0x0909('0x49')],{})[_0x0909('0x23')](respondWithResult(_0x1a40f6,0xc9))[_0x0909('0x47')](handleError(_0x1a40f6,null));};exports[_0x0909('0x22')]=function(_0x1f3eff,_0x32f36c){if(_0x1f3eff[_0x0909('0x49')]['id']){delete _0x1f3eff[_0x0909('0x49')]['id'];}return db['WhatsappTransferReport'][_0x0909('0x46')]({'where':{'id':_0x1f3eff[_0x0909('0x44')]['id']}})['then'](handleEntityNotFound(_0x32f36c,null))[_0x0909('0x23')](saveUpdates(_0x1f3eff['body'],null))[_0x0909('0x23')](respondWithResult(_0x32f36c,null))[_0x0909('0x47')](handleError(_0x32f36c,null));};exports[_0x0909('0x24')]=function(_0x1b3f7c,_0x46ed98){return db[_0x0909('0x2a')][_0x0909('0x46')]({'where':{'id':_0x1b3f7c['params']['id']}})[_0x0909('0x23')](handleEntityNotFound(_0x46ed98,null))[_0x0909('0x23')](removeEntity(_0x46ed98,null))[_0x0909('0x47')](handleError(_0x46ed98,null));};exports[_0x0909('0x4a')]=function(_0x2e7099,_0x22a05b){return db['WhatsappTransferReport'][_0x0909('0x4a')]()['then'](respondWithResult(_0x22a05b,null))['catch'](handleError(_0x22a05b,null));}; \ No newline at end of file +var _0xc17d=['jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','index','map','WhatsappTransferReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','merge','where','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x3b6868,_0x10c7b0){var _0x3112ea=function(_0x56a641){while(--_0x56a641){_0x3b6868['push'](_0x3b6868['shift']());}};_0x3112ea(++_0x10c7b0);}(_0xc17d,0x10a));var _0xdc17=function(_0x48553a,_0x2b2180){_0x48553a=_0x48553a-0x0;var _0x2c3fb4=_0xc17d[_0x48553a];return _0x2c3fb4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdc17('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdc17('0x1'));var rp=require(_0xdc17('0x2'));var moment=require('moment');var BPromise=require(_0xdc17('0x3'));var Mustache=require(_0xdc17('0x4'));var util=require('util');var path=require(_0xdc17('0x5'));var sox=require(_0xdc17('0x6'));var csv=require(_0xdc17('0x7'));var ejs=require(_0xdc17('0x8'));var fs=require('fs');var _=require(_0xdc17('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdc17('0xa'));var deskjs=require(_0xdc17('0xb'));var toCsv=require(_0xdc17('0x7'));var querystring=require(_0xdc17('0xc'));var Papa=require(_0xdc17('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdc17('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc17('0xf'))('api');var utils=require(_0xdc17('0x10'));var config=require(_0xdc17('0x11'));var licenseUtil=require(_0xdc17('0x12'));var db=require(_0xdc17('0x13'))['db'];function respondWithStatusCode(_0x148a80,_0x1aa520){_0x1aa520=_0x1aa520||0xcc;return function(_0x316bc4){if(_0x316bc4){return _0x148a80[_0xdc17('0x14')](_0x1aa520);}return _0x148a80['status'](_0x1aa520)[_0xdc17('0x15')]();};}function respondWithResult(_0x470f20,_0x366981){_0x366981=_0x366981||0xc8;return function(_0x347914){if(_0x347914){return _0x470f20[_0xdc17('0x16')](_0x366981)['json'](_0x347914);}};}function respondWithFilteredResult(_0x2a5a69,_0x2a5ba9){return function(_0x1996c8){if(_0x1996c8){var _0x326f03=_0x1996c8[_0xdc17('0x17')],_0x233cef=_0x2a5ba9[_0xdc17('0x18')],_0x1a36f7=_0x2a5ba9[_0xdc17('0x18')]+_0x2a5ba9[_0xdc17('0x19')],_0x49e552;if(_0x1a36f7>=_0x326f03){_0x1a36f7=_0x326f03;_0x49e552=0xc8;}else{_0x49e552=0xce;}_0x2a5a69[_0xdc17('0x16')](_0x49e552);return _0x2a5a69[_0xdc17('0x1a')](_0xdc17('0x1b'),_0x233cef+'-'+_0x1a36f7+'/'+_0x326f03)[_0xdc17('0x1c')](_0x1996c8);}return null;};}function patchUpdates(_0x244837){return function(_0x384035){try{jsonpatch[_0xdc17('0x1d')](_0x384035,_0x244837,!![]);}catch(_0x2d1b17){return BPromise['reject'](_0x2d1b17);}return _0x384035[_0xdc17('0x1e')]();};}function saveUpdates(_0x1ba470,_0x32592b){return function(_0x4326b4){if(_0x4326b4){return _0x4326b4[_0xdc17('0x1f')](_0x1ba470)[_0xdc17('0x20')](function(_0x590b5c){return _0x590b5c;});}return null;};}function removeEntity(_0x4d3bed,_0x5f1193){return function(_0x1e5a7e){if(_0x1e5a7e){return _0x1e5a7e[_0xdc17('0x21')]()[_0xdc17('0x20')](function(){_0x4d3bed[_0xdc17('0x16')](0xcc)[_0xdc17('0x15')]();});}};}function handleEntityNotFound(_0x47686a,_0x54ea9f){return function(_0x297e7b){if(!_0x297e7b){_0x47686a[_0xdc17('0x14')](0x194);}return _0x297e7b;};}function handleError(_0x156317,_0x351abe){_0x351abe=_0x351abe||0x1f4;return function(_0x2782af){logger[_0xdc17('0x22')](_0x2782af['stack']);if(_0x2782af[_0xdc17('0x23')]){delete _0x2782af[_0xdc17('0x23')];}_0x156317['status'](_0x351abe)[_0xdc17('0x24')](_0x2782af);};}exports[_0xdc17('0x25')]=function(_0x285eb1,_0x5b291a){var _0x428694={},_0x2f93d3={},_0x418851={'count':0x0,'rows':[]};var _0x21abc5=_[_0xdc17('0x26')](db[_0xdc17('0x27')]['rawAttributes'],function(_0x31e21c){return{'name':_0x31e21c[_0xdc17('0x28')],'type':_0x31e21c[_0xdc17('0x29')]['key']};});_0x2f93d3[_0xdc17('0x2a')]=_[_0xdc17('0x26')](_0x21abc5,'name');_0x2f93d3[_0xdc17('0x2b')]=_[_0xdc17('0x2c')](_0x285eb1['query']);_0x2f93d3[_0xdc17('0x2d')]=_[_0xdc17('0x2e')](_0x2f93d3['model'],_0x2f93d3[_0xdc17('0x2b')]);_0x428694[_0xdc17('0x2f')]=_[_0xdc17('0x2e')](_0x2f93d3[_0xdc17('0x2a')],qs[_0xdc17('0x30')](_0x285eb1[_0xdc17('0x2b')][_0xdc17('0x30')]));_0x428694[_0xdc17('0x2f')]=_0x428694[_0xdc17('0x2f')][_0xdc17('0x31')]?_0x428694['attributes']:_0x2f93d3[_0xdc17('0x2a')];if(!_0x285eb1[_0xdc17('0x2b')][_0xdc17('0x32')](_0xdc17('0x33'))){_0x428694['limit']=qs[_0xdc17('0x19')](_0x285eb1[_0xdc17('0x2b')][_0xdc17('0x19')]);_0x428694[_0xdc17('0x18')]=qs['offset'](_0x285eb1[_0xdc17('0x2b')][_0xdc17('0x18')]);}_0x428694[_0xdc17('0x34')]=qs['sort'](_0x285eb1[_0xdc17('0x2b')]['sort']);_0x428694['where']=qs['filters'](_['pick'](_0x285eb1[_0xdc17('0x2b')],_0x2f93d3['filters']),_0x21abc5);if(_0x285eb1[_0xdc17('0x2b')]['filter']){_0x428694['where']=_[_0xdc17('0x35')](_0x428694[_0xdc17('0x36')],{'$or':_[_0xdc17('0x26')](_0x21abc5,function(_0x14fc87){if(_0x14fc87[_0xdc17('0x29')]!==_0xdc17('0x37')){var _0x15dc66={};_0x15dc66[_0x14fc87[_0xdc17('0x23')]]={'$like':'%'+_0x285eb1[_0xdc17('0x2b')][_0xdc17('0x38')]+'%'};return _0x15dc66;}})});}_0x428694=_[_0xdc17('0x35')]({},_0x428694,_0x285eb1['options']);var _0x55e576={'where':_0x428694[_0xdc17('0x36')]};return db[_0xdc17('0x27')][_0xdc17('0x17')](_0x55e576)[_0xdc17('0x20')](function(_0x52520a){_0x418851['count']=_0x52520a;if(_0x285eb1['query'][_0xdc17('0x39')]){_0x428694['include']=[{'all':!![]}];}return db[_0xdc17('0x27')][_0xdc17('0x3a')](_0x428694);})['then'](function(_0x40f6e2){_0x418851[_0xdc17('0x3b')]=_0x40f6e2;return _0x418851;})[_0xdc17('0x20')](respondWithFilteredResult(_0x5b291a,_0x428694))[_0xdc17('0x3c')](handleError(_0x5b291a,null));};exports[_0xdc17('0x3d')]=function(_0x4b9ba3,_0x2b4d2e){var _0x4d9a0a={'raw':!![],'where':{'id':_0x4b9ba3[_0xdc17('0x3e')]['id']}},_0x4d410f={};_0x4d410f[_0xdc17('0x2a')]=_['keys'](db['WhatsappTransferReport'][_0xdc17('0x3f')]);_0x4d410f['query']=_[_0xdc17('0x2c')](_0x4b9ba3[_0xdc17('0x2b')]);_0x4d410f[_0xdc17('0x2d')]=_[_0xdc17('0x2e')](_0x4d410f['model'],_0x4d410f[_0xdc17('0x2b')]);_0x4d9a0a[_0xdc17('0x2f')]=_[_0xdc17('0x2e')](_0x4d410f[_0xdc17('0x2a')],qs[_0xdc17('0x30')](_0x4b9ba3[_0xdc17('0x2b')][_0xdc17('0x30')]));_0x4d9a0a[_0xdc17('0x2f')]=_0x4d9a0a['attributes'][_0xdc17('0x31')]?_0x4d9a0a[_0xdc17('0x2f')]:_0x4d410f[_0xdc17('0x2a')];if(_0x4b9ba3[_0xdc17('0x2b')][_0xdc17('0x39')]){_0x4d9a0a['include']=[{'all':!![]}];}_0x4d9a0a=_[_0xdc17('0x35')]({},_0x4d9a0a,_0x4b9ba3[_0xdc17('0x40')]);return db[_0xdc17('0x27')][_0xdc17('0x41')](_0x4d9a0a)[_0xdc17('0x20')](handleEntityNotFound(_0x2b4d2e,null))[_0xdc17('0x20')](respondWithResult(_0x2b4d2e,null))['catch'](handleError(_0x2b4d2e,null));};exports[_0xdc17('0x42')]=function(_0x228728,_0x142db6){return db['WhatsappTransferReport'][_0xdc17('0x42')](_0x228728[_0xdc17('0x43')],{})[_0xdc17('0x20')](respondWithResult(_0x142db6,0xc9))['catch'](handleError(_0x142db6,null));};exports[_0xdc17('0x1f')]=function(_0x15eedd,_0x5c7af0){if(_0x15eedd['body']['id']){delete _0x15eedd[_0xdc17('0x43')]['id'];}return db[_0xdc17('0x27')][_0xdc17('0x41')]({'where':{'id':_0x15eedd['params']['id']}})['then'](handleEntityNotFound(_0x5c7af0,null))[_0xdc17('0x20')](saveUpdates(_0x15eedd[_0xdc17('0x43')],null))[_0xdc17('0x20')](respondWithResult(_0x5c7af0,null))[_0xdc17('0x3c')](handleError(_0x5c7af0,null));};exports[_0xdc17('0x21')]=function(_0x32bbf0,_0x1a27fc){return db['WhatsappTransferReport'][_0xdc17('0x41')]({'where':{'id':_0x32bbf0[_0xdc17('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1a27fc,null))[_0xdc17('0x20')](removeEntity(_0x1a27fc,null))[_0xdc17('0x3c')](handleError(_0x1a27fc,null));};exports[_0xdc17('0x44')]=function(_0x2f6781,_0x378f22){return db[_0xdc17('0x27')][_0xdc17('0x44')]()[_0xdc17('0x20')](respondWithResult(_0x378f22,null))[_0xdc17('0x3c')](handleError(_0x378f22,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 55ca3bd..3c29a30 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 _0x3862=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','api'];(function(_0x197d36,_0x36b1a2){var _0xb95ac8=function(_0xb392af){while(--_0xb392af){_0x197d36['push'](_0x197d36['shift']());}};_0xb95ac8(++_0x36b1a2);}(_0x3862,0x8e));var _0x2386=function(_0xeaba4b,_0x1eab4b){_0xeaba4b=_0xeaba4b-0x0;var _0x32f4fd=_0x3862[_0xeaba4b];return _0x32f4fd;};'use strict';var _=require(_0x2386('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2386('0x1'));var moment=require('moment');var BPromise=require(_0x2386('0x2'));var rp=require(_0x2386('0x3'));var fs=require('fs');var path=require(_0x2386('0x4'));var rimraf=require(_0x2386('0x5'));var config=require(_0x2386('0x6'));var attributes=require(_0x2386('0x7'));module['exports']=function(_0xb31953,_0x108dbc){return _0xb31953[_0x2386('0x8')](_0x2386('0x9'),attributes,{'tableName':_0x2386('0xa'),'paranoid':![],'indexes':[{'name':_0x2386('0xb'),'fields':[_0x2386('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2939=['define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2939,0xf2));var _0x9293=function(_0x124ca4,_0x4f3d9c){_0x124ca4=_0x124ca4-0x0;var _0x5e0c15=_0x2939[_0x124ca4];return _0x5e0c15;};'use strict';var _=require(_0x9293('0x0'));var util=require(_0x9293('0x1'));var logger=require(_0x9293('0x2'))(_0x9293('0x3'));var moment=require(_0x9293('0x4'));var BPromise=require(_0x9293('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9293('0x6'));var rimraf=require(_0x9293('0x7'));var config=require(_0x9293('0x8'));var attributes=require(_0x9293('0x9'));module['exports']=function(_0x5bad68,_0x239a20){return _0x5bad68[_0x9293('0xa')](_0x9293('0xb'),attributes,{'tableName':_0x9293('0xc'),'paranoid':![],'indexes':[{'name':_0x9293('0xd'),'fields':[_0x9293('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index b77e2a5..21012ed 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(_0x244603,_0x17013a){var _0x2cdc51=function(_0x3a5a12){while(--_0x3a5a12){_0x244603['push'](_0x244603['shift']());}};_0x2cdc51(++_0x17013a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x1fd5d8,_0x3753b2){var _0xb219b7=function(_0x51ac7e){while(--_0x51ac7e){_0x1fd5d8['push'](_0x1fd5d8['shift']());}};_0xb219b7(++_0x3753b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 3dd39a1..ba6b0a5 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb59=['./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','status','None','./config/seedDB','default'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0xbb59,0xec));var _0x9bb5=function(_0x789ba3,_0x32d6cb){_0x789ba3=_0x789ba3-0x0;var _0x2a1692=_0xbb59[_0x789ba3];return _0x2a1692;};'use strict';var _=require(_0x9bb5('0x0'));var mysqldb=require(_0x9bb5('0x1'));var rpc=require(_0x9bb5('0x2'));var config=require('./config/environment');var logger=require('./config/logger')(_0x9bb5('0x3'));var pm2=require(_0x9bb5('0x4'));var pm2Config=require(_0x9bb5('0x5'));var schedule=require(_0x9bb5('0x6'));var chat=require(_0x9bb5('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x9bb5('0x8'));function main(){return mysqldb['db'][_0x9bb5('0x9')][_0x9bb5('0xa')]()[_0x9bb5('0xb')](function(){return rpc[_0x9bb5('0xc')]();})[_0x9bb5('0xb')](function(_0x2d6cce){logger[_0x9bb5('0xd')](_0x2d6cce);return chat[_0x9bb5('0xe')]();})[_0x9bb5('0xb')](function(){return whatsapp[_0x9bb5('0xe')]();})[_0x9bb5('0xb')](function(){return schedule[_0x9bb5('0xe')]();})['then'](function(){return transcribe[_0x9bb5('0xe')]();})[_0x9bb5('0xb')](function(_0x922d10){logger[_0x9bb5('0xd')](_0x922d10);return pm2[_0x9bb5('0xe')](pm2Config);})[_0x9bb5('0xb')](function(_0x12a08a){logger[_0x9bb5('0xd')](_0x9bb5('0xf'),_[_0x9bb5('0x10')](_[_0x9bb5('0x11')](_0x12a08a,{'status':_0x9bb5('0x12')}),_0x9bb5('0x13'))[_0x9bb5('0x14')]());logger['info']('Offline\x20apps:',_[_0x9bb5('0x10')](_['filter'](_0x12a08a,function(_0x535e73){return _0x535e73[_0x9bb5('0x15')]!=='online';}),_0x9bb5('0x13'))[_0x9bb5('0x14')]()||_0x9bb5('0x16'));config['seedDB']&&require(_0x9bb5('0x17'))[_0x9bb5('0x18')]();require(_0x9bb5('0x19'))[_0x9bb5('0x18')]();})[_0x9bb5('0x1a')](function(_0x19d1e9){logger[_0x9bb5('0x1b')](_0x9bb5('0x1c'),_0x19d1e9);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x5a13=['start','info','Online\x20apps:','filter','online','name','join','Offline\x20apps:','map','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen'];(function(_0x12e30b,_0x3e1299){var _0x42b836=function(_0x4563fa){while(--_0x4563fa){_0x12e30b['push'](_0x12e30b['shift']());}};_0x42b836(++_0x3e1299);}(_0x5a13,0x145));var _0x35a1=function(_0x1b38b8,_0x26038d){_0x1b38b8=_0x1b38b8-0x0;var _0x54017c=_0x5a13[_0x1b38b8];return _0x54017c;};'use strict';var _=require(_0x35a1('0x0'));var mysqldb=require(_0x35a1('0x1'));var rpc=require('./rpc');var config=require(_0x35a1('0x2'));var logger=require(_0x35a1('0x3'))(_0x35a1('0x4'));var pm2=require(_0x35a1('0x5'));var pm2Config=require(_0x35a1('0x6'));var schedule=require(_0x35a1('0x7'));var chat=require(_0x35a1('0x8'));var whatsapp=require(_0x35a1('0x9'));var transcribe=require(_0x35a1('0xa'));function main(){return mysqldb['db'][_0x35a1('0xb')][_0x35a1('0xc')]()[_0x35a1('0xd')](function(){return rpc[_0x35a1('0xe')]();})[_0x35a1('0xd')](function(_0x58afca){logger['info'](_0x58afca);return chat['start']();})[_0x35a1('0xd')](function(){return whatsapp[_0x35a1('0xf')]();})['then'](function(){return schedule[_0x35a1('0xf')]();})[_0x35a1('0xd')](function(){return transcribe['start']();})['then'](function(_0x3bcbdd){logger[_0x35a1('0x10')](_0x3bcbdd);return pm2['start'](pm2Config);})['then'](function(_0x25c630){logger['info'](_0x35a1('0x11'),_['map'](_[_0x35a1('0x12')](_0x25c630,{'status':_0x35a1('0x13')}),_0x35a1('0x14'))[_0x35a1('0x15')]());logger[_0x35a1('0x10')](_0x35a1('0x16'),_[_0x35a1('0x17')](_[_0x35a1('0x12')](_0x25c630,function(_0x1a2627){return _0x1a2627[_0x35a1('0x18')]!==_0x35a1('0x13');}),_0x35a1('0x14'))[_0x35a1('0x15')]()||_0x35a1('0x19'));config[_0x35a1('0x1a')]&&require(_0x35a1('0x1b'))[_0x35a1('0x1c')]();require(_0x35a1('0x1d'))[_0x35a1('0x1c')]();})[_0x35a1('0x1e')](function(_0x5e4317){logger[_0x35a1('0x1f')](_0x35a1('0x20'),_0x5e4317);process[_0x35a1('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 03d251b..2ceeaef 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 _0xedde=['It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','validatePasswordPattern','test','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~!@#$%^&-_=+[{]}.','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.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/hardware','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','userpic','permissions','md5secret','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','json','catch','headers','authorization','startsWith','Basic','User','then','Wrong\x20credentials.','Bearer','query','getUuid','apikey','find','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','isMiddleware','signToken','setTokenCookie'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedde,0x1f4));var _0xeedd=function(_0xde1fb9,_0x13adc7){_0xde1fb9=_0xde1fb9-0x0;var _0x215755=_0xedde[_0xde1fb9];return _0x215755;};'use strict';var db=require(_0xeedd('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xeedd('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xeedd('0x2'));var _=require(_0xeedd('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xeedd('0x4'));var compose=require(_0xeedd('0x5'));var basicAuth=require(_0xeedd('0x6'));var crypto=require(_0xeedd('0x7'));var BPromise=require(_0xeedd('0x8'));var util=require(_0xeedd('0x9'));var moment=require(_0xeedd('0xa'));var validateJwt=expressJwt({'secret':config[_0xeedd('0xb')][_0xeedd('0xc')]});var userAttributes=['id',_0xeedd('0xd'),_0xeedd('0xe'),_0xeedd('0xf'),_0xeedd('0x10'),'email',_0xeedd('0x11'),_0xeedd('0x12'),_0xeedd('0x13'),'voicePause',_0xeedd('0x14'),_0xeedd('0x15'),'faxPause',_0xeedd('0x16'),_0xeedd('0x17'),_0xeedd('0x18'),_0xeedd('0x19'),_0xeedd('0x1a'),_0xeedd('0x1b'),_0xeedd('0x1c'),_0xeedd('0x1d'),'passwordResetAt','alias',_0xeedd('0x1e'),_0xeedd('0x1f'),'phoneBarDnd',_0xeedd('0x20'),_0xeedd('0x21'),'phoneBarEnableSettings','phoneBarExpires',_0xeedd('0x22'),_0xeedd('0x23'),_0xeedd('0x24'),'hotdesk',_0xeedd('0x25'),_0xeedd('0x26'),_0xeedd('0x27')];exports['isChatInteractionAuthorized']=function(){return this[_0xeedd('0x28')](!![])[_0xeedd('0x29')](function(_0x5465a7,_0x174a22,_0x144c34){if(_0x5465a7[_0xeedd('0x2a')]){_0x144c34();}else{return db[_0xeedd('0x2b')][_0xeedd('0x2c')]({'where':{'id':_0x5465a7[_0xeedd('0x2d')]['id']},'attributes':['id',_0xeedd('0x2e'),_0xeedd('0x2f')],'raw':!![]})['then'](function(_0x9954df){if(_0x9954df&&_0x9954df[_0xeedd('0x2e')]){return _0x174a22[_0xeedd('0x30')](_0x9954df[_0xeedd('0x2f')]===_0xeedd('0x31')?0x195:0x193)[_0xeedd('0x32')]({'message':_0x9954df[_0xeedd('0x2f')]===_0xeedd('0x31')?'Unmanaged.':'Forbidden.'});}else{_0x144c34();}})[_0xeedd('0x33')](function(_0x3ecd90){_0x144c34(_0x3ecd90);});}});};exports[_0xeedd('0x28')]=function isAuthenticated(_0x2fd99c){return compose()['use'](function(_0x3f6965,_0x301019,_0x2c66b6){var _0x149b50;if(_0x3f6965[_0xeedd('0x34')][_0xeedd('0x35')]){if(_[_0xeedd('0x36')](_0x3f6965[_0xeedd('0x34')][_0xeedd('0x35')],_0xeedd('0x37'))){var _0x27ee9d=basicAuth(_0x3f6965);db[_0xeedd('0x38')]['find']({'where':{'name':_0x27ee9d[_0xeedd('0xf')]}})[_0xeedd('0x39')](function(_0x1b530a){if(!_0x1b530a||!_0x1b530a['authenticate'](_0x27ee9d['pass'])){return _0x301019['status'](0x191)['json']({'message':_0xeedd('0x3a')});}_0x3f6965[_0xeedd('0x2a')]={'id':_0x1b530a['id']};_0x2c66b6();})[_0xeedd('0x33')](function(_0x5b3ac9){_0x2c66b6(_0x5b3ac9);});}else if(_[_0xeedd('0x36')](_0x3f6965[_0xeedd('0x34')][_0xeedd('0x35')],_0xeedd('0x3b'))){validateJwt(_0x3f6965,_0x301019,_0x2c66b6);}else{if(_0x2fd99c){_0x2c66b6();}else{return _0x301019[_0xeedd('0x30')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3f6965[_0xeedd('0x3c')]['apikey']){try{var _0x5595f9={'audience':hardwareConf[_0xeedd('0x3d')](),'issuer':hardwareConf[_0xeedd('0x3d')]()};verifyJwt(_0x3f6965[_0xeedd('0x3c')][_0xeedd('0x3e')],_0x5595f9)[_0xeedd('0x39')](function(_0x29983f){return db[_0xeedd('0x38')][_0xeedd('0x3f')]({'where':{'id':_0x29983f[_0xeedd('0x40')]}})[_0xeedd('0x39')](function(_0x1825da){_0x149b50=_0x1825da;return db[_0xeedd('0x41')]['findOne']({'where':{'id':0x1},'attributes':[_0xeedd('0x42'),_0xeedd('0x43')],'raw':!![]});})[_0xeedd('0x39')](function(_0x145145){if(!_0x149b50||!_[_0xeedd('0x44')](_0x149b50[_0xeedd('0x45')],_0x29983f['nonce'])){return _0x301019[_0xeedd('0x30')](0x191)[_0xeedd('0x32')]({'message':_0xeedd('0x46')});}if(_0x149b50[_0xeedd('0x47')]){return _0x301019['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0x149b50[_0xeedd('0x48')]){if(_0x145145[_0xeedd('0x43')]>0x0){if(moment(_0x149b50[_0xeedd('0x49')])[_0xeedd('0x4a')](_0x145145[_0xeedd('0x43')],_0xeedd('0x4b'))>moment()){return _0x301019[_0xeedd('0x30')](0x191)[_0xeedd('0x32')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x301019['status'](0x191)[_0xeedd('0x32')]({'message':_0xeedd('0x4c')});}}_0x3f6965[_0xeedd('0x2a')]={'id':_0x149b50['id']};_0x2c66b6();});})['catch'](function(){return _0x301019[_0xeedd('0x30')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x46d6bd){_0x2c66b6(_0x46d6bd);}}else if(_0x2fd99c){_0x2c66b6();}else{return _0x301019[_0xeedd('0x30')](0x193)[_0xeedd('0x32')]({'message':_0xeedd('0x4d')});}})[_0xeedd('0x29')](function(_0x1d8d4b,_0x473d36,_0x161891){if(_0x1d8d4b[_0xeedd('0x2a')]){db[_0xeedd('0x38')][_0xeedd('0x3f')]({'where':{'id':_0x1d8d4b[_0xeedd('0x2a')]['id']},'attributes':userAttributes})[_0xeedd('0x39')](function(_0x8c9d4c){if(!_0x8c9d4c){return _0x473d36[_0xeedd('0x30')](0x194)[_0xeedd('0x32')]({'message':_0xeedd('0x4e')});}_0x1d8d4b[_0xeedd('0x2a')]=_0x8c9d4c;_0x161891();})[_0xeedd('0x33')](function(_0x5e788b){_0x161891(_0x5e788b);});}else if(_0x2fd99c){_0x161891();}else{return _0x473d36[_0xeedd('0x30')](0x194)[_0xeedd('0x32')]({'message':_0xeedd('0x4f')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xeedd('0x29')](function(_0x2687c6,_0x5a41b3,_0x126c56){return licenseUtil[_0xeedd('0x50')]()[_0xeedd('0x39')](function(_0x477553){if(_0x477553[_0xeedd('0x51')]){_0x126c56();}else{return _0x5a41b3[_0xeedd('0x30')](0x193)[_0xeedd('0x32')]({'message':'Forbidden'});}})['catch'](function(_0x529985){_0x126c56(_0x529985);});});};exports[_0xeedd('0x52')]=function(_0xd636de,_0x498010,_0x3b927a){_0xd636de[_0xeedd('0x52')]=!![];return _0x3b927a();};exports[_0xeedd('0x53')]=function signToken(_0x3b50ba){return signJwt(_0x3b50ba);};exports[_0xeedd('0x54')]=function(_0x54835f,_0x4ba8b9){if(!_0x54835f[_0xeedd('0x2a')]){return _0x4ba8b9[_0xeedd('0x30')](0x194)[_0xeedd('0x32')]({'message':_0xeedd('0x55')});}var _0x1e7db0={'payload':{'id':_0x54835f[_0xeedd('0x2a')]['id'],'role':_0x54835f[_0xeedd('0x2a')][_0xeedd('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1e7db0)[_0xeedd('0x39')](function(_0x49aefe){_0x4ba8b9[_0xeedd('0x56')]('motion.token',_0x49aefe);_0x4ba8b9['redirect'](_0xeedd('0x57'));})[_0xeedd('0x33')](function(_0x3f86c6){return _0x4ba8b9[_0xeedd('0x30')](0x1f4)[_0xeedd('0x58')](_0x3f86c6);});};exports['retrieveApiKey']=function(_0x2bbc55){if(_[_0xeedd('0x59')](_0x2bbc55['apiKeyNonce'])||_['isNil'](_0x2bbc55[_0xeedd('0x5a')])){return null;}else{return createJwt(_0x2bbc55);}};exports[_0xeedd('0x5b')]=function(_0x113cb3){_0x113cb3[_0xeedd('0x45')]=generateNonce();_0x113cb3[_0xeedd('0x5a')]=generateIssuedAt();return createJwt(_0x113cb3);};exports['regenerateApiKey']=function(_0x4e8a8c,_0x4b09d8){var _0x21f839=_0x4e8a8c[_0xeedd('0x3c')][_0xeedd('0x3e')];if(_0x21f839){var _0x580d09={'nonce':_0x4b09d8[_0xeedd('0x45')],'iat':_0x4b09d8[_0xeedd('0x5a')],'audience':hardwareConf[_0xeedd('0x3d')](),'issuer':hardwareConf[_0xeedd('0x3d')]()};return verifyJwt(_0x21f839,_0x580d09)['then'](function(){return generateApiKey(_0x4b09d8);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xeedd('0x5c')]=function(_0x1745ca){var _0x4da9f3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4da9f3[_0xeedd('0x5d')](_0x1745ca))throw new db[(_0xeedd('0x5e'))][(_0xeedd('0x5f'))](_0xeedd('0x60'));return;};exports[_0xeedd('0x61')]=function(_0xb8e19,_0x3bb5cc,_0x49e9ac){var _0x2034a6=encryptor[_0xeedd('0x62')](_0x3bb5cc)['split'](',');for(var _0x4a7e3b=0x0;_0x4a7e3b<_0x49e9ac;_0x4a7e3b++){if(!_0x2034a6[_0x4a7e3b])break;if(_0xb8e19[_0xeedd('0x63')]()===_0x2034a6[_0x4a7e3b]['toLowerCase']()){var _0x5dc101=util[_0xeedd('0x64')](_0xeedd('0x65'),_0x49e9ac);if(_0x49e9ac===0x1){_0x5dc101=_0xeedd('0x66');}throw new db[(_0xeedd('0x5e'))][(_0xeedd('0x5f'))](_0x5dc101);}}return;};exports[_0xeedd('0x67')]=function(_0xed30ca,_0xd478ce){var _0x133cd4=_0xd478ce?encryptor[_0xeedd('0x62')](_0xd478ce)['split'](','):[];if(_0x133cd4[_0xeedd('0x68')]===0x5){_0x133cd4['splice'](-0x1,0x1);}_0x133cd4[_0xeedd('0x69')](_0xed30ca);return encryptor[_0xeedd('0x6a')](_0x133cd4[_0xeedd('0x6b')](','));};function signJwt(_0x2493f6){var _0x3ffa1a=BPromise[_0xeedd('0x6c')](jwt[_0xeedd('0x6d')],{'context':jwt});var _0x33f70b=_0x2493f6[_0xeedd('0x6e')]||config['secrets'][_0xeedd('0xc')];return new BPromise(function(_0x35fa4c,_0xd7499f){_0x3ffa1a(_0x2493f6['payload'],_0x33f70b,_0x2493f6['options'])[_0xeedd('0x39')](function(_0x52c688){_0x35fa4c(_0x52c688);})[_0xeedd('0x33')](function(_0x563f7e){_0xd7499f(_0x563f7e);});});}function verifyJwt(_0x12fe98,_0x31c650,_0x4ad358){var _0x108e02=BPromise[_0xeedd('0x6c')](jwt['verify'],{'context':jwt});var _0x441c43=_0x4ad358||config['secrets'][_0xeedd('0xc')];return new BPromise(function(_0x1e3ae2,_0x3d6c71){_0x108e02(_0x12fe98,_0x441c43,_0x31c650)[_0xeedd('0x39')](function(_0x19a1fa){_0x1e3ae2(_0x19a1fa);})[_0xeedd('0x33')](function(_0x4a795e){_0x3d6c71(_0x4a795e);});});}function generateNonce(){return crypto[_0xeedd('0x6f')](0x10)[_0xeedd('0x70')](_0xeedd('0x71'));}function generateIssuedAt(){return Math[_0xeedd('0x72')](Date[_0xeedd('0x73')]()/0x3e8)['toString']();}function createJwt(_0x47ffab){var _0x5916b6={'payload':{'iat':_0x47ffab[_0xeedd('0x5a')],'nonce':_0x47ffab[_0xeedd('0x45')]},'options':{'algorithm':_0xeedd('0x74'),'subject':_0x47ffab['id'][_0xeedd('0x70')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xeedd('0x3d')]()}};return signJwt(_0x5916b6)['then'](function(_0x15bc80){return{'iat':_0x47ffab[_0xeedd('0x5a')],'nonce':_0x47ffab[_0xeedd('0x45')],'token':_0x15bc80};});} \ No newline at end of file +var _0x051e=['disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','authorization','headers','Basic','User','find','name','authenticate','status','Wrong\x20credentials.','startsWith','Bearer','apikey','getUuid','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','add','blockDuration','minutes','User\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','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~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','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.','updatePasswordsHistory','length','unshift','encryptString','join','promisify','sign','secret','secrets','payload','options','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','session','role','userpic','permissions','md5secret','chatPause','mailPause','smsPause','pauseType','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','isAuthenticated','use','user','ChatInteraction','findOne','params','closed'];(function(_0x11c030,_0x5c0b9b){var _0x1af76b=function(_0x5e83ce){while(--_0x5e83ce){_0x11c030['push'](_0x11c030['shift']());}};_0x1af76b(++_0x5c0b9b);}(_0x051e,0x1ad));var _0xe051=function(_0x54404f,_0x3d8e94){_0x54404f=_0x54404f-0x0;var _0x101638=_0x051e[_0x54404f];return _0x101638;};'use strict';var db=require(_0xe051('0x0'))['db'];var config=require(_0xe051('0x1'));var hardwareConf=require(_0xe051('0x2'));var licenseUtil=require(_0xe051('0x3'));var encryptor=require(_0xe051('0x4'));var _=require(_0xe051('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xe051('0x6'));var compose=require(_0xe051('0x7'));var basicAuth=require(_0xe051('0x8'));var crypto=require('crypto');var BPromise=require(_0xe051('0x9'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets'][_0xe051('0xa')]});var userAttributes=['id',_0xe051('0xb'),'fullname','name','internal','email',_0xe051('0xc'),_0xe051('0xd'),_0xe051('0xe'),'voicePause',_0xe051('0xf'),_0xe051('0x10'),'faxPause',_0xe051('0x11'),'openchannelPause',_0xe051('0x12'),'showWebBar',_0xe051('0x13'),'lastPauseAt','crudPermissions',_0xe051('0x14'),_0xe051('0x15'),_0xe051('0x16'),_0xe051('0x17'),'phoneBarAutoAnswerDelay',_0xe051('0x18'),_0xe051('0x19'),_0xe051('0x1a'),_0xe051('0x1b'),'phoneBarExpires','phoneBarPrefixRequired',_0xe051('0x1c'),_0xe051('0x1d'),'hotdesk',_0xe051('0x1e'),_0xe051('0x1f'),'settingsEnabled'];exports['isChatInteractionAuthorized']=function(){return this[_0xe051('0x20')](!![])[_0xe051('0x21')](function(_0x59cd46,_0x24a6e5,_0x5a6e9a){if(_0x59cd46[_0xe051('0x22')]){_0x5a6e9a();}else{return db[_0xe051('0x23')][_0xe051('0x24')]({'where':{'id':_0x59cd46[_0xe051('0x25')]['id']},'attributes':['id',_0xe051('0x26'),_0xe051('0x27')],'raw':!![]})[_0xe051('0x28')](function(_0x41a6e8){if(_0x41a6e8&&_0x41a6e8[_0xe051('0x26')]){return _0x24a6e5['status'](_0x41a6e8[_0xe051('0x27')]===_0xe051('0x29')?0x195:0x193)[_0xe051('0x2a')]({'message':_0x41a6e8[_0xe051('0x27')]===_0xe051('0x29')?_0xe051('0x2b'):_0xe051('0x2c')});}else{_0x5a6e9a();}})[_0xe051('0x2d')](function(_0x53435f){_0x5a6e9a(_0x53435f);});}});};exports['isAuthenticated']=function isAuthenticated(_0x1c17ca){return compose()['use'](function(_0x40583a,_0x573df6,_0x115566){var _0x4ec76e;if(_0x40583a['headers'][_0xe051('0x2e')]){if(_['startsWith'](_0x40583a[_0xe051('0x2f')]['authorization'],_0xe051('0x30'))){var _0x215426=basicAuth(_0x40583a);db[_0xe051('0x31')][_0xe051('0x32')]({'where':{'name':_0x215426[_0xe051('0x33')]}})[_0xe051('0x28')](function(_0x3eb167){if(!_0x3eb167||!_0x3eb167[_0xe051('0x34')](_0x215426['pass'])){return _0x573df6[_0xe051('0x35')](0x191)[_0xe051('0x2a')]({'message':_0xe051('0x36')});}_0x40583a[_0xe051('0x22')]={'id':_0x3eb167['id']};_0x115566();})['catch'](function(_0x467f09){_0x115566(_0x467f09);});}else if(_[_0xe051('0x37')](_0x40583a[_0xe051('0x2f')][_0xe051('0x2e')],_0xe051('0x38'))){validateJwt(_0x40583a,_0x573df6,_0x115566);}else{if(_0x1c17ca){_0x115566();}else{return _0x573df6['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x40583a['query'][_0xe051('0x39')]){try{var _0x15b235={'audience':hardwareConf[_0xe051('0x3a')](),'issuer':hardwareConf[_0xe051('0x3a')]()};verifyJwt(_0x40583a['query'][_0xe051('0x39')],_0x15b235)[_0xe051('0x28')](function(_0x40a3a4){return db['User'][_0xe051('0x32')]({'where':{'id':_0x40a3a4[_0xe051('0x3b')]}})[_0xe051('0x28')](function(_0x47437a){_0x4ec76e=_0x47437a;return db['Setting'][_0xe051('0x24')]({'where':{'id':0x1},'attributes':[_0xe051('0x3c'),'blockDuration'],'raw':!![]});})[_0xe051('0x28')](function(_0x49ff03){if(!_0x4ec76e||!_[_0xe051('0x3d')](_0x4ec76e[_0xe051('0x3e')],_0x40a3a4[_0xe051('0x3f')])){return _0x573df6['status'](0x191)[_0xe051('0x2a')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x4ec76e[_0xe051('0x40')]){return _0x573df6[_0xe051('0x35')](0x191)[_0xe051('0x2a')]({'message':_0xe051('0x41')});}if(_0x4ec76e[_0xe051('0x42')]){if(_0x49ff03['blockDuration']>0x0){if(moment(_0x4ec76e['blockedAt'])[_0xe051('0x43')](_0x49ff03[_0xe051('0x44')],_0xe051('0x45'))>moment()){return _0x573df6[_0xe051('0x35')](0x191)[_0xe051('0x2a')]({'message':_0xe051('0x41')});}}else{return _0x573df6[_0xe051('0x35')](0x191)['json']({'message':_0xe051('0x41')});}}_0x40583a[_0xe051('0x22')]={'id':_0x4ec76e['id']};_0x115566();});})['catch'](function(){return _0x573df6['status'](0x191)[_0xe051('0x2a')]({'message':_0xe051('0x41')});});}catch(_0x4a63fa){_0x115566(_0x4a63fa);}}else if(_0x1c17ca){_0x115566();}else{return _0x573df6[_0xe051('0x35')](0x193)[_0xe051('0x2a')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x192cb4,_0x12fabb,_0x2589d3){if(_0x192cb4[_0xe051('0x22')]){db['User']['find']({'where':{'id':_0x192cb4[_0xe051('0x22')]['id']},'attributes':userAttributes})[_0xe051('0x28')](function(_0x1c2789){if(!_0x1c2789){return _0x12fabb[_0xe051('0x35')](0x194)[_0xe051('0x2a')]({'message':_0xe051('0x46')});}_0x192cb4[_0xe051('0x22')]=_0x1c2789;_0x2589d3();})[_0xe051('0x2d')](function(_0x3e131e){_0x2589d3(_0x3e131e);});}else if(_0x1c17ca){_0x2589d3();}else{return _0x12fabb[_0xe051('0x35')](0x194)[_0xe051('0x2a')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xe051('0x47')]=function canUpdate(){return compose()['use'](function(_0x14cdc3,_0x1ce5bd,_0x48ed7c){return licenseUtil[_0xe051('0x48')]()[_0xe051('0x28')](function(_0x52c207){if(_0x52c207['update']){_0x48ed7c();}else{return _0x1ce5bd[_0xe051('0x35')](0x193)['json']({'message':_0xe051('0x49')});}})['catch'](function(_0x2aae47){_0x48ed7c(_0x2aae47);});});};exports[_0xe051('0x4a')]=function(_0x48b545,_0x34e090,_0x1f6726){_0x48b545[_0xe051('0x4a')]=!![];return _0x1f6726();};exports['signToken']=function signToken(_0x484ba5){return signJwt(_0x484ba5);};exports[_0xe051('0x4b')]=function(_0x8c4921,_0x57f28a){if(!_0x8c4921[_0xe051('0x22')]){return _0x57f28a[_0xe051('0x35')](0x194)[_0xe051('0x2a')]({'message':_0xe051('0x4c')});}var _0x336936={'payload':{'id':_0x8c4921[_0xe051('0x22')]['id'],'role':_0x8c4921['user'][_0xe051('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x336936)[_0xe051('0x28')](function(_0x3ab507){_0x57f28a[_0xe051('0x4d')](_0xe051('0x4e'),_0x3ab507);_0x57f28a[_0xe051('0x4f')](_0xe051('0x50'));})['catch'](function(_0x62fb29){return _0x57f28a[_0xe051('0x35')](0x1f4)[_0xe051('0x51')](_0x62fb29);});};exports[_0xe051('0x52')]=function(_0x3c0f07){if(_[_0xe051('0x53')](_0x3c0f07[_0xe051('0x3e')])||_[_0xe051('0x53')](_0x3c0f07[_0xe051('0x54')])){return null;}else{return createJwt(_0x3c0f07);}};exports[_0xe051('0x55')]=function(_0x20c871){_0x20c871[_0xe051('0x3e')]=generateNonce();_0x20c871[_0xe051('0x54')]=generateIssuedAt();return createJwt(_0x20c871);};exports[_0xe051('0x56')]=function(_0x555b68,_0x4c6d18){var _0xf3f9b6=_0x555b68[_0xe051('0x57')][_0xe051('0x39')];if(_0xf3f9b6){var _0x27e799={'nonce':_0x4c6d18[_0xe051('0x3e')],'iat':_0x4c6d18[_0xe051('0x54')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xe051('0x3a')]()};return verifyJwt(_0xf3f9b6,_0x27e799)['then'](function(){return generateApiKey(_0x4c6d18);});}else{throw{'message':_0xe051('0x58')};}};exports['validatePasswordPattern']=function(_0x5062f9){var _0x5eeaec=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5eeaec[_0xe051('0x59')](_0x5062f9))throw new db[(_0xe051('0x5a'))][(_0xe051('0x5b'))](_0xe051('0x5c'));return;};exports[_0xe051('0x5d')]=function(_0x404202,_0x4530a4,_0x33321b){var _0x6b3ce9=encryptor[_0xe051('0x5e')](_0x4530a4)[_0xe051('0x5f')](',');for(var _0x321f93=0x0;_0x321f93<_0x33321b;_0x321f93++){if(!_0x6b3ce9[_0x321f93])break;if(_0x404202['toLowerCase']()===_0x6b3ce9[_0x321f93][_0xe051('0x60')]()){var _0x5221ac=util[_0xe051('0x61')](_0xe051('0x62'),_0x33321b);if(_0x33321b===0x1){_0x5221ac=_0xe051('0x63');}throw new db[(_0xe051('0x5a'))][(_0xe051('0x5b'))](_0x5221ac);}}return;};exports[_0xe051('0x64')]=function(_0x18d06e,_0x2c9497){var _0x3a0029=_0x2c9497?encryptor[_0xe051('0x5e')](_0x2c9497)[_0xe051('0x5f')](','):[];if(_0x3a0029[_0xe051('0x65')]===0x5){_0x3a0029['splice'](-0x1,0x1);}_0x3a0029[_0xe051('0x66')](_0x18d06e);return encryptor[_0xe051('0x67')](_0x3a0029[_0xe051('0x68')](','));};function signJwt(_0x25b5ea){var _0x24578b=BPromise[_0xe051('0x69')](jwt[_0xe051('0x6a')],{'context':jwt});var _0x346f9d=_0x25b5ea[_0xe051('0x6b')]||config[_0xe051('0x6c')]['session'];return new BPromise(function(_0x33d325,_0x1e6d21){_0x24578b(_0x25b5ea[_0xe051('0x6d')],_0x346f9d,_0x25b5ea[_0xe051('0x6e')])['then'](function(_0x52570b){_0x33d325(_0x52570b);})[_0xe051('0x2d')](function(_0x328fc6){_0x1e6d21(_0x328fc6);});});}function verifyJwt(_0x3f0865,_0x56a888,_0x393b00){var _0x4eeb06=BPromise['promisify'](jwt[_0xe051('0x6f')],{'context':jwt});var _0x1b8683=_0x393b00||config['secrets'][_0xe051('0xa')];return new BPromise(function(_0x3a5f0e,_0x5ecde4){_0x4eeb06(_0x3f0865,_0x1b8683,_0x56a888)['then'](function(_0x170907){_0x3a5f0e(_0x170907);})[_0xe051('0x2d')](function(_0x30a9ef){_0x5ecde4(_0x30a9ef);});});}function generateNonce(){return crypto[_0xe051('0x70')](0x10)[_0xe051('0x71')](_0xe051('0x72'));}function generateIssuedAt(){return Math[_0xe051('0x73')](Date[_0xe051('0x74')]()/0x3e8)[_0xe051('0x71')]();}function createJwt(_0x5a2bb3){var _0x2c30de={'payload':{'iat':_0x5a2bb3[_0xe051('0x54')],'nonce':_0x5a2bb3[_0xe051('0x3e')]},'options':{'algorithm':'HS512','subject':_0x5a2bb3['id'][_0xe051('0x71')](),'issuer':hardwareConf[_0xe051('0x3a')](),'audience':hardwareConf[_0xe051('0x3a')]()}};return signJwt(_0x2c30de)[_0xe051('0x28')](function(_0x34928d){return{'iat':_0x5a2bb3[_0xe051('0x54')],'nonce':_0x5a2bb3[_0xe051('0x3e')],'token':_0x34928d};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 13ef372..40fab7e 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 _0xeda8=['final','close','unlink','decryptFile','createReadStream','createDecipher','algorithm','secret','utf8','base64','crypto','bluebird','secrets','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','end'];(function(_0x377f72,_0x2f4c12){var _0x14cdf8=function(_0x192297){while(--_0x192297){_0x377f72['push'](_0x377f72['shift']());}};_0x14cdf8(++_0x2f4c12);}(_0xeda8,0x104));var _0x8eda=function(_0x12cc31,_0x271427){_0x12cc31=_0x12cc31-0x0;var _0x21901d=_0xeda8[_0x12cc31];return _0x21901d;};'use strict';var crypto=require(_0x8eda('0x0'));var fs=require('fs');var BPromise=require(_0x8eda('0x1'));var config=require('../../config/environment');const stringOptions={'secret':config[_0x8eda('0x2')][_0x8eda('0x3')],'algorithm':_0x8eda('0x4')};const fileOptions={'algorithm':_0x8eda('0x5')};function combineOptions(_0x37ab2c){var _0x94b83f={};for(var _0x25b19a in fileOptions){if(fileOptions[_0x8eda('0x6')](_0x25b19a)){_0x94b83f[_0x25b19a]=fileOptions[_0x25b19a];}}if(_0x37ab2c){for(var _0x22dee9 in _0x37ab2c){if(_0x37ab2c[_0x8eda('0x6')](_0x22dee9)){_0x94b83f[_0x22dee9]=_0x37ab2c[_0x22dee9];}}}return _0x94b83f;}exports[_0x8eda('0x7')]=function(_0x32abe8,_0x4e2ebb,_0x28b721,_0x1b6a1d){return new BPromise(function(_0x5aa93d,_0x6b544f){_0x1b6a1d=combineOptions(_0x1b6a1d);var _0x4be9df=new Buffer(_0x28b721);var _0x4f7893=fs['createReadStream'](_0x32abe8);var _0x4fbf0a=fs[_0x8eda('0x8')](_0x4e2ebb);var _0x2d3739=crypto[_0x8eda('0x9')](_0x1b6a1d['algorithm'],_0x4be9df);_0x4f7893['on'](_0x8eda('0xa'),function(_0x5a80ca){var _0x3f34c=new Buffer(_0x2d3739[_0x8eda('0xb')](_0x5a80ca),_0x8eda('0xc'));_0x4fbf0a[_0x8eda('0xd')](_0x3f34c);});_0x4f7893['on'](_0x8eda('0xe'),function(){try{var _0x3af00c=new Buffer(_0x2d3739[_0x8eda('0xf')](_0x8eda('0xc')),'binary');_0x4fbf0a['write'](_0x3af00c);_0x4fbf0a[_0x8eda('0xe')]();_0x4fbf0a['on'](_0x8eda('0x10'),function(){return _0x5aa93d(_0x4e2ebb);});}catch(_0x4fa040){fs[_0x8eda('0x11')](_0x4e2ebb);return _0x6b544f(_0x4fa040);}});});};exports[_0x8eda('0x12')]=function(_0x123905,_0x56ff8a,_0x3f2925,_0x5594ad){return new BPromise(function(_0xf7d764,_0x553382){_0x5594ad=combineOptions(_0x5594ad);var _0x24aed4=new Buffer(_0x3f2925);var _0x58023b=fs[_0x8eda('0x13')](_0x123905);var _0x2a4d2b=fs['createWriteStream'](_0x56ff8a);var _0x5e44b7=crypto[_0x8eda('0x14')](_0x5594ad[_0x8eda('0x15')],_0x24aed4);_0x58023b['on'](_0x8eda('0xa'),function(_0x41abfa){var _0x110f36=new Buffer(_0x5e44b7[_0x8eda('0xb')](_0x41abfa),_0x8eda('0xc'));_0x2a4d2b[_0x8eda('0xd')](_0x110f36);});_0x58023b['on'](_0x8eda('0xe'),function(){try{var _0x232786=new Buffer(_0x5e44b7[_0x8eda('0xf')]('binary'),_0x8eda('0xc'));_0x2a4d2b['write'](_0x232786);_0x2a4d2b[_0x8eda('0xe')]();_0x2a4d2b['on']('close',function(){return _0xf7d764(_0x56ff8a);});}catch(_0x1033d6){fs[_0x8eda('0x11')](_0x56ff8a);return _0x553382(_0x1033d6);}});});};exports['encryptString']=function(_0x58e54b,_0x56dba4,_0x2a4c99){var _0x17cae8=_0x2a4c99||stringOptions['algorithm'];var _0x978502=_0x56dba4||stringOptions[_0x8eda('0x16')];var _0x54aa7f=crypto[_0x8eda('0x9')](_0x17cae8,_0x978502);var _0xfa57ca=_0x54aa7f[_0x8eda('0xb')](_0x58e54b,_0x8eda('0x17'),_0x8eda('0x18'));_0xfa57ca+=_0x54aa7f['final'](_0x8eda('0x18'));return _0xfa57ca;};exports['decryptString']=function(_0x35310c,_0x2e8b2b,_0x8337b4){var _0x567f69=_0x8337b4||stringOptions[_0x8eda('0x15')];var _0x244400=_0x2e8b2b||stringOptions[_0x8eda('0x16')];var _0x4cdd2e=crypto[_0x8eda('0x14')](_0x567f69,_0x244400);var _0x11a999=_0x4cdd2e['update'](_0x35310c,_0x8eda('0x18'),_0x8eda('0x17'));_0x11a999+=_0x4cdd2e[_0x8eda('0xf')](_0x8eda('0x17'));return _0x11a999;}; \ No newline at end of file +var _0xcd59=['unlink','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','../../config/environment','secrets','session','aes-256-ctr','hasOwnProperty','encryptFile','createReadStream','createWriteStream','algorithm','data','write','end','final','binary','close','createDecipher','update'];(function(_0x3a26a8,_0x56de00){var _0xa1eeaa=function(_0x1fc349){while(--_0x1fc349){_0x3a26a8['push'](_0x3a26a8['shift']());}};_0xa1eeaa(++_0x56de00);}(_0xcd59,0x14b));var _0x9cd5=function(_0x2f1a6e,_0x3082cb){_0x2f1a6e=_0x2f1a6e-0x0;var _0x5865e5=_0xcd59[_0x2f1a6e];return _0x5865e5;};'use strict';var crypto=require(_0x9cd5('0x0'));var fs=require('fs');var BPromise=require(_0x9cd5('0x1'));var config=require(_0x9cd5('0x2'));const stringOptions={'secret':config[_0x9cd5('0x3')][_0x9cd5('0x4')],'algorithm':_0x9cd5('0x5')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x2d392c){var _0x191236={};for(var _0xf96efa in fileOptions){if(fileOptions[_0x9cd5('0x6')](_0xf96efa)){_0x191236[_0xf96efa]=fileOptions[_0xf96efa];}}if(_0x2d392c){for(var _0x6acbef in _0x2d392c){if(_0x2d392c[_0x9cd5('0x6')](_0x6acbef)){_0x191236[_0x6acbef]=_0x2d392c[_0x6acbef];}}}return _0x191236;}exports[_0x9cd5('0x7')]=function(_0x2cd19a,_0x214256,_0x3f888f,_0x545407){return new BPromise(function(_0x10162d,_0x15e76c){_0x545407=combineOptions(_0x545407);var _0x37b97f=new Buffer(_0x3f888f);var _0x23e524=fs[_0x9cd5('0x8')](_0x2cd19a);var _0x4099d0=fs[_0x9cd5('0x9')](_0x214256);var _0x18d9bb=crypto['createCipher'](_0x545407[_0x9cd5('0xa')],_0x37b97f);_0x23e524['on'](_0x9cd5('0xb'),function(_0x3fefe6){var _0x38e0ee=new Buffer(_0x18d9bb['update'](_0x3fefe6),'binary');_0x4099d0[_0x9cd5('0xc')](_0x38e0ee);});_0x23e524['on'](_0x9cd5('0xd'),function(){try{var _0x44518d=new Buffer(_0x18d9bb[_0x9cd5('0xe')](_0x9cd5('0xf')),_0x9cd5('0xf'));_0x4099d0['write'](_0x44518d);_0x4099d0[_0x9cd5('0xd')]();_0x4099d0['on'](_0x9cd5('0x10'),function(){return _0x10162d(_0x214256);});}catch(_0x21d768){fs['unlink'](_0x214256);return _0x15e76c(_0x21d768);}});});};exports['decryptFile']=function(_0x5c4f3d,_0x258305,_0x1ea3f7,_0x565db7){return new BPromise(function(_0x24c233,_0x11a7d2){_0x565db7=combineOptions(_0x565db7);var _0xcfaaa0=new Buffer(_0x1ea3f7);var _0x57b986=fs[_0x9cd5('0x8')](_0x5c4f3d);var _0x2d1863=fs[_0x9cd5('0x9')](_0x258305);var _0x3a6f01=crypto[_0x9cd5('0x11')](_0x565db7[_0x9cd5('0xa')],_0xcfaaa0);_0x57b986['on']('data',function(_0x37ea13){var _0x18346f=new Buffer(_0x3a6f01[_0x9cd5('0x12')](_0x37ea13),_0x9cd5('0xf'));_0x2d1863[_0x9cd5('0xc')](_0x18346f);});_0x57b986['on']('end',function(){try{var _0x16c4e9=new Buffer(_0x3a6f01[_0x9cd5('0xe')](_0x9cd5('0xf')),_0x9cd5('0xf'));_0x2d1863[_0x9cd5('0xc')](_0x16c4e9);_0x2d1863[_0x9cd5('0xd')]();_0x2d1863['on'](_0x9cd5('0x10'),function(){return _0x24c233(_0x258305);});}catch(_0x2238ec){fs[_0x9cd5('0x13')](_0x258305);return _0x11a7d2(_0x2238ec);}});});};exports['encryptString']=function(_0x297f0e,_0xba8ee9,_0x1a88e3){var _0x43f47d=_0x1a88e3||stringOptions['algorithm'];var _0x24ae67=_0xba8ee9||stringOptions[_0x9cd5('0x14')];var _0x211576=crypto[_0x9cd5('0x15')](_0x43f47d,_0x24ae67);var _0x297776=_0x211576[_0x9cd5('0x12')](_0x297f0e,_0x9cd5('0x16'),'base64');_0x297776+=_0x211576[_0x9cd5('0xe')](_0x9cd5('0x17'));return _0x297776;};exports[_0x9cd5('0x18')]=function(_0x4af6c8,_0x5c33e9,_0x2e45a3){var _0x502257=_0x2e45a3||stringOptions['algorithm'];var _0x1ab8d6=_0x5c33e9||stringOptions[_0x9cd5('0x14')];var _0x13e0d3=crypto['createDecipher'](_0x502257,_0x1ab8d6);var _0x40461a=_0x13e0d3[_0x9cd5('0x12')](_0x4af6c8,_0x9cd5('0x17'),_0x9cd5('0x16'));_0x40461a+=_0x13e0d3[_0x9cd5('0xe')](_0x9cd5('0x16'));return _0x40461a;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index b9c69b8..1388f8a 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 _0x0a9a=['num','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','.csv','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV','Setting','split','then','splitSizeCsv','sequelize','query','format','QueryTypes','SELECT'];(function(_0x13a11b,_0x5361b4){var _0xe65d31=function(_0x5f2a91){while(--_0x5f2a91){_0x13a11b['push'](_0x13a11b['shift']());}};_0xe65d31(++_0x5361b4);}(_0x0a9a,0x183));var _0xa0a9=function(_0x59646e,_0x4f9a03){_0x59646e=_0x59646e-0x0;var _0x424357=_0x0a9a[_0x59646e];return _0x424357;};'use strict';var util=require('util');var path=require(_0xa0a9('0x0'));var _=require('lodash');var csv=require(_0xa0a9('0x1'));var fs=require('fs');var BPromise=require(_0xa0a9('0x2'));var zipdir=require(_0xa0a9('0x3'));var rimraf=require(_0xa0a9('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xa0a9('0x5'))[_0xa0a9('0x6')];var logger=require('../../config/logger')(_0xa0a9('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xa0a9('0x8')][0x2]);var QUERY=process[_0xa0a9('0x8')][0x3];var PATH=process[_0xa0a9('0x8')][0x4];function analyticExtractedReport(_0x499a29,_0x2b2eb4){var _0x520f42={'status':_0x499a29};var _0x10aa8a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b2eb4){_0x520f42[_0xa0a9('0x9')]=_0x2b2eb4;}return db[_0xa0a9('0xa')][_0xa0a9('0xb')](_0x520f42,_0x10aa8a);}function main(){var _0x4b9b93=0x1388;var _0x2ba0ac;logger[_0xa0a9('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa0a9('0xd')));return db[_0xa0a9('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa0a9('0xf'),'splitSizeCsv']})[_0xa0a9('0x10')](function(_0x4b7913){if(_0x4b7913){_0x2ba0ac=_0x4b7913;_0x4b9b93=_0x2ba0ac[_0xa0a9('0x11')]||0x1388;}})[_0xa0a9('0x10')](function(){return dbH[_0xa0a9('0x12')][_0xa0a9('0x13')](util[_0xa0a9('0x14')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xa0a9('0x12')][_0xa0a9('0x15')][_0xa0a9('0x16')]});})[_0xa0a9('0x10')](function(_0x2f8b3c){if(!_0x2f8b3c[0x0][_0xa0a9('0x17')]){return analyticExtractedReport('Empty');}var _0x176faa=[];var _0x48c315=0x0;var _0x4a57dd=!![];if(_0x2f8b3c&&_0x2f8b3c[_0xa0a9('0x18')]){var _0x9f5abd=_0x2f8b3c[0x0][_0xa0a9('0x17')]%(_0x48c315+_0x4b9b93);if(_0x2ba0ac[_0xa0a9('0xf')]){for(;_0x4a57dd;_0x48c315+=_0x4b9b93,_0x9f5abd=_0x2f8b3c[0x0]['num']%(_0x48c315+_0x4b9b93)){if(_0x9f5abd==0x0||_0x9f5abd==_0x2f8b3c[0x0][_0xa0a9('0x17')]){_0x4a57dd=![];}_0x176faa[_0xa0a9('0x19')](dbH[_0xa0a9('0x12')][_0xa0a9('0x13')](util[_0xa0a9('0x14')](_0xa0a9('0x1a'),QUERY,_0x4b9b93,_0x48c315),{'type':dbH['sequelize'][_0xa0a9('0x15')][_0xa0a9('0x16')]}));}}else{_0x176faa['push'](dbH['sequelize'][_0xa0a9('0x13')](QUERY,{'type':dbH[_0xa0a9('0x12')][_0xa0a9('0x15')]['SELECT']}));}}var _0x307d7e=path['dirname'](PATH);var _0x1fb36b=path['basename'](PATH,_0xa0a9('0x1b'));var _0x504786=_0x2ba0ac[_0xa0a9('0xf')]&&_0x176faa[_0xa0a9('0x18')]>0x1;var _0x4938da=[];if(!fs[_0xa0a9('0x1c')](path['join'](_0x307d7e,_0x1fb36b))&&_0x504786){fs[_0xa0a9('0x1d')](path[_0xa0a9('0x1e')](_0x307d7e,_0x1fb36b));}return BPromise[_0xa0a9('0x1f')](_0x176faa,function(_0x252a14){_0x4938da['push'](_0x252a14);})[_0xa0a9('0x10')](function(){for(var _0xe49d3b=0x0;_0xe49d3b<_0x4938da[_0xa0a9('0x18')];_0xe49d3b+=0x1){var _0x3f4bea;var _0x526dd1=_0x4938da[_0xe49d3b];if(_0x504786){_0x3f4bea=path[_0xa0a9('0x1e')](_0x307d7e,_0x1fb36b,util[_0xa0a9('0x14')](_0xa0a9('0x20'),_0x1fb36b,_0xe49d3b,'csv'));}else{_0x3f4bea=path['join'](_0x307d7e,util[_0xa0a9('0x14')](_0xa0a9('0x21'),_0x1fb36b,_0xa0a9('0x22')));}fs[_0xa0a9('0x23')](_0x3f4bea,csv(_0x526dd1));}})[_0xa0a9('0x10')](function(){if(_0x504786){zipdir(path[_0xa0a9('0x1e')](_0x307d7e,_0x1fb36b),{'saveTo':path[_0xa0a9('0x1e')](_0x307d7e,util[_0xa0a9('0x14')](_0xa0a9('0x21'),_0x1fb36b,_0xa0a9('0x24')))},function(_0x41e994,_0x554191){});rimraf(path[_0xa0a9('0x1e')](_0x307d7e,_0x1fb36b),function(){});}})[_0xa0a9('0x10')](function(){logger['info'](util[_0xa0a9('0x14')](_0xa0a9('0x25'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x504786?util[_0xa0a9('0x14')]('%s.%s',_0x1fb36b,_0x504786?'zip':_0xa0a9('0x22')):null);});})[_0xa0a9('0x26')](function(_0x347cbf){logger[_0xa0a9('0xc')](util[_0xa0a9('0x14')](_0xa0a9('0x27'),EXTRACTED_REPORT_ID,_0xa0a9('0xd')),util['inspect'](_0x347cbf,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xa0a9('0x28'));});}main(); \ No newline at end of file +var _0xb43b=['basename','.csv','existsSync','join','length','%s%d.%s','csv','%s.%s','writeFileSync','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','QueryTypes','num','Empty','split','push','query','SELECT','dirname'];(function(_0x52056f,_0x12f6c1){var _0x33ece8=function(_0x4792e7){while(--_0x4792e7){_0x52056f['push'](_0x52056f['shift']());}};_0x33ece8(++_0x12f6c1);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3dd9bc,_0xaea02a){_0x3dd9bc=_0x3dd9bc-0x0;var _0x19ee67=_0xb43b[_0x3dd9bc];return _0x19ee67;};'use strict';var util=require(_0xbb43('0x0'));var path=require(_0xbb43('0x1'));var _=require('lodash');var csv=require(_0xbb43('0x2'));var fs=require('fs');var BPromise=require(_0xbb43('0x3'));var zipdir=require(_0xbb43('0x4'));var rimraf=require('rimraf');var db=require(_0xbb43('0x5'))['db'];var dbH=require(_0xbb43('0x5'))[_0xbb43('0x6')];var logger=require(_0xbb43('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xbb43('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x80fe61,_0x1ccd49){var _0x2a2f11={'status':_0x80fe61};var _0x29ae1a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1ccd49){_0x2a2f11[_0xbb43('0x9')]=_0x1ccd49;}return db['AnalyticExtractedReport'][_0xbb43('0xa')](_0x2a2f11,_0x29ae1a);}function main(){var _0xf54ac5=0x1388;var _0x5d5b11;logger[_0xbb43('0xb')](util[_0xbb43('0xc')](_0xbb43('0xd'),EXTRACTED_REPORT_ID,_0xbb43('0xe')));return db[_0xbb43('0xf')][_0xbb43('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xbb43('0x11')]})[_0xbb43('0x12')](function(_0x50e2c0){if(_0x50e2c0){_0x5d5b11=_0x50e2c0;_0xf54ac5=_0x5d5b11['splitSizeCsv']||0x1388;}})[_0xbb43('0x12')](function(){return dbH['sequelize']['query'](util[_0xbb43('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xbb43('0x13')][_0xbb43('0x14')]['SELECT']});})['then'](function(_0x4d5bcf){if(!_0x4d5bcf[0x0][_0xbb43('0x15')]){return analyticExtractedReport(_0xbb43('0x16'));}var _0x57bd1d=[];var _0x526330=0x0;var _0x202980=!![];if(_0x4d5bcf&&_0x4d5bcf['length']){var _0x5923dc=_0x4d5bcf[0x0][_0xbb43('0x15')]%(_0x526330+_0xf54ac5);if(_0x5d5b11[_0xbb43('0x17')]){for(;_0x202980;_0x526330+=_0xf54ac5,_0x5923dc=_0x4d5bcf[0x0][_0xbb43('0x15')]%(_0x526330+_0xf54ac5)){if(_0x5923dc==0x0||_0x5923dc==_0x4d5bcf[0x0]['num']){_0x202980=![];}_0x57bd1d[_0xbb43('0x18')](dbH['sequelize'][_0xbb43('0x19')](util[_0xbb43('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xf54ac5,_0x526330),{'type':dbH['sequelize'][_0xbb43('0x14')][_0xbb43('0x1a')]}));}}else{_0x57bd1d[_0xbb43('0x18')](dbH[_0xbb43('0x13')]['query'](QUERY,{'type':dbH[_0xbb43('0x13')]['QueryTypes'][_0xbb43('0x1a')]}));}}var _0x4bfaca=path[_0xbb43('0x1b')](PATH);var _0x565256=path[_0xbb43('0x1c')](PATH,_0xbb43('0x1d'));var _0x577ddd=_0x5d5b11[_0xbb43('0x17')]&&_0x57bd1d['length']>0x1;var _0xf24e60=[];if(!fs[_0xbb43('0x1e')](path[_0xbb43('0x1f')](_0x4bfaca,_0x565256))&&_0x577ddd){fs['mkdirSync'](path['join'](_0x4bfaca,_0x565256));}return BPromise['each'](_0x57bd1d,function(_0x269ca5){_0xf24e60[_0xbb43('0x18')](_0x269ca5);})['then'](function(){for(var _0x3b3083=0x0;_0x3b3083<_0xf24e60[_0xbb43('0x20')];_0x3b3083+=0x1){var _0x226827;var _0x3874fb=_0xf24e60[_0x3b3083];if(_0x577ddd){_0x226827=path['join'](_0x4bfaca,_0x565256,util['format'](_0xbb43('0x21'),_0x565256,_0x3b3083,_0xbb43('0x22')));}else{_0x226827=path[_0xbb43('0x1f')](_0x4bfaca,util[_0xbb43('0xc')](_0xbb43('0x23'),_0x565256,_0xbb43('0x22')));}fs[_0xbb43('0x24')](_0x226827,csv(_0x3874fb));}})[_0xbb43('0x12')](function(){if(_0x577ddd){zipdir(path['join'](_0x4bfaca,_0x565256),{'saveTo':path[_0xbb43('0x1f')](_0x4bfaca,util['format'](_0xbb43('0x23'),_0x565256,_0xbb43('0x25')))},function(_0x34f5b2,_0x1880cd){});rimraf(path['join'](_0x4bfaca,_0x565256),function(){});}})[_0xbb43('0x12')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xbb43('0xe')));return analyticExtractedReport('Completed',_0x577ddd?util[_0xbb43('0xc')](_0xbb43('0x23'),_0x565256,_0x577ddd?_0xbb43('0x25'):'csv'):null);});})[_0xbb43('0x26')](function(_0x1bdf91){logger[_0xbb43('0xb')](util[_0xbb43('0xc')](_0xbb43('0x27'),EXTRACTED_REPORT_ID,_0xbb43('0xe')),util[_0xbb43('0x28')](_0x1bdf91,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb43('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 90b6de7..f95cfd3 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 _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(_0x47780a,_0x1a1687){var _0x27d100=function(_0x3245f4){while(--_0x3245f4){_0x47780a['push'](_0x47780a['shift']());}};_0x27d100(++_0x1a1687);}(_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 +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(_0x1c5f63,_0x4acfbd){var _0x5b389d=function(_0x2789c5){while(--_0x2789c5){_0x1c5f63['push'](_0x1c5f63['shift']());}};_0x5b389d(++_0x4acfbd);}(_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 96ab7db..7f961c2 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 _0x09cb=['each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','Failed','util','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','length','existsSync','join'];(function(_0x503b6a,_0x1f608f){var _0x45201c=function(_0x2991c8){while(--_0x2991c8){_0x503b6a['push'](_0x503b6a['shift']());}};_0x45201c(++_0x1f608f);}(_0x09cb,0xdd));var _0xb09c=function(_0x993440,_0x59ba70){_0x993440=_0x993440-0x0;var _0x236538=_0x09cb[_0x993440];return _0x236538;};'use strict';var util=require(_0xb09c('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0xb09c('0x1'));var BPromise=require(_0xb09c('0x2'));var zipdir=require(_0xb09c('0x3'));var rimraf=require(_0xb09c('0x4'));var db=require(_0xb09c('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0xb09c('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xb09c('0x7')][0x3];var PATH=process[_0xb09c('0x7')][0x4];function analyticExtractedReport(_0x551229,_0x5770f0){var _0x4eb509={'status':_0x551229};var _0x490a92={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5770f0){_0x4eb509['savename']=_0x5770f0;}return db[_0xb09c('0x8')][_0xb09c('0x9')](_0x4eb509,_0x490a92);}function main(){var _0x338367=0x1388;var _0x1b5057;logger[_0xb09c('0xa')](util[_0xb09c('0xb')](_0xb09c('0xc'),EXTRACTED_REPORT_ID,_0xb09c('0xd')));return db['Setting'][_0xb09c('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb09c('0xf'),'splitSizeXlsx']})['then'](function(_0x2905b8){if(_0x2905b8){_0x1b5057=_0x2905b8;_0x338367=_0x1b5057[_0xb09c('0x10')]||0x1388;}})[_0xb09c('0x11')](function(){return dbH[_0xb09c('0x12')]['query'](util[_0xb09c('0xb')](_0xb09c('0x13'),QUERY),{'type':dbH[_0xb09c('0x12')]['QueryTypes'][_0xb09c('0x14')]});})[_0xb09c('0x11')](function(_0x5b703c){if(!_0x5b703c[0x0][_0xb09c('0x15')]){return analyticExtractedReport(_0xb09c('0x16'));}var _0x66c42e=[];var _0x2a2a89=0x0;var _0xaf277c=!![];if(_0x1b5057[_0xb09c('0xf')]){if(_0x5b703c&&_0x5b703c['length']){var _0xfee704=_0x5b703c[0x0]['num']%(_0x2a2a89+_0x338367);for(;_0xaf277c;_0x2a2a89+=_0x338367,_0xfee704=_0x5b703c[0x0][_0xb09c('0x15')]%(_0x2a2a89+_0x338367)){if(_0xfee704==0x0||_0xfee704==_0x5b703c[0x0][_0xb09c('0x15')]){_0xaf277c=![];}_0x66c42e[_0xb09c('0x17')](dbH[_0xb09c('0x12')][_0xb09c('0x18')](util['format'](_0xb09c('0x19'),QUERY,_0x338367,_0x2a2a89),{'type':dbH[_0xb09c('0x12')]['QueryTypes'][_0xb09c('0x14')]}));}}}else{_0x66c42e[_0xb09c('0x17')](dbH['sequelize'][_0xb09c('0x18')](QUERY,{'type':dbH[_0xb09c('0x12')]['QueryTypes'][_0xb09c('0x14')]}));}var _0x3d8fae=path['dirname'](PATH);var _0x1ca864=path[_0xb09c('0x1a')](PATH,_0xb09c('0x1b'));var _0x37f42e=_0x1b5057['split']&&_0x66c42e[_0xb09c('0x1c')]>0x1;var _0x1330c0=[];if(!fs[_0xb09c('0x1d')](path['join'](_0x3d8fae,_0x1ca864))&&_0x37f42e){fs['mkdirSync'](path[_0xb09c('0x1e')](_0x3d8fae,_0x1ca864));}return BPromise[_0xb09c('0x1f')](_0x66c42e,function(_0x5aa199){_0x1330c0['push'](_0x5aa199);})[_0xb09c('0x11')](function(){for(var _0x4701cb=0x0;_0x4701cb<_0x1330c0[_0xb09c('0x1c')];_0x4701cb+=0x1){var _0x9a0fe3;var _0x2d62f5=_0x1330c0[_0x4701cb];if(_0x37f42e){_0x9a0fe3=path['join'](_0x3d8fae,_0x1ca864,util[_0xb09c('0xb')](_0xb09c('0x20'),_0x1ca864,_0x4701cb,_0xb09c('0x21')));}else{_0x9a0fe3=path[_0xb09c('0x1e')](_0x3d8fae,util[_0xb09c('0xb')](_0xb09c('0x22'),_0x1ca864,'xlsx'));}fs[_0xb09c('0x23')](_0x9a0fe3,json2xls(_0x2d62f5),_0xb09c('0x24'));}})['then'](function(){if(_0x37f42e){zipdir(path[_0xb09c('0x1e')](_0x3d8fae,_0x1ca864),{'saveTo':path[_0xb09c('0x1e')](_0x3d8fae,util['format'](_0xb09c('0x22'),_0x1ca864,_0xb09c('0x25')))},function(_0x127ba7,_0x3eeeb6){});rimraf(path[_0xb09c('0x1e')](_0x3d8fae,_0x1ca864),function(){});}})[_0xb09c('0x11')](function(){logger['info'](util[_0xb09c('0xb')](_0xb09c('0x26'),EXTRACTED_REPORT_ID,_0xb09c('0xd')));return analyticExtractedReport(_0xb09c('0x27'),_0x37f42e?util['format'](_0xb09c('0x22'),_0x1ca864,_0x37f42e?'zip':_0xb09c('0x21')):null);});})['catch'](function(_0x36e5c6){logger[_0xb09c('0xa')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb09c('0xd')),util[_0xb09c('0x28')](_0x36e5c6,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xb09c('0x29'));});}main(); \ No newline at end of file +var _0x0e56=['info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','length','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','query','dirname','basename','.xlsx','join','each','xlsx','%s.%s','writeFileSync','zip','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update'];(function(_0x552081,_0x316aac){var _0x367f47=function(_0x2dc479){while(--_0x2dc479){_0x552081['push'](_0x552081['shift']());}};_0x367f47(++_0x316aac);}(_0x0e56,0xf5));var _0x60e5=function(_0x49c957,_0x3509d8){_0x49c957=_0x49c957-0x0;var _0x5b1d38=_0x0e56[_0x49c957];return _0x5b1d38;};'use strict';var util=require(_0x60e5('0x0'));var path=require(_0x60e5('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x60e5('0x2'));var BPromise=require(_0x60e5('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x60e5('0x4'));var db=require(_0x60e5('0x5'))['db'];var dbH=require(_0x60e5('0x5'))[_0x60e5('0x6')];var logger=require(_0x60e5('0x7'))(_0x60e5('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x60e5('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x60e5('0x9')][0x4];function analyticExtractedReport(_0x5513f2,_0x31765c){var _0x3083a0={'status':_0x5513f2};var _0x59389e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x31765c){_0x3083a0[_0x60e5('0xa')]=_0x31765c;}return db[_0x60e5('0xb')][_0x60e5('0xc')](_0x3083a0,_0x59389e);}function main(){var _0x2cebba=0x1388;var _0xcd22d5;logger[_0x60e5('0xd')](util[_0x60e5('0xe')](_0x60e5('0xf'),EXTRACTED_REPORT_ID,_0x60e5('0x10')));return db[_0x60e5('0x11')][_0x60e5('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x60e5('0x13'),_0x60e5('0x14')]})[_0x60e5('0x15')](function(_0x8338f8){if(_0x8338f8){_0xcd22d5=_0x8338f8;_0x2cebba=_0xcd22d5[_0x60e5('0x14')]||0x1388;}})['then'](function(){return dbH[_0x60e5('0x16')]['query'](util['format'](_0x60e5('0x17'),QUERY),{'type':dbH[_0x60e5('0x16')]['QueryTypes'][_0x60e5('0x18')]});})[_0x60e5('0x15')](function(_0x426620){if(!_0x426620[0x0][_0x60e5('0x19')]){return analyticExtractedReport('Empty');}var _0x23a88e=[];var _0x622ead=0x0;var _0x3fbc43=!![];if(_0xcd22d5[_0x60e5('0x13')]){if(_0x426620&&_0x426620[_0x60e5('0x1a')]){var _0x1df84a=_0x426620[0x0][_0x60e5('0x19')]%(_0x622ead+_0x2cebba);for(;_0x3fbc43;_0x622ead+=_0x2cebba,_0x1df84a=_0x426620[0x0][_0x60e5('0x19')]%(_0x622ead+_0x2cebba)){if(_0x1df84a==0x0||_0x1df84a==_0x426620[0x0][_0x60e5('0x19')]){_0x3fbc43=![];}_0x23a88e['push'](dbH['sequelize']['query'](util['format'](_0x60e5('0x1b'),QUERY,_0x2cebba,_0x622ead),{'type':dbH[_0x60e5('0x16')][_0x60e5('0x1c')]['SELECT']}));}}}else{_0x23a88e[_0x60e5('0x1d')](dbH[_0x60e5('0x16')][_0x60e5('0x1e')](QUERY,{'type':dbH[_0x60e5('0x16')][_0x60e5('0x1c')][_0x60e5('0x18')]}));}var _0x26829e=path[_0x60e5('0x1f')](PATH);var _0x443665=path[_0x60e5('0x20')](PATH,_0x60e5('0x21'));var _0x5ecd6a=_0xcd22d5['split']&&_0x23a88e[_0x60e5('0x1a')]>0x1;var _0x518741=[];if(!fs['existsSync'](path[_0x60e5('0x22')](_0x26829e,_0x443665))&&_0x5ecd6a){fs['mkdirSync'](path[_0x60e5('0x22')](_0x26829e,_0x443665));}return BPromise[_0x60e5('0x23')](_0x23a88e,function(_0x476d0a){_0x518741[_0x60e5('0x1d')](_0x476d0a);})[_0x60e5('0x15')](function(){for(var _0x59e702=0x0;_0x59e702<_0x518741[_0x60e5('0x1a')];_0x59e702+=0x1){var _0x4fdcda;var _0xd13043=_0x518741[_0x59e702];if(_0x5ecd6a){_0x4fdcda=path[_0x60e5('0x22')](_0x26829e,_0x443665,util[_0x60e5('0xe')]('%s%d.%s',_0x443665,_0x59e702,_0x60e5('0x24')));}else{_0x4fdcda=path[_0x60e5('0x22')](_0x26829e,util['format'](_0x60e5('0x25'),_0x443665,_0x60e5('0x24')));}fs[_0x60e5('0x26')](_0x4fdcda,json2xls(_0xd13043),'binary');}})[_0x60e5('0x15')](function(){if(_0x5ecd6a){zipdir(path[_0x60e5('0x22')](_0x26829e,_0x443665),{'saveTo':path[_0x60e5('0x22')](_0x26829e,util[_0x60e5('0xe')](_0x60e5('0x25'),_0x443665,_0x60e5('0x27')))},function(_0x311485,_0x22116d){});rimraf(path[_0x60e5('0x22')](_0x26829e,_0x443665),function(){});}})[_0x60e5('0x15')](function(){logger[_0x60e5('0xd')](util[_0x60e5('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x60e5('0x10')));return analyticExtractedReport(_0x60e5('0x28'),_0x5ecd6a?util[_0x60e5('0xe')](_0x60e5('0x25'),_0x443665,_0x5ecd6a?'zip':'xlsx'):null);});})['catch'](function(_0x1663b4){logger[_0x60e5('0xd')](util[_0x60e5('0xe')](_0x60e5('0x29'),EXTRACTED_REPORT_ID,_0x60e5('0x10')),util['inspect'](_0x1663b4,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x60e5('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 302dded..18c12b2 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 _0xef91=['XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','interval','*,*,*,*','intervals','tag','length','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)','indexOf','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','bulkCreate','catch','error','rewrite','lodash','util','findAll','then','models','IntervalId','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','extensions','extension','find','push','type','Set','format','context','priority','VoiceExtensionId','outbound','CDR(destination)=','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav'];(function(_0x367785,_0x590316){var _0x3ff37f=function(_0x35d21e){while(--_0x35d21e){_0x367785['push'](_0x367785['shift']());}};_0x3ff37f(++_0x590316);}(_0xef91,0x1a1));var _0x1ef9=function(_0x479f47,_0x3d619a){_0x479f47=_0x479f47-0x0;var _0xc3fac2=_0xef91[_0x479f47];return _0xc3fac2;};'use strict';var _=require(_0x1ef9('0x0'));var util=require(_0x1ef9('0x1'));function rewrite(_0x6bcdf9,_0x715ee9){var _0x632f70=this;return _0x6bcdf9['models']['Interval'][_0x1ef9('0x2')]({'raw':!![]})[_0x1ef9('0x3')](function(_0xb1e825){_0x632f70['intervals']=_0xb1e825;return _0x6bcdf9[_0x1ef9('0x4')]['VoiceExtension'][_0x1ef9('0x2')]({'where':{'IntervalId':_0x715ee9[_0x1ef9('0x5')]},'raw':!![]});})[_0x1ef9('0x3')](function(_0xb4de7a){return _0x6bcdf9[_0x1ef9('0x4')][_0x1ef9('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x1ef9('0x7')](_0xb4de7a,_0x1ef9('0x8')))}},'order':[{'raw':_0x1ef9('0x9')}],'raw':!![]});})[_0x1ef9('0x3')](function(_0x245f44){var _0x368eb5=_[_0x1ef9('0xa')](_0x245f44,{'priority':'1'});var _0x4503d3=_[_0x1ef9('0xa')](_0x245f44,{'isApp':0x1});var _0x312301=_['groupBy'](_0x4503d3,_0x1ef9('0x8'));var _0x301e09=[_0x1ef9('0xb'),_0x1ef9('0xc')];var _0x4b9a08=[];var _0x114527=[];for(var _0x135bd5 in _0x312301){if(_0x312301[_0x1ef9('0xd')](_0x135bd5)){_0x632f70['priority']=0x2;_0x632f70[_0x1ef9('0xe')]=[];_0x632f70[_0x1ef9('0xf')]=_[_0x1ef9('0x10')](_0x368eb5,{'exten':_0x312301[_0x135bd5][0x0][_0x1ef9('0x8')]});_0x632f70['extensions'][_0x1ef9('0x11')]({'type':_0x312301[_0x135bd5][0x0][_0x1ef9('0x12')],'app':_0x1ef9('0x13'),'appdata':util[_0x1ef9('0x14')]('CDR(type)=%s',_0x312301[_0x135bd5][0x0]['type']),'context':_0x312301[_0x135bd5][0x0][_0x1ef9('0x15')],'exten':_0x312301[_0x135bd5][0x0][_0x1ef9('0x8')],'priority':_0x632f70[_0x1ef9('0x16')]++,'VoiceExtensionId':_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')]});if(_0x312301[_0x135bd5][0x0][_0x1ef9('0x12')]===_0x1ef9('0x18')){if(_0x632f70['extension']){_0x632f70[_0x1ef9('0xe')][_0x1ef9('0x11')]({'type':_0x312301[_0x135bd5][0x0][_0x1ef9('0x12')],'app':_0x1ef9('0x13'),'appdata':_0x1ef9('0x19')+(_0x632f70[_0x1ef9('0xf')]['cutdigits']?_0x1ef9('0x1a')+_0x632f70['extension']['cutdigits']+'}':'${EXTEN}'),'context':_0x312301[_0x135bd5][0x0][_0x1ef9('0x15')],'exten':_0x312301[_0x135bd5][0x0][_0x1ef9('0x8')],'priority':_0x632f70[_0x1ef9('0x16')]++,'VoiceExtensionId':_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')]});}_0x632f70['extensions']['push']({'type':_0x312301[_0x135bd5][0x0]['type'],'app':_0x1ef9('0x13'),'appdata':_0x1ef9('0x1b')+_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')],'context':_0x312301[_0x135bd5][0x0][_0x1ef9('0x15')],'exten':_0x312301[_0x135bd5][0x0][_0x1ef9('0x8')],'priority':_0x632f70[_0x1ef9('0x16')]++,'VoiceExtensionId':_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')]});var _0x20f6e1=_0x632f70['priority']++;_0x632f70[_0x1ef9('0xe')]['push']({'type':_0x312301[_0x135bd5][0x0][_0x1ef9('0x12')],'app':_0x1ef9('0x1c'),'appdata':_0x1ef9('0x1d')+(_0x20f6e1+0x2)+'):Goto('+(_0x20f6e1+0x1)+')','context':_0x312301[_0x135bd5][0x0]['context'],'exten':_0x312301[_0x135bd5][0x0][_0x1ef9('0x8')],'priority':_0x20f6e1,'VoiceExtensionId':_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')]});if(_0x632f70['extension']){_0x632f70[_0x1ef9('0xe')][_0x1ef9('0x11')]({'type':_0x312301[_0x135bd5][0x0][_0x1ef9('0x12')],'app':_0x1ef9('0x13'),'appdata':_0x632f70['extension'][_0x1ef9('0x1e')]?_0x1ef9('0x1f')+_0x632f70['extension'][_0x1ef9('0x1e')]+'}':'CDR(prefix)=noprefix','context':_0x312301[_0x135bd5][0x0][_0x1ef9('0x15')],'exten':_0x312301[_0x135bd5][0x0][_0x1ef9('0x8')],'priority':_0x632f70[_0x1ef9('0x16')]++,'VoiceExtensionId':_0x312301[_0x135bd5][0x0]['VoiceExtensionId']});}_0x632f70['extensions'][_0x1ef9('0x11')]({'type':_0x312301[_0x135bd5][0x0][_0x1ef9('0x12')],'app':'Set','appdata':_0x1ef9('0x20')+_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')],'context':_0x312301[_0x135bd5][0x0][_0x1ef9('0x15')],'exten':_0x312301[_0x135bd5][0x0][_0x1ef9('0x8')],'priority':_0x632f70[_0x1ef9('0x16')]++,'VoiceExtensionId':_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')]});if(_0x632f70[_0x1ef9('0xf')]&&_0x632f70[_0x1ef9('0xf')]['hasOwnProperty'](_0x1ef9('0x21'))&&_0x632f70[_0x1ef9('0xf')][_0x1ef9('0x21')]!==_0x1ef9('0x22')){_0x632f70['extensions']['push']({'type':_0x312301[_0x135bd5][0x0]['type'],'app':_0x1ef9('0x13'),'appdata':_0x1ef9('0x23'),'context':_0x312301[_0x135bd5][0x0][_0x1ef9('0x15')],'exten':_0x312301[_0x135bd5][0x0][_0x1ef9('0x8')],'priority':_0x632f70[_0x1ef9('0x16')]++,'VoiceExtensionId':_0x312301[_0x135bd5][0x0]['VoiceExtensionId']});_0x632f70[_0x1ef9('0xe')][_0x1ef9('0x11')]({'type':_0x312301[_0x135bd5][0x0][_0x1ef9('0x12')],'app':'Set','appdata':_0x1ef9('0x24')+_0x632f70[_0x1ef9('0xf')][_0x1ef9('0x21')]||_0x1ef9('0x25'),'context':_0x312301[_0x135bd5][0x0]['context'],'exten':_0x312301[_0x135bd5][0x0]['exten'],'priority':_0x632f70[_0x1ef9('0x16')]++,'VoiceExtensionId':_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')]});}}_0x632f70[_0x1ef9('0xe')][_0x1ef9('0x11')]({'type':_0x312301[_0x135bd5][0x0][_0x1ef9('0x12')],'app':_0x1ef9('0x13'),'appdata':_0x1ef9('0x26'),'context':_0x312301[_0x135bd5][0x0][_0x1ef9('0x15')],'exten':_0x312301[_0x135bd5][0x0][_0x1ef9('0x8')],'priority':_0x632f70['priority']++,'VoiceExtensionId':_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')]});_0x632f70[_0x1ef9('0xe')][_0x1ef9('0x11')]({'type':_0x312301[_0x135bd5][0x0][_0x1ef9('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x312301[_0x135bd5][0x0][_0x1ef9('0x15')],'exten':_0x312301[_0x135bd5][0x0][_0x1ef9('0x8')],'priority':_0x632f70[_0x1ef9('0x16')]++,'VoiceExtensionId':_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')]});_0x632f70[_0x1ef9('0xe')][_0x1ef9('0x11')]({'type':_0x312301[_0x135bd5][0x0]['type'],'app':_0x1ef9('0x13'),'appdata':_0x1ef9('0x27'),'context':_0x312301[_0x135bd5][0x0][_0x1ef9('0x15')],'exten':_0x312301[_0x135bd5][0x0][_0x1ef9('0x8')],'priority':_0x632f70[_0x1ef9('0x16')]++,'VoiceExtensionId':_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')]});for(var _0x15586e=0x0,_0x4b4c97=0x0;_0x15586e<_0x312301[_0x135bd5]['length'];_0x15586e+=0x1,_0x4b4c97=0x0){var _0x2f36e7=_0x312301[_0x135bd5][_0x15586e];if(_0x2f36e7[_0x1ef9('0x12')]){_0x2f36e7[_0x1ef9('0x12')]=_0x2f36e7[_0x1ef9('0x12')]['toLowerCase']();}var _0x10675e=[];var _0xaf8117=[];delete _0x2f36e7['id'];delete _0x2f36e7['createdAt'];delete _0x2f36e7['updatedAt'];var _0xef2da=_0x2f36e7[_0x1ef9('0x28')]!==_0x1ef9('0x29')?[_0x2f36e7[_0x1ef9('0x28')]]:_0x2f36e7[_0x1ef9('0x5')]?_[_0x1ef9('0x7')](_[_0x1ef9('0xa')](_0x632f70[_0x1ef9('0x2a')],{'IntervalId':_0x2f36e7[_0x1ef9('0x5')]}),_0x1ef9('0x28')):[];if(_0x2f36e7[_0x1ef9('0xd')](_0x1ef9('0x2b'))){if(_0x2f36e7[_0x1ef9('0x2b')]&&_0x2f36e7[_0x1ef9('0x2b')]!=='--'){_0x10675e[_0x1ef9('0x11')]({'type':_0x2f36e7[_0x1ef9('0x12')],'app':'Set','appdata':'CDR(tag)='+_0x2f36e7[_0x1ef9('0x2b')],'context':_0x2f36e7['context'],'exten':_0x2f36e7['exten'],'priority':_0xef2da[_0x1ef9('0x2c')]+_0x632f70['priority']+_0x4b4c97++,'VoiceExtensionId':_0x2f36e7[_0x1ef9('0x17')]});}}if(_0x2f36e7[_0x1ef9('0x12')]===_0x1ef9('0x18')&&_0x2f36e7[_0x1ef9('0xd')](_0x1ef9('0x2d'))){if(_0x2f36e7[_0x1ef9('0x2d')]){_0x10675e['push']({'type':_0x2f36e7['type'],'app':_0x1ef9('0x1c'),'appdata':_0x1ef9('0x2e')+_0x2f36e7['callerID']+')','context':_0x2f36e7[_0x1ef9('0x15')],'exten':_0x2f36e7[_0x1ef9('0x8')],'priority':_0xef2da[_0x1ef9('0x2c')]+_0x632f70['priority']+_0x4b4c97++,'VoiceExtensionId':_0x2f36e7['VoiceExtensionId']});}else{_0x10675e['push']({'type':_0x2f36e7[_0x1ef9('0x12')],'app':'ExecIf','appdata':_0x1ef9('0x2f'),'context':_0x2f36e7['context'],'exten':_0x2f36e7['exten'],'priority':_0xef2da[_0x1ef9('0x2c')]+_0x632f70[_0x1ef9('0x16')]+_0x4b4c97++,'VoiceExtensionId':_0x2f36e7[_0x1ef9('0x17')]});}}if(_0x2f36e7[_0x1ef9('0xd')]('answer')){if(_0x301e09[_0x1ef9('0x30')](_0x2f36e7['app']['toLowerCase']())>=0x0&&_0x2f36e7[_0x1ef9('0x31')]!==_0x1ef9('0x32')){if(_0x2f36e7[_0x1ef9('0x33')]){_0x10675e[_0x1ef9('0x11')]({'type':_0x2f36e7['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2f36e7[_0x1ef9('0x15')],'exten':_0x2f36e7[_0x1ef9('0x8')],'priority':_0xef2da[_0x1ef9('0x2c')]+_0x632f70['priority']+_0x4b4c97++,'VoiceExtensionId':_0x2f36e7[_0x1ef9('0x17')]});_0x10675e[_0x1ef9('0x11')]({'type':_0x2f36e7[_0x1ef9('0x12')],'app':_0x1ef9('0x13'),'appdata':_0x1ef9('0x34'),'context':_0x2f36e7['context'],'exten':_0x2f36e7[_0x1ef9('0x8')],'priority':_0xef2da[_0x1ef9('0x2c')]+_0x632f70[_0x1ef9('0x16')]+_0x4b4c97++,'VoiceExtensionId':_0x2f36e7['VoiceExtensionId']});}else{_0x10675e[_0x1ef9('0x11')]({'type':_0x2f36e7['type'],'app':_0x1ef9('0x1c'),'appdata':_0x1ef9('0x35'),'context':_0x2f36e7[_0x1ef9('0x15')],'exten':_0x2f36e7[_0x1ef9('0x8')],'priority':_0xef2da[_0x1ef9('0x2c')]+_0x632f70[_0x1ef9('0x16')]+_0x4b4c97++,'VoiceExtensionId':_0x2f36e7['VoiceExtensionId']});_0x10675e[_0x1ef9('0x11')]({'type':_0x2f36e7[_0x1ef9('0x12')],'app':_0x1ef9('0x13'),'appdata':_0x1ef9('0x36'),'context':_0x2f36e7['context'],'exten':_0x2f36e7[_0x1ef9('0x8')],'priority':_0xef2da[_0x1ef9('0x2c')]+_0x632f70['priority']+_0x4b4c97++,'VoiceExtensionId':_0x2f36e7[_0x1ef9('0x17')]});}}}for(var _0x30e922=0x0;_0x30e922<_0xef2da['length'];_0x30e922+=0x1){var _0x58671b=_0x632f70[_0x1ef9('0x16')]+_0xef2da[_0x1ef9('0x2c')];var _0x43c226=_0x30e922===_0xef2da[_0x1ef9('0x2c')]-0x1?_0x632f70[_0x1ef9('0x16')]+_0x10675e[_0x1ef9('0x2c')]+_0xaf8117[_0x1ef9('0x2c')]+0x2:_0x632f70[_0x1ef9('0x16')]+_0x30e922+0x1;_0x10675e[_0x1ef9('0x37')](_0x30e922,0x0,{'type':_0x2f36e7[_0x1ef9('0x12')],'app':_0x1ef9('0x38'),'appdata':_0xef2da[_0x30e922]+'?'+_0x2f36e7[_0x1ef9('0x15')]+',${EXTEN},'+_0x58671b+':'+_0x2f36e7[_0x1ef9('0x15')]+_0x1ef9('0x39')+_0x43c226,'exten':_0x2f36e7['exten'],'context':_0x2f36e7['context'],'priority':_0x632f70['priority']+_0x30e922,'VoiceExtensionId':_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')]});}_0x2f36e7[_0x1ef9('0x16')]=_0x10675e['length']?_[_0x1ef9('0x3a')](_0x10675e)[_0x1ef9('0x16')]+0x1:_0x632f70[_0x1ef9('0x16')];_0x632f70[_0x1ef9('0x16')]=(_0xaf8117[_0x1ef9('0x2c')]?_[_0x1ef9('0x3a')](_0xaf8117)['priority']:_0x2f36e7[_0x1ef9('0x16')])+0x1;_0x632f70[_0x1ef9('0xe')]=_['concat'](_0x632f70[_0x1ef9('0xe')],_0x10675e,[_0x2f36e7],_0xaf8117);}_0x632f70[_0x1ef9('0xe')][_0x1ef9('0x11')]({'type':_0x312301[_0x135bd5][0x0][_0x1ef9('0x12')],'app':'Hangup','exten':_0x312301[_0x135bd5][0x0][_0x1ef9('0x8')],'context':_0x312301[_0x135bd5][0x0][_0x1ef9('0x15')],'priority':_0x632f70[_0x1ef9('0x16')],'VoiceExtensionId':_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')]});_0x4b9a08[_0x1ef9('0x11')](_0x312301[_0x135bd5][0x0][_0x1ef9('0x17')]);_0x114527=_[_0x1ef9('0x3b')](_0x114527,_0x632f70[_0x1ef9('0xe')]);}}return _0x6bcdf9[_0x1ef9('0x3c')](function(_0x1c2ddf){return _0x6bcdf9[_0x1ef9('0x4')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x4b9a08}},'transaction':_0x1c2ddf})[_0x1ef9('0x3')](function(_0x288c3){return _0x6bcdf9[_0x1ef9('0x4')]['VoiceExtension'][_0x1ef9('0x3d')](_['sortBy'](_0x114527,_0x1ef9('0x16')),{'transaction':_0x1c2ddf});});});})[_0x1ef9('0x3e')](function(_0x3d301b){console[_0x1ef9('0x3f')](_0x3d301b);});}exports[_0x1ef9('0x40')]=rewrite; \ No newline at end of file +var _0x74b8=['concat','Hangup','destroy','catch','error','rewrite','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','Set','format','type','context','CDR(destination)=','cutdigits','VoiceExtensionId','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74b8,0x86));var _0x874b=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x74b8[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x2c3beb,_0x255aff){var _0x66cdf3=this;return _0x2c3beb[_0x874b('0x0')][_0x874b('0x1')][_0x874b('0x2')]({'raw':!![]})[_0x874b('0x3')](function(_0x33fb00){_0x66cdf3[_0x874b('0x4')]=_0x33fb00;return _0x2c3beb[_0x874b('0x0')][_0x874b('0x5')][_0x874b('0x2')]({'where':{'IntervalId':_0x255aff[_0x874b('0x6')]},'raw':!![]});})[_0x874b('0x3')](function(_0x2c3119){return _0x2c3beb[_0x874b('0x0')][_0x874b('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x874b('0x7')](_[_0x874b('0x8')](_0x2c3119,_0x874b('0x9')))}},'order':[{'raw':_0x874b('0xa')}],'raw':!![]});})[_0x874b('0x3')](function(_0x149fda){var _0x6aa393=_['filter'](_0x149fda,{'priority':'1'});var _0x2ea796=_[_0x874b('0xb')](_0x149fda,{'isApp':0x1});var _0xb632a4=_[_0x874b('0xc')](_0x2ea796,'exten');var _0x41fbcf=[_0x874b('0xd'),_0x874b('0xe')];var _0x3fbb6a=[];var _0x52406d=[];for(var _0x446088 in _0xb632a4){if(_0xb632a4[_0x874b('0xf')](_0x446088)){_0x66cdf3[_0x874b('0x10')]=0x2;_0x66cdf3[_0x874b('0x11')]=[];_0x66cdf3[_0x874b('0x12')]=_['find'](_0x6aa393,{'exten':_0xb632a4[_0x446088][0x0][_0x874b('0x9')]});_0x66cdf3[_0x874b('0x11')][_0x874b('0x13')]({'type':_0xb632a4[_0x446088][0x0]['type'],'app':_0x874b('0x14'),'appdata':util[_0x874b('0x15')]('CDR(type)=%s',_0xb632a4[_0x446088][0x0][_0x874b('0x16')]),'context':_0xb632a4[_0x446088][0x0][_0x874b('0x17')],'exten':_0xb632a4[_0x446088][0x0][_0x874b('0x9')],'priority':_0x66cdf3[_0x874b('0x10')]++,'VoiceExtensionId':_0xb632a4[_0x446088][0x0]['VoiceExtensionId']});if(_0xb632a4[_0x446088][0x0][_0x874b('0x16')]==='outbound'){if(_0x66cdf3['extension']){_0x66cdf3[_0x874b('0x11')][_0x874b('0x13')]({'type':_0xb632a4[_0x446088][0x0][_0x874b('0x16')],'app':_0x874b('0x14'),'appdata':_0x874b('0x18')+(_0x66cdf3[_0x874b('0x12')][_0x874b('0x19')]?'${EXTEN:'+_0x66cdf3[_0x874b('0x12')]['cutdigits']+'}':'${EXTEN}'),'context':_0xb632a4[_0x446088][0x0][_0x874b('0x17')],'exten':_0xb632a4[_0x446088][0x0]['exten'],'priority':_0x66cdf3[_0x874b('0x10')]++,'VoiceExtensionId':_0xb632a4[_0x446088][0x0][_0x874b('0x1a')]});}_0x66cdf3['extensions'][_0x874b('0x13')]({'type':_0xb632a4[_0x446088][0x0][_0x874b('0x16')],'app':_0x874b('0x14'),'appdata':_0x874b('0x1b')+_0xb632a4[_0x446088][0x0][_0x874b('0x1a')],'context':_0xb632a4[_0x446088][0x0][_0x874b('0x17')],'exten':_0xb632a4[_0x446088][0x0][_0x874b('0x9')],'priority':_0x66cdf3[_0x874b('0x10')]++,'VoiceExtensionId':_0xb632a4[_0x446088][0x0][_0x874b('0x1a')]});var _0x5bcb28=_0x66cdf3[_0x874b('0x10')]++;_0x66cdf3['extensions'][_0x874b('0x13')]({'type':_0xb632a4[_0x446088][0x0][_0x874b('0x16')],'app':_0x874b('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5bcb28+0x2)+'):Goto('+(_0x5bcb28+0x1)+')','context':_0xb632a4[_0x446088][0x0][_0x874b('0x17')],'exten':_0xb632a4[_0x446088][0x0]['exten'],'priority':_0x5bcb28,'VoiceExtensionId':_0xb632a4[_0x446088][0x0][_0x874b('0x1a')]});if(_0x66cdf3[_0x874b('0x12')]){_0x66cdf3[_0x874b('0x11')][_0x874b('0x13')]({'type':_0xb632a4[_0x446088][0x0][_0x874b('0x16')],'app':_0x874b('0x14'),'appdata':_0x66cdf3[_0x874b('0x12')][_0x874b('0x19')]?_0x874b('0x1d')+_0x66cdf3[_0x874b('0x12')][_0x874b('0x19')]+'}':_0x874b('0x1e'),'context':_0xb632a4[_0x446088][0x0][_0x874b('0x17')],'exten':_0xb632a4[_0x446088][0x0][_0x874b('0x9')],'priority':_0x66cdf3[_0x874b('0x10')]++,'VoiceExtensionId':_0xb632a4[_0x446088][0x0][_0x874b('0x1a')]});}_0x66cdf3[_0x874b('0x11')][_0x874b('0x13')]({'type':_0xb632a4[_0x446088][0x0][_0x874b('0x16')],'app':_0x874b('0x14'),'appdata':_0x874b('0x1f')+_0xb632a4[_0x446088][0x0][_0x874b('0x1a')],'context':_0xb632a4[_0x446088][0x0]['context'],'exten':_0xb632a4[_0x446088][0x0][_0x874b('0x9')],'priority':_0x66cdf3[_0x874b('0x10')]++,'VoiceExtensionId':_0xb632a4[_0x446088][0x0][_0x874b('0x1a')]});if(_0x66cdf3['extension']&&_0x66cdf3['extension']['hasOwnProperty']('recordingFormat')&&_0x66cdf3['extension'][_0x874b('0x20')]!==_0x874b('0x21')){_0x66cdf3['extensions'][_0x874b('0x13')]({'type':_0xb632a4[_0x446088][0x0][_0x874b('0x16')],'app':_0x874b('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xb632a4[_0x446088][0x0][_0x874b('0x17')],'exten':_0xb632a4[_0x446088][0x0]['exten'],'priority':_0x66cdf3[_0x874b('0x10')]++,'VoiceExtensionId':_0xb632a4[_0x446088][0x0]['VoiceExtensionId']});_0x66cdf3[_0x874b('0x11')]['push']({'type':_0xb632a4[_0x446088][0x0][_0x874b('0x16')],'app':_0x874b('0x14'),'appdata':_0x874b('0x22')+_0x66cdf3[_0x874b('0x12')]['recordingFormat']||_0x874b('0x23'),'context':_0xb632a4[_0x446088][0x0][_0x874b('0x17')],'exten':_0xb632a4[_0x446088][0x0][_0x874b('0x9')],'priority':_0x66cdf3[_0x874b('0x10')]++,'VoiceExtensionId':_0xb632a4[_0x446088][0x0]['VoiceExtensionId']});}}_0x66cdf3[_0x874b('0x11')][_0x874b('0x13')]({'type':_0xb632a4[_0x446088][0x0][_0x874b('0x16')],'app':_0x874b('0x14'),'appdata':_0x874b('0x24'),'context':_0xb632a4[_0x446088][0x0]['context'],'exten':_0xb632a4[_0x446088][0x0]['exten'],'priority':_0x66cdf3[_0x874b('0x10')]++,'VoiceExtensionId':_0xb632a4[_0x446088][0x0][_0x874b('0x1a')]});_0x66cdf3['extensions']['push']({'type':_0xb632a4[_0x446088][0x0][_0x874b('0x16')],'app':_0x874b('0x14'),'appdata':_0x874b('0x25'),'context':_0xb632a4[_0x446088][0x0][_0x874b('0x17')],'exten':_0xb632a4[_0x446088][0x0]['exten'],'priority':_0x66cdf3['priority']++,'VoiceExtensionId':_0xb632a4[_0x446088][0x0][_0x874b('0x1a')]});_0x66cdf3[_0x874b('0x11')][_0x874b('0x13')]({'type':_0xb632a4[_0x446088][0x0][_0x874b('0x16')],'app':_0x874b('0x14'),'appdata':'MONITOR_OPTIONS=ab','context':_0xb632a4[_0x446088][0x0][_0x874b('0x17')],'exten':_0xb632a4[_0x446088][0x0][_0x874b('0x9')],'priority':_0x66cdf3[_0x874b('0x10')]++,'VoiceExtensionId':_0xb632a4[_0x446088][0x0][_0x874b('0x1a')]});for(var _0x345b1c=0x0,_0x5e9d4f=0x0;_0x345b1c<_0xb632a4[_0x446088][_0x874b('0x26')];_0x345b1c+=0x1,_0x5e9d4f=0x0){var _0x203f4d=_0xb632a4[_0x446088][_0x345b1c];if(_0x203f4d['type']){_0x203f4d[_0x874b('0x16')]=_0x203f4d['type'][_0x874b('0x27')]();}var _0x1003ae=[];var _0x38eaea=[];delete _0x203f4d['id'];delete _0x203f4d[_0x874b('0x28')];delete _0x203f4d[_0x874b('0x29')];var _0x3c58cb=_0x203f4d[_0x874b('0x2a')]!==_0x874b('0x2b')?[_0x203f4d[_0x874b('0x2a')]]:_0x203f4d['IntervalId']?_['map'](_[_0x874b('0xb')](_0x66cdf3['intervals'],{'IntervalId':_0x203f4d[_0x874b('0x6')]}),_0x874b('0x2a')):[];if(_0x203f4d[_0x874b('0xf')]('tag')){if(_0x203f4d[_0x874b('0x2c')]&&_0x203f4d['tag']!=='--'){_0x1003ae['push']({'type':_0x203f4d[_0x874b('0x16')],'app':_0x874b('0x14'),'appdata':_0x874b('0x2d')+_0x203f4d[_0x874b('0x2c')],'context':_0x203f4d[_0x874b('0x17')],'exten':_0x203f4d[_0x874b('0x9')],'priority':_0x3c58cb['length']+_0x66cdf3['priority']+_0x5e9d4f++,'VoiceExtensionId':_0x203f4d[_0x874b('0x1a')]});}}if(_0x203f4d[_0x874b('0x16')]===_0x874b('0x2e')&&_0x203f4d[_0x874b('0xf')](_0x874b('0x2f'))){if(_0x203f4d[_0x874b('0x2f')]){_0x1003ae['push']({'type':_0x203f4d[_0x874b('0x16')],'app':'ExecIf','appdata':_0x874b('0x30')+_0x203f4d[_0x874b('0x2f')]+')','context':_0x203f4d[_0x874b('0x17')],'exten':_0x203f4d[_0x874b('0x9')],'priority':_0x3c58cb[_0x874b('0x26')]+_0x66cdf3[_0x874b('0x10')]+_0x5e9d4f++,'VoiceExtensionId':_0x203f4d[_0x874b('0x1a')]});}else{_0x1003ae[_0x874b('0x13')]({'type':_0x203f4d['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x203f4d[_0x874b('0x17')],'exten':_0x203f4d['exten'],'priority':_0x3c58cb['length']+_0x66cdf3[_0x874b('0x10')]+_0x5e9d4f++,'VoiceExtensionId':_0x203f4d[_0x874b('0x1a')]});}}if(_0x203f4d[_0x874b('0xf')](_0x874b('0x31'))){if(_0x41fbcf[_0x874b('0x32')](_0x203f4d[_0x874b('0x33')][_0x874b('0x27')]())>=0x0&&_0x203f4d['appType']!==_0x874b('0x34')){if(_0x203f4d[_0x874b('0x31')]){_0x1003ae[_0x874b('0x13')]({'type':_0x203f4d['type'],'app':_0x874b('0x1c'),'appdata':_0x874b('0x35'),'context':_0x203f4d[_0x874b('0x17')],'exten':_0x203f4d[_0x874b('0x9')],'priority':_0x3c58cb[_0x874b('0x26')]+_0x66cdf3[_0x874b('0x10')]+_0x5e9d4f++,'VoiceExtensionId':_0x203f4d[_0x874b('0x1a')]});_0x1003ae[_0x874b('0x13')]({'type':_0x203f4d[_0x874b('0x16')],'app':_0x874b('0x14'),'appdata':_0x874b('0x36'),'context':_0x203f4d[_0x874b('0x17')],'exten':_0x203f4d[_0x874b('0x9')],'priority':_0x3c58cb['length']+_0x66cdf3[_0x874b('0x10')]+_0x5e9d4f++,'VoiceExtensionId':_0x203f4d[_0x874b('0x1a')]});}else{_0x1003ae[_0x874b('0x13')]({'type':_0x203f4d[_0x874b('0x16')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x203f4d['context'],'exten':_0x203f4d[_0x874b('0x9')],'priority':_0x3c58cb[_0x874b('0x26')]+_0x66cdf3['priority']+_0x5e9d4f++,'VoiceExtensionId':_0x203f4d[_0x874b('0x1a')]});_0x1003ae['push']({'type':_0x203f4d[_0x874b('0x16')],'app':_0x874b('0x14'),'appdata':_0x874b('0x37'),'context':_0x203f4d[_0x874b('0x17')],'exten':_0x203f4d[_0x874b('0x9')],'priority':_0x3c58cb[_0x874b('0x26')]+_0x66cdf3['priority']+_0x5e9d4f++,'VoiceExtensionId':_0x203f4d[_0x874b('0x1a')]});}}}for(var _0x3a642b=0x0;_0x3a642b<_0x3c58cb['length'];_0x3a642b+=0x1){var _0x1c97d1=_0x66cdf3['priority']+_0x3c58cb[_0x874b('0x26')];var _0x2fa685=_0x3a642b===_0x3c58cb['length']-0x1?_0x66cdf3[_0x874b('0x10')]+_0x1003ae[_0x874b('0x26')]+_0x38eaea[_0x874b('0x26')]+0x2:_0x66cdf3[_0x874b('0x10')]+_0x3a642b+0x1;_0x1003ae['splice'](_0x3a642b,0x0,{'type':_0x203f4d[_0x874b('0x16')],'app':_0x874b('0x38'),'appdata':_0x3c58cb[_0x3a642b]+'?'+_0x203f4d['context']+_0x874b('0x39')+_0x1c97d1+':'+_0x203f4d[_0x874b('0x17')]+',${EXTEN},'+_0x2fa685,'exten':_0x203f4d[_0x874b('0x9')],'context':_0x203f4d[_0x874b('0x17')],'priority':_0x66cdf3[_0x874b('0x10')]+_0x3a642b,'VoiceExtensionId':_0xb632a4[_0x446088][0x0][_0x874b('0x1a')]});}_0x203f4d['priority']=_0x1003ae['length']?_['last'](_0x1003ae)[_0x874b('0x10')]+0x1:_0x66cdf3[_0x874b('0x10')];_0x66cdf3[_0x874b('0x10')]=(_0x38eaea[_0x874b('0x26')]?_['last'](_0x38eaea)['priority']:_0x203f4d['priority'])+0x1;_0x66cdf3['extensions']=_[_0x874b('0x3a')](_0x66cdf3[_0x874b('0x11')],_0x1003ae,[_0x203f4d],_0x38eaea);}_0x66cdf3['extensions'][_0x874b('0x13')]({'type':_0xb632a4[_0x446088][0x0][_0x874b('0x16')],'app':_0x874b('0x3b'),'exten':_0xb632a4[_0x446088][0x0][_0x874b('0x9')],'context':_0xb632a4[_0x446088][0x0][_0x874b('0x17')],'priority':_0x66cdf3[_0x874b('0x10')],'VoiceExtensionId':_0xb632a4[_0x446088][0x0][_0x874b('0x1a')]});_0x3fbb6a[_0x874b('0x13')](_0xb632a4[_0x446088][0x0][_0x874b('0x1a')]);_0x52406d=_['concat'](_0x52406d,_0x66cdf3[_0x874b('0x11')]);}}return _0x2c3beb['transaction'](function(_0x4b1c78){return _0x2c3beb[_0x874b('0x0')][_0x874b('0x5')][_0x874b('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x3fbb6a}},'transaction':_0x4b1c78})['then'](function(_0x407c9f){return _0x2c3beb[_0x874b('0x0')][_0x874b('0x5')]['bulkCreate'](_['sortBy'](_0x52406d,_0x874b('0x10')),{'transaction':_0x4b1c78});});});})[_0x874b('0x3d')](function(_0x920c25){console[_0x874b('0x3e')](_0x920c25);});}exports[_0x874b('0x3f')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 01c0e2b..dd9ec5a 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 _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x512355,_0x5c4be0){var _0x964a95=function(_0x2bf4e2){while(--_0x2bf4e2){_0x512355['push'](_0x512355['shift']());}};_0x964a95(++_0x5c4be0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);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(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){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))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);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(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){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))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a3cf8b3..30c6cec 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 _0x5015=['cm_contacts','field','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','select','fields',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','info','Received\x20SIGINT','error','message','exit','errors','sequelize','spread','push','catch','stringify','send','start','root','server/files/tmp','.csv','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','step','duplicates','cm_contacts_','format','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','DROP\x20TABLE\x20','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','finish','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_hopper_black','fromQuery'];(function(_0x2cfc62,_0x400529){var _0x4226d1=function(_0x4ecea2){while(--_0x4ecea2){_0x2cfc62['push'](_0x2cfc62['shift']());}};_0x4226d1(++_0x400529);}(_0x5015,0x1dd));var _0x5501=function(_0x28757e,_0x36da7f){_0x28757e=_0x28757e-0x0;var _0x37dcaa=_0x5015[_0x28757e];return _0x37dcaa;};'use strict';var fs=require('fs');var path=require(_0x5501('0x0'));var _=require('lodash');var Papa=require(_0x5501('0x1'));var util=require('util');var BPromise=require(_0x5501('0x2'));var moment=require('moment');var squel=require(_0x5501('0x3'));var Redis=require(_0x5501('0x4'));var db=require(_0x5501('0x5'))['db'];var config=require(_0x5501('0x6'));var logger=require(_0x5501('0x7'))('import');config[_0x5501('0x8')]=_[_0x5501('0x9')](config[_0x5501('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x5501('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x5501('0xb'));function isEmail(_0x22fe56){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))*$/[_0x5501('0xc')](_0x22fe56);}function selectNotIn(_0x51ebcb,_0x20d5bf,_0x55012c,_0x2b4490,_0x2b2861){return squel['select']()['field'](_0x5501('0xd'))[_0x5501('0xe')](_0x2b4490)[_0x5501('0xf')](_0x20d5bf,null,_0x20d5bf+'.id\x20=\x20'+_0x2b4490+'.'+_0x55012c)[_0x5501('0x10')](_0x2b4490+'.'+_0x55012c+_0x5501('0x11')+_0x51ebcb+'.'+_0x55012c)[_0x5501('0x10')](_0x20d5bf+_0x5501('0x12')+_0x2b2861[_0x5501('0xf')]()+')');}function insertCmHopper(_0x79e80e,_0x9693c6,_0x3e4294,_0x2334d9,_0x4c6690){var _0x5cd4a7=['cm_contacts.phone',_0x5501('0x13'),'cm_contacts.id',_0x5501('0x14'),_0x9693c6+'.'+_0x2334d9,'cm_contacts.createdAt',_0x5501('0x15'),_0x5501('0x16'),'cm_contacts.UserId','\x22'+_0x4c6690+'\x22'];return squel[_0x5501('0x17')]()[_0x5501('0x18')](_0x5501('0x19'))['fromQuery']([_0x5501('0xd'),_0x5501('0x1a'),_0x5501('0x1b'),_0x5501('0x1c'),_0x2334d9,_0x5501('0x1d'),_0x5501('0x1e'),'priority',_0x5501('0x1f'),_0x5501('0x20')],squel['select']()['fields'](_0x5cd4a7)[_0x5501('0xe')](_0x9693c6)[_0x5501('0xf')]('cm_contacts',null,_0x5501('0x21')+_0x9693c6+_0x5501('0x22'))[_0x5501('0xf')](_0x3e4294,null,_0x3e4294+_0x5501('0x23')+_0x9693c6+'.'+_0x2334d9)[_0x5501('0x10')](_0x9693c6+_0x5501('0x24'),_0x79e80e)[_0x5501('0x10')](_0x5501('0x25'),NOW)[_0x5501('0x10')](_0x5501('0x26'),selectNotIn(_0x9693c6,_0x3e4294,_0x2334d9,_0x5501('0x19'),[_0x5501('0x27'),_0x5501('0x28')]))['where'](_0x5501('0x26'),selectNotIn(_0x9693c6,_0x3e4294,_0x2334d9,'cm_hopper',[_0x5501('0x27')])))[_0x5501('0x29')]();}function insertCmHopperBlack(_0x160d81,_0x1f61ff,_0x30e8a6,_0x170d88){var _0x14853b=[_0x5501('0x2a'),_0x5501('0x2b'),_0x5501('0x14'),_0x1f61ff+'.'+_0x170d88,_0x5501('0x2c'),_0x5501('0x15')];return squel[_0x5501('0x17')]()[_0x5501('0x18')](_0x5501('0x2d'))[_0x5501('0x2e')]([_0x5501('0xd'),_0x5501('0x1b'),_0x5501('0x1c'),_0x170d88,'createdAt',_0x5501('0x1e')],squel['select']()['fields'](_0x14853b)[_0x5501('0xe')](_0x1f61ff)[_0x5501('0xf')](_0x5501('0x2f'),null,_0x5501('0x21')+_0x1f61ff+_0x5501('0x22'))['join'](_0x30e8a6,null,_0x30e8a6+_0x5501('0x23')+_0x1f61ff+'.'+_0x170d88)[_0x5501('0x10')](_0x1f61ff+_0x5501('0x24'),_0x160d81)[_0x5501('0x10')](_0x5501('0x25'),NOW)[_0x5501('0x10')](_0x5501('0x26'),squel['select']()[_0x5501('0x30')](_0x5501('0xd'))[_0x5501('0xe')](_0x5501('0x2d'))['where'](_0x5501('0x31'),_0x160d81)['where'](_0x170d88+_0x5501('0x32'),_0x1f61ff+'.'+_0x170d88)))['toString']();}function insertCmContact(_0x169bff,_0x3b0134,_0x34de87,_0x95b48c){var _0x326de4=_[_0x5501('0x33')](_[_0x5501('0x34')](_0x95b48c),['ListId',_0x5501('0x35'),_0x5501('0x1d'),_0x5501('0x1e')]);return squel[_0x5501('0x17')]()['into'](_0x5501('0x2f'))[_0x5501('0x2e')](_0x326de4,squel[_0x5501('0x36')]()[_0x5501('0x37')](_0x326de4)[_0x5501('0xe')](_0x3b0134)[_0x5501('0x10')]('('+_0x34de87['join'](',')+_0x5501('0x38'),squel[_0x5501('0x36')]()[_0x5501('0x37')](_0x34de87)[_0x5501('0xe')](_0x5501('0x2f'))[_0x5501('0x10')](_0x5501('0x31'),_0x169bff)[_0x5501('0x10')](_0x5501('0x39')))[_0x5501('0x10')]('id\x20IN\x20?',squel[_0x5501('0x36')]()[_0x5501('0x30')](_0x5501('0x3a'),_0x5501('0x3b'))['from'](_0x3b0134)['group'](_0x34de87[_0x5501('0xf')](','))))[_0x5501('0x29')]();}function handleStop(){logger[_0x5501('0x3c')](_0x5501('0x3d'));stopped=!![];}function handleUncaughtException(_0x42e327){logger[_0x5501('0x3e')](_0x42e327[_0x5501('0x3f')]);process[_0x5501('0x40')](0x1);}function handleError(_0x3730ed,_0x502f80){stats[_0x5501('0x41')]['push']({'name':_0x502f80['code'],'message':_0x502f80[_0x5501('0x3f')],'row':_0x3730ed});}function handleQuery(_0x44f7bd){logger['info'](_0x44f7bd);return db[_0x5501('0x42')]['query'](_0x44f7bd)[_0x5501('0x43')](function(_0x57da02){results[_0x5501('0x44')](_0x57da02);})[_0x5501('0x45')](function(_0xb0eeec){logger[_0x5501('0x3e')](_0xb0eeec[_0x5501('0x3f')]);});}function main(_0x3c9acc,_0x2e81da,_0x2e79d3,_0x14e3e8){logger[_0x5501('0x3c')]('main',_0x3c9acc,JSON[_0x5501('0x46')](_0x2e81da));process[_0x5501('0x47')](_0x5501('0x48'));var _0x98e7b5=_0x2e81da['binding'];var _0x2e900a=_0x2e81da['socket_timestamp'];var _0x19559c=path[_0x5501('0xf')](config[_0x5501('0x49')],_0x5501('0x4a'),_0x2e900a+_0x5501('0x4b'));var _0x578726=_[_0x5501('0x34')](_0x98e7b5)[_0x5501('0xf')]();logger[_0x5501('0x3c')]('header',_0x578726);fs[_0x5501('0x4c')](_0x19559c,_0x578726+'\x0a');Papa[_0x5501('0x4d')](fs[_0x5501('0x4e')](_0x3c9acc),{'header':!![],'skipEmptyLines':!![],'step':function(_0x37c517,_0x59bb50){try{for(var _0x49e46f=0x0,_0x127b16=[];_0x49e46f<_0x37c517[_0x5501('0x4f')][_0x5501('0x50')];_0x49e46f++){stats[_0x5501('0x51')]+=0x1;if(_0x37c517[_0x5501('0x41')][_0x49e46f]){handleError(_0x37c517[_0x5501('0x4f')][_0x49e46f],_0x37c517[_0x5501('0x41')][_0x49e46f]);}else{var _0x40bedb=[];for(var _0x34be23 in _0x98e7b5){if(_0x98e7b5[_0x5501('0x52')](_0x34be23)){if(_0x37c517['data'][_0x49e46f][_0x98e7b5[_0x34be23]]){var _0x57b837=_[_0x5501('0x53')](_0x37c517[_0x5501('0x4f')][_0x49e46f][_0x98e7b5[_0x34be23]][_0x5501('0x54')](/"/g,'\x27'));switch(_0x34be23){case _0x5501('0x1a'):var _0x4af112=moment(_0x57b837,_0x5501('0xb'),!![]);if(_0x4af112[_0x5501('0x55')]()){_0x127b16[_0x5501('0x44')]('\x22'+_0x57b837+'\x22');}else{_0x40bedb[_0x5501('0x44')](_0x5501('0x56'));}break;case _0x5501('0x57'):var _0x23ea05=parseInt(_0x57b837);_0x57b837=_[_0x5501('0x58')](_0x23ea05)||_0x23ea05<0x0||_0x23ea05>0x4?_0x14e3e8?0x3:0x2:_0x23ea05;_0x127b16[_0x5501('0x44')]('\x22'+_0x57b837+'\x22');break;case _0x5501('0x1f'):var _0x475a98=parseInt(_0x57b837);if(_[_0x5501('0x59')](_0x475a98)&&_[_0x5501('0x5a')](_0x2e79d3,_0x475a98)){_0x127b16[_0x5501('0x44')]('\x22'+_0x475a98+'\x22');}else{_0x40bedb['push'](_0x5501('0x5b'));}break;case _0x5501('0x5c'):if(isEmail(_0x57b837)){_0x127b16['push']('\x22'+_0x57b837+'\x22');}else{_0x40bedb[_0x5501('0x44')](_0x5501('0x5d'));}break;case _0x5501('0x5e'):var _0x45e81d=moment(_0x57b837,_0x5501('0x5f'),!![]);if(_0x45e81d[_0x5501('0x55')]()){_0x127b16[_0x5501('0x44')]('\x22'+_0x57b837+'\x22');}else{_0x40bedb[_0x5501('0x44')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x127b16['push']('\x22'+_0x57b837+'\x22');}}else{switch(_0x34be23){case _0x5501('0x60'):case _0x5501('0xd'):_0x40bedb['push'](_0x34be23+_0x5501('0x61'));break;default:_0x127b16[_0x5501('0x44')]('\x22\x22');}}}}if(_0x40bedb['length']){handleError(_0x37c517['data'][_0x49e46f],{'code':'SystemRow','message':_0x40bedb[_0x5501('0xf')]()});}else{fs[_0x5501('0x62')](_0x19559c,_0x127b16[_0x5501('0xf')]()+'\x0a');}_0x127b16=[];}if(!(stats['rows']%0xc8)){socket[_0x5501('0x63')](_0x5501('0x64')+_0x2e900a,stats);stats[_0x5501('0x41')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x59bb50['abort']();}}catch(_0xa64e18){handleError(_0x37c517[_0x5501('0x4f')][_0x49e46f],{'code':'SystemError','message':_0xa64e18[_0x5501('0x3f')]});logger[_0x5501('0x3e')](_0x5501('0x65'),_0xa64e18[_0x5501('0x3f')]);}},'complete':function(){try{var _0x4b54ab=[];var _0x2fdf22='cm_contacts';if(_0x2e81da[_0x5501('0x66')]&&_0x2e81da[_0x5501('0x66')]['length']){_0x2fdf22=_0x5501('0x67')+_0x2e900a;_0x4b54ab[_0x5501('0x44')]('CREATE\x20TABLE\x20'+_0x2fdf22+'\x20LIKE\x20cm_contacts;');}var _0x4b228b=util[_0x5501('0x68')](_0x5501('0x69'),_0x19559c,_0x2fdf22,_0x578726,_0x2e81da[_0x5501('0x1c')],_0x2e81da['CompanyId']||null,NOW,NOW);if(_[_0x5501('0x6a')](_0x98e7b5[_0x5501('0x1a')])){_0x4b228b+=',\x20scheduledAt\x20=\x20NOW()';}_0x4b54ab['push'](_0x4b228b);if(_0x2e81da['duplicates']&&_0x2e81da['duplicates'][_0x5501('0x50')]){_0x4b54ab[_0x5501('0x44')](insertCmContact(_0x2e81da[_0x5501('0x1c')],_0x2fdf22,_0x2e81da['duplicates'],_0x98e7b5));_0x4b54ab[_0x5501('0x44')](_0x5501('0x6b')+_0x2fdf22+';');}_0x4b54ab['push'](insertCmHopper(_0x2e81da[_0x5501('0x1c')],'voice_queues_has_cm_lists',_0x5501('0x6c'),'VoiceQueueId',_0x14e3e8));_0x4b54ab[_0x5501('0x44')](insertCmHopperBlack(_0x2e81da['ListId'],_0x5501('0x6d'),_0x5501('0x6c'),_0x5501('0x6e')));_0x4b54ab[_0x5501('0x44')](insertCmHopper(_0x2e81da[_0x5501('0x1c')],_0x5501('0x6f'),_0x5501('0x70'),_0x5501('0x71'),_0x14e3e8));_0x4b54ab[_0x5501('0x44')](insertCmHopperBlack(_0x2e81da[_0x5501('0x1c')],_0x5501('0x72'),'campaigns',_0x5501('0x71')));BPromise[_0x5501('0x73')](_0x4b54ab,handleQuery)['then'](function(_0x595b31){stats[_0x5501('0x74')]=!![];stats[_0x5501('0x75')]=_0x2e81da[_0x5501('0x66')]&&_0x2e81da[_0x5501('0x66')][_0x5501('0x50')]?results[0x2][_0x5501('0x75')]:results[0x0][_0x5501('0x75')];socket[_0x5501('0x63')]('contact:import:'+_0x2e900a,stats);fs['unlink'](_0x3c9acc);fs[_0x5501('0x76')](_0x19559c);process[_0x5501('0x40')](0x0);})[_0x5501('0x45')](function(_0x54d4d3){logger[_0x5501('0x3e')](_0x54d4d3[_0x5501('0x3f')]);process[_0x5501('0x40')](0x1);});}catch(_0x118844){logger[_0x5501('0x3e')](_0x5501('0x77'),_0x118844['message']);process['exit'](0x1);}},'error':function(_0x47ee21,_0x27adba,_0x518b94,_0xb78676){throw new Error(_0xb78676);}});}function validate(){if(process['argv']&&process[_0x5501('0x78')][_0x5501('0x50')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x102843=path[_0x5501('0xf')](config['root'],_0x5501('0x4a'),process[_0x5501('0x78')][0x2]);if(!fs[_0x5501('0x79')](_0x102843)){throw new Error(_0x5501('0x7a'));}var _0x1d95a3={};try{_0x1d95a3=JSON[_0x5501('0x4d')](process['argv'][0x3]);if(!_0x1d95a3[_0x5501('0x7b')]){throw new Error(_0x5501('0x7c'));}if(!_0x1d95a3[_0x5501('0x7b')][_0x5501('0xd')]){throw new Error(_0x5501('0x7d'));}if(!_0x1d95a3[_0x5501('0x7b')][_0x5501('0x60')]){throw new Error(_0x5501('0x7e'));}var _0x32d7a3=0x0;if(_0x1d95a3[_0x5501('0x7b')][_0x5501('0x1f')]){_0x32d7a3=0x1;}if(!_0x1d95a3[_0x5501('0x1c')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x2be775){throw new Error(_0x5501('0x7f'));}var _0x131217=[];try{_0x131217=_[_0x5501('0x80')](JSON[_0x5501('0x4d')](process[_0x5501('0x78')][0x4]),'id');}catch(_0x5f305f){logger[_0x5501('0x3c')](_0x5501('0x81'));}main(_0x102843,_0x1d95a3,_0x131217,_0x32d7a3);}validate();process['on'](_0x5501('0x82'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x7d2f=['stringify','send','binding','socket_timestamp','root','server/files/tmp','header','writeFileSync','parse','createReadStream','data','length','rows','errors','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','lodash','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','phone','join','.id\x20=\x20','where','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts','cm_contacts.createdAt\x20=\x20?','field','cm_hopper_black','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','Received\x20SIGINT','error','push','code','info','sequelize','query','spread','catch','message','main'];(function(_0x3733eb,_0x2d9450){var _0x4c80e3=function(_0x365bce){while(--_0x365bce){_0x3733eb['push'](_0x3733eb['shift']());}};_0x4c80e3(++_0x2d9450);}(_0x7d2f,0xc3));var _0xf7d2=function(_0x12a6a7,_0x3ee840){_0x12a6a7=_0x12a6a7-0x0;var _0x2a211f=_0x7d2f[_0x12a6a7];return _0x2a211f;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xf7d2('0x0'));var Papa=require(_0xf7d2('0x1'));var util=require('util');var BPromise=require(_0xf7d2('0x2'));var moment=require('moment');var squel=require(_0xf7d2('0x3'));var Redis=require(_0xf7d2('0x4'));var db=require(_0xf7d2('0x5'))['db'];var config=require(_0xf7d2('0x6'));var logger=require(_0xf7d2('0x7'))(_0xf7d2('0x8'));config['redis']=_['defaults'](config[_0xf7d2('0x9')],{'host':_0xf7d2('0xa'),'port':0x18eb});var socket=require(_0xf7d2('0xb'))(new Redis(config[_0xf7d2('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xf7d2('0xc')](_0xf7d2('0xd'));function isEmail(_0x4cabe4){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'](_0x4cabe4);}function selectNotIn(_0x473692,_0x359928,_0x3a5027,_0x18c09b,_0x6cf896){return squel[_0xf7d2('0xe')]()['field'](_0xf7d2('0xf'))['from'](_0x18c09b)[_0xf7d2('0x10')](_0x359928,null,_0x359928+_0xf7d2('0x11')+_0x18c09b+'.'+_0x3a5027)[_0xf7d2('0x12')](_0x18c09b+'.'+_0x3a5027+'\x20=\x20'+_0x473692+'.'+_0x3a5027)[_0xf7d2('0x12')](_0x359928+'.dialCheckDuplicateType\x20IN\x20('+_0x6cf896[_0xf7d2('0x10')]()+')');}function insertCmHopper(_0x2acec2,_0xeb97a8,_0x416871,_0x2eb09f,_0x38a815){var _0x3d62d8=[_0xf7d2('0x13'),_0xf7d2('0x14'),'cm_contacts.id','cm_contacts.ListId',_0xeb97a8+'.'+_0x2eb09f,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xf7d2('0x15'),_0xf7d2('0x16'),'\x22'+_0x38a815+'\x22'];return squel[_0xf7d2('0x17')]()[_0xf7d2('0x18')](_0xf7d2('0x19'))[_0xf7d2('0x1a')]([_0xf7d2('0xf'),_0xf7d2('0x1b'),_0xf7d2('0x1c'),_0xf7d2('0x1d'),_0x2eb09f,_0xf7d2('0x1e'),_0xf7d2('0x1f'),_0xf7d2('0x20'),'UserId',_0xf7d2('0x21')],squel[_0xf7d2('0xe')]()[_0xf7d2('0x22')](_0x3d62d8)[_0xf7d2('0x23')](_0xeb97a8)[_0xf7d2('0x10')]('cm_contacts',null,_0xf7d2('0x24')+_0xeb97a8+_0xf7d2('0x25'))[_0xf7d2('0x10')](_0x416871,null,_0x416871+_0xf7d2('0x11')+_0xeb97a8+'.'+_0x2eb09f)[_0xf7d2('0x12')](_0xeb97a8+_0xf7d2('0x26'),_0x2acec2)[_0xf7d2('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf7d2('0x12')](_0xf7d2('0x27'),selectNotIn(_0xeb97a8,_0x416871,_0x2eb09f,_0xf7d2('0x19'),[_0xf7d2('0x28'),_0xf7d2('0x29')]))['where'](_0xf7d2('0x27'),selectNotIn(_0xeb97a8,_0x416871,_0x2eb09f,'cm_hopper',[_0xf7d2('0x28')])))[_0xf7d2('0x2a')]();}function insertCmHopperBlack(_0x926133,_0x57aef,_0x2a95cf,_0x5ea8c8){var _0x177fc2=[_0xf7d2('0x13'),_0xf7d2('0x2b'),_0xf7d2('0x2c'),_0x57aef+'.'+_0x5ea8c8,_0xf7d2('0x2d'),_0xf7d2('0x2e')];return squel['insert']()['into']('cm_hopper_black')[_0xf7d2('0x1a')]([_0xf7d2('0xf'),_0xf7d2('0x1c'),_0xf7d2('0x1d'),_0x5ea8c8,_0xf7d2('0x1e'),_0xf7d2('0x1f')],squel[_0xf7d2('0xe')]()[_0xf7d2('0x22')](_0x177fc2)[_0xf7d2('0x23')](_0x57aef)[_0xf7d2('0x10')](_0xf7d2('0x2f'),null,_0xf7d2('0x24')+_0x57aef+_0xf7d2('0x25'))['join'](_0x2a95cf,null,_0x2a95cf+_0xf7d2('0x11')+_0x57aef+'.'+_0x5ea8c8)[_0xf7d2('0x12')](_0x57aef+_0xf7d2('0x26'),_0x926133)[_0xf7d2('0x12')](_0xf7d2('0x30'),NOW)['where'](_0xf7d2('0x27'),squel[_0xf7d2('0xe')]()[_0xf7d2('0x31')]('phone')['from'](_0xf7d2('0x32'))[_0xf7d2('0x12')]('ListId\x20=\x20?',_0x926133)['where'](_0x5ea8c8+'\x20=\x20?',_0x57aef+'.'+_0x5ea8c8)))['toString']();}function insertCmContact(_0x4c9522,_0x11e8d9,_0x329ecd,_0x5c1ff9){var _0x511fc8=_[_0xf7d2('0x33')](_[_0xf7d2('0x34')](_0x5c1ff9),[_0xf7d2('0x1d'),_0xf7d2('0x35'),_0xf7d2('0x1e'),_0xf7d2('0x1f')]);return squel[_0xf7d2('0x17')]()[_0xf7d2('0x18')]('cm_contacts')[_0xf7d2('0x1a')](_0x511fc8,squel['select']()[_0xf7d2('0x22')](_0x511fc8)['from'](_0x11e8d9)[_0xf7d2('0x12')]('('+_0x329ecd['join'](',')+_0xf7d2('0x36'),squel[_0xf7d2('0xe')]()[_0xf7d2('0x22')](_0x329ecd)['from']('cm_contacts')[_0xf7d2('0x12')]('ListId\x20=\x20?',_0x4c9522)[_0xf7d2('0x12')]('deletedAt\x20IS\x20NULL'))[_0xf7d2('0x12')](_0xf7d2('0x37'),squel[_0xf7d2('0xe')]()[_0xf7d2('0x31')](_0xf7d2('0x38'),'min_id')[_0xf7d2('0x23')](_0x11e8d9)[_0xf7d2('0x39')](_0x329ecd[_0xf7d2('0x10')](','))))['toString']();}function handleStop(){logger['info'](_0xf7d2('0x3a'));stopped=!![];}function handleUncaughtException(_0x2d8e9e){logger[_0xf7d2('0x3b')](_0x2d8e9e['message']);process['exit'](0x1);}function handleError(_0x560bec,_0x3603bb){stats['errors'][_0xf7d2('0x3c')]({'name':_0x3603bb[_0xf7d2('0x3d')],'message':_0x3603bb['message'],'row':_0x560bec});}function handleQuery(_0x3326d6){logger[_0xf7d2('0x3e')](_0x3326d6);return db[_0xf7d2('0x3f')][_0xf7d2('0x40')](_0x3326d6)[_0xf7d2('0x41')](function(_0x3c882f){results[_0xf7d2('0x3c')](_0x3c882f);})[_0xf7d2('0x42')](function(_0x16f0db){logger['error'](_0x16f0db[_0xf7d2('0x43')]);});}function main(_0x2ab290,_0x554f77,_0x107a16,_0x5ef577){logger[_0xf7d2('0x3e')](_0xf7d2('0x44'),_0x2ab290,JSON[_0xf7d2('0x45')](_0x554f77));process[_0xf7d2('0x46')]('start');var _0x4bb943=_0x554f77[_0xf7d2('0x47')];var _0x20bda8=_0x554f77[_0xf7d2('0x48')];var _0x42e105=path[_0xf7d2('0x10')](config[_0xf7d2('0x49')],_0xf7d2('0x4a'),_0x20bda8+'.csv');var _0x2addd2=_['keys'](_0x4bb943)[_0xf7d2('0x10')]();logger[_0xf7d2('0x3e')](_0xf7d2('0x4b'),_0x2addd2);fs[_0xf7d2('0x4c')](_0x42e105,_0x2addd2+'\x0a');Papa[_0xf7d2('0x4d')](fs[_0xf7d2('0x4e')](_0x2ab290),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3436c6,_0x22b8fe){try{for(var _0x13d4ee=0x0,_0x57ff23=[];_0x13d4ee<_0x3436c6[_0xf7d2('0x4f')][_0xf7d2('0x50')];_0x13d4ee++){stats[_0xf7d2('0x51')]+=0x1;if(_0x3436c6[_0xf7d2('0x52')][_0x13d4ee]){handleError(_0x3436c6[_0xf7d2('0x4f')][_0x13d4ee],_0x3436c6[_0xf7d2('0x52')][_0x13d4ee]);}else{var _0x539f18=[];for(var _0x456327 in _0x4bb943){if(_0x4bb943[_0xf7d2('0x53')](_0x456327)){if(_0x3436c6['data'][_0x13d4ee][_0x4bb943[_0x456327]]){var _0x5a151b=_['trim'](_0x3436c6[_0xf7d2('0x4f')][_0x13d4ee][_0x4bb943[_0x456327]][_0xf7d2('0x54')](/"/g,'\x27'));switch(_0x456327){case _0xf7d2('0x1b'):var _0x45e3dd=moment(_0x5a151b,_0xf7d2('0xd'),!![]);if(_0x45e3dd[_0xf7d2('0x55')]()){_0x57ff23['push']('\x22'+_0x5a151b+'\x22');}else{_0x539f18['push'](_0xf7d2('0x56'));}break;case _0xf7d2('0x20'):var _0x74b98c=parseInt(_0x5a151b);_0x5a151b=_[_0xf7d2('0x57')](_0x74b98c)||_0x74b98c<0x0||_0x74b98c>0x4?_0x5ef577?0x3:0x2:_0x74b98c;_0x57ff23[_0xf7d2('0x3c')]('\x22'+_0x5a151b+'\x22');break;case _0xf7d2('0x58'):var _0xd86e38=parseInt(_0x5a151b);if(_['isNumber'](_0xd86e38)&&_['includes'](_0x107a16,_0xd86e38)){_0x57ff23['push']('\x22'+_0xd86e38+'\x22');}else{_0x539f18[_0xf7d2('0x3c')](_0xf7d2('0x59'));}break;case _0xf7d2('0x5a'):if(isEmail(_0x5a151b)){_0x57ff23[_0xf7d2('0x3c')]('\x22'+_0x5a151b+'\x22');}else{_0x539f18[_0xf7d2('0x3c')](_0xf7d2('0x5b'));}break;case _0xf7d2('0x5c'):var _0x26733c=moment(_0x5a151b,_0xf7d2('0x5d'),!![]);if(_0x26733c[_0xf7d2('0x55')]()){_0x57ff23[_0xf7d2('0x3c')]('\x22'+_0x5a151b+'\x22');}else{_0x539f18[_0xf7d2('0x3c')](_0xf7d2('0x5e'));}break;default:_0x57ff23[_0xf7d2('0x3c')]('\x22'+_0x5a151b+'\x22');}}else{switch(_0x456327){case _0xf7d2('0x5f'):case _0xf7d2('0xf'):_0x539f18[_0xf7d2('0x3c')](_0x456327+_0xf7d2('0x60'));break;default:_0x57ff23['push']('\x22\x22');}}}}if(_0x539f18[_0xf7d2('0x50')]){handleError(_0x3436c6[_0xf7d2('0x4f')][_0x13d4ee],{'code':_0xf7d2('0x61'),'message':_0x539f18[_0xf7d2('0x10')]()});}else{fs[_0xf7d2('0x62')](_0x42e105,_0x57ff23[_0xf7d2('0x10')]()+'\x0a');}_0x57ff23=[];}if(!(stats[_0xf7d2('0x51')]%0xc8)){socket[_0xf7d2('0x63')]('contact:import:'+_0x20bda8,stats);stats['errors']=[];}}if(stopped){logger[_0xf7d2('0x3e')](_0xf7d2('0x64'));_0x22b8fe[_0xf7d2('0x65')]();}}catch(_0x2367d9){handleError(_0x3436c6[_0xf7d2('0x4f')][_0x13d4ee],{'code':_0xf7d2('0x66'),'message':_0x2367d9[_0xf7d2('0x43')]});logger[_0xf7d2('0x3b')](_0xf7d2('0x67'),_0x2367d9[_0xf7d2('0x43')]);}},'complete':function(){try{var _0x4a2aba=[];var _0xd4b9cd=_0xf7d2('0x2f');if(_0x554f77['duplicates']&&_0x554f77[_0xf7d2('0x68')][_0xf7d2('0x50')]){_0xd4b9cd=_0xf7d2('0x69')+_0x20bda8;_0x4a2aba[_0xf7d2('0x3c')](_0xf7d2('0x6a')+_0xd4b9cd+_0xf7d2('0x6b'));}var _0x5b7b37=util[_0xf7d2('0xc')]('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',_0x42e105,_0xd4b9cd,_0x2addd2,_0x554f77[_0xf7d2('0x1d')],_0x554f77[_0xf7d2('0x35')]||null,NOW,NOW);if(_[_0xf7d2('0x6c')](_0x4bb943[_0xf7d2('0x1b')])){_0x5b7b37+=_0xf7d2('0x6d');}_0x4a2aba[_0xf7d2('0x3c')](_0x5b7b37);if(_0x554f77[_0xf7d2('0x68')]&&_0x554f77['duplicates'][_0xf7d2('0x50')]){_0x4a2aba[_0xf7d2('0x3c')](insertCmContact(_0x554f77[_0xf7d2('0x1d')],_0xd4b9cd,_0x554f77[_0xf7d2('0x68')],_0x4bb943));_0x4a2aba[_0xf7d2('0x3c')](_0xf7d2('0x6e')+_0xd4b9cd+';');}_0x4a2aba['push'](insertCmHopper(_0x554f77[_0xf7d2('0x1d')],_0xf7d2('0x6f'),_0xf7d2('0x70'),'VoiceQueueId',_0x5ef577));_0x4a2aba['push'](insertCmHopperBlack(_0x554f77[_0xf7d2('0x1d')],_0xf7d2('0x71'),_0xf7d2('0x70'),_0xf7d2('0x72')));_0x4a2aba['push'](insertCmHopper(_0x554f77[_0xf7d2('0x1d')],_0xf7d2('0x73'),'campaigns','CampaignId',_0x5ef577));_0x4a2aba[_0xf7d2('0x3c')](insertCmHopperBlack(_0x554f77[_0xf7d2('0x1d')],_0xf7d2('0x74'),'campaigns',_0xf7d2('0x75')));BPromise['each'](_0x4a2aba,handleQuery)['then'](function(_0x3ef613){stats[_0xf7d2('0x76')]=!![];stats[_0xf7d2('0x77')]=_0x554f77[_0xf7d2('0x68')]&&_0x554f77['duplicates'][_0xf7d2('0x50')]?results[0x2][_0xf7d2('0x77')]:results[0x0]['affectedRows'];socket['emit']('contact:import:'+_0x20bda8,stats);fs[_0xf7d2('0x78')](_0x2ab290);fs[_0xf7d2('0x78')](_0x42e105);process[_0xf7d2('0x79')](0x0);})['catch'](function(_0x27588b){logger[_0xf7d2('0x3b')](_0x27588b[_0xf7d2('0x43')]);process[_0xf7d2('0x79')](0x1);});}catch(_0x38fb80){logger[_0xf7d2('0x3b')](_0xf7d2('0x7a'),_0x38fb80[_0xf7d2('0x43')]);process[_0xf7d2('0x79')](0x1);}},'error':function(_0x410a93,_0x34f077,_0xc645cb,_0x7edc20){throw new Error(_0x7edc20);}});}function validate(){if(process['argv']&&process[_0xf7d2('0x7b')][_0xf7d2('0x50')]<0x4){throw new Error(_0xf7d2('0x7c'));}var _0x372b79=path['join'](config[_0xf7d2('0x49')],_0xf7d2('0x4a'),process[_0xf7d2('0x7b')][0x2]);if(!fs['existsSync'](_0x372b79)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3fa2b={};try{_0x3fa2b=JSON[_0xf7d2('0x4d')](process['argv'][0x3]);if(!_0x3fa2b[_0xf7d2('0x47')]){throw new Error(_0xf7d2('0x7d'));}if(!_0x3fa2b[_0xf7d2('0x47')][_0xf7d2('0xf')]){throw new Error(_0xf7d2('0x7e'));}if(!_0x3fa2b[_0xf7d2('0x47')][_0xf7d2('0x5f')]){throw new Error(_0xf7d2('0x7f'));}var _0x3e384b=0x0;if(_0x3fa2b[_0xf7d2('0x47')]['UserId']){_0x3e384b=0x1;}if(!_0x3fa2b[_0xf7d2('0x1d')]){throw new Error(_0xf7d2('0x80'));}}catch(_0x53c77b){throw new Error('body\x20id\x20mandatory');}var _0x35c9a4=[];try{_0x35c9a4=_[_0xf7d2('0x81')](JSON[_0xf7d2('0x4d')](process['argv'][0x4]),'id');}catch(_0x829cf0){logger[_0xf7d2('0x3e')](_0xf7d2('0x82'));}main(_0x372b79,_0x3fa2b,_0x35c9a4,_0x3e384b);}validate();process['on']('SIGINT',handleStop);process['on'](_0xf7d2('0x83'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 787fcba..e312079 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 _0x8066=['where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','length','isNil','phone','AdditionalPhones','push','all','then','catch','error','message','split','CmContactHasItem','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','into','ContactId','ListId','select','cm_contacts','.CmListId\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','exit','errors','code','info','sequelize','stringify','start','binding','clone','socket_timestamp','root','server/files/tmp','body','ContactItemType','name','writeFileSync','parse','createReadStream','rows','data','find','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','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','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','each','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','squel','ioredis','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','test','field','from','join'];(function(_0x1afeb6,_0x48ddd8){var _0x1872b2=function(_0x4303c6){while(--_0x4303c6){_0x1afeb6['push'](_0x1afeb6['shift']());}};_0x1872b2(++_0x48ddd8);}(_0x8066,0x8d));var _0x6806=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x8066[_0x1da527];return _0x40fc7c;};'use strict';var fs=require('fs');var path=require(_0x6806('0x0'));var _=require(_0x6806('0x1'));var Papa=require(_0x6806('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x6806('0x3'));var Redis=require(_0x6806('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x6806('0x5'));var logger=require('../../../config/logger')(_0x6806('0x6'));config[_0x6806('0x7')]=_[_0x6806('0x8')](config[_0x6806('0x7')],{'host':_0x6806('0x9'),'port':0x18eb});var socket=require(_0x6806('0xa'))(new Redis(config[_0x6806('0x7')]));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()[_0x6806('0xb')](_0x6806('0xc'));var tempTableName=_0x6806('0xd')+moment()[_0x6806('0xb')]('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x454f0f){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))*$/[_0x6806('0xe')](_0x454f0f);}function selectNotIn(_0x1f353a,_0x191e4a,_0x3eb6b3,_0x331bf1,_0x431531){return squel['select']()[_0x6806('0xf')]('phone')[_0x6806('0x10')](_0x331bf1)[_0x6806('0x11')](_0x191e4a,null,_0x191e4a+'.id\x20=\x20'+_0x331bf1+'.'+_0x3eb6b3)[_0x6806('0x12')](_0x331bf1+'.'+_0x3eb6b3+_0x6806('0x13')+_0x1f353a+'.'+_0x3eb6b3)[_0x6806('0x12')](_0x191e4a+_0x6806('0x14')+_0x431531[_0x6806('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x54b565,_0x1cd8ef){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x6806('0x15')](_0x6806('0x16')+tempTableName)[_0x6806('0x17')](function(_0x40a1d9){if(_0x40a1d9!==null){var _0x3e2ccb=[];for(var _0x205e90=0x0;_0x205e90<_0x40a1d9[_0x6806('0x18')];_0x205e90++){var _0x41ebcf=_0x40a1d9[_0x205e90];if(!_[_0x6806('0x19')](_0x41ebcf[_0x6806('0x1a')])){if(!_[_0x6806('0x19')](_0x41ebcf[_0x6806('0x1b')]))_0x3e2ccb[_0x6806('0x1c')](insertAdditionalPhones(_0x41ebcf));promisesContact['push']({'contact':_0x41ebcf});}}}Promise[_0x6806('0x1d')](_0x3e2ccb)[_0x6806('0x1e')](function(){_0x54b565({'val':0x1});});})[_0x6806('0x1f')](function(_0x181b90){logger[_0x6806('0x20')](_0x181b90[_0x6806('0x21')]);});});}function insertAdditionalPhones(_0x431aeb){return new Promise(function(_0x2ff1b6,_0x4083ca){var _0x3f0e24=_0x431aeb['AdditionalPhones'];if(_[_0x6806('0x19')](_0x3f0e24))_0x4083ca({'val':0x0});else{var _0x42b595=_0x3f0e24['split'](';');var _0x1691f4=[];orderBy=0x0;for(var _0x3095fa=0x0;_0x3095fa<_0x42b595[_0x6806('0x18')];_0x3095fa++){_0x1691f4[_0x6806('0x1c')](splitAdditionalPhone(_0x431aeb['id'],_0x42b595[_0x3095fa]));}Promise[_0x6806('0x1d')](_0x1691f4)['then'](function(){_0x2ff1b6({'val':_0x42b595['length']});});}});}function splitAdditionalPhone(_0x39ba5,_0x21b6f0){return new Promise(function(_0x315887,_0x2c0a5c){var _0x191777=_0x21b6f0[_0x6806('0x22')](':');var _0x412a91=_0x191777[0x0];var _0x5e5a4e=_0x191777[0x1];if(_0x5e5a4e!==''){var _0x4188fa=_0x5e5a4e[_0x6806('0x22')]('|');var _0x88545a=[];for(var _0xdfdcee=0x0;_0xdfdcee<_0x4188fa['length'];_0xdfdcee++){if(_0x4188fa[_0xdfdcee]!==''){var _0xeef764=_['filter'](promisesAdditionalPhones,{'contactId':_0x39ba5,'phone':_0x4188fa[_0xdfdcee]});if(_0xeef764[_0x6806('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x6806('0x1c')]({'contactId':_0x39ba5,'contactTypeId':_0x412a91,'phone':_0x4188fa[_0xdfdcee],'orderBy':orderBy});}}}_0x315887({'ok':0x1});}else _0x315887({'res':0x0});});}function createAdditionalPhone(_0x2f03cc,_0xdfa974,_0x125f13,_0x271b5a){return new Promise(function(_0x2b248f,_0x334747){return db[_0x6806('0x23')]['findOne']({'where':{'CmContactId':_0x2f03cc,'item':_0x125f13}})[_0x6806('0x1e')](function(_0x22f277){if(_0x22f277){return db[_0x6806('0x23')][_0x6806('0x24')]({'ItemTypeId':_0xdfa974,'OrderBy':_0x271b5a},{'where':{'CmContactId':_0x2f03cc,'item':_0x125f13}})[_0x6806('0x1e')](function(_0x111efb){_0x2b248f({'res':_0x6806('0x25')});});}else{return db[_0x6806('0x23')][_0x6806('0x26')]({'CmContactId':_0x2f03cc,'item':_0x125f13,'ItemTypeId':_0xdfa974,'OrderBy':_0x271b5a,'ItemClass':_0x6806('0x27')})[_0x6806('0x1e')](function(_0x31326b){_0x2b248f({'res':_0x6806('0x28')});});}});});}function updateContact(_0x19fdef){return new Promise(function(_0x4e34f7,_0x25e29f){var _0x134f7c=_0x19fdef['id'];delete _0x19fdef['id'];return db[_0x6806('0x29')][_0x6806('0x24')](_0x19fdef,{'where':{'id':_0x134f7c}})['then'](function(_0x5d957e){updatedRows+=0x1;return db[_0x6806('0x2a')][_0x6806('0x24')]({'phone':_0x19fdef[_0x6806('0x1a')]},{'where':{'ContactId':_0x134f7c}})[_0x6806('0x1e')](function(_0x1f979f){_0x4e34f7({'ret':'OK'});});});});}function insertCmHopper(_0x2a70b2,_0x588b83,_0x338331,_0x2dccd4,_0x19de80){var _0x4b67c8=['cm_contacts.phone',_0x6806('0x2b'),_0x6806('0x2c'),'cm_contacts.ListId',_0x588b83+'.'+_0x2dccd4,'cm_contacts.createdAt',_0x6806('0x2d'),_0x6806('0x2e'),_0x6806('0x2f'),'\x22'+_0x19de80+'\x22'];return squel[_0x6806('0x30')]()['into'](_0x6806('0x31'))[_0x6806('0x32')]([_0x6806('0x1a'),_0x6806('0x33'),'ContactId','ListId',_0x2dccd4,_0x6806('0x34'),_0x6806('0x35'),_0x6806('0x36'),_0x6806('0x37'),_0x6806('0x38')],squel['select']()[_0x6806('0x39')](_0x4b67c8)[_0x6806('0x10')](_0x588b83)['join']('cm_contacts',null,_0x6806('0x3a')+_0x588b83+_0x6806('0x3b'))['join'](_0x338331,null,_0x338331+_0x6806('0x3c')+_0x588b83+'.'+_0x2dccd4)[_0x6806('0x12')](_0x588b83+'.CmListId\x20=\x20?',_0x2a70b2)[_0x6806('0x12')](_0x6806('0x3d'),NOW)[_0x6806('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x588b83,_0x338331,_0x2dccd4,_0x6806('0x31'),[_0x6806('0x3e'),_0x6806('0x3f')]))[_0x6806('0x12')](_0x6806('0x40'),selectNotIn(_0x588b83,_0x338331,_0x2dccd4,_0x6806('0x31'),[_0x6806('0x3e')])))[_0x6806('0x41')]();}function insertCmHopperBlack(_0x14b8a6,_0x4432d6,_0x33c5ad,_0x458f17){var _0x2de995=[_0x6806('0x42'),_0x6806('0x2c'),_0x6806('0x43'),_0x4432d6+'.'+_0x458f17,_0x6806('0x44'),'cm_contacts.updatedAt'];return squel[_0x6806('0x30')]()[_0x6806('0x45')]('cm_hopper_black')['fromQuery'](['phone',_0x6806('0x46'),_0x6806('0x47'),_0x458f17,'createdAt','updatedAt'],squel[_0x6806('0x48')]()['fields'](_0x2de995)[_0x6806('0x10')](_0x4432d6)[_0x6806('0x11')](_0x6806('0x49'),null,_0x6806('0x3a')+_0x4432d6+_0x6806('0x3b'))[_0x6806('0x11')](_0x33c5ad,null,_0x33c5ad+_0x6806('0x3c')+_0x4432d6+'.'+_0x458f17)['where'](_0x4432d6+_0x6806('0x4a'),_0x14b8a6)[_0x6806('0x12')](_0x6806('0x3d'),NOW)[_0x6806('0x12')](_0x6806('0x40'),squel[_0x6806('0x48')]()['field'](_0x6806('0x1a'))[_0x6806('0x10')](_0x6806('0x4b'))['where'](_0x6806('0x4c'),_0x14b8a6)['where'](_0x458f17+_0x6806('0x4d'),_0x4432d6+'.'+_0x458f17)))[_0x6806('0x41')]();}function insertCmHopperAdditionalPhones(_0x13dd0c){var _0xdbdc6c=[_0x6806('0x4e'),_0x6806('0x4f'),'cm_contact_has_items.OrderBy',_0x6806('0x50'),'cm_contact_has_items.updatedAt'];return squel[_0x6806('0x30')]()[_0x6806('0x45')](_0x6806('0x51'))['fromQuery'](['CmHopperId',_0x6806('0x1a'),_0x6806('0x52'),_0x6806('0x34'),_0x6806('0x35')],squel[_0x6806('0x48')]()[_0x6806('0x39')](_0xdbdc6c)[_0x6806('0x10')](_0x6806('0x31'))[_0x6806('0x11')](_0x6806('0x49'),null,_0x6806('0x53'))[_0x6806('0x11')](_0x6806('0x54'),null,_0x6806('0x55'))[_0x6806('0x12')]('cm_hopper.ListId\x20=\x20?',_0x13dd0c)[_0x6806('0x12')](_0x6806('0x3d'),NOW))[_0x6806('0x41')]();}function insertCmContact(_0x28d26c,_0x4ee91d,_0x2e1d38,_0x3c512c){var _0xfe7f1=_[_0x6806('0x56')](_[_0x6806('0x57')](_0x3c512c),[_0x6806('0x47'),_0x6806('0x58'),_0x6806('0x34'),_0x6806('0x35')]);return squel[_0x6806('0x30')]()['into'](_0x6806('0x49'))[_0x6806('0x32')](_0xfe7f1,squel[_0x6806('0x48')]()[_0x6806('0x39')](_0xfe7f1)[_0x6806('0x10')](_0x4ee91d)[_0x6806('0x12')]('('+_0x2e1d38[_0x6806('0x11')](',')+_0x6806('0x59'),squel['select']()['fields'](_0x2e1d38)[_0x6806('0x10')](_0x6806('0x49'))['where']('ListId\x20=\x20?',_0x28d26c))[_0x6806('0x12')](_0x6806('0x5a'),squel[_0x6806('0x48')]()[_0x6806('0xf')]('MIN(id)',_0x6806('0x5b'))[_0x6806('0x10')](_0x4ee91d)[_0x6806('0x5c')](_0x2e1d38[_0x6806('0x11')](','))))[_0x6806('0x41')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xb1c191){logger['error'](_0xb1c191[_0x6806('0x21')]);process[_0x6806('0x5d')](0x1);}function handleError(_0x1f2478,_0x34ba20){stats[_0x6806('0x5e')][_0x6806('0x1c')]({'name':_0x34ba20[_0x6806('0x5f')],'message':_0x34ba20['message'],'row':_0x1f2478});}function handleQuery(_0x3aba34){logger[_0x6806('0x60')](_0x3aba34);return db[_0x6806('0x61')][_0x6806('0x15')](_0x3aba34)[_0x6806('0x17')](function(_0x73e90e){results[_0x6806('0x1c')](_0x73e90e);})[_0x6806('0x1f')](function(_0x17b7f4){logger[_0x6806('0x20')](_0x17b7f4[_0x6806('0x21')]);});}function main(_0x2ff8b0,_0x20940d,_0x4d2b5b,_0x39c8e5){logger[_0x6806('0x60')]('main',_0x2ff8b0,JSON[_0x6806('0x62')](_0x20940d));process['send'](_0x6806('0x63'));var _0x5d722e=_0x20940d[_0x6806('0x64')];var _0x1954fb=_[_0x6806('0x65')](_0x5d722e);var _0xe911b9=_0x20940d[_0x6806('0x66')];var _0xe1e5ab=path[_0x6806('0x11')](config[_0x6806('0x67')],_0x6806('0x68'),_0xe911b9+'.csv');logger[_0x6806('0x60')](_0x6806('0x69'),_0x20940d);db[_0x6806('0x6a')]['findAll']({'raw':!![],'attributes':['id',_0x6806('0x6b')]})[_0x6806('0x1e')](function(_0x10fcae){for(var _0x4533f5=0x0;_0x4533f5<_0x10fcae[_0x6806('0x18')];_0x4533f5++){if(_0x10fcae[_0x4533f5]['name']in _0x5d722e){contactItemTypes[_0x6806('0x1c')](_0x10fcae[_0x4533f5]);delete _0x1954fb[_0x10fcae[_0x4533f5][_0x6806('0x6b')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x1954fb[_0x6806('0x1b')]='';var _0x502859=_[_0x6806('0x57')](_0x1954fb)[_0x6806('0x11')]();logger[_0x6806('0x60')]('header',_0x502859);fs[_0x6806('0x6c')](_0xe1e5ab,_0x502859+'\x0a');Papa[_0x6806('0x6d')](fs[_0x6806('0x6e')](_0x2ff8b0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1574f9,_0x48245f){try{for(var _0xcdcc3b=0x0,_0x51e7d4=[];_0xcdcc3b<_0x1574f9['data'][_0x6806('0x18')];_0xcdcc3b++){stats[_0x6806('0x6f')]+=0x1;if(_0x1574f9[_0x6806('0x5e')][_0xcdcc3b]){handleError(_0x1574f9[_0x6806('0x70')][_0xcdcc3b],_0x1574f9[_0x6806('0x5e')][_0xcdcc3b]);}else{var _0x35ea85=[];var _0xcdcb3e=[];for(var _0x159c40 in _0x5d722e){let _0xbf0519=contactItemTypes[_0x6806('0x71')](_0x4edd55=>_0x4edd55[_0x6806('0x6b')]===_0x159c40);if(_[_0x6806('0x19')](_0xbf0519)){if(_0x5d722e[_0x6806('0x72')](_0x159c40)){if(_0x1574f9[_0x6806('0x70')][_0xcdcc3b][_0x5d722e[_0x159c40]]){var _0x5c5083=_['trim'](_0x1574f9[_0x6806('0x70')][_0xcdcc3b][_0x5d722e[_0x159c40]][_0x6806('0x73')](/"/g,'\x27'));switch(_0x159c40){case _0x6806('0x33'):var _0x3765bd=moment(_0x5c5083,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3765bd[_0x6806('0x74')]()){_0x51e7d4[_0x6806('0x1c')]('\x22'+_0x5c5083+'\x22');}else{_0x35ea85[_0x6806('0x1c')](_0x6806('0x75'));}break;case _0x6806('0x36'):var _0x5e661b=parseInt(_0x5c5083);_0x5c5083=_[_0x6806('0x76')](_0x5e661b)||_0x5e661b<0x0||_0x5e661b>0x4?_0x39c8e5?0x3:0x2:_0x5e661b;_0x51e7d4['push']('\x22'+_0x5c5083+'\x22');break;case _0x6806('0x37'):var _0x117e03=parseInt(_0x5c5083);if(_[_0x6806('0x77')](_0x117e03)&&_['includes'](_0x4d2b5b,_0x117e03)){_0x51e7d4[_0x6806('0x1c')]('\x22'+_0x117e03+'\x22');}else{_0x35ea85['push']('agent\x20not\x20exists');}break;case _0x6806('0x78'):if(isEmail(_0x5c5083)){_0x51e7d4[_0x6806('0x1c')]('\x22'+_0x5c5083+'\x22');}else{_0x35ea85['push'](_0x6806('0x79'));}break;case _0x6806('0x7a'):var _0x2d382c=moment(_0x5c5083,_0x6806('0x7b'),!![]);if(_0x2d382c[_0x6806('0x74')]()){_0x51e7d4[_0x6806('0x1c')]('\x22'+_0x5c5083+'\x22');}else{_0x35ea85[_0x6806('0x1c')](_0x6806('0x7c'));}break;default:_0x51e7d4[_0x6806('0x1c')]('\x22'+_0x5c5083+'\x22');}}else{switch(_0x159c40){case _0x6806('0x7d'):case _0x6806('0x1a'):_0x35ea85[_0x6806('0x1c')](_0x159c40+_0x6806('0x7e'));break;default:_0x51e7d4[_0x6806('0x1c')]('\x22\x22');}}}}else{var _0x193253='';for(var _0x17cc04=0x0;_0x17cc04<_0x5d722e[_0x159c40][_0x6806('0x18')];_0x17cc04++){var _0x5c5083=_['trim'](_0x1574f9['data'][_0xcdcc3b][_0x5d722e[_0x159c40][_0x17cc04]][_0x6806('0x73')](/"/g,'\x27'));if(_0x193253=='')_0x193253=_0x5c5083;else _0x193253+='|'+_0x5c5083;}_0xcdcb3e[_0x6806('0x1c')](_0xbf0519['id']+':'+_0x193253);}}if(hasAdditionalPhones){_0x51e7d4[_0x6806('0x1c')]('\x22'+_0xcdcb3e[_0x6806('0x11')](';')+'\x22');}if(_0x35ea85[_0x6806('0x18')]){handleError(_0x1574f9[_0x6806('0x70')][_0xcdcc3b],{'code':_0x6806('0x7f'),'message':_0x35ea85[_0x6806('0x11')]()});}else{fs[_0x6806('0x80')](_0xe1e5ab,_0x51e7d4[_0x6806('0x11')]()+'\x0a');}_0x51e7d4=[];}if(!(stats[_0x6806('0x6f')]%0xc8)){socket[_0x6806('0x81')](_0x6806('0x82')+_0xe911b9,stats);stats[_0x6806('0x5e')]=[];}}if(stopped){logger[_0x6806('0x60')](_0x6806('0x83'));_0x48245f[_0x6806('0x84')]();}}catch(_0x3f52d5){handleError(_0x1574f9[_0x6806('0x70')][_0xcdcc3b],{'code':_0x6806('0x85'),'message':_0x3f52d5[_0x6806('0x21')]});logger[_0x6806('0x20')](_0x6806('0x86'),_0x3f52d5[_0x6806('0x21')]);}},'complete':function(){try{var _0x152773=[];var _0x515a8c=tempTableName;_0x152773[_0x6806('0x1c')](_0x6806('0x87')+_0x515a8c+_0x6806('0x88'));logger[_0x6806('0x60')](_0x6806('0x89'),contactItemTypes[_0x6806('0x18')]);var _0x42adea=util['format'](_0x6806('0x8a'),_0xe1e5ab,_0x515a8c,_0x502859,_0x20940d[_0x6806('0x47')],_0x20940d[_0x6806('0x58')]||null,NOW,NOW);if(_[_0x6806('0x19')](_0x5d722e[_0x6806('0x33')])){_0x42adea+=',\x20scheduledAt\x20=\x20NOW()';}_0x152773['push'](_0x42adea);BPromise['each'](_0x152773,handleQuery)[_0x6806('0x1e')](function(_0x55b149){BPromise[_0x6806('0x1d')]([handleAdditionalPhones()])[_0x6806('0x1e')](function(){_0x152773=[];for(var _0x1825f0=0x0;_0x1825f0\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','bluebird','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','spread','isNil','phone','AdditionalPhones','push','then','catch','message','length','all','split','filter','CmContactHasItem','findOne','updated','PHONE','inserted','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery'];(function(_0x3e5864,_0x1ead13){var _0x2c7822=function(_0x2b2f71){while(--_0x2b2f71){_0x3e5864['push'](_0x3e5864['shift']());}};_0x2c7822(++_0x1ead13);}(_0x9f88,0x195));var _0x89f8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9f88[_0x2dafbe];return _0x58a45a;};'use strict';var fs=require('fs');var path=require(_0x89f8('0x0'));var _=require(_0x89f8('0x1'));var Papa=require(_0x89f8('0x2'));var util=require('util');var BPromise=require(_0x89f8('0x3'));var moment=require('moment');var squel=require(_0x89f8('0x4'));var Redis=require('ioredis');var db=require(_0x89f8('0x5'))['db'];var config=require(_0x89f8('0x6'));var logger=require(_0x89f8('0x7'))(_0x89f8('0x8'));config[_0x89f8('0x9')]=_['defaults'](config[_0x89f8('0x9')],{'host':_0x89f8('0xa'),'port':0x18eb});var socket=require(_0x89f8('0xb'))(new Redis(config[_0x89f8('0x9')]));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()[_0x89f8('0xc')](_0x89f8('0xd'));var tempTableName=_0x89f8('0xe')+moment()[_0x89f8('0xc')](_0x89f8('0xf'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0xcf3c7b){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))*$/[_0x89f8('0x10')](_0xcf3c7b);}function selectNotIn(_0x489972,_0x3c2dd2,_0x275b58,_0x122d0b,_0xc81908){return squel[_0x89f8('0x11')]()['field']('phone')['from'](_0x122d0b)['join'](_0x3c2dd2,null,_0x3c2dd2+_0x89f8('0x12')+_0x122d0b+'.'+_0x275b58)['where'](_0x122d0b+'.'+_0x275b58+'\x20=\x20'+_0x489972+'.'+_0x275b58)[_0x89f8('0x13')](_0x3c2dd2+_0x89f8('0x14')+_0xc81908[_0x89f8('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x268f3e,_0x336b9e){promisesAdditionalPhones=[];promisesContact=[];return db[_0x89f8('0x16')][_0x89f8('0x17')](_0x89f8('0x18')+tempTableName)[_0x89f8('0x19')](function(_0xbe0cbf){if(_0xbe0cbf!==null){var _0x3f0bcb=[];for(var _0x59a211=0x0;_0x59a211<_0xbe0cbf['length'];_0x59a211++){var _0xdfc0c=_0xbe0cbf[_0x59a211];if(!_[_0x89f8('0x1a')](_0xdfc0c[_0x89f8('0x1b')])){if(!_['isNil'](_0xdfc0c[_0x89f8('0x1c')]))_0x3f0bcb[_0x89f8('0x1d')](insertAdditionalPhones(_0xdfc0c));promisesContact['push']({'contact':_0xdfc0c});}}}Promise['all'](_0x3f0bcb)[_0x89f8('0x1e')](function(){_0x268f3e({'val':0x1});});})[_0x89f8('0x1f')](function(_0x41c068){logger['error'](_0x41c068[_0x89f8('0x20')]);});});}function insertAdditionalPhones(_0x3ad671){return new Promise(function(_0x2005ba,_0x5c0e19){var _0x5a087d=_0x3ad671[_0x89f8('0x1c')];if(_[_0x89f8('0x1a')](_0x5a087d))_0x5c0e19({'val':0x0});else{var _0x134029=_0x5a087d['split'](';');var _0x12296c=[];orderBy=0x0;for(var _0x429a5c=0x0;_0x429a5c<_0x134029[_0x89f8('0x21')];_0x429a5c++){_0x12296c[_0x89f8('0x1d')](splitAdditionalPhone(_0x3ad671['id'],_0x134029[_0x429a5c]));}Promise[_0x89f8('0x22')](_0x12296c)[_0x89f8('0x1e')](function(){_0x2005ba({'val':_0x134029[_0x89f8('0x21')]});});}});}function splitAdditionalPhone(_0x3608f5,_0x4db511){return new Promise(function(_0x4a1b67,_0x5334b5){var _0x158ed8=_0x4db511['split'](':');var _0x114bfb=_0x158ed8[0x0];var _0x4f1b93=_0x158ed8[0x1];if(_0x4f1b93!==''){var _0x522b4e=_0x4f1b93[_0x89f8('0x23')]('|');var _0x58ce54=[];for(var _0x25a386=0x0;_0x25a386<_0x522b4e[_0x89f8('0x21')];_0x25a386++){if(_0x522b4e[_0x25a386]!==''){var _0x462e6d=_[_0x89f8('0x24')](promisesAdditionalPhones,{'contactId':_0x3608f5,'phone':_0x522b4e[_0x25a386]});if(_0x462e6d[_0x89f8('0x21')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3608f5,'contactTypeId':_0x114bfb,'phone':_0x522b4e[_0x25a386],'orderBy':orderBy});}}}_0x4a1b67({'ok':0x1});}else _0x4a1b67({'res':0x0});});}function createAdditionalPhone(_0x22451c,_0x3b71a5,_0x599d93,_0xbe8891){return new Promise(function(_0x154a9c,_0x324e76){return db[_0x89f8('0x25')][_0x89f8('0x26')]({'where':{'CmContactId':_0x22451c,'item':_0x599d93}})[_0x89f8('0x1e')](function(_0x251fcf){if(_0x251fcf){return db[_0x89f8('0x25')]['update']({'ItemTypeId':_0x3b71a5,'OrderBy':_0xbe8891},{'where':{'CmContactId':_0x22451c,'item':_0x599d93}})[_0x89f8('0x1e')](function(_0x1e0275){_0x154a9c({'res':_0x89f8('0x27')});});}else{return db[_0x89f8('0x25')]['create']({'CmContactId':_0x22451c,'item':_0x599d93,'ItemTypeId':_0x3b71a5,'OrderBy':_0xbe8891,'ItemClass':_0x89f8('0x28')})[_0x89f8('0x1e')](function(_0x5ea2d7){_0x154a9c({'res':_0x89f8('0x29')});});}});});}function updateContact(_0x256de2){return new Promise(function(_0x31f9f1,_0x27e147){var _0x3c59df=_0x256de2['id'];delete _0x256de2['id'];return db['CmContact'][_0x89f8('0x2a')](_0x256de2,{'where':{'id':_0x3c59df}})[_0x89f8('0x1e')](function(_0xdac7af){updatedRows+=0x1;return db[_0x89f8('0x2b')][_0x89f8('0x2a')]({'phone':_0x256de2[_0x89f8('0x1b')]},{'where':{'ContactId':_0x3c59df}})['then'](function(_0x5c6898){_0x31f9f1({'ret':'OK'});});});});}function insertCmHopper(_0x2eb3c1,_0x12e595,_0x1434f0,_0x1a0765,_0x500bd6){var _0x1481fa=[_0x89f8('0x2c'),_0x89f8('0x2d'),_0x89f8('0x2e'),_0x89f8('0x2f'),_0x12e595+'.'+_0x1a0765,_0x89f8('0x30'),_0x89f8('0x31'),_0x89f8('0x32'),'cm_contacts.UserId','\x22'+_0x500bd6+'\x22'];return squel[_0x89f8('0x33')]()[_0x89f8('0x34')]('cm_hopper')[_0x89f8('0x35')]([_0x89f8('0x1b'),'scheduledat',_0x89f8('0x36'),_0x89f8('0x37'),_0x1a0765,_0x89f8('0x38'),_0x89f8('0x39'),_0x89f8('0x3a'),_0x89f8('0x3b'),_0x89f8('0x3c')],squel[_0x89f8('0x11')]()['fields'](_0x1481fa)[_0x89f8('0x3d')](_0x12e595)[_0x89f8('0x15')]('cm_contacts',null,_0x89f8('0x3e')+_0x12e595+'.CmListId')[_0x89f8('0x15')](_0x1434f0,null,_0x1434f0+_0x89f8('0x12')+_0x12e595+'.'+_0x1a0765)[_0x89f8('0x13')](_0x12e595+_0x89f8('0x3f'),_0x2eb3c1)[_0x89f8('0x13')](_0x89f8('0x40'),NOW)[_0x89f8('0x13')](_0x89f8('0x41'),selectNotIn(_0x12e595,_0x1434f0,_0x1a0765,'cm_hopper',[_0x89f8('0x42'),_0x89f8('0x43')]))[_0x89f8('0x13')](_0x89f8('0x41'),selectNotIn(_0x12e595,_0x1434f0,_0x1a0765,_0x89f8('0x44'),[_0x89f8('0x42')])))[_0x89f8('0x45')]();}function insertCmHopperBlack(_0x4a31eb,_0x315bcc,_0x165eea,_0x547bf6){var _0x2c4f60=[_0x89f8('0x2c'),_0x89f8('0x2e'),_0x89f8('0x2f'),_0x315bcc+'.'+_0x547bf6,_0x89f8('0x30'),_0x89f8('0x31')];return squel[_0x89f8('0x33')]()[_0x89f8('0x34')](_0x89f8('0x46'))[_0x89f8('0x35')]([_0x89f8('0x1b'),_0x89f8('0x36'),_0x89f8('0x37'),_0x547bf6,_0x89f8('0x38'),'updatedAt'],squel[_0x89f8('0x11')]()[_0x89f8('0x47')](_0x2c4f60)[_0x89f8('0x3d')](_0x315bcc)[_0x89f8('0x15')]('cm_contacts',null,_0x89f8('0x3e')+_0x315bcc+_0x89f8('0x48'))[_0x89f8('0x15')](_0x165eea,null,_0x165eea+'.id\x20=\x20'+_0x315bcc+'.'+_0x547bf6)[_0x89f8('0x13')](_0x315bcc+_0x89f8('0x3f'),_0x4a31eb)[_0x89f8('0x13')](_0x89f8('0x40'),NOW)[_0x89f8('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x89f8('0x49')](_0x89f8('0x1b'))['from'](_0x89f8('0x46'))[_0x89f8('0x13')](_0x89f8('0x4a'),_0x4a31eb)['where'](_0x547bf6+_0x89f8('0x4b'),_0x315bcc+'.'+_0x547bf6)))[_0x89f8('0x45')]();}function insertCmHopperAdditionalPhones(_0x3d23e3){var _0x4c69e9=['cm_hopper.id',_0x89f8('0x4c'),_0x89f8('0x4d'),_0x89f8('0x4e'),'cm_contact_has_items.updatedAt'];return squel[_0x89f8('0x33')]()[_0x89f8('0x34')](_0x89f8('0x4f'))[_0x89f8('0x35')]([_0x89f8('0x50'),_0x89f8('0x1b'),_0x89f8('0x51'),'createdAt',_0x89f8('0x39')],squel[_0x89f8('0x11')]()[_0x89f8('0x47')](_0x4c69e9)[_0x89f8('0x3d')](_0x89f8('0x44'))['join']('cm_contacts',null,_0x89f8('0x52'))[_0x89f8('0x15')](_0x89f8('0x53'),null,_0x89f8('0x54'))['where']('cm_hopper.ListId\x20=\x20?',_0x3d23e3)[_0x89f8('0x13')](_0x89f8('0x40'),NOW))[_0x89f8('0x45')]();}function insertCmContact(_0x29feff,_0xa97fd4,_0x17ea33,_0x26f02d){var _0x36ad0e=_[_0x89f8('0x55')](_['keys'](_0x26f02d),[_0x89f8('0x37'),'CompanyId','createdAt',_0x89f8('0x39')]);return squel[_0x89f8('0x33')]()[_0x89f8('0x34')](_0x89f8('0x56'))[_0x89f8('0x35')](_0x36ad0e,squel[_0x89f8('0x11')]()[_0x89f8('0x47')](_0x36ad0e)[_0x89f8('0x3d')](_0xa97fd4)[_0x89f8('0x13')]('('+_0x17ea33['join'](',')+_0x89f8('0x57'),squel['select']()[_0x89f8('0x47')](_0x17ea33)[_0x89f8('0x3d')](_0x89f8('0x56'))[_0x89f8('0x13')]('ListId\x20=\x20?',_0x29feff))[_0x89f8('0x13')](_0x89f8('0x58'),squel[_0x89f8('0x11')]()[_0x89f8('0x49')](_0x89f8('0x59'),'min_id')[_0x89f8('0x3d')](_0xa97fd4)[_0x89f8('0x5a')](_0x17ea33[_0x89f8('0x15')](','))))[_0x89f8('0x45')]();}function handleStop(){logger[_0x89f8('0x5b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3d2223){logger['error'](_0x3d2223['message']);process[_0x89f8('0x5c')](0x1);}function handleError(_0x5893ad,_0x3cbfc2){stats[_0x89f8('0x5d')][_0x89f8('0x1d')]({'name':_0x3cbfc2[_0x89f8('0x5e')],'message':_0x3cbfc2[_0x89f8('0x20')],'row':_0x5893ad});}function handleQuery(_0x50f2e7){logger[_0x89f8('0x5b')](_0x50f2e7);return db[_0x89f8('0x16')][_0x89f8('0x17')](_0x50f2e7)[_0x89f8('0x19')](function(_0x5e039c){results['push'](_0x5e039c);})[_0x89f8('0x1f')](function(_0x51fdb7){logger[_0x89f8('0x5f')](_0x51fdb7[_0x89f8('0x20')]);});}function main(_0x199d75,_0x174a2c,_0x8302fb,_0xca0c85){logger['info'](_0x89f8('0x60'),_0x199d75,JSON['stringify'](_0x174a2c));process['send'](_0x89f8('0x61'));var _0x28dc84=_0x174a2c['binding'];var _0x19e5a7=_[_0x89f8('0x62')](_0x28dc84);var _0x360d0c=_0x174a2c[_0x89f8('0x63')];var _0x1db01b=path['join'](config[_0x89f8('0x64')],_0x89f8('0x65'),_0x360d0c+_0x89f8('0x66'));logger[_0x89f8('0x5b')](_0x89f8('0x67'),_0x174a2c);db[_0x89f8('0x68')][_0x89f8('0x69')]({'raw':!![],'attributes':['id',_0x89f8('0x6a')]})['then'](function(_0x1bd3e3){for(var _0x147ec0=0x0;_0x147ec0<_0x1bd3e3['length'];_0x147ec0++){if(_0x1bd3e3[_0x147ec0][_0x89f8('0x6a')]in _0x28dc84){contactItemTypes[_0x89f8('0x1d')](_0x1bd3e3[_0x147ec0]);delete _0x19e5a7[_0x1bd3e3[_0x147ec0]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x19e5a7[_0x89f8('0x1c')]='';var _0x14fe21=_[_0x89f8('0x6b')](_0x19e5a7)[_0x89f8('0x15')]();logger[_0x89f8('0x5b')](_0x89f8('0x6c'),_0x14fe21);fs[_0x89f8('0x6d')](_0x1db01b,_0x14fe21+'\x0a');Papa[_0x89f8('0x6e')](fs[_0x89f8('0x6f')](_0x199d75),{'header':!![],'skipEmptyLines':!![],'step':function(_0x317bd0,_0x25db61){try{for(var _0x4e06d2=0x0,_0x24a0b9=[];_0x4e06d2<_0x317bd0[_0x89f8('0x70')]['length'];_0x4e06d2++){stats[_0x89f8('0x71')]+=0x1;if(_0x317bd0['errors'][_0x4e06d2]){handleError(_0x317bd0[_0x89f8('0x70')][_0x4e06d2],_0x317bd0[_0x89f8('0x5d')][_0x4e06d2]);}else{var _0x55c371=[];var _0x43a11d=[];for(var _0x31a5ef in _0x28dc84){let _0x521864=contactItemTypes['find'](_0x59b413=>_0x59b413[_0x89f8('0x6a')]===_0x31a5ef);if(_[_0x89f8('0x1a')](_0x521864)){if(_0x28dc84[_0x89f8('0x72')](_0x31a5ef)){if(_0x317bd0['data'][_0x4e06d2][_0x28dc84[_0x31a5ef]]){var _0xe2382f=_[_0x89f8('0x73')](_0x317bd0[_0x89f8('0x70')][_0x4e06d2][_0x28dc84[_0x31a5ef]][_0x89f8('0x74')](/"/g,'\x27'));switch(_0x31a5ef){case _0x89f8('0x75'):var _0x242a82=moment(_0xe2382f,_0x89f8('0xd'),!![]);if(_0x242a82['isValid']()){_0x24a0b9['push']('\x22'+_0xe2382f+'\x22');}else{_0x55c371[_0x89f8('0x1d')](_0x89f8('0x76'));}break;case'priority':var _0x5b7c0d=parseInt(_0xe2382f);_0xe2382f=_['isNaN'](_0x5b7c0d)||_0x5b7c0d<0x0||_0x5b7c0d>0x4?_0xca0c85?0x3:0x2:_0x5b7c0d;_0x24a0b9[_0x89f8('0x1d')]('\x22'+_0xe2382f+'\x22');break;case'UserId':var _0x2a2cbc=parseInt(_0xe2382f);if(_['isNumber'](_0x2a2cbc)&&_[_0x89f8('0x77')](_0x8302fb,_0x2a2cbc)){_0x24a0b9[_0x89f8('0x1d')]('\x22'+_0x2a2cbc+'\x22');}else{_0x55c371[_0x89f8('0x1d')]('agent\x20not\x20exists');}break;case _0x89f8('0x78'):if(isEmail(_0xe2382f)){_0x24a0b9['push']('\x22'+_0xe2382f+'\x22');}else{_0x55c371['push'](_0x89f8('0x79'));}break;case'dateOfBirth':var _0x52f929=moment(_0xe2382f,'YYYY-MM-DD',!![]);if(_0x52f929[_0x89f8('0x7a')]()){_0x24a0b9[_0x89f8('0x1d')]('\x22'+_0xe2382f+'\x22');}else{_0x55c371[_0x89f8('0x1d')](_0x89f8('0x7b'));}break;default:_0x24a0b9[_0x89f8('0x1d')]('\x22'+_0xe2382f+'\x22');}}else{switch(_0x31a5ef){case _0x89f8('0x7c'):case'phone':_0x55c371['push'](_0x31a5ef+'\x20not\x20specified');break;default:_0x24a0b9[_0x89f8('0x1d')]('\x22\x22');}}}}else{var _0x94d947='';for(var _0x351265=0x0;_0x351265<_0x28dc84[_0x31a5ef][_0x89f8('0x21')];_0x351265++){var _0xe2382f=_[_0x89f8('0x73')](_0x317bd0[_0x89f8('0x70')][_0x4e06d2][_0x28dc84[_0x31a5ef][_0x351265]][_0x89f8('0x74')](/"/g,'\x27'));if(_0x94d947=='')_0x94d947=_0xe2382f;else _0x94d947+='|'+_0xe2382f;}_0x43a11d[_0x89f8('0x1d')](_0x521864['id']+':'+_0x94d947);}}if(hasAdditionalPhones){_0x24a0b9['push']('\x22'+_0x43a11d['join'](';')+'\x22');}if(_0x55c371[_0x89f8('0x21')]){handleError(_0x317bd0[_0x89f8('0x70')][_0x4e06d2],{'code':_0x89f8('0x7d'),'message':_0x55c371[_0x89f8('0x15')]()});}else{fs[_0x89f8('0x7e')](_0x1db01b,_0x24a0b9[_0x89f8('0x15')]()+'\x0a');}_0x24a0b9=[];}if(!(stats[_0x89f8('0x71')]%0xc8)){socket[_0x89f8('0x7f')](_0x89f8('0x80')+_0x360d0c,stats);stats[_0x89f8('0x5d')]=[];}}if(stopped){logger[_0x89f8('0x5b')]('Abort\x20parser');_0x25db61[_0x89f8('0x81')]();}}catch(_0x28cf27){handleError(_0x317bd0[_0x89f8('0x70')][_0x4e06d2],{'code':_0x89f8('0x82'),'message':_0x28cf27[_0x89f8('0x20')]});logger[_0x89f8('0x5f')]('step',_0x28cf27[_0x89f8('0x20')]);}},'complete':function(){try{var _0x2e1056=[];var _0x333af8=tempTableName;_0x2e1056[_0x89f8('0x1d')](_0x89f8('0x83')+_0x333af8+_0x89f8('0x84'));logger['info'](_0x89f8('0x85'),contactItemTypes[_0x89f8('0x21')]);var _0x16cebc=util['format'](_0x89f8('0x86'),_0x1db01b,_0x333af8,_0x14fe21,_0x174a2c[_0x89f8('0x37')],_0x174a2c[_0x89f8('0x87')]||null,NOW,NOW);if(_['isNil'](_0x28dc84[_0x89f8('0x75')])){_0x16cebc+=',\x20scheduledAt\x20=\x20NOW()';}_0x2e1056[_0x89f8('0x1d')](_0x16cebc);BPromise['each'](_0x2e1056,handleQuery)['then'](function(_0x40f5f3){BPromise[_0x89f8('0x22')]([handleAdditionalPhones()])[_0x89f8('0x1e')](function(){_0x2e1056=[];for(var _0x248db0=0x0;_0x248db0=_0x2fa6c9){return _0x3edb1b[_0xc46d('0x14')](0x193)['json']({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x34195a)});}_0x13dab7();})[_0xc46d('0x15')](function(_0x416120){_0x13dab7(_0x416120);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xc46d('0x16')],{'where':{'$or':[{'role':_0xc46d('0x17')},{'role':_0xc46d('0x18')}]}});}exports[_0xc46d('0x19')]=isUserLimit; \ No newline at end of file +var _0x674a=['parse','hasOwnProperty','use','License','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','license','split','createDecipher','aes-256-ctr','update','base64','utf8','final'];(function(_0x439c2f,_0x5841b1){var _0x395b21=function(_0x31d4ab){while(--_0x31d4ab){_0x439c2f['push'](_0x439c2f['shift']());}};_0x395b21(++_0x5841b1);}(_0x674a,0x17a));var _0xa674=function(_0x4f5c78,_0xa41bd4){_0x4f5c78=_0x4f5c78-0x0;var _0x212702=_0x674a[_0x4f5c78];return _0x212702;};'use strict';var crypto=require(_0xa674('0x0'));var util=require(_0xa674('0x1'));var compose=require(_0xa674('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xa674('0x3'));function getValueFromLicense(_0x2f185a,_0x281196){if(_0x2f185a&&_0x281196){if(_0x281196['data1']&&_0x281196[_0xa674('0x4')]){var _0x265638=_0x281196['data1'];var _0x13c197=_0x281196['license'];var _0x14b9c1=_0x265638[_0xa674('0x5')]('-')[0x4];var _0x50b720=_0x265638[_0xa674('0x5')]('-')[0x0];var _0x3e9dfa=crypto[_0xa674('0x6')](_0xa674('0x7'),util['format']('%s:%s:%s',_0x14b9c1,_0x265638,_0x50b720));var _0x49f3ae=_0x3e9dfa[_0xa674('0x8')](_0x13c197,_0xa674('0x9'),_0xa674('0xa'));_0x49f3ae+=_0x3e9dfa[_0xa674('0xb')](_0xa674('0xa'));var _0x3c1254=JSON[_0xa674('0xc')](_0x49f3ae);return _0x3c1254[_0xa674('0xd')](_0x2f185a)?_0x3c1254[_0x2f185a]:null;}}return null;}function isLimit(_0x420735,_0x43e62a,_0x401b21,_0x4dedef){var _0x1683f7=_0x43e62a;return compose()[_0xa674('0xe')](function(_0xd778d4,_0x124481,_0x3640c4){return db[_0xa674('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x4db1bd){var _0xf2af6=getValueFromLicense(_0x420735,_0x4db1bd);return _0xf2af6?_0xf2af6:_0x1683f7;})[_0xa674('0x10')](function(_0x483860){_0x1683f7=_0x483860;return _0x401b21[_0xa674('0x11')](_0x4dedef);})[_0xa674('0x10')](function(_0x3d07b4){if(_0x3d07b4>=_0x1683f7){return _0x124481['status'](0x193)[_0xa674('0x12')]({'message':util[_0xa674('0x13')](_0xa674('0x14'),_0x420735)});}_0x3640c4();})['catch'](function(_0x3cb7ad){_0x3640c4(_0x3cb7ad);});});}function isUserLimit(){return isLimit(_0xa674('0x15'),0x1,db[_0xa674('0x16')],{'where':{'$or':[{'role':_0xa674('0x17')},{'role':_0xa674('0x18')}]}});}exports[_0xa674('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 516906a..63449b3 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 _0x14e9=['$ne','$startsWith','$endsWith','LIKE\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch','sqlOperator','[$or]','and','replace','[$and]','slice','forEach','split','shift','indexOf','map','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?'];(function(_0x3478c7,_0x15c022){var _0x9cc062=function(_0x3a3cb3){while(--_0x3a3cb3){_0x3478c7['push'](_0x3478c7['shift']());}};_0x9cc062(++_0x15c022);}(_0x14e9,0x75));var _0x914e=function(_0x68680a,_0x28ff5d){_0x68680a=_0x68680a-0x0;var _0x3e8fde=_0x14e9[_0x68680a];return _0x3e8fde;};'use strict';var _=require(_0x914e('0x0'));var moment=require('moment');exports[_0x914e('0x1')]=function(_0x1075f5){var _0x55ca5d={'conditions':[]};_0x55ca5d[_0x914e('0x2')]=_['startsWith'](_0x1075f5,_0x914e('0x3'))?'or':_0x914e('0x4');var _0x243628=_0x1075f5[_0x914e('0x5')](_0x914e('0x6'),'')[_0x914e('0x5')]('[$or]','')['split']('||');for(var _0x2b0987=0x0;_0x2b0987<_0x243628['length'];_0x2b0987++){var _0x81857d=_0x243628[_0x2b0987]['split'](':=');var _0x3bea76=_0x81857d[0x0];var _0x561ce8=_0x81857d[_0x914e('0x7')](0x1);_0x561ce8[_0x914e('0x8')](function(_0x214c85){var _0x77b5a9=_0x214c85[_0x914e('0x9')]('[')[_0x914e('0xa')]();var _0x1d4161=_0x214c85['match'](/\[(.*?)\]/g);_0x1d4161[_0x914e('0x8')](function(_0x238eef){var _0x2efb21=_0x238eef[_0x914e('0x9')]('[')['filter'](function(_0x3e01c2){return _0x3e01c2[_0x914e('0xb')](']')>-0x1;})[_0x914e('0xc')](function(_0x293096){return _0x293096[_0x914e('0x9')](']')[0x0];})[0x0];_0x55ca5d['conditions']['push']({'field':_0x3bea76,'operator':_0x77b5a9,'value':_0x2efb21});});});}return _0x55ca5d;};exports[_0x914e('0xd')]=function(_0x3927c3,_0x903e5,_0x5962fc){var _0x45c07c={};if(_0x903e5===_0x914e('0xe')){if(_0x5962fc[_0x914e('0xf')]===_0x914e('0x10')){_0x5962fc[_0x914e('0xf')]=_0x914e('0x11');_0x5962fc[_0x914e('0x12')]+=','+_0x5962fc[_0x914e('0x12')];}else if(_[_0x914e('0x13')]([_0x914e('0x14'),_0x914e('0x15')],_0x5962fc[_0x914e('0xf')])){_0x5962fc[_0x914e('0x12')]=moment(_0x5962fc[_0x914e('0x12')])[_0x914e('0x16')](0x1,_0x914e('0x17'))[_0x914e('0x18')](_0x914e('0x19'));}}if(_0x5962fc[_0x914e('0x1a')]){_0x903e5=_0x5962fc[_0x914e('0x1a')];_0x45c07c[_0x914e('0x1b')]='CAST('+_0x3927c3+'.'+_0x5962fc[_0x914e('0x1c')]+_0x914e('0x1d')+_0x5962fc[_0x914e('0x1a')]+')\x20'+parseOperator(_0x5962fc[_0x914e('0xf')]);}else{_0x45c07c['text']=_0x3927c3+'.'+_0x5962fc[_0x914e('0x1c')]+'\x20'+parseOperator(_0x5962fc[_0x914e('0xf')]);}if(_['includes'](['$ne',_0x914e('0x1e')],_0x5962fc[_0x914e('0xf')]))_0x45c07c[_0x914e('0x1b')]='('+_0x45c07c[_0x914e('0x1b')]+_0x914e('0x1f')+_0x3927c3+'.'+_0x5962fc[_0x914e('0x1c')]+_0x914e('0x20');_0x45c07c[_0x914e('0x12')]=parseValue(_0x903e5,_0x5962fc[_0x914e('0xf')],_0x5962fc[_0x914e('0x12')]);return _0x45c07c;};function parseOperator(_0x4b943f){var _0x15b0cc;switch(_0x4b943f){case _0x914e('0x21'):_0x15b0cc=_0x914e('0x22');break;case _0x914e('0x1e'):_0x15b0cc='NOT\x20IN\x20?';break;case _0x914e('0x10'):_0x15b0cc=_0x914e('0x23');break;case _0x914e('0x24'):_0x15b0cc='<>\x20?';break;case'$substring':case _0x914e('0x25'):case _0x914e('0x26'):_0x15b0cc=_0x914e('0x27');break;case'$lt':_0x15b0cc='<\x20?';break;case _0x914e('0x14'):_0x15b0cc=_0x914e('0x28');break;case _0x914e('0x15'):_0x15b0cc=_0x914e('0x29');break;case'$gte':_0x15b0cc=_0x914e('0x2a');break;case'$between':_0x15b0cc=_0x914e('0x2b');break;}return _0x15b0cc;}function parseValue(_0x5750c7,_0x57601c,_0x18c213){var _0x2fc196={'start':undefined,'end':undefined};switch(_0x57601c){case _0x914e('0x21'):case _0x914e('0x1e'):_0x2fc196[_0x914e('0x2c')]=_0x18c213[_0x914e('0x9')](',');break;case _0x914e('0x2d'):_0x2fc196['start']='%'+_0x18c213+'%';break;case _0x914e('0x25'):_0x2fc196[_0x914e('0x2c')]=_0x18c213+'%';break;case _0x914e('0x26'):_0x2fc196[_0x914e('0x2c')]='%'+_0x18c213;break;case _0x914e('0x11'):var _0x4d1351=_0x18c213['split'](',');var _0x18c213=_0x4d1351[_0x914e('0xa')]();var _0x13fe75=_0x4d1351[_0x914e('0x2e')]();if(_0x5750c7===_0x914e('0xe')){_0x18c213=moment(_0x18c213)['utcOffset'](0x0,!![])[_0x914e('0x18')]();_0x13fe75=moment(_0x13fe75)[_0x914e('0x2f')](0x0,!![])[_0x914e('0x16')](0x17,_0x914e('0x30'))[_0x914e('0x16')](0x3b,_0x914e('0x31'))[_0x914e('0x16')](0x3b,_0x914e('0x32'))['format']();}_0x2fc196={'start':_0x18c213,'end':_0x13fe75};break;default:_0x2fc196[_0x914e('0x2c')]=_0x18c213;break;}return _0x2fc196;} \ No newline at end of file +var _0xe4ca=['split','length','forEach','shift','match','filter','map','conditions','push','buildExpression','DATE','operator','$between','includes','$lte','value','add','days','format','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace'];(function(_0x58f867,_0x3cef24){var _0x4e4cc2=function(_0xdd9b9a){while(--_0xdd9b9a){_0x58f867['push'](_0x58f867['shift']());}};_0x4e4cc2(++_0x3cef24);}(_0xe4ca,0x1cd));var _0xae4c=function(_0x58b7a4,_0x3cf180){_0x58b7a4=_0x58b7a4-0x0;var _0x5aef32=_0xe4ca[_0x58b7a4];return _0x5aef32;};'use strict';var _=require(_0xae4c('0x0'));var moment=require(_0xae4c('0x1'));exports[_0xae4c('0x2')]=function(_0x2fd4a3){var _0x12c8c4={'conditions':[]};_0x12c8c4[_0xae4c('0x3')]=_[_0xae4c('0x4')](_0x2fd4a3,'[$or]')?'or':_0xae4c('0x5');var _0x4c99f2=_0x2fd4a3['replace']('[$and]','')[_0xae4c('0x6')]('[$or]','')[_0xae4c('0x7')]('||');for(var _0x2cc871=0x0;_0x2cc871<_0x4c99f2[_0xae4c('0x8')];_0x2cc871++){var _0x3fa014=_0x4c99f2[_0x2cc871][_0xae4c('0x7')](':=');var _0x62c976=_0x3fa014[0x0];var _0x3bf170=_0x3fa014['slice'](0x1);_0x3bf170[_0xae4c('0x9')](function(_0x42bc65){var _0x2b11e8=_0x42bc65['split']('[')[_0xae4c('0xa')]();var _0x225e6f=_0x42bc65[_0xae4c('0xb')](/\[(.*?)\]/g);_0x225e6f['forEach'](function(_0x2481ef){var _0x43c7e8=_0x2481ef[_0xae4c('0x7')]('[')[_0xae4c('0xc')](function(_0x4163e3){return _0x4163e3['indexOf'](']')>-0x1;})[_0xae4c('0xd')](function(_0x46986c){return _0x46986c[_0xae4c('0x7')](']')[0x0];})[0x0];_0x12c8c4[_0xae4c('0xe')][_0xae4c('0xf')]({'field':_0x62c976,'operator':_0x2b11e8,'value':_0x43c7e8});});});}return _0x12c8c4;};exports[_0xae4c('0x10')]=function(_0x3e9872,_0x36bb52,_0xfaad64){var _0x2e1a00={};if(_0x36bb52===_0xae4c('0x11')){if(_0xfaad64[_0xae4c('0x12')]==='$eq'){_0xfaad64[_0xae4c('0x12')]=_0xae4c('0x13');_0xfaad64['value']+=','+_0xfaad64['value'];}else if(_[_0xae4c('0x14')](['$gt',_0xae4c('0x15')],_0xfaad64['operator'])){_0xfaad64[_0xae4c('0x16')]=moment(_0xfaad64[_0xae4c('0x16')])[_0xae4c('0x17')](0x1,_0xae4c('0x18'))[_0xae4c('0x19')]('YYYY-MM-DD');}}if(_0xfaad64[_0xae4c('0x1a')]){_0x36bb52=_0xfaad64[_0xae4c('0x1a')];_0x2e1a00[_0xae4c('0x1b')]=_0xae4c('0x1c')+_0x3e9872+'.'+_0xfaad64['field']+_0xae4c('0x1d')+_0xfaad64['castTo']+')\x20'+parseOperator(_0xfaad64[_0xae4c('0x12')]);}else{_0x2e1a00[_0xae4c('0x1b')]=_0x3e9872+'.'+_0xfaad64[_0xae4c('0x1e')]+'\x20'+parseOperator(_0xfaad64[_0xae4c('0x12')]);}if(_[_0xae4c('0x14')]([_0xae4c('0x1f'),_0xae4c('0x20')],_0xfaad64[_0xae4c('0x12')]))_0x2e1a00['text']='('+_0x2e1a00[_0xae4c('0x1b')]+'\x20OR\x20'+_0x3e9872+'.'+_0xfaad64[_0xae4c('0x1e')]+_0xae4c('0x21');_0x2e1a00[_0xae4c('0x16')]=parseValue(_0x36bb52,_0xfaad64['operator'],_0xfaad64[_0xae4c('0x16')]);return _0x2e1a00;};function parseOperator(_0x17e755){var _0x2e3599;switch(_0x17e755){case _0xae4c('0x22'):_0x2e3599=_0xae4c('0x23');break;case'$notIn':_0x2e3599=_0xae4c('0x24');break;case _0xae4c('0x25'):_0x2e3599=_0xae4c('0x26');break;case _0xae4c('0x1f'):_0x2e3599=_0xae4c('0x27');break;case _0xae4c('0x28'):case _0xae4c('0x29'):case _0xae4c('0x2a'):_0x2e3599=_0xae4c('0x2b');break;case _0xae4c('0x2c'):_0x2e3599=_0xae4c('0x2d');break;case'$gt':_0x2e3599=_0xae4c('0x2e');break;case _0xae4c('0x15'):_0x2e3599='<=\x20?';break;case'$gte':_0x2e3599=_0xae4c('0x2f');break;case _0xae4c('0x13'):_0x2e3599=_0xae4c('0x30');break;}return _0x2e3599;}function parseValue(_0x4cbf68,_0x33b514,_0xd5f445){var _0x3dd443={'start':undefined,'end':undefined};switch(_0x33b514){case _0xae4c('0x22'):case'$notIn':_0x3dd443[_0xae4c('0x31')]=_0xd5f445['split'](',');break;case _0xae4c('0x28'):_0x3dd443[_0xae4c('0x31')]='%'+_0xd5f445+'%';break;case _0xae4c('0x29'):_0x3dd443[_0xae4c('0x31')]=_0xd5f445+'%';break;case _0xae4c('0x2a'):_0x3dd443[_0xae4c('0x31')]='%'+_0xd5f445;break;case _0xae4c('0x13'):var _0x2980cc=_0xd5f445[_0xae4c('0x7')](',');var _0xd5f445=_0x2980cc['shift']();var _0x190cc4=_0x2980cc['pop']();if(_0x4cbf68==='DATE'){_0xd5f445=moment(_0xd5f445)['utcOffset'](0x0,!![])[_0xae4c('0x19')]();_0x190cc4=moment(_0x190cc4)['utcOffset'](0x0,!![])['add'](0x17,_0xae4c('0x32'))[_0xae4c('0x17')](0x3b,'minutes')[_0xae4c('0x17')](0x3b,_0xae4c('0x33'))[_0xae4c('0x19')]();}_0x3dd443={'start':_0xd5f445,'end':_0x190cc4};break;default:_0x3dd443['start']=_0xd5f445;break;}return _0x3dd443;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index af03e4e..e11e4e4 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 _0xeee3=['utc','$lte','format','parse','split','limit','offset','sort','map','indexOf','priority','cast','unsigned','substr','DESC','ASC','omit','isEmpty','isArray','length','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','includes','push','join','lodash','sequelize','moment','filters','forOwn','type','DATE','isPlainObject','$gte','YYYY-MM-DD'];(function(_0xb7a157,_0x235103){var _0x3c1909=function(_0x20a827){while(--_0x20a827){_0xb7a157['push'](_0xb7a157['shift']());}};_0x3c1909(++_0x235103);}(_0xeee3,0xa2));var _0x3eee=function(_0x46a642,_0x31cfcf){_0x46a642=_0x46a642-0x0;var _0x4d7a9c=_0xeee3[_0x46a642];return _0x4d7a9c;};'use strict';var _=require(_0x3eee('0x0'));var sequelize=require(_0x3eee('0x1'));var moment=require(_0x3eee('0x2'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x25c59d){var _0x5e7c34=null;if(_0x25c59d){_0x5e7c34=_0x25c59d['split'](',');}return _0x5e7c34;};exports[_0x3eee('0x3')]=function(_0x520615,_0x3737bc){var _0x508541={};if(!_['isEmpty'](_0x520615)){_[_0x3eee('0x4')](_0x520615,function(_0x1abb26,_0xe946ed){try{if(_0x3737bc){var _0x511ce8=_['find'](_0x3737bc,{'name':_0xe946ed})||{};if(_0x511ce8[_0x3eee('0x5')]===_0x3eee('0x6')&&_[_0x3eee('0x7')](_0x1abb26)){var _0xa535f9=JSON['parse'](_0x1abb26);var _0x31e7bb={'$gte':moment(moment(_0xa535f9[_0x3eee('0x8')])['format'](_0x3eee('0x9')))[_0x3eee('0xa')]()['format'](),'$lte':moment(moment(_0xa535f9[_0x3eee('0xb')])[_0x3eee('0xc')](_0x3eee('0x9')))[_0x3eee('0xa')]()['subtract'](0x1,'s')[_0x3eee('0xc')]()};_0x508541[_0xe946ed]=_0x31e7bb;}else{_0x508541[_0xe946ed]=_['isArray'](_0x1abb26)?_0x1abb26:JSON[_0x3eee('0xd')](_0x1abb26);}}else{_0x508541[_0xe946ed]=_['isArray'](_0x1abb26)?_0x1abb26:JSON[_0x3eee('0xd')](_0x1abb26);}}catch(_0x4031fe){_0x508541[_0xe946ed]=_0x1abb26[_0x3eee('0xe')](',');}});}return _0x508541;};exports[_0x3eee('0xf')]=function(_0x31872f){_0x31872f=parseInt(_0x31872f,0xa);if(!_0x31872f||_0x31872f<0x0){_0x31872f=LIMIT_VALUE;}return _0x31872f;};exports[_0x3eee('0x10')]=function(_0x1b1a10){_0x1b1a10=parseInt(_0x1b1a10,0xa);if(!_0x1b1a10||_0x1b1a10<0x0){_0x1b1a10=0x0;}return _0x1b1a10;};exports[_0x3eee('0x11')]=function(_0x4141c8){var _0x2248a5,_0x49b82b=null;if(_0x4141c8){_0x2248a5=_0x4141c8[_0x3eee('0xe')](',');_0x49b82b=_[_0x3eee('0x12')](_0x2248a5,function(_0x4eca64){if(_0x4eca64[_0x3eee('0x13')]('-')===0x0){return[_0x4eca64===_0x3eee('0x14')?sequelize[_0x3eee('0x15')](sequelize['col'](_0x3eee('0x14')),_0x3eee('0x16')):_0x4eca64[_0x3eee('0x17')](0x1),_0x3eee('0x18')];}else{return[_0x4eca64===_0x3eee('0x14')?sequelize[_0x3eee('0x15')](sequelize['col'](_0x3eee('0x14')),_0x3eee('0x16')):_0x4eca64,_0x3eee('0x19')];}});}return _0x49b82b;};exports[_0x3eee('0x1a')]=function(_0x38a89b,_0x508b08){if(_[_0x3eee('0x1b')](_0x38a89b)){return _0x38a89b;}if(_[_0x3eee('0x1c')](_0x38a89b)){for(var _0x184493=0x0;_0x184493<_0x38a89b[_0x3eee('0x1d')];_0x184493+=0x1){_0x38a89b[_0x184493]=this[_0x3eee('0x1a')](_0x38a89b[_0x184493],_0x508b08);}return _0x38a89b;}if(!_['isObject'](_0x38a89b)){return _0x38a89b;}if(_[_0x3eee('0x1e')](_0x508b08)){_0x508b08=[_0x508b08];}if(!_['isArray'](_0x508b08)){return _0x38a89b;}for(var _0x41bf32=0x0;_0x41bf32<_0x508b08['length'];_0x41bf32+=0x1){_[_0x3eee('0x1f')](_0x38a89b,_0x508b08[_0x41bf32]);}for(var _0x20b45e in _0x38a89b){if(_0x38a89b[_0x3eee('0x20')](_0x20b45e)){_0x38a89b[_0x20b45e]=this[_0x3eee('0x1a')](_0x38a89b[_0x20b45e],_0x508b08);}}return _0x38a89b;};exports[_0x3eee('0x21')]=function(_0x46e3ed){return _0x46e3ed['match'](RegExp(_0x3eee('0x22')))?!![]:![];};exports[_0x3eee('0x23')]=function(_0x3f709a){return _0x3f709a[_0x3eee('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x3eee('0x25')]=function(_0x3b75d6){var _0x34b1ad=[];_0x3b75d6[_0x3eee('0xe')](/[ ,]+/)[_0x3eee('0x26')](function(_0x2077ea){_0x2077ea=_0x2077ea[_0x3eee('0x27')](/([^:]")"+/g,'$1');_0x2077ea='+'+_0x2077ea+'*';if(_0x2077ea[_0x3eee('0x28')]('@'))_0x2077ea='\x22'+_0x2077ea+'\x22';_0x34b1ad[_0x3eee('0x29')](_0x2077ea);});return _0x34b1ad[_0x3eee('0x2a')]('\x20');}; \ No newline at end of file +var _0xed1f=['forEach','replace','includes','push','join','lodash','sequelize','moment','fields','split','isEmpty','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','isArray','parse','sort','map','indexOf','priority','substr','DESC','col','unsigned','ASC','omit','isObject','isString','length','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue'];(function(_0x51a53d,_0x440df7){var _0x2a5df2=function(_0x39399f){while(--_0x39399f){_0x51a53d['push'](_0x51a53d['shift']());}};_0x2a5df2(++_0x440df7);}(_0xed1f,0x7d));var _0xfed1=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xed1f[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xfed1('0x0'));var sequelize=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var LIMIT_VALUE=0xfa;exports[_0xfed1('0x3')]=function(_0x4d906a){var _0x136e2a=null;if(_0x4d906a){_0x136e2a=_0x4d906a[_0xfed1('0x4')](',');}return _0x136e2a;};exports['filters']=function(_0x262ace,_0x20b82b){var _0x516ad5={};if(!_[_0xfed1('0x5')](_0x262ace)){_['forOwn'](_0x262ace,function(_0x3a209c,_0x5dbe76){try{if(_0x20b82b){var _0x43e162=_['find'](_0x20b82b,{'name':_0x5dbe76})||{};if(_0x43e162[_0xfed1('0x6')]===_0xfed1('0x7')&&_[_0xfed1('0x8')](_0x3a209c)){var _0x11982f=JSON['parse'](_0x3a209c);var _0x55e4ce={'$gte':moment(moment(_0x11982f[_0xfed1('0x9')])[_0xfed1('0xa')](_0xfed1('0xb')))[_0xfed1('0xc')]()['format'](),'$lte':moment(moment(_0x11982f[_0xfed1('0xd')])['format'](_0xfed1('0xb')))['utc']()['subtract'](0x1,'s')[_0xfed1('0xa')]()};_0x516ad5[_0x5dbe76]=_0x55e4ce;}else{_0x516ad5[_0x5dbe76]=_[_0xfed1('0xe')](_0x3a209c)?_0x3a209c:JSON['parse'](_0x3a209c);}}else{_0x516ad5[_0x5dbe76]=_[_0xfed1('0xe')](_0x3a209c)?_0x3a209c:JSON[_0xfed1('0xf')](_0x3a209c);}}catch(_0x35b0f3){_0x516ad5[_0x5dbe76]=_0x3a209c['split'](',');}});}return _0x516ad5;};exports['limit']=function(_0x27b37b){_0x27b37b=parseInt(_0x27b37b,0xa);if(!_0x27b37b||_0x27b37b<0x0){_0x27b37b=LIMIT_VALUE;}return _0x27b37b;};exports['offset']=function(_0x5d8e18){_0x5d8e18=parseInt(_0x5d8e18,0xa);if(!_0x5d8e18||_0x5d8e18<0x0){_0x5d8e18=0x0;}return _0x5d8e18;};exports[_0xfed1('0x10')]=function(_0x34a394){var _0x17de12,_0x2fd5ac=null;if(_0x34a394){_0x17de12=_0x34a394[_0xfed1('0x4')](',');_0x2fd5ac=_[_0xfed1('0x11')](_0x17de12,function(_0x395781){if(_0x395781[_0xfed1('0x12')]('-')===0x0){return[_0x395781===_0xfed1('0x13')?sequelize['cast'](sequelize['col'](_0xfed1('0x13')),'unsigned'):_0x395781[_0xfed1('0x14')](0x1),_0xfed1('0x15')];}else{return[_0x395781===_0xfed1('0x13')?sequelize['cast'](sequelize[_0xfed1('0x16')]('priority'),_0xfed1('0x17')):_0x395781,_0xfed1('0x18')];}});}return _0x2fd5ac;};exports[_0xfed1('0x19')]=function(_0xf9a9a5,_0x13e9d3){if(_['isEmpty'](_0xf9a9a5)){return _0xf9a9a5;}if(_['isArray'](_0xf9a9a5)){for(var _0x2c917d=0x0;_0x2c917d<_0xf9a9a5['length'];_0x2c917d+=0x1){_0xf9a9a5[_0x2c917d]=this[_0xfed1('0x19')](_0xf9a9a5[_0x2c917d],_0x13e9d3);}return _0xf9a9a5;}if(!_[_0xfed1('0x1a')](_0xf9a9a5)){return _0xf9a9a5;}if(_[_0xfed1('0x1b')](_0x13e9d3)){_0x13e9d3=[_0x13e9d3];}if(!_['isArray'](_0x13e9d3)){return _0xf9a9a5;}for(var _0x4afd1e=0x0;_0x4afd1e<_0x13e9d3[_0xfed1('0x1c')];_0x4afd1e+=0x1){_['unset'](_0xf9a9a5,_0x13e9d3[_0x4afd1e]);}for(var _0x522351 in _0xf9a9a5){if(_0xf9a9a5[_0xfed1('0x1d')](_0x522351)){_0xf9a9a5[_0x522351]=this[_0xfed1('0x19')](_0xf9a9a5[_0x522351],_0x13e9d3);}}return _0xf9a9a5;};exports[_0xfed1('0x1e')]=function(_0x18cbbc){return _0x18cbbc[_0xfed1('0x1f')](RegExp(_0xfed1('0x20')))?!![]:![];};exports[_0xfed1('0x21')]=function(_0x4c5a5d){return _0x4c5a5d[_0xfed1('0x1f')](/^\S+@\S+$/)?!![]:![];};exports[_0xfed1('0x22')]=function(_0x3ebb9d){var _0x1bffa8=[];_0x3ebb9d[_0xfed1('0x4')](/[ ,]+/)[_0xfed1('0x23')](function(_0x390ac3){_0x390ac3=_0x390ac3[_0xfed1('0x24')](/([^:]")"+/g,'$1');_0x390ac3='+'+_0x390ac3+'*';if(_0x390ac3[_0xfed1('0x25')]('@'))_0x390ac3='\x22'+_0x390ac3+'\x22';_0x1bffa8[_0xfed1('0x26')](_0x390ac3);});return _0x1bffa8[_0xfed1('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index c78ce69..671c351 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf44b=['use','json\x20replacer','toISOString','static','views','/server/views','engine','ejs','renderFile','view\x20engine','html','urlencoded','express','serve-favicon','body-parser','method-override','path','cors','moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','development','test','client'];(function(_0x4121d4,_0x2240b6){var _0x4f7ab8=function(_0x2e72a8){while(--_0x2e72a8){_0x4121d4['push'](_0x4121d4['shift']());}};_0x4f7ab8(++_0x2240b6);}(_0xf44b,0x161));var _0xbf44=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0xf44b[_0x3ec1da];return _0x472358;};'use strict';var express=require(_0xbf44('0x0'));var favicon=require(_0xbf44('0x1'));var bodyParser=require(_0xbf44('0x2'));var methodOverride=require(_0xbf44('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0xbf44('0x4'));var passport=require('passport');var cors=require(_0xbf44('0x5'));var moment=require(_0xbf44('0x6'));var config=require(_0xbf44('0x7'));var db=require(_0xbf44('0x8'))['db'];exports[_0xbf44('0x9')]=function(_0x3cc8ea){var _0x1e854a=_0x3cc8ea[_0xbf44('0xa')](_0xbf44('0xb'));if(_0x1e854a===_0xbf44('0xc')){_0x3cc8ea[_0xbf44('0xd')](_0xbf44('0xe'),path[_0xbf44('0xf')](config['root'],'public'));}if(_0x1e854a===_0xbf44('0x10')||_0x1e854a===_0xbf44('0x11')){_0x3cc8ea[_0xbf44('0xd')]('appPath',path['join'](config['root'],_0xbf44('0x12')));_0x3cc8ea[_0xbf44('0x13')](errorHandler());}_0x3cc8ea[_0xbf44('0xd')](_0xbf44('0x14'),function(_0x3f758c,_0x5ebee5){if(this[_0x3f758c]instanceof Date){_0x5ebee5=this[_0x3f758c][_0xbf44('0x15')]()['split']('.')[0x0]+'Z';}return _0x5ebee5;});_0x3cc8ea['use'](express[_0xbf44('0x16')](_0x3cc8ea[_0xbf44('0xa')]('appPath')));_0x3cc8ea[_0xbf44('0xd')](_0xbf44('0x17'),config['root']+_0xbf44('0x18'));_0x3cc8ea[_0xbf44('0x19')]('html',require(_0xbf44('0x1a'))[_0xbf44('0x1b')]);_0x3cc8ea[_0xbf44('0xd')](_0xbf44('0x1c'),_0xbf44('0x1d'));_0x3cc8ea[_0xbf44('0x13')](bodyParser[_0xbf44('0x1e')]({'limit':'50mb','extended':!![]}));_0x3cc8ea[_0xbf44('0x13')](bodyParser['json']({'limit':'50mb'}));_0x3cc8ea['use'](cors());_0x3cc8ea[_0xbf44('0x13')](methodOverride());_0x3cc8ea[_0xbf44('0x13')](cookieParser());_0x3cc8ea['use'](passport['initialize']());}; \ No newline at end of file +var _0xc810=['passport','cors','moment','./environment','default','get','appPath','join','public','test','set','root','client','use','json\x20replacer','split','views','/server/views','engine','ejs','view\x20engine','urlencoded','50mb','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','path'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0xc810,0x19e));var _0x0c81=function(_0x4cc4af,_0xff9505){_0x4cc4af=_0x4cc4af-0x0;var _0x2bdac8=_0xc810[_0x4cc4af];return _0x2bdac8;};'use strict';var express=require(_0x0c81('0x0'));var favicon=require(_0x0c81('0x1'));var bodyParser=require(_0x0c81('0x2'));var methodOverride=require(_0x0c81('0x3'));var cookieParser=require(_0x0c81('0x4'));var errorHandler=require('errorhandler');var path=require(_0x0c81('0x5'));var passport=require(_0x0c81('0x6'));var cors=require(_0x0c81('0x7'));var moment=require(_0x0c81('0x8'));var config=require(_0x0c81('0x9'));var db=require('../mysqldb')['db'];exports[_0x0c81('0xa')]=function(_0x2fdff9){var _0x1cfba1=_0x2fdff9[_0x0c81('0xb')]('env');if(_0x1cfba1==='production'){_0x2fdff9['set'](_0x0c81('0xc'),path[_0x0c81('0xd')](config['root'],_0x0c81('0xe')));}if(_0x1cfba1==='development'||_0x1cfba1===_0x0c81('0xf')){_0x2fdff9[_0x0c81('0x10')](_0x0c81('0xc'),path[_0x0c81('0xd')](config[_0x0c81('0x11')],_0x0c81('0x12')));_0x2fdff9[_0x0c81('0x13')](errorHandler());}_0x2fdff9[_0x0c81('0x10')](_0x0c81('0x14'),function(_0x1a79cd,_0x800cb7){if(this[_0x1a79cd]instanceof Date){_0x800cb7=this[_0x1a79cd]['toISOString']()[_0x0c81('0x15')]('.')[0x0]+'Z';}return _0x800cb7;});_0x2fdff9['use'](express['static'](_0x2fdff9['get']('appPath')));_0x2fdff9[_0x0c81('0x10')](_0x0c81('0x16'),config['root']+_0x0c81('0x17'));_0x2fdff9[_0x0c81('0x18')]('html',require(_0x0c81('0x19'))['renderFile']);_0x2fdff9[_0x0c81('0x10')](_0x0c81('0x1a'),'html');_0x2fdff9[_0x0c81('0x13')](bodyParser[_0x0c81('0x1b')]({'limit':_0x0c81('0x1c'),'extended':!![]}));_0x2fdff9['use'](bodyParser['json']({'limit':_0x0c81('0x1c')}));_0x2fdff9[_0x0c81('0x13')](cors());_0x2fdff9['use'](methodOverride());_0x2fdff9[_0x0c81('0x13')](cookieParser());_0x2fdff9['use'](passport[_0x0c81('0x1d')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index a8ecc98..7c03f1a 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 _0xdb94=['createHash','md5','digest','hex','getUuid','platform','win32','utf8','replace','hostname','ipAddress','substring','crypto','bimedia-machine-uuid','execSync','networkInterfaces','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join'];(function(_0x103b13,_0x11c29d){var _0x61f40e=function(_0x555e8f){while(--_0x555e8f){_0x103b13['push'](_0x103b13['shift']());}};_0x61f40e(++_0x11c29d);}(_0xdb94,0xe5));var _0x4db9=function(_0x3cdd9e,_0x4ea44f){_0x3cdd9e=_0x3cdd9e-0x0;var _0x5bc51b=_0xdb94[_0x3cdd9e];return _0x5bc51b;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x4db9('0x0'));var machine=require(_0x4db9('0x1'));var exec=require('child_process')[_0x4db9('0x2')];function getInterfaces(){var _0x3b24a6=[];var _0x25b510=os[_0x4db9('0x3')]();var _0x1f05d4=_['orderBy'](_[_0x4db9('0x4')](_0x25b510));for(var _0x541226=0x0;_0x541226<_0x1f05d4[_0x4db9('0x5')];_0x541226++){var _0xc76bc1=_0x25b510[_0x1f05d4[_0x541226]][_0x4db9('0x6')](function(_0x3404f6){return _0x3404f6[_0x4db9('0x7')]==='IPv4'&&_0x3404f6[_0x4db9('0x8')]===![];});_0x3b24a6=_0x3b24a6[_0x4db9('0x9')](_0xc76bc1);}return _0x3b24a6;}function getFirstInterface(){var _0x2d1d38=_[_0x4db9('0xa')](getInterfaces());return{'macAddress':_0x2d1d38&&_0x2d1d38[_0x4db9('0xb')]?_0x2d1d38['mac']:_0x4db9('0xc'),'ipAddress':_0x2d1d38&&_0x2d1d38[_0x4db9('0xd')]?_0x2d1d38[_0x4db9('0xd')]:_0x4db9('0xe')};}exports[_0x4db9('0xf')]=getFirstInterface;function getCPUhash(){var _0x3d1b96=_['orderBy'](os[_0x4db9('0x10')]()[_0x4db9('0x11')](function(_0x59f01c){return _0x59f01c['model'];}))[_0x4db9('0x12')](':');return crypto[_0x4db9('0x13')](_0x4db9('0x14'))['update'](_0x3d1b96)[_0x4db9('0x15')](_0x4db9('0x16'));}exports[_0x4db9('0x17')]=function(){switch(os[_0x4db9('0x18')]()){case _0x4db9('0x19'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x4db9('0x1a')})[_0x4db9('0x1b')]('\x0d\x0a','');default:var _0x5d4d70=getFirstInterface();var _0x27b387=getCPUhash();var _0x7df575=_0x27b387+'|'+os[_0x4db9('0x1c')]()+'|'+_0x5d4d70['macAddress']+'|'+_0x5d4d70[_0x4db9('0x1d')];var _0x3b0863=crypto['createHash']('md5')['update'](_0x7df575)[_0x4db9('0x15')](_0x4db9('0x16'));return _0x3b0863['substring'](0x0,0x8)+'-'+_0x3b0863[_0x4db9('0x1e')](0x8,0xc)+'-'+_0x3b0863[_0x4db9('0x1e')](0xc,0x10)+'-'+_0x3b0863[_0x4db9('0x1e')](0x10,0x14)+'-'+_0x3b0863[_0x4db9('0x1e')](0x14);}}; \ No newline at end of file +var _0x6d19=['lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','filter','IPv4','internal','concat','head','mac','address','getFirstInterface','cpus','map','model','join','md5','update','digest','hex','getUuid','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','substring'];(function(_0x409582,_0x1f0415){var _0xc9369d=function(_0x18dddf){while(--_0x18dddf){_0x409582['push'](_0x409582['shift']());}};_0xc9369d(++_0x1f0415);}(_0x6d19,0x160));var _0x96d1=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x6d19[_0x4eafed];return _0x159c85;};'use strict';var _=require(_0x96d1('0x0'));var os=require('os');var crypto=require(_0x96d1('0x1'));var machine=require(_0x96d1('0x2'));var exec=require(_0x96d1('0x3'))[_0x96d1('0x4')];function getInterfaces(){var _0x31518c=[];var _0x36405d=os['networkInterfaces']();var _0x186315=_[_0x96d1('0x5')](_[_0x96d1('0x6')](_0x36405d));for(var _0x4704b3=0x0;_0x4704b3<_0x186315['length'];_0x4704b3++){var _0x32b7d9=_0x36405d[_0x186315[_0x4704b3]][_0x96d1('0x7')](function(_0x61e0f5){return _0x61e0f5['family']===_0x96d1('0x8')&&_0x61e0f5[_0x96d1('0x9')]===![];});_0x31518c=_0x31518c[_0x96d1('0xa')](_0x32b7d9);}return _0x31518c;}function getFirstInterface(){var _0x4e1e7a=_[_0x96d1('0xb')](getInterfaces());return{'macAddress':_0x4e1e7a&&_0x4e1e7a[_0x96d1('0xc')]?_0x4e1e7a['mac']:'00:00:00:00:00:00','ipAddress':_0x4e1e7a&&_0x4e1e7a[_0x96d1('0xd')]?_0x4e1e7a[_0x96d1('0xd')]:'127.0.0.1'};}exports[_0x96d1('0xe')]=getFirstInterface;function getCPUhash(){var _0x51b089=_[_0x96d1('0x5')](os[_0x96d1('0xf')]()[_0x96d1('0x10')](function(_0xb019fb){return _0xb019fb[_0x96d1('0x11')];}))[_0x96d1('0x12')](':');return crypto['createHash'](_0x96d1('0x13'))[_0x96d1('0x14')](_0x51b089)[_0x96d1('0x15')](_0x96d1('0x16'));}exports[_0x96d1('0x17')]=function(){switch(os['platform']()){case'win32':return exec(_0x96d1('0x18'),{'encoding':_0x96d1('0x19')})[_0x96d1('0x1a')]('\x0d\x0a','');default:var _0x9eb2c4=getFirstInterface();var _0x2d521d=getCPUhash();var _0x3e9a0=_0x2d521d+'|'+os[_0x96d1('0x1b')]()+'|'+_0x9eb2c4[_0x96d1('0x1c')]+'|'+_0x9eb2c4[_0x96d1('0x1d')];var _0x5853f0=crypto[_0x96d1('0x1e')](_0x96d1('0x13'))[_0x96d1('0x14')](_0x3e9a0)[_0x96d1('0x15')](_0x96d1('0x16'));return _0x5853f0['substring'](0x0,0x8)+'-'+_0x5853f0[_0x96d1('0x1f')](0x8,0xc)+'-'+_0x5853f0[_0x96d1('0x1f')](0xc,0x10)+'-'+_0x5853f0[_0x96d1('0x1f')](0x10,0x14)+'-'+_0x5853f0[_0x96d1('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index eee7e8c..8764f93 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 _0xffdb=['catch','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','then','|reason|','|uuid|','|name|','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','update','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','format','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','license','../../api/jira/jira.controller','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET'];(function(_0xd1df80,_0x497ac8){var _0x17274f=function(_0x1f4bbd){while(--_0x1f4bbd){_0xd1df80['push'](_0xd1df80['shift']());}};_0x17274f(++_0x497ac8);}(_0xffdb,0x8e));var _0xbffd=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xffdb[_0x3b0731];return _0x4204d7;};'use strict';var util=require('util');var moment=require(_0xbffd('0x0'));var rp=require(_0xbffd('0x1'));var BPromise=require(_0xbffd('0x2'));var pkginfo=require(_0xbffd('0x3'))(module,_0xbffd('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xbffd('0x5'));var hardware=require(_0xbffd('0x6'));var logger=require(_0xbffd('0x7'))(_0xbffd('0x8'));var jira=require(_0xbffd('0x9'));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(_0x189e1c){return new BPromise(function(_0x3a05d0,_0xf5db1e){var _0x38ef5e=util['format'](_0xbffd('0xa'),HOST,_0x189e1c,module[_0xbffd('0xb')][_0xbffd('0x4')]);if(oldToken){_0x38ef5e=util['format'](_0xbffd('0xc'),HOST,_0x189e1c,module['exports']['version'],oldToken);}var _0x4a5f69={'uri':_0x38ef5e,'method':_0xbffd('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x4a5f69)['then'](function(_0x49bca3){_0x3a05d0(_0x49bca3);})[_0xbffd('0xe')](function(_0x599ea9){_0xf5db1e(_0x599ea9);});});}function sendJiraAlert(_0x30976a,_0x17cb56,_0x2c7b1b){var _0x164a5f=_0xbffd('0xf');return db[_0xbffd('0x10')][_0xbffd('0x11')]({'where':{'role':_0xbffd('0x12')},'attributes':[_0xbffd('0x13'),_0xbffd('0x14')],'raw':!![]})[_0xbffd('0x15')](function(_0x36e7c4){ADMIN=_0x36e7c4;_0x164a5f+=_0xbffd('0x16')+_0x2c7b1b+'|\x0a';_0x164a5f+=_0xbffd('0x17')+_0x30976a+'|\x0a';_0x164a5f+='|machineUuid|'+_0x17cb56+'|\x0a';_0x164a5f+=_0xbffd('0x18')+ADMIN['fullname']+'|\x0a';_0x164a5f+='|email|'+ADMIN[_0xbffd('0x14')]+'|\x0a';return _0x164a5f;})[_0xbffd('0x15')](function(_0x4f1de1){var _0x145873=hardware['getFirstInterface']()[_0xbffd('0x19')];return jira[_0xbffd('0x1a')]({'key':_0xbffd('0x1b'),'summary':_0xbffd('0x1c'),'description':_0x4f1de1,'issuetype':'Alert','oldToken':_0x30976a,'newToken':_0x17cb56,'email':ADMIN[_0xbffd('0x14')],'name':ADMIN[_0xbffd('0x13')],'reason':GRAY_PERIOD_REASON,'ip':_0x145873});});}function manageLicense(_0x4666c2,_0x348f6b){var _0x333fac=_0x348f6b['get']({'plain':!![]});httpRequest(_0x4666c2)[_0xbffd('0x15')](function(_0x5a8119){if(oldToken){oldToken=undefined;}if(_0x5a8119['active']){if(!_0x333fac[_0xbffd('0x8')]&&_0x333fac['license']!=_0x5a8119['license']||_0x333fac[_0xbffd('0x8')]&&_0x333fac['data2']){logger[_0xbffd('0x1d')](_0xbffd('0x1e'));}if(_0x333fac['license']&&!_0x333fac[_0xbffd('0x1f')]&&_0x333fac['license']!=_0x5a8119[_0xbffd('0x8')]){logger[_0xbffd('0x1d')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x333fac[_0xbffd('0x8')]&&!_0x333fac[_0xbffd('0x1f')]&&_0x333fac[_0xbffd('0x8')]==_0x5a8119[_0xbffd('0x8')]){return _0x348f6b;}return _0x348f6b[_0xbffd('0x20')]({'data1':_0x4666c2,'data2':null,'license':_0x5a8119['license']});}else{if(_0x5a8119[_0xbffd('0x8')]||_0x333fac[_0xbffd('0x8')]){if(!_0x333fac['data2']){if(_0x333fac[_0xbffd('0x21')]==_0x4666c2){GRAY_PERIOD_REASON=_0xbffd('0x22');logger[_0xbffd('0x1d')](_0xbffd('0x23'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x333fac[_0xbffd('0x21')];logger['info'](_0xbffd('0x24'),_0x333fac['data1'],_0x4666c2);}sendJiraAlert(_0x333fac[_0xbffd('0x21')],_0x5a8119['uuid'],GRAY_PERIOD_REASON);logger[_0xbffd('0x1d')](_0xbffd('0x25'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xbffd('0x26')]('YYYY-MM-DD\x20HH:mm'));return _0x348f6b[_0xbffd('0x20')]({'data2':encryptor[_0xbffd('0x27')](moment()['format'](_0xbffd('0x28')))});}else{if(moment()[_0xbffd('0x29')](encryptor[_0xbffd('0x2a')](_0x333fac[_0xbffd('0x1f')]),_0xbffd('0x2b'))>DAYS){logger[_0xbffd('0x1d')](_0xbffd('0x2c'),moment()[_0xbffd('0x26')](_0xbffd('0x28')));return _0x348f6b[_0xbffd('0x20')]({'data1':_0x4666c2,'data2':null,'license':null});}}}else{if(_0x333fac[_0xbffd('0x21')]!=_0x4666c2){logger[_0xbffd('0x1d')](_0xbffd('0x24'),_0x333fac[_0xbffd('0x21')],_0x4666c2);return _0x348f6b[_0xbffd('0x20')]({'data1':_0x4666c2,'data2':null,'license':null});}}}return _0x348f6b;})[_0xbffd('0x15')](function(_0xfdb41){_0x348f6b=_0xfdb41;})[_0xbffd('0xe')](function(_0x19586c){logger[_0xbffd('0x2d')](_0x19586c[_0xbffd('0x2e')]);})[_0xbffd('0x2f')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x348f6b);},TIME);});}function defaultLicense(){var _0x5c55df=hardware['getUuid']();if(_0x5c55df){return db[_0xbffd('0x30')][_0xbffd('0x31')]({'where':{'id':0x1},'defaults':{'data1':_0x5c55df}})[_0xbffd('0x32')](function(_0x33f180,_0x4b96bb){logger[_0xbffd('0x1d')](_0xbffd('0x33'),_0x5c55df);manageLicense(_0x5c55df,_0x33f180);})[_0xbffd('0xe')](function(_0xe2ed23){logger[_0xbffd('0x2d')](_0xe2ed23[_0xbffd('0x2e')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x4c68=['|name|','email','getFirstInterface','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','Alert','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','update','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','error','util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','User','findOne','fullname','|reason|','|uuid|'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4c68,0x12c));var _0x84c6=function(_0xb7f071,_0x34134a){_0xb7f071=_0xb7f071-0x0;var _0xdc2c6d=_0x4c68[_0xb7f071];return _0xdc2c6d;};'use strict';var util=require(_0x84c6('0x0'));var moment=require(_0x84c6('0x1'));var rp=require(_0x84c6('0x2'));var BPromise=require(_0x84c6('0x3'));var pkginfo=require('pkginfo')(module,_0x84c6('0x4'));var db=require(_0x84c6('0x5'))['db'];var encryptor=require(_0x84c6('0x6'));var hardware=require(_0x84c6('0x7'));var logger=require(_0x84c6('0x8'))(_0x84c6('0x9'));var jira=require(_0x84c6('0xa'));const {config}=require('process');var HOST=_0x84c6('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x11a3a6){return new BPromise(function(_0x4dc04c,_0x173dd7){var _0xff5c7d=util[_0x84c6('0xc')](_0x84c6('0xd'),HOST,_0x11a3a6,module[_0x84c6('0xe')][_0x84c6('0x4')]);if(oldToken){_0xff5c7d=util['format'](_0x84c6('0xf'),HOST,_0x11a3a6,module[_0x84c6('0xe')][_0x84c6('0x4')],oldToken);}var _0x2e2c78={'uri':_0xff5c7d,'method':_0x84c6('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x2e2c78)[_0x84c6('0x11')](function(_0x5be1b0){_0x4dc04c(_0x5be1b0);})[_0x84c6('0x12')](function(_0x35063b){_0x173dd7(_0x35063b);});});}function sendJiraAlert(_0x4ab351,_0x12424f,_0x162e8f){var _0x171c01='||FIELD||VALUE||\x0a';return db[_0x84c6('0x13')][_0x84c6('0x14')]({'where':{'role':'admin'},'attributes':[_0x84c6('0x15'),'email'],'raw':!![]})[_0x84c6('0x11')](function(_0x4d2862){ADMIN=_0x4d2862;_0x171c01+=_0x84c6('0x16')+_0x162e8f+'|\x0a';_0x171c01+=_0x84c6('0x17')+_0x4ab351+'|\x0a';_0x171c01+='|machineUuid|'+_0x12424f+'|\x0a';_0x171c01+=_0x84c6('0x18')+ADMIN[_0x84c6('0x15')]+'|\x0a';_0x171c01+='|email|'+ADMIN[_0x84c6('0x19')]+'|\x0a';return _0x171c01;})['then'](function(_0x9efec9){var _0x969075=hardware[_0x84c6('0x1a')]()[_0x84c6('0x1b')];return jira['openIssue']({'key':_0x84c6('0x1c'),'summary':_0x84c6('0x1d'),'description':_0x9efec9,'issuetype':_0x84c6('0x1e'),'oldToken':_0x4ab351,'newToken':_0x12424f,'email':ADMIN[_0x84c6('0x19')],'name':ADMIN[_0x84c6('0x15')],'reason':GRAY_PERIOD_REASON,'ip':_0x969075});});}function manageLicense(_0x5e1588,_0x5e85fd){var _0x49040f=_0x5e85fd['get']({'plain':!![]});httpRequest(_0x5e1588)[_0x84c6('0x11')](function(_0x18bd85){if(oldToken){oldToken=undefined;}if(_0x18bd85[_0x84c6('0x1f')]){if(!_0x49040f[_0x84c6('0x9')]&&_0x49040f[_0x84c6('0x9')]!=_0x18bd85[_0x84c6('0x9')]||_0x49040f['license']&&_0x49040f[_0x84c6('0x20')]){logger['info'](_0x84c6('0x21'));}if(_0x49040f[_0x84c6('0x9')]&&!_0x49040f[_0x84c6('0x20')]&&_0x49040f['license']!=_0x18bd85[_0x84c6('0x9')]){logger[_0x84c6('0x22')](_0x84c6('0x23'));}if(_0x49040f[_0x84c6('0x9')]&&!_0x49040f[_0x84c6('0x20')]&&_0x49040f[_0x84c6('0x9')]==_0x18bd85[_0x84c6('0x9')]){return _0x5e85fd;}return _0x5e85fd['update']({'data1':_0x5e1588,'data2':null,'license':_0x18bd85[_0x84c6('0x9')]});}else{if(_0x18bd85[_0x84c6('0x9')]||_0x49040f[_0x84c6('0x9')]){if(!_0x49040f[_0x84c6('0x20')]){if(_0x49040f[_0x84c6('0x24')]==_0x5e1588){GRAY_PERIOD_REASON=_0x84c6('0x25');logger['info'](_0x84c6('0x26'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x49040f['data1'];logger[_0x84c6('0x22')](_0x84c6('0x27'),_0x49040f[_0x84c6('0x24')],_0x5e1588);}sendJiraAlert(_0x49040f[_0x84c6('0x24')],_0x18bd85[_0x84c6('0x28')],GRAY_PERIOD_REASON);logger['info'](_0x84c6('0x29'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x84c6('0xc')](_0x84c6('0x2a')));return _0x5e85fd[_0x84c6('0x2b')]({'data2':encryptor[_0x84c6('0x2c')](moment()[_0x84c6('0xc')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x84c6('0x2d')](_0x49040f['data2']),_0x84c6('0x2e'))>DAYS){logger[_0x84c6('0x22')](_0x84c6('0x2f'),moment()[_0x84c6('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x5e85fd[_0x84c6('0x2b')]({'data1':_0x5e1588,'data2':null,'license':null});}}}else{if(_0x49040f[_0x84c6('0x24')]!=_0x5e1588){logger[_0x84c6('0x22')](_0x84c6('0x27'),_0x49040f[_0x84c6('0x24')],_0x5e1588);return _0x5e85fd[_0x84c6('0x2b')]({'data1':_0x5e1588,'data2':null,'license':null});}}}return _0x5e85fd;})[_0x84c6('0x11')](function(_0xedaea1){_0x5e85fd=_0xedaea1;})['catch'](function(_0x457e75){logger['error'](_0x457e75[_0x84c6('0x30')]);})[_0x84c6('0x31')](function(){setTimeout(function(){manageLicense(hardware[_0x84c6('0x32')](),_0x5e85fd);},TIME);});}function defaultLicense(){var _0x34982d=hardware[_0x84c6('0x32')]();if(_0x34982d){return db[_0x84c6('0x33')][_0x84c6('0x34')]({'where':{'id':0x1},'defaults':{'data1':_0x34982d}})['spread'](function(_0x361e19,_0x55c363){logger[_0x84c6('0x22')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x34982d);manageLicense(_0x34982d,_0x361e19);})[_0x84c6('0x12')](function(_0x672126){logger[_0x84c6('0x35')](_0x672126[_0x84c6('0x30')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index d089119..da44fcb 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 _0x6951=['users','telephones','user','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','uuid','license','License\x20key\x20value\x20not\x20found','split','decryptString','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','format','grayReason','changed','disabled','data1','message','findAll','role','sequelize','COUNT','col','count','admin','telephone'];(function(_0x4ec520,_0x15fee2){var _0xed49d7=function(_0x3031f2){while(--_0x3031f2){_0x4ec520['push'](_0x4ec520['shift']());}};_0xed49d7(++_0x15fee2);}(_0x6951,0x9a));var _0x1695=function(_0x5adbf1,_0x44ca47){_0x5adbf1=_0x5adbf1-0x0;var _0x5b2e24=_0x6951[_0x5adbf1];return _0x5b2e24;};'use strict';var util=require(_0x1695('0x0'));var _=require(_0x1695('0x1'));var moment=require(_0x1695('0x2'));var BPromise=require(_0x1695('0x3'));var hardware=require(_0x1695('0x4'));var encryptor=require(_0x1695('0x5'));var db=require(_0x1695('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1695('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x1695('0x8'),'machineUuid':hardware[_0x1695('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x1695('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x1695('0xa'),'machineUuid':hardware[_0x1695('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x19440f){return new BPromise(function(_0x411cc1,_0x2ff2d3){return db[_0x1695('0xb')][_0x1695('0xc')](_[_0x1695('0xd')](_0x19440f,{'raw':!![],'where':{'id':0x1}}))[_0x1695('0xe')](function(_0x260fcd){return checkLicense(_0x260fcd,null);})['then'](function(_0x560b9e){_0x411cc1(_0x560b9e);return;})['catch'](function(_0x524867){_0x2ff2d3(_0x524867);});});}function checkLicense(_0x317c98,_0x4188ee){if(!_0x317c98){demoLicense[_0x1695('0xf')]=_0x317c98['data1'];return demoLicense;}try{var _0xebac07=_0x4188ee||_0x317c98[_0x1695('0x10')];if(_['isEmpty'](_0xebac07)){throw new Error(_0x1695('0x11'));}var _0x401268=_0x317c98['data1'];var _0x5112a8=_0x317c98['data2'];var _0x24e307=_0x401268[_0x1695('0x12')]('-')[0x4];var _0x359c79=_0x401268[_0x1695('0x12')]('-')[0x0];var _0x5f17b0=encryptor[_0x1695('0x13')](_0xebac07,util['format'](_0x1695('0x14'),_0x24e307,_0x401268,_0x359c79));var _0x340ef7=JSON[_0x1695('0x15')](_0x5f17b0);_0x340ef7[_0x1695('0x16')]=![];_0x340ef7[_0x1695('0xf')]=_0x401268;_0x340ef7[_0x1695('0x17')]=hardware[_0x1695('0x9')]();if(_0x5112a8){var _0x4b4944=encryptor[_0x1695('0x13')](_0x5112a8);_0x340ef7[_0x1695('0x18')]=_0x4b4944;_0x340ef7[_0x1695('0x19')]=moment(_0x4b4944)[_0x1695('0x1a')](0x7,_0x1695('0x1b'))[_0x1695('0x1c')]();_0x340ef7[_0x1695('0x1d')]=_0x340ef7[_0x1695('0xf')]!=_0x340ef7[_0x1695('0x17')]?_0x1695('0x1e'):_0x1695('0x1f');}return _0x340ef7;}catch(_0x549d2e){breakingLicense[_0x1695('0xf')]=_0x317c98[_0x1695('0x20')];breakingLicense[_0x1695('0x21')]=_0x549d2e[_0x1695('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1e5c82,_0x2edffe){getLicense()[_0x1695('0xe')](function(_0x1e2f48){return db['User'][_0x1695('0x22')]({'attributes':[_0x1695('0x23'),[db[_0x1695('0x24')]['fn'](_0x1695('0x25'),db[_0x1695('0x24')][_0x1695('0x26')](_0x1695('0x23'))),_0x1695('0x27')]],'group':_0x1695('0x23'),'where':{'role':{'$or':[_0x1695('0x28'),'user',_0x1695('0x29')]}},'raw':!![]})[_0x1695('0xe')](function(_0x30b343){var _0x4378fc={'user':_0x1e2f48[_0x1695('0x2a')]||0x0,'telephone':_0x1e2f48[_0x1695('0x2b')]||0x0};_0x30b343['forEach'](function(_0x3711ab){var _0x8e8ff5=_0x3711ab[_0x1695('0x23')]===_0x1695('0x28')?_0x1695('0x2c'):_0x3711ab[_0x1695('0x23')];_0x4378fc[_0x8e8ff5]-=_0x3711ab['count'];if(_0x4378fc[_0x8e8ff5]<0x0)_0x4378fc[_0x8e8ff5]=0x0;});_0x1e5c82(_0x4378fc);return;});})[_0x1695('0x2d')](function(_0x492f1f){_0x2edffe(_0x492f1f);});});}function checkUserLimits(_0x2bd930){return new BPromise(function(_0x2542cb,_0x2e328a){getLimits()[_0x1695('0xe')](function(_0x38788f){var _0xafb1d5=_[_0x1695('0x2e')](_[_0x1695('0x2f')](_0x2bd930,'role'),[_0x1695('0x28'),_0x1695('0x2c'),_0x1695('0x29')]);var _0x4d10b7=(_0xafb1d5[_0x1695('0x28')]||0x0)+(_0xafb1d5[_0x1695('0x2c')]||0x0);var _0x41ceca=_0xafb1d5[_0x1695('0x29')]||0x0;if(_0x4d10b7>_0x38788f['user'])return _0x2e328a(_0x1695('0x30'));if(_0x41ceca>_0x38788f[_0x1695('0x29')])return _0x2e328a('License\x20limit\x20reached\x20for\x20telephones');return _0x2542cb();})[_0x1695('0x2d')](function(_0x34a140){_0x2e328a(_0x34a140);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x2332=['user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','find','defaults','then','catch','uuid','data1','isEmpty','data2','split','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','grayReason','disabled','message','User','findAll','role','count','admin','telephone','telephones','forEach','pick'];(function(_0x101a01,_0x18bd83){var _0x538e92=function(_0x3ed902){while(--_0x3ed902){_0x101a01['push'](_0x101a01['shift']());}};_0x538e92(++_0x18bd83);}(_0x2332,0x187));var _0x2233=function(_0x1a7f5b,_0x2821e9){_0x1a7f5b=_0x1a7f5b-0x0;var _0x464a32=_0x2332[_0x1a7f5b];return _0x464a32;};'use strict';var util=require(_0x2233('0x0'));var _=require(_0x2233('0x1'));var moment=require(_0x2233('0x2'));var BPromise=require('bluebird');var hardware=require(_0x2233('0x3'));var encryptor=require(_0x2233('0x4'));var db=require(_0x2233('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2233('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x2233('0x7'),'machineUuid':hardware[_0x2233('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x2233('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x13f6ac){return new BPromise(function(_0x5afa13,_0x5d2c7d){return db['License'][_0x2233('0x9')](_[_0x2233('0xa')](_0x13f6ac,{'raw':!![],'where':{'id':0x1}}))[_0x2233('0xb')](function(_0x4cfa1f){return checkLicense(_0x4cfa1f,null);})['then'](function(_0x206478){_0x5afa13(_0x206478);return;})[_0x2233('0xc')](function(_0x7fc3d0){_0x5d2c7d(_0x7fc3d0);});});}function checkLicense(_0x588874,_0x1536e5){if(!_0x588874){demoLicense[_0x2233('0xd')]=_0x588874[_0x2233('0xe')];return demoLicense;}try{var _0x3dd602=_0x1536e5||_0x588874['license'];if(_[_0x2233('0xf')](_0x3dd602)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xd98bd3=_0x588874[_0x2233('0xe')];var _0x430a21=_0x588874[_0x2233('0x10')];var _0x341fce=_0xd98bd3['split']('-')[0x4];var _0x195097=_0xd98bd3[_0x2233('0x11')]('-')[0x0];var _0x576fa5=encryptor['decryptString'](_0x3dd602,util[_0x2233('0x12')](_0x2233('0x13'),_0x341fce,_0xd98bd3,_0x195097));var _0x20b189=JSON[_0x2233('0x14')](_0x576fa5);_0x20b189[_0x2233('0x15')]=![];_0x20b189['uuid']=_0xd98bd3;_0x20b189[_0x2233('0x16')]=hardware[_0x2233('0x8')]();if(_0x430a21){var _0x5e86ac=encryptor['decryptString'](_0x430a21);_0x20b189[_0x2233('0x17')]=_0x5e86ac;_0x20b189[_0x2233('0x18')]=moment(_0x5e86ac)[_0x2233('0x19')](0x7,_0x2233('0x1a'))[_0x2233('0x12')]();_0x20b189[_0x2233('0x1b')]=_0x20b189[_0x2233('0xd')]!=_0x20b189['machineUuid']?'changed':_0x2233('0x1c');}return _0x20b189;}catch(_0x54c7b7){breakingLicense[_0x2233('0xd')]=_0x588874[_0x2233('0xe')];breakingLicense[_0x2233('0x1d')]=_0x54c7b7['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x11114d,_0x300a6e){getLicense()[_0x2233('0xb')](function(_0x4400e5){return db[_0x2233('0x1e')][_0x2233('0x1f')]({'attributes':[_0x2233('0x20'),[db['sequelize']['fn']('COUNT',db['sequelize']['col'](_0x2233('0x20'))),_0x2233('0x21')]],'group':'role','where':{'role':{'$or':[_0x2233('0x22'),'user',_0x2233('0x23')]}},'raw':!![]})[_0x2233('0xb')](function(_0x187fd8){var _0x5b1bdf={'user':_0x4400e5['users']||0x0,'telephone':_0x4400e5[_0x2233('0x24')]||0x0};_0x187fd8[_0x2233('0x25')](function(_0x2e6da0){var _0x5de5cc=_0x2e6da0[_0x2233('0x20')]===_0x2233('0x22')?'user':_0x2e6da0['role'];_0x5b1bdf[_0x5de5cc]-=_0x2e6da0[_0x2233('0x21')];if(_0x5b1bdf[_0x5de5cc]<0x0)_0x5b1bdf[_0x5de5cc]=0x0;});_0x11114d(_0x5b1bdf);return;});})[_0x2233('0xc')](function(_0x29e05b){_0x300a6e(_0x29e05b);});});}function checkUserLimits(_0x39f455){return new BPromise(function(_0x1ede07,_0x43aade){getLimits()[_0x2233('0xb')](function(_0x5a201b){var _0x51b964=_[_0x2233('0x26')](_['countBy'](_0x39f455,_0x2233('0x20')),[_0x2233('0x22'),_0x2233('0x27'),_0x2233('0x23')]);var _0x43d7df=(_0x51b964['admin']||0x0)+(_0x51b964[_0x2233('0x27')]||0x0);var _0x29c7d3=_0x51b964[_0x2233('0x23')]||0x0;if(_0x43d7df>_0x5a201b[_0x2233('0x27')])return _0x43aade(_0x2233('0x28'));if(_0x29c7d3>_0x5a201b['telephone'])return _0x43aade(_0x2233('0x29'));return _0x1ede07();})[_0x2233('0xc')](function(_0x426577){_0x43aade(_0x426577);});});}module[_0x2233('0x2a')]={'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 3866cdc..66a02c6 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 _0xaf1c=['app-id','secret','exports','myappanuglar-secret'];(function(_0x5ebe34,_0x421337){var _0x36a3ee=function(_0x1d3306){while(--_0x1d3306){_0x5ebe34['push'](_0x5ebe34['shift']());}};_0x36a3ee(++_0x421337);}(_0xaf1c,0xea));var _0xcaf1=function(_0x20ef59,_0x514ff8){_0x20ef59=_0x20ef59-0x0;var _0x3c97ab=_0xaf1c[_0x20ef59];return _0x3c97ab;};'use strict';module[_0xcaf1('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xcaf1('0x1'),'GOOGLE_ID':_0xcaf1('0x2'),'GOOGLE_SECRET':_0xcaf1('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xc70f=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x533d66,_0x558e5f){var _0x541b95=function(_0x525b42){while(--_0x525b42){_0x533d66['push'](_0x533d66['shift']());}};_0x541b95(++_0x558e5f);}(_0xc70f,0x18d));var _0xfc70=function(_0x305505,_0x2f60c6){_0x305505=_0x305505-0x0;var _0x712ff6=_0xc70f[_0x305505];return _0x712ff6;};'use strict';module[_0xfc70('0x0')]={'DOMAIN':_0xfc70('0x1'),'SESSION_SECRET':_0xfc70('0x2'),'GOOGLE_ID':_0xfc70('0x3'),'GOOGLE_SECRET':_0xfc70('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 808763a..7034c7a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebde=['env','moment','winston','util','join','/var','log','xcally','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','exports','Logger','transports','error','File','%s-%s','info','Console'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xebde,0xb9));var _0xeebd=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0xebde[_0x242a4f];return _0x122117;};'use strict';var moment=require(_0xeebd('0x0'));var winston=require(_0xeebd('0x1'));var util=require(_0xeebd('0x2'));var path=require('path');var debugLevel='INFO';function filename(_0x49c350,_0x749349){return path[_0xeebd('0x3')](_0xeebd('0x4'),_0xeebd('0x5'),_0xeebd('0x6'),util[_0xeebd('0x7')]('%s-%s.log',_0x49c350,_0x749349));}function formatter(_0x1c6b4f,_0x2ac9b7){_0x2ac9b7['message']=_0x2ac9b7[_0xeebd('0x8')][_0xeebd('0x9')](/@@{/g,_0xeebd('0xa'))[_0xeebd('0x9')](/}@@/g,_0xeebd('0xb'))['replace'](/@{/g,'{{')[_0xeebd('0x9')](/}@/g,'}}');return util[_0xeebd('0x7')](_0xeebd('0xc'),moment()[_0xeebd('0x7')](_0xeebd('0xd')),_0x2ac9b7['level']['toUpperCase'](),_0x1c6b4f,_0x2ac9b7[_0xeebd('0x8')]);}module[_0xeebd('0xe')]=function(_0x2a5cbf){return new winston[(_0xeebd('0xf'))]({'transports':[new winston[(_0xeebd('0x10'))]['File']({'name':util[_0xeebd('0x7')]('%s-%s',_0x2a5cbf,_0xeebd('0x11')),'filename':filename(_0x2a5cbf,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc1906e){return formatter(_0x2a5cbf,_0xc1906e);}}),new winston[(_0xeebd('0x10'))][(_0xeebd('0x12'))]({'name':util['format'](_0xeebd('0x13'),_0x2a5cbf,_0xeebd('0x14')),'filename':filename(_0x2a5cbf,'info'),'level':_0xeebd('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3ae025){return formatter(_0x2a5cbf,_0x3ae025);}}),new winston[(_0xeebd('0x10'))][(_0xeebd('0x15'))]({'level':process[_0xeebd('0x16')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x416584){return formatter(_0x2a5cbf,_0x416584);}})]});}; \ No newline at end of file +var _0x9700=['level','toUpperCase','exports','Logger','transports','File','error','info','Console','env','debugLevel','util','path','INFO','join','/var','log','xcally','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x102b13,_0x27df4c){var _0x266b08=function(_0x4962c9){while(--_0x4962c9){_0x102b13['push'](_0x102b13['shift']());}};_0x266b08(++_0x27df4c);}(_0x9700,0x88));var _0x0970=function(_0x4753c8,_0x18603f){_0x4753c8=_0x4753c8-0x0;var _0x420151=_0x9700[_0x4753c8];return _0x420151;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0x0970('0x0'));var path=require(_0x0970('0x1'));var debugLevel=_0x0970('0x2');function filename(_0xc36a60,_0x3ef267){return path[_0x0970('0x3')](_0x0970('0x4'),_0x0970('0x5'),_0x0970('0x6'),util[_0x0970('0x7')]('%s-%s.log',_0xc36a60,_0x3ef267));}function formatter(_0x193c43,_0x363bf8){_0x363bf8[_0x0970('0x8')]=_0x363bf8[_0x0970('0x8')][_0x0970('0x9')](/@@{/g,_0x0970('0xa'))['replace'](/}@@/g,_0x0970('0xb'))[_0x0970('0x9')](/@{/g,'{{')[_0x0970('0x9')](/}@/g,'}}');return util[_0x0970('0x7')](_0x0970('0xc'),moment()['format'](_0x0970('0xd')),_0x363bf8[_0x0970('0xe')][_0x0970('0xf')](),_0x193c43,_0x363bf8[_0x0970('0x8')]);}module[_0x0970('0x10')]=function(_0xfeb289){return new winston[(_0x0970('0x11'))]({'transports':[new winston[(_0x0970('0x12'))][(_0x0970('0x13'))]({'name':util[_0x0970('0x7')]('%s-%s',_0xfeb289,_0x0970('0x14')),'filename':filename(_0xfeb289,'error'),'level':_0x0970('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1cb8e4){return formatter(_0xfeb289,_0x1cb8e4);}}),new winston[(_0x0970('0x12'))][(_0x0970('0x13'))]({'name':util['format']('%s-%s',_0xfeb289,_0x0970('0x15')),'filename':filename(_0xfeb289,_0x0970('0x15')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x516cd6){return formatter(_0xfeb289,_0x516cd6);}}),new winston[(_0x0970('0x12'))][(_0x0970('0x16'))]({'level':process[_0x0970('0x17')][_0x0970('0x18')]||debugLevel,'json':![],'formatter':function(_0x47670c){return formatter(_0xfeb289,_0x47670c);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 131b5cc..effda8f 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 _0x3bff=['../../services/express/index.js','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','../../services/routing/index.js','exports','path','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bff,0xd0));var _0xf3bf=function(_0x774583,_0x5f1519){_0x774583=_0x774583-0x0;var _0xa751f4=_0x3bff[_0x774583];return _0xa751f4;};'use strict';var path=require(_0xf3bf('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xf3bf('0x1')](__dirname,_0xf3bf('0x2'))},{'name':'ami','script':path[_0xf3bf('0x1')](__dirname,_0xf3bf('0x3'))},{'name':_0xf3bf('0x4'),'script':path[_0xf3bf('0x1')](__dirname,'../../services/agi/index.js')},{'name':_0xf3bf('0x5'),'script':path['join'](__dirname,_0xf3bf('0x6'))},{'name':_0xf3bf('0x7'),'script':path[_0xf3bf('0x1')](__dirname,_0xf3bf('0x8'))},{'name':'xdr','script':path[_0xf3bf('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0xf3bf('0x9')]=config; \ No newline at end of file +var _0x4c3c=['express','../../services/express/index.js','../../services/ami/index.js','../../services/agi/index.js','email','join','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4c3c,0x1e3));var _0xc4c3=function(_0xf25c17,_0x288f2c){_0xf25c17=_0xf25c17-0x0;var _0x429736=_0x4c3c[_0xf25c17];return _0x429736;};'use strict';var path=require(_0xc4c3('0x0'));var os=require('os');var config={'apps':[{'name':_0xc4c3('0x1'),'script':path['join'](__dirname,_0xc4c3('0x2'))},{'name':'ami','script':path['join'](__dirname,_0xc4c3('0x3'))},{'name':'agi','script':path['join'](__dirname,_0xc4c3('0x4'))},{'name':_0xc4c3('0x5'),'script':path[_0xc4c3('0x6')](__dirname,_0xc4c3('0x7'))},{'name':_0xc4c3('0x8'),'script':path[_0xc4c3('0x6')](__dirname,_0xc4c3('0x9'))},{'name':'xdr','script':path[_0xc4c3('0x6')](__dirname,_0xc4c3('0xa'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 3061994..7a4b4c2 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 _0x24ca=['disconnect','stop','restart','list','describe','delete','dump','saved','pm2','connect','connected','then'];(function(_0x57645b,_0x25f73a){var _0xe82f00=function(_0x526b4){while(--_0x526b4){_0x57645b['push'](_0x57645b['shift']());}};_0xe82f00(++_0x25f73a);}(_0x24ca,0x8c));var _0xa24c=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x24ca[_0x52f1e6];return _0x21f104;};'use strict';var pm2=require(_0xa24c('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x1f4ee1,_0x4e90b0){return pm2[_0xa24c('0x1')](function(_0x1efd39){if(_0x1efd39){return _0x4e90b0(_0x1efd39);}return _0x1f4ee1(_0xa24c('0x2'));});});};exports['start']=function(_0x2fbcfa){return connect()[_0xa24c('0x3')](function(){return new BPromise(function(_0x4707f9,_0x5a37ae){return pm2['start'](_0x2fbcfa,function(_0x52147a,_0x2288d4){if(_0x52147a){return _0x5a37ae(_0x52147a);}pm2[_0xa24c('0x4')]();return _0x4707f9(_0x2288d4);});});});};exports[_0xa24c('0x5')]=function(_0x3c3959){return connect()[_0xa24c('0x3')](function(){return new BPromise(function(_0x87c265,_0x5bedc6){return pm2[_0xa24c('0x5')](_0x3c3959,function(_0x413b3d,_0x355882){if(_0x413b3d){return _0x5bedc6(_0x413b3d);}pm2['disconnect']();return _0x87c265(_0x355882);});});});};exports['restart']=function(_0x1331f4){return connect()[_0xa24c('0x3')](function(){return new BPromise(function(_0x2da0c3,_0x1e9b6a){return pm2[_0xa24c('0x6')](_0x1331f4,function(_0x1d06da,_0x566313){if(_0x1d06da){return _0x1e9b6a(_0x1d06da);}pm2['disconnect']();return _0x2da0c3(_0x566313);});});});};exports['list']=function(){return connect()[_0xa24c('0x3')](function(){return new BPromise(function(_0x23bd58,_0x337c8a){return pm2[_0xa24c('0x7')](function(_0x4351a8,_0x4971af){if(_0x4351a8){return _0x337c8a(_0x4351a8);}pm2[_0xa24c('0x4')]();return _0x23bd58(_0x4971af);});});});};exports['describe']=function(_0x493bcb){return connect()['then'](function(){return new BPromise(function(_0x2e8dc9,_0x2a4270){return pm2[_0xa24c('0x8')](_0x493bcb,function(_0x267762,_0x204e7a){if(_0x267762){return _0x2a4270(_0x267762);}pm2[_0xa24c('0x4')]();return _0x2e8dc9(_0x204e7a);});});});};exports[_0xa24c('0x9')]=function(_0x32a226){return connect()[_0xa24c('0x3')](function(){return new BPromise(function(_0x117177,_0x1970fc){return pm2[_0xa24c('0x9')](_0x32a226,function(_0x278cce,_0x3e4e81){if(_0x278cce){return _0x1970fc(_0x278cce);}pm2['disconnect']();return _0x117177(_0x3e4e81);});});});};exports[_0xa24c('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x98802d,_0xf9f8bd){return pm2[_0xa24c('0xa')](function(_0x37e20e){if(_0x37e20e){return _0xf9f8bd(_0x37e20e);}return _0x98802d(_0xa24c('0xb'));});});});}; \ No newline at end of file +var _0xa777=['restart','list','describe','delete','dump','saved','bluebird','./config','connect','connected','start','then','stop','disconnect'];(function(_0xd06c4a,_0xf491bc){var _0x479b00=function(_0x5d296c){while(--_0x5d296c){_0xd06c4a['push'](_0xd06c4a['shift']());}};_0x479b00(++_0xf491bc);}(_0xa777,0x102));var _0x7a77=function(_0x5c0e7c,_0x4c1de3){_0x5c0e7c=_0x5c0e7c-0x0;var _0x2567da=_0xa777[_0x5c0e7c];return _0x2567da;};'use strict';var pm2=require('pm2');var BPromise=require(_0x7a77('0x0'));var config=require(_0x7a77('0x1'));function connect(){return new BPromise(function(_0xfaf6a7,_0x2ad543){return pm2[_0x7a77('0x2')](function(_0x4f3b32){if(_0x4f3b32){return _0x2ad543(_0x4f3b32);}return _0xfaf6a7(_0x7a77('0x3'));});});};exports[_0x7a77('0x4')]=function(_0x175bae){return connect()[_0x7a77('0x5')](function(){return new BPromise(function(_0x4d4b58,_0x493a5f){return pm2[_0x7a77('0x4')](_0x175bae,function(_0x931f18,_0x500859){if(_0x931f18){return _0x493a5f(_0x931f18);}pm2['disconnect']();return _0x4d4b58(_0x500859);});});});};exports[_0x7a77('0x6')]=function(_0x3d14a3){return connect()['then'](function(){return new BPromise(function(_0x43f0a7,_0x239a17){return pm2[_0x7a77('0x6')](_0x3d14a3,function(_0x1acc0a,_0x453772){if(_0x1acc0a){return _0x239a17(_0x1acc0a);}pm2[_0x7a77('0x7')]();return _0x43f0a7(_0x453772);});});});};exports[_0x7a77('0x8')]=function(_0x3404f6){return connect()['then'](function(){return new BPromise(function(_0x164dad,_0x64c667){return pm2[_0x7a77('0x8')](_0x3404f6,function(_0x14a467,_0x2331d6){if(_0x14a467){return _0x64c667(_0x14a467);}pm2['disconnect']();return _0x164dad(_0x2331d6);});});});};exports[_0x7a77('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1e6c9a,_0x1283f3){return pm2['list'](function(_0x424d6e,_0x1af6d9){if(_0x424d6e){return _0x1283f3(_0x424d6e);}pm2['disconnect']();return _0x1e6c9a(_0x1af6d9);});});});};exports[_0x7a77('0xa')]=function(_0x361e30){return connect()[_0x7a77('0x5')](function(){return new BPromise(function(_0x3547db,_0x4f36d3){return pm2['describe'](_0x361e30,function(_0x2bc2d3,_0x592a36){if(_0x2bc2d3){return _0x4f36d3(_0x2bc2d3);}pm2['disconnect']();return _0x3547db(_0x592a36);});});});};exports['delete']=function(_0x176a57){return connect()['then'](function(){return new BPromise(function(_0x399a41,_0x4d0405){return pm2[_0x7a77('0xb')](_0x176a57,function(_0x22d04b,_0x241b30){if(_0x22d04b){return _0x4d0405(_0x22d04b);}pm2['disconnect']();return _0x399a41(_0x241b30);});});});};exports[_0x7a77('0xc')]=function(){return connect()[_0x7a77('0x5')](function(){return new BPromise(function(_0x9e81f4,_0x104688){return pm2[_0x7a77('0xc')](function(_0x2299bf){if(_0x2299bf){return _0x104688(_0x2299bf);}return _0x9e81f4(_0x7a77('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index edddb1f..3d1957a 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 _0xa74e=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','schedule','defaults','redis','socket.io-emitter','Setting','find','chatTimeout','findAll','subtract','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa74e,0x1dc));var _0xea74=function(_0x4af49b,_0x2fd0bd){_0x4af49b=_0x4af49b-0x0;var _0x415b01=_0xa74e[_0x4af49b];return _0x415b01;};'use strict';var _=require('lodash');var moment=require(_0xea74('0x0'));var Redis=require(_0xea74('0x1'));var util=require(_0xea74('0x2'));var config=require(_0xea74('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xea74('0x4'));config['redis']=_[_0xea74('0x5')](config[_0xea74('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xea74('0x7'))(new Redis(config[_0xea74('0x6')]));function closeInteractions(){var _0xd6f5a6=0x0;var _0x2038ae=[];return db[_0xea74('0x8')][_0xea74('0x9')]({'raw':!![],'attributes':['id',_0xea74('0xa')],'where':{'id':0x1}})['then'](function(_0x3d08d7){_0xd6f5a6=_0x3d08d7[_0xea74('0xa')];if(_0xd6f5a6){return db['ChatInteraction'][_0xea74('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xea74('0xc')](_0x3d08d7['chatTimeout'],'minutes')}}});}else{return[];}})['then'](function(_0x2fbe6b){if(_0x2fbe6b&&_0x2fbe6b[_0xea74('0xd')]){_0x2038ae=_[_0xea74('0xe')](_0x2fbe6b||[],'id');logger[_0xea74('0xf')](_0xea74('0x10'),_0x2038ae[_0xea74('0x11')]());return db[_0xea74('0x12')][_0xea74('0x13')]({'closeReason':_0xea74('0x14'),'disposition':_0xea74('0x15'),'closed':!![],'closedAt':moment()[_0xea74('0x16')](_0xea74('0x17'))},{'where':{'id':_0x2038ae}});}})[_0xea74('0x18')](function(){if(_0x2038ae&&_0x2038ae[_0xea74('0xd')]){logger[_0xea74('0xf')](_0xea74('0x19'),_0x2038ae['join']());for(var _0x1cd1a8=0x0;_0x1cd1a8<_0x2038ae[_0xea74('0xd')];_0x1cd1a8++){io[_0xea74('0x1a')](_0xea74('0x1b'),{'id':_0x2038ae[_0x1cd1a8],'closed':!![]});}}})[_0xea74('0x1c')](function(_0x22d72e){logger[_0xea74('0x1d')](_0xea74('0x1e'),_0x22d72e?util[_0xea74('0x1f')](_0x22d72e,{'showHidden':![],'depth':null}):'');});}exports[_0xea74('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf13e=['lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','catch','error','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction'];(function(_0x209acf,_0x413882){var _0x10d5b2=function(_0x53853a){while(--_0x53853a){_0x209acf['push'](_0x209acf['shift']());}};_0x10d5b2(++_0x413882);}(_0xf13e,0x190));var _0xef13=function(_0x4bc88a,_0x5f1427){_0x4bc88a=_0x4bc88a-0x0;var _0x5429c0=_0xf13e[_0x4bc88a];return _0x5429c0;};'use strict';var _=require(_0xef13('0x0'));var moment=require(_0xef13('0x1'));var Redis=require(_0xef13('0x2'));var util=require(_0xef13('0x3'));var config=require(_0xef13('0x4'));var db=require(_0xef13('0x5'))['db'];var logger=require(_0xef13('0x6'))(_0xef13('0x7'));config[_0xef13('0x8')]=_[_0xef13('0x9')](config['redis'],{'host':_0xef13('0xa'),'port':0x18eb});var io=require(_0xef13('0xb'))(new Redis(config[_0xef13('0x8')]));function closeInteractions(){var _0x1007a9=0x0;var _0xab06c5=[];return db[_0xef13('0xc')][_0xef13('0xd')]({'raw':!![],'attributes':['id',_0xef13('0xe')],'where':{'id':0x1}})['then'](function(_0xb220bb){_0x1007a9=_0xb220bb[_0xef13('0xe')];if(_0x1007a9){return db[_0xef13('0xf')]['findAll']({'raw':!![],'attributes':['id',_0xef13('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xef13('0x11')](_0xb220bb[_0xef13('0xe')],_0xef13('0x12'))}}});}else{return[];}})[_0xef13('0x13')](function(_0x3d4b26){if(_0x3d4b26&&_0x3d4b26[_0xef13('0x14')]){_0xab06c5=_[_0xef13('0x15')](_0x3d4b26||[],'id');logger[_0xef13('0x16')](_0xef13('0x17'),_0xab06c5[_0xef13('0x18')]());return db['ChatInteraction']['update']({'closeReason':_0xef13('0x19'),'disposition':_0xef13('0x1a'),'closed':!![],'closedAt':moment()['format'](_0xef13('0x1b'))},{'where':{'id':_0xab06c5}});}})[_0xef13('0x13')](function(){if(_0xab06c5&&_0xab06c5[_0xef13('0x14')]){logger[_0xef13('0x16')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0xab06c5[_0xef13('0x18')]());for(var _0x3934e2=0x0;_0x3934e2<_0xab06c5['length'];_0x3934e2++){io['emit'](_0xef13('0x1c'),{'id':_0xab06c5[_0x3934e2],'closed':!![]});}}})[_0xef13('0x1d')](function(_0x19be16){logger[_0xef13('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x19be16?util['inspect'](_0x19be16,{'showHidden':![],'depth':null}):'');});}exports[_0xef13('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 b69fd71..1976c66 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 _0x3acc=['jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','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','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','then','findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','toRun','index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop','stop\x20cron','update\x20cron','lodash','moment'];(function(_0xfcac73,_0x4194c4){var _0x2501ec=function(_0x323801){while(--_0x323801){_0xfcac73['push'](_0xfcac73['shift']());}};_0x2501ec(++_0x4194c4);}(_0x3acc,0x106));var _0xc3ac=function(_0x172c86,_0x2ac5fd){_0x172c86=_0x172c86-0x0;var _0x586de4=_0x3acc[_0x172c86];return _0x586de4;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0xc3ac('0x0'));var moment=require(_0xc3ac('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xc3ac('0x2'));var BPromise=require(_0xc3ac('0x3'));var logger=require(_0xc3ac('0x4'))(_0xc3ac('0x5'));var db=require(_0xc3ac('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xc3ac('0x7'));var client=jayson[_0xc3ac('0x8')][_0xc3ac('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2470bc,_0x59154e){return function(){logger[_0xc3ac('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x2470bc[_0xc3ac('0xb')]);var _0x2e2f60=!![];var _0x2f8c7e={'tls':{'rejectUnauthorized':![]}};if(_0x2470bc[_0xc3ac('0xc')][_0xc3ac('0xd')]['service']){_0x2f8c7e[_0xc3ac('0xe')]=_0x2470bc[_0xc3ac('0xc')]['Smtp'][_0xc3ac('0xe')];}else{_0x2f8c7e[_0xc3ac('0xf')]=_0x2470bc[_0xc3ac('0xc')][_0xc3ac('0xd')]['host'];_0x2f8c7e[_0xc3ac('0x10')]=_0x2470bc[_0xc3ac('0xc')]['Smtp'][_0xc3ac('0x10')];_0x2f8c7e['secure']=_0x2470bc['MailAccount'][_0xc3ac('0xd')][_0xc3ac('0x11')];}if(_0x2470bc['MailAccount']['Smtp'][_0xc3ac('0x12')]){_0x2f8c7e[_0xc3ac('0x13')]={'user':_0x2470bc['MailAccount']['Smtp'][_0xc3ac('0x14')],'pass':_0x2470bc[_0xc3ac('0xc')][_0xc3ac('0xd')][_0xc3ac('0x15')]};}var _0x5c69f5={'account':_0x2f8c7e,'message':{'from':util[_0xc3ac('0x16')](_0xc3ac('0x17'),_0x2470bc['MailAccount'][_0xc3ac('0x18')],_0x2470bc['MailAccount']['email']||_0x2470bc[_0xc3ac('0xc')]['Smtp']['user']),'to':_0x2470bc[_0xc3ac('0xb')],'cc':_0x2470bc['cc'],'bcc':_0x2470bc[_0xc3ac('0x19')],'subject':util[_0xc3ac('0x16')](_0xc3ac('0x1a'),_0x59154e[_0xc3ac('0x18')],_0x2470bc[_0xc3ac('0x1b')],_0x2470bc[_0xc3ac('0x1c')])}};var _0x34e76f=path[_0xc3ac('0x1d')](__dirname,_0xc3ac('0x1e'));var _0x507372=_0x59154e[_0xc3ac('0x1f')];var _0x425954=util[_0xc3ac('0x16')](_0xc3ac('0x20'),path['basename'](_0x59154e[_0xc3ac('0x1f')],path[_0xc3ac('0x21')](_0x59154e[_0xc3ac('0x1f')])),_0xc3ac('0x22'));var _0x2bb1ca=path[_0xc3ac('0x1d')](_0x34e76f,_0x507372);var _0x3a4728=path[_0xc3ac('0x1d')](_0x34e76f,_0x425954);if(fs[_0xc3ac('0x23')](_0x2bb1ca)){_0x59154e[_0xc3ac('0x24')]=_0xc3ac('0x25');_0x5c69f5[_0xc3ac('0x26')][_0xc3ac('0x27')]=[{'filename':_0x507372,'path':_0x2bb1ca}];_0x5c69f5[_0xc3ac('0x26')][_0xc3ac('0x28')]=util[_0xc3ac('0x16')](_0xc3ac('0x29'),JSON[_0xc3ac('0x2a')](_0x59154e,null,0x2));}else if(fs[_0xc3ac('0x23')](_0x3a4728)){_0x59154e[_0xc3ac('0x24')]=_0xc3ac('0x25');_0x5c69f5[_0xc3ac('0x26')][_0xc3ac('0x27')]=[{'filename':_0x425954,'path':_0x3a4728}];}else{_0x5c69f5[_0xc3ac('0x26')][_0xc3ac('0x28')]=_0xc3ac('0x2b');if(!_0x2470bc[_0xc3ac('0x2c')]){_0x2e2f60=![];logger[_0xc3ac('0xa')](_0xc3ac('0x2d'));}}if(_0x2e2f60){return client['request']('SendMail',_0x5c69f5)['then'](function(_0x2289c8){if(_0x2289c8[_0xc3ac('0x2e')]){return logger['error'](_0xc3ac('0x2f'),JSON['stringify'](_0x2289c8));}return logger['info'](_0xc3ac('0x30'));})['catch'](function(_0x1a6d6c){return logger['error'](_0xc3ac('0x2f'),JSON['stringify'](_0x1a6d6c));});}};}function handleError(){return function(_0xe495c1){return logger[_0xc3ac('0x2e')](JSON['stringify'](_0xe495c1));};}function handleResult(_0x3df968){return function(_0x53761c){logger[_0xc3ac('0xa')](_0xc3ac('0x31'),JSON[_0xc3ac('0x2a')](_0x53761c));if(_0x3df968['MailAccount']&&_0x3df968[_0xc3ac('0xc')][_0xc3ac('0xd')]&&!_[_0xc3ac('0x32')](_0x3df968[_0xc3ac('0xb')])){setTimeout(handleSendEmail(_0x3df968,_0x53761c),0x3c*0x3e8);}};}function handleJob(_0x4c8322){return function(){try{if(_[_0xc3ac('0x32')](_0x4c8322['subtractNumber'])){return logger[_0xc3ac('0xa')](_0xc3ac('0x33'));}if(_[_0xc3ac('0x32')](_0x4c8322['subtractUnit'])){return logger[_0xc3ac('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x20b230={'startDate':moment()[_0xc3ac('0x34')](_0x4c8322[_0xc3ac('0x1b')],_0x4c8322[_0xc3ac('0x1c')])[_0xc3ac('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0xc3ac('0x35')),'type':_0xc3ac('0x36'),'output':_0x4c8322[_0xc3ac('0x37')],'name':_0x4c8322[_0xc3ac('0x18')]};if(!_['isNil'](_0x4c8322[_0xc3ac('0x38')])){logger[_0xc3ac('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x4c8322['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x4c8322[_0xc3ac('0x38')]},_0x20b230)['then'](handleResult(_0x4c8322))[_0xc3ac('0x39')](handleError());}if(!_[_0xc3ac('0x32')](_0x4c8322[_0xc3ac('0x3a')])){logger[_0xc3ac('0xa')](_0xc3ac('0x3b'),_0x4c8322[_0xc3ac('0x3a')]);return analyticCustomReportController[_0xc3ac('0x3c')]({'id':_0x4c8322[_0xc3ac('0x3a')]},_0x20b230)[_0xc3ac('0x3d')](handleResult(_0x4c8322))[_0xc3ac('0x39')](handleError());}}catch(_0x247074){logger['error'](JSON[_0xc3ac('0x2a')](_0x247074));}return logger[_0xc3ac('0xa')]('no\x20report\x20id');};}function getJobs(_0x163cdc){var _0x58eae2={};if(_0x163cdc){_0x58eae2['id']=_0x163cdc;}return db['Schedule'][_0xc3ac('0x3e')]({'where':_0x58eae2,'include':[{'model':db['MailAccount'],'attributes':['id',_0xc3ac('0x18'),_0xc3ac('0xb')],'include':[{'model':db[_0xc3ac('0x3f')],'as':_0xc3ac('0xd')}]}]})[_0xc3ac('0x3d')](function(_0x541fd4){var _0x188625=_['keys'](manager[_0xc3ac('0x40')]);var _0x276223=_[_0xc3ac('0x41')](_0x541fd4,function(_0x52f617){return _0x52f617['id'][_0xc3ac('0x42')]();});var _0x454756=_[_0xc3ac('0x43')](_0x541fd4,function(_0x44f0dd){return _0x44f0dd['id'][_0xc3ac('0x42')]();});var _0x23ab14=_0x163cdc?_0x276223:_[_0xc3ac('0x44')](_0x276223,_0x188625);var _0x27c2fb=_[_0xc3ac('0x45')](_0x276223,_0x188625);var _0x48e7f0=_[_0xc3ac('0x44')](_0x188625,_0x276223);var _0x22869a;var _0x1a75e0;for(_0x22869a=0x0;_0x22869a<_0x48e7f0[_0xc3ac('0x46')]&&!_0x163cdc;_0x22869a+=0x1){_0x1a75e0=_0x48e7f0[_0x22869a][_0xc3ac('0x42')]();if(manager[_0xc3ac('0x47')](_0x1a75e0)){manager['stop'](_0x1a75e0);manager[_0xc3ac('0x48')](_0x1a75e0);logger['info']('delete\x20cron',_0x1a75e0);}}logger[_0xc3ac('0xa')](_0xc3ac('0x49'),JSON[_0xc3ac('0x2a')](_0x23ab14));for(_0x22869a=0x0;_0x22869a<_0x23ab14['length'];_0x22869a+=0x1){_0x1a75e0=_0x23ab14[_0x22869a][_0xc3ac('0x42')]();logger['info'](_0xc3ac('0x4a'),_0x1a75e0);if(_0x163cdc){logger[_0xc3ac('0xa')]('my\x20id',_0x163cdc);logger[_0xc3ac('0xa')](JSON['stringify'](_0x454756[_0x1a75e0]));BPromise[_0xc3ac('0x4b')]()['then'](handleJob(_0x454756[_0x1a75e0]));logger[_0xc3ac('0xa')](_0xc3ac('0x4c'),_0x454756[_0x1a75e0][_0xc3ac('0x18')],_0x454756[_0x1a75e0][_0xc3ac('0x4d')]);}else if(_0x454756[_0x1a75e0][_0xc3ac('0x4d')]&&_0x454756[_0x1a75e0][_0xc3ac('0x4e')]&&moment()[_0xc3ac('0x4f')](_0x454756[_0x1a75e0][_0xc3ac('0x50')],_0x454756[_0x1a75e0][_0xc3ac('0x51')])){manager[_0xc3ac('0x52')](_0x1a75e0,_0x454756[_0x1a75e0][_0xc3ac('0x4d')],handleJob(_0x454756[_0x1a75e0]));manager[_0xc3ac('0x53')](_0x1a75e0);logger['info'](_0xc3ac('0x54'),_0x454756[_0x1a75e0]['name'],_0x454756[_0x1a75e0][_0xc3ac('0x4d')]);}else if(manager[_0xc3ac('0x47')](_0x1a75e0)){manager[_0xc3ac('0x55')](_0x1a75e0);manager['deleteJob'](_0x1a75e0);logger['info'](_0xc3ac('0x56'),_0x454756[_0x1a75e0][_0xc3ac('0x18')],_0x454756[_0x1a75e0][_0xc3ac('0x4d')]);}}for(_0x22869a=0x0,_0x1a75e0;_0x22869a<_0x27c2fb[_0xc3ac('0x46')]&&!_0x163cdc;_0x22869a+=0x1){_0x1a75e0=_0x27c2fb[_0x22869a][_0xc3ac('0x42')]();if(manager[_0xc3ac('0x47')](_0x1a75e0)){if(_0x454756[_0x1a75e0][_0xc3ac('0x4d')]&&_0x454756[_0x1a75e0][_0xc3ac('0x4e')]&&moment()[_0xc3ac('0x4f')](_0x454756[_0x1a75e0][_0xc3ac('0x50')],_0x454756[_0x1a75e0][_0xc3ac('0x51')])){manager['update'](_0x1a75e0,_0x454756[_0x1a75e0][_0xc3ac('0x4d')],handleJob(_0x454756[_0x1a75e0]));logger[_0xc3ac('0xa')](_0xc3ac('0x57'),_0x454756[_0x1a75e0][_0xc3ac('0x18')],_0x454756[_0x1a75e0][_0xc3ac('0x4d')]);}else{manager['stop'](_0x1a75e0);manager[_0xc3ac('0x48')](_0x1a75e0);logger['info'](_0xc3ac('0x56'),_0x454756[_0x1a75e0][_0xc3ac('0x18')],_0x454756[_0x1a75e0][_0xc3ac('0x4d')]);}}}})['catch'](function(_0x5d1a41){logger[_0xc3ac('0x2e')](JSON[_0xc3ac('0x2a')](_0x5d1a41));});}exports['run']=function(_0xb1c34){return getJobs(_0xb1c34);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xc5c9=['subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','jobs','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','startAt','endAt','add','add\x20cron','stop','stop\x20cron','active','isBetween','run','start','util','path','lodash','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','MailAccount','Smtp','service','host','port','secure','authentication','pass','format','\x22%s\x22\x20<%s>','email','user','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','sendIfEmpty','info','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','data','isNil'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0xc5c9,0x12e));var _0x9c5c=function(_0x468bef,_0xfc5fd0){_0x468bef=_0x468bef-0x0;var _0x4f5f6d=_0xc5c9[_0x468bef];return _0x4f5f6d;};'use strict';var fs=require('fs');var util=require(_0x9c5c('0x0'));var path=require(_0x9c5c('0x1'));var _=require(_0x9c5c('0x2'));var moment=require('moment');var CronJobManager=require(_0x9c5c('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x9c5c('0x4'));var logger=require(_0x9c5c('0x5'))(_0x9c5c('0x6'));var db=require(_0x9c5c('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x9c5c('0x8'));var client=jayson['client'][_0x9c5c('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2ce389,_0x525368){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x2ce389['email']);var _0x1681c6=!![];var _0x4f4c7e={'tls':{'rejectUnauthorized':![]}};if(_0x2ce389[_0x9c5c('0xa')][_0x9c5c('0xb')][_0x9c5c('0xc')]){_0x4f4c7e[_0x9c5c('0xc')]=_0x2ce389[_0x9c5c('0xa')]['Smtp'][_0x9c5c('0xc')];}else{_0x4f4c7e['host']=_0x2ce389[_0x9c5c('0xa')]['Smtp'][_0x9c5c('0xd')];_0x4f4c7e[_0x9c5c('0xe')]=_0x2ce389[_0x9c5c('0xa')][_0x9c5c('0xb')][_0x9c5c('0xe')];_0x4f4c7e[_0x9c5c('0xf')]=_0x2ce389[_0x9c5c('0xa')]['Smtp']['secure'];}if(_0x2ce389['MailAccount']['Smtp'][_0x9c5c('0x10')]){_0x4f4c7e['auth']={'user':_0x2ce389[_0x9c5c('0xa')]['Smtp']['user'],'pass':_0x2ce389['MailAccount'][_0x9c5c('0xb')][_0x9c5c('0x11')]};}var _0xa8f4bb={'account':_0x4f4c7e,'message':{'from':util[_0x9c5c('0x12')](_0x9c5c('0x13'),_0x2ce389[_0x9c5c('0xa')]['name'],_0x2ce389[_0x9c5c('0xa')][_0x9c5c('0x14')]||_0x2ce389[_0x9c5c('0xa')][_0x9c5c('0xb')][_0x9c5c('0x15')]),'to':_0x2ce389[_0x9c5c('0x14')],'cc':_0x2ce389['cc'],'bcc':_0x2ce389['bcc'],'subject':util[_0x9c5c('0x12')](_0x9c5c('0x16'),_0x525368[_0x9c5c('0x17')],_0x2ce389[_0x9c5c('0x18')],_0x2ce389[_0x9c5c('0x19')])}};var _0x299845=path[_0x9c5c('0x1a')](__dirname,'../../files/reports');var _0x613aab=_0x525368[_0x9c5c('0x1b')];var _0x38bb9b=util[_0x9c5c('0x12')](_0x9c5c('0x1c'),path[_0x9c5c('0x1d')](_0x525368[_0x9c5c('0x1b')],path[_0x9c5c('0x1e')](_0x525368[_0x9c5c('0x1b')])),_0x9c5c('0x1f'));var _0x4a83fa=path[_0x9c5c('0x1a')](_0x299845,_0x613aab);var _0x59e021=path[_0x9c5c('0x1a')](_0x299845,_0x38bb9b);if(fs[_0x9c5c('0x20')](_0x4a83fa)){_0x525368[_0x9c5c('0x21')]=_0x9c5c('0x22');_0xa8f4bb[_0x9c5c('0x23')][_0x9c5c('0x24')]=[{'filename':_0x613aab,'path':_0x4a83fa}];_0xa8f4bb[_0x9c5c('0x23')][_0x9c5c('0x25')]=util[_0x9c5c('0x12')](_0x9c5c('0x26'),JSON['stringify'](_0x525368,null,0x2));}else if(fs['existsSync'](_0x59e021)){_0x525368['status']='Sent';_0xa8f4bb['message'][_0x9c5c('0x24')]=[{'filename':_0x38bb9b,'path':_0x59e021}];}else{_0xa8f4bb[_0x9c5c('0x23')][_0x9c5c('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x2ce389[_0x9c5c('0x27')]){_0x1681c6=![];logger[_0x9c5c('0x28')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x1681c6){return client['request'](_0x9c5c('0x29'),_0xa8f4bb)[_0x9c5c('0x2a')](function(_0x1609f1){if(_0x1609f1[_0x9c5c('0x2b')]){return logger[_0x9c5c('0x2b')](_0x9c5c('0x2c'),JSON[_0x9c5c('0x2d')](_0x1609f1));}return logger[_0x9c5c('0x28')](_0x9c5c('0x2e'));})[_0x9c5c('0x2f')](function(_0x4b7eb2){return logger[_0x9c5c('0x2b')](_0x9c5c('0x2c'),JSON[_0x9c5c('0x2d')](_0x4b7eb2));});}};}function handleError(){return function(_0x2c89c9){return logger[_0x9c5c('0x2b')](JSON[_0x9c5c('0x2d')](_0x2c89c9));};}function handleResult(_0x4fb503){return function(_0x1fac92){logger[_0x9c5c('0x28')](_0x9c5c('0x30'),JSON['stringify'](_0x1fac92));if(_0x4fb503[_0x9c5c('0xa')]&&_0x4fb503[_0x9c5c('0xa')][_0x9c5c('0xb')]&&!_['isNil'](_0x4fb503[_0x9c5c('0x14')])){setTimeout(handleSendEmail(_0x4fb503,_0x1fac92),0x3c*0x3e8);}};}function handleJob(_0x1f0bd6){return function(){try{if(_['isNil'](_0x1f0bd6[_0x9c5c('0x18')])){return logger[_0x9c5c('0x28')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x9c5c('0x31')](_0x1f0bd6[_0x9c5c('0x19')])){return logger[_0x9c5c('0x28')](_0x9c5c('0x32'));}var _0x3a1813={'startDate':moment()[_0x9c5c('0x33')](_0x1f0bd6['subtractNumber'],_0x1f0bd6[_0x9c5c('0x19')])[_0x9c5c('0x12')](_0x9c5c('0x34')),'endDate':moment()[_0x9c5c('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x9c5c('0x35'),'output':_0x1f0bd6[_0x9c5c('0x36')],'name':_0x1f0bd6[_0x9c5c('0x17')]};if(!_[_0x9c5c('0x31')](_0x1f0bd6[_0x9c5c('0x37')])){logger[_0x9c5c('0x28')](_0x9c5c('0x38'),_0x1f0bd6[_0x9c5c('0x37')]);return analyticDefaultReportController[_0x9c5c('0x39')]({'id':_0x1f0bd6[_0x9c5c('0x37')]},_0x3a1813)[_0x9c5c('0x2a')](handleResult(_0x1f0bd6))['catch'](handleError());}if(!_[_0x9c5c('0x31')](_0x1f0bd6[_0x9c5c('0x3a')])){logger[_0x9c5c('0x28')](_0x9c5c('0x3b'),_0x1f0bd6[_0x9c5c('0x3a')]);return analyticCustomReportController[_0x9c5c('0x39')]({'id':_0x1f0bd6[_0x9c5c('0x3a')]},_0x3a1813)[_0x9c5c('0x2a')](handleResult(_0x1f0bd6))['catch'](handleError());}}catch(_0x48adf){logger[_0x9c5c('0x2b')](JSON['stringify'](_0x48adf));}return logger['info'](_0x9c5c('0x3c'));};}function getJobs(_0x2be48b){var _0x1fe42b={};if(_0x2be48b){_0x1fe42b['id']=_0x2be48b;}return db[_0x9c5c('0x3d')]['findAll']({'where':_0x1fe42b,'include':[{'model':db[_0x9c5c('0xa')],'attributes':['id',_0x9c5c('0x17'),_0x9c5c('0x14')],'include':[{'model':db[_0x9c5c('0x3e')],'as':_0x9c5c('0xb')}]}]})[_0x9c5c('0x2a')](function(_0x125d26){var _0x98e92=_['keys'](manager[_0x9c5c('0x3f')]);var _0x1d36eb=_['map'](_0x125d26,function(_0xd82494){return _0xd82494['id'][_0x9c5c('0x40')]();});var _0x2cb629=_[_0x9c5c('0x41')](_0x125d26,function(_0x5149a7){return _0x5149a7['id'][_0x9c5c('0x40')]();});var _0x369bfe=_0x2be48b?_0x1d36eb:_[_0x9c5c('0x42')](_0x1d36eb,_0x98e92);var _0x194c0c=_[_0x9c5c('0x43')](_0x1d36eb,_0x98e92);var _0x104c12=_[_0x9c5c('0x42')](_0x98e92,_0x1d36eb);var _0x184f99;var _0x272c47;for(_0x184f99=0x0;_0x184f99<_0x104c12[_0x9c5c('0x44')]&&!_0x2be48b;_0x184f99+=0x1){_0x272c47=_0x104c12[_0x184f99][_0x9c5c('0x40')]();if(manager[_0x9c5c('0x45')](_0x272c47)){manager['stop'](_0x272c47);manager[_0x9c5c('0x46')](_0x272c47);logger[_0x9c5c('0x28')](_0x9c5c('0x47'),_0x272c47);}}logger[_0x9c5c('0x28')](_0x9c5c('0x48'),JSON[_0x9c5c('0x2d')](_0x369bfe));for(_0x184f99=0x0;_0x184f99<_0x369bfe[_0x9c5c('0x44')];_0x184f99+=0x1){_0x272c47=_0x369bfe[_0x184f99][_0x9c5c('0x40')]();logger[_0x9c5c('0x28')](_0x9c5c('0x49'),_0x272c47);if(_0x2be48b){logger[_0x9c5c('0x28')](_0x9c5c('0x4a'),_0x2be48b);logger[_0x9c5c('0x28')](JSON['stringify'](_0x2cb629[_0x272c47]));BPromise[_0x9c5c('0x4b')]()[_0x9c5c('0x2a')](handleJob(_0x2cb629[_0x272c47]));logger[_0x9c5c('0x28')](_0x9c5c('0x4c'),_0x2cb629[_0x272c47][_0x9c5c('0x17')],_0x2cb629[_0x272c47]['cron']);}else if(_0x2cb629[_0x272c47][_0x9c5c('0x4d')]&&_0x2cb629[_0x272c47]['active']&&moment()['isBetween'](_0x2cb629[_0x272c47][_0x9c5c('0x4e')],_0x2cb629[_0x272c47][_0x9c5c('0x4f')])){manager[_0x9c5c('0x50')](_0x272c47,_0x2cb629[_0x272c47][_0x9c5c('0x4d')],handleJob(_0x2cb629[_0x272c47]));manager['start'](_0x272c47);logger[_0x9c5c('0x28')](_0x9c5c('0x51'),_0x2cb629[_0x272c47]['name'],_0x2cb629[_0x272c47]['cron']);}else if(manager[_0x9c5c('0x45')](_0x272c47)){manager[_0x9c5c('0x52')](_0x272c47);manager[_0x9c5c('0x46')](_0x272c47);logger[_0x9c5c('0x28')](_0x9c5c('0x53'),_0x2cb629[_0x272c47]['name'],_0x2cb629[_0x272c47][_0x9c5c('0x4d')]);}}for(_0x184f99=0x0,_0x272c47;_0x184f99<_0x194c0c['length']&&!_0x2be48b;_0x184f99+=0x1){_0x272c47=_0x194c0c[_0x184f99][_0x9c5c('0x40')]();if(manager[_0x9c5c('0x45')](_0x272c47)){if(_0x2cb629[_0x272c47]['cron']&&_0x2cb629[_0x272c47][_0x9c5c('0x54')]&&moment()[_0x9c5c('0x55')](_0x2cb629[_0x272c47][_0x9c5c('0x4e')],_0x2cb629[_0x272c47]['endAt'])){manager['update'](_0x272c47,_0x2cb629[_0x272c47][_0x9c5c('0x4d')],handleJob(_0x2cb629[_0x272c47]));logger[_0x9c5c('0x28')]('update\x20cron',_0x2cb629[_0x272c47][_0x9c5c('0x17')],_0x2cb629[_0x272c47]['cron']);}else{manager['stop'](_0x272c47);manager[_0x9c5c('0x46')](_0x272c47);logger['info'](_0x9c5c('0x53'),_0x2cb629[_0x272c47][_0x9c5c('0x17')],_0x2cb629[_0x272c47][_0x9c5c('0x4d')]);}}}})[_0x9c5c('0x2f')](function(_0x5e3579){logger['error'](JSON[_0x9c5c('0x2d')](_0x5e3579));});}exports[_0x9c5c('0x56')]=function(_0x204afc){return getJobs(_0x204afc);};exports[_0x9c5c('0x57')]=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 b2b8188..31cd090 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 _0xb1f8=['Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','Positive','COMPLETED','catch','SequelizeValidationError','error','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','name','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','format','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2'];(function(_0x812c96,_0x52d4d2){var _0x5f3304=function(_0xedcd6b){while(--_0xedcd6b){_0x812c96['push'](_0x812c96['shift']());}};_0x5f3304(++_0x52d4d2);}(_0xb1f8,0xa6));var _0x8b1f=function(_0x2194b7,_0x4eb021){_0x2194b7=_0x2194b7-0x0;var _0x5dc049=_0xb1f8[_0x2194b7];return _0x5dc049;};var _=require(_0x8b1f('0x0'));var AWS=require(_0x8b1f('0x1'));var rp=require(_0x8b1f('0x2'));var util=require(_0x8b1f('0x3'));var BPromise=require('bluebird');var db=require(_0x8b1f('0x4'))['db'];var logger=require(_0x8b1f('0x5'))(_0x8b1f('0x6'));function getTranscriptionJob(_0x3f2b7b,_0x33c5f0,_0xd14fa0,_0x4ad31a){return new Promise(function(_0x47ae75,_0x1f7b16){var _0x4d667d=new AWS[(_0x8b1f('0x7'))]({'accessKeyId':_0x33c5f0,'secretAccessKey':_0x3f2b7b,'region':_0xd14fa0});_0x4d667d[_0x8b1f('0x8')]({'TranscriptionJobName':_0x4ad31a},function(_0x3701fa,_0x189176){if(_0x3701fa){return _0x1f7b16(_0x3701fa);}else{return _0x47ae75(_0x189176);}});});}function sentiment(_0x3bd180,_0x3b0ad4,_0x483b19,_0x81445f,_0xd54027){return new Promise(function(_0x5b8d17,_0x377abe){var _0x2ddaa6=new AWS['Comprehend']({'accessKeyId':_0x3b0ad4,'secretAccessKey':_0x3bd180,'region':_0x483b19});_0x2ddaa6[_0x8b1f('0x9')]({'Text':_0x81445f,'LanguageCode':_0xd54027[_0x8b1f('0xa')](0x0,0x2)},function(_0x34c59b,_0x2d7c56){if(_0x34c59b){return _0x377abe(_0x34c59b);}else{return _0x5b8d17(_0x2d7c56);}});});}function checkTranscribeJob(_0x1641fb,_0x539be3,_0x5d991c){var _0x429976;return new BPromise(function(_0x205773,_0x24b749){logger[_0x8b1f('0xb')](util['format'](_0x8b1f('0xc'),_0x1641fb['id'],_0x1641fb[_0x8b1f('0xd')]));return getTranscriptionJob(_0x5d991c[_0x8b1f('0xe')],_0x5d991c['data2'],_0x539be3[_0x8b1f('0xf')],_0x1641fb[_0x8b1f('0xd')])[_0x8b1f('0x10')](function(_0x591251){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x1641fb['id'],_0x1641fb[_0x8b1f('0xd')],_0x591251['TranscriptionJob'][_0x8b1f('0x12')]));if(!_0x1641fb[_0x8b1f('0x13')]){switch(_0x591251['TranscriptionJob']['TranscriptionJobStatus']){case'COMPLETED':var _0x2bb47c={'transcribeStatus':_0x591251[_0x8b1f('0x14')][_0x8b1f('0x12')],'fileUri':_0x591251[_0x8b1f('0x14')][_0x8b1f('0x15')][_0x8b1f('0x16')]};logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x17'),_0x1641fb['id']));return rp({'uri':_0x591251[_0x8b1f('0x14')]['Transcript'][_0x8b1f('0x16')],'json':!![]})[_0x8b1f('0x10')](function(_0x4aa6a4){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x1641fb['id']));if(_0x4aa6a4&&_0x4aa6a4[_0x8b1f('0x18')]&&_0x4aa6a4['results']['transcripts']&&_0x4aa6a4[_0x8b1f('0x18')][_0x8b1f('0x19')][_0x8b1f('0x1a')]){_0x2bb47c[_0x8b1f('0x13')]='';for(var _0x5e9d86=0x0;_0x5e9d86<_0x4aa6a4[_0x8b1f('0x18')][_0x8b1f('0x19')]['length'];_0x5e9d86++){_0x2bb47c[_0x8b1f('0x13')]+=_0x4aa6a4[_0x8b1f('0x18')][_0x8b1f('0x19')][_0x5e9d86][_0x8b1f('0x1b')]+'';}}return _0x1641fb[_0x8b1f('0x1c')](_0x2bb47c);})[_0x8b1f('0x10')](function(){logger['info'](util[_0x8b1f('0x11')](_0x8b1f('0x1d'),_0x1641fb['id']));if(!_0x1641fb[_0x8b1f('0x1e')]){throw new db['Sequelize'][(_0x8b1f('0x1f'))](_0x8b1f('0x20'));}if(!_0x539be3['sentiment']||!_0x539be3['sentimentAccountId']||!_0x539be3[_0x8b1f('0x21')]||!_0x539be3[_0x8b1f('0x22')]||!_0x539be3[_0x8b1f('0x23')]){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))](_0x8b1f('0x25'));}if(!_0x2bb47c[_0x8b1f('0x13')]){throw new Error(_0x8b1f('0x26'));}if(_0x539be3[_0x8b1f('0x27')]===_0x5d991c['id']){return _0x5d991c;}else{return db[_0x8b1f('0x28')][_0x8b1f('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x8b1f('0x10')](function(_0x3e5f1f){if(!_0x3e5f1f){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))](_0x8b1f('0x2a'));}if(!_0x3e5f1f[_0x8b1f('0xe')]||!_0x3e5f1f[_0x8b1f('0x2b')]){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))](_0x8b1f('0x2c'));}_0x429976=_0x3e5f1f;logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x2d'),_0x1641fb['id']));return sentiment(_0x429976[_0x8b1f('0xe')],_0x429976['data2'],_0x539be3[_0x8b1f('0x21')],_0x2bb47c['fileText'],_0x539be3[_0x8b1f('0x22')]);})[_0x8b1f('0x10')](function(_0x1bc0cb){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x2e'),_0x1641fb['id']));return _0x1641fb['update']({'sentiment':_0x1bc0cb[_0x8b1f('0x2f')],'sPositive':_0x1bc0cb[_0x8b1f('0x30')]['Positive'],'sNegative':_0x1bc0cb[_0x8b1f('0x30')][_0x8b1f('0x31')],'sMixed':_0x1bc0cb[_0x8b1f('0x30')][_0x8b1f('0x32')],'sNeutral':_0x1bc0cb[_0x8b1f('0x30')][_0x8b1f('0x33')]});})[_0x8b1f('0x10')](function(){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x1d'),_0x1641fb['id']));_0x205773();});case'FAILED':return _0x1641fb['update']({'transcribeStatus':_0x8b1f('0x34'),'failureReason':_0x591251[_0x8b1f('0x14')]['FailureReason']})['then'](function(){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x1d'),_0x1641fb['id']));_0x205773();});default:logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x35'),_0x1641fb['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x1641fb[_0x8b1f('0x1e')]){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x539be3[_0x8b1f('0x36')]||!_0x539be3[_0x8b1f('0x27')]||!_0x539be3[_0x8b1f('0x21')]||!_0x539be3[_0x8b1f('0x22')]||!_0x539be3['bucket']){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))](_0x8b1f('0x25'));}if(!_0x1641fb['fileText']){throw new Error(_0x8b1f('0x26'));}if(_0x539be3[_0x8b1f('0x27')]===_0x5d991c['id']){return _0x5d991c;}else{return db[_0x8b1f('0x28')]['findOne']({'where':{'id':_settings[_0x8b1f('0x27')]}});}})[_0x8b1f('0x10')](function(_0xa3bc90){if(!_0xa3bc90){throw new db['Sequelize'][(_0x8b1f('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xa3bc90[_0x8b1f('0xe')]||!_0xa3bc90[_0x8b1f('0x2b')]){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x429976=_0xa3bc90;logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x2d'),_0x1641fb['id']));return sentiment(_0x429976[_0x8b1f('0xe')],_0x429976[_0x8b1f('0x2b')],_0x539be3[_0x8b1f('0x21')],_0x1641fb[_0x8b1f('0x13')],_0x539be3[_0x8b1f('0x22')]);})[_0x8b1f('0x10')](function(_0x28a840){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x2e'),_0x1641fb['id']));return _0x1641fb[_0x8b1f('0x1c')]({'sentiment':_0x28a840[_0x8b1f('0x2f')],'sPositive':_0x28a840[_0x8b1f('0x30')][_0x8b1f('0x37')],'sNegative':_0x28a840[_0x8b1f('0x30')][_0x8b1f('0x31')],'sMixed':_0x28a840[_0x8b1f('0x30')][_0x8b1f('0x32')],'sNeutral':_0x28a840[_0x8b1f('0x30')][_0x8b1f('0x33')],'transcribeStatus':_0x8b1f('0x38')});})['then'](function(){logger[_0x8b1f('0xb')](util[_0x8b1f('0x11')](_0x8b1f('0x1d'),_0x1641fb['id']));_0x205773();});}})[_0x8b1f('0x39')](function(_0x3ae8a3){if(_0x3ae8a3){if(!_0x3ae8a3['name']||_0x3ae8a3['name']!==_0x8b1f('0x3a')){logger[_0x8b1f('0x3b')](util[_0x8b1f('0x11')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x1641fb['id']),util[_0x8b1f('0x3c')](_0x3ae8a3,{'showHidden':![],'depth':null}));}}_0x205773();});});}function checkTranscribe(){var _0x441f8e;var _0x13f9f7;var _0x3e6231;return db['VoiceRecording'][_0x8b1f('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x8b1f('0x10')](function(_0xb51603){if(!_0xb51603||!_0xb51603[_0x8b1f('0x1a')]){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))](_0x8b1f('0x3e'));}_0x441f8e=_0xb51603;return db['Setting'][_0x8b1f('0x29')]({'where':{'id':0x1}});})[_0x8b1f('0x10')](function(_0x2b2754){if(!_0x2b2754){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))](_0x8b1f('0x3f'));}_0x13f9f7=_0x2b2754;if(!_0x13f9f7['transcribe']||!_0x13f9f7[_0x8b1f('0x40')]||!_0x13f9f7['transcribeRegion']||!_0x13f9f7[_0x8b1f('0x22')]||!_0x13f9f7[_0x8b1f('0x23')]){throw new db[(_0x8b1f('0x24'))][(_0x8b1f('0x1f'))]('Transcribe\x20not\x20configured');}return db[_0x8b1f('0x28')][_0x8b1f('0x29')]({'where':{'id':_0x13f9f7[_0x8b1f('0x40')]}});})['then'](function(_0x170693){if(!_0x170693){throw new db['Sequelize'][(_0x8b1f('0x1f'))](_0x8b1f('0x2a'));}if(!_0x170693[_0x8b1f('0xe')]||!_0x170693[_0x8b1f('0x2b')]){throw new db['Sequelize']['ValidationError'](_0x8b1f('0x2c'));}_0x3e6231=_0x170693;var _0x417dc9=[];_0x441f8e[_0x8b1f('0x41')](function(_0x502eef){_0x417dc9[_0x8b1f('0x42')](checkTranscribeJob(_0x502eef,_0x13f9f7,_0x3e6231));});return BPromise[_0x8b1f('0x43')](_0x417dc9);})[_0x8b1f('0x39')](function(_0x45d0c8){if(_0x45d0c8){if(!_0x45d0c8[_0x8b1f('0x44')]||_0x45d0c8[_0x8b1f('0x44')]!=='SequelizeValidationError'){logger[_0x8b1f('0x3b')](util[_0x8b1f('0x3c')](_0x45d0c8,{'showHidden':![],'depth':null}));}}});}exports[_0x8b1f('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8d40=['util','bluebird','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','length','transcript','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','Sequelize','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','Neutral','FAILED','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','resolve','sentiment','Sentiment\x20Analysis\x20not\x20configured','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','Negative','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','start','lodash','aws-sdk','request-promise'];(function(_0x3ff97b,_0x459934){var _0x43ab91=function(_0x771d6f){while(--_0x771d6f){_0x3ff97b['push'](_0x3ff97b['shift']());}};_0x43ab91(++_0x459934);}(_0x8d40,0x160));var _0x08d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8d40[_0xa464c9];return _0x3d73c4;};var _=require(_0x08d4('0x0'));var AWS=require(_0x08d4('0x1'));var rp=require(_0x08d4('0x2'));var util=require(_0x08d4('0x3'));var BPromise=require(_0x08d4('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x08d4('0x5'))(_0x08d4('0x6'));function getTranscriptionJob(_0x4dbd63,_0xcd8816,_0x1920a3,_0x2527e7){return new Promise(function(_0x333648,_0x1dab2a){var _0x12c11c=new AWS['TranscribeService']({'accessKeyId':_0xcd8816,'secretAccessKey':_0x4dbd63,'region':_0x1920a3});_0x12c11c[_0x08d4('0x7')]({'TranscriptionJobName':_0x2527e7},function(_0x3152bd,_0xc9cc30){if(_0x3152bd){return _0x1dab2a(_0x3152bd);}else{return _0x333648(_0xc9cc30);}});});}function sentiment(_0x3c2b42,_0x48028e,_0x1fb379,_0x31bc76,_0x2dcb2d){return new Promise(function(_0x1f0a5f,_0x4af59e){var _0xbae4a9=new AWS[(_0x08d4('0x8'))]({'accessKeyId':_0x48028e,'secretAccessKey':_0x3c2b42,'region':_0x1fb379});_0xbae4a9[_0x08d4('0x9')]({'Text':_0x31bc76,'LanguageCode':_0x2dcb2d[_0x08d4('0xa')](0x0,0x2)},function(_0x4f113b,_0x1f3f42){if(_0x4f113b){return _0x4af59e(_0x4f113b);}else{return _0x1f0a5f(_0x1f3f42);}});});}function checkTranscribeJob(_0x44557c,_0x9d6586,_0x5dfcee){var _0x45038e;return new BPromise(function(_0x34a5ac,_0xb22d05){logger[_0x08d4('0xb')](util[_0x08d4('0xc')](_0x08d4('0xd'),_0x44557c['id'],_0x44557c['transcribeName']));return getTranscriptionJob(_0x5dfcee[_0x08d4('0xe')],_0x5dfcee['data2'],_0x9d6586[_0x08d4('0xf')],_0x44557c['transcribeName'])['then'](function(_0x1e1586){logger['info'](util[_0x08d4('0xc')](_0x08d4('0x10'),_0x44557c['id'],_0x44557c[_0x08d4('0x11')],_0x1e1586[_0x08d4('0x12')][_0x08d4('0x13')]));if(!_0x44557c[_0x08d4('0x14')]){switch(_0x1e1586[_0x08d4('0x12')][_0x08d4('0x13')]){case _0x08d4('0x15'):var _0x4212c0={'transcribeStatus':_0x1e1586[_0x08d4('0x12')][_0x08d4('0x13')],'fileUri':_0x1e1586['TranscriptionJob']['Transcript'][_0x08d4('0x16')]};logger['info'](util[_0x08d4('0xc')](_0x08d4('0x17'),_0x44557c['id']));return rp({'uri':_0x1e1586['TranscriptionJob']['Transcript']['TranscriptFileUri'],'json':!![]})[_0x08d4('0x18')](function(_0x329790){logger[_0x08d4('0xb')](util[_0x08d4('0xc')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x44557c['id']));if(_0x329790&&_0x329790[_0x08d4('0x19')]&&_0x329790[_0x08d4('0x19')][_0x08d4('0x1a')]&&_0x329790[_0x08d4('0x19')][_0x08d4('0x1a')][_0x08d4('0x1b')]){_0x4212c0[_0x08d4('0x14')]='';for(var _0x16a229=0x0;_0x16a229<_0x329790[_0x08d4('0x19')][_0x08d4('0x1a')][_0x08d4('0x1b')];_0x16a229++){_0x4212c0[_0x08d4('0x14')]+=_0x329790[_0x08d4('0x19')]['transcripts'][_0x16a229][_0x08d4('0x1c')]+'';}}return _0x44557c['update'](_0x4212c0);})[_0x08d4('0x18')](function(){logger[_0x08d4('0xb')](util[_0x08d4('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x44557c['id']));if(!_0x44557c[_0x08d4('0x1d')]){throw new db['Sequelize'][(_0x08d4('0x1e'))](_0x08d4('0x1f'));}if(!_0x9d6586['sentiment']||!_0x9d6586[_0x08d4('0x20')]||!_0x9d6586[_0x08d4('0x21')]||!_0x9d6586[_0x08d4('0x22')]||!_0x9d6586[_0x08d4('0x23')]){throw new db['Sequelize'][(_0x08d4('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4212c0[_0x08d4('0x14')]){throw new Error(_0x08d4('0x24'));}if(_0x9d6586[_0x08d4('0x20')]===_0x5dfcee['id']){return _0x5dfcee;}else{return db[_0x08d4('0x25')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x2fa465){if(!_0x2fa465){throw new db[(_0x08d4('0x26'))][(_0x08d4('0x1e'))](_0x08d4('0x27'));}if(!_0x2fa465[_0x08d4('0xe')]||!_0x2fa465[_0x08d4('0x28')]){throw new db[(_0x08d4('0x26'))]['ValidationError'](_0x08d4('0x29'));}_0x45038e=_0x2fa465;logger['info'](util[_0x08d4('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x44557c['id']));return sentiment(_0x45038e['data1'],_0x45038e[_0x08d4('0x28')],_0x9d6586[_0x08d4('0x21')],_0x4212c0[_0x08d4('0x14')],_0x9d6586[_0x08d4('0x22')]);})[_0x08d4('0x18')](function(_0x1478db){logger[_0x08d4('0xb')](util[_0x08d4('0xc')](_0x08d4('0x2a'),_0x44557c['id']));return _0x44557c['update']({'sentiment':_0x1478db['Sentiment'],'sPositive':_0x1478db[_0x08d4('0x2b')][_0x08d4('0x2c')],'sNegative':_0x1478db[_0x08d4('0x2b')]['Negative'],'sMixed':_0x1478db[_0x08d4('0x2b')][_0x08d4('0x2d')],'sNeutral':_0x1478db[_0x08d4('0x2b')][_0x08d4('0x2e')]});})[_0x08d4('0x18')](function(){logger['info'](util[_0x08d4('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x44557c['id']));_0x34a5ac();});case _0x08d4('0x2f'):return _0x44557c[_0x08d4('0x30')]({'transcribeStatus':'FAILED','failureReason':_0x1e1586[_0x08d4('0x12')]['FailureReason']})[_0x08d4('0x18')](function(){logger[_0x08d4('0xb')](util[_0x08d4('0xc')](_0x08d4('0x31'),_0x44557c['id']));_0x34a5ac();});default:logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x44557c['id']));break;}}else{return BPromise[_0x08d4('0x32')]()[_0x08d4('0x18')](function(){if(!_0x44557c[_0x08d4('0x1d')]){throw new db[(_0x08d4('0x26'))][(_0x08d4('0x1e'))](_0x08d4('0x1f'));}if(!_0x9d6586[_0x08d4('0x33')]||!_0x9d6586[_0x08d4('0x20')]||!_0x9d6586[_0x08d4('0x21')]||!_0x9d6586['language']||!_0x9d6586[_0x08d4('0x23')]){throw new db[(_0x08d4('0x26'))][(_0x08d4('0x1e'))](_0x08d4('0x34'));}if(!_0x44557c[_0x08d4('0x14')]){throw new Error(_0x08d4('0x24'));}if(_0x9d6586[_0x08d4('0x20')]===_0x5dfcee['id']){return _0x5dfcee;}else{return db['CloudProvider'][_0x08d4('0x35')]({'where':{'id':_settings[_0x08d4('0x20')]}});}})[_0x08d4('0x18')](function(_0x4321c7){if(!_0x4321c7){throw new db[(_0x08d4('0x26'))][(_0x08d4('0x1e'))](_0x08d4('0x27'));}if(!_0x4321c7[_0x08d4('0xe')]||!_0x4321c7[_0x08d4('0x28')]){throw new db[(_0x08d4('0x26'))][(_0x08d4('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x45038e=_0x4321c7;logger['info'](util['format'](_0x08d4('0x36'),_0x44557c['id']));return sentiment(_0x45038e[_0x08d4('0xe')],_0x45038e[_0x08d4('0x28')],_0x9d6586[_0x08d4('0x21')],_0x44557c[_0x08d4('0x14')],_0x9d6586['language']);})['then'](function(_0x3c7eae){logger[_0x08d4('0xb')](util[_0x08d4('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x44557c['id']));return _0x44557c[_0x08d4('0x30')]({'sentiment':_0x3c7eae[_0x08d4('0x37')],'sPositive':_0x3c7eae[_0x08d4('0x2b')][_0x08d4('0x2c')],'sNegative':_0x3c7eae[_0x08d4('0x2b')][_0x08d4('0x38')],'sMixed':_0x3c7eae['SentimentScore']['Mixed'],'sNeutral':_0x3c7eae[_0x08d4('0x2b')]['Neutral'],'transcribeStatus':_0x08d4('0x15')});})[_0x08d4('0x18')](function(){logger[_0x08d4('0xb')](util[_0x08d4('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x44557c['id']));_0x34a5ac();});}})['catch'](function(_0x582527){if(_0x582527){if(!_0x582527[_0x08d4('0x39')]||_0x582527['name']!==_0x08d4('0x3a')){logger[_0x08d4('0x3b')](util[_0x08d4('0xc')](_0x08d4('0x3c'),_0x44557c['id']),util[_0x08d4('0x3d')](_0x582527,{'showHidden':![],'depth':null}));}}_0x34a5ac();});});}function checkTranscribe(){var _0xd3c822;var _0x2712fd;var _0xde7ae6;return db[_0x08d4('0x3e')][_0x08d4('0x3f')]({'where':{'transcribeStatus':_0x08d4('0x40')}})['then'](function(_0x3bdbea){if(!_0x3bdbea||!_0x3bdbea[_0x08d4('0x1b')]){throw new db[(_0x08d4('0x26'))][(_0x08d4('0x1e'))]('No\x20transcribe\x20job\x20to\x20check');}_0xd3c822=_0x3bdbea;return db[_0x08d4('0x41')][_0x08d4('0x35')]({'where':{'id':0x1}});})[_0x08d4('0x18')](function(_0x4ae545){if(!_0x4ae545){throw new db['Sequelize']['ValidationError']('Settings\x20not\x20available');}_0x2712fd=_0x4ae545;if(!_0x2712fd['transcribe']||!_0x2712fd['transcribeAccountId']||!_0x2712fd['transcribeRegion']||!_0x2712fd[_0x08d4('0x22')]||!_0x2712fd[_0x08d4('0x23')]){throw new db[(_0x08d4('0x26'))]['ValidationError'](_0x08d4('0x42'));}return db['CloudProvider'][_0x08d4('0x35')]({'where':{'id':_0x2712fd[_0x08d4('0x43')]}});})['then'](function(_0x5f0e80){if(!_0x5f0e80){throw new db['Sequelize']['ValidationError'](_0x08d4('0x27'));}if(!_0x5f0e80[_0x08d4('0xe')]||!_0x5f0e80[_0x08d4('0x28')]){throw new db[(_0x08d4('0x26'))][(_0x08d4('0x1e'))](_0x08d4('0x29'));}_0xde7ae6=_0x5f0e80;var _0x370dd5=[];_0xd3c822[_0x08d4('0x44')](function(_0xdbb86){_0x370dd5[_0x08d4('0x45')](checkTranscribeJob(_0xdbb86,_0x2712fd,_0xde7ae6));});return BPromise['all'](_0x370dd5);})['catch'](function(_0x39d9bd){if(_0x39d9bd){if(!_0x39d9bd[_0x08d4('0x39')]||_0x39d9bd[_0x08d4('0x39')]!==_0x08d4('0x3a')){logger[_0x08d4('0x3b')](util[_0x08d4('0x3d')](_0x39d9bd,{'showHidden':![],'depth':null}));}}});}exports[_0x08d4('0x46')]=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 82bd686..0c08167 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 _0x38f3=['subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','format','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll'];(function(_0x533927,_0x289652){var _0x3aa9a6=function(_0x30dc71){while(--_0x30dc71){_0x533927['push'](_0x533927['shift']());}};_0x3aa9a6(++_0x289652);}(_0x38f3,0x12f));var _0x338f=function(_0x44044a,_0x3a0097){_0x44044a=_0x44044a-0x0;var _0x43bb6e=_0x38f3[_0x44044a];return _0x43bb6e;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x338f('0x0'));var util=require(_0x338f('0x1'));var config=require(_0x338f('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x338f('0x3'));config['redis']=_['defaults'](config[_0x338f('0x4')],{'host':_0x338f('0x5'),'port':0x18eb});var io=require(_0x338f('0x6'))(new Redis(config[_0x338f('0x4')]));function closeInteractions(){var _0x3991b4=[];return db[_0x338f('0x7')][_0x338f('0x8')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x338f('0x9')](0x18,_0x338f('0xa'))}}})[_0x338f('0xb')](function(_0x39b949){if(_0x39b949&&_0x39b949[_0x338f('0xc')]){_0x3991b4=_[_0x338f('0xd')](_0x39b949||[],'id');logger['info'](_0x338f('0xe'),_0x3991b4['join']());return db[_0x338f('0x7')][_0x338f('0xf')]({'closeReason':'system','disposition':_0x338f('0x10'),'closed':!![],'closedAt':moment()[_0x338f('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3991b4}});}})[_0x338f('0xb')](function(){if(_0x3991b4&&_0x3991b4[_0x338f('0xc')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x3991b4['join']());for(var _0x5b9cb8=0x0;_0x5b9cb8<_0x3991b4[_0x338f('0xc')];_0x5b9cb8++){io[_0x338f('0x12')](_0x338f('0x13'),{'id':_0x3991b4[_0x5b9cb8],'closed':!![]});}}})[_0x338f('0x14')](function(_0x29b813){logger['error'](_0x338f('0x15'),_0x29b813?util[_0x338f('0x16')](_0x29b813,{'showHidden':![],'depth':null}):'');});}exports[_0x338f('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3b1f=['util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','length','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b1f,0x184));var _0xf3b1=function(_0x59167c,_0x290494){_0x59167c=_0x59167c-0x0;var _0x4be684=_0x3b1f[_0x59167c];return _0x4be684;};'use strict';var _=require('lodash');var moment=require(_0xf3b1('0x0'));var Redis=require(_0xf3b1('0x1'));var util=require(_0xf3b1('0x2'));var config=require(_0xf3b1('0x3'));var db=require(_0xf3b1('0x4'))['db'];var logger=require(_0xf3b1('0x5'))(_0xf3b1('0x6'));config[_0xf3b1('0x7')]=_[_0xf3b1('0x8')](config[_0xf3b1('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xf3b1('0x9'))(new Redis(config[_0xf3b1('0x7')]));function closeInteractions(){var _0x2be001=[];return db[_0xf3b1('0xa')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf3b1('0xb')](0x18,_0xf3b1('0xc'))}}})[_0xf3b1('0xd')](function(_0x1a4467){if(_0x1a4467&&_0x1a4467['length']){_0x2be001=_[_0xf3b1('0xe')](_0x1a4467||[],'id');logger[_0xf3b1('0xf')](_0xf3b1('0x10'),_0x2be001[_0xf3b1('0x11')]());return db['WhatsappInteraction'][_0xf3b1('0x12')]({'closeReason':_0xf3b1('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xf3b1('0x14')](_0xf3b1('0x15'))},{'where':{'id':_0x2be001}});}})['then'](function(){if(_0x2be001&&_0x2be001['length']){logger[_0xf3b1('0xf')](_0xf3b1('0x16'),_0x2be001[_0xf3b1('0x11')]());for(var _0x101393=0x0;_0x101393<_0x2be001[_0xf3b1('0x17')];_0x101393++){io[_0xf3b1('0x18')](_0xf3b1('0x19'),{'id':_0x2be001[_0x101393],'closed':!![]});}}})[_0xf3b1('0x1a')](function(_0x3475e7){logger['error'](_0xf3b1('0x1b'),_0x3475e7?util[_0xf3b1('0x1c')](_0x3475e7,{'showHidden':![],'depth':null}):'');});}exports[_0xf3b1('0x1d')]=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 c8d22ec..561a210 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac16=['CmHopper','destroy','hopper1','contacts2','util','../mysqldb','push','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','then','bulkCreate','log','finished\x20populating','contacts1'];(function(_0xd97ecc,_0x5d6a2f){var _0xa70368=function(_0x480cee){while(--_0x480cee){_0xd97ecc['push'](_0xd97ecc['shift']());}};_0xa70368(++_0x5d6a2f);}(_0xac16,0x158));var _0x6ac1=function(_0x350e7b,_0x5ae51c){_0x350e7b=_0x350e7b-0x0;var _0x1577d5=_0xac16[_0x350e7b];return _0x1577d5;};'use strict';var util=require(_0x6ac1('0x0'));var db=require(_0x6ac1('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6ac1('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x6ac1('0x3')+i+_0x6ac1('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6ac1('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x6ac1('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6ac1('0x5')](),'updatedAt':Date[_0x6ac1('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6ac1('0x2')]({'id':i,'firstName':_0x6ac1('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x6ac1('0x3')+i+_0x6ac1('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'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[_0x6ac1('0x5')]()});}db[_0x6ac1('0x7')]['destroy']({'where':{}})[_0x6ac1('0x8')](function(){return db[_0x6ac1('0x7')][_0x6ac1('0x9')](contacts);})[_0x6ac1('0x8')](function(){console[_0x6ac1('0xa')](_0x6ac1('0xb'),_0x6ac1('0xc'));return db[_0x6ac1('0xd')][_0x6ac1('0xe')]({'where':{}});})[_0x6ac1('0x8')](function(){return db[_0x6ac1('0xd')][_0x6ac1('0x9')](hopper);})[_0x6ac1('0x8')](function(){console[_0x6ac1('0xa')]('finished\x20populating',_0x6ac1('0xf'));return db[_0x6ac1('0x7')]['bulkCreate'](contacts2);})[_0x6ac1('0x8')](function(){console['log'](_0x6ac1('0xb'),_0x6ac1('0x10'));return db[_0x6ac1('0xd')][_0x6ac1('0x9')](hopper2);})[_0x6ac1('0x8')](function(){console['log'](_0x6ac1('0xb'),'hopper2');})['catch'](function(_0x2f0433){console['log'](_0x2f0433);}); \ No newline at end of file +var _0xc2db=['contacts1','CmHopper','hopper1','contacts2','hopper2','util','../mysqldb','push','Biondo','innocenzo.biondo','now','Innocenzo','@xcally.com','destroy','then','CmContact','bulkCreate','log','finished\x20populating'];(function(_0x30fd9c,_0x3a1860){var _0x53d395=function(_0x3b328a){while(--_0x3b328a){_0x30fd9c['push'](_0x30fd9c['shift']());}};_0x53d395(++_0x3a1860);}(_0xc2db,0xd6));var _0xbc2d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xc2db[_0x138adb];return _0x1b27f2;};'use strict';var util=require(_0xbc2d('0x0'));var db=require(_0xbc2d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbc2d('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xbc2d('0x3')+i,'phone':0xf879fb460+i,'email':_0xbc2d('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xbc2d('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xbc2d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbc2d('0x5')](),'updatedAt':Date[_0xbc2d('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xbc2d('0x6')+i,'lastName':_0xbc2d('0x3')+i,'phone':0xf879fb460+i,'email':_0xbc2d('0x4')+i+_0xbc2d('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xbc2d('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xbc2d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbc2d('0x5')](),'updatedAt':Date['now']()});}db['CmContact'][_0xbc2d('0x8')]({'where':{}})[_0xbc2d('0x9')](function(){return db[_0xbc2d('0xa')][_0xbc2d('0xb')](contacts);})['then'](function(){console[_0xbc2d('0xc')](_0xbc2d('0xd'),_0xbc2d('0xe'));return db[_0xbc2d('0xf')][_0xbc2d('0x8')]({'where':{}});})['then'](function(){return db[_0xbc2d('0xf')][_0xbc2d('0xb')](hopper);})['then'](function(){console[_0xbc2d('0xc')](_0xbc2d('0xd'),_0xbc2d('0x10'));return db['CmContact'][_0xbc2d('0xb')](contacts2);})['then'](function(){console[_0xbc2d('0xc')](_0xbc2d('0xd'),_0xbc2d('0x11'));return db[_0xbc2d('0xf')][_0xbc2d('0xb')](hopper2);})[_0xbc2d('0x9')](function(){console[_0xbc2d('0xc')](_0xbc2d('0xd'),_0xbc2d('0x12'));})['catch'](function(_0x49ba9d){console[_0xbc2d('0xc')](_0x49ba9d);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index ed182f7..e4d8ca6 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x444a=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','util','push','%s%s','agent','format','friend','udp','wss','all'];(function(_0x17a750,_0x8b9552){var _0x307b72=function(_0x23da4f){while(--_0x23da4f){_0x17a750['push'](_0x17a750['shift']());}};_0x307b72(++_0x8b9552);}(_0x444a,0x1d2));var _0xa444=function(_0x2656a4,_0x28dd1b){_0x2656a4=_0x2656a4-0x0;var _0x48ce85=_0x444a[_0x2656a4];return _0x48ce85;};'use strict';var util=require(_0xa444('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa444('0x1')]({'name':util['format'](_0xa444('0x2'),_0xa444('0x3'),i),'fullname':util[_0xa444('0x4')](_0xa444('0x2'),_0xa444('0x3'),i),'email':util[_0xa444('0x4')]('%s%s@xcally.com',_0xa444('0x3'),i),'role':_0xa444('0x3'),'password':'password','internal':0xfa0+i,'type':_0xa444('0x5'),'transport':[_0xa444('0x6'),'ws',_0xa444('0x7')],'disallow':[_0xa444('0x8')],'allow':[_0xa444('0x9')],'defaultuser':util['format'](_0xa444('0x2'),_0xa444('0x3'),i),'encryption':_0xa444('0xa'),'avpf':'yes','force_avp':_0xa444('0xa'),'icesupport':_0xa444('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xa444('0xb'),'dtlsprivatekey':_0xa444('0xc'),'dtlssetup':_0xa444('0xd'),'callerid':util[_0xa444('0x4')]('\x22%s\x22\x20<%s>',util[_0xa444('0x4')](_0xa444('0x2'),_0xa444('0x3'),i),0xfa0+i)});}db[_0xa444('0xe')][_0xa444('0xf')](users)[_0xa444('0x10')](function(){console[_0xa444('0x11')](_0xa444('0x12'));})['catch'](function(_0x432b68){console[_0xa444('0x11')](_0x432b68);}); \ No newline at end of file +var _0xdb5f=['ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','bulkCreate','then','log','catch','util','format','%s%s','agent','password','friend','udp','all'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0xdb5f,0x1a8));var _0xfdb5=function(_0x270332,_0x5720dd){_0x270332=_0x270332-0x0;var _0x56ded9=_0xdb5f[_0x270332];return _0x56ded9;};'use strict';var util=require(_0xfdb5('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xfdb5('0x1')](_0xfdb5('0x2'),'agent',i),'fullname':util['format'](_0xfdb5('0x2'),_0xfdb5('0x3'),i),'email':util[_0xfdb5('0x1')]('%s%s@xcally.com',_0xfdb5('0x3'),i),'role':_0xfdb5('0x3'),'password':_0xfdb5('0x4'),'internal':0xfa0+i,'type':_0xfdb5('0x5'),'transport':[_0xfdb5('0x6'),'ws','wss'],'disallow':[_0xfdb5('0x7')],'allow':[_0xfdb5('0x8')],'defaultuser':util[_0xfdb5('0x1')](_0xfdb5('0x2'),_0xfdb5('0x3'),i),'encryption':_0xfdb5('0x9'),'avpf':_0xfdb5('0x9'),'force_avp':_0xfdb5('0x9'),'icesupport':_0xfdb5('0x9'),'dtlsenable':_0xfdb5('0x9'),'dtlsverify':'no','dtlscertfile':_0xfdb5('0xa'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0xfdb5('0x1')](_0xfdb5('0xb'),util[_0xfdb5('0x1')](_0xfdb5('0x2'),'agent',i),0xfa0+i)});}db['User'][_0xfdb5('0xc')](users)[_0xfdb5('0xd')](function(){console[_0xfdb5('0xe')]('add\x20user');})[_0xfdb5('0xf')](function(_0x40f9fc){console['log'](_0x40f9fc);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index a320afe..e7f1831 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56ce=['findAll','Telephones','Trunks','UserProfileResource','resourceId','then','map','where','format','%s:queue:%s','length','user:%s','query','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','IvrCampaigns','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','type','ivr','UserProfileSection','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues'];(function(_0x376569,_0x5f13ce){var _0x2decbd=function(_0x453dbd){while(--_0x453dbd){_0x376569['push'](_0x376569['shift']());}};_0x2decbd(++_0x5f13ce);}(_0x56ce,0x1e9));var _0xe56c=function(_0x227f48,_0x11a0e0){_0x227f48=_0x227f48-0x0;var _0x2a54dc=_0x56ce[_0x227f48];return _0x2a54dc;};'use strict';var _=require(_0xe56c('0x0'));var util=require('util');var BPromise=require(_0xe56c('0x1'));var db=require(_0xe56c('0x2'))['db'];var config=require(_0xe56c('0x3'));var queryQueues={'attributes':['id',_0xe56c('0x4')],'include':[{'as':_0xe56c('0x5'),'model':db[_0xe56c('0x6')],'attributes':['id',_0xe56c('0x4'),_0xe56c('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xe56c('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xe56c('0x4')],'where':{'role':_0xe56c('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xe56c('0x4'),_0xe56c('0xa')],'where':{'type':_0xe56c('0xb')}};function getAssociatedResources(_0x13e644,_0x7bc27e,_0x263812){return db[_0xe56c('0xc')]['findOne']({'where':{'name':_0x13e644,'userProfileId':_0x7bc27e},'raw':!![]})['then'](function(_0x399ca7){if(_0x399ca7){if(_0x399ca7[_0xe56c('0xd')]){switch(_0x13e644){case _0xe56c('0xe'):case _0xe56c('0xf'):case _0xe56c('0x10'):case _0xe56c('0x11'):case _0xe56c('0x12'):case _0xe56c('0x13'):case _0xe56c('0x14'):return db[_0x263812][_0xe56c('0x15')](queryQueues);case _0xe56c('0x16'):return db[_0x263812][_0xe56c('0x15')](queryTelephones);case _0xe56c('0x17'):return db[_0x263812][_0xe56c('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x263812]['findAll'](queryCampaigns);}}else{return db[_0xe56c('0x18')][_0xe56c('0x15')]({'attributes':[_0xe56c('0x19')],'where':{'sectionId':_0x399ca7['id']},'raw':!![]})[_0xe56c('0x1a')](function(_0x4f8eb4){if(_0x4f8eb4){var _0x5cf446={'where':{'id':_[_0xe56c('0x1b')](_0x4f8eb4,'resourceId')},'raw':!![]};switch(_0x263812){case _0xe56c('0x6'):_0x5cf446['where']['role']=_0xe56c('0x8');break;case'Campaign':_0x5cf446[_0xe56c('0x1c')][_0xe56c('0xa')]=_0xe56c('0xb');break;}return db[_0x263812][_0xe56c('0x15')](_0x5cf446);}else{return[];}});}}else{return[];}})[_0xe56c('0x1a')](function(_0xba96dd){return _0xba96dd;});}function joinOrLeaveQueues(_0x27870c,_0x9ea9bf,_0x8c0afd,_0x567a46){_0x27870c[_0x9ea9bf](util[_0xe56c('0x1d')](_0xe56c('0x1e'),_0x8c0afd,_0x567a46[_0xe56c('0x4')]));if(_0x567a46[_0xe56c('0x5')]){for(var _0x562461=0x0;_0x562461<_0x567a46[_0xe56c('0x5')][_0xe56c('0x1f')];_0x562461+=0x1){_0x27870c[_0x9ea9bf](util['format'](_0xe56c('0x20'),_0x567a46[_0xe56c('0x5')][_0x562461][_0xe56c('0x4')]));}}}function joinOrLeave(_0x511c77,_0x45f7bc,_0x4d4058){var _0x188c49;if(_0x511c77['handshake'][_0xe56c('0x21')]['id']){db[_0xe56c('0x6')]['find']({'attributes':['id',_0xe56c('0x4'),_0xe56c('0x7'),_0xe56c('0x22')],'where':{'id':_0x511c77[_0xe56c('0x23')][_0xe56c('0x21')]['id']},'include':[{'model':db[_0xe56c('0x24')],'as':_0xe56c('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xe56c('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe56c('0x27')],'as':_0xe56c('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xe56c('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xe56c('0x2a')],'as':_0xe56c('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xe56c('0x2c')],'as':_0xe56c('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xe56c('0x1a')](function(_0x6336a){if(_0x6336a){_0x188c49=_0x6336a;_0x511c77[_0x45f7bc](util['format']('user:%s',_0x6336a['name']));var _0x321ab0=[];switch(_0x6336a[_0xe56c('0x7')]){case _0xe56c('0x2e'):_0x511c77[_0x45f7bc](_0xe56c('0x2f'));_0x511c77[_0x45f7bc](_0xe56c('0x30'));if(queryQueues['hasOwnProperty'](_0xe56c('0x31'))){delete queryQueues[_0xe56c('0x31')];}_0x321ab0[_0xe56c('0x32')](db[_0xe56c('0x33')][_0xe56c('0x15')](queryQueues));_0x321ab0['push'](db[_0xe56c('0x34')][_0xe56c('0x15')](queryQueues));_0x321ab0['push'](db[_0xe56c('0x35')][_0xe56c('0x15')](queryQueues));_0x321ab0[_0xe56c('0x32')](db[_0xe56c('0x36')][_0xe56c('0x15')](queryQueues));_0x321ab0['push'](db[_0xe56c('0x37')]['findAll'](queryQueues));_0x321ab0[_0xe56c('0x32')](db[_0xe56c('0x38')]['findAll'](queryQueues));_0x321ab0[_0xe56c('0x32')](db[_0xe56c('0x39')][_0xe56c('0x15')](queryQueues));_0x321ab0[_0xe56c('0x32')](db[_0xe56c('0x6')][_0xe56c('0x15')](queryTelephones));_0x321ab0[_0xe56c('0x32')](db[_0xe56c('0x3a')]['findAll'](queryTrunks));_0x321ab0[_0xe56c('0x32')](db[_0xe56c('0x3b')][_0xe56c('0x15')](queryCampaigns));_0x321ab0[_0xe56c('0x32')](db[_0xe56c('0x6')][_0xe56c('0x15')](queryAgents));break;case _0xe56c('0x3c'):_0x511c77[_0x45f7bc](_0xe56c('0x2f'));_0x511c77[_0x45f7bc]('voice:outbound');_0x321ab0[_0xe56c('0x32')](getAssociatedResources(_0xe56c('0xe'),_0x6336a[_0xe56c('0x22')],_0xe56c('0x33')));_0x321ab0[_0xe56c('0x32')](getAssociatedResources(_0xe56c('0xf'),_0x6336a['userProfileId'],_0xe56c('0x34')));_0x321ab0[_0xe56c('0x32')](getAssociatedResources(_0xe56c('0x10'),_0x6336a[_0xe56c('0x22')],'FaxQueue'));_0x321ab0[_0xe56c('0x32')](getAssociatedResources(_0xe56c('0x11'),_0x6336a[_0xe56c('0x22')],'SmsQueue'));_0x321ab0[_0xe56c('0x32')](getAssociatedResources(_0xe56c('0x12'),_0x6336a[_0xe56c('0x22')],'MailQueue'));_0x321ab0['push'](getAssociatedResources(_0xe56c('0x13'),_0x6336a['userProfileId'],_0xe56c('0x38')));_0x321ab0[_0xe56c('0x32')](getAssociatedResources(_0xe56c('0x14'),_0x6336a[_0xe56c('0x22')],'WhatsappQueue'));_0x321ab0['push'](getAssociatedResources(_0xe56c('0x16'),_0x6336a[_0xe56c('0x22')],_0xe56c('0x6')));_0x321ab0[_0xe56c('0x32')](getAssociatedResources(_0xe56c('0x17'),_0x6336a[_0xe56c('0x22')],_0xe56c('0x3a')));_0x321ab0[_0xe56c('0x32')](getAssociatedResources(_0xe56c('0x3d'),_0x6336a['userProfileId'],_0xe56c('0x3b')));_0x321ab0['push'](db[_0xe56c('0x6')][_0xe56c('0x15')](queryAgents));break;case _0xe56c('0x9'):_0x511c77[_0x45f7bc](_0xe56c('0x2f'));_0x511c77[_0x45f7bc](_0xe56c('0x30'));_0x321ab0[_0xe56c('0x32')](_0x6336a[_0xe56c('0x3e')]({'attributes':['id',_0xe56c('0x4')]}));_0x321ab0['push'](_0x6336a[_0xe56c('0x3f')]({'attributes':['id','name']}));_0x321ab0[_0xe56c('0x32')](_0x6336a['getFaxQueues']({'attributes':['id',_0xe56c('0x4')]}));_0x321ab0['push'](_0x6336a[_0xe56c('0x40')]({'attributes':['id',_0xe56c('0x4')]}));_0x321ab0[_0xe56c('0x32')](_0x6336a[_0xe56c('0x41')]({'attributes':['id',_0xe56c('0x4')]}));_0x321ab0['push'](_0x6336a[_0xe56c('0x42')]({'attributes':['id',_0xe56c('0x4')]}));_0x321ab0[_0xe56c('0x32')](_0x6336a[_0xe56c('0x43')]({'attributes':['id',_0xe56c('0x4')]}));break;}return BPromise['all'](_0x321ab0);}})[_0xe56c('0x1a')](function(_0x56f178){if(_0x56f178&&_0x56f178[_0xe56c('0x1f')]){for(var _0x1be443=0x0;_0x1be443<_0x56f178[_0xe56c('0x1f')];_0x1be443+=0x1){for(var _0x443451=0x0;_0x443451<_0x56f178[_0x1be443][_0xe56c('0x1f')];_0x443451+=0x1){switch(_0x1be443){case 0x0:joinOrLeaveQueues(_0x511c77,_0x45f7bc,_0xe56c('0x44'),_0x56f178[_0x1be443][_0x443451]);break;case 0x1:joinOrLeaveQueues(_0x511c77,_0x45f7bc,_0xe56c('0x45'),_0x56f178[_0x1be443][_0x443451]);break;case 0x2:joinOrLeaveQueues(_0x511c77,_0x45f7bc,'fax',_0x56f178[_0x1be443][_0x443451]);break;case 0x3:joinOrLeaveQueues(_0x511c77,_0x45f7bc,_0xe56c('0x46'),_0x56f178[_0x1be443][_0x443451]);break;case 0x4:joinOrLeaveQueues(_0x511c77,_0x45f7bc,_0xe56c('0x47'),_0x56f178[_0x1be443][_0x443451]);break;case 0x5:joinOrLeaveQueues(_0x511c77,_0x45f7bc,_0xe56c('0x48'),_0x56f178[_0x1be443][_0x443451]);break;case 0x6:joinOrLeaveQueues(_0x511c77,_0x45f7bc,'whatsapp',_0x56f178[_0x1be443][_0x443451]);break;case 0x7:_0x511c77[_0x45f7bc](util[_0xe56c('0x1d')](_0xe56c('0x49'),_0x56f178[_0x1be443][_0x443451]['name']));break;case 0x8:_0x511c77[_0x45f7bc](util[_0xe56c('0x1d')](_0xe56c('0x4a'),_0x56f178[_0x1be443][_0x443451]['name']));break;case 0x9:_0x511c77[_0x45f7bc](util[_0xe56c('0x1d')](_0xe56c('0x4b'),_0x56f178[_0x1be443][_0x443451][_0xe56c('0xa')],_0x56f178[_0x1be443][_0x443451][_0xe56c('0x4')]));break;case 0xa:_0x511c77[_0x45f7bc](util[_0xe56c('0x1d')](_0xe56c('0x20'),_0x56f178[_0x1be443][_0x443451][_0xe56c('0x4')]));break;}}}}})[_0xe56c('0x1a')](function(){if(_0x45f7bc===_0xe56c('0x4c')){var _0x8df016=_[_0xe56c('0x1b')](_0x188c49[_0xe56c('0x25')],'id');return _0x188c49[_0xe56c('0x4d')](_0x8df016)['then'](function(){for(var _0x5108ff=0x0;_0x5108ff<_0x8df016[_0xe56c('0x1f')];_0x5108ff+=0x1){_0x4d4058[_0xe56c('0x4e')](_0xe56c('0x4f'),{'ChatInteractionId':Number(_0x8df016[_0x5108ff]),'UserId':Number(_0x188c49['id'])});}});}})[_0xe56c('0x1a')](function(){if(_0x45f7bc===_0xe56c('0x4c')){var _0x461767=_[_0xe56c('0x1b')](_0x188c49[_0xe56c('0x50')],'id');return _0x188c49[_0xe56c('0x51')](_0x461767)['then'](function(){for(var _0x517606=0x0;_0x517606<_0x461767[_0xe56c('0x1f')];_0x517606+=0x1){_0x4d4058[_0xe56c('0x4e')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x461767[_0x517606]),'UserId':Number(_0x188c49['id'])});}});}})[_0xe56c('0x1a')](function(){if(_0x45f7bc===_0xe56c('0x4c')){var _0x407d67=_[_0xe56c('0x1b')](_0x188c49['FaxInteractions'],'id');return _0x188c49[_0xe56c('0x52')](_0x407d67)[_0xe56c('0x1a')](function(){for(var _0xb9824a=0x0;_0xb9824a<_0x407d67[_0xe56c('0x1f')];_0xb9824a+=0x1){_0x4d4058['emit'](_0xe56c('0x53'),{'FaxInteractionId':Number(_0x407d67[_0xb9824a]),'UserId':Number(_0x188c49['id'])});}});}})[_0xe56c('0x1a')](function(){if(_0x45f7bc===_0xe56c('0x4c')){var _0x547eb1=_['map'](_0x188c49[_0xe56c('0x29')],'id');return _0x188c49['removeSmsInteractions'](_0x547eb1)[_0xe56c('0x1a')](function(){for(var _0x33d90e=0x0;_0x33d90e<_0x547eb1[_0xe56c('0x1f')];_0x33d90e+=0x1){_0x4d4058[_0xe56c('0x4e')](_0xe56c('0x54'),{'SmsInteractionId':Number(_0x547eb1[_0x33d90e]),'UserId':Number(_0x188c49['id'])});}});}})[_0xe56c('0x1a')](function(){if(_0x45f7bc===_0xe56c('0x4c')){var _0x5f2680=_[_0xe56c('0x1b')](_0x188c49[_0xe56c('0x2b')],'id');return _0x188c49[_0xe56c('0x55')](_0x5f2680)[_0xe56c('0x1a')](function(){for(var _0x4e762c=0x0;_0x4e762c<_0x5f2680[_0xe56c('0x1f')];_0x4e762c+=0x1){_0x4d4058['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x5f2680[_0x4e762c]),'UserId':Number(_0x188c49['id'])});}});}})[_0xe56c('0x1a')](function(){if(_0x45f7bc==='leave'){var _0x57d06e=_[_0xe56c('0x1b')](_0x188c49[_0xe56c('0x2d')],'id');return _0x188c49[_0xe56c('0x56')](_0x57d06e)['then'](function(){for(var _0x55608c=0x0;_0x55608c<_0x57d06e[_0xe56c('0x1f')];_0x55608c+=0x1){_0x4d4058['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x57d06e[_0x55608c]),'UserId':Number(_0x188c49['id'])});}});}})['catch'](function(_0xde804a){_0x511c77['log'](_0xde804a);});}}function onDisconnect(_0x12643e,_0x702271){joinOrLeave(_0x12643e,_0xe56c('0x4c'),_0x702271);}function onConnect(_0x10dd93){joinOrLeave(_0x10dd93,_0xe56c('0x57'));}exports[_0xe56c('0x58')]=function(_0x7169bc){_0x7169bc['on'](_0xe56c('0x59'),function(_0x49a006){_0x49a006[_0xe56c('0x5a')](0x0);_0x49a006[_0xe56c('0x5b')]=_0x49a006[_0xe56c('0x5c')][_0xe56c('0x59')][_0xe56c('0x5d')]+':'+_0x49a006[_0xe56c('0x5c')]['connection'][_0xe56c('0x5e')];_0x49a006[_0xe56c('0x5f')]=new Date();_0x49a006[_0xe56c('0x60')]=function(_0x4ba23b){console['log'](_0xe56c('0x61')+_0x49a006[_0xe56c('0x62')][_0xe56c('0x4')]+'['+_0x49a006[_0xe56c('0x5b')]+']',_0x4ba23b);};_0x49a006['on'](_0xe56c('0x63'),function(){onDisconnect(_0x49a006,_0x7169bc);_0x49a006[_0xe56c('0x60')](_0xe56c('0x64'));});onConnect(_0x49a006);_0x49a006[_0xe56c('0x60')](_0xe56c('0x65'));});}; \ No newline at end of file +var _0x821e=['removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','./environment','name','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','VoiceQueues','FaxQueues','SmsQueues','MailQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','format','%s:queue:%s','Agents','length','user:%s','handshake','find','userProfileId','query','ChatInteractions','MailInteraction','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','WhatsappQueue','Campaign','user','ChatQueues','OpenchannelQueue','WhatsappQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','mail','openchannel','whatsapp','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove'];(function(_0x259d84,_0x99d2a1){var _0x28b1c1=function(_0x3a76a4){while(--_0x3a76a4){_0x259d84['push'](_0x259d84['shift']());}};_0x28b1c1(++_0x99d2a1);}(_0x821e,0x76));var _0xe821=function(_0x4fd109,_0x33c503){_0x4fd109=_0x4fd109-0x0;var _0x30f0a6=_0x821e[_0x4fd109];return _0x30f0a6;};'use strict';var _=require('lodash');var util=require(_0xe821('0x0'));var BPromise=require(_0xe821('0x1'));var db=require('../mysqldb')['db'];var config=require(_0xe821('0x2'));var queryQueues={'attributes':['id',_0xe821('0x3')],'include':[{'as':'Agents','model':db[_0xe821('0x4')],'attributes':['id','name',_0xe821('0x5')],'raw':!![],'where':{'role':_0xe821('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe821('0x3')],'where':{'role':_0xe821('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xe821('0x3'),_0xe821('0x8')],'where':{'type':_0xe821('0x9')}};function getAssociatedResources(_0x10e3c2,_0x11a8a8,_0x65d7c8){return db[_0xe821('0xa')][_0xe821('0xb')]({'where':{'name':_0x10e3c2,'userProfileId':_0x11a8a8},'raw':!![]})[_0xe821('0xc')](function(_0x111897){if(_0x111897){if(_0x111897['autoAssociation']){switch(_0x10e3c2){case _0xe821('0xd'):case'ChatQueues':case _0xe821('0xe'):case _0xe821('0xf'):case _0xe821('0x10'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x65d7c8][_0xe821('0x11')](queryQueues);case _0xe821('0x12'):return db[_0x65d7c8]['findAll'](queryTelephones);case _0xe821('0x13'):return db[_0x65d7c8][_0xe821('0x11')](queryTrunks);case _0xe821('0x14'):return db[_0x65d7c8]['findAll'](queryCampaigns);}}else{return db[_0xe821('0x15')]['findAll']({'attributes':[_0xe821('0x16')],'where':{'sectionId':_0x111897['id']},'raw':!![]})['then'](function(_0xc35420){if(_0xc35420){var _0x1dffa1={'where':{'id':_[_0xe821('0x17')](_0xc35420,_0xe821('0x16'))},'raw':!![]};switch(_0x65d7c8){case _0xe821('0x4'):_0x1dffa1[_0xe821('0x18')][_0xe821('0x5')]='telephone';break;case'Campaign':_0x1dffa1[_0xe821('0x18')][_0xe821('0x8')]=_0xe821('0x9');break;}return db[_0x65d7c8][_0xe821('0x11')](_0x1dffa1);}else{return[];}});}}else{return[];}})[_0xe821('0xc')](function(_0x43394e){return _0x43394e;});}function joinOrLeaveQueues(_0x5c0a95,_0x2c3547,_0x2cf7b2,_0x215712){_0x5c0a95[_0x2c3547](util[_0xe821('0x19')](_0xe821('0x1a'),_0x2cf7b2,_0x215712[_0xe821('0x3')]));if(_0x215712['Agents']){for(var _0x108695=0x0;_0x108695<_0x215712[_0xe821('0x1b')][_0xe821('0x1c')];_0x108695+=0x1){_0x5c0a95[_0x2c3547](util[_0xe821('0x19')](_0xe821('0x1d'),_0x215712[_0xe821('0x1b')][_0x108695][_0xe821('0x3')]));}}}function joinOrLeave(_0x28d08e,_0x597b85,_0x55d3f5){var _0x4b0256;if(_0x28d08e[_0xe821('0x1e')]['query']['id']){db[_0xe821('0x4')][_0xe821('0x1f')]({'attributes':['id','name',_0xe821('0x5'),_0xe821('0x20')],'where':{'id':_0x28d08e[_0xe821('0x1e')][_0xe821('0x21')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xe821('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xe821('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe821('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe821('0x25')],'as':_0xe821('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xe821('0x27')],'as':_0xe821('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xe821('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xe821('0xc')](function(_0x2d95ad){if(_0x2d95ad){_0x4b0256=_0x2d95ad;_0x28d08e[_0x597b85](util[_0xe821('0x19')](_0xe821('0x1d'),_0x2d95ad[_0xe821('0x3')]));var _0xb3109c=[];switch(_0x2d95ad[_0xe821('0x5')]){case _0xe821('0x2a'):_0x28d08e[_0x597b85](_0xe821('0x2b'));_0x28d08e[_0x597b85](_0xe821('0x2c'));if(queryQueues[_0xe821('0x2d')]('include')){delete queryQueues['include'];}_0xb3109c[_0xe821('0x2e')](db[_0xe821('0x2f')][_0xe821('0x11')](queryQueues));_0xb3109c['push'](db[_0xe821('0x30')]['findAll'](queryQueues));_0xb3109c['push'](db[_0xe821('0x31')][_0xe821('0x11')](queryQueues));_0xb3109c[_0xe821('0x2e')](db['SmsQueue']['findAll'](queryQueues));_0xb3109c[_0xe821('0x2e')](db[_0xe821('0x32')]['findAll'](queryQueues));_0xb3109c[_0xe821('0x2e')](db['OpenchannelQueue'][_0xe821('0x11')](queryQueues));_0xb3109c['push'](db[_0xe821('0x33')]['findAll'](queryQueues));_0xb3109c[_0xe821('0x2e')](db[_0xe821('0x4')][_0xe821('0x11')](queryTelephones));_0xb3109c['push'](db['Trunk'][_0xe821('0x11')](queryTrunks));_0xb3109c['push'](db[_0xe821('0x34')][_0xe821('0x11')](queryCampaigns));_0xb3109c[_0xe821('0x2e')](db['User'][_0xe821('0x11')](queryAgents));break;case _0xe821('0x35'):_0x28d08e[_0x597b85](_0xe821('0x2b'));_0x28d08e[_0x597b85](_0xe821('0x2c'));_0xb3109c[_0xe821('0x2e')](getAssociatedResources(_0xe821('0xd'),_0x2d95ad['userProfileId'],_0xe821('0x2f')));_0xb3109c['push'](getAssociatedResources(_0xe821('0x36'),_0x2d95ad['userProfileId'],'ChatQueue'));_0xb3109c[_0xe821('0x2e')](getAssociatedResources('FaxQueues',_0x2d95ad['userProfileId'],'FaxQueue'));_0xb3109c['push'](getAssociatedResources('SmsQueues',_0x2d95ad[_0xe821('0x20')],'SmsQueue'));_0xb3109c['push'](getAssociatedResources('MailQueues',_0x2d95ad[_0xe821('0x20')],_0xe821('0x32')));_0xb3109c['push'](getAssociatedResources('OpenchannelQueues',_0x2d95ad[_0xe821('0x20')],_0xe821('0x37')));_0xb3109c[_0xe821('0x2e')](getAssociatedResources(_0xe821('0x38'),_0x2d95ad[_0xe821('0x20')],_0xe821('0x33')));_0xb3109c[_0xe821('0x2e')](getAssociatedResources(_0xe821('0x12'),_0x2d95ad[_0xe821('0x20')],_0xe821('0x4')));_0xb3109c[_0xe821('0x2e')](getAssociatedResources(_0xe821('0x13'),_0x2d95ad['userProfileId'],'Trunk'));_0xb3109c['push'](getAssociatedResources(_0xe821('0x14'),_0x2d95ad[_0xe821('0x20')],_0xe821('0x34')));_0xb3109c['push'](db[_0xe821('0x4')]['findAll'](queryAgents));break;case'agent':_0x28d08e[_0x597b85](_0xe821('0x2b'));_0x28d08e[_0x597b85]('voice:outbound');_0xb3109c['push'](_0x2d95ad['getVoiceQueues']({'attributes':['id',_0xe821('0x3')]}));_0xb3109c['push'](_0x2d95ad[_0xe821('0x39')]({'attributes':['id',_0xe821('0x3')]}));_0xb3109c[_0xe821('0x2e')](_0x2d95ad[_0xe821('0x3a')]({'attributes':['id',_0xe821('0x3')]}));_0xb3109c[_0xe821('0x2e')](_0x2d95ad[_0xe821('0x3b')]({'attributes':['id',_0xe821('0x3')]}));_0xb3109c[_0xe821('0x2e')](_0x2d95ad[_0xe821('0x3c')]({'attributes':['id',_0xe821('0x3')]}));_0xb3109c[_0xe821('0x2e')](_0x2d95ad[_0xe821('0x3d')]({'attributes':['id',_0xe821('0x3')]}));_0xb3109c[_0xe821('0x2e')](_0x2d95ad[_0xe821('0x3e')]({'attributes':['id',_0xe821('0x3')]}));break;}return BPromise[_0xe821('0x3f')](_0xb3109c);}})[_0xe821('0xc')](function(_0x27746c){if(_0x27746c&&_0x27746c[_0xe821('0x1c')]){for(var _0x5e5121=0x0;_0x5e5121<_0x27746c[_0xe821('0x1c')];_0x5e5121+=0x1){for(var _0x180230=0x0;_0x180230<_0x27746c[_0x5e5121][_0xe821('0x1c')];_0x180230+=0x1){switch(_0x5e5121){case 0x0:joinOrLeaveQueues(_0x28d08e,_0x597b85,'voice',_0x27746c[_0x5e5121][_0x180230]);break;case 0x1:joinOrLeaveQueues(_0x28d08e,_0x597b85,_0xe821('0x40'),_0x27746c[_0x5e5121][_0x180230]);break;case 0x2:joinOrLeaveQueues(_0x28d08e,_0x597b85,_0xe821('0x41'),_0x27746c[_0x5e5121][_0x180230]);break;case 0x3:joinOrLeaveQueues(_0x28d08e,_0x597b85,'sms',_0x27746c[_0x5e5121][_0x180230]);break;case 0x4:joinOrLeaveQueues(_0x28d08e,_0x597b85,_0xe821('0x42'),_0x27746c[_0x5e5121][_0x180230]);break;case 0x5:joinOrLeaveQueues(_0x28d08e,_0x597b85,_0xe821('0x43'),_0x27746c[_0x5e5121][_0x180230]);break;case 0x6:joinOrLeaveQueues(_0x28d08e,_0x597b85,_0xe821('0x44'),_0x27746c[_0x5e5121][_0x180230]);break;case 0x7:_0x28d08e[_0x597b85](util['format']('telephone:%s',_0x27746c[_0x5e5121][_0x180230]['name']));break;case 0x8:_0x28d08e[_0x597b85](util['format']('trunk:%s',_0x27746c[_0x5e5121][_0x180230][_0xe821('0x3')]));break;case 0x9:_0x28d08e[_0x597b85](util[_0xe821('0x19')](_0xe821('0x45'),_0x27746c[_0x5e5121][_0x180230][_0xe821('0x8')],_0x27746c[_0x5e5121][_0x180230][_0xe821('0x3')]));break;case 0xa:_0x28d08e[_0x597b85](util['format'](_0xe821('0x1d'),_0x27746c[_0x5e5121][_0x180230][_0xe821('0x3')]));break;}}}}})[_0xe821('0xc')](function(){if(_0x597b85===_0xe821('0x46')){var _0x1d2062=_['map'](_0x4b0256[_0xe821('0x22')],'id');return _0x4b0256[_0xe821('0x47')](_0x1d2062)[_0xe821('0xc')](function(){for(var _0x353fa2=0x0;_0x353fa2<_0x1d2062['length'];_0x353fa2+=0x1){_0x55d3f5[_0xe821('0x48')](_0xe821('0x49'),{'ChatInteractionId':Number(_0x1d2062[_0x353fa2]),'UserId':Number(_0x4b0256['id'])});}});}})['then'](function(){if(_0x597b85===_0xe821('0x46')){var _0x40117d=_[_0xe821('0x17')](_0x4b0256['MailInteractions'],'id');return _0x4b0256[_0xe821('0x4a')](_0x40117d)['then'](function(){for(var _0x19d56b=0x0;_0x19d56b<_0x40117d[_0xe821('0x1c')];_0x19d56b+=0x1){_0x55d3f5[_0xe821('0x48')](_0xe821('0x4b'),{'MailInteractionId':Number(_0x40117d[_0x19d56b]),'UserId':Number(_0x4b0256['id'])});}});}})[_0xe821('0xc')](function(){if(_0x597b85===_0xe821('0x46')){var _0x5b190c=_[_0xe821('0x17')](_0x4b0256[_0xe821('0x4c')],'id');return _0x4b0256[_0xe821('0x4d')](_0x5b190c)[_0xe821('0xc')](function(){for(var _0x41f30f=0x0;_0x41f30f<_0x5b190c['length'];_0x41f30f+=0x1){_0x55d3f5[_0xe821('0x48')](_0xe821('0x4e'),{'FaxInteractionId':Number(_0x5b190c[_0x41f30f]),'UserId':Number(_0x4b0256['id'])});}});}})[_0xe821('0xc')](function(){if(_0x597b85===_0xe821('0x46')){var _0x14f8e9=_[_0xe821('0x17')](_0x4b0256[_0xe821('0x26')],'id');return _0x4b0256[_0xe821('0x4f')](_0x14f8e9)[_0xe821('0xc')](function(){for(var _0x22369e=0x0;_0x22369e<_0x14f8e9['length'];_0x22369e+=0x1){_0x55d3f5[_0xe821('0x48')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x14f8e9[_0x22369e]),'UserId':Number(_0x4b0256['id'])});}});}})['then'](function(){if(_0x597b85==='leave'){var _0x1ad8d8=_[_0xe821('0x17')](_0x4b0256['OpenchannelInteractions'],'id');return _0x4b0256[_0xe821('0x50')](_0x1ad8d8)[_0xe821('0xc')](function(){for(var _0x5b0791=0x0;_0x5b0791<_0x1ad8d8[_0xe821('0x1c')];_0x5b0791+=0x1){_0x55d3f5[_0xe821('0x48')](_0xe821('0x51'),{'OpenchannelInteractionId':Number(_0x1ad8d8[_0x5b0791]),'UserId':Number(_0x4b0256['id'])});}});}})[_0xe821('0xc')](function(){if(_0x597b85===_0xe821('0x46')){var _0x2e00f9=_[_0xe821('0x17')](_0x4b0256[_0xe821('0x52')],'id');return _0x4b0256[_0xe821('0x53')](_0x2e00f9)[_0xe821('0xc')](function(){for(var _0x567f8a=0x0;_0x567f8a<_0x2e00f9[_0xe821('0x1c')];_0x567f8a+=0x1){_0x55d3f5[_0xe821('0x48')](_0xe821('0x54'),{'WhatsappInteractionId':Number(_0x2e00f9[_0x567f8a]),'UserId':Number(_0x4b0256['id'])});}});}})[_0xe821('0x55')](function(_0x468a41){_0x28d08e[_0xe821('0x56')](_0x468a41);});}}function onDisconnect(_0x51e26d,_0x41110c){joinOrLeave(_0x51e26d,_0xe821('0x46'),_0x41110c);}function onConnect(_0x23fbbe){joinOrLeave(_0x23fbbe,'join');}exports[_0xe821('0x57')]=function(_0x3a4e59){_0x3a4e59['on'](_0xe821('0x58'),function(_0x4ffef7){_0x4ffef7[_0xe821('0x59')](0x0);_0x4ffef7[_0xe821('0x5a')]=_0x4ffef7[_0xe821('0x5b')][_0xe821('0x58')]['remoteAddress']+':'+_0x4ffef7[_0xe821('0x5b')][_0xe821('0x58')]['remotePort'];_0x4ffef7['connectedAt']=new Date();_0x4ffef7['log']=function(_0x48615d){console[_0xe821('0x56')]('SocketIO\x20'+_0x4ffef7[_0xe821('0x5c')][_0xe821('0x3')]+'['+_0x4ffef7['address']+']',_0x48615d);};_0x4ffef7['on'](_0xe821('0x5d'),function(){onDisconnect(_0x4ffef7,_0x3a4e59);_0x4ffef7['log'](_0xe821('0x5e'));});onConnect(_0x4ffef7);_0x4ffef7['log'](_0xe821('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 1f37269..f959367 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 _0x9247=['triggers','client','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','newmessage','SmsInteraction','Sms','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','info','Trigger,\x20%s','error','code','get','channel','event','direction','UserId','find','name','format','SIP/%s','incomingmessage','outgoingmessage','opened','changed','closed','User','interface','catch','default','length','model','callback','toLowerCase','util','../../mysqldb','jayson/promise','../logger'];(function(_0x5c04d7,_0xba8154){var _0x773680=function(_0x321b99){while(--_0x321b99){_0x5c04d7['push'](_0x5c04d7['shift']());}};_0x773680(++_0xba8154);}(_0x9247,0x6a));var _0x7924=function(_0x58ea32,_0x17c124){_0x58ea32=_0x58ea32-0x0;var _0x28273e=_0x9247[_0x58ea32];return _0x28273e;};'use strict';var util=require(_0x7924('0x0'));var db=require(_0x7924('0x1'))['db'];var jayson=require(_0x7924('0x2'));var logger=require(_0x7924('0x3'))(_0x7924('0x4'));var client=jayson[_0x7924('0x5')][_0x7924('0x6')]({'port':0x232a});var triggers=[{'channel':_0x7924('0x7'),'model':'ChatInteraction','event':_0x7924('0x8'),'condition':_0x7924('0x9'),'callback':afterCreate},{'channel':_0x7924('0x7'),'model':_0x7924('0xa'),'event':_0x7924('0xb'),'condition':_0x7924('0xc'),'callback':afterUpdate},{'channel':_0x7924('0x7'),'model':'ChatMessage','event':'afterCreate','condition':_0x7924('0xd'),'callback':afterCreateMessage},{'channel':'Sms','model':_0x7924('0xe'),'event':_0x7924('0x8'),'condition':_0x7924('0x9'),'callback':afterCreate},{'channel':_0x7924('0xf'),'model':_0x7924('0xe'),'event':'afterUpdate','condition':_0x7924('0xc'),'callback':afterUpdate},{'channel':_0x7924('0xf'),'model':'SmsMessage','event':'afterCreate','condition':_0x7924('0xd'),'callback':afterCreateMessage},{'channel':_0x7924('0x10'),'model':_0x7924('0x11'),'event':_0x7924('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x7924('0x10'),'model':'WhatsappInteraction','event':_0x7924('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7924('0x10'),'model':_0x7924('0x12'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x7924('0x13'),'model':_0x7924('0x14'),'event':_0x7924('0x8'),'condition':_0x7924('0x9'),'callback':afterCreate},{'channel':_0x7924('0x13'),'model':'FaxInteraction','event':'afterUpdate','condition':_0x7924('0xc'),'callback':afterUpdate},{'channel':'Fax','model':_0x7924('0x15'),'event':_0x7924('0x8'),'condition':_0x7924('0xd'),'callback':afterCreateMessage},{'channel':_0x7924('0x16'),'model':_0x7924('0x17'),'event':_0x7924('0x8'),'condition':_0x7924('0x9'),'callback':afterCreate},{'channel':_0x7924('0x16'),'model':_0x7924('0x17'),'event':_0x7924('0xb'),'condition':_0x7924('0xc'),'callback':afterUpdate},{'channel':_0x7924('0x16'),'model':_0x7924('0x18'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x7924('0x19'),'model':_0x7924('0x1a'),'event':_0x7924('0x8'),'condition':_0x7924('0x9'),'callback':afterCreate},{'channel':_0x7924('0x19'),'model':_0x7924('0x1a'),'event':_0x7924('0xb'),'condition':_0x7924('0xc'),'callback':afterUpdate},{'channel':_0x7924('0x19'),'model':'OpenchannelMessage','event':_0x7924('0x8'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x3d7798){return client[_0x7924('0x1b')](_0x7924('0x1c'),_0x3d7798)['then'](function(_0x31bd5b){logger[_0x7924('0x1d')](_0x7924('0x1e'),'EventManager',_0x31bd5b);if(_0x31bd5b[_0x7924('0x1f')]){if(_0x31bd5b[_0x7924('0x1f')][_0x7924('0x20')]===0x1f4){logger[_0x7924('0x1f')](_0x7924('0x1e'),'EventManager',_0x31bd5b[_0x7924('0x1f')]);}}})['catch'](function(_0x26c5e0){logger[_0x7924('0x1f')](_0x7924('0x1e'),_0x7924('0x1c'),_0x26c5e0);});}function afterCreateMessage(_0x1a7ad1,_0x4fa2fe){return function(_0x291a99,_0x54428b){_0x291a99=_0x291a99[_0x7924('0x21')]({'plain':!![]});_0x291a99[_0x7924('0x22')]=_0x1a7ad1;_0x291a99[_0x7924('0x23')]=_0x291a99[_0x7924('0x24')];if(_0x291a99[_0x7924('0x25')]){return db['User'][_0x7924('0x26')]({'where':{'id':_0x291a99['UserId']},'attributes':['id',_0x7924('0x27')],'raw':!![]})['then'](function(_0x431e56){_0x291a99['interface']=util[_0x7924('0x28')](_0x7924('0x29'),_0x431e56['name']);_0x291a99['channel']=_0x1a7ad1;return request({'event':_0x7924('0x2a'),'message':_0x291a99});})['catch'](function(_0x321ed2){console[_0x7924('0x1f')](_0x321ed2);});}else{return request({'event':_0x7924('0x2b'),'message':_0x291a99});}};}function afterCreate(_0x2e1a51,_0x9b7d4){return function(_0x11e15d,_0x43a0e2){_0x11e15d=_0x11e15d[_0x7924('0x21')]({'plain':!![]});_0x11e15d[_0x7924('0x22')]=_0x2e1a51;_0x11e15d['event']=_0x7924('0x2c');return request({'event':_0x9b7d4,'message':_0x11e15d});};}function afterUpdate(_0x5e496b,_0x8f93a8){return function(_0x529d4f,_0x1b0d86){if(_0x529d4f[_0x7924('0x2d')](_0x7924('0x2e'))&&_0x529d4f[_0x7924('0x2e')]){_0x529d4f=_0x529d4f[_0x7924('0x21')]({'plain':!![]});_0x529d4f[_0x7924('0x22')]=_0x5e496b;_0x529d4f[_0x7924('0x23')]=_0x7924('0x2e');if(_0x529d4f[_0x7924('0x25')]){return db[_0x7924('0x2f')][_0x7924('0x26')]({'where':{'id':_0x529d4f[_0x7924('0x25')]},'attributes':['id','name'],'raw':!![]})['then'](function(_0x2a6e48){_0x529d4f[_0x7924('0x30')]=util['format'](_0x7924('0x29'),_0x2a6e48['name']);return request({'event':_0x8f93a8,'message':_0x529d4f});})[_0x7924('0x31')](function(_0x4d11a3){console[_0x7924('0x1f')](_0x4d11a3);});}else{return request({'event':_0x8f93a8,'message':_0x529d4f});}}};}exports[_0x7924('0x32')]=function(){for(var _0x36d022=0x0;_0x36d022=_0x23b671[_0xe4eb('0x12')]){throw Error(_0xe4eb('0x13'));}_0x3b0f37(_0x43509c);})[_0xe4eb('0x14')](function(_0x1d5a66){_0x174c55(_0x1d5a66);});});}; \ No newline at end of file +var _0x85e0=['toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','User','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','openchannel','isValidChannel'];(function(_0x3b71e5,_0x333d6e){var _0x31d4fd=function(_0x52b911){while(--_0x52b911){_0x3b71e5['push'](_0x3b71e5['shift']());}};_0x31d4fd(++_0x333d6e);}(_0x85e0,0x15e));var _0x085e=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x85e0[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require('lodash');var BPromise=require(_0x085e('0x0'));var db=require(_0x085e('0x1'))['db'];var util=require(_0x085e('0x2'));var channels=[_0x085e('0x3'),_0x085e('0x4'),_0x085e('0x5'),_0x085e('0x6'),_0x085e('0x7'),'whatsapp',_0x085e('0x8')];exports['getChannels']=function(){return channels;};exports[_0x085e('0x9')]=function(_0x37b972){_0x37b972=_0x37b972[_0x085e('0xa')]();return _[_0x085e('0xb')](channels,_0x37b972);};exports[_0x085e('0xc')]=function(_0x4360a4,_0x360e7c,_0x57794f,_0x398425){var _0x45eb56={'loginAttempts':_0x360e7c,'blocked':_0x57794f};if(!_[_0x085e('0xd')](_0x398425)){_0x45eb56[_0x085e('0xe')]=_0x398425;}return _0x4360a4[_0x085e('0xf')](_0x45eb56);};exports[_0x085e('0x10')]=function(_0x4bbb1b){return new BPromise(function(_0x10d143,_0x58844f){var _0x30ec3f=0x0;if(_0x4bbb1b[_0x085e('0x11')]!=='agent'){_0x10d143(_0x4bbb1b);}db[_0x085e('0x12')]['count']({'where':{'role':_0x085e('0x13'),'online':!![],'id':{'$ne':_0x4bbb1b['id']}}})[_0x085e('0x14')](function(_0x3871cb){_0x30ec3f=_0x3871cb;return util[_0x085e('0x10')]();})['then'](function(_0x5b832f){if(_0x5b832f&&_0x5b832f[_0x085e('0x15')]&&_0x30ec3f>=_0x5b832f[_0x085e('0x15')]){throw Error(_0x085e('0x16'));}_0x10d143(_0x4bbb1b);})[_0x085e('0x17')](function(_0x152e1d){_0x58844f(_0x152e1d);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index cd7f6d3..bcc3182 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4411=['exports','status'];(function(_0x1bdcf8,_0x3c2a82){var _0x4a2d7f=function(_0x547257){while(--_0x547257){_0x1bdcf8['push'](_0x1bdcf8['shift']());}};_0x4a2d7f(++_0x3c2a82);}(_0x4411,0x170));var _0x1441=function(_0x184ae2,_0x57c309){_0x184ae2=_0x184ae2-0x0;var _0x229818=_0x4411[_0x184ae2];return _0x229818;};'use strict';module[_0x1441('0x0')][0x194]=function pageNotFound(_0x2f0d5f,_0xba910b){var _0x5cd5ab='404';var _0xfc079a=0x194;var _0x5a39f0={'status':_0xfc079a};_0xba910b[_0x1441('0x1')](_0x5a39f0[_0x1441('0x1')]);_0xba910b['render'](_0x5cd5ab,{},function(_0x3361ec,_0x4bdb55){if(_0x3361ec){return _0xba910b[_0x1441('0x1')](_0x5a39f0['status'])['json'](_0x5a39f0);}_0xba910b['send'](_0x4bdb55);});}; \ No newline at end of file +var _0x3b3f=['json','send','404','status','render'];(function(_0x34003e,_0x119f72){var _0x21faef=function(_0x1d40f2){while(--_0x1d40f2){_0x34003e['push'](_0x34003e['shift']());}};_0x21faef(++_0x119f72);}(_0x3b3f,0x1ab));var _0xf3b3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3b3f[_0x3947c9];return _0x2e7871;};'use strict';module['exports'][0x194]=function pageNotFound(_0x41f4ca,_0x10ec01){var _0x224bed=_0xf3b3('0x0');var _0x167a61=0x194;var _0x4eb24a={'status':_0x167a61};_0x10ec01['status'](_0x4eb24a[_0xf3b3('0x1')]);_0x10ec01[_0xf3b3('0x2')](_0x224bed,{},function(_0x3aad8b,_0x32249a){if(_0x3aad8b){return _0x10ec01[_0xf3b3('0x1')](_0x4eb24a['status'])[_0xf3b3('0x3')](_0x4eb24a);}_0x10ec01[_0xf3b3('0x4')](_0x32249a);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 054a48f..2c37f8c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc5c=['../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','../api/condition/condition.model','Interval','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','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','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','hasMany','Recordings','UserId','UserVoiceQueueRt','VoiceQueuesRt','Extensions','CmHopperFinal','ReportAgentPreview','ChatInteraction','ChatInteractions','SmsInteraction','SmsInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','UserNotifications','belongsTo','userProfileId','chat_group_has_users','belongsToMany','CmContact','Contacts','Lists','user_has_teams','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','SmsQueues','WhatsappQueue','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','VoiceQueue','CmHopper','Hoppers','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','Interactions','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','restrict','TagId','List','DashboardItem','Answers','Exntensions','FaxMessage','FaxInteractionId','FaxAccountId','fax_interaction_has_tags','Attachment','AttachmentId','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','CmCompany','Company','CompanyId','cm_user_has_contacts','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AllCondition','AnyCondition','Actions','TriggerId','Fields','CustomReportId','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','ZohoConfiguration','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FreshsalesAccount','FreshsalesConfiguration','FromId','ToId','SessionId','JscriptyProject','ProjectId','user_has_square_projects','team_has_chat_queues','team_has_fax_queues','OpenchannelQueues','team_has_whatsapp_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','xcall','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','127.0.0.1','database','options','password','User','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue'];(function(_0x5aace1,_0x30d389){var _0x4933e1=function(_0x359088){while(--_0x359088){_0x5aace1['push'](_0x5aace1['shift']());}};_0x4933e1(++_0x30d389);}(_0xfc5c,0x185));var _0xcfc5=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xfc5c[_0x13e741];return _0x3f8bb3;};'use strict';var path=require('path');var config=require(_0xcfc5('0x0'));var Sequelize=require(_0xcfc5('0x1'));var _=require(_0xcfc5('0x2'));var jstz=require('jstz');var timezone=jstz[_0xcfc5('0x3')]();config['sequelize']=_[_0xcfc5('0x4')](config['sequelize'],{'database':_0xcfc5('0x5'),'username':_0xcfc5('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xcfc5('0x7'),'dialectOptions':{'charset':_0xcfc5('0x8')},'logging':![],'timezone':timezone[_0xcfc5('0x9')](),'define':{'charset':_0xcfc5('0xa'),'collate':_0xcfc5('0xb')}}});config[_0xcfc5('0xc')]=_[_0xcfc5('0x4')](config[_0xcfc5('0xc')],{'database':_0xcfc5('0x5'),'username':_0xcfc5('0x6'),'password':_0xcfc5('0xd'),'options':{'host':_0xcfc5('0xe'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xcfc5('0x8')},'logging':![],'timezone':timezone[_0xcfc5('0x9')](),'define':{'charset':_0xcfc5('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcfc5('0x1')][_0xcfc5('0xf')],config[_0xcfc5('0x1')]['username'],config[_0xcfc5('0x1')]['password'],config[_0xcfc5('0x1')][_0xcfc5('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcfc5('0xc')][_0xcfc5('0xf')],config[_0xcfc5('0xc')]['username'],config['sequelizeHistory'][_0xcfc5('0x11')],config[_0xcfc5('0xc')][_0xcfc5('0x10')])};db[_0xcfc5('0x12')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/user/user.model');db['VoiceChanSpy']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x14'));db[_0xcfc5('0x15')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x16'));db[_0xcfc5('0x17')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x18'));db[_0xcfc5('0x19')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x1a'));db['VoiceQueue']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x1b'));db[_0xcfc5('0x1c')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x1d'));db['ScreenRecording']=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x1e'));db[_0xcfc5('0x1f')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xcfc5('0x20')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x21'));db[_0xcfc5('0x22')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0xcfc5('0x23')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x24'));db[_0xcfc5('0x25')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xcfc5('0x26')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x27'));db[_0xcfc5('0x28')]=db[_0xcfc5('0x1')]['import']('../api/trunk/trunk.model');db[_0xcfc5('0x29')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db['sequelize'][_0xcfc5('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xcfc5('0x2a')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xcfc5('0x2b')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x2c'));db[_0xcfc5('0x2d')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x2e'));db[_0xcfc5('0x2f')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x30'));db[_0xcfc5('0x31')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x32'));db[_0xcfc5('0x33')]=db[_0xcfc5('0x1')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xcfc5('0x34')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x35'));db[_0xcfc5('0x36')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x37'));db[_0xcfc5('0x38')]=db['sequelize'][_0xcfc5('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0xcfc5('0x39')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x3a'));db[_0xcfc5('0x3b')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x3c'));db[_0xcfc5('0x3d')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x3e'));db[_0xcfc5('0x3f')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x40'));db[_0xcfc5('0x41')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x42'));db[_0xcfc5('0x43')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/mailApplication/mailApplication.model');db[_0xcfc5('0x44')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x45'));db[_0xcfc5('0x46')]=db[_0xcfc5('0x1')]['import']('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0xcfc5('0x47')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x48'));db[_0xcfc5('0x49')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/faxApplication/faxApplication.model');db[_0xcfc5('0x4a')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x4b'));db['FaxMessage']=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/faxMessage/faxMessage.model');db[_0xcfc5('0x4c')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x4d'));db[_0xcfc5('0x4e')]=db['sequelize'][_0xcfc5('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0xcfc5('0x4f')]=db['sequelize']['import'](_0xcfc5('0x50'));db[_0xcfc5('0x51')]=db['sequelize']['import'](_0xcfc5('0x52'));db['SmsInteraction']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x53'));db[_0xcfc5('0x54')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x55'));db[_0xcfc5('0x56')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/smsQueue/smsQueue.model');db[_0xcfc5('0x57')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x58'));db[_0xcfc5('0x59')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x5a'));db[_0xcfc5('0x5b')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x5c'));db[_0xcfc5('0x5d')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/openchannelMessage/openchannelMessage.model');db[_0xcfc5('0x5e')]=db[_0xcfc5('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xcfc5('0x5f')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x60'));db[_0xcfc5('0x61')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x62'));db[_0xcfc5('0x63')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x64'));db['ChatInteraction']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x65'));db[_0xcfc5('0x66')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x67'));db[_0xcfc5('0x68')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x69'));db[_0xcfc5('0x6a')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x6b'));db[_0xcfc5('0x6c')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x6d'));db[_0xcfc5('0x6e')]=db[_0xcfc5('0x1')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/cmCompany/cmCompany.model');db['CmContact']=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x6f'));db['CmHopper']=db['sequelize']['import'](_0xcfc5('0x70'));db[_0xcfc5('0x71')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x72'));db['CmHopperFinal']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x73'));db[_0xcfc5('0x74')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x75'));db[_0xcfc5('0x76')]=db['sequelize'][_0xcfc5('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0xcfc5('0x77')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x78'));db[_0xcfc5('0x79')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x7a'));db[_0xcfc5('0x7b')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x7c'));db['Disposition']=db['sequelize'][_0xcfc5('0x13')]('../api/disposition/disposition.model');db[_0xcfc5('0x7d')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x7e'));db[_0xcfc5('0x7f')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/interval/interval.model');db['Pause']=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x80'));db['Cdr']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x81'));db[_0xcfc5('0x82')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x83'));db[_0xcfc5('0x84')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x85'));db['Sound']=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x86'));db[_0xcfc5('0x87')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x88'));db[_0xcfc5('0x89')]=db[_0xcfc5('0x1')]['import']('../api/template/template.model');db[_0xcfc5('0x8a')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x8b'));db[_0xcfc5('0x8c')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/variable/variable.model');db[_0xcfc5('0x8d')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x8e'));db[_0xcfc5('0x8f')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x90'));db[_0xcfc5('0x91')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x92'));db[_0xcfc5('0x93')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x94'));db[_0xcfc5('0x95')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x96'));db['AnalyticMetric']=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0xcfc5('0x97')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x98'));db['AnalyticTreeReport']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x99'));db[_0xcfc5('0x9a')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x9b'));db[_0xcfc5('0x9c')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x9d'));db[_0xcfc5('0x9e')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x9f'));db['SugarcrmAccount']=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0xa0'));db['SugarcrmConfiguration']=db[_0xcfc5('0x1')]['import'](_0xcfc5('0xa1'));db['SugarcrmField']=db[_0xcfc5('0x1')]['import'](_0xcfc5('0xa2'));db[_0xcfc5('0xa3')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0xa4'));db[_0xcfc5('0xa5')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0xa6'));db[_0xcfc5('0xa7')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xa8'));db[_0xcfc5('0xa9')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0xaa'));db['ZohoConfiguration']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xab'));db[_0xcfc5('0xac')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/intZohoField/intZohoField.model');db[_0xcfc5('0xad')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xae'));db['ZendeskConfiguration']=db['sequelize']['import'](_0xcfc5('0xaf'));db['ZendeskField']=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0xcfc5('0xb0')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xb1'));db[_0xcfc5('0xb2')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xcfc5('0xb3')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0xb4'));db[_0xcfc5('0xb5')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xcfc5('0xb6')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xb7'));db[_0xcfc5('0xb8')]=db[_0xcfc5('0x1')]['import']('../api/intVtigerField/intVtigerField.model');db[_0xcfc5('0xb9')]=db[_0xcfc5('0x1')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0xcfc5('0xba')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0xbb'));db[_0xcfc5('0xbc')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xbd'));db[_0xcfc5('0xbe')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0xbf'));db[_0xcfc5('0xc0')]=db['sequelize']['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xcfc5('0xc1')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0xc2'));db['FreshsalesAccount']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xc3'));db['FreshsalesConfiguration']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xc4'));db[_0xcfc5('0xc5')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0xc6'));db[_0xcfc5('0x8d')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x8e'));db[_0xcfc5('0xc7')]=db['sequelize'][_0xcfc5('0x13')]('../api/network/network.model');db[_0xcfc5('0xc8')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0xc9'));db[_0xcfc5('0xca')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xcb'));db[_0xcfc5('0xcc')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0xcd'));db[_0xcfc5('0xce')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xcf'));db[_0xcfc5('0xd0')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xd1'));db[_0xcfc5('0xd2')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xd3'));db[_0xcfc5('0xd4')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xd5'));db[_0xcfc5('0xd6')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xd7'));db['JscriptyProject']=db['sequelize']['import'](_0xcfc5('0xd8'));db['Setting']=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/setting/setting.model');db['SquareOdbc']=db[_0xcfc5('0x1')]['import']('../api/squareOdbc/squareOdbc.model');db[_0xcfc5('0xd9')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0xda'));db['SquareRecording']=db['sequelize']['import'](_0xcfc5('0xdb'));db[_0xcfc5('0xdc')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xdd'));db[_0xcfc5('0xde')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0xdf'));db[_0xcfc5('0xe0')]=db[_0xcfc5('0x1')]['import']('../api/license/license.model');db[_0xcfc5('0xe1')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xe2'));db[_0xcfc5('0xe3')]=db['sequelize'][_0xcfc5('0x13')]('../api/migration/migration.model');db['Attachment']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xe4'));db['Plugin']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xe5'));db[_0xcfc5('0xe6')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0xe7'));db[_0xcfc5('0xe8')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0xe9'));db[_0xcfc5('0xea')]=db[_0xcfc5('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0xcfc5('0xeb')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xec'));db[_0xcfc5('0xed')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0xee'));db[_0xcfc5('0xef')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xf0'));db[_0xcfc5('0xf1')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0xcfc5('0xf2')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xf3'));db['UserProfileSection']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xf4'));db[_0xcfc5('0xf5')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0xf6'));db[_0xcfc5('0xf7')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xf8'));db[_0xcfc5('0xf9')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/userNotification/userNotification.model');db[_0xcfc5('0xfa')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0xfb'));db[_0xcfc5('0xfc')]=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0xfd'));db[_0xcfc5('0xfe')]=db[_0xcfc5('0x1')][_0xcfc5('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db['sequelize']['import'](_0xcfc5('0xff'));db[_0xcfc5('0x100')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x101'));db[_0xcfc5('0x102')]=db[_0xcfc5('0x1')]['import'](_0xcfc5('0x103'));db['WhatsappQueue']=db['sequelize'][_0xcfc5('0x13')](_0xcfc5('0x104'));db['CloudProvider']=db[_0xcfc5('0x1')][_0xcfc5('0x13')](_0xcfc5('0x105'));db[_0xcfc5('0x12')][_0xcfc5('0x106')](db[_0xcfc5('0x107')],{'as':'VoiceMail','onDelete':_0xcfc5('0x108'),'foreignKey':'UserId'});db[_0xcfc5('0x12')][_0xcfc5('0x109')](db[_0xcfc5('0x1c')],{'as':_0xcfc5('0x10a'),'foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x12')]['hasMany'](db[_0xcfc5('0x10c')],{'as':_0xcfc5('0x10d'),'foreignKey':_0xcfc5('0x10b')});db['User'][_0xcfc5('0x109')](db[_0xcfc5('0x17')],{'as':_0xcfc5('0x10e'),'onDelete':_0xcfc5('0x108'),'hooks':!![]});db[_0xcfc5('0x12')][_0xcfc5('0x109')](db[_0xcfc5('0x10f')],{'as':'HopperFinals','foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x12')][_0xcfc5('0x109')](db[_0xcfc5('0x74')],{'as':'HopperHistory','foreignKey':_0xcfc5('0x10b')});db['User'][_0xcfc5('0x109')](db[_0xcfc5('0x110')],{'as':_0xcfc5('0x110'),'foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x12')][_0xcfc5('0x109')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x12')][_0xcfc5('0x109')](db[_0xcfc5('0x111')],{'as':_0xcfc5('0x112'),'foreignKey':_0xcfc5('0x10b')});db['User']['hasMany'](db[_0xcfc5('0x113')],{'as':_0xcfc5('0x114'),'foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x12')]['hasMany'](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'UserId'});db['User'][_0xcfc5('0x109')](db[_0xcfc5('0x3f')],{'as':_0xcfc5('0x115'),'foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x12')][_0xcfc5('0x109')](db[_0xcfc5('0xfe')],{'as':_0xcfc5('0x116'),'foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x12')][_0xcfc5('0x109')](db[_0xcfc5('0xf7')],{'as':_0xcfc5('0x117'),'foreignKey':_0xcfc5('0x118')});db[_0xcfc5('0x12')][_0xcfc5('0x109')](db[_0xcfc5('0xf9')],{'as':_0xcfc5('0x119'),'foreignKey':_0xcfc5('0x118')});db[_0xcfc5('0x12')][_0xcfc5('0x11a')](db[_0xcfc5('0xf2')],{'as':'UserProfile','foreignKey':_0xcfc5('0x11b')});db[_0xcfc5('0x12')]['belongsToMany'](db[_0xcfc5('0x6c')],{'as':'Groups','through':_0xcfc5('0x11c')});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db[_0xcfc5('0x11e')],{'as':_0xcfc5('0x11f'),'through':'cm_user_has_contacts'});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x120'),'through':'cm_user_has_lists'});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db['Team'],{'through':_0xcfc5('0x121')});db[_0xcfc5('0x12')]['belongsToMany'](db[_0xcfc5('0x3f')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0xcfc5('0x12')]['belongsToMany'](db[_0xcfc5('0x111')],{'as':_0xcfc5('0x112'),'through':_0xcfc5('0x122')});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db[_0xcfc5('0x4a')],{'as':_0xcfc5('0x123'),'through':_0xcfc5('0x124')});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db['SmsInteraction'],{'as':'SmsInteractions','through':_0xcfc5('0x125')});db[_0xcfc5('0x12')]['belongsToMany'](db[_0xcfc5('0x5b')],{'as':_0xcfc5('0x126'),'through':_0xcfc5('0x127')});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db[_0xcfc5('0xfe')],{'as':_0xcfc5('0x116'),'through':_0xcfc5('0x128')});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db['VoiceQueue'],{'as':_0xcfc5('0x129'),'through':'UserVoiceQueue','required':![]});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db[_0xcfc5('0x3b')],{'as':_0xcfc5('0x12a'),'through':'UserMailQueue','required':![]});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db[_0xcfc5('0x6a')],{'as':_0xcfc5('0x12b'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db[_0xcfc5('0x4c')],{'as':_0xcfc5('0x12c'),'through':_0xcfc5('0x2f'),'required':![]});db[_0xcfc5('0x12')]['belongsToMany'](db[_0xcfc5('0x56')],{'as':_0xcfc5('0x12d'),'through':'UserSmsQueue','required':![]});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db[_0xcfc5('0x5e')],{'as':'OpenchannelQueues','through':_0xcfc5('0x33'),'required':![]});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db[_0xcfc5('0x12e')],{'as':_0xcfc5('0x12f'),'through':_0xcfc5('0x34'),'required':![]});db['User'][_0xcfc5('0x11d')](db[_0xcfc5('0xef')],{'through':_0xcfc5('0x130')});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db[_0xcfc5('0xf1')],{'as':_0xcfc5('0x131'),'through':_0xcfc5('0x132'),'required':![]});db[_0xcfc5('0x12')]['belongsToMany'](db[_0xcfc5('0x5f')],{'as':_0xcfc5('0x133'),'through':_0xcfc5('0x134')});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db['FaxAccount'],{'as':_0xcfc5('0x135'),'through':_0xcfc5('0x136')});db[_0xcfc5('0x12')][_0xcfc5('0x11d')](db[_0xcfc5('0x39')],{'as':'MailAccounts','through':_0xcfc5('0x137')});db[_0xcfc5('0x12')]['belongsToMany'](db[_0xcfc5('0x57')],{'as':_0xcfc5('0x138'),'through':_0xcfc5('0x139')});db['User'][_0xcfc5('0x11d')](db['SmsAccount'],{'as':_0xcfc5('0x13a'),'through':_0xcfc5('0x13b')});db[_0xcfc5('0x12')]['belongsToMany'](db[_0xcfc5('0xfa')],{'as':_0xcfc5('0x13c'),'through':_0xcfc5('0x13d')});db[_0xcfc5('0x12')]['belongsToMany'](db['SquareProject'],{'as':_0xcfc5('0x13e'),'through':'user_has_square_projects'});db[_0xcfc5('0x13f')][_0xcfc5('0x109')](db['VoiceExtension'],{'as':_0xcfc5('0x140'),'onDelete':'cascade','foreignKey':_0xcfc5('0x141')});db[_0xcfc5('0x15')][_0xcfc5('0x109')](db[_0xcfc5('0x17')],{'onDelete':'cascade'});db['VoiceExtension'][_0xcfc5('0x109')](db[_0xcfc5('0x17')],{'as':_0xcfc5('0x142'),'onDelete':_0xcfc5('0x108')});db[_0xcfc5('0x19')][_0xcfc5('0x11d')](db[_0xcfc5('0x143')],{'as':_0xcfc5('0x144'),'through':_0xcfc5('0x145')});db['VoiceQueue'][_0xcfc5('0x109')](db['UserVoiceQueueRt'],{'as':_0xcfc5('0x146'),'foreignKey':_0xcfc5('0x147')});db[_0xcfc5('0x148')]['hasMany'](db[_0xcfc5('0x149')],{'as':_0xcfc5('0x14a'),'foreignKey':_0xcfc5('0x147')});db[_0xcfc5('0x148')][_0xcfc5('0x109')](db[_0xcfc5('0x10f')],{'as':_0xcfc5('0x14b'),'foreignKey':_0xcfc5('0x147')});db[_0xcfc5('0x148')][_0xcfc5('0x109')](db[_0xcfc5('0x74')],{'as':_0xcfc5('0x14c'),'foreignKey':_0xcfc5('0x147')});db['VoiceQueue'][_0xcfc5('0x109')](db['ReportAgentPreview'],{'as':_0xcfc5('0x110'),'foreignKey':_0xcfc5('0x147')});db[_0xcfc5('0x148')][_0xcfc5('0x109')](db[_0xcfc5('0x71')],{'as':_0xcfc5('0x14d'),'foreignKey':_0xcfc5('0x147')});db[_0xcfc5('0x148')]['hasMany'](db[_0xcfc5('0xd0')],{'as':_0xcfc5('0x14e'),'foreignKey':_0xcfc5('0x147')});db['VoiceQueue'][_0xcfc5('0x11a')](db['Trunk'],{'as':_0xcfc5('0x28'),'foreignKey':_0xcfc5('0x14f')});db[_0xcfc5('0x148')][_0xcfc5('0x11a')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xcfc5('0x150')});db[_0xcfc5('0x148')][_0xcfc5('0x11a')](db['Interval'],{'as':_0xcfc5('0x7f'),'foreignKey':_0xcfc5('0x151')});db[_0xcfc5('0x148')][_0xcfc5('0x11a')](db[_0xcfc5('0x152')],{'as':_0xcfc5('0x153'),'foreignKey':_0xcfc5('0x154')});db[_0xcfc5('0x148')]['belongsToMany'](db[_0xcfc5('0xef')],{'as':'Lists','through':_0xcfc5('0x155')});db['VoiceQueue'][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x156'),'through':_0xcfc5('0x2a')});db[_0xcfc5('0x148')]['belongsToMany'](db[_0xcfc5('0xde')],{'as':_0xcfc5('0x157'),'through':_0xcfc5('0x158')});db['VoiceQueue'][_0xcfc5('0x11d')](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x159'),'through':_0xcfc5('0x15a')});db[_0xcfc5('0x1c')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x12'),'foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x15b')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x12'),'foreignKey':_0xcfc5('0x10b')});db['VoiceMail'][_0xcfc5('0x109')](db['VoiceMailMessage'],{'as':_0xcfc5('0x15c'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0xcfc5('0x15d')});db['VoiceMailMessage'][_0xcfc5('0x11a')](db[_0xcfc5('0x107')],{'foreignKey':_0xcfc5('0x15e'),'targetKey':'mailbox'});db[_0xcfc5('0x20')]['hasMany'](db[_0xcfc5('0x25')],{'as':_0xcfc5('0x15f'),'foreignKey':_0xcfc5('0x160'),'constraints':![]});db[_0xcfc5('0x20')][_0xcfc5('0x109')](db[_0xcfc5('0x23')],{'as':_0xcfc5('0x161'),'foreignKey':_0xcfc5('0x160'),'constraints':![]});db[_0xcfc5('0x20')]['belongsTo'](db['User'],{'as':_0xcfc5('0x12'),'foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x20')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'as':_0xcfc5('0x162'),'foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0x36')][_0xcfc5('0x11a')](db['MailAccount'],{'as':_0xcfc5('0x39'),'foreignKey':_0xcfc5('0x164')});db['MailServerOut'][_0xcfc5('0x11a')](db[_0xcfc5('0x39')],{'as':'MailAccount','foreignKey':_0xcfc5('0x164')});db[_0xcfc5('0x39')][_0xcfc5('0x106')](db[_0xcfc5('0x36')],{'as':_0xcfc5('0x165'),'onDelete':'cascade'});db[_0xcfc5('0x39')][_0xcfc5('0x106')](db[_0xcfc5('0x38')],{'as':_0xcfc5('0x166'),'onDelete':_0xcfc5('0x108')});db[_0xcfc5('0x39')]['hasMany'](db[_0xcfc5('0x167')],{'as':_0xcfc5('0x168'),'foreignKey':_0xcfc5('0x164')});db[_0xcfc5('0x39')][_0xcfc5('0x109')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xcfc5('0x164')});db[_0xcfc5('0x39')][_0xcfc5('0x109')](db['MailMessage'],{'as':'Messages','foreignKey':_0xcfc5('0x164')});db[_0xcfc5('0x39')][_0xcfc5('0x109')](db[_0xcfc5('0x3f')],{'as':_0xcfc5('0x169')});db[_0xcfc5('0x39')][_0xcfc5('0x109')](db[_0xcfc5('0x43')],{'as':_0xcfc5('0x142')});db[_0xcfc5('0x39')][_0xcfc5('0x11a')](db['CmList'],{'as':'List','foreignKey':_0xcfc5('0x16a')});db[_0xcfc5('0x39')][_0xcfc5('0x11a')](db[_0xcfc5('0x89')],{'as':'Template','foreignKey':_0xcfc5('0x16b')});db[_0xcfc5('0x39')][_0xcfc5('0x11a')](db[_0xcfc5('0x152')],{'as':_0xcfc5('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcfc5('0x39')][_0xcfc5('0x11d')](db['User'],{'as':'Agents','through':_0xcfc5('0x137')});db[_0xcfc5('0x3b')][_0xcfc5('0x11d')](db['User'],{'as':'Agents','through':_0xcfc5('0x2d')});db[_0xcfc5('0x3b')][_0xcfc5('0x11d')](db['Team'],{'through':_0xcfc5('0x16c'),'as':'Teams'});db[_0xcfc5('0x3f')][_0xcfc5('0x109')](db['MailMessage'],{'as':_0xcfc5('0x15c'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x16d')});db[_0xcfc5('0x3f')][_0xcfc5('0x11a')](db[_0xcfc5('0x39')],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x164')});db[_0xcfc5('0x3f')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'as':'Contact','foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0x3f')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x16f'),'foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x3f')][_0xcfc5('0x11d')](db[_0xcfc5('0x87')],{'through':_0xcfc5('0x170'),'as':_0xcfc5('0x171')});db[_0xcfc5('0x3f')][_0xcfc5('0x11d')](db[_0xcfc5('0x87')],{'through':_0xcfc5('0x170'),'as':_0xcfc5('0x172')});db[_0xcfc5('0x3f')]['belongsToMany'](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x173'),'through':_0xcfc5('0x174'),'foreignKey':'MailInteractionId'});db[_0xcfc5('0x41')][_0xcfc5('0x109')](db['Attachment'],{'as':_0xcfc5('0x175'),'onDelete':_0xcfc5('0x108')});db['MailMessage']['belongsTo'](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x12')});db[_0xcfc5('0x41')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'onDelete':_0xcfc5('0x108'),'as':'Contact'});db['MailMessage'][_0xcfc5('0x11a')](db[_0xcfc5('0x3f')],{'as':_0xcfc5('0x176'),'foreignKey':'MailInteractionId'});db[_0xcfc5('0x41')][_0xcfc5('0x11a')](db[_0xcfc5('0x39')],{'as':_0xcfc5('0x16e'),'foreignKey':'MailAccountId'});db['MailApplication']['belongsTo'](db[_0xcfc5('0x12')],{'onDelete':_0xcfc5('0x177')});db['MailApplication'][_0xcfc5('0x11a')](db['MailQueue'],{'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x43')][_0xcfc5('0x11a')](db[_0xcfc5('0x39')],{'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x43')]['belongsTo'](db[_0xcfc5('0x7f')],{'onDelete':_0xcfc5('0x177'),'foreignKey':_0xcfc5('0x151')});db[_0xcfc5('0x43')]['belongsTo'](db[_0xcfc5('0x87')],{'onDelete':_0xcfc5('0x177'),'foreignKey':_0xcfc5('0x178')});db[_0xcfc5('0x44')][_0xcfc5('0x11a')](db[_0xcfc5('0x39')],{});db['MailQueueReport'][_0xcfc5('0x11a')](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x179'),'foreignKey':'ListId'});db[_0xcfc5('0x44')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'as':'Contact','foreignKey':_0xcfc5('0x163')});db['MailQueueReport']['belongsTo'](db[_0xcfc5('0x3f')],{});db[_0xcfc5('0x44')][_0xcfc5('0x11a')](db[_0xcfc5('0x41')],{});db[_0xcfc5('0x44')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{});db[_0xcfc5('0x44')][_0xcfc5('0x11a')](db[_0xcfc5('0x3b')],{});db['Dashboard'][_0xcfc5('0x109')](db[_0xcfc5('0x17a')],{'as':'Items','onDelete':_0xcfc5('0x108')});db[_0xcfc5('0x47')][_0xcfc5('0x109')](db[_0xcfc5('0x167')],{'as':'Dispositions','foreignKey':'FaxAccountId'});db[_0xcfc5('0x47')]['hasMany'](db['CannedAnswer'],{'as':_0xcfc5('0x17b'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0xcfc5('0x109')](db[_0xcfc5('0x4a')],{'as':_0xcfc5('0x169')});db[_0xcfc5('0x47')]['hasMany'](db[_0xcfc5('0x49')],{'as':_0xcfc5('0x142')});db[_0xcfc5('0x47')][_0xcfc5('0x109')](db['VoiceExtension'],{'as':_0xcfc5('0x17c'),'onDelete':_0xcfc5('0x108')});db[_0xcfc5('0x47')]['hasMany'](db[_0xcfc5('0x17d')],{'as':_0xcfc5('0x15c')});db[_0xcfc5('0x47')][_0xcfc5('0x11a')](db[_0xcfc5('0x28')],{'as':_0xcfc5('0x28')});db[_0xcfc5('0x47')]['belongsTo'](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x179'),'foreignKey':_0xcfc5('0x16a')});db[_0xcfc5('0x47')][_0xcfc5('0x11a')](db[_0xcfc5('0x152')],{'as':_0xcfc5('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount']['belongsToMany'](db[_0xcfc5('0x12')],{'as':'Agents','through':'user_has_fax_accounts'});db['FaxApplication']['belongsTo'](db[_0xcfc5('0x12')],{'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x49')][_0xcfc5('0x11a')](db[_0xcfc5('0x4c')],{'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x49')][_0xcfc5('0x11a')](db['FaxAccount'],{'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x49')][_0xcfc5('0x11a')](db[_0xcfc5('0x87')],{'onDelete':_0xcfc5('0x177'),'foreignKey':_0xcfc5('0x178')});db[_0xcfc5('0x4a')][_0xcfc5('0x109')](db[_0xcfc5('0x17d')],{'as':_0xcfc5('0x15c'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x17e')});db[_0xcfc5('0x4a')]['belongsTo'](db[_0xcfc5('0x47')],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x17f')});db[_0xcfc5('0x4a')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'as':_0xcfc5('0x162'),'foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0x4a')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x16f'),'foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x4a')][_0xcfc5('0x11d')](db[_0xcfc5('0x87')],{'through':_0xcfc5('0x180'),'as':'Tags'});db['FaxInteraction']['belongsToMany'](db[_0xcfc5('0x87')],{'through':_0xcfc5('0x180'),'as':_0xcfc5('0x172')});db[_0xcfc5('0x4a')]['belongsToMany'](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x173'),'through':'user_has_fax_interactions','foreignKey':_0xcfc5('0x17e')});db['FaxMessage'][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'onDelete':'cascade','as':_0xcfc5('0x12')});db[_0xcfc5('0x17d')]['belongsTo'](db['FaxInteraction'],{'as':_0xcfc5('0x176'),'foreignKey':'FaxInteractionId'});db[_0xcfc5('0x17d')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'onDelete':_0xcfc5('0x108'),'as':_0xcfc5('0x162')});db[_0xcfc5('0x17d')][_0xcfc5('0x11a')](db['Attachment'],{'as':_0xcfc5('0x181'),'foreignKey':_0xcfc5('0x182')});db[_0xcfc5('0x17d')][_0xcfc5('0x11a')](db[_0xcfc5('0x47')],{'as':_0xcfc5('0x16e'),'foreignKey':'FaxAccountId'});db[_0xcfc5('0x4c')]['belongsToMany'](db['User'],{'as':_0xcfc5('0x156'),'through':_0xcfc5('0x2f')});db['FaxQueue']['belongsToMany'](db['Team'],{'through':'team_has_fax_queues','as':_0xcfc5('0x157')});db[_0xcfc5('0x4e')][_0xcfc5('0x11a')](db[_0xcfc5('0x47')],{});db[_0xcfc5('0x4e')][_0xcfc5('0x11a')](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x179'),'foreignKey':'ListId'});db[_0xcfc5('0x4e')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'as':_0xcfc5('0x162'),'foreignKey':'ContactId'});db[_0xcfc5('0x4e')][_0xcfc5('0x11a')](db[_0xcfc5('0x4a')],{});db[_0xcfc5('0x4e')][_0xcfc5('0x11a')](db[_0xcfc5('0x17d')],{});db['FaxQueueReport'][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{});db[_0xcfc5('0x4e')][_0xcfc5('0x11a')](db[_0xcfc5('0x4c')],{});db['SmsAccount'][_0xcfc5('0x109')](db[_0xcfc5('0x167')],{'as':_0xcfc5('0x168'),'foreignKey':_0xcfc5('0x183')});db[_0xcfc5('0x4f')][_0xcfc5('0x109')](db['CannedAnswer'],{'as':_0xcfc5('0x17b'),'foreignKey':_0xcfc5('0x183')});db[_0xcfc5('0x4f')][_0xcfc5('0x109')](db['SmsMessage'],{'as':_0xcfc5('0x15c'),'foreignKey':_0xcfc5('0x183')});db[_0xcfc5('0x4f')][_0xcfc5('0x109')](db[_0xcfc5('0x113')],{'as':'Interactions'});db[_0xcfc5('0x4f')][_0xcfc5('0x109')](db['SmsApplication'],{'as':_0xcfc5('0x142')});db[_0xcfc5('0x4f')]['belongsTo'](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x179'),'foreignKey':_0xcfc5('0x16a')});db[_0xcfc5('0x4f')]['belongsTo'](db[_0xcfc5('0x152')],{'as':_0xcfc5('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcfc5('0x4f')][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x156'),'through':_0xcfc5('0x13b')});db[_0xcfc5('0x51')][_0xcfc5('0x11a')](db['User'],{'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x51')][_0xcfc5('0x11a')](db['SmsQueue'],{'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x51')][_0xcfc5('0x11a')](db[_0xcfc5('0x4f')],{'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x51')][_0xcfc5('0x11a')](db[_0xcfc5('0x7f')],{'onDelete':'restrict','foreignKey':_0xcfc5('0x151')});db[_0xcfc5('0x51')][_0xcfc5('0x11a')](db[_0xcfc5('0x87')],{'onDelete':_0xcfc5('0x177'),'foreignKey':_0xcfc5('0x178')});db['SmsInteraction'][_0xcfc5('0x109')](db[_0xcfc5('0x54')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xcfc5('0x184')});db['SmsInteraction'][_0xcfc5('0x11a')](db['SmsAccount'],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xcfc5('0x113')]['belongsTo'](db[_0xcfc5('0x11e')],{'as':'Contact','foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0x113')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x16f'),'foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x113')][_0xcfc5('0x11d')](db[_0xcfc5('0x87')],{'through':_0xcfc5('0x185'),'as':_0xcfc5('0x171')});db[_0xcfc5('0x113')][_0xcfc5('0x11d')](db[_0xcfc5('0x87')],{'through':_0xcfc5('0x185'),'as':_0xcfc5('0x172')});db[_0xcfc5('0x113')][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x173'),'through':_0xcfc5('0x125'),'foreignKey':_0xcfc5('0x184')});db['SmsMessage'][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x12')});db['SmsMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xcfc5('0x108'),'as':_0xcfc5('0x162')});db[_0xcfc5('0x54')][_0xcfc5('0x11a')](db[_0xcfc5('0x113')],{'onDelete':_0xcfc5('0x108'),'as':_0xcfc5('0x176'),'foreignKey':_0xcfc5('0x184')});db[_0xcfc5('0x54')][_0xcfc5('0x11a')](db['SmsAccount'],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x183')});db[_0xcfc5('0x56')]['belongsToMany'](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x156'),'through':_0xcfc5('0x31'),'foreignKey':_0xcfc5('0x186')});db[_0xcfc5('0x56')][_0xcfc5('0x11d')](db[_0xcfc5('0xde')],{'through':'team_has_sms_queues','as':_0xcfc5('0x157')});db[_0xcfc5('0x57')][_0xcfc5('0x109')](db[_0xcfc5('0x167')],{'as':_0xcfc5('0x168'),'foreignKey':_0xcfc5('0x187')});db['OpenchannelAccount']['hasMany'](db[_0xcfc5('0x7b')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xcfc5('0x109')](db[_0xcfc5('0x5b')],{'as':_0xcfc5('0x169'),'foreignKey':_0xcfc5('0x187')});db[_0xcfc5('0x57')][_0xcfc5('0x109')](db[_0xcfc5('0x5d')],{'as':_0xcfc5('0x15c'),'foreignKey':_0xcfc5('0x187')});db[_0xcfc5('0x57')]['hasMany'](db['OpenchannelApplication'],{'as':_0xcfc5('0x142'),'foreignKey':_0xcfc5('0x187')});db['OpenchannelAccount']['belongsTo'](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x179'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0xcfc5('0x11a')](db[_0xcfc5('0x152')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xcfc5('0x57')][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':'Agents','through':_0xcfc5('0x139')});db[_0xcfc5('0x59')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'onDelete':_0xcfc5('0x177')});db['OpenchannelApplication'][_0xcfc5('0x11a')](db[_0xcfc5('0x5e')],{'onDelete':_0xcfc5('0x177'),'foreignKey':_0xcfc5('0x188')});db['OpenchannelApplication'][_0xcfc5('0x11a')](db[_0xcfc5('0x57')],{'onDelete':_0xcfc5('0x177'),'foreignKey':_0xcfc5('0x187')});db[_0xcfc5('0x59')][_0xcfc5('0x11a')](db[_0xcfc5('0x7f')],{'onDelete':_0xcfc5('0x177'),'foreignKey':_0xcfc5('0x151')});db[_0xcfc5('0x59')][_0xcfc5('0x11a')](db[_0xcfc5('0x87')],{'onDelete':_0xcfc5('0x177'),'foreignKey':'TagId'});db[_0xcfc5('0x5b')][_0xcfc5('0x109')](db[_0xcfc5('0x5d')],{'as':_0xcfc5('0x15c'),'onDelete':_0xcfc5('0x108'),'foreignKey':'OpenchannelInteractionId'});db[_0xcfc5('0x5b')][_0xcfc5('0x11a')](db[_0xcfc5('0x57')],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x187')});db[_0xcfc5('0x5b')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'as':_0xcfc5('0x162'),'foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0x5b')][_0xcfc5('0x11a')](db['User'],{'as':_0xcfc5('0x16f'),'foreignKey':'UserId'});db[_0xcfc5('0x5b')]['belongsToMany'](db[_0xcfc5('0x87')],{'through':_0xcfc5('0x189'),'as':_0xcfc5('0x171')});db[_0xcfc5('0x5b')]['belongsToMany'](db[_0xcfc5('0x87')],{'through':_0xcfc5('0x189'),'as':'ThroughTags'});db[_0xcfc5('0x5b')][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':'Users','through':_0xcfc5('0x127'),'foreignKey':_0xcfc5('0x18a')});db[_0xcfc5('0x5d')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'onDelete':_0xcfc5('0x108'),'as':_0xcfc5('0x12')});db[_0xcfc5('0x5d')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'onDelete':_0xcfc5('0x108'),'as':_0xcfc5('0x162')});db[_0xcfc5('0x5d')][_0xcfc5('0x11a')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0xcfc5('0x176'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xcfc5('0x11a')](db['Attachment'],{'as':'Attachment','foreignKey':_0xcfc5('0x182')});db[_0xcfc5('0x5d')][_0xcfc5('0x11a')](db[_0xcfc5('0x57')],{'as':_0xcfc5('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0xcfc5('0x5e')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xcfc5('0x33'),'foreignKey':_0xcfc5('0x188')});db[_0xcfc5('0x5e')][_0xcfc5('0x11d')](db[_0xcfc5('0xde')],{'through':_0xcfc5('0x18b'),'as':'Teams'});db[_0xcfc5('0x5f')]['hasMany'](db[_0xcfc5('0x167')],{'as':_0xcfc5('0x168'),'foreignKey':_0xcfc5('0x18c')});db[_0xcfc5('0x5f')]['hasMany'](db['CannedAnswer'],{'as':_0xcfc5('0x17b'),'foreignKey':_0xcfc5('0x18c')});db[_0xcfc5('0x5f')][_0xcfc5('0x109')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0xcfc5('0x5f')]['hasMany'](db[_0xcfc5('0x111')],{'as':_0xcfc5('0x169')});db['ChatWebsite'][_0xcfc5('0x109')](db[_0xcfc5('0x63')],{'as':_0xcfc5('0x142')});db[_0xcfc5('0x5f')][_0xcfc5('0x109')](db[_0xcfc5('0x66')],{'as':'Messages'});db[_0xcfc5('0x5f')][_0xcfc5('0x11a')](db['CmList'],{'as':_0xcfc5('0x179'),'foreignKey':'ListId'});db[_0xcfc5('0x5f')][_0xcfc5('0x11a')](db['Interval'],{'as':_0xcfc5('0x7f'),'foreignKey':_0xcfc5('0x151')});db['ChatWebsite'][_0xcfc5('0x11a')](db[_0xcfc5('0x152')],{'as':'mandatoryDispositionPause','foreignKey':_0xcfc5('0x154')});db[_0xcfc5('0x5f')][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x156'),'through':_0xcfc5('0x134')});db[_0xcfc5('0x61')]['belongsTo'](db['OpenchannelAccount'],{});db[_0xcfc5('0x61')][_0xcfc5('0x11a')](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x179'),'foreignKey':_0xcfc5('0x16a')});db[_0xcfc5('0x61')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'as':_0xcfc5('0x162'),'foreignKey':_0xcfc5('0x163')});db['OpenchannelQueueReport']['belongsTo'](db[_0xcfc5('0x5b')],{});db[_0xcfc5('0x61')][_0xcfc5('0x11a')](db[_0xcfc5('0x5d')],{});db[_0xcfc5('0x61')]['belongsTo'](db[_0xcfc5('0x12')],{});db['OpenchannelQueueReport'][_0xcfc5('0x11a')](db['OpenchannelQueue'],{});db[_0xcfc5('0x63')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x18d'),'foreignKey':'UserId','onDelete':_0xcfc5('0x177')});db['ChatApplication'][_0xcfc5('0x11a')](db[_0xcfc5('0x6a')],{'as':'Queue','foreignKey':_0xcfc5('0x18e'),'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x63')][_0xcfc5('0x11a')](db['ChatWebsite'],{'as':_0xcfc5('0x18f'),'foreignKey':_0xcfc5('0x18c'),'onDelete':_0xcfc5('0x177')});db['ChatApplication'][_0xcfc5('0x11a')](db[_0xcfc5('0x87')],{'onDelete':_0xcfc5('0x177'),'foreignKey':_0xcfc5('0x178')});db[_0xcfc5('0x111')][_0xcfc5('0x109')](db['ChatMessage'],{'as':_0xcfc5('0x15c'),'onDelete':'cascade','foreignKey':_0xcfc5('0x190')});db[_0xcfc5('0x111')][_0xcfc5('0x11a')](db['ChatWebsite'],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x18c')});db[_0xcfc5('0x111')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'as':'Contact','foreignKey':'ContactId'});db['ChatInteraction']['belongsTo'](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x16f'),'foreignKey':_0xcfc5('0x10b')});db['ChatInteraction']['belongsToMany'](db['Tag'],{'through':_0xcfc5('0x191'),'as':_0xcfc5('0x171')});db[_0xcfc5('0x111')][_0xcfc5('0x11d')](db[_0xcfc5('0x87')],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db[_0xcfc5('0x111')][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x173'),'through':_0xcfc5('0x122'),'foreignKey':_0xcfc5('0x190')});db[_0xcfc5('0x66')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'onDelete':_0xcfc5('0x108'),'as':_0xcfc5('0x12')});db[_0xcfc5('0x66')]['belongsTo'](db[_0xcfc5('0x11e')],{'onDelete':_0xcfc5('0x108'),'as':'Contact','foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0x66')][_0xcfc5('0x11a')](db[_0xcfc5('0x111')],{'onDelete':_0xcfc5('0x108'),'as':_0xcfc5('0x176'),'foreignKey':_0xcfc5('0x190')});db['ChatMessage']['belongsTo'](db[_0xcfc5('0x181')],{'as':'Attachment','foreignKey':_0xcfc5('0x182')});db[_0xcfc5('0x66')][_0xcfc5('0x11a')](db[_0xcfc5('0x5f')],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x18c')});db[_0xcfc5('0x68')][_0xcfc5('0x11a')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0x68')][_0xcfc5('0x11a')](db[_0xcfc5('0x5f')],{'as':_0xcfc5('0x16e'),'foreignKey':'ChatWebsiteId'});db[_0xcfc5('0x6a')][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x156'),'through':'UserChatQueue','hooks':!![]});db[_0xcfc5('0x6a')][_0xcfc5('0x11d')](db[_0xcfc5('0xde')],{'through':'team_has_chat_queues','as':_0xcfc5('0x157')});db[_0xcfc5('0x6c')][_0xcfc5('0x109')](db[_0xcfc5('0xca')],{'as':_0xcfc5('0x15c'),'foreignKey':_0xcfc5('0x192'),'onDelete':_0xcfc5('0x108')});db['ChatGroup']['belongsToMany'](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x146'),'through':_0xcfc5('0x11c')});db[_0xcfc5('0x6e')][_0xcfc5('0x11a')](db['ChatWebsite'],{'as':_0xcfc5('0x18f'),'foreignKey':_0xcfc5('0x18c')});db[_0xcfc5('0x193')][_0xcfc5('0x109')](db[_0xcfc5('0x11e')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0xcfc5('0x11e')]['hasMany'](db[_0xcfc5('0x149')],{'as':'Hoppers','foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0x11e')][_0xcfc5('0x109')](db[_0xcfc5('0x10f')],{'as':'HopperFinals','foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0x11e')][_0xcfc5('0x109')](db[_0xcfc5('0x74')],{'as':'HopperHistories','foreignKey':_0xcfc5('0x163')});db['CmContact'][_0xcfc5('0x109')](db['ReportAgentPreview'],{'as':_0xcfc5('0x110'),'foreignKey':'ContactId'});db['CmContact'][_0xcfc5('0x109')](db['JscriptySessionReport'],{'as':_0xcfc5('0x14e'),'foreignKey':_0xcfc5('0x163')});db['CmContact']['hasMany'](db[_0xcfc5('0x5b')],{'as':_0xcfc5('0x126'),'foreignKey':_0xcfc5('0x163'),'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x11e')][_0xcfc5('0x109')](db[_0xcfc5('0x111')],{'as':'ChatInteractions','foreignKey':_0xcfc5('0x163'),'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x11e')][_0xcfc5('0x109')](db[_0xcfc5('0x113')],{'as':_0xcfc5('0x114'),'foreignKey':_0xcfc5('0x163'),'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x11e')][_0xcfc5('0x109')](db[_0xcfc5('0x4a')],{'as':_0xcfc5('0x123'),'foreignKey':_0xcfc5('0x163'),'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x11e')]['hasMany'](db[_0xcfc5('0x3f')],{'as':_0xcfc5('0x115'),'foreignKey':_0xcfc5('0x163'),'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0x11e')][_0xcfc5('0x11a')](db[_0xcfc5('0x193')],{'as':_0xcfc5('0x194'),'foreignKey':_0xcfc5('0x195')});db[_0xcfc5('0x11e')]['belongsTo'](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x179'),'foreignKey':_0xcfc5('0x16a'),'onDelete':'cascade'});db[_0xcfc5('0x11e')][_0xcfc5('0x11d')](db['User'],{'as':_0xcfc5('0x173'),'through':_0xcfc5('0x196')});db[_0xcfc5('0x11e')][_0xcfc5('0x11d')](db[_0xcfc5('0x87')],{'as':_0xcfc5('0x171'),'through':_0xcfc5('0x197')});db[_0xcfc5('0x11e')][_0xcfc5('0x11d')](db[_0xcfc5('0x87')],{'through':_0xcfc5('0x197'),'as':'ThroughTags'});db[_0xcfc5('0x149')]['belongsTo'](db['CmContact'],{'as':_0xcfc5('0x162'),'foreignKey':_0xcfc5('0x163'),'onDelete':_0xcfc5('0x108')});db[_0xcfc5('0x149')][_0xcfc5('0x11a')](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x179'),'foreignKey':_0xcfc5('0x16a'),'onDelete':_0xcfc5('0x108')});db[_0xcfc5('0x149')]['belongsTo'](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x18d'),'foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0x149')]['belongsTo'](db[_0xcfc5('0x148')],{'as':_0xcfc5('0x198'),'foreignKey':'VoiceQueueId','onDelete':_0xcfc5('0x108')});db[_0xcfc5('0x149')][_0xcfc5('0x11a')](db[_0xcfc5('0xe1')],{'as':'Campaign','foreignKey':_0xcfc5('0x199'),'onDelete':'cascade'});db[_0xcfc5('0x149')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x16f'),'foreignKey':_0xcfc5('0x19a')});db[_0xcfc5('0x71')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'as':_0xcfc5('0x162'),'foreignKey':_0xcfc5('0x163'),'onDelete':_0xcfc5('0x108')});db['CmHopperBlack'][_0xcfc5('0x11a')](db['CmList'],{'as':_0xcfc5('0x179'),'foreignKey':_0xcfc5('0x16a'),'onDelete':_0xcfc5('0x108')});db[_0xcfc5('0x71')]['belongsTo'](db[_0xcfc5('0x148')],{'as':'Queue','foreignKey':_0xcfc5('0x147'),'onDelete':_0xcfc5('0x108')});db[_0xcfc5('0x71')][_0xcfc5('0x11a')](db[_0xcfc5('0xe1')],{'as':_0xcfc5('0xe1'),'foreignKey':'CampaignId','onDelete':_0xcfc5('0x108')});db['Automation']['hasMany'](db[_0xcfc5('0x7d')],{'as':{'plural':_0xcfc5('0x19b'),'singular':'OneAll'},'foreignKey':_0xcfc5('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0xcfc5('0x79')][_0xcfc5('0x109')](db[_0xcfc5('0x7d')],{'as':{'plural':_0xcfc5('0x19d'),'singular':_0xcfc5('0x19e')},'foreignKey':_0xcfc5('0x19f'),'onDelete':_0xcfc5('0x108'),'hooks':!![]});db[_0xcfc5('0x79')][_0xcfc5('0x109')](db[_0xcfc5('0x77')],{'as':'Actions','foreignKey':_0xcfc5('0x1a0'),'onDelete':_0xcfc5('0x108'),'hooks':!![]});db[_0xcfc5('0x167')]['hasMany'](db[_0xcfc5('0x167')],{'as':_0xcfc5('0x168'),'foreignKey':'ParentId','onDelete':_0xcfc5('0x108')});db[_0xcfc5('0x7f')]['hasMany'](db['Interval'],{'as':_0xcfc5('0x1a1'),'foreignKey':_0xcfc5('0x151'),'onDelete':_0xcfc5('0x108'),'hooks':!![],'required':![]});db[_0xcfc5('0x7f')][_0xcfc5('0x109')](db[_0xcfc5('0x17')],{'as':_0xcfc5('0x10e'),'foreignKey':_0xcfc5('0x151'),'onDelete':_0xcfc5('0x177')});db['Interval'][_0xcfc5('0x109')](db['MailApplication'],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0xcfc5('0x7f')][_0xcfc5('0x109')](db[_0xcfc5('0x63')],{'as':_0xcfc5('0x1a2'),'foreignKey':_0xcfc5('0x151')});db[_0xcfc5('0x7f')][_0xcfc5('0x109')](db[_0xcfc5('0x49')],{'as':_0xcfc5('0x1a3'),'foreignKey':_0xcfc5('0x151')});db[_0xcfc5('0x7f')][_0xcfc5('0x109')](db[_0xcfc5('0x51')],{'as':_0xcfc5('0x1a4'),'foreignKey':'IntervalId'});db[_0xcfc5('0x84')]['belongsTo'](db['MailAccount'],{});db[_0xcfc5('0x84')][_0xcfc5('0x11a')](db[_0xcfc5('0x93')],{'foreignKey':_0xcfc5('0x1a5')});db['Schedule'][_0xcfc5('0x11a')](db[_0xcfc5('0x91')],{'foreignKey':'CustomReportId'});db[_0xcfc5('0x143')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0xcfc5('0x145'),'onDelete':'restrict'});db[_0xcfc5('0x87')]['belongsToMany'](db[_0xcfc5('0x11e')],{'through':_0xcfc5('0x197')});db['Tag'][_0xcfc5('0x11d')](db[_0xcfc5('0x111')],{'through':_0xcfc5('0x191')});db[_0xcfc5('0x87')][_0xcfc5('0x11d')](db[_0xcfc5('0x3f')],{'through':_0xcfc5('0x170')});db['Tag'][_0xcfc5('0x11d')](db[_0xcfc5('0x113')],{'through':_0xcfc5('0x185')});db[_0xcfc5('0x87')][_0xcfc5('0x11d')](db[_0xcfc5('0x4a')],{'through':_0xcfc5('0x180')});db[_0xcfc5('0x87')][_0xcfc5('0x11d')](db[_0xcfc5('0x5b')],{'through':_0xcfc5('0x189')});db['Tag']['belongsToMany'](db[_0xcfc5('0xfe')],{'through':'whatsapp_interaction_has_tags'});db[_0xcfc5('0x8a')]['hasMany'](db[_0xcfc5('0x7d')],{'as':{'plural':'AllConditions','singular':_0xcfc5('0x1a6')},'foreignKey':'TriggerAllId','onDelete':_0xcfc5('0x108'),'hooks':!![]});db[_0xcfc5('0x8a')][_0xcfc5('0x109')](db[_0xcfc5('0x7d')],{'as':{'plural':'AnyConditions','singular':_0xcfc5('0x1a7')},'foreignKey':'TriggerAnyId','onDelete':_0xcfc5('0x108'),'hooks':!![]});db[_0xcfc5('0x8a')]['hasMany'](db['Action'],{'as':_0xcfc5('0x1a8'),'foreignKey':_0xcfc5('0x1a9'),'onDelete':_0xcfc5('0x108'),'hooks':!![]});db[_0xcfc5('0x91')][_0xcfc5('0x109')](db[_0xcfc5('0x97')],{'as':_0xcfc5('0x1aa'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1ab'),'hooks':!![]});db[_0xcfc5('0x93')][_0xcfc5('0x109')](db['AnalyticFieldReport'],{'as':_0xcfc5('0x1aa'),'onDelete':'cascade','foreignKey':_0xcfc5('0x1a5')});db[_0xcfc5('0x1ac')][_0xcfc5('0x109')](db['AnalyticFieldReport'],{'as':_0xcfc5('0x1aa'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1ad')});db[_0xcfc5('0x97')][_0xcfc5('0x11a')](db['AnalyticMetric'],{'foreignKey':_0xcfc5('0x1ad')});db['SalesforceAccount'][_0xcfc5('0x109')](db[_0xcfc5('0x9c')],{'as':_0xcfc5('0x1ae'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1af')});db[_0xcfc5('0x9c')][_0xcfc5('0x109')](db[_0xcfc5('0x9e')],{'as':_0xcfc5('0x1b0'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0x9c')]['hasMany'](db[_0xcfc5('0x9e')],{'as':_0xcfc5('0x1b2'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0x9c')][_0xcfc5('0x109')](db[_0xcfc5('0x9e')],{'as':_0xcfc5('0x1aa'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1b4')});db[_0xcfc5('0x9c')][_0xcfc5('0x11a')](db['SalesforceAccount'],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x1af')});db[_0xcfc5('0x9e')][_0xcfc5('0x109')](db[_0xcfc5('0x9e')],{'as':_0xcfc5('0x1b5'),'foreignKey':_0xcfc5('0x1b1')});db['SalesforceField']['hasMany'](db[_0xcfc5('0x9e')],{'as':_0xcfc5('0x1b6'),'foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0x9e')][_0xcfc5('0x109')](db[_0xcfc5('0x9e')],{'as':_0xcfc5('0x1b7'),'foreignKey':'FieldId'});db[_0xcfc5('0x9e')]['belongsTo'](db[_0xcfc5('0x8c')],{'as':_0xcfc5('0x8c'),'foreignKey':_0xcfc5('0x1b8')});db[_0xcfc5('0x1b9')][_0xcfc5('0x109')](db[_0xcfc5('0x1ba')],{'as':_0xcfc5('0x1ae'),'onDelete':'cascade','foreignKey':_0xcfc5('0x1af')});db[_0xcfc5('0x1ba')][_0xcfc5('0x109')](db[_0xcfc5('0x1bb')],{'as':_0xcfc5('0x1b0'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0x1ba')][_0xcfc5('0x109')](db[_0xcfc5('0x1bb')],{'as':_0xcfc5('0x1b2'),'onDelete':_0xcfc5('0x108'),'foreignKey':'DescriptionId'});db[_0xcfc5('0x1ba')][_0xcfc5('0x109')](db[_0xcfc5('0x1bb')],{'as':_0xcfc5('0x1aa'),'onDelete':_0xcfc5('0x108'),'foreignKey':'FieldId'});db[_0xcfc5('0x1ba')][_0xcfc5('0x11a')](db[_0xcfc5('0x1b9')],{'as':_0xcfc5('0x16e'),'foreignKey':'AccountId'});db['SugarcrmField'][_0xcfc5('0x109')](db[_0xcfc5('0x1bb')],{'as':_0xcfc5('0x1b5'),'foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0x1bb')]['hasMany'](db['SugarcrmField'],{'as':_0xcfc5('0x1b6'),'foreignKey':'DescriptionId'});db[_0xcfc5('0x1bb')][_0xcfc5('0x109')](db['SugarcrmField'],{'as':'Field','foreignKey':_0xcfc5('0x1b4')});db[_0xcfc5('0x1bb')][_0xcfc5('0x11a')](db[_0xcfc5('0x8c')],{'as':_0xcfc5('0x8c'),'foreignKey':_0xcfc5('0x1b8')});db[_0xcfc5('0xa3')][_0xcfc5('0x109')](db[_0xcfc5('0xa5')],{'as':_0xcfc5('0x1ae'),'onDelete':_0xcfc5('0x108'),'foreignKey':'AccountId'});db[_0xcfc5('0xa5')]['hasMany'](db[_0xcfc5('0xa7')],{'as':_0xcfc5('0x1b0'),'onDelete':_0xcfc5('0x108'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0xcfc5('0x109')](db[_0xcfc5('0xa7')],{'as':_0xcfc5('0x1b2'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0xa5')]['hasMany'](db[_0xcfc5('0xa7')],{'as':_0xcfc5('0x1aa'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1b4')});db[_0xcfc5('0xa5')]['belongsTo'](db[_0xcfc5('0xa3')],{'as':_0xcfc5('0x16e'),'foreignKey':'AccountId'});db[_0xcfc5('0xa5')]['belongsToMany'](db[_0xcfc5('0x87')],{'through':'int_desk_configuration_has_tags'});db[_0xcfc5('0xa7')][_0xcfc5('0x109')](db[_0xcfc5('0xa7')],{'as':_0xcfc5('0x1b5'),'foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0xa7')][_0xcfc5('0x109')](db[_0xcfc5('0xa7')],{'as':_0xcfc5('0x1b6'),'foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0xa7')][_0xcfc5('0x109')](db['DeskField'],{'as':_0xcfc5('0x1b7'),'foreignKey':_0xcfc5('0x1b4')});db[_0xcfc5('0xa7')][_0xcfc5('0x11a')](db[_0xcfc5('0x8c')],{'as':_0xcfc5('0x8c'),'foreignKey':_0xcfc5('0x1b8')});db[_0xcfc5('0xa9')][_0xcfc5('0x109')](db[_0xcfc5('0x1bc')],{'as':_0xcfc5('0x1ae'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1af')});db[_0xcfc5('0x1bc')]['hasMany'](db[_0xcfc5('0xac')],{'as':'Subjects','onDelete':_0xcfc5('0x108'),'foreignKey':'SubjectId'});db[_0xcfc5('0x1bc')]['hasMany'](db[_0xcfc5('0xac')],{'as':_0xcfc5('0x1b2'),'onDelete':'cascade','foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0x1bc')][_0xcfc5('0x109')](db[_0xcfc5('0xac')],{'as':_0xcfc5('0x1aa'),'onDelete':_0xcfc5('0x108'),'foreignKey':'FieldId'});db[_0xcfc5('0x1bc')]['belongsTo'](db[_0xcfc5('0xa9')],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x1af')});db['ZohoField']['hasMany'](db[_0xcfc5('0xac')],{'as':'Subject','foreignKey':_0xcfc5('0x1b1')});db['ZohoField'][_0xcfc5('0x109')](db[_0xcfc5('0xac')],{'as':_0xcfc5('0x1b6'),'foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0xac')]['hasMany'](db[_0xcfc5('0xac')],{'as':_0xcfc5('0x1b7'),'foreignKey':_0xcfc5('0x1b4')});db[_0xcfc5('0xac')][_0xcfc5('0x11a')](db[_0xcfc5('0x8c')],{'as':_0xcfc5('0x8c'),'foreignKey':'VariableId'});db[_0xcfc5('0xad')][_0xcfc5('0x109')](db[_0xcfc5('0x1bd')],{'as':_0xcfc5('0x1ae'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1af')});db[_0xcfc5('0x1bd')][_0xcfc5('0x109')](db[_0xcfc5('0x1be')],{'as':_0xcfc5('0x1b0'),'foreignKey':'SubjectId'});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0xcfc5('0x1b2'),'foreignKey':'DescriptionId'});db[_0xcfc5('0x1bd')][_0xcfc5('0x109')](db[_0xcfc5('0x1be')],{'as':_0xcfc5('0x1aa'),'foreignKey':_0xcfc5('0x1b4')});db[_0xcfc5('0x1bd')][_0xcfc5('0x11a')](db['ZendeskAccount'],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x1af')});db['ZendeskConfiguration'][_0xcfc5('0x11d')](db['Tag'],{'through':_0xcfc5('0x1bf')});db[_0xcfc5('0x1be')]['hasMany'](db[_0xcfc5('0x1be')],{'as':_0xcfc5('0x1b5'),'foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0x1be')][_0xcfc5('0x109')](db['ZendeskField'],{'as':_0xcfc5('0x1b6'),'foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0x1be')][_0xcfc5('0x109')](db[_0xcfc5('0x1be')],{'as':_0xcfc5('0x1b7'),'foreignKey':'FieldId'});db[_0xcfc5('0x1be')]['belongsTo'](db[_0xcfc5('0x8c')],{'as':_0xcfc5('0x8c'),'foreignKey':_0xcfc5('0x1b8')});db['FreshdeskAccount']['hasMany'](db['FreshdeskConfiguration'],{'as':_0xcfc5('0x1ae'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1af')});db[_0xcfc5('0xb2')][_0xcfc5('0x109')](db[_0xcfc5('0xb3')],{'as':_0xcfc5('0x1b0'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0xb2')][_0xcfc5('0x109')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0xb2')]['hasMany'](db[_0xcfc5('0xb3')],{'as':_0xcfc5('0x1aa'),'onDelete':_0xcfc5('0x108'),'foreignKey':'FieldId'});db[_0xcfc5('0xb2')][_0xcfc5('0x11a')](db[_0xcfc5('0xb0')],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x1af')});db[_0xcfc5('0xb2')][_0xcfc5('0x11d')](db[_0xcfc5('0x87')],{'through':_0xcfc5('0x1c0')});db[_0xcfc5('0xb3')][_0xcfc5('0x109')](db['FreshdeskField'],{'as':_0xcfc5('0x1b5'),'foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0xb3')][_0xcfc5('0x109')](db[_0xcfc5('0xb3')],{'as':_0xcfc5('0x1b6'),'foreignKey':'DescriptionId'});db[_0xcfc5('0xb3')][_0xcfc5('0x109')](db[_0xcfc5('0xb3')],{'as':_0xcfc5('0x1b7'),'foreignKey':_0xcfc5('0x1b4')});db[_0xcfc5('0xb3')][_0xcfc5('0x11a')](db['Variable'],{'as':_0xcfc5('0x8c'),'foreignKey':_0xcfc5('0x1b8')});db['VtigerAccount']['hasMany'](db['VtigerConfiguration'],{'as':_0xcfc5('0x1ae'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1af')});db[_0xcfc5('0xb6')][_0xcfc5('0x109')](db[_0xcfc5('0xb8')],{'as':_0xcfc5('0x1b0'),'foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0xb6')][_0xcfc5('0x109')](db['VtigerField'],{'as':_0xcfc5('0x1b2'),'foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0xb6')][_0xcfc5('0x109')](db['VtigerField'],{'as':_0xcfc5('0x1aa'),'foreignKey':_0xcfc5('0x1b4')});db[_0xcfc5('0xb6')][_0xcfc5('0x11a')](db['VtigerAccount'],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x1af')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0xb8')][_0xcfc5('0x109')](db['VtigerField'],{'as':_0xcfc5('0x1b6'),'foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0xb8')][_0xcfc5('0x109')](db['VtigerField'],{'as':_0xcfc5('0x1b7'),'foreignKey':_0xcfc5('0x1b4')});db[_0xcfc5('0xb8')][_0xcfc5('0x11a')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xcfc5('0xb9')]['hasMany'](db[_0xcfc5('0xba')],{'as':'Configurations','onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1af')});db[_0xcfc5('0xba')][_0xcfc5('0x109')](db[_0xcfc5('0xbc')],{'as':_0xcfc5('0x1b0'),'foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0xba')][_0xcfc5('0x109')](db[_0xcfc5('0xbc')],{'as':'Descriptions','foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0xba')][_0xcfc5('0x109')](db[_0xcfc5('0xbc')],{'as':_0xcfc5('0x1aa'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0xcfc5('0x11a')](db[_0xcfc5('0xb9')],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x1af')});db[_0xcfc5('0xbc')][_0xcfc5('0x109')](db[_0xcfc5('0xbc')],{'as':_0xcfc5('0x1b5'),'foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0xbc')][_0xcfc5('0x109')](db[_0xcfc5('0xbc')],{'as':_0xcfc5('0x1b6'),'foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0xbc')][_0xcfc5('0x109')](db['ServicenowField'],{'as':_0xcfc5('0x1b7'),'foreignKey':'FieldId'});db['ServicenowField'][_0xcfc5('0x11a')](db[_0xcfc5('0x8c')],{'as':'Variable','foreignKey':_0xcfc5('0x1b8')});db[_0xcfc5('0xbe')][_0xcfc5('0x109')](db['Dynamics365Configuration'],{'as':_0xcfc5('0x1ae'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1af')});db['Dynamics365Configuration'][_0xcfc5('0x109')](db[_0xcfc5('0xc1')],{'as':_0xcfc5('0x1b0'),'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0xc0')][_0xcfc5('0x109')](db[_0xcfc5('0xc1')],{'as':'Descriptions','onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0xc0')][_0xcfc5('0x109')](db[_0xcfc5('0xc1')],{'as':_0xcfc5('0x1aa'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xcfc5('0xc0')]['belongsTo'](db[_0xcfc5('0xbe')],{'as':_0xcfc5('0x16e'),'foreignKey':'AccountId'});db[_0xcfc5('0xc1')][_0xcfc5('0x109')](db[_0xcfc5('0xc1')],{'as':'Subject','foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0xc1')][_0xcfc5('0x109')](db['Dynamics365Field'],{'as':'Description','foreignKey':_0xcfc5('0x1b3')});db['Dynamics365Field'][_0xcfc5('0x109')](db[_0xcfc5('0xc1')],{'as':'Field','foreignKey':'FieldId'});db[_0xcfc5('0xc1')][_0xcfc5('0x11a')](db[_0xcfc5('0x8c')],{'as':_0xcfc5('0x8c'),'foreignKey':_0xcfc5('0x1b8')});db[_0xcfc5('0x1c1')]['hasMany'](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1af')});db[_0xcfc5('0x1c2')][_0xcfc5('0x109')](db[_0xcfc5('0xc5')],{'as':_0xcfc5('0x1b0'),'foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0x1c2')][_0xcfc5('0x109')](db[_0xcfc5('0xc5')],{'as':_0xcfc5('0x1b2'),'foreignKey':_0xcfc5('0x1b3')});db[_0xcfc5('0x1c2')][_0xcfc5('0x109')](db[_0xcfc5('0xc5')],{'as':_0xcfc5('0x1aa'),'foreignKey':_0xcfc5('0x1b4')});db[_0xcfc5('0x1c2')]['belongsTo'](db[_0xcfc5('0x1c1')],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x1af')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xcfc5('0x1b1')});db[_0xcfc5('0xc5')][_0xcfc5('0x109')](db['FreshsalesField'],{'as':_0xcfc5('0x1b6'),'foreignKey':_0xcfc5('0x1b3')});db['FreshsalesField'][_0xcfc5('0x109')](db[_0xcfc5('0xc5')],{'as':_0xcfc5('0x1b7'),'foreignKey':'FieldId'});db[_0xcfc5('0xc5')][_0xcfc5('0x11a')](db[_0xcfc5('0x8c')],{'as':_0xcfc5('0x8c'),'foreignKey':_0xcfc5('0x1b8')});db['ChatQueueReport']['belongsTo'](db[_0xcfc5('0x5f')],{});db['ChatQueueReport']['belongsTo'](db[_0xcfc5('0xef')],{'as':'List','foreignKey':_0xcfc5('0x16a')});db['ChatQueueReport'][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'as':_0xcfc5('0x162'),'foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0xc8')][_0xcfc5('0x11a')](db[_0xcfc5('0x111')],{});db['ChatQueueReport'][_0xcfc5('0x11a')](db[_0xcfc5('0x66')],{});db[_0xcfc5('0xc8')]['belongsTo'](db[_0xcfc5('0x12')],{});db['ChatQueueReport'][_0xcfc5('0x11a')](db['ChatQueue'],{});db[_0xcfc5('0xca')][_0xcfc5('0x11a')](db['User'],{'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1c3')});db[_0xcfc5('0xca')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1c4')});db[_0xcfc5('0xd0')][_0xcfc5('0x109')](db[_0xcfc5('0xce')],{'foreignKey':_0xcfc5('0x1c5'),'onDelete':_0xcfc5('0x108')});db[_0xcfc5('0xd0')][_0xcfc5('0x109')](db[_0xcfc5('0xcc')],{'foreignKey':_0xcfc5('0x1c5'),'onDelete':'cascade'});db['SmsQueueReport']['belongsTo'](db[_0xcfc5('0x4f')],{});db[_0xcfc5('0xd2')][_0xcfc5('0x11a')](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x179'),'foreignKey':_0xcfc5('0x16a')});db[_0xcfc5('0xd2')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'as':_0xcfc5('0x162'),'foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0xd2')][_0xcfc5('0x11a')](db['SmsInteraction'],{});db['SmsQueueReport'][_0xcfc5('0x11a')](db[_0xcfc5('0x54')],{});db[_0xcfc5('0xd2')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{});db[_0xcfc5('0xd2')][_0xcfc5('0x11a')](db[_0xcfc5('0x56')],{});db[_0xcfc5('0x1c6')][_0xcfc5('0x109')](db[_0xcfc5('0xd0')],{'foreignKey':_0xcfc5('0x1c7')});db[_0xcfc5('0x1c6')][_0xcfc5('0x109')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0xcfc5('0x1c6')][_0xcfc5('0x109')](db['JscriptyAnswerReport'],{'foreignKey':_0xcfc5('0x1c7')});db[_0xcfc5('0xd9')][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x173'),'through':_0xcfc5('0x1c8')});db['Team']['belongsToMany'](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x156'),'through':_0xcfc5('0x121')});db[_0xcfc5('0xde')][_0xcfc5('0x11d')](db[_0xcfc5('0x148')],{'through':_0xcfc5('0x158'),'as':_0xcfc5('0x129')});db[_0xcfc5('0xde')][_0xcfc5('0x11d')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0xcfc5('0x12a')});db[_0xcfc5('0xde')][_0xcfc5('0x11d')](db['ChatQueue'],{'through':_0xcfc5('0x1c9'),'as':_0xcfc5('0x12b')});db[_0xcfc5('0xde')][_0xcfc5('0x11d')](db[_0xcfc5('0x4c')],{'through':_0xcfc5('0x1ca'),'as':_0xcfc5('0x12c')});db['Team']['belongsToMany'](db[_0xcfc5('0x56')],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0xcfc5('0xde')][_0xcfc5('0x11d')](db['OpenchannelQueue'],{'through':_0xcfc5('0x18b'),'as':_0xcfc5('0x1cb')});db['Team'][_0xcfc5('0x11d')](db[_0xcfc5('0x12e')],{'through':_0xcfc5('0x1cc'),'as':_0xcfc5('0x12f')});db['Campaign']['hasMany'](db[_0xcfc5('0x149')],{'as':_0xcfc5('0x14a'),'foreignKey':_0xcfc5('0x199')});db[_0xcfc5('0xe1')]['hasMany'](db['CmHopperFinal'],{'as':_0xcfc5('0x14b'),'foreignKey':'CampaignId'});db[_0xcfc5('0xe1')][_0xcfc5('0x109')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xcfc5('0x199')});db[_0xcfc5('0xe1')][_0xcfc5('0x109')](db[_0xcfc5('0x71')],{'as':_0xcfc5('0x14d'),'foreignKey':_0xcfc5('0x199')});db[_0xcfc5('0xe1')][_0xcfc5('0x11a')](db[_0xcfc5('0x28')],{'as':_0xcfc5('0x28'),'foreignKey':_0xcfc5('0x14f')});db[_0xcfc5('0xe1')][_0xcfc5('0x11a')](db[_0xcfc5('0x28')],{'as':_0xcfc5('0x1cd'),'foreignKey':_0xcfc5('0x150')});db[_0xcfc5('0xe1')]['belongsTo'](db[_0xcfc5('0x7f')],{'as':_0xcfc5('0x7f'),'foreignKey':'IntervalId'});db[_0xcfc5('0xe1')][_0xcfc5('0x11a')](db['SquareProject'],{'as':'SquareProject','foreignKey':_0xcfc5('0x1ce')});db['Campaign'][_0xcfc5('0x11d')](db[_0xcfc5('0xef')],{'as':'Lists','through':_0xcfc5('0x1cf')});db[_0xcfc5('0xe1')][_0xcfc5('0x11d')](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x159'),'through':_0xcfc5('0x1d0')});db[_0xcfc5('0xe6')][_0xcfc5('0x11a')](db['MailMessage'],{});db[_0xcfc5('0xe6')]['belongsTo'](db['MailInteraction'],{});db[_0xcfc5('0xe6')][_0xcfc5('0x11a')](db[_0xcfc5('0x39')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db['MailTransferReport'][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'foreignKey':_0xcfc5('0x1d1'),'as':_0xcfc5('0x1d2')});db[_0xcfc5('0xe6')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'foreignKey':_0xcfc5('0x1d3'),'as':'ToAgent'});db['MailTransferReport']['belongsTo'](db[_0xcfc5('0x3b')],{'foreignKey':_0xcfc5('0x1d4'),'as':_0xcfc5('0x1d5')});db[_0xcfc5('0xe6')]['belongsTo'](db[_0xcfc5('0x39')],{'foreignKey':_0xcfc5('0x1d6'),'as':_0xcfc5('0x1d7')});db['ChatTransferReport'][_0xcfc5('0x11a')](db['ChatMessage'],{});db[_0xcfc5('0xe8')][_0xcfc5('0x11a')](db['ChatInteraction'],{});db[_0xcfc5('0xe8')][_0xcfc5('0x11a')](db['ChatWebsite'],{'foreignKey':_0xcfc5('0x1d8'),'as':_0xcfc5('0x1d9')});db[_0xcfc5('0xe8')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'foreignKey':_0xcfc5('0x1d1'),'as':_0xcfc5('0x1d2')});db[_0xcfc5('0xe8')][_0xcfc5('0x11a')](db['User'],{'foreignKey':_0xcfc5('0x1d3'),'as':_0xcfc5('0x1da')});db[_0xcfc5('0xe8')][_0xcfc5('0x11a')](db[_0xcfc5('0x6a')],{'foreignKey':_0xcfc5('0x1db'),'as':_0xcfc5('0x1d5')});db[_0xcfc5('0xe8')]['belongsTo'](db[_0xcfc5('0x5f')],{'foreignKey':_0xcfc5('0x1dc'),'as':_0xcfc5('0x1d7')});db['FaxTransferReport'][_0xcfc5('0x11a')](db['FaxMessage'],{});db[_0xcfc5('0xea')][_0xcfc5('0x11a')](db[_0xcfc5('0x4a')],{});db['FaxTransferReport'][_0xcfc5('0x11a')](db[_0xcfc5('0x47')],{'foreignKey':_0xcfc5('0x1dd'),'as':_0xcfc5('0x1d9')});db[_0xcfc5('0xea')][_0xcfc5('0x11a')](db['User'],{'foreignKey':'FromUserId','as':_0xcfc5('0x1d2')});db[_0xcfc5('0xea')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'foreignKey':_0xcfc5('0x1d3'),'as':'ToAgent'});db[_0xcfc5('0xea')]['belongsTo'](db[_0xcfc5('0x4c')],{'foreignKey':_0xcfc5('0x1de'),'as':_0xcfc5('0x1d5')});db[_0xcfc5('0xea')][_0xcfc5('0x11a')](db[_0xcfc5('0x47')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0xcfc5('0xeb')][_0xcfc5('0x11a')](db[_0xcfc5('0x5d')],{});db[_0xcfc5('0xeb')]['belongsTo'](db[_0xcfc5('0x5b')],{});db[_0xcfc5('0xeb')][_0xcfc5('0x11a')](db[_0xcfc5('0x57')],{'foreignKey':_0xcfc5('0x1df'),'as':_0xcfc5('0x1d9')});db[_0xcfc5('0xeb')]['belongsTo'](db[_0xcfc5('0x12')],{'foreignKey':_0xcfc5('0x1d1'),'as':_0xcfc5('0x1d2')});db['OpenchannelTransferReport'][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'foreignKey':_0xcfc5('0x1d3'),'as':'ToAgent'});db[_0xcfc5('0xeb')][_0xcfc5('0x11a')](db[_0xcfc5('0x5e')],{'foreignKey':_0xcfc5('0x1e0'),'as':'ToQueue'});db[_0xcfc5('0xeb')][_0xcfc5('0x11a')](db['OpenchannelAccount'],{'foreignKey':_0xcfc5('0x1e1'),'as':_0xcfc5('0x1d7')});db['SmsTransferReport'][_0xcfc5('0x11a')](db['SmsMessage'],{});db['SmsTransferReport'][_0xcfc5('0x11a')](db[_0xcfc5('0x113')],{});db[_0xcfc5('0xed')][_0xcfc5('0x11a')](db[_0xcfc5('0x4f')],{'foreignKey':_0xcfc5('0x1e2'),'as':_0xcfc5('0x1d9')});db[_0xcfc5('0xed')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'foreignKey':_0xcfc5('0x1d1'),'as':'FromAgent'});db[_0xcfc5('0xed')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'foreignKey':_0xcfc5('0x1d3'),'as':_0xcfc5('0x1da')});db[_0xcfc5('0xed')][_0xcfc5('0x11a')](db[_0xcfc5('0x56')],{'foreignKey':_0xcfc5('0x1e3'),'as':_0xcfc5('0x1d5')});db[_0xcfc5('0xed')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xcfc5('0x1e4'),'as':_0xcfc5('0x1d7')});db[_0xcfc5('0xef')][_0xcfc5('0x109')](db['Disposition'],{'as':_0xcfc5('0x168'),'foreignKey':_0xcfc5('0x16a')});db[_0xcfc5('0xef')][_0xcfc5('0x109')](db[_0xcfc5('0x76')],{'as':'CustomFields','foreignKey':_0xcfc5('0x16a')});db[_0xcfc5('0xef')][_0xcfc5('0x109')](db[_0xcfc5('0x11e')],{'as':'Contacts','onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x16a')});db['CmList'][_0xcfc5('0x109')](db[_0xcfc5('0x10f')],{'as':_0xcfc5('0x14b'),'foreignKey':_0xcfc5('0x16a')});db['CmList'][_0xcfc5('0x109')](db[_0xcfc5('0x74')],{'as':'HopperHistory','foreignKey':_0xcfc5('0x16a')});db['CmList'][_0xcfc5('0x109')](db['ReportAgentPreview'],{'as':_0xcfc5('0x110'),'foreignKey':_0xcfc5('0x16a')});db[_0xcfc5('0xef')][_0xcfc5('0x11d')](db[_0xcfc5('0x148')],{'as':'Queues','through':_0xcfc5('0x155')});db[_0xcfc5('0xef')][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x156'),'through':_0xcfc5('0x130')});db[_0xcfc5('0xf1')][_0xcfc5('0x109')](db['VoiceExtension'],{'as':_0xcfc5('0x10e'),'onDelete':_0xcfc5('0x108')});db[_0xcfc5('0xf1')][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':'Agents','through':'user_has_voice_prefixes'});db[_0xcfc5('0xf2')][_0xcfc5('0x109')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x173'),'foreignKey':_0xcfc5('0x11b')});db[_0xcfc5('0xf2')][_0xcfc5('0x109')](db[_0xcfc5('0x1e5')],{'as':_0xcfc5('0x1e6'),'foreignKey':_0xcfc5('0x11b'),'onDelete':_0xcfc5('0x108')});db[_0xcfc5('0x1e5')][_0xcfc5('0x109')](db['UserProfileResource'],{'as':_0xcfc5('0x1e7'),'foreignKey':_0xcfc5('0x1e8'),'onDelete':'cascade'});db['WhatsappAccount'][_0xcfc5('0x109')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xcfc5('0x1e9')});db[_0xcfc5('0xfa')]['hasMany'](db[_0xcfc5('0x7b')],{'as':_0xcfc5('0x17b'),'foreignKey':_0xcfc5('0x1e9')});db[_0xcfc5('0xfa')][_0xcfc5('0x109')](db[_0xcfc5('0x1ea')],{'as':_0xcfc5('0x15c'),'foreignKey':_0xcfc5('0x1e9')});db[_0xcfc5('0xfa')]['hasMany'](db[_0xcfc5('0xfe')],{'as':_0xcfc5('0x169')});db['WhatsappAccount']['hasMany'](db[_0xcfc5('0xfc')],{'as':_0xcfc5('0x142')});db[_0xcfc5('0xfa')][_0xcfc5('0x11a')](db[_0xcfc5('0xef')],{'as':'List','foreignKey':_0xcfc5('0x16a')});db[_0xcfc5('0xfa')]['belongsTo'](db[_0xcfc5('0x152')],{'as':_0xcfc5('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x156'),'through':_0xcfc5('0x13d')});db[_0xcfc5('0xfc')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0xfc')][_0xcfc5('0x11a')](db[_0xcfc5('0x12e')],{'onDelete':_0xcfc5('0x177')});db[_0xcfc5('0xfc')][_0xcfc5('0x11a')](db[_0xcfc5('0xfa')],{'onDelete':_0xcfc5('0x177')});db['WhatsappApplication'][_0xcfc5('0x11a')](db[_0xcfc5('0x7f')],{'onDelete':'restrict','foreignKey':_0xcfc5('0x151')});db['WhatsappApplication']['belongsTo'](db[_0xcfc5('0x87')],{'onDelete':_0xcfc5('0x177'),'foreignKey':_0xcfc5('0x178')});db[_0xcfc5('0xfe')][_0xcfc5('0x109')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0xcfc5('0x108'),'foreignKey':_0xcfc5('0x1eb')});db[_0xcfc5('0xfe')]['belongsTo'](db[_0xcfc5('0xfa')],{'as':_0xcfc5('0x16e'),'foreignKey':_0xcfc5('0x1e9')});db[_0xcfc5('0xfe')]['belongsTo'](db[_0xcfc5('0x11e')],{'as':_0xcfc5('0x162'),'foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0xfe')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x16f'),'foreignKey':_0xcfc5('0x10b')});db[_0xcfc5('0xfe')][_0xcfc5('0x11d')](db['Tag'],{'through':_0xcfc5('0x1ec'),'as':_0xcfc5('0x171')});db['WhatsappInteraction']['belongsToMany'](db[_0xcfc5('0x87')],{'through':_0xcfc5('0x1ec'),'as':_0xcfc5('0x172')});db[_0xcfc5('0xfe')][_0xcfc5('0x11d')](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x173'),'through':_0xcfc5('0x128'),'foreignKey':'WhatsappInteractionId'});db[_0xcfc5('0x1ea')][_0xcfc5('0x11a')](db['User'],{'as':_0xcfc5('0x12')});db[_0xcfc5('0x1ea')]['belongsTo'](db[_0xcfc5('0x11e')],{'onDelete':'cascade','as':_0xcfc5('0x162')});db['WhatsappMessage'][_0xcfc5('0x11a')](db[_0xcfc5('0xfe')],{'onDelete':_0xcfc5('0x108'),'as':_0xcfc5('0x176'),'foreignKey':_0xcfc5('0x1eb')});db[_0xcfc5('0x1ea')][_0xcfc5('0x11a')](db['WhatsappAccount'],{'as':_0xcfc5('0x16e'),'foreignKey':'WhatsappAccountId'});db[_0xcfc5('0x100')][_0xcfc5('0x11a')](db['WhatsappAccount'],{});db[_0xcfc5('0x100')][_0xcfc5('0x11a')](db[_0xcfc5('0xef')],{'as':_0xcfc5('0x179'),'foreignKey':_0xcfc5('0x16a')});db[_0xcfc5('0x100')][_0xcfc5('0x11a')](db[_0xcfc5('0x11e')],{'as':_0xcfc5('0x162'),'foreignKey':_0xcfc5('0x163')});db[_0xcfc5('0x100')][_0xcfc5('0x11a')](db[_0xcfc5('0xfe')],{});db[_0xcfc5('0x100')][_0xcfc5('0x11a')](db[_0xcfc5('0x12e')],{});db[_0xcfc5('0x100')][_0xcfc5('0x11a')](db[_0xcfc5('0x1ea')],{});db[_0xcfc5('0x100')][_0xcfc5('0x11a')](db['User'],{});db[_0xcfc5('0x102')][_0xcfc5('0x11a')](db[_0xcfc5('0x1ea')],{});db['WhatsappTransferReport'][_0xcfc5('0x11a')](db[_0xcfc5('0xfe')],{});db[_0xcfc5('0x102')][_0xcfc5('0x11a')](db[_0xcfc5('0xfa')],{'foreignKey':_0xcfc5('0x1ed'),'as':'FromAccount'});db[_0xcfc5('0x102')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xcfc5('0x1ee'),'as':_0xcfc5('0x1d7')});db[_0xcfc5('0x102')]['belongsTo'](db[_0xcfc5('0x12e')],{'foreignKey':'ToQueueId','as':_0xcfc5('0x1d5')});db[_0xcfc5('0x102')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'foreignKey':_0xcfc5('0x1d1'),'as':'FromAgent'});db[_0xcfc5('0x102')][_0xcfc5('0x11a')](db[_0xcfc5('0x12')],{'foreignKey':_0xcfc5('0x1d3'),'as':_0xcfc5('0x1da')});db['WhatsappQueue']['belongsToMany'](db[_0xcfc5('0x12')],{'as':_0xcfc5('0x156'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0xcfc5('0x12e')][_0xcfc5('0x11d')](db[_0xcfc5('0xde')],{'through':_0xcfc5('0x1cc'),'as':'Teams'});module[_0xcfc5('0x1ef')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x10a9=['ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','../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','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SquareReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','UserId','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','VoiceExtension','Extensions','cascade','CmHopperFinal','ReportAgentPreview','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','SenderId','UserNotifications','userProfileId','Groups','chat_group_has_users','belongsToMany','CmContact','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','MailQueues','ChatQueues','FaxQueue','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueue','WhatsappQueues','cm_user_has_lists','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccount','WhatsappAccounts','SquareProjects','SpiedAgents','Applications','VoiceMusicOnHold','Sound','moh_has_sounds','CmHopper','Hoppers','VoiceQueueId','HopperFinals','HopperBlacks','JscriptySessions','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','uniqueid','VoiceAgentReport','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','List','TemplateId','mandatoryDispositionPauseId','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','Attachment','restrict','FaxAccountId','FaxApplication','Exntensions','ListId','Pause','TagId','FaxInteractionId','fax_interaction_has_tags','Interaction','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','sms_interaction_has_tags','ThroughTags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatMessage','Agent','ChatQueueId','ChatInteractionId','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','Members','Website','Contacts','CompanyId','HopperHistories','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','Mohs','chat_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Action','Fields','DefaultReportId','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmField','Field','DeskField','ZohoConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','FromId','ToId','SessionId','SmsQueueReport','ProjectId','user_has_square_projects','TrunkId','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','FromChatWebsiteId','FromAccount','ToChatQueueId','ToChatWebsiteId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','HopperHistory','Queues','UserProfileSections','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8','utf8_general_ci','sequelizeHistory','utf8mb4','name','database','password','options','User','../api/user/user.model','VoiceChanSpy','import','VoiceContext','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.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','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model'];(function(_0xbfd192,_0x3ba06a){var _0x102a48=function(_0x40008f){while(--_0x40008f){_0xbfd192['push'](_0xbfd192['shift']());}};_0x102a48(++_0x3ba06a);}(_0x10a9,0x18b));var _0x910a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x10a9[_0x3947c9];return _0x2e7871;};'use strict';var path=require(_0x910a('0x0'));var config=require(_0x910a('0x1'));var Sequelize=require(_0x910a('0x2'));var _=require(_0x910a('0x3'));var jstz=require(_0x910a('0x4'));var timezone=jstz[_0x910a('0x5')]();config[_0x910a('0x2')]=_[_0x910a('0x6')](config[_0x910a('0x2')],{'database':_0x910a('0x7'),'username':_0x910a('0x8'),'password':_0x910a('0x9'),'options':{'host':_0x910a('0xa'),'port':0xcea,'dialect':_0x910a('0xb'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x910a('0xc'),'collate':_0x910a('0xd')}}});config[_0x910a('0xe')]=_[_0x910a('0x6')](config['sequelizeHistory'],{'database':_0x910a('0x7'),'username':_0x910a('0x8'),'password':_0x910a('0x9'),'options':{'host':_0x910a('0xa'),'port':0xcea,'dialect':_0x910a('0xb'),'dialectOptions':{'charset':_0x910a('0xf')},'logging':![],'timezone':timezone[_0x910a('0x10')](),'define':{'charset':_0x910a('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x910a('0x2')][_0x910a('0x11')],config[_0x910a('0x2')]['username'],config['sequelize'][_0x910a('0x12')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x910a('0xe')][_0x910a('0x11')],config[_0x910a('0xe')]['username'],config[_0x910a('0xe')]['password'],config[_0x910a('0xe')][_0x910a('0x13')])};db[_0x910a('0x14')]=db['sequelize']['import'](_0x910a('0x15'));db[_0x910a('0x16')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x910a('0x18')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db['sequelize'][_0x910a('0x17')](_0x910a('0x19'));db['VoiceMusicOnHold']=db[_0x910a('0x2')]['import'](_0x910a('0x1a'));db['VoiceQueue']=db['sequelize'][_0x910a('0x17')]('../api/voiceQueue/voiceQueue.model');db[_0x910a('0x1b')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x1c'));db[_0x910a('0x1d')]=db[_0x910a('0x2')]['import'](_0x910a('0x1e'));db[_0x910a('0x1f')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/voiceMail/voiceMail.model');db[_0x910a('0x20')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x21'));db[_0x910a('0x22')]=db['sequelize'][_0x910a('0x17')](_0x910a('0x23'));db[_0x910a('0x24')]=db['sequelize'][_0x910a('0x17')](_0x910a('0x25'));db['VoiceAgentReport']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x26'));db['VoiceQueueReport']=db[_0x910a('0x2')]['import'](_0x910a('0x27'));db['MemberReport']=db[_0x910a('0x2')]['import']('../api/memberReport/memberReport.model');db[_0x910a('0x28')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x29'));db[_0x910a('0x2a')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x2b'));db['UserVoiceQueueRt']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x2c'));db[_0x910a('0x2d')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x2e'));db[_0x910a('0x2f')]=db['sequelize'][_0x910a('0x17')](_0x910a('0x30'));db[_0x910a('0x31')]=db[_0x910a('0x2')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x910a('0x32')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/userFaxQueue/userFaxQueue.model');db[_0x910a('0x33')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x34'));db['UserOpenchannelQueue']=db[_0x910a('0x2')][_0x910a('0x17')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x910a('0x35')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x36'));db[_0x910a('0x37')]=db[_0x910a('0x2')]['import']('../api/mailServerIn/mailServerIn.model');db[_0x910a('0x38')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x39'));db[_0x910a('0x3a')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/mailAccount/mailAccount.model');db[_0x910a('0x3b')]=db['sequelize']['import'](_0x910a('0x3c'));db[_0x910a('0x3d')]=db[_0x910a('0x2')]['import'](_0x910a('0x3e'));db[_0x910a('0x3f')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/mailInteraction/mailInteraction.model');db[_0x910a('0x40')]=db[_0x910a('0x2')]['import'](_0x910a('0x41'));db[_0x910a('0x42')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x43'));db[_0x910a('0x44')]=db['sequelize'][_0x910a('0x17')]('../api/mailQueueReport/mailQueueReport.model');db[_0x910a('0x45')]=db[_0x910a('0x2')]['import'](_0x910a('0x46'));db[_0x910a('0x47')]=db['sequelize'][_0x910a('0x17')](_0x910a('0x48'));db[_0x910a('0x49')]=db['sequelize']['import'](_0x910a('0x4a'));db['FaxApplication']=db[_0x910a('0x2')]['import'](_0x910a('0x4b'));db[_0x910a('0x4c')]=db[_0x910a('0x2')]['import'](_0x910a('0x4d'));db[_0x910a('0x4e')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x4f'));db['FaxQueue']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x50'));db[_0x910a('0x51')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x52'));db[_0x910a('0x53')]=db[_0x910a('0x2')]['import']('../api/smsAccount/smsAccount.model');db[_0x910a('0x54')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x55'));db[_0x910a('0x56')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/smsInteraction/smsInteraction.model');db[_0x910a('0x57')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/smsMessage/smsMessage.model');db[_0x910a('0x58')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x59'));db[_0x910a('0x5a')]=db[_0x910a('0x2')]['import'](_0x910a('0x5b'));db['OpenchannelApplication']=db['sequelize'][_0x910a('0x17')](_0x910a('0x5c'));db[_0x910a('0x5d')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x5e'));db[_0x910a('0x5f')]=db[_0x910a('0x2')]['import'](_0x910a('0x60'));db[_0x910a('0x61')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x62'));db[_0x910a('0x63')]=db['sequelize'][_0x910a('0x17')](_0x910a('0x64'));db[_0x910a('0x65')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x66'));db[_0x910a('0x67')]=db[_0x910a('0x2')]['import'](_0x910a('0x68'));db[_0x910a('0x69')]=db[_0x910a('0x2')]['import']('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0x910a('0x2')]['import'](_0x910a('0x6a'));db['ChatOfflineMessage']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x6b'));db[_0x910a('0x6c')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/chatQueue/chatQueue.model');db[_0x910a('0x6d')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x6e'));db[_0x910a('0x6f')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x70'));db[_0x910a('0x71')]=db[_0x910a('0x2')]['import'](_0x910a('0x72'));db['CmContact']=db[_0x910a('0x2')]['import'](_0x910a('0x73'));db['CmHopper']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x74'));db[_0x910a('0x75')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x76'));db['CmHopperFinal']=db[_0x910a('0x2')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x910a('0x77')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x78'));db['ReportAgentPreview']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x79'));db[_0x910a('0x7a')]=db['sequelize'][_0x910a('0x17')]('../api/cmCustomField/cmCustomField.model');db['Action']=db['sequelize']['import'](_0x910a('0x7b'));db[_0x910a('0x7c')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x7d'));db[_0x910a('0x7e')]=db[_0x910a('0x2')]['import'](_0x910a('0x7f'));db[_0x910a('0x80')]=db['sequelize'][_0x910a('0x17')](_0x910a('0x81'));db[_0x910a('0x82')]=db['sequelize'][_0x910a('0x17')]('../api/condition/condition.model');db[_0x910a('0x83')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x84'));db['Pause']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x85'));db['Cdr']=db['sequelize'][_0x910a('0x17')](_0x910a('0x86'));db[_0x910a('0x87')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x88'));db[_0x910a('0x89')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x8a'));db['Sound']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x8b'));db[_0x910a('0x8c')]=db[_0x910a('0x2')]['import'](_0x910a('0x8d'));db[_0x910a('0x8e')]=db[_0x910a('0x2')]['import'](_0x910a('0x8f'));db[_0x910a('0x90')]=db[_0x910a('0x2')]['import'](_0x910a('0x91'));db[_0x910a('0x92')]=db['sequelize'][_0x910a('0x17')](_0x910a('0x93'));db[_0x910a('0x94')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x95'));db[_0x910a('0x96')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x97'));db[_0x910a('0x98')]=db[_0x910a('0x2')]['import'](_0x910a('0x99'));db[_0x910a('0x9a')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x9b'));db[_0x910a('0x9c')]=db['sequelize']['import'](_0x910a('0x9d'));db[_0x910a('0x9e')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/analyticMetric/analyticMetric.model');db[_0x910a('0x9f')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xa0'));db[_0x910a('0xa1')]=db['sequelize'][_0x910a('0x17')](_0x910a('0xa2'));db[_0x910a('0xa3')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xa4'));db['SalesforceConfiguration']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xa5'));db[_0x910a('0xa6')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/intSalesforceField/intSalesforceField.model');db[_0x910a('0xa7')]=db['sequelize'][_0x910a('0x17')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x910a('0xa8')]=db[_0x910a('0x2')]['import'](_0x910a('0xa9'));db['SugarcrmField']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xaa'));db[_0x910a('0xab')]=db[_0x910a('0x2')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x910a('0xac')]=db['sequelize'][_0x910a('0x17')](_0x910a('0xad'));db['DeskField']=db['sequelize'][_0x910a('0x17')](_0x910a('0xae'));db[_0x910a('0xaf')]=db[_0x910a('0x2')]['import'](_0x910a('0xb0'));db['ZohoConfiguration']=db[_0x910a('0x2')][_0x910a('0x17')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x910a('0xb1')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xb2'));db[_0x910a('0xb3')]=db['sequelize']['import'](_0x910a('0xb4'));db[_0x910a('0xb5')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xb6'));db['FreshdeskAccount']=db[_0x910a('0x2')]['import'](_0x910a('0xb7'));db[_0x910a('0xb8')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xb9'));db[_0x910a('0xba')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xbb'));db['VtigerAccount']=db['sequelize']['import'](_0x910a('0xbc'));db['VtigerConfiguration']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xbd'));db[_0x910a('0xbe')]=db[_0x910a('0x2')]['import'](_0x910a('0xbf'));db[_0x910a('0xc0')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xc1'));db[_0x910a('0xc2')]=db[_0x910a('0x2')]['import'](_0x910a('0xc3'));db[_0x910a('0xc4')]=db[_0x910a('0x2')]['import'](_0x910a('0xc5'));db[_0x910a('0xc6')]=db[_0x910a('0x2')]['import'](_0x910a('0xc7'));db[_0x910a('0xc8')]=db[_0x910a('0x2')]['import'](_0x910a('0xc9'));db[_0x910a('0xca')]=db['sequelize'][_0x910a('0x17')](_0x910a('0xcb'));db[_0x910a('0xcc')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xcd'));db[_0x910a('0xce')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xcf'));db[_0x910a('0xd0')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xd1'));db['Integration']=db[_0x910a('0x2')]['import'](_0x910a('0x95'));db[_0x910a('0xd2')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xd3'));db[_0x910a('0xd4')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xd5'));db[_0x910a('0xd6')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x910a('0xd7')]=db['sequelize'][_0x910a('0x17')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x910a('0xd8')]=db[_0x910a('0x2')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x910a('0xd9')]=db[_0x910a('0x2')]['import'](_0x910a('0xda'));db['SmsQueueReport']=db[_0x910a('0x2')][_0x910a('0x17')]('../api/smsQueueReport/smsQueueReport.model');db[_0x910a('0xdb')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0x910a('0x2')][_0x910a('0x17')]('../api/squareReportDetail/squareReportDetail.model');db[_0x910a('0xdc')]=db['sequelize'][_0x910a('0x17')](_0x910a('0xdd'));db['Setting']=db['sequelize']['import'](_0x910a('0xde'));db[_0x910a('0xdf')]=db[_0x910a('0x2')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x910a('0xe0')]=db['sequelize'][_0x910a('0x17')](_0x910a('0xe1'));db[_0x910a('0xe2')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xe3'));db['SquareMessage']=db['sequelize'][_0x910a('0x17')]('../api/squareMessage/squareMessage.model');db[_0x910a('0xe4')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xe5'));db[_0x910a('0xe6')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/license/license.model');db[_0x910a('0xe7')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xe8'));db[_0x910a('0xe9')]=db['sequelize'][_0x910a('0x17')](_0x910a('0xea'));db['Attachment']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xeb'));db[_0x910a('0xec')]=db[_0x910a('0x2')]['import']('../api/plugin/plugin.model');db[_0x910a('0xed')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xee'));db[_0x910a('0xef')]=db[_0x910a('0x2')]['import'](_0x910a('0xf0'));db[_0x910a('0xf1')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xf2'));db['OpenchannelTransferReport']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xf3'));db[_0x910a('0xf4')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xf5'));db[_0x910a('0xf6')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xf7'));db['VoicePrefix']=db[_0x910a('0x2')][_0x910a('0x17')]('../api/voicePrefix/voicePrefix.model');db[_0x910a('0xf8')]=db[_0x910a('0x2')]['import'](_0x910a('0xf9'));db['UserProfileSection']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xfa'));db[_0x910a('0xfb')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xfc'));db[_0x910a('0xfd')]=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0xfe'));db['UserNotification']=db[_0x910a('0x2')][_0x910a('0x17')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x910a('0x2')]['import'](_0x910a('0xff'));db['WhatsappApplication']=db['sequelize'][_0x910a('0x17')]('../api/whatsappApplication/whatsappApplication.model');db[_0x910a('0x100')]=db[_0x910a('0x2')][_0x910a('0x17')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x910a('0x101')]=db[_0x910a('0x2')]['import'](_0x910a('0x102'));db[_0x910a('0x103')]=db['sequelize'][_0x910a('0x17')](_0x910a('0x104'));db[_0x910a('0x105')]=db[_0x910a('0x2')]['import'](_0x910a('0x106'));db['WhatsappQueue']=db[_0x910a('0x2')][_0x910a('0x17')](_0x910a('0x107'));db[_0x910a('0x108')]=db[_0x910a('0x2')]['import'](_0x910a('0x109'));db[_0x910a('0x14')][_0x910a('0x10a')](db['VoiceMail'],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x910a('0x10b')});db['User'][_0x910a('0x10c')](db[_0x910a('0x1b')],{'as':_0x910a('0x10d'),'foreignKey':_0x910a('0x10b')});db[_0x910a('0x14')]['hasMany'](db[_0x910a('0x10e')],{'as':_0x910a('0x10f'),'foreignKey':_0x910a('0x10b')});db[_0x910a('0x14')][_0x910a('0x10c')](db[_0x910a('0x110')],{'as':_0x910a('0x111'),'onDelete':_0x910a('0x112'),'hooks':!![]});db[_0x910a('0x14')]['hasMany'](db[_0x910a('0x113')],{'as':'HopperFinals','foreignKey':_0x910a('0x10b')});db[_0x910a('0x14')][_0x910a('0x10c')](db[_0x910a('0x77')],{'as':'HopperHistory','foreignKey':'UserId'});db['User'][_0x910a('0x10c')](db[_0x910a('0x114')],{'as':_0x910a('0x114'),'foreignKey':_0x910a('0x10b')});db['User'][_0x910a('0x10c')](db[_0x910a('0x5d')],{'as':'OpenchannelInteractions','foreignKey':_0x910a('0x10b')});db['User']['hasMany'](db[_0x910a('0x69')],{'as':_0x910a('0x115'),'foreignKey':_0x910a('0x10b')});db[_0x910a('0x14')][_0x910a('0x10c')](db[_0x910a('0x56')],{'as':_0x910a('0x116'),'foreignKey':_0x910a('0x10b')});db[_0x910a('0x14')]['hasMany'](db[_0x910a('0x4c')],{'as':_0x910a('0x117'),'foreignKey':'UserId'});db[_0x910a('0x14')][_0x910a('0x10c')](db[_0x910a('0x3f')],{'as':'MailInteractions','foreignKey':_0x910a('0x10b')});db[_0x910a('0x14')][_0x910a('0x10c')](db['WhatsappInteraction'],{'as':_0x910a('0x118'),'foreignKey':'UserId'});db[_0x910a('0x14')]['hasMany'](db[_0x910a('0xfd')],{'as':'Notifications','foreignKey':_0x910a('0x119')});db['User'][_0x910a('0x10c')](db['UserNotification'],{'as':_0x910a('0x11a'),'foreignKey':'SenderId'});db['User']['belongsTo'](db[_0x910a('0xf8')],{'as':_0x910a('0xf8'),'foreignKey':_0x910a('0x11b')});db[_0x910a('0x14')]['belongsToMany'](db[_0x910a('0x6d')],{'as':_0x910a('0x11c'),'through':_0x910a('0x11d')});db[_0x910a('0x14')][_0x910a('0x11e')](db[_0x910a('0x11f')],{'as':'Contacts','through':_0x910a('0x120')});db['User']['belongsToMany'](db[_0x910a('0xf6')],{'as':_0x910a('0x121'),'through':'cm_user_has_lists'});db['User'][_0x910a('0x11e')](db[_0x910a('0xe4')],{'through':_0x910a('0x122')});db['User'][_0x910a('0x11e')](db[_0x910a('0x3f')],{'as':'MailInteractions','through':_0x910a('0x123')});db[_0x910a('0x14')]['belongsToMany'](db[_0x910a('0x69')],{'as':'ChatInteractions','through':_0x910a('0x124')});db[_0x910a('0x14')][_0x910a('0x11e')](db['FaxInteraction'],{'as':_0x910a('0x117'),'through':'user_has_fax_interactions'});db['User'][_0x910a('0x11e')](db[_0x910a('0x56')],{'as':_0x910a('0x116'),'through':_0x910a('0x125')});db[_0x910a('0x14')][_0x910a('0x11e')](db['OpenchannelInteraction'],{'as':_0x910a('0x126'),'through':_0x910a('0x127')});db[_0x910a('0x14')][_0x910a('0x11e')](db[_0x910a('0x100')],{'as':_0x910a('0x118'),'through':_0x910a('0x128')});db['User']['belongsToMany'](db[_0x910a('0x129')],{'as':_0x910a('0x12a'),'through':'UserVoiceQueue','required':![]});db[_0x910a('0x14')][_0x910a('0x11e')](db[_0x910a('0x3b')],{'as':_0x910a('0x12b'),'through':_0x910a('0x31'),'required':![]});db[_0x910a('0x14')][_0x910a('0x11e')](db[_0x910a('0x6c')],{'as':_0x910a('0x12c'),'through':_0x910a('0x2f'),'required':![],'hooks':!![]});db[_0x910a('0x14')][_0x910a('0x11e')](db[_0x910a('0x12d')],{'as':'FaxQueues','through':_0x910a('0x32'),'required':![]});db['User'][_0x910a('0x11e')](db['SmsQueue'],{'as':_0x910a('0x12e'),'through':'UserSmsQueue','required':![]});db[_0x910a('0x14')]['belongsToMany'](db[_0x910a('0x61')],{'as':_0x910a('0x12f'),'through':_0x910a('0x130'),'required':![]});db[_0x910a('0x14')]['belongsToMany'](db[_0x910a('0x131')],{'as':_0x910a('0x132'),'through':_0x910a('0x35'),'required':![]});db[_0x910a('0x14')][_0x910a('0x11e')](db[_0x910a('0xf6')],{'through':_0x910a('0x133')});db[_0x910a('0x14')][_0x910a('0x11e')](db[_0x910a('0x134')],{'as':_0x910a('0x135'),'through':_0x910a('0x136'),'required':![]});db[_0x910a('0x14')][_0x910a('0x11e')](db[_0x910a('0x63')],{'as':_0x910a('0x137'),'through':_0x910a('0x138')});db[_0x910a('0x14')][_0x910a('0x11e')](db[_0x910a('0x49')],{'as':_0x910a('0x139'),'through':_0x910a('0x13a')});db['User']['belongsToMany'](db[_0x910a('0x3a')],{'as':'MailAccounts','through':_0x910a('0x13b')});db[_0x910a('0x14')][_0x910a('0x11e')](db[_0x910a('0x5a')],{'as':_0x910a('0x13c'),'through':_0x910a('0x13d')});db[_0x910a('0x14')]['belongsToMany'](db[_0x910a('0x53')],{'as':_0x910a('0x13e'),'through':'user_has_sms_accounts'});db['User'][_0x910a('0x11e')](db[_0x910a('0x13f')],{'as':_0x910a('0x140'),'through':'user_has_whatsapp_accounts'});db['User'][_0x910a('0x11e')](db[_0x910a('0xe0')],{'as':_0x910a('0x141'),'through':'user_has_square_projects'});db[_0x910a('0x16')]['hasMany'](db[_0x910a('0x110')],{'as':_0x910a('0x142'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x910a('0x18')][_0x910a('0x10c')](db[_0x910a('0x110')],{'onDelete':_0x910a('0x112')});db[_0x910a('0x110')][_0x910a('0x10c')](db[_0x910a('0x110')],{'as':_0x910a('0x143'),'onDelete':_0x910a('0x112')});db[_0x910a('0x144')][_0x910a('0x11e')](db[_0x910a('0x145')],{'as':'Sounds','through':_0x910a('0x146')});db[_0x910a('0x129')][_0x910a('0x10c')](db[_0x910a('0x10e')],{'as':'Members','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x910a('0x10c')](db[_0x910a('0x147')],{'as':_0x910a('0x148'),'foreignKey':_0x910a('0x149')});db[_0x910a('0x129')]['hasMany'](db[_0x910a('0x113')],{'as':_0x910a('0x14a'),'foreignKey':_0x910a('0x149')});db[_0x910a('0x129')]['hasMany'](db[_0x910a('0x77')],{'as':'HopperHistories','foreignKey':_0x910a('0x149')});db[_0x910a('0x129')][_0x910a('0x10c')](db[_0x910a('0x114')],{'as':_0x910a('0x114'),'foreignKey':_0x910a('0x149')});db[_0x910a('0x129')][_0x910a('0x10c')](db[_0x910a('0x75')],{'as':_0x910a('0x14b'),'foreignKey':_0x910a('0x149')});db[_0x910a('0x129')][_0x910a('0x10c')](db[_0x910a('0xd9')],{'as':_0x910a('0x14c'),'foreignKey':_0x910a('0x149')});db['VoiceQueue'][_0x910a('0x14d')](db[_0x910a('0x28')],{'as':_0x910a('0x28'),'foreignKey':'TrunkId'});db[_0x910a('0x129')][_0x910a('0x14d')](db['Trunk'],{'as':_0x910a('0x14e'),'foreignKey':_0x910a('0x14f')});db[_0x910a('0x129')][_0x910a('0x14d')](db['Interval'],{'as':_0x910a('0x83'),'foreignKey':_0x910a('0x150')});db[_0x910a('0x129')][_0x910a('0x14d')](db['Pause'],{'as':_0x910a('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x910a('0x129')][_0x910a('0x11e')](db[_0x910a('0xf6')],{'as':_0x910a('0x121'),'through':_0x910a('0x152')});db[_0x910a('0x129')][_0x910a('0x11e')](db['User'],{'as':_0x910a('0x153'),'through':'UserVoiceQueue'});db['VoiceQueue'][_0x910a('0x11e')](db['Team'],{'as':_0x910a('0x154'),'through':_0x910a('0x155')});db[_0x910a('0x129')][_0x910a('0x11e')](db[_0x910a('0xf6')],{'as':'BlackLists','through':_0x910a('0x156')});db[_0x910a('0x1b')]['belongsTo'](db[_0x910a('0x14')],{'as':_0x910a('0x14'),'foreignKey':_0x910a('0x10b')});db[_0x910a('0x1d')][_0x910a('0x14d')](db[_0x910a('0x14')],{'as':_0x910a('0x14'),'foreignKey':'UserId'});db[_0x910a('0x1f')][_0x910a('0x10c')](db[_0x910a('0x20')],{'as':_0x910a('0x157'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x158'),'sourceKey':_0x910a('0x159')});db[_0x910a('0x20')][_0x910a('0x14d')](db[_0x910a('0x1f')],{'foreignKey':_0x910a('0x158'),'targetKey':'mailbox'});db[_0x910a('0x22')][_0x910a('0x10c')](db[_0x910a('0x15a')],{'as':'QueueCalls','foreignKey':_0x910a('0x15b'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0x910a('0x15c')],{'as':'AgentReports','foreignKey':_0x910a('0x15b'),'constraints':![]});db[_0x910a('0x22')][_0x910a('0x14d')](db[_0x910a('0x14')],{'as':_0x910a('0x14'),'foreignKey':_0x910a('0x10b')});db[_0x910a('0x22')][_0x910a('0x14d')](db[_0x910a('0x11f')],{'as':_0x910a('0x15d'),'foreignKey':_0x910a('0x15e')});db[_0x910a('0x37')][_0x910a('0x14d')](db[_0x910a('0x3a')],{'as':_0x910a('0x3a'),'foreignKey':'MailAccountId'});db[_0x910a('0x38')][_0x910a('0x14d')](db[_0x910a('0x3a')],{'as':_0x910a('0x3a'),'foreignKey':_0x910a('0x15f')});db[_0x910a('0x3a')][_0x910a('0x10a')](db['MailServerIn'],{'as':_0x910a('0x160'),'onDelete':_0x910a('0x112')});db[_0x910a('0x3a')][_0x910a('0x10a')](db[_0x910a('0x38')],{'as':_0x910a('0x161'),'onDelete':_0x910a('0x112')});db[_0x910a('0x3a')][_0x910a('0x10c')](db[_0x910a('0x80')],{'as':_0x910a('0x162'),'foreignKey':_0x910a('0x15f')});db[_0x910a('0x3a')][_0x910a('0x10c')](db[_0x910a('0x7e')],{'as':_0x910a('0x163'),'foreignKey':_0x910a('0x15f')});db[_0x910a('0x3a')][_0x910a('0x10c')](db[_0x910a('0x40')],{'as':_0x910a('0x157'),'foreignKey':_0x910a('0x15f')});db[_0x910a('0x3a')][_0x910a('0x10c')](db['MailInteraction'],{'as':_0x910a('0x164')});db[_0x910a('0x3a')][_0x910a('0x10c')](db['MailApplication'],{'as':_0x910a('0x143')});db['MailAccount'][_0x910a('0x14d')](db['CmList'],{'as':_0x910a('0x165'),'foreignKey':'ListId'});db[_0x910a('0x3a')]['belongsTo'](db['Template'],{'as':_0x910a('0x8e'),'foreignKey':_0x910a('0x166')});db['MailAccount'][_0x910a('0x14d')](db['Pause'],{'as':_0x910a('0x151'),'foreignKey':_0x910a('0x167')});db[_0x910a('0x3a')][_0x910a('0x11e')](db['User'],{'as':'Agents','through':_0x910a('0x13b')});db[_0x910a('0x3b')][_0x910a('0x11e')](db[_0x910a('0x14')],{'as':_0x910a('0x153'),'through':_0x910a('0x31')});db[_0x910a('0x3b')]['belongsToMany'](db[_0x910a('0xe4')],{'through':'team_has_mail_queues','as':_0x910a('0x154')});db[_0x910a('0x3f')][_0x910a('0x10c')](db[_0x910a('0x40')],{'as':_0x910a('0x157'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x168')});db['MailInteraction'][_0x910a('0x14d')](db[_0x910a('0x3a')],{'as':_0x910a('0x169'),'foreignKey':'MailAccountId'});db[_0x910a('0x3f')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x910a('0x15e')});db[_0x910a('0x3f')][_0x910a('0x14d')](db[_0x910a('0x14')],{'as':_0x910a('0x16a'),'foreignKey':'UserId'});db['MailInteraction']['belongsToMany'](db[_0x910a('0x8c')],{'through':_0x910a('0x16b'),'as':_0x910a('0x16c')});db[_0x910a('0x3f')][_0x910a('0x11e')](db[_0x910a('0x8c')],{'through':_0x910a('0x16b'),'as':'ThroughTags'});db[_0x910a('0x3f')][_0x910a('0x11e')](db['User'],{'as':_0x910a('0x16d'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x910a('0x40')][_0x910a('0x10c')](db[_0x910a('0x16e')],{'as':'Attachments','onDelete':_0x910a('0x112')});db[_0x910a('0x40')]['belongsTo'](db[_0x910a('0x14')],{'as':_0x910a('0x14')});db[_0x910a('0x40')][_0x910a('0x14d')](db[_0x910a('0x11f')],{'onDelete':_0x910a('0x112'),'as':_0x910a('0x15d')});db[_0x910a('0x40')][_0x910a('0x14d')](db[_0x910a('0x3f')],{'as':'Interaction','foreignKey':_0x910a('0x168')});db['MailMessage'][_0x910a('0x14d')](db[_0x910a('0x3a')],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x15f')});db[_0x910a('0x42')]['belongsTo'](db['User'],{'onDelete':_0x910a('0x16f')});db['MailApplication'][_0x910a('0x14d')](db[_0x910a('0x3b')],{'onDelete':_0x910a('0x16f')});db[_0x910a('0x42')][_0x910a('0x14d')](db[_0x910a('0x3a')],{'onDelete':_0x910a('0x16f')});db['MailApplication'][_0x910a('0x14d')](db[_0x910a('0x83')],{'onDelete':_0x910a('0x16f'),'foreignKey':_0x910a('0x150')});db[_0x910a('0x42')][_0x910a('0x14d')](db[_0x910a('0x8c')],{'onDelete':_0x910a('0x16f'),'foreignKey':'TagId'});db[_0x910a('0x44')][_0x910a('0x14d')](db[_0x910a('0x3a')],{});db[_0x910a('0x44')][_0x910a('0x14d')](db[_0x910a('0xf6')],{'as':_0x910a('0x165'),'foreignKey':'ListId'});db['MailQueueReport'][_0x910a('0x14d')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x910a('0x44')][_0x910a('0x14d')](db[_0x910a('0x3f')],{});db[_0x910a('0x44')][_0x910a('0x14d')](db['MailMessage'],{});db[_0x910a('0x44')]['belongsTo'](db[_0x910a('0x14')],{});db[_0x910a('0x44')][_0x910a('0x14d')](db['MailQueue'],{});db[_0x910a('0x45')][_0x910a('0x10c')](db[_0x910a('0x47')],{'as':'Items','onDelete':_0x910a('0x112')});db[_0x910a('0x49')]['hasMany'](db[_0x910a('0x80')],{'as':_0x910a('0x162'),'foreignKey':_0x910a('0x170')});db[_0x910a('0x49')][_0x910a('0x10c')](db[_0x910a('0x7e')],{'as':'Answers','foreignKey':_0x910a('0x170')});db[_0x910a('0x49')][_0x910a('0x10c')](db[_0x910a('0x4c')],{'as':'Interactions'});db['FaxAccount'][_0x910a('0x10c')](db[_0x910a('0x171')],{'as':_0x910a('0x143')});db[_0x910a('0x49')][_0x910a('0x10c')](db[_0x910a('0x110')],{'as':_0x910a('0x172'),'onDelete':_0x910a('0x112')});db[_0x910a('0x49')][_0x910a('0x10c')](db[_0x910a('0x4e')],{'as':_0x910a('0x157')});db['FaxAccount'][_0x910a('0x14d')](db[_0x910a('0x28')],{'as':_0x910a('0x28')});db[_0x910a('0x49')][_0x910a('0x14d')](db[_0x910a('0xf6')],{'as':_0x910a('0x165'),'foreignKey':_0x910a('0x173')});db['FaxAccount'][_0x910a('0x14d')](db[_0x910a('0x174')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x910a('0x49')][_0x910a('0x11e')](db[_0x910a('0x14')],{'as':_0x910a('0x153'),'through':_0x910a('0x13a')});db[_0x910a('0x171')][_0x910a('0x14d')](db[_0x910a('0x14')],{'onDelete':_0x910a('0x16f')});db[_0x910a('0x171')][_0x910a('0x14d')](db[_0x910a('0x12d')],{'onDelete':_0x910a('0x16f')});db['FaxApplication'][_0x910a('0x14d')](db[_0x910a('0x49')],{'onDelete':_0x910a('0x16f')});db[_0x910a('0x171')]['belongsTo'](db[_0x910a('0x8c')],{'onDelete':_0x910a('0x16f'),'foreignKey':_0x910a('0x175')});db[_0x910a('0x4c')][_0x910a('0x10c')](db[_0x910a('0x4e')],{'as':_0x910a('0x157'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x176')});db[_0x910a('0x4c')][_0x910a('0x14d')](db[_0x910a('0x49')],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x170')});db[_0x910a('0x4c')][_0x910a('0x14d')](db['CmContact'],{'as':_0x910a('0x15d'),'foreignKey':_0x910a('0x15e')});db['FaxInteraction'][_0x910a('0x14d')](db['User'],{'as':_0x910a('0x16a'),'foreignKey':_0x910a('0x10b')});db[_0x910a('0x4c')][_0x910a('0x11e')](db[_0x910a('0x8c')],{'through':_0x910a('0x177'),'as':_0x910a('0x16c')});db[_0x910a('0x4c')][_0x910a('0x11e')](db['Tag'],{'through':_0x910a('0x177'),'as':'ThroughTags'});db[_0x910a('0x4c')][_0x910a('0x11e')](db[_0x910a('0x14')],{'as':_0x910a('0x16d'),'through':'user_has_fax_interactions','foreignKey':_0x910a('0x176')});db['FaxMessage']['belongsTo'](db['User'],{'onDelete':_0x910a('0x112'),'as':_0x910a('0x14')});db[_0x910a('0x4e')]['belongsTo'](db['FaxInteraction'],{'as':_0x910a('0x178'),'foreignKey':_0x910a('0x176')});db[_0x910a('0x4e')][_0x910a('0x14d')](db[_0x910a('0x11f')],{'onDelete':_0x910a('0x112'),'as':_0x910a('0x15d')});db['FaxMessage'][_0x910a('0x14d')](db[_0x910a('0x16e')],{'as':_0x910a('0x16e'),'foreignKey':'AttachmentId'});db[_0x910a('0x4e')][_0x910a('0x14d')](db[_0x910a('0x49')],{'as':_0x910a('0x169'),'foreignKey':'FaxAccountId'});db[_0x910a('0x12d')]['belongsToMany'](db[_0x910a('0x14')],{'as':_0x910a('0x153'),'through':_0x910a('0x32')});db[_0x910a('0x12d')][_0x910a('0x11e')](db[_0x910a('0xe4')],{'through':_0x910a('0x179'),'as':'Teams'});db[_0x910a('0x51')]['belongsTo'](db[_0x910a('0x49')],{});db[_0x910a('0x51')][_0x910a('0x14d')](db[_0x910a('0xf6')],{'as':_0x910a('0x165'),'foreignKey':_0x910a('0x173')});db['FaxQueueReport'][_0x910a('0x14d')](db[_0x910a('0x11f')],{'as':_0x910a('0x15d'),'foreignKey':_0x910a('0x15e')});db[_0x910a('0x51')][_0x910a('0x14d')](db[_0x910a('0x4c')],{});db[_0x910a('0x51')][_0x910a('0x14d')](db['FaxMessage'],{});db[_0x910a('0x51')][_0x910a('0x14d')](db[_0x910a('0x14')],{});db['FaxQueueReport'][_0x910a('0x14d')](db[_0x910a('0x12d')],{});db[_0x910a('0x53')][_0x910a('0x10c')](db['Disposition'],{'as':_0x910a('0x162'),'foreignKey':_0x910a('0x17a')});db[_0x910a('0x53')]['hasMany'](db[_0x910a('0x7e')],{'as':_0x910a('0x163'),'foreignKey':_0x910a('0x17a')});db[_0x910a('0x53')][_0x910a('0x10c')](db[_0x910a('0x57')],{'as':_0x910a('0x157'),'foreignKey':_0x910a('0x17a')});db['SmsAccount']['hasMany'](db[_0x910a('0x56')],{'as':_0x910a('0x164')});db['SmsAccount'][_0x910a('0x10c')](db['SmsApplication'],{'as':_0x910a('0x143')});db[_0x910a('0x53')][_0x910a('0x14d')](db[_0x910a('0xf6')],{'as':_0x910a('0x165'),'foreignKey':'ListId'});db['SmsAccount']['belongsTo'](db[_0x910a('0x174')],{'as':_0x910a('0x151'),'foreignKey':_0x910a('0x167')});db['SmsAccount']['belongsToMany'](db[_0x910a('0x14')],{'as':_0x910a('0x153'),'through':_0x910a('0x17b')});db[_0x910a('0x54')]['belongsTo'](db[_0x910a('0x14')],{'onDelete':_0x910a('0x16f')});db['SmsApplication'][_0x910a('0x14d')](db['SmsQueue'],{'onDelete':_0x910a('0x16f')});db['SmsApplication']['belongsTo'](db[_0x910a('0x53')],{'onDelete':_0x910a('0x16f')});db[_0x910a('0x54')][_0x910a('0x14d')](db[_0x910a('0x83')],{'onDelete':'restrict','foreignKey':_0x910a('0x150')});db[_0x910a('0x54')][_0x910a('0x14d')](db[_0x910a('0x8c')],{'onDelete':_0x910a('0x16f'),'foreignKey':_0x910a('0x175')});db[_0x910a('0x56')]['hasMany'](db[_0x910a('0x57')],{'as':_0x910a('0x157'),'onDelete':_0x910a('0x112'),'foreignKey':'SmsInteractionId'});db[_0x910a('0x56')][_0x910a('0x14d')](db[_0x910a('0x53')],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x17a')});db[_0x910a('0x56')]['belongsTo'](db[_0x910a('0x11f')],{'as':'Contact','foreignKey':'ContactId'});db['SmsInteraction'][_0x910a('0x14d')](db['User'],{'as':'Owner','foreignKey':_0x910a('0x10b')});db['SmsInteraction'][_0x910a('0x11e')](db['Tag'],{'through':_0x910a('0x17c'),'as':_0x910a('0x16c')});db['SmsInteraction'][_0x910a('0x11e')](db[_0x910a('0x8c')],{'through':_0x910a('0x17c'),'as':_0x910a('0x17d')});db[_0x910a('0x56')][_0x910a('0x11e')](db['User'],{'as':'Users','through':_0x910a('0x125'),'foreignKey':_0x910a('0x17e')});db[_0x910a('0x57')][_0x910a('0x14d')](db[_0x910a('0x14')],{'as':_0x910a('0x14')});db[_0x910a('0x57')][_0x910a('0x14d')](db[_0x910a('0x11f')],{'onDelete':'cascade','as':_0x910a('0x15d')});db['SmsMessage'][_0x910a('0x14d')](db[_0x910a('0x56')],{'onDelete':_0x910a('0x112'),'as':'Interaction','foreignKey':_0x910a('0x17e')});db[_0x910a('0x57')]['belongsTo'](db[_0x910a('0x53')],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x17a')});db[_0x910a('0x58')][_0x910a('0x11e')](db[_0x910a('0x14')],{'as':_0x910a('0x153'),'through':_0x910a('0x33'),'foreignKey':_0x910a('0x17f')});db[_0x910a('0x58')][_0x910a('0x11e')](db[_0x910a('0xe4')],{'through':_0x910a('0x180'),'as':_0x910a('0x154')});db[_0x910a('0x5a')][_0x910a('0x10c')](db[_0x910a('0x80')],{'as':_0x910a('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0x910a('0x5a')][_0x910a('0x10c')](db[_0x910a('0x7e')],{'as':_0x910a('0x163'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db['OpenchannelInteraction'],{'as':_0x910a('0x164'),'foreignKey':_0x910a('0x181')});db['OpenchannelAccount'][_0x910a('0x10c')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x910a('0x181')});db['OpenchannelAccount'][_0x910a('0x10c')](db[_0x910a('0x182')],{'as':_0x910a('0x143'),'foreignKey':_0x910a('0x181')});db[_0x910a('0x5a')]['belongsTo'](db[_0x910a('0xf6')],{'as':_0x910a('0x165'),'foreignKey':_0x910a('0x173')});db[_0x910a('0x5a')]['belongsTo'](db['Pause'],{'as':_0x910a('0x151'),'foreignKey':_0x910a('0x167')});db[_0x910a('0x5a')][_0x910a('0x11e')](db['User'],{'as':'Agents','through':_0x910a('0x13d')});db[_0x910a('0x182')][_0x910a('0x14d')](db['User'],{'onDelete':_0x910a('0x16f')});db[_0x910a('0x182')][_0x910a('0x14d')](db[_0x910a('0x61')],{'onDelete':'restrict','foreignKey':_0x910a('0x183')});db[_0x910a('0x182')][_0x910a('0x14d')](db[_0x910a('0x5a')],{'onDelete':_0x910a('0x16f'),'foreignKey':_0x910a('0x181')});db[_0x910a('0x182')][_0x910a('0x14d')](db['Interval'],{'onDelete':_0x910a('0x16f'),'foreignKey':_0x910a('0x150')});db[_0x910a('0x182')][_0x910a('0x14d')](db[_0x910a('0x8c')],{'onDelete':'restrict','foreignKey':_0x910a('0x175')});db[_0x910a('0x5d')][_0x910a('0x10c')](db[_0x910a('0x5f')],{'as':_0x910a('0x157'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x184')});db['OpenchannelInteraction'][_0x910a('0x14d')](db[_0x910a('0x5a')],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x181')});db[_0x910a('0x5d')]['belongsTo'](db[_0x910a('0x11f')],{'as':_0x910a('0x15d'),'foreignKey':_0x910a('0x15e')});db['OpenchannelInteraction'][_0x910a('0x14d')](db[_0x910a('0x14')],{'as':_0x910a('0x16a'),'foreignKey':'UserId'});db[_0x910a('0x5d')][_0x910a('0x11e')](db[_0x910a('0x8c')],{'through':_0x910a('0x185'),'as':_0x910a('0x16c')});db[_0x910a('0x5d')][_0x910a('0x11e')](db[_0x910a('0x8c')],{'through':_0x910a('0x185'),'as':_0x910a('0x17d')});db[_0x910a('0x5d')][_0x910a('0x11e')](db[_0x910a('0x14')],{'as':_0x910a('0x16d'),'through':_0x910a('0x127'),'foreignKey':_0x910a('0x184')});db['OpenchannelMessage'][_0x910a('0x14d')](db['User'],{'onDelete':_0x910a('0x112'),'as':_0x910a('0x14')});db[_0x910a('0x5f')][_0x910a('0x14d')](db['CmContact'],{'onDelete':_0x910a('0x112'),'as':_0x910a('0x15d')});db['OpenchannelMessage'][_0x910a('0x14d')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x910a('0x178'),'foreignKey':_0x910a('0x184')});db[_0x910a('0x5f')][_0x910a('0x14d')](db[_0x910a('0x16e')],{'as':_0x910a('0x16e'),'foreignKey':_0x910a('0x186')});db[_0x910a('0x5f')][_0x910a('0x14d')](db[_0x910a('0x5a')],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x181')});db[_0x910a('0x61')][_0x910a('0x11e')](db[_0x910a('0x14')],{'as':_0x910a('0x153'),'through':_0x910a('0x130'),'foreignKey':_0x910a('0x183')});db['OpenchannelQueue'][_0x910a('0x11e')](db[_0x910a('0xe4')],{'through':_0x910a('0x187'),'as':_0x910a('0x154')});db['ChatWebsite'][_0x910a('0x10c')](db[_0x910a('0x80')],{'as':_0x910a('0x162'),'foreignKey':_0x910a('0x188')});db[_0x910a('0x63')][_0x910a('0x10c')](db['CannedAnswer'],{'as':_0x910a('0x163'),'foreignKey':_0x910a('0x188')});db[_0x910a('0x63')]['hasMany'](db[_0x910a('0x6f')],{'as':_0x910a('0x189')});db[_0x910a('0x63')][_0x910a('0x10c')](db[_0x910a('0x69')],{'as':'Interactions'});db[_0x910a('0x63')][_0x910a('0x10c')](db[_0x910a('0x67')],{'as':_0x910a('0x143')});db[_0x910a('0x63')][_0x910a('0x10c')](db[_0x910a('0x18a')],{'as':_0x910a('0x157')});db[_0x910a('0x63')][_0x910a('0x14d')](db[_0x910a('0xf6')],{'as':_0x910a('0x165'),'foreignKey':_0x910a('0x173')});db[_0x910a('0x63')]['belongsTo'](db[_0x910a('0x83')],{'as':'Interval','foreignKey':_0x910a('0x150')});db[_0x910a('0x63')][_0x910a('0x14d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x910a('0x167')});db[_0x910a('0x63')][_0x910a('0x11e')](db[_0x910a('0x14')],{'as':'Agents','through':_0x910a('0x138')});db[_0x910a('0x65')][_0x910a('0x14d')](db[_0x910a('0x5a')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x910a('0xf6')],{'as':_0x910a('0x165'),'foreignKey':_0x910a('0x173')});db[_0x910a('0x65')][_0x910a('0x14d')](db[_0x910a('0x11f')],{'as':_0x910a('0x15d'),'foreignKey':_0x910a('0x15e')});db[_0x910a('0x65')][_0x910a('0x14d')](db[_0x910a('0x5d')],{});db[_0x910a('0x65')][_0x910a('0x14d')](db['OpenchannelMessage'],{});db[_0x910a('0x65')][_0x910a('0x14d')](db['User'],{});db[_0x910a('0x65')]['belongsTo'](db[_0x910a('0x61')],{});db[_0x910a('0x67')][_0x910a('0x14d')](db[_0x910a('0x14')],{'as':_0x910a('0x18b'),'foreignKey':_0x910a('0x10b'),'onDelete':_0x910a('0x16f')});db[_0x910a('0x67')][_0x910a('0x14d')](db[_0x910a('0x6c')],{'as':'Queue','foreignKey':_0x910a('0x18c'),'onDelete':_0x910a('0x16f')});db[_0x910a('0x67')]['belongsTo'](db[_0x910a('0x63')],{'as':'Website','foreignKey':_0x910a('0x188'),'onDelete':_0x910a('0x16f')});db['ChatApplication'][_0x910a('0x14d')](db[_0x910a('0x8c')],{'onDelete':_0x910a('0x16f'),'foreignKey':_0x910a('0x175')});db[_0x910a('0x69')][_0x910a('0x10c')](db['ChatMessage'],{'as':'Messages','onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x18d')});db[_0x910a('0x69')][_0x910a('0x14d')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x910a('0x188')});db[_0x910a('0x69')][_0x910a('0x14d')](db[_0x910a('0x11f')],{'as':_0x910a('0x15d'),'foreignKey':_0x910a('0x15e')});db[_0x910a('0x69')][_0x910a('0x14d')](db[_0x910a('0x14')],{'as':'Owner','foreignKey':_0x910a('0x10b')});db[_0x910a('0x69')][_0x910a('0x11e')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x910a('0x16c')});db[_0x910a('0x69')][_0x910a('0x11e')](db[_0x910a('0x8c')],{'through':'chat_interaction_has_tags','as':_0x910a('0x17d')});db[_0x910a('0x69')][_0x910a('0x11e')](db['User'],{'as':'Users','through':_0x910a('0x124'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x910a('0x14d')](db[_0x910a('0x14')],{'onDelete':'cascade','as':_0x910a('0x14')});db[_0x910a('0x18a')][_0x910a('0x14d')](db[_0x910a('0x11f')],{'onDelete':_0x910a('0x112'),'as':'Contact','foreignKey':'ContactId'});db[_0x910a('0x18a')][_0x910a('0x14d')](db['ChatInteraction'],{'onDelete':'cascade','as':_0x910a('0x178'),'foreignKey':'ChatInteractionId'});db['ChatMessage']['belongsTo'](db[_0x910a('0x16e')],{'as':_0x910a('0x16e'),'foreignKey':_0x910a('0x186')});db[_0x910a('0x18a')][_0x910a('0x14d')](db['ChatWebsite'],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x188')});db[_0x910a('0x18e')][_0x910a('0x14d')](db[_0x910a('0x11f')],{'onDelete':_0x910a('0x112'),'as':_0x910a('0x15d'),'foreignKey':_0x910a('0x15e')});db[_0x910a('0x18e')][_0x910a('0x14d')](db[_0x910a('0x63')],{'as':_0x910a('0x169'),'foreignKey':'ChatWebsiteId'});db['ChatQueue']['belongsToMany'](db[_0x910a('0x14')],{'as':'Agents','through':_0x910a('0x2f'),'hooks':!![]});db[_0x910a('0x6c')][_0x910a('0x11e')](db[_0x910a('0xe4')],{'through':_0x910a('0x18f'),'as':_0x910a('0x154')});db[_0x910a('0x6d')][_0x910a('0x10c')](db['ChatInternalMessage'],{'as':_0x910a('0x157'),'foreignKey':_0x910a('0x190'),'onDelete':_0x910a('0x112')});db[_0x910a('0x6d')][_0x910a('0x11e')](db[_0x910a('0x14')],{'as':_0x910a('0x191'),'through':_0x910a('0x11d')});db[_0x910a('0x6f')][_0x910a('0x14d')](db[_0x910a('0x63')],{'as':_0x910a('0x192'),'foreignKey':_0x910a('0x188')});db[_0x910a('0x71')]['hasMany'](db[_0x910a('0x11f')],{'as':_0x910a('0x193'),'foreignKey':_0x910a('0x194')});db[_0x910a('0x11f')][_0x910a('0x10c')](db[_0x910a('0x147')],{'as':_0x910a('0x148'),'foreignKey':'ContactId'});db[_0x910a('0x11f')][_0x910a('0x10c')](db[_0x910a('0x113')],{'as':_0x910a('0x14a'),'foreignKey':'ContactId'});db['CmContact'][_0x910a('0x10c')](db[_0x910a('0x77')],{'as':_0x910a('0x195'),'foreignKey':_0x910a('0x15e')});db[_0x910a('0x11f')][_0x910a('0x10c')](db['ReportAgentPreview'],{'as':_0x910a('0x114'),'foreignKey':'ContactId'});db[_0x910a('0x11f')][_0x910a('0x10c')](db[_0x910a('0xd9')],{'as':_0x910a('0x14c'),'foreignKey':_0x910a('0x15e')});db[_0x910a('0x11f')][_0x910a('0x10c')](db['OpenchannelInteraction'],{'as':_0x910a('0x126'),'foreignKey':_0x910a('0x15e'),'onDelete':'restrict'});db[_0x910a('0x11f')][_0x910a('0x10c')](db[_0x910a('0x69')],{'as':_0x910a('0x115'),'foreignKey':_0x910a('0x15e'),'onDelete':_0x910a('0x16f')});db[_0x910a('0x11f')][_0x910a('0x10c')](db[_0x910a('0x56')],{'as':'SmsInteractions','foreignKey':_0x910a('0x15e'),'onDelete':_0x910a('0x16f')});db[_0x910a('0x11f')][_0x910a('0x10c')](db['FaxInteraction'],{'as':_0x910a('0x117'),'foreignKey':_0x910a('0x15e'),'onDelete':_0x910a('0x16f')});db[_0x910a('0x11f')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x910a('0x16f')});db['CmContact'][_0x910a('0x14d')](db[_0x910a('0x71')],{'as':_0x910a('0x196'),'foreignKey':_0x910a('0x194')});db[_0x910a('0x11f')]['belongsTo'](db['CmList'],{'as':_0x910a('0x165'),'foreignKey':'ListId','onDelete':_0x910a('0x112')});db[_0x910a('0x11f')][_0x910a('0x11e')](db['User'],{'as':'Users','through':'cm_user_has_contacts'});db['CmContact']['belongsToMany'](db[_0x910a('0x8c')],{'as':_0x910a('0x16c'),'through':_0x910a('0x197')});db[_0x910a('0x11f')][_0x910a('0x11e')](db[_0x910a('0x8c')],{'through':_0x910a('0x197'),'as':'ThroughTags'});db['CmHopper'][_0x910a('0x14d')](db['CmContact'],{'as':_0x910a('0x15d'),'foreignKey':'ContactId','onDelete':_0x910a('0x112')});db[_0x910a('0x147')]['belongsTo'](db[_0x910a('0xf6')],{'as':_0x910a('0x165'),'foreignKey':_0x910a('0x173'),'onDelete':_0x910a('0x112')});db['CmHopper'][_0x910a('0x14d')](db[_0x910a('0x14')],{'as':_0x910a('0x18b'),'foreignKey':_0x910a('0x10b')});db[_0x910a('0x147')][_0x910a('0x14d')](db['VoiceQueue'],{'as':_0x910a('0x198'),'foreignKey':_0x910a('0x149'),'onDelete':_0x910a('0x112')});db[_0x910a('0x147')][_0x910a('0x14d')](db[_0x910a('0xe7')],{'as':_0x910a('0xe7'),'foreignKey':_0x910a('0x199'),'onDelete':_0x910a('0x112')});db['CmHopper'][_0x910a('0x14d')](db[_0x910a('0x14')],{'as':_0x910a('0x16a'),'foreignKey':_0x910a('0x19a')});db['CmHopperBlack'][_0x910a('0x14d')](db[_0x910a('0x11f')],{'as':'Contact','foreignKey':_0x910a('0x15e'),'onDelete':_0x910a('0x112')});db[_0x910a('0x75')][_0x910a('0x14d')](db[_0x910a('0xf6')],{'as':'List','foreignKey':_0x910a('0x173'),'onDelete':_0x910a('0x112')});db['CmHopperBlack'][_0x910a('0x14d')](db[_0x910a('0x129')],{'as':_0x910a('0x198'),'foreignKey':_0x910a('0x149'),'onDelete':_0x910a('0x112')});db['CmHopperBlack'][_0x910a('0x14d')](db[_0x910a('0xe7')],{'as':'Campaign','foreignKey':_0x910a('0x199'),'onDelete':'cascade'});db[_0x910a('0x7c')][_0x910a('0x10c')](db['Condition'],{'as':{'plural':_0x910a('0x19b'),'singular':'OneAll'},'foreignKey':_0x910a('0x19c'),'onDelete':_0x910a('0x112'),'hooks':!![]});db[_0x910a('0x7c')][_0x910a('0x10c')](db[_0x910a('0x82')],{'as':{'plural':_0x910a('0x19d'),'singular':_0x910a('0x19e')},'foreignKey':_0x910a('0x19f'),'onDelete':_0x910a('0x112'),'hooks':!![]});db[_0x910a('0x7c')][_0x910a('0x10c')](db['Action'],{'as':_0x910a('0x1a0'),'foreignKey':_0x910a('0x1a1'),'onDelete':_0x910a('0x112'),'hooks':!![]});db[_0x910a('0x80')][_0x910a('0x10c')](db[_0x910a('0x80')],{'as':_0x910a('0x162'),'foreignKey':_0x910a('0x1a2'),'onDelete':_0x910a('0x112')});db[_0x910a('0x83')]['hasMany'](db['Interval'],{'as':'Intervals','foreignKey':_0x910a('0x150'),'onDelete':_0x910a('0x112'),'hooks':!![],'required':![]});db[_0x910a('0x83')]['hasMany'](db[_0x910a('0x110')],{'as':_0x910a('0x111'),'foreignKey':'IntervalId','onDelete':_0x910a('0x16f')});db[_0x910a('0x83')]['hasMany'](db[_0x910a('0x42')],{'as':_0x910a('0x1a3'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0x910a('0x67')],{'as':_0x910a('0x1a4'),'foreignKey':_0x910a('0x150')});db[_0x910a('0x83')][_0x910a('0x10c')](db[_0x910a('0x171')],{'as':_0x910a('0x1a5'),'foreignKey':_0x910a('0x150')});db['Interval'][_0x910a('0x10c')](db[_0x910a('0x54')],{'as':'SmsApplications','foreignKey':'IntervalId'});db['Schedule']['belongsTo'](db[_0x910a('0x3a')],{});db[_0x910a('0x89')][_0x910a('0x14d')](db[_0x910a('0x9a')],{'foreignKey':'DefaultReportId'});db['Schedule']['belongsTo'](db[_0x910a('0x98')],{'foreignKey':'CustomReportId'});db[_0x910a('0x145')][_0x910a('0x11e')](db[_0x910a('0x144')],{'as':_0x910a('0x1a6'),'through':_0x910a('0x146'),'onDelete':_0x910a('0x16f')});db[_0x910a('0x8c')]['belongsToMany'](db[_0x910a('0x11f')],{'through':_0x910a('0x197')});db[_0x910a('0x8c')][_0x910a('0x11e')](db[_0x910a('0x69')],{'through':_0x910a('0x1a7')});db[_0x910a('0x8c')][_0x910a('0x11e')](db[_0x910a('0x3f')],{'through':'mail_interaction_has_tags'});db['Tag'][_0x910a('0x11e')](db[_0x910a('0x56')],{'through':_0x910a('0x17c')});db['Tag'][_0x910a('0x11e')](db[_0x910a('0x4c')],{'through':_0x910a('0x177')});db['Tag'][_0x910a('0x11e')](db[_0x910a('0x5d')],{'through':'openchannel_interaction_has_tags'});db[_0x910a('0x8c')]['belongsToMany'](db[_0x910a('0x100')],{'through':_0x910a('0x1a8')});db[_0x910a('0x90')]['hasMany'](db[_0x910a('0x82')],{'as':{'plural':_0x910a('0x1a9'),'singular':_0x910a('0x1aa')},'foreignKey':_0x910a('0x1ab'),'onDelete':_0x910a('0x112'),'hooks':!![]});db[_0x910a('0x90')][_0x910a('0x10c')](db[_0x910a('0x82')],{'as':{'plural':_0x910a('0x1ac'),'singular':_0x910a('0x1ad')},'foreignKey':_0x910a('0x1ae'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x910a('0x10c')](db[_0x910a('0x1af')],{'as':_0x910a('0x1a0'),'foreignKey':'TriggerId','onDelete':_0x910a('0x112'),'hooks':!![]});db[_0x910a('0x98')][_0x910a('0x10c')](db[_0x910a('0x9f')],{'as':'Fields','onDelete':_0x910a('0x112'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x910a('0x9a')]['hasMany'](db[_0x910a('0x9f')],{'as':_0x910a('0x1b0'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b1')});db[_0x910a('0x9e')][_0x910a('0x10c')](db[_0x910a('0x9f')],{'as':_0x910a('0x1b0'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b2')});db[_0x910a('0x9f')]['belongsTo'](db[_0x910a('0x9e')],{'foreignKey':_0x910a('0x1b2')});db[_0x910a('0xa3')]['hasMany'](db[_0x910a('0x1b3')],{'as':_0x910a('0x1b4'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b5')});db['SalesforceConfiguration'][_0x910a('0x10c')](db[_0x910a('0xa6')],{'as':_0x910a('0x1b6'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b7')});db[_0x910a('0x1b3')][_0x910a('0x10c')](db[_0x910a('0xa6')],{'as':_0x910a('0x1b8'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b9')});db[_0x910a('0x1b3')][_0x910a('0x10c')](db[_0x910a('0xa6')],{'as':_0x910a('0x1b0'),'onDelete':'cascade','foreignKey':_0x910a('0x1ba')});db['SalesforceConfiguration'][_0x910a('0x14d')](db[_0x910a('0xa3')],{'as':_0x910a('0x169'),'foreignKey':'AccountId'});db[_0x910a('0xa6')]['hasMany'](db[_0x910a('0xa6')],{'as':_0x910a('0x1bb'),'foreignKey':_0x910a('0x1b7')});db[_0x910a('0xa6')][_0x910a('0x10c')](db[_0x910a('0xa6')],{'as':_0x910a('0x1bc'),'foreignKey':_0x910a('0x1b9')});db[_0x910a('0xa6')]['hasMany'](db[_0x910a('0xa6')],{'as':'Field','foreignKey':_0x910a('0x1ba')});db['SalesforceField']['belongsTo'](db[_0x910a('0x92')],{'as':_0x910a('0x92'),'foreignKey':_0x910a('0x1bd')});db[_0x910a('0xa7')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0x910a('0x1b4'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b5')});db[_0x910a('0xa8')][_0x910a('0x10c')](db[_0x910a('0x1be')],{'as':_0x910a('0x1b6'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b7')});db[_0x910a('0xa8')][_0x910a('0x10c')](db[_0x910a('0x1be')],{'as':_0x910a('0x1b8'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x910a('0xa8')][_0x910a('0x10c')](db[_0x910a('0x1be')],{'as':_0x910a('0x1b0'),'onDelete':_0x910a('0x112'),'foreignKey':'FieldId'});db['SugarcrmConfiguration']['belongsTo'](db['SugarcrmAccount'],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x1b5')});db[_0x910a('0x1be')][_0x910a('0x10c')](db[_0x910a('0x1be')],{'as':_0x910a('0x1bb'),'foreignKey':_0x910a('0x1b7')});db[_0x910a('0x1be')][_0x910a('0x10c')](db['SugarcrmField'],{'as':'Description','foreignKey':_0x910a('0x1b9')});db[_0x910a('0x1be')][_0x910a('0x10c')](db['SugarcrmField'],{'as':_0x910a('0x1bf'),'foreignKey':_0x910a('0x1ba')});db[_0x910a('0x1be')][_0x910a('0x14d')](db[_0x910a('0x92')],{'as':_0x910a('0x92'),'foreignKey':_0x910a('0x1bd')});db[_0x910a('0xab')]['hasMany'](db[_0x910a('0xac')],{'as':_0x910a('0x1b4'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b5')});db['DeskConfiguration'][_0x910a('0x10c')](db['DeskField'],{'as':_0x910a('0x1b6'),'onDelete':_0x910a('0x112'),'foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db[_0x910a('0x1c0')],{'as':'Descriptions','onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b9')});db[_0x910a('0xac')]['hasMany'](db['DeskField'],{'as':_0x910a('0x1b0'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1ba')});db[_0x910a('0xac')][_0x910a('0x14d')](db['DeskAccount'],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x1b5')});db[_0x910a('0xac')][_0x910a('0x11e')](db[_0x910a('0x8c')],{'through':'int_desk_configuration_has_tags'});db[_0x910a('0x1c0')]['hasMany'](db[_0x910a('0x1c0')],{'as':_0x910a('0x1bb'),'foreignKey':_0x910a('0x1b7')});db[_0x910a('0x1c0')][_0x910a('0x10c')](db[_0x910a('0x1c0')],{'as':'Description','foreignKey':_0x910a('0x1b9')});db['DeskField'][_0x910a('0x10c')](db[_0x910a('0x1c0')],{'as':_0x910a('0x1bf'),'foreignKey':_0x910a('0x1ba')});db[_0x910a('0x1c0')]['belongsTo'](db[_0x910a('0x92')],{'as':_0x910a('0x92'),'foreignKey':_0x910a('0x1bd')});db['ZohoAccount'][_0x910a('0x10c')](db['ZohoConfiguration'],{'as':_0x910a('0x1b4'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b5')});db[_0x910a('0x1c1')][_0x910a('0x10c')](db['ZohoField'],{'as':_0x910a('0x1b6'),'onDelete':'cascade','foreignKey':_0x910a('0x1b7')});db[_0x910a('0x1c1')][_0x910a('0x10c')](db['ZohoField'],{'as':'Descriptions','onDelete':_0x910a('0x112'),'foreignKey':'DescriptionId'});db[_0x910a('0x1c1')][_0x910a('0x10c')](db[_0x910a('0xb1')],{'as':_0x910a('0x1b0'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1ba')});db[_0x910a('0x1c1')][_0x910a('0x14d')](db[_0x910a('0xaf')],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x1b5')});db[_0x910a('0xb1')][_0x910a('0x10c')](db[_0x910a('0xb1')],{'as':_0x910a('0x1bb'),'foreignKey':_0x910a('0x1b7')});db[_0x910a('0xb1')][_0x910a('0x10c')](db[_0x910a('0xb1')],{'as':'Description','foreignKey':_0x910a('0x1b9')});db[_0x910a('0xb1')][_0x910a('0x10c')](db[_0x910a('0xb1')],{'as':'Field','foreignKey':_0x910a('0x1ba')});db[_0x910a('0xb1')]['belongsTo'](db[_0x910a('0x92')],{'as':_0x910a('0x92'),'foreignKey':_0x910a('0x1bd')});db['ZendeskAccount'][_0x910a('0x10c')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x910a('0x112'),'foreignKey':'AccountId'});db[_0x910a('0xb5')][_0x910a('0x10c')](db[_0x910a('0x1c2')],{'as':_0x910a('0x1b6'),'foreignKey':_0x910a('0x1b7')});db['ZendeskConfiguration']['hasMany'](db[_0x910a('0x1c2')],{'as':'Descriptions','foreignKey':_0x910a('0x1b9')});db[_0x910a('0xb5')]['hasMany'](db[_0x910a('0x1c2')],{'as':_0x910a('0x1b0'),'foreignKey':_0x910a('0x1ba')});db[_0x910a('0xb5')]['belongsTo'](db[_0x910a('0xb3')],{'as':_0x910a('0x169'),'foreignKey':'AccountId'});db[_0x910a('0xb5')][_0x910a('0x11e')](db['Tag'],{'through':_0x910a('0x1c3')});db[_0x910a('0x1c2')][_0x910a('0x10c')](db[_0x910a('0x1c2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x910a('0x1c2')]['hasMany'](db[_0x910a('0x1c2')],{'as':_0x910a('0x1bc'),'foreignKey':_0x910a('0x1b9')});db['ZendeskField'][_0x910a('0x10c')](db[_0x910a('0x1c2')],{'as':'Field','foreignKey':_0x910a('0x1ba')});db[_0x910a('0x1c2')][_0x910a('0x14d')](db[_0x910a('0x92')],{'as':_0x910a('0x92'),'foreignKey':_0x910a('0x1bd')});db[_0x910a('0x1c4')][_0x910a('0x10c')](db[_0x910a('0xb8')],{'as':_0x910a('0x1b4'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b5')});db[_0x910a('0xb8')][_0x910a('0x10c')](db[_0x910a('0xba')],{'as':_0x910a('0x1b6'),'onDelete':_0x910a('0x112'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x910a('0x10c')](db[_0x910a('0xba')],{'as':_0x910a('0x1b8'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b9')});db[_0x910a('0xb8')][_0x910a('0x10c')](db[_0x910a('0xba')],{'as':_0x910a('0x1b0'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1ba')});db['FreshdeskConfiguration'][_0x910a('0x14d')](db[_0x910a('0x1c4')],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x1b5')});db['FreshdeskConfiguration'][_0x910a('0x11e')](db[_0x910a('0x8c')],{'through':_0x910a('0x1c5')});db[_0x910a('0xba')]['hasMany'](db[_0x910a('0xba')],{'as':_0x910a('0x1bb'),'foreignKey':_0x910a('0x1b7')});db[_0x910a('0xba')][_0x910a('0x10c')](db['FreshdeskField'],{'as':_0x910a('0x1bc'),'foreignKey':_0x910a('0x1b9')});db['FreshdeskField'][_0x910a('0x10c')](db[_0x910a('0xba')],{'as':_0x910a('0x1bf'),'foreignKey':_0x910a('0x1ba')});db[_0x910a('0xba')]['belongsTo'](db[_0x910a('0x92')],{'as':_0x910a('0x92'),'foreignKey':_0x910a('0x1bd')});db['VtigerAccount']['hasMany'](db[_0x910a('0x1c6')],{'as':_0x910a('0x1b4'),'onDelete':'cascade','foreignKey':_0x910a('0x1b5')});db['VtigerConfiguration'][_0x910a('0x10c')](db[_0x910a('0xbe')],{'as':_0x910a('0x1b6'),'foreignKey':'SubjectId'});db[_0x910a('0x1c6')]['hasMany'](db[_0x910a('0xbe')],{'as':_0x910a('0x1b8'),'foreignKey':_0x910a('0x1b9')});db[_0x910a('0x1c6')]['hasMany'](db[_0x910a('0xbe')],{'as':_0x910a('0x1b0'),'foreignKey':_0x910a('0x1ba')});db[_0x910a('0x1c6')][_0x910a('0x14d')](db['VtigerAccount'],{'as':'Account','foreignKey':_0x910a('0x1b5')});db['VtigerField'][_0x910a('0x10c')](db[_0x910a('0xbe')],{'as':_0x910a('0x1bb'),'foreignKey':_0x910a('0x1b7')});db[_0x910a('0xbe')]['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x910a('0xbe')]['hasMany'](db['VtigerField'],{'as':_0x910a('0x1bf'),'foreignKey':'FieldId'});db['VtigerField'][_0x910a('0x14d')](db['Variable'],{'as':_0x910a('0x92'),'foreignKey':_0x910a('0x1bd')});db['ServicenowAccount'][_0x910a('0x10c')](db['ServicenowConfiguration'],{'as':_0x910a('0x1b4'),'onDelete':'cascade','foreignKey':_0x910a('0x1b5')});db[_0x910a('0xc2')]['hasMany'](db['ServicenowField'],{'as':_0x910a('0x1b6'),'foreignKey':_0x910a('0x1b7')});db[_0x910a('0xc2')][_0x910a('0x10c')](db[_0x910a('0xc4')],{'as':'Descriptions','foreignKey':_0x910a('0x1b9')});db['ServicenowConfiguration']['hasMany'](db[_0x910a('0xc4')],{'as':_0x910a('0x1b0'),'foreignKey':_0x910a('0x1ba')});db[_0x910a('0xc2')][_0x910a('0x14d')](db[_0x910a('0xc0')],{'as':'Account','foreignKey':_0x910a('0x1b5')});db[_0x910a('0xc4')][_0x910a('0x10c')](db[_0x910a('0xc4')],{'as':'Subject','foreignKey':_0x910a('0x1b7')});db[_0x910a('0xc4')]['hasMany'](db[_0x910a('0xc4')],{'as':_0x910a('0x1bc'),'foreignKey':_0x910a('0x1b9')});db[_0x910a('0xc4')][_0x910a('0x10c')](db['ServicenowField'],{'as':_0x910a('0x1bf'),'foreignKey':'FieldId'});db[_0x910a('0xc4')][_0x910a('0x14d')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x910a('0xc6')]['hasMany'](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b5')});db[_0x910a('0xc8')][_0x910a('0x10c')](db['Dynamics365Field'],{'as':_0x910a('0x1b6'),'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1b7')});db['Dynamics365Configuration'][_0x910a('0x10c')](db[_0x910a('0xca')],{'as':_0x910a('0x1b8'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x910a('0x10c')](db[_0x910a('0xca')],{'as':'Fields','onDelete':_0x910a('0x112'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x910a('0x14d')](db[_0x910a('0xc6')],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x1b5')});db[_0x910a('0xca')][_0x910a('0x10c')](db[_0x910a('0xca')],{'as':_0x910a('0x1bb'),'foreignKey':_0x910a('0x1b7')});db[_0x910a('0xca')][_0x910a('0x10c')](db['Dynamics365Field'],{'as':_0x910a('0x1bc'),'foreignKey':'DescriptionId'});db['Dynamics365Field']['hasMany'](db[_0x910a('0xca')],{'as':_0x910a('0x1bf'),'foreignKey':_0x910a('0x1ba')});db['Dynamics365Field'][_0x910a('0x14d')](db[_0x910a('0x92')],{'as':_0x910a('0x92'),'foreignKey':_0x910a('0x1bd')});db[_0x910a('0xcc')][_0x910a('0x10c')](db[_0x910a('0xce')],{'as':'Configurations','onDelete':_0x910a('0x112'),'foreignKey':'AccountId'});db[_0x910a('0xce')][_0x910a('0x10c')](db['FreshsalesField'],{'as':_0x910a('0x1b6'),'foreignKey':_0x910a('0x1b7')});db[_0x910a('0xce')][_0x910a('0x10c')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x910a('0xce')][_0x910a('0x10c')](db[_0x910a('0xd0')],{'as':_0x910a('0x1b0'),'foreignKey':'FieldId'});db[_0x910a('0xce')][_0x910a('0x14d')](db[_0x910a('0xcc')],{'as':'Account','foreignKey':_0x910a('0x1b5')});db[_0x910a('0xd0')][_0x910a('0x10c')](db['FreshsalesField'],{'as':_0x910a('0x1bb'),'foreignKey':_0x910a('0x1b7')});db[_0x910a('0xd0')][_0x910a('0x10c')](db[_0x910a('0xd0')],{'as':'Description','foreignKey':_0x910a('0x1b9')});db[_0x910a('0xd0')][_0x910a('0x10c')](db[_0x910a('0xd0')],{'as':'Field','foreignKey':_0x910a('0x1ba')});db[_0x910a('0xd0')][_0x910a('0x14d')](db[_0x910a('0x92')],{'as':_0x910a('0x92'),'foreignKey':_0x910a('0x1bd')});db[_0x910a('0xd4')]['belongsTo'](db[_0x910a('0x63')],{});db['ChatQueueReport'][_0x910a('0x14d')](db['CmList'],{'as':'List','foreignKey':_0x910a('0x173')});db[_0x910a('0xd4')][_0x910a('0x14d')](db[_0x910a('0x11f')],{'as':_0x910a('0x15d'),'foreignKey':'ContactId'});db[_0x910a('0xd4')][_0x910a('0x14d')](db[_0x910a('0x69')],{});db['ChatQueueReport'][_0x910a('0x14d')](db['ChatMessage'],{});db[_0x910a('0xd4')]['belongsTo'](db[_0x910a('0x14')],{});db[_0x910a('0xd4')][_0x910a('0x14d')](db[_0x910a('0x6c')],{});db['ChatInternalMessage']['belongsTo'](db[_0x910a('0x14')],{'onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x1c7')});db['ChatInternalMessage'][_0x910a('0x14d')](db['User'],{'onDelete':'cascade','foreignKey':_0x910a('0x1c8')});db[_0x910a('0xd9')][_0x910a('0x10c')](db[_0x910a('0xd8')],{'foreignKey':'SessionId','onDelete':_0x910a('0x112')});db[_0x910a('0xd9')]['hasMany'](db[_0x910a('0xd7')],{'foreignKey':_0x910a('0x1c9'),'onDelete':_0x910a('0x112')});db[_0x910a('0x1ca')]['belongsTo'](db[_0x910a('0x53')],{});db[_0x910a('0x1ca')][_0x910a('0x14d')](db[_0x910a('0xf6')],{'as':'List','foreignKey':_0x910a('0x173')});db[_0x910a('0x1ca')][_0x910a('0x14d')](db[_0x910a('0x11f')],{'as':_0x910a('0x15d'),'foreignKey':_0x910a('0x15e')});db[_0x910a('0x1ca')][_0x910a('0x14d')](db[_0x910a('0x56')],{});db[_0x910a('0x1ca')]['belongsTo'](db[_0x910a('0x57')],{});db[_0x910a('0x1ca')][_0x910a('0x14d')](db['User'],{});db[_0x910a('0x1ca')][_0x910a('0x14d')](db[_0x910a('0x58')],{});db[_0x910a('0xdc')][_0x910a('0x10c')](db[_0x910a('0xd9')],{'foreignKey':_0x910a('0x1cb')});db[_0x910a('0xdc')][_0x910a('0x10c')](db[_0x910a('0xd8')],{'foreignKey':_0x910a('0x1cb')});db[_0x910a('0xdc')][_0x910a('0x10c')](db[_0x910a('0xd7')],{'foreignKey':_0x910a('0x1cb')});db[_0x910a('0xe0')][_0x910a('0x11e')](db[_0x910a('0x14')],{'as':_0x910a('0x16d'),'through':_0x910a('0x1cc')});db['Team'][_0x910a('0x11e')](db['User'],{'as':_0x910a('0x153'),'through':_0x910a('0x122')});db[_0x910a('0xe4')][_0x910a('0x11e')](db[_0x910a('0x129')],{'through':_0x910a('0x155'),'as':'VoiceQueues'});db[_0x910a('0xe4')][_0x910a('0x11e')](db[_0x910a('0x3b')],{'through':'team_has_mail_queues','as':_0x910a('0x12b')});db[_0x910a('0xe4')][_0x910a('0x11e')](db[_0x910a('0x6c')],{'through':_0x910a('0x18f'),'as':_0x910a('0x12c')});db[_0x910a('0xe4')][_0x910a('0x11e')](db['FaxQueue'],{'through':_0x910a('0x179'),'as':'FaxQueues'});db[_0x910a('0xe4')][_0x910a('0x11e')](db[_0x910a('0x58')],{'through':_0x910a('0x180'),'as':_0x910a('0x12e')});db['Team']['belongsToMany'](db[_0x910a('0x61')],{'through':'team_has_openchannel_queues','as':_0x910a('0x12f')});db[_0x910a('0xe4')]['belongsToMany'](db[_0x910a('0x131')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x910a('0xe7')][_0x910a('0x10c')](db['CmHopper'],{'as':_0x910a('0x148'),'foreignKey':_0x910a('0x199')});db[_0x910a('0xe7')][_0x910a('0x10c')](db[_0x910a('0x113')],{'as':_0x910a('0x14a'),'foreignKey':_0x910a('0x199')});db[_0x910a('0xe7')][_0x910a('0x10c')](db[_0x910a('0x77')],{'as':_0x910a('0x195'),'foreignKey':'CampaignId'});db[_0x910a('0xe7')][_0x910a('0x10c')](db[_0x910a('0x75')],{'as':_0x910a('0x14b'),'foreignKey':_0x910a('0x199')});db['Campaign'][_0x910a('0x14d')](db[_0x910a('0x28')],{'as':_0x910a('0x28'),'foreignKey':_0x910a('0x1cd')});db[_0x910a('0xe7')]['belongsTo'](db[_0x910a('0x28')],{'as':_0x910a('0x14e'),'foreignKey':'TrunkBackupId'});db[_0x910a('0xe7')][_0x910a('0x14d')](db['Interval'],{'as':_0x910a('0x83'),'foreignKey':'IntervalId'});db[_0x910a('0xe7')]['belongsTo'](db[_0x910a('0xe0')],{'as':_0x910a('0xe0'),'foreignKey':'SquareProjectId'});db[_0x910a('0xe7')][_0x910a('0x11e')](db[_0x910a('0xf6')],{'as':_0x910a('0x121'),'through':'campaigns_has_cm_lists'});db[_0x910a('0xe7')][_0x910a('0x11e')](db[_0x910a('0xf6')],{'as':'BlackLists','through':_0x910a('0x1ce')});db['MailTransferReport'][_0x910a('0x14d')](db[_0x910a('0x40')],{});db[_0x910a('0xed')][_0x910a('0x14d')](db['MailInteraction'],{});db[_0x910a('0xed')][_0x910a('0x14d')](db[_0x910a('0x3a')],{'foreignKey':_0x910a('0x1cf'),'as':'FromAccount'});db['MailTransferReport'][_0x910a('0x14d')](db[_0x910a('0x14')],{'foreignKey':_0x910a('0x1d0'),'as':_0x910a('0x1d1')});db[_0x910a('0xed')]['belongsTo'](db[_0x910a('0x14')],{'foreignKey':_0x910a('0x1d2'),'as':_0x910a('0x1d3')});db['MailTransferReport'][_0x910a('0x14d')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x910a('0x1d4')});db[_0x910a('0xed')]['belongsTo'](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x910a('0xef')][_0x910a('0x14d')](db[_0x910a('0x18a')],{});db[_0x910a('0xef')][_0x910a('0x14d')](db[_0x910a('0x69')],{});db['ChatTransferReport'][_0x910a('0x14d')](db[_0x910a('0x63')],{'foreignKey':_0x910a('0x1d5'),'as':_0x910a('0x1d6')});db[_0x910a('0xef')][_0x910a('0x14d')](db[_0x910a('0x14')],{'foreignKey':_0x910a('0x1d0'),'as':'FromAgent'});db[_0x910a('0xef')][_0x910a('0x14d')](db['User'],{'foreignKey':_0x910a('0x1d2'),'as':_0x910a('0x1d3')});db[_0x910a('0xef')][_0x910a('0x14d')](db[_0x910a('0x6c')],{'foreignKey':_0x910a('0x1d7'),'as':'ToQueue'});db['ChatTransferReport'][_0x910a('0x14d')](db[_0x910a('0x63')],{'foreignKey':_0x910a('0x1d8'),'as':_0x910a('0x1d9')});db['FaxTransferReport'][_0x910a('0x14d')](db['FaxMessage'],{});db[_0x910a('0xf1')][_0x910a('0x14d')](db['FaxInteraction'],{});db['FaxTransferReport']['belongsTo'](db['FaxAccount'],{'foreignKey':_0x910a('0x1da'),'as':_0x910a('0x1d6')});db[_0x910a('0xf1')][_0x910a('0x14d')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x910a('0xf1')][_0x910a('0x14d')](db[_0x910a('0x14')],{'foreignKey':_0x910a('0x1d2'),'as':'ToAgent'});db[_0x910a('0xf1')][_0x910a('0x14d')](db[_0x910a('0x12d')],{'foreignKey':_0x910a('0x1db'),'as':'ToQueue'});db[_0x910a('0xf1')][_0x910a('0x14d')](db[_0x910a('0x49')],{'foreignKey':_0x910a('0x1dc'),'as':'ToAccount'});db[_0x910a('0x1dd')][_0x910a('0x14d')](db[_0x910a('0x5f')],{});db[_0x910a('0x1dd')][_0x910a('0x14d')](db[_0x910a('0x5d')],{});db['OpenchannelTransferReport'][_0x910a('0x14d')](db['OpenchannelAccount'],{'foreignKey':_0x910a('0x1de'),'as':_0x910a('0x1d6')});db['OpenchannelTransferReport'][_0x910a('0x14d')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db['OpenchannelTransferReport'][_0x910a('0x14d')](db[_0x910a('0x14')],{'foreignKey':_0x910a('0x1d2'),'as':_0x910a('0x1d3')});db[_0x910a('0x1dd')][_0x910a('0x14d')](db[_0x910a('0x61')],{'foreignKey':_0x910a('0x1df'),'as':'ToQueue'});db[_0x910a('0x1dd')][_0x910a('0x14d')](db['OpenchannelAccount'],{'foreignKey':_0x910a('0x1e0'),'as':'ToAccount'});db[_0x910a('0xf4')][_0x910a('0x14d')](db['SmsMessage'],{});db['SmsTransferReport'][_0x910a('0x14d')](db[_0x910a('0x56')],{});db[_0x910a('0xf4')][_0x910a('0x14d')](db[_0x910a('0x53')],{'foreignKey':_0x910a('0x1e1'),'as':_0x910a('0x1d6')});db['SmsTransferReport'][_0x910a('0x14d')](db[_0x910a('0x14')],{'foreignKey':_0x910a('0x1d0'),'as':'FromAgent'});db[_0x910a('0xf4')][_0x910a('0x14d')](db[_0x910a('0x14')],{'foreignKey':_0x910a('0x1d2'),'as':_0x910a('0x1d3')});db[_0x910a('0xf4')]['belongsTo'](db[_0x910a('0x58')],{'foreignKey':_0x910a('0x1e2'),'as':_0x910a('0x1d4')});db[_0x910a('0xf4')][_0x910a('0x14d')](db['SmsAccount'],{'foreignKey':_0x910a('0x1e3'),'as':_0x910a('0x1d9')});db['CmList'][_0x910a('0x10c')](db[_0x910a('0x80')],{'as':'Dispositions','foreignKey':'ListId'});db[_0x910a('0xf6')][_0x910a('0x10c')](db[_0x910a('0x7a')],{'as':'CustomFields','foreignKey':_0x910a('0x173')});db['CmList'][_0x910a('0x10c')](db[_0x910a('0x11f')],{'as':'Contacts','onDelete':_0x910a('0x112'),'foreignKey':_0x910a('0x173')});db['CmList'][_0x910a('0x10c')](db['CmHopperFinal'],{'as':_0x910a('0x14a'),'foreignKey':'ListId'});db[_0x910a('0xf6')]['hasMany'](db[_0x910a('0x77')],{'as':_0x910a('0x1e4'),'foreignKey':_0x910a('0x173')});db['CmList']['hasMany'](db[_0x910a('0x114')],{'as':'ReportAgentPreview','foreignKey':_0x910a('0x173')});db[_0x910a('0xf6')][_0x910a('0x11e')](db[_0x910a('0x129')],{'as':_0x910a('0x1e5'),'through':'voice_queues_has_cm_lists'});db[_0x910a('0xf6')][_0x910a('0x11e')](db[_0x910a('0x14')],{'as':'Agents','through':_0x910a('0x133')});db[_0x910a('0x134')]['hasMany'](db[_0x910a('0x110')],{'as':'Extensions','onDelete':_0x910a('0x112')});db[_0x910a('0x134')][_0x910a('0x11e')](db[_0x910a('0x14')],{'as':'Agents','through':_0x910a('0x136')});db['UserProfile'][_0x910a('0x10c')](db[_0x910a('0x14')],{'as':_0x910a('0x16d'),'foreignKey':_0x910a('0x11b')});db[_0x910a('0xf8')][_0x910a('0x10c')](db['UserProfileSection'],{'as':_0x910a('0x1e6'),'foreignKey':_0x910a('0x11b'),'onDelete':_0x910a('0x112')});db[_0x910a('0x1e7')]['hasMany'](db['UserProfileResource'],{'as':_0x910a('0x1e8'),'foreignKey':_0x910a('0x1e9'),'onDelete':'cascade'});db[_0x910a('0x13f')][_0x910a('0x10c')](db[_0x910a('0x80')],{'as':_0x910a('0x162'),'foreignKey':_0x910a('0x1ea')});db[_0x910a('0x13f')][_0x910a('0x10c')](db['CannedAnswer'],{'as':_0x910a('0x163'),'foreignKey':'WhatsappAccountId'});db[_0x910a('0x13f')][_0x910a('0x10c')](db['WhatsappMessage'],{'as':_0x910a('0x157'),'foreignKey':_0x910a('0x1ea')});db['WhatsappAccount']['hasMany'](db['WhatsappInteraction'],{'as':_0x910a('0x164')});db[_0x910a('0x13f')][_0x910a('0x10c')](db[_0x910a('0x1eb')],{'as':_0x910a('0x143')});db['WhatsappAccount'][_0x910a('0x14d')](db[_0x910a('0xf6')],{'as':_0x910a('0x165'),'foreignKey':_0x910a('0x173')});db[_0x910a('0x13f')]['belongsTo'](db[_0x910a('0x174')],{'as':_0x910a('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x910a('0x13f')][_0x910a('0x11e')](db['User'],{'as':_0x910a('0x153'),'through':'user_has_whatsapp_accounts'});db[_0x910a('0x1eb')]['belongsTo'](db['User'],{'onDelete':_0x910a('0x16f')});db[_0x910a('0x1eb')][_0x910a('0x14d')](db[_0x910a('0x131')],{'onDelete':_0x910a('0x16f')});db[_0x910a('0x1eb')][_0x910a('0x14d')](db[_0x910a('0x13f')],{'onDelete':_0x910a('0x16f')});db[_0x910a('0x1eb')]['belongsTo'](db['Interval'],{'onDelete':_0x910a('0x16f'),'foreignKey':_0x910a('0x150')});db[_0x910a('0x1eb')][_0x910a('0x14d')](db[_0x910a('0x8c')],{'onDelete':_0x910a('0x16f'),'foreignKey':_0x910a('0x175')});db[_0x910a('0x100')][_0x910a('0x10c')](db['WhatsappMessage'],{'as':_0x910a('0x157'),'onDelete':'cascade','foreignKey':_0x910a('0x1ec')});db[_0x910a('0x100')]['belongsTo'](db[_0x910a('0x13f')],{'as':'Account','foreignKey':_0x910a('0x1ea')});db[_0x910a('0x100')][_0x910a('0x14d')](db[_0x910a('0x11f')],{'as':_0x910a('0x15d'),'foreignKey':'ContactId'});db[_0x910a('0x100')][_0x910a('0x14d')](db[_0x910a('0x14')],{'as':_0x910a('0x16a'),'foreignKey':_0x910a('0x10b')});db[_0x910a('0x100')][_0x910a('0x11e')](db[_0x910a('0x8c')],{'through':_0x910a('0x1a8'),'as':_0x910a('0x16c')});db[_0x910a('0x100')]['belongsToMany'](db[_0x910a('0x8c')],{'through':_0x910a('0x1a8'),'as':_0x910a('0x17d')});db['WhatsappInteraction']['belongsToMany'](db[_0x910a('0x14')],{'as':'Users','through':_0x910a('0x128'),'foreignKey':_0x910a('0x1ec')});db[_0x910a('0x101')][_0x910a('0x14d')](db[_0x910a('0x14')],{'as':_0x910a('0x14')});db[_0x910a('0x101')][_0x910a('0x14d')](db[_0x910a('0x11f')],{'onDelete':_0x910a('0x112'),'as':_0x910a('0x15d')});db['WhatsappMessage'][_0x910a('0x14d')](db[_0x910a('0x100')],{'onDelete':_0x910a('0x112'),'as':'Interaction','foreignKey':_0x910a('0x1ec')});db[_0x910a('0x101')][_0x910a('0x14d')](db['WhatsappAccount'],{'as':_0x910a('0x169'),'foreignKey':_0x910a('0x1ea')});db[_0x910a('0x103')][_0x910a('0x14d')](db[_0x910a('0x13f')],{});db[_0x910a('0x103')][_0x910a('0x14d')](db['CmList'],{'as':_0x910a('0x165'),'foreignKey':'ListId'});db[_0x910a('0x103')]['belongsTo'](db['CmContact'],{'as':_0x910a('0x15d'),'foreignKey':_0x910a('0x15e')});db[_0x910a('0x103')]['belongsTo'](db[_0x910a('0x100')],{});db[_0x910a('0x103')][_0x910a('0x14d')](db[_0x910a('0x131')],{});db[_0x910a('0x103')][_0x910a('0x14d')](db[_0x910a('0x101')],{});db[_0x910a('0x103')][_0x910a('0x14d')](db[_0x910a('0x14')],{});db['WhatsappTransferReport'][_0x910a('0x14d')](db['WhatsappMessage'],{});db[_0x910a('0x105')][_0x910a('0x14d')](db[_0x910a('0x100')],{});db[_0x910a('0x105')][_0x910a('0x14d')](db[_0x910a('0x13f')],{'foreignKey':_0x910a('0x1ed'),'as':_0x910a('0x1d6')});db['WhatsappTransferReport'][_0x910a('0x14d')](db[_0x910a('0x13f')],{'foreignKey':_0x910a('0x1ee'),'as':_0x910a('0x1d9')});db[_0x910a('0x105')]['belongsTo'](db[_0x910a('0x131')],{'foreignKey':_0x910a('0x1ef'),'as':_0x910a('0x1d4')});db[_0x910a('0x105')][_0x910a('0x14d')](db['User'],{'foreignKey':_0x910a('0x1d0'),'as':_0x910a('0x1d1')});db[_0x910a('0x105')][_0x910a('0x14d')](db[_0x910a('0x14')],{'foreignKey':'ToUserId','as':_0x910a('0x1d3')});db[_0x910a('0x131')]['belongsToMany'](db['User'],{'as':_0x910a('0x153'),'through':_0x910a('0x35'),'foreignKey':_0x910a('0x1f0')});db[_0x910a('0x131')][_0x910a('0x11e')](db['Team'],{'through':_0x910a('0x1f1'),'as':'Teams'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 1b6e5a5..3a47abc 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf197=['lodash','path','express','./errors','./config/logger','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','remoteAddress','url','statusCode','user','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)','connection','responseTime','name','agent_id','agent_name','test','/api/users','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/templates','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/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/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/cm/lists','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','static','join','/apidoc','root','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','email','clientId','clientSecret','code','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','secretaccesskey','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','isString','replace','@@{','}@@','includes'];(function(_0x4c1535,_0xad180e){var _0x4eef7b=function(_0xa18df3){while(--_0xa18df3){_0x4c1535['push'](_0x4c1535['shift']());}};_0x4eef7b(++_0xad180e);}(_0xf197,0x130));var _0x7f19=function(_0x4b1a15,_0x45ae49){_0x4b1a15=_0x4b1a15-0x0;var _0x33db44=_0xf197[_0x4b1a15];return _0x33db44;};'use strict';var _=require(_0x7f19('0x0'));var path=require(_0x7f19('0x1'));var express=require(_0x7f19('0x2'));var ewinston=require('express-winston');var util=require('util');var errors=require(_0x7f19('0x3'));var config=require('./config/environment');var logger=require('./config/logger')('api');var authLogger=require(_0x7f19('0x4'))('auth');exports['default']=function(_0x1a3591){_0x1a3591[_0x7f19('0x5')](ewinston[_0x7f19('0x6')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1851e3,_0x39c494){var _0x2ebbfb=_0x7f19('0x7');if(!_['isEmpty'](_0x1851e3[_0x7f19('0x8')])){_0x2ebbfb+=_0x7f19('0x9');var _0x7c5f2c=_0x1851e3['body'];maskSensitiveData(_0x7c5f2c);}return util[_0x7f19('0xa')](_0x2ebbfb,_0x1851e3[_0x7f19('0xb')],_0x1851e3[_0x7f19('0xc')][_0x7f19('0xd')]?_0x1851e3['headers'][_0x7f19('0xd')]:_0x1851e3['connection'][_0x7f19('0xe')]||_0x1851e3['ip'],_0x1851e3[_0x7f19('0xf')],_0x39c494[_0x7f19('0x10')],_0x39c494['responseTime'],_0x1851e3['user']?_0x1851e3[_0x7f19('0x11')]['id']:null,_0x1851e3[_0x7f19('0x11')]?_0x1851e3[_0x7f19('0x11')]['name']:null,_0x1851e3[_0x7f19('0x11')]?_0x1851e3[_0x7f19('0x11')]['role']:null,_0x7c5f2c?util[_0x7f19('0x12')](_0x7c5f2c,![],null):'');}}));_0x1a3591[_0x7f19('0x5')](ewinston[_0x7f19('0x6')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5c0b64,_0x3d81d1){var _0x520281=_0x7f19('0x13');if(_0x5c0b64[_0x7f19('0x8')]&&_0x5c0b64[_0x7f19('0x8')][_0x7f19('0x14')]&&_0x5c0b64[_0x7f19('0x8')]['agent_id']){_0x520281=_0x7f19('0x15');}return util[_0x7f19('0xa')](_0x520281,_0x5c0b64[_0x7f19('0xb')],_0x5c0b64['headers'][_0x7f19('0xd')]?_0x5c0b64[_0x7f19('0xc')][_0x7f19('0xd')]:_0x5c0b64[_0x7f19('0x16')]['remoteAddress']||_0x5c0b64['ip'],_0x5c0b64[_0x7f19('0xf')],_0x3d81d1[_0x7f19('0x10')],_0x3d81d1[_0x7f19('0x17')],_0x5c0b64[_0x7f19('0x11')]?_0x5c0b64['user']['id']:null,_0x5c0b64[_0x7f19('0x11')]?_0x5c0b64[_0x7f19('0x11')][_0x7f19('0x18')]:null,_0x5c0b64[_0x7f19('0x11')]?_0x5c0b64[_0x7f19('0x11')]['role']:null,_0x5c0b64[_0x7f19('0x8')]&&_0x5c0b64[_0x7f19('0x8')][_0x7f19('0x14')]?_0x5c0b64[_0x7f19('0x8')][_0x7f19('0x14')]:'other',_0x5c0b64['body']&&_0x5c0b64[_0x7f19('0x8')][_0x7f19('0x19')]?_0x5c0b64['body'][_0x7f19('0x19')]:'',_0x5c0b64[_0x7f19('0x8')]&&_0x5c0b64[_0x7f19('0x8')][_0x7f19('0x1a')]?_0x5c0b64[_0x7f19('0x8')][_0x7f19('0x1a')]:'');},'ignoreRoute':function(_0x3550a9){var _0x4ae0d2=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4ae0d2[_0x7f19('0x1b')](_0x3550a9[_0x7f19('0xf')]);}}));_0x1a3591['use'](_0x7f19('0x1c'),require('./api/user'));_0x1a3591[_0x7f19('0x5')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x1a3591[_0x7f19('0x5')]('/api/voice/contexts',require(_0x7f19('0x1d')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x1e'),require('./api/voiceExtension'));_0x1a3591[_0x7f19('0x5')]('/api/voice/mohs',require(_0x7f19('0x1f')));_0x1a3591['use'](_0x7f19('0x20'),require(_0x7f19('0x21')));_0x1a3591[_0x7f19('0x5')]('/api/voice/recordings',require('./api/voiceRecording'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x22'),require(_0x7f19('0x23')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x24'),require('./api/voiceMail'));_0x1a3591['use']('/api/voice/mails/messages',require(_0x7f19('0x25')));_0x1a3591[_0x7f19('0x5')]('/api/voice/calls/reports',require(_0x7f19('0x26')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x27'),require(_0x7f19('0x28')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x29'),require(_0x7f19('0x2a')));_0x1a3591[_0x7f19('0x5')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x2b'),require(_0x7f19('0x2c')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x2d'),require(_0x7f19('0x2e')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x2f'),require(_0x7f19('0x30')));_0x1a3591['use'](_0x7f19('0x31'),require(_0x7f19('0x32')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x33'),require('./api/mailAccount'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x34'),require(_0x7f19('0x35')));_0x1a3591[_0x7f19('0x5')]('/api/mail/substatuses',require(_0x7f19('0x36')));_0x1a3591['use'](_0x7f19('0x37'),require(_0x7f19('0x38')));_0x1a3591['use']('/api/mail/messages',require(_0x7f19('0x39')));_0x1a3591[_0x7f19('0x5')]('/api/mail/applications',require('./api/mailApplication'));_0x1a3591['use']('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x1a3591['use'](_0x7f19('0x3a'),require(_0x7f19('0x3b')));_0x1a3591[_0x7f19('0x5')]('/api/dashboards/items',require(_0x7f19('0x3c')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x3d'),require(_0x7f19('0x3e')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x3f'),require('./api/faxApplication'));_0x1a3591[_0x7f19('0x5')]('/api/fax/interactions',require(_0x7f19('0x40')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x41'),require('./api/faxMessage'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x42'),require(_0x7f19('0x43')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x44'),require(_0x7f19('0x45')));_0x1a3591[_0x7f19('0x5')]('/api/sms/accounts',require(_0x7f19('0x46')));_0x1a3591['use'](_0x7f19('0x47'),require(_0x7f19('0x48')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x49'),require(_0x7f19('0x4a')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x4b'),require(_0x7f19('0x4c')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x4d'),require('./api/smsQueue'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x4e'),require('./api/openchannelAccount'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x4f'),require(_0x7f19('0x50')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x51'),require(_0x7f19('0x52')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x53'),require(_0x7f19('0x54')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x55'),require(_0x7f19('0x56')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x57'),require(_0x7f19('0x58')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x59'),require(_0x7f19('0x5a')));_0x1a3591[_0x7f19('0x5')]('/api/chat/applications',require(_0x7f19('0x5b')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x5c'),require(_0x7f19('0x5d')));_0x1a3591['use']('/api/chat/messages',require(_0x7f19('0x5e')));_0x1a3591[_0x7f19('0x5')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x5f'),require('./api/chatQueue'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x60'),require(_0x7f19('0x61')));_0x1a3591[_0x7f19('0x5')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x62'),require(_0x7f19('0x63')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x64'),require(_0x7f19('0x65')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x66'),require(_0x7f19('0x67')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x68'),require('./api/cmHopperBlack'));_0x1a3591[_0x7f19('0x5')]('/api/cm/hopper_final',require(_0x7f19('0x69')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x6a'),require(_0x7f19('0x6b')));_0x1a3591[_0x7f19('0x5')]('/api/cm/custom_fields',require(_0x7f19('0x6c')));_0x1a3591['use']('/api/actions',require(_0x7f19('0x6d')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x6e'),require(_0x7f19('0x6f')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x70'),require(_0x7f19('0x71')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x72'),require(_0x7f19('0x73')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x74'),require(_0x7f19('0x75')));_0x1a3591[_0x7f19('0x5')]('/api/intervals',require(_0x7f19('0x76')));_0x1a3591['use'](_0x7f19('0x77'),require(_0x7f19('0x78')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x79'),require('./api/cdr'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x7a'),require(_0x7f19('0x7b')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x7c'),require('./api/schedule'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x7d'),require(_0x7f19('0x7e')));_0x1a3591[_0x7f19('0x5')]('/api/tags',require('./api/tag'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x7f'),require('./api/template'));_0x1a3591[_0x7f19('0x5')]('/api/triggers',require('./api/trigger'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x80'),require('./api/variable'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x81'),require(_0x7f19('0x82')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x83'),require(_0x7f19('0x84')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x85'),require('./api/analyticCustomReport'));_0x1a3591[_0x7f19('0x5')]('/api/analytics/default_reports',require(_0x7f19('0x86')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x87'),require(_0x7f19('0x88')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x89'),require('./api/analyticMetric'));_0x1a3591[_0x7f19('0x5')]('/api/analytics/field_reports',require(_0x7f19('0x8a')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x8b'),require(_0x7f19('0x8c')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x8d'),require(_0x7f19('0x8e')));_0x1a3591['use']('/api/integrations/salesforce/configurations',require(_0x7f19('0x8f')));_0x1a3591['use'](_0x7f19('0x90'),require(_0x7f19('0x91')));_0x1a3591[_0x7f19('0x5')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x92'),require('./api/intSugarcrmConfiguration'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x93'),require('./api/intSugarcrmField'));_0x1a3591[_0x7f19('0x5')]('/api/integrations/desk/accounts',require(_0x7f19('0x94')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x95'),require(_0x7f19('0x96')));_0x1a3591[_0x7f19('0x5')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x97'),require(_0x7f19('0x98')));_0x1a3591[_0x7f19('0x5')]('/api/integrations/zoho/configurations',require(_0x7f19('0x99')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x9a'),require('./api/intZohoField'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x9b'),require(_0x7f19('0x9c')));_0x1a3591[_0x7f19('0x5')]('/api/integrations/zendesk/configurations',require(_0x7f19('0x9d')));_0x1a3591[_0x7f19('0x5')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x1a3591[_0x7f19('0x5')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x1a3591[_0x7f19('0x5')]('/api/integrations/freshdesk/configurations',require(_0x7f19('0x9e')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x9f'),require(_0x7f19('0xa0')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xa1'),require(_0x7f19('0xa2')));_0x1a3591[_0x7f19('0x5')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xa3'),require(_0x7f19('0xa4')));_0x1a3591['use'](_0x7f19('0xa5'),require(_0x7f19('0xa6')));_0x1a3591[_0x7f19('0x5')]('/api/integrations/servicenow/configurations',require(_0x7f19('0xa7')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xa8'),require(_0x7f19('0xa9')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xaa'),require('./api/intDynamics365Account'));_0x1a3591['use'](_0x7f19('0xab'),require(_0x7f19('0xac')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xad'),require(_0x7f19('0xae')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xaf'),require(_0x7f19('0xb0')));_0x1a3591[_0x7f19('0x5')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x1a3591['use'](_0x7f19('0xb1'),require(_0x7f19('0xb2')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xb3'),require(_0x7f19('0xb4')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xb5'),require(_0x7f19('0xb6')));_0x1a3591[_0x7f19('0x5')]('/api/chat/internal/messages',require(_0x7f19('0xb7')));_0x1a3591['use'](_0x7f19('0xb8'),require(_0x7f19('0xb9')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xba'),require(_0x7f19('0xbb')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xbc'),require(_0x7f19('0xbd')));_0x1a3591[_0x7f19('0x5')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xbe'),require(_0x7f19('0xbf')));_0x1a3591[_0x7f19('0x5')]('/api/square/details/reports',require(_0x7f19('0xc0')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xc1'),require(_0x7f19('0xc2')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xc3'),require(_0x7f19('0xc4')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xc5'),require(_0x7f19('0xc6')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xc7'),require(_0x7f19('0xc8')));_0x1a3591[_0x7f19('0x5')]('/api/square/recordings',require(_0x7f19('0xc9')));_0x1a3591['use']('/api/square/messages',require(_0x7f19('0xca')));_0x1a3591[_0x7f19('0x5')]('/api/teams',require(_0x7f19('0xcb')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xcc'),require(_0x7f19('0xcd')));_0x1a3591[_0x7f19('0x5')]('/api/campaigns',require(_0x7f19('0xce')));_0x1a3591['use'](_0x7f19('0xcf'),require('./api/migration'));_0x1a3591[_0x7f19('0x5')]('/api/attachments',require(_0x7f19('0xd0')));_0x1a3591['use']('/api/plugins',require(_0x7f19('0xd1')));_0x1a3591[_0x7f19('0x5')]('/api/mail/reports/transfer',require(_0x7f19('0xd2')));_0x1a3591['use'](_0x7f19('0xd3'),require(_0x7f19('0xd4')));_0x1a3591['use'](_0x7f19('0xd5'),require(_0x7f19('0xd6')));_0x1a3591['use']('/api/openchannel/reports/transfer',require(_0x7f19('0xd7')));_0x1a3591[_0x7f19('0x5')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xd8'),require('./api/cmList'));_0x1a3591[_0x7f19('0x5')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xd9'),require(_0x7f19('0xda')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xdb'),require(_0x7f19('0xdc')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xdd'),require(_0x7f19('0xde')));_0x1a3591['use'](_0x7f19('0xdf'),require(_0x7f19('0xe0')));_0x1a3591[_0x7f19('0x5')]('/api/userNotifications',require('./api/userNotification'));_0x1a3591[_0x7f19('0x5')]('/api/whatsapp/accounts',require(_0x7f19('0xe1')));_0x1a3591['use']('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xe2'),require(_0x7f19('0xe3')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xe4'),require('./api/whatsappMessage'));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xe5'),require(_0x7f19('0xe6')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xe7'),require(_0x7f19('0xe8')));_0x1a3591[_0x7f19('0x5')]('/api/whatsapp/queues',require(_0x7f19('0xe9')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xea'),require(_0x7f19('0xeb')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xec'),require(_0x7f19('0xed')));_0x1a3591['use']('/api/auth/google',require(_0x7f19('0xee')));_0x1a3591['use'](_0x7f19('0xef'),require(_0x7f19('0xf0')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xf1'),require(_0x7f19('0xf2')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xf3'),require(_0x7f19('0xf4')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xf5'),require(_0x7f19('0xf6')));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xf7'),require(_0x7f19('0xf8')));_0x1a3591[_0x7f19('0x5')]('/api/webbar',require(_0x7f19('0xf9')));_0x1a3591[_0x7f19('0x5')]('/apidoc',express[_0x7f19('0xfa')](path[_0x7f19('0xfb')](config['root'],_0x7f19('0xfc'))));_0x1a3591[_0x7f19('0x5')]('/www',express['static'](path[_0x7f19('0xfb')](config[_0x7f19('0xfd')],'/www')));_0x1a3591['use'](_0x7f19('0xfe'),express['static'](path[_0x7f19('0xfb')](config[_0x7f19('0xfd')],_0x7f19('0xfe'))));_0x1a3591[_0x7f19('0x5')](_0x7f19('0xff'),express[_0x7f19('0xfa')](path[_0x7f19('0xfb')](config[_0x7f19('0xfd')],_0x7f19('0x100'),_0x7f19('0x101'))));_0x1a3591[_0x7f19('0x5')](_0x7f19('0x102'),express['static'](path[_0x7f19('0xfb')](config[_0x7f19('0xfd')],_0x7f19('0x103'))));_0x1a3591[_0x7f19('0x104')](_0x7f19('0x105'))[_0x7f19('0x106')](errors[0x194]);_0x1a3591[_0x7f19('0x104')]('/*')[_0x7f19('0x106')](function(_0x44ab45,_0xf0273e){_0xf0273e['sendFile'](path['resolve'](_0x1a3591[_0x7f19('0x106')](_0x7f19('0x107'))+_0x7f19('0x108')));});};var sensitiveFields=[_0x7f19('0x109'),_0x7f19('0x10a'),_0x7f19('0x10b'),_0x7f19('0x10c'),_0x7f19('0x10d'),_0x7f19('0x10e'),_0x7f19('0x10f'),_0x7f19('0x110'),_0x7f19('0x111'),'fax',_0x7f19('0x112'),_0x7f19('0x113'),_0x7f19('0x114'),'securityToken',_0x7f19('0x115'),'accessKey',_0x7f19('0x116'),_0x7f19('0x117'),_0x7f19('0x118'),_0x7f19('0x119'),_0x7f19('0x11a'),_0x7f19('0x11b'),'consumerKey',_0x7f19('0x11c'),'membername',_0x7f19('0x11d'),_0x7f19('0x11e'),_0x7f19('0x11f'),_0x7f19('0x120'),_0x7f19('0x121'),'privateKey','accesskeyid',_0x7f19('0x122'),'key','user',_0x7f19('0x123'),_0x7f19('0x124'),_0x7f19('0x125'),_0x7f19('0x126'),_0x7f19('0x127'),_0x7f19('0x128'),'oldPassword'];function maskSensitiveData(_0x97add7){var _0x4e4ddc=/(?!^)[\s\S](?!$)/g;if(!_[_0x7f19('0x129')](_0x97add7))return;for(var _0x5bb7bd in _0x97add7){if(_[_0x7f19('0x12a')](_0x97add7[_0x5bb7bd])){for(var _0x3b1428=0x0;_0x3b1428<_0x97add7[_0x5bb7bd]['length'];_0x3b1428++){maskSensitiveData(_0x97add7[_0x5bb7bd][_0x3b1428]);}}else if(_[_0x7f19('0x129')](_0x97add7[_0x5bb7bd])){maskSensitiveData(_0x97add7[_0x5bb7bd]);}else if(_[_0x7f19('0x12b')](_0x97add7[_0x5bb7bd])){_0x97add7[_0x5bb7bd]=_0x97add7[_0x5bb7bd][_0x7f19('0x12c')](/{{{/g,_0x7f19('0x12d'))[_0x7f19('0x12c')](/}}}/g,_0x7f19('0x12e'))[_0x7f19('0x12c')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7f19('0x12f')](sensitiveFields,_0x5bb7bd)){_0x97add7[_0x5bb7bd]=_0x97add7[_0x5bb7bd][_0x7f19('0x12c')](_0x4e4ddc,'*');}}}} \ No newline at end of file +var _0x3164=['./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','1.0.16','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','membername','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','registry','oldPassword','isArray','length','isPlainObject','isString','replace','lodash','path','express','express-winston','util','./config/environment','./config/logger','api','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','method','connection','name','role','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/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/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/notifications','./api/notification','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','/api/auth/google','/api/jira','./api/jira'];(function(_0x137d48,_0x5356c8){var _0x296c54=function(_0x474b7c){while(--_0x474b7c){_0x137d48['push'](_0x137d48['shift']());}};_0x296c54(++_0x5356c8);}(_0x3164,0x182));var _0x4316=function(_0x53be8d,_0x2cb53f){_0x53be8d=_0x53be8d-0x0;var _0x396d2c=_0x3164[_0x53be8d];return _0x396d2c;};'use strict';var _=require(_0x4316('0x0'));var path=require(_0x4316('0x1'));var express=require(_0x4316('0x2'));var ewinston=require(_0x4316('0x3'));var util=require(_0x4316('0x4'));var errors=require('./errors');var config=require(_0x4316('0x5'));var logger=require(_0x4316('0x6'))(_0x4316('0x7'));var authLogger=require('./config/logger')('auth');exports[_0x4316('0x8')]=function(_0x25827b){_0x25827b[_0x4316('0x9')](ewinston[_0x4316('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x25be1f,_0x473cd2){var _0x1bcd38=_0x4316('0xb');if(!_[_0x4316('0xc')](_0x25be1f[_0x4316('0xd')])){_0x1bcd38+=_0x4316('0xe');var _0x8c143=_0x25be1f[_0x4316('0xd')];maskSensitiveData(_0x8c143);}return util[_0x4316('0xf')](_0x1bcd38,_0x25be1f['method'],_0x25be1f[_0x4316('0x10')][_0x4316('0x11')]?_0x25be1f[_0x4316('0x10')][_0x4316('0x11')]:_0x25be1f['connection'][_0x4316('0x12')]||_0x25be1f['ip'],_0x25be1f[_0x4316('0x13')],_0x473cd2[_0x4316('0x14')],_0x473cd2[_0x4316('0x15')],_0x25be1f['user']?_0x25be1f[_0x4316('0x16')]['id']:null,_0x25be1f['user']?_0x25be1f['user']['name']:null,_0x25be1f[_0x4316('0x16')]?_0x25be1f[_0x4316('0x16')]['role']:null,_0x8c143?util[_0x4316('0x17')](_0x8c143,![],null):'');}}));_0x25827b['use'](ewinston[_0x4316('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3e9ab8,_0x211d87){var _0x1caa59=_0x4316('0x18');if(_0x3e9ab8[_0x4316('0xd')]&&_0x3e9ab8[_0x4316('0xd')][_0x4316('0x19')]&&_0x3e9ab8[_0x4316('0xd')][_0x4316('0x1a')]){_0x1caa59='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x4316('0xf')](_0x1caa59,_0x3e9ab8[_0x4316('0x1b')],_0x3e9ab8['headers']['x-forwarded-for']?_0x3e9ab8[_0x4316('0x10')][_0x4316('0x11')]:_0x3e9ab8[_0x4316('0x1c')][_0x4316('0x12')]||_0x3e9ab8['ip'],_0x3e9ab8[_0x4316('0x13')],_0x211d87['statusCode'],_0x211d87[_0x4316('0x15')],_0x3e9ab8[_0x4316('0x16')]?_0x3e9ab8['user']['id']:null,_0x3e9ab8[_0x4316('0x16')]?_0x3e9ab8[_0x4316('0x16')][_0x4316('0x1d')]:null,_0x3e9ab8['user']?_0x3e9ab8[_0x4316('0x16')][_0x4316('0x1e')]:null,_0x3e9ab8[_0x4316('0xd')]&&_0x3e9ab8['body'][_0x4316('0x19')]?_0x3e9ab8[_0x4316('0xd')][_0x4316('0x19')]:_0x4316('0x1f'),_0x3e9ab8[_0x4316('0xd')]&&_0x3e9ab8[_0x4316('0xd')][_0x4316('0x1a')]?_0x3e9ab8[_0x4316('0xd')][_0x4316('0x1a')]:'',_0x3e9ab8[_0x4316('0xd')]&&_0x3e9ab8[_0x4316('0xd')][_0x4316('0x20')]?_0x3e9ab8[_0x4316('0xd')][_0x4316('0x20')]:'');},'ignoreRoute':function(_0x22abc7){var _0x31cd5f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x31cd5f[_0x4316('0x21')](_0x22abc7['url']);}}));_0x25827b['use'](_0x4316('0x22'),require(_0x4316('0x23')));_0x25827b[_0x4316('0x9')](_0x4316('0x24'),require(_0x4316('0x25')));_0x25827b['use'](_0x4316('0x26'),require('./api/voiceContext'));_0x25827b[_0x4316('0x9')]('/api/voice/extensions',require(_0x4316('0x27')));_0x25827b['use'](_0x4316('0x28'),require(_0x4316('0x29')));_0x25827b['use'](_0x4316('0x2a'),require('./api/voiceQueue'));_0x25827b[_0x4316('0x9')](_0x4316('0x2b'),require(_0x4316('0x2c')));_0x25827b[_0x4316('0x9')](_0x4316('0x2d'),require(_0x4316('0x2e')));_0x25827b[_0x4316('0x9')](_0x4316('0x2f'),require('./api/voiceMail'));_0x25827b[_0x4316('0x9')](_0x4316('0x30'),require('./api/voiceMailMessage'));_0x25827b['use'](_0x4316('0x31'),require(_0x4316('0x32')));_0x25827b[_0x4316('0x9')](_0x4316('0x33'),require(_0x4316('0x34')));_0x25827b['use'](_0x4316('0x35'),require(_0x4316('0x36')));_0x25827b[_0x4316('0x9')](_0x4316('0x37'),require(_0x4316('0x38')));_0x25827b[_0x4316('0x9')]('/api/members/reports',require(_0x4316('0x39')));_0x25827b['use'](_0x4316('0x3a'),require('./api/trunk'));_0x25827b[_0x4316('0x9')](_0x4316('0x3b'),require(_0x4316('0x3c')));_0x25827b[_0x4316('0x9')]('/api/mail/out_servers',require(_0x4316('0x3d')));_0x25827b[_0x4316('0x9')]('/api/mail/accounts',require(_0x4316('0x3e')));_0x25827b[_0x4316('0x9')](_0x4316('0x3f'),require('./api/mailQueue'));_0x25827b[_0x4316('0x9')](_0x4316('0x40'),require(_0x4316('0x41')));_0x25827b[_0x4316('0x9')](_0x4316('0x42'),require(_0x4316('0x43')));_0x25827b[_0x4316('0x9')](_0x4316('0x44'),require(_0x4316('0x45')));_0x25827b[_0x4316('0x9')](_0x4316('0x46'),require(_0x4316('0x47')));_0x25827b[_0x4316('0x9')](_0x4316('0x48'),require(_0x4316('0x49')));_0x25827b[_0x4316('0x9')](_0x4316('0x4a'),require(_0x4316('0x4b')));_0x25827b[_0x4316('0x9')](_0x4316('0x4c'),require('./api/dashboardItem'));_0x25827b[_0x4316('0x9')]('/api/fax/accounts',require('./api/faxAccount'));_0x25827b[_0x4316('0x9')](_0x4316('0x4d'),require(_0x4316('0x4e')));_0x25827b['use'](_0x4316('0x4f'),require(_0x4316('0x50')));_0x25827b['use'](_0x4316('0x51'),require('./api/faxMessage'));_0x25827b[_0x4316('0x9')](_0x4316('0x52'),require(_0x4316('0x53')));_0x25827b[_0x4316('0x9')]('/api/fax/reports/queue',require(_0x4316('0x54')));_0x25827b[_0x4316('0x9')](_0x4316('0x55'),require(_0x4316('0x56')));_0x25827b['use'](_0x4316('0x57'),require(_0x4316('0x58')));_0x25827b[_0x4316('0x9')](_0x4316('0x59'),require('./api/smsInteraction'));_0x25827b['use']('/api/sms/messages',require(_0x4316('0x5a')));_0x25827b[_0x4316('0x9')]('/api/sms/queues',require(_0x4316('0x5b')));_0x25827b[_0x4316('0x9')](_0x4316('0x5c'),require('./api/openchannelAccount'));_0x25827b['use'](_0x4316('0x5d'),require(_0x4316('0x5e')));_0x25827b['use']('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x25827b[_0x4316('0x9')](_0x4316('0x5f'),require(_0x4316('0x60')));_0x25827b[_0x4316('0x9')](_0x4316('0x61'),require(_0x4316('0x62')));_0x25827b['use'](_0x4316('0x63'),require(_0x4316('0x64')));_0x25827b[_0x4316('0x9')]('/api/openchannel/reports/queue',require(_0x4316('0x65')));_0x25827b[_0x4316('0x9')](_0x4316('0x66'),require('./api/chatApplication'));_0x25827b[_0x4316('0x9')](_0x4316('0x67'),require(_0x4316('0x68')));_0x25827b[_0x4316('0x9')](_0x4316('0x69'),require(_0x4316('0x6a')));_0x25827b['use'](_0x4316('0x6b'),require(_0x4316('0x6c')));_0x25827b[_0x4316('0x9')](_0x4316('0x6d'),require('./api/chatQueue'));_0x25827b[_0x4316('0x9')]('/api/chat/groups',require('./api/chatGroup'));_0x25827b['use'](_0x4316('0x6e'),require('./api/chatProactiveAction'));_0x25827b[_0x4316('0x9')](_0x4316('0x6f'),require(_0x4316('0x70')));_0x25827b[_0x4316('0x9')](_0x4316('0x71'),require(_0x4316('0x72')));_0x25827b[_0x4316('0x9')](_0x4316('0x73'),require(_0x4316('0x74')));_0x25827b[_0x4316('0x9')]('/api/cm/hopper_black',require(_0x4316('0x75')));_0x25827b['use'](_0x4316('0x76'),require(_0x4316('0x77')));_0x25827b[_0x4316('0x9')](_0x4316('0x78'),require(_0x4316('0x79')));_0x25827b[_0x4316('0x9')]('/api/cm/custom_fields',require(_0x4316('0x7a')));_0x25827b[_0x4316('0x9')](_0x4316('0x7b'),require('./api/action'));_0x25827b['use'](_0x4316('0x7c'),require(_0x4316('0x7d')));_0x25827b['use']('/api/canned_answers',require('./api/cannedAnswer'));_0x25827b[_0x4316('0x9')](_0x4316('0x7e'),require(_0x4316('0x7f')));_0x25827b[_0x4316('0x9')](_0x4316('0x80'),require(_0x4316('0x81')));_0x25827b[_0x4316('0x9')]('/api/intervals',require(_0x4316('0x82')));_0x25827b['use']('/api/pauses',require(_0x4316('0x83')));_0x25827b[_0x4316('0x9')](_0x4316('0x84'),require('./api/cdr'));_0x25827b[_0x4316('0x9')](_0x4316('0x85'),require(_0x4316('0x86')));_0x25827b['use'](_0x4316('0x87'),require('./api/schedule'));_0x25827b[_0x4316('0x9')](_0x4316('0x88'),require(_0x4316('0x89')));_0x25827b['use'](_0x4316('0x8a'),require('./api/tag'));_0x25827b[_0x4316('0x9')](_0x4316('0x8b'),require(_0x4316('0x8c')));_0x25827b[_0x4316('0x9')]('/api/triggers',require('./api/trigger'));_0x25827b[_0x4316('0x9')](_0x4316('0x8d'),require(_0x4316('0x8e')));_0x25827b[_0x4316('0x9')](_0x4316('0x8f'),require('./api/integration'));_0x25827b[_0x4316('0x9')]('/api/integrations/reports',require(_0x4316('0x90')));_0x25827b[_0x4316('0x9')](_0x4316('0x91'),require(_0x4316('0x92')));_0x25827b['use'](_0x4316('0x93'),require('./api/analyticDefaultReport'));_0x25827b['use']('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x25827b[_0x4316('0x9')](_0x4316('0x94'),require(_0x4316('0x95')));_0x25827b['use']('/api/analytics/field_reports',require(_0x4316('0x96')));_0x25827b[_0x4316('0x9')](_0x4316('0x97'),require('./api/analyticTreeReport'));_0x25827b[_0x4316('0x9')](_0x4316('0x98'),require(_0x4316('0x99')));_0x25827b[_0x4316('0x9')](_0x4316('0x9a'),require(_0x4316('0x9b')));_0x25827b['use'](_0x4316('0x9c'),require('./api/intSalesforceField'));_0x25827b[_0x4316('0x9')](_0x4316('0x9d'),require(_0x4316('0x9e')));_0x25827b[_0x4316('0x9')](_0x4316('0x9f'),require('./api/intSugarcrmConfiguration'));_0x25827b[_0x4316('0x9')](_0x4316('0xa0'),require('./api/intSugarcrmField'));_0x25827b[_0x4316('0x9')]('/api/integrations/desk/accounts',require(_0x4316('0xa1')));_0x25827b[_0x4316('0x9')](_0x4316('0xa2'),require(_0x4316('0xa3')));_0x25827b[_0x4316('0x9')](_0x4316('0xa4'),require('./api/intDeskField'));_0x25827b[_0x4316('0x9')]('/api/integrations/zoho/accounts',require(_0x4316('0xa5')));_0x25827b[_0x4316('0x9')](_0x4316('0xa6'),require(_0x4316('0xa7')));_0x25827b[_0x4316('0x9')](_0x4316('0xa8'),require('./api/intZohoField'));_0x25827b[_0x4316('0x9')](_0x4316('0xa9'),require(_0x4316('0xaa')));_0x25827b[_0x4316('0x9')](_0x4316('0xab'),require('./api/intZendeskConfiguration'));_0x25827b[_0x4316('0x9')](_0x4316('0xac'),require('./api/intZendeskField'));_0x25827b[_0x4316('0x9')]('/api/integrations/freshdesk/accounts',require(_0x4316('0xad')));_0x25827b[_0x4316('0x9')](_0x4316('0xae'),require(_0x4316('0xaf')));_0x25827b[_0x4316('0x9')](_0x4316('0xb0'),require(_0x4316('0xb1')));_0x25827b['use'](_0x4316('0xb2'),require(_0x4316('0xb3')));_0x25827b[_0x4316('0x9')]('/api/integrations/vtiger/configurations',require(_0x4316('0xb4')));_0x25827b[_0x4316('0x9')](_0x4316('0xb5'),require('./api/intVtigerField'));_0x25827b['use'](_0x4316('0xb6'),require(_0x4316('0xb7')));_0x25827b[_0x4316('0x9')](_0x4316('0xb8'),require(_0x4316('0xb9')));_0x25827b['use'](_0x4316('0xba'),require(_0x4316('0xbb')));_0x25827b[_0x4316('0x9')](_0x4316('0xbc'),require(_0x4316('0xbd')));_0x25827b['use'](_0x4316('0xbe'),require('./api/intDynamics365Configuration'));_0x25827b['use'](_0x4316('0xbf'),require(_0x4316('0xc0')));_0x25827b[_0x4316('0x9')](_0x4316('0xc1'),require('./api/intFreshsalesAccount'));_0x25827b[_0x4316('0x9')]('/api/integrations/freshsales/configurations',require(_0x4316('0xc2')));_0x25827b['use'](_0x4316('0xc3'),require(_0x4316('0xc4')));_0x25827b['use'](_0x4316('0xc5'),require(_0x4316('0xc6')));_0x25827b[_0x4316('0x9')](_0x4316('0xc7'),require(_0x4316('0xc8')));_0x25827b[_0x4316('0x9')](_0x4316('0xc9'),require(_0x4316('0xca')));_0x25827b[_0x4316('0x9')]('/api/jscripty/answers/reports',require(_0x4316('0xcb')));_0x25827b[_0x4316('0x9')](_0x4316('0xcc'),require('./api/jscriptyQuestionReport'));_0x25827b['use']('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x25827b[_0x4316('0x9')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x25827b['use'](_0x4316('0xcd'),require(_0x4316('0xce')));_0x25827b[_0x4316('0x9')](_0x4316('0xcf'),require(_0x4316('0xd0')));_0x25827b[_0x4316('0x9')]('/api/jscripty/projects',require(_0x4316('0xd1')));_0x25827b[_0x4316('0x9')](_0x4316('0xd2'),require('./api/setting'));_0x25827b[_0x4316('0x9')]('/api/square/odbc',require(_0x4316('0xd3')));_0x25827b[_0x4316('0x9')](_0x4316('0xd4'),require(_0x4316('0xd5')));_0x25827b[_0x4316('0x9')]('/api/square/recordings',require(_0x4316('0xd6')));_0x25827b[_0x4316('0x9')](_0x4316('0xd7'),require('./api/squareMessage'));_0x25827b[_0x4316('0x9')]('/api/teams',require(_0x4316('0xd8')));_0x25827b['use'](_0x4316('0xd9'),require(_0x4316('0xda')));_0x25827b[_0x4316('0x9')](_0x4316('0xdb'),require(_0x4316('0xdc')));_0x25827b[_0x4316('0x9')]('/api/migrations',require('./api/migration'));_0x25827b[_0x4316('0x9')]('/api/attachments',require(_0x4316('0xdd')));_0x25827b[_0x4316('0x9')](_0x4316('0xde'),require('./api/plugin'));_0x25827b['use'](_0x4316('0xdf'),require(_0x4316('0xe0')));_0x25827b[_0x4316('0x9')](_0x4316('0xe1'),require(_0x4316('0xe2')));_0x25827b[_0x4316('0x9')]('/api/fax/reports/transfer',require(_0x4316('0xe3')));_0x25827b[_0x4316('0x9')]('/api/openchannel/reports/transfer',require(_0x4316('0xe4')));_0x25827b[_0x4316('0x9')]('/api/sms/reports/transfer',require(_0x4316('0xe5')));_0x25827b['use'](_0x4316('0xe6'),require(_0x4316('0xe7')));_0x25827b[_0x4316('0x9')](_0x4316('0xe8'),require('./api/voicePrefix'));_0x25827b[_0x4316('0x9')](_0x4316('0xe9'),require(_0x4316('0xea')));_0x25827b[_0x4316('0x9')](_0x4316('0xeb'),require(_0x4316('0xec')));_0x25827b[_0x4316('0x9')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x25827b[_0x4316('0x9')](_0x4316('0xed'),require(_0x4316('0xee')));_0x25827b[_0x4316('0x9')]('/api/userNotifications',require(_0x4316('0xef')));_0x25827b['use']('/api/whatsapp/accounts',require(_0x4316('0xf0')));_0x25827b[_0x4316('0x9')](_0x4316('0xf1'),require('./api/whatsappApplication'));_0x25827b[_0x4316('0x9')](_0x4316('0xf2'),require(_0x4316('0xf3')));_0x25827b[_0x4316('0x9')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x25827b[_0x4316('0x9')](_0x4316('0xf4'),require(_0x4316('0xf5')));_0x25827b['use'](_0x4316('0xf6'),require(_0x4316('0xf7')));_0x25827b[_0x4316('0x9')](_0x4316('0xf8'),require(_0x4316('0xf9')));_0x25827b[_0x4316('0x9')](_0x4316('0xfa'),require(_0x4316('0xfb')));_0x25827b[_0x4316('0x9')](_0x4316('0xfc'),require('./api/authLocal'));_0x25827b[_0x4316('0x9')](_0x4316('0xfd'),require('./api/authGoogle'));_0x25827b['use'](_0x4316('0xfe'),require(_0x4316('0xff')));_0x25827b[_0x4316('0x9')]('/api/rpc',require(_0x4316('0x100')));_0x25827b[_0x4316('0x9')](_0x4316('0x101'),require(_0x4316('0x102')));_0x25827b[_0x4316('0x9')](_0x4316('0x103'),require(_0x4316('0x104')));_0x25827b[_0x4316('0x9')](_0x4316('0x105'),require(_0x4316('0x106')));_0x25827b['use'](_0x4316('0x107'),require(_0x4316('0x108')));_0x25827b['use'](_0x4316('0x109'),express[_0x4316('0x10a')](path[_0x4316('0x10b')](config[_0x4316('0x10c')],_0x4316('0x109'))));_0x25827b[_0x4316('0x9')](_0x4316('0x10d'),express['static'](path['join'](config['root'],_0x4316('0x10d'))));_0x25827b[_0x4316('0x9')](_0x4316('0x10e'),express[_0x4316('0x10a')](path[_0x4316('0x10b')](config[_0x4316('0x10c')],_0x4316('0x10e'))));_0x25827b[_0x4316('0x9')]('/snippet',express[_0x4316('0x10a')](path[_0x4316('0x10b')](config[_0x4316('0x10c')],_0x4316('0x10f'),_0x4316('0x110'))));_0x25827b['use'](_0x4316('0x111'),express[_0x4316('0x10a')](path[_0x4316('0x10b')](config['root'],'/server/files/plugins')));_0x25827b[_0x4316('0x112')](_0x4316('0x113'))[_0x4316('0x114')](errors[0x194]);_0x25827b[_0x4316('0x112')]('/*')[_0x4316('0x114')](function(_0x5b43d8,_0x3c8acf){_0x3c8acf[_0x4316('0x115')](path[_0x4316('0x116')](_0x25827b[_0x4316('0x114')](_0x4316('0x117'))+_0x4316('0x118')));});};var sensitiveFields=[_0x4316('0x119'),_0x4316('0x11a'),'newPassword',_0x4316('0x11b'),_0x4316('0x11c'),_0x4316('0x11d'),_0x4316('0x11e'),_0x4316('0x11f'),_0x4316('0x120'),_0x4316('0x121'),_0x4316('0x122'),_0x4316('0x123'),_0x4316('0x124'),_0x4316('0x125'),'code',_0x4316('0x126'),_0x4316('0x127'),_0x4316('0x128'),_0x4316('0x129'),_0x4316('0x12a'),'accessTokenSecret',_0x4316('0x12b'),_0x4316('0x12c'),_0x4316('0x12d'),_0x4316('0x12e'),'calleridname',_0x4316('0x12f'),_0x4316('0x130'),_0x4316('0x131'),_0x4316('0x132'),_0x4316('0x133'),_0x4316('0x134'),_0x4316('0x135'),_0x4316('0x136'),_0x4316('0x16'),_0x4316('0x137'),_0x4316('0x138'),_0x4316('0x139'),'dsn','secret',_0x4316('0x13a'),_0x4316('0x13b')];function maskSensitiveData(_0x40aa22){var _0x144304=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x40aa22))return;for(var _0x2da8df in _0x40aa22){if(_[_0x4316('0x13c')](_0x40aa22[_0x2da8df])){for(var _0x2682a7=0x0;_0x2682a7<_0x40aa22[_0x2da8df][_0x4316('0x13d')];_0x2682a7++){maskSensitiveData(_0x40aa22[_0x2da8df][_0x2682a7]);}}else if(_[_0x4316('0x13e')](_0x40aa22[_0x2da8df])){maskSensitiveData(_0x40aa22[_0x2da8df]);}else if(_[_0x4316('0x13f')](_0x40aa22[_0x2da8df])){_0x40aa22[_0x2da8df]=_0x40aa22[_0x2da8df]['replace'](/{{{/g,'@@{')[_0x4316('0x140')](/}}}/g,'}@@')[_0x4316('0x140')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x2da8df)){_0x40aa22[_0x2da8df]=_0x40aa22[_0x2da8df]['replace'](_0x144304,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3c0d85c..b4983b0 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c87=['../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/user/user.rpc','../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/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc'];(function(_0x53c68,_0x375dc8){var _0x7b161f=function(_0x28e8a3){while(--_0x28e8a3){_0x53c68['push'](_0x53c68['shift']());}};_0x7b161f(++_0x375dc8);}(_0x8c87,0x1e3));var _0x78c8=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x8c87[_0xf50820];return _0x2a9b10;};'use strict';var jayson=require(_0x78c8('0x0'));var BPromise=require(_0x78c8('0x1'));var _=require(_0x78c8('0x2'));var config=require('../config/environment');exports[_0x78c8('0x3')]=function(){return new BPromise(function(_0x28fec8,_0x4f9235){var _0xe15709={};_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x5')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x6')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x7')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x8')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x9')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require('../api/voiceDialReport/voiceDialReport.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0xa')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0xb')));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0xc')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0xd')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0xe')));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0xf')));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0x10')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x11')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x12')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require('../api/mailInteraction/mailInteraction.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x13')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x14')));_0xe15709=_['merge'](_0xe15709,require('../api/mailQueueReport/mailQueueReport.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x15')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x16')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x17')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x18')));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0x19')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require('../api/faxQueueReport/faxQueueReport.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x1a')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x1b')));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0x1c')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require('../api/smsQueue/smsQueue.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x1d')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x1e')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x1f')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x20')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x21')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require('../api/chatInteraction/chatInteraction.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require('../api/chatMessage/chatMessage.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x22')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require('../api/cmContact/cmContact.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x23')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x24')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x25')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x26')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x27')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x28')));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0x29')));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0x2a')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require('../api/variable/variable.rpc'));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0x2b')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x2c')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x2d')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x2e')));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0x2f')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x30')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x31')));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0x32')));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0x33')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x34')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x35')));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0x36')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x37')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x38')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x39')));_0xe15709=_['merge'](_0xe15709,require('../api/squareRecording/squareRecording.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x3a')));_0xe15709=_['merge'](_0xe15709,require(_0x78c8('0x3b')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x3c')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x3d')));_0xe15709=_['merge'](_0xe15709,require('../api/whatsappAccount/whatsappAccount.rpc'));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x3e')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x3f')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require(_0x78c8('0x40')));_0xe15709=_[_0x78c8('0x4')](_0xe15709,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x885d7f=jayson[_0x78c8('0x41')](_0xe15709)[_0x78c8('0x42')]();var _0xc9c7cc=config[_0x78c8('0x43')]['port']||config[_0x78c8('0x44')]+0x1;var _0x178dcc=config[_0x78c8('0x43')]['ip']||_0x78c8('0x45');_0x885d7f['on']('error',function(_0x39e3cb){return _0x4f9235(_0x39e3cb);});_0x885d7f[_0x78c8('0x3')](_0xc9c7cc,_0x178dcc,function(){console[_0x78c8('0x46')](_0x78c8('0x47'),_0x178dcc,_0xc9c7cc);require(_0x78c8('0x48'))[_0x78c8('0x49')]();return _0x28fec8(_0x78c8('0x4a')+_0x178dcc+':'+_0xc9c7cc);});});}; \ No newline at end of file +var _0x807d=['jayson/promise','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.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/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','server','http','rpc','port','error','listen','../config/triggers','RPC\x20listening\x20on\x20'];(function(_0xf96ff1,_0x1db6e7){var _0x1f4042=function(_0x3914ea){while(--_0x3914ea){_0xf96ff1['push'](_0xf96ff1['shift']());}};_0x1f4042(++_0x1db6e7);}(_0x807d,0x86));var _0xd807=function(_0x10a039,_0x313dd3){_0x10a039=_0x10a039-0x0;var _0x1330ab=_0x807d[_0x10a039];return _0x1330ab;};'use strict';var jayson=require(_0xd807('0x0'));var BPromise=require('bluebird');var _=require('lodash');var config=require(_0xd807('0x1'));exports['listen']=function(){return new BPromise(function(_0x403a3f,_0x5b4682){var _0x362b70={};_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/user/user.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x3')));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0x4')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x5')));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0x6')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x7')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x8')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x9')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/memberReport/memberReport.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0xa')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0xb')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0xc')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0xd')));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0xe')));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0xf')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/mailMessage/mailMessage.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x10')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0x11')));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0x12')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/faxInteraction/faxInteraction.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/faxMessage/faxMessage.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x13')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x14')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/smsAccount/smsAccount.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x15')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x16')));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0x17')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x18')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x19')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x1a')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x1b')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x1c')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x1d')));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0x1e')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x1f')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x20')));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0x21')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x22')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x23')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x24')));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0x25')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x26')));_0x362b70=_['merge'](_0x362b70,require('../api/sound/sound.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x27')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x28')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x29')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x2a')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0x2b')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x2c')));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0x2d')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x2e')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x2f')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x30')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x31')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x32')));_0x362b70=_['merge'](_0x362b70,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/squareReport/squareReport.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x33')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/squareOdbc/squareOdbc.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x34')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x35')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x36')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/campaign/campaign.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x37')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x38')));_0x362b70=_[_0xd807('0x2')](_0x362b70,require(_0xd807('0x39')));_0x362b70=_['merge'](_0x362b70,require(_0xd807('0x3a')));_0x362b70=_['merge'](_0x362b70,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x362b70=_['merge'](_0x362b70,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x362b70=_[_0xd807('0x2')](_0x362b70,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x56517a=jayson[_0xd807('0x3b')](_0x362b70)[_0xd807('0x3c')]();var _0x4454ca=config[_0xd807('0x3d')]['port']||config[_0xd807('0x3e')]+0x1;var _0x18fa1d=config['rpc']['ip']||'localhost';_0x56517a['on'](_0xd807('0x3f'),function(_0x42586f){return _0x5b4682(_0x42586f);});_0x56517a[_0xd807('0x40')](_0x4454ca,_0x18fa1d,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x18fa1d,_0x4454ca);require(_0xd807('0x41'))['default']();return _0x403a3f(_0xd807('0x42')+_0x18fa1d+':'+_0x4454ca);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index dba4db9..098d5b1 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 _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(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'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 +var _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0x446cf2,_0x188dd2){var _0xcf823d=function(_0xa12400){while(--_0xa12400){_0x446cf2['push'](_0x446cf2['shift']());}};_0xcf823d(++_0x188dd2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 7de274f..e31dafe 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 _0x7884=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[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','message','exports','util'];(function(_0x42235f,_0x5dabfd){var _0x3f5fab=function(_0x358fd7){while(--_0x358fd7){_0x42235f['push'](_0x42235f['shift']());}};_0x3f5fab(++_0x5dabfd);}(_0x7884,0x10d));var _0x4788=function(_0x4fbb3e,_0x55785f){_0x4fbb3e=_0x4fbb3e-0x0;var _0x1eb197=_0x7884[_0x4fbb3e];return _0x1eb197;};'use strict';var util=require(_0x4788('0x0'));var error={'E_AGI_UNDEFINED':_0x4788('0x1'),'E_AGI_ARGUMENT_PORT':_0x4788('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x4788('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x4788('0x4'),'E_AGI_SOCKET_ERROR':_0x4788('0x5'),'E_AGI_SOCKET_CLOSE':_0x4788('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x4788('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x4788('0x8'),'E_AGI_IVR_ENTRY':_0x4788('0x9')};function AGIError(_0xaf9370){var _0xaf9370=_0xaf9370||null,_0x47916e=_0x47916e||[],_0x796e6f=0x1,_0x4e910b='';if(!error[_0xaf9370]){_0xaf9370=_0x4788('0xa');}_0x47916e[_0x4788('0xb')](error[_0xaf9370]);while(arguments[_0x796e6f]){_0x47916e['push'](arguments[_0x796e6f]);_0x796e6f++;}_0x4e910b=util[_0x4788('0xc')]['apply'](util,_0x47916e);this[_0x4788('0xd')]=_0x4e910b;this['name']=_0xaf9370;}module[_0x4788('0xe')]=AGIError; \ No newline at end of file +var _0x2f72=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','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\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(_0x56eb47,_0x5f0a82){var _0x534c27=function(_0x2069db){while(--_0x2069db){_0x56eb47['push'](_0x56eb47['shift']());}};_0x534c27(++_0x5f0a82);}(_0x2f72,0x166));var _0x22f7=function(_0x592f6c,_0x2a9d7b){_0x592f6c=_0x592f6c-0x0;var _0xf762e8=_0x2f72[_0x592f6c];return _0xf762e8;};'use strict';var util=require(_0x22f7('0x0'));var error={'E_AGI_UNDEFINED':_0x22f7('0x1'),'E_AGI_ARGUMENT_PORT':_0x22f7('0x2'),'E_AGI_SERVER_ERROR':_0x22f7('0x3'),'E_AGI_SERVER_CLOSE':_0x22f7('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x22f7('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x22f7('0x6'),'E_AGI_SOCKET_ERROR':_0x22f7('0x7'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x22f7('0x8'),'E_AGI_COMMAND_EMPTY':_0x22f7('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x22f7('0xa'),'E_AGI_IVR_ENTRY':_0x22f7('0xb')};function AGIError(_0xd85654){var _0xd85654=_0xd85654||null,_0x46195a=_0x46195a||[],_0x1ad8d1=0x1,_0x261813='';if(!error[_0xd85654]){_0xd85654=_0x22f7('0xc');}_0x46195a[_0x22f7('0xd')](error[_0xd85654]);while(arguments[_0x1ad8d1]){_0x46195a[_0x22f7('0xd')](arguments[_0x1ad8d1]);_0x1ad8d1++;}_0x261813=util[_0x22f7('0xe')][_0x22f7('0xf')](util,_0x46195a);this[_0x22f7('0x10')]=_0x261813;this[_0x22f7('0x11')]=_0xd85654;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 099a589..667bf06 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 _0xa902=['getdigits','vertices','prototype','addVertex','edges','push','numberOfEdges','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','exports','lodash','../../../config/logger','agi','menu'];(function(_0x477051,_0x1607ea){var _0x4b05b0=function(_0x586247){while(--_0x586247){_0x477051['push'](_0x477051['shift']());}};_0x4b05b0(++_0x1607ea);}(_0xa902,0x8d));var _0x2a90=function(_0x59d980,_0x1f2185){_0x59d980=_0x59d980-0x0;var _0x505478=_0xa902[_0x59d980];return _0x505478;};'use strict';var _=require(_0x2a90('0x0'));var logger=require(_0x2a90('0x1'))(_0x2a90('0x2'));var verticesWithRetry=[_0x2a90('0x3'),_0x2a90('0x4'),'getsecretdigits'];var Graph=function(){this[_0x2a90('0x5')]={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0x2a90('0x6')][_0x2a90('0x7')]=function(_0x203ecf){this[_0x2a90('0x5')][_0x203ecf['id']]=_0x203ecf;this[_0x2a90('0x8')][_0x203ecf['id']]=[];};Graph[_0x2a90('0x6')]['addEdge']=function(_0x4109e6,_0x570659,_0x5ec2b9){this[_0x2a90('0x8')][_0x4109e6][_0x2a90('0x9')]({'target':_0x570659,'condition':_0x5ec2b9});this[_0x2a90('0xa')]+=0x1;};Graph[_0x2a90('0x6')][_0x2a90('0xb')]=function(){return _['size'](this[_0x2a90('0x5')]);};Graph[_0x2a90('0x6')][_0x2a90('0xc')]=function(){return this[_0x2a90('0xa')];};Graph['prototype'][_0x2a90('0xd')]=function(_0x52391c){return this[_0x2a90('0x5')][_0x52391c];};Graph['prototype'][_0x2a90('0xe')]=function(_0x57aee3,_0x407ce5){if(!this[_0x2a90('0x5')][_0x57aee3]){return logger[_0x2a90('0xf')]('no\x20vertex\x20found');}var _0x56d1b8=_0x407ce5(this['vertices'][_0x57aee3]);if(!_0x56d1b8){return logger[_0x2a90('0xf')](_0x2a90('0x10'));}if(this['edges'][_0x57aee3][_0x2a90('0x11')]===0x0){return logger[_0x2a90('0xf')](_0x2a90('0x12'));}for(var _0x25bd0e=0x0,_0x3200b4=[],_0x37858e=![];_0x25bd0e\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','vertex','[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','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','lodash','syncho','moment','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','error','stack','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','calleridname','callerid','toJson','mxGraphModel','root','hasOwnProperty','retry','omit','isArray','length','source','target','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','hangup','sync','production','start','debug','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x84e7,0x122));var _0x784e=function(_0x161450,_0x62612){_0x161450=_0x161450-0x0;var _0x222835=_0x84e7[_0x161450];return _0x222835;};'use strict';var parser=require('xml2json');var _=require(_0x784e('0x0'));var syncho=require(_0x784e('0x1'));var util=require('util');var moment=require(_0x784e('0x2'));var config=require(_0x784e('0x3'));var logger=require('../../config/logger')(_0x784e('0x4'));var utilLicense=require(_0x784e('0x5'));var rpc=require(_0x784e('0x6'));var mailRpc=require(_0x784e('0x7'));var Graph=require(_0x784e('0x8'));var Vertices=require(_0x784e('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x784e('0xa')](config['agi'],{'ip':_0x784e('0xb'),'port':0x11dd});function connectionHandler(_0x24654d){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x24654d);agiHandler(_0x24654d);}catch(_0x18be55){logger[_0x784e('0xc')](_0x18be55[_0x784e('0xd')]);}});});}function listeningHandler(){console[_0x784e('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x784e('0xf')]);logger[_0x784e('0x10')](util[_0x784e('0x11')](_0x784e('0x12'),config['agi']['ip'],config[_0x784e('0x4')][_0x784e('0xf')]));}function errorHandler(_0x37ec58){if(_0x37ec58&&_0x37ec58[_0x784e('0x13')]&&_0x37ec58[_0x784e('0x14')]){logger[_0x784e('0xc')](util['format'](_0x784e('0x15'),_0x37ec58['name'],_0x37ec58[_0x784e('0x14')]));}else{logger[_0x784e('0xc')](util[_0x784e('0x11')](_0x784e('0x16'),_0x37ec58[_0x784e('0xd')]));}}function closeHandler(){logger[_0x784e('0x10')](util[_0x784e('0x11')](_0x784e('0x17'),this[_0x784e('0x18')],this['calleridname'],this['callerid'],this[_0x784e('0x19')],this[_0x784e('0x1a')]));try{createSquareReport(this);}catch(_0x3b7d6a){logger[_0x784e('0xc')](_0x3b7d6a[_0x784e('0xd')]);}}function timeoutHandler(){logger[_0x784e('0x10')](util[_0x784e('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x784e('0x18')],this[_0x784e('0x1b')],this[_0x784e('0x1c')],this[_0x784e('0x19')],this[_0x784e('0x1a')]));}function hangupHandler(){logger[_0x784e('0x10')](util[_0x784e('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x784e('0x1b')],this['callerid'],this[_0x784e('0x19')],this[_0x784e('0x1a')]));this['evtHangup']=!![];}function getRoot(_0x544a1b){return parser[_0x784e('0x1d')](_0x544a1b,{'object':!![]})[_0x784e('0x1e')][_0x784e('0x1f')];}function addVertex(_0xfc37fb,_0x51f452,_0x4fab06){_0x51f452['agicommand']=_0x4fab06;if(_0x51f452[_0x784e('0x20')](_0x784e('0x21'))){_0x51f452['maxRetry']=parseInt(_0x51f452[_0x784e('0x21')],0xa);}_0xfc37fb['addVertex'](_[_0x784e('0x22')](_0x51f452,'mxCell'));}function initGraph(_0x94a91b,_0x103a90){var _0x277101=new Graph();for(var _0x7de85b in _0x94a91b){if(_0x94a91b['hasOwnProperty'](_0x7de85b)){if(_[_0x784e('0x23')](_0x94a91b[_0x7de85b])){for(var _0x2242e6=0x0;_0x2242e6<_0x94a91b[_0x7de85b][_0x784e('0x24')];_0x2242e6+=0x1){addVertex(_0x277101,_0x94a91b[_0x7de85b][_0x2242e6],_0x7de85b);}}else{addVertex(_0x277101,_0x94a91b[_0x7de85b],_0x7de85b);}}}for(var _0x2def08=0x0;_0x2def08<_0x103a90['length'];_0x2def08+=0x1){if(_0x103a90[_0x2def08][_0x784e('0x25')]&&_0x103a90[_0x2def08][_0x784e('0x26')]){_0x277101['addEdge'](_0x103a90[_0x2def08]['source'],_0x103a90[_0x2def08][_0x784e('0x26')],_0x103a90[_0x2def08][_0x784e('0x27')]);}}return _0x277101;}function getSquareProject(_0x17a278,_0x296b12){rpc[_0x784e('0x28')](_0x17a278)[_0x784e('0x29')](function(_0x150757){_0x296b12(null,_0x150757);})[_0x784e('0x2a')](function(_0x42bdfb){_0x296b12(null,_0x42bdfb);});}function createSquareReport(_0x2e18d6,_0x328b70){rpc[_0x784e('0x2b')](_0x2e18d6)[_0x784e('0x29')](function(_0x30fdc6){if(_0x328b70){_0x328b70(null,_0x30fdc6);}})[_0x784e('0x2a')](function(_0x5348e7){if(_0x328b70){_0x328b70(null,_0x5348e7);}});}function setChannelVariables(_0x32e399){for(var _0x4ea50b in _0x32e399){if(_0x32e399[_0x784e('0x20')](_0x4ea50b)){if(_0x4ea50b[_0x784e('0x2c')](_0x784e('0x2d'))===0x0){_0x32e399[_0x4ea50b['substring'](0x4)]=_0x32e399[_0x4ea50b];delete _0x32e399[_0x4ea50b];}}}}function getLogFromObject(_0x18d8f4){return util['inspect'](_0x18d8f4,{'showHidden':![],'depth':null});}function agiHandler(_0x1fa9e2){var _0x3525d6,_0x4fc7b3,_0x23b3b0,_0x287f3e,_0x4ffad7;logger['debug'](_0x784e('0x2e'),JSON[_0x784e('0x2f')](_0x1fa9e2,null,0x2));logger[_0x784e('0x10')](util[_0x784e('0x11')](_0x784e('0x30'),_0x1fa9e2['arg_1'],_0x1fa9e2[_0x784e('0x1b')],_0x1fa9e2[_0x784e('0x1c')],_0x1fa9e2['dnid'],_0x1fa9e2[_0x784e('0x1a')]));_0x1fa9e2['on']('error',errorHandler);_0x1fa9e2['on']('close',closeHandler);_0x1fa9e2['on']('timeout',timeoutHandler);_0x1fa9e2[_0x784e('0x31')]=![];_0x1fa9e2['on'](_0x784e('0x32'),hangupHandler);var _0x5aa239=getSquareProject[_0x784e('0x33')](null,_0x1fa9e2[_0x784e('0x18')]);if(_0x5aa239){if(_0x5aa239[_0x784e('0x34')]){_0x3525d6=getRoot(_0x5aa239[_0x784e('0x34')]);if(_0x3525d6&&_0x3525d6[_0x784e('0x35')]){logger[_0x784e('0x36')]('root',JSON['stringify'](_0x3525d6,null,0x2));_0x1fa9e2[_0x784e('0x37')]=moment()[_0x784e('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4fc7b3=initGraph(_['omit'](_0x3525d6,'mxCell'),_0x3525d6[_0x784e('0x38')]);_0x23b3b0=new Vertices(_0x1fa9e2,rpc,mailRpc);logger[_0x784e('0x10')](util['format'](_0x784e('0x39'),_0x1fa9e2[_0x784e('0x18')],_0x1fa9e2[_0x784e('0x1b')],_0x1fa9e2['callerid'],_0x1fa9e2[_0x784e('0x19')],_0x1fa9e2['uniqueid']));_0x4fc7b3[_0x784e('0x3a')](_0x3525d6['start']['id'],function(_0x412ef4){try{_0x412ef4=_0x23b3b0[_0x784e('0x3b')](_0x412ef4);logger['debug']('vertex',JSON[_0x784e('0x2f')](_0x412ef4,null,0x2));if(_0x412ef4[_0x784e('0x3c')]===_0x784e('0x3d')){logger['info'](_0x784e('0x3e'));_0x1fa9e2[_0x784e('0x3f')]=_0x412ef4[_0x784e('0x3f')]||_0x1fa9e2[_0x784e('0x3f')];_0x1fa9e2['extension']=_0x412ef4[_0x784e('0x40')];_0x1fa9e2[_0x784e('0x41')]=_0x412ef4['priority']?_0x412ef4['priority']-0x1:0x1;return null;}else if(_0x412ef4&&_0x23b3b0[_0x412ef4[_0x784e('0x3c')]]){_0x4ffad7=_0x23b3b0[_0x412ef4[_0x784e('0x3c')]](_0x412ef4);logger[_0x784e('0x10')](_0x784e('0x42'),JSON[_0x784e('0x2f')](_0x4ffad7,null,0x2));if(_0x4ffad7&&_0x4ffad7['code']===AGI_CODE_SUCCESS&&_0x4ffad7['result']!==AGI_RESULT_ERROR&&!_0x1fa9e2['evtHangup']){logger[_0x784e('0x36')](_0x784e('0x42'),getLogFromObject(_0x4ffad7));return _[_0x784e('0x43')](_0x4ffad7[_0x784e('0x44')])?null:_0x4ffad7[_0x784e('0x44')]['toString']();}else{logger['error']('response',getLogFromObject(_0x4ffad7));return null;}}else{logger[_0x784e('0xc')](_0x784e('0x45'));return null;}}catch(_0x4c637a){logger[_0x784e('0xc')](_0x4c637a[_0x784e('0xd')]);return null;}});if(_0x3525d6['finally']){logger[_0x784e('0x10')](util[_0x784e('0x11')](_0x784e('0x46'),_0x1fa9e2[_0x784e('0x18')],_0x1fa9e2[_0x784e('0x1b')],_0x1fa9e2[_0x784e('0x1c')],_0x1fa9e2[_0x784e('0x19')],_0x1fa9e2[_0x784e('0x1a')]));_0x4fc7b3['traverseBFS'](_0x3525d6[_0x784e('0x47')]['id'],function(_0x1a4969){try{_0x1a4969=_0x23b3b0['clear'](_0x1a4969);logger[_0x784e('0x36')](_0x784e('0x48'),JSON[_0x784e('0x2f')](_0x1a4969,null,0x2));if(_0x1a4969&&_0x23b3b0[_0x1a4969[_0x784e('0x3c')]]){_0x4ffad7=_0x23b3b0[_0x1a4969[_0x784e('0x3c')]](_0x1a4969);if(_0x4ffad7){logger[_0x784e('0x36')](_0x784e('0x42'),getLogFromObject(_0x4ffad7));return _[_0x784e('0x43')](_0x4ffad7[_0x784e('0x44')])?null:_0x4ffad7[_0x784e('0x44')]['toString']();}else{logger[_0x784e('0xc')](_0x784e('0x42'),getLogFromObject(_0x4ffad7));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0xdc779c){logger['error'](_0xdc779c[_0x784e('0xd')]);return null;}});}logger['info'](util[_0x784e('0x11')](_0x784e('0x49'),_0x1fa9e2[_0x784e('0x18')],_0x1fa9e2[_0x784e('0x1b')],_0x1fa9e2['callerid'],_0x1fa9e2['dnid'],_0x1fa9e2[_0x784e('0x1a')]));logger[_0x784e('0x10')](util[_0x784e('0x11')](_0x784e('0x4a'),_0x1fa9e2[_0x784e('0x3f')],_0x1fa9e2['extension'],parseInt(_0x1fa9e2['priority'],0xa)+0x1));_0x1fa9e2[_0x784e('0x4b')](_0x1fa9e2[_0x784e('0x3f')],_0x1fa9e2['extension'],parseInt(_0x1fa9e2[_0x784e('0x41')],0xa)+0x1);_0x1fa9e2[_0x784e('0x4c')]();}}else{logger['error'](util[_0x784e('0x11')](_0x784e('0x4d'),_0x1fa9e2[_0x784e('0x18')]));_0x1fa9e2[_0x784e('0x4b')](_0x1fa9e2['context'],_0x1fa9e2['extension'],parseInt(_0x1fa9e2[_0x784e('0x41')],0xa)+0x1);_0x1fa9e2['close']();}}else{logger['error'](util[_0x784e('0x11')](_0x784e('0x4e'),_0x1fa9e2[_0x784e('0x18')]));_0x1fa9e2[_0x784e('0x4b')](_0x1fa9e2[_0x784e('0x3f')],_0x1fa9e2[_0x784e('0x40')],parseInt(_0x1fa9e2[_0x784e('0x41')],0xa)+0x1);_0x1fa9e2['close']();}}function main(){var _0x3b79ee;return utilLicense[_0x784e('0x4f')]()['then'](function(_0x52b19f){if(_0x52b19f){if(_0x52b19f['voice']){if(_0x52b19f[_0x784e('0x50')]&&_0x52b19f[_0x784e('0x50')]>0x0){logger[_0x784e('0x10')](util[_0x784e('0x11')](_0x784e('0x51'),_0x52b19f['callysquare']));_0x3b79ee=_0x52b19f[_0x784e('0x50')];}else{logger[_0x784e('0x10')](_0x784e('0x52'));}}else{logger[_0x784e('0x10')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x3b79ee=-0x1;}}})[_0x784e('0x2a')](function(_0x5bccc1){logger[_0x784e('0xc')](_0x784e('0x53'),_0x5bccc1[_0x784e('0xd')]);})[_0x784e('0x47')](function(){var _0x4e143a=require(_0x784e('0x54'))(config['agi'][_0x784e('0xf')],config['agi']['ip'],_0x3b79ee);_0x4e143a['on'](_0x784e('0xc'),errorHandler);_0x4e143a['on'](_0x784e('0x55'),listeningHandler);_0x4e143a['on'](_0x784e('0x56'),connectionHandler);_0x4e143a['on'](_0x784e('0x4c'),closeHandler);});}main(); \ No newline at end of file +var _0x885a=['context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','calleridname','finally','clear','isUndefined','[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','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','./server','listening','connection','lodash','syncho','util','moment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','defaults','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','error','[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','root','agicommand','retry','maxRetry','addVertex','mxCell','hasOwnProperty','isArray','length','source','target','value','getSquareProject','then','catch','indexOf','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x885a,0x180));var _0xa885=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x885a[_0x2be8c2];return _0x97f531;};'use strict';var parser=require('xml2json');var _=require(_0xa885('0x0'));var syncho=require(_0xa885('0x1'));var util=require(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var config=require('../../config/environment');var logger=require(_0xa885('0x4'))(_0xa885('0x5'));var utilLicense=require(_0xa885('0x6'));var rpc=require(_0xa885('0x7'));var mailRpc=require(_0xa885('0x8'));var Graph=require(_0xa885('0x9'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xa885('0x5')]=_[_0xa885('0xa')](config[_0xa885('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x6b26e2){process[_0xa885('0xb')](function(){syncho(function(){try{setChannelVariables(_0x6b26e2);agiHandler(_0x6b26e2);}catch(_0x38df93){logger['error'](_0x38df93[_0xa885('0xc')]);}});});}function listeningHandler(){console[_0xa885('0xd')](_0xa885('0xe'),config[_0xa885('0x5')][_0xa885('0xf')]);logger[_0xa885('0x10')](util[_0xa885('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xa885('0x5')]['ip'],config[_0xa885('0x5')][_0xa885('0xf')]));}function errorHandler(_0x229b38){if(_0x229b38&&_0x229b38[_0xa885('0x12')]&&_0x229b38[_0xa885('0x13')]){logger[_0xa885('0x14')](util['format'](_0xa885('0x15'),_0x229b38[_0xa885('0x12')],_0x229b38[_0xa885('0x13')]));}else{logger[_0xa885('0x14')](util[_0xa885('0x11')]('[ERROR]\x20%s',_0x229b38[_0xa885('0xc')]));}}function closeHandler(){logger[_0xa885('0x10')](util['format'](_0xa885('0x16'),this[_0xa885('0x17')],this['calleridname'],this[_0xa885('0x18')],this[_0xa885('0x19')],this['uniqueid']));try{createSquareReport(this);}catch(_0x20a206){logger['error'](_0x20a206[_0xa885('0xc')]);}}function timeoutHandler(){logger[_0xa885('0x10')](util[_0xa885('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xa885('0x17')],this['calleridname'],this[_0xa885('0x18')],this[_0xa885('0x19')],this[_0xa885('0x1a')]));}function hangupHandler(){logger['info'](util[_0xa885('0x11')](_0xa885('0x1b'),this[_0xa885('0x17')],this['calleridname'],this[_0xa885('0x18')],this[_0xa885('0x19')],this[_0xa885('0x1a')]));this['evtHangup']=!![];}function getRoot(_0x303830){return parser['toJson'](_0x303830,{'object':!![]})[_0xa885('0x1c')][_0xa885('0x1d')];}function addVertex(_0x5d2b43,_0x1d94c1,_0x190a57){_0x1d94c1[_0xa885('0x1e')]=_0x190a57;if(_0x1d94c1['hasOwnProperty'](_0xa885('0x1f'))){_0x1d94c1[_0xa885('0x20')]=parseInt(_0x1d94c1['retry'],0xa);}_0x5d2b43[_0xa885('0x21')](_['omit'](_0x1d94c1,_0xa885('0x22')));}function initGraph(_0x526ba9,_0x1a28d6){var _0x110e63=new Graph();for(var _0x3e347e in _0x526ba9){if(_0x526ba9[_0xa885('0x23')](_0x3e347e)){if(_[_0xa885('0x24')](_0x526ba9[_0x3e347e])){for(var _0x410968=0x0;_0x410968<_0x526ba9[_0x3e347e][_0xa885('0x25')];_0x410968+=0x1){addVertex(_0x110e63,_0x526ba9[_0x3e347e][_0x410968],_0x3e347e);}}else{addVertex(_0x110e63,_0x526ba9[_0x3e347e],_0x3e347e);}}}for(var _0x3f219d=0x0;_0x3f219d<_0x1a28d6['length'];_0x3f219d+=0x1){if(_0x1a28d6[_0x3f219d]['source']&&_0x1a28d6[_0x3f219d]['target']){_0x110e63['addEdge'](_0x1a28d6[_0x3f219d][_0xa885('0x26')],_0x1a28d6[_0x3f219d][_0xa885('0x27')],_0x1a28d6[_0x3f219d][_0xa885('0x28')]);}}return _0x110e63;}function getSquareProject(_0x17c0eb,_0x3ad88e){rpc[_0xa885('0x29')](_0x17c0eb)['then'](function(_0x40d982){_0x3ad88e(null,_0x40d982);})['catch'](function(_0x1318ef){_0x3ad88e(null,_0x1318ef);});}function createSquareReport(_0x4a1e54,_0x39990f){rpc['createSquareReport'](_0x4a1e54)[_0xa885('0x2a')](function(_0x9c6b86){if(_0x39990f){_0x39990f(null,_0x9c6b86);}})[_0xa885('0x2b')](function(_0x5d62c2){if(_0x39990f){_0x39990f(null,_0x5d62c2);}});}function setChannelVariables(_0x15f3a){for(var _0x23dea1 in _0x15f3a){if(_0x15f3a['hasOwnProperty'](_0x23dea1)){if(_0x23dea1[_0xa885('0x2c')]('agi_')===0x0){_0x15f3a[_0x23dea1[_0xa885('0x2d')](0x4)]=_0x15f3a[_0x23dea1];delete _0x15f3a[_0x23dea1];}}}}function getLogFromObject(_0x103985){return util[_0xa885('0x2e')](_0x103985,{'showHidden':![],'depth':null});}function agiHandler(_0x504091){var _0xf34189,_0x25ee20,_0x79626c,_0x49ae7a,_0x40150e;logger[_0xa885('0x2f')](_0xa885('0x30'),JSON[_0xa885('0x31')](_0x504091,null,0x2));logger[_0xa885('0x10')](util[_0xa885('0x11')](_0xa885('0x32'),_0x504091[_0xa885('0x17')],_0x504091['calleridname'],_0x504091['callerid'],_0x504091[_0xa885('0x19')],_0x504091[_0xa885('0x1a')]));_0x504091['on'](_0xa885('0x14'),errorHandler);_0x504091['on'](_0xa885('0x33'),closeHandler);_0x504091['on'](_0xa885('0x34'),timeoutHandler);_0x504091[_0xa885('0x35')]=![];_0x504091['on'](_0xa885('0x36'),hangupHandler);var _0x337e55=getSquareProject[_0xa885('0x37')](null,_0x504091['arg_1']);if(_0x337e55){if(_0x337e55['production']){_0xf34189=getRoot(_0x337e55[_0xa885('0x38')]);if(_0xf34189&&_0xf34189['start']){logger['debug'](_0xa885('0x1d'),JSON['stringify'](_0xf34189,null,0x2));_0x504091[_0xa885('0x39')]=moment()[_0xa885('0x11')](_0xa885('0x3a'));_0x25ee20=initGraph(_[_0xa885('0x3b')](_0xf34189,_0xa885('0x22')),_0xf34189[_0xa885('0x22')]);_0x79626c=new Vertices(_0x504091,rpc,mailRpc);logger[_0xa885('0x10')](util[_0xa885('0x11')](_0xa885('0x3c'),_0x504091[_0xa885('0x17')],_0x504091['calleridname'],_0x504091[_0xa885('0x18')],_0x504091[_0xa885('0x19')],_0x504091[_0xa885('0x1a')]));_0x25ee20[_0xa885('0x3d')](_0xf34189[_0xa885('0x3e')]['id'],function(_0x5e327f){try{_0x5e327f=_0x79626c['clear'](_0x5e327f);logger[_0xa885('0x2f')](_0xa885('0x3f'),JSON[_0xa885('0x31')](_0x5e327f,null,0x2));if(_0x5e327f[_0xa885('0x1e')]===_0xa885('0x40')){logger['info'](_0xa885('0x41'));_0x504091[_0xa885('0x42')]=_0x5e327f['context']||_0x504091['context'];_0x504091[_0xa885('0x43')]=_0x5e327f[_0xa885('0x43')];_0x504091['priority']=_0x5e327f['priority']?_0x5e327f[_0xa885('0x44')]-0x1:0x1;return null;}else if(_0x5e327f&&_0x79626c[_0x5e327f[_0xa885('0x1e')]]){_0x40150e=_0x79626c[_0x5e327f[_0xa885('0x1e')]](_0x5e327f);logger[_0xa885('0x10')](_0xa885('0x45'),JSON[_0xa885('0x31')](_0x40150e,null,0x2));if(_0x40150e&&_0x40150e[_0xa885('0x46')]===AGI_CODE_SUCCESS&&_0x40150e[_0xa885('0x47')]!==AGI_RESULT_ERROR&&!_0x504091[_0xa885('0x35')]){logger[_0xa885('0x2f')](_0xa885('0x45'),getLogFromObject(_0x40150e));return _['isUndefined'](_0x40150e[_0xa885('0x47')])?null:_0x40150e[_0xa885('0x47')][_0xa885('0x48')]();}else{logger['error'](_0xa885('0x45'),getLogFromObject(_0x40150e));return null;}}else{logger[_0xa885('0x14')](_0xa885('0x49'));return null;}}catch(_0x3d19f1){logger['error'](_0x3d19f1[_0xa885('0xc')]);return null;}});if(_0xf34189['finally']){logger[_0xa885('0x10')](util[_0xa885('0x11')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x504091[_0xa885('0x17')],_0x504091[_0xa885('0x4a')],_0x504091[_0xa885('0x18')],_0x504091[_0xa885('0x19')],_0x504091[_0xa885('0x1a')]));_0x25ee20['traverseBFS'](_0xf34189[_0xa885('0x4b')]['id'],function(_0x174ca3){try{_0x174ca3=_0x79626c[_0xa885('0x4c')](_0x174ca3);logger['debug']('vertex',JSON['stringify'](_0x174ca3,null,0x2));if(_0x174ca3&&_0x79626c[_0x174ca3[_0xa885('0x1e')]]){_0x40150e=_0x79626c[_0x174ca3[_0xa885('0x1e')]](_0x174ca3);if(_0x40150e){logger[_0xa885('0x2f')](_0xa885('0x45'),getLogFromObject(_0x40150e));return _[_0xa885('0x4d')](_0x40150e[_0xa885('0x47')])?null:_0x40150e[_0xa885('0x47')][_0xa885('0x48')]();}else{logger[_0xa885('0x14')](_0xa885('0x45'),getLogFromObject(_0x40150e));return null;}}else{logger[_0xa885('0x14')]('agicommand\x20not\x20found');return null;}}catch(_0x5f4856){logger['error'](_0x5f4856[_0xa885('0xc')]);return null;}});}logger[_0xa885('0x10')](util[_0xa885('0x11')](_0xa885('0x4e'),_0x504091[_0xa885('0x17')],_0x504091[_0xa885('0x4a')],_0x504091[_0xa885('0x18')],_0x504091['dnid'],_0x504091[_0xa885('0x1a')]));logger[_0xa885('0x10')](util[_0xa885('0x11')](_0xa885('0x4f'),_0x504091[_0xa885('0x42')],_0x504091[_0xa885('0x43')],parseInt(_0x504091[_0xa885('0x44')],0xa)+0x1));_0x504091['continueAt'](_0x504091[_0xa885('0x42')],_0x504091[_0xa885('0x43')],parseInt(_0x504091[_0xa885('0x44')],0xa)+0x1);_0x504091['close']();}}else{logger[_0xa885('0x14')](util[_0xa885('0x11')](_0xa885('0x50'),_0x504091[_0xa885('0x17')]));_0x504091[_0xa885('0x51')](_0x504091[_0xa885('0x42')],_0x504091[_0xa885('0x43')],parseInt(_0x504091[_0xa885('0x44')],0xa)+0x1);_0x504091['close']();}}else{logger[_0xa885('0x14')](util[_0xa885('0x11')](_0xa885('0x52'),_0x504091['arg_1']));_0x504091[_0xa885('0x51')](_0x504091[_0xa885('0x42')],_0x504091[_0xa885('0x43')],parseInt(_0x504091[_0xa885('0x44')],0xa)+0x1);_0x504091[_0xa885('0x33')]();}}function main(){var _0x2783e7;return utilLicense['getLicense']()[_0xa885('0x2a')](function(_0x2800e8){if(_0x2800e8){if(_0x2800e8[_0xa885('0x53')]){if(_0x2800e8['callysquare']&&_0x2800e8[_0xa885('0x54')]>0x0){logger[_0xa885('0x10')](util[_0xa885('0x11')](_0xa885('0x55'),_0x2800e8[_0xa885('0x54')]));_0x2783e7=_0x2800e8[_0xa885('0x54')];}else{logger[_0xa885('0x10')](_0xa885('0x56'));}}else{logger[_0xa885('0x10')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x2783e7=-0x1;}}})[_0xa885('0x2b')](function(_0x333502){logger['error']('[LICENSE]',_0x333502[_0xa885('0xc')]);})[_0xa885('0x4b')](function(){var _0x487cc5=require(_0xa885('0x57'))(config[_0xa885('0x5')][_0xa885('0xf')],config[_0xa885('0x5')]['ip'],_0x2783e7);_0x487cc5['on'](_0xa885('0x14'),errorHandler);_0x487cc5['on'](_0xa885('0x58'),listeningHandler);_0x487cc5['on'](_0xa885('0x59'),connectionHandler);_0x487cc5['on']('close',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 fdcba15..47c44da 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 _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x3334eb,_0xfdfe3e){var _0x17e0ea=function(_0x52917b){while(--_0x52917b){_0x3334eb['push'](_0x3334eb['shift']());}};_0x17e0ea(++_0xfdfe3e);}(_0x34e8,0x12c));var _0x834e=function(_0x2ece31,_0x52a10a){_0x2ece31=_0x2ece31-0x0;var _0x53e51c=_0x34e8[_0x2ece31];return _0x53e51c;};'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 +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x54e8e3,_0x511045){var _0x48f613=function(_0x192410){while(--_0x192410){_0x54e8e3['push'](_0x54e8e3['shift']());}};_0x48f613(++_0x511045);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 7af88bb..89e4148 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(_0x2676d7,_0x376226){var _0x49f258=function(_0x57c9fd){while(--_0x57c9fd){_0x2676d7['push'](_0x2676d7['shift']());}};_0x49f258(++_0x376226);}(_0x5f2f,0x73));var _0xf5f2=function(_0x430380,_0x2181fe){_0x430380=_0x430380-0x0;var _0x52e751=_0x5f2f[_0x430380];return _0x52e751;};'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(_0x322257,_0xd267a7){var _0x40aa7e=function(_0x482f39){while(--_0x482f39){_0x322257['push'](_0x322257['shift']());}};_0x40aa7e(++_0xd267a7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x45c967,_0x817714){_0x45c967=_0x45c967-0x0;var _0x1823d2=_0x5f2f[_0x45c967];return _0x1823d2;};'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 6263497..24e6491 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 _0x87d6=['CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','client','http','then','error','message','result','catch','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x87d6,0xce));var _0x687d=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x87d6[_0x3b5ad9];return _0x611ae9;};'use strict';var BPromise=require('bluebird');var moment=require(_0x687d('0x0'));var _=require(_0x687d('0x1'));var util=require(_0x687d('0x2'));var jayson=require('jayson/promise');var client=jayson[_0x687d('0x3')][_0x687d('0x4')]({'port':0x2329});function request(_0x286c58,_0x4170ad){return new BPromise(function(_0x43156b,_0x3daca5){return client['request'](_0x286c58,_0x4170ad)[_0x687d('0x5')](function(_0x1c33b2){if(_0x1c33b2[_0x687d('0x6')]){return _0x3daca5(_0x1c33b2[_0x687d('0x6')][_0x687d('0x7')]);}else{return _0x43156b(_0x1c33b2[_0x687d('0x8')]);}})[_0x687d('0x9')](function(_0x333ccc){return _0x3daca5(_0x333ccc);});});}exports[_0x687d('0xa')]=function(_0x5e0fb5){return request(_0x687d('0xb'),{'options':{'raw':![],'where':{'name':_0x5e0fb5},'attributes':['production']}});};exports[_0x687d('0xc')]=function(_0x40ec05){return request(_0x687d('0xd'),{'options':{'raw':![],'where':{'id':_0x40ec05},'include':[{'model':_0x687d('0xe'),'as':'Smtp'}],'attributes':['id',_0x687d('0xf'),_0x687d('0x10')]}});};exports[_0x687d('0x11')]=function(_0xfa1824){return request(_0x687d('0xb'),{'options':{'where':{'id':_0xfa1824},'attributes':[_0x687d('0xf')]}});};exports[_0x687d('0x12')]=function(_0x3fbf87){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x3fbf87},'attributes':[_0x687d('0xf')]}});};exports[_0x687d('0x13')]=function(_0x834024){return request(_0x687d('0x14'),{'options':{'where':{'id':_0x834024},'attributes':[_0x687d('0xf')]}});};exports[_0x687d('0x15')]=function(_0x14cf39){return request(_0x687d('0x16'),{'options':{'where':{'id':_0x14cf39},'attributes':[_0x687d('0x17')]}});};exports['getUserById']=function(_0x29041c){return request('ShowUser',{'options':{'where':{'id':_0x29041c},'attributes':[_0x687d('0xf')]}});};exports[_0x687d('0x18')]=function(_0x4ee265){return request(_0x687d('0x19'),{'options':{'where':{'id':_0x4ee265},'attributes':[_0x687d('0xf')]}});};exports['getSoundById']=function(_0x129cca){return request(_0x687d('0x1a'),{'options':{'where':{'id':_0x129cca},'attributes':[_0x687d('0x1b')]}});};exports[_0x687d('0x1c')]=function(_0xb96a64){return request(_0x687d('0x1d'),{'options':{'raw':![],'where':{'id':_0xb96a64},'include':[{'model':_0x687d('0x1e'),'as':_0x687d('0x1f')}]}});};exports[_0x687d('0x20')]=function(_0x5b4c7b){return request(_0x687d('0x21'),{'options':{'where':{'id':_0x5b4c7b},'attributes':['id',_0x687d('0xf')]}});};exports['createSmsMessage']=function(_0x2d1fa9){return request(_0x687d('0x22'),{'body':_0x2d1fa9});};exports['createSquareDetailsReport']=function(_0x41f89c){return request(_0x687d('0x23'),{'body':_0x41f89c});};exports[_0x687d('0x24')]=function(_0x22f9b0){return request(_0x687d('0x25'),{'body':_[_0x687d('0x26')](_0x22f9b0,{'project_name':_0x22f9b0[_0x687d('0x27')],'prev_project_name':_0x22f9b0[_0x687d('0x28')]||'','is_subproject':_0x22f9b0[_0x687d('0x28')]?!![]:![],'leaveAt':moment()[_0x687d('0x29')](_0x687d('0x2a'))})});};exports[_0x687d('0x2b')]=function(_0x1be7cd){return request('CreateSquareRecording',{'body':_0x1be7cd});};exports[_0x687d('0x2c')]=function(_0x13eb44){return request(_0x687d('0x2d'),{'body':_0x13eb44});};exports[_0x687d('0x2e')]=function(_0x2b34c0){return request(_0x687d('0x2f'),{'options':{'raw':![],'where':{'phone':_0x2b34c0[_0x687d('0x30')],'ListId':_0x2b34c0['ListId']}}})[_0x687d('0x5')](function(_0x3e5002){if(_0x3e5002){return _0x3e5002;}return request(_0x687d('0x31'),{'body':_0x2b34c0});});};exports[_0x687d('0x32')]=function(_0x1a8ffb){return request(_0x687d('0x33'),{'options':{'where':{'id':_0x1a8ffb},'attributes':['name']}});};exports[_0x687d('0x34')]=function(_0x230a83,_0x4c14d4){return request(_0x687d('0x35'),{'body':{'interface':_0x4c14d4},'options':{'where':_0x230a83}});};exports[_0x687d('0x36')]=function(_0x202dab,_0x12863a,_0x4f2c64){return request(_0x687d('0x37'),{'body':{'type':_0x12863a,'uniqueid':_0x4f2c64},'options':{'where':_0x202dab}});};exports[_0x687d('0x38')]=function(_0x120e9c){return request(_0x687d('0x39'),{'body':{},'options':{'where':_0x120e9c}});};exports[_0x687d('0x3a')]=function(_0x38611f){return request(_0x687d('0x3b'),{'body':{},'options':{'where':_0x38611f}});}; \ No newline at end of file +var _0x0580=['getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','lodash','jayson/promise','client','http','request','then','error','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','name','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0580,0x1d0));var _0x0058=function(_0x4cdda5,_0xfc35a9){_0x4cdda5=_0x4cdda5-0x0;var _0x5d59ad=_0x0580[_0x4cdda5];return _0x5d59ad;};'use strict';var BPromise=require(_0x0058('0x0'));var moment=require(_0x0058('0x1'));var _=require(_0x0058('0x2'));var util=require('util');var jayson=require(_0x0058('0x3'));var client=jayson[_0x0058('0x4')][_0x0058('0x5')]({'port':0x2329});function request(_0x588120,_0xb23888){return new BPromise(function(_0xc33799,_0xbf84b){return client[_0x0058('0x6')](_0x588120,_0xb23888)[_0x0058('0x7')](function(_0xc3712a){if(_0xc3712a[_0x0058('0x8')]){return _0xbf84b(_0xc3712a[_0x0058('0x8')]['message']);}else{return _0xc33799(_0xc3712a['result']);}})[_0x0058('0x9')](function(_0x4002d9){return _0xbf84b(_0x4002d9);});});}exports[_0x0058('0xa')]=function(_0x57d2aa){return request(_0x0058('0xb'),{'options':{'raw':![],'where':{'name':_0x57d2aa},'attributes':[_0x0058('0xc')]}});};exports[_0x0058('0xd')]=function(_0x571dbd){return request(_0x0058('0xe'),{'options':{'raw':![],'where':{'id':_0x571dbd},'include':[{'model':_0x0058('0xf'),'as':_0x0058('0x10')}],'attributes':['id','name',_0x0058('0x11')]}});};exports['getSquareProjectById']=function(_0x45940d){return request(_0x0058('0xb'),{'options':{'where':{'id':_0x45940d},'attributes':[_0x0058('0x12')]}});};exports['getVoiceQueueById']=function(_0x4a097a){return request(_0x0058('0x13'),{'options':{'where':{'id':_0x4a097a},'attributes':[_0x0058('0x12')]}});};exports['getVariableById']=function(_0x353a33){return request(_0x0058('0x14'),{'options':{'where':{'id':_0x353a33},'attributes':[_0x0058('0x12')]}});};exports['getSquareOdbcById']=function(_0x1ba811){return request(_0x0058('0x15'),{'options':{'where':{'id':_0x1ba811},'attributes':['dsn']}});};exports[_0x0058('0x16')]=function(_0x6bb9d9){return request(_0x0058('0x17'),{'options':{'where':{'id':_0x6bb9d9},'attributes':[_0x0058('0x12')]}});};exports[_0x0058('0x18')]=function(_0x294738){return request(_0x0058('0x19'),{'options':{'where':{'id':_0x294738},'attributes':[_0x0058('0x12')]}});};exports[_0x0058('0x1a')]=function(_0x1daa9b){return request(_0x0058('0x1b'),{'options':{'where':{'id':_0x1daa9b},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x3f0b47){return request(_0x0058('0x1c'),{'options':{'raw':![],'where':{'id':_0x3f0b47},'include':[{'model':_0x0058('0x1d'),'as':_0x0058('0x1e')}]}});};exports[_0x0058('0x1f')]=function(_0x2aa848){return request(_0x0058('0x20'),{'options':{'where':{'id':_0x2aa848},'attributes':['id',_0x0058('0x12')]}});};exports[_0x0058('0x21')]=function(_0x4fc5c9){return request(_0x0058('0x22'),{'body':_0x4fc5c9});};exports['createSquareDetailsReport']=function(_0x23825e){return request(_0x0058('0x23'),{'body':_0x23825e});};exports[_0x0058('0x24')]=function(_0x4fc32a){return request(_0x0058('0x25'),{'body':_[_0x0058('0x26')](_0x4fc32a,{'project_name':_0x4fc32a[_0x0058('0x27')],'prev_project_name':_0x4fc32a[_0x0058('0x28')]||'','is_subproject':_0x4fc32a[_0x0058('0x28')]?!![]:![],'leaveAt':moment()[_0x0058('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x5bc6f8){return request(_0x0058('0x2a'),{'body':_0x5bc6f8});};exports[_0x0058('0x2b')]=function(_0x118d3){return request(_0x0058('0x2c'),{'body':_0x118d3});};exports[_0x0058('0x2d')]=function(_0x5e8624){return request(_0x0058('0x2e'),{'options':{'raw':![],'where':{'phone':_0x5e8624[_0x0058('0x2f')],'ListId':_0x5e8624['ListId']}}})[_0x0058('0x7')](function(_0x159774){if(_0x159774){return _0x159774;}return request(_0x0058('0x30'),{'body':_0x5e8624});});};exports[_0x0058('0x31')]=function(_0x34fc7e){return request(_0x0058('0x32'),{'options':{'where':{'id':_0x34fc7e},'attributes':['name']}});};exports[_0x0058('0x33')]=function(_0x28c8eb,_0x3152fb){return request(_0x0058('0x34'),{'body':{'interface':_0x3152fb},'options':{'where':_0x28c8eb}});};exports['agentPause']=function(_0x2af202,_0x2f4bb0,_0x128c8d){return request(_0x0058('0x35'),{'body':{'type':_0x2f4bb0,'uniqueid':_0x128c8d},'options':{'where':_0x2af202}});};exports[_0x0058('0x36')]=function(_0x176f13){return request('UnpauseUser',{'body':{},'options':{'where':_0x176f13}});};exports[_0x0058('0x37')]=function(_0x4add5b){return request(_0x0058('0x38'),{'body':{},'options':{'where':_0x4add5b}});}; \ 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 a06f030..b835052 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 _0x1cc7=['exports','./polly','./lex'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cc7,0x15a));var _0x71cc=function(_0x2ca602,_0x2ce12d){_0x2ca602=_0x2ca602-0x0;var _0x44b1d6=_0x1cc7[_0x2ca602];return _0x44b1d6;};var polly=require(_0x71cc('0x0'));var lex=require(_0x71cc('0x1'));module[_0x71cc('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9b9b=['./lex'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x9b9b,0x114));var _0xb9b9=function(_0x226f94,_0x111cb2){_0x226f94=_0x226f94-0x0;var _0xb4249f=_0x9b9b[_0x226f94];return _0xb4249f;};var polly=require('./polly');var lex=require(_0xb9b9('0x0'));module['exports']={'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 eaf7565..369960c 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 _0x032a=['exports'];(function(_0x2596db,_0x523f12){var _0x591a65=function(_0x4b4a5c){while(--_0x4b4a5c){_0x2596db['push'](_0x2596db['shift']());}};_0x591a65(++_0x523f12);}(_0x032a,0xf0));var _0xa032=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0x032a[_0x4e4519];return _0x340044;};'use strict';var lex=require('./lib/api');module[_0xa032('0x0')]=function(_0x591b65,_0xb3b072,_0x39053e,_0x40e5b5,_0x2ee4ef,_0x185934){return lex(_0x591b65,_0xb3b072,_0x39053e,_0x40e5b5,_0x2ee4ef,_0x185934);}; \ No newline at end of file +var _0x0884=['exports','./lib/api'];(function(_0x4f3560,_0x2c5102){var _0x2a6db5=function(_0x1af7f7){while(--_0x1af7f7){_0x4f3560['push'](_0x4f3560['shift']());}};_0x2a6db5(++_0x2c5102);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var lex=require(_0x4088('0x0'));module[_0x4088('0x1')]=function(_0x1eb3d7,_0xcd6f6e,_0x39e7de,_0x1e9e1d,_0x300c58,_0x556d34){return lex(_0x1eb3d7,_0xcd6f6e,_0x39e7de,_0x1e9e1d,_0x300c58,_0x556d34);}; \ 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 74aeae1..6eef777 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 _0x4fd6=['slot_','exports','LexRuntime','$LATEST','bluebird','postText','slots','hasOwnProperty'];(function(_0x589adc,_0x189976){var _0x24b572=function(_0x5b463b){while(--_0x5b463b){_0x589adc['push'](_0x589adc['shift']());}};_0x24b572(++_0x189976);}(_0x4fd6,0x13c));var _0x64fd=function(_0x1b2cf0,_0x3e1559){_0x1b2cf0=_0x1b2cf0-0x0;var _0x566935=_0x4fd6[_0x1b2cf0];return _0x566935;};'use strict';var BPromise=require(_0x64fd('0x0'));var AWS=require('aws-sdk');function lexResult(_0x3d716e,_0x57c344){return new BPromise(function(_0x2d1772,_0x15ed72){_0x3d716e[_0x64fd('0x1')](_0x57c344,function(_0x2f7eb3,_0x282d13){if(_0x2f7eb3){_0x15ed72(_0x2f7eb3);}if(_0x282d13[_0x64fd('0x2')]){for(const _0x2ab9f9 in _0x282d13[_0x64fd('0x2')]){if(_0x282d13[_0x64fd('0x2')][_0x64fd('0x3')](_0x2ab9f9)){var _0xd7fa0b=_0x282d13['slots'][_0x2ab9f9];_0x282d13[_0x64fd('0x4')+_0x2ab9f9]=_0xd7fa0b;}}}_0x2d1772(_0x282d13);});});}module[_0x64fd('0x5')]=function(_0x3f6585,_0x18bf6e,_0xa37643,_0x2be826,_0x458a03,_0x1192f3){var _0x3d1055=new AWS[(_0x64fd('0x6'))]({'accessKeyId':_0x18bf6e,'secretAccessKey':_0xa37643,'region':_0x2be826});var _0x1a4494={'botAlias':_0x64fd('0x7'),'botName':_0x1192f3,'inputText':_0x458a03,'userId':_0x3f6585};return lexResult(_0x3d1055,_0x1a4494);}; \ No newline at end of file +var _0xc9a0=['$LATEST','bluebird','aws-sdk','postText','slots','hasOwnProperty','slot_','exports','LexRuntime'];(function(_0x2bdbc6,_0x42afa8){var _0x36d2a1=function(_0x57b338){while(--_0x57b338){_0x2bdbc6['push'](_0x2bdbc6['shift']());}};_0x36d2a1(++_0x42afa8);}(_0xc9a0,0x106));var _0x0c9a=function(_0x2c3802,_0x42ff06){_0x2c3802=_0x2c3802-0x0;var _0x27cea5=_0xc9a0[_0x2c3802];return _0x27cea5;};'use strict';var BPromise=require(_0x0c9a('0x0'));var AWS=require(_0x0c9a('0x1'));function lexResult(_0x155c18,_0x1c630e){return new BPromise(function(_0x510840,_0x731382){_0x155c18[_0x0c9a('0x2')](_0x1c630e,function(_0x4d5ec4,_0x741404){if(_0x4d5ec4){_0x731382(_0x4d5ec4);}if(_0x741404[_0x0c9a('0x3')]){for(const _0x59f5ed in _0x741404['slots']){if(_0x741404[_0x0c9a('0x3')][_0x0c9a('0x4')](_0x59f5ed)){var _0x324473=_0x741404[_0x0c9a('0x3')][_0x59f5ed];_0x741404[_0x0c9a('0x5')+_0x59f5ed]=_0x324473;}}}_0x510840(_0x741404);});});}module[_0x0c9a('0x6')]=function(_0x3791b4,_0x4a080b,_0x511e48,_0x774324,_0x536179,_0x331a5f){var _0x185743=new AWS[(_0x0c9a('0x7'))]({'accessKeyId':_0x4a080b,'secretAccessKey':_0x511e48,'region':_0x774324});var _0x5e9db1={'botAlias':_0x0c9a('0x8'),'botName':_0x331a5f,'inputText':_0x536179,'userId':_0x3791b4};return lexResult(_0x185743,_0x5e9db1);}; \ 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 9aea141..48f086b 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. * // * * // ************************************************************************* -var _0x2951=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2951,0xbf));var _0x1295=function(_0x44e00a,_0x248bbc){_0x44e00a=_0x44e00a-0x0;var _0x2bdfba=_0x2951[_0x44e00a];return _0x2bdfba;};'use strict';var polly=require('./lib/api');module[_0x1295('0x0')]=function(_0x74fb30,_0x3982a3,_0x1a9995,_0x298178,_0x40f81d,_0x327791,_0x27466a){return polly(_0x74fb30,_0x3982a3,_0x1a9995,_0x298178,_0x40f81d,_0x327791,_0x27466a);}; \ No newline at end of file +var _0xcc0b=['exports'];(function(_0x6c79a9,_0x3218e7){var _0x1f80a9=function(_0x487fc6){while(--_0x487fc6){_0x6c79a9['push'](_0x6c79a9['shift']());}};_0x1f80a9(++_0x3218e7);}(_0xcc0b,0x11d));var _0xbcc0=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0xcc0b[_0x409deb];return _0x15a4f7;};'use strict';var polly=require('./lib/api');module[_0xbcc0('0x0')]=function(_0x1afad5,_0x289e99,_0x4ed4f7,_0x3c25a2,_0x2df271,_0x31e3f9,_0x31341d){return polly(_0x1afad5,_0x289e99,_0x4ed4f7,_0x3c25a2,_0x2df271,_0x31e3f9,_0x31341d);}; \ 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 a21753b..87f00a3 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 _0xf1a6=['mp3','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x5117cb,_0x1da3ae){var _0x4e8f9a=function(_0x5e43c1){while(--_0x5e43c1){_0x5117cb['push'](_0x5117cb['shift']());}};_0x4e8f9a(++_0x1da3ae);}(_0xf1a6,0xf4));var _0x6f1a=function(_0x27c941,_0x2e018a){_0x27c941=_0x27c941-0x0;var _0x5d0732=_0xf1a6[_0x27c941];return _0x5d0732;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x6f1a('0x0'));var AWS=require(_0x6f1a('0x1'));function pollyResult(_0x57a25f,_0x7ee37c,_0x4fde39){return new BPromise(function(_0x5e959f,_0x258cc9){_0x57a25f[_0x6f1a('0x2')](_0x7ee37c,function(_0x425488,_0xfbeab5){if(_0x425488){_0x258cc9(_0x425488);}else if(_0xfbeab5){if(_0xfbeab5[_0x6f1a('0x3')]instanceof Buffer){fs[_0x6f1a('0x4')](_0x4fde39,_0xfbeab5[_0x6f1a('0x3')],function(_0x139199){if(_0x139199){_0x258cc9(_0x139199);}else{_0x5e959f();}});}else{_0x258cc9(new Error(_0x6f1a('0x5')));}}else{_0x258cc9(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x6f1a('0x6')]=function(_0x1caec2,_0x15dfe2,_0x188003,_0x5bb5c2,_0x3f2ef5,_0x2a2361,_0x34e418){var _0x289a81=new AWS[(_0x6f1a('0x7'))]({'accessKeyId':_0x1caec2,'secretAccessKey':_0x15dfe2,'region':_0x188003});var _0xfe6245={'Text':_0x3f2ef5,'TextType':_0x2a2361||'text','OutputFormat':_0x6f1a('0x8'),'VoiceId':_0x5bb5c2};return pollyResult(_0x289a81,_0xfe6245,_0x34e418);}; \ No newline at end of file +var _0x3816=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x3816,0x89));var _0x6381=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0x3816[_0x27d8bc];return _0x4b04cb;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x6381('0x0'));var AWS=require(_0x6381('0x1'));function pollyResult(_0x106598,_0x324853,_0x236e23){return new BPromise(function(_0x397336,_0x3fe712){_0x106598[_0x6381('0x2')](_0x324853,function(_0x539be9,_0x24487e){if(_0x539be9){_0x3fe712(_0x539be9);}else if(_0x24487e){if(_0x24487e[_0x6381('0x3')]instanceof Buffer){fs[_0x6381('0x4')](_0x236e23,_0x24487e[_0x6381('0x3')],function(_0x124b16){if(_0x124b16){_0x3fe712(_0x124b16);}else{_0x397336();}});}else{_0x3fe712(new Error(_0x6381('0x5')));}}else{_0x3fe712(new Error(_0x6381('0x6')));}});});}module[_0x6381('0x7')]=function(_0x310140,_0x514048,_0xdd108d,_0x34244d,_0x28f1b2,_0x6c2f4a,_0x3f9e5f){var _0x566417=new AWS[(_0x6381('0x8'))]({'accessKeyId':_0x310140,'secretAccessKey':_0x514048,'region':_0xdd108d});var _0x4bd0db={'Text':_0x28f1b2,'TextType':_0x6c2f4a||_0x6381('0x9'),'OutputFormat':_0x6381('0xa'),'VoiceId':_0x34244d};return pollyResult(_0x566417,_0x4bd0db,_0x3f9e5f);}; \ 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 52a8283..47e5691 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 _0x9cd0=['./lib/api','exports'];(function(_0x574ce3,_0x59eef4){var _0x3447a0=function(_0x27f8cb){while(--_0x27f8cb){_0x574ce3['push'](_0x574ce3['shift']());}};_0x3447a0(++_0x59eef4);}(_0x9cd0,0x19e));var _0x09cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cd0[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0x09cd('0x0'));module[_0x09cd('0x1')]=function(_0x11b7d4,_0x5d91ce,_0x1cb4dd,_0x1b2fbc){return asr(_0x11b7d4,_0x5d91ce,_0x1cb4dd);}; \ No newline at end of file +var _0xe207=['exports'];(function(_0x34b1b8,_0x54c9bf){var _0x542dd8=function(_0xff3f89){while(--_0xff3f89){_0x34b1b8['push'](_0x34b1b8['shift']());}};_0x542dd8(++_0x54c9bf);}(_0xe207,0x1c7));var _0x7e20=function(_0x5253e1,_0x564632){_0x5253e1=_0x5253e1-0x0;var _0x432628=_0xe207[_0x5253e1];return _0x432628;};'use strict';var asr=require('./lib/api');module[_0x7e20('0x0')]=function(_0x483787,_0x3ca950,_0x59203f,_0x2ef7b7){return asr(_0x483787,_0x3ca950,_0x59203f);}; \ 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 36cfdab..c09ffba 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 _0x3643=['https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird'];(function(_0x4b5887,_0x2e163b){var _0x49eea7=function(_0x28485c){while(--_0x28485c){_0x4b5887['push'](_0x4b5887['shift']());}};_0x49eea7(++_0x2e163b);}(_0x3643,0xfa));var _0x3364=function(_0x24ec59,_0x3bbeec){_0x24ec59=_0x24ec59-0x0;var _0x5eaeb7=_0x3643[_0x24ec59];return _0x5eaeb7;};'use strict';var url=require(_0x3364('0x0'));var BPromise=require(_0x3364('0x1'));var fs=require('fs');var host=_0x3364('0x2');module[_0x3364('0x3')]=function(_0x50f281,_0x5aa048,_0x281071){return new BPromise(function(_0x17b171,_0x24cf68){var _0x4f357d;if(typeof _0x50f281!==_0x3364('0x4')||_0x50f281[_0x3364('0x5')]===0x0){return _0x24cf68(_0x3364('0x6'));}if(typeof _0x5aa048!=='string'||_0x5aa048[_0x3364('0x5')]===0x0){return _0x24cf68(_0x3364('0x7'));}if(typeof _0x281071!==_0x3364('0x8')&&(typeof _0x281071!==_0x3364('0x4')||_0x281071[_0x3364('0x5')]===0x0)){return _0x24cf68(_0x3364('0x9'));}try{_0x4f357d=fs[_0x3364('0xa')](_0x50f281)['toString']('base64');}catch(_0x18a865){return _0x24cf68(_0x18a865);}return _0x17b171({'method':'POST','uri':host+_0x3364('0xb')+_0x5aa048,'body':{'config':{'encoding':_0x3364('0xc'),'sampleRateHertz':_0x3364('0xd'),'languageCode':_0x281071},'audio':{'content':_0x4f357d}},'json':!![]});});}; \ No newline at end of file +var _0x33b2=['exports','length','string','key\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','url','bluebird'];(function(_0x1b37d4,_0x23128b){var _0x1bb8b6=function(_0x25a43f){while(--_0x25a43f){_0x1b37d4['push'](_0x1b37d4['shift']());}};_0x1bb8b6(++_0x23128b);}(_0x33b2,0x111));var _0x233b=function(_0x1cba9e,_0x427f55){_0x1cba9e=_0x1cba9e-0x0;var _0xc46ab9=_0x33b2[_0x1cba9e];return _0xc46ab9;};'use strict';var url=require(_0x233b('0x0'));var BPromise=require(_0x233b('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x233b('0x2')]=function(_0x2bc8dd,_0x126bdc,_0x4ce80f){return new BPromise(function(_0x52cd9c,_0x107e35){var _0x1314fd;if(typeof _0x2bc8dd!=='string'||_0x2bc8dd[_0x233b('0x3')]===0x0){return _0x107e35('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x126bdc!==_0x233b('0x4')||_0x126bdc['length']===0x0){return _0x107e35(_0x233b('0x5'));}if(typeof _0x4ce80f!=='undefined'&&(typeof _0x4ce80f!==_0x233b('0x4')||_0x4ce80f['length']===0x0)){return _0x107e35('lang\x20should\x20be\x20a\x20string');}try{_0x1314fd=fs[_0x233b('0x6')](_0x2bc8dd)[_0x233b('0x7')](_0x233b('0x8'));}catch(_0x55583f){return _0x107e35(_0x55583f);}return _0x52cd9c({'method':_0x233b('0x9'),'uri':host+'/v1/speech:recognize?key='+_0x126bdc,'body':{'config':{'encoding':_0x233b('0xa'),'sampleRateHertz':'8000','languageCode':_0x4ce80f},'audio':{'content':_0x1314fd}},'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 fa9919e..817a5e2 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 _0xa182=['./asr','exports'];(function(_0x1d02b9,_0x5a2dc7){var _0x5261f3=function(_0x48abc5){while(--_0x48abc5){_0x1d02b9['push'](_0x1d02b9['shift']());}};_0x5261f3(++_0x5a2dc7);}(_0xa182,0x122));var _0x2a18=function(_0x1aa42f,_0x4ddd0d){_0x1aa42f=_0x1aa42f-0x0;var _0x4dba40=_0xa182[_0x1aa42f];return _0x4dba40;};var asr=require(_0x2a18('0x0'));module[_0x2a18('0x1')]={'asr':asr}; \ No newline at end of file +var _0x052c=['./asr','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x052c,0xe6));var _0xc052=function(_0x1e059c,_0x450449){_0x1e059c=_0x1e059c-0x0;var _0x4bd972=_0x052c[_0x1e059c];return _0x4bd972;};var asr=require(_0xc052('0x0'));module[_0xc052('0x1')]={'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 d4340bf..3ee0b05 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 _0x5af1=['queryText','responseId','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','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','model=%s','freeform=3','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','path','querystring','request-promise','randomstring','sox','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','error','statusCode','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','end','host','get','data','transcode','wav','error\x20convert','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','then','chmodSync','777','split','toString','googleCloudTTS','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','.mp3','from','audioContent','base64','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','score','status','metadata','endConversation','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','name','intent','displayName','isFallback','languageCode'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x5af1,0x128));var _0x15af=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5af1[_0x3ab9ee];return _0x82ee88;};'use strict';var apiai=require(_0x15af('0x0'));var BPromise=require(_0x15af('0x1'));var dialogflow=require(_0x15af('0x2'));var fs=require('fs');var http=require(_0x15af('0x3'));var https=require(_0x15af('0x4'));var md5=require('md5');var path=require(_0x15af('0x5'));var querystring=require(_0x15af('0x6'));var rp=require(_0x15af('0x7'));var rs=require(_0x15af('0x8'));var sox=require(_0x15af('0x9'));var tts=require('google-tts-api');var urlParse=require(_0x15af('0xa'))[_0x15af('0xb')];var util=require(_0x15af('0xc'));var aws=require(_0x15af('0xd'));var google=require(_0x15af('0xe'));var sestek=require(_0x15af('0xf'));var tilde=require(_0x15af('0x10'));var logger=require(_0x15af('0x11'))(_0x15af('0x12'));var ISPEECH_API=_0x15af('0x13');function downloadFile(_0x22e959,_0x4acee4){return new BPromise(function(_0x2802e9,_0x3db28b){var _0x3693e7=urlParse(_0x22e959);var _0x9f7e8c=_0x3693e7[_0x15af('0x14')]===_0x15af('0x15')?https:http;var _0x2b5c60={'host':_0x3693e7['host'],'path':_0x3693e7[_0x15af('0x5')],'headers':{'user-agent':_0x15af('0x16')}};_0x9f7e8c['get'](_0x2b5c60,function(_0x2d1209){if(_0x2d1209['statusCode']!==0xc8){logger[_0x15af('0x17')]('request\x20to\x20'+_0x22e959+'\x20failed,\x20status\x20code\x20=\x20'+_0x2d1209[_0x15af('0x18')]+'\x20('+_0x2d1209[_0x15af('0x19')]+')');_0x3db28b(new Error(_0x15af('0x1a')+_0x22e959+_0x15af('0x1b')+_0x2d1209[_0x15af('0x18')]+'\x20('+_0x2d1209[_0x15af('0x19')]+')'));return;}var _0x51df2f=fs[_0x15af('0x1c')](_0x4acee4);_0x51df2f['on'](_0x15af('0x1d'),function(){logger[_0x15af('0x1e')](_0x15af('0x1f'));_0x51df2f[_0x15af('0x20')](_0x2802e9);});_0x51df2f['on']('error',function(_0x3b604d){fs[_0x15af('0x21')](_0x4acee4);logger[_0x15af('0x17')]('download\x20error',_0x3b604d);_0x3db28b(_0x3b604d);});_0x2d1209[_0x15af('0x22')](_0x51df2f);})['on']('error',function(_0x5676e6){logger['error'](_0x5676e6);_0x3db28b(_0x5676e6);})[_0x15af('0x23')]();});}function uploadFile(_0xc9bbc7){return new BPromise(function(_0x535d21,_0x7f2aff){var _0x3e3ce8=urlParse(_0xc9bbc7);var _0x37ffbc=_0x3e3ce8['protocol']===_0x15af('0x15')?https:http;var _0x47c8a5={'host':_0x3e3ce8[_0x15af('0x24')],'path':_0x3e3ce8[_0x15af('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x37ffbc[_0x15af('0x25')](_0x47c8a5,function(_0x237dae){if(_0x237dae[_0x15af('0x18')]!==0xc8){_0x7f2aff(new Error(_0x15af('0x1a')+_0xc9bbc7+'\x20failed,\x20status\x20code\x20=\x20'+_0x237dae['statusCode']+'\x20('+_0x237dae[_0x15af('0x19')]+')'));return;}var _0x4b77b9='';_0x237dae['on'](_0x15af('0x26'),function(_0x597cba){_0x4b77b9+=_0x597cba;});_0x237dae['on']('end',function(){_0x535d21(_0x4b77b9);});})['on'](_0x15af('0x17'),function(_0x30bb43){_0x7f2aff(_0x30bb43);})[_0x15af('0x23')]();});}function convertFile(_0x4acc3c,_0x56809d){return new BPromise(function(_0x1af20b,_0x1527c7){var _0x2d057c=sox[_0x15af('0x27')](_0x4acc3c,_0x56809d,{'sampleRate':0x1f40,'format':_0x15af('0x28'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2d057c['on'](_0x15af('0x17'),function(_0x3bed61){logger[_0x15af('0x17')](_0x15af('0x29'),_0x3bed61);_0x1527c7(_0x3bed61);});_0x2d057c['on'](_0x15af('0x23'),function(){logger['info'](_0x15af('0x2a'));_0x1af20b();});_0x2d057c['start']();});}function base64Decode(_0x603b98,_0x272056){var _0x22801b=path['resolve'](__dirname,_0x15af('0x2b'),rs[_0x15af('0x2c')](0x4)+_0x15af('0x2d'));fs[_0x15af('0x2e')](_0x22801b,_0x603b98,'base64');return convertFile(_0x22801b,_0x272056)[_0x15af('0x2f')](function(){try{fs[_0x15af('0x21')](_0x22801b);fs[_0x15af('0x30')](_0x272056,_0x15af('0x31'));}catch(_0x410374){logger[_0x15af('0x17')](_0x410374);}return _0x272056[_0x15af('0x32')]('.')[0x0];});}function base64Encode(_0x584646){var _0x59b049=fs['readFileSync'](_0x584646);return new Buffer(_0x59b049)[_0x15af('0x33')]('base64');}exports[_0x15af('0x34')]=function(_0x5f102a,_0x388d4f,_0x1aa9fb,_0x3163d9,_0x1596c4,_0x3c64ae){var _0x10ee35,_0x275380;var _0x555e9d='https://texttospeech.googleapis.com/v1/';var _0x373f57=_0x15af('0x35')+_0x5f102a;var _0x2440ac={};if(_0x388d4f==='ssml'){_0x2440ac['input']={'ssml':_0x1aa9fb};}else{_0x2440ac[_0x15af('0x36')]={'text':_0x1aa9fb};};_0x2440ac[_0x15af('0x37')]={'languageCode':_0x3163d9,'ssmlGender':_0x1596c4};_0x2440ac[_0x15af('0x38')]={'audioEncoding':_0x15af('0x39'),'sampleRateHertz':0x1f40};var _0x1c3a89={'url':_0x555e9d+_0x15af('0x3a')+_0x373f57,'method':_0x15af('0x3b'),'json':!![],'body':_0x2440ac};return rp(_0x1c3a89)['then'](function(_0x5973e6){return new BPromise(function(_0x5d0573,_0x45d642){_0x10ee35=path[_0x15af('0x3c')](__dirname,'tmp',rs[_0x15af('0x2c')](0x4)+_0x15af('0x3d'));var _0x5b508f=Buffer[_0x15af('0x3e')](_0x5973e6[_0x15af('0x3f')],_0x15af('0x40'));return fs[_0x15af('0x41')](_0x10ee35,_0x5b508f,function(_0x56361f){_0x45d642(_0x56361f);},function(_0x171a52){fs[_0x15af('0x30')](_0x10ee35,'777');_0x5d0573(_0x171a52);});});})[_0x15af('0x2f')](function(_0x171ce1){_0x275380=path[_0x15af('0x3c')](__dirname,_0x15af('0x2b'),rs[_0x15af('0x2c')](0x4)+_0x15af('0x2d'));return convertFile(_0x10ee35,_0x275380);})['then'](function(){try{fs[_0x15af('0x21')](_0x10ee35);fs[_0x15af('0x30')](_0x275380,_0x15af('0x31'));}catch(_0x4d2704){logger[_0x15af('0x17')](_0x4d2704);}logger[_0x15af('0x1e')](_0x15af('0x42'),_0x275380[_0x15af('0x32')]('.')[0x0]);return _0x275380['split']('.')[0x0];});};exports[_0x15af('0x43')]=function(_0xfe9d03,_0x3eb7ff){var _0x1a2504=_0x15af('0x44');var _0x47342c,_0x46296c;var _0x3d642f;var _0x1eeff0={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x1a2504,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x15af('0x45')]([[[_0x15af('0x46'),JSON[_0x15af('0x45')]([_0xfe9d03,_0x3eb7ff||'en',![],'null']),null,_0x15af('0x47')]]]))};return rp(_0x1eeff0)[_0x15af('0x2f')](function(_0x3b389f){try{_0x3d642f=eval(_0x3b389f[_0x15af('0x48')](0x5))[0x0][0x2];}catch(_0x4267e6){throw new Error(_0x15af('0x49')+_0x3b389f['data']);}if(!_0x3d642f){if(_0xfe9d03[_0x15af('0x4a')]>0xc8){throw new Error(_0x15af('0x4b'));}else{throw new Error('lang\x20\x22'+_0x3eb7ff+_0x15af('0x4c'));}}try{_0x3d642f=eval(_0x3d642f)[0x0];}catch(_0x819beb){throw new Error(_0x15af('0x49')+res[_0x15af('0x26')]);}const _0x32eb63=_0x3d642f;_0x47342c=path[_0x15af('0x3c')](__dirname,_0x15af('0x2b'),rs[_0x15af('0x2c')](0x4)+'.mp3');fs[_0x15af('0x2e')](_0x47342c,_0x3d642f,{'encoding':'base64'});_0x46296c=path[_0x15af('0x3c')](__dirname,_0x15af('0x2b'),rs[_0x15af('0x2c')](0x4)+'.wav');return convertFile(_0x47342c,_0x46296c);})[_0x15af('0x2f')](function(){try{fs['unlink'](_0x47342c);fs[_0x15af('0x30')](_0x46296c,'777');}catch(_0x2dafa7){logger[_0x15af('0x17')](_0x2dafa7);}logger[_0x15af('0x1e')](_0x15af('0x4d'),_0x46296c[_0x15af('0x32')]('.')[0x0]);return _0x46296c[_0x15af('0x32')]('.')[0x0];});};exports[_0x15af('0x4e')]=function(_0x18820b,_0xb0cc7d,_0x300c87){return google['asr'](_0x18820b,_0xb0cc7d,_0x300c87)['then'](function(_0x1ed4ac){logger[_0x15af('0x1e')](_0x1ed4ac[_0x15af('0x4f')]);return rp(_0x1ed4ac);})[_0x15af('0x2f')](function(_0x5b993c){var _0x225f90='';var _0x23fbad=0x0;try{fs['unlink'](_0x18820b);}catch(_0x17aedd){logger[_0x15af('0x17')](_0x17aedd);}if(_0x5b993c&&_0x5b993c[_0x15af('0x50')]){_0x225f90=_0x5b993c[_0x15af('0x50')][_0x15af('0x51')](function(_0x1f4188){return _0x1f4188&&_0x1f4188['alternatives'][0x0]&&_0x1f4188[_0x15af('0x52')][0x0][_0x15af('0x53')]?_0x1f4188[_0x15af('0x52')][0x0][_0x15af('0x53')]:'';})[_0x15af('0x54')]('\x0a');_0x23fbad=_0x5b993c[_0x15af('0x50')][_0x15af('0x51')](function(_0x5cfa2f){return _0x5cfa2f&&_0x5cfa2f[_0x15af('0x52')][0x0]&&_0x5cfa2f[_0x15af('0x52')][0x0]['confidence']?_0x5cfa2f[_0x15af('0x52')][0x0][_0x15af('0x55')]:0x0;})[_0x15af('0x54')]('\x0a');}logger[_0x15af('0x1e')](_0x15af('0x56'),_0x225f90);logger[_0x15af('0x1e')](_0x15af('0x57'),_0x23fbad);return{'transcript':_0x225f90,'confidence':_0x23fbad};})['catch'](function(_0x25d7bf){logger['error']('[%s]\x20%s:%s',_0x25d7bf['statusCode'],_0x25d7bf['name'],_0x25d7bf[_0x15af('0x58')]);});};exports[_0x15af('0x59')]=function(_0x1bc2ae,_0x3cf963,_0x13ed8d,_0x143f88){var _0x6a4d75=apiai(_0x3cf963,{'language':_0x143f88||'en'});return _0x6a4d75[_0x15af('0x5a')](_0x13ed8d,{'sessionId':md5(_0x1bc2ae)})[_0x15af('0x2f')](function(_0x5dc01c){logger['info'](JSON[_0x15af('0x45')](_0x5dc01c));return{'source':_0x5dc01c[_0x15af('0x5b')]['source'],'resolvedQuery':_0x5dc01c[_0x15af('0x5b')][_0x15af('0x5c')],'action':_0x5dc01c[_0x15af('0x5b')][_0x15af('0x5d')],'actionIncomplete':_0x5dc01c[_0x15af('0x5b')][_0x15af('0x5e')],'speech':_0x5dc01c[_0x15af('0x5b')]['fulfillment']['speech'],'score':_0x5dc01c[_0x15af('0x5b')][_0x15af('0x5f')],'statusCode':_0x5dc01c[_0x15af('0x60')]['code'],'endConversation':_0x5dc01c[_0x15af('0x5b')][_0x15af('0x61')][_0x15af('0x62')]||![],'isFallbackIntent':_0x5dc01c[_0x15af('0x5b')][_0x15af('0x61')]['isFallbackIntent']};});};exports[_0x15af('0x63')]=function(_0x2af1d2,_0x495fde,_0x2010ff,_0x3fb1f0,_0x4fb393,_0x11e758){var _0x185bd2=_0x3fb1f0['replace'](/\\n/g,'\x0a');var _0x531bc7={'credentials':{'private_key':_0x185bd2,'client_email':_0x2010ff}};var _0x4f28f3=new dialogflow[(_0x15af('0x64'))](_0x531bc7);var _0x14ccc3=_0x4f28f3[_0x15af('0x65')](_0x495fde,md5(_0x2af1d2));var _0x418be0={'session':_0x14ccc3,'queryInput':{'text':{'text':_0x4fb393,'languageCode':_0x11e758}}};return _0x4f28f3[_0x15af('0x66')](_0x418be0)['then'](function(_0x155a74){if(_0x155a74&&_0x155a74[_0x15af('0x4a')]){logger['info'](_0x15af('0x67'),JSON[_0x15af('0x45')](_0x155a74));var _0x2f1a8d=_0x155a74[0x0];if(_0x2f1a8d){var _0x2010d6={'action':_0x2f1a8d[_0x15af('0x68')][_0x15af('0x5d')],'allRequiredParamsPresent':_0x2f1a8d[_0x15af('0x68')][_0x15af('0x69')],'endConversation':_0x2f1a8d[_0x15af('0x68')][_0x15af('0x6a')]&&_0x2f1a8d[_0x15af('0x68')][_0x15af('0x6a')][_0x15af('0x6b')]?_0x2f1a8d[_0x15af('0x68')][_0x15af('0x6a')][_0x15af('0x6b')]['end_conversation'][_0x15af('0x6c')]:![],'fulfillmentText':_0x2f1a8d[_0x15af('0x68')][_0x15af('0x6d')],'intentName':_0x2f1a8d[_0x15af('0x68')]['intent'][_0x15af('0x6e')],'intentDisplayName':_0x2f1a8d[_0x15af('0x68')][_0x15af('0x6f')][_0x15af('0x70')],'isFallbackIntent':_0x2f1a8d[_0x15af('0x68')][_0x15af('0x6f')][_0x15af('0x71')],'languageCode':_0x2f1a8d['queryResult'][_0x15af('0x72')],'queryText':_0x2f1a8d['queryResult'][_0x15af('0x73')],'responseId':_0x2f1a8d[_0x15af('0x74')],'score':_0x2f1a8d[_0x15af('0x68')]['intentDetectionConfidence'],'speech':_0x2f1a8d[_0x15af('0x68')][_0x15af('0x6d')],'providerResponse':JSON['stringify'](_0x155a74)};return _0x2010d6;}}});};exports['tildeASR']=function(_0x31f75d,_0x4e3dec,_0x3257e0,_0x47d8d0){return tilde[_0x15af('0x75')](_0x31f75d,_0x4e3dec,_0x3257e0,_0x47d8d0)[_0x15af('0x2f')](function(_0x51d8f8){try{fs[_0x15af('0x21')](_0x31f75d);}catch(_0x29f2f9){logger['error'](_0x29f2f9);}logger[_0x15af('0x1e')](_0x15af('0x76'),_0x51d8f8['transcript']);logger['info'](_0x15af('0x77'),_0x51d8f8[_0x15af('0x55')]);return _0x51d8f8;});};exports[_0x15af('0x78')]=function(_0x5909fa,_0x54a03c,_0xde009b,_0x136b26,_0x605c3a,_0x284286){var _0x268059=path[_0x15af('0x3c')](__dirname,_0x15af('0x2b'),rs[_0x15af('0x2c')](0x4)+_0x15af('0x3d'));var _0x352979;return aws[_0x15af('0x79')](_0x5909fa,_0x54a03c,_0xde009b,_0x136b26,_0x605c3a,_0x284286,_0x268059)[_0x15af('0x2f')](function(){_0x352979=path[_0x15af('0x3c')](__dirname,_0x15af('0x2b'),rs[_0x15af('0x2c')](0x4)+_0x15af('0x2d'));return convertFile(_0x268059,_0x352979);})[_0x15af('0x2f')](function(){try{fs[_0x15af('0x21')](_0x268059);fs[_0x15af('0x30')](_0x352979,_0x15af('0x31'));}catch(_0x4f0271){logger[_0x15af('0x17')](_0x4f0271);}return _0x352979[_0x15af('0x32')]('.')[0x0];});};exports['awsLex']=function(_0x260c74,_0x48d451,_0x3600c8,_0x362904,_0x2b8bea,_0x48629c){return aws[_0x15af('0x7a')](_0x260c74,_0x48d451,_0x3600c8,_0x362904,_0x2b8bea,_0x48629c)[_0x15af('0x2f')](function(_0x925bca){logger['info'](JSON[_0x15af('0x45')](_0x925bca));return _0x925bca;});};exports[_0x15af('0x7b')]=function(_0x5b8c1b,_0x303273,_0x2d0298,_0x439689){var _0x1d6a1f=util[_0x15af('0x7c')](_0x15af('0x7d'),ISPEECH_API,_0x5b8c1b,encodeURIComponent(_0x303273),_0x2d0298,_0x439689);var _0x49bf1b=path[_0x15af('0x3c')](__dirname,_0x15af('0x2b'),rs[_0x15af('0x2c')](0x4)+_0x15af('0x3d'));var _0xc26e49;return downloadFile(_0x1d6a1f,_0x49bf1b)['then'](function(){_0xc26e49=path[_0x15af('0x3c')](__dirname,_0x15af('0x2b'),rs[_0x15af('0x2c')](0x4)+_0x15af('0x2d'));return convertFile(_0x49bf1b,_0xc26e49);})[_0x15af('0x2f')](function(){try{fs['unlink'](_0x49bf1b);fs[_0x15af('0x30')](_0xc26e49,_0x15af('0x31'));}catch(_0x298e1f){logger['error'](_0x298e1f);}return _0xc26e49['split']('.')[0x0];});};exports[_0x15af('0x7e')]=function(_0x447f14,_0x5abb8f,_0x4e8b88,_0x4a1a13){var _0x4d8312=util[_0x15af('0x7c')](_0x15af('0x7f'),ISPEECH_API,_0x5abb8f,_0x4e8b88,base64Encode(_0x447f14),_0x4a1a13?util[_0x15af('0x7c')](_0x15af('0x80'),encodeURIComponent(_0x4a1a13)):_0x15af('0x81'));return uploadFile(_0x4d8312)['then'](function(_0x5a2877){return querystring[_0x15af('0xb')](_0x5a2877);});};exports['sestekNDA']=function(_0x3615d5,_0x1a14b8){return sestek['nda'](_0x3615d5,_0x1a14b8)[_0x15af('0x2f')](function(_0x5d3705){logger[_0x15af('0x1e')](JSON[_0x15af('0x45')](_0x5d3705));var _0x105a94={'speech':_0x5d3705[_0x15af('0x82')],'action':_0x5d3705[_0x15af('0x83')]?_0x5d3705['channelData'][_0x15af('0x84')]:undefined,'actiondata':_0x5d3705[_0x15af('0x83')]?_0x5d3705[_0x15af('0x83')]['CustomActionData']:undefined};if(_0x5d3705[_0x15af('0x83')]&&_0x5d3705[_0x15af('0x83')]['AudioFromTts']){return base64Decode(_0x5d3705[_0x15af('0x83')][_0x15af('0x85')][_0x15af('0x86')],path[_0x15af('0x3c')](__dirname,'tmp',rs[_0x15af('0x2c')](0x4)+'.wav'))[_0x15af('0x2f')](function(_0x1e24a1){_0x105a94[_0x15af('0x87')]=_0x1e24a1;return _0x105a94;});}return _0x105a94;});};exports[_0x15af('0x88')]=function(){return __dirname;}; \ No newline at end of file +var _0x943a=['writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','stringify','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','googleASR\x20transcription','catch','name','textRequest','source','result','resolvedQuery','action','actionIncomplete','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','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','CustomAction','channelData','CustomActionData','AudioFromTts','audiofile','dirName','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./google','./tilde','../../../config/logger','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','close','unlink','download\x20error','end','WHAT_EVER','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','then','chmodSync','777','split','readFileSync','toString','base64','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','generate','.mp3','audioContent'];(function(_0xbfdcad,_0x38dbed){var _0x81d663=function(_0x2f0f38){while(--_0x2f0f38){_0xbfdcad['push'](_0xbfdcad['shift']());}};_0x81d663(++_0x38dbed);}(_0x943a,0xd2));var _0xa943=function(_0x4ad55e,_0x2aa12e){_0x4ad55e=_0x4ad55e-0x0;var _0x490907=_0x943a[_0x4ad55e];return _0x490907;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xa943('0x0'));var dialogflow=require(_0xa943('0x1'));var fs=require('fs');var http=require('http');var https=require(_0xa943('0x2'));var md5=require(_0xa943('0x3'));var path=require(_0xa943('0x4'));var querystring=require(_0xa943('0x5'));var rp=require(_0xa943('0x6'));var rs=require(_0xa943('0x7'));var sox=require(_0xa943('0x8'));var tts=require(_0xa943('0x9'));var urlParse=require(_0xa943('0xa'))[_0xa943('0xb')];var util=require(_0xa943('0xc'));var aws=require('./aws');var google=require(_0xa943('0xd'));var sestek=require('./sestek');var tilde=require(_0xa943('0xe'));var logger=require(_0xa943('0xf'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x4f25d8,_0x5f25e8){return new BPromise(function(_0x3dc1cd,_0x1b9e8f){var _0x411e8d=urlParse(_0x4f25d8);var _0x566f03=_0x411e8d[_0xa943('0x10')]===_0xa943('0x11')?https:http;var _0x276d29={'host':_0x411e8d[_0xa943('0x12')],'path':_0x411e8d[_0xa943('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x566f03[_0xa943('0x13')](_0x276d29,function(_0x4774c5){if(_0x4774c5[_0xa943('0x14')]!==0xc8){logger[_0xa943('0x15')](_0xa943('0x16')+_0x4f25d8+_0xa943('0x17')+_0x4774c5[_0xa943('0x14')]+'\x20('+_0x4774c5[_0xa943('0x18')]+')');_0x1b9e8f(new Error('request\x20to\x20'+_0x4f25d8+_0xa943('0x17')+_0x4774c5[_0xa943('0x14')]+'\x20('+_0x4774c5[_0xa943('0x18')]+')'));return;}var _0x4744e2=fs['createWriteStream'](_0x5f25e8);_0x4744e2['on']('finish',function(){logger[_0xa943('0x19')]('finish\x20download\x20file');_0x4744e2[_0xa943('0x1a')](_0x3dc1cd);});_0x4744e2['on'](_0xa943('0x15'),function(_0x286f30){fs[_0xa943('0x1b')](_0x5f25e8);logger['error'](_0xa943('0x1c'),_0x286f30);_0x1b9e8f(_0x286f30);});_0x4774c5['pipe'](_0x4744e2);})['on'](_0xa943('0x15'),function(_0x472705){logger[_0xa943('0x15')](_0x472705);_0x1b9e8f(_0x472705);})[_0xa943('0x1d')]();});}function uploadFile(_0x24e663){return new BPromise(function(_0x55eeb3,_0x72e119){var _0x4526df=urlParse(_0x24e663);var _0x46d162=_0x4526df[_0xa943('0x10')]==='https:'?https:http;var _0xd749b={'host':_0x4526df[_0xa943('0x12')],'path':_0x4526df[_0xa943('0x4')],'headers':{'user-agent':_0xa943('0x1e')}};_0x46d162['get'](_0xd749b,function(_0x4d08e6){if(_0x4d08e6[_0xa943('0x14')]!==0xc8){_0x72e119(new Error('request\x20to\x20'+_0x24e663+'\x20failed,\x20status\x20code\x20=\x20'+_0x4d08e6[_0xa943('0x14')]+'\x20('+_0x4d08e6[_0xa943('0x18')]+')'));return;}var _0x307352='';_0x4d08e6['on'](_0xa943('0x1f'),function(_0x36e0f9){_0x307352+=_0x36e0f9;});_0x4d08e6['on']('end',function(){_0x55eeb3(_0x307352);});})['on'](_0xa943('0x15'),function(_0x3fef8d){_0x72e119(_0x3fef8d);})[_0xa943('0x1d')]();});}function convertFile(_0x279468,_0xdf3106){return new BPromise(function(_0x2b09cf,_0x404a70){var _0x2657f4=sox[_0xa943('0x20')](_0x279468,_0xdf3106,{'sampleRate':0x1f40,'format':_0xa943('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2657f4['on']('error',function(_0x3d701b){logger[_0xa943('0x15')](_0xa943('0x22'),_0x3d701b);_0x404a70(_0x3d701b);});_0x2657f4['on'](_0xa943('0x1d'),function(){logger[_0xa943('0x19')](_0xa943('0x23'));_0x2b09cf();});_0x2657f4[_0xa943('0x24')]();});}function base64Decode(_0x38062,_0x480093){var _0x41f2ec=path[_0xa943('0x25')](__dirname,_0xa943('0x26'),rs['generate'](0x4)+_0xa943('0x27'));fs['writeFileSync'](_0x41f2ec,_0x38062,'base64');return convertFile(_0x41f2ec,_0x480093)[_0xa943('0x28')](function(){try{fs['unlink'](_0x41f2ec);fs[_0xa943('0x29')](_0x480093,_0xa943('0x2a'));}catch(_0x108f3f){logger['error'](_0x108f3f);}return _0x480093[_0xa943('0x2b')]('.')[0x0];});}function base64Encode(_0x475733){var _0x1a86b8=fs[_0xa943('0x2c')](_0x475733);return new Buffer(_0x1a86b8)[_0xa943('0x2d')](_0xa943('0x2e'));}exports['googleCloudTTS']=function(_0x22cda0,_0x5f6d25,_0x2cffa0,_0x57459c,_0x100b3f,_0x4f33e3){var _0x4e7e8e,_0x496d2a;var _0x1c7cfc=_0xa943('0x2f');var _0x280136=_0xa943('0x30')+_0x22cda0;var _0x2bcc4f={};if(_0x5f6d25===_0xa943('0x31')){_0x2bcc4f[_0xa943('0x32')]={'ssml':_0x2cffa0};}else{_0x2bcc4f['input']={'text':_0x2cffa0};};_0x2bcc4f[_0xa943('0x33')]={'languageCode':_0x57459c,'ssmlGender':_0x100b3f};_0x2bcc4f[_0xa943('0x34')]={'audioEncoding':_0xa943('0x35'),'sampleRateHertz':0x1f40};var _0xf82130={'url':_0x1c7cfc+'text:synthesize'+_0x280136,'method':_0xa943('0x36'),'json':!![],'body':_0x2bcc4f};return rp(_0xf82130)[_0xa943('0x28')](function(_0x36b22a){return new BPromise(function(_0xc90fe8,_0x50d499){_0x4e7e8e=path[_0xa943('0x25')](__dirname,'tmp',rs[_0xa943('0x37')](0x4)+_0xa943('0x38'));var _0x36400a=Buffer['from'](_0x36b22a[_0xa943('0x39')],_0xa943('0x2e'));return fs[_0xa943('0x3a')](_0x4e7e8e,_0x36400a,function(_0x198bfa){_0x50d499(_0x198bfa);},function(_0x4b6a99){fs[_0xa943('0x29')](_0x4e7e8e,'777');_0xc90fe8(_0x4b6a99);});});})[_0xa943('0x28')](function(_0x1d4694){_0x496d2a=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xa943('0x27'));return convertFile(_0x4e7e8e,_0x496d2a);})[_0xa943('0x28')](function(){try{fs[_0xa943('0x1b')](_0x4e7e8e);fs[_0xa943('0x29')](_0x496d2a,_0xa943('0x2a'));}catch(_0x28a9d3){logger['error'](_0x28a9d3);}logger[_0xa943('0x19')](_0xa943('0x3b'),_0x496d2a[_0xa943('0x2b')]('.')[0x0]);return _0x496d2a['split']('.')[0x0];});};exports[_0xa943('0x3c')]=function(_0x20589b,_0x1325e8){var _0x43c282=_0xa943('0x3d');var _0x74f0e6,_0x47a7c3;var _0x4baaaf;var _0x26cbeb={'encoding':'utf8','method':_0xa943('0x36'),'timeout':0x2710,'url':_0x43c282,'headers':{'Content-Type':_0xa943('0x3e')},'body':'f.req='+encodeURIComponent(JSON[_0xa943('0x3f')]([[['jQ1olc',JSON[_0xa943('0x3f')]([_0x20589b,_0x1325e8||'en',![],_0xa943('0x40')]),null,_0xa943('0x41')]]]))};return rp(_0x26cbeb)[_0xa943('0x28')](function(_0x16f3d2){try{_0x4baaaf=eval(_0x16f3d2['slice'](0x5))[0x0][0x2];}catch(_0x1ec502){throw new Error(_0xa943('0x42')+_0x16f3d2['data']);}if(!_0x4baaaf){if(_0x20589b[_0xa943('0x43')]>0xc8){throw new Error(_0xa943('0x44'));}else{throw new Error(_0xa943('0x45')+_0x1325e8+'\x22\x20might\x20not\x20exist');}}try{_0x4baaaf=eval(_0x4baaaf)[0x0];}catch(_0x21fe22){throw new Error(_0xa943('0x42')+res[_0xa943('0x1f')]);}const _0x5d27b1=_0x4baaaf;_0x74f0e6=path[_0xa943('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0xa943('0x38'));fs[_0xa943('0x46')](_0x74f0e6,_0x4baaaf,{'encoding':_0xa943('0x2e')});_0x47a7c3=path[_0xa943('0x25')](__dirname,_0xa943('0x26'),rs[_0xa943('0x37')](0x4)+_0xa943('0x27'));return convertFile(_0x74f0e6,_0x47a7c3);})['then'](function(){try{fs[_0xa943('0x1b')](_0x74f0e6);fs[_0xa943('0x29')](_0x47a7c3,_0xa943('0x2a'));}catch(_0x12d87c){logger[_0xa943('0x15')](_0x12d87c);}logger[_0xa943('0x19')](_0xa943('0x47'),_0x47a7c3[_0xa943('0x2b')]('.')[0x0]);return _0x47a7c3[_0xa943('0x2b')]('.')[0x0];});};exports[_0xa943('0x48')]=function(_0x383e7b,_0x1606c9,_0x2348ea){return google[_0xa943('0x49')](_0x383e7b,_0x1606c9,_0x2348ea)[_0xa943('0x28')](function(_0x46779d){logger[_0xa943('0x19')](_0x46779d[_0xa943('0x4a')]);return rp(_0x46779d);})[_0xa943('0x28')](function(_0x2e96d1){var _0x19f710='';var _0x15f263=0x0;try{fs[_0xa943('0x1b')](_0x383e7b);}catch(_0x189dd3){logger[_0xa943('0x15')](_0x189dd3);}if(_0x2e96d1&&_0x2e96d1[_0xa943('0x4b')]){_0x19f710=_0x2e96d1[_0xa943('0x4b')][_0xa943('0x4c')](function(_0x45c503){return _0x45c503&&_0x45c503[_0xa943('0x4d')][0x0]&&_0x45c503['alternatives'][0x0][_0xa943('0x4e')]?_0x45c503[_0xa943('0x4d')][0x0]['transcript']:'';})[_0xa943('0x4f')]('\x0a');_0x15f263=_0x2e96d1[_0xa943('0x4b')][_0xa943('0x4c')](function(_0x38d317){return _0x38d317&&_0x38d317['alternatives'][0x0]&&_0x38d317[_0xa943('0x4d')][0x0]['confidence']?_0x38d317['alternatives'][0x0]['confidence']:0x0;})[_0xa943('0x4f')]('\x0a');}logger[_0xa943('0x19')](_0xa943('0x50'),_0x19f710);logger['info']('googleASR\x20confidence',_0x15f263);return{'transcript':_0x19f710,'confidence':_0x15f263};})[_0xa943('0x51')](function(_0x43376f){logger[_0xa943('0x15')]('[%s]\x20%s:%s',_0x43376f[_0xa943('0x14')],_0x43376f[_0xa943('0x52')],_0x43376f['message']);});};exports['googleDialogflow']=function(_0x33ed57,_0x28320f,_0x4cd80c,_0x3e9a4f){var _0xa5f099=apiai(_0x28320f,{'language':_0x3e9a4f||'en'});return _0xa5f099[_0xa943('0x53')](_0x4cd80c,{'sessionId':md5(_0x33ed57)})[_0xa943('0x28')](function(_0x36b85e){logger[_0xa943('0x19')](JSON[_0xa943('0x3f')](_0x36b85e));return{'source':_0x36b85e['result'][_0xa943('0x54')],'resolvedQuery':_0x36b85e[_0xa943('0x55')][_0xa943('0x56')],'action':_0x36b85e[_0xa943('0x55')][_0xa943('0x57')],'actionIncomplete':_0x36b85e[_0xa943('0x55')][_0xa943('0x58')],'speech':_0x36b85e[_0xa943('0x55')]['fulfillment'][_0xa943('0x59')],'score':_0x36b85e[_0xa943('0x55')][_0xa943('0x5a')],'statusCode':_0x36b85e[_0xa943('0x5b')][_0xa943('0x5c')],'endConversation':_0x36b85e['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x36b85e['result'][_0xa943('0x5d')][_0xa943('0x5e')]};});};exports[_0xa943('0x5f')]=function(_0x28dc34,_0x2487cd,_0x23adfd,_0x9780d2,_0x275c41,_0xeb84de){var _0x2dccc7=_0x9780d2[_0xa943('0x60')](/\\n/g,'\x0a');var _0x19607d={'credentials':{'private_key':_0x2dccc7,'client_email':_0x23adfd}};var _0x2becc4=new dialogflow['SessionsClient'](_0x19607d);var _0x4a6f9e=_0x2becc4[_0xa943('0x61')](_0x2487cd,md5(_0x28dc34));var _0x44c231={'session':_0x4a6f9e,'queryInput':{'text':{'text':_0x275c41,'languageCode':_0xeb84de}}};return _0x2becc4[_0xa943('0x62')](_0x44c231)['then'](function(_0xddcf4e){if(_0xddcf4e&&_0xddcf4e[_0xa943('0x43')]){logger[_0xa943('0x19')]('Dialogflow\x20V2\x20response:',JSON[_0xa943('0x3f')](_0xddcf4e));var _0x348c7f=_0xddcf4e[0x0];if(_0x348c7f){var _0x128059={'action':_0x348c7f[_0xa943('0x63')][_0xa943('0x57')],'allRequiredParamsPresent':_0x348c7f['queryResult'][_0xa943('0x64')],'endConversation':_0x348c7f[_0xa943('0x63')]['diagnosticInfo']&&_0x348c7f[_0xa943('0x63')]['diagnosticInfo'][_0xa943('0x65')]?_0x348c7f['queryResult']['diagnosticInfo'][_0xa943('0x65')][_0xa943('0x66')][_0xa943('0x67')]:![],'fulfillmentText':_0x348c7f['queryResult'][_0xa943('0x68')],'intentName':_0x348c7f['queryResult'][_0xa943('0x69')]['name'],'intentDisplayName':_0x348c7f[_0xa943('0x63')]['intent'][_0xa943('0x6a')],'isFallbackIntent':_0x348c7f[_0xa943('0x63')][_0xa943('0x69')][_0xa943('0x6b')],'languageCode':_0x348c7f[_0xa943('0x63')][_0xa943('0x6c')],'queryText':_0x348c7f[_0xa943('0x63')][_0xa943('0x6d')],'responseId':_0x348c7f['responseId'],'score':_0x348c7f[_0xa943('0x63')][_0xa943('0x6e')],'speech':_0x348c7f[_0xa943('0x63')][_0xa943('0x68')],'providerResponse':JSON[_0xa943('0x3f')](_0xddcf4e)};return _0x128059;}}});};exports[_0xa943('0x6f')]=function(_0x55f293,_0x31db4e,_0x18edc3,_0x523145){return tilde[_0xa943('0x49')](_0x55f293,_0x31db4e,_0x18edc3,_0x523145)['then'](function(_0x44b4e0){try{fs[_0xa943('0x1b')](_0x55f293);}catch(_0x5354e6){logger[_0xa943('0x15')](_0x5354e6);}logger[_0xa943('0x19')](_0xa943('0x70'),_0x44b4e0[_0xa943('0x4e')]);logger[_0xa943('0x19')](_0xa943('0x71'),_0x44b4e0[_0xa943('0x72')]);return _0x44b4e0;});};exports[_0xa943('0x73')]=function(_0x13af16,_0x4d17b7,_0x11062f,_0x442f57,_0x37f6e4,_0x1a62f7){var _0x47800b=path[_0xa943('0x25')](__dirname,_0xa943('0x26'),rs[_0xa943('0x37')](0x4)+_0xa943('0x38'));var _0x5572af;return aws[_0xa943('0x74')](_0x13af16,_0x4d17b7,_0x11062f,_0x442f57,_0x37f6e4,_0x1a62f7,_0x47800b)['then'](function(){_0x5572af=path[_0xa943('0x25')](__dirname,_0xa943('0x26'),rs[_0xa943('0x37')](0x4)+_0xa943('0x27'));return convertFile(_0x47800b,_0x5572af);})[_0xa943('0x28')](function(){try{fs['unlink'](_0x47800b);fs[_0xa943('0x29')](_0x5572af,_0xa943('0x2a'));}catch(_0x54012b){logger[_0xa943('0x15')](_0x54012b);}return _0x5572af[_0xa943('0x2b')]('.')[0x0];});};exports[_0xa943('0x75')]=function(_0x404065,_0x10359e,_0x108b72,_0x16e45f,_0x5684b1,_0x2d9eaa){return aws[_0xa943('0x76')](_0x404065,_0x10359e,_0x108b72,_0x16e45f,_0x5684b1,_0x2d9eaa)[_0xa943('0x28')](function(_0x5f121e){logger[_0xa943('0x19')](JSON['stringify'](_0x5f121e));return _0x5f121e;});};exports[_0xa943('0x77')]=function(_0x3573ce,_0x121cf6,_0x480c8c,_0x2589f9){var _0x20920e=util[_0xa943('0x78')](_0xa943('0x79'),ISPEECH_API,_0x3573ce,encodeURIComponent(_0x121cf6),_0x480c8c,_0x2589f9);var _0x51850e=path[_0xa943('0x25')](__dirname,_0xa943('0x26'),rs[_0xa943('0x37')](0x4)+'.mp3');var _0x52b8f9;return downloadFile(_0x20920e,_0x51850e)[_0xa943('0x28')](function(){_0x52b8f9=path[_0xa943('0x25')](__dirname,_0xa943('0x26'),rs[_0xa943('0x37')](0x4)+'.wav');return convertFile(_0x51850e,_0x52b8f9);})[_0xa943('0x28')](function(){try{fs['unlink'](_0x51850e);fs['chmodSync'](_0x52b8f9,_0xa943('0x2a'));}catch(_0x11c5c5){logger[_0xa943('0x15')](_0x11c5c5);}return _0x52b8f9[_0xa943('0x2b')]('.')[0x0];});};exports[_0xa943('0x7a')]=function(_0x4961be,_0x44b48f,_0xd8b8a4,_0x391526){var _0x3bbad5=util[_0xa943('0x78')](_0xa943('0x7b'),ISPEECH_API,_0x44b48f,_0xd8b8a4,base64Encode(_0x4961be),_0x391526?util[_0xa943('0x78')]('model=%s',encodeURIComponent(_0x391526)):_0xa943('0x7c'));return uploadFile(_0x3bbad5)['then'](function(_0x4d5932){return querystring[_0xa943('0xb')](_0x4d5932);});};exports[_0xa943('0x7d')]=function(_0xcdc4f,_0x38b96f){return sestek[_0xa943('0x7e')](_0xcdc4f,_0x38b96f)[_0xa943('0x28')](function(_0x1cf208){logger['info'](JSON[_0xa943('0x3f')](_0x1cf208));var _0x4da392={'speech':_0x1cf208[_0xa943('0x7f')],'action':_0x1cf208['channelData']?_0x1cf208['channelData'][_0xa943('0x80')]:undefined,'actiondata':_0x1cf208['channelData']?_0x1cf208[_0xa943('0x81')][_0xa943('0x82')]:undefined};if(_0x1cf208[_0xa943('0x81')]&&_0x1cf208[_0xa943('0x81')][_0xa943('0x83')]){return base64Decode(_0x1cf208[_0xa943('0x81')]['AudioFromTts']['Data'],path['resolve'](__dirname,_0xa943('0x26'),rs[_0xa943('0x37')](0x4)+'.wav'))[_0xa943('0x28')](function(_0x22af30){_0x4da392[_0xa943('0x84')]=_0x22af30;return _0x4da392;});}return _0x4da392;});};exports[_0xa943('0x85')]=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 ec30127..225c2f2 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 _0x53d0=['exports','./nda'];(function(_0x3efe9b,_0x5b41a8){var _0x132073=function(_0x34459e){while(--_0x34459e){_0x3efe9b['push'](_0x3efe9b['shift']());}};_0x132073(++_0x5b41a8);}(_0x53d0,0x1ab));var _0x053d=function(_0x271954,_0x2cad70){_0x271954=_0x271954-0x0;var _0x2fb9f0=_0x53d0[_0x271954];return _0x2fb9f0;};var nda=require(_0x053d('0x0'));module[_0x053d('0x1')]={'nda':nda}; \ No newline at end of file +var _0xb0ed=['./nda','exports'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xb0ed,0x184));var _0xdb0e=function(_0x5ee54d,_0x383db3){_0x5ee54d=_0x5ee54d-0x0;var _0x341f01=_0xb0ed[_0x5ee54d];return _0x341f01;};var nda=require(_0xdb0e('0x0'));module[_0xdb0e('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 3232a0a..9a6a80c 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 _0x5df5=['custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','password','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','uniqueid','dnid','text','Bearer\x20','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction'];(function(_0x2fb511,_0x41cf72){var _0x44d001=function(_0x49f2cb){while(--_0x49f2cb){_0x2fb511['push'](_0x2fb511['shift']());}};_0x44d001(++_0x41cf72);}(_0x5df5,0xb2));var _0x55df=function(_0x406b53,_0x30ade3){_0x406b53=_0x406b53-0x0;var _0x3c83a0=_0x5df5[_0x406b53];return _0x3c83a0;};'use strict';var rp=require(_0x55df('0x0'));var url=require(_0x55df('0x1'));var logger=require(_0x55df('0x2'))(_0x55df('0x3'));module[_0x55df('0x4')]=function(_0x10ac6d,_0x5aa0dc){var _0x194457={'method':'POST','uri':url['resolve'](_0x5aa0dc['ndauth_url'],'/token'),'form':{'grant_type':_0x55df('0x5'),'username':_0x5aa0dc['username'],'password':_0x5aa0dc[_0x55df('0x5')]},'json':!![]};return rp(_0x194457)['then'](function(_0x471645){var _0x36c50f={'method':'POST','uri':url[_0x55df('0x6')](_0x5aa0dc[_0x55df('0x7')],_0x55df('0x8')),'body':{'type':_0x5aa0dc['ndaactivity_type']||_0x55df('0x9'),'channelId':'Nda','conversation':{'id':_0x10ac6d[_0x55df('0xa')]},'from':{'id':_0x10ac6d['callerid'],'name':_0x10ac6d['calleridname']},'recipient':{'id':_0x10ac6d[_0x55df('0xb')],'name':_0x10ac6d['extension']},'text':_0x5aa0dc[_0x55df('0xc')],'channelData':{}},'headers':{'Authorization':_0x55df('0xd')+_0x471645['access_token']},'json':!![]};if(_0x5aa0dc[_0x55df('0xe')]){_0x36c50f[_0x55df('0xf')][_0x55df('0x10')]['ProjectName']=_0x5aa0dc['project'];}if(_0x5aa0dc[_0x55df('0x11')]=='1'){_0x36c50f[_0x55df('0xf')][_0x55df('0x10')][_0x55df('0x12')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x55df('0x13')};}if(_0x5aa0dc[_0x55df('0x14')]){_0x36c50f[_0x55df('0xf')]['channelData'][_0x55df('0x15')]=_0x5aa0dc['custom_action'];if(_0x5aa0dc[_0x55df('0x16')]){_0x36c50f['body'][_0x55df('0x10')][_0x55df('0x17')]=_0x5aa0dc[_0x55df('0x16')];}}logger['info'](JSON[_0x55df('0x18')](_0x36c50f));return rp(_0x36c50f);});}; \ No newline at end of file +var _0x235a=['dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','ndauth_url','password','username','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname'];(function(_0x36f8b7,_0x3c9fa2){var _0x1f3e7d=function(_0x58bcc6){while(--_0x58bcc6){_0x36f8b7['push'](_0x36f8b7['shift']());}};_0x1f3e7d(++_0x3c9fa2);}(_0x235a,0xf8));var _0xa235=function(_0x121319,_0x181c1c){_0x121319=_0x121319-0x0;var _0x2295b3=_0x235a[_0x121319];return _0x2295b3;};'use strict';var rp=require(_0xa235('0x0'));var url=require(_0xa235('0x1'));var logger=require(_0xa235('0x2'))(_0xa235('0x3'));module[_0xa235('0x4')]=function(_0x2c8deb,_0x1405a0){var _0x3c725d={'method':'POST','uri':url['resolve'](_0x1405a0[_0xa235('0x5')],'/token'),'form':{'grant_type':_0xa235('0x6'),'username':_0x1405a0[_0xa235('0x7')],'password':_0x1405a0[_0xa235('0x6')]},'json':!![]};return rp(_0x3c725d)['then'](function(_0x1fc590){var _0xc1482f={'method':'POST','uri':url[_0xa235('0x8')](_0x1405a0[_0xa235('0x9')],_0xa235('0xa')),'body':{'type':_0x1405a0[_0xa235('0xb')]||_0xa235('0xc'),'channelId':_0xa235('0xd'),'conversation':{'id':_0x2c8deb['uniqueid']},'from':{'id':_0x2c8deb[_0xa235('0xe')],'name':_0x2c8deb[_0xa235('0xf')]},'recipient':{'id':_0x2c8deb[_0xa235('0x10')],'name':_0x2c8deb['extension']},'text':_0x1405a0[_0xa235('0x11')],'channelData':{}},'headers':{'Authorization':_0xa235('0x12')+_0x1fc590[_0xa235('0x13')]},'json':!![]};if(_0x1405a0[_0xa235('0x14')]){_0xc1482f[_0xa235('0x15')][_0xa235('0x16')][_0xa235('0x17')]=_0x1405a0[_0xa235('0x14')];}if(_0x1405a0[_0xa235('0x18')]=='1'){_0xc1482f['body'][_0xa235('0x16')][_0xa235('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa235('0x1a')};}if(_0x1405a0[_0xa235('0x1b')]){_0xc1482f[_0xa235('0x15')][_0xa235('0x16')][_0xa235('0x1c')]=_0x1405a0[_0xa235('0x1b')];if(_0x1405a0[_0xa235('0x1d')]){_0xc1482f[_0xa235('0x15')][_0xa235('0x16')][_0xa235('0x1e')]=_0x1405a0['custom_action_data'];}}logger[_0xa235('0x1f')](JSON[_0xa235('0x20')](_0xc1482f));return rp(_0xc1482f);});}; \ 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 5c0dd2d..8d89bdb 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 _0xb24e=['./lib/api','exports'];(function(_0x42d33e,_0x194e00){var _0x121a4f=function(_0xbaedca){while(--_0xbaedca){_0x42d33e['push'](_0x42d33e['shift']());}};_0x121a4f(++_0x194e00);}(_0xb24e,0x178));var _0xeb24=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb24e[_0x40a045];return _0x1a687c;};'use strict';var asr=require(_0xeb24('0x0'));module[_0xeb24('0x1')]=function(_0x12bb83,_0x90488c,_0x5ea7e9,_0x1623a2){return asr(_0x12bb83,_0x90488c,_0x5ea7e9,_0x1623a2);}; \ No newline at end of file +var _0x8dc6=['./lib/api'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x8dc6,0x79));var _0x68dc=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x8dc6[_0x31ced5];return _0x10d9e5;};'use strict';var asr=require(_0x68dc('0x0'));module['exports']=function(_0xd93fc4,_0x57c434,_0x45b6d1,_0x1329f9){return asr(_0xd93fc4,_0x57c434,_0x45b6d1,_0x1329f9);}; \ 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 600e063..cdef27b 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 _0xe9a2=['hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','digest'];(function(_0x1af772,_0xd32696){var _0x172c4d=function(_0x3dd373){while(--_0x3dd373){_0x1af772['push'](_0x1af772['shift']());}};_0x172c4d(++_0xd32696);}(_0xe9a2,0x15c));var _0x2e9a=function(_0x45591a,_0x327a11){_0x45591a=_0x45591a-0x0;var _0x3a033f=_0xe9a2[_0x45591a];return _0x3a033f;};'use strict';var BPromise=require(_0x2e9a('0x0'));var _=require(_0x2e9a('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x2e9a('0x2'));var logger=require(_0x2e9a('0x3'))(_0x2e9a('0x4'));module[_0x2e9a('0x5')]=function(_0xbaa982,_0x50e26b,_0x3605a0,_0x5e5adf){return new BPromise(function(_0x28e04b,_0x294902){logger[_0x2e9a('0x6')](_0x2e9a('0x7'),_0x5e5adf||_0x2e9a('0x8'));var _0x5a43f8=new WebSocket(_0x5e5adf||_0x2e9a('0x8'),{'perMessageDeflate':![]});var _0x2a7e2b='';var _0x3c9e91='0';var _0x5b6fbd='1';var _0x1c6e31=_0x2e9a('0x9');function _0x570720(_0x5ca303){var _0x3251d8=crypto['createHash'](_0x2e9a('0xa'));_0x3251d8['update'](_0x5ca303);return _0x3251d8[_0x2e9a('0xb')](_0x2e9a('0xc'));}function _0x4be545(){try{logger['info'](_0x2e9a('0xd'));var _0x2d9642=moment()['unix']();var _0x222922=_0x570720(_0x2d9642+_0x50e26b+_0x3605a0);_0x5a43f8[_0x2e9a('0xe')](JSON[_0x2e9a('0xf')]({'appID':_0x50e26b,'timestamp':_0x2d9642,'appKey':_0x222922}));var _0x2945cb=fs[_0x2e9a('0x10')](_0xbaa982);_0x2945cb['on'](_0x2e9a('0x11'),function(_0x4342fa){_0x5a43f8[_0x2e9a('0xe')](_0x4342fa);});_0x2945cb['on'](_0x2e9a('0x12'),function(){_0x5a43f8['send']('EOS');});}catch(_0x52b1e5){logger['error'](_0x2e9a('0x13'),JSON['stringify'](_0x52b1e5));_0x5a43f8[_0x2e9a('0x14')]();}}function _0x50af1f(_0x463ea6){try{if(_0x463ea6){var _0x52ed24=JSON['parse'](_0x463ea6);switch(_0x52ed24[_0x2e9a('0x15')]){case 0x0:if(_0x52ed24['result']){if(_0x52ed24[_0x2e9a('0x16')][_0x2e9a('0x17')]){logger['info'](_0x2e9a('0x18'),JSON['stringify'](_0x52ed24['result'][_0x2e9a('0x19')]));_0x2a7e2b=_0x52ed24[_0x2e9a('0x16')][_0x2e9a('0x19')][0x0]['transcript'];_0x3c9e91=_0x52ed24[_0x2e9a('0x16')][_0x2e9a('0x19')][0x0][_0x2e9a('0x1a')];_0x5b6fbd='0';_0x1c6e31=_0x2e9a('0x1b');_0x5a43f8['terminate']();}}break;case 0x1:logger[_0x2e9a('0x6')](_0x2e9a('0x9'));_0x5b6fbd='1';_0x1c6e31='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x2e9a('0x6')](_0x2e9a('0x1c'));_0x5b6fbd='2';_0x1c6e31=_0x2e9a('0x1c');break;case 0x9:logger[_0x2e9a('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x5b6fbd='9';_0x1c6e31='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x2e9a('0x6')](_0x2e9a('0x1d'));_0x5b6fbd='10';_0x1c6e31='Authentication\x20failed.';break;case 0xb:logger[_0x2e9a('0x6')](_0x2e9a('0x1e'));_0x5b6fbd='11';_0x1c6e31=_0x2e9a('0x1e');}}}catch(_0x568489){logger[_0x2e9a('0x1f')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x2e9a('0xf')](_0x568489));_0x5a43f8[_0x2e9a('0x14')]();}}function _0x289a31(){logger[_0x2e9a('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x28e04b({'transcript':_0x2a7e2b,'confidence':_0x3c9e91,'status':_0x5b6fbd,'status_message':_0x1c6e31});}function _0x5e6141(_0x5783d1){logger[_0x2e9a('0x1f')](_0x2e9a('0x20'));if(!_['isNil'](_0x5783d1)){logger[_0x2e9a('0x1f')](_[_0x2e9a('0x21')](_0x5783d1)?JSON[_0x2e9a('0xf')](_0x5783d1):_0x5783d1);}}_0x5a43f8['on'](_0x2e9a('0x22'),_0x4be545);_0x5a43f8['on'](_0x2e9a('0x23'),_0x50af1f);_0x5a43f8['on'](_0x2e9a('0x12'),_0x289a31);_0x5a43f8['on'](_0x2e9a('0x1f'),_0x5e6141);});}; \ No newline at end of file +var _0xc6b5=['isNil','isObject','open','message','bluebird','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','transcript','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket'];(function(_0x29025b,_0x539e92){var _0x41c4c1=function(_0x4f45e6){while(--_0x4f45e6){_0x29025b['push'](_0x29025b['shift']());}};_0x41c4c1(++_0x539e92);}(_0xc6b5,0xac));var _0x5c6b=function(_0x25f154,_0x25a53){_0x25f154=_0x25f154-0x0;var _0x43aaf4=_0xc6b5[_0x25f154];return _0x43aaf4;};'use strict';var BPromise=require(_0x5c6b('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x5c6b('0x1'));var logger=require(_0x5c6b('0x2'))(_0x5c6b('0x3'));module[_0x5c6b('0x4')]=function(_0x4a53e0,_0x294d9c,_0xa25be2,_0x4ef39d){return new BPromise(function(_0x15abc4,_0x59824d){logger[_0x5c6b('0x5')](_0x5c6b('0x6'),_0x4ef39d||_0x5c6b('0x7'));var _0x1e629d=new WebSocket(_0x4ef39d||_0x5c6b('0x7'),{'perMessageDeflate':![]});var _0x1ef61a='';var _0x4f3c9a='0';var _0x435aec='1';var _0x99b725=_0x5c6b('0x8');function _0x283928(_0x3639a0){var _0x255354=crypto[_0x5c6b('0x9')](_0x5c6b('0xa'));_0x255354[_0x5c6b('0xb')](_0x3639a0);return _0x255354[_0x5c6b('0xc')](_0x5c6b('0xd'));}function _0xc6e7b3(){try{logger[_0x5c6b('0x5')](_0x5c6b('0xe'));var _0x57cac8=moment()[_0x5c6b('0xf')]();var _0x575117=_0x283928(_0x57cac8+_0x294d9c+_0xa25be2);_0x1e629d[_0x5c6b('0x10')](JSON['stringify']({'appID':_0x294d9c,'timestamp':_0x57cac8,'appKey':_0x575117}));var _0x375bc9=fs[_0x5c6b('0x11')](_0x4a53e0);_0x375bc9['on'](_0x5c6b('0x12'),function(_0x3e1e10){_0x1e629d[_0x5c6b('0x10')](_0x3e1e10);});_0x375bc9['on'](_0x5c6b('0x13'),function(){_0x1e629d[_0x5c6b('0x10')](_0x5c6b('0x14'));});}catch(_0x536996){logger[_0x5c6b('0x15')](_0x5c6b('0x16'),JSON[_0x5c6b('0x17')](_0x536996));_0x1e629d[_0x5c6b('0x18')]();}}function _0x18bec0(_0x116abb){try{if(_0x116abb){var _0x5af775=JSON[_0x5c6b('0x19')](_0x116abb);switch(_0x5af775[_0x5c6b('0x1a')]){case 0x0:if(_0x5af775[_0x5c6b('0x1b')]){if(_0x5af775['result']['final']){logger[_0x5c6b('0x5')](_0x5c6b('0x1c'),JSON[_0x5c6b('0x17')](_0x5af775[_0x5c6b('0x1b')]['hypotheses']));_0x1ef61a=_0x5af775[_0x5c6b('0x1b')]['hypotheses'][0x0][_0x5c6b('0x1d')];_0x4f3c9a=_0x5af775['result'][_0x5c6b('0x1e')][0x0]['likelihood'];_0x435aec='0';_0x99b725=_0x5c6b('0x1f');_0x1e629d['terminate']();}}break;case 0x1:logger[_0x5c6b('0x5')](_0x5c6b('0x8'));_0x435aec='1';_0x99b725=_0x5c6b('0x8');break;case 0x2:logger[_0x5c6b('0x5')](_0x5c6b('0x20'));_0x435aec='2';_0x99b725='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x5c6b('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x435aec='9';_0x99b725='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x435aec='10';_0x99b725=_0x5c6b('0x21');break;case 0xb:logger[_0x5c6b('0x5')](_0x5c6b('0x22'));_0x435aec='11';_0x99b725='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x51863f){logger[_0x5c6b('0x15')](_0x5c6b('0x23'),JSON[_0x5c6b('0x17')](_0x51863f));_0x1e629d[_0x5c6b('0x18')]();}}function _0xe22ca0(){logger[_0x5c6b('0x5')](_0x5c6b('0x24'));_0x15abc4({'transcript':_0x1ef61a,'confidence':_0x4f3c9a,'status':_0x435aec,'status_message':_0x99b725});}function _0xcadc07(_0x3c1baa){logger[_0x5c6b('0x15')](_0x5c6b('0x25'));if(!_[_0x5c6b('0x26')](_0x3c1baa)){logger[_0x5c6b('0x15')](_[_0x5c6b('0x27')](_0x3c1baa)?JSON['stringify'](_0x3c1baa):_0x3c1baa);}}_0x1e629d['on'](_0x5c6b('0x28'),_0xc6e7b3);_0x1e629d['on'](_0x5c6b('0x29'),_0x18bec0);_0x1e629d['on'](_0x5c6b('0x13'),_0xe22ca0);_0x1e629d['on']('error',_0xcadc07);});}; \ 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 30ffe12..c44b18d 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 _0xd983=['exports','./asr'];(function(_0x2ecdc9,_0x286cae){var _0x414e5f=function(_0x151046){while(--_0x151046){_0x2ecdc9['push'](_0x2ecdc9['shift']());}};_0x414e5f(++_0x286cae);}(_0xd983,0x1df));var _0x3d98=function(_0x30f737,_0x7b62b6){_0x30f737=_0x30f737-0x0;var _0x5919bf=_0xd983[_0x30f737];return _0x5919bf;};var asr=require(_0x3d98('0x0'));module[_0x3d98('0x1')]={'asr':asr}; \ No newline at end of file +var _0x501d=['./asr','exports'];(function(_0x33a4e9,_0x5701bf){var _0x2e4425=function(_0xc6684c){while(--_0xc6684c){_0x33a4e9['push'](_0x33a4e9['shift']());}};_0x2e4425(++_0x5701bf);}(_0x501d,0x94));var _0xd501=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x501d[_0x14add3];return _0x4a174f;};var asr=require(_0xd501('0x0'));module[_0xd501('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index d5a5d3d..5fbcf7a 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 _0xfc65=['net','events','EventEmitter','./error','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','createServer','listening','emit','connection','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util'];(function(_0x16fe6e,_0x4e0559){var _0x428b7d=function(_0x5872e9){while(--_0x5872e9){_0x16fe6e['push'](_0x16fe6e['shift']());}};_0x428b7d(++_0x4e0559);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x2d378e,_0x685d14){_0x2d378e=_0x2d378e-0x0;var _0x1f3ea5=_0xfc65[_0x2d378e];return _0x1f3ea5;};'use strict';var util=require(_0x5fc6('0x0'));var net=require(_0x5fc6('0x1'));var EventEmitter=require(_0x5fc6('0x2'))[_0x5fc6('0x3')];var AGIError=require(_0x5fc6('0x4'));var AGIChannel=require(_0x5fc6('0x5'));var AGIServer=function(_0x355810,_0x15af25,_0xe1ad23){var _0x4e09e0=this,_0x355810=_0x355810||0x11dd,_0x15af25=_0x15af25||_0x5fc6('0x6'),_0x2e1c2b=null,_0x3e9bf3=0x0;EventEmitter[_0x5fc6('0x7')](_0x4e09e0);function _0x5c93f7(){if(!_0x355810){_0x4e09e0['emit'](_0x5fc6('0x8'),new AGIError(_0x5fc6('0x9')));return![];}_0x2e1c2b=net[_0x5fc6('0xa')]();_0x2e1c2b['listen'](_0x355810,_0x15af25);_0x2e1c2b['on'](_0x5fc6('0xb'),function(){_0x4e09e0[_0x5fc6('0xc')]('listening');});_0x2e1c2b['on'](_0x5fc6('0xd'),function(_0x3a0a5c){_0x2e1c2b['getConnections'](function(_0x5b2256,_0x3caadc){if(_0x5b2256){_0x4e09e0[_0x5fc6('0xc')](_0x5fc6('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x5b2256));}else if(_0xe1ad23&&_0xe1ad23<0x0){_0x4e09e0[_0x5fc6('0xc')](_0x5fc6('0x8'),new AGIError(_0x5fc6('0xe')));_0x3a0a5c[_0x5fc6('0xf')]();}else if(_0xe1ad23&&_0xe1ad23>0x0&&_0xe1ad23<_0x3caadc){_0x3e9bf3+=0x1;_0x4e09e0[_0x5fc6('0xc')](_0x5fc6('0x8'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x3e9bf3));_0x3a0a5c[_0x5fc6('0xf')]();}else{var _0x4ee120=new AGIChannel(_0x3a0a5c);_0x4ee120['on'](_0x5fc6('0x10'),function(){_0x4e09e0[_0x5fc6('0xc')](_0x5fc6('0xd'),_0x4ee120);});}});});_0x2e1c2b['on'](_0x5fc6('0x8'),function(_0x5f3eec){_0x4e09e0[_0x5fc6('0xc')]('error',new AGIError(_0x5fc6('0x11'),_0x5f3eec['code']));});_0x2e1c2b['on']('close',function(){_0x4e09e0[_0x5fc6('0xc')](_0x5fc6('0x12'),new AGIError(_0x5fc6('0x13')));});}process[_0x5fc6('0x14')](function(){_0x5c93f7();});};util[_0x5fc6('0x15')](AGIServer,EventEmitter);module[_0x5fc6('0x16')]=function(_0x47c75b,_0x491cc9,_0x299746){return new AGIServer(_0x47c75b,_0x491cc9,_0x299746);}; \ No newline at end of file +var _0x80d9=['emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','events','EventEmitter','./error'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0x80d9,0x15c));var _0x980d=function(_0x355147,_0x22a093){_0x355147=_0x355147-0x0;var _0x39eea8=_0x80d9[_0x355147];return _0x39eea8;};'use strict';var util=require(_0x980d('0x0'));var net=require('net');var EventEmitter=require(_0x980d('0x1'))[_0x980d('0x2')];var AGIError=require(_0x980d('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x358d0a,_0x3a9d1e,_0x38d1b9){var _0x279d93=this,_0x358d0a=_0x358d0a||0x11dd,_0x3a9d1e=_0x3a9d1e||'127.0.0.1',_0x4c3533=null,_0x2fd4b9=0x0;EventEmitter['call'](_0x279d93);function _0x7e96f7(){if(!_0x358d0a){_0x279d93[_0x980d('0x4')](_0x980d('0x5'),new AGIError(_0x980d('0x6')));return![];}_0x4c3533=net[_0x980d('0x7')]();_0x4c3533[_0x980d('0x8')](_0x358d0a,_0x3a9d1e);_0x4c3533['on'](_0x980d('0x9'),function(){_0x279d93['emit']('listening');});_0x4c3533['on']('connection',function(_0x43a0d8){_0x4c3533[_0x980d('0xa')](function(_0x4a9536,_0x1c8a14){if(_0x4a9536){_0x279d93['emit'](_0x980d('0x5'),new AGIError('E_AGI_SERVER_ERROR',_0x4a9536));}else if(_0x38d1b9&&_0x38d1b9<0x0){_0x279d93[_0x980d('0x4')](_0x980d('0x5'),new AGIError(_0x980d('0xb')));_0x43a0d8[_0x980d('0xc')]();}else if(_0x38d1b9&&_0x38d1b9>0x0&&_0x38d1b9<_0x1c8a14){_0x2fd4b9+=0x1;_0x279d93[_0x980d('0x4')](_0x980d('0x5'),new AGIError(_0x980d('0xd'),_0x2fd4b9));_0x43a0d8[_0x980d('0xc')]();}else{var _0x5f524e=new AGIChannel(_0x43a0d8);_0x5f524e['on'](_0x980d('0xe'),function(){_0x279d93[_0x980d('0x4')](_0x980d('0xf'),_0x5f524e);});}});});_0x4c3533['on'](_0x980d('0x5'),function(_0x2f229b){_0x279d93[_0x980d('0x4')]('error',new AGIError(_0x980d('0x10'),_0x2f229b[_0x980d('0x11')]));});_0x4c3533['on']('close',function(){_0x279d93[_0x980d('0x4')]('close',new AGIError(_0x980d('0x12')));});}process[_0x980d('0x13')](function(){_0x7e96f7();});};util[_0x980d('0x14')](AGIServer,EventEmitter);module[_0x980d('0x15')]=function(_0x2a9ce4,_0xc360c4,_0x3ef68b){return new AGIServer(_0x2a9ce4,_0xc360c4,_0x3ef68b);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 00f447a..f058ee4 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 _0x1672=['saveRestApiResult','isPlainObject','%s.%s','setVariable','split','replaceAll','getVariable','extra','result','isConfigured','maxRetry','sync','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','getAndSetVariable','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','application','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','RECOG_CONFIDENCE()','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20is\x20unreachable','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','awslex','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','%s/recordings/%s','beep','NOBEEP','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sendMail','account_id','no\x20mail\x20account\x20configured','email','Smtp','bcc','service','host','port','secure','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','streamFile','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getSound','getSoundPath','getMailAccount','getIntervals','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','exec','trim','replace','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isString'];(function(_0x48faf4,_0x2df3c1){var _0x5d2ab0=function(_0x20aae2){while(--_0x20aae2){_0x48faf4['push'](_0x48faf4['shift']());}};_0x5d2ab0(++_0x2df3c1);}(_0x1672,0x126));var _0x2167=function(_0x485635,_0x42a428){_0x485635=_0x485635-0x0;var _0x577a4f=_0x1672[_0x485635];return _0x577a4f;};'use strict';var fs=require('fs');var path=require(_0x2167('0x0'));var util=require(_0x2167('0x1'));var _=require(_0x2167('0x2'));var sh=require(_0x2167('0x3'));var odbc=require('odbc')();var rs=require(_0x2167('0x4'));var moment=require(_0x2167('0x5'));var Mustache=require(_0x2167('0x6'));var rp=require(_0x2167('0x7'));var logger=require(_0x2167('0x8'))(_0x2167('0x9'));var config=require(_0x2167('0xa'));var scripts=require(_0x2167('0xb'));var FILES_PATH=_0x2167('0xc');var recursiveMapAttributes=[_0x2167('0xd'),_0x2167('0xe')];var verticesWithRetry=[_0x2167('0xf'),_0x2167('0x10'),_0x2167('0x11')];var AGIVertices=function(_0x46632b,_0x579557,_0x4b9be9){this[_0x2167('0x12')]=_0x46632b;this[_0x2167('0x13')]=_0x579557;this['mailRpc']=_0x4b9be9;};AGIVertices['prototype']['getVariable']=function(_0x5d383a,_0x2e95d3){this[_0x2167('0x13')]['getVariableById'](_0x5d383a)[_0x2167('0x14')](function(_0x53ca2e){_0x2e95d3(null,_0x53ca2e?_0x53ca2e[_0x2167('0x15')]:![]);})[_0x2167('0x16')](function(_0x19e2f1){_0x2e95d3(_0x19e2f1);});};AGIVertices[_0x2167('0x17')][_0x2167('0x18')]=function(_0x316763,_0x3c3af5){this[_0x2167('0x13')][_0x2167('0x19')](_0x316763)[_0x2167('0x14')](function(_0x506a51){_0x3c3af5(null,_0x506a51?_0x506a51[_0x2167('0x15')]:![]);})[_0x2167('0x16')](function(_0x253374){_0x3c3af5(_0x253374);});};AGIVertices[_0x2167('0x17')][_0x2167('0x1a')]=function(_0x29f12a,_0x3d3e78){this[_0x2167('0x13')]['getSquareProjectById'](_0x29f12a)[_0x2167('0x14')](function(_0x152e01){_0x3d3e78(null,_0x152e01?_0x152e01[_0x2167('0x15')]:![]);})[_0x2167('0x16')](function(_0x531dd7){_0x3d3e78(_0x531dd7);});};AGIVertices[_0x2167('0x17')][_0x2167('0x1b')]=function(_0x408543,_0x200493){this[_0x2167('0x13')][_0x2167('0x1c')](_0x408543)[_0x2167('0x14')](function(_0x4ddae5){_0x200493(null,_0x4ddae5?_0x4ddae5[_0x2167('0x1d')]:![]);})[_0x2167('0x16')](function(_0x4fbd13){_0x200493(_0x4fbd13);});};AGIVertices[_0x2167('0x17')][_0x2167('0x1e')]=function(_0x17e00c,_0x336d9d){this['rpc'][_0x2167('0x1f')](_0x17e00c)[_0x2167('0x14')](function(_0x2d5341){_0x336d9d(null,_0x2d5341?_0x2d5341[_0x2167('0x15')]:![]);})['catch'](function(_0x104d88){_0x336d9d(_0x104d88);});};AGIVertices[_0x2167('0x17')]['getTrunk']=function(_0x1501d0,_0x4b410c){this['rpc']['getTrunkById'](_0x1501d0)[_0x2167('0x14')](function(_0x1b8ec2){_0x4b410c(null,_0x1b8ec2?_0x1b8ec2['name']:![]);})[_0x2167('0x16')](function(_0x367e16){_0x4b410c(_0x367e16);});};AGIVertices[_0x2167('0x17')][_0x2167('0x20')]=function(_0x39b6e7,_0x560aaa){var _0x4cd81b=this;this[_0x2167('0x13')]['getSoundById'](_0x39b6e7)[_0x2167('0x14')](function(_0x1568cd){_0x560aaa(null,_0x1568cd?_0x4cd81b[_0x2167('0x21')](_0x1568cd['save_name']):![]);})[_0x2167('0x16')](function(_0x5a6a2c){_0x560aaa(_0x5a6a2c);});};AGIVertices[_0x2167('0x17')][_0x2167('0x22')]=function(_0x1a2b8c,_0x56011b){this[_0x2167('0x13')]['getMailAccountById'](_0x1a2b8c)['then'](function(_0xdc7045){_0x56011b(null,_0xdc7045?_0xdc7045:![]);})[_0x2167('0x16')](function(_0x3682cb){_0x56011b(_0x3682cb);});};AGIVertices['prototype']['sendMailMessage']=function(_0x130f4d,_0x5a1290,_0x3773bf){this['mailRpc']['sendMailMessage'](_0x130f4d,_0x5a1290)[_0x2167('0x14')](function(){_0x3773bf(null);})[_0x2167('0x16')](function(_0xab9ede){_0x3773bf(_0xab9ede);});};AGIVertices[_0x2167('0x17')][_0x2167('0x23')]=function(_0x4cc458,_0x5060db){this[_0x2167('0x13')]['getIntervalById'](_0x4cc458)[_0x2167('0x14')](function(_0x24feb9){if(_0x24feb9){if(_0x24feb9['IntervalId']){_0x5060db(null,[_0x24feb9[_0x2167('0x24')]]);}else{_0x5060db(null,_['map'](_0x24feb9[_0x2167('0x25')],_0x2167('0x24')));}}else{_0x5060db(null,![]);}})[_0x2167('0x16')](function(_0x41e7cb){_0x5060db(_0x41e7cb);});};AGIVertices[_0x2167('0x17')][_0x2167('0x21')]=function(_0x5cf437){return util[_0x2167('0x26')](_0x2167('0x27'),FILES_PATH,_0x5cf437);};AGIVertices[_0x2167('0x17')][_0x2167('0x28')]=function(_0x106d71,_0x332065,_0x5f2c24){odbc[_0x2167('0x29')](_0x106d71,function(_0x2b8127){if(_0x2b8127){logger[_0x2167('0x2a')](_0x2167('0x2b'),_0x2b8127);_0x5f2c24(_0x2b8127);}else{logger[_0x2167('0x2c')](_0x2167('0x2d'));odbc[_0x2167('0x2e')](_0x332065,function(_0x594778,_0xf55ccd){if(_0x594778){logger['info'](_0x2167('0x2f'),_0x332065);_0x5f2c24(_0x594778);}else{logger[_0x2167('0x2c')](_0x2167('0x30'),_0x332065);odbc[_0x2167('0x31')](function(_0x3f3f87){if(_0x3f3f87){logger['error'](_0x2167('0x32'),_0x3f3f87);}_0x5f2c24(null,_0xf55ccd);});}});}});};AGIVertices[_0x2167('0x17')][_0x2167('0x33')]=function(_0x3ee9a4,_0x7ff9b8){this[_0x2167('0x13')][_0x2167('0x34')](_0x3ee9a4)['then'](function(_0x44b4a4){_0x7ff9b8(null,_0x44b4a4?_0x44b4a4:![]);})[_0x2167('0x16')](function(_0x3c2f64){_0x7ff9b8(_0x3c2f64);});};AGIVertices[_0x2167('0x17')][_0x2167('0x35')]=function(_0x859b03,_0x13fbc0){this['rpc'][_0x2167('0x35')](_0x859b03)[_0x2167('0x14')](function(_0x492c7a){_0x13fbc0(null,_0x492c7a);})['catch'](function(_0x34623e){_0x13fbc0(_0x34623e);});};AGIVertices[_0x2167('0x17')][_0x2167('0x36')]=function(_0x20e7df,_0x2ccf7b,_0x3bf767){this['rpc'][_0x2167('0x36')]({'uniqueid':this[_0x2167('0x12')][_0x2167('0x37')],'node':_0x20e7df[_0x2167('0x38')],'application':_0x20e7df['agicommand'],'data':_0x2ccf7b||null,'project_name':this[_0x2167('0x12')][_0x2167('0x39')],'callerid':this[_0x2167('0x12')][_0x2167('0x3a')]})['then'](function(_0xc3dfa5){if(_0x3bf767){_0x3bf767(null,_0xc3dfa5);}})[_0x2167('0x16')](function(_0x31ee72){if(_0x3bf767){_0x3bf767(_0x31ee72);}});};AGIVertices[_0x2167('0x17')][_0x2167('0x3b')]=function(_0x2a0c73,_0x1e4c2e,_0x47a717,_0xe852c7){this[_0x2167('0x13')][_0x2167('0x3b')]({'uniqueid':this['channel'][_0x2167('0x37')],'callerid':this[_0x2167('0x12')][_0x2167('0x3a')],'calleridname':this[_0x2167('0x12')][_0x2167('0x3c')],'context':this['channel'][_0x2167('0x3d')],'extension':this[_0x2167('0x12')]['extension'],'priority':this[_0x2167('0x12')][_0x2167('0x3e')],'accountcode':this[_0x2167('0x12')][_0x2167('0x3f')],'dnid':this[_0x2167('0x12')]['dnid'],'projectName':this[_0x2167('0x12')]['arg_1'],'saveName':_0x1e4c2e,'filename':_0x2a0c73[_0x2167('0x40')]||_0x1e4c2e,'savePath':_0x47a717})['then'](function(_0x1757fa){_0xe852c7(null,_0x1757fa);})[_0x2167('0x16')](function(_0x1385ab){_0xe852c7(_0x1385ab);});};AGIVertices[_0x2167('0x17')][_0x2167('0x41')]=function(_0x2baa32,_0x5cb429,_0x315e72,_0x4cb63d,_0x93331a){this[_0x2167('0x13')][_0x2167('0x41')]({'uniqueid':this['channel'][_0x2167('0x37')],'body':_0x2baa32,'direction':_0x5cb429,'providerName':_0x315e72,'providerResponse':_0x4cb63d})[_0x2167('0x14')](function(_0x501eee){if(_0x93331a){_0x93331a(null,_0x501eee);}})[_0x2167('0x16')](function(_0x51676a){if(_0x93331a){_0x93331a(_0x51676a);}});};AGIVertices[_0x2167('0x17')]['createCmContact']=function(_0x222771,_0x59e38e){this[_0x2167('0x13')][_0x2167('0x42')]({'firstName':_[_0x2167('0x43')](_0x222771[_0x2167('0x15')])||_[_0x2167('0x44')](_0x222771['name'])?_0x2167('0x45')+Math[_0x2167('0x46')]():_0x222771[_0x2167('0x15')],'lastName':_[_0x2167('0x43')](_0x222771[_0x2167('0x47')])||_[_0x2167('0x44')](_0x222771[_0x2167('0x47')])?null:_0x222771[_0x2167('0x47')],'phone':_0x222771[_0x2167('0x48')],'ListId':_0x222771[_0x2167('0x49')],'scheduledat':_0x222771['scheduledAt'],'callbackUniqueid':this[_0x2167('0x12')][_0x2167('0x37')],'tags':_0x2167('0x4a'),'description':_0x2167('0x4b')+_0x222771[_0x2167('0x4c')][_0x2167('0x4d')](),'priority':_0x222771[_0x2167('0x4e')]})[_0x2167('0x14')](function(_0x5a6087){_0x59e38e(null,_0x5a6087);})['catch'](function(_0x57bd05){_0x59e38e(_0x57bd05);});};AGIVertices[_0x2167('0x17')][_0x2167('0x4f')]=function(_0x274804,_0x169a41){this['rpc'][_0x2167('0x50')](_0x274804)['then'](function(_0x5128e5){_0x169a41(null,_0x5128e5?_0x5128e5[_0x2167('0x15')]:![]);})[_0x2167('0x16')](function(_0x29e5fc){_0x169a41(_0x29e5fc);});};AGIVertices[_0x2167('0x17')][_0x2167('0x51')]=function(_0xe999e2,_0x2cf08f,_0x41cad1){var _0x219858={'role':_0x2167('0x52')};_0x219858[_0xe999e2]=this[_0x2167('0x12')]['callerid'];this[_0x2167('0x13')][_0x2167('0x51')](_0x219858,_0x2cf08f,this[_0x2167('0x12')]['uniqueid'])[_0x2167('0x14')](function(_0x190e51){_0x41cad1(null,_[_0x2167('0x44')](_0x190e51)?![]:!![]);})[_0x2167('0x16')](function(_0x50fa7e){logger[_0x2167('0x2a')](_0x50fa7e);_0x41cad1(null,![]);});};AGIVertices[_0x2167('0x17')][_0x2167('0x53')]=function(_0x412626,_0x88030){var _0x241849={'role':_0x2167('0x52')};_0x241849[_0x412626]=this[_0x2167('0x12')][_0x2167('0x3a')];this[_0x2167('0x13')][_0x2167('0x53')](_0x241849)[_0x2167('0x14')](function(_0x4bea53){_0x88030(null,_[_0x2167('0x44')](_0x4bea53)?![]:!![]);})[_0x2167('0x16')](function(_0x33fe53){logger[_0x2167('0x2a')](_0x33fe53);_0x88030(null,![]);});};AGIVertices[_0x2167('0x17')][_0x2167('0x54')]=function(_0x2fcf35,_0x5fb5d1){var _0x47cba2={'role':'agent'};_0x47cba2[_0x2fcf35]=this['channel'][_0x2167('0x3a')];this['rpc']['agentLogout'](_0x47cba2)['then'](function(_0x2b5436){_0x5fb5d1(null,_[_0x2167('0x44')](_0x2b5436)?![]:!![]);})[_0x2167('0x16')](function(_0x29133a){logger['error'](_0x29133a);_0x5fb5d1(null,![]);});};AGIVertices[_0x2167('0x17')][_0x2167('0x55')]=function(_0x350616,_0x502e12){var _0x363e47={'role':'agent'};_0x363e47[_0x350616]=this[_0x2167('0x12')]['callerid'];var _0x400b6b=_0x350616!='internal'?util['format'](_0x2167('0x56'),'LOCAL',this[_0x2167('0x12')][_0x2167('0x3a')]):undefined;this[_0x2167('0x13')][_0x2167('0x55')](_0x363e47,_0x400b6b)[_0x2167('0x14')](function(_0x3e6a7a){_0x502e12(null,_['isNil'](_0x3e6a7a)?![]:!![]);})['catch'](function(_0x50a81d){logger[_0x2167('0x2a')](_0x50a81d);_0x502e12(null,![]);});};AGIVertices[_0x2167('0x17')]['shellCommand']=function(_0x5aec73,_0x280a75){sh[_0x2167('0x57')](_[_0x2167('0x58')](_0x5aec73),function(_0x5c277c,_0x432d72){var _0x2388f7=_0x432d72[_0x2167('0x59')](/(\r\n|\n|\r)/gm,'');_0x280a75(null,_0x2388f7);});};AGIVertices[_0x2167('0x17')]['googleCloudTTS']=function(_0x1ab928,_0x2f4461){scripts['googleCloudTTS'](_0x1ab928['apiKey'],_0x1ab928[_0x2167('0x5a')]||_0x2167('0x5b'),_0x1ab928['text'],_0x1ab928[_0x2167('0x5c')]||_0x2167('0x5d'),_0x1ab928[_0x2167('0x5e')]||_0x2167('0x5f'),_0x1ab928[_0x2167('0x60')]||_0x2167('0x61'))[_0x2167('0x14')](function(_0x4fb5a5){_0x2f4461(null,_0x4fb5a5);})[_0x2167('0x16')](function(_0x2b930e){_0x2f4461(_0x2b930e);});};AGIVertices['prototype'][_0x2167('0x62')]=function(_0x36b893,_0x332d56){scripts[_0x2167('0x62')](_0x36b893[_0x2167('0x5b')],_0x36b893[_0x2167('0x63')]||'en',0x1)[_0x2167('0x14')](function(_0x317642){_0x332d56(null,_0x317642);})[_0x2167('0x16')](function(_0x2733c2){_0x332d56(_0x2733c2);});};AGIVertices['prototype'][_0x2167('0x64')]=function(_0x3b1bb4,_0x58017a){var _0x54b6b6={'uri':_0x3b1bb4['url'],'method':_0x3b1bb4[_0x2167('0x65')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3b1bb4[_0x2167('0x66')])===_0x2167('0x67')&&parseInt(_0x3b1bb4['timeout'])>=0x1?parseInt(_0x3b1bb4[_0x2167('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x2167('0x68')]([_0x2167('0x69'),_0x2167('0x6a')],_0x54b6b6[_0x2167('0x65')][_0x2167('0x6b')]())){try{_0x54b6b6[_0x2167('0x6c')]=_0x3b1bb4[_0x2167('0xe')]?JSON[_0x2167('0x6d')](_0x3b1bb4[_0x2167('0xe')]):{};}catch(_0x17ac77){logger[_0x2167('0x2a')](_0x2167('0x6e'),_0x17ac77);}}try{_0x54b6b6[_0x2167('0x6f')]=_0x3b1bb4[_0x2167('0xd')]?JSON[_0x2167('0x6d')](_0x3b1bb4[_0x2167('0xd')]):{};}catch(_0x7f69b6){logger[_0x2167('0x2a')](_0x2167('0x70'),_0x7f69b6);}if(_0x3b1bb4['computedVariables']){try{var _0x5edc97=require(_0x3b1bb4[_0x2167('0x71')])['sync'](this,_0x54b6b6);_0x54b6b6[_0x2167('0x72')]=Mustache[_0x2167('0x73')](_0x3b1bb4[_0x2167('0x74')],_0x5edc97,{},['$$','$$']);if(_0x54b6b6['headers']){_0x54b6b6['headers']=JSON[_0x2167('0x6d')](Mustache[_0x2167('0x73')](JSON['stringify'](_0x54b6b6[_0x2167('0x6f')]),_0x5edc97,{},['$$','$$']));}if(_0x54b6b6['body']){_0x54b6b6['body']=JSON['parse'](Mustache[_0x2167('0x73')](JSON[_0x2167('0x75')](_0x54b6b6[_0x2167('0x6c')]),_0x5edc97,{},['$$','$$']));}}catch(_0x32cb5a){logger[_0x2167('0x2a')](_0x2167('0x76'),_0x32cb5a);}}rp(_0x54b6b6)['then'](function(_0x102c43){var _0x205c9e={'statusCode':_0x102c43[_0x2167('0x77')]||0xc8,'statusMessage':_0x102c43['statusMessage']||'OK','headers':_0x102c43[_0x2167('0x6f')]||{},'body':_0x102c43[_0x2167('0x6c')]||{}};_0x58017a(null,_0x205c9e);})[_0x2167('0x16')](function(_0x1ab8e8){var _0x58083b={'statusCode':_0x1ab8e8[_0x2167('0x77')]||0x1f4,'statusMessage':_0x1ab8e8[_0x2167('0x78')]||_0x2167('0x79'),'headers':_0x1ab8e8[_0x2167('0x7a')][_0x2167('0x6f')]||{},'body':_0x1ab8e8[_0x2167('0x7a')]['body']||{}};_0x58017a(null,_0x58083b);});};AGIVertices[_0x2167('0x17')][_0x2167('0x7b')]=function(_0x486f37,_0x1fa47b){scripts[_0x2167('0x7b')](this['channel'][_0x2167('0x37')],_0x486f37[_0x2167('0x7c')],_0x486f37[_0x2167('0x5b')],_0x486f37[_0x2167('0x7d')]||'en')[_0x2167('0x14')](function(_0x5b797f){_0x1fa47b(null,_0x5b797f);})[_0x2167('0x16')](function(_0x3aaa81){_0x1fa47b(_0x3aaa81);});};AGIVertices[_0x2167('0x17')][_0x2167('0x7e')]=function(_0x1f4400,_0x32df19){scripts[_0x2167('0x7e')](this[_0x2167('0x12')]['uniqueid'],_0x1f4400[_0x2167('0x7f')],_0x1f4400[_0x2167('0x80')],_0x1f4400[_0x2167('0x81')],_0x1f4400['text'],_0x1f4400[_0x2167('0x82')]||'en')[_0x2167('0x14')](function(_0x4bb81f){_0x32df19(null,_0x4bb81f);})[_0x2167('0x16')](function(_0x34d337){_0x32df19(_0x34d337);});};AGIVertices[_0x2167('0x17')][_0x2167('0x83')]=function(_0x36653d,_0x128e32){scripts[_0x2167('0x83')](this[_0x2167('0x12')],_0x36653d)[_0x2167('0x14')](function(_0x9b543c){_0x128e32(null,_0x9b543c);})[_0x2167('0x16')](function(_0x4a5001){_0x128e32(_0x4a5001);});};AGIVertices['prototype'][_0x2167('0x84')]=function(_0x45ea44,_0x3d3fda){scripts[_0x2167('0x84')](_0x45ea44['key'],_0x45ea44[_0x2167('0x5b')],_0x45ea44['ispeech_tts_language']||_0x2167('0x5d'),_0x45ea44['speed'])[_0x2167('0x14')](function(_0x12a989){_0x3d3fda(null,_0x12a989);})[_0x2167('0x16')](function(_0x448983){_0x3d3fda(_0x448983);});};AGIVertices[_0x2167('0x17')]['ispeechASR']=function(_0x293d2f,_0x20fd3f,_0x2e38c0){scripts['ispeechASR'](_0x20fd3f,_0x293d2f[_0x2167('0x7c')],_0x293d2f['ispeech_asr_language']||_0x2167('0x5d'),this['isConfigured'](_0x293d2f[_0x2167('0x85')])?_0x293d2f['model']:undefined)[_0x2167('0x14')](function(_0x1cb955){_0x2e38c0(null,_0x1cb955);})[_0x2167('0x16')](function(_0x4c67f7){_0x2e38c0(_0x4c67f7);});};AGIVertices['prototype'][_0x2167('0x86')]=function(_0x56b570,_0x31f937){scripts[_0x2167('0x86')](_0x56b570[_0x2167('0x87')],_0x56b570[_0x2167('0x88')],_0x56b570[_0x2167('0x89')],_0x56b570['aws_polly_voice']||_0x2167('0x8a'),_0x56b570['text'],_0x56b570[_0x2167('0x8b')]||_0x2167('0x5b'))[_0x2167('0x14')](function(_0x4cf13d){_0x31f937(null,_0x4cf13d);})[_0x2167('0x16')](function(_0x4c6b0d){_0x31f937(_0x4c6b0d);});};AGIVertices[_0x2167('0x17')][_0x2167('0x8c')]=function(_0x273e2a,_0xb834b9){scripts['awsLex'](this['channel']['uniqueid'],_0x273e2a[_0x2167('0x87')],_0x273e2a['aws_secret_access_key'],_0x273e2a[_0x2167('0x8d')],_0x273e2a['text'],_0x273e2a[_0x2167('0x8e')])[_0x2167('0x14')](function(_0x4e9209){_0xb834b9(null,_0x4e9209);})[_0x2167('0x16')](function(_0x21efca){_0xb834b9(_0x21efca);});};AGIVertices[_0x2167('0x17')]['googleASR']=function(_0xecee8c,_0x45b933,_0x5c067f){scripts[_0x2167('0x8f')](_0x45b933,_0xecee8c['key'],_0xecee8c[_0x2167('0x90')]||_0x2167('0x5d'))[_0x2167('0x14')](function(_0x8dbbb8){_0x5c067f(null,_0x8dbbb8);})[_0x2167('0x16')](function(_0x457da4){_0x5c067f(_0x457da4);});};AGIVertices[_0x2167('0x17')][_0x2167('0x91')]=function(_0x113fab,_0xcb95a4,_0x3e3bab){scripts['tildeASR'](_0xcb95a4,_0x113fab[_0x2167('0x92')],_0x113fab[_0x2167('0x93')],_0x113fab[_0x2167('0x72')])[_0x2167('0x14')](function(_0xf7a390){_0x3e3bab(null,_0xf7a390);})[_0x2167('0x16')](function(_0x320463){_0x3e3bab(_0x320463);});};AGIVertices[_0x2167('0x17')][_0x2167('0x94')]=function(_0x227d8d){var _0x2efed7=_[_0x2167('0x68')](verticesWithRetry,_0x227d8d[_0x2167('0x95')])?_0x227d8d:_[_0x2167('0x96')](_0x227d8d);for(var _0x38fdf3 in _0x2efed7){if(_0x2efed7[_0x2167('0x97')](_0x38fdf3)){if(_0x2efed7[_0x38fdf3]&&_['isString'](_0x2efed7[_0x38fdf3])){if(_[_0x2167('0x68')](recursiveMapAttributes,_0x38fdf3)){_0x2efed7[_0x38fdf3]=this[_0x2167('0x98')](_0x2efed7[_0x38fdf3]);}else{_0x2efed7[_0x38fdf3]=this[_0x2167('0x99')](_0x2efed7[_0x38fdf3]);}}}}return _0x2efed7;};AGIVertices[_0x2167('0x17')][_0x2167('0x9a')]=function(_0x2452c6){for(var _0x1acb6c in _0x2452c6){if(_0x2452c6[_0x2167('0x97')](_0x1acb6c)){if(_['isPlainObject'](_0x2452c6[_0x1acb6c])){this[_0x2167('0x9a')](_0x2452c6[_0x1acb6c]);}else if(_[_0x2167('0x9b')](_0x2452c6[_0x1acb6c])){for(var _0x14df06=0x0;_0x14df06<_0x2452c6[_0x1acb6c][_0x2167('0x9c')];_0x14df06++){this['recursiveNodeIndex'](_0x2452c6[_0x1acb6c][_0x14df06]);}}else if(_[_0x2167('0x9d')](_0x2452c6[_0x1acb6c])){_0x2452c6[_0x1acb6c]=this[_0x2167('0x99')](_0x2452c6[_0x1acb6c]);}}}};AGIVertices[_0x2167('0x17')][_0x2167('0x9e')]=function(_0x19870b,_0x4bf0e9){for(var _0xaa80ca in _0x19870b){if(_0x19870b[_0x2167('0x97')](_0xaa80ca)){if(_[_0x2167('0x9f')](_0x19870b[_0xaa80ca])){if(!_['isEmpty'](_0x19870b[_0xaa80ca])){this[_0x2167('0x9e')](_0x19870b[_0xaa80ca],util[_0x2167('0x26')]('%s.%s',_0x4bf0e9,_0xaa80ca));}}else if(_[_0x2167('0x9b')](_0x19870b[_0xaa80ca])){for(var _0x3a0b33=0x0;_0x3a0b33<_0x19870b[_0xaa80ca][_0x2167('0x9c')];_0x3a0b33++){this['saveRestApiResult'](_0x19870b[_0xaa80ca][_0x3a0b33],util[_0x2167('0x26')](_0x2167('0xa0'),_0x4bf0e9,_0xaa80ca+'['+_0x3a0b33+']'));}}else{if(!_['isNil'](_0x19870b[_0xaa80ca])){this['channel'][_0x2167('0xa1')](util[_0x2167('0x26')]('%s.%s',_0x4bf0e9,_0xaa80ca),_0x19870b[_0xaa80ca]);}}}}};AGIVertices['prototype'][_0x2167('0x98')]=function(_0x11c3cb){try{var _0x5b93f6=JSON[_0x2167('0x6d')](_0x11c3cb);this[_0x2167('0x9a')](_0x5b93f6);return JSON[_0x2167('0x75')](_0x5b93f6);}catch(_0x53a7cb){return this[_0x2167('0x99')](_0x11c3cb);}};AGIVertices[_0x2167('0x17')][_0x2167('0x99')]=function(_0x2a5211){var _0x4d7da5=_0x2a5211[_0x2167('0xa2')]('{');for(var _0x4474c4=0x1;_0x4474c4<_0x4d7da5[_0x2167('0x9c')];_0x4474c4+=0x1){var _0x5d1ea2=_0x4d7da5[_0x4474c4][_0x2167('0xa2')]('}');if(_0x5d1ea2[_0x2167('0x9c')]>0x1){_0x2a5211=_0x2a5211[_0x2167('0xa3')]('{'+_0x5d1ea2[0x0]+'}',this[_0x2167('0x12')][_0x2167('0xa4')](_0x5d1ea2[0x0])[_0x2167('0xa5')]||_0x5d1ea2[0x0]);}}if(_0x4d7da5['length']===0x1){return _0x2a5211['toString']();}return this[_0x2167('0x99')](_0x2a5211);};AGIVertices[_0x2167('0x17')]['getAndSetVariable']=function(_0x5ba0d3,_0x3d159e){var _0x3866a5=this[_0x2167('0x12')]['getVariable'](_0x5ba0d3);if(_0x3866a5[_0x2167('0xa6')]===-0x1){return _0x3866a5;}logger[_0x2167('0x2c')](util[_0x2167('0x26')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x3d159e,_0x3866a5[_0x2167('0xa5')]));return this[_0x2167('0x12')]['setVariable'](_0x3d159e,_0x3866a5['extra']);};AGIVertices[_0x2167('0x17')][_0x2167('0xa7')]=function(_0xdbe124){return _0xdbe124&&_0xdbe124!=='0'&&_0xdbe124!=='-1'&&_0xdbe124!=='';};AGIVertices['prototype'][_0x2167('0xa8')]=function(_0x5c1d3c){this[_0x2167('0x36')][_0x2167('0xa9')](this,_0x5c1d3c,'-');_0x5c1d3c[_0x2167('0xaa')]=_0x5c1d3c['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x47213b){logger['info'](util[_0x2167('0x26')](_0x2167('0xab'),_0x47213b[_0x2167('0x38')]));if(!this['isConfigured'](_0x47213b[_0x2167('0x5b')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xad'));}var _0x357a28='\x22'+_0x47213b[_0x2167('0x5b')]+'\x22';if(this[_0x2167('0xa7')](_0x47213b['options'])){_0x357a28+=','+_0x47213b[_0x2167('0x7a')];}var _0x12bffb=this[_0x2167('0x12')][_0x2167('0x57')](_0x2167('0xae'),_0x357a28);if(_0x12bffb[_0x2167('0xa6')]===-0x1){return _0x12bffb;}return this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x357a28));};AGIVertices[_0x2167('0x17')]['mrcprecog']=function(_0x4b3210){logger['info'](util['format'](_0x2167('0xaf'),_0x4b3210['label']));if(!this[_0x2167('0xa7')](_0x4b3210['grammar'])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xb0'));}var _0x10f60d=_0x4b3210[_0x2167('0xb1')];if(this[_0x2167('0xa7')](_0x4b3210[_0x2167('0x7a')])){_0x10f60d+=','+_0x4b3210[_0x2167('0x7a')];}var _0x2e6eb1=this[_0x2167('0x12')][_0x2167('0x57')]('MRCPRecog',_0x10f60d);if(_0x2e6eb1[_0x2167('0xa6')]===-0x1){return _0x2e6eb1;}var _0x5d3d2d=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x2167('0xb2'));if(_0x5d3d2d[_0x2167('0xa6')]===-0x1){return _0x5d3d2d;}var _0x323cd0=this['getAndSetVariable'](_0x2167('0xb3'),_0x2167('0xb4'));if(_0x323cd0[_0x2167('0xa6')]===-0x1){return _0x323cd0;}var _0x2d4f61=this[_0x2167('0xb5')](_0x2167('0xb6'),_0x2167('0xb7'));if(_0x2d4f61[_0x2167('0xa6')]===-0x1){return _0x2d4f61;}return this['channel']['noop'](util[_0x2167('0x26')](_0x2167('0xb8'),_0x10f60d));};AGIVertices[_0x2167('0x17')][_0x2167('0x9')]=function(_0x4be900){logger[_0x2167('0x2c')](util[_0x2167('0x26')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x4be900[_0x2167('0x38')]));return this[_0x2167('0x12')][_0x2167('0x9')]([_0x4be900[_0x2167('0xb9')],_0x4be900[_0x2167('0xba')]]);};AGIVertices[_0x2167('0x17')][_0x2167('0xbb')]=function(_0x5548f4){logger['info'](util[_0x2167('0x26')](_0x2167('0xbc'),_0x5548f4[_0x2167('0x38')]));if(this[_0x2167('0xa7')](_0x5548f4[_0x2167('0x66')])){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0xbd'),_0x5548f4[_0x2167('0x66')]));var _0x3d2d39=this[_0x2167('0x12')]['wait'](_0x5548f4[_0x2167('0x66')]);if(_0x3d2d39[_0x2167('0xa6')]===-0x1){return _0x3d2d39;}}return this[_0x2167('0x12')][_0x2167('0xbb')]();};AGIVertices[_0x2167('0x17')]['callback']=function(_0x16d02c){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0xbe'),_0x16d02c['label']));if(!this['isConfigured'](_0x16d02c['list_id'])){return this['channel']['error'](_0x16d02c,_0x2167('0xbf'));}_0x16d02c[_0x2167('0x4c')]=moment();if(this[_0x2167('0xa7')](_0x16d02c[_0x2167('0xc0')])){_0x16d02c[_0x2167('0x4c')]=moment()[_0x2167('0xc1')](_0x16d02c[_0x2167('0xc0')],'minutes');}if(!this['isConfigured'](_0x16d02c[_0x2167('0x4e')])){_0x16d02c['callback_priority']=0x2;}this[_0x2167('0x42')]['sync'](this,_0x16d02c);return this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0xc2'),_0x16d02c['phone'],_0x16d02c[_0x2167('0x49')],_0x16d02c['scheduledAt']));};AGIVertices[_0x2167('0x17')][_0x2167('0xc3')]=function(_0x31bf25){logger['info'](util[_0x2167('0x26')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x31bf25[_0x2167('0x38')]));var _0x436045=this[_0x2167('0x12')]['exec'](_0x31bf25['application'],_0x31bf25[_0x2167('0x7a')]);if(_0x436045[_0x2167('0xa6')]===-0x1){return _0x436045;}return this[_0x2167('0x12')][_0x2167('0xac')](util['format'](_0x2167('0xc4'),_0x31bf25[_0x2167('0xc5')],_0x31bf25['options']));};AGIVertices['prototype'][_0x2167('0xc6')]=function(_0x291898){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0xc7'),_0x291898[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x291898['text'])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xad'));}var _0x20e758='\x22'+_0x291898[_0x2167('0x5b')]+'\x22';if(this[_0x2167('0xa7')](_0x291898['options'])){_0x20e758+=','+_0x291898[_0x2167('0x7a')];}var _0x2e602e=this[_0x2167('0x12')][_0x2167('0x57')](_0x2167('0xae'),_0x20e758);if(_0x2e602e[_0x2167('0xa6')]===-0x1){return _0x2e602e;}return this[_0x2167('0x12')]['noop'](util[_0x2167('0x26')](_0x2167('0xc8'),_0x20e758));};AGIVertices[_0x2167('0x17')][_0x2167('0xc9')]=function(_0x5742e5){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0xca'),_0x5742e5[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x5742e5[_0x2167('0x5b')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xad'));}var _0x2064b9='\x22'+_0x5742e5[_0x2167('0x5b')]+'\x22';if(this[_0x2167('0xa7')](_0x5742e5[_0x2167('0x7a')])){_0x2064b9+=','+_0x5742e5[_0x2167('0x7a')];}var _0x40b79e=this[_0x2167('0x12')]['exec'](_0x2167('0xae'),_0x2064b9);if(_0x40b79e['result']===-0x1){return _0x40b79e;}return this['channel'][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0xc8'),_0x2064b9));};AGIVertices[_0x2167('0x17')]['lumenvoxasr']=function(_0x4b034c){logger['info'](util['format'](_0x2167('0xcb'),_0x4b034c[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x4b034c[_0x2167('0xb1')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xb0'));}var _0x49867d=_0x4b034c[_0x2167('0xb1')];if(this['isConfigured'](_0x4b034c[_0x2167('0x7a')])){_0x49867d+=','+_0x4b034c[_0x2167('0x7a')];}var _0x1f7a77=this[_0x2167('0x12')]['exec']('MRCPRecog',_0x49867d);if(_0x1f7a77[_0x2167('0xa6')]===-0x1){return _0x1f7a77;}var _0x4e9993=this['getAndSetVariable'](_0x2167('0xcc'),'LUMENVOX_ASR_CONFIDENCE');if(_0x4e9993['result']===-0x1){return _0x4e9993;}var _0x436aef=this[_0x2167('0xb5')](_0x2167('0xb3'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x436aef[_0x2167('0xa6')]===-0x1){return _0x436aef;}var _0xbf7733=this['getAndSetVariable']('RECOG_INSTANCE()',_0x2167('0xcd'));if(_0xbf7733[_0x2167('0xa6')]===-0x1){return _0xbf7733;}return this['channel']['noop'](util[_0x2167('0x26')](_0x2167('0xb8'),_0x49867d));};AGIVertices[_0x2167('0x17')]['sestekasr']=function(_0x43873c){logger['info'](util[_0x2167('0x26')](_0x2167('0xce'),_0x43873c['label']));if(!this[_0x2167('0xa7')](_0x43873c[_0x2167('0xb1')])){return this[_0x2167('0x12')]['noop'](_0x2167('0xb0'));}var _0x163ae8=_0x43873c[_0x2167('0xb1')];if(this[_0x2167('0xa7')](_0x43873c['options'])){_0x163ae8+=','+_0x43873c[_0x2167('0x7a')];}var _0x3a76cf=this[_0x2167('0x12')]['exec'](_0x2167('0xcf'),_0x163ae8);if(_0x3a76cf[_0x2167('0xa6')]===-0x1){return _0x3a76cf;}var _0x4136b1=this[_0x2167('0xb5')](_0x2167('0xcc'),_0x2167('0xd0'));if(_0x4136b1[_0x2167('0xa6')]===-0x1){return _0x4136b1;}var _0x267663=this[_0x2167('0xb5')](_0x2167('0xb3'),_0x2167('0xd1'));if(_0x267663[_0x2167('0xa6')]===-0x1){return _0x267663;}var _0x4c3810=this[_0x2167('0xb5')](_0x2167('0xb6'),_0x2167('0xd2'));if(_0x4c3810[_0x2167('0xa6')]===-0x1){return _0x4c3810;}return this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0xb8'),_0x163ae8));};AGIVertices[_0x2167('0x17')][_0x2167('0xd3')]=function(_0x13127b){logger['info'](util['format'](_0x2167('0xd4'),_0x13127b[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x13127b[_0x2167('0xd5')])){return this[_0x2167('0x12')]['error'](_0x13127b,'no\x20database\x20selected');}var _0x18b595=this[_0x2167('0x1b')][_0x2167('0xa9')](this,_0x13127b[_0x2167('0xd5')]);if(!_0x18b595){return this['channel'][_0x2167('0x2a')](_0x13127b,_0x2167('0xd6'));}if(!this[_0x2167('0xa7')](_0x13127b[_0x2167('0x2e')])){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x13127b,_0x2167('0xd7'));}var _0x3893d8=_0x13127b[_0x2167('0x2e')][_0x2167('0x59')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0x2167('0x26')](_0x2167('0xd8'),_0x3893d8));var _0x26d782=this[_0x2167('0x28')][_0x2167('0xa9')](this,_0x18b595,_0x3893d8);this[_0x2167('0x36')][_0x2167('0xa9')](this,_0x13127b,_0x3893d8);if(!this[_0x2167('0xa7')](_0x13127b[_0x2167('0xd9')])){return this[_0x2167('0x12')]['noop'](_0x2167('0xda'));}var _0xd8e1ac=this[_0x2167('0xa4')][_0x2167('0xa9')](this,_0x13127b[_0x2167('0xd9')]);if(!_0xd8e1ac){return this['channel'][_0x2167('0x2a')](_0x13127b,_0x2167('0xdb'));}var _0x4b49f7=this;_0x26d782[_0x2167('0xdc')](function(_0x3f55ff,_0x42cee0){Object[_0x2167('0xdd')](_0x3f55ff)[_0x2167('0xdc')](function(_0x411412){_0x4b49f7['channel']['setVariable'](util['format'](_0x2167('0xde'),_0xd8e1ac,_0x42cee0,_0x411412),_0x3f55ff[_0x411412]);});});this[_0x2167('0x12')][_0x2167('0xa1')](util['format'](_0x2167('0xdf'),_0xd8e1ac),_0x26d782[_0x2167('0x9c')]);return this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0xe0'),_0xd8e1ac));};AGIVertices[_0x2167('0x17')]['dial']=function(_0x297292){logger[_0x2167('0xe1')](util[_0x2167('0x26')](_0x2167('0xe2'),_0x297292[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x297292['sip_id'])){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x297292,'no\x20user\x20selected');}var _0x3faff4=this[_0x2167('0x1e')][_0x2167('0xa9')](this,_0x297292[_0x2167('0xe3')]);if(!_0x3faff4){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x297292,_0x2167('0xe4'));}var _0x5ac132=this[_0x2167('0x12')][_0x2167('0x57')]('DIAL',[util[_0x2167('0x26')](_0x2167('0xe5'),_0x3faff4),_0x297292[_0x2167('0x66')],_0x297292[_0x2167('0xe6')],_0x297292[_0x2167('0x74')]]);if(_0x5ac132[_0x2167('0xa6')]===-0x1){return _0x5ac132;}return this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')]('Executed\x20command\x20%s',_0x2167('0xe7')));};AGIVertices['prototype'][_0x2167('0xe8')]=function(_0x3fd95d){logger[_0x2167('0x2c')](util['format'](_0x2167('0xe9'),_0x3fd95d['label']));if(!this[_0x2167('0xa7')](_0x3fd95d['key'])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xea'));}if(!this[_0x2167('0xa7')](_0x3fd95d[_0x2167('0x5b')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xad'));}this[_0x2167('0x12')][_0x2167('0xeb')]=!![];this[_0x2167('0x36')](_0x3fd95d);this[_0x2167('0x41')](_0x3fd95d[_0x2167('0x5b')],'in','','');this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0xec'),_0x3fd95d[_0x2167('0x5b')]));var _0x484e74=this[_0x2167('0x7b')][_0x2167('0xa9')](this,_0x3fd95d);if(_0x484e74){for(var _0x5a7679 in _0x484e74){if(_0x484e74[_0x2167('0x97')](_0x5a7679)){this[_0x2167('0x12')]['setVariable'](util[_0x2167('0x26')](_0x2167('0xed'),_0x5a7679[_0x2167('0x6b')]()),_0x484e74[_0x5a7679]);}}this[_0x2167('0x41')](_0x484e74[_0x2167('0xee')],'out',_0x2167('0xe8'),'');return this[_0x2167('0x12')][_0x2167('0xac')](util['format']('Dialogflow\x20Result\x20%s',_0x484e74['speech']));}return this['channel'][_0x2167('0x2a')](_0x3fd95d,_0x2167('0xef'));};AGIVertices[_0x2167('0x17')][_0x2167('0xf0')]=function(_0x4feacb){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0xf1'),_0x4feacb[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x4feacb[_0x2167('0x7f')])){return this['channel'][_0x2167('0xac')](_0x2167('0xf2'));}if(!this[_0x2167('0xa7')](_0x4feacb[_0x2167('0x80')])){return this[_0x2167('0x12')][_0x2167('0xac')]('no\x20client_email\x20configured');}if(!this[_0x2167('0xa7')](_0x4feacb['private_key'])){return this[_0x2167('0x12')][_0x2167('0xac')]('no\x20private_key\x20configured');}if(!this[_0x2167('0xa7')](_0x4feacb[_0x2167('0x82')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xf3'));}if(!this['isConfigured'](_0x4feacb[_0x2167('0x5b')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xad'));}this['channel']['bot']=!![];this[_0x2167('0x36')](_0x4feacb);this[_0x2167('0x41')](_0x4feacb['text'],'in','','');this[_0x2167('0x12')]['noop'](util[_0x2167('0x26')](_0x2167('0xf4'),_0x4feacb[_0x2167('0x5b')]));var _0x25b115=this[_0x2167('0x7e')][_0x2167('0xa9')](this,_0x4feacb);if(_0x25b115){for(var _0x110134 in _0x25b115){if(_0x25b115['hasOwnProperty'](_0x110134)){if(_0x110134!==_0x2167('0xf5')){this['channel']['setVariable'](util[_0x2167('0x26')](_0x2167('0xed'),_0x110134['toUpperCase']()),_0x25b115[_0x110134]);}}}this['createSquareMessage'](_0x25b115[_0x2167('0xee')],_0x2167('0xf6'),_0x2167('0xf0'),_0x25b115[_0x2167('0xf5')]);return this['channel'][_0x2167('0xac')](util[_0x2167('0x26')]('DialogflowV2\x20Result\x20%s',_0x25b115['speech']));}return this[_0x2167('0x12')][_0x2167('0x2a')](_0x4feacb,_0x2167('0xf7'));};AGIVertices[_0x2167('0x17')]['sesteknda']=function(_0xb4ff8e){logger[_0x2167('0x2c')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xb4ff8e['label']));if(!this['isConfigured'](_0xb4ff8e['ndauth_url'])){return this['channel']['noop'](_0x2167('0xf8'));}if(!this['isConfigured'](_0xb4ff8e[_0x2167('0xf9')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xfa'));}if(!this[_0x2167('0xa7')](_0xb4ff8e['password'])){return this['channel'][_0x2167('0xac')](_0x2167('0xfb'));}if(!this['isConfigured'](_0xb4ff8e['ndassistant_url'])){return this[_0x2167('0x12')]['noop'](_0x2167('0xad'));}this[_0x2167('0x12')][_0x2167('0xeb')]=!![];this[_0x2167('0x36')](_0xb4ff8e);this[_0x2167('0x41')](_0xb4ff8e['text'],'in','','');this['channel'][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0xfc'),_0xb4ff8e[_0x2167('0x5b')]));var _0xda1fdd=this[_0x2167('0x83')][_0x2167('0xa9')](this,_0xb4ff8e);if(_0xda1fdd){for(var _0x347ce1 in _0xda1fdd){if(_0xda1fdd[_0x2167('0x97')](_0x347ce1)){this[_0x2167('0x12')][_0x2167('0xa1')](util[_0x2167('0x26')](_0x2167('0xfd'),_0x347ce1['toUpperCase']()),_0xda1fdd[_0x347ce1]);}}this[_0x2167('0x41')](_0xda1fdd['speech'],_0x2167('0xf6'),'sesteknda','');if(_0xda1fdd[_0x2167('0xfe')]){this[_0x2167('0x12')]['noop'](util[_0x2167('0x26')](_0x2167('0xff'),_0xda1fdd[_0x2167('0xfe')]));var _0x5658c4=this[_0x2167('0x12')]['streamFile'](_0xda1fdd[_0x2167('0xfe')]);try{fs[_0x2167('0x100')](_0xda1fdd['audiofile']+'.wav');}catch(_0x4ee6ba){logger['error'](_0x4ee6ba);}return _0x5658c4;}else{return this[_0x2167('0x12')][_0x2167('0xac')](util['format'](_0x2167('0x101'),_0xda1fdd['speech']));}}return this[_0x2167('0x12')]['error'](_0xb4ff8e,_0x2167('0x102'));};AGIVertices['prototype'][_0x2167('0x103')]=function(_0x1d56ee){logger[_0x2167('0x2c')](util[_0x2167('0x26')]('Enter\x20in\x20END\x20(%s)\x20block',_0x1d56ee[_0x2167('0x38')]));return this['channel'][_0x2167('0xac')](_0x2167('0x103'));};AGIVertices['prototype'][_0x2167('0x104')]=function(_0xfc66a8){logger['info'](util[_0x2167('0x26')](_0x2167('0x105'),_0xfc66a8[_0x2167('0x38')]));var _0x27113f='';if(_0xfc66a8['trunk_id']){if(!this['isConfigured'](_0xfc66a8['trunk_id'])){return this[_0x2167('0x12')][_0x2167('0x2a')](_0xfc66a8,_0x2167('0x106'));}else{var _0x52f9a4=parseInt(_0xfc66a8[_0x2167('0x107')],0xa);if(isNaN(_0x52f9a4)){_0x27113f=_0xfc66a8[_0x2167('0x107')];}else{_0x27113f=this[_0x2167('0x108')][_0x2167('0xa9')](this,_0xfc66a8[_0x2167('0x107')]);if(!_0x27113f){return this[_0x2167('0x12')][_0x2167('0x2a')](_0xfc66a8,_0x2167('0x109'));}}}}else if(_0xfc66a8[_0x2167('0x10a')]){_0x27113f=_0xfc66a8['trunk_name'];}else{return this[_0x2167('0x12')][_0x2167('0x2a')](_0xfc66a8,_0x2167('0x106'));}var _0x389a57=this['channel']['exec'](_0x2167('0xe7'),[util[_0x2167('0x26')](_0x2167('0x10b'),_0x27113f,_0xfc66a8[_0x2167('0x48')]),_0xfc66a8[_0x2167('0x66')],_0xfc66a8[_0x2167('0xe6')],_0xfc66a8[_0x2167('0x74')]]);if(_0x389a57['result']===-0x1){return _0x389a57;}return this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')]('Executed\x20command\x20%s',_0x2167('0xe7')));};AGIVertices['prototype'][_0x2167('0x10c')]=function(_0x3e9d7c){logger[_0x2167('0x2c')](util[_0x2167('0x26')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x3e9d7c['label']));return this[_0x2167('0x12')]['noop']('finally');};AGIVertices[_0x2167('0x17')][_0x2167('0x10')]=function(_0x3b55bf){logger[_0x2167('0x2c')](util[_0x2167('0x26')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3b55bf[_0x2167('0x38')]));if(_0x3b55bf['retry']===0x0){return this['maxRetry'](_0x3b55bf);}_0x3b55bf[_0x2167('0xaa')]-=0x1;if(!this[_0x2167('0xa7')](_0x3b55bf[_0x2167('0x10d')])){return this[_0x2167('0x12')]['error'](_0x3b55bf,_0x2167('0x10e'));}var _0x289dd4=this[_0x2167('0x20')][_0x2167('0xa9')](this,_0x3b55bf['file_id']);if(!_0x289dd4){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x3b55bf,_0x2167('0x10f'));}if(!this[_0x2167('0xa7')](_0x3b55bf['variable_id'])){return this[_0x2167('0x12')][_0x2167('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3ce317=this[_0x2167('0x12')][_0x2167('0x110')](_0x289dd4,_0x3b55bf[_0x2167('0x111')],_0x3b55bf[_0x2167('0x112')]);var _0x27c7e2=_0x3ce317[_0x2167('0xa6')]?_0x3ce317[_0x2167('0xa6')][_0x2167('0x4d')]():'';logger[_0x2167('0x2c')](_0x2167('0x113'),JSON[_0x2167('0x75')](_0x3ce317));if(_0x3ce317['result']===-0x1){this['createSquareDetailsReport'][_0x2167('0xa9')](this,_0x3b55bf,_0x27c7e2);return _0x3ce317;}else if(_0x3ce317[_0x2167('0xa5')]==='timeout'){_0x3ce317[_0x2167('0xa6')]=_0x27c7e2[_0x2167('0x9c')]>=parseInt(_0x3b55bf['mindigit'])?'x':'i';}else{_0x3ce317[_0x2167('0xa6')]=_0x27c7e2['length']>=parseInt(_0x3b55bf[_0x2167('0x114')])&&_0x27c7e2['length']<=parseInt(_0x3b55bf[_0x2167('0x112')])?'x':'i';}var _0x1e436a=this[_0x2167('0xa4')]['sync'](this,_0x3b55bf[_0x2167('0xd9')]);if(!_0x1e436a){return this[_0x2167('0x12')]['error'](_0x3b55bf,_0x2167('0xdb'));}this[_0x2167('0x12')]['setVariable'](_0x1e436a,_0x27c7e2);if(this[_0x2167('0xa7')](_0x3b55bf[_0x2167('0x115')])){var _0x211086=parseInt(_0x3b55bf[_0x2167('0x115')],0xa);var _0x1a9a7d=rs[_0x2167('0x116')]({'charset':'*','length':_0x211086});var _0x2ade3f=_0x27c7e2['length'];if(_0x2ade3f>0x0){if(_0x2ade3f>_0x211086){this[_0x2167('0x36')][_0x2167('0xa9')](this,_0x3b55bf,_0x3b55bf[_0x2167('0x117')]===_0x2167('0x118')?_0x1a9a7d+_0x27c7e2['substr'](_0x211086):_0x27c7e2[_0x2167('0x119')](0x0,_0x2ade3f-_0x211086)+_0x1a9a7d);}else{this[_0x2167('0x36')][_0x2167('0xa9')](this,_0x3b55bf,rs['generate']({'charset':'*','length':_0x2ade3f}));}}else{this[_0x2167('0x36')][_0x2167('0xa9')](this,_0x3b55bf,'');}}else{this[_0x2167('0x36')][_0x2167('0xa9')](this,_0x3b55bf,_0x27c7e2);}return _0x3ce317;};AGIVertices[_0x2167('0x17')][_0x2167('0x11')]=function(_0x2b7fe5){logger[_0x2167('0x2c')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x2b7fe5[_0x2167('0x38')]));return this[_0x2167('0x10')](_0x2b7fe5);};AGIVertices[_0x2167('0x17')][_0x2167('0x11a')]=function(_0x2ba077){logger[_0x2167('0x2c')](util[_0x2167('0x26')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x2ba077[_0x2167('0x38')]));this[_0x2167('0x36')][_0x2167('0xa9')](this,_0x2ba077,_0x2ba077['goalname']);return this[_0x2167('0x12')]['noop'](util[_0x2167('0x26')](_0x2167('0x11b'),_0x2ba077[_0x2167('0x11c')]));};AGIVertices[_0x2167('0x17')][_0x2167('0x11d')]=function(_0x42df13){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x11e'),_0x42df13[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x42df13[_0x2167('0x87')])||!this['isConfigured'](_0x42df13[_0x2167('0x88')])){return this['channel']['noop'](_0x2167('0x11f'));}if(!this[_0x2167('0xa7')](_0x42df13[_0x2167('0x5b')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xad'));}this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0x120'),_0x42df13[_0x2167('0x5b')]));var _0x3675c2=this[_0x2167('0x86')][_0x2167('0xa9')](this,_0x42df13);if(_0x3675c2){this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0x121'),_0x3675c2));var _0x17decb=this[_0x2167('0x12')]['streamFile'](_0x3675c2);try{fs[_0x2167('0x100')](_0x3675c2+_0x2167('0x122'));}catch(_0x3578ee){logger[_0x2167('0x2a')](_0x3578ee);}return _0x17decb;}return this['channel']['error'](_0x42df13,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x2167('0x17')][_0x2167('0x123')]=function(_0x2f2d04){logger[_0x2167('0x2c')](util[_0x2167('0x26')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x2f2d04[_0x2167('0x38')]));if(!this['isConfigured'](_0x2f2d04[_0x2167('0x87')])||!this[_0x2167('0xa7')](_0x2f2d04[_0x2167('0x88')])){return this[_0x2167('0x12')][_0x2167('0xac')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x2f2d04[_0x2167('0x8e')])){return this['channel']['noop']('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x2f2d04[_0x2167('0x5b')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xad'));}this[_0x2167('0x12')][_0x2167('0xeb')]=!![];this['createSquareDetailsReport'](_0x2f2d04);this['createSquareMessage'](_0x2f2d04[_0x2167('0x5b')],'in','','');this[_0x2167('0x12')]['noop'](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x2f2d04[_0x2167('0x5b')]));var _0x38ddd6=this[_0x2167('0x8c')]['sync'](this,_0x2f2d04);if(_0x38ddd6){for(var _0x2dc443 in _0x38ddd6){if(_0x38ddd6['hasOwnProperty'](_0x2dc443)&&_[_0x2167('0x9d')](_0x38ddd6[_0x2dc443])){this[_0x2167('0x12')]['setVariable'](util[_0x2167('0x26')](_0x2167('0x124'),_0x2dc443[_0x2167('0x6b')]()),_0x38ddd6[_0x2dc443]);}}if(_[_0x2167('0x44')](_0x38ddd6[_0x2167('0x78')])){return this[_0x2167('0x12')][_0x2167('0xac')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x2167('0x41')](_0x38ddd6[_0x2167('0x78')],'out',_0x2167('0x125'),'');return this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')]('Amazon\x20Lex\x20Result\x20%s',_0x38ddd6[_0x2167('0x78')]));}}return this[_0x2167('0x12')][_0x2167('0x2a')](_0x2f2d04,_0x2167('0x126'));};AGIVertices[_0x2167('0x17')][_0x2167('0x127')]=function(_0x28ef9e){logger['info'](util[_0x2167('0x26')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x28ef9e[_0x2167('0x38')],_0x28ef9e[_0x2167('0x66')]));if(!this[_0x2167('0xa7')](_0x28ef9e[_0x2167('0x7c')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xea'));}var _0x1e4156=_0x2167('0x128');var _0x4ba42d=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x2167('0x116')](0x4));var _0x11be63=util[_0x2167('0x26')](_0x2167('0xa0'),_0x4ba42d,_0x1e4156);var _0x393a77=!![];if(_0x28ef9e['beep']==='NOBEEP'){_0x393a77=![];}var _0x5c8daa=this['channel'][_0x2167('0x129')](_0x4ba42d,_0x1e4156,_0x28ef9e['intKey'],_0x28ef9e['timeout'],undefined,_0x393a77);if(_0x5c8daa[_0x2167('0xa6')]!==-0x1){this[_0x2167('0x12')]['noop'](util[_0x2167('0x26')](_0x2167('0x12a'),_0x11be63));var _0x5d350c=this[_0x2167('0x8f')][_0x2167('0xa9')](this,_0x28ef9e,_0x11be63);if(_0x5d350c){for(var _0x9e3ae9 in _0x5d350c){if(_0x5d350c[_0x2167('0x97')](_0x9e3ae9)){this[_0x2167('0x12')]['setVariable'](util[_0x2167('0x26')](_0x2167('0x12b'),_0x9e3ae9['toUpperCase']()),_0x5d350c[_0x9e3ae9]);}}return this['channel'][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0x12c'),JSON['stringify'](_0x5d350c)));}}return _0x5c8daa;};AGIVertices[_0x2167('0x17')][_0x2167('0x12d')]=function(_0x347d83){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x12e'),_0x347d83[_0x2167('0x38')]));if(!this['isConfigured'](_0x347d83[_0x2167('0x92')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0x12f'));}if(!this[_0x2167('0xa7')](_0x347d83['appsecret'])){return this[_0x2167('0x12')][_0x2167('0xac')]('no\x20appsecret\x20configured');}var _0x1a7dbc=_0x2167('0x128');var _0x24a50b=util['format'](_0x2167('0x130'),FILES_PATH,rs[_0x2167('0x116')](0x4));var _0x56126e=util['format']('%s.%s',_0x24a50b,_0x1a7dbc);var _0x4c1f20=!![];if(_0x347d83[_0x2167('0x131')]===_0x2167('0x132')){_0x4c1f20=![];}var _0x54c4e2=this[_0x2167('0x12')][_0x2167('0x129')](_0x24a50b,_0x1a7dbc,_0x347d83[_0x2167('0x133')],_0x347d83['timeout'],undefined,_0x4c1f20);if(_0x54c4e2[_0x2167('0xa6')]!==-0x1){this[_0x2167('0x12')]['noop'](util['format'](_0x2167('0x134'),_0x56126e));var _0x5afbda=this[_0x2167('0x91')][_0x2167('0xa9')](this,_0x347d83,_0x56126e);if(_0x5afbda){for(var _0x33f58f in _0x5afbda){if(_0x5afbda[_0x2167('0x97')](_0x33f58f)){this[_0x2167('0x12')][_0x2167('0xa1')](util[_0x2167('0x26')](_0x2167('0x135'),_0x33f58f[_0x2167('0x6b')]()),_0x5afbda[_0x33f58f]);}}return this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')]('TildeASR\x20Result\x20%s',JSON[_0x2167('0x75')](_0x5afbda)));}}return _0x54c4e2;};AGIVertices[_0x2167('0x17')]['gotoc']=function(_0x2c6222){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x136'),_0x2c6222[_0x2167('0x38')]));return this[_0x2167('0x12')][_0x2167('0x137')](_0x2c6222['context'],_0x2c6222[_0x2167('0x138')],_0x2c6222[_0x2167('0x3e')]);};AGIVertices[_0x2167('0x17')][_0x2167('0x139')]=function(_0x377834){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x13a'),_0x377834[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x377834[_0x2167('0x13b')])){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x377834,_0x2167('0x13c'));}try{var _0xe60b04=eval(_0x377834[_0x2167('0x13b')])?_0x2167('0x13d'):_0x2167('0x13e');this['channel'][_0x2167('0xac')](util['format'](_0x2167('0x13f'),_0x377834[_0x2167('0x13b')],_0xe60b04));return{'code':0xc8,'result':_0xe60b04};}catch(_0x2b25fb){return{'code':0xc8,'result':_0x2167('0x13e')};}};AGIVertices[_0x2167('0x17')][_0x2167('0x140')]=function(_0x5d4b7d){logger[_0x2167('0x2c')](util['format'](_0x2167('0x141'),_0x5d4b7d[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x5d4b7d[_0x2167('0x142')])){return this['channel'][_0x2167('0x2a')](_0x5d4b7d,_0x2167('0x143'));}var _0x3f2d77=this[_0x2167('0x23')][_0x2167('0xa9')](this,_0x5d4b7d[_0x2167('0x142')]);if(!_0x3f2d77){return this[_0x2167('0x12')]['error'](_0x5d4b7d,_0x2167('0x144'));}for(var _0x5bd1f8=0x0;_0x5bd1f8<_0x3f2d77[_0x2167('0x9c')];_0x5bd1f8+=0x1){var _0x5bffef=this[_0x2167('0x12')][_0x2167('0xa4')](util['format']('IFTIME(%s?true:false)',_0x3f2d77[_0x5bd1f8]));if(_0x5bffef[_0x2167('0xa6')]===-0x1){return _0x5bffef;}logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x145'),_0x3f2d77[_0x5bd1f8],_0x5bffef[_0x2167('0xa5')]));if(_0x5bffef[_0x2167('0xa5')]===_0x2167('0x13d')){logger[_0x2167('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x3f2d77[_0x5bd1f8],_0x2167('0x13d')));this[_0x2167('0x12')]['noop'](util[_0x2167('0x26')](_0x2167('0x145'),_0x3f2d77[_0x5bd1f8],_0x2167('0x13d')));return{'code':0xc8,'result':_0x2167('0x13d')};}else{logger['info'](util[_0x2167('0x26')]('IFTIME\x20%s\x20%s',_0x3f2d77[_0x5bd1f8],'false'));this[_0x2167('0x12')][_0x2167('0xac')](util['format'](_0x2167('0x145'),_0x3f2d77[_0x5bd1f8],_0x2167('0x13e')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x2167('0x17')]['hangup']=function(_0x2f4d5e){logger[_0x2167('0x2c')](util['format'](_0x2167('0x146'),_0x2f4d5e[_0x2167('0x38')]));return this['channel'][_0x2167('0x147')]();};AGIVertices['prototype'][_0x2167('0x148')]=function(_0x3408b9){logger[_0x2167('0x2c')](util[_0x2167('0x26')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x3408b9[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x3408b9[_0x2167('0x7c')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xea'));}var _0x763365=_0x2167('0x128');var _0x576b15=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x2167('0x116')](0x4));var _0x525a68=util[_0x2167('0x26')]('%s.%s',_0x576b15,_0x763365);var _0x2829c2=!![];if(_0x3408b9[_0x2167('0x131')]===_0x2167('0x132')){_0x2829c2=![];}var _0xfd4a58=this[_0x2167('0x12')][_0x2167('0x129')](_0x576b15,_0x763365,_0x3408b9[_0x2167('0x133')],_0x3408b9['timeout'],undefined,_0x2829c2);if(_0xfd4a58[_0x2167('0xa6')]!==-0x1){this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0x149'),_0x525a68));var _0x21b5a8=this['ispeechASR']['sync'](this,_0x3408b9,_0x525a68);if(_0x21b5a8){for(var _0x1c625a in _0x21b5a8){if(_0x21b5a8[_0x2167('0x97')](_0x1c625a)){this['channel'][_0x2167('0xa1')](util['format'](_0x2167('0x14a'),_0x1c625a[_0x2167('0x6b')]()),_0x21b5a8[_0x1c625a]);}}return this[_0x2167('0x12')]['noop'](util['format'](_0x2167('0x14b'),JSON['stringify'](_0x21b5a8)));}}return _0xfd4a58;};AGIVertices[_0x2167('0x17')][_0x2167('0x14c')]=function(_0x1210da){logger[_0x2167('0x2c')](util['format'](_0x2167('0x14d'),_0x1210da['label']));if(!this['isConfigured'](_0x1210da[_0x2167('0x7c')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xea'));}if(!this[_0x2167('0xa7')](_0x1210da[_0x2167('0x5b')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xad'));}this['channel'][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0x14e'),_0x1210da[_0x2167('0x5b')]));var _0x2fe64b=this['ispeechTTS'][_0x2167('0xa9')](this,_0x1210da);if(_0x2fe64b){this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0x149'),_0x2fe64b));var _0xbb2db3=this[_0x2167('0x12')]['streamFile'](_0x2fe64b,_0x1210da[_0x2167('0x133')]);try{fs[_0x2167('0x100')](_0x2fe64b+'.wav');}catch(_0x4a3c71){logger['error'](_0x4a3c71);}return _0xbb2db3;}return this[_0x2167('0x12')]['error'](_0x1210da,_0x2167('0x14f'));};AGIVertices[_0x2167('0x17')]['login']=function(_0x3662ff){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x150'),_0x3662ff[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x3662ff[_0x2167('0x151')])){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x3662ff,_0x2167('0x152'));}logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x153'),this[_0x2167('0x12')][_0x2167('0x3a')],_0x3662ff[_0x2167('0x151')]));var _0x3a54d6=this[_0x2167('0x55')]['sync'](this,_0x3662ff[_0x2167('0x151')]);if(_0x3a54d6){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x154'),this['channel']['callerid'],_0x3662ff[_0x2167('0x151')]));this['channel']['noop'](util[_0x2167('0x26')](_0x2167('0x154'),this[_0x2167('0x12')][_0x2167('0x3a')],_0x3662ff[_0x2167('0x151')]));return{'code':0xc8,'result':_0x2167('0x155')};}else{logger[_0x2167('0x2c')](util[_0x2167('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x2167('0x3a')],_0x3662ff[_0x2167('0x151')]));this[_0x2167('0x12')][_0x2167('0xac')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2167('0x12')]['callerid'],_0x3662ff['findBy']));return{'code':0xc8,'result':_0x2167('0x156')};}};AGIVertices[_0x2167('0x17')]['logout']=function(_0x2cc07a){logger[_0x2167('0x2c')](util['format'](_0x2167('0x157'),_0x2cc07a[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x2cc07a[_0x2167('0x151')])){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x2cc07a,'no\x20find\x20by\x20configured');}logger['info'](util[_0x2167('0x26')](_0x2167('0x153'),this[_0x2167('0x12')][_0x2167('0x3a')],_0x2cc07a[_0x2167('0x151')]));var _0x4dac9b=this[_0x2167('0x54')][_0x2167('0xa9')](this,_0x2cc07a[_0x2167('0x151')]);if(_0x4dac9b){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x154'),this[_0x2167('0x12')]['callerid'],_0x2cc07a[_0x2167('0x151')]));this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2167('0x12')][_0x2167('0x3a')],_0x2cc07a['findBy']));return{'code':0xc8,'result':_0x2167('0x155')};}else{logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x158'),this['channel'][_0x2167('0x3a')],_0x2cc07a[_0x2167('0x151')]));this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2167('0x12')][_0x2167('0x3a')],_0x2cc07a[_0x2167('0x151')]));return{'code':0xc8,'result':_0x2167('0x156')};}};AGIVertices[_0x2167('0x17')]['math']=function(_0x4ce2){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x159'),_0x4ce2[_0x2167('0x38')]));if(!this['isConfigured'](_0x4ce2[_0x2167('0x15a')])){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x4ce2,_0x2167('0x15b'));}this['channel'][_0x2167('0xac')](util[_0x2167('0x26')]('math\x20%s',_0x4ce2[_0x2167('0x15a')]));var _0x5def45=eval(_0x4ce2['operation']);if(!this[_0x2167('0xa7')](_0x4ce2['variable_id'])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xda'));}var _0x481d22=this[_0x2167('0xa4')]['sync'](this,_0x4ce2[_0x2167('0xd9')]);if(!_0x481d22){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x4ce2,'no\x20variable\x20found');}if(_[_0x2167('0x9b')](_0x5def45)){var _0x3864f7=this;_0x5def45['forEach'](function(_0xc8f72b,_0x36e767){_0x3864f7[_0x2167('0x12')][_0x2167('0xa1')](util[_0x2167('0x26')]('%s[%s]',_0x481d22,_0x36e767),_0xc8f72b);});return this['channel']['noop'](util[_0x2167('0x26')](_0x2167('0x15c'),_0x481d22));}else{return this[_0x2167('0x12')][_0x2167('0xa1')](_0x481d22,_0x5def45);}};AGIVertices['prototype']['menu']=function(_0x9e2352){logger['info'](util['format'](_0x2167('0x15d'),_0x9e2352[_0x2167('0x38')]));if(_0x9e2352[_0x2167('0xaa')]===0x0){return this[_0x2167('0xa8')](_0x9e2352);}_0x9e2352[_0x2167('0xaa')]-=0x1;if(!this[_0x2167('0xa7')](_0x9e2352[_0x2167('0x10d')])){return this[_0x2167('0x12')]['error'](_0x9e2352,_0x2167('0x10e'));}var _0x4374df=this[_0x2167('0x20')][_0x2167('0xa9')](this,_0x9e2352[_0x2167('0x10d')]);if(!_0x4374df){return this[_0x2167('0x12')]['error'](_0x9e2352,'no\x20file\x20audio\x20found');}var _0x5bbaf8=this[_0x2167('0x12')]['getData'](_0x4374df,_0x9e2352['response'],_0x9e2352[_0x2167('0x15e')]);var _0x22feb4=_0x5bbaf8[_0x2167('0xa6')];if(_0x5bbaf8[_0x2167('0xa6')]===-0x1){this['createSquareDetailsReport'][_0x2167('0xa9')](this,_0x9e2352,'-1');return _0x5bbaf8;}else if(_0x5bbaf8[_0x2167('0xa5')]==='timeout'){_0x5bbaf8['result']=_0x5bbaf8[_0x2167('0xa6')][_0x2167('0x9c')]>0x0?_0x5bbaf8['result']:'t';}else if(_[_0x2167('0x43')](_0x5bbaf8[_0x2167('0xa6')])){_0x5bbaf8['result']='#';_0x22feb4='#';}if(!this[_0x2167('0xa7')](_0x9e2352[_0x2167('0xd9')])){this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0xda'));}else{var _0x4ec5aa=this['getVariable']['sync'](this,_0x9e2352['variable_id']);if(!_0x4ec5aa){return this['channel'][_0x2167('0x2a')](_0x9e2352,_0x2167('0xdb'));}this[_0x2167('0x12')][_0x2167('0xa1')](_0x4ec5aa,_0x22feb4);}this['createSquareDetailsReport'][_0x2167('0xa9')](this,_0x9e2352,_0x22feb4);return _0x5bbaf8;};AGIVertices[_0x2167('0x17')]['noop']=function(_0x1846c6){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x15f'),_0x1846c6[_0x2167('0x38')]));return this[_0x2167('0x12')]['noop'](_0x1846c6['output']||_0x1846c6[_0x2167('0x38')]);};AGIVertices[_0x2167('0x17')][_0x2167('0x160')]=function(_0x5801a8){logger['info'](util[_0x2167('0x26')](_0x2167('0x161'),_0x5801a8['label']));if(!this[_0x2167('0xa7')](_0x5801a8[_0x2167('0x151')])){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x5801a8,_0x2167('0x152'));}logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x153'),this['channel'][_0x2167('0x3a')],_0x5801a8['findBy']));var _0xecaaaf=this[_0x2167('0x4f')][_0x2167('0xa9')](this,_0x5801a8[_0x2167('0x162')]);var _0x57fe32=this[_0x2167('0x51')][_0x2167('0xa9')](this,_0x5801a8[_0x2167('0x151')],_0xecaaaf);if(_0x57fe32){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x154'),this[_0x2167('0x12')][_0x2167('0x3a')],_0x5801a8[_0x2167('0x151')]));this['channel']['noop'](util[_0x2167('0x26')](_0x2167('0x154'),this['channel'][_0x2167('0x3a')],_0x5801a8['findBy']));return{'code':0xc8,'result':_0x2167('0x155')};}else{logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x158'),this[_0x2167('0x12')][_0x2167('0x3a')],_0x5801a8['findBy']));this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2167('0x12')]['callerid'],_0x5801a8['findBy']));return{'code':0xc8,'result':_0x2167('0x156')};}};AGIVertices[_0x2167('0x17')]['playback']=function(_0x3bf9cb){logger['info'](util[_0x2167('0x26')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3bf9cb[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x3bf9cb[_0x2167('0x10d')])){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x3bf9cb,_0x2167('0x10e'));}var _0x50e82b=this['getSound'][_0x2167('0xa9')](this,_0x3bf9cb['file_id']);if(!_0x50e82b){return this['channel']['error'](_0x3bf9cb,'no\x20file\x20audio\x20found');}var _0x3f42fe=this[_0x2167('0x12')]['exec'](_0x2167('0x163'),[_0x50e82b,_0x3bf9cb[_0x2167('0xe6')]]);if(_0x3f42fe[_0x2167('0xa6')]===-0x1){return _0x3f42fe;}return this['channel'][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0xc4'),'PLAYBACK',_0x50e82b));};AGIVertices[_0x2167('0x17')][_0x2167('0x164')]=function(_0x3af0ba){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x165'),_0x3af0ba[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x3af0ba[_0x2167('0x166')])){return this[_0x2167('0x12')]['error'](_0x3af0ba,_0x2167('0x167'));}var _0x10d071='';var _0x566fe6=parseInt(_0x3af0ba[_0x2167('0x166')],0xa);if(isNaN(_0x566fe6)){_0x10d071=_0x3af0ba[_0x2167('0x166')];}else{_0x10d071=this['getVoiceQueue'][_0x2167('0xa9')](this,_0x3af0ba[_0x2167('0x166')]);if(!_0x10d071){return this[_0x2167('0x12')]['error'](_0x3af0ba,_0x2167('0x168'));}}var _0x43cfce='';if(this['isConfigured'](_0x3af0ba['file_id'])){var _0x544db1=this['getSound'][_0x2167('0xa9')](this,_0x3af0ba[_0x2167('0x10d')]);if(_0x544db1){_0x43cfce=_0x544db1;}}this[_0x2167('0x36')]['sync'](this,_0x3af0ba,_0x10d071);if(_0x3af0ba[_0x2167('0xe6')]['indexOf']('x')<0x0){_0x3af0ba['opts']+='x';}if(_0x3af0ba[_0x2167('0xe6')][_0x2167('0x169')]('X')<0x0){_0x3af0ba[_0x2167('0xe6')]+='X';}this[_0x2167('0x12')][_0x2167('0xa1')](_0x2167('0x16a'),_0x10d071?_0x10d071[_0x2167('0x16b')]():'');var _0x10ede3=this[_0x2167('0x12')][_0x2167('0x57')](_0x2167('0x16c'),[_0x10d071,_0x3af0ba['opts'],_0x3af0ba[_0x2167('0x74')],_0x43cfce,_0x3af0ba['timeout'],_0x3af0ba[_0x2167('0x9')],_0x3af0ba[_0x2167('0x16d')],_0x3af0ba[_0x2167('0x16e')],'',_0x3af0ba[_0x2167('0x16f')]]);if(_0x10ede3[_0x2167('0xa6')]===-0x1){return _0x10ede3;}return this['channel'][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0xc4'),'QUEUE',_0x10d071));};AGIVertices[_0x2167('0x17')][_0x2167('0x170')]=function(_0x7be2e9){logger['info'](util['format'](_0x2167('0x171'),_0x7be2e9[_0x2167('0x38')]));var _0xf704e9=_0x7be2e9[_0x2167('0x172')]||_0x2167('0x128');var _0x46aa9c=util[_0x2167('0x26')]('%s_%s',this[_0x2167('0x12')][_0x2167('0x37')],rs[_0x2167('0x116')](0x5));var _0x2e629e=util[_0x2167('0x26')]('%s/recordings/%s.%s',FILES_PATH,_0x46aa9c,_0xf704e9);var _0x123578=util[_0x2167('0x26')]('%s/recordings/%s',FILES_PATH,_0x46aa9c);this[_0x2167('0x3b')][_0x2167('0xa9')](this,_0x7be2e9,_0x46aa9c,_0x2e629e);this['channel']['setVariable'](_0x2167('0x173'),_0x46aa9c);logger[_0x2167('0x2c')](_0x2167('0x174'),_0x123578,_0xf704e9,_0x7be2e9[_0x2167('0x175')],_0x7be2e9[_0x2167('0x66')]);return this[_0x2167('0x12')][_0x2167('0x129')](_0x123578,_0xf704e9,_0x7be2e9['escape_digits'],_0x7be2e9[_0x2167('0x66')],undefined,!![]);};AGIVertices['prototype'][_0x2167('0x176')]=function(_0x549ef7){logger[_0x2167('0x2c')](util['format'](_0x2167('0x177'),_0x549ef7[_0x2167('0x38')]));if(!this['isConfigured'](_0x549ef7[_0x2167('0x74')])){return this[_0x2167('0x12')]['noop'](_0x2167('0x178'));}var _0x1bd198=this[_0x2167('0x64')][_0x2167('0xa9')](this,_0x549ef7);logger[_0x2167('0x2c')](util['format']('Response:',util[_0x2167('0x179')](_0x1bd198,{'showHidden':![],'depth':null})));if(!this[_0x2167('0xa7')](_0x549ef7[_0x2167('0xd9')])){return this['channel'][_0x2167('0xac')](_0x2167('0x17a'));}var _0xd2ad4e=this[_0x2167('0xa4')][_0x2167('0xa9')](this,_0x549ef7[_0x2167('0xd9')]);if(!_0xd2ad4e){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x549ef7,_0x2167('0xdb'));}this[_0x2167('0x12')]['setVariable'](util['format'](_0x2167('0x17b'),_0xd2ad4e),_0x1bd198[_0x2167('0x77')]?_0x1bd198[_0x2167('0x77')]:'200');this[_0x2167('0x12')]['setVariable'](util[_0x2167('0x26')](_0x2167('0x17c'),_0xd2ad4e),_0x1bd198['statusMessage']?_0x1bd198['statusMessage']:'OK');if(_0x1bd198[_0x2167('0x6c')]){try{this[_0x2167('0x9e')](_0x1bd198[_0x2167('0x6c')],_0xd2ad4e);}catch(_0x210f04){logger[_0x2167('0x2a')](util[_0x2167('0x26')](_0x2167('0x17d'),_0xd2ad4e));}}return this['channel']['noop'](util[_0x2167('0x26')](_0x2167('0xe0'),_0xd2ad4e));};AGIVertices[_0x2167('0x17')]['saydigits']=function(_0x2d513e){logger['info'](util['format'](_0x2167('0x17e'),_0x2d513e[_0x2167('0x38')]));return this[_0x2167('0x12')][_0x2167('0x17f')](_0x2d513e[_0x2167('0x180')]['replace'](/\s+/g,''),_0x2d513e[_0x2167('0x175')]);};AGIVertices[_0x2167('0x17')][_0x2167('0x181')]=function(_0x400cd5){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x182'),_0x400cd5[_0x2167('0x38')]));return this[_0x2167('0x12')][_0x2167('0x183')](_0x400cd5[_0x2167('0x67')][_0x2167('0x59')](/\s+/g,''),_0x400cd5['escape_digits']);};AGIVertices[_0x2167('0x17')][_0x2167('0x184')]=function(_0x22defb){logger[_0x2167('0x2c')](util[_0x2167('0x26')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x22defb[_0x2167('0x38')]));return this[_0x2167('0x12')]['sayPhonetic'](_0x22defb[_0x2167('0x5b')],_0x22defb['escape_digits']);};AGIVertices[_0x2167('0x17')][_0x2167('0x185')]=function(_0x235f02){logger['info'](util[_0x2167('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x235f02[_0x2167('0x38')]));if(!this['isConfigured'](_0x235f02[_0x2167('0x186')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0x187'));}var _0x541c93=this['getMailAccount'][_0x2167('0xa9')](this,_0x235f02[_0x2167('0x186')]);if(!_0x541c93||!_0x541c93['Smtp']){return this['channel']['error'](_0x235f02,'no\x20mail\x20account\x20found');}var _0x3b8171={'from':util['format']('\x22%s\x22\x20<%s>',_0x541c93['name'],_0x541c93[_0x2167('0x188')]||_0x541c93[_0x2167('0x189')]['user']),'to':_0x235f02['to']||'','cc':_0x235f02['cc']||'','bcc':_0x235f02[_0x2167('0x18a')]||'','subject':_0x235f02['subject'],'html':_0x235f02[_0x2167('0x5b')],'text':_0x235f02[_0x2167('0x5b')]};var _0x4e8ed4={'tls':{'rejectUnauthorized':![]}};if(_0x541c93[_0x2167('0x189')][_0x2167('0x18b')]){_0x4e8ed4[_0x2167('0x18b')]=_0x541c93[_0x2167('0x189')][_0x2167('0x18b')];}else{_0x4e8ed4[_0x2167('0x18c')]=_0x541c93[_0x2167('0x189')]['host'];_0x4e8ed4['port']=_0x541c93[_0x2167('0x189')][_0x2167('0x18d')];_0x4e8ed4[_0x2167('0x18e')]=_0x541c93[_0x2167('0x189')][_0x2167('0x18e')];}if(_0x541c93[_0x2167('0x189')]['authentication']){_0x4e8ed4[_0x2167('0x18f')]={'user':_0x541c93[_0x2167('0x189')]['user'],'pass':_0x541c93['Smtp']['pass']};}if(this[_0x2167('0xa7')](_0x235f02[_0x2167('0x190')])){}logger[_0x2167('0xe1')](_0x2167('0x191'),JSON[_0x2167('0x75')](_0x3b8171));this[_0x2167('0x36')][_0x2167('0xa9')](this,_0x235f02,_0x235f02[_0x2167('0x186')]);this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0x192'),_0x541c93[_0x2167('0x15')]));this[_0x2167('0x193')][_0x2167('0xa9')](this,_0x4e8ed4,_0x3b8171);return this['channel'][_0x2167('0xac')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x2167('0x17')][_0x2167('0x194')]=function(_0x4254eb){logger[_0x2167('0x2c')](util['format'](_0x2167('0x195'),_0x4254eb['label']));return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0x196'));};AGIVertices[_0x2167('0x17')][_0x2167('0x197')]=function(_0x6585c){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x198'),_0x6585c[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x6585c[_0x2167('0x199')])){return this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0x19a'));}var _0x244334=this[_0x2167('0x33')]['sync'](this,_0x6585c[_0x2167('0x199')]);if(!_0x244334){return this[_0x2167('0x12')]['error'](_0x6585c,_0x2167('0x19b'));}var _0x2726df={'body':_0x6585c[_0x2167('0x19c')],'phone':_0x6585c['to']||'','SmsAccountId':_0x244334['id']};logger[_0x2167('0xe1')](_0x2167('0x19d'),JSON[_0x2167('0x75')](_0x2726df));this[_0x2167('0x36')][_0x2167('0xa9')](this,_0x6585c,_0x6585c['sms_account_id']);this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x244334['name']));this[_0x2167('0x35')]['sync'](this,_0x2726df);return this['channel'][_0x2167('0xac')](_0x2167('0x19e'));};AGIVertices[_0x2167('0x17')][_0x2167('0x19f')]=function(_0x265fea){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x1a0'),_0x265fea['label']));if(!this[_0x2167('0xa7')](_0x265fea[_0x2167('0xd9')])){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x265fea,_0x2167('0x1a1'));}var _0x485c6f=this['getVariable'][_0x2167('0xa9')](this,_0x265fea[_0x2167('0xd9')]);if(!_0x485c6f){return this['channel']['error'](_0x265fea,_0x2167('0xdb'));}return this['channel'][_0x2167('0xa1')](_0x485c6f,_0x265fea['variable_value']);};AGIVertices[_0x2167('0x17')][_0x2167('0x1a2')]=function(_0x3f82a8){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x1a3'),_0x3f82a8[_0x2167('0x38')]));this[_0x2167('0x12')][_0x2167('0xac')](_0x2167('0x1a4'));if(_0x3f82a8[_0x2167('0xbb')]===_0x2167('0x1a5')){this[_0x2167('0x12')][_0x2167('0xac')]('Answer');return this[_0x2167('0x12')][_0x2167('0xbb')]();}return this[_0x2167('0x12')]['noop'](_0x2167('0x1a6'));};AGIVertices[_0x2167('0x17')][_0x2167('0x1a7')]=function(_0xc33bd6){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x1a8'),_0xc33bd6['label']));if(!this['isConfigured'](_0xc33bd6['project_id'])){return this[_0x2167('0x12')][_0x2167('0x2a')](_0xc33bd6,_0x2167('0x1a9'));}var _0x2eae3f=this['getSquareProject'][_0x2167('0xa9')](this,_0xc33bd6[_0x2167('0x1aa')]);if(!this[_0x2167('0xa7')](_0x2eae3f)){return this[_0x2167('0x12')]['error'](_0xc33bd6,util['format'](_0x2167('0x1ab'),_0xc33bd6[_0x2167('0x1aa')]));}if(_0x2eae3f===this[_0x2167('0x12')][_0x2167('0x39')]){return this['channel'][_0x2167('0x2a')](_0xc33bd6,_0x2167('0x1ac'));}this['createSquareDetailsReport'][_0x2167('0xa9')](this,_0xc33bd6,_0x2eae3f);var _0x2526cc=this[_0x2167('0x12')][_0x2167('0x57')](_0x2167('0x1ad'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x2167('0x9')]['host']||_0x2167('0x1ae'),_0x2eae3f,this[_0x2167('0x12')][_0x2167('0x39')]));if(_0x2526cc[_0x2167('0xa6')]===-0x1){return _0x2526cc;}return this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0xc4'),_0x2167('0x1ad'),_0x2eae3f));};AGIVertices['prototype'][_0x2167('0x1af')]=function(_0x30fd01){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x1b0'),_0x30fd01[_0x2167('0x38')]));var _0x16065b=this[_0x2167('0x1b1')][_0x2167('0xa9')](this,_0x30fd01[_0x2167('0xb9')]);this[_0x2167('0x36')][_0x2167('0xa9')](this,_0x30fd01,_0x30fd01[_0x2167('0xb9')]);if(this[_0x2167('0xa7')](_0x30fd01[_0x2167('0xd9')])){var _0x2d40c7=this['getVariable'][_0x2167('0xa9')](this,_0x30fd01['variable_id']);if(_0x2d40c7){this[_0x2167('0x12')][_0x2167('0xa1')](_0x2d40c7,_0x16065b);return this['channel']['noop'](util['format'](_0x2167('0x1b2'),_0x30fd01[_0x2167('0xb9')],_0x2d40c7));}}return this[_0x2167('0x12')]['noop'](util[_0x2167('0x26')](_0x2167('0x1b3'),_0x30fd01[_0x2167('0xb9')]));};AGIVertices[_0x2167('0x17')]['google_cloud_tts']=function(_0x5104b9){logger['info'](util[_0x2167('0x26')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x5104b9[_0x2167('0x38')]));_0x5104b9[_0x2167('0x5b')]=_0x5104b9['text'][_0x2167('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5104b9[_0x2167('0x1b4')])){return this[_0x2167('0x12')]['noop'](_0x2167('0x1b5'));}if(!this['isConfigured'](_0x5104b9[_0x2167('0x5b')])){return this[_0x2167('0x12')][_0x2167('0xac')]('no\x20text\x20configured');}this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0x1b6'),_0x5104b9[_0x2167('0x5b')]));var _0x1c9668=this[_0x2167('0x1b7')][_0x2167('0xa9')](this,_0x5104b9);if(_0x1c9668){this[_0x2167('0x12')][_0x2167('0xac')](util['format'](_0x2167('0x1b8'),_0x1c9668));var _0x1b2055=this[_0x2167('0x12')][_0x2167('0x1b9')](_0x1c9668);try{fs[_0x2167('0x100')](_0x1c9668+_0x2167('0x122'));}catch(_0x3f83b9){logger[_0x2167('0x2a')](_0x3f83b9);}return _0x1b2055;}return this['channel'][_0x2167('0x2a')](_0x5104b9,_0x2167('0x1ba'));};AGIVertices['prototype']['tts']=function(_0x40d5bd){logger['info'](util[_0x2167('0x26')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x40d5bd[_0x2167('0x38')]));_0x40d5bd[_0x2167('0x5b')]=_0x40d5bd[_0x2167('0x5b')][_0x2167('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2167('0xa7')](_0x40d5bd[_0x2167('0x5b')])){return this[_0x2167('0x12')]['noop'](_0x2167('0xad'));}this[_0x2167('0x12')][_0x2167('0xac')](util['format'](_0x2167('0x1bb'),_0x40d5bd[_0x2167('0x5b')]));var _0x3c8a58=this[_0x2167('0x62')]['sync'](this,_0x40d5bd);if(_0x3c8a58){this[_0x2167('0x12')][_0x2167('0xac')](util['format'](_0x2167('0x1bc'),_0x3c8a58));var _0x257688=this[_0x2167('0x12')][_0x2167('0x1b9')](_0x3c8a58);try{fs[_0x2167('0x100')](_0x3c8a58+'.wav');}catch(_0x5935fb){logger[_0x2167('0x2a')](_0x5935fb);}return _0x257688;}return this[_0x2167('0x12')]['error'](_0x40d5bd,_0x2167('0x1bd'));};AGIVertices['prototype']['unpause']=function(_0x28b04c){logger[_0x2167('0x2c')](util[_0x2167('0x26')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x28b04c[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x28b04c[_0x2167('0x151')])){return this[_0x2167('0x12')]['error'](_0x28b04c,_0x2167('0x152'));}logger[_0x2167('0x2c')](util[_0x2167('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x2167('0x12')][_0x2167('0x3a')],_0x28b04c[_0x2167('0x151')]));var _0x4fb2de=this['agentUnpause'][_0x2167('0xa9')](this,_0x28b04c['findBy']);if(_0x4fb2de){logger[_0x2167('0x2c')](util[_0x2167('0x26')](_0x2167('0x154'),this[_0x2167('0x12')][_0x2167('0x3a')],_0x28b04c[_0x2167('0x151')]));this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0x154'),this[_0x2167('0x12')]['callerid'],_0x28b04c[_0x2167('0x151')]));return{'code':0xc8,'result':_0x2167('0x155')};}else{logger[_0x2167('0x2c')](util[_0x2167('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x28b04c[_0x2167('0x151')]));this[_0x2167('0x12')][_0x2167('0xac')](util['format'](_0x2167('0x158'),this['channel'][_0x2167('0x3a')],_0x28b04c['findBy']));return{'code':0xc8,'result':_0x2167('0x156')};}};AGIVertices['prototype'][_0x2167('0x1be')]=function(_0x444c32){logger[_0x2167('0x2c')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x444c32[_0x2167('0x38')]));var _0x4a168a=this['channel'][_0x2167('0x57')](_0x2167('0x1bf'),[_0x444c32[_0x2167('0x1c0')],_0x444c32[_0x2167('0x7a')]]);if(_0x4a168a['result']===-0x1){return _0x4a168a;}return this[_0x2167('0x12')][_0x2167('0xac')](util[_0x2167('0x26')](_0x2167('0xc4'),_0x2167('0x1bf'),_0x444c32['mailbox']));};AGIVertices[_0x2167('0x17')][_0x2167('0x1c1')]=function(_0x1eac4c){logger['info'](util[_0x2167('0x26')](_0x2167('0x1c2'),_0x1eac4c[_0x2167('0x38')]));if(!this[_0x2167('0xa7')](_0x1eac4c[_0x2167('0xd9')])){return this[_0x2167('0x12')][_0x2167('0x2a')](_0x1eac4c,'no\x20variable\x20selected');}var _0x4bf52a=this[_0x2167('0xa4')][_0x2167('0xa9')](this,_0x1eac4c['variable_id']);if(!_0x4bf52a){return this['channel']['error'](_0x1eac4c,_0x2167('0xdb'));}var _0x1abcd4=this[_0x2167('0x12')][_0x2167('0xa4')](_0x4bf52a);return{'code':0xc8,'result':_0x1abcd4[_0x2167('0xa5')]?_0x1abcd4[_0x2167('0xa5')]:'-'};};String[_0x2167('0x17')][_0x2167('0xa3')]=function(_0x3c6ff3,_0x93e87a){return this[_0x2167('0xa2')](_0x3c6ff3)['join'](_0x93e87a);};module[_0x2167('0x1c3')]=AGIVertices; \ No newline at end of file +var _0x8af8=['Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','no\x20variable\x20found','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','wav','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','restAPI','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','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','no\x20mail\x20account\x20configured','account_id','Smtp','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','auth','pass','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','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','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','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','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','lodash','shelljs','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','then','getSquareProject','getSquareOdbcById','getUser','getUserById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','Intervals','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','aws_secret_access_key','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','clone','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','length','isString','replaceAllVariables','saveRestApiResult','isPlainObject','split','replaceAll','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','isConfigured','maxRetry','retry','mrcpsynth','no\x20text\x20configured','MRCPSynth','result','mrcprecog','label','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','sync','noop','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','createSquareDetailsReport','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','url','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','finally','getdigits','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','extra','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','%s.%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s'];(function(_0x5868b4,_0x151579){var _0x3af8d8=function(_0x54691a){while(--_0x54691a){_0x5868b4['push'](_0x5868b4['shift']());}};_0x3af8d8(++_0x151579);}(_0x8af8,0x81));var _0x88af=function(_0x1e7a12,_0x6ee8ae){_0x1e7a12=_0x1e7a12-0x0;var _0x2a7be7=_0x8af8[_0x1e7a12];return _0x2a7be7;};'use strict';var fs=require('fs');var path=require(_0x88af('0x0'));var util=require('util');var _=require(_0x88af('0x1'));var sh=require(_0x88af('0x2'));var odbc=require('odbc')();var rs=require(_0x88af('0x3'));var moment=require(_0x88af('0x4'));var Mustache=require('mustache');var rp=require(_0x88af('0x5'));var logger=require(_0x88af('0x6'))(_0x88af('0x7'));var config=require(_0x88af('0x8'));var scripts=require(_0x88af('0x9'));var FILES_PATH=_0x88af('0xa');var recursiveMapAttributes=['rawHeaders',_0x88af('0xb')];var verticesWithRetry=['menu','getdigits',_0x88af('0xc')];var AGIVertices=function(_0x325ab9,_0x2ee450,_0x2dee84){this[_0x88af('0xd')]=_0x325ab9;this[_0x88af('0xe')]=_0x2ee450;this[_0x88af('0xf')]=_0x2dee84;};AGIVertices['prototype'][_0x88af('0x10')]=function(_0x1e7f74,_0x2d8188){this[_0x88af('0xe')][_0x88af('0x11')](_0x1e7f74)['then'](function(_0x5e5a59){_0x2d8188(null,_0x5e5a59?_0x5e5a59[_0x88af('0x12')]:![]);})[_0x88af('0x13')](function(_0x28f2bc){_0x2d8188(_0x28f2bc);});};AGIVertices[_0x88af('0x14')][_0x88af('0x15')]=function(_0x1494ff,_0x53e43f){this[_0x88af('0xe')]['getVoiceQueueById'](_0x1494ff)[_0x88af('0x16')](function(_0x46e040){_0x53e43f(null,_0x46e040?_0x46e040[_0x88af('0x12')]:![]);})[_0x88af('0x13')](function(_0x192e1c){_0x53e43f(_0x192e1c);});};AGIVertices[_0x88af('0x14')][_0x88af('0x17')]=function(_0x606c46,_0x570d9f){this[_0x88af('0xe')]['getSquareProjectById'](_0x606c46)[_0x88af('0x16')](function(_0x2222f8){_0x570d9f(null,_0x2222f8?_0x2222f8['name']:![]);})[_0x88af('0x13')](function(_0x2e1d6d){_0x570d9f(_0x2e1d6d);});};AGIVertices[_0x88af('0x14')]['getSquareOdbc']=function(_0x515ea3,_0x3de06a){this[_0x88af('0xe')][_0x88af('0x18')](_0x515ea3)[_0x88af('0x16')](function(_0x3492cd){_0x3de06a(null,_0x3492cd?_0x3492cd['dsn']:![]);})['catch'](function(_0x4a0d85){_0x3de06a(_0x4a0d85);});};AGIVertices['prototype'][_0x88af('0x19')]=function(_0x35a5bf,_0x1213b0){this['rpc'][_0x88af('0x1a')](_0x35a5bf)[_0x88af('0x16')](function(_0x33ff88){_0x1213b0(null,_0x33ff88?_0x33ff88[_0x88af('0x12')]:![]);})[_0x88af('0x13')](function(_0x55a1f7){_0x1213b0(_0x55a1f7);});};AGIVertices['prototype']['getTrunk']=function(_0x3d0176,_0x24e212){this[_0x88af('0xe')]['getTrunkById'](_0x3d0176)[_0x88af('0x16')](function(_0x52b2bb){_0x24e212(null,_0x52b2bb?_0x52b2bb[_0x88af('0x12')]:![]);})[_0x88af('0x13')](function(_0x5d775f){_0x24e212(_0x5d775f);});};AGIVertices['prototype'][_0x88af('0x1b')]=function(_0x2bda8b,_0x45f43a){var _0x466e61=this;this['rpc'][_0x88af('0x1c')](_0x2bda8b)[_0x88af('0x16')](function(_0x4264ef){_0x45f43a(null,_0x4264ef?_0x466e61[_0x88af('0x1d')](_0x4264ef['save_name']):![]);})[_0x88af('0x13')](function(_0x20470b){_0x45f43a(_0x20470b);});};AGIVertices[_0x88af('0x14')][_0x88af('0x1e')]=function(_0x57aa26,_0x4ed9bb){this['rpc'][_0x88af('0x1f')](_0x57aa26)[_0x88af('0x16')](function(_0x347d82){_0x4ed9bb(null,_0x347d82?_0x347d82:![]);})[_0x88af('0x13')](function(_0x18a9f0){_0x4ed9bb(_0x18a9f0);});};AGIVertices[_0x88af('0x14')][_0x88af('0x20')]=function(_0x4b9540,_0x3f62ca,_0x8ae95f){this[_0x88af('0xf')]['sendMailMessage'](_0x4b9540,_0x3f62ca)[_0x88af('0x16')](function(){_0x8ae95f(null);})['catch'](function(_0x496f8a){_0x8ae95f(_0x496f8a);});};AGIVertices['prototype'][_0x88af('0x21')]=function(_0xbaeae2,_0x2a8078){this[_0x88af('0xe')][_0x88af('0x22')](_0xbaeae2)[_0x88af('0x16')](function(_0x30a11f){if(_0x30a11f){if(_0x30a11f[_0x88af('0x23')]){_0x2a8078(null,[_0x30a11f['interval']]);}else{_0x2a8078(null,_['map'](_0x30a11f[_0x88af('0x24')],_0x88af('0x25')));}}else{_0x2a8078(null,![]);}})[_0x88af('0x13')](function(_0x832e36){_0x2a8078(_0x832e36);});};AGIVertices[_0x88af('0x14')][_0x88af('0x1d')]=function(_0x242844){return util[_0x88af('0x26')]('%s/sounds/converted/%s',FILES_PATH,_0x242844);};AGIVertices[_0x88af('0x14')][_0x88af('0x27')]=function(_0x2dacd7,_0x52de6a,_0x50bcfe){odbc[_0x88af('0x28')](_0x2dacd7,function(_0x47aed3){if(_0x47aed3){logger[_0x88af('0x29')](_0x88af('0x2a'),_0x47aed3);_0x50bcfe(_0x47aed3);}else{logger[_0x88af('0x2b')](_0x88af('0x2c'));odbc[_0x88af('0x2d')](_0x52de6a,function(_0x59bc92,_0x3325a1){if(_0x59bc92){logger[_0x88af('0x2b')](_0x88af('0x2e'),_0x52de6a);_0x50bcfe(_0x59bc92);}else{logger[_0x88af('0x2b')](_0x88af('0x2f'),_0x52de6a);odbc['close'](function(_0x50da7e){if(_0x50da7e){logger[_0x88af('0x29')](_0x88af('0x30'),_0x50da7e);}_0x50bcfe(null,_0x3325a1);});}});}});};AGIVertices[_0x88af('0x14')][_0x88af('0x31')]=function(_0x149a74,_0x1d0d9f){this[_0x88af('0xe')][_0x88af('0x32')](_0x149a74)[_0x88af('0x16')](function(_0x4d7af7){_0x1d0d9f(null,_0x4d7af7?_0x4d7af7:![]);})['catch'](function(_0x54f3a6){_0x1d0d9f(_0x54f3a6);});};AGIVertices[_0x88af('0x14')]['createSmsMessage']=function(_0x460092,_0x4c32ec){this['rpc'][_0x88af('0x33')](_0x460092)[_0x88af('0x16')](function(_0x2f97a5){_0x4c32ec(null,_0x2f97a5);})[_0x88af('0x13')](function(_0x42666c){_0x4c32ec(_0x42666c);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x4b0265,_0x3c2470,_0x3b6d0f){this[_0x88af('0xe')]['createSquareDetailsReport']({'uniqueid':this[_0x88af('0xd')][_0x88af('0x34')],'node':_0x4b0265['label'],'application':_0x4b0265[_0x88af('0x35')],'data':_0x3c2470||null,'project_name':this[_0x88af('0xd')][_0x88af('0x36')],'callerid':this[_0x88af('0xd')][_0x88af('0x37')]})[_0x88af('0x16')](function(_0x14e095){if(_0x3b6d0f){_0x3b6d0f(null,_0x14e095);}})[_0x88af('0x13')](function(_0x215750){if(_0x3b6d0f){_0x3b6d0f(_0x215750);}});};AGIVertices[_0x88af('0x14')][_0x88af('0x38')]=function(_0x44a326,_0x21aa97,_0x122e55,_0x3bf4cb){this['rpc'][_0x88af('0x38')]({'uniqueid':this[_0x88af('0xd')][_0x88af('0x34')],'callerid':this[_0x88af('0xd')][_0x88af('0x37')],'calleridname':this[_0x88af('0xd')][_0x88af('0x39')],'context':this['channel']['context'],'extension':this[_0x88af('0xd')]['extension'],'priority':this['channel'][_0x88af('0x3a')],'accountcode':this['channel'][_0x88af('0x3b')],'dnid':this[_0x88af('0xd')][_0x88af('0x3c')],'projectName':this[_0x88af('0xd')][_0x88af('0x36')],'saveName':_0x21aa97,'filename':_0x44a326[_0x88af('0x3d')]||_0x21aa97,'savePath':_0x122e55})['then'](function(_0xfde564){_0x3bf4cb(null,_0xfde564);})[_0x88af('0x13')](function(_0xcbe4fc){_0x3bf4cb(_0xcbe4fc);});};AGIVertices['prototype']['createSquareMessage']=function(_0x4142a4,_0x56c61b,_0x507e33,_0x4b170a,_0x6278f1){this[_0x88af('0xe')][_0x88af('0x3e')]({'uniqueid':this['channel'][_0x88af('0x34')],'body':_0x4142a4,'direction':_0x56c61b,'providerName':_0x507e33,'providerResponse':_0x4b170a})[_0x88af('0x16')](function(_0x3fc035){if(_0x6278f1){_0x6278f1(null,_0x3fc035);}})[_0x88af('0x13')](function(_0x50843a){if(_0x6278f1){_0x6278f1(_0x50843a);}});};AGIVertices[_0x88af('0x14')][_0x88af('0x3f')]=function(_0x42dcae,_0x571b31){this[_0x88af('0xe')][_0x88af('0x3f')]({'firstName':_[_0x88af('0x40')](_0x42dcae[_0x88af('0x12')])||_[_0x88af('0x41')](_0x42dcae[_0x88af('0x12')])?_0x88af('0x42')+Math['random']():_0x42dcae[_0x88af('0x12')],'lastName':_[_0x88af('0x40')](_0x42dcae[_0x88af('0x43')])||_[_0x88af('0x41')](_0x42dcae[_0x88af('0x43')])?null:_0x42dcae[_0x88af('0x43')],'phone':_0x42dcae[_0x88af('0x44')],'ListId':_0x42dcae[_0x88af('0x45')],'scheduledat':_0x42dcae[_0x88af('0x46')],'callbackUniqueid':this[_0x88af('0xd')][_0x88af('0x34')],'tags':_0x88af('0x47'),'description':_0x88af('0x48')+_0x42dcae[_0x88af('0x46')][_0x88af('0x49')](),'priority':_0x42dcae[_0x88af('0x4a')]})[_0x88af('0x16')](function(_0x46287a){_0x571b31(null,_0x46287a);})[_0x88af('0x13')](function(_0xf19afc){_0x571b31(_0xf19afc);});};AGIVertices['prototype'][_0x88af('0x4b')]=function(_0x2a99bc,_0x3e2c71){this[_0x88af('0xe')][_0x88af('0x4c')](_0x2a99bc)[_0x88af('0x16')](function(_0x45ef67){_0x3e2c71(null,_0x45ef67?_0x45ef67[_0x88af('0x12')]:![]);})['catch'](function(_0x51a9aa){_0x3e2c71(_0x51a9aa);});};AGIVertices['prototype'][_0x88af('0x4d')]=function(_0x572354,_0x4fe5fd,_0x12de8c){var _0x2ef5e7={'role':_0x88af('0x4e')};_0x2ef5e7[_0x572354]=this[_0x88af('0xd')][_0x88af('0x37')];this['rpc']['agentPause'](_0x2ef5e7,_0x4fe5fd,this['channel']['uniqueid'])['then'](function(_0x581648){_0x12de8c(null,_[_0x88af('0x41')](_0x581648)?![]:!![]);})['catch'](function(_0x2b8185){logger[_0x88af('0x29')](_0x2b8185);_0x12de8c(null,![]);});};AGIVertices[_0x88af('0x14')][_0x88af('0x4f')]=function(_0x3b24b7,_0x3707f7){var _0x34e21e={'role':_0x88af('0x4e')};_0x34e21e[_0x3b24b7]=this[_0x88af('0xd')]['callerid'];this[_0x88af('0xe')][_0x88af('0x4f')](_0x34e21e)['then'](function(_0x30bfc2){_0x3707f7(null,_[_0x88af('0x41')](_0x30bfc2)?![]:!![]);})[_0x88af('0x13')](function(_0x33a230){logger[_0x88af('0x29')](_0x33a230);_0x3707f7(null,![]);});};AGIVertices[_0x88af('0x14')]['agentLogout']=function(_0x5395fe,_0x5cd9c7){var _0x3ac4c4={'role':_0x88af('0x4e')};_0x3ac4c4[_0x5395fe]=this[_0x88af('0xd')][_0x88af('0x37')];this['rpc'][_0x88af('0x50')](_0x3ac4c4)[_0x88af('0x16')](function(_0x3897df){_0x5cd9c7(null,_['isNil'](_0x3897df)?![]:!![]);})[_0x88af('0x13')](function(_0x26fd48){logger['error'](_0x26fd48);_0x5cd9c7(null,![]);});};AGIVertices[_0x88af('0x14')][_0x88af('0x51')]=function(_0xfe80f,_0x1c472b){var _0x93dcf3={'role':_0x88af('0x4e')};_0x93dcf3[_0xfe80f]=this[_0x88af('0xd')]['callerid'];var _0x13215e=_0xfe80f!=_0x88af('0x52')?util[_0x88af('0x26')](_0x88af('0x53'),_0x88af('0x54'),this[_0x88af('0xd')][_0x88af('0x37')]):undefined;this[_0x88af('0xe')]['agentLogin'](_0x93dcf3,_0x13215e)[_0x88af('0x16')](function(_0x46d455){_0x1c472b(null,_[_0x88af('0x41')](_0x46d455)?![]:!![]);})[_0x88af('0x13')](function(_0x21a32b){logger['error'](_0x21a32b);_0x1c472b(null,![]);});};AGIVertices[_0x88af('0x14')]['shellCommand']=function(_0x39d54c,_0x53fabe){sh[_0x88af('0x55')](_['trim'](_0x39d54c),function(_0x41fb9,_0x44cc28){var _0x2c0478=_0x44cc28[_0x88af('0x56')](/(\r\n|\n|\r)/gm,'');_0x53fabe(null,_0x2c0478);});};AGIVertices[_0x88af('0x14')][_0x88af('0x57')]=function(_0x32801c,_0x4a8981){scripts[_0x88af('0x57')](_0x32801c[_0x88af('0x58')],_0x32801c[_0x88af('0x59')]||'text',_0x32801c[_0x88af('0x5a')],_0x32801c[_0x88af('0x5b')]||_0x88af('0x5c'),_0x32801c[_0x88af('0x5d')]||_0x88af('0x5e'),_0x32801c[_0x88af('0x5f')]||_0x88af('0x60'))[_0x88af('0x16')](function(_0x18580b){_0x4a8981(null,_0x18580b);})['catch'](function(_0x39d9e6){_0x4a8981(_0x39d9e6);});};AGIVertices[_0x88af('0x14')]['googleTTS']=function(_0x4de804,_0x2462b5){scripts[_0x88af('0x61')](_0x4de804[_0x88af('0x5a')],_0x4de804[_0x88af('0x62')]||'en',0x1)[_0x88af('0x16')](function(_0x2dbced){_0x2462b5(null,_0x2dbced);})['catch'](function(_0x109d3e){_0x2462b5(_0x109d3e);});};AGIVertices[_0x88af('0x14')]['restAPI']=function(_0x498d86,_0x23d5de){var _0x33fe5a={'uri':_0x498d86['url'],'method':_0x498d86[_0x88af('0x63')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x498d86[_0x88af('0x64')])===_0x88af('0x65')&&parseInt(_0x498d86[_0x88af('0x64')])>=0x1?parseInt(_0x498d86[_0x88af('0x64')])*0x3e8:0x5*0x3e8};if(_[_0x88af('0x66')]([_0x88af('0x67'),_0x88af('0x68')],_0x33fe5a['method'][_0x88af('0x69')]())){try{_0x33fe5a[_0x88af('0x6a')]=_0x498d86[_0x88af('0xb')]?JSON[_0x88af('0x6b')](_0x498d86[_0x88af('0xb')]):{};}catch(_0xd63d9b){logger[_0x88af('0x29')](_0x88af('0x6c'),_0xd63d9b);}}try{_0x33fe5a[_0x88af('0x6d')]=_0x498d86[_0x88af('0x6e')]?JSON[_0x88af('0x6b')](_0x498d86[_0x88af('0x6e')]):{};}catch(_0x55acf2){logger[_0x88af('0x29')](_0x88af('0x6f'),_0x55acf2);}if(_0x498d86[_0x88af('0x70')]){try{var _0x54fe05=require(_0x498d86[_0x88af('0x70')])['sync'](this,_0x33fe5a);_0x33fe5a[_0x88af('0x71')]=Mustache[_0x88af('0x72')](_0x498d86['url'],_0x54fe05,{},['$$','$$']);if(_0x33fe5a[_0x88af('0x6d')]){_0x33fe5a[_0x88af('0x6d')]=JSON['parse'](Mustache['render'](JSON['stringify'](_0x33fe5a['headers']),_0x54fe05,{},['$$','$$']));}if(_0x33fe5a[_0x88af('0x6a')]){_0x33fe5a[_0x88af('0x6a')]=JSON['parse'](Mustache['render'](JSON[_0x88af('0x73')](_0x33fe5a[_0x88af('0x6a')]),_0x54fe05,{},['$$','$$']));}}catch(_0x28c11d){logger['error'](_0x88af('0x74'),_0x28c11d);}}rp(_0x33fe5a)['then'](function(_0x53a32b){var _0xc8622b={'statusCode':_0x53a32b[_0x88af('0x75')]||0xc8,'statusMessage':_0x53a32b[_0x88af('0x76')]||'OK','headers':_0x53a32b[_0x88af('0x6d')]||{},'body':_0x53a32b['body']||{}};_0x23d5de(null,_0xc8622b);})[_0x88af('0x13')](function(_0x128965){var _0x1d1b72={'statusCode':_0x128965[_0x88af('0x75')]||0x1f4,'statusMessage':_0x128965[_0x88af('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x128965[_0x88af('0x78')][_0x88af('0x6d')]||{},'body':_0x128965[_0x88af('0x78')][_0x88af('0x6a')]||{}};_0x23d5de(null,_0x1d1b72);});};AGIVertices[_0x88af('0x14')][_0x88af('0x79')]=function(_0x555ea4,_0x3015b8){scripts[_0x88af('0x79')](this[_0x88af('0xd')][_0x88af('0x34')],_0x555ea4[_0x88af('0x7a')],_0x555ea4[_0x88af('0x5a')],_0x555ea4[_0x88af('0x7b')]||'en')[_0x88af('0x16')](function(_0x599445){_0x3015b8(null,_0x599445);})['catch'](function(_0x29aae6){_0x3015b8(_0x29aae6);});};AGIVertices[_0x88af('0x14')][_0x88af('0x7c')]=function(_0x9d072a,_0x1bd25a){scripts[_0x88af('0x7c')](this[_0x88af('0xd')][_0x88af('0x34')],_0x9d072a[_0x88af('0x7d')],_0x9d072a[_0x88af('0x7e')],_0x9d072a[_0x88af('0x7f')],_0x9d072a[_0x88af('0x5a')],_0x9d072a[_0x88af('0x80')]||'en')[_0x88af('0x16')](function(_0x17bac1){_0x1bd25a(null,_0x17bac1);})['catch'](function(_0x4570cc){_0x1bd25a(_0x4570cc);});};AGIVertices['prototype'][_0x88af('0x81')]=function(_0x11c73f,_0x381b9f){scripts[_0x88af('0x81')](this[_0x88af('0xd')],_0x11c73f)[_0x88af('0x16')](function(_0x5a4e3c){_0x381b9f(null,_0x5a4e3c);})[_0x88af('0x13')](function(_0x152a86){_0x381b9f(_0x152a86);});};AGIVertices[_0x88af('0x14')][_0x88af('0x82')]=function(_0x5d17fe,_0x572181){scripts[_0x88af('0x82')](_0x5d17fe[_0x88af('0x7a')],_0x5d17fe[_0x88af('0x5a')],_0x5d17fe[_0x88af('0x83')]||_0x88af('0x5c'),_0x5d17fe[_0x88af('0x84')])['then'](function(_0x222ca3){_0x572181(null,_0x222ca3);})[_0x88af('0x13')](function(_0x5a2900){_0x572181(_0x5a2900);});};AGIVertices[_0x88af('0x14')][_0x88af('0x85')]=function(_0x3f1ac9,_0x2e96b9,_0x92f72d){scripts[_0x88af('0x85')](_0x2e96b9,_0x3f1ac9[_0x88af('0x7a')],_0x3f1ac9[_0x88af('0x86')]||_0x88af('0x5c'),this['isConfigured'](_0x3f1ac9[_0x88af('0x87')])?_0x3f1ac9[_0x88af('0x87')]:undefined)[_0x88af('0x16')](function(_0x316756){_0x92f72d(null,_0x316756);})[_0x88af('0x13')](function(_0x1ebd80){_0x92f72d(_0x1ebd80);});};AGIVertices[_0x88af('0x14')]['awsPolly']=function(_0x69fc91,_0x2fd2b5){scripts['awsPolly'](_0x69fc91['aws_access_key_id'],_0x69fc91[_0x88af('0x88')],_0x69fc91['aws_polly_region'],_0x69fc91['aws_polly_voice']||'Amy',_0x69fc91['text'],_0x69fc91['aws_text_type']||_0x88af('0x5a'))['then'](function(_0x149b3d){_0x2fd2b5(null,_0x149b3d);})[_0x88af('0x13')](function(_0x67b0a2){_0x2fd2b5(_0x67b0a2);});};AGIVertices[_0x88af('0x14')][_0x88af('0x89')]=function(_0xa57a2f,_0x1346a7){scripts[_0x88af('0x89')](this[_0x88af('0xd')][_0x88af('0x34')],_0xa57a2f[_0x88af('0x8a')],_0xa57a2f[_0x88af('0x88')],_0xa57a2f[_0x88af('0x8b')],_0xa57a2f['text'],_0xa57a2f[_0x88af('0x8c')])['then'](function(_0x15af27){_0x1346a7(null,_0x15af27);})[_0x88af('0x13')](function(_0x135a49){_0x1346a7(_0x135a49);});};AGIVertices[_0x88af('0x14')][_0x88af('0x8d')]=function(_0x2b15dc,_0x7d20c3,_0x5c4156){scripts[_0x88af('0x8d')](_0x7d20c3,_0x2b15dc[_0x88af('0x7a')],_0x2b15dc['google_asr_language']||_0x88af('0x5c'))['then'](function(_0x599b87){_0x5c4156(null,_0x599b87);})[_0x88af('0x13')](function(_0x54f8c8){_0x5c4156(_0x54f8c8);});};AGIVertices[_0x88af('0x14')][_0x88af('0x8e')]=function(_0x21a453,_0x2af2f0,_0x913b67){scripts[_0x88af('0x8e')](_0x2af2f0,_0x21a453[_0x88af('0x8f')],_0x21a453['appsecret'],_0x21a453[_0x88af('0x71')])[_0x88af('0x16')](function(_0x46e79b){_0x913b67(null,_0x46e79b);})['catch'](function(_0x445ec5){_0x913b67(_0x445ec5);});};AGIVertices['prototype']['clear']=function(_0x377155){var _0x18a313=_['includes'](verticesWithRetry,_0x377155['agicommand'])?_0x377155:_[_0x88af('0x90')](_0x377155);for(var _0x30f706 in _0x18a313){if(_0x18a313['hasOwnProperty'](_0x30f706)){if(_0x18a313[_0x30f706]&&_['isString'](_0x18a313[_0x30f706])){if(_[_0x88af('0x66')](recursiveMapAttributes,_0x30f706)){_0x18a313[_0x30f706]=this[_0x88af('0x91')](_0x18a313[_0x30f706]);}else{_0x18a313[_0x30f706]=this['replaceAllVariables'](_0x18a313[_0x30f706]);}}}}return _0x18a313;};AGIVertices[_0x88af('0x14')][_0x88af('0x92')]=function(_0x24eb64){for(var _0xee12e5 in _0x24eb64){if(_0x24eb64[_0x88af('0x93')](_0xee12e5)){if(_['isPlainObject'](_0x24eb64[_0xee12e5])){this[_0x88af('0x92')](_0x24eb64[_0xee12e5]);}else if(_[_0x88af('0x94')](_0x24eb64[_0xee12e5])){for(var _0x55794d=0x0;_0x55794d<_0x24eb64[_0xee12e5][_0x88af('0x95')];_0x55794d++){this[_0x88af('0x92')](_0x24eb64[_0xee12e5][_0x55794d]);}}else if(_[_0x88af('0x96')](_0x24eb64[_0xee12e5])){_0x24eb64[_0xee12e5]=this[_0x88af('0x97')](_0x24eb64[_0xee12e5]);}}}};AGIVertices[_0x88af('0x14')][_0x88af('0x98')]=function(_0x1e488a,_0x255f98){for(var _0x566517 in _0x1e488a){if(_0x1e488a[_0x88af('0x93')](_0x566517)){if(_[_0x88af('0x99')](_0x1e488a[_0x566517])){if(!_[_0x88af('0x40')](_0x1e488a[_0x566517])){this['saveRestApiResult'](_0x1e488a[_0x566517],util[_0x88af('0x26')]('%s.%s',_0x255f98,_0x566517));}}else if(_['isArray'](_0x1e488a[_0x566517])){for(var _0x55db25=0x0;_0x55db25<_0x1e488a[_0x566517][_0x88af('0x95')];_0x55db25++){this['saveRestApiResult'](_0x1e488a[_0x566517][_0x55db25],util[_0x88af('0x26')]('%s.%s',_0x255f98,_0x566517+'['+_0x55db25+']'));}}else{if(!_[_0x88af('0x41')](_0x1e488a[_0x566517])){this['channel']['setVariable'](util[_0x88af('0x26')]('%s.%s',_0x255f98,_0x566517),_0x1e488a[_0x566517]);}}}}};AGIVertices[_0x88af('0x14')][_0x88af('0x91')]=function(_0x56b701){try{var _0x4fef1f=JSON[_0x88af('0x6b')](_0x56b701);this[_0x88af('0x92')](_0x4fef1f);return JSON[_0x88af('0x73')](_0x4fef1f);}catch(_0xe13ae5){return this['replaceAllVariables'](_0x56b701);}};AGIVertices['prototype'][_0x88af('0x97')]=function(_0xd6eb7b){var _0x108c2c=_0xd6eb7b[_0x88af('0x9a')]('{');for(var _0x16e59e=0x1;_0x16e59e<_0x108c2c[_0x88af('0x95')];_0x16e59e+=0x1){var _0x38400f=_0x108c2c[_0x16e59e][_0x88af('0x9a')]('}');if(_0x38400f[_0x88af('0x95')]>0x1){_0xd6eb7b=_0xd6eb7b[_0x88af('0x9b')]('{'+_0x38400f[0x0]+'}',this[_0x88af('0xd')]['getVariable'](_0x38400f[0x0])['extra']||_0x38400f[0x0]);}}if(_0x108c2c[_0x88af('0x95')]===0x1){return _0xd6eb7b[_0x88af('0x49')]();}return this['replaceAllVariables'](_0xd6eb7b);};AGIVertices[_0x88af('0x14')][_0x88af('0x9c')]=function(_0x367d72,_0x27b8a6){var _0x303db9=this[_0x88af('0xd')]['getVariable'](_0x367d72);if(_0x303db9['result']===-0x1){return _0x303db9;}logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x9d'),_0x27b8a6,_0x303db9['extra']));return this['channel'][_0x88af('0x9e')](_0x27b8a6,_0x303db9['extra']);};AGIVertices[_0x88af('0x14')][_0x88af('0x9f')]=function(_0x1697f6){return _0x1697f6&&_0x1697f6!=='0'&&_0x1697f6!=='-1'&&_0x1697f6!=='';};AGIVertices['prototype'][_0x88af('0xa0')]=function(_0x3a5e8b){this['createSquareDetailsReport']['sync'](this,_0x3a5e8b,'-');_0x3a5e8b[_0x88af('0xa1')]=_0x3a5e8b[_0x88af('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x88af('0x14')][_0x88af('0xa2')]=function(_0xf74c4c){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0xf74c4c['label']));if(!this[_0x88af('0x9f')](_0xf74c4c[_0x88af('0x5a')])){return this['channel']['noop'](_0x88af('0xa3'));}var _0x5ba36a='\x22'+_0xf74c4c[_0x88af('0x5a')]+'\x22';if(this[_0x88af('0x9f')](_0xf74c4c[_0x88af('0x78')])){_0x5ba36a+=','+_0xf74c4c[_0x88af('0x78')];}var _0x351bf9=this[_0x88af('0xd')][_0x88af('0x55')](_0x88af('0xa4'),_0x5ba36a);if(_0x351bf9[_0x88af('0xa5')]===-0x1){return _0x351bf9;}return this['channel']['noop'](util[_0x88af('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5ba36a));};AGIVertices[_0x88af('0x14')][_0x88af('0xa6')]=function(_0x517dd5){logger[_0x88af('0x2b')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x517dd5[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x517dd5[_0x88af('0xa8')])){return this[_0x88af('0xd')]['noop'](_0x88af('0xa9'));}var _0x54536f=_0x517dd5[_0x88af('0xa8')];if(this[_0x88af('0x9f')](_0x517dd5[_0x88af('0x78')])){_0x54536f+=','+_0x517dd5[_0x88af('0x78')];}var _0x37d63c=this[_0x88af('0xd')][_0x88af('0x55')](_0x88af('0xaa'),_0x54536f);if(_0x37d63c['result']===-0x1){return _0x37d63c;}var _0x455a0a=this[_0x88af('0x9c')](_0x88af('0xab'),_0x88af('0xac'));if(_0x455a0a['result']===-0x1){return _0x455a0a;}var _0x455965=this[_0x88af('0x9c')](_0x88af('0xad'),_0x88af('0xae'));if(_0x455965[_0x88af('0xa5')]===-0x1){return _0x455965;}var _0x20dcae=this['getAndSetVariable'](_0x88af('0xaf'),_0x88af('0xb0'));if(_0x20dcae[_0x88af('0xa5')]===-0x1){return _0x20dcae;}return this[_0x88af('0xd')]['noop'](util[_0x88af('0x26')](_0x88af('0xb1'),_0x54536f));};AGIVertices['prototype'][_0x88af('0x7')]=function(_0x33c75e){logger['info'](util[_0x88af('0x26')](_0x88af('0xb2'),_0x33c75e['label']));return this['channel']['agi']([_0x33c75e[_0x88af('0xb3')],_0x33c75e['args']]);};AGIVertices[_0x88af('0x14')][_0x88af('0xb4')]=function(_0x57d21c){logger[_0x88af('0x2b')](util['format'](_0x88af('0xb5'),_0x57d21c[_0x88af('0xa7')]));if(this[_0x88af('0x9f')](_0x57d21c[_0x88af('0x64')])){logger['info'](util[_0x88af('0x26')](_0x88af('0xb6'),_0x57d21c['timeout']));var _0x3afbf0=this[_0x88af('0xd')][_0x88af('0xb7')](_0x57d21c[_0x88af('0x64')]);if(_0x3afbf0['result']===-0x1){return _0x3afbf0;}}return this[_0x88af('0xd')]['answer']();};AGIVertices['prototype'][_0x88af('0x47')]=function(_0x1eebba){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0xb8'),_0x1eebba[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x1eebba[_0x88af('0x45')])){return this[_0x88af('0xd')][_0x88af('0x29')](_0x1eebba,_0x88af('0xb9'));}_0x1eebba[_0x88af('0x46')]=moment();if(this[_0x88af('0x9f')](_0x1eebba[_0x88af('0xba')])){_0x1eebba[_0x88af('0x46')]=moment()[_0x88af('0xbb')](_0x1eebba[_0x88af('0xba')],_0x88af('0xbc'));}if(!this[_0x88af('0x9f')](_0x1eebba[_0x88af('0x4a')])){_0x1eebba[_0x88af('0x4a')]=0x2;}this['createCmContact'][_0x88af('0xbd')](this,_0x1eebba);return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1eebba['phone'],_0x1eebba[_0x88af('0x45')],_0x1eebba[_0x88af('0x46')]));};AGIVertices['prototype']['custom_app']=function(_0x16385c){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x16385c[_0x88af('0xa7')]));var _0x2d013a=this[_0x88af('0xd')]['exec'](_0x16385c[_0x88af('0xbf')],_0x16385c[_0x88af('0x78')]);if(_0x2d013a[_0x88af('0xa5')]===-0x1){return _0x2d013a;}return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0xc0'),_0x16385c[_0x88af('0xbf')],_0x16385c[_0x88af('0x78')]));};AGIVertices[_0x88af('0x14')][_0x88af('0xc1')]=function(_0x5168c7){logger['info'](util[_0x88af('0x26')](_0x88af('0xc2'),_0x5168c7[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x5168c7[_0x88af('0x5a')])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0xa3'));}var _0x26c38e='\x22'+_0x5168c7[_0x88af('0x5a')]+'\x22';if(this[_0x88af('0x9f')](_0x5168c7[_0x88af('0x78')])){_0x26c38e+=','+_0x5168c7[_0x88af('0x78')];}var _0x323ad3=this['channel'][_0x88af('0x55')](_0x88af('0xa4'),_0x26c38e);if(_0x323ad3[_0x88af('0xa5')]===-0x1){return _0x323ad3;}return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x26c38e));};AGIVertices[_0x88af('0x14')][_0x88af('0xc3')]=function(_0x4148ae){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0xc4'),_0x4148ae[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x4148ae['text'])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0xa3'));}var _0x354223='\x22'+_0x4148ae[_0x88af('0x5a')]+'\x22';if(this[_0x88af('0x9f')](_0x4148ae['options'])){_0x354223+=','+_0x4148ae[_0x88af('0x78')];}var _0x276f71=this[_0x88af('0xd')][_0x88af('0x55')](_0x88af('0xa4'),_0x354223);if(_0x276f71[_0x88af('0xa5')]===-0x1){return _0x276f71;}return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x354223));};AGIVertices['prototype']['lumenvoxasr']=function(_0x4488e6){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x4488e6['label']));if(!this['isConfigured'](_0x4488e6[_0x88af('0xa8')])){return this[_0x88af('0xd')][_0x88af('0xbe')]('no\x20grammar\x20configured');}var _0x2ddfbb=_0x4488e6['grammar'];if(this[_0x88af('0x9f')](_0x4488e6['options'])){_0x2ddfbb+=','+_0x4488e6[_0x88af('0x78')];}var _0x4a595d=this['channel']['exec'](_0x88af('0xaa'),_0x2ddfbb);if(_0x4a595d['result']===-0x1){return _0x4a595d;}var _0x503c9b=this['getAndSetVariable'](_0x88af('0xab'),'LUMENVOX_ASR_CONFIDENCE');if(_0x503c9b['result']===-0x1){return _0x503c9b;}var _0x4b30ce=this[_0x88af('0x9c')](_0x88af('0xad'),_0x88af('0xc5'));if(_0x4b30ce[_0x88af('0xa5')]===-0x1){return _0x4b30ce;}var _0x4189b7=this[_0x88af('0x9c')](_0x88af('0xaf'),'LUMENVOX_ASR_INSTANCE');if(_0x4189b7['result']===-0x1){return _0x4189b7;}return this[_0x88af('0xd')]['noop'](util['format'](_0x88af('0xb1'),_0x2ddfbb));};AGIVertices[_0x88af('0x14')][_0x88af('0xc6')]=function(_0x78ef41){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0xc7'),_0x78ef41[_0x88af('0xa7')]));if(!this['isConfigured'](_0x78ef41[_0x88af('0xa8')])){return this['channel'][_0x88af('0xbe')]('no\x20grammar\x20configured');}var _0x1f4435=_0x78ef41[_0x88af('0xa8')];if(this['isConfigured'](_0x78ef41[_0x88af('0x78')])){_0x1f4435+=','+_0x78ef41[_0x88af('0x78')];}var _0x26acd7=this[_0x88af('0xd')][_0x88af('0x55')](_0x88af('0xaa'),_0x1f4435);if(_0x26acd7[_0x88af('0xa5')]===-0x1){return _0x26acd7;}var _0x241e1f=this[_0x88af('0x9c')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x241e1f[_0x88af('0xa5')]===-0x1){return _0x241e1f;}var _0x5ddf11=this[_0x88af('0x9c')](_0x88af('0xad'),'SESTEK_ASR_TRANSCRIPT');if(_0x5ddf11[_0x88af('0xa5')]===-0x1){return _0x5ddf11;}var _0x42fed6=this['getAndSetVariable'](_0x88af('0xaf'),'SESTEK_ASR_INSTANCE');if(_0x42fed6[_0x88af('0xa5')]===-0x1){return _0x42fed6;}return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0xb1'),_0x1f4435));};AGIVertices[_0x88af('0x14')][_0x88af('0xc8')]=function(_0x471261){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0xc9'),_0x471261[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x471261['odbc_id'])){return this[_0x88af('0xd')]['error'](_0x471261,_0x88af('0xca'));}var _0x72ded1=this[_0x88af('0xcb')]['sync'](this,_0x471261['odbc_id']);if(!_0x72ded1){return this['channel']['error'](_0x471261,_0x88af('0xcc'));}if(!this[_0x88af('0x9f')](_0x471261[_0x88af('0x2d')])){return this['channel'][_0x88af('0x29')](_0x471261,_0x88af('0xcd'));}var _0x48ff5c=_0x471261[_0x88af('0x2d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x88af('0xbe')](util['format']('query:\x20%s',_0x48ff5c));var _0x370b21=this[_0x88af('0x27')][_0x88af('0xbd')](this,_0x72ded1,_0x48ff5c);this[_0x88af('0xce')][_0x88af('0xbd')](this,_0x471261,_0x48ff5c);if(!this['isConfigured'](_0x471261[_0x88af('0xcf')])){return this['channel'][_0x88af('0xbe')](_0x88af('0xd0'));}var _0x2b6631=this[_0x88af('0x10')][_0x88af('0xbd')](this,_0x471261[_0x88af('0xcf')]);if(!_0x2b6631){return this[_0x88af('0xd')][_0x88af('0x29')](_0x471261,'no\x20variable\x20found');}var _0x2ac18f=this;_0x370b21['forEach'](function(_0xdedb06,_0x597a7e){Object[_0x88af('0xd1')](_0xdedb06)[_0x88af('0xd2')](function(_0x1951ca){_0x2ac18f['channel'][_0x88af('0x9e')](util[_0x88af('0x26')](_0x88af('0xd3'),_0x2b6631,_0x597a7e,_0x1951ca),_0xdedb06[_0x1951ca]);});});this[_0x88af('0xd')][_0x88af('0x9e')](util[_0x88af('0x26')](_0x88af('0xd4'),_0x2b6631),_0x370b21['length']);return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0xd5'),_0x2b6631));};AGIVertices[_0x88af('0x14')]['dial']=function(_0x14f6be){logger[_0x88af('0xd6')](util['format'](_0x88af('0xd7'),_0x14f6be[_0x88af('0xa7')]));if(!this['isConfigured'](_0x14f6be['sip_id'])){return this['channel'][_0x88af('0x29')](_0x14f6be,'no\x20user\x20selected');}var _0xb1a5c4=this['getUser'][_0x88af('0xbd')](this,_0x14f6be[_0x88af('0xd8')]);if(!_0xb1a5c4){return this[_0x88af('0xd')]['error'](_0x14f6be,_0x88af('0xd9'));}var _0xd6e1cd=this[_0x88af('0xd')]['exec'](_0x88af('0xda'),[util[_0x88af('0x26')](_0x88af('0xdb'),_0xb1a5c4),_0x14f6be[_0x88af('0x64')],_0x14f6be[_0x88af('0xdc')],_0x14f6be[_0x88af('0xdd')]]);if(_0xd6e1cd['result']===-0x1){return _0xd6e1cd;}return this['channel']['noop'](util['format'](_0x88af('0xde'),_0x88af('0xda')));};AGIVertices[_0x88af('0x14')][_0x88af('0xdf')]=function(_0x2dd8f4){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x2dd8f4[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x2dd8f4[_0x88af('0x7a')])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0xe0'));}if(!this[_0x88af('0x9f')](_0x2dd8f4[_0x88af('0x5a')])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0xa3'));}this[_0x88af('0xd')][_0x88af('0xe1')]=!![];this[_0x88af('0xce')](_0x2dd8f4);this[_0x88af('0x3e')](_0x2dd8f4[_0x88af('0x5a')],'in','','');this['channel'][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0xe2'),_0x2dd8f4['text']));var _0x5c5ed1=this[_0x88af('0x79')][_0x88af('0xbd')](this,_0x2dd8f4);if(_0x5c5ed1){for(var _0x755992 in _0x5c5ed1){if(_0x5c5ed1[_0x88af('0x93')](_0x755992)){this[_0x88af('0xd')][_0x88af('0x9e')](util['format'](_0x88af('0xe3'),_0x755992[_0x88af('0x69')]()),_0x5c5ed1[_0x755992]);}}this[_0x88af('0x3e')](_0x5c5ed1[_0x88af('0xe4')],_0x88af('0xe5'),_0x88af('0xdf'),'');return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')]('Dialogflow\x20Result\x20%s',_0x5c5ed1[_0x88af('0xe4')]));}return this[_0x88af('0xd')]['error'](_0x2dd8f4,_0x88af('0xe6'));};AGIVertices['prototype'][_0x88af('0xe7')]=function(_0x27a299){logger[_0x88af('0x2b')](util['format'](_0x88af('0xe8'),_0x27a299['label']));if(!this[_0x88af('0x9f')](_0x27a299[_0x88af('0x7d')])){return this['channel']['noop'](_0x88af('0xe9'));}if(!this[_0x88af('0x9f')](_0x27a299[_0x88af('0x7e')])){return this[_0x88af('0xd')]['noop'](_0x88af('0xea'));}if(!this[_0x88af('0x9f')](_0x27a299['private_key'])){return this['channel']['noop'](_0x88af('0xeb'));}if(!this[_0x88af('0x9f')](_0x27a299[_0x88af('0x80')])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0xec'));}if(!this[_0x88af('0x9f')](_0x27a299[_0x88af('0x5a')])){return this['channel'][_0x88af('0xbe')]('no\x20text\x20configured');}this[_0x88af('0xd')][_0x88af('0xe1')]=!![];this['createSquareDetailsReport'](_0x27a299);this[_0x88af('0x3e')](_0x27a299[_0x88af('0x5a')],'in','','');this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0xed'),_0x27a299['text']));var _0x44be9a=this[_0x88af('0x7c')][_0x88af('0xbd')](this,_0x27a299);if(_0x44be9a){for(var _0x545045 in _0x44be9a){if(_0x44be9a[_0x88af('0x93')](_0x545045)){if(_0x545045!=='providerResponse'){this[_0x88af('0xd')][_0x88af('0x9e')](util[_0x88af('0x26')]('DIALOGFLOW_%s',_0x545045[_0x88af('0x69')]()),_0x44be9a[_0x545045]);}}}this[_0x88af('0x3e')](_0x44be9a['speech'],_0x88af('0xe5'),'dialogflowV2',_0x44be9a[_0x88af('0xee')]);return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0xef'),_0x44be9a[_0x88af('0xe4')]));}return this[_0x88af('0xd')][_0x88af('0x29')](_0x27a299,_0x88af('0xf0'));};AGIVertices[_0x88af('0x14')][_0x88af('0xf1')]=function(_0xc10ec3){logger['info'](util[_0x88af('0x26')](_0x88af('0xf2'),_0xc10ec3[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0xc10ec3[_0x88af('0xf3')])){return this[_0x88af('0xd')][_0x88af('0xbe')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x88af('0x9f')](_0xc10ec3['username'])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0xf4'));}if(!this[_0x88af('0x9f')](_0xc10ec3[_0x88af('0xf5')])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0xf6'));}if(!this[_0x88af('0x9f')](_0xc10ec3[_0x88af('0xf7')])){return this['channel']['noop'](_0x88af('0xa3'));}this[_0x88af('0xd')][_0x88af('0xe1')]=!![];this[_0x88af('0xce')](_0xc10ec3);this['createSquareMessage'](_0xc10ec3['text'],'in','','');this[_0x88af('0xd')][_0x88af('0xbe')](util['format'](_0x88af('0xf8'),_0xc10ec3['text']));var _0x1f3f5d=this[_0x88af('0x81')][_0x88af('0xbd')](this,_0xc10ec3);if(_0x1f3f5d){for(var _0x5bbdf1 in _0x1f3f5d){if(_0x1f3f5d[_0x88af('0x93')](_0x5bbdf1)){this[_0x88af('0xd')][_0x88af('0x9e')](util[_0x88af('0x26')](_0x88af('0xf9'),_0x5bbdf1[_0x88af('0x69')]()),_0x1f3f5d[_0x5bbdf1]);}}this[_0x88af('0x3e')](_0x1f3f5d['speech'],_0x88af('0xe5'),_0x88af('0xf1'),'');if(_0x1f3f5d[_0x88af('0xfa')]){this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0xfb'),_0x1f3f5d[_0x88af('0xfa')]));var _0x281a76=this[_0x88af('0xd')][_0x88af('0xfc')](_0x1f3f5d[_0x88af('0xfa')]);try{fs[_0x88af('0xfd')](_0x1f3f5d[_0x88af('0xfa')]+'.wav');}catch(_0x1ccd30){logger[_0x88af('0x29')](_0x1ccd30);}return _0x281a76;}else{return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0xfe'),_0x1f3f5d['speech']));}}return this['channel'][_0x88af('0x29')](_0xc10ec3,_0x88af('0xff'));};AGIVertices[_0x88af('0x14')][_0x88af('0x100')]=function(_0x4dec27){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('Enter\x20in\x20END\x20(%s)\x20block',_0x4dec27['label']));return this['channel']['noop']('end');};AGIVertices[_0x88af('0x14')][_0x88af('0x101')]=function(_0x28f670){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x28f670[_0x88af('0xa7')]));var _0x47402d='';if(_0x28f670[_0x88af('0x102')]){if(!this[_0x88af('0x9f')](_0x28f670['trunk_id'])){return this['channel'][_0x88af('0x29')](_0x28f670,_0x88af('0x103'));}else{var _0x4107c7=parseInt(_0x28f670[_0x88af('0x102')],0xa);if(isNaN(_0x4107c7)){_0x47402d=_0x28f670['trunk_id'];}else{_0x47402d=this[_0x88af('0x104')][_0x88af('0xbd')](this,_0x28f670[_0x88af('0x102')]);if(!_0x47402d){return this['channel'][_0x88af('0x29')](_0x28f670,_0x88af('0x105'));}}}}else if(_0x28f670[_0x88af('0x106')]){_0x47402d=_0x28f670[_0x88af('0x106')];}else{return this[_0x88af('0xd')][_0x88af('0x29')](_0x28f670,_0x88af('0x103'));}var _0x642e1a=this[_0x88af('0xd')]['exec'](_0x88af('0xda'),[util[_0x88af('0x26')]('SIP/%s/%s',_0x47402d,_0x28f670[_0x88af('0x44')]),_0x28f670[_0x88af('0x64')],_0x28f670[_0x88af('0xdc')],_0x28f670[_0x88af('0xdd')]]);if(_0x642e1a['result']===-0x1){return _0x642e1a;}return this[_0x88af('0xd')][_0x88af('0xbe')](util['format'](_0x88af('0xde'),'DIAL'));};AGIVertices[_0x88af('0x14')][_0x88af('0x107')]=function(_0x1725d4){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1725d4[_0x88af('0xa7')]));return this['channel'][_0x88af('0xbe')](_0x88af('0x107'));};AGIVertices[_0x88af('0x14')][_0x88af('0x108')]=function(_0x597ab3){logger['info'](util[_0x88af('0x26')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x597ab3[_0x88af('0xa7')]));if(_0x597ab3['retry']===0x0){return this[_0x88af('0xa0')](_0x597ab3);}_0x597ab3[_0x88af('0xa1')]-=0x1;if(!this[_0x88af('0x9f')](_0x597ab3[_0x88af('0x109')])){return this[_0x88af('0xd')][_0x88af('0x29')](_0x597ab3,'no\x20file\x20audio\x20selected');}var _0xf65150=this[_0x88af('0x1b')][_0x88af('0xbd')](this,_0x597ab3[_0x88af('0x109')]);if(!_0xf65150){return this['channel'][_0x88af('0x29')](_0x597ab3,_0x88af('0x10a'));}if(!this[_0x88af('0x9f')](_0x597ab3[_0x88af('0xcf')])){return this[_0x88af('0xd')][_0x88af('0x29')](_0x88af('0xd0'));}var _0x33335d=this[_0x88af('0xd')][_0x88af('0x10b')](_0xf65150,_0x597ab3[_0x88af('0x10c')],_0x597ab3[_0x88af('0x10d')]);var _0x4b47ba=_0x33335d['result']?_0x33335d[_0x88af('0xa5')]['toString']():'';logger[_0x88af('0x2b')](_0x88af('0x10e'),JSON[_0x88af('0x73')](_0x33335d));if(_0x33335d[_0x88af('0xa5')]===-0x1){this[_0x88af('0xce')][_0x88af('0xbd')](this,_0x597ab3,_0x4b47ba);return _0x33335d;}else if(_0x33335d[_0x88af('0x10f')]===_0x88af('0x64')){_0x33335d['result']=_0x4b47ba['length']>=parseInt(_0x597ab3[_0x88af('0x110')])?'x':'i';}else{_0x33335d[_0x88af('0xa5')]=_0x4b47ba[_0x88af('0x95')]>=parseInt(_0x597ab3['mindigit'])&&_0x4b47ba[_0x88af('0x95')]<=parseInt(_0x597ab3[_0x88af('0x10d')])?'x':'i';}var _0x25ef29=this[_0x88af('0x10')]['sync'](this,_0x597ab3[_0x88af('0xcf')]);if(!_0x25ef29){return this['channel'][_0x88af('0x29')](_0x597ab3,'no\x20variable\x20found');}this[_0x88af('0xd')][_0x88af('0x9e')](_0x25ef29,_0x4b47ba);if(this[_0x88af('0x9f')](_0x597ab3[_0x88af('0x111')])){var _0x59d482=parseInt(_0x597ab3[_0x88af('0x111')],0xa);var _0x19275b=rs[_0x88af('0x112')]({'charset':'*','length':_0x59d482});var _0x27f657=_0x4b47ba[_0x88af('0x95')];if(_0x27f657>0x0){if(_0x27f657>_0x59d482){this[_0x88af('0xce')][_0x88af('0xbd')](this,_0x597ab3,_0x597ab3[_0x88af('0x113')]===_0x88af('0x114')?_0x19275b+_0x4b47ba['substr'](_0x59d482):_0x4b47ba[_0x88af('0x115')](0x0,_0x27f657-_0x59d482)+_0x19275b);}else{this[_0x88af('0xce')][_0x88af('0xbd')](this,_0x597ab3,rs['generate']({'charset':'*','length':_0x27f657}));}}else{this[_0x88af('0xce')][_0x88af('0xbd')](this,_0x597ab3,'');}}else{this['createSquareDetailsReport'][_0x88af('0xbd')](this,_0x597ab3,_0x4b47ba);}return _0x33335d;};AGIVertices[_0x88af('0x14')][_0x88af('0xc')]=function(_0x1ef724){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x1ef724['label']));return this[_0x88af('0x108')](_0x1ef724);};AGIVertices['prototype'][_0x88af('0x116')]=function(_0x19c95f){logger['info'](util[_0x88af('0x26')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x19c95f[_0x88af('0xa7')]));this['createSquareDetailsReport']['sync'](this,_0x19c95f,_0x19c95f[_0x88af('0x117')]);return this['channel'][_0x88af('0xbe')](util['format'](_0x88af('0x118'),_0x19c95f['goalname']));};AGIVertices[_0x88af('0x14')][_0x88af('0x119')]=function(_0x50dfc6){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x11a'),_0x50dfc6[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x50dfc6[_0x88af('0x8a')])||!this[_0x88af('0x9f')](_0x50dfc6['aws_secret_access_key'])){return this[_0x88af('0xd')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x50dfc6['text'])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0xa3'));}this['channel'][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x11b'),_0x50dfc6[_0x88af('0x5a')]));var _0x41325a=this['awsPolly'][_0x88af('0xbd')](this,_0x50dfc6);if(_0x41325a){this[_0x88af('0xd')]['noop'](util[_0x88af('0x26')]('aws\x20Polly\x20%s\x20file\x20created',_0x41325a));var _0x5638df=this[_0x88af('0xd')][_0x88af('0xfc')](_0x41325a);try{fs[_0x88af('0xfd')](_0x41325a+_0x88af('0x11c'));}catch(_0x1cf2df){logger[_0x88af('0x29')](_0x1cf2df);}return _0x5638df;}return this[_0x88af('0xd')][_0x88af('0x29')](_0x50dfc6,_0x88af('0x11d'));};AGIVertices['prototype'][_0x88af('0x11e')]=function(_0x94a810){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x11f'),_0x94a810['label']));if(!this[_0x88af('0x9f')](_0x94a810[_0x88af('0x8a')])||!this[_0x88af('0x9f')](_0x94a810[_0x88af('0x88')])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0x120'));}if(!this[_0x88af('0x9f')](_0x94a810['aws_bot_name'])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0x121'));}if(!this['isConfigured'](_0x94a810['text'])){return this[_0x88af('0xd')][_0x88af('0xbe')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x88af('0xce')](_0x94a810);this[_0x88af('0x3e')](_0x94a810[_0x88af('0x5a')],'in','','');this['channel'][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x122'),_0x94a810[_0x88af('0x5a')]));var _0x4f08d6=this[_0x88af('0x89')][_0x88af('0xbd')](this,_0x94a810);if(_0x4f08d6){for(var _0x383762 in _0x4f08d6){if(_0x4f08d6[_0x88af('0x93')](_0x383762)&&_[_0x88af('0x96')](_0x4f08d6[_0x383762])){this[_0x88af('0xd')][_0x88af('0x9e')](util[_0x88af('0x26')](_0x88af('0x123'),_0x383762[_0x88af('0x69')]()),_0x4f08d6[_0x383762]);}}if(_['isNil'](_0x4f08d6[_0x88af('0x77')])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0x124'));}else{this[_0x88af('0x3e')](_0x4f08d6[_0x88af('0x77')],_0x88af('0xe5'),'amazonlex','');return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')]('Amazon\x20Lex\x20Result\x20%s',_0x4f08d6['message']));}}return this[_0x88af('0xd')]['error'](_0x94a810,_0x88af('0x125'));};AGIVertices[_0x88af('0x14')][_0x88af('0x126')]=function(_0xc0509){logger['info'](util[_0x88af('0x26')](_0x88af('0x127'),_0xc0509['label'],_0xc0509['timeout']));if(!this['isConfigured'](_0xc0509['key'])){return this['channel']['noop'](_0x88af('0xe0'));}var _0x4e9db9='wav';var _0x556ef4=util[_0x88af('0x26')](_0x88af('0x128'),FILES_PATH,rs[_0x88af('0x112')](0x4));var _0x79d08e=util[_0x88af('0x26')](_0x88af('0x129'),_0x556ef4,_0x4e9db9);var _0xe9e2c7=!![];if(_0xc0509[_0x88af('0x12a')]==='NOBEEP'){_0xe9e2c7=![];}var _0x47d1b2=this['channel'][_0x88af('0x12b')](_0x556ef4,_0x4e9db9,_0xc0509[_0x88af('0x12c')],_0xc0509[_0x88af('0x64')],undefined,_0xe9e2c7);if(_0x47d1b2[_0x88af('0xa5')]!==-0x1){this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x12d'),_0x79d08e));var _0x54534e=this['googleASR'][_0x88af('0xbd')](this,_0xc0509,_0x79d08e);if(_0x54534e){for(var _0xf0d69f in _0x54534e){if(_0x54534e[_0x88af('0x93')](_0xf0d69f)){this[_0x88af('0xd')][_0x88af('0x9e')](util[_0x88af('0x26')]('GOOGLE_ASR_%s',_0xf0d69f[_0x88af('0x69')]()),_0x54534e[_0xf0d69f]);}}return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x12e'),JSON[_0x88af('0x73')](_0x54534e)));}}return _0x47d1b2;};AGIVertices[_0x88af('0x14')][_0x88af('0x12f')]=function(_0x59f369){logger['info'](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x59f369[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x59f369[_0x88af('0x8f')])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0x130'));}if(!this[_0x88af('0x9f')](_0x59f369['appsecret'])){return this['channel'][_0x88af('0xbe')](_0x88af('0x131'));}var _0x48bb58='wav';var _0x520537=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1cd076=util[_0x88af('0x26')](_0x88af('0x129'),_0x520537,_0x48bb58);var _0x36224c=!![];if(_0x59f369[_0x88af('0x12a')]===_0x88af('0x132')){_0x36224c=![];}var _0x54cfec=this[_0x88af('0xd')][_0x88af('0x12b')](_0x520537,_0x48bb58,_0x59f369['intKey'],_0x59f369[_0x88af('0x64')],undefined,_0x36224c);if(_0x54cfec['result']!==-0x1){this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x133'),_0x1cd076));var _0x397337=this[_0x88af('0x8e')][_0x88af('0xbd')](this,_0x59f369,_0x1cd076);if(_0x397337){for(var _0xda5ed6 in _0x397337){if(_0x397337[_0x88af('0x93')](_0xda5ed6)){this[_0x88af('0xd')][_0x88af('0x9e')](util[_0x88af('0x26')](_0x88af('0x134'),_0xda5ed6[_0x88af('0x69')]()),_0x397337[_0xda5ed6]);}}return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x135'),JSON[_0x88af('0x73')](_0x397337)));}}return _0x54cfec;};AGIVertices[_0x88af('0x14')][_0x88af('0x136')]=function(_0x5e17d1){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x137'),_0x5e17d1[_0x88af('0xa7')]));return this['channel'][_0x88af('0x138')](_0x5e17d1['context'],_0x5e17d1['extension'],_0x5e17d1[_0x88af('0x3a')]);};AGIVertices['prototype']['gotoif']=function(_0x33bb04){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x139'),_0x33bb04[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x33bb04['condition'])){return this[_0x88af('0xd')][_0x88af('0x29')](_0x33bb04,'no\x20condition\x20configured');}try{var _0x1d3593=eval(_0x33bb04[_0x88af('0x13a')])?'true':_0x88af('0x13b');this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')]('EVAL\x20CONDITION\x20%s\x20%s',_0x33bb04['condition'],_0x1d3593));return{'code':0xc8,'result':_0x1d3593};}catch(_0x181050){return{'code':0xc8,'result':_0x88af('0x13b')};}};AGIVertices['prototype'][_0x88af('0x13c')]=function(_0x1743c4){logger[_0x88af('0x2b')](util['format'](_0x88af('0x13d'),_0x1743c4[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x1743c4[_0x88af('0x13e')])){return this[_0x88af('0xd')][_0x88af('0x29')](_0x1743c4,_0x88af('0x13f'));}var _0x4e334a=this['getIntervals'][_0x88af('0xbd')](this,_0x1743c4[_0x88af('0x13e')]);if(!_0x4e334a){return this[_0x88af('0xd')][_0x88af('0x29')](_0x1743c4,_0x88af('0x140'));}for(var _0x1ea7c3=0x0;_0x1ea7c3<_0x4e334a[_0x88af('0x95')];_0x1ea7c3+=0x1){var _0x41f9bc=this[_0x88af('0xd')][_0x88af('0x10')](util['format'](_0x88af('0x141'),_0x4e334a[_0x1ea7c3]));if(_0x41f9bc[_0x88af('0xa5')]===-0x1){return _0x41f9bc;}logger[_0x88af('0x2b')](util[_0x88af('0x26')]('IFTIME\x20%s\x20%s',_0x4e334a[_0x1ea7c3],_0x41f9bc[_0x88af('0x10f')]));if(_0x41f9bc[_0x88af('0x10f')]===_0x88af('0x142')){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x143'),_0x4e334a[_0x1ea7c3],_0x88af('0x142')));this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x143'),_0x4e334a[_0x1ea7c3],_0x88af('0x142')));return{'code':0xc8,'result':_0x88af('0x142')};}else{logger[_0x88af('0x2b')](util[_0x88af('0x26')]('IFTIME\x20%s\x20%s',_0x4e334a[_0x1ea7c3],_0x88af('0x13b')));this[_0x88af('0xd')]['noop'](util[_0x88af('0x26')](_0x88af('0x143'),_0x4e334a[_0x1ea7c3],_0x88af('0x13b')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x88af('0x14')][_0x88af('0x144')]=function(_0x3cb0af){logger[_0x88af('0x2b')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3cb0af[_0x88af('0xa7')]));return this[_0x88af('0xd')][_0x88af('0x144')]();};AGIVertices[_0x88af('0x14')][_0x88af('0x145')]=function(_0xb17e90){logger[_0x88af('0x2b')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0xb17e90[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0xb17e90[_0x88af('0x7a')])){return this[_0x88af('0xd')][_0x88af('0xbe')]('no\x20key\x20configured');}var _0x236fe0='wav';var _0x44cc34=util[_0x88af('0x26')](_0x88af('0x128'),FILES_PATH,rs[_0x88af('0x112')](0x4));var _0x506a2d=util[_0x88af('0x26')](_0x88af('0x129'),_0x44cc34,_0x236fe0);var _0x4f0050=!![];if(_0xb17e90['beep']===_0x88af('0x132')){_0x4f0050=![];}var _0x149917=this[_0x88af('0xd')][_0x88af('0x12b')](_0x44cc34,_0x236fe0,_0xb17e90[_0x88af('0x12c')],_0xb17e90[_0x88af('0x64')],undefined,_0x4f0050);if(_0x149917[_0x88af('0xa5')]!==-0x1){this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x146'),_0x506a2d));var _0x20ddd6=this[_0x88af('0x85')][_0x88af('0xbd')](this,_0xb17e90,_0x506a2d);if(_0x20ddd6){for(var _0x36316e in _0x20ddd6){if(_0x20ddd6[_0x88af('0x93')](_0x36316e)){this[_0x88af('0xd')][_0x88af('0x9e')](util['format'](_0x88af('0x147'),_0x36316e[_0x88af('0x69')]()),_0x20ddd6[_0x36316e]);}}return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x148'),JSON[_0x88af('0x73')](_0x20ddd6)));}}return _0x149917;};AGIVertices['prototype']['ispeechtts']=function(_0x55818c){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x149'),_0x55818c[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x55818c[_0x88af('0x7a')])){return this[_0x88af('0xd')]['noop'](_0x88af('0xe0'));}if(!this['isConfigured'](_0x55818c[_0x88af('0x5a')])){return this[_0x88af('0xd')][_0x88af('0xbe')]('no\x20text\x20configured');}this[_0x88af('0xd')][_0x88af('0xbe')](util['format'](_0x88af('0x14a'),_0x55818c[_0x88af('0x5a')]));var _0x32dfc2=this[_0x88af('0x82')]['sync'](this,_0x55818c);if(_0x32dfc2){this['channel'][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x146'),_0x32dfc2));var _0x437acc=this[_0x88af('0xd')]['streamFile'](_0x32dfc2,_0x55818c[_0x88af('0x12c')]);try{fs['unlink'](_0x32dfc2+_0x88af('0x11c'));}catch(_0xe9c29e){logger[_0x88af('0x29')](_0xe9c29e);}return _0x437acc;}return this[_0x88af('0xd')][_0x88af('0x29')](_0x55818c,_0x88af('0x14b'));};AGIVertices[_0x88af('0x14')][_0x88af('0x14c')]=function(_0x5c0452){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x5c0452['label']));if(!this['isConfigured'](_0x5c0452[_0x88af('0x14d')])){return this[_0x88af('0xd')][_0x88af('0x29')](_0x5c0452,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x88af('0x14e'),this[_0x88af('0xd')][_0x88af('0x37')],_0x5c0452[_0x88af('0x14d')]));var _0x19fc05=this[_0x88af('0x51')][_0x88af('0xbd')](this,_0x5c0452[_0x88af('0x14d')]);if(_0x19fc05){logger[_0x88af('0x2b')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x88af('0xd')][_0x88af('0x37')],_0x5c0452[_0x88af('0x14d')]));this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x88af('0xd')][_0x88af('0x37')],_0x5c0452['findBy']));return{'code':0xc8,'result':_0x88af('0x14f')};}else{logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x150'),this[_0x88af('0xd')][_0x88af('0x37')],_0x5c0452['findBy']));this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x150'),this[_0x88af('0xd')][_0x88af('0x37')],_0x5c0452['findBy']));return{'code':0xc8,'result':_0x88af('0x151')};}};AGIVertices[_0x88af('0x14')]['logout']=function(_0x348e15){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x152'),_0x348e15['label']));if(!this[_0x88af('0x9f')](_0x348e15[_0x88af('0x14d')])){return this[_0x88af('0xd')]['error'](_0x348e15,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x88af('0x14e'),this['channel']['callerid'],_0x348e15[_0x88af('0x14d')]));var _0x43eed3=this[_0x88af('0x50')]['sync'](this,_0x348e15[_0x88af('0x14d')]);if(_0x43eed3){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x348e15[_0x88af('0x14d')]));this[_0x88af('0xd')][_0x88af('0xbe')](util['format'](_0x88af('0x153'),this['channel'][_0x88af('0x37')],_0x348e15['findBy']));return{'code':0xc8,'result':_0x88af('0x14f')};}else{logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x150'),this[_0x88af('0xd')][_0x88af('0x37')],_0x348e15[_0x88af('0x14d')]));this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x150'),this['channel']['callerid'],_0x348e15[_0x88af('0x14d')]));return{'code':0xc8,'result':_0x88af('0x151')};}};AGIVertices[_0x88af('0x14')][_0x88af('0x154')]=function(_0x2c4e29){logger[_0x88af('0x2b')](util['format'](_0x88af('0x155'),_0x2c4e29[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x2c4e29[_0x88af('0x156')])){return this['channel'][_0x88af('0x29')](_0x2c4e29,'no\x20operation\x20configured');}this[_0x88af('0xd')]['noop'](util['format'](_0x88af('0x157'),_0x2c4e29[_0x88af('0x156')]));var _0x569fba=eval(_0x2c4e29[_0x88af('0x156')]);if(!this[_0x88af('0x9f')](_0x2c4e29[_0x88af('0xcf')])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0xd0'));}var _0x12fd48=this[_0x88af('0x10')][_0x88af('0xbd')](this,_0x2c4e29['variable_id']);if(!_0x12fd48){return this[_0x88af('0xd')][_0x88af('0x29')](_0x2c4e29,_0x88af('0x158'));}if(_[_0x88af('0x94')](_0x569fba)){var _0xf76c73=this;_0x569fba[_0x88af('0xd2')](function(_0x46fd06,_0x51becd){_0xf76c73[_0x88af('0xd')][_0x88af('0x9e')](util[_0x88af('0x26')]('%s[%s]',_0x12fd48,_0x51becd),_0x46fd06);});return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x159'),_0x12fd48));}else{return this[_0x88af('0xd')][_0x88af('0x9e')](_0x12fd48,_0x569fba);}};AGIVertices[_0x88af('0x14')][_0x88af('0x15a')]=function(_0x7d02f5){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x15b'),_0x7d02f5[_0x88af('0xa7')]));if(_0x7d02f5[_0x88af('0xa1')]===0x0){return this[_0x88af('0xa0')](_0x7d02f5);}_0x7d02f5[_0x88af('0xa1')]-=0x1;if(!this[_0x88af('0x9f')](_0x7d02f5[_0x88af('0x109')])){return this['channel'][_0x88af('0x29')](_0x7d02f5,_0x88af('0x15c'));}var _0x8af5c2=this[_0x88af('0x1b')][_0x88af('0xbd')](this,_0x7d02f5['file_id']);if(!_0x8af5c2){return this['channel'][_0x88af('0x29')](_0x7d02f5,'no\x20file\x20audio\x20found');}var _0x4850d4=this[_0x88af('0xd')]['getData'](_0x8af5c2,_0x7d02f5['response'],_0x7d02f5[_0x88af('0x15d')]);var _0x47deee=_0x4850d4['result'];if(_0x4850d4[_0x88af('0xa5')]===-0x1){this[_0x88af('0xce')][_0x88af('0xbd')](this,_0x7d02f5,'-1');return _0x4850d4;}else if(_0x4850d4[_0x88af('0x10f')]===_0x88af('0x64')){_0x4850d4[_0x88af('0xa5')]=_0x4850d4[_0x88af('0xa5')][_0x88af('0x95')]>0x0?_0x4850d4[_0x88af('0xa5')]:'t';}else if(_[_0x88af('0x40')](_0x4850d4['result'])){_0x4850d4[_0x88af('0xa5')]='#';_0x47deee='#';}if(!this[_0x88af('0x9f')](_0x7d02f5[_0x88af('0xcf')])){this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0xd0'));}else{var _0xcd7b33=this['getVariable'][_0x88af('0xbd')](this,_0x7d02f5[_0x88af('0xcf')]);if(!_0xcd7b33){return this['channel'][_0x88af('0x29')](_0x7d02f5,_0x88af('0x158'));}this[_0x88af('0xd')][_0x88af('0x9e')](_0xcd7b33,_0x47deee);}this[_0x88af('0xce')][_0x88af('0xbd')](this,_0x7d02f5,_0x47deee);return _0x4850d4;};AGIVertices[_0x88af('0x14')][_0x88af('0xbe')]=function(_0x5b3524){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x15e'),_0x5b3524[_0x88af('0xa7')]));return this[_0x88af('0xd')][_0x88af('0xbe')](_0x5b3524[_0x88af('0x15f')]||_0x5b3524[_0x88af('0xa7')]);};AGIVertices[_0x88af('0x14')][_0x88af('0x160')]=function(_0x489f5d){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x161'),_0x489f5d[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x489f5d[_0x88af('0x14d')])){return this[_0x88af('0xd')][_0x88af('0x29')](_0x489f5d,_0x88af('0x162'));}logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x14e'),this['channel']['callerid'],_0x489f5d[_0x88af('0x14d')]));var _0x4b6ea9=this['getPause'][_0x88af('0xbd')](this,_0x489f5d['pause_id']);var _0x405e46=this['agentPause'][_0x88af('0xbd')](this,_0x489f5d[_0x88af('0x14d')],_0x4b6ea9);if(_0x405e46){logger['info'](util[_0x88af('0x26')](_0x88af('0x153'),this[_0x88af('0xd')]['callerid'],_0x489f5d['findBy']));this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x153'),this['channel'][_0x88af('0x37')],_0x489f5d['findBy']));return{'code':0xc8,'result':_0x88af('0x14f')};}else{logger[_0x88af('0x2b')](util[_0x88af('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x88af('0xd')][_0x88af('0x37')],_0x489f5d['findBy']));this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x153'),this[_0x88af('0xd')][_0x88af('0x37')],_0x489f5d[_0x88af('0x14d')]));return{'code':0xc8,'result':_0x88af('0x151')};}};AGIVertices[_0x88af('0x14')]['playback']=function(_0x3fe793){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x163'),_0x3fe793[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x3fe793[_0x88af('0x109')])){return this['channel'][_0x88af('0x29')](_0x3fe793,_0x88af('0x15c'));}var _0x4dd092=this[_0x88af('0x1b')][_0x88af('0xbd')](this,_0x3fe793['file_id']);if(!_0x4dd092){return this[_0x88af('0xd')][_0x88af('0x29')](_0x3fe793,_0x88af('0x10a'));}var _0x47dcc2=this[_0x88af('0xd')][_0x88af('0x55')](_0x88af('0x164'),[_0x4dd092,_0x3fe793['opts']]);if(_0x47dcc2['result']===-0x1){return _0x47dcc2;}return this[_0x88af('0xd')]['noop'](util[_0x88af('0x26')](_0x88af('0xc0'),_0x88af('0x164'),_0x4dd092));};AGIVertices[_0x88af('0x14')][_0x88af('0x165')]=function(_0x22c1b2){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x166'),_0x22c1b2[_0x88af('0xa7')]));if(!this['isConfigured'](_0x22c1b2['queue_id'])){return this[_0x88af('0xd')][_0x88af('0x29')](_0x22c1b2,_0x88af('0x167'));}var _0x5d9b17='';var _0x15ccc4=parseInt(_0x22c1b2[_0x88af('0x168')],0xa);if(isNaN(_0x15ccc4)){_0x5d9b17=_0x22c1b2['queue_id'];}else{_0x5d9b17=this[_0x88af('0x15')][_0x88af('0xbd')](this,_0x22c1b2[_0x88af('0x168')]);if(!_0x5d9b17){return this[_0x88af('0xd')]['error'](_0x22c1b2,_0x88af('0x169'));}}var _0x4676e7='';if(this['isConfigured'](_0x22c1b2[_0x88af('0x109')])){var _0x5b5e2b=this[_0x88af('0x1b')][_0x88af('0xbd')](this,_0x22c1b2[_0x88af('0x109')]);if(_0x5b5e2b){_0x4676e7=_0x5b5e2b;}}this[_0x88af('0xce')][_0x88af('0xbd')](this,_0x22c1b2,_0x5d9b17);if(_0x22c1b2[_0x88af('0xdc')][_0x88af('0x16a')]('x')<0x0){_0x22c1b2[_0x88af('0xdc')]+='x';}if(_0x22c1b2[_0x88af('0xdc')]['indexOf']('X')<0x0){_0x22c1b2['opts']+='X';}this[_0x88af('0xd')][_0x88af('0x9e')](_0x88af('0x16b'),_0x5d9b17?_0x5d9b17[_0x88af('0x16c')]():'');var _0x18ec4c=this[_0x88af('0xd')][_0x88af('0x55')]('QUEUE',[_0x5d9b17,_0x22c1b2[_0x88af('0xdc')],_0x22c1b2[_0x88af('0xdd')],_0x4676e7,_0x22c1b2['timeout'],_0x22c1b2[_0x88af('0x7')],_0x22c1b2[_0x88af('0x16d')],_0x22c1b2['gosub'],'',_0x22c1b2['position']]);if(_0x18ec4c[_0x88af('0xa5')]===-0x1){return _0x18ec4c;}return this['channel']['noop'](util[_0x88af('0x26')](_0x88af('0xc0'),_0x88af('0x16e'),_0x5d9b17));};AGIVertices['prototype']['record']=function(_0x31c4bd){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x16f'),_0x31c4bd[_0x88af('0xa7')]));var _0x55ad66=_0x31c4bd['recordingFormat']||_0x88af('0x170');var _0x1c50b7=util[_0x88af('0x26')](_0x88af('0x171'),this[_0x88af('0xd')][_0x88af('0x34')],rs[_0x88af('0x112')](0x5));var _0x2d8105=util[_0x88af('0x26')]('%s/recordings/%s.%s',FILES_PATH,_0x1c50b7,_0x55ad66);var _0x45bfad=util[_0x88af('0x26')](_0x88af('0x128'),FILES_PATH,_0x1c50b7);this['createSquareRecording'][_0x88af('0xbd')](this,_0x31c4bd,_0x1c50b7,_0x2d8105);this[_0x88af('0xd')][_0x88af('0x9e')](_0x88af('0x172'),_0x1c50b7);logger['info'](_0x88af('0x173'),_0x45bfad,_0x55ad66,_0x31c4bd[_0x88af('0x174')],_0x31c4bd[_0x88af('0x64')]);return this['channel'][_0x88af('0x12b')](_0x45bfad,_0x55ad66,_0x31c4bd['escape_digits'],_0x31c4bd[_0x88af('0x64')],undefined,!![]);};AGIVertices[_0x88af('0x14')][_0x88af('0x175')]=function(_0x180f79){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x180f79[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x180f79[_0x88af('0xdd')])){return this[_0x88af('0xd')]['noop'](_0x88af('0x176'));}var _0x1857b8=this[_0x88af('0x177')]['sync'](this,_0x180f79);logger['info'](util['format']('Response:',util[_0x88af('0x178')](_0x1857b8,{'showHidden':![],'depth':null})));if(!this[_0x88af('0x9f')](_0x180f79[_0x88af('0xcf')])){return this['channel'][_0x88af('0xbe')](_0x88af('0x179'));}var _0x4ebbb2=this['getVariable'][_0x88af('0xbd')](this,_0x180f79[_0x88af('0xcf')]);if(!_0x4ebbb2){return this[_0x88af('0xd')]['error'](_0x180f79,'no\x20variable\x20found');}this[_0x88af('0xd')][_0x88af('0x9e')](util['format'](_0x88af('0x17a'),_0x4ebbb2),_0x1857b8[_0x88af('0x75')]?_0x1857b8[_0x88af('0x75')]:_0x88af('0x17b'));this[_0x88af('0xd')][_0x88af('0x9e')](util[_0x88af('0x26')](_0x88af('0x17c'),_0x4ebbb2),_0x1857b8[_0x88af('0x76')]?_0x1857b8[_0x88af('0x76')]:'OK');if(_0x1857b8['body']){try{this[_0x88af('0x98')](_0x1857b8[_0x88af('0x6a')],_0x4ebbb2);}catch(_0xa39e51){logger[_0x88af('0x29')](util[_0x88af('0x26')](_0x88af('0x17d'),_0x4ebbb2));}}return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0xd5'),_0x4ebbb2));};AGIVertices[_0x88af('0x14')][_0x88af('0x17e')]=function(_0x2e632b){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x17f'),_0x2e632b[_0x88af('0xa7')]));return this[_0x88af('0xd')][_0x88af('0x180')](_0x2e632b[_0x88af('0x181')]['replace'](/\s+/g,''),_0x2e632b['escape_digits']);};AGIVertices['prototype'][_0x88af('0x182')]=function(_0x50e2de){logger['info'](util[_0x88af('0x26')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x50e2de[_0x88af('0xa7')]));return this[_0x88af('0xd')][_0x88af('0x183')](_0x50e2de[_0x88af('0x65')][_0x88af('0x56')](/\s+/g,''),_0x50e2de[_0x88af('0x174')]);};AGIVertices[_0x88af('0x14')][_0x88af('0x184')]=function(_0x35822a){logger['info'](util['format'](_0x88af('0x185'),_0x35822a[_0x88af('0xa7')]));return this[_0x88af('0xd')][_0x88af('0x186')](_0x35822a['text'],_0x35822a['escape_digits']);};AGIVertices[_0x88af('0x14')][_0x88af('0x187')]=function(_0x1f0258){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x188'),_0x1f0258[_0x88af('0xa7')]));if(!this['isConfigured'](_0x1f0258['account_id'])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0x189'));}var _0x10db36=this[_0x88af('0x1e')][_0x88af('0xbd')](this,_0x1f0258[_0x88af('0x18a')]);if(!_0x10db36||!_0x10db36[_0x88af('0x18b')]){return this['channel']['error'](_0x1f0258,'no\x20mail\x20account\x20found');}var _0x5892d0={'from':util[_0x88af('0x26')](_0x88af('0x18c'),_0x10db36[_0x88af('0x12')],_0x10db36[_0x88af('0x18d')]||_0x10db36[_0x88af('0x18b')][_0x88af('0x18e')]),'to':_0x1f0258['to']||'','cc':_0x1f0258['cc']||'','bcc':_0x1f0258['bcc']||'','subject':_0x1f0258[_0x88af('0x18f')],'html':_0x1f0258[_0x88af('0x5a')],'text':_0x1f0258[_0x88af('0x5a')]};var _0x5b7279={'tls':{'rejectUnauthorized':![]}};if(_0x10db36[_0x88af('0x18b')][_0x88af('0x190')]){_0x5b7279[_0x88af('0x190')]=_0x10db36[_0x88af('0x18b')][_0x88af('0x190')];}else{_0x5b7279[_0x88af('0x191')]=_0x10db36[_0x88af('0x18b')][_0x88af('0x191')];_0x5b7279[_0x88af('0x192')]=_0x10db36['Smtp'][_0x88af('0x192')];_0x5b7279[_0x88af('0x193')]=_0x10db36[_0x88af('0x18b')][_0x88af('0x193')];}if(_0x10db36[_0x88af('0x18b')]['authentication']){_0x5b7279[_0x88af('0x194')]={'user':_0x10db36[_0x88af('0x18b')]['user'],'pass':_0x10db36['Smtp'][_0x88af('0x195')]};}if(this['isConfigured'](_0x1f0258[_0x88af('0x196')])){}logger[_0x88af('0xd6')](_0x88af('0x197'),JSON[_0x88af('0x73')](_0x5892d0));this[_0x88af('0xce')]['sync'](this,_0x1f0258,_0x1f0258[_0x88af('0x18a')]);this['channel']['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x10db36[_0x88af('0x12')]));this[_0x88af('0x20')][_0x88af('0xbd')](this,_0x5b7279,_0x5892d0);return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0x198'));};AGIVertices[_0x88af('0x14')]['sendFax']=function(_0x147529){logger[_0x88af('0x2b')](util['format'](_0x88af('0x199'),_0x147529[_0x88af('0xa7')]));return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0x19a'));};AGIVertices[_0x88af('0x14')][_0x88af('0x19b')]=function(_0x31d1fe){logger['info'](util['format'](_0x88af('0x19c'),_0x31d1fe['label']));if(!this[_0x88af('0x9f')](_0x31d1fe['sms_account_id'])){return this[_0x88af('0xd')][_0x88af('0xbe')]('no\x20sms\x20account\x20configured');}var _0x1b0c70=this[_0x88af('0x31')][_0x88af('0xbd')](this,_0x31d1fe[_0x88af('0x19d')]);if(!_0x1b0c70){return this[_0x88af('0xd')][_0x88af('0x29')](_0x31d1fe,_0x88af('0x19e'));}var _0x39e7b5={'body':_0x31d1fe[_0x88af('0x19f')],'phone':_0x31d1fe['to']||'','SmsAccountId':_0x1b0c70['id']};logger[_0x88af('0xd6')](_0x88af('0x1a0'),JSON[_0x88af('0x73')](_0x39e7b5));this[_0x88af('0xce')][_0x88af('0xbd')](this,_0x31d1fe,_0x31d1fe[_0x88af('0x19d')]);this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x1a1'),_0x1b0c70['name']));this['createSmsMessage']['sync'](this,_0x39e7b5);return this[_0x88af('0xd')][_0x88af('0xbe')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x88af('0x1a2')]=function(_0x51d4cf){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x1a3'),_0x51d4cf[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x51d4cf['variable_id'])){return this[_0x88af('0xd')]['error'](_0x51d4cf,'no\x20variable\x20selected');}var _0x39a87b=this[_0x88af('0x10')][_0x88af('0xbd')](this,_0x51d4cf[_0x88af('0xcf')]);if(!_0x39a87b){return this['channel'][_0x88af('0x29')](_0x51d4cf,_0x88af('0x158'));}return this[_0x88af('0xd')][_0x88af('0x9e')](_0x39a87b,_0x51d4cf[_0x88af('0x1a4')]);};AGIVertices[_0x88af('0x14')][_0x88af('0x1a5')]=function(_0xe5b5a2){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x1a6'),_0xe5b5a2['label']));this[_0x88af('0xd')]['noop'](_0x88af('0x1a7'));if(_0xe5b5a2['answer']===_0x88af('0x1a8')){this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0x1a9'));return this[_0x88af('0xd')][_0x88af('0xb4')]();}return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0x1aa'));};AGIVertices[_0x88af('0x14')]['subproject']=function(_0x533cc3){logger['info'](util[_0x88af('0x26')](_0x88af('0x1ab'),_0x533cc3[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x533cc3[_0x88af('0x1ac')])){return this['channel'][_0x88af('0x29')](_0x533cc3,'no\x20subproject\x20selected');}var _0x2d5bd8=this[_0x88af('0x17')][_0x88af('0xbd')](this,_0x533cc3[_0x88af('0x1ac')]);if(!this[_0x88af('0x9f')](_0x2d5bd8)){return this[_0x88af('0xd')][_0x88af('0x29')](_0x533cc3,util[_0x88af('0x26')](_0x88af('0x1ad'),_0x533cc3['project_id']));}if(_0x2d5bd8===this[_0x88af('0xd')][_0x88af('0x36')]){return this[_0x88af('0xd')][_0x88af('0x29')](_0x533cc3,_0x88af('0x1ae'));}this[_0x88af('0xce')]['sync'](this,_0x533cc3,_0x2d5bd8);var _0x16a5c4=this['channel'][_0x88af('0x55')](_0x88af('0x1af'),util[_0x88af('0x26')](_0x88af('0x1b0'),config[_0x88af('0x7')][_0x88af('0x191')]||_0x88af('0x1b1'),_0x2d5bd8,this['channel'][_0x88af('0x36')]));if(_0x16a5c4[_0x88af('0xa5')]===-0x1){return _0x16a5c4;}return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0xc0'),_0x88af('0x1af'),_0x2d5bd8));};AGIVertices[_0x88af('0x14')][_0x88af('0x1b2')]=function(_0x5a2823){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x1b3'),_0x5a2823[_0x88af('0xa7')]));var _0x2823de=this[_0x88af('0x1b4')][_0x88af('0xbd')](this,_0x5a2823[_0x88af('0xb3')]);this['createSquareDetailsReport'][_0x88af('0xbd')](this,_0x5a2823,_0x5a2823['command']);if(this[_0x88af('0x9f')](_0x5a2823['variable_id'])){var _0x543a7e=this[_0x88af('0x10')][_0x88af('0xbd')](this,_0x5a2823['variable_id']);if(_0x543a7e){this[_0x88af('0xd')][_0x88af('0x9e')](_0x543a7e,_0x2823de);return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x1b5'),_0x5a2823[_0x88af('0xb3')],_0x543a7e));}}return this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x1b6'),_0x5a2823[_0x88af('0xb3')]));};AGIVertices['prototype'][_0x88af('0x1b7')]=function(_0xe4d7af){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0xe4d7af['label']));_0xe4d7af[_0x88af('0x5a')]=_0xe4d7af[_0x88af('0x5a')][_0x88af('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x88af('0x9f')](_0xe4d7af[_0x88af('0x58')])){return this[_0x88af('0xd')][_0x88af('0xbe')](_0x88af('0x1b8'));}if(!this[_0x88af('0x9f')](_0xe4d7af[_0x88af('0x5a')])){return this[_0x88af('0xd')][_0x88af('0xbe')]('no\x20text\x20configured');}this[_0x88af('0xd')][_0x88af('0xbe')](util['format'](_0x88af('0x1b9'),_0xe4d7af[_0x88af('0x5a')]));var _0x487863=this['googleCloudTTS'][_0x88af('0xbd')](this,_0xe4d7af);if(_0x487863){this['channel'][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x1ba'),_0x487863));var _0x22967c=this['channel'][_0x88af('0xfc')](_0x487863);try{fs[_0x88af('0xfd')](_0x487863+_0x88af('0x11c'));}catch(_0x3595f1){logger[_0x88af('0x29')](_0x3595f1);}return _0x22967c;}return this[_0x88af('0xd')][_0x88af('0x29')](_0xe4d7af,_0x88af('0x1bb'));};AGIVertices[_0x88af('0x14')][_0x88af('0x1bc')]=function(_0x48a757){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x1bd'),_0x48a757[_0x88af('0xa7')]));_0x48a757['text']=_0x48a757['text'][_0x88af('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x88af('0x9f')](_0x48a757[_0x88af('0x5a')])){return this['channel'][_0x88af('0xbe')](_0x88af('0xa3'));}this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x1be'),_0x48a757[_0x88af('0x5a')]));var _0x1448da=this[_0x88af('0x61')][_0x88af('0xbd')](this,_0x48a757);if(_0x1448da){this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x1bf'),_0x1448da));var _0x40faa3=this[_0x88af('0xd')]['streamFile'](_0x1448da);try{fs[_0x88af('0xfd')](_0x1448da+_0x88af('0x11c'));}catch(_0xaad42f){logger[_0x88af('0x29')](_0xaad42f);}return _0x40faa3;}return this[_0x88af('0xd')]['error'](_0x48a757,_0x88af('0x1c0'));};AGIVertices[_0x88af('0x14')][_0x88af('0x1c1')]=function(_0x3d0660){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x1c2'),_0x3d0660[_0x88af('0xa7')]));if(!this[_0x88af('0x9f')](_0x3d0660[_0x88af('0x14d')])){return this[_0x88af('0xd')][_0x88af('0x29')](_0x3d0660,_0x88af('0x162'));}logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x14e'),this['channel'][_0x88af('0x37')],_0x3d0660[_0x88af('0x14d')]));var _0x1c956a=this[_0x88af('0x4f')][_0x88af('0xbd')](this,_0x3d0660[_0x88af('0x14d')]);if(_0x1c956a){logger[_0x88af('0x2b')](util['format'](_0x88af('0x153'),this['channel'][_0x88af('0x37')],_0x3d0660[_0x88af('0x14d')]));this['channel']['noop'](util[_0x88af('0x26')](_0x88af('0x153'),this[_0x88af('0xd')][_0x88af('0x37')],_0x3d0660[_0x88af('0x14d')]));return{'code':0xc8,'result':_0x88af('0x14f')};}else{logger['info'](util['format'](_0x88af('0x150'),this[_0x88af('0xd')][_0x88af('0x37')],_0x3d0660[_0x88af('0x14d')]));this[_0x88af('0xd')][_0x88af('0xbe')](util[_0x88af('0x26')](_0x88af('0x150'),this[_0x88af('0xd')]['callerid'],_0x3d0660[_0x88af('0x14d')]));return{'code':0xc8,'result':_0x88af('0x151')};}};AGIVertices[_0x88af('0x14')][_0x88af('0x1c3')]=function(_0xab0d0d){logger[_0x88af('0x2b')](util[_0x88af('0x26')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0xab0d0d[_0x88af('0xa7')]));var _0x4a5cfa=this[_0x88af('0xd')][_0x88af('0x55')](_0x88af('0x1c4'),[_0xab0d0d['mailbox'],_0xab0d0d[_0x88af('0x78')]]);if(_0x4a5cfa[_0x88af('0xa5')]===-0x1){return _0x4a5cfa;}return this[_0x88af('0xd')][_0x88af('0xbe')](util['format'](_0x88af('0xc0'),_0x88af('0x1c4'),_0xab0d0d[_0x88af('0x1c5')]));};AGIVertices[_0x88af('0x14')][_0x88af('0x1c6')]=function(_0xeae971){logger[_0x88af('0x2b')](util[_0x88af('0x26')](_0x88af('0x1c7'),_0xeae971['label']));if(!this['isConfigured'](_0xeae971[_0x88af('0xcf')])){return this[_0x88af('0xd')][_0x88af('0x29')](_0xeae971,'no\x20variable\x20selected');}var _0x62c3ac=this[_0x88af('0x10')]['sync'](this,_0xeae971[_0x88af('0xcf')]);if(!_0x62c3ac){return this[_0x88af('0xd')][_0x88af('0x29')](_0xeae971,'no\x20variable\x20found');}var _0x1fd24a=this[_0x88af('0xd')][_0x88af('0x10')](_0x62c3ac);return{'code':0xc8,'result':_0x1fd24a[_0x88af('0x10f')]?_0x1fd24a[_0x88af('0x10f')]:'-'};};String[_0x88af('0x14')][_0x88af('0x9b')]=function(_0x1132c0,_0x115a5f){return this[_0x88af('0x9a')](_0x1132c0)[_0x88af('0x1c8')](_0x115a5f);};module[_0x88af('0x1c9')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c9a71b9..61fe1e7 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 _0x81bd=['YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','uniqueid','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','getAgent','then','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x81bd,0x7c));var _0xd81b=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x81bd[_0x16a223];return _0x5ded66;};'use strict';var util=require(_0xd81b('0x0'));var _=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var ami=require(_0xd81b('0x3'));var logger=require(_0xd81b('0x4'))(_0xd81b('0x5'));var RpcUser=require(_0xd81b('0x6'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x16e8de){this[_0xd81b('0x7')]=_0x16e8de[_0xd81b('0x7')];this['agents']=_0x16e8de[_0xd81b('0x8')];this[_0xd81b('0x9')]=_0x16e8de[_0xd81b('0x9')];this['channels']={};ami['on']('agentconnect',this[_0xd81b('0xa')]['bind'](this));ami['on'](_0xd81b('0xb'),this[_0xd81b('0xc')][_0xd81b('0xd')](this));ami['on'](_0xd81b('0xe'),this[_0xd81b('0xf')][_0xd81b('0xd')](this));ami['on'](_0xd81b('0x10'),this[_0xd81b('0x11')][_0xd81b('0xd')](this));ami['on'](_0xd81b('0x12'),this[_0xd81b('0x13')][_0xd81b('0xd')](this));ami['on'](_0xd81b('0x14'),this['syncBlindTransfer'][_0xd81b('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0xd81b('0x15')][_0xd81b('0xd')](this));}function getDiff(_0x5f0b6b){var _0x35a053=moment()['milliseconds'](0x0);var _0x13dd00=moment(_0x5f0b6b)[_0xd81b('0x16')](0x0);return _0x35a053[_0xd81b('0x17')](_0x13dd00,_0xd81b('0x18'));}Acw[_0xd81b('0x19')]['startAcw']=function(_0x1c620d){try{var _0x27b7a0=this;var _0x5c2863=this[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x1b')];var _0x4657cf=this[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x1c')];var _0xc49b8d=this[_0xd81b('0x7')][_0x4657cf];var _0x3d4d34=![];var _0x1c34c5=_0xd81b('0x1d');if(_0xc49b8d[_0xd81b('0x1e')]){if(_0xc49b8d[_0xd81b('0x1f')][_0xd81b('0x20')]){_0x3d4d34=!![];_0x1c34c5=_0xc49b8d[_0xd81b('0x1f')][_0xd81b('0x20')];}}ami[_0xd81b('0x21')]({'action':'QueuePause','interface':_0x5c2863,'paused':!![],'reason':_0x1c34c5})['then'](function(_0xc16ad0){if(_0x27b7a0[_0xd81b('0x8')][_0x5c2863]){return RpcUser[_0xd81b('0x22')](_0x27b7a0['agents'][_0x5c2863]['id'])[_0xd81b('0x23')](function(_0x6571a6){if(_0x6571a6&&!_0x6571a6['voicePause']){logger[_0xd81b('0x24')](_0xd81b('0x25'),_0x1c620d,_0x5c2863,_0x4657cf);var _0x1670cd=_0x27b7a0[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x26')]&&_0x27b7a0[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x27')]?_0x27b7a0[_0xd81b('0x1a')][_0x1c620d][_0xd81b('0x27')]:_0x1c620d;return RpcUser[_0xd81b('0x28')](_0x27b7a0[_0xd81b('0x8')][_0x5c2863],_0x1c34c5,_0x1670cd)[_0xd81b('0x23')](function(_0x596389){if(!_0x3d4d34){_0x27b7a0[_0xd81b('0x9')][_0x5c2863]={};logger[_0xd81b('0x24')](_0xd81b('0x29'),_0x1c620d,_0x27b7a0[_0xd81b('0x7')][_0x4657cf][_0xd81b('0x2a')],_0x5c2863,_0x4657cf);_0x27b7a0[_0xd81b('0x9')][_0x5c2863][_0xd81b('0x2b')]=setTimeout(_0x27b7a0[_0xd81b('0x2c')][_0xd81b('0xd')](_0x27b7a0,_0x5c2863),_0x27b7a0['voiceQueues'][_0x4657cf][_0xd81b('0x2a')]*0x3e8);_0x27b7a0['timers'][_0x5c2863]['lastPauseAt']=moment()[_0xd81b('0x2d')](_0xd81b('0x2e'));_0x27b7a0['timers'][_0x5c2863]['uniqueid']=_0x1c620d;_0x27b7a0[_0xd81b('0x9')][_0x5c2863][_0xd81b('0x1c')]=_0x4657cf;_0x27b7a0[_0xd81b('0x9')][_0x5c2863][_0xd81b('0x2f')]=function(){var _0x1a1572=getDiff(_0x27b7a0[_0xd81b('0x9')][_0x5c2863]['lastPauseAt']);clearTimeout(_0x27b7a0[_0xd81b('0x9')][_0x5c2863][_0xd81b('0x2b')]);_0x27b7a0['timers'][_0x5c2863]['timer']=![];RpcVoiceAgentReport[_0xd81b('0x30')]({'acwtime':_0x1a1572},_0x27b7a0[_0xd81b('0x9')][_0x5c2863]['uniqueid'],_0x5c2863)['then'](function(_0x5317b2){logger[_0xd81b('0x24')](_0xd81b('0x31'),_0x1c620d,_0x1a1572,_0x5317b2);})[_0xd81b('0x32')](function(_0x1c4cf7){logger[_0xd81b('0x33')](_0xd81b('0x34'),_0x1c620d,_0x1c4cf7);});delete _0x27b7a0[_0xd81b('0x9')][_0x5c2863];};}});}else{logger['info'](_0xd81b('0x35'),_0x1c620d,_0x5c2863,_0x4657cf);}});}})['catch'](function(_0x34634a){logger[_0xd81b('0x33')](_0xd81b('0x29'),_0x1c620d,_0x27b7a0[_0xd81b('0x7')][_0x4657cf][_0xd81b('0x2a')],_0x5c2863,_0x4657cf);})[_0xd81b('0x36')](function(){delete _0x27b7a0[_0xd81b('0x1a')][_0x1c620d];});}catch(_0x2d23b9){logger[_0xd81b('0x33')](_0xd81b('0x37'),_0x2d23b9[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0x2c')]=function(_0x57bc0c){try{var _0x49deb8=this;if(_0x49deb8[_0xd81b('0x9')][_0x57bc0c]){_0x49deb8[_0xd81b('0x9')][_0x57bc0c][_0xd81b('0x2b')]=![];var _0x59c066=_0x49deb8[_0xd81b('0x9')][_0x57bc0c][_0xd81b('0x39')];var _0x5a236a=_0x49deb8[_0xd81b('0x9')][_0x57bc0c][_0xd81b('0x1c')];var _0x512e39=_0x49deb8[_0xd81b('0x7')][_0x5a236a]['acwTimeout'];logger[_0xd81b('0x24')](_0xd81b('0x3a'),_0x57bc0c);RpcUser[_0xd81b('0x3b')](this[_0xd81b('0x8')][_0x57bc0c]);RpcVoiceAgentReport['update']({'acwtime':_0x512e39,'agentacw':!![]},_0x59c066,_0x57bc0c)[_0xd81b('0x23')](function(_0x3444d4){logger[_0xd81b('0x24')](_0xd81b('0x31'),_0x59c066,_0x512e39,_0x3444d4);})[_0xd81b('0x32')](function(_0x466e98){logger[_0xd81b('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x59c066,_0x466e98);});}else{logger[_0xd81b('0x33')](_0xd81b('0x3c'),_0x57bc0c);if(_0x49deb8[_0xd81b('0x9')]){logger['info'](_0xd81b('0x3d'),JSON[_0xd81b('0x3e')](_0x49deb8[_0xd81b('0x9')]));}}}catch(_0x1cd745){logger[_0xd81b('0x33')]('[ACW][STOP]\x20%s',_0x1cd745[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0xa')]=function(_0x43ea38){try{if(this[_0xd81b('0x7')][_0x43ea38[_0xd81b('0x1c')]]&&(this[_0xd81b('0x7')][_0x43ea38[_0xd81b('0x1c')]][_0xd81b('0x5')]||this[_0xd81b('0x7')][_0x43ea38[_0xd81b('0x1c')]]['mandatoryDisposition'])){if(this[_0xd81b('0x8')][_0x43ea38[_0xd81b('0x1b')]]){this[_0xd81b('0x1a')][_0x43ea38[_0xd81b('0x39')]]={'queue':_0x43ea38[_0xd81b('0x1c')],'interface':_0x43ea38[_0xd81b('0x1b')],'destlinkedid':_0x43ea38[_0xd81b('0x27')]};}}}catch(_0x475bcf){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x475bcf[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0x15')]=function(_0x222c5e){try{if(this[_0xd81b('0x7')][_0x222c5e[_0xd81b('0x1c')]]&&(this[_0xd81b('0x7')][_0x222c5e[_0xd81b('0x1c')]][_0xd81b('0x5')]||this[_0xd81b('0x7')][_0x222c5e[_0xd81b('0x1c')]][_0xd81b('0x1e')])){if(this['agents'][_0x222c5e[_0xd81b('0x1b')]]){this[_0xd81b('0x1a')][_0x222c5e[_0xd81b('0x39')]]={'queue':_0x222c5e[_0xd81b('0x1c')],'interface':_0x222c5e[_0xd81b('0x1b')]};}}}catch(_0x410ef3){logger[_0xd81b('0x33')](_0xd81b('0x3f'),_0x410ef3[_0xd81b('0x38')]);}};Acw['prototype'][_0xd81b('0xc')]=function(_0x2368dd){try{if(this[_0xd81b('0x1a')][_0x2368dd[_0xd81b('0x39')]]&&_['isUndefined'](this[_0xd81b('0x1a')][_0x2368dd[_0xd81b('0x39')]][_0xd81b('0x26')])){logger[_0xd81b('0x24')](_0xd81b('0x40'),_0x2368dd[_0xd81b('0x39')]);this[_0xd81b('0x41')](_0x2368dd[_0xd81b('0x39')]);}else if(this[_0xd81b('0x1a')][_0x2368dd['linkedid']]&&_['isUndefined'](this[_0xd81b('0x1a')][_0x2368dd[_0xd81b('0x42')]][_0xd81b('0x26')])){logger[_0xd81b('0x24')](_0xd81b('0x43'),_0x2368dd[_0xd81b('0x42')]);this[_0xd81b('0x41')](_0x2368dd[_0xd81b('0x42')]);}}catch(_0x4e039e){logger[_0xd81b('0x33')](_0xd81b('0x44'),_0x4e039e[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0xf')]=function(_0x59b13b){try{if(this[_0xd81b('0x1a')][_0x59b13b[_0xd81b('0x39')]]&&this['channels'][_0x59b13b[_0xd81b('0x39')]][_0xd81b('0x26')]){logger[_0xd81b('0x24')](_0xd81b('0x45'),_0x59b13b[_0xd81b('0x39')]);this[_0xd81b('0x41')](_0x59b13b[_0xd81b('0x39')]);}else if(this[_0xd81b('0x1a')][_0x59b13b[_0xd81b('0x42')]]&&this[_0xd81b('0x1a')][_0x59b13b[_0xd81b('0x42')]]['attended']){logger[_0xd81b('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x59b13b[_0xd81b('0x42')]);this[_0xd81b('0x41')](_0x59b13b[_0xd81b('0x42')]);}}catch(_0x3c2a9f){logger[_0xd81b('0x33')](_0xd81b('0x46'),_0x3c2a9f['message']);}};Acw[_0xd81b('0x19')][_0xd81b('0x13')]=function(_0x51f5a1){try{if(!_['isNil'](this[_0xd81b('0x1a')][_0x51f5a1['transfereeuniqueid']])){this[_0xd81b('0x41')](_0x51f5a1['transfereeuniqueid']);if(this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x47')]]){this[_0xd81b('0x1a')][_0x51f5a1['secondtransfereruniqueid']][_0xd81b('0x26')]=!![];this[_0xd81b('0x1a')][_0x51f5a1['transfertargetuniqueid']]=this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x47')]];delete this['channels'][_0x51f5a1[_0xd81b('0x47')]];}}else if(!_['isNil'](this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x48')]])){this[_0xd81b('0x41')](_0x51f5a1[_0xd81b('0x48')]);if(this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x49')]]){this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x49')]][_0xd81b('0x26')]=!![];this[_0xd81b('0x1a')][_0x51f5a1['transfereeuniqueid']]=this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x49')]];delete this[_0xd81b('0x1a')][_0x51f5a1[_0xd81b('0x49')]];}}}catch(_0x1bdf37){logger[_0xd81b('0x33')](_0xd81b('0x4a'),_0x1bdf37['message']);}};Acw['prototype']['syncBlindTransfer']=function(_0x2afe84){try{if(this[_0xd81b('0x1a')][_0x2afe84[_0xd81b('0x4b')]]){logger[_0xd81b('0x24')](_0xd81b('0x4c'),JSON[_0xd81b('0x3e')](_0x2afe84[_0xd81b('0x4b')]));this['startAcw'](_0x2afe84[_0xd81b('0x4b')]);}else if(this[_0xd81b('0x1a')][_0x2afe84[_0xd81b('0x4d')]]){logger[_0xd81b('0x24')](_0xd81b('0x4e'),JSON[_0xd81b('0x3e')](_0x2afe84[_0xd81b('0x4d')]));this['startAcw'](_0x2afe84[_0xd81b('0x4d')]);}}catch(_0x15f003){logger[_0xd81b('0x33')](_0xd81b('0x4f'),_0x15f003[_0xd81b('0x38')]);}};Acw[_0xd81b('0x19')][_0xd81b('0x11')]=function(_0x19d4f0){try{if(this[_0xd81b('0x7')][_0x19d4f0[_0xd81b('0x1c')]]&&this[_0xd81b('0x7')][_0x19d4f0[_0xd81b('0x1c')]]['autopause']===_0xd81b('0x50')){if(this['agents'][_0x19d4f0[_0xd81b('0x1b')]]){logger[_0xd81b('0x24')](_0xd81b('0x51'),_0x19d4f0[_0xd81b('0x39')],_0x19d4f0[_0xd81b('0x1b')],_0x19d4f0[_0xd81b('0x1c')]);return RpcUser[_0xd81b('0x28')](this[_0xd81b('0x8')][_0x19d4f0[_0xd81b('0x1b')]],_0xd81b('0x52'),_0x19d4f0['uniqueid']);}}}catch(_0xfa2a13){logger[_0xd81b('0x33')](_0xd81b('0x53'),_0xfa2a13[_0xd81b('0x38')]);}};module[_0xd81b('0x54')]=Acw; \ No newline at end of file +var _0xbec5=['syncAttendedTransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','lastPauseAt','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','util','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer'];(function(_0x357930,_0x29c90d){var _0x7abbce=function(_0x2e4fa2){while(--_0x2e4fa2){_0x357930['push'](_0x357930['shift']());}};_0x7abbce(++_0x29c90d);}(_0xbec5,0xe5));var _0x5bec=function(_0x1c2f29,_0x5a2668){_0x1c2f29=_0x1c2f29-0x0;var _0x258465=_0xbec5[_0x1c2f29];return _0x258465;};'use strict';var util=require(_0x5bec('0x0'));var _=require(_0x5bec('0x1'));var moment=require('moment');var ami=require(_0x5bec('0x2'));var logger=require(_0x5bec('0x3'))(_0x5bec('0x4'));var RpcUser=require(_0x5bec('0x5'));var RpcVoiceAgentReport=require(_0x5bec('0x6'));function Acw(_0x4ee982){this[_0x5bec('0x7')]=_0x4ee982[_0x5bec('0x7')];this[_0x5bec('0x8')]=_0x4ee982['agents'];this[_0x5bec('0x9')]=_0x4ee982[_0x5bec('0x9')];this[_0x5bec('0xa')]={};ami['on'](_0x5bec('0xb'),this[_0x5bec('0xc')][_0x5bec('0xd')](this));ami['on'](_0x5bec('0xe'),this[_0x5bec('0xf')]['bind'](this));ami['on'](_0x5bec('0x10'),this['syncHangup'][_0x5bec('0xd')](this));ami['on'](_0x5bec('0x11'),this[_0x5bec('0x12')]['bind'](this));ami['on'](_0x5bec('0x13'),this[_0x5bec('0x14')][_0x5bec('0xd')](this));ami['on']('blindtransfer',this[_0x5bec('0x15')][_0x5bec('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0x5bec('0x16')][_0x5bec('0xd')](this));}function getDiff(_0x35393a){var _0x6888a4=moment()[_0x5bec('0x17')](0x0);var _0xcd6d90=moment(_0x35393a)[_0x5bec('0x17')](0x0);return _0x6888a4[_0x5bec('0x18')](_0xcd6d90,_0x5bec('0x19'));}Acw[_0x5bec('0x1a')][_0x5bec('0x1b')]=function(_0x325daf){try{var _0x11fb8e=this;var _0x506639=this['channels'][_0x325daf][_0x5bec('0x1c')];var _0x773740=this[_0x5bec('0xa')][_0x325daf][_0x5bec('0x1d')];var _0x5cd7ae=this['voiceQueues'][_0x773740];var _0x3cd354=![];var _0x6c0d35='ACW';if(_0x5cd7ae[_0x5bec('0x1e')]){if(_0x5cd7ae[_0x5bec('0x1f')][_0x5bec('0x20')]){_0x3cd354=!![];_0x6c0d35=_0x5cd7ae[_0x5bec('0x1f')]['name'];}}ami[_0x5bec('0x21')]({'action':'QueuePause','interface':_0x506639,'paused':!![],'reason':_0x6c0d35})[_0x5bec('0x22')](function(_0x208d99){if(_0x11fb8e[_0x5bec('0x8')][_0x506639]){return RpcUser[_0x5bec('0x23')](_0x11fb8e[_0x5bec('0x8')][_0x506639]['id'])['then'](function(_0x232584){if(_0x232584&&!_0x232584['voicePause']){logger[_0x5bec('0x24')](_0x5bec('0x25'),_0x325daf,_0x506639,_0x773740);var _0x5b2636=_0x11fb8e[_0x5bec('0xa')][_0x325daf][_0x5bec('0x26')]&&_0x11fb8e['channels'][_0x325daf][_0x5bec('0x27')]?_0x11fb8e[_0x5bec('0xa')][_0x325daf][_0x5bec('0x27')]:_0x325daf;return RpcUser[_0x5bec('0x28')](_0x11fb8e[_0x5bec('0x8')][_0x506639],_0x6c0d35,_0x5b2636)[_0x5bec('0x22')](function(_0x2dc014){if(!_0x3cd354){_0x11fb8e['timers'][_0x506639]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x325daf,_0x11fb8e[_0x5bec('0x7')][_0x773740][_0x5bec('0x29')],_0x506639,_0x773740);_0x11fb8e[_0x5bec('0x9')][_0x506639]['timer']=setTimeout(_0x11fb8e[_0x5bec('0x2a')][_0x5bec('0xd')](_0x11fb8e,_0x506639),_0x11fb8e['voiceQueues'][_0x773740][_0x5bec('0x29')]*0x3e8);_0x11fb8e[_0x5bec('0x9')][_0x506639]['lastPauseAt']=moment()['format'](_0x5bec('0x2b'));_0x11fb8e[_0x5bec('0x9')][_0x506639][_0x5bec('0x2c')]=_0x325daf;_0x11fb8e[_0x5bec('0x9')][_0x506639][_0x5bec('0x1d')]=_0x773740;_0x11fb8e[_0x5bec('0x9')][_0x506639]['updateAcw']=function(){var _0x2987ca=getDiff(_0x11fb8e['timers'][_0x506639][_0x5bec('0x2d')]);clearTimeout(_0x11fb8e[_0x5bec('0x9')][_0x506639][_0x5bec('0x2e')]);_0x11fb8e[_0x5bec('0x9')][_0x506639]['timer']=![];RpcVoiceAgentReport[_0x5bec('0x2f')]({'acwtime':_0x2987ca},_0x11fb8e[_0x5bec('0x9')][_0x506639][_0x5bec('0x2c')],_0x506639)['then'](function(_0xf6ae6b){logger['info'](_0x5bec('0x30'),_0x325daf,_0x2987ca,_0xf6ae6b);})[_0x5bec('0x31')](function(_0x29df14){logger['error'](_0x5bec('0x32'),_0x325daf,_0x29df14);});delete _0x11fb8e[_0x5bec('0x9')][_0x506639];};}});}else{logger['info'](_0x5bec('0x33'),_0x325daf,_0x506639,_0x773740);}});}})[_0x5bec('0x31')](function(_0x24aa2f){logger[_0x5bec('0x34')](_0x5bec('0x35'),_0x325daf,_0x11fb8e['voiceQueues'][_0x773740][_0x5bec('0x29')],_0x506639,_0x773740);})['finally'](function(){delete _0x11fb8e[_0x5bec('0xa')][_0x325daf];});}catch(_0x384f04){logger[_0x5bec('0x34')](_0x5bec('0x36'),_0x384f04[_0x5bec('0x37')]);}};Acw[_0x5bec('0x1a')]['stopAcw']=function(_0x1c6cc3){try{var _0xb515bb=this;if(_0xb515bb[_0x5bec('0x9')][_0x1c6cc3]){_0xb515bb['timers'][_0x1c6cc3][_0x5bec('0x2e')]=![];var _0x355707=_0xb515bb['timers'][_0x1c6cc3][_0x5bec('0x2c')];var _0x58c34e=_0xb515bb[_0x5bec('0x9')][_0x1c6cc3][_0x5bec('0x1d')];var _0x402e5d=_0xb515bb['voiceQueues'][_0x58c34e][_0x5bec('0x29')];logger[_0x5bec('0x24')](_0x5bec('0x38'),_0x1c6cc3);RpcUser[_0x5bec('0x39')](this[_0x5bec('0x8')][_0x1c6cc3]);RpcVoiceAgentReport[_0x5bec('0x2f')]({'acwtime':_0x402e5d,'agentacw':!![]},_0x355707,_0x1c6cc3)[_0x5bec('0x22')](function(_0x4a8b0b){logger[_0x5bec('0x24')](_0x5bec('0x30'),_0x355707,_0x402e5d,_0x4a8b0b);})[_0x5bec('0x31')](function(_0x414d59){logger['error'](_0x5bec('0x32'),_0x355707,_0x414d59);});}else{logger[_0x5bec('0x34')](_0x5bec('0x3a'),_0x1c6cc3);if(_0xb515bb['timers']){logger['info'](_0x5bec('0x3b'),JSON[_0x5bec('0x3c')](_0xb515bb[_0x5bec('0x9')]));}}}catch(_0x11f667){logger[_0x5bec('0x34')]('[ACW][STOP]\x20%s',_0x11f667['message']);}};Acw[_0x5bec('0x1a')]['syncAgentConnect']=function(_0x39597c){try{if(this[_0x5bec('0x7')][_0x39597c[_0x5bec('0x1d')]]&&(this['voiceQueues'][_0x39597c[_0x5bec('0x1d')]][_0x5bec('0x4')]||this['voiceQueues'][_0x39597c[_0x5bec('0x1d')]][_0x5bec('0x1e')])){if(this[_0x5bec('0x8')][_0x39597c[_0x5bec('0x1c')]]){this[_0x5bec('0xa')][_0x39597c[_0x5bec('0x2c')]]={'queue':_0x39597c[_0x5bec('0x1d')],'interface':_0x39597c['interface'],'destlinkedid':_0x39597c['destlinkedid']};}}}catch(_0x776912){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x776912[_0x5bec('0x37')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x48bff0){try{if(this[_0x5bec('0x7')][_0x48bff0[_0x5bec('0x1d')]]&&(this[_0x5bec('0x7')][_0x48bff0[_0x5bec('0x1d')]]['acw']||this[_0x5bec('0x7')][_0x48bff0[_0x5bec('0x1d')]][_0x5bec('0x1e')])){if(this[_0x5bec('0x8')][_0x48bff0['interface']]){this[_0x5bec('0xa')][_0x48bff0[_0x5bec('0x2c')]]={'queue':_0x48bff0[_0x5bec('0x1d')],'interface':_0x48bff0['interface']};}}}catch(_0x2752ba){logger['error'](_0x5bec('0x3d'),_0x2752ba[_0x5bec('0x37')]);}};Acw[_0x5bec('0x1a')][_0x5bec('0xf')]=function(_0x54b11a){try{if(this[_0x5bec('0xa')][_0x54b11a[_0x5bec('0x2c')]]&&_[_0x5bec('0x3e')](this[_0x5bec('0xa')][_0x54b11a[_0x5bec('0x2c')]][_0x5bec('0x26')])){logger[_0x5bec('0x24')]('[%s][HANGUP:UNIQUEID]',_0x54b11a[_0x5bec('0x2c')]);this[_0x5bec('0x1b')](_0x54b11a['uniqueid']);}else if(this[_0x5bec('0xa')][_0x54b11a[_0x5bec('0x3f')]]&&_[_0x5bec('0x3e')](this[_0x5bec('0xa')][_0x54b11a[_0x5bec('0x3f')]][_0x5bec('0x26')])){logger[_0x5bec('0x24')]('[%s][HANGUP:LINKEDID]',_0x54b11a[_0x5bec('0x3f')]);this['startAcw'](_0x54b11a[_0x5bec('0x3f')]);}}catch(_0x208c7b){logger[_0x5bec('0x34')](_0x5bec('0x40'),_0x208c7b[_0x5bec('0x37')]);}};Acw[_0x5bec('0x1a')][_0x5bec('0x41')]=function(_0x3bc0c9){try{if(this[_0x5bec('0xa')][_0x3bc0c9[_0x5bec('0x2c')]]&&this['channels'][_0x3bc0c9[_0x5bec('0x2c')]]['attended']){logger['info'](_0x5bec('0x42'),_0x3bc0c9['uniqueid']);this['startAcw'](_0x3bc0c9[_0x5bec('0x2c')]);}else if(this[_0x5bec('0xa')][_0x3bc0c9[_0x5bec('0x3f')]]&&this['channels'][_0x3bc0c9[_0x5bec('0x3f')]][_0x5bec('0x26')]){logger[_0x5bec('0x24')](_0x5bec('0x43'),_0x3bc0c9['linkedid']);this[_0x5bec('0x1b')](_0x3bc0c9[_0x5bec('0x3f')]);}}catch(_0x9cae50){logger[_0x5bec('0x34')](_0x5bec('0x44'),_0x9cae50[_0x5bec('0x37')]);}};Acw[_0x5bec('0x1a')]['syncAttendedTransfer']=function(_0x504dda){try{if(!_[_0x5bec('0x45')](this['channels'][_0x504dda[_0x5bec('0x46')]])){this[_0x5bec('0x1b')](_0x504dda['transfereeuniqueid']);if(this[_0x5bec('0xa')][_0x504dda['secondtransfereruniqueid']]){this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x47')]][_0x5bec('0x26')]=!![];this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x48')]]=this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x47')]];delete this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x47')]];}}else if(!_[_0x5bec('0x45')](this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x48')]])){this[_0x5bec('0x1b')](_0x504dda[_0x5bec('0x48')]);if(this['channels'][_0x504dda[_0x5bec('0x49')]]){this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x49')]]['attended']=!![];this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x46')]]=this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x49')]];delete this[_0x5bec('0xa')][_0x504dda['origtransfereruniqueid']];}}}catch(_0x3e3108){logger[_0x5bec('0x34')](_0x5bec('0x4a'),_0x3e3108[_0x5bec('0x37')]);}};Acw['prototype'][_0x5bec('0x15')]=function(_0x5dda24){try{if(this[_0x5bec('0xa')][_0x5dda24[_0x5bec('0x4b')]]){logger[_0x5bec('0x24')](_0x5bec('0x4c'),JSON['stringify'](_0x5dda24[_0x5bec('0x4b')]));this[_0x5bec('0x1b')](_0x5dda24[_0x5bec('0x4b')]);}else if(this[_0x5bec('0xa')][_0x5dda24[_0x5bec('0x4d')]]){logger[_0x5bec('0x24')](_0x5bec('0x4e'),JSON[_0x5bec('0x3c')](_0x5dda24[_0x5bec('0x4d')]));this[_0x5bec('0x1b')](_0x5dda24[_0x5bec('0x4d')]);}}catch(_0x42d4e4){logger[_0x5bec('0x34')](_0x5bec('0x4f'),_0x42d4e4[_0x5bec('0x37')]);}};Acw['prototype'][_0x5bec('0x12')]=function(_0x27c160){try{if(this['voiceQueues'][_0x27c160[_0x5bec('0x1d')]]&&this['voiceQueues'][_0x27c160[_0x5bec('0x1d')]][_0x5bec('0x50')]==='all'){if(this['agents'][_0x27c160[_0x5bec('0x1c')]]){logger[_0x5bec('0x24')](_0x5bec('0x51'),_0x27c160[_0x5bec('0x2c')],_0x27c160[_0x5bec('0x1c')],_0x27c160['queue']);return RpcUser[_0x5bec('0x28')](this[_0x5bec('0x8')][_0x27c160['interface']],_0x5bec('0x52'),_0x27c160[_0x5bec('0x2c')]);}}}catch(_0x44a945){logger[_0x5bec('0x34')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x44a945[_0x5bec('0x37')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ce66ab9..d3d1f3b 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 _0x0fc3=['fullybooted','resolve','then','actionQueueSummary','actionCoreShowChannels','catch','log','exports','asterisk-manager','bluebird','moment','util','lodash','ami','../../config/environment','asterisk','port','username','password','keepConnected','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x0fc3,0x1d6));var _0x30fc=function(_0x4d28df,_0x3cec2f){_0x4d28df=_0x4d28df-0x0;var _0x15b115=_0x0fc3[_0x4d28df];return _0x15b115;};'use strict';var Manager=require(_0x30fc('0x0'));var BPromise=require(_0x30fc('0x1'));var moment=require(_0x30fc('0x2'));var util=require(_0x30fc('0x3'));var _=require(_0x30fc('0x4'));var logger=require('../../config/logger')(_0x30fc('0x5'));var config=require(_0x30fc('0x6'));var ami=new Manager(config[_0x30fc('0x7')][_0x30fc('0x8')],config['asterisk']['ip'],config[_0x30fc('0x7')][_0x30fc('0x9')],config['asterisk'][_0x30fc('0xa')],!![]);ami[_0x30fc('0xb')]();ami['Action']=BPromise[_0x30fc('0xc')](ami[_0x30fc('0xd')]);function error(_0x133869){logger['error'](util[_0x30fc('0xe')](_0x30fc('0xf'),config[_0x30fc('0x7')]['username'],config[_0x30fc('0x7')]['ip'],config[_0x30fc('0x7')][_0x30fc('0x8')],util[_0x30fc('0x10')](_0x133869,![],null)));}function close(){logger[_0x30fc('0x11')](util[_0x30fc('0xe')](_0x30fc('0x12'),config[_0x30fc('0x7')][_0x30fc('0x9')],config[_0x30fc('0x7')]['ip'],config['asterisk'][_0x30fc('0x8')]));}ami[_0x30fc('0x13')]=function(){return function(){return ami[_0x30fc('0x14')]({'action':_0x30fc('0x15')});};};ami[_0x30fc('0x16')]=function(){return function(){return ami['Action']({'action':_0x30fc('0x17')});};};ami[_0x30fc('0x18')]=function(){return function(){return ami[_0x30fc('0x14')]({'action':_0x30fc('0x19')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x30fc('0x14')]({'action':_0x30fc('0x1a')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x30fc('0x14')]({'action':_0x30fc('0x1b')});};};function connect(_0xf6f99f){logger[_0x30fc('0x1c')](util[_0x30fc('0xe')](_0x30fc('0x1d'),config[_0x30fc('0x7')]['username'],config[_0x30fc('0x7')]['ip'],config[_0x30fc('0x7')][_0x30fc('0x8')]));ami[_0x30fc('0x1e')](_0x30fc('0x11'),error);ami['once'](_0x30fc('0x1f'),close);}ami['on']('connect',connect);ami['on'](_0x30fc('0x20'),function(_0x15ba11){logger[_0x30fc('0x1c')](util[_0x30fc('0xe')](_0x30fc('0x21'),config[_0x30fc('0x7')][_0x30fc('0x9')],config[_0x30fc('0x7')]['ip'],config[_0x30fc('0x7')]['port'],util[_0x30fc('0x10')](_0x15ba11,![],null)));});ami['on'](_0x30fc('0x22'),function(_0x45c7a8){logger[_0x30fc('0x1c')](util[_0x30fc('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x30fc('0x9')],config[_0x30fc('0x7')]['ip'],config[_0x30fc('0x7')][_0x30fc('0x8')]));return BPromise[_0x30fc('0x23')]()[_0x30fc('0x24')](ami[_0x30fc('0x13')]())[_0x30fc('0x24')](ami[_0x30fc('0x16')]())['then'](ami[_0x30fc('0x18')]())[_0x30fc('0x24')](ami[_0x30fc('0x25')]())[_0x30fc('0x24')](ami[_0x30fc('0x26')]())[_0x30fc('0x27')](function(_0xca1f32){console[_0x30fc('0x28')](_0xca1f32);});});ami['once']('error',error);ami['once']('close',close);module[_0x30fc('0x29')]=ami; \ No newline at end of file +var _0xbc18=['queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','log','asterisk-manager','bluebird','moment','util','ami','../../config/environment','port','asterisk','username','password','keepConnected','Action','promisify','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbc18,0x128));var _0x8bc1=function(_0x5f584a,_0x47f064){_0x5f584a=_0x5f584a-0x0;var _0x3788d9=_0xbc18[_0x5f584a];return _0x3788d9;};'use strict';var Manager=require(_0x8bc1('0x0'));var BPromise=require(_0x8bc1('0x1'));var moment=require(_0x8bc1('0x2'));var util=require(_0x8bc1('0x3'));var _=require('lodash');var logger=require('../../config/logger')(_0x8bc1('0x4'));var config=require(_0x8bc1('0x5'));var ami=new Manager(config['asterisk'][_0x8bc1('0x6')],config['asterisk']['ip'],config[_0x8bc1('0x7')][_0x8bc1('0x8')],config[_0x8bc1('0x7')][_0x8bc1('0x9')],!![]);ami[_0x8bc1('0xa')]();ami[_0x8bc1('0xb')]=BPromise[_0x8bc1('0xc')](ami['action']);function error(_0x5c7e67){logger['error'](util[_0x8bc1('0xd')](_0x8bc1('0xe'),config[_0x8bc1('0x7')][_0x8bc1('0x8')],config[_0x8bc1('0x7')]['ip'],config[_0x8bc1('0x7')][_0x8bc1('0x6')],util[_0x8bc1('0xf')](_0x5c7e67,![],null)));}function close(){logger[_0x8bc1('0x10')](util[_0x8bc1('0xd')](_0x8bc1('0x11'),config[_0x8bc1('0x7')][_0x8bc1('0x8')],config[_0x8bc1('0x7')]['ip'],config[_0x8bc1('0x7')][_0x8bc1('0x6')]));}ami[_0x8bc1('0x12')]=function(){return function(){return ami[_0x8bc1('0xb')]({'action':_0x8bc1('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x8bc1('0x14')});};};ami[_0x8bc1('0x15')]=function(){return function(){return ami[_0x8bc1('0xb')]({'action':_0x8bc1('0x16')});};};ami[_0x8bc1('0x17')]=function(){return function(){return ami[_0x8bc1('0xb')]({'action':_0x8bc1('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x8bc1('0xb')]({'action':_0x8bc1('0x19')});};};function connect(_0x529bd9){logger[_0x8bc1('0x1a')](util['format'](_0x8bc1('0x1b'),config[_0x8bc1('0x7')][_0x8bc1('0x8')],config[_0x8bc1('0x7')]['ip'],config[_0x8bc1('0x7')][_0x8bc1('0x6')]));ami[_0x8bc1('0x1c')](_0x8bc1('0x10'),error);ami['once'](_0x8bc1('0x1d'),close);}ami['on'](_0x8bc1('0x1e'),connect);ami['on'](_0x8bc1('0x1f'),function(_0x131d83){logger[_0x8bc1('0x1a')](util[_0x8bc1('0xd')](_0x8bc1('0x20'),config['asterisk'][_0x8bc1('0x8')],config[_0x8bc1('0x7')]['ip'],config[_0x8bc1('0x7')][_0x8bc1('0x6')],util['inspect'](_0x131d83,![],null)));});ami['on'](_0x8bc1('0x21'),function(_0x21c98f){logger[_0x8bc1('0x1a')](util[_0x8bc1('0xd')](_0x8bc1('0x22'),config[_0x8bc1('0x7')][_0x8bc1('0x8')],config['asterisk']['ip'],config[_0x8bc1('0x7')][_0x8bc1('0x6')]));return BPromise[_0x8bc1('0x23')]()[_0x8bc1('0x24')](ami[_0x8bc1('0x12')]())[_0x8bc1('0x24')](ami['actionDeviceStateList']())['then'](ami[_0x8bc1('0x15')]())[_0x8bc1('0x24')](ami[_0x8bc1('0x17')]())[_0x8bc1('0x24')](ami[_0x8bc1('0x25')]())[_0x8bc1('0x26')](function(_0x31fb81){console[_0x8bc1('0x27')](_0x31fb81);});});ami[_0x8bc1('0x1c')](_0x8bc1('0x10'),error);ami[_0x8bc1('0x1c')](_0x8bc1('0x1d'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index b2d48c2..e6b5587 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 _0x57e6=['memberReport','error','message','result','rpc','exports','bluebird','../../config/logger','ami','http','request'];(function(_0x3b8240,_0x4cf6d6){var _0x39edd4=function(_0x165de1){while(--_0x165de1){_0x3b8240['push'](_0x3b8240['shift']());}};_0x39edd4(++_0x4cf6d6);}(_0x57e6,0x119));var _0x657e=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0x57e6[_0x409deb];return _0x15a4f7;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x657e('0x0'));var logger=require(_0x657e('0x1'))(_0x657e('0x2'));var client=jayson['client'][_0x657e('0x3')]({'port':0x2329});client['Request']=function(_0x50e240,_0x514142){return new BPromise(function(_0x14f2c2,_0x19865b){return client[_0x657e('0x4')](_0x50e240,_0x514142)['then'](function(_0x3cb723){logger['debug']('rpc',_0x657e('0x5'),_0x50e240,_0x514142,_0x3cb723);if(_0x3cb723[_0x657e('0x6')]){logger[_0x657e('0x6')]('rpc',_0x657e('0x5'),_0x50e240,_0x3cb723['error'][_0x657e('0x7')],_0x514142);return _0x19865b(_0x3cb723[_0x657e('0x6')][_0x657e('0x7')]);}else{return _0x14f2c2(_0x3cb723[_0x657e('0x8')]);}})['catch'](function(_0x153f5d){logger[_0x657e('0x6')](_0x657e('0x9'),_0x657e('0x5'),_0x50e240,_0x153f5d,_0x514142);return _0x19865b(_0x153f5d);});});};module[_0x657e('0xa')]=client; \ No newline at end of file +var _0x2955=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','request','debug','rpc','memberReport','error','message'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x2955,0xe3));var _0x5295=function(_0x17d4cd,_0x5876ae){_0x17d4cd=_0x17d4cd-0x0;var _0x47fb2d=_0x2955[_0x17d4cd];return _0x47fb2d;};'use strict';var jayson=require(_0x5295('0x0'));var BPromise=require(_0x5295('0x1'));var logger=require(_0x5295('0x2'))(_0x5295('0x3'));var client=jayson[_0x5295('0x4')][_0x5295('0x5')]({'port':0x2329});client[_0x5295('0x6')]=function(_0x4280ed,_0x505827){return new BPromise(function(_0x20dfe0,_0x109881){return client[_0x5295('0x7')](_0x4280ed,_0x505827)['then'](function(_0x644f63){logger[_0x5295('0x8')](_0x5295('0x9'),_0x5295('0xa'),_0x4280ed,_0x505827,_0x644f63);if(_0x644f63['error']){logger['error'](_0x5295('0x9'),_0x5295('0xa'),_0x4280ed,_0x644f63[_0x5295('0xb')][_0x5295('0xc')],_0x505827);return _0x109881(_0x644f63['error'][_0x5295('0xc')]);}else{return _0x20dfe0(_0x644f63[_0x5295('0xd')]);}})[_0x5295('0xe')](function(_0x1749e0){logger['error'](_0x5295('0x9'),'memberReport',_0x4280ed,_0x1749e0,_0x505827);return _0x109881(_0x1749e0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 133ee96..f5d78bf 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 _0xe6f1=['ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','substring','voiceQueue','dialCutDigit','getQueue','queue','util','moment','string','isNil','Contact','phone','firstName','lastName','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0xe6f1,0x19c));var _0x1e6f=function(_0x5124d2,_0x3400cb){_0x5124d2=_0x5124d2-0x0;var _0x361478=_0xe6f1[_0x5124d2];return _0x361478;};'use strict';var util=require(_0x1e6f('0x0'));var _=require('lodash');var moment=require(_0x1e6f('0x1'));function checkNameSurname(_0x5bc0b0,_0x3d42b3,_0x56bb81){var _0x34fcdd='';if(!_['isNil'](_0x3d42b3)&&_0x1e6f('0x2')===typeof _0x3d42b3){_0x34fcdd+=_0x3d42b3;}if(!_[_0x1e6f('0x3')](_0x56bb81)&&_0x1e6f('0x2')===typeof _0x56bb81){_0x34fcdd+='\x20'+_0x56bb81;}if(_0x34fcdd!==''){return _0x34fcdd;}return _0x5bc0b0;}function Action(_0x1d0119,_0x289772,_0x4cecf5){this['voiceQueue']=_0x1d0119;this['uniqueid']=_0x4cecf5||undefined;this['name']=checkNameSurname(_0x289772[_0x1e6f('0x4')][_0x1e6f('0x5')],_0x289772['Contact'][_0x1e6f('0x6')],_0x289772[_0x1e6f('0x4')][_0x1e6f('0x7')]);this[_0x1e6f('0x8')]=_0x289772['Contact'][_0x1e6f('0x5')];this['queue']=_0x1d0119[_0x1e6f('0x9')];this[_0x1e6f('0xa')]=_0x289772[_0x1e6f('0xa')]||![];this[_0x1e6f('0xb')]=_0x1d0119['type'];this[_0x1e6f('0xc')]=_0x1d0119['dialQueueTimeout']||0x3;this[_0x1e6f('0xd')]=_0x289772[_0x1e6f('0xd')];this[_0x1e6f('0xe')]=_0x289772[_0x1e6f('0xe')];this[_0x1e6f('0xf')]=_0x289772['countcongestionretry'];this[_0x1e6f('0x10')]=_0x289772[_0x1e6f('0x10')];this[_0x1e6f('0x11')]=_0x289772[_0x1e6f('0x11')];this[_0x1e6f('0x12')]=_0x289772[_0x1e6f('0x12')];this[_0x1e6f('0x13')]=_0x289772[_0x1e6f('0x13')];this[_0x1e6f('0x14')]=_0x289772[_0x1e6f('0x14')];this['countagentrejectretry']=_0x289772[_0x1e6f('0x15')];this[_0x1e6f('0x16')]=_0x289772[_0x1e6f('0x16')];this[_0x1e6f('0x17')]=_0x289772[_0x1e6f('0x17')];this['UserId']=_0x289772[_0x1e6f('0x18')];this[_0x1e6f('0x19')]=_0x289772[_0x1e6f('0x19')];this[_0x1e6f('0x1a')]=_0x289772[_0x1e6f('0x1a')];this[_0x1e6f('0x1b')]=_0x289772['id'];this[_0x1e6f('0x1c')]=_0x289772[_0x1e6f('0x4')][_0x1e6f('0x6')]||'';this[_0x1e6f('0x1d')]=moment()[_0x1e6f('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1e6f('0x1f')]=_0x289772[_0x1e6f('0x1f')];this[_0x1e6f('0x20')]=_0x289772['callbackuniqueid'];this[_0x1e6f('0x21')]=_0x289772[_0x1e6f('0x21')];this['recallme']=_0x289772[_0x1e6f('0x22')];this[_0x1e6f('0x23')]='';this[_0x1e6f('0x24')]='';}Action[_0x1e6f('0x25')]['getCaller']=function(){return util[_0x1e6f('0x1e')](_0x1e6f('0x26'),this[_0x1e6f('0x9')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x1e6f('0x8')][_0x1e6f('0x27')](this[_0x1e6f('0x28')][_0x1e6f('0x29')]):this[_0x1e6f('0x8')]);};Action[_0x1e6f('0x25')][_0x1e6f('0x2a')]=function(){return this[_0x1e6f('0x2b')];};module['exports']=Action; \ No newline at end of file +var _0xb01a=['VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','phone','Contact','queue','name','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x4cdece,_0x2c330f){var _0x296080=function(_0x3cf8cf){while(--_0x3cf8cf){_0x4cdece['push'](_0x4cdece['shift']());}};_0x296080(++_0x2c330f);}(_0xb01a,0x1a1));var _0xab01=function(_0x49e52e,_0x15f616){_0x49e52e=_0x49e52e-0x0;var _0x36a6e6=_0xb01a[_0x49e52e];return _0x36a6e6;};'use strict';var util=require(_0xab01('0x0'));var _=require(_0xab01('0x1'));var moment=require(_0xab01('0x2'));function checkNameSurname(_0x2c8083,_0x392b1e,_0xf04f1b){var _0xd3eaba='';if(!_[_0xab01('0x3')](_0x392b1e)&&_0xab01('0x4')===typeof _0x392b1e){_0xd3eaba+=_0x392b1e;}if(!_[_0xab01('0x3')](_0xf04f1b)&&_0xab01('0x4')===typeof _0xf04f1b){_0xd3eaba+='\x20'+_0xf04f1b;}if(_0xd3eaba!==''){return _0xd3eaba;}return _0x2c8083;}function Action(_0x47103c,_0x22db85,_0x5d8dd9){this[_0xab01('0x5')]=_0x47103c;this[_0xab01('0x6')]=_0x5d8dd9||undefined;this['name']=checkNameSurname(_0x22db85['Contact'][_0xab01('0x7')],_0x22db85[_0xab01('0x8')]['firstName'],_0x22db85[_0xab01('0x8')]['lastName']);this['number']=_0x22db85[_0xab01('0x8')]['phone'];this[_0xab01('0x9')]=_0x47103c[_0xab01('0xa')];this['active']=_0x22db85[_0xab01('0xb')]||![];this['type']=_0x47103c['type'];this[_0xab01('0xc')]=_0x47103c[_0xab01('0xc')]||0x3;this[_0xab01('0xd')]=_0x22db85[_0xab01('0xd')];this[_0xab01('0xe')]=_0x22db85[_0xab01('0xe')];this[_0xab01('0xf')]=_0x22db85[_0xab01('0xf')];this['countnoanswerretry']=_0x22db85['countnoanswerretry'];this['countnosuchnumberretry']=_0x22db85['countnosuchnumberretry'];this[_0xab01('0x10')]=_0x22db85['countdropretry'];this[_0xab01('0x11')]=_0x22db85[_0xab01('0x11')];this[_0xab01('0x12')]=_0x22db85[_0xab01('0x12')];this['countagentrejectretry']=_0x22db85[_0xab01('0x13')];this['ContactId']=_0x22db85[_0xab01('0x14')];this[_0xab01('0x15')]=_0x22db85['ListId'];this['UserId']=_0x22db85[_0xab01('0x16')];this[_0xab01('0x17')]=_0x22db85[_0xab01('0x17')];this[_0xab01('0x18')]=_0x22db85[_0xab01('0x18')];this[_0xab01('0x19')]=_0x22db85['id'];this[_0xab01('0x1a')]=_0x22db85[_0xab01('0x8')][_0xab01('0x1b')]||'';this[_0xab01('0x1c')]=moment()['format'](_0xab01('0x1d'));this[_0xab01('0x1e')]=_0x22db85[_0xab01('0x1e')];this[_0xab01('0x1f')]=_0x22db85[_0xab01('0x1f')];this[_0xab01('0x20')]=_0x22db85[_0xab01('0x20')];this[_0xab01('0x21')]=_0x22db85['recallme'];this[_0xab01('0x22')]='';this[_0xab01('0x23')]='';}Action[_0xab01('0x24')][_0xab01('0x25')]=function(){return util[_0xab01('0x26')](_0xab01('0x27'),this[_0xab01('0xa')],this['voiceQueue'][_0xab01('0x28')]>0x0?this[_0xab01('0x29')][_0xab01('0x2a')](this[_0xab01('0x5')][_0xab01('0x28')]):this[_0xab01('0x29')]);};Action[_0xab01('0x24')]['getQueue']=function(){return this[_0xab01('0x9')];};module[_0xab01('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 2b32e4a..14de2dc 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 _0x9851=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','name','calleridnum'];(function(_0x5ca38b,_0xf84298){var _0x2614a4=function(_0x5277f){while(--_0x5277f){_0x5ca38b['push'](_0x5ca38b['shift']());}};_0x2614a4(++_0xf84298);}(_0x9851,0x171));var _0x1985=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9851[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x1985('0x0'));var _=require(_0x1985('0x1'));var moment=require('moment');function getSeconds(_0x44fdc6,_0x17ad74){var _0xff640a=moment(_0x44fdc6)[_0x1985('0x2')](0x0);var _0x525e08=moment(_0x17ad74)['milliseconds'](0x0);return _0xff640a[_0x1985('0x3')](_0x525e08,_0x1985('0x4'));}function AdditionalPhone(_0x443ab2){this[_0x1985('0x5')]=_0x443ab2[_0x1985('0x5')];this[_0x1985('0x6')]=_0x443ab2['scheduledat']||undefined;this[_0x1985('0x7')]=_0x443ab2[_0x1985('0x7')];this[_0x1985('0x8')]=_0x443ab2['type']===_0x1985('0x9')?'queue':_0x443ab2[_0x1985('0x7')];this['countbusyretry']=_0x443ab2[_0x1985('0xa')];this[_0x1985('0xb')]=_0x443ab2['countcongestionretry'];this['countnoanswerretry']=_0x443ab2['countnoanswerretry'];this[_0x1985('0xc')]=_0x443ab2[_0x1985('0xa')]+_0x443ab2[_0x1985('0xb')]+_0x443ab2['countnoanswerretry']+_0x443ab2[_0x1985('0xd')]+_0x443ab2['countdropretry']+_0x443ab2[_0x1985('0xe')]+_0x443ab2[_0x1985('0xf')]+_0x443ab2[_0x1985('0x10')];this[_0x1985('0xd')]=_0x443ab2['countnosuchnumberretry'];this[_0x1985('0x11')]=_0x443ab2['countdropretry'];this[_0x1985('0xe')]=_0x443ab2[_0x1985('0xe')];this[_0x1985('0xf')]=_0x443ab2[_0x1985('0xf')];this['countagentrejectretry']=_0x443ab2['countagentrejectretry'];this[_0x1985('0x12')]=_0x443ab2['queue'];this['calleridname']=_0x443ab2[_0x1985('0x13')];this[_0x1985('0x14')]=_0x443ab2['number'];this[_0x1985('0x15')]=_0x443ab2[_0x1985('0x15')];this[_0x1985('0x16')]=_0x443ab2[_0x1985('0x16')];this[_0x1985('0x17')]=_0x443ab2[_0x1985('0x16')];this[_0x1985('0x18')]=getSeconds(_0x443ab2[_0x1985('0x16')],_0x443ab2[_0x1985('0x15')]);this[_0x1985('0x19')]=0x0;this[_0x1985('0x1a')]=0x0;this[_0x1985('0x1b')]=_0x443ab2[_0x1985('0x1b')];this[_0x1985('0x1c')]=_0x443ab2[_0x1985('0x1c')];this[_0x1985('0x1d')]=_0x443ab2[_0x1985('0x1d')];this['recallme']=_0x443ab2[_0x1985('0x1e')];this['ContactId']=_0x443ab2[_0x1985('0x1f')];this[_0x1985('0x20')]=_0x443ab2[_0x1985('0x20')];this[_0x1985('0x21')]=_0x443ab2[_0x1985('0x21')];this[_0x1985('0x22')]=_0x443ab2['VoiceQueueId'];this[_0x1985('0x23')]=_0x443ab2[_0x1985('0x23')];this['originatecalleridnum']=_0x443ab2[_0x1985('0x24')]||'';this[_0x1985('0x25')]=_0x443ab2[_0x1985('0x25')]||'';}module[_0x1985('0x26')]=History; \ No newline at end of file +var _0x701b=['calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry'];(function(_0x1529ca,_0xda1a9f){var _0x2ee87d=function(_0x531e78){while(--_0x531e78){_0x1529ca['push'](_0x1529ca['shift']());}};_0x2ee87d(++_0xda1a9f);}(_0x701b,0x16f));var _0xb701=function(_0x152a03,_0x41a4fe){_0x152a03=_0x152a03-0x0;var _0x3ccbd0=_0x701b[_0x152a03];return _0x3ccbd0;};'use strict';var util=require(_0xb701('0x0'));var _=require(_0xb701('0x1'));var moment=require(_0xb701('0x2'));function getSeconds(_0x1ea7cc,_0x3ef266){var _0x19cfae=moment(_0x1ea7cc)[_0xb701('0x3')](0x0);var _0x206c6d=moment(_0x3ef266)[_0xb701('0x3')](0x0);return _0x19cfae[_0xb701('0x4')](_0x206c6d,_0xb701('0x5'));}function AdditionalPhone(_0x180773){this[_0xb701('0x6')]=_0x180773[_0xb701('0x6')];this[_0xb701('0x7')]=_0x180773[_0xb701('0x7')]||undefined;this[_0xb701('0x8')]=_0x180773[_0xb701('0x8')];this['campaigntype']=_0x180773[_0xb701('0x8')]==='outbound'?_0xb701('0x9'):_0x180773[_0xb701('0x8')];this[_0xb701('0xa')]=_0x180773[_0xb701('0xa')];this['countcongestionretry']=_0x180773[_0xb701('0xb')];this[_0xb701('0xc')]=_0x180773[_0xb701('0xc')];this['countglobal']=_0x180773[_0xb701('0xa')]+_0x180773[_0xb701('0xb')]+_0x180773[_0xb701('0xc')]+_0x180773[_0xb701('0xd')]+_0x180773[_0xb701('0xe')]+_0x180773['countabandonedretry']+_0x180773[_0xb701('0xf')]+_0x180773[_0xb701('0x10')];this[_0xb701('0xd')]=_0x180773[_0xb701('0xd')];this[_0xb701('0xe')]=_0x180773[_0xb701('0xe')];this[_0xb701('0x11')]=_0x180773['countabandonedretry'];this['countmachineretry']=_0x180773[_0xb701('0xf')];this[_0xb701('0x10')]=_0x180773['countagentrejectretry'];this[_0xb701('0x9')]=_0x180773[_0xb701('0x9')];this[_0xb701('0x12')]=_0x180773['name'];this[_0xb701('0x13')]=_0x180773['number'];this[_0xb701('0x14')]=_0x180773[_0xb701('0x14')];this[_0xb701('0x15')]=_0x180773[_0xb701('0x15')];this[_0xb701('0x16')]=_0x180773['responsetime'];this[_0xb701('0x17')]=getSeconds(_0x180773[_0xb701('0x15')],_0x180773[_0xb701('0x14')]);this[_0xb701('0x18')]=0x0;this[_0xb701('0x19')]=0x0;this[_0xb701('0x1a')]=_0x180773[_0xb701('0x1a')];this[_0xb701('0x1b')]=_0x180773['callbackuniqueid'];this[_0xb701('0x1c')]=_0x180773[_0xb701('0x1c')];this[_0xb701('0x1d')]=_0x180773[_0xb701('0x1d')];this['ContactId']=_0x180773['ContactId'];this[_0xb701('0x1e')]=_0x180773['ListId'];this[_0xb701('0x1f')]=_0x180773[_0xb701('0x1f')];this[_0xb701('0x20')]=_0x180773[_0xb701('0x20')];this['CampaignId']=_0x180773['CampaignId'];this[_0xb701('0x21')]=_0x180773[_0xb701('0x21')]||'';this[_0xb701('0x22')]=_0x180773[_0xb701('0x22')]||'';}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 6e80b1f..ec44014 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 _0xc65c=['answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime'];(function(_0x413b73,_0x8f6b70){var _0xb830e1=function(_0x2457ca){while(--_0x2457ca){_0x413b73['push'](_0x413b73['shift']());}};_0xb830e1(++_0x8f6b70);}(_0xc65c,0x18c));var _0xcc65=function(_0x3be01c,_0x470941){_0x3be01c=_0x3be01c-0x0;var _0x5de780=_0xc65c[_0x3be01c];return _0x5de780;};'use strict';var util=require(_0xcc65('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x4f63bb,_0x67e9b4){var _0x1b4f01=moment(_0x4f63bb)[_0xcc65('0x1')](0x0);var _0x52ba81=moment(_0x67e9b4)[_0xcc65('0x1')](0x0);return _0x1b4f01[_0xcc65('0x2')](_0x52ba81,_0xcc65('0x3'));}function AgentComplete(_0x350886,_0x3be348){this[_0xcc65('0x4')]=0x4;this[_0xcc65('0x5')]=_0xcc65('0x6');this[_0xcc65('0x7')]=_0x350886[_0xcc65('0x7')];this[_0xcc65('0x8')]=_0x350886[_0xcc65('0x8')];this[_0xcc65('0x9')]=_0x350886[_0xcc65('0x8')]===_0xcc65('0xa')?_0xcc65('0xb'):_0x350886[_0xcc65('0x8')];this['countbusyretry']=_0x350886[_0xcc65('0xc')];this[_0xcc65('0xd')]=_0x350886['countcongestionretry'];this[_0xcc65('0xe')]=_0x350886[_0xcc65('0xe')];this[_0xcc65('0xf')]=_0x350886[_0xcc65('0xc')]+_0x350886[_0xcc65('0xd')]+_0x350886[_0xcc65('0xe')]+_0x350886[_0xcc65('0x10')]+_0x350886['countdropretry']+_0x350886['countabandonedretry']+_0x350886[_0xcc65('0x11')]+_0x350886[_0xcc65('0x12')];this[_0xcc65('0x10')]=_0x350886[_0xcc65('0x10')];this[_0xcc65('0x13')]=_0x350886[_0xcc65('0x13')];this[_0xcc65('0x14')]=_0x350886[_0xcc65('0x14')];this[_0xcc65('0x11')]=_0x350886[_0xcc65('0x11')];this[_0xcc65('0x12')]=_0x350886[_0xcc65('0x12')];this[_0xcc65('0x15')]=_0x3be348[_0xcc65('0x15')];this['calleridname']=_0x350886[_0xcc65('0x16')];this[_0xcc65('0x17')]=_0x350886[_0xcc65('0x18')];this[_0xcc65('0x19')]=_0x350886[_0xcc65('0x19')];this['responsetime']=_0x350886[_0xcc65('0x1a')];this[_0xcc65('0x1b')]=_0x350886[_0xcc65('0x1b')];this[_0xcc65('0x1c')]=moment()[_0xcc65('0x1d')](_0xcc65('0x1e'));this[_0xcc65('0x1f')]=getSeconds(_0x350886[_0xcc65('0x1a')],_0x350886[_0xcc65('0x19')]);this[_0xcc65('0x20')]=getSeconds(_0x350886[_0xcc65('0x1b')],_0x350886[_0xcc65('0x1a')]);this[_0xcc65('0x21')]=getSeconds(this[_0xcc65('0x1c')],_0x350886[_0xcc65('0x1b')]);this['queue']=_0x3be348[_0xcc65('0xb')];this[_0xcc65('0x22')]=_0x3be348[_0xcc65('0x22')];this[_0xcc65('0x23')]=_0x3be348[_0xcc65('0x23')];this[_0xcc65('0x24')]=_0x350886['callback'];this['callbackuniqueid']=_0x350886[_0xcc65('0x25')];this[_0xcc65('0x26')]=_0x350886[_0xcc65('0x26')];this[_0xcc65('0x27')]=_0x350886[_0xcc65('0x27')];this[_0xcc65('0x28')]=_0x350886[_0xcc65('0x28')];this[_0xcc65('0x29')]=_0x350886[_0xcc65('0x29')];this[_0xcc65('0x2a')]=_0x350886['UserId'];this[_0xcc65('0x2b')]=_0x350886[_0xcc65('0x2b')];this[_0xcc65('0x2c')]=_0x350886['CampaignId'];this['originatecalleridnum']=_0x350886['originatecalleridnum']||'';this[_0xcc65('0x2d')]=_0x350886[_0xcc65('0x2d')]||'';}module[_0xcc65('0x2e')]=AgentComplete; \ No newline at end of file +var _0x4701=['lodash','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4701,0x8d));var _0x1470=function(_0x4048d6,_0x5e80ec){_0x4048d6=_0x4048d6-0x0;var _0x1d1f20=_0x4701[_0x4048d6];return _0x1d1f20;};'use strict';var util=require('util');var _=require(_0x1470('0x0'));var moment=require('moment');function getSeconds(_0x32c5d1,_0x5bf2ce){var _0x7e445c=moment(_0x32c5d1)[_0x1470('0x1')](0x0);var _0x4a86e9=moment(_0x5bf2ce)[_0x1470('0x1')](0x0);return _0x7e445c['diff'](_0x4a86e9,_0x1470('0x2'));}function AgentComplete(_0x3d1657,_0x3a099a){this[_0x1470('0x3')]=0x4;this[_0x1470('0x4')]=_0x1470('0x5');this[_0x1470('0x6')]=_0x3d1657[_0x1470('0x6')];this['type']=_0x3d1657[_0x1470('0x7')];this[_0x1470('0x8')]=_0x3d1657['type']===_0x1470('0x9')?'queue':_0x3d1657['type'];this[_0x1470('0xa')]=_0x3d1657[_0x1470('0xa')];this[_0x1470('0xb')]=_0x3d1657[_0x1470('0xb')];this[_0x1470('0xc')]=_0x3d1657['countnoanswerretry'];this[_0x1470('0xd')]=_0x3d1657[_0x1470('0xa')]+_0x3d1657[_0x1470('0xb')]+_0x3d1657[_0x1470('0xc')]+_0x3d1657['countnosuchnumberretry']+_0x3d1657['countdropretry']+_0x3d1657[_0x1470('0xe')]+_0x3d1657['countmachineretry']+_0x3d1657[_0x1470('0xf')];this[_0x1470('0x10')]=_0x3d1657['countnosuchnumberretry'];this['countdropretry']=_0x3d1657[_0x1470('0x11')];this[_0x1470('0xe')]=_0x3d1657[_0x1470('0xe')];this[_0x1470('0x12')]=_0x3d1657[_0x1470('0x12')];this[_0x1470('0xf')]=_0x3d1657[_0x1470('0xf')];this[_0x1470('0x13')]=_0x3a099a[_0x1470('0x13')];this[_0x1470('0x14')]=_0x3d1657[_0x1470('0x15')];this[_0x1470('0x16')]=_0x3d1657[_0x1470('0x17')];this[_0x1470('0x18')]=_0x3d1657[_0x1470('0x18')];this[_0x1470('0x19')]=_0x3d1657[_0x1470('0x19')];this['answertime']=_0x3d1657[_0x1470('0x1a')];this[_0x1470('0x1b')]=moment()[_0x1470('0x1c')](_0x1470('0x1d'));this[_0x1470('0x1e')]=getSeconds(_0x3d1657[_0x1470('0x19')],_0x3d1657[_0x1470('0x18')]);this[_0x1470('0x1f')]=getSeconds(_0x3d1657[_0x1470('0x1a')],_0x3d1657[_0x1470('0x19')]);this[_0x1470('0x20')]=getSeconds(this[_0x1470('0x1b')],_0x3d1657[_0x1470('0x1a')]);this['queue']=_0x3a099a[_0x1470('0x21')];this[_0x1470('0x22')]=_0x3a099a[_0x1470('0x22')];this[_0x1470('0x23')]=_0x3a099a[_0x1470('0x23')];this[_0x1470('0x24')]=_0x3d1657[_0x1470('0x24')];this[_0x1470('0x25')]=_0x3d1657[_0x1470('0x25')];this[_0x1470('0x26')]=_0x3d1657[_0x1470('0x26')];this[_0x1470('0x27')]=_0x3d1657[_0x1470('0x27')];this[_0x1470('0x28')]=_0x3d1657[_0x1470('0x28')];this[_0x1470('0x29')]=_0x3d1657[_0x1470('0x29')];this[_0x1470('0x2a')]=_0x3d1657['UserId'];this[_0x1470('0x2b')]=_0x3d1657[_0x1470('0x2b')];this[_0x1470('0x2c')]=_0x3d1657[_0x1470('0x2c')];this[_0x1470('0x2d')]=_0x3d1657['originatecalleridnum']||'';this[_0x1470('0x2e')]=_0x3d1657[_0x1470('0x2e')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 81481ea..c031530 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 _0xd5d0=['campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','uniqueid','scheduledat','type'];(function(_0x135487,_0x59564f){var _0x2a768d=function(_0x63024d){while(--_0x63024d){_0x135487['push'](_0x135487['shift']());}};_0x2a768d(++_0x59564f);}(_0xd5d0,0x1cd));var _0x0d5d=function(_0x58622c,_0x10d530){_0x58622c=_0x58622c-0x0;var _0x2479a2=_0xd5d0[_0x58622c];return _0x2479a2;};'use strict';var util=require(_0x0d5d('0x0'));var _=require(_0x0d5d('0x1'));var moment=require('moment');function getSeconds(_0x19871c,_0x14a4ad){var _0x53a971=moment(_0x19871c)[_0x0d5d('0x2')](0x0);var _0x502365=moment(_0x14a4ad)['milliseconds'](0x0);return _0x53a971['diff'](_0x502365,_0x0d5d('0x3'));}function Final(_0x3d18ba){this[_0x0d5d('0x4')]=_0x3d18ba[_0x0d5d('0x4')];this[_0x0d5d('0x5')]=_0x3d18ba['scheduledat'];this['type']=_0x3d18ba[_0x0d5d('0x6')];this[_0x0d5d('0x7')]=_0x3d18ba[_0x0d5d('0x6')]===_0x0d5d('0x8')?'queue':_0x3d18ba[_0x0d5d('0x6')];this[_0x0d5d('0x9')]=_0x3d18ba[_0x0d5d('0x9')];this['countcongestionretry']=_0x3d18ba[_0x0d5d('0xa')];this[_0x0d5d('0xb')]=_0x3d18ba[_0x0d5d('0xb')];this[_0x0d5d('0xc')]=_0x3d18ba[_0x0d5d('0x9')]+_0x3d18ba[_0x0d5d('0xa')]+_0x3d18ba[_0x0d5d('0xb')]+_0x3d18ba[_0x0d5d('0xd')]+_0x3d18ba[_0x0d5d('0xe')]+_0x3d18ba[_0x0d5d('0xf')]+_0x3d18ba['countmachineretry']+_0x3d18ba[_0x0d5d('0x10')];this[_0x0d5d('0xd')]=_0x3d18ba[_0x0d5d('0xd')];this[_0x0d5d('0xe')]=_0x3d18ba[_0x0d5d('0xe')];this[_0x0d5d('0xf')]=_0x3d18ba['countabandonedretry'];this[_0x0d5d('0x11')]=_0x3d18ba[_0x0d5d('0x11')];this['countagentrejectretry']=_0x3d18ba[_0x0d5d('0x10')];this['queue']=_0x3d18ba[_0x0d5d('0x12')];this[_0x0d5d('0x13')]=_0x3d18ba['calleridname'];this[_0x0d5d('0x14')]=_0x3d18ba[_0x0d5d('0x14')];this[_0x0d5d('0x15')]=_0x3d18ba[_0x0d5d('0x15')];this['responsetime']=_0x3d18ba[_0x0d5d('0x16')];this[_0x0d5d('0x17')]=_0x3d18ba['responsetime'];this[_0x0d5d('0x18')]=_0x3d18ba['ringtime']||0x0;this[_0x0d5d('0x19')]=_0x3d18ba['holdtime']||0x0;this[_0x0d5d('0x1a')]=_0x3d18ba[_0x0d5d('0x1a')]||0x0;this['callback']=_0x3d18ba[_0x0d5d('0x1b')];this['callbackuniqueid']=_0x3d18ba[_0x0d5d('0x1c')];this[_0x0d5d('0x1d')]=_0x3d18ba['callbackat'];this[_0x0d5d('0x1e')]=_0x3d18ba[_0x0d5d('0x1e')];this[_0x0d5d('0x1f')]=_0x3d18ba['ContactId'];this['ListId']=_0x3d18ba[_0x0d5d('0x20')];this[_0x0d5d('0x21')]=_0x3d18ba[_0x0d5d('0x21')];this[_0x0d5d('0x22')]=_0x3d18ba['VoiceQueueId'];this[_0x0d5d('0x23')]=_0x3d18ba['CampaignId'];this[_0x0d5d('0x24')]=_0x3d18ba[_0x0d5d('0x24')]||'';this[_0x0d5d('0x25')]=_0x3d18ba[_0x0d5d('0x25')]||'';}module[_0x0d5d('0x26')]=Final; \ No newline at end of file +var _0xf9b1=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime'];(function(_0x191993,_0x3c4d3c){var _0x53c1bf=function(_0x43e3ff){while(--_0x43e3ff){_0x191993['push'](_0x191993['shift']());}};_0x53c1bf(++_0x3c4d3c);}(_0xf9b1,0xd6));var _0x1f9b=function(_0x2f466c,_0x5efef9){_0x2f466c=_0x2f466c-0x0;var _0x5da6c0=_0xf9b1[_0x2f466c];return _0x5da6c0;};'use strict';var util=require(_0x1f9b('0x0'));var _=require(_0x1f9b('0x1'));var moment=require('moment');function getSeconds(_0x8a6eae,_0x491b52){var _0x7d02c5=moment(_0x8a6eae)[_0x1f9b('0x2')](0x0);var _0x4cff42=moment(_0x491b52)[_0x1f9b('0x2')](0x0);return _0x7d02c5[_0x1f9b('0x3')](_0x4cff42,_0x1f9b('0x4'));}function Final(_0x40af51){this[_0x1f9b('0x5')]=_0x40af51[_0x1f9b('0x5')];this[_0x1f9b('0x6')]=_0x40af51[_0x1f9b('0x6')];this[_0x1f9b('0x7')]=_0x40af51[_0x1f9b('0x7')];this[_0x1f9b('0x8')]=_0x40af51[_0x1f9b('0x7')]===_0x1f9b('0x9')?_0x1f9b('0xa'):_0x40af51[_0x1f9b('0x7')];this['countbusyretry']=_0x40af51[_0x1f9b('0xb')];this[_0x1f9b('0xc')]=_0x40af51['countcongestionretry'];this[_0x1f9b('0xd')]=_0x40af51[_0x1f9b('0xd')];this[_0x1f9b('0xe')]=_0x40af51[_0x1f9b('0xb')]+_0x40af51['countcongestionretry']+_0x40af51['countnoanswerretry']+_0x40af51[_0x1f9b('0xf')]+_0x40af51[_0x1f9b('0x10')]+_0x40af51[_0x1f9b('0x11')]+_0x40af51['countmachineretry']+_0x40af51[_0x1f9b('0x12')];this[_0x1f9b('0xf')]=_0x40af51['countnosuchnumberretry'];this[_0x1f9b('0x10')]=_0x40af51[_0x1f9b('0x10')];this['countabandonedretry']=_0x40af51[_0x1f9b('0x11')];this[_0x1f9b('0x13')]=_0x40af51['countmachineretry'];this[_0x1f9b('0x12')]=_0x40af51[_0x1f9b('0x12')];this[_0x1f9b('0xa')]=_0x40af51[_0x1f9b('0xa')];this['calleridname']=_0x40af51[_0x1f9b('0x14')];this[_0x1f9b('0x15')]=_0x40af51[_0x1f9b('0x15')];this[_0x1f9b('0x16')]=_0x40af51[_0x1f9b('0x16')];this[_0x1f9b('0x17')]=_0x40af51['responsetime'];this[_0x1f9b('0x18')]=_0x40af51['responsetime'];this[_0x1f9b('0x19')]=_0x40af51['ringtime']||0x0;this[_0x1f9b('0x1a')]=_0x40af51[_0x1f9b('0x1a')]||0x0;this[_0x1f9b('0x1b')]=_0x40af51[_0x1f9b('0x1b')]||0x0;this['callback']=_0x40af51[_0x1f9b('0x1c')];this[_0x1f9b('0x1d')]=_0x40af51[_0x1f9b('0x1d')];this[_0x1f9b('0x1e')]=_0x40af51['callbackat'];this[_0x1f9b('0x1f')]=_0x40af51[_0x1f9b('0x1f')];this[_0x1f9b('0x20')]=_0x40af51[_0x1f9b('0x20')];this[_0x1f9b('0x21')]=_0x40af51[_0x1f9b('0x21')];this[_0x1f9b('0x22')]=_0x40af51[_0x1f9b('0x22')];this[_0x1f9b('0x23')]=_0x40af51['VoiceQueueId'];this['CampaignId']=_0x40af51[_0x1f9b('0x24')];this[_0x1f9b('0x25')]=_0x40af51[_0x1f9b('0x25')]||'';this['originatecalleridname']=_0x40af51[_0x1f9b('0x26')]||'';}module[_0x1f9b('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 1ab9af0..d0d5a86 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 _0xa56c=['util','moment','milliseconds','diff','state','statedesc','Answer','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','queue','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports'];(function(_0x2bec40,_0x2830a0){var _0x3ad43f=function(_0x4b4225){while(--_0x4b4225){_0x2bec40['push'](_0x2bec40['shift']());}};_0x3ad43f(++_0x2830a0);}(_0xa56c,0x1b8));var _0xca56=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xa56c[_0x45b034];return _0x509cb0;};'use strict';var util=require(_0xca56('0x0'));var _=require('lodash');var moment=require(_0xca56('0x1'));function getSeconds(_0x5a181c,_0x1b248e){var _0x4ffb56=moment(_0x5a181c)[_0xca56('0x2')](0x0);var _0x4dd416=moment(_0x1b248e)['milliseconds'](0x0);return _0x4ffb56[_0xca56('0x3')](_0x4dd416,'seconds');}function Hangup(_0x40bd67,_0x48103e){this[_0xca56('0x4')]=0x4;this[_0xca56('0x5')]=_0xca56('0x6');this['scheduledat']=_0x40bd67['scheduledat'];this['type']=_0x40bd67[_0xca56('0x7')];this[_0xca56('0x8')]=_0x40bd67['type']===_0xca56('0x9')?'queue':_0x40bd67[_0xca56('0x7')];this[_0xca56('0xa')]=_0x40bd67[_0xca56('0xa')];this[_0xca56('0xb')]=_0x40bd67[_0xca56('0xb')];this['countnoanswerretry']=_0x40bd67[_0xca56('0xc')];this[_0xca56('0xd')]=_0x40bd67['countbusyretry']+_0x40bd67[_0xca56('0xb')]+_0x40bd67['countnoanswerretry']+_0x40bd67['countnosuchnumberretry']+_0x40bd67['countdropretry']+_0x40bd67['countabandonedretry']+_0x40bd67[_0xca56('0xe')]+_0x40bd67[_0xca56('0xf')];this[_0xca56('0x10')]=_0x40bd67[_0xca56('0x10')];this[_0xca56('0x11')]=_0x40bd67[_0xca56('0x11')];this[_0xca56('0x12')]=_0x40bd67[_0xca56('0x12')];this[_0xca56('0xe')]=_0x40bd67[_0xca56('0xe')];this[_0xca56('0xf')]=_0x40bd67[_0xca56('0xf')];this['uniqueid']=_0x48103e[_0xca56('0x13')];this['calleridname']=_0x40bd67[_0xca56('0x14')];this[_0xca56('0x15')]=_0x40bd67[_0xca56('0x16')];this[_0xca56('0x17')]=_0x40bd67['starttime'];this[_0xca56('0x18')]=_0x40bd67[_0xca56('0x18')];this[_0xca56('0x19')]=moment()[_0xca56('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xca56('0x1b')]=getSeconds(_0x40bd67['responsetime'],_0x40bd67[_0xca56('0x17')]);this[_0xca56('0x1c')]=0x0;this[_0xca56('0x1d')]=getSeconds(this[_0xca56('0x19')],_0x40bd67['responsetime']);this[_0xca56('0x1e')]=_0x40bd67[_0xca56('0x1e')];this[_0xca56('0x1f')]=_0xca56('0x20');this['reason']=_0x48103e[_0xca56('0x21')];this[_0xca56('0x22')]=_0x40bd67[_0xca56('0x22')];this[_0xca56('0x23')]=_0x40bd67[_0xca56('0x23')];this[_0xca56('0x24')]=_0x40bd67[_0xca56('0x24')];this[_0xca56('0x25')]=_0x40bd67[_0xca56('0x25')];this[_0xca56('0x26')]=_0x40bd67[_0xca56('0x26')];this[_0xca56('0x27')]=_0x40bd67[_0xca56('0x27')];this[_0xca56('0x28')]=_0x40bd67[_0xca56('0x28')];this[_0xca56('0x29')]=_0x40bd67[_0xca56('0x29')];this[_0xca56('0x2a')]=_0x40bd67['CampaignId'];}module[_0xca56('0x2b')]=Hangup; \ No newline at end of file +var _0xdb08=['holdtime','talktime','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xdb08,0x1a8));var _0x8db0=function(_0x27ad33,_0x356cf3){_0x27ad33=_0x27ad33-0x0;var _0x57541b=_0xdb08[_0x27ad33];return _0x57541b;};'use strict';var util=require(_0x8db0('0x0'));var _=require(_0x8db0('0x1'));var moment=require(_0x8db0('0x2'));function getSeconds(_0x357fc2,_0x5040ac){var _0x431fe8=moment(_0x357fc2)[_0x8db0('0x3')](0x0);var _0x58e7b4=moment(_0x5040ac)[_0x8db0('0x3')](0x0);return _0x431fe8[_0x8db0('0x4')](_0x58e7b4,_0x8db0('0x5'));}function Hangup(_0x11d2b3,_0x283f96){this['state']=0x4;this[_0x8db0('0x6')]='Answer';this[_0x8db0('0x7')]=_0x11d2b3[_0x8db0('0x7')];this[_0x8db0('0x8')]=_0x11d2b3['type'];this[_0x8db0('0x9')]=_0x11d2b3['type']===_0x8db0('0xa')?'queue':_0x11d2b3[_0x8db0('0x8')];this['countbusyretry']=_0x11d2b3[_0x8db0('0xb')];this[_0x8db0('0xc')]=_0x11d2b3[_0x8db0('0xc')];this[_0x8db0('0xd')]=_0x11d2b3[_0x8db0('0xd')];this['countglobal']=_0x11d2b3[_0x8db0('0xb')]+_0x11d2b3[_0x8db0('0xc')]+_0x11d2b3[_0x8db0('0xd')]+_0x11d2b3[_0x8db0('0xe')]+_0x11d2b3[_0x8db0('0xf')]+_0x11d2b3[_0x8db0('0x10')]+_0x11d2b3[_0x8db0('0x11')]+_0x11d2b3[_0x8db0('0x12')];this[_0x8db0('0xe')]=_0x11d2b3[_0x8db0('0xe')];this['countdropretry']=_0x11d2b3[_0x8db0('0xf')];this[_0x8db0('0x10')]=_0x11d2b3[_0x8db0('0x10')];this['countmachineretry']=_0x11d2b3[_0x8db0('0x11')];this[_0x8db0('0x12')]=_0x11d2b3['countagentrejectretry'];this['uniqueid']=_0x283f96[_0x8db0('0x13')];this['calleridname']=_0x11d2b3[_0x8db0('0x14')];this[_0x8db0('0x15')]=_0x11d2b3[_0x8db0('0x16')];this[_0x8db0('0x17')]=_0x11d2b3[_0x8db0('0x17')];this['responsetime']=_0x11d2b3[_0x8db0('0x18')];this[_0x8db0('0x19')]=moment()['format'](_0x8db0('0x1a'));this['ringtime']=getSeconds(_0x11d2b3[_0x8db0('0x18')],_0x11d2b3[_0x8db0('0x17')]);this[_0x8db0('0x1b')]=0x0;this[_0x8db0('0x1c')]=getSeconds(this[_0x8db0('0x19')],_0x11d2b3[_0x8db0('0x18')]);this[_0x8db0('0x1d')]=_0x11d2b3['queue'];this[_0x8db0('0x1e')]=_0x8db0('0x1f');this[_0x8db0('0x20')]=_0x283f96['cause-txt'];this[_0x8db0('0x21')]=_0x11d2b3[_0x8db0('0x21')];this[_0x8db0('0x22')]=_0x11d2b3[_0x8db0('0x22')];this['callbackat']=_0x11d2b3[_0x8db0('0x23')];this[_0x8db0('0x24')]=_0x11d2b3[_0x8db0('0x24')];this['ContactId']=_0x11d2b3['ContactId'];this['ListId']=_0x11d2b3['ListId'];this[_0x8db0('0x25')]=_0x11d2b3['UserId'];this['VoiceQueueId']=_0x11d2b3[_0x8db0('0x26')];this['CampaignId']=_0x11d2b3[_0x8db0('0x27')];}module[_0x8db0('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 1a9f917..6a98fdc 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 _0xd2b8=['countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','starttime','responsetime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x5cc450,_0xbc6fa8){var _0x781ec6=function(_0x3f772b){while(--_0x3f772b){_0x5cc450['push'](_0x5cc450['shift']());}};_0x781ec6(++_0xbc6fa8);}(_0xd2b8,0x7e));var _0x8d2b=function(_0x4a879e,_0x5b503c){_0x4a879e=_0x4a879e-0x0;var _0x54b31a=_0xd2b8[_0x4a879e];return _0x54b31a;};'use strict';var util=require(_0x8d2b('0x0'));var _=require('lodash');var moment=require(_0x8d2b('0x1'));function getSeconds(_0x35885c,_0x3fc3d3){var _0x35eedb=moment(_0x35885c)['milliseconds'](0x0);var _0x2a6e0e=moment(_0x3fc3d3)['milliseconds'](0x0);return _0x35eedb[_0x8d2b('0x2')](_0x2a6e0e,_0x8d2b('0x3'));}function History(_0x14f0fd){this['uniqueid']=_0x14f0fd[_0x8d2b('0x4')];this[_0x8d2b('0x5')]=_0x14f0fd[_0x8d2b('0x5')]||undefined;this['type']=_0x14f0fd[_0x8d2b('0x6')];this['campaigntype']=_0x14f0fd[_0x8d2b('0x6')]===_0x8d2b('0x7')?_0x8d2b('0x8'):_0x14f0fd[_0x8d2b('0x6')];this[_0x8d2b('0x9')]=_0x14f0fd['countbusyretry'];this[_0x8d2b('0xa')]=_0x14f0fd[_0x8d2b('0xa')];this[_0x8d2b('0xb')]=_0x14f0fd[_0x8d2b('0xb')];this[_0x8d2b('0xc')]=_0x14f0fd['countbusyretry']+_0x14f0fd[_0x8d2b('0xa')]+_0x14f0fd['countnoanswerretry']+_0x14f0fd[_0x8d2b('0xd')]+_0x14f0fd[_0x8d2b('0xe')]+_0x14f0fd[_0x8d2b('0xf')]+_0x14f0fd['countmachineretry']+_0x14f0fd[_0x8d2b('0x10')];this[_0x8d2b('0xd')]=_0x14f0fd['countnosuchnumberretry'];this[_0x8d2b('0xe')]=_0x14f0fd[_0x8d2b('0xe')];this['countabandonedretry']=_0x14f0fd['countabandonedretry'];this[_0x8d2b('0x11')]=_0x14f0fd[_0x8d2b('0x11')];this['countagentrejectretry']=_0x14f0fd[_0x8d2b('0x10')];this[_0x8d2b('0x8')]=_0x14f0fd[_0x8d2b('0x8')];this[_0x8d2b('0x12')]=_0x14f0fd[_0x8d2b('0x13')];this[_0x8d2b('0x14')]=_0x14f0fd['number'];this[_0x8d2b('0x15')]=_0x14f0fd['starttime'];this[_0x8d2b('0x16')]=_0x14f0fd[_0x8d2b('0x16')];this['endtime']=_0x14f0fd[_0x8d2b('0x16')];this['ringtime']=getSeconds(_0x14f0fd[_0x8d2b('0x16')],_0x14f0fd[_0x8d2b('0x15')]);this[_0x8d2b('0x17')]=0x0;this['talktime']=0x0;this[_0x8d2b('0x18')]=_0x14f0fd[_0x8d2b('0x18')];this['callbackuniqueid']=_0x14f0fd[_0x8d2b('0x19')];this[_0x8d2b('0x1a')]=_0x14f0fd['callbackat'];this[_0x8d2b('0x1b')]=_0x14f0fd[_0x8d2b('0x1b')];this[_0x8d2b('0x1c')]=_0x14f0fd['ContactId'];this['ListId']=_0x14f0fd['ListId'];this[_0x8d2b('0x1d')]=_0x14f0fd[_0x8d2b('0x1d')];this[_0x8d2b('0x1e')]=_0x14f0fd[_0x8d2b('0x1e')];this['CampaignId']=_0x14f0fd[_0x8d2b('0x1f')];this[_0x8d2b('0x20')]=_0x14f0fd[_0x8d2b('0x20')]||'';this[_0x8d2b('0x21')]=_0x14f0fd[_0x8d2b('0x21')]||'';}module[_0x8d2b('0x22')]=History; \ No newline at end of file +var _0xab5b=['endtime','ringtime','starttime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','name','calleridnum','number','responsetime'];(function(_0x24f871,_0x1b1ead){var _0x42739e=function(_0xd1f501){while(--_0xd1f501){_0x24f871['push'](_0x24f871['shift']());}};_0x42739e(++_0x1b1ead);}(_0xab5b,0x11a));var _0xbab5=function(_0x1070b9,_0x5d7f5a){_0x1070b9=_0x1070b9-0x0;var _0x162168=_0xab5b[_0x1070b9];return _0x162168;};'use strict';var util=require(_0xbab5('0x0'));var _=require(_0xbab5('0x1'));var moment=require('moment');function getSeconds(_0x431930,_0x140394){var _0x50418d=moment(_0x431930)['milliseconds'](0x0);var _0x2a5d23=moment(_0x140394)['milliseconds'](0x0);return _0x50418d[_0xbab5('0x2')](_0x2a5d23,_0xbab5('0x3'));}function History(_0x438e9b){this[_0xbab5('0x4')]=_0x438e9b[_0xbab5('0x4')];this['scheduledat']=_0x438e9b[_0xbab5('0x5')]||undefined;this[_0xbab5('0x6')]=_0x438e9b[_0xbab5('0x6')];this[_0xbab5('0x7')]=_0x438e9b[_0xbab5('0x6')]==='outbound'?_0xbab5('0x8'):_0x438e9b[_0xbab5('0x6')];this[_0xbab5('0x9')]=_0x438e9b['countbusyretry'];this[_0xbab5('0xa')]=_0x438e9b[_0xbab5('0xa')];this['countnoanswerretry']=_0x438e9b[_0xbab5('0xb')];this[_0xbab5('0xc')]=_0x438e9b[_0xbab5('0x9')]+_0x438e9b[_0xbab5('0xa')]+_0x438e9b['countnoanswerretry']+_0x438e9b[_0xbab5('0xd')]+_0x438e9b['countdropretry']+_0x438e9b[_0xbab5('0xe')]+_0x438e9b[_0xbab5('0xf')]+_0x438e9b[_0xbab5('0x10')];this[_0xbab5('0xd')]=_0x438e9b[_0xbab5('0xd')];this['countdropretry']=_0x438e9b[_0xbab5('0x11')];this[_0xbab5('0xe')]=_0x438e9b[_0xbab5('0xe')];this[_0xbab5('0xf')]=_0x438e9b[_0xbab5('0xf')];this[_0xbab5('0x10')]=_0x438e9b[_0xbab5('0x10')];this[_0xbab5('0x8')]=_0x438e9b[_0xbab5('0x8')];this['calleridname']=_0x438e9b[_0xbab5('0x12')];this[_0xbab5('0x13')]=_0x438e9b[_0xbab5('0x14')];this['starttime']=_0x438e9b['starttime'];this[_0xbab5('0x15')]=_0x438e9b[_0xbab5('0x15')];this[_0xbab5('0x16')]=_0x438e9b[_0xbab5('0x15')];this[_0xbab5('0x17')]=getSeconds(_0x438e9b[_0xbab5('0x15')],_0x438e9b[_0xbab5('0x18')]);this['holdtime']=0x0;this[_0xbab5('0x19')]=0x0;this[_0xbab5('0x1a')]=_0x438e9b[_0xbab5('0x1a')];this['callbackuniqueid']=_0x438e9b[_0xbab5('0x1b')];this[_0xbab5('0x1c')]=_0x438e9b[_0xbab5('0x1c')];this[_0xbab5('0x1d')]=_0x438e9b[_0xbab5('0x1d')];this[_0xbab5('0x1e')]=_0x438e9b[_0xbab5('0x1e')];this[_0xbab5('0x1f')]=_0x438e9b[_0xbab5('0x1f')];this[_0xbab5('0x20')]=_0x438e9b[_0xbab5('0x20')];this['VoiceQueueId']=_0x438e9b[_0xbab5('0x21')];this[_0xbab5('0x22')]=_0x438e9b[_0xbab5('0x22')];this[_0xbab5('0x23')]=_0x438e9b[_0xbab5('0x23')]||'';this['originatecalleridname']=_0x438e9b[_0xbab5('0x24')]||'';}module[_0xbab5('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 80f8184..fd0ae9a 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 _0x01f6=['queueStatusComplete','[unlockQueueStatus][undefined]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','Agent:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','isArray','command','interval','indexOf','true','Action','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','predictive','booked','Queue','method\x20not\x20recognized','handleIvr','dialActive','loggedIn','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','syncCampaigns','checkIsTrunkReachable','checkIfTime','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','dialQueueOptions','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','%s%s','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnosuchnumberretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dropRate','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','startMethodPredictive','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','getVoiceQueueRtPauses','outboundQueuePauses','[CatchErlangB]','busyFactor','check\x20failure','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','[booked][checkContactBlack][else]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','dialOrderByScheduledAt','ACTIVE','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[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','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','[abandonmentRate]','m\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]','Ts\x20=\x20','p\x20=\x20','Umin\x20=\x20','exports','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','queuecallerabandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','Error','stringify','milliseconds','diff','emit','type','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','isEmpty','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','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','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','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','inspect','error','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','starttime','clearZombieChannels','[actions]','enqueue','isNil','status','channel','catch','ivr','queue','updateOriginated','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','state','HangupInAMD','membername','AMD','[syncHangupInAMD]','Machine','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr]','MACHINE','countglobal','countcongestionretry','countnoanswerretry','countabandonedretry','reason19\x20machine....','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','syncAgentConnect','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','dialQueueTimeout','Drop','dropreason','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','queueCallerAbandonCreateState','[syncAgentComplete][createHistory][11]','actions','actionid','locked','paused','stateinterface','strategy','queueBooked','push','idHopper'];(function(_0x35035e,_0x26bc1d){var _0x3a042f=function(_0x38d4e3){while(--_0x38d4e3){_0x35035e['push'](_0x35035e['shift']());}};_0x3a042f(++_0x26bc1d);}(_0x01f6,0xea));var _0x601f=function(_0x1b4b01,_0x43eb55){_0x1b4b01=_0x1b4b01-0x0;var _0x521446=_0x01f6[_0x1b4b01];return _0x521446;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x601f('0x0'));var uuid=require(_0x601f('0x1'));var moment=require('moment');var rr=require('rr');var md5=require(_0x601f('0x2'));var Redis=require(_0x601f('0x3'));var ut=require(_0x601f('0x4'));var config=require(_0x601f('0x5'));var logger=require(_0x601f('0x6'))('dialer');var loggerBooked=require(_0x601f('0x6'))('booked');var loggerPredictive=require(_0x601f('0x6'))('predictive');var loggerPredictiveCalls=require(_0x601f('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x601f('0x6'))(_0x601f('0x7'));var ami=require(_0x601f('0x8'));config[_0x601f('0x9')]=_[_0x601f('0xa')](config[_0x601f('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x601f('0xb'));var cmHopperBlack=require(_0x601f('0xc'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x601f('0xd'));var History=require(_0x601f('0xe'));var Final=require(_0x601f('0xf'));var AgentComplete=require(_0x601f('0x10'));var QueueCallerAbandon=require(_0x601f('0x11'));var Hangup=require('./hangup');var ipAgi=process[_0x601f('0x12')][_0x601f('0x13')]||_0x601f('0x14');var strategy={'rrmemory':_0x601f('0x15'),'roundrobin':_0x601f('0x16')};var Sequence=function(){};Sequence[_0x601f('0x17')]['enqueue']=function(_0x483f91){this[_0x601f('0x18')]=this[_0x601f('0x18')]?this[_0x601f('0x18')][_0x601f('0x19')](_0x483f91):_0x483f91();};function Dialer(_0x1ce34e,_0x32d6f4){this[_0x601f('0x1a')]=new Sequence();this[_0x601f('0x1b')]=_0x32d6f4;this[_0x601f('0x1c')]=_0x1ce34e['voiceQueues'];this['campaigns']=_0x1ce34e[_0x601f('0x1d')];this[_0x601f('0x1e')]=_0x1ce34e[_0x601f('0x1e')];this[_0x601f('0x1f')]=_0x1ce34e[_0x601f('0x1f')];this[_0x601f('0x20')]=config[_0x601f('0x20')]||0x2;this[_0x601f('0x21')]={};this['actions']={};this[_0x601f('0x22')]={};this[_0x601f('0x23')]={};this['optionPredictive']={};this[_0x601f('0x24')]={};this[_0x601f('0x25')]={};this[_0x601f('0x26')]={};this['queueBooked']={};this[_0x601f('0x27')]={};ami['on'](_0x601f('0x28'),this['syncAgentConnect']['bind'](this));ami['on'](_0x601f('0x29'),this['syncQueueCallerAbandon'][_0x601f('0x2a')](this));ami['on']('originateresponse',this[_0x601f('0x2b')][_0x601f('0x2a')](this));ami['on'](_0x601f('0x2c'),this[_0x601f('0x2d')]['bind'](this));ami['on'](_0x601f('0x2e'),this['syncQueueSummary']['bind'](this));ami['on']('hangup',this[_0x601f('0x2f')][_0x601f('0x2a')](this));ami['on'](_0x601f('0x30'),this[_0x601f('0x31')][_0x601f('0x2a')](this));ami['on'](_0x601f('0x32'),this[_0x601f('0x33')][_0x601f('0x2a')](this));ami['on'](_0x601f('0x34'),this[_0x601f('0x35')][_0x601f('0x2a')](this));ami['on'](_0x601f('0x36'),this['syncQueueStatusComplete'][_0x601f('0x2a')](this));this['loopCampaigns']();this[_0x601f('0x37')]();}function isNotNull(_0x4fa51c){return _0x4fa51c!==null&&!_[_0x601f('0x38')](_0x4fa51c);}function checkIsLoggedIn(_0x371296,_0x48740d){return function(){if(_0x48740d<=0x0){_0x371296[_0x601f('0x39')]='AGENTS_NOT_LOGGED';throw _0x371296[_0x601f('0x3a')]+_0x601f('0x3b');}};}function isActive(_0x88b276){return _0x88b276;}function checkIsActive(_0x2f95a6,_0x122273){return function(){if(!isActive(_0x122273)){_0x2f95a6['message']=_0x601f('0x3c');throw _0x2f95a6[_0x601f('0x3a')]+_0x601f('0x3d');}};}function checkInterval(_0x5b4ef0){return function(){if(!isNotNull(_0x5b4ef0[_0x601f('0x3e')])){_0x5b4ef0[_0x601f('0x39')]=_0x601f('0x3f');throw _0x5b4ef0[_0x601f('0x3a')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x5b4ef0[_0x601f('0x3e')][_0x601f('0x40')])){_0x5b4ef0['message']=_0x601f('0x3f');throw _0x5b4ef0[_0x601f('0x3a')]+_0x601f('0x41');}if(!isNotNull(_['isEmpty'](_0x5b4ef0['Interval']['Intervals']))){_0x5b4ef0[_0x601f('0x39')]=_0x601f('0x3f');throw _0x5b4ef0['name']+_0x601f('0x41');}};}function msgResponse(_0xab59d9,_0x3cb6b4,_0x42461e){return{'action':_0xab59d9,'response':_0x3cb6b4,'message':_0x42461e,'stack':_0x42461e};}function myreject(_0x5c70bb){return function(_0x1ae5ca){return _0x5c70bb(msgResponse('[ifTime][Action]',_0x601f('0x42'),JSON[_0x601f('0x43')](_0x1ae5ca)));};}function getSeconds(_0x24ed27,_0x27fbb7){var _0x907e17=moment(_0x24ed27)[_0x601f('0x44')](0x0);var _0x1ba05f=moment(_0x27fbb7)[_0x601f('0x44')](0x0);return _0x907e17[_0x601f('0x45')](_0x1ba05f,'seconds');}function emit(_0xe085da,_0x3edc45,_0x4e8057){io['to'](_0xe085da)[_0x601f('0x46')](_0x3edc45,_0x4e8057);}function emitVoiceQueueSummary(_0x70f1b8){if(_0x70f1b8[_0x601f('0x47')]==='outbound'){var _0x2c9d81={'id':_0x70f1b8['id'],'name':_0x70f1b8[_0x601f('0x3a')],'strategy':_0x70f1b8['strategy'],'answered':_0x70f1b8[_0x601f('0x48')],'available':_0x70f1b8[_0x601f('0x49')],'loggedIn':_0x70f1b8['loggedIn'],'pTalking':_0x70f1b8[_0x601f('0x4a')],'sumBillable':_0x70f1b8[_0x601f('0x4b')],'sumDuration':_0x70f1b8[_0x601f('0x4c')],'sumHoldTime':_0x70f1b8[_0x601f('0x4d')]||0x0,'talking':_0x70f1b8[_0x601f('0x4e')],'total':_0x70f1b8[_0x601f('0x4f')],'type':_0x70f1b8[_0x601f('0x47')],'unmanaged':_0x70f1b8['unmanaged'],'abandoned':_0x70f1b8[_0x601f('0x50')],'waiting':_0x70f1b8[_0x601f('0x51')],'loggedInDb':_0x70f1b8[_0x601f('0x52')],'dialActive':_0x70f1b8['dialActive'],'dialMethod':_0x70f1b8[_0x601f('0x53')],'dialOriginateCallerIdName':_0x70f1b8[_0x601f('0x54')],'dialOriginateCallerIdNumber':_0x70f1b8[_0x601f('0x55')],'dialOriginateTimeout':_0x70f1b8[_0x601f('0x56')],'dialPrefix':_0x70f1b8['dialPrefix'],'outboundAnswerAgiCallsDay':_0x70f1b8[_0x601f('0x57')],'outboundAnswerCallsDay':_0x70f1b8[_0x601f('0x58')],'outboundBlacklistCallsDay':_0x70f1b8[_0x601f('0x59')],'outboundBusyCallsDay':_0x70f1b8[_0x601f('0x5a')],'outboundCongestionCallsDay':_0x70f1b8[_0x601f('0x5b')],'outboundDropCallsDayACS':_0x70f1b8['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x70f1b8['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x70f1b8[_0x601f('0x5c')],'outboundNoAnswerCallsDay':_0x70f1b8[_0x601f('0x5d')],'outboundNoSuchCallsDay':_0x70f1b8[_0x601f('0x5e')],'outboundOriginateFailureCallsDay':_0x70f1b8[_0x601f('0x5f')],'outboundReCallsDay':_0x70f1b8[_0x601f('0x60')],'outboundRejectCallsDay':_0x70f1b8[_0x601f('0x61')],'outboundUnknownCallsDay':_0x70f1b8[_0x601f('0x62')],'predictiveIntervalAnsweredCalls':_0x70f1b8[_0x601f('0x63')],'predictiveIntervalAvgHoldtime':_0x70f1b8[_0x601f('0x64')],'predictiveIntervalAvgTalktime':_0x70f1b8['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x70f1b8[_0x601f('0x65')],'predictiveIntervalDroppedCallsTimeout':_0x70f1b8[_0x601f('0x66')],'predictiveIntervalErlangCalls':_0x70f1b8[_0x601f('0x67')],'predictiveIntervalErlangCallsDroppedCalls':_0x70f1b8[_0x601f('0x68')],'predictiveIntervalHitRate':_0x70f1b8['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x70f1b8[_0x601f('0x69')],'predictiveIntervalPauses':_0x70f1b8[_0x601f('0x6a')],'predictiveIntervalAvailable':_0x70f1b8[_0x601f('0x6b')],'predictiveIntervalTotalCalls':_0x70f1b8[_0x601f('0x6c')],'message':_0x70f1b8[_0x601f('0x39')],'originated':_0x70f1b8[_0x601f('0x6d')],'erlangCalls':_0x70f1b8[_0x601f('0x6e')],'erlangCallToSecond':_0x70f1b8[_0x601f('0x6f')],'erlangAbandonmentRate':_0x70f1b8[_0x601f('0x70')],'erlangBusyFactor':_0x70f1b8[_0x601f('0x71')],'startPredictive':_0x70f1b8[_0x601f('0x24')],'startProgressive':_0x70f1b8[_0x601f('0x25')]};if(_0x70f1b8['Trunk']){_0x2c9d81['Trunk']={'id':_0x70f1b8[_0x601f('0x72')]['id'],'name':_0x70f1b8[_0x601f('0x72')]['name'],'active':_0x70f1b8[_0x601f('0x72')]['active'],'callerid':_0x70f1b8[_0x601f('0x72')]['callerid']};}if(_0x70f1b8[_0x601f('0x3e')]){_0x2c9d81['Interval']={'id':_0x70f1b8[_0x601f('0x3e')]['id'],'name':_0x70f1b8[_0x601f('0x3e')][_0x601f('0x3a')]};}var _0x5a28bb=md5(JSON[_0x601f('0x43')](_0x2c9d81));if(_0x70f1b8[_0x601f('0x2')]!==_0x5a28bb){_0x70f1b8['md5']=_0x5a28bb;emit(util[_0x601f('0x73')](_0x601f('0x74'),_0x2c9d81['name']),_0x601f('0x75'),_0x2c9d81);}}}function emitCampaignSummary(_0x393a42){if(_0x393a42[_0x601f('0x47')]==='ivr'){emit(util[_0x601f('0x73')](_0x601f('0x76'),_0x393a42[_0x601f('0x3a')]),_0x601f('0x77'),_0x393a42);}}function checkGetDataPredictive(_0x4b3f2f){if(isNotNull(_0x4b3f2f)&&!_[_0x601f('0x78')](_0x4b3f2f)){loggerPredictive[_0x601f('0x79')](_0x601f('0x7a'));loggerPredictive[_0x601f('0x79')](_0x601f('0x7b'),_0x4b3f2f[_0x601f('0x6c')]);loggerPredictive['info'](_0x601f('0x7c'),_0x4b3f2f[_0x601f('0x63')]);loggerPredictive[_0x601f('0x79')](_0x601f('0x7d'),_0x4b3f2f[_0x601f('0x66')]);loggerPredictive['info'](_0x601f('0x7e'),_0x4b3f2f[_0x601f('0x65')]);loggerPredictive['info'](_0x601f('0x7f'),_0x4b3f2f['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b3f2f['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0x601f('0x80'));if(_0x4b3f2f[_0x601f('0x6c')]>0x0){if(!_[_0x601f('0x38')](_0x4b3f2f['predictiveIntervalAvgTalktime'])&&_0x4b3f2f[_0x601f('0x81')]>0x0){return!![];}loggerPredictive[_0x601f('0x79')](_0x601f('0x82'));if(!_['isUndefined'](_0x4b3f2f['predictiveIntervalAvgHoldtime'])&&_0x4b3f2f[_0x601f('0x64')]>0x0){return!![];}loggerPredictive[_0x601f('0x79')](_0x601f('0x83'));}else{loggerPredictive[_0x601f('0x79')](_0x601f('0x84'));}}else{loggerPredictive[_0x601f('0x79')](_0x601f('0x85'));}return![];}function mergeDataErlangB(_0xa7c556){return function(_0x528884){loggerPredictive[_0x601f('0x79')](_0x601f('0x86'));loggerPredictive[_0x601f('0x79')](_0x601f('0x87'),_0x528884['erlangCalls']);loggerPredictive['info'](_0x601f('0x88'),_0x528884[_0x601f('0x6f')]);loggerPredictive[_0x601f('0x79')](_0x601f('0x89'),_0x528884[_0x601f('0x70')]);loggerPredictive[_0x601f('0x79')](_0x601f('0x8a'),_0x528884[_0x601f('0x71')]);loggerPredictive[_0x601f('0x79')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x528884[_0x601f('0x70')]);loggerPredictive['info']('---------------------------');_[_0x601f('0x8b')](_0xa7c556,_0x528884);};}function getDiff(_0x55e56c){var _0xc8121=moment()[_0x601f('0x44')](0x0);var _0x228b07=moment(_0x55e56c)[_0x601f('0x44')](0x0);return _0xc8121[_0x601f('0x45')](_0x228b07,'seconds');}function ifInterval(_0x5f52da,_0x563f20){if(_['isUndefined'](_0x563f20)){return![];}return getDiff(_0x563f20)<_0x5f52da*0x3c;}function freeVariablesPredictive(_0x59af11){if(isNotNull(_0x59af11)){if(!_[_0x601f('0x38')](_0x59af11[_0x601f('0x25')])){_0x59af11[_0x601f('0x25')]=undefined;loggerPredictive['info'](_0x59af11['name'],_0x601f('0x8c'));}if(!_[_0x601f('0x38')](_0x59af11[_0x601f('0x24')])){_0x59af11[_0x601f('0x24')]=undefined;loggerPredictive[_0x601f('0x79')](_0x59af11[_0x601f('0x3a')],_0x601f('0x8d'));}if(!_[_0x601f('0x38')](_0x59af11[_0x601f('0x8e')])){clearInterval(_0x59af11[_0x601f('0x8e')]);_0x59af11[_0x601f('0x8e')]=undefined;loggerPredictive['info'](_0x59af11[_0x601f('0x3a')],_0x601f('0x8f'));}}}function erlangb(_0x455152,_0x37669f){if(_0x37669f===0x0){return 0x0;}var _0x1f4962=0x1;for(var _0x591489=0x1;_0x591489<=_0x37669f;_0x591489+=0x1){_0x1f4962=0x1+_0x1f4962*_0x591489/_0x455152;}return 0x1/_0x1f4962;}function isVoiceQueueOutbound(_0x13ddf7){return _0x13ddf7==='outbound';}function isNotPreview(_0x80fffe){return _0x80fffe!=='preview';}function isCampaignIvr(_0xdeec08){return _0xdeec08==='ivr';}function getCallerId(_0x370817,_0x3a2efc,_0x52dd59){if(!_['isUndefined'](_0x52dd59)&&typeof _0x52dd59===_0x601f('0x90')&&!_[_0x601f('0x78')](_0x52dd59)){if(!_['isUndefined'](_0x3a2efc)&&typeof _0x3a2efc===_0x601f('0x90')&&!_['isEmpty'](_0x3a2efc)){return util[_0x601f('0x73')](_0x601f('0x91'),_0x3a2efc,_0x52dd59);}return util['format'](_0x601f('0x91'),_0x52dd59,_0x52dd59);}if(!_[_0x601f('0x38')](_0x370817)&&typeof _0x370817==='string'&&!_[_0x601f('0x78')](_0x370817)){return _0x370817;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x2e9d1a,_0x1b34f5){return function(_0x2ba769){freeVariablesPredictive(_0x1b34f5);emitVoiceQueueSummary(_0x1b34f5);emitCampaignSummary(_0x1b34f5);loggerSyncQueueSummary['error'](_0x2e9d1a,util[_0x601f('0x92')](_0x2ba769,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2a1d09,_0x47c66d){return function(_0x243f81){loggerPredictive[_0x601f('0x93')](_0x47c66d[_0x601f('0x3a')],_0x2a1d09);loggerPredictive['error'](_0x243f81['stack']);freeVariablesPredictive(_0x47c66d);};}function loggerCatch(_0x10c0d3){return function(_0x210988){logger[_0x601f('0x93')](_0x10c0d3,util[_0x601f('0x92')](_0x210988,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x38e55a){return _0x38e55a&&!_[_0x601f('0x38')](_0x38e55a)&&_0x38e55a[_0x601f('0x94')]>0x0;}function decremetOriginate(_0x33c4e4){if(!_[_0x601f('0x38')](_0x33c4e4)&&_0x33c4e4!==null){if(typeof _0x33c4e4['originated']!==_0x601f('0x95')){if(_0x33c4e4[_0x601f('0x6d')]>0x0){_0x33c4e4[_0x601f('0x6d')]-=0x1;}else{logger[_0x601f('0x93')](_0x601f('0x96'));}}}else{logger['error'](_0x601f('0x97'));}}function checkContactLowerLimitOriginate(_0x508cfa,_0xd80ed0,_0x3ee089){if(_0xd80ed0>_0x3ee089){for(var _0x2534f0=0x0;_0x2534f0<_0xd80ed0-_0x3ee089;_0x2534f0+=0x1){decremetOriginate(_0x508cfa);}}}function loggerGetContactDialer(_0x8fd49a,_0x20086d,_0x34d894){return function(_0x567841){checkContactLowerLimitOriginate(_0x20086d,_0x34d894,0x0);logger[_0x601f('0x93')](_0x8fd49a,util[_0x601f('0x92')](_0x567841,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2ddaea){return function(_0x202114){if(isNotNull(_0x202114)&&isNotNull(_0x202114[0x0])){if(_0x202114[0x0][_0x601f('0x98')]>0x0){_0x2ddaea[_0x601f('0x39')]=_0x601f('0x99');logger[_0x601f('0x79')](_0x601f('0x9a')+_0x2ddaea[_0x601f('0x3a')],_0x202114[0x0][_0x601f('0x98')],_0x601f('0x9b'));}else{_0x2ddaea[_0x601f('0x39')]=_0x601f('0x9c');logger[_0x601f('0x79')](_0x601f('0x9d')+_0x2ddaea[_0x601f('0x3a')]);}}};}function notSendMessagesQueue(_0x822a6f){if(_0x822a6f[_0x601f('0x9e')]){freeVariablesPredictive(_0x822a6f);if(_0x822a6f['originated']===0x0&&_0x822a6f[_0x601f('0x4e')]===0x0&&_0x822a6f[_0x601f('0x51')]===0x0&&(_0x822a6f[_0x601f('0x4a')]||0x0)===0x0){_0x822a6f[_0x601f('0x9e')]=![];_0x822a6f['available']=0x0;_0x822a6f[_0x601f('0x39')]=_0x601f('0x3c');loggerSyncQueueSummary[_0x601f('0x93')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x822a6f[_0x601f('0x3a')],_0x601f('0x9f'));}else{_0x822a6f[_0x601f('0x39')]=_0x601f('0xa0');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x822a6f[_0x601f('0x3a')],_0x601f('0xa1'));}emitVoiceQueueSummary(_0x822a6f);}}function notSendMessagesCampaign(_0x5a4050){if(_0x5a4050[_0x601f('0x9e')]){if(_0x5a4050[_0x601f('0x6d')]===0x0){_0x5a4050['sendMessageOneNotActive']=![];_0x5a4050[_0x601f('0x39')]=_0x601f('0x3c');loggerSyncQueueSummary[_0x601f('0x93')](_0x601f('0xa2'),_0x5a4050[_0x601f('0x3a')],_0x601f('0x9f'));}else{_0x5a4050[_0x601f('0x39')]=_0x601f('0xa0');loggerSyncQueueSummary['error'](_0x601f('0xa2'),_0x5a4050[_0x601f('0x3a')],'is\x20disactive');}emitCampaignSummary(_0x5a4050);}}function createObjHistory(_0x594d0b,_0x510c29,_0x1711a1,_0x54ce96,_0x275066){_0x594d0b['message']=_0x1711a1;var _0x1e53e1=new Action(_0x594d0b,_0x510c29);var _0x3f778b=new History(_0x1e53e1);_0x3f778b['state']=_0x54ce96;_0x3f778b[_0x601f('0xa3')]=_0x275066;_0x3f778b['endtime']=_0x1e53e1[_0x601f('0xa4')];return _0x3f778b;}Dialer[_0x601f('0x17')][_0x601f('0x37')]=function(){var _0x4bf0ae=this;setInterval(function(){_0x4bf0ae[_0x601f('0xa5')](_0x4bf0ae['uniqueId'],'[uniqueid]');_0x4bf0ae[_0x601f('0xa5')](_0x4bf0ae['actions'],_0x601f('0xa6'));},0x32c8);};Dialer[_0x601f('0x17')]['clearZombieChannels']=function(_0x12e2b8,_0x2a7c5a){var _0x538e07=this;for(var _0x2df0c9 in _0x12e2b8){if(typeof _0x12e2b8[_0x2df0c9]!=='undefined'){this[_0x601f('0x1a')][_0x601f('0xa7')](function(){if(!_[_0x601f('0xa8')](_0x12e2b8[_0x2df0c9])){return ami['Action']({'action':_0x601f('0xa9'),'channel':_0x12e2b8[_0x2df0c9][_0x601f('0xaa')]})[_0x601f('0xab')](function(_0x4d8bdd){if(_0x4d8bdd['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x12e2b8[_0x2df0c9]&&_0x12e2b8[_0x2df0c9]['type']!==_0x601f('0xac')){_0x538e07['updateOriginated'](_0x538e07['voiceQueues'][_0x12e2b8[_0x2df0c9][_0x601f('0xad')]]);logger[_0x601f('0x93')]('[Dialer][checkChannel]',_0x2a7c5a,_0x2df0c9,_0x12e2b8[_0x2df0c9][_0x601f('0xad')]);delete _0x12e2b8[_0x2df0c9];}if(_0x12e2b8[_0x2df0c9]&&_0x12e2b8[_0x2df0c9]['type']==='ivr'){_0x538e07[_0x601f('0xae')](_0x538e07[_0x601f('0x1d')][_0x12e2b8[_0x2df0c9][_0x601f('0xad')]]);logger[_0x601f('0x93')]('[Dialer][checkChannel][ivr]',_0x2a7c5a,_0x2df0c9,_0x12e2b8[_0x2df0c9][_0x601f('0xad')]);delete _0x12e2b8[_0x2df0c9];}},0x2328);}});}});}}};Dialer[_0x601f('0x17')][_0x601f('0xaf')]=function(_0x5816f0){return BPromise[_0x601f('0xb0')]()[_0x601f('0xb1')](cmHopper[_0x601f('0xaf')](_0x5816f0))['catch'](loggerCatch(_0x601f('0xb2')));};Dialer['prototype'][_0x601f('0xb3')]=function(_0x4fd622){return BPromise['resolve']()[_0x601f('0xb1')](cmHopperBlack[_0x601f('0xb3')](_0x4fd622))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x601f('0x17')][_0x601f('0xb4')]=function(_0x4b6bec){return BPromise[_0x601f('0xb0')]()[_0x601f('0xb1')](cmHopperBlack['checkIsBlackListIvr'](_0x4b6bec))[_0x601f('0xab')](loggerCatch(_0x601f('0xb5')));};Dialer[_0x601f('0x17')][_0x601f('0xb6')]=function(_0x507b30){return BPromise[_0x601f('0xb0')]()[_0x601f('0xb1')](cmHopperHistory[_0x601f('0xb7')](_0x507b30))[_0x601f('0xab')](loggerCatch(_0x601f('0xb8')));};Dialer[_0x601f('0x17')][_0x601f('0xb9')]=function(_0x31c2b5){return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x31c2b5))[_0x601f('0xab')](loggerCatch(_0x601f('0xba')));};Dialer['prototype'][_0x601f('0xbb')]=function(_0x28f8e8,_0x10a7fa,_0x3a7d37){return BPromise['resolve']()[_0x601f('0xb1')](cmHopper[_0x601f('0xbb')](_0x28f8e8,_0x10a7fa,_0x3a7d37))[_0x601f('0xab')](loggerCatch(_0x601f('0xbc')));};Dialer[_0x601f('0x17')][_0x601f('0xbd')]=function(_0x539770,_0x3691b3,_0x25a83f,_0x23a891){return BPromise['resolve']()[_0x601f('0xb1')](cmHopper[_0x601f('0xbd')](_0x539770,_0x3691b3,_0x25a83f,_0x23a891))[_0x601f('0xab')](loggerCatch(_0x601f('0xbe')));};Dialer[_0x601f('0x17')][_0x601f('0xbf')]=function(_0x165226,_0x27ace2,_0x54c791){return BPromise['resolve']()['then'](cmHopper[_0x601f('0xbf')](_0x165226,_0x27ace2,_0x54c791))[_0x601f('0xab')](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x5244bb){return BPromise[_0x601f('0xb0')]()[_0x601f('0xb1')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5244bb))[_0x601f('0xab')](loggerCatch(_0x601f('0xc0')));};Dialer['prototype'][_0x601f('0xc1')]=function(_0x415c96){return BPromise[_0x601f('0xb0')]()[_0x601f('0xb1')](cmHopper[_0x601f('0xc1')](_0x415c96))[_0x601f('0xab')](loggerCatch(_0x601f('0xc2')));};Dialer[_0x601f('0x17')][_0x601f('0xc3')]=function(_0x44e453){return BPromise[_0x601f('0xb0')]()['then'](cmHopperHistory[_0x601f('0xc3')](_0x44e453))[_0x601f('0xab')](loggerCatch(_0x601f('0xc4')));};Dialer[_0x601f('0x17')][_0x601f('0xae')]=function(_0x57ba57){if(!_['isUndefined'](_0x57ba57)&&_0x57ba57!==null){if(typeof _0x57ba57['originated']!==_0x601f('0x95')){if(_0x57ba57[_0x601f('0x6d')]>0x0){_0x57ba57['originated']-=0x1;}else{logger[_0x601f('0x93')](_0x601f('0xc5'));}}}else{logger[_0x601f('0x93')](_0x601f('0xc6'));}};Dialer['prototype'][_0x601f('0xc7')]=function(_0xf06835,_0x327933){var _0x656d=this;return function(_0x77e5c0){_0x656d[_0x601f('0xae')](_0x327933);logger[_0x601f('0x93')](_0xf06835,util[_0x601f('0x92')](_0x77e5c0,{'showHidden':![],'depth':null}));};};Dialer[_0x601f('0x17')]['emptyContact']=function(_0x1a14b0,_0x5c2d91,_0x56cb25){var _0xa2c87e={'state':0x19,'statedesc':_0x601f('0xc8')};this[_0x601f('0xae')](_0x5c2d91);this[_0x601f('0xc9')](_[_0x601f('0x8b')](_0xa2c87e,_[_0x601f('0xca')](_0x56cb25,[_0x601f('0xcb'),'ListId',_0x601f('0xcc'),_0x601f('0xcd'),_0x601f('0xce')])),_0x601f('0xcf'),_0x601f('0xd0'));logger[_0x601f('0x93')](_0x1a14b0);};Dialer[_0x601f('0x17')][_0x601f('0xd1')]=function(_0x3bfabf){return _0x3bfabf===_0x601f('0xd2');};Dialer[_0x601f('0x17')][_0x601f('0xd3')]=function(_0x8a24dc){return!_[_0x601f('0x38')](_0x8a24dc)&&_0x8a24dc&&!_['isUndefined'](_0x8a24dc[_0x601f('0x3a')])&&!_['isUndefined'](_0x8a24dc[_0x601f('0xd4')])&&_0x8a24dc[_0x601f('0xd4')]&&(this[_0x601f('0x1f')][util['format'](_0x601f('0xd5'),_0x8a24dc[_0x601f('0x3a')])][_0x601f('0xa9')]===_0x601f('0xd6')||this[_0x601f('0x1f')][util['format']('SIP/%s',_0x8a24dc[_0x601f('0x3a')])][_0x601f('0xa9')]===_0x601f('0xd7'));};Dialer[_0x601f('0x17')][_0x601f('0xc9')]=function(_0x1bbf17,_0x4cbd88,_0x2385b4){this['createHistory'](_0x1bbf17)[_0x601f('0xab')](loggerCatch(_0x4cbd88));this[_0x601f('0xc1')](_0x1bbf17)['catch'](loggerCatch(_0x2385b4));};Dialer[_0x601f('0x17')]['syncVarSet']=function(_0x4d734e){var _0x5c1224=this[_0x601f('0x23')][_0x4d734e[_0x601f('0xd8')]];var _0x5cbffa;if(!_['isNil'](_0x4d734e)&&!_['isNil'](_0x4d734e[_0x601f('0xd9')])&&!_[_0x601f('0xa8')](_0x4d734e[_0x601f('0xd9')][_0x601f('0xda')])&&_0x4d734e['exten']===_0x601f('0xdb')&&_0x5c1224){if(_0x5c1224['type']!==_0x601f('0xac')&&this[_0x601f('0x1c')][_0x5c1224[_0x601f('0xad')]][_0x601f('0xdc')]&&_0x4d734e[_0x601f('0xdd')]==='HANGUP'){delete this[_0x601f('0x23')][_0x4d734e[_0x601f('0xd8')]];this[_0x601f('0xae')](this[_0x601f('0x1c')][_0x5c1224[_0x601f('0xad')]]);this[_0x601f('0x1c')][_0x5c1224[_0x601f('0xad')]][_0x601f('0x58')]+=0x1;this[_0x601f('0x1c')][_0x5c1224[_0x601f('0xad')]][_0x601f('0x57')]+=0x1;_0x5cbffa=new Hangup(_0x5c1224,_0x4d734e);_0x5cbffa[_0x601f('0xde')]=0x12;_0x5cbffa[_0x601f('0xa3')]=_0x601f('0xdf');_0x5cbffa[_0x601f('0xe0')]=_0x601f('0xe1');this['saveInDb'](_0x5cbffa,'[syncHangupInAMD][createHistory]',_0x601f('0xe2'));}if(_0x5c1224[_0x601f('0x47')]!==_0x601f('0xac')&&this[_0x601f('0x1c')][_0x5c1224[_0x601f('0xad')]][_0x601f('0xdc')]&&_0x4d734e['value']==='MACHINE'){var _0x1f4a89=this;return new BPromise(function(_0x43423e,_0x193a2f){delete _0x1f4a89[_0x601f('0x23')][_0x4d734e['uniqueid']];_0x1f4a89[_0x601f('0xae')](_0x1f4a89[_0x601f('0x1c')][_0x5c1224['queue']]);_0x1f4a89[_0x601f('0x1c')][_0x5c1224['queue']][_0x601f('0x58')]+=0x1;_0x1f4a89[_0x601f('0x1c')][_0x5c1224[_0x601f('0xad')]][_0x601f('0x57')]+=0x1;var _0x15f300=_0x1f4a89['voiceQueues'][_0x5c1224[_0x601f('0xad')]];var _0x3d0b9e=new Hangup(_0x5c1224,_0x4d734e);_0x3d0b9e[_0x601f('0xde')]=0x13;_0x3d0b9e[_0x601f('0xa3')]=_0x601f('0xe3');_0x3d0b9e[_0x601f('0xe0')]='AMD';_0x3d0b9e['countmachineretry']+=0x1;_0x3d0b9e['countglobal']+=0x1;_0x3d0b9e[_0x601f('0xe4')]=!![];_0x1f4a89[_0x601f('0xc3')](_0x3d0b9e)['catch'](loggerCatch(_0x601f('0xe5')));if(_0x3d0b9e[_0x601f('0xe6')]+_0x3d0b9e['countcongestionretry']+_0x3d0b9e['countnoanswerretry']+_0x3d0b9e['countnosuchnumberretry']+_0x3d0b9e[_0x601f('0xe7')]+_0x3d0b9e['countabandonedretry']+_0x3d0b9e[_0x601f('0xe8')]+_0x3d0b9e[_0x601f('0xe9')]>=_0x15f300[_0x601f('0xea')]){_0x1f4a89[_0x601f('0xeb')](_0x3d0b9e,_0x43423e,_0x193a2f,'reason19\x20machine....');}else{if(_0x3d0b9e[_0x601f('0xe8')]>=_0x15f300[_0x601f('0xec')]){_0x1f4a89[_0x601f('0xed')](_0x3d0b9e,_0x43423e,_0x193a2f,'reason\x2019\x20machine....');}else{_0x1f4a89['rescheduleContact']({'active':![],'countmachineretry':_0x3d0b9e[_0x601f('0xe8')],'scheduledat':moment()[_0x601f('0xee')](_0x15f300[_0x601f('0xef')],_0x601f('0xf0'))[_0x601f('0x73')](_0x601f('0xf1')),'ContactId':_0x3d0b9e[_0x601f('0xcb')],'ListId':_0x3d0b9e[_0x601f('0xf2')],'VoiceQueueId':_0x3d0b9e[_0x601f('0xcd')]||undefined,'CampaignId':_0x3d0b9e['CampaignId']||undefined})[_0x601f('0xab')](loggerCatch(_0x601f('0xf3')));_0x43423e({'reschedule':0x1});}}});}if(_0x5c1224[_0x601f('0x47')]===_0x601f('0xac')&&this[_0x601f('0x1d')][_0x5c1224[_0x601f('0xad')]][_0x601f('0xdc')]&&_0x4d734e[_0x601f('0xdd')]===_0x601f('0xf4')){delete this['uniqueId'][_0x4d734e['uniqueid']];this[_0x601f('0xae')](this['campaigns'][_0x5c1224[_0x601f('0xad')]]);_0x5cbffa=new Hangup(_0x5c1224,_0x4d734e);_0x5cbffa[_0x601f('0xde')]=0x12;_0x5cbffa['statedesc']=_0x601f('0xdf');_0x5cbffa[_0x601f('0xe0')]='AMD';this[_0x601f('0xc9')](_0x5cbffa,'[syncHangupInAMDIvr][createHistory]',_0x601f('0xf5'));}if(_0x5c1224['type']==='ivr'&&this[_0x601f('0x1d')][_0x5c1224[_0x601f('0xad')]][_0x601f('0xdc')]&&_0x4d734e[_0x601f('0xdd')]===_0x601f('0xf6')){var _0x1f4a89=this;return new BPromise(function(_0x5e2faf,_0x5e3d1d){delete _0x1f4a89[_0x601f('0x23')][_0x4d734e['uniqueid']];_0x1f4a89[_0x601f('0xae')](_0x1f4a89[_0x601f('0x1d')][_0x5c1224[_0x601f('0xad')]]);_0x1f4a89['campaigns'][_0x5c1224['queue']]['outboundAnswerCallsDay']+=0x1;_0x1f4a89[_0x601f('0x1d')][_0x5c1224[_0x601f('0xad')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x298b52=_0x1f4a89[_0x601f('0x1d')][_0x5c1224[_0x601f('0xad')]];var _0x3a5f9a=new Hangup(_0x5c1224,_0x4d734e);_0x3a5f9a[_0x601f('0xde')]=0x13;_0x3a5f9a[_0x601f('0xa3')]=_0x601f('0xe3');_0x3a5f9a[_0x601f('0xe0')]=_0x601f('0xe1');_0x3a5f9a['countmachineretry']+=0x1;_0x3a5f9a[_0x601f('0xf7')]+=0x1;_0x3a5f9a[_0x601f('0xe4')]=!![];_0x1f4a89[_0x601f('0xc3')](_0x3a5f9a)[_0x601f('0xab')](loggerCatch(_0x601f('0xe5')));if(_0x3a5f9a[_0x601f('0xe6')]+_0x3a5f9a[_0x601f('0xf8')]+_0x3a5f9a[_0x601f('0xf9')]+_0x3a5f9a['countnosuchnumberretry']+_0x3a5f9a[_0x601f('0xe7')]+_0x3a5f9a[_0x601f('0xfa')]+_0x3a5f9a[_0x601f('0xe8')]+_0x3a5f9a[_0x601f('0xe9')]>=_0x298b52['dialGlobalMaxRetry']){_0x1f4a89[_0x601f('0xeb')](_0x3a5f9a,_0x5e2faf,_0x5e3d1d,_0x601f('0xfb'));}else{if(_0x3a5f9a['countmachineretry']>=_0x298b52[_0x601f('0xec')]){_0x1f4a89[_0x601f('0xed')](_0x3a5f9a,_0x5e2faf,_0x5e3d1d,_0x601f('0xfc'));}else{_0x1f4a89[_0x601f('0xb9')]({'active':![],'countmachineretry':_0x3a5f9a[_0x601f('0xe8')],'scheduledat':moment()[_0x601f('0xee')](_0x298b52[_0x601f('0xef')],_0x601f('0xf0'))[_0x601f('0x73')](_0x601f('0xf1')),'ContactId':_0x3a5f9a['ContactId'],'ListId':_0x3a5f9a['ListId'],'VoiceQueueId':_0x3a5f9a[_0x601f('0xcd')]||undefined,'CampaignId':_0x3a5f9a[_0x601f('0xce')]||undefined})[_0x601f('0xab')](loggerCatch(_0x601f('0xf3')));_0x5e2faf({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x601f('0x2f')]=function(_0x3b72b5){var _0x1574ba=this[_0x601f('0x23')][_0x3b72b5[_0x601f('0xd8')]];var _0x392944=this;var _0x43d8ec;if(_0x1574ba&&_0x1574ba[_0x601f('0x47')]===_0x601f('0xac')){delete this['uniqueId'][_0x3b72b5[_0x601f('0xd8')]];this[_0x601f('0xae')](this[_0x601f('0x1d')][_0x1574ba[_0x601f('0xad')]]);this[_0x601f('0x1d')][_0x1574ba[_0x601f('0xad')]][_0x601f('0xfd')]+=0x1;_0x43d8ec=new Hangup(_0x1574ba,_0x3b72b5);this[_0x601f('0xc3')](_0x43d8ec)[_0x601f('0xab')](loggerCatch(_0x601f('0xfe')));this[_0x601f('0xc1')](_0x43d8ec)[_0x601f('0xab')](loggerCatch(_0x601f('0xff')));}if(_0x1574ba&&_0x1574ba[_0x601f('0x47')]!=='ivr'&&isNotNull(this[_0x601f('0x1c')][_0x1574ba[_0x601f('0xad')]][_0x601f('0x100')])){delete this[_0x601f('0x23')][_0x3b72b5[_0x601f('0xd8')]];this[_0x601f('0xae')](this[_0x601f('0x1c')][_0x1574ba['queue']]);this[_0x601f('0x1c')][_0x1574ba[_0x601f('0xad')]][_0x601f('0x58')]+=0x1;this[_0x601f('0x1c')][_0x1574ba[_0x601f('0xad')]][_0x601f('0x57')]+=0x1;_0x43d8ec=new Hangup(_0x1574ba,_0x3b72b5);_0x43d8ec[_0x601f('0xde')]=0x10;_0x43d8ec[_0x601f('0xa3')]='AnswerAGI';_0x43d8ec[_0x601f('0xe0')]=_0x601f('0x101');this[_0x601f('0xc3')](_0x43d8ec)[_0x601f('0xab')](loggerCatch(_0x601f('0xfe')));this['moveContactManagedDialer'](_0x43d8ec)['catch'](loggerCatch(_0x601f('0xff')));}if(_0x1574ba&&_0x1574ba[_0x601f('0x47')]!==_0x601f('0xac')&&!isNotNull(this[_0x601f('0x1c')][_0x1574ba[_0x601f('0xad')]][_0x601f('0x100')])){delete this['uniqueId'][_0x3b72b5[_0x601f('0xd8')]];this['updateOriginated'](this[_0x601f('0x1c')][_0x1574ba[_0x601f('0xad')]]);this['voiceQueues'][_0x1574ba[_0x601f('0xad')]][_0x601f('0x62')]+=0x1;_0x43d8ec=new Hangup(_0x1574ba,_0x3b72b5);_0x43d8ec[_0x601f('0xde')]=0xc;_0x43d8ec['statedesc']=_0x3b72b5[_0x601f('0x102')];_0x43d8ec['membername']='Unknow';this[_0x601f('0xc3')](_0x43d8ec)[_0x601f('0xab')](loggerCatch(_0x601f('0xfe')));this[_0x601f('0xc1')](_0x43d8ec)[_0x601f('0xab')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x601f('0x17')][_0x601f('0x2d')]=function(_0x5df715){var _0x355d2d=this['uniqueId'][_0x5df715[_0x601f('0xd8')]];var _0x532313=this;if(this[_0x601f('0x1c')][_0x5df715[_0x601f('0xad')]]){if(_0x355d2d&&_0x355d2d[_0x601f('0x47')]!==_0x601f('0xac')){delete this[_0x601f('0x23')][_0x5df715[_0x601f('0xd8')]];this[_0x601f('0x1c')][_0x5df715['queue']][_0x601f('0x58')]+=0x1;var _0x1b0a85=new AgentComplete(_0x355d2d,_0x5df715);if(_0x5df715[_0x601f('0x103')]===_0x601f('0x104')){_0x1b0a85[_0x601f('0x105')]=this['voiceQueues'][_0x5df715['queue']][_0x601f('0x106')]&&this[_0x601f('0x1c')][_0x5df715[_0x601f('0xad')]][_0x601f('0x107')]?moment()[_0x601f('0x73')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x601f('0xc3')](_0x1b0a85)[_0x601f('0xab')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x1b0a85)['catch'](loggerCatch(_0x601f('0x108')));}}};Dialer[_0x601f('0x17')][_0x601f('0x109')]=function(_0x3de669){if(this[_0x601f('0x1c')][_0x3de669[_0x601f('0xad')]]){if(this[_0x601f('0x23')][_0x3de669[_0x601f('0xd8')]]&&this['uniqueId'][_0x3de669[_0x601f('0xd8')]][_0x601f('0x47')]!==_0x601f('0xac')){this[_0x601f('0xae')](this[_0x601f('0x1c')][_0x3de669['queue']]);this[_0x601f('0x23')][_0x3de669[_0x601f('0xd8')]]['answertime']=moment()[_0x601f('0x73')](_0x601f('0xf1'));}}};Dialer[_0x601f('0x17')]['queueCallerAbandonCreateState']=function(_0x4a106b){this['createHistory'](_0x4a106b)[_0x601f('0xab')](loggerCatch(_0x601f('0x10a')));this[_0x601f('0xc1')](_0x4a106b)['catch'](loggerCatch(_0x601f('0x10b')));};Dialer[_0x601f('0x17')][_0x601f('0x10c')]=function(_0x1c3eec){var _0x2844d2=this[_0x601f('0x23')][_0x1c3eec[_0x601f('0xd8')]];var _0x223fcb=this;if(this[_0x601f('0x1c')][_0x1c3eec[_0x601f('0xad')]]){if(_0x2844d2&&_0x2844d2[_0x601f('0x47')]!==_0x601f('0xac')){delete this[_0x601f('0x23')][_0x1c3eec[_0x601f('0xd8')]];this[_0x601f('0xae')](this[_0x601f('0x1c')][_0x1c3eec['queue']]);_0x2844d2[_0x601f('0x10d')]=moment()[_0x601f('0x73')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4982de=new QueueCallerAbandon(_0x2844d2,_0x1c3eec);if(getSeconds(_0x2844d2[_0x601f('0x10d')],_0x2844d2['responsetime'])>=_0x2844d2[_0x601f('0x10e')]){this[_0x601f('0x1c')][_0x1c3eec['queue']][_0x601f('0x66')]+=0x1;this[_0x601f('0x1c')][_0x1c3eec[_0x601f('0xad')]][_0x601f('0x5c')]+=0x1;this['voiceQueues'][_0x1c3eec[_0x601f('0xad')]][_0x601f('0x68')]+=0x1;_0x4982de[_0x601f('0xde')]=0xa;_0x4982de[_0x601f('0xa3')]=_0x601f('0x10f');_0x4982de[_0x601f('0x110')]='TIMEOUT';_0x4982de[_0x601f('0x105')]=this[_0x601f('0x1c')][_0x1c3eec[_0x601f('0xad')]][_0x601f('0x106')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x4982de[_0x601f('0xe7')]+=0x1;_0x4982de['countglobal']+=0x1;if(_0x4982de[_0x601f('0xe7')]>=this[_0x601f('0x1c')][_0x1c3eec[_0x601f('0xad')]][_0x601f('0x111')]){this['queueCallerAbandonCreateState'](_0x4982de);}else{this[_0x601f('0xb9')]({'active':![],'countdropretry':_0x4982de[_0x601f('0xe7')],'scheduledat':moment()[_0x601f('0xee')](this[_0x601f('0x1c')][_0x1c3eec[_0x601f('0xad')]][_0x601f('0x112')],_0x601f('0xf0'))['format'](_0x601f('0xf1')),'ContactId':_0x2844d2[_0x601f('0xcb')],'ListId':_0x2844d2[_0x601f('0xf2')],'VoiceQueueId':_0x2844d2[_0x601f('0xcd')]||undefined,'CampaignId':_0x2844d2[_0x601f('0xce')]||undefined})[_0x601f('0xab')](loggerCatch(_0x601f('0x113')));var _0x1cdc04=new History(_0x4982de);_0x1cdc04['state']=0xa;_0x1cdc04[_0x601f('0xa3')]=_0x601f('0x10f');_0x1cdc04[_0x601f('0xa4')]=moment()[_0x601f('0x73')]('YYYY-MM-DD\x20HH:mm:ss');_0x1cdc04[_0x601f('0x114')]=_0x1cdc04[_0x601f('0xa4')];_0x1cdc04[_0x601f('0x115')]=_0x4982de['calleridname'];_0x1cdc04['calleridnum']=_0x4982de[_0x601f('0x116')];this[_0x601f('0xc3')](_0x1cdc04)[_0x601f('0xab')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x601f('0x1c')][_0x1c3eec['queue']][_0x601f('0x65')]+=0x1;this[_0x601f('0x1c')][_0x1c3eec[_0x601f('0xad')]]['outboundDropCallsDayCallersExit']+=0x1;_0x4982de[_0x601f('0xde')]=0xb;_0x4982de[_0x601f('0xa3')]=_0x601f('0x117');_0x4982de[_0x601f('0x110')]=_0x601f('0x118');_0x4982de[_0x601f('0xfa')]+=0x1;_0x4982de[_0x601f('0xf7')]+=0x1;if(_0x4982de['countabandonedretry']>=this['voiceQueues'][_0x1c3eec[_0x601f('0xad')]][_0x601f('0x119')]){this[_0x601f('0x11a')](_0x4982de);}else{this[_0x601f('0xb9')]({'active':![],'countabandonedretry':_0x4982de['countabandonedretry'],'scheduledat':moment()[_0x601f('0xee')](this[_0x601f('0x1c')][_0x1c3eec[_0x601f('0xad')]]['dialAbandonedRetryFrequency'],_0x601f('0xf0'))[_0x601f('0x73')](_0x601f('0xf1')),'ContactId':_0x2844d2[_0x601f('0xcb')],'ListId':_0x2844d2[_0x601f('0xf2')],'VoiceQueueId':_0x2844d2[_0x601f('0xcd')]||undefined,'CampaignId':_0x2844d2[_0x601f('0xce')]||undefined})[_0x601f('0xab')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x1cdc04=new History(_0x4982de);_0x1cdc04['state']=0xb;_0x1cdc04[_0x601f('0xa3')]='Abandoned';_0x1cdc04[_0x601f('0xa4')]=moment()['format'](_0x601f('0xf1'));_0x1cdc04['endtime']=_0x1cdc04[_0x601f('0xa4')];_0x1cdc04[_0x601f('0x115')]=_0x4982de[_0x601f('0x115')];_0x1cdc04[_0x601f('0x116')]=_0x4982de[_0x601f('0x116')];this['createHistory'](_0x1cdc04)[_0x601f('0xab')](loggerCatch(_0x601f('0x11b')));}}}}};Dialer['prototype'][_0x601f('0x31')]=function(_0x1277ff){if(this['actions'][_0x1277ff[_0x601f('0xd8')]]){this['actions'][_0x1277ff['uniqueid']][_0x601f('0xaa')]=_0x1277ff[_0x601f('0xaa')];}if(this['uniqueId'][_0x1277ff['uniqueid']]){this[_0x601f('0x23')][_0x1277ff[_0x601f('0xd8')]][_0x601f('0xaa')]=_0x1277ff[_0x601f('0xaa')];}};Dialer['prototype'][_0x601f('0x35')]=function(_0xc7d6dc){if(strategy[this[_0x601f('0x1c')][this['actions'][_0xc7d6dc['actionid']][_0x601f('0xad')]]['strategy']]===_0x601f('0x16')){if(this[_0x601f('0x11c')][_0xc7d6dc[_0x601f('0x11d')]]&&_[_0x601f('0xa8')](this[_0x601f('0x11c')][_0xc7d6dc['actionid']][_0x601f('0x11e')])&&_0xc7d6dc[_0x601f('0xa9')]==='1'&&_0xc7d6dc[_0x601f('0x11f')]==='0'){if(this[_0x601f('0x1e')][_0xc7d6dc[_0x601f('0x120')]]){if(!this[_0x601f('0x1e')][_0xc7d6dc[_0x601f('0x120')]][_0x601f('0x11e')]){this[_0x601f('0x1e')][_0xc7d6dc[_0x601f('0x120')]]['locked']=!![];this[_0x601f('0x11c')][_0xc7d6dc[_0x601f('0x11d')]][_0x601f('0x11e')]=!![];this['actions'][_0xc7d6dc[_0x601f('0x11d')]][_0x601f('0x120')]=_0xc7d6dc['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x601f('0x11c')][_0xc7d6dc[_0x601f('0x11d')]][_0x601f('0xad')]][_0x601f('0x121')]]||_0x601f('0x15'))==='rrmemory'){if(this[_0x601f('0x11c')][_0xc7d6dc[_0x601f('0x11d')]]){if(this[_0x601f('0x1e')][_0xc7d6dc['stateinterface']]){this[_0x601f('0x11c')][_0xc7d6dc[_0x601f('0x11d')]][_0x601f('0x120')]=_0xc7d6dc['stateinterface'];if(_[_0x601f('0xa8')](this[_0x601f('0x122')][this[_0x601f('0x11c')][_0xc7d6dc[_0x601f('0x11d')]][_0x601f('0xad')]])){this['queueBooked'][this[_0x601f('0x11c')][_0xc7d6dc[_0x601f('0x11d')]]['queue']]=[];}this[_0x601f('0x122')][this[_0x601f('0x11c')][_0xc7d6dc[_0x601f('0x11d')]]['queue']][_0x601f('0x123')](_[_0x601f('0x8b')](_[_0x601f('0xca')](this[_0x601f('0x11c')][_0xc7d6dc[_0x601f('0x11d')]],[_0x601f('0x124'),_0x601f('0x120')]),{'status':_0xc7d6dc[_0x601f('0xa9')],'paused':_0xc7d6dc[_0x601f('0x11f')]}));}}}};function unlockQueueStatus(_0xcb34ce,_0x9cbf9e){setTimeout(function(){if(_['isUndefined'](_0xcb34ce[_0x601f('0x125')])){loggerBooked[_0x601f('0x93')](_0x601f('0x126'),_0x9cbf9e);}_0xcb34ce[_0x601f('0x125')]=!![];loggerBooked[_0x601f('0x79')]('[booked][unlockQueueStatus]',_0x9cbf9e,JSON[_0x601f('0x43')](_[_0x601f('0xca')](_0xcb34ce,[_0x601f('0x3a'),_0x601f('0x125')])));},0x1f3);}Dialer[_0x601f('0x17')]['syncQueueStatusComplete']=function(_0x2bfdf5){var _0x2a61a0=this;var _0x8d73b1=_0x2a61a0[_0x601f('0x1c')][_0x2a61a0[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0xad')]];if(strategy[this[_0x601f('0x1c')][this['actions'][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0xad')]]['strategy']]===_0x601f('0x16')){if(this['actions'][_0x2bfdf5[_0x601f('0x11d')]]&&this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]]['stateinterface']){this[_0x601f('0x1b')][_0x601f('0x127')](this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0x124')],this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0x120')])[_0x601f('0xab')](function(_0x16f978){logger['error'](_0x601f('0x128'),util[_0x601f('0x92')](_0x16f978,{'showHidden':![],'depth':null}));})['finally'](function(){_0x2a61a0[_0x601f('0xae')](_0x2a61a0['voiceQueues'][_0x2a61a0[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0xad')]]);_0x2a61a0['agents'][_0x2a61a0[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0x120')]][_0x601f('0x11e')]=![];delete _0x2a61a0[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]];unlockQueueStatus(_0x8d73b1);});}else{this[_0x601f('0xae')](this[_0x601f('0x1c')][this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0xad')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x601f('0x11c')][_0x2bfdf5['actionid']][_0x601f('0xcb')],'ListId':this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]]['ListId'],'VoiceQueueId':this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0xcd')]||undefined,'CampaignId':this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0xce')]||undefined})[_0x601f('0xab')](loggerCatch(_0x601f('0x129')));delete this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]];unlockQueueStatus(_0x8d73b1);}}else if((strategy[this[_0x601f('0x1c')][this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0xad')]][_0x601f('0x121')]]||_0x601f('0x15'))==='rrmemory'){var _0x33095c;if(this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]]&&!_[_0x601f('0x78')](this[_0x601f('0x122')][this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0xad')]])){if(this[_0x601f('0x27')][_0x2a61a0['actions'][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0xad')]]){this['queueBookedRR'][_0x2a61a0[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0xad')]]=this[_0x601f('0x27')][this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]]['queue']]?this[_0x601f('0x27')][this[_0x601f('0x11c')][_0x2bfdf5['actionid']][_0x601f('0xad')]]:this['queueBooked'][this[_0x601f('0x11c')][_0x2bfdf5['actionid']][_0x601f('0xad')]]?this[_0x601f('0x122')][this[_0x601f('0x11c')][_0x2bfdf5['actionid']]['queue']][_0x601f('0x12a')]||0x0:0x0;}this[_0x601f('0x122')][this['actions'][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0xad')]][_0x601f('0x12a')]=this[_0x601f('0x27')][this[_0x601f('0x11c')][_0x2bfdf5[_0x601f('0x11d')]][_0x601f('0xad')]];for(var _0x42734a=0x0;_0x42734a=0x0;})[_0x601f('0xab')](myreject(_0x114a7e)));}}else{_0x5ea448[_0x601f('0x123')](ami[_0x601f('0x140')]({'action':_0x601f('0x13c'),'command':util['format']('iftime\x20%s,%s',_0xbbee20,!_[_0x601f('0x38')](config['timezones'][_0x3712cb])?_0x3712cb:'')})[_0x601f('0xb1')](function(_0x1e4595){return _0x1e4595['content'][_0x601f('0x13e')]('true')>=0x0;})[_0x601f('0xab')](myreject(_0x114a7e)));}BPromise[_0x601f('0x141')](_0x5ea448)[_0x601f('0xb1')](function(_0x9fd71d){var _0x4ae46a=_[_0x601f('0x142')](_0x9fd71d);if(_0x4ae46a){return _0x5571c7(_0x4ae46a);}else{_0x456a6d[_0x601f('0x39')]=_0x532523?'GLOBAL_INTERVAL_IS_OVERTIME':_0x601f('0x143');return _0x114a7e(msgResponse(_0x601f('0x144'),'Failure',_0x601f('0x145')+_0x532523+'\x20'+_0x1df63e+_0x601f('0x146')+util[_0x601f('0x92')](_0xbbee20,{'showHidden':![],'depth':null})+_0x601f('0x147')+_0x3712cb));}})['catch'](function(_0x56b186){return _0x114a7e(msgResponse(_0x601f('0x135'),_0x601f('0x137'),JSON[_0x601f('0x43')](_0x56b186)));});});};Dialer[_0x601f('0x17')]['checkDialMethod']=function(_0x4439b4){var _0x5b0c12=this;return function(){switch(_0x4439b4[_0x601f('0x53')]){case _0x601f('0x148'):freeVariablesPredictive(_0x4439b4);_0x5b0c12[_0x601f('0x149')](_0x4439b4,0x1);break;case _0x601f('0x14a'):freeVariablesPredictive(_0x4439b4);_0x5b0c12['handlePower'](_0x4439b4,_0x4439b4[_0x601f('0x14b')]);break;case _0x601f('0x14c'):_0x5b0c12[_0x601f('0x14c')](_0x4439b4);break;case _0x601f('0x14d'):freeVariablesPredictive(_0x4439b4);_0x5b0c12[_0x601f('0x149')](_0x4439b4,0x1);break;default:freeVariablesPredictive(_0x4439b4);logger['error'](_0x601f('0x14e'),_0x4439b4[_0x601f('0x3a')],_0x601f('0x14f'));}};};Dialer[_0x601f('0x17')]['launchHandleIvr']=function(_0x345e45){var _0x2c81ec=this;return function(){_0x2c81ec[_0x601f('0x150')](_0x345e45);};};Dialer[_0x601f('0x17')]['syncQueueSummary']=function(_0x42f4f9){var _0x5694ed=this;if(isNotPreview(_0x42f4f9['dialMethod'])){if(isVoiceQueueOutbound(_0x42f4f9[_0x601f('0x47')])&&isActive(_0x42f4f9[_0x601f('0x151')])){_0x42f4f9['sendMessageOneNotActive']=!![];BPromise[_0x601f('0xb0')]()[_0x601f('0xb1')](checkIsLoggedIn(_0x42f4f9,_0x42f4f9[_0x601f('0x152')]))[_0x601f('0xb1')](checkIsActive(_0x42f4f9,_0x42f4f9[_0x601f('0x151')]))[_0x601f('0xb1')](checkInterval(_0x42f4f9))[_0x601f('0xb1')](_0x5694ed['checkIsTrunkReachable'](_0x42f4f9))['then'](_0x5694ed['checkIfTime'](_0x42f4f9[_0x601f('0x153')],_0x42f4f9[_0x601f('0x154')],_0x42f4f9['name'],_0x42f4f9))[_0x601f('0xb1')](_0x5694ed['checkIfTimeIntervals'](_0x42f4f9[_0x601f('0x3e')],_0x42f4f9['dialTimezone'],_0x42f4f9['name'],_0x42f4f9))[_0x601f('0xb1')](_0x5694ed[_0x601f('0x155')](_0x42f4f9))[_0x601f('0xab')](loggerCatchQueueSummary(_0x601f('0x156'),_0x42f4f9));}else{notSendMessagesQueue(_0x42f4f9);}}else{freeVariablesPredictive(_0x42f4f9);}};Dialer['prototype'][_0x601f('0x157')]=function(){var _0xe456ea=this;var _0x2b4870;for(var _0x156d9b in this['campaigns']){if(typeof this[_0x601f('0x1d')][_0x156d9b]!=='undefined'){_0x2b4870=this[_0x601f('0x1d')][_0x156d9b];if(isCampaignIvr(_0x2b4870[_0x601f('0x47')])&&isActive(_0x2b4870[_0x601f('0xd4')])){_0x2b4870['sendMessageOneNotActive']=!![];BPromise[_0x601f('0xb0')]()[_0x601f('0xb1')](checkIsActive(_0x2b4870,_0x2b4870[_0x601f('0xd4')]))[_0x601f('0xb1')](checkInterval(_0x2b4870))[_0x601f('0xb1')](_0xe456ea[_0x601f('0x158')](_0x2b4870))[_0x601f('0xb1')](_0xe456ea[_0x601f('0x159')](_0x2b4870[_0x601f('0x153')],_0x2b4870['dialTimezone'],_0x2b4870[_0x601f('0x3a')],_0x2b4870))[_0x601f('0xb1')](_0xe456ea['checkIfTimeIntervals'](_0x2b4870[_0x601f('0x3e')],_0x2b4870['dialTimezone'],_0x2b4870[_0x601f('0x3a')],_0x2b4870))['then'](_0xe456ea[_0x601f('0x15a')](_0x2b4870))[_0x601f('0xab')](loggerCatchQueueSummary(_0x601f('0x15b'),_0x2b4870));}else{notSendMessagesCampaign(_0x2b4870);}}}};function getCallerIdRandom(_0x3c9a68,_0xa2fc8d){var _0x3429e2;var _0x2b46d1;var _0x55afcd;if(_0xa2fc8d<=0x0){_0xa2fc8d=0x1;}_0x3429e2=new RegExp(_0x601f('0x15c')+_0xa2fc8d+'}$');_0x2b46d1=Math[_0x601f('0x15d')](0xa,_0xa2fc8d-0x1);_0x55afcd=Math[_0x601f('0x15d')](0xa,_0xa2fc8d)-0x1;return util['format']('%s',_[_0x601f('0x15e')](_0x3c9a68,_0x3429e2,_[_0x601f('0x15f')](_0x2b46d1,_0x55afcd)));}function extractCalleridName(_0x5947ee){var _0x3a9c9d=_0x5947ee['match'](/"(.*?)"/);return _0x3a9c9d?_0x3a9c9d[0x1]:_0x5947ee;}function extractCalleridNumber(_0x47b47a){var _0x505eaa=_0x47b47a['match'](/<(.*?)>/);return _0x505eaa?_0x505eaa[0x1]:_0x47b47a;}Dialer[_0x601f('0x17')][_0x601f('0x160')]=function(_0x56e2ce,_0x1f94c9){var _0x164ba3=this;var _0x3db1c6=uuid['v4']();this[_0x601f('0x11c')][_0x3db1c6]=new Action(_0x56e2ce,_0x1f94c9,_0x3db1c6);return new BPromise(function(_0x58e936,_0x48146a){if(_['isUndefined'](_0x56e2ce)&&typeof _0x56e2ce!==_0x601f('0x161')){return _0x48146a(msgResponse(_0x601f('0x162'),_0x601f('0x137'),_0x601f('0x163')));}if(_[_0x601f('0x38')](_0x1f94c9['Contact'][_0x601f('0x164')])||_0x1f94c9[_0x601f('0x165')][_0x601f('0x164')]===null){return _0x48146a(msgResponse('originate','Failure',_0x601f('0x166')));}var _0x4ddb06={'XMD-CALLERID':_0x164ba3[_0x601f('0x11c')][_0x3db1c6][_0x601f('0x167')](),'XMD-AGI':_0x56e2ce[_0x601f('0x100')]?util['format'](_0x601f('0x168'),ipAgi,_0x56e2ce[_0x601f('0x100')]):_0x601f('0x169'),'XMD-AGIAFTER':_0x56e2ce['dialQueueProject2']?util['format'](_0x601f('0x168'),ipAgi,_0x56e2ce[_0x601f('0x106')]):_0x601f('0x169'),'XMD-QUEUE':_0x56e2ce[_0x601f('0x47')]===_0x601f('0x16a')?util['format']('\x22%s,%s%s,,,%s\x22',_0x56e2ce['name'],_0x56e2ce[_0x601f('0x16b')]||'',_0x56e2ce['dialAgiAfterHangupAgent']?'c':'',_0x56e2ce[_0x601f('0x10e')]||0x3):_0x601f('0x169'),'XMD-CONTACTID':_0x1f94c9['ContactId'],'XMD-CDRTYPE':_0x601f('0x16c'),'CALLERID(all)':_0x164ba3[_0x601f('0x11c')][_0x3db1c6]['getCaller'](),'XMD-AMD':_0x56e2ce[_0x601f('0xdc')]?'ACTIVE':'NONE','XMD-DESTINATION':_0x601f('0xdb')};if(_0x56e2ce['dialAMDActive']){_0x4ddb06[_0x601f('0x16d')]=_0x56e2ce[_0x601f('0x16e')]||0x9c4;_0x4ddb06[_0x601f('0x16f')]=_0x56e2ce[_0x601f('0x170')]||0x5dc;_0x4ddb06[_0x601f('0x171')]=_0x56e2ce[_0x601f('0x172')]||0x320;_0x4ddb06['XMD-AMDTOTALANALYSISTIME']=_0x56e2ce[_0x601f('0x173')]||0x1388;_0x4ddb06[_0x601f('0x174')]=_0x56e2ce[_0x601f('0x175')]||0x64;_0x4ddb06['XMD-AMDBETWEENWORDSSILENCE']=_0x56e2ce[_0x601f('0x176')]||0x32;_0x4ddb06['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x56e2ce[_0x601f('0x177')]||0x3;_0x4ddb06[_0x601f('0x178')]=_0x56e2ce[_0x601f('0x179')]||0x100;_0x4ddb06[_0x601f('0x17a')]=_0x56e2ce[_0x601f('0x17b')]||0x1388;}if(_0x56e2ce[_0x601f('0x47')]===_0x601f('0x16a')){_0x4ddb06[_0x601f('0x17c')]=_0x1f94c9[_0x601f('0xcd')];}else{_0x4ddb06[_0x601f('0x17d')]=_0x1f94c9[_0x601f('0xce')];}for(var _0x5d5c4f in _0x1f94c9['Contact']){if(typeof _0x1f94c9[_0x601f('0x165')][_0x5d5c4f]!==_0x601f('0x95')){if(isNotNull(_0x1f94c9[_0x601f('0x165')][_0x5d5c4f])&&_0x5d5c4f!=='id'&&_0x5d5c4f!=='tags'&&_0x5d5c4f!=='createdAt'&&_0x5d5c4f!=='updatedAt'){_0x4ddb06[util[_0x601f('0x73')](_0x601f('0x17e'),'XMD-',_[_0x601f('0x17f')](_0x5d5c4f))]=_0x1f94c9[_0x601f('0x165')][_0x5d5c4f];}}}var _0x3baa0e=_0x164ba3[_0x601f('0xd3')](_0x56e2ce[_0x601f('0x72')])?getCallerId(_0x56e2ce[_0x601f('0x72')][_0x601f('0x180')],_0x56e2ce['dialOriginateCallerIdName'],_0x56e2ce[_0x601f('0x181')]>0x0?getCallerIdRandom(_0x56e2ce[_0x601f('0x55')],_0x56e2ce[_0x601f('0x181')]):_0x56e2ce[_0x601f('0x55')]):getCallerId(_[_0x601f('0xa8')](_0x56e2ce[_0x601f('0x133')])?_0x56e2ce[_0x601f('0x72')]['callerid']:_0x56e2ce[_0x601f('0x133')]['callerid'],_0x56e2ce[_0x601f('0x54')],_0x56e2ce[_0x601f('0x181')]>0x0?getCallerIdRandom(_0x56e2ce[_0x601f('0x55')],_0x56e2ce[_0x601f('0x181')]):_0x56e2ce[_0x601f('0x55')]);if(_0x3baa0e){_0x4ddb06[_0x601f('0x182')]=_0x164ba3[_0x601f('0x11c')][_0x3db1c6][_0x601f('0x183')]=extractCalleridName(_0x3baa0e);_0x4ddb06[_0x601f('0x184')]=_0x164ba3[_0x601f('0x11c')][_0x3db1c6][_0x601f('0x185')]=extractCalleridNumber(_0x3baa0e);}return ami[_0x601f('0x140')]({'actionid':_0x3db1c6,'action':_0x601f('0x162'),'channel':_0x164ba3[_0x601f('0xd3')](_0x56e2ce[_0x601f('0x72')])?util[_0x601f('0x73')]('SIP/%s/%s%s',_0x56e2ce[_0x601f('0x72')][_0x601f('0x3a')],isNotNull(_0x56e2ce[_0x601f('0x186')])?_0x56e2ce[_0x601f('0x186')][_0x601f('0x187')]()||'':'',_0x56e2ce[_0x601f('0x188')]>0x0?_0x1f94c9[_0x601f('0x165')][_0x601f('0x164')][_0x601f('0x189')](_0x56e2ce[_0x601f('0x188')]):_0x1f94c9[_0x601f('0x165')][_0x601f('0x164')]):util[_0x601f('0x73')]('SIP/%s/%s%s',_[_0x601f('0xa8')](_0x56e2ce['TrunkBackup'])?_0x56e2ce['Trunk'][_0x601f('0x3a')]:_0x56e2ce[_0x601f('0x133')][_0x601f('0x3a')],isNotNull(_0x56e2ce[_0x601f('0x186')])?_0x56e2ce['dialPrefix'][_0x601f('0x187')]()||'':'',_0x56e2ce['dialCutDigit']>0x0?_0x1f94c9[_0x601f('0x165')]['phone'][_0x601f('0x189')](_0x56e2ce[_0x601f('0x188')]):_0x1f94c9[_0x601f('0x165')][_0x601f('0x164')]),'callerid':_0x3baa0e,'Exten':_0x601f('0xdb'),'Context':_0x601f('0x18a'),'Priority':'1','variable':_0x4ddb06,'timeout':(_0x56e2ce[_0x601f('0x56')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3db1c6})[_0x601f('0xb1')](function(_0x38c0c7){return _0x58e936(_0x38c0c7);})[_0x601f('0xab')](function(_0x4e5a04){_0x56e2ce[_0x601f('0x5f')]+=0x1;var _0x100603=new History(_0x164ba3[_0x601f('0x11c')][_0x3db1c6]);logger['error'](util[_0x601f('0x73')](_0x601f('0x18b'),JSON[_0x601f('0x43')](_0x4e5a04)));_0x100603[_0x601f('0xde')]=0xe;_0x100603[_0x601f('0xa3')]='OriginateError';_0x100603[_0x601f('0xa4')]=moment()['format'](_0x601f('0xf1'));_0x100603[_0x601f('0x114')]=_0x100603[_0x601f('0xa4')];_0x164ba3[_0x601f('0xc3')](_0x100603)[_0x601f('0xab')](loggerCatch('[originate][error]'));_0x164ba3[_0x601f('0xc1')](_0x100603)[_0x601f('0xab')](loggerCatch(_0x601f('0x18c')))[_0x601f('0x19')](function(){delete _0x164ba3[_0x601f('0x11c')][_0x3db1c6];return _0x48146a(msgResponse(_0x601f('0x162'),_0x601f('0x42'),_0x601f('0x18d')));});});});};Dialer[_0x601f('0x17')][_0x601f('0x2b')]=function(_0xe2ef97){var _0x132503=this[_0x601f('0x11c')][_0xe2ef97[_0x601f('0x11d')]];if(_0x132503){delete this[_0x601f('0x11c')][_0xe2ef97[_0x601f('0x11d')]];_0x132503[_0x601f('0x18e')]=moment()[_0x601f('0x73')](_0x601f('0xf1'));var _0x2c47a6=_0x132503[_0x601f('0x47')]===_0x601f('0xac')?this['campaigns'][_0x132503[_0x601f('0xad')]]:this[_0x601f('0x1c')][_0x132503[_0x601f('0x18f')]()];if(!this[_0x601f('0xd1')](_0xe2ef97['response'])){this[_0x601f('0xae')](_0x2c47a6);return this[_0x601f('0x190')](_0x132503,_0x2c47a6,_0xe2ef97)['catch'](loggerCatch(_0x601f('0x191')));}this[_0x601f('0x23')][_0xe2ef97['uniqueid']]=_0x132503;}};Dialer['prototype'][_0x601f('0x192')]=function(_0x1efda9,_0x709e6,_0x1fc499){var _0x4ab07d=new History(_0x709e6);if(_0x4ab07d[_0x601f('0xe6')]+_0x4ab07d[_0x601f('0xf8')]+_0x4ab07d['countnoanswerretry']+_0x4ab07d[_0x601f('0x193')]+_0x4ab07d[_0x601f('0xe7')]+_0x4ab07d[_0x601f('0xfa')]+_0x4ab07d['countmachineretry']+_0x4ab07d['countagentrejectretry']>=_0x1fc499['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x1efda9){case 0x3:if(_0x4ab07d[_0x601f('0xf9')]>=_0x1fc499['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x601f('0xb9')]({'active':![],'countnoanswerretry':_0x4ab07d[_0x601f('0xf9')]+=0x1,'scheduledat':moment()['add'](_0x1fc499[_0x601f('0x194')],_0x601f('0xf0'))['format'](_0x601f('0xf1')),'ContactId':_0x4ab07d[_0x601f('0xcb')],'ListId':_0x4ab07d[_0x601f('0xf2')],'VoiceQueueId':_0x4ab07d[_0x601f('0xcd')]||undefined,'CampaignId':_0x4ab07d[_0x601f('0xce')]||undefined})['catch'](loggerCatch(_0x601f('0x195')));break;case 0x5:if(_0x4ab07d[_0x601f('0xe6')]>=_0x1fc499[_0x601f('0x196')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x4ab07d[_0x601f('0xe6')]+=0x1,'scheduledat':moment()[_0x601f('0xee')](_0x1fc499[_0x601f('0x197')],_0x601f('0xf0'))[_0x601f('0x73')](_0x601f('0xf1')),'ContactId':_0x4ab07d['ContactId'],'ListId':_0x4ab07d[_0x601f('0xf2')],'VoiceQueueId':_0x4ab07d['VoiceQueueId']||undefined,'CampaignId':_0x4ab07d[_0x601f('0xce')]||undefined})[_0x601f('0xab')](loggerCatch(_0x601f('0x198')));break;case 0x8:if(_0x4ab07d[_0x601f('0xf8')]>=_0x1fc499[_0x601f('0x199')]-0x1){return!![];}this[_0x601f('0xb9')]({'active':![],'countcongestionretry':_0x4ab07d[_0x601f('0xf8')]+=0x1,'scheduledat':moment()[_0x601f('0xee')](_0x1fc499[_0x601f('0x19a')],'minutes')[_0x601f('0x73')](_0x601f('0xf1')),'ContactId':_0x4ab07d[_0x601f('0xcb')],'ListId':_0x4ab07d[_0x601f('0xf2')],'VoiceQueueId':_0x4ab07d['VoiceQueueId']||undefined,'CampaignId':_0x4ab07d[_0x601f('0xce')]||undefined})['catch'](loggerCatch(_0x601f('0x19b')));break;case 0x0:if(_0x4ab07d[_0x601f('0x193')]>=_0x1fc499[_0x601f('0x19c')]-0x1){return!![];}else{this[_0x601f('0xb9')]({'active':![],'countnosuchnumberretry':_0x4ab07d[_0x601f('0x193')]+=0x1,'scheduledat':moment()[_0x601f('0xee')](_0x1fc499['dialNoSuchNumberRetryFrequency'],_0x601f('0xf0'))[_0x601f('0x73')](_0x601f('0xf1')),'ContactId':_0x4ab07d[_0x601f('0xcb')],'ListId':_0x4ab07d['ListId'],'VoiceQueueId':_0x4ab07d[_0x601f('0xcd')]||undefined,'CampaignId':_0x4ab07d[_0x601f('0xce')]||undefined})[_0x601f('0xab')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x4ab07d['countdropretry']>=_0x1fc499['dialDropMaxRetry']-0x1){return!![];}this[_0x601f('0xb9')]({'active':![],'countdropretry':_0x4ab07d[_0x601f('0xe7')]+=0x1,'scheduledat':moment()[_0x601f('0xee')](_0x1fc499[_0x601f('0x112')],_0x601f('0xf0'))[_0x601f('0x73')](_0x601f('0xf1')),'ContactId':_0x4ab07d['ContactId'],'ListId':_0x4ab07d[_0x601f('0xf2')],'VoiceQueueId':_0x4ab07d['VoiceQueueId']||undefined,'CampaignId':_0x4ab07d[_0x601f('0xce')]||undefined})['catch'](loggerCatch(_0x601f('0x113')));break;case 0xb:if(_0x4ab07d[_0x601f('0xfa')]>=_0x1fc499[_0x601f('0x119')]-0x1){return!![];}this[_0x601f('0xb9')]({'active':![],'countabandonedretry':_0x4ab07d['countabandonedretry']+=0x1,'scheduledat':moment()[_0x601f('0xee')](_0x1fc499[_0x601f('0x19d')],_0x601f('0xf0'))[_0x601f('0x73')](_0x601f('0xf1')),'ContactId':_0x4ab07d['ContactId'],'ListId':_0x4ab07d['ListId'],'VoiceQueueId':_0x4ab07d[_0x601f('0xcd')]||undefined,'CampaignId':_0x4ab07d[_0x601f('0xce')]||undefined})[_0x601f('0xab')](loggerCatch(_0x601f('0x19e')));break;case 0x13:if(_0x4ab07d['countmachineretry']>=_0x1fc499[_0x601f('0xec')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x4ab07d[_0x601f('0xe8')]+=0x1,'scheduledat':moment()[_0x601f('0xee')](_0x1fc499[_0x601f('0xef')],_0x601f('0xf0'))[_0x601f('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4ab07d[_0x601f('0xcb')],'ListId':_0x4ab07d[_0x601f('0xf2')],'VoiceQueueId':_0x4ab07d[_0x601f('0xcd')]||undefined,'CampaignId':_0x4ab07d[_0x601f('0xce')]||undefined})[_0x601f('0xab')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x4ab07d['countagentrejectretry']>=_0x1fc499[_0x601f('0x19f')]-0x1){return!![];}this[_0x601f('0xb9')]({'active':![],'countagentrejectretry':_0x4ab07d[_0x601f('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x1fc499['dialAgentRejectRetryFrequency'],_0x601f('0xf0'))[_0x601f('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4ab07d['ContactId'],'ListId':_0x4ab07d[_0x601f('0xf2')],'VoiceQueueId':_0x4ab07d[_0x601f('0xcd')]||undefined,'CampaignId':_0x4ab07d[_0x601f('0xce')]||undefined})['catch'](loggerCatch(_0x601f('0x1a0')));break;default:return!![];}};Dialer[_0x601f('0x17')][_0x601f('0x190')]=function(_0x9894d2,_0x34df06,_0x5a43ec){var _0x4c59e7=this;var _0x1eeee1=new History(_0x9894d2);return new BPromise(function(_0x2fdfe4,_0x5f3bea){if(_[_0x601f('0x38')](_0x34df06)&&typeof _0x34df06!==_0x601f('0x161')){return _0x5f3bea(msgResponse('[callProgressDetecting]','Failure','entity\x20is\x20undefine'));}if(_[_0x601f('0x38')](_0x5a43ec)&&typeof _0x5a43ec!==_0x601f('0x161')){return _0x5f3bea(msgResponse(_0x601f('0x1a1'),'Failure',_0x601f('0x1a2')));}switch(_0x5a43ec[_0x601f('0x103')]){case'0':_0x34df06[_0x601f('0x5e')]+=0x1;_0x1eeee1[_0x601f('0xde')]=0x0;_0x1eeee1['statedesc']=_0x601f('0x1a3');_0x1eeee1[_0x601f('0x193')]+=0x1;_0x1eeee1[_0x601f('0xf7')]+=0x1;ami[_0x601f('0x46')](_0x601f('0x1a4'),ut[_0x601f('0x1a5')](_0x9894d2,'nosuchnumber'));_0x4c59e7[_0x601f('0xc3')](_0x1eeee1)[_0x601f('0xab')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4c59e7['checkRetriveMax'](0x0,_0x9894d2,_0x34df06)){if(_0x1eeee1['countnosuchnumberretry']>=_0x34df06[_0x601f('0x19c')]){_0x4c59e7[_0x601f('0xed')](_0x1eeee1,_0x2fdfe4,_0x5f3bea,_0x601f('0x1a6'));}else{_0x4c59e7[_0x601f('0xeb')](_0x1eeee1,_0x2fdfe4,_0x5f3bea,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x34df06[_0x601f('0x5d')]+=0x1;_0x1eeee1['state']=0x3;_0x1eeee1[_0x601f('0xa3')]=_0x601f('0x1a7');_0x1eeee1[_0x601f('0xf9')]+=0x1;_0x1eeee1[_0x601f('0xf7')]+=0x1;ami[_0x601f('0x46')](_0x601f('0x1a8'),ut[_0x601f('0x1a5')](_0x9894d2,_0x601f('0x1a9')));_0x4c59e7[_0x601f('0xc3')](_0x1eeee1)[_0x601f('0xab')](loggerCatch(_0x601f('0x1aa')));if(_0x4c59e7['checkRetriveMax'](0x3,_0x9894d2,_0x34df06)){if(_0x1eeee1[_0x601f('0xf9')]>=_0x34df06[_0x601f('0x1ab')]){_0x4c59e7[_0x601f('0xed')](_0x1eeee1,_0x2fdfe4,_0x5f3bea,_0x601f('0x1ac'));}else{_0x4c59e7['stateGlobal'](_0x1eeee1,_0x2fdfe4,_0x5f3bea,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x34df06[_0x601f('0x5a')]+=0x1;_0x1eeee1['state']=0x5;_0x1eeee1[_0x601f('0xa3')]=_0x601f('0x1ad');_0x1eeee1[_0x601f('0xe6')]+=0x1;_0x1eeee1[_0x601f('0xf7')]+=0x1;ami['emit'](_0x601f('0x1ae'),ut[_0x601f('0x1a5')](_0x9894d2,_0x601f('0x1af')));_0x4c59e7[_0x601f('0xc3')](_0x1eeee1)['catch'](loggerCatch(_0x601f('0x1b0')));if(_0x4c59e7[_0x601f('0x192')](0x5,_0x9894d2,_0x34df06)){if(_0x1eeee1[_0x601f('0xe6')]>=_0x34df06['dialBusyMaxRetry']){_0x4c59e7[_0x601f('0xed')](_0x1eeee1,_0x2fdfe4,_0x5f3bea,_0x601f('0x1b1'));}else{_0x4c59e7['stateGlobal'](_0x1eeee1,_0x2fdfe4,_0x5f3bea,_0x601f('0x1b1'));}}break;case'8':_0x34df06[_0x601f('0x5b')]+=0x1;_0x1eeee1['state']=0x8;_0x1eeee1[_0x601f('0xa3')]=_0x601f('0x1b2');_0x1eeee1[_0x601f('0xf8')]+=0x1;_0x1eeee1['countglobal']+=0x1;ami['emit'](_0x601f('0x1b3'),ut[_0x601f('0x1a5')](_0x9894d2,'congestion'));_0x4c59e7[_0x601f('0xc3')](_0x1eeee1)[_0x601f('0xab')](loggerCatch(_0x601f('0x1b4')));if(_0x4c59e7['checkRetriveMax'](0x8,_0x9894d2,_0x34df06)){if(_0x1eeee1[_0x601f('0xf8')]>=_0x34df06[_0x601f('0x199')]){_0x4c59e7[_0x601f('0xed')](_0x1eeee1,_0x2fdfe4,_0x5f3bea,_0x601f('0x1b5'));}else{_0x4c59e7[_0x601f('0xeb')](_0x1eeee1,_0x2fdfe4,_0x5f3bea,_0x601f('0x1b5'));}}break;case'11':_0x34df06[_0x601f('0x1b6')]+=0x1;_0x1eeee1['state']=0xb;_0x1eeee1[_0x601f('0xa3')]=_0x601f('0x117');_0x1eeee1[_0x601f('0xfa')]+=0x1;_0x1eeee1[_0x601f('0xf7')]+=0x1;_0x4c59e7[_0x601f('0xc3')](_0x1eeee1)[_0x601f('0xab')](loggerCatch(_0x601f('0x11b')));if(_0x4c59e7[_0x601f('0x192')](0xb,_0x9894d2,_0x34df06)){if(_0x1eeee1['countabandonedretry']>=_0x34df06[_0x601f('0x119')]){_0x4c59e7[_0x601f('0xed')](_0x1eeee1,_0x2fdfe4,_0x5f3bea,'reason\x2011\x20abandoned');}else{_0x4c59e7[_0x601f('0xeb')](_0x1eeee1,_0x2fdfe4,_0x5f3bea,_0x601f('0x1b7'));}}break;case'20':_0x34df06[_0x601f('0x61')]+=0x1;_0x1eeee1[_0x601f('0xde')]=0x14;_0x1eeee1[_0x601f('0xa3')]='AgentReject';_0x1eeee1[_0x601f('0xe9')]+=0x1;_0x1eeee1[_0x601f('0xf7')]+=0x1;ami[_0x601f('0x46')]('custom:agentreject',ut[_0x601f('0x1a5')](_0x9894d2,'agentreject'));_0x4c59e7[_0x601f('0xc3')](_0x1eeee1)[_0x601f('0xab')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x4c59e7['checkRetriveMax'](0x14,_0x9894d2,_0x34df06)){if(_0x1eeee1[_0x601f('0xe9')]>=_0x34df06[_0x601f('0x19f')]){_0x4c59e7[_0x601f('0xed')](_0x1eeee1,_0x2fdfe4,_0x5f3bea,'reason\x2020\x20agentreject');}else{_0x4c59e7[_0x601f('0xeb')](_0x1eeee1,_0x2fdfe4,_0x5f3bea,_0x601f('0x1b8'));}}break;default:_0x34df06['outboundUnknownCallsDay']+=0x1;_0x1eeee1[_0x601f('0xde')]=0xc;_0x1eeee1[_0x601f('0xa3')]=_0x5a43ec[_0x601f('0x103')];_0x4c59e7[_0x601f('0xc3')](_0x1eeee1)[_0x601f('0xab')](loggerCatch(_0x601f('0x1b9')));if(_0x4c59e7[_0x601f('0x192')](_0x5a43ec[_0x601f('0x103')],_0x9894d2,_0x34df06)){if(_0x1eeee1[_0x601f('0xe6')]+_0x1eeee1[_0x601f('0xf8')]+_0x1eeee1[_0x601f('0xf9')]+_0x1eeee1[_0x601f('0x193')]+_0x1eeee1[_0x601f('0xe7')]+_0x1eeee1[_0x601f('0xfa')]+_0x1eeee1[_0x601f('0xe8')]+_0x1eeee1[_0x601f('0xe9')]>=_0x34df06[_0x601f('0xea')]){_0x4c59e7[_0x601f('0xeb')](_0x1eeee1,_0x2fdfe4,_0x5f3bea,_0x5a43ec[_0x601f('0x103')]);}else{_0x4c59e7['createStateFinal'](_0x1eeee1,_0x2fdfe4,_0x5f3bea,_0x5a43ec[_0x601f('0x103')]);}}}});};Dialer[_0x601f('0x17')][_0x601f('0xeb')]=function(_0x57c5a6,_0x398916,_0x122031,_0x53cb18){var _0xb12325=new Final(_0x57c5a6);_0xb12325[_0x601f('0xde')]=0xf;_0xb12325[_0x601f('0xa3')]=_0x601f('0x1ba');this['createStateFinal'](_0xb12325,_0x398916,_0x122031,_0x53cb18);};Dialer['prototype'][_0x601f('0xed')]=function(_0x22d388,_0x3478d4,_0x10480e,_0x1db639){this[_0x601f('0xc1')](_0x22d388)[_0x601f('0xb1')](function(){return _0x3478d4(msgResponse(_0x601f('0x1a1'),_0x601f('0xd2'),_0x1db639));})[_0x601f('0xab')](function(){return _0x10480e(msgResponse(_0x601f('0x1bb'),'Failure',_0x601f('0x1bc')));});};Dialer[_0x601f('0x17')]['predictive']=function(_0x579620){var _0x5e23b8=_0x579620['dialPredictiveOptimizationPercentage']/0x64;var _0x5a609f=_0x579620[_0x601f('0x5c')]/(_0x579620[_0x601f('0x5c')]+_0x579620[_0x601f('0x58')]);var _0x34ca5b=Math[_0x601f('0x1bd')](_0x579620[_0x601f('0x6b')]*(_0x579620[_0x601f('0x1be')]/0x64));var _0x3c16b7=Math[_0x601f('0x1bd')](_0x579620[_0x601f('0x6b')]*(_0x579620['predictiveIntervalMinThreshold']/0x64));var _0x431bab=_0x579620[_0x601f('0x49')]+_0x579620[_0x601f('0x4e')];var _0x3c70be=Math[_0x601f('0x1bf')](_0x579620[_0x601f('0x6e')]*_0x579620[_0x601f('0x70')]*_0x579620[_0x601f('0x1c0')]*_0x579620[_0x601f('0x69')]);if(_[_0x601f('0x38')](_0x579620[_0x601f('0x25')])){if(!_[_0x601f('0x38')](_0x579620[_0x601f('0x24')])){_0x579620[_0x601f('0x24')]=undefined;loggerPredictive[_0x601f('0x93')](_0x601f('0x1c1'),_0x601f('0x1c2'));}if(!_['isUndefined'](_0x579620[_0x601f('0x8e')])){loggerPredictive[_0x601f('0x93')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x579620['handlePredictive']);_0x579620['handlePredictive']=undefined;}_0x579620['startProgressive']=moment()['format'](_0x601f('0xf1'));loggerPredictive[_0x601f('0x79')](_0x579620[_0x601f('0x3a')],_0x601f('0x1c3'),_0x579620[_0x601f('0x25')]);this[_0x601f('0x149')](_0x579620,0x1);}else if(ifInterval(_0x579620['dialPredictiveInterval'],_0x579620[_0x601f('0x25')])){this[_0x601f('0x149')](_0x579620,0x1);loggerPredictiveCalls[_0x601f('0x79')](_0x601f('0x1c4'),_0x579620[_0x601f('0x25')],_0x579620[_0x601f('0x3a')]);_0x579620[_0x601f('0x6e')]=0x0;_0x579620[_0x601f('0x68')]=0x0;}else if(_0x5e23b8<_0x5a609f&&_0x579620['dialPredictiveOptimization']===_0x601f('0x1c5')){freeVariablesPredictive(_0x579620);loggerPredictive[_0x601f('0x79')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x601f('0x1c6'),_0x5a609f,'startProgressive',_0x579620['name']);}else if(_0x3c70be<_0x579620[_0x601f('0x68')]&&_0x579620[_0x601f('0x1c7')]===_0x601f('0x1c5')){freeVariablesPredictive(_0x579620);loggerPredictive[_0x601f('0x79')](_0x601f('0x1c8'),'Max\x20Drop\x20',_0x3c70be,_0x601f('0x1c9'),_0x579620[_0x601f('0x68')],'startProgressive',_0x579620[_0x601f('0x3a')]);}else if(!ifInterval(_0x579620[_0x601f('0x1ca')],_0x579620[_0x601f('0x25')])&&_[_0x601f('0x38')](_0x579620[_0x601f('0x24')])&&!_[_0x601f('0x38')](_0x579620[_0x601f('0x25')])){_0x579620['startPredictive']=moment()[_0x601f('0x73')](_0x601f('0xf1'));loggerPredictive['info'](_0x579620[_0x601f('0x3a')],_0x601f('0x1cb'),_0x579620[_0x601f('0x24')]);this[_0x601f('0xb6')](_0x579620[_0x601f('0x1ca')])[_0x601f('0xb1')](this['getDataPredictive'](_0x579620))[_0x601f('0xb1')](mergeDataErlangB(_0x579620))['then'](this[_0x601f('0x1cc')](_0x579620))[_0x601f('0xab')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x579620));}else if(!ifInterval(_0x579620[_0x601f('0x1ca')],_0x579620[_0x601f('0x24')])){_0x579620[_0x601f('0x68')]=0x0;_0x579620[_0x601f('0x24')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x579620['name'],'recalculate\x20predictive\x20at',_0x579620[_0x601f('0x24')]);clearInterval(_0x579620['handlePredictive']);_0x579620[_0x601f('0x8e')]=undefined;this[_0x601f('0xb6')](_0x579620['dialPredictiveInterval'])[_0x601f('0xb1')](this[_0x601f('0x1cd')](_0x579620))[_0x601f('0xb1')](mergeDataErlangB(_0x579620))[_0x601f('0xb1')](this[_0x601f('0x1cc')](_0x579620))['catch'](loggerCatchPredictive(_0x601f('0x1ce'),_0x579620));}else if(_0x579620['predictiveIntervalAvailable']&&_0x431bab<_0x579620[_0x601f('0x6b')]-_0x3c16b7){freeVariablesPredictive(_0x579620);loggerPredictive[_0x601f('0x79')](_0x579620['name'],_0x601f('0x1cf'),_0x431bab,')\x20are\x20less\x20than\x20threshold\x20(',_0x579620[_0x601f('0x6b')],'-',_0x3c16b7,'=',_0x579620[_0x601f('0x6b')]-_0x3c16b7,')');}else if(_0x579620[_0x601f('0x6b')]&&_0x431bab>_0x579620[_0x601f('0x6b')]+_0x34ca5b){freeVariablesPredictive(_0x579620);loggerPredictive[_0x601f('0x79')](_0x579620['name'],_0x601f('0x1cf'),_0x431bab,_0x601f('0x1d0'),_0x579620['predictiveIntervalAvailable'],'+',_0x34ca5b,'=',_0x579620['predictiveIntervalAvailable']+_0x34ca5b,')');}};Dialer['prototype'][_0x601f('0x1cd')]=function(_0x3c4f88){var _0x2459a9=this;return function(_0xd47773){return new BPromise(function(_0x1a7428,_0x2fa1e4){_[_0x601f('0x8b')](_0x3c4f88,_0xd47773[0x0]);if(checkGetDataPredictive(_0xd47773[0x0])){var _0x4851fe=_0x3c4f88[_0x601f('0x6b')]=_0x3c4f88[_0x601f('0x4e')]+_0x3c4f88[_0x601f('0x49')];var _0x29eb42=_0x3c4f88[_0x601f('0x1ca')]*0x3c;var _0x2f259c=_0xd47773[0x0][_0x601f('0x81')]+_0xd47773[0x0][_0x601f('0x64')];var _0x2fb8f9=(_0xd47773[0x0]['predictiveIntervalAnsweredCalls']+_0xd47773[0x0][_0x601f('0x66')]+_0xd47773[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xd47773[0x0]['predictiveIntervalTotalCalls'];_0x3c4f88[_0x601f('0x1c0')]=_0x2fb8f9>0x0?_0x2fb8f9:0x1;switch(_0x3c4f88[_0x601f('0x1c7')]){case _0x601f('0x1c5'):var _0x3bf33f=_0x3c4f88[_0x601f('0x1d1')]/0x64;return _0x2459a9[_0x601f('0x1d2')](_0x4851fe,_0x29eb42,_0x2f259c,_0x2fb8f9,_0x3bf33f)['then'](function(_0x2a7be4){return _0x1a7428(_0x2a7be4);});case _0x601f('0x1d3'):var _0x36e434=_0x3c4f88[_0x601f('0x1d1')]/0x64;return _0x2459a9['busyFactor'](_0x4851fe,_0x29eb42,_0x2f259c,_0x2fb8f9,_0x36e434)[_0x601f('0xb1')](function(_0x3d54d2){return _0x1a7428(_0x3d54d2);});default:return _0x2fa1e4(msgResponse(_0x601f('0x1d4'),'Failure',_0x601f('0x1d5')));}}else{return _0x2fa1e4(msgResponse('[getDataPredictive]',_0x601f('0x137'),'check\x20failure'));}});};};Dialer[_0x601f('0x17')]['getDataPredictiveOld']=function(_0x311f0e){var _0x5c0bbd=this;return function(_0xf09d34){return new BPromise(function(_0x142426,_0x50ba38){_['merge'](_0x311f0e,_0xf09d34[0x0]);if(checkGetDataPredictive(_0xf09d34[0x0])){loggerPredictive[_0x601f('0x79')](JSON[_0x601f('0x43')](_0xf09d34[0x0]));if(_0x311f0e['dialPredictiveOptimization']===_0x601f('0x1c5')){return _0x5c0bbd[_0x601f('0x1d6')](_0x311f0e['id'])[_0x601f('0xb1')](function(_0x3d9be2){var _0x2763c4=_0x311f0e[_0x601f('0x152')]-_0x3d9be2[0x0][_0x601f('0x1d7')];var _0x375f07=_0x311f0e['dialPredictiveInterval']*0x3c;var _0x21306c=_0xf09d34[0x0][_0x601f('0x81')]+_0xf09d34[0x0][_0x601f('0x64')];var _0xca68f1=(_0xf09d34[0x0][_0x601f('0x63')]+_0xf09d34[0x0][_0x601f('0x66')]+_0xf09d34[0x0][_0x601f('0x65')])/_0xf09d34[0x0][_0x601f('0x6c')];var _0x2d15b7=_0x311f0e[_0x601f('0x1d1')]/0x64;_0x311f0e[_0x601f('0x6a')]=_0x3d9be2[0x0]['outboundQueuePauses']||0x0;_0x311f0e['predictiveIntervalHitRate']=_0xca68f1>0x0?_0xca68f1:0x1;return _0x5c0bbd[_0x601f('0x1d2')](_0x2763c4,_0x375f07,_0x21306c,_0xca68f1,_0x2d15b7);})[_0x601f('0xb1')](function(_0x12274e){return _0x142426(_0x12274e);})[_0x601f('0xab')](function(_0xff825c){return _0x50ba38(msgResponse(_0x601f('0x1d8'),_0x601f('0x137'),JSON[_0x601f('0x43')](_0xff825c)));});}if(_0x311f0e[_0x601f('0x1c7')]===_0x601f('0x1d3')){return _0x5c0bbd[_0x601f('0x1d6')](_0x311f0e['id'])[_0x601f('0xb1')](function(_0x291f28){var _0x401a6d=_0x311f0e[_0x601f('0x152')]-_0x291f28[0x0][_0x601f('0x1d7')];var _0x326e5e=_0x311f0e[_0x601f('0x1ca')]*0x3c;var _0x12b2ae=_0xf09d34[0x0][_0x601f('0x81')]+_0xf09d34[0x0]['predictiveIntervalAvgHoldtime'];var _0x50c6cc=(_0xf09d34[0x0][_0x601f('0x63')]+_0xf09d34[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xf09d34[0x0][_0x601f('0x65')])/_0xf09d34[0x0][_0x601f('0x6c')];var _0x1924c7=_0x311f0e[_0x601f('0x1d1')]/0x64;_0x311f0e[_0x601f('0x6a')]=_0x291f28[0x0][_0x601f('0x1d7')]||0x0;_0x311f0e[_0x601f('0x1c0')]=_0x50c6cc>0x0?_0x50c6cc:0x1;return _0x5c0bbd[_0x601f('0x1d9')](_0x401a6d,_0x326e5e,_0x12b2ae,_0x50c6cc,_0x1924c7);})[_0x601f('0xb1')](function(_0x38813a){return _0x142426(_0x38813a);})[_0x601f('0xab')](function(_0xc21b53){return _0x50ba38(msgResponse('[CatchErlangB]','Failure',JSON[_0x601f('0x43')](_0xc21b53)));});}}else{return _0x50ba38(msgResponse(_0x601f('0x1d4'),_0x601f('0x137'),_0x601f('0x1da')));}});};};Dialer[_0x601f('0x17')][_0x601f('0x1cc')]=function(_0x50568c){var _0x36a51b=this;return function(){var _0x162ae5=0x0;var _0x340002=Math[_0x601f('0x1bf')](_0x50568c[_0x601f('0x6f')]*0x3e8);if(_0x340002>0x0){_0x340002=_0x340002<0x64?0x64:_0x340002;loggerPredictive[_0x601f('0x79')](_0x50568c[_0x601f('0x3a')],'one\x20call\x20every:',_0x340002,'milliseconds');_0x50568c[_0x601f('0x8e')]=setInterval(function(){_0x36a51b['handlePredictive'](_0x50568c);loggerPredictiveCalls[_0x601f('0x79')]('[handlePredictive]',_0x162ae5+=0x1);},_0x340002);}else{loggerPredictive[_0x601f('0x79')](_0x50568c[_0x601f('0x3a')],_0x601f('0x1db'));}};};Dialer[_0x601f('0x17')][_0x601f('0x1dc')]=function(_0x3018b1,_0xb8bab5){var _0x369512=this;return function(_0x446bee){if(_['isEmpty'](_0x446bee)){if(_['isNil'](_0xb8bab5[_0x601f('0xcc')])||!_0xb8bab5[_0x601f('0x1dd')]){if(_0x3018b1[_0x601f('0x53')]===_0x601f('0x14d')){_0x3018b1['queueStatusComplete']=_[_0x601f('0x38')](_0x3018b1[_0x601f('0x125')])?!![]:_0x3018b1[_0x601f('0x125')];var _0x1c6253=uuid['v4']();_0x369512['actions'][_0x1c6253]=new Action(_0x3018b1,_0xb8bab5,_0x1c6253);loggerBooked[_0x601f('0x79')]('[booked][checkContactBlack]',_0x1c6253,_0x601f('0x1de'),JSON[_0x601f('0x43')](_0x3018b1[_0x601f('0x125')]),'Queue:\x20',_0x3018b1[_0x601f('0x3a')]);if(_0x3018b1[_0x601f('0x125')]){_0x3018b1[_0x601f('0x125')]=![];_0x369512[_0x601f('0x122')][_0x369512['actions'][_0x1c6253]['queue']]=[];ami['Action']({'actionid':_0x1c6253,'action':'queuestatus','queue':_0x3018b1['name']})[_0x601f('0xab')](function(){_0x369512[_0x601f('0xae')](_0x3018b1);_0x369512['rescheduleContact']({'active':![],'ContactId':_0x369512[_0x601f('0x11c')][_0x1c6253][_0x601f('0xcb')],'ListId':_0x369512[_0x601f('0x11c')][_0x1c6253][_0x601f('0xf2')],'VoiceQueueId':_0x369512[_0x601f('0x11c')][_0x1c6253][_0x601f('0xcd')]||undefined,'CampaignId':_0x369512[_0x601f('0x11c')][_0x1c6253][_0x601f('0xce')]||undefined})[_0x601f('0xab')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x369512['actions'][_0x1c6253];});}else{loggerBooked[_0x601f('0x79')](_0x601f('0x1df'),JSON[_0x601f('0x43')](_0x3018b1[_0x601f('0x125')]),_0x601f('0x1e0'),_0x3018b1[_0x601f('0x3a')]);_0x369512[_0x601f('0xae')](_0x3018b1);_0x369512['rescheduleContact']({'active':![],'ContactId':_0x369512[_0x601f('0x11c')][_0x1c6253][_0x601f('0xcb')],'ListId':_0x369512['actions'][_0x1c6253][_0x601f('0xf2')],'VoiceQueueId':_0x369512['actions'][_0x1c6253][_0x601f('0xcd')]||undefined,'CampaignId':_0x369512[_0x601f('0x11c')][_0x1c6253]['CampaignId']||undefined})['catch'](loggerCatch(_0x601f('0x1e1')));delete _0x369512[_0x601f('0x11c')][_0x1c6253];}}else{return _0x369512['actionOriginate'](_0x3018b1,_0xb8bab5);}}else{if(getDiff(_0xb8bab5[_0x601f('0x1e2')])<_0x3018b1[_0x601f('0x1e3')]*0x3c){if(_0xb8bab5['Agent']&&!_0xb8bab5['Agent'][_0x601f('0x1e4')]){_0x369512[_0x601f('0x1b')][_0x601f('0x127')](_0xb8bab5['id'])[_0x601f('0x19')](function(){_0x369512[_0x601f('0xae')](_0x3018b1);});}else{_0x369512[_0x601f('0xbb')]({'active':![]},_0xb8bab5['id'],0x1)[_0x601f('0x19')](function(){_0x369512[_0x601f('0xae')](_0x3018b1);});}}else{_0x3018b1['outboundReCallsDay']+=0x1;_0x369512[_0x601f('0xae')](_0x3018b1);if(_0x3018b1[_0x601f('0x1e5')]){_0x369512[_0x601f('0xb9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xb8bab5[_0x601f('0xcb')],'ListId':_0xb8bab5[_0x601f('0xf2')],'VoiceQueueId':_0xb8bab5[_0x601f('0xcd')]||undefined,'CampaignId':_0xb8bab5[_0x601f('0xce')]||undefined})[_0x601f('0xab')](loggerCatch(_0x601f('0x1e6')));_0x369512[_0x601f('0xc3')](createObjHistory(_0x3018b1,_0xb8bab5,'RECALLINQUEUE',0x17,_0x601f('0x1e7')))[_0x601f('0xab')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x369512[_0x601f('0xc9')](createObjHistory(_0x3018b1,_0xb8bab5,_0x601f('0x1e8'),0x16,_0x601f('0x1e9')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x3018b1[_0x601f('0x59')]+=0x1;_0x369512[_0x601f('0xc9')](createObjHistory(_0x3018b1,_0xb8bab5,_0x601f('0x1ea'),0xd,_0x601f('0x1eb')),_0x601f('0x1ec'),_0x601f('0x1ed'));throw'inBlackList';}};};Dialer[_0x601f('0x17')]['handleIvr']=function(_0x521f86){var _0x2c7b88=this;var _0x40db24=_0x521f86['limitCalls']-_0x521f86[_0x601f('0x6d')]-_0x521f86[_0x601f('0x1ee')];emitCampaignSummary(_0x521f86);if(_0x40db24>0x0){if(_0x40db24>this[_0x601f('0x20')]){_0x40db24=this[_0x601f('0x20')];}_0x521f86['temp']+=_0x40db24;this[_0x601f('0xbf')](_0x521f86['id'],_0x40db24,_0x521f86['dialOrderByScheduledAt'])['then'](function(_0x6c711b){_0x521f86['temp']-=_0x40db24;_0x521f86[_0x601f('0x1ee')]=_0x521f86[_0x601f('0x1ee')]>0x0?_0x521f86[_0x601f('0x1ee')]:0x0;if(!checkContactEmpty(_0x6c711b)){_0x521f86['message']=_0x601f('0x9c');logger[_0x601f('0x79')](_0x601f('0x1ef')+_0x521f86['name']);}else{_0x521f86[_0x601f('0x6d')]+=_0x6c711b[_0x601f('0x94')];_0x521f86['message']=_0x601f('0x1f0');for(var _0x50f3b4=0x0;_0x50f3b4<_0x6c711b['length'];_0x50f3b4+=0x1){_0x521f86[_0x601f('0x1f1')]+=0x1;if(_[_0x601f('0xa8')](_0x6c711b[_0x50f3b4])||_[_0x601f('0xa8')](_0x6c711b[_0x50f3b4][_0x601f('0x165')])||_['isNil'](_0x6c711b[_0x50f3b4][_0x601f('0x165')][_0x601f('0x164')])){_0x2c7b88[_0x601f('0x1f2')](_0x601f('0x1f3'),_0x521f86,_0x6c711b[_0x50f3b4]);}else{_0x2c7b88[_0x601f('0xb4')](_[_0x601f('0xca')](_0x6c711b[_0x50f3b4],['CampaignId',_0x601f('0x1f4')]))[_0x601f('0xb1')](_0x2c7b88[_0x601f('0x1dc')](_0x521f86,_0x6c711b[_0x50f3b4]))['catch'](_0x2c7b88['loggerHandler'](_0x601f('0x1f5'),_0x521f86));}}}})[_0x601f('0xab')](loggerGetContactDialer(_0x601f('0x1f6'),_0x521f86,_0x40db24));}};Dialer[_0x601f('0x17')][_0x601f('0x149')]=function(_0x4182b1,_0x505710){var _0x5123af=this;var _0x1cb9df=[];var _0x3e3d18=_0x505710>=0x1?_0x505710:0x1;if(_0x4182b1[_0x601f('0x53')]===_0x601f('0x14d')){_0x3e3d18=0x1;}var _0x473e19=Math[_0x601f('0x1bf')](_0x4182b1[_0x601f('0x49')]*_0x3e3d18)-_0x4182b1[_0x601f('0x6d')]-_0x4182b1[_0x601f('0x1ee')];emitVoiceQueueSummary(_0x4182b1);if(_0x4182b1['dialLimitQueue']>0x0){var _0x44398d=_0x4182b1['dialLimitQueue']-_0x4182b1['originated']-_0x4182b1[_0x601f('0x4e')]-_0x4182b1[_0x601f('0x1ee')]-_0x4182b1[_0x601f('0x4a')];if(_0x473e19>_0x44398d){_0x473e19=_0x44398d;}}if(_0x473e19>0x0){if(_0x4182b1[_0x601f('0x53')]===_0x601f('0x14d')){_0x473e19=0x1;}if(_0x473e19>this[_0x601f('0x20')]){_0x473e19=this[_0x601f('0x20')];}_0x4182b1[_0x601f('0x1ee')]+=_0x473e19;for(var _0x2a98fa in this[_0x601f('0x1e')]){if(typeof this['agents'][_0x2a98fa]!==_0x601f('0x95')){if(this[_0x601f('0x1e')][_0x2a98fa][_0x601f('0xde')]===_0x601f('0x1f7')&&this[_0x601f('0x1e')][_0x2a98fa][_0x601f('0xa9')]===_0x601f('0xd6')){_0x1cb9df['push'](this[_0x601f('0x1e')][_0x2a98fa]['id']);}}}this[_0x601f('0xbd')](_0x4182b1['id'],_0x1cb9df,_0x473e19,_0x4182b1[_0x601f('0x1f8')])['then'](function(_0x3a9d74){_0x4182b1[_0x601f('0x1ee')]-=_0x473e19;_0x4182b1[_0x601f('0x1ee')]=_0x4182b1[_0x601f('0x1ee')]>0x0?_0x4182b1['temp']:0x0;if(!checkContactEmpty(_0x3a9d74)){_0x5123af[_0x601f('0xaf')](_0x4182b1)[_0x601f('0xb1')](sendMessageReschedule(_0x4182b1))[_0x601f('0xab')](loggerCatch(_0x601f('0xb2')));}else{_0x4182b1['originated']+=_0x3a9d74[_0x601f('0x94')];_0x4182b1[_0x601f('0x39')]=_0x4182b1[_0x601f('0x53')]===_0x601f('0x14d')?_0x601f('0x1f9'):_0x601f('0x1f0');for(var _0x48a4d4=0x0;_0x48a4d4<_0x3a9d74[_0x601f('0x94')];_0x48a4d4+=0x1){if(_[_0x601f('0xa8')](_0x3a9d74[_0x48a4d4])||_[_0x601f('0xa8')](_0x3a9d74[_0x48a4d4]['Contact'])||_[_0x601f('0xa8')](_0x3a9d74[_0x48a4d4][_0x601f('0x165')][_0x601f('0x164')])){_0x5123af[_0x601f('0x1f2')]('[actionOriginate]\x20',_0x4182b1,_0x3a9d74[_0x48a4d4]);}else{_0x5123af[_0x601f('0xb3')](_['pick'](_0x3a9d74[_0x48a4d4],[_0x601f('0xcd'),_0x601f('0x1f4')]))[_0x601f('0xb1')](_0x5123af[_0x601f('0x1dc')](_0x4182b1,_0x3a9d74[_0x48a4d4]))[_0x601f('0xab')](_0x5123af['loggerHandler']('[actionOriginate]\x20',_0x4182b1));}}}})[_0x601f('0xab')](loggerGetContactDialer(_0x601f('0x1fa'),_0x4182b1,_0x473e19));}};Dialer[_0x601f('0x17')][_0x601f('0x8e')]=function(_0x2a2184){if(_0x2a2184['dialLimitQueue']>0x0){var _0x1340a8=_0x2a2184[_0x601f('0x1fb')]-_0x2a2184[_0x601f('0x6d')]-_0x2a2184['talking'];if(_0x1340a8>0x0){this[_0x601f('0x1fc')](_0x2a2184);}else{loggerPredictiveCalls[_0x601f('0x79')](_0x601f('0x1fd'));}}else{this[_0x601f('0x1fc')](_0x2a2184);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x1696a7){var _0x172639=this;var _0x5e75cd=[];_0x1696a7[_0x601f('0x6d')]+=0x1;for(var _0x3e6bba in this[_0x601f('0x1e')]){if(typeof this['agents'][_0x3e6bba]!==_0x601f('0x95')){if(this['agents'][_0x3e6bba]['state']===_0x601f('0x1f7')&&this['agents'][_0x3e6bba]['status']===_0x601f('0xd6')){_0x5e75cd[_0x601f('0x123')](this[_0x601f('0x1e')][_0x3e6bba]['id']);}}}this['getContactDialer'](_0x1696a7['id'],_0x5e75cd,0x1,_0x1696a7[_0x601f('0x1f8')])[_0x601f('0xb1')](function(_0x24740d){if(!checkContactEmpty(_0x24740d)){checkContactLowerLimitOriginate(_0x1696a7,0x1,0x0);_0x172639['countReScheduled'](_0x1696a7)[_0x601f('0xb1')](sendMessageReschedule(_0x1696a7))[_0x601f('0xab')](loggerCatch('[countReScheduled]\x20'));}else{_0x1696a7[_0x601f('0x39')]=_0x601f('0x1f0');if(_['isNil'](_0x24740d[0x0])||_[_0x601f('0xa8')](_0x24740d[0x0][_0x601f('0x165')])||_['isNil'](_0x24740d[0x0]['Contact'][_0x601f('0x164')])){_0x172639[_0x601f('0x1f2')](_0x601f('0x1f3'),_0x1696a7,_0x24740d[0x0]);}else{_0x172639['checkIsBlackList'](_['pick'](_0x24740d[0x0],['VoiceQueueId',_0x601f('0x1f4')]))[_0x601f('0xb1')](_0x172639[_0x601f('0x1dc')](_0x1696a7,_0x24740d[0x0]))[_0x601f('0xab')](_0x172639[_0x601f('0xc7')](_0x601f('0x1fe'),_0x1696a7));}}})[_0x601f('0xab')](loggerGetContactDialer(_0x601f('0x1ff'),_0x1696a7,0x1));emitVoiceQueueSummary(_0x1696a7);};Dialer[_0x601f('0x17')][_0x601f('0x1d2')]=function(_0x4de0da,_0x59f38e,_0x344f09,_0x3a17a3,_0x301988,_0xa17319){loggerPredictive[_0x601f('0x79')](_0x601f('0x200'));loggerPredictive[_0x601f('0x79')](_0x601f('0x201'),_0x4de0da);loggerPredictive['info'](_0x601f('0x202'),_0x59f38e);loggerPredictive[_0x601f('0x79')](_0x601f('0x203'),_0x344f09);loggerPredictive['info'](_0x601f('0x204'),_0x3a17a3);loggerPredictive[_0x601f('0x79')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x301988);loggerPredictive[_0x601f('0x79')](_0x601f('0x80'));return new BPromise(function(_0x22f8b7,_0xd63a41){if(_0x4de0da<=0x0||isNaN(_0x4de0da)){return _0xd63a41(msgResponse(_0x601f('0x205'),_0x601f('0x42'),_0x601f('0x206')+_0x4de0da));}if(_0x344f09<=0x0||isNaN(_0x344f09)){return _0xd63a41(msgResponse(_0x601f('0x205'),_0x601f('0x42'),'Ts\x20=\x20'+_0x344f09));}if(_0x3a17a3<=0x0||isNaN(_0x3a17a3)){return _0xd63a41(msgResponse(_0x601f('0x205'),'Error','p\x20=\x20'+_0x3a17a3));}if(_0x59f38e<=0x0||isNaN(_0x59f38e)){return _0xd63a41(msgResponse('[abandonmentRate]',_0x601f('0x42'),_0x601f('0x207')+_0x59f38e));}if(_0x301988<=0x0||isNaN(_0x301988)){return _0xd63a41(msgResponse(_0x601f('0x205'),_0x601f('0x42'),'Amax\x20=\x20'+_0x301988));}_0xa17319=_0xa17319||0x0;var _0x24be8d=0x1/_0x344f09;var _0x45243e=0x0;var _0x177a6c=0x0;var _0x5a7ece=0x0;var _0x559aed=0x0;for(var _0x26ac11=0x0;_0x5a7ece<_0x301988;_0x26ac11+=0x1){_0x177a6c=_0x26ac11/_0x59f38e;_0x45243e=(_0x3a17a3*_0x177a6c+_0xa17319)/_0x24be8d;_0x5a7ece=erlangb(_0x45243e,_0x4de0da);_0x559aed=_0x45243e/_0x4de0da*(0x1-erlangb(_0x45243e,_0x4de0da));}return _0x22f8b7({'erlangCalls':_0x26ac11,'erlangCallToSecond':_0x59f38e/_0x26ac11,'erlangAbandonmentRate':_0x5a7ece,'erlangBusyFactor':_0x559aed});});};Dialer[_0x601f('0x17')][_0x601f('0x1d9')]=function(_0x35849a,_0x5110b3,_0x43a60e,_0x4daf05,_0xfaca77,_0x836bd){loggerPredictive[_0x601f('0x79')](_0x601f('0x208'));loggerPredictive['info'](_0x601f('0x201'),_0x35849a);loggerPredictive[_0x601f('0x79')](_0x601f('0x202'),_0x5110b3);loggerPredictive[_0x601f('0x79')](_0x601f('0x203'),_0x43a60e);loggerPredictive['info'](_0x601f('0x204'),_0x4daf05);loggerPredictive[_0x601f('0x79')](_0x601f('0x209'),_0xfaca77);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x55ec28,_0x4ecc83){if(_0x35849a<=0x0||isNaN(_0x35849a)){return _0x4ecc83(msgResponse(_0x601f('0x20a'),_0x601f('0x42'),_0x601f('0x206')+_0x35849a));}if(_0x43a60e<=0x0||isNaN(_0x43a60e)){return _0x4ecc83(msgResponse(_0x601f('0x20a'),_0x601f('0x42'),_0x601f('0x20b')+_0x43a60e));}if(_0x4daf05<=0x0||isNaN(_0x4daf05)){return _0x4ecc83(msgResponse(_0x601f('0x20a'),_0x601f('0x42'),_0x601f('0x20c')+_0x4daf05));}if(_0x5110b3<=0x0||isNaN(_0x5110b3)){return _0x4ecc83(msgResponse(_0x601f('0x20a'),'Error',_0x601f('0x207')+_0x5110b3));}if(_0xfaca77<=0x0||isNaN(_0xfaca77)){return _0x4ecc83(msgResponse(_0x601f('0x20a'),'Error',_0x601f('0x20d')+_0xfaca77));}_0x836bd=_0x836bd||0x0;var _0x19bbd1=0x1/_0x43a60e;var _0x2e0183=0x0;var _0x23fc08=0x0;var _0x5c3d12=0x0;var _0x487693=0x0;for(var _0x41789d=0x0;_0x487693<_0xfaca77;_0x41789d+=0x1){_0x23fc08=_0x41789d/_0x5110b3;_0x2e0183=(_0x4daf05*_0x23fc08+_0x836bd)/_0x19bbd1;_0x5c3d12=erlangb(_0x2e0183,_0x35849a);_0x487693=_0x2e0183/_0x35849a*(0x1-erlangb(_0x2e0183,_0x35849a));}return _0x55ec28({'erlangCalls':_0x41789d,'erlangCallToSecond':_0x5110b3/_0x41789d,'erlangAbandonmentRate':_0x5c3d12,'erlangBusyFactor':_0x487693});});};module[_0x601f('0x20e')]=Dialer; \ No newline at end of file +var _0x7e04=['isEmpty','Intervals','Error','stringify','milliseconds','seconds','emit','type','available','pTalking','sumBillable','sumHoldTime','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','md5','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\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','merge','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','statedesc','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','[countReScheduled]\x20','checkIsBlackList','then','catch','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','resolve','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','unmonitored','saveInDb','uniqueid','isNil','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','state','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','membername','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','campaigns','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','amd','countcongestionretry','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','syncAgentConnect','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','dialDropMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncQueueMember','strategy','actionid','locked','stateinterface','idHopper','paused','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','TRUNK_IS_NOT_REACHABLE','checkIfTimeIntervals','ifTime','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','push','all','some','GLOBAL_INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','launchHandleIvr','dialActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','checkIfTime','[syncCampaigns]','\x5cw{0,','pow','match','object','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','originate','SIP/%s/%s%s','trim','dialCutDigit','substring','TrunkBackup','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','RUNNING','[actionOriginate]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','[actionOriginatePredictive]\x20','--------\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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','interval\x20=\x20','Amax\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Ts\x20=\x20','Umin\x20=\x20','util','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./history','./final','./agentComplete','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','name','\x20INTERVAL_IS_NULL','Interval'];(function(_0x456c88,_0x599f52){var _0x3b36a4=function(_0x103956){while(--_0x103956){_0x456c88['push'](_0x456c88['shift']());}};_0x3b36a4(++_0x599f52);}(_0x7e04,0x1cf));var _0x47e0=function(_0x1eec3a,_0x168828){_0x1eec3a=_0x1eec3a-0x0;var _0x133cf7=_0x7e04[_0x1eec3a];return _0x133cf7;};'use strict';var util=require(_0x47e0('0x0'));var _=require('lodash');var BPromise=require(_0x47e0('0x1'));var uuid=require(_0x47e0('0x2'));var moment=require(_0x47e0('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x47e0('0x4'));var ut=require(_0x47e0('0x5'));var config=require(_0x47e0('0x6'));var logger=require(_0x47e0('0x7'))(_0x47e0('0x8'));var loggerBooked=require(_0x47e0('0x7'))(_0x47e0('0x9'));var loggerPredictive=require(_0x47e0('0x7'))(_0x47e0('0xa'));var loggerPredictiveCalls=require(_0x47e0('0x7'))(_0x47e0('0xb'));var loggerSyncQueueSummary=require(_0x47e0('0x7'))(_0x47e0('0xc'));var ami=require(_0x47e0('0xd'));config[_0x47e0('0xe')]=_['defaults'](config['redis'],{'host':_0x47e0('0xf'),'port':0x18eb});var io=require(_0x47e0('0x10'))(new Redis(config[_0x47e0('0xe')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x47e0('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x47e0('0x12'));var Action=require('./action');var History=require(_0x47e0('0x13'));var Final=require(_0x47e0('0x14'));var AgentComplete=require(_0x47e0('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x47e0('0x16'));var ipAgi=process[_0x47e0('0x17')]['XCALLY_IP_AGI']||_0x47e0('0x18');var strategy={'rrmemory':_0x47e0('0x19'),'roundrobin':_0x47e0('0x1a')};var Sequence=function(){};Sequence[_0x47e0('0x1b')][_0x47e0('0x1c')]=function(_0x52860f){this[_0x47e0('0x1d')]=this[_0x47e0('0x1d')]?this[_0x47e0('0x1d')][_0x47e0('0x1e')](_0x52860f):_0x52860f();};function Dialer(_0x1a81c2,_0x5c6684){this[_0x47e0('0x1f')]=new Sequence();this[_0x47e0('0x20')]=_0x5c6684;this['voiceQueues']=_0x1a81c2[_0x47e0('0x21')];this['campaigns']=_0x1a81c2['campaigns'];this[_0x47e0('0x22')]=_0x1a81c2['agents'];this[_0x47e0('0x23')]=_0x1a81c2['trunks'];this['maxNumberOriginate']=config[_0x47e0('0x24')]||0x2;this[_0x47e0('0x25')]={};this[_0x47e0('0x26')]={};this[_0x47e0('0x27')]={};this[_0x47e0('0x28')]={};this['optionPredictive']={};this['startPredictive']={};this[_0x47e0('0x29')]={};this[_0x47e0('0x2a')]={};this[_0x47e0('0x2b')]={};this[_0x47e0('0x2c')]={};ami['on'](_0x47e0('0x2d'),this['syncAgentConnect'][_0x47e0('0x2e')](this));ami['on'](_0x47e0('0x2f'),this[_0x47e0('0x30')]['bind'](this));ami['on'](_0x47e0('0x31'),this[_0x47e0('0x32')]['bind'](this));ami['on'](_0x47e0('0x33'),this['syncAgentComplete'][_0x47e0('0x2e')](this));ami['on'](_0x47e0('0x34'),this[_0x47e0('0xc')][_0x47e0('0x2e')](this));ami['on'](_0x47e0('0x35'),this[_0x47e0('0x36')][_0x47e0('0x2e')](this));ami['on'](_0x47e0('0x37'),this[_0x47e0('0x38')][_0x47e0('0x2e')](this));ami['on'](_0x47e0('0x39'),this[_0x47e0('0x3a')][_0x47e0('0x2e')](this));ami['on']('queuemember',this['syncQueueMember'][_0x47e0('0x2e')](this));ami['on'](_0x47e0('0x3b'),this[_0x47e0('0x3c')][_0x47e0('0x2e')](this));this[_0x47e0('0x3d')]();this['loopClearZombieChannels']();}function isNotNull(_0x38dd99){return _0x38dd99!==null&&!_[_0x47e0('0x3e')](_0x38dd99);}function checkIsLoggedIn(_0x3960e3,_0x44205f){return function(){if(_0x44205f<=0x0){_0x3960e3['message']='AGENTS_NOT_LOGGED';throw _0x3960e3['name']+_0x47e0('0x3f');}};}function isActive(_0x2f0cdc){return _0x2f0cdc;}function checkIsActive(_0x434837,_0x565390){return function(){if(!isActive(_0x565390)){_0x434837[_0x47e0('0x40')]=_0x47e0('0x41');throw _0x434837['name']+_0x47e0('0x42');}};}function checkInterval(_0xbc6c2b){return function(){if(!isNotNull(_0xbc6c2b['Interval'])){_0xbc6c2b[_0x47e0('0x40')]=_0x47e0('0x43');throw _0xbc6c2b[_0x47e0('0x44')]+_0x47e0('0x45');}if(!isNotNull(_0xbc6c2b[_0x47e0('0x46')]['Intervals'])){_0xbc6c2b[_0x47e0('0x40')]=_0x47e0('0x43');throw _0xbc6c2b[_0x47e0('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x47e0('0x47')](_0xbc6c2b[_0x47e0('0x46')][_0x47e0('0x48')]))){_0xbc6c2b[_0x47e0('0x40')]=_0x47e0('0x43');throw _0xbc6c2b[_0x47e0('0x44')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x522d13,_0x496cc4,_0x4aea56){return{'action':_0x522d13,'response':_0x496cc4,'message':_0x4aea56,'stack':_0x4aea56};}function myreject(_0x4d00e2){return function(_0x2fe3e1){return _0x4d00e2(msgResponse('[ifTime][Action]',_0x47e0('0x49'),JSON[_0x47e0('0x4a')](_0x2fe3e1)));};}function getSeconds(_0x18eb64,_0x5b13e3){var _0x41c888=moment(_0x18eb64)[_0x47e0('0x4b')](0x0);var _0x272606=moment(_0x5b13e3)[_0x47e0('0x4b')](0x0);return _0x41c888['diff'](_0x272606,_0x47e0('0x4c'));}function emit(_0x567d33,_0x20d872,_0x271dd4){io['to'](_0x567d33)[_0x47e0('0x4d')](_0x20d872,_0x271dd4);}function emitVoiceQueueSummary(_0x329048){if(_0x329048[_0x47e0('0x4e')]==='outbound'){var _0x3cbd5e={'id':_0x329048['id'],'name':_0x329048[_0x47e0('0x44')],'strategy':_0x329048['strategy'],'answered':_0x329048['answered'],'available':_0x329048[_0x47e0('0x4f')],'loggedIn':_0x329048['loggedIn'],'pTalking':_0x329048[_0x47e0('0x50')],'sumBillable':_0x329048[_0x47e0('0x51')],'sumDuration':_0x329048['sumDuration'],'sumHoldTime':_0x329048[_0x47e0('0x52')]||0x0,'talking':_0x329048['talking'],'total':_0x329048[_0x47e0('0x53')],'type':_0x329048[_0x47e0('0x4e')],'unmanaged':_0x329048[_0x47e0('0x54')],'abandoned':_0x329048[_0x47e0('0x55')],'waiting':_0x329048[_0x47e0('0x56')],'loggedInDb':_0x329048['loggedInDb'],'dialActive':_0x329048['dialActive'],'dialMethod':_0x329048[_0x47e0('0x57')],'dialOriginateCallerIdName':_0x329048[_0x47e0('0x58')],'dialOriginateCallerIdNumber':_0x329048[_0x47e0('0x59')],'dialOriginateTimeout':_0x329048[_0x47e0('0x5a')],'dialPrefix':_0x329048[_0x47e0('0x5b')],'outboundAnswerAgiCallsDay':_0x329048[_0x47e0('0x5c')],'outboundAnswerCallsDay':_0x329048[_0x47e0('0x5d')],'outboundBlacklistCallsDay':_0x329048[_0x47e0('0x5e')],'outboundBusyCallsDay':_0x329048[_0x47e0('0x5f')],'outboundCongestionCallsDay':_0x329048[_0x47e0('0x60')],'outboundDropCallsDayACS':_0x329048[_0x47e0('0x61')],'outboundDropCallsDayCallersExit':_0x329048[_0x47e0('0x62')],'outboundDropCallsDayTimeout':_0x329048['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x329048[_0x47e0('0x63')],'outboundNoSuchCallsDay':_0x329048[_0x47e0('0x64')],'outboundOriginateFailureCallsDay':_0x329048[_0x47e0('0x65')],'outboundReCallsDay':_0x329048[_0x47e0('0x66')],'outboundRejectCallsDay':_0x329048[_0x47e0('0x67')],'outboundUnknownCallsDay':_0x329048[_0x47e0('0x68')],'predictiveIntervalAnsweredCalls':_0x329048[_0x47e0('0x69')],'predictiveIntervalAvgHoldtime':_0x329048[_0x47e0('0x6a')],'predictiveIntervalAvgTalktime':_0x329048[_0x47e0('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x329048[_0x47e0('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x329048['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x329048[_0x47e0('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x329048[_0x47e0('0x6e')],'predictiveIntervalHitRate':_0x329048[_0x47e0('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x329048['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x329048[_0x47e0('0x70')],'predictiveIntervalAvailable':_0x329048[_0x47e0('0x71')],'predictiveIntervalTotalCalls':_0x329048[_0x47e0('0x72')],'message':_0x329048[_0x47e0('0x40')],'originated':_0x329048[_0x47e0('0x73')],'erlangCalls':_0x329048['erlangCalls'],'erlangCallToSecond':_0x329048[_0x47e0('0x74')],'erlangAbandonmentRate':_0x329048[_0x47e0('0x75')],'erlangBusyFactor':_0x329048[_0x47e0('0x76')],'startPredictive':_0x329048[_0x47e0('0x77')],'startProgressive':_0x329048[_0x47e0('0x29')]};if(_0x329048[_0x47e0('0x78')]){_0x3cbd5e['Trunk']={'id':_0x329048['Trunk']['id'],'name':_0x329048['Trunk'][_0x47e0('0x44')],'active':_0x329048[_0x47e0('0x78')][_0x47e0('0x79')],'callerid':_0x329048[_0x47e0('0x78')][_0x47e0('0x7a')]};}if(_0x329048['Interval']){_0x3cbd5e[_0x47e0('0x46')]={'id':_0x329048[_0x47e0('0x46')]['id'],'name':_0x329048[_0x47e0('0x46')][_0x47e0('0x44')]};}var _0x2b5d0a=md5(JSON[_0x47e0('0x4a')](_0x3cbd5e));if(_0x329048[_0x47e0('0x7b')]!==_0x2b5d0a){_0x329048[_0x47e0('0x7b')]=_0x2b5d0a;emit(util['format']('voice:queue:%s',_0x3cbd5e[_0x47e0('0x44')]),_0x47e0('0x7c'),_0x3cbd5e);}}}function emitCampaignSummary(_0x5ea7ef){if(_0x5ea7ef[_0x47e0('0x4e')]===_0x47e0('0x7d')){emit(util[_0x47e0('0x7e')](_0x47e0('0x7f'),_0x5ea7ef[_0x47e0('0x44')]),_0x47e0('0x80'),_0x5ea7ef);}}function checkGetDataPredictive(_0x546432){if(isNotNull(_0x546432)&&!_[_0x47e0('0x47')](_0x546432)){loggerPredictive['info'](_0x47e0('0x81'));loggerPredictive[_0x47e0('0x82')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x546432[_0x47e0('0x72')]);loggerPredictive[_0x47e0('0x82')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x546432[_0x47e0('0x69')]);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x83'),_0x546432[_0x47e0('0x84')]);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x85'),_0x546432[_0x47e0('0x6c')]);loggerPredictive['info'](_0x47e0('0x86'),_0x546432[_0x47e0('0x6a')]);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x87'),_0x546432['predictiveIntervalAvgTalktime']);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x88'));if(_0x546432['predictiveIntervalTotalCalls']>0x0){if(!_[_0x47e0('0x3e')](_0x546432['predictiveIntervalAvgTalktime'])&&_0x546432[_0x47e0('0x6b')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x546432['predictiveIntervalAvgHoldtime'])&&_0x546432[_0x47e0('0x6a')]>0x0){return!![];}loggerPredictive[_0x47e0('0x82')](_0x47e0('0x89'));}else{loggerPredictive[_0x47e0('0x82')](_0x47e0('0x8a'));}}else{loggerPredictive[_0x47e0('0x82')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x3047f5){return function(_0x37015f){loggerPredictive[_0x47e0('0x82')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x47e0('0x82')](_0x47e0('0x8b'),_0x37015f[_0x47e0('0x8c')]);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x8d'),_0x37015f[_0x47e0('0x74')]);loggerPredictive[_0x47e0('0x82')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37015f['erlangAbandonmentRate']);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x8e'),_0x37015f[_0x47e0('0x76')]);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x8f'),_0x37015f['erlangAbandonmentRate']);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x88'));_[_0x47e0('0x90')](_0x3047f5,_0x37015f);};}function getDiff(_0x45ddbe){var _0x1a64fe=moment()['milliseconds'](0x0);var _0x93be77=moment(_0x45ddbe)['milliseconds'](0x0);return _0x1a64fe[_0x47e0('0x91')](_0x93be77,_0x47e0('0x4c'));}function ifInterval(_0xf0684b,_0x109f53){if(_['isUndefined'](_0x109f53)){return![];}return getDiff(_0x109f53)<_0xf0684b*0x3c;}function freeVariablesPredictive(_0x376103){if(isNotNull(_0x376103)){if(!_[_0x47e0('0x3e')](_0x376103[_0x47e0('0x29')])){_0x376103['startProgressive']=undefined;loggerPredictive[_0x47e0('0x82')](_0x376103['name'],_0x47e0('0x92'));}if(!_['isUndefined'](_0x376103[_0x47e0('0x77')])){_0x376103['startPredictive']=undefined;loggerPredictive[_0x47e0('0x82')](_0x376103['name'],_0x47e0('0x93'));}if(!_[_0x47e0('0x3e')](_0x376103[_0x47e0('0x94')])){clearInterval(_0x376103['handlePredictive']);_0x376103['handlePredictive']=undefined;loggerPredictive[_0x47e0('0x82')](_0x376103[_0x47e0('0x44')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x381734,_0x29eb08){if(_0x29eb08===0x0){return 0x0;}var _0x547201=0x1;for(var _0x6adccd=0x1;_0x6adccd<=_0x29eb08;_0x6adccd+=0x1){_0x547201=0x1+_0x547201*_0x6adccd/_0x381734;}return 0x1/_0x547201;}function isVoiceQueueOutbound(_0x293824){return _0x293824===_0x47e0('0x95');}function isNotPreview(_0x25e651){return _0x25e651!==_0x47e0('0x20');}function isCampaignIvr(_0x474fc9){return _0x474fc9===_0x47e0('0x7d');}function getCallerId(_0x3d6ae9,_0x5e0445,_0x5d3222){if(!_[_0x47e0('0x3e')](_0x5d3222)&&typeof _0x5d3222==='string'&&!_[_0x47e0('0x47')](_0x5d3222)){if(!_[_0x47e0('0x3e')](_0x5e0445)&&typeof _0x5e0445===_0x47e0('0x96')&&!_['isEmpty'](_0x5e0445)){return util[_0x47e0('0x7e')](_0x47e0('0x97'),_0x5e0445,_0x5d3222);}return util[_0x47e0('0x7e')](_0x47e0('0x97'),_0x5d3222,_0x5d3222);}if(!_[_0x47e0('0x3e')](_0x3d6ae9)&&typeof _0x3d6ae9===_0x47e0('0x96')&&!_[_0x47e0('0x47')](_0x3d6ae9)){return _0x3d6ae9;}return _0x47e0('0x98');}function loggerCatchQueueSummary(_0x412e15,_0x2ba0c2){return function(_0x414fea){freeVariablesPredictive(_0x2ba0c2);emitVoiceQueueSummary(_0x2ba0c2);emitCampaignSummary(_0x2ba0c2);loggerSyncQueueSummary[_0x47e0('0x99')](_0x412e15,util[_0x47e0('0x9a')](_0x414fea,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2176ae,_0x4178e7){return function(_0x23e3b5){loggerPredictive[_0x47e0('0x99')](_0x4178e7[_0x47e0('0x44')],_0x2176ae);loggerPredictive['error'](_0x23e3b5[_0x47e0('0x9b')]);freeVariablesPredictive(_0x4178e7);};}function loggerCatch(_0x4d6630){return function(_0x34f04e){logger[_0x47e0('0x99')](_0x4d6630,util[_0x47e0('0x9a')](_0x34f04e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x28a627){return _0x28a627&&!_[_0x47e0('0x3e')](_0x28a627)&&_0x28a627[_0x47e0('0x9c')]>0x0;}function decremetOriginate(_0x1177b7){if(!_[_0x47e0('0x3e')](_0x1177b7)&&_0x1177b7!==null){if(typeof _0x1177b7['originated']!==_0x47e0('0x9d')){if(_0x1177b7[_0x47e0('0x73')]>0x0){_0x1177b7[_0x47e0('0x73')]-=0x1;}else{logger['error'](_0x47e0('0x9e'));}}}else{logger[_0x47e0('0x99')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x3fcb28,_0xcad3d6,_0x5cfd29){if(_0xcad3d6>_0x5cfd29){for(var _0x7fe713=0x0;_0x7fe713<_0xcad3d6-_0x5cfd29;_0x7fe713+=0x1){decremetOriginate(_0x3fcb28);}}}function loggerGetContactDialer(_0x30aaa1,_0x41296a,_0x230ce5){return function(_0x2cf96b){checkContactLowerLimitOriginate(_0x41296a,_0x230ce5,0x0);logger[_0x47e0('0x99')](_0x30aaa1,util['inspect'](_0x2cf96b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x7232df){return function(_0x102c93){if(isNotNull(_0x102c93)&&isNotNull(_0x102c93[0x0])){if(_0x102c93[0x0][_0x47e0('0x9f')]>0x0){_0x7232df[_0x47e0('0x40')]=_0x47e0('0xa0');logger[_0x47e0('0x82')]('[getContactDialer2][ReScheduled]'+_0x7232df[_0x47e0('0x44')],_0x102c93[0x0]['contactsRescheduled'],_0x47e0('0xa1'));}else{_0x7232df[_0x47e0('0x40')]=_0x47e0('0xa2');logger[_0x47e0('0x82')]('[getContactDialer2][Empty]'+_0x7232df['name']);}}};}function notSendMessagesQueue(_0x1e2f4a){if(_0x1e2f4a[_0x47e0('0xa3')]){freeVariablesPredictive(_0x1e2f4a);if(_0x1e2f4a[_0x47e0('0x73')]===0x0&&_0x1e2f4a[_0x47e0('0xa4')]===0x0&&_0x1e2f4a[_0x47e0('0x56')]===0x0&&(_0x1e2f4a[_0x47e0('0x50')]||0x0)===0x0){_0x1e2f4a['sendMessageOneNotActive']=![];_0x1e2f4a[_0x47e0('0x4f')]=0x0;_0x1e2f4a[_0x47e0('0x40')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x47e0('0x99')](_0x47e0('0xa5'),_0x1e2f4a[_0x47e0('0x44')],_0x47e0('0xa6'));}else{_0x1e2f4a[_0x47e0('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x47e0('0xa5'),_0x1e2f4a['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x1e2f4a);}}function notSendMessagesCampaign(_0xef23f5){if(_0xef23f5[_0x47e0('0xa3')]){if(_0xef23f5[_0x47e0('0x73')]===0x0){_0xef23f5['sendMessageOneNotActive']=![];_0xef23f5['message']=_0x47e0('0x41');loggerSyncQueueSummary[_0x47e0('0x99')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xef23f5[_0x47e0('0x44')],_0x47e0('0xa6'));}else{_0xef23f5[_0x47e0('0x40')]=_0x47e0('0xa7');loggerSyncQueueSummary[_0x47e0('0x99')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xef23f5[_0x47e0('0x44')],_0x47e0('0xa8'));}emitCampaignSummary(_0xef23f5);}}function createObjHistory(_0x4f4a4b,_0x386bf9,_0x22f6bb,_0x410f50,_0x1ea064){_0x4f4a4b[_0x47e0('0x40')]=_0x22f6bb;var _0x1162b9=new Action(_0x4f4a4b,_0x386bf9);var _0x4154ba=new History(_0x1162b9);_0x4154ba['state']=_0x410f50;_0x4154ba[_0x47e0('0xa9')]=_0x1ea064;_0x4154ba['endtime']=_0x1162b9[_0x47e0('0xaa')];return _0x4154ba;}Dialer[_0x47e0('0x1b')][_0x47e0('0xab')]=function(){var _0x400dd4=this;setInterval(function(){_0x400dd4[_0x47e0('0xac')](_0x400dd4[_0x47e0('0x28')],_0x47e0('0xad'));_0x400dd4[_0x47e0('0xac')](_0x400dd4['actions'],_0x47e0('0xae'));},0x32c8);};Dialer[_0x47e0('0x1b')]['clearZombieChannels']=function(_0x3f8c74,_0x4c6f41){var _0x408920=this;for(var _0x2f837f in _0x3f8c74){if(typeof _0x3f8c74[_0x2f837f]!==_0x47e0('0x9d')){this['sequence'][_0x47e0('0x1c')](function(){if(!_['isNil'](_0x3f8c74[_0x2f837f])){return ami[_0x47e0('0xaf')]({'action':_0x47e0('0xb0'),'channel':_0x3f8c74[_0x2f837f][_0x47e0('0xb1')]})['catch'](function(_0x3a18a6){if(_0x3a18a6[_0x47e0('0x40')]===_0x47e0('0xb2')){setTimeout(function(){if(_0x3f8c74[_0x2f837f]&&_0x3f8c74[_0x2f837f][_0x47e0('0x4e')]!==_0x47e0('0x7d')){_0x408920[_0x47e0('0xb3')](_0x408920[_0x47e0('0x21')][_0x3f8c74[_0x2f837f][_0x47e0('0xb4')]]);logger['error'](_0x47e0('0xb5'),_0x4c6f41,_0x2f837f,_0x3f8c74[_0x2f837f][_0x47e0('0xb4')]);delete _0x3f8c74[_0x2f837f];}if(_0x3f8c74[_0x2f837f]&&_0x3f8c74[_0x2f837f][_0x47e0('0x4e')]===_0x47e0('0x7d')){_0x408920[_0x47e0('0xb3')](_0x408920['campaigns'][_0x3f8c74[_0x2f837f][_0x47e0('0xb4')]]);logger['error'](_0x47e0('0xb6'),_0x4c6f41,_0x2f837f,_0x3f8c74[_0x2f837f]['queue']);delete _0x3f8c74[_0x2f837f];}},0x2328);}});}});}}};Dialer[_0x47e0('0x1b')][_0x47e0('0xb7')]=function(_0x4007c2){return BPromise['resolve']()['then'](cmHopper[_0x47e0('0xb7')](_0x4007c2))['catch'](loggerCatch(_0x47e0('0xb8')));};Dialer[_0x47e0('0x1b')][_0x47e0('0xb9')]=function(_0x39de13){return BPromise['resolve']()[_0x47e0('0xba')](cmHopperBlack[_0x47e0('0xb9')](_0x39de13))[_0x47e0('0xbb')](loggerCatch(_0x47e0('0xbc')));};Dialer[_0x47e0('0x1b')][_0x47e0('0xbd')]=function(_0x4a4094){return BPromise['resolve']()[_0x47e0('0xba')](cmHopperBlack['checkIsBlackListIvr'](_0x4a4094))[_0x47e0('0xbb')](loggerCatch(_0x47e0('0xbe')));};Dialer['prototype'][_0x47e0('0xbf')]=function(_0x179f32){return BPromise[_0x47e0('0xc0')]()['then'](cmHopperHistory[_0x47e0('0xc1')](_0x179f32))[_0x47e0('0xbb')](loggerCatch(_0x47e0('0xc2')));};Dialer[_0x47e0('0x1b')][_0x47e0('0xc3')]=function(_0xc57c15){return BPromise['resolve']()[_0x47e0('0xba')](cmHopper['rescheduleContact'](_0xc57c15))['catch'](loggerCatch(_0x47e0('0xc4')));};Dialer['prototype'][_0x47e0('0xc5')]=function(_0x5170b7,_0x59bcc5,_0x3d842e){return BPromise['resolve']()[_0x47e0('0xba')](cmHopper[_0x47e0('0xc5')](_0x5170b7,_0x59bcc5,_0x3d842e))['catch'](loggerCatch(_0x47e0('0xc6')));};Dialer[_0x47e0('0x1b')]['getContactDialer']=function(_0x1cf970,_0x1f12f5,_0x2f4728,_0x21fd23){return BPromise['resolve']()['then'](cmHopper['getContactDialer'](_0x1cf970,_0x1f12f5,_0x2f4728,_0x21fd23))[_0x47e0('0xbb')](loggerCatch(_0x47e0('0xc7')));};Dialer[_0x47e0('0x1b')][_0x47e0('0xc8')]=function(_0x3989e8,_0x540a36,_0x36a6b4){return BPromise[_0x47e0('0xc0')]()['then'](cmHopper['getContactDialerIvr'](_0x3989e8,_0x540a36,_0x36a6b4))[_0x47e0('0xbb')](loggerCatch(_0x47e0('0xc7')));};Dialer[_0x47e0('0x1b')][_0x47e0('0xc9')]=function(_0x1fe289){return BPromise[_0x47e0('0xc0')]()[_0x47e0('0xba')](voiceQueueRt['getVoiceQueueRtPauses'](_0x1fe289))['catch'](loggerCatch(_0x47e0('0xca')));};Dialer[_0x47e0('0x1b')][_0x47e0('0xcb')]=function(_0x5ab396){return BPromise[_0x47e0('0xc0')]()[_0x47e0('0xba')](cmHopper[_0x47e0('0xcb')](_0x5ab396))['catch'](loggerCatch(_0x47e0('0xcc')));};Dialer[_0x47e0('0x1b')][_0x47e0('0xcd')]=function(_0x37d2ff){return BPromise[_0x47e0('0xc0')]()[_0x47e0('0xba')](cmHopperHistory[_0x47e0('0xcd')](_0x37d2ff))[_0x47e0('0xbb')](loggerCatch('[createHistory]\x20'));};Dialer[_0x47e0('0x1b')][_0x47e0('0xb3')]=function(_0x19a200){if(!_[_0x47e0('0x3e')](_0x19a200)&&_0x19a200!==null){if(typeof _0x19a200[_0x47e0('0x73')]!==_0x47e0('0x9d')){if(_0x19a200['originated']>0x0){_0x19a200[_0x47e0('0x73')]-=0x1;}else{logger[_0x47e0('0x99')](_0x47e0('0xce'));}}}else{logger['error'](_0x47e0('0xcf'));}};Dialer[_0x47e0('0x1b')][_0x47e0('0xd0')]=function(_0xa12098,_0x4048f8){var _0xafdc28=this;return function(_0x5df7de){_0xafdc28[_0x47e0('0xb3')](_0x4048f8);logger[_0x47e0('0x99')](_0xa12098,util['inspect'](_0x5df7de,{'showHidden':![],'depth':null}));};};Dialer[_0x47e0('0x1b')][_0x47e0('0xd1')]=function(_0xede08a,_0x138ca9,_0x4352fc){var _0x324f64={'state':0x19,'statedesc':'notFound'};this[_0x47e0('0xb3')](_0x138ca9);this['saveInDb'](_[_0x47e0('0x90')](_0x324f64,_[_0x47e0('0xd2')](_0x4352fc,[_0x47e0('0xd3'),'ListId',_0x47e0('0xd4'),_0x47e0('0xd5'),_0x47e0('0xd6')])),_0x47e0('0xd7'),_0x47e0('0xd8'));logger['error'](_0xede08a);};Dialer['prototype'][_0x47e0('0xd9')]=function(_0x1a32dc){return _0x1a32dc===_0x47e0('0xda');};Dialer[_0x47e0('0x1b')][_0x47e0('0xdb')]=function(_0x3db9e6){return!_[_0x47e0('0x3e')](_0x3db9e6)&&_0x3db9e6&&!_['isUndefined'](_0x3db9e6[_0x47e0('0x44')])&&!_[_0x47e0('0x3e')](_0x3db9e6[_0x47e0('0x79')])&&_0x3db9e6['active']&&(this[_0x47e0('0x23')][util[_0x47e0('0x7e')]('SIP/%s',_0x3db9e6[_0x47e0('0x44')])][_0x47e0('0xb0')]===_0x47e0('0xdc')||this['trunks'][util[_0x47e0('0x7e')](_0x47e0('0xdd'),_0x3db9e6[_0x47e0('0x44')])][_0x47e0('0xb0')]===_0x47e0('0xde'));};Dialer['prototype'][_0x47e0('0xdf')]=function(_0x2a1b77,_0x5647cb,_0x2e97bb){this[_0x47e0('0xcd')](_0x2a1b77)[_0x47e0('0xbb')](loggerCatch(_0x5647cb));this['moveContactManagedDialer'](_0x2a1b77)[_0x47e0('0xbb')](loggerCatch(_0x2e97bb));};Dialer[_0x47e0('0x1b')][_0x47e0('0x3a')]=function(_0x2191e4){var _0x54c9f8=this[_0x47e0('0x28')][_0x2191e4[_0x47e0('0xe0')]];var _0x1568d4;if(!_['isNil'](_0x2191e4)&&!_[_0x47e0('0xe1')](_0x2191e4[_0x47e0('0xe2')])&&!_[_0x47e0('0xe1')](_0x2191e4[_0x47e0('0xe2')][_0x47e0('0xe3')])&&_0x2191e4['exten']===_0x47e0('0xe4')&&_0x54c9f8){if(_0x54c9f8[_0x47e0('0x4e')]!==_0x47e0('0x7d')&&this[_0x47e0('0x21')][_0x54c9f8['queue']][_0x47e0('0xe5')]&&_0x2191e4[_0x47e0('0xe6')]===_0x47e0('0xe7')){delete this['uniqueId'][_0x2191e4[_0x47e0('0xe0')]];this['updateOriginated'](this[_0x47e0('0x21')][_0x54c9f8['queue']]);this[_0x47e0('0x21')][_0x54c9f8[_0x47e0('0xb4')]][_0x47e0('0x5d')]+=0x1;this[_0x47e0('0x21')][_0x54c9f8[_0x47e0('0xb4')]][_0x47e0('0x5c')]+=0x1;_0x1568d4=new Hangup(_0x54c9f8,_0x2191e4);_0x1568d4[_0x47e0('0xe8')]=0x12;_0x1568d4['statedesc']=_0x47e0('0xe9');_0x1568d4['membername']=_0x47e0('0xea');this[_0x47e0('0xdf')](_0x1568d4,_0x47e0('0xeb'),_0x47e0('0xec'));}if(_0x54c9f8['type']!==_0x47e0('0x7d')&&this['voiceQueues'][_0x54c9f8[_0x47e0('0xb4')]]['dialAMDActive']&&_0x2191e4[_0x47e0('0xe6')]==='MACHINE'){var _0x5c77ca=this;return new BPromise(function(_0x452e45,_0x47ff04){delete _0x5c77ca[_0x47e0('0x28')][_0x2191e4[_0x47e0('0xe0')]];_0x5c77ca[_0x47e0('0xb3')](_0x5c77ca['voiceQueues'][_0x54c9f8[_0x47e0('0xb4')]]);_0x5c77ca['voiceQueues'][_0x54c9f8[_0x47e0('0xb4')]][_0x47e0('0x5d')]+=0x1;_0x5c77ca['voiceQueues'][_0x54c9f8['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x14107c=_0x5c77ca[_0x47e0('0x21')][_0x54c9f8[_0x47e0('0xb4')]];var _0x147acd=new Hangup(_0x54c9f8,_0x2191e4);_0x147acd[_0x47e0('0xe8')]=0x13;_0x147acd[_0x47e0('0xa9')]=_0x47e0('0xed');_0x147acd[_0x47e0('0xee')]=_0x47e0('0xea');_0x147acd[_0x47e0('0xef')]+=0x1;_0x147acd[_0x47e0('0xf0')]+=0x1;_0x147acd['amd']=!![];_0x5c77ca['createHistory'](_0x147acd)[_0x47e0('0xbb')](loggerCatch(_0x47e0('0xf1')));if(_0x147acd[_0x47e0('0xf2')]+_0x147acd['countcongestionretry']+_0x147acd[_0x47e0('0xf3')]+_0x147acd[_0x47e0('0xf4')]+_0x147acd[_0x47e0('0xf5')]+_0x147acd[_0x47e0('0xf6')]+_0x147acd[_0x47e0('0xef')]+_0x147acd[_0x47e0('0xf7')]>=_0x14107c[_0x47e0('0xf8')]){_0x5c77ca[_0x47e0('0xf9')](_0x147acd,_0x452e45,_0x47ff04,_0x47e0('0xfa'));}else{if(_0x147acd['countmachineretry']>=_0x14107c[_0x47e0('0xfb')]){_0x5c77ca[_0x47e0('0xfc')](_0x147acd,_0x452e45,_0x47ff04,_0x47e0('0xfd'));}else{_0x5c77ca[_0x47e0('0xc3')]({'active':![],'countmachineretry':_0x147acd[_0x47e0('0xef')],'scheduledat':moment()[_0x47e0('0xfe')](_0x14107c[_0x47e0('0xff')],_0x47e0('0x100'))[_0x47e0('0x7e')](_0x47e0('0x101')),'ContactId':_0x147acd[_0x47e0('0xd3')],'ListId':_0x147acd[_0x47e0('0x102')],'VoiceQueueId':_0x147acd[_0x47e0('0xd5')]||undefined,'CampaignId':_0x147acd[_0x47e0('0xd6')]||undefined})[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x103')));_0x452e45({'reschedule':0x1});}}});}if(_0x54c9f8[_0x47e0('0x4e')]==='ivr'&&this['campaigns'][_0x54c9f8['queue']][_0x47e0('0xe5')]&&_0x2191e4[_0x47e0('0xe6')]===_0x47e0('0xe7')){delete this['uniqueId'][_0x2191e4[_0x47e0('0xe0')]];this[_0x47e0('0xb3')](this[_0x47e0('0x104')][_0x54c9f8[_0x47e0('0xb4')]]);_0x1568d4=new Hangup(_0x54c9f8,_0x2191e4);_0x1568d4[_0x47e0('0xe8')]=0x12;_0x1568d4[_0x47e0('0xa9')]=_0x47e0('0xe9');_0x1568d4[_0x47e0('0xee')]=_0x47e0('0xea');this['saveInDb'](_0x1568d4,_0x47e0('0x105'),_0x47e0('0x106'));}if(_0x54c9f8[_0x47e0('0x4e')]===_0x47e0('0x7d')&&this[_0x47e0('0x104')][_0x54c9f8['queue']][_0x47e0('0xe5')]&&_0x2191e4[_0x47e0('0xe6')]===_0x47e0('0x107')){var _0x5c77ca=this;return new BPromise(function(_0x4ce2c2,_0x563bdb){delete _0x5c77ca[_0x47e0('0x28')][_0x2191e4[_0x47e0('0xe0')]];_0x5c77ca[_0x47e0('0xb3')](_0x5c77ca[_0x47e0('0x104')][_0x54c9f8[_0x47e0('0xb4')]]);_0x5c77ca['campaigns'][_0x54c9f8[_0x47e0('0xb4')]][_0x47e0('0x5d')]+=0x1;_0x5c77ca['campaigns'][_0x54c9f8[_0x47e0('0xb4')]][_0x47e0('0x5c')]+=0x1;var _0x27a465=_0x5c77ca['campaigns'][_0x54c9f8[_0x47e0('0xb4')]];var _0x1273b1=new Hangup(_0x54c9f8,_0x2191e4);_0x1273b1['state']=0x13;_0x1273b1[_0x47e0('0xa9')]='Machine';_0x1273b1['membername']='AMD';_0x1273b1[_0x47e0('0xef')]+=0x1;_0x1273b1[_0x47e0('0xf0')]+=0x1;_0x1273b1[_0x47e0('0x108')]=!![];_0x5c77ca['createHistory'](_0x1273b1)[_0x47e0('0xbb')](loggerCatch(_0x47e0('0xf1')));if(_0x1273b1[_0x47e0('0xf2')]+_0x1273b1[_0x47e0('0x109')]+_0x1273b1[_0x47e0('0xf3')]+_0x1273b1['countnosuchnumberretry']+_0x1273b1[_0x47e0('0xf5')]+_0x1273b1[_0x47e0('0xf6')]+_0x1273b1[_0x47e0('0xef')]+_0x1273b1['countagentrejectretry']>=_0x27a465[_0x47e0('0xf8')]){_0x5c77ca[_0x47e0('0xf9')](_0x1273b1,_0x4ce2c2,_0x563bdb,_0x47e0('0xfa'));}else{if(_0x1273b1[_0x47e0('0xef')]>=_0x27a465[_0x47e0('0xfb')]){_0x5c77ca[_0x47e0('0xfc')](_0x1273b1,_0x4ce2c2,_0x563bdb,'reason\x2019\x20machine....');}else{_0x5c77ca['rescheduleContact']({'active':![],'countmachineretry':_0x1273b1[_0x47e0('0xef')],'scheduledat':moment()[_0x47e0('0xfe')](_0x27a465[_0x47e0('0xff')],_0x47e0('0x100'))[_0x47e0('0x7e')](_0x47e0('0x101')),'ContactId':_0x1273b1[_0x47e0('0xd3')],'ListId':_0x1273b1[_0x47e0('0x102')],'VoiceQueueId':_0x1273b1[_0x47e0('0xd5')]||undefined,'CampaignId':_0x1273b1[_0x47e0('0xd6')]||undefined})['catch'](loggerCatch(_0x47e0('0x103')));_0x4ce2c2({'reschedule':0x1});}}});}}};Dialer[_0x47e0('0x1b')][_0x47e0('0x36')]=function(_0x444dac){var _0x403764=this['uniqueId'][_0x444dac[_0x47e0('0xe0')]];var _0xd822fa=this;var _0x4f5f74;if(_0x403764&&_0x403764[_0x47e0('0x4e')]===_0x47e0('0x7d')){delete this[_0x47e0('0x28')][_0x444dac[_0x47e0('0xe0')]];this[_0x47e0('0xb3')](this[_0x47e0('0x104')][_0x403764[_0x47e0('0xb4')]]);this[_0x47e0('0x104')][_0x403764['queue']]['ivrAnswerCallsDay']+=0x1;_0x4f5f74=new Hangup(_0x403764,_0x444dac);this[_0x47e0('0xcd')](_0x4f5f74)[_0x47e0('0xbb')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x47e0('0xcb')](_0x4f5f74)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x403764&&_0x403764[_0x47e0('0x4e')]!==_0x47e0('0x7d')&&isNotNull(this['voiceQueues'][_0x403764[_0x47e0('0xb4')]][_0x47e0('0x10a')])){delete this['uniqueId'][_0x444dac[_0x47e0('0xe0')]];this[_0x47e0('0xb3')](this['voiceQueues'][_0x403764[_0x47e0('0xb4')]]);this[_0x47e0('0x21')][_0x403764[_0x47e0('0xb4')]][_0x47e0('0x5d')]+=0x1;this[_0x47e0('0x21')][_0x403764[_0x47e0('0xb4')]][_0x47e0('0x5c')]+=0x1;_0x4f5f74=new Hangup(_0x403764,_0x444dac);_0x4f5f74[_0x47e0('0xe8')]=0x10;_0x4f5f74[_0x47e0('0xa9')]=_0x47e0('0x10b');_0x4f5f74[_0x47e0('0xee')]=_0x47e0('0x10c');this[_0x47e0('0xcd')](_0x4f5f74)[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x10d')));this[_0x47e0('0xcb')](_0x4f5f74)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x403764&&_0x403764[_0x47e0('0x4e')]!==_0x47e0('0x7d')&&!isNotNull(this[_0x47e0('0x21')][_0x403764[_0x47e0('0xb4')]][_0x47e0('0x10a')])){delete this['uniqueId'][_0x444dac['uniqueid']];this['updateOriginated'](this[_0x47e0('0x21')][_0x403764[_0x47e0('0xb4')]]);this[_0x47e0('0x21')][_0x403764[_0x47e0('0xb4')]]['outboundUnknownCallsDay']+=0x1;_0x4f5f74=new Hangup(_0x403764,_0x444dac);_0x4f5f74['state']=0xc;_0x4f5f74[_0x47e0('0xa9')]=_0x444dac[_0x47e0('0x10e')];_0x4f5f74[_0x47e0('0xee')]=_0x47e0('0x10f');this[_0x47e0('0xcd')](_0x4f5f74)[_0x47e0('0xbb')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x47e0('0xcb')](_0x4f5f74)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x47e0('0x1b')][_0x47e0('0x110')]=function(_0x360a13){var _0x2b9a04=this[_0x47e0('0x28')][_0x360a13['uniqueid']];var _0x3068d4=this;if(this[_0x47e0('0x21')][_0x360a13[_0x47e0('0xb4')]]){if(_0x2b9a04&&_0x2b9a04['type']!==_0x47e0('0x7d')){delete this[_0x47e0('0x28')][_0x360a13['uniqueid']];this['voiceQueues'][_0x360a13['queue']][_0x47e0('0x5d')]+=0x1;var _0xb35257=new AgentComplete(_0x2b9a04,_0x360a13);if(_0x360a13[_0x47e0('0x111')]===_0x47e0('0x112')){_0xb35257[_0x47e0('0x113')]=this[_0x47e0('0x21')][_0x360a13[_0x47e0('0xb4')]][_0x47e0('0x114')]&&this[_0x47e0('0x21')][_0x360a13[_0x47e0('0xb4')]][_0x47e0('0x115')]?moment()[_0x47e0('0x7e')](_0x47e0('0x101')):undefined;}this[_0x47e0('0xcd')](_0xb35257)[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x116')));this[_0x47e0('0xcb')](_0xb35257)[_0x47e0('0xbb')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x47e0('0x117')]=function(_0x43440c){if(this[_0x47e0('0x21')][_0x43440c[_0x47e0('0xb4')]]){if(this[_0x47e0('0x28')][_0x43440c[_0x47e0('0xe0')]]&&this[_0x47e0('0x28')][_0x43440c['uniqueid']]['type']!==_0x47e0('0x7d')){this[_0x47e0('0xb3')](this[_0x47e0('0x21')][_0x43440c[_0x47e0('0xb4')]]);this['uniqueId'][_0x43440c[_0x47e0('0xe0')]][_0x47e0('0x118')]=moment()[_0x47e0('0x7e')](_0x47e0('0x101'));}}};Dialer[_0x47e0('0x1b')]['queueCallerAbandonCreateState']=function(_0x1b172c){this[_0x47e0('0xcd')](_0x1b172c)[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x116')));this[_0x47e0('0xcb')](_0x1b172c)[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x119')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x3914fc){var _0x307fe9=this[_0x47e0('0x28')][_0x3914fc['uniqueid']];var _0x35bb84=this;if(this[_0x47e0('0x21')][_0x3914fc[_0x47e0('0xb4')]]){if(_0x307fe9&&_0x307fe9['type']!==_0x47e0('0x7d')){delete this[_0x47e0('0x28')][_0x3914fc[_0x47e0('0xe0')]];this[_0x47e0('0xb3')](this[_0x47e0('0x21')][_0x3914fc[_0x47e0('0xb4')]]);_0x307fe9[_0x47e0('0x11a')]=moment()[_0x47e0('0x7e')](_0x47e0('0x101'));var _0x378b92=new QueueCallerAbandon(_0x307fe9,_0x3914fc);if(getSeconds(_0x307fe9['droptime'],_0x307fe9[_0x47e0('0x11b')])>=_0x307fe9[_0x47e0('0x11c')]){this['voiceQueues'][_0x3914fc['queue']][_0x47e0('0x84')]+=0x1;this['voiceQueues'][_0x3914fc[_0x47e0('0xb4')]][_0x47e0('0x11d')]+=0x1;this[_0x47e0('0x21')][_0x3914fc[_0x47e0('0xb4')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x378b92['state']=0xa;_0x378b92[_0x47e0('0xa9')]=_0x47e0('0x11e');_0x378b92[_0x47e0('0x11f')]='TIMEOUT';_0x378b92[_0x47e0('0x113')]=this['voiceQueues'][_0x3914fc['queue']][_0x47e0('0x114')]?moment()[_0x47e0('0x7e')](_0x47e0('0x101')):undefined;_0x378b92[_0x47e0('0xf5')]+=0x1;_0x378b92[_0x47e0('0xf0')]+=0x1;if(_0x378b92['countdropretry']>=this[_0x47e0('0x21')][_0x3914fc[_0x47e0('0xb4')]][_0x47e0('0x120')]){this[_0x47e0('0x121')](_0x378b92);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x378b92['countdropretry'],'scheduledat':moment()['add'](this[_0x47e0('0x21')][_0x3914fc[_0x47e0('0xb4')]]['dialDropRetryFrequency'],_0x47e0('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x307fe9[_0x47e0('0xd3')],'ListId':_0x307fe9['ListId'],'VoiceQueueId':_0x307fe9['VoiceQueueId']||undefined,'CampaignId':_0x307fe9[_0x47e0('0xd6')]||undefined})[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x122')));var _0x103b61=new History(_0x378b92);_0x103b61['state']=0xa;_0x103b61['statedesc']=_0x47e0('0x11e');_0x103b61['starttime']=moment()[_0x47e0('0x7e')](_0x47e0('0x101'));_0x103b61[_0x47e0('0x123')]=_0x103b61[_0x47e0('0xaa')];_0x103b61[_0x47e0('0x124')]=_0x378b92[_0x47e0('0x124')];_0x103b61[_0x47e0('0x125')]=_0x378b92[_0x47e0('0x125')];this[_0x47e0('0xcd')](_0x103b61)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x47e0('0x21')][_0x3914fc[_0x47e0('0xb4')]][_0x47e0('0x6c')]+=0x1;this[_0x47e0('0x21')][_0x3914fc[_0x47e0('0xb4')]][_0x47e0('0x62')]+=0x1;_0x378b92[_0x47e0('0xe8')]=0xb;_0x378b92['statedesc']='Abandoned';_0x378b92[_0x47e0('0x11f')]=_0x47e0('0x126');_0x378b92[_0x47e0('0xf6')]+=0x1;_0x378b92[_0x47e0('0xf0')]+=0x1;if(_0x378b92[_0x47e0('0xf6')]>=this[_0x47e0('0x21')][_0x3914fc[_0x47e0('0xb4')]]['dialAbandonedMaxRetry']){this[_0x47e0('0x121')](_0x378b92);}else{this[_0x47e0('0xc3')]({'active':![],'countabandonedretry':_0x378b92[_0x47e0('0xf6')],'scheduledat':moment()['add'](this[_0x47e0('0x21')][_0x3914fc['queue']][_0x47e0('0x127')],_0x47e0('0x100'))[_0x47e0('0x7e')](_0x47e0('0x101')),'ContactId':_0x307fe9[_0x47e0('0xd3')],'ListId':_0x307fe9[_0x47e0('0x102')],'VoiceQueueId':_0x307fe9[_0x47e0('0xd5')]||undefined,'CampaignId':_0x307fe9[_0x47e0('0xd6')]||undefined})[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x128')));var _0x103b61=new History(_0x378b92);_0x103b61[_0x47e0('0xe8')]=0xb;_0x103b61[_0x47e0('0xa9')]='Abandoned';_0x103b61['starttime']=moment()[_0x47e0('0x7e')](_0x47e0('0x101'));_0x103b61[_0x47e0('0x123')]=_0x103b61[_0x47e0('0xaa')];_0x103b61[_0x47e0('0x124')]=_0x378b92[_0x47e0('0x124')];_0x103b61[_0x47e0('0x125')]=_0x378b92[_0x47e0('0x125')];this[_0x47e0('0xcd')](_0x103b61)['catch'](loggerCatch(_0x47e0('0x129')));}}}}};Dialer[_0x47e0('0x1b')]['syncNewExten']=function(_0x4f9217){if(this[_0x47e0('0x26')][_0x4f9217[_0x47e0('0xe0')]]){this[_0x47e0('0x26')][_0x4f9217[_0x47e0('0xe0')]][_0x47e0('0xb1')]=_0x4f9217[_0x47e0('0xb1')];}if(this['uniqueId'][_0x4f9217[_0x47e0('0xe0')]]){this[_0x47e0('0x28')][_0x4f9217[_0x47e0('0xe0')]][_0x47e0('0xb1')]=_0x4f9217[_0x47e0('0xb1')];}};Dialer[_0x47e0('0x1b')][_0x47e0('0x12a')]=function(_0x2d0e6d){if(strategy[this[_0x47e0('0x21')][this[_0x47e0('0x26')][_0x2d0e6d['actionid']][_0x47e0('0xb4')]][_0x47e0('0x12b')]]===_0x47e0('0x1a')){if(this[_0x47e0('0x26')][_0x2d0e6d[_0x47e0('0x12c')]]&&_['isNil'](this[_0x47e0('0x26')][_0x2d0e6d[_0x47e0('0x12c')]][_0x47e0('0x12d')])&&_0x2d0e6d['status']==='1'&&_0x2d0e6d['paused']==='0'){if(this['agents'][_0x2d0e6d[_0x47e0('0x12e')]]){if(!this['agents'][_0x2d0e6d['stateinterface']][_0x47e0('0x12d')]){this['agents'][_0x2d0e6d[_0x47e0('0x12e')]][_0x47e0('0x12d')]=!![];this[_0x47e0('0x26')][_0x2d0e6d['actionid']][_0x47e0('0x12d')]=!![];this['actions'][_0x2d0e6d[_0x47e0('0x12c')]]['stateinterface']=_0x2d0e6d['stateinterface'];}}}}else if((strategy[this[_0x47e0('0x21')][this[_0x47e0('0x26')][_0x2d0e6d[_0x47e0('0x12c')]][_0x47e0('0xb4')]][_0x47e0('0x12b')]]||_0x47e0('0x19'))===_0x47e0('0x19')){if(this['actions'][_0x2d0e6d['actionid']]){if(this['agents'][_0x2d0e6d['stateinterface']]){this[_0x47e0('0x26')][_0x2d0e6d[_0x47e0('0x12c')]]['stateinterface']=_0x2d0e6d[_0x47e0('0x12e')];if(_[_0x47e0('0xe1')](this['queueBooked'][this['actions'][_0x2d0e6d[_0x47e0('0x12c')]]['queue']])){this[_0x47e0('0x2b')][this['actions'][_0x2d0e6d[_0x47e0('0x12c')]]['queue']]=[];}this[_0x47e0('0x2b')][this['actions'][_0x2d0e6d[_0x47e0('0x12c')]][_0x47e0('0xb4')]]['push'](_[_0x47e0('0x90')](_[_0x47e0('0xd2')](this[_0x47e0('0x26')][_0x2d0e6d[_0x47e0('0x12c')]],[_0x47e0('0x12f'),_0x47e0('0x12e')]),{'status':_0x2d0e6d[_0x47e0('0xb0')],'paused':_0x2d0e6d[_0x47e0('0x130')]}));}}}};function unlockQueueStatus(_0xf714be,_0x12a4ef){setTimeout(function(){if(_['isUndefined'](_0xf714be[_0x47e0('0x131')])){loggerBooked[_0x47e0('0x99')]('[unlockQueueStatus][undefined]',_0x12a4ef);}_0xf714be[_0x47e0('0x131')]=!![];loggerBooked[_0x47e0('0x82')](_0x47e0('0x132'),_0x12a4ef,JSON['stringify'](_[_0x47e0('0xd2')](_0xf714be,['name','queueStatusComplete'])));},0x1f3);}Dialer[_0x47e0('0x1b')]['syncQueueStatusComplete']=function(_0x42ccbf){var _0x4a7986=this;var _0x1fd799=_0x4a7986[_0x47e0('0x21')][_0x4a7986[_0x47e0('0x26')][_0x42ccbf['actionid']][_0x47e0('0xb4')]];if(strategy[this[_0x47e0('0x21')][this[_0x47e0('0x26')][_0x42ccbf[_0x47e0('0x12c')]][_0x47e0('0xb4')]][_0x47e0('0x12b')]]===_0x47e0('0x1a')){if(this['actions'][_0x42ccbf[_0x47e0('0x12c')]]&&this[_0x47e0('0x26')][_0x42ccbf[_0x47e0('0x12c')]][_0x47e0('0x12e')]){this[_0x47e0('0x20')][_0x47e0('0x133')](this[_0x47e0('0x26')][_0x42ccbf[_0x47e0('0x12c')]]['idHopper'],this['actions'][_0x42ccbf[_0x47e0('0x12c')]][_0x47e0('0x12e')])['catch'](function(_0x34d3e3){logger['error'](_0x47e0('0x134'),util[_0x47e0('0x9a')](_0x34d3e3,{'showHidden':![],'depth':null}));})[_0x47e0('0x1e')](function(){_0x4a7986[_0x47e0('0xb3')](_0x4a7986['voiceQueues'][_0x4a7986[_0x47e0('0x26')][_0x42ccbf['actionid']]['queue']]);_0x4a7986[_0x47e0('0x22')][_0x4a7986[_0x47e0('0x26')][_0x42ccbf[_0x47e0('0x12c')]]['stateinterface']][_0x47e0('0x12d')]=![];delete _0x4a7986[_0x47e0('0x26')][_0x42ccbf[_0x47e0('0x12c')]];unlockQueueStatus(_0x1fd799);});}else{this[_0x47e0('0xb3')](this[_0x47e0('0x21')][this[_0x47e0('0x26')][_0x42ccbf['actionid']][_0x47e0('0xb4')]]);this[_0x47e0('0xc3')]({'active':![],'ContactId':this[_0x47e0('0x26')][_0x42ccbf[_0x47e0('0x12c')]][_0x47e0('0xd3')],'ListId':this[_0x47e0('0x26')][_0x42ccbf['actionid']]['ListId'],'VoiceQueueId':this['actions'][_0x42ccbf['actionid']][_0x47e0('0xd5')]||undefined,'CampaignId':this[_0x47e0('0x26')][_0x42ccbf['actionid']][_0x47e0('0xd6')]||undefined})[_0x47e0('0xbb')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x47e0('0x26')][_0x42ccbf[_0x47e0('0x12c')]];unlockQueueStatus(_0x1fd799);}}else if((strategy[this['voiceQueues'][this[_0x47e0('0x26')][_0x42ccbf[_0x47e0('0x12c')]]['queue']]['strategy']]||_0x47e0('0x19'))===_0x47e0('0x19')){var _0x3ef246;if(this[_0x47e0('0x26')][_0x42ccbf['actionid']]&&!_[_0x47e0('0x47')](this[_0x47e0('0x2b')][this[_0x47e0('0x26')][_0x42ccbf[_0x47e0('0x12c')]][_0x47e0('0xb4')]])){if(this[_0x47e0('0x2c')][_0x4a7986['actions'][_0x42ccbf['actionid']][_0x47e0('0xb4')]]){this[_0x47e0('0x2c')][_0x4a7986[_0x47e0('0x26')][_0x42ccbf[_0x47e0('0x12c')]]['queue']]=this[_0x47e0('0x2c')][this[_0x47e0('0x26')][_0x42ccbf['actionid']][_0x47e0('0xb4')]]?this[_0x47e0('0x2c')][this['actions'][_0x42ccbf[_0x47e0('0x12c')]]['queue']]:this[_0x47e0('0x2b')][this[_0x47e0('0x26')][_0x42ccbf[_0x47e0('0x12c')]][_0x47e0('0xb4')]]?this[_0x47e0('0x2b')][this[_0x47e0('0x26')][_0x42ccbf['actionid']]['queue']][_0x47e0('0x135')]||0x0:0x0;}this[_0x47e0('0x2b')][this['actions'][_0x42ccbf['actionid']][_0x47e0('0xb4')]]['_rr']=this[_0x47e0('0x2c')][this['actions'][_0x42ccbf[_0x47e0('0x12c')]]['queue']];for(var _0x2529fd=0x0;_0x2529fd=0x0;})[_0x47e0('0xbb')](myreject(_0x3cf02a)));}}else{_0x29e832[_0x47e0('0x14d')](ami[_0x47e0('0xaf')]({'action':'command','command':util[_0x47e0('0x7e')]('iftime\x20%s,%s',_0xdc204f,!_[_0x47e0('0x3e')](config[_0x47e0('0x143')][_0x1c499c])?_0x1c499c:'')})['then'](function(_0x5dd00f){return _0x5dd00f[_0x47e0('0x14a')][_0x47e0('0x14b')](_0x47e0('0x14c'))>=0x0;})[_0x47e0('0xbb')](myreject(_0x3cf02a)));}BPromise[_0x47e0('0x14e')](_0x29e832)[_0x47e0('0xba')](function(_0x4fd44a){var _0x298941=_[_0x47e0('0x14f')](_0x4fd44a);if(_0x298941){return _0x4f528d(_0x298941);}else{_0x1a78c8[_0x47e0('0x40')]=_0xb33352?_0x47e0('0x150'):'INTERVAL_IS_OVERTIME';return _0x3cf02a(msgResponse('[ifTime][promiseAll]',_0x47e0('0x141'),'Global:\x20'+_0xb33352+'\x20'+_0x270a1e+_0x47e0('0x151')+util['inspect'](_0xdc204f,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1c499c));}})['catch'](function(_0x3bb0cf){return _0x3cf02a(msgResponse(_0x47e0('0x13f'),'Failure',JSON[_0x47e0('0x4a')](_0x3bb0cf)));});});};Dialer[_0x47e0('0x1b')][_0x47e0('0x152')]=function(_0xb0821d){var _0x44f075=this;return function(){switch(_0xb0821d[_0x47e0('0x57')]){case _0x47e0('0x153'):freeVariablesPredictive(_0xb0821d);_0x44f075['handlePower'](_0xb0821d,0x1);break;case _0x47e0('0x154'):freeVariablesPredictive(_0xb0821d);_0x44f075[_0x47e0('0x155')](_0xb0821d,_0xb0821d[_0x47e0('0x156')]);break;case'predictive':_0x44f075[_0x47e0('0xa')](_0xb0821d);break;case _0x47e0('0x9'):freeVariablesPredictive(_0xb0821d);_0x44f075[_0x47e0('0x155')](_0xb0821d,0x1);break;default:freeVariablesPredictive(_0xb0821d);logger['error']('Queue',_0xb0821d['name'],'method\x20not\x20recognized');}};};Dialer[_0x47e0('0x1b')][_0x47e0('0x157')]=function(_0x37ca50){var _0x52f9b5=this;return function(){_0x52f9b5['handleIvr'](_0x37ca50);};};Dialer[_0x47e0('0x1b')][_0x47e0('0xc')]=function(_0x35f09a){var _0x3eb56a=this;if(isNotPreview(_0x35f09a['dialMethod'])){if(isVoiceQueueOutbound(_0x35f09a['type'])&&isActive(_0x35f09a[_0x47e0('0x158')])){_0x35f09a[_0x47e0('0xa3')]=!![];BPromise[_0x47e0('0xc0')]()['then'](checkIsLoggedIn(_0x35f09a,_0x35f09a['loggedIn']))[_0x47e0('0xba')](checkIsActive(_0x35f09a,_0x35f09a['dialActive']))['then'](checkInterval(_0x35f09a))[_0x47e0('0xba')](_0x3eb56a[_0x47e0('0x159')](_0x35f09a))[_0x47e0('0xba')](_0x3eb56a['checkIfTime'](_0x35f09a[_0x47e0('0x15a')],_0x35f09a[_0x47e0('0x15b')],_0x35f09a['name'],_0x35f09a))['then'](_0x3eb56a[_0x47e0('0x13e')](_0x35f09a['Interval'],_0x35f09a[_0x47e0('0x15b')],_0x35f09a[_0x47e0('0x44')],_0x35f09a))[_0x47e0('0xba')](_0x3eb56a['checkDialMethod'](_0x35f09a))[_0x47e0('0xbb')](loggerCatchQueueSummary(_0x47e0('0x15c'),_0x35f09a));}else{notSendMessagesQueue(_0x35f09a);}}else{freeVariablesPredictive(_0x35f09a);}};Dialer['prototype'][_0x47e0('0x15d')]=function(){var _0x46c9fb=this;var _0x553ecd;for(var _0x56e19b in this['campaigns']){if(typeof this[_0x47e0('0x104')][_0x56e19b]!==_0x47e0('0x9d')){_0x553ecd=this[_0x47e0('0x104')][_0x56e19b];if(isCampaignIvr(_0x553ecd[_0x47e0('0x4e')])&&isActive(_0x553ecd[_0x47e0('0x79')])){_0x553ecd[_0x47e0('0xa3')]=!![];BPromise[_0x47e0('0xc0')]()[_0x47e0('0xba')](checkIsActive(_0x553ecd,_0x553ecd[_0x47e0('0x79')]))[_0x47e0('0xba')](checkInterval(_0x553ecd))['then'](_0x46c9fb[_0x47e0('0x159')](_0x553ecd))[_0x47e0('0xba')](_0x46c9fb[_0x47e0('0x15e')](_0x553ecd['dialGlobalInterval'],_0x553ecd[_0x47e0('0x15b')],_0x553ecd['name'],_0x553ecd))[_0x47e0('0xba')](_0x46c9fb[_0x47e0('0x13e')](_0x553ecd[_0x47e0('0x46')],_0x553ecd['dialTimezone'],_0x553ecd[_0x47e0('0x44')],_0x553ecd))['then'](_0x46c9fb[_0x47e0('0x157')](_0x553ecd))[_0x47e0('0xbb')](loggerCatchQueueSummary(_0x47e0('0x15f'),_0x553ecd));}else{notSendMessagesCampaign(_0x553ecd);}}}};function getCallerIdRandom(_0x4a82fd,_0x44a2cf){var _0x113e1f;var _0x11c57f;var _0x419180;if(_0x44a2cf<=0x0){_0x44a2cf=0x1;}_0x113e1f=new RegExp(_0x47e0('0x160')+_0x44a2cf+'}$');_0x11c57f=Math['pow'](0xa,_0x44a2cf-0x1);_0x419180=Math[_0x47e0('0x161')](0xa,_0x44a2cf)-0x1;return util[_0x47e0('0x7e')]('%s',_['replace'](_0x4a82fd,_0x113e1f,_['random'](_0x11c57f,_0x419180)));}function extractCalleridName(_0x2bdd7e){var _0x269ec1=_0x2bdd7e[_0x47e0('0x162')](/"(.*?)"/);return _0x269ec1?_0x269ec1[0x1]:_0x2bdd7e;}function extractCalleridNumber(_0xf873fa){var _0x434437=_0xf873fa['match'](/<(.*?)>/);return _0x434437?_0x434437[0x1]:_0xf873fa;}Dialer[_0x47e0('0x1b')]['actionOriginate']=function(_0x545c6b,_0x7f442b){var _0x179c45=this;var _0x391faa=uuid['v4']();this[_0x47e0('0x26')][_0x391faa]=new Action(_0x545c6b,_0x7f442b,_0x391faa);return new BPromise(function(_0xe7745a,_0x348237){if(_[_0x47e0('0x3e')](_0x545c6b)&&typeof _0x545c6b!==_0x47e0('0x163')){return _0x348237(msgResponse('originate','Failure',_0x47e0('0x164')));}if(_[_0x47e0('0x3e')](_0x7f442b['Contact'][_0x47e0('0x165')])||_0x7f442b[_0x47e0('0x166')]['phone']===null){return _0x348237(msgResponse('originate',_0x47e0('0x141'),_0x47e0('0x167')));}var _0xe09a1c={'XMD-CALLERID':_0x179c45[_0x47e0('0x26')][_0x391faa][_0x47e0('0x168')](),'XMD-AGI':_0x545c6b[_0x47e0('0x10a')]?util[_0x47e0('0x7e')](_0x47e0('0x169'),ipAgi,_0x545c6b[_0x47e0('0x10a')]):_0x47e0('0x16a'),'XMD-AGIAFTER':_0x545c6b['dialQueueProject2']?util['format'](_0x47e0('0x169'),ipAgi,_0x545c6b['dialQueueProject2']):_0x47e0('0x16a'),'XMD-QUEUE':_0x545c6b[_0x47e0('0x4e')]===_0x47e0('0x95')?util[_0x47e0('0x7e')](_0x47e0('0x16b'),_0x545c6b[_0x47e0('0x44')],_0x545c6b[_0x47e0('0x16c')]||'',_0x545c6b[_0x47e0('0x115')]?'c':'',_0x545c6b[_0x47e0('0x11c')]||0x3):_0x47e0('0x16a'),'XMD-CONTACTID':_0x7f442b[_0x47e0('0xd3')],'XMD-CDRTYPE':_0x47e0('0x8'),'CALLERID(all)':_0x179c45[_0x47e0('0x26')][_0x391faa][_0x47e0('0x168')](),'XMD-AMD':_0x545c6b[_0x47e0('0xe5')]?_0x47e0('0x16d'):_0x47e0('0x16a'),'XMD-DESTINATION':_0x47e0('0xe4')};if(_0x545c6b[_0x47e0('0xe5')]){_0xe09a1c['XMD-AMDINITIALSILENCE']=_0x545c6b[_0x47e0('0x16e')]||0x9c4;_0xe09a1c['XMD-AMDGREETING']=_0x545c6b[_0x47e0('0x16f')]||0x5dc;_0xe09a1c['XMD-AMDAFTERGREETINGSILENCE']=_0x545c6b[_0x47e0('0x170')]||0x320;_0xe09a1c[_0x47e0('0x171')]=_0x545c6b[_0x47e0('0x172')]||0x1388;_0xe09a1c[_0x47e0('0x173')]=_0x545c6b[_0x47e0('0x174')]||0x64;_0xe09a1c[_0x47e0('0x175')]=_0x545c6b['dialAMDBetweenWordsSilence']||0x32;_0xe09a1c['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x545c6b['dialAMDMaximumNumberOfWords']||0x3;_0xe09a1c[_0x47e0('0x176')]=_0x545c6b[_0x47e0('0x177')]||0x100;_0xe09a1c[_0x47e0('0x178')]=_0x545c6b[_0x47e0('0x179')]||0x1388;}if(_0x545c6b[_0x47e0('0x4e')]===_0x47e0('0x95')){_0xe09a1c[_0x47e0('0x17a')]=_0x7f442b[_0x47e0('0xd5')];}else{_0xe09a1c[_0x47e0('0x17b')]=_0x7f442b[_0x47e0('0xd6')];}for(var _0x7cbf9a in _0x7f442b['Contact']){if(typeof _0x7f442b[_0x47e0('0x166')][_0x7cbf9a]!=='undefined'){if(isNotNull(_0x7f442b['Contact'][_0x7cbf9a])&&_0x7cbf9a!=='id'&&_0x7cbf9a!==_0x47e0('0x17c')&&_0x7cbf9a!==_0x47e0('0x17d')&&_0x7cbf9a!==_0x47e0('0x17e')){_0xe09a1c[util['format'](_0x47e0('0x17f'),_0x47e0('0x180'),_[_0x47e0('0x181')](_0x7cbf9a))]=_0x7f442b[_0x47e0('0x166')][_0x7cbf9a];}}}var _0x2a79bd=_0x179c45[_0x47e0('0xdb')](_0x545c6b[_0x47e0('0x78')])?getCallerId(_0x545c6b[_0x47e0('0x78')][_0x47e0('0x7a')],_0x545c6b[_0x47e0('0x58')],_0x545c6b['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x545c6b[_0x47e0('0x59')],_0x545c6b[_0x47e0('0x182')]):_0x545c6b[_0x47e0('0x59')]):getCallerId(_[_0x47e0('0xe1')](_0x545c6b['TrunkBackup'])?_0x545c6b[_0x47e0('0x78')]['callerid']:_0x545c6b['TrunkBackup'][_0x47e0('0x7a')],_0x545c6b[_0x47e0('0x58')],_0x545c6b[_0x47e0('0x182')]>0x0?getCallerIdRandom(_0x545c6b['dialOriginateCallerIdNumber'],_0x545c6b[_0x47e0('0x182')]):_0x545c6b['dialOriginateCallerIdNumber']);if(_0x2a79bd){_0xe09a1c['XMD-ORIGINATECALLERIDNAME']=_0x179c45[_0x47e0('0x26')][_0x391faa]['originatecalleridname']=extractCalleridName(_0x2a79bd);_0xe09a1c[_0x47e0('0x183')]=_0x179c45[_0x47e0('0x26')][_0x391faa][_0x47e0('0x184')]=extractCalleridNumber(_0x2a79bd);}return ami[_0x47e0('0xaf')]({'actionid':_0x391faa,'action':_0x47e0('0x185'),'channel':_0x179c45[_0x47e0('0xdb')](_0x545c6b['Trunk'])?util[_0x47e0('0x7e')](_0x47e0('0x186'),_0x545c6b[_0x47e0('0x78')][_0x47e0('0x44')],isNotNull(_0x545c6b[_0x47e0('0x5b')])?_0x545c6b[_0x47e0('0x5b')][_0x47e0('0x187')]()||'':'',_0x545c6b[_0x47e0('0x188')]>0x0?_0x7f442b[_0x47e0('0x166')][_0x47e0('0x165')][_0x47e0('0x189')](_0x545c6b[_0x47e0('0x188')]):_0x7f442b[_0x47e0('0x166')][_0x47e0('0x165')]):util[_0x47e0('0x7e')](_0x47e0('0x186'),_[_0x47e0('0xe1')](_0x545c6b['TrunkBackup'])?_0x545c6b[_0x47e0('0x78')][_0x47e0('0x44')]:_0x545c6b[_0x47e0('0x18a')]['name'],isNotNull(_0x545c6b['dialPrefix'])?_0x545c6b[_0x47e0('0x5b')][_0x47e0('0x187')]()||'':'',_0x545c6b[_0x47e0('0x188')]>0x0?_0x7f442b[_0x47e0('0x166')][_0x47e0('0x165')][_0x47e0('0x189')](_0x545c6b[_0x47e0('0x188')]):_0x7f442b[_0x47e0('0x166')][_0x47e0('0x165')]),'callerid':_0x2a79bd,'Exten':_0x47e0('0xe4'),'Context':_0x47e0('0x18b'),'Priority':'1','variable':_0xe09a1c,'timeout':(_0x545c6b[_0x47e0('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x391faa})['then'](function(_0x4c844d){return _0xe7745a(_0x4c844d);})[_0x47e0('0xbb')](function(_0x5a3503){_0x545c6b[_0x47e0('0x65')]+=0x1;var _0x4636dc=new History(_0x179c45['actions'][_0x391faa]);logger[_0x47e0('0x99')](util['format'](_0x47e0('0x18c'),JSON[_0x47e0('0x4a')](_0x5a3503)));_0x4636dc[_0x47e0('0xe8')]=0xe;_0x4636dc[_0x47e0('0xa9')]='OriginateError';_0x4636dc[_0x47e0('0xaa')]=moment()[_0x47e0('0x7e')](_0x47e0('0x101'));_0x4636dc[_0x47e0('0x123')]=_0x4636dc[_0x47e0('0xaa')];_0x179c45[_0x47e0('0xcd')](_0x4636dc)[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x18d')));_0x179c45[_0x47e0('0xcb')](_0x4636dc)[_0x47e0('0xbb')](loggerCatch('[originate][error]'))[_0x47e0('0x1e')](function(){delete _0x179c45[_0x47e0('0x26')][_0x391faa];return _0x348237(msgResponse('originate',_0x47e0('0x49'),_0x47e0('0x18e')));});});});};Dialer[_0x47e0('0x1b')][_0x47e0('0x32')]=function(_0x42dee8){var _0x1a440f=this['actions'][_0x42dee8[_0x47e0('0x12c')]];if(_0x1a440f){delete this[_0x47e0('0x26')][_0x42dee8[_0x47e0('0x12c')]];_0x1a440f[_0x47e0('0x11b')]=moment()[_0x47e0('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x32805e=_0x1a440f[_0x47e0('0x4e')]===_0x47e0('0x7d')?this[_0x47e0('0x104')][_0x1a440f[_0x47e0('0xb4')]]:this[_0x47e0('0x21')][_0x1a440f[_0x47e0('0x18f')]()];if(!this['isSuccess'](_0x42dee8[_0x47e0('0x190')])){this[_0x47e0('0xb3')](_0x32805e);return this[_0x47e0('0x191')](_0x1a440f,_0x32805e,_0x42dee8)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x42dee8[_0x47e0('0xe0')]]=_0x1a440f;}};Dialer[_0x47e0('0x1b')]['checkRetriveMax']=function(_0x279bac,_0x28fc5e,_0x1349b0){var _0x59ec0d=new History(_0x28fc5e);if(_0x59ec0d[_0x47e0('0xf2')]+_0x59ec0d[_0x47e0('0x109')]+_0x59ec0d[_0x47e0('0xf3')]+_0x59ec0d[_0x47e0('0xf4')]+_0x59ec0d[_0x47e0('0xf5')]+_0x59ec0d['countabandonedretry']+_0x59ec0d[_0x47e0('0xef')]+_0x59ec0d['countagentrejectretry']>=_0x1349b0[_0x47e0('0xf8')]-0x1){return!![];}switch(_0x279bac){case 0x3:if(_0x59ec0d[_0x47e0('0xf3')]>=_0x1349b0[_0x47e0('0x192')]-0x1){return!![];}this[_0x47e0('0xc3')]({'active':![],'countnoanswerretry':_0x59ec0d[_0x47e0('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x1349b0['dialNoAnswerRetryFrequency'],'minutes')['format'](_0x47e0('0x101')),'ContactId':_0x59ec0d[_0x47e0('0xd3')],'ListId':_0x59ec0d[_0x47e0('0x102')],'VoiceQueueId':_0x59ec0d['VoiceQueueId']||undefined,'CampaignId':_0x59ec0d[_0x47e0('0xd6')]||undefined})['catch'](loggerCatch(_0x47e0('0x193')));break;case 0x5:if(_0x59ec0d[_0x47e0('0xf2')]>=_0x1349b0[_0x47e0('0x194')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x59ec0d[_0x47e0('0xf2')]+=0x1,'scheduledat':moment()[_0x47e0('0xfe')](_0x1349b0[_0x47e0('0x195')],'minutes')['format'](_0x47e0('0x101')),'ContactId':_0x59ec0d[_0x47e0('0xd3')],'ListId':_0x59ec0d[_0x47e0('0x102')],'VoiceQueueId':_0x59ec0d[_0x47e0('0xd5')]||undefined,'CampaignId':_0x59ec0d[_0x47e0('0xd6')]||undefined})['catch'](loggerCatch(_0x47e0('0x196')));break;case 0x8:if(_0x59ec0d[_0x47e0('0x109')]>=_0x1349b0[_0x47e0('0x197')]-0x1){return!![];}this[_0x47e0('0xc3')]({'active':![],'countcongestionretry':_0x59ec0d[_0x47e0('0x109')]+=0x1,'scheduledat':moment()[_0x47e0('0xfe')](_0x1349b0[_0x47e0('0x198')],_0x47e0('0x100'))[_0x47e0('0x7e')](_0x47e0('0x101')),'ContactId':_0x59ec0d['ContactId'],'ListId':_0x59ec0d[_0x47e0('0x102')],'VoiceQueueId':_0x59ec0d['VoiceQueueId']||undefined,'CampaignId':_0x59ec0d['CampaignId']||undefined})[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x199')));break;case 0x0:if(_0x59ec0d[_0x47e0('0xf4')]>=_0x1349b0[_0x47e0('0x19a')]-0x1){return!![];}else{this[_0x47e0('0xc3')]({'active':![],'countnosuchnumberretry':_0x59ec0d['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x47e0('0xfe')](_0x1349b0[_0x47e0('0x19b')],_0x47e0('0x100'))[_0x47e0('0x7e')](_0x47e0('0x101')),'ContactId':_0x59ec0d[_0x47e0('0xd3')],'ListId':_0x59ec0d[_0x47e0('0x102')],'VoiceQueueId':_0x59ec0d[_0x47e0('0xd5')]||undefined,'CampaignId':_0x59ec0d[_0x47e0('0xd6')]||undefined})[_0x47e0('0xbb')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x59ec0d[_0x47e0('0xf5')]>=_0x1349b0[_0x47e0('0x120')]-0x1){return!![];}this[_0x47e0('0xc3')]({'active':![],'countdropretry':_0x59ec0d['countdropretry']+=0x1,'scheduledat':moment()[_0x47e0('0xfe')](_0x1349b0[_0x47e0('0x19c')],_0x47e0('0x100'))[_0x47e0('0x7e')](_0x47e0('0x101')),'ContactId':_0x59ec0d[_0x47e0('0xd3')],'ListId':_0x59ec0d[_0x47e0('0x102')],'VoiceQueueId':_0x59ec0d[_0x47e0('0xd5')]||undefined,'CampaignId':_0x59ec0d[_0x47e0('0xd6')]||undefined})[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x122')));break;case 0xb:if(_0x59ec0d[_0x47e0('0xf6')]>=_0x1349b0[_0x47e0('0x19d')]-0x1){return!![];}this[_0x47e0('0xc3')]({'active':![],'countabandonedretry':_0x59ec0d['countabandonedretry']+=0x1,'scheduledat':moment()[_0x47e0('0xfe')](_0x1349b0[_0x47e0('0x127')],_0x47e0('0x100'))['format'](_0x47e0('0x101')),'ContactId':_0x59ec0d[_0x47e0('0xd3')],'ListId':_0x59ec0d['ListId'],'VoiceQueueId':_0x59ec0d[_0x47e0('0xd5')]||undefined,'CampaignId':_0x59ec0d['CampaignId']||undefined})[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x128')));break;case 0x13:if(_0x59ec0d['countmachineretry']>=_0x1349b0[_0x47e0('0xfb')]-0x1){return!![];}this[_0x47e0('0xc3')]({'active':![],'countmachineretry':_0x59ec0d[_0x47e0('0xef')]+=0x1,'scheduledat':moment()[_0x47e0('0xfe')](_0x1349b0[_0x47e0('0xff')],'minutes')[_0x47e0('0x7e')](_0x47e0('0x101')),'ContactId':_0x59ec0d[_0x47e0('0xd3')],'ListId':_0x59ec0d[_0x47e0('0x102')],'VoiceQueueId':_0x59ec0d[_0x47e0('0xd5')]||undefined,'CampaignId':_0x59ec0d[_0x47e0('0xd6')]||undefined})[_0x47e0('0xbb')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x59ec0d['countagentrejectretry']>=_0x1349b0[_0x47e0('0x19e')]-0x1){return!![];}this[_0x47e0('0xc3')]({'active':![],'countagentrejectretry':_0x59ec0d['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x47e0('0xfe')](_0x1349b0[_0x47e0('0x19f')],_0x47e0('0x100'))[_0x47e0('0x7e')](_0x47e0('0x101')),'ContactId':_0x59ec0d[_0x47e0('0xd3')],'ListId':_0x59ec0d[_0x47e0('0x102')],'VoiceQueueId':_0x59ec0d['VoiceQueueId']||undefined,'CampaignId':_0x59ec0d[_0x47e0('0xd6')]||undefined})['catch'](loggerCatch(_0x47e0('0x1a0')));break;default:return!![];}};Dialer[_0x47e0('0x1b')][_0x47e0('0x191')]=function(_0x1b6589,_0x15ad2f,_0x20739c){var _0xd3e6d7=this;var _0x5ceae6=new History(_0x1b6589);return new BPromise(function(_0x5df331,_0x4a7d8f){if(_[_0x47e0('0x3e')](_0x15ad2f)&&typeof _0x15ad2f!=='object'){return _0x4a7d8f(msgResponse(_0x47e0('0x1a1'),_0x47e0('0x141'),_0x47e0('0x1a2')));}if(_[_0x47e0('0x3e')](_0x20739c)&&typeof _0x20739c!=='object'){return _0x4a7d8f(msgResponse(_0x47e0('0x1a1'),'Failure',_0x47e0('0x1a3')));}switch(_0x20739c['reason']){case'0':_0x15ad2f[_0x47e0('0x64')]+=0x1;_0x5ceae6[_0x47e0('0xe8')]=0x0;_0x5ceae6[_0x47e0('0xa9')]=_0x47e0('0x1a4');_0x5ceae6[_0x47e0('0xf4')]+=0x1;_0x5ceae6['countglobal']+=0x1;ami[_0x47e0('0x4d')](_0x47e0('0x1a5'),ut[_0x47e0('0x1a6')](_0x1b6589,_0x47e0('0x1a7')));_0xd3e6d7[_0x47e0('0xcd')](_0x5ceae6)['catch'](loggerCatch(_0x47e0('0xf1')));if(_0xd3e6d7[_0x47e0('0x1a8')](0x0,_0x1b6589,_0x15ad2f)){if(_0x5ceae6[_0x47e0('0xf4')]>=_0x15ad2f[_0x47e0('0x19a')]){_0xd3e6d7[_0x47e0('0xfc')](_0x5ceae6,_0x5df331,_0x4a7d8f,_0x47e0('0x1a9'));}else{_0xd3e6d7[_0x47e0('0xf9')](_0x5ceae6,_0x5df331,_0x4a7d8f,_0x47e0('0x1a9'));}}break;case'3':_0x15ad2f['outboundNoAnswerCallsDay']+=0x1;_0x5ceae6[_0x47e0('0xe8')]=0x3;_0x5ceae6['statedesc']=_0x47e0('0x1aa');_0x5ceae6[_0x47e0('0xf3')]+=0x1;_0x5ceae6[_0x47e0('0xf0')]+=0x1;ami[_0x47e0('0x4d')](_0x47e0('0x1ab'),ut[_0x47e0('0x1a6')](_0x1b6589,_0x47e0('0x1ac')));_0xd3e6d7['createHistory'](_0x5ceae6)['catch'](loggerCatch(_0x47e0('0x1ad')));if(_0xd3e6d7[_0x47e0('0x1a8')](0x3,_0x1b6589,_0x15ad2f)){if(_0x5ceae6[_0x47e0('0xf3')]>=_0x15ad2f[_0x47e0('0x192')]){_0xd3e6d7[_0x47e0('0xfc')](_0x5ceae6,_0x5df331,_0x4a7d8f,_0x47e0('0x1ae'));}else{_0xd3e6d7[_0x47e0('0xf9')](_0x5ceae6,_0x5df331,_0x4a7d8f,_0x47e0('0x1ae'));}}break;case'5':_0x15ad2f[_0x47e0('0x5f')]+=0x1;_0x5ceae6[_0x47e0('0xe8')]=0x5;_0x5ceae6['statedesc']='Busy';_0x5ceae6[_0x47e0('0xf2')]+=0x1;_0x5ceae6[_0x47e0('0xf0')]+=0x1;ami['emit'](_0x47e0('0x1af'),ut['buildObj'](_0x1b6589,'busy'));_0xd3e6d7[_0x47e0('0xcd')](_0x5ceae6)[_0x47e0('0xbb')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0xd3e6d7[_0x47e0('0x1a8')](0x5,_0x1b6589,_0x15ad2f)){if(_0x5ceae6[_0x47e0('0xf2')]>=_0x15ad2f[_0x47e0('0x194')]){_0xd3e6d7['createStateFinal'](_0x5ceae6,_0x5df331,_0x4a7d8f,_0x47e0('0x1b0'));}else{_0xd3e6d7[_0x47e0('0xf9')](_0x5ceae6,_0x5df331,_0x4a7d8f,_0x47e0('0x1b0'));}}break;case'8':_0x15ad2f[_0x47e0('0x60')]+=0x1;_0x5ceae6['state']=0x8;_0x5ceae6['statedesc']=_0x47e0('0x1b1');_0x5ceae6[_0x47e0('0x109')]+=0x1;_0x5ceae6[_0x47e0('0xf0')]+=0x1;ami[_0x47e0('0x4d')]('custom:agentcongestion',ut['buildObj'](_0x1b6589,_0x47e0('0x1b2')));_0xd3e6d7[_0x47e0('0xcd')](_0x5ceae6)['catch'](loggerCatch(_0x47e0('0x1b3')));if(_0xd3e6d7['checkRetriveMax'](0x8,_0x1b6589,_0x15ad2f)){if(_0x5ceae6[_0x47e0('0x109')]>=_0x15ad2f[_0x47e0('0x197')]){_0xd3e6d7[_0x47e0('0xfc')](_0x5ceae6,_0x5df331,_0x4a7d8f,_0x47e0('0x1b4'));}else{_0xd3e6d7[_0x47e0('0xf9')](_0x5ceae6,_0x5df331,_0x4a7d8f,_0x47e0('0x1b4'));}}break;case'11':_0x15ad2f[_0x47e0('0x1b5')]+=0x1;_0x5ceae6['state']=0xb;_0x5ceae6[_0x47e0('0xa9')]='Abandoned';_0x5ceae6[_0x47e0('0xf6')]+=0x1;_0x5ceae6[_0x47e0('0xf0')]+=0x1;_0xd3e6d7[_0x47e0('0xcd')](_0x5ceae6)['catch'](loggerCatch(_0x47e0('0x129')));if(_0xd3e6d7[_0x47e0('0x1a8')](0xb,_0x1b6589,_0x15ad2f)){if(_0x5ceae6['countabandonedretry']>=_0x15ad2f[_0x47e0('0x19d')]){_0xd3e6d7[_0x47e0('0xfc')](_0x5ceae6,_0x5df331,_0x4a7d8f,_0x47e0('0x1b6'));}else{_0xd3e6d7['stateGlobal'](_0x5ceae6,_0x5df331,_0x4a7d8f,'reason\x2011\x20abandoned');}}break;case'20':_0x15ad2f['outboundRejectCallsDay']+=0x1;_0x5ceae6[_0x47e0('0xe8')]=0x14;_0x5ceae6[_0x47e0('0xa9')]=_0x47e0('0x1b7');_0x5ceae6['countagentrejectretry']+=0x1;_0x5ceae6['countglobal']+=0x1;ami[_0x47e0('0x4d')](_0x47e0('0x1b8'),ut['buildObj'](_0x1b6589,_0x47e0('0x1b9')));_0xd3e6d7['createHistory'](_0x5ceae6)[_0x47e0('0xbb')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0xd3e6d7[_0x47e0('0x1a8')](0x14,_0x1b6589,_0x15ad2f)){if(_0x5ceae6[_0x47e0('0xf7')]>=_0x15ad2f[_0x47e0('0x19e')]){_0xd3e6d7['createStateFinal'](_0x5ceae6,_0x5df331,_0x4a7d8f,_0x47e0('0x1ba'));}else{_0xd3e6d7[_0x47e0('0xf9')](_0x5ceae6,_0x5df331,_0x4a7d8f,'reason\x2020\x20agentreject');}}break;default:_0x15ad2f[_0x47e0('0x68')]+=0x1;_0x5ceae6[_0x47e0('0xe8')]=0xc;_0x5ceae6[_0x47e0('0xa9')]=_0x20739c[_0x47e0('0x111')];_0xd3e6d7[_0x47e0('0xcd')](_0x5ceae6)[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x1bb')));if(_0xd3e6d7[_0x47e0('0x1a8')](_0x20739c[_0x47e0('0x111')],_0x1b6589,_0x15ad2f)){if(_0x5ceae6['countbusyretry']+_0x5ceae6[_0x47e0('0x109')]+_0x5ceae6['countnoanswerretry']+_0x5ceae6[_0x47e0('0xf4')]+_0x5ceae6[_0x47e0('0xf5')]+_0x5ceae6[_0x47e0('0xf6')]+_0x5ceae6[_0x47e0('0xef')]+_0x5ceae6['countagentrejectretry']>=_0x15ad2f['dialGlobalMaxRetry']){_0xd3e6d7['stateGlobal'](_0x5ceae6,_0x5df331,_0x4a7d8f,_0x20739c[_0x47e0('0x111')]);}else{_0xd3e6d7['createStateFinal'](_0x5ceae6,_0x5df331,_0x4a7d8f,_0x20739c[_0x47e0('0x111')]);}}}});};Dialer[_0x47e0('0x1b')][_0x47e0('0xf9')]=function(_0x12d8b1,_0x174225,_0x495de0,_0x44c37c){var _0x3c7d8d=new Final(_0x12d8b1);_0x3c7d8d['state']=0xf;_0x3c7d8d[_0x47e0('0xa9')]=_0x47e0('0x1bc');this[_0x47e0('0xfc')](_0x3c7d8d,_0x174225,_0x495de0,_0x44c37c);};Dialer['prototype']['createStateFinal']=function(_0x3462da,_0x578004,_0x3b2841,_0x495486){this[_0x47e0('0xcb')](_0x3462da)[_0x47e0('0xba')](function(){return _0x578004(msgResponse(_0x47e0('0x1a1'),_0x47e0('0xda'),_0x495486));})[_0x47e0('0xbb')](function(){return _0x3b2841(msgResponse(_0x47e0('0x1bd'),_0x47e0('0x141'),_0x47e0('0x1be')));});};Dialer[_0x47e0('0x1b')][_0x47e0('0xa')]=function(_0x1a4d46){var _0x56e563=_0x1a4d46['dialPredictiveOptimizationPercentage']/0x64;var _0x5122fe=_0x1a4d46[_0x47e0('0x11d')]/(_0x1a4d46['outboundDropCallsDayTimeout']+_0x1a4d46[_0x47e0('0x5d')]);var _0x5ee55f=Math[_0x47e0('0x1bf')](_0x1a4d46[_0x47e0('0x71')]*(_0x1a4d46[_0x47e0('0x1c0')]/0x64));var _0x400918=Math[_0x47e0('0x1bf')](_0x1a4d46['predictiveIntervalAvailable']*(_0x1a4d46[_0x47e0('0x1c1')]/0x64));var _0x66b766=_0x1a4d46[_0x47e0('0x4f')]+_0x1a4d46[_0x47e0('0xa4')];var _0x14bd75=Math[_0x47e0('0x1c2')](_0x1a4d46[_0x47e0('0x8c')]*_0x1a4d46[_0x47e0('0x75')]*_0x1a4d46[_0x47e0('0x6f')]*_0x1a4d46[_0x47e0('0x1c3')]);if(_[_0x47e0('0x3e')](_0x1a4d46[_0x47e0('0x29')])){if(!_['isUndefined'](_0x1a4d46['startPredictive'])){_0x1a4d46['startPredictive']=undefined;loggerPredictive[_0x47e0('0x99')]('[startMethodPredictive][StartProgressive]',_0x47e0('0x1c4'));}if(!_[_0x47e0('0x3e')](_0x1a4d46[_0x47e0('0x94')])){loggerPredictive[_0x47e0('0x99')](_0x47e0('0x1c5'),_0x47e0('0x1c6'));clearInterval(_0x1a4d46[_0x47e0('0x94')]);_0x1a4d46[_0x47e0('0x94')]=undefined;}_0x1a4d46['startProgressive']=moment()[_0x47e0('0x7e')](_0x47e0('0x101'));loggerPredictive[_0x47e0('0x82')](_0x1a4d46[_0x47e0('0x44')],_0x47e0('0x1c7'),_0x1a4d46[_0x47e0('0x29')]);this['handlePower'](_0x1a4d46,0x1);}else if(ifInterval(_0x1a4d46[_0x47e0('0x1c8')],_0x1a4d46[_0x47e0('0x29')])){this[_0x47e0('0x155')](_0x1a4d46,0x1);loggerPredictiveCalls[_0x47e0('0x82')](_0x47e0('0x1c9'),_0x1a4d46[_0x47e0('0x29')],_0x1a4d46['name']);_0x1a4d46[_0x47e0('0x8c')]=0x0;_0x1a4d46[_0x47e0('0x6e')]=0x0;}else if(_0x56e563<_0x5122fe&&_0x1a4d46[_0x47e0('0x1ca')]===_0x47e0('0x1cb')){freeVariablesPredictive(_0x1a4d46);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x47e0('0x1cc'),_0x5122fe,_0x47e0('0x29'),_0x1a4d46[_0x47e0('0x44')]);}else if(_0x14bd75<_0x1a4d46[_0x47e0('0x6e')]&&_0x1a4d46[_0x47e0('0x1ca')]===_0x47e0('0x1cb')){freeVariablesPredictive(_0x1a4d46);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x1cd'),'Max\x20Drop\x20',_0x14bd75,'Drop\x20in\x20this\x20interval',_0x1a4d46[_0x47e0('0x6e')],'startProgressive',_0x1a4d46[_0x47e0('0x44')]);}else if(!ifInterval(_0x1a4d46['dialPredictiveInterval'],_0x1a4d46[_0x47e0('0x29')])&&_[_0x47e0('0x3e')](_0x1a4d46['startPredictive'])&&!_[_0x47e0('0x3e')](_0x1a4d46['startProgressive'])){_0x1a4d46['startPredictive']=moment()[_0x47e0('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x47e0('0x82')](_0x1a4d46[_0x47e0('0x44')],'started\x20in\x20predictive\x20at',_0x1a4d46[_0x47e0('0x77')]);this[_0x47e0('0xbf')](_0x1a4d46['dialPredictiveInterval'])[_0x47e0('0xba')](this[_0x47e0('0x1ce')](_0x1a4d46))[_0x47e0('0xba')](mergeDataErlangB(_0x1a4d46))[_0x47e0('0xba')](this[_0x47e0('0x1cf')](_0x1a4d46))[_0x47e0('0xbb')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x1a4d46));}else if(!ifInterval(_0x1a4d46[_0x47e0('0x1c8')],_0x1a4d46[_0x47e0('0x77')])){_0x1a4d46[_0x47e0('0x6e')]=0x0;_0x1a4d46[_0x47e0('0x77')]=moment()[_0x47e0('0x7e')](_0x47e0('0x101'));loggerPredictive[_0x47e0('0x82')](_0x1a4d46[_0x47e0('0x44')],_0x47e0('0x1d0'),_0x1a4d46[_0x47e0('0x77')]);clearInterval(_0x1a4d46[_0x47e0('0x94')]);_0x1a4d46[_0x47e0('0x94')]=undefined;this['averageHandleTime'](_0x1a4d46['dialPredictiveInterval'])[_0x47e0('0xba')](this[_0x47e0('0x1ce')](_0x1a4d46))[_0x47e0('0xba')](mergeDataErlangB(_0x1a4d46))[_0x47e0('0xba')](this['startMethodPredictive'](_0x1a4d46))['catch'](loggerCatchPredictive(_0x47e0('0x1d1'),_0x1a4d46));}else if(_0x1a4d46[_0x47e0('0x71')]&&_0x66b766<_0x1a4d46[_0x47e0('0x71')]-_0x400918){freeVariablesPredictive(_0x1a4d46);loggerPredictive[_0x47e0('0x82')](_0x1a4d46[_0x47e0('0x44')],_0x47e0('0x1d2'),_0x66b766,_0x47e0('0x1d3'),_0x1a4d46[_0x47e0('0x71')],'-',_0x400918,'=',_0x1a4d46[_0x47e0('0x71')]-_0x400918,')');}else if(_0x1a4d46[_0x47e0('0x71')]&&_0x66b766>_0x1a4d46['predictiveIntervalAvailable']+_0x5ee55f){freeVariablesPredictive(_0x1a4d46);loggerPredictive['info'](_0x1a4d46['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x66b766,_0x47e0('0x1d4'),_0x1a4d46[_0x47e0('0x71')],'+',_0x5ee55f,'=',_0x1a4d46[_0x47e0('0x71')]+_0x5ee55f,')');}};Dialer['prototype'][_0x47e0('0x1ce')]=function(_0x5f682b){var _0x261de9=this;return function(_0x5daa76){return new BPromise(function(_0xa5accf,_0x592585){_[_0x47e0('0x90')](_0x5f682b,_0x5daa76[0x0]);if(checkGetDataPredictive(_0x5daa76[0x0])){var _0x1fe0d3=_0x5f682b[_0x47e0('0x71')]=_0x5f682b[_0x47e0('0xa4')]+_0x5f682b[_0x47e0('0x4f')];var _0x4d0def=_0x5f682b[_0x47e0('0x1c8')]*0x3c;var _0x55cb36=_0x5daa76[0x0]['predictiveIntervalAvgTalktime']+_0x5daa76[0x0]['predictiveIntervalAvgHoldtime'];var _0x424fa8=(_0x5daa76[0x0]['predictiveIntervalAnsweredCalls']+_0x5daa76[0x0][_0x47e0('0x84')]+_0x5daa76[0x0][_0x47e0('0x6c')])/_0x5daa76[0x0]['predictiveIntervalTotalCalls'];_0x5f682b[_0x47e0('0x6f')]=_0x424fa8>0x0?_0x424fa8:0x1;switch(_0x5f682b['dialPredictiveOptimization']){case _0x47e0('0x1cb'):var _0x1096b3=_0x5f682b[_0x47e0('0x1d5')]/0x64;return _0x261de9[_0x47e0('0x1d6')](_0x1fe0d3,_0x4d0def,_0x55cb36,_0x424fa8,_0x1096b3)[_0x47e0('0xba')](function(_0x42cf3e){return _0xa5accf(_0x42cf3e);});case _0x47e0('0x1d7'):var _0x249624=_0x5f682b[_0x47e0('0x1d5')]/0x64;return _0x261de9[_0x47e0('0x1d8')](_0x1fe0d3,_0x4d0def,_0x55cb36,_0x424fa8,_0x249624)['then'](function(_0x35a8c5){return _0xa5accf(_0x35a8c5);});default:return _0x592585(msgResponse(_0x47e0('0x1d9'),_0x47e0('0x141'),'Unknown\x20Predictive'));}}else{return _0x592585(msgResponse(_0x47e0('0x1d9'),_0x47e0('0x141'),_0x47e0('0x1da')));}});};};Dialer[_0x47e0('0x1b')][_0x47e0('0x1db')]=function(_0x472b8a){var _0x4bd052=this;return function(_0x2b9507){return new BPromise(function(_0x16411d,_0x245fbb){_[_0x47e0('0x90')](_0x472b8a,_0x2b9507[0x0]);if(checkGetDataPredictive(_0x2b9507[0x0])){loggerPredictive[_0x47e0('0x82')](JSON[_0x47e0('0x4a')](_0x2b9507[0x0]));if(_0x472b8a[_0x47e0('0x1ca')]===_0x47e0('0x1cb')){return _0x4bd052[_0x47e0('0xc9')](_0x472b8a['id'])[_0x47e0('0xba')](function(_0x473f12){var _0x1b1ff9=_0x472b8a[_0x47e0('0x1dc')]-_0x473f12[0x0][_0x47e0('0x1dd')];var _0x2c00f7=_0x472b8a[_0x47e0('0x1c8')]*0x3c;var _0x8deb60=_0x2b9507[0x0][_0x47e0('0x6b')]+_0x2b9507[0x0][_0x47e0('0x6a')];var _0x17fbf2=(_0x2b9507[0x0][_0x47e0('0x69')]+_0x2b9507[0x0][_0x47e0('0x84')]+_0x2b9507[0x0][_0x47e0('0x6c')])/_0x2b9507[0x0][_0x47e0('0x72')];var _0x46bbe9=_0x472b8a[_0x47e0('0x1d5')]/0x64;_0x472b8a['predictiveIntervalPauses']=_0x473f12[0x0][_0x47e0('0x1dd')]||0x0;_0x472b8a[_0x47e0('0x6f')]=_0x17fbf2>0x0?_0x17fbf2:0x1;return _0x4bd052['abandonmentRate'](_0x1b1ff9,_0x2c00f7,_0x8deb60,_0x17fbf2,_0x46bbe9);})[_0x47e0('0xba')](function(_0x21e526){return _0x16411d(_0x21e526);})[_0x47e0('0xbb')](function(_0x11dc93){return _0x245fbb(msgResponse('[CatchErlangB]',_0x47e0('0x141'),JSON[_0x47e0('0x4a')](_0x11dc93)));});}if(_0x472b8a[_0x47e0('0x1ca')]===_0x47e0('0x1d7')){return _0x4bd052[_0x47e0('0xc9')](_0x472b8a['id'])[_0x47e0('0xba')](function(_0x493a7f){var _0x16f43f=_0x472b8a['loggedIn']-_0x493a7f[0x0][_0x47e0('0x1dd')];var _0x59784b=_0x472b8a[_0x47e0('0x1c8')]*0x3c;var _0x40aba9=_0x2b9507[0x0][_0x47e0('0x6b')]+_0x2b9507[0x0]['predictiveIntervalAvgHoldtime'];var _0x2a59cb=(_0x2b9507[0x0][_0x47e0('0x69')]+_0x2b9507[0x0][_0x47e0('0x84')]+_0x2b9507[0x0][_0x47e0('0x6c')])/_0x2b9507[0x0]['predictiveIntervalTotalCalls'];var _0x29337a=_0x472b8a[_0x47e0('0x1d5')]/0x64;_0x472b8a[_0x47e0('0x70')]=_0x493a7f[0x0][_0x47e0('0x1dd')]||0x0;_0x472b8a[_0x47e0('0x6f')]=_0x2a59cb>0x0?_0x2a59cb:0x1;return _0x4bd052[_0x47e0('0x1d8')](_0x16f43f,_0x59784b,_0x40aba9,_0x2a59cb,_0x29337a);})['then'](function(_0x13d13b){return _0x16411d(_0x13d13b);})[_0x47e0('0xbb')](function(_0x3af34f){return _0x245fbb(msgResponse(_0x47e0('0x1de'),_0x47e0('0x141'),JSON[_0x47e0('0x4a')](_0x3af34f)));});}}else{return _0x245fbb(msgResponse(_0x47e0('0x1d9'),_0x47e0('0x141'),_0x47e0('0x1da')));}});};};Dialer[_0x47e0('0x1b')]['startMethodPredictive']=function(_0x122f67){var _0x212ebf=this;return function(){var _0x4c6756=0x0;var _0x45f6be=Math[_0x47e0('0x1c2')](_0x122f67['erlangCallToSecond']*0x3e8);if(_0x45f6be>0x0){_0x45f6be=_0x45f6be<0x64?0x64:_0x45f6be;loggerPredictive['info'](_0x122f67[_0x47e0('0x44')],_0x47e0('0x1df'),_0x45f6be,_0x47e0('0x4b'));_0x122f67[_0x47e0('0x94')]=setInterval(function(){_0x212ebf['handlePredictive'](_0x122f67);loggerPredictiveCalls[_0x47e0('0x82')](_0x47e0('0x1e0'),_0x4c6756+=0x1);},_0x45f6be);}else{loggerPredictive['info'](_0x122f67['name'],_0x47e0('0x1e1'));}};};Dialer['prototype'][_0x47e0('0x1e2')]=function(_0x16448c,_0x23e41b){var _0x187a73=this;return function(_0x5f421d){if(_[_0x47e0('0x47')](_0x5f421d)){if(_[_0x47e0('0xe1')](_0x23e41b[_0x47e0('0xd4')])||!_0x23e41b[_0x47e0('0x1e3')]){if(_0x16448c[_0x47e0('0x57')]===_0x47e0('0x9')){_0x16448c['queueStatusComplete']=_[_0x47e0('0x3e')](_0x16448c[_0x47e0('0x131')])?!![]:_0x16448c[_0x47e0('0x131')];var _0x3ad319=uuid['v4']();_0x187a73[_0x47e0('0x26')][_0x3ad319]=new Action(_0x16448c,_0x23e41b,_0x3ad319);loggerBooked['info'](_0x47e0('0x1e4'),_0x3ad319,_0x47e0('0x1e5'),JSON['stringify'](_0x16448c[_0x47e0('0x131')]),_0x47e0('0x1e6'),_0x16448c[_0x47e0('0x44')]);if(_0x16448c[_0x47e0('0x131')]){_0x16448c[_0x47e0('0x131')]=![];_0x187a73['queueBooked'][_0x187a73[_0x47e0('0x26')][_0x3ad319]['queue']]=[];ami[_0x47e0('0xaf')]({'actionid':_0x3ad319,'action':_0x47e0('0x1e7'),'queue':_0x16448c[_0x47e0('0x44')]})[_0x47e0('0xbb')](function(){_0x187a73[_0x47e0('0xb3')](_0x16448c);_0x187a73['rescheduleContact']({'active':![],'ContactId':_0x187a73[_0x47e0('0x26')][_0x3ad319][_0x47e0('0xd3')],'ListId':_0x187a73['actions'][_0x3ad319]['ListId'],'VoiceQueueId':_0x187a73['actions'][_0x3ad319][_0x47e0('0xd5')]||undefined,'CampaignId':_0x187a73['actions'][_0x3ad319][_0x47e0('0xd6')]||undefined})[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x1e8')));delete _0x187a73['actions'][_0x3ad319];});}else{loggerBooked['info'](_0x47e0('0x1e9'),JSON[_0x47e0('0x4a')](_0x16448c[_0x47e0('0x131')]),'Queue:\x20',_0x16448c[_0x47e0('0x44')]);_0x187a73[_0x47e0('0xb3')](_0x16448c);_0x187a73[_0x47e0('0xc3')]({'active':![],'ContactId':_0x187a73[_0x47e0('0x26')][_0x3ad319]['ContactId'],'ListId':_0x187a73[_0x47e0('0x26')][_0x3ad319][_0x47e0('0x102')],'VoiceQueueId':_0x187a73['actions'][_0x3ad319][_0x47e0('0xd5')]||undefined,'CampaignId':_0x187a73['actions'][_0x3ad319][_0x47e0('0xd6')]||undefined})[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x1e8')));delete _0x187a73[_0x47e0('0x26')][_0x3ad319];}}else{return _0x187a73[_0x47e0('0x1ea')](_0x16448c,_0x23e41b);}}else{if(getDiff(_0x23e41b[_0x47e0('0x1eb')])<_0x16448c[_0x47e0('0x1ec')]*0x3c){if(_0x23e41b[_0x47e0('0x1ed')]&&!_0x23e41b['Agent'][_0x47e0('0x1ee')]){_0x187a73[_0x47e0('0x20')][_0x47e0('0x133')](_0x23e41b['id'])[_0x47e0('0x1e')](function(){_0x187a73[_0x47e0('0xb3')](_0x16448c);});}else{_0x187a73[_0x47e0('0xc5')]({'active':![]},_0x23e41b['id'],0x1)[_0x47e0('0x1e')](function(){_0x187a73[_0x47e0('0xb3')](_0x16448c);});}}else{_0x16448c['outboundReCallsDay']+=0x1;_0x187a73['updateOriginated'](_0x16448c);if(_0x16448c['dialRecallInQueue']){_0x187a73[_0x47e0('0xc3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x23e41b[_0x47e0('0xd3')],'ListId':_0x23e41b[_0x47e0('0x102')],'VoiceQueueId':_0x23e41b['VoiceQueueId']||undefined,'CampaignId':_0x23e41b['CampaignId']||undefined})[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x1ef')));_0x187a73[_0x47e0('0xcd')](createObjHistory(_0x16448c,_0x23e41b,'RECALLINQUEUE',0x17,_0x47e0('0x1f0')))[_0x47e0('0xbb')](loggerCatch(_0x47e0('0x1f1')));}else{_0x187a73['saveInDb'](createObjHistory(_0x16448c,_0x23e41b,'RECALLFAILEDTIMEOUT',0x16,_0x47e0('0x1f2')),_0x47e0('0x1f3'),_0x47e0('0x1f4'));}}}}else{_0x16448c[_0x47e0('0x5e')]+=0x1;_0x187a73['saveInDb'](createObjHistory(_0x16448c,_0x23e41b,'BLACKLIST',0xd,'Blacklist'),_0x47e0('0x1f5'),_0x47e0('0x1f6'));throw _0x47e0('0x1f7');}};};Dialer[_0x47e0('0x1b')]['handleIvr']=function(_0x2ec7a3){var _0x5e908f=this;var _0xd83b2c=_0x2ec7a3[_0x47e0('0x1f8')]-_0x2ec7a3[_0x47e0('0x73')]-_0x2ec7a3[_0x47e0('0x1f9')];emitCampaignSummary(_0x2ec7a3);if(_0xd83b2c>0x0){if(_0xd83b2c>this['maxNumberOriginate']){_0xd83b2c=this['maxNumberOriginate'];}_0x2ec7a3['temp']+=_0xd83b2c;this[_0x47e0('0xc8')](_0x2ec7a3['id'],_0xd83b2c,_0x2ec7a3[_0x47e0('0x1fa')])[_0x47e0('0xba')](function(_0x26e406){_0x2ec7a3['temp']-=_0xd83b2c;_0x2ec7a3[_0x47e0('0x1f9')]=_0x2ec7a3[_0x47e0('0x1f9')]>0x0?_0x2ec7a3[_0x47e0('0x1f9')]:0x0;if(!checkContactEmpty(_0x26e406)){_0x2ec7a3['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0x47e0('0x82')](_0x47e0('0x1fb')+_0x2ec7a3['name']);}else{_0x2ec7a3[_0x47e0('0x73')]+=_0x26e406['length'];_0x2ec7a3[_0x47e0('0x40')]='RUNNING';for(var _0x35b324=0x0;_0x35b324<_0x26e406[_0x47e0('0x9c')];_0x35b324+=0x1){_0x2ec7a3['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x26e406[_0x35b324])||_[_0x47e0('0xe1')](_0x26e406[_0x35b324][_0x47e0('0x166')])||_[_0x47e0('0xe1')](_0x26e406[_0x35b324][_0x47e0('0x166')][_0x47e0('0x165')])){_0x5e908f[_0x47e0('0xd1')]('[actionOriginate]\x20',_0x2ec7a3,_0x26e406[_0x35b324]);}else{_0x5e908f['checkIsBlackListIvr'](_[_0x47e0('0xd2')](_0x26e406[_0x35b324],[_0x47e0('0xd6'),_0x47e0('0x1fc')]))['then'](_0x5e908f[_0x47e0('0x1e2')](_0x2ec7a3,_0x26e406[_0x35b324]))[_0x47e0('0xbb')](_0x5e908f['loggerHandler'](_0x47e0('0x1fd'),_0x2ec7a3));}}}})['catch'](loggerGetContactDialer(_0x47e0('0x1fe'),_0x2ec7a3,_0xd83b2c));}};Dialer['prototype'][_0x47e0('0x155')]=function(_0x1b64d9,_0x49101f){var _0x559792=this;var _0x1a22dc=[];var _0x270b1e=_0x49101f>=0x1?_0x49101f:0x1;if(_0x1b64d9['dialMethod']===_0x47e0('0x9')){_0x270b1e=0x1;}var _0x35f2e6=Math['floor'](_0x1b64d9[_0x47e0('0x4f')]*_0x270b1e)-_0x1b64d9[_0x47e0('0x73')]-_0x1b64d9['temp'];emitVoiceQueueSummary(_0x1b64d9);if(_0x1b64d9[_0x47e0('0x1ff')]>0x0){var _0x311b68=_0x1b64d9[_0x47e0('0x1ff')]-_0x1b64d9[_0x47e0('0x73')]-_0x1b64d9[_0x47e0('0xa4')]-_0x1b64d9[_0x47e0('0x1f9')]-_0x1b64d9['pTalking'];if(_0x35f2e6>_0x311b68){_0x35f2e6=_0x311b68;}}if(_0x35f2e6>0x0){if(_0x1b64d9[_0x47e0('0x57')]===_0x47e0('0x9')){_0x35f2e6=0x1;}if(_0x35f2e6>this[_0x47e0('0x24')]){_0x35f2e6=this[_0x47e0('0x24')];}_0x1b64d9[_0x47e0('0x1f9')]+=_0x35f2e6;for(var _0x1bcf2b in this[_0x47e0('0x22')]){if(typeof this[_0x47e0('0x22')][_0x1bcf2b]!==_0x47e0('0x9d')){if(this['agents'][_0x1bcf2b][_0x47e0('0xe8')]===_0x47e0('0x200')&&this[_0x47e0('0x22')][_0x1bcf2b]['status']==='reachable'){_0x1a22dc[_0x47e0('0x14d')](this['agents'][_0x1bcf2b]['id']);}}}this['getContactDialer'](_0x1b64d9['id'],_0x1a22dc,_0x35f2e6,_0x1b64d9['dialOrderByScheduledAt'])['then'](function(_0x56054b){_0x1b64d9[_0x47e0('0x1f9')]-=_0x35f2e6;_0x1b64d9['temp']=_0x1b64d9[_0x47e0('0x1f9')]>0x0?_0x1b64d9[_0x47e0('0x1f9')]:0x0;if(!checkContactEmpty(_0x56054b)){_0x559792['countReScheduled'](_0x1b64d9)[_0x47e0('0xba')](sendMessageReschedule(_0x1b64d9))[_0x47e0('0xbb')](loggerCatch(_0x47e0('0xb8')));}else{_0x1b64d9[_0x47e0('0x73')]+=_0x56054b['length'];_0x1b64d9[_0x47e0('0x40')]=_0x1b64d9[_0x47e0('0x57')]===_0x47e0('0x9')?'ACTIVE':_0x47e0('0x201');for(var _0x107d80=0x0;_0x107d80<_0x56054b[_0x47e0('0x9c')];_0x107d80+=0x1){if(_[_0x47e0('0xe1')](_0x56054b[_0x107d80])||_[_0x47e0('0xe1')](_0x56054b[_0x107d80][_0x47e0('0x166')])||_[_0x47e0('0xe1')](_0x56054b[_0x107d80][_0x47e0('0x166')][_0x47e0('0x165')])){_0x559792[_0x47e0('0xd1')](_0x47e0('0x202'),_0x1b64d9,_0x56054b[_0x107d80]);}else{_0x559792[_0x47e0('0xb9')](_[_0x47e0('0xd2')](_0x56054b[_0x107d80],[_0x47e0('0xd5'),_0x47e0('0x1fc')]))[_0x47e0('0xba')](_0x559792['checkContactBlack'](_0x1b64d9,_0x56054b[_0x107d80]))[_0x47e0('0xbb')](_0x559792['loggerHandler'](_0x47e0('0x202'),_0x1b64d9));}}}})[_0x47e0('0xbb')](loggerGetContactDialer('[getContactDialer2]',_0x1b64d9,_0x35f2e6));}};Dialer[_0x47e0('0x1b')][_0x47e0('0x94')]=function(_0x5e6b82){if(_0x5e6b82['dialLimitQueue']>0x0){var _0x4dc990=_0x5e6b82[_0x47e0('0x1ff')]-_0x5e6b82[_0x47e0('0x73')]-_0x5e6b82[_0x47e0('0xa4')];if(_0x4dc990>0x0){this[_0x47e0('0x203')](_0x5e6b82);}else{loggerPredictiveCalls['info'](_0x47e0('0x204'));}}else{this[_0x47e0('0x203')](_0x5e6b82);}};Dialer[_0x47e0('0x1b')][_0x47e0('0x203')]=function(_0x54233f){var _0x12921b=this;var _0x137f62=[];_0x54233f['originated']+=0x1;for(var _0x5357a7 in this['agents']){if(typeof this[_0x47e0('0x22')][_0x5357a7]!==_0x47e0('0x9d')){if(this[_0x47e0('0x22')][_0x5357a7][_0x47e0('0xe8')]===_0x47e0('0x200')&&this[_0x47e0('0x22')][_0x5357a7][_0x47e0('0xb0')]==='reachable'){_0x137f62[_0x47e0('0x14d')](this[_0x47e0('0x22')][_0x5357a7]['id']);}}}this[_0x47e0('0x205')](_0x54233f['id'],_0x137f62,0x1,_0x54233f[_0x47e0('0x1fa')])[_0x47e0('0xba')](function(_0x1d9433){if(!checkContactEmpty(_0x1d9433)){checkContactLowerLimitOriginate(_0x54233f,0x1,0x0);_0x12921b[_0x47e0('0xb7')](_0x54233f)[_0x47e0('0xba')](sendMessageReschedule(_0x54233f))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x54233f[_0x47e0('0x40')]=_0x47e0('0x201');if(_['isNil'](_0x1d9433[0x0])||_[_0x47e0('0xe1')](_0x1d9433[0x0][_0x47e0('0x166')])||_[_0x47e0('0xe1')](_0x1d9433[0x0][_0x47e0('0x166')][_0x47e0('0x165')])){_0x12921b[_0x47e0('0xd1')](_0x47e0('0x202'),_0x54233f,_0x1d9433[0x0]);}else{_0x12921b[_0x47e0('0xb9')](_[_0x47e0('0xd2')](_0x1d9433[0x0],[_0x47e0('0xd5'),_0x47e0('0x1fc')]))[_0x47e0('0xba')](_0x12921b[_0x47e0('0x1e2')](_0x54233f,_0x1d9433[0x0]))[_0x47e0('0xbb')](_0x12921b[_0x47e0('0xd0')](_0x47e0('0x206'),_0x54233f));}}})[_0x47e0('0xbb')](loggerGetContactDialer('[getContactDialerPredictive]',_0x54233f,0x1));emitVoiceQueueSummary(_0x54233f);};Dialer[_0x47e0('0x1b')][_0x47e0('0x1d6')]=function(_0x55340f,_0x573ae3,_0x39f681,_0xaa0fa2,_0x3f19fd,_0x58a057){loggerPredictive[_0x47e0('0x82')](_0x47e0('0x207'));loggerPredictive[_0x47e0('0x82')](_0x47e0('0x208'),_0x55340f);loggerPredictive[_0x47e0('0x82')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x573ae3);loggerPredictive['info'](_0x47e0('0x209'),_0x39f681);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x20a'),_0xaa0fa2);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x20b'),_0x3f19fd);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x88'));return new BPromise(function(_0x35125d,_0x171dc9){if(_0x55340f<=0x0||isNaN(_0x55340f)){return _0x171dc9(msgResponse(_0x47e0('0x20c'),_0x47e0('0x49'),'m\x20=\x20'+_0x55340f));}if(_0x39f681<=0x0||isNaN(_0x39f681)){return _0x171dc9(msgResponse('[abandonmentRate]',_0x47e0('0x49'),'Ts\x20=\x20'+_0x39f681));}if(_0xaa0fa2<=0x0||isNaN(_0xaa0fa2)){return _0x171dc9(msgResponse('[abandonmentRate]',_0x47e0('0x49'),'p\x20=\x20'+_0xaa0fa2));}if(_0x573ae3<=0x0||isNaN(_0x573ae3)){return _0x171dc9(msgResponse(_0x47e0('0x20c'),'Error',_0x47e0('0x20d')+_0x573ae3));}if(_0x3f19fd<=0x0||isNaN(_0x3f19fd)){return _0x171dc9(msgResponse(_0x47e0('0x20c'),_0x47e0('0x49'),_0x47e0('0x20e')+_0x3f19fd));}_0x58a057=_0x58a057||0x0;var _0x3b831b=0x1/_0x39f681;var _0x278a66=0x0;var _0x57aa83=0x0;var _0x4ba9b8=0x0;var _0x1e6f38=0x0;for(var _0x992f38=0x0;_0x4ba9b8<_0x3f19fd;_0x992f38+=0x1){_0x57aa83=_0x992f38/_0x573ae3;_0x278a66=(_0xaa0fa2*_0x57aa83+_0x58a057)/_0x3b831b;_0x4ba9b8=erlangb(_0x278a66,_0x55340f);_0x1e6f38=_0x278a66/_0x55340f*(0x1-erlangb(_0x278a66,_0x55340f));}return _0x35125d({'erlangCalls':_0x992f38,'erlangCallToSecond':_0x573ae3/_0x992f38,'erlangAbandonmentRate':_0x4ba9b8,'erlangBusyFactor':_0x1e6f38});});};Dialer[_0x47e0('0x1b')]['busyFactor']=function(_0x1dc659,_0x51e785,_0x2fe73b,_0x23f4ef,_0xe266b4,_0x26d20d){loggerPredictive[_0x47e0('0x82')](_0x47e0('0x20f'));loggerPredictive[_0x47e0('0x82')]('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',_0x1dc659);loggerPredictive['info'](_0x47e0('0x210'),_0x51e785);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x209'),_0x2fe73b);loggerPredictive['info']('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',_0x23f4ef);loggerPredictive['info'](_0x47e0('0x211'),_0xe266b4);loggerPredictive[_0x47e0('0x82')](_0x47e0('0x88'));return new BPromise(function(_0x4bd1de,_0x375607){if(_0x1dc659<=0x0||isNaN(_0x1dc659)){return _0x375607(msgResponse(_0x47e0('0x212'),_0x47e0('0x49'),_0x47e0('0x213')+_0x1dc659));}if(_0x2fe73b<=0x0||isNaN(_0x2fe73b)){return _0x375607(msgResponse(_0x47e0('0x212'),_0x47e0('0x49'),_0x47e0('0x214')+_0x2fe73b));}if(_0x23f4ef<=0x0||isNaN(_0x23f4ef)){return _0x375607(msgResponse(_0x47e0('0x212'),'Error','p\x20=\x20'+_0x23f4ef));}if(_0x51e785<=0x0||isNaN(_0x51e785)){return _0x375607(msgResponse(_0x47e0('0x212'),'Error',_0x47e0('0x20d')+_0x51e785));}if(_0xe266b4<=0x0||isNaN(_0xe266b4)){return _0x375607(msgResponse('[busyFactor]',_0x47e0('0x49'),_0x47e0('0x215')+_0xe266b4));}_0x26d20d=_0x26d20d||0x0;var _0x1b377a=0x1/_0x2fe73b;var _0x388e04=0x0;var _0x54a7ec=0x0;var _0x29e5c6=0x0;var _0x1081e1=0x0;for(var _0x2e0b0d=0x0;_0x1081e1<_0xe266b4;_0x2e0b0d+=0x1){_0x54a7ec=_0x2e0b0d/_0x51e785;_0x388e04=(_0x23f4ef*_0x54a7ec+_0x26d20d)/_0x1b377a;_0x29e5c6=erlangb(_0x388e04,_0x1dc659);_0x1081e1=_0x388e04/_0x1dc659*(0x1-erlangb(_0x388e04,_0x1dc659));}return _0x4bd1de({'erlangCalls':_0x2e0b0d,'erlangCallToSecond':_0x51e785/_0x2e0b0d,'erlangAbandonmentRate':_0x29e5c6,'erlangBusyFactor':_0x1081e1});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 22cb1db..e7bce5f 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 _0x879c=['util','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x3fdb3a,_0x5a9391){var _0x53556a=function(_0x1d3ad1){while(--_0x1d3ad1){_0x3fdb3a['push'](_0x3fdb3a['shift']());}};_0x53556a(++_0x5a9391);}(_0x879c,0xf6));var _0xc879=function(_0xbde8eb,_0xc9dbd1){_0xbde8eb=_0xbde8eb-0x0;var _0xd5b4d4=_0x879c[_0xbde8eb];return _0xd5b4d4;};'use strict';var util=require(_0xc879('0x0'));var _=require(_0xc879('0x1'));var moment=require('moment');function getSeconds(_0x3d31c6,_0xcc6b1b){var _0x3cf08b=moment(_0x3d31c6)[_0xc879('0x2')](0x0);var _0x1fd46c=moment(_0xcc6b1b)[_0xc879('0x2')](0x0);return _0x3cf08b[_0xc879('0x3')](_0x1fd46c,_0xc879('0x4'));}function QueueCallerAbandon(_0x3f29fd,_0x7907b8){this[_0xc879('0x5')]=_0x3f29fd[_0xc879('0x5')];this[_0xc879('0x6')]=_0x3f29fd[_0xc879('0x6')];this[_0xc879('0x7')]=_0x3f29fd[_0xc879('0x6')]==='outbound'?_0xc879('0x8'):_0x3f29fd['type'];this['countbusyretry']=_0x3f29fd[_0xc879('0x9')];this[_0xc879('0xa')]=_0x3f29fd[_0xc879('0xa')];this['countnoanswerretry']=_0x3f29fd[_0xc879('0xb')];this[_0xc879('0xc')]=_0x3f29fd['countbusyretry']+_0x3f29fd[_0xc879('0xa')]+_0x3f29fd[_0xc879('0xb')]+_0x3f29fd[_0xc879('0xd')]+_0x3f29fd[_0xc879('0xe')]+_0x3f29fd[_0xc879('0xf')]+_0x3f29fd[_0xc879('0x10')]+_0x3f29fd['countagentrejectretry'];this['countnosuchnumberretry']=_0x3f29fd[_0xc879('0xd')];this['countdropretry']=_0x3f29fd[_0xc879('0xe')];this[_0xc879('0xf')]=_0x3f29fd[_0xc879('0xf')];this[_0xc879('0x10')]=_0x3f29fd[_0xc879('0x10')];this[_0xc879('0x11')]=_0x3f29fd[_0xc879('0x11')];this[_0xc879('0x12')]=_0x7907b8[_0xc879('0x12')];this['calleridname']=_0x3f29fd[_0xc879('0x13')];this[_0xc879('0x14')]=_0x3f29fd[_0xc879('0x15')];this[_0xc879('0x16')]=_0x3f29fd[_0xc879('0x16')];this[_0xc879('0x17')]=_0x3f29fd[_0xc879('0x17')];this[_0xc879('0x18')]=_0x3f29fd[_0xc879('0x18')];this[_0xc879('0x19')]=this['droptime'];this[_0xc879('0x1a')]=getSeconds(_0x3f29fd[_0xc879('0x17')],_0x3f29fd[_0xc879('0x16')]);this[_0xc879('0x1b')]=getSeconds(this['droptime'],_0x3f29fd[_0xc879('0x17')]);this[_0xc879('0x1c')]=0x0;this['queue']=_0x7907b8[_0xc879('0x8')];this['membername']=_0x7907b8[_0xc879('0x1d')];this[_0xc879('0x1e')]=_0x7907b8[_0xc879('0x1e')];this['callback']=_0x3f29fd[_0xc879('0x1f')];this[_0xc879('0x20')]=_0x3f29fd[_0xc879('0x20')];this['callbackat']=_0x3f29fd[_0xc879('0x21')];this[_0xc879('0x22')]=_0x3f29fd['recallme'];this['ContactId']=_0x3f29fd[_0xc879('0x23')];this['ListId']=_0x3f29fd['ListId'];this[_0xc879('0x24')]=_0x3f29fd['UserId'];this[_0xc879('0x25')]=_0x3f29fd[_0xc879('0x25')];this[_0xc879('0x26')]=_0x3f29fd[_0xc879('0x26')];this[_0xc879('0x27')]=_0x3f29fd['originatecalleridnum']||'';this[_0xc879('0x28')]=_0x3f29fd[_0xc879('0x28')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x3df9=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x40509a,_0x38e0b){var _0x4d6008=function(_0x3b3a13){while(--_0x3b3a13){_0x40509a['push'](_0x40509a['shift']());}};_0x4d6008(++_0x38e0b);}(_0x3df9,0x10e));var _0x93df=function(_0x57ed9e,_0x7512be){_0x57ed9e=_0x57ed9e-0x0;var _0x4a321d=_0x3df9[_0x57ed9e];return _0x4a321d;};'use strict';var util=require(_0x93df('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x2fc993,_0x173ed2){var _0x2df9d6=moment(_0x2fc993)[_0x93df('0x1')](0x0);var _0x43963a=moment(_0x173ed2)['milliseconds'](0x0);return _0x2df9d6['diff'](_0x43963a,'seconds');}function QueueCallerAbandon(_0x35b4f0,_0x11ce12){this[_0x93df('0x2')]=_0x35b4f0[_0x93df('0x2')];this[_0x93df('0x3')]=_0x35b4f0[_0x93df('0x3')];this[_0x93df('0x4')]=_0x35b4f0[_0x93df('0x3')]==='outbound'?_0x93df('0x5'):_0x35b4f0[_0x93df('0x3')];this[_0x93df('0x6')]=_0x35b4f0[_0x93df('0x6')];this[_0x93df('0x7')]=_0x35b4f0[_0x93df('0x7')];this[_0x93df('0x8')]=_0x35b4f0['countnoanswerretry'];this[_0x93df('0x9')]=_0x35b4f0[_0x93df('0x6')]+_0x35b4f0['countcongestionretry']+_0x35b4f0[_0x93df('0x8')]+_0x35b4f0[_0x93df('0xa')]+_0x35b4f0[_0x93df('0xb')]+_0x35b4f0[_0x93df('0xc')]+_0x35b4f0[_0x93df('0xd')]+_0x35b4f0[_0x93df('0xe')];this['countnosuchnumberretry']=_0x35b4f0[_0x93df('0xa')];this[_0x93df('0xb')]=_0x35b4f0[_0x93df('0xb')];this[_0x93df('0xc')]=_0x35b4f0['countabandonedretry'];this['countmachineretry']=_0x35b4f0['countmachineretry'];this[_0x93df('0xe')]=_0x35b4f0[_0x93df('0xe')];this[_0x93df('0xf')]=_0x11ce12[_0x93df('0xf')];this[_0x93df('0x10')]=_0x35b4f0[_0x93df('0x11')];this['calleridnum']=_0x35b4f0[_0x93df('0x12')];this['starttime']=_0x35b4f0['starttime'];this[_0x93df('0x13')]=_0x35b4f0[_0x93df('0x13')];this[_0x93df('0x14')]=_0x35b4f0[_0x93df('0x14')];this[_0x93df('0x15')]=this[_0x93df('0x14')];this[_0x93df('0x16')]=getSeconds(_0x35b4f0[_0x93df('0x13')],_0x35b4f0['starttime']);this[_0x93df('0x17')]=getSeconds(this[_0x93df('0x14')],_0x35b4f0[_0x93df('0x13')]);this[_0x93df('0x18')]=0x0;this[_0x93df('0x5')]=_0x11ce12[_0x93df('0x5')];this[_0x93df('0x19')]=_0x11ce12[_0x93df('0x1a')];this['reason']=_0x11ce12[_0x93df('0x1b')];this['callback']=_0x35b4f0[_0x93df('0x1c')];this[_0x93df('0x1d')]=_0x35b4f0[_0x93df('0x1d')];this[_0x93df('0x1e')]=_0x35b4f0[_0x93df('0x1e')];this[_0x93df('0x1f')]=_0x35b4f0[_0x93df('0x1f')];this[_0x93df('0x20')]=_0x35b4f0[_0x93df('0x20')];this[_0x93df('0x21')]=_0x35b4f0['ListId'];this['UserId']=_0x35b4f0[_0x93df('0x22')];this[_0x93df('0x23')]=_0x35b4f0[_0x93df('0x23')];this[_0x93df('0x24')]=_0x35b4f0[_0x93df('0x24')];this[_0x93df('0x25')]=_0x35b4f0[_0x93df('0x25')]||'';this[_0x93df('0x26')]=_0x35b4f0[_0x93df('0x26')]||'';}module[_0x93df('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 2f04d48..377cad3 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 _0xae58=['localstationid','headerinfo','path','AttachmentId','exports','util','lodash','uniqueid','format','%s/%s/%s','tech'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xae58,0x170));var _0x8ae5=function(_0xd2e2ab,_0x2440cf){_0xd2e2ab=_0xd2e2ab-0x0;var _0x1703a2=_0xae58[_0xd2e2ab];return _0x1703a2;};'use strict';var util=require(_0x8ae5('0x0'));var _=require(_0x8ae5('0x1'));var moment=require('moment');function Action(_0x5f29c0,_0x5e3c5c,_0x294795){this[_0x8ae5('0x2')]=_0x5f29c0||undefined;this['channel']=util[_0x8ae5('0x3')](_0x8ae5('0x4'),_0x5e3c5c[_0x8ae5('0x5')],_0x5e3c5c['Trunk']['name'],_0x294795['fax']);this['localstationid']=_0x5e3c5c[_0x8ae5('0x6')];this[_0x8ae5('0x7')]=_0x5e3c5c[_0x8ae5('0x7')];this[_0x8ae5('0x8')]=_0x294795[_0x8ae5('0x8')];this[_0x8ae5('0x9')]=_0x294795[_0x8ae5('0x9')];}module[_0x8ae5('0xa')]=Action; \ No newline at end of file +var _0xccce=['localstationid','headerinfo','path','AttachmentId','lodash','moment','uniqueid','channel','%s/%s/%s','tech','Trunk','fax'];(function(_0x2b6512,_0x13f30e){var _0x437e2b=function(_0x320267){while(--_0x320267){_0x2b6512['push'](_0x2b6512['shift']());}};_0x437e2b(++_0x13f30e);}(_0xccce,0x70));var _0xeccc=function(_0x59fa5b,_0x15091a){_0x59fa5b=_0x59fa5b-0x0;var _0x2fa1d9=_0xccce[_0x59fa5b];return _0x2fa1d9;};'use strict';var util=require('util');var _=require(_0xeccc('0x0'));var moment=require(_0xeccc('0x1'));function Action(_0x1fdd5b,_0x3c52e5,_0x374d95){this[_0xeccc('0x2')]=_0x1fdd5b||undefined;this[_0xeccc('0x3')]=util['format'](_0xeccc('0x4'),_0x3c52e5[_0xeccc('0x5')],_0x3c52e5[_0xeccc('0x6')]['name'],_0x374d95[_0xeccc('0x7')]);this[_0xeccc('0x8')]=_0x3c52e5[_0xeccc('0x8')];this[_0xeccc('0x9')]=_0x3c52e5[_0xeccc('0x9')];this[_0xeccc('0xa')]=_0x374d95[_0xeccc('0xa')];this[_0xeccc('0xb')]=_0x374d95[_0xeccc('0xb')];}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 3f2260a..4def47b 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 _0x77ee=['Fax\x20failed','checkAfterSend','Trunk','Trunk\x20Reachable','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','path','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','bind','newstate','syncNewState','newexten','syncFaxStatus','syncReceiveFax','hangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','filename','calleridnum','/var/opt/motion2/server/files/attachments/','info','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','error','\x20notify\x20','catch','\x20receiveFax\x20','syncOriginateResponse','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]'];(function(_0x50aa4b,_0x2fdb32){var _0x2b4000=function(_0x7bd82c){while(--_0x7bd82c){_0x50aa4b['push'](_0x50aa4b['shift']());}};_0x2b4000(++_0x2fdb32);}(_0x77ee,0x8f));var _0xe77e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x77ee[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0xe77e('0x0'));var _=require('lodash');var BPromise=require(_0xe77e('0x1'));var uuid=require('uuid');var moment=require('moment');var path=require(_0xe77e('0x2'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xe77e('0x3'));var logger=require(_0xe77e('0x4'))(_0xe77e('0x5'));var ami=require(_0xe77e('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0xe77e('0x7'));var ut=require(_0xe77e('0x8'));var Action=require(_0xe77e('0x9'));var faxAccount=require(_0xe77e('0xa'));var attachment=require(_0xe77e('0xb'));var faxMessage=require(_0xe77e('0xc'));function Fax(_0x2f1452){this[_0xe77e('0xd')]={};this['faxAccounts']=_0x2f1452[_0xe77e('0xe')];this['trunks']=_0x2f1452[_0xe77e('0xf')];this[_0xe77e('0x10')]={};ami['on']('newchannel',this['syncNewchannel'][_0xe77e('0x11')](this));ami['on']('varset',this['syncVarSet'][_0xe77e('0x11')](this));ami['on'](_0xe77e('0x12'),this[_0xe77e('0x13')]['bind'](this));ami['on'](_0xe77e('0x14'),this['syncNewExten'][_0xe77e('0x11')](this));ami['on']('faxstatus',this[_0xe77e('0x15')][_0xe77e('0x11')](this));ami['on']('receivefax',this[_0xe77e('0x16')][_0xe77e('0x11')](this));ami['on'](_0xe77e('0x17'),this['syncHangup'][_0xe77e('0x11')](this));ami['on'](_0xe77e('0x18'),this['syncOriginateResponse']['bind'](this));}Fax[_0xe77e('0x19')]['syncNewchannel']=function(_0xe9e399){if(_0xe9e399[_0xe77e('0x1a')]===_0xe77e('0x1b')){for(var _0x2321ef in this[_0xe77e('0xe')]){if(this[_0xe77e('0xe')][_0xe77e('0x1c')](_0x2321ef)){if(_0xe9e399['exten']===this[_0xe77e('0xe')][_0x2321ef][_0xe77e('0x1d')]){this[_0xe77e('0xd')][_0xe9e399['uniqueid']]={};this['channels'][_0xe9e399[_0xe77e('0x1e')]][_0xe77e('0x1f')]=_0xe9e399[_0xe77e('0x1f')];this[_0xe77e('0xd')][_0xe9e399[_0xe77e('0x1e')]]['id']=this['faxAccounts'][_0x2321ef]['id'];this[_0xe77e('0xd')][_0xe9e399['uniqueid']]['name']=this[_0xe77e('0xe')][_0x2321ef][_0xe77e('0x20')];logger['info'](_0xe9e399['uniqueid'],_0xe77e('0x21'));}}}}if(this['actions'][_0xe9e399[_0xe77e('0x1e')]]){this[_0xe77e('0xd')][_0xe9e399[_0xe77e('0x1e')]]={};this[_0xe77e('0xd')][_0xe9e399[_0xe77e('0x1e')]][_0xe77e('0x1f')]=_0xe9e399['channel'];logger['info'](_0xe9e399[_0xe77e('0x1e')],'\x20syncNewchannel\x20');}};Fax[_0xe77e('0x19')]['syncVarSet']=function(_0x4ab825){if(this[_0xe77e('0xd')][_0x4ab825[_0xe77e('0x1e')]]){for(var _0x3ef9e9 in _0x4ab825[_0xe77e('0x22')]){if(_0x4ab825['variable']['hasOwnProperty'](_0x3ef9e9)){this[_0xe77e('0xd')][_0x4ab825[_0xe77e('0x1e')]][_0x3ef9e9]=_0x4ab825[_0xe77e('0x23')];}}}};Fax[_0xe77e('0x19')][_0xe77e('0x13')]=function(_0x2d3fe2){if(this['channels'][_0x2d3fe2[_0xe77e('0x1e')]]){this[_0xe77e('0xd')][_0x2d3fe2[_0xe77e('0x1e')]][_0xe77e('0x24')]=_0x2d3fe2[_0xe77e('0x24')];this[_0xe77e('0xd')][_0x2d3fe2[_0xe77e('0x1e')]][_0xe77e('0x25')]=_0x2d3fe2[_0xe77e('0x25')];}};Fax[_0xe77e('0x19')][_0xe77e('0x26')]=function(_0x21ec11){if(this[_0xe77e('0xd')][_0x21ec11[_0xe77e('0x1e')]]){for(var _0x67f0ed in _0x21ec11[_0xe77e('0x22')]){if(_0x21ec11[_0xe77e('0x22')]['hasOwnProperty'](_0x67f0ed)){this[_0xe77e('0xd')][_0x21ec11[_0xe77e('0x1e')]][_0x67f0ed]=_0x21ec11[_0xe77e('0x23')];}}}};Fax[_0xe77e('0x19')][_0xe77e('0x15')]=function(_0x5f3f28){if(this['channels'][_0x5f3f28[_0xe77e('0x1e')]]){this[_0xe77e('0xd')][_0x5f3f28[_0xe77e('0x1e')]][_0xe77e('0x27')]=_0x5f3f28[_0xe77e('0x27')];this['channels'][_0x5f3f28['uniqueid']][_0xe77e('0x28')]=_0x5f3f28['status'];this['channels'][_0x5f3f28['uniqueid']][_0xe77e('0x1d')]=_0x5f3f28[_0xe77e('0x1d')];this['channels'][_0x5f3f28[_0xe77e('0x1e')]]['filename']=_0x5f3f28['filename'];logger['info'](_0x5f3f28[_0xe77e('0x1e')],_0xe77e('0x29'));}};Fax[_0xe77e('0x19')][_0xe77e('0x16')]=function(_0x16d9b0){var _0x4d6701=this;if(this['channels'][_0x16d9b0['uniqueid']]){var _0x314f5c=this[_0xe77e('0xd')][_0x16d9b0[_0xe77e('0x1e')]]['id'];this[_0xe77e('0xd')][_0x16d9b0[_0xe77e('0x1e')]][_0xe77e('0x2a')]=_0x16d9b0[_0xe77e('0x2a')];this[_0xe77e('0xd')][_0x16d9b0[_0xe77e('0x1e')]]['pagestransferred']=_0x16d9b0[_0xe77e('0x2b')];this[_0xe77e('0xd')][_0x16d9b0[_0xe77e('0x1e')]][_0xe77e('0x1d')]=_0x16d9b0[_0xe77e('0x1d')];this['channels'][_0x16d9b0[_0xe77e('0x1e')]][_0xe77e('0x2c')]=_0x16d9b0[_0xe77e('0x2c')];this[_0xe77e('0xd')][_0x16d9b0[_0xe77e('0x1e')]]['transferrate']=_0x16d9b0['transferrate'];this[_0xe77e('0xd')][_0x16d9b0[_0xe77e('0x1e')]][_0xe77e('0x2d')]=_0x16d9b0['filename'];this[_0xe77e('0xd')][_0x16d9b0['uniqueid']][_0xe77e('0x2e')]=_0x16d9b0[_0xe77e('0x2e')];if(this[_0xe77e('0xd')][_0x16d9b0[_0xe77e('0x1e')]]['pagestransferred']>0x0){tiff2pdf(_0x16d9b0[_0xe77e('0x2d')],_0xe77e('0x2f'),function(_0x5de0e3){logger[_0xe77e('0x30')](_0x16d9b0[_0xe77e('0x1e')],_0xe77e('0x31'),_0x5de0e3[_0xe77e('0x32')]);attachment[_0xe77e('0x33')]({'name':path[_0xe77e('0x34')](_0x16d9b0[_0xe77e('0x2d')])[_0xe77e('0x20')],'basename':path[_0xe77e('0x34')](_0x16d9b0['filename'])['name']+_0xe77e('0x35'),'type':'application/pdf'})[_0xe77e('0x36')](function(_0x4949c3){faxAccount[_0xe77e('0x37')](_0x314f5c,{'from':_0x16d9b0[_0xe77e('0x2e')],'mapKey':_0xe77e('0x5'),'body':path[_0xe77e('0x34')](_0x16d9b0[_0xe77e('0x2d')])[_0xe77e('0x20')]+_0xe77e('0x35'),'AttachmentId':_0x4949c3['id']})['catch'](function(_0x1ee67e){logger[_0xe77e('0x38')](_0x16d9b0[_0xe77e('0x1e')],_0xe77e('0x39'),JSON['stringify'](_0x1ee67e));});})[_0xe77e('0x3a')](function(_0x120226){logger[_0xe77e('0x38')](_0x16d9b0['uniqueid'],_0xe77e('0x3b'),JSON['stringify'](_0x120226));});});}logger['info'](_0x16d9b0[_0xe77e('0x1e')],'\x20receiveFax\x20');}};Fax[_0xe77e('0x19')][_0xe77e('0x3c')]=function(_0x25e355){if(this[_0xe77e('0x10')][_0x25e355[_0xe77e('0x1e')]]){_['merge'](this['channels'][_0x25e355[_0xe77e('0x1e')]],_[_0xe77e('0x3d')](_0x25e355,[_0xe77e('0x3e'),_0xe77e('0x3f')]));}};function updateStatus(_0x36410c){if(_0x36410c[_0xe77e('0x40')]){faxMessage[_0xe77e('0x41')](_0x36410c[_0xe77e('0x40')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xe77e('0x36')](function(_0x2534e1){ut[_0xe77e('0x42')](_0xe77e('0x43'),_0x2534e1);})[_0xe77e('0x3a')](function(_0x4c6161){ut[_0xe77e('0x42')](_0xe77e('0x44'),_0x4c6161);});}else{ut[_0xe77e('0x42')](_0xe77e('0x45'));}}Fax[_0xe77e('0x19')][_0xe77e('0x46')]=function(_0xcafaa1,_0x40870d,_0x1dc743){var _0x3175f1=this;var _0x541d59={};if(_0x40870d){_0x541d59={'read':_0x40870d};}else{_0x541d59={'failMessage':_0x1dc743};}if(this[_0xe77e('0x10')][_0xcafaa1][_0xe77e('0x40')]){faxMessage[_0xe77e('0x41')](this[_0xe77e('0x10')][_0xcafaa1][_0xe77e('0x40')],_0x541d59)[_0xe77e('0x36')](function(_0x1bbc49){ut[_0xe77e('0x42')](_0xe77e('0x47'),_0x1bbc49);})[_0xe77e('0x3a')](function(_0x6b346b){ut[_0xe77e('0x42')](_0xe77e('0x48'),_0x6b346b);})[_0xe77e('0x49')](function(){delete _0x3175f1[_0xe77e('0xd')][_0xcafaa1];delete _0x3175f1[_0xe77e('0x10')][_0xcafaa1];});}else{ut['logger'](_0xe77e('0x4a'));delete this['channels'][_0xcafaa1];delete this[_0xe77e('0x10')][_0xcafaa1];}};Fax[_0xe77e('0x19')][_0xe77e('0x4b')]=function(_0x73fb3b){var _0x106c11=this;if(this[_0xe77e('0xd')][_0x73fb3b[_0xe77e('0x1e')]]){if(this['actions'][_0x73fb3b[_0xe77e('0x1e')]]){this[_0xe77e('0xd')][_0x73fb3b[_0xe77e('0x1e')]]['id']=this[_0xe77e('0x10')][_0x73fb3b[_0xe77e('0x1e')]]['id'];this[_0xe77e('0xd')][_0x73fb3b[_0xe77e('0x1e')]]['name']=this[_0xe77e('0x10')][_0x73fb3b[_0xe77e('0x1e')]]['name'];}logger[_0xe77e('0x30')](_0x73fb3b[_0xe77e('0x1e')],this[_0xe77e('0x10')][_0x73fb3b[_0xe77e('0x1e')]]?_0xe77e('0x4c'):_0xe77e('0x4d'),JSON[_0xe77e('0x4e')](this[_0xe77e('0xd')][_0x73fb3b['uniqueid']]));if(this[_0xe77e('0x10')][_0x73fb3b[_0xe77e('0x1e')]]){if(this[_0xe77e('0xd')][_0x73fb3b[_0xe77e('0x1e')]][_0xe77e('0x4f')]>0x0&&this[_0xe77e('0xd')][_0x73fb3b[_0xe77e('0x1e')]][_0xe77e('0x50')]===_0xe77e('0x51')){this['updateStatus'](_0x73fb3b['uniqueid'],!![]);}else{this[_0xe77e('0x46')](_0x73fb3b[_0xe77e('0x1e')],![],this[_0xe77e('0xd')][_0x73fb3b['uniqueid']][_0xe77e('0x52')]?_0xe77e('0x53')+this[_0xe77e('0xd')][_0x73fb3b[_0xe77e('0x1e')]]['faxstatusstring']:_0xe77e('0x54'));}}}};Fax[_0xe77e('0x19')][_0xe77e('0x55')]=function(_0x355a73){var _0x5d38f9=this;return new BPromise(function(_0x405cfb,_0x3e47f8){_0x5d38f9[_0xe77e('0x56')](_0x355a73,_0x5d38f9[_0xe77e('0xe')][_0x355a73[_0xe77e('0x57')]])[_0xe77e('0x36')](function(_0x2f0d39){ut[_0xe77e('0x42')](_0xe77e('0x58'),_0x2f0d39);_0x405cfb(ut[_0xe77e('0x32')](_0xe77e('0x59')));})[_0xe77e('0x3a')](function(_0xddbdfb){ut[_0xe77e('0x42')](_0xe77e('0x5a'),_0xddbdfb);updateStatus(_0x355a73);_0x3e47f8(ut[_0xe77e('0x32')](_0xe77e('0x5b')));});});};Fax['prototype'][_0xe77e('0x5c')]=function(_0x259d92){var _0x398063=this;return new BPromise(function(_0x495407,_0x2f273e){var _0x2d04ce=_0x398063['checkTrunk'](_0x398063[_0xe77e('0xe')][_0x259d92['FaxAccountId']][_0xe77e('0x5d')],_0x259d92);if(_0x2d04ce['isValid']){_0x495407(ut[_0xe77e('0x32')](_0xe77e('0x5e')));}else{_0x2f273e(ut[_0xe77e('0x32')](_0x2d04ce[_0xe77e('0x32')]));}});};function originate(_0x4d6bcc,_0x45e0a1,_0x216664){return new BPromise(function(_0x51b14c,_0x40a4a4){if(_0x216664){var _0x5b3ed1=util[_0xe77e('0x5f')]('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[_0xe77e('0x34')](_0x4d6bcc[_0xe77e('0x2')])[_0xe77e('0x20')],_0x4d6bcc[_0xe77e('0x2')]);gs['execute'](_0x5b3ed1)[_0xe77e('0x36')](function(){_0x4d6bcc['path']=util[_0xe77e('0x5f')](_0xe77e('0x60'),path[_0xe77e('0x34')](_0x4d6bcc['path'])['dir'],path['parse'](_0x4d6bcc['path'])['name']);_0x45e0a1[_0xe77e('0x61')]=_0x4d6bcc[_0xe77e('0x2')];ut[_0xe77e('0x42')](_0xe77e('0x62'),'');ami[_0xe77e('0x63')](ut[_0xe77e('0x64')](_0x4d6bcc,_0x45e0a1))[_0xe77e('0x36')](function(_0xa73533){_0x51b14c(_0xa73533);})['catch'](function(_0x1a8fb1){_0x40a4a4(_0x1a8fb1);});})[_0xe77e('0x3a')](function(_0x371093){_0x40a4a4(_0x371093);});}else{ami[_0xe77e('0x63')](ut[_0xe77e('0x64')](_0x4d6bcc,_0x45e0a1))[_0xe77e('0x36')](function(_0x2f9496){_0x51b14c(_0x2f9496);})[_0xe77e('0x3a')](function(_0x542b6b){_0x40a4a4(_0x542b6b);});}});}Fax[_0xe77e('0x19')][_0xe77e('0x56')]=function(_0xb443b0,_0x55c8ec){var _0x4158f7=this;return new BPromise(function(_0x276a22,_0x28bae9){var _0x1fa2f1=uuid['v4']();var _0x48872c=ut[_0xe77e('0x65')](_0xb443b0,_0x55c8ec);_0x4158f7[_0xe77e('0x10')][_0x1fa2f1]=new Action(_0x1fa2f1,_0x55c8ec,_0xb443b0);var _0x191a62=_0x4158f7[_0xe77e('0x10')][_0x1fa2f1];if(path[_0xe77e('0x34')](_0xb443b0[_0xe77e('0x2')])[_0xe77e('0x66')]===_0xe77e('0x35')){originate(_0x191a62,_0x48872c,!![])[_0xe77e('0x36')](function(_0x364211){_0x276a22(_0x364211);})['catch'](function(_0xb70d08){_0x28bae9(_0xb70d08);});}else{originate(_0x191a62,_0x48872c,![])['then'](function(_0x6c079){_0x276a22(_0x6c079);})[_0xe77e('0x3a')](function(_0x3268ff){_0x28bae9(_0x3268ff);});}});};Fax[_0xe77e('0x19')][_0xe77e('0x67')]=function(_0x5a3ea6){return!_[_0xe77e('0x68')](_0x5a3ea6)&&!_[_0xe77e('0x68')](_0x5a3ea6[_0xe77e('0x20')])&&!_['isNil'](_0x5a3ea6[_0xe77e('0x69')])&&_0x5a3ea6[_0xe77e('0x69')]&&!_[_0xe77e('0x68')](this[_0xe77e('0xf')][util[_0xe77e('0x5f')](_0xe77e('0x6a'),_0x5a3ea6[_0xe77e('0x20')])])&&!_[_0xe77e('0x68')](this[_0xe77e('0xf')][util[_0xe77e('0x5f')]('SIP/%s',_0x5a3ea6[_0xe77e('0x20')])][_0xe77e('0x28')])&&(this[_0xe77e('0xf')][util[_0xe77e('0x5f')]('SIP/%s',_0x5a3ea6[_0xe77e('0x20')])][_0xe77e('0x28')]===_0xe77e('0x6b')||this[_0xe77e('0xf')][util[_0xe77e('0x5f')](_0xe77e('0x6a'),_0x5a3ea6[_0xe77e('0x20')])][_0xe77e('0x28')]===_0xe77e('0x6c'));};Fax[_0xe77e('0x19')][_0xe77e('0x6d')]=function(_0x1d7661,_0xdd4546){if(!this['isTrunkReachable'](_0x1d7661)){ut[_0xe77e('0x42')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xe77e('0x68')](_0x1d7661)?'':_0x1d7661[_0xe77e('0x20')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xe77e('0x6e')};}if(_[_0xe77e('0x68')](_0xdd4546['fax'])){ut[_0xe77e('0x42')](_0xe77e('0x6f'),JSON[_0xe77e('0x4e')](_0xdd4546));return{'isValid':![],'message':_0xe77e('0x70')};}if(_['isNil'](_0xdd4546[_0xe77e('0x2')])){ut[_0xe77e('0x42')](_0xe77e('0x71'),JSON['stringify'](_0xdd4546));return{'isValid':![],'message':_0xe77e('0x72')};}return{'isValid':!![],'message':_0xe77e('0x73')};};module[_0xe77e('0x74')]=Fax; \ No newline at end of file +var _0xca22=['../rpc/attachment','../rpc/faxMessage','channels','trunks','actions','newchannel','varset','syncVarSet','newstate','bind','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','syncNewchannel','context','from-voip-provider','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','syncNewState','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','parse','.pdf','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','syncOriginateResponse','reason','update','AttachmentId','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','message','checkAfterSend','checkTrunk','FaxAccountId','isValid','format','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','status','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','lodash','bluebird','uuid','path','./util/gs','../../../config/logger','fax','./channel','./util/util','../rpc/faxAccount'];(function(_0x509fa6,_0x5aa233){var _0x4f4294=function(_0x104d3c){while(--_0x104d3c){_0x509fa6['push'](_0x509fa6['shift']());}};_0x4f4294(++_0x5aa233);}(_0xca22,0x13d));var _0x2ca2=function(_0x299611,_0x2a97ff){_0x299611=_0x299611-0x0;var _0x443eae=_0xca22[_0x299611];return _0x443eae;};'use strict';var util=require('util');var _=require(_0x2ca2('0x0'));var BPromise=require(_0x2ca2('0x1'));var uuid=require(_0x2ca2('0x2'));var moment=require('moment');var path=require(_0x2ca2('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x2ca2('0x4'));var logger=require(_0x2ca2('0x5'))(_0x2ca2('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x2ca2('0x7'));var ut=require(_0x2ca2('0x8'));var Action=require('./action');var faxAccount=require(_0x2ca2('0x9'));var attachment=require(_0x2ca2('0xa'));var faxMessage=require(_0x2ca2('0xb'));function Fax(_0x2efdd4){this[_0x2ca2('0xc')]={};this['faxAccounts']=_0x2efdd4['faxAccounts'];this['trunks']=_0x2efdd4[_0x2ca2('0xd')];this[_0x2ca2('0xe')]={};ami['on'](_0x2ca2('0xf'),this['syncNewchannel']['bind'](this));ami['on'](_0x2ca2('0x10'),this[_0x2ca2('0x11')]['bind'](this));ami['on'](_0x2ca2('0x12'),this['syncNewState'][_0x2ca2('0x13')](this));ami['on'](_0x2ca2('0x14'),this[_0x2ca2('0x15')][_0x2ca2('0x13')](this));ami['on'](_0x2ca2('0x16'),this[_0x2ca2('0x17')][_0x2ca2('0x13')](this));ami['on'](_0x2ca2('0x18'),this[_0x2ca2('0x19')][_0x2ca2('0x13')](this));ami['on'](_0x2ca2('0x1a'),this[_0x2ca2('0x1b')][_0x2ca2('0x13')](this));ami['on'](_0x2ca2('0x1c'),this['syncOriginateResponse'][_0x2ca2('0x13')](this));}Fax[_0x2ca2('0x1d')][_0x2ca2('0x1e')]=function(_0x4c2a5e){if(_0x4c2a5e[_0x2ca2('0x1f')]===_0x2ca2('0x20')){for(var _0x2b719c in this[_0x2ca2('0x21')]){if(this[_0x2ca2('0x21')][_0x2ca2('0x22')](_0x2b719c)){if(_0x4c2a5e[_0x2ca2('0x23')]===this[_0x2ca2('0x21')][_0x2b719c][_0x2ca2('0x24')]){this[_0x2ca2('0xc')][_0x4c2a5e[_0x2ca2('0x25')]]={};this[_0x2ca2('0xc')][_0x4c2a5e[_0x2ca2('0x25')]][_0x2ca2('0x26')]=_0x4c2a5e[_0x2ca2('0x26')];this['channels'][_0x4c2a5e[_0x2ca2('0x25')]]['id']=this[_0x2ca2('0x21')][_0x2b719c]['id'];this['channels'][_0x4c2a5e[_0x2ca2('0x25')]][_0x2ca2('0x27')]=this[_0x2ca2('0x21')][_0x2b719c][_0x2ca2('0x27')];logger['info'](_0x4c2a5e[_0x2ca2('0x25')],_0x2ca2('0x28'));}}}}if(this[_0x2ca2('0xe')][_0x4c2a5e[_0x2ca2('0x25')]]){this['channels'][_0x4c2a5e[_0x2ca2('0x25')]]={};this[_0x2ca2('0xc')][_0x4c2a5e[_0x2ca2('0x25')]][_0x2ca2('0x26')]=_0x4c2a5e[_0x2ca2('0x26')];logger[_0x2ca2('0x29')](_0x4c2a5e['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0x2ca2('0x1d')][_0x2ca2('0x11')]=function(_0x4ea0e0){if(this['channels'][_0x4ea0e0[_0x2ca2('0x25')]]){for(var _0x23612f in _0x4ea0e0['variable']){if(_0x4ea0e0[_0x2ca2('0x2a')][_0x2ca2('0x22')](_0x23612f)){this[_0x2ca2('0xc')][_0x4ea0e0[_0x2ca2('0x25')]][_0x23612f]=_0x4ea0e0[_0x2ca2('0x2b')];}}}};Fax[_0x2ca2('0x1d')][_0x2ca2('0x2c')]=function(_0x3d1ecd){if(this[_0x2ca2('0xc')][_0x3d1ecd[_0x2ca2('0x25')]]){this[_0x2ca2('0xc')][_0x3d1ecd[_0x2ca2('0x25')]][_0x2ca2('0x2d')]=_0x3d1ecd[_0x2ca2('0x2d')];this[_0x2ca2('0xc')][_0x3d1ecd[_0x2ca2('0x25')]][_0x2ca2('0x2e')]=_0x3d1ecd[_0x2ca2('0x2e')];}};Fax[_0x2ca2('0x1d')][_0x2ca2('0x15')]=function(_0x22b6ab){if(this[_0x2ca2('0xc')][_0x22b6ab[_0x2ca2('0x25')]]){for(var _0x360bbc in _0x22b6ab[_0x2ca2('0x2a')]){if(_0x22b6ab['variable']['hasOwnProperty'](_0x360bbc)){this[_0x2ca2('0xc')][_0x22b6ab[_0x2ca2('0x25')]][_0x360bbc]=_0x22b6ab[_0x2ca2('0x2b')];}}}};Fax[_0x2ca2('0x1d')]['syncFaxStatus']=function(_0x3ef006){if(this['channels'][_0x3ef006['uniqueid']]){this[_0x2ca2('0xc')][_0x3ef006[_0x2ca2('0x25')]]['operation']=_0x3ef006[_0x2ca2('0x2f')];this[_0x2ca2('0xc')][_0x3ef006[_0x2ca2('0x25')]]['status']=_0x3ef006['status'];this[_0x2ca2('0xc')][_0x3ef006[_0x2ca2('0x25')]][_0x2ca2('0x24')]=_0x3ef006[_0x2ca2('0x24')];this['channels'][_0x3ef006[_0x2ca2('0x25')]][_0x2ca2('0x30')]=_0x3ef006[_0x2ca2('0x30')];logger[_0x2ca2('0x29')](_0x3ef006[_0x2ca2('0x25')],_0x2ca2('0x31'));}};Fax['prototype'][_0x2ca2('0x19')]=function(_0x2bcb72){var _0x48f291=this;if(this['channels'][_0x2bcb72[_0x2ca2('0x25')]]){var _0x5489d3=this[_0x2ca2('0xc')][_0x2bcb72[_0x2ca2('0x25')]]['id'];this[_0x2ca2('0xc')][_0x2bcb72[_0x2ca2('0x25')]][_0x2ca2('0x32')]=_0x2bcb72[_0x2ca2('0x32')];this[_0x2ca2('0xc')][_0x2bcb72[_0x2ca2('0x25')]]['pagestransferred']=_0x2bcb72[_0x2ca2('0x33')];this[_0x2ca2('0xc')][_0x2bcb72['uniqueid']][_0x2ca2('0x24')]=_0x2bcb72[_0x2ca2('0x24')];this[_0x2ca2('0xc')][_0x2bcb72[_0x2ca2('0x25')]]['resolution']=_0x2bcb72['resolution'];this['channels'][_0x2bcb72[_0x2ca2('0x25')]][_0x2ca2('0x34')]=_0x2bcb72['transferrate'];this[_0x2ca2('0xc')][_0x2bcb72[_0x2ca2('0x25')]]['filename']=_0x2bcb72['filename'];this[_0x2ca2('0xc')][_0x2bcb72[_0x2ca2('0x25')]][_0x2ca2('0x35')]=_0x2bcb72[_0x2ca2('0x35')];if(this['channels'][_0x2bcb72['uniqueid']][_0x2ca2('0x33')]>0x0){tiff2pdf(_0x2bcb72[_0x2ca2('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x1b04d5){logger['info'](_0x2bcb72[_0x2ca2('0x25')],_0x2ca2('0x36'),_0x1b04d5['message']);attachment['create']({'name':path[_0x2ca2('0x37')](_0x2bcb72[_0x2ca2('0x30')])[_0x2ca2('0x27')],'basename':path[_0x2ca2('0x37')](_0x2bcb72[_0x2ca2('0x30')])['name']+_0x2ca2('0x38'),'type':'application/pdf'})['then'](function(_0x1482d8){faxAccount[_0x2ca2('0x39')](_0x5489d3,{'from':_0x2bcb72[_0x2ca2('0x35')],'mapKey':_0x2ca2('0x6'),'body':path[_0x2ca2('0x37')](_0x2bcb72[_0x2ca2('0x30')])[_0x2ca2('0x27')]+'.pdf','AttachmentId':_0x1482d8['id']})[_0x2ca2('0x3a')](function(_0x2d28fd){logger[_0x2ca2('0x3b')](_0x2bcb72[_0x2ca2('0x25')],_0x2ca2('0x3c'),JSON['stringify'](_0x2d28fd));});})['catch'](function(_0x15d400){logger[_0x2ca2('0x3b')](_0x2bcb72[_0x2ca2('0x25')],_0x2ca2('0x3d'),JSON[_0x2ca2('0x3e')](_0x15d400));});});}logger['info'](_0x2bcb72[_0x2ca2('0x25')],'\x20receiveFax\x20');}};Fax[_0x2ca2('0x1d')][_0x2ca2('0x3f')]=function(_0x4646a1){if(this[_0x2ca2('0xe')][_0x4646a1['uniqueid']]){_['merge'](this[_0x2ca2('0xc')][_0x4646a1[_0x2ca2('0x25')]],_['pick'](_0x4646a1,['response',_0x2ca2('0x40')]));}};function updateStatus(_0x340a12){if(_0x340a12['AttachmentId']){faxMessage[_0x2ca2('0x41')](_0x340a12[_0x2ca2('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x2ca2('0x43')](function(_0x10e6fd){ut[_0x2ca2('0x44')](_0x2ca2('0x45'),_0x10e6fd);})[_0x2ca2('0x3a')](function(_0x157ef3){ut['logger'](_0x2ca2('0x46'),_0x157ef3);});}else{ut[_0x2ca2('0x44')]('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x2ca2('0x47')]=function(_0x246d57,_0x2d4cc6,_0x554327){var _0x36fbeb=this;var _0x376bab={};if(_0x2d4cc6){_0x376bab={'read':_0x2d4cc6};}else{_0x376bab={'failMessage':_0x554327};}if(this['actions'][_0x246d57][_0x2ca2('0x42')]){faxMessage[_0x2ca2('0x41')](this[_0x2ca2('0xe')][_0x246d57][_0x2ca2('0x42')],_0x376bab)[_0x2ca2('0x43')](function(_0xc7e418){ut[_0x2ca2('0x44')]('[Fax][Message][Updated]',_0xc7e418);})[_0x2ca2('0x3a')](function(_0x32ed64){ut[_0x2ca2('0x44')](_0x2ca2('0x48'),_0x32ed64);})[_0x2ca2('0x49')](function(){delete _0x36fbeb[_0x2ca2('0xc')][_0x246d57];delete _0x36fbeb[_0x2ca2('0xe')][_0x246d57];});}else{ut[_0x2ca2('0x44')](_0x2ca2('0x4a'));delete this[_0x2ca2('0xc')][_0x246d57];delete this[_0x2ca2('0xe')][_0x246d57];}};Fax[_0x2ca2('0x1d')][_0x2ca2('0x1b')]=function(_0x2a66a3){var _0x13fab5=this;if(this[_0x2ca2('0xc')][_0x2a66a3[_0x2ca2('0x25')]]){if(this[_0x2ca2('0xe')][_0x2a66a3[_0x2ca2('0x25')]]){this[_0x2ca2('0xc')][_0x2a66a3[_0x2ca2('0x25')]]['id']=this[_0x2ca2('0xe')][_0x2a66a3['uniqueid']]['id'];this[_0x2ca2('0xc')][_0x2a66a3[_0x2ca2('0x25')]]['name']=this[_0x2ca2('0xe')][_0x2a66a3[_0x2ca2('0x25')]][_0x2ca2('0x27')];}logger[_0x2ca2('0x29')](_0x2a66a3[_0x2ca2('0x25')],this[_0x2ca2('0xe')][_0x2a66a3[_0x2ca2('0x25')]]?_0x2ca2('0x4b'):_0x2ca2('0x4c'),JSON[_0x2ca2('0x3e')](this[_0x2ca2('0xc')][_0x2a66a3[_0x2ca2('0x25')]]));if(this[_0x2ca2('0xe')][_0x2a66a3[_0x2ca2('0x25')]]){if(this['channels'][_0x2a66a3[_0x2ca2('0x25')]][_0x2ca2('0x4d')]>0x0&&this[_0x2ca2('0xc')][_0x2a66a3[_0x2ca2('0x25')]][_0x2ca2('0x16')]===_0x2ca2('0x4e')){this['updateStatus'](_0x2a66a3['uniqueid'],!![]);}else{this[_0x2ca2('0x47')](_0x2a66a3[_0x2ca2('0x25')],![],this[_0x2ca2('0xc')][_0x2a66a3['uniqueid']]['faxstatusstring']?_0x2ca2('0x4f')+this[_0x2ca2('0xc')][_0x2a66a3[_0x2ca2('0x25')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x2ca2('0x1d')][_0x2ca2('0x50')]=function(_0x4c71c4){var _0x1a965e=this;return new BPromise(function(_0x55037f,_0x3259cd){_0x1a965e[_0x2ca2('0x51')](_0x4c71c4,_0x1a965e[_0x2ca2('0x21')][_0x4c71c4['FaxAccountId']])['then'](function(_0x4f77df){ut[_0x2ca2('0x44')](_0x2ca2('0x52'),_0x4f77df);_0x55037f(ut['message']('Fax\x20received'));})[_0x2ca2('0x3a')](function(_0x2fd71f){ut[_0x2ca2('0x44')](_0x2ca2('0x53'),_0x2fd71f);updateStatus(_0x4c71c4);_0x3259cd(ut[_0x2ca2('0x54')]('Fax\x20failed'));});});};Fax[_0x2ca2('0x1d')][_0x2ca2('0x55')]=function(_0x323682){var _0x3a9a40=this;return new BPromise(function(_0x21d0f6,_0x241a0f){var _0x4dbab3=_0x3a9a40[_0x2ca2('0x56')](_0x3a9a40[_0x2ca2('0x21')][_0x323682[_0x2ca2('0x57')]]['Trunk'],_0x323682);if(_0x4dbab3[_0x2ca2('0x58')]){_0x21d0f6(ut['message']('Trunk\x20Reachable'));}else{_0x241a0f(ut[_0x2ca2('0x54')](_0x4dbab3[_0x2ca2('0x54')]));}});};function originate(_0x2ad5d4,_0x5bec16,_0x428bb3){return new BPromise(function(_0x56552c,_0x389c63){if(_0x428bb3){var _0x592ab6=util[_0x2ca2('0x59')]('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['parse'](_0x2ad5d4[_0x2ca2('0x3')])[_0x2ca2('0x27')],_0x2ad5d4['path']);gs[_0x2ca2('0x5a')](_0x592ab6)['then'](function(){_0x2ad5d4[_0x2ca2('0x3')]=util[_0x2ca2('0x59')](_0x2ca2('0x5b'),path[_0x2ca2('0x37')](_0x2ad5d4[_0x2ca2('0x3')])['dir'],path[_0x2ca2('0x37')](_0x2ad5d4['path'])[_0x2ca2('0x27')]);_0x5bec16[_0x2ca2('0x5c')]=_0x2ad5d4[_0x2ca2('0x3')];ut[_0x2ca2('0x44')](_0x2ca2('0x5d'),'');ami[_0x2ca2('0x5e')](ut['variablesAction'](_0x2ad5d4,_0x5bec16))[_0x2ca2('0x43')](function(_0x554c27){_0x56552c(_0x554c27);})[_0x2ca2('0x3a')](function(_0x2e906d){_0x389c63(_0x2e906d);});})[_0x2ca2('0x3a')](function(_0x4e976c){_0x389c63(_0x4e976c);});}else{ami[_0x2ca2('0x5e')](ut[_0x2ca2('0x5f')](_0x2ad5d4,_0x5bec16))['then'](function(_0x9a0a0a){_0x56552c(_0x9a0a0a);})[_0x2ca2('0x3a')](function(_0x4da1dd){_0x389c63(_0x4da1dd);});}});}Fax['prototype'][_0x2ca2('0x51')]=function(_0x29c33f,_0x49c3c8){var _0x32dc17=this;return new BPromise(function(_0x5b83b6,_0x529e3a){var _0x19af26=uuid['v4']();var _0x3a817f=ut['addVariables'](_0x29c33f,_0x49c3c8);_0x32dc17['actions'][_0x19af26]=new Action(_0x19af26,_0x49c3c8,_0x29c33f);var _0x912213=_0x32dc17[_0x2ca2('0xe')][_0x19af26];if(path[_0x2ca2('0x37')](_0x29c33f[_0x2ca2('0x3')])[_0x2ca2('0x60')]==='.pdf'){originate(_0x912213,_0x3a817f,!![])[_0x2ca2('0x43')](function(_0xab8642){_0x5b83b6(_0xab8642);})['catch'](function(_0x39c2a0){_0x529e3a(_0x39c2a0);});}else{originate(_0x912213,_0x3a817f,![])[_0x2ca2('0x43')](function(_0x290cc3){_0x5b83b6(_0x290cc3);})[_0x2ca2('0x3a')](function(_0x2523a1){_0x529e3a(_0x2523a1);});}});};Fax[_0x2ca2('0x1d')][_0x2ca2('0x61')]=function(_0x11b15b){return!_[_0x2ca2('0x62')](_0x11b15b)&&!_['isNil'](_0x11b15b['name'])&&!_[_0x2ca2('0x62')](_0x11b15b['active'])&&_0x11b15b[_0x2ca2('0x63')]&&!_[_0x2ca2('0x62')](this[_0x2ca2('0xd')][util[_0x2ca2('0x59')](_0x2ca2('0x64'),_0x11b15b['name'])])&&!_[_0x2ca2('0x62')](this[_0x2ca2('0xd')][util['format'](_0x2ca2('0x64'),_0x11b15b[_0x2ca2('0x27')])][_0x2ca2('0x65')])&&(this[_0x2ca2('0xd')][util[_0x2ca2('0x59')](_0x2ca2('0x64'),_0x11b15b[_0x2ca2('0x27')])][_0x2ca2('0x65')]==='reachable'||this[_0x2ca2('0xd')][util[_0x2ca2('0x59')](_0x2ca2('0x64'),_0x11b15b['name'])][_0x2ca2('0x65')]==='unmonitored');};Fax[_0x2ca2('0x1d')][_0x2ca2('0x56')]=function(_0x51dfd6,_0x3709a1){if(!this['isTrunkReachable'](_0x51dfd6)){ut[_0x2ca2('0x44')](_0x2ca2('0x66'),_[_0x2ca2('0x62')](_0x51dfd6)?'':_0x51dfd6[_0x2ca2('0x27')]+_0x2ca2('0x67'));return{'isValid':![],'message':_0x2ca2('0x68')};}if(_[_0x2ca2('0x62')](_0x3709a1[_0x2ca2('0x6')])){ut[_0x2ca2('0x44')](_0x2ca2('0x69'),JSON['stringify'](_0x3709a1));return{'isValid':![],'message':_0x2ca2('0x6a')};}if(_[_0x2ca2('0x62')](_0x3709a1[_0x2ca2('0x3')])){ut[_0x2ca2('0x44')](_0x2ca2('0x6b'),JSON[_0x2ca2('0x3e')](_0x3709a1));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x2ca2('0x6c')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0ed8d92..3dd3561 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 _0x7fec=['error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x17ebe2,_0x1072c9){var _0x2694d7=function(_0x5ef0f0){while(--_0x5ef0f0){_0x17ebe2['push'](_0x17ebe2['shift']());}};_0x2694d7(++_0x1072c9);}(_0x7fec,0x166));var _0xc7fe=function(_0x558349,_0x243263){_0x558349=_0x558349-0x0;var _0xacc059=_0x7fec[_0x558349];return _0xacc059;};'use strict';var util=require(_0xc7fe('0x0'));var BPromise=require(_0xc7fe('0x1'));var logger=require(_0xc7fe('0x2'))(_0xc7fe('0x3'));var _=require(_0xc7fe('0x4'));var faxAccount=require(_0xc7fe('0x5'));function loggerCatch(_0x24ab12){return function(_0x48083d){logger[_0xc7fe('0x6')](_0x24ab12,util[_0xc7fe('0x7')](_0x48083d,{'showHidden':![],'depth':null}));};}exports[_0xc7fe('0x8')]=function(_0xb7fae,_0x51259f){return BPromise[_0xc7fe('0x9')]()[_0xc7fe('0xa')](faxAccount['notify'](_0xb7fae,_0x51259f))[_0xc7fe('0xb')](loggerCatch(_0xc7fe('0xc')));}; \ No newline at end of file +var _0x2249=['bluebird','preview','lodash','error','inspect','notify','resolve','then','catch','[Notify]\x20','util'];(function(_0x276f9e,_0x11ed70){var _0x78f36a=function(_0x175b8c){while(--_0x175b8c){_0x276f9e['push'](_0x276f9e['shift']());}};_0x78f36a(++_0x11ed70);}(_0x2249,0x1c2));var _0x9224=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0x2249[_0x4d0df6];return _0x4e2615;};'use strict';var util=require(_0x9224('0x0'));var BPromise=require(_0x9224('0x1'));var logger=require('../../../config/logger')(_0x9224('0x2'));var _=require(_0x9224('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x26cf8d){return function(_0x29a83a){logger[_0x9224('0x4')](_0x26cf8d,util[_0x9224('0x5')](_0x29a83a,{'showHidden':![],'depth':null}));};}exports[_0x9224('0x6')]=function(_0x1fda01,_0x5102eb){return BPromise[_0x9224('0x7')]()[_0x9224('0x8')](faxAccount['notify'](_0x1fda01,_0x5102eb))[_0x9224('0x9')](loggerCatch(_0x9224('0xa')));}; \ 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 3fab8c6..af0abf5 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 _0x41ed=['fax','child_process','execute','info','Exec\x20gs','\x20Error\x20:','../../../../config/logger'];(function(_0x145a9f,_0x11e82d){var _0x1a206e=function(_0x3422e4){while(--_0x3422e4){_0x145a9f['push'](_0x145a9f['shift']());}};_0x1a206e(++_0x11e82d);}(_0x41ed,0x1db));var _0xd41e=function(_0x398872,_0x209e1f){_0x398872=_0x398872-0x0;var _0x307542=_0x41ed[_0x398872];return _0x307542;};'use strict';var util=require('util');var logger=require(_0xd41e('0x0'))(_0xd41e('0x1'));var BPromise=require('bluebird');var exec=require(_0xd41e('0x2'))['exec'];exports[_0xd41e('0x3')]=function(_0x46d9ad){return new BPromise(function(_0x506af5,_0x2a27b5){exec(_0x46d9ad,function(_0x3c7458,_0x42ceb1,_0x145d0a){logger[_0xd41e('0x4')](_0xd41e('0x5'),_0x42ceb1);if(_0x3c7458){logger[_0xd41e('0x4')](_0xd41e('0x5'),_0xd41e('0x6'),util['inspect'](_0x3c7458,{'showHidden':![],'depth':null}),_0x42ceb1,_0x145d0a);_0x2a27b5(_0x3c7458);}_0x506af5(_0x42ceb1);});});}; \ No newline at end of file +var _0xe9da=['fax','bluebird','execute','Exec\x20gs','info','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x128dca,_0x2cbd5f){var _0x1d85f8=function(_0x49ae9f){while(--_0x49ae9f){_0x128dca['push'](_0x128dca['shift']());}};_0x1d85f8(++_0x2cbd5f);}(_0xe9da,0x7c));var _0xae9d=function(_0x160ef5,_0x34449e){_0x160ef5=_0x160ef5-0x0;var _0x213d20=_0xe9da[_0x160ef5];return _0x213d20;};'use strict';var util=require(_0xae9d('0x0'));var logger=require(_0xae9d('0x1'))(_0xae9d('0x2'));var BPromise=require(_0xae9d('0x3'));var exec=require('child_process')['exec'];exports[_0xae9d('0x4')]=function(_0x184d68){return new BPromise(function(_0x4d5f3a,_0x49819c){exec(_0x184d68,function(_0x185457,_0x27bcd3,_0x46d839){logger['info'](_0xae9d('0x5'),_0x27bcd3);if(_0x185457){logger[_0xae9d('0x6')]('Exec\x20gs',_0xae9d('0x7'),util[_0xae9d('0x8')](_0x185457,{'showHidden':![],'depth':null}),_0x27bcd3,_0x46d839);_0x49819c(_0x185457);}_0x4d5f3a(_0x27bcd3);});});}; \ 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 9e0102b..a6f192a 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 _0xb7c8=['logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','faxdetect','t38timeout','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','uniqueid','lodash','moment','../../../../config/logger','fax','message'];(function(_0x4706c6,_0x23d052){var _0x2d7a25=function(_0xdb502f){while(--_0xdb502f){_0x4706c6['push'](_0x4706c6['shift']());}};_0x2d7a25(++_0x23d052);}(_0xb7c8,0x119));var _0x8b7c=function(_0x2c8454,_0x579501){_0x2c8454=_0x2c8454-0x0;var _0x511f5b=_0xb7c8[_0x2c8454];return _0x511f5b;};'use strict';var util=require('util');var _=require(_0x8b7c('0x0'));var moment=require(_0x8b7c('0x1'));var logger=require(_0x8b7c('0x2'))(_0x8b7c('0x3'));exports[_0x8b7c('0x4')]=function(_0x31ad24){return{'message':_0x31ad24};};exports[_0x8b7c('0x5')]=function(_0x50113e,_0x38672b){logger[_0x8b7c('0x6')](_0x50113e,util[_0x8b7c('0x7')](_0x38672b,{'showHidden':![],'depth':null}));};exports[_0x8b7c('0x8')]=function(_0x107428,_0x12665c){var _0x7a3850={'XMF-ECM':_0x12665c[_0x8b7c('0x9')],'XMF-HEADERINFO':_0x12665c[_0x8b7c('0xa')],'XMF-MINRATE':_0x12665c[_0x8b7c('0xb')],'XMF-MAXRATE':_0x12665c[_0x8b7c('0xc')],'XMF-MODEM':util[_0x8b7c('0xd')]('\x22%s\x22',_0x12665c[_0x8b7c('0xe')]),'XMF-GATEWAY':_0x12665c['gateway'],'XMF-FAXDETECT':_0x12665c[_0x8b7c('0xf')],'XMF-T38TIMEOUT':_0x12665c[_0x8b7c('0x10')],'XMF-LOCALSTATIONID':_0x12665c['localstationid'],'XMF-PATH':_0x107428[_0x8b7c('0x11')]};return _0x7a3850;};exports[_0x8b7c('0x12')]=function(_0x3594b1,_0x586826){return{'actionid':_0x3594b1['uniqueid'],'action':_0x8b7c('0x13'),'channel':_0x3594b1[_0x8b7c('0x14')],'Exten':_0x8b7c('0x15'),'Context':_0x8b7c('0x16'),'Priority':'1','callerid':util[_0x8b7c('0xd')](_0x8b7c('0x17'),_0x3594b1[_0x8b7c('0xa')]?_0x3594b1['headerinfo']:'',_0x3594b1[_0x8b7c('0x18')]),'variable':_0x586826,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3594b1[_0x8b7c('0x19')]};}; \ No newline at end of file +var _0x593e=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','t38timeout','localstationid','path','uniqueid','originate','channel'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x593e,0xcb));var _0xe593=function(_0xa81603,_0x43c9b5){_0xa81603=_0xa81603-0x0;var _0xc22b01=_0x593e[_0xa81603];return _0xc22b01;};'use strict';var util=require(_0xe593('0x0'));var _=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var logger=require(_0xe593('0x3'))(_0xe593('0x4'));exports[_0xe593('0x5')]=function(_0x2c7c48){return{'message':_0x2c7c48};};exports[_0xe593('0x6')]=function(_0x550574,_0x8a87e8){logger[_0xe593('0x7')](_0x550574,util[_0xe593('0x8')](_0x8a87e8,{'showHidden':![],'depth':null}));};exports[_0xe593('0x9')]=function(_0x3b7082,_0x14cff3){var _0x1cda29={'XMF-ECM':_0x14cff3[_0xe593('0xa')],'XMF-HEADERINFO':_0x14cff3[_0xe593('0xb')],'XMF-MINRATE':_0x14cff3[_0xe593('0xc')],'XMF-MAXRATE':_0x14cff3['maxrate'],'XMF-MODEM':util[_0xe593('0xd')](_0xe593('0xe'),_0x14cff3[_0xe593('0xf')]),'XMF-GATEWAY':_0x14cff3['gateway'],'XMF-FAXDETECT':_0x14cff3['faxdetect'],'XMF-T38TIMEOUT':_0x14cff3[_0xe593('0x10')],'XMF-LOCALSTATIONID':_0x14cff3[_0xe593('0x11')],'XMF-PATH':_0x3b7082[_0xe593('0x12')]};return _0x1cda29;};exports['variablesAction']=function(_0x6a5d4f,_0x6bc1b8){return{'actionid':_0x6a5d4f[_0xe593('0x13')],'action':_0xe593('0x14'),'channel':_0x6a5d4f[_0xe593('0x15')],'Exten':_0xe593('0x16'),'Context':_0xe593('0x17'),'Priority':'1','callerid':util[_0xe593('0xd')](_0xe593('0x18'),_0x6a5d4f[_0xe593('0xb')]?_0x6a5d4f['headerinfo']:'',_0x6a5d4f[_0xe593('0x11')]),'variable':_0x6bc1b8,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x6a5d4f[_0xe593('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ba13214..ba49285 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 _0x7c39=['getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./acw','./trigger','./dialer','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','hour','get','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7c39,0x98));var _0x97c3=function(_0x4e822a,_0x21f15e){_0x4e822a=_0x4e822a-0x0;var _0x5908df=_0x7c39[_0x4e822a];return _0x5908df;};'use strict';var BPromise=require(_0x97c3('0x0'));var util=require(_0x97c3('0x1'));var moment=require(_0x97c3('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x97c3('0x3'));var Trigger=require(_0x97c3('0x4'));var Dialer=require(_0x97c3('0x5'));var Preview=require('./preview');var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x97c3('0x6'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x97c3('0x7'));var trunk=require(_0x97c3('0x8'));var trigger=require('./rpc/trigger');var template=require(_0x97c3('0x9'));var cmHopperHistory=require(_0x97c3('0xa'));var campaign=require(_0x97c3('0xb'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x97c3('0xc'));var zendesk=require(_0x97c3('0xd'));var salesforce=require(_0x97c3('0xe'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x97c3('0xf'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x97c3('0x10'));var freshsales=require(_0x97c3('0x11'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x97c3('0x12'));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'](_0x97c3('0x13'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x97c3('0x14')](_0x97c3('0x13'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x97c3('0x15')]()[_0x97c3('0x16')](user[_0x97c3('0x17')]())[_0x97c3('0x16')](realtime['initAgents']())[_0x97c3('0x16')](user[_0x97c3('0x18')]())[_0x97c3('0x16')](realtime[_0x97c3('0x19')]())[_0x97c3('0x16')](trunk[_0x97c3('0x1a')]())[_0x97c3('0x16')](realtime[_0x97c3('0x1b')]())[_0x97c3('0x16')](voiceQueue['getVoiceQueues']())['then'](realtime[_0x97c3('0x1c')]())[_0x97c3('0x16')](trigger[_0x97c3('0x1d')]())[_0x97c3('0x16')](realtime[_0x97c3('0x1e')]())[_0x97c3('0x16')](template[_0x97c3('0x1f')]())['then'](realtime['initTemplates']())[_0x97c3('0x16')](zendesk[_0x97c3('0x20')]())['then'](realtime[_0x97c3('0x21')]())[_0x97c3('0x16')](salesforce[_0x97c3('0x22')]())[_0x97c3('0x16')](realtime[_0x97c3('0x23')]())[_0x97c3('0x16')](sugarcrm['getSugarcrmAccounts']())[_0x97c3('0x16')](realtime[_0x97c3('0x24')]())[_0x97c3('0x16')](freshdesk['getFreshdeskAccounts']())['then'](realtime['initFreshdeskAccounts']())['then'](desk[_0x97c3('0x25')]())[_0x97c3('0x16')](realtime[_0x97c3('0x26')]())[_0x97c3('0x16')](zoho[_0x97c3('0x27')]())['then'](realtime[_0x97c3('0x28')]())[_0x97c3('0x16')](vtiger[_0x97c3('0x29')]())[_0x97c3('0x16')](realtime[_0x97c3('0x2a')]())[_0x97c3('0x16')](freshsales[_0x97c3('0x2b')]())[_0x97c3('0x16')](realtime[_0x97c3('0x2c')]())[_0x97c3('0x16')](servicenow['getServicenowAccounts']())[_0x97c3('0x16')](realtime[_0x97c3('0x2d')]())['then'](dynamics365[_0x97c3('0x2e')]())[_0x97c3('0x16')](realtime[_0x97c3('0x2f')]())[_0x97c3('0x16')](campaign[_0x97c3('0x30')]())[_0x97c3('0x16')](realtime[_0x97c3('0x31')]())[_0x97c3('0x16')](voiceExtension['getVoiceExtensions']())['then'](realtime['initVoiceExtensions']())['then'](faxAccount[_0x97c3('0x32')]())[_0x97c3('0x16')](realtime[_0x97c3('0x33')]())[_0x97c3('0x16')](function(){return realtime;});}function initParams(){return BPromise[_0x97c3('0x15')]()[_0x97c3('0x16')](voiceQueueReport[_0x97c3('0x34')]())[_0x97c3('0x16')](realtime['initVoiceQueueReports']())[_0x97c3('0x16')](cmHopperHistory[_0x97c3('0x35')]())[_0x97c3('0x16')](realtime[_0x97c3('0x36')]())[_0x97c3('0x16')](cmHopperHistory[_0x97c3('0x37')]())[_0x97c3('0x16')](realtime['initCampaignHopperHistory']())[_0x97c3('0x16')](voiceCallReport['getVoiceCallReports']())[_0x97c3('0x16')](realtime[_0x97c3('0x38')]())[_0x97c3('0x16')](function(_0x42ecb0){})[_0x97c3('0x39')](function(_0x3537e1){console[_0x97c3('0x3a')](_0x3537e1);});}function main(){return server[_0x97c3('0x3b')](realtime,preview,fax)[_0x97c3('0x16')](function(_0x3ad580){return initRealtime();})[_0x97c3('0x16')](function(){return initParams();})['then'](function(){report[_0x97c3('0x3c')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x119fe){console[_0x97c3('0x3a')](_0x119fe);});}main(); \ No newline at end of file +var _0x80bb=['initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts'];(function(_0x3d4abb,_0x54f038){var _0x1cf665=function(_0x2215cc){while(--_0x2215cc){_0x3d4abb['push'](_0x3d4abb['shift']());}};_0x1cf665(++_0x54f038);}(_0x80bb,0x120));var _0xb80b=function(_0x316686,_0x1d0887){_0x316686=_0x316686-0x0;var _0x7c9440=_0x80bb[_0x316686];return _0x7c9440;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require(_0xb80b('0x0'));var server=require(_0xb80b('0x1'));var Realtime=require(_0xb80b('0x2'));var Report=require(_0xb80b('0x3'));var Acw=require(_0xb80b('0x4'));var Trigger=require(_0xb80b('0x5'));var Dialer=require(_0xb80b('0x6'));var Preview=require(_0xb80b('0x7'));var Fax=require(_0xb80b('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0xb80b('0x9'));var voiceQueueReport=require(_0xb80b('0xa'));var voiceCallReport=require(_0xb80b('0xb'));var trunk=require(_0xb80b('0xc'));var trigger=require(_0xb80b('0xd'));var template=require(_0xb80b('0xe'));var cmHopperHistory=require(_0xb80b('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xb80b('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xb80b('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xb80b('0x12'));var freshdesk=require(_0xb80b('0x13'));var desk=require(_0xb80b('0x14'));var zoho=require(_0xb80b('0x15'));var vtiger=require(_0xb80b('0x16'));var freshsales=require(_0xb80b('0x17'));var servicenow=require(_0xb80b('0x18'));var dynamics365=require(_0xb80b('0x19'));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()[_0xb80b('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xb80b('0x1a')](_0xb80b('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xb80b('0x1c')]()['then'](user[_0xb80b('0x1d')]())[_0xb80b('0x1e')](realtime[_0xb80b('0x1f')]())['then'](user[_0xb80b('0x20')]())[_0xb80b('0x1e')](realtime[_0xb80b('0x21')]())['then'](trunk[_0xb80b('0x22')]())['then'](realtime[_0xb80b('0x23')]())['then'](voiceQueue[_0xb80b('0x24')]())[_0xb80b('0x1e')](realtime['initVoiceQueues']())[_0xb80b('0x1e')](trigger[_0xb80b('0x25')]())[_0xb80b('0x1e')](realtime['initTriggers']())[_0xb80b('0x1e')](template[_0xb80b('0x26')]())['then'](realtime[_0xb80b('0x27')]())[_0xb80b('0x1e')](zendesk['getZendeskAccounts']())[_0xb80b('0x1e')](realtime[_0xb80b('0x28')]())[_0xb80b('0x1e')](salesforce[_0xb80b('0x29')]())[_0xb80b('0x1e')](realtime[_0xb80b('0x2a')]())[_0xb80b('0x1e')](sugarcrm[_0xb80b('0x2b')]())[_0xb80b('0x1e')](realtime[_0xb80b('0x2c')]())['then'](freshdesk['getFreshdeskAccounts']())[_0xb80b('0x1e')](realtime['initFreshdeskAccounts']())['then'](desk[_0xb80b('0x2d')]())[_0xb80b('0x1e')](realtime[_0xb80b('0x2e')]())[_0xb80b('0x1e')](zoho[_0xb80b('0x2f')]())[_0xb80b('0x1e')](realtime[_0xb80b('0x30')]())[_0xb80b('0x1e')](vtiger[_0xb80b('0x31')]())[_0xb80b('0x1e')](realtime['initVtigerAccounts']())[_0xb80b('0x1e')](freshsales[_0xb80b('0x32')]())[_0xb80b('0x1e')](realtime[_0xb80b('0x33')]())['then'](servicenow['getServicenowAccounts']())[_0xb80b('0x1e')](realtime['initServicenowAccounts']())['then'](dynamics365['getDynamics365Accounts']())[_0xb80b('0x1e')](realtime[_0xb80b('0x34')]())[_0xb80b('0x1e')](campaign[_0xb80b('0x35')]())[_0xb80b('0x1e')](realtime[_0xb80b('0x36')]())[_0xb80b('0x1e')](voiceExtension[_0xb80b('0x37')]())[_0xb80b('0x1e')](realtime[_0xb80b('0x38')]())['then'](faxAccount[_0xb80b('0x39')]())[_0xb80b('0x1e')](realtime[_0xb80b('0x3a')]())[_0xb80b('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0xb80b('0x1c')]()['then'](voiceQueueReport[_0xb80b('0x3b')]())[_0xb80b('0x1e')](realtime['initVoiceQueueReports']())[_0xb80b('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0xb80b('0x3c')]())[_0xb80b('0x1e')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0xb80b('0x3d')]())[_0xb80b('0x1e')](voiceCallReport[_0xb80b('0x3e')]())['then'](realtime[_0xb80b('0x3f')]())[_0xb80b('0x1e')](function(_0x5ab01a){})[_0xb80b('0x40')](function(_0x9f9902){console[_0xb80b('0x41')](_0x9f9902);});}function main(){return server[_0xb80b('0x42')](realtime,preview,fax)[_0xb80b('0x1e')](function(_0x482f66){return initRealtime();})[_0xb80b('0x1e')](function(){return initParams();})[_0xb80b('0x1e')](function(){report[_0xb80b('0x43')]();setInterval(initRealtime,0x1388);})[_0xb80b('0x40')](function(_0x18d81d){console[_0xb80b('0x41')](_0x18d81d);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index b43a1a3..d5df897 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 _0x35b4=['email','fullname','unknown','address','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','state','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','stateTime','status','format','user:%s','emit','user:save','lodash','util','moment','md5','redis','localhost','socket.io-emitter','name'];(function(_0x1a9caa,_0x4ffb13){var _0x5c4478=function(_0x26fd59){while(--_0x26fd59){_0x1a9caa['push'](_0x1a9caa['shift']());}};_0x5c4478(++_0x4ffb13);}(_0x35b4,0x156));var _0x435b=function(_0x2d37b1,_0x347d8b){_0x2d37b1=_0x2d37b1-0x0;var _0x5bbad2=_0x35b4[_0x2d37b1];return _0x5bbad2;};'use strict';var _=require(_0x435b('0x0'));var util=require(_0x435b('0x1'));var moment=require(_0x435b('0x2'));var md5=require(_0x435b('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x435b('0x4')]=_['defaults'](config[_0x435b('0x4')],{'host':_0x435b('0x5'),'port':0x18eb});var io=require(_0x435b('0x6'))(new Redis(config[_0x435b('0x4')]));function Agent(_0x4b09ea){this['id']=_0x4b09ea['id']||0x0;this['name']=_0x4b09ea[_0x435b('0x7')]||'';this['email']=_0x4b09ea[_0x435b('0x8')]||'';this['accountcode']=_0x4b09ea['accountcode']||'';this[_0x435b('0x9')]=_0x4b09ea[_0x435b('0x9')]||'';this['state']=_0x435b('0xa');this['stateTime']=0x0;this['status']='unknown';this[_0x435b('0xb')]='';this[_0x435b('0xc')]='';this['mobile']='';this[_0x435b('0xd')]='';this['online']=_0x4b09ea[_0x435b('0xe')]||![];this[_0x435b('0xf')]=_0x435b('0xa');this[_0x435b('0x10')]=0x0;this[_0x435b('0x11')]='';this[_0x435b('0x12')]='';this[_0x435b('0x13')]=![];this[_0x435b('0x14')]=![];this[_0x435b('0x3')]='';}Agent['prototype']['updateStatusRealtime']=function(_0x27feaf){var _0x1eba58;if(_0x27feaf&&_0x27feaf[_0x435b('0x15')]){_0x1eba58=_0x27feaf[_0x435b('0x15')][_0x435b('0x16')]();switch(_0x1eba58){case _0x435b('0x17'):_0x1eba58=_0x435b('0x18');break;case _0x435b('0x19'):_0x1eba58=_0x435b('0x1a');break;}}if(_0x1eba58&&this[_0x435b('0xf')]!==_0x1eba58||_0x27feaf[_0x435b('0x1b')]){this['voiceStatusTime']=_[_0x435b('0x1c')](moment()['format']('x'));}if(_0x1eba58){this[_0x435b('0xf')]=_0x1eba58;}var _0x216b2c={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0x435b('0x1d')],'status':this[_0x435b('0x1e')],'address':this[_0x435b('0xb')],'online':this[_0x435b('0xe')],'voiceStatus':this[_0x435b('0xf')],'voiceStatusTime':this[_0x435b('0x10')],'voiceStatusCallerIdNumber':this[_0x435b('0x11')],'voiceStatusQueue':this[_0x435b('0x12')],'interface':this[_0x435b('0xd')],'onhold':this[_0x435b('0x13')]};var _0x9ffbb3=md5(JSON['stringify'](_0x216b2c));if(this[_0x435b('0x3')]!==_0x9ffbb3){this[_0x435b('0x3')]=_0x9ffbb3;io['to'](util[_0x435b('0x1f')](_0x435b('0x20'),_0x216b2c[_0x435b('0x7')]))[_0x435b('0x21')](_0x435b('0x22'),_0x216b2c);}};module['exports']=Agent; \ No newline at end of file +var _0x7918=['idle','inuse','talking','toNumber','format','user:%s','emit','user:save','exports','lodash','util','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase'];(function(_0x4a1ac1,_0x55f2d2){var _0x158882=function(_0x33ef0d){while(--_0x33ef0d){_0x4a1ac1['push'](_0x4a1ac1['shift']());}};_0x158882(++_0x55f2d2);}(_0x7918,0x1c5));var _0x8791=function(_0x5964e1,_0x2b19b9){_0x5964e1=_0x5964e1-0x0;var _0x1c85a7=_0x7918[_0x5964e1];return _0x1c85a7;};'use strict';var _=require(_0x8791('0x0'));var util=require(_0x8791('0x1'));var moment=require('moment');var md5=require(_0x8791('0x2'));var Redis=require(_0x8791('0x3'));var config=require(_0x8791('0x4'));config['redis']=_[_0x8791('0x5')](config[_0x8791('0x6')],{'host':_0x8791('0x7'),'port':0x18eb});var io=require(_0x8791('0x8'))(new Redis(config[_0x8791('0x6')]));function Agent(_0x18cf3a){this['id']=_0x18cf3a['id']||0x0;this[_0x8791('0x9')]=_0x18cf3a[_0x8791('0x9')]||'';this[_0x8791('0xa')]=_0x18cf3a[_0x8791('0xa')]||'';this[_0x8791('0xb')]=_0x18cf3a[_0x8791('0xb')]||'';this[_0x8791('0xc')]=_0x18cf3a[_0x8791('0xc')]||'';this[_0x8791('0xd')]=_0x8791('0xe');this[_0x8791('0xf')]=0x0;this[_0x8791('0x10')]=_0x8791('0xe');this['address']='';this[_0x8791('0x11')]='';this['mobile']='';this[_0x8791('0x12')]='';this['online']=_0x18cf3a[_0x8791('0x13')]||![];this[_0x8791('0x14')]=_0x8791('0xe');this[_0x8791('0x15')]=0x0;this[_0x8791('0x16')]='';this['voiceStatusQueue']='';this[_0x8791('0x17')]=![];this[_0x8791('0x18')]=![];this[_0x8791('0x2')]='';}Agent[_0x8791('0x19')][_0x8791('0x1a')]=function(_0x9bf827){var _0x1f3d41;if(_0x9bf827&&_0x9bf827[_0x8791('0xd')]){_0x1f3d41=_0x9bf827[_0x8791('0xd')][_0x8791('0x1b')]();switch(_0x1f3d41){case'not_inuse':_0x1f3d41=_0x8791('0x1c');break;case _0x8791('0x1d'):_0x1f3d41=_0x8791('0x1e');break;}}if(_0x1f3d41&&this['voiceStatus']!==_0x1f3d41||_0x9bf827['statePause']){this[_0x8791('0x15')]=_[_0x8791('0x1f')](moment()[_0x8791('0x20')]('x'));}if(_0x1f3d41){this['voiceStatus']=_0x1f3d41;}var _0x15733b={'id':this['id'],'name':this[_0x8791('0x9')],'email':this[_0x8791('0xa')],'accountcode':this[_0x8791('0xb')],'fullname':this[_0x8791('0xc')],'state':this[_0x8791('0xd')],'stateTime':this[_0x8791('0xf')],'status':this[_0x8791('0x10')],'address':this['address'],'online':this[_0x8791('0x13')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x8791('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x8791('0x12')],'onhold':this[_0x8791('0x17')]};var _0x4d2492=md5(JSON['stringify'](_0x15733b));if(this[_0x8791('0x2')]!==_0x4d2492){this[_0x8791('0x2')]=_0x4d2492;io['to'](util[_0x8791('0x20')](_0x8791('0x21'),_0x15733b[_0x8791('0x9')]))[_0x8791('0x22')](_0x8791('0x23'),_0x15733b);}};module[_0x8791('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index ec58918..8022fa0 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 _0x9926=['dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0x1f6215,_0x59e6ea){var _0x54ca44=function(_0x404e90){while(--_0x404e90){_0x1f6215['push'](_0x1f6215['shift']());}};_0x54ca44(++_0x59e6ea);}(_0x9926,0x104));var _0x6992=function(_0xe1c7bb,_0x47eaba){_0xe1c7bb=_0xe1c7bb-0x0;var _0x4a8128=_0x9926[_0xe1c7bb];return _0x4a8128;};'use strict';function Campaign(_0x945e7a){this['id']=_0x945e7a['id']||0x0;this['name']=_0x945e7a[_0x6992('0x0')]||'';this[_0x6992('0x1')]=_0x945e7a[_0x6992('0x1')]||_0x6992('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x6992('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x6992('0x4')]='';this[_0x6992('0x5')]=!![];this[_0x6992('0x6')]=_0x945e7a[_0x6992('0x6')];this[_0x6992('0x7')]=_0x945e7a['limitCalls'];this[_0x6992('0x8')]=_0x945e7a[_0x6992('0x8')]||null;this[_0x6992('0x9')]=_0x945e7a[_0x6992('0x9')]?_0x945e7a[_0x6992('0x9')]:null;this[_0x6992('0xa')]=_0x945e7a[_0x6992('0xa')];this[_0x6992('0xb')]=_0x945e7a[_0x6992('0xb')];this[_0x6992('0xc')]=_0x945e7a[_0x6992('0xc')]||0x1e;this[_0x6992('0xd')]=_0x945e7a[_0x6992('0xd')];this[_0x6992('0xe')]=_0x945e7a[_0x6992('0xe')];this[_0x6992('0xf')]=_0x945e7a['dialBusyMaxRetry'];this[_0x6992('0x10')]=_0x945e7a[_0x6992('0x10')];this[_0x6992('0x11')]=_0x945e7a[_0x6992('0x11')];this[_0x6992('0x12')]=_0x945e7a['dialNoAnswerRetryFrequency'];this[_0x6992('0x13')]=_0x945e7a[_0x6992('0x13')];this[_0x6992('0x14')]=_0x945e7a['dialNoSuchNumberMaxRetry']||0x3;this[_0x6992('0x15')]=_0x945e7a[_0x6992('0x15')]||0x96;this[_0x6992('0x16')]=_0x945e7a[_0x6992('0x16')]||0x3;this[_0x6992('0x17')]=_0x945e7a['dialDropRetryFrequency']||0x96;this[_0x6992('0x18')]=_0x945e7a[_0x6992('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0x945e7a['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x945e7a['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x945e7a[_0x6992('0x19')]||0x96;this[_0x6992('0x1a')]=_0x945e7a[_0x6992('0x1a')]||0x3;this[_0x6992('0x1b')]=_0x945e7a[_0x6992('0x1b')]||0x96;this[_0x6992('0x1c')]=_0x945e7a[_0x6992('0x1c')]||_0x6992('0x1d');this[_0x6992('0x1e')]=_0x945e7a['dialPrefix']||undefined;this[_0x6992('0x1f')]=_0x945e7a[_0x6992('0x1f')]||undefined;this[_0x6992('0x20')]=_0x945e7a[_0x6992('0x20')]||undefined;this['TrunkBackup']=_0x945e7a[_0x6992('0x21')]?_0x945e7a[_0x6992('0x21')]:undefined;this['Trunk']=_0x945e7a[_0x6992('0x22')]?_0x945e7a[_0x6992('0x22')]:undefined;this['Interval']=_0x945e7a[_0x6992('0x23')]?_0x945e7a[_0x6992('0x23')]:undefined;this[_0x6992('0x24')]=_0x945e7a['SquareProject']?_0x945e7a[_0x6992('0x24')]:undefined;this['dialQueueProject']=_0x945e7a[_0x6992('0x24')]?_0x945e7a[_0x6992('0x24')][_0x6992('0x0')]:undefined;this[_0x6992('0x25')]=_0x945e7a[_0x6992('0x25')]||![];this['dialAMDInitialSilence']=_0x945e7a[_0x6992('0x26')];this['dialAMDGreeting']=_0x945e7a[_0x6992('0x27')];this[_0x6992('0x28')]=_0x945e7a[_0x6992('0x28')];this[_0x6992('0x29')]=_0x945e7a[_0x6992('0x29')];this[_0x6992('0x2a')]=_0x945e7a[_0x6992('0x2a')];this[_0x6992('0x2b')]=_0x945e7a[_0x6992('0x2b')];this[_0x6992('0x2c')]=_0x945e7a[_0x6992('0x2c')];this[_0x6992('0x2d')]=_0x945e7a[_0x6992('0x2d')];this[_0x6992('0x2e')]=_0x945e7a['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0x016e=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','name','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence'];(function(_0x4ef395,_0x45faed){var _0x155d7d=function(_0x562ca0){while(--_0x562ca0){_0x4ef395['push'](_0x4ef395['shift']());}};_0x155d7d(++_0x45faed);}(_0x016e,0x1ad));var _0xe016=function(_0x3b0d98,_0x346f06){_0x3b0d98=_0x3b0d98-0x0;var _0x296885=_0x016e[_0x3b0d98];return _0x296885;};'use strict';function Campaign(_0x39770e){this['id']=_0x39770e['id']||0x0;this[_0xe016('0x0')]=_0x39770e['name']||'';this['type']=_0x39770e['type']||_0xe016('0x1');this[_0xe016('0x2')]=0x0;this[_0xe016('0x3')]=0x0;this[_0xe016('0x4')]=0x0;this[_0xe016('0x5')]=0x0;this[_0xe016('0x6')]='';this[_0xe016('0x7')]=!![];this['active']=_0x39770e[_0xe016('0x8')];this[_0xe016('0x9')]=_0x39770e[_0xe016('0x9')];this['dialTimezone']=_0x39770e[_0xe016('0xa')]||null;this[_0xe016('0xb')]=_0x39770e['dialGlobalInterval']?_0x39770e[_0xe016('0xb')]:null;this[_0xe016('0xc')]=_0x39770e[_0xe016('0xc')];this[_0xe016('0xd')]=_0x39770e[_0xe016('0xd')];this['dialOriginateTimeout']=_0x39770e[_0xe016('0xe')]||0x1e;this[_0xe016('0xf')]=_0x39770e[_0xe016('0xf')];this[_0xe016('0x10')]=_0x39770e[_0xe016('0x10')];this['dialBusyMaxRetry']=_0x39770e[_0xe016('0x11')];this[_0xe016('0x12')]=_0x39770e['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x39770e[_0xe016('0x13')];this[_0xe016('0x14')]=_0x39770e[_0xe016('0x14')];this[_0xe016('0x15')]=_0x39770e['dialGlobalMaxRetry'];this[_0xe016('0x16')]=_0x39770e[_0xe016('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x39770e['dialNoSuchNumberRetryFrequency']||0x96;this[_0xe016('0x17')]=_0x39770e[_0xe016('0x17')]||0x3;this[_0xe016('0x18')]=_0x39770e[_0xe016('0x18')]||0x96;this[_0xe016('0x19')]=_0x39770e[_0xe016('0x19')]||0x3;this[_0xe016('0x1a')]=_0x39770e['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x39770e['dialMachineMaxRetry']||0x3;this[_0xe016('0x1b')]=_0x39770e[_0xe016('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x39770e[_0xe016('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x39770e['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x39770e[_0xe016('0x1d')]||_0xe016('0x1e');this[_0xe016('0x1f')]=_0x39770e[_0xe016('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x39770e[_0xe016('0x20')]||undefined;this[_0xe016('0x21')]=_0x39770e[_0xe016('0x21')]||undefined;this[_0xe016('0x22')]=_0x39770e[_0xe016('0x22')]?_0x39770e['TrunkBackup']:undefined;this['Trunk']=_0x39770e[_0xe016('0x23')]?_0x39770e['Trunk']:undefined;this[_0xe016('0x24')]=_0x39770e[_0xe016('0x24')]?_0x39770e[_0xe016('0x24')]:undefined;this[_0xe016('0x25')]=_0x39770e[_0xe016('0x25')]?_0x39770e[_0xe016('0x25')]:undefined;this[_0xe016('0x26')]=_0x39770e[_0xe016('0x25')]?_0x39770e['SquareProject'][_0xe016('0x0')]:undefined;this[_0xe016('0x27')]=_0x39770e[_0xe016('0x27')]||![];this['dialAMDInitialSilence']=_0x39770e[_0xe016('0x28')];this[_0xe016('0x29')]=_0x39770e[_0xe016('0x29')];this[_0xe016('0x2a')]=_0x39770e[_0xe016('0x2a')];this['dialAMDTotalAnalysisTime']=_0x39770e[_0xe016('0x2b')];this[_0xe016('0x2c')]=_0x39770e['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x39770e[_0xe016('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x39770e['dialAMDMaximumNumberOfWords'];this[_0xe016('0x2e')]=_0x39770e['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x39770e['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index f20eb33..a83c0d6 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 _0xbc87=['starttime','calleridnum','calleridname','connectedlinenum','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports'];(function(_0x2cab9e,_0x3087dd){var _0x18498d=function(_0x347f9c){while(--_0x347f9c){_0x2cab9e['push'](_0x2cab9e['shift']());}};_0x18498d(++_0x3087dd);}(_0xbc87,0x144));var _0x7bc8=function(_0x2d7bbf,_0x5554f9){_0x2d7bbf=_0x2d7bbf-0x0;var _0x26ce6d=_0xbc87[_0x2d7bbf];return _0x26ce6d;};'use strict';function Channel(){this[_0x7bc8('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x7bc8('0x1')]=0x0;this[_0x7bc8('0x2')]='';this[_0x7bc8('0x3')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x7bc8('0x4')]='';this[_0x7bc8('0x5')]=0x0;this[_0x7bc8('0x6')]=0x0;this[_0x7bc8('0x7')]=0x0;this[_0x7bc8('0x8')]=![];this[_0x7bc8('0x9')]=null;this[_0x7bc8('0xa')]=null;this[_0x7bc8('0xb')]=![];this[_0x7bc8('0xc')]=![];this[_0x7bc8('0xd')]='';this[_0x7bc8('0xe')]='';this[_0x7bc8('0xf')]=0x0;this[_0x7bc8('0x10')]=0x0;this[_0x7bc8('0x11')]=0x0;this[_0x7bc8('0x12')]=null;this[_0x7bc8('0x13')]=null;this[_0x7bc8('0x14')]=null;this['monitor']=![];this[_0x7bc8('0x15')]=null;this['queue']=null;this[_0x7bc8('0x16')]=[];this[_0x7bc8('0x17')]=undefined;this[_0x7bc8('0x18')]=undefined;this[_0x7bc8('0x19')]=0x0;}module[_0x7bc8('0x1a')]=Channel; \ No newline at end of file +var _0xc87b=['endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc87b,0xb2));var _0xbc87=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xc87b[_0x5783f4];return _0x28e380;};'use strict';function Channel(){this[_0xbc87('0x0')]=null;this[_0xbc87('0x1')]='';this[_0xbc87('0x2')]='';this[_0xbc87('0x3')]=0x0;this['calleridname']='';this[_0xbc87('0x4')]=undefined;this[_0xbc87('0x5')]=undefined;this[_0xbc87('0x6')]=0x0;this['context']='';this[_0xbc87('0x7')]=0x0;this[_0xbc87('0x8')]=0x0;this[_0xbc87('0x9')]=0x0;this[_0xbc87('0xa')]=![];this['answertime']=null;this[_0xbc87('0xb')]=null;this[_0xbc87('0xc')]=![];this[_0xbc87('0xd')]=![];this[_0xbc87('0xe')]='';this[_0xbc87('0xf')]='';this[_0xbc87('0x10')]=0x0;this[_0xbc87('0x11')]=0x0;this[_0xbc87('0x12')]=0x0;this[_0xbc87('0x13')]=null;this[_0xbc87('0x14')]=null;this[_0xbc87('0x15')]=null;this['monitor']=![];this[_0xbc87('0x16')]=null;this['queue']=null;this[_0xbc87('0x17')]=[];this[_0xbc87('0x18')]=undefined;this[_0xbc87('0x19')]=undefined;this['mohtime']=0x0;}module[_0xbc87('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 53b1c27..a793d18 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 _0x3de0=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x35e3d2,_0x63ffbc){var _0x29daa0=function(_0x31d775){while(--_0x31d775){_0x35e3d2['push'](_0x35e3d2['shift']());}};_0x29daa0(++_0x63ffbc);}(_0x3de0,0x143));var _0x03de=function(_0x1a0968,_0x1a41f7){_0x1a0968=_0x1a0968-0x0;var _0x39abdf=_0x3de0[_0x1a0968];return _0x39abdf;};'use strict';function DeskAccount(_0x27c5fa){this['id']=_0x27c5fa['id']||0x0;this['name']=_0x27c5fa[_0x03de('0x0')]||'';this[_0x03de('0x1')]=_0x27c5fa['username']||'';this[_0x03de('0x2')]=_0x27c5fa[_0x03de('0x2')]||'';this['authType']=_0x27c5fa[_0x03de('0x3')]||'';this[_0x03de('0x4')]=_0x27c5fa['password']||'';this['consumerKey']=_0x27c5fa[_0x03de('0x5')]||'';this[_0x03de('0x6')]=_0x27c5fa[_0x03de('0x6')]||'';this[_0x03de('0x7')]=_0x27c5fa[_0x03de('0x7')]||'';this[_0x03de('0x8')]=_0x27c5fa[_0x03de('0x8')]||'';this[_0x03de('0x9')]=_0x27c5fa['type']||'';this[_0x03de('0xa')]=_0x27c5fa['serverUrl']||'';this['Configurations']=_0x27c5fa[_0x03de('0xb')]||{};}module[_0x03de('0xc')]=DeskAccount; \ No newline at end of file +var _0xcb99=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey'];(function(_0x2fd0b2,_0x48a7ee){var _0x38d016=function(_0x32ab2c){while(--_0x32ab2c){_0x2fd0b2['push'](_0x2fd0b2['shift']());}};_0x38d016(++_0x48a7ee);}(_0xcb99,0x8b));var _0x9cb9=function(_0x48a836,_0xa1d010){_0x48a836=_0x48a836-0x0;var _0x249dc8=_0xcb99[_0x48a836];return _0x249dc8;};'use strict';function DeskAccount(_0x4ef05b){this['id']=_0x4ef05b['id']||0x0;this['name']=_0x4ef05b[_0x9cb9('0x0')]||'';this['username']=_0x4ef05b['username']||'';this[_0x9cb9('0x1')]=_0x4ef05b[_0x9cb9('0x1')]||'';this[_0x9cb9('0x2')]=_0x4ef05b['authType']||'';this[_0x9cb9('0x3')]=_0x4ef05b[_0x9cb9('0x3')]||'';this['consumerKey']=_0x4ef05b[_0x9cb9('0x4')]||'';this['consumerSecret']=_0x4ef05b[_0x9cb9('0x5')]||'';this[_0x9cb9('0x6')]=_0x4ef05b[_0x9cb9('0x6')]||'';this[_0x9cb9('0x7')]=_0x4ef05b[_0x9cb9('0x7')]||'';this[_0x9cb9('0x8')]=_0x4ef05b[_0x9cb9('0x8')]||'';this[_0x9cb9('0x9')]=_0x4ef05b['serverUrl']||'';this['Configurations']=_0x4ef05b[_0x9cb9('0xa')]||{};}module[_0x9cb9('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 28c6877..8ab7e73 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 _0x4c2c=['remoteUri','tenantId','clientId','serverUrl','Configurations','exports','name','username','password'];(function(_0x25916d,_0x445355){var _0xf278f4=function(_0x5224f5){while(--_0x5224f5){_0x25916d['push'](_0x25916d['shift']());}};_0xf278f4(++_0x445355);}(_0x4c2c,0x177));var _0xc4c2=function(_0x490c45,_0x97b829){_0x490c45=_0x490c45-0x0;var _0x82738e=_0x4c2c[_0x490c45];return _0x82738e;};'use strict';function Dynamics365Account(_0x562781){this['id']=_0x562781['id']||0x0;this[_0xc4c2('0x0')]=_0x562781[_0xc4c2('0x0')]||'';this[_0xc4c2('0x1')]=_0x562781[_0xc4c2('0x1')]||'';this[_0xc4c2('0x2')]=_0x562781[_0xc4c2('0x2')]||'';this[_0xc4c2('0x3')]=_0x562781[_0xc4c2('0x3')]||'';this[_0xc4c2('0x4')]=_0x562781['tenantId']||'';this[_0xc4c2('0x5')]=_0x562781[_0xc4c2('0x5')]||'';this['clientSecret']=_0x562781['clientSecret']||{};this[_0xc4c2('0x6')]=_0x562781['serverUrl']||'';this['Configurations']=_0x562781[_0xc4c2('0x7')]||{};}module[_0xc4c2('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x43cd=['serverUrl','Configurations','exports','name','username','password','tenantId','clientSecret'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x43cd,0x1b3));var _0xd43c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x43cd[_0x5b644e];return _0x49c6bf;};'use strict';function Dynamics365Account(_0x5ec564){this['id']=_0x5ec564['id']||0x0;this[_0xd43c('0x0')]=_0x5ec564[_0xd43c('0x0')]||'';this['username']=_0x5ec564[_0xd43c('0x1')]||'';this[_0xd43c('0x2')]=_0x5ec564[_0xd43c('0x2')]||'';this['remoteUri']=_0x5ec564['remoteUri']||'';this[_0xd43c('0x3')]=_0x5ec564[_0xd43c('0x3')]||'';this['clientId']=_0x5ec564['clientId']||'';this[_0xd43c('0x4')]=_0x5ec564[_0xd43c('0x4')]||{};this[_0xd43c('0x5')]=_0x5ec564[_0xd43c('0x5')]||'';this[_0xd43c('0x6')]=_0x5ec564[_0xd43c('0x6')]||{};}module[_0xd43c('0x7')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index cd8e874..41cb603 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 _0x5e89=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','exports','description','ecm','headerinfo','minrate','maxrate','modem','v17,v27,v29'];(function(_0x38cb51,_0xeb1028){var _0x30ce20=function(_0x406c08){while(--_0x406c08){_0x38cb51['push'](_0x38cb51['shift']());}};_0x30ce20(++_0xeb1028);}(_0x5e89,0x19d));var _0x95e8=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5e89[_0x5ddb1c];return _0x354adc;};'use strict';function FaxAccount(_0x42dff2){this['id']=_0x42dff2['id']||0x0;this['name']=_0x42dff2['name']||'';this['description']=_0x42dff2[_0x95e8('0x0')];this[_0x95e8('0x1')]=_0x42dff2[_0x95e8('0x1')];this[_0x95e8('0x2')]=_0x42dff2[_0x95e8('0x2')];this['localstationid']=_0x42dff2['localstationid'];this[_0x95e8('0x3')]=_0x42dff2[_0x95e8('0x3')]||0x960;this[_0x95e8('0x4')]=_0x42dff2[_0x95e8('0x4')]||0x3840;this['modem']=_0x42dff2[_0x95e8('0x5')]||_0x95e8('0x6');this['gateway']=_0x42dff2[_0x95e8('0x7')]||'no';this[_0x95e8('0x8')]=_0x42dff2[_0x95e8('0x8')]||'no';this[_0x95e8('0x9')]=_0x42dff2['t38timeout']||0x1388;this[_0x95e8('0xa')]=_0x42dff2[_0x95e8('0xa')]||_0x95e8('0xb');this[_0x95e8('0xc')]=_0x42dff2[_0x95e8('0xc')]?_0x42dff2[_0x95e8('0xc')]:undefined;this['ListId']=_0x42dff2['ListId'];this['key']=_0x42dff2['key'];}module[_0x95e8('0xd')]=FaxAccount; \ No newline at end of file +var _0x1a22=['tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x364c1e,_0x39df18){var _0x522dd6=function(_0x767b70){while(--_0x767b70){_0x364c1e['push'](_0x364c1e['shift']());}};_0x522dd6(++_0x39df18);}(_0x1a22,0x125));var _0x21a2=function(_0x19cd2a,_0x52bf9e){_0x19cd2a=_0x19cd2a-0x0;var _0x41f8b7=_0x1a22[_0x19cd2a];return _0x41f8b7;};'use strict';function FaxAccount(_0x3af80d){this['id']=_0x3af80d['id']||0x0;this[_0x21a2('0x0')]=_0x3af80d['name']||'';this[_0x21a2('0x1')]=_0x3af80d[_0x21a2('0x1')];this[_0x21a2('0x2')]=_0x3af80d[_0x21a2('0x2')];this[_0x21a2('0x3')]=_0x3af80d['headerinfo'];this['localstationid']=_0x3af80d[_0x21a2('0x4')];this[_0x21a2('0x5')]=_0x3af80d[_0x21a2('0x5')]||0x960;this[_0x21a2('0x6')]=_0x3af80d[_0x21a2('0x6')]||0x3840;this['modem']=_0x3af80d[_0x21a2('0x7')]||'v17,v27,v29';this[_0x21a2('0x8')]=_0x3af80d[_0x21a2('0x8')]||'no';this[_0x21a2('0x9')]=_0x3af80d[_0x21a2('0x9')]||'no';this['t38timeout']=_0x3af80d[_0x21a2('0xa')]||0x1388;this[_0x21a2('0xb')]=_0x3af80d['tech']||'SIP';this[_0x21a2('0xc')]=_0x3af80d[_0x21a2('0xc')]?_0x3af80d[_0x21a2('0xc')]:undefined;this[_0x21a2('0xd')]=_0x3af80d[_0x21a2('0xd')];this['key']=_0x3af80d[_0x21a2('0xe')];}module[_0x21a2('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index f1ba0b2..7832c37 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 _0x97ad=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x45fc6c,_0x576a86){var _0x456120=function(_0xc5cf21){while(--_0xc5cf21){_0x45fc6c['push'](_0x45fc6c['shift']());}};_0x456120(++_0x576a86);}(_0x97ad,0x157));var _0xd97a=function(_0xe88494,_0x13750e){_0xe88494=_0xe88494-0x0;var _0x3f2954=_0x97ad[_0xe88494];return _0x3f2954;};'use strict';function FreshdeskAccount(_0x1def01){this['id']=_0x1def01['id']||0x0;this[_0xd97a('0x0')]=_0x1def01['name']||'';this[_0xd97a('0x1')]=_0x1def01[_0xd97a('0x1')]||'';this[_0xd97a('0x2')]=_0x1def01[_0xd97a('0x3')]||'';this[_0xd97a('0x4')]=_0x1def01[_0xd97a('0x4')]||'';this['serverUrl']=_0x1def01[_0xd97a('0x5')]||'';this[_0xd97a('0x6')]=_0x1def01[_0xd97a('0x6')]||{};}module[_0xd97a('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xa8d6=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa8d6,0x17e));var _0x6a8d=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xa8d6[_0x2dea24];return _0x309d58;};'use strict';function FreshdeskAccount(_0x14b913){this['id']=_0x14b913['id']||0x0;this[_0x6a8d('0x0')]=_0x14b913['name']||'';this[_0x6a8d('0x1')]=_0x14b913[_0x6a8d('0x1')]||'';this[_0x6a8d('0x2')]=_0x14b913[_0x6a8d('0x3')]||'';this[_0x6a8d('0x4')]=_0x14b913[_0x6a8d('0x4')]||'';this[_0x6a8d('0x5')]=_0x14b913[_0x6a8d('0x5')]||'';this[_0x6a8d('0x6')]=_0x14b913['Configurations']||{};}module[_0x6a8d('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 9b2f8f5..6b055bc 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 _0x25e9=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x193928,_0x59fcb4){var _0x182cd4=function(_0x422fbb){while(--_0x422fbb){_0x193928['push'](_0x193928['shift']());}};_0x182cd4(++_0x59fcb4);}(_0x25e9,0x179));var _0x925e=function(_0x1e440c,_0x3b2ca5){_0x1e440c=_0x1e440c-0x0;var _0x3cfab5=_0x25e9[_0x1e440c];return _0x3cfab5;};'use strict';function FreshsalesAccount(_0x30e2c0){this['id']=_0x30e2c0['id']||0x0;this[_0x925e('0x0')]=_0x30e2c0[_0x925e('0x0')]||'';this['username']=_0x30e2c0[_0x925e('0x1')]||'';this[_0x925e('0x2')]=_0x30e2c0[_0x925e('0x3')]||'';this[_0x925e('0x4')]=_0x30e2c0[_0x925e('0x4')]||'';this[_0x925e('0x5')]=_0x30e2c0[_0x925e('0x5')]||'';this['Configurations']=_0x30e2c0[_0x925e('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xea41=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x30fc33,_0x3f9520){var _0xe1e4ff=function(_0x2b613a){while(--_0x2b613a){_0x30fc33['push'](_0x30fc33['shift']());}};_0xe1e4ff(++_0x3f9520);}(_0xea41,0xf9));var _0x1ea4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xea41[_0x2b7764];return _0x848dcb;};'use strict';function FreshsalesAccount(_0x292a06){this['id']=_0x292a06['id']||0x0;this[_0x1ea4('0x0')]=_0x292a06[_0x1ea4('0x0')]||'';this[_0x1ea4('0x1')]=_0x292a06[_0x1ea4('0x1')]||'';this['apiKey']=_0x292a06['token']||'';this[_0x1ea4('0x2')]=_0x292a06[_0x1ea4('0x2')]||'';this['serverUrl']=_0x292a06[_0x1ea4('0x3')]||'';this[_0x1ea4('0x4')]=_0x292a06[_0x1ea4('0x4')]||{};}module[_0x1ea4('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c0821d2..9fea49c 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 _0x51ef=['queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','type','inbound','uniqueid','queue','queuecallerjoinAt'];(function(_0x11f688,_0x40fc33){var _0x5b8558=function(_0x992d74){while(--_0x992d74){_0x11f688['push'](_0x11f688['shift']());}};_0x5b8558(++_0x40fc33);}(_0x51ef,0x1db));var _0xf51e=function(_0x22ceed,_0x1998f0){_0x22ceed=_0x22ceed-0x0;var _0x2bc59f=_0x51ef[_0x22ceed];return _0x2bc59f;};'use strict';function QueueReport(){this[_0xf51e('0x0')]=_0xf51e('0x1');this[_0xf51e('0x2')]='';this['calleridnum']='';this['calleridname']='';this[_0xf51e('0x3')]='';this[_0xf51e('0x4')]=null;this[_0xf51e('0x5')]=null;this[_0xf51e('0x6')]=0x1;this[_0xf51e('0x7')]=0x1;this[_0xf51e('0x8')]=![];this[_0xf51e('0x9')]=null;this[_0xf51e('0xa')]=![];this[_0xf51e('0xb')]=null;this[_0xf51e('0xc')]=![];this[_0xf51e('0xd')]=null;this[_0xf51e('0xe')]=0x1;this[_0xf51e('0xf')]='';this['connectedlinenum']='';this[_0xf51e('0x10')]='';this['accountcode']='';this[_0xf51e('0x11')]='';this[_0xf51e('0x12')]='';this[_0xf51e('0x13')]='';this[_0xf51e('0x14')]=0x0;this[_0xf51e('0x15')]=![];this[_0xf51e('0x16')]='';this[_0xf51e('0x17')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0x2b63=['connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','mohtime','exports','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum'];(function(_0xfd63fa,_0x1f115a){var _0x3cc89a=function(_0x3b5d7f){while(--_0x3b5d7f){_0xfd63fa['push'](_0xfd63fa['shift']());}};_0x3cc89a(++_0x1f115a);}(_0x2b63,0x1d5));var _0x32b6=function(_0x350117,_0x56cd55){_0x350117=_0x350117-0x0;var _0x5982d8=_0x2b63[_0x350117];return _0x5982d8;};'use strict';function QueueReport(){this['type']='inbound';this[_0x32b6('0x0')]='';this[_0x32b6('0x1')]='';this[_0x32b6('0x2')]='';this[_0x32b6('0x3')]='';this[_0x32b6('0x4')]=null;this[_0x32b6('0x5')]=null;this['position']=0x1;this[_0x32b6('0x6')]=0x1;this[_0x32b6('0x7')]=![];this[_0x32b6('0x8')]=null;this[_0x32b6('0x9')]=![];this[_0x32b6('0xa')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x32b6('0xb')]=0x1;this[_0x32b6('0xc')]='';this[_0x32b6('0xd')]='';this[_0x32b6('0xe')]='';this[_0x32b6('0xf')]='';this[_0x32b6('0x10')]='';this[_0x32b6('0x11')]='';this[_0x32b6('0x12')]='';this[_0x32b6('0x13')]=0x0;this['assigned']=![];this[_0x32b6('0x14')]='';this[_0x32b6('0x15')]=0x0;this['variables']={};}module[_0x32b6('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 68a068e..f6957a9 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 _0x0a48=['clientSecret','securityToken','type','integrationTab','serverUrl','exports','name','username','remoteUri','password','clientId'];(function(_0x406f41,_0x5108cc){var _0x13fc13=function(_0x1a4301){while(--_0x1a4301){_0x406f41['push'](_0x406f41['shift']());}};_0x13fc13(++_0x5108cc);}(_0x0a48,0x95));var _0x80a4=function(_0x38b360,_0x4fd106){_0x38b360=_0x38b360-0x0;var _0x29932f=_0x0a48[_0x38b360];return _0x29932f;};'use strict';function SalesforceAccount(_0x3af003){this['id']=_0x3af003['id']||0x0;this[_0x80a4('0x0')]=_0x3af003['name']||'';this[_0x80a4('0x1')]=_0x3af003[_0x80a4('0x1')]||'';this[_0x80a4('0x2')]=_0x3af003[_0x80a4('0x2')]||'';this[_0x80a4('0x3')]=_0x3af003['password']||'';this['clientId']=_0x3af003[_0x80a4('0x4')]||'';this[_0x80a4('0x5')]=_0x3af003[_0x80a4('0x5')]||'';this[_0x80a4('0x6')]=_0x3af003['securityToken']||'';this[_0x80a4('0x7')]=_0x3af003['type']||_0x80a4('0x8');this[_0x80a4('0x9')]=_0x3af003[_0x80a4('0x9')]||'';this['Configurations']=_0x3af003['Configurations']||{};}module[_0x80a4('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x4503=['type','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x1bb47b,_0x54e02e){var _0x566418=function(_0x4ceb66){while(--_0x4ceb66){_0x1bb47b['push'](_0x1bb47b['shift']());}};_0x566418(++_0x54e02e);}(_0x4503,0x111));var _0x3450=function(_0x336e4d,_0x121110){_0x336e4d=_0x336e4d-0x0;var _0x89d9b8=_0x4503[_0x336e4d];return _0x89d9b8;};'use strict';function SalesforceAccount(_0xe25f2e){this['id']=_0xe25f2e['id']||0x0;this[_0x3450('0x0')]=_0xe25f2e[_0x3450('0x0')]||'';this[_0x3450('0x1')]=_0xe25f2e['username']||'';this[_0x3450('0x2')]=_0xe25f2e[_0x3450('0x2')]||'';this[_0x3450('0x3')]=_0xe25f2e['password']||'';this[_0x3450('0x4')]=_0xe25f2e[_0x3450('0x4')]||'';this[_0x3450('0x5')]=_0xe25f2e['clientSecret']||'';this[_0x3450('0x6')]=_0xe25f2e[_0x3450('0x6')]||'';this[_0x3450('0x7')]=_0xe25f2e[_0x3450('0x7')]||'integrationTab';this[_0x3450('0x8')]=_0xe25f2e['serverUrl']||'';this[_0x3450('0x9')]=_0xe25f2e[_0x3450('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index e36b0f2..d1cdd43 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 _0xfa9e=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0xfa9e,0xad));var _0xefa9=function(_0x1dda59,_0xb18d21){_0x1dda59=_0x1dda59-0x0;var _0x56a58f=_0xfa9e[_0x1dda59];return _0x56a58f;};'use strict';function ServicenowAccount(_0x3bd1b6){this['id']=_0x3bd1b6['id']||0x0;this['name']=_0x3bd1b6[_0xefa9('0x0')]||'';this['username']=_0x3bd1b6[_0xefa9('0x1')]||'';this['password']=_0x3bd1b6['password']||'';this[_0xefa9('0x2')]=_0x3bd1b6[_0xefa9('0x2')]||'';this[_0xefa9('0x3')]=_0x3bd1b6[_0xefa9('0x3')]||'';this[_0xefa9('0x4')]=_0x3bd1b6[_0xefa9('0x4')]||{};}module[_0xefa9('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x7d72=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x364d8f,_0x9e262c){var _0x488b8a=function(_0x485395){while(--_0x485395){_0x364d8f['push'](_0x364d8f['shift']());}};_0x488b8a(++_0x9e262c);}(_0x7d72,0xe7));var _0x27d7=function(_0x4a0900,_0x5cb62f){_0x4a0900=_0x4a0900-0x0;var _0x3b4aa6=_0x7d72[_0x4a0900];return _0x3b4aa6;};'use strict';function ServicenowAccount(_0x17d821){this['id']=_0x17d821['id']||0x0;this[_0x27d7('0x0')]=_0x17d821[_0x27d7('0x0')]||'';this['username']=_0x17d821[_0x27d7('0x1')]||'';this[_0x27d7('0x2')]=_0x17d821['password']||'';this[_0x27d7('0x3')]=_0x17d821['remoteUri']||'';this['serverUrl']=_0x17d821[_0x27d7('0x4')]||'';this['Configurations']=_0x17d821[_0x27d7('0x5')]||{};}module[_0x27d7('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index fb37737..e4b1a13 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 _0x3551=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x3d59e0,_0x170079){var _0x43baf4=function(_0xae481f){while(--_0xae481f){_0x3d59e0['push'](_0x3d59e0['shift']());}};_0x43baf4(++_0x170079);}(_0x3551,0x1c4));var _0x1355=function(_0x4bf591,_0x48b450){_0x4bf591=_0x4bf591-0x0;var _0x18f0df=_0x3551[_0x4bf591];return _0x18f0df;};'use strict';function SugarcrmAccount(_0x16a977){this['id']=_0x16a977['id']||0x0;this[_0x1355('0x0')]=_0x16a977[_0x1355('0x0')]||'';this[_0x1355('0x1')]=_0x16a977['username']||'';this['password']=_0x16a977[_0x1355('0x2')]||'';this[_0x1355('0x3')]=_0x16a977[_0x1355('0x3')]||'';this[_0x1355('0x4')]=_0x16a977[_0x1355('0x4')]||'';this[_0x1355('0x5')]=_0x16a977[_0x1355('0x5')]||{};}module[_0x1355('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x8f47=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x5d914b,_0x2d096d){var _0x156cf7=function(_0x5011f7){while(--_0x5011f7){_0x5d914b['push'](_0x5d914b['shift']());}};_0x156cf7(++_0x2d096d);}(_0x8f47,0x111));var _0x78f4=function(_0x1cffe2,_0x5383e8){_0x1cffe2=_0x1cffe2-0x0;var _0x57030e=_0x8f47[_0x1cffe2];return _0x57030e;};'use strict';function SugarcrmAccount(_0x33af11){this['id']=_0x33af11['id']||0x0;this[_0x78f4('0x0')]=_0x33af11['name']||'';this['username']=_0x33af11[_0x78f4('0x1')]||'';this['password']=_0x33af11['password']||'';this[_0x78f4('0x2')]=_0x33af11[_0x78f4('0x2')]||'';this[_0x78f4('0x3')]=_0x33af11['serverUrl']||'';this[_0x78f4('0x4')]=_0x33af11['Configurations']||{};}module[_0x78f4('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 5c6569e..b1ccb84 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 _0x3efb=['status','unknown','address','name','accountcode','stateTime'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x3efb,0x8d));var _0xb3ef=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0x3efb[_0x121886];return _0x20ca01;};'use strict';function Telephone(_0x406dc4){this['id']=_0x406dc4['id']||0x0;this[_0xb3ef('0x0')]=_0x406dc4[_0xb3ef('0x0')]||'';this[_0xb3ef('0x1')]=_0x406dc4['accountcode']||'';this['state']='unknown';this[_0xb3ef('0x2')]=0x0;this[_0xb3ef('0x3')]=_0xb3ef('0x4');this[_0xb3ef('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xb234=['state','unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xb234,0x13e));var _0x4b23=function(_0xc4bb8c,_0x118660){_0xc4bb8c=_0xc4bb8c-0x0;var _0x5ea887=_0xb234[_0xc4bb8c];return _0x5ea887;};'use strict';function Telephone(_0x17a514){this['id']=_0x17a514['id']||0x0;this[_0x4b23('0x0')]=_0x17a514[_0x4b23('0x0')]||'';this[_0x4b23('0x1')]=_0x17a514[_0x4b23('0x1')]||'';this[_0x4b23('0x2')]=_0x4b23('0x3');this[_0x4b23('0x4')]=0x0;this[_0x4b23('0x5')]=_0x4b23('0x3');this[_0x4b23('0x6')]='';}module[_0x4b23('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 3ff50db..4200785 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 _0x5bf5=['html','name'];(function(_0xca268,_0x1cc126){var _0x1e5699=function(_0x34a47f){while(--_0x34a47f){_0xca268['push'](_0xca268['shift']());}};_0x1e5699(++_0x1cc126);}(_0x5bf5,0xf1));var _0x55bf=function(_0xdfa2c4,_0xf2d691){_0xdfa2c4=_0xdfa2c4-0x0;var _0x2857f7=_0x5bf5[_0xdfa2c4];return _0x2857f7;};'use strict';function template(_0xa91c1c){this['id']=_0xa91c1c['id']||0x0;this[_0x55bf('0x0')]=_0xa91c1c[_0x55bf('0x0')]||'';this[_0x55bf('0x1')]=_0xa91c1c[_0x55bf('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xe2ca=['html','name'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xe2ca,0xbd));var _0xae2c=function(_0x9abe08,_0x9ec703){_0x9abe08=_0x9abe08-0x0;var _0x18cea2=_0xe2ca[_0x9abe08];return _0x18cea2;};'use strict';function template(_0x13654c){this['id']=_0x13654c['id']||0x0;this[_0xae2c('0x0')]=_0x13654c[_0xae2c('0x0')]||'';this['html']=_0x13654c[_0xae2c('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 28fb806..b150192 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 _0x8ef6=['status','AllConditions','AnyConditions','exports','name','channel','voice'];(function(_0x137f28,_0x4f2498){var _0x36785e=function(_0x3ebf5f){while(--_0x3ebf5f){_0x137f28['push'](_0x137f28['shift']());}};_0x36785e(++_0x4f2498);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2001b0,_0x5f046f){_0x2001b0=_0x2001b0-0x0;var _0x1ee3c5=_0x8ef6[_0x2001b0];return _0x1ee3c5;};'use strict';function Trigger(_0x58ecc7){this['id']=_0x58ecc7['id']||0x0;this[_0x68ef('0x0')]=_0x58ecc7[_0x68ef('0x0')]||'';this[_0x68ef('0x1')]=_0x58ecc7[_0x68ef('0x1')]||_0x68ef('0x2');this[_0x68ef('0x3')]=_0x58ecc7['status']||![];this[_0x68ef('0x4')]=_0x58ecc7[_0x68ef('0x4')]||[];this[_0x68ef('0x5')]=_0x58ecc7[_0x68ef('0x5')]||[];this['Actions']=_0x58ecc7['Actions']||[];}module[_0x68ef('0x6')]=Trigger; \ No newline at end of file +var _0x54ef=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x39684e,_0x570c7f){var _0x7e28b9=function(_0x580333){while(--_0x580333){_0x39684e['push'](_0x39684e['shift']());}};_0x7e28b9(++_0x570c7f);}(_0x54ef,0x112));var _0xf54e=function(_0x32d2b7,_0x26fd25){_0x32d2b7=_0x32d2b7-0x0;var _0x4f8ef0=_0x54ef[_0x32d2b7];return _0x4f8ef0;};'use strict';function Trigger(_0x19d4d5){this['id']=_0x19d4d5['id']||0x0;this[_0xf54e('0x0')]=_0x19d4d5[_0xf54e('0x0')]||'';this['channel']=_0x19d4d5[_0xf54e('0x1')]||_0xf54e('0x2');this[_0xf54e('0x3')]=_0x19d4d5[_0xf54e('0x3')]||![];this[_0xf54e('0x4')]=_0x19d4d5[_0xf54e('0x4')]||[];this[_0xf54e('0x5')]=_0x19d4d5['AnyConditions']||[];this['Actions']=_0x19d4d5[_0xf54e('0x6')]||[];}module[_0xf54e('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 08eb405..6d55e96 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 _0xf6a9=['stateTime','status','unknown','registry','split','host','port','domain','stateRegistry','address','active','name','state'];(function(_0x110fe0,_0x50c9f5){var _0x4582d0=function(_0x357ebb){while(--_0x357ebb){_0x110fe0['push'](_0x110fe0['shift']());}};_0x4582d0(++_0x50c9f5);}(_0xf6a9,0x176));var _0x9f6a=function(_0x55c4f6,_0x46a508){_0x55c4f6=_0x55c4f6-0x0;var _0x454afc=_0xf6a9[_0x55c4f6];return _0x454afc;};'use strict';function Trunk(_0x73a217){this['id']=_0x73a217['id']||0x0;this['active']=_0x73a217[_0x9f6a('0x0')]||![];this['name']=_0x73a217[_0x9f6a('0x1')]||'';this[_0x9f6a('0x2')]='unknown';this[_0x9f6a('0x3')]=0x0;this[_0x9f6a('0x4')]=_0x9f6a('0x5');this[_0x9f6a('0x6')]=_0x73a217[_0x9f6a('0x6')]&&_0x73a217[_0x9f6a('0x6')]['indexOf'](':')?_0x73a217[_0x9f6a('0x6')][_0x9f6a('0x7')](':')[0x0]:'';this[_0x9f6a('0x8')]='';this[_0x9f6a('0x9')]='';this[_0x9f6a('0xa')]='';this['domainport']='';this['refresh']='';this[_0x9f6a('0xb')]=_0x9f6a('0x5');this['registrationtime']='';this[_0x9f6a('0xc')]='';}module['exports']=Trunk; \ No newline at end of file +var _0x8162=['indexOf','split','host','port','domain','domainport','refresh','stateRegistry','exports','active','name','unknown','stateTime','status','registry'];(function(_0xb2e44e,_0x23da21){var _0x2b6ac1=function(_0x4d24c7){while(--_0x4d24c7){_0xb2e44e['push'](_0xb2e44e['shift']());}};_0x2b6ac1(++_0x23da21);}(_0x8162,0x117));var _0x2816=function(_0x38b255,_0x3fd343){_0x38b255=_0x38b255-0x0;var _0x26f9bb=_0x8162[_0x38b255];return _0x26f9bb;};'use strict';function Trunk(_0x18b0b8){this['id']=_0x18b0b8['id']||0x0;this[_0x2816('0x0')]=_0x18b0b8[_0x2816('0x0')]||![];this[_0x2816('0x1')]=_0x18b0b8[_0x2816('0x1')]||'';this['state']=_0x2816('0x2');this[_0x2816('0x3')]=0x0;this[_0x2816('0x4')]='unknown';this[_0x2816('0x5')]=_0x18b0b8[_0x2816('0x5')]&&_0x18b0b8['registry'][_0x2816('0x6')](':')?_0x18b0b8[_0x2816('0x5')][_0x2816('0x7')](':')[0x0]:'';this[_0x2816('0x8')]='';this[_0x2816('0x9')]='';this[_0x2816('0xa')]='';this[_0x2816('0xb')]='';this[_0x2816('0xc')]='';this[_0x2816('0xd')]=_0x2816('0x2');this['registrationtime']='';this['address']='';}module[_0x2816('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index e84a90b..a81f293 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 _0x2e10=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x3ca0ef,_0x13da45){var _0x1b1127=function(_0x66101b){while(--_0x66101b){_0x3ca0ef['push'](_0x3ca0ef['shift']());}};_0x1b1127(++_0x13da45);}(_0x2e10,0xc3));var _0x02e1=function(_0x244fb2,_0x34e517){_0x244fb2=_0x244fb2-0x0;var _0x477b05=_0x2e10[_0x244fb2];return _0x477b05;};'use strict';function voiceExtension(_0x3e9229){this['id']=_0x3e9229['id']||0x0;this[_0x02e1('0x0')]=_0x3e9229[_0x02e1('0x0')]||'';this[_0x02e1('0x1')]=_0x3e9229[_0x02e1('0x1')]||_0x02e1('0x2');this[_0x02e1('0x3')]=_0x3e9229['mandatoryDisposition']||![];}module[_0x02e1('0x4')]=voiceExtension; \ No newline at end of file +var _0xae3e=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x10b7de,_0x51cf9d){var _0xd51c81=function(_0x34d442){while(--_0x34d442){_0x10b7de['push'](_0x10b7de['shift']());}};_0xd51c81(++_0x51cf9d);}(_0xae3e,0xee));var _0xeae3=function(_0x4729ae,_0x35a7c4){_0x4729ae=_0x4729ae-0x0;var _0x464880=_0xae3e[_0x4729ae];return _0x464880;};'use strict';function voiceExtension(_0x245b04){this['id']=_0x245b04['id']||0x0;this[_0xeae3('0x0')]=_0x245b04[_0xeae3('0x0')]||'';this[_0xeae3('0x1')]=_0x245b04[_0xeae3('0x1')]||_0xeae3('0x2');this[_0xeae3('0x3')]=_0x245b04[_0xeae3('0x3')]||![];}module[_0xeae3('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 f826ca3..5b4caa3 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 _0xdcac=['dialDropRetryFrequency','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','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x1b3785,_0x145888){var _0x16340e=function(_0x5f29fc){while(--_0x5f29fc){_0x1b3785['push'](_0x1b3785['shift']());}};_0x16340e(++_0x145888);}(_0xdcac,0xbb));var _0xcdca=function(_0xa2e990,_0x27310c){_0xa2e990=_0xa2e990-0x0;var _0x4f1db6=_0xdcac[_0xa2e990];return _0x4f1db6;};'use strict';var statusDesc=[_0xcdca('0x0'),'not_inuse',_0xcdca('0x1'),_0xcdca('0x2'),_0xcdca('0x3'),_0xcdca('0x4'),_0xcdca('0x5'),_0xcdca('0x6'),_0xcdca('0x7')];var monitorFormat={'wav':_0xcdca('0x8'),'wav49':_0xcdca('0x9'),'gsm':'gsm'};var strategy={'rrmemory':_0xcdca('0xa'),'roundrobin':_0xcdca('0xb')};function VoiceQueue(_0x4a63b7){this['id']=_0x4a63b7['id']||0x0;this[_0xcdca('0xc')]=_0x4a63b7['name']||'';this[_0xcdca('0xd')]=_0x4a63b7[_0xcdca('0xd')]||'';this['type']=_0x4a63b7[_0xcdca('0xe')]||_0xcdca('0xf');this[_0xcdca('0x10')]=0x0;this[_0xcdca('0x11')]=0x0;this[_0xcdca('0x12')]=0x0;this['answered']=0x0;this[_0xcdca('0x13')]=0x0;this[_0xcdca('0x14')]=0x0;this['sumBillable']=0x0;this[_0xcdca('0x15')]=0x0;this[_0xcdca('0x16')]=0x0;this[_0xcdca('0x17')]=0x0;this[_0xcdca('0x18')]=0x0;this[_0xcdca('0x19')]=_0x4a63b7[_0xcdca('0x19')]||![];this[_0xcdca('0x1a')]=_0x4a63b7[_0xcdca('0x1a')]||0xa;this['autopause']=_0x4a63b7[_0xcdca('0x1b')]||'no';this['sendMessageOneNotActive']=!![];this[_0xcdca('0x1c')]='';this['originated']=0x0;this[_0xcdca('0x1d')]=0x0;this[_0xcdca('0x1e')]=_0x4a63b7[_0xcdca('0x1e')]||null;this['dialGlobalInterval']=_0x4a63b7[_0xcdca('0x1f')]?_0x4a63b7[_0xcdca('0x1f')]:null;this[_0xcdca('0x20')]=_0x4a63b7[_0xcdca('0x20')];this['dialMethod']=_0x4a63b7[_0xcdca('0x21')]||_0xcdca('0x22');this[_0xcdca('0x23')]=_0x4a63b7[_0xcdca('0x23')]||0x0;this[_0xcdca('0x24')]=_0x4a63b7[_0xcdca('0x24')]||0x0;this[_0xcdca('0x25')]=_0x4a63b7[_0xcdca('0x25')]||0x1;this['dialPredictiveOptimization']=_0x4a63b7[_0xcdca('0x26')]||_0xcdca('0x27');this[_0xcdca('0x28')]=_0x4a63b7[_0xcdca('0x28')]||0.03;this[_0xcdca('0x29')]=_0x4a63b7[_0xcdca('0x29')]||0x258;this[_0xcdca('0x2a')]=_0x4a63b7[_0xcdca('0x2a')]||'anonymous';this[_0xcdca('0x2b')]=_0x4a63b7[_0xcdca('0x2b')]||_0xcdca('0x2c');this[_0xcdca('0x2d')]=_0x4a63b7['dialOriginateTimeout']||0x1e;this[_0xcdca('0x2e')]=_0x4a63b7[_0xcdca('0x2e')]||_0xcdca('0x2f');this[_0xcdca('0x30')]=_0x4a63b7[_0xcdca('0x30')]||0x3;this[_0xcdca('0x31')]=_0x4a63b7[_0xcdca('0x31')]||undefined;this[_0xcdca('0x32')]=_0x4a63b7[_0xcdca('0x32')]||0x3;this[_0xcdca('0x33')]=_0x4a63b7[_0xcdca('0x33')]||0x96;this['dialBusyMaxRetry']=_0x4a63b7[_0xcdca('0x34')]||0x3;this[_0xcdca('0x35')]=_0x4a63b7[_0xcdca('0x35')]||0x96;this[_0xcdca('0x36')]=_0x4a63b7['dialNoAnswerMaxRetry']||0x3;this[_0xcdca('0x37')]=_0x4a63b7[_0xcdca('0x37')]||0x96;this[_0xcdca('0x38')]=_0x4a63b7[_0xcdca('0x38')]||0x3;this[_0xcdca('0x39')]=_0x4a63b7[_0xcdca('0x39')]||0x96;this[_0xcdca('0x3a')]=_0x4a63b7['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x4a63b7[_0xcdca('0x3b')]||0x96;this['dialAbandonedMaxRetry']=_0x4a63b7['dialAbandonedMaxRetry']||0x3;this[_0xcdca('0x3c')]=_0x4a63b7[_0xcdca('0x3c')]||0x96;this[_0xcdca('0x3d')]=_0x4a63b7['dialMachineMaxRetry']||0x3;this[_0xcdca('0x3e')]=_0x4a63b7[_0xcdca('0x3e')]||0x96;this[_0xcdca('0x3f')]=_0x4a63b7[_0xcdca('0x3f')]||0x3;this[_0xcdca('0x40')]=_0x4a63b7['dialAgentRejectRetryFrequency']||0x96;this[_0xcdca('0x41')]=_0x4a63b7['dialGlobalMaxRetry']||0x4;this[_0xcdca('0x42')]=_0x4a63b7[_0xcdca('0x42')]?_0x4a63b7[_0xcdca('0x42')]:undefined;this['TrunkBackup']=_0x4a63b7[_0xcdca('0x43')]?_0x4a63b7[_0xcdca('0x43')]:undefined;this[_0xcdca('0x44')]=_0x4a63b7['dialPrefix']||undefined;this['Interval']=_0x4a63b7[_0xcdca('0x45')]?_0x4a63b7[_0xcdca('0x45')]:undefined;this['dialOrderByScheduledAt']=_0x4a63b7[_0xcdca('0x46')]||_0xcdca('0x47');this[_0xcdca('0x48')]=_0x4a63b7[_0xcdca('0x48')]||undefined;this[_0xcdca('0x49')]=_0x4a63b7[_0xcdca('0x49')]||undefined;this[_0xcdca('0x4a')]=strategy[_0x4a63b7[_0xcdca('0x4a')]]||_0xcdca('0xa');this[_0xcdca('0x4b')]=!![];this['dialAMDActive']=_0x4a63b7[_0xcdca('0x4c')]||![];this[_0xcdca('0x4d')]=_0x4a63b7[_0xcdca('0x4d')];this[_0xcdca('0x4e')]=_0x4a63b7[_0xcdca('0x4e')];this['dialAMDAfterGreetingSilence']=_0x4a63b7[_0xcdca('0x4f')];this[_0xcdca('0x50')]=_0x4a63b7[_0xcdca('0x50')];this[_0xcdca('0x51')]=_0x4a63b7[_0xcdca('0x51')];this[_0xcdca('0x52')]=_0x4a63b7[_0xcdca('0x52')];this[_0xcdca('0x53')]=_0x4a63b7['dialAMDMaximumNumberOfWords'];this[_0xcdca('0x54')]=_0x4a63b7[_0xcdca('0x54')];this[_0xcdca('0x55')]=_0x4a63b7[_0xcdca('0x55')];this['outboundRejectCallsDay']=0x0;this[_0xcdca('0x56')]=0x0;this[_0xcdca('0x57')]=_0x4a63b7[_0xcdca('0x57')];this[_0xcdca('0x58')]=0x0;this[_0xcdca('0x59')]=0x0;this[_0xcdca('0x5a')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xcdca('0x5b')]=0x0;this[_0xcdca('0x5c')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xcdca('0x5d')]=0x0;this[_0xcdca('0x5e')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xcdca('0x5f')]=0x0;this[_0xcdca('0x60')]=0x0;this['outboundReCallsDay']=0x0;this[_0xcdca('0x61')]=0x0;this[_0xcdca('0x62')]=undefined;this[_0xcdca('0x63')]=undefined;this[_0xcdca('0x64')]=undefined;this[_0xcdca('0x65')]=1.05;this[_0xcdca('0x66')]=0x0;this[_0xcdca('0x67')]=0x0;this[_0xcdca('0x68')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xcdca('0x69')]=0x0;this[_0xcdca('0x6a')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xcdca('0x6b')]=0x0;this['predictiveIntervalMaxThreshold']=_0x4a63b7[_0xcdca('0x6c')]||0x14;this[_0xcdca('0x6d')]=_0x4a63b7[_0xcdca('0x6c')]||0xa;this[_0xcdca('0x6e')]=0x0;this[_0xcdca('0x6f')]=0x0;this[_0xcdca('0x70')]=0x1;this['erlangCalls']=0x0;this[_0xcdca('0x71')]=0x0;this[_0xcdca('0x72')]=0x0;this[_0xcdca('0x73')]=0x0;this['dialRecallMeTimeout']=_0x4a63b7['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x4a63b7[_0xcdca('0x74')]||![];this[_0xcdca('0x75')]=_0x4a63b7['dialQueueProject2']||undefined;this[_0xcdca('0x76')]=_0x4a63b7['dialAgiAfterHangupClient']||![];this[_0xcdca('0x77')]=_0x4a63b7['dialAgiAfterHangupAgent']||![];this[_0xcdca('0xd')]=monitorFormat[_0x4a63b7[_0xcdca('0xd')]]?monitorFormat[_0x4a63b7[_0xcdca('0xd')]]:undefined;this[_0xcdca('0x78')]=_0x4a63b7['mandatoryDisposition']||![];this[_0xcdca('0x79')]=_0x4a63b7[_0xcdca('0x79')]?_0x4a63b7[_0xcdca('0x79')]:undefined;}module[_0xcdca('0x7a')]=VoiceQueue; \ No newline at end of file +var _0xc756=['monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name'];(function(_0x43ae64,_0x31976d){var _0x21fcb5=function(_0x3a6c4f){while(--_0x3a6c4f){_0x43ae64['push'](_0x43ae64['shift']());}};_0x21fcb5(++_0x31976d);}(_0xc756,0x6c));var _0x6c75=function(_0x42c6c6,_0x558040){_0x42c6c6=_0x42c6c6-0x0;var _0x528bb2=_0xc756[_0x42c6c6];return _0x528bb2;};'use strict';var statusDesc=[_0x6c75('0x0'),_0x6c75('0x1'),_0x6c75('0x2'),_0x6c75('0x3'),_0x6c75('0x4'),_0x6c75('0x5'),'ringing',_0x6c75('0x6'),_0x6c75('0x7')];var monitorFormat={'wav':'wav','wav49':_0x6c75('0x8'),'gsm':_0x6c75('0x9')};var strategy={'rrmemory':_0x6c75('0xa'),'roundrobin':_0x6c75('0xb')};function VoiceQueue(_0x51726a){this['id']=_0x51726a['id']||0x0;this[_0x6c75('0xc')]=_0x51726a[_0x6c75('0xc')]||'';this[_0x6c75('0xd')]=_0x51726a[_0x6c75('0xd')]||'';this[_0x6c75('0xe')]=_0x51726a[_0x6c75('0xe')]||_0x6c75('0xf');this[_0x6c75('0x10')]=0x0;this[_0x6c75('0x11')]=0x0;this[_0x6c75('0x12')]=0x0;this[_0x6c75('0x13')]=0x0;this[_0x6c75('0x14')]=0x0;this[_0x6c75('0x15')]=0x0;this[_0x6c75('0x16')]=0x0;this['unmanaged']=0x0;this[_0x6c75('0x17')]=0x0;this[_0x6c75('0x18')]=0x0;this[_0x6c75('0x19')]=0x0;this['acw']=_0x51726a[_0x6c75('0x1a')]||![];this[_0x6c75('0x1b')]=_0x51726a[_0x6c75('0x1b')]||0xa;this[_0x6c75('0x1c')]=_0x51726a[_0x6c75('0x1c')]||'no';this[_0x6c75('0x1d')]=!![];this[_0x6c75('0x1e')]='';this['originated']=0x0;this['temp']=0x0;this['dialTimezone']=_0x51726a[_0x6c75('0x1f')]||null;this[_0x6c75('0x20')]=_0x51726a[_0x6c75('0x20')]?_0x51726a['dialGlobalInterval']:null;this[_0x6c75('0x21')]=_0x51726a['dialActive'];this[_0x6c75('0x22')]=_0x51726a[_0x6c75('0x22')]||_0x6c75('0x23');this[_0x6c75('0x24')]=_0x51726a['dialLimitChannel']||0x0;this[_0x6c75('0x25')]=_0x51726a['dialLimitQueue']||0x0;this[_0x6c75('0x26')]=_0x51726a['dialPowerLevel']||0x1;this[_0x6c75('0x27')]=_0x51726a['dialPredictiveOptimization']||_0x6c75('0x28');this['dialPredictiveOptimizationPercentage']=_0x51726a[_0x6c75('0x29')]||0.03;this[_0x6c75('0x2a')]=_0x51726a[_0x6c75('0x2a')]||0x258;this[_0x6c75('0x2b')]=_0x51726a[_0x6c75('0x2b')]||_0x6c75('0x2c');this[_0x6c75('0x2d')]=_0x51726a[_0x6c75('0x2d')]||_0x6c75('0x2c');this['dialOriginateTimeout']=_0x51726a[_0x6c75('0x2e')]||0x1e;this[_0x6c75('0x2f')]=_0x51726a[_0x6c75('0x2f')]||_0x6c75('0x30');this['dialQueueTimeout']=_0x51726a[_0x6c75('0x31')]||0x3;this['dialQueueProject']=_0x51726a[_0x6c75('0x32')]||undefined;this[_0x6c75('0x33')]=_0x51726a['dialCongestionMaxRetry']||0x3;this[_0x6c75('0x34')]=_0x51726a[_0x6c75('0x34')]||0x96;this['dialBusyMaxRetry']=_0x51726a[_0x6c75('0x35')]||0x3;this['dialBusyRetryFrequency']=_0x51726a[_0x6c75('0x36')]||0x96;this[_0x6c75('0x37')]=_0x51726a[_0x6c75('0x37')]||0x3;this[_0x6c75('0x38')]=_0x51726a['dialNoAnswerRetryFrequency']||0x96;this[_0x6c75('0x39')]=_0x51726a['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x51726a[_0x6c75('0x3a')]||0x96;this[_0x6c75('0x3b')]=_0x51726a[_0x6c75('0x3b')]||0x3;this[_0x6c75('0x3c')]=_0x51726a['dialDropRetryFrequency']||0x96;this[_0x6c75('0x3d')]=_0x51726a['dialAbandonedMaxRetry']||0x3;this[_0x6c75('0x3e')]=_0x51726a[_0x6c75('0x3e')]||0x96;this['dialMachineMaxRetry']=_0x51726a['dialMachineMaxRetry']||0x3;this[_0x6c75('0x3f')]=_0x51726a[_0x6c75('0x3f')]||0x96;this['dialAgentRejectMaxRetry']=_0x51726a[_0x6c75('0x40')]||0x3;this[_0x6c75('0x41')]=_0x51726a[_0x6c75('0x41')]||0x96;this[_0x6c75('0x42')]=_0x51726a[_0x6c75('0x42')]||0x4;this[_0x6c75('0x43')]=_0x51726a[_0x6c75('0x43')]?_0x51726a[_0x6c75('0x43')]:undefined;this['TrunkBackup']=_0x51726a[_0x6c75('0x44')]?_0x51726a[_0x6c75('0x44')]:undefined;this[_0x6c75('0x45')]=_0x51726a['dialPrefix']||undefined;this[_0x6c75('0x46')]=_0x51726a[_0x6c75('0x46')]?_0x51726a[_0x6c75('0x46')]:undefined;this[_0x6c75('0x47')]=_0x51726a[_0x6c75('0x47')]||'DESC';this[_0x6c75('0x48')]=_0x51726a['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x6c75('0x49')]=_0x51726a[_0x6c75('0x49')]||undefined;this[_0x6c75('0x4a')]=strategy[_0x51726a[_0x6c75('0x4a')]]||_0x6c75('0xa');this[_0x6c75('0x4b')]=!![];this[_0x6c75('0x4c')]=_0x51726a[_0x6c75('0x4c')]||![];this[_0x6c75('0x4d')]=_0x51726a[_0x6c75('0x4d')];this[_0x6c75('0x4e')]=_0x51726a[_0x6c75('0x4e')];this[_0x6c75('0x4f')]=_0x51726a[_0x6c75('0x4f')];this[_0x6c75('0x50')]=_0x51726a[_0x6c75('0x50')];this[_0x6c75('0x51')]=_0x51726a[_0x6c75('0x51')];this[_0x6c75('0x52')]=_0x51726a[_0x6c75('0x52')];this[_0x6c75('0x53')]=_0x51726a[_0x6c75('0x53')];this['dialAMDSilenceThreshold']=_0x51726a[_0x6c75('0x54')];this[_0x6c75('0x55')]=_0x51726a[_0x6c75('0x55')];this[_0x6c75('0x56')]=0x0;this['pTalking']=0x0;this[_0x6c75('0x57')]=_0x51726a[_0x6c75('0x57')];this[_0x6c75('0x58')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x6c75('0x59')]=0x0;this[_0x6c75('0x5a')]=0x0;this[_0x6c75('0x5b')]=0x0;this[_0x6c75('0x5c')]=0x0;this[_0x6c75('0x5d')]=0x0;this[_0x6c75('0x5e')]=0x0;this[_0x6c75('0x5f')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x6c75('0x60')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x6c75('0x61')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x6c75('0x62')]=undefined;this[_0x6c75('0x63')]=undefined;this[_0x6c75('0x64')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x6c75('0x65')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x6c75('0x66')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x6c75('0x67')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x6c75('0x68')]=_0x51726a[_0x6c75('0x69')]||0x14;this[_0x6c75('0x6a')]=_0x51726a[_0x6c75('0x69')]||0xa;this[_0x6c75('0x6b')]=0x0;this[_0x6c75('0x6c')]=0x0;this[_0x6c75('0x6d')]=0x1;this[_0x6c75('0x6e')]=0x0;this['erlangCallToSecond']=0x0;this[_0x6c75('0x6f')]=0x0;this[_0x6c75('0x70')]=0x0;this[_0x6c75('0x71')]=_0x51726a[_0x6c75('0x71')]||0x1e;this[_0x6c75('0x72')]=_0x51726a['dialRecallInQueue']||![];this[_0x6c75('0x73')]=_0x51726a[_0x6c75('0x73')]||undefined;this[_0x6c75('0x74')]=_0x51726a[_0x6c75('0x74')]||![];this['dialAgiAfterHangupAgent']=_0x51726a[_0x6c75('0x75')]||![];this['monitor_format']=monitorFormat[_0x51726a[_0x6c75('0xd')]]?monitorFormat[_0x51726a['monitor_format']]:undefined;this[_0x6c75('0x76')]=_0x51726a[_0x6c75('0x76')]||![];this[_0x6c75('0x77')]=_0x51726a[_0x6c75('0x77')]?_0x51726a['mandatoryDispositionPause']:undefined;}module[_0x6c75('0x78')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 8c8a62a..7b0d2e8 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 _0xe038=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0x4b3b7b,_0x3983b2){var _0x36a411=function(_0x31b4ec){while(--_0x31b4ec){_0x4b3b7b['push'](_0x4b3b7b['shift']());}};_0x36a411(++_0x3983b2);}(_0xe038,0x1b9));var _0x8e03=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xe038[_0x4ae6ef];return _0x3cbb4e;};'use strict';function VtigerAccount(_0x414265){this['id']=_0x414265['id']||0x0;this[_0x8e03('0x0')]=_0x414265[_0x8e03('0x0')]||'';this['username']=_0x414265[_0x8e03('0x1')]||'';this['accessKey']=_0x414265[_0x8e03('0x2')]||'';this[_0x8e03('0x3')]=_0x414265['remoteUri']||'';this['serverUrl']=_0x414265[_0x8e03('0x4')]||'';this['Configurations']=_0x414265[_0x8e03('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xa033=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x3f0662,_0x3b5bc3){var _0x42e8c2=function(_0x1ad4b0){while(--_0x1ad4b0){_0x3f0662['push'](_0x3f0662['shift']());}};_0x42e8c2(++_0x3b5bc3);}(_0xa033,0x1d5));var _0x3a03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa033[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x6bbe08){this['id']=_0x6bbe08['id']||0x0;this[_0x3a03('0x0')]=_0x6bbe08[_0x3a03('0x0')]||'';this[_0x3a03('0x1')]=_0x6bbe08['username']||'';this[_0x3a03('0x2')]=_0x6bbe08[_0x3a03('0x2')]||'';this[_0x3a03('0x3')]=_0x6bbe08[_0x3a03('0x3')]||'';this['serverUrl']=_0x6bbe08[_0x3a03('0x4')]||'';this[_0x3a03('0x5')]=_0x6bbe08[_0x3a03('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index c5c86fc..5888597 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 _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x0b0e[_0x2d2c16];return _0x53f2fb;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x2032=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x48ab93,_0x3d5a41){var _0x22a0ab=function(_0x3b68aa){while(--_0x3b68aa){_0x48ab93['push'](_0x48ab93['shift']());}};_0x22a0ab(++_0x3d5a41);}(_0x2032,0xd9));var _0x2203=function(_0x36ad3d,_0x5cd7bb){_0x36ad3d=_0x36ad3d-0x0;var _0x3fc7db=_0x2032[_0x36ad3d];return _0x3fc7db;};'use strict';function ZendeskAccount(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['username']||'';this[_0x2203('0x2')]=_0x4d6c97[_0x2203('0x2')]||'';this['token']=_0x4d6c97[_0x2203('0x3')]||'';this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||'';this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||'';this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||_0x2203('0x7');this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')]||'';this[_0x2203('0x9')]=_0x4d6c97['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 478af95..fa2db17 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 _0x2fee=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fee,0x11a));var _0xe2fe=function(_0x3303fb,_0x1266dd){_0x3303fb=_0x3303fb-0x0;var _0x71a686=_0x2fee[_0x3303fb];return _0x71a686;};'use strict';function ZohoAccount(_0x57774a){this['id']=_0x57774a['id']||0x0;this['name']=_0x57774a[_0xe2fe('0x0')]||'';this['description']=_0x57774a[_0xe2fe('0x1')]||'';this['host']=_0x57774a[_0xe2fe('0x2')]||'';this[_0xe2fe('0x3')]=_0x57774a['zone']||'';this[_0xe2fe('0x4')]=_0x57774a[_0xe2fe('0x4')]||'';this[_0xe2fe('0x5')]=_0x57774a['clientSecret']||'';this[_0xe2fe('0x6')]=_0x57774a[_0xe2fe('0x6')]||'';this[_0xe2fe('0x7')]=_0x57774a[_0xe2fe('0x7')]||'';this[_0xe2fe('0x8')]=_0x57774a[_0xe2fe('0x8')]||'';this['Configurations']=_0x57774a[_0xe2fe('0x9')]||{};}module[_0xe2fe('0xa')]=ZohoAccount; \ No newline at end of file +var _0xe2ab=['clientId','clientSecret','serverUrl','code','refreshToken','exports','name','description','host','zone'];(function(_0xe24142,_0x1b0ad7){var _0x5f0127=function(_0x4d98ad){while(--_0x4d98ad){_0xe24142['push'](_0xe24142['shift']());}};_0x5f0127(++_0x1b0ad7);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x3f84bd,_0xef44d5){_0x3f84bd=_0x3f84bd-0x0;var _0x35dec1=_0xe2ab[_0x3f84bd];return _0x35dec1;};'use strict';function ZohoAccount(_0x3fe77e){this['id']=_0x3fe77e['id']||0x0;this[_0xbe2a('0x0')]=_0x3fe77e[_0xbe2a('0x0')]||'';this[_0xbe2a('0x1')]=_0x3fe77e[_0xbe2a('0x1')]||'';this[_0xbe2a('0x2')]=_0x3fe77e['host']||'';this[_0xbe2a('0x3')]=_0x3fe77e[_0xbe2a('0x3')]||'';this[_0xbe2a('0x4')]=_0x3fe77e[_0xbe2a('0x4')]||'';this['clientSecret']=_0x3fe77e[_0xbe2a('0x5')]||'';this['serverUrl']=_0x3fe77e[_0xbe2a('0x6')]||'';this['code']=_0x3fe77e[_0xbe2a('0x7')]||'';this[_0xbe2a('0x8')]=_0x3fe77e[_0xbe2a('0x8')]||'';this['Configurations']=_0x3fe77e['Configurations']||{};}module[_0xbe2a('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 091dfc8..f3a650b 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 _0x616c=['countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','isNil','Agent','channelAgent','format','SIP/%s','Contact','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x594371,_0x374af2){var _0x25d473=function(_0x205a1c){while(--_0x205a1c){_0x594371['push'](_0x594371['shift']());}};_0x25d473(++_0x374af2);}(_0x616c,0x122));var _0xc616=function(_0xa10994,_0x2f5087){_0xa10994=_0xa10994-0x0;var _0x38ca6e=_0x616c[_0xa10994];return _0x38ca6e;};'use strict';var util=require(_0xc616('0x0'));var _=require(_0xc616('0x1'));var moment=require(_0xc616('0x2'));function checkNameSurname(_0x50ed5a,_0x1359ee,_0x4315f1){var _0xe3244e='';if(!_['isNil'](_0x1359ee)&&_0xc616('0x3')===typeof _0x1359ee){_0xe3244e+=_0x1359ee;}if(!_['isNil'](_0x4315f1)&&_0xc616('0x3')===typeof _0x4315f1){_0xe3244e+='\x20'+_0x4315f1;}if(_0xe3244e!==''){return _0xe3244e;}return _0x50ed5a;}function Action(_0x3551ef,_0x19c953,_0x5958b8,_0x857d17,_0x421c2f){this[_0xc616('0x4')]=_0x5958b8||undefined;this[_0xc616('0x5')]=_0x3551ef['id'];this[_0xc616('0x6')]=_0x19c953[_0xc616('0x7')];this[_0xc616('0x8')]=_0x19c953[_0xc616('0x8')];this[_0xc616('0x9')]=_0xc616('0x6');this[_0xc616('0xa')]=![];this[_0xc616('0xb')]=_[_0xc616('0xc')](_0x3551ef['Agent'])?undefined:_0x3551ef[_0xc616('0xd')]['name'];this[_0xc616('0xe')]=this['membername']?util[_0xc616('0xf')](_0xc616('0x10'),this[_0xc616('0xb')]):_0x857d17||undefined;this['calleridname']=checkNameSurname(_0x3551ef[_0xc616('0x11')][_0xc616('0x12')],_0x3551ef[_0xc616('0x11')]['firstName'],_0x3551ef['Contact'][_0xc616('0x13')]);this[_0xc616('0x14')]=_0x3551ef[_0xc616('0x14')]||![];this['calleridnum']=_0x3551ef[_0xc616('0x11')][_0xc616('0x12')];this[_0xc616('0x15')]=_0x3551ef[_0xc616('0x15')];this[_0xc616('0x16')]=_0x3551ef[_0xc616('0x16')]||0x0;this['countcongestionretry']=_0x3551ef[_0xc616('0x17')]||0x0;this['countnoanswerretry']=_0x3551ef[_0xc616('0x18')]||0x0;this[_0xc616('0x19')]=(_0x3551ef[_0xc616('0x16')]||0x0)+(_0x3551ef[_0xc616('0x17')]||0x0)+(_0x3551ef[_0xc616('0x18')]||0x0)+(_0x3551ef['countnosuchnumberretry']||0x0)+(_0x3551ef[_0xc616('0x1a')]||0x0)+(_0x3551ef['countabandonedretry']||0x0)+(_0x3551ef[_0xc616('0x1b')]||0x0)+(_0x3551ef[_0xc616('0x1c')]||0x0);this[_0xc616('0x1d')]=_0x3551ef[_0xc616('0x1d')]||0x0;this['countdropretry']=_0x3551ef['countdropretry']||0x0;this['countabandonedretry']=_0x3551ef['countabandonedretry']||0x0;this[_0xc616('0x1b')]=_0x3551ef[_0xc616('0x1b')]||0x0;this[_0xc616('0x1c')]=_0x3551ef[_0xc616('0x1c')]||0x0;this[_0xc616('0x1e')]=_0x3551ef[_0xc616('0x1e')];this[_0xc616('0x1f')]=_0x3551ef['callbackuniqueid'];this['callbackat']=_0x3551ef[_0xc616('0x20')];this[_0xc616('0x21')]=_0x3551ef[_0xc616('0x21')];this[_0xc616('0x22')]=_0x3551ef[_0xc616('0x22')];this[_0xc616('0x23')]=_0x3551ef['ListId'];this['UserId']=_['isNil'](_0x3551ef[_0xc616('0xd')])?_0x3551ef[_0xc616('0x24')]:_0x3551ef['Agent']['id'];this['VoiceQueueId']=_0x3551ef[_0xc616('0x25')];this[_0xc616('0x26')]='';this[_0xc616('0x27')]='';}Action[_0xc616('0x28')]['getCaller']=function(){return util['format'](_0xc616('0x29'),this[_0xc616('0x2a')],this[_0xc616('0x2b')]);};module[_0xc616('0x2c')]=Action; \ No newline at end of file +var _0x05df=['calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active'];(function(_0x1aae87,_0x587519){var _0x438d22=function(_0x41413a){while(--_0x41413a){_0x1aae87['push'](_0x1aae87['shift']());}};_0x438d22(++_0x587519);}(_0x05df,0x154));var _0xf05d=function(_0x561a50,_0x3bbc44){_0x561a50=_0x561a50-0x0;var _0x19e0f1=_0x05df[_0x561a50];return _0x19e0f1;};'use strict';var util=require(_0xf05d('0x0'));var _=require('lodash');var moment=require(_0xf05d('0x1'));function checkNameSurname(_0x486274,_0x253d68,_0x1b9b1f){var _0x882d45='';if(!_['isNil'](_0x253d68)&&'string'===typeof _0x253d68){_0x882d45+=_0x253d68;}if(!_[_0xf05d('0x2')](_0x1b9b1f)&&_0xf05d('0x3')===typeof _0x1b9b1f){_0x882d45+='\x20'+_0x1b9b1f;}if(_0x882d45!==''){return _0x882d45;}return _0x486274;}function Action(_0x27eccd,_0x638640,_0x4c7a9c,_0x3deeef,_0x31bba5){this[_0xf05d('0x4')]=_0x4c7a9c||undefined;this[_0xf05d('0x5')]=_0x27eccd['id'];this[_0xf05d('0x6')]=_0x638640[_0xf05d('0x7')];this['type']=_0x638640[_0xf05d('0x8')];this['campaigntype']=_0xf05d('0x6');this[_0xf05d('0x9')]=![];this[_0xf05d('0xa')]=_[_0xf05d('0x2')](_0x27eccd['Agent'])?undefined:_0x27eccd[_0xf05d('0xb')][_0xf05d('0x7')];this[_0xf05d('0xc')]=this[_0xf05d('0xa')]?util[_0xf05d('0xd')](_0xf05d('0xe'),this[_0xf05d('0xa')]):_0x3deeef||undefined;this[_0xf05d('0xf')]=checkNameSurname(_0x27eccd[_0xf05d('0x10')][_0xf05d('0x11')],_0x27eccd['Contact']['firstName'],_0x27eccd['Contact'][_0xf05d('0x12')]);this[_0xf05d('0x13')]=_0x27eccd[_0xf05d('0x13')]||![];this[_0xf05d('0x14')]=_0x27eccd['Contact'][_0xf05d('0x11')];this[_0xf05d('0x15')]=_0x27eccd[_0xf05d('0x15')];this['countbusyretry']=_0x27eccd[_0xf05d('0x16')]||0x0;this['countcongestionretry']=_0x27eccd[_0xf05d('0x17')]||0x0;this[_0xf05d('0x18')]=_0x27eccd['countnoanswerretry']||0x0;this[_0xf05d('0x19')]=(_0x27eccd[_0xf05d('0x16')]||0x0)+(_0x27eccd[_0xf05d('0x17')]||0x0)+(_0x27eccd[_0xf05d('0x18')]||0x0)+(_0x27eccd[_0xf05d('0x1a')]||0x0)+(_0x27eccd['countdropretry']||0x0)+(_0x27eccd[_0xf05d('0x1b')]||0x0)+(_0x27eccd[_0xf05d('0x1c')]||0x0)+(_0x27eccd[_0xf05d('0x1d')]||0x0);this[_0xf05d('0x1a')]=_0x27eccd[_0xf05d('0x1a')]||0x0;this[_0xf05d('0x1e')]=_0x27eccd[_0xf05d('0x1e')]||0x0;this[_0xf05d('0x1b')]=_0x27eccd[_0xf05d('0x1b')]||0x0;this[_0xf05d('0x1c')]=_0x27eccd[_0xf05d('0x1c')]||0x0;this[_0xf05d('0x1d')]=_0x27eccd[_0xf05d('0x1d')]||0x0;this[_0xf05d('0x1f')]=_0x27eccd[_0xf05d('0x1f')];this[_0xf05d('0x20')]=_0x27eccd['callbackuniqueid'];this[_0xf05d('0x21')]=_0x27eccd[_0xf05d('0x21')];this[_0xf05d('0x22')]=_0x27eccd[_0xf05d('0x22')];this['ContactId']=_0x27eccd['ContactId'];this[_0xf05d('0x23')]=_0x27eccd['ListId'];this[_0xf05d('0x24')]=_[_0xf05d('0x2')](_0x27eccd['Agent'])?_0x27eccd['UserId']:_0x27eccd[_0xf05d('0xb')]['id'];this[_0xf05d('0x25')]=_0x27eccd[_0xf05d('0x25')];this[_0xf05d('0x26')]='';this[_0xf05d('0x27')]='';}Action[_0xf05d('0x28')][_0xf05d('0x29')]=function(){return util['format'](_0xf05d('0x2a'),this[_0xf05d('0xf')],this[_0xf05d('0x2b')]);};module[_0xf05d('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 6dfa34d..ca55796 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 _0x34e8=['type','outbound','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','unmanaged','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','voice:queue:%s','name','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','actions','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','emit','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','Global','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','isNil','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','run','execRun','unlock','active','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','originated:\x20','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','responsetime','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','callProgressDetectingCustomer','[syncHangup][talking][cause]','cause','dialQueueProject','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34e8,0x12c));var _0x834e=function(_0x18c8b1,_0x1b726c){_0x18c8b1=_0x18c8b1-0x0;var _0x5e3e1c=_0x34e8[_0x18c8b1];return _0x5e3e1c;};'use strict';var util=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var uuid=require(_0x834e('0x3'));var moment=require('moment');var md5=require(_0x834e('0x4'));var Redis=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var loggerAction=require(_0x834e('0x7'))(_0x834e('0x9'));var ami=require('../ami');var rpcDb=require(_0x834e('0xa'));var Action=require('./action');var ut=require(_0x834e('0xb'));config[_0x834e('0xc')]=_[_0x834e('0xd')](config[_0x834e('0xc')],{'host':_0x834e('0xe'),'port':0x18eb});var io=require(_0x834e('0xf'))(new Redis(config[_0x834e('0xc')]));var Sequence=function(){};Sequence[_0x834e('0x10')][_0x834e('0x11')]=function(_0x186b3b){this[_0x834e('0x12')]=this[_0x834e('0x12')]?this[_0x834e('0x12')][_0x834e('0x13')](_0x186b3b):_0x186b3b();};function Preview(_0x293514){this[_0x834e('0x14')]=new Sequence();this[_0x834e('0x15')]=_0x293514['voiceQueues'];this[_0x834e('0x16')]=_0x293514[_0x834e('0x16')];this['actions']={};this[_0x834e('0x17')]=_0x293514[_0x834e('0x17')];this[_0x834e('0x18')]=0x0;ami['on'](_0x834e('0x19'),this['syncOriginateResponse'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1b'),this['syncHangup'][_0x834e('0x1a')](this));ami['on']('hanguprequest',this[_0x834e('0x1c')][_0x834e('0x1a')](this));ami['on']('dialend',this[_0x834e('0x1d')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1e'),this['syncNewExten'][_0x834e('0x1a')](this));ami['on'](_0x834e('0x1f'),this[_0x834e('0x20')][_0x834e('0x1a')](this));ami['on'](_0x834e('0x21'),this[_0x834e('0x22')][_0x834e('0x1a')](this));ami['on']('blindtransfer',this[_0x834e('0x23')][_0x834e('0x1a')](this));this[_0x834e('0x24')](this[_0x834e('0x15')]);}function emit(_0x4ab05d,_0x45a630,_0x62f8f1){io['to'](_0x4ab05d)['emit'](_0x45a630,_0x62f8f1);}function emitCampaignPreview(_0x1b4bdf){if(_0x1b4bdf[_0x834e('0x25')]===_0x834e('0x26')){var _0x5c55ca={'id':_0x1b4bdf['id'],'name':_0x1b4bdf['name'],'strategy':_0x1b4bdf[_0x834e('0x27')],'answered':_0x1b4bdf[_0x834e('0x28')],'available':_0x1b4bdf['available'],'loggedIn':_0x1b4bdf[_0x834e('0x29')],'pTalking':_0x1b4bdf[_0x834e('0x2a')],'sumBillable':_0x1b4bdf['sumBillable'],'sumDuration':_0x1b4bdf[_0x834e('0x2b')],'sumHoldTime':_0x1b4bdf[_0x834e('0x2c')]||0x0,'talking':_0x1b4bdf[_0x834e('0x2d')],'total':_0x1b4bdf['total'],'type':_0x1b4bdf[_0x834e('0x25')],'unmanaged':_0x1b4bdf[_0x834e('0x2e')],'abandoned':_0x1b4bdf['abandoned'],'waiting':_0x1b4bdf['waiting'],'loggedInDb':_0x1b4bdf[_0x834e('0x2f')],'dialActive':_0x1b4bdf['dialActive'],'dialMethod':_0x1b4bdf[_0x834e('0x30')],'dialOriginateCallerIdName':_0x1b4bdf[_0x834e('0x31')],'dialOriginateCallerIdNumber':_0x1b4bdf[_0x834e('0x32')],'dialOriginateTimeout':_0x1b4bdf[_0x834e('0x33')],'dialPrefix':_0x1b4bdf[_0x834e('0x34')],'outboundAnswerAgiCallsDay':_0x1b4bdf[_0x834e('0x35')],'outboundAnswerCallsDay':_0x1b4bdf['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1b4bdf['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1b4bdf['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1b4bdf['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1b4bdf[_0x834e('0x36')],'outboundDropCallsDayCallersExit':_0x1b4bdf[_0x834e('0x37')],'outboundDropCallsDayTimeout':_0x1b4bdf[_0x834e('0x38')],'outboundNoAnswerCallsDay':_0x1b4bdf['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1b4bdf[_0x834e('0x39')],'outboundOriginateFailureCallsDay':_0x1b4bdf[_0x834e('0x3a')],'outboundReCallsDay':_0x1b4bdf[_0x834e('0x3b')],'outboundRejectCallsDay':_0x1b4bdf[_0x834e('0x3c')],'outboundUnknownCallsDay':_0x1b4bdf[_0x834e('0x3d')],'outboundAbandonedCallsDay':_0x1b4bdf[_0x834e('0x3e')],'predictiveIntervalAnsweredCalls':_0x1b4bdf[_0x834e('0x3f')],'predictiveIntervalAvgHoldtime':_0x1b4bdf[_0x834e('0x40')],'predictiveIntervalAvgTalktime':_0x1b4bdf[_0x834e('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x1b4bdf['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1b4bdf[_0x834e('0x42')],'predictiveIntervalErlangCalls':_0x1b4bdf['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1b4bdf[_0x834e('0x43')],'predictiveIntervalHitRate':_0x1b4bdf[_0x834e('0x44')],'predictiveIntervalMultiplicativeFactor':_0x1b4bdf[_0x834e('0x45')],'predictiveIntervalPauses':_0x1b4bdf[_0x834e('0x46')],'predictiveIntervalAvailable':_0x1b4bdf[_0x834e('0x47')],'predictiveIntervalTotalCalls':_0x1b4bdf[_0x834e('0x48')],'message':_0x1b4bdf[_0x834e('0x49')],'originated':_0x1b4bdf[_0x834e('0x4a')],'erlangCalls':_0x1b4bdf[_0x834e('0x4b')],'erlangCallToSecond':_0x1b4bdf[_0x834e('0x4c')],'erlangAbandonmentRate':_0x1b4bdf['erlangAbandonmentRate'],'erlangBusyFactor':_0x1b4bdf[_0x834e('0x4d')],'startPredictive':_0x1b4bdf[_0x834e('0x4e')],'startProgressive':_0x1b4bdf[_0x834e('0x4f')]};if(_0x1b4bdf[_0x834e('0x50')]){_0x5c55ca['Trunk']={'id':_0x1b4bdf[_0x834e('0x50')]['id'],'name':_0x1b4bdf[_0x834e('0x50')]['name'],'active':_0x1b4bdf['Trunk']['active'],'callerid':_0x1b4bdf[_0x834e('0x50')][_0x834e('0x51')]};}if(_0x1b4bdf[_0x834e('0x52')]){_0x5c55ca[_0x834e('0x52')]={'id':_0x1b4bdf[_0x834e('0x52')]['id'],'name':_0x1b4bdf[_0x834e('0x52')]['name']};}var _0x2c2d94=md5(JSON['stringify'](_0x5c55ca));if(_0x1b4bdf[_0x834e('0x4')]!==_0x2c2d94){_0x1b4bdf[_0x834e('0x4')]=_0x2c2d94;emit(util['format'](_0x834e('0x53'),_0x5c55ca[_0x834e('0x54')]),'voice_queue:save',_0x5c55ca);}}}function emitVoiceQueueChannelRemove(_0x481f70){logger[_0x834e('0x55')](_0x834e('0x56'),JSON[_0x834e('0x57')](_0x481f70));emit(util[_0x834e('0x58')](_0x834e('0x53'),_0x481f70['name']),_0x834e('0x59'),_0x481f70);}function notSendMessagesQueue(_0x548d1d){if(_0x548d1d['sendMessageOneNotActive']){if(_0x548d1d[_0x834e('0x4a')]===0x0&&_0x548d1d['pTalking']===0x0){_0x548d1d[_0x834e('0x5a')]=![];_0x548d1d[_0x834e('0x5b')]=0x0;_0x548d1d[_0x834e('0x5c')]=0x0;_0x548d1d[_0x834e('0x49')]=_0x834e('0x5d');ut['logger'](_0x834e('0x5e'),_0x548d1d[_0x834e('0x54')]+_0x834e('0x5f'));}else{_0x548d1d['message']=_0x834e('0x60');ut[_0x834e('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x548d1d[_0x834e('0x54')]+'\x20is\x20disactive');}emitCampaignPreview(_0x548d1d);}}Preview[_0x834e('0x10')][_0x834e('0x24')]=function(){var _0x4a18bb=this;setInterval(function(){_0x4a18bb['syncCampaigns']();},0x7cf);};Preview[_0x834e('0x10')][_0x834e('0x62')]=function(){var _0x3bcbf4=this[_0x834e('0x15')];this[_0x834e('0x18')]+=0x1;for(var _0x23feea in _0x3bcbf4){if(_0x3bcbf4[_0x834e('0x63')](_0x23feea)&&(_0x3bcbf4[_0x23feea]['dialMethod']===_0x834e('0x8')||_0x3bcbf4[_0x23feea]['dialMethod']===_0x834e('0x64'))&&_0x3bcbf4[_0x23feea]['type']===_0x834e('0x26')){if(this['clockClearZombieChannels']>0x7){this[_0x834e('0x18')]=0x0;this[_0x834e('0x65')]();}}if(_0x3bcbf4['hasOwnProperty'](_0x23feea)&&_0x3bcbf4[_0x23feea][_0x834e('0x30')]===_0x834e('0x8')&&_0x3bcbf4[_0x23feea][_0x834e('0x25')]===_0x834e('0x26')){if(_0x3bcbf4[_0x23feea][_0x834e('0x66')]){this[_0x834e('0x67')](_0x3bcbf4[_0x23feea]);this[_0x834e('0x68')](_0x3bcbf4[_0x23feea]);}else{notSendMessagesQueue(_0x3bcbf4[_0x23feea]);}}}};Preview[_0x834e('0x10')][_0x834e('0x69')]=function(_0x279ea1){var _0x5f3943=this;this[_0x834e('0x14')][_0x834e('0x11')](function(){if(!_['isNil'](_0x5f3943[_0x834e('0x6a')][_0x279ea1])){loggerAction[_0x834e('0x55')](_0x834e('0x6b'),_0x279ea1,_0x834e('0x6c'),_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')],'originated:\x20',JSON['stringify'](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]][_0x834e('0x4a')]),_0x834e('0x6e'),JSON[_0x834e('0x57')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]][_0x834e('0x2a')]),JSON[_0x834e('0x57')](_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6f')]),JSON[_0x834e('0x57')](_[_0x834e('0x70')](_0x5f3943[_0x834e('0x6a')][_0x279ea1],[_0x834e('0x71'),_0x834e('0x72'),_0x834e('0x73'),_0x834e('0x74')])));return ami['Action']({'action':_0x834e('0x75'),'channel':_0x5f3943[_0x834e('0x6a')][_0x279ea1]['channel']})[_0x834e('0x76')](function(_0x3b0988){if(_0x3b0988['message']===_0x834e('0x77')){setTimeout(function(){if(_0x5f3943[_0x834e('0x6a')][_0x279ea1]){ut[_0x834e('0x78')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]],_0x834e('0x79'));if(_0x5f3943['actions'][_0x279ea1][_0x834e('0x6f')]===!![]){ut[_0x834e('0x7a')](_0x5f3943[_0x834e('0x15')][_0x5f3943[_0x834e('0x6a')][_0x279ea1][_0x834e('0x6d')]],_0x834e('0x79'));ut[_0x834e('0x7b')](_0x834e('0x7c')+_0x279ea1,_0x5f3943['actions'][_0x279ea1][_0x834e('0x6d')]);}ut['loggerError'](_0x834e('0x7d')+_0x279ea1,_0x5f3943['actions'][_0x279ea1][_0x834e('0x6d')]);delete _0x5f3943['actions'][_0x279ea1];}},0x2328);}});}});};Preview['prototype'][_0x834e('0x65')]=function(){var _0x3e1bee=this;loggerAction['info']('[action]',_[_0x834e('0x7e')](this[_0x834e('0x6a')]));for(var _0x138ed2 in this[_0x834e('0x6a')]){if(_0x3e1bee[_0x834e('0x6a')][_0x834e('0x63')](_0x138ed2)){_0x3e1bee[_0x834e('0x69')](_0x138ed2);}}};Preview[_0x834e('0x10')]['recallMe']=function(_0x142334){var _0x3c70bf=this;rpcDb['getContactRecallMe'](_0x142334['id'],ut[_0x834e('0x7f')](this['agents']))[_0x834e('0x80')](function(_0x45eceb){if(!_['isNil'](_0x45eceb)){for(var _0x41ef86=0x0;_0x41ef86<_0x45eceb[_0x834e('0x81')];_0x41ef86+=0x1){if(ut[_0x834e('0x82')](_0x45eceb[_0x41ef86][_0x834e('0x83')])<_0x142334['dialRecallMeTimeout']*0x3c){if(_0x45eceb[_0x41ef86][_0x834e('0x84')]&&!_0x45eceb[_0x41ef86][_0x834e('0x84')][_0x834e('0x85')]){_0x3c70bf['run'](_0x45eceb[_0x41ef86]['id'])[_0x834e('0x80')](ut[_0x834e('0x86')](_0x834e('0x87')))[_0x834e('0x76')](ut[_0x834e('0x86')](_0x834e('0x87')));}else{rpcDb[_0x834e('0x88')](_0x45eceb[_0x41ef86]['id']);}}else{var _0x1def00=new Action(_0x45eceb[_0x41ef86],_0x142334);_0x1def00[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));_0x142334[_0x834e('0x3b')]+=0x1;ut[_0x834e('0x8b')](_0x1def00,0x17,_0x834e('0x8c'));if(_0x142334[_0x834e('0x8d')]){rpcDb[_0x834e('0x8e')](ut[_0x834e('0x8f')](_0x45eceb[_0x41ef86]));rpcDb[_0x834e('0x90')](_0x1def00,_0x834e('0x91'));}else{ut[_0x834e('0x8b')](_0x1def00,0x16,_0x834e('0x92'));rpcDb[_0x834e('0x90')](_0x1def00,'[HistoryRecallClose]');rpcDb[_0x834e('0x93')](_0x1def00,_0x834e('0x94'));}}}}})[_0x834e('0x76')](ut[_0x834e('0x86')]('[getContactRecallMe]'));};Preview[_0x834e('0x10')]['setMessage']=function(_0x56a152){_0x56a152[_0x834e('0x5a')]=!![];if(ut[_0x834e('0x95')](_0x56a152[_0x834e('0x29')])){_0x56a152[_0x834e('0x49')]=_0x834e('0x96');}else if(!ut[_0x834e('0x97')](_0x56a152[_0x834e('0x66')])){_0x56a152[_0x834e('0x49')]='NOT_ACTIVE';}else if(!this[_0x834e('0x98')](_0x56a152['Trunk'])){if(!this[_0x834e('0x98')](_0x56a152[_0x834e('0x99')])){_0x56a152['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x56a152[_0x834e('0x49')]=_0x834e('0x9a');}}else{_0x56a152[_0x834e('0x49')]=_0x834e('0x9a');}emitCampaignPreview(_0x56a152);};Preview[_0x834e('0x10')]['callProgressDetectingCustomer']=function(_0x2b0d93,_0x15018f,_0x2df64f){var _0x228a60=this;var _0x3181af=this[_0x834e('0x6a')][_0x15018f];var _0x87818b=this[_0x834e('0x15')][_0x3181af[_0x834e('0x6d')]];var _0x324f67;if(_0x87818b){switch(_0x2df64f){case'1':_0x87818b['outboundNoSuchCallsDay']+=0x1;_0x3181af[_0x834e('0x9b')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x0,'NoSuchNumber');ami[_0x834e('0x9e')]('custom:agentnosuchnumber',ut['buildObj'](_0x3181af,'nosuchnumber'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0x9f'));if(ut['totalGlobal'](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,'Global');rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xa2'));}else{if(_0x3181af['countnosuchnumberretry']>=_0x87818b['dialNoSuchNumberMaxRetry']){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xa2'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0x9b'),_0x87818b['dialNoSuchNumberRetryFrequency']),_0x3181af[_0x834e('0xa5')],_0x3181af['activeContact']);}}delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];break;case _0x834e('0xa7'):var _0x5afb41=moment()[_0x834e('0x58')](_0x834e('0x8a'));_0x3181af['responsetime']=_0x5afb41;_0x3181af[_0x834e('0xa8')]=_0x5afb41;_0x3181af[_0x834e('0x6f')]=!![];_0x87818b[_0x834e('0x2a')]+=0x1;logger['info'](_0x834e('0xa9'),_0x3181af[_0x834e('0xaa')],_0x834e('0xab'),_0x87818b[_0x834e('0x54')],_0x834e('0x6e'),_0x87818b[_0x834e('0x2a')]);ami[_0x834e('0x9e')](_0x834e('0xac'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xae'),this['campaignsPreview'][_0x3181af['queue']]));if(_0x87818b['acw']){ami[_0x834e('0x9e')](_0x834e('0xaf'),ut[_0x834e('0xb0')](_0x3181af));}break;case'16':ami[_0x834e('0x9e')](_0x834e('0xb1'),ut['buildObj'](_0x3181af,'complete',this[_0x834e('0x15')][_0x3181af[_0x834e('0x6d')]]));emitVoiceQueueChannelRemove(ut[_0x834e('0xad')](_0x3181af,_0x834e('0xb2')));_0x87818b[_0x834e('0xb3')]+=0x1;_0x87818b['total']+=0x1;_0x87818b[_0x834e('0x28')]+=0x1;ut[_0x834e('0x7a')](_0x87818b,_0x834e('0xb4'));_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x4,_0x834e('0xb5'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xb6'));rpcDb['createCustomerFinal'](_0x3181af,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x834e('0xb7')](_0x3181af);_0x87818b[_0x834e('0x2b')]+=_0x3181af['talktime'];_0x87818b[_0x834e('0xb8')]+=_0x3181af['talktime'];logger[_0x834e('0x55')](_0x834e('0xb9'),_0x3181af[_0x834e('0xaa')],'\x20Queue',_0x87818b[_0x834e('0x54')],'pTalking:\x20',_0x87818b['pTalking']);delete this['actions'][_0x2b0d93[_0x834e('0xa6')]];break;case _0x834e('0xba'):_0x87818b[_0x834e('0xbb')]+=0x1;_0x3181af[_0x834e('0xbc')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x5,_0x834e('0xbd'));ami[_0x834e('0x9e')]('custom:agentbusy',ut[_0x834e('0xad')](_0x3181af,'busy'));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xbe'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x3181af[_0x834e('0xbc')]>=_0x87818b[_0x834e('0xc0')]){rpcDb['createCustomerFinal'](_0x3181af,_0x834e('0xbe'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xbc'),_0x87818b[_0x834e('0xc1')]),_0x3181af['unlockAgent'],_0x3181af[_0x834e('0xc2')]);}}break;case _0x834e('0xc3'):_0x87818b['outboundNoAnswerCallsDay']+=0x1;_0x3181af['countnoanswerretry']+=0x1;_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x3,'NoAnswer');ami[_0x834e('0x9e')](_0x834e('0xc4'),ut['buildObj'](_0x3181af,_0x834e('0xc5')));rpcDb['createCustomerHistory'](_0x3181af,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,_0x834e('0xc6'));}else{if(_0x3181af[_0x834e('0xc7')]>=_0x87818b[_0x834e('0xc8')]){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xc9'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xc7'),_0x87818b[_0x834e('0xca')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case _0x834e('0xcb'):_0x87818b[_0x834e('0xcc')]+=0x1;_0x3181af[_0x834e('0xcd')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x8,_0x834e('0xce'));ami[_0x834e('0x9e')](_0x834e('0xcf'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xd0')));rpcDb['createCustomerHistory'](_0x3181af,_0x834e('0xd1'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xd2'));}else{if(_0x3181af[_0x834e('0xcd')]>=_0x87818b[_0x834e('0xd3')]){rpcDb['createCustomerFinal'](_0x3181af,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x834e('0xa4')](_0x3181af,'countcongestionretry',_0x87818b[_0x834e('0xc1')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case'CANCEL':_0x87818b[_0x834e('0x3c')]+=0x1;_0x3181af[_0x834e('0xd4')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0x14,_0x834e('0xd5'));ami['emit'](_0x834e('0xd6'),ut[_0x834e('0xad')](_0x3181af,_0x834e('0xd7')));rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xd8'));if(ut['totalGlobal'](_0x3181af)>=_0x87818b['dialGlobalMaxRetry']){_0x324f67=ut['cloneAction'](_0x3181af,0x14,'AgentReject');rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xd9'));}else{if(_0x3181af['countagentrejectretry']>=_0x87818b[_0x834e('0xda')]){rpcDb[_0x834e('0x93')](_0x3181af,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xd4'),_0x87818b[_0x834e('0xdb')]),_0x3181af[_0x834e('0xa5')],_0x3181af[_0x834e('0xc2')]);}}break;case'ABANDONED':_0x87818b['outboundAbandonedCallsDay']+=0x1;_0x3181af[_0x834e('0xdc')]+=0x1;_0x3181af[_0x834e('0x9c')]=ut[_0x834e('0x9d')](_0x3181af);ut['logCustomer'](_0x3181af,0xb,_0x834e('0xdd'));rpcDb[_0x834e('0x90')](_0x3181af,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb['createCustomerFinal'](_0x324f67,_0x834e('0xde'));}else{if(_0x3181af['countabandonedetry']>=_0x87818b['dialAbandonedMaxRety']){rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xde'));}else{rpcDb[_0x834e('0xa3')](ut[_0x834e('0xa4')](_0x3181af,_0x834e('0xdc'),_0x87818b[_0x834e('0xdf')]),_0x3181af['unlockAgent'],_0x3181af['activeContact']);}}break;default:if(_0x3181af[_0x834e('0x6f')]){ut[_0x834e('0x7a')](_0x87818b,_0x834e('0xe0'));ut[_0x834e('0x7b')](_0x834e('0xe1')+_0x87818b[_0x834e('0x54')],_0x2b0d93);}_0x87818b[_0x834e('0x3d')]+=0x1;_0x3181af['countglobal']=ut[_0x834e('0x9d')](_0x3181af);ut[_0x834e('0x8b')](_0x3181af,0xc,_0x2b0d93['cause-txt']||_0x2b0d93[_0x834e('0xe2')]);rpcDb[_0x834e('0x90')](_0x3181af,_0x834e('0xe3'));if(ut[_0x834e('0x9d')](_0x3181af)>=_0x87818b[_0x834e('0xa0')]){_0x324f67=ut[_0x834e('0xa1')](_0x3181af,0xf,_0x834e('0xbf'));rpcDb[_0x834e('0x93')](_0x324f67,_0x834e('0xe4'));}else{rpcDb[_0x834e('0x93')](_0x3181af,_0x834e('0xe4'));}delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];}if(!(_0x3181af[_0x834e('0x6f')]&&_0x2df64f==='16')){ut['updateOriginated'](_0x87818b,_0x834e('0xe5'));logger[_0x834e('0x55')]('[originated][decrement][callProgressDetectingCustomer]',_0x3181af[_0x834e('0xaa')],'\x20Queue',_0x87818b[_0x834e('0x54')],'originated:\x20',_0x87818b[_0x834e('0x4a')]);}if(_0x2df64f!=='ANSWER'){delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xa6')]];delete this[_0x834e('0x6a')][_0x2b0d93[_0x834e('0xe6')]];}}};Preview['prototype'][_0x834e('0xe7')]=function(_0x38085e,_0x375fec,_0x2247f7){if(_[_0x834e('0xe8')](_0x375fec)&&_0x834e('0xe9')!==typeof _0x375fec){return;}if(_[_0x834e('0xe8')](_0x2247f7)&&_0x834e('0xe9')!==typeof _0x2247f7){return;}switch(_0x2247f7[_0x834e('0xea')]){case'0':ut[_0x834e('0xeb')](_0x38085e,0x0,_0x834e('0xec'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xee'));break;case'3':ut[_0x834e('0xeb')](_0x38085e,0x3,_0x834e('0xef'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf0'));break;case'5':ut['logAgent'](_0x38085e,0x5,'Busy');rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf1'));break;case'8':ut[_0x834e('0xeb')](_0x38085e,0x8,_0x834e('0xce'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf2'));break;case'22':ut[_0x834e('0xeb')](_0x38085e,0x16,_0x834e('0xf3'));rpcDb[_0x834e('0xed')](_0x38085e,_0x834e('0xf4'));break;default:ut[_0x834e('0xeb')](_0x38085e,0xc,_0x2247f7[_0x834e('0xea')]);rpcDb['createAgentHistory'](_0x38085e,_0x834e('0xf2'));}ut['updateOriginated'](_0x375fec,_0x834e('0xf5'));logger[_0x834e('0x55')](_0x834e('0xf6'),_0x38085e['uniqueid'],_0x834e('0xab'),_0x375fec[_0x834e('0x54')],'originated:\x20',_0x375fec['originated']);delete this[_0x834e('0x6a')][_0x38085e[_0x834e('0xaa')]];};Preview['prototype'][_0x834e('0xf7')]=function(_0x132edd,_0x4643d9,_0x135219,_0x170ec2,_0x5e6fff){var _0x4e7545=this;return new BPromise(function(_0x453e58,_0x5dd31e){if(_['isNil'](_0x4643d9)||_['isNil'](_0x4643d9[_0x834e('0xf8')])||_[_0x834e('0xf9')](_0x4643d9['Contact'][_0x834e('0xfa')])||_[_0x834e('0xf9')](_0x4643d9[_0x834e('0x73')])){_0x5dd31e(ut[_0x834e('0x49')]('Contact\x20is\x20undefined',_0x170ec2,_0x5e6fff));return;}var _0x1998ba=uuid['v4']();var _0x288eb1=_0x4e7545[_0x834e('0x15')][_0x4643d9['Queue'][_0x834e('0x54')]];var _0x5f3b7d=_0x135219?_0x4e7545[_0x834e('0x17')][_0x135219]['id']:undefined;_0x4e7545['actions'][_0x1998ba]=new Action(_0x4643d9,_0x288eb1,_0x1998ba,_0x135219,_0x5f3b7d);var _0x461420=_0x4e7545[_0x834e('0x6a')][_0x1998ba];_0x461420['unlockAgent']=_0x170ec2;_0x461420[_0x834e('0xc2')]=_0x5e6fff;_0x461420[_0x834e('0xfb')]=_0x135219;if(_[_0x834e('0xfc')](_0x132edd)){_0x4e7545[_0x834e('0xfd')](_0x461420,_0x288eb1,_0x4643d9,_0x135219)[_0x834e('0x80')](function(_0x24d77c){logger['info'](_0x834e('0xfe'),_0x834e('0xff')+_0x461420[_0x834e('0x6d')]+_0x834e('0x100')+_0x461420[_0x834e('0x101')],JSON[_0x834e('0x57')](_0x24d77c));ami['emit'](_0x834e('0x102'),ut['buildObj'](_0x461420,'called',_0x4e7545[_0x834e('0x15')][_0x461420['queue']]));_0x453e58(ut['message'](_0x834e('0x103')));})[_0x834e('0x76')](function(_0x257fed){ut[_0x834e('0x61')](_0x834e('0x104'),_0x257fed);_0x5dd31e(ut[_0x834e('0x49')](_0x834e('0x105'),_0x170ec2,_0x5e6fff));});}else{_0x288eb1[_0x834e('0x106')]+=0x1;ut[_0x834e('0x107')](_0x461420);rpcDb[_0x834e('0x108')](_0x461420,_0x834e('0x109'));delete _0x4e7545[_0x834e('0x6a')][_0x1998ba];_0x5dd31e(ut[_0x834e('0x49')](_0x834e('0x10a'),_0x170ec2,_0x5e6fff));}});};Preview['prototype'][_0x834e('0x98')]=function(_0x4874e1){return!_[_0x834e('0xf9')](_0x4874e1)&&!_[_0x834e('0xf9')](_0x4874e1[_0x834e('0x54')])&&!_[_0x834e('0xf9')](_0x4874e1['active'])&&_0x4874e1['active']&&!_[_0x834e('0xf9')](this[_0x834e('0x16')][util['format'](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])])&&!_['isNil'](this[_0x834e('0x16')][util[_0x834e('0x58')](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])]['status'])&&(this['trunks'][util['format']('SIP/%s',_0x4874e1[_0x834e('0x54')])][_0x834e('0x75')]==='reachable'||this[_0x834e('0x16')][util['format'](_0x834e('0x10b'),_0x4874e1[_0x834e('0x54')])][_0x834e('0x75')]===_0x834e('0x10c'));};Preview[_0x834e('0x10')][_0x834e('0x10d')]=function(_0x3c775f,_0x4fc61d){var _0x12a0f3=this;return new BPromise(function(_0x20d52f,_0x59ac23){_0x12a0f3[_0x834e('0x10e')](_0x3c775f,_0x4fc61d)[_0x834e('0x80')](function(_0x536f66){_0x20d52f(_['pick'](_0x536f66,['message']));})[_0x834e('0x76')](function(_0x19e17b){if(_0x19e17b[_0x834e('0x10f')]){rpcDb['unlockContact'](_0x3c775f);}if(_0x19e17b[_0x834e('0x110')]){rpcDb[_0x834e('0x88')](_0x3c775f);}_0x59ac23(_[_0x834e('0x70')](_0x19e17b,[_0x834e('0x49')]));});});};Preview[_0x834e('0x10')][_0x834e('0x10e')]=function(_0x19cb0b,_0x13af70){var _0x8804a8=this;return new BPromise(function(_0x102640,_0x48b6c4){var _0x5d6b66,_0x117e8f;rpcDb[_0x834e('0x111')](_0x19cb0b)[_0x834e('0x80')](function(_0x3eda93){if(!_[_0x834e('0xf9')](_0x3eda93[0x0])){_0x117e8f=_0x3eda93[0x0][_0x834e('0x112')]?![]:!![];_0x5d6b66=_0x3eda93[0x0][_0x834e('0x112')]?!![]:![];_0x5d6b66=_0x13af70?!![]:_0x5d6b66;}var _0x39210f=_0x8804a8[_0x834e('0x113')](_0x3eda93);if(_0x39210f[_0x834e('0x114')]){rpcDb[_0x834e('0x115')](_[_0x834e('0x70')](_0x3eda93[0x0],[_0x834e('0x73'),'Contact.phone']))[_0x834e('0x80')](function(_0x3b13be){_0x8804a8[_0x834e('0xf7')](_0x3b13be,_0x3eda93[0x0],_0x13af70,_0x117e8f,_0x5d6b66)[_0x834e('0x80')](function(_0x495697){_0x102640(_0x495697);})['catch'](function(_0x4e7c43){_0x48b6c4(_0x4e7c43);});})[_0x834e('0x76')](function(_0xf98fb4){ut[_0x834e('0x61')](_0x834e('0x116'),_0xf98fb4);_0x48b6c4(ut[_0x834e('0x49')](_0x834e('0x117'),_0x117e8f,_0x5d6b66));});}else{_0x48b6c4(ut[_0x834e('0x49')](_0x39210f[_0x834e('0x49')],_0x117e8f,_0x5d6b66));}})['catch'](function(_0x58ff66){ut['logger']('[Preview][getContactPreview]',_0x58ff66);_0x48b6c4(ut[_0x834e('0x49')](_0x834e('0x117'),![],!![]));});});};Preview[_0x834e('0x10')][_0x834e('0x113')]=function(_0x72f950){if(_[_0x834e('0xf9')](_0x72f950)||_[_0x834e('0xfc')](_0x72f950)||!_[_0x834e('0xf9')](_0x72f950[0x0][_0x834e('0x84')])&&_['isNil'](_0x72f950[0x0]['Agent']['name'])){ut['logger'](_0x834e('0x118'),_0x72f950);return{'isValid':![],'message':_0x834e('0x119')};}var _0x284183=this[_0x834e('0x15')][_0x72f950[0x0][_0x834e('0x6c')][_0x834e('0x54')]];_0x284183[_0x834e('0x49')]=_0x834e('0x9a');if(_[_0x834e('0xf9')](_0x284183)){ut[_0x834e('0x61')](_0x834e('0x11a'),_0x284183);return{'isValid':![],'message':_0x834e('0x11b')};}if(!this[_0x834e('0x98')](_0x284183[_0x834e('0x50')])){ut[_0x834e('0x61')](_0x834e('0x11c'),'campaign\x20Name:\x20'+_0x284183[_0x834e('0x54')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x834e('0x98')](_0x284183[_0x834e('0x99')])){ut[_0x834e('0x61')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x284183[_0x834e('0x54')]+_0x834e('0x11d'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x284183[_0x834e('0x66')])){ut[_0x834e('0x61')](_0x834e('0x11e'),_0x284183[_0x834e('0x54')]+_0x834e('0x11f'));return{'isValid':![],'message':_0x834e('0x120')+_0x284183[_0x834e('0x54')]+_0x834e('0x11f')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x834e('0x10')][_0x834e('0xfd')]=function(_0x375e40,_0x1d4947,_0x1912e6,_0x614e15){var _0x17aaae=this;return new BPromise(function(_0x58ebc8,_0x40a92a){var _0x59e298=_0x375e40['uniqueid'];var _0x1115b7=_0x17aaae[_0x834e('0x98')](_0x1d4947['Trunk'])?util[_0x834e('0x58')](_0x834e('0x121'),_0x1d4947['Trunk'][_0x834e('0x54')],_[_0x834e('0xf9')](_0x1d4947['dialPrefix'])?'':_0x1d4947['dialPrefix'][_0x834e('0x122')]()||'',_0x1d4947[_0x834e('0x123')]>0x0?_0x1912e6['Contact']['phone'][_0x834e('0x124')](_0x1d4947[_0x834e('0x123')]):_0x1912e6['Contact']['phone']):util['format']('SIP/%s/%s%s',_[_0x834e('0xf9')](_0x1d4947['TrunkBackup'])?_0x1d4947[_0x834e('0x50')]['name']:_0x1d4947[_0x834e('0x99')][_0x834e('0x54')],_[_0x834e('0xf9')](_0x1d4947[_0x834e('0x34')])?'':_0x1d4947['dialPrefix'][_0x834e('0x122')]()||'',_0x1d4947[_0x834e('0x123')]>0x0?_0x1912e6[_0x834e('0xf8')][_0x834e('0xfa')][_0x834e('0x124')](_0x1d4947[_0x834e('0x123')]):_0x1912e6[_0x834e('0xf8')][_0x834e('0xfa')]);var _0x464ae6=_0x17aaae[_0x834e('0x98')](_0x1d4947['Trunk'])?ut[_0x834e('0x125')](_0x1d4947['Trunk'][_0x834e('0x51')],_0x1d4947[_0x834e('0x31')],_0x1d4947[_0x834e('0x126')]>0x0?ut[_0x834e('0x127')](_0x1d4947[_0x834e('0x32')],_0x1d4947['dialRandomLastDigitCallerIdNumber']):_0x1d4947[_0x834e('0x32')]):ut['getCallerId'](_['isNil'](_0x1d4947[_0x834e('0x99')])?_0x1d4947[_0x834e('0x50')][_0x834e('0x51')]:_0x1d4947['TrunkBackup'][_0x834e('0x51')],_0x1d4947[_0x834e('0x31')],_0x1d4947[_0x834e('0x126')]>0x0?ut[_0x834e('0x127')](_0x1d4947[_0x834e('0x32')],_0x1d4947[_0x834e('0x126')]):_0x1d4947[_0x834e('0x32')]);if(_0x464ae6){_0x375e40[_0x834e('0x128')]=ut[_0x834e('0x129')](_0x464ae6);_0x375e40[_0x834e('0x12a')]=ut[_0x834e('0x12b')](_0x464ae6);}var _0x578204=ut[_0x834e('0x12c')](_0x1d4947,_0x1912e6,_0x1115b7,_0x464ae6,_0x59e298,_0x375e40);_[_0x834e('0x12d')](_0x375e40,ut[_0x834e('0x12e')](_0x578204));_0x375e40[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));ami['Action'](ut[_0x834e('0x12f')](_0x375e40,_0x1d4947,_0x578204,_0x375e40[_0x834e('0xc2')],_0x614e15))[_0x834e('0x80')](function(_0x37dea1){_0x1d4947[_0x834e('0x4a')]+=0x1;logger[_0x834e('0x55')](_0x834e('0x130'),_0x59e298,_0x834e('0xab'),_0x1d4947[_0x834e('0x54')],_0x834e('0x131'),_0x1d4947['originated']);_0x58ebc8(_0x37dea1);})['catch'](function(_0x5f339f){ut['logAgent'](_0x375e40,0xe,_0x834e('0x132'));rpcDb[_0x834e('0xed')](_0x375e40,_0x834e('0x133'));_0x40a92a(_0x5f339f);});});};Preview[_0x834e('0x10')][_0x834e('0x134')]=function(_0x1d53c6){if(this['actions'][_0x1d53c6[_0x834e('0xa6')]]){this['actions'][_0x1d53c6['linkedid']]['channel']=_0x1d53c6[_0x834e('0x135')];}};Preview[_0x834e('0x10')]['syncOriginateResponse']=function(_0x5cb379){var _0x494e08=this;var _0x2515f6=this[_0x834e('0x6a')][_0x5cb379[_0x834e('0x136')]];if(_0x2515f6){if(_0x2515f6['lookAgent']&&this[_0x834e('0x17')][_0x2515f6[_0x834e('0xfb')]]){ut[_0x834e('0x137')](_0x2515f6,this[_0x834e('0x17')][_0x2515f6[_0x834e('0xfb')]][_0x834e('0x54')],this['agents'][_0x2515f6['lookAgent']]['id']);}var _0x5c7fe3=_['clone'](_0x2515f6);_0x5c7fe3[_0x834e('0x138')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));var _0xfa95ad=_0x494e08[_0x834e('0x15')][_0x2515f6[_0x834e('0x6d')]];if(ut[_0x834e('0x139')](_0x5cb379[_0x834e('0x13a')])){if(_0x2515f6[_0x834e('0xa5')]){rpcDb[_0x834e('0x13b')](_0x2515f6[_0x834e('0x101')]);}if(_0x2515f6[_0x834e('0xc2')]){rpcDb[_0x834e('0x88')](_0x2515f6[_0x834e('0x101')]);}ami[_0x834e('0x9e')]('custom:agentringnoanswer',ut['buildObj'](_0x2515f6,_0x834e('0x13c'),this[_0x834e('0x15')][_0x2515f6[_0x834e('0x6d')]]));this['callProgressDetectingAgent'](_0x5c7fe3,_0xfa95ad,_0x5cb379);}else{_0x2515f6[_0x834e('0x89')]=moment()[_0x834e('0x58')](_0x834e('0x8a'));ut[_0x834e('0xeb')](_0x5c7fe3,0x4,_0x834e('0xb5'));rpcDb[_0x834e('0xed')](_0x5c7fe3,_0x834e('0x13d'));}}};Preview[_0x834e('0x10')][_0x834e('0x13e')]=function(_0x53850c){var _0x1785ca=this;var _0x2e0674=this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]];var _0x4b6834;if(_0x2e0674){_0x4b6834=this[_0x834e('0x15')][_0x2e0674[_0x834e('0x6d')]];logger[_0x834e('0x55')](_0x834e('0x13f'),_0x53850c[_0x834e('0xa6')],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834[_0x834e('0x2a')]);}if(this['actions'][_0x53850c[_0x834e('0xa6')]]&&_0x53850c['linkedid']!==_0x53850c[_0x834e('0xaa')]){if(_0x53850c['cause']==='16'&&this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]][_0x834e('0x6f')]){this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c['cause']);}else if(this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]]['dialAnswer']){logger['info'](_0x834e('0x141'),_0x53850c['linkedid'],_0x53850c['cause'],'\x20Queue',_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834[_0x834e('0x2a')]);this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}}else if(_0x2e0674&&_[_0x834e('0xf9')](_0x2e0674['statedesc'])&&_0x4b6834[_0x834e('0x143')]&&_0x53850c[_0x834e('0xa6')]===_0x53850c['uniqueid']&&_['isNil'](_0x53850c[_0x834e('0xea')])&&_0x53850c[_0x834e('0x142')]==='16'&&_0x53850c['channelstate']==='6'&&_['isUndefined'](_0x2e0674[_0x834e('0x144')])){if(_0x2e0674[_0x834e('0xa5')]){rpcDb[_0x834e('0x13b')](_0x2e0674['idContact']);}if(_0x2e0674[_0x834e('0xc2')]){rpcDb[_0x834e('0x88')](_0x2e0674[_0x834e('0x101')]);}_0x53850c['reason']='22';this[_0x834e('0xe7')](_0x2e0674,_0x4b6834,_0x53850c);}else if(_0x2e0674&&_0x2e0674['transfer']){if(_0x53850c[_0x834e('0x142')]==='16'&&this[_0x834e('0x6a')][_0x53850c[_0x834e('0xa6')]][_0x834e('0x6f')]){logger[_0x834e('0x55')]('[syncHangup][talking][transfer]',_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],_0x834e('0x6e'),_0x4b6834['pTalking']);this['callProgressDetectingCustomer'](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}else if(this[_0x834e('0x6a')][_0x53850c['linkedid']][_0x834e('0x6f')]){logger[_0x834e('0x55')](_0x834e('0x141'),_0x53850c[_0x834e('0xa6')],_0x53850c['cause'],_0x834e('0xab'),_0x4b6834[_0x834e('0x54')],'pTalking:\x20',_0x4b6834[_0x834e('0x2a')]);this[_0x834e('0x140')](_0x53850c,_0x53850c[_0x834e('0xa6')],_0x53850c[_0x834e('0x142')]);}}};Preview['prototype'][_0x834e('0x1d')]=function(_0x52a673){if(this[_0x834e('0x6a')][_0x52a673[_0x834e('0xe6')]]&&_0x52a673[_0x834e('0xe6')]!==_0x52a673[_0x834e('0x145')]){this[_0x834e('0x140')](_0x52a673,_0x52a673[_0x834e('0xe6')],_0x52a673['dialstatus']);}};Preview['prototype'][_0x834e('0x1c')]=function(_0x3f2c59){if(this['actions'][_0x3f2c59[_0x834e('0xa6')]]&&_0x3f2c59['linkedid']!==_0x3f2c59[_0x834e('0xaa')]&&!this[_0x834e('0x6a')][_0x3f2c59[_0x834e('0xa6')]][_0x834e('0x6f')]){if(_0x3f2c59[_0x834e('0x142')]==='1'){this[_0x834e('0x140')](_0x3f2c59,_0x3f2c59[_0x834e('0xa6')],_0x3f2c59['cause']);}}};Preview[_0x834e('0x10')][_0x834e('0x146')]=function(_0x2a6bca,_0x223d48,_0x1c03bc){if(this['actions'][_0x2a6bca]){if(_[_0x834e('0xf9')](this[_0x834e('0x6a')][_0x2a6bca][_0x834e('0x147')])){this['actions'][_0x2a6bca]['variables']={};}this['actions'][_0x2a6bca][_0x834e('0x147')][_0x223d48]=_0x1c03bc;}};Preview[_0x834e('0x10')][_0x834e('0x20')]=function(_0xd6f2cc){try{if(!_[_0x834e('0xf9')](_0xd6f2cc)){if(ut[_0x834e('0x148')](_[_0x834e('0x149')](_0xd6f2cc[_0x834e('0x14a')])[0x0])){this[_0x834e('0x146')](_0xd6f2cc[_0x834e('0xaa')],_[_0x834e('0x149')](_0xd6f2cc['variable'])[0x0],_0xd6f2cc[_0x834e('0x14b')]);}}}catch(_0x3552b1){logger[_0x834e('0x14c')](_0x834e('0x14d'),util[_0x834e('0x14e')](_0x3552b1,{'showHidden':![],'depth':null}));}};Preview[_0x834e('0x10')][_0x834e('0x22')]=function(_0xa4bb26){if(_0xa4bb26){if(this['actions'][_0xa4bb26[_0x834e('0x14f')]]){this[_0x834e('0x6a')][_0xa4bb26['transfertargetlinkedid']][_0x834e('0x144')]=!![];}}};Preview[_0x834e('0x10')][_0x834e('0x23')]=function(_0x3fba1d){if(_0x3fba1d){if(this['actions'][_0x3fba1d['transfererlinkedid']]){this[_0x834e('0x6a')][_0x3fba1d['transfererlinkedid']][_0x834e('0x144')]=!![];}}};module[_0x834e('0x150')]=Preview; \ No newline at end of file +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(_0x5eaa8a,_0x396d27){var _0x558bc8=function(_0x38e99d){while(--_0x38e99d){_0x5eaa8a['push'](_0x5eaa8a['shift']());}};_0x558bc8(++_0x396d27);}(_0xe706,0xa3));var _0x6e70=function(_0x39c545,_0x4a7b5c){_0x39c545=_0x39c545-0x0;var _0x2ceed9=_0xe706[_0x39c545];return _0x2ceed9;};'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 diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index d98983c..2db5e4e 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 _0xeec6=['getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','inspect','resolve','then','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20'];(function(_0xfd949d,_0x4e7e33){var _0x117fb6=function(_0x52e343){while(--_0x52e343){_0xfd949d['push'](_0xfd949d['shift']());}};_0x117fb6(++_0x4e7e33);}(_0xeec6,0x1c2));var _0x6eec=function(_0x56418e,_0x362812){_0x56418e=_0x56418e-0x0;var _0x5b160c=_0xeec6[_0x56418e];return _0x5b160c;};'use strict';var util=require(_0x6eec('0x0'));var BPromise=require(_0x6eec('0x1'));var logger=require(_0x6eec('0x2'))(_0x6eec('0x3'));var _=require('lodash');var cmHopper=require(_0x6eec('0x4'));var cmHopperFinal=require(_0x6eec('0x5'));var cmHopperHistory=require(_0x6eec('0x6'));var cmHopperBlack=require(_0x6eec('0x7'));var voiceQueueRt=require(_0x6eec('0x8'));var agentReportPreview=require(_0x6eec('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x185f31){return function(_0x3c6eda){logger['error'](_0x185f31,util[_0x6eec('0xa')](_0x3c6eda,{'showHidden':![],'depth':null}));};}function create(_0x1c810e){return BPromise[_0x6eec('0xb')]()[_0x6eec('0xc')](cmHopperHistory['createHistory'](_0x1c810e))[_0x6eec('0xd')](loggerCatch(_0x6eec('0xe')));}function createAgent(_0x1c774d){return BPromise['resolve']()['then'](agentReportPreview['createHistory'](_0x1c774d))[_0x6eec('0xd')](loggerCatch(_0x6eec('0xe')));}function moveContact(_0x51a9e3){return BPromise['resolve']()[_0x6eec('0xc')](cmHopper['moveContactManagedDialer'](_0x51a9e3,!![]))[_0x6eec('0xd')](loggerCatch(_0x6eec('0xf')));}exports[_0x6eec('0x10')]=function(_0x3fe94b){return BPromise[_0x6eec('0xb')]()['then'](cmHopperBlack[_0x6eec('0x10')](_0x3fe94b))[_0x6eec('0xd')](loggerCatch(_0x6eec('0x11')));};exports[_0x6eec('0x12')]=function(_0x3d653b){return BPromise[_0x6eec('0xb')]()[_0x6eec('0xc')](cmHopper[_0x6eec('0x12')](_0x3d653b))[_0x6eec('0xd')](loggerCatch(_0x6eec('0x13')));};exports['createHistory']=function(_0x3c0c1b,_0x5f1f33){create(_0x3c0c1b)[_0x6eec('0xd')](loggerCatch(_0x5f1f33));moveContact(_0x3c0c1b)[_0x6eec('0xd')](loggerCatch(_0x5f1f33));};exports['createAgentHistory']=function(_0x3ee353,_0x80736b){createAgent(_0x3ee353)[_0x6eec('0xd')](loggerCatch(_0x80736b));};exports['createCustomerHistory']=function(_0x87f3be,_0x1ed94c){create(_0x87f3be)[_0x6eec('0xd')](loggerCatch(_0x1ed94c));};exports[_0x6eec('0x14')]=function(_0xd86135,_0x1761f4){moveContact(_0xd86135)['catch'](loggerCatch(_0x1761f4));};exports[_0x6eec('0x15')]=function(_0x2f843e,_0x132652,_0x34522a){if(_0x132652){_0x2f843e[_0x6eec('0x16')]=null;}if(_0x34522a){_0x2f843e[_0x6eec('0x17')]=![];}return BPromise['resolve']()[_0x6eec('0xc')](cmHopper[_0x6eec('0x15')](_0x2f843e))[_0x6eec('0xd')](loggerCatch(_0x6eec('0x18')));};exports[_0x6eec('0x19')]=function(_0x13863c){return BPromise['resolve']()[_0x6eec('0xc')](cmHopper[_0x6eec('0x19')](_0x13863c))[_0x6eec('0xd')](loggerCatch(_0x6eec('0x1a')));};exports[_0x6eec('0x1b')]=function(_0x1f386c){return BPromise[_0x6eec('0xb')]()[_0x6eec('0xc')](cmHopper[_0x6eec('0x1b')]({'UserId':null},_0x1f386c,0x1))['catch'](loggerCatch(_0x6eec('0x1c')));};exports[_0x6eec('0x1d')]=function(_0x30eb98){return BPromise[_0x6eec('0xb')]()['then'](cmHopper[_0x6eec('0x1b')]({'active':![]},_0x30eb98,0x1))[_0x6eec('0xd')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x3240c3){var _0x47ed95={};_0x47ed95[_0x6eec('0x1e')]=_0x3240c3[_0x6eec('0x1e')];_0x47ed95[_0x6eec('0x1f')]=_0x3240c3[_0x6eec('0x1f')];_0x47ed95[_0x6eec('0x20')]=_0x3240c3[_0x6eec('0x20')];_0x47ed95[_0x6eec('0x21')]=_0x3240c3[_0x6eec('0x21')];_0x47ed95[_0x6eec('0x22')]=_0x3240c3[_0x6eec('0x22')];_0x47ed95['queuecallerjoinAt']=_0x3240c3[_0x6eec('0x23')];_0x47ed95['queuecallerleaveAt']=_0x3240c3[_0x6eec('0x23')];_0x47ed95[_0x6eec('0x24')]=0x1;_0x47ed95[_0x6eec('0x25')]=_0x3240c3['endtime'];_0x47ed95['connectedlinename']=_0x3240c3['membername'];_0x47ed95[_0x6eec('0x26')]=_0x6eec('0x27');_0x47ed95[_0x6eec('0x28')]=_0x6eec('0x29');_0x47ed95[_0x6eec('0x2a')]=0x0;_0x47ed95[_0x6eec('0x2b')]=0x1;_0x47ed95[_0x6eec('0x2c')]=_0x3240c3[_0x6eec('0x2d')];_0x47ed95[_0x6eec('0x2e')]=_0x6eec('0x2f');return BPromise[_0x6eec('0xb')]()[_0x6eec('0xc')](voiceQueueReport['create'](_0x47ed95))[_0x6eec('0xd')](loggerCatch(_0x6eec('0x30')));};exports[_0x6eec('0x31')]=function(_0x47e169,_0x2ce8c3){return BPromise[_0x6eec('0xb')]()[_0x6eec('0xc')](cmHopper[_0x6eec('0x31')](_0x47e169,_0x2ce8c3))[_0x6eec('0xd')](loggerCatch(_0x6eec('0x32')));};exports['rescheduleContactInQueue']=function(_0x45cfb6){return BPromise[_0x6eec('0xb')]()[_0x6eec('0xc')](cmHopper['rescheduleContact'](_0x45cfb6,!![],!![]))['catch'](loggerCatch(_0x6eec('0x33')));}; \ No newline at end of file +var _0x8958=['catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','then','createHistory'];(function(_0x1af979,_0xb13052){var _0x538ec3=function(_0xd77ea4){while(--_0xd77ea4){_0x1af979['push'](_0x1af979['shift']());}};_0x538ec3(++_0xb13052);}(_0x8958,0x93));var _0x8895=function(_0x583456,_0x10f8cc){_0x583456=_0x583456-0x0;var _0x542be5=_0x8958[_0x583456];return _0x542be5;};'use strict';var util=require('util');var BPromise=require(_0x8895('0x0'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x8895('0x1'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x8895('0x2'));var voiceQueueRt=require(_0x8895('0x3'));var agentReportPreview=require(_0x8895('0x4'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x22fa52){return function(_0x2f03ad){logger[_0x8895('0x5')](_0x22fa52,util[_0x8895('0x6')](_0x2f03ad,{'showHidden':![],'depth':null}));};}function create(_0x33013a){return BPromise['resolve']()[_0x8895('0x7')](cmHopperHistory[_0x8895('0x8')](_0x33013a))[_0x8895('0x9')](loggerCatch(_0x8895('0xa')));}function createAgent(_0x6eab1e){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](agentReportPreview[_0x8895('0x8')](_0x6eab1e))[_0x8895('0x9')](loggerCatch(_0x8895('0xa')));}function moveContact(_0x4d1358){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopper[_0x8895('0xc')](_0x4d1358,!![]))[_0x8895('0x9')](loggerCatch(_0x8895('0xd')));}exports[_0x8895('0xe')]=function(_0x5af0ef){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopperBlack[_0x8895('0xe')](_0x5af0ef))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x8895('0xf')]=function(_0x4e8f53){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopper[_0x8895('0xf')](_0x4e8f53))[_0x8895('0x9')](loggerCatch(_0x8895('0x10')));};exports['createHistory']=function(_0x4128e2,_0x100fc8){create(_0x4128e2)[_0x8895('0x9')](loggerCatch(_0x100fc8));moveContact(_0x4128e2)[_0x8895('0x9')](loggerCatch(_0x100fc8));};exports[_0x8895('0x11')]=function(_0x1b5c82,_0x304be6){createAgent(_0x1b5c82)[_0x8895('0x9')](loggerCatch(_0x304be6));};exports[_0x8895('0x12')]=function(_0x2da618,_0x24fef0){create(_0x2da618)[_0x8895('0x9')](loggerCatch(_0x24fef0));};exports[_0x8895('0x13')]=function(_0x54e6d4,_0x522a4e){moveContact(_0x54e6d4)['catch'](loggerCatch(_0x522a4e));};exports[_0x8895('0x14')]=function(_0x456282,_0x2d189c,_0x29449a){if(_0x2d189c){_0x456282[_0x8895('0x15')]=null;}if(_0x29449a){_0x456282[_0x8895('0x16')]=![];}return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopper['rescheduleContact'](_0x456282))[_0x8895('0x9')](loggerCatch(_0x8895('0x17')));};exports[_0x8895('0x18')]=function(_0x1f71f3){return BPromise[_0x8895('0xb')]()['then'](cmHopper['countReScheduled'](_0x1f71f3))[_0x8895('0x9')](loggerCatch(_0x8895('0x19')));};exports[_0x8895('0x1a')]=function(_0x24a376){return BPromise['resolve']()[_0x8895('0x7')](cmHopper[_0x8895('0x1a')]({'UserId':null},_0x24a376,0x1))[_0x8895('0x9')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x78b57){return BPromise['resolve']()[_0x8895('0x7')](cmHopper[_0x8895('0x1a')]({'active':![]},_0x78b57,0x1))[_0x8895('0x9')](loggerCatch(_0x8895('0x1b')));};exports[_0x8895('0x1c')]=function(_0x5c03ea){var _0x4d567a={};_0x4d567a[_0x8895('0x1d')]=_0x5c03ea[_0x8895('0x1d')];_0x4d567a[_0x8895('0x1e')]=_0x5c03ea[_0x8895('0x1e')];_0x4d567a[_0x8895('0x1f')]=_0x5c03ea['calleridnum'];_0x4d567a['calleridname']=_0x5c03ea[_0x8895('0x20')];_0x4d567a[_0x8895('0x21')]=_0x5c03ea[_0x8895('0x21')];_0x4d567a[_0x8895('0x22')]=_0x5c03ea[_0x8895('0x23')];_0x4d567a['queuecallerleaveAt']=_0x5c03ea[_0x8895('0x23')];_0x4d567a['queuecallercomplete']=0x1;_0x4d567a[_0x8895('0x24')]=_0x5c03ea['endtime'];_0x4d567a[_0x8895('0x25')]=_0x5c03ea[_0x8895('0x26')];_0x4d567a[_0x8895('0x27')]=_0x8895('0x28');_0x4d567a[_0x8895('0x29')]='xcally-motion-preview';_0x4d567a[_0x8895('0x2a')]=0x0;_0x4d567a[_0x8895('0x2b')]=0x1;_0x4d567a[_0x8895('0x2c')]=_0x5c03ea[_0x8895('0x26')];_0x4d567a[_0x8895('0x2d')]='COMPLETED';return BPromise[_0x8895('0xb')]()['then'](voiceQueueReport[_0x8895('0x2e')](_0x4d567a))['catch'](loggerCatch(_0x8895('0x2f')));};exports[_0x8895('0x30')]=function(_0x20907a,_0x418e53){return BPromise[_0x8895('0xb')]()['then'](cmHopper[_0x8895('0x30')](_0x20907a,_0x418e53))['catch'](loggerCatch(_0x8895('0x31')));};exports[_0x8895('0x32')]=function(_0x36e13b){return BPromise[_0x8895('0xb')]()[_0x8895('0x7')](cmHopper[_0x8895('0x14')](_0x36e13b,!![],!![]))['catch'](loggerCatch(_0x8895('0x33')));}; \ 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 2c68b7b..ba4b478 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 _0x3a6a=['random','match','extractCalleridNumber','util','lodash','moment','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','logLookAgent','membername','UserId','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','Global','active','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','mandatoryDisposition','buildAcw','queue','interface','agentReadyId','not_inuse','reachable','push','getDiff','createBody','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','getCallerIdRandom','\x5cw{0,','pow'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x3a6a,0x10d));var _0xa3a6=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x3a6a[_0x365e54];return _0x13317a;};'use strict';var util=require(_0xa3a6('0x0'));var _=require(_0xa3a6('0x1'));var moment=require(_0xa3a6('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xa3a6('0x3')][_0xa3a6('0x4')]||_0xa3a6('0x5');function getSeconds(_0x4a79f6,_0x2210f4){var _0x47fde1=moment(_0x4a79f6)[_0xa3a6('0x6')](0x0);var _0x45d200=moment(_0x2210f4)['milliseconds'](0x0);return _0x47fde1[_0xa3a6('0x7')](_0x45d200,'seconds');}exports['loggerCatch']=function(_0x56b9a6){return function(_0x1740d6){logger[_0xa3a6('0x8')](_0x56b9a6,util[_0xa3a6('0x9')](_0x1740d6,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x32fb18,_0x38dedb){logger[_0xa3a6('0xa')](_0x32fb18,util['inspect'](_0x38dedb,{'showHidden':![],'depth':null}));};exports[_0xa3a6('0xb')]=function(_0x7f8c7b,_0x17a043){logger['error'](_0x7f8c7b,util[_0xa3a6('0x9')](_0x17a043,{'showHidden':![],'depth':null}));};exports[_0xa3a6('0xc')]=function(_0x1ba0ad){return function(_0xde43dd){logger[_0xa3a6('0xa')](_0x1ba0ad,util['inspect'](_0xde43dd,{'showHidden':![],'depth':null}));};};exports[_0xa3a6('0xd')]=function(_0x30b03f,_0x1a8bbc,_0x50eba0){return{'message':_0x30b03f,'unlock':_0x1a8bbc,'active':_0x50eba0};};exports[_0xa3a6('0xe')]=function(_0x44bf14,_0x3efd60,_0x573e98){if(!_[_0xa3a6('0xf')](_0x573e98)&&_0xa3a6('0x10')===typeof _0x573e98&&!_[_0xa3a6('0x11')](_0x573e98)){if(!_[_0xa3a6('0xf')](_0x3efd60)&&_0xa3a6('0x10')===typeof _0x3efd60&&!_[_0xa3a6('0x11')](_0x3efd60)){return util['format'](_0xa3a6('0x12'),_0x3efd60,_0x573e98);}return util[_0xa3a6('0x13')](_0xa3a6('0x12'),_0x573e98,_0x573e98);}if(!_[_0xa3a6('0xf')](_0x44bf14)&&_0xa3a6('0x10')===typeof _0x44bf14&&!_['isEmpty'](_0x44bf14)){return _0x44bf14;}return'\x22\x22\x20<>';};exports[_0xa3a6('0x14')]=function(_0x86df0){if(_[_0xa3a6('0x15')](_0x86df0)){return![];}return _0x86df0;};exports[_0xa3a6('0x16')]=function(_0x4d3dcf,_0x51f2ce,_0x469723,_0x29426f,_0x474388,_0x8128){var _0x344e67={'XMD-QUEUE':_0x51f2ce[_0xa3a6('0x17')]?_0x51f2ce[_0xa3a6('0x17')][_0xa3a6('0x18')]:'','XMD-CALLERID':_0x29426f,'XMD-CALLERID-PREVIEW':_0x8128?util[_0xa3a6('0x13')]('\x22%s\x22\x20<%s>',_0x8128[_0xa3a6('0x19')],_0x8128[_0xa3a6('0x1a')]):_0x29426f,'XMD-DIALID':_0x474388,'XMD-CONTACTID':_0x51f2ce[_0xa3a6('0x1b')],'XMD-CDRTYPE':_0xa3a6('0x1c'),'CALLERID(all)':_0x29426f,'XMD-VOICEQUEUEID':_0x51f2ce['VoiceQueueId'],'XMD-DIALCHANNEL':_0x469723,'XMD-DIALTIMEOUT':_0x4d3dcf[_0xa3a6('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xa3a6('0x13')](_0xa3a6('0x1e'),_0x4d3dcf[_0xa3a6('0x1f')]?'g':'',_[_0xa3a6('0x11')](_0x4d3dcf[_0xa3a6('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4d3dcf['dialPreviewUrl']||'','XMD-AGI':_0x4d3dcf['dialQueueProject']?util[_0xa3a6('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4d3dcf[_0xa3a6('0x21')]):_0xa3a6('0x22'),'XMD-AGIAFTER':_0x4d3dcf[_0xa3a6('0x1f')]?util['format'](_0xa3a6('0x23'),ipAgi,_0x4d3dcf[_0xa3a6('0x1f')]):_0xa3a6('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x8128?_0x8128[_0xa3a6('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x8128?_0x8128[_0xa3a6('0x25')]:'','XMD-DESTINATION':_0xa3a6('0x26')};if(!_['isEmpty'](_0x4d3dcf['monitor_format'])){_0x344e67[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x4d3dcf['monitor_format'];_0x344e67[util[_0xa3a6('0x13')]('%s',_0xa3a6('0x27'))]=_0x474388;}if(_0x51f2ce&&_0x51f2ce[_0xa3a6('0x28')]){for(var _0xa60a7e in _0x51f2ce[_0xa3a6('0x28')]){if(_0x51f2ce['Contact'][_0xa3a6('0x29')](_0xa60a7e)){if(!_[_0xa3a6('0x15')](_0x51f2ce['Contact'][_0xa60a7e])&&_0xa60a7e!=='id'&&_0xa60a7e!=='tags'&&_0xa60a7e!==_0xa3a6('0x2a')&&_0xa60a7e!==_0xa3a6('0x2b')){_0x344e67[util[_0xa3a6('0x13')](_0xa3a6('0x2c'),_0xa3a6('0x2d'),_[_0xa3a6('0x2e')](_0xa60a7e))]=_0x51f2ce[_0xa3a6('0x28')][_0xa60a7e];}}}}return _0x344e67;};exports[_0xa3a6('0x2f')]=function(_0x4fe989){var _0xe0c890={};for(var _0xdc107e in _0x4fe989){if(_0x4fe989['hasOwnProperty'](_0xdc107e)){_0xe0c890[util[_0xa3a6('0x13')]('%s',_[_0xa3a6('0x30')](_0xdc107e))]=_0x4fe989[_0xdc107e];}}return{'variables':_0xe0c890};};exports[_0xa3a6('0x31')]=function(_0x427834,_0x56a765){if(!_[_0xa3a6('0x15')](_0x427834)){if(_0x427834[_0xa3a6('0x29')](_0xa3a6('0x32'))){if(_0x427834[_0xa3a6('0x32')]>0x0){_0x427834[_0xa3a6('0x32')]-=0x1;}else{logger[_0xa3a6('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x56a765);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x56a765);}};exports[_0xa3a6('0x33')]=function(_0x168f08){var _0x380790=moment()[_0xa3a6('0x13')](_0xa3a6('0x34'));_0x168f08[_0xa3a6('0x35')]=0xd;_0x168f08[_0xa3a6('0x36')]=_0xa3a6('0x37');_0x168f08[_0xa3a6('0x38')]=_0x380790;_0x168f08[_0xa3a6('0x39')]=_0x380790;_0x168f08[_0xa3a6('0x3a')]=_0x380790;};exports[_0xa3a6('0x3b')]=function(_0x562afb,_0x3becd4,_0x44476b){var _0x178a51=moment()[_0xa3a6('0x13')](_0xa3a6('0x34'));_0x562afb[_0xa3a6('0x35')]=_0x3becd4;_0x562afb[_0xa3a6('0x36')]=_0x44476b;_0x562afb[_0xa3a6('0x39')]=_0x178a51;_0x562afb['ringtime']=getSeconds(_0x562afb[_0xa3a6('0x39')],_0x562afb[_0xa3a6('0x38')]);};exports[_0xa3a6('0x3c')]=function(_0x1ea217,_0x2be35c,_0x25ac6d){_0x1ea217[_0xa3a6('0x3d')]=_0x2be35c;_0x1ea217[_0xa3a6('0x3e')]=_0x25ac6d;};exports['logCustomer']=function(_0x560a26,_0x3fd7b3,_0x1c90cd){var _0x2486f0=moment()[_0xa3a6('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x560a26[_0xa3a6('0x35')]=_0x3fd7b3;_0x560a26[_0xa3a6('0x36')]=_0x1c90cd;_0x560a26[_0xa3a6('0x39')]=_0x560a26[_0xa3a6('0x39')]?_0x560a26[_0xa3a6('0x39')]:_0x2486f0;_0x560a26[_0xa3a6('0x3a')]=_0x560a26[_0xa3a6('0x3a')]?_0x560a26[_0xa3a6('0x3a')]:_0x2486f0;_0x560a26[_0xa3a6('0x3f')]=getSeconds(_0x560a26[_0xa3a6('0x39')]||0x0,_0x560a26['starttime']||0x0);_0x560a26[_0xa3a6('0x40')]=_0x560a26['answertime']?getSeconds(_0x560a26[_0xa3a6('0x3a')],_0x560a26[_0xa3a6('0x41')]):0x0;};exports[_0xa3a6('0x42')]=function(_0x477a61){return _0x477a61===_0xa3a6('0x43');};exports[_0xa3a6('0x44')]=function(_0x6ad0f6,_0x246574,_0x27b6a,_0x11d601,_0x474df9){var _0x2a364d=_0x11d601?_0xa3a6('0x45'):_0x6ad0f6[_0xa3a6('0x19')];_0x2a364d=_0x474df9?'BOOKED':_0x2a364d;return{'actionid':_0x6ad0f6[_0xa3a6('0x46')],'action':'originate','channel':_0x6ad0f6[_0xa3a6('0x47')],'callerid':util[_0xa3a6('0x13')](_0xa3a6('0x12'),_0x2a364d,_0x6ad0f6['calleridnum']),'Exten':_0xa3a6('0x26'),'Context':_0xa3a6('0x48'),'Priority':'1','variable':_0x27b6a,'timeout':(_0x246574[_0xa3a6('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x6ad0f6[_0xa3a6('0x46')]};};exports[_0xa3a6('0x4a')]=function(_0x17ec47){return _0x17ec47[_0xa3a6('0x4b')]+_0x17ec47[_0xa3a6('0x4c')]+_0x17ec47[_0xa3a6('0x4d')]+_0x17ec47['countagentrejectretry']+_0x17ec47[_0xa3a6('0x4e')];};exports[_0xa3a6('0x4f')]=function(_0x254500){var _0x13eeb8=_['clone'](_0x254500);_0x13eeb8[_0xa3a6('0x35')]=0xf;_0x13eeb8['statedesc']=_0xa3a6('0x50');return _0x13eeb8;};exports['scheduledAt']=function(_0x13c4f8,_0x59e236,_0x2e46f3){var _0x535a0a={};_0x535a0a[_0x59e236]=_0x13c4f8[_0x59e236];_0x535a0a[_0xa3a6('0x51')]=![];_0x535a0a['scheduledat']=moment()[_0xa3a6('0x52')](_0x2e46f3,_0xa3a6('0x53'))[_0xa3a6('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x535a0a[_0xa3a6('0x1b')]=_0x13c4f8[_0xa3a6('0x1b')];_0x535a0a[_0xa3a6('0x54')]=_0x13c4f8[_0xa3a6('0x54')];_0x535a0a[_0xa3a6('0x55')]=_0x13c4f8['VoiceQueueId']||undefined;return _0x535a0a;};exports[_0xa3a6('0x56')]=function(_0x2ce995,_0x599dbc){if(!_[_0xa3a6('0x15')](_0x2ce995)){if(_0x2ce995[_0xa3a6('0x57')]>0x0){_0x2ce995[_0xa3a6('0x57')]-=0x1;}else{logger[_0xa3a6('0x8')](_0x599dbc,_0xa3a6('0x58'));}}else{logger[_0xa3a6('0x8')](_0x599dbc,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xa3a6('0x59')]=function(_0x449016){if(_0x449016<=0x0){return!![];}return![];};exports[_0xa3a6('0x5a')]=function(_0x31af4a,_0x439193,_0x24fb69){_0x31af4a[_0xa3a6('0x5b')]=_0x439193;_0x31af4a[_0xa3a6('0x18')]=_0x31af4a['queue'];_0x31af4a['interface']=_0x31af4a[_0xa3a6('0x47')];if(_0x24fb69){_0x31af4a[_0xa3a6('0x5c')]=_0x24fb69[_0xa3a6('0x5c')];}return _0x31af4a;};exports[_0xa3a6('0x5d')]=function(_0x59b332){var _0x39d8c1={};_0x39d8c1[_0xa3a6('0x5e')]=_0x59b332[_0xa3a6('0x5e')];_0x39d8c1[_0xa3a6('0x5f')]=_0x59b332[_0xa3a6('0x47')];_0x39d8c1[_0xa3a6('0x46')]=_0x59b332[_0xa3a6('0x46')];return _0x39d8c1;};exports[_0xa3a6('0x60')]=function(_0x592430){var _0x1c7145=[];for(var _0x50a755 in _0x592430){if(_0x592430[_0xa3a6('0x29')](_0x50a755)){if(!_[_0xa3a6('0x15')](_0x592430[_0x50a755])&&_0x592430[_0x50a755][_0xa3a6('0x35')]===_0xa3a6('0x61')&&_0x592430[_0x50a755]['status']===_0xa3a6('0x62')){_0x1c7145[_0xa3a6('0x63')](_0x592430[_0x50a755]['id']);}}}return _0x1c7145;};exports[_0xa3a6('0x64')]=function(_0x2e1090){var _0x20b54c=moment()['milliseconds'](0x0);var _0xc05243=moment(_0x2e1090)[_0xa3a6('0x6')](0x0);return _0x20b54c['diff'](_0xc05243,'seconds');};exports[_0xa3a6('0x65')]=function(_0x488f84){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x488f84[_0xa3a6('0x1b')],'ListId':_0x488f84[_0xa3a6('0x54')],'VoiceQueueId':_0x488f84[_0xa3a6('0x55')]||undefined,'CampaignId':_0x488f84['CampaignId']||undefined};};exports['filterKey']=function(_0x31119a){if(_0x31119a===_0xa3a6('0x46')||_0x31119a==='idContact'||_0x31119a==='queue'||_0x31119a==='type'||_0x31119a==='campaigntype'||_0x31119a===_0xa3a6('0x66')||_0x31119a===_0xa3a6('0x3d')||_0x31119a==='channelAgent'||_0x31119a===_0xa3a6('0x19')||_0x31119a===_0xa3a6('0x51')||_0x31119a===_0xa3a6('0x1a')||_0x31119a===_0xa3a6('0x67')||_0x31119a===_0xa3a6('0x4b')||_0x31119a===_0xa3a6('0x4c')||_0x31119a===_0xa3a6('0x4d')||_0x31119a===_0xa3a6('0x68')||_0x31119a===_0xa3a6('0x69')||_0x31119a===_0xa3a6('0x6a')||_0x31119a===_0xa3a6('0x6b')||_0x31119a===_0xa3a6('0x6c')||_0x31119a===_0xa3a6('0x1b')||_0x31119a===_0xa3a6('0x54')||_0x31119a===_0xa3a6('0x3e')||_0x31119a===_0xa3a6('0x55')||_0x31119a===_0xa3a6('0x6d')||_0x31119a==='xmd-voicequeueid'||_0x31119a==='xmd-queue'||_0x31119a===_0xa3a6('0x6e')||_0x31119a==='xmd-listid'||_0x31119a===_0xa3a6('0x6f')||_0x31119a===_0xa3a6('0x70')||_0x31119a===_0xa3a6('0x71')||_0x31119a===_0xa3a6('0x72')||_0x31119a===_0xa3a6('0x73')||_0x31119a===_0xa3a6('0x74')||_0x31119a===_0xa3a6('0x75')||_0x31119a===_0xa3a6('0x76')||_0x31119a===_0xa3a6('0x77')||_0x31119a==='xmd-agi'||_0x31119a==='rtpaudioqos'||_0x31119a===_0xa3a6('0x78')||_0x31119a===_0xa3a6('0x79')||_0x31119a==='rtpaudioqosjitterbridged'||_0x31119a===_0xa3a6('0x7a')||_0x31119a==='rtpaudioqoslossbridged'||_0x31119a==='rtpaudioqosrtt'||_0x31119a===_0xa3a6('0x7b')||_0x31119a==='rtpaudioqos'||_0x31119a===_0xa3a6('0x78')||_0x31119a===_0xa3a6('0x79')||_0x31119a===_0xa3a6('0x7c')||_0x31119a===_0xa3a6('0x7a')||_0x31119a===_0xa3a6('0x7d')||_0x31119a===_0xa3a6('0x7e')||_0x31119a==='rtpaudioqosrttbridged'||_0x31119a==='bridgepeer'||_0x31119a==='bridgepvtcallid'||_0x31119a===_0xa3a6('0x35')||_0x31119a===_0xa3a6('0x36')){return![];}return!![];};exports[_0xa3a6('0x7f')]=function(_0x4506fa,_0x55c208){var _0x2eaea7,_0x32aa5f,_0x42ba84;if(_0x55c208<=0x0){_0x55c208=0x1;}_0x2eaea7=new RegExp(_0xa3a6('0x80')+_0x55c208+'}$');_0x32aa5f=Math[_0xa3a6('0x81')](0xa,_0x55c208-0x1);_0x42ba84=Math[_0xa3a6('0x81')](0xa,_0x55c208)-0x1;return util[_0xa3a6('0x13')]('%s',_['replace'](_0x4506fa,_0x2eaea7,_[_0xa3a6('0x82')](_0x32aa5f,_0x42ba84)));};exports['extractCalleridName']=function(_0x2fc5b4){var _0x36d193=_0x2fc5b4[_0xa3a6('0x83')](/"(.*?)"/);return _0x36d193?_0x36d193[0x1]:_0x2fc5b4;};exports[_0xa3a6('0x84')]=function(_0x57c4ed){var _0x4bc569=_0x57c4ed['match'](/<(.*?)>/);return _0x4bc569?_0x4bc569[0x1]:_0x57c4ed;}; \ No newline at end of file +var _0xb4ad=['originate','channelAgent','calleridnum','xcally-motion-preview','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','scheduledat','add','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','isNil','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','active','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','xmd-queue','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','preview','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','updatedAt','%s%s','XMD-','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','logAgent','ringtime','membername','UserId','endtime','talktime','answertime','isFailure','Failure','variablesAction'];(function(_0xe1b3ee,_0x402aaf){var _0x4b2ead=function(_0xcb3754){while(--_0xcb3754){_0xe1b3ee['push'](_0xe1b3ee['shift']());}};_0x4b2ead(++_0x402aaf);}(_0xb4ad,0xd8));var _0xdb4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb4ad[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xdb4a('0x0'));var _=require(_0xdb4a('0x1'));var moment=require(_0xdb4a('0x2'));var logger=require('../../../../config/logger')(_0xdb4a('0x3'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0xdb4a('0x4');function getSeconds(_0x5487ba,_0x4281ad){var _0xd65154=moment(_0x5487ba)[_0xdb4a('0x5')](0x0);var _0x5c2abd=moment(_0x4281ad)[_0xdb4a('0x5')](0x0);return _0xd65154[_0xdb4a('0x6')](_0x5c2abd,_0xdb4a('0x7'));}exports[_0xdb4a('0x8')]=function(_0x543cf1){return function(_0x3c5d5d){logger[_0xdb4a('0x9')](_0x543cf1,util['inspect'](_0x3c5d5d,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2ef2e6,_0x55a3cd){logger[_0xdb4a('0xa')](_0x2ef2e6,util[_0xdb4a('0xb')](_0x55a3cd,{'showHidden':![],'depth':null}));};exports[_0xdb4a('0xc')]=function(_0x320008,_0x3105f6){logger[_0xdb4a('0x9')](_0x320008,util[_0xdb4a('0xb')](_0x3105f6,{'showHidden':![],'depth':null}));};exports[_0xdb4a('0xd')]=function(_0x32dc74){return function(_0x56ed65){logger[_0xdb4a('0xa')](_0x32dc74,util[_0xdb4a('0xb')](_0x56ed65,{'showHidden':![],'depth':null}));};};exports[_0xdb4a('0xe')]=function(_0x591a71,_0x5c5f0f,_0x8588e5){return{'message':_0x591a71,'unlock':_0x5c5f0f,'active':_0x8588e5};};exports[_0xdb4a('0xf')]=function(_0xed2975,_0x3bc20b,_0x3f3e04){if(!_[_0xdb4a('0x10')](_0x3f3e04)&&_0xdb4a('0x11')===typeof _0x3f3e04&&!_[_0xdb4a('0x12')](_0x3f3e04)){if(!_['isUndefined'](_0x3bc20b)&&'string'===typeof _0x3bc20b&&!_[_0xdb4a('0x12')](_0x3bc20b)){return util['format'](_0xdb4a('0x13'),_0x3bc20b,_0x3f3e04);}return util[_0xdb4a('0x14')](_0xdb4a('0x13'),_0x3f3e04,_0x3f3e04);}if(!_[_0xdb4a('0x10')](_0xed2975)&&_0xdb4a('0x11')===typeof _0xed2975&&!_[_0xdb4a('0x12')](_0xed2975)){return _0xed2975;}return _0xdb4a('0x15');};exports[_0xdb4a('0x16')]=function(_0x1fbc55){if(_['isNil'](_0x1fbc55)){return![];}return _0x1fbc55;};exports[_0xdb4a('0x17')]=function(_0x2b7be3,_0x28ea86,_0x5d9c39,_0x17e42a,_0x1e61c8,_0x42c4d2){var _0xb11df3={'XMD-QUEUE':_0x28ea86[_0xdb4a('0x18')]?_0x28ea86[_0xdb4a('0x18')]['name']:'','XMD-CALLERID':_0x17e42a,'XMD-CALLERID-PREVIEW':_0x42c4d2?util['format'](_0xdb4a('0x13'),_0x42c4d2[_0xdb4a('0x19')],_0x42c4d2['calleridnum']):_0x17e42a,'XMD-DIALID':_0x1e61c8,'XMD-CONTACTID':_0x28ea86['ContactId'],'XMD-CDRTYPE':_0xdb4a('0x1a'),'CALLERID(all)':_0x17e42a,'XMD-VOICEQUEUEID':_0x28ea86['VoiceQueueId'],'XMD-DIALCHANNEL':_0x5d9c39,'XMD-DIALTIMEOUT':_0x2b7be3[_0xdb4a('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xdb4a('0x14')](_0xdb4a('0x1c'),_0x2b7be3['dialQueueProject2']?'g':'',_[_0xdb4a('0x12')](_0x2b7be3[_0xdb4a('0x1d')])?'':_0xdb4a('0x1e')),'XMD-DIALURL':_0x2b7be3[_0xdb4a('0x1f')]||'','XMD-AGI':_0x2b7be3[_0xdb4a('0x20')]?util['format'](_0xdb4a('0x21'),ipAgi,_0x2b7be3[_0xdb4a('0x20')]):_0xdb4a('0x22'),'XMD-AGIAFTER':_0x2b7be3[_0xdb4a('0x23')]?util[_0xdb4a('0x14')](_0xdb4a('0x21'),ipAgi,_0x2b7be3[_0xdb4a('0x23')]):_0xdb4a('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x42c4d2?_0x42c4d2[_0xdb4a('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x42c4d2?_0x42c4d2['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0x2b7be3['monitor_format'])){_0xb11df3[util[_0xdb4a('0x14')]('%s',_0xdb4a('0x25'))]=_0x2b7be3[_0xdb4a('0x1d')];_0xb11df3[util['format']('%s',_0xdb4a('0x26'))]=_0x1e61c8;}if(_0x28ea86&&_0x28ea86[_0xdb4a('0x27')]){for(var _0x5b7adf in _0x28ea86[_0xdb4a('0x27')]){if(_0x28ea86[_0xdb4a('0x27')]['hasOwnProperty'](_0x5b7adf)){if(!_['isNil'](_0x28ea86[_0xdb4a('0x27')][_0x5b7adf])&&_0x5b7adf!=='id'&&_0x5b7adf!=='tags'&&_0x5b7adf!==_0xdb4a('0x28')&&_0x5b7adf!==_0xdb4a('0x29')){_0xb11df3[util[_0xdb4a('0x14')](_0xdb4a('0x2a'),_0xdb4a('0x2b'),_['toUpper'](_0x5b7adf))]=_0x28ea86['Contact'][_0x5b7adf];}}}}return _0xb11df3;};exports['toLowerVariables']=function(_0x57732e){var _0x2d6a07={};for(var _0xc64452 in _0x57732e){if(_0x57732e[_0xdb4a('0x2c')](_0xc64452)){_0x2d6a07[util[_0xdb4a('0x14')]('%s',_[_0xdb4a('0x2d')](_0xc64452))]=_0x57732e[_0xc64452];}}return{'variables':_0x2d6a07};};exports[_0xdb4a('0x2e')]=function(_0x2cbcb3,_0x4068f7){if(!_['isNil'](_0x2cbcb3)){if(_0x2cbcb3[_0xdb4a('0x2c')](_0xdb4a('0x2f'))){if(_0x2cbcb3['originated']>0x0){_0x2cbcb3[_0xdb4a('0x2f')]-=0x1;}else{logger[_0xdb4a('0x9')](_0xdb4a('0x30'),_0x4068f7);}}}else{logger[_0xdb4a('0x9')](_0xdb4a('0x31'),_0x4068f7);}};exports[_0xdb4a('0x32')]=function(_0x41af41){var _0x50a576=moment()[_0xdb4a('0x14')](_0xdb4a('0x33'));_0x41af41[_0xdb4a('0x34')]=0xd;_0x41af41[_0xdb4a('0x35')]='Blacklist';_0x41af41[_0xdb4a('0x36')]=_0x50a576;_0x41af41[_0xdb4a('0x37')]=_0x50a576;_0x41af41['endtime']=_0x50a576;};exports[_0xdb4a('0x38')]=function(_0x1cb27b,_0x409e09,_0x48445f){var _0xc1928c=moment()[_0xdb4a('0x14')](_0xdb4a('0x33'));_0x1cb27b[_0xdb4a('0x34')]=_0x409e09;_0x1cb27b[_0xdb4a('0x35')]=_0x48445f;_0x1cb27b['responsetime']=_0xc1928c;_0x1cb27b[_0xdb4a('0x39')]=getSeconds(_0x1cb27b['responsetime'],_0x1cb27b[_0xdb4a('0x36')]);};exports['logLookAgent']=function(_0x3b0384,_0x1b7bbf,_0x2bb0d0){_0x3b0384[_0xdb4a('0x3a')]=_0x1b7bbf;_0x3b0384[_0xdb4a('0x3b')]=_0x2bb0d0;};exports['logCustomer']=function(_0x276606,_0x5831d1,_0x474be6){var _0x2745dd=moment()[_0xdb4a('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x276606[_0xdb4a('0x34')]=_0x5831d1;_0x276606[_0xdb4a('0x35')]=_0x474be6;_0x276606[_0xdb4a('0x37')]=_0x276606[_0xdb4a('0x37')]?_0x276606[_0xdb4a('0x37')]:_0x2745dd;_0x276606[_0xdb4a('0x3c')]=_0x276606[_0xdb4a('0x3c')]?_0x276606[_0xdb4a('0x3c')]:_0x2745dd;_0x276606[_0xdb4a('0x39')]=getSeconds(_0x276606[_0xdb4a('0x37')]||0x0,_0x276606[_0xdb4a('0x36')]||0x0);_0x276606[_0xdb4a('0x3d')]=_0x276606[_0xdb4a('0x3e')]?getSeconds(_0x276606['endtime'],_0x276606[_0xdb4a('0x3e')]):0x0;};exports[_0xdb4a('0x3f')]=function(_0x48f50a){return _0x48f50a===_0xdb4a('0x40');};exports[_0xdb4a('0x41')]=function(_0x25d0b3,_0x4825e3,_0x33db4d,_0xedbde3,_0x5bf41f){var _0x3c472a=_0xedbde3?'RECALL':_0x25d0b3['calleridname'];_0x3c472a=_0x5bf41f?'BOOKED':_0x3c472a;return{'actionid':_0x25d0b3['uniqueid'],'action':_0xdb4a('0x42'),'channel':_0x25d0b3[_0xdb4a('0x43')],'callerid':util['format'](_0xdb4a('0x13'),_0x3c472a,_0x25d0b3[_0xdb4a('0x44')]),'Exten':_0xdb4a('0x45'),'Context':_0xdb4a('0x46'),'Priority':'1','variable':_0x33db4d,'timeout':(_0x4825e3[_0xdb4a('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x25d0b3[_0xdb4a('0x48')]};};exports[_0xdb4a('0x49')]=function(_0x18f0d0){return _0x18f0d0[_0xdb4a('0x4a')]+_0x18f0d0[_0xdb4a('0x4b')]+_0x18f0d0['countnoanswerretry']+_0x18f0d0[_0xdb4a('0x4c')]+_0x18f0d0[_0xdb4a('0x4d')];};exports[_0xdb4a('0x4e')]=function(_0x3892e5){var _0x2329ef=_[_0xdb4a('0x4f')](_0x3892e5);_0x2329ef['state']=0xf;_0x2329ef[_0xdb4a('0x35')]='Global';return _0x2329ef;};exports[_0xdb4a('0x50')]=function(_0x7eec6c,_0x1648c6,_0x19037f){var _0x17844d={};_0x17844d[_0x1648c6]=_0x7eec6c[_0x1648c6];_0x17844d['active']=![];_0x17844d[_0xdb4a('0x51')]=moment()[_0xdb4a('0x52')](_0x19037f,_0xdb4a('0x53'))[_0xdb4a('0x14')](_0xdb4a('0x33'));_0x17844d[_0xdb4a('0x54')]=_0x7eec6c['ContactId'];_0x17844d[_0xdb4a('0x55')]=_0x7eec6c['ListId'];_0x17844d['VoiceQueueId']=_0x7eec6c[_0xdb4a('0x56')]||undefined;return _0x17844d;};exports[_0xdb4a('0x57')]=function(_0x584c73,_0x4e57c9){if(!_[_0xdb4a('0x58')](_0x584c73)){if(_0x584c73[_0xdb4a('0x59')]>0x0){_0x584c73[_0xdb4a('0x59')]-=0x1;}else{logger[_0xdb4a('0x9')](_0x4e57c9,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xdb4a('0x9')](_0x4e57c9,_0xdb4a('0x5a'));}};exports[_0xdb4a('0x5b')]=function(_0x8217c4){if(_0x8217c4<=0x0){return!![];}return![];};exports[_0xdb4a('0x5c')]=function(_0x2bf3fd,_0x464099,_0x4bc97b){_0x2bf3fd[_0xdb4a('0x5d')]=_0x464099;_0x2bf3fd[_0xdb4a('0x5e')]=_0x2bf3fd[_0xdb4a('0x5f')];_0x2bf3fd['interface']=_0x2bf3fd[_0xdb4a('0x43')];if(_0x4bc97b){_0x2bf3fd['mandatoryDisposition']=_0x4bc97b[_0xdb4a('0x60')];}return _0x2bf3fd;};exports[_0xdb4a('0x61')]=function(_0x2dd89d){var _0x25a656={};_0x25a656['queue']=_0x2dd89d[_0xdb4a('0x5f')];_0x25a656['interface']=_0x2dd89d['channelAgent'];_0x25a656[_0xdb4a('0x48')]=_0x2dd89d[_0xdb4a('0x48')];return _0x25a656;};exports[_0xdb4a('0x62')]=function(_0x3c8732){var _0x40c0b4=[];for(var _0x125808 in _0x3c8732){if(_0x3c8732[_0xdb4a('0x2c')](_0x125808)){if(!_[_0xdb4a('0x58')](_0x3c8732[_0x125808])&&_0x3c8732[_0x125808][_0xdb4a('0x34')]===_0xdb4a('0x63')&&_0x3c8732[_0x125808][_0xdb4a('0x64')]===_0xdb4a('0x65')){_0x40c0b4[_0xdb4a('0x66')](_0x3c8732[_0x125808]['id']);}}}return _0x40c0b4;};exports['getDiff']=function(_0x5f36ef){var _0x1e750b=moment()[_0xdb4a('0x5')](0x0);var _0x51b0fd=moment(_0x5f36ef)[_0xdb4a('0x5')](0x0);return _0x1e750b[_0xdb4a('0x6')](_0x51b0fd,_0xdb4a('0x7'));};exports[_0xdb4a('0x67')]=function(_0x141784){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x141784[_0xdb4a('0x54')],'ListId':_0x141784[_0xdb4a('0x55')],'VoiceQueueId':_0x141784[_0xdb4a('0x56')]||undefined,'CampaignId':_0x141784[_0xdb4a('0x68')]||undefined};};exports[_0xdb4a('0x69')]=function(_0x29f1a){if(_0x29f1a===_0xdb4a('0x48')||_0x29f1a===_0xdb4a('0x6a')||_0x29f1a===_0xdb4a('0x5f')||_0x29f1a==='type'||_0x29f1a===_0xdb4a('0x6b')||_0x29f1a===_0xdb4a('0x6c')||_0x29f1a===_0xdb4a('0x3a')||_0x29f1a==='channelAgent'||_0x29f1a===_0xdb4a('0x19')||_0x29f1a===_0xdb4a('0x6d')||_0x29f1a===_0xdb4a('0x44')||_0x29f1a===_0xdb4a('0x51')||_0x29f1a===_0xdb4a('0x4a')||_0x29f1a===_0xdb4a('0x4b')||_0x29f1a===_0xdb4a('0x6e')||_0x29f1a===_0xdb4a('0x6f')||_0x29f1a===_0xdb4a('0x70')||_0x29f1a===_0xdb4a('0x71')||_0x29f1a===_0xdb4a('0x72')||_0x29f1a==='recallme'||_0x29f1a===_0xdb4a('0x54')||_0x29f1a===_0xdb4a('0x55')||_0x29f1a===_0xdb4a('0x3b')||_0x29f1a===_0xdb4a('0x56')||_0x29f1a==='sipcallid'||_0x29f1a==='xmd-voicequeueid'||_0x29f1a===_0xdb4a('0x73')||_0x29f1a==='xmd-phone'||_0x29f1a===_0xdb4a('0x74')||_0x29f1a==='xmd-dialurl'||_0x29f1a===_0xdb4a('0x75')||_0x29f1a===_0xdb4a('0x76')||_0x29f1a===_0xdb4a('0x77')||_0x29f1a==='xmd-dialchannel'||_0x29f1a===_0xdb4a('0x78')||_0x29f1a===_0xdb4a('0x79')||_0x29f1a==='xmd-callerid'||_0x29f1a===_0xdb4a('0x7a')||_0x29f1a===_0xdb4a('0x7b')||_0x29f1a===_0xdb4a('0x7c')||_0x29f1a===_0xdb4a('0x7d')||_0x29f1a==='rtpaudioqosjitter'||_0x29f1a===_0xdb4a('0x7e')||_0x29f1a===_0xdb4a('0x7f')||_0x29f1a==='rtpaudioqoslossbridged'||_0x29f1a===_0xdb4a('0x80')||_0x29f1a===_0xdb4a('0x81')||_0x29f1a===_0xdb4a('0x7c')||_0x29f1a===_0xdb4a('0x7d')||_0x29f1a===_0xdb4a('0x82')||_0x29f1a===_0xdb4a('0x7e')||_0x29f1a==='rtpaudioqosloss'||_0x29f1a==='rtpaudioqoslossbridged'||_0x29f1a===_0xdb4a('0x80')||_0x29f1a==='rtpaudioqosrttbridged'||_0x29f1a===_0xdb4a('0x83')||_0x29f1a===_0xdb4a('0x84')||_0x29f1a===_0xdb4a('0x34')||_0x29f1a==='statedesc'){return![];}return!![];};exports[_0xdb4a('0x85')]=function(_0x215fb2,_0x10962b){var _0x1aaef9,_0x351d7b,_0x1312f4;if(_0x10962b<=0x0){_0x10962b=0x1;}_0x1aaef9=new RegExp(_0xdb4a('0x86')+_0x10962b+'}$');_0x351d7b=Math[_0xdb4a('0x87')](0xa,_0x10962b-0x1);_0x1312f4=Math['pow'](0xa,_0x10962b)-0x1;return util[_0xdb4a('0x14')]('%s',_[_0xdb4a('0x88')](_0x215fb2,_0x1aaef9,_[_0xdb4a('0x89')](_0x351d7b,_0x1312f4)));};exports[_0xdb4a('0x8a')]=function(_0x344de1){var _0x5b6c1e=_0x344de1[_0xdb4a('0x8b')](/"(.*?)"/);return _0x5b6c1e?_0x5b6c1e[0x1]:_0x344de1;};exports[_0xdb4a('0x8c')]=function(_0x267fd1){var _0x2f5b6e=_0x267fd1[_0xdb4a('0x8b')](/<(.*?)>/);return _0x2f5b6e?_0x2f5b6e[0x1]:_0x267fd1;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 6966894..af0f1b1 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 _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x428f8c,_0x5a4846){var _0x872e18=function(_0x29cbf7){while(--_0x29cbf7){_0x428f8c['push'](_0x428f8c['shift']());}};_0x872e18(++_0x5a4846);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c60ef,_0x51da79){_0x1c60ef=_0x1c60ef-0x0;var _0x5b6b80=_0xb10b[_0x1c60ef];return _0x5b6b80;};'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 +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x40dea3,_0x2e8c7c){var _0x17ee6a=function(_0x5f0560){while(--_0x5f0560){_0x40dea3['push'](_0x40dea3['shift']());}};_0x17ee6a(++_0x2e8c7c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2aa788,_0x498eb8){_0x2aa788=_0x2aa788-0x0;var _0x5be967=_0xb10b[_0x2aa788];return _0x5be967;};'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 743742a..ade30da 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 _0xa4b0=['sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','sumHoldTime','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','voiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','groupBy','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','total','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','SquareProject','initVoiceExtensions','merge','initFaxAccounts','exports','bluebird','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','interface','name','answered'];(function(_0x304655,_0x15b109){var _0x2fa58a=function(_0x7d144){while(--_0x7d144){_0x304655['push'](_0x304655['shift']());}};_0x2fa58a(++_0x15b109);}(_0xa4b0,0x1e8));var _0x0a4b=function(_0x162703,_0x57b788){_0x162703=_0x162703-0x0;var _0x5e7f4a=_0xa4b0[_0x162703];return _0x5e7f4a;};'use strict';var BPromise=require(_0x0a4b('0x0'));var util=require('util');var _=require('lodash');var moment=require('moment');var Agent=require(_0x0a4b('0x1'));var Telephone=require(_0x0a4b('0x2'));var Trunk=require(_0x0a4b('0x3'));var VoiceQueue=require(_0x0a4b('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x0a4b('0x5'));var Campaign=require(_0x0a4b('0x6'));var VoiceExtension=require(_0x0a4b('0x7'));var ZendeskAccount=require(_0x0a4b('0x8'));var SalesforceAccount=require(_0x0a4b('0x9'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x0a4b('0xa'));var ZohoAccount=require(_0x0a4b('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x0a4b('0xc'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x0a4b('0xd'));var FaxAccount=require(_0x0a4b('0xe'));var Realtime=function(){this[_0x0a4b('0xf')]={};this[_0x0a4b('0x10')]={};this[_0x0a4b('0x11')]={};this['voiceQueues']={};this['triggers']={};this[_0x0a4b('0x12')]={};this[_0x0a4b('0x13')]={};this[_0x0a4b('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x0a4b('0x15')]={};this['channels']={};this[_0x0a4b('0x16')]={};this[_0x0a4b('0x17')]={};this[_0x0a4b('0x18')]={};this[_0x0a4b('0x19')]={};this[_0x0a4b('0x1a')]={};this['sugarcrmAccounts']={};this[_0x0a4b('0x1b')]={};this[_0x0a4b('0x1c')]={};this[_0x0a4b('0x1d')]={};this[_0x0a4b('0x1e')]={};this[_0x0a4b('0x1f')]={};this[_0x0a4b('0x20')]={};this[_0x0a4b('0x21')]={};this[_0x0a4b('0x22')]={};};function freeIsNotKey(_0x320b57,_0x4cc13b,_0x2be559){var _0x4065da=_[_0x0a4b('0x23')](_0x320b57,function(_0x552473,_0x42eb96){return _0x552473[_0x2be559];});for(var _0x1e5da7 in _0x4cc13b){if(_0x4cc13b[_0x0a4b('0x24')](_0x1e5da7)){if(!_0x4065da[_0x1e5da7]){delete _0x4cc13b[_0x1e5da7];}}}}function freeIsNotKeySip(_0x266503,_0x2fd5fd){var _0x4c583e=_['mapKeys'](_0x266503,function(_0x18feff,_0x262e32){return util[_0x0a4b('0x25')](_0x0a4b('0x26'),_0x18feff['name']);});for(var _0x1810a5 in _0x2fd5fd){if(_0x2fd5fd['hasOwnProperty'](_0x1810a5)){if(!_0x4c583e[_0x1810a5]){delete _0x2fd5fd[_0x1810a5];}}}}function freeIsNotKeyAgent(_0x1b9641,_0x5d5cb0){var _0x43a7ce=_[_0x0a4b('0x23')](_0x1b9641,function(_0x8531da,_0x2f21eb){var _0x50d82f=_['isNil'](_0x8531da[_0x0a4b('0x27')])?util['format'](_0x0a4b('0x26'),_0x8531da[_0x0a4b('0x28')]):_0x8531da['interface'];return _0x50d82f;});for(var _0x2df4ea in _0x5d5cb0){if(_0x5d5cb0['hasOwnProperty'](_0x2df4ea)){if(!_0x43a7ce[_0x2df4ea]){delete _0x5d5cb0[_0x2df4ea];}}}}function clearVoiceCallReports(_0x1b8566){_0x1b8566['total']=0x0;_0x1b8566[_0x0a4b('0x29')]=0x0;_0x1b8566['sumHoldTime']=0x0;_0x1b8566['sumDuration']=0x0;_0x1b8566[_0x0a4b('0x2a')]=0x0;}function clearCampaigns(_0x27f902){if(!_[_0x0a4b('0x2b')](_0x27f902)){for(var _0x4dbac7 in _0x27f902){if(_0x27f902[_0x0a4b('0x24')](_0x4dbac7)){_0x27f902[_0x4dbac7]['ivrTotalCallsDays']=0x0;_0x27f902[_0x4dbac7][_0x0a4b('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x1390a1){if(!_['isEmpty'](_0x1390a1)){for(var _0x138150 in _0x1390a1){if(_0x1390a1[_0x0a4b('0x24')](_0x138150)){_0x1390a1[_0x138150]['total']=0x0;_0x1390a1[_0x138150][_0x0a4b('0x29')]=0x0;_0x1390a1[_0x138150][_0x0a4b('0x2d')]=0x0;_0x1390a1[_0x138150]['abandoned']=0x0;_0x1390a1[_0x138150][_0x0a4b('0x2e')]=0x0;_0x1390a1[_0x138150][_0x0a4b('0x2f')]=0x0;_0x1390a1[_0x138150][_0x0a4b('0x2a')]=0x0;_0x1390a1[_0x138150][_0x0a4b('0x30')]=0x0;_0x1390a1[_0x138150][_0x0a4b('0x31')]=0x0;_0x1390a1[_0x138150][_0x0a4b('0x32')]=0x0;_0x1390a1[_0x138150]['outboundCongestionCallsDay']=0x0;_0x1390a1[_0x138150][_0x0a4b('0x33')]=0x0;_0x1390a1[_0x138150]['outboundUnknownCallsDay']=0x0;_0x1390a1[_0x138150][_0x0a4b('0x34')]=0x0;_0x1390a1[_0x138150][_0x0a4b('0x35')]=0x0;_0x1390a1[_0x138150][_0x0a4b('0x36')]=0x0;_0x1390a1[_0x138150]['outboundOriginateFailureCallsDay']=0x0;_0x1390a1[_0x138150][_0x0a4b('0x37')]=0x0;_0x1390a1[_0x138150][_0x0a4b('0x38')]=0x0;_0x1390a1[_0x138150][_0x0a4b('0x30')]=0x0;_0x1390a1[_0x138150][_0x0a4b('0x39')]=0x0;_0x1390a1[_0x138150][_0x0a4b('0x3a')]=!![];}}}}Realtime[_0x0a4b('0x3b')][_0x0a4b('0x3c')]=function(_0x164952,_0x31de91){for(var _0x236997 in _0x31de91){if(_0x164952[_0x0a4b('0x24')](_0x236997)){_0x164952[_0x236997]=_0x31de91[_0x236997];}}};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x3d')]=function(){var _0x471b70=this;return function(_0x42a459){if(_0x42a459){freeIsNotKeyAgent(_0x42a459,_0x471b70['agents']);for(var _0x21d783=0x0,_0x399bab={},_0x119a0f={};_0x21d783<_0x42a459[_0x0a4b('0x3e')];_0x21d783+=0x1){_0x399bab=_0x42a459[_0x21d783];var _0x17e9d2=_[_0x0a4b('0x3f')](_0x399bab[_0x0a4b('0x27')])?util[_0x0a4b('0x25')](_0x0a4b('0x26'),_0x399bab['name']):_0x399bab['interface'];if(_[_0x0a4b('0x40')](_0x471b70['agents'][_0x17e9d2])){_0x471b70[_0x0a4b('0xf')][_0x17e9d2]=new Agent(_0x399bab);}else{_0x471b70[_0x0a4b('0x3c')](_0x471b70['agents'][_0x17e9d2],_0x399bab);}}}return _0x471b70[_0x0a4b('0xf')];};};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x41')]=function(){var _0x418a75=this;return function(_0x22a3dc){if(_0x22a3dc){freeIsNotKeySip(_0x22a3dc,_0x418a75[_0x0a4b('0x10')]);for(var _0x4cbb65=0x0,_0x4f082b={},_0x190b80={};_0x4cbb65<_0x22a3dc[_0x0a4b('0x3e')];_0x4cbb65+=0x1){_0x4f082b=_0x22a3dc[_0x4cbb65];if(_[_0x0a4b('0x40')](_0x418a75[_0x0a4b('0x10')][util[_0x0a4b('0x25')](_0x0a4b('0x26'),_0x4f082b[_0x0a4b('0x28')])])){_0x418a75[_0x0a4b('0x10')][util[_0x0a4b('0x25')](_0x0a4b('0x26'),_0x4f082b[_0x0a4b('0x28')])]=new Telephone(_0x4f082b);}else{_0x418a75[_0x0a4b('0x3c')](_0x418a75[_0x0a4b('0x10')][util[_0x0a4b('0x25')]('SIP/%s',_0x4f082b[_0x0a4b('0x28')])],_0x4f082b);}}}return _0x418a75[_0x0a4b('0x10')];};};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x42')]=function(){var _0x5caae=this;return function(_0x23a001){if(_0x23a001){freeIsNotKeySip(_0x23a001,_0x5caae['trunks']);for(var _0x278fc4=0x0,_0x88fce7={},_0x396c94={};_0x278fc4<_0x23a001[_0x0a4b('0x3e')];_0x278fc4+=0x1){_0x88fce7=_0x23a001[_0x278fc4];if(_['isUndefined'](_0x5caae[_0x0a4b('0x11')][util['format'](_0x0a4b('0x26'),_0x88fce7['name'])])){_0x5caae[_0x0a4b('0x11')][util[_0x0a4b('0x25')](_0x0a4b('0x26'),_0x88fce7[_0x0a4b('0x28')])]=new Trunk(_0x88fce7);}else{_0x5caae[_0x0a4b('0x3c')](_0x5caae['trunks'][util[_0x0a4b('0x25')](_0x0a4b('0x26'),_0x88fce7[_0x0a4b('0x28')])],_0x88fce7);}}}return _0x5caae['trunks'];};};Realtime['prototype'][_0x0a4b('0x43')]=function(){var _0xbb255d=this;return function(_0x452b0d){if(_0x452b0d){freeIsNotKey(_0x452b0d,_0xbb255d[_0x0a4b('0x44')],_0x0a4b('0x28'));for(var _0x51c8a3=0x0,_0x4ac0e4={},_0x2bf6e1={};_0x51c8a3<_0x452b0d['length'];_0x51c8a3+=0x1){_0x4ac0e4=_0x452b0d[_0x51c8a3];if(_[_0x0a4b('0x40')](_0xbb255d[_0x0a4b('0x44')][_0x4ac0e4[_0x0a4b('0x28')]])){_0xbb255d[_0x0a4b('0x44')][_0x4ac0e4[_0x0a4b('0x28')]]=new VoiceQueue(_0x4ac0e4);}else{_0xbb255d[_0x0a4b('0x3c')](_0xbb255d[_0x0a4b('0x44')][_0x4ac0e4[_0x0a4b('0x28')]],_0x4ac0e4);}}}return _0xbb255d[_0x0a4b('0x44')];};};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x45')]=function(){var _0x4924dd=this;return function(_0x5cc8b0){if(_0x5cc8b0){freeIsNotKey(_0x5cc8b0,_0x4924dd[_0x0a4b('0x46')],'id');for(var _0x55d082=0x0,_0x590b5a={},_0xf2d5b8={};_0x55d082<_0x5cc8b0[_0x0a4b('0x3e')];_0x55d082+=0x1){_0x590b5a=_0x5cc8b0[_0x55d082];if(_['isUndefined'](_0x4924dd[_0x0a4b('0x46')][_0x590b5a['id']])){_0x4924dd[_0x0a4b('0x46')][_0x590b5a['id']]=new Trigger(_0x590b5a);}else{_0x4924dd[_0x0a4b('0x3c')](_0x4924dd[_0x0a4b('0x46')][_0x590b5a['id']],_0x590b5a);}}}return _0x4924dd['triggers'];};};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x47')]=function(){var _0x476045=this;return function(_0x4ab2c2){if(_0x4ab2c2){freeIsNotKey(_0x4ab2c2,_0x476045[_0x0a4b('0x13')],'id');for(var _0x3490e5=0x0,_0x2dd888={},_0x11b9da={};_0x3490e5<_0x4ab2c2['length'];_0x3490e5+=0x1){_0x2dd888=_0x4ab2c2[_0x3490e5];if(_['isUndefined'](_0x476045[_0x0a4b('0x13')][_0x2dd888['id']])){_0x476045[_0x0a4b('0x13')][_0x2dd888['id']]=new Template(_0x2dd888);}else{_0x476045[_0x0a4b('0x3c')](_0x476045[_0x0a4b('0x13')][_0x2dd888['id']],_0x2dd888);}}}return _0x476045['templates'];};};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x48')]=function(){var _0x519fee=this;return function(_0x39605c){if(_0x39605c){freeIsNotKey(_0x39605c,_0x519fee[_0x0a4b('0x19')],'id');for(var _0x35afbd=0x0,_0x175a81={},_0x180dc1={};_0x35afbd<_0x39605c[_0x0a4b('0x3e')];_0x35afbd+=0x1){_0x175a81=_0x39605c[_0x35afbd];if(_[_0x0a4b('0x40')](_0x519fee['zendeskAccounts'][_0x175a81['id']])){_0x519fee[_0x0a4b('0x19')][_0x175a81['id']]=new ZendeskAccount(_0x175a81);}else{_0x519fee[_0x0a4b('0x3c')](_0x519fee[_0x0a4b('0x19')][_0x175a81['id']],_0x175a81);}}}return _0x519fee[_0x0a4b('0x19')];};};Realtime['prototype'][_0x0a4b('0x49')]=function(){var _0x1155de=this;return function(_0x5e33d1){if(_0x5e33d1){freeIsNotKey(_0x5e33d1,_0x1155de[_0x0a4b('0x1a')],'id');for(var _0x50a98c=0x0,_0x2f7f30={},_0x3936ab={};_0x50a98c<_0x5e33d1[_0x0a4b('0x3e')];_0x50a98c+=0x1){_0x2f7f30=_0x5e33d1[_0x50a98c];if(_['isUndefined'](_0x1155de['salesforceAccounts'][_0x2f7f30['id']])){_0x1155de[_0x0a4b('0x1a')][_0x2f7f30['id']]=new SalesforceAccount(_0x2f7f30);}else{_0x1155de[_0x0a4b('0x3c')](_0x1155de[_0x0a4b('0x1a')][_0x2f7f30['id']],_0x2f7f30);}}}return _0x1155de['salesforceAccounts'];};};Realtime['prototype'][_0x0a4b('0x4a')]=function(){var _0x47b759=this;return function(_0x48e25a){if(_0x48e25a){freeIsNotKey(_0x48e25a,_0x47b759[_0x0a4b('0x1b')],'id');for(var _0x44660e=0x0,_0x285a32={},_0x48afa5={};_0x44660e<_0x48e25a[_0x0a4b('0x3e')];_0x44660e+=0x1){_0x285a32=_0x48e25a[_0x44660e];if(_[_0x0a4b('0x40')](_0x47b759[_0x0a4b('0x1b')][_0x285a32['id']])){_0x47b759['freshdeskAccounts'][_0x285a32['id']]=new FreshdeskAccount(_0x285a32);}else{_0x47b759[_0x0a4b('0x3c')](_0x47b759[_0x0a4b('0x1b')][_0x285a32['id']],_0x285a32);}}}return _0x47b759['freshdeskAccounts'];};};Realtime['prototype'][_0x0a4b('0x4b')]=function(){var _0x4c39ba=this;return function(_0x41f7c4){if(_0x41f7c4){freeIsNotKey(_0x41f7c4,_0x4c39ba[_0x0a4b('0x1c')],'id');for(var _0x38847d=0x0,_0x99aea2={},_0x2c4550={};_0x38847d<_0x41f7c4[_0x0a4b('0x3e')];_0x38847d+=0x1){_0x99aea2=_0x41f7c4[_0x38847d];if(_[_0x0a4b('0x40')](_0x4c39ba['zohoAccounts'][_0x99aea2['id']])){_0x4c39ba[_0x0a4b('0x1c')][_0x99aea2['id']]=new ZohoAccount(_0x99aea2);}else{_0x4c39ba[_0x0a4b('0x3c')](_0x4c39ba['zohoAccounts'][_0x99aea2['id']],_0x99aea2);}}}return _0x4c39ba[_0x0a4b('0x1c')];};};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x4c')]=function(){var _0x4c10ee=this;return function(_0x774c85){if(_0x774c85){freeIsNotKey(_0x774c85,_0x4c10ee[_0x0a4b('0x1d')],'id');for(var _0x406db0=0x0,_0x18f770={},_0x48d071={};_0x406db0<_0x774c85[_0x0a4b('0x3e')];_0x406db0+=0x1){_0x18f770=_0x774c85[_0x406db0];if(_[_0x0a4b('0x40')](_0x4c10ee[_0x0a4b('0x1d')][_0x18f770['id']])){_0x4c10ee[_0x0a4b('0x1d')][_0x18f770['id']]=new DeskAccount(_0x18f770);}else{_0x4c10ee['mergeFromDatabase'](_0x4c10ee[_0x0a4b('0x1d')][_0x18f770['id']],_0x18f770);}}}return _0x4c10ee[_0x0a4b('0x1d')];};};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x4d')]=function(){var _0x331fc0=this;return function(_0x143bbb){if(_0x143bbb){freeIsNotKey(_0x143bbb,_0x331fc0[_0x0a4b('0x4e')],'id');for(var _0x5ad713=0x0,_0x4a61b9={},_0x548f52={};_0x5ad713<_0x143bbb[_0x0a4b('0x3e')];_0x5ad713+=0x1){_0x4a61b9=_0x143bbb[_0x5ad713];if(_[_0x0a4b('0x40')](_0x331fc0[_0x0a4b('0x4e')][_0x4a61b9['id']])){_0x331fc0[_0x0a4b('0x4e')][_0x4a61b9['id']]=new SugarcrmAccount(_0x4a61b9);}else{_0x331fc0[_0x0a4b('0x3c')](_0x331fc0['sugarcrmAccounts'][_0x4a61b9['id']],_0x4a61b9);}}}return _0x331fc0[_0x0a4b('0x4e')];};};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x4f')]=function(){var _0x35aec0=this;return function(_0x23072d){if(_0x23072d){freeIsNotKey(_0x23072d,_0x35aec0[_0x0a4b('0x1e')],'id');for(var _0xc48d6f=0x0,_0x2ecfac={},_0x55ea11={};_0xc48d6f<_0x23072d[_0x0a4b('0x3e')];_0xc48d6f+=0x1){_0x2ecfac=_0x23072d[_0xc48d6f];if(_[_0x0a4b('0x40')](_0x35aec0[_0x0a4b('0x1e')][_0x2ecfac['id']])){_0x35aec0['vtigerAccounts'][_0x2ecfac['id']]=new VtigerAccount(_0x2ecfac);}else{_0x35aec0[_0x0a4b('0x3c')](_0x35aec0[_0x0a4b('0x1e')][_0x2ecfac['id']],_0x2ecfac);}}}return _0x35aec0[_0x0a4b('0x1e')];};};Realtime['prototype'][_0x0a4b('0x50')]=function(){var _0x14d7b6=this;return function(_0x5b0818){if(_0x5b0818){freeIsNotKey(_0x5b0818,_0x14d7b6[_0x0a4b('0x1f')],'id');for(var _0x376bf0=0x0,_0x293d6c={},_0x1e8a20={};_0x376bf0<_0x5b0818[_0x0a4b('0x3e')];_0x376bf0+=0x1){_0x293d6c=_0x5b0818[_0x376bf0];if(_[_0x0a4b('0x40')](_0x14d7b6['servicenowAccounts'][_0x293d6c['id']])){_0x14d7b6[_0x0a4b('0x1f')][_0x293d6c['id']]=new ServicenowAccount(_0x293d6c);}else{_0x14d7b6[_0x0a4b('0x3c')](_0x14d7b6['servicenowAccounts'][_0x293d6c['id']],_0x293d6c);}}}return _0x14d7b6[_0x0a4b('0x1f')];};};Realtime['prototype'][_0x0a4b('0x51')]=function(){var _0x1adf6e=this;return function(_0x1b2af0){if(_0x1b2af0){freeIsNotKey(_0x1b2af0,_0x1adf6e[_0x0a4b('0x20')],'id');for(var _0x4d878c=0x0,_0x1260c7={},_0x4b4e1f={};_0x4d878c<_0x1b2af0[_0x0a4b('0x3e')];_0x4d878c+=0x1){_0x1260c7=_0x1b2af0[_0x4d878c];if(_['isUndefined'](_0x1adf6e[_0x0a4b('0x20')][_0x1260c7['id']])){_0x1adf6e[_0x0a4b('0x20')][_0x1260c7['id']]=new Dynamics365Account(_0x1260c7);}else{_0x1adf6e[_0x0a4b('0x3c')](_0x1adf6e[_0x0a4b('0x20')][_0x1260c7['id']],_0x1260c7);}}}return _0x1adf6e['dynamics365Accounts'];};};Realtime[_0x0a4b('0x3b')]['initFreshsalesAccounts']=function(){var _0x31639f=this;return function(_0x50394d){if(_0x50394d){freeIsNotKey(_0x50394d,_0x31639f[_0x0a4b('0x21')],'id');for(var _0x2e4b9b=0x0,_0x58967c={},_0x361a1e={};_0x2e4b9b<_0x50394d[_0x0a4b('0x3e')];_0x2e4b9b+=0x1){_0x58967c=_0x50394d[_0x2e4b9b];if(_['isUndefined'](_0x31639f[_0x0a4b('0x21')][_0x58967c['id']])){_0x31639f['freshsalesAccounts'][_0x58967c['id']]=new FreshsalesAccount(_0x58967c);}else{_0x31639f[_0x0a4b('0x3c')](_0x31639f[_0x0a4b('0x21')][_0x58967c['id']],_0x58967c);}}}return _0x31639f['freshsalesAccounts'];};};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x52')]=function(){var _0x186094=this;return function(_0x5c80d0){for(var _0x5a5509=0x0;_0x5a5509<_0x5c80d0[_0x0a4b('0x3e')];_0x5a5509+=0x1){_['merge'](_0x186094[_0x0a4b('0x44')][_0x5c80d0[_0x5a5509]['name']],_0x5c80d0[_0x5a5509]);}return _0x186094['voiceQueues'];};};Realtime[_0x0a4b('0x3b')]['initVoiceQueueReports']=function(){var _0x51605d=this;return function(_0x4ab43b){clearVoiceQueues(_0x51605d[_0x0a4b('0x44')]);if(_0x4ab43b){_0x4ab43b=_[_0x0a4b('0x53')](_0x4ab43b,'uniqueid');for(var _0x5814b8 in _0x4ab43b){if(_0x4ab43b[_0x0a4b('0x24')](_0x5814b8)){var _0x257992={};for(var _0x497409=0x0;_0x497409<_0x4ab43b[_0x5814b8][_0x0a4b('0x3e')];_0x497409+=0x1){var _0x1c33c4=_0x4ab43b[_0x5814b8][_0x497409][_0x0a4b('0x54')];if(_0x51605d[_0x0a4b('0x44')][_0x1c33c4]){if(_0x4ab43b[_0x5814b8][_0x497409][_0x0a4b('0x55')]){_0x51605d[_0x0a4b('0x44')][_0x1c33c4][_0x0a4b('0x2d')]+=0x1;}if(_0x4ab43b[_0x5814b8][_0x497409][_0x0a4b('0x56')]){_0x51605d[_0x0a4b('0x44')][_0x1c33c4][_0x0a4b('0x57')]+=0x1;}_0x51605d[_0x0a4b('0x44')][_0x1c33c4]['sumHoldTime']+=moment(_0x4ab43b[_0x5814b8][_0x497409]['queuecallerleaveAt'])[_0x0a4b('0x58')](moment(_0x4ab43b[_0x5814b8][_0x497409][_0x0a4b('0x59')]),_0x0a4b('0x5a'))||0x0;if(_0x497409===_0x4ab43b[_0x5814b8][_0x0a4b('0x3e')]-0x1){_0x51605d[_0x0a4b('0x44')][_0x1c33c4][_0x0a4b('0x2f')]+=moment(_0x4ab43b[_0x5814b8][_0x497409][_0x0a4b('0x5b')]||_0x4ab43b[_0x5814b8][_0x497409]['queuecallerabandonAt']||_0x4ab43b[_0x5814b8][_0x497409][_0x0a4b('0x5c')])[_0x0a4b('0x58')](moment(_0x4ab43b[_0x5814b8][_0x497409][_0x0a4b('0x59')]),'seconds')||0x0;_0x51605d[_0x0a4b('0x44')][_0x1c33c4][_0x0a4b('0x5d')]+=0x1;if(_0x4ab43b[_0x5814b8][_0x497409][_0x0a4b('0x5e')]){_0x51605d[_0x0a4b('0x44')][_0x1c33c4][_0x0a4b('0x29')]+=0x1;_0x51605d['voiceQueues'][_0x1c33c4][_0x0a4b('0x2a')]+=moment(_0x4ab43b[_0x5814b8][_0x497409][_0x0a4b('0x5b')])['diff'](moment(_0x4ab43b[_0x5814b8][_0x497409][_0x0a4b('0x5f')]),_0x0a4b('0x5a'))||0x0;}}else{_0x51605d[_0x0a4b('0x44')][_0x1c33c4]['sumDuration']+=_0x51605d[_0x0a4b('0x44')][_0x1c33c4][_0x0a4b('0x2e')]||0x0;}}}}}}return _0x51605d[_0x0a4b('0x44')];};};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x60')]=function(){var _0x7607ba=this;return function(_0x435a47){clearVoiceCallReports(_0x7607ba[_0x0a4b('0x14')]);if(_0x435a47){for(var _0x336399=0x0;_0x336399<_0x435a47[_0x0a4b('0x3e')];_0x336399+=0x1){_0x7607ba[_0x0a4b('0x14')][_0x0a4b('0x5d')]+=0x1;_0x7607ba[_0x0a4b('0x14')][_0x0a4b('0x2f')]+=_0x435a47[_0x336399][_0x0a4b('0x61')];if(_0x435a47[_0x336399][_0x0a4b('0x62')]===_0x0a4b('0x63')){_0x7607ba[_0x0a4b('0x14')]['answered']+=0x1;_0x7607ba[_0x0a4b('0x14')][_0x0a4b('0x2e')]+=_0x435a47[_0x336399][_0x0a4b('0x61')]-_0x435a47[_0x336399][_0x0a4b('0x64')]||0x0;_0x7607ba[_0x0a4b('0x14')][_0x0a4b('0x2a')]+=_0x435a47[_0x336399][_0x0a4b('0x64')];}}}return _0x7607ba[_0x0a4b('0x14')];};};Realtime['prototype']['initCampaigns']=function(){var _0x10e5b5=this;return function(_0x2f63c2){if(_0x2f63c2){freeIsNotKey(_0x2f63c2,_0x10e5b5[_0x0a4b('0x12')],_0x0a4b('0x28'));for(var _0x4f0ad1=0x0,_0x3b9814={};_0x4f0ad1<_0x2f63c2[_0x0a4b('0x3e')];_0x4f0ad1+=0x1){_0x3b9814=_0x2f63c2[_0x4f0ad1];if(_[_0x0a4b('0x40')](_0x10e5b5[_0x0a4b('0x12')][_0x3b9814[_0x0a4b('0x28')]])){_0x10e5b5[_0x0a4b('0x12')][_0x3b9814[_0x0a4b('0x28')]]=new Campaign(_0x3b9814);}else{_0x10e5b5['mergeFromDatabase'](_0x10e5b5['campaigns'][_0x3b9814[_0x0a4b('0x28')]],_0x3b9814);_0x10e5b5[_0x0a4b('0x12')][_0x3b9814['name']]['dialQueueProject']=_0x3b9814[_0x0a4b('0x65')]?_0x3b9814[_0x0a4b('0x65')][_0x0a4b('0x28')]:undefined;}}}return _0x10e5b5['campaigns'];};};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x66')]=function(){var _0x3b1986=this;return function(_0x495679){if(_0x495679){freeIsNotKey(_0x495679,_0x3b1986['voiceExtensions'],'id');for(var _0x1e2afa=0x0,_0x4f238a={};_0x1e2afa<_0x495679[_0x0a4b('0x3e')];_0x1e2afa+=0x1){_0x4f238a=_0x495679[_0x1e2afa];if(_['isUndefined'](_0x3b1986[_0x0a4b('0x15')][_0x4f238a['id']])){_0x3b1986[_0x0a4b('0x15')][_0x4f238a['id']]=new VoiceExtension(_0x4f238a);}else{_0x3b1986['mergeFromDatabase'](_0x3b1986[_0x0a4b('0x15')][_0x4f238a['id']],_0x4f238a);}}}return _0x3b1986['voiceExtensions'];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x367aba=this;return function(_0x2a3c55){clearCampaigns(_0x367aba[_0x0a4b('0x12')]);for(var _0x31dfb4=0x0;_0x31dfb4<_0x2a3c55[_0x0a4b('0x3e')];_0x31dfb4+=0x1){_[_0x0a4b('0x67')](_0x367aba[_0x0a4b('0x12')][_0x2a3c55[_0x31dfb4][_0x0a4b('0x28')]],_0x2a3c55[_0x31dfb4]);}return _0x367aba[_0x0a4b('0x12')];};};Realtime[_0x0a4b('0x3b')][_0x0a4b('0x68')]=function(){var _0x1f9498=this;return function(_0x164cff){if(_0x164cff){freeIsNotKey(_0x164cff,_0x1f9498['faxAccounts'],'id');for(var _0x37379b=0x0,_0x751efc={},_0x469e98={};_0x37379b<_0x164cff[_0x0a4b('0x3e')];_0x37379b+=0x1){_0x751efc=_0x164cff[_0x37379b];if(_['isUndefined'](_0x1f9498[_0x0a4b('0x22')][_0x751efc['id']])){_0x1f9498['faxAccounts'][_0x751efc['id']]=new FaxAccount(_0x751efc);}else{_0x1f9498['mergeFromDatabase'](_0x1f9498[_0x0a4b('0x22')][_0x751efc['id']],_0x751efc);}}}return _0x1f9498['faxAccounts'];};};module[_0x0a4b('0x69')]=Realtime; \ No newline at end of file +var _0x9c9c=['queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','SIP/%s','name','hasOwnProperty','interface','format','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','isNil','initTelephones','isUndefined','telephones','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallercompleteAt','queuecallerabandonAt','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','ANSWERED','duration','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','merge','faxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c9c,0x1ec));var _0xc9c9=function(_0x47c902,_0x220fd2){_0x47c902=_0x47c902-0x0;var _0x1ad6a0=_0x9c9c[_0x47c902];return _0x1ad6a0;};'use strict';var BPromise=require('bluebird');var util=require(_0xc9c9('0x0'));var _=require(_0xc9c9('0x1'));var moment=require(_0xc9c9('0x2'));var Agent=require(_0xc9c9('0x3'));var Telephone=require(_0xc9c9('0x4'));var Trunk=require(_0xc9c9('0x5'));var VoiceQueue=require(_0xc9c9('0x6'));var Trigger=require(_0xc9c9('0x7'));var Template=require('../model/template');var Campaign=require(_0xc9c9('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xc9c9('0x9'));var FreshdeskAccount=require(_0xc9c9('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xc9c9('0xb'));var DeskAccount=require(_0xc9c9('0xc'));var VtigerAccount=require(_0xc9c9('0xd'));var ServicenowAccount=require(_0xc9c9('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xc9c9('0xf'));var Realtime=function(){this[_0xc9c9('0x10')]={};this['telephones']={};this[_0xc9c9('0x11')]={};this[_0xc9c9('0x12')]={};this[_0xc9c9('0x13')]={};this[_0xc9c9('0x14')]={};this['templates']={};this[_0xc9c9('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc9c9('0x16')]={};this['channels']={};this[_0xc9c9('0x17')]={};this[_0xc9c9('0x18')]={};this[_0xc9c9('0x19')]={};this[_0xc9c9('0x1a')]={};this[_0xc9c9('0x1b')]={};this['sugarcrmAccounts']={};this[_0xc9c9('0x1c')]={};this[_0xc9c9('0x1d')]={};this['deskAccounts']={};this[_0xc9c9('0x1e')]={};this[_0xc9c9('0x1f')]={};this[_0xc9c9('0x20')]={};this[_0xc9c9('0x21')]={};this['faxAccounts']={};};function freeIsNotKey(_0x3bfe17,_0x23f99a,_0x2e968e){var _0x46311b=_[_0xc9c9('0x22')](_0x3bfe17,function(_0x1e3407,_0x562470){return _0x1e3407[_0x2e968e];});for(var _0x3d4595 in _0x23f99a){if(_0x23f99a['hasOwnProperty'](_0x3d4595)){if(!_0x46311b[_0x3d4595]){delete _0x23f99a[_0x3d4595];}}}}function freeIsNotKeySip(_0x2ea8f7,_0x3ce1e7){var _0x326d9d=_[_0xc9c9('0x22')](_0x2ea8f7,function(_0x3a74c1,_0x2c7bd9){return util['format'](_0xc9c9('0x23'),_0x3a74c1[_0xc9c9('0x24')]);});for(var _0x2ba686 in _0x3ce1e7){if(_0x3ce1e7[_0xc9c9('0x25')](_0x2ba686)){if(!_0x326d9d[_0x2ba686]){delete _0x3ce1e7[_0x2ba686];}}}}function freeIsNotKeyAgent(_0x39ab18,_0x292366){var _0x5440d5=_[_0xc9c9('0x22')](_0x39ab18,function(_0x18b652,_0x5d097c){var _0x23667a=_['isNil'](_0x18b652[_0xc9c9('0x26')])?util[_0xc9c9('0x27')](_0xc9c9('0x23'),_0x18b652[_0xc9c9('0x24')]):_0x18b652['interface'];return _0x23667a;});for(var _0x501b91 in _0x292366){if(_0x292366[_0xc9c9('0x25')](_0x501b91)){if(!_0x5440d5[_0x501b91]){delete _0x292366[_0x501b91];}}}}function clearVoiceCallReports(_0x2c0fbb){_0x2c0fbb[_0xc9c9('0x28')]=0x0;_0x2c0fbb[_0xc9c9('0x29')]=0x0;_0x2c0fbb[_0xc9c9('0x2a')]=0x0;_0x2c0fbb[_0xc9c9('0x2b')]=0x0;_0x2c0fbb[_0xc9c9('0x2c')]=0x0;}function clearCampaigns(_0x142620){if(!_[_0xc9c9('0x2d')](_0x142620)){for(var _0x2063da in _0x142620){if(_0x142620[_0xc9c9('0x25')](_0x2063da)){_0x142620[_0x2063da][_0xc9c9('0x2e')]=0x0;_0x142620[_0x2063da][_0xc9c9('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x30313d){if(!_[_0xc9c9('0x2d')](_0x30313d)){for(var _0x194ca6 in _0x30313d){if(_0x30313d[_0xc9c9('0x25')](_0x194ca6)){_0x30313d[_0x194ca6]['total']=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x29')]=0x0;_0x30313d[_0x194ca6]['unmanaged']=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x30')]=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x2a')]=0x0;_0x30313d[_0x194ca6]['sumDuration']=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x2c')]=0x0;_0x30313d[_0x194ca6]['outboundAnswerAgiCallsDay']=0x0;_0x30313d[_0x194ca6]['outboundNoAnswerCallsDay']=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x31')]=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x32')]=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x33')]=0x0;_0x30313d[_0x194ca6]['outboundUnknownCallsDay']=0x0;_0x30313d[_0x194ca6]['outboundDropCallsDayTimeout']=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x34')]=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x35')]=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x36')]=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x37')]=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x38')]=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x39')]=0x0;_0x30313d[_0x194ca6][_0xc9c9('0x3a')]=0x0;_0x30313d[_0x194ca6]['queueStatusComplete']=!![];}}}}Realtime[_0xc9c9('0x3b')][_0xc9c9('0x3c')]=function(_0x8c9212,_0x275481){for(var _0x4e1d0d in _0x275481){if(_0x8c9212[_0xc9c9('0x25')](_0x4e1d0d)){_0x8c9212[_0x4e1d0d]=_0x275481[_0x4e1d0d];}}};Realtime[_0xc9c9('0x3b')][_0xc9c9('0x3d')]=function(){var _0x5e58f7=this;return function(_0x54a6ac){if(_0x54a6ac){freeIsNotKeyAgent(_0x54a6ac,_0x5e58f7[_0xc9c9('0x10')]);for(var _0x4cba0d=0x0,_0x2fa1ac={},_0x47f6a0={};_0x4cba0d<_0x54a6ac[_0xc9c9('0x3e')];_0x4cba0d+=0x1){_0x2fa1ac=_0x54a6ac[_0x4cba0d];var _0x1563f7=_[_0xc9c9('0x3f')](_0x2fa1ac[_0xc9c9('0x26')])?util[_0xc9c9('0x27')](_0xc9c9('0x23'),_0x2fa1ac[_0xc9c9('0x24')]):_0x2fa1ac[_0xc9c9('0x26')];if(_['isUndefined'](_0x5e58f7[_0xc9c9('0x10')][_0x1563f7])){_0x5e58f7[_0xc9c9('0x10')][_0x1563f7]=new Agent(_0x2fa1ac);}else{_0x5e58f7[_0xc9c9('0x3c')](_0x5e58f7['agents'][_0x1563f7],_0x2fa1ac);}}}return _0x5e58f7[_0xc9c9('0x10')];};};Realtime[_0xc9c9('0x3b')][_0xc9c9('0x40')]=function(){var _0x390e4f=this;return function(_0x32bd17){if(_0x32bd17){freeIsNotKeySip(_0x32bd17,_0x390e4f['telephones']);for(var _0x5382d3=0x0,_0x1120bd={},_0x2ec1c5={};_0x5382d3<_0x32bd17[_0xc9c9('0x3e')];_0x5382d3+=0x1){_0x1120bd=_0x32bd17[_0x5382d3];if(_[_0xc9c9('0x41')](_0x390e4f[_0xc9c9('0x42')][util[_0xc9c9('0x27')](_0xc9c9('0x23'),_0x1120bd[_0xc9c9('0x24')])])){_0x390e4f[_0xc9c9('0x42')][util[_0xc9c9('0x27')]('SIP/%s',_0x1120bd[_0xc9c9('0x24')])]=new Telephone(_0x1120bd);}else{_0x390e4f['mergeFromDatabase'](_0x390e4f[_0xc9c9('0x42')][util['format'](_0xc9c9('0x23'),_0x1120bd[_0xc9c9('0x24')])],_0x1120bd);}}}return _0x390e4f[_0xc9c9('0x42')];};};Realtime['prototype']['initTrunks']=function(){var _0x18111f=this;return function(_0x4c813f){if(_0x4c813f){freeIsNotKeySip(_0x4c813f,_0x18111f['trunks']);for(var _0x19463a=0x0,_0x243cfe={},_0x27a406={};_0x19463a<_0x4c813f[_0xc9c9('0x3e')];_0x19463a+=0x1){_0x243cfe=_0x4c813f[_0x19463a];if(_[_0xc9c9('0x41')](_0x18111f[_0xc9c9('0x11')][util['format'](_0xc9c9('0x23'),_0x243cfe[_0xc9c9('0x24')])])){_0x18111f['trunks'][util['format'](_0xc9c9('0x23'),_0x243cfe[_0xc9c9('0x24')])]=new Trunk(_0x243cfe);}else{_0x18111f['mergeFromDatabase'](_0x18111f[_0xc9c9('0x11')][util[_0xc9c9('0x27')](_0xc9c9('0x23'),_0x243cfe[_0xc9c9('0x24')])],_0x243cfe);}}}return _0x18111f[_0xc9c9('0x11')];};};Realtime[_0xc9c9('0x3b')][_0xc9c9('0x43')]=function(){var _0x4aa2ea=this;return function(_0x2741fa){if(_0x2741fa){freeIsNotKey(_0x2741fa,_0x4aa2ea[_0xc9c9('0x12')],'name');for(var _0x27e7f9=0x0,_0x2001fc={},_0x4d9da3={};_0x27e7f9<_0x2741fa['length'];_0x27e7f9+=0x1){_0x2001fc=_0x2741fa[_0x27e7f9];if(_[_0xc9c9('0x41')](_0x4aa2ea[_0xc9c9('0x12')][_0x2001fc[_0xc9c9('0x24')]])){_0x4aa2ea['voiceQueues'][_0x2001fc[_0xc9c9('0x24')]]=new VoiceQueue(_0x2001fc);}else{_0x4aa2ea['mergeFromDatabase'](_0x4aa2ea[_0xc9c9('0x12')][_0x2001fc[_0xc9c9('0x24')]],_0x2001fc);}}}return _0x4aa2ea[_0xc9c9('0x12')];};};Realtime['prototype'][_0xc9c9('0x44')]=function(){var _0x21a911=this;return function(_0x5ac21a){if(_0x5ac21a){freeIsNotKey(_0x5ac21a,_0x21a911[_0xc9c9('0x13')],'id');for(var _0x437482=0x0,_0x22ddd0={},_0x257670={};_0x437482<_0x5ac21a[_0xc9c9('0x3e')];_0x437482+=0x1){_0x22ddd0=_0x5ac21a[_0x437482];if(_['isUndefined'](_0x21a911[_0xc9c9('0x13')][_0x22ddd0['id']])){_0x21a911[_0xc9c9('0x13')][_0x22ddd0['id']]=new Trigger(_0x22ddd0);}else{_0x21a911['mergeFromDatabase'](_0x21a911['triggers'][_0x22ddd0['id']],_0x22ddd0);}}}return _0x21a911[_0xc9c9('0x13')];};};Realtime[_0xc9c9('0x3b')][_0xc9c9('0x45')]=function(){var _0x382ee2=this;return function(_0x19ac5f){if(_0x19ac5f){freeIsNotKey(_0x19ac5f,_0x382ee2[_0xc9c9('0x46')],'id');for(var _0xa0a6f7=0x0,_0x413e65={},_0x31162f={};_0xa0a6f7<_0x19ac5f[_0xc9c9('0x3e')];_0xa0a6f7+=0x1){_0x413e65=_0x19ac5f[_0xa0a6f7];if(_[_0xc9c9('0x41')](_0x382ee2[_0xc9c9('0x46')][_0x413e65['id']])){_0x382ee2[_0xc9c9('0x46')][_0x413e65['id']]=new Template(_0x413e65);}else{_0x382ee2[_0xc9c9('0x3c')](_0x382ee2[_0xc9c9('0x46')][_0x413e65['id']],_0x413e65);}}}return _0x382ee2['templates'];};};Realtime[_0xc9c9('0x3b')][_0xc9c9('0x47')]=function(){var _0x35756d=this;return function(_0x3aebb4){if(_0x3aebb4){freeIsNotKey(_0x3aebb4,_0x35756d[_0xc9c9('0x1a')],'id');for(var _0x53ca05=0x0,_0x1d0199={},_0x5ce553={};_0x53ca05<_0x3aebb4[_0xc9c9('0x3e')];_0x53ca05+=0x1){_0x1d0199=_0x3aebb4[_0x53ca05];if(_[_0xc9c9('0x41')](_0x35756d[_0xc9c9('0x1a')][_0x1d0199['id']])){_0x35756d[_0xc9c9('0x1a')][_0x1d0199['id']]=new ZendeskAccount(_0x1d0199);}else{_0x35756d['mergeFromDatabase'](_0x35756d[_0xc9c9('0x1a')][_0x1d0199['id']],_0x1d0199);}}}return _0x35756d[_0xc9c9('0x1a')];};};Realtime[_0xc9c9('0x3b')][_0xc9c9('0x48')]=function(){var _0x34fa31=this;return function(_0x567e76){if(_0x567e76){freeIsNotKey(_0x567e76,_0x34fa31['salesforceAccounts'],'id');for(var _0x2bbc85=0x0,_0x5eee19={},_0x3fea16={};_0x2bbc85<_0x567e76['length'];_0x2bbc85+=0x1){_0x5eee19=_0x567e76[_0x2bbc85];if(_[_0xc9c9('0x41')](_0x34fa31[_0xc9c9('0x1b')][_0x5eee19['id']])){_0x34fa31[_0xc9c9('0x1b')][_0x5eee19['id']]=new SalesforceAccount(_0x5eee19);}else{_0x34fa31[_0xc9c9('0x3c')](_0x34fa31[_0xc9c9('0x1b')][_0x5eee19['id']],_0x5eee19);}}}return _0x34fa31['salesforceAccounts'];};};Realtime[_0xc9c9('0x3b')][_0xc9c9('0x49')]=function(){var _0x49ccdd=this;return function(_0x393728){if(_0x393728){freeIsNotKey(_0x393728,_0x49ccdd[_0xc9c9('0x1c')],'id');for(var _0x293c27=0x0,_0x219393={},_0x377d76={};_0x293c27<_0x393728['length'];_0x293c27+=0x1){_0x219393=_0x393728[_0x293c27];if(_[_0xc9c9('0x41')](_0x49ccdd[_0xc9c9('0x1c')][_0x219393['id']])){_0x49ccdd[_0xc9c9('0x1c')][_0x219393['id']]=new FreshdeskAccount(_0x219393);}else{_0x49ccdd['mergeFromDatabase'](_0x49ccdd[_0xc9c9('0x1c')][_0x219393['id']],_0x219393);}}}return _0x49ccdd[_0xc9c9('0x1c')];};};Realtime[_0xc9c9('0x3b')]['initZohoAccounts']=function(){var _0x48b58c=this;return function(_0x4a6e05){if(_0x4a6e05){freeIsNotKey(_0x4a6e05,_0x48b58c[_0xc9c9('0x1d')],'id');for(var _0x28e6a1=0x0,_0x4a82f6={},_0x167238={};_0x28e6a1<_0x4a6e05[_0xc9c9('0x3e')];_0x28e6a1+=0x1){_0x4a82f6=_0x4a6e05[_0x28e6a1];if(_[_0xc9c9('0x41')](_0x48b58c[_0xc9c9('0x1d')][_0x4a82f6['id']])){_0x48b58c[_0xc9c9('0x1d')][_0x4a82f6['id']]=new ZohoAccount(_0x4a82f6);}else{_0x48b58c[_0xc9c9('0x3c')](_0x48b58c['zohoAccounts'][_0x4a82f6['id']],_0x4a82f6);}}}return _0x48b58c[_0xc9c9('0x1d')];};};Realtime[_0xc9c9('0x3b')]['initDeskAccounts']=function(){var _0x233ac6=this;return function(_0x34e5a2){if(_0x34e5a2){freeIsNotKey(_0x34e5a2,_0x233ac6[_0xc9c9('0x4a')],'id');for(var _0x4cba70=0x0,_0x328a7c={},_0x20cff2={};_0x4cba70<_0x34e5a2[_0xc9c9('0x3e')];_0x4cba70+=0x1){_0x328a7c=_0x34e5a2[_0x4cba70];if(_[_0xc9c9('0x41')](_0x233ac6['deskAccounts'][_0x328a7c['id']])){_0x233ac6[_0xc9c9('0x4a')][_0x328a7c['id']]=new DeskAccount(_0x328a7c);}else{_0x233ac6[_0xc9c9('0x3c')](_0x233ac6[_0xc9c9('0x4a')][_0x328a7c['id']],_0x328a7c);}}}return _0x233ac6[_0xc9c9('0x4a')];};};Realtime[_0xc9c9('0x3b')][_0xc9c9('0x4b')]=function(){var _0x459de3=this;return function(_0x14ed89){if(_0x14ed89){freeIsNotKey(_0x14ed89,_0x459de3[_0xc9c9('0x4c')],'id');for(var _0x3e3a4d=0x0,_0x35435e={},_0x21e9e8={};_0x3e3a4d<_0x14ed89[_0xc9c9('0x3e')];_0x3e3a4d+=0x1){_0x35435e=_0x14ed89[_0x3e3a4d];if(_[_0xc9c9('0x41')](_0x459de3[_0xc9c9('0x4c')][_0x35435e['id']])){_0x459de3[_0xc9c9('0x4c')][_0x35435e['id']]=new SugarcrmAccount(_0x35435e);}else{_0x459de3[_0xc9c9('0x3c')](_0x459de3['sugarcrmAccounts'][_0x35435e['id']],_0x35435e);}}}return _0x459de3[_0xc9c9('0x4c')];};};Realtime['prototype'][_0xc9c9('0x4d')]=function(){var _0x379b44=this;return function(_0x48100b){if(_0x48100b){freeIsNotKey(_0x48100b,_0x379b44[_0xc9c9('0x1e')],'id');for(var _0x501a6f=0x0,_0x19ceac={},_0x34526c={};_0x501a6f<_0x48100b[_0xc9c9('0x3e')];_0x501a6f+=0x1){_0x19ceac=_0x48100b[_0x501a6f];if(_[_0xc9c9('0x41')](_0x379b44[_0xc9c9('0x1e')][_0x19ceac['id']])){_0x379b44[_0xc9c9('0x1e')][_0x19ceac['id']]=new VtigerAccount(_0x19ceac);}else{_0x379b44[_0xc9c9('0x3c')](_0x379b44[_0xc9c9('0x1e')][_0x19ceac['id']],_0x19ceac);}}}return _0x379b44[_0xc9c9('0x1e')];};};Realtime[_0xc9c9('0x3b')][_0xc9c9('0x4e')]=function(){var _0x5c5ba5=this;return function(_0x58358a){if(_0x58358a){freeIsNotKey(_0x58358a,_0x5c5ba5['servicenowAccounts'],'id');for(var _0xef3b0c=0x0,_0x59c2c0={},_0xa13797={};_0xef3b0c<_0x58358a[_0xc9c9('0x3e')];_0xef3b0c+=0x1){_0x59c2c0=_0x58358a[_0xef3b0c];if(_['isUndefined'](_0x5c5ba5[_0xc9c9('0x1f')][_0x59c2c0['id']])){_0x5c5ba5['servicenowAccounts'][_0x59c2c0['id']]=new ServicenowAccount(_0x59c2c0);}else{_0x5c5ba5['mergeFromDatabase'](_0x5c5ba5[_0xc9c9('0x1f')][_0x59c2c0['id']],_0x59c2c0);}}}return _0x5c5ba5[_0xc9c9('0x1f')];};};Realtime['prototype'][_0xc9c9('0x4f')]=function(){var _0x3ae8df=this;return function(_0x21666d){if(_0x21666d){freeIsNotKey(_0x21666d,_0x3ae8df[_0xc9c9('0x20')],'id');for(var _0xe035eb=0x0,_0x5670ea={},_0x32660d={};_0xe035eb<_0x21666d[_0xc9c9('0x3e')];_0xe035eb+=0x1){_0x5670ea=_0x21666d[_0xe035eb];if(_[_0xc9c9('0x41')](_0x3ae8df[_0xc9c9('0x20')][_0x5670ea['id']])){_0x3ae8df[_0xc9c9('0x20')][_0x5670ea['id']]=new Dynamics365Account(_0x5670ea);}else{_0x3ae8df[_0xc9c9('0x3c')](_0x3ae8df[_0xc9c9('0x20')][_0x5670ea['id']],_0x5670ea);}}}return _0x3ae8df['dynamics365Accounts'];};};Realtime[_0xc9c9('0x3b')]['initFreshsalesAccounts']=function(){var _0x1c84dd=this;return function(_0xc01dd2){if(_0xc01dd2){freeIsNotKey(_0xc01dd2,_0x1c84dd['freshsalesAccounts'],'id');for(var _0x53a823=0x0,_0x2665f1={},_0x502d05={};_0x53a823<_0xc01dd2[_0xc9c9('0x3e')];_0x53a823+=0x1){_0x2665f1=_0xc01dd2[_0x53a823];if(_[_0xc9c9('0x41')](_0x1c84dd[_0xc9c9('0x21')][_0x2665f1['id']])){_0x1c84dd[_0xc9c9('0x21')][_0x2665f1['id']]=new FreshsalesAccount(_0x2665f1);}else{_0x1c84dd[_0xc9c9('0x3c')](_0x1c84dd['freshsalesAccounts'][_0x2665f1['id']],_0x2665f1);}}}return _0x1c84dd[_0xc9c9('0x21')];};};Realtime['prototype'][_0xc9c9('0x50')]=function(){var _0xba1dbe=this;return function(_0x22c312){for(var _0x533c89=0x0;_0x533c89<_0x22c312[_0xc9c9('0x3e')];_0x533c89+=0x1){_['merge'](_0xba1dbe['voiceQueues'][_0x22c312[_0x533c89][_0xc9c9('0x24')]],_0x22c312[_0x533c89]);}return _0xba1dbe[_0xc9c9('0x12')];};};Realtime[_0xc9c9('0x3b')]['initVoiceQueueReports']=function(){var _0x442f2e=this;return function(_0x3928e5){clearVoiceQueues(_0x442f2e[_0xc9c9('0x12')]);if(_0x3928e5){_0x3928e5=_[_0xc9c9('0x51')](_0x3928e5,_0xc9c9('0x52'));for(var _0x3f748f in _0x3928e5){if(_0x3928e5[_0xc9c9('0x25')](_0x3f748f)){var _0x2ff74a={};for(var _0xa095c9=0x0;_0xa095c9<_0x3928e5[_0x3f748f]['length'];_0xa095c9+=0x1){var _0x48694e=_0x3928e5[_0x3f748f][_0xa095c9][_0xc9c9('0x53')];if(_0x442f2e[_0xc9c9('0x12')][_0x48694e]){if(_0x3928e5[_0x3f748f][_0xa095c9][_0xc9c9('0x54')]){_0x442f2e['voiceQueues'][_0x48694e][_0xc9c9('0x55')]+=0x1;}if(_0x3928e5[_0x3f748f][_0xa095c9][_0xc9c9('0x56')]){_0x442f2e[_0xc9c9('0x12')][_0x48694e][_0xc9c9('0x30')]+=0x1;}_0x442f2e[_0xc9c9('0x12')][_0x48694e][_0xc9c9('0x2a')]+=moment(_0x3928e5[_0x3f748f][_0xa095c9][_0xc9c9('0x57')])[_0xc9c9('0x58')](moment(_0x3928e5[_0x3f748f][_0xa095c9]['queuecallerjoinAt']),'seconds')||0x0;if(_0xa095c9===_0x3928e5[_0x3f748f]['length']-0x1){_0x442f2e[_0xc9c9('0x12')][_0x48694e][_0xc9c9('0x2b')]+=moment(_0x3928e5[_0x3f748f][_0xa095c9][_0xc9c9('0x59')]||_0x3928e5[_0x3f748f][_0xa095c9][_0xc9c9('0x5a')]||_0x3928e5[_0x3f748f][_0xa095c9]['queuecallerexitAt'])[_0xc9c9('0x58')](moment(_0x3928e5[_0x3f748f][_0xa095c9][_0xc9c9('0x5b')]),'seconds')||0x0;_0x442f2e['voiceQueues'][_0x48694e][_0xc9c9('0x28')]+=0x1;if(_0x3928e5[_0x3f748f][_0xa095c9][_0xc9c9('0x5c')]){_0x442f2e[_0xc9c9('0x12')][_0x48694e][_0xc9c9('0x29')]+=0x1;_0x442f2e[_0xc9c9('0x12')][_0x48694e][_0xc9c9('0x2c')]+=moment(_0x3928e5[_0x3f748f][_0xa095c9]['queuecallercompleteAt'])[_0xc9c9('0x58')](moment(_0x3928e5[_0x3f748f][_0xa095c9]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x442f2e['voiceQueues'][_0x48694e][_0xc9c9('0x2b')]+=_0x442f2e[_0xc9c9('0x12')][_0x48694e][_0xc9c9('0x2a')]||0x0;}}}}}}return _0x442f2e[_0xc9c9('0x12')];};};Realtime[_0xc9c9('0x3b')][_0xc9c9('0x5d')]=function(){var _0xc24eb8=this;return function(_0x2bf733){clearVoiceCallReports(_0xc24eb8[_0xc9c9('0x15')]);if(_0x2bf733){for(var _0x1735d6=0x0;_0x1735d6<_0x2bf733[_0xc9c9('0x3e')];_0x1735d6+=0x1){_0xc24eb8[_0xc9c9('0x15')][_0xc9c9('0x28')]+=0x1;_0xc24eb8[_0xc9c9('0x15')]['sumDuration']+=_0x2bf733[_0x1735d6]['duration'];if(_0x2bf733[_0x1735d6]['disposition']===_0xc9c9('0x5e')){_0xc24eb8[_0xc9c9('0x15')][_0xc9c9('0x29')]+=0x1;_0xc24eb8['outbound'][_0xc9c9('0x2a')]+=_0x2bf733[_0x1735d6][_0xc9c9('0x5f')]-_0x2bf733[_0x1735d6][_0xc9c9('0x60')]||0x0;_0xc24eb8[_0xc9c9('0x15')][_0xc9c9('0x2c')]+=_0x2bf733[_0x1735d6][_0xc9c9('0x60')];}}}return _0xc24eb8[_0xc9c9('0x15')];};};Realtime[_0xc9c9('0x3b')]['initCampaigns']=function(){var _0x1b9849=this;return function(_0x55305c){if(_0x55305c){freeIsNotKey(_0x55305c,_0x1b9849[_0xc9c9('0x14')],'name');for(var _0x4e5682=0x0,_0x1fea22={};_0x4e5682<_0x55305c[_0xc9c9('0x3e')];_0x4e5682+=0x1){_0x1fea22=_0x55305c[_0x4e5682];if(_[_0xc9c9('0x41')](_0x1b9849['campaigns'][_0x1fea22[_0xc9c9('0x24')]])){_0x1b9849[_0xc9c9('0x14')][_0x1fea22[_0xc9c9('0x24')]]=new Campaign(_0x1fea22);}else{_0x1b9849['mergeFromDatabase'](_0x1b9849[_0xc9c9('0x14')][_0x1fea22[_0xc9c9('0x24')]],_0x1fea22);_0x1b9849[_0xc9c9('0x14')][_0x1fea22[_0xc9c9('0x24')]][_0xc9c9('0x61')]=_0x1fea22[_0xc9c9('0x62')]?_0x1fea22[_0xc9c9('0x62')]['name']:undefined;}}}return _0x1b9849[_0xc9c9('0x14')];};};Realtime[_0xc9c9('0x3b')][_0xc9c9('0x63')]=function(){var _0x17c8c9=this;return function(_0x526522){if(_0x526522){freeIsNotKey(_0x526522,_0x17c8c9[_0xc9c9('0x16')],'id');for(var _0x33eec0=0x0,_0x455b73={};_0x33eec0<_0x526522[_0xc9c9('0x3e')];_0x33eec0+=0x1){_0x455b73=_0x526522[_0x33eec0];if(_[_0xc9c9('0x41')](_0x17c8c9[_0xc9c9('0x16')][_0x455b73['id']])){_0x17c8c9[_0xc9c9('0x16')][_0x455b73['id']]=new VoiceExtension(_0x455b73);}else{_0x17c8c9[_0xc9c9('0x3c')](_0x17c8c9['voiceExtensions'][_0x455b73['id']],_0x455b73);}}}return _0x17c8c9['voiceExtensions'];};};Realtime[_0xc9c9('0x3b')]['initCampaignHopperHistory']=function(){var _0x33f97d=this;return function(_0x4c3f32){clearCampaigns(_0x33f97d[_0xc9c9('0x14')]);for(var _0x4a5aee=0x0;_0x4a5aee<_0x4c3f32[_0xc9c9('0x3e')];_0x4a5aee+=0x1){_[_0xc9c9('0x64')](_0x33f97d['campaigns'][_0x4c3f32[_0x4a5aee]['name']],_0x4c3f32[_0x4a5aee]);}return _0x33f97d[_0xc9c9('0x14')];};};Realtime[_0xc9c9('0x3b')]['initFaxAccounts']=function(){var _0x15ceee=this;return function(_0x2eb1c8){if(_0x2eb1c8){freeIsNotKey(_0x2eb1c8,_0x15ceee[_0xc9c9('0x65')],'id');for(var _0x500081=0x0,_0x1f543d={},_0x18db3f={};_0x500081<_0x2eb1c8[_0xc9c9('0x3e')];_0x500081+=0x1){_0x1f543d=_0x2eb1c8[_0x500081];if(_[_0xc9c9('0x41')](_0x15ceee[_0xc9c9('0x65')][_0x1f543d['id']])){_0x15ceee['faxAccounts'][_0x1f543d['id']]=new FaxAccount(_0x1f543d);}else{_0x15ceee['mergeFromDatabase'](_0x15ceee['faxAccounts'][_0x1f543d['id']],_0x1f543d);}}}return _0x15ceee[_0xc9c9('0x65')];};};module[_0xc9c9('0x66')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 2306257..4e33f7a 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 _0xea8d=['assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','destination','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','calleridname','transfers','linkedid','uniqueid','monitor','monitors','length','monitorFilename','createdAt','exten','connectedlinename','membername','forEach','startsWith','Local','substring','indexOf','phone','lastIndexOf','exports','lodash','moment','../../../config/environment','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','sync','realtime','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','prototype','findAgent','find','name','isNil','format','SIP/%s','connectedlinenum','accountcode'];(function(_0x16a244,_0x31d392){var _0x374334=function(_0x1f7ac5){while(--_0x1f7ac5){_0x16a244['push'](_0x16a244['shift']());}};_0x374334(++_0x31d392);}(_0xea8d,0x121));var _0xdea8=function(_0x50cf7e,_0x50787b){_0x50cf7e=_0x50cf7e-0x0;var _0x1d74ec=_0xea8d[_0x50cf7e];return _0x1d74ec;};'use strict';var _=require(_0xdea8('0x0'));var moment=require(_0xdea8('0x1'));var util=require('util');var config=require(_0xdea8('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xdea8('0x3'));var RpcVoiceDialReport=require(_0xdea8('0x4'));var RpcMemberReport=require(_0xdea8('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xdea8('0x6'));var RpcVoiceTransferReport=require(_0xdea8('0x7'));var VoiceQueueReport=require(_0xdea8('0x8'));var VoiceCallReport=require(_0xdea8('0x9'));var VoiceAgentReport=require(_0xdea8('0xa'));var VoiceDialReport=require(_0xdea8('0xb'));var UserReport=require(_0xdea8('0xc'));function Report(_0x50f674){this['realtime']=_0x50f674;this[_0xdea8('0xd')]=_0x50f674[_0xdea8('0xd')];this[_0xdea8('0xe')]=_0x50f674[_0xdea8('0xe')];}Report['prototype'][_0xdea8('0xf')]=function(_0x38545e){var _0x8c410e=new VoiceQueueReport(this[_0xdea8('0x10')]);var _0x2e8a9c=new VoiceAgentReport(this[_0xdea8('0x10')]);var _0x54550f=new VoiceDialReport(this[_0xdea8('0x10')]);var _0x2a82e3=new VoiceCallReport(this[_0xdea8('0x10')]);var _0x5746be=new UserReport(this['realtime']);if(config['xdr']&&config['xdr'][_0xdea8('0x11')]){ami['on'](_0xdea8('0x12'),this[_0xdea8('0x13')][_0xdea8('0x14')](this));ami['on'](_0xdea8('0x15'),this[_0xdea8('0x16')][_0xdea8('0x14')](this));ami['on'](_0xdea8('0x17'),this[_0xdea8('0x18')][_0xdea8('0x14')](this));ami['on'](_0xdea8('0x19'),this[_0xdea8('0x1a')]['bind'](this));ami['on'](_0xdea8('0x1b'),this[_0xdea8('0x1c')][_0xdea8('0x14')](this));ami['on']('attendedtransfer',this[_0xdea8('0x1d')][_0xdea8('0x14')](this));}};Report[_0xdea8('0x1e')][_0xdea8('0x1f')]=function(_0x10cf11){var _0x4eb88f;_0x4eb88f=_[_0xdea8('0x20')](this[_0xdea8('0xd')],function(_0x5e4eae){return _0x5e4eae['accountcode']==_0x10cf11||_0x5e4eae[_0xdea8('0x21')]==_0x10cf11;});if(_[_0xdea8('0x22')](_0x4eb88f)){var _0x124a88=_['find'](this['telephones'],function(_0x34b177){return _0x34b177['accountcode']==_0x10cf11||_0x34b177[_0xdea8('0x21')]==_0x10cf11;});if(_0x124a88){_0x4eb88f=_[_0xdea8('0x20')](this[_0xdea8('0xd')],function(_0x54c762){return _0x54c762['interface']==util[_0xdea8('0x23')](_0xdea8('0x24'),_0x124a88['name']);});}}return _0x4eb88f;};Report[_0xdea8('0x1e')]['voiceQueueReport']=function(_0x460277){for(var _0x7781c3=0x0;_0x7781c3<_0x460277['length'];_0x7781c3+=0x1){var _0x5d9442=this['findAgent'](_0x460277[_0x7781c3][_0xdea8('0x25')]);if(_0x5d9442){_0x460277[_0x7781c3]['accountcode']=_0x5d9442[_0xdea8('0x26')];_0x460277[_0x7781c3][_0xdea8('0x27')]=!![];_0x460277[_0x7781c3][_0xdea8('0x28')]=_0x5d9442[_0xdea8('0x21')];_0x460277[_0x7781c3][_0xdea8('0x29')]=_[_0xdea8('0x22')](_0x5d9442[_0xdea8('0x29')])?util[_0xdea8('0x23')](_0xdea8('0x24'),_0x5d9442['name']):_0x5d9442['interface'];if(_0x460277[_0x7781c3][_0xdea8('0x2a')]){_0x460277[_0x7781c3][_0xdea8('0x2b')]=moment()[_0xdea8('0x23')](_0xdea8('0x2c'));}if(_0x460277[_0x7781c3][_0xdea8('0x2d')]){_0x460277[_0x7781c3]['queuecallerexitAt']=moment()[_0xdea8('0x23')](_0xdea8('0x2c'));}RpcMemberReport[_0xdea8('0x13')](_0x460277[_0x7781c3]);}RpcVoiceQueueReport[_0xdea8('0x2e')](_0x460277[_0x7781c3]);}};function extractCalleridNumber(_0x5d4f8e){var _0x2671a0=_0x5d4f8e[_0xdea8('0x2f')](/<(.*?)>/);return _0x2671a0?_0x2671a0[0x1]:_0x5d4f8e;}Report['prototype'][_0xdea8('0x16')]=function(_0x27db33){_0x27db33[_0xdea8('0x30')]=_0x27db33[_0xdea8('0x30')]||_0x27db33['exten'];if(_0x27db33['type']=='dialer'){_0x27db33['lastapplication']=_0xdea8('0x31');_0x27db33[_0xdea8('0x32')]=_0x27db33['queue'];if(_0x27db33[_0xdea8('0x33')]==_0xdea8('0x34')){_0x27db33[_0xdea8('0x26')]='';_0x27db33['destination']=extractCalleridNumber(_0x27db33[_0xdea8('0x35')]);}else if(_0x27db33['context']==_0xdea8('0x36')){if(_0x27db33[_0xdea8('0x30')]==_0xdea8('0x37')){_0x27db33[_0xdea8('0x30')]=extractCalleridNumber(_0x27db33[_0xdea8('0x38')]);_0x27db33[_0xdea8('0x39')]=_0x27db33[_0xdea8('0x3a')];_0x27db33[_0xdea8('0x3b')]=[_0x27db33['channel'],_0x27db33[_0xdea8('0x3c')]=_0x27db33[_0xdea8('0x3b')]][0x0];_0x27db33['callerid']=_0x27db33[_0xdea8('0x38')];}else{_0x27db33[_0xdea8('0x30')]=_0x27db33[_0xdea8('0x39')];_0x27db33[_0xdea8('0x39')]=_0x27db33[_0xdea8('0x3a')];if(_0x27db33['disposition']==_0xdea8('0x3d')){_0x27db33[_0xdea8('0x26')]=_0x27db33[_0xdea8('0x25')];}else{_0x27db33[_0xdea8('0x26')]='';}}}}else{_0x27db33[_0xdea8('0x35')]=util[_0xdea8('0x23')]('\x22%s\x22\x20<%s>',_0x27db33[_0xdea8('0x3e')],_0x27db33['calleridnum']);}if(RpcVoiceTransferReport[_0xdea8('0x3f')][_0x27db33[_0xdea8('0x40')]]){var _0x368bd3=RpcVoiceTransferReport[_0xdea8('0x3f')][_0x27db33[_0xdea8('0x40')]];_0x368bd3['transfereelinkedid']=_0x27db33[_0xdea8('0x41')];RpcVoiceTransferReport[_0xdea8('0x1c')](_0x368bd3);delete RpcVoiceTransferReport[_0xdea8('0x3f')][_0x27db33[_0xdea8('0x40')]];}RpcVoiceCallReport[_0xdea8('0x2e')](_0x27db33);if(_0x27db33[_0xdea8('0x42')]){for(var _0x22fe13=0x0;_0x22fe13<_0x27db33[_0xdea8('0x43')][_0xdea8('0x44')];_0x22fe13+=0x1){_0x27db33[_0xdea8('0x45')]=_0x27db33['monitors'][_0x22fe13]['filename'];_0x27db33['createdAt']=_0x27db33[_0xdea8('0x43')][_0x22fe13][_0xdea8('0x46')];if(_0x27db33[_0xdea8('0x47')]=='xcally-motion-preview'){_0x27db33['calleridnum']=_0x27db33[_0xdea8('0x25')];_0x27db33[_0xdea8('0x3e')]=_0x27db33[_0xdea8('0x48')];_0x27db33[_0xdea8('0x25')]=_0x27db33[_0xdea8('0x26')];_0x27db33[_0xdea8('0x48')]=_0x27db33[_0xdea8('0x49')];_0x27db33[_0xdea8('0x47')]=_0x27db33[_0xdea8('0x3a')];}else if(_0x27db33[_0xdea8('0x47')]=='xcally-motion-dialer'){_0x27db33[_0xdea8('0x39')]=_0x27db33[_0xdea8('0x30')];_0x27db33[_0xdea8('0x47')]=_0x27db33['originatecalleridnum'];}RpcVoiceRecording['create'](_0x27db33);}}};Report[_0xdea8('0x1e')]['voiceAgentReport']=function(_0x1a8794){if(_['isArray'](_0x1a8794)){_0x1a8794[_0xdea8('0x4a')](function(_0x1cc58b){RpcVoiceAgentReport[_0xdea8('0x2e')](_0x1cc58b);});}else{RpcVoiceAgentReport[_0xdea8('0x2e')](_0x1a8794);}};Report[_0xdea8('0x1e')][_0xdea8('0x1a')]=function(_0x3364dc){RpcVoiceDialReport[_0xdea8('0x2e')](_0x3364dc);var _0x10a5fe;var _0x4f53e8;var _0x34daf3=_0x3364dc[_0xdea8('0x3c')];if(_[_0xdea8('0x4b')](_0x34daf3,_0xdea8('0x4c'))){_0x4f53e8=_0x34daf3[_0xdea8('0x4d')](_0x34daf3[_0xdea8('0x4e')]('/')+0x1,_0x34daf3[_0xdea8('0x4e')]('@'));_0x10a5fe=_[_0xdea8('0x20')](this['agents'],function(_0x2d4a69){return _0x2d4a69['mobile']==_0x4f53e8||_0x2d4a69[_0xdea8('0x4f')]==_0x4f53e8||_0x2d4a69['accountcode']==_0x4f53e8;});}else{_0x4f53e8=_0x34daf3[_0xdea8('0x4d')](_0x34daf3[_0xdea8('0x4e')]('/')+0x1,_0x34daf3[_0xdea8('0x50')]('-'));_0x10a5fe=this[_0xdea8('0x1f')](_0x4f53e8);}if(_0x10a5fe){_0x3364dc[_0xdea8('0x29')]=_[_0xdea8('0x22')](_0x10a5fe[_0xdea8('0x29')])?util[_0xdea8('0x23')](_0xdea8('0x24'),_0x10a5fe['name']):_0x10a5fe[_0xdea8('0x29')];_0x3364dc[_0xdea8('0x49')]=_0x10a5fe[_0xdea8('0x21')];_0x3364dc['accountcode']=_0x10a5fe[_0xdea8('0x26')];RpcMemberReport[_0xdea8('0x1a')](_0x3364dc);}};Report[_0xdea8('0x1e')][_0xdea8('0x1c')]=function(_0x4de931){RpcVoiceTransferReport[_0xdea8('0x3f')][_0x4de931['transfererlinkedid']]=_0x4de931;};Report[_0xdea8('0x1e')][_0xdea8('0x1d')]=function(_0x41c57d){RpcVoiceTransferReport[_0xdea8('0x1d')](_0x41c57d);};module[_0xdea8('0x51')]=Report; \ No newline at end of file +var _0xfa83=['SIP/%s','length','findAgent','connectedlinenum','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','ANSWERED','\x22%s\x22\x20<%s>','calleridname','calleridnum','linkedid','transfereelinkedid','uniqueid','transfers','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','startsWith','Local','substring','mobile','indexOf','lastIndexOf','isNil','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','interface'];(function(_0x57ec1a,_0x2b7624){var _0x2159ad=function(_0x4738b4){while(--_0x4738b4){_0x57ec1a['push'](_0x57ec1a['shift']());}};_0x2159ad(++_0x2b7624);}(_0xfa83,0x1f2));var _0x3fa8=function(_0x59d928,_0x33776c){_0x59d928=_0x59d928-0x0;var _0x68df47=_0xfa83[_0x59d928];return _0x68df47;};'use strict';var _=require(_0x3fa8('0x0'));var moment=require(_0x3fa8('0x1'));var util=require(_0x3fa8('0x2'));var config=require('../../../config/environment');var ami=require(_0x3fa8('0x3'));var RpcVoiceAgentReport=require(_0x3fa8('0x4'));var RpcVoiceCallReport=require(_0x3fa8('0x5'));var RpcVoiceDialReport=require(_0x3fa8('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x3fa8('0x7'));var RpcVoiceRecording=require(_0x3fa8('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x3fa8('0x9'));var VoiceCallReport=require(_0x3fa8('0xa'));var VoiceAgentReport=require(_0x3fa8('0xb'));var VoiceDialReport=require(_0x3fa8('0xc'));var UserReport=require(_0x3fa8('0xd'));function Report(_0x186463){this[_0x3fa8('0xe')]=_0x186463;this[_0x3fa8('0xf')]=_0x186463[_0x3fa8('0xf')];this[_0x3fa8('0x10')]=_0x186463[_0x3fa8('0x10')];}Report[_0x3fa8('0x11')][_0x3fa8('0x12')]=function(_0xae10ab){var _0x360181=new VoiceQueueReport(this[_0x3fa8('0xe')]);var _0x283af0=new VoiceAgentReport(this[_0x3fa8('0xe')]);var _0x5ef98c=new VoiceDialReport(this[_0x3fa8('0xe')]);var _0x5a2f67=new VoiceCallReport(this[_0x3fa8('0xe')]);var _0x6c924=new UserReport(this['realtime']);if(config['xdr']&&config[_0x3fa8('0x13')][_0x3fa8('0x14')]){ami['on'](_0x3fa8('0x15'),this[_0x3fa8('0x16')][_0x3fa8('0x17')](this));ami['on'](_0x3fa8('0x18'),this['voiceCallReport'][_0x3fa8('0x17')](this));ami['on'](_0x3fa8('0x19'),this[_0x3fa8('0x1a')][_0x3fa8('0x17')](this));ami['on']('custom:voiceDialReport',this[_0x3fa8('0x1b')][_0x3fa8('0x17')](this));ami['on'](_0x3fa8('0x1c'),this[_0x3fa8('0x1d')]['bind'](this));ami['on'](_0x3fa8('0x1e'),this[_0x3fa8('0x1f')][_0x3fa8('0x17')](this));}};Report[_0x3fa8('0x11')]['findAgent']=function(_0x407e62){var _0x8e05bd;_0x8e05bd=_[_0x3fa8('0x20')](this['agents'],function(_0x495418){return _0x495418[_0x3fa8('0x21')]==_0x407e62||_0x495418[_0x3fa8('0x22')]==_0x407e62;});if(_['isNil'](_0x8e05bd)){var _0x49cedd=_[_0x3fa8('0x20')](this['telephones'],function(_0x4da072){return _0x4da072[_0x3fa8('0x21')]==_0x407e62||_0x4da072[_0x3fa8('0x22')]==_0x407e62;});if(_0x49cedd){_0x8e05bd=_[_0x3fa8('0x20')](this[_0x3fa8('0xf')],function(_0x1b1766){return _0x1b1766[_0x3fa8('0x23')]==util['format'](_0x3fa8('0x24'),_0x49cedd['name']);});}}return _0x8e05bd;};Report[_0x3fa8('0x11')]['voiceQueueReport']=function(_0x15b633){for(var _0x378e89=0x0;_0x378e89<_0x15b633[_0x3fa8('0x25')];_0x378e89+=0x1){var _0x3e1357=this[_0x3fa8('0x26')](_0x15b633[_0x378e89][_0x3fa8('0x27')]);if(_0x3e1357){_0x15b633[_0x378e89]['accountcode']=_0x3e1357['accountcode'];_0x15b633[_0x378e89]['assigned']=!![];_0x15b633[_0x378e89][_0x3fa8('0x28')]=_0x3e1357[_0x3fa8('0x22')];_0x15b633[_0x378e89][_0x3fa8('0x23')]=_['isNil'](_0x3e1357[_0x3fa8('0x23')])?util[_0x3fa8('0x29')]('SIP/%s',_0x3e1357[_0x3fa8('0x22')]):_0x3e1357['interface'];if(_0x15b633[_0x378e89][_0x3fa8('0x2a')]){_0x15b633[_0x378e89][_0x3fa8('0x2b')]=moment()[_0x3fa8('0x29')](_0x3fa8('0x2c'));}if(_0x15b633[_0x378e89][_0x3fa8('0x2d')]){_0x15b633[_0x378e89][_0x3fa8('0x2e')]=moment()[_0x3fa8('0x29')](_0x3fa8('0x2c'));}RpcMemberReport[_0x3fa8('0x16')](_0x15b633[_0x378e89]);}RpcVoiceQueueReport['create'](_0x15b633[_0x378e89]);}};function extractCalleridNumber(_0x47da32){var _0x37821c=_0x47da32[_0x3fa8('0x2f')](/<(.*?)>/);return _0x37821c?_0x37821c[0x1]:_0x47da32;}Report[_0x3fa8('0x11')]['voiceCallReport']=function(_0x428cbb){_0x428cbb[_0x3fa8('0x30')]=_0x428cbb[_0x3fa8('0x30')]||_0x428cbb[_0x3fa8('0x31')];if(_0x428cbb[_0x3fa8('0x32')]==_0x3fa8('0x33')){_0x428cbb[_0x3fa8('0x34')]=_0x3fa8('0x35');_0x428cbb[_0x3fa8('0x36')]=_0x428cbb['queue'];if(_0x428cbb[_0x3fa8('0x37')]=='from-voip-provider'){_0x428cbb['accountcode']='';_0x428cbb['destination']=extractCalleridNumber(_0x428cbb[_0x3fa8('0x38')]);}else if(_0x428cbb[_0x3fa8('0x37')]==_0x3fa8('0x39')){if(_0x428cbb[_0x3fa8('0x30')]==_0x3fa8('0x3a')){_0x428cbb['destination']=extractCalleridNumber(_0x428cbb['calleridpreview']);_0x428cbb['calleridnum']=_0x428cbb[_0x3fa8('0x3b')];_0x428cbb[_0x3fa8('0x3c')]=[_0x428cbb['channel'],_0x428cbb[_0x3fa8('0x3d')]=_0x428cbb[_0x3fa8('0x3c')]][0x0];_0x428cbb['callerid']=_0x428cbb[_0x3fa8('0x3e')];}else{_0x428cbb[_0x3fa8('0x30')]=_0x428cbb['calleridnum'];_0x428cbb['calleridnum']=_0x428cbb[_0x3fa8('0x3b')];if(_0x428cbb['disposition']==_0x3fa8('0x3f')){_0x428cbb[_0x3fa8('0x21')]=_0x428cbb[_0x3fa8('0x27')];}else{_0x428cbb[_0x3fa8('0x21')]='';}}}}else{_0x428cbb['callerid']=util[_0x3fa8('0x29')](_0x3fa8('0x40'),_0x428cbb[_0x3fa8('0x41')],_0x428cbb[_0x3fa8('0x42')]);}if(RpcVoiceTransferReport['transfers'][_0x428cbb[_0x3fa8('0x43')]]){var _0x1ea563=RpcVoiceTransferReport['transfers'][_0x428cbb[_0x3fa8('0x43')]];_0x1ea563[_0x3fa8('0x44')]=_0x428cbb[_0x3fa8('0x45')];RpcVoiceTransferReport[_0x3fa8('0x1d')](_0x1ea563);delete RpcVoiceTransferReport[_0x3fa8('0x46')][_0x428cbb[_0x3fa8('0x43')]];}RpcVoiceCallReport[_0x3fa8('0x47')](_0x428cbb);if(_0x428cbb[_0x3fa8('0x48')]){for(var _0x35b6f4=0x0;_0x35b6f4<_0x428cbb[_0x3fa8('0x49')]['length'];_0x35b6f4+=0x1){_0x428cbb[_0x3fa8('0x4a')]=_0x428cbb[_0x3fa8('0x49')][_0x35b6f4][_0x3fa8('0x4b')];_0x428cbb['createdAt']=_0x428cbb[_0x3fa8('0x49')][_0x35b6f4][_0x3fa8('0x4c')];if(_0x428cbb[_0x3fa8('0x31')]==_0x3fa8('0x3a')){_0x428cbb[_0x3fa8('0x42')]=_0x428cbb[_0x3fa8('0x27')];_0x428cbb[_0x3fa8('0x41')]=_0x428cbb[_0x3fa8('0x4d')];_0x428cbb[_0x3fa8('0x27')]=_0x428cbb[_0x3fa8('0x21')];_0x428cbb[_0x3fa8('0x4d')]=_0x428cbb[_0x3fa8('0x4e')];_0x428cbb['exten']=_0x428cbb[_0x3fa8('0x3b')];}else if(_0x428cbb[_0x3fa8('0x31')]==_0x3fa8('0x4f')){_0x428cbb[_0x3fa8('0x42')]=_0x428cbb[_0x3fa8('0x30')];_0x428cbb[_0x3fa8('0x31')]=_0x428cbb['originatecalleridnum'];}RpcVoiceRecording[_0x3fa8('0x47')](_0x428cbb);}}};Report[_0x3fa8('0x11')]['voiceAgentReport']=function(_0x523a29){if(_[_0x3fa8('0x50')](_0x523a29)){_0x523a29['forEach'](function(_0x3b8b34){RpcVoiceAgentReport[_0x3fa8('0x47')](_0x3b8b34);});}else{RpcVoiceAgentReport['create'](_0x523a29);}};Report[_0x3fa8('0x11')][_0x3fa8('0x1b')]=function(_0x1ae175){RpcVoiceDialReport[_0x3fa8('0x47')](_0x1ae175);var _0x45e1e7;var _0x1cbb0a;var _0x5323d3=_0x1ae175[_0x3fa8('0x3d')];if(_[_0x3fa8('0x51')](_0x5323d3,_0x3fa8('0x52'))){_0x1cbb0a=_0x5323d3[_0x3fa8('0x53')](_0x5323d3['indexOf']('/')+0x1,_0x5323d3['indexOf']('@'));_0x45e1e7=_[_0x3fa8('0x20')](this[_0x3fa8('0xf')],function(_0x22b932){return _0x22b932[_0x3fa8('0x54')]==_0x1cbb0a||_0x22b932['phone']==_0x1cbb0a||_0x22b932['accountcode']==_0x1cbb0a;});}else{_0x1cbb0a=_0x5323d3[_0x3fa8('0x53')](_0x5323d3[_0x3fa8('0x55')]('/')+0x1,_0x5323d3[_0x3fa8('0x56')]('-'));_0x45e1e7=this['findAgent'](_0x1cbb0a);}if(_0x45e1e7){_0x1ae175[_0x3fa8('0x23')]=_[_0x3fa8('0x57')](_0x45e1e7[_0x3fa8('0x23')])?util[_0x3fa8('0x29')](_0x3fa8('0x24'),_0x45e1e7[_0x3fa8('0x22')]):_0x45e1e7[_0x3fa8('0x23')];_0x1ae175[_0x3fa8('0x4e')]=_0x45e1e7[_0x3fa8('0x22')];_0x1ae175[_0x3fa8('0x21')]=_0x45e1e7['accountcode'];RpcMemberReport[_0x3fa8('0x1b')](_0x1ae175);}};Report[_0x3fa8('0x11')][_0x3fa8('0x1d')]=function(_0x384662){RpcVoiceTransferReport[_0x3fa8('0x46')][_0x384662['transfererlinkedid']]=_0x384662;};Report[_0x3fa8('0x11')][_0x3fa8('0x1f')]=function(_0x123036){RpcVoiceTransferReport['attendedTransfer'](_0x123036);};module[_0x3fa8('0x58')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 65dc8d7..a3ae026 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 _0xa423=['registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','ioredis','bluebird','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','resolve','then','actionSipShowRegistry','catch','error','inspect','actionSipPeerStatus','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','device','[userReport][devicestatechange]','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','indexOf','mobile','phone','syncPeerStatus','peerstatus','peer','address','[userReport][peerstatus]'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xa423,0x16c));var _0x3a42=function(_0x19b5a0,_0x22be6a){_0x19b5a0=_0x19b5a0-0x0;var _0x3535d4=_0xa423[_0x19b5a0];return _0x3535d4;};'use strict';var _=require(_0x3a42('0x0'));var moment=require(_0x3a42('0x1'));var util=require(_0x3a42('0x2'));var Redis=require(_0x3a42('0x3'));var BPromise=require(_0x3a42('0x4'));var config=require('../../../config/environment');var logger=require(_0x3a42('0x5'))(_0x3a42('0x6'));var ami=require('../ami');config[_0x3a42('0x7')]=_[_0x3a42('0x8')](config[_0x3a42('0x7')],{'host':_0x3a42('0x9'),'port':0x18eb});var io=require(_0x3a42('0xa'))(new Redis(config['redis']));function UserReport(_0x65e0ba){this[_0x3a42('0xb')]=_0x65e0ba[_0x3a42('0xb')];this[_0x3a42('0xc')]=_0x65e0ba[_0x3a42('0xc')];this[_0x3a42('0xd')]=_0x65e0ba[_0x3a42('0xd')];ami['on'](_0x3a42('0xe'),this[_0x3a42('0xf')][_0x3a42('0x10')](this));ami['on'](_0x3a42('0x11'),this['syncRegistry'][_0x3a42('0x10')](this));ami['on'](_0x3a42('0x12'),this[_0x3a42('0x13')][_0x3a42('0x10')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0x3a42('0x10')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x3a42('0x14')]()[_0x3a42('0x15')](ami[_0x3a42('0x16')]())[_0x3a42('0x17')](function(_0x891963){logger[_0x3a42('0x18')]('[userReport][sipshowregistry]',util[_0x3a42('0x19')](_0x891963,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x3a42('0x15')](ami['actionDeviceStateList']())[_0x3a42('0x17')](function(_0x5895a8){logger[_0x3a42('0x18')]('[userReport][devicestatelist]',util['inspect'](_0x5895a8,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x3a42('0x15')](ami[_0x3a42('0x1a')]())[_0x3a42('0x17')](function(_0x39e620){logger[_0x3a42('0x18')]('[userReport][sippeerstatus]',util[_0x3a42('0x19')](_0x39e620,{'showHidden':![],'depth':null}));});}UserReport[_0x3a42('0x1b')][_0x3a42('0x1c')]=function(){setInterval(function(){BPromise[_0x3a42('0x14')]()[_0x3a42('0x15')](showSipRegistrations())[_0x3a42('0x15')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x3a42('0x1b')][_0x3a42('0x1d')]=function(_0x3bb792){return _0x3bb792!==null&&!_[_0x3a42('0x1e')](_0x3bb792);};UserReport[_0x3a42('0x1b')]['emit']=function(_0x34927a,_0x42b40f,_0x379fe6){io['to'](_0x34927a)[_0x3a42('0x1f')](_0x42b40f,_0x379fe6);};UserReport[_0x3a42('0x1b')]['syncRegistry']=function(_0xab8ab7){try{if(this[_0x3a42('0x1d')](_0xab8ab7)){logger[_0x3a42('0x20')](_0x3a42('0x21'),_0xab8ab7[_0x3a42('0x22')],_0xab8ab7[_0x3a42('0x23')]);logger[_0x3a42('0x24')](_0x3a42('0x25'),util[_0x3a42('0x19')](_0xab8ab7,{'showHidden':![],'depth':null}));var _0x3a3f87=_[_0x3a42('0x26')](this['trunks'],{'registry':_0xab8ab7[_0x3a42('0x22')]});if(_0x3a3f87){_0xab8ab7[_0x3a42('0x27')]=_0xab8ab7['state'];_[_0x3a42('0x28')](_0x3a3f87,_['omit'](_0xab8ab7,[_0x3a42('0x29'),_0x3a42('0x2a'),_0x3a42('0x22'),_0x3a42('0x23')]));logger[_0x3a42('0x24')](_0x3a42('0x2b'),util['inspect'](_0x3a3f87,{'showHidden':![],'depth':null}));this[_0x3a42('0x1f')](util[_0x3a42('0x2c')](_0x3a42('0x2d'),_0x3a3f87[_0x3a42('0x2e')]),_0x3a42('0x2f'),_0x3a3f87);}}}catch(_0x44ef39){logger[_0x3a42('0x18')]('[userReport][registry]',util[_0x3a42('0x19')](_0x44ef39,{'showHidden':![],'depth':null}));}};UserReport[_0x3a42('0x1b')][_0x3a42('0x13')]=function(_0x69e4f7){try{if(this[_0x3a42('0x1d')](_0x69e4f7)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x69e4f7[_0x3a42('0x30')],_0x69e4f7['state']);logger[_0x3a42('0x24')](_0x3a42('0x31'),util[_0x3a42('0x19')](_0x69e4f7,{'showHidden':![],'depth':null}));if(this[_0x3a42('0xc')][_0x69e4f7[_0x3a42('0x30')]]){if(!this[_0x3a42('0xc')][_0x69e4f7['device']][_0x3a42('0x32')]||_0x69e4f7[_0x3a42('0x23')][_0x3a42('0x33')]()=='inuse'){this['agents'][_0x69e4f7[_0x3a42('0x30')]][_0x3a42('0x32')]=![];if(this[_0x3a42('0xc')][_0x69e4f7[_0x3a42('0x30')]][_0x3a42('0x23')]!==_0x69e4f7['state']['toLowerCase']()){this[_0x3a42('0xc')][_0x69e4f7[_0x3a42('0x30')]][_0x3a42('0x34')]=_[_0x3a42('0x35')](moment()['format']('x'));}this[_0x3a42('0xc')][_0x69e4f7[_0x3a42('0x30')]]['state']=_0x69e4f7['state']['toLowerCase']();this[_0x3a42('0xc')][_0x69e4f7['device']][_0x3a42('0x36')](_0x69e4f7);}}else if(this[_0x3a42('0xd')][_0x69e4f7[_0x3a42('0x30')]]){if(this[_0x3a42('0xd')][_0x69e4f7[_0x3a42('0x30')]][_0x3a42('0x23')]!==_0x69e4f7[_0x3a42('0x23')][_0x3a42('0x33')]()){this[_0x3a42('0xd')][_0x69e4f7['device']][_0x3a42('0x34')]=_[_0x3a42('0x35')](moment()[_0x3a42('0x2c')]('x'));}this[_0x3a42('0xd')][_0x69e4f7[_0x3a42('0x30')]]['state']=_0x69e4f7[_0x3a42('0x23')]['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x3a42('0xd')][_0x69e4f7['device']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x3a42('0x37'),this['telephones'][_0x69e4f7['device']][_0x3a42('0x2e')]),_0x3a42('0x38'),this[_0x3a42('0xd')][_0x69e4f7[_0x3a42('0x30')]]);}else if(this[_0x3a42('0xb')][_0x69e4f7[_0x3a42('0x30')]]){if(this['trunks'][_0x69e4f7[_0x3a42('0x30')]][_0x3a42('0x23')]!==_0x69e4f7[_0x3a42('0x23')]['toLowerCase']()){this[_0x3a42('0xb')][_0x69e4f7[_0x3a42('0x30')]]['stateTime']=_[_0x3a42('0x35')](moment()[_0x3a42('0x2c')]('x'));}this[_0x3a42('0xb')][_0x69e4f7[_0x3a42('0x30')]][_0x3a42('0x23')]=_0x69e4f7[_0x3a42('0x23')][_0x3a42('0x33')]();logger['debug'](_0x3a42('0x39'),util[_0x3a42('0x19')](this[_0x3a42('0xb')][_0x69e4f7[_0x3a42('0x30')]],{'showHidden':![],'depth':null}));this[_0x3a42('0x1f')](util['format'](_0x3a42('0x2d'),this[_0x3a42('0xb')][_0x69e4f7[_0x3a42('0x30')]]['name']),_0x3a42('0x2f'),this[_0x3a42('0xb')][_0x69e4f7[_0x3a42('0x30')]]);}else if(_[_0x3a42('0x3a')](_0x69e4f7[_0x3a42('0x30')],'Local')){var _0x40c746=_0x69e4f7[_0x3a42('0x30')];var _0x3a3293=_0x40c746[_0x3a42('0x3b')](_0x40c746['indexOf']('/')+0x1,_0x40c746[_0x3a42('0x3c')]('@'));var _0x486472=_[_0x3a42('0x26')](this[_0x3a42('0xc')],function(_0x8e5316){return _0x8e5316[_0x3a42('0x3d')]==_0x3a3293||_0x8e5316[_0x3a42('0x3e')]==_0x3a3293||_0x8e5316['accountcode']==_0x3a3293;});if(_0x486472){if(_0x486472[_0x3a42('0x23')]!==_0x69e4f7[_0x3a42('0x23')][_0x3a42('0x33')]()){_0x486472[_0x3a42('0x34')]=_[_0x3a42('0x35')](moment()[_0x3a42('0x2c')]('x'));}_0x486472['state']=_0x69e4f7[_0x3a42('0x23')]['toLowerCase']();_0x486472[_0x3a42('0x32')]=!![];_0x486472[_0x3a42('0x36')](_0x69e4f7);}}}}catch(_0x458d47){logger[_0x3a42('0x18')](_0x3a42('0x31'),util[_0x3a42('0x19')](_0x458d47,{'showHidden':![],'depth':null}));}};UserReport[_0x3a42('0x1b')][_0x3a42('0x3f')]=function(_0x32552f){try{if(this['isNotNull'](_0x32552f)&&this[_0x3a42('0x1d')](_0x32552f[_0x3a42('0x40')])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x32552f[_0x3a42('0x41')],_0x32552f[_0x3a42('0x42')],_0x32552f['peerstatus']);logger[_0x3a42('0x24')](_0x3a42('0x43'),util[_0x3a42('0x19')](_0x32552f,{'showHidden':![],'depth':null}));if(this['agents'][_0x32552f[_0x3a42('0x41')]]){if(!this[_0x3a42('0xc')][_0x32552f['peer']][_0x3a42('0x32')]||_0x32552f['peerstatus'][_0x3a42('0x33')]()==_0x3a42('0x44')){this['agents'][_0x32552f[_0x3a42('0x41')]][_0x3a42('0x32')]=![];this[_0x3a42('0xc')][_0x32552f[_0x3a42('0x41')]][_0x3a42('0x45')]=_0x32552f[_0x3a42('0x40')][_0x3a42('0x33')]();this[_0x3a42('0xc')][_0x32552f[_0x3a42('0x41')]][_0x3a42('0x42')]=_0x32552f['address'];this[_0x3a42('0xc')][_0x32552f[_0x3a42('0x41')]][_0x3a42('0x36')](_0x32552f);}}else if(this[_0x3a42('0xd')][_0x32552f[_0x3a42('0x41')]]){this['telephones'][_0x32552f[_0x3a42('0x41')]][_0x3a42('0x45')]=_0x32552f[_0x3a42('0x40')]['toLowerCase']();this[_0x3a42('0xd')][_0x32552f[_0x3a42('0x41')]]['address']=_0x32552f[_0x3a42('0x42')];logger[_0x3a42('0x24')](_0x3a42('0x46'),util[_0x3a42('0x19')](this[_0x3a42('0xd')][_0x32552f[_0x3a42('0x41')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('telephone:%s',this[_0x3a42('0xd')][_0x32552f[_0x3a42('0x41')]][_0x3a42('0x2e')]),_0x3a42('0x38'),this['telephones'][_0x32552f[_0x3a42('0x41')]]);}else if(this[_0x3a42('0xb')][_0x32552f[_0x3a42('0x41')]]){this['trunks'][_0x32552f[_0x3a42('0x41')]][_0x3a42('0x45')]=_0x32552f['peerstatus'][_0x3a42('0x33')]();this[_0x3a42('0xb')][_0x32552f[_0x3a42('0x41')]][_0x3a42('0x42')]=_0x32552f[_0x3a42('0x42')];logger[_0x3a42('0x24')](_0x3a42('0x47'),util[_0x3a42('0x19')](this[_0x3a42('0xb')][_0x32552f[_0x3a42('0x41')]],{'showHidden':![],'depth':null}));this[_0x3a42('0x1f')](util[_0x3a42('0x2c')](_0x3a42('0x2d'),this[_0x3a42('0xb')][_0x32552f[_0x3a42('0x41')]][_0x3a42('0x2e')]),_0x3a42('0x2f'),this[_0x3a42('0xb')][_0x32552f['peer']]);}}}catch(_0x253c2d){logger[_0x3a42('0x18')](_0x3a42('0x43'),util['inspect'](_0x253c2d,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x6093=['inuse','local','stateTime','toNumber','format','toLowerCase','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','name','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','redis','defaults','localhost','trunks','agents','telephones','registryentry','syncRegistry','registry','bind','devicestatechange','peerstatus','syncPeerStatus','syncRealtimeShow','catch','error','[userReport][sipshowregistry]','inspect','resolve','then','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','find','state','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','trunk:save','[userReport][registry]','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]'];(function(_0x352e90,_0x441411){var _0x2f5c41=function(_0x98b9e8){while(--_0x98b9e8){_0x352e90['push'](_0x352e90['shift']());}};_0x2f5c41(++_0x441411);}(_0x6093,0x107));var _0x3609=function(_0xc878bd,_0x16fedf){_0xc878bd=_0xc878bd-0x0;var _0x2cdbe3=_0x6093[_0xc878bd];return _0x2cdbe3;};'use strict';var _=require(_0x3609('0x0'));var moment=require(_0x3609('0x1'));var util=require(_0x3609('0x2'));var Redis=require(_0x3609('0x3'));var BPromise=require(_0x3609('0x4'));var config=require(_0x3609('0x5'));var logger=require(_0x3609('0x6'))('ami');var ami=require('../ami');config[_0x3609('0x7')]=_[_0x3609('0x8')](config[_0x3609('0x7')],{'host':_0x3609('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3609('0x7')]));function UserReport(_0x269e29){this[_0x3609('0xa')]=_0x269e29['trunks'];this[_0x3609('0xb')]=_0x269e29[_0x3609('0xb')];this[_0x3609('0xc')]=_0x269e29[_0x3609('0xc')];ami['on'](_0x3609('0xd'),this[_0x3609('0xe')]['bind'](this));ami['on'](_0x3609('0xf'),this[_0x3609('0xe')][_0x3609('0x10')](this));ami['on'](_0x3609('0x11'),this['syncDeviceState'][_0x3609('0x10')](this));ami['on'](_0x3609('0x12'),this[_0x3609('0x13')][_0x3609('0x10')](this));return this[_0x3609('0x14')]();}function showSipRegistrations(){Promise['resolve']()['then'](ami['actionSipShowRegistry']())[_0x3609('0x15')](function(_0x68b346){logger[_0x3609('0x16')](_0x3609('0x17'),util[_0x3609('0x18')](_0x68b346,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x3609('0x19')]()[_0x3609('0x1a')](ami[_0x3609('0x1b')]())[_0x3609('0x15')](function(_0x4aae0a){logger[_0x3609('0x16')](_0x3609('0x1c'),util['inspect'](_0x4aae0a,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x3609('0x19')]()[_0x3609('0x1a')](ami[_0x3609('0x1d')]())['catch'](function(_0x2d1cd5){logger[_0x3609('0x16')](_0x3609('0x1e'),util['inspect'](_0x2d1cd5,{'showHidden':![],'depth':null}));});}UserReport[_0x3609('0x1f')][_0x3609('0x14')]=function(){setInterval(function(){BPromise[_0x3609('0x19')]()[_0x3609('0x1a')](showSipRegistrations())[_0x3609('0x1a')](listDeviceStates())[_0x3609('0x1a')](showPeersStatus());},0x32c8);};UserReport[_0x3609('0x1f')][_0x3609('0x20')]=function(_0x3024c5){return _0x3024c5!==null&&!_[_0x3609('0x21')](_0x3024c5);};UserReport[_0x3609('0x1f')][_0x3609('0x22')]=function(_0x323ad4,_0x2a03a0,_0x52d052){io['to'](_0x323ad4)[_0x3609('0x22')](_0x2a03a0,_0x52d052);};UserReport[_0x3609('0x1f')]['syncRegistry']=function(_0x27d5ab){try{if(this[_0x3609('0x20')](_0x27d5ab)){logger[_0x3609('0x23')](_0x3609('0x24'),_0x27d5ab[_0x3609('0x25')],_0x27d5ab['state']);logger[_0x3609('0x26')]('[userReport][registry]',util['inspect'](_0x27d5ab,{'showHidden':![],'depth':null}));var _0xc7978b=_[_0x3609('0x27')](this[_0x3609('0xa')],{'registry':_0x27d5ab['username']});if(_0xc7978b){_0x27d5ab['stateRegistry']=_0x27d5ab[_0x3609('0x28')];_[_0x3609('0x29')](_0xc7978b,_[_0x3609('0x2a')](_0x27d5ab,[_0x3609('0x2b'),_0x3609('0x2c'),_0x3609('0x25'),'state']));logger['debug'](_0x3609('0x2d'),util['inspect'](_0xc7978b,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x3609('0x2e'),_0xc7978b['name']),_0x3609('0x2f'),_0xc7978b);}}}catch(_0x4a979f){logger[_0x3609('0x16')](_0x3609('0x30'),util[_0x3609('0x18')](_0x4a979f,{'showHidden':![],'depth':null}));}};UserReport[_0x3609('0x1f')][_0x3609('0x31')]=function(_0x3e72f0){try{if(this[_0x3609('0x20')](_0x3e72f0)){logger['info'](_0x3609('0x32'),_0x3e72f0[_0x3609('0x33')],_0x3e72f0[_0x3609('0x28')]);logger['debug'](_0x3609('0x34'),util[_0x3609('0x18')](_0x3e72f0,{'showHidden':![],'depth':null}));if(this[_0x3609('0xb')][_0x3e72f0[_0x3609('0x33')]]){if(!this[_0x3609('0xb')][_0x3e72f0[_0x3609('0x33')]]['local']||_0x3e72f0[_0x3609('0x28')]['toLowerCase']()==_0x3609('0x35')){this[_0x3609('0xb')][_0x3e72f0[_0x3609('0x33')]][_0x3609('0x36')]=![];if(this['agents'][_0x3e72f0[_0x3609('0x33')]][_0x3609('0x28')]!==_0x3e72f0[_0x3609('0x28')]['toLowerCase']()){this[_0x3609('0xb')][_0x3e72f0[_0x3609('0x33')]][_0x3609('0x37')]=_[_0x3609('0x38')](moment()[_0x3609('0x39')]('x'));}this[_0x3609('0xb')][_0x3e72f0[_0x3609('0x33')]]['state']=_0x3e72f0[_0x3609('0x28')][_0x3609('0x3a')]();this[_0x3609('0xb')][_0x3e72f0[_0x3609('0x33')]][_0x3609('0x3b')](_0x3e72f0);}}else if(this[_0x3609('0xc')][_0x3e72f0['device']]){if(this[_0x3609('0xc')][_0x3e72f0['device']][_0x3609('0x28')]!==_0x3e72f0['state']['toLowerCase']()){this['telephones'][_0x3e72f0[_0x3609('0x33')]][_0x3609('0x37')]=_[_0x3609('0x38')](moment()[_0x3609('0x39')]('x'));}this[_0x3609('0xc')][_0x3e72f0[_0x3609('0x33')]]['state']=_0x3e72f0['state'][_0x3609('0x3a')]();logger[_0x3609('0x26')](_0x3609('0x3c'),util[_0x3609('0x18')](this[_0x3609('0xc')][_0x3e72f0[_0x3609('0x33')]],{'showHidden':![],'depth':null}));this[_0x3609('0x22')](util['format'](_0x3609('0x3d'),this['telephones'][_0x3e72f0['device']][_0x3609('0x3e')]),_0x3609('0x3f'),this[_0x3609('0xc')][_0x3e72f0[_0x3609('0x33')]]);}else if(this[_0x3609('0xa')][_0x3e72f0[_0x3609('0x33')]]){if(this[_0x3609('0xa')][_0x3e72f0[_0x3609('0x33')]]['state']!==_0x3e72f0[_0x3609('0x28')][_0x3609('0x3a')]()){this['trunks'][_0x3e72f0[_0x3609('0x33')]][_0x3609('0x37')]=_['toNumber'](moment()[_0x3609('0x39')]('x'));}this[_0x3609('0xa')][_0x3e72f0[_0x3609('0x33')]][_0x3609('0x28')]=_0x3e72f0[_0x3609('0x28')][_0x3609('0x3a')]();logger[_0x3609('0x26')](_0x3609('0x40'),util[_0x3609('0x18')](this['trunks'][_0x3e72f0[_0x3609('0x33')]],{'showHidden':![],'depth':null}));this[_0x3609('0x22')](util[_0x3609('0x39')](_0x3609('0x2e'),this[_0x3609('0xa')][_0x3e72f0[_0x3609('0x33')]][_0x3609('0x3e')]),_0x3609('0x2f'),this['trunks'][_0x3e72f0[_0x3609('0x33')]]);}else if(_[_0x3609('0x41')](_0x3e72f0[_0x3609('0x33')],_0x3609('0x42'))){var _0xf88959=_0x3e72f0[_0x3609('0x33')];var _0x4f4c04=_0xf88959[_0x3609('0x43')](_0xf88959[_0x3609('0x44')]('/')+0x1,_0xf88959[_0x3609('0x44')]('@'));var _0x565970=_['find'](this['agents'],function(_0x31679a){return _0x31679a[_0x3609('0x45')]==_0x4f4c04||_0x31679a[_0x3609('0x46')]==_0x4f4c04||_0x31679a[_0x3609('0x47')]==_0x4f4c04;});if(_0x565970){if(_0x565970[_0x3609('0x28')]!==_0x3e72f0[_0x3609('0x28')]['toLowerCase']()){_0x565970[_0x3609('0x37')]=_['toNumber'](moment()[_0x3609('0x39')]('x'));}_0x565970[_0x3609('0x28')]=_0x3e72f0['state'][_0x3609('0x3a')]();_0x565970[_0x3609('0x36')]=!![];_0x565970['updateStatusRealtime'](_0x3e72f0);}}}}catch(_0x42c9fe){logger['error'](_0x3609('0x34'),util['inspect'](_0x42c9fe,{'showHidden':![],'depth':null}));}};UserReport[_0x3609('0x1f')]['syncPeerStatus']=function(_0x2acaea){try{if(this[_0x3609('0x20')](_0x2acaea)&&this[_0x3609('0x20')](_0x2acaea[_0x3609('0x12')])){logger[_0x3609('0x23')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x2acaea[_0x3609('0x48')],_0x2acaea[_0x3609('0x49')],_0x2acaea[_0x3609('0x12')]);logger['debug'](_0x3609('0x4a'),util['inspect'](_0x2acaea,{'showHidden':![],'depth':null}));if(this['agents'][_0x2acaea[_0x3609('0x48')]]){if(!this[_0x3609('0xb')][_0x2acaea[_0x3609('0x48')]]['local']||_0x2acaea[_0x3609('0x12')][_0x3609('0x3a')]()==_0x3609('0x4b')){this[_0x3609('0xb')][_0x2acaea['peer']][_0x3609('0x36')]=![];this[_0x3609('0xb')][_0x2acaea[_0x3609('0x48')]]['status']=_0x2acaea[_0x3609('0x12')][_0x3609('0x3a')]();this[_0x3609('0xb')][_0x2acaea[_0x3609('0x48')]]['address']=_0x2acaea[_0x3609('0x49')];this[_0x3609('0xb')][_0x2acaea[_0x3609('0x48')]]['updateStatusRealtime'](_0x2acaea);}}else if(this[_0x3609('0xc')][_0x2acaea[_0x3609('0x48')]]){this['telephones'][_0x2acaea[_0x3609('0x48')]][_0x3609('0x4c')]=_0x2acaea[_0x3609('0x12')][_0x3609('0x3a')]();this[_0x3609('0xc')][_0x2acaea['peer']][_0x3609('0x49')]=_0x2acaea[_0x3609('0x49')];logger['debug'](_0x3609('0x4d'),util['inspect'](this[_0x3609('0xc')][_0x2acaea['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0x3609('0x39')](_0x3609('0x3d'),this[_0x3609('0xc')][_0x2acaea['peer']][_0x3609('0x3e')]),_0x3609('0x3f'),this[_0x3609('0xc')][_0x2acaea['peer']]);}else if(this[_0x3609('0xa')][_0x2acaea[_0x3609('0x48')]]){this[_0x3609('0xa')][_0x2acaea[_0x3609('0x48')]][_0x3609('0x4c')]=_0x2acaea[_0x3609('0x12')][_0x3609('0x3a')]();this[_0x3609('0xa')][_0x2acaea[_0x3609('0x48')]][_0x3609('0x49')]=_0x2acaea[_0x3609('0x49')];logger['debug'](_0x3609('0x4e'),util['inspect'](this[_0x3609('0xa')][_0x2acaea[_0x3609('0x48')]],{'showHidden':![],'depth':null}));this[_0x3609('0x22')](util['format'](_0x3609('0x2e'),this[_0x3609('0xa')][_0x2acaea[_0x3609('0x48')]][_0x3609('0x3e')]),'trunk:save',this[_0x3609('0xa')][_0x2acaea[_0x3609('0x48')]]);}}}catch(_0xe54ef1){logger[_0x3609('0x16')]('[userReport][peerstatus]',util[_0x3609('0x18')](_0xe54ef1,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 242517c..498dec1 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 _0x3672=['destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberdynamic','memberlastcall','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','onhold','lodash','moment','ioredis','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','redis','channels','voiceQueues','agents','variables','agentcalled','agentconnect','bind','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','info','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','error','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','merge','interface','pick','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3672,0x149));var _0x2367=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x3672[_0x28611e];return _0x530f69;};'use strict';var _=require(_0x2367('0x0'));var moment=require(_0x2367('0x1'));var util=require('util');var Redis=require(_0x2367('0x2'));var config=require('../../../config/environment');var logger=require(_0x2367('0x3'))(_0x2367('0x4'));var ami=require(_0x2367('0x5'));config['redis']=_[_0x2367('0x6')](config['redis'],{'host':_0x2367('0x7'),'port':0x18eb});var io=require(_0x2367('0x8'))(new Redis(config[_0x2367('0x9')]));function VoiceAgentReport(_0x117064){this[_0x2367('0xa')]={};this[_0x2367('0xb')]=_0x117064[_0x2367('0xb')];this[_0x2367('0xc')]=_0x117064[_0x2367('0xc')];this[_0x2367('0xd')]={};ami['on'](_0x2367('0xe'),this['syncAgentCalled']['bind'](this));ami['on'](_0x2367('0xf'),this['syncAgentConnect'][_0x2367('0x10')](this));ami['on']('agentringnoanswer',this[_0x2367('0x11')]['bind'](this));ami['on'](_0x2367('0x12'),this[_0x2367('0x13')][_0x2367('0x10')](this));ami['on'](_0x2367('0x14'),this['syncAgentComplete']['bind'](this));ami['on']('varset',this[_0x2367('0x15')][_0x2367('0x10')](this));ami['on'](_0x2367('0x16'),this['syncHangup'][_0x2367('0x10')](this));ami['on'](_0x2367('0x17'),this['syncMusicOnHoldStart'][_0x2367('0x10')](this));ami['on']('musiconholdstop',this[_0x2367('0x18')]['bind'](this));ami['on'](_0x2367('0x19'),this[_0x2367('0x1a')][_0x2367('0x10')](this));ami['on'](_0x2367('0x1b'),this[_0x2367('0x1c')][_0x2367('0x10')](this));}VoiceAgentReport[_0x2367('0x1d')][_0x2367('0x1e')]=function(_0x5f055e,_0x5f4a06,_0x48aecf){io['to'](_0x5f055e)[_0x2367('0x1e')](_0x5f4a06,_0x48aecf);};VoiceAgentReport[_0x2367('0x1d')][_0x2367('0x1f')]=function(_0x2239ad){return _0x2239ad!==null&&!_[_0x2367('0x20')](_0x2239ad);};VoiceAgentReport['prototype'][_0x2367('0x21')]=function(_0x304049){try{if(this[_0x2367('0x1f')](_0x304049)){logger[_0x2367('0x22')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x304049['uniqueid'],_0x304049[_0x2367('0x23')],_0x304049['destuniqueid']);logger[_0x2367('0x24')](_0x2367('0x25'),_0x304049['uniqueid'],util[_0x2367('0x26')](_0x304049,{'showHidden':![],'depth':null}));if(_[_0x2367('0x20')](this[_0x2367('0xa')][_0x304049[_0x2367('0x27')]])){this[_0x2367('0xa')][_0x304049[_0x2367('0x27')]]={};}if(_[_0x2367('0x20')](this[_0x2367('0xa')][_0x304049['uniqueid']][_0x304049['destuniqueid']])){this[_0x2367('0xa')][_0x304049[_0x2367('0x27')]][_0x304049[_0x2367('0x28')]]={'agentcalledAt':moment()['format'](_0x2367('0x29')),'lastevent':_0x2367('0x2a'),'mandatoryDisposition':this[_0x2367('0xb')][_0x304049['queue']]?this[_0x2367('0xb')][_0x304049[_0x2367('0x2b')]][_0x2367('0x2c')]||![]:![],'type':this[_0x2367('0xb')][_0x304049[_0x2367('0x2b')]]?this[_0x2367('0xb')][_0x304049[_0x2367('0x2b')]][_0x2367('0x2d')]||_0x2367('0x2e'):'inbound','variables':this['variables'][_0x304049[_0x2367('0x27')]]};}_['merge'](this[_0x2367('0xa')][_0x304049[_0x2367('0x27')]][_0x304049[_0x2367('0x28')]],_[_0x2367('0x2f')](_0x304049,[_0x2367('0x30'),_0x2367('0x31')]));logger[_0x2367('0x24')](_0x2367('0x32'),_0x304049[_0x2367('0x27')],util['inspect'](this['channels'][_0x304049['uniqueid']][_0x304049[_0x2367('0x28')]],{'showHidden':![],'depth':null}));ami[_0x2367('0x1e')](_0x2367('0x33'),this['channels'][_0x304049[_0x2367('0x27')]][_0x304049['destuniqueid']]);logger[_0x2367('0x24')](_0x2367('0x34'),_0x304049[_0x2367('0x27')],util['inspect'](this[_0x2367('0xa')][_0x304049[_0x2367('0x27')]][_0x304049[_0x2367('0x28')]],{'showHidden':![],'depth':null}));this[_0x2367('0x1e')](util[_0x2367('0x35')](_0x2367('0x36'),_0x304049[_0x2367('0x23')]),'user:called',this[_0x2367('0xa')][_0x304049[_0x2367('0x27')]][_0x304049['destuniqueid']]);}}catch(_0x1e4a3f){logger[_0x2367('0x37')]('[%s][voiceAgentReport][agentcalled]',_0x304049['uniqueid'],util[_0x2367('0x26')](_0x1e4a3f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2367('0x1d')]['syncAgentConnect']=function(_0x1f399e){try{if(this['isNotNull'](_0x1f399e)){if(this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]]){logger[_0x2367('0x24')](_0x2367('0x38'),_0x1f399e[_0x2367('0x27')],util['inspect'](_0x1f399e,{'showHidden':![],'depth':null}));for(var _0x3f52a6 in this['channels'][_0x1f399e['uniqueid']]){if(this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]]['hasOwnProperty'](_0x3f52a6)){if(_0x1f399e['destuniqueid']===_0x3f52a6){logger['info'](_0x2367('0x39'),_0x1f399e['uniqueid'],_0x1f399e['membername'],_0x1f399e['destuniqueid']);this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x3f52a6][_0x2367('0x3a')]=moment()[_0x2367('0x35')](_0x2367('0x29'));this['channels'][_0x1f399e[_0x2367('0x27')]][_0x3f52a6][_0x2367('0x3b')]=_0x1f399e['connectedlinename'];this[_0x2367('0xa')][_0x1f399e['uniqueid']][_0x3f52a6][_0x2367('0x3c')]=_0x1f399e[_0x2367('0x3c')];this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x3f52a6][_0x2367('0x3d')]=_0x1f399e['destchannelstate'];this[_0x2367('0xa')][_0x1f399e['uniqueid']][_0x3f52a6]['destchannelstatedesc']=_0x1f399e[_0x2367('0x3e')];this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x3f52a6][_0x2367('0x3f')]=_0x1f399e[_0x2367('0x3f')];this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x3f52a6][_0x2367('0x40')]='connect';_[_0x2367('0x41')](this['agents'][_0x1f399e[_0x2367('0x42')]],_[_0x2367('0x43')](_0x1f399e,['queue','destconnectedlinenum']));logger[_0x2367('0x24')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x1f399e[_0x2367('0x27')],util[_0x2367('0x26')](this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x1f399e[_0x2367('0x28')]],{'showHidden':![],'depth':null}));ami[_0x2367('0x1e')]('custom:agentconnect',this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x1f399e['destuniqueid']]);logger[_0x2367('0x24')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x1f399e[_0x2367('0x27')],util['inspect'](this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x1f399e[_0x2367('0x28')]],{'showHidden':![],'depth':null}));this[_0x2367('0x1e')](util[_0x2367('0x35')]('user:%s',_0x1f399e['membername']),_0x2367('0x44'),this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x1f399e[_0x2367('0x28')]]);}else if(!this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x3f52a6][_0x2367('0x45')]&&!this['channels'][_0x1f399e['uniqueid']][_0x3f52a6][_0x2367('0x14')]){logger['info'](_0x2367('0x46'),_0x1f399e[_0x2367('0x27')],this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x3f52a6][_0x2367('0x23')],_0x3f52a6);this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x3f52a6][_0x2367('0x45')]=!![];this[_0x2367('0xa')][_0x1f399e['uniqueid']][_0x3f52a6][_0x2367('0x47')]=moment()[_0x2367('0x35')](_0x2367('0x29'));this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x3f52a6][_0x2367('0x48')]=_0x1f399e[_0x2367('0x28')];this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x3f52a6][_0x2367('0x49')]=_0x1f399e['membername'];this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x3f52a6]['lastevent']='answered_elsewhere';this['channels'][_0x1f399e['uniqueid']][_0x3f52a6][_0x2367('0x4a')]=_0x2367('0x4b');logger[_0x2367('0x24')](_0x2367('0x4c'),_0x1f399e[_0x2367('0x27')],util[_0x2367('0x26')](this['channels'][_0x1f399e[_0x2367('0x27')]][_0x3f52a6],{'showHidden':![],'depth':null}));ami[_0x2367('0x1e')]('custom:agentansweredelsewhere',this[_0x2367('0xa')][_0x1f399e[_0x2367('0x27')]][_0x3f52a6]);}}}}}}catch(_0x252d9d){logger['error']('[%s][voiceAgentReport][agentconnect]',_0x1f399e[_0x2367('0x27')],util['inspect'](_0x252d9d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2367('0x11')]=function(_0xcfc03e){try{if(this[_0x2367('0x1f')](_0xcfc03e)){logger[_0x2367('0x24')](_0x2367('0x4d'),_0xcfc03e[_0x2367('0x27')],util[_0x2367('0x26')](_0xcfc03e,{'showHidden':![],'depth':null}));if(this[_0x2367('0xa')][_0xcfc03e['uniqueid']]&&this[_0x2367('0xa')][_0xcfc03e[_0x2367('0x27')]][_0xcfc03e['destuniqueid']]){logger['info'](_0x2367('0x4e'),_0xcfc03e[_0x2367('0x27')],_0xcfc03e[_0x2367('0x23')],_0xcfc03e['destuniqueid']);this['channels'][_0xcfc03e[_0x2367('0x27')]][_0xcfc03e['destuniqueid']]['agentringnoanswer']=!![];this[_0x2367('0xa')][_0xcfc03e[_0x2367('0x27')]][_0xcfc03e[_0x2367('0x28')]][_0x2367('0x47')]=moment()[_0x2367('0x35')](_0x2367('0x29'));this[_0x2367('0xa')][_0xcfc03e[_0x2367('0x27')]][_0xcfc03e['destuniqueid']]['lastevent']=_0x2367('0x4f');this[_0x2367('0xa')][_0xcfc03e[_0x2367('0x27')]][_0xcfc03e[_0x2367('0x28')]][_0x2367('0x4a')]=_0x2367('0x4f');logger['debug'](_0x2367('0x50'),_0xcfc03e[_0x2367('0x27')],util['inspect'](this[_0x2367('0xa')][_0xcfc03e['uniqueid']][_0xcfc03e[_0x2367('0x28')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentringnoanswer',this['channels'][_0xcfc03e[_0x2367('0x27')]][_0xcfc03e[_0x2367('0x28')]]);}}}catch(_0x3e8b8f){logger[_0x2367('0x37')]('[%s][voiceAgentReport][agentringnoanswer]',_0xcfc03e[_0x2367('0x27')],util[_0x2367('0x26')](_0x3e8b8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2367('0x1d')][_0x2367('0x13')]=function(_0x4e7ec6){try{if(this[_0x2367('0x1f')](_0x4e7ec6)){logger[_0x2367('0x24')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x4e7ec6[_0x2367('0x27')],util[_0x2367('0x26')](_0x4e7ec6,{'showHidden':![],'depth':null}));if(this[_0x2367('0xa')][_0x4e7ec6[_0x2367('0x27')]]){for(var _0x531ba1 in this['channels'][_0x4e7ec6[_0x2367('0x27')]]){if(this['channels'][_0x4e7ec6[_0x2367('0x27')]][_0x2367('0x51')](_0x531ba1)&&!this[_0x2367('0xa')][_0x4e7ec6[_0x2367('0x27')]][_0x531ba1][_0x2367('0x45')]&&!this[_0x2367('0xa')][_0x4e7ec6[_0x2367('0x27')]][_0x531ba1][_0x2367('0x14')]){logger[_0x2367('0x22')](_0x2367('0x52'),_0x4e7ec6[_0x2367('0x27')],this[_0x2367('0xa')][_0x4e7ec6[_0x2367('0x27')]][_0x531ba1]['membername'],_0x531ba1);this[_0x2367('0xa')][_0x4e7ec6[_0x2367('0x27')]][_0x531ba1][_0x2367('0x45')]=!![];this[_0x2367('0xa')][_0x4e7ec6[_0x2367('0x27')]][_0x531ba1]['agentringnoanswerAt']=moment()[_0x2367('0x35')](_0x2367('0x29'));this[_0x2367('0xa')][_0x4e7ec6['uniqueid']][_0x531ba1][_0x2367('0x40')]=_0x2367('0x53');this[_0x2367('0xa')][_0x4e7ec6[_0x2367('0x27')]][_0x531ba1][_0x2367('0x4a')]=_0x2367('0x53');logger['debug'](_0x2367('0x54'),_0x4e7ec6[_0x2367('0x27')],util['inspect'](this[_0x2367('0xa')][_0x4e7ec6[_0x2367('0x27')]][_0x531ba1],{'showHidden':![],'depth':null}));ami[_0x2367('0x1e')]('custom:agentqueuecallerabandon',this['channels'][_0x4e7ec6[_0x2367('0x27')]][_0x531ba1]);}}}}}catch(_0xca98e2){logger['error'](_0x2367('0x55'),_0x4e7ec6['uniqueid'],util[_0x2367('0x26')](_0xca98e2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2367('0x1d')]['syncAgentComplete']=function(_0x2b54b7){try{if(this['isNotNull'](_0x2b54b7)){logger[_0x2367('0x24')](_0x2367('0x56'),_0x2b54b7[_0x2367('0x27')],util[_0x2367('0x26')](_0x2b54b7,{'showHidden':![],'depth':null}));if(this['channels'][_0x2b54b7[_0x2367('0x27')]]){for(var _0x265a5a in this['channels'][_0x2b54b7[_0x2367('0x27')]]){if(this['channels'][_0x2b54b7[_0x2367('0x27')]][_0x2367('0x51')](_0x265a5a)){if(this['channels'][_0x2b54b7['uniqueid']][_0x265a5a][_0x2367('0x3a')]&&!this[_0x2367('0xa')][_0x2b54b7[_0x2367('0x27')]][_0x265a5a][_0x2367('0x14')]){logger['info'](_0x2367('0x57'),_0x2b54b7[_0x2367('0x27')],this[_0x2367('0xa')][_0x2b54b7[_0x2367('0x27')]][_0x265a5a]['membername'],_0x265a5a);this[_0x2367('0xa')][_0x2b54b7[_0x2367('0x27')]][_0x265a5a][_0x2367('0x14')]=!![];this[_0x2367('0xa')][_0x2b54b7['uniqueid']][_0x265a5a][_0x2367('0x58')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x2367('0xa')][_0x2b54b7[_0x2367('0x27')]][_0x265a5a][_0x2367('0x40')]=_0x2367('0x59');this['channels'][_0x2b54b7[_0x2367('0x27')]][_0x265a5a][_0x2367('0x4a')]=_0x2b54b7[_0x2367('0x4a')]==_0x2367('0x5a')?_0x2367('0x5b'):_0x2b54b7[_0x2367('0x4a')];this[_0x2367('0xa')][_0x2b54b7[_0x2367('0x27')]][_0x265a5a][_0x2367('0x5c')]=_0x2b54b7[_0x2367('0x5c')];if(this[_0x2367('0xb')][_0x2b54b7[_0x2367('0x2b')]]&&this[_0x2367('0xb')][_0x2b54b7['queue']][_0x2367('0x5d')]){this[_0x2367('0xa')][_0x2b54b7[_0x2367('0x27')]][_0x265a5a][_0x2367('0x5e')]=this[_0x2367('0xb')][_0x2b54b7[_0x2367('0x2b')]][_0x2367('0x5f')];this[_0x2367('0xa')][_0x2b54b7[_0x2367('0x27')]][_0x265a5a][_0x2367('0x60')]=!![];}this[_0x2367('0xc')][_0x2b54b7['interface']]=_['omit'](this[_0x2367('0xc')][_0x2b54b7[_0x2367('0x42')]],[_0x2367('0x2b'),_0x2367('0x61')]);logger[_0x2367('0x24')](_0x2367('0x62'),_0x2b54b7['uniqueid'],util[_0x2367('0x26')](this['channels'][_0x2b54b7[_0x2367('0x27')]][_0x265a5a],{'showHidden':![],'depth':null}));ami[_0x2367('0x1e')](_0x2367('0x63'),this[_0x2367('0xa')][_0x2b54b7[_0x2367('0x27')]][_0x265a5a]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2b54b7[_0x2367('0x27')],util[_0x2367('0x26')](this[_0x2367('0xa')][_0x2b54b7[_0x2367('0x27')]][_0x265a5a],{'showHidden':![],'depth':null}));this[_0x2367('0x1e')](util[_0x2367('0x35')](_0x2367('0x36'),_0x2b54b7[_0x2367('0x23')]),_0x2367('0x64'),this[_0x2367('0xa')][_0x2b54b7[_0x2367('0x27')]][_0x265a5a]);}}}}}}catch(_0x1ef344){logger[_0x2367('0x37')](_0x2367('0x65'),_0x2b54b7[_0x2367('0x27')],util[_0x2367('0x26')](_0x1ef344,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2367('0x1d')][_0x2367('0x15')]=function(_0x423350){try{if(this[_0x2367('0x1f')](_0x423350)){logger[_0x2367('0x24')]('[%s][voiceAgentReport][varset]\x20event:',_0x423350['uniqueid'],util[_0x2367('0x26')](_0x423350,{'showHidden':![],'depth':null}));this['addVariable'](_0x423350[_0x2367('0x27')],_[_0x2367('0x66')](_0x423350[_0x2367('0x67')])[0x0],_0x423350['value']);if(this['channels'][_0x423350[_0x2367('0x27')]]){for(var _0x5e5783 in this[_0x2367('0xa')][_0x423350[_0x2367('0x27')]]){if(this[_0x2367('0xa')][_0x423350[_0x2367('0x27')]][_0x2367('0x51')](_0x5e5783)){logger[_0x2367('0x22')](_0x2367('0x68'),_0x423350[_0x2367('0x27')],_0x5e5783,_[_0x2367('0x66')](_0x423350['variable'])[0x0],_0x423350[_0x2367('0x69')]);if(_['isUndefined'](this[_0x2367('0xa')][_0x423350['uniqueid']][_0x5e5783][_0x2367('0xd')])){this[_0x2367('0xa')][_0x423350[_0x2367('0x27')]][_0x5e5783]['variables']={};}this[_0x2367('0xa')][_0x423350[_0x2367('0x27')]][_0x5e5783][_0x2367('0xd')]=this[_0x2367('0xd')][_0x423350['uniqueid']];}}}}}catch(_0x4efd30){logger[_0x2367('0x37')](_0x2367('0x6a'),_0x423350[_0x2367('0x27')],util['inspect'](_0x4efd30,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2367('0x1d')][_0x2367('0x6b')]=function(_0x46d8f,_0x2f5d1c,_0x5d0e80){var _0xbea3f3=[_0x2367('0x6c'),_0x2367('0x6d'),'rtpaudioqosjitter',_0x2367('0x6e'),_0x2367('0x6f'),'rtpaudioqoslossbridged',_0x2367('0x70'),_0x2367('0x71'),_0x2367('0x72'),_0x2367('0x73'),'bridgepeer','bridgepvtcallid',_0x2367('0x74'),_0x2367('0x75'),'memberinterface',_0x2367('0x76'),'membername','memberpenalty','memberrealtime'];if(!_[_0x2367('0x77')](_0x2f5d1c)&&!_[_0x2367('0x78')](_0xbea3f3,_0x2f5d1c)){if(_['isUndefined'](this[_0x2367('0xd')][_0x46d8f])){this[_0x2367('0xd')][_0x46d8f]={};}this[_0x2367('0xd')][_0x46d8f][_0x2f5d1c]=_0x5d0e80;}};VoiceAgentReport[_0x2367('0x1d')][_0x2367('0x79')]=function(_0x225537){try{if(this[_0x2367('0x1f')](_0x225537)){logger[_0x2367('0x24')]('[%s][voiceAgentReport][hangup]\x20event:',_0x225537['uniqueid'],util[_0x2367('0x26')](_0x225537,{'showHidden':![],'depth':null}));if(this[_0x2367('0xa')][_0x225537[_0x2367('0x27')]]){for(var _0x2687a7 in this[_0x2367('0xa')][_0x225537[_0x2367('0x27')]]){if(this['channels'][_0x225537['uniqueid']][_0x2367('0x51')](_0x2687a7)){if(this[_0x2367('0xa')][_0x225537[_0x2367('0x27')]][_0x2687a7][_0x2367('0x4a')]==_0x2367('0x5a')&&this['channels'][_0x225537[_0x2367('0x27')]][_0x2687a7]['agentcomplete']){logger['info'](_0x2367('0x7a'),_0x225537[_0x2367('0x27')],_0x2687a7);this[_0x2367('0xa')][_0x225537[_0x2367('0x27')]][_0x2687a7][_0x2367('0x58')]=moment()['format'](_0x2367('0x29'));}}}logger[_0x2367('0x24')](_0x2367('0x7b'),_0x225537[_0x2367('0x27')],util[_0x2367('0x26')](_['values'](this[_0x2367('0xa')][_0x225537[_0x2367('0x27')]]),{'showHidden':![],'depth':null}));ami[_0x2367('0x1e')](_0x2367('0x7c'),_['values'](this[_0x2367('0xa')][_0x225537['uniqueid']]));delete this[_0x2367('0xa')][_0x225537[_0x2367('0x27')]];}if(this[_0x2367('0xd')][_0x225537[_0x2367('0x27')]]){delete this[_0x2367('0xd')][_0x225537[_0x2367('0x27')]];}}}catch(_0x459f07){logger[_0x2367('0x37')](_0x2367('0x7d'),_0x225537[_0x2367('0x27')],util[_0x2367('0x26')](_0x459f07,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2367('0x1d')][_0x2367('0x1a')]=function(_0x3204d9){try{if(this[_0x2367('0x1f')](_0x3204d9)){logger[_0x2367('0x24')](_0x2367('0x7e'),_0x3204d9[_0x2367('0x27')],util[_0x2367('0x26')](_0x3204d9,{'showHidden':![],'depth':null}));if(this[_0x2367('0xa')][_0x3204d9[_0x2367('0x7f')]]){for(var _0x95b96d in this[_0x2367('0xa')][_0x3204d9['transfereeuniqueid']]){if(this[_0x2367('0xa')][_0x3204d9[_0x2367('0x7f')]][_0x2367('0x51')](_0x95b96d)){if(_0x3204d9['origtransfereruniqueid']===_0x95b96d){logger['info'](_0x2367('0x80'),_0x3204d9[_0x2367('0x27')],this[_0x2367('0xa')][_0x3204d9['transfereeuniqueid']][_0x95b96d][_0x2367('0x23')],_0x95b96d);var _0x17dbef=moment();this[_0x2367('0xa')][_0x3204d9[_0x2367('0x7f')]][_0x95b96d][_0x2367('0x14')]=!![];this[_0x2367('0xa')][_0x3204d9[_0x2367('0x7f')]][_0x95b96d][_0x2367('0x58')]=moment()[_0x2367('0x35')](_0x2367('0x29'));this[_0x2367('0xa')][_0x3204d9[_0x2367('0x7f')]][_0x95b96d][_0x2367('0x40')]=_0x2367('0x59');this[_0x2367('0xa')][_0x3204d9[_0x2367('0x7f')]][_0x95b96d]['reason']=_0x2367('0x5a');this[_0x2367('0xa')][_0x3204d9[_0x2367('0x7f')]][_0x95b96d][_0x2367('0x5c')]=_0x17dbef[_0x2367('0x81')](this['channels'][_0x3204d9[_0x2367('0x7f')]][_0x95b96d][_0x2367('0x3a')],_0x2367('0x82'));}}}}if(this[_0x2367('0xa')][_0x3204d9[_0x2367('0x83')]]){var _0x48d770=this['channels'][_0x3204d9[_0x2367('0x83')]];this[_0x2367('0xa')][_0x3204d9[_0x2367('0x83')]]=this['channels'][_0x3204d9[_0x2367('0x7f')]];this[_0x2367('0xa')][_0x3204d9[_0x2367('0x7f')]]=_0x48d770;}}}catch(_0x1adfc4){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x3204d9['uniqueid'],util['inspect'](_0x1adfc4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2367('0x1d')][_0x2367('0x1c')]=function(_0x7e98d8){try{if(this['isNotNull'](_0x7e98d8)){logger[_0x2367('0x24')](_0x2367('0x84'),_0x7e98d8[_0x2367('0x27')],util[_0x2367('0x26')](_0x7e98d8,{'showHidden':![],'depth':null}));if(this[_0x2367('0xa')][_0x7e98d8[_0x2367('0x7f')]]){for(var _0x2a05ce in this[_0x2367('0xa')][_0x7e98d8['transfereeuniqueid']]){if(this[_0x2367('0xa')][_0x7e98d8[_0x2367('0x7f')]][_0x2367('0x51')](_0x2a05ce)){if(_0x7e98d8['transfereruniqueid']===_0x2a05ce){logger['info'](_0x2367('0x85'),_0x7e98d8[_0x2367('0x27')],this[_0x2367('0xa')][_0x7e98d8[_0x2367('0x7f')]][_0x2a05ce][_0x2367('0x23')],_0x2a05ce);var _0xec6787=moment();this[_0x2367('0xa')][_0x7e98d8[_0x2367('0x7f')]][_0x2a05ce][_0x2367('0x14')]=!![];this['channels'][_0x7e98d8[_0x2367('0x7f')]][_0x2a05ce]['agentcompleteAt']=_0xec6787;this[_0x2367('0xa')][_0x7e98d8[_0x2367('0x7f')]][_0x2a05ce]['lastevent']=_0x2367('0x59');this[_0x2367('0xa')][_0x7e98d8[_0x2367('0x7f')]][_0x2a05ce]['reason']=_0x2367('0x5a');this[_0x2367('0xa')][_0x7e98d8[_0x2367('0x7f')]][_0x2a05ce][_0x2367('0x5c')]=_0xec6787[_0x2367('0x81')](this[_0x2367('0xa')][_0x7e98d8['transfereeuniqueid']][_0x2a05ce]['agentconnectAt'],_0x2367('0x82'));}}}}}}catch(_0x38f994){logger[_0x2367('0x37')](_0x2367('0x86'),_0x7e98d8['uniqueid'],util[_0x2367('0x26')](_0x38f994,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2367('0x1d')][_0x2367('0x87')]=function(_0x565b5f){var _0x2bed25='';try{if(this[_0x2367('0x1f')](_0x565b5f)){logger[_0x2367('0x24')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x565b5f[_0x2367('0x27')],util[_0x2367('0x26')](_0x565b5f,{'showHidden':![],'depth':null}));if(_0x565b5f['channel']){_0x2bed25=_0x565b5f[_0x2367('0x88')][_0x2367('0x89')](0x0,_0x565b5f[_0x2367('0x88')][_0x2367('0x8a')]('-'));if(this['agents'][_0x2bed25]){logger[_0x2367('0x22')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x565b5f[_0x2367('0x27')],_0x2bed25);this['agents'][_0x2bed25]['onhold']=!![];}}}}catch(_0xdab5ca){logger[_0x2367('0x37')](_0x2367('0x8b'),_0x565b5f['uniqueid'],util[_0x2367('0x26')](_0xdab5ca,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2367('0x1d')][_0x2367('0x18')]=function(_0x507ed1){var _0x3d2655='';try{if(this['isNotNull'](_0x507ed1)){logger['debug'](_0x2367('0x8c'),_0x507ed1[_0x2367('0x27')],util[_0x2367('0x26')](_0x507ed1,{'showHidden':![],'depth':null}));if(_0x507ed1[_0x2367('0x88')]){_0x3d2655=_0x507ed1['channel'][_0x2367('0x89')](0x0,_0x507ed1[_0x2367('0x88')][_0x2367('0x8a')]('-'));if(this[_0x2367('0xc')][_0x3d2655]){logger['info']('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x507ed1[_0x2367('0x27')],_0x3d2655);this[_0x2367('0xc')][_0x3d2655][_0x2367('0x8d')]=![];}}}}catch(_0x50263a){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x507ed1[_0x2367('0x27')],util[_0x2367('0x26')](_0x50263a,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x1c94=['[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','agentcomplete','varset','hangup','syncHangup','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','info','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','membername','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','interface','pick','destconnectedlinenum','user:%s','user:agentconnect','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','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]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','variable','variables','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]'];(function(_0x5d5533,_0x111a56){var _0x2a4525=function(_0x23f4d2){while(--_0x23f4d2){_0x5d5533['push'](_0x5d5533['shift']());}};_0x2a4525(++_0x111a56);}(_0x1c94,0x1e0));var _0x41c9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1c94[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x41c9('0x0'));var moment=require(_0x41c9('0x1'));var util=require(_0x41c9('0x2'));var Redis=require(_0x41c9('0x3'));var config=require(_0x41c9('0x4'));var logger=require(_0x41c9('0x5'))(_0x41c9('0x6'));var ami=require(_0x41c9('0x7'));config[_0x41c9('0x8')]=_[_0x41c9('0x9')](config[_0x41c9('0x8')],{'host':_0x41c9('0xa'),'port':0x18eb});var io=require(_0x41c9('0xb'))(new Redis(config['redis']));function VoiceAgentReport(_0x3f3f1a){this[_0x41c9('0xc')]={};this[_0x41c9('0xd')]=_0x3f3f1a['voiceQueues'];this[_0x41c9('0xe')]=_0x3f3f1a[_0x41c9('0xe')];this['variables']={};ami['on'](_0x41c9('0xf'),this[_0x41c9('0x10')][_0x41c9('0x11')](this));ami['on'](_0x41c9('0x12'),this['syncAgentConnect'][_0x41c9('0x11')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x41c9('0x11')](this));ami['on'](_0x41c9('0x13'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x41c9('0x14'),this['syncAgentComplete']['bind'](this));ami['on'](_0x41c9('0x15'),this['syncVarSet'][_0x41c9('0x11')](this));ami['on'](_0x41c9('0x16'),this[_0x41c9('0x17')][_0x41c9('0x11')](this));ami['on']('musiconholdstart',this[_0x41c9('0x18')][_0x41c9('0x11')](this));ami['on']('musiconholdstop',this[_0x41c9('0x19')][_0x41c9('0x11')](this));ami['on'](_0x41c9('0x1a'),this[_0x41c9('0x1b')][_0x41c9('0x11')](this));ami['on'](_0x41c9('0x1c'),this[_0x41c9('0x1d')][_0x41c9('0x11')](this));}VoiceAgentReport['prototype'][_0x41c9('0x1e')]=function(_0x478062,_0x181120,_0x18aa9f){io['to'](_0x478062)[_0x41c9('0x1e')](_0x181120,_0x18aa9f);};VoiceAgentReport[_0x41c9('0x1f')][_0x41c9('0x20')]=function(_0x2169fe){return _0x2169fe!==null&&!_[_0x41c9('0x21')](_0x2169fe);};VoiceAgentReport['prototype'][_0x41c9('0x10')]=function(_0x28f883){try{if(this[_0x41c9('0x20')](_0x28f883)){logger[_0x41c9('0x22')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x28f883[_0x41c9('0x23')],_0x28f883['membername'],_0x28f883[_0x41c9('0x24')]);logger[_0x41c9('0x25')](_0x41c9('0x26'),_0x28f883['uniqueid'],util[_0x41c9('0x27')](_0x28f883,{'showHidden':![],'depth':null}));if(_[_0x41c9('0x21')](this[_0x41c9('0xc')][_0x28f883['uniqueid']])){this['channels'][_0x28f883['uniqueid']]={};}if(_['isUndefined'](this['channels'][_0x28f883['uniqueid']][_0x28f883['destuniqueid']])){this[_0x41c9('0xc')][_0x28f883[_0x41c9('0x23')]][_0x28f883[_0x41c9('0x24')]]={'agentcalledAt':moment()[_0x41c9('0x28')](_0x41c9('0x29')),'lastevent':_0x41c9('0x2a'),'mandatoryDisposition':this[_0x41c9('0xd')][_0x28f883[_0x41c9('0x2b')]]?this[_0x41c9('0xd')][_0x28f883[_0x41c9('0x2b')]][_0x41c9('0x2c')]||![]:![],'type':this[_0x41c9('0xd')][_0x28f883[_0x41c9('0x2b')]]?this['voiceQueues'][_0x28f883['queue']][_0x41c9('0x2d')]||_0x41c9('0x2e'):_0x41c9('0x2e'),'variables':this['variables'][_0x28f883['uniqueid']]};}_[_0x41c9('0x2f')](this[_0x41c9('0xc')][_0x28f883[_0x41c9('0x23')]][_0x28f883[_0x41c9('0x24')]],_[_0x41c9('0x30')](_0x28f883,['event',_0x41c9('0x31')]));logger['debug'](_0x41c9('0x32'),_0x28f883[_0x41c9('0x23')],util[_0x41c9('0x27')](this[_0x41c9('0xc')][_0x28f883['uniqueid']][_0x28f883[_0x41c9('0x24')]],{'showHidden':![],'depth':null}));ami[_0x41c9('0x1e')](_0x41c9('0x33'),this[_0x41c9('0xc')][_0x28f883[_0x41c9('0x23')]][_0x28f883['destuniqueid']]);logger[_0x41c9('0x25')](_0x41c9('0x34'),_0x28f883['uniqueid'],util[_0x41c9('0x27')](this['channels'][_0x28f883[_0x41c9('0x23')]][_0x28f883[_0x41c9('0x24')]],{'showHidden':![],'depth':null}));this[_0x41c9('0x1e')](util[_0x41c9('0x28')]('user:%s',_0x28f883[_0x41c9('0x35')]),'user:called',this[_0x41c9('0xc')][_0x28f883['uniqueid']][_0x28f883[_0x41c9('0x24')]]);}}catch(_0x58bcf8){logger[_0x41c9('0x36')](_0x41c9('0x37'),_0x28f883[_0x41c9('0x23')],util[_0x41c9('0x27')](_0x58bcf8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x41c9('0x1f')]['syncAgentConnect']=function(_0x1ed70f){try{if(this['isNotNull'](_0x1ed70f)){if(this['channels'][_0x1ed70f[_0x41c9('0x23')]]){logger[_0x41c9('0x25')](_0x41c9('0x38'),_0x1ed70f[_0x41c9('0x23')],util[_0x41c9('0x27')](_0x1ed70f,{'showHidden':![],'depth':null}));for(var _0x305824 in this['channels'][_0x1ed70f[_0x41c9('0x23')]]){if(this['channels'][_0x1ed70f[_0x41c9('0x23')]]['hasOwnProperty'](_0x305824)){if(_0x1ed70f['destuniqueid']===_0x305824){logger[_0x41c9('0x22')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x1ed70f[_0x41c9('0x23')],_0x1ed70f[_0x41c9('0x35')],_0x1ed70f['destuniqueid']);this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824]['agentconnectAt']=moment()[_0x41c9('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824]['connectedlinename']=_0x1ed70f['connectedlinename'];this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824][_0x41c9('0x39')]=_0x1ed70f[_0x41c9('0x39')];this[_0x41c9('0xc')][_0x1ed70f['uniqueid']][_0x305824]['destchannelstate']=_0x1ed70f[_0x41c9('0x3a')];this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824][_0x41c9('0x3b')]=_0x1ed70f[_0x41c9('0x3b')];this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824][_0x41c9('0x3c')]=_0x1ed70f[_0x41c9('0x3c')];this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824][_0x41c9('0x3d')]='connect';_[_0x41c9('0x2f')](this[_0x41c9('0xe')][_0x1ed70f[_0x41c9('0x3e')]],_[_0x41c9('0x3f')](_0x1ed70f,['queue',_0x41c9('0x40')]));logger[_0x41c9('0x25')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x1ed70f[_0x41c9('0x23')],util[_0x41c9('0x27')](this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x1ed70f[_0x41c9('0x24')]],{'showHidden':![],'depth':null}));ami[_0x41c9('0x1e')]('custom:agentconnect',this[_0x41c9('0xc')][_0x1ed70f['uniqueid']][_0x1ed70f[_0x41c9('0x24')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x1ed70f[_0x41c9('0x23')],util['inspect'](this[_0x41c9('0xc')][_0x1ed70f['uniqueid']][_0x1ed70f[_0x41c9('0x24')]],{'showHidden':![],'depth':null}));this[_0x41c9('0x1e')](util['format'](_0x41c9('0x41'),_0x1ed70f[_0x41c9('0x35')]),_0x41c9('0x42'),this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x1ed70f[_0x41c9('0x24')]]);}else if(!this[_0x41c9('0xc')][_0x1ed70f['uniqueid']][_0x305824]['agentringnoanswer']&&!this['channels'][_0x1ed70f[_0x41c9('0x23')]][_0x305824][_0x41c9('0x14')]){logger[_0x41c9('0x22')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x1ed70f[_0x41c9('0x23')],this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824][_0x41c9('0x35')],_0x305824);this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824]['agentringnoanswer']=!![];this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824][_0x41c9('0x43')]=moment()[_0x41c9('0x28')](_0x41c9('0x29'));this['channels'][_0x1ed70f[_0x41c9('0x23')]][_0x305824][_0x41c9('0x44')]=_0x1ed70f[_0x41c9('0x24')];this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824]['answeredelsewheremembername']=_0x1ed70f[_0x41c9('0x35')];this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824][_0x41c9('0x3d')]=_0x41c9('0x45');this['channels'][_0x1ed70f[_0x41c9('0x23')]][_0x305824][_0x41c9('0x46')]=_0x41c9('0x45');logger[_0x41c9('0x25')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x1ed70f[_0x41c9('0x23')],util[_0x41c9('0x27')](this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824],{'showHidden':![],'depth':null}));ami[_0x41c9('0x1e')](_0x41c9('0x47'),this[_0x41c9('0xc')][_0x1ed70f[_0x41c9('0x23')]][_0x305824]);}}}}}}catch(_0x5d0340){logger[_0x41c9('0x36')](_0x41c9('0x48'),_0x1ed70f[_0x41c9('0x23')],util['inspect'](_0x5d0340,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x41c9('0x1f')][_0x41c9('0x49')]=function(_0xf389b){try{if(this[_0x41c9('0x20')](_0xf389b)){logger[_0x41c9('0x25')](_0x41c9('0x4a'),_0xf389b[_0x41c9('0x23')],util[_0x41c9('0x27')](_0xf389b,{'showHidden':![],'depth':null}));if(this[_0x41c9('0xc')][_0xf389b[_0x41c9('0x23')]]&&this[_0x41c9('0xc')][_0xf389b[_0x41c9('0x23')]][_0xf389b[_0x41c9('0x24')]]){logger['info'](_0x41c9('0x4b'),_0xf389b[_0x41c9('0x23')],_0xf389b['membername'],_0xf389b['destuniqueid']);this[_0x41c9('0xc')][_0xf389b['uniqueid']][_0xf389b[_0x41c9('0x24')]]['agentringnoanswer']=!![];this[_0x41c9('0xc')][_0xf389b[_0x41c9('0x23')]][_0xf389b[_0x41c9('0x24')]][_0x41c9('0x43')]=moment()[_0x41c9('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xf389b[_0x41c9('0x23')]][_0xf389b[_0x41c9('0x24')]][_0x41c9('0x3d')]=_0x41c9('0x4c');this[_0x41c9('0xc')][_0xf389b[_0x41c9('0x23')]][_0xf389b[_0x41c9('0x24')]][_0x41c9('0x46')]=_0x41c9('0x4c');logger[_0x41c9('0x25')](_0x41c9('0x4d'),_0xf389b[_0x41c9('0x23')],util['inspect'](this[_0x41c9('0xc')][_0xf389b['uniqueid']][_0xf389b['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x41c9('0x1e')](_0x41c9('0x4e'),this[_0x41c9('0xc')][_0xf389b[_0x41c9('0x23')]][_0xf389b[_0x41c9('0x24')]]);}}}catch(_0x484d6f){logger['error'](_0x41c9('0x4f'),_0xf389b[_0x41c9('0x23')],util[_0x41c9('0x27')](_0x484d6f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x41c9('0x50')]=function(_0x33e364){try{if(this[_0x41c9('0x20')](_0x33e364)){logger['debug'](_0x41c9('0x51'),_0x33e364[_0x41c9('0x23')],util[_0x41c9('0x27')](_0x33e364,{'showHidden':![],'depth':null}));if(this[_0x41c9('0xc')][_0x33e364[_0x41c9('0x23')]]){for(var _0x5b88ca in this[_0x41c9('0xc')][_0x33e364['uniqueid']]){if(this[_0x41c9('0xc')][_0x33e364['uniqueid']][_0x41c9('0x52')](_0x5b88ca)&&!this[_0x41c9('0xc')][_0x33e364[_0x41c9('0x23')]][_0x5b88ca][_0x41c9('0x53')]&&!this[_0x41c9('0xc')][_0x33e364[_0x41c9('0x23')]][_0x5b88ca][_0x41c9('0x14')]){logger['info'](_0x41c9('0x54'),_0x33e364[_0x41c9('0x23')],this[_0x41c9('0xc')][_0x33e364[_0x41c9('0x23')]][_0x5b88ca][_0x41c9('0x35')],_0x5b88ca);this['channels'][_0x33e364[_0x41c9('0x23')]][_0x5b88ca][_0x41c9('0x53')]=!![];this[_0x41c9('0xc')][_0x33e364[_0x41c9('0x23')]][_0x5b88ca]['agentringnoanswerAt']=moment()[_0x41c9('0x28')](_0x41c9('0x29'));this['channels'][_0x33e364['uniqueid']][_0x5b88ca][_0x41c9('0x3d')]='abandoned';this[_0x41c9('0xc')][_0x33e364['uniqueid']][_0x5b88ca][_0x41c9('0x46')]=_0x41c9('0x55');logger[_0x41c9('0x25')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x33e364[_0x41c9('0x23')],util[_0x41c9('0x27')](this[_0x41c9('0xc')][_0x33e364[_0x41c9('0x23')]][_0x5b88ca],{'showHidden':![],'depth':null}));ami[_0x41c9('0x1e')](_0x41c9('0x56'),this['channels'][_0x33e364[_0x41c9('0x23')]][_0x5b88ca]);}}}}}catch(_0x5de3c4){logger['error']('[%s][voiceAgentReport][queuecallerabandon]',_0x33e364[_0x41c9('0x23')],util[_0x41c9('0x27')](_0x5de3c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x41c9('0x1f')][_0x41c9('0x57')]=function(_0x22e2f3){try{if(this[_0x41c9('0x20')](_0x22e2f3)){logger[_0x41c9('0x25')](_0x41c9('0x58'),_0x22e2f3['uniqueid'],util[_0x41c9('0x27')](_0x22e2f3,{'showHidden':![],'depth':null}));if(this[_0x41c9('0xc')][_0x22e2f3[_0x41c9('0x23')]]){for(var _0x2165db in this[_0x41c9('0xc')][_0x22e2f3[_0x41c9('0x23')]]){if(this[_0x41c9('0xc')][_0x22e2f3[_0x41c9('0x23')]][_0x41c9('0x52')](_0x2165db)){if(this[_0x41c9('0xc')][_0x22e2f3[_0x41c9('0x23')]][_0x2165db][_0x41c9('0x59')]&&!this['channels'][_0x22e2f3[_0x41c9('0x23')]][_0x2165db]['agentcomplete']){logger[_0x41c9('0x22')](_0x41c9('0x5a'),_0x22e2f3[_0x41c9('0x23')],this[_0x41c9('0xc')][_0x22e2f3[_0x41c9('0x23')]][_0x2165db][_0x41c9('0x35')],_0x2165db);this[_0x41c9('0xc')][_0x22e2f3[_0x41c9('0x23')]][_0x2165db][_0x41c9('0x14')]=!![];this[_0x41c9('0xc')][_0x22e2f3[_0x41c9('0x23')]][_0x2165db]['agentcompleteAt']=moment()[_0x41c9('0x28')](_0x41c9('0x29'));this[_0x41c9('0xc')][_0x22e2f3['uniqueid']][_0x2165db][_0x41c9('0x3d')]=_0x41c9('0x5b');this[_0x41c9('0xc')][_0x22e2f3[_0x41c9('0x23')]][_0x2165db][_0x41c9('0x46')]=_0x22e2f3['reason']==_0x41c9('0x5c')?_0x41c9('0x5d'):_0x22e2f3['reason'];this[_0x41c9('0xc')][_0x22e2f3['uniqueid']][_0x2165db]['talktime']=_0x22e2f3[_0x41c9('0x5e')];if(this[_0x41c9('0xd')][_0x22e2f3[_0x41c9('0x2b')]]&&this[_0x41c9('0xd')][_0x22e2f3[_0x41c9('0x2b')]][_0x41c9('0x5f')]){this['channels'][_0x22e2f3[_0x41c9('0x23')]][_0x2165db][_0x41c9('0x60')]=this[_0x41c9('0xd')][_0x22e2f3[_0x41c9('0x2b')]][_0x41c9('0x61')];this[_0x41c9('0xc')][_0x22e2f3['uniqueid']][_0x2165db][_0x41c9('0x62')]=!![];}this[_0x41c9('0xe')][_0x22e2f3[_0x41c9('0x3e')]]=_[_0x41c9('0x30')](this[_0x41c9('0xe')][_0x22e2f3['interface']],['queue',_0x41c9('0x40')]);logger[_0x41c9('0x25')](_0x41c9('0x63'),_0x22e2f3[_0x41c9('0x23')],util[_0x41c9('0x27')](this[_0x41c9('0xc')][_0x22e2f3['uniqueid']][_0x2165db],{'showHidden':![],'depth':null}));ami[_0x41c9('0x1e')](_0x41c9('0x64'),this[_0x41c9('0xc')][_0x22e2f3['uniqueid']][_0x2165db]);logger[_0x41c9('0x25')](_0x41c9('0x65'),_0x22e2f3[_0x41c9('0x23')],util[_0x41c9('0x27')](this['channels'][_0x22e2f3[_0x41c9('0x23')]][_0x2165db],{'showHidden':![],'depth':null}));this[_0x41c9('0x1e')](util[_0x41c9('0x28')](_0x41c9('0x41'),_0x22e2f3[_0x41c9('0x35')]),_0x41c9('0x66'),this[_0x41c9('0xc')][_0x22e2f3[_0x41c9('0x23')]][_0x2165db]);}}}}}}catch(_0x5f3da8){logger[_0x41c9('0x36')](_0x41c9('0x67'),_0x22e2f3['uniqueid'],util['inspect'](_0x5f3da8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x4e47b3){try{if(this['isNotNull'](_0x4e47b3)){logger['debug'](_0x41c9('0x68'),_0x4e47b3['uniqueid'],util[_0x41c9('0x27')](_0x4e47b3,{'showHidden':![],'depth':null}));this[_0x41c9('0x69')](_0x4e47b3[_0x41c9('0x23')],_[_0x41c9('0x6a')](_0x4e47b3['variable'])[0x0],_0x4e47b3[_0x41c9('0x6b')]);if(this[_0x41c9('0xc')][_0x4e47b3[_0x41c9('0x23')]]){for(var _0x247928 in this['channels'][_0x4e47b3[_0x41c9('0x23')]]){if(this[_0x41c9('0xc')][_0x4e47b3[_0x41c9('0x23')]][_0x41c9('0x52')](_0x247928)){logger[_0x41c9('0x22')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x4e47b3[_0x41c9('0x23')],_0x247928,_[_0x41c9('0x6a')](_0x4e47b3[_0x41c9('0x6c')])[0x0],_0x4e47b3['value']);if(_[_0x41c9('0x21')](this[_0x41c9('0xc')][_0x4e47b3[_0x41c9('0x23')]][_0x247928][_0x41c9('0x6d')])){this[_0x41c9('0xc')][_0x4e47b3['uniqueid']][_0x247928][_0x41c9('0x6d')]={};}this[_0x41c9('0xc')][_0x4e47b3[_0x41c9('0x23')]][_0x247928][_0x41c9('0x6d')]=this[_0x41c9('0x6d')][_0x4e47b3[_0x41c9('0x23')]];}}}}}catch(_0x53f8c1){logger['error'](_0x41c9('0x6e'),_0x4e47b3[_0x41c9('0x23')],util[_0x41c9('0x27')](_0x53f8c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x41c9('0x1f')]['addVariable']=function(_0x51f708,_0x43cd02,_0x12711e){var _0x3d58e4=[_0x41c9('0x6f'),_0x41c9('0x70'),_0x41c9('0x71'),_0x41c9('0x72'),_0x41c9('0x73'),_0x41c9('0x74'),_0x41c9('0x75'),_0x41c9('0x76'),_0x41c9('0x77'),_0x41c9('0x78'),'bridgepeer',_0x41c9('0x79'),_0x41c9('0x7a'),_0x41c9('0x7b'),_0x41c9('0x7c'),'memberlastcall',_0x41c9('0x35'),_0x41c9('0x7d'),_0x41c9('0x7e')];if(!_[_0x41c9('0x7f')](_0x43cd02)&&!_[_0x41c9('0x80')](_0x3d58e4,_0x43cd02)){if(_[_0x41c9('0x21')](this[_0x41c9('0x6d')][_0x51f708])){this[_0x41c9('0x6d')][_0x51f708]={};}this['variables'][_0x51f708][_0x43cd02]=_0x12711e;}};VoiceAgentReport[_0x41c9('0x1f')][_0x41c9('0x17')]=function(_0x46909c){try{if(this[_0x41c9('0x20')](_0x46909c)){logger[_0x41c9('0x25')](_0x41c9('0x81'),_0x46909c['uniqueid'],util[_0x41c9('0x27')](_0x46909c,{'showHidden':![],'depth':null}));if(this['channels'][_0x46909c[_0x41c9('0x23')]]){for(var _0x501e21 in this[_0x41c9('0xc')][_0x46909c['uniqueid']]){if(this[_0x41c9('0xc')][_0x46909c[_0x41c9('0x23')]][_0x41c9('0x52')](_0x501e21)){if(this[_0x41c9('0xc')][_0x46909c['uniqueid']][_0x501e21][_0x41c9('0x46')]==_0x41c9('0x5c')&&this[_0x41c9('0xc')][_0x46909c[_0x41c9('0x23')]][_0x501e21][_0x41c9('0x14')]){logger['info'](_0x41c9('0x82'),_0x46909c[_0x41c9('0x23')],_0x501e21);this['channels'][_0x46909c['uniqueid']][_0x501e21][_0x41c9('0x83')]=moment()['format'](_0x41c9('0x29'));}}}logger[_0x41c9('0x25')](_0x41c9('0x84'),_0x46909c[_0x41c9('0x23')],util[_0x41c9('0x27')](_['values'](this[_0x41c9('0xc')][_0x46909c[_0x41c9('0x23')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x41c9('0x85'),_[_0x41c9('0x86')](this[_0x41c9('0xc')][_0x46909c['uniqueid']]));delete this[_0x41c9('0xc')][_0x46909c['uniqueid']];}if(this[_0x41c9('0x6d')][_0x46909c[_0x41c9('0x23')]]){delete this[_0x41c9('0x6d')][_0x46909c[_0x41c9('0x23')]];}}}catch(_0x6e6764){logger[_0x41c9('0x36')](_0x41c9('0x87'),_0x46909c[_0x41c9('0x23')],util['inspect'](_0x6e6764,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x41c9('0x1f')][_0x41c9('0x1b')]=function(_0x1171f0){try{if(this[_0x41c9('0x20')](_0x1171f0)){logger[_0x41c9('0x25')](_0x41c9('0x88'),_0x1171f0[_0x41c9('0x23')],util[_0x41c9('0x27')](_0x1171f0,{'showHidden':![],'depth':null}));if(this[_0x41c9('0xc')][_0x1171f0[_0x41c9('0x89')]]){for(var _0x1bcca4 in this[_0x41c9('0xc')][_0x1171f0[_0x41c9('0x89')]]){if(this[_0x41c9('0xc')][_0x1171f0[_0x41c9('0x89')]]['hasOwnProperty'](_0x1bcca4)){if(_0x1171f0[_0x41c9('0x8a')]===_0x1bcca4){logger[_0x41c9('0x22')](_0x41c9('0x8b'),_0x1171f0[_0x41c9('0x23')],this['channels'][_0x1171f0[_0x41c9('0x89')]][_0x1bcca4][_0x41c9('0x35')],_0x1bcca4);var _0x360f7e=moment();this[_0x41c9('0xc')][_0x1171f0[_0x41c9('0x89')]][_0x1bcca4][_0x41c9('0x14')]=!![];this[_0x41c9('0xc')][_0x1171f0['transfereeuniqueid']][_0x1bcca4][_0x41c9('0x83')]=moment()[_0x41c9('0x28')](_0x41c9('0x29'));this[_0x41c9('0xc')][_0x1171f0[_0x41c9('0x89')]][_0x1bcca4][_0x41c9('0x3d')]=_0x41c9('0x5b');this['channels'][_0x1171f0[_0x41c9('0x89')]][_0x1bcca4][_0x41c9('0x46')]=_0x41c9('0x5c');this['channels'][_0x1171f0[_0x41c9('0x89')]][_0x1bcca4][_0x41c9('0x5e')]=_0x360f7e[_0x41c9('0x8c')](this[_0x41c9('0xc')][_0x1171f0[_0x41c9('0x89')]][_0x1bcca4][_0x41c9('0x59')],_0x41c9('0x8d'));}}}}if(this[_0x41c9('0xc')][_0x1171f0[_0x41c9('0x8e')]]){var _0x22edca=this[_0x41c9('0xc')][_0x1171f0[_0x41c9('0x8e')]];this[_0x41c9('0xc')][_0x1171f0[_0x41c9('0x8e')]]=this[_0x41c9('0xc')][_0x1171f0[_0x41c9('0x89')]];this[_0x41c9('0xc')][_0x1171f0[_0x41c9('0x89')]]=_0x22edca;}}}catch(_0x456aa0){logger[_0x41c9('0x36')](_0x41c9('0x8f'),_0x1171f0[_0x41c9('0x23')],util[_0x41c9('0x27')](_0x456aa0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x41c9('0x1f')][_0x41c9('0x1d')]=function(_0x4c4722){try{if(this[_0x41c9('0x20')](_0x4c4722)){logger[_0x41c9('0x25')](_0x41c9('0x90'),_0x4c4722[_0x41c9('0x23')],util[_0x41c9('0x27')](_0x4c4722,{'showHidden':![],'depth':null}));if(this[_0x41c9('0xc')][_0x4c4722['transfereeuniqueid']]){for(var _0x2d6dc6 in this[_0x41c9('0xc')][_0x4c4722['transfereeuniqueid']]){if(this[_0x41c9('0xc')][_0x4c4722[_0x41c9('0x89')]]['hasOwnProperty'](_0x2d6dc6)){if(_0x4c4722[_0x41c9('0x91')]===_0x2d6dc6){logger[_0x41c9('0x22')](_0x41c9('0x92'),_0x4c4722[_0x41c9('0x23')],this[_0x41c9('0xc')][_0x4c4722[_0x41c9('0x89')]][_0x2d6dc6][_0x41c9('0x35')],_0x2d6dc6);var _0x5b2d9b=moment();this[_0x41c9('0xc')][_0x4c4722['transfereeuniqueid']][_0x2d6dc6]['agentcomplete']=!![];this[_0x41c9('0xc')][_0x4c4722[_0x41c9('0x89')]][_0x2d6dc6][_0x41c9('0x83')]=_0x5b2d9b;this['channels'][_0x4c4722[_0x41c9('0x89')]][_0x2d6dc6][_0x41c9('0x3d')]=_0x41c9('0x5b');this[_0x41c9('0xc')][_0x4c4722[_0x41c9('0x89')]][_0x2d6dc6]['reason']=_0x41c9('0x5c');this[_0x41c9('0xc')][_0x4c4722[_0x41c9('0x89')]][_0x2d6dc6]['talktime']=_0x5b2d9b[_0x41c9('0x8c')](this[_0x41c9('0xc')][_0x4c4722[_0x41c9('0x89')]][_0x2d6dc6][_0x41c9('0x59')],_0x41c9('0x8d'));}}}}}}catch(_0x56eff6){logger['error'](_0x41c9('0x93'),_0x4c4722[_0x41c9('0x23')],util[_0x41c9('0x27')](_0x56eff6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x41c9('0x1f')][_0x41c9('0x18')]=function(_0x482ef1){var _0x5c5ba8='';try{if(this[_0x41c9('0x20')](_0x482ef1)){logger['debug'](_0x41c9('0x94'),_0x482ef1[_0x41c9('0x23')],util['inspect'](_0x482ef1,{'showHidden':![],'depth':null}));if(_0x482ef1[_0x41c9('0x95')]){_0x5c5ba8=_0x482ef1[_0x41c9('0x95')]['substring'](0x0,_0x482ef1[_0x41c9('0x95')][_0x41c9('0x96')]('-'));if(this[_0x41c9('0xe')][_0x5c5ba8]){logger[_0x41c9('0x22')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x482ef1[_0x41c9('0x23')],_0x5c5ba8);this['agents'][_0x5c5ba8]['onhold']=!![];}}}}catch(_0x5e636b){logger[_0x41c9('0x36')](_0x41c9('0x97'),_0x482ef1[_0x41c9('0x23')],util[_0x41c9('0x27')](_0x5e636b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x41c9('0x1f')][_0x41c9('0x19')]=function(_0x21216d){var _0x1624ad='';try{if(this[_0x41c9('0x20')](_0x21216d)){logger[_0x41c9('0x25')](_0x41c9('0x98'),_0x21216d[_0x41c9('0x23')],util['inspect'](_0x21216d,{'showHidden':![],'depth':null}));if(_0x21216d[_0x41c9('0x95')]){_0x1624ad=_0x21216d[_0x41c9('0x95')][_0x41c9('0x99')](0x0,_0x21216d[_0x41c9('0x95')]['lastIndexOf']('-'));if(this[_0x41c9('0xe')][_0x1624ad]){logger[_0x41c9('0x22')](_0x41c9('0x9a'),_0x21216d[_0x41c9('0x23')],_0x1624ad);this['agents'][_0x1624ad][_0x41c9('0x9b')]=![];}}}}catch(_0x576799){logger[_0x41c9('0x36')](_0x41c9('0x9c'),_0x21216d[_0x41c9('0x23')],util[_0x41c9('0x27')](_0x576799,{'showHidden':![],'depth':null}));}};module[_0x41c9('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 71666f6..72b91f1 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 _0xedf7=['NO\x20ANSWER','ANSWERED','BUSY','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newchannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','[%s][voiceCallReport][newcallerid]','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','merge','pick','keys','context','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','OutgoingSpoolFailed','application','applicationdata','appdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','match','queue','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','channelstate','answered','answertime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','monitorFilename','find','isNil','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','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','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','from-sip','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','lodash','util','path','ioredis','../../../config/environment','ami','../ami','unknown','inuse','busy','invalid','ringinuse','onhold','set','agi','dial','playback','voicemail','FAILED'];(function(_0x3c6c7a,_0x4727d3){var _0x1f6f97=function(_0x3fed14){while(--_0x3fed14){_0x3c6c7a['push'](_0x3c6c7a['shift']());}};_0x1f6f97(++_0x4727d3);}(_0xedf7,0x155));var _0x7edf=function(_0x2ec5e7,_0x3572d7){_0x2ec5e7=_0x2ec5e7-0x0;var _0x389af5=_0xedf7[_0x2ec5e7];return _0x389af5;};'use strict';var BPromise=require('bluebird');var _=require(_0x7edf('0x0'));var moment=require('moment');var util=require(_0x7edf('0x1'));var path=require(_0x7edf('0x2'));var Redis=require(_0x7edf('0x3'));var config=require(_0x7edf('0x4'));var logger=require('../../../config/logger')(_0x7edf('0x5'));var ami=require(_0x7edf('0x6'));var Channel=require('../model/channel');var statusDesc=[_0x7edf('0x7'),'not_inuse',_0x7edf('0x8'),_0x7edf('0x9'),_0x7edf('0xa'),'unavailable','ringing',_0x7edf('0xb'),_0x7edf('0xc')];var applications=[_0x7edf('0xd'),'queue',_0x7edf('0xe'),_0x7edf('0xf'),_0x7edf('0x10'),_0x7edf('0x11')];var dispositions=['NO\x20ANSWER',_0x7edf('0x12'),_0x7edf('0x12'),'NO\x20ANSWER',_0x7edf('0x13'),'NO\x20ANSWER',_0x7edf('0x14'),_0x7edf('0x15'),'FAILED',_0x7edf('0x12'),'FAILED'];var actions={};config['redis']=_['defaults'](config['redis'],{'host':_0x7edf('0x16'),'port':0x18eb});var io=require(_0x7edf('0x17'))(new Redis(config['redis']));function VoiceCallReport(_0x37a1c2){this[_0x7edf('0x18')]=_0x37a1c2['channels'];this[_0x7edf('0x19')]=_0x37a1c2[_0x7edf('0x19')];this['blindTransfers']={};ami['on'](_0x7edf('0x1a'),this[_0x7edf('0x1b')][_0x7edf('0x1c')](this));ami['on']('newexten',this[_0x7edf('0x1b')]['bind'](this));ami['on'](_0x7edf('0x1d'),this['syncNewChannel'][_0x7edf('0x1c')](this));ami['on'](_0x7edf('0x1e'),this[_0x7edf('0x1f')][_0x7edf('0x1c')](this));ami['on']('varset',this[_0x7edf('0x20')][_0x7edf('0x1c')](this));ami['on'](_0x7edf('0x21'),this[_0x7edf('0x22')]['bind'](this));ami['on']('newcallerid',this[_0x7edf('0x23')]['bind'](this));ami['on'](_0x7edf('0x24'),this['syncAttendedTransfer'][_0x7edf('0x1c')](this));ami['on'](_0x7edf('0x25'),this[_0x7edf('0x26')][_0x7edf('0x1c')](this));ami['on']('musiconholdstart',this[_0x7edf('0x27')]['bind'](this));ami['on']('musiconholdstop',this[_0x7edf('0x28')][_0x7edf('0x1c')](this));try{logger[_0x7edf('0x29')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x7edf('0x2a')]();}catch(_0x592359){logger[_0x7edf('0x2b')](_0x7edf('0x2c'),util[_0x7edf('0x2d')](_0x592359,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x7edf('0x2e')][_0x7edf('0x2f')]=function(_0x5bb212){return _0x5bb212!==null&&!_[_0x7edf('0x30')](_0x5bb212);};VoiceCallReport[_0x7edf('0x2e')][_0x7edf('0x31')]=function(_0x5eaf93,_0x28709d,_0x4a4a57){io['to'](_0x5eaf93)[_0x7edf('0x31')](_0x28709d,_0x4a4a57);};VoiceCallReport[_0x7edf('0x2e')][_0x7edf('0x23')]=function(_0x5980cf){try{if(this[_0x7edf('0x2f')](_0x5980cf)){logger[_0x7edf('0x29')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x5980cf[_0x7edf('0x32')],_0x5980cf['calleridname'],_0x5980cf[_0x7edf('0x33')]);logger[_0x7edf('0x34')](_0x7edf('0x35'),_0x5980cf[_0x7edf('0x32')],util['inspect'](_0x5980cf,{'showHidden':![],'depth':null}));if(_0x5980cf[_0x7edf('0x32')]===_0x5980cf[_0x7edf('0x36')]){if(!_[_0x7edf('0x30')](this[_0x7edf('0x18')][_0x5980cf[_0x7edf('0x32')]])){_['merge'](this[_0x7edf('0x18')][_0x5980cf['uniqueid']],_['pick'](_0x5980cf,_['keys'](this[_0x7edf('0x18')][_0x5980cf[_0x7edf('0x32')]])));}}}}catch(_0x138a90){logger[_0x7edf('0x2b')](_0x7edf('0x37'),_0x5980cf[_0x7edf('0x32')],util[_0x7edf('0x2d')](_0x138a90,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7edf('0x2e')][_0x7edf('0x38')]=function(_0x5421c2){try{if(this['isNotNull'](_0x5421c2)){logger['debug'](_0x7edf('0x39'),_0x5421c2[_0x7edf('0x32')],util[_0x7edf('0x2d')](_0x5421c2,{'showHidden':![],'depth':null}));if(_0x5421c2[_0x7edf('0x32')]===_0x5421c2[_0x7edf('0x36')]&&_0x5421c2[_0x7edf('0x3a')]!='OutgoingSpoolFailed'){if(_[_0x7edf('0x30')](this[_0x7edf('0x18')][_0x5421c2[_0x7edf('0x32')]])){logger[_0x7edf('0x29')](_0x7edf('0x3b'),_0x5421c2[_0x7edf('0x32')],_0x5421c2['context'],_0x5421c2[_0x7edf('0x3c')]);this[_0x7edf('0x18')][_0x5421c2[_0x7edf('0x32')]]=new Channel();this[_0x7edf('0x18')][_0x5421c2[_0x7edf('0x32')]][_0x7edf('0x3d')]=moment()[_0x7edf('0x3e')](_0x7edf('0x3f'));this[_0x7edf('0x18')][_0x5421c2['uniqueid']][_0x7edf('0x40')]=dispositions[_[_0x7edf('0x41')](_0x5421c2['channelstate'])];_[_0x7edf('0x42')](this[_0x7edf('0x18')][_0x5421c2[_0x7edf('0x32')]],_[_0x7edf('0x43')](_0x5421c2,_[_0x7edf('0x44')](this[_0x7edf('0x18')][_0x5421c2[_0x7edf('0x32')]])));if(_0x5421c2[_0x7edf('0x45')]==='from-sip'){if(this[_0x7edf('0x19')][_0x5421c2[_0x7edf('0x3a')][_0x7edf('0x46')]('-')[0x0]]){this[_0x7edf('0x19')][_0x5421c2['channel'][_0x7edf('0x46')]('-')[0x0]][_0x7edf('0x47')]=_0x5421c2['exten'];logger['debug'](_0x7edf('0x48'),_0x5421c2[_0x7edf('0x32')],util['inspect']({'destaccountcode':this[_0x7edf('0x19')][_0x5421c2[_0x7edf('0x3a')][_0x7edf('0x46')]('-')[0x0]][_0x7edf('0x49')],'destconnectedlinenum':_0x5421c2[_0x7edf('0x3c')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x7edf('0x4a'),this[_0x7edf('0x19')][_0x5421c2[_0x7edf('0x3a')][_0x7edf('0x46')]('-')[0x0]][_0x7edf('0x4b')]),_0x7edf('0x4c'),{'destaccountcode':this['agents'][_0x5421c2[_0x7edf('0x3a')][_0x7edf('0x46')]('-')[0x0]][_0x7edf('0x49')],'destconnectedlinenum':_0x5421c2[_0x7edf('0x3c')]});}}}}}}catch(_0x34d1bf){logger[_0x7edf('0x2b')](_0x7edf('0x4d'),_0x5421c2['uniqueid'],util[_0x7edf('0x2d')](_0x34d1bf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7edf('0x2e')][_0x7edf('0x1b')]=function(_0x40ec0f){try{if(this[_0x7edf('0x2f')](_0x40ec0f)){logger[_0x7edf('0x34')]('[%s][voiceCallReport][newexten]\x20event:',_0x40ec0f[_0x7edf('0x32')],util[_0x7edf('0x2d')](_0x40ec0f,{'showHidden':![],'depth':null}));if(_0x40ec0f['uniqueid']===_0x40ec0f[_0x7edf('0x36')]&&_0x40ec0f[_0x7edf('0x3c')]!='h'&&_0x40ec0f[_0x7edf('0x3a')]!=_0x7edf('0x4e')){_0x40ec0f[_0x7edf('0x4f')]=_0x40ec0f[_0x7edf('0x4f')]['toLowerCase']();_0x40ec0f[_0x7edf('0x50')]=(_0x40ec0f[_0x7edf('0x51')]||_0x40ec0f[_0x7edf('0x50')])[_0x7edf('0x52')]();logger[_0x7edf('0x29')](_0x7edf('0x53'),_0x40ec0f['uniqueid'],_0x40ec0f['application'],_0x40ec0f['applicationdata']);if(_[_0x7edf('0x30')](this['channels'][_0x40ec0f[_0x7edf('0x32')]])){this[_0x7edf('0x18')][_0x40ec0f[_0x7edf('0x32')]]=new Channel();this['channels'][_0x40ec0f[_0x7edf('0x32')]][_0x7edf('0x3d')]=_0x40ec0f[_0x7edf('0x54')]?moment()[_0x7edf('0x55')](moment[_0x7edf('0x54')](_0x40ec0f[_0x7edf('0x54')])['seconds'](),_0x7edf('0x56'))[_0x7edf('0x3e')](_0x7edf('0x3f')):moment()['format'](_0x7edf('0x3f'));this[_0x7edf('0x18')][_0x40ec0f['uniqueid']]['disposition']=_0x7edf('0x13');}_['merge'](this[_0x7edf('0x18')][_0x40ec0f[_0x7edf('0x32')]],_[_0x7edf('0x43')](_0x40ec0f,_['keys'](this['channels'][_0x40ec0f[_0x7edf('0x32')]])));if(_[_0x7edf('0x57')](applications,_0x40ec0f['application'])){this[_0x7edf('0x18')][_0x40ec0f[_0x7edf('0x32')]][_0x7edf('0x58')]=_0x40ec0f['application'];this[_0x7edf('0x18')][_0x40ec0f[_0x7edf('0x32')]]['lastdata']=_0x40ec0f['applicationdata'];if(_0x40ec0f[_0x7edf('0x4f')]==='set'&&_['startsWith'](_0x40ec0f[_0x7edf('0x50')],'cdr(')){var _0xe0fe7f=_0x40ec0f['applicationdata'][_0x7edf('0x46')]('=');var _0x3b2e70=_0xe0fe7f[0x0][_0x7edf('0x59')](/cdr\((.*)\)/);if(_0x3b2e70){this['channels'][_0x40ec0f['uniqueid']][_0x3b2e70[0x1]]=_0xe0fe7f[0x1];}}else if(_0x40ec0f[_0x7edf('0x4f')]==='queue'){this['channels'][_0x40ec0f[_0x7edf('0x32')]][_0x7edf('0x5a')]=_0x40ec0f[_0x7edf('0x50')][_0x7edf('0x46')](',')[0x0];}}}}}catch(_0xfd3a03){logger[_0x7edf('0x2b')]('[%s][voiceCallReport][newexten]',_0x40ec0f['uniqueid'],util['inspect'](_0xfd3a03,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x56d5e5){try{if(this[_0x7edf('0x2f')](_0x56d5e5)){logger[_0x7edf('0x29')](_0x7edf('0x5b'),_0x56d5e5['uniqueid'],_0x56d5e5[_0x7edf('0x36')],_0x56d5e5[_0x7edf('0x5c')],_0x56d5e5[_0x7edf('0x33')]);logger[_0x7edf('0x34')]('[%s][voiceCallReport][newstate]\x20event:',_0x56d5e5[_0x7edf('0x32')],util[_0x7edf('0x2d')](_0x56d5e5,{'showHidden':![],'depth':null}));if(_0x56d5e5['uniqueid']!==_0x56d5e5[_0x7edf('0x36')]){if(this['channels'][_0x56d5e5[_0x7edf('0x36')]]){if(_0x56d5e5[_0x7edf('0x5d')]==='6'){if(!this[_0x7edf('0x18')][_0x56d5e5[_0x7edf('0x36')]]['answered']){var _0x1d5d2b=moment();this[_0x7edf('0x18')][_0x56d5e5[_0x7edf('0x36')]][_0x7edf('0x5e')]=!![];this[_0x7edf('0x18')][_0x56d5e5[_0x7edf('0x36')]][_0x7edf('0x5f')]=_0x1d5d2b[_0x7edf('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x7edf('0x18')][_0x56d5e5[_0x7edf('0x36')]]['starttime']){this['channels'][_0x56d5e5['linkedid']]['holdtime']=_0x1d5d2b[_0x7edf('0x60')](this[_0x7edf('0x18')][_0x56d5e5[_0x7edf('0x36')]]['starttime'],_0x7edf('0x56'));}}this[_0x7edf('0x18')][_0x56d5e5['linkedid']][_0x7edf('0x36')]=_0x56d5e5[_0x7edf('0x32')];if(_0x56d5e5['calleridnum']!==_0x7edf('0x61')){this[_0x7edf('0x18')][_0x56d5e5[_0x7edf('0x36')]][_0x7edf('0x62')]=_0x56d5e5[_0x7edf('0x33')];}this[_0x7edf('0x18')][_0x56d5e5['linkedid']][_0x7edf('0x63')]=_0x56d5e5[_0x7edf('0x5c')];this[_0x7edf('0x18')][_0x56d5e5['linkedid']][_0x7edf('0x64')]=_0x56d5e5['channel'];this[_0x7edf('0x18')][_0x56d5e5['linkedid']]['disposition']=dispositions[_['toNumber'](_0x56d5e5['channelstate'])];if(this['agents'][_0x56d5e5[_0x7edf('0x3a')]['split']('-')[0x0]]){this['channels'][_0x56d5e5[_0x7edf('0x36')]][_0x7edf('0x65')]=this[_0x7edf('0x19')][_0x56d5e5['channel'][_0x7edf('0x46')]('-')[0x0]]['id'];this[_0x7edf('0x18')][_0x56d5e5[_0x7edf('0x36')]][_0x7edf('0x66')]=this['agents'][_0x56d5e5[_0x7edf('0x3a')][_0x7edf('0x46')]('-')[0x0]][_0x7edf('0x4b')];}}}}else{if(this[_0x7edf('0x18')][_0x56d5e5[_0x7edf('0x32')]]){if(_0x56d5e5[_0x7edf('0x5d')]==='6'){if(this[_0x7edf('0x19')][_0x56d5e5[_0x7edf('0x3a')]['split']('-')[0x0]]){this[_0x7edf('0x18')][_0x56d5e5['uniqueid']][_0x7edf('0x65')]=this[_0x7edf('0x19')][_0x56d5e5['channel']['split']('-')[0x0]]['id'];this[_0x7edf('0x18')][_0x56d5e5[_0x7edf('0x32')]][_0x7edf('0x66')]=this['agents'][_0x56d5e5[_0x7edf('0x3a')]['split']('-')[0x0]]['name'];}}}}}}catch(_0x5213e5){logger[_0x7edf('0x2b')]('[%s][voiceCallReport][newstate]',_0x56d5e5[_0x7edf('0x32')],util['inspect'](_0x5213e5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7edf('0x2e')][_0x7edf('0x67')]=function(_0x1bb45d,_0x151704){try{if(this[_0x7edf('0x18')][_0x1bb45d]){logger[_0x7edf('0x29')](_0x7edf('0x68'),_0x1bb45d,_0x151704);this[_0x7edf('0x18')][_0x1bb45d][_0x7edf('0x69')]=!![];if(_['endsWith'](_0x151704,_0x7edf('0x6a'))){_0x151704=_0x151704[_0x7edf('0x6b')](_0x7edf('0x6a'),_0x7edf('0x6c'));}this['channels'][_0x1bb45d][_0x7edf('0x6d')]=_0x151704;var _0x2c927b=_[_0x7edf('0x6e')](this['channels'][_0x1bb45d]['monitors'],{'filename':_0x151704});if(_[_0x7edf('0x6f')](_0x2c927b)){this[_0x7edf('0x18')][_0x1bb45d]['monitors']['push']({'filename':_0x151704,'createdAt':moment()[_0x7edf('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x7edf('0x70')});}}}catch(_0x4fdcfb){logger[_0x7edf('0x2b')](_0x7edf('0x71'),_0x1bb45d,util[_0x7edf('0x2d')](_0x4fdcfb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7edf('0x2e')][_0x7edf('0x20')]=function(_0x468a75){try{if(this[_0x7edf('0x2f')](_0x468a75)){logger[_0x7edf('0x34')](_0x7edf('0x72'),_0x468a75[_0x7edf('0x32')],util['inspect'](_0x468a75,{'showHidden':![],'depth':null}));if(this[_0x7edf('0x18')][_0x468a75['uniqueid']]&&_0x468a75[_0x7edf('0x3a')]!=_0x7edf('0x4e')){if(this[_0x7edf('0x2f')](_0x468a75[_0x7edf('0x73')])){if(this[_0x7edf('0x2f')](_0x468a75['variable']['mixmonitor_filename'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x468a75[_0x7edf('0x32')],_0x468a75['value']);this[_0x7edf('0x67')](_0x468a75[_0x7edf('0x32')],_0x468a75[_0x7edf('0x74')]);}else if(this[_0x7edf('0x2f')](_0x468a75['variable'][_0x7edf('0x75')])){logger[_0x7edf('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x468a75[_0x7edf('0x32')],_0x468a75[_0x7edf('0x74')]);this['channels'][_0x468a75[_0x7edf('0x32')]][_0x7edf('0x33')]=_0x468a75[_0x7edf('0x74')];}else if(this[_0x7edf('0x2f')](_0x468a75[_0x7edf('0x73')][_0x7edf('0x76')])){logger[_0x7edf('0x29')](_0x7edf('0x77'),_0x468a75[_0x7edf('0x32')],_0x468a75[_0x7edf('0x74')]);this[_0x7edf('0x18')][_0x468a75[_0x7edf('0x32')]]['callerid']=_0x468a75[_0x7edf('0x74')];}else if(this['isNotNull'](_0x468a75[_0x7edf('0x73')][_0x7edf('0x78')])){logger['info'](_0x7edf('0x79'),_0x468a75[_0x7edf('0x32')],_0x468a75['value']);this['channels'][_0x468a75['uniqueid']][_0x7edf('0x7a')]=_0x468a75[_0x7edf('0x74')];}else if(this['isNotNull'](_0x468a75['variable'][_0x7edf('0x7b')])){logger[_0x7edf('0x29')](_0x7edf('0x7c'),_0x468a75['uniqueid'],_0x468a75['value'][_0x7edf('0x46')](',')[0x0]);this[_0x7edf('0x18')][_0x468a75[_0x7edf('0x32')]]['queue']=_0x468a75[_0x7edf('0x74')]['split'](',')[0x0];}else if(this[_0x7edf('0x2f')](_0x468a75[_0x7edf('0x73')][_0x7edf('0x7d')])){logger[_0x7edf('0x29')](_0x7edf('0x7e'),_0x468a75[_0x7edf('0x32')],_0x468a75['value']);this[_0x7edf('0x18')][_0x468a75[_0x7edf('0x32')]][_0x7edf('0x7f')]=_0x468a75[_0x7edf('0x74')];}else if(this[_0x7edf('0x2f')](_0x468a75[_0x7edf('0x73')][_0x7edf('0x80')])){logger[_0x7edf('0x29')](_0x7edf('0x81'),_0x468a75[_0x7edf('0x32')],_0x468a75['value']);this[_0x7edf('0x18')][_0x468a75[_0x7edf('0x32')]][_0x7edf('0x82')]=_0x468a75[_0x7edf('0x74')];}else if(this[_0x7edf('0x2f')](_0x468a75[_0x7edf('0x73')][_0x7edf('0x83')])){logger[_0x7edf('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x468a75[_0x7edf('0x32')],_0x468a75['value']);this['channels'][_0x468a75['uniqueid']][_0x7edf('0x84')]=_0x468a75['value'];}else if(this[_0x7edf('0x2f')](_0x468a75[_0x7edf('0x73')][_0x7edf('0x85')])){logger[_0x7edf('0x29')](_0x7edf('0x86'),_0x468a75[_0x7edf('0x32')],_0x468a75['value']);this[_0x7edf('0x18')][_0x468a75[_0x7edf('0x32')]][_0x7edf('0x5a')]=_0x468a75[_0x7edf('0x74')];}else if(this['isNotNull'](_0x468a75[_0x7edf('0x73')][_0x7edf('0x87')])){logger[_0x7edf('0x29')](_0x7edf('0x88'),_0x468a75[_0x7edf('0x32')],_0x468a75[_0x7edf('0x74')]);this[_0x7edf('0x18')][_0x468a75[_0x7edf('0x32')]][_0x7edf('0x89')]=_0x468a75[_0x7edf('0x74')];}}}else if(this[_0x7edf('0x2f')](_0x468a75['variable'][_0x7edf('0x8a')])){if(_0x468a75[_0x7edf('0x74')]){var _0x42f1be=path[_0x7edf('0x8b')](_0x468a75[_0x7edf('0x74')])[_0x7edf('0x4b')];logger[_0x7edf('0x29')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x42f1be,_0x468a75[_0x7edf('0x74')]);this[_0x7edf('0x67')](_0x42f1be,_0x468a75[_0x7edf('0x74')]);}}else if(this[_0x7edf('0x18')][_0x468a75[_0x7edf('0x36')]]){if(this[_0x7edf('0x2f')](_0x468a75[_0x7edf('0x73')])){if(this[_0x7edf('0x2f')](_0x468a75[_0x7edf('0x73')][_0x7edf('0x87')])){logger[_0x7edf('0x29')](_0x7edf('0x88'),_0x468a75[_0x7edf('0x36')],_0x468a75[_0x7edf('0x74')]);this[_0x7edf('0x18')][_0x468a75['linkedid']][_0x7edf('0x8c')]=_0x468a75['value'];}}}}}catch(_0x5cfe4e){logger[_0x7edf('0x2b')](_0x7edf('0x8d'),_0x468a75[_0x7edf('0x32')],util['inspect'](_0x5cfe4e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7edf('0x2e')][_0x7edf('0x22')]=function(_0x343843){try{if(this['isNotNull'](_0x343843)){logger[_0x7edf('0x34')](_0x7edf('0x8e'),_0x343843['uniqueid'],util['inspect'](_0x343843,{'showHidden':![],'depth':null}));if(this['channels'][_0x343843[_0x7edf('0x32')]]){logger[_0x7edf('0x29')](_0x7edf('0x8f'),_0x343843[_0x7edf('0x32')],_0x343843[_0x7edf('0x90')]);var _0x2e910f=moment();this[_0x7edf('0x18')][_0x343843[_0x7edf('0x32')]][_0x7edf('0x91')]=_0x2e910f[_0x7edf('0x3e')](_0x7edf('0x3f'));this[_0x7edf('0x18')][_0x343843['uniqueid']][_0x7edf('0x54')]=_0x2e910f[_0x7edf('0x60')](this['channels'][_0x343843['uniqueid']][_0x7edf('0x3d')],_0x7edf('0x56'));if(this[_0x7edf('0x18')][_0x343843[_0x7edf('0x32')]]['answered']){this['channels'][_0x343843[_0x7edf('0x32')]][_0x7edf('0x92')]=_0x2e910f[_0x7edf('0x60')](this[_0x7edf('0x18')][_0x343843[_0x7edf('0x32')]][_0x7edf('0x5f')],_0x7edf('0x56'));this[_0x7edf('0x18')][_0x343843[_0x7edf('0x32')]]['holdtime']=this['channels'][_0x343843[_0x7edf('0x32')]]['duration']-this[_0x7edf('0x18')][_0x343843[_0x7edf('0x32')]]['billableseconds'];}if(_0x343843[_0x7edf('0x45')]===_0x7edf('0x93')){if(this[_0x7edf('0x19')][_0x343843[_0x7edf('0x3a')]['split']('-')[0x0]]){this[_0x7edf('0x19')][_0x343843['channel'][_0x7edf('0x46')]('-')[0x0]]=_['omit'](this['agents'][_0x343843[_0x7edf('0x3a')][_0x7edf('0x46')]('-')[0x0]],[_0x7edf('0x47')]);logger[_0x7edf('0x34')](_0x7edf('0x94'),_0x343843['uniqueid'],util[_0x7edf('0x2d')]({'destaccountcode':this[_0x7edf('0x19')][_0x343843[_0x7edf('0x3a')][_0x7edf('0x46')]('-')[0x0]][_0x7edf('0x49')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x7edf('0x3e')]('user:%s',this['agents'][_0x343843[_0x7edf('0x3a')][_0x7edf('0x46')]('-')[0x0]][_0x7edf('0x4b')]),_0x7edf('0x95'),{'destaccountcode':this[_0x7edf('0x19')][_0x343843[_0x7edf('0x3a')][_0x7edf('0x46')]('-')[0x0]][_0x7edf('0x49')]});}}if(_0x343843[_0x7edf('0x96')]===_0x7edf('0x97')){this[_0x7edf('0x98')][_0x343843['uniqueid']]=this[_0x7edf('0x18')][_0x343843[_0x7edf('0x32')]];}else{if(this[_0x7edf('0x18')][_0x343843[_0x7edf('0x32')]]['type']===_0x7edf('0x99')&&this[_0x7edf('0x98')][_0x343843[_0x7edf('0x32')]]){this[_0x7edf('0x18')][_0x343843[_0x7edf('0x32')]][_0x7edf('0x32')]=[this['channels'][_0x343843['uniqueid']][_0x7edf('0x36')],this[_0x7edf('0x18')][_0x343843[_0x7edf('0x32')]][_0x7edf('0x36')]=this[_0x7edf('0x18')][_0x343843['uniqueid']][_0x7edf('0x32')]][0x0];delete this[_0x7edf('0x98')][_0x343843[_0x7edf('0x32')]];}}logger[_0x7edf('0x34')](_0x7edf('0x9a'),_0x343843[_0x7edf('0x32')],util[_0x7edf('0x2d')](this['channels'][_0x343843[_0x7edf('0x32')]],{'showHidden':![],'depth':null}));ami[_0x7edf('0x31')]('custom:voiceCallReport',this[_0x7edf('0x18')][_0x343843['uniqueid']]);delete this[_0x7edf('0x18')][_0x343843[_0x7edf('0x32')]];}}}catch(_0x55c8a9){logger[_0x7edf('0x2b')](_0x7edf('0x9b'),_0x343843[_0x7edf('0x32')],util[_0x7edf('0x2d')](_0x55c8a9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7edf('0x2e')][_0x7edf('0x9c')]=function(_0x2185e0){try{if(this[_0x7edf('0x2f')](_0x2185e0)){logger[_0x7edf('0x29')](_0x7edf('0x9d'),_0x2185e0[_0x7edf('0x32')],_0x2185e0[_0x7edf('0x9e')],_0x2185e0[_0x7edf('0x9f')]);logger[_0x7edf('0x34')](_0x7edf('0xa0'),_0x2185e0[_0x7edf('0x32')],util[_0x7edf('0x2d')](_0x2185e0,{'showHidden':![],'depth':null}));if(this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa1')]]){this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa1')]][_0x7edf('0xa2')]=_0x2185e0[_0x7edf('0x9e')];this[_0x7edf('0x18')][_0x2185e0['transfereeuniqueid']][_0x7edf('0xa3')]=_0x2185e0[_0x7edf('0x9f')];if(this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa4')]]){var _0x12fdcb=this[_0x7edf('0x18')][_0x2185e0['secondtransfereruniqueid']];this['channels'][_0x2185e0[_0x7edf('0xa4')]]=this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa1')]];this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa1')]]=_0x12fdcb;}}else if(this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa5')]]){this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa5')]]['transfercalleridnum']=_0x2185e0[_0x7edf('0x9e')];this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa5')]][_0x7edf('0xa3')]=_0x2185e0['transfertargetcalleridnum'];if(this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa6')]]){var _0x12fdcb=this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa6')]];this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa6')]]=this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa5')]];this[_0x7edf('0x18')][_0x2185e0[_0x7edf('0xa5')]]=_0x12fdcb;}}}}catch(_0x2a147a){logger['error'](_0x7edf('0xa7'),_0x2185e0[_0x7edf('0x32')],util[_0x7edf('0x2d')](_0x2a147a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7edf('0x2e')][_0x7edf('0x26')]=function(_0x516cb6){try{if(this[_0x7edf('0x2f')](_0x516cb6)){logger[_0x7edf('0x29')](_0x7edf('0xa8'),_0x516cb6[_0x7edf('0x32')],_0x516cb6[_0x7edf('0xa9')],_0x516cb6['extension']);logger[_0x7edf('0x34')](_0x7edf('0xaa'),_0x516cb6[_0x7edf('0x32')],util[_0x7edf('0x2d')](_0x516cb6,{'showHidden':![],'depth':null}));if(this[_0x7edf('0x18')][_0x516cb6[_0x7edf('0xa1')]]){this[_0x7edf('0x18')][_0x516cb6['transfereeuniqueid']][_0x7edf('0xa2')]=_0x516cb6[_0x7edf('0xa9')];this[_0x7edf('0x18')][_0x516cb6[_0x7edf('0xa1')]][_0x7edf('0xa3')]=_0x516cb6['extension'];this[_0x7edf('0x22')]({'event':_0x7edf('0x97'),'uniqueid':_0x516cb6[_0x7edf('0xa1')],'context':_0x516cb6[_0x7edf('0x45')],'channel':_0x516cb6['transfererchannel']});}}}catch(_0xb3b1f0){logger['error'](_0x7edf('0xab'),_0x516cb6[_0x7edf('0x32')],util[_0x7edf('0x2d')](_0xb3b1f0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7edf('0x2e')]['syncMusicOnHoldStart']=function(_0x515282){try{if(this['isNotNull'](_0x515282)){logger[_0x7edf('0x34')](_0x7edf('0xac'),_0x515282['uniqueid'],util['inspect'](_0x515282,{'showHidden':![],'depth':null}));if(this[_0x7edf('0x18')][_0x515282[_0x7edf('0x32')]]){if(!_[_0x7edf('0x6f')](this['channels'][_0x515282[_0x7edf('0x32')]]['answertime'])){this['channels'][_0x515282['uniqueid']][_0x7edf('0xad')]=moment()[_0x7edf('0x3e')](_0x7edf('0x3f'));logger['info'](_0x7edf('0xae'),_0x515282[_0x7edf('0x32')],this[_0x7edf('0x18')][_0x515282[_0x7edf('0x32')]][_0x7edf('0xad')]);}}}}catch(_0xfa3ac8){logger['error'](_0x7edf('0xaf'),_0x515282[_0x7edf('0x32')],util[_0x7edf('0x2d')](_0xfa3ac8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7edf('0x2e')][_0x7edf('0x28')]=function(_0x164189){try{if(this[_0x7edf('0x2f')](_0x164189)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x164189[_0x7edf('0x32')],util[_0x7edf('0x2d')](_0x164189,{'showHidden':![],'depth':null}));if(this[_0x7edf('0x18')][_0x164189[_0x7edf('0x32')]]){if(!_[_0x7edf('0x6f')](this[_0x7edf('0x18')][_0x164189[_0x7edf('0x32')]][_0x7edf('0xad')])){this[_0x7edf('0x18')][_0x164189[_0x7edf('0x32')]][_0x7edf('0xb0')]+=moment()[_0x7edf('0xb1')](0x0)['diff'](this['channels'][_0x164189['uniqueid']][_0x7edf('0xad')],_0x7edf('0x56'));logger[_0x7edf('0x29')](_0x7edf('0xb2'),_0x164189[_0x7edf('0x32')],this[_0x7edf('0x18')][_0x164189['uniqueid']][_0x7edf('0xb0')]);delete this['channels'][_0x164189[_0x7edf('0x32')]][_0x7edf('0xad')];}}}}catch(_0x508868){logger[_0x7edf('0x2b')](_0x7edf('0xb3'),_0x164189[_0x7edf('0x32')],util[_0x7edf('0x2d')](_0x508868,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0xcd75=['parse','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','blindTransfers','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','busy','unavailable','onhold','set','queue','agi','playback','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','bind','newexten','syncNewExten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','newcallerid','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','keys','[%s][voiceCallReport][newcallerid]','debug','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','pick','from-sip','channel','split','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','isNotNull','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','disposition','includes','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','holdtime','connectedlinenum','destinationchannel','UserId','membername','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid'];(function(_0x2f7aa6,_0x2072e5){var _0x18d006=function(_0x21f07b){while(--_0x21f07b){_0x2f7aa6['push'](_0x2f7aa6['shift']());}};_0x18d006(++_0x2072e5);}(_0xcd75,0x190));var _0x5cd7=function(_0x8d40da,_0x147388){_0x8d40da=_0x8d40da-0x0;var _0x4e8897=_0xcd75[_0x8d40da];return _0x4e8897;};'use strict';var BPromise=require(_0x5cd7('0x0'));var _=require('lodash');var moment=require(_0x5cd7('0x1'));var util=require(_0x5cd7('0x2'));var path=require(_0x5cd7('0x3'));var Redis=require(_0x5cd7('0x4'));var config=require(_0x5cd7('0x5'));var logger=require(_0x5cd7('0x6'))(_0x5cd7('0x7'));var ami=require(_0x5cd7('0x8'));var Channel=require(_0x5cd7('0x9'));var statusDesc=[_0x5cd7('0xa'),_0x5cd7('0xb'),'inuse',_0x5cd7('0xc'),'invalid',_0x5cd7('0xd'),'ringing','ringinuse',_0x5cd7('0xe')];var applications=[_0x5cd7('0xf'),_0x5cd7('0x10'),_0x5cd7('0x11'),'dial',_0x5cd7('0x12'),'voicemail'];var dispositions=[_0x5cd7('0x13'),'FAILED','FAILED',_0x5cd7('0x13'),_0x5cd7('0x13'),_0x5cd7('0x13'),_0x5cd7('0x14'),_0x5cd7('0x15'),_0x5cd7('0x16'),_0x5cd7('0x16'),_0x5cd7('0x16')];var actions={};config[_0x5cd7('0x17')]=_[_0x5cd7('0x18')](config[_0x5cd7('0x17')],{'host':_0x5cd7('0x19'),'port':0x18eb});var io=require(_0x5cd7('0x1a'))(new Redis(config[_0x5cd7('0x17')]));function VoiceCallReport(_0x225d02){this[_0x5cd7('0x1b')]=_0x225d02['channels'];this[_0x5cd7('0x1c')]=_0x225d02[_0x5cd7('0x1c')];this['blindTransfers']={};ami['on']('coreshowchannel',this['syncNewExten'][_0x5cd7('0x1d')](this));ami['on'](_0x5cd7('0x1e'),this[_0x5cd7('0x1f')][_0x5cd7('0x1d')](this));ami['on'](_0x5cd7('0x20'),this[_0x5cd7('0x21')][_0x5cd7('0x1d')](this));ami['on']('newstate',this[_0x5cd7('0x22')][_0x5cd7('0x1d')](this));ami['on'](_0x5cd7('0x23'),this[_0x5cd7('0x24')][_0x5cd7('0x1d')](this));ami['on']('hangup',this['syncHangup'][_0x5cd7('0x1d')](this));ami['on'](_0x5cd7('0x25'),this['syncNewCallerId'][_0x5cd7('0x1d')](this));ami['on'](_0x5cd7('0x26'),this[_0x5cd7('0x27')][_0x5cd7('0x1d')](this));ami['on']('blindtransfer',this[_0x5cd7('0x28')][_0x5cd7('0x1d')](this));ami['on'](_0x5cd7('0x29'),this[_0x5cd7('0x2a')][_0x5cd7('0x1d')](this));ami['on']('musiconholdstop',this[_0x5cd7('0x2b')][_0x5cd7('0x1d')](this));try{logger[_0x5cd7('0x2c')](_0x5cd7('0x2d'));ami[_0x5cd7('0x2e')]();}catch(_0x5c7b10){logger[_0x5cd7('0x2f')]('[voiceCallReport][coreshowchannels]',util[_0x5cd7('0x30')](_0x5c7b10,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x5cd7('0x31')]['isNotNull']=function(_0x3dfd50){return _0x3dfd50!==null&&!_[_0x5cd7('0x32')](_0x3dfd50);};VoiceCallReport[_0x5cd7('0x31')][_0x5cd7('0x33')]=function(_0x3c4cac,_0x1f2352,_0x367302){io['to'](_0x3c4cac)[_0x5cd7('0x33')](_0x1f2352,_0x367302);};VoiceCallReport[_0x5cd7('0x31')][_0x5cd7('0x34')]=function(_0x229121){try{if(this['isNotNull'](_0x229121)){logger[_0x5cd7('0x2c')](_0x5cd7('0x35'),_0x229121[_0x5cd7('0x36')],_0x229121['calleridname'],_0x229121[_0x5cd7('0x37')]);logger['debug'](_0x5cd7('0x38'),_0x229121[_0x5cd7('0x36')],util[_0x5cd7('0x30')](_0x229121,{'showHidden':![],'depth':null}));if(_0x229121[_0x5cd7('0x36')]===_0x229121[_0x5cd7('0x39')]){if(!_[_0x5cd7('0x32')](this[_0x5cd7('0x1b')][_0x229121[_0x5cd7('0x36')]])){_[_0x5cd7('0x3a')](this[_0x5cd7('0x1b')][_0x229121[_0x5cd7('0x36')]],_['pick'](_0x229121,_[_0x5cd7('0x3b')](this['channels'][_0x229121[_0x5cd7('0x36')]])));}}}}catch(_0x52aa67){logger[_0x5cd7('0x2f')](_0x5cd7('0x3c'),_0x229121['uniqueid'],util['inspect'](_0x52aa67,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5cd7('0x31')]['syncNewChannel']=function(_0x369b12){try{if(this['isNotNull'](_0x369b12)){logger[_0x5cd7('0x3d')]('[%s][voiceCallReport][newchannel]\x20event:',_0x369b12[_0x5cd7('0x36')],util[_0x5cd7('0x30')](_0x369b12,{'showHidden':![],'depth':null}));if(_0x369b12[_0x5cd7('0x36')]===_0x369b12[_0x5cd7('0x39')]&&_0x369b12['channel']!=_0x5cd7('0x3e')){if(_[_0x5cd7('0x32')](this[_0x5cd7('0x1b')][_0x369b12[_0x5cd7('0x36')]])){logger['info'](_0x5cd7('0x3f'),_0x369b12[_0x5cd7('0x36')],_0x369b12[_0x5cd7('0x40')],_0x369b12[_0x5cd7('0x41')]);this[_0x5cd7('0x1b')][_0x369b12['uniqueid']]=new Channel();this[_0x5cd7('0x1b')][_0x369b12[_0x5cd7('0x36')]][_0x5cd7('0x42')]=moment()[_0x5cd7('0x43')](_0x5cd7('0x44'));this['channels'][_0x369b12[_0x5cd7('0x36')]]['disposition']=dispositions[_[_0x5cd7('0x45')](_0x369b12['channelstate'])];_[_0x5cd7('0x3a')](this['channels'][_0x369b12[_0x5cd7('0x36')]],_[_0x5cd7('0x46')](_0x369b12,_[_0x5cd7('0x3b')](this[_0x5cd7('0x1b')][_0x369b12[_0x5cd7('0x36')]])));if(_0x369b12['context']===_0x5cd7('0x47')){if(this[_0x5cd7('0x1c')][_0x369b12[_0x5cd7('0x48')][_0x5cd7('0x49')]('-')[0x0]]){this[_0x5cd7('0x1c')][_0x369b12[_0x5cd7('0x48')][_0x5cd7('0x49')]('-')[0x0]][_0x5cd7('0x4a')]=_0x369b12[_0x5cd7('0x41')];logger[_0x5cd7('0x3d')](_0x5cd7('0x4b'),_0x369b12['uniqueid'],util[_0x5cd7('0x30')]({'destaccountcode':this[_0x5cd7('0x1c')][_0x369b12[_0x5cd7('0x48')][_0x5cd7('0x49')]('-')[0x0]][_0x5cd7('0x4c')],'destconnectedlinenum':_0x369b12['exten']},{'showHidden':![],'depth':null}));this[_0x5cd7('0x33')](util[_0x5cd7('0x43')](_0x5cd7('0x4d'),this[_0x5cd7('0x1c')][_0x369b12[_0x5cd7('0x48')][_0x5cd7('0x49')]('-')[0x0]][_0x5cd7('0x4e')]),_0x5cd7('0x4f'),{'destaccountcode':this['agents'][_0x369b12[_0x5cd7('0x48')]['split']('-')[0x0]][_0x5cd7('0x4c')],'destconnectedlinenum':_0x369b12[_0x5cd7('0x41')]});}}}}}}catch(_0x125028){logger['error'](_0x5cd7('0x50'),_0x369b12[_0x5cd7('0x36')],util[_0x5cd7('0x30')](_0x125028,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x1391ec){try{if(this[_0x5cd7('0x51')](_0x1391ec)){logger[_0x5cd7('0x3d')](_0x5cd7('0x52'),_0x1391ec[_0x5cd7('0x36')],util[_0x5cd7('0x30')](_0x1391ec,{'showHidden':![],'depth':null}));if(_0x1391ec[_0x5cd7('0x36')]===_0x1391ec[_0x5cd7('0x39')]&&_0x1391ec[_0x5cd7('0x41')]!='h'&&_0x1391ec[_0x5cd7('0x48')]!=_0x5cd7('0x3e')){_0x1391ec['application']=_0x1391ec[_0x5cd7('0x53')][_0x5cd7('0x54')]();_0x1391ec[_0x5cd7('0x55')]=(_0x1391ec[_0x5cd7('0x56')]||_0x1391ec[_0x5cd7('0x55')])[_0x5cd7('0x54')]();logger[_0x5cd7('0x2c')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x1391ec['uniqueid'],_0x1391ec[_0x5cd7('0x53')],_0x1391ec[_0x5cd7('0x55')]);if(_['isUndefined'](this['channels'][_0x1391ec[_0x5cd7('0x36')]])){this[_0x5cd7('0x1b')][_0x1391ec[_0x5cd7('0x36')]]=new Channel();this[_0x5cd7('0x1b')][_0x1391ec['uniqueid']][_0x5cd7('0x42')]=_0x1391ec[_0x5cd7('0x57')]?moment()[_0x5cd7('0x58')](moment['duration'](_0x1391ec[_0x5cd7('0x57')])[_0x5cd7('0x59')](),'seconds')[_0x5cd7('0x43')](_0x5cd7('0x44')):moment()[_0x5cd7('0x43')](_0x5cd7('0x44'));this['channels'][_0x1391ec[_0x5cd7('0x36')]][_0x5cd7('0x5a')]=_0x5cd7('0x13');}_[_0x5cd7('0x3a')](this[_0x5cd7('0x1b')][_0x1391ec[_0x5cd7('0x36')]],_[_0x5cd7('0x46')](_0x1391ec,_[_0x5cd7('0x3b')](this[_0x5cd7('0x1b')][_0x1391ec[_0x5cd7('0x36')]])));if(_[_0x5cd7('0x5b')](applications,_0x1391ec[_0x5cd7('0x53')])){this[_0x5cd7('0x1b')][_0x1391ec[_0x5cd7('0x36')]][_0x5cd7('0x5c')]=_0x1391ec['application'];this[_0x5cd7('0x1b')][_0x1391ec[_0x5cd7('0x36')]][_0x5cd7('0x5d')]=_0x1391ec[_0x5cd7('0x55')];if(_0x1391ec[_0x5cd7('0x53')]===_0x5cd7('0xf')&&_[_0x5cd7('0x5e')](_0x1391ec[_0x5cd7('0x55')],_0x5cd7('0x5f'))){var _0x15e56f=_0x1391ec[_0x5cd7('0x55')][_0x5cd7('0x49')]('=');var _0x7b537d=_0x15e56f[0x0][_0x5cd7('0x60')](/cdr\((.*)\)/);if(_0x7b537d){this[_0x5cd7('0x1b')][_0x1391ec[_0x5cd7('0x36')]][_0x7b537d[0x1]]=_0x15e56f[0x1];}}else if(_0x1391ec['application']===_0x5cd7('0x10')){this[_0x5cd7('0x1b')][_0x1391ec[_0x5cd7('0x36')]][_0x5cd7('0x10')]=_0x1391ec[_0x5cd7('0x55')][_0x5cd7('0x49')](',')[0x0];}}}}}catch(_0x12dd58){logger[_0x5cd7('0x2f')](_0x5cd7('0x61'),_0x1391ec[_0x5cd7('0x36')],util['inspect'](_0x12dd58,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5cd7('0x31')][_0x5cd7('0x22')]=function(_0x488e9f){try{if(this[_0x5cd7('0x51')](_0x488e9f)){logger[_0x5cd7('0x2c')](_0x5cd7('0x62'),_0x488e9f['uniqueid'],_0x488e9f['linkedid'],_0x488e9f[_0x5cd7('0x63')],_0x488e9f[_0x5cd7('0x37')]);logger[_0x5cd7('0x3d')](_0x5cd7('0x64'),_0x488e9f[_0x5cd7('0x36')],util[_0x5cd7('0x30')](_0x488e9f,{'showHidden':![],'depth':null}));if(_0x488e9f[_0x5cd7('0x36')]!==_0x488e9f[_0x5cd7('0x39')]){if(this[_0x5cd7('0x1b')][_0x488e9f[_0x5cd7('0x39')]]){if(_0x488e9f[_0x5cd7('0x65')]==='6'){if(!this[_0x5cd7('0x1b')][_0x488e9f[_0x5cd7('0x39')]][_0x5cd7('0x66')]){var _0x3e2d9d=moment();this[_0x5cd7('0x1b')][_0x488e9f['linkedid']]['answered']=!![];this['channels'][_0x488e9f[_0x5cd7('0x39')]]['answertime']=_0x3e2d9d[_0x5cd7('0x43')](_0x5cd7('0x44'));if(this[_0x5cd7('0x1b')][_0x488e9f['linkedid']]['starttime']){this[_0x5cd7('0x1b')][_0x488e9f[_0x5cd7('0x39')]][_0x5cd7('0x67')]=_0x3e2d9d['diff'](this[_0x5cd7('0x1b')][_0x488e9f[_0x5cd7('0x39')]][_0x5cd7('0x42')],'seconds');}}this['channels'][_0x488e9f[_0x5cd7('0x39')]]['linkedid']=_0x488e9f[_0x5cd7('0x36')];if(_0x488e9f['calleridnum']!=='xcally-motion-preview'){this[_0x5cd7('0x1b')][_0x488e9f[_0x5cd7('0x39')]][_0x5cd7('0x68')]=_0x488e9f[_0x5cd7('0x37')];}this[_0x5cd7('0x1b')][_0x488e9f['linkedid']]['connectedlinename']=_0x488e9f[_0x5cd7('0x63')];this['channels'][_0x488e9f[_0x5cd7('0x39')]][_0x5cd7('0x69')]=_0x488e9f[_0x5cd7('0x48')];this[_0x5cd7('0x1b')][_0x488e9f[_0x5cd7('0x39')]][_0x5cd7('0x5a')]=dispositions[_[_0x5cd7('0x45')](_0x488e9f[_0x5cd7('0x65')])];if(this[_0x5cd7('0x1c')][_0x488e9f['channel']['split']('-')[0x0]]){this['channels'][_0x488e9f[_0x5cd7('0x39')]][_0x5cd7('0x6a')]=this['agents'][_0x488e9f[_0x5cd7('0x48')][_0x5cd7('0x49')]('-')[0x0]]['id'];this[_0x5cd7('0x1b')][_0x488e9f[_0x5cd7('0x39')]][_0x5cd7('0x6b')]=this[_0x5cd7('0x1c')][_0x488e9f[_0x5cd7('0x48')][_0x5cd7('0x49')]('-')[0x0]][_0x5cd7('0x4e')];}}}}else{if(this[_0x5cd7('0x1b')][_0x488e9f[_0x5cd7('0x36')]]){if(_0x488e9f[_0x5cd7('0x65')]==='6'){if(this[_0x5cd7('0x1c')][_0x488e9f[_0x5cd7('0x48')][_0x5cd7('0x49')]('-')[0x0]]){this['channels'][_0x488e9f[_0x5cd7('0x36')]][_0x5cd7('0x6a')]=this['agents'][_0x488e9f[_0x5cd7('0x48')]['split']('-')[0x0]]['id'];this[_0x5cd7('0x1b')][_0x488e9f[_0x5cd7('0x36')]][_0x5cd7('0x6b')]=this[_0x5cd7('0x1c')][_0x488e9f[_0x5cd7('0x48')]['split']('-')[0x0]][_0x5cd7('0x4e')];}}}}}}catch(_0x9f50ad){logger[_0x5cd7('0x2f')]('[%s][voiceCallReport][newstate]',_0x488e9f[_0x5cd7('0x36')],util[_0x5cd7('0x30')](_0x9f50ad,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5cd7('0x6c')]=function(_0x17d3fb,_0x554b73){try{if(this[_0x5cd7('0x1b')][_0x17d3fb]){logger['info'](_0x5cd7('0x6d'),_0x17d3fb,_0x554b73);this[_0x5cd7('0x1b')][_0x17d3fb][_0x5cd7('0x6e')]=!![];if(_[_0x5cd7('0x6f')](_0x554b73,_0x5cd7('0x70'))){_0x554b73=_0x554b73[_0x5cd7('0x71')](_0x5cd7('0x70'),'.WAV');}this[_0x5cd7('0x1b')][_0x17d3fb]['monitorFilename']=_0x554b73;var _0x1cd991=_['find'](this[_0x5cd7('0x1b')][_0x17d3fb][_0x5cd7('0x72')],{'filename':_0x554b73});if(_['isNil'](_0x1cd991)){this[_0x5cd7('0x1b')][_0x17d3fb][_0x5cd7('0x72')]['push']({'filename':_0x554b73,'createdAt':moment()['format'](_0x5cd7('0x44')),'mixmonitorid':'','status':_0x5cd7('0x73')});}}}catch(_0x4702a6){logger['error'](_0x5cd7('0x74'),_0x17d3fb,util[_0x5cd7('0x30')](_0x4702a6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5cd7('0x31')][_0x5cd7('0x24')]=function(_0x16bcd9){try{if(this[_0x5cd7('0x51')](_0x16bcd9)){logger[_0x5cd7('0x3d')](_0x5cd7('0x75'),_0x16bcd9[_0x5cd7('0x36')],util['inspect'](_0x16bcd9,{'showHidden':![],'depth':null}));if(this[_0x5cd7('0x1b')][_0x16bcd9[_0x5cd7('0x36')]]&&_0x16bcd9[_0x5cd7('0x48')]!='OutgoingSpoolFailed'){if(this[_0x5cd7('0x51')](_0x16bcd9[_0x5cd7('0x76')])){if(this[_0x5cd7('0x51')](_0x16bcd9[_0x5cd7('0x76')][_0x5cd7('0x77')])){logger[_0x5cd7('0x2c')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x16bcd9[_0x5cd7('0x36')],_0x16bcd9[_0x5cd7('0x78')]);this[_0x5cd7('0x6c')](_0x16bcd9[_0x5cd7('0x36')],_0x16bcd9[_0x5cd7('0x78')]);}else if(this[_0x5cd7('0x51')](_0x16bcd9[_0x5cd7('0x76')][_0x5cd7('0x79')])){logger[_0x5cd7('0x2c')](_0x5cd7('0x7a'),_0x16bcd9[_0x5cd7('0x36')],_0x16bcd9[_0x5cd7('0x78')]);this[_0x5cd7('0x1b')][_0x16bcd9[_0x5cd7('0x36')]][_0x5cd7('0x37')]=_0x16bcd9[_0x5cd7('0x78')];}else if(this[_0x5cd7('0x51')](_0x16bcd9['variable']['xmd-callerid'])){logger[_0x5cd7('0x2c')](_0x5cd7('0x7b'),_0x16bcd9[_0x5cd7('0x36')],_0x16bcd9[_0x5cd7('0x78')]);this[_0x5cd7('0x1b')][_0x16bcd9[_0x5cd7('0x36')]][_0x5cd7('0x7c')]=_0x16bcd9[_0x5cd7('0x78')];}else if(this[_0x5cd7('0x51')](_0x16bcd9[_0x5cd7('0x76')][_0x5cd7('0x7d')])){logger[_0x5cd7('0x2c')](_0x5cd7('0x7e'),_0x16bcd9[_0x5cd7('0x36')],_0x16bcd9[_0x5cd7('0x78')]);this[_0x5cd7('0x1b')][_0x16bcd9['uniqueid']][_0x5cd7('0x7f')]=_0x16bcd9[_0x5cd7('0x78')];}else if(this['isNotNull'](_0x16bcd9[_0x5cd7('0x76')]['xmd-queue'])){logger[_0x5cd7('0x2c')](_0x5cd7('0x80'),_0x16bcd9[_0x5cd7('0x36')],_0x16bcd9[_0x5cd7('0x78')][_0x5cd7('0x49')](',')[0x0]);this[_0x5cd7('0x1b')][_0x16bcd9[_0x5cd7('0x36')]]['queue']=_0x16bcd9[_0x5cd7('0x78')][_0x5cd7('0x49')](',')[0x0];}else if(this[_0x5cd7('0x51')](_0x16bcd9[_0x5cd7('0x76')]['xmd-originatecalleridnum'])){logger[_0x5cd7('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x16bcd9['uniqueid'],_0x16bcd9[_0x5cd7('0x78')]);this['channels'][_0x16bcd9['uniqueid']][_0x5cd7('0x81')]=_0x16bcd9[_0x5cd7('0x78')];}else if(this['isNotNull'](_0x16bcd9['variable'][_0x5cd7('0x82')])){logger['info'](_0x5cd7('0x83'),_0x16bcd9[_0x5cd7('0x36')],_0x16bcd9[_0x5cd7('0x78')]);this[_0x5cd7('0x1b')][_0x16bcd9[_0x5cd7('0x36')]][_0x5cd7('0x84')]=_0x16bcd9[_0x5cd7('0x78')];}else if(this['isNotNull'](_0x16bcd9[_0x5cd7('0x76')][_0x5cd7('0x85')])){logger[_0x5cd7('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x16bcd9[_0x5cd7('0x36')],_0x16bcd9['value']);this[_0x5cd7('0x1b')][_0x16bcd9[_0x5cd7('0x36')]][_0x5cd7('0x86')]=_0x16bcd9[_0x5cd7('0x78')];}else if(this[_0x5cd7('0x51')](_0x16bcd9[_0x5cd7('0x76')][_0x5cd7('0x87')])){logger[_0x5cd7('0x2c')](_0x5cd7('0x88'),_0x16bcd9['uniqueid'],_0x16bcd9['value']);this[_0x5cd7('0x1b')][_0x16bcd9[_0x5cd7('0x36')]][_0x5cd7('0x10')]=_0x16bcd9[_0x5cd7('0x78')];}else if(this[_0x5cd7('0x51')](_0x16bcd9[_0x5cd7('0x76')][_0x5cd7('0x89')])){logger[_0x5cd7('0x2c')](_0x5cd7('0x8a'),_0x16bcd9['uniqueid'],_0x16bcd9[_0x5cd7('0x78')]);this['channels'][_0x16bcd9[_0x5cd7('0x36')]][_0x5cd7('0x8b')]=_0x16bcd9[_0x5cd7('0x78')];}}}else if(this[_0x5cd7('0x51')](_0x16bcd9[_0x5cd7('0x76')][_0x5cd7('0x77')])){if(_0x16bcd9['value']){var _0x14310f=path[_0x5cd7('0x8c')](_0x16bcd9[_0x5cd7('0x78')])['name'];logger[_0x5cd7('0x2c')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x14310f,_0x16bcd9[_0x5cd7('0x78')]);this[_0x5cd7('0x6c')](_0x14310f,_0x16bcd9[_0x5cd7('0x78')]);}}else if(this[_0x5cd7('0x1b')][_0x16bcd9[_0x5cd7('0x39')]]){if(this[_0x5cd7('0x51')](_0x16bcd9[_0x5cd7('0x76')])){if(this[_0x5cd7('0x51')](_0x16bcd9[_0x5cd7('0x76')]['sipcallid'])){logger[_0x5cd7('0x2c')](_0x5cd7('0x8a'),_0x16bcd9[_0x5cd7('0x39')],_0x16bcd9[_0x5cd7('0x78')]);this['channels'][_0x16bcd9[_0x5cd7('0x39')]][_0x5cd7('0x8d')]=_0x16bcd9[_0x5cd7('0x78')];}}}}}catch(_0xf870e2){logger['error'](_0x5cd7('0x8e'),_0x16bcd9['uniqueid'],util[_0x5cd7('0x30')](_0xf870e2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5cd7('0x8f')]=function(_0x4178df){try{if(this['isNotNull'](_0x4178df)){logger['debug'](_0x5cd7('0x90'),_0x4178df[_0x5cd7('0x36')],util['inspect'](_0x4178df,{'showHidden':![],'depth':null}));if(this['channels'][_0x4178df[_0x5cd7('0x36')]]){logger[_0x5cd7('0x2c')](_0x5cd7('0x91'),_0x4178df['uniqueid'],_0x4178df[_0x5cd7('0x92')]);var _0x47791a=moment();this[_0x5cd7('0x1b')][_0x4178df['uniqueid']][_0x5cd7('0x93')]=_0x47791a[_0x5cd7('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5cd7('0x1b')][_0x4178df[_0x5cd7('0x36')]]['duration']=_0x47791a['diff'](this[_0x5cd7('0x1b')][_0x4178df[_0x5cd7('0x36')]][_0x5cd7('0x42')],_0x5cd7('0x59'));if(this[_0x5cd7('0x1b')][_0x4178df[_0x5cd7('0x36')]][_0x5cd7('0x66')]){this[_0x5cd7('0x1b')][_0x4178df[_0x5cd7('0x36')]][_0x5cd7('0x94')]=_0x47791a['diff'](this[_0x5cd7('0x1b')][_0x4178df[_0x5cd7('0x36')]]['answertime'],_0x5cd7('0x59'));this['channels'][_0x4178df['uniqueid']][_0x5cd7('0x67')]=this[_0x5cd7('0x1b')][_0x4178df[_0x5cd7('0x36')]][_0x5cd7('0x57')]-this[_0x5cd7('0x1b')][_0x4178df[_0x5cd7('0x36')]][_0x5cd7('0x94')];}if(_0x4178df[_0x5cd7('0x40')]===_0x5cd7('0x47')){if(this[_0x5cd7('0x1c')][_0x4178df[_0x5cd7('0x48')][_0x5cd7('0x49')]('-')[0x0]]){this[_0x5cd7('0x1c')][_0x4178df[_0x5cd7('0x48')][_0x5cd7('0x49')]('-')[0x0]]=_[_0x5cd7('0x95')](this[_0x5cd7('0x1c')][_0x4178df[_0x5cd7('0x48')][_0x5cd7('0x49')]('-')[0x0]],[_0x5cd7('0x4a')]);logger[_0x5cd7('0x3d')](_0x5cd7('0x96'),_0x4178df[_0x5cd7('0x36')],util['inspect']({'destaccountcode':this[_0x5cd7('0x1c')][_0x4178df[_0x5cd7('0x48')]['split']('-')[0x0]][_0x5cd7('0x4c')]},{'showHidden':![],'depth':null}));this[_0x5cd7('0x33')](util[_0x5cd7('0x43')](_0x5cd7('0x4d'),this[_0x5cd7('0x1c')][_0x4178df[_0x5cd7('0x48')][_0x5cd7('0x49')]('-')[0x0]][_0x5cd7('0x4e')]),_0x5cd7('0x97'),{'destaccountcode':this['agents'][_0x4178df['channel'][_0x5cd7('0x49')]('-')[0x0]][_0x5cd7('0x4c')]});}}if(_0x4178df[_0x5cd7('0x98')]===_0x5cd7('0x99')){this[_0x5cd7('0x9a')][_0x4178df['uniqueid']]=this['channels'][_0x4178df['uniqueid']];}else{if(this[_0x5cd7('0x1b')][_0x4178df[_0x5cd7('0x36')]][_0x5cd7('0x7f')]==='outbound'&&this[_0x5cd7('0x9a')][_0x4178df[_0x5cd7('0x36')]]){this[_0x5cd7('0x1b')][_0x4178df['uniqueid']][_0x5cd7('0x36')]=[this[_0x5cd7('0x1b')][_0x4178df[_0x5cd7('0x36')]][_0x5cd7('0x39')],this['channels'][_0x4178df[_0x5cd7('0x36')]][_0x5cd7('0x39')]=this[_0x5cd7('0x1b')][_0x4178df['uniqueid']][_0x5cd7('0x36')]][0x0];delete this[_0x5cd7('0x9a')][_0x4178df['uniqueid']];}}logger[_0x5cd7('0x3d')](_0x5cd7('0x9b'),_0x4178df[_0x5cd7('0x36')],util[_0x5cd7('0x30')](this[_0x5cd7('0x1b')][_0x4178df[_0x5cd7('0x36')]],{'showHidden':![],'depth':null}));ami[_0x5cd7('0x33')](_0x5cd7('0x9c'),this[_0x5cd7('0x1b')][_0x4178df['uniqueid']]);delete this[_0x5cd7('0x1b')][_0x4178df[_0x5cd7('0x36')]];}}}catch(_0x14b24f){logger[_0x5cd7('0x2f')](_0x5cd7('0x9d'),_0x4178df['uniqueid'],util['inspect'](_0x14b24f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5cd7('0x27')]=function(_0x35df0c){try{if(this['isNotNull'](_0x35df0c)){logger[_0x5cd7('0x2c')](_0x5cd7('0x9e'),_0x35df0c[_0x5cd7('0x36')],_0x35df0c[_0x5cd7('0x9f')],_0x35df0c[_0x5cd7('0xa0')]);logger[_0x5cd7('0x3d')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x35df0c[_0x5cd7('0x36')],util[_0x5cd7('0x30')](_0x35df0c,{'showHidden':![],'depth':null}));if(this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa1')]]){this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa1')]][_0x5cd7('0xa2')]=_0x35df0c['origtransferercalleridnum'];this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa1')]]['transferconnectedlinenum']=_0x35df0c['transfertargetcalleridnum'];if(this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa3')]]){var _0x7438fb=this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa3')]];this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa3')]]=this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa1')]];this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa1')]]=_0x7438fb;}}else if(this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa4')]]){this[_0x5cd7('0x1b')][_0x35df0c['transfertargetuniqueid']][_0x5cd7('0xa2')]=_0x35df0c[_0x5cd7('0x9f')];this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa4')]][_0x5cd7('0xa5')]=_0x35df0c[_0x5cd7('0xa0')];if(this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa6')]]){var _0x7438fb=this[_0x5cd7('0x1b')][_0x35df0c['origtransfereruniqueid']];this[_0x5cd7('0x1b')][_0x35df0c['origtransfereruniqueid']]=this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa4')]];this[_0x5cd7('0x1b')][_0x35df0c[_0x5cd7('0xa4')]]=_0x7438fb;}}}}catch(_0x58529a){logger[_0x5cd7('0x2f')]('[%s][voiceCallReport][attendedtransfer]',_0x35df0c[_0x5cd7('0x36')],util[_0x5cd7('0x30')](_0x58529a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5cd7('0x31')]['syncBlindTransfer']=function(_0x46220f){try{if(this[_0x5cd7('0x51')](_0x46220f)){logger[_0x5cd7('0x2c')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x46220f[_0x5cd7('0x36')],_0x46220f[_0x5cd7('0xa7')],_0x46220f[_0x5cd7('0xa8')]);logger[_0x5cd7('0x3d')](_0x5cd7('0xa9'),_0x46220f['uniqueid'],util[_0x5cd7('0x30')](_0x46220f,{'showHidden':![],'depth':null}));if(this[_0x5cd7('0x1b')][_0x46220f[_0x5cd7('0xa1')]]){this['channels'][_0x46220f['transfereeuniqueid']][_0x5cd7('0xa2')]=_0x46220f[_0x5cd7('0xa7')];this[_0x5cd7('0x1b')][_0x46220f[_0x5cd7('0xa1')]]['transferconnectedlinenum']=_0x46220f[_0x5cd7('0xa8')];this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x46220f[_0x5cd7('0xa1')],'context':_0x46220f['context'],'channel':_0x46220f['transfererchannel']});}}}catch(_0x3b2917){logger['error'](_0x5cd7('0xaa'),_0x46220f[_0x5cd7('0x36')],util[_0x5cd7('0x30')](_0x3b2917,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5cd7('0x2a')]=function(_0x1d88fa){try{if(this[_0x5cd7('0x51')](_0x1d88fa)){logger['debug'](_0x5cd7('0xab'),_0x1d88fa[_0x5cd7('0x36')],util[_0x5cd7('0x30')](_0x1d88fa,{'showHidden':![],'depth':null}));if(this[_0x5cd7('0x1b')][_0x1d88fa[_0x5cd7('0x36')]]){if(!_[_0x5cd7('0xac')](this[_0x5cd7('0x1b')][_0x1d88fa[_0x5cd7('0x36')]]['answertime'])){this[_0x5cd7('0x1b')][_0x1d88fa[_0x5cd7('0x36')]][_0x5cd7('0xad')]=moment()[_0x5cd7('0x43')](_0x5cd7('0x44'));logger['info'](_0x5cd7('0xae'),_0x1d88fa[_0x5cd7('0x36')],this['channels'][_0x1d88fa[_0x5cd7('0x36')]][_0x5cd7('0xad')]);}}}}catch(_0x220b09){logger[_0x5cd7('0x2f')]('[%s][voiceCallReport][musiconholdstart]',_0x1d88fa['uniqueid'],util['inspect'](_0x220b09,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5cd7('0x2b')]=function(_0x2d9962){try{if(this[_0x5cd7('0x51')](_0x2d9962)){logger[_0x5cd7('0x3d')](_0x5cd7('0xaf'),_0x2d9962[_0x5cd7('0x36')],util[_0x5cd7('0x30')](_0x2d9962,{'showHidden':![],'depth':null}));if(this[_0x5cd7('0x1b')][_0x2d9962['uniqueid']]){if(!_[_0x5cd7('0xac')](this[_0x5cd7('0x1b')][_0x2d9962['uniqueid']]['mohstarttime'])){this[_0x5cd7('0x1b')][_0x2d9962['uniqueid']][_0x5cd7('0xb0')]+=moment()[_0x5cd7('0xb1')](0x0)['diff'](this['channels'][_0x2d9962[_0x5cd7('0x36')]][_0x5cd7('0xad')],_0x5cd7('0x59'));logger[_0x5cd7('0x2c')](_0x5cd7('0xb2'),_0x2d9962['uniqueid'],this[_0x5cd7('0x1b')][_0x2d9962[_0x5cd7('0x36')]][_0x5cd7('0xb0')]);delete this['channels'][_0x2d9962['uniqueid']]['mohstarttime'];}}}}catch(_0x46e38c){logger[_0x5cd7('0x2f')]('[%s][voiceCallReport][musiconholdstop]',_0x2d9962[_0x5cd7('0x36')],util[_0x5cd7('0x30')](_0x46e38c,{'showHidden':![],'depth':null}));}};module[_0x5cd7('0xb3')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index a7ffa2c..43f8447 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 _0x4b33=['value','outboundrouteid','isUndefined','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','seconds','diff','starttime','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%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','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','outbound','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','emit','isNotNull','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','omit','privilege','info','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinename','answertime','lastevent','connect','substring','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable'];(function(_0x568cfe,_0x39022c){var _0x598d17=function(_0x225ff7){while(--_0x225ff7){_0x568cfe['push'](_0x568cfe['shift']());}};_0x598d17(++_0x39022c);}(_0x4b33,0x1c6));var _0x34b3=function(_0x259a49,_0x192f2a){_0x259a49=_0x259a49-0x0;var _0x4e7cf9=_0x4b33[_0x259a49];return _0x4e7cf9;};'use strict';var _=require('lodash');var moment=require(_0x34b3('0x0'));var util=require(_0x34b3('0x1'));var Redis=require(_0x34b3('0x2'));var config=require(_0x34b3('0x3'));var logger=require(_0x34b3('0x4'))('ami');var ami=require(_0x34b3('0x5'));config[_0x34b3('0x6')]=_[_0x34b3('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x34b3('0x6')]));function VoiceDialReport(_0x460661){this['channels']=_0x460661['outboundChannels'];this[_0x34b3('0x8')]=_0x460661[_0x34b3('0x8')];this[_0x34b3('0x9')]={};ami['on'](_0x34b3('0xa'),this[_0x34b3('0xb')][_0x34b3('0xc')](this));ami['on']('dialend',this[_0x34b3('0xd')][_0x34b3('0xc')](this));ami['on'](_0x34b3('0xe'),this[_0x34b3('0xf')][_0x34b3('0xc')](this));ami['on'](_0x34b3('0x10'),this[_0x34b3('0x11')][_0x34b3('0xc')](this));}VoiceDialReport[_0x34b3('0x12')]['isNotNull']=function(_0x2dede8){return _0x2dede8!==null&&!_['isUndefined'](_0x2dede8);};VoiceDialReport[_0x34b3('0x12')][_0x34b3('0x13')]=function(_0x2a549e,_0x353d39,_0x4f6c29){io['to'](_0x2a549e)[_0x34b3('0x13')](_0x353d39,_0x4f6c29);};VoiceDialReport[_0x34b3('0x12')][_0x34b3('0xb')]=function(_0x4dd01c){try{if(this[_0x34b3('0x14')](_0x4dd01c)){logger['debug'](_0x34b3('0x15'),_0x4dd01c[_0x34b3('0x16')],util['inspect'](_0x4dd01c,{'showHidden':![],'depth':null}));if(this['channels'][_0x4dd01c['uniqueid']]){_[_0x34b3('0x17')](this[_0x34b3('0x18')][_0x4dd01c[_0x34b3('0x16')]],{'starttime':moment()[_0x34b3('0x19')](_0x34b3('0x1a')),'lastevent':_0x34b3('0x1b'),'interface':_0x4dd01c[_0x34b3('0x1c')]['substring'](0x0,_0x4dd01c[_0x34b3('0x1c')][_0x34b3('0x1d')]('-')),'membername':_0x4dd01c[_0x34b3('0x1c')]['substring'](_0x4dd01c['channel'][_0x34b3('0x1d')]('/')+0x1,_0x4dd01c[_0x34b3('0x1c')]['lastIndexOf']('-'))},_[_0x34b3('0x1e')](_0x4dd01c,['event',_0x34b3('0x1f')]));logger[_0x34b3('0x20')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x4dd01c[_0x34b3('0x16')],this[_0x34b3('0x18')][_0x4dd01c[_0x34b3('0x16')]]['membername'],this[_0x34b3('0x18')][_0x4dd01c[_0x34b3('0x16')]]['interface']);logger[_0x34b3('0x21')](_0x34b3('0x22'),_0x4dd01c[_0x34b3('0x16')],util[_0x34b3('0x23')](this[_0x34b3('0x18')][_0x4dd01c['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x34b3('0x24'),_0x34b3('0x25'),this[_0x34b3('0x18')][_0x4dd01c[_0x34b3('0x16')]]);logger['debug'](_0x34b3('0x26'),_0x4dd01c[_0x34b3('0x16')],util['inspect'](this['channels'][_0x4dd01c[_0x34b3('0x16')]],{'showHidden':![],'depth':null}));ami[_0x34b3('0x13')]('custom:dialbegin',this[_0x34b3('0x18')][_0x4dd01c[_0x34b3('0x16')]]);}}}catch(_0x2ee736){logger['error'](_0x34b3('0x27'),_0x4dd01c[_0x34b3('0x16')],util[_0x34b3('0x23')](_0x2ee736,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x34b3('0x12')][_0x34b3('0xd')]=function(_0x20ea7f){try{if(this[_0x34b3('0x14')](_0x20ea7f)){logger['debug'](_0x34b3('0x28'),_0x20ea7f['uniqueid'],util[_0x34b3('0x23')](_0x20ea7f,{'showHidden':![],'depth':null}));if(this[_0x34b3('0x18')][_0x20ea7f[_0x34b3('0x16')]]){this['channels'][_0x20ea7f['uniqueid']][_0x34b3('0x29')]=_0x20ea7f[_0x34b3('0x29')];if(_0x20ea7f[_0x34b3('0x29')]===_0x34b3('0x2a')){this['channels'][_0x20ea7f[_0x34b3('0x16')]]['connectedlinenum']=_0x20ea7f['connectedlinenum'];this[_0x34b3('0x18')][_0x20ea7f[_0x34b3('0x16')]][_0x34b3('0x2b')]=_0x20ea7f[_0x34b3('0x2b')];this[_0x34b3('0x18')][_0x20ea7f['uniqueid']][_0x34b3('0x2c')]=moment()[_0x34b3('0x19')](_0x34b3('0x1a'));this[_0x34b3('0x18')][_0x20ea7f[_0x34b3('0x16')]][_0x34b3('0x2d')]=_0x34b3('0x2e');logger[_0x34b3('0x20')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x20ea7f[_0x34b3('0x16')],_0x20ea7f[_0x34b3('0x1c')][_0x34b3('0x2f')](_0x20ea7f[_0x34b3('0x1c')]['lastIndexOf']('/')+0x1,_0x20ea7f[_0x34b3('0x1c')]['lastIndexOf']('-')));logger[_0x34b3('0x21')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x20ea7f[_0x34b3('0x16')],util['inspect'](this['channels'][_0x20ea7f[_0x34b3('0x16')]],{'showHidden':![],'depth':null}));ami[_0x34b3('0x13')](_0x34b3('0x30'),this['channels'][_0x20ea7f[_0x34b3('0x16')]]);}logger[_0x34b3('0x21')](_0x34b3('0x31'),_0x20ea7f[_0x34b3('0x16')],util[_0x34b3('0x23')](this[_0x34b3('0x18')][_0x20ea7f[_0x34b3('0x16')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:save',this[_0x34b3('0x18')][_0x20ea7f[_0x34b3('0x16')]]);}}}catch(_0x4d2367){logger[_0x34b3('0x32')](_0x34b3('0x33'),_0x20ea7f['uniqueid'],util[_0x34b3('0x23')](_0x4d2367,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x34b3('0x12')][_0x34b3('0xf')]=function(_0x10ee1c){try{if(this[_0x34b3('0x14')](_0x10ee1c)){logger['debug'](_0x34b3('0x34'),_0x10ee1c['uniqueid'],util[_0x34b3('0x23')](_0x10ee1c,{'showHidden':![],'depth':null}));this[_0x34b3('0x35')](_0x10ee1c[_0x34b3('0x16')],_[_0x34b3('0x36')](_0x10ee1c[_0x34b3('0x37')])[0x0],_0x10ee1c[_0x34b3('0x38')]);if(this[_0x34b3('0x14')](_0x10ee1c[_0x34b3('0x37')])&&this[_0x34b3('0x14')](_0x10ee1c[_0x34b3('0x37')][_0x34b3('0x39')])){if(_[_0x34b3('0x3a')](this['channels'][_0x10ee1c['uniqueid']])){this[_0x34b3('0x18')][_0x10ee1c[_0x34b3('0x16')]]={'routeId':_0x10ee1c['value'],'variables':this[_0x34b3('0x9')][_0x10ee1c['uniqueid']]};logger[_0x34b3('0x20')](_0x34b3('0x3b'),_0x10ee1c[_0x34b3('0x16')],_0x10ee1c[_0x34b3('0x37')][_0x34b3('0x39')],_['keys'](_0x10ee1c[_0x34b3('0x37')])[0x0],_0x10ee1c[_0x34b3('0x38')]);logger[_0x34b3('0x21')](_0x34b3('0x3c'),_0x10ee1c['uniqueid'],util['inspect'](this[_0x34b3('0x18')][_0x10ee1c['uniqueid']],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x34b3('0x25'),this['channels'][_0x10ee1c[_0x34b3('0x16')]]);}}}}catch(_0x1be419){logger[_0x34b3('0x32')](_0x34b3('0x3d'),_0x10ee1c[_0x34b3('0x16')],util[_0x34b3('0x23')](_0x1be419,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x34b3('0x12')]['addVariable']=function(_0x475bf4,_0x3c6b77,_0x335e40){var _0x1158e4=[_0x34b3('0x3e'),'rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x34b3('0x3f'),_0x34b3('0x40'),_0x34b3('0x41'),_0x34b3('0x42'),_0x34b3('0x43'),_0x34b3('0x44'),_0x34b3('0x45'),_0x34b3('0x46'),_0x34b3('0x47'),_0x34b3('0x48'),_0x34b3('0x49'),_0x34b3('0x4a'),_0x34b3('0x4b'),_0x34b3('0x4c'),_0x34b3('0x4d')];if(!_['isNil'](_0x3c6b77)&&!_['includes'](_0x1158e4,_0x3c6b77)){if(_[_0x34b3('0x3a')](this[_0x34b3('0x9')][_0x475bf4])){this[_0x34b3('0x9')][_0x475bf4]={};}this[_0x34b3('0x9')][_0x475bf4][_0x3c6b77]=_0x335e40;}};VoiceDialReport[_0x34b3('0x12')]['syncHangup']=function(_0x304d3c){try{if(this[_0x34b3('0x14')](_0x304d3c)){logger[_0x34b3('0x21')](_0x34b3('0x4e'),_0x304d3c[_0x34b3('0x16')],util[_0x34b3('0x23')](_0x304d3c,{'showHidden':![],'depth':null}));if(this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x16')]]){logger['info'](_0x34b3('0x4f'),_0x304d3c['uniqueid'],_0x304d3c[_0x34b3('0x50')]);this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x16')]][_0x34b3('0x51')]=moment()[_0x34b3('0x19')](_0x34b3('0x1a'));this['channels'][_0x304d3c['uniqueid']][_0x34b3('0x52')]=moment(this['channels'][_0x304d3c['uniqueid']]['endtime'])['diff'](this[_0x34b3('0x18')][_0x304d3c['uniqueid']]['starttime'],_0x34b3('0x53'));this[_0x34b3('0x18')][_0x304d3c['uniqueid']][_0x34b3('0x2d')]='complete';this[_0x34b3('0x8')]['total']+=0x1;if(this['channels'][_0x304d3c[_0x34b3('0x16')]][_0x34b3('0x2c')]){this[_0x34b3('0x8')]['answered']+=0x1;this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x16')]]['holdtime']=moment(this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x16')]][_0x34b3('0x2c')])[_0x34b3('0x54')](this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x16')]][_0x34b3('0x55')],_0x34b3('0x53'));this['channels'][_0x304d3c[_0x34b3('0x16')]][_0x34b3('0x56')]=moment(this['channels'][_0x304d3c[_0x34b3('0x16')]][_0x34b3('0x51')])[_0x34b3('0x54')](this[_0x34b3('0x18')][_0x304d3c['uniqueid']]['answertime'],'seconds');this['outbound'][_0x34b3('0x57')]+=this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x16')]][_0x34b3('0x58')]||0x0;this[_0x34b3('0x8')][_0x34b3('0x59')]+=this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x16')]][_0x34b3('0x56')];}this[_0x34b3('0x8')][_0x34b3('0x5a')]+=this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x16')]]['duration'];logger[_0x34b3('0x21')](_0x34b3('0x5b'),_0x304d3c['uniqueid'],util[_0x34b3('0x23')](this[_0x34b3('0x18')][_0x304d3c['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x34b3('0x13')](_0x34b3('0x5c'),this['channels'][_0x304d3c[_0x34b3('0x16')]]);logger[_0x34b3('0x21')](_0x34b3('0x5d'),_0x304d3c[_0x34b3('0x16')],util[_0x34b3('0x23')](this['channels'][_0x304d3c[_0x34b3('0x16')]],{'showHidden':![],'depth':null}));ami[_0x34b3('0x13')](_0x34b3('0x5e'),this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x16')]]);logger[_0x34b3('0x21')](_0x34b3('0x5f'),_0x304d3c['uniqueid'],util[_0x34b3('0x23')](this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x16')]],{'showHidden':![],'depth':null}));this[_0x34b3('0x13')](_0x34b3('0x24'),'voice_outbound:save',this[_0x34b3('0x8')]);logger[_0x34b3('0x20')](_0x34b3('0x60'),JSON[_0x34b3('0x61')](this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x16')]]));logger[_0x34b3('0x21')](_0x34b3('0x62'),_0x304d3c[_0x34b3('0x16')],util[_0x34b3('0x23')](this['channels'][_0x304d3c[_0x34b3('0x16')]],{'showHidden':![],'depth':null}));this['emit'](_0x34b3('0x24'),_0x34b3('0x63'),this['channels'][_0x304d3c[_0x34b3('0x16')]]);delete this['channels'][_0x304d3c['uniqueid']];}else if(this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x64')]]){this[_0x34b3('0x18')][_0x304d3c['linkedid']][_0x34b3('0x16')]=this[_0x34b3('0x18')][_0x304d3c[_0x34b3('0x64')]][_0x34b3('0x65')];}if(this[_0x34b3('0x9')][_0x304d3c[_0x34b3('0x16')]]){delete this[_0x34b3('0x9')][_0x304d3c[_0x34b3('0x16')]];}}}catch(_0x5ab16d){logger['error']('[%s][voiceDialReport][hangup]',_0x304d3c['uniqueid'],util[_0x34b3('0x23')](_0x5ab16d,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xf5d3=['moment','util','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','isNotNull','isUndefined','prototype','emit','uniqueid','merge','format','substring','lastIndexOf','channel','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialbegin]','debug','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','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:','voice:outbound','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','seconds','lastevent','complete','total','answered','starttime','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','lodash'];(function(_0xa41fd3,_0x55742e){var _0x46f2d3=function(_0x190474){while(--_0x190474){_0xa41fd3['push'](_0xa41fd3['shift']());}};_0x46f2d3(++_0x55742e);}(_0xf5d3,0x6c));var _0x3f5d=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xf5d3[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x3f5d('0x0'));var moment=require(_0x3f5d('0x1'));var util=require(_0x3f5d('0x2'));var Redis=require('ioredis');var config=require(_0x3f5d('0x3'));var logger=require(_0x3f5d('0x4'))('ami');var ami=require(_0x3f5d('0x5'));config[_0x3f5d('0x6')]=_['defaults'](config[_0x3f5d('0x6')],{'host':_0x3f5d('0x7'),'port':0x18eb});var io=require(_0x3f5d('0x8'))(new Redis(config[_0x3f5d('0x6')]));function VoiceDialReport(_0x217b35){this[_0x3f5d('0x9')]=_0x217b35[_0x3f5d('0xa')];this['outbound']=_0x217b35[_0x3f5d('0xb')];this[_0x3f5d('0xc')]={};ami['on'](_0x3f5d('0xd'),this[_0x3f5d('0xe')][_0x3f5d('0xf')](this));ami['on'](_0x3f5d('0x10'),this[_0x3f5d('0x11')][_0x3f5d('0xf')](this));ami['on'](_0x3f5d('0x12'),this[_0x3f5d('0x13')][_0x3f5d('0xf')](this));ami['on'](_0x3f5d('0x14'),this['syncHangup'][_0x3f5d('0xf')](this));}VoiceDialReport['prototype'][_0x3f5d('0x15')]=function(_0x42bf04){return _0x42bf04!==null&&!_[_0x3f5d('0x16')](_0x42bf04);};VoiceDialReport[_0x3f5d('0x17')][_0x3f5d('0x18')]=function(_0x1bc286,_0x519b07,_0x386c48){io['to'](_0x1bc286)[_0x3f5d('0x18')](_0x519b07,_0x386c48);};VoiceDialReport['prototype'][_0x3f5d('0xe')]=function(_0x7255bf){try{if(this[_0x3f5d('0x15')](_0x7255bf)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x7255bf['uniqueid'],util['inspect'](_0x7255bf,{'showHidden':![],'depth':null}));if(this['channels'][_0x7255bf[_0x3f5d('0x19')]]){_[_0x3f5d('0x1a')](this[_0x3f5d('0x9')][_0x7255bf['uniqueid']],{'starttime':moment()[_0x3f5d('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x7255bf['channel'][_0x3f5d('0x1c')](0x0,_0x7255bf['channel'][_0x3f5d('0x1d')]('-')),'membername':_0x7255bf['channel'][_0x3f5d('0x1c')](_0x7255bf[_0x3f5d('0x1e')]['lastIndexOf']('/')+0x1,_0x7255bf[_0x3f5d('0x1e')][_0x3f5d('0x1d')]('-'))},_[_0x3f5d('0x1f')](_0x7255bf,['event',_0x3f5d('0x20')]));logger[_0x3f5d('0x21')](_0x3f5d('0x22'),_0x7255bf[_0x3f5d('0x19')],this['channels'][_0x7255bf[_0x3f5d('0x19')]][_0x3f5d('0x23')],this[_0x3f5d('0x9')][_0x7255bf[_0x3f5d('0x19')]][_0x3f5d('0x24')]);logger['debug'](_0x3f5d('0x25'),_0x7255bf[_0x3f5d('0x19')],util[_0x3f5d('0x26')](this[_0x3f5d('0x9')][_0x7255bf[_0x3f5d('0x19')]],{'showHidden':![],'depth':null}));this[_0x3f5d('0x18')]('voice:outbound',_0x3f5d('0x27'),this[_0x3f5d('0x9')][_0x7255bf['uniqueid']]);logger['debug'](_0x3f5d('0x28'),_0x7255bf['uniqueid'],util[_0x3f5d('0x26')](this['channels'][_0x7255bf[_0x3f5d('0x19')]],{'showHidden':![],'depth':null}));ami[_0x3f5d('0x18')](_0x3f5d('0x29'),this[_0x3f5d('0x9')][_0x7255bf[_0x3f5d('0x19')]]);}}}catch(_0x59a8f4){logger['error'](_0x3f5d('0x2a'),_0x7255bf['uniqueid'],util[_0x3f5d('0x26')](_0x59a8f4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3f5d('0x17')][_0x3f5d('0x11')]=function(_0x39fb2a){try{if(this[_0x3f5d('0x15')](_0x39fb2a)){logger[_0x3f5d('0x2b')]('[%s][voiceDialReport][dialend]\x20event:',_0x39fb2a[_0x3f5d('0x19')],util[_0x3f5d('0x26')](_0x39fb2a,{'showHidden':![],'depth':null}));if(this['channels'][_0x39fb2a[_0x3f5d('0x19')]]){this[_0x3f5d('0x9')][_0x39fb2a[_0x3f5d('0x19')]]['dialstatus']=_0x39fb2a[_0x3f5d('0x2c')];if(_0x39fb2a[_0x3f5d('0x2c')]===_0x3f5d('0x2d')){this[_0x3f5d('0x9')][_0x39fb2a[_0x3f5d('0x19')]][_0x3f5d('0x2e')]=_0x39fb2a['connectedlinenum'];this[_0x3f5d('0x9')][_0x39fb2a['uniqueid']]['connectedlinename']=_0x39fb2a[_0x3f5d('0x2f')];this[_0x3f5d('0x9')][_0x39fb2a[_0x3f5d('0x19')]][_0x3f5d('0x30')]=moment()[_0x3f5d('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3f5d('0x9')][_0x39fb2a['uniqueid']]['lastevent']=_0x3f5d('0x31');logger[_0x3f5d('0x21')](_0x3f5d('0x32'),_0x39fb2a[_0x3f5d('0x19')],_0x39fb2a[_0x3f5d('0x1e')]['substring'](_0x39fb2a[_0x3f5d('0x1e')]['lastIndexOf']('/')+0x1,_0x39fb2a['channel'][_0x3f5d('0x1d')]('-')));logger[_0x3f5d('0x2b')](_0x3f5d('0x33'),_0x39fb2a[_0x3f5d('0x19')],util['inspect'](this[_0x3f5d('0x9')][_0x39fb2a[_0x3f5d('0x19')]],{'showHidden':![],'depth':null}));ami[_0x3f5d('0x18')](_0x3f5d('0x34'),this[_0x3f5d('0x9')][_0x39fb2a[_0x3f5d('0x19')]]);}logger[_0x3f5d('0x2b')](_0x3f5d('0x35'),_0x39fb2a[_0x3f5d('0x19')],util['inspect'](this[_0x3f5d('0x9')][_0x39fb2a['uniqueid']],{'showHidden':![],'depth':null}));this[_0x3f5d('0x18')](_0x3f5d('0x36'),_0x3f5d('0x27'),this['channels'][_0x39fb2a[_0x3f5d('0x19')]]);}}}catch(_0x12bc01){logger['error'](_0x3f5d('0x37'),_0x39fb2a[_0x3f5d('0x19')],util['inspect'](_0x12bc01,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3f5d('0x17')][_0x3f5d('0x13')]=function(_0xb17954){try{if(this[_0x3f5d('0x15')](_0xb17954)){logger[_0x3f5d('0x2b')](_0x3f5d('0x38'),_0xb17954['uniqueid'],util[_0x3f5d('0x26')](_0xb17954,{'showHidden':![],'depth':null}));this[_0x3f5d('0x39')](_0xb17954['uniqueid'],_['keys'](_0xb17954[_0x3f5d('0x3a')])[0x0],_0xb17954[_0x3f5d('0x3b')]);if(this['isNotNull'](_0xb17954[_0x3f5d('0x3a')])&&this[_0x3f5d('0x15')](_0xb17954[_0x3f5d('0x3a')]['outboundrouteid'])){if(_[_0x3f5d('0x16')](this[_0x3f5d('0x9')][_0xb17954[_0x3f5d('0x19')]])){this[_0x3f5d('0x9')][_0xb17954['uniqueid']]={'routeId':_0xb17954['value'],'variables':this[_0x3f5d('0xc')][_0xb17954[_0x3f5d('0x19')]]};logger[_0x3f5d('0x21')](_0x3f5d('0x3c'),_0xb17954[_0x3f5d('0x19')],_0xb17954['variable'][_0x3f5d('0x3d')],_[_0x3f5d('0x3e')](_0xb17954[_0x3f5d('0x3a')])[0x0],_0xb17954[_0x3f5d('0x3b')]);logger[_0x3f5d('0x2b')](_0x3f5d('0x3f'),_0xb17954[_0x3f5d('0x19')],util[_0x3f5d('0x26')](this[_0x3f5d('0x9')][_0xb17954[_0x3f5d('0x19')]],{'showHidden':![],'depth':null}));this[_0x3f5d('0x18')](_0x3f5d('0x36'),_0x3f5d('0x27'),this[_0x3f5d('0x9')][_0xb17954[_0x3f5d('0x19')]]);}}}}catch(_0x2e577c){logger[_0x3f5d('0x40')](_0x3f5d('0x41'),_0xb17954[_0x3f5d('0x19')],util[_0x3f5d('0x26')](_0x2e577c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3f5d('0x17')][_0x3f5d('0x39')]=function(_0x250199,_0xe44aa8,_0x40c856){var _0x3db823=[_0x3f5d('0x42'),_0x3f5d('0x43'),'rtpaudioqosjitter',_0x3f5d('0x44'),_0x3f5d('0x45'),_0x3f5d('0x46'),_0x3f5d('0x47'),'rtpaudioqosrttbridged',_0x3f5d('0x48'),_0x3f5d('0x49'),_0x3f5d('0x4a'),_0x3f5d('0x4b'),_0x3f5d('0x4c'),_0x3f5d('0x4d'),_0x3f5d('0x4e'),_0x3f5d('0x4f'),_0x3f5d('0x23'),_0x3f5d('0x50'),_0x3f5d('0x51')];if(!_['isNil'](_0xe44aa8)&&!_['includes'](_0x3db823,_0xe44aa8)){if(_[_0x3f5d('0x16')](this[_0x3f5d('0xc')][_0x250199])){this[_0x3f5d('0xc')][_0x250199]={};}this['variables'][_0x250199][_0xe44aa8]=_0x40c856;}};VoiceDialReport[_0x3f5d('0x17')]['syncHangup']=function(_0x4df5c5){try{if(this[_0x3f5d('0x15')](_0x4df5c5)){logger['debug'](_0x3f5d('0x52'),_0x4df5c5[_0x3f5d('0x19')],util[_0x3f5d('0x26')](_0x4df5c5,{'showHidden':![],'depth':null}));if(this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]]){logger[_0x3f5d('0x21')](_0x3f5d('0x53'),_0x4df5c5[_0x3f5d('0x19')],_0x4df5c5[_0x3f5d('0x54')]);this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]][_0x3f5d('0x55')]=moment()[_0x3f5d('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]][_0x3f5d('0x56')]=moment(this['channels'][_0x4df5c5[_0x3f5d('0x19')]][_0x3f5d('0x55')])[_0x3f5d('0x57')](this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]]['starttime'],_0x3f5d('0x58'));this[_0x3f5d('0x9')][_0x4df5c5['uniqueid']][_0x3f5d('0x59')]=_0x3f5d('0x5a');this['outbound'][_0x3f5d('0x5b')]+=0x1;if(this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]][_0x3f5d('0x30')]){this[_0x3f5d('0xb')][_0x3f5d('0x5c')]+=0x1;this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]]['holdtime']=moment(this['channels'][_0x4df5c5[_0x3f5d('0x19')]][_0x3f5d('0x30')])[_0x3f5d('0x57')](this['channels'][_0x4df5c5[_0x3f5d('0x19')]][_0x3f5d('0x5d')],_0x3f5d('0x58'));this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]][_0x3f5d('0x5e')]=moment(this['channels'][_0x4df5c5[_0x3f5d('0x19')]][_0x3f5d('0x55')])[_0x3f5d('0x57')](this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]][_0x3f5d('0x30')],_0x3f5d('0x58'));this[_0x3f5d('0xb')][_0x3f5d('0x5f')]+=this[_0x3f5d('0x9')][_0x4df5c5['uniqueid']][_0x3f5d('0x60')]||0x0;this[_0x3f5d('0xb')][_0x3f5d('0x61')]+=this['channels'][_0x4df5c5[_0x3f5d('0x19')]][_0x3f5d('0x5e')];}this[_0x3f5d('0xb')][_0x3f5d('0x62')]+=this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]][_0x3f5d('0x56')];logger['debug'](_0x3f5d('0x63'),_0x4df5c5[_0x3f5d('0x19')],util[_0x3f5d('0x26')](this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]],{'showHidden':![],'depth':null}));ami[_0x3f5d('0x18')](_0x3f5d('0x64'),this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]]);logger[_0x3f5d('0x2b')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x4df5c5[_0x3f5d('0x19')],util['inspect'](this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]],{'showHidden':![],'depth':null}));ami['emit'](_0x3f5d('0x65'),this['channels'][_0x4df5c5[_0x3f5d('0x19')]]);logger[_0x3f5d('0x2b')](_0x3f5d('0x66'),_0x4df5c5[_0x3f5d('0x19')],util[_0x3f5d('0x26')](this[_0x3f5d('0x9')][_0x4df5c5['uniqueid']],{'showHidden':![],'depth':null}));this[_0x3f5d('0x18')](_0x3f5d('0x36'),_0x3f5d('0x67'),this['outbound']);logger[_0x3f5d('0x21')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]]));logger[_0x3f5d('0x2b')](_0x3f5d('0x68'),_0x4df5c5[_0x3f5d('0x19')],util[_0x3f5d('0x26')](this['channels'][_0x4df5c5[_0x3f5d('0x19')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x3f5d('0x69'),this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]]);delete this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x19')]];}else if(this['channels'][_0x4df5c5[_0x3f5d('0x6a')]]){this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x6a')]][_0x3f5d('0x19')]=this[_0x3f5d('0x9')][_0x4df5c5[_0x3f5d('0x6a')]][_0x3f5d('0x6b')];}if(this[_0x3f5d('0xc')][_0x4df5c5['uniqueid']]){delete this[_0x3f5d('0xc')][_0x4df5c5[_0x3f5d('0x19')]];}}}catch(_0x4e373a){logger[_0x3f5d('0x40')](_0x3f5d('0x6c'),_0x4df5c5[_0x3f5d('0x19')],util[_0x3f5d('0x26')](_0x4e373a,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 93e77f6..62d4ad9 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 _0xec89=['[voiceQueueReport][queuesummary]\x20name:%s','callers','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','isNotNull','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][queuecallerleave]','syncAgentConnect','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','syncAgentComplete','assigned','membername','holdtime','queuecallerexit','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','local/','linkedid','queuecallerexitAt','FORWARDTRANSFER','transfertype','transferexten','transferuniqueid','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','agentcomplete','[%s][voiceQueueReport][agentcomplete]','addVariable','value','variable','queuestatus','CONTINUE','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','length','unmanaged','diff','seconds','sumDuration','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','redis','prototype','tail','finally','sequence','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','clearZombieChannels','switch','enqueue','isNil','Action','channel','catch','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','clearqueuereport','emit','debug',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice_queue_channel:save','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','voice:queue:%s','emitVoiceQueueSummary','type','inbound','name','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','talking','total','abandoned','Trunk','active','Interval','stringify','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isUndefined','[voiceQueueReport][queues]','queuesummary','then','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummary]\x20event:','queue','info'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xec89,0x155));var _0x9ec8=function(_0x5c309c,_0x54b7e3){_0x5c309c=_0x5c309c-0x0;var _0x73965d=_0xec89[_0x5c309c];return _0x73965d;};'use strict';var _=require(_0x9ec8('0x0'));var moment=require(_0x9ec8('0x1'));var util=require(_0x9ec8('0x2'));var md5=require('md5');var Redis=require(_0x9ec8('0x3'));var config=require('../../../config/environment');var logger=require(_0x9ec8('0x4'))(_0x9ec8('0x5'));var ami=require(_0x9ec8('0x6'));var QueueReport=require('../model/queueReport');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9ec8('0x7')]));var Sequence=function(){};Sequence[_0x9ec8('0x8')]['enqueue']=function(_0x379357){this[_0x9ec8('0x9')]=this[_0x9ec8('0x9')]?this[_0x9ec8('0x9')][_0x9ec8('0xa')](_0x379357):_0x379357();};function VoiceQueueReport(_0x169859){this[_0x9ec8('0xb')]=new Sequence();this['queueReports']={};this[_0x9ec8('0xc')]=_0x169859[_0x9ec8('0xc')];this[_0x9ec8('0xd')]=_0x169859[_0x9ec8('0xe')];this['voiceQueues']=_0x169859[_0x9ec8('0xf')];this[_0x9ec8('0x10')]=!![];this[_0x9ec8('0x11')]=_0x169859[_0x9ec8('0x11')];this[_0x9ec8('0x12')]={};ami['on']('queuesummary',this[_0x9ec8('0x13')][_0x9ec8('0x14')](this));ami['on'](_0x9ec8('0x15'),this[_0x9ec8('0x16')][_0x9ec8('0x14')](this));ami['on'](_0x9ec8('0x17'),this[_0x9ec8('0x18')]['bind'](this));ami['on'](_0x9ec8('0x19'),this[_0x9ec8('0x1a')][_0x9ec8('0x14')](this));ami['on'](_0x9ec8('0x1b'),this[_0x9ec8('0x1c')][_0x9ec8('0x14')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x9ec8('0x14')](this));ami['on'](_0x9ec8('0x1d'),this['syncAgentConnect'][_0x9ec8('0x14')](this));ami['on'](_0x9ec8('0x1e'),this[_0x9ec8('0x1f')]['bind'](this));ami['on'](_0x9ec8('0x20'),this[_0x9ec8('0x21')]['bind'](this));ami['on'](_0x9ec8('0x22'),this[_0x9ec8('0x23')]['bind'](this));ami['on'](_0x9ec8('0x24'),this[_0x9ec8('0x25')][_0x9ec8('0x14')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0x9ec8('0x26'),this[_0x9ec8('0x27')]['bind'](this));ami['on'](_0x9ec8('0x28'),this['syncBlindTransfer'][_0x9ec8('0x14')](this));this[_0x9ec8('0x29')]();this[_0x9ec8('0x2a')]();}function clearChannels(_0x35aa43){if(!_[_0x9ec8('0x2b')](_0x35aa43)){for(var _0x8d9d7b in _0x35aa43){if(_0x35aa43[_0x9ec8('0x2c')](_0x8d9d7b)){delete _0x35aa43[_0x8d9d7b];}}}}function clearCampaigns(_0x54d947){if(!_['isEmpty'](_0x54d947)){for(var _0x5e93b9 in _0x54d947){if(_0x54d947[_0x9ec8('0x2c')](_0x5e93b9)){_0x54d947[_0x5e93b9][_0x9ec8('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x36d216){if(!_[_0x9ec8('0x2b')](_0x36d216)){for(var _0x359634 in _0x36d216){if(_0x36d216['hasOwnProperty'](_0x359634)){_0x36d216[_0x359634][_0x9ec8('0x2d')]=0x0;_0x36d216[_0x359634]['talking']=0x0;_0x36d216[_0x359634][_0x9ec8('0x2e')]=0x0;_0x36d216[_0x359634][_0x9ec8('0x2f')]=0x0;_0x36d216[_0x359634][_0x9ec8('0x30')]=!![];}}}}function clearAgentBooked(_0x2ad5f4){if(!_[_0x9ec8('0x2b')](_0x2ad5f4)){for(var _0xa6a235 in _0x2ad5f4){if(_0x2ad5f4[_0x9ec8('0x2c')](_0xa6a235)){_0x2ad5f4[_0xa6a235]['unlockRR']=!![];}}}}VoiceQueueReport[_0x9ec8('0x8')][_0x9ec8('0x31')]=function(){var _0x25ba3c=this;for(var _0x41541a in this[_0x9ec8('0xd')]){if(this[_0x9ec8('0xd')]['hasOwnProperty'](_0x41541a)&&!this['channels'][_0x41541a][_0x9ec8('0x32')]){this['sequence'][_0x9ec8('0x33')](function(){if(!_[_0x9ec8('0x34')](_0x25ba3c[_0x9ec8('0xd')][_0x41541a])){return ami[_0x9ec8('0x35')]({'action':'status','channel':_0x25ba3c[_0x9ec8('0xd')][_0x41541a][_0x9ec8('0x36')]})[_0x9ec8('0x37')](function(_0x283187){if(_0x283187['message']===_0x9ec8('0x38')){setTimeout(function(){if(_0x25ba3c['channels'][_0x41541a]){delete _0x25ba3c[_0x9ec8('0xd')][_0x41541a];logger[_0x9ec8('0x39')](_0x9ec8('0x3a'),_0x41541a,util[_0x9ec8('0x3b')](_0x283187,{'showHidden':![],'depth':null}));}if(_0x25ba3c[_0x9ec8('0x3c')][_0x41541a]){delete _0x25ba3c['queueReports'][_0x41541a];logger['error'](_0x9ec8('0x3d'),_0x41541a,util[_0x9ec8('0x3b')](_0x283187,{'showHidden':![],'depth':null}));}if(_0x25ba3c[_0x9ec8('0x12')][_0x41541a]){delete _0x25ba3c[_0x9ec8('0x12')][_0x41541a];logger[_0x9ec8('0x39')](_0x9ec8('0x3e'),_0x41541a,util[_0x9ec8('0x3b')](_0x283187,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x9ec8('0x8')]['syncFullyBooted']=function(){logger[_0x9ec8('0x39')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this['channels']);this[_0x9ec8('0x3f')](this[_0x9ec8('0x3c')]);clearAgentBooked(this[_0x9ec8('0xc')]);clearVoiceQueues(this[_0x9ec8('0xf')]);clearCampaigns(this[_0x9ec8('0x11')]);};VoiceQueueReport['prototype'][_0x9ec8('0x3f')]=function(_0x19a700){var _0x49a5d6=this;if(!_[_0x9ec8('0x2b')](_0x19a700)){for(var _0x66c4f5 in _0x19a700){if(_0x19a700[_0x9ec8('0x2c')](_0x66c4f5)){_0x49a5d6['emitVoiceQueueChannelRemove'](_0x19a700[_0x66c4f5],_0x9ec8('0x40'));delete _0x19a700[_0x66c4f5];}}}};VoiceQueueReport['prototype']['emit']=function(_0x55b3f1,_0x50fcf2,_0x3b424b){io['to'](_0x55b3f1)[_0x9ec8('0x41')](_0x50fcf2,_0x3b424b);};VoiceQueueReport[_0x9ec8('0x8')]['emitVoiceQueueChannelSave']=function(_0x4933e6,_0x1ca177){logger[_0x9ec8('0x42')]('[%s][voiceQueueReport]['+_0x1ca177+_0x9ec8('0x43'),_0x4933e6[_0x9ec8('0x44')],util[_0x9ec8('0x3b')](_0x4933e6,{'showHidden':![],'depth':null}));this[_0x9ec8('0x41')](util[_0x9ec8('0x45')]('voice:queue:%s',_0x4933e6['name']),_0x9ec8('0x46'),_0x4933e6);};VoiceQueueReport[_0x9ec8('0x8')][_0x9ec8('0x47')]=function(_0x3c31d2,_0x16ad51){logger[_0x9ec8('0x42')]('[%s][voiceQueueReport]['+_0x16ad51+_0x9ec8('0x48'),_0x3c31d2[_0x9ec8('0x44')],util[_0x9ec8('0x3b')](_0x3c31d2,{'showHidden':![],'depth':null}));this['emit'](util[_0x9ec8('0x45')](_0x9ec8('0x49'),_0x3c31d2['name']),'voice_queue_channel:remove',_0x3c31d2);};VoiceQueueReport[_0x9ec8('0x8')][_0x9ec8('0x4a')]=function(_0xd04001,_0x343108){if(_0xd04001[_0x9ec8('0x4b')]===_0x9ec8('0x4c')){var _0x227d84={'id':_0xd04001['id'],'name':_0xd04001[_0x9ec8('0x4d')],'strategy':_0xd04001[_0x9ec8('0x4e')],'answered':_0xd04001[_0x9ec8('0x4f')],'available':_0xd04001[_0x9ec8('0x50')],'loggedIn':_0xd04001[_0x9ec8('0x51')],'pTalking':_0xd04001[_0x9ec8('0x2e')],'sumBillable':_0xd04001[_0x9ec8('0x52')],'sumDuration':_0xd04001['sumDuration'],'sumHoldTime':_0xd04001[_0x9ec8('0x53')]||0x0,'talking':_0xd04001[_0x9ec8('0x54')],'total':_0xd04001[_0x9ec8('0x55')],'type':_0xd04001['type'],'unmanaged':_0xd04001['unmanaged'],'abandoned':_0xd04001[_0x9ec8('0x56')],'waiting':_0xd04001[_0x9ec8('0x2f')]};if(_0xd04001[_0x9ec8('0x57')]){_0x227d84[_0x9ec8('0x57')]={'id':_0xd04001['Trunk']['id'],'name':_0xd04001[_0x9ec8('0x57')]['name'],'active':_0xd04001[_0x9ec8('0x57')][_0x9ec8('0x58')],'callerid':_0xd04001['Trunk']['callerid']};}if(_0xd04001['Interval']){_0x227d84['Interval']={'id':_0xd04001[_0x9ec8('0x59')]['id'],'name':_0xd04001[_0x9ec8('0x59')]['name']};}var _0x3b7715=md5(JSON[_0x9ec8('0x5a')](_0x227d84));if(_0xd04001[_0x9ec8('0x5b')]!==_0x3b7715){_0xd04001[_0x9ec8('0x5b')]=_0x3b7715;logger['debug'](_0x9ec8('0x5c')+_0x343108+_0x9ec8('0x5d'),util['inspect'](_0x227d84,{'showHidden':![],'depth':null}));this[_0x9ec8('0x41')](util[_0x9ec8('0x45')](_0x9ec8('0x49'),_0x227d84[_0x9ec8('0x4d')]),_0x9ec8('0x5e'),_0x227d84);}}};VoiceQueueReport[_0x9ec8('0x8')]['isNotNull']=function(_0x2e9dcb){return _0x2e9dcb!==null&&!_[_0x9ec8('0x5f')](_0x2e9dcb);};VoiceQueueReport[_0x9ec8('0x8')][_0x9ec8('0x2a')]=function(){var _0x55dceb=this;setInterval(function(){_0x55dceb[_0x9ec8('0x31')]();ami[_0x9ec8('0x35')]({'action':'queues'})[_0x9ec8('0x37')](function(_0x452adc){logger[_0x9ec8('0x39')](_0x9ec8('0x60'),util[_0x9ec8('0x3b')](_0x452adc,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x9ec8('0x8')][_0x9ec8('0x29')]=function(){var _0x36dd3c=this;setInterval(function(){if(_0x36dd3c['flagQueueSummary']){return ami['Action']({'action':_0x9ec8('0x61')})[_0x9ec8('0x62')](function(_0x49b65e){_0x36dd3c[_0x9ec8('0x10')]=![];})['catch'](function(_0x47bb07){logger[_0x9ec8('0x39')](_0x9ec8('0x63'),util[_0x9ec8('0x3b')](_0x47bb07,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x379191){try{if(this['isNotNull'](_0x379191)&&this['isNotNull'](_0x379191['queue'])){logger[_0x9ec8('0x42')](_0x9ec8('0x64'),util[_0x9ec8('0x3b')](_0x379191,{'showHidden':![],'depth':null}));if(this[_0x9ec8('0xf')][_0x379191[_0x9ec8('0x65')]]){logger[_0x9ec8('0x66')](_0x9ec8('0x67'),_0x379191['queue']);var _0x161131=_['countBy'](this[_0x9ec8('0xd')],_0x9ec8('0x65'))[_0x379191['queue']]||0x0;var _0x404336=_0x161131-_0x379191[_0x9ec8('0x68')];if(this[_0x9ec8('0xf')][_0x379191[_0x9ec8('0x65')]][_0x9ec8('0x2f')]!==_[_0x9ec8('0x69')](_0x379191[_0x9ec8('0x68')])||this[_0x9ec8('0xf')][_0x379191[_0x9ec8('0x65')]][_0x9ec8('0x51')]!==_[_0x9ec8('0x69')](_0x379191[_0x9ec8('0x6a')])||this['voiceQueues'][_0x379191['queue']][_0x9ec8('0x50')]!==_['toNumber'](_0x379191[_0x9ec8('0x50')])||this['voiceQueues'][_0x379191['queue']][_0x9ec8('0x54')]!==_0x404336){this['voiceQueues'][_0x379191[_0x9ec8('0x65')]][_0x9ec8('0x2f')]=_['toNumber'](_0x379191[_0x9ec8('0x68')]);this[_0x9ec8('0xf')][_0x379191[_0x9ec8('0x65')]][_0x9ec8('0x51')]=_[_0x9ec8('0x69')](_0x379191[_0x9ec8('0x6a')]);this[_0x9ec8('0xf')][_0x379191['queue']][_0x9ec8('0x50')]=_['toNumber'](_0x379191[_0x9ec8('0x50')]);this[_0x9ec8('0xf')][_0x379191[_0x9ec8('0x65')]][_0x9ec8('0x54')]=_0x404336>0x0?_0x404336:0x0;this[_0x9ec8('0xf')][_0x379191[_0x9ec8('0x65')]]['talking']=this[_0x9ec8('0xf')][_0x379191[_0x9ec8('0x65')]]['talking']>_[_0x9ec8('0x69')](_0x379191[_0x9ec8('0x6a')])?_[_0x9ec8('0x69')](_0x379191[_0x9ec8('0x6a')]):this[_0x9ec8('0xf')][_0x379191[_0x9ec8('0x65')]][_0x9ec8('0x54')];this['emitVoiceQueueSummary'](this[_0x9ec8('0xf')][_0x379191['queue']],_0x9ec8('0x61'));}logger[_0x9ec8('0x42')](_0x9ec8('0x6b'),util[_0x9ec8('0x3b')](this[_0x9ec8('0xf')][_0x379191[_0x9ec8('0x65')]],{'showHidden':![],'depth':null}));ami[_0x9ec8('0x41')](_0x9ec8('0x6c'),this[_0x9ec8('0xf')][_0x379191[_0x9ec8('0x65')]]);}}}catch(_0x540b19){logger[_0x9ec8('0x39')]('[voiceQueueReport][queuesummary]',util[_0x9ec8('0x3b')](_0x540b19,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9ec8('0x16')]=function(_0x188ce1){logger[_0x9ec8('0x42')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x9ec8('0x3b')](_0x188ce1,{'showHidden':![],'depth':null}));this[_0x9ec8('0x10')]=!![];};VoiceQueueReport[_0x9ec8('0x8')][_0x9ec8('0x18')]=function(_0x4726f4){try{if(this[_0x9ec8('0x6d')](_0x4726f4)){logger[_0x9ec8('0x42')](_0x9ec8('0x6e'),_0x4726f4[_0x9ec8('0x44')],util['inspect'](_0x4726f4,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x9ec8('0x3c')][_0x4726f4['uniqueid']])){this[_0x9ec8('0x3c')][_0x4726f4[_0x9ec8('0x44')]]=[];this[_0x9ec8('0xd')][_0x4726f4[_0x9ec8('0x44')]]={};}var _0x4c65a4=new QueueReport();_0x4c65a4[_0x9ec8('0x4d')]=_0x4726f4[_0x9ec8('0x65')];_0x4c65a4[_0x9ec8('0x4b')]=this['voiceQueues'][_0x4c65a4[_0x9ec8('0x4d')]]&&this['voiceQueues'][_0x4c65a4[_0x9ec8('0x4d')]][_0x9ec8('0x4b')]?this['voiceQueues'][_0x4c65a4[_0x9ec8('0x4d')]][_0x9ec8('0x4b')]||_0x9ec8('0x4c'):_0x9ec8('0x4c');_0x4c65a4[_0x9ec8('0x65')]=_0x4726f4[_0x9ec8('0x65')];_0x4c65a4[_0x9ec8('0x6f')]=moment()[_0x9ec8('0x45')](_0x9ec8('0x70'));_0x4c65a4['position']=_0x4726f4[_0x9ec8('0x71')];_0x4c65a4[_0x9ec8('0x72')]=_0x4726f4[_0x9ec8('0x72')];_0x4c65a4[_0x9ec8('0x44')]=_0x4726f4[_0x9ec8('0x44')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x4c65a4[_0x9ec8('0x4d')],_0x4c65a4[_0x9ec8('0x4b')]);_[_0x9ec8('0x73')](_0x4c65a4,_[_0x9ec8('0x74')](_0x4726f4,_[_0x9ec8('0x75')](_0x4c65a4)));this['queueReports'][_0x4726f4['uniqueid']]['push'](_0x4c65a4);this[_0x9ec8('0xd')][_0x4726f4['uniqueid']]=_0x4c65a4;this['emitVoiceQueueChannelSave'](_0x4c65a4,_0x9ec8('0x17'));}}catch(_0x57bedd){logger[_0x9ec8('0x39')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4726f4[_0x9ec8('0x44')],util['inspect'](_0x57bedd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x277858){try{if(this[_0x9ec8('0x6d')](_0x277858)){logger[_0x9ec8('0x42')](_0x9ec8('0x76'),_0x277858['uniqueid'],util['inspect'](_0x277858,{'showHidden':![],'depth':null}));if(this[_0x9ec8('0x3c')][_0x277858[_0x9ec8('0x44')]]){var _0x5f507a=_[_0x9ec8('0x77')](this[_0x9ec8('0x3c')][_0x277858[_0x9ec8('0x44')]]);_0x5f507a[_0x9ec8('0x78')]=![];_0x5f507a[_0x9ec8('0x79')]=null;_0x5f507a['holdtime']=_0x277858['holdtime'];_0x5f507a[_0x9ec8('0x7a')]=_0x277858[_0x9ec8('0x7a')];_0x5f507a[_0x9ec8('0x19')]=!![];_0x5f507a[_0x9ec8('0x7b')]=moment()[_0x9ec8('0x45')](_0x9ec8('0x70'));_0x5f507a[_0x9ec8('0x7c')]=_0x9ec8('0x7d');_0x5f507a[_0x9ec8('0x7e')]=null;logger['info'](_0x9ec8('0x7f'),_0x5f507a[_0x9ec8('0x4d')],_0x5f507a[_0x9ec8('0x4b')]);this[_0x9ec8('0xd')][_0x277858[_0x9ec8('0x44')]]=_0x5f507a;this['emitVoiceQueueChannelRemove'](_0x5f507a,_0x9ec8('0x19'));}}}catch(_0x4324b7){logger[_0x9ec8('0x39')](_0x9ec8('0x76'),_0x277858['uniqueid'],util['inspect'](_0x4324b7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9ec8('0x8')][_0x9ec8('0x1c')]=function(_0x42bdd0){try{if(this[_0x9ec8('0x6d')](_0x42bdd0)){logger[_0x9ec8('0x42')]('[%s][voiceQueueReport][queuecallerleave]',_0x42bdd0[_0x9ec8('0x44')],util['inspect'](_0x42bdd0,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x42bdd0[_0x9ec8('0x44')]]){var _0x2e057b=_[_0x9ec8('0x77')](this[_0x9ec8('0x3c')][_0x42bdd0[_0x9ec8('0x44')]]);_0x2e057b[_0x9ec8('0x80')]=moment()[_0x9ec8('0x45')](_0x9ec8('0x70'));_0x2e057b[_0x9ec8('0x81')]=_0x42bdd0[_0x9ec8('0x81')];_0x2e057b[_0x9ec8('0x82')]=_0x42bdd0[_0x9ec8('0x82')];logger[_0x9ec8('0x66')](_0x9ec8('0x83'),_0x2e057b[_0x9ec8('0x4d')],_0x2e057b[_0x9ec8('0x4b')],_0x42bdd0[_0x9ec8('0x81')],_0x42bdd0[_0x9ec8('0x82')]);this['channels'][_0x42bdd0[_0x9ec8('0x44')]]=_0x2e057b;this['emitVoiceQueueChannelSave'](_0x2e057b,_0x9ec8('0x1b'));}}}catch(_0x30b37f){logger[_0x9ec8('0x39')](_0x9ec8('0x84'),_0x42bdd0[_0x9ec8('0x44')],util[_0x9ec8('0x3b')](_0x30b37f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9ec8('0x8')][_0x9ec8('0x85')]=function(_0x21094b){try{if(this[_0x9ec8('0x6d')](_0x21094b)){logger[_0x9ec8('0x42')](_0x9ec8('0x86'),_0x21094b['uniqueid'],util[_0x9ec8('0x3b')](_0x21094b,{'showHidden':![],'depth':null}));if(this[_0x9ec8('0x3c')][_0x21094b['uniqueid']]){var _0x5af20e=_[_0x9ec8('0x77')](this['queueReports'][_0x21094b[_0x9ec8('0x44')]]);_0x5af20e[_0x9ec8('0x78')]=!![];_0x5af20e[_0x9ec8('0x7c')]=_0x9ec8('0x87');logger[_0x9ec8('0x66')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x5af20e['name'],_0x5af20e['type']);}}}catch(_0x4b971d){logger['error'](_0x9ec8('0x86'),_0x21094b['uniqueid'],util[_0x9ec8('0x3b')](_0x4b971d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9ec8('0x88')]=function(_0x4c5ae5){try{if(this[_0x9ec8('0x6d')](_0x4c5ae5)){logger[_0x9ec8('0x42')]('[%s][voiceQueueReport][agentcomplete]',_0x4c5ae5[_0x9ec8('0x44')],util[_0x9ec8('0x3b')](_0x4c5ae5,{'showHidden':![],'depth':null}));if(this[_0x9ec8('0x3c')][_0x4c5ae5['uniqueid']]){var _0x6260b8=_[_0x9ec8('0x77')](this[_0x9ec8('0x3c')][_0x4c5ae5[_0x9ec8('0x44')]]);_0x6260b8[_0x9ec8('0x19')]=![];_0x6260b8[_0x9ec8('0x7b')]=null;_0x6260b8[_0x9ec8('0x89')]=!![];_0x6260b8[_0x9ec8('0x7e')]=_0x4c5ae5[_0x9ec8('0x8a')];_0x6260b8[_0x9ec8('0x8b')]=_0x4c5ae5[_0x9ec8('0x8b')];_0x6260b8[_0x9ec8('0x78')]=!![];_0x6260b8[_0x9ec8('0x8c')]=![];_0x6260b8['queuecallerexitAt']=null;if(!_0x6260b8[_0x9ec8('0x8d')]){if(_0x4c5ae5[_0x9ec8('0x8e')]=='transfer'){_0x6260b8[_0x9ec8('0x7c')]=_0x9ec8('0x8f');logger['info'](_0x9ec8('0x90'),_0x6260b8[_0x9ec8('0x4d')],_0x6260b8[_0x9ec8('0x4b')]);}else{if(_[_0x9ec8('0x91')](_0x4c5ae5[_0x9ec8('0x36')]['toLowerCase'](),_0x9ec8('0x92'))){if(this['queueReports'][_0x4c5ae5[_0x9ec8('0x93')]]){var _0x25b20c=_[_0x9ec8('0x77')](this[_0x9ec8('0x3c')][_0x4c5ae5['linkedid']]);_0x25b20c[_0x9ec8('0x78')]=![];_0x25b20c[_0x9ec8('0x8c')]=!![];_0x25b20c[_0x9ec8('0x94')]=moment(_0x6260b8['queuecallerjoinAt'])['add'](_0x4c5ae5[_0x9ec8('0x8b')],'seconds')[_0x9ec8('0x45')](_0x9ec8('0x70'));_0x25b20c[_0x9ec8('0x7c')]=_0x9ec8('0x95');_0x25b20c['transfer']=!![];_0x25b20c[_0x9ec8('0x96')]='FORWARD';_0x25b20c[_0x9ec8('0x97')]=_0x4c5ae5['destexten'];_0x25b20c[_0x9ec8('0x98')]=_0x4c5ae5['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x25b20c[_0x9ec8('0x4d')],_0x25b20c['type']);var _0x2044bd=this[_0x9ec8('0x3c')][_0x4c5ae5[_0x9ec8('0x93')]];this[_0x9ec8('0x3c')][_0x4c5ae5[_0x9ec8('0x93')]]=this['queueReports'][_0x4c5ae5[_0x9ec8('0x44')]];this['queueReports'][_0x4c5ae5[_0x9ec8('0x44')]]=_0x2044bd;}}else{_0x6260b8[_0x9ec8('0x7c')]='COMPLETEDBY'+_0x4c5ae5[_0x9ec8('0x8e')][_0x9ec8('0x99')]();logger[_0x9ec8('0x66')](_0x9ec8('0x9a'),_0x6260b8[_0x9ec8('0x4d')],_0x6260b8[_0x9ec8('0x4b')],_0x6260b8['queuecallerexitreason']);}}}this[_0x9ec8('0xd')][_0x4c5ae5['uniqueid']]=_0x6260b8;this[_0x9ec8('0x47')](_0x6260b8,_0x9ec8('0x9b'));}}}catch(_0x130f8c){logger[_0x9ec8('0x39')](_0x9ec8('0x9c'),_0x4c5ae5[_0x9ec8('0x44')],util[_0x9ec8('0x3b')](_0x130f8c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9ec8('0x8')][_0x9ec8('0x1f')]=function(_0xa1a73c){try{if(this[_0x9ec8('0x6d')](_0xa1a73c)){logger[_0x9ec8('0x42')]('[%s][voiceQueueReport][varset]',_0xa1a73c['uniqueid'],util[_0x9ec8('0x3b')](_0xa1a73c,{'showHidden':![],'depth':null}));this[_0x9ec8('0x9d')](_0xa1a73c[_0x9ec8('0x44')],_[_0x9ec8('0x75')](_0xa1a73c['variable'])[0x0],_0xa1a73c[_0x9ec8('0x9e')]);if(this['queueReports'][_0xa1a73c[_0x9ec8('0x44')]]){var _0x2ca9d0=_['last'](this[_0x9ec8('0x3c')][_0xa1a73c[_0x9ec8('0x44')]]);if(_0x2ca9d0){if(this[_0x9ec8('0x6d')](_0xa1a73c[_0x9ec8('0x9f')])&&this[_0x9ec8('0x6d')](_0xa1a73c[_0x9ec8('0x9f')][_0x9ec8('0xa0')])){switch(_0xa1a73c[_0x9ec8('0x9e')]){case _0x9ec8('0xa1'):_0x2ca9d0[_0x9ec8('0x8c')]=![];_0x2ca9d0[_0x9ec8('0x94')]=null;break;case'TIMEOUT':_0x2ca9d0['lastevent']='timeout';_0x2ca9d0['queuecallerexit']=!![];_0x2ca9d0[_0x9ec8('0x94')]=moment()['format'](_0x9ec8('0x70'));_0x2ca9d0['queuecallerleaveAt']=moment()[_0x9ec8('0x45')](_0x9ec8('0x70'));logger['debug'](_0x9ec8('0xa2'),_0xa1a73c[_0x9ec8('0x44')],util[_0x9ec8('0x3b')](_0x2ca9d0,{'showHidden':![],'depth':null}));ami[_0x9ec8('0x41')](_0x9ec8('0xa3'),_0x2ca9d0);break;default:_0x2ca9d0[_0x9ec8('0x8c')]=!![];_0x2ca9d0[_0x9ec8('0x94')]=moment()[_0x9ec8('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x2ca9d0[_0x9ec8('0x80')]=moment()[_0x9ec8('0x45')](_0x9ec8('0x70'));}_0x2ca9d0[_0x9ec8('0x19')]=![];_0x2ca9d0[_0x9ec8('0x7b')]=null;_0x2ca9d0[_0x9ec8('0x7c')]=_0xa1a73c[_0x9ec8('0x9e')];this[_0x9ec8('0xd')][_0xa1a73c[_0x9ec8('0x44')]]=_0x2ca9d0;this[_0x9ec8('0x47')](_0x2ca9d0,_0x9ec8('0x1e'));}else if(this[_0x9ec8('0x6d')](_0xa1a73c[_0x9ec8('0x9f')])&&this['isNotNull'](_0xa1a73c['variable']['queueposition'])){if(!_0x2ca9d0[_0x9ec8('0x19')]){_0x2ca9d0[_0x9ec8('0x8c')]=!![];_0x2ca9d0[_0x9ec8('0x94')]=moment()[_0x9ec8('0x45')](_0x9ec8('0x70'));_0x2ca9d0[_0x9ec8('0x7c')]=_0x9ec8('0xa4');_0x2ca9d0[_0x9ec8('0x80')]=moment()[_0x9ec8('0x45')](_0x9ec8('0x70'));this['channels'][_0xa1a73c[_0x9ec8('0x44')]]=_0x2ca9d0;}}logger[_0x9ec8('0x66')](_0x9ec8('0xa5'),_0xa1a73c['uniqueid'],_0x2ca9d0['name'],_0x2ca9d0['type'],_[_0x9ec8('0x75')](_0xa1a73c[_0x9ec8('0x9f')])[0x0],_0xa1a73c[_0x9ec8('0x9e')]);_0x2ca9d0[_0x9ec8('0x12')]=this['variables'][_0xa1a73c[_0x9ec8('0x44')]];}}}}catch(_0x2749d0){logger[_0x9ec8('0x39')](_0x9ec8('0xa6'),_0xa1a73c[_0x9ec8('0x44')],util[_0x9ec8('0x3b')](_0x2749d0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9ec8('0x8')][_0x9ec8('0x9d')]=function(_0x25b280,_0x110a7a,_0xcf7ddb){var _0x225a09=[_0x9ec8('0xa7'),_0x9ec8('0xa8'),'rtpaudioqosjitter',_0x9ec8('0xa9'),_0x9ec8('0xaa'),_0x9ec8('0xab'),_0x9ec8('0xac'),_0x9ec8('0xad'),'sipcallid',_0x9ec8('0xae'),_0x9ec8('0xaf'),_0x9ec8('0xb0'),_0x9ec8('0xb1'),_0x9ec8('0xb2'),_0x9ec8('0xb3'),_0x9ec8('0xb4'),_0x9ec8('0x8a'),_0x9ec8('0xb5'),_0x9ec8('0xb6')];if(!_['isNil'](_0x110a7a)&&!_[_0x9ec8('0xb7')](_0x225a09,_0x110a7a)){if(_[_0x9ec8('0x5f')](this[_0x9ec8('0x12')][_0x25b280])){this['variables'][_0x25b280]={};}this[_0x9ec8('0x12')][_0x25b280][_0x110a7a]=_0xcf7ddb;}};VoiceQueueReport[_0x9ec8('0x8')][_0x9ec8('0x21')]=function(_0x468107){try{if(this[_0x9ec8('0x6d')](_0x468107)){logger[_0x9ec8('0x42')]('[%s][voiceQueueReport][hangup]',_0x468107[_0x9ec8('0x44')],util[_0x9ec8('0x3b')](_0x468107,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x468107[_0x9ec8('0x44')]]){for(var _0x2d7d65=0x0,_0x2fe17b={};_0x2d7d650x0?_0xfb4e64:0x0;this[_0x34b5('0x12')][_0x2e44f0[_0x34b5('0x65')]][_0x34b5('0x55')]=this[_0x34b5('0x12')][_0x2e44f0['queue']]['talking']>_[_0x34b5('0x6b')](_0x2e44f0['loggedin'])?_[_0x34b5('0x6b')](_0x2e44f0[_0x34b5('0x6d')]):this[_0x34b5('0x12')][_0x2e44f0['queue']][_0x34b5('0x55')];this[_0x34b5('0x4c')](this[_0x34b5('0x12')][_0x2e44f0['queue']],_0x34b5('0x63'));}logger[_0x34b5('0x44')](_0x34b5('0x6e'),util[_0x34b5('0x3b')](this['voiceQueues'][_0x2e44f0[_0x34b5('0x65')]],{'showHidden':![],'depth':null}));ami['emit'](_0x34b5('0x6f'),this[_0x34b5('0x12')][_0x2e44f0[_0x34b5('0x65')]]);}}}catch(_0x14d113){logger[_0x34b5('0x3c')](_0x34b5('0x70'),util[_0x34b5('0x3b')](_0x14d113,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0x18')]=function(_0x381c48){logger['debug'](_0x34b5('0x71'),util[_0x34b5('0x3b')](_0x381c48,{'showHidden':![],'depth':null}));this[_0x34b5('0x62')]=!![];};VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0x72')]=function(_0x529600){try{if(this[_0x34b5('0x5e')](_0x529600)){logger['debug'](_0x34b5('0x73'),_0x529600[_0x34b5('0x45')],util['inspect'](_0x529600,{'showHidden':![],'depth':null}));if(_[_0x34b5('0x5f')](this[_0x34b5('0xf')][_0x529600[_0x34b5('0x45')]])){this[_0x34b5('0xf')][_0x529600['uniqueid']]=[];this[_0x34b5('0x31')][_0x529600['uniqueid']]={};}var _0x4c118=new QueueReport();_0x4c118[_0x34b5('0x47')]=_0x529600[_0x34b5('0x65')];_0x4c118[_0x34b5('0x4d')]=this[_0x34b5('0x12')][_0x4c118[_0x34b5('0x47')]]&&this[_0x34b5('0x12')][_0x4c118['name']][_0x34b5('0x4d')]?this[_0x34b5('0x12')][_0x4c118[_0x34b5('0x47')]][_0x34b5('0x4d')]||_0x34b5('0x4e'):_0x34b5('0x4e');_0x4c118[_0x34b5('0x65')]=_0x529600['queue'];_0x4c118[_0x34b5('0x74')]=moment()[_0x34b5('0x4a')](_0x34b5('0x75'));_0x4c118[_0x34b5('0x76')]=_0x529600['position'];_0x4c118[_0x34b5('0x77')]=_0x529600[_0x34b5('0x77')];_0x4c118[_0x34b5('0x45')]=_0x529600[_0x34b5('0x45')];logger[_0x34b5('0x67')](_0x34b5('0x78'),_0x4c118['name'],_0x4c118['type']);_['merge'](_0x4c118,_[_0x34b5('0x79')](_0x529600,_[_0x34b5('0x7a')](_0x4c118)));this['queueReports'][_0x529600[_0x34b5('0x45')]][_0x34b5('0x7b')](_0x4c118);this[_0x34b5('0x31')][_0x529600[_0x34b5('0x45')]]=_0x4c118;this[_0x34b5('0x43')](_0x4c118,_0x34b5('0x19'));}}catch(_0x7e726){logger[_0x34b5('0x3c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x529600[_0x34b5('0x45')],util[_0x34b5('0x3b')](_0x7e726,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0x1b')]=function(_0x541b56){try{if(this[_0x34b5('0x5e')](_0x541b56)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x541b56[_0x34b5('0x45')],util[_0x34b5('0x3b')](_0x541b56,{'showHidden':![],'depth':null}));if(this[_0x34b5('0xf')][_0x541b56[_0x34b5('0x45')]]){var _0x28a751=_[_0x34b5('0x7c')](this['queueReports'][_0x541b56[_0x34b5('0x45')]]);_0x28a751['queuecallercomplete']=![];_0x28a751[_0x34b5('0x7d')]=null;_0x28a751[_0x34b5('0x7e')]=_0x541b56[_0x34b5('0x7e')];_0x28a751[_0x34b5('0x7f')]=_0x541b56[_0x34b5('0x7f')];_0x28a751[_0x34b5('0x1a')]=!![];_0x28a751['queuecallerabandonAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x28a751['queuecallerexitreason']=_0x34b5('0x80');_0x28a751[_0x34b5('0x81')]=null;logger[_0x34b5('0x67')](_0x34b5('0x82'),_0x28a751[_0x34b5('0x47')],_0x28a751[_0x34b5('0x4d')]);this[_0x34b5('0x31')][_0x541b56[_0x34b5('0x45')]]=_0x28a751;this[_0x34b5('0x41')](_0x28a751,_0x34b5('0x1a'));}}}catch(_0x41b9c0){logger[_0x34b5('0x3c')](_0x34b5('0x83'),_0x541b56['uniqueid'],util[_0x34b5('0x3b')](_0x41b9c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x34b5('0xb')]['syncQueueCallerLeave']=function(_0x3a82d3){try{if(this[_0x34b5('0x5e')](_0x3a82d3)){logger[_0x34b5('0x44')](_0x34b5('0x84'),_0x3a82d3[_0x34b5('0x45')],util['inspect'](_0x3a82d3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3a82d3[_0x34b5('0x45')]]){var _0x481571=_[_0x34b5('0x7c')](this[_0x34b5('0xf')][_0x3a82d3[_0x34b5('0x45')]]);_0x481571[_0x34b5('0x85')]=moment()[_0x34b5('0x4a')](_0x34b5('0x75'));_0x481571[_0x34b5('0x86')]=_0x3a82d3[_0x34b5('0x86')];_0x481571[_0x34b5('0x87')]=_0x3a82d3[_0x34b5('0x87')];logger[_0x34b5('0x67')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x481571[_0x34b5('0x47')],_0x481571['type'],_0x3a82d3[_0x34b5('0x86')],_0x3a82d3['connectedlinename']);this[_0x34b5('0x31')][_0x3a82d3[_0x34b5('0x45')]]=_0x481571;this[_0x34b5('0x43')](_0x481571,'queuecallerleave');}}}catch(_0x41a089){logger['error'](_0x34b5('0x84'),_0x3a82d3[_0x34b5('0x45')],util['inspect'](_0x41a089,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x34b5('0x1e')]=function(_0x299bd4){try{if(this[_0x34b5('0x5e')](_0x299bd4)){logger[_0x34b5('0x44')]('[%s][voiceQueueReport][agentconnect]',_0x299bd4[_0x34b5('0x45')],util[_0x34b5('0x3b')](_0x299bd4,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x299bd4[_0x34b5('0x45')]]){var _0x128243=_[_0x34b5('0x7c')](this['queueReports'][_0x299bd4[_0x34b5('0x45')]]);_0x128243['queuecallercomplete']=!![];_0x128243['queuecallerexitreason']=_0x34b5('0x88');logger['info'](_0x34b5('0x89'),_0x128243[_0x34b5('0x47')],_0x128243[_0x34b5('0x4d')]);}}}catch(_0x369548){logger['error'](_0x34b5('0x8a'),_0x299bd4['uniqueid'],util[_0x34b5('0x3b')](_0x369548,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0x1d')]=function(_0x5b0236){try{if(this['isNotNull'](_0x5b0236)){logger['debug'](_0x34b5('0x8b'),_0x5b0236[_0x34b5('0x45')],util[_0x34b5('0x3b')](_0x5b0236,{'showHidden':![],'depth':null}));if(this[_0x34b5('0xf')][_0x5b0236['uniqueid']]){var _0x575c86=_[_0x34b5('0x7c')](this[_0x34b5('0xf')][_0x5b0236[_0x34b5('0x45')]]);_0x575c86[_0x34b5('0x1a')]=![];_0x575c86[_0x34b5('0x8c')]=null;_0x575c86['assigned']=!![];_0x575c86[_0x34b5('0x81')]=_0x5b0236[_0x34b5('0x8d')];_0x575c86[_0x34b5('0x7e')]=_0x5b0236[_0x34b5('0x7e')];_0x575c86[_0x34b5('0x8e')]=!![];_0x575c86[_0x34b5('0x8f')]=![];_0x575c86[_0x34b5('0x90')]=null;if(!_0x575c86[_0x34b5('0x91')]){if(_0x5b0236['reason']=='transfer'){_0x575c86['queuecallerexitreason']='COMPLETED';logger[_0x34b5('0x67')](_0x34b5('0x92'),_0x575c86[_0x34b5('0x47')],_0x575c86[_0x34b5('0x4d')]);}else{if(_[_0x34b5('0x93')](_0x5b0236[_0x34b5('0x36')][_0x34b5('0x94')](),_0x34b5('0x95'))){if(this[_0x34b5('0xf')][_0x5b0236[_0x34b5('0x96')]]){var _0x25b86e=_[_0x34b5('0x7c')](this['queueReports'][_0x5b0236[_0x34b5('0x96')]]);_0x25b86e[_0x34b5('0x8e')]=![];_0x25b86e[_0x34b5('0x8f')]=!![];_0x25b86e[_0x34b5('0x90')]=moment(_0x575c86[_0x34b5('0x74')])[_0x34b5('0x97')](_0x5b0236['holdtime'],_0x34b5('0x98'))[_0x34b5('0x4a')](_0x34b5('0x75'));_0x25b86e['queuecallerexitreason']='FORWARDTRANSFER';_0x25b86e[_0x34b5('0x91')]=!![];_0x25b86e[_0x34b5('0x99')]=_0x34b5('0x9a');_0x25b86e[_0x34b5('0x9b')]=_0x5b0236[_0x34b5('0x9c')];_0x25b86e['transferuniqueid']=_0x5b0236[_0x34b5('0x45')];logger[_0x34b5('0x67')](_0x34b5('0x9d'),_0x25b86e[_0x34b5('0x47')],_0x25b86e[_0x34b5('0x4d')]);var _0x48a0bf=this[_0x34b5('0xf')][_0x5b0236['linkedid']];this[_0x34b5('0xf')][_0x5b0236['linkedid']]=this[_0x34b5('0xf')][_0x5b0236['uniqueid']];this['queueReports'][_0x5b0236['uniqueid']]=_0x48a0bf;}}else{_0x575c86[_0x34b5('0x9e')]=_0x34b5('0x9f')+_0x5b0236[_0x34b5('0xa0')][_0x34b5('0xa1')]();logger[_0x34b5('0x67')](_0x34b5('0xa2'),_0x575c86[_0x34b5('0x47')],_0x575c86[_0x34b5('0x4d')],_0x575c86['queuecallerexitreason']);}}}this[_0x34b5('0x31')][_0x5b0236['uniqueid']]=_0x575c86;this[_0x34b5('0x41')](_0x575c86,_0x34b5('0x1c'));}}}catch(_0x52f2aa){logger[_0x34b5('0x3c')](_0x34b5('0x8b'),_0x5b0236['uniqueid'],util[_0x34b5('0x3b')](_0x52f2aa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0x20')]=function(_0xf1ec79){try{if(this[_0x34b5('0x5e')](_0xf1ec79)){logger[_0x34b5('0x44')](_0x34b5('0xa3'),_0xf1ec79[_0x34b5('0x45')],util[_0x34b5('0x3b')](_0xf1ec79,{'showHidden':![],'depth':null}));this['addVariable'](_0xf1ec79['uniqueid'],_[_0x34b5('0x7a')](_0xf1ec79[_0x34b5('0xa4')])[0x0],_0xf1ec79[_0x34b5('0xa5')]);if(this[_0x34b5('0xf')][_0xf1ec79[_0x34b5('0x45')]]){var _0x51d4bf=_[_0x34b5('0x7c')](this[_0x34b5('0xf')][_0xf1ec79[_0x34b5('0x45')]]);if(_0x51d4bf){if(this[_0x34b5('0x5e')](_0xf1ec79['variable'])&&this[_0x34b5('0x5e')](_0xf1ec79[_0x34b5('0xa4')]['queuestatus'])){switch(_0xf1ec79[_0x34b5('0xa5')]){case _0x34b5('0xa6'):_0x51d4bf[_0x34b5('0x8f')]=![];_0x51d4bf[_0x34b5('0x90')]=null;break;case _0x34b5('0xa7'):_0x51d4bf['lastevent']=_0x34b5('0xa8');_0x51d4bf[_0x34b5('0x8f')]=!![];_0x51d4bf[_0x34b5('0x90')]=moment()[_0x34b5('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x51d4bf['queuecallerleaveAt']=moment()['format'](_0x34b5('0x75'));logger['debug'](_0x34b5('0xa9'),_0xf1ec79[_0x34b5('0x45')],util['inspect'](_0x51d4bf,{'showHidden':![],'depth':null}));ami[_0x34b5('0x42')](_0x34b5('0xaa'),_0x51d4bf);break;default:_0x51d4bf[_0x34b5('0x8f')]=!![];_0x51d4bf[_0x34b5('0x90')]=moment()[_0x34b5('0x4a')](_0x34b5('0x75'));_0x51d4bf[_0x34b5('0x85')]=moment()[_0x34b5('0x4a')](_0x34b5('0x75'));}_0x51d4bf[_0x34b5('0x1a')]=![];_0x51d4bf['queuecallerabandonAt']=null;_0x51d4bf[_0x34b5('0x9e')]=_0xf1ec79['value'];this['channels'][_0xf1ec79['uniqueid']]=_0x51d4bf;this[_0x34b5('0x41')](_0x51d4bf,_0x34b5('0x1f'));}else if(this[_0x34b5('0x5e')](_0xf1ec79[_0x34b5('0xa4')])&&this[_0x34b5('0x5e')](_0xf1ec79[_0x34b5('0xa4')][_0x34b5('0xab')])){if(!_0x51d4bf[_0x34b5('0x1a')]){_0x51d4bf[_0x34b5('0x8f')]=!![];_0x51d4bf[_0x34b5('0x90')]=moment()[_0x34b5('0x4a')](_0x34b5('0x75'));_0x51d4bf[_0x34b5('0x9e')]=_0x34b5('0xac');_0x51d4bf['queuecallerleaveAt']=moment()[_0x34b5('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x34b5('0x31')][_0xf1ec79[_0x34b5('0x45')]]=_0x51d4bf;}}logger[_0x34b5('0x67')](_0x34b5('0xad'),_0xf1ec79[_0x34b5('0x45')],_0x51d4bf[_0x34b5('0x47')],_0x51d4bf[_0x34b5('0x4d')],_[_0x34b5('0x7a')](_0xf1ec79['variable'])[0x0],_0xf1ec79[_0x34b5('0xa5')]);_0x51d4bf[_0x34b5('0x14')]=this[_0x34b5('0x14')][_0xf1ec79[_0x34b5('0x45')]];}}}}catch(_0x1ca2af){logger[_0x34b5('0x3c')](_0x34b5('0xa3'),_0xf1ec79[_0x34b5('0x45')],util[_0x34b5('0x3b')](_0x1ca2af,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0xae')]=function(_0x525a25,_0x3d2dc1,_0x40fc7b){var _0xfa29ce=[_0x34b5('0xaf'),_0x34b5('0xb0'),_0x34b5('0xb1'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x34b5('0xb2'),'rtpaudioqosrtt',_0x34b5('0xb3'),_0x34b5('0xb4'),'sipuri',_0x34b5('0xb5'),_0x34b5('0xb6'),'membercalls',_0x34b5('0xb7'),_0x34b5('0xb8'),'memberlastcall','membername',_0x34b5('0xb9'),_0x34b5('0xba')];if(!_['isNil'](_0x3d2dc1)&&!_['includes'](_0xfa29ce,_0x3d2dc1)){if(_[_0x34b5('0x5f')](this[_0x34b5('0x14')][_0x525a25])){this[_0x34b5('0x14')][_0x525a25]={};}this['variables'][_0x525a25][_0x3d2dc1]=_0x40fc7b;}};VoiceQueueReport[_0x34b5('0xb')][_0x34b5('0x22')]=function(_0x26ab74){try{if(this['isNotNull'](_0x26ab74)){logger[_0x34b5('0x44')](_0x34b5('0xbb'),_0x26ab74['uniqueid'],util['inspect'](_0x26ab74,{'showHidden':![],'depth':null}));if(this[_0x34b5('0xf')][_0x26ab74[_0x34b5('0x45')]]){for(var _0x41e6ab=0x0,_0x501954={};_0x41e6ab=0x0?moment(_0x5f102f['endtime'])[_0x1a58('0xe')](_0x5f102f[_0x1a58('0x18')],_0x1a58('0xf')):null,'data1':_0x1a58('0x19'),'data2':_0x5f102f[_0x1a58('0x1a')],'data3':_0x5f102f[_0x1a58('0x11')],'data4':_0x5f102f['dialstring']||null,'role':'agent','internal':_0x5f102f[_0x1a58('0x1a')]?_[_0x1a58('0x14')](_0x5f102f['accountcode']):undefined,'uniqueid':_0x5f102f[_0x1a58('0x15')]},'log':_0x1a58('0x6')});}; \ No newline at end of file +var _0x3814=['TALKING','starttime','endtime','diff','dialstring','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','format','interface','queuecallerleaveAt','seconds','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0x3814,0xa7));var _0x4381=function(_0xb85d3f,_0x3f4454){_0xb85d3f=_0xb85d3f-0x0;var _0x29c170=_0x3814[_0xb85d3f];return _0x29c170;};'use strict';var moment=require('moment');var _=require(_0x4381('0x0'));var util=require('util');var client=require(_0x4381('0x1'));exports[_0x4381('0x2')]=function(_0x3c03f1){var _0x5edcc6=_0x3c03f1[_0x4381('0x3')]||_0x3c03f1[_0x4381('0x4')];return client[_0x4381('0x5')]('CreateMemberReport',{'body':{'channel':_0x4381('0x6'),'membername':_0x3c03f1[_0x4381('0x7')],'interface':_['isNil'](_0x3c03f1['interface'])?util[_0x4381('0x8')]('SIP/%s',_0x3c03f1[_0x4381('0x7')]):_0x3c03f1[_0x4381('0x9')],'type':'TALKING','enterAt':_0x3c03f1[_0x4381('0xa')],'exitAt':_0x5edcc6,'duration':moment(_0x5edcc6)['diff'](_0x3c03f1[_0x4381('0xa')],_0x4381('0xb')),'data1':'inbound','data2':_0x3c03f1[_0x4381('0xc')],'data3':_0x3c03f1[_0x4381('0xd')],'data4':null,'data5':_0x3c03f1[_0x4381('0xe')],'role':_0x4381('0xf'),'internal':_0x3c03f1[_0x4381('0x10')]?_[_0x4381('0x11')](_0x3c03f1[_0x4381('0x10')]):undefined,'uniqueid':_0x3c03f1[_0x4381('0x12')]},'log':_0x4381('0x13')});};exports[_0x4381('0x14')]=function(_0xfae779){return client[_0x4381('0x5')](_0x4381('0x13'),{'body':{'channel':_0x4381('0x6'),'membername':_0xfae779[_0x4381('0x15')],'interface':_0xfae779[_0x4381('0x9')],'type':_0x4381('0x16'),'enterAt':_0xfae779[_0x4381('0x17')],'exitAt':_0xfae779['endtime'],'duration':moment(_0xfae779[_0x4381('0x18')])[_0x4381('0x19')](_0xfae779[_0x4381('0x17')],_0x4381('0xb'))>=0x0?moment(_0xfae779[_0x4381('0x18')])[_0x4381('0x19')](_0xfae779[_0x4381('0x17')],_0x4381('0xb')):null,'data1':'outbound','data2':_0xfae779['accountcode'],'data3':_0xfae779[_0x4381('0xd')],'data4':_0xfae779[_0x4381('0x1a')]||null,'role':_0x4381('0xf'),'internal':_0xfae779[_0x4381('0x10')]?_[_0x4381('0x11')](_0xfae779[_0x4381('0x10')]):undefined,'uniqueid':_0xfae779[_0x4381('0x12')]},'log':_0x4381('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 13973e2..824a501 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 _0xe28e=['Request','GetTemplate','name','html','../client','getTemplates'];(function(_0x3b84ea,_0x85e5a9){var _0xfb8c9b=function(_0x597426){while(--_0x597426){_0x3b84ea['push'](_0x3b84ea['shift']());}};_0xfb8c9b(++_0x85e5a9);}(_0xe28e,0x1ba));var _0xee28=function(_0x3ccd19,_0xc1940d){_0x3ccd19=_0x3ccd19-0x0;var _0x384eec=_0xe28e[_0x3ccd19];return _0x384eec;};'use strict';var client=require(_0xee28('0x0'));exports[_0xee28('0x1')]=function(_0x1d67b1){return function(_0x280bed){return client[_0xee28('0x2')](_0xee28('0x3'),{'options':{'raw':!![],'attributes':['id',_0xee28('0x4'),_0xee28('0x5')]},'log':_0xee28('0x3')});};}; \ No newline at end of file +var _0xe130=['html','../client','getTemplates','Request','GetTemplate','name'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0xe130,0x127));var _0x0e13=function(_0x21d56d,_0x484a71){_0x21d56d=_0x21d56d-0x0;var _0x42f976=_0xe130[_0x21d56d];return _0x42f976;};'use strict';var client=require(_0x0e13('0x0'));exports[_0x0e13('0x1')]=function(_0x51aabf){return function(_0x35c7af){return client[_0x0e13('0x2')](_0x0e13('0x3'),{'options':{'raw':!![],'attributes':['id',_0x0e13('0x4'),_0x0e13('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index a8fd2df..afbe707 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 _0xfd2a=['data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','field','operator','value','Action','Actions','data2'];(function(_0x1ccd83,_0x945c00){var _0x3993cf=function(_0x255849){while(--_0x255849){_0x1ccd83['push'](_0x1ccd83['shift']());}};_0x3993cf(++_0x945c00);}(_0xfd2a,0x9d));var _0xafd2=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xfd2a[_0x1b4b23];return _0x2a325b;};'use strict';var client=require(_0xafd2('0x0'));exports[_0xafd2('0x1')]=function(_0x6cc43a){return function(_0x5d9a6e){return client[_0xafd2('0x2')](_0xafd2('0x3'),{'options':{'raw':![],'attributes':['id',_0xafd2('0x4'),_0xafd2('0x5'),_0xafd2('0x6')],'include':[{'model':_0xafd2('0x7'),'as':'AllConditions','attributes':['id',_0xafd2('0x8'),_0xafd2('0x9'),_0xafd2('0xa')]},{'model':_0xafd2('0x7'),'as':'AnyConditions','attributes':['id','field',_0xafd2('0x9'),_0xafd2('0xa')]},{'model':_0xafd2('0xb'),'as':_0xafd2('0xc'),'attributes':['id','action','data1',_0xafd2('0xd'),_0xafd2('0xe'),_0xafd2('0xf'),_0xafd2('0x10'),_0xafd2('0x11'),_0xafd2('0x12')]}]},'log':_0xafd2('0x3')});};}; \ No newline at end of file +var _0x1262=['AnyConditions','field','Actions','data1','data3','data4','data6','data7','GetTrigger','../client','getTriggers','Request','name','channel','operator','value','Condition'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x1262,0x1e5));var _0x2126=function(_0x56238e,_0x50a0ce){_0x56238e=_0x56238e-0x0;var _0x5d967c=_0x1262[_0x56238e];return _0x5d967c;};'use strict';var client=require(_0x2126('0x0'));exports[_0x2126('0x1')]=function(_0x1d2e24){return function(_0x506686){return client[_0x2126('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x2126('0x3'),_0x2126('0x4'),'status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id','field',_0x2126('0x5'),_0x2126('0x6')]},{'model':_0x2126('0x7'),'as':_0x2126('0x8'),'attributes':['id',_0x2126('0x9'),_0x2126('0x5'),_0x2126('0x6')]},{'model':'Action','as':_0x2126('0xa'),'attributes':['id','action',_0x2126('0xb'),'data2',_0x2126('0xc'),_0x2126('0xd'),'data5',_0x2126('0xe'),_0x2126('0xf')]}]},'log':_0x2126('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 085d5bb..7439c0e 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 _0x6706=['getTrunks','Request','GetTrunk','name','registry','../client'];(function(_0xfec3c8,_0x33c9f5){var _0xfb507d=function(_0x2ff2b2){while(--_0x2ff2b2){_0xfec3c8['push'](_0xfec3c8['shift']());}};_0xfb507d(++_0x33c9f5);}(_0x6706,0x185));var _0x6670=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6706[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6670('0x0'));exports[_0x6670('0x1')]=function(_0x285444){return function(_0x4e8fbc){return client[_0x6670('0x2')](_0x6670('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6670('0x4'),_0x6670('0x5')]},'log':_0x6670('0x3')});};}; \ No newline at end of file +var _0x49a4=['Request','GetTrunk','name','registry'];(function(_0x2728ab,_0x4d0d28){var _0x33d104=function(_0x5633c5){while(--_0x5633c5){_0x2728ab['push'](_0x2728ab['shift']());}};_0x33d104(++_0x4d0d28);}(_0x49a4,0x188));var _0x449a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x49a4[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x4e555e){return function(_0x47af88){return client[_0x449a('0x0')](_0x449a('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x449a('0x2'),_0x449a('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 40262c7..d452264 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 _0xa573=['name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','interface','getTelephones','GetUser','internal','PauseUser','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','getAgents','Request'];(function(_0x2a616b,_0x5161f4){var _0x368f19=function(_0x537d7f){while(--_0x537d7f){_0x2a616b['push'](_0x2a616b['shift']());}};_0x368f19(++_0x5161f4);}(_0xa573,0x163));var _0x3a57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa573[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x3a57('0x0')]=function(){return function(){return client[_0x3a57('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x3a57('0x2'),_0x3a57('0x3'),_0x3a57('0x4'),_0x3a57('0x5'),'online',_0x3a57('0x6'),_0x3a57('0x7'),_0x3a57('0x8'),_0x3a57('0x9'),_0x3a57('0xa'),'mobile',_0x3a57('0xb')]},'log':_0x3a57('0x0')});};};exports[_0x3a57('0xc')]=function(){return function(){return client['Request'](_0x3a57('0xd'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3a57('0x2'),_0x3a57('0x4'),_0x3a57('0xe')]},'log':_0x3a57('0xc')});};};exports['savePause']=function(_0x27e4f4,_0x106371,_0x8e26cb){return client[_0x3a57('0x1')](_0x3a57('0xf'),{'body':{'type':_0x106371,'uniqueid':_0x8e26cb},'options':{'where':{'id':_0x27e4f4['id']}},'log':_0x3a57('0x10')});};exports[_0x3a57('0x11')]=function(_0xbe616a){return client[_0x3a57('0x1')](_0x3a57('0x12'),{'body':{},'options':{'where':{'id':_0xbe616a['id']}},'log':'savePause'});};exports[_0x3a57('0x13')]=function(_0x1f22d1){return client[_0x3a57('0x1')](_0x3a57('0x14'),{'options':{'raw':![],'where':{'role':'agent','id':_0x1f22d1},'attributes':['id',_0x3a57('0x2'),_0x3a57('0x3'),_0x3a57('0x4'),_0x3a57('0x5'),'online',_0x3a57('0x6'),_0x3a57('0x7'),_0x3a57('0x8'),_0x3a57('0x9'),_0x3a57('0xb')]},'log':_0x3a57('0x13')});}; \ No newline at end of file +var _0x240a=['UnpauseUser','getAgent','../client','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','online','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause'];(function(_0x55d6c3,_0x32e69e){var _0x26a5b1=function(_0x31cfd2){while(--_0x31cfd2){_0x55d6c3['push'](_0x55d6c3['shift']());}};_0x26a5b1(++_0x32e69e);}(_0x240a,0x1e2));var _0xa240=function(_0x203dd4,_0x1a4a8a){_0x203dd4=_0x203dd4-0x0;var _0xd2d85a=_0x240a[_0x203dd4];return _0xd2d85a;};'use strict';var client=require(_0xa240('0x0'));exports[_0xa240('0x1')]=function(){return function(){return client[_0xa240('0x2')](_0xa240('0x3'),{'options':{'raw':![],'where':{'role':_0xa240('0x4')},'attributes':['id',_0xa240('0x5'),_0xa240('0x6'),_0xa240('0x7'),_0xa240('0x8'),_0xa240('0x9'),'lastLoginAt',_0xa240('0xa'),_0xa240('0xb'),_0xa240('0xc'),_0xa240('0xd'),_0xa240('0xe'),_0xa240('0xf')]},'log':_0xa240('0x1')});};};exports[_0xa240('0x10')]=function(){return function(){return client[_0xa240('0x2')](_0xa240('0x3'),{'options':{'raw':!![],'where':{'role':_0xa240('0x11')},'attributes':['id',_0xa240('0x5'),'accountcode',_0xa240('0x12')]},'log':_0xa240('0x10')});};};exports[_0xa240('0x13')]=function(_0x5615b2,_0xe7d282,_0x3a2f89){return client['Request'](_0xa240('0x14'),{'body':{'type':_0xe7d282,'uniqueid':_0x3a2f89},'options':{'where':{'id':_0x5615b2['id']}},'log':'savePause'});};exports[_0xa240('0x15')]=function(_0x3b9edf){return client[_0xa240('0x2')](_0xa240('0x16'),{'body':{},'options':{'where':{'id':_0x3b9edf['id']}},'log':_0xa240('0x13')});};exports[_0xa240('0x17')]=function(_0x5d99df){return client[_0xa240('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':_0xa240('0x4'),'id':_0x5d99df},'attributes':['id',_0xa240('0x5'),'email',_0xa240('0x7'),_0xa240('0x8'),_0xa240('0x9'),'lastLoginAt',_0xa240('0xa'),_0xa240('0xb'),_0xa240('0xc'),'interface']},'log':_0xa240('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 0704712..8856441 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 _0x7ef9=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create','Request'];(function(_0x393ebf,_0x449e5a){var _0x5808c2=function(_0x3e132d){while(--_0x3e132d){_0x393ebf['push'](_0x393ebf['shift']());}};_0x5808c2(++_0x449e5a);}(_0x7ef9,0x13e));var _0x97ef=function(_0x300754,_0x120159){_0x300754=_0x300754-0x0;var _0x3566e0=_0x7ef9[_0x300754];return _0x3566e0;};'use strict';var client=require('../client');exports[_0x97ef('0x0')]=function(_0x52ac5c){return client[_0x97ef('0x1')]('CreateVoiceAgentReport',{'body':_0x52ac5c,'log':_0x97ef('0x2')});};exports[_0x97ef('0x3')]=function(_0x13ce16,_0x5e8180,_0x23c802){return client[_0x97ef('0x1')](_0x97ef('0x4'),{'body':_0x13ce16,'options':{'where':{'uniqueid':_0x5e8180,'interface':_0x23c802,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x5d66=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x48381d,_0x4ee067){var _0x1431d3=function(_0x492d96){while(--_0x492d96){_0x48381d['push'](_0x48381d['shift']());}};_0x1431d3(++_0x4ee067);}(_0x5d66,0x109));var _0x65d6=function(_0x2bdef5,_0x4e51e3){_0x2bdef5=_0x2bdef5-0x0;var _0x4fd352=_0x5d66[_0x2bdef5];return _0x4fd352;};'use strict';var client=require(_0x65d6('0x0'));exports['create']=function(_0x1aeb63){return client[_0x65d6('0x1')](_0x65d6('0x2'),{'body':_0x1aeb63,'log':_0x65d6('0x2')});};exports[_0x65d6('0x3')]=function(_0x4aa8dd,_0x3fe6f4,_0x515c77){return client[_0x65d6('0x1')](_0x65d6('0x4'),{'body':_0x4aa8dd,'options':{'where':{'uniqueid':_0x3fe6f4,'interface':_0x515c77,'agentcomplete':!![]}},'log':_0x65d6('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 68f4738..4f6836d 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 _0xace7=['startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','outbound'];(function(_0x514582,_0x4cd39a){var _0x1fe535=function(_0x3718fe){while(--_0x3718fe){_0x514582['push'](_0x514582['shift']());}};_0x1fe535(++_0x4cd39a);}(_0xace7,0x195));var _0x7ace=function(_0x2215d2,_0x563782){_0x2215d2=_0x2215d2-0x0;var _0x2bb13a=_0xace7[_0x2215d2];return _0x2bb13a;};'use strict';var moment=require(_0x7ace('0x0'));var util=require(_0x7ace('0x1'));var _=require(_0x7ace('0x2'));var client=require(_0x7ace('0x3'));exports[_0x7ace('0x4')]=function(_0x350a80){return client[_0x7ace('0x5')](_0x7ace('0x6'),{'body':_[_0x7ace('0x7')](_0x350a80,{'source':_0x350a80[_0x7ace('0x8')],'destinationcontext':_0x350a80[_0x7ace('0x9')],'callerid':_0x350a80['callerid'],'amaflags':_0x7ace('0xa')}),'log':_0x7ace('0x6')});};exports[_0x7ace('0xb')]=function(){return function(){return client[_0x7ace('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x7ace('0xc')],'createdAt':{'$between':[moment()[_0x7ace('0xd')](_0x7ace('0xe'))[_0x7ace('0xf')](_0x7ace('0x10')),moment()['endOf']('day')['format'](_0x7ace('0x10'))]}},'attributes':[_0x7ace('0x11'),_0x7ace('0x12'),_0x7ace('0x13'),_0x7ace('0x14')]},'log':_0x7ace('0x15')});};}; \ No newline at end of file +var _0xd5e3=['outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','duration','GetVoiceCallReports','moment','../client','create','Request','merge','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport'];(function(_0x2798b4,_0x3847be){var _0x343d38=function(_0xcc7b18){while(--_0xcc7b18){_0x2798b4['push'](_0x2798b4['shift']());}};_0x343d38(++_0x3847be);}(_0xd5e3,0x128));var _0x3d5e=function(_0x1d2586,_0x5f5bf9){_0x1d2586=_0x1d2586-0x0;var _0x58f7e1=_0xd5e3[_0x1d2586];return _0x58f7e1;};'use strict';var moment=require(_0x3d5e('0x0'));var util=require('util');var _=require('lodash');var client=require(_0x3d5e('0x1'));exports[_0x3d5e('0x2')]=function(_0x597c5f){return client[_0x3d5e('0x3')]('CreateVoiceCallReport',{'body':_[_0x3d5e('0x4')](_0x597c5f,{'source':_0x597c5f['calleridnum'],'destinationcontext':_0x597c5f['context'],'callerid':_0x597c5f[_0x3d5e('0x5')],'amaflags':_0x3d5e('0x6')}),'log':_0x3d5e('0x7')});};exports[_0x3d5e('0x8')]=function(){return function(){return client[_0x3d5e('0x3')](_0x3d5e('0x9'),{'options':{'where':{'type':[_0x3d5e('0xa')],'createdAt':{'$between':[moment()[_0x3d5e('0xb')](_0x3d5e('0xc'))[_0x3d5e('0xd')](_0x3d5e('0xe')),moment()[_0x3d5e('0xf')](_0x3d5e('0xc'))[_0x3d5e('0xd')](_0x3d5e('0xe'))]}},'attributes':['type','disposition',_0x3d5e('0x10'),'billableseconds']},'log':_0x3d5e('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index e88fa22..04be25a 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 _0xee52=['../client','create','Request','CreateVoiceDialReport'];(function(_0xf9b28f,_0x560889){var _0x1d5dfc=function(_0x2be6e0){while(--_0x2be6e0){_0xf9b28f['push'](_0xf9b28f['shift']());}};_0x1d5dfc(++_0x560889);}(_0xee52,0xc0));var _0x2ee5=function(_0x51617d,_0x3a3685){_0x51617d=_0x51617d-0x0;var _0x120b53=_0xee52[_0x51617d];return _0x120b53;};'use strict';var client=require(_0x2ee5('0x0'));exports[_0x2ee5('0x1')]=function(_0x2d48a8){return client[_0x2ee5('0x2')]('CreateVoiceDialReport',{'body':_0x2d48a8,'log':_0x2ee5('0x3')});}; \ No newline at end of file +var _0xb393=['../client','CreateVoiceDialReport'];(function(_0x1eb89e,_0x3de126){var _0x1d3032=function(_0x280a80){while(--_0x280a80){_0x1eb89e['push'](_0x1eb89e['shift']());}};_0x1d3032(++_0x3de126);}(_0xb393,0xca));var _0x3b39=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb393[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x3b39('0x0'));exports['create']=function(_0x3c21ad){return client['Request'](_0x3b39('0x1'),{'body':_0x3c21ad,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 94284f7..17504a7 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 _0x3a5d=['getVoiceExtensions','../client','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x3d7c6d,_0x4a6b57){var _0x465da2=function(_0x4c420b){while(--_0x4c420b){_0x3d7c6d['push'](_0x3d7c6d['shift']());}};_0x465da2(++_0x4a6b57);}(_0x3a5d,0x193));var _0xd3a5=function(_0x6295cf,_0x13ad24){_0x6295cf=_0x6295cf-0x0;var _0x34b304=_0x3a5d[_0x6295cf];return _0x34b304;};'use strict';var client=require(_0xd3a5('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xd3a5('0x1')](_0xd3a5('0x2'),{'options':{'raw':!![],'attributes':['id',_0xd3a5('0x3'),_0xd3a5('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xd3a5('0x5')});};}; \ No newline at end of file +var _0x62ff=['../client','getVoiceExtensions','GetVoiceExtension','exten','recordingFormat'];(function(_0x4a44b8,_0xd09da0){var _0x39a190=function(_0x1a4813){while(--_0x1a4813){_0x4a44b8['push'](_0x4a44b8['shift']());}};_0x39a190(++_0xd09da0);}(_0x62ff,0x1e5));var _0xf62f=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x62ff[_0x5ddaac];return _0x2a9c58;};'use strict';var client=require(_0xf62f('0x0'));exports[_0xf62f('0x1')]=function(){return function(){return client['Request'](_0xf62f('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf62f('0x3'),_0xf62f('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xf62f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index a520d44..0db447f 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 _0xe54b=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval'];(function(_0x4dfb68,_0x4ccb8e){var _0x13fe59=function(_0x822119){while(--_0x822119){_0x4dfb68['push'](_0x4dfb68['shift']());}};_0x13fe59(++_0x4ccb8e);}(_0xe54b,0xb9));var _0xbe54=function(_0x3a84aa,_0x74bf06){_0x3a84aa=_0x3a84aa-0x0;var _0x5a0cde=_0xe54b[_0x3a84aa];return _0x5a0cde;};'use strict';var client=require(_0xbe54('0x0'));exports[_0xbe54('0x1')]=function(){return function(){return client['Request'](_0xbe54('0x2'),{'options':{'raw':![],'attributes':['id',_0xbe54('0x3'),_0xbe54('0x4'),_0xbe54('0x5'),_0xbe54('0x6'),_0xbe54('0x7'),_0xbe54('0x8'),_0xbe54('0x9'),'dialMethod',_0xbe54('0xa'),_0xbe54('0xb'),_0xbe54('0xc'),_0xbe54('0xd'),_0xbe54('0xe'),_0xbe54('0xf'),_0xbe54('0x10'),_0xbe54('0x11'),_0xbe54('0x12'),_0xbe54('0x13'),'dialQueueTimeout',_0xbe54('0x14'),_0xbe54('0x15'),_0xbe54('0x16'),_0xbe54('0x17'),_0xbe54('0x18'),_0xbe54('0x19'),_0xbe54('0x1a'),_0xbe54('0x1b'),_0xbe54('0x1c'),'dialGlobalInterval',_0xbe54('0x1d'),'dialCheckDuplicateType','dialAMDActive',_0xbe54('0x1e'),_0xbe54('0x1f'),_0xbe54('0x20'),'dialAMDTotalAnalysisTime',_0xbe54('0x21'),_0xbe54('0x22'),_0xbe54('0x23'),_0xbe54('0x24'),_0xbe54('0x25'),'timeout',_0xbe54('0x26'),_0xbe54('0x27'),_0xbe54('0x28'),_0xbe54('0x29'),_0xbe54('0x2a'),_0xbe54('0x2b'),'monitor_format',_0xbe54('0x2c'),_0xbe54('0x2d'),'dialCutDigit',_0xbe54('0x2e'),_0xbe54('0x2f'),'dialDropMaxRetry',_0xbe54('0x30'),_0xbe54('0x31'),_0xbe54('0x32'),_0xbe54('0x33'),_0xbe54('0x34'),_0xbe54('0x35'),_0xbe54('0x36'),_0xbe54('0x37'),_0xbe54('0x38'),_0xbe54('0x39')],'include':[{'model':_0xbe54('0x3a'),'as':_0xbe54('0x3a'),'attributes':['id','name',_0xbe54('0x3b'),_0xbe54('0x3c')]},{'model':_0xbe54('0x3d'),'as':_0xbe54('0x3e'),'attributes':['id',_0xbe54('0x3')]},{'model':_0xbe54('0x3a'),'as':_0xbe54('0x3f'),'attributes':['id',_0xbe54('0x3'),_0xbe54('0x3b'),'active']},{'model':_0xbe54('0x40'),'as':_0xbe54('0x40'),'attributes':['id','name'],'include':[{'model':_0xbe54('0x40'),'as':_0xbe54('0x41'),'attributes':['id',_0xbe54('0x3'),_0xbe54('0x42')]}]}]},'log':_0xbe54('0x1')});};}; \ No newline at end of file +var _0x5a5a=['dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialNoAnswerRetryFrequency'];(function(_0x2305f1,_0x478cfc){var _0x384773=function(_0x4bd1b7){while(--_0x4bd1b7){_0x2305f1['push'](_0x2305f1['shift']());}};_0x384773(++_0x478cfc);}(_0x5a5a,0x65));var _0xa5a5=function(_0x2c1de0,_0x4fc4e3){_0x2c1de0=_0x2c1de0-0x0;var _0x208965=_0x5a5a[_0x2c1de0];return _0x208965;};'use strict';var client=require(_0xa5a5('0x0'));exports[_0xa5a5('0x1')]=function(){return function(){return client[_0xa5a5('0x2')](_0xa5a5('0x3'),{'options':{'raw':![],'attributes':['id',_0xa5a5('0x4'),_0xa5a5('0x5'),_0xa5a5('0x6'),_0xa5a5('0x7'),_0xa5a5('0x8'),_0xa5a5('0x9'),'dialActive',_0xa5a5('0xa'),_0xa5a5('0xb'),'dialLimitQueue','dialPowerLevel',_0xa5a5('0xc'),_0xa5a5('0xd'),_0xa5a5('0xe'),_0xa5a5('0xf'),_0xa5a5('0x10'),_0xa5a5('0x11'),_0xa5a5('0x12'),_0xa5a5('0x13'),_0xa5a5('0x14'),'dialCongestionMaxRetry',_0xa5a5('0x15'),'dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0xa5a5('0x16'),_0xa5a5('0x17'),_0xa5a5('0x18'),_0xa5a5('0x19'),_0xa5a5('0x1a'),_0xa5a5('0x1b'),_0xa5a5('0x1c'),_0xa5a5('0x1d'),_0xa5a5('0x1e'),_0xa5a5('0x1f'),_0xa5a5('0x20'),_0xa5a5('0x21'),'dialAMDBetweenWordsSilence',_0xa5a5('0x22'),_0xa5a5('0x23'),_0xa5a5('0x24'),_0xa5a5('0x25'),_0xa5a5('0x26'),_0xa5a5('0x27'),_0xa5a5('0x28'),_0xa5a5('0x29'),'dialAgiAfterHangupClient',_0xa5a5('0x2a'),_0xa5a5('0x8'),_0xa5a5('0x2b'),_0xa5a5('0x2c'),_0xa5a5('0x2d'),_0xa5a5('0x2e'),_0xa5a5('0x2f'),_0xa5a5('0x30'),_0xa5a5('0x31'),_0xa5a5('0x32'),_0xa5a5('0x33'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xa5a5('0x34'),'dialAgentRejectRetryFrequency',_0xa5a5('0x35'),_0xa5a5('0x36'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0xa5a5('0x37'),'as':_0xa5a5('0x37'),'attributes':['id',_0xa5a5('0x4'),_0xa5a5('0x38'),_0xa5a5('0x39')]},{'model':_0xa5a5('0x3a'),'as':_0xa5a5('0x3b'),'attributes':['id','name']},{'model':_0xa5a5('0x37'),'as':'TrunkBackup','attributes':['id','name',_0xa5a5('0x38'),_0xa5a5('0x39')]},{'model':'Interval','as':_0xa5a5('0x3c'),'attributes':['id',_0xa5a5('0x4')],'include':[{'model':_0xa5a5('0x3c'),'as':_0xa5a5('0x3d'),'attributes':['id',_0xa5a5('0x4'),'interval']}]}]},'log':_0xa5a5('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index ca5cedd..0c59b2e 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 _0x2fbb=['../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','day','YYYY-MM-DD\x20HH:mm:ss','format','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash'];(function(_0x231f6f,_0xf231e0){var _0xc621c4=function(_0x5c8549){while(--_0x5c8549){_0x231f6f['push'](_0x231f6f['shift']());}};_0xc621c4(++_0xf231e0);}(_0x2fbb,0xe2));var _0xb2fb=function(_0xdd3312,_0x5622bc){_0xdd3312=_0xdd3312-0x0;var _0x4a513a=_0x2fbb[_0xdd3312];return _0x4a513a;};'use strict';var moment=require(_0xb2fb('0x0'));var _=require(_0xb2fb('0x1'));var client=require(_0xb2fb('0x2'));exports['create']=function(_0x43ce60){return client[_0xb2fb('0x3')](_0xb2fb('0x4'),{'body':_0x43ce60,'log':'CreateVoiceQueueReport'});};exports[_0xb2fb('0x5')]=function(){return function(){return client[_0xb2fb('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xb2fb('0x6'))['format'](_0xb2fb('0x7')),moment()['endOf']('day')[_0xb2fb('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid',_0xb2fb('0x9'),_0xb2fb('0xa'),_0xb2fb('0xb'),_0xb2fb('0xc'),_0xb2fb('0xd'),_0xb2fb('0xe'),_0xb2fb('0xf'),_0xb2fb('0x10'),_0xb2fb('0x11')]},'log':_0xb2fb('0x12')});};}; \ No newline at end of file +var _0xa057=['queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x2725c7,_0x518341){var _0x57a630=function(_0x5dfbc7){while(--_0x5dfbc7){_0x2725c7['push'](_0x2725c7['shift']());}};_0x57a630(++_0x518341);}(_0xa057,0x123));var _0x7a05=function(_0x9ee2e0,_0x1f7a34){_0x9ee2e0=_0x9ee2e0-0x0;var _0xeaf856=_0xa057[_0x9ee2e0];return _0xeaf856;};'use strict';var moment=require(_0x7a05('0x0'));var _=require(_0x7a05('0x1'));var client=require('../client');exports[_0x7a05('0x2')]=function(_0x28ebf8){return client[_0x7a05('0x3')]('CreateVoiceQueueReport',{'body':_0x28ebf8,'log':_0x7a05('0x4')});};exports[_0x7a05('0x5')]=function(){return function(){return client['Request'](_0x7a05('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0x7a05('0x7')](_0x7a05('0x8')),moment()[_0x7a05('0x9')]('day')[_0x7a05('0x7')](_0x7a05('0x8'))]}},'attributes':[_0x7a05('0xa'),'queue',_0x7a05('0xb'),_0x7a05('0xc'),_0x7a05('0xd'),_0x7a05('0xe'),_0x7a05('0xf'),_0x7a05('0x10'),'queuecallerabandon',_0x7a05('0x11')]},'log':_0x7a05('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 51e6510..a3a478a 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 _0x371f=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x342704,_0x4c13f7){var _0x4e9c8a=function(_0xc09146){while(--_0xc09146){_0x342704['push'](_0x342704['shift']());}};_0x4e9c8a(++_0x4c13f7);}(_0x371f,0x169));var _0xf371=function(_0x5ad496,_0x399bf6){_0x5ad496=_0x5ad496-0x0;var _0x152285=_0x371f[_0x5ad496];return _0x152285;};'use strict';var client=require(_0xf371('0x0'));exports[_0xf371('0x1')]=function(_0x54a957){return function(){return client[_0xf371('0x2')](_0xf371('0x3'),{'options':{'where':{'VoiceQueueId':_0x54a957,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xb6ec=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x131fd1,_0x327cc1){var _0x16273c=function(_0x23c272){while(--_0x23c272){_0x131fd1['push'](_0x131fd1['shift']());}};_0x16273c(++_0x327cc1);}(_0xb6ec,0x1e7));var _0xcb6e=function(_0x215e21,_0x4d16df){_0x215e21=_0x215e21-0x0;var _0x4a2d7a=_0xb6ec[_0x215e21];return _0x4a2d7a;};'use strict';var client=require(_0xcb6e('0x0'));exports['getVoiceQueueRtPauses']=function(_0x20e046){return function(){return client[_0xcb6e('0x1')](_0xcb6e('0x2'),{'options':{'where':{'VoiceQueueId':_0x20e046,'paused':!![]},'raw':!![]},'log':_0xcb6e('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 714c07a..50348b0 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 _0xd250=['../client','create','Request','CreateVoiceRecording','merge','lodash'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd250,0x9b));var _0x0d25=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0xd250[_0x35d4e9];return _0x5c2770;};'use strict';var _=require(_0x0d25('0x0'));var client=require(_0x0d25('0x1'));exports[_0x0d25('0x2')]=function(_0x592d15){return client[_0x0d25('0x3')](_0x0d25('0x4'),{'body':_[_0x0d25('0x5')](_0x592d15,{'value':_0x592d15['monitorFilename']}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0xb289=['../client','create','CreateVoiceRecording','merge','monitorFilename'];(function(_0x3de8a2,_0x1c8615){var _0x267573=function(_0x51af8f){while(--_0x51af8f){_0x3de8a2['push'](_0x3de8a2['shift']());}};_0x267573(++_0x1c8615);}(_0xb289,0x154));var _0x9b28=function(_0x20f902,_0x4d4486){_0x20f902=_0x20f902-0x0;var _0x4d1d36=_0xb289[_0x20f902];return _0x4d1d36;};'use strict';var _=require('lodash');var client=require(_0x9b28('0x0'));exports[_0x9b28('0x1')]=function(_0x4f98f7){return client['Request'](_0x9b28('0x2'),{'body':_[_0x9b28('0x3')](_0x4f98f7,{'value':_0x4f98f7[_0x9b28('0x4')]}),'log':_0x9b28('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 670528e..2b16513 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 _0x9308=['transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x9308,0xcd));var _0x8930=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9308[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x8930('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x5e2490){return client[_0x8930('0x1')](_0x8930('0x2'),{'body':{'result':_0x5e2490['result'],'transfererchannel':_0x5e2490[_0x8930('0x3')],'transferercalleridnum':_0x5e2490[_0x8930('0x4')],'transferercalleridname':_0x5e2490[_0x8930('0x5')],'transfererconnectedlinenum':_0x5e2490['transfererconnectedlinenum'],'transfererconnectedlinename':_0x5e2490[_0x8930('0x6')],'transfereraccountcode':_0x5e2490[_0x8930('0x7')],'transferercontext':_0x5e2490[_0x8930('0x8')],'transfererexten':_0x5e2490[_0x8930('0x9')],'transfererlinkedid':_0x5e2490['transfererlinkedid'],'transfereechannel':_0x5e2490['transfereechannel'],'transfereecalleridnum':_0x5e2490[_0x8930('0xa')],'transfereecalleridname':_0x5e2490[_0x8930('0xb')],'transfereeconnectedlinenum':_0x5e2490['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5e2490['transfereeconnectedlinename'],'transfereeaccountcode':_0x5e2490[_0x8930('0xc')],'transfereecontext':_0x5e2490[_0x8930('0xd')],'transfereeexten':_0x5e2490[_0x8930('0xe')],'transfereelinkedid':_0x5e2490[_0x8930('0xf')],'isexternal':_0x5e2490[_0x8930('0x10')],'context':_0x5e2490['context'],'extension':_0x5e2490[_0x8930('0x11')],'type':_0x8930('0x12')},'log':'CreateVoiceTransferReport'});};exports[_0x8930('0x13')]=function(_0x3c820d){return client[_0x8930('0x1')](_0x8930('0x2'),{'body':{'result':_0x3c820d[_0x8930('0x14')],'transfererchannel':_0x3c820d[_0x8930('0x15')],'transferercalleridnum':_0x3c820d[_0x8930('0x16')],'transferercalleridname':_0x3c820d['origtransferercalleridname'],'transfererconnectedlinenum':_0x3c820d[_0x8930('0x17')],'transfererconnectedlinename':_0x3c820d[_0x8930('0x18')],'transfereraccountcode':_0x3c820d[_0x8930('0x19')],'transferercontext':_0x3c820d['secondtransferercontext'],'transfererexten':_0x3c820d[_0x8930('0x1a')],'transfererlinkedid':_0x3c820d[_0x8930('0x1b')],'transfereechannel':_0x3c820d[_0x8930('0x1c')],'transfereecalleridnum':_0x3c820d['transfertargetcalleridnum'],'transfereecalleridname':_0x3c820d[_0x8930('0x1d')],'transfereeconnectedlinenum':_0x3c820d[_0x8930('0x1e')],'transfereeconnectedlinename':_0x3c820d[_0x8930('0x1f')],'transfereeaccountcode':_0x3c820d[_0x8930('0x20')],'transfereecontext':_0x3c820d[_0x8930('0x21')],'transfereeexten':_0x3c820d[_0x8930('0x22')],'transfereelinkedid':_0x3c820d[_0x8930('0x23')],'isexternal':_0x3c820d['isexternal'],'context':_0x3c820d[_0x8930('0x24')],'extension':_0x3c820d[_0x8930('0x25')],'type':_0x8930('0x26')},'log':_0x8930('0x2')});}; \ No newline at end of file +var _0xfcf5=['transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','result','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname'];(function(_0x26779a,_0x565d54){var _0x3a40ec=function(_0x2663f0){while(--_0x2663f0){_0x26779a['push'](_0x26779a['shift']());}};_0x3a40ec(++_0x565d54);}(_0xfcf5,0xd0));var _0x5fcf=function(_0x362dc0,_0x1945af){_0x362dc0=_0x362dc0-0x0;var _0x2ad659=_0xfcf5[_0x362dc0];return _0x2ad659;};'use strict';var client=require(_0x5fcf('0x0'));exports['transfers']={};exports[_0x5fcf('0x1')]=function(_0x52a465){return client[_0x5fcf('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x52a465[_0x5fcf('0x3')],'transfererchannel':_0x52a465['transfererchannel'],'transferercalleridnum':_0x52a465['transferercalleridnum'],'transferercalleridname':_0x52a465[_0x5fcf('0x4')],'transfererconnectedlinenum':_0x52a465[_0x5fcf('0x5')],'transfererconnectedlinename':_0x52a465['transfererconnectedlinename'],'transfereraccountcode':_0x52a465[_0x5fcf('0x6')],'transferercontext':_0x52a465[_0x5fcf('0x7')],'transfererexten':_0x52a465[_0x5fcf('0x8')],'transfererlinkedid':_0x52a465['transfererlinkedid'],'transfereechannel':_0x52a465[_0x5fcf('0x9')],'transfereecalleridnum':_0x52a465[_0x5fcf('0xa')],'transfereecalleridname':_0x52a465[_0x5fcf('0xb')],'transfereeconnectedlinenum':_0x52a465[_0x5fcf('0xc')],'transfereeconnectedlinename':_0x52a465[_0x5fcf('0xd')],'transfereeaccountcode':_0x52a465[_0x5fcf('0xe')],'transfereecontext':_0x52a465[_0x5fcf('0xf')],'transfereeexten':_0x52a465[_0x5fcf('0x10')],'transfereelinkedid':_0x52a465[_0x5fcf('0x11')],'isexternal':_0x52a465[_0x5fcf('0x12')],'context':_0x52a465[_0x5fcf('0x13')],'extension':_0x52a465[_0x5fcf('0x14')],'type':_0x5fcf('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0x5fcf('0x16')]=function(_0x1754c2){return client[_0x5fcf('0x2')](_0x5fcf('0x17'),{'body':{'result':_0x1754c2[_0x5fcf('0x3')],'transfererchannel':_0x1754c2[_0x5fcf('0x18')],'transferercalleridnum':_0x1754c2[_0x5fcf('0x19')],'transferercalleridname':_0x1754c2[_0x5fcf('0x1a')],'transfererconnectedlinenum':_0x1754c2[_0x5fcf('0x1b')],'transfererconnectedlinename':_0x1754c2[_0x5fcf('0x1c')],'transfereraccountcode':_0x1754c2[_0x5fcf('0x1d')],'transferercontext':_0x1754c2[_0x5fcf('0x1e')],'transfererexten':_0x1754c2['secondtransfererexten'],'transfererlinkedid':_0x1754c2[_0x5fcf('0x1f')],'transfereechannel':_0x1754c2[_0x5fcf('0x20')],'transfereecalleridnum':_0x1754c2[_0x5fcf('0x21')],'transfereecalleridname':_0x1754c2[_0x5fcf('0x22')],'transfereeconnectedlinenum':_0x1754c2[_0x5fcf('0x23')],'transfereeconnectedlinename':_0x1754c2[_0x5fcf('0x24')],'transfereeaccountcode':_0x1754c2[_0x5fcf('0x25')],'transfereecontext':_0x1754c2[_0x5fcf('0x26')],'transfereeexten':_0x1754c2[_0x5fcf('0x27')],'transfereelinkedid':_0x1754c2[_0x5fcf('0x28')],'isexternal':_0x1754c2[_0x5fcf('0x12')],'context':_0x1754c2[_0x5fcf('0x29')],'extension':_0x1754c2[_0x5fcf('0x2a')],'type':_0x5fcf('0x2b')},'log':_0x5fcf('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index a57838e..dfffa9d 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 _0x7788=['status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','find','stop','%s.%s','StopMixMonitor\x20Success','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','context','trunks','outboundChannels','outbound','campaigns','run','emit','custom:','faxAccounts','send','checkAfterSend','server','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../properties','../ami','listen','format','SIP','name','timers','timer','updateAcw','agents','QueuePause','isConnected','error','asterisk','join','pick','module','then','catch','username','action','Command','Action','content','hasOwnProperty','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','ami\x20disconnected','voicechannel','map','uniqueid','filename','wav','MixMonitor','channel','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid'];(function(_0x4df912,_0x4a3d9f){var _0x3438fb=function(_0x1163f9){while(--_0x1163f9){_0x4df912['push'](_0x4df912['shift']());}};_0x3438fb(++_0x4a3d9f);}(_0x7788,0xa3));var _0x8778=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0x7788[_0x5ce15c];return _0x36e4f5;};'use strict';var _=require(_0x8778('0x0'));var util=require(_0x8778('0x1'));var jayson=require(_0x8778('0x2'));var schema=require(_0x8778('0x3'));var BPromise=require(_0x8778('0x4'));var moment=require(_0x8778('0x5'));var config=require('../../../config/environment');var properties=require(_0x8778('0x6'));var ami=require(_0x8778('0x7'));exports[_0x8778('0x8')]=function(_0x5777a6,_0x245a92,_0x40d608){return new BPromise(function(_0x39f6a8,_0x29fa8f){var _0xc023f5={'QueuePause':function(_0x31cd9a){return new Promise(function(_0x1cdabe,_0x22c2a1){var _0x4805b1=util[_0x8778('0x9')]('%s/%s',_0x8778('0xa'),_0x31cd9a[_0x8778('0xb')]);if(_0x5777a6[_0x8778('0xc')]&&_0x5777a6[_0x8778('0xc')][_0x4805b1]&&_0x5777a6[_0x8778('0xc')][_0x4805b1][_0x8778('0xd')]){_0x5777a6[_0x8778('0xc')][_0x4805b1][_0x8778('0xe')]();}if(_0x5777a6['agents'][_0x4805b1]){_0x5777a6[_0x8778('0xf')][_0x4805b1]['updateStatusRealtime']({'statePause':_0x31cd9a['pause']?!![]:![]});}_0x1cdabe({'code':0xc8,'message':_0x8778('0x10')});});},'Reload':function(_0x5b907a){var _0x5c806a=this;return new Promise(function(_0x33981f,_0x470d0f){if(ami[_0x8778('0x11')]()==![]){return _0x470d0f(_0x5c806a[_0x8778('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x8778('0x13')]['username'],'ami\x20disconnected'][_0x8778('0x14')]('\x20')));}_0x5b907a=_[_0x8778('0x15')](_0x5b907a,_['keys'](properties[_0x8778('0x16')]));_0x5b907a['action']='Reload';return ami['Action'](_0x5b907a)[_0x8778('0x17')](function(_0x5bdab3){_0x33981f({'code':0xc8,'message':_0x5bdab3['message']});})[_0x8778('0x18')](function(_0x133375){_0x470d0f(_0x5c806a[_0x8778('0x12')](0x1f5,_0x133375['message']));});});},'Command':function(_0x443ed4){var _0x205aae=this;return new Promise(function(_0x5939d2,_0x2a0ba5){if(ami[_0x8778('0x11')]()==![]){return _0x2a0ba5(_0x205aae[_0x8778('0x12')](0x1f4,[config[_0x8778('0x13')]['ip'],config[_0x8778('0x13')][_0x8778('0x19')],'ami\x20disconnected']['join']('\x20')));}_0x443ed4=_[_0x8778('0x15')](_0x443ed4,'command');_0x443ed4[_0x8778('0x1a')]=_0x8778('0x1b');return ami[_0x8778('0x1c')](_0x443ed4)[_0x8778('0x17')](function(_0x10aa3e){_0x5939d2({'code':0xc8,'message':_0x10aa3e[_0x8778('0x1d')]});})[_0x8778('0x18')](function(_0x10d5be){_0x2a0ba5(_0x205aae['error'](0x1f5,_0x10d5be['message']));});});},'VoiceQueues':function(_0x364262){return new Promise(function(_0x17b985,_0x4fed63){var _0x2583db=[];for(var _0x19551e in _0x5777a6['voiceQueues']){if(_0x5777a6['voiceQueues'][_0x8778('0x1e')](_0x19551e)){var _0xba5c14=_0x5777a6[_0x8778('0x1f')][_0x19551e];var _0x5740a8={'id':_0xba5c14['id'],'name':_0xba5c14['name'],'strategy':_0xba5c14[_0x8778('0x20')],'answered':_0xba5c14[_0x8778('0x21')],'available':_0xba5c14[_0x8778('0x22')],'loggedIn':_0xba5c14[_0x8778('0x23')],'pTalking':_0xba5c14[_0x8778('0x24')],'sumBillable':_0xba5c14[_0x8778('0x25')],'sumDuration':_0xba5c14['sumDuration'],'sumHoldTime':_0xba5c14[_0x8778('0x26')]||0x0,'talking':_0xba5c14[_0x8778('0x27')],'total':_0xba5c14[_0x8778('0x28')],'type':_0xba5c14[_0x8778('0x29')],'unmanaged':_0xba5c14['unmanaged'],'abandoned':_0xba5c14[_0x8778('0x2a')],'waiting':_0xba5c14[_0x8778('0x2b')],'loggedInDb':_0xba5c14[_0x8778('0x2c')]};if(_0xba5c14[_0x8778('0x29')]==='outbound'){_0x5740a8[_0x8778('0x2d')]=_0xba5c14[_0x8778('0x2d')];_0x5740a8[_0x8778('0x2e')]=_0xba5c14[_0x8778('0x2e')];_0x5740a8[_0x8778('0x2f')]=_0xba5c14[_0x8778('0x2f')];_0x5740a8[_0x8778('0x30')]=_0xba5c14['dialOriginateCallerIdNumber'];_0x5740a8['dialOriginateTimeout']=_0xba5c14[_0x8778('0x31')];_0x5740a8['dialPrefix']=_0xba5c14[_0x8778('0x32')];_0x5740a8['outboundAnswerAgiCallsDay']=_0xba5c14['outboundAnswerAgiCallsDay'];_0x5740a8[_0x8778('0x33')]=_0xba5c14[_0x8778('0x33')];_0x5740a8['outboundBlacklistCallsDay']=_0xba5c14[_0x8778('0x34')];_0x5740a8[_0x8778('0x35')]=_0xba5c14[_0x8778('0x35')];_0x5740a8[_0x8778('0x36')]=_0xba5c14[_0x8778('0x36')];_0x5740a8[_0x8778('0x37')]=_0xba5c14[_0x8778('0x37')];_0x5740a8['outboundDropCallsDayCallersExit']=_0xba5c14['outboundDropCallsDayCallersExit'];_0x5740a8[_0x8778('0x38')]=_0xba5c14[_0x8778('0x38')];_0x5740a8[_0x8778('0x39')]=_0xba5c14[_0x8778('0x39')];_0x5740a8[_0x8778('0x3a')]=_0xba5c14[_0x8778('0x3a')];_0x5740a8['outboundOriginateFailureCallsDay']=_0xba5c14[_0x8778('0x3b')];_0x5740a8['outboundReCallsDay']=_0xba5c14[_0x8778('0x3c')];_0x5740a8['outboundRejectCallsDay']=_0xba5c14[_0x8778('0x3d')];_0x5740a8[_0x8778('0x3e')]=_0xba5c14['outboundUnknownCallsDay'];_0x5740a8[_0x8778('0x3f')]=_0xba5c14[_0x8778('0x3f')];_0x5740a8[_0x8778('0x40')]=_0xba5c14['predictiveIntervalAvgHoldtime'];_0x5740a8[_0x8778('0x41')]=_0xba5c14[_0x8778('0x41')];_0x5740a8[_0x8778('0x42')]=_0xba5c14[_0x8778('0x42')];_0x5740a8['predictiveIntervalDroppedCallsTimeout']=_0xba5c14[_0x8778('0x43')];_0x5740a8[_0x8778('0x44')]=_0xba5c14[_0x8778('0x44')];_0x5740a8[_0x8778('0x45')]=_0xba5c14[_0x8778('0x45')];_0x5740a8[_0x8778('0x46')]=_0xba5c14[_0x8778('0x46')];_0x5740a8['predictiveIntervalMultiplicativeFactor']=_0xba5c14[_0x8778('0x47')];_0x5740a8[_0x8778('0x48')]=_0xba5c14[_0x8778('0x48')];_0x5740a8[_0x8778('0x49')]=_0xba5c14['predictiveIntervalAvailable'];_0x5740a8[_0x8778('0x4a')]=_0xba5c14[_0x8778('0x4a')];_0x5740a8[_0x8778('0x4b')]=_0xba5c14[_0x8778('0x4b')];_0x5740a8[_0x8778('0x4c')]=_0xba5c14[_0x8778('0x4c')];_0x5740a8[_0x8778('0x4d')]=_0xba5c14[_0x8778('0x4d')];_0x5740a8[_0x8778('0x4e')]=_0xba5c14[_0x8778('0x4e')];_0x5740a8[_0x8778('0x4f')]=_0xba5c14[_0x8778('0x4f')];_0x5740a8[_0x8778('0x50')]=_0xba5c14['erlangBusyFactor'];_0x5740a8[_0x8778('0x51')]=_0xba5c14[_0x8778('0x51')];_0x5740a8[_0x8778('0x52')]=_0xba5c14[_0x8778('0x52')];}if(_0xba5c14['Trunk']){_0x5740a8[_0x8778('0x53')]={'id':_0xba5c14[_0x8778('0x53')]['id'],'name':_0xba5c14[_0x8778('0x53')][_0x8778('0xb')],'active':_0xba5c14[_0x8778('0x53')][_0x8778('0x54')],'callerid':_0xba5c14[_0x8778('0x53')][_0x8778('0x55')]};}if(_0xba5c14['Interval']){_0x5740a8[_0x8778('0x56')]={'id':_0xba5c14[_0x8778('0x56')]['id'],'name':_0xba5c14[_0x8778('0x56')][_0x8778('0xb')]};}_0x2583db[_0x8778('0x57')](_0x5740a8);}}_0x17b985({'count':_0x2583db[_0x8778('0x58')],'rows':_0x2583db});});},'VoiceChannels':function(_0x26f4ac){return new Promise(function(_0x52c571,_0xe5abef){var _0x20b09c=_[_0x8778('0x59')](_0x5777a6[_0x8778('0x5a')]);_0x52c571({'count':_0x20b09c[_0x8778('0x58')],'rows':_0x20b09c});});},'VoiceChannelMixMonitor':function(_0x37d5d0){var _0x13ec3e=this;return new Promise(function(_0xc4cd81,_0x2b07ed){if(ami[_0x8778('0x11')]()==![]){return _0x2b07ed(_0x13ec3e['error'](0x1f4,[config['asterisk']['ip'],config[_0x8778('0x13')]['username'],_0x8778('0x5b')][_0x8778('0x14')]('\x20')));}var _0x404fa9=schema(properties[_0x8778('0x5c')])[_0x8778('0x3')](_0x37d5d0);if(_0x404fa9[_0x8778('0x58')]>0x0){return _0x2b07ed(_0x13ec3e[_0x8778('0x12')](0x1f4,_[_0x8778('0x5d')](_0x404fa9,_0x8778('0x4b'))[_0x8778('0x14')](',\x20')));}var _0x506472=_['find'](_0x5777a6[_0x8778('0x5a')],{'uniqueid':_0x37d5d0[_0x8778('0x5e')]});if(_0x506472&&_0x506472['channel']){var _0x430fe8=util['format']('%s.%s',_0x37d5d0[_0x8778('0x5f')]||_0x37d5d0[_0x8778('0x5e')],_0x37d5d0[_0x8778('0x9')]||_0x8778('0x60'));return ami[_0x8778('0x1c')]({'action':_0x8778('0x61'),'channel':_0x506472[_0x8778('0x62')],'file':_0x430fe8,'options':'ai(mixmonitorid)'})[_0x8778('0x17')](function(_0x2c3160){var _0x39df04=_['find'](_0x506472[_0x8778('0x63')],{'filename':'/var/spool/asterisk/monitor/'+_0x430fe8[_0x8778('0x64')]()});if(_[_0x8778('0x65')](_0x39df04)){_0x506472[_0x8778('0x63')][_0x8778('0x57')]({'filename':_0x8778('0x66')+_0x430fe8['toLowerCase'](),'createdAt':moment()['format'](_0x8778('0x67')),'mixmonitorid':_0x2c3160[_0x8778('0x68')],'status':'rec'});}else{_0x39df04['mixmonitorid']=_0x2c3160[_0x8778('0x68')];_0x39df04[_0x8778('0x69')]=_0x8778('0x6a');}_0xc4cd81({'code':0xc8,'message':[_0x37d5d0[_0x8778('0x5e')],_0x8778('0x6b'),_0x2c3160[_0x8778('0x68')]][_0x8778('0x14')]('\x20'),'mixmonitorid':_0x2c3160[_0x8778('0x68')]});})[_0x8778('0x18')](function(_0x583d70){_0x2b07ed(_0x13ec3e[_0x8778('0x12')](0x1f5,[_0x37d5d0[_0x8778('0x5e')],_0x583d70[_0x8778('0x4b')][_0x8778('0x64')]()][_0x8778('0x14')]('\x20')));});}else{return _0x2b07ed(_0x13ec3e[_0x8778('0x12')](0x1f5,_0x8778('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x3cfbea){var _0x1a62b6=this;return new Promise(function(_0x42fc4b,_0x52f18b){if(ami[_0x8778('0x11')]()==![]){return _0x52f18b(_0x1a62b6['error'](0x1f4,[config[_0x8778('0x13')]['ip'],config['asterisk'][_0x8778('0x19')],_0x8778('0x5b')][_0x8778('0x14')]('\x20')));}var _0x73affe=schema(properties[_0x8778('0x5c')])[_0x8778('0x3')](_0x3cfbea);if(_0x73affe[_0x8778('0x58')]>0x0){return _0x52f18b(_0x1a62b6[_0x8778('0x12')](0x1f4,_['map'](_0x73affe,_0x8778('0x4b'))[_0x8778('0x14')](',\x20')));}var _0x5d69be=_['find'](_0x5777a6['channels'],{'uniqueid':_0x3cfbea[_0x8778('0x5e')]});if(_0x5d69be){return BPromise[_0x8778('0x6d')]()[_0x8778('0x17')](function(){if(_0x5d69be[_0x8778('0x62')]){return ami[_0x8778('0x1c')]({'action':'StopMixMonitor','channel':_0x5d69be[_0x8778('0x62')],'mixmonitorid':_0x3cfbea[_0x8778('0x68')]})[_0x8778('0x18')](function(_0x388534){});}})['then'](function(){if(_0x5d69be[_0x8778('0x6e')]){return ami[_0x8778('0x1c')]({'action':'StopMixMonitor','channel':_0x5d69be[_0x8778('0x6e')],'mixmonitorid':_0x3cfbea[_0x8778('0x68')]})[_0x8778('0x18')](function(_0x4866bf){});}})[_0x8778('0x17')](function(_0x23d3f2){var _0x9c5d87=_[_0x8778('0x6f')](_0x5d69be[_0x8778('0x63')],{'mixmonitorid':_0x3cfbea[_0x8778('0x68')]});if(_0x9c5d87){_0x9c5d87[_0x8778('0x69')]=_0x8778('0x70');}})[_0x8778('0x17')](function(){var _0x29132d=util[_0x8778('0x9')](_0x8778('0x71'),_0x3cfbea['filename']||_0x3cfbea[_0x8778('0x5e')],_0x3cfbea[_0x8778('0x9')]||_0x8778('0x60'));var _0x10a719=_[_0x8778('0x6f')](_0x5d69be['monitors'],{'filename':_0x8778('0x66')+_0x29132d[_0x8778('0x64')]()});if(_0x10a719){_0x10a719[_0x8778('0x69')]=_0x8778('0x70');}})[_0x8778('0x17')](function(){_0x42fc4b({'code':0xc8,'message':[_0x3cfbea[_0x8778('0x5e')],_0x8778('0x72')][_0x8778('0x14')]('\x20')});})[_0x8778('0x18')](function(_0x5889cc){_0x52f18b(_0x1a62b6[_0x8778('0x12')](0x1f5,[_0x3cfbea[_0x8778('0x5e')],_0x5889cc[_0x8778('0x4b')][_0x8778('0x64')]()]['join']('\x20')));});}else{return _0x52f18b(_0x1a62b6[_0x8778('0x12')](0x1f5,_0x8778('0x6c')));}});},'VoiceQueuesChannels':function(_0x1f31a0){return new Promise(function(_0x951f6,_0x1d7d96){var _0x1b4348=_[_0x8778('0x59')](_0x5777a6['queueChannels']);_0x951f6({'count':_0x1b4348[_0x8778('0x58')],'rows':_0x1b4348});});},'VoiceQueuesChannel':function(_0x1940fb){var _0x54c0e0=this;return new Promise(function(_0x2b0dc1,_0x11f744){var _0x426d4a=schema(properties[_0x8778('0x73')])[_0x8778('0x3')](_0x1940fb);if(_0x426d4a[_0x8778('0x58')]>0x0){return _0x11f744(_0x54c0e0[_0x8778('0x12')](0x1f4,_[_0x8778('0x5d')](_0x426d4a,_0x8778('0x4b'))[_0x8778('0x14')](',\x20')));}var _0x51620a=_[_0x8778('0x6f')](_0x5777a6['queueChannels'],{'uniqueid':_0x1940fb[_0x8778('0x5e')]});if(_0x51620a){_0x2b0dc1(_0x51620a);}else{return _0x11f744(_0x54c0e0[_0x8778('0x12')](0x1f5,_0x8778('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0xd87a0b){var _0x46df5d=this;return new Promise(function(_0xdaa21,_0x5e9235){if(ami[_0x8778('0x11')]()==![]){return _0x5e9235(_0x46df5d[_0x8778('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x8778('0x13')][_0x8778('0x19')],_0x8778('0x5b')][_0x8778('0x14')]('\x20')));}var _0x13108f=schema(properties[_0x8778('0x74')])[_0x8778('0x3')](_0xd87a0b);if(_0x13108f[_0x8778('0x58')]>0x0){return _0x5e9235(_0x46df5d[_0x8778('0x12')](0x1f4,_[_0x8778('0x5d')](_0x13108f,'message')[_0x8778('0x14')](',\x20')));}var _0x218f9e=_['find'](_0x5777a6['queueChannels'],{'uniqueid':_0xd87a0b[_0x8778('0x5e')]});if(_0x218f9e&&_0x218f9e['channel']){return ami['Action']({'action':_0x8778('0x75'),'channel':_0x218f9e['channel']})[_0x8778('0x17')](function(_0x435264){_0xdaa21({'code':0xc8,'message':[_0xd87a0b[_0x8778('0x5e')],_0x435264['message'][_0x8778('0x64')]()][_0x8778('0x14')]('\x20')});})['catch'](function(_0x2f4fae){_0x5e9235(_0x46df5d['error'](0x1f5,[_0xd87a0b['uniqueid'],_0x2f4fae['message'][_0x8778('0x64')]()][_0x8778('0x14')]('\x20')));});}else{return _0x5e9235(_0x46df5d[_0x8778('0x12')](0x1f5,_0x8778('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x33fdc5){var _0x43ad27=this;return new Promise(function(_0x45f4b7,_0x3a2d88){if(ami[_0x8778('0x11')]()==![]){return _0x3a2d88(_0x43ad27['error'](0x1f4,[config['asterisk']['ip'],config[_0x8778('0x13')][_0x8778('0x19')],_0x8778('0x5b')]['join']('\x20')));}var _0x38c0ca=schema(properties['voicequeuechannelredirect'])[_0x8778('0x3')](_0x33fdc5);if(_0x38c0ca[_0x8778('0x58')]>0x0){return _0x3a2d88(_0x43ad27['error'](0x1f4,_[_0x8778('0x5d')](_0x38c0ca,'message')[_0x8778('0x14')](',\x20')));}var _0xebdab6=_[_0x8778('0x6f')](_0x5777a6['queueChannels'],{'uniqueid':_0x33fdc5[_0x8778('0x5e')]});if(_0xebdab6&&_0xebdab6[_0x8778('0x62')]){return ami[_0x8778('0x1c')]({'action':_0x8778('0x76'),'channel':_0xebdab6['channel'],'exten':_0x33fdc5['exten'],'context':_0x33fdc5[_0x8778('0x77')]||_0xebdab6['context'],'priority':0x1})[_0x8778('0x17')](function(_0x3c8fdf){_0x45f4b7({'code':0xc8,'message':[_0x33fdc5[_0x8778('0x5e')],_0x3c8fdf[_0x8778('0x4b')][_0x8778('0x64')]()][_0x8778('0x14')]('\x20')});})[_0x8778('0x18')](function(_0x57652a){_0x3a2d88(_0x43ad27[_0x8778('0x12')](0x1f5,[_0x33fdc5['uniqueid'],_0x57652a[_0x8778('0x4b')][_0x8778('0x64')]()][_0x8778('0x14')]('\x20')));});}else{return _0x3a2d88(_0x43ad27[_0x8778('0x12')](0x1f5,_0x8778('0x6c')));}});},'Agents':function(_0x3b1014){return new Promise(function(_0x38fb27,_0x2f64e1){var _0x8042a9=_[_0x8778('0x59')](_0x5777a6['agents']);_0x38fb27({'count':_0x8042a9[_0x8778('0x58')],'rows':_0x8042a9});});},'Telephones':function(_0x2bacd3){return new Promise(function(_0x10445a,_0x281dee){var _0x39c150=_['values'](_0x5777a6['telephones']);_0x10445a({'count':_0x39c150[_0x8778('0x58')],'rows':_0x39c150});});},'Trunks':function(_0x828d98){return new Promise(function(_0x6cf70e,_0x5cd1b2){var _0x2fccc4=_[_0x8778('0x59')](_0x5777a6[_0x8778('0x78')]);_0x6cf70e({'count':_0x2fccc4[_0x8778('0x58')],'rows':_0x2fccc4});});},'OutboundChannels':function(_0x591a35){return new Promise(function(_0x47c9e0,_0x5d8219){var _0x3a10e8=_[_0x8778('0x59')](_0x5777a6[_0x8778('0x79')]);_0x47c9e0({'count':_0x3a10e8[_0x8778('0x58')],'rows':_0x3a10e8});});},'Outbound':function(_0x384186){return new Promise(function(_0x4ffffd,_0x2d1f0c){_0x4ffffd(_0x5777a6[_0x8778('0x7a')]);});},'Campaigns':function(_0x4448c3){return new Promise(function(_0x31f154,_0x27df0a){var _0x2e62a4=_[_0x8778('0x59')](_0x5777a6[_0x8778('0x7b')]);_0x31f154({'count':_0x2e62a4['length'],'rows':_0x2e62a4});});},'VoiceQueuesPreview':function(_0x4c8591){var _0x38409a=this;return new Promise(function(_0x40f077,_0x13a4fa){_0x245a92[_0x8778('0x7c')](_0x4c8591['id'])['then'](function(_0x215195){_0x40f077({'code':0xc8,'message':_0x215195[_0x8778('0x4b')]});})['catch'](function(_0x41404e){_0x13a4fa(_0x38409a[_0x8778('0x12')](0x1f4,_0x41404e[_0x8778('0x4b')]));});});},'EventManager':function(_0x53fe1d){var _0x1c816e=this;return new Promise(function(_0x2021ed,_0x697b9b){if(!_0x53fe1d['event']){return _0x697b9b(_0x1c816e[_0x8778('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x8778('0x7d')](_0x8778('0x7e')+_0x53fe1d['event'],_0x53fe1d['message']);_0x2021ed({'code':0xc8,'message':_0x53fe1d});});},'FaxAccounts':function(_0x51679f){return new Promise(function(_0x1b94d9,_0x24028b){var _0x5cffde=_[_0x8778('0x59')](_0x5777a6[_0x8778('0x7f')]);_0x1b94d9({'count':_0x5cffde[_0x8778('0x58')],'rows':_0x5cffde});});},'SendFax':function(_0x4d84be){var _0x7c40f7=this;return new Promise(function(_0x2af227,_0x25a334){_0x40d608[_0x8778('0x80')](_0x4d84be)['then'](function(_0x55cac0){_0x2af227({'code':0xc8,'message':_0x55cac0[_0x8778('0x4b')]});})[_0x8778('0x18')](function(_0x5bc775){_0x25a334(_0x7c40f7['error'](0x1f4,_0x5bc775[_0x8778('0x4b')]));});});},'CheckAfterSend':function(_0x1022d1){var _0x2bbba4=this;return new Promise(function(_0x3e5781,_0x4f5c42){_0x40d608[_0x8778('0x81')](_0x1022d1)[_0x8778('0x17')](function(_0x2a0ad6){_0x3e5781({'code':0xc8,'message':_0x2a0ad6[_0x8778('0x4b')]});})['catch'](function(_0x3530ad){_0x4f5c42(_0x2bbba4[_0x8778('0x12')](0x1f4,_0x3530ad[_0x8778('0x4b')]));});});}};var _0x58b1fa=jayson[_0x8778('0x82')](_0xc023f5)[_0x8778('0x83')]();_0x58b1fa['on'](_0x8778('0x12'),function(_0x42ed8f){return _0x29fa8f(_0x42ed8f);});_0x58b1fa['listen'](0x232a,'127.0.0.1',function(){console['log'](_0x8778('0x84'),0x232a);return _0x39f6a8(_0x8778('0x85')+0x232a);});});}; \ No newline at end of file +var _0x76aa=['Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','username','command','Command','content','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','type','unmanaged','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','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','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','values','channels','length','map','find','channel','%s.%s','filename','uniqueid','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','destinationchannel','StopMixMonitor','stop','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0xd1a4c9,_0x5380fc){var _0x53abf1=function(_0x4ef28c){while(--_0x4ef28c){_0xd1a4c9['push'](_0xd1a4c9['shift']());}};_0x53abf1(++_0x5380fc);}(_0x76aa,0x124));var _0xa76a=function(_0x495586,_0x680346){_0x495586=_0x495586-0x0;var _0x56196b=_0x76aa[_0x495586];return _0x56196b;};'use strict';var _=require(_0xa76a('0x0'));var util=require('util');var jayson=require(_0xa76a('0x1'));var schema=require(_0xa76a('0x2'));var BPromise=require(_0xa76a('0x3'));var moment=require('moment');var config=require(_0xa76a('0x4'));var properties=require(_0xa76a('0x5'));var ami=require('../ami');exports[_0xa76a('0x6')]=function(_0x54ee2c,_0x50e13f,_0x130066){return new BPromise(function(_0x3d4cd2,_0x100edb){var _0x5ce0a5={'QueuePause':function(_0x3967ca){return new Promise(function(_0x84d137,_0x34c7d5){var _0x1ed4dd=util[_0xa76a('0x7')](_0xa76a('0x8'),_0xa76a('0x9'),_0x3967ca[_0xa76a('0xa')]);if(_0x54ee2c[_0xa76a('0xb')]&&_0x54ee2c[_0xa76a('0xb')][_0x1ed4dd]&&_0x54ee2c[_0xa76a('0xb')][_0x1ed4dd]['timer']){_0x54ee2c[_0xa76a('0xb')][_0x1ed4dd][_0xa76a('0xc')]();}if(_0x54ee2c[_0xa76a('0xd')][_0x1ed4dd]){_0x54ee2c[_0xa76a('0xd')][_0x1ed4dd][_0xa76a('0xe')]({'statePause':_0x3967ca[_0xa76a('0xf')]?!![]:![]});}_0x84d137({'code':0xc8,'message':_0xa76a('0x10')});});},'Reload':function(_0x5586a7){var _0x32338b=this;return new Promise(function(_0x2b5047,_0x1a9150){if(ami[_0xa76a('0x11')]()==![]){return _0x1a9150(_0x32338b[_0xa76a('0x12')](0x1f4,[config[_0xa76a('0x13')]['ip'],config[_0xa76a('0x13')]['username'],_0xa76a('0x14')][_0xa76a('0x15')]('\x20')));}_0x5586a7=_[_0xa76a('0x16')](_0x5586a7,_[_0xa76a('0x17')](properties[_0xa76a('0x18')]));_0x5586a7[_0xa76a('0x19')]=_0xa76a('0x1a');return ami[_0xa76a('0x1b')](_0x5586a7)[_0xa76a('0x1c')](function(_0x198f66){_0x2b5047({'code':0xc8,'message':_0x198f66[_0xa76a('0x1d')]});})[_0xa76a('0x1e')](function(_0x423855){_0x1a9150(_0x32338b['error'](0x1f5,_0x423855[_0xa76a('0x1d')]));});});},'Command':function(_0x557b67){var _0x527ec3=this;return new Promise(function(_0x567bc2,_0x15abd6){if(ami['isConnected']()==![]){return _0x15abd6(_0x527ec3[_0xa76a('0x12')](0x1f4,[config[_0xa76a('0x13')]['ip'],config[_0xa76a('0x13')][_0xa76a('0x1f')],_0xa76a('0x14')][_0xa76a('0x15')]('\x20')));}_0x557b67=_[_0xa76a('0x16')](_0x557b67,_0xa76a('0x20'));_0x557b67['action']=_0xa76a('0x21');return ami[_0xa76a('0x1b')](_0x557b67)[_0xa76a('0x1c')](function(_0x5e8382){_0x567bc2({'code':0xc8,'message':_0x5e8382[_0xa76a('0x22')]});})[_0xa76a('0x1e')](function(_0x2819bc){_0x15abd6(_0x527ec3[_0xa76a('0x12')](0x1f5,_0x2819bc[_0xa76a('0x1d')]));});});},'VoiceQueues':function(_0x250a79){return new Promise(function(_0x249fe4,_0x5ef6f7){var _0xcdf9a3=[];for(var _0x59cd27 in _0x54ee2c['voiceQueues']){if(_0x54ee2c['voiceQueues']['hasOwnProperty'](_0x59cd27)){var _0x4c693d=_0x54ee2c[_0xa76a('0x23')][_0x59cd27];var _0x475cb3={'id':_0x4c693d['id'],'name':_0x4c693d[_0xa76a('0xa')],'strategy':_0x4c693d[_0xa76a('0x24')],'answered':_0x4c693d[_0xa76a('0x25')],'available':_0x4c693d[_0xa76a('0x26')],'loggedIn':_0x4c693d[_0xa76a('0x27')],'pTalking':_0x4c693d[_0xa76a('0x28')],'sumBillable':_0x4c693d[_0xa76a('0x29')],'sumDuration':_0x4c693d['sumDuration'],'sumHoldTime':_0x4c693d[_0xa76a('0x2a')]||0x0,'talking':_0x4c693d[_0xa76a('0x2b')],'total':_0x4c693d['total'],'type':_0x4c693d[_0xa76a('0x2c')],'unmanaged':_0x4c693d[_0xa76a('0x2d')],'abandoned':_0x4c693d['abandoned'],'waiting':_0x4c693d[_0xa76a('0x2e')],'loggedInDb':_0x4c693d['loggedInDb']};if(_0x4c693d['type']===_0xa76a('0x2f')){_0x475cb3[_0xa76a('0x30')]=_0x4c693d[_0xa76a('0x30')];_0x475cb3[_0xa76a('0x31')]=_0x4c693d['dialMethod'];_0x475cb3[_0xa76a('0x32')]=_0x4c693d[_0xa76a('0x32')];_0x475cb3[_0xa76a('0x33')]=_0x4c693d[_0xa76a('0x33')];_0x475cb3[_0xa76a('0x34')]=_0x4c693d[_0xa76a('0x34')];_0x475cb3[_0xa76a('0x35')]=_0x4c693d[_0xa76a('0x35')];_0x475cb3[_0xa76a('0x36')]=_0x4c693d[_0xa76a('0x36')];_0x475cb3[_0xa76a('0x37')]=_0x4c693d[_0xa76a('0x37')];_0x475cb3[_0xa76a('0x38')]=_0x4c693d[_0xa76a('0x38')];_0x475cb3[_0xa76a('0x39')]=_0x4c693d['outboundBusyCallsDay'];_0x475cb3[_0xa76a('0x3a')]=_0x4c693d['outboundCongestionCallsDay'];_0x475cb3[_0xa76a('0x3b')]=_0x4c693d[_0xa76a('0x3b')];_0x475cb3[_0xa76a('0x3c')]=_0x4c693d[_0xa76a('0x3c')];_0x475cb3[_0xa76a('0x3d')]=_0x4c693d[_0xa76a('0x3d')];_0x475cb3[_0xa76a('0x3e')]=_0x4c693d['outboundNoAnswerCallsDay'];_0x475cb3[_0xa76a('0x3f')]=_0x4c693d[_0xa76a('0x3f')];_0x475cb3[_0xa76a('0x40')]=_0x4c693d[_0xa76a('0x40')];_0x475cb3[_0xa76a('0x41')]=_0x4c693d['outboundReCallsDay'];_0x475cb3[_0xa76a('0x42')]=_0x4c693d[_0xa76a('0x42')];_0x475cb3[_0xa76a('0x43')]=_0x4c693d[_0xa76a('0x43')];_0x475cb3[_0xa76a('0x44')]=_0x4c693d[_0xa76a('0x44')];_0x475cb3[_0xa76a('0x45')]=_0x4c693d[_0xa76a('0x45')];_0x475cb3['predictiveIntervalAvgTalktime']=_0x4c693d[_0xa76a('0x46')];_0x475cb3[_0xa76a('0x47')]=_0x4c693d[_0xa76a('0x47')];_0x475cb3['predictiveIntervalDroppedCallsTimeout']=_0x4c693d[_0xa76a('0x48')];_0x475cb3[_0xa76a('0x49')]=_0x4c693d[_0xa76a('0x49')];_0x475cb3['predictiveIntervalErlangCallsDroppedCalls']=_0x4c693d[_0xa76a('0x4a')];_0x475cb3[_0xa76a('0x4b')]=_0x4c693d['predictiveIntervalHitRate'];_0x475cb3[_0xa76a('0x4c')]=_0x4c693d[_0xa76a('0x4c')];_0x475cb3[_0xa76a('0x4d')]=_0x4c693d[_0xa76a('0x4d')];_0x475cb3['predictiveIntervalAvailable']=_0x4c693d['predictiveIntervalAvailable'];_0x475cb3[_0xa76a('0x4e')]=_0x4c693d['predictiveIntervalTotalCalls'];_0x475cb3[_0xa76a('0x1d')]=_0x4c693d[_0xa76a('0x1d')];_0x475cb3[_0xa76a('0x4f')]=_0x4c693d[_0xa76a('0x4f')];_0x475cb3[_0xa76a('0x50')]=_0x4c693d[_0xa76a('0x50')];_0x475cb3['erlangCallToSecond']=_0x4c693d[_0xa76a('0x51')];_0x475cb3['erlangAbandonmentRate']=_0x4c693d[_0xa76a('0x52')];_0x475cb3[_0xa76a('0x53')]=_0x4c693d[_0xa76a('0x53')];_0x475cb3[_0xa76a('0x54')]=_0x4c693d['startPredictive'];_0x475cb3[_0xa76a('0x55')]=_0x4c693d[_0xa76a('0x55')];}if(_0x4c693d[_0xa76a('0x56')]){_0x475cb3[_0xa76a('0x56')]={'id':_0x4c693d[_0xa76a('0x56')]['id'],'name':_0x4c693d[_0xa76a('0x56')][_0xa76a('0xa')],'active':_0x4c693d[_0xa76a('0x56')]['active'],'callerid':_0x4c693d['Trunk'][_0xa76a('0x57')]};}if(_0x4c693d['Interval']){_0x475cb3['Interval']={'id':_0x4c693d[_0xa76a('0x58')]['id'],'name':_0x4c693d[_0xa76a('0x58')]['name']};}_0xcdf9a3['push'](_0x475cb3);}}_0x249fe4({'count':_0xcdf9a3['length'],'rows':_0xcdf9a3});});},'VoiceChannels':function(_0x5a271d){return new Promise(function(_0x55ea43,_0x3a33de){var _0x3e95b4=_[_0xa76a('0x59')](_0x54ee2c[_0xa76a('0x5a')]);_0x55ea43({'count':_0x3e95b4[_0xa76a('0x5b')],'rows':_0x3e95b4});});},'VoiceChannelMixMonitor':function(_0xcc61b){var _0x3d7687=this;return new Promise(function(_0x35a44d,_0x42303d){if(ami[_0xa76a('0x11')]()==![]){return _0x42303d(_0x3d7687['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xa76a('0x1f')],_0xa76a('0x14')][_0xa76a('0x15')]('\x20')));}var _0x18ee2d=schema(properties['voicechannel'])[_0xa76a('0x2')](_0xcc61b);if(_0x18ee2d['length']>0x0){return _0x42303d(_0x3d7687[_0xa76a('0x12')](0x1f4,_[_0xa76a('0x5c')](_0x18ee2d,_0xa76a('0x1d'))[_0xa76a('0x15')](',\x20')));}var _0x302137=_[_0xa76a('0x5d')](_0x54ee2c[_0xa76a('0x5a')],{'uniqueid':_0xcc61b['uniqueid']});if(_0x302137&&_0x302137[_0xa76a('0x5e')]){var _0x562ff1=util['format'](_0xa76a('0x5f'),_0xcc61b[_0xa76a('0x60')]||_0xcc61b[_0xa76a('0x61')],_0xcc61b['format']||'wav');return ami['Action']({'action':_0xa76a('0x62'),'channel':_0x302137['channel'],'file':_0x562ff1,'options':_0xa76a('0x63')})[_0xa76a('0x1c')](function(_0xc39e8e){var _0x413e8e=_[_0xa76a('0x5d')](_0x302137[_0xa76a('0x64')],{'filename':_0xa76a('0x65')+_0x562ff1[_0xa76a('0x66')]()});if(_[_0xa76a('0x67')](_0x413e8e)){_0x302137['monitors']['push']({'filename':_0xa76a('0x65')+_0x562ff1[_0xa76a('0x66')](),'createdAt':moment()[_0xa76a('0x7')](_0xa76a('0x68')),'mixmonitorid':_0xc39e8e['mixmonitorid'],'status':_0xa76a('0x69')});}else{_0x413e8e['mixmonitorid']=_0xc39e8e[_0xa76a('0x6a')];_0x413e8e[_0xa76a('0x6b')]='rec';}_0x35a44d({'code':0xc8,'message':[_0xcc61b[_0xa76a('0x61')],_0xa76a('0x6c'),_0xc39e8e[_0xa76a('0x6a')]][_0xa76a('0x15')]('\x20'),'mixmonitorid':_0xc39e8e[_0xa76a('0x6a')]});})['catch'](function(_0x3a04ba){_0x42303d(_0x3d7687['error'](0x1f5,[_0xcc61b[_0xa76a('0x61')],_0x3a04ba[_0xa76a('0x1d')]['toLowerCase']()][_0xa76a('0x15')]('\x20')));});}else{return _0x42303d(_0x3d7687[_0xa76a('0x12')](0x1f5,_0xa76a('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x27f5a8){var _0x28b653=this;return new Promise(function(_0x4ecd8a,_0x435ec8){if(ami[_0xa76a('0x11')]()==![]){return _0x435ec8(_0x28b653[_0xa76a('0x12')](0x1f4,[config[_0xa76a('0x13')]['ip'],config['asterisk'][_0xa76a('0x1f')],'ami\x20disconnected']['join']('\x20')));}var _0x180593=schema(properties[_0xa76a('0x6e')])[_0xa76a('0x2')](_0x27f5a8);if(_0x180593[_0xa76a('0x5b')]>0x0){return _0x435ec8(_0x28b653['error'](0x1f4,_[_0xa76a('0x5c')](_0x180593,_0xa76a('0x1d'))[_0xa76a('0x15')](',\x20')));}var _0x351886=_[_0xa76a('0x5d')](_0x54ee2c[_0xa76a('0x5a')],{'uniqueid':_0x27f5a8[_0xa76a('0x61')]});if(_0x351886){return BPromise['resolve']()[_0xa76a('0x1c')](function(){if(_0x351886[_0xa76a('0x5e')]){return ami[_0xa76a('0x1b')]({'action':'StopMixMonitor','channel':_0x351886['channel'],'mixmonitorid':_0x27f5a8[_0xa76a('0x6a')]})[_0xa76a('0x1e')](function(_0x509192){});}})[_0xa76a('0x1c')](function(){if(_0x351886[_0xa76a('0x6f')]){return ami[_0xa76a('0x1b')]({'action':_0xa76a('0x70'),'channel':_0x351886[_0xa76a('0x6f')],'mixmonitorid':_0x27f5a8['mixmonitorid']})[_0xa76a('0x1e')](function(_0x1647b4){});}})['then'](function(_0xa9ca91){var _0x31e748=_[_0xa76a('0x5d')](_0x351886['monitors'],{'mixmonitorid':_0x27f5a8['mixmonitorid']});if(_0x31e748){_0x31e748[_0xa76a('0x6b')]=_0xa76a('0x71');}})[_0xa76a('0x1c')](function(){var _0x594292=util['format'](_0xa76a('0x5f'),_0x27f5a8[_0xa76a('0x60')]||_0x27f5a8[_0xa76a('0x61')],_0x27f5a8[_0xa76a('0x7')]||_0xa76a('0x72'));var _0xff8a36=_[_0xa76a('0x5d')](_0x351886['monitors'],{'filename':_0xa76a('0x65')+_0x594292[_0xa76a('0x66')]()});if(_0xff8a36){_0xff8a36[_0xa76a('0x6b')]=_0xa76a('0x71');}})[_0xa76a('0x1c')](function(){_0x4ecd8a({'code':0xc8,'message':[_0x27f5a8[_0xa76a('0x61')],_0xa76a('0x73')][_0xa76a('0x15')]('\x20')});})[_0xa76a('0x1e')](function(_0x4407de){_0x435ec8(_0x28b653[_0xa76a('0x12')](0x1f5,[_0x27f5a8['uniqueid'],_0x4407de[_0xa76a('0x1d')]['toLowerCase']()][_0xa76a('0x15')]('\x20')));});}else{return _0x435ec8(_0x28b653[_0xa76a('0x12')](0x1f5,_0xa76a('0x6d')));}});},'VoiceQueuesChannels':function(_0x4eaaa2){return new Promise(function(_0x342415,_0x3b7614){var _0x22f6e9=_['values'](_0x54ee2c[_0xa76a('0x74')]);_0x342415({'count':_0x22f6e9['length'],'rows':_0x22f6e9});});},'VoiceQueuesChannel':function(_0x3fd13d){var _0x3a959e=this;return new Promise(function(_0x1d5aa5,_0x30380e){var _0x5e8320=schema(properties['voicequeuechannel'])[_0xa76a('0x2')](_0x3fd13d);if(_0x5e8320[_0xa76a('0x5b')]>0x0){return _0x30380e(_0x3a959e[_0xa76a('0x12')](0x1f4,_['map'](_0x5e8320,_0xa76a('0x1d'))[_0xa76a('0x15')](',\x20')));}var _0x31b661=_[_0xa76a('0x5d')](_0x54ee2c[_0xa76a('0x74')],{'uniqueid':_0x3fd13d[_0xa76a('0x61')]});if(_0x31b661){_0x1d5aa5(_0x31b661);}else{return _0x30380e(_0x3a959e['error'](0x1f5,_0xa76a('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x5954ab){var _0x512f2c=this;return new Promise(function(_0x45cc0a,_0x2e47d7){if(ami[_0xa76a('0x11')]()==![]){return _0x2e47d7(_0x512f2c['error'](0x1f4,[config[_0xa76a('0x13')]['ip'],config['asterisk'][_0xa76a('0x1f')],_0xa76a('0x14')][_0xa76a('0x15')]('\x20')));}var _0x45d722=schema(properties[_0xa76a('0x75')])[_0xa76a('0x2')](_0x5954ab);if(_0x45d722[_0xa76a('0x5b')]>0x0){return _0x2e47d7(_0x512f2c['error'](0x1f4,_[_0xa76a('0x5c')](_0x45d722,'message')[_0xa76a('0x15')](',\x20')));}var _0x62de60=_[_0xa76a('0x5d')](_0x54ee2c[_0xa76a('0x74')],{'uniqueid':_0x5954ab[_0xa76a('0x61')]});if(_0x62de60&&_0x62de60[_0xa76a('0x5e')]){return ami['Action']({'action':'Hangup','channel':_0x62de60[_0xa76a('0x5e')]})[_0xa76a('0x1c')](function(_0x11aed0){_0x45cc0a({'code':0xc8,'message':[_0x5954ab['uniqueid'],_0x11aed0[_0xa76a('0x1d')][_0xa76a('0x66')]()][_0xa76a('0x15')]('\x20')});})[_0xa76a('0x1e')](function(_0x89ca51){_0x2e47d7(_0x512f2c[_0xa76a('0x12')](0x1f5,[_0x5954ab['uniqueid'],_0x89ca51['message'][_0xa76a('0x66')]()][_0xa76a('0x15')]('\x20')));});}else{return _0x2e47d7(_0x512f2c[_0xa76a('0x12')](0x1f5,_0xa76a('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x4ffed9){var _0x566673=this;return new Promise(function(_0x22ca3e,_0x3120f3){if(ami[_0xa76a('0x11')]()==![]){return _0x3120f3(_0x566673[_0xa76a('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xa76a('0x13')][_0xa76a('0x1f')],_0xa76a('0x14')]['join']('\x20')));}var _0x14bdfb=schema(properties[_0xa76a('0x76')])[_0xa76a('0x2')](_0x4ffed9);if(_0x14bdfb[_0xa76a('0x5b')]>0x0){return _0x3120f3(_0x566673[_0xa76a('0x12')](0x1f4,_['map'](_0x14bdfb,'message')[_0xa76a('0x15')](',\x20')));}var _0x1daefd=_['find'](_0x54ee2c['queueChannels'],{'uniqueid':_0x4ffed9[_0xa76a('0x61')]});if(_0x1daefd&&_0x1daefd[_0xa76a('0x5e')]){return ami[_0xa76a('0x1b')]({'action':_0xa76a('0x77'),'channel':_0x1daefd[_0xa76a('0x5e')],'exten':_0x4ffed9[_0xa76a('0x78')],'context':_0x4ffed9[_0xa76a('0x79')]||_0x1daefd[_0xa76a('0x79')],'priority':0x1})[_0xa76a('0x1c')](function(_0x5b1253){_0x22ca3e({'code':0xc8,'message':[_0x4ffed9['uniqueid'],_0x5b1253[_0xa76a('0x1d')]['toLowerCase']()][_0xa76a('0x15')]('\x20')});})[_0xa76a('0x1e')](function(_0x5dc125){_0x3120f3(_0x566673[_0xa76a('0x12')](0x1f5,[_0x4ffed9['uniqueid'],_0x5dc125[_0xa76a('0x1d')][_0xa76a('0x66')]()][_0xa76a('0x15')]('\x20')));});}else{return _0x3120f3(_0x566673[_0xa76a('0x12')](0x1f5,_0xa76a('0x6d')));}});},'Agents':function(_0x559499){return new Promise(function(_0x4ed04c,_0x13de1f){var _0x4381d8=_[_0xa76a('0x59')](_0x54ee2c[_0xa76a('0xd')]);_0x4ed04c({'count':_0x4381d8[_0xa76a('0x5b')],'rows':_0x4381d8});});},'Telephones':function(_0x10c267){return new Promise(function(_0x5a2ae1,_0x3adf64){var _0x54f5b3=_[_0xa76a('0x59')](_0x54ee2c[_0xa76a('0x7a')]);_0x5a2ae1({'count':_0x54f5b3[_0xa76a('0x5b')],'rows':_0x54f5b3});});},'Trunks':function(_0x293412){return new Promise(function(_0x1c4fa7,_0x3e502b){var _0x199f56=_[_0xa76a('0x59')](_0x54ee2c[_0xa76a('0x7b')]);_0x1c4fa7({'count':_0x199f56[_0xa76a('0x5b')],'rows':_0x199f56});});},'OutboundChannels':function(_0x51ae1f){return new Promise(function(_0x2cdd65,_0x15dc56){var _0x125e88=_[_0xa76a('0x59')](_0x54ee2c[_0xa76a('0x7c')]);_0x2cdd65({'count':_0x125e88[_0xa76a('0x5b')],'rows':_0x125e88});});},'Outbound':function(_0x234631){return new Promise(function(_0x1dd88d,_0x5496c3){_0x1dd88d(_0x54ee2c[_0xa76a('0x2f')]);});},'Campaigns':function(_0x4a3c27){return new Promise(function(_0x50f270,_0x5d02cd){var _0x1f1bdd=_[_0xa76a('0x59')](_0x54ee2c[_0xa76a('0x7d')]);_0x50f270({'count':_0x1f1bdd[_0xa76a('0x5b')],'rows':_0x1f1bdd});});},'VoiceQueuesPreview':function(_0x2f13f9){var _0x2f2e3c=this;return new Promise(function(_0x4e4d41,_0x25f83b){_0x50e13f['run'](_0x2f13f9['id'])[_0xa76a('0x1c')](function(_0x5a260b){_0x4e4d41({'code':0xc8,'message':_0x5a260b['message']});})[_0xa76a('0x1e')](function(_0x16b92c){_0x25f83b(_0x2f2e3c[_0xa76a('0x12')](0x1f4,_0x16b92c['message']));});});},'EventManager':function(_0x4afaf7){var _0x3b17c3=this;return new Promise(function(_0x35befa,_0x4eaca4){if(!_0x4afaf7[_0xa76a('0x7e')]){return _0x4eaca4(_0x3b17c3[_0xa76a('0x12')](0x1f4,_0xa76a('0x7f')));}ami[_0xa76a('0x80')](_0xa76a('0x81')+_0x4afaf7[_0xa76a('0x7e')],_0x4afaf7[_0xa76a('0x1d')]);_0x35befa({'code':0xc8,'message':_0x4afaf7});});},'FaxAccounts':function(_0x324609){return new Promise(function(_0x152649,_0x3f8c4b){var _0x1d99cb=_[_0xa76a('0x59')](_0x54ee2c['faxAccounts']);_0x152649({'count':_0x1d99cb[_0xa76a('0x5b')],'rows':_0x1d99cb});});},'SendFax':function(_0x57c07c){var _0x2081c5=this;return new Promise(function(_0xb0382d,_0x78963f){_0x130066[_0xa76a('0x82')](_0x57c07c)[_0xa76a('0x1c')](function(_0x4c44f4){_0xb0382d({'code':0xc8,'message':_0x4c44f4[_0xa76a('0x1d')]});})[_0xa76a('0x1e')](function(_0x50236f){_0x78963f(_0x2081c5[_0xa76a('0x12')](0x1f4,_0x50236f['message']));});});},'CheckAfterSend':function(_0xfc34da){var _0x2ea67e=this;return new Promise(function(_0x3fb5f5,_0x3aa47c){_0x130066[_0xa76a('0x83')](_0xfc34da)[_0xa76a('0x1c')](function(_0x1d7ed3){_0x3fb5f5({'code':0xc8,'message':_0x1d7ed3[_0xa76a('0x1d')]});})[_0xa76a('0x1e')](function(_0x5e4fd1){_0x3aa47c(_0x2ea67e[_0xa76a('0x12')](0x1f4,_0x5e4fd1['message']));});});}};var _0x2216bb=jayson[_0xa76a('0x84')](_0x5ce0a5)[_0xa76a('0x85')]();_0x2216bb['on'](_0xa76a('0x12'),function(_0x3630aa){return _0x100edb(_0x3630aa);});_0x2216bb['listen'](0x232a,_0xa76a('0x86'),function(){console[_0xa76a('0x87')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d4cd2(_0xa76a('0x88')+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 ebfc8f5..49dbda4 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 _0xb839=['firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','$or','map','destcalleridnum','lastName','phone','mobile','createdAt','scheduledAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','isNil','routeId'];(function(_0x2ad374,_0x18b3fa){var _0x3602fd=function(_0x4fd519){while(--_0x4fd519){_0x2ad374['push'](_0x2ad374['shift']());}};_0x3602fd(++_0x18b3fa);}(_0xb839,0xee));var _0x9b83=function(_0x553bd5,_0x58d09e){_0x553bd5=_0x553bd5-0x0;var _0x487a53=_0xb839[_0x553bd5];return _0x487a53;};'use strict';var _=require(_0x9b83('0x0'));var BPromise=require('bluebird');var Redis=require(_0x9b83('0x1'));var util=require('util');var config=require(_0x9b83('0x2'));var logger=require(_0x9b83('0x3'))(_0x9b83('0x4'));var cmContactRpc=require(_0x9b83('0x5'));config[_0x9b83('0x6')]=_[_0x9b83('0x7')](config[_0x9b83('0x6')],{'host':_0x9b83('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9b83('0x6')]));function emit(_0x329b8a,_0x331e25,_0x491f3c,_0x47f5e4,_0x56d2dc){logger[_0x9b83('0x9')](_0x9b83('0xa'),_0x329b8a,_0x331e25['id'],_0x491f3c,_0x47f5e4,JSON[_0x9b83('0xb')](_0x56d2dc));io['to'](_0x491f3c)[_0x9b83('0xc')](_0x47f5e4,_0x56d2dc);}exports[_0x9b83('0xd')]=function(_0x102ca6,_0x4bfd6e,_0x5b772d,_0x489345){var _0x3c355e,_0x309079;var _0x378222={};var _0x2231cd=Number(_0x5b772d[_0x9b83('0xe')]);var _0x54decc=_0x5b772d[_0x9b83('0xf')]?Boolean(Number(_0x5b772d[_0x9b83('0xf')])):![];var _0x1ee761;if(_0x489345[_0x9b83('0x10')]){_0x378222['id']=_0x489345[_0x9b83('0x10')];}if(!_0x378222['id']){_0x378222[_0x9b83('0x11')]=_0x2231cd;_0x1ee761=_0x5b772d['data3']&&_0x5b772d[_0x9b83('0x12')]!=='0'?_0x5b772d['data3'][_0x9b83('0x13')](','):['phone'];_0x378222[_0x9b83('0x14')]=_[_0x9b83('0x15')](_0x1ee761,function(_0x1f1dc7){var _0x22153d={};_0x22153d[_0x1f1dc7]=_0x489345['routeId']?_0x489345[_0x9b83('0x16')]:_0x489345['calleridnum'];return _0x22153d;});}var _0x5afc56=['id','firstName',_0x9b83('0x17'),_0x9b83('0x18'),_0x9b83('0x19'),'fax',_0x9b83('0x11'),_0x9b83('0x1a'),_0x9b83('0x1b'),'updatedAt'];var _0x3daaa3=_['union'](_0x5afc56,_0x1ee761);BPromise[_0x9b83('0x1c')]()[_0x9b83('0x1d')](cmContactRpc[_0x9b83('0x1e')]({'attributes':_0x3daaa3,'where':_0x378222}))['then'](function(_0x51c82b){_0x309079=_0x51c82b;if(!_[_0x9b83('0x1f')](_0x309079)){if(_0x309079[_0x9b83('0x20')]===0x1){_0x3c355e=_0x309079[0x0];logger[_0x9b83('0x9')](_0x9b83('0x21'),_0x489345[_0x9b83('0x22')],_0x4bfd6e['id'],_0x3c355e['id']);}else{logger[_0x9b83('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x489345[_0x9b83('0x22')],_0x4bfd6e['id'],_[_0x9b83('0x15')](_0x309079,'id')[_0x9b83('0x23')](','));}return;}else{logger['info'](_0x9b83('0x24'),_0x489345[_0x9b83('0x22')],_0x4bfd6e['id']);var _0x292842={'ListId':_0x2231cd};var _0x28dd61=_0x5b772d[_0x9b83('0x25')]&&_0x5b772d[_0x9b83('0x25')]!=='0'?_0x5b772d[_0x9b83('0x25')]:_0x9b83('0x18');if(_0x54decc){logger[_0x9b83('0x9')](_0x9b83('0x26'),_0x489345['uniqueid'],_0x4bfd6e['id']);_0x292842[_0x28dd61]=_['isNil'](_0x489345['routeId'])?_0x489345[_0x9b83('0x27')]:_0x489345[_0x9b83('0x16')];if(_[_0x9b83('0x28')](_0x489345[_0x9b83('0x29')])){_0x292842[_0x9b83('0x2a')]=_0x489345['calleridname']&&_0x489345[_0x9b83('0x2b')]!==_0x9b83('0x2c')?_0x489345['calleridname']:_0x9b83('0x2d');}else{_0x292842[_0x9b83('0x2a')]=_0x489345[_0x9b83('0x2e')]&&_0x489345[_0x9b83('0x2e')]!==_0x9b83('0x2c')?_0x489345[_0x9b83('0x2e')]:_0x9b83('0x2d');}return BPromise['resolve']()[_0x9b83('0x1d')](cmContactRpc[_0x9b83('0x2f')](_0x292842))[_0x9b83('0x1d')](function(_0x86a6e1){_0x3c355e=_0x86a6e1;_0x309079[_0x9b83('0x30')](_0x86a6e1);if(_0x3c355e){logger[_0x9b83('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x489345[_0x9b83('0x22')],_0x4bfd6e['id'],_0x3c355e['id']);}return;});}else{logger[_0x9b83('0x9')](_0x9b83('0x31'),_0x489345[_0x9b83('0x22')],_0x4bfd6e['id']);_0x292842[_0x28dd61]=_[_0x9b83('0x28')](_0x489345[_0x9b83('0x29')])?_0x489345[_0x9b83('0x27')]:_0x489345[_0x9b83('0x16')];if(_[_0x9b83('0x28')](_0x489345['routeId'])){_0x292842['firstName']=_0x489345[_0x9b83('0x2b')]&&_0x489345[_0x9b83('0x2b')]!==_0x9b83('0x2c')?_0x489345[_0x9b83('0x2b')]:_0x9b83('0x2d');}else{_0x292842[_0x9b83('0x2a')]=_0x489345[_0x9b83('0x2e')]&&_0x489345[_0x9b83('0x2e')]!==_0x9b83('0x2c')?_0x489345[_0x9b83('0x2e')]:_0x9b83('0x2d');}_0x3c355e=_0x292842;_0x309079[_0x9b83('0x30')](_0x292842);return;}}})[_0x9b83('0x1d')](function(){if(_0x102ca6){emit(_0x489345['uniqueid'],_0x4bfd6e,util[_0x9b83('0x32')](_0x9b83('0x33'),_0x102ca6[_0x9b83('0x34')]),util[_0x9b83('0x32')](_0x9b83('0x35'),_0x5b772d[_0x9b83('0x36')][_0x9b83('0x37')]()),{'evt':_['merge'](_0x489345,{'autoCreate':_0x54decc}),'contact':_0x3c355e===undefined?{}:_0x3c355e,'contacts':_0x309079[_0x9b83('0x20')]===0x0?undefined:_0x309079});}});}; \ No newline at end of file +var _0x9860=['bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','calleridnum','firstName','lastName','mobile','fax','createdAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','destcalleridnum','isNil','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','merge'];(function(_0x3fc92d,_0x45439a){var _0x2aa031=function(_0x16f1a5){while(--_0x16f1a5){_0x3fc92d['push'](_0x3fc92d['shift']());}};_0x2aa031(++_0x45439a);}(_0x9860,0xa5));var _0x0986=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9860[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var BPromise=require(_0x0986('0x0'));var Redis=require(_0x0986('0x1'));var util=require(_0x0986('0x2'));var config=require(_0x0986('0x3'));var logger=require(_0x0986('0x4'))('trigger');var cmContactRpc=require(_0x0986('0x5'));config['redis']=_['defaults'](config[_0x0986('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0986('0x7'))(new Redis(config['redis']));function emit(_0x29dda0,_0x68669a,_0x3589eb,_0x5d01bf,_0x5ba7eb){logger[_0x0986('0x8')](_0x0986('0x9'),_0x29dda0,_0x68669a['id'],_0x3589eb,_0x5d01bf,JSON[_0x0986('0xa')](_0x5ba7eb));io['to'](_0x3589eb)[_0x0986('0xb')](_0x5d01bf,_0x5ba7eb);}exports['exec']=function(_0x3c976c,_0x4aa565,_0x23093c,_0x44177d){var _0x235a3d,_0x10b32;var _0xa7f6b0={};var _0x3b228e=Number(_0x23093c[_0x0986('0xc')]);var _0x4a6a7d=_0x23093c[_0x0986('0xd')]?Boolean(Number(_0x23093c[_0x0986('0xd')])):![];var _0x4e1cd7;if(_0x44177d[_0x0986('0xe')]){_0xa7f6b0['id']=_0x44177d[_0x0986('0xe')];}if(!_0xa7f6b0['id']){_0xa7f6b0[_0x0986('0xf')]=_0x3b228e;_0x4e1cd7=_0x23093c[_0x0986('0x10')]&&_0x23093c['data3']!=='0'?_0x23093c['data3'][_0x0986('0x11')](','):[_0x0986('0x12')];_0xa7f6b0[_0x0986('0x13')]=_[_0x0986('0x14')](_0x4e1cd7,function(_0x11974a){var _0x4c9666={};_0x4c9666[_0x11974a]=_0x44177d[_0x0986('0x15')]?_0x44177d['destcalleridnum']:_0x44177d[_0x0986('0x16')];return _0x4c9666;});}var _0x335bfe=['id',_0x0986('0x17'),_0x0986('0x18'),_0x0986('0x12'),_0x0986('0x19'),_0x0986('0x1a'),_0x0986('0xf'),_0x0986('0x1b'),'scheduledAt',_0x0986('0x1c')];var _0x2b9637=_['union'](_0x335bfe,_0x4e1cd7);BPromise[_0x0986('0x1d')]()[_0x0986('0x1e')](cmContactRpc[_0x0986('0x1f')]({'attributes':_0x2b9637,'where':_0xa7f6b0}))[_0x0986('0x1e')](function(_0x48e28c){_0x10b32=_0x48e28c;if(!_[_0x0986('0x20')](_0x10b32)){if(_0x10b32[_0x0986('0x21')]===0x1){_0x235a3d=_0x10b32[0x0];logger[_0x0986('0x8')](_0x0986('0x22'),_0x44177d['uniqueid'],_0x4aa565['id'],_0x235a3d['id']);}else{logger[_0x0986('0x8')](_0x0986('0x23'),_0x44177d['uniqueid'],_0x4aa565['id'],_[_0x0986('0x14')](_0x10b32,'id')[_0x0986('0x24')](','));}return;}else{logger[_0x0986('0x8')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x44177d[_0x0986('0x25')],_0x4aa565['id']);var _0x415ce4={'ListId':_0x3b228e};var _0x40c097=_0x23093c[_0x0986('0x26')]&&_0x23093c[_0x0986('0x26')]!=='0'?_0x23093c[_0x0986('0x26')]:_0x0986('0x12');if(_0x4a6a7d){logger[_0x0986('0x8')](_0x0986('0x27'),_0x44177d[_0x0986('0x25')],_0x4aa565['id']);_0x415ce4[_0x40c097]=_['isNil'](_0x44177d['routeId'])?_0x44177d[_0x0986('0x16')]:_0x44177d[_0x0986('0x28')];if(_[_0x0986('0x29')](_0x44177d[_0x0986('0x15')])){_0x415ce4[_0x0986('0x17')]=_0x44177d[_0x0986('0x2a')]&&_0x44177d['calleridname']!==''?_0x44177d[_0x0986('0x2a')]:_0x0986('0x2b');}else{_0x415ce4[_0x0986('0x17')]=_0x44177d[_0x0986('0x2c')]&&_0x44177d[_0x0986('0x2c')]!==_0x0986('0x2d')?_0x44177d[_0x0986('0x2c')]:_0x0986('0x2b');}return BPromise[_0x0986('0x1d')]()[_0x0986('0x1e')](cmContactRpc[_0x0986('0x2e')](_0x415ce4))[_0x0986('0x1e')](function(_0x2cab2d){_0x235a3d=_0x2cab2d;_0x10b32[_0x0986('0x2f')](_0x2cab2d);if(_0x235a3d){logger[_0x0986('0x8')](_0x0986('0x30'),_0x44177d[_0x0986('0x25')],_0x4aa565['id'],_0x235a3d['id']);}return;});}else{logger[_0x0986('0x8')](_0x0986('0x31'),_0x44177d['uniqueid'],_0x4aa565['id']);_0x415ce4[_0x40c097]=_[_0x0986('0x29')](_0x44177d[_0x0986('0x15')])?_0x44177d['calleridnum']:_0x44177d['destcalleridnum'];if(_[_0x0986('0x29')](_0x44177d[_0x0986('0x15')])){_0x415ce4[_0x0986('0x17')]=_0x44177d[_0x0986('0x2a')]&&_0x44177d['calleridname']!==_0x0986('0x2d')?_0x44177d['calleridname']:_0x0986('0x2b');}else{_0x415ce4['firstName']=_0x44177d[_0x0986('0x2c')]&&_0x44177d[_0x0986('0x2c')]!==''?_0x44177d[_0x0986('0x2c')]:_0x0986('0x2b');}_0x235a3d=_0x415ce4;_0x10b32[_0x0986('0x2f')](_0x415ce4);return;}}})[_0x0986('0x1e')](function(){if(_0x3c976c){emit(_0x44177d[_0x0986('0x25')],_0x4aa565,util[_0x0986('0x32')]('user:%s',_0x3c976c[_0x0986('0x33')]),util['format'](_0x0986('0x34'),_0x23093c[_0x0986('0x35')]['toLowerCase']()),{'evt':_[_0x0986('0x36')](_0x44177d,{'autoCreate':_0x4a6a7d}),'contact':_0x235a3d===undefined?{}:_0x235a3d,'contacts':_0x10b32[_0x0986('0x21')]===0x0?undefined:_0x10b32});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 767cdad..9ec1514 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 _0x81f5=['exports','util','lodash','url','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','stringify','clone','checkTriggers','prototype','interface','triggers','status','merge','variables','Actions','length','action','contactmanager','motionbar','data1','popup','TemplateId','html','render','data2','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','600','data6','winApplication','winArguments','format','name','trigger:%s:%s','user:%s','trigger:%s','toLowerCase','integration','queue','routeId','urlforward','exec','query','search','replace','checkTrigger','AllConditions','every','channel','AnyConditions','checkConditions','field','value','upperFirst','AccountId','operator','interaction','message','event','agent','membername','lastevent'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0x81f5,0x77));var _0x581f=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x81f5[_0x2b10c6];return _0x3789d2;};'use strict';var util=require(_0x581f('0x0'));var _=require(_0x581f('0x1'));var url=require(_0x581f('0x2'));var Mustache=require(_0x581f('0x3'));var Redis=require(_0x581f('0x4'));var urlforward=require(_0x581f('0x5'));var integration=require('./integration');var cmContact=require(_0x581f('0x6'));var script=require(_0x581f('0x7'));var config=require(_0x581f('0x8'));var logger=require(_0x581f('0x9'))(_0x581f('0xa'));var ami=require(_0x581f('0xb'));config[_0x581f('0xc')]=_[_0x581f('0xd')](config[_0x581f('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x581f('0xe'))(new Redis(config[_0x581f('0xc')]));var operators={'equals':function(_0x577bcb,_0x143a7a){return _0x577bcb==_0x143a7a;},'not_equals':function(_0x14c350,_0x3c0085){return _0x14c350!=_0x3c0085;}};var barAndWebActions=['popup',_0x581f('0x2'),_0x581f('0xf')];function Trigger(_0xf0f3f4){this['triggers']=_0xf0f3f4['triggers'];this[_0x581f('0x10')]=_0xf0f3f4[_0x581f('0x10')];this[_0x581f('0x11')]=_0xf0f3f4['voiceQueues'];this['templates']=_0xf0f3f4[_0x581f('0x12')];this[_0x581f('0x13')]=_0xf0f3f4[_0x581f('0x13')];this[_0x581f('0x14')]=_0xf0f3f4[_0x581f('0x14')];this[_0x581f('0x15')]=_0xf0f3f4['freshdeskAccounts'];this['salesforceAccounts']=_0xf0f3f4[_0x581f('0x16')];this[_0x581f('0x17')]=_0xf0f3f4[_0x581f('0x17')];this[_0x581f('0x18')]=_0xf0f3f4[_0x581f('0x18')];this[_0x581f('0x19')]=_0xf0f3f4[_0x581f('0x19')];this[_0x581f('0x1a')]=_0xf0f3f4[_0x581f('0x1a')];this[_0x581f('0x1b')]=_0xf0f3f4[_0x581f('0x1b')];this[_0x581f('0x1c')]=_0xf0f3f4[_0x581f('0x1c')];this[_0x581f('0x1d')]=_0xf0f3f4[_0x581f('0x1d')];this['accounts']={'zendesk':this[_0x581f('0x14')],'salesforce':this[_0x581f('0x16')],'freshdesk':this[_0x581f('0x15')],'sugarcrm':this[_0x581f('0x17')],'zoho':this[_0x581f('0x18')],'desk':this['deskAccounts'],'vtiger':this[_0x581f('0x1a')],'dynamics365':this[_0x581f('0x1c')],'freshsales':this[_0x581f('0x1d')],'servicenow':this[_0x581f('0x1b')]};ami['on'](_0x581f('0x1e'),this['syncCustomEvent'][_0x581f('0x1f')](this));ami['on'](_0x581f('0x20'),this[_0x581f('0x21')][_0x581f('0x1f')](this));ami['on'](_0x581f('0x22'),this['syncCustomEvent'][_0x581f('0x1f')](this));ami['on'](_0x581f('0x23'),this[_0x581f('0x21')][_0x581f('0x1f')](this));ami['on'](_0x581f('0x24'),this[_0x581f('0x21')][_0x581f('0x1f')](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0x581f('0x1f')](this));ami['on'](_0x581f('0x25'),this[_0x581f('0x21')][_0x581f('0x1f')](this));ami['on'](_0x581f('0x26'),this[_0x581f('0x21')]['bind'](this));ami['on'](_0x581f('0x27'),this['syncCustomEvent'][_0x581f('0x1f')](this));ami['on']('custom:queuecallerabandon',this[_0x581f('0x21')][_0x581f('0x1f')](this));ami['on'](_0x581f('0x28'),this[_0x581f('0x21')]['bind'](this));ami['on'](_0x581f('0x29'),this[_0x581f('0x2a')][_0x581f('0x1f')](this));ami['on'](_0x581f('0x2b'),this[_0x581f('0x2a')][_0x581f('0x1f')](this));ami['on']('custom:dialend',this[_0x581f('0x2a')][_0x581f('0x1f')](this));ami['on'](_0x581f('0x2c'),this[_0x581f('0x21')][_0x581f('0x1f')](this));ami['on']('custom:closedinteraction',this[_0x581f('0x21')][_0x581f('0x1f')](this));ami['on'](_0x581f('0x2d'),this['syncCustomEvent'][_0x581f('0x1f')](this));ami['on'](_0x581f('0x2e'),this['syncCustomEvent'][_0x581f('0x1f')](this));ami['on'](_0x581f('0x2f'),this[_0x581f('0x21')][_0x581f('0x1f')](this));ami['on'](_0x581f('0x30'),this[_0x581f('0x21')][_0x581f('0x1f')](this));}Trigger['prototype'][_0x581f('0x31')]=function(_0x2939c2,_0x5b6b92,_0x1aab65){logger['info'](_0x2939c2,_0x5b6b92,JSON[_0x581f('0x32')](_0x1aab65));io['to'](_0x2939c2)[_0x581f('0x31')](_0x5b6b92,_0x1aab65);};Trigger['prototype'][_0x581f('0x21')]=function(_0x60cd3a){var _0x2e1bc8=_[_0x581f('0x33')](_0x60cd3a);this[_0x581f('0x34')](_0x2e1bc8);};Trigger[_0x581f('0x35')]['syncAgentDial']=function(_0x27c566){if(this[_0x581f('0x10')][_0x27c566[_0x581f('0x36')]]){this[_0x581f('0x21')](_0x27c566);}};Trigger['prototype'][_0x581f('0x34')]=function(_0x1ed297){var _0xbaacad;for(var _0x79d61e in this[_0x581f('0x37')]){if(this[_0x581f('0x37')]['hasOwnProperty'](_0x79d61e)){if(this[_0x581f('0x37')][_0x79d61e][_0x581f('0x38')]){_0xbaacad=this['checkTrigger'](this['triggers'][_0x79d61e],_0x1ed297);if(_0xbaacad){_[_0x581f('0x39')](_0x1ed297,_0x1ed297[_0x581f('0x3a')]);for(var _0x1decfc=0x0,_0x13e13a,_0x2eec4f,_0x5377f1;_0x1decfc0x0){_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(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 552f4a4..e7f81f1 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 _0x764a=['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','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','name','ticketId','inspect','lodash','bluebird','request-promise','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','remoteUri','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','value','validateEmail','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','outbound','destcalleridnum','calleridnum','4.0','headers','odata-entityid','substring','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','type','string','customField','idField','content','ticketType','incidents','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','phonecalls','assign','callDirection','queue','lastIndexOf','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl'];(function(_0x2fbff6,_0xd47a5f){var _0x1d9e67=function(_0x53bca3){while(--_0x53bca3){_0x2fbff6['push'](_0x2fbff6['shift']());}};_0x1d9e67(++_0xd47a5f);}(_0x764a,0xce));var _0xa764=function(_0x16c80d,_0x5673d2){_0x16c80d=_0x16c80d-0x0;var _0x234a69=_0x764a[_0x16c80d];return _0x234a69;};'use strict';var _=require(_0xa764('0x0'));var BPromise=require(_0xa764('0x1'));var rp=require(_0xa764('0x2'));var util=require(_0xa764('0x3'));var intUtil=require(_0xa764('0x4'));var md5=require(_0xa764('0x5'));var Redis=require('ioredis');var logger=require(_0xa764('0x6'))(_0xa764('0x7'));var config=require(_0xa764('0x8'));config[_0xa764('0x9')]=_[_0xa764('0xa')](config[_0xa764('0x9')],{'host':_0xa764('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa764('0x9')]));function getAuthToken(_0x315f61,_0x21730a,_0x5b9269){var _0x38ea21={'method':_0xa764('0xc'),'uri':_0x21730a,'form':{'client_id':_0x315f61['clientId'],'resource':_0x315f61[_0xa764('0xd')],'username':_0x315f61[_0xa764('0xe')],'password':_0x315f61[_0xa764('0xf')],'grant_type':'password','client_secret':_0x315f61['clientSecret']},'json':!![]};return rp(_0x38ea21)[_0xa764('0x10')](function(_0x43d922){return _0x43d922[_0xa764('0x11')];})[_0xa764('0x12')](function(_0x495652){logger[_0xa764('0x13')]('['+[_0x5b9269[_0xa764('0x14')]()]+_0xa764('0x15'));return _0x495652[_0xa764('0x16')];});}function getUser(_0xcbf786,_0x10f666,_0x6b78ad,_0x26e27f,_0x3828cf,_0x507c67){return new BPromise(function(_0x523214,_0x4fc5df){return getAuthToken(_0x10f666,_0x26e27f,_0x507c67)[_0xa764('0x10')](function(_0x23e3f0){var _0x378ad9={'method':_0xa764('0x17'),'uri':_0x3828cf+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xa764('0x18')+_0x23e3f0,'OData-Version':'4.0'},'json':!![]};return rp(_0x378ad9);})[_0xa764('0x10')](function(_0x58e85a){var _0x860d94=_0x58e85a[_0xa764('0x19')];var _0x521e3f=![];var _0x1aefdb=null;if(!_['isNil'](_0x6b78ad)){if(intUtil[_0xa764('0x1a')](_0x6b78ad[_0xa764('0x1b')])){_0xcbf786[_0xa764('0x1c')]=_0x6b78ad['email'];for(_0x1aefdb=0x0;_0x1aefdb<_0x860d94['length'];_0x1aefdb++){if(_0x860d94[_0x1aefdb][_0xa764('0x1d')]===_0x6b78ad[_0xa764('0x1b')]&&!_0x860d94[_0x1aefdb][_0xa764('0x1e')]){_0x521e3f=!![];logger[_0xa764('0x1f')]('['+[_0x507c67[_0xa764('0x14')]()]+_0xa764('0x20')+_0x860d94[_0x1aefdb][_0xa764('0x21')]+'!');_0xcbf786[_0xa764('0x22')]=_0x860d94[_0x1aefdb]['systemuserid'];}}}}if(!_0x521e3f){logger[_0xa764('0x1f')]('['+[_0x507c67['toUpperCase']()]+_0xa764('0x23'));_0xcbf786[_0xa764('0x1c')]=_0x10f666['username'];for(_0x1aefdb=0x0;_0x1aefdb<_0x860d94[_0xa764('0x24')];_0x1aefdb++){if(_0x860d94[_0x1aefdb][_0xa764('0x1d')]===_0x10f666[_0xa764('0xe')]){_0xcbf786[_0xa764('0x22')]=_0x860d94[_0x1aefdb]['systemuserid'];}}}_0x523214(_0xcbf786);})[_0xa764('0x12')](function(_0x24bbfa){_0x4fc5df(_0x24bbfa[_0xa764('0x16')]);});});}function createEndUser(_0x271c3c,_0x45eb8d,_0x4369cd,_0x2eaa57,_0x49ae2c,_0x2951f8){return new BPromise(function(_0x40c940,_0x59600f){return getAuthToken(_0x45eb8d,_0x4369cd,_0x2951f8)[_0xa764('0x10')](function(_0x314b01){var _0x5386e7=_0x2951f8[_0xa764('0x25')]()===_0xa764('0x26')?_0x49ae2c[_0xa764('0x27')]:_0x49ae2c[_0xa764('0x28')];var _0x11ba48={'method':_0xa764('0xc'),'uri':_0x2eaa57+'contacts','body':{'telephone1':_0x5386e7,'fullname':_0x5386e7,'firstname':_0x5386e7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x271c3c[_0xa764('0x22')]+')'},'headers':{'Authorization':_0xa764('0x18')+_0x314b01,'OData-Version':_0xa764('0x29')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x11ba48);})['then'](function(_0x462f62){var _0xc034b1=_0x462f62[_0xa764('0x2a')][_0xa764('0x2b')];var _0x1ddd1b=_0xc034b1[_0xa764('0x2c')](_0xc034b1['lastIndexOf']('(')+0x1,_0xc034b1['lastIndexOf'](')'));_0x271c3c[_0xa764('0x2d')]=_0x1ddd1b;_0x40c940(_0x271c3c);})[_0xa764('0x12')](function(_0x2adb33){_0x59600f(_0x2adb33[_0xa764('0x16')]);});});}function getEndUser(_0x311aa3,_0x1ff20e,_0x146461,_0x777de0,_0xaf6628,_0x537527){return new BPromise(function(_0x566991,_0x20346f){return getAuthToken(_0x1ff20e,_0x146461,_0x537527)[_0xa764('0x10')](function(_0x4adfe3){var _0x59781a={'method':_0xa764('0x17'),'uri':_0x777de0+_0xa764('0x2e'),'headers':{'Authorization':_0xa764('0x18')+_0x4adfe3,'If-None-Match':null,'OData-Version':_0xa764('0x29')},'json':!![]};return rp(_0x59781a);})[_0xa764('0x10')](function(_0x329462){var _0x222098=null;if(_0x329462){var _0x21898c=_0x329462[_0xa764('0x19')];var _0x5d4a01=![];for(_0x222098=0x0;_0x222098<_0x21898c[_0xa764('0x24')];_0x222098++){var _0x46b92e=_0x537527[_0xa764('0x25')]()===_0xa764('0x26')?_0xaf6628[_0xa764('0x27')]:_0xaf6628[_0xa764('0x28')];if(_0x21898c[_0x222098][_0xa764('0x2f')]===_0x46b92e){_0x5d4a01=!![];_0x311aa3[_0xa764('0x2d')]=_0x21898c[_0x222098][_0xa764('0x30')];}}if(_0x5d4a01){_0x566991(_0x311aa3);}else{return createEndUser(_0x311aa3,_0x1ff20e,_0x146461,_0x777de0,_0xaf6628,_0x537527)[_0xa764('0x10')](function(_0x37f508){logger[_0xa764('0x1f')]('['+[_0x537527['toUpperCase']()]+_0xa764('0x31'),_0x37f508[_0xa764('0x2d')]);_0x566991(_0x37f508);});}}else{return createEndUser(_0x311aa3,_0x1ff20e,_0x146461,_0x777de0,_0xaf6628,_0x537527)[_0xa764('0x10')](function(_0x26f2d1){logger[_0xa764('0x1f')]('['+[_0x537527['toUpperCase']()]+_0xa764('0x32'),_0x26f2d1[_0xa764('0x2d')]);_0x566991(_0x26f2d1);});}});});}function getCustomFields(_0x2392cd,_0xc6920e,_0x23c0cd){var _0x50c41a={};if(_0x2392cd[_0xa764('0x24')]>0x0){_['forEach'](_0x2392cd,function(_0x3524fb){if(_0x3524fb[_0xa764('0x33')]===_0xa764('0x34')&&_0x3524fb['nameField']&&!_0x3524fb[_0xa764('0x35')]){var _0x5b5ab1=_0x3524fb[_0xa764('0x36')]['toLowerCase']();var _0x19239c=_0x5b5ab1[_0xa764('0x2c')](0x0,_0x5b5ab1['indexOf']('_'));var _0x38bbd4=_0x5b5ab1['substring'](_0x5b5ab1['indexOf']('_')+0x1);if(_0x19239c===_0x23c0cd){_0x50c41a[_0x38bbd4]=_0x3524fb[_0xa764('0x37')];}}});}return _0x50c41a;}function getTicket(_0x35e480,_0x1a2a27,_0x39f049,_0x82cfc3,_0x3049e1,_0x67b644,_0x5025e){return new BPromise(function(_0x444fbf,_0x14e562){var _0x1620e9;return getAuthToken(_0x1a2a27,_0x39f049,_0x5025e)[_0xa764('0x10')](function(_0x4edf28){if(_0x67b644[_0xa764('0x38')]==='incident'){_0x1620e9={'method':_0xa764('0xc'),'uri':_0x82cfc3+_0xa764('0x39'),'body':Object['assign']({},{'title':intUtil[_0xa764('0x3a')](_0x67b644[_0xa764('0x3b')],_0x3049e1,'\x20'),'description':intUtil[_0xa764('0x3a')](_0x67b644[_0xa764('0x3c')],_0x3049e1,'\x0a'),'customerid_contact@odata.bind':_0xa764('0x3d')+_0x35e480[_0xa764('0x2d')]+')','ownerid@odata.bind':_0xa764('0x3e')+_0x35e480[_0xa764('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x67b644[_0xa764('0x3f')],_0x3049e1,_0x67b644[_0xa764('0x38')])),'headers':{'Authorization':_0xa764('0x18')+_0x4edf28,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x67b644[_0xa764('0x38')]===_0xa764('0x40')){_0x1620e9={'method':_0xa764('0xc'),'uri':_0x82cfc3+_0xa764('0x41'),'body':Object[_0xa764('0x42')]({},{'subject':intUtil['getString'](_0x67b644[_0xa764('0x3b')],_0x3049e1,'\x20'),'phonenumber':String(_0x3049e1[_0xa764('0x28')]),'description':intUtil['getString'](_0x67b644[_0xa764('0x3c')],_0x3049e1,'\x0a'),'regardingobjectid_contact@odata.bind':_0xa764('0x3d')+_0x35e480[_0xa764('0x2d')]+')','ownerid@odata.bind':'/systemusers('+_0x35e480[_0xa764('0x22')]+')','directioncode':_0x35e480[_0xa764('0x43')]===_0xa764('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xa764('0x3e')+_0x35e480[_0xa764('0x22')]+')','participationtypemask':_0x35e480[_0xa764('0x43')]===_0xa764('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0xa764('0x3d')+_0x35e480[_0xa764('0x2d')]+')','participationtypemask':_0x35e480[_0xa764('0x43')]==='queue'?0x1:0x2}]},getCustomFields(_0x67b644[_0xa764('0x3f')],_0x3049e1,_0x67b644[_0xa764('0x38')])),'headers':{'Authorization':_0xa764('0x18')+_0x4edf28,'OData-Version':_0xa764('0x29')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1620e9);})[_0xa764('0x10')](function(_0x63de0d){var _0x1446d2=_0x63de0d['headers'][_0xa764('0x2b')];var _0x590a54=_0x1446d2[_0xa764('0x2c')](_0x1446d2[_0xa764('0x45')]('(')+0x1,_0x1446d2[_0xa764('0x45')](')'));_0x35e480['ticketId']=_0x590a54;_0x444fbf(_0x35e480);})['catch'](function(_0x27c5ed){_0x14e562(_0x27c5ed[_0xa764('0x16')]);});});}function emit(_0x3b5b38,_0x544ea9,_0x9a6a7f,_0x31cf1c){var _0x4eb523={'uri':util[_0xa764('0x46')](_0xa764('0x47'),_0x3b5b38,_0x9a6a7f,_0x31cf1c)};io['to'](util[_0xa764('0x46')](_0xa764('0x48'),_0x544ea9))[_0xa764('0x49')]('trigger:browser:url',_0x4eb523);}exports['cs']=function(_0x26dfbd,_0x477356,_0x211980,_0x3c4fc5,_0x4982de,_0x46b356,_0x2052fe,_0x50c7eb){var _0x2c8869={};_0x46b356[_0xa764('0xd')]=intUtil[_0xa764('0x4a')](_0x46b356['remoteUri']);_0x46b356[_0xa764('0x4b')]=intUtil[_0xa764('0x4a')](_0x46b356[_0xa764('0x4b')]);_0x2c8869[_0xa764('0x43')]=_0x50c7eb===_0xa764('0x44')||_0x50c7eb===_0xa764('0x4c')?_0xa764('0x44'):_0xa764('0x26');var _0x4b639e=util['format'](_0xa764('0x4d'),_0x46b356['remoteUri']);var _0x4271e5=util[_0xa764('0x46')](_0xa764('0x4e'),_0x46b356[_0xa764('0x4f')]);var _0x5c234a=util[_0xa764('0x46')](_0xa764('0x50'),_0x46b356[_0xa764('0x4b')],_0x477356[_0xa764('0x51')],md5(_0x477356['uniqueid']));if(_0x4982de&&_0x4982de[_0xa764('0x52')]){logger[_0xa764('0x1f')]('[QUEUE]',_0xa764('0x53'));_0x477356[_0xa764('0x54')]=_0x5c234a;}else if(_0x2052fe&&_0x2052fe[_0xa764('0x55')]&&_0x2052fe['recordingFormat']!=='none'){logger[_0xa764('0x1f')](_0xa764('0x56'),'Recording\x20is\x20enabled!');_0x477356[_0xa764('0x54')]=_0x5c234a;}else{_0x477356[_0xa764('0x54')]='';}return getUser(_0x2c8869,_0x46b356,_0x3c4fc5,_0x4271e5,_0x4b639e,_0x50c7eb)[_0xa764('0x10')](function(_0xbdeb49){logger[_0xa764('0x1f')]('['+_0x50c7eb[_0xa764('0x14')]()+_0xa764('0x57'),_0xbdeb49[_0xa764('0x22')]);logger[_0xa764('0x1f')]('['+_0x50c7eb[_0xa764('0x14')]()+_0xa764('0x58'),_0xbdeb49['userEmail']);return getEndUser(_0xbdeb49,_0x46b356,_0x4271e5,_0x4b639e,_0x477356,_0x50c7eb);})[_0xa764('0x10')](function(_0x5f45f6){logger[_0xa764('0x1f')]('['+_0x50c7eb[_0xa764('0x14')]()+_0xa764('0x59'),_0x5f45f6[_0xa764('0x2d')]);logger[_0xa764('0x1f')]('['+_0x50c7eb[_0xa764('0x14')]()+_0xa764('0x5a'),_0x477356[_0xa764('0x28')]);return getTicket(_0x5f45f6,_0x46b356,_0x4271e5,_0x4b639e,_0x477356,_0x211980,_0x50c7eb);})[_0xa764('0x10')](function(_0x3fa4dd){logger[_0xa764('0x1f')](util[_0xa764('0x46')]('['+_0x50c7eb[_0xa764('0x14')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x211980['ticketType'],_0x3fa4dd['ticketId']));logger[_0xa764('0x1f')](util['format']('['+_0x50c7eb[_0xa764('0x14')]()+']\x20Call\x20direction:\x20%s',_0x50c7eb));if(_0x50c7eb!=='unmanaged'){logger[_0xa764('0x1f')]('['+_0x50c7eb['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x46b356['remoteUri'],_0x3c4fc5[_0xa764('0x5b')],_0x211980['ticketType'],_0x3fa4dd[_0xa764('0x5c')]);}})[_0xa764('0x12')](function(_0x3081c6){logger['error']('['+_0x50c7eb[_0xa764('0x14')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0xa764('0x5d')](_0x3081c6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2bc4=['serverUrl','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','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','password','clientSecret','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','internalemailaddress','info',']\x20Agent\x20found\x20','userId','systemuserid','userEmail','username','length','outbound','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','contacts?$select=telephone1','toLowerCase','destcalleridnum','enduserId',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','customField','idField','indexOf','content','incident','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','callDirection','queue','format','user:%s','trigger:browser:url','stripTrailingSlash'];(function(_0x4fde0e,_0x42909e){var _0x359da0=function(_0xa21082){while(--_0xa21082){_0x4fde0e['push'](_0x4fde0e['shift']());}};_0x359da0(++_0x42909e);}(_0x2bc4,0x139));var _0x42bc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2bc4[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x42bc('0x0'));var BPromise=require(_0x42bc('0x1'));var rp=require('request-promise');var util=require(_0x42bc('0x2'));var intUtil=require(_0x42bc('0x3'));var md5=require(_0x42bc('0x4'));var Redis=require(_0x42bc('0x5'));var logger=require('../../../../config/logger')(_0x42bc('0x6'));var config=require(_0x42bc('0x7'));config[_0x42bc('0x8')]=_[_0x42bc('0x9')](config[_0x42bc('0x8')],{'host':_0x42bc('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x42bc('0x8')]));function getAuthToken(_0x4ec8be,_0x3bbfff,_0x3ab83f){var _0x566fb2={'method':_0x42bc('0xb'),'uri':_0x3bbfff,'form':{'client_id':_0x4ec8be[_0x42bc('0xc')],'resource':_0x4ec8be[_0x42bc('0xd')],'username':_0x4ec8be['username'],'password':_0x4ec8be[_0x42bc('0xe')],'grant_type':_0x42bc('0xe'),'client_secret':_0x4ec8be[_0x42bc('0xf')]},'json':!![]};return rp(_0x566fb2)[_0x42bc('0x10')](function(_0x1a6b05){return _0x1a6b05['access_token'];})[_0x42bc('0x11')](function(_0x594d72){logger[_0x42bc('0x12')]('['+[_0x3ab83f[_0x42bc('0x13')]()]+_0x42bc('0x14'));return _0x594d72[_0x42bc('0x15')];});}function getUser(_0x43e59c,_0x1e9f2f,_0x29d5b5,_0x180990,_0x93666e,_0x4b275f){return new BPromise(function(_0x49baff,_0x49dbbd){return getAuthToken(_0x1e9f2f,_0x180990,_0x4b275f)[_0x42bc('0x10')](function(_0x53cb82){var _0x4116eb={'method':_0x42bc('0x16'),'uri':_0x93666e+_0x42bc('0x17'),'headers':{'Authorization':_0x42bc('0x18')+_0x53cb82,'OData-Version':_0x42bc('0x19')},'json':!![]};return rp(_0x4116eb);})[_0x42bc('0x10')](function(_0x4129a1){var _0x554870=_0x4129a1[_0x42bc('0x1a')];var _0x4bdd9e=![];var _0x58132c=null;if(!_['isNil'](_0x29d5b5)){if(intUtil[_0x42bc('0x1b')](_0x29d5b5[_0x42bc('0x1c')])){_0x43e59c['userEmail']=_0x29d5b5[_0x42bc('0x1c')];for(_0x58132c=0x0;_0x58132c<_0x554870['length'];_0x58132c++){if(_0x554870[_0x58132c][_0x42bc('0x1d')]===_0x29d5b5[_0x42bc('0x1c')]&&!_0x554870[_0x58132c]['isdisabled']){_0x4bdd9e=!![];logger[_0x42bc('0x1e')]('['+[_0x4b275f[_0x42bc('0x13')]()]+_0x42bc('0x1f')+_0x554870[_0x58132c]['systemuserid']+'!');_0x43e59c[_0x42bc('0x20')]=_0x554870[_0x58132c][_0x42bc('0x21')];}}}}if(!_0x4bdd9e){logger['info']('['+[_0x4b275f[_0x42bc('0x13')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x43e59c[_0x42bc('0x22')]=_0x1e9f2f[_0x42bc('0x23')];for(_0x58132c=0x0;_0x58132c<_0x554870[_0x42bc('0x24')];_0x58132c++){if(_0x554870[_0x58132c][_0x42bc('0x1d')]===_0x1e9f2f[_0x42bc('0x23')]){_0x43e59c[_0x42bc('0x20')]=_0x554870[_0x58132c][_0x42bc('0x21')];}}}_0x49baff(_0x43e59c);})['catch'](function(_0x3abbdc){_0x49dbbd(_0x3abbdc['message']);});});}function createEndUser(_0xff86b2,_0x132364,_0x400d72,_0x1a2e51,_0x12e206,_0x1f2dac){return new BPromise(function(_0x399c0a,_0x1766ae){return getAuthToken(_0x132364,_0x400d72,_0x1f2dac)['then'](function(_0x45057d){var _0x3b7922=_0x1f2dac['toLowerCase']()===_0x42bc('0x25')?_0x12e206['destcalleridnum']:_0x12e206[_0x42bc('0x26')];var _0x389b3b={'method':'POST','uri':_0x1a2e51+_0x42bc('0x27'),'body':{'telephone1':_0x3b7922,'fullname':_0x3b7922,'firstname':_0x3b7922,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x42bc('0x28')+_0xff86b2[_0x42bc('0x20')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x45057d,'OData-Version':_0x42bc('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x389b3b);})[_0x42bc('0x10')](function(_0x23ac49){var _0x3b042e=_0x23ac49[_0x42bc('0x29')][_0x42bc('0x2a')];var _0x918575=_0x3b042e[_0x42bc('0x2b')](_0x3b042e[_0x42bc('0x2c')]('(')+0x1,_0x3b042e['lastIndexOf'](')'));_0xff86b2['enduserId']=_0x918575;_0x399c0a(_0xff86b2);})[_0x42bc('0x11')](function(_0x584f0c){_0x1766ae(_0x584f0c[_0x42bc('0x15')]);});});}function getEndUser(_0x170faa,_0x38fcfc,_0x8d037,_0x23ecdb,_0x15db41,_0x316ccc){return new BPromise(function(_0x13ef11,_0x4cde9c){return getAuthToken(_0x38fcfc,_0x8d037,_0x316ccc)[_0x42bc('0x10')](function(_0x459038){var _0x344835={'method':'GET','uri':_0x23ecdb+_0x42bc('0x2d'),'headers':{'Authorization':_0x42bc('0x18')+_0x459038,'If-None-Match':null,'OData-Version':_0x42bc('0x19')},'json':!![]};return rp(_0x344835);})[_0x42bc('0x10')](function(_0x248dbd){var _0x785556=null;if(_0x248dbd){var _0x167083=_0x248dbd[_0x42bc('0x1a')];var _0x45a97d=![];for(_0x785556=0x0;_0x785556<_0x167083['length'];_0x785556++){var _0x59b782=_0x316ccc[_0x42bc('0x2e')]()===_0x42bc('0x25')?_0x15db41[_0x42bc('0x2f')]:_0x15db41[_0x42bc('0x26')];if(_0x167083[_0x785556]['telephone1']===_0x59b782){_0x45a97d=!![];_0x170faa[_0x42bc('0x30')]=_0x167083[_0x785556]['contactid'];}}if(_0x45a97d){_0x13ef11(_0x170faa);}else{return createEndUser(_0x170faa,_0x38fcfc,_0x8d037,_0x23ecdb,_0x15db41,_0x316ccc)[_0x42bc('0x10')](function(_0x4186cb){logger['info']('['+[_0x316ccc[_0x42bc('0x13')]()]+_0x42bc('0x31'),_0x4186cb[_0x42bc('0x30')]);_0x13ef11(_0x4186cb);});}}else{return createEndUser(_0x170faa,_0x38fcfc,_0x8d037,_0x23ecdb,_0x15db41,_0x316ccc)['then'](function(_0x49fdbd){logger['info']('['+[_0x316ccc[_0x42bc('0x13')]()]+_0x42bc('0x32'),_0x49fdbd[_0x42bc('0x30')]);_0x13ef11(_0x49fdbd);});}});});}function getCustomFields(_0x7238c8,_0x4c0b38,_0x4e8bd3){var _0x567820={};if(_0x7238c8[_0x42bc('0x24')]>0x0){_[_0x42bc('0x33')](_0x7238c8,function(_0xfe8091){if(_0xfe8091[_0x42bc('0x34')]===_0x42bc('0x35')&&_0xfe8091[_0x42bc('0x36')]&&!_0xfe8091[_0x42bc('0x37')]){var _0x42f81a=_0xfe8091[_0x42bc('0x38')][_0x42bc('0x2e')]();var _0x1e2e42=_0x42f81a['substring'](0x0,_0x42f81a[_0x42bc('0x39')]('_'));var _0x8e5935=_0x42f81a[_0x42bc('0x2b')](_0x42f81a[_0x42bc('0x39')]('_')+0x1);if(_0x1e2e42===_0x4e8bd3){_0x567820[_0x8e5935]=_0xfe8091[_0x42bc('0x3a')];}}});}return _0x567820;}function getTicket(_0x399ce6,_0x17497a,_0x3686b9,_0x786664,_0x533b5b,_0x224ac3,_0x1aa378){return new BPromise(function(_0x3cbf63,_0x1cc820){var _0x559ae1;return getAuthToken(_0x17497a,_0x3686b9,_0x1aa378)[_0x42bc('0x10')](function(_0x4493e7){if(_0x224ac3['ticketType']===_0x42bc('0x3b')){_0x559ae1={'method':_0x42bc('0xb'),'uri':_0x786664+'incidents','body':Object[_0x42bc('0x3c')]({},{'title':intUtil[_0x42bc('0x3d')](_0x224ac3[_0x42bc('0x3e')],_0x533b5b,'\x20'),'description':intUtil[_0x42bc('0x3d')](_0x224ac3[_0x42bc('0x3f')],_0x533b5b,'\x0a'),'customerid_contact@odata.bind':_0x42bc('0x40')+_0x399ce6['enduserId']+')','ownerid@odata.bind':_0x42bc('0x28')+_0x399ce6[_0x42bc('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x224ac3[_0x42bc('0x41')],_0x533b5b,_0x224ac3[_0x42bc('0x42')])),'headers':{'Authorization':_0x42bc('0x18')+_0x4493e7,'OData-Version':_0x42bc('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x224ac3[_0x42bc('0x42')]===_0x42bc('0x43')){_0x559ae1={'method':'POST','uri':_0x786664+_0x42bc('0x44'),'body':Object['assign']({},{'subject':intUtil[_0x42bc('0x3d')](_0x224ac3[_0x42bc('0x3e')],_0x533b5b,'\x20'),'phonenumber':String(_0x533b5b[_0x42bc('0x26')]),'description':intUtil[_0x42bc('0x3d')](_0x224ac3[_0x42bc('0x3f')],_0x533b5b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x42bc('0x40')+_0x399ce6[_0x42bc('0x30')]+')','ownerid@odata.bind':'/systemusers('+_0x399ce6['userId']+')','directioncode':_0x399ce6[_0x42bc('0x45')]===_0x42bc('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x42bc('0x28')+_0x399ce6[_0x42bc('0x20')]+')','participationtypemask':_0x399ce6[_0x42bc('0x45')]===_0x42bc('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x42bc('0x40')+_0x399ce6[_0x42bc('0x30')]+')','participationtypemask':_0x399ce6[_0x42bc('0x45')]===_0x42bc('0x46')?0x1:0x2}]},getCustomFields(_0x224ac3[_0x42bc('0x41')],_0x533b5b,_0x224ac3[_0x42bc('0x42')])),'headers':{'Authorization':_0x42bc('0x18')+_0x4493e7,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x559ae1);})[_0x42bc('0x10')](function(_0x2a271f){var _0x48f33b=_0x2a271f['headers'][_0x42bc('0x2a')];var _0x53f084=_0x48f33b[_0x42bc('0x2b')](_0x48f33b[_0x42bc('0x2c')]('(')+0x1,_0x48f33b[_0x42bc('0x2c')](')'));_0x399ce6['ticketId']=_0x53f084;_0x3cbf63(_0x399ce6);})[_0x42bc('0x11')](function(_0x4164a0){_0x1cc820(_0x4164a0[_0x42bc('0x15')]);});});}function emit(_0x3446a3,_0xd18a63,_0x5bd7b3,_0x527348){var _0x591990={'uri':util[_0x42bc('0x47')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3446a3,_0x5bd7b3,_0x527348)};io['to'](util[_0x42bc('0x47')](_0x42bc('0x48'),_0xd18a63))['emit'](_0x42bc('0x49'),_0x591990);}exports['cs']=function(_0x15a99d,_0x1e01fe,_0x2a0e91,_0x24f23f,_0x79e538,_0x28b5e9,_0x214908,_0x11bbc0){var _0x4c9e8a={};_0x28b5e9[_0x42bc('0xd')]=intUtil[_0x42bc('0x4a')](_0x28b5e9[_0x42bc('0xd')]);_0x28b5e9[_0x42bc('0x4b')]=intUtil[_0x42bc('0x4a')](_0x28b5e9[_0x42bc('0x4b')]);_0x4c9e8a[_0x42bc('0x45')]=_0x11bbc0==='queue'||_0x11bbc0===_0x42bc('0x4c')?_0x42bc('0x46'):_0x42bc('0x25');var _0x22c42c=util[_0x42bc('0x47')](_0x42bc('0x4d'),_0x28b5e9[_0x42bc('0xd')]);var _0x3ed374=util['format'](_0x42bc('0x4e'),_0x28b5e9[_0x42bc('0x4f')]);var _0x296a29=util['format'](_0x42bc('0x50'),_0x28b5e9[_0x42bc('0x4b')],_0x1e01fe[_0x42bc('0x51')],md5(_0x1e01fe[_0x42bc('0x51')]));if(_0x79e538&&_0x79e538[_0x42bc('0x52')]){logger['info'](_0x42bc('0x53'),_0x42bc('0x54'));_0x1e01fe[_0x42bc('0x55')]=_0x296a29;}else if(_0x214908&&_0x214908[_0x42bc('0x56')]&&_0x214908[_0x42bc('0x56')]!==_0x42bc('0x57')){logger[_0x42bc('0x1e')](_0x42bc('0x58'),'Recording\x20is\x20enabled!');_0x1e01fe[_0x42bc('0x55')]=_0x296a29;}else{_0x1e01fe[_0x42bc('0x55')]='';}return getUser(_0x4c9e8a,_0x28b5e9,_0x24f23f,_0x3ed374,_0x22c42c,_0x11bbc0)[_0x42bc('0x10')](function(_0x510a40){logger['info']('['+_0x11bbc0[_0x42bc('0x13')]()+']\x20The\x20User\x20ID\x20is:',_0x510a40[_0x42bc('0x20')]);logger['info']('['+_0x11bbc0[_0x42bc('0x13')]()+_0x42bc('0x59'),_0x510a40[_0x42bc('0x22')]);return getEndUser(_0x510a40,_0x28b5e9,_0x3ed374,_0x22c42c,_0x1e01fe,_0x11bbc0);})['then'](function(_0x5c9111){logger[_0x42bc('0x1e')]('['+_0x11bbc0['toUpperCase']()+_0x42bc('0x5a'),_0x5c9111[_0x42bc('0x30')]);logger['info']('['+_0x11bbc0['toUpperCase']()+_0x42bc('0x5b'),_0x1e01fe['calleridnum']);return getTicket(_0x5c9111,_0x28b5e9,_0x3ed374,_0x22c42c,_0x1e01fe,_0x2a0e91,_0x11bbc0);})[_0x42bc('0x10')](function(_0x5298f7){logger[_0x42bc('0x1e')](util['format']('['+_0x11bbc0[_0x42bc('0x13')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x2a0e91[_0x42bc('0x42')],_0x5298f7[_0x42bc('0x5c')]));logger[_0x42bc('0x1e')](util[_0x42bc('0x47')]('['+_0x11bbc0['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x11bbc0));if(_0x11bbc0!==_0x42bc('0x4c')){logger[_0x42bc('0x1e')]('['+_0x11bbc0[_0x42bc('0x13')]()+']',_0x42bc('0x5d'));emit(_0x28b5e9[_0x42bc('0xd')],_0x24f23f[_0x42bc('0x5e')],_0x2a0e91['ticketType'],_0x5298f7[_0x42bc('0x5c')]);}})['catch'](function(_0x29544d){logger['error']('['+_0x11bbc0[_0x42bc('0x13')]()+_0x42bc('0x5f'),util[_0x42bc('0x60')](_0x29544d,{'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 85c2dfa..32d24ef 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 _0x6822=['mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','push','variable','variableName','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','catch','error','unmanaged','lastevent','toUpperCase','Ticket\x20created!','lodash','request-promise','md5','util','ioredis','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','custom_fields'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6822,0x14e));var _0x2682=function(_0x528020,_0x423c46){_0x528020=_0x528020-0x0;var _0x70a02a=_0x6822[_0x528020];return _0x70a02a;};'use strict';var _=require(_0x2682('0x0'));var rp=require(_0x2682('0x1'));var md5=require(_0x2682('0x2'));var util=require(_0x2682('0x3'));var Redis=require(_0x2682('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x2682('0x5'));config[_0x2682('0x6')]=_[_0x2682('0x7')](config[_0x2682('0x6')],{'host':_0x2682('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2682('0x6')]));var headers={'Content-Type':'application/json','Accept':_0x2682('0x9')};function emit(_0x24fad7,_0x5d56b5,_0x46ac31){io['to'](_0x24fad7)[_0x2682('0xa')](_0x5d56b5,_0x46ac31);}function getTicket(_0x393b95,_0x39edbf,_0x1b7a2f,_0x485ef9,_0x4b6e69){logger[_0x2682('0xb')](_0x2682('0xc'));var _0x2437b0=_['merge']({'responder_id':_0x39edbf['id'],'requester_id':_0x1b7a2f['id'],'name':util[_0x2682('0xd')]('Caller\x20-\x20%s',_0x4b6e69[_0x2682('0xe')]),'phone':_0x4b6e69[_0x2682('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2682('0x10')](_0x485ef9[_0x2682('0x11')],_0x4b6e69,'\x20'),'description':intUtil[_0x2682('0x10')](_0x485ef9[_0x2682('0x12')],_0x4b6e69,_0x2682('0x13')),'tags':getTags(_0x485ef9['Tags'],_0x2682('0x14'))},getCustomFields(_0x485ef9['Fields'],_0x4b6e69));_0x2437b0[_0x2682('0x15')]=_[_0x2682('0x16')](_[_0x2682('0x17')](_0x2437b0[_0x2682('0x15')],'id'),'value');return request({'uri':util['format'](_0x2682('0x18'),_0x393b95[_0x2682('0x19')]),'method':_0x2682('0x1a'),'body':_0x2437b0})['then'](function(_0x123c62){logger['info']('Ticket\x20created!');return _0x123c62;});}function getUser(_0x44a249,_0x140e23){if(intUtil[_0x2682('0x1b')](_0x140e23)){return request({'uri':util[_0x2682('0xd')](_0x2682('0x1c'),_0x44a249[_0x2682('0x19')]),'qs':{'email':_0x140e23}})['then'](function(_0x3e7565){if(_0x3e7565[_0x2682('0x1d')]){logger[_0x2682('0xb')](_0x2682('0x1e'));return _[_0x2682('0x1f')](_0x3e7565,function(_0x5529ef){return _0x5529ef[_0x2682('0x20')][_0x2682('0x21')]===_0x140e23;});}else{logger['info'](_0x2682('0x22'));return request({'uri':util[_0x2682('0xd')](_0x2682('0x23'),_0x44a249['remoteUri'])})[_0x2682('0x24')](function(_0x1ccdce){logger['info'](_0x2682('0x25'));return _0x1ccdce;});}});}else{logger[_0x2682('0xb')](_0x2682('0x26'));return request({'uri':util[_0x2682('0xd')]('%s/api/v2/agents/me',_0x44a249[_0x2682('0x19')])})['then'](function(_0x5cf107){logger[_0x2682('0xb')](_0x2682('0x25'));return _0x5cf107;});}}function getEndUser(_0x306870,_0x5edffb,_0x84296f){logger['info'](_0x2682('0x27'),_0x84296f);return request({'uri':util[_0x2682('0xd')](_0x2682('0x28'),_0x306870[_0x2682('0x19')]),'qs':{'phone':_0x84296f}})['then'](function(_0x39c100){if(_0x39c100[_0x2682('0x1d')]){logger[_0x2682('0xb')]('Enduser\x20found!');return _[_0x2682('0x1f')](_0x39c100,{'phone':_0x84296f});}else{logger[_0x2682('0xb')](_0x2682('0x29'));return request({'uri':util['format'](_0x2682('0x28'),_0x306870['remoteUri']),'method':_0x2682('0x1a'),'body':{'name':_0x5edffb,'phone':_0x84296f}})['then'](function(_0x396afa){logger[_0x2682('0xb')](_0x2682('0x2a'));return _0x396afa;});}});}function getAuth(_0x24751c){return util[_0x2682('0xd')](_0x2682('0x2b'),new Buffer(_0x24751c[_0x2682('0x2c')]+':X')[_0x2682('0x2d')]('base64'));}function request(_0x52f624){logger[_0x2682('0x2e')](_0x2682('0x2f'),JSON[_0x2682('0x30')](_0x52f624));return rp(_[_0x2682('0x7')](_0x52f624,{'method':_0x2682('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x4bef3d,_0x45c772){var _0x253413=[];if(_0x4bef3d&&_0x4bef3d[_0x2682('0x1d')]>0x0){_0x253413=_[_0x2682('0x32')](_0x4bef3d,_0x45c772);}return _0x253413;}function getCustomFields(_0x2a3297,_0x11deda){var _0x501947=[];var _0x30beeb={'custom_fields':[]};if(_0x2a3297['length']>0x0){_[_0x2682('0x33')](_0x2a3297,function(_0x397241){if(_0x397241[_0x2682('0x34')]===_0x2682('0x35')&&_0x397241[_0x2682('0x36')]&&!_0x397241[_0x2682('0x37')]){_0x30beeb[_0x397241[_0x2682('0x36')][_0x2682('0x38')]()]=_0x397241[_0x2682('0x39')]['toString']();}else if(_0x397241[_0x2682('0x34')]===_0x2682('0x35')&&_0x397241[_0x2682('0x3a')]&&_0x397241[_0x2682('0x37')]){_0x30beeb[_0x2682('0x15')][_0x2682('0x3b')]({'id':_0x397241[_0x2682('0x3a')],'value':_0x397241[_0x2682('0x39')]['toString']()});}else if(_0x397241[_0x2682('0x34')]===_0x2682('0x3c')&&_0x397241[_0x2682('0x3d')]&&_0x397241['idField']&&_0x397241[_0x2682('0x37')]){_0x11deda[_0x397241[_0x2682('0x3d')]]&&_0x30beeb[_0x2682('0x15')][_0x2682('0x3b')]({'id':_0x397241[_0x2682('0x3a')],'value':_0x11deda[_0x397241['variableName']][_0x2682('0x2d')]()});}else if(_0x397241[_0x2682('0x34')]==='customVariable'&&_0x397241[_0x2682('0x3e')]&&_0x397241[_0x2682('0x3e')][_0x2682('0x14')]&&_0x397241[_0x2682('0x3a')]&&_0x397241[_0x2682('0x37')]){_0x11deda[_0x397241[_0x2682('0x3e')][_0x2682('0x14')][_0x2682('0x38')]()]&&_0x30beeb['custom_fields'][_0x2682('0x3b')]({'id':_0x397241[_0x2682('0x3a')],'value':_0x11deda[_0x397241[_0x2682('0x3e')][_0x2682('0x14')][_0x2682('0x38')]()][_0x2682('0x2d')]()});}});}return _0x30beeb;}exports[_0x2682('0x3f')]=function(_0x41ca7e,_0x3e8bde,_0x1b156b,_0x1dbf0a,_0x5b2664,_0x435eee){var _0x54d6b4,_0x4c18a5;_0x435eee['remoteUri']=intUtil['stripTrailingSlash'](_0x435eee[_0x2682('0x19')]);_0x435eee[_0x2682('0x40')]=intUtil[_0x2682('0x41')](_0x435eee['serverUrl']);if(_0x5b2664&&_0x5b2664[_0x2682('0x42')]){logger['info'](_0x2682('0x43'),_0x2682('0x44'));_0x3e8bde['recordingURL']=util['format'](_0x2682('0x45'),_0x435eee['serverUrl'],_0x3e8bde[_0x2682('0x46')],md5(_0x3e8bde[_0x2682('0x46')]));}else{_0x3e8bde[_0x2682('0x47')]='';}headers['Authorization']=getAuth(_0x435eee);return getUser(_0x435eee,_0x1dbf0a[_0x2682('0x21')])['then'](function(_0x5cd538){_0x54d6b4=_0x5cd538;logger[_0x2682('0xb')](_0x2682('0x48'),_0x54d6b4['id']);return getEndUser(_0x435eee,_0x3e8bde[_0x2682('0xe')],_0x3e8bde['calleridnum']);})[_0x2682('0x24')](function(_0x36617e){_0x4c18a5=_0x36617e;logger[_0x2682('0xb')](_0x2682('0x49'),_0x4c18a5['id']);return getTicket(_0x435eee,_0x54d6b4,_0x4c18a5,_0x1b156b,_0x3e8bde);})[_0x2682('0x24')](function(_0xb9c5dc){if(_0xb9c5dc&&_0xb9c5dc['id']){logger['info']('Ticket\x20created!');logger['info'](_0x2682('0x4a'),_0xb9c5dc['id']);logger[_0x2682('0xb')](_0x2682('0x43'),_0x2682('0x4b'));emit(util[_0x2682('0xd')](_0x2682('0x4c'),_0x1dbf0a[_0x2682('0x14')]),_0x2682('0x4d'),{'uri':util[_0x2682('0xd')](_0x2682('0x4e'),_0x435eee['remoteUri'],_0xb9c5dc['id'])});}})['catch'](function(_0x3ba9c0){logger['error'](_0x2682('0x43'),JSON['stringify'](_0x3ba9c0));});};exports['outbound']=function(_0x593fbe,_0x48b2e7,_0x92953f,_0x202a7b,_0x433dbf,_0x527bc9,_0x594a91){var _0xcea2b9,_0xe6cbb0;_0x527bc9[_0x2682('0x19')]=intUtil[_0x2682('0x41')](_0x527bc9[_0x2682('0x19')]);_0x527bc9[_0x2682('0x40')]=intUtil[_0x2682('0x41')](_0x527bc9[_0x2682('0x40')]);if(_0x594a91&&_0x594a91[_0x2682('0x4f')]&&_0x594a91[_0x2682('0x4f')]!=='none'){logger[_0x2682('0xb')](_0x2682('0x50'),_0x2682('0x44'));_0x48b2e7[_0x2682('0x47')]=util[_0x2682('0xd')](_0x2682('0x45'),_0x527bc9[_0x2682('0x40')],_0x48b2e7['uniqueid'],md5(_0x48b2e7['uniqueid']));}headers[_0x2682('0x51')]=getAuth(_0x527bc9);return getUser(_0x527bc9,_0x202a7b['email'])[_0x2682('0x24')](function(_0x301fc4){_0xcea2b9=_0x301fc4;logger[_0x2682('0xb')](_0x2682('0x48'),_0xcea2b9['id']);return getEndUser(_0x527bc9,_0x48b2e7[_0x2682('0x52')],_0x48b2e7['destcalleridnum']);})[_0x2682('0x24')](function(_0x24061a){_0xe6cbb0=_0x24061a;logger['info'](_0x2682('0x49'),_0xe6cbb0['id']);return getTicket(_0x527bc9,_0xcea2b9,_0xe6cbb0,_0x92953f,_0x48b2e7);})['then'](function(_0x2fe981){if(_0x2fe981&&_0x2fe981['id']){logger[_0x2682('0xb')]('Ticket\x20created!');logger[_0x2682('0xb')](_0x2682('0x4a'),_0x2fe981['id']);logger[_0x2682('0xb')](_0x2682('0x50'),_0x2682('0x4b'));emit(util[_0x2682('0xd')](_0x2682('0x4c'),_0x202a7b[_0x2682('0x14')]),'trigger:browser:url',{'uri':util[_0x2682('0xd')](_0x2682('0x4e'),_0x527bc9['remoteUri'],_0x2fe981['id'])});}})[_0x2682('0x53')](function(_0x9d1b22){logger[_0x2682('0x54')](_0x2682('0x50'),JSON[_0x2682('0x30')](_0x9d1b22));});};exports[_0x2682('0x55')]=function(_0x23bbf9,_0x1c0016,_0x2fe42e,_0x55cc31,_0x403144,_0x337230){var _0x55a622,_0x4c10a4;_0x337230[_0x2682('0x19')]=intUtil[_0x2682('0x41')](_0x337230[_0x2682('0x19')]);_0x337230[_0x2682('0x40')]=intUtil[_0x2682('0x41')](_0x337230['serverUrl']);if(_0x403144&&_0x403144['monitor_format']){logger['info']('['+_0x1c0016[_0x2682('0x56')][_0x2682('0x57')]()+']',_0x2682('0x44'));_0x1c0016['recordingURL']=util[_0x2682('0xd')](_0x2682('0x45'),_0x337230[_0x2682('0x40')],_0x1c0016[_0x2682('0x46')],md5(_0x1c0016[_0x2682('0x46')]));}else{_0x1c0016[_0x2682('0x47')]='';}headers[_0x2682('0x51')]=getAuth(_0x337230);return getUser(_0x337230,'')[_0x2682('0x24')](function(_0x2747ce){_0x55a622=_0x2747ce;logger[_0x2682('0xb')](_0x2682('0x48'),_0x55a622['id']);return getEndUser(_0x337230,_0x1c0016[_0x2682('0xe')],_0x1c0016[_0x2682('0xf')]);})[_0x2682('0x24')](function(_0x4dae00){_0x4c10a4=_0x4dae00;logger[_0x2682('0xb')](_0x2682('0x49'),_0x4c10a4['id']);return getTicket(_0x337230,_0x55a622,_0x4c10a4,_0x2fe42e,_0x1c0016);})[_0x2682('0x24')](function(_0x2071a7){if(_0x2071a7){logger[_0x2682('0xb')](_0x2682('0x58'));logger[_0x2682('0xb')](_0x2682('0x4a'),_0x2071a7['id']);}})['catch'](function(_0x4a69df){logger[_0x2682('0x54')]('['+_0x1c0016['lastevent']['toUpperCase']()+']',JSON[_0x2682('0x30')](_0x4a69df));});}; \ No newline at end of file +var _0xd1c3=['The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','error','unmanaged','toUpperCase','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','value','format','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','find','contact','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','toLowerCase','content','customField','push','idField','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:'];(function(_0x4789a2,_0xb2ebf5){var _0x31c5c0=function(_0x37ecf0){while(--_0x37ecf0){_0x4789a2['push'](_0x4789a2['shift']());}};_0x31c5c0(++_0xb2ebf5);}(_0xd1c3,0x11d));var _0x3d1c=function(_0x567e25,_0xb3ff67){_0x567e25=_0x567e25-0x0;var _0x4c3990=_0xd1c3[_0x567e25];return _0x4c3990;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x3d1c('0x0'));var util=require(_0x3d1c('0x1'));var Redis=require(_0x3d1c('0x2'));var intUtil=require(_0x3d1c('0x3'));var config=require(_0x3d1c('0x4'));var logger=require(_0x3d1c('0x5'))(_0x3d1c('0x6'));config[_0x3d1c('0x7')]=_[_0x3d1c('0x8')](config['redis'],{'host':_0x3d1c('0x9'),'port':0x18eb});var io=require(_0x3d1c('0xa'))(new Redis(config[_0x3d1c('0x7')]));var headers={'Content-Type':_0x3d1c('0xb'),'Accept':'application/json'};function emit(_0x11eff3,_0xf00d26,_0x329e7c){io['to'](_0x11eff3)[_0x3d1c('0xc')](_0xf00d26,_0x329e7c);}function getTicket(_0x271218,_0x4f8d3e,_0x2b89b1,_0x11abfb,_0x1633ce){logger[_0x3d1c('0xd')](_0x3d1c('0xe'));var _0x5707e1=_[_0x3d1c('0xf')]({'responder_id':_0x4f8d3e['id'],'requester_id':_0x2b89b1['id'],'name':util['format'](_0x3d1c('0x10'),_0x1633ce['calleridname']),'phone':_0x1633ce[_0x3d1c('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x3d1c('0x12')](_0x11abfb[_0x3d1c('0x13')],_0x1633ce,'\x20'),'description':intUtil[_0x3d1c('0x12')](_0x11abfb[_0x3d1c('0x14')],_0x1633ce,_0x3d1c('0x15')),'tags':getTags(_0x11abfb['Tags'],_0x3d1c('0x16'))},getCustomFields(_0x11abfb[_0x3d1c('0x17')],_0x1633ce));_0x5707e1[_0x3d1c('0x18')]=_[_0x3d1c('0x19')](_['keyBy'](_0x5707e1[_0x3d1c('0x18')],'id'),_0x3d1c('0x1a'));return request({'uri':util[_0x3d1c('0x1b')]('%s/api/v2/tickets',_0x271218[_0x3d1c('0x1c')]),'method':_0x3d1c('0x1d'),'body':_0x5707e1})[_0x3d1c('0x1e')](function(_0x3f403b){logger['info'](_0x3d1c('0x1f'));return _0x3f403b;});}function getUser(_0x56d11c,_0x538f2c){if(intUtil[_0x3d1c('0x20')](_0x538f2c)){return request({'uri':util[_0x3d1c('0x1b')]('%s/api/v2/agents',_0x56d11c['remoteUri']),'qs':{'email':_0x538f2c}})['then'](function(_0x869bd7){if(_0x869bd7[_0x3d1c('0x21')]){logger['info']('Agent\x20found!');return _[_0x3d1c('0x22')](_0x869bd7,function(_0x338ef1){return _0x338ef1[_0x3d1c('0x23')]['email']===_0x538f2c;});}else{logger[_0x3d1c('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3d1c('0x1b')](_0x3d1c('0x24'),_0x56d11c[_0x3d1c('0x1c')])})[_0x3d1c('0x1e')](function(_0x3d8bbb){logger[_0x3d1c('0xd')]('Admin\x20account\x20selected.');return _0x3d8bbb;});}});}else{logger['info'](_0x3d1c('0x25'));return request({'uri':util['format'](_0x3d1c('0x24'),_0x56d11c[_0x3d1c('0x1c')])})[_0x3d1c('0x1e')](function(_0x14b828){logger['info'](_0x3d1c('0x26'));return _0x14b828;});}}function getEndUser(_0x5a517c,_0x500071,_0x5e8fa9){logger[_0x3d1c('0xd')]('Searching\x20enduser\x20with\x20phone',_0x5e8fa9);return request({'uri':util[_0x3d1c('0x1b')](_0x3d1c('0x27'),_0x5a517c[_0x3d1c('0x1c')]),'qs':{'phone':_0x5e8fa9}})[_0x3d1c('0x1e')](function(_0x107efe){if(_0x107efe[_0x3d1c('0x21')]){logger[_0x3d1c('0xd')](_0x3d1c('0x28'));return _[_0x3d1c('0x22')](_0x107efe,{'phone':_0x5e8fa9});}else{logger[_0x3d1c('0xd')](_0x3d1c('0x29'));return request({'uri':util[_0x3d1c('0x1b')]('%s/api/v2/contacts',_0x5a517c[_0x3d1c('0x1c')]),'method':_0x3d1c('0x1d'),'body':{'name':_0x500071,'phone':_0x5e8fa9}})[_0x3d1c('0x1e')](function(_0x543f02){logger[_0x3d1c('0xd')](_0x3d1c('0x2a'));return _0x543f02;});}});}function getAuth(_0x5bf0f9){return util['format']('Basic\x20%s',new Buffer(_0x5bf0f9[_0x3d1c('0x2b')]+':X')[_0x3d1c('0x2c')](_0x3d1c('0x2d')));}function request(_0x1a3ead){logger[_0x3d1c('0x2e')](_0x3d1c('0x2f'),JSON[_0x3d1c('0x30')](_0x1a3ead));return rp(_[_0x3d1c('0x8')](_0x1a3ead,{'method':_0x3d1c('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x38e82d,_0x9b999a){var _0x4d3fe7=[];if(_0x38e82d&&_0x38e82d[_0x3d1c('0x21')]>0x0){_0x4d3fe7=_[_0x3d1c('0x32')](_0x38e82d,_0x9b999a);}return _0x4d3fe7;}function getCustomFields(_0x61c729,_0x2bf4f7){var _0x5a4a3f=[];var _0x4c4543={'custom_fields':[]};if(_0x61c729[_0x3d1c('0x21')]>0x0){_[_0x3d1c('0x33')](_0x61c729,function(_0x479c9f){if(_0x479c9f[_0x3d1c('0x34')]===_0x3d1c('0x35')&&_0x479c9f[_0x3d1c('0x36')]&&!_0x479c9f['customField']){_0x4c4543[_0x479c9f[_0x3d1c('0x36')][_0x3d1c('0x37')]()]=_0x479c9f[_0x3d1c('0x38')][_0x3d1c('0x2c')]();}else if(_0x479c9f[_0x3d1c('0x34')]===_0x3d1c('0x35')&&_0x479c9f['idField']&&_0x479c9f[_0x3d1c('0x39')]){_0x4c4543[_0x3d1c('0x18')][_0x3d1c('0x3a')]({'id':_0x479c9f[_0x3d1c('0x3b')],'value':_0x479c9f['content'][_0x3d1c('0x2c')]()});}else if(_0x479c9f['type']==='variable'&&_0x479c9f['variableName']&&_0x479c9f[_0x3d1c('0x3b')]&&_0x479c9f[_0x3d1c('0x39')]){_0x2bf4f7[_0x479c9f[_0x3d1c('0x3c')]]&&_0x4c4543[_0x3d1c('0x18')][_0x3d1c('0x3a')]({'id':_0x479c9f['idField'],'value':_0x2bf4f7[_0x479c9f[_0x3d1c('0x3c')]]['toString']()});}else if(_0x479c9f[_0x3d1c('0x34')]===_0x3d1c('0x3d')&&_0x479c9f[_0x3d1c('0x3e')]&&_0x479c9f[_0x3d1c('0x3e')][_0x3d1c('0x16')]&&_0x479c9f['idField']&&_0x479c9f['customField']){_0x2bf4f7[_0x479c9f[_0x3d1c('0x3e')][_0x3d1c('0x16')][_0x3d1c('0x37')]()]&&_0x4c4543[_0x3d1c('0x18')][_0x3d1c('0x3a')]({'id':_0x479c9f[_0x3d1c('0x3b')],'value':_0x2bf4f7[_0x479c9f[_0x3d1c('0x3e')][_0x3d1c('0x16')][_0x3d1c('0x37')]()][_0x3d1c('0x2c')]()});}});}return _0x4c4543;}exports[_0x3d1c('0x3f')]=function(_0x2bfda8,_0x2fea65,_0x22ef19,_0x40fecd,_0x31c305,_0x3be62d){var _0xd12e2a,_0x3ef847;_0x3be62d[_0x3d1c('0x1c')]=intUtil[_0x3d1c('0x40')](_0x3be62d[_0x3d1c('0x1c')]);_0x3be62d[_0x3d1c('0x41')]=intUtil['stripTrailingSlash'](_0x3be62d[_0x3d1c('0x41')]);if(_0x31c305&&_0x31c305[_0x3d1c('0x42')]){logger[_0x3d1c('0xd')](_0x3d1c('0x43'),'Recording\x20is\x20enabled!');_0x2fea65[_0x3d1c('0x44')]=util['format'](_0x3d1c('0x45'),_0x3be62d[_0x3d1c('0x41')],_0x2fea65[_0x3d1c('0x46')],md5(_0x2fea65[_0x3d1c('0x46')]));}else{_0x2fea65[_0x3d1c('0x44')]='';}headers[_0x3d1c('0x47')]=getAuth(_0x3be62d);return getUser(_0x3be62d,_0x40fecd[_0x3d1c('0x48')])[_0x3d1c('0x1e')](function(_0x2e551e){_0xd12e2a=_0x2e551e;logger['info']('The\x20User\x20ID\x20is:',_0xd12e2a['id']);return getEndUser(_0x3be62d,_0x2fea65[_0x3d1c('0x49')],_0x2fea65[_0x3d1c('0x11')]);})[_0x3d1c('0x1e')](function(_0x586b76){_0x3ef847=_0x586b76;logger[_0x3d1c('0xd')](_0x3d1c('0x4a'),_0x3ef847['id']);return getTicket(_0x3be62d,_0xd12e2a,_0x3ef847,_0x22ef19,_0x2fea65);})[_0x3d1c('0x1e')](function(_0xa2d3e3){if(_0xa2d3e3&&_0xa2d3e3['id']){logger[_0x3d1c('0xd')](_0x3d1c('0x1f'));logger[_0x3d1c('0xd')](_0x3d1c('0x4b'),_0xa2d3e3['id']);logger['info']('[QUEUE]',_0x3d1c('0x4c'));emit(util[_0x3d1c('0x1b')](_0x3d1c('0x4d'),_0x40fecd[_0x3d1c('0x16')]),_0x3d1c('0x4e'),{'uri':util[_0x3d1c('0x1b')](_0x3d1c('0x4f'),_0x3be62d['remoteUri'],_0xa2d3e3['id'])});}})[_0x3d1c('0x50')](function(_0x591ca1){logger['error'](_0x3d1c('0x43'),JSON['stringify'](_0x591ca1));});};exports['outbound']=function(_0x2f0047,_0xa59047,_0x29e7fe,_0x3edf25,_0x55a3ca,_0x1d41fa,_0xfdcbc9){var _0x4b9c92,_0x3c7c5d;_0x1d41fa[_0x3d1c('0x1c')]=intUtil[_0x3d1c('0x40')](_0x1d41fa[_0x3d1c('0x1c')]);_0x1d41fa[_0x3d1c('0x41')]=intUtil[_0x3d1c('0x40')](_0x1d41fa[_0x3d1c('0x41')]);if(_0xfdcbc9&&_0xfdcbc9[_0x3d1c('0x51')]&&_0xfdcbc9[_0x3d1c('0x51')]!==_0x3d1c('0x52')){logger[_0x3d1c('0xd')](_0x3d1c('0x53'),_0x3d1c('0x54'));_0xa59047[_0x3d1c('0x44')]=util['format'](_0x3d1c('0x45'),_0x1d41fa[_0x3d1c('0x41')],_0xa59047[_0x3d1c('0x46')],md5(_0xa59047[_0x3d1c('0x46')]));}headers[_0x3d1c('0x47')]=getAuth(_0x1d41fa);return getUser(_0x1d41fa,_0x3edf25[_0x3d1c('0x48')])[_0x3d1c('0x1e')](function(_0x5d3ff9){_0x4b9c92=_0x5d3ff9;logger[_0x3d1c('0xd')]('The\x20User\x20ID\x20is:',_0x4b9c92['id']);return getEndUser(_0x1d41fa,_0xa59047[_0x3d1c('0x55')],_0xa59047[_0x3d1c('0x56')]);})[_0x3d1c('0x1e')](function(_0x56248f){_0x3c7c5d=_0x56248f;logger[_0x3d1c('0xd')]('The\x20Enduser\x20ID\x20is:',_0x3c7c5d['id']);return getTicket(_0x1d41fa,_0x4b9c92,_0x3c7c5d,_0x29e7fe,_0xa59047);})[_0x3d1c('0x1e')](function(_0x1437ec){if(_0x1437ec&&_0x1437ec['id']){logger[_0x3d1c('0xd')](_0x3d1c('0x1f'));logger['info'](_0x3d1c('0x4b'),_0x1437ec['id']);logger[_0x3d1c('0xd')](_0x3d1c('0x53'),_0x3d1c('0x4c'));emit(util['format']('user:%s',_0x3edf25[_0x3d1c('0x16')]),_0x3d1c('0x4e'),{'uri':util[_0x3d1c('0x1b')](_0x3d1c('0x4f'),_0x1d41fa[_0x3d1c('0x1c')],_0x1437ec['id'])});}})[_0x3d1c('0x50')](function(_0x32427f){logger[_0x3d1c('0x57')](_0x3d1c('0x53'),JSON[_0x3d1c('0x30')](_0x32427f));});};exports[_0x3d1c('0x58')]=function(_0x130aba,_0x3e456c,_0x59c623,_0x428d92,_0xe64dc3,_0x48cc01){var _0x1dca27,_0x25ece2;_0x48cc01['remoteUri']=intUtil[_0x3d1c('0x40')](_0x48cc01[_0x3d1c('0x1c')]);_0x48cc01[_0x3d1c('0x41')]=intUtil[_0x3d1c('0x40')](_0x48cc01['serverUrl']);if(_0xe64dc3&&_0xe64dc3['monitor_format']){logger['info']('['+_0x3e456c['lastevent'][_0x3d1c('0x59')]()+']',_0x3d1c('0x54'));_0x3e456c['recordingURL']=util['format'](_0x3d1c('0x45'),_0x48cc01[_0x3d1c('0x41')],_0x3e456c[_0x3d1c('0x46')],md5(_0x3e456c['uniqueid']));}else{_0x3e456c[_0x3d1c('0x44')]='';}headers[_0x3d1c('0x47')]=getAuth(_0x48cc01);return getUser(_0x48cc01,'')['then'](function(_0x299fbf){_0x1dca27=_0x299fbf;logger['info']('The\x20User\x20ID\x20is:',_0x1dca27['id']);return getEndUser(_0x48cc01,_0x3e456c[_0x3d1c('0x49')],_0x3e456c[_0x3d1c('0x11')]);})['then'](function(_0x10aaa1){_0x25ece2=_0x10aaa1;logger[_0x3d1c('0xd')](_0x3d1c('0x4a'),_0x25ece2['id']);return getTicket(_0x48cc01,_0x1dca27,_0x25ece2,_0x59c623,_0x3e456c);})[_0x3d1c('0x1e')](function(_0x4ffe01){if(_0x4ffe01){logger[_0x3d1c('0xd')](_0x3d1c('0x1f'));logger[_0x3d1c('0xd')](_0x3d1c('0x4b'),_0x4ffe01['id']);}})[_0x3d1c('0x50')](function(_0x2df962){logger[_0x3d1c('0x57')]('['+_0x3e456c['lastevent'][_0x3d1c('0x59')]()+']',JSON[_0x3d1c('0x30')](_0x2df962));});}; \ 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 6bb792d..43469f1 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 _0x933c=['then','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','users','agentEmail','userEmail','userId','User\x20found:','message','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','error','/contacts/','user:%s','emit','Token\x20token=','stripTrailingSlash','serverUrl','remoteUri','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information'];(function(_0x56efcb,_0x362ced){var _0x4f5469=function(_0x540734){while(--_0x540734){_0x56efcb['push'](_0x56efcb['shift']());}};_0x4f5469(++_0x362ced);}(_0x933c,0x99));var _0xc933=function(_0x4b01b9,_0x559c81){_0x4b01b9=_0x4b01b9-0x0;var _0x505deb=_0x933c[_0x4b01b9];return _0x505deb;};'use strict';var _=require(_0xc933('0x0'));var rp=require(_0xc933('0x1'));var md5=require(_0xc933('0x2'));var util=require(_0xc933('0x3'));var moment=require(_0xc933('0x4'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0xc933('0x5'));var config=require(_0xc933('0x6'));var logger=require(_0xc933('0x7'))(_0xc933('0x8'));config[_0xc933('0x9')]=_[_0xc933('0xa')](config['redis'],{'host':_0xc933('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc933('0x9')]));function getAdminId(_0xf924f4,_0x520373,_0x5e9b96,_0x406918){return new Promise(function(_0x1ac472,_0x5906c4){var _0x4cd7cc=![];var _0x36e8eb={'method':_0xc933('0xc'),'uri':_0x406918+_0xc933('0xd'),'json':!![]};_0x36e8eb[_0xc933('0xe')]=_0x5e9b96;logger[_0xc933('0xf')](_0xc933('0x10'));return rp(_0x36e8eb)[_0xc933('0x11')](function(_0xb1a409){if(_0xb1a409){var _0x515b72=_0xb1a409['users'];var _0x2c855a=null;for(_0x2c855a=0x0;_0x2c855a<_0x515b72[_0xc933('0x12')];_0x2c855a++){if(_0x515b72[_0x2c855a][_0xc933('0x13')]===_0xf924f4[_0xc933('0x14')]){_0xf924f4[_0xc933('0x15')]=_0x515b72[_0x2c855a]['id'];_0x4cd7cc=!![];}}if(_0x4cd7cc){logger['info'](_0xc933('0x16'),_0xf924f4['adminId']);_0x1ac472(_0xf924f4);}else{_0x5906c4({'statusCode':0x194,'message':_0xc933('0x17')});}}else{_0x5906c4({'statusCode':0x194,'message':_0xc933('0x17')});}})[_0xc933('0x18')](function(_0x2f5784){logger['error']('['+[_0x520373[_0xc933('0x19')]()]+']',_0x2f5784['message']);_0x5906c4(_0x2f5784);});});}function getUser(_0x4bdbe8,_0x776634,_0x42b06a){return function(_0xb76659){return new Promise(function(_0x229901,_0x1611a7){var _0x2ba124={'method':_0xc933('0xc'),'uri':_0x42b06a+_0xc933('0xd'),'json':!![]};_0x2ba124[_0xc933('0xe')]=_0x776634;logger[_0xc933('0xf')]('Getting\x20user\x20list');return rp(_0x2ba124)[_0xc933('0x11')](function(_0x15fd65){if(_0x15fd65){var _0xbe7f7b=_0x15fd65[_0xc933('0x1a')];var _0x1f57db=![];var _0x318370=null;if(_0xb76659[_0xc933('0x1b')]!==null){logger[_0xc933('0xf')]('Getting\x20user\x20with\x20email',_0xb76659[_0xc933('0x1b')]);_0xb76659[_0xc933('0x1c')]=_0xb76659[_0xc933('0x1b')];for(_0x318370=0x0;_0x318370<_0xbe7f7b[_0xc933('0x12')];_0x318370++){if(_0xbe7f7b[_0x318370][_0xc933('0x13')]===_0xb76659['agentEmail']){_0x1f57db=!![];_0xb76659[_0xc933('0x1d')]=_0xbe7f7b[_0x318370]['id'];logger[_0xc933('0xf')](_0xc933('0x1e'),_0xb76659[_0xc933('0x1d')]);}}}if(!_0x1f57db){logger[_0xc933('0xf')]('Admin\x20selected');_0xb76659[_0xc933('0x1c')]=_0xb76659[_0xc933('0x14')];_0xb76659['userId']=_0xb76659['adminId'];_0x1f57db=!![];}if(_0x1f57db){_0x229901(_0xb76659);}else{_0x1611a7({'statusCode':0x194,'message':_0xc933('0x17')});}}else{_0x1611a7({'statusCode':0x194,'message':_0xc933('0x17')});}})[_0xc933('0x18')](function(_0x1afada){logger['error']('['+[_0x4bdbe8[_0xc933('0x19')]()]+']',_0x1afada[_0xc933('0x1f')]);_0x1611a7(_0x1afada);});});};}function searchContact(_0x519ede,_0x1a9004,_0x202244,_0x53373a){return new Promise(function(_0x50805b,_0x4628ec){var _0x5d7b77={'method':_0xc933('0xc'),'headers':_0x1a9004,'uri':_0x519ede+_0xc933('0x20')+_0x53373a+'&f='+_0x202244+_0xc933('0x21'),'json':!![]};rp(_0x5d7b77)[_0xc933('0x11')](function(_0x22af1a){var _0x5055c7=_[_0xc933('0x22')](_0x22af1a[_0xc933('0x23')][_0xc933('0x23')],[_0x202244,_0x53373a]);_0x50805b(_0x5055c7);})['catch'](function(_0x129af4){_0x4628ec(_0x129af4);});});}function getEndUser(_0x1d6469,_0x142ec9,_0x21fcd1){return function(_0x322332){return new Promise(function(_0x38e548,_0x387367){logger[_0xc933('0xf')](util[_0xc933('0x24')](_0xc933('0x25'),_0x322332['contactNumber']));searchContact(_0x21fcd1,_0x142ec9,_0xc933('0x26'),_0x322332[_0xc933('0x27')])[_0xc933('0x11')](function(_0x45fa89){if(_0x45fa89){_0x322332['endUserId']=_0x45fa89['id'];logger['info'](_0xc933('0x28'),_0x322332[_0xc933('0x29')]);return _0x38e548(_0x322332);}searchContact(_0x21fcd1,_0x142ec9,_0xc933('0x2a'),_0x322332['contactNumber'])[_0xc933('0x11')](function(_0x1d559a){if(_0x1d559a){_0x322332[_0xc933('0x29')]=_0x1d559a['id'];logger[_0xc933('0xf')](_0xc933('0x2b'),_0x322332[_0xc933('0x29')]);return _0x38e548(_0x322332);}createEndUser(_0x322332,_0x1d6469,_0x142ec9,_0x21fcd1)[_0xc933('0x11')](function(_0x3dc8db){logger[_0xc933('0xf')]('Contact\x20created:',_0x3dc8db[_0xc933('0x29')]);return _0x38e548(_0x3dc8db);});});})[_0xc933('0x18')](function(_0x3eacab){_0x387367(_0x3eacab);});});};}function createEndUser(_0x304ee7,_0x566635,_0x1530eb,_0x42dc86){return new Promise(function(_0x19dea9,_0x204347){var _0x8769b6=moment();var _0x4652fb={'method':_0xc933('0x2c'),'uri':_0x42dc86+_0xc933('0x2d'),'body':{'contact':{'last_name':_0x304ee7[_0xc933('0x27')],'work_number':_0x304ee7[_0xc933('0x27')],'mobile_number':_0x304ee7['contactNumber'],'owner_id':_0x304ee7[_0xc933('0x1d')],'created_at':_0x8769b6[_0xc933('0x24')](_0xc933('0x2e'))}},'json':!![]};_0x4652fb[_0xc933('0xe')]=_0x1530eb;logger['info'](_0xc933('0x2f'));return rp(_0x4652fb)['then'](function(_0xde28c7){_0x304ee7['endUserId']=_0xde28c7[_0xc933('0x30')]['id'];_0x19dea9(_0x304ee7);})['catch'](function(_0x280f20){logger['error']('['+[_0x566635['toUpperCase']()]+']',_0x280f20[_0xc933('0x1f')]);_0x204347(_0x280f20[_0xc933('0x1f')]);});});}function getTicket(_0x31316f,_0x560ae9,_0x30775c,_0x40cd12,_0x29f7d8){return function(_0x5b23f7){logger[_0xc933('0xf')](_0xc933('0x31'));return new Promise(function(_0x31d591,_0x40857c){var _0x3ea21f=moment();var _0x3cb197={'method':_0xc933('0x2c'),'uri':_0x30775c+'/api/tasks','body':{'title':intUtil[_0xc933('0x32')](_0x40cd12[_0xc933('0x33')],_0x29f7d8,'\x20'),'description':intUtil['getString'](_0x40cd12[_0xc933('0x34')],_0x29f7d8,'\x0a'),'owner_id':_0x5b23f7[_0xc933('0x1d')],'creater_id':_0x5b23f7[_0xc933('0x15')],'targetable_id':_0x5b23f7[_0xc933('0x29')],'targetable_type':_0xc933('0x35'),'created_at':_0x3ea21f[_0xc933('0x24')](_0xc933('0x2e')),'due_date':_0x3ea21f[_0xc933('0x36')](0x1e,'m')[_0xc933('0x24')](_0xc933('0x2e'))},'json':!![]};_0x3cb197['headers']=_0x560ae9;return rp(_0x3cb197)[_0xc933('0x11')](function(_0x251a64){_0x5b23f7[_0xc933('0x37')]=_0x251a64[_0xc933('0x38')]['id'];logger[_0xc933('0xf')](_0xc933('0x39'),_0x5b23f7[_0xc933('0x37')]);_0x31d591(_0x5b23f7);})[_0xc933('0x18')](function(_0x5d4f68){logger[_0xc933('0x3a')]('['+[_0x31316f[_0xc933('0x19')]()]+']',_0x5d4f68[_0xc933('0x1f')]);_0x40857c(_0x5d4f68['message']);});});};}function emit(_0x1c481a,_0x18f88f,_0x3a0352){var _0xb9453d={'uri':_0x1c481a+_0xc933('0x3b')+_0x3a0352};io['to'](util[_0xc933('0x24')](_0xc933('0x3c'),_0x18f88f))[_0xc933('0x3d')]('trigger:browser:url',_0xb9453d);}exports['cs']=function(_0x4a3295,_0x33c6f2,_0x22734f,_0x4c7709,_0x1721b6,_0x461a86,_0x627891,_0x72884f){var _0x1ac447={};var _0x4d74b5={'Authorization':_0xc933('0x3e')+_0x461a86['apiKey']};_0x461a86['remoteUri']=intUtil[_0xc933('0x3f')](_0x461a86['remoteUri']);_0x461a86[_0xc933('0x40')]=intUtil[_0xc933('0x3f')](_0x461a86[_0xc933('0x40')]);var _0x43316a=_0x461a86[_0xc933('0x41')];_0x1ac447['adminEmail']=_0x461a86[_0xc933('0x42')];_0x1ac447['contactNumber']=_0x72884f[_0xc933('0x43')]()===_0xc933('0x44')?_0x33c6f2[_0xc933('0x45')]:_0x33c6f2[_0xc933('0x46')];_0x1ac447[_0xc933('0x47')]=_0x72884f==='queue'||_0x72884f==='unmanaged'?'queue':_0xc933('0x44');if(_0x4c7709){_0x1ac447[_0xc933('0x1b')]=_0x4c7709[_0xc933('0x13')];}var _0x4856a9=util[_0xc933('0x24')](_0xc933('0x48'),_0x461a86[_0xc933('0x40')],_0x33c6f2[_0xc933('0x49')],md5(_0x33c6f2[_0xc933('0x49')]));if(_0x1721b6&&_0x1721b6[_0xc933('0x4a')]){logger['info'](_0xc933('0x4b'),_0xc933('0x4c'));_0x33c6f2['recordingURL']=_0x4856a9;}else if(_0x627891&&_0x627891[_0xc933('0x4d')]&&_0x627891[_0xc933('0x4d')]!==_0xc933('0x4e')){logger[_0xc933('0xf')]('[OUTBOUND]',_0xc933('0x4c'));_0x33c6f2[_0xc933('0x4f')]=_0x4856a9;}else{_0x33c6f2[_0xc933('0x4f')]='';}return getAdminId(_0x1ac447,_0x72884f,_0x4d74b5,_0x43316a)['then'](getUser(_0x72884f,_0x4d74b5,_0x43316a))[_0xc933('0x11')](getEndUser(_0x72884f,_0x4d74b5,_0x43316a))['then'](getTicket(_0x72884f,_0x4d74b5,_0x43316a,_0x22734f,_0x33c6f2))[_0xc933('0x11')](function(_0x265565){logger[_0xc933('0xf')](util['format'](_0xc933('0x50'),_0x265565[_0xc933('0x37')]));if(_0x72884f!==_0xc933('0x51')){logger[_0xc933('0xf')]('['+[_0x72884f[_0xc933('0x19')]()]+']',_0xc933('0x52'));emit(_0x43316a,_0x4c7709['name'],_0x265565['endUserId']);}})[_0xc933('0x18')](function(_0x4b2a19){logger[_0xc933('0x3a')]('['+[_0x72884f['toUpperCase']()]+_0xc933('0x53'),util[_0xc933('0x54')](_0x4b2a19,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcddd=[']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','GET','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','catch','toUpperCase','message','/api/lookup?q=','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','callDirection','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name'];(function(_0x2cf53d,_0x24f5e0){var _0x3333f9=function(_0xa38322){while(--_0xa38322){_0x2cf53d['push'](_0x2cf53d['shift']());}};_0x3333f9(++_0x24f5e0);}(_0xcddd,0x1a1));var _0xdcdd=function(_0x4ff2a4,_0x5be6d3){_0x4ff2a4=_0x4ff2a4-0x0;var _0x203f19=_0xcddd[_0x4ff2a4];return _0x203f19;};'use strict';var _=require(_0xdcdd('0x0'));var rp=require(_0xdcdd('0x1'));var md5=require(_0xdcdd('0x2'));var util=require(_0xdcdd('0x3'));var moment=require(_0xdcdd('0x4'));var Promise=require(_0xdcdd('0x5'));var Redis=require(_0xdcdd('0x6'));var intUtil=require(_0xdcdd('0x7'));var config=require(_0xdcdd('0x8'));var logger=require(_0xdcdd('0x9'))(_0xdcdd('0xa'));config[_0xdcdd('0xb')]=_['defaults'](config[_0xdcdd('0xb')],{'host':_0xdcdd('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdcdd('0xb')]));function getAdminId(_0x5b3e21,_0x162167,_0xb25eeb,_0x2c1e48){return new Promise(function(_0x58f6e8,_0x2c4357){var _0x5b4041=![];var _0x257e7f={'method':_0xdcdd('0xd'),'uri':_0x2c1e48+'/api/selector/owners','json':!![]};_0x257e7f[_0xdcdd('0xe')]=_0xb25eeb;logger[_0xdcdd('0xf')](_0xdcdd('0x10'));return rp(_0x257e7f)[_0xdcdd('0x11')](function(_0x56c0f5){if(_0x56c0f5){var _0x4e7859=_0x56c0f5[_0xdcdd('0x12')];var _0x11e0b4=null;for(_0x11e0b4=0x0;_0x11e0b4<_0x4e7859['length'];_0x11e0b4++){if(_0x4e7859[_0x11e0b4][_0xdcdd('0x13')]===_0x5b3e21[_0xdcdd('0x14')]){_0x5b3e21[_0xdcdd('0x15')]=_0x4e7859[_0x11e0b4]['id'];_0x5b4041=!![];}}if(_0x5b4041){logger[_0xdcdd('0xf')](_0xdcdd('0x16'),_0x5b3e21['adminId']);_0x58f6e8(_0x5b3e21);}else{_0x2c4357({'statusCode':0x194,'message':_0xdcdd('0x17')});}}else{_0x2c4357({'statusCode':0x194,'message':_0xdcdd('0x17')});}})['catch'](function(_0x31ae41){logger[_0xdcdd('0x18')]('['+[_0x162167['toUpperCase']()]+']',_0x31ae41['message']);_0x2c4357(_0x31ae41);});});}function getUser(_0x313273,_0x500d9a,_0x2cd24f){return function(_0x7dcf1f){return new Promise(function(_0x638ce1,_0x459979){var _0x2f24f7={'method':_0xdcdd('0xd'),'uri':_0x2cd24f+'/api/selector/owners','json':!![]};_0x2f24f7[_0xdcdd('0xe')]=_0x500d9a;logger['info'](_0xdcdd('0x19'));return rp(_0x2f24f7)['then'](function(_0x569046){if(_0x569046){var _0x41ca09=_0x569046[_0xdcdd('0x12')];var _0x28a477=![];var _0xfadcc0=null;if(_0x7dcf1f[_0xdcdd('0x1a')]!==null){logger[_0xdcdd('0xf')](_0xdcdd('0x1b'),_0x7dcf1f[_0xdcdd('0x1a')]);_0x7dcf1f[_0xdcdd('0x1c')]=_0x7dcf1f['agentEmail'];for(_0xfadcc0=0x0;_0xfadcc0<_0x41ca09[_0xdcdd('0x1d')];_0xfadcc0++){if(_0x41ca09[_0xfadcc0][_0xdcdd('0x13')]===_0x7dcf1f[_0xdcdd('0x1a')]){_0x28a477=!![];_0x7dcf1f[_0xdcdd('0x1e')]=_0x41ca09[_0xfadcc0]['id'];logger[_0xdcdd('0xf')](_0xdcdd('0x1f'),_0x7dcf1f['userId']);}}}if(!_0x28a477){logger[_0xdcdd('0xf')](_0xdcdd('0x20'));_0x7dcf1f[_0xdcdd('0x1c')]=_0x7dcf1f[_0xdcdd('0x14')];_0x7dcf1f[_0xdcdd('0x1e')]=_0x7dcf1f[_0xdcdd('0x15')];_0x28a477=!![];}if(_0x28a477){_0x638ce1(_0x7dcf1f);}else{_0x459979({'statusCode':0x194,'message':_0xdcdd('0x17')});}}else{_0x459979({'statusCode':0x194,'message':_0xdcdd('0x17')});}})[_0xdcdd('0x21')](function(_0x186e1f){logger[_0xdcdd('0x18')]('['+[_0x313273[_0xdcdd('0x22')]()]+']',_0x186e1f[_0xdcdd('0x23')]);_0x459979(_0x186e1f);});});};}function searchContact(_0xe6b71,_0x49cb3e,_0x50bda3,_0x4b555b){return new Promise(function(_0x1a4cf6,_0x24cb6c){var _0x486978={'method':_0xdcdd('0xd'),'headers':_0x49cb3e,'uri':_0xe6b71+_0xdcdd('0x24')+_0x4b555b+'&f='+_0x50bda3+'&entities=contact','json':!![]};rp(_0x486978)['then'](function(_0xdc9db){var _0x421717=_['find'](_0xdc9db['contacts'][_0xdcdd('0x25')],[_0x50bda3,_0x4b555b]);_0x1a4cf6(_0x421717);})[_0xdcdd('0x21')](function(_0x2f2aff){_0x24cb6c(_0x2f2aff);});});}function getEndUser(_0x5ed248,_0x37f789,_0x150176){return function(_0x33dcc5){return new Promise(function(_0x14c34d,_0x4801e8){logger[_0xdcdd('0xf')](util[_0xdcdd('0x26')]('Searching\x20contact\x20with\x20phone\x20%s',_0x33dcc5[_0xdcdd('0x27')]));searchContact(_0x150176,_0x37f789,_0xdcdd('0x28'),_0x33dcc5[_0xdcdd('0x27')])[_0xdcdd('0x11')](function(_0x46d650){if(_0x46d650){_0x33dcc5[_0xdcdd('0x29')]=_0x46d650['id'];logger[_0xdcdd('0xf')](_0xdcdd('0x2a'),_0x33dcc5['endUserId']);return _0x14c34d(_0x33dcc5);}searchContact(_0x150176,_0x37f789,_0xdcdd('0x2b'),_0x33dcc5[_0xdcdd('0x27')])[_0xdcdd('0x11')](function(_0x3d6bb0){if(_0x3d6bb0){_0x33dcc5[_0xdcdd('0x29')]=_0x3d6bb0['id'];logger[_0xdcdd('0xf')](_0xdcdd('0x2c'),_0x33dcc5[_0xdcdd('0x29')]);return _0x14c34d(_0x33dcc5);}createEndUser(_0x33dcc5,_0x5ed248,_0x37f789,_0x150176)['then'](function(_0x1bc272){logger['info'](_0xdcdd('0x2d'),_0x1bc272[_0xdcdd('0x29')]);return _0x14c34d(_0x1bc272);});});})[_0xdcdd('0x21')](function(_0x52a970){_0x4801e8(_0x52a970);});});};}function createEndUser(_0x2af2d3,_0x137b06,_0x347199,_0x17c3dc){return new Promise(function(_0x1b0b65,_0x4a946b){var _0xcacc53=moment();var _0xed6b2f={'method':'POST','uri':_0x17c3dc+_0xdcdd('0x2e'),'body':{'contact':{'last_name':_0x2af2d3['contactNumber'],'work_number':_0x2af2d3[_0xdcdd('0x27')],'mobile_number':_0x2af2d3[_0xdcdd('0x27')],'owner_id':_0x2af2d3[_0xdcdd('0x1e')],'created_at':_0xcacc53[_0xdcdd('0x26')](_0xdcdd('0x2f'))}},'json':!![]};_0xed6b2f[_0xdcdd('0xe')]=_0x347199;logger[_0xdcdd('0xf')](_0xdcdd('0x30'));return rp(_0xed6b2f)[_0xdcdd('0x11')](function(_0xf5f338){_0x2af2d3[_0xdcdd('0x29')]=_0xf5f338['contact']['id'];_0x1b0b65(_0x2af2d3);})[_0xdcdd('0x21')](function(_0x319f68){logger[_0xdcdd('0x18')]('['+[_0x137b06['toUpperCase']()]+']',_0x319f68[_0xdcdd('0x23')]);_0x4a946b(_0x319f68[_0xdcdd('0x23')]);});});}function getTicket(_0x5356c5,_0x421254,_0x979fb9,_0x3ffe2c,_0x1ba0f8){return function(_0x3e859a){logger[_0xdcdd('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x781461,_0x2ea8c8){var _0x1a427a=moment();var _0x2364bc={'method':'POST','uri':_0x979fb9+_0xdcdd('0x31'),'body':{'title':intUtil[_0xdcdd('0x32')](_0x3ffe2c[_0xdcdd('0x33')],_0x1ba0f8,'\x20'),'description':intUtil[_0xdcdd('0x32')](_0x3ffe2c[_0xdcdd('0x34')],_0x1ba0f8,'\x0a'),'owner_id':_0x3e859a[_0xdcdd('0x1e')],'creater_id':_0x3e859a[_0xdcdd('0x15')],'targetable_id':_0x3e859a['endUserId'],'targetable_type':_0xdcdd('0x35'),'created_at':_0x1a427a[_0xdcdd('0x26')](_0xdcdd('0x2f')),'due_date':_0x1a427a[_0xdcdd('0x36')](0x1e,'m')[_0xdcdd('0x26')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x2364bc[_0xdcdd('0xe')]=_0x421254;return rp(_0x2364bc)[_0xdcdd('0x11')](function(_0x3a7417){_0x3e859a[_0xdcdd('0x37')]=_0x3a7417[_0xdcdd('0x38')]['id'];logger[_0xdcdd('0xf')](_0xdcdd('0x39'),_0x3e859a['ticketId']);_0x781461(_0x3e859a);})[_0xdcdd('0x21')](function(_0x1d6bf3){logger['error']('['+[_0x5356c5[_0xdcdd('0x22')]()]+']',_0x1d6bf3[_0xdcdd('0x23')]);_0x2ea8c8(_0x1d6bf3[_0xdcdd('0x23')]);});});};}function emit(_0x3824ba,_0x433434,_0x36e11a){var _0x69e901={'uri':_0x3824ba+'/contacts/'+_0x36e11a};io['to'](util['format'](_0xdcdd('0x3a'),_0x433434))[_0xdcdd('0x3b')]('trigger:browser:url',_0x69e901);}exports['cs']=function(_0x3a14ef,_0x1c6453,_0x471eb3,_0x2520fb,_0x43395c,_0x5669a9,_0x45a452,_0x36a8cc){var _0x193ad6={};var _0x1a05f5={'Authorization':_0xdcdd('0x3c')+_0x5669a9[_0xdcdd('0x3d')]};_0x5669a9[_0xdcdd('0x3e')]=intUtil[_0xdcdd('0x3f')](_0x5669a9[_0xdcdd('0x3e')]);_0x5669a9[_0xdcdd('0x40')]=intUtil[_0xdcdd('0x3f')](_0x5669a9[_0xdcdd('0x40')]);var _0x1ec447=_0x5669a9[_0xdcdd('0x3e')];_0x193ad6['adminEmail']=_0x5669a9[_0xdcdd('0x41')];_0x193ad6['contactNumber']=_0x36a8cc[_0xdcdd('0x42')]()===_0xdcdd('0x43')?_0x1c6453['destcalleridnum']:_0x1c6453['calleridnum'];_0x193ad6[_0xdcdd('0x44')]=_0x36a8cc===_0xdcdd('0x45')||_0x36a8cc==='unmanaged'?_0xdcdd('0x45'):_0xdcdd('0x43');if(_0x2520fb){_0x193ad6[_0xdcdd('0x1a')]=_0x2520fb[_0xdcdd('0x13')];}var _0x27da0f=util[_0xdcdd('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5669a9[_0xdcdd('0x40')],_0x1c6453[_0xdcdd('0x46')],md5(_0x1c6453[_0xdcdd('0x46')]));if(_0x43395c&&_0x43395c[_0xdcdd('0x47')]){logger[_0xdcdd('0xf')](_0xdcdd('0x48'),_0xdcdd('0x49'));_0x1c6453[_0xdcdd('0x4a')]=_0x27da0f;}else if(_0x45a452&&_0x45a452[_0xdcdd('0x4b')]&&_0x45a452[_0xdcdd('0x4b')]!=='none'){logger[_0xdcdd('0xf')](_0xdcdd('0x4c'),_0xdcdd('0x49'));_0x1c6453[_0xdcdd('0x4a')]=_0x27da0f;}else{_0x1c6453['recordingURL']='';}return getAdminId(_0x193ad6,_0x36a8cc,_0x1a05f5,_0x1ec447)[_0xdcdd('0x11')](getUser(_0x36a8cc,_0x1a05f5,_0x1ec447))['then'](getEndUser(_0x36a8cc,_0x1a05f5,_0x1ec447))['then'](getTicket(_0x36a8cc,_0x1a05f5,_0x1ec447,_0x471eb3,_0x1c6453))[_0xdcdd('0x11')](function(_0x5844eb){logger[_0xdcdd('0xf')](util[_0xdcdd('0x26')](_0xdcdd('0x4d'),_0x5844eb[_0xdcdd('0x37')]));if(_0x36a8cc!==_0xdcdd('0x4e')){logger[_0xdcdd('0xf')]('['+[_0x36a8cc[_0xdcdd('0x22')]()]+']',_0xdcdd('0x4f'));emit(_0x1ec447,_0x2520fb[_0xdcdd('0x50')],_0x5844eb[_0xdcdd('0x29')]);}})[_0xdcdd('0x21')](function(_0x63002d){logger[_0xdcdd('0x18')]('['+[_0x36a8cc[_0xdcdd('0x22')]()]+_0xdcdd('0x51'),util[_0xdcdd('0x52')](_0x63002d,{'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 9125413..20143d5 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 _0x8603=['zendesk','salesforce','sugarcrm','freshdesk','zoho','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./dynamics365'];(function(_0x2b764b,_0x552064){var _0x33eab0=function(_0x329efd){while(--_0x329efd){_0x2b764b['push'](_0x2b764b['shift']());}};_0x33eab0(++_0x552064);}(_0x8603,0x190));var _0x3860=function(_0x377e30,_0x2fe51a){_0x377e30=_0x377e30-0x0;var _0x50a9e8=_0x8603[_0x377e30];return _0x50a9e8;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var zendesk=require(_0x3860('0x1'));var salesforce=require(_0x3860('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x3860('0x3'));var desk=require(_0x3860('0x4'));var vtiger=require(_0x3860('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x3860('0x6'));var freshsales=require('./freshsales');var integrations=[_0x3860('0x7'),_0x3860('0x8'),_0x3860('0x9'),_0x3860('0xa'),_0x3860('0xb'),'desk','vtiger','dynamics365',_0x3860('0xc'),_0x3860('0xd')];exports['exec']=function(_0x2fb169,_0x38737e,_0x5909b8,_0x101263,_0x45ba50,_0x4cd35d){if(_0x5909b8){if(_[_0x3860('0xe')](integrations,_0x2fb169[_0x3860('0xf')]['toLowerCase']())){try{var _0x405510=null;var _0x8ad61d='';var _0x2428f6=_0x5909b8[_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]()];if(_0x2428f6){var _0x21ae4e=_0x2428f6[_0x2fb169[_0x3860('0x11')]];if(_0x21ae4e){var _0x12b23b=_[_0x3860('0x12')](_0x21ae4e[_0x3860('0x13')],{'id':parseInt(_0x2fb169['data3'],0xa)});if(_0x12b23b){if(_0x101263){if(_0x45ba50&&_0x38737e[_0x3860('0x14')]){_0x8ad61d=_0x3860('0x14');}else if(_0x38737e[_0x3860('0x15')]){_0x8ad61d=_0x3860('0x16');}else{console[_0x3860('0x17')](_0x3860('0x18'),_0x38737e);}}else{_0x8ad61d=_0x3860('0x19');}switch(_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]()){case _0x3860('0x7'):zendesk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x8'):salesforce[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x9'):sugarcrm[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case'freshdesk':freshdesk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case'zoho':zoho[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x1a'):desk[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0x1b'):vtiger[_0x8ad61d](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d);break;case _0x3860('0xc'):freshsales['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;case'servicenow':servicenow['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;case _0x3860('0x1c'):dynamics365['cs'](_0x2fb169,_0x38737e,_0x12b23b,_0x101263,_0x45ba50,_0x21ae4e,_0x4cd35d,_0x8ad61d);break;default:console[_0x3860('0x17')](_0x3860('0x1d'));}}else{_0x405510=require(_0x3860('0x1e'))(_0x2fb169[_0x3860('0xf')][_0x3860('0x10')]());_0x405510[_0x3860('0x1f')](_0x3860('0x20'),util[_0x3860('0x21')](_0x3860('0x22'),_0x2fb169[_0x3860('0xf')][_0x3860('0x10')](),_0x2fb169[_0x3860('0x23')]));}}else{_0x405510=require(_0x3860('0x1e'))(_0x2fb169[_0x3860('0xf')]['toLowerCase']());_0x405510[_0x3860('0x1f')](_0x3860('0x20'),util[_0x3860('0x21')](_0x3860('0x24'),_0x2fb169[_0x3860('0xf')]['toLowerCase'](),_0x2fb169[_0x3860('0x11')]));}}else{}}catch(_0x568515){console['error'](_0x568515);}}}}; \ No newline at end of file +var _0x757a=['EVENT\x20UNKNOWN','unmanaged','toLowerCase','zendesk','servicenow','unknown\x20integration','data1','error','[EXEC]','../../../../config/logger','format','data2','util','./zendesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','exec','find','Configurations','data3','queue','routeId','outbound','log'];(function(_0x38d803,_0x5c11c9){var _0x18fac8=function(_0x11292d){while(--_0x11292d){_0x38d803['push'](_0x38d803['shift']());}};_0x18fac8(++_0x5c11c9);}(_0x757a,0xde));var _0xa757=function(_0x13e09b,_0x5af66e){_0x13e09b=_0x13e09b-0x0;var _0x2cec3f=_0x757a[_0x13e09b];return _0x2cec3f;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var zendesk=require(_0xa757('0x1'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xa757('0x2'));var desk=require(_0xa757('0x3'));var vtiger=require(_0xa757('0x4'));var servicenow=require(_0xa757('0x5'));var dynamics365=require(_0xa757('0x6'));var freshsales=require(_0xa757('0x7'));var integrations=['zendesk',_0xa757('0x8'),_0xa757('0x9'),'freshdesk',_0xa757('0xa'),_0xa757('0xb'),_0xa757('0xc'),_0xa757('0xd'),_0xa757('0xe'),'servicenow'];exports[_0xa757('0xf')]=function(_0x2ca96f,_0x32f0ec,_0x3e2c9a,_0xb7610b,_0x188ad5,_0x17408b){if(_0x3e2c9a){if(_['includes'](integrations,_0x2ca96f['data1']['toLowerCase']())){try{var _0x56acfb=null;var _0x4db68e='';var _0x421040=_0x3e2c9a[_0x2ca96f['data1']['toLowerCase']()];if(_0x421040){var _0x2ed0d2=_0x421040[_0x2ca96f['data2']];if(_0x2ed0d2){var _0x481508=_[_0xa757('0x10')](_0x2ed0d2[_0xa757('0x11')],{'id':parseInt(_0x2ca96f[_0xa757('0x12')],0xa)});if(_0x481508){if(_0xb7610b){if(_0x188ad5&&_0x32f0ec[_0xa757('0x13')]){_0x4db68e=_0xa757('0x13');}else if(_0x32f0ec[_0xa757('0x14')]){_0x4db68e=_0xa757('0x15');}else{console[_0xa757('0x16')](_0xa757('0x17'),_0x32f0ec);}}else{_0x4db68e=_0xa757('0x18');}switch(_0x2ca96f['data1'][_0xa757('0x19')]()){case _0xa757('0x1a'):zendesk[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case _0xa757('0x8'):salesforce[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case'sugarcrm':sugarcrm[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case'freshdesk':freshdesk[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case _0xa757('0xa'):zoho[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case _0xa757('0xb'):desk[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case _0xa757('0xc'):vtiger[_0x4db68e](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b);break;case _0xa757('0xe'):freshsales['cs'](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b,_0x4db68e);break;case _0xa757('0x1b'):servicenow['cs'](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b,_0x4db68e);break;case _0xa757('0xd'):dynamics365['cs'](_0x2ca96f,_0x32f0ec,_0x481508,_0xb7610b,_0x188ad5,_0x2ed0d2,_0x17408b,_0x4db68e);break;default:console['log'](_0xa757('0x1c'));}}else{_0x56acfb=require('../../../../config/logger')(_0x2ca96f[_0xa757('0x1d')][_0xa757('0x19')]());_0x56acfb[_0xa757('0x1e')](_0xa757('0x1f'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x2ca96f[_0xa757('0x1d')][_0xa757('0x19')](),_0x2ca96f[_0xa757('0x12')]));}}else{_0x56acfb=require(_0xa757('0x20'))(_0x2ca96f[_0xa757('0x1d')][_0xa757('0x19')]());_0x56acfb[_0xa757('0x1e')](_0xa757('0x1f'),util[_0xa757('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x2ca96f[_0xa757('0x1d')]['toLowerCase'](),_0x2ca96f[_0xa757('0x22')]));}}else{}}catch(_0x47903b){console[_0xa757('0x1e')](_0x47903b);}}}}; \ 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 aad82b7..b3e66b4 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 _0xd78d=['then','length','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','moduleSearch','Contact','Lead','contact','lead','Case','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','Company','No\x20Company','upperFirst','forEach','type','idField','content','variable','variableName','toString','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','clientId','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Fields','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','jsforce','util','ioredis','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','Task','assign','utc','Subjects','getString','Descriptions','WhoId','ticketType','ContactId','sobject','isNil','User','find','execute'];(function(_0x275803,_0x24caad){var _0x422c17=function(_0x19019d){while(--_0x19019d){_0x275803['push'](_0x275803['shift']());}};_0x422c17(++_0x24caad);}(_0xd78d,0x126));var _0xdd78=function(_0x5bcf83,_0x3ffc79){_0x5bcf83=_0x5bcf83-0x0;var _0xa38a59=_0xd78d[_0x5bcf83];return _0xa38a59;};'use strict';var _=require(_0xdd78('0x0'));var rp=require(_0xdd78('0x1'));var moment=require(_0xdd78('0x2'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xdd78('0x3'));var util=require(_0xdd78('0x4'));var Redis=require(_0xdd78('0x5'));var intUtil=require('./util');var config=require(_0xdd78('0x6'));var logger=require('../../../../config/logger')(_0xdd78('0x7'));config[_0xdd78('0x8')]=_[_0xdd78('0x9')](config['redis'],{'host':_0xdd78('0xa'),'port':0x18eb});var io=require(_0xdd78('0xb'))(new Redis(config[_0xdd78('0x8')]));function emit(_0x3fa8f5,_0x22cc73,_0x3a105c){io['to'](_0x3fa8f5)[_0xdd78('0xc')](_0x22cc73,_0x3a105c);}function getTicket(_0x35f3c0,_0x1726ff,_0x189e45,_0x910cc1,_0x536c0f,_0x434b18,_0x436cc7,_0x3f6db6){var _0x2047f5={};if(_0x910cc1['ticketType']===_0xdd78('0xd')){_0x2047f5=Object[_0xdd78('0xe')]({},{'OwnerId':_0x1726ff['id'],'ActivityDate':moment[_0xdd78('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x910cc1[_0xdd78('0x10')],_0x536c0f,'\x20'),'Description':intUtil[_0xdd78('0x11')](_0x910cc1[_0xdd78('0x12')],_0x536c0f,'\x0a')},getCustomFields(_0x434b18,_0x536c0f));if(_0x189e45){_0x2047f5[_0xdd78('0x13')]=_0x189e45['id'];}}else if(_0x910cc1[_0xdd78('0x14')]==='Case'){_0x2047f5=Object[_0xdd78('0xe')]({},{'OwnerId':_0x1726ff['id'],'Subject':intUtil[_0xdd78('0x11')](_0x910cc1['Subjects'],_0x536c0f,'\x20'),'Description':intUtil[_0xdd78('0x11')](_0x910cc1['Descriptions'],_0x536c0f,'\x0a')},getCustomFields(_0x434b18,_0x536c0f));if(_0x189e45){_0x2047f5[_0xdd78('0x15')]=_0x189e45['id'];}}return _0x436cc7[_0xdd78('0x16')](_0x910cc1[_0xdd78('0x14')])['create'](_0x2047f5);}function getUser(_0x526566,_0x2fbf94,_0x80cfdc){if(!_[_0xdd78('0x17')](_0x2fbf94)&&intUtil['validateEmail'](_0x2fbf94)){var _0x551d3e={'Email':_0x2fbf94};var _0x301bec={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x80cfdc[_0xdd78('0x16')](_0xdd78('0x18'))[_0xdd78('0x19')](_0x551d3e,_0x301bec)[_0xdd78('0x1a')]()[_0xdd78('0x1b')](function(_0x506d1c){if(_0x506d1c[_0xdd78('0x1c')]){var _0x3204c8=_[_0xdd78('0x19')](_0x506d1c,function(_0x20fac2){return _0x20fac2[_0xdd78('0x1d')]===_0x2fbf94;});if(_0x3204c8){logger['info'](_0xdd78('0x1e'),_0x2fbf94);return BPromise[_0xdd78('0x1f')]({'id':_0x3204c8['Id'],'name':_0x3204c8[_0xdd78('0x20')]});}}else{logger[_0xdd78('0x21')](_0xdd78('0x22'),_0x2fbf94);return _0x80cfdc[_0xdd78('0x23')]()[_0xdd78('0x1b')](function(_0x2fd095){return BPromise[_0xdd78('0x1f')]({'id':_0x2fd095['user_id'],'name':_0x2fd095[_0xdd78('0x24')]});});}});}else{logger[_0xdd78('0x21')](_0xdd78('0x22'),_0x2fbf94);return _0x80cfdc[_0xdd78('0x23')]()[_0xdd78('0x1b')](function(_0x3e0b52){return BPromise['resolve']({'id':_0x3e0b52[_0xdd78('0x25')],'name':_0x3e0b52[_0xdd78('0x24')]});});}}function getEndUser(_0x10bc87,_0x7f13bb,_0x227224,_0x35e924,_0x154cec){var _0xc77c4b={'Phone':_0x35e924};var _0x1a5158={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xdd78('0x1f')]()[_0xdd78('0x1b')](function(){if(_0x7f13bb[_0xdd78('0x14')]===_0xdd78('0xd')){logger[_0xdd78('0x21')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x35e924,_0x7f13bb[_0xdd78('0x26')]);switch(_0x7f13bb[_0xdd78('0x26')]){case'contact_lead':return _0x154cec[_0xdd78('0x16')](_0xdd78('0x27'))[_0xdd78('0x19')](_0xc77c4b,_0x1a5158)['execute']()[_0xdd78('0x1b')](function(_0x3de77d){if(_0x3de77d&&_0x3de77d['length']){return _0x3de77d;}else{return _0x154cec['sobject'](_0xdd78('0x28'))['find'](_0xc77c4b,_0x1a5158);}});case _0xdd78('0x29'):return _0x154cec[_0xdd78('0x16')](_0xdd78('0x27'))[_0xdd78('0x19')](_0xc77c4b,_0x1a5158)[_0xdd78('0x1a')]();case _0xdd78('0x2a'):return _0x154cec[_0xdd78('0x16')](_0xdd78('0x28'))['find'](_0xc77c4b,_0x1a5158);default:return null;}}else if(_0x7f13bb['ticketType']===_0xdd78('0x2b')){logger[_0xdd78('0x21')](_0xdd78('0x2c'),_0x35e924,_0xdd78('0x29'));return _0x154cec['sobject'](_0xdd78('0x27'))[_0xdd78('0x19')](_0xc77c4b,_0x1a5158)['execute']();}})[_0xdd78('0x1b')](function(_0x12a663){if(_0x12a663&&_0x12a663[_0xdd78('0x1c')]){var _0x2cb629=_[_0xdd78('0x19')](_0x12a663,function(_0x13c71a){return _0x13c71a['Phone']===_0x35e924;});if(_0x2cb629){return BPromise[_0xdd78('0x1f')]({'id':_0x2cb629['Id'],'name':_0x2cb629[_0xdd78('0x20')],'phone':_0x2cb629['Phone']});}}})['then'](function(_0x55487f){if(_0x55487f){logger[_0xdd78('0x21')](_0xdd78('0x2d'),_0x35e924);return BPromise['resolve'](_0x55487f);}else{logger[_0xdd78('0x21')](_0xdd78('0x2e'),_0x35e924);var _0x43d79d={'LastName':_0x227224!==_0xdd78('0x2f')?_0x227224:util[_0xdd78('0x30')]('Caller\x20-\x20%s',_0x35e924),'Phone':_0x35e924};if(_0x7f13bb['moduleCreate']){if(_0x7f13bb['moduleCreate']===_0xdd78('0x29')){logger['info'](_0xdd78('0x31'),_0x35e924,_0x7f13bb[_0xdd78('0x32')]);}else if(_0x7f13bb[_0xdd78('0x32')]==='lead'&&_0x7f13bb[_0xdd78('0x14')]==='Task'){logger[_0xdd78('0x21')](_0xdd78('0x31'),_0x35e924,_0x7f13bb['moduleCreate']);_0x43d79d[_0xdd78('0x33')]=_0xdd78('0x34');}else{return null;}}return _0x154cec['sobject'](_[_0xdd78('0x35')](_0x7f13bb[_0xdd78('0x32')]))['create'](_0x43d79d);}});}function getCustomFields(_0x4a5447,_0x518cce){var _0x266a83={};if(_0x4a5447[_0xdd78('0x1c')]>0x0){_[_0xdd78('0x36')](_0x4a5447,function(_0x41212c){if(_0x41212c[_0xdd78('0x37')]==='string'&&_0x41212c[_0xdd78('0x38')]){_0x266a83[_0x41212c[_0xdd78('0x38')]]=_0x41212c[_0xdd78('0x39')]['toString']();}else if(_0x41212c['type']===_0xdd78('0x3a')&&_0x41212c['variableName']&&_0x41212c[_0xdd78('0x38')]){_0x518cce[_0x41212c[_0xdd78('0x3b')]]&&(_0x266a83[_0x41212c[_0xdd78('0x38')]]=_0x518cce[_0x41212c['variableName']][_0xdd78('0x3c')]());}else if(_0x41212c['type']==='customVariable'&&_0x41212c[_0xdd78('0x3d')]&&_0x41212c[_0xdd78('0x3d')][_0xdd78('0x3e')]&&_0x41212c['idField']){_0x518cce[_0x41212c['Variable']['name'][_0xdd78('0x3f')]()]&&(_0x266a83[_0x41212c['idField']]=_0x518cce[_0x41212c['Variable']['name']['toLowerCase']()]['toString']());}});}return _0x266a83;}function getConnection(_0x25fc73){var _0x2189ab=_0x25fc73[_0xdd78('0x40')][_0xdd78('0x41')](_0x25fc73[_0xdd78('0x42')]);var _0x417c10=new jsforce[(_0xdd78('0x43'))]({'oauth2':{'loginUrl':_0x25fc73[_0xdd78('0x44')]||'https://login.salesforce.com','clientId':_0x25fc73[_0xdd78('0x45')],'clientSecret':_0x25fc73['clientSecret']}});return _0x417c10[_0xdd78('0x46')](_0x25fc73['username'],_0x2189ab)[_0xdd78('0x1b')](function(){logger['info'](_0xdd78('0x47'));return _0x417c10;});}exports[_0xdd78('0x48')]=function(_0x27a75b,_0x1ce727,_0x5b4a0b,_0x5c9c6b,_0x2ab6dc,_0x5d9421){var _0x3efd3d,_0x2ccabc,_0x27e880,_0x4efaa4;_0x5d9421[_0xdd78('0x49')]=intUtil[_0xdd78('0x4a')](_0x5d9421[_0xdd78('0x49')]);_0x5d9421[_0xdd78('0x44')]=intUtil[_0xdd78('0x4a')](_0x5d9421[_0xdd78('0x44')]);if(_0x2ab6dc&&_0x2ab6dc['monitor_format']){logger['info']('[QUEUE]',_0xdd78('0x4b'));_0x1ce727[_0xdd78('0x4c')]=util[_0xdd78('0x30')](_0xdd78('0x4d'),_0x5d9421[_0xdd78('0x49')],_0x1ce727[_0xdd78('0x4e')],md5(_0x1ce727[_0xdd78('0x4e')]));}else{_0x1ce727[_0xdd78('0x4c')]='';}return getConnection(_0x5d9421)['then'](function(_0x40edcf){_0x4efaa4=_0x40edcf;return getUser(_0x5d9421,_0x5c9c6b['email'],_0x4efaa4);})[_0xdd78('0x1b')](function(_0x4a9f24){_0x3efd3d=_0x4a9f24;return getEndUser(_0x5d9421,_0x5b4a0b,_0x1ce727[_0xdd78('0x4f')],_0x1ce727['calleridnum'],_0x4efaa4);})[_0xdd78('0x1b')](function(_0x50885a){_0x2ccabc=_0x50885a;return getTicket(_0x5d9421,_0x3efd3d,_0x2ccabc,_0x5b4a0b,_0x1ce727,_0x5b4a0b[_0xdd78('0x50')],_0x4efaa4,_0xdd78('0x48'));})['then'](function(_0x582959){_0x27e880=_0x582959;logger[_0xdd78('0x21')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x27e880['id']);logger[_0xdd78('0x21')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x27e880['id'],_0x5c9c6b[_0xdd78('0x3e')],_0x5d9421[_0xdd78('0x37')]);switch(_0x5d9421[_0xdd78('0x37')]){case _0xdd78('0x51'):emit(util[_0xdd78('0x30')](_0xdd78('0x52'),_0x5c9c6b[_0xdd78('0x3e')]),_0xdd78('0x53'),{'recordId':_0x27e880['id']});break;case'newTab':emit(util[_0xdd78('0x30')]('user:%s',_0x5c9c6b[_0xdd78('0x3e')]),_0xdd78('0x54'),{'uri':util[_0xdd78('0x30')](_0xdd78('0x55'),_0x4efaa4[_0xdd78('0x56')],_0x27e880['id'])});break;default:logger['error'](_0xdd78('0x57'));}})[_0xdd78('0x58')](function(_0x2f4ac0){logger[_0xdd78('0x59')]('[QUEUE]',JSON[_0xdd78('0x5a')](_0x2f4ac0));});};exports[_0xdd78('0x5b')]=function(_0x18e284,_0x3e1335,_0x8ba4e3,_0xb98d94,_0x450466,_0x58a7ef,_0x54ae93){var _0xaea8e9,_0x1a22e3,_0x589755,_0x546e74;_0x58a7ef[_0xdd78('0x49')]=intUtil[_0xdd78('0x4a')](_0x58a7ef[_0xdd78('0x49')]);_0x58a7ef[_0xdd78('0x44')]=intUtil[_0xdd78('0x4a')](_0x58a7ef[_0xdd78('0x44')]);if(_0x54ae93&&_0x54ae93[_0xdd78('0x5c')]&&_0x54ae93[_0xdd78('0x5c')]!==_0xdd78('0x5d')){logger[_0xdd78('0x21')](_0xdd78('0x5e'),_0xdd78('0x4b'));_0x3e1335[_0xdd78('0x4c')]=util[_0xdd78('0x30')](_0xdd78('0x4d'),_0x58a7ef[_0xdd78('0x49')],_0x3e1335[_0xdd78('0x4e')],md5(_0x3e1335['uniqueid']));}return getConnection(_0x58a7ef)[_0xdd78('0x1b')](function(_0x3790c6){_0x546e74=_0x3790c6;return getUser(_0x58a7ef,_0xb98d94[_0xdd78('0x5f')],_0x546e74);})[_0xdd78('0x1b')](function(_0x258e0c){_0xaea8e9=_0x258e0c;return getEndUser(_0x58a7ef,_0x8ba4e3,_0x3e1335[_0xdd78('0x60')],_0x3e1335[_0xdd78('0x61')],_0x546e74);})[_0xdd78('0x1b')](function(_0x20f8d3){_0x1a22e3=_0x20f8d3;return getTicket(_0x58a7ef,_0xaea8e9,_0x1a22e3,_0x8ba4e3,_0x3e1335,_0x8ba4e3['Fields'],_0x546e74,_0xdd78('0x5b'));})[_0xdd78('0x1b')](function(_0x599ca3){_0x589755=_0x599ca3;logger[_0xdd78('0x21')](_0xdd78('0x62'),_0x589755['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x589755['id'],_0xb98d94[_0xdd78('0x3e')],_0x58a7ef['type']);switch(_0x58a7ef['type']){case'integrationTab':emit(util['format'](_0xdd78('0x52'),_0xb98d94['name']),_0xdd78('0x53'),{'recordId':_0x589755['id']});break;case _0xdd78('0x63'):emit(util['format'](_0xdd78('0x52'),_0xb98d94[_0xdd78('0x3e')]),_0xdd78('0x54'),{'uri':util['format'](_0xdd78('0x55'),_0x546e74['instanceUrl'],_0x589755['id'])});break;default:logger[_0xdd78('0x59')](_0xdd78('0x5e'),_0xdd78('0x64'));}})[_0xdd78('0x58')](function(_0x3d0004){logger[_0xdd78('0x59')]('[OUTBOUND]',JSON[_0xdd78('0x5a')](_0x3d0004));});};exports[_0xdd78('0x65')]=function(_0x55a08f,_0x29df01,_0x160276,_0x537388,_0x59723a,_0x53d1b0){var _0x5e57fe,_0x531303,_0x177751,_0x47d537;_0x53d1b0[_0xdd78('0x49')]=intUtil[_0xdd78('0x4a')](_0x53d1b0['serverUrl']);_0x53d1b0[_0xdd78('0x44')]=intUtil[_0xdd78('0x4a')](_0x53d1b0[_0xdd78('0x44')]);if(_0x59723a&&_0x59723a[_0xdd78('0x66')]){logger[_0xdd78('0x21')]('['+_0x29df01['lastevent'][_0xdd78('0x67')]()+']',_0xdd78('0x4b'));_0x29df01[_0xdd78('0x4c')]=util['format'](_0xdd78('0x4d'),_0x53d1b0[_0xdd78('0x49')],_0x29df01[_0xdd78('0x4e')],md5(_0x29df01['uniqueid']));}else{_0x29df01[_0xdd78('0x4c')]='';}return getConnection(_0x53d1b0)[_0xdd78('0x1b')](function(_0x3a8971){_0x47d537=_0x3a8971;if(!_['isNil'](_0x537388)){return getUser(_0x53d1b0,_0x537388[_0xdd78('0x3e')],_0x47d537);}else{return getUser(_0x53d1b0,null,_0x47d537);}})[_0xdd78('0x1b')](function(_0x19e69b){_0x5e57fe=_0x19e69b;return getEndUser(_0x53d1b0,_0x160276,_0x29df01[_0xdd78('0x4f')],_0x29df01[_0xdd78('0x68')],_0x47d537);})[_0xdd78('0x1b')](function(_0x22ebf7){_0x531303=_0x22ebf7;return getTicket(_0x53d1b0,_0x5e57fe,_0x531303,_0x160276,_0x29df01,_0x160276[_0xdd78('0x50')],_0x47d537);})[_0xdd78('0x1b')](function(_0x44dfa2){_0x177751=_0x44dfa2;logger[_0xdd78('0x21')]('['+_0x29df01[_0xdd78('0x69')][_0xdd78('0x67')]()+_0xdd78('0x6a'),_0x177751['id']);logger[_0xdd78('0x21')]('['+_0x29df01[_0xdd78('0x69')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x53d1b0['type']);})[_0xdd78('0x58')](function(_0x51105f){logger['error']('['+_0x29df01['lastevent'][_0xdd78('0x67')]()+']',JSON[_0xdd78('0x5a')](_0x51105f));});}; \ No newline at end of file +var _0xa740=['Variable','name','toLowerCase','password','concat','Connection','remoteUri','clientId','login','username','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','user:%s','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','stringify','monitor_format','toUpperCase',']\x20Ticket\x20%s\x20created.','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','emit','ticketType','Task','assign','utc','getString','Descriptions','Case','Subjects','create','isNil','validateEmail','sobject','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','length','Lead','contact','Contact','lead','Name','Phone','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','string','idField','content','toString','type','variable','variableName','customVariable'];(function(_0x2bdaf8,_0x36cb7d){var _0x3a31a3=function(_0x351b7a){while(--_0x351b7a){_0x2bdaf8['push'](_0x2bdaf8['shift']());}};_0x3a31a3(++_0x36cb7d);}(_0xa740,0x10b));var _0x0a74=function(_0x4509ae,_0xfa23c6){_0x4509ae=_0x4509ae-0x0;var _0x496fd3=_0xa740[_0x4509ae];return _0x496fd3;};'use strict';var _=require(_0x0a74('0x0'));var rp=require(_0x0a74('0x1'));var moment=require(_0x0a74('0x2'));var BPromise=require('bluebird');var md5=require(_0x0a74('0x3'));var jsforce=require('jsforce');var util=require(_0x0a74('0x4'));var Redis=require('ioredis');var intUtil=require(_0x0a74('0x5'));var config=require(_0x0a74('0x6'));var logger=require(_0x0a74('0x7'))(_0x0a74('0x8'));config[_0x0a74('0x9')]=_['defaults'](config[_0x0a74('0x9')],{'host':_0x0a74('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a74('0x9')]));function emit(_0x2bba0e,_0x45aed1,_0x2b2e96){io['to'](_0x2bba0e)[_0x0a74('0xb')](_0x45aed1,_0x2b2e96);}function getTicket(_0x526417,_0x66d346,_0x10c3d9,_0x33e29e,_0x1cb695,_0x2153a6,_0x31d850,_0x434558){var _0x5022b4={};if(_0x33e29e[_0x0a74('0xc')]===_0x0a74('0xd')){_0x5022b4=Object[_0x0a74('0xe')]({},{'OwnerId':_0x66d346['id'],'ActivityDate':moment[_0x0a74('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x0a74('0x10')](_0x33e29e['Subjects'],_0x1cb695,'\x20'),'Description':intUtil[_0x0a74('0x10')](_0x33e29e[_0x0a74('0x11')],_0x1cb695,'\x0a')},getCustomFields(_0x2153a6,_0x1cb695));if(_0x10c3d9){_0x5022b4['WhoId']=_0x10c3d9['id'];}}else if(_0x33e29e[_0x0a74('0xc')]===_0x0a74('0x12')){_0x5022b4=Object[_0x0a74('0xe')]({},{'OwnerId':_0x66d346['id'],'Subject':intUtil[_0x0a74('0x10')](_0x33e29e[_0x0a74('0x13')],_0x1cb695,'\x20'),'Description':intUtil['getString'](_0x33e29e['Descriptions'],_0x1cb695,'\x0a')},getCustomFields(_0x2153a6,_0x1cb695));if(_0x10c3d9){_0x5022b4['ContactId']=_0x10c3d9['id'];}}return _0x31d850['sobject'](_0x33e29e[_0x0a74('0xc')])[_0x0a74('0x14')](_0x5022b4);}function getUser(_0x89e4a,_0x3a9507,_0x186adc){if(!_[_0x0a74('0x15')](_0x3a9507)&&intUtil[_0x0a74('0x16')](_0x3a9507)){var _0x5db1e3={'Email':_0x3a9507};var _0x39880e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x186adc[_0x0a74('0x17')](_0x0a74('0x18'))[_0x0a74('0x19')](_0x5db1e3,_0x39880e)[_0x0a74('0x1a')]()[_0x0a74('0x1b')](function(_0x6741ae){if(_0x6741ae['length']){var _0x1ef99b=_[_0x0a74('0x19')](_0x6741ae,function(_0x1a0923){return _0x1a0923[_0x0a74('0x1c')]===_0x3a9507;});if(_0x1ef99b){logger['info'](_0x0a74('0x1d'),_0x3a9507);return BPromise[_0x0a74('0x1e')]({'id':_0x1ef99b['Id'],'name':_0x1ef99b['Name']});}}else{logger[_0x0a74('0x1f')](_0x0a74('0x20'),_0x3a9507);return _0x186adc[_0x0a74('0x21')]()[_0x0a74('0x1b')](function(_0x356fd2){return BPromise[_0x0a74('0x1e')]({'id':_0x356fd2['user_id'],'name':_0x356fd2[_0x0a74('0x22')]});});}});}else{logger[_0x0a74('0x1f')](_0x0a74('0x20'),_0x3a9507);return _0x186adc[_0x0a74('0x21')]()['then'](function(_0x37a0b3){return BPromise[_0x0a74('0x1e')]({'id':_0x37a0b3[_0x0a74('0x23')],'name':_0x37a0b3[_0x0a74('0x22')]});});}}function getEndUser(_0x4e3462,_0x5bb4e9,_0x20e867,_0x28677d,_0x28fbaa){var _0x3fc864={'Phone':_0x28677d};var _0x102730={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x0a74('0x1e')]()[_0x0a74('0x1b')](function(){if(_0x5bb4e9[_0x0a74('0xc')]===_0x0a74('0xd')){logger[_0x0a74('0x1f')](_0x0a74('0x24'),_0x28677d,_0x5bb4e9[_0x0a74('0x25')]);switch(_0x5bb4e9[_0x0a74('0x25')]){case _0x0a74('0x26'):return _0x28fbaa[_0x0a74('0x17')]('Contact')[_0x0a74('0x19')](_0x3fc864,_0x102730)[_0x0a74('0x1a')]()[_0x0a74('0x1b')](function(_0x348d2d){if(_0x348d2d&&_0x348d2d[_0x0a74('0x27')]){return _0x348d2d;}else{return _0x28fbaa[_0x0a74('0x17')](_0x0a74('0x28'))[_0x0a74('0x19')](_0x3fc864,_0x102730);}});case _0x0a74('0x29'):return _0x28fbaa[_0x0a74('0x17')](_0x0a74('0x2a'))[_0x0a74('0x19')](_0x3fc864,_0x102730)[_0x0a74('0x1a')]();case _0x0a74('0x2b'):return _0x28fbaa[_0x0a74('0x17')](_0x0a74('0x28'))['find'](_0x3fc864,_0x102730);default:return null;}}else if(_0x5bb4e9[_0x0a74('0xc')]===_0x0a74('0x12')){logger['info'](_0x0a74('0x24'),_0x28677d,_0x0a74('0x29'));return _0x28fbaa[_0x0a74('0x17')](_0x0a74('0x2a'))[_0x0a74('0x19')](_0x3fc864,_0x102730)['execute']();}})[_0x0a74('0x1b')](function(_0x46740d){if(_0x46740d&&_0x46740d[_0x0a74('0x27')]){var _0x49a6d1=_[_0x0a74('0x19')](_0x46740d,function(_0xa4aafc){return _0xa4aafc['Phone']===_0x28677d;});if(_0x49a6d1){return BPromise[_0x0a74('0x1e')]({'id':_0x49a6d1['Id'],'name':_0x49a6d1[_0x0a74('0x2c')],'phone':_0x49a6d1[_0x0a74('0x2d')]});}}})[_0x0a74('0x1b')](function(_0x2fb585){if(_0x2fb585){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x28677d);return BPromise[_0x0a74('0x1e')](_0x2fb585);}else{logger[_0x0a74('0x1f')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x28677d);var _0x13435e={'LastName':_0x20e867!==_0x0a74('0x2e')?_0x20e867:util[_0x0a74('0x2f')](_0x0a74('0x30'),_0x28677d),'Phone':_0x28677d};if(_0x5bb4e9[_0x0a74('0x31')]){if(_0x5bb4e9[_0x0a74('0x31')]==='contact'){logger[_0x0a74('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x28677d,_0x5bb4e9['moduleCreate']);}else if(_0x5bb4e9['moduleCreate']===_0x0a74('0x2b')&&_0x5bb4e9[_0x0a74('0xc')]===_0x0a74('0xd')){logger['info'](_0x0a74('0x32'),_0x28677d,_0x5bb4e9['moduleCreate']);_0x13435e[_0x0a74('0x33')]=_0x0a74('0x34');}else{return null;}}return _0x28fbaa[_0x0a74('0x17')](_[_0x0a74('0x35')](_0x5bb4e9[_0x0a74('0x31')]))[_0x0a74('0x14')](_0x13435e);}});}function getCustomFields(_0x5de20f,_0x4a9f93){var _0x17ef8f={};if(_0x5de20f[_0x0a74('0x27')]>0x0){_[_0x0a74('0x36')](_0x5de20f,function(_0x54fe0a){if(_0x54fe0a['type']===_0x0a74('0x37')&&_0x54fe0a['idField']){_0x17ef8f[_0x54fe0a[_0x0a74('0x38')]]=_0x54fe0a[_0x0a74('0x39')][_0x0a74('0x3a')]();}else if(_0x54fe0a[_0x0a74('0x3b')]===_0x0a74('0x3c')&&_0x54fe0a[_0x0a74('0x3d')]&&_0x54fe0a[_0x0a74('0x38')]){_0x4a9f93[_0x54fe0a[_0x0a74('0x3d')]]&&(_0x17ef8f[_0x54fe0a[_0x0a74('0x38')]]=_0x4a9f93[_0x54fe0a[_0x0a74('0x3d')]][_0x0a74('0x3a')]());}else if(_0x54fe0a[_0x0a74('0x3b')]===_0x0a74('0x3e')&&_0x54fe0a['Variable']&&_0x54fe0a[_0x0a74('0x3f')][_0x0a74('0x40')]&&_0x54fe0a[_0x0a74('0x38')]){_0x4a9f93[_0x54fe0a['Variable']['name'][_0x0a74('0x41')]()]&&(_0x17ef8f[_0x54fe0a[_0x0a74('0x38')]]=_0x4a9f93[_0x54fe0a[_0x0a74('0x3f')][_0x0a74('0x40')]['toLowerCase']()][_0x0a74('0x3a')]());}});}return _0x17ef8f;}function getConnection(_0xe210ce){var _0x512c31=_0xe210ce[_0x0a74('0x42')][_0x0a74('0x43')](_0xe210ce['securityToken']);var _0x2f96ba=new jsforce[(_0x0a74('0x44'))]({'oauth2':{'loginUrl':_0xe210ce[_0x0a74('0x45')]||'https://login.salesforce.com','clientId':_0xe210ce[_0x0a74('0x46')],'clientSecret':_0xe210ce['clientSecret']}});return _0x2f96ba[_0x0a74('0x47')](_0xe210ce[_0x0a74('0x48')],_0x512c31)[_0x0a74('0x1b')](function(){logger[_0x0a74('0x1f')]('Connection\x20established.');return _0x2f96ba;});}exports['queue']=function(_0x142dc8,_0x44ed83,_0x5e5d0e,_0x51ede7,_0x1f45e8,_0x5a56d8){var _0x546ba0,_0xa47ee,_0x57082e,_0x543f8b;_0x5a56d8[_0x0a74('0x49')]=intUtil[_0x0a74('0x4a')](_0x5a56d8['serverUrl']);_0x5a56d8['remoteUri']=intUtil['stripTrailingSlash'](_0x5a56d8[_0x0a74('0x45')]);if(_0x1f45e8&&_0x1f45e8['monitor_format']){logger[_0x0a74('0x1f')](_0x0a74('0x4b'),_0x0a74('0x4c'));_0x44ed83[_0x0a74('0x4d')]=util[_0x0a74('0x2f')](_0x0a74('0x4e'),_0x5a56d8[_0x0a74('0x49')],_0x44ed83[_0x0a74('0x4f')],md5(_0x44ed83[_0x0a74('0x4f')]));}else{_0x44ed83[_0x0a74('0x4d')]='';}return getConnection(_0x5a56d8)[_0x0a74('0x1b')](function(_0x2a925a){_0x543f8b=_0x2a925a;return getUser(_0x5a56d8,_0x51ede7[_0x0a74('0x50')],_0x543f8b);})['then'](function(_0x14a82d){_0x546ba0=_0x14a82d;return getEndUser(_0x5a56d8,_0x5e5d0e,_0x44ed83[_0x0a74('0x51')],_0x44ed83['calleridnum'],_0x543f8b);})['then'](function(_0x1711be){_0xa47ee=_0x1711be;return getTicket(_0x5a56d8,_0x546ba0,_0xa47ee,_0x5e5d0e,_0x44ed83,_0x5e5d0e[_0x0a74('0x52')],_0x543f8b,_0x0a74('0x53'));})[_0x0a74('0x1b')](function(_0x3b8d4e){_0x57082e=_0x3b8d4e;logger[_0x0a74('0x1f')](_0x0a74('0x54'),_0x57082e['id']);logger[_0x0a74('0x1f')](_0x0a74('0x55'),_0x57082e['id'],_0x51ede7['name'],_0x5a56d8[_0x0a74('0x3b')]);switch(_0x5a56d8[_0x0a74('0x3b')]){case _0x0a74('0x56'):emit(util[_0x0a74('0x2f')]('user:%s',_0x51ede7[_0x0a74('0x40')]),'trigger:salesforce:display',{'recordId':_0x57082e['id']});break;case _0x0a74('0x57'):emit(util['format'](_0x0a74('0x58'),_0x51ede7[_0x0a74('0x40')]),_0x0a74('0x59'),{'uri':util[_0x0a74('0x2f')]('%s/%s/e',_0x543f8b[_0x0a74('0x5a')],_0x57082e['id'])});break;default:logger[_0x0a74('0x5b')](_0x0a74('0x5c'));}})[_0x0a74('0x5d')](function(_0x20af76){logger[_0x0a74('0x5b')](_0x0a74('0x4b'),JSON['stringify'](_0x20af76));});};exports[_0x0a74('0x5e')]=function(_0x25be9e,_0x89da89,_0x2c14e0,_0x3276bc,_0x14a42e,_0x5c165e,_0x2e2c61){var _0x2b112d,_0x2cb9fc,_0xbaa85b,_0x3a8203;_0x5c165e[_0x0a74('0x49')]=intUtil[_0x0a74('0x4a')](_0x5c165e['serverUrl']);_0x5c165e[_0x0a74('0x45')]=intUtil['stripTrailingSlash'](_0x5c165e[_0x0a74('0x45')]);if(_0x2e2c61&&_0x2e2c61[_0x0a74('0x5f')]&&_0x2e2c61[_0x0a74('0x5f')]!==_0x0a74('0x60')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x89da89[_0x0a74('0x4d')]=util[_0x0a74('0x2f')](_0x0a74('0x4e'),_0x5c165e[_0x0a74('0x49')],_0x89da89[_0x0a74('0x4f')],md5(_0x89da89[_0x0a74('0x4f')]));}return getConnection(_0x5c165e)['then'](function(_0x4f304e){_0x3a8203=_0x4f304e;return getUser(_0x5c165e,_0x3276bc[_0x0a74('0x50')],_0x3a8203);})[_0x0a74('0x1b')](function(_0x4bab6c){_0x2b112d=_0x4bab6c;return getEndUser(_0x5c165e,_0x2c14e0,_0x89da89[_0x0a74('0x61')],_0x89da89[_0x0a74('0x62')],_0x3a8203);})['then'](function(_0x45e4a5){_0x2cb9fc=_0x45e4a5;return getTicket(_0x5c165e,_0x2b112d,_0x2cb9fc,_0x2c14e0,_0x89da89,_0x2c14e0[_0x0a74('0x52')],_0x3a8203,_0x0a74('0x5e'));})[_0x0a74('0x1b')](function(_0x2c909a){_0xbaa85b=_0x2c909a;logger[_0x0a74('0x1f')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0xbaa85b['id']);logger['info'](_0x0a74('0x63'),_0xbaa85b['id'],_0x3276bc[_0x0a74('0x40')],_0x5c165e[_0x0a74('0x3b')]);switch(_0x5c165e[_0x0a74('0x3b')]){case _0x0a74('0x56'):emit(util[_0x0a74('0x2f')]('user:%s',_0x3276bc[_0x0a74('0x40')]),_0x0a74('0x64'),{'recordId':_0xbaa85b['id']});break;case _0x0a74('0x57'):emit(util[_0x0a74('0x2f')](_0x0a74('0x58'),_0x3276bc[_0x0a74('0x40')]),_0x0a74('0x59'),{'uri':util[_0x0a74('0x2f')](_0x0a74('0x65'),_0x3a8203[_0x0a74('0x5a')],_0xbaa85b['id'])});break;default:logger[_0x0a74('0x5b')](_0x0a74('0x66'),_0x0a74('0x67'));}})[_0x0a74('0x5d')](function(_0x1464c3){logger['error']('[OUTBOUND]',JSON[_0x0a74('0x68')](_0x1464c3));});};exports['unmanaged']=function(_0x5163c4,_0x16c789,_0x4a1c52,_0x1934b1,_0x5af469,_0x8513cf){var _0x36be5b,_0x3c658c,_0xb7c908,_0x57f5ee;_0x8513cf['serverUrl']=intUtil[_0x0a74('0x4a')](_0x8513cf['serverUrl']);_0x8513cf[_0x0a74('0x45')]=intUtil['stripTrailingSlash'](_0x8513cf[_0x0a74('0x45')]);if(_0x5af469&&_0x5af469[_0x0a74('0x69')]){logger[_0x0a74('0x1f')]('['+_0x16c789['lastevent']['toUpperCase']()+']',_0x0a74('0x4c'));_0x16c789[_0x0a74('0x4d')]=util[_0x0a74('0x2f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8513cf[_0x0a74('0x49')],_0x16c789[_0x0a74('0x4f')],md5(_0x16c789[_0x0a74('0x4f')]));}else{_0x16c789[_0x0a74('0x4d')]='';}return getConnection(_0x8513cf)[_0x0a74('0x1b')](function(_0x4f2477){_0x57f5ee=_0x4f2477;if(!_[_0x0a74('0x15')](_0x1934b1)){return getUser(_0x8513cf,_0x1934b1[_0x0a74('0x40')],_0x57f5ee);}else{return getUser(_0x8513cf,null,_0x57f5ee);}})[_0x0a74('0x1b')](function(_0x191e60){_0x36be5b=_0x191e60;return getEndUser(_0x8513cf,_0x4a1c52,_0x16c789[_0x0a74('0x51')],_0x16c789['calleridnum'],_0x57f5ee);})[_0x0a74('0x1b')](function(_0x279c2b){_0x3c658c=_0x279c2b;return getTicket(_0x8513cf,_0x36be5b,_0x3c658c,_0x4a1c52,_0x16c789,_0x4a1c52[_0x0a74('0x52')],_0x57f5ee);})[_0x0a74('0x1b')](function(_0x24be60){_0xb7c908=_0x24be60;logger[_0x0a74('0x1f')]('['+_0x16c789['lastevent'][_0x0a74('0x6a')]()+_0x0a74('0x6b'),_0xb7c908['id']);logger[_0x0a74('0x1f')]('['+_0x16c789[_0x0a74('0x6c')]['toUpperCase']()+_0x0a74('0x6d'),_0x8513cf['type']);})[_0x0a74('0x5d')](function(_0xf5c470){logger['error']('['+_0x16c789[_0x0a74('0x6c')][_0x0a74('0x6a')]()+']',JSON[_0x0a74('0x68')](_0xf5c470));});}; \ 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 0e7cedb..a96db09 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 _0x2ef3=['userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','catch','label','?sysparm_query=name%3D','label_entry','Incident','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','validateEmail'];(function(_0x28b035,_0xfa6753){var _0x5467ce=function(_0xf20440){while(--_0xf20440){_0x28b035['push'](_0x28b035['shift']());}};_0x5467ce(++_0xfa6753);}(_0x2ef3,0xba));var _0x32ef=function(_0x3a04e4,_0xa213d){_0x3a04e4=_0x3a04e4-0x0;var _0x358d45=_0x2ef3[_0x3a04e4];return _0x358d45;};'use strict';var _=require(_0x32ef('0x0'));var Promise=require(_0x32ef('0x1'));var rp=require(_0x32ef('0x2'));var util=require(_0x32ef('0x3'));var md5=require(_0x32ef('0x4'));var Redis=require(_0x32ef('0x5'));var intUtil=require('./util');var config=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('servicenow');config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));function getAdminUser(_0x367c39,_0x2fb8eb,_0x234863,_0x298066,_0x2484a0,_0x2bbb50){return new Promise(function(_0x28275c,_0x77df79){var _0x56eb42={'method':'GET','uri':_0x298066+_0x32ef('0xb')+'&'+_0x2484a0+'&'+_0x2bbb50,'auth':_0x2fb8eb,'json':!![]};return rp(_0x56eb42)[_0x32ef('0xc')](function(_0x45bfd5){if(_0x45bfd5[_0x32ef('0xd')]['length']>0x0){_0x234863[_0x32ef('0xe')]=_0x45bfd5['result'][0x0][_0x32ef('0xf')];}logger['info']('['+[_0x367c39[_0x32ef('0x10')]()]+_0x32ef('0x11'),_0x234863);_0x28275c(_0x234863);})['catch'](function(_0x539d18){logger[_0x32ef('0x12')]('['+[_0x367c39['toUpperCase']()]+']',_0x539d18[_0x32ef('0x13')]);_0x77df79(_0x539d18[_0x32ef('0x13')]);});});}function getUser(_0x93d492,_0x54c7f5,_0x57aff1,_0x55bf0b,_0x531e30){return function(_0x13db1a){logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x13db1a);return new Promise(function(_0x5d559b,_0x1eb468){if(intUtil[_0x32ef('0x15')](_0x13db1a[_0x32ef('0x16')])){var _0x57863c={'method':_0x32ef('0x17'),'uri':_0x57aff1+_0x32ef('0x18')+_0x13db1a['userEmail']+'&'+_0x55bf0b+'&'+_0x531e30,'auth':_0x54c7f5,'json':!![]};logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x19'),_0x57863c);return rp(_0x57863c)[_0x32ef('0xc')](function(_0x445cda){logger[_0x32ef('0x14')]('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1a'),_0x445cda);if(_0x445cda['result'][_0x32ef('0x1b')]>0x0&&String(_0x445cda[_0x32ef('0xd')][0x0]['active'])===_0x32ef('0x1c')){_0x13db1a[_0x32ef('0x1d')]=_0x445cda[_0x32ef('0xd')][0x0]['sys_id'];}else{_0x13db1a['userId']=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];}logger['info']('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1f'),_0x13db1a);_0x5d559b(_0x13db1a);})['catch'](function(_0x51a412){logger[_0x32ef('0x12')]('['+[_0x93d492[_0x32ef('0x10')]()]+']',_0x51a412[_0x32ef('0x13')]);_0x1eb468(_0x51a412[_0x32ef('0x13')]);});}else{logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x20'));_0x13db1a[_0x32ef('0x1d')]=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];_0x5d559b(_0x13db1a);}});};}function createEndUser(_0xba4b3f,_0x5a88a5,_0xd65fde,_0x2f5d06,_0x5a04cd){logger[_0x32ef('0x14')]('['+[_0xba4b3f[_0x32ef('0x10')]()]+_0x32ef('0x21'),_0xd65fde);return new Promise(function(_0x26e207,_0x50a95b){var _0x10e38c={'method':_0x32ef('0x22'),'uri':_0x2f5d06+_0x32ef('0x23')+_0x5a04cd,'body':{'user_name':_0xd65fde[_0x32ef('0x24')],'roles':_0x32ef('0x25'),'first_name':_0xd65fde[_0x32ef('0x24')],'active':_0x32ef('0x1c'),'date_format':'System','phone':_0xd65fde[_0x32ef('0x24')]},'auth':_0x5a88a5,'json':!![]};return rp(_0x10e38c)['then'](function(_0x38bf73){logger[_0x32ef('0x14')]('['+[_0xba4b3f['toUpperCase']()]+_0x32ef('0x26'),_0x38bf73[_0x32ef('0xd')]);_0xd65fde[_0x32ef('0x27')]=_0x38bf73[_0x32ef('0xd')][_0x32ef('0xf')];_0x26e207(_0xd65fde);})['catch'](function(_0x50ecd6){logger[_0x32ef('0x12')]('['+[_0xba4b3f['toUpperCase']()]+']',_0x50ecd6[_0x32ef('0x13')]);_0x50a95b(_0x50ecd6[_0x32ef('0x13')]);});});}function getEndUser(_0x2f1349,_0x390670,_0x389583,_0x22fa1a,_0x566b56){return function(_0x482d3a){logger['info']('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x28'),_0x482d3a);return new Promise(function(_0x136b02,_0x5f2443){var _0x4fb402={'method':_0x32ef('0x17'),'uri':_0x389583+_0x32ef('0x29')+_0x482d3a[_0x32ef('0x24')]+'&'+_0x22fa1a+'&'+_0x566b56,'auth':_0x390670,'json':!![]};return rp(_0x4fb402)['then'](function(_0x4abbd6){if(_0x4abbd6[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){_0x482d3a[_0x32ef('0x27')]=_0x4abbd6[_0x32ef('0xd')][0x0][_0x32ef('0xf')];logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2a'),_0x482d3a);_0x136b02(_0x482d3a);}else{return createEndUser(_0x2f1349,_0x390670,_0x482d3a,_0x389583,_0x22fa1a)[_0x32ef('0xc')](function(_0x4de939){logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2b'),_0x4de939);_0x136b02(_0x4de939);});}})['catch'](function(_0x365125){logger[_0x32ef('0x12')]('['+[_0x2f1349[_0x32ef('0x10')]()]+']',_0x365125[_0x32ef('0x13')]);_0x5f2443(_0x365125[_0x32ef('0x13')]);});});};}function getCustomFields(_0x33a0fb,_0x256c40){var _0x1cebed={};if(_0x33a0fb[_0x32ef('0x1b')]>0x0){_[_0x32ef('0x2c')](_0x33a0fb,function(_0xb4db74){if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74[_0x32ef('0x2e')]&&!_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74['idField']&&_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')]['toString']();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x34')&&_0xb4db74['variableName']&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0x256c40[_0xb4db74[_0x32ef('0x35')]][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x36')&&_0xb4db74[_0x32ef('0x37')]&&_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')]&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')]['toLowerCase']()]=_0x256c40[_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')][_0x32ef('0x31')]()]['toString']();}});}return _0x1cebed;}function getTicket(_0x502113,_0x230ac9,_0x37b954,_0x241f82,_0x35b4e0,_0x40bf12){return function(_0x12c9e6){logger['info']('['+[_0x502113['toUpperCase']()]+_0x32ef('0x39'),_0x12c9e6);return new Promise(function(_0x270826,_0x27d65b){var _0x13b270=_0x502113[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x12c9e6[_0x32ef('0x1d')]:_0x12c9e6[_0x32ef('0x27')];var _0xc10e7={'method':_0x32ef('0x22'),'uri':_0x37b954+_0x32ef('0x3b')+'?'+_0x40bf12,'body':Object[_0x32ef('0x3c')]({},{'active':_0x32ef('0x1c'),'caller_id':_0x13b270,'assigned_to':_0x12c9e6['userId'],'short_description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3e')],_0x35b4e0,'\x20'),'description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3f')],_0x35b4e0,'\x0a')},getCustomFields(_0x241f82[_0x32ef('0x40')],_0x35b4e0)),'auth':_0x230ac9,'json':!![]};return rp(_0xc10e7)[_0x32ef('0xc')](function(_0x278696){logger[_0x32ef('0x14')]('['+[_0x502113[_0x32ef('0x10')]()]+_0x32ef('0x41'),_0x278696[_0x32ef('0xd')]);_0x12c9e6[_0x32ef('0x42')]=_0x278696[_0x32ef('0xd')][_0x32ef('0xf')];_0x12c9e6[_0x32ef('0x43')]=_0x278696[_0x32ef('0xd')][_0x32ef('0x44')];logger[_0x32ef('0x14')]('['+[_0x502113['toUpperCase']()]+']\x20getTicket\x20crm',_0x12c9e6);_0x270826(_0x12c9e6);})[_0x32ef('0x45')](function(_0x259c32){logger[_0x32ef('0x12')]('['+[_0x502113[_0x32ef('0x10')]()]+']',_0x259c32[_0x32ef('0x13')]);_0x27d65b(_0x259c32[_0x32ef('0x13')]);});});};}function createRemoteTag(_0x1572d9,_0x1f105a,_0x15b640,_0x368bf1){return new Promise(function(_0x3697a7,_0x4a6fd2){var _0x21216d={'method':_0x32ef('0x22'),'uri':_0x15b640+_0x32ef('0x46')+'?'+_0x368bf1,'body':{'short_description':_0x1572d9,'global':!![],'active':!![],'name':_0x1572d9},'auth':_0x1f105a,'json':!![]};return rp(_0x21216d)[_0x32ef('0xc')](function(_0x38314a){var _0x387cf0=_0x38314a['result'][_0x32ef('0xf')];_0x3697a7(_0x387cf0);});});}function getRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa,_0x52692a){return new Promise(function(_0x2ee3dd,_0xbe35b){var _0x579bc1={'method':_0x32ef('0x17'),'uri':_0x56b7ce+'label'+_0x32ef('0x47')+_0x1eeb3e+'&'+_0x1b0faa,'auth':_0x31d5d8,'json':!![]};return rp(_0x579bc1)[_0x32ef('0xc')](function(_0x2bff39){if(_0x2bff39[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){var _0x30e377=_0x2bff39[_0x32ef('0xd')][0x0]['sys_id'];_0x2ee3dd(_0x30e377);}else{return createRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa)['then'](function(_0xdfa103){_0x2ee3dd(_0xdfa103);});}});});}function assignTagToIncident(_0x52232a,_0x4fbab6,_0xb519e9,_0x89d0b3,_0x2ef0f8){return new Promise(function(_0x6aae59,_0x2468e6){var _0x356704={'method':_0x32ef('0x22'),'uri':_0xb519e9+_0x32ef('0x48')+'?'+_0x2ef0f8,'body':{'label':_0x52232a,'table':_0x32ef('0x3b'),'id_type':_0x32ef('0x49'),'table_key':_0x89d0b3['ticketId'],'title':'Incident\x20-\x20'+_0x89d0b3[_0x32ef('0x43')],'id_display':_0x89d0b3[_0x32ef('0x43')]},'auth':_0x4fbab6,'json':!![]};return rp(_0x356704)['then'](function(_0xda1d1){_0x6aae59();})[_0x32ef('0x45')](function(){_0x6aae59();});});}function manageTags(_0x2b5703,_0x49c245,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0,_0x5e6030){return new Promise(function(_0x13ea1a,_0x47d8bf){var _0x17f447=[];_0x49c245['forEach'](function(_0x58b652){_0x17f447[_0x32ef('0x4a')](getRemoteTag(_0x58b652,_0x2ac877,_0x3c31d0,_0x52dfe0,_0x5e6030));});return Promise[_0x32ef('0x4b')](_0x17f447)[_0x32ef('0xc')](function(_0x5dca6a){if(_0x5dca6a[_0x32ef('0x1b')]){logger[_0x32ef('0x14')]('['+[_0x2b5703[_0x32ef('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5dca6a);var _0x4557ce=[];_0x5dca6a[_0x32ef('0x2c')](function(_0x4c3bab){_0x4557ce['push'](assignTagToIncident(_0x4c3bab,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0));});return Promise[_0x32ef('0x4b')](_0x4557ce)[_0x32ef('0xc')](function(){_0x13ea1a();})[_0x32ef('0x45')](function(){_0x13ea1a();});}else{_0x13ea1a();}});});}function getTags(_0x339625,_0x4c4df8,_0x40700e,_0x4c89e8,_0x285330,_0x63b65){return function(_0x25b6d6){return new Promise(function(_0x36ed97,_0x21e930){var _0x340861=[];var _0x1dc755=_0x4c89e8[_0x32ef('0x4c')];if(_0x1dc755&&_0x1dc755[_0x32ef('0x1b')]>0x0){_0x340861=_['map'](_0x1dc755,_0x32ef('0x38'));}if(_0x340861[_0x32ef('0x1b')]>0x0){return manageTags(_0x339625,_0x340861,_0x4c4df8,_0x40700e,_0x25b6d6,_0x285330,_0x63b65)[_0x32ef('0xc')](function(){_0x36ed97(_0x25b6d6);});}else{_0x36ed97(_0x25b6d6);}});};}function emit(_0x1c629d,_0x79ae28,_0x5ad75c){var _0x47c0ed=_0x32ef('0x4d')+_0x32ef('0x4e')+_0x32ef('0x4f')+_0x32ef('0x50');var _0x1a8bad={'uri':_0x1c629d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5ad75c+_0x47c0ed};io['to'](util[_0x32ef('0x51')]('user:%s',_0x79ae28))[_0x32ef('0x52')](_0x32ef('0x53'),_0x1a8bad);}exports['cs']=function(_0x48b6f4,_0x5402b4,_0x2c9f7a,_0x1538d0,_0x2e0873,_0x5b378b,_0x52b63b,_0x3b4a8e){var _0x5edd29={};var _0x7d2c3a={'user':_0x5b378b[_0x32ef('0x54')],'pass':_0x5b378b['password']};var _0x476bbf=_0x32ef('0x55');var _0x974974=_0x32ef('0x56');_0x5b378b[_0x32ef('0x57')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x57')]);_0x5b378b[_0x32ef('0x59')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x59')]);var _0x132d9f=util[_0x32ef('0x51')]('%s/api/now/table/',_0x5b378b['remoteUri']);_0x5edd29[_0x32ef('0x16')]=!_[_0x32ef('0x5a')](_0x1538d0)?_0x1538d0['email']:null;_0x5edd29[_0x32ef('0x1e')]=_0x5b378b['email'];_0x5edd29[_0x32ef('0x24')]=_0x3b4a8e[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x5402b4['destcalleridnum']:_0x5402b4[_0x32ef('0x5b')];_0x5edd29['callDirection']=_0x3b4a8e===_0x32ef('0x5c')||_0x3b4a8e===_0x32ef('0x5d')?'queue':'outbound';var _0x3c9039=util['format'](_0x32ef('0x5e'),_0x5b378b['serverUrl'],_0x5402b4[_0x32ef('0x5f')],md5(_0x5402b4[_0x32ef('0x5f')]));if(_0x2e0873&&_0x2e0873[_0x32ef('0x60')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else if(_0x52b63b&&_0x52b63b['recordingFormat']&&_0x52b63b[_0x32ef('0x62')]!==_0x32ef('0x63')){logger[_0x32ef('0x14')](_0x32ef('0x64'),_0x32ef('0x65'));_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else{_0x5402b4['recordingURL']='';}return getAdminUser(_0x3b4a8e,_0x7d2c3a,_0x5edd29,_0x132d9f,_0x974974,_0x476bbf)[_0x32ef('0xc')](getUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getEndUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getTicket(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x2c9f7a,_0x5402b4,_0x974974))[_0x32ef('0xc')](function(_0x5c4f2a){logger[_0x32ef('0x14')](util[_0x32ef('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5c4f2a[_0x32ef('0x42')]));logger[_0x32ef('0x14')](util[_0x32ef('0x51')](_0x32ef('0x66'),_0x3b4a8e));if(_0x3b4a8e!==_0x32ef('0x5d')){logger[_0x32ef('0x14')]('['+[_0x3b4a8e['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5b378b[_0x32ef('0x57')],_0x1538d0['name'],_0x5c4f2a[_0x32ef('0x42')]);}})[_0x32ef('0x45')](function(_0x114d8e){logger[_0x32ef('0x12')]('['+[_0x3b4a8e[_0x32ef('0x10')]()]+_0x32ef('0x67'),util['inspect'](_0x114d8e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2ef3=['userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','catch','label','?sysparm_query=name%3D','label_entry','Incident','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','validateEmail'];(function(_0x47a64e,_0x1de825){var _0x3179b8=function(_0xccfdd5){while(--_0xccfdd5){_0x47a64e['push'](_0x47a64e['shift']());}};_0x3179b8(++_0x1de825);}(_0x2ef3,0xba));var _0x32ef=function(_0x200372,_0x568430){_0x200372=_0x200372-0x0;var _0x2e16f6=_0x2ef3[_0x200372];return _0x2e16f6;};'use strict';var _=require(_0x32ef('0x0'));var Promise=require(_0x32ef('0x1'));var rp=require(_0x32ef('0x2'));var util=require(_0x32ef('0x3'));var md5=require(_0x32ef('0x4'));var Redis=require(_0x32ef('0x5'));var intUtil=require('./util');var config=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('servicenow');config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));function getAdminUser(_0x367c39,_0x2fb8eb,_0x234863,_0x298066,_0x2484a0,_0x2bbb50){return new Promise(function(_0x28275c,_0x77df79){var _0x56eb42={'method':'GET','uri':_0x298066+_0x32ef('0xb')+'&'+_0x2484a0+'&'+_0x2bbb50,'auth':_0x2fb8eb,'json':!![]};return rp(_0x56eb42)[_0x32ef('0xc')](function(_0x45bfd5){if(_0x45bfd5[_0x32ef('0xd')]['length']>0x0){_0x234863[_0x32ef('0xe')]=_0x45bfd5['result'][0x0][_0x32ef('0xf')];}logger['info']('['+[_0x367c39[_0x32ef('0x10')]()]+_0x32ef('0x11'),_0x234863);_0x28275c(_0x234863);})['catch'](function(_0x539d18){logger[_0x32ef('0x12')]('['+[_0x367c39['toUpperCase']()]+']',_0x539d18[_0x32ef('0x13')]);_0x77df79(_0x539d18[_0x32ef('0x13')]);});});}function getUser(_0x93d492,_0x54c7f5,_0x57aff1,_0x55bf0b,_0x531e30){return function(_0x13db1a){logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x13db1a);return new Promise(function(_0x5d559b,_0x1eb468){if(intUtil[_0x32ef('0x15')](_0x13db1a[_0x32ef('0x16')])){var _0x57863c={'method':_0x32ef('0x17'),'uri':_0x57aff1+_0x32ef('0x18')+_0x13db1a['userEmail']+'&'+_0x55bf0b+'&'+_0x531e30,'auth':_0x54c7f5,'json':!![]};logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x19'),_0x57863c);return rp(_0x57863c)[_0x32ef('0xc')](function(_0x445cda){logger[_0x32ef('0x14')]('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1a'),_0x445cda);if(_0x445cda['result'][_0x32ef('0x1b')]>0x0&&String(_0x445cda[_0x32ef('0xd')][0x0]['active'])===_0x32ef('0x1c')){_0x13db1a[_0x32ef('0x1d')]=_0x445cda[_0x32ef('0xd')][0x0]['sys_id'];}else{_0x13db1a['userId']=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];}logger['info']('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1f'),_0x13db1a);_0x5d559b(_0x13db1a);})['catch'](function(_0x51a412){logger[_0x32ef('0x12')]('['+[_0x93d492[_0x32ef('0x10')]()]+']',_0x51a412[_0x32ef('0x13')]);_0x1eb468(_0x51a412[_0x32ef('0x13')]);});}else{logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x20'));_0x13db1a[_0x32ef('0x1d')]=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];_0x5d559b(_0x13db1a);}});};}function createEndUser(_0xba4b3f,_0x5a88a5,_0xd65fde,_0x2f5d06,_0x5a04cd){logger[_0x32ef('0x14')]('['+[_0xba4b3f[_0x32ef('0x10')]()]+_0x32ef('0x21'),_0xd65fde);return new Promise(function(_0x26e207,_0x50a95b){var _0x10e38c={'method':_0x32ef('0x22'),'uri':_0x2f5d06+_0x32ef('0x23')+_0x5a04cd,'body':{'user_name':_0xd65fde[_0x32ef('0x24')],'roles':_0x32ef('0x25'),'first_name':_0xd65fde[_0x32ef('0x24')],'active':_0x32ef('0x1c'),'date_format':'System','phone':_0xd65fde[_0x32ef('0x24')]},'auth':_0x5a88a5,'json':!![]};return rp(_0x10e38c)['then'](function(_0x38bf73){logger[_0x32ef('0x14')]('['+[_0xba4b3f['toUpperCase']()]+_0x32ef('0x26'),_0x38bf73[_0x32ef('0xd')]);_0xd65fde[_0x32ef('0x27')]=_0x38bf73[_0x32ef('0xd')][_0x32ef('0xf')];_0x26e207(_0xd65fde);})['catch'](function(_0x50ecd6){logger[_0x32ef('0x12')]('['+[_0xba4b3f['toUpperCase']()]+']',_0x50ecd6[_0x32ef('0x13')]);_0x50a95b(_0x50ecd6[_0x32ef('0x13')]);});});}function getEndUser(_0x2f1349,_0x390670,_0x389583,_0x22fa1a,_0x566b56){return function(_0x482d3a){logger['info']('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x28'),_0x482d3a);return new Promise(function(_0x136b02,_0x5f2443){var _0x4fb402={'method':_0x32ef('0x17'),'uri':_0x389583+_0x32ef('0x29')+_0x482d3a[_0x32ef('0x24')]+'&'+_0x22fa1a+'&'+_0x566b56,'auth':_0x390670,'json':!![]};return rp(_0x4fb402)['then'](function(_0x4abbd6){if(_0x4abbd6[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){_0x482d3a[_0x32ef('0x27')]=_0x4abbd6[_0x32ef('0xd')][0x0][_0x32ef('0xf')];logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2a'),_0x482d3a);_0x136b02(_0x482d3a);}else{return createEndUser(_0x2f1349,_0x390670,_0x482d3a,_0x389583,_0x22fa1a)[_0x32ef('0xc')](function(_0x4de939){logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2b'),_0x4de939);_0x136b02(_0x4de939);});}})['catch'](function(_0x365125){logger[_0x32ef('0x12')]('['+[_0x2f1349[_0x32ef('0x10')]()]+']',_0x365125[_0x32ef('0x13')]);_0x5f2443(_0x365125[_0x32ef('0x13')]);});});};}function getCustomFields(_0x33a0fb,_0x256c40){var _0x1cebed={};if(_0x33a0fb[_0x32ef('0x1b')]>0x0){_[_0x32ef('0x2c')](_0x33a0fb,function(_0xb4db74){if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74[_0x32ef('0x2e')]&&!_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74['idField']&&_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')]['toString']();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x34')&&_0xb4db74['variableName']&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0x256c40[_0xb4db74[_0x32ef('0x35')]][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x36')&&_0xb4db74[_0x32ef('0x37')]&&_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')]&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')]['toLowerCase']()]=_0x256c40[_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')][_0x32ef('0x31')]()]['toString']();}});}return _0x1cebed;}function getTicket(_0x502113,_0x230ac9,_0x37b954,_0x241f82,_0x35b4e0,_0x40bf12){return function(_0x12c9e6){logger['info']('['+[_0x502113['toUpperCase']()]+_0x32ef('0x39'),_0x12c9e6);return new Promise(function(_0x270826,_0x27d65b){var _0x13b270=_0x502113[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x12c9e6[_0x32ef('0x1d')]:_0x12c9e6[_0x32ef('0x27')];var _0xc10e7={'method':_0x32ef('0x22'),'uri':_0x37b954+_0x32ef('0x3b')+'?'+_0x40bf12,'body':Object[_0x32ef('0x3c')]({},{'active':_0x32ef('0x1c'),'caller_id':_0x13b270,'assigned_to':_0x12c9e6['userId'],'short_description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3e')],_0x35b4e0,'\x20'),'description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3f')],_0x35b4e0,'\x0a')},getCustomFields(_0x241f82[_0x32ef('0x40')],_0x35b4e0)),'auth':_0x230ac9,'json':!![]};return rp(_0xc10e7)[_0x32ef('0xc')](function(_0x278696){logger[_0x32ef('0x14')]('['+[_0x502113[_0x32ef('0x10')]()]+_0x32ef('0x41'),_0x278696[_0x32ef('0xd')]);_0x12c9e6[_0x32ef('0x42')]=_0x278696[_0x32ef('0xd')][_0x32ef('0xf')];_0x12c9e6[_0x32ef('0x43')]=_0x278696[_0x32ef('0xd')][_0x32ef('0x44')];logger[_0x32ef('0x14')]('['+[_0x502113['toUpperCase']()]+']\x20getTicket\x20crm',_0x12c9e6);_0x270826(_0x12c9e6);})[_0x32ef('0x45')](function(_0x259c32){logger[_0x32ef('0x12')]('['+[_0x502113[_0x32ef('0x10')]()]+']',_0x259c32[_0x32ef('0x13')]);_0x27d65b(_0x259c32[_0x32ef('0x13')]);});});};}function createRemoteTag(_0x1572d9,_0x1f105a,_0x15b640,_0x368bf1){return new Promise(function(_0x3697a7,_0x4a6fd2){var _0x21216d={'method':_0x32ef('0x22'),'uri':_0x15b640+_0x32ef('0x46')+'?'+_0x368bf1,'body':{'short_description':_0x1572d9,'global':!![],'active':!![],'name':_0x1572d9},'auth':_0x1f105a,'json':!![]};return rp(_0x21216d)[_0x32ef('0xc')](function(_0x38314a){var _0x387cf0=_0x38314a['result'][_0x32ef('0xf')];_0x3697a7(_0x387cf0);});});}function getRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa,_0x52692a){return new Promise(function(_0x2ee3dd,_0xbe35b){var _0x579bc1={'method':_0x32ef('0x17'),'uri':_0x56b7ce+'label'+_0x32ef('0x47')+_0x1eeb3e+'&'+_0x1b0faa,'auth':_0x31d5d8,'json':!![]};return rp(_0x579bc1)[_0x32ef('0xc')](function(_0x2bff39){if(_0x2bff39[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){var _0x30e377=_0x2bff39[_0x32ef('0xd')][0x0]['sys_id'];_0x2ee3dd(_0x30e377);}else{return createRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa)['then'](function(_0xdfa103){_0x2ee3dd(_0xdfa103);});}});});}function assignTagToIncident(_0x52232a,_0x4fbab6,_0xb519e9,_0x89d0b3,_0x2ef0f8){return new Promise(function(_0x6aae59,_0x2468e6){var _0x356704={'method':_0x32ef('0x22'),'uri':_0xb519e9+_0x32ef('0x48')+'?'+_0x2ef0f8,'body':{'label':_0x52232a,'table':_0x32ef('0x3b'),'id_type':_0x32ef('0x49'),'table_key':_0x89d0b3['ticketId'],'title':'Incident\x20-\x20'+_0x89d0b3[_0x32ef('0x43')],'id_display':_0x89d0b3[_0x32ef('0x43')]},'auth':_0x4fbab6,'json':!![]};return rp(_0x356704)['then'](function(_0xda1d1){_0x6aae59();})[_0x32ef('0x45')](function(){_0x6aae59();});});}function manageTags(_0x2b5703,_0x49c245,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0,_0x5e6030){return new Promise(function(_0x13ea1a,_0x47d8bf){var _0x17f447=[];_0x49c245['forEach'](function(_0x58b652){_0x17f447[_0x32ef('0x4a')](getRemoteTag(_0x58b652,_0x2ac877,_0x3c31d0,_0x52dfe0,_0x5e6030));});return Promise[_0x32ef('0x4b')](_0x17f447)[_0x32ef('0xc')](function(_0x5dca6a){if(_0x5dca6a[_0x32ef('0x1b')]){logger[_0x32ef('0x14')]('['+[_0x2b5703[_0x32ef('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5dca6a);var _0x4557ce=[];_0x5dca6a[_0x32ef('0x2c')](function(_0x4c3bab){_0x4557ce['push'](assignTagToIncident(_0x4c3bab,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0));});return Promise[_0x32ef('0x4b')](_0x4557ce)[_0x32ef('0xc')](function(){_0x13ea1a();})[_0x32ef('0x45')](function(){_0x13ea1a();});}else{_0x13ea1a();}});});}function getTags(_0x339625,_0x4c4df8,_0x40700e,_0x4c89e8,_0x285330,_0x63b65){return function(_0x25b6d6){return new Promise(function(_0x36ed97,_0x21e930){var _0x340861=[];var _0x1dc755=_0x4c89e8[_0x32ef('0x4c')];if(_0x1dc755&&_0x1dc755[_0x32ef('0x1b')]>0x0){_0x340861=_['map'](_0x1dc755,_0x32ef('0x38'));}if(_0x340861[_0x32ef('0x1b')]>0x0){return manageTags(_0x339625,_0x340861,_0x4c4df8,_0x40700e,_0x25b6d6,_0x285330,_0x63b65)[_0x32ef('0xc')](function(){_0x36ed97(_0x25b6d6);});}else{_0x36ed97(_0x25b6d6);}});};}function emit(_0x1c629d,_0x79ae28,_0x5ad75c){var _0x47c0ed=_0x32ef('0x4d')+_0x32ef('0x4e')+_0x32ef('0x4f')+_0x32ef('0x50');var _0x1a8bad={'uri':_0x1c629d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5ad75c+_0x47c0ed};io['to'](util[_0x32ef('0x51')]('user:%s',_0x79ae28))[_0x32ef('0x52')](_0x32ef('0x53'),_0x1a8bad);}exports['cs']=function(_0x48b6f4,_0x5402b4,_0x2c9f7a,_0x1538d0,_0x2e0873,_0x5b378b,_0x52b63b,_0x3b4a8e){var _0x5edd29={};var _0x7d2c3a={'user':_0x5b378b[_0x32ef('0x54')],'pass':_0x5b378b['password']};var _0x476bbf=_0x32ef('0x55');var _0x974974=_0x32ef('0x56');_0x5b378b[_0x32ef('0x57')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x57')]);_0x5b378b[_0x32ef('0x59')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x59')]);var _0x132d9f=util[_0x32ef('0x51')]('%s/api/now/table/',_0x5b378b['remoteUri']);_0x5edd29[_0x32ef('0x16')]=!_[_0x32ef('0x5a')](_0x1538d0)?_0x1538d0['email']:null;_0x5edd29[_0x32ef('0x1e')]=_0x5b378b['email'];_0x5edd29[_0x32ef('0x24')]=_0x3b4a8e[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x5402b4['destcalleridnum']:_0x5402b4[_0x32ef('0x5b')];_0x5edd29['callDirection']=_0x3b4a8e===_0x32ef('0x5c')||_0x3b4a8e===_0x32ef('0x5d')?'queue':'outbound';var _0x3c9039=util['format'](_0x32ef('0x5e'),_0x5b378b['serverUrl'],_0x5402b4[_0x32ef('0x5f')],md5(_0x5402b4[_0x32ef('0x5f')]));if(_0x2e0873&&_0x2e0873[_0x32ef('0x60')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else if(_0x52b63b&&_0x52b63b['recordingFormat']&&_0x52b63b[_0x32ef('0x62')]!==_0x32ef('0x63')){logger[_0x32ef('0x14')](_0x32ef('0x64'),_0x32ef('0x65'));_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else{_0x5402b4['recordingURL']='';}return getAdminUser(_0x3b4a8e,_0x7d2c3a,_0x5edd29,_0x132d9f,_0x974974,_0x476bbf)[_0x32ef('0xc')](getUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getEndUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getTicket(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x2c9f7a,_0x5402b4,_0x974974))[_0x32ef('0xc')](function(_0x5c4f2a){logger[_0x32ef('0x14')](util[_0x32ef('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5c4f2a[_0x32ef('0x42')]));logger[_0x32ef('0x14')](util[_0x32ef('0x51')](_0x32ef('0x66'),_0x3b4a8e));if(_0x3b4a8e!==_0x32ef('0x5d')){logger[_0x32ef('0x14')]('['+[_0x3b4a8e['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5b378b[_0x32ef('0x57')],_0x1538d0['name'],_0x5c4f2a[_0x32ef('0x42')]);}})[_0x32ef('0x45')](function(_0x114d8e){logger[_0x32ef('0x12')]('['+[_0x3b4a8e[_0x32ef('0x10')]()]+_0x32ef('0x67'),util['inspect'](_0x114d8e,{'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 cbb61b1..61d4401 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 _0x93ed=['Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','error','unmanaged','lastevent','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','date_start','toISOString','slice','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','length','push','idField','variableName','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','entry_list','find','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','format','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','forEach','type','string','nameField','toLowerCase','content','customField','custom_fields','variable','customVariable','Variable','POST','login','username','password','PLAIN','sessionID','resolve','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','none'];(function(_0x3efd17,_0x298d48){var _0x2832a5=function(_0x5d7ead){while(--_0x5d7ead){_0x3efd17['push'](_0x3efd17['shift']());}};_0x2832a5(++_0x298d48);}(_0x93ed,0xfe));var _0xd93e=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x93ed[_0x5ce3c8];return _0xa76867;};'use strict';var _=require(_0xd93e('0x0'));var rp=require(_0xd93e('0x1'));var BPromise=require(_0xd93e('0x2'));var md5=require(_0xd93e('0x3'));var util=require(_0xd93e('0x4'));var Redis=require('ioredis');var intUtil=require(_0xd93e('0x5'));var config=require('../../../../config/environment');var logger=require(_0xd93e('0x6'))(_0xd93e('0x7'));config['redis']=_[_0xd93e('0x8')](config[_0xd93e('0x9')],{'host':_0xd93e('0xa'),'port':0x18eb});var io=require(_0xd93e('0xb'))(new Redis(config[_0xd93e('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x4ef1a1,_0x466fca,_0x3b1527){io['to'](_0x4ef1a1)[_0xd93e('0xc')](_0x466fca,_0x3b1527);}function getTicket(_0x14fc46,_0x561e6d,_0x4bb433,_0x25b7c0,_0x5d916b,_0x3f3f19,_0x276b19,_0xc194fe){logger[_0xd93e('0xd')](_0xd93e('0xe'));var _0x5993e5=new Date();var _0x652ac9=[{'name':_0xd93e('0xf'),'value':intUtil[_0xd93e('0x10')](_0x25b7c0[_0xd93e('0x11')],_0x5d916b,'\x20')},{'name':_0xd93e('0x12'),'value':_0x561e6d['id']},{'name':'created_by','value':_0x561e6d['id']},{'name':'description','value':intUtil['getString'](_0x25b7c0['Descriptions'],_0x5d916b,'\x0a')},{'name':_0xd93e('0x13'),'value':_0x5993e5[_0xd93e('0x14')]()[_0xd93e('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0xd93e('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xd93e('0x17'),'value':_0x4bb433['id']},{'name':_0xd93e('0x18'),'value':_0xd93e('0x19')},{'name':_0xd93e('0x1a'),'value':_0x4bb433[_0xd93e('0xf')]},{'name':_0xd93e('0x1b'),'value':_0xc194fe}];if(_0x3f3f19[_0xd93e('0x1c')]){_['forEach'](_0x3f3f19,function(_0x50c196){if(_0x5d916b[_0x50c196['variableName']]){_0x652ac9[_0xd93e('0x1d')]({'name':_0x50c196[_0xd93e('0x1e')],'value':_0x5d916b[_0x50c196[_0xd93e('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xd93e('0x20'),'rest_data':JSON[_0xd93e('0x21')]({'session':_0x276b19['id'],'module_name':_0xd93e('0x22'),'name_value_list':_0x652ac9})}});}function getAuth(_0x235687){return util['format'](_0xd93e('0x23'),new Buffer(_0x235687[_0xd93e('0x24')]+':X')[_0xd93e('0x25')](_0xd93e('0x26')));}function getServerInfo(_0x25193b){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0xd93e('0x20'),'rest_data':JSON[_0xd93e('0x21')]({'session':_0x25193b['id']})}});}function getUser(_0xd34caf,_0xe5553f,_0xd74297){if(!_[_0xd93e('0x27')](_0xe5553f)){logger[_0xd93e('0xd')](_0xd93e('0x28'),_0xe5553f);return request({'form':{'method':_0xd93e('0x29'),'input_type':_0xd93e('0x20'),'response_type':_0xd93e('0x20'),'rest_data':JSON['stringify']({'session':_0xd74297['id'],'module_name':_0xd93e('0x2a'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xe5553f),'order_by':'','offset':'0','select_fields':['id',_0xd93e('0xf'),_0xd93e('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2f3fac){if(_0x2f3fac[_0xd93e('0x2c')][_0xd93e('0x1c')]){var _0x49ae2c=_[_0xd93e('0x2d')](_0x2f3fac[_0xd93e('0x2c')],function(_0x5a5f48){return _0x5a5f48[_0xd93e('0x2e')][_0xd93e('0x2b')][_0xd93e('0x2f')]===_0xe5553f;});if(_0x49ae2c){logger[_0xd93e('0xd')]('Agent\x20found!');return BPromise['resolve']({'id':_0x49ae2c['name_value_list']['id'][_0xd93e('0x2f')],'name':_0x49ae2c[_0xd93e('0x2e')][_0xd93e('0xf')][_0xd93e('0x2f')]});}}logger[_0xd93e('0xd')](_0xd93e('0x30'));return BPromise['resolve']({'id':_0xd74297[_0xd93e('0x2e')]['user_id'][_0xd93e('0x2f')],'name':_0xd74297[_0xd93e('0x2e')][_0xd93e('0x2b')][_0xd93e('0x2f')]});});}else{logger[_0xd93e('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0xd74297['name_value_list']['user_id']['value'],'name':_0xd74297[_0xd93e('0x2e')][_0xd93e('0x2b')][_0xd93e('0x2f')]});}}function getEndUser(_0x589412,_0x210e99,_0x59b772,_0x599f40){logger[_0xd93e('0xd')](_0xd93e('0x31'),_0x59b772);return request({'form':{'method':_0xd93e('0x29'),'input_type':_0xd93e('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x599f40['id'],'module_name':_0xd93e('0x19'),'query':util[_0xd93e('0x32')](_0xd93e('0x33'),_0x59b772),'order_by':'','offset':'0','select_fields':['id','name',_0xd93e('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd93e('0x35')](function(_0x4f79d4){if(_0x4f79d4['entry_list']['length']){var _0x8849b3=_[_0xd93e('0x2d')](_0x4f79d4[_0xd93e('0x2c')],function(_0x4455dd){return _0x4455dd[_0xd93e('0x2e')][_0xd93e('0x34')][_0xd93e('0x2f')]===_0x59b772;});if(_0x8849b3){logger['info'](_0xd93e('0x36'));return BPromise['resolve']({'id':_0x8849b3[_0xd93e('0x2e')]['id']['value'],'name':_0x8849b3[_0xd93e('0x2e')][_0xd93e('0xf')]['value'],'phone':_0x8849b3[_0xd93e('0x2e')][_0xd93e('0x34')]['value']});}}else{logger[_0xd93e('0xd')](_0xd93e('0x37'));return request({'form':{'method':_0xd93e('0x38'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x599f40['id'],'module_name':_0xd93e('0x19'),'name_value_list':[{'name':_0xd93e('0x39'),'value':_0x210e99!==_0xd93e('0x3a')?_0x210e99:util[_0xd93e('0x32')](_0xd93e('0x3b'),_0x59b772)},{'name':_0xd93e('0x34'),'value':_0x59b772}]})}})[_0xd93e('0x35')](function(_0x593c4){logger['info'](_0xd93e('0x3c'));return BPromise['resolve']({'id':_0x593c4['id'],'name':_0x593c4[_0xd93e('0x2c')][_0xd93e('0x39')]['value'],'phone':_0x593c4[_0xd93e('0x2c')][_0xd93e('0x34')][_0xd93e('0x2f')]});});}});}function request(_0x20c463){logger[_0xd93e('0x3d')]('[HTTP]',JSON[_0xd93e('0x21')](_0x20c463));return rp(_[_0xd93e('0x3e')](def,_0x20c463));}function getTags(_0x45e50a,_0x4974c3){var _0x21ea5a=[];if(_0x45e50a&&_0x45e50a['length']>0x0){_0x21ea5a=_['map'](_0x45e50a,_0x4974c3);}return _0x21ea5a;}function getCustomFields(_0x271250,_0x24d369){var _0x161136=[];var _0x4a3772={'custom_fields':[]};if(_0x271250['length']>0x0){_[_0xd93e('0x3f')](_0x271250,function(_0x417fdc){if(_0x417fdc[_0xd93e('0x40')]===_0xd93e('0x41')&&_0x417fdc['nameField']&&!_0x417fdc['customField']){_0x4a3772[_0x417fdc[_0xd93e('0x42')][_0xd93e('0x43')]()]=_0x417fdc[_0xd93e('0x44')][_0xd93e('0x25')]();}else if(_0x417fdc[_0xd93e('0x40')]===_0xd93e('0x41')&&_0x417fdc[_0xd93e('0x1e')]&&_0x417fdc[_0xd93e('0x45')]){_0x4a3772[_0xd93e('0x46')][_0xd93e('0x1d')]({'id':_0x417fdc[_0xd93e('0x1e')],'value':_0x417fdc[_0xd93e('0x44')][_0xd93e('0x25')]()});}else if(_0x417fdc[_0xd93e('0x40')]===_0xd93e('0x47')&&_0x417fdc[_0xd93e('0x1f')]&&_0x417fdc['idField']&&_0x417fdc[_0xd93e('0x45')]){_0x24d369[_0x417fdc[_0xd93e('0x1f')]]&&_0x4a3772[_0xd93e('0x46')][_0xd93e('0x1d')]({'id':_0x417fdc['idField'],'value':_0x24d369[_0x417fdc[_0xd93e('0x1f')]]['toString']()});}else if(_0x417fdc[_0xd93e('0x40')]===_0xd93e('0x48')&&_0x417fdc[_0xd93e('0x49')]&&_0x417fdc[_0xd93e('0x49')][_0xd93e('0xf')]&&_0x417fdc['idField']&&_0x417fdc[_0xd93e('0x45')]){_0x24d369[_0x417fdc[_0xd93e('0x49')][_0xd93e('0xf')][_0xd93e('0x43')]()]&&_0x4a3772[_0xd93e('0x46')]['push']({'id':_0x417fdc[_0xd93e('0x1e')],'value':_0x24d369[_0x417fdc[_0xd93e('0x49')][_0xd93e('0xf')][_0xd93e('0x43')]()]['toString']()});}});}return _0x4a3772;}function getConnection(_0x55a65e){return request({'method':_0xd93e('0x4a'),'form':{'method':_0xd93e('0x4b'),'input_type':_0xd93e('0x20'),'response_type':_0xd93e('0x20'),'rest_data':JSON[_0xd93e('0x21')]({'user_auth':{'user_name':_0x55a65e[_0xd93e('0x4c')],'password':_0x55a65e[_0xd93e('0x4d')],'encryption':_0xd93e('0x4e')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x22d8d4){var _0x51438f=_0x22d8d4;if(_0x51438f['id']){def[_0xd93e('0x4f')]=_0x51438f['id'];return BPromise[_0xd93e('0x50')](_0x51438f);}else{throw new Error(util[_0xd93e('0x32')](_0xd93e('0x51'),_0x55a65e['id']));}});}function setRelationship(_0x2b2a88,_0x56197e,_0x21230d,_0x4c953e){return request({'form':{'method':_0xd93e('0x52'),'input_type':_0xd93e('0x20'),'response_type':_0xd93e('0x20'),'rest_data':JSON['stringify']({'session':_0x2b2a88['id'],'module_name':_0xd93e('0x22'),'module_id':_0x21230d['id'],'link_field_name':_0x4c953e,'related_ids':[_0x56197e['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x4e8e14,_0x180303,_0x4080c9,_0x37b306,_0x355401,_0x1272f2){var _0x522310,_0x581115,_0x5cefd4,_0x592fbc;_0x1272f2[_0xd93e('0x53')]=intUtil[_0xd93e('0x54')](_0x1272f2['remoteUri']);_0x1272f2[_0xd93e('0x55')]=intUtil['stripTrailingSlash'](_0x1272f2[_0xd93e('0x55')]);def[_0xd93e('0x56')]=util[_0xd93e('0x32')](_0xd93e('0x57'),_0x1272f2[_0xd93e('0x53')]);if(_0x355401&&_0x355401[_0xd93e('0x58')]){logger[_0xd93e('0xd')](_0xd93e('0x59'),'Recording\x20is\x20enabled!');_0x180303[_0xd93e('0x5a')]=util[_0xd93e('0x32')](_0xd93e('0x5b'),_0x1272f2[_0xd93e('0x55')],_0x180303[_0xd93e('0x5c')],md5(_0x180303['uniqueid']));}else{_0x180303[_0xd93e('0x5a')]='';}return getConnection(_0x1272f2)[_0xd93e('0x35')](function(_0x38bf73){_0x592fbc=_0x38bf73;return getUser(_0x1272f2,_0x37b306[_0xd93e('0xf')],_0x592fbc);})['then'](function(_0x4cee73){_0x522310=_0x4cee73;logger[_0xd93e('0xd')](_0xd93e('0x5d'),_0x522310['id']);return getEndUser(_0x1272f2,_0x180303[_0xd93e('0x5e')],_0x180303[_0xd93e('0x5f')],_0x592fbc);})[_0xd93e('0x35')](function(_0x45f429){_0x581115=_0x45f429;logger[_0xd93e('0xd')]('The\x20Enduser\x20ID\x20is:',_0x581115['id']);return getTicket(_0x1272f2,_0x522310,_0x581115,_0x4080c9,_0x180303,_0x4080c9[_0xd93e('0x60')],_0x592fbc,_0xd93e('0x61'));})['then'](function(_0x3939e5){_0x5cefd4=_0x3939e5;logger['info'](_0xd93e('0x62'));logger[_0xd93e('0xd')](_0xd93e('0x63'),_0x5cefd4['id']);return setRelationship(_0x592fbc,_0x522310,_0x5cefd4,_0xd93e('0x64'));})['then'](function(){return setRelationship(_0x592fbc,_0x581115,_0x5cefd4,_0xd93e('0x65'));})[_0xd93e('0x35')](function(){return getServerInfo(_0x592fbc);})['then'](function(_0xc5d319){var _0x51e692=parseInt(_0xc5d319[_0xd93e('0x66')][_0xd93e('0x67')](0x0));var _0x261902=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1272f2[_0xd93e('0x53')],_0x5cefd4['id']);if(_0x51e692>0x6){_0x261902=util['format'](_0xd93e('0x68'),_0x1272f2[_0xd93e('0x53')],_0x5cefd4['id']);}logger['info'](_0xd93e('0x59'),_0xd93e('0x69'));emit(util[_0xd93e('0x32')](_0xd93e('0x6a'),_0x37b306['name']),_0xd93e('0x6b'),{'uri':_0x261902});})[_0xd93e('0x6c')](function(_0x31bf7a){logger['error'](_0xd93e('0x59'),JSON['stringify'](_0x31bf7a));});};exports[_0xd93e('0x6d')]=function(_0x4506dc,_0x3a2cfc,_0x4dd2b3,_0x216240,_0x42e74c,_0x3f368f,_0x2d35b0){var _0x4379b1,_0x3b0e5f,_0x185995,_0x398112;_0x3f368f[_0xd93e('0x53')]=intUtil[_0xd93e('0x54')](_0x3f368f[_0xd93e('0x53')]);_0x3f368f['serverUrl']=intUtil[_0xd93e('0x54')](_0x3f368f[_0xd93e('0x55')]);def[_0xd93e('0x56')]=util[_0xd93e('0x32')](_0xd93e('0x57'),_0x3f368f['remoteUri']);if(_0x2d35b0&&_0x2d35b0[_0xd93e('0x6e')]&&_0x2d35b0[_0xd93e('0x6e')]!==_0xd93e('0x6f')){logger[_0xd93e('0xd')]('[OUTBOUND]',_0xd93e('0x70'));_0x3a2cfc[_0xd93e('0x5a')]=util[_0xd93e('0x32')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f368f[_0xd93e('0x55')],_0x3a2cfc[_0xd93e('0x5c')],md5(_0x3a2cfc[_0xd93e('0x5c')]));}return getConnection(_0x3f368f)[_0xd93e('0x35')](function(_0x850610){_0x398112=_0x850610;return getUser(_0x3f368f,_0x216240[_0xd93e('0xf')],_0x398112);})[_0xd93e('0x35')](function(_0x25e15f){_0x4379b1=_0x25e15f;logger[_0xd93e('0xd')]('The\x20User\x20ID\x20is:',_0x4379b1['id']);return getEndUser(_0x3f368f,_0x3a2cfc[_0xd93e('0x71')],_0x3a2cfc[_0xd93e('0x72')],_0x398112);})[_0xd93e('0x35')](function(_0x148861){_0x3b0e5f=_0x148861;logger[_0xd93e('0xd')](_0xd93e('0x73'),_0x3b0e5f['id']);return getTicket(_0x3f368f,_0x4379b1,_0x3b0e5f,_0x4dd2b3,_0x3a2cfc,_0x4dd2b3[_0xd93e('0x60')],_0x398112,_0xd93e('0x74'));})[_0xd93e('0x35')](function(_0x1eedd3){_0x185995=_0x1eedd3;logger[_0xd93e('0xd')](_0xd93e('0x62'));logger['info'](_0xd93e('0x63'),_0x185995['id']);return setRelationship(_0x398112,_0x4379b1,_0x185995,_0xd93e('0x64'));})[_0xd93e('0x35')](function(){return setRelationship(_0x398112,_0x3b0e5f,_0x185995,'contacts');})[_0xd93e('0x35')](function(){return getServerInfo(_0x398112);})[_0xd93e('0x35')](function(_0xbdda1d){var _0x19bdc2=parseInt(_0xbdda1d[_0xd93e('0x66')][_0xd93e('0x67')](0x0));var _0x29362f=util['format'](_0xd93e('0x75'),_0x3f368f[_0xd93e('0x53')],_0x185995['id']);if(_0x19bdc2>0x6){_0x29362f=util[_0xd93e('0x32')](_0xd93e('0x68'),_0x3f368f['remoteUri'],_0x185995['id']);}logger['info'](_0xd93e('0x76'),_0xd93e('0x69'));emit(util[_0xd93e('0x32')](_0xd93e('0x6a'),_0x216240['name']),_0xd93e('0x6b'),{'uri':_0x29362f});})['catch'](function(_0x5f1fb4){logger[_0xd93e('0x77')](_0xd93e('0x76'),JSON['stringify'](_0x5f1fb4));});};exports[_0xd93e('0x78')]=function(_0x1c05ff,_0x5e4456,_0x45746d,_0x3b26eb,_0x459217,_0x3abbfe){var _0x1772b6,_0x396215,_0x3681ab,_0x35276c;_0x3abbfe[_0xd93e('0x53')]=intUtil[_0xd93e('0x54')](_0x3abbfe[_0xd93e('0x53')]);_0x3abbfe[_0xd93e('0x55')]=intUtil[_0xd93e('0x54')](_0x3abbfe[_0xd93e('0x55')]);def[_0xd93e('0x56')]=util[_0xd93e('0x32')](_0xd93e('0x57'),_0x3abbfe[_0xd93e('0x53')]);if(_0x459217&&_0x459217[_0xd93e('0x58')]){logger[_0xd93e('0xd')]('['+_0x5e4456['lastevent']['toUpperCase']()+']',_0xd93e('0x70'));_0x5e4456[_0xd93e('0x5a')]=util[_0xd93e('0x32')](_0xd93e('0x5b'),_0x3abbfe[_0xd93e('0x55')],_0x5e4456[_0xd93e('0x5c')],md5(_0x5e4456['uniqueid']));}else{_0x5e4456['recordingURL']='';}return getConnection(_0x3abbfe)[_0xd93e('0x35')](function(_0x427689){_0x35276c=_0x427689;if(!_['isNil'](_0x3b26eb)){return getUser(_0x3abbfe,_0x3b26eb['name'],_0x35276c);}else{return getUser(_0x3abbfe,null,_0x35276c);}})[_0xd93e('0x35')](function(_0x560a1f){_0x1772b6=_0x560a1f;logger[_0xd93e('0xd')](_0xd93e('0x5d'),_0x1772b6['id']);return getEndUser(_0x3abbfe,_0x5e4456[_0xd93e('0x5e')],_0x5e4456['calleridnum'],_0x35276c);})['then'](function(_0x2f55ee){_0x396215=_0x2f55ee;logger[_0xd93e('0xd')]('The\x20Enduser\x20ID\x20is:',_0x396215['id']);return getTicket(_0x3abbfe,_0x1772b6,_0x396215,_0x45746d,_0x5e4456,_0x45746d[_0xd93e('0x60')],_0x35276c,'Inbound');})['then'](function(_0x366310){_0x3681ab=_0x366310;logger[_0xd93e('0xd')]('Ticket\x20created!');logger[_0xd93e('0xd')](_0xd93e('0x63'),_0x3681ab['id']);return setRelationship(_0x35276c,_0x1772b6,_0x3681ab,'users');})['then'](function(){return setRelationship(_0x35276c,_0x396215,_0x3681ab,_0xd93e('0x65'));})[_0xd93e('0x35')](function(){return getServerInfo(_0x35276c);})[_0xd93e('0x6c')](function(_0x489702){logger[_0xd93e('0x77')]('['+_0x5e4456[_0xd93e('0x79')]['toUpperCase']()+']',JSON[_0xd93e('0x21')](_0x489702));});}; \ No newline at end of file +var _0x0e30=['lastevent','toUpperCase','The\x20User\x20ID\x20is:','calleridname','contacts','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','assigned_user_id','description','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','length','forEach','variableName','push','idField','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','custom_fields','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','catch','error','[QUEUE]','recordingFormat','destcalleridnum','Outbound','Ticket\x20created!','users','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','uri'];(function(_0x1393cc,_0x3d0294){var _0x4fd93f=function(_0xe8c979){while(--_0xe8c979){_0x1393cc['push'](_0x1393cc['shift']());}};_0x4fd93f(++_0x3d0294);}(_0x0e30,0x1d5));var _0x00e3=function(_0x44c604,_0x333517){_0x44c604=_0x44c604-0x0;var _0x4ee022=_0x0e30[_0x44c604];return _0x4ee022;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x00e3('0x0'));var md5=require('md5');var util=require(_0x00e3('0x1'));var Redis=require(_0x00e3('0x2'));var intUtil=require(_0x00e3('0x3'));var config=require(_0x00e3('0x4'));var logger=require(_0x00e3('0x5'))(_0x00e3('0x6'));config[_0x00e3('0x7')]=_[_0x00e3('0x8')](config[_0x00e3('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x00e3('0x9'))(new Redis(config[_0x00e3('0x7')]));var def={'method':_0x00e3('0xa'),'json':!![]};function emit(_0x4c44af,_0x2dbc48,_0x57edac){io['to'](_0x4c44af)[_0x00e3('0xb')](_0x2dbc48,_0x57edac);}function getTicket(_0x2e0b28,_0x562728,_0x3cae04,_0x573be5,_0x508da5,_0x101f52,_0xda0704,_0x3fbb60){logger[_0x00e3('0xc')](_0x00e3('0xd'));var _0x3f39e3=new Date();var _0x362804=[{'name':'name','value':intUtil[_0x00e3('0xe')](_0x573be5['Subjects'],_0x508da5,'\x20')},{'name':_0x00e3('0xf'),'value':_0x562728['id']},{'name':'created_by','value':_0x562728['id']},{'name':_0x00e3('0x10'),'value':intUtil[_0x00e3('0xe')](_0x573be5['Descriptions'],_0x508da5,'\x0a')},{'name':_0x00e3('0x11'),'value':_0x3f39e3[_0x00e3('0x12')]()[_0x00e3('0x13')](0x0,0x13)[_0x00e3('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x00e3('0x15'),'value':'15'},{'name':_0x00e3('0x16'),'value':_0x3cae04['id']},{'name':_0x00e3('0x17'),'value':_0x00e3('0x18')},{'name':_0x00e3('0x19'),'value':_0x3cae04[_0x00e3('0x1a')]},{'name':_0x00e3('0x1b'),'value':_0x3fbb60}];if(_0x101f52[_0x00e3('0x1c')]){_[_0x00e3('0x1d')](_0x101f52,function(_0x20f528){if(_0x508da5[_0x20f528[_0x00e3('0x1e')]]){_0x362804[_0x00e3('0x1f')]({'name':_0x20f528[_0x00e3('0x20')],'value':_0x508da5[_0x20f528['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x00e3('0x21'),'rest_data':JSON[_0x00e3('0x22')]({'session':_0xda0704['id'],'module_name':'Calls','name_value_list':_0x362804})}});}function getAuth(_0x2afe39){return util[_0x00e3('0x23')](_0x00e3('0x24'),new Buffer(_0x2afe39[_0x00e3('0x25')]+':X')[_0x00e3('0x26')](_0x00e3('0x27')));}function getServerInfo(_0x213883){return request({'form':{'method':'get_server_info','input_type':_0x00e3('0x21'),'response_type':_0x00e3('0x21'),'rest_data':JSON[_0x00e3('0x22')]({'session':_0x213883['id']})}});}function getUser(_0x4739e1,_0x2473b2,_0x37739e){if(!_[_0x00e3('0x28')](_0x2473b2)){logger[_0x00e3('0xc')]('Getting\x20agent\x20with\x20name',_0x2473b2);return request({'form':{'method':_0x00e3('0x29'),'input_type':_0x00e3('0x21'),'response_type':_0x00e3('0x21'),'rest_data':JSON[_0x00e3('0x22')]({'session':_0x37739e['id'],'module_name':_0x00e3('0x2a'),'query':util['format'](_0x00e3('0x2b'),_0x2473b2),'order_by':'','offset':'0','select_fields':['id',_0x00e3('0x1a'),_0x00e3('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x00e3('0x2d')](function(_0x4f2245){if(_0x4f2245[_0x00e3('0x2e')]['length']){var _0x1dd400=_[_0x00e3('0x2f')](_0x4f2245[_0x00e3('0x2e')],function(_0x3810b5){return _0x3810b5[_0x00e3('0x30')][_0x00e3('0x2c')][_0x00e3('0x31')]===_0x2473b2;});if(_0x1dd400){logger['info'](_0x00e3('0x32'));return BPromise[_0x00e3('0x33')]({'id':_0x1dd400[_0x00e3('0x30')]['id']['value'],'name':_0x1dd400[_0x00e3('0x30')]['name'][_0x00e3('0x31')]});}}logger[_0x00e3('0xc')](_0x00e3('0x34'));return BPromise['resolve']({'id':_0x37739e[_0x00e3('0x30')][_0x00e3('0x35')]['value'],'name':_0x37739e[_0x00e3('0x30')]['user_name'][_0x00e3('0x31')]});});}else{logger['info'](_0x00e3('0x36'));return BPromise[_0x00e3('0x33')]({'id':_0x37739e[_0x00e3('0x30')][_0x00e3('0x35')]['value'],'name':_0x37739e[_0x00e3('0x30')]['user_name'][_0x00e3('0x31')]});}}function getEndUser(_0x4ee82b,_0x52ea4c,_0x1041ec,_0x543769){logger[_0x00e3('0xc')]('Searching\x20enduser\x20with\x20phone',_0x1041ec);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x00e3('0x21'),'rest_data':JSON['stringify']({'session':_0x543769['id'],'module_name':'Contacts','query':util[_0x00e3('0x23')](_0x00e3('0x37'),_0x1041ec),'order_by':'','offset':'0','select_fields':['id',_0x00e3('0x1a'),_0x00e3('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x00e3('0x2d')](function(_0x32bd5f){if(_0x32bd5f[_0x00e3('0x2e')]['length']){var _0x2fe71f=_[_0x00e3('0x2f')](_0x32bd5f['entry_list'],function(_0x5ddbb6){return _0x5ddbb6[_0x00e3('0x30')][_0x00e3('0x38')][_0x00e3('0x31')]===_0x1041ec;});if(_0x2fe71f){logger[_0x00e3('0xc')]('Enduser\x20found!');return BPromise[_0x00e3('0x33')]({'id':_0x2fe71f[_0x00e3('0x30')]['id'][_0x00e3('0x31')],'name':_0x2fe71f['name_value_list']['name']['value'],'phone':_0x2fe71f[_0x00e3('0x30')][_0x00e3('0x38')]['value']});}}else{logger[_0x00e3('0xc')](_0x00e3('0x39'));return request({'form':{'method':_0x00e3('0x3a'),'input_type':_0x00e3('0x21'),'response_type':_0x00e3('0x21'),'rest_data':JSON['stringify']({'session':_0x543769['id'],'module_name':'Contacts','name_value_list':[{'name':_0x00e3('0x3b'),'value':_0x52ea4c!==''?_0x52ea4c:util[_0x00e3('0x23')]('Caller\x20-\x20%s',_0x1041ec)},{'name':_0x00e3('0x38'),'value':_0x1041ec}]})}})[_0x00e3('0x2d')](function(_0x37270d){logger[_0x00e3('0xc')](_0x00e3('0x3c'));return BPromise[_0x00e3('0x33')]({'id':_0x37270d['id'],'name':_0x37270d['entry_list'][_0x00e3('0x3b')][_0x00e3('0x31')],'phone':_0x37270d[_0x00e3('0x2e')]['phone_home'][_0x00e3('0x31')]});});}});}function request(_0x1386a4){logger[_0x00e3('0x3d')](_0x00e3('0x3e'),JSON[_0x00e3('0x22')](_0x1386a4));return rp(_[_0x00e3('0x3f')](def,_0x1386a4));}function getTags(_0x408460,_0x37edde){var _0x4a9c54=[];if(_0x408460&&_0x408460['length']>0x0){_0x4a9c54=_[_0x00e3('0x40')](_0x408460,_0x37edde);}return _0x4a9c54;}function getCustomFields(_0x39f3b8,_0x29cc5b){var _0x1021fc=[];var _0x39d5f8={'custom_fields':[]};if(_0x39f3b8['length']>0x0){_[_0x00e3('0x1d')](_0x39f3b8,function(_0x47904f){if(_0x47904f[_0x00e3('0x41')]==='string'&&_0x47904f[_0x00e3('0x42')]&&!_0x47904f[_0x00e3('0x43')]){_0x39d5f8[_0x47904f['nameField'][_0x00e3('0x44')]()]=_0x47904f['content']['toString']();}else if(_0x47904f[_0x00e3('0x41')]==='string'&&_0x47904f['idField']&&_0x47904f[_0x00e3('0x43')]){_0x39d5f8[_0x00e3('0x45')][_0x00e3('0x1f')]({'id':_0x47904f[_0x00e3('0x20')],'value':_0x47904f['content'][_0x00e3('0x26')]()});}else if(_0x47904f[_0x00e3('0x41')]==='variable'&&_0x47904f['variableName']&&_0x47904f[_0x00e3('0x20')]&&_0x47904f[_0x00e3('0x43')]){_0x29cc5b[_0x47904f[_0x00e3('0x1e')]]&&_0x39d5f8['custom_fields']['push']({'id':_0x47904f[_0x00e3('0x20')],'value':_0x29cc5b[_0x47904f[_0x00e3('0x1e')]]['toString']()});}else if(_0x47904f[_0x00e3('0x41')]==='customVariable'&&_0x47904f[_0x00e3('0x46')]&&_0x47904f[_0x00e3('0x46')][_0x00e3('0x1a')]&&_0x47904f[_0x00e3('0x20')]&&_0x47904f[_0x00e3('0x43')]){_0x29cc5b[_0x47904f['Variable'][_0x00e3('0x1a')][_0x00e3('0x44')]()]&&_0x39d5f8[_0x00e3('0x45')]['push']({'id':_0x47904f[_0x00e3('0x20')],'value':_0x29cc5b[_0x47904f[_0x00e3('0x46')]['name'][_0x00e3('0x44')]()][_0x00e3('0x26')]()});}});}return _0x39d5f8;}function getConnection(_0x2ce563){return request({'method':_0x00e3('0xa'),'form':{'method':_0x00e3('0x47'),'input_type':_0x00e3('0x21'),'response_type':_0x00e3('0x21'),'rest_data':JSON[_0x00e3('0x22')]({'user_auth':{'user_name':_0x2ce563[_0x00e3('0x48')],'password':_0x2ce563['password'],'encryption':_0x00e3('0x49')},'application':_0x00e3('0x4a')})}})['then'](function(_0x3c94f7){var _0xb146e9=_0x3c94f7;if(_0xb146e9['id']){def[_0x00e3('0x4b')]=_0xb146e9['id'];return BPromise[_0x00e3('0x33')](_0xb146e9);}else{throw new Error(util[_0x00e3('0x23')](_0x00e3('0x4c'),_0x2ce563['id']));}});}function setRelationship(_0x5dc741,_0x3d528f,_0x3b175b,_0x2a8bc6){return request({'form':{'method':_0x00e3('0x4d'),'input_type':'JSON','response_type':_0x00e3('0x21'),'rest_data':JSON[_0x00e3('0x22')]({'session':_0x5dc741['id'],'module_name':_0x00e3('0x4e'),'module_id':_0x3b175b['id'],'link_field_name':_0x2a8bc6,'related_ids':[_0x3d528f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x00e3('0x4f')]=function(_0x1f03f5,_0x1dfcaa,_0x3991ae,_0x2979ff,_0x14f811,_0xab73cf){var _0x1c39a1,_0x3a9443,_0x385ae8,_0x173bee;_0xab73cf[_0x00e3('0x50')]=intUtil['stripTrailingSlash'](_0xab73cf['remoteUri']);_0xab73cf[_0x00e3('0x51')]=intUtil[_0x00e3('0x52')](_0xab73cf[_0x00e3('0x51')]);def['uri']=util[_0x00e3('0x23')](_0x00e3('0x53'),_0xab73cf[_0x00e3('0x50')]);if(_0x14f811&&_0x14f811[_0x00e3('0x54')]){logger[_0x00e3('0xc')]('[QUEUE]',_0x00e3('0x55'));_0x1dfcaa['recordingURL']=util[_0x00e3('0x23')](_0x00e3('0x56'),_0xab73cf[_0x00e3('0x51')],_0x1dfcaa[_0x00e3('0x57')],md5(_0x1dfcaa[_0x00e3('0x57')]));}else{_0x1dfcaa[_0x00e3('0x58')]='';}return getConnection(_0xab73cf)[_0x00e3('0x2d')](function(_0x397532){_0x173bee=_0x397532;return getUser(_0xab73cf,_0x2979ff[_0x00e3('0x1a')],_0x173bee);})[_0x00e3('0x2d')](function(_0x444c8c){_0x1c39a1=_0x444c8c;logger[_0x00e3('0xc')]('The\x20User\x20ID\x20is:',_0x1c39a1['id']);return getEndUser(_0xab73cf,_0x1dfcaa['calleridname'],_0x1dfcaa[_0x00e3('0x59')],_0x173bee);})['then'](function(_0x4f5788){_0x3a9443=_0x4f5788;logger[_0x00e3('0xc')](_0x00e3('0x5a'),_0x3a9443['id']);return getTicket(_0xab73cf,_0x1c39a1,_0x3a9443,_0x3991ae,_0x1dfcaa,_0x3991ae[_0x00e3('0x5b')],_0x173bee,_0x00e3('0x5c'));})[_0x00e3('0x2d')](function(_0x2c5b10){_0x385ae8=_0x2c5b10;logger[_0x00e3('0xc')]('Ticket\x20created!');logger[_0x00e3('0xc')](_0x00e3('0x5d'),_0x385ae8['id']);return setRelationship(_0x173bee,_0x1c39a1,_0x385ae8,'users');})[_0x00e3('0x2d')](function(){return setRelationship(_0x173bee,_0x3a9443,_0x385ae8,'contacts');})['then'](function(){return getServerInfo(_0x173bee);})['then'](function(_0x196fba){var _0x22ebaa=parseInt(_0x196fba[_0x00e3('0x5e')][_0x00e3('0x5f')](0x0));var _0x4ab680=util[_0x00e3('0x23')](_0x00e3('0x60'),_0xab73cf[_0x00e3('0x50')],_0x385ae8['id']);if(_0x22ebaa>0x6){_0x4ab680=util[_0x00e3('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xab73cf['remoteUri'],_0x385ae8['id']);}logger[_0x00e3('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x00e3('0x23')](_0x00e3('0x61'),_0x2979ff[_0x00e3('0x1a')]),_0x00e3('0x62'),{'uri':_0x4ab680});})[_0x00e3('0x63')](function(_0xc8372f){logger[_0x00e3('0x64')](_0x00e3('0x65'),JSON[_0x00e3('0x22')](_0xc8372f));});};exports['outbound']=function(_0x4ff65e,_0x37e1e6,_0x57b667,_0x2af8b1,_0x20773d,_0x37d2a0,_0x841f1){var _0x1d9387,_0x5bc066,_0x2365ec,_0x31a6cf;_0x37d2a0[_0x00e3('0x50')]=intUtil['stripTrailingSlash'](_0x37d2a0[_0x00e3('0x50')]);_0x37d2a0[_0x00e3('0x51')]=intUtil[_0x00e3('0x52')](_0x37d2a0['serverUrl']);def['uri']=util[_0x00e3('0x23')](_0x00e3('0x53'),_0x37d2a0[_0x00e3('0x50')]);if(_0x841f1&&_0x841f1[_0x00e3('0x66')]&&_0x841f1[_0x00e3('0x66')]!=='none'){logger[_0x00e3('0xc')]('[OUTBOUND]',_0x00e3('0x55'));_0x37e1e6['recordingURL']=util['format'](_0x00e3('0x56'),_0x37d2a0[_0x00e3('0x51')],_0x37e1e6[_0x00e3('0x57')],md5(_0x37e1e6[_0x00e3('0x57')]));}return getConnection(_0x37d2a0)[_0x00e3('0x2d')](function(_0xa1ae77){_0x31a6cf=_0xa1ae77;return getUser(_0x37d2a0,_0x2af8b1[_0x00e3('0x1a')],_0x31a6cf);})[_0x00e3('0x2d')](function(_0x44e840){_0x1d9387=_0x44e840;logger[_0x00e3('0xc')]('The\x20User\x20ID\x20is:',_0x1d9387['id']);return getEndUser(_0x37d2a0,_0x37e1e6['destcalleridname'],_0x37e1e6[_0x00e3('0x67')],_0x31a6cf);})[_0x00e3('0x2d')](function(_0x4ea7c3){_0x5bc066=_0x4ea7c3;logger['info'](_0x00e3('0x5a'),_0x5bc066['id']);return getTicket(_0x37d2a0,_0x1d9387,_0x5bc066,_0x57b667,_0x37e1e6,_0x57b667['Fields'],_0x31a6cf,_0x00e3('0x68'));})[_0x00e3('0x2d')](function(_0x903b33){_0x2365ec=_0x903b33;logger[_0x00e3('0xc')](_0x00e3('0x69'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2365ec['id']);return setRelationship(_0x31a6cf,_0x1d9387,_0x2365ec,_0x00e3('0x6a'));})[_0x00e3('0x2d')](function(){return setRelationship(_0x31a6cf,_0x5bc066,_0x2365ec,'contacts');})[_0x00e3('0x2d')](function(){return getServerInfo(_0x31a6cf);})[_0x00e3('0x2d')](function(_0x579cff){var _0x4aeac8=parseInt(_0x579cff[_0x00e3('0x5e')][_0x00e3('0x5f')](0x0));var _0x4dfe3d=util[_0x00e3('0x23')](_0x00e3('0x60'),_0x37d2a0['remoteUri'],_0x2365ec['id']);if(_0x4aeac8>0x6){_0x4dfe3d=util[_0x00e3('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x37d2a0[_0x00e3('0x50')],_0x2365ec['id']);}logger[_0x00e3('0xc')](_0x00e3('0x6b'),_0x00e3('0x6c'));emit(util[_0x00e3('0x23')](_0x00e3('0x61'),_0x2af8b1['name']),'trigger:browser:url',{'uri':_0x4dfe3d});})[_0x00e3('0x63')](function(_0x773efb){logger['error']('[OUTBOUND]',JSON[_0x00e3('0x22')](_0x773efb));});};exports[_0x00e3('0x6d')]=function(_0x3c07b0,_0x33f61a,_0x3934ee,_0x1835ed,_0x20bf30,_0x381c80){var _0x179ae3,_0x4480da,_0x51e876,_0x31ee38;_0x381c80[_0x00e3('0x50')]=intUtil[_0x00e3('0x52')](_0x381c80[_0x00e3('0x50')]);_0x381c80['serverUrl']=intUtil['stripTrailingSlash'](_0x381c80['serverUrl']);def[_0x00e3('0x6e')]=util[_0x00e3('0x23')](_0x00e3('0x53'),_0x381c80[_0x00e3('0x50')]);if(_0x20bf30&&_0x20bf30[_0x00e3('0x54')]){logger[_0x00e3('0xc')]('['+_0x33f61a[_0x00e3('0x6f')][_0x00e3('0x70')]()+']',_0x00e3('0x55'));_0x33f61a[_0x00e3('0x58')]=util[_0x00e3('0x23')](_0x00e3('0x56'),_0x381c80[_0x00e3('0x51')],_0x33f61a[_0x00e3('0x57')],md5(_0x33f61a[_0x00e3('0x57')]));}else{_0x33f61a[_0x00e3('0x58')]='';}return getConnection(_0x381c80)[_0x00e3('0x2d')](function(_0x414d48){_0x31ee38=_0x414d48;if(!_[_0x00e3('0x28')](_0x1835ed)){return getUser(_0x381c80,_0x1835ed[_0x00e3('0x1a')],_0x31ee38);}else{return getUser(_0x381c80,null,_0x31ee38);}})[_0x00e3('0x2d')](function(_0x55c04a){_0x179ae3=_0x55c04a;logger[_0x00e3('0xc')](_0x00e3('0x71'),_0x179ae3['id']);return getEndUser(_0x381c80,_0x33f61a[_0x00e3('0x72')],_0x33f61a[_0x00e3('0x59')],_0x31ee38);})[_0x00e3('0x2d')](function(_0x4a0cb9){_0x4480da=_0x4a0cb9;logger[_0x00e3('0xc')](_0x00e3('0x5a'),_0x4480da['id']);return getTicket(_0x381c80,_0x179ae3,_0x4480da,_0x3934ee,_0x33f61a,_0x3934ee['Fields'],_0x31ee38,_0x00e3('0x5c'));})['then'](function(_0x37b144){_0x51e876=_0x37b144;logger[_0x00e3('0xc')](_0x00e3('0x69'));logger['info'](_0x00e3('0x5d'),_0x51e876['id']);return setRelationship(_0x31ee38,_0x179ae3,_0x51e876,_0x00e3('0x6a'));})[_0x00e3('0x2d')](function(){return setRelationship(_0x31ee38,_0x4480da,_0x51e876,_0x00e3('0x73'));})[_0x00e3('0x2d')](function(){return getServerInfo(_0x31ee38);})[_0x00e3('0x63')](function(_0x176804){logger[_0x00e3('0x64')]('['+_0x33f61a[_0x00e3('0x6f')][_0x00e3('0x70')]()+']',JSON[_0x00e3('0x22')](_0x176804));});}; \ 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 da4d86d..fc519bc 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 _0x96d6=['toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','test','util','getString','length','sortBy','type','string','content','variable','variableName','push'];(function(_0x3a031a,_0xd706bb){var _0x2c71c6=function(_0x2d6b6b){while(--_0x2d6b6b){_0x3a031a['push'](_0x3a031a['shift']());}};_0x2c71c6(++_0xd706bb);}(_0x96d6,0x12a));var _0x696d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x96d6[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x696d('0x0'));exports[_0x696d('0x1')]=function(_0x238d8b,_0x34f7a4,_0x1f222c){var _0x393afc=[];if(_0x238d8b[_0x696d('0x2')]>0x0){var _0x4d03c4=_[_0x696d('0x3')](_0x238d8b,['id']);for(var _0x5d40c7=0x0;_0x5d40c7<_0x4d03c4[_0x696d('0x2')];_0x5d40c7++){var _0x7a2f0f=_0x4d03c4[_0x5d40c7];if(_0x7a2f0f[_0x696d('0x4')]===_0x696d('0x5')){_0x393afc['push'](_0x7a2f0f[_0x696d('0x6')]);}else if(_0x7a2f0f[_0x696d('0x4')]===_0x696d('0x7')&&_0x7a2f0f[_0x696d('0x8')]){_0x34f7a4[_0x7a2f0f[_0x696d('0x8')]]&&_0x393afc[_0x696d('0x9')](_0x34f7a4[_0x7a2f0f[_0x696d('0x8')]][_0x696d('0xa')]());}else if(_0x7a2f0f[_0x696d('0x4')]===_0x696d('0xb')&&_0x7a2f0f[_0x696d('0xc')]&&_0x7a2f0f[_0x696d('0xc')][_0x696d('0xd')]){_0x34f7a4[_0x7a2f0f[_0x696d('0xc')][_0x696d('0xd')][_0x696d('0xe')]()]&&_0x393afc['push'](_0x34f7a4[_0x7a2f0f[_0x696d('0xc')]['name'][_0x696d('0xe')]()][_0x696d('0xa')]());}else if(_0x7a2f0f[_0x696d('0x4')]===_0x696d('0xf')){if(_0x7a2f0f[_0x696d('0x10')]===_0x696d('0x5')&&_0x7a2f0f[_0x696d('0x11')]){_0x393afc['push'](util[_0x696d('0x12')](_0x696d('0x13'),_0x7a2f0f[_0x696d('0x11')],_0x7a2f0f[_0x696d('0x14')]));}else if(_0x7a2f0f[_0x696d('0x10')]===_0x696d('0x7')&&_0x7a2f0f['variableName']&&_0x7a2f0f['key']){_0x34f7a4[_0x7a2f0f[_0x696d('0x8')]]&&_0x393afc[_0x696d('0x9')](util['format']('%s:\x20%s',_0x7a2f0f[_0x696d('0x11')],_0x34f7a4[_0x7a2f0f['variableName']]));}else if(_0x7a2f0f['keyType']===_0x696d('0xb')&&_0x7a2f0f['Variable']&&_0x7a2f0f[_0x696d('0xc')][_0x696d('0xd')]&&_0x7a2f0f[_0x696d('0x11')]){_0x34f7a4[_0x7a2f0f[_0x696d('0xc')]['name'][_0x696d('0xe')]()]&&_0x393afc['push'](util['format'](_0x696d('0x13'),_0x7a2f0f[_0x696d('0x11')],_0x34f7a4[_0x7a2f0f['Variable'][_0x696d('0xd')][_0x696d('0xe')]()]));}}}}return _0x393afc[_0x696d('0x15')](_0x1f222c);};exports[_0x696d('0x16')]=function(_0x44cbf4){var _0x573819=_0x44cbf4[_0x696d('0x17')](-0x1);if(_0x573819==='/'){_0x44cbf4=_0x44cbf4[_0x696d('0x18')](0x0,_0x44cbf4[_0x696d('0x19')](_0x573819));}return _0x44cbf4;};exports['validateEmail']=function(_0x598eee){if(!_[_0x696d('0x1a')](_0x598eee)&&_0x598eee!==''){var _0xe0e693=/^(([^<>()\[\]\\.,;:\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 _0xe0e693[_0x696d('0x1b')](String(_0x598eee)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xe57b=['Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','format','join','substring','lastIndexOf','isNil','test','lodash','util','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xe57b,0x16b));var _0xbe57=function(_0xc5182d,_0x8cb46b){_0xc5182d=_0xc5182d-0x0;var _0x489bbf=_0xe57b[_0xc5182d];return _0x489bbf;};'use strict';var _=require(_0xbe57('0x0'));var util=require(_0xbe57('0x1'));exports['getString']=function(_0x255a8c,_0x3ba32f,_0x445f34){var _0xa368d9=[];if(_0x255a8c[_0xbe57('0x2')]>0x0){var _0x5818a0=_[_0xbe57('0x3')](_0x255a8c,['id']);for(var _0x3d4a2e=0x0;_0x3d4a2e<_0x5818a0['length'];_0x3d4a2e++){var _0x4503fd=_0x5818a0[_0x3d4a2e];if(_0x4503fd[_0xbe57('0x4')]===_0xbe57('0x5')){_0xa368d9[_0xbe57('0x6')](_0x4503fd[_0xbe57('0x7')]);}else if(_0x4503fd[_0xbe57('0x4')]===_0xbe57('0x8')&&_0x4503fd[_0xbe57('0x9')]){_0x3ba32f[_0x4503fd[_0xbe57('0x9')]]&&_0xa368d9[_0xbe57('0x6')](_0x3ba32f[_0x4503fd['variableName']][_0xbe57('0xa')]());}else if(_0x4503fd['type']===_0xbe57('0xb')&&_0x4503fd[_0xbe57('0xc')]&&_0x4503fd[_0xbe57('0xc')]['name']){_0x3ba32f[_0x4503fd[_0xbe57('0xc')]['name']['toLowerCase']()]&&_0xa368d9['push'](_0x3ba32f[_0x4503fd[_0xbe57('0xc')][_0xbe57('0xd')][_0xbe57('0xe')]()][_0xbe57('0xa')]());}else if(_0x4503fd['type']===_0xbe57('0xf')){if(_0x4503fd[_0xbe57('0x10')]==='string'&&_0x4503fd[_0xbe57('0x11')]){_0xa368d9[_0xbe57('0x6')](util['format'](_0xbe57('0x12'),_0x4503fd[_0xbe57('0x11')],_0x4503fd['keyContent']));}else if(_0x4503fd[_0xbe57('0x10')]==='variable'&&_0x4503fd[_0xbe57('0x9')]&&_0x4503fd[_0xbe57('0x11')]){_0x3ba32f[_0x4503fd[_0xbe57('0x9')]]&&_0xa368d9[_0xbe57('0x6')](util[_0xbe57('0x13')]('%s:\x20%s',_0x4503fd[_0xbe57('0x11')],_0x3ba32f[_0x4503fd[_0xbe57('0x9')]]));}else if(_0x4503fd[_0xbe57('0x10')]===_0xbe57('0xb')&&_0x4503fd[_0xbe57('0xc')]&&_0x4503fd['Variable'][_0xbe57('0xd')]&&_0x4503fd[_0xbe57('0x11')]){_0x3ba32f[_0x4503fd['Variable'][_0xbe57('0xd')][_0xbe57('0xe')]()]&&_0xa368d9[_0xbe57('0x6')](util[_0xbe57('0x13')]('%s:\x20%s',_0x4503fd[_0xbe57('0x11')],_0x3ba32f[_0x4503fd[_0xbe57('0xc')][_0xbe57('0xd')][_0xbe57('0xe')]()]));}}}}return _0xa368d9[_0xbe57('0x14')](_0x445f34);};exports['stripTrailingSlash']=function(_0x43c4fb){var _0x2f24fc=_0x43c4fb['slice'](-0x1);if(_0x2f24fc==='/'){_0x43c4fb=_0x43c4fb[_0xbe57('0x15')](0x0,_0x43c4fb[_0xbe57('0x16')](_0x2f24fc));}return _0x43c4fb;};exports['validateEmail']=function(_0x25600d){if(!_[_0xbe57('0x17')](_0x25600d)&&_0x25600d!==''){var _0x14caa2=/^(([^<>()\[\]\\.,;:\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 _0x14caa2[_0xbe57('0x18')](String(_0x25600d)[_0xbe57('0xe')]());}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 6a81a04..58158e8 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 _0x87e1=['../../../../config/logger','redis','defaults','localhost','emit','length','forEach','type','string','idField','content','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Descriptions','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','then','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','createTicket','validateEmail','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','userId','admin','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Searching\x20end\x20user\x20with\x20phone','GET','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;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','getEndUser','accessKey','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','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...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','email','destcalleridnum','user:%s','unmanaged','lastevent','toUpperCase','lodash','bluebird','md5','ioredis','./util'];(function(_0x47a12a,_0x70f591){var _0x30cd40=function(_0x46b68f){while(--_0x46b68f){_0x47a12a['push'](_0x47a12a['shift']());}};_0x30cd40(++_0x70f591);}(_0x87e1,0x187));var _0x187e=function(_0x1be448,_0x1fb778){_0x1be448=_0x1be448-0x0;var _0x39a54d=_0x87e1[_0x1be448];return _0x39a54d;};'use strict';var _=require(_0x187e('0x0'));var rp=require('request-promise');var BPromise=require(_0x187e('0x1'));var md5=require(_0x187e('0x2'));var util=require('util');var Redis=require(_0x187e('0x3'));var intUtil=require(_0x187e('0x4'));var config=require('../../../../config/environment');var logger=require(_0x187e('0x5'))('vTiger');config[_0x187e('0x6')]=_[_0x187e('0x7')](config['redis'],{'host':_0x187e('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x187e('0x6')]));function emit(_0x4915f4,_0x1e725f,_0x3e7717){io['to'](_0x4915f4)[_0x187e('0x9')](_0x1e725f,_0x3e7717);}function getCustomFields(_0x5e76fd,_0x2eebee){var _0xa467bb={};if(_0x5e76fd[_0x187e('0xa')]>0x0){_[_0x187e('0xb')](_0x5e76fd,function(_0x2fc86f){if(_0x2fc86f[_0x187e('0xc')]===_0x187e('0xd')&&_0x2fc86f[_0x187e('0xe')]){_0xa467bb[_0x2fc86f[_0x187e('0xe')]]=_0x2fc86f[_0x187e('0xf')][_0x187e('0x10')]();}else if(_0x2fc86f[_0x187e('0xc')]==='variable'&&_0x2fc86f[_0x187e('0x11')]&&_0x2fc86f[_0x187e('0xe')]&&_0x2eebee[_0x2fc86f[_0x187e('0x11')]]){_0xa467bb[_0x2fc86f[_0x187e('0xe')]]=_0x2eebee[_0x2fc86f['variableName']][_0x187e('0x10')]();}else if(_0x2fc86f['type']==='customVariable'&&_0x2fc86f[_0x187e('0x12')]&&_0x2fc86f[_0x187e('0x12')][_0x187e('0x13')]&&_0x2fc86f['idField']&&_0x2eebee[_0x2fc86f[_0x187e('0x12')][_0x187e('0x13')][_0x187e('0x14')]()]){_0xa467bb[_0x2fc86f[_0x187e('0xe')]]=_0x2eebee[_0x2fc86f[_0x187e('0x12')]['name'][_0x187e('0x14')]()][_0x187e('0x10')]();}});}return _0xa467bb;}function createTicket(_0x793504,_0x4d6b65,_0x3a0712,_0x4904be,_0x47b3f8,_0x5e4b0a,_0x3b364c){logger[_0x187e('0x15')](_0x187e('0x16'));var _0x412c17=_[_0x187e('0x17')]({'parent_id':'','assigned_user_id':_0x4d6b65['id'],'ticketpriorities':_0x187e('0x18'),'ticketstatus':_0x187e('0x19'),'ticket_title':intUtil['getString'](_0x4904be['Subjects'],_0x47b3f8,'\x20'),'description':intUtil['getString'](_0x4904be[_0x187e('0x1a')],_0x47b3f8,'\x0a'),'contact_id':_0x3a0712['id']},getCustomFields(_0x5e4b0a,_0x47b3f8));var _0x1409b9={'method':_0x187e('0x1b'),'uri':util[_0x187e('0x1c')]('%s/webservice.php',_0x793504[_0x187e('0x1d')]),'form':{'operation':_0x187e('0x1e'),'username':_0x793504['username'],'sessionName':_0x3b364c[_0x187e('0x1f')],'elementType':_0x187e('0x20'),'element':JSON[_0x187e('0x21')](_0x412c17)},'json':!![]};return request(_0x1409b9)[_0x187e('0x22')](function(_0x463640){if(_0x463640[_0x187e('0x23')]){return BPromise['resolve']({'id':_0x463640[_0x187e('0x24')]['id']});}else{throw new Error(util[_0x187e('0x1c')](_0x187e('0x25'),JSON['stringify'](_0x463640[_0x187e('0x26')])));}})[_0x187e('0x27')](function(_0x425309){var _0xedae39=_0x425309['statusCode']||0x1f4;logger[_0x187e('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x187e('0x28'),_0xedae39,JSON[_0x187e('0x21')](_0x425309));});}function getUser(_0x219e70,_0x39b0c6,_0x5ab526){if(intUtil[_0x187e('0x29')](_0x39b0c6)){logger[_0x187e('0x15')]('Getting\x20agent\x20with\x20email',_0x39b0c6);return request({'method':'GET','uri':util[_0x187e('0x1c')](_0x187e('0x2a'),_0x219e70[_0x187e('0x1d')]),'qs':{'operation':_0x187e('0x2b'),'username':_0x219e70[_0x187e('0x2c')],'sessionName':_0x5ab526[_0x187e('0x1f')],'query':util[_0x187e('0x1c')](_0x187e('0x2d'),_0x39b0c6)},'json':!![]})[_0x187e('0x22')](function(_0x35cb37){if(_0x35cb37[_0x187e('0x23')]&&_0x35cb37['result'][_0x187e('0xa')]){logger[_0x187e('0x15')](_0x187e('0x2e'));return BPromise['resolve']({'id':_0x35cb37[_0x187e('0x24')][0x0]['id'],'email':_0x35cb37[_0x187e('0x24')][0x0][_0x187e('0x2f')],'name':_0x35cb37['result'][0x0]['first_name']+'\x20'+_0x35cb37['result'][_0x187e('0x30')]});}else{logger[_0x187e('0x15')](_0x187e('0x31'));return BPromise[_0x187e('0x32')]({'id':_0x5ab526[_0x187e('0x33')],'email':_0x219e70[_0x187e('0x2c')],'name':_0x187e('0x34')});}})[_0x187e('0x27')](function(_0x24377c){var _0x25223e=_0x24377c[_0x187e('0x35')]||0x1f4;logger[_0x187e('0x26')](_0x187e('0x36'),_0x187e('0x37'),_0x25223e,JSON[_0x187e('0x21')](_0x24377c));});}else{logger[_0x187e('0x15')](_0x187e('0x31'));return BPromise['resolve']({'id':_0x5ab526[_0x187e('0x33')],'email':_0x219e70[_0x187e('0x2c')],'name':_0x187e('0x34')})[_0x187e('0x27')](function(_0x3b5b08){var _0x21fc97=_0x3b5b08[_0x187e('0x35')]||0x1f4;logger[_0x187e('0x26')](_0x187e('0x36'),_0x187e('0x37'),_0x21fc97,JSON[_0x187e('0x21')](_0x3b5b08));});}}function getEndUser(_0x192dc8,_0xf0e7c3,_0x4637e4,_0x531267){logger[_0x187e('0x15')](_0x187e('0x38'),_0x4637e4);return request({'method':_0x187e('0x39'),'uri':util[_0x187e('0x1c')](_0x187e('0x2a'),_0x192dc8[_0x187e('0x1d')]),'qs':{'operation':'query','username':_0x192dc8['username'],'sessionName':_0x531267[_0x187e('0x1f')],'query':util[_0x187e('0x1c')](_0x187e('0x3a'),_0x4637e4,_0x4637e4,_0x4637e4,_0x4637e4,_0x4637e4)},'json':!![]})['then'](function(_0x440d8c){if(_0x440d8c['success']&&_0x440d8c[_0x187e('0x24')]['length']){logger[_0x187e('0x15')](_0x187e('0x3b'));return BPromise['resolve']({'id':_0x440d8c[_0x187e('0x24')][0x0]['id'],'name':_0x440d8c[_0x187e('0x24')][0x0][_0x187e('0x3c')]+'\x20'+_0x440d8c[_0x187e('0x24')][0x0][_0x187e('0x3d')],'phone':_0x4637e4});}else{logger[_0x187e('0x15')](_0x187e('0x3e'));return request({'method':_0x187e('0x1b'),'uri':util[_0x187e('0x1c')](_0x187e('0x2a'),_0x192dc8[_0x187e('0x1d')]),'form':{'operation':_0x187e('0x1e'),'sessionName':_0x531267[_0x187e('0x1f')],'elementType':_0x187e('0x3f'),'element':JSON[_0x187e('0x21')]({'lastname':_0xf0e7c3,'phone':_0x4637e4,'assigned_user_id':'\x20'})},'json':!![]})[_0x187e('0x22')](function(_0x28e277){logger[_0x187e('0x15')]('Enduser\x20created.');return BPromise[_0x187e('0x32')]({'id':_0x28e277['result']['id'],'name':_0x28e277['result'][_0x187e('0x3d')],'phone':_0x28e277[_0x187e('0x24')]['phone']});})[_0x187e('0x27')](function(_0x38da18){var _0x3b0df6=_0x38da18[_0x187e('0x35')]||0x1f4;logger[_0x187e('0x26')](_0x187e('0x36'),_0x187e('0x40'),_0x3b0df6,JSON[_0x187e('0x21')](_0x38da18));});}});}function getConnection(_0x4f57d4){var _0x22865d=_0x4f57d4['username'];var _0x4f393d=_0x4f57d4[_0x187e('0x41')];return request({'method':_0x187e('0x39'),'uri':util['format'](_0x187e('0x2a'),_0x4f57d4[_0x187e('0x1d')]),'qs':{'operation':'getchallenge','username':_0x22865d},'json':!![]})[_0x187e('0x22')](function(_0x7662f6){if(_0x7662f6['success']){return request({'method':'POST','uri':util['format'](_0x187e('0x2a'),_0x4f57d4[_0x187e('0x1d')]),'form':{'operation':_0x187e('0x42'),'username':_0x22865d,'accessKey':md5(_0x7662f6['result'][_0x187e('0x43')]+_0x4f393d)},'json':!![]});}})['then'](function(_0x1e96c5){if(_0x1e96c5[_0x187e('0x23')]){return BPromise[_0x187e('0x32')](_0x1e96c5[_0x187e('0x24')]);}else{throw new Error(util[_0x187e('0x1c')](_0x187e('0x44'),_0x4f57d4['id']));}})[_0x187e('0x27')](function(_0x1e946c){var _0x78c2f4=_0x1e946c[_0x187e('0x35')]||0x1f4;logger[_0x187e('0x26')](_0x187e('0x36'),_0x187e('0x45'),_0x78c2f4,JSON[_0x187e('0x21')](_0x1e946c));});}function request(_0x43660c){logger['info']('[HTTP]',JSON[_0x187e('0x21')](_0x43660c));return rp(_0x43660c);}exports['queue']=function(_0x561863,_0x24e53e,_0x2a2df0,_0x16a3b4,_0x2a3969,_0x29ec06){var _0x31ba97,_0x3fe433,_0x1d6dc9,_0x5a9a2c;_0x29ec06[_0x187e('0x1d')]=intUtil[_0x187e('0x46')](_0x29ec06[_0x187e('0x1d')]);if(_0x2a3969&&_0x2a3969[_0x187e('0x47')]){logger['info'](_0x187e('0x48'),'Recording\x20is\x20enabled!');_0x24e53e[_0x187e('0x49')]=util['format'](_0x187e('0x4a'),_0x29ec06[_0x187e('0x4b')],_0x24e53e[_0x187e('0x4c')],md5(_0x24e53e[_0x187e('0x4c')]));}else{_0x24e53e[_0x187e('0x49')]='';}return getConnection(_0x29ec06)[_0x187e('0x22')](function(_0x4a89fb){_0x5a9a2c=_0x4a89fb;return getUser(_0x29ec06,_0x16a3b4['email'],_0x5a9a2c);})[_0x187e('0x22')](function(_0x27c44c){_0x31ba97=_0x27c44c;logger[_0x187e('0x15')](_0x187e('0x4d'),_0x31ba97['id']);return getEndUser(_0x29ec06,_0x24e53e[_0x187e('0x4e')],_0x24e53e[_0x187e('0x4f')],_0x5a9a2c);})[_0x187e('0x22')](function(_0x3c604e){_0x3fe433=_0x3c604e;logger['info'](_0x187e('0x50'),_0x3fe433['id']);return createTicket(_0x29ec06,_0x31ba97,_0x3fe433,_0x2a2df0,_0x24e53e,_0x2a2df0[_0x187e('0x51')],_0x5a9a2c);})[_0x187e('0x22')](function(_0x2dd311){_0x1d6dc9=_0x2dd311;logger[_0x187e('0x15')](_0x187e('0x52'));logger[_0x187e('0x15')](_0x187e('0x53'),_0x1d6dc9['id']);var _0x1514c3=util[_0x187e('0x1c')](_0x187e('0x54'),_0x29ec06[_0x187e('0x1d')],_[_0x187e('0x55')](_0x1d6dc9['id'],'x')[0x1]);logger[_0x187e('0x15')]('[QUEUE]',_0x187e('0x56'));emit(util['format']('user:%s',_0x16a3b4['name']),_0x187e('0x57'),{'uri':_0x1514c3});})[_0x187e('0x27')](function(_0x27ab2a){logger['error'](_0x187e('0x48'),JSON[_0x187e('0x21')](_0x27ab2a));});};exports[_0x187e('0x58')]=function(_0x36fc2d,_0x603ec8,_0x79b737,_0x40660c,_0x3f7127,_0x4fad84,_0x17a6e3){var _0xf05f7f,_0x4f7373,_0x2ccf9f,_0x34f5b5;_0x4fad84[_0x187e('0x1d')]=intUtil['stripTrailingSlash'](_0x4fad84[_0x187e('0x1d')]);_0x4fad84['serverUrl']=intUtil['stripTrailingSlash'](_0x4fad84[_0x187e('0x4b')]);if(_0x17a6e3&&_0x17a6e3[_0x187e('0x59')]&&_0x17a6e3[_0x187e('0x59')]!==_0x187e('0x5a')){logger['info'](_0x187e('0x5b'),_0x187e('0x5c'));_0x603ec8['recordingURL']=util[_0x187e('0x1c')](_0x187e('0x4a'),_0x4fad84[_0x187e('0x4b')],_0x603ec8['uniqueid'],md5(_0x603ec8[_0x187e('0x4c')]));}return getConnection(_0x4fad84)[_0x187e('0x22')](function(_0x226e10){_0x34f5b5=_0x226e10;return getUser(_0x4fad84,_0x40660c[_0x187e('0x5d')],_0x34f5b5);})[_0x187e('0x22')](function(_0x35e3bb){_0xf05f7f=_0x35e3bb;logger['info']('The\x20User\x20ID\x20is:',_0xf05f7f['id']);return getEndUser(_0x4fad84,_0x603ec8['destcalleridname'],_0x603ec8[_0x187e('0x5e')],_0x34f5b5);})['then'](function(_0x5e4733){_0x4f7373=_0x5e4733;logger[_0x187e('0x15')]('The\x20Enduser\x20ID\x20is:',_0x4f7373['id']);return createTicket(_0x4fad84,_0xf05f7f,_0x4f7373,_0x79b737,_0x603ec8,_0x79b737['Fields'],_0x34f5b5);})[_0x187e('0x22')](function(_0x58b504){_0x2ccf9f=_0x58b504;logger['info'](_0x187e('0x52'));logger[_0x187e('0x15')](_0x187e('0x53'),_0x2ccf9f['id']);var _0x1c4b09=util[_0x187e('0x1c')](_0x187e('0x54'),_0x4fad84['remoteUri'],_[_0x187e('0x55')](_0x2ccf9f['id'],'x')[0x1]);logger[_0x187e('0x15')]('[OUTBOUND]',_0x187e('0x56'));emit(util[_0x187e('0x1c')](_0x187e('0x5f'),_0x40660c[_0x187e('0x13')]),_0x187e('0x57'),{'uri':_0x1c4b09});})[_0x187e('0x27')](function(_0x53dc89){logger[_0x187e('0x26')]('[OUTBOUND]',JSON[_0x187e('0x21')](_0x53dc89));});};exports[_0x187e('0x60')]=function(_0x8b296c,_0x350622,_0x425684,_0x33717f,_0x535d36,_0x28d769){var _0x46cd62,_0x2c929b,_0x208435,_0x4e4123;_0x28d769['remoteUri']=intUtil[_0x187e('0x46')](_0x28d769[_0x187e('0x1d')]);_0x28d769['serverUrl']=intUtil['stripTrailingSlash'](_0x28d769[_0x187e('0x4b')]);if(_0x535d36&&_0x535d36[_0x187e('0x47')]){logger['info']('['+_0x350622[_0x187e('0x61')]['toUpperCase']()+']',_0x187e('0x5c'));_0x350622['recordingURL']=util[_0x187e('0x1c')](_0x187e('0x4a'),_0x28d769[_0x187e('0x4b')],_0x350622[_0x187e('0x4c')],md5(_0x350622['uniqueid']));}else{_0x350622['recordingURL']='';}return getConnection(_0x28d769)[_0x187e('0x22')](function(_0x2f68d4){_0x4e4123=_0x2f68d4;return getUser(_0x28d769,'',_0x4e4123);})['then'](function(_0xefa2c2){_0x46cd62=_0xefa2c2;logger[_0x187e('0x15')](_0x187e('0x4d'),_0x46cd62['id']);return getEndUser(_0x28d769,_0x350622[_0x187e('0x4e')],_0x350622[_0x187e('0x4f')],_0x4e4123);})[_0x187e('0x22')](function(_0x3e1578){_0x2c929b=_0x3e1578;logger[_0x187e('0x15')]('The\x20Enduser\x20ID\x20is:',_0x2c929b['id']);return createTicket(_0x28d769,_0x46cd62,_0x2c929b,_0x425684,_0x350622,_0x425684['Fields'],_0x4e4123);})[_0x187e('0x22')](function(_0x311dc3){_0x208435=_0x311dc3;logger[_0x187e('0x15')](_0x187e('0x52'));logger[_0x187e('0x15')](_0x187e('0x53'),_0x208435['id']);})['catch'](function(_0x1192f9){logger[_0x187e('0x26')]('['+_0x350622[_0x187e('0x61')][_0x187e('0x62')]()+']',JSON[_0x187e('0x21')](_0x1192f9));});}; \ No newline at end of file +var _0x48ce=['variable','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Subjects','getString','Descriptions','%s/webservice.php','remoteUri','create','username','sessionName','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','Getting\x20agent\x20with\x20email','query','format','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','email1','first_name','last_name','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','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','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','user:%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','toString'];(function(_0x90f4a9,_0x3da2c7){var _0xd31954=function(_0x26048a){while(--_0x26048a){_0x90f4a9['push'](_0x90f4a9['shift']());}};_0xd31954(++_0x3da2c7);}(_0x48ce,0x11f));var _0xe48c=function(_0x269d63,_0x27468f){_0x269d63=_0x269d63-0x0;var _0x3821f9=_0x48ce[_0x269d63];return _0x3821f9;};'use strict';var _=require(_0xe48c('0x0'));var rp=require(_0xe48c('0x1'));var BPromise=require(_0xe48c('0x2'));var md5=require(_0xe48c('0x3'));var util=require(_0xe48c('0x4'));var Redis=require(_0xe48c('0x5'));var intUtil=require(_0xe48c('0x6'));var config=require(_0xe48c('0x7'));var logger=require('../../../../config/logger')(_0xe48c('0x8'));config['redis']=_['defaults'](config[_0xe48c('0x9')],{'host':_0xe48c('0xa'),'port':0x18eb});var io=require(_0xe48c('0xb'))(new Redis(config[_0xe48c('0x9')]));function emit(_0x4dc3ab,_0xf363c5,_0x3bb278){io['to'](_0x4dc3ab)[_0xe48c('0xc')](_0xf363c5,_0x3bb278);}function getCustomFields(_0x295ad3,_0x4037f5){var _0x51ffe2={};if(_0x295ad3[_0xe48c('0xd')]>0x0){_[_0xe48c('0xe')](_0x295ad3,function(_0x3f2f03){if(_0x3f2f03[_0xe48c('0xf')]===_0xe48c('0x10')&&_0x3f2f03['idField']){_0x51ffe2[_0x3f2f03[_0xe48c('0x11')]]=_0x3f2f03['content'][_0xe48c('0x12')]();}else if(_0x3f2f03['type']===_0xe48c('0x13')&&_0x3f2f03['variableName']&&_0x3f2f03[_0xe48c('0x11')]&&_0x4037f5[_0x3f2f03['variableName']]){_0x51ffe2[_0x3f2f03[_0xe48c('0x11')]]=_0x4037f5[_0x3f2f03['variableName']][_0xe48c('0x12')]();}else if(_0x3f2f03['type']===_0xe48c('0x14')&&_0x3f2f03[_0xe48c('0x15')]&&_0x3f2f03[_0xe48c('0x15')]['name']&&_0x3f2f03[_0xe48c('0x11')]&&_0x4037f5[_0x3f2f03['Variable'][_0xe48c('0x16')]['toLowerCase']()]){_0x51ffe2[_0x3f2f03[_0xe48c('0x11')]]=_0x4037f5[_0x3f2f03[_0xe48c('0x15')]['name'][_0xe48c('0x17')]()][_0xe48c('0x12')]();}});}return _0x51ffe2;}function createTicket(_0x283801,_0x2a78b1,_0xb22af,_0x4c92c3,_0x5a0829,_0x4964b2,_0x4b8add){logger[_0xe48c('0x18')](_0xe48c('0x19'));var _0x1cc05e=_[_0xe48c('0x1a')]({'parent_id':'','assigned_user_id':_0x2a78b1['id'],'ticketpriorities':_0xe48c('0x1b'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4c92c3[_0xe48c('0x1c')],_0x5a0829,'\x20'),'description':intUtil[_0xe48c('0x1d')](_0x4c92c3[_0xe48c('0x1e')],_0x5a0829,'\x0a'),'contact_id':_0xb22af['id']},getCustomFields(_0x4964b2,_0x5a0829));var _0x52f3a5={'method':'POST','uri':util['format'](_0xe48c('0x1f'),_0x283801[_0xe48c('0x20')]),'form':{'operation':_0xe48c('0x21'),'username':_0x283801[_0xe48c('0x22')],'sessionName':_0x4b8add[_0xe48c('0x23')],'elementType':'HelpDesk','element':JSON[_0xe48c('0x24')](_0x1cc05e)},'json':!![]};return request(_0x52f3a5)[_0xe48c('0x25')](function(_0x960b1b){if(_0x960b1b[_0xe48c('0x26')]){return BPromise[_0xe48c('0x27')]({'id':_0x960b1b['result']['id']});}else{throw new Error(util['format'](_0xe48c('0x28'),JSON['stringify'](_0x960b1b[_0xe48c('0x29')])));}})[_0xe48c('0x2a')](function(_0x2c3e28){var _0x4d1c6a=_0x2c3e28[_0xe48c('0x2b')]||0x1f4;logger[_0xe48c('0x29')](_0xe48c('0x2c'),_0xe48c('0x2d'),_0x4d1c6a,JSON[_0xe48c('0x24')](_0x2c3e28));});}function getUser(_0x258b21,_0x4cd555,_0x251f88){if(intUtil['validateEmail'](_0x4cd555)){logger['info'](_0xe48c('0x2e'),_0x4cd555);return request({'method':'GET','uri':util['format'](_0xe48c('0x1f'),_0x258b21[_0xe48c('0x20')]),'qs':{'operation':_0xe48c('0x2f'),'username':_0x258b21[_0xe48c('0x22')],'sessionName':_0x251f88['sessionName'],'query':util[_0xe48c('0x30')](_0xe48c('0x31'),_0x4cd555)},'json':!![]})['then'](function(_0x5d732e){if(_0x5d732e[_0xe48c('0x26')]&&_0x5d732e[_0xe48c('0x32')][_0xe48c('0xd')]){logger['info'](_0xe48c('0x33'));return BPromise[_0xe48c('0x27')]({'id':_0x5d732e[_0xe48c('0x32')][0x0]['id'],'email':_0x5d732e['result'][0x0][_0xe48c('0x34')],'name':_0x5d732e[_0xe48c('0x32')][0x0][_0xe48c('0x35')]+'\x20'+_0x5d732e['result'][_0xe48c('0x36')]});}else{logger[_0xe48c('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xe48c('0x27')]({'id':_0x251f88[_0xe48c('0x37')],'email':_0x258b21[_0xe48c('0x22')],'name':'admin'});}})[_0xe48c('0x2a')](function(_0xa67021){var _0x37374e=_0xa67021[_0xe48c('0x2b')]||0x1f4;logger[_0xe48c('0x29')](_0xe48c('0x2c'),_0xe48c('0x38'),_0x37374e,JSON['stringify'](_0xa67021));});}else{logger[_0xe48c('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x251f88['userId'],'email':_0x258b21[_0xe48c('0x22')],'name':'admin'})['catch'](function(_0x162c58){var _0x224eed=_0x162c58['statusCode']||0x1f4;logger[_0xe48c('0x29')](_0xe48c('0x2c'),_0xe48c('0x38'),_0x224eed,JSON[_0xe48c('0x24')](_0x162c58));});}}function getEndUser(_0x12c10b,_0x3a7b50,_0x35690b,_0x11f257){logger[_0xe48c('0x18')](_0xe48c('0x39'),_0x35690b);return request({'method':_0xe48c('0x3a'),'uri':util[_0xe48c('0x30')](_0xe48c('0x1f'),_0x12c10b[_0xe48c('0x20')]),'qs':{'operation':_0xe48c('0x2f'),'username':_0x12c10b[_0xe48c('0x22')],'sessionName':_0x11f257[_0xe48c('0x23')],'query':util[_0xe48c('0x30')]('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;',_0x35690b,_0x35690b,_0x35690b,_0x35690b,_0x35690b)},'json':!![]})[_0xe48c('0x25')](function(_0x3e6bb5){if(_0x3e6bb5[_0xe48c('0x26')]&&_0x3e6bb5['result'][_0xe48c('0xd')]){logger['info'](_0xe48c('0x3b'));return BPromise[_0xe48c('0x27')]({'id':_0x3e6bb5[_0xe48c('0x32')][0x0]['id'],'name':_0x3e6bb5[_0xe48c('0x32')][0x0][_0xe48c('0x3c')]+'\x20'+_0x3e6bb5['result'][0x0][_0xe48c('0x3d')],'phone':_0x35690b});}else{logger[_0xe48c('0x18')](_0xe48c('0x3e'));return request({'method':_0xe48c('0x3f'),'uri':util[_0xe48c('0x30')](_0xe48c('0x1f'),_0x12c10b[_0xe48c('0x20')]),'form':{'operation':_0xe48c('0x21'),'sessionName':_0x11f257[_0xe48c('0x23')],'elementType':'Contacts','element':JSON[_0xe48c('0x24')]({'lastname':_0x3a7b50,'phone':_0x35690b,'assigned_user_id':'\x20'})},'json':!![]})[_0xe48c('0x25')](function(_0x1b36f2){logger['info'](_0xe48c('0x40'));return BPromise[_0xe48c('0x27')]({'id':_0x1b36f2['result']['id'],'name':_0x1b36f2[_0xe48c('0x32')]['lastname'],'phone':_0x1b36f2[_0xe48c('0x32')][_0xe48c('0x41')]});})[_0xe48c('0x2a')](function(_0x48896e){var _0xe8ed0d=_0x48896e['statusCode']||0x1f4;logger[_0xe48c('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xe48c('0x42'),_0xe8ed0d,JSON[_0xe48c('0x24')](_0x48896e));});}});}function getConnection(_0x1389d9){var _0x5d0ba8=_0x1389d9[_0xe48c('0x22')];var _0x5c905b=_0x1389d9[_0xe48c('0x43')];return request({'method':_0xe48c('0x3a'),'uri':util[_0xe48c('0x30')](_0xe48c('0x1f'),_0x1389d9[_0xe48c('0x20')]),'qs':{'operation':_0xe48c('0x44'),'username':_0x5d0ba8},'json':!![]})[_0xe48c('0x25')](function(_0x2594b5){if(_0x2594b5[_0xe48c('0x26')]){return request({'method':_0xe48c('0x3f'),'uri':util[_0xe48c('0x30')]('%s/webservice.php',_0x1389d9[_0xe48c('0x20')]),'form':{'operation':_0xe48c('0x45'),'username':_0x5d0ba8,'accessKey':md5(_0x2594b5[_0xe48c('0x32')]['token']+_0x5c905b)},'json':!![]});}})[_0xe48c('0x25')](function(_0x14e7fd){if(_0x14e7fd[_0xe48c('0x26')]){return BPromise[_0xe48c('0x27')](_0x14e7fd[_0xe48c('0x32')]);}else{throw new Error(util[_0xe48c('0x30')](_0xe48c('0x46'),_0x1389d9['id']));}})[_0xe48c('0x2a')](function(_0x40636a){var _0x31bf7e=_0x40636a[_0xe48c('0x2b')]||0x1f4;logger[_0xe48c('0x29')](_0xe48c('0x2c'),_0xe48c('0x47'),_0x31bf7e,JSON[_0xe48c('0x24')](_0x40636a));});}function request(_0x1b6e78){logger['info'](_0xe48c('0x48'),JSON['stringify'](_0x1b6e78));return rp(_0x1b6e78);}exports[_0xe48c('0x49')]=function(_0x3849c7,_0x431f60,_0x552c3b,_0x5a251f,_0x8c1b84,_0x436235){var _0x4baa96,_0x5d1b55,_0x4c6054,_0x3e763a;_0x436235[_0xe48c('0x20')]=intUtil['stripTrailingSlash'](_0x436235['remoteUri']);if(_0x8c1b84&&_0x8c1b84[_0xe48c('0x4a')]){logger[_0xe48c('0x18')](_0xe48c('0x4b'),_0xe48c('0x4c'));_0x431f60[_0xe48c('0x4d')]=util[_0xe48c('0x30')](_0xe48c('0x4e'),_0x436235[_0xe48c('0x4f')],_0x431f60[_0xe48c('0x50')],md5(_0x431f60[_0xe48c('0x50')]));}else{_0x431f60[_0xe48c('0x4d')]='';}return getConnection(_0x436235)[_0xe48c('0x25')](function(_0x6b0f7d){_0x3e763a=_0x6b0f7d;return getUser(_0x436235,_0x5a251f['email'],_0x3e763a);})[_0xe48c('0x25')](function(_0x3588ad){_0x4baa96=_0x3588ad;logger[_0xe48c('0x18')](_0xe48c('0x51'),_0x4baa96['id']);return getEndUser(_0x436235,_0x431f60[_0xe48c('0x52')],_0x431f60[_0xe48c('0x53')],_0x3e763a);})[_0xe48c('0x25')](function(_0x5edad9){_0x5d1b55=_0x5edad9;logger[_0xe48c('0x18')](_0xe48c('0x54'),_0x5d1b55['id']);return createTicket(_0x436235,_0x4baa96,_0x5d1b55,_0x552c3b,_0x431f60,_0x552c3b[_0xe48c('0x55')],_0x3e763a);})['then'](function(_0x4583cd){_0x4c6054=_0x4583cd;logger[_0xe48c('0x18')](_0xe48c('0x56'));logger['info'](_0xe48c('0x57'),_0x4c6054['id']);var _0x15d86b=util[_0xe48c('0x30')](_0xe48c('0x58'),_0x436235[_0xe48c('0x20')],_[_0xe48c('0x59')](_0x4c6054['id'],'x')[0x1]);logger[_0xe48c('0x18')](_0xe48c('0x4b'),_0xe48c('0x5a'));emit(util[_0xe48c('0x30')]('user:%s',_0x5a251f[_0xe48c('0x16')]),'trigger:browser:url',{'uri':_0x15d86b});})['catch'](function(_0x8ee98f){logger[_0xe48c('0x29')](_0xe48c('0x4b'),JSON[_0xe48c('0x24')](_0x8ee98f));});};exports[_0xe48c('0x5b')]=function(_0x18711b,_0x332de1,_0x56a083,_0xbde5bd,_0x72ed3f,_0x3c5973,_0x422a97){var _0x239fb6,_0x1674a0,_0x1e015d,_0x249845;_0x3c5973[_0xe48c('0x20')]=intUtil[_0xe48c('0x5c')](_0x3c5973[_0xe48c('0x20')]);_0x3c5973['serverUrl']=intUtil[_0xe48c('0x5c')](_0x3c5973['serverUrl']);if(_0x422a97&&_0x422a97[_0xe48c('0x5d')]&&_0x422a97[_0xe48c('0x5d')]!==_0xe48c('0x5e')){logger[_0xe48c('0x18')](_0xe48c('0x5f'),_0xe48c('0x4c'));_0x332de1['recordingURL']=util['format'](_0xe48c('0x4e'),_0x3c5973[_0xe48c('0x4f')],_0x332de1[_0xe48c('0x50')],md5(_0x332de1[_0xe48c('0x50')]));}return getConnection(_0x3c5973)[_0xe48c('0x25')](function(_0x1820a6){_0x249845=_0x1820a6;return getUser(_0x3c5973,_0xbde5bd['email'],_0x249845);})[_0xe48c('0x25')](function(_0x20934d){_0x239fb6=_0x20934d;logger['info'](_0xe48c('0x51'),_0x239fb6['id']);return getEndUser(_0x3c5973,_0x332de1[_0xe48c('0x60')],_0x332de1['destcalleridnum'],_0x249845);})[_0xe48c('0x25')](function(_0x932066){_0x1674a0=_0x932066;logger[_0xe48c('0x18')]('The\x20Enduser\x20ID\x20is:',_0x1674a0['id']);return createTicket(_0x3c5973,_0x239fb6,_0x1674a0,_0x56a083,_0x332de1,_0x56a083[_0xe48c('0x55')],_0x249845);})[_0xe48c('0x25')](function(_0x2446ee){_0x1e015d=_0x2446ee;logger[_0xe48c('0x18')](_0xe48c('0x56'));logger[_0xe48c('0x18')](_0xe48c('0x57'),_0x1e015d['id']);var _0x260579=util[_0xe48c('0x30')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3c5973[_0xe48c('0x20')],_['split'](_0x1e015d['id'],'x')[0x1]);logger[_0xe48c('0x18')](_0xe48c('0x5f'),_0xe48c('0x5a'));emit(util[_0xe48c('0x30')](_0xe48c('0x61'),_0xbde5bd[_0xe48c('0x16')]),_0xe48c('0x62'),{'uri':_0x260579});})[_0xe48c('0x2a')](function(_0x110930){logger[_0xe48c('0x29')](_0xe48c('0x5f'),JSON[_0xe48c('0x24')](_0x110930));});};exports[_0xe48c('0x63')]=function(_0x1b6bda,_0x408abd,_0x5bce17,_0x273739,_0x340a4b,_0x32fdf0){var _0x17f2af,_0x5837ab,_0x10254e,_0xc5f70d;_0x32fdf0['remoteUri']=intUtil['stripTrailingSlash'](_0x32fdf0[_0xe48c('0x20')]);_0x32fdf0[_0xe48c('0x4f')]=intUtil[_0xe48c('0x5c')](_0x32fdf0[_0xe48c('0x4f')]);if(_0x340a4b&&_0x340a4b['monitor_format']){logger[_0xe48c('0x18')]('['+_0x408abd[_0xe48c('0x64')][_0xe48c('0x65')]()+']',_0xe48c('0x4c'));_0x408abd[_0xe48c('0x4d')]=util[_0xe48c('0x30')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32fdf0['serverUrl'],_0x408abd[_0xe48c('0x50')],md5(_0x408abd[_0xe48c('0x50')]));}else{_0x408abd[_0xe48c('0x4d')]='';}return getConnection(_0x32fdf0)['then'](function(_0x35db9c){_0xc5f70d=_0x35db9c;return getUser(_0x32fdf0,'',_0xc5f70d);})[_0xe48c('0x25')](function(_0x4ddcf3){_0x17f2af=_0x4ddcf3;logger[_0xe48c('0x18')](_0xe48c('0x51'),_0x17f2af['id']);return getEndUser(_0x32fdf0,_0x408abd[_0xe48c('0x52')],_0x408abd[_0xe48c('0x53')],_0xc5f70d);})[_0xe48c('0x25')](function(_0xf82247){_0x5837ab=_0xf82247;logger[_0xe48c('0x18')](_0xe48c('0x54'),_0x5837ab['id']);return createTicket(_0x32fdf0,_0x17f2af,_0x5837ab,_0x5bce17,_0x408abd,_0x5bce17['Fields'],_0xc5f70d);})[_0xe48c('0x25')](function(_0x4911ed){_0x10254e=_0x4911ed;logger[_0xe48c('0x18')](_0xe48c('0x56'));logger['info'](_0xe48c('0x57'),_0x10254e['id']);})[_0xe48c('0x2a')](function(_0x11ac24){logger['error']('['+_0x408abd[_0xe48c('0x64')][_0xe48c('0x65')]()+']',JSON[_0xe48c('0x24')](_0x11ac24));});}; \ 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 971f5e5..14012f0 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 _0x0fbd=['then','Ticket\x20created!','ticket','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s/token:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','email','destcalleridname','[OUTBOUND]','user:%s','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','POST','merge','Tags','name','getString','Descriptions','Fields'];(function(_0x5a5379,_0x58dee3){var _0x419fcc=function(_0x50cd03){while(--_0x50cd03){_0x5a5379['push'](_0x5a5379['shift']());}};_0x419fcc(++_0x58dee3);}(_0x0fbd,0x1ef));var _0xd0fb=function(_0x3c8068,_0x313b86){_0x3c8068=_0x3c8068-0x0;var _0x25eacb=_0x0fbd[_0x3c8068];return _0x25eacb;};'use strict';var _=require(_0xd0fb('0x0'));var rp=require(_0xd0fb('0x1'));var md5=require(_0xd0fb('0x2'));var util=require(_0xd0fb('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xd0fb('0x4'));var logger=require('../../../../config/logger')('zendesk');config[_0xd0fb('0x5')]=_[_0xd0fb('0x6')](config[_0xd0fb('0x5')],{'host':_0xd0fb('0x7'),'port':0x18eb});var io=require(_0xd0fb('0x8'))(new Redis(config[_0xd0fb('0x5')]));function emit(_0x453751,_0x293513,_0x3b14c6){io['to'](_0x453751)[_0xd0fb('0x9')](_0x293513,_0x3b14c6);}var headers={'Content-Type':_0xd0fb('0xa'),'Accept':_0xd0fb('0xa')};function getTicket(_0x35bcbb,_0xe7c4de,_0x1a87e5,_0x121a81,_0x3344b5){logger[_0xd0fb('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xd0fb('0xc')]('%s/tickets.json',_0x35bcbb['remoteUri']),'method':_0xd0fb('0xd'),'body':{'ticket':_[_0xd0fb('0xe')]({'requester_id':_0x1a87e5['id'],'submitter_id':_0xe7c4de?_0xe7c4de['id']:undefined,'assignee_id':_0xe7c4de?_0xe7c4de['id']:undefined,'tags':getTags(_0x121a81[_0xd0fb('0xf')],_0xd0fb('0x10')),'subject':intUtil[_0xd0fb('0x11')](_0x121a81['Subjects'],_0x3344b5,'\x20'),'description':intUtil[_0xd0fb('0x11')](_0x121a81[_0xd0fb('0x12')],_0x3344b5,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x121a81[_0xd0fb('0x12')],_0x3344b5,'\x0a')}},getCustomFields(_0x121a81[_0xd0fb('0x13')],_0x3344b5))}})[_0xd0fb('0x14')](function(_0x5cc814){logger[_0xd0fb('0xb')](_0xd0fb('0x15'));return _0x5cc814[_0xd0fb('0x16')];});}function getUser(_0x21c0c4,_0x1a4c55){if(intUtil['validateEmail'](_0x1a4c55)){logger['info']('Getting\x20agent\x20with\x20email',_0x1a4c55);return request({'uri':util[_0xd0fb('0xc')](_0xd0fb('0x17'),_0x21c0c4[_0xd0fb('0x18')]),'qs':{'query':util[_0xd0fb('0xc')](_0xd0fb('0x19'),_0x1a4c55)}})[_0xd0fb('0x14')](function(_0x461b0b){if(_0x461b0b[_0xd0fb('0x1a')]){logger[_0xd0fb('0xb')](_0xd0fb('0x1b'));return _[_0xd0fb('0x1c')](_0x461b0b['results'],{'email':_0x1a4c55,'role':_0xd0fb('0x1d')});}else{logger[_0xd0fb('0xb')](_0xd0fb('0x1e'));return request({'uri':util[_0xd0fb('0xc')](_0xd0fb('0x1f'),_0x21c0c4[_0xd0fb('0x18')])})[_0xd0fb('0x14')](function(_0x72ab52){logger[_0xd0fb('0xb')]('Admin\x20account\x20selected.');return _0x72ab52[_0xd0fb('0x20')];});}});}else{logger[_0xd0fb('0xb')](_0xd0fb('0x1e'));return request({'uri':util[_0xd0fb('0xc')](_0xd0fb('0x1f'),_0x21c0c4[_0xd0fb('0x18')])})[_0xd0fb('0x14')](function(_0x5db31f){logger['info']('Admin\x20account\x20selected.');return _0x5db31f[_0xd0fb('0x20')];});}}function getEndUser(_0x5dacb0,_0x177b7b,_0x11ed6){logger[_0xd0fb('0xb')](_0xd0fb('0x21'),_0x11ed6);return request({'uri':util[_0xd0fb('0xc')](_0xd0fb('0x17'),_0x5dacb0[_0xd0fb('0x18')]),'qs':{'query':util['format'](_0xd0fb('0x22'),_0x11ed6)}})[_0xd0fb('0x14')](function(_0x15da5a){var _0x127640;if(_0x15da5a[_0xd0fb('0x23')][_0xd0fb('0x24')]){_0x15da5a[_0xd0fb('0x23')]=_[_0xd0fb('0x25')](_0x15da5a['results'],{'suspended':![],'role':_0xd0fb('0x26')});if(_0x15da5a[_0xd0fb('0x23')][_0xd0fb('0x24')]){_0x127640=_[_0xd0fb('0x27')](_0x15da5a[_0xd0fb('0x23')]);}}if(_0x127640){logger[_0xd0fb('0xb')](_0xd0fb('0x28'));return _0x127640;}else{logger[_0xd0fb('0xb')](_0xd0fb('0x29'));return request({'uri':util[_0xd0fb('0xc')]('%s/users.json',_0x5dacb0[_0xd0fb('0x18')]),'method':_0xd0fb('0xd'),'body':{'user':{'role':_0xd0fb('0x26'),'name':util['format'](_0xd0fb('0x2a'),_0x177b7b||_0x11ed6),'phone':_0x11ed6}}})[_0xd0fb('0x14')](function(_0x3a435b){logger[_0xd0fb('0xb')](_0xd0fb('0x2b'));return _0x3a435b[_0xd0fb('0x20')];});}});}function getAuth(_0x877960){var _0x24c40e;if(_0x877960[_0xd0fb('0x2c')]==='password'){_0x24c40e=util['format']('%s:%s',_0x877960['username'],_0x877960[_0xd0fb('0x2d')]);}else if(_0x877960[_0xd0fb('0x2c')]==='token'){_0x24c40e=util[_0xd0fb('0xc')](_0xd0fb('0x2e'),_0x877960[_0xd0fb('0x2f')],_0x877960[_0xd0fb('0x30')]);}return util['format'](_0xd0fb('0x31'),new Buffer(_0x24c40e)[_0xd0fb('0x32')](_0xd0fb('0x33')));}function request(_0x32554e){logger[_0xd0fb('0x34')](_0xd0fb('0x35'),JSON[_0xd0fb('0x36')](_0x32554e));return rp(_[_0xd0fb('0x6')](_0x32554e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xb5e1eb,_0x2c71f6){var _0x1c3492=[];if(_0xb5e1eb&&_0xb5e1eb[_0xd0fb('0x24')]>0x0){_0x1c3492=_[_0xd0fb('0x37')](_0xb5e1eb,_0x2c71f6);}return _0x1c3492;}function getCustomFields(_0x397ee5,_0x343522){var _0x11ac00=[];var _0x57aa2d={'custom_fields':[]};if(_0x397ee5[_0xd0fb('0x24')]>0x0){_['forEach'](_0x397ee5,function(_0x5f2a4c){if(_0x5f2a4c[_0xd0fb('0x38')]===_0xd0fb('0x39')&&_0x5f2a4c[_0xd0fb('0x3a')]&&!_0x5f2a4c[_0xd0fb('0x3b')]){_0x57aa2d[_0x5f2a4c[_0xd0fb('0x3a')][_0xd0fb('0x3c')]()]=_0x5f2a4c[_0xd0fb('0x3d')][_0xd0fb('0x32')]();}else if(_0x5f2a4c[_0xd0fb('0x38')]===_0xd0fb('0x39')&&_0x5f2a4c[_0xd0fb('0x3e')]&&_0x5f2a4c[_0xd0fb('0x3b')]){_0x57aa2d[_0xd0fb('0x3f')][_0xd0fb('0x40')]({'id':_0x5f2a4c[_0xd0fb('0x3e')],'value':_0x5f2a4c[_0xd0fb('0x3d')][_0xd0fb('0x32')]()});}else if(_0x5f2a4c[_0xd0fb('0x38')]===_0xd0fb('0x41')&&_0x5f2a4c[_0xd0fb('0x42')]&&_0x5f2a4c[_0xd0fb('0x3e')]&&_0x5f2a4c[_0xd0fb('0x3b')]){_0x343522[_0x5f2a4c['variableName']]&&_0x57aa2d['custom_fields'][_0xd0fb('0x40')]({'id':_0x5f2a4c[_0xd0fb('0x3e')],'value':_0x343522[_0x5f2a4c[_0xd0fb('0x42')]]['toString']()});}else if(_0x5f2a4c[_0xd0fb('0x38')]===_0xd0fb('0x43')&&_0x5f2a4c[_0xd0fb('0x44')]&&_0x5f2a4c[_0xd0fb('0x44')][_0xd0fb('0x10')]&&_0x5f2a4c['idField']&&_0x5f2a4c[_0xd0fb('0x3b')]){_0x343522[_0x5f2a4c[_0xd0fb('0x44')][_0xd0fb('0x10')][_0xd0fb('0x3c')]()]&&_0x57aa2d[_0xd0fb('0x3f')][_0xd0fb('0x40')]({'id':_0x5f2a4c[_0xd0fb('0x3e')],'value':_0x343522[_0x5f2a4c[_0xd0fb('0x44')][_0xd0fb('0x10')][_0xd0fb('0x3c')]()][_0xd0fb('0x32')]()});}});}return _0x57aa2d;}exports[_0xd0fb('0x45')]=function(_0x49b28f,_0xc48942,_0x59d3b0,_0x4b46f6,_0x14d956,_0x2dde14){var _0x3a9e58,_0x1b4d7d;_0x2dde14[_0xd0fb('0x18')]=intUtil[_0xd0fb('0x46')](_0x2dde14[_0xd0fb('0x18')]);_0x2dde14[_0xd0fb('0x47')]=intUtil[_0xd0fb('0x46')](_0x2dde14[_0xd0fb('0x47')]);if(_0x14d956&&_0x14d956[_0xd0fb('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0xc48942['recordingURL']=util['format'](_0xd0fb('0x49'),_0x2dde14[_0xd0fb('0x47')],_0xc48942['uniqueid'],md5(_0xc48942[_0xd0fb('0x4a')]));}else{_0xc48942[_0xd0fb('0x4b')]='';}headers['Authorization']=getAuth(_0x2dde14);return getUser(_0x2dde14,_0x4b46f6['email'])[_0xd0fb('0x14')](function(_0x101361){_0x3a9e58=_0x101361;logger['info'](_0xd0fb('0x4c'),_0x3a9e58['id']);return getEndUser(_0x2dde14,_0xc48942[_0xd0fb('0x4d')],_0xc48942['calleridnum']);})['then'](function(_0x4a4a5e){_0x1b4d7d=_0x4a4a5e;logger[_0xd0fb('0xb')](_0xd0fb('0x4e'),_0x1b4d7d['id']);return getTicket(_0x2dde14,_0x3a9e58,_0x1b4d7d,_0x59d3b0,_0xc48942);})[_0xd0fb('0x14')](function(_0xf088ec){if(_0xf088ec){logger[_0xd0fb('0xb')](_0xd0fb('0x4f'),_0xf088ec['id']);switch(_0x2dde14['type']){case'integrationTab':logger[_0xd0fb('0xb')]('[QUEUE]',_0xd0fb('0x50'));return request({'uri':util['format'](_0xd0fb('0x51'),_0x2dde14['remoteUri'],_0x3a9e58['id'],_0xf088ec['id']),'method':_0xd0fb('0xd')});case _0xd0fb('0x52'):logger[_0xd0fb('0xb')](_0xd0fb('0x53'),_0xd0fb('0x54'));emit(util[_0xd0fb('0xc')]('user:%s',_0x4b46f6[_0xd0fb('0x10')]),'trigger:browser:url',{'uri':util[_0xd0fb('0xc')](_0xd0fb('0x55'),_0x2dde14[_0xd0fb('0x18')][_0xd0fb('0x56')]('/api/v2',''),_0xf088ec['id'])});break;default:logger[_0xd0fb('0x57')](_0xd0fb('0x53'),_0xd0fb('0x58'));}}})[_0xd0fb('0x59')](function(_0x11ba22){logger[_0xd0fb('0x57')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xd0fb('0x5a')](_0x11ba22,{'showHidden':!![],'depth':null}));});};exports[_0xd0fb('0x5b')]=function(_0x2de835,_0x56218f,_0x4b7127,_0x54fbcd,_0x305bea,_0x5596d2,_0x2ab83b){var _0x11f9c2,_0x2a67fc;_0x5596d2[_0xd0fb('0x18')]=intUtil[_0xd0fb('0x46')](_0x5596d2[_0xd0fb('0x18')]);_0x5596d2[_0xd0fb('0x47')]=intUtil[_0xd0fb('0x46')](_0x5596d2['serverUrl']);if(_0x2ab83b&&_0x2ab83b['recordingFormat']&&_0x2ab83b[_0xd0fb('0x5c')]!==_0xd0fb('0x5d')){logger[_0xd0fb('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x56218f[_0xd0fb('0x4b')]=util[_0xd0fb('0xc')](_0xd0fb('0x49'),_0x5596d2[_0xd0fb('0x47')],_0x56218f[_0xd0fb('0x4a')],md5(_0x56218f[_0xd0fb('0x4a')]));}headers['Authorization']=getAuth(_0x5596d2);return getUser(_0x5596d2,_0x54fbcd[_0xd0fb('0x5e')])['then'](function(_0x5d2505){_0x11f9c2=_0x5d2505;logger[_0xd0fb('0xb')](_0xd0fb('0x4c'),_0x11f9c2['id']);return getEndUser(_0x5596d2,_0x56218f[_0xd0fb('0x5f')],_0x56218f['destcalleridnum']);})['then'](function(_0x77983d){_0x2a67fc=_0x77983d;logger[_0xd0fb('0xb')](_0xd0fb('0x4e'),_0x2a67fc['id']);return getTicket(_0x5596d2,_0x11f9c2,_0x2a67fc,_0x4b7127,_0x56218f);})['then'](function(_0x510de8){if(_0x510de8){logger[_0xd0fb('0xb')]('The\x20Ticket\x20ID\x20is:',_0x510de8['id']);switch(_0x5596d2[_0xd0fb('0x38')]){case'integrationTab':logger[_0xd0fb('0xb')](_0xd0fb('0x60'),_0xd0fb('0x50'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5596d2[_0xd0fb('0x18')],_0x11f9c2['id'],_0x510de8['id']),'method':'POST'});case _0xd0fb('0x52'):logger[_0xd0fb('0xb')](_0xd0fb('0x60'),_0xd0fb('0x54'));emit(util['format'](_0xd0fb('0x61'),_0x54fbcd['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x5596d2[_0xd0fb('0x18')][_0xd0fb('0x56')](_0xd0fb('0x62'),''),_0x510de8['id'])});break;default:logger[_0xd0fb('0x57')](_0xd0fb('0x60'),_0xd0fb('0x58'));}}})['catch'](function(_0x14873f){logger['error'](_0xd0fb('0x63'),util[_0xd0fb('0x5a')](_0x14873f,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x19442a,_0x155e2c,_0x2b8380,_0x534c09,_0x43c6be,_0x1c98f1){var _0x1bcf68,_0x38f4e2;_0x1c98f1[_0xd0fb('0x18')]=intUtil[_0xd0fb('0x46')](_0x1c98f1[_0xd0fb('0x18')]);_0x1c98f1[_0xd0fb('0x47')]=intUtil[_0xd0fb('0x46')](_0x1c98f1[_0xd0fb('0x47')]);if(_0x43c6be&&_0x43c6be[_0xd0fb('0x48')]){logger[_0xd0fb('0xb')]('['+_0x155e2c['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x155e2c['recordingURL']=util['format'](_0xd0fb('0x49'),_0x1c98f1[_0xd0fb('0x47')],_0x155e2c[_0xd0fb('0x4a')],md5(_0x155e2c[_0xd0fb('0x4a')]));}else{_0x155e2c[_0xd0fb('0x4b')]='';}headers['Authorization']=getAuth(_0x1c98f1);return getUser(_0x1c98f1)['then'](function(_0x4bc7ce){_0x1bcf68=_0x4bc7ce;logger[_0xd0fb('0xb')](_0xd0fb('0x4c'),_0x1bcf68['id']);return getEndUser(_0x1c98f1,_0x155e2c['calleridname'],_0x155e2c[_0xd0fb('0x64')]);})['then'](function(_0x1ed857){_0x38f4e2=_0x1ed857;logger[_0xd0fb('0xb')](_0xd0fb('0x4e'),_0x38f4e2['id']);return getTicket(_0x1c98f1,_0x1bcf68,_0x38f4e2,_0x2b8380,_0x155e2c);})[_0xd0fb('0x14')](function(_0x287369){if(_0x287369){logger[_0xd0fb('0xb')](_0xd0fb('0x4f'),_0x287369['id']);}})[_0xd0fb('0x59')](function(_0x38a49d){logger[_0xd0fb('0x57')]('['+_0x155e2c[_0xd0fb('0x65')]['toUpperCase']()+']'+_0xd0fb('0x66'),util[_0xd0fb('0x5a')](_0x38a49d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcc0c=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]','replace','/api/v2','catch','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','then','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s/token:%s','username','token','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','type','string','nameField','customField','content','custom_fields','push','idField','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl'];(function(_0x1d056a,_0x293d07){var _0x8e14c0=function(_0xb2a20a){while(--_0xb2a20a){_0x1d056a['push'](_0x1d056a['shift']());}};_0x8e14c0(++_0x293d07);}(_0xcc0c,0x102));var _0xccc0=function(_0x51c726,_0x332b95){_0x51c726=_0x51c726-0x0;var _0x23fe86=_0xcc0c[_0x51c726];return _0x23fe86;};'use strict';var _=require(_0xccc0('0x0'));var rp=require(_0xccc0('0x1'));var md5=require(_0xccc0('0x2'));var util=require(_0xccc0('0x3'));var Redis=require(_0xccc0('0x4'));var intUtil=require(_0xccc0('0x5'));var config=require(_0xccc0('0x6'));var logger=require('../../../../config/logger')(_0xccc0('0x7'));config[_0xccc0('0x8')]=_['defaults'](config['redis'],{'host':_0xccc0('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xccc0('0x8')]));function emit(_0x1ebe2d,_0x536ff0,_0xe587c2){io['to'](_0x1ebe2d)[_0xccc0('0xa')](_0x536ff0,_0xe587c2);}var headers={'Content-Type':_0xccc0('0xb'),'Accept':_0xccc0('0xb')};function getTicket(_0x3c805e,_0x171423,_0x402bb8,_0x540c80,_0x2e3e3b){logger[_0xccc0('0xc')](_0xccc0('0xd'));return request({'uri':util[_0xccc0('0xe')]('%s/tickets.json',_0x3c805e['remoteUri']),'method':_0xccc0('0xf'),'body':{'ticket':_[_0xccc0('0x10')]({'requester_id':_0x402bb8['id'],'submitter_id':_0x171423?_0x171423['id']:undefined,'assignee_id':_0x171423?_0x171423['id']:undefined,'tags':getTags(_0x540c80[_0xccc0('0x11')],_0xccc0('0x12')),'subject':intUtil['getString'](_0x540c80[_0xccc0('0x13')],_0x2e3e3b,'\x20'),'description':intUtil[_0xccc0('0x14')](_0x540c80[_0xccc0('0x15')],_0x2e3e3b,'\x0a'),'comment':{'public':![],'body':intUtil[_0xccc0('0x14')](_0x540c80[_0xccc0('0x15')],_0x2e3e3b,'\x0a')}},getCustomFields(_0x540c80[_0xccc0('0x16')],_0x2e3e3b))}})['then'](function(_0x4b35bc){logger[_0xccc0('0xc')](_0xccc0('0x17'));return _0x4b35bc[_0xccc0('0x18')];});}function getUser(_0x355343,_0x3996ec){if(intUtil[_0xccc0('0x19')](_0x3996ec)){logger[_0xccc0('0xc')](_0xccc0('0x1a'),_0x3996ec);return request({'uri':util[_0xccc0('0xe')](_0xccc0('0x1b'),_0x355343[_0xccc0('0x1c')]),'qs':{'query':util[_0xccc0('0xe')]('type:user\x20role:agent\x20email:%s',_0x3996ec)}})[_0xccc0('0x1d')](function(_0x30bb5f){if(_0x30bb5f[_0xccc0('0x1e')]){logger[_0xccc0('0xc')](_0xccc0('0x1f'));return _['find'](_0x30bb5f[_0xccc0('0x20')],{'email':_0x3996ec,'role':_0xccc0('0x21')});}else{logger[_0xccc0('0xc')](_0xccc0('0x22'));return request({'uri':util[_0xccc0('0xe')](_0xccc0('0x23'),_0x355343[_0xccc0('0x1c')])})['then'](function(_0x340a82){logger[_0xccc0('0xc')](_0xccc0('0x24'));return _0x340a82[_0xccc0('0x25')];});}});}else{logger['info'](_0xccc0('0x22'));return request({'uri':util[_0xccc0('0xe')](_0xccc0('0x23'),_0x355343[_0xccc0('0x1c')])})[_0xccc0('0x1d')](function(_0x1815d4){logger[_0xccc0('0xc')]('Admin\x20account\x20selected.');return _0x1815d4[_0xccc0('0x25')];});}}function getEndUser(_0x1be0dd,_0x1e0929,_0x4115cd){logger[_0xccc0('0xc')]('Searching\x20enduser\x20with\x20phone',_0x4115cd);return request({'uri':util[_0xccc0('0xe')](_0xccc0('0x1b'),_0x1be0dd['remoteUri']),'qs':{'query':util[_0xccc0('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x4115cd)}})[_0xccc0('0x1d')](function(_0x48b8f7){var _0x253dd5;if(_0x48b8f7['results']['length']){_0x48b8f7[_0xccc0('0x20')]=_[_0xccc0('0x26')](_0x48b8f7[_0xccc0('0x20')],{'suspended':![],'role':_0xccc0('0x27')});if(_0x48b8f7[_0xccc0('0x20')][_0xccc0('0x28')]){_0x253dd5=_[_0xccc0('0x29')](_0x48b8f7[_0xccc0('0x20')]);}}if(_0x253dd5){logger['info'](_0xccc0('0x2a'));return _0x253dd5;}else{logger[_0xccc0('0xc')](_0xccc0('0x2b'));return request({'uri':util[_0xccc0('0xe')](_0xccc0('0x2c'),_0x1be0dd[_0xccc0('0x1c')]),'method':_0xccc0('0xf'),'body':{'user':{'role':'end-user','name':util[_0xccc0('0xe')](_0xccc0('0x2d'),_0x1e0929||_0x4115cd),'phone':_0x4115cd}}})[_0xccc0('0x1d')](function(_0x1dcc0c){logger[_0xccc0('0xc')](_0xccc0('0x2e'));return _0x1dcc0c[_0xccc0('0x25')];});}});}function getAuth(_0x248323){var _0x27b39d;if(_0x248323[_0xccc0('0x2f')]===_0xccc0('0x30')){_0x27b39d=util[_0xccc0('0xe')]('%s:%s',_0x248323['username'],_0x248323[_0xccc0('0x30')]);}else if(_0x248323[_0xccc0('0x2f')]==='token'){_0x27b39d=util[_0xccc0('0xe')](_0xccc0('0x31'),_0x248323[_0xccc0('0x32')],_0x248323[_0xccc0('0x33')]);}return util['format']('Basic\x20%s',new Buffer(_0x27b39d)[_0xccc0('0x34')](_0xccc0('0x35')));}function request(_0x2e17e9){logger[_0xccc0('0x36')](_0xccc0('0x37'),JSON[_0xccc0('0x38')](_0x2e17e9));return rp(_[_0xccc0('0x39')](_0x2e17e9,{'method':_0xccc0('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x5b6ef0,_0x1964aa){var _0x2e314f=[];if(_0x5b6ef0&&_0x5b6ef0[_0xccc0('0x28')]>0x0){_0x2e314f=_[_0xccc0('0x3b')](_0x5b6ef0,_0x1964aa);}return _0x2e314f;}function getCustomFields(_0x47b355,_0x5f0db0){var _0x42286a=[];var _0x406e50={'custom_fields':[]};if(_0x47b355[_0xccc0('0x28')]>0x0){_[_0xccc0('0x3c')](_0x47b355,function(_0x44c3f5){if(_0x44c3f5[_0xccc0('0x3d')]===_0xccc0('0x3e')&&_0x44c3f5[_0xccc0('0x3f')]&&!_0x44c3f5[_0xccc0('0x40')]){_0x406e50[_0x44c3f5[_0xccc0('0x3f')]['toLowerCase']()]=_0x44c3f5[_0xccc0('0x41')][_0xccc0('0x34')]();}else if(_0x44c3f5[_0xccc0('0x3d')]===_0xccc0('0x3e')&&_0x44c3f5['idField']&&_0x44c3f5['customField']){_0x406e50[_0xccc0('0x42')][_0xccc0('0x43')]({'id':_0x44c3f5[_0xccc0('0x44')],'value':_0x44c3f5[_0xccc0('0x41')]['toString']()});}else if(_0x44c3f5[_0xccc0('0x3d')]===_0xccc0('0x45')&&_0x44c3f5['variableName']&&_0x44c3f5[_0xccc0('0x44')]&&_0x44c3f5[_0xccc0('0x40')]){_0x5f0db0[_0x44c3f5[_0xccc0('0x46')]]&&_0x406e50[_0xccc0('0x42')][_0xccc0('0x43')]({'id':_0x44c3f5['idField'],'value':_0x5f0db0[_0x44c3f5['variableName']][_0xccc0('0x34')]()});}else if(_0x44c3f5[_0xccc0('0x3d')]==='customVariable'&&_0x44c3f5[_0xccc0('0x47')]&&_0x44c3f5[_0xccc0('0x47')][_0xccc0('0x12')]&&_0x44c3f5[_0xccc0('0x44')]&&_0x44c3f5[_0xccc0('0x40')]){_0x5f0db0[_0x44c3f5[_0xccc0('0x47')][_0xccc0('0x12')]['toLowerCase']()]&&_0x406e50[_0xccc0('0x42')][_0xccc0('0x43')]({'id':_0x44c3f5['idField'],'value':_0x5f0db0[_0x44c3f5[_0xccc0('0x47')][_0xccc0('0x12')]['toLowerCase']()][_0xccc0('0x34')]()});}});}return _0x406e50;}exports[_0xccc0('0x48')]=function(_0x4a59d3,_0x3a2149,_0x72e623,_0x48e0e9,_0x9dd23f,_0x20f55a){var _0x14b92f,_0x215a7b;_0x20f55a[_0xccc0('0x1c')]=intUtil['stripTrailingSlash'](_0x20f55a['remoteUri']);_0x20f55a['serverUrl']=intUtil[_0xccc0('0x49')](_0x20f55a[_0xccc0('0x4a')]);if(_0x9dd23f&&_0x9dd23f[_0xccc0('0x4b')]){logger[_0xccc0('0xc')](_0xccc0('0x4c'),_0xccc0('0x4d'));_0x3a2149[_0xccc0('0x4e')]=util['format'](_0xccc0('0x4f'),_0x20f55a[_0xccc0('0x4a')],_0x3a2149[_0xccc0('0x50')],md5(_0x3a2149[_0xccc0('0x50')]));}else{_0x3a2149['recordingURL']='';}headers[_0xccc0('0x51')]=getAuth(_0x20f55a);return getUser(_0x20f55a,_0x48e0e9['email'])[_0xccc0('0x1d')](function(_0x3e70b9){_0x14b92f=_0x3e70b9;logger['info']('The\x20User\x20ID\x20is:',_0x14b92f['id']);return getEndUser(_0x20f55a,_0x3a2149[_0xccc0('0x52')],_0x3a2149[_0xccc0('0x53')]);})[_0xccc0('0x1d')](function(_0x221285){_0x215a7b=_0x221285;logger[_0xccc0('0xc')](_0xccc0('0x54'),_0x215a7b['id']);return getTicket(_0x20f55a,_0x14b92f,_0x215a7b,_0x72e623,_0x3a2149);})[_0xccc0('0x1d')](function(_0x225579){if(_0x225579){logger[_0xccc0('0xc')]('The\x20Ticket\x20ID\x20is:',_0x225579['id']);switch(_0x20f55a[_0xccc0('0x3d')]){case _0xccc0('0x55'):logger[_0xccc0('0xc')](_0xccc0('0x4c'),_0xccc0('0x56'));return request({'uri':util[_0xccc0('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x20f55a['remoteUri'],_0x14b92f['id'],_0x225579['id']),'method':_0xccc0('0xf')});case _0xccc0('0x57'):logger['info'](_0xccc0('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xccc0('0xe')](_0xccc0('0x58'),_0x48e0e9[_0xccc0('0x12')]),_0xccc0('0x59'),{'uri':util[_0xccc0('0xe')](_0xccc0('0x5a'),_0x20f55a['remoteUri']['replace']('/api/v2',''),_0x225579['id'])});break;default:logger['error'](_0xccc0('0x4c'),_0xccc0('0x5b'));}}})['catch'](function(_0x30991f){logger[_0xccc0('0x5c')](_0xccc0('0x5d'),util[_0xccc0('0x5e')](_0x30991f,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5297c7,_0x5ccfe0,_0x41f9d9,_0x20cbb4,_0x91f04e,_0xf413f0,_0x5511c2){var _0x4fcfa9,_0x4f7017;_0xf413f0[_0xccc0('0x1c')]=intUtil[_0xccc0('0x49')](_0xf413f0['remoteUri']);_0xf413f0[_0xccc0('0x4a')]=intUtil[_0xccc0('0x49')](_0xf413f0[_0xccc0('0x4a')]);if(_0x5511c2&&_0x5511c2['recordingFormat']&&_0x5511c2[_0xccc0('0x5f')]!==_0xccc0('0x60')){logger[_0xccc0('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5ccfe0[_0xccc0('0x4e')]=util[_0xccc0('0xe')](_0xccc0('0x4f'),_0xf413f0[_0xccc0('0x4a')],_0x5ccfe0[_0xccc0('0x50')],md5(_0x5ccfe0['uniqueid']));}headers[_0xccc0('0x51')]=getAuth(_0xf413f0);return getUser(_0xf413f0,_0x20cbb4[_0xccc0('0x61')])[_0xccc0('0x1d')](function(_0x4db7a){_0x4fcfa9=_0x4db7a;logger[_0xccc0('0xc')](_0xccc0('0x62'),_0x4fcfa9['id']);return getEndUser(_0xf413f0,_0x5ccfe0[_0xccc0('0x63')],_0x5ccfe0[_0xccc0('0x64')]);})[_0xccc0('0x1d')](function(_0x1a0f6f){_0x4f7017=_0x1a0f6f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4f7017['id']);return getTicket(_0xf413f0,_0x4fcfa9,_0x4f7017,_0x41f9d9,_0x5ccfe0);})[_0xccc0('0x1d')](function(_0x34a9d5){if(_0x34a9d5){logger['info'](_0xccc0('0x65'),_0x34a9d5['id']);switch(_0xf413f0['type']){case _0xccc0('0x55'):logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xccc0('0xe')](_0xccc0('0x66'),_0xf413f0['remoteUri'],_0x4fcfa9['id'],_0x34a9d5['id']),'method':'POST'});case _0xccc0('0x57'):logger[_0xccc0('0xc')](_0xccc0('0x67'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xccc0('0x58'),_0x20cbb4[_0xccc0('0x12')]),'trigger:browser:url',{'uri':util['format'](_0xccc0('0x5a'),_0xf413f0[_0xccc0('0x1c')][_0xccc0('0x68')](_0xccc0('0x69'),''),_0x34a9d5['id'])});break;default:logger[_0xccc0('0x5c')](_0xccc0('0x67'),_0xccc0('0x5b'));}}})[_0xccc0('0x6a')](function(_0x4c9bd5){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x4c9bd5,{'showHidden':!![],'depth':null}));});};exports[_0xccc0('0x6b')]=function(_0x1e52ed,_0xb5e58,_0x4c7e45,_0x592228,_0x535fef,_0x179661){var _0x5682c5,_0xda7330;_0x179661[_0xccc0('0x1c')]=intUtil[_0xccc0('0x49')](_0x179661[_0xccc0('0x1c')]);_0x179661['serverUrl']=intUtil['stripTrailingSlash'](_0x179661[_0xccc0('0x4a')]);if(_0x535fef&&_0x535fef[_0xccc0('0x4b')]){logger[_0xccc0('0xc')]('['+_0xb5e58[_0xccc0('0x6c')][_0xccc0('0x6d')]()+']',_0xccc0('0x4d'));_0xb5e58[_0xccc0('0x4e')]=util[_0xccc0('0xe')](_0xccc0('0x4f'),_0x179661['serverUrl'],_0xb5e58[_0xccc0('0x50')],md5(_0xb5e58[_0xccc0('0x50')]));}else{_0xb5e58[_0xccc0('0x4e')]='';}headers[_0xccc0('0x51')]=getAuth(_0x179661);return getUser(_0x179661)['then'](function(_0x5578da){_0x5682c5=_0x5578da;logger[_0xccc0('0xc')](_0xccc0('0x62'),_0x5682c5['id']);return getEndUser(_0x179661,_0xb5e58[_0xccc0('0x52')],_0xb5e58[_0xccc0('0x53')]);})['then'](function(_0x16329a){_0xda7330=_0x16329a;logger['info'](_0xccc0('0x54'),_0xda7330['id']);return getTicket(_0x179661,_0x5682c5,_0xda7330,_0x4c7e45,_0xb5e58);})[_0xccc0('0x1d')](function(_0xcd83d6){if(_0xcd83d6){logger[_0xccc0('0xc')]('The\x20Ticket\x20ID\x20is:',_0xcd83d6['id']);}})[_0xccc0('0x6a')](function(_0x227db4){logger['error']('['+_0xb5e58[_0xccc0('0x6c')][_0xccc0('0x6d')]()+']'+_0xccc0('0x6e'),util['inspect'](_0x227db4,{'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 1e3b5af..dea4496 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 _0x3ace=['CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Creating\x20new\x20call...','Subjects','Description','getString','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','connect','Answered','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','queue','stripTrailingSlash','host','serverUrl','monitor_format','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','recordingURL','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','toUpperCase','request-promise','md5','util','ioredis','bluebird','../../../../config/environment','zoho','redis','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientSecret','refresh_token','then','add','seconds','catch','error','stack','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','log'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3ace,0xda));var _0xe3ac=function(_0x693c8b,_0x162bb5){_0x693c8b=_0x693c8b-0x0;var _0x2e5221=_0x3ace[_0x693c8b];return _0x2e5221;};'use strict';var _=require('lodash');var rp=require(_0xe3ac('0x0'));var md5=require(_0xe3ac('0x1'));var util=require(_0xe3ac('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0xe3ac('0x3'));var BPromise=require(_0xe3ac('0x4'));var config=require(_0xe3ac('0x5'));var logger=require('../../../../config/logger')(_0xe3ac('0x6'));config['redis']=_['defaults'](config[_0xe3ac('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xe3ac('0x8'))(new Redis(config['redis']));function emit(_0x345e51,_0x26eeed,_0x15f13f){io['to'](_0x345e51)[_0xe3ac('0x9')](_0x26eeed,_0x15f13f);}function request(_0x29ba64){logger['debug'](_0xe3ac('0xa'),JSON[_0xe3ac('0xb')](_0x29ba64));return rp(_0x29ba64);}function getCustomFields(_0x1000f8,_0x50fbee){var _0x2b1934={};if(_0x1000f8[_0xe3ac('0xc')]>0x0){_[_0xe3ac('0xd')](_0x1000f8,function(_0x1463fc){if(_0x1463fc[_0xe3ac('0xe')]===_0xe3ac('0xf')&&_0x1463fc[_0xe3ac('0x10')]){_0x2b1934[_0x1463fc[_0xe3ac('0x10')]]=_0x1463fc[_0xe3ac('0x11')][_0xe3ac('0x12')]();}else if(_0x1463fc[_0xe3ac('0xe')]===_0xe3ac('0x13')&&_0x1463fc[_0xe3ac('0x14')]&&_0x1463fc[_0xe3ac('0x10')]&&_0x50fbee[_0x1463fc[_0xe3ac('0x14')]]){_0x2b1934[_0x1463fc[_0xe3ac('0x10')]]=_0x50fbee[_0x1463fc[_0xe3ac('0x14')]]['toString']();}else if(_0x1463fc[_0xe3ac('0xe')]===_0xe3ac('0x15')&&_0x1463fc[_0xe3ac('0x16')]&&_0x1463fc['Variable']['name']&&_0x1463fc[_0xe3ac('0x10')]&&_0x50fbee[_0x1463fc['Variable'][_0xe3ac('0x17')][_0xe3ac('0x18')]()]){_0x2b1934[_0x1463fc['idField']]=_0x50fbee[_0x1463fc[_0xe3ac('0x16')]['name'][_0xe3ac('0x18')]()]['toString']();}});}return _0x2b1934;}function getName(_0x22f661){if(_0x22f661[_0xe3ac('0x19')]('\x20')>0x0){var _0x18508d=_0x22f661[_0xe3ac('0x1a')](/ (.+)/);if(_0x18508d[0x1]){return _0x18508d;}}return[_0x22f661,_0x22f661];}var accountsTokens={};function getAccessToken(_0x3834f9){return new Promise(function(_0xbc852e,_0x5635b7){if(!_[_0xe3ac('0x1b')](accountsTokens[_0x3834f9['id']])&&!_[_0xe3ac('0x1b')](accountsTokens[_0x3834f9['id']]['access_token'])){if(moment()[_0xe3ac('0x1c')](accountsTokens[_0x3834f9['id']][_0xe3ac('0x1d')])){_0xbc852e(accountsTokens[_0x3834f9['id']][_0xe3ac('0x1e')]);}}var _0x1b9983;switch(_0x3834f9[_0xe3ac('0x1f')]){case'US':_0x1b9983='https://accounts.zoho.com';break;case'AU':_0x1b9983=_0xe3ac('0x20');break;case'EU':_0x1b9983=_0xe3ac('0x21');break;case'IN':_0x1b9983=_0xe3ac('0x22');break;case'CN':_0x1b9983=_0xe3ac('0x23');break;default:_0x1b9983='https://accounts.zoho.eu';break;}var _0x20a8ac={'method':_0xe3ac('0x24'),'uri':_0x1b9983+'/oauth/v2/token','qs':{'refresh_token':_0x3834f9[_0xe3ac('0x25')],'client_id':_0x3834f9['clientId'],'client_secret':_0x3834f9[_0xe3ac('0x26')],'grant_type':_0xe3ac('0x27')},'json':!![]};return rp(_0x20a8ac)[_0xe3ac('0x28')](function(_0xd87134){accountsTokens[_0x3834f9['id']]={'access_token':_0xd87134[_0xe3ac('0x1e')],'expires_in':moment()[_0xe3ac('0x29')](_0xd87134['expires_in'],_0xe3ac('0x2a'))};_0xbc852e(_0xd87134['access_token']);})[_0xe3ac('0x2b')](function(_0x1090d2){logger[_0xe3ac('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x1090d2[_0xe3ac('0x2d')]);_0x5635b7(_0x1090d2);});});}function getUser(_0x223827,_0x21cddd,_0x3c9c36,_0x2fbe11){logger['info'](_0xe3ac('0x2e'));return request({'method':_0xe3ac('0x2f'),'uri':util[_0xe3ac('0x30')]('https://www.zohoapis.%s/crm/v2/users',_0x21cddd),'qs':{'type':_0xe3ac('0x31')},'headers':{'Authorization':_0xe3ac('0x32')+_0x223827},'json':!![]})['then'](function(_0x222a40){if(_0x222a40[_0xe3ac('0x33')]){var _0x31ccb7=-0x1;if(_['isArrayLikeObject'](_0x222a40['users'])){if(!_[_0xe3ac('0x1b')](_0x2fbe11)){_0x31ccb7=_[_0xe3ac('0x34')](_0x222a40[_0xe3ac('0x33')],function(_0x2a86f9){return _0x2a86f9[_0xe3ac('0x35')]===_0x2fbe11;});}if(_0x31ccb7>=0x0){logger[_0xe3ac('0x36')](_0xe3ac('0x37'));}else{logger[_0xe3ac('0x36')](_0xe3ac('0x38'));_0x31ccb7=_['findIndex'](_0x222a40[_0xe3ac('0x33')],function(_0x3325e1){return _0x3325e1[_0xe3ac('0x39')][_0xe3ac('0x17')]===_0xe3ac('0x3a');});}return _0x222a40[_0xe3ac('0x33')][_0x31ccb7];}else{if(_0x222a40['user'][_0xe3ac('0x39')][_0xe3ac('0x17')]===_0xe3ac('0x3a')){logger[_0xe3ac('0x36')](_0xe3ac('0x38'));user=_0x222a40[_0xe3ac('0x3b')];return user;}else{logger[_0xe3ac('0x2c')]('The\x20failing\x20result\x20is',JSON[_0xe3ac('0xb')](_0x222a40));throw new Error(_0xe3ac('0x3c')+JSON[_0xe3ac('0xb')](_0x222a40));}}}else{logger['error'](_0xe3ac('0x3d'),JSON[_0xe3ac('0xb')](_0x222a40));throw new Error(_0xe3ac('0x3c')+JSON[_0xe3ac('0xb')](_0x222a40));}})[_0xe3ac('0x2b')](function(_0x48badc){console[_0xe3ac('0x2c')](_0x48badc);});}function getZohoUser(_0x4be11e,_0x68a477){return new BPromise(function(_0x320a06,_0x62e371){request(_0x4be11e)[_0xe3ac('0x28')](function(_0x3831fb){var _0x2ea042=null;if(_0x3831fb){_0x2ea042=_0x3831fb[_0xe3ac('0x3e')][0x0];_0x2ea042['enduserType']=_0x68a477;}_0x320a06(_0x2ea042);})[_0xe3ac('0x2b')](function(_0x2c8ba6){_0x62e371(_0x2c8ba6);});});}function createEndUser(_0x5e191e,_0xa079a5,_0x6231f0,_0x4f317c,_0x163653,_0xe438b3){var _0x6231f0=getName(_0x6231f0);return request({'method':_0xe3ac('0x24'),'uri':'https://www.zohoapis.'+_0xa079a5+'/crm/v2/'+_[_0xe3ac('0x3f')](_0xe438b3[_0xe3ac('0x40')])+'s','body':{'data':[{'Last_Name':_0x6231f0[0x1],'First_Name':_0x6231f0[0x0],'Phone':_0x4f317c,'Owner':{'name':!_[_0xe3ac('0x1b')](_0x163653['role'][_0xe3ac('0x17')])?_0x163653[_0xe3ac('0x41')][_0xe3ac('0x17')]:!_[_0xe3ac('0x1b')](_0x163653[_0xe3ac('0x42')])?_0x163653[_0xe3ac('0x42')]+'\x20'+_0x163653[_0xe3ac('0x43')]:_0x163653['last_name'],'id':_0x163653['id']}}]},'headers':{'Authorization':_0xe3ac('0x32')+_0x5e191e},'json':!![]})['then'](function(_0x244566){if(_0x244566&&_0x244566[_0xe3ac('0x3e')][0x0][_0xe3ac('0x44')]===_0xe3ac('0x45')){var _0x4454f0=_0x244566[_0xe3ac('0x3e')][0x0][_0xe3ac('0x46')];_0x4454f0[_0xe3ac('0x47')]=_['startCase'](_0xe438b3[_0xe3ac('0x40')])+'s';return _0x4454f0;}logger[_0xe3ac('0x2c')](_0xe3ac('0x3d'),JSON['stringify'](data));throw new Error(_0xe3ac('0x48')+JSON[_0xe3ac('0xb')](data));})['catch'](function(_0x4f3135){console[_0xe3ac('0x49')](_0xe3ac('0x4a'),_0x4f3135);});}function getEndUser(_0xe78248,_0x420bcf,_0x4cd692,_0x5e5205,_0x31d5b2,_0xdf883d,_0x5b6f18){var _0xcbee52={'method':_0xe3ac('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xe78248},'json':!![]};switch(_0x5b6f18[_0xe3ac('0x4b')]){case _0xe3ac('0x4c'):_0xcbee52[_0xe3ac('0x4d')]=_0xe3ac('0x4e')+_0x420bcf+_0xe3ac('0x4f')+_0x31d5b2+'))';return getZohoUser(_0xcbee52,_0xe3ac('0x50'))[_0xe3ac('0x28')](function(_0x58b965){if(_0x58b965)return _0x58b965;_0xcbee52[_0xe3ac('0x4d')]=_0xe3ac('0x4e')+_0x420bcf+_0xe3ac('0x51')+_0x31d5b2+'))';return getZohoUser(_0xcbee52,_0xe3ac('0x52'))[_0xe3ac('0x28')](function(_0xf276d0){if(_0xf276d0)return _0xf276d0;if(_0x5b6f18[_0xe3ac('0x40')]!='nothing'){return createEndUser(_0xe78248,_0x420bcf,_0x5e5205,_0x31d5b2,_0xdf883d,_0x5b6f18);}else{return{};}});});break;case'contact':_0xcbee52['uri']=_0xe3ac('0x4e')+_0x420bcf+_0xe3ac('0x4f')+_0x31d5b2+'))';return getZohoUser(_0xcbee52,_0xe3ac('0x50'))[_0xe3ac('0x28')](function(_0x6c7c0a){if(_0x6c7c0a)return _0x6c7c0a;if(_0x5b6f18[_0xe3ac('0x40')]!='nothing'){return createEndUser(_0xe78248,_0x420bcf,_0x5e5205,_0x31d5b2,_0xdf883d,_0x5b6f18);}else{return{};}});break;case'lead':_0xcbee52[_0xe3ac('0x4d')]='https://www.zohoapis.'+_0x420bcf+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x31d5b2+'))';return getZohoUser(_0xcbee52,_0xe3ac('0x52'))[_0xe3ac('0x28')](function(_0x5f072a){if(_0x5f072a)return _0x5f072a;if(_0x5b6f18[_0xe3ac('0x40')]!=_0xe3ac('0x53')){return createEndUser(_0xe78248,_0x420bcf,_0x5e5205,_0x31d5b2,_0xdf883d,_0x5b6f18);}else{return{};}});break;}}function getCall(_0x322f4a,_0x368f5d,_0x3e0090,_0x2ab8b4,_0x5c1477,_0x2ca56a,_0x5e7087,_0x361964){logger[_0xe3ac('0x36')](_0xe3ac('0x54'));var _0x4918ef={};_0x4918ef['Owner']={'name':!_['isNil'](_0x2ab8b4[_0xe3ac('0x41')][_0xe3ac('0x17')])&&!_[_0xe3ac('0x1b')](_0x2ab8b4[_0xe3ac('0x39')]['name'])&&_0x2ab8b4[_0xe3ac('0x39')][_0xe3ac('0x17')]==='administrator'?_0x2ab8b4[_0xe3ac('0x41')][_0xe3ac('0x17')]:!_[_0xe3ac('0x1b')](_0x2ab8b4[_0xe3ac('0x42')])?_0x2ab8b4['first_name']+'\x20'+_0x2ab8b4['last_name']:_0x2ab8b4[_0xe3ac('0x43')],'id':_0x2ab8b4['id']};_0x4918ef['Subject']=intUtil['getString'](_0x2ca56a[_0xe3ac('0x55')],_0x5e7087,'\x20');_0x4918ef[_0xe3ac('0x56')]=intUtil[_0xe3ac('0x57')](_0x2ca56a['Descriptions'],_0x5e7087,'\x0a');if(_0x5c1477[_0xe3ac('0x47')]==='Contacts'){_0x4918ef[_0xe3ac('0x58')]={'name':!_[_0xe3ac('0x1b')](_0x5c1477[_0xe3ac('0x59')])?_0x5c1477['Full_Name']:!_[_0xe3ac('0x1b')](_0x5c1477['First_Name'])?_0x5c1477[_0xe3ac('0x5a')]+'\x20'+_0x5c1477[_0xe3ac('0x5b')]:_0x5c1477[_0xe3ac('0x5b')],'id':_0x5c1477['id']};}if(_0x5c1477[_0xe3ac('0x47')]===_0xe3ac('0x52')){_0x4918ef['What_Id']={'name':!_['isNil'](_0x5c1477[_0xe3ac('0x59')])?_0x5c1477['Full_Name']:!_[_0xe3ac('0x1b')](_0x5c1477[_0xe3ac('0x5a')])?_0x5c1477[_0xe3ac('0x5a')]+'\x20'+_0x5c1477['Last_Name']:_0x5c1477[_0xe3ac('0x5b')],'id':_0x5c1477['id']};_0x4918ef[_0xe3ac('0x5c')]=_[_0xe3ac('0x3f')](_0x5c1477[_0xe3ac('0x47')]);}if(_0x5e7087[_0xe3ac('0x5d')]){_0x4918ef[_0xe3ac('0x5e')]=moment[_0xe3ac('0x5f')](parseInt(_0x5e7087[_0xe3ac('0x5d')])*0x3e8)[_0xe3ac('0x30')](_0xe3ac('0x60'));}else if(_0x5e7087[_0xe3ac('0x61')]&&_0x5e7087[_0xe3ac('0x62')]){_0x4918ef[_0xe3ac('0x5e')]=moment[_0xe3ac('0x5f')](moment(_0x5e7087[_0xe3ac('0x62')],_0xe3ac('0x63'))[_0xe3ac('0x64')](moment(_0x5e7087[_0xe3ac('0x65')],_0xe3ac('0x63'))))[_0xe3ac('0x30')]('mm:ss');}switch(_0x5e7087[_0xe3ac('0x66')]){case'called':_0x4918ef[_0xe3ac('0x67')]=_0xe3ac('0x68');break;case'complete':case _0xe3ac('0x69'):_0x4918ef[_0xe3ac('0x67')]=_0xe3ac('0x6a');break;case'rejected':_0x4918ef['Call_Result']='Rejected';break;case _0xe3ac('0x6b'):_0x4918ef['Call_Result']=_0xe3ac('0x6c');break;case _0xe3ac('0x6d'):_0x4918ef[_0xe3ac('0x67')]='Timeout';default:}_0x4918ef[_0xe3ac('0x6e')]=(_0x361964===_0xe3ac('0x6f')?moment(_0x5e7087[_0xe3ac('0x65')])['format'](_0xe3ac('0x63')):moment(_0x5e7087[_0xe3ac('0x70')])[_0xe3ac('0x30')](_0xe3ac('0x63')))||moment()[_0xe3ac('0x30')]('YYYY-MM-DDTHH:mm:ss');_0x4918ef[_0xe3ac('0x71')]=_0x361964||_0xe3ac('0x72');_0x4918ef=_['merge'](_0x4918ef,getCustomFields(_0x2ca56a[_0xe3ac('0x73')],_0x5e7087));return request({'method':_0xe3ac('0x24'),'uri':_0xe3ac('0x4e')+_0x368f5d+_0xe3ac('0x74'),'headers':{'Authorization':_0xe3ac('0x32')+_0x322f4a},'body':{'data':[_0x4918ef]},'json':!![]})['then'](function(_0x4c9055){if(_0x4c9055&&_0x4c9055[_0xe3ac('0x3e')][0x0]['code']===_0xe3ac('0x45')){logger['info'](_0xe3ac('0x75'));return{'id':_0x4c9055[_0xe3ac('0x3e')][0x0][_0xe3ac('0x46')]['id']};}})['catch'](function(_0x1a43cc){logger[_0xe3ac('0x36')]('err',_0x1a43cc['stack']);console['log']('err',_0x1a43cc);});}exports[_0xe3ac('0x76')]=function(_0x2d24f9,_0x9a7f35,_0x468a11,_0x64cd82,_0x43c552,_0xb7d95b){var _0x3534f4,_0x4186b1,_0x392ef9;_0xb7d95b['host']=intUtil[_0xe3ac('0x77')](_0xb7d95b[_0xe3ac('0x78')]);_0xb7d95b['serverUrl']=intUtil[_0xe3ac('0x77')](_0xb7d95b[_0xe3ac('0x79')]);if(_0x43c552&&_0x43c552[_0xe3ac('0x7a')]){logger[_0xe3ac('0x36')]('[QUEUE]','Recording\x20is\x20enabled!');_0x9a7f35['recordingURL']=_0xb7d95b['serverUrl']+_0xe3ac('0x7b')+_0x9a7f35['uniqueid']+_0xe3ac('0x7c')+md5(_0x9a7f35[_0xe3ac('0x7d')]);}else{_0x9a7f35[_0xe3ac('0x7e')]='';}var _0x28a4a3=_0xb7d95b[_0xe3ac('0x78')]===_0xe3ac('0x7f')?'eu':_0xe3ac('0x80');return getAccessToken(_0xb7d95b)['then'](function(_0x257051){_0x392ef9=_0x257051;return getUser(_0x392ef9,_0x28a4a3,_0xb7d95b,_0x64cd82['email']);})['then'](function(_0x370f33){_0x3534f4=_0x370f33;logger['info']('The\x20User\x20ID\x20is:',_0x3534f4['id']);return getEndUser(_0x392ef9,_0x28a4a3,_0xb7d95b,_0x9a7f35[_0xe3ac('0x81')],_0x9a7f35[_0xe3ac('0x82')],_0x3534f4,_0x468a11);})[_0xe3ac('0x28')](function(_0x35f2c9){_0x4186b1=_0x35f2c9;return getCall(_0x392ef9,_0x28a4a3,_0xb7d95b,_0x3534f4,_0x4186b1,_0x468a11,_0x9a7f35,_0xe3ac('0x72'));})[_0xe3ac('0x28')](function(_0x4aa781){if(_0x4aa781){logger['info'](_0xe3ac('0x83'),_0x4aa781['id']);logger['info'](_0xe3ac('0x84'),_0xe3ac('0x85'));emit(util[_0xe3ac('0x30')](_0xe3ac('0x86'),_0x64cd82[_0xe3ac('0x17')]),_0xe3ac('0x87'),{'uri':_0xe3ac('0x88')+_0xb7d95b[_0xe3ac('0x78')]+_0xe3ac('0x89')+_0x4aa781['id']});}})[_0xe3ac('0x2b')](function(_0x5c10f7){logger['error'](_0xe3ac('0x84'),JSON[_0xe3ac('0xb')](_0x5c10f7));});};exports[_0xe3ac('0x6f')]=function(_0x443e64,_0x125507,_0x42c758,_0x10d055,_0x40788b,_0x1055b6,_0x463364){var _0x47a758,_0x47d204,_0x590e3b;_0x1055b6[_0xe3ac('0x78')]=intUtil[_0xe3ac('0x77')](_0x1055b6['host']);_0x1055b6[_0xe3ac('0x79')]=intUtil[_0xe3ac('0x77')](_0x1055b6[_0xe3ac('0x79')]);if(_0x463364&&_0x463364[_0xe3ac('0x8a')]&&_0x463364[_0xe3ac('0x8a')]!==_0xe3ac('0x8b')){logger['info'](_0xe3ac('0x8c'),_0xe3ac('0x8d'));_0x125507['recordingURL']=_0x1055b6[_0xe3ac('0x79')]+_0xe3ac('0x7b')+_0x125507[_0xe3ac('0x7d')]+_0xe3ac('0x7c')+md5(_0x125507[_0xe3ac('0x7d')]);}var _0x452017=_0x1055b6[_0xe3ac('0x78')]===_0xe3ac('0x7f')?'eu':_0xe3ac('0x80');return getAccessToken(_0x1055b6)[_0xe3ac('0x28')](function(_0x51da68){_0x590e3b=_0x51da68;return getUser(_0x590e3b,_0x452017,_0x1055b6,_0x10d055['email']);})['then'](function(_0x2176bb){_0x47a758=_0x2176bb;logger[_0xe3ac('0x36')](_0xe3ac('0x8e'),_0x47a758['id']);return getEndUser(_0x590e3b,_0x452017,_0x1055b6,_0x125507[_0xe3ac('0x8f')],_0x125507[_0xe3ac('0x90')],_0x47a758,_0x42c758);})[_0xe3ac('0x28')](function(_0x1d2607){_0x47d204=_0x1d2607;return getCall(_0x590e3b,_0x452017,_0x1055b6,_0x47a758,_0x47d204,_0x42c758,_0x125507,'Outbound');})[_0xe3ac('0x28')](function(_0x53b153){if(_0x53b153){logger[_0xe3ac('0x36')](_0xe3ac('0x83'),_0x53b153['id']);logger[_0xe3ac('0x36')]('[OUTBOUND]',_0xe3ac('0x85'));emit(util['format'](_0xe3ac('0x86'),_0x10d055[_0xe3ac('0x17')]),'trigger:browser:url',{'uri':'https://crm.'+_0x1055b6[_0xe3ac('0x78')]+_0xe3ac('0x89')+_0x53b153['id']});}})['catch'](function(_0x25a8de){logger['error'](_0xe3ac('0x8c'),JSON['stringify'](_0x25a8de));});};exports['unmanaged']=function(_0x543418,_0x38e54f,_0x3907bf,_0x5684c2,_0x335524,_0x1758a4){var _0x42508a,_0x26d338,_0x1e6f09;_0x1758a4[_0xe3ac('0x78')]=intUtil[_0xe3ac('0x77')](_0x1758a4[_0xe3ac('0x78')]);_0x1758a4[_0xe3ac('0x79')]=intUtil['stripTrailingSlash'](_0x1758a4['serverUrl']);if(_0x335524&&_0x335524['monitor_format']){logger['info']('['+_0x38e54f[_0xe3ac('0x66')][_0xe3ac('0x91')]()+']',_0xe3ac('0x8d'));_0x38e54f['recordingURL']=_0x1758a4[_0xe3ac('0x79')]+_0xe3ac('0x7b')+_0x38e54f[_0xe3ac('0x7d')]+_0xe3ac('0x7c')+md5(_0x38e54f['uniqueid']);}else{_0x38e54f['recordingURL']='';}var _0x3735b3=_0x1758a4[_0xe3ac('0x78')]===_0xe3ac('0x7f')?'eu':_0xe3ac('0x80');return getAccessToken(_0x1758a4)[_0xe3ac('0x28')](function(_0x15609f){_0x1e6f09=_0x15609f;return getUser(_0x1e6f09,_0x3735b3,_0x1758a4);})[_0xe3ac('0x28')](function(_0x30673d){_0x42508a=_0x30673d;logger['info'](_0xe3ac('0x8e'),_0x42508a['id']);return getEndUser(_0x1e6f09,_0x3735b3,_0x1758a4,_0x38e54f[_0xe3ac('0x81')],_0x38e54f[_0xe3ac('0x82')],_0x42508a,_0x3907bf);})[_0xe3ac('0x28')](function(_0x5bf5b6){_0x26d338=_0x5bf5b6;return getCall(_0x1e6f09,_0x3735b3,_0x1758a4,_0x42508a,_0x26d338,_0x3907bf,_0x38e54f,_0xe3ac('0x72'));})['then'](function(_0x16f951){if(_0x16f951){logger[_0xe3ac('0x36')](_0xe3ac('0x83'),_0x16f951['id']);}})[_0xe3ac('0x2b')](function(_0x3af87b){logger[_0xe3ac('0x2c')]('['+_0x38e54f[_0xe3ac('0x66')][_0xe3ac('0x91')]()+']',JSON[_0xe3ac('0xb')](_0x3af87b));});}; \ No newline at end of file +var _0xa88f=['Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','answertime','Call_Duration','diff','starttime','YYYY-MM-DDTHH:mm:ss','called','Called','complete','connect','Call_Result','Answered','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','unmanaged','lastevent','lodash','request-promise','md5','util','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','debug','[HTTP]','stringify','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientSecret','refresh_token','seconds','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','isArrayLikeObject','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','catch','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details'];(function(_0x5d8694,_0x12b8c2){var _0x442111=function(_0x52f1eb){while(--_0x52f1eb){_0x5d8694['push'](_0x5d8694['shift']());}};_0x442111(++_0x12b8c2);}(_0xa88f,0x182));var _0xfa88=function(_0x4ddc3b,_0xaad91){_0x4ddc3b=_0x4ddc3b-0x0;var _0x3c1589=_0xa88f[_0x4ddc3b];return _0x3c1589;};'use strict';var _=require(_0xfa88('0x0'));var rp=require(_0xfa88('0x1'));var md5=require(_0xfa88('0x2'));var util=require(_0xfa88('0x3'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0xfa88('0x4'));var BPromise=require(_0xfa88('0x5'));var config=require('../../../../config/environment');var logger=require(_0xfa88('0x6'))(_0xfa88('0x7'));config[_0xfa88('0x8')]=_[_0xfa88('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfa88('0x8')]));function emit(_0x2ea42f,_0x196c63,_0x33893f){io['to'](_0x2ea42f)['emit'](_0x196c63,_0x33893f);}function request(_0x47d446){logger[_0xfa88('0xa')](_0xfa88('0xb'),JSON[_0xfa88('0xc')](_0x47d446));return rp(_0x47d446);}function getCustomFields(_0x4b375c,_0x1d8487){var _0x102d10={};if(_0x4b375c['length']>0x0){_[_0xfa88('0xd')](_0x4b375c,function(_0x2607e9){if(_0x2607e9[_0xfa88('0xe')]===_0xfa88('0xf')&&_0x2607e9[_0xfa88('0x10')]){_0x102d10[_0x2607e9[_0xfa88('0x10')]]=_0x2607e9['content'][_0xfa88('0x11')]();}else if(_0x2607e9['type']===_0xfa88('0x12')&&_0x2607e9['variableName']&&_0x2607e9[_0xfa88('0x10')]&&_0x1d8487[_0x2607e9[_0xfa88('0x13')]]){_0x102d10[_0x2607e9['idField']]=_0x1d8487[_0x2607e9[_0xfa88('0x13')]][_0xfa88('0x11')]();}else if(_0x2607e9['type']===_0xfa88('0x14')&&_0x2607e9[_0xfa88('0x15')]&&_0x2607e9[_0xfa88('0x15')][_0xfa88('0x16')]&&_0x2607e9['idField']&&_0x1d8487[_0x2607e9[_0xfa88('0x15')][_0xfa88('0x16')][_0xfa88('0x17')]()]){_0x102d10[_0x2607e9[_0xfa88('0x10')]]=_0x1d8487[_0x2607e9[_0xfa88('0x15')][_0xfa88('0x16')]['toLowerCase']()][_0xfa88('0x11')]();}});}return _0x102d10;}function getName(_0xa7fe06){if(_0xa7fe06[_0xfa88('0x18')]('\x20')>0x0){var _0x4d1489=_0xa7fe06[_0xfa88('0x19')](/ (.+)/);if(_0x4d1489[0x1]){return _0x4d1489;}}return[_0xa7fe06,_0xa7fe06];}var accountsTokens={};function getAccessToken(_0x46cd8c){return new Promise(function(_0x5a225e,_0x1e6897){if(!_[_0xfa88('0x1a')](accountsTokens[_0x46cd8c['id']])&&!_['isNil'](accountsTokens[_0x46cd8c['id']][_0xfa88('0x1b')])){if(moment()[_0xfa88('0x1c')](accountsTokens[_0x46cd8c['id']][_0xfa88('0x1d')])){_0x5a225e(accountsTokens[_0x46cd8c['id']]['access_token']);}}var _0x5191af;switch(_0x46cd8c[_0xfa88('0x1e')]){case'US':_0x5191af=_0xfa88('0x1f');break;case'AU':_0x5191af=_0xfa88('0x20');break;case'EU':_0x5191af='https://accounts.zoho.eu';break;case'IN':_0x5191af=_0xfa88('0x21');break;case'CN':_0x5191af=_0xfa88('0x22');break;default:_0x5191af='https://accounts.zoho.eu';break;}var _0x5eb8d1={'method':'POST','uri':_0x5191af+_0xfa88('0x23'),'qs':{'refresh_token':_0x46cd8c['refreshToken'],'client_id':_0x46cd8c['clientId'],'client_secret':_0x46cd8c[_0xfa88('0x24')],'grant_type':_0xfa88('0x25')},'json':!![]};return rp(_0x5eb8d1)['then'](function(_0x43f834){accountsTokens[_0x46cd8c['id']]={'access_token':_0x43f834[_0xfa88('0x1b')],'expires_in':moment()['add'](_0x43f834[_0xfa88('0x1d')],_0xfa88('0x26'))};_0x5a225e(_0x43f834[_0xfa88('0x1b')]);})['catch'](function(_0x25023f){logger[_0xfa88('0x27')]('Failing\x20creating\x20the\x20access_token',_0x25023f[_0xfa88('0x28')]);_0x1e6897(_0x25023f);});});}function getUser(_0x90ef74,_0x13b87b,_0x584e7b,_0x30ca6c){logger[_0xfa88('0x29')](_0xfa88('0x2a'));return request({'method':_0xfa88('0x2b'),'uri':util[_0xfa88('0x2c')](_0xfa88('0x2d'),_0x13b87b),'qs':{'type':_0xfa88('0x2e')},'headers':{'Authorization':_0xfa88('0x2f')+_0x90ef74},'json':!![]})[_0xfa88('0x30')](function(_0x25a4d4){if(_0x25a4d4['users']){var _0x18eb45=-0x1;if(_[_0xfa88('0x31')](_0x25a4d4[_0xfa88('0x32')])){if(!_[_0xfa88('0x1a')](_0x30ca6c)){_0x18eb45=_[_0xfa88('0x33')](_0x25a4d4['users'],function(_0x369f7e){return _0x369f7e['email']===_0x30ca6c;});}if(_0x18eb45>=0x0){logger[_0xfa88('0x29')](_0xfa88('0x34'));}else{logger['info'](_0xfa88('0x35'));_0x18eb45=_[_0xfa88('0x33')](_0x25a4d4['users'],function(_0xfff8d3){return _0xfff8d3[_0xfa88('0x36')][_0xfa88('0x16')]===_0xfa88('0x37');});}return _0x25a4d4[_0xfa88('0x32')][_0x18eb45];}else{if(_0x25a4d4['user'][_0xfa88('0x36')][_0xfa88('0x16')]===_0xfa88('0x37')){logger['info'](_0xfa88('0x35'));user=_0x25a4d4[_0xfa88('0x38')];return user;}else{logger[_0xfa88('0x27')](_0xfa88('0x39'),JSON[_0xfa88('0xc')](_0x25a4d4));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xfa88('0xc')](_0x25a4d4));}}}else{logger[_0xfa88('0x27')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x25a4d4));throw new Error(_0xfa88('0x3a')+JSON[_0xfa88('0xc')](_0x25a4d4));}})['catch'](function(_0xe38b98){console['error'](_0xe38b98);});}function getZohoUser(_0x354ccc,_0x367564){return new BPromise(function(_0x5b0fbd,_0x2fc3c9){request(_0x354ccc)[_0xfa88('0x30')](function(_0x3f739a){var _0x104c0d=null;if(_0x3f739a){_0x104c0d=_0x3f739a['data'][0x0];_0x104c0d[_0xfa88('0x3b')]=_0x367564;}_0x5b0fbd(_0x104c0d);})[_0xfa88('0x3c')](function(_0x454e1f){_0x2fc3c9(_0x454e1f);});});}function createEndUser(_0x55d662,_0x101234,_0x4263ea,_0x3a7afc,_0xebe796,_0x3efbf4){var _0x4263ea=getName(_0x4263ea);return request({'method':_0xfa88('0x3d'),'uri':_0xfa88('0x3e')+_0x101234+_0xfa88('0x3f')+_[_0xfa88('0x40')](_0x3efbf4[_0xfa88('0x41')])+'s','body':{'data':[{'Last_Name':_0x4263ea[0x1],'First_Name':_0x4263ea[0x0],'Phone':_0x3a7afc,'Owner':{'name':!_[_0xfa88('0x1a')](_0xebe796[_0xfa88('0x42')]['name'])?_0xebe796['role'][_0xfa88('0x16')]:!_['isNil'](_0xebe796['first_name'])?_0xebe796[_0xfa88('0x43')]+'\x20'+_0xebe796[_0xfa88('0x44')]:_0xebe796[_0xfa88('0x44')],'id':_0xebe796['id']}}]},'headers':{'Authorization':_0xfa88('0x2f')+_0x55d662},'json':!![]})['then'](function(_0xf9105d){if(_0xf9105d&&_0xf9105d[_0xfa88('0x45')][0x0][_0xfa88('0x46')]===_0xfa88('0x47')){var _0x18a5cf=_0xf9105d[_0xfa88('0x45')][0x0][_0xfa88('0x48')];_0x18a5cf[_0xfa88('0x3b')]=_[_0xfa88('0x40')](_0x3efbf4[_0xfa88('0x41')])+'s';return _0x18a5cf;}logger[_0xfa88('0x27')]('The\x20failing\x20result\x20is',JSON[_0xfa88('0xc')](data));throw new Error(_0xfa88('0x49')+JSON[_0xfa88('0xc')](data));})['catch'](function(_0x3d0516){console[_0xfa88('0x4a')](_0xfa88('0x4b'),_0x3d0516);});}function getEndUser(_0x3385d2,_0x496b4b,_0xbc0238,_0x4348e6,_0x2ad0ac,_0x4653ad,_0x10bf81){var _0x25f87a={'method':_0xfa88('0x2b'),'uri':'','headers':{'Authorization':_0xfa88('0x2f')+_0x3385d2},'json':!![]};switch(_0x10bf81[_0xfa88('0x4c')]){case _0xfa88('0x4d'):_0x25f87a[_0xfa88('0x4e')]=_0xfa88('0x3e')+_0x496b4b+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2ad0ac+'))';return getZohoUser(_0x25f87a,_0xfa88('0x4f'))[_0xfa88('0x30')](function(_0x40c0af){if(_0x40c0af)return _0x40c0af;_0x25f87a[_0xfa88('0x4e')]=_0xfa88('0x3e')+_0x496b4b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2ad0ac+'))';return getZohoUser(_0x25f87a,_0xfa88('0x50'))[_0xfa88('0x30')](function(_0x3c0395){if(_0x3c0395)return _0x3c0395;if(_0x10bf81[_0xfa88('0x41')]!=_0xfa88('0x51')){return createEndUser(_0x3385d2,_0x496b4b,_0x4348e6,_0x2ad0ac,_0x4653ad,_0x10bf81);}else{return{};}});});break;case _0xfa88('0x52'):_0x25f87a[_0xfa88('0x4e')]=_0xfa88('0x3e')+_0x496b4b+_0xfa88('0x53')+_0x2ad0ac+'))';return getZohoUser(_0x25f87a,_0xfa88('0x4f'))[_0xfa88('0x30')](function(_0x55bce8){if(_0x55bce8)return _0x55bce8;if(_0x10bf81['moduleCreate']!=_0xfa88('0x51')){return createEndUser(_0x3385d2,_0x496b4b,_0x4348e6,_0x2ad0ac,_0x4653ad,_0x10bf81);}else{return{};}});break;case _0xfa88('0x54'):_0x25f87a['uri']=_0xfa88('0x3e')+_0x496b4b+_0xfa88('0x55')+_0x2ad0ac+'))';return getZohoUser(_0x25f87a,_0xfa88('0x50'))['then'](function(_0x25db4e){if(_0x25db4e)return _0x25db4e;if(_0x10bf81[_0xfa88('0x41')]!=_0xfa88('0x51')){return createEndUser(_0x3385d2,_0x496b4b,_0x4348e6,_0x2ad0ac,_0x4653ad,_0x10bf81);}else{return{};}});break;}}function getCall(_0x2f6f04,_0x9199e8,_0x4f916f,_0x4748af,_0xcef93e,_0x4a10f8,_0x3bf885,_0x3d16b5){logger[_0xfa88('0x29')](_0xfa88('0x56'));var _0x56f934={};_0x56f934[_0xfa88('0x57')]={'name':!_[_0xfa88('0x1a')](_0x4748af['role'][_0xfa88('0x16')])&&!_['isNil'](_0x4748af[_0xfa88('0x36')][_0xfa88('0x16')])&&_0x4748af['profile'][_0xfa88('0x16')]===_0xfa88('0x58')?_0x4748af[_0xfa88('0x42')][_0xfa88('0x16')]:!_[_0xfa88('0x1a')](_0x4748af['first_name'])?_0x4748af[_0xfa88('0x43')]+'\x20'+_0x4748af[_0xfa88('0x44')]:_0x4748af['last_name'],'id':_0x4748af['id']};_0x56f934[_0xfa88('0x59')]=intUtil[_0xfa88('0x5a')](_0x4a10f8[_0xfa88('0x5b')],_0x3bf885,'\x20');_0x56f934[_0xfa88('0x5c')]=intUtil[_0xfa88('0x5a')](_0x4a10f8[_0xfa88('0x5d')],_0x3bf885,'\x0a');if(_0xcef93e['enduserType']==='Contacts'){_0x56f934[_0xfa88('0x5e')]={'name':!_[_0xfa88('0x1a')](_0xcef93e[_0xfa88('0x5f')])?_0xcef93e['Full_Name']:!_[_0xfa88('0x1a')](_0xcef93e[_0xfa88('0x60')])?_0xcef93e[_0xfa88('0x60')]+'\x20'+_0xcef93e['Last_Name']:_0xcef93e[_0xfa88('0x61')],'id':_0xcef93e['id']};}if(_0xcef93e[_0xfa88('0x3b')]===_0xfa88('0x50')){_0x56f934[_0xfa88('0x62')]={'name':!_['isNil'](_0xcef93e[_0xfa88('0x5f')])?_0xcef93e['Full_Name']:!_[_0xfa88('0x1a')](_0xcef93e['First_Name'])?_0xcef93e[_0xfa88('0x60')]+'\x20'+_0xcef93e[_0xfa88('0x61')]:_0xcef93e[_0xfa88('0x61')],'id':_0xcef93e['id']};_0x56f934[_0xfa88('0x63')]=_[_0xfa88('0x40')](_0xcef93e[_0xfa88('0x3b')]);}if(_0x3bf885[_0xfa88('0x64')]){_0x56f934['Call_Duration']=moment[_0xfa88('0x65')](parseInt(_0x3bf885[_0xfa88('0x64')])*0x3e8)[_0xfa88('0x2c')](_0xfa88('0x66'));}else if(_0x3bf885[_0xfa88('0x67')]&&_0x3bf885['endtime']){_0x56f934[_0xfa88('0x68')]=moment[_0xfa88('0x65')](moment(_0x3bf885['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0xfa88('0x69')](moment(_0x3bf885[_0xfa88('0x6a')],_0xfa88('0x6b'))))['format']('mm:ss');}switch(_0x3bf885['lastevent']){case _0xfa88('0x6c'):_0x56f934['Call_Result']=_0xfa88('0x6d');break;case _0xfa88('0x6e'):case _0xfa88('0x6f'):_0x56f934[_0xfa88('0x70')]=_0xfa88('0x71');break;case'rejected':_0x56f934[_0xfa88('0x70')]='Rejected';break;case _0xfa88('0x72'):_0x56f934[_0xfa88('0x70')]=_0xfa88('0x73');break;case _0xfa88('0x74'):_0x56f934[_0xfa88('0x70')]=_0xfa88('0x75');default:}_0x56f934['Call_Start_Time']=(_0x3d16b5===_0xfa88('0x76')?moment(_0x3bf885[_0xfa88('0x6a')])['format'](_0xfa88('0x6b')):moment(_0x3bf885[_0xfa88('0x77')])[_0xfa88('0x2c')](_0xfa88('0x6b')))||moment()[_0xfa88('0x2c')](_0xfa88('0x6b'));_0x56f934[_0xfa88('0x78')]=_0x3d16b5||_0xfa88('0x79');_0x56f934=_[_0xfa88('0x7a')](_0x56f934,getCustomFields(_0x4a10f8['Fields'],_0x3bf885));return request({'method':'POST','uri':_0xfa88('0x3e')+_0x9199e8+_0xfa88('0x7b'),'headers':{'Authorization':_0xfa88('0x2f')+_0x2f6f04},'body':{'data':[_0x56f934]},'json':!![]})[_0xfa88('0x30')](function(_0x31415d){if(_0x31415d&&_0x31415d['data'][0x0]['code']===_0xfa88('0x47')){logger[_0xfa88('0x29')]('Call\x20created!');return{'id':_0x31415d['data'][0x0][_0xfa88('0x48')]['id']};}})['catch'](function(_0x569f9f){logger['info'](_0xfa88('0x7c'),_0x569f9f['stack']);console[_0xfa88('0x4a')](_0xfa88('0x7c'),_0x569f9f);});}exports[_0xfa88('0x7d')]=function(_0xa91137,_0x3c2fff,_0x24e7f5,_0x4657df,_0x55abe0,_0x2f008a){var _0x1ce1d1,_0x42baf3,_0x3bce9e;_0x2f008a[_0xfa88('0x7e')]=intUtil[_0xfa88('0x7f')](_0x2f008a[_0xfa88('0x7e')]);_0x2f008a[_0xfa88('0x80')]=intUtil[_0xfa88('0x7f')](_0x2f008a[_0xfa88('0x80')]);if(_0x55abe0&&_0x55abe0['monitor_format']){logger[_0xfa88('0x29')](_0xfa88('0x81'),_0xfa88('0x82'));_0x3c2fff[_0xfa88('0x83')]=_0x2f008a['serverUrl']+_0xfa88('0x84')+_0x3c2fff['uniqueid']+_0xfa88('0x85')+md5(_0x3c2fff[_0xfa88('0x86')]);}else{_0x3c2fff[_0xfa88('0x83')]='';}var _0xee8722=_0x2f008a[_0xfa88('0x7e')]===_0xfa88('0x87')?'eu':_0xfa88('0x88');return getAccessToken(_0x2f008a)[_0xfa88('0x30')](function(_0x2ef054){_0x3bce9e=_0x2ef054;return getUser(_0x3bce9e,_0xee8722,_0x2f008a,_0x4657df[_0xfa88('0x89')]);})[_0xfa88('0x30')](function(_0x4ac90c){_0x1ce1d1=_0x4ac90c;logger[_0xfa88('0x29')](_0xfa88('0x8a'),_0x1ce1d1['id']);return getEndUser(_0x3bce9e,_0xee8722,_0x2f008a,_0x3c2fff[_0xfa88('0x8b')],_0x3c2fff['calleridnum'],_0x1ce1d1,_0x24e7f5);})[_0xfa88('0x30')](function(_0x1eefad){_0x42baf3=_0x1eefad;return getCall(_0x3bce9e,_0xee8722,_0x2f008a,_0x1ce1d1,_0x42baf3,_0x24e7f5,_0x3c2fff,'Inbound');})[_0xfa88('0x30')](function(_0x199d62){if(_0x199d62){logger[_0xfa88('0x29')](_0xfa88('0x8c'),_0x199d62['id']);logger[_0xfa88('0x29')](_0xfa88('0x81'),_0xfa88('0x8d'));emit(util['format'](_0xfa88('0x8e'),_0x4657df[_0xfa88('0x16')]),_0xfa88('0x8f'),{'uri':_0xfa88('0x90')+_0x2f008a[_0xfa88('0x7e')]+_0xfa88('0x91')+_0x199d62['id']});}})[_0xfa88('0x3c')](function(_0x265141){logger[_0xfa88('0x27')](_0xfa88('0x81'),JSON[_0xfa88('0xc')](_0x265141));});};exports[_0xfa88('0x76')]=function(_0x4c73ac,_0x155266,_0x2cadb4,_0x279d98,_0x2c242b,_0x1a44a4,_0x4c41ba){var _0x2b5e5d,_0x5ca27f,_0x2fd270;_0x1a44a4[_0xfa88('0x7e')]=intUtil[_0xfa88('0x7f')](_0x1a44a4[_0xfa88('0x7e')]);_0x1a44a4['serverUrl']=intUtil['stripTrailingSlash'](_0x1a44a4[_0xfa88('0x80')]);if(_0x4c41ba&&_0x4c41ba[_0xfa88('0x92')]&&_0x4c41ba[_0xfa88('0x92')]!=='none'){logger[_0xfa88('0x29')](_0xfa88('0x93'),'Recording\x20is\x20enabled!');_0x155266['recordingURL']=_0x1a44a4[_0xfa88('0x80')]+_0xfa88('0x84')+_0x155266[_0xfa88('0x86')]+_0xfa88('0x85')+md5(_0x155266[_0xfa88('0x86')]);}var _0x104b72=_0x1a44a4[_0xfa88('0x7e')]==='zoho.eu'?'eu':_0xfa88('0x88');return getAccessToken(_0x1a44a4)[_0xfa88('0x30')](function(_0x158ebf){_0x2fd270=_0x158ebf;return getUser(_0x2fd270,_0x104b72,_0x1a44a4,_0x279d98[_0xfa88('0x89')]);})[_0xfa88('0x30')](function(_0x18e3bd){_0x2b5e5d=_0x18e3bd;logger[_0xfa88('0x29')]('The\x20User\x20ID\x20is:',_0x2b5e5d['id']);return getEndUser(_0x2fd270,_0x104b72,_0x1a44a4,_0x155266[_0xfa88('0x94')],_0x155266[_0xfa88('0x95')],_0x2b5e5d,_0x2cadb4);})[_0xfa88('0x30')](function(_0x6c294a){_0x5ca27f=_0x6c294a;return getCall(_0x2fd270,_0x104b72,_0x1a44a4,_0x2b5e5d,_0x5ca27f,_0x2cadb4,_0x155266,_0xfa88('0x96'));})[_0xfa88('0x30')](function(_0x3f916f){if(_0x3f916f){logger[_0xfa88('0x29')](_0xfa88('0x8c'),_0x3f916f['id']);logger[_0xfa88('0x29')]('[OUTBOUND]',_0xfa88('0x8d'));emit(util[_0xfa88('0x2c')](_0xfa88('0x8e'),_0x279d98[_0xfa88('0x16')]),_0xfa88('0x8f'),{'uri':_0xfa88('0x90')+_0x1a44a4[_0xfa88('0x7e')]+_0xfa88('0x91')+_0x3f916f['id']});}})['catch'](function(_0xbb750b){logger[_0xfa88('0x27')](_0xfa88('0x93'),JSON[_0xfa88('0xc')](_0xbb750b));});};exports[_0xfa88('0x97')]=function(_0x41eef7,_0x5d3b1f,_0x218ad8,_0x9f414d,_0x1ecff5,_0x2bb6b6){var _0x5ea5b2,_0x5ef767,_0x208502;_0x2bb6b6[_0xfa88('0x7e')]=intUtil['stripTrailingSlash'](_0x2bb6b6[_0xfa88('0x7e')]);_0x2bb6b6[_0xfa88('0x80')]=intUtil[_0xfa88('0x7f')](_0x2bb6b6[_0xfa88('0x80')]);if(_0x1ecff5&&_0x1ecff5['monitor_format']){logger[_0xfa88('0x29')]('['+_0x5d3b1f[_0xfa88('0x98')]['toUpperCase']()+']',_0xfa88('0x82'));_0x5d3b1f[_0xfa88('0x83')]=_0x2bb6b6[_0xfa88('0x80')]+_0xfa88('0x84')+_0x5d3b1f[_0xfa88('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x5d3b1f[_0xfa88('0x86')]);}else{_0x5d3b1f[_0xfa88('0x83')]='';}var _0x5ce2a8=_0x2bb6b6[_0xfa88('0x7e')]===_0xfa88('0x87')?'eu':'com';return getAccessToken(_0x2bb6b6)[_0xfa88('0x30')](function(_0x20e992){_0x208502=_0x20e992;return getUser(_0x208502,_0x5ce2a8,_0x2bb6b6);})[_0xfa88('0x30')](function(_0x1bcea3){_0x5ea5b2=_0x1bcea3;logger[_0xfa88('0x29')](_0xfa88('0x8a'),_0x5ea5b2['id']);return getEndUser(_0x208502,_0x5ce2a8,_0x2bb6b6,_0x5d3b1f[_0xfa88('0x8b')],_0x5d3b1f['calleridnum'],_0x5ea5b2,_0x218ad8);})[_0xfa88('0x30')](function(_0x491add){_0x5ef767=_0x491add;return getCall(_0x208502,_0x5ce2a8,_0x2bb6b6,_0x5ea5b2,_0x5ef767,_0x218ad8,_0x5d3b1f,_0xfa88('0x79'));})[_0xfa88('0x30')](function(_0x19ee2a){if(_0x19ee2a){logger[_0xfa88('0x29')](_0xfa88('0x8c'),_0x19ee2a['id']);}})['catch'](function(_0x4be774){logger[_0xfa88('0x27')]('['+_0x5d3b1f[_0xfa88('0x98')]['toUpperCase']()+']',JSON[_0xfa88('0xc')](_0x4be774));});}; \ 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 1fea9d3..23f2ebd 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(_0x5abe6c,_0x4ae51e){var _0x2f9a85=function(_0x2bddf4){while(--_0x2bddf4){_0x5abe6c['push'](_0x5abe6c['shift']());}};_0x2f9a85(++_0x4ae51e);}(_0x7a54,0x106));var _0x47a5=function(_0x1a8580,_0x2f0b36){_0x1a8580=_0x1a8580-0x0;var _0x5884f7=_0x7a54[_0x1a8580];return _0x5884f7;};'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(_0x5ee41d,_0x13f516){var _0x13d9a7=function(_0x3a07ef){while(--_0x3a07ef){_0x5ee41d['push'](_0x5ee41d['shift']());}};_0x13d9a7(++_0x13f516);}(_0x7a54,0x106));var _0x47a5=function(_0x7ce8e5,_0x11eb93){_0x7ce8e5=_0x7ce8e5-0x0;var _0x305726=_0x7a54[_0x7ce8e5];return _0x305726;};'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 58a1e4f..76e77dc 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(_0x6a25ed,_0x221264){var _0x313f85=function(_0xeb84c7){while(--_0xeb84c7){_0x6a25ed['push'](_0x6a25ed['shift']());}};_0x313f85(++_0x221264);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32b774,_0x785261){_0x32b774=_0x32b774-0x0;var _0x5f2ae3=_0x5f2f[_0x32b774];return _0x5f2ae3;};'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 _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x4abb65,_0x45844c){var _0x534d23=function(_0xce4874){while(--_0xce4874){_0x4abb65['push'](_0x4abb65['shift']());}};_0x534d23(++_0x45844c);}(_0x7a54,0x106));var _0x47a5=function(_0x4be92d,_0xc69633){_0x4be92d=_0x4be92d-0x0;var _0xad3eb5=_0x7a54[_0x4be92d];return _0xad3eb5;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 717f85e..298e85b 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 _0xac31=['debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then'];(function(_0x537a95,_0x32c06f){var _0x34ecbd=function(_0x3cfc82){while(--_0x3cfc82){_0x537a95['push'](_0x537a95['shift']());}};_0x34ecbd(++_0x32c06f);}(_0xac31,0xca));var _0x1ac3=function(_0x407a59,_0x36c702){_0x407a59=_0x407a59-0x0;var _0x36dd62=_0xac31[_0x407a59];return _0x36dd62;};'use strict';var jayson=require(_0x1ac3('0x0'));var BPromise=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var client=jayson[_0x1ac3('0x4')][_0x1ac3('0x5')]({'port':0x2329});client[_0x1ac3('0x6')]=function(_0x59b42c,_0x33b5ab){return new BPromise(function(_0x434b5e,_0x4dcc96){return client['request'](_0x59b42c,_0x33b5ab)[_0x1ac3('0x7')](function(_0x20027f){logger[_0x1ac3('0x8')](_0x1ac3('0x9'),_0x1ac3('0x3'),_0x59b42c,_0x33b5ab,_0x20027f);if(_0x20027f['error']){logger[_0x1ac3('0xa')]('rpc',_0x1ac3('0x3'),_0x59b42c,_0x20027f[_0x1ac3('0xa')][_0x1ac3('0xb')],_0x33b5ab);return _0x4dcc96(_0x20027f['error'][_0x1ac3('0xb')]);}else{return _0x434b5e(_0x20027f[_0x1ac3('0xc')]);}})[_0x1ac3('0xd')](function(_0x24f0d2){logger[_0x1ac3('0xa')](_0x1ac3('0x9'),'routing',_0x59b42c,_0x24f0d2,_0x33b5ab);return _0x4dcc96(_0x24f0d2);});});};module[_0x1ac3('0xe')]=client; \ No newline at end of file +var _0xecd5=['Request','then','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing','http'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xecd5,0x110));var _0x5ecd=function(_0x11d314,_0x3dea3f){_0x11d314=_0x11d314-0x0;var _0x9f1906=_0xecd5[_0x11d314];return _0x9f1906;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x5ecd('0x0'));var logger=require(_0x5ecd('0x1'))(_0x5ecd('0x2'));var client=jayson['client'][_0x5ecd('0x3')]({'port':0x2329});client[_0x5ecd('0x4')]=function(_0x469fd0,_0x458bb3){return new BPromise(function(_0x516d8e,_0x3995e5){return client['request'](_0x469fd0,_0x458bb3)[_0x5ecd('0x5')](function(_0x492eba){logger['debug'](_0x5ecd('0x6'),_0x5ecd('0x2'),_0x469fd0,_0x458bb3,_0x492eba);if(_0x492eba[_0x5ecd('0x7')]){logger[_0x5ecd('0x7')](_0x5ecd('0x6'),_0x5ecd('0x2'),_0x469fd0,_0x492eba[_0x5ecd('0x7')][_0x5ecd('0x8')],_0x458bb3);return _0x3995e5(_0x492eba[_0x5ecd('0x7')][_0x5ecd('0x8')]);}else{return _0x516d8e(_0x492eba[_0x5ecd('0x9')]);}})[_0x5ecd('0xa')](function(_0x5a8b1c){logger[_0x5ecd('0x7')]('rpc','routing',_0x469fd0,_0x5a8b1c,_0x458bb3);return _0x3995e5(_0x5a8b1c);});});};module[_0x5ecd('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 338421a..785e596 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 _0x975f=['resolve','then','initMailAccounts','refresh','mailAccounts','listen','Setting','loginMailFrequency','log','bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0x975f,0x191));var _0xf975=function(_0x13342f,_0x3d6303){_0x13342f=_0x13342f-0x0;var _0x2fc1fc=_0x975f[_0x13342f];return _0x2fc1fc;};'use strict';var BPromise=require(_0xf975('0x0'));var server=require('./server');var Realtime=require(_0xf975('0x1'));var EmailChannel=require(_0xf975('0x2'));var mailAccount=require(_0xf975('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xf975('0x4'))['db'];function initRealtime(){return BPromise[_0xf975('0x5')]()[_0xf975('0x6')](mailAccount['getMailAccounts']())[_0xf975('0x6')](realtime[_0xf975('0x7')]())['then'](function(){email[_0xf975('0x8')](realtime[_0xf975('0x9')]);return realtime;});}function main(){return server[_0xf975('0xa')](realtime,email)[_0xf975('0x6')](function(_0xe62d83){return initRealtime();})[_0xf975('0x6')](function(_0x5d5860){return db[_0xf975('0xb')]['findOne']({'attributes':['id',_0xf975('0xc')],'raw':!![]});})['then'](function(_0x32e936){return setInterval(initRealtime,_0x32e936[_0xf975('0xc')]*0x3e8);})['catch'](function(_0x472fc7){console[_0xf975('0xd')](_0x472fc7);});}main(); \ No newline at end of file +var _0xe574=['bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','Setting','findOne','loginMailFrequency','catch','log'];(function(_0x122152,_0x6e61fe){var _0x2eaf9e=function(_0x56802a){while(--_0x56802a){_0x122152['push'](_0x122152['shift']());}};_0x2eaf9e(++_0x6e61fe);}(_0xe574,0x100));var _0x4e57=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xe574[_0x4b055c];return _0x4b62bb;};'use strict';var BPromise=require(_0x4e57('0x0'));var server=require('./server');var Realtime=require(_0x4e57('0x1'));var EmailChannel=require(_0x4e57('0x2'));var mailAccount=require(_0x4e57('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x4e57('0x4'))['db'];function initRealtime(){return BPromise[_0x4e57('0x5')]()[_0x4e57('0x6')](mailAccount[_0x4e57('0x7')]())[_0x4e57('0x6')](realtime[_0x4e57('0x8')]())[_0x4e57('0x6')](function(){email[_0x4e57('0x9')](realtime[_0x4e57('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(_0x12ec74){return initRealtime();})['then'](function(_0x5274e7){return db[_0x4e57('0xb')][_0x4e57('0xc')]({'attributes':['id',_0x4e57('0xd')],'raw':!![]});})[_0x4e57('0x6')](function(_0x26a43d){return setInterval(initRealtime,_0x26a43d['loginMailFrequency']*0x3e8);})[_0x4e57('0xe')](function(_0x2dbdd5){console[_0x4e57('0xf')](_0x2dbdd5);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 3ca57a6..cfee8e1 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 _0xaf5a=['handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','Smtp','verify','verified','lodash','moment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','Imap','status','messageStatus','isNil','stringify','md5','mailAccount:update','refresh','box'];(function(_0x5d6280,_0x3f72ab){var _0x77b738=function(_0x1b8208){while(--_0x1b8208){_0x5d6280['push'](_0x5d6280['shift']());}};_0x77b738(++_0x3f72ab);}(_0xaf5a,0x84));var _0xaaf5=function(_0x227b64,_0x1c6f72){_0x227b64=_0x227b64-0x0;var _0xc84cb5=_0xaf5a[_0x227b64];return _0xc84cb5;};'use strict';var _=require(_0xaaf5('0x0'));var moment=require(_0xaaf5('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xaaf5('0x2'))(_0xaaf5('0x3'));config['redis']=_[_0xaaf5('0x4')](config[_0xaaf5('0x5')],{'host':_0xaaf5('0x6'),'port':0x18eb});var io=require(_0xaaf5('0x7'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0xaaf5('0x8'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3d4738){logger[_0xaaf5('0x9')](_0xaaf5('0xa'));this[_0xaaf5('0xb')]=_0x3d4738[_0xaaf5('0xb')];this[_0xaaf5('0xc')]={};this[_0xaaf5('0xd')]=new EmailSmtp();}EmailChannel[_0xaaf5('0xe')][_0xaaf5('0xf')]=function(_0x162d85){var _0xbaf24b=this['mailAccounts'][_0x162d85];var _0x124374={'id':_0xbaf24b['id'],'name':_0xbaf24b[_0xaaf5('0x10')],'key':_0xbaf24b['key'],'active':_0xbaf24b[_0xaaf5('0x11')],'Imap':{'status':_0xbaf24b[_0xaaf5('0x12')][_0xaaf5('0x13')],'messageStatus':_0xbaf24b['Imap'][_0xaaf5('0x14')],'total':_0xbaf24b['Imap']['total']}};if(_[_0xaaf5('0x15')](md5Accounts[_0x162d85])){md5Accounts[_0x162d85]={};}var _0xa07459=md5(JSON[_0xaaf5('0x16')](_0x124374));if(md5Accounts[_0x162d85][_0xaaf5('0x17')]!==_0xa07459){md5Accounts[_0x162d85]['md5']=_0xa07459;io[_0xaaf5('0xf')](_0xaaf5('0x18'),_0x124374);}};EmailChannel[_0xaaf5('0xe')][_0xaaf5('0x19')]=function(_0x71acc9){for(var _0x368b98 in _0x71acc9){if(_0x71acc9['hasOwnProperty'](_0x368b98)){if(_0x71acc9[_0x368b98][_0xaaf5('0x12')]&&_0x71acc9[_0x368b98][_0xaaf5('0x11')]){var _0x16471e=_0x71acc9[_0x368b98][_0xaaf5('0x12')];if(!this['imapAccounts']['hasOwnProperty'](_0x16471e['id'])){this['imapAccounts'][_0x16471e['id']]=new EmailImap(_0x16471e,_0x71acc9[_0x368b98]['email']);this[_0xaaf5('0xc')][_0x16471e['id']]['on'](_0xaaf5('0x1a'),this[_0xaaf5('0x1b')][_0xaaf5('0x1c')](this,_0x368b98));this[_0xaaf5('0xc')][_0x16471e['id']]['on'](_0xaaf5('0x3'),this[_0xaaf5('0x1d')][_0xaaf5('0x1c')](this,_0x368b98));this[_0xaaf5('0xc')][_0x16471e['id']]['on'](_0xaaf5('0x1e'),this[_0xaaf5('0x1f')][_0xaaf5('0x1c')](this,_0x368b98));this[_0xaaf5('0xc')][_0x16471e['id']]['on'](_0xaaf5('0x20'),this[_0xaaf5('0x21')][_0xaaf5('0x1c')](this,_0x368b98));}}else{if(_[_0xaaf5('0x15')](this[_0xaaf5('0xb')][_0x368b98][_0xaaf5('0x12')])){this[_0xaaf5('0xb')][_0x368b98]['Imap']={};}this[_0xaaf5('0xb')][_0x368b98][_0xaaf5('0x12')][_0xaaf5('0x13')]=_0xaaf5('0x22');this[_0xaaf5('0xb')][_0x368b98][_0xaaf5('0x12')][_0xaaf5('0x14')]='';this[_0xaaf5('0xf')](_0x368b98);}}}};EmailChannel[_0xaaf5('0xe')]['handleImapBox']=function(_0x245485,_0x50beb5){if(this['mailAccounts'][_0x245485]){this[_0xaaf5('0xb')][_0x245485][_0xaaf5('0x12')][_0xaaf5('0x13')]=_0xaaf5('0x23');this[_0xaaf5('0xb')][_0x245485][_0xaaf5('0x12')][_0xaaf5('0x14')]=_0x50beb5[_0xaaf5('0x10')];if(_0x50beb5[_0xaaf5('0x24')]){this[_0xaaf5('0xb')][_0x245485]['Imap'][_0xaaf5('0x25')]=_0x50beb5[_0xaaf5('0x24')][_0xaaf5('0x25')];}return this[_0xaaf5('0xf')](_0x245485);}};EmailChannel['prototype'][_0xaaf5('0x1d')]=function(_0x288722,_0xc5a2be){logger['info'](_0xaaf5('0x26'),_0xc5a2be[_0xaaf5('0x27')],_0xc5a2be[_0xaaf5('0x28')],_0xc5a2be[_0xaaf5('0x29')],_0x288722);if(this[_0xaaf5('0xb')][_0x288722]){return mailAccount[_0xaaf5('0x2a')](_0x288722,_0xc5a2be)[_0xaaf5('0x2b')](function(_0x2b8b63){if(_0x2b8b63){logger[_0xaaf5('0x9')](_0xaaf5('0x2c'));}})[_0xaaf5('0x2d')](function(_0x26dc30){logger[_0xaaf5('0x20')](_0xaaf5('0x2e'),JSON['stringify'](_0x26dc30));});}};EmailChannel[_0xaaf5('0xe')][_0xaaf5('0x1f')]=function(_0x479e95){if(this['mailAccounts'][_0x479e95]&&this['mailAccounts'][_0x479e95]['Imap']){if(this[_0xaaf5('0xc')][this[_0xaaf5('0xb')][_0x479e95][_0xaaf5('0x12')]['id']]){delete this[_0xaaf5('0xc')][this[_0xaaf5('0xb')][_0x479e95][_0xaaf5('0x12')]['id']];}this[_0xaaf5('0xb')][_0x479e95][_0xaaf5('0x12')][_0xaaf5('0x2f')]=moment();this['emit'](_0x479e95);}};EmailChannel[_0xaaf5('0xe')][_0xaaf5('0x21')]=function(_0x101b22,_0x388061){if(this[_0xaaf5('0xb')][_0x101b22]){this[_0xaaf5('0xb')][_0x101b22][_0xaaf5('0x12')][_0xaaf5('0x13')]=_0xaaf5('0x20');this[_0xaaf5('0xb')][_0x101b22][_0xaaf5('0x12')][_0xaaf5('0x14')]=_0x388061;return this['emit'](_0x101b22);}};EmailChannel[_0xaaf5('0xe')]['sendMail']=function(_0x286b48,_0x1c2fb0){return this[_0xaaf5('0xd')][_0xaaf5('0x30')](_0x286b48,_0x1c2fb0);};EmailChannel[_0xaaf5('0xe')][_0xaaf5('0x31')]=function(_0x198f49){var _0x26d4d9=this;if(this['mailAccounts'][_0x198f49['id']]){if(_[_0xaaf5('0x15')](this[_0xaaf5('0xb')][_0x198f49['id']][_0xaaf5('0x32')])){this[_0xaaf5('0xb')][_0x198f49['id']][_0xaaf5('0x32')]={};}this[_0xaaf5('0xb')][_0x198f49['id']][_0xaaf5('0x32')][_0xaaf5('0x2f')]=moment();return new BPromise(function(_0x32d774,_0x4e977e){return _0x26d4d9[_0xaaf5('0xd')][_0xaaf5('0x33')](_0x198f49)['then'](function(_0x4d83ed){_0x26d4d9[_0xaaf5('0xb')][_0x198f49['id']][_0xaaf5('0x32')][_0xaaf5('0x13')]=_0xaaf5('0x34');_0x26d4d9['mailAccounts'][_0x198f49['id']][_0xaaf5('0x32')][_0xaaf5('0x14')]='';_0x26d4d9[_0xaaf5('0xf')](_0x198f49['id']);_0x32d774(_0x4d83ed);})['catch'](function(_0x5024be){_0x26d4d9[_0xaaf5('0xb')][_0x198f49['id']][_0xaaf5('0x32')][_0xaaf5('0x13')]='error';_0x26d4d9[_0xaaf5('0xb')][_0x198f49['id']][_0xaaf5('0x32')][_0xaaf5('0x14')]=_0x5024be;_0x26d4d9[_0xaaf5('0xf')](_0x198f49['id']);_0x4e977e(_0x5024be);});});}return this['smtp'][_0xaaf5('0x33')](_0x198f49);};module['exports']=EmailChannel; \ No newline at end of file +var _0x70e0=['key','active','Imap','status','messageStatus','total','isNil','stringify','refresh','hasOwnProperty','email','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','then','verify','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','./imap','./smtp','info','mailAccounts','imapAccounts','smtp','prototype','emit','name'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x70e0,0x101));var _0x070e=function(_0x479eb4,_0x46b8eb){_0x479eb4=_0x479eb4-0x0;var _0x12a9e7=_0x70e0[_0x479eb4];return _0x12a9e7;};'use strict';var _=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var BPromise=require('bluebird');var md5=require(_0x070e('0x2'));var Redis=require(_0x070e('0x3'));var config=require(_0x070e('0x4'));var logger=require(_0x070e('0x5'))('email');config[_0x070e('0x6')]=_['defaults'](config[_0x070e('0x6')],{'host':_0x070e('0x7'),'port':0x18eb});var io=require(_0x070e('0x8'))(new Redis(config[_0x070e('0x6')]));var EmailImap=require(_0x070e('0x9'));var EmailSmtp=require(_0x070e('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4793b3){logger[_0x070e('0xb')]('start\x20email\x20channel');this[_0x070e('0xc')]=_0x4793b3[_0x070e('0xc')];this[_0x070e('0xd')]={};this[_0x070e('0xe')]=new EmailSmtp();}EmailChannel[_0x070e('0xf')][_0x070e('0x10')]=function(_0x547252){var _0x3d7156=this[_0x070e('0xc')][_0x547252];var _0x430a75={'id':_0x3d7156['id'],'name':_0x3d7156[_0x070e('0x11')],'key':_0x3d7156[_0x070e('0x12')],'active':_0x3d7156[_0x070e('0x13')],'Imap':{'status':_0x3d7156[_0x070e('0x14')][_0x070e('0x15')],'messageStatus':_0x3d7156[_0x070e('0x14')][_0x070e('0x16')],'total':_0x3d7156['Imap'][_0x070e('0x17')]}};if(_[_0x070e('0x18')](md5Accounts[_0x547252])){md5Accounts[_0x547252]={};}var _0x48d422=md5(JSON[_0x070e('0x19')](_0x430a75));if(md5Accounts[_0x547252][_0x070e('0x2')]!==_0x48d422){md5Accounts[_0x547252][_0x070e('0x2')]=_0x48d422;io['emit']('mailAccount:update',_0x430a75);}};EmailChannel[_0x070e('0xf')][_0x070e('0x1a')]=function(_0x3bc782){for(var _0xeb6b60 in _0x3bc782){if(_0x3bc782[_0x070e('0x1b')](_0xeb6b60)){if(_0x3bc782[_0xeb6b60][_0x070e('0x14')]&&_0x3bc782[_0xeb6b60]['active']){var _0x17edac=_0x3bc782[_0xeb6b60][_0x070e('0x14')];if(!this[_0x070e('0xd')][_0x070e('0x1b')](_0x17edac['id'])){this['imapAccounts'][_0x17edac['id']]=new EmailImap(_0x17edac,_0x3bc782[_0xeb6b60][_0x070e('0x1c')]);this[_0x070e('0xd')][_0x17edac['id']]['on'](_0x070e('0x1d'),this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0xeb6b60));this[_0x070e('0xd')][_0x17edac['id']]['on'](_0x070e('0x1c'),this[_0x070e('0x20')][_0x070e('0x1f')](this,_0xeb6b60));this[_0x070e('0xd')][_0x17edac['id']]['on'](_0x070e('0x21'),this['handleImapEnd'][_0x070e('0x1f')](this,_0xeb6b60));this['imapAccounts'][_0x17edac['id']]['on'](_0x070e('0x22'),this[_0x070e('0x23')][_0x070e('0x1f')](this,_0xeb6b60));}}else{if(_[_0x070e('0x18')](this[_0x070e('0xc')][_0xeb6b60][_0x070e('0x14')])){this[_0x070e('0xc')][_0xeb6b60]['Imap']={};}this[_0x070e('0xc')][_0xeb6b60][_0x070e('0x14')][_0x070e('0x15')]='disabled';this['mailAccounts'][_0xeb6b60][_0x070e('0x14')]['messageStatus']='';this[_0x070e('0x10')](_0xeb6b60);}}}};EmailChannel[_0x070e('0xf')]['handleImapBox']=function(_0x3ace92,_0x48cc13){if(this[_0x070e('0xc')][_0x3ace92]){this['mailAccounts'][_0x3ace92][_0x070e('0x14')][_0x070e('0x15')]=_0x070e('0x24');this[_0x070e('0xc')][_0x3ace92][_0x070e('0x14')][_0x070e('0x16')]=_0x48cc13[_0x070e('0x11')];if(_0x48cc13[_0x070e('0x25')]){this[_0x070e('0xc')][_0x3ace92][_0x070e('0x14')][_0x070e('0x17')]=_0x48cc13['messages'][_0x070e('0x17')];}return this[_0x070e('0x10')](_0x3ace92);}};EmailChannel[_0x070e('0xf')]['handleImapEmail']=function(_0x569223,_0x3415df){logger[_0x070e('0xb')](_0x070e('0x26'),_0x3415df[_0x070e('0x27')],_0x3415df[_0x070e('0x28')],_0x3415df[_0x070e('0x29')],_0x569223);if(this[_0x070e('0xc')][_0x569223]){return mailAccount[_0x070e('0x2a')](_0x569223,_0x3415df)['then'](function(_0x577296){if(_0x577296){logger[_0x070e('0xb')](_0x070e('0x2b'));}})[_0x070e('0x2c')](function(_0x4f3cb8){logger[_0x070e('0x22')](_0x070e('0x2d'),JSON[_0x070e('0x19')](_0x4f3cb8));});}};EmailChannel[_0x070e('0xf')][_0x070e('0x2e')]=function(_0x5e1861){if(this['mailAccounts'][_0x5e1861]&&this[_0x070e('0xc')][_0x5e1861][_0x070e('0x14')]){if(this[_0x070e('0xd')][this['mailAccounts'][_0x5e1861][_0x070e('0x14')]['id']]){delete this[_0x070e('0xd')][this[_0x070e('0xc')][_0x5e1861][_0x070e('0x14')]['id']];}this[_0x070e('0xc')][_0x5e1861][_0x070e('0x14')][_0x070e('0x2f')]=moment();this['emit'](_0x5e1861);}};EmailChannel['prototype'][_0x070e('0x23')]=function(_0x4b71d6,_0x53a5c6){if(this[_0x070e('0xc')][_0x4b71d6]){this['mailAccounts'][_0x4b71d6]['Imap'][_0x070e('0x15')]=_0x070e('0x22');this['mailAccounts'][_0x4b71d6][_0x070e('0x14')][_0x070e('0x16')]=_0x53a5c6;return this[_0x070e('0x10')](_0x4b71d6);}};EmailChannel['prototype'][_0x070e('0x30')]=function(_0x529568,_0x57e59b){return this['smtp'][_0x070e('0x31')](_0x529568,_0x57e59b);};EmailChannel[_0x070e('0xf')][_0x070e('0x32')]=function(_0x83092a){var _0x189bc5=this;if(this[_0x070e('0xc')][_0x83092a['id']]){if(_[_0x070e('0x18')](this[_0x070e('0xc')][_0x83092a['id']][_0x070e('0x33')])){this['mailAccounts'][_0x83092a['id']][_0x070e('0x33')]={};}this[_0x070e('0xc')][_0x83092a['id']][_0x070e('0x33')][_0x070e('0x2f')]=moment();return new BPromise(function(_0x266b3d,_0x4a567b){return _0x189bc5[_0x070e('0xe')]['verify'](_0x83092a)[_0x070e('0x34')](function(_0x2adfef){_0x189bc5[_0x070e('0xc')][_0x83092a['id']][_0x070e('0x33')]['status']='verified';_0x189bc5[_0x070e('0xc')][_0x83092a['id']][_0x070e('0x33')][_0x070e('0x16')]='';_0x189bc5[_0x070e('0x10')](_0x83092a['id']);_0x266b3d(_0x2adfef);})['catch'](function(_0x992fbd){_0x189bc5[_0x070e('0xc')][_0x83092a['id']][_0x070e('0x33')][_0x070e('0x15')]=_0x070e('0x22');_0x189bc5[_0x070e('0xc')][_0x83092a['id']][_0x070e('0x33')][_0x070e('0x16')]=_0x992fbd;_0x189bc5[_0x070e('0x10')](_0x83092a['id']);_0x4a567b(_0x992fbd);});});}return this[_0x070e('0xe')][_0x070e('0x35')](_0x83092a);};module[_0x070e('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 3ac6685..5fd35ce 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 _0xe010=['error','handleError','inherits','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','prototype','handleReady','openBox','handleOpenBox','box','readUnseen','handleCloseBox','end','handleReadUnseen','fetch','message','handleFetchError','handleFetchEnd','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','closeBox','stringify','textCode','path','lodash','randomstring','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','imap','ready','bind','once','handleEnd'];(function(_0x23075a,_0xa6e01d){var _0x1c4aee=function(_0x27c24b){while(--_0x27c24b){_0x23075a['push'](_0x23075a['shift']());}};_0x1c4aee(++_0xa6e01d);}(_0xe010,0x18a));var _0x0e01=function(_0x404db5,_0x3f723d){_0x404db5=_0x404db5-0x0;var _0x380a23=_0xe010[_0x404db5];return _0x380a23;};'use strict';var fs=require('fs');var path=require(_0x0e01('0x0'));var util=require('util');var Imap=require('imap');var _=require(_0x0e01('0x1'));var rs=require(_0x0e01('0x2'));var simpleParser=require(_0x0e01('0x3'))[_0x0e01('0x4')];var Iconv=require('iconv')[_0x0e01('0x5')];var EventEmitter=require(_0x0e01('0x6'))[_0x0e01('0x7')];var utils=require(_0x0e01('0x8'));var logger=require('../../../config/logger')(_0x0e01('0x9'));function EmailImap(_0x23ee3d,_0x2c7647){this[_0x0e01('0xa')]=_0x0e01('0xb');this[_0x0e01('0xc')]=this[_0x0e01('0xd')](_0x23ee3d,_0x2c7647);this['imap']=new Imap(this[_0x0e01('0xc')]);this[_0x0e01('0xe')]['once'](_0x0e01('0xf'),this['handleReady'][_0x0e01('0x10')](this));this['imap'][_0x0e01('0x11')]('end',this[_0x0e01('0x12')]['bind'](this));this[_0x0e01('0xe')]['on'](_0x0e01('0x13'),this[_0x0e01('0x14')]['bind'](this));this['imap']['connect']();}util[_0x0e01('0x15')](EmailImap,EventEmitter);EmailImap['prototype'][_0x0e01('0xd')]=function(_0x29c898,_0x4a39fd){var _0xa1b44a={'connTimeout':_0x29c898[_0x0e01('0x16')]?_0x29c898['connTimeout']*0x3e8:0x2710,'authTimeout':_0x29c898[_0x0e01('0x17')]?_0x29c898['authTimeout']*0x3e8:0x1388};if(_[_0x0e01('0x18')](_0x29c898[_0x0e01('0x19')])){if(_0x29c898['authentication']){_0xa1b44a['user']=_0x29c898[_0x0e01('0x1a')];_0xa1b44a[_0x0e01('0x1b')]=_0x29c898['password'];}_0xa1b44a[_0x0e01('0x1c')]=_0x29c898[_0x0e01('0x1c')];_0xa1b44a[_0x0e01('0x1d')]=_0x29c898[_0x0e01('0x1d')]||0x3e1;if(_0x29c898[_0x0e01('0x1e')]){_0xa1b44a[_0x0e01('0x1e')]=!![];}else{_0xa1b44a[_0x0e01('0x1e')]=![];_0xa1b44a[_0x0e01('0x1f')]=_0x0e01('0x20');}}else{_0xa1b44a[_0x0e01('0x1a')]=_0x29c898['user'];_0xa1b44a['password']=_0x29c898[_0x0e01('0x1b')];_0xa1b44a[_0x0e01('0x1c')]=utils[_0x0e01('0x21')](_0x29c898[_0x0e01('0x19')]);_0xa1b44a[_0x0e01('0x1d')]=0x3e1;_0xa1b44a[_0x0e01('0x1e')]=!![];}_0xa1b44a[_0x0e01('0x9')]=_0x4a39fd||_0x29c898[_0x0e01('0x1a')]||_0x0e01('0x22');return _0xa1b44a;};EmailImap[_0x0e01('0x23')][_0x0e01('0x24')]=function(){this[_0x0e01('0xe')][_0x0e01('0x25')](this[_0x0e01('0xa')],![],this['handleOpenBox'][_0x0e01('0x10')](this));};EmailImap[_0x0e01('0x23')][_0x0e01('0x26')]=function(_0x2ed6bc,_0x5b4ac6){if(_0x2ed6bc){this[_0x0e01('0x14')](_0x2ed6bc,!![]);}else{this['emit'](_0x0e01('0x27'),_0x5b4ac6);this[_0x0e01('0x28')]();}};EmailImap['prototype'][_0x0e01('0x29')]=function(_0x20447d){if(_0x20447d){this[_0x0e01('0x14')](_0x20447d,!![]);}else{this[_0x0e01('0xe')][_0x0e01('0x2a')]();}};EmailImap['prototype'][_0x0e01('0x28')]=function(){this[_0x0e01('0xe')]['search'](['UNSEEN'],this[_0x0e01('0x2b')]['bind'](this));};EmailImap[_0x0e01('0x23')]['handleReadUnseen']=function(_0x445ff5,_0x36363d){if(_0x445ff5){this[_0x0e01('0x14')](_0x445ff5,!![]);}else{if(_0x36363d['length']){try{var _0x2c7dd=this[_0x0e01('0xe')][_0x0e01('0x2c')](_0x36363d,{'bodies':'','markSeen':!![]});_0x2c7dd['on'](_0x0e01('0x2d'),this['handleFetchMessage'][_0x0e01('0x10')](this));_0x2c7dd[_0x0e01('0x11')](_0x0e01('0x13'),this[_0x0e01('0x2e')][_0x0e01('0x10')](this));_0x2c7dd[_0x0e01('0x11')](_0x0e01('0x2a'),this[_0x0e01('0x2f')][_0x0e01('0x10')](this));}catch(_0x24309b){logger[_0x0e01('0x13')](_0x24309b);}}else{this[_0x0e01('0xe')]['closeBox'](!![],this['handleCloseBox'][_0x0e01('0x10')](this));}}};EmailImap[_0x0e01('0x23')][_0x0e01('0x30')]=function(_0x3afbcf,_0x40fd16){_0x3afbcf['on'](_0x0e01('0x31'),this[_0x0e01('0x32')]['bind'](this));_0x3afbcf[_0x0e01('0x11')](_0x0e01('0x33'),this[_0x0e01('0x34')][_0x0e01('0x10')](this));_0x3afbcf[_0x0e01('0x11')]('end',this[_0x0e01('0x35')][_0x0e01('0x10')](this));};EmailImap[_0x0e01('0x23')][_0x0e01('0x32')]=function(_0x1427f3,_0x2252f4){simpleParser(_0x1427f3,{'Iconv':Iconv},this[_0x0e01('0x36')][_0x0e01('0x10')](this));};EmailImap['prototype'][_0x0e01('0x34')]=function(_0x703d4b){};EmailImap[_0x0e01('0x23')]['handleMessageEnd']=function(){};EmailImap[_0x0e01('0x23')]['handleSimpleParser']=function(_0x1d27c3,_0x1b1bef){if(_0x1d27c3){logger['error'](_0x1d27c3);}else{var _0x5126cd=this;utils['parser'](this['account'],_0x1b1bef,function(_0x187489){_0x5126cd[_0x0e01('0x37')](_0x0e01('0x9'),_0x187489);});}};EmailImap[_0x0e01('0x23')][_0x0e01('0x2f')]=function(){this['imap'][_0x0e01('0x38')](!![],this[_0x0e01('0x29')][_0x0e01('0x10')](this));};EmailImap[_0x0e01('0x23')][_0x0e01('0x2e')]=function(_0x5c2cc7){this[_0x0e01('0x14')](_0x5c2cc7);this['imap']['closeBox'](!![],this[_0x0e01('0x29')][_0x0e01('0x10')](this));};EmailImap[_0x0e01('0x23')][_0x0e01('0x12')]=function(){this[_0x0e01('0x37')](_0x0e01('0x2a'));};EmailImap[_0x0e01('0x23')][_0x0e01('0x14')]=function(_0xd7cc3a,_0x47836b){logger['error'](_0x0e01('0x14'),this['account'][_0x0e01('0x9')],JSON[_0x0e01('0x39')](_0xd7cc3a));var _0x338c04='';if(_0xd7cc3a){if(_0xd7cc3a[_0x0e01('0x3a')]){_0x338c04=_0xd7cc3a['textCode'];}else{for(var _0x294992 in _0xd7cc3a){if(_0xd7cc3a['hasOwnProperty'](_0x294992)){_0x338c04+=_['upperFirst'](_0x294992)+':\x20'+_0xd7cc3a[_0x294992]+'\x0a';}}}}if(_0x47836b){this[_0x0e01('0xe')][_0x0e01('0x2a')]();}else{this[_0x0e01('0x37')](_0x0e01('0x13'),_0x338c04);this[_0x0e01('0x37')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0x7d47=['./utils','email','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','prototype','connTimeout','authTimeout','user','password','host','port','tls','autotls','getHost','service','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','stringify','textCode','hasOwnProperty','upperFirst','util','imap','mailparser','simpleParser','iconv','Iconv','events'];(function(_0xafb36e,_0x538cf1){var _0x2623e3=function(_0x340010){while(--_0x340010){_0xafb36e['push'](_0xafb36e['shift']());}};_0x2623e3(++_0x538cf1);}(_0x7d47,0x149));var _0x77d4=function(_0x1501e4,_0x29d7b3){_0x1501e4=_0x1501e4-0x0;var _0x26f1cf=_0x7d47[_0x1501e4];return _0x26f1cf;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x77d4('0x0'));var Imap=require(_0x77d4('0x1'));var _=require('lodash');var rs=require('randomstring');var simpleParser=require(_0x77d4('0x2'))[_0x77d4('0x3')];var Iconv=require(_0x77d4('0x4'))[_0x77d4('0x5')];var EventEmitter=require(_0x77d4('0x6'))['EventEmitter'];var utils=require(_0x77d4('0x7'));var logger=require('../../../config/logger')(_0x77d4('0x8'));function EmailImap(_0x4a8006,_0x2b7ede){this['mailbox']='INBOX';this[_0x77d4('0x9')]=this[_0x77d4('0xa')](_0x4a8006,_0x2b7ede);this[_0x77d4('0x1')]=new Imap(this['account']);this['imap'][_0x77d4('0xb')](_0x77d4('0xc'),this[_0x77d4('0xd')][_0x77d4('0xe')](this));this['imap'][_0x77d4('0xb')](_0x77d4('0xf'),this[_0x77d4('0x10')][_0x77d4('0xe')](this));this['imap']['on'](_0x77d4('0x11'),this[_0x77d4('0x12')][_0x77d4('0xe')](this));this[_0x77d4('0x1')][_0x77d4('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x77d4('0x14')]['getAccount']=function(_0x4dd687,_0x4f7502){var _0x54d8dc={'connTimeout':_0x4dd687[_0x77d4('0x15')]?_0x4dd687['connTimeout']*0x3e8:0x2710,'authTimeout':_0x4dd687['authTimeout']?_0x4dd687[_0x77d4('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x4dd687['service'])){if(_0x4dd687['authentication']){_0x54d8dc[_0x77d4('0x17')]=_0x4dd687[_0x77d4('0x17')];_0x54d8dc[_0x77d4('0x18')]=_0x4dd687['password'];}_0x54d8dc[_0x77d4('0x19')]=_0x4dd687[_0x77d4('0x19')];_0x54d8dc[_0x77d4('0x1a')]=_0x4dd687[_0x77d4('0x1a')]||0x3e1;if(_0x4dd687['tls']){_0x54d8dc[_0x77d4('0x1b')]=!![];}else{_0x54d8dc[_0x77d4('0x1b')]=![];_0x54d8dc[_0x77d4('0x1c')]='required';}}else{_0x54d8dc['user']=_0x4dd687[_0x77d4('0x17')];_0x54d8dc['password']=_0x4dd687[_0x77d4('0x18')];_0x54d8dc[_0x77d4('0x19')]=utils[_0x77d4('0x1d')](_0x4dd687[_0x77d4('0x1e')]);_0x54d8dc[_0x77d4('0x1a')]=0x3e1;_0x54d8dc[_0x77d4('0x1b')]=!![];}_0x54d8dc[_0x77d4('0x8')]=_0x4f7502||_0x4dd687['user']||'anonymous@xcally.com';return _0x54d8dc;};EmailImap['prototype'][_0x77d4('0xd')]=function(){this['imap']['openBox'](this[_0x77d4('0x1f')],![],this[_0x77d4('0x20')][_0x77d4('0xe')](this));};EmailImap['prototype'][_0x77d4('0x20')]=function(_0x317d9c,_0x1f91b0){if(_0x317d9c){this[_0x77d4('0x12')](_0x317d9c,!![]);}else{this[_0x77d4('0x21')](_0x77d4('0x22'),_0x1f91b0);this[_0x77d4('0x23')]();}};EmailImap[_0x77d4('0x14')][_0x77d4('0x24')]=function(_0x738539){if(_0x738539){this['handleError'](_0x738539,!![]);}else{this['imap'][_0x77d4('0xf')]();}};EmailImap[_0x77d4('0x14')]['readUnseen']=function(){this[_0x77d4('0x1')]['search']([_0x77d4('0x25')],this[_0x77d4('0x26')][_0x77d4('0xe')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x957f63,_0x8c4aee){if(_0x957f63){this['handleError'](_0x957f63,!![]);}else{if(_0x8c4aee[_0x77d4('0x27')]){try{var _0x515d68=this[_0x77d4('0x1')]['fetch'](_0x8c4aee,{'bodies':'','markSeen':!![]});_0x515d68['on'](_0x77d4('0x28'),this[_0x77d4('0x29')][_0x77d4('0xe')](this));_0x515d68[_0x77d4('0xb')](_0x77d4('0x11'),this[_0x77d4('0x2a')][_0x77d4('0xe')](this));_0x515d68[_0x77d4('0xb')](_0x77d4('0xf'),this[_0x77d4('0x2b')][_0x77d4('0xe')](this));}catch(_0x1b10ba){logger[_0x77d4('0x11')](_0x1b10ba);}}else{this[_0x77d4('0x1')][_0x77d4('0x2c')](!![],this[_0x77d4('0x24')]['bind'](this));}}};EmailImap['prototype'][_0x77d4('0x29')]=function(_0xc0edd3,_0x4e6e76){_0xc0edd3['on'](_0x77d4('0x2d'),this[_0x77d4('0x2e')][_0x77d4('0xe')](this));_0xc0edd3[_0x77d4('0xb')](_0x77d4('0x2f'),this['handleMessageAttributes']['bind'](this));_0xc0edd3[_0x77d4('0xb')](_0x77d4('0xf'),this[_0x77d4('0x30')][_0x77d4('0xe')](this));};EmailImap[_0x77d4('0x14')]['handleMessageBody']=function(_0x102fa9,_0x59c3d4){simpleParser(_0x102fa9,{'Iconv':Iconv},this[_0x77d4('0x31')][_0x77d4('0xe')](this));};EmailImap[_0x77d4('0x14')][_0x77d4('0x32')]=function(_0xf91b97){};EmailImap[_0x77d4('0x14')][_0x77d4('0x30')]=function(){};EmailImap[_0x77d4('0x14')]['handleSimpleParser']=function(_0x661ddb,_0x22b21b){if(_0x661ddb){logger[_0x77d4('0x11')](_0x661ddb);}else{var _0x1bbb3e=this;utils[_0x77d4('0x33')](this[_0x77d4('0x9')],_0x22b21b,function(_0x7e2843){_0x1bbb3e[_0x77d4('0x21')](_0x77d4('0x8'),_0x7e2843);});}};EmailImap['prototype'][_0x77d4('0x2b')]=function(){this[_0x77d4('0x1')][_0x77d4('0x2c')](!![],this[_0x77d4('0x24')][_0x77d4('0xe')](this));};EmailImap[_0x77d4('0x14')][_0x77d4('0x2a')]=function(_0x56be13){this[_0x77d4('0x12')](_0x56be13);this[_0x77d4('0x1')][_0x77d4('0x2c')](!![],this['handleCloseBox'][_0x77d4('0xe')](this));};EmailImap[_0x77d4('0x14')][_0x77d4('0x10')]=function(){this[_0x77d4('0x21')](_0x77d4('0xf'));};EmailImap[_0x77d4('0x14')][_0x77d4('0x12')]=function(_0x13643a,_0x1c895b){logger[_0x77d4('0x11')](_0x77d4('0x12'),this[_0x77d4('0x9')][_0x77d4('0x8')],JSON[_0x77d4('0x34')](_0x13643a));var _0x54f324='';if(_0x13643a){if(_0x13643a[_0x77d4('0x35')]){_0x54f324=_0x13643a[_0x77d4('0x35')];}else{for(var _0x183732 in _0x13643a){if(_0x13643a[_0x77d4('0x36')](_0x183732)){_0x54f324+=_[_0x77d4('0x37')](_0x183732)+':\x20'+_0x13643a[_0x183732]+'\x0a';}}}}if(_0x1c895b){this[_0x77d4('0x1')]['end']();}else{this[_0x77d4('0x21')](_0x77d4('0x11'),_0x54f324);this[_0x77d4('0x21')]('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index d0ae3d1..8a089a4 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 _0x2aea=['use','compile','verify','toString','Not\x20verifired','exports','bluebird','prototype','send','createTransport'];(function(_0xfe1d02,_0x542261){var _0x44a3f1=function(_0x15866e){while(--_0x15866e){_0xfe1d02['push'](_0xfe1d02['shift']());}};_0x44a3f1(++_0x542261);}(_0x2aea,0x1dc));var _0xa2ae=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0x2aea[_0x1f7413];return _0x2d2775;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xa2ae('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xa2ae('0x1')][_0xa2ae('0x2')]=function(_0x1ee3eb,_0x5b8691){return new BPromise(function(_0x5cfeeb,_0x36f7cc){var _0xbb4add=nodemailer[_0xa2ae('0x3')](_0x1ee3eb);_0xbb4add[_0xa2ae('0x4')](_0xa2ae('0x5'),inlineBase64());_0xbb4add['sendMail'](_0x5b8691,function(_0x53f695,_0x4d41a1){if(_0x53f695){_0x36f7cc(_0x53f695['toString']());}else{_0x5cfeeb(_0x4d41a1);}});});};EmailSmtp[_0xa2ae('0x1')][_0xa2ae('0x6')]=function(_0x2f7f9e){return new BPromise(function(_0x3f97c7,_0x5c4b5c){var _0x29be4c=nodemailer[_0xa2ae('0x3')](_0x2f7f9e);_0x29be4c[_0xa2ae('0x6')](function(_0x431fb0,_0x53cbf4){if(_0x431fb0){_0x5c4b5c(_0x431fb0[_0xa2ae('0x7')]());}else{if(_0x53cbf4){_0x3f97c7(_0x53cbf4);}else{_0x5c4b5c(_0xa2ae('0x8'));}}});});};module[_0xa2ae('0x9')]=EmailSmtp; \ No newline at end of file +var _0x801b=['toString','verify','createTransport','Not\x20verifired','exports','nodemailer','prototype','send','compile','sendMail'];(function(_0x3c9159,_0x58f463){var _0x3a6f26=function(_0x57c4f7){while(--_0x57c4f7){_0x3c9159['push'](_0x3c9159['shift']());}};_0x3a6f26(++_0x58f463);}(_0x801b,0xa5));var _0xb801=function(_0x5bf5af,_0x1dd15a){_0x5bf5af=_0x5bf5af-0x0;var _0x25cd24=_0x801b[_0x5bf5af];return _0x25cd24;};'use strict';var nodemailer=require(_0xb801('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xb801('0x1')][_0xb801('0x2')]=function(_0x55a8a7,_0x51bcad){return new BPromise(function(_0x3d1252,_0x513344){var _0x2018a2=nodemailer['createTransport'](_0x55a8a7);_0x2018a2['use'](_0xb801('0x3'),inlineBase64());_0x2018a2[_0xb801('0x4')](_0x51bcad,function(_0x7ac530,_0x4b954a){if(_0x7ac530){_0x513344(_0x7ac530[_0xb801('0x5')]());}else{_0x3d1252(_0x4b954a);}});});};EmailSmtp['prototype'][_0xb801('0x6')]=function(_0x503e0a){return new BPromise(function(_0x24616c,_0x2dc3d4){var _0x45c29e=nodemailer[_0xb801('0x7')](_0x503e0a);_0x45c29e[_0xb801('0x6')](function(_0x12637b,_0x3c9534){if(_0x12637b){_0x2dc3d4(_0x12637b['toString']());}else{if(_0x3c9534){_0x24616c(_0x3c9534);}else{_0x2dc3d4(_0xb801('0x8'));}}});});};module[_0xb801('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 6f58b94..344e565 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 _0x730b=['Title','Data','getHost','gmail','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','lodash','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','name','split','length','slice','join','pop','test','replace','includes','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments'];(function(_0xb08260,_0x442585){var _0x18ac94=function(_0x1d5630){while(--_0x1d5630){_0xb08260['push'](_0xb08260['shift']());}};_0x18ac94(++_0x442585);}(_0x730b,0x91));var _0xb730=function(_0x419f71,_0xaefd05){_0x419f71=_0x419f71-0x0;var _0x4b182a=_0x730b[_0x419f71];return _0x4b182a;};'use strict';var _=require(_0xb730('0x0'));var moment=require('moment');var random=require(_0xb730('0x1'));var fs=require('fs');var path=require(_0xb730('0x2'));var util=require('util');var tnef=require(_0xb730('0x3'));var logger=require(_0xb730('0x4'))(_0xb730('0x5'));var config=require(_0xb730('0x6'));function getAddress(_0xc39513){var _0x3ebef4=_[_0xb730('0x7')](_0xc39513[_0xb730('0x8')]);return _0x3ebef4&&_0x3ebef4[_0xb730('0x9')]?_0x3ebef4[_0xb730('0x9')]:_0xb730('0xa')+random[_0xb730('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x154b65){var _0x222df7=_[_0xb730('0x7')](_0x154b65[_0xb730('0x8')]);if(_0x222df7&&_0x222df7[_0xb730('0xc')]){var _0x24261d=_0x222df7[_0xb730('0xc')][_0xb730('0xd')](/\s+/);return _0x24261d[_0xb730('0xe')]?_0x24261d[_0xb730('0xf')](0x0,-0x1)[_0xb730('0x10')]('\x20'):_0x222df7['name'];}return'Anonymous';}function getLastName(_0x536e41){var _0x1586d1=_['head'](_0x536e41['value']);if(_0x1586d1&&_0x1586d1[_0xb730('0xc')]){var _0x55e864=_0x1586d1[_0xb730('0xc')][_0xb730('0xd')](/\s+/);return _0x55e864[_0xb730('0xe')]>0x1?_0x55e864[_0xb730('0x11')]():'';}return'';}function getMails(_0x197a03,_0x51086f){var _0x3f43b8='';for(var _0xd352fc=0x0;_0xd352fc<_0x51086f[_0xb730('0x8')][_0xb730('0xe')];_0xd352fc+=0x1){if(_0x51086f['value'][_0xd352fc][_0xb730('0x9')]!==_0x197a03){if(!_['isEmpty'](_0x3f43b8)){_0x3f43b8+=',';}_0x3f43b8+=_0x51086f[_0xb730('0x8')][_0xd352fc][_0xb730('0xc')]||_0x51086f['value'][_0xd352fc][_0xb730('0x9')]||'';_0x3f43b8+='\x20<';_0x3f43b8+=_0x51086f[_0xb730('0x8')][_0xd352fc][_0xb730('0x9')]?_0x51086f[_0xb730('0x8')][_0xd352fc][_0xb730('0x9')]:_0xb730('0xa')+random[_0xb730('0xb')](0x6)+'@xcally.com';_0x3f43b8+='>';}}return _0x3f43b8;}function parseEmail(_0x2723b9,_0x580cbc,_0x313bda){if(_0x580cbc['html']){var _0x4809ac=/)<[^<]*)*<\/script>/gi;while(_0x4809ac[_0xb730('0x12')](_0x580cbc['html'])){_0x580cbc['html']=_0x580cbc['html'][_0xb730('0x13')](_0x4809ac,'');}if(_0x580cbc['html'][_0xb730('0x14')](_0xb730('0x15'))){var _0x3f6897=[];_0x580cbc[_0xb730('0x16')]['forEach'](_0x3cea08=>{_0x3f6897[_0xb730('0x17')](_0x3cea08[_0xb730('0x18')]);});var _0x32463d=/]+>/g;var _0x40a401=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x78ef7c=_0x580cbc[_0xb730('0x19')][_0xb730('0x13')](_0x40a401,_0xb730('0x1a'));var _0x6ddde1=_0x78ef7c['replace'](_0x32463d,_0xb730('0x1b'));for(let _0x1b6fc9=0x0;_0x1b6fc9<_0x3f6897[_0xb730('0xe')];_0x1b6fc9++){var _0x67d893=_0x6ddde1['replace'](_0xb730('0x1b'),_0xb730('0x1c')+_0x3f6897[_0x1b6fc9]+_0xb730('0x1d'));_0x6ddde1=_0x67d893;}_0x580cbc[_0xb730('0x19')]=_0x6ddde1;}_0x313bda[_0xb730('0x1e')]=_0x580cbc[_0xb730('0x19')];}else{_0x313bda['body']=_0x580cbc['textAsHtml'];}if(_0x313bda[_0xb730('0x1e')]){_0x313bda['body']=_0x313bda['body'][_0xb730('0x13')](/\x20[Attachment:\x20','body','textAsHtml','message','originCc','originTo','bcc','attachments','attach','type','attachment','filename','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','parser','from','messageId','inReplyTo','date','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','BodyHTML','Attachments','Title','getHost','gmail'];(function(_0x39a757,_0x51e36d){var _0x3df2f=function(_0x1e5083){while(--_0x1e5083){_0x39a757['push'](_0x39a757['shift']());}};_0x3df2f(++_0x51e36d);}(_0xd494,0x166));var _0x4d49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd494[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4d49('0x0'));var moment=require('moment');var random=require(_0x4d49('0x1'));var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0x4d49('0x2'));var logger=require(_0x4d49('0x3'))(_0x4d49('0x4'));var config=require('../../../config/environment');function getAddress(_0x2b40e6){var _0x4c40e3=_[_0x4d49('0x5')](_0x2b40e6['value']);return _0x4c40e3&&_0x4c40e3[_0x4d49('0x6')]?_0x4c40e3[_0x4d49('0x6')]:_0x4d49('0x7')+random[_0x4d49('0x8')](0x6)+_0x4d49('0x9');}function getFirstName(_0x36b63a){var _0xb74f36=_[_0x4d49('0x5')](_0x36b63a['value']);if(_0xb74f36&&_0xb74f36[_0x4d49('0xa')]){var _0x329292=_0xb74f36[_0x4d49('0xa')]['split'](/\s+/);return _0x329292[_0x4d49('0xb')]?_0x329292[_0x4d49('0xc')](0x0,-0x1)[_0x4d49('0xd')]('\x20'):_0xb74f36[_0x4d49('0xa')];}return _0x4d49('0xe');}function getLastName(_0x116355){var _0x33c561=_[_0x4d49('0x5')](_0x116355['value']);if(_0x33c561&&_0x33c561[_0x4d49('0xa')]){var _0x43c1fd=_0x33c561[_0x4d49('0xa')][_0x4d49('0xf')](/\s+/);return _0x43c1fd[_0x4d49('0xb')]>0x1?_0x43c1fd['pop']():'';}return'';}function getMails(_0x5221f5,_0x3fe72b){var _0x2dd25f='';for(var _0x3f154b=0x0;_0x3f154b<_0x3fe72b[_0x4d49('0x10')][_0x4d49('0xb')];_0x3f154b+=0x1){if(_0x3fe72b[_0x4d49('0x10')][_0x3f154b][_0x4d49('0x6')]!==_0x5221f5){if(!_[_0x4d49('0x11')](_0x2dd25f)){_0x2dd25f+=',';}_0x2dd25f+=_0x3fe72b[_0x4d49('0x10')][_0x3f154b][_0x4d49('0xa')]||_0x3fe72b[_0x4d49('0x10')][_0x3f154b]['address']||'';_0x2dd25f+='\x20<';_0x2dd25f+=_0x3fe72b[_0x4d49('0x10')][_0x3f154b]['address']?_0x3fe72b[_0x4d49('0x10')][_0x3f154b]['address']:_0x4d49('0x7')+random['generate'](0x6)+_0x4d49('0x9');_0x2dd25f+='>';}}return _0x2dd25f;}function parseEmail(_0x1397b6,_0x9f20ee,_0x1e79b4){if(_0x9f20ee[_0x4d49('0x12')]){var _0x56589f=/)<[^<]*)*<\/script>/gi;while(_0x56589f[_0x4d49('0x13')](_0x9f20ee[_0x4d49('0x12')])){_0x9f20ee[_0x4d49('0x12')]=_0x9f20ee['html']['replace'](_0x56589f,'');}if(_0x9f20ee[_0x4d49('0x12')][_0x4d49('0x14')](_0x4d49('0x15'))){var _0x299331=[];_0x9f20ee['attachments'][_0x4d49('0x16')](_0x4a80d6=>{_0x299331[_0x4d49('0x17')](_0x4a80d6['filename']);});var _0x5996cb=/]+>/g;var _0x484e46=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x2914a9=_0x9f20ee[_0x4d49('0x12')][_0x4d49('0x18')](_0x484e46,_0x4d49('0x19'));var _0x54a748=_0x2914a9[_0x4d49('0x18')](_0x5996cb,'_IMG');for(let _0x3190ac=0x0;_0x3190ac<_0x299331[_0x4d49('0xb')];_0x3190ac++){var _0x356aeb=_0x54a748[_0x4d49('0x18')](_0x4d49('0x1a'),_0x4d49('0x1b')+_0x299331[_0x3190ac]+'\x20]');_0x54a748=_0x356aeb;}_0x9f20ee[_0x4d49('0x12')]=_0x54a748;}_0x1e79b4[_0x4d49('0x1c')]=_0x9f20ee[_0x4d49('0x12')];}else{_0x1e79b4[_0x4d49('0x1c')]=_0x9f20ee[_0x4d49('0x1d')];}if(_0x1e79b4['body']){_0x1e79b4[_0x4d49('0x1c')]=_0x1e79b4[_0x4d49('0x1c')][_0x4d49('0x18')](/Empty\x20message

';if(_0xe86443['Attachments']){for(var _0x3bf8e7=0x0;_0x3bf8e7<_0xe86443[_0x4d49('0x3a')][_0x4d49('0xb')];_0x3bf8e7++){var _0x46ac0d=_0xe86443[_0x4d49('0x3a')][_0x3bf8e7];_0x39118e[_0x4d49('0x1e')]['attachments']['push']({'filename':_0x46ac0d[_0x4d49('0x3b')],'content':new Buffer(_0x46ac0d['Data'])});}}}_0x19b791(parseEmail(_0x45b92d,_0x52ce5f,_0x39118e));});}else{_0x52ce5f[_0x4d49('0x12')]='

Empty\x20message

';_0x19b791(parseEmail(_0x45b92d,_0x52ce5f,_0x39118e));}}else{_0x19b791(parseEmail(_0x45b92d,_0x52ce5f,_0x39118e));}};exports[_0x4d49('0x3c')]=function(_0x215433){switch(_0x215433){case _0x4d49('0x3d'):return _0x4d49('0x3e');case _0x4d49('0x3f'):return _0x4d49('0x40');case _0x4d49('0x41'):return _0x4d49('0x42');case _0x4d49('0x43'):return _0x4d49('0x44');}return _0x4d49('0x45');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 9f8893d..8e321ab 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebbf=['Imap','Smtp','exports','lodash','Service','SERV','active'];(function(_0x5ace22,_0xa17b4){var _0x43318f=function(_0x19381f){while(--_0x19381f){_0x5ace22['push'](_0x5ace22['shift']());}};_0x43318f(++_0xa17b4);}(_0xebbf,0x65));var _0xfebb=function(_0x29a08d,_0x551eca){_0x29a08d=_0x29a08d-0x0;var _0x10fc1a=_0xebbf[_0x29a08d];return _0x10fc1a;};'use strict';var _=require(_0xfebb('0x0'));function MailAccount(_0x1f47ce){this['id']=_0x1f47ce['id']||0x0;this['name']=_0x1f47ce['name']||_0xfebb('0x1');this['key']=_0x1f47ce['key']||_0xfebb('0x2');this[_0xfebb('0x3')]=_0x1f47ce['active']||![];this[_0xfebb('0x4')]=_0x1f47ce[_0xfebb('0x4')]||[];this[_0xfebb('0x5')]=_0x1f47ce[_0xfebb('0x5')]||[];}module[_0xfebb('0x6')]=MailAccount; \ No newline at end of file +var _0xe462=['active','Imap','exports','lodash','name','key'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xe462,0xcf));var _0x2e46=function(_0x5eb1a8,_0x30e664){_0x5eb1a8=_0x5eb1a8-0x0;var _0x14c11c=_0xe462[_0x5eb1a8];return _0x14c11c;};'use strict';var _=require(_0x2e46('0x0'));function MailAccount(_0xaa5856){this['id']=_0xaa5856['id']||0x0;this[_0x2e46('0x1')]=_0xaa5856['name']||'Service';this[_0x2e46('0x2')]=_0xaa5856[_0x2e46('0x2')]||'SERV';this[_0x2e46('0x3')]=_0xaa5856[_0x2e46('0x3')]||![];this[_0x2e46('0x4')]=_0xaa5856['Imap']||[];this['Smtp']=_0xaa5856['Smtp']||[];}module[_0x2e46('0x5')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index ec077c9..e1e3383 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3de=['exports','mailAccounts','prototype','hasOwnProperty','initMailAccounts','isUndefined'];(function(_0x5c0665,_0x6a41ca){var _0x4fdb25=function(_0x115544){while(--_0x115544){_0x5c0665['push'](_0x5c0665['shift']());}};_0x4fdb25(++_0x6a41ca);}(_0xe3de,0x145));var _0xee3d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe3de[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xee3d('0x0')]={};};function freeIsNotKey(_0x2dac74,_0x1c653c,_0x221536){var _0x517479=_['mapKeys'](_0x2dac74,function(_0x30668f,_0x30a1b0){return _0x30668f[_0x221536];});for(var _0x5f237e in _0x1c653c){if(_0x1c653c['hasOwnProperty'](_0x5f237e)){if(!_0x517479[_0x5f237e]){delete _0x1c653c[_0x5f237e];}}}}Realtime[_0xee3d('0x1')]['mergeFromDatabase']=function(_0x10b266,_0x245466){for(var _0xcaa7b0 in _0x245466){if(_0x10b266[_0xee3d('0x2')](_0xcaa7b0)){_0x10b266[_0xcaa7b0]=_0x245466[_0xcaa7b0];}}};Realtime[_0xee3d('0x1')][_0xee3d('0x3')]=function(){var _0x1efb6d=this;return function(_0x490c91){if(_0x490c91){freeIsNotKey(_0x490c91,_0x1efb6d[_0xee3d('0x0')],'id');for(var _0x54c9ef=0x0,_0x5512e4={},_0x3c485b={};_0x54c9ef<_0x490c91['length'];_0x54c9ef+=0x1){_0x5512e4=_0x490c91[_0x54c9ef];if(_[_0xee3d('0x4')](_0x1efb6d['mailAccounts'][_0x5512e4['id']])){_0x1efb6d[_0xee3d('0x0')][_0x5512e4['id']]=new MailAccount(_0x5512e4);}else{_['merge'](_0x1efb6d[_0xee3d('0x0')][_0x5512e4['id']],_0x5512e4);}}}return _0x1efb6d[_0xee3d('0x0')];};};module[_0xee3d('0x5')]=Realtime; \ No newline at end of file +var _0x6b92=['merge','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','initMailAccounts','mailAccounts','length'];(function(_0x1bf48,_0x39cfa8){var _0x3ba527=function(_0x186003){while(--_0x186003){_0x1bf48['push'](_0x1bf48['shift']());}};_0x3ba527(++_0x39cfa8);}(_0x6b92,0x192));var _0x26b9=function(_0x35edbb,_0x4c549e){_0x35edbb=_0x35edbb-0x0;var _0x378692=_0x6b92[_0x35edbb];return _0x378692;};'use strict';var _=require(_0x26b9('0x0'));var MailAccount=require(_0x26b9('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x1930bc,_0x1b6286,_0x3ba3af){var _0x1f41ed=_[_0x26b9('0x2')](_0x1930bc,function(_0x280b22,_0x212980){return _0x280b22[_0x3ba3af];});for(var _0x553496 in _0x1b6286){if(_0x1b6286['hasOwnProperty'](_0x553496)){if(!_0x1f41ed[_0x553496]){delete _0x1b6286[_0x553496];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x2ba830,_0x5d6e4a){for(var _0x298efb in _0x5d6e4a){if(_0x2ba830[_0x26b9('0x3')](_0x298efb)){_0x2ba830[_0x298efb]=_0x5d6e4a[_0x298efb];}}};Realtime[_0x26b9('0x4')][_0x26b9('0x5')]=function(){var _0x378223=this;return function(_0x38955d){if(_0x38955d){freeIsNotKey(_0x38955d,_0x378223[_0x26b9('0x6')],'id');for(var _0x577595=0x0,_0x1de435={},_0x14b23e={};_0x577595<_0x38955d[_0x26b9('0x7')];_0x577595+=0x1){_0x1de435=_0x38955d[_0x577595];if(_['isUndefined'](_0x378223[_0x26b9('0x6')][_0x1de435['id']])){_0x378223[_0x26b9('0x6')][_0x1de435['id']]=new MailAccount(_0x1de435);}else{_[_0x26b9('0x8')](_0x378223[_0x26b9('0x6')][_0x1de435['id']],_0x1de435);}}}return _0x378223[_0x26b9('0x6')];};};module[_0x26b9('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 7f7eb9c..4ade84b 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9120=['NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','email','active','key','ListId','TemplateId','MailServerIn','MailServerOut','Smtp','getMailAccount'];(function(_0xd8ac96,_0x31766a){var _0x49def2=function(_0x36725a){while(--_0x36725a){_0xd8ac96['push'](_0xd8ac96['shift']());}};_0x49def2(++_0x31766a);}(_0x9120,0x1b3));var _0x0912=function(_0x5a8011,_0x5a9371){_0x5a8011=_0x5a8011-0x0;var _0x116821=_0x9120[_0x5a8011];return _0x116821;};'use strict';var client=require(_0x0912('0x0'));exports[_0x0912('0x1')]=function(){return function(){return client[_0x0912('0x2')](_0x0912('0x3'),{'options':{'attributes':['id','name','service',_0x0912('0x4'),_0x0912('0x5'),_0x0912('0x6'),_0x0912('0x7'),_0x0912('0x8')],'raw':![],'include':[{'model':_0x0912('0x9'),'as':'Imap'},{'model':_0x0912('0xa'),'as':_0x0912('0xb')}]},'log':_0x0912('0xc')});};};exports['notify']=function(_0x674709,_0x4383c7){return client[_0x0912('0x2')](_0x0912('0xd'),{'account':{'id':_0x674709},'body':_0x4383c7,'log':_0x0912('0xd')});}; \ No newline at end of file +var _0x6003=['key','TemplateId','MailServerIn','MailServerOut','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','email','active'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0x6003,0xae));var _0x3600=function(_0x567575,_0x1a8d8a){_0x567575=_0x567575-0x0;var _0x384e20=_0x6003[_0x567575];return _0x384e20;};'use strict';var client=require(_0x3600('0x0'));exports[_0x3600('0x1')]=function(){return function(){return client[_0x3600('0x2')](_0x3600('0x3'),{'options':{'attributes':['id','name','service',_0x3600('0x4'),_0x3600('0x5'),_0x3600('0x6'),'ListId',_0x3600('0x7')],'raw':![],'include':[{'model':_0x3600('0x8'),'as':'Imap'},{'model':_0x3600('0x9'),'as':'Smtp'}]},'log':'getMailAccount'});};};exports[_0x3600('0xa')]=function(_0x4a5962,_0x145243){return client['Request'](_0x3600('0xb'),{'account':{'id':_0x4a5962},'body':_0x145243,'log':_0x3600('0xb')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index e92b29f..79c75a0 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1342=['mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','jayson/promise','bluebird','../../../config/logger','email','listen','sendMail','then','catch','error','verifySmtp','Verified','values'];(function(_0xe420bc,_0x3b9be5){var _0x3d10de=function(_0x6b97bc){while(--_0x6b97bc){_0xe420bc['push'](_0xe420bc['shift']());}};_0x3d10de(++_0x3b9be5);}(_0x1342,0xf1));var _0x2134=function(_0x5cd70a,_0x51f70a){_0x5cd70a=_0x5cd70a-0x0;var _0x28d47e=_0x1342[_0x5cd70a];return _0x28d47e;};'use strict';var jayson=require(_0x2134('0x0'));var BPromise=require(_0x2134('0x1'));var _=require('lodash');var logger=require(_0x2134('0x2'))(_0x2134('0x3'));exports[_0x2134('0x4')]=function(_0x2d113a,_0x3d67dd){return new BPromise(function(_0x14275f,_0x1e786e){var _0x5f1164={'SendMail':function(_0x41f56d){var _0x19b636=this;return new Promise(function(_0x5c56a7,_0x3517d5){_0x3d67dd[_0x2134('0x5')](_0x41f56d['account'],_0x41f56d['message'])[_0x2134('0x6')](function(_0x169b49){_0x5c56a7({'code':0xc8,'message':_0x169b49});})[_0x2134('0x7')](function(_0x350b7a){_0x3517d5(_0x19b636[_0x2134('0x8')](0x1f4,_0x350b7a));});});},'VerifySmtp':function(_0x375761){var _0x581a7f=this;return new Promise(function(_0x4fa4a,_0x556f50){_0x3d67dd[_0x2134('0x9')](_0x375761['account'])[_0x2134('0x6')](function(_0x2e7523){_0x4fa4a({'code':0xc8,'message':_0x2134('0xa')});})[_0x2134('0x7')](function(_0x341357){_0x556f50(_0x581a7f['error'](0x1f4,_0x341357));});});},'MailAccounts':function(_0x426ad5){return new Promise(function(_0x5eeb5d,_0x4c3419){var _0x1c34f9=_[_0x2134('0xb')](_0x2d113a[_0x2134('0xc')]);for(var _0xcd64d3=0x0;_0xcd64d3<_0x1c34f9[_0x2134('0xd')];_0xcd64d3+=0x1){if(_0x1c34f9[_0xcd64d3][_0x2134('0xe')]&&_0x1c34f9[_0xcd64d3]['Imap'][_0x2134('0xf')]){delete _0x1c34f9[_0xcd64d3][_0x2134('0xe')][_0x2134('0xf')];}if(_0x1c34f9[_0xcd64d3][_0x2134('0x10')]&&_0x1c34f9[_0xcd64d3][_0x2134('0x10')]['pass']){delete _0x1c34f9[_0xcd64d3][_0x2134('0x10')][_0x2134('0x11')];}}_0x5eeb5d({'count':_0x1c34f9[_0x2134('0xd')],'rows':_0x1c34f9});});}};var _0x5c5004=jayson[_0x2134('0x12')](_0x5f1164)[_0x2134('0x13')]();_0x5c5004['on'](_0x2134('0x8'),function(_0xb35a17){logger['error'](JSON[_0x2134('0x14')](_0xb35a17));return _0x1e786e(_0xb35a17);});_0x5c5004[_0x2134('0x4')](0x232b,'127.0.0.1',function(){console[_0x2134('0x15')](_0x2134('0x16'),0x232b);return _0x14275f('RPC\x20listening\x20on\x20port:'+0x232b);});});}; \ No newline at end of file +var _0x2235=['bluebird','lodash','../../../config/logger','email','listen','sendMail','account','message','then','catch','error','verifySmtp','values','mailAccounts','Imap','password','Smtp','pass','length','server','stringify','127.0.0.1','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x2235,0x112));var _0x5223=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x2235[_0x126558];return _0x1f6d14;};'use strict';var jayson=require(_0x5223('0x0'));var BPromise=require(_0x5223('0x1'));var _=require(_0x5223('0x2'));var logger=require(_0x5223('0x3'))(_0x5223('0x4'));exports[_0x5223('0x5')]=function(_0x52f01d,_0x323c31){return new BPromise(function(_0x516d38,_0x3b1ca6){var _0x4682a7={'SendMail':function(_0x524065){var _0x556495=this;return new Promise(function(_0x2b03bd,_0x19aee1){_0x323c31[_0x5223('0x6')](_0x524065[_0x5223('0x7')],_0x524065[_0x5223('0x8')])[_0x5223('0x9')](function(_0x1dd521){_0x2b03bd({'code':0xc8,'message':_0x1dd521});})[_0x5223('0xa')](function(_0x23733e){_0x19aee1(_0x556495[_0x5223('0xb')](0x1f4,_0x23733e));});});},'VerifySmtp':function(_0x56ec78){var _0x1b13e8=this;return new Promise(function(_0x525841,_0x2032c6){_0x323c31[_0x5223('0xc')](_0x56ec78[_0x5223('0x7')])[_0x5223('0x9')](function(_0x3cb9ae){_0x525841({'code':0xc8,'message':'Verified'});})[_0x5223('0xa')](function(_0x412a97){_0x2032c6(_0x1b13e8['error'](0x1f4,_0x412a97));});});},'MailAccounts':function(_0x110fc1){return new Promise(function(_0x44fd28,_0x501bd6){var _0x3f5cff=_[_0x5223('0xd')](_0x52f01d[_0x5223('0xe')]);for(var _0x271596=0x0;_0x271596<_0x3f5cff['length'];_0x271596+=0x1){if(_0x3f5cff[_0x271596]['Imap']&&_0x3f5cff[_0x271596][_0x5223('0xf')]['password']){delete _0x3f5cff[_0x271596][_0x5223('0xf')][_0x5223('0x10')];}if(_0x3f5cff[_0x271596][_0x5223('0x11')]&&_0x3f5cff[_0x271596][_0x5223('0x11')]['pass']){delete _0x3f5cff[_0x271596][_0x5223('0x11')][_0x5223('0x12')];}}_0x44fd28({'count':_0x3f5cff[_0x5223('0x13')],'rows':_0x3f5cff});});}};var _0x59867e=jayson[_0x5223('0x14')](_0x4682a7)['http']();_0x59867e['on'](_0x5223('0xb'),function(_0xedfbc0){logger['error'](JSON[_0x5223('0x15')](_0xedfbc0));return _0x3b1ca6(_0xedfbc0);});_0x59867e['listen'](0x232b,_0x5223('0x16'),function(){console['log'](_0x5223('0x17'),0x232b);return _0x516d38(_0x5223('0x18')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 6aadba7..aa8a06b 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd00=['port','socket.io','websocket','redis','defaults','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','createServer','timeout'];(function(_0x521d3c,_0x305e7c){var _0x4a4bad=function(_0x12240a){while(--_0x12240a){_0x521d3c['push'](_0x521d3c['shift']());}};_0x4a4bad(++_0x305e7c);}(_0xdd00,0x1c7));var _0x0dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd00[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0dd0('0x0'));var http=require(_0x0dd0('0x1'));var express=require(_0x0dd0('0x2'));var sticky=require(_0x0dd0('0x3'));var Redis=require(_0x0dd0('0x4'));var config=require('../../config/environment');var app=express();var server=http[_0x0dd0('0x5')](app);server[_0x0dd0('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0x0dd0('0x7')])){var socketio=require(_0x0dd0('0x8'))(server,{'transports':[_0x0dd0('0x9'),'polling']});config[_0x0dd0('0xa')]=_[_0x0dd0('0xb')](config[_0x0dd0('0xa')],{'host':_0x0dd0('0xc'),'port':0x18eb});socketio['adapter'](require(_0x0dd0('0xd'))({'pubClient':new Redis(config[_0x0dd0('0xa')]),'subClient':new Redis(config[_0x0dd0('0xa')])}));require(_0x0dd0('0xe'))[_0x0dd0('0xf')]();require(_0x0dd0('0x10'))[_0x0dd0('0xf')](socketio);require('../../config/express')[_0x0dd0('0xf')](app);require('../../routes')[_0x0dd0('0xf')](app);}else{server[_0x0dd0('0x11')](_0x0dd0('0x12'),function(){console[_0x0dd0('0x13')](_0x0dd0('0x14'),config['port']);});}exports=module[_0x0dd0('0x15')]=app; \ No newline at end of file +var _0x34b4=['sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','websocket','redis','localhost','../../config/triggers','../../config/socketio','default','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express'];(function(_0x54f415,_0x52be28){var _0xaca73b=function(_0x5937ce){while(--_0x5937ce){_0x54f415['push'](_0x54f415['shift']());}};_0xaca73b(++_0x52be28);}(_0x34b4,0x18e));var _0x434b=function(_0x24708c,_0x568348){_0x24708c=_0x24708c-0x0;var _0x52e233=_0x34b4[_0x24708c];return _0x52e233;};'use strict';var _=require(_0x434b('0x0'));var http=require('http');var express=require(_0x434b('0x1'));var sticky=require(_0x434b('0x2'));var Redis=require(_0x434b('0x3'));var config=require(_0x434b('0x4'));var app=express();var server=http[_0x434b('0x5')](app);server[_0x434b('0x6')]=0xdbba0;if(sticky[_0x434b('0x7')](server,config[_0x434b('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0x434b('0x9'),'polling']});config[_0x434b('0xa')]=_['defaults'](config[_0x434b('0xa')],{'host':_0x434b('0xb'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x434b('0xa')])}));require(_0x434b('0xc'))['default']();require(_0x434b('0xd'))[_0x434b('0xe')](socketio);require('../../config/express')['default'](app);require(_0x434b('0xf'))[_0x434b('0xe')](app);}else{server[_0x434b('0x10')]('listening',function(){console[_0x434b('0x11')](_0x434b('0x12'),config[_0x434b('0x8')]);});}exports=module[_0x434b('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 2f702b6..b361988 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62c8=['then','debug','rpc','routing','error','message','result','catch','exports','../../config/logger','http','Request'];(function(_0x4282c6,_0x114c5e){var _0x3933ba=function(_0x3ccb9d){while(--_0x3ccb9d){_0x4282c6['push'](_0x4282c6['shift']());}};_0x3933ba(++_0x114c5e);}(_0x62c8,0x1ad));var _0x862c=function(_0x52afcc,_0x143cc3){_0x52afcc=_0x52afcc-0x0;var _0x3787a2=_0x62c8[_0x52afcc];return _0x3787a2;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x862c('0x0'))('routing');var client=jayson['client'][_0x862c('0x1')]({'port':0x2329});client[_0x862c('0x2')]=function(_0x34d6ee,_0x2b628c){return new BPromise(function(_0x67570,_0x2aa8a8){return client['request'](_0x34d6ee,_0x2b628c)[_0x862c('0x3')](function(_0x2c6929){logger[_0x862c('0x4')](_0x862c('0x5'),_0x862c('0x6'),_0x34d6ee,_0x2b628c,_0x2c6929);if(_0x2c6929[_0x862c('0x7')]){logger[_0x862c('0x7')](_0x862c('0x5'),_0x862c('0x6'),_0x34d6ee,_0x2c6929[_0x862c('0x7')][_0x862c('0x8')],_0x2b628c);return _0x2aa8a8(_0x2c6929['error'][_0x862c('0x8')]);}else{return _0x67570(_0x2c6929[_0x862c('0x9')]);}})[_0x862c('0xa')](function(_0x305555){logger[_0x862c('0x7')]('rpc',_0x862c('0x6'),_0x34d6ee,_0x305555,_0x2b628c);return _0x2aa8a8(_0x305555);});});};module[_0x862c('0xb')]=client; \ No newline at end of file +var _0x950a=['routing','http','Request','request','debug','error','rpc','message','catch','jayson/promise','bluebird','../../config/logger'];(function(_0x12d513,_0x5b74fd){var _0xc62767=function(_0x5f3d7d){while(--_0x5f3d7d){_0x12d513['push'](_0x12d513['shift']());}};_0xc62767(++_0x5b74fd);}(_0x950a,0x111));var _0xa950=function(_0x5f1c9c,_0x1445c3){_0x5f1c9c=_0x5f1c9c-0x0;var _0x100fb8=_0x950a[_0x5f1c9c];return _0x100fb8;};'use strict';var jayson=require(_0xa950('0x0'));var BPromise=require(_0xa950('0x1'));var logger=require(_0xa950('0x2'))(_0xa950('0x3'));var client=jayson['client'][_0xa950('0x4')]({'port':0x2329});client[_0xa950('0x5')]=function(_0x4c027f,_0x2c80ed){return new BPromise(function(_0x5cd4aa,_0x1cd8ec){return client[_0xa950('0x6')](_0x4c027f,_0x2c80ed)['then'](function(_0x14b4ac){logger[_0xa950('0x7')]('rpc','routing',_0x4c027f,_0x2c80ed,_0x14b4ac);if(_0x14b4ac[_0xa950('0x8')]){logger[_0xa950('0x8')](_0xa950('0x9'),_0xa950('0x3'),_0x4c027f,_0x14b4ac[_0xa950('0x8')][_0xa950('0xa')],_0x2c80ed);return _0x1cd8ec(_0x14b4ac['error']['message']);}else{return _0x5cd4aa(_0x14b4ac['result']);}})[_0xa950('0xb')](function(_0x48c1b5){logger[_0xa950('0x8')](_0xa950('0x9'),_0xa950('0x3'),_0x4c027f,_0x48c1b5,_0x2c80ed);return _0x1cd8ec(_0x48c1b5);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 7da44f8..3ac0f32 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c20=['./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','initAgents','then','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue'];(function(_0xd3da17,_0x1ae783){var _0x1b68fd=function(_0x3a2836){while(--_0x3a2836){_0xd3da17['push'](_0xd3da17['shift']());}};_0x1b68fd(++_0x1ae783);}(_0x6c20,0x1c4));var _0x06c2=function(_0x4053cf,_0x14397f){_0x4053cf=_0x4053cf-0x0;var _0x3bf960=_0x6c20[_0x4053cf];return _0x3bf960;};'use strict';var BPromise=require(_0x06c2('0x0'));var server=require('./server');var Realtime=require(_0x06c2('0x1'));var user=require(_0x06c2('0x2'));var interval=require(_0x06c2('0x3'));var openchannelQueue=require(_0x06c2('0x4'));var chatQueue=require(_0x06c2('0x5'));var smsQueue=require(_0x06c2('0x6'));var mailQueue=require(_0x06c2('0x7'));var faxQueue=require(_0x06c2('0x8'));var whatsappQueue=require(_0x06c2('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x06c2('0xa')]()['then'](user[_0x06c2('0xb')]())['then'](realtime[_0x06c2('0xc')]())[_0x06c2('0xd')](interval[_0x06c2('0xe')]())[_0x06c2('0xd')](realtime['initIntervals']())[_0x06c2('0xd')](openchannelQueue[_0x06c2('0xf')]())[_0x06c2('0xd')](realtime[_0x06c2('0x10')]())[_0x06c2('0xd')](chatQueue[_0x06c2('0x11')]())[_0x06c2('0xd')](realtime['initChatQueues']())['then'](smsQueue[_0x06c2('0x12')]())[_0x06c2('0xd')](realtime[_0x06c2('0x13')]())[_0x06c2('0xd')](mailQueue[_0x06c2('0x14')]())[_0x06c2('0xd')](realtime[_0x06c2('0x15')]())[_0x06c2('0xd')](faxQueue['getFaxQueues']())['then'](realtime[_0x06c2('0x16')]())[_0x06c2('0xd')](whatsappQueue['getWhatsappQueues']())[_0x06c2('0xd')](realtime[_0x06c2('0x17')]())['then'](function(){return realtime;});}function main(){return server[_0x06c2('0x18')](realtime)['then'](function(_0xafc528){return initRealtime();})[_0x06c2('0xd')](function(_0x48bb3f){return setInterval(initRealtime,0x1388);})[_0x06c2('0x19')](function(_0x4b90ae){console[_0x06c2('0x1a')](_0x4b90ae);});}main(); \ No newline at end of file +var _0x36e2=['initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','catch','bluebird','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents'];(function(_0x5d5979,_0x3b4921){var _0x237182=function(_0xbd4df7){while(--_0xbd4df7){_0x5d5979['push'](_0x5d5979['shift']());}};_0x237182(++_0x3b4921);}(_0x36e2,0x1cf));var _0x236e=function(_0x56a930,_0x54c3b2){_0x56a930=_0x56a930-0x0;var _0x11c985=_0x36e2[_0x56a930];return _0x11c985;};'use strict';var BPromise=require(_0x236e('0x0'));var server=require('./server');var Realtime=require(_0x236e('0x1'));var user=require('./rpc/user');var interval=require(_0x236e('0x2'));var openchannelQueue=require(_0x236e('0x3'));var chatQueue=require(_0x236e('0x4'));var smsQueue=require(_0x236e('0x5'));var mailQueue=require(_0x236e('0x6'));var faxQueue=require(_0x236e('0x7'));var whatsappQueue=require(_0x236e('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x236e('0x9')]()[_0x236e('0xa')](user[_0x236e('0xb')]())[_0x236e('0xa')](realtime[_0x236e('0xc')]())[_0x236e('0xa')](interval[_0x236e('0xd')]())[_0x236e('0xa')](realtime[_0x236e('0xe')]())[_0x236e('0xa')](openchannelQueue['getOpenchannelQueues']())[_0x236e('0xa')](realtime[_0x236e('0xf')]())[_0x236e('0xa')](chatQueue[_0x236e('0x10')]())[_0x236e('0xa')](realtime['initChatQueues']())[_0x236e('0xa')](smsQueue[_0x236e('0x11')]())[_0x236e('0xa')](realtime[_0x236e('0x12')]())[_0x236e('0xa')](mailQueue[_0x236e('0x13')]())[_0x236e('0xa')](realtime[_0x236e('0x14')]())[_0x236e('0xa')](faxQueue[_0x236e('0x15')]())['then'](realtime[_0x236e('0x16')]())['then'](whatsappQueue[_0x236e('0x17')]())[_0x236e('0xa')](realtime['initWhatsappQueues']())[_0x236e('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x236e('0xa')](function(_0x36771a){return initRealtime();})['then'](function(_0x390e48){return setInterval(initRealtime,0x1388);})[_0x236e('0x18')](function(_0x36b4fc){console['log'](_0x36b4fc);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index fd9d0fe..8a21930 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09d4=['ignoreFactChanges','prototype','isArray','rules','concat','isObject','sync','activeRules','orderBy','asc','result','clone','consequence','name','index_','nextTick','call','next','isEqual','restart','condition','matchPath','noop','turn','findRules','length','priority','toJSON','map','toString','exports','lodash','events','EventEmitter','init','isNil','register'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x09d4,0xd8));var _0x409d=function(_0x51dc30,_0x2af9c7){_0x51dc30=_0x51dc30-0x0;var _0x5ce924=_0x09d4[_0x51dc30];return _0x5ce924;};'use strict';var _=require(_0x409d('0x0'));var util=require('util');var EventEmitter=require(_0x409d('0x1'))[_0x409d('0x2')];function RuleEngine(_0x624aa1,_0x2bba14){this[_0x409d('0x3')]();if(!_[_0x409d('0x4')](_0x624aa1)){this[_0x409d('0x5')](_0x624aa1);}if(_0x2bba14){this[_0x409d('0x6')]=_0x2bba14[_0x409d('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x409d('0x3')]=function(_0x520848){this['rules']=[];this['activeRules']=[];};RuleEngine[_0x409d('0x7')][_0x409d('0x5')]=function(_0x58adb7){if(Array[_0x409d('0x8')](_0x58adb7)){this[_0x409d('0x9')]=this[_0x409d('0x9')][_0x409d('0xa')](_0x58adb7);}else if(_0x58adb7!==null&&_[_0x409d('0xb')](_0x58adb7)){this[_0x409d('0x9')]['push'](_0x58adb7);}this[_0x409d('0xc')]();};RuleEngine[_0x409d('0x7')]['sync']=function(){this[_0x409d('0xd')]=this[_0x409d('0x9')]['filter'](function(_0x3df77e){if(_[_0x409d('0x4')](_0x3df77e['on'])){_0x3df77e['on']=!![];}if(_0x3df77e['on']===!![]){return _0x3df77e;}});this[_0x409d('0xd')]=_[_0x409d('0xe')](this[_0x409d('0xd')],['p'],[_0x409d('0xf')]);};RuleEngine['prototype']['execute']=function(_0x58975a,_0x332a78){var _0x2eab28=![];_0x58975a[_0x409d('0x10')]=!![];var _0x2819af=_[_0x409d('0x11')](_0x58975a);var _0x18f343=_[_0x409d('0x11')](_0x58975a);var _0x2c37d1=this[_0x409d('0xd')];var _0x1386f2=[];var _0x7c639f=this[_0x409d('0x6')];(function FnRuleLoop(_0x5b1546){var _0x159b50={'rules':function(){return _0x2c37d1;},'rule':function(){return _0x2c37d1[_0x5b1546];},'when':function(_0x5ea55b){if(_0x5ea55b){var _0x1724a5=_0x2c37d1[_0x5b1546][_0x409d('0x12')];_0x1724a5['ruleRef']=_0x2c37d1[_0x5b1546]['id']||_0x2c37d1[_0x5b1546][_0x409d('0x13')]||_0x409d('0x14')+_0x5b1546;process[_0x409d('0x15')](function(){_0x1386f2['push'](_0x1724a5['ruleRef']);_0x1724a5[_0x409d('0x16')](_0x2819af,_0x159b50);});}else{process[_0x409d('0x15')](function(){_0x159b50[_0x409d('0x17')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2eab28=!![];return FnRuleLoop(0x0);},'next':function(_0x4eba39){if(!_0x7c639f&&!_[_0x409d('0x18')](_0x18f343,_0x2819af)){_0x18f343=_[_0x409d('0x11')](_0x2819af);process[_0x409d('0x15')](function(){_0x159b50[_0x409d('0x19')]();});}else{process[_0x409d('0x15')](function(){if(_[_0x409d('0x4')](_0x4eba39)){return FnRuleLoop(_0x5b1546+0x1);}else{return FnRuleLoop(_0x4eba39);}});}}};if(_0x5b1546<_0x2c37d1['length']&&_0x2eab28===![]){var _0x356187=_0x2c37d1[_0x5b1546][_0x409d('0x1a')];_0x356187['call'](_0x2819af,_0x159b50);}else{process[_0x409d('0x15')](function(){_0x2819af[_0x409d('0x1b')]=_0x1386f2;return _0x332a78?_0x332a78(_0x2819af):_[_0x409d('0x1c')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x2e7635){if(_[_0x409d('0x4')](_0x2e7635)){return this[_0x409d('0x9')];}else{var _0x2428ec=_['matches'](_0x2e7635);return _['filter'](this['rules'],_0x2428ec);}};RuleEngine[_0x409d('0x7')][_0x409d('0x1d')]=function(_0x31ee7d,_0x2ecfc8){var _0x58cdf0=_0x31ee7d==='on'||_0x31ee7d==='ON'?!![]:![];var _0x586c8f=this[_0x409d('0x1e')](_0x2ecfc8);for(var _0x38690c=0x0,_0x480eeb=_0x586c8f[_0x409d('0x1f')];_0x38690c<_0x480eeb;_0x38690c+=0x1){_0x586c8f[_0x38690c]['on']=_0x58cdf0;}this[_0x409d('0xc')]();};RuleEngine[_0x409d('0x7')]['prioritize']=function(_0x47fa7d,_0x496065){_0x47fa7d=parseInt(_0x47fa7d,0xa);var _0x574202=this[_0x409d('0x1e')](_0x496065);for(var _0x2f673d=0x0,_0x26a0d5=_0x574202['length'];_0x2f673d<_0x26a0d5;_0x2f673d+=0x1){_0x574202[_0x2f673d][_0x409d('0x20')]=_0x47fa7d;}this['sync']();};RuleEngine['prototype'][_0x409d('0x21')]=function(){var _0x5f0002=this['rules'];if(_0x5f0002 instanceof Array){_0x5f0002=_0x5f0002[_0x409d('0x22')](function(_0x507079){_0x507079['condition']=_0x507079['condition']['toString']();_0x507079[_0x409d('0x12')]=_0x507079[_0x409d('0x12')][_0x409d('0x23')]();return _0x507079;});}else if(!_[_0x409d('0x4')](_0x5f0002)){_0x5f0002[_0x409d('0x1a')]=_0x5f0002[_0x409d('0x1a')][_0x409d('0x23')]();_0x5f0002['consequence']=_0x5f0002['consequence'][_0x409d('0x23')]();}return _0x5f0002;};RuleEngine[_0x409d('0x7')]['fromJSON']=function(_0x1a0783){this[_0x409d('0x3')]();if(_['isString'](_0x1a0783)){_0x1a0783=JSON['parse'](_0x1a0783);}if(_0x1a0783 instanceof Array){_0x1a0783=_0x1a0783[_0x409d('0x22')](function(_0x376ad3){_0x376ad3[_0x409d('0x1a')]=eval('('+_0x376ad3[_0x409d('0x1a')]+')');_0x376ad3['consequence']=eval('('+_0x376ad3['consequence']+')');return _0x376ad3;});}else if(_0x1a0783!==null&&typeof _0x1a0783=='object'){_0x1a0783['condition']=eval('('+_0x1a0783[_0x409d('0x1a')]+')');_0x1a0783['consequence']=eval('('+_0x1a0783[_0x409d('0x12')]+')');}this['register'](_0x1a0783);};module[_0x409d('0x24')]=RuleEngine; \ No newline at end of file +var _0x381a=['isEqual','restart','length','condition','findRules','prioritize','toJSON','consequence','toString','fromJSON','isString','parse','map','object','exports','lodash','util','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','rules','activeRules','isArray','concat','isObject','sync','prototype','filter','orderBy','asc','result','clone','ruleRef','name','index_','nextTick','push','call','next'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x381a,0x1dd));var _0xa381=function(_0x17b55f,_0xbf5803){_0x17b55f=_0x17b55f-0x0;var _0x4f7f61=_0x381a[_0x17b55f];return _0x4f7f61;};'use strict';var _=require(_0xa381('0x0'));var util=require(_0xa381('0x1'));var EventEmitter=require('events')[_0xa381('0x2')];function RuleEngine(_0x3f243f,_0x553826){this[_0xa381('0x3')]();if(!_[_0xa381('0x4')](_0x3f243f)){this[_0xa381('0x5')](_0x3f243f);}if(_0x553826){this[_0xa381('0x6')]=_0x553826['ignoreFactChanges'];}return this;}util[_0xa381('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0xa381('0x3')]=function(_0x5efd97){this[_0xa381('0x8')]=[];this[_0xa381('0x9')]=[];};RuleEngine['prototype'][_0xa381('0x5')]=function(_0xf9c5a6){if(Array[_0xa381('0xa')](_0xf9c5a6)){this[_0xa381('0x8')]=this['rules'][_0xa381('0xb')](_0xf9c5a6);}else if(_0xf9c5a6!==null&&_[_0xa381('0xc')](_0xf9c5a6)){this['rules']['push'](_0xf9c5a6);}this[_0xa381('0xd')]();};RuleEngine[_0xa381('0xe')][_0xa381('0xd')]=function(){this[_0xa381('0x9')]=this['rules'][_0xa381('0xf')](function(_0x3e7c27){if(_[_0xa381('0x4')](_0x3e7c27['on'])){_0x3e7c27['on']=!![];}if(_0x3e7c27['on']===!![]){return _0x3e7c27;}});this['activeRules']=_[_0xa381('0x10')](this[_0xa381('0x9')],['p'],[_0xa381('0x11')]);};RuleEngine[_0xa381('0xe')]['execute']=function(_0x26ff78,_0x410df1){var _0x2f98e7=![];_0x26ff78[_0xa381('0x12')]=!![];var _0x38e962=_[_0xa381('0x13')](_0x26ff78);var _0x3c778d=_[_0xa381('0x13')](_0x26ff78);var _0x57ac37=this[_0xa381('0x9')];var _0x35c96a=[];var _0x1bf052=this[_0xa381('0x6')];(function FnRuleLoop(_0x38cbb4){var _0x45f2aa={'rules':function(){return _0x57ac37;},'rule':function(){return _0x57ac37[_0x38cbb4];},'when':function(_0x6d57a7){if(_0x6d57a7){var _0x468b60=_0x57ac37[_0x38cbb4]['consequence'];_0x468b60[_0xa381('0x14')]=_0x57ac37[_0x38cbb4]['id']||_0x57ac37[_0x38cbb4][_0xa381('0x15')]||_0xa381('0x16')+_0x38cbb4;process[_0xa381('0x17')](function(){_0x35c96a[_0xa381('0x18')](_0x468b60[_0xa381('0x14')]);_0x468b60[_0xa381('0x19')](_0x38e962,_0x45f2aa);});}else{process[_0xa381('0x17')](function(){_0x45f2aa[_0xa381('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2f98e7=!![];return FnRuleLoop(0x0);},'next':function(_0x340ecb){if(!_0x1bf052&&!_[_0xa381('0x1b')](_0x3c778d,_0x38e962)){_0x3c778d=_[_0xa381('0x13')](_0x38e962);process['nextTick'](function(){_0x45f2aa[_0xa381('0x1c')]();});}else{process[_0xa381('0x17')](function(){if(_['isNil'](_0x340ecb)){return FnRuleLoop(_0x38cbb4+0x1);}else{return FnRuleLoop(_0x340ecb);}});}}};if(_0x38cbb4<_0x57ac37[_0xa381('0x1d')]&&_0x2f98e7===![]){var _0x1dc8f6=_0x57ac37[_0x38cbb4][_0xa381('0x1e')];_0x1dc8f6['call'](_0x38e962,_0x45f2aa);}else{process[_0xa381('0x17')](function(){_0x38e962['matchPath']=_0x35c96a;return _0x410df1?_0x410df1(_0x38e962):_['noop']();});}}(0x0));};RuleEngine[_0xa381('0xe')][_0xa381('0x1f')]=function(_0x49277c){if(_['isNil'](_0x49277c)){return this['rules'];}else{var _0x51061c=_['matches'](_0x49277c);return _['filter'](this[_0xa381('0x8')],_0x51061c);}};RuleEngine['prototype']['turn']=function(_0x51a0e6,_0x2c11c7){var _0x4bc732=_0x51a0e6==='on'||_0x51a0e6==='ON'?!![]:![];var _0x38cfc7=this[_0xa381('0x1f')](_0x2c11c7);for(var _0x40048c=0x0,_0x4c30e8=_0x38cfc7[_0xa381('0x1d')];_0x40048c<_0x4c30e8;_0x40048c+=0x1){_0x38cfc7[_0x40048c]['on']=_0x4bc732;}this[_0xa381('0xd')]();};RuleEngine[_0xa381('0xe')][_0xa381('0x20')]=function(_0x3caff3,_0x154786){_0x3caff3=parseInt(_0x3caff3,0xa);var _0x4b4aae=this[_0xa381('0x1f')](_0x154786);for(var _0x4853e7=0x0,_0x315f3c=_0x4b4aae[_0xa381('0x1d')];_0x4853e7<_0x315f3c;_0x4853e7+=0x1){_0x4b4aae[_0x4853e7]['priority']=_0x3caff3;}this[_0xa381('0xd')]();};RuleEngine[_0xa381('0xe')][_0xa381('0x21')]=function(){var _0x3b5263=this[_0xa381('0x8')];if(_0x3b5263 instanceof Array){_0x3b5263=_0x3b5263['map'](function(_0x1f78f7){_0x1f78f7[_0xa381('0x1e')]=_0x1f78f7['condition']['toString']();_0x1f78f7[_0xa381('0x22')]=_0x1f78f7[_0xa381('0x22')][_0xa381('0x23')]();return _0x1f78f7;});}else if(!_[_0xa381('0x4')](_0x3b5263)){_0x3b5263[_0xa381('0x1e')]=_0x3b5263[_0xa381('0x1e')]['toString']();_0x3b5263[_0xa381('0x22')]=_0x3b5263[_0xa381('0x22')][_0xa381('0x23')]();}return _0x3b5263;};RuleEngine['prototype'][_0xa381('0x24')]=function(_0x43ae98){this['init']();if(_[_0xa381('0x25')](_0x43ae98)){_0x43ae98=JSON[_0xa381('0x26')](_0x43ae98);}if(_0x43ae98 instanceof Array){_0x43ae98=_0x43ae98[_0xa381('0x27')](function(_0x464628){_0x464628['condition']=eval('('+_0x464628[_0xa381('0x1e')]+')');_0x464628['consequence']=eval('('+_0x464628[_0xa381('0x22')]+')');return _0x464628;});}else if(_0x43ae98!==null&&typeof _0x43ae98==_0xa381('0x28')){_0x43ae98[_0xa381('0x1e')]=eval('('+_0x43ae98['condition']+')');_0x43ae98[_0xa381('0x22')]=eval('('+_0x43ae98[_0xa381('0x22')]+')');}this[_0xa381('0x5')](_0x43ae98);};module[_0xa381('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index cecb953..ca0bcb3 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x3f9e92,_0x2257ff){var _0xd0bd1c=function(_0x25ca3a){while(--_0x25ca3a){_0x3f9e92['push'](_0x3f9e92['shift']());}};_0xd0bd1c(++_0x2257ff);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x259c03,_0x2ade9a){var _0x2d62c7=function(_0x452e65){while(--_0x452e65){_0x259c03['push'](_0x259c03['shift']());}};_0x2d62c7(++_0x2ade9a);}(_0x814b,0x1a2));var _0xb814=function(_0xee122e,_0x58ef2e){_0xee122e=_0xee122e-0x0;var _0x34f98a=_0x814b[_0xee122e];return _0x34f98a;};'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 diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 4c19c27..00a9ffd 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2fe3=['busyQueue','md5','updateRealtime','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','fax','sms','whatsapp','getChannelStatus','toNumber','Status','chatCapacity','whatsappStatus','emit','user:save','exports','lodash','moment','../../../config/environment','defaults','socket.io-emitter','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy'];(function(_0x8a1b6c,_0x3f10c4){var _0x1a8e81=function(_0x1cde0d){while(--_0x1cde0d){_0x8a1b6c['push'](_0x8a1b6c['shift']());}};_0x1a8e81(++_0x3f10c4);}(_0x2fe3,0x87));var _0x32fe=function(_0x3e47f8,_0x3eb8ff){_0x3e47f8=_0x3e47f8-0x0;var _0x149737=_0x2fe3[_0x3e47f8];return _0x149737;};'use strict';var _=require(_0x32fe('0x0'));var moment=require(_0x32fe('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x32fe('0x2'));config['redis']=_[_0x32fe('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x32fe('0x4'))(new Redis(config[_0x32fe('0x5')]));function Agent(_0x532c57){this['id']=_0x532c57['id']||0x0;this[_0x32fe('0x6')]=_0x532c57[_0x32fe('0x6')]||'';this[_0x32fe('0x7')]=_0x532c57[_0x32fe('0x7')]||!![];this[_0x32fe('0x8')]=_0x532c57[_0x32fe('0x8')]||![];this['chatPause']=_0x532c57[_0x32fe('0x9')]||![];this[_0x32fe('0xa')]=_0x532c57[_0x32fe('0xa')]||![];this[_0x32fe('0xb')]=_0x532c57['faxPause']||![];this['smsPause']=_0x532c57[_0x32fe('0xc')]||![];this[_0x32fe('0xd')]=_0x532c57[_0x32fe('0xd')]||![];this[_0x32fe('0xe')]='unknown';this[_0x32fe('0xf')]=0x0;this['chatCapacity']=_0x532c57['chatCapacity']||0x0;this[_0x32fe('0x10')]=0x0;this[_0x32fe('0x11')]=_0x32fe('0x12');this[_0x32fe('0x13')]=0x0;this[_0x32fe('0x14')]=_0x532c57[_0x32fe('0x14')]||0x0;this[_0x32fe('0x15')]=0x0;this[_0x32fe('0x16')]=_0x32fe('0x12');this[_0x32fe('0x17')]=0x0;this[_0x32fe('0x18')]=_0x532c57[_0x32fe('0x18')]||0x0;this[_0x32fe('0x19')]=0x0;this[_0x32fe('0x1a')]=_0x32fe('0x12');this['smsStatusTime']=0x0;this['smsCapacity']=_0x532c57[_0x32fe('0x1b')]||0x0;this[_0x32fe('0x1c')]=0x0;this['whatsappStatus']=_0x32fe('0x12');this[_0x32fe('0x1d')]=0x0;this[_0x32fe('0x1e')]=_0x532c57['whatsappCapacity']||0x0;this[_0x32fe('0x1f')]=0x0;this[_0x32fe('0x20')]=_0x32fe('0x12');this[_0x32fe('0x21')]=0x0;this['openchannelCapacity']=_0x532c57[_0x32fe('0x22')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x32fe('0x23')]=![];this[_0x32fe('0x24')]=undefined;this[_0x32fe('0x25')]='';this[_0x32fe('0x26')]();}Agent['prototype']['getChannelStatus']=function(_0x30f3d1){if(this[_0x30f3d1+_0x32fe('0x27')]>0x0){if(this[_0x30f3d1+_0x32fe('0x28')]>0x0&&this[_0x30f3d1+_0x32fe('0x27')]>=this[_0x30f3d1+_0x32fe('0x28')]){return _0x32fe('0x29');}else{return _0x32fe('0x2a');}}else{return _0x32fe('0x2b');}};Agent['prototype'][_0x32fe('0x26')]=function(){var _0x5a8331=[_0x32fe('0x2c'),_0x32fe('0x2d'),'openchannel',_0x32fe('0x2e'),_0x32fe('0x2f'),_0x32fe('0x30')];for(var _0x435b43=0x0;_0x435b43<_0x5a8331['length'];_0x435b43+=0x1){var _0x50e340=this[_0x32fe('0x31')](_0x5a8331[_0x435b43]);if(this[_0x5a8331[_0x435b43]+'Status']!==_0x50e340){this[_0x5a8331[_0x435b43]+'StatusTime']=_[_0x32fe('0x32')](moment()['format']('x'));}this[_0x5a8331[_0x435b43]+_0x32fe('0x33')]=_0x50e340;}var _0x9c9933={'id':this['id'],'name':this[_0x32fe('0x6')],'online':this[_0x32fe('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x32fe('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0x32fe('0xc')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x32fe('0xe')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x32fe('0x34')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x32fe('0x11')],'mailStatusTime':this[_0x32fe('0x13')],'mailCapacity':this[_0x32fe('0x14')],'mailCurrentCapacity':this[_0x32fe('0x15')],'faxStatus':this[_0x32fe('0x16')],'faxStatusTime':this[_0x32fe('0x17')],'faxCapacity':this[_0x32fe('0x18')],'faxCurrentCapacity':this[_0x32fe('0x19')],'smsStatus':this[_0x32fe('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x32fe('0x1b')],'smsCurrentCapacity':this[_0x32fe('0x1c')],'whatsappStatus':this[_0x32fe('0x35')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x32fe('0x1e')],'whatsappCurrentCapacity':this[_0x32fe('0x1f')],'openchannelStatus':this[_0x32fe('0x20')],'openchannelStatusTime':this[_0x32fe('0x21')],'openchannelCapacity':this[_0x32fe('0x22')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x32fe('0x24')]};var _0x239766=md5(JSON['stringify'](_0x9c9933));if(this[_0x32fe('0x25')]!==_0x239766){this[_0x32fe('0x25')]=_0x239766;io[_0x32fe('0x36')](_0x32fe('0x37'),_0x9c9933);}};module[_0x32fe('0x38')]=Agent; \ No newline at end of file +var _0x34ab=['mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','format','mailStatus','mailStatusTime','mailCurrentCapacity','faxStatus','smsStatusTime','whatsappCurrentCapacity','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','name','online','voicePause','chatPause'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x34ab,0x169));var _0xb34a=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x34ab[_0x5519a9];return _0x32f2cc;};'use strict';var _=require(_0xb34a('0x0'));var moment=require(_0xb34a('0x1'));var md5=require(_0xb34a('0x2'));var Redis=require(_0xb34a('0x3'));var config=require(_0xb34a('0x4'));config[_0xb34a('0x5')]=_[_0xb34a('0x6')](config[_0xb34a('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb34a('0x5')]));function Agent(_0x15bc3b){this['id']=_0x15bc3b['id']||0x0;this[_0xb34a('0x7')]=_0x15bc3b['name']||'';this[_0xb34a('0x8')]=_0x15bc3b[_0xb34a('0x8')]||!![];this[_0xb34a('0x9')]=_0x15bc3b[_0xb34a('0x9')]||![];this[_0xb34a('0xa')]=_0x15bc3b[_0xb34a('0xa')]||![];this[_0xb34a('0xb')]=_0x15bc3b[_0xb34a('0xb')]||![];this[_0xb34a('0xc')]=_0x15bc3b['faxPause']||![];this[_0xb34a('0xd')]=_0x15bc3b[_0xb34a('0xd')]||![];this[_0xb34a('0xe')]=_0x15bc3b['openchannelPause']||![];this[_0xb34a('0xf')]=_0xb34a('0x10');this[_0xb34a('0x11')]=0x0;this[_0xb34a('0x12')]=_0x15bc3b[_0xb34a('0x12')]||0x0;this[_0xb34a('0x13')]=0x0;this['mailStatus']='unknown';this['mailStatusTime']=0x0;this['mailCapacity']=_0x15bc3b[_0xb34a('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0xb34a('0x10');this[_0xb34a('0x15')]=0x0;this[_0xb34a('0x16')]=_0x15bc3b['faxCapacity']||0x0;this[_0xb34a('0x17')]=0x0;this[_0xb34a('0x18')]=_0xb34a('0x10');this['smsStatusTime']=0x0;this[_0xb34a('0x19')]=_0x15bc3b['smsCapacity']||0x0;this[_0xb34a('0x1a')]=0x0;this[_0xb34a('0x1b')]=_0xb34a('0x10');this[_0xb34a('0x1c')]=0x0;this[_0xb34a('0x1d')]=_0x15bc3b[_0xb34a('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xb34a('0x1e')]=_0xb34a('0x10');this[_0xb34a('0x1f')]=0x0;this[_0xb34a('0x20')]=_0x15bc3b['openchannelCapacity']||0x0;this[_0xb34a('0x21')]=0x0;this[_0xb34a('0x22')]=![];this[_0xb34a('0x23')]=undefined;this[_0xb34a('0x2')]='';this[_0xb34a('0x24')]();}Agent[_0xb34a('0x25')][_0xb34a('0x26')]=function(_0x1b0271){if(this[_0x1b0271+_0xb34a('0x27')]>0x0){if(this[_0x1b0271+'Capacity']>0x0&&this[_0x1b0271+_0xb34a('0x27')]>=this[_0x1b0271+_0xb34a('0x28')]){return'maxcapacity';}else{return _0xb34a('0x29');}}else{return _0xb34a('0x2a');}};Agent['prototype'][_0xb34a('0x24')]=function(){var _0x41c197=[_0xb34a('0x2b'),_0xb34a('0x2c'),_0xb34a('0x2d'),_0xb34a('0x2e'),_0xb34a('0x2f'),_0xb34a('0x30')];for(var _0x1aa03e=0x0;_0x1aa03e<_0x41c197[_0xb34a('0x31')];_0x1aa03e+=0x1){var _0x28afd8=this[_0xb34a('0x26')](_0x41c197[_0x1aa03e]);if(this[_0x41c197[_0x1aa03e]+_0xb34a('0x32')]!==_0x28afd8){this[_0x41c197[_0x1aa03e]+'StatusTime']=_['toNumber'](moment()[_0xb34a('0x33')]('x'));}this[_0x41c197[_0x1aa03e]+_0xb34a('0x32')]=_0x28afd8;}var _0x1b3115={'id':this['id'],'name':this[_0xb34a('0x7')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0xb34a('0xb')],'smsPause':this[_0xb34a('0xd')],'faxPause':this[_0xb34a('0xc')],'openchannelPause':this[_0xb34a('0xe')],'chatStatus':this[_0xb34a('0xf')],'chatStatusTime':this[_0xb34a('0x11')],'chatCapacity':this[_0xb34a('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xb34a('0x34')],'mailStatusTime':this[_0xb34a('0x35')],'mailCapacity':this[_0xb34a('0x14')],'mailCurrentCapacity':this[_0xb34a('0x36')],'faxStatus':this[_0xb34a('0x37')],'faxStatusTime':this[_0xb34a('0x15')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xb34a('0x38')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xb34a('0x1a')],'whatsappStatus':this[_0xb34a('0x1b')],'whatsappStatusTime':this[_0xb34a('0x1c')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xb34a('0x39')],'openchannelStatus':this[_0xb34a('0x1e')],'openchannelStatusTime':this[_0xb34a('0x1f')],'openchannelCapacity':this[_0xb34a('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x2621a6=md5(JSON[_0xb34a('0x3a')](_0x1b3115));if(this[_0xb34a('0x2')]!==_0x2621a6){this['md5']=_0x2621a6;io[_0xb34a('0x3b')](_0xb34a('0x3c'),_0x1b3115);}};module[_0xb34a('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index c1b6da4..1738969 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 _0x56f0=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','paused','length','loggedIn','chatPause','available','md5','format','chat:queue:%s','emit','chat_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis'];(function(_0x1c5742,_0x31c1a7){var _0x3fcf9f=function(_0x3e9939){while(--_0x3e9939){_0x1c5742['push'](_0x1c5742['shift']());}};_0x3fcf9f(++_0x31c1a7);}(_0x56f0,0x1ba));var _0x056f=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0x56f0[_0x45c48f];return _0xaf5037;};'use strict';var _=require(_0x056f('0x0'));var md5=require('md5');var util=require(_0x056f('0x1'));var Redis=require(_0x056f('0x2'));var config=require(_0x056f('0x3'));config['redis']=_[_0x056f('0x4')](config[_0x056f('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x056f('0x6'))(new Redis(config['redis']));function ChatQueue(_0x21616e){this['id']=_0x21616e['id']||0x0;this[_0x056f('0x7')]=_0x21616e[_0x056f('0x7')]||'';this[_0x056f('0x8')]=_0x21616e[_0x056f('0x8')]||0xa;this[_0x056f('0x9')]=_0x21616e[_0x056f('0x9')]||'beepall';this[_0x056f('0xa')]=_0x21616e['Agents'];this[_0x056f('0xb')]={};this[_0x056f('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0x056f('0xd')]();}ChatQueue[_0x056f('0xe')][_0x056f('0xf')]=function(){var _0x5e5c59=this[_0x056f('0xb')][_0x056f('0x10')];this[_0x056f('0xb')]=_[_0x056f('0x11')](this[_0x056f('0xa')],'id');this[_0x056f('0xb')]['_rr']=_0x5e5c59;};ChatQueue['prototype'][_0x056f('0xd')]=function(){this['loggedIn']=0x0;this[_0x056f('0x12')]=0x0;for(var _0x3c20fd=0x0;_0x3c20fd=0x0?this[_0x056f('0x16')]:0x0;var _0x20c0d8={'id':this['id'],'available':this[_0x056f('0x16')],'loggedIn':this[_0x056f('0x14')],'name':this['name'],'paused':this[_0x056f('0x12')],'waiting':this[_0x056f('0xc')]};var _0x214eca=md5(JSON['stringify'](_0x20c0d8));if(this[_0x056f('0x17')]!==_0x214eca){this[_0x056f('0x17')]=_0x214eca;io['to'](util[_0x056f('0x18')](_0x056f('0x19'),_0x20c0d8['name']))[_0x056f('0x1a')](_0x056f('0x1b'),_0x20c0d8);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xc4dc=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','format','emit','chat_queue:save'];(function(_0x1bce91,_0x2b6500){var _0x3c20c2=function(_0x1eeb06){while(--_0x1eeb06){_0x1bce91['push'](_0x1bce91['shift']());}};_0x3c20c2(++_0x2b6500);}(_0xc4dc,0xcb));var _0xcc4d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc4dc[_0x432682];return _0x463d05;};'use strict';var _=require(_0xcc4d('0x0'));var md5=require(_0xcc4d('0x1'));var util=require(_0xcc4d('0x2'));var Redis=require(_0xcc4d('0x3'));var config=require(_0xcc4d('0x4'));config[_0xcc4d('0x5')]=_[_0xcc4d('0x6')](config[_0xcc4d('0x5')],{'host':_0xcc4d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcc4d('0x5')]));function ChatQueue(_0x4524b4){this['id']=_0x4524b4['id']||0x0;this['name']=_0x4524b4[_0xcc4d('0x8')]||'';this[_0xcc4d('0x9')]=_0x4524b4[_0xcc4d('0x9')]||0xa;this[_0xcc4d('0xa')]=_0x4524b4[_0xcc4d('0xa')]||_0xcc4d('0xb');this['Agents']=_0x4524b4[_0xcc4d('0xc')];this[_0xcc4d('0xd')]={};this[_0xcc4d('0xe')]=0x0;this[_0xcc4d('0x1')]='';this[_0xcc4d('0xf')]();this[_0xcc4d('0x10')]();}ChatQueue[_0xcc4d('0x11')]['updateRouting']=function(){var _0x12bfbe=this[_0xcc4d('0xd')][_0xcc4d('0x12')];this['mapAgentsId']=_[_0xcc4d('0x13')](this[_0xcc4d('0xc')],'id');this[_0xcc4d('0xd')][_0xcc4d('0x12')]=_0x12bfbe;};ChatQueue['prototype'][_0xcc4d('0x10')]=function(){this[_0xcc4d('0x14')]=0x0;this[_0xcc4d('0x15')]=0x0;for(var _0xa1b01f=0x0;_0xa1b01f=0x0?this[_0xcc4d('0x19')]:0x0;var _0x149bb7={'id':this['id'],'available':this[_0xcc4d('0x19')],'loggedIn':this[_0xcc4d('0x14')],'name':this['name'],'paused':this[_0xcc4d('0x15')],'waiting':this[_0xcc4d('0xe')]};var _0x74b432=md5(JSON['stringify'](_0x149bb7));if(this['md5']!==_0x74b432){this[_0xcc4d('0x1')]=_0x74b432;io['to'](util[_0xcc4d('0x1a')]('chat:queue:%s',_0x149bb7['name']))[_0xcc4d('0x1b')](_0xcc4d('0x1c'),_0x149bb7);}};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 39cad07..992d054 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(_0x342c62,_0x158fda){var _0x5eb4a2=function(_0x1090ca){while(--_0x1090ca){_0x342c62['push'](_0x342c62['shift']());}};_0x5eb4a2(++_0x158fda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x37bfc7,_0x4816ca){var _0x13e5c2=function(_0x2b2aed){while(--_0x2b2aed){_0x37bfc7['push'](_0x37bfc7['shift']());}};_0x13e5c2(++_0x4816ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 46eea37..c552f5e 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 _0x0c78=['Intervals','exports'];(function(_0x44e6d4,_0x868699){var _0x529177=function(_0x58cc61){while(--_0x58cc61){_0x44e6d4['push'](_0x44e6d4['shift']());}};_0x529177(++_0x868699);}(_0x0c78,0x176));var _0x80c7=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x0c78[_0x13b8f3];return _0x1a6d06;};'use strict';function Interval(_0x21dde6){this['id']=_0x21dde6['id']||0x0;this['name']=_0x21dde6['name']||'';this[_0x80c7('0x0')]=_0x21dde6[_0x80c7('0x0')]||{};}module[_0x80c7('0x1')]=Interval; \ No newline at end of file +var _0x30e4=['Intervals','exports','name'];(function(_0x10e322,_0x1f84a7){var _0x16a92=function(_0xab5e76){while(--_0xab5e76){_0x10e322['push'](_0x10e322['shift']());}};_0x16a92(++_0x1f84a7);}(_0x30e4,0xa7));var _0x430e=function(_0x2abe4c,_0x1a629c){_0x2abe4c=_0x2abe4c-0x0;var _0x4d843f=_0x30e4[_0x2abe4c];return _0x4d843f;};'use strict';function Interval(_0x2654eb){this['id']=_0x2654eb['id']||0x0;this[_0x430e('0x0')]=_0x2654eb[_0x430e('0x0')]||'';this[_0x430e('0x1')]=_0x2654eb['Intervals']||{};}module[_0x430e('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 d11ee0d..6914345 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 _0x9901=['stringify','mail:queue:%s','name','emit','mail_queue:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','online','mailPause','paused','available'];(function(_0x90841e,_0x5bb5d2){var _0x3e9249=function(_0x2340e4){while(--_0x2340e4){_0x90841e['push'](_0x90841e['shift']());}};_0x3e9249(++_0x5bb5d2);}(_0x9901,0x1bf));var _0x1990=function(_0x4de8c4,_0x75f17f){_0x4de8c4=_0x4de8c4-0x0;var _0x276b10=_0x9901[_0x4de8c4];return _0x276b10;};'use strict';var _=require('lodash');var md5=require(_0x1990('0x0'));var util=require('util');var Redis=require(_0x1990('0x1'));var config=require(_0x1990('0x2'));config[_0x1990('0x3')]=_[_0x1990('0x4')](config['redis'],{'host':_0x1990('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x29a081){this['id']=_0x29a081['id']||0x0;this['name']=_0x29a081['name']||'';this[_0x1990('0x6')]=_0x29a081[_0x1990('0x6')]||0xa;this[_0x1990('0x7')]=_0x29a081['strategy']||'beepall';this['Agents']=_0x29a081[_0x1990('0x8')];this[_0x1990('0x9')]={};this[_0x1990('0xa')]=0x0;this['md5']='';this[_0x1990('0xb')]();this[_0x1990('0xc')]();}MailQueue[_0x1990('0xd')][_0x1990('0xb')]=function(){var _0x289c25=this[_0x1990('0x9')][_0x1990('0xe')];this[_0x1990('0x9')]=_['map'](this[_0x1990('0x8')],'id');this[_0x1990('0x9')][_0x1990('0xe')]=_0x289c25;};MailQueue[_0x1990('0xd')][_0x1990('0xc')]=function(){this[_0x1990('0xf')]=0x0;this['paused']=0x0;for(var _0x472d8a=0x0;_0x472d8a=0x0?this[_0x1990('0x14')]:0x0;var _0x1a5f4e={'id':this['id'],'available':this[_0x1990('0x14')],'loggedIn':this[_0x1990('0xf')],'name':this['name'],'paused':this[_0x1990('0x13')],'waiting':this[_0x1990('0xa')]};var _0x3040ae=md5(JSON[_0x1990('0x15')](_0x1a5f4e));if(this[_0x1990('0x0')]!==_0x3040ae){this['md5']=_0x3040ae;io['to'](util['format'](_0x1990('0x16'),_0x1a5f4e[_0x1990('0x17')]))[_0x1990('0x18')](_0x1990('0x19'),_0x1a5f4e);}};module['exports']=MailQueue; \ No newline at end of file +var _0x0c80=['mapAgentsId','waiting','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','paused','online','available','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0x0c80,0x7a));var _0x00c8=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x0c80[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x00c8('0x0'));var md5=require(_0x00c8('0x1'));var util=require(_0x00c8('0x2'));var Redis=require(_0x00c8('0x3'));var config=require('../../../config/environment');config[_0x00c8('0x4')]=_[_0x00c8('0x5')](config[_0x00c8('0x4')],{'host':_0x00c8('0x6'),'port':0x18eb});var io=require(_0x00c8('0x7'))(new Redis(config[_0x00c8('0x4')]));function MailQueue(_0xed8c47){this['id']=_0xed8c47['id']||0x0;this[_0x00c8('0x8')]=_0xed8c47[_0x00c8('0x8')]||'';this[_0x00c8('0x9')]=_0xed8c47[_0x00c8('0x9')]||0xa;this[_0x00c8('0xa')]=_0xed8c47[_0x00c8('0xa')]||_0x00c8('0xb');this['Agents']=_0xed8c47[_0x00c8('0xc')];this[_0x00c8('0xd')]={};this[_0x00c8('0xe')]=0x0;this[_0x00c8('0x1')]='';this[_0x00c8('0xf')]();this['updateRealtime']();}MailQueue[_0x00c8('0x10')][_0x00c8('0xf')]=function(){var _0x38a3f0=this[_0x00c8('0xd')]['_rr'];this[_0x00c8('0xd')]=_[_0x00c8('0x11')](this[_0x00c8('0xc')],'id');this[_0x00c8('0xd')][_0x00c8('0x12')]=_0x38a3f0;};MailQueue[_0x00c8('0x10')][_0x00c8('0x13')]=function(){this[_0x00c8('0x14')]=0x0;this[_0x00c8('0x15')]=0x0;for(var _0x39d838=0x0;_0x39d838=0x0?this[_0x00c8('0x17')]:0x0;var _0x39f65b={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x00c8('0x8')],'paused':this[_0x00c8('0x15')],'waiting':this['waiting']};var _0x160612=md5(JSON['stringify'](_0x39f65b));if(this['md5']!==_0x160612){this['md5']=_0x160612;io['to'](util['format'](_0x00c8('0x18'),_0x39f65b[_0x00c8('0x8')]))[_0x00c8('0x19')](_0x00c8('0x1a'),_0x39f65b);}};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 295d457..afa00fc 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 _0x36ce=['format','openchannel:queue:%s','emit','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','length','online','openchannelPause','paused','available'];(function(_0x11270e,_0x3f7c7e){var _0x561007=function(_0x3ed1c8){while(--_0x3ed1c8){_0x11270e['push'](_0x11270e['shift']());}};_0x561007(++_0x3f7c7e);}(_0x36ce,0x15a));var _0xe36c=function(_0x4c17c3,_0x1b13c3){_0x4c17c3=_0x4c17c3-0x0;var _0x1275ca=_0x36ce[_0x4c17c3];return _0x1275ca;};'use strict';var _=require('lodash');var md5=require(_0xe36c('0x0'));var util=require(_0xe36c('0x1'));var Redis=require(_0xe36c('0x2'));var config=require(_0xe36c('0x3'));config[_0xe36c('0x4')]=_[_0xe36c('0x5')](config['redis'],{'host':_0xe36c('0x6'),'port':0x18eb});var io=require(_0xe36c('0x7'))(new Redis(config[_0xe36c('0x4')]));function OpenchannelQueue(_0x7c584a){this['id']=_0x7c584a['id']||0x0;this['name']=_0x7c584a[_0xe36c('0x8')]||'';this[_0xe36c('0x9')]=_0x7c584a[_0xe36c('0x9')]||0xa;this[_0xe36c('0xa')]=_0x7c584a[_0xe36c('0xa')]||_0xe36c('0xb');this['Agents']=_0x7c584a[_0xe36c('0xc')];this['mapAgentsId']={};this[_0xe36c('0xd')]=0x0;this[_0xe36c('0x0')]='';this[_0xe36c('0xe')]();this[_0xe36c('0xf')]();}OpenchannelQueue[_0xe36c('0x10')][_0xe36c('0xe')]=function(){var _0xbe0e90=this[_0xe36c('0x11')]['_rr'];this[_0xe36c('0x11')]=_[_0xe36c('0x12')](this[_0xe36c('0xc')],'id');this[_0xe36c('0x11')][_0xe36c('0x13')]=_0xbe0e90;};OpenchannelQueue[_0xe36c('0x10')][_0xe36c('0xf')]=function(){this[_0xe36c('0x14')]=0x0;this['paused']=0x0;for(var _0x538052=0x0;_0x538052=0x0?this[_0xe36c('0x19')]:0x0;var _0x36b460={'id':this['id'],'available':this[_0xe36c('0x19')],'loggedIn':this[_0xe36c('0x14')],'name':this[_0xe36c('0x8')],'paused':this['paused'],'waiting':this[_0xe36c('0xd')]};var _0x1ea3a9=md5(JSON['stringify'](_0x36b460));if(this[_0xe36c('0x0')]!==_0x1ea3a9){this['md5']=_0x1ea3a9;io['to'](util[_0xe36c('0x1a')](_0xe36c('0x1b'),_0x36b460[_0xe36c('0x8')]))[_0xe36c('0x1c')](_0xe36c('0x1d'),_0x36b460);}};module[_0xe36c('0x1e')]=OpenchannelQueue; \ No newline at end of file +var _0xfff0=['strategy','Agents','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','length','openchannelPause','paused','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x1e9429,_0x503a3b){var _0x3f80d6=function(_0x4d8e6a){while(--_0x4d8e6a){_0x1e9429['push'](_0x1e9429['shift']());}};_0x3f80d6(++_0x503a3b);}(_0xfff0,0x1c3));var _0x0fff=function(_0x299206,_0x4fad51){_0x299206=_0x299206-0x0;var _0x279737=_0xfff0[_0x299206];return _0x279737;};'use strict';var _=require(_0x0fff('0x0'));var md5=require(_0x0fff('0x1'));var util=require(_0x0fff('0x2'));var Redis=require('ioredis');var config=require(_0x0fff('0x3'));config[_0x0fff('0x4')]=_['defaults'](config[_0x0fff('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x0fff('0x5'))(new Redis(config[_0x0fff('0x4')]));function OpenchannelQueue(_0x735340){this['id']=_0x735340['id']||0x0;this[_0x0fff('0x6')]=_0x735340[_0x0fff('0x6')]||'';this[_0x0fff('0x7')]=_0x735340[_0x0fff('0x7')]||0xa;this[_0x0fff('0x8')]=_0x735340['strategy']||'beepall';this[_0x0fff('0x9')]=_0x735340[_0x0fff('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x0fff('0x1')]='';this[_0x0fff('0xa')]();this['updateRealtime']();}OpenchannelQueue[_0x0fff('0xb')][_0x0fff('0xa')]=function(){var _0x2ee5e9=this[_0x0fff('0xc')][_0x0fff('0xd')];this['mapAgentsId']=_[_0x0fff('0xe')](this[_0x0fff('0x9')],'id');this[_0x0fff('0xc')][_0x0fff('0xd')]=_0x2ee5e9;};OpenchannelQueue['prototype'][_0x0fff('0xf')]=function(){this[_0x0fff('0x10')]=0x0;this['paused']=0x0;for(var _0x334094=0x0;_0x334094=0x0?this[_0x0fff('0x14')]:0x0;var _0x3b1d1f={'id':this['id'],'available':this[_0x0fff('0x14')],'loggedIn':this[_0x0fff('0x10')],'name':this[_0x0fff('0x6')],'paused':this[_0x0fff('0x13')],'waiting':this['waiting']};var _0x5bfedc=md5(JSON[_0x0fff('0x15')](_0x3b1d1f));if(this['md5']!==_0x5bfedc){this[_0x0fff('0x1')]=_0x5bfedc;io['to'](util[_0x0fff('0x16')](_0x0fff('0x17'),_0x3b1d1f[_0x0fff('0x6')]))[_0x0fff('0x18')](_0x0fff('0x19'),_0x3b1d1f);}};module[_0x0fff('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 3432588..6b95cf1 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 _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x4af6bb,_0x2ca5d1){var _0x4a4981=function(_0x381135){while(--_0x381135){_0x4af6bb['push'](_0x4af6bb['shift']());}};_0x4a4981(++_0x2ca5d1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file +var _0xcb91=['loggedIn','paused','length','online','available','stringify','sms:queue:%s','emit','sms_queue:save','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map'];(function(_0x47038e,_0x490251){var _0x3d7ec6=function(_0x1831a5){while(--_0x1831a5){_0x47038e['push'](_0x47038e['shift']());}};_0x3d7ec6(++_0x490251);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xcb91[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1cb9('0x0'));var Redis=require(_0x1cb9('0x1'));var config=require(_0x1cb9('0x2'));config[_0x1cb9('0x3')]=_['defaults'](config[_0x1cb9('0x3')],{'host':_0x1cb9('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x3')]));function SmsQueue(_0x1b26cd){this['id']=_0x1b26cd['id']||0x0;this['name']=_0x1b26cd[_0x1cb9('0x5')]||'';this[_0x1cb9('0x6')]=_0x1b26cd['timeout']||0xa;this[_0x1cb9('0x7')]=_0x1b26cd[_0x1cb9('0x7')]||'beepall';this[_0x1cb9('0x8')]=_0x1b26cd['Agents'];this['mapAgentsId']={};this[_0x1cb9('0x9')]=0x0;this[_0x1cb9('0xa')]='';this[_0x1cb9('0xb')]();this[_0x1cb9('0xc')]();}SmsQueue[_0x1cb9('0xd')]['updateRouting']=function(){var _0x9b58f1=this[_0x1cb9('0xe')][_0x1cb9('0xf')];this[_0x1cb9('0xe')]=_[_0x1cb9('0x10')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x9b58f1;};SmsQueue[_0x1cb9('0xd')][_0x1cb9('0xc')]=function(){this[_0x1cb9('0x11')]=0x0;this[_0x1cb9('0x12')]=0x0;for(var _0x56884d=0x0;_0x56884d=0x0?this[_0x1cb9('0x15')]:0x0;var _0x4e1340={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1cb9('0x11')],'name':this[_0x1cb9('0x5')],'paused':this[_0x1cb9('0x12')],'waiting':this[_0x1cb9('0x9')]};var _0x280a84=md5(JSON[_0x1cb9('0x16')](_0x4e1340));if(this[_0x1cb9('0xa')]!==_0x280a84){this['md5']=_0x280a84;io['to'](util['format'](_0x1cb9('0x17'),_0x4e1340['name']))[_0x1cb9('0x18')](_0x1cb9('0x19'),_0x4e1340);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index a2ba85d..b035257 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 _0x141a=['waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp_queue:save','exports','lodash','md5','util','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x484432,_0x132d67){var _0x4ff446=function(_0x5c82af){while(--_0x5c82af){_0x484432['push'](_0x484432['shift']());}};_0x4ff446(++_0x132d67);}(_0x141a,0xf9));var _0xa141=function(_0x4c7d67,_0x4f47c8){_0x4c7d67=_0x4c7d67-0x0;var _0x4b2781=_0x141a[_0x4c7d67];return _0x4b2781;};'use strict';var _=require(_0xa141('0x0'));var md5=require(_0xa141('0x1'));var util=require(_0xa141('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xa141('0x3')]=_[_0xa141('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa141('0x3')]));function WhatsappQueue(_0x144a75){this['id']=_0x144a75['id']||0x0;this[_0xa141('0x5')]=_0x144a75['name']||'';this[_0xa141('0x6')]=_0x144a75[_0xa141('0x6')]||0xa;this[_0xa141('0x7')]=_0x144a75[_0xa141('0x7')]||_0xa141('0x8');this[_0xa141('0x9')]=_0x144a75['Agents'];this[_0xa141('0xa')]={};this[_0xa141('0xb')]=0x0;this['md5']='';this[_0xa141('0xc')]();this[_0xa141('0xd')]();}WhatsappQueue['prototype'][_0xa141('0xc')]=function(){var _0xfffa9c=this[_0xa141('0xa')]['_rr'];this[_0xa141('0xa')]=_[_0xa141('0xe')](this[_0xa141('0x9')],'id');this[_0xa141('0xa')][_0xa141('0xf')]=_0xfffa9c;};WhatsappQueue[_0xa141('0x10')][_0xa141('0xd')]=function(){this[_0xa141('0x11')]=0x0;this[_0xa141('0x12')]=0x0;for(var _0x10ce1e=0x0;_0x10ce1e=0x0?this[_0xa141('0x15')]:0x0;var _0x3cc7d3={'id':this['id'],'available':this[_0xa141('0x15')],'loggedIn':this[_0xa141('0x11')],'name':this['name'],'paused':this[_0xa141('0x12')],'waiting':this[_0xa141('0xb')]};var _0x203374=md5(JSON[_0xa141('0x16')](_0x3cc7d3));if(this['md5']!==_0x203374){this[_0xa141('0x1')]=_0x203374;io['to'](util[_0xa141('0x17')]('whatsapp:queue:%s',_0x3cc7d3['name']))['emit'](_0xa141('0x18'),_0x3cc7d3);}};module[_0xa141('0x19')]=WhatsappQueue; \ No newline at end of file +var _0xe441=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','available','paused','stringify','format','whatsapp:queue:%s','emit','exports','lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name'];(function(_0x2c5ae4,_0xe798ba){var _0x1c206f=function(_0x11b7dd){while(--_0x11b7dd){_0x2c5ae4['push'](_0x2c5ae4['shift']());}};_0x1c206f(++_0xe798ba);}(_0xe441,0x18f));var _0x1e44=function(_0x460f50,_0xe404f8){_0x460f50=_0x460f50-0x0;var _0x503c2d=_0xe441[_0x460f50];return _0x503c2d;};'use strict';var _=require(_0x1e44('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x1e44('0x1'));var config=require(_0x1e44('0x2'));config['redis']=_['defaults'](config[_0x1e44('0x3')],{'host':_0x1e44('0x4'),'port':0x18eb});var io=require(_0x1e44('0x5'))(new Redis(config[_0x1e44('0x3')]));function WhatsappQueue(_0xf11190){this['id']=_0xf11190['id']||0x0;this['name']=_0xf11190[_0x1e44('0x6')]||'';this[_0x1e44('0x7')]=_0xf11190[_0x1e44('0x7')]||0xa;this[_0x1e44('0x8')]=_0xf11190['strategy']||_0x1e44('0x9');this['Agents']=_0xf11190[_0x1e44('0xa')];this[_0x1e44('0xb')]={};this[_0x1e44('0xc')]=0x0;this[_0x1e44('0xd')]='';this[_0x1e44('0xe')]();this[_0x1e44('0xf')]();}WhatsappQueue[_0x1e44('0x10')][_0x1e44('0xe')]=function(){var _0xf0bfaa=this[_0x1e44('0xb')][_0x1e44('0x11')];this[_0x1e44('0xb')]=_[_0x1e44('0x12')](this[_0x1e44('0xa')],'id');this[_0x1e44('0xb')]['_rr']=_0xf0bfaa;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x1e44('0x13')]=0x0;this['paused']=0x0;for(var _0x5ad02f=0x0;_0x5ad02f=0x0?this[_0x1e44('0x16')]:0x0;var _0x2f7d82={'id':this['id'],'available':this[_0x1e44('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x1e44('0x17')],'waiting':this['waiting']};var _0xb661ba=md5(JSON[_0x1e44('0x18')](_0x2f7d82));if(this[_0x1e44('0xd')]!==_0xb661ba){this['md5']=_0xb661ba;io['to'](util[_0x1e44('0x19')](_0x1e44('0x1a'),_0x2f7d82[_0x1e44('0x6')]))[_0x1e44('0x1b')]('whatsapp_queue:save',_0x2f7d82);}};module[_0x1e44('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 00dbfdc..0294530 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 _0x4b84=['../model/agent','../model/chatQueue','../model/smsQueue','../model/mailQueue','intervals','chatQueues','mailQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty','agents','isUndefined','mergeFromDatabase','length','initOpenchannelQueues','openchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','bluebird','util'];(function(_0x537c8c,_0x37d938){var _0x41987c=function(_0x550c05){while(--_0x550c05){_0x537c8c['push'](_0x537c8c['shift']());}};_0x41987c(++_0x37d938);}(_0x4b84,0x1cc));var _0x44b8=function(_0x25fc41,_0x250864){_0x25fc41=_0x25fc41-0x0;var _0x1371d1=_0x4b84[_0x25fc41];return _0x1371d1;};'use strict';var BPromise=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x44b8('0x2'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x44b8('0x3'));var SmsQueue=require(_0x44b8('0x4'));var MailQueue=require(_0x44b8('0x5'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this[_0x44b8('0x6')]={};this['openchannelQueues']={};this[_0x44b8('0x7')]={};this['smsQueues']={};this[_0x44b8('0x8')]={};this['faxQueues']={};this['whatsappQueues']={};this[_0x44b8('0x9')]={};this[_0x44b8('0xa')]={};this[_0x44b8('0xb')]={};this['smsQueuesWaitingInteractions']={};this[_0x44b8('0xc')]={};this[_0x44b8('0xd')]={};};function freeIsNotKey(_0x4315f6,_0x9b6048,_0x24dd10){var _0x37e471=_[_0x44b8('0xe')](_0x4315f6,function(_0x4ae8a1,_0x147529){return _0x4ae8a1[_0x24dd10];});for(var _0x4301a6 in _0x9b6048){if(_0x9b6048['hasOwnProperty'](_0x4301a6)){if(!_0x37e471[_0x4301a6]){delete _0x9b6048[_0x4301a6];}}}}Realtime[_0x44b8('0xf')]['mergeFromDatabase']=function(_0x833ea3,_0x18d642){for(var _0x4df670 in _0x18d642){if(_0x833ea3[_0x44b8('0x10')](_0x4df670)){_0x833ea3[_0x4df670]=_0x18d642[_0x4df670];}}};Realtime['prototype']['initAgents']=function(){var _0x2a3e4c=this;return function(_0x2af0ad){if(_0x2af0ad){freeIsNotKey(_0x2af0ad,_0x2a3e4c[_0x44b8('0x11')],'id');for(var _0x41ab46=0x0,_0x5e52f2={},_0x495c74={};_0x41ab46<_0x2af0ad['length'];_0x41ab46+=0x1){_0x5e52f2=_0x2af0ad[_0x41ab46];if(_[_0x44b8('0x12')](_0x2a3e4c['agents'][_0x5e52f2['id']])){_0x2a3e4c[_0x44b8('0x11')][_0x5e52f2['id']]=new Agent(_0x5e52f2);}else{_0x2a3e4c[_0x44b8('0x13')](_0x2a3e4c['agents'][_0x5e52f2['id']],_0x5e52f2);}}}return _0x2a3e4c[_0x44b8('0x11')];};};Realtime[_0x44b8('0xf')]['initIntervals']=function(){var _0x89bc30=this;return function(_0x3f4688){if(_0x3f4688){freeIsNotKey(_0x3f4688,_0x89bc30['intervals'],'id');for(var _0xcce202=0x0,_0x8b4301={},_0xebfe79={};_0xcce202<_0x3f4688[_0x44b8('0x14')];_0xcce202+=0x1){_0x8b4301=_0x3f4688[_0xcce202];if(_[_0x44b8('0x12')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']])){_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']]=new Interval(_0x8b4301);}else{_0x89bc30[_0x44b8('0x13')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']],_0x8b4301);}}}return _0x89bc30[_0x44b8('0x6')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x15')]=function(){var _0x48327e=this;return function(_0x56549a){if(_0x56549a){freeIsNotKey(_0x56549a,_0x48327e[_0x44b8('0x16')],'id');for(var _0x416b34=0x0,_0x1418db={},_0x305a5c={};_0x416b34<_0x56549a['length'];_0x416b34+=0x1){_0x1418db=_0x56549a[_0x416b34];if(_[_0x44b8('0x12')](_0x48327e['openchannelQueues'][_0x1418db['id']])){_0x48327e[_0x44b8('0x16')][_0x1418db['id']]=new OpenchannelQueue(_0x1418db);}else{_0x48327e[_0x44b8('0x13')](_0x48327e[_0x44b8('0x16')][_0x1418db['id']],_0x1418db);}_0x48327e[_0x44b8('0x16')][_0x1418db['id']][_0x44b8('0x17')]();_0x48327e['openchannelQueues'][_0x1418db['id']][_0x44b8('0x18')]();}}return _0x48327e['openchannelQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x19')]=function(){var _0x549a26=this;return function(_0x17ac44){if(_0x17ac44){freeIsNotKey(_0x17ac44,_0x549a26[_0x44b8('0x7')],'id');for(var _0x2656d7=0x0,_0x59c1bf={},_0xb22107={};_0x2656d7<_0x17ac44[_0x44b8('0x14')];_0x2656d7+=0x1){_0x59c1bf=_0x17ac44[_0x2656d7];if(_['isUndefined'](_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']])){_0x549a26['chatQueues'][_0x59c1bf['id']]=new ChatQueue(_0x59c1bf);}else{_0x549a26[_0x44b8('0x13')](_0x549a26['chatQueues'][_0x59c1bf['id']],_0x59c1bf);}_0x549a26['chatQueues'][_0x59c1bf['id']]['updateRouting']();_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']][_0x44b8('0x18')]();}}return _0x549a26[_0x44b8('0x7')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1a')]=function(){var _0xc3f667=this;return function(_0x2cf205){if(_0x2cf205){freeIsNotKey(_0x2cf205,_0xc3f667[_0x44b8('0x1b')],'id');for(var _0xd1d320=0x0,_0x28f918={},_0x5e1129={};_0xd1d320<_0x2cf205[_0x44b8('0x14')];_0xd1d320+=0x1){_0x28f918=_0x2cf205[_0xd1d320];if(_[_0x44b8('0x12')](_0xc3f667['smsQueues'][_0x28f918['id']])){_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']]=new SmsQueue(_0x28f918);}else{_0xc3f667['mergeFromDatabase'](_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']],_0x28f918);}_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x17')]();_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x18')]();}}return _0xc3f667['smsQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1c')]=function(){var _0x26265f=this;return function(_0x339f0f){if(_0x339f0f){freeIsNotKey(_0x339f0f,_0x26265f[_0x44b8('0x8')],'id');for(var _0x5f541d=0x0,_0x3875a5={},_0x400edc={};_0x5f541d<_0x339f0f[_0x44b8('0x14')];_0x5f541d+=0x1){_0x3875a5=_0x339f0f[_0x5f541d];if(_[_0x44b8('0x12')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']])){_0x26265f[_0x44b8('0x8')][_0x3875a5['id']]=new MailQueue(_0x3875a5);}else{_0x26265f[_0x44b8('0x13')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']],_0x3875a5);}_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x17')]();_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x18')]();}}return _0x26265f[_0x44b8('0x8')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1d')]=function(){var _0x1becb0=this;return function(_0x323c50){if(_0x323c50){freeIsNotKey(_0x323c50,_0x1becb0[_0x44b8('0x1e')],'id');for(var _0x28faa9=0x0,_0x3984f8={},_0x2c02d6={};_0x28faa9<_0x323c50[_0x44b8('0x14')];_0x28faa9+=0x1){_0x3984f8=_0x323c50[_0x28faa9];if(_['isUndefined'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']])){_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]=new FaxQueue(_0x3984f8);}else{_0x1becb0['mergeFromDatabase'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']],_0x3984f8);}_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']][_0x44b8('0x17')]();_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]['updateRealtime']();}}return _0x1becb0[_0x44b8('0x1e')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1f')]=function(){var _0x1ee3cc=this;return function(_0x9cb2a){if(_0x9cb2a){freeIsNotKey(_0x9cb2a,_0x1ee3cc[_0x44b8('0x20')],'id');for(var _0x46aadd=0x0,_0x3581b8={},_0x209039={};_0x46aadd<_0x9cb2a[_0x44b8('0x14')];_0x46aadd+=0x1){_0x3581b8=_0x9cb2a[_0x46aadd];if(_[_0x44b8('0x12')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']])){_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]=new WhatsappQueue(_0x3581b8);}else{_0x1ee3cc[_0x44b8('0x13')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']],_0x3581b8);}_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]['updateRouting']();_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']][_0x44b8('0x18')]();}}return _0x1ee3cc[_0x44b8('0x20')];};};module['exports']=Realtime; \ No newline at end of file +var _0x4b84=['../model/agent','../model/chatQueue','../model/smsQueue','../model/mailQueue','intervals','chatQueues','mailQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty','agents','isUndefined','mergeFromDatabase','length','initOpenchannelQueues','openchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','bluebird','util'];(function(_0x1b911a,_0x25b38a){var _0x10c915=function(_0x2c833c){while(--_0x2c833c){_0x1b911a['push'](_0x1b911a['shift']());}};_0x10c915(++_0x25b38a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0x4b84[_0x36feb2];return _0x292b43;};'use strict';var BPromise=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x44b8('0x2'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x44b8('0x3'));var SmsQueue=require(_0x44b8('0x4'));var MailQueue=require(_0x44b8('0x5'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this[_0x44b8('0x6')]={};this['openchannelQueues']={};this[_0x44b8('0x7')]={};this['smsQueues']={};this[_0x44b8('0x8')]={};this['faxQueues']={};this['whatsappQueues']={};this[_0x44b8('0x9')]={};this[_0x44b8('0xa')]={};this[_0x44b8('0xb')]={};this['smsQueuesWaitingInteractions']={};this[_0x44b8('0xc')]={};this[_0x44b8('0xd')]={};};function freeIsNotKey(_0x4315f6,_0x9b6048,_0x24dd10){var _0x37e471=_[_0x44b8('0xe')](_0x4315f6,function(_0x4ae8a1,_0x147529){return _0x4ae8a1[_0x24dd10];});for(var _0x4301a6 in _0x9b6048){if(_0x9b6048['hasOwnProperty'](_0x4301a6)){if(!_0x37e471[_0x4301a6]){delete _0x9b6048[_0x4301a6];}}}}Realtime[_0x44b8('0xf')]['mergeFromDatabase']=function(_0x833ea3,_0x18d642){for(var _0x4df670 in _0x18d642){if(_0x833ea3[_0x44b8('0x10')](_0x4df670)){_0x833ea3[_0x4df670]=_0x18d642[_0x4df670];}}};Realtime['prototype']['initAgents']=function(){var _0x2a3e4c=this;return function(_0x2af0ad){if(_0x2af0ad){freeIsNotKey(_0x2af0ad,_0x2a3e4c[_0x44b8('0x11')],'id');for(var _0x41ab46=0x0,_0x5e52f2={},_0x495c74={};_0x41ab46<_0x2af0ad['length'];_0x41ab46+=0x1){_0x5e52f2=_0x2af0ad[_0x41ab46];if(_[_0x44b8('0x12')](_0x2a3e4c['agents'][_0x5e52f2['id']])){_0x2a3e4c[_0x44b8('0x11')][_0x5e52f2['id']]=new Agent(_0x5e52f2);}else{_0x2a3e4c[_0x44b8('0x13')](_0x2a3e4c['agents'][_0x5e52f2['id']],_0x5e52f2);}}}return _0x2a3e4c[_0x44b8('0x11')];};};Realtime[_0x44b8('0xf')]['initIntervals']=function(){var _0x89bc30=this;return function(_0x3f4688){if(_0x3f4688){freeIsNotKey(_0x3f4688,_0x89bc30['intervals'],'id');for(var _0xcce202=0x0,_0x8b4301={},_0xebfe79={};_0xcce202<_0x3f4688[_0x44b8('0x14')];_0xcce202+=0x1){_0x8b4301=_0x3f4688[_0xcce202];if(_[_0x44b8('0x12')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']])){_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']]=new Interval(_0x8b4301);}else{_0x89bc30[_0x44b8('0x13')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']],_0x8b4301);}}}return _0x89bc30[_0x44b8('0x6')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x15')]=function(){var _0x48327e=this;return function(_0x56549a){if(_0x56549a){freeIsNotKey(_0x56549a,_0x48327e[_0x44b8('0x16')],'id');for(var _0x416b34=0x0,_0x1418db={},_0x305a5c={};_0x416b34<_0x56549a['length'];_0x416b34+=0x1){_0x1418db=_0x56549a[_0x416b34];if(_[_0x44b8('0x12')](_0x48327e['openchannelQueues'][_0x1418db['id']])){_0x48327e[_0x44b8('0x16')][_0x1418db['id']]=new OpenchannelQueue(_0x1418db);}else{_0x48327e[_0x44b8('0x13')](_0x48327e[_0x44b8('0x16')][_0x1418db['id']],_0x1418db);}_0x48327e[_0x44b8('0x16')][_0x1418db['id']][_0x44b8('0x17')]();_0x48327e['openchannelQueues'][_0x1418db['id']][_0x44b8('0x18')]();}}return _0x48327e['openchannelQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x19')]=function(){var _0x549a26=this;return function(_0x17ac44){if(_0x17ac44){freeIsNotKey(_0x17ac44,_0x549a26[_0x44b8('0x7')],'id');for(var _0x2656d7=0x0,_0x59c1bf={},_0xb22107={};_0x2656d7<_0x17ac44[_0x44b8('0x14')];_0x2656d7+=0x1){_0x59c1bf=_0x17ac44[_0x2656d7];if(_['isUndefined'](_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']])){_0x549a26['chatQueues'][_0x59c1bf['id']]=new ChatQueue(_0x59c1bf);}else{_0x549a26[_0x44b8('0x13')](_0x549a26['chatQueues'][_0x59c1bf['id']],_0x59c1bf);}_0x549a26['chatQueues'][_0x59c1bf['id']]['updateRouting']();_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']][_0x44b8('0x18')]();}}return _0x549a26[_0x44b8('0x7')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1a')]=function(){var _0xc3f667=this;return function(_0x2cf205){if(_0x2cf205){freeIsNotKey(_0x2cf205,_0xc3f667[_0x44b8('0x1b')],'id');for(var _0xd1d320=0x0,_0x28f918={},_0x5e1129={};_0xd1d320<_0x2cf205[_0x44b8('0x14')];_0xd1d320+=0x1){_0x28f918=_0x2cf205[_0xd1d320];if(_[_0x44b8('0x12')](_0xc3f667['smsQueues'][_0x28f918['id']])){_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']]=new SmsQueue(_0x28f918);}else{_0xc3f667['mergeFromDatabase'](_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']],_0x28f918);}_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x17')]();_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x18')]();}}return _0xc3f667['smsQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1c')]=function(){var _0x26265f=this;return function(_0x339f0f){if(_0x339f0f){freeIsNotKey(_0x339f0f,_0x26265f[_0x44b8('0x8')],'id');for(var _0x5f541d=0x0,_0x3875a5={},_0x400edc={};_0x5f541d<_0x339f0f[_0x44b8('0x14')];_0x5f541d+=0x1){_0x3875a5=_0x339f0f[_0x5f541d];if(_[_0x44b8('0x12')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']])){_0x26265f[_0x44b8('0x8')][_0x3875a5['id']]=new MailQueue(_0x3875a5);}else{_0x26265f[_0x44b8('0x13')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']],_0x3875a5);}_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x17')]();_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x18')]();}}return _0x26265f[_0x44b8('0x8')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1d')]=function(){var _0x1becb0=this;return function(_0x323c50){if(_0x323c50){freeIsNotKey(_0x323c50,_0x1becb0[_0x44b8('0x1e')],'id');for(var _0x28faa9=0x0,_0x3984f8={},_0x2c02d6={};_0x28faa9<_0x323c50[_0x44b8('0x14')];_0x28faa9+=0x1){_0x3984f8=_0x323c50[_0x28faa9];if(_['isUndefined'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']])){_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]=new FaxQueue(_0x3984f8);}else{_0x1becb0['mergeFromDatabase'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']],_0x3984f8);}_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']][_0x44b8('0x17')]();_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]['updateRealtime']();}}return _0x1becb0[_0x44b8('0x1e')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1f')]=function(){var _0x1ee3cc=this;return function(_0x9cb2a){if(_0x9cb2a){freeIsNotKey(_0x9cb2a,_0x1ee3cc[_0x44b8('0x20')],'id');for(var _0x46aadd=0x0,_0x3581b8={},_0x209039={};_0x46aadd<_0x9cb2a[_0x44b8('0x14')];_0x46aadd+=0x1){_0x3581b8=_0x9cb2a[_0x46aadd];if(_[_0x44b8('0x12')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']])){_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]=new WhatsappQueue(_0x3581b8);}else{_0x1ee3cc[_0x44b8('0x13')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']],_0x3581b8);}_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]['updateRouting']();_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']][_0x44b8('0x18')]();}}return _0x1ee3cc[_0x44b8('0x20')];};};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 03877c1..4deef9d 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 _0x476c=['updateChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x476c,0x1a6));var _0xc476=function(_0x3f1000,_0x4746a9){_0x3f1000=_0x3f1000-0x0;var _0x5a07e6=_0x476c[_0x3f1000];return _0x5a07e6;};'use strict';var client=require(_0xc476('0x0'));exports[_0xc476('0x1')]=function(_0x2f7699,_0xa7cbdf){return client[_0xc476('0x2')]('UpdateChatInteraction',{'body':_0xa7cbdf,'options':{'where':{'id':_0x2f7699}},'log':_0xc476('0x3')});};exports['addTags']=function(_0x33fc8b,_0x29c6ad){return client[_0xc476('0x2')]('AddTagsToChatInteraction',{'body':_0x29c6ad,'options':{'where':{'id':_0x33fc8b}},'log':_0xc476('0x4')});}; \ No newline at end of file +var _0xad4d=['addTagsToChatInteraction','updateChatInteraction','Request','AddTagsToChatInteraction'];(function(_0x10be3d,_0xb78690){var _0x4aed09=function(_0x56460f){while(--_0x56460f){_0x10be3d['push'](_0x10be3d['shift']());}};_0x4aed09(++_0xb78690);}(_0xad4d,0x105));var _0xdad4=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xad4d[_0x46e363];return _0x3fb059;};'use strict';var client=require('../client');exports['update']=function(_0x3390a0,_0x807e67){return client['Request']('UpdateChatInteraction',{'body':_0x807e67,'options':{'where':{'id':_0x3390a0}},'log':_0xdad4('0x0')});};exports['addTags']=function(_0x1555e5,_0x2dab38){return client[_0xdad4('0x1')](_0xdad4('0x2'),{'body':_0x2dab38,'options':{'where':{'id':_0x1555e5}},'log':_0xdad4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1524227..a9b2c05 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 _0x53fc=['CreateChatMessage','createChatMessage','Request'];(function(_0x21648b,_0x4c0dc6){var _0x190592=function(_0x2a0e00){while(--_0x2a0e00){_0x21648b['push'](_0x21648b['shift']());}};_0x190592(++_0x4c0dc6);}(_0x53fc,0x1b5));var _0xc53f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53fc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x687817){return client[_0xc53f('0x0')](_0xc53f('0x1'),{'body':_0x687817,'log':_0xc53f('0x2')});}; \ No newline at end of file +var _0xe9a9=['create','createChatMessage','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe9a9,0xb9));var _0x9e9a=function(_0x34e7c8,_0x4a7ff1){_0x34e7c8=_0x34e7c8-0x0;var _0x7bbdb5=_0xe9a9[_0x34e7c8];return _0x7bbdb5;};'use strict';var client=require(_0x9e9a('0x0'));exports[_0x9e9a('0x1')]=function(_0x27cac7){return client['Request']('CreateChatMessage',{'body':_0x27cac7,'log':_0x9e9a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ab00270..733ba2e 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 _0xb606=['getChatQueues','Request','name','strategy','Agents','online','chatPause','../client'];(function(_0x25ea2b,_0x3c841a){var _0x358d86=function(_0x55da97){while(--_0x55da97){_0x25ea2b['push'](_0x25ea2b['shift']());}};_0x358d86(++_0x3c841a);}(_0xb606,0x10f));var _0x6b60=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xb606[_0x4b2436];return _0x4f5ab2;};'use strict';var client=require(_0x6b60('0x0'));exports[_0x6b60('0x1')]=function(){return function(){return client[_0x6b60('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x6b60('0x3'),'timeout',_0x6b60('0x4')],'include':[{'model':'User','as':_0x6b60('0x5'),'attributes':['id',_0x6b60('0x3'),_0x6b60('0x6'),_0x6b60('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x9a7b=['online','chatPause','../client','getChatQueues','GetChatQueue','name','timeout','strategy','User'];(function(_0x5575cd,_0x73ab7a){var _0x4979a0=function(_0x1ac744){while(--_0x1ac744){_0x5575cd['push'](_0x5575cd['shift']());}};_0x4979a0(++_0x73ab7a);}(_0x9a7b,0x134));var _0xb9a7=function(_0x2cc93e,_0x1ab512){_0x2cc93e=_0x2cc93e-0x0;var _0x4f1cb3=_0x9a7b[_0x2cc93e];return _0x4f1cb3;};'use strict';var client=require(_0xb9a7('0x0'));exports[_0xb9a7('0x1')]=function(){return function(){return client['Request'](_0xb9a7('0x2'),{'options':{'raw':![],'attributes':['id',_0xb9a7('0x3'),_0xb9a7('0x4'),_0xb9a7('0x5')],'include':[{'model':_0xb9a7('0x6'),'as':'Agents','attributes':['id',_0xb9a7('0x3'),_0xb9a7('0x7'),_0xb9a7('0x8')]}]},'log':_0xb9a7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 910f055..2f8945a 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 _0xe9e8=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x5d7dc6,_0x5d48cc){var _0x28349f=function(_0xfd1f90){while(--_0xfd1f90){_0x5d7dc6['push'](_0x5d7dc6['shift']());}};_0x28349f(++_0x5d48cc);}(_0xe9e8,0x179));var _0x8e9e=function(_0x14edd6,_0x39a78e){_0x14edd6=_0x14edd6-0x0;var _0x3ac21e=_0xe9e8[_0x14edd6];return _0x3ac21e;};'use strict';var client=require(_0x8e9e('0x0'));exports[_0x8e9e('0x1')]=function(_0x38ef03){return client[_0x8e9e('0x2')](_0x8e9e('0x3'),{'body':_0x38ef03,'log':_0x8e9e('0x3')});};exports[_0x8e9e('0x4')]=function(_0x48f1bc,_0x1508fb){return client['Request'](_0x8e9e('0x5'),{'body':_0x1508fb,'options':{'where':{'uniqueid':_0x48f1bc},'order':[['id',_0x8e9e('0x6')]],'limit':0x1},'log':_0x8e9e('0x5')});}; \ No newline at end of file +var _0x03ce=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x545827,_0x51baa6){var _0x42f69c=function(_0x122aaa){while(--_0x122aaa){_0x545827['push'](_0x545827['shift']());}};_0x42f69c(++_0x51baa6);}(_0x03ce,0x1a1));var _0xe03c=function(_0x2efc07,_0x427db4){_0x2efc07=_0x2efc07-0x0;var _0xb625c8=_0x03ce[_0x2efc07];return _0xb625c8;};'use strict';var client=require(_0xe03c('0x0'));exports[_0xe03c('0x1')]=function(_0x237c84){return client[_0xe03c('0x2')]('CreateChatQueueReport',{'body':_0x237c84,'log':_0xe03c('0x3')});};exports[_0xe03c('0x4')]=function(_0x326c04,_0x527a32){return client[_0xe03c('0x2')](_0xe03c('0x5'),{'body':_0x527a32,'options':{'where':{'uniqueid':_0x326c04},'order':[['id',_0xe03c('0x6')]],'limit':0x1},'log':_0xe03c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 71d9cbb..ad11e4b 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 _0x05a5=['AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','Request','UpdateFaxInteraction','addTags'];(function(_0x9afb6,_0x9c85c1){var _0x1da6cd=function(_0x4ab1d2){while(--_0x4ab1d2){_0x9afb6['push'](_0x9afb6['shift']());}};_0x1da6cd(++_0x9c85c1);}(_0x05a5,0x19f));var _0x505a=function(_0x340f91,_0x2fc3f3){_0x340f91=_0x340f91-0x0;var _0x35dcf8=_0x05a5[_0x340f91];return _0x35dcf8;};'use strict';var client=require(_0x505a('0x0'));exports[_0x505a('0x1')]=function(_0xa738f0,_0x39ba2d){return client[_0x505a('0x2')](_0x505a('0x3'),{'body':_0x39ba2d,'options':{'where':{'id':_0xa738f0}},'log':'updateFaxInteraction'});};exports[_0x505a('0x4')]=function(_0x1340ab,_0x58ff29){return client[_0x505a('0x2')](_0x505a('0x5'),{'body':_0x58ff29,'options':{'where':{'id':_0x1340ab}},'log':_0x505a('0x6')});}; \ No newline at end of file +var _0xfc2d=['AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','updateFaxInteraction'];(function(_0x137da3,_0xa6277a){var _0x1ac46c=function(_0x49e68b){while(--_0x49e68b){_0x137da3['push'](_0x137da3['shift']());}};_0x1ac46c(++_0xa6277a);}(_0xfc2d,0xed));var _0xdfc2=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0xfc2d[_0x22b8a3];return _0x199a0c;};'use strict';var client=require(_0xdfc2('0x0'));exports[_0xdfc2('0x1')]=function(_0x4b6747,_0x332331){return client['Request']('UpdateFaxInteraction',{'body':_0x332331,'options':{'where':{'id':_0x4b6747}},'log':_0xdfc2('0x2')});};exports['addTags']=function(_0x595e4a,_0x30b3d1){return client['Request'](_0xdfc2('0x3'),{'body':_0x30b3d1,'options':{'where':{'id':_0x595e4a}},'log':_0xdfc2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 66f49ae..64bd8e2 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 _0x581a=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x5cce63,_0x4eda40){var _0x12aa27=function(_0x4c73f7){while(--_0x4c73f7){_0x5cce63['push'](_0x5cce63['shift']());}};_0x12aa27(++_0x4eda40);}(_0x581a,0x18c));var _0xa581=function(_0x18e441,_0x279668){_0x18e441=_0x18e441-0x0;var _0x19a98c=_0x581a[_0x18e441];return _0x19a98c;};'use strict';var client=require(_0xa581('0x0'));exports[_0xa581('0x1')]=function(_0x3e703b){return client[_0xa581('0x2')](_0xa581('0x3'),{'body':_0x3e703b,'log':_0xa581('0x4')});}; \ No newline at end of file +var _0x1d35=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x20b2e2,_0x4b63a8){var _0x3816ea=function(_0x4be421){while(--_0x4be421){_0x20b2e2['push'](_0x20b2e2['shift']());}};_0x3816ea(++_0x4b63a8);}(_0x1d35,0x1f4));var _0x51d3=function(_0xdc009e,_0x10b501){_0xdc009e=_0xdc009e-0x0;var _0x499d0f=_0x1d35[_0xdc009e];return _0x499d0f;};'use strict';var client=require(_0x51d3('0x0'));exports[_0x51d3('0x1')]=function(_0x3c3a53){return client[_0x51d3('0x2')](_0x51d3('0x3'),{'body':_0x3c3a53,'log':_0x51d3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b8cb69e..a787c53 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 _0x79f5=['../client','getFaxQueues','Request','name','timeout','online'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x79f5,0x18c));var _0x579f=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x79f5[_0x1ddedd];return _0xa3e1ac;};'use strict';var client=require(_0x579f('0x0'));exports[_0x579f('0x1')]=function(){return function(){return client[_0x579f('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x579f('0x3'),_0x579f('0x4'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x579f('0x3'),_0x579f('0x5'),'faxPause']}]},'log':_0x579f('0x1')});};}; \ No newline at end of file +var _0xa0bc=['Request','name','timeout','strategy','Agents','faxPause','../client','getFaxQueues'];(function(_0x2b6465,_0x5a4caa){var _0x1f8fd2=function(_0x336115){while(--_0x336115){_0x2b6465['push'](_0x2b6465['shift']());}};_0x1f8fd2(++_0x5a4caa);}(_0xa0bc,0xa6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xca0b('0x0'));exports[_0xca0b('0x1')]=function(){return function(){return client[_0xca0b('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xca0b('0x3'),_0xca0b('0x4'),_0xca0b('0x5')],'include':[{'model':'User','as':_0xca0b('0x6'),'attributes':['id',_0xca0b('0x3'),'online',_0xca0b('0x7')]}]},'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 d057459..db7a383 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 _0x2926=['DESC','UpdateFaxQueueReport','create','Request','CreateFaxQueueReport','update'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x2926,0x170));var _0x6292=function(_0x5e2751,_0x518a55){_0x5e2751=_0x5e2751-0x0;var _0x139a39=_0x2926[_0x5e2751];return _0x139a39;};'use strict';var client=require('../client');exports[_0x6292('0x0')]=function(_0x1821e7){return client[_0x6292('0x1')](_0x6292('0x2'),{'body':_0x1821e7,'log':'CreateFaxQueueReport'});};exports[_0x6292('0x3')]=function(_0x3840fc,_0x43f028){return client['Request']('UpdateFaxQueueReport',{'body':_0x43f028,'options':{'where':{'uniqueid':_0x3840fc},'order':[['id',_0x6292('0x4')]],'limit':0x1},'log':_0x6292('0x5')});}; \ No newline at end of file +var _0xad8f=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x3a1dab,_0xb44f93){var _0x568728=function(_0x17bfe9){while(--_0x17bfe9){_0x3a1dab['push'](_0x3a1dab['shift']());}};_0x568728(++_0xb44f93);}(_0xad8f,0xd9));var _0xfad8=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xad8f[_0x47e7cb];return _0x2a8874;};'use strict';var client=require(_0xfad8('0x0'));exports[_0xfad8('0x1')]=function(_0xa53dff){return client[_0xfad8('0x2')](_0xfad8('0x3'),{'body':_0xa53dff,'log':_0xfad8('0x3')});};exports[_0xfad8('0x4')]=function(_0x180836,_0x17fda5){return client['Request'](_0xfad8('0x5'),{'body':_0x17fda5,'options':{'where':{'uniqueid':_0x180836},'order':[['id',_0xfad8('0x6')]],'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 994f6f2..94c6096 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 _0xb574=['GetInterval','name','Intervals','interval','../client','getIntervals'];(function(_0x2309c3,_0x47d8c9){var _0x1ab894=function(_0x7d15fd){while(--_0x7d15fd){_0x2309c3['push'](_0x2309c3['shift']());}};_0x1ab894(++_0x47d8c9);}(_0xb574,0x106));var _0x4b57=function(_0x23aaaa,_0x33c920){_0x23aaaa=_0x23aaaa-0x0;var _0x49e44d=_0xb574[_0x23aaaa];return _0x49e44d;};'use strict';var client=require(_0x4b57('0x0'));exports[_0x4b57('0x1')]=function(){return function(){return client['Request'](_0x4b57('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4b57('0x3')],'include':[{'model':'Interval','as':_0x4b57('0x4'),'attributes':['id',_0x4b57('0x3'),_0x4b57('0x5')]}]},'log':_0x4b57('0x1')});};}; \ No newline at end of file +var _0x8580=['GetInterval','Intervals','name','getIntervals'];(function(_0x10e653,_0x59f1cc){var _0x328dfd=function(_0x2bc428){while(--_0x2bc428){_0x10e653['push'](_0x10e653['shift']());}};_0x328dfd(++_0x59f1cc);}(_0x8580,0x1c7));var _0x0858=function(_0x4d64a0,_0x4e6e24){_0x4d64a0=_0x4d64a0-0x0;var _0x5e9dbc=_0x8580[_0x4d64a0];return _0x5e9dbc;};'use strict';var client=require('../client');exports[_0x0858('0x0')]=function(){return function(){return client['Request'](_0x0858('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x0858('0x2'),'attributes':['id',_0x0858('0x3'),'interval']}]},'log':_0x0858('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 7bd40dd..dea100c 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 _0x20c3=['update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x3566c2,_0xd6bcff){var _0x4b7fc1=function(_0x2514ec){while(--_0x2514ec){_0x3566c2['push'](_0x3566c2['shift']());}};_0x4b7fc1(++_0xd6bcff);}(_0x20c3,0x110));var _0x320c=function(_0x4ef1bb,_0x33ccf4){_0x4ef1bb=_0x4ef1bb-0x0;var _0x39e424=_0x20c3[_0x4ef1bb];return _0x39e424;};'use strict';var client=require(_0x320c('0x0'));exports[_0x320c('0x1')]=function(_0x32441b,_0x54ea8e){return client[_0x320c('0x2')](_0x320c('0x3'),{'body':_0x54ea8e,'options':{'where':{'id':_0x32441b}},'log':_0x320c('0x4')});};exports['addTags']=function(_0x2af1be,_0x582cdf){return client[_0x320c('0x2')](_0x320c('0x5'),{'body':_0x582cdf,'options':{'where':{'id':_0x2af1be}},'log':_0x320c('0x6')});}; \ No newline at end of file +var _0xb30a=['Request','addTags','AddTagsToMailInteraction','update'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0xb30a,0x143));var _0xab30=function(_0x7d44f2,_0x50238e){_0x7d44f2=_0x7d44f2-0x0;var _0x2027c7=_0xb30a[_0x7d44f2];return _0x2027c7;};'use strict';var client=require('../client');exports[_0xab30('0x0')]=function(_0x303558,_0xbe0db3){return client[_0xab30('0x1')]('UpdateMailInteraction',{'body':_0xbe0db3,'options':{'where':{'id':_0x303558}},'log':'updateMailInteraction'});};exports[_0xab30('0x2')]=function(_0xdf8251,_0x6653a6){return client[_0xab30('0x1')](_0xab30('0x3'),{'body':_0x6653a6,'options':{'where':{'id':_0xdf8251}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 60d643e..f359ecf 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 _0xc701=['../client','create','Request'];(function(_0x33ce40,_0x56016a){var _0x40a535=function(_0x153e51){while(--_0x153e51){_0x33ce40['push'](_0x33ce40['shift']());}};_0x40a535(++_0x56016a);}(_0xc701,0x168));var _0x1c70=function(_0x332ff9,_0x2a6021){_0x332ff9=_0x332ff9-0x0;var _0x11ca93=_0xc701[_0x332ff9];return _0x11ca93;};'use strict';var client=require(_0x1c70('0x0'));exports[_0x1c70('0x1')]=function(_0x4defe8){return client[_0x1c70('0x2')]('CreateMailMessage',{'body':_0x4defe8,'log':'createMailMessage'});}; \ No newline at end of file +var _0x4f03=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x1858db,_0x200ae7){var _0x1c2329=function(_0x55b945){while(--_0x55b945){_0x1858db['push'](_0x1858db['shift']());}};_0x1c2329(++_0x200ae7);}(_0x4f03,0x91));var _0x34f0=function(_0x1163a0,_0xfed5f4){_0x1163a0=_0x1163a0-0x0;var _0x1af53e=_0x4f03[_0x1163a0];return _0x1af53e;};'use strict';var client=require(_0x34f0('0x0'));exports[_0x34f0('0x1')]=function(_0x2235e6){return client[_0x34f0('0x2')](_0x34f0('0x3'),{'body':_0x2235e6,'log':_0x34f0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 0f2edd0..9698596 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 _0xb03b=['Request','GetMailQueue','timeout','strategy','User','Agents','name','online','mailPause','../client','getMailQueues'];(function(_0x5655fd,_0x2f47af){var _0x3a9e68=function(_0x2ca508){while(--_0x2ca508){_0x5655fd['push'](_0x5655fd['shift']());}};_0x3a9e68(++_0x2f47af);}(_0xb03b,0x77));var _0xbb03=function(_0x570ab6,_0xb3d513){_0x570ab6=_0x570ab6-0x0;var _0x4a66d5=_0xb03b[_0x570ab6];return _0x4a66d5;};'use strict';var client=require(_0xbb03('0x0'));exports[_0xbb03('0x1')]=function(){return function(){return client[_0xbb03('0x2')](_0xbb03('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xbb03('0x4'),_0xbb03('0x5')],'include':[{'model':_0xbb03('0x6'),'as':_0xbb03('0x7'),'attributes':['id',_0xbb03('0x8'),_0xbb03('0x9'),_0xbb03('0xa')]}]},'log':_0xbb03('0x1')});};}; \ No newline at end of file +var _0xc655=['GetMailQueue','timeout','strategy','User','Agents','name','online','mailPause','getMailQueues','../client'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0xc655,0x1b7));var _0x5c65=function(_0x385455,_0x5babb2){_0x385455=_0x385455-0x0;var _0x5b0f65=_0xc655[_0x385455];return _0x5b0f65;};'use strict';var client=require(_0x5c65('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0x5c65('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x5c65('0x2'),_0x5c65('0x3')],'include':[{'model':_0x5c65('0x4'),'as':_0x5c65('0x5'),'attributes':['id',_0x5c65('0x6'),_0x5c65('0x7'),_0x5c65('0x8')]}]},'log':_0x5c65('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 124f859..5081af4 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 _0x994a=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client'];(function(_0x3b2c8e,_0x53910b){var _0x3ebe3d=function(_0x57220b){while(--_0x57220b){_0x3b2c8e['push'](_0x3b2c8e['shift']());}};_0x3ebe3d(++_0x53910b);}(_0x994a,0xef));var _0xa994=function(_0x488ed9,_0x4dd310){_0x488ed9=_0x488ed9-0x0;var _0x14b8ff=_0x994a[_0x488ed9];return _0x14b8ff;};'use strict';var client=require(_0xa994('0x0'));exports[_0xa994('0x1')]=function(_0x1a7a73){return client[_0xa994('0x2')](_0xa994('0x3'),{'body':_0x1a7a73,'log':_0xa994('0x3')});};exports[_0xa994('0x4')]=function(_0x457639,_0xb3bf18){return client[_0xa994('0x2')]('UpdateMailQueueReport',{'body':_0xb3bf18,'options':{'where':{'uniqueid':_0x457639},'order':[['id','DESC']],'limit':0x1},'log':_0xa994('0x5')});}; \ No newline at end of file +var _0x0d16=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x1eac11,_0x4ce731){var _0x549b8d=function(_0xd6d280){while(--_0xd6d280){_0x1eac11['push'](_0x1eac11['shift']());}};_0x549b8d(++_0x4ce731);}(_0x0d16,0x12c));var _0x60d1=function(_0x48d35c,_0x229c69){_0x48d35c=_0x48d35c-0x0;var _0x447dea=_0x0d16[_0x48d35c];return _0x447dea;};'use strict';var client=require('../client');exports[_0x60d1('0x0')]=function(_0x57d5c7){return client[_0x60d1('0x1')](_0x60d1('0x2'),{'body':_0x57d5c7,'log':_0x60d1('0x2')});};exports[_0x60d1('0x3')]=function(_0x10d6bb,_0x400a8f){return client[_0x60d1('0x1')]('UpdateMailQueueReport',{'body':_0x400a8f,'options':{'where':{'uniqueid':_0x10d6bb},'order':[['id','DESC']],'limit':0x1},'log':_0x60d1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 228cd12..d89cf7d 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 _0x425c=['Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x425c,0xa6));var _0xc425=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x425c[_0x122096];return _0x3d1966;};'use strict';var client=require(_0xc425('0x0'));exports[_0xc425('0x1')]=function(_0x5d0028,_0x5de88d){return client[_0xc425('0x2')]('UpdateOpenchannelInteraction',{'body':_0x5de88d,'options':{'where':{'id':_0x5d0028}},'log':_0xc425('0x3')});};exports[_0xc425('0x4')]=function(_0xbc0233,_0x1d1120){return client[_0xc425('0x2')](_0xc425('0x5'),{'body':_0x1d1120,'options':{'where':{'id':_0xbc0233}},'log':_0xc425('0x6')});}; \ No newline at end of file +var _0xca2b=['Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','update'];(function(_0x564615,_0x51000c){var _0x3e5c3c=function(_0x35b777){while(--_0x35b777){_0x564615['push'](_0x564615['shift']());}};_0x3e5c3c(++_0x51000c);}(_0xca2b,0x176));var _0xbca2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xca2b[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require('../client');exports[_0xbca2('0x0')]=function(_0x443b56,_0x452245){return client[_0xbca2('0x1')](_0xbca2('0x2'),{'body':_0x452245,'options':{'where':{'id':_0x443b56}},'log':'updateOpenchannelInteraction'});};exports[_0xbca2('0x3')]=function(_0x271967,_0x34c711){return client[_0xbca2('0x1')](_0xbca2('0x4'),{'body':_0x34c711,'options':{'where':{'id':_0x271967}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index a0764d5..b13663c 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 _0xf109=['../client','create'];(function(_0x33aded,_0x173eb7){var _0x3e1558=function(_0x4d6e8c){while(--_0x4d6e8c){_0x33aded['push'](_0x33aded['shift']());}};_0x3e1558(++_0x173eb7);}(_0xf109,0xce));var _0x9f10=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xf109[_0x346737];return _0x1ade2e;};'use strict';var client=require(_0x9f10('0x0'));exports[_0x9f10('0x1')]=function(_0x44c4f2){return client['Request']('CreateOpenchannelMessage',{'body':_0x44c4f2,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x54ef=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x39fa28,_0x118046){var _0x19d0df=function(_0x323dc4){while(--_0x323dc4){_0x39fa28['push'](_0x39fa28['shift']());}};_0x19d0df(++_0x118046);}(_0x54ef,0x112));var _0xf54e=function(_0x4715a4,_0x173bda){_0x4715a4=_0x4715a4-0x0;var _0x3e196c=_0x54ef[_0x4715a4];return _0x3e196c;};'use strict';var client=require(_0xf54e('0x0'));exports[_0xf54e('0x1')]=function(_0x12c070){return client['Request'](_0xf54e('0x2'),{'body':_0x12c070,'log':_0xf54e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index ffe1414..07fd24c 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 _0x04d6=['../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy','User','Agents','openchannelPause'];(function(_0x335e20,_0x3b998c){var _0x410b0f=function(_0x5c4075){while(--_0x5c4075){_0x335e20['push'](_0x335e20['shift']());}};_0x410b0f(++_0x3b998c);}(_0x04d6,0x15f));var _0x604d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x04d6[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x604d('0x0'));exports[_0x604d('0x1')]=function(){return function(){return client['Request'](_0x604d('0x2'),{'options':{'raw':![],'attributes':['id',_0x604d('0x3'),_0x604d('0x4'),_0x604d('0x5')],'include':[{'model':_0x604d('0x6'),'as':_0x604d('0x7'),'attributes':['id',_0x604d('0x3'),'online',_0x604d('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x3d6c=['openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','User','online'];(function(_0x2d5e13,_0x2f25ef){var _0x2fab3d=function(_0x624025){while(--_0x624025){_0x2d5e13['push'](_0x2d5e13['shift']());}};_0x2fab3d(++_0x2f25ef);}(_0x3d6c,0x91));var _0xc3d6=function(_0x14defb,_0x511690){_0x14defb=_0x14defb-0x0;var _0xbc28df=_0x3d6c[_0x14defb];return _0xbc28df;};'use strict';var client=require('../client');exports[_0xc3d6('0x0')]=function(){return function(){return client[_0xc3d6('0x1')](_0xc3d6('0x2'),{'options':{'raw':![],'attributes':['id',_0xc3d6('0x3'),_0xc3d6('0x4'),'strategy'],'include':[{'model':_0xc3d6('0x5'),'as':'Agents','attributes':['id','name',_0xc3d6('0x6'),_0xc3d6('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3b7ca2e..2ecd5fe 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 _0x322e=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x322e,0x177));var _0xe322=function(_0xaa8797,_0x426785){_0xaa8797=_0xaa8797-0x0;var _0x50353d=_0x322e[_0xaa8797];return _0x50353d;};'use strict';var client=require(_0xe322('0x0'));exports[_0xe322('0x1')]=function(_0x20b1f5){return client[_0xe322('0x2')](_0xe322('0x3'),{'body':_0x20b1f5,'log':_0xe322('0x3')});};exports[_0xe322('0x4')]=function(_0x3a4b59,_0x303b50){return client[_0xe322('0x2')](_0xe322('0x5'),{'body':_0x303b50,'options':{'where':{'uniqueid':_0x3a4b59},'order':[['id',_0xe322('0x6')]],'limit':0x1},'log':_0xe322('0x5')});}; \ No newline at end of file +var _0x0eb5=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC','create'];(function(_0x2b92a6,_0x55ac25){var _0x36c767=function(_0x1b7ac3){while(--_0x1b7ac3){_0x2b92a6['push'](_0x2b92a6['shift']());}};_0x36c767(++_0x55ac25);}(_0x0eb5,0x1c1));var _0x50eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0eb5[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports[_0x50eb('0x0')]=function(_0x360466){return client['Request'](_0x50eb('0x1'),{'body':_0x360466,'log':_0x50eb('0x1')});};exports[_0x50eb('0x2')]=function(_0x47cd8e,_0x4ac2c4){return client[_0x50eb('0x3')](_0x50eb('0x4'),{'body':_0x4ac2c4,'options':{'where':{'uniqueid':_0x47cd8e},'order':[['id',_0x50eb('0x5')]],'limit':0x1},'log':_0x50eb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 182fd43..de034e4 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 _0xc5ce=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0xfdeae5,_0x3aa003){var _0x398b51=function(_0x51817b){while(--_0x51817b){_0xfdeae5['push'](_0xfdeae5['shift']());}};_0x398b51(++_0x3aa003);}(_0xc5ce,0x7d));var _0xec5c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc5ce[_0xfae23b];return _0x200640;};'use strict';var client=require('../client');exports[_0xec5c('0x0')]=function(_0x51f9da,_0x45cecb){return client[_0xec5c('0x1')](_0xec5c('0x2'),{'body':_0x45cecb,'options':{'where':{'id':_0x51f9da}},'log':_0xec5c('0x3')});};exports[_0xec5c('0x4')]=function(_0x5a4a31,_0x4180cd){return client[_0xec5c('0x1')](_0xec5c('0x5'),{'body':_0x4180cd,'options':{'where':{'id':_0x5a4a31}},'log':_0xec5c('0x6')});}; \ No newline at end of file +var _0x2ce4=['updateSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x1c7bcd,_0x478875){var _0x554320=function(_0x1acb8d){while(--_0x1acb8d){_0x1c7bcd['push'](_0x1c7bcd['shift']());}};_0x554320(++_0x478875);}(_0x2ce4,0x141));var _0x42ce=function(_0x81e2cf,_0x1612b4){_0x81e2cf=_0x81e2cf-0x0;var _0x1fa87a=_0x2ce4[_0x81e2cf];return _0x1fa87a;};'use strict';var client=require(_0x42ce('0x0'));exports[_0x42ce('0x1')]=function(_0x3a997f,_0x51cd12){return client[_0x42ce('0x2')](_0x42ce('0x3'),{'body':_0x51cd12,'options':{'where':{'id':_0x3a997f}},'log':_0x42ce('0x4')});};exports['addTags']=function(_0x22b9aa,_0x1e5132){return client[_0x42ce('0x2')]('AddTagsToSmsInteraction',{'body':_0x1e5132,'options':{'where':{'id':_0x22b9aa}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 2382b4e..3061d6d 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 _0xd72b=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x5d7686,_0x5d11b1){var _0x408ab4=function(_0x424411){while(--_0x424411){_0x5d7686['push'](_0x5d7686['shift']());}};_0x408ab4(++_0x5d11b1);}(_0xd72b,0x1ba));var _0xbd72=function(_0x1a0a14,_0x33f734){_0x1a0a14=_0x1a0a14-0x0;var _0x588fd1=_0xd72b[_0x1a0a14];return _0x588fd1;};'use strict';var client=require(_0xbd72('0x0'));exports[_0xbd72('0x1')]=function(_0x3ed6e9){return client[_0xbd72('0x2')](_0xbd72('0x3'),{'body':_0x3ed6e9,'log':_0xbd72('0x4')});}; \ No newline at end of file +var _0x366d=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x479c0f,_0x2c7884){var _0x309eae=function(_0x474fbd){while(--_0x474fbd){_0x479c0f['push'](_0x479c0f['shift']());}};_0x309eae(++_0x2c7884);}(_0x366d,0xde));var _0xd366=function(_0x1dba2c,_0x31d583){_0x1dba2c=_0x1dba2c-0x0;var _0x383a83=_0x366d[_0x1dba2c];return _0x383a83;};'use strict';var client=require(_0xd366('0x0'));exports[_0xd366('0x1')]=function(_0x2e644b){return client[_0xd366('0x2')](_0xd366('0x3'),{'body':_0x2e644b,'log':_0xd366('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 955ed22..06cddf7 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 _0x3e5a=['smsPause','getSmsQueues','../client','Request','GetSmsQueue','name','timeout','strategy','User','Agents'];(function(_0xd3da2a,_0x22241c){var _0x10ab61=function(_0x12b964){while(--_0x12b964){_0xd3da2a['push'](_0xd3da2a['shift']());}};_0x10ab61(++_0x22241c);}(_0x3e5a,0x12e));var _0xa3e5=function(_0x339d1d,_0x203feb){_0x339d1d=_0x339d1d-0x0;var _0x3536bf=_0x3e5a[_0x339d1d];return _0x3536bf;};'use strict';var client=require(_0xa3e5('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0xa3e5('0x1')](_0xa3e5('0x2'),{'options':{'raw':![],'attributes':['id',_0xa3e5('0x3'),_0xa3e5('0x4'),_0xa3e5('0x5')],'include':[{'model':_0xa3e5('0x6'),'as':_0xa3e5('0x7'),'attributes':['id','name','online',_0xa3e5('0x8')]}]},'log':_0xa3e5('0x9')});};}; \ No newline at end of file +var _0x3762=['User','Agents','smsPause','../client','getSmsQueues','name','timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3762,0x7a));var _0x2376=function(_0x7d8fc0,_0x51fce0){_0x7d8fc0=_0x7d8fc0-0x0;var _0x413368=_0x3762[_0x7d8fc0];return _0x413368;};'use strict';var client=require(_0x2376('0x0'));exports[_0x2376('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x2376('0x2'),_0x2376('0x3'),'strategy'],'include':[{'model':_0x2376('0x4'),'as':_0x2376('0x5'),'attributes':['id',_0x2376('0x2'),'online',_0x2376('0x6')]}]},'log':_0x2376('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 0a2e8ce..a151e32 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 _0x73a1=['update','DESC','UpdateSmsQueueReport','Request','CreateSmsQueueReport'];(function(_0x40a2dd,_0x7898c7){var _0x1d21d6=function(_0x4055b8){while(--_0x4055b8){_0x40a2dd['push'](_0x40a2dd['shift']());}};_0x1d21d6(++_0x7898c7);}(_0x73a1,0x161));var _0x173a=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x73a1[_0x3e25c1];return _0x52e7f2;};'use strict';var client=require('../client');exports['create']=function(_0x25c3a3){return client[_0x173a('0x0')]('CreateSmsQueueReport',{'body':_0x25c3a3,'log':_0x173a('0x1')});};exports[_0x173a('0x2')]=function(_0xeec920,_0xf2a2c8){return client[_0x173a('0x0')]('UpdateSmsQueueReport',{'body':_0xf2a2c8,'options':{'where':{'uniqueid':_0xeec920},'order':[['id',_0x173a('0x3')]],'limit':0x1},'log':_0x173a('0x4')});}; \ No newline at end of file +var _0x3f4b=['Request','DESC','../client','create','CreateSmsQueueReport','update'];(function(_0x2176cf,_0x1c97a6){var _0x4548ea=function(_0xca3401){while(--_0xca3401){_0x2176cf['push'](_0x2176cf['shift']());}};_0x4548ea(++_0x1c97a6);}(_0x3f4b,0x1c4));var _0xb3f4=function(_0x566204,_0x402192){_0x566204=_0x566204-0x0;var _0x58c130=_0x3f4b[_0x566204];return _0x58c130;};'use strict';var client=require(_0xb3f4('0x0'));exports[_0xb3f4('0x1')]=function(_0x13e69f){return client['Request'](_0xb3f4('0x2'),{'body':_0x13e69f,'log':_0xb3f4('0x2')});};exports[_0xb3f4('0x3')]=function(_0x45a101,_0x2ebb0a){return client[_0xb3f4('0x4')]('UpdateSmsQueueReport',{'body':_0x2ebb0a,'options':{'where':{'uniqueid':_0x45a101},'order':[['id',_0xb3f4('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 f92ff32..2de33cb 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 _0x6386=['whatsappPause','faxCapacity','smsCapacity','whatsappCapacity','getAgents','Request','GetUser','name','online','pauseType','chatPause','faxPause','smsPause'];(function(_0x495054,_0x304104){var _0x146d2e=function(_0x350426){while(--_0x350426){_0x495054['push'](_0x495054['shift']());}};_0x146d2e(++_0x304104);}(_0x6386,0x197));var _0x6638=function(_0x40b032,_0xe41c4b){_0x40b032=_0x40b032-0x0;var _0x3ffbda=_0x6386[_0x40b032];return _0x3ffbda;};'use strict';var client=require('../client');exports[_0x6638('0x0')]=function(){return function(){return client[_0x6638('0x1')](_0x6638('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x6638('0x3'),_0x6638('0x4'),_0x6638('0x5'),'lastPauseAt','voicePause',_0x6638('0x6'),'mailPause',_0x6638('0x7'),_0x6638('0x8'),_0x6638('0x9'),'openchannelPause','chatCapacity','mailCapacity',_0x6638('0xa'),_0x6638('0xb'),_0x6638('0xc'),'openchannelCapacity']},'log':_0x6638('0x0')});};}; \ No newline at end of file +var _0x6604=['smsCapacity','openchannelCapacity','getAgents','../client','Request','agent','online','pauseType','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x6604,0x81));var _0x4660=function(_0x4e216a,_0x2ed91d){_0x4e216a=_0x4e216a-0x0;var _0x2d84c5=_0x6604[_0x4e216a];return _0x2d84c5;};'use strict';var client=require(_0x4660('0x0'));exports['getAgents']=function(){return function(){return client[_0x4660('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x4660('0x2')},'attributes':['id','name',_0x4660('0x3'),_0x4660('0x4'),_0x4660('0x5'),_0x4660('0x6'),_0x4660('0x7'),_0x4660('0x8'),_0x4660('0x9'),_0x4660('0xa'),'whatsappPause',_0x4660('0xb'),_0x4660('0xc'),_0x4660('0xd'),_0x4660('0xe'),_0x4660('0xf'),'whatsappCapacity',_0x4660('0x10')]},'log':_0x4660('0x11')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 120431e..939ed12 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 _0x919e=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x1d3366,_0x335df9){var _0x4ed3a0=function(_0x34bb84){while(--_0x34bb84){_0x1d3366['push'](_0x1d3366['shift']());}};_0x4ed3a0(++_0x335df9);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe919('0x0'));exports[_0xe919('0x1')]=function(_0x24d2f4,_0x5d7d06){return client[_0xe919('0x2')]('UpdateWhatsappInteraction',{'body':_0x5d7d06,'options':{'where':{'id':_0x24d2f4}},'log':'updateWhatsappInteraction'});};exports[_0xe919('0x3')]=function(_0x3a1192,_0x2bf552){return client[_0xe919('0x2')](_0xe919('0x4'),{'body':_0x2bf552,'options':{'where':{'id':_0x3a1192}},'log':_0xe919('0x5')});}; \ No newline at end of file +var _0x3ee5=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x82dfc1,_0x283f8c){var _0x3405cf=function(_0x4d2168){while(--_0x4d2168){_0x82dfc1['push'](_0x82dfc1['shift']());}};_0x3405cf(++_0x283f8c);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x43060e,_0x44c4da){_0x43060e=_0x43060e-0x0;var _0x548281=_0x3ee5[_0x43060e];return _0x548281;};'use strict';var client=require('../client');exports[_0x53ee('0x0')]=function(_0x283eaf,_0x544fe1){return client[_0x53ee('0x1')](_0x53ee('0x2'),{'body':_0x544fe1,'options':{'where':{'id':_0x283eaf}},'log':_0x53ee('0x3')});};exports[_0x53ee('0x4')]=function(_0x25e597,_0x119975){return client[_0x53ee('0x1')](_0x53ee('0x5'),{'body':_0x119975,'options':{'where':{'id':_0x25e597}},'log':_0x53ee('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 4b31354..2562cfc 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 _0x66b3=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x66b3,0x181));var _0x366b=function(_0x59e223,_0x430a2c){_0x59e223=_0x59e223-0x0;var _0xcbf87e=_0x66b3[_0x59e223];return _0xcbf87e;};'use strict';var client=require('../client');exports[_0x366b('0x0')]=function(_0x34e7af){return client[_0x366b('0x1')](_0x366b('0x2'),{'body':_0x34e7af,'log':_0x366b('0x3')});}; \ No newline at end of file +var _0x8fad=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x5302fb,_0x1a2db3){var _0x43e6a4=function(_0x324ae6){while(--_0x324ae6){_0x5302fb['push'](_0x5302fb['shift']());}};_0x43e6a4(++_0x1a2db3);}(_0x8fad,0x79));var _0xd8fa=function(_0xe48653,_0x51e87f){_0xe48653=_0xe48653-0x0;var _0x2fabab=_0x8fad[_0xe48653];return _0x2fabab;};'use strict';var client=require(_0xd8fa('0x0'));exports[_0xd8fa('0x1')]=function(_0x58aba9){return client[_0xd8fa('0x2')](_0xd8fa('0x3'),{'body':_0x58aba9,'log':_0xd8fa('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 0afb890..b02b764 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 _0xe2cf=['whatsappPause','getWhatsappQueues','GetWhatsappQueue','timeout','strategy','User','Agents','online'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xe2cf[_0x1e4f2d];return _0xd05ce5;};'use strict';var client=require('../client');exports[_0xfe2c('0x0')]=function(){return function(){return client['Request'](_0xfe2c('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xfe2c('0x2'),_0xfe2c('0x3')],'include':[{'model':_0xfe2c('0x4'),'as':_0xfe2c('0x5'),'attributes':['id','name',_0xfe2c('0x6'),_0xfe2c('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x01d3=['online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy','Agents','name'];(function(_0x14a441,_0x177fe1){var _0x2ad5ad=function(_0x86b8cb){while(--_0x86b8cb){_0x14a441['push'](_0x14a441['shift']());}};_0x2ad5ad(++_0x177fe1);}(_0x01d3,0xa2));var _0x301d=function(_0x25e434,_0x48e43a){_0x25e434=_0x25e434-0x0;var _0x546adb=_0x01d3[_0x25e434];return _0x546adb;};'use strict';var client=require(_0x301d('0x0'));exports[_0x301d('0x1')]=function(){return function(){return client[_0x301d('0x2')](_0x301d('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x301d('0x4'),_0x301d('0x5')],'include':[{'model':'User','as':_0x301d('0x6'),'attributes':['id',_0x301d('0x7'),_0x301d('0x8'),_0x301d('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index ccfd52c..007eed7 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 _0xad2c=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x22d58a,_0x361d0f){var _0x342330=function(_0x19c030){while(--_0x19c030){_0x22d58a['push'](_0x22d58a['shift']());}};_0x342330(++_0x361d0f);}(_0xad2c,0x194));var _0xcad2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xad2c[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0xcad2('0x0'));exports[_0xcad2('0x1')]=function(_0x1f5d7c){return client[_0xcad2('0x2')](_0xcad2('0x3'),{'body':_0x1f5d7c,'log':_0xcad2('0x3')});};exports[_0xcad2('0x4')]=function(_0x5f2107,_0x1ee947){return client[_0xcad2('0x2')](_0xcad2('0x5'),{'body':_0x1ee947,'options':{'where':{'uniqueid':_0x5f2107},'order':[['id',_0xcad2('0x6')]],'limit':0x1},'log':_0xcad2('0x5')});}; \ No newline at end of file +var _0xc297=['DESC','../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x41a78b,_0x5344b0){var _0x2bf089=function(_0x33eae4){while(--_0x33eae4){_0x41a78b['push'](_0x41a78b['shift']());}};_0x2bf089(++_0x5344b0);}(_0xc297,0xbe));var _0x7c29=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xc297[_0x361d3f];return _0x320229;};'use strict';var client=require(_0x7c29('0x0'));exports[_0x7c29('0x1')]=function(_0x322d25){return client[_0x7c29('0x2')](_0x7c29('0x3'),{'body':_0x322d25,'log':_0x7c29('0x3')});};exports[_0x7c29('0x4')]=function(_0x2249e1,_0x67fdca){return client[_0x7c29('0x2')](_0x7c29('0x5'),{'body':_0x67fdca,'options':{'where':{'uniqueid':_0x2249e1},'order':[['id',_0x7c29('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 689bbb7..8a32690 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 _0x16bc=['rules','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','join','stop','find','createQueue','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0xc2cbce,_0xc5c997){var _0x1bac5e=function(_0x4893bf){while(--_0x4893bf){_0xc2cbce['push'](_0xc2cbce['shift']());}};_0x1bac5e(++_0xc5c997);}(_0x16bc,0x8b));var _0xc16b=function(_0x219e2c,_0x49bdf2){_0x219e2c=_0x219e2c-0x0;var _0x1dee0a=_0x16bc[_0x219e2c];return _0x1dee0a;};'use strict';var schema=require(_0xc16b('0x0'));var _=require(_0xc16b('0x1'));var util=require(_0xc16b('0x2'));var seqqueue=require(_0xc16b('0x3'));var logger=require(_0xc16b('0x4'))('routing');var strategy=require(_0xc16b('0x5'));var queue=schema({'name':{'type':_0xc16b('0x6'),'required':!![],'message':_0xc16b('0x7')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x4a1eaf,_0x499ff8,_0x401260){return logger[_0xc16b('0x8')](util[_0xc16b('0x9')](_0xc16b('0xa'),_0x4a1eaf,_0x499ff8[_0xc16b('0xb')],_0x401260));}function handleFindAgent(_0x562a99){return function(_0x556303){return _0x556303['name'][_0xc16b('0xc')]()===_0x562a99[_0xc16b('0xc')]();};}exports[_0xc16b('0xd')]=function(_0x1fe519,_0x31fac1,_0x12dea9,_0x393e1c){return function(_0x41520e){try{var _0x147c45={'name':_0x31fac1[0x0],'timeout':_0x31fac1[0x1]};var _0xae2697=queue[_0xc16b('0x0')](_0x147c45,{'typecast':!![]});if(_0xae2697[_0xc16b('0xe')]){logger[_0xc16b('0xf')]('[%s][AGENT]\x20%s',_0x1fe519,_[_0xc16b('0x10')](_0xae2697,'message')[_0xc16b('0x11')](',\x20'));_0x41520e[_0xc16b('0x12')]();}else{var _0x3a4ca0=_[_0xc16b('0x13')](_0x12dea9['agents'],handleFindAgent(_0x147c45[_0xc16b('0xb')]));if(_0x3a4ca0){var _0x50d12d=(_0x147c45['timeout']||0xa)*0x3e8;var _0x67ba3e,_0x3252d4;var _0x16286b=seqqueue[_0xc16b('0x14')](_0x50d12d);_0x16286b['id']=_0x1fe519;_0x16286b[_0xc16b('0x15')]=_0x50d12d;_0x16286b[_0xc16b('0x16')]=_0x393e1c[_0xc16b('0x16')];writeLog(_0x1fe519,_0x3a4ca0,util[_0xc16b('0x9')](_0xc16b('0x17'),_0x50d12d));_0x12dea9['rules'][_0x1fe519]['on'](_0xc16b('0x18'),function(){logger[_0xc16b('0x8')](_0xc16b('0x19'),_0x1fe519);clearTimeout(_0x3252d4);_0x3252d4=undefined;_0x16286b['close']();if(_0x12dea9[_0xc16b('0x1a')][_0x1fe519]){delete _0x12dea9[_0xc16b('0x1a')][_0x1fe519];}_0x41520e[_0xc16b('0x12')]();});_0x12dea9['rules'][_0x1fe519]['on'](_0xc16b('0x1b'),function(){if(_0x12dea9[_0xc16b('0x1a')][_0x1fe519]){delete _0x12dea9[_0xc16b('0x1a')][_0x1fe519];}});_0x3252d4=setTimeout(function(){logger[_0xc16b('0x8')](_0xc16b('0x1c'),_0x1fe519);clearTimeout(_0x3252d4);_0x16286b[_0xc16b('0x1d')]();_0x41520e[_0xc16b('0x1e')]();},_0x50d12d);strategy['agent'](_0x16286b,_0x3a4ca0,_0x12dea9,_0x393e1c);}else{logger[_0xc16b('0xf')](_0xc16b('0x1f'),_0x1fe519,_0x147c45['name']);_0x41520e['stop']();}}}catch(_0x437604){console['log'](_0x437604);logger[_0xc16b('0xf')](_0xc16b('0x20'),_0x1fe519,_0x437604['stack']);_0x41520e['stop']();}};}; \ No newline at end of file +var _0x6b7f=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','map','message','join','stop','find','createQueue','atimeout','channel','START:%s','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','info','format'];(function(_0x488c4a,_0x517bb3){var _0xd843dc=function(_0x2a06b1){while(--_0x2a06b1){_0x488c4a['push'](_0x488c4a['shift']());}};_0xd843dc(++_0x517bb3);}(_0x6b7f,0x1a7));var _0xf6b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b7f[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xf6b7('0x0'));var _=require(_0xf6b7('0x1'));var util=require(_0xf6b7('0x2'));var seqqueue=require(_0xf6b7('0x3'));var logger=require(_0xf6b7('0x4'))(_0xf6b7('0x5'));var strategy=require(_0xf6b7('0x6'));var queue=schema({'name':{'type':_0xf6b7('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xf6b7('0x8')}});function writeLog(_0x3f00d4,_0x8cdf6f,_0x4bf218){return logger[_0xf6b7('0x9')](util[_0xf6b7('0xa')](_0xf6b7('0xb'),_0x3f00d4,_0x8cdf6f[_0xf6b7('0xc')],_0x4bf218));}function handleFindAgent(_0x3f9a29){return function(_0x237855){return _0x237855['name'][_0xf6b7('0xd')]()===_0x3f9a29['toLowerCase']();};}exports['consequence']=function(_0x210832,_0x8fa2f3,_0x468a59,_0x178aba){return function(_0x414e46){try{var _0x14254d={'name':_0x8fa2f3[0x0],'timeout':_0x8fa2f3[0x1]};var _0x4d2736=queue['validate'](_0x14254d,{'typecast':!![]});if(_0x4d2736[_0xf6b7('0xe')]){logger[_0xf6b7('0xf')]('[%s][AGENT]\x20%s',_0x210832,_[_0xf6b7('0x10')](_0x4d2736,_0xf6b7('0x11'))[_0xf6b7('0x12')](',\x20'));_0x414e46[_0xf6b7('0x13')]();}else{var _0x1fa7ff=_[_0xf6b7('0x14')](_0x468a59['agents'],handleFindAgent(_0x14254d[_0xf6b7('0xc')]));if(_0x1fa7ff){var _0x162baf=(_0x14254d['timeout']||0xa)*0x3e8;var _0x2b97d9,_0x34898e;var _0x239da7=seqqueue[_0xf6b7('0x15')](_0x162baf);_0x239da7['id']=_0x210832;_0x239da7[_0xf6b7('0x16')]=_0x162baf;_0x239da7[_0xf6b7('0x17')]=_0x178aba['channel'];writeLog(_0x210832,_0x1fa7ff,util[_0xf6b7('0xa')](_0xf6b7('0x18'),_0x162baf));_0x468a59['rules'][_0x210832]['on']('end',function(){logger[_0xf6b7('0x9')](_0xf6b7('0x19'),_0x210832);clearTimeout(_0x34898e);_0x34898e=undefined;_0x239da7[_0xf6b7('0x1a')]();if(_0x468a59[_0xf6b7('0x1b')][_0x210832]){delete _0x468a59[_0xf6b7('0x1b')][_0x210832];}_0x414e46[_0xf6b7('0x13')]();});_0x468a59[_0xf6b7('0x1b')][_0x210832]['on']('complete',function(){if(_0x468a59[_0xf6b7('0x1b')][_0x210832]){delete _0x468a59[_0xf6b7('0x1b')][_0x210832];}});_0x34898e=setTimeout(function(){logger[_0xf6b7('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x210832);clearTimeout(_0x34898e);_0x239da7[_0xf6b7('0x1a')]();_0x414e46['next']();},_0x162baf);strategy[_0xf6b7('0x1c')](_0x239da7,_0x1fa7ff,_0x468a59,_0x178aba);}else{logger[_0xf6b7('0xf')](_0xf6b7('0x1d'),_0x210832,_0x14254d['name']);_0x414e46[_0xf6b7('0x13')]();}}}catch(_0x8dc701){console['log'](_0x8dc701);logger[_0xf6b7('0xf')]('[%s][QUEUE]\x20%s',_0x210832,_0x8dc701[_0xf6b7('0x1e')]);_0x414e46['stop']();}};}; \ 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 30e156d..7486add 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 _0xa285=['sms','whatsapp','phone','interaction','channel','chat','account','AccountId','upperFirst','InteractionId','body','getMustacheRender','Message','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','next','providerName','providerResponse','stringify','create','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out'];(function(_0x534f7c,_0x3eb489){var _0x5c3e22=function(_0x5dd4a4){while(--_0x5dd4a4){_0x534f7c['push'](_0x534f7c['shift']());}};_0x5c3e22(++_0x3eb489);}(_0xa285,0x80));var _0x5a28=function(_0x4ec8ce,_0xf20520){_0x4ec8ce=_0x4ec8ce-0x0;var _0x75a47c=_0xa285[_0x4ec8ce];return _0x75a47c;};'use strict';var _=require(_0x5a28('0x0'));var moment=require(_0x5a28('0x1'));var AWS=require('aws-sdk');var utils=require(_0x5a28('0x2'));var logger=require(_0x5a28('0x3'))(_0x5a28('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5a28('0x5')),'mailMessage':require(_0x5a28('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x5a28('0x7')),'whatsappMessage':require(_0x5a28('0x8'))};exports[_0x5a28('0x9')]=function(_0x2cd6c4,_0x4f0f1b){return function(_0x3b4dc1){try{if(!_[_0x5a28('0xa')](this['interaction'][_0x5a28('0xb')])){logger[_0x5a28('0xc')](_0x5a28('0xd'),_0x2cd6c4,_0x5a28('0xe'));return _0x3b4dc1['next']();}var _0x20be58={'ContactId':this[_0x5a28('0xf')]['id'],'sentAt':moment()[_0x5a28('0x10')](_0x5a28('0x11')),'direction':_0x5a28('0x12')};if(this['channel']===_0x5a28('0x13')||this['channel']===_0x5a28('0x14')){_0x20be58[_0x5a28('0x15')]=this[_0x5a28('0x16')][_0x5a28('0x15')];}var _0x2760f1=this[_0x5a28('0x17')];if(_0x2760f1===_0x5a28('0x18')){_0x20be58['ChatWebsiteId']=this[_0x5a28('0x19')]['id'];}else{_0x20be58[_['upperFirst'](_0x2760f1)+_0x5a28('0x1a')]=this[_0x5a28('0x19')]['id'];}_0x20be58[_[_0x5a28('0x1b')](_0x2760f1)+_0x5a28('0x1c')]=this[_0x5a28('0x16')]['id'];if(this[_0x5a28('0x16')]['created']){var _0x49cdcf=_0x4f0f1b[0x4];if(!_['isEmpty'](_0x49cdcf)){_0x20be58[_0x5a28('0x1d')]=utils[_0x5a28('0x1e')](_0x49cdcf,this);return rpc[_0x2760f1+_0x5a28('0x1f')]['create'](_0x20be58)[_0x5a28('0x20')](function(_0x219a24){logger[_0x5a28('0xc')](_0x5a28('0xd'),_0x2cd6c4,_0x20be58[_0x5a28('0x1d')]);})[_0x5a28('0x21')](function(_0x1a2a31){logger[_0x5a28('0x22')](_0x5a28('0xd'),_0x2cd6c4,JSON['stringify'](_0x1a2a31));})[_0x5a28('0x23')](function(){logger[_0x5a28('0xc')](_0x5a28('0x24'),_0x2cd6c4);_0x3b4dc1['stop']();});}else{logger[_0x5a28('0xc')](_0x5a28('0x25'),_0x2cd6c4);_0x3b4dc1[_0x5a28('0x26')]();}}else{var _0x410186=this;var _0x5efe7b=new AWS[(_0x5a28('0x27'))]({'accessKeyId':_0x4f0f1b[0x0],'secretAccessKey':_0x4f0f1b[0x1],'region':_0x4f0f1b[0x2]});var _0x4f8160={'botAlias':_0x5a28('0x28'),'botName':_0x4f0f1b[0x3],'inputText':this[_0x5a28('0x29')][_0x5a28('0x1d')],'userId':this[_0x5a28('0x17')]+':'+this['interaction']['id'][_0x5a28('0x2a')]()};_0x5efe7b['postText'](_0x4f8160,function(_0x431fb6,_0x547c34){if(_0x431fb6){logger[_0x5a28('0x22')]('[%s][AMAZONLEX]\x20%s',_0x2cd6c4,_0x431fb6[_0x5a28('0x29')]);_0x3b4dc1[_0x5a28('0x2b')]();}else if(_0x547c34&&_0x547c34[_0x5a28('0x29')]){_0x410186[_0x5a28('0x1d')]['amazonlex']=_0x547c34;_0x20be58[_0x5a28('0x1d')]=_0x547c34[_0x5a28('0x29')];_0x20be58[_0x5a28('0x2c')]='amazonlex';_0x20be58[_0x5a28('0x2d')]=JSON[_0x5a28('0x2e')](_0x547c34);return rpc[_0x2760f1+_0x5a28('0x1f')][_0x5a28('0x2f')](_0x20be58)[_0x5a28('0x20')](function(_0x560882){logger[_0x5a28('0xc')](_0x5a28('0xd'),_0x2cd6c4,_0x20be58[_0x5a28('0x1d')]);if(_0x547c34['dialogState']==_0x5a28('0x30')){_0x3b4dc1[_0x5a28('0x2b')]();}else{_0x3b4dc1[_0x5a28('0x26')]();}})[_0x5a28('0x21')](function(_0x54e1c4){logger[_0x5a28('0x22')](_0x5a28('0xd'),_0x2cd6c4,JSON['stringify'](_0x54e1c4));_0x3b4dc1[_0x5a28('0x2b')]();});}else{_0x3b4dc1[_0x5a28('0x2b')]();}});}}catch(_0x548be5){logger[_0x5a28('0x22')]('[%s][AMAZONLEX]\x20%s',_0x2cd6c4,JSON['stringify'](_0x548be5));_0x3b4dc1[_0x5a28('0x26')]();}};}; \ No newline at end of file +var _0x722e=['../../rpc/faxMessage','../../rpc/whatsappMessage','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','interaction','phone','ChatWebsiteId','account','upperFirst','InteractionId','created','create','then','body','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','message','amazonlex','providerName','providerResponse','dialogState','catch','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x722e,0xe2));var _0xe722=function(_0x18dad0,_0x5d5022){_0x18dad0=_0x18dad0-0x0;var _0x2a0475=_0x722e[_0x18dad0];return _0x2a0475;};'use strict';var _=require('lodash');var moment=require(_0xe722('0x0'));var AWS=require(_0xe722('0x1'));var utils=require(_0xe722('0x2'));var logger=require(_0xe722('0x3'))(_0xe722('0x4'));var rpc={'chatMessage':require(_0xe722('0x5')),'openchannelMessage':require(_0xe722('0x6')),'mailMessage':require(_0xe722('0x7')),'smsMessage':require(_0xe722('0x8')),'faxMessage':require(_0xe722('0x9')),'whatsappMessage':require(_0xe722('0xa'))};exports['consequence']=function(_0x133d61,_0x361bf7){return function(_0x2a9bfd){try{if(!_['isNil'](this['interaction'][_0xe722('0xb')])){logger[_0xe722('0xc')](_0xe722('0xd'),_0x133d61,_0xe722('0xe'));return _0x2a9bfd[_0xe722('0xf')]();}var _0x5de63f={'ContactId':this[_0xe722('0x10')]['id'],'sentAt':moment()[_0xe722('0x11')](_0xe722('0x12')),'direction':_0xe722('0x13')};if(this[_0xe722('0x14')]==='sms'||this[_0xe722('0x14')]===_0xe722('0x15')){_0x5de63f['phone']=this[_0xe722('0x16')][_0xe722('0x17')];}var _0x22197e=this[_0xe722('0x14')];if(_0x22197e==='chat'){_0x5de63f[_0xe722('0x18')]=this[_0xe722('0x19')]['id'];}else{_0x5de63f[_[_0xe722('0x1a')](_0x22197e)+'AccountId']=this[_0xe722('0x19')]['id'];}_0x5de63f[_[_0xe722('0x1a')](_0x22197e)+_0xe722('0x1b')]=this[_0xe722('0x16')]['id'];if(this[_0xe722('0x16')][_0xe722('0x1c')]){var _0x271d64=_0x361bf7[0x4];if(!_['isEmpty'](_0x271d64)){_0x5de63f['body']=utils['getMustacheRender'](_0x271d64,this);return rpc[_0x22197e+'Message'][_0xe722('0x1d')](_0x5de63f)[_0xe722('0x1e')](function(_0x487596){logger['info']('[%s][AMAZONLEX]\x20%s',_0x133d61,_0x5de63f[_0xe722('0x1f')]);})['catch'](function(_0x228ddf){logger[_0xe722('0x20')](_0xe722('0xd'),_0x133d61,JSON[_0xe722('0x21')](_0x228ddf));})['finally'](function(){logger[_0xe722('0xc')](_0xe722('0x22'),_0x133d61);_0x2a9bfd[_0xe722('0x23')]();});}else{logger[_0xe722('0xc')](_0xe722('0x24'),_0x133d61);_0x2a9bfd[_0xe722('0x23')]();}}else{var _0x56b904=this;var _0x1059c3=new AWS[(_0xe722('0x25'))]({'accessKeyId':_0x361bf7[0x0],'secretAccessKey':_0x361bf7[0x1],'region':_0x361bf7[0x2]});var _0x1b5c1a={'botAlias':_0xe722('0x26'),'botName':_0x361bf7[0x3],'inputText':this['message'][_0xe722('0x1f')],'userId':this[_0xe722('0x14')]+':'+this['interaction']['id'][_0xe722('0x27')]()};_0x1059c3[_0xe722('0x28')](_0x1b5c1a,function(_0x3ec7ea,_0x45db3a){if(_0x3ec7ea){logger[_0xe722('0x20')](_0xe722('0xd'),_0x133d61,_0x3ec7ea['message']);_0x2a9bfd[_0xe722('0xf')]();}else if(_0x45db3a&&_0x45db3a[_0xe722('0x29')]){_0x56b904[_0xe722('0x1f')][_0xe722('0x2a')]=_0x45db3a;_0x5de63f[_0xe722('0x1f')]=_0x45db3a[_0xe722('0x29')];_0x5de63f[_0xe722('0x2b')]=_0xe722('0x2a');_0x5de63f[_0xe722('0x2c')]=JSON[_0xe722('0x21')](_0x45db3a);return rpc[_0x22197e+'Message']['create'](_0x5de63f)[_0xe722('0x1e')](function(_0x5cf486){logger['info'](_0xe722('0xd'),_0x133d61,_0x5de63f['body']);if(_0x45db3a[_0xe722('0x2d')]=='Failed'){_0x2a9bfd[_0xe722('0xf')]();}else{_0x2a9bfd[_0xe722('0x23')]();}})[_0xe722('0x2e')](function(_0x28d3b3){logger[_0xe722('0x20')](_0xe722('0xd'),_0x133d61,JSON[_0xe722('0x21')](_0x28d3b3));_0x2a9bfd['next']();});}else{_0x2a9bfd['next']();}});}}catch(_0x35830e){logger[_0xe722('0x20')](_0xe722('0xd'),_0x133d61,JSON[_0xe722('0x21')](_0x35830e));_0x2a9bfd[_0xe722('0x23')]();}};}; \ 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 57e6e1c..1919af2 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 _0xbdc2=['[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','catch','error','lodash','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','mail','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Smtp','service','host','port','secure','authentication','user','pass','inReplyTo','messageId','html','','replace','';_0x4bf71d['headers']={'Auto-Submitted':_0x2bdc('0x33'),'X-Auto-Response-Suppress':_0x2bdc('0x34'),'Precedence':_0x2bdc('0x35')};return mailRpc[_0x2bdc('0x36')](_0x3af3be,_0x4bf71d)[_0x2bdc('0x37')](function(_0x17817f){logger[_0x2bdc('0xc')](_0x2bdc('0x38'),_0x4bf5cd);_0x4bf71d[_0x2bdc('0x2d')]=_0x17817f[_0x2bdc('0x16')]['messageId'];return rpc[_0x386e58+_0x2bdc('0x39')][_0x2bdc('0x3a')](_0x4bf71d);})[_0x2bdc('0x37')](function(_0x2e0e99){logger[_0x2bdc('0xc')](_0x2bdc('0xd'),_0x4bf5cd,JSON[_0x2bdc('0x3b')](_0x2e0e99));})['catch'](function(_0x2c0d14){logger['error'](_0x2bdc('0x3c'),_0x4bf5cd,JSON['stringify'](_0x2c0d14));})[_0x2bdc('0x3d')](function(){_0x9e129f[_0x2bdc('0xf')]();});}else{return rpc[this[_0x2bdc('0x10')]+_0x2bdc('0x39')]['create'](_0x4bf71d)[_0x2bdc('0x37')](function(_0x22b453){logger['info'](_0x2bdc('0xd'),_0x4bf5cd,_0x4bf71d[_0x2bdc('0x14')]);})[_0x2bdc('0x3e')](function(_0x379232){logger[_0x2bdc('0x3f')]('[%s][AUTOREPLY]\x20%s',_0x4bf5cd,JSON['stringify'](_0x379232));})['finally'](function(){_0x9e129f['next']();});}}}catch(_0x3e63cc){logger[_0x2bdc('0x3f')](_0x2bdc('0xd'),_0x4bf5cd,JSON[_0x2bdc('0x3b')](_0x3e63cc));_0x9e129f['stop']();}};}; \ No newline at end of file +var _0xa486=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','Autoreply\x20already\x20sent','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Smtp','host','port','secure','user','inReplyTo','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','then','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','next','create','[%s][AUTOREPLY]\x20%s','error','lodash','./utils','routing'];(function(_0x517cf3,_0x3fec76){var _0x49c861=function(_0x379f79){while(--_0x379f79){_0x517cf3['push'](_0x517cf3['shift']());}};_0x49c861(++_0x3fec76);}(_0xa486,0x17d));var _0x6a48=function(_0x19c259,_0x45d551){_0x19c259=_0x19c259-0x0;var _0x3ce6b0=_0xa486[_0x19c259];return _0x3ce6b0;};'use strict';var _=require(_0x6a48('0x0'));var moment=require('moment');var utils=require(_0x6a48('0x1'));var logger=require('../../../../config/logger')(_0x6a48('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6a48('0x3')),'mailMessage':require(_0x6a48('0x4')),'smsMessage':require(_0x6a48('0x5')),'faxMessage':require(_0x6a48('0x6')),'whatsappMessage':require(_0x6a48('0x7'))};var mailRpc=require(_0x6a48('0x8'));exports[_0x6a48('0x9')]=function(_0x3d81f7,_0x124af7){return function(_0x121665){try{if(_0x124af7[0x0]==='1'&&(_[_0x6a48('0xa')](this[_0x6a48('0xb')][_0x6a48('0xc')])||!this[_0x6a48('0xb')][_0x6a48('0xc')])){logger[_0x6a48('0xd')]('[%s][AUTOREPLY]\x20%s',_0x3d81f7,_0x6a48('0xe'));return _0x121665['next']();}var _0x17bc14=this[_0x6a48('0xf')];var _0x158714={'ContactId':this[_0x6a48('0x10')]['id'],'sentAt':moment()[_0x6a48('0x11')](_0x6a48('0x12')),'direction':_0x6a48('0x13')};if(this[_0x6a48('0xf')]===_0x6a48('0x14')){_0x158714[_0x6a48('0x15')]=utils[_0x6a48('0x16')](_0x124af7[0x2],this);}else{_0x158714[_0x6a48('0x15')]=utils[_0x6a48('0x16')](_0x124af7[0x1],this);}if(this[_0x6a48('0x17')]){_0x158714['to']=this[_0x6a48('0x17')][_0x6a48('0x18')]||'';if(this[_0x6a48('0xf')]===_0x6a48('0x14')&&_0x124af7[0x1]==='1'){_0x158714['cc']=this[_0x6a48('0x17')]['cc']||'';}_0x158714[_0x6a48('0x18')]=this[_0x6a48('0x17')]['to']||'';_0x158714[_0x6a48('0x19')]=this[_0x6a48('0x17')][_0x6a48('0x19')]||'';_0x158714[_0x6a48('0x1a')]=!![];if(this[_0x6a48('0x17')][_0x6a48('0x1b')]){_0x158714[_0x6a48('0x1b')]='';_0x158714['subject']+=_[_0x6a48('0x1c')](this[_0x6a48('0x17')][_0x6a48('0x1b')],_0x6a48('0x1d'))?'':'Re:\x20';_0x158714[_0x6a48('0x1b')]+=this[_0x6a48('0x17')][_0x6a48('0x1b')];}}if(this['channel']===_0x6a48('0x1e')){_0x158714[_0x6a48('0x1f')]=this[_0x6a48('0x20')]['id'];}else{_0x158714[_['upperFirst'](this[_0x6a48('0xf')])+_0x6a48('0x21')]=this[_0x6a48('0x20')]['id'];}_0x158714[_[_0x6a48('0x22')](this['channel'])+_0x6a48('0x23')]=this[_0x6a48('0xb')]['id'];if(rpc[this['channel']+'Message']){if(this[_0x6a48('0xf')]===_0x6a48('0x14')){var _0x4cb5d0={'tls':{'rejectUnauthorized':![]}};if(this[_0x6a48('0x20')]['Smtp']['service']){_0x4cb5d0['service']=this['account'][_0x6a48('0x24')]['service'];}else{_0x4cb5d0[_0x6a48('0x25')]=this['account']['Smtp']['host'];_0x4cb5d0['port']=this[_0x6a48('0x20')][_0x6a48('0x24')][_0x6a48('0x26')];_0x4cb5d0[_0x6a48('0x27')]=this['account'][_0x6a48('0x24')][_0x6a48('0x27')];}if(this[_0x6a48('0x20')][_0x6a48('0x24')]['authentication']){_0x4cb5d0['auth']={'user':this[_0x6a48('0x20')][_0x6a48('0x24')][_0x6a48('0x28')],'pass':this[_0x6a48('0x20')][_0x6a48('0x24')]['pass']};}_0x158714[_0x6a48('0x29')]=this['message']['messageId'];_0x158714[_0x6a48('0x2a')]=_0x6a48('0x2b')+_[_0x6a48('0x2c')](_0x158714[_0x6a48('0x15')],_0x6a48('0x2d'),_0x6a48('0x2e'))+_0x6a48('0x2f');_0x158714[_0x6a48('0x30')]={'Auto-Submitted':_0x6a48('0x31'),'X-Auto-Response-Suppress':_0x6a48('0x32'),'Precedence':_0x6a48('0x33')};return mailRpc[_0x6a48('0x34')](_0x4cb5d0,_0x158714)['then'](function(_0x3e0bc6){logger[_0x6a48('0xd')](_0x6a48('0x35'),_0x3d81f7);_0x158714['messageId']=_0x3e0bc6[_0x6a48('0x17')]['messageId'];return rpc[_0x17bc14+_0x6a48('0x36')]['create'](_0x158714);})[_0x6a48('0x37')](function(_0x259cab){logger[_0x6a48('0xd')]('[%s][AUTOREPLY]\x20%s',_0x3d81f7,JSON[_0x6a48('0x38')](_0x259cab));})[_0x6a48('0x39')](function(_0x51703a){logger['error'](_0x6a48('0x3a'),_0x3d81f7,JSON[_0x6a48('0x38')](_0x51703a));})[_0x6a48('0x3b')](function(){_0x121665[_0x6a48('0x3c')]();});}else{return rpc[this[_0x6a48('0xf')]+_0x6a48('0x36')][_0x6a48('0x3d')](_0x158714)[_0x6a48('0x37')](function(_0x57a36b){logger[_0x6a48('0xd')](_0x6a48('0x3e'),_0x3d81f7,_0x158714[_0x6a48('0x15')]);})[_0x6a48('0x39')](function(_0x228297){logger[_0x6a48('0x3f')](_0x6a48('0x3e'),_0x3d81f7,JSON[_0x6a48('0x38')](_0x228297));})[_0x6a48('0x3b')](function(){_0x121665[_0x6a48('0x3c')]();});}}}catch(_0x102ea2){logger[_0x6a48('0x3f')](_0x6a48('0x3e'),_0x3d81f7,JSON[_0x6a48('0x38')](_0x102ea2));_0x121665['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 8f46df8..0277882 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5db2=['[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info'];(function(_0x4c1a00,_0xcbd8e5){var _0xe74851=function(_0x2c4253){while(--_0x2c4253){_0x4c1a00['push'](_0x4c1a00['shift']());}};_0xe74851(++_0xcbd8e5);}(_0x5db2,0xf3));var _0x25db=function(_0x199dfd,_0x320a1c){_0x199dfd=_0x199dfd-0x0;var _0x34c290=_0x5db2[_0x199dfd];return _0x34c290;};'use strict';var moment=require(_0x25db('0x0'));var logger=require(_0x25db('0x1'))(_0x25db('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x25db('0x3')),'smsInteraction':require(_0x25db('0x4')),'mailInteraction':require(_0x25db('0x5')),'faxInteraction':require(_0x25db('0x6')),'whatsappInteraction':require(_0x25db('0x7'))};exports[_0x25db('0x8')]=function(_0x40e4bc,_0x1d0224,_0x4b9260,_0x248306){return function(_0x497759){try{logger[_0x25db('0x9')](_0x25db('0xa'),_0x40e4bc,_0x1d0224[0x0]);var _0x40f7eb={'closed':0x1,'closedAt':moment()[_0x25db('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x1d0224[0x0]};if(rpc[_0x248306[_0x25db('0xc')]+_0x25db('0xd')]){rpc[_0x248306[_0x25db('0xc')]+_0x25db('0xd')][_0x25db('0xe')](_0x248306[_0x25db('0xf')]['id'],_0x40f7eb)[_0x25db('0x10')](function(_0x470d43){logger[_0x25db('0x9')](_0x25db('0x11'),_0x40e4bc,_0x248306[_0x25db('0xf')]['id']);})[_0x25db('0x12')](function(_0x4879c2){logger[_0x25db('0x13')](_0x25db('0x14'),_0x40e4bc,JSON[_0x25db('0x15')](_0x4879c2));})['finally'](function(){_0x497759[_0x25db('0x16')]();});}}catch(_0x1ad722){logger[_0x25db('0x13')](_0x25db('0x14'),_0x40e4bc,JSON[_0x25db('0x15')](_0x1ad722));_0x497759[_0x25db('0x16')]();}};}; \ No newline at end of file +var _0x7f59=['channel','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','finally','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x7f59,0x12e));var _0x97f5=function(_0x40ec6b,_0x7133ff){_0x40ec6b=_0x40ec6b-0x0;var _0x5a3462=_0x7f59[_0x40ec6b];return _0x5a3462;};'use strict';var moment=require(_0x97f5('0x0'));var logger=require(_0x97f5('0x1'))('routing');var rpc={'chatInteraction':require(_0x97f5('0x2')),'openchannelInteraction':require(_0x97f5('0x3')),'smsInteraction':require(_0x97f5('0x4')),'mailInteraction':require(_0x97f5('0x5')),'faxInteraction':require(_0x97f5('0x6')),'whatsappInteraction':require(_0x97f5('0x7'))};exports[_0x97f5('0x8')]=function(_0x5e6215,_0x507c36,_0x498110,_0x5d7027){return function(_0x2ad891){try{logger[_0x97f5('0x9')](_0x97f5('0xa'),_0x5e6215,_0x507c36[0x0]);var _0x317b2d={'closed':0x1,'closedAt':moment()[_0x97f5('0xb')](_0x97f5('0xc')),'closeReason':'system','disposition':_0x507c36[0x0]};if(rpc[_0x5d7027['channel']+'Interaction']){rpc[_0x5d7027[_0x97f5('0xd')]+'Interaction'][_0x97f5('0xe')](_0x5d7027[_0x97f5('0xf')]['id'],_0x317b2d)['then'](function(_0x1a9e14){logger[_0x97f5('0x9')](_0x97f5('0x10'),_0x5e6215,_0x5d7027[_0x97f5('0xf')]['id']);})['catch'](function(_0x3e9348){logger['error']('[%s][CLOSE]\x20%s',_0x5e6215,JSON['stringify'](_0x3e9348));})[_0x97f5('0x11')](function(){_0x2ad891['stop']();});}}catch(_0x2bb71d){logger['error'](_0x97f5('0x12'),_0x5e6215,JSON[_0x97f5('0x13')](_0x2bb71d));_0x2ad891[_0x97f5('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 8e105fc..db71743 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4edf=['consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','then','body','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','result','fulfillment','speech','providerName','providerResponse','Message','metadata','endConversation','next','message','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x4edf,0x196));var _0xf4ed=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0x4edf[_0x13524d];return _0x9918b4;};'use strict';var _=require(_0xf4ed('0x0'));var moment=require(_0xf4ed('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0xf4ed('0x2'));var logger=require(_0xf4ed('0x3'))(_0xf4ed('0x4'));var rpc={'chatMessage':require(_0xf4ed('0x5')),'openchannelMessage':require(_0xf4ed('0x6')),'mailMessage':require(_0xf4ed('0x7')),'smsMessage':require(_0xf4ed('0x8')),'faxMessage':require(_0xf4ed('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xf4ed('0xa')]=function(_0x174d4b,_0x477cb2){return function(_0x2f0995){try{if(!_[_0xf4ed('0xb')](this[_0xf4ed('0xc')][_0xf4ed('0xd')])){logger[_0xf4ed('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x174d4b,_0xf4ed('0xf'));return _0x2f0995['next']();}var _0x2e9388={'ContactId':this[_0xf4ed('0x10')]['id'],'sentAt':moment()[_0xf4ed('0x11')](_0xf4ed('0x12')),'direction':_0xf4ed('0x13')};if(this[_0xf4ed('0x14')]===_0xf4ed('0x15')||this[_0xf4ed('0x14')]===_0xf4ed('0x16')){_0x2e9388[_0xf4ed('0x17')]=this[_0xf4ed('0xc')]['phone'];}var _0x5cc7dd=this[_0xf4ed('0x14')];if(_0x5cc7dd===_0xf4ed('0x18')){_0x2e9388[_0xf4ed('0x19')]=this[_0xf4ed('0x1a')]['id'];}else{_0x2e9388[_[_0xf4ed('0x1b')](_0x5cc7dd)+_0xf4ed('0x1c')]=this[_0xf4ed('0x1a')]['id'];}_0x2e9388[_['upperFirst'](_0x5cc7dd)+'InteractionId']=this[_0xf4ed('0xc')]['id'];if(this[_0xf4ed('0xc')][_0xf4ed('0x1d')]){var _0x32d3bd=_0x477cb2[0x2];if(!_[_0xf4ed('0x1e')](_0x32d3bd)){_0x2e9388['body']=utils[_0xf4ed('0x1f')](_0x32d3bd,this);return rpc[_0x5cc7dd+'Message']['create'](_0x2e9388)[_0xf4ed('0x20')](function(_0x5e03a3){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x174d4b,_0x2e9388[_0xf4ed('0x21')]);})[_0xf4ed('0x22')](function(_0xd196c9){logger[_0xf4ed('0x23')](_0xf4ed('0x24'),_0x174d4b,JSON[_0xf4ed('0x25')](_0xd196c9));})[_0xf4ed('0x26')](function(){logger[_0xf4ed('0xe')](_0xf4ed('0x27'),_0x174d4b);_0x2f0995[_0xf4ed('0x28')]();});}else{logger[_0xf4ed('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x174d4b);_0x2f0995[_0xf4ed('0x28')]();}}else{var _0x1e0010=this;var _0x20c308=apiai(_0x477cb2[0x0],{'language':_0x477cb2[0x1]||'en'});return _0x20c308[_0xf4ed('0x29')](this['message']['body'],{'sessionId':md5(this[_0xf4ed('0xc')]['id'])})[_0xf4ed('0x20')](function(_0x7dc8fc){_0x1e0010['body']['dialogflow']=_0x7dc8fc;_0x2e9388['body']=_0x7dc8fc[_0xf4ed('0x2a')][_0xf4ed('0x2b')][_0xf4ed('0x2c')];_0x2e9388[_0xf4ed('0x2d')]='dialogflow';_0x2e9388[_0xf4ed('0x2e')]=JSON['stringify'](_0x7dc8fc);return rpc[_0x5cc7dd+_0xf4ed('0x2f')]['create'](_0x2e9388)[_0xf4ed('0x20')](function(_0x4f92b8){logger['info'](_0xf4ed('0x24'),_0x174d4b,_0x2e9388['body']);if(_0x7dc8fc['result'][_0xf4ed('0x30')][_0xf4ed('0x31')]){_0x2f0995[_0xf4ed('0x32')]();}else{_0x2f0995['stop']();}})[_0xf4ed('0x22')](function(_0x6dd95){logger[_0xf4ed('0x23')]('[%s][DIALOGFLOW]\x20%s',_0x174d4b,JSON[_0xf4ed('0x25')](_0x6dd95));_0x2f0995[_0xf4ed('0x32')]();});})[_0xf4ed('0x22')](function(_0x1ca371){logger[_0xf4ed('0x23')](_0xf4ed('0x24'),_0x174d4b,_0x1ca371[_0xf4ed('0x33')]);_0x2f0995[_0xf4ed('0x32')]();});}}catch(_0x244f61){logger[_0xf4ed('0x23')](_0xf4ed('0x24'),_0x174d4b,JSON[_0xf4ed('0x25')](_0x244f61));_0x2f0995['stop']();}};}; \ No newline at end of file +var _0x5859=['interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','create','then','body','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','dialogflow','fulfillment','speech','providerName','stringify','Message','result','metadata','endConversation','catch','lodash','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0x4903f9,_0x58c3f7){var _0x2c250e=function(_0xc5a7c9){while(--_0xc5a7c9){_0x4903f9['push'](_0x4903f9['shift']());}};_0x2c250e(++_0x58c3f7);}(_0x5859,0xe8));var _0x9585=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x5859[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require(_0x9585('0x0'));var moment=require('moment');var apiai=require(_0x9585('0x1'));var md5=require(_0x9585('0x2'));var utils=require(_0x9585('0x3'));var logger=require('../../../../config/logger')(_0x9585('0x4'));var rpc={'chatMessage':require(_0x9585('0x5')),'openchannelMessage':require(_0x9585('0x6')),'mailMessage':require(_0x9585('0x7')),'smsMessage':require(_0x9585('0x8')),'faxMessage':require(_0x9585('0x9')),'whatsappMessage':require(_0x9585('0xa'))};exports[_0x9585('0xb')]=function(_0x4ab2a8,_0x36a1b0){return function(_0x399a4c){try{if(!_[_0x9585('0xc')](this[_0x9585('0xd')]['UserId'])){logger[_0x9585('0xe')](_0x9585('0xf'),_0x4ab2a8,_0x9585('0x10'));return _0x399a4c[_0x9585('0x11')]();}var _0x1cef36={'ContactId':this[_0x9585('0x12')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x9585('0x13')};if(this[_0x9585('0x14')]===_0x9585('0x15')||this['channel']==='whatsapp'){_0x1cef36[_0x9585('0x16')]=this[_0x9585('0xd')][_0x9585('0x16')];}var _0x2834f3=this[_0x9585('0x14')];if(_0x2834f3===_0x9585('0x17')){_0x1cef36[_0x9585('0x18')]=this[_0x9585('0x19')]['id'];}else{_0x1cef36[_[_0x9585('0x1a')](_0x2834f3)+_0x9585('0x1b')]=this[_0x9585('0x19')]['id'];}_0x1cef36[_[_0x9585('0x1a')](_0x2834f3)+_0x9585('0x1c')]=this[_0x9585('0xd')]['id'];if(this['interaction']['created']){var _0x4e76b9=_0x36a1b0[0x2];if(!_[_0x9585('0x1d')](_0x4e76b9)){_0x1cef36['body']=utils[_0x9585('0x1e')](_0x4e76b9,this);return rpc[_0x2834f3+'Message'][_0x9585('0x1f')](_0x1cef36)[_0x9585('0x20')](function(_0x1562dd){logger['info'](_0x9585('0xf'),_0x4ab2a8,_0x1cef36[_0x9585('0x21')]);})['catch'](function(_0x2129cf){logger[_0x9585('0x22')](_0x9585('0xf'),_0x4ab2a8,JSON['stringify'](_0x2129cf));})[_0x9585('0x23')](function(){logger['info'](_0x9585('0x24'),_0x4ab2a8);_0x399a4c[_0x9585('0x25')]();});}else{logger['info'](_0x9585('0x26'),_0x4ab2a8);_0x399a4c[_0x9585('0x25')]();}}else{var _0x4d10dd=this;var _0x2da8db=apiai(_0x36a1b0[0x0],{'language':_0x36a1b0[0x1]||'en'});return _0x2da8db['textRequest'](this['message'][_0x9585('0x21')],{'sessionId':md5(this[_0x9585('0xd')]['id'])})[_0x9585('0x20')](function(_0x75b07a){_0x4d10dd[_0x9585('0x21')][_0x9585('0x27')]=_0x75b07a;_0x1cef36[_0x9585('0x21')]=_0x75b07a['result'][_0x9585('0x28')][_0x9585('0x29')];_0x1cef36[_0x9585('0x2a')]=_0x9585('0x27');_0x1cef36['providerResponse']=JSON[_0x9585('0x2b')](_0x75b07a);return rpc[_0x2834f3+_0x9585('0x2c')]['create'](_0x1cef36)[_0x9585('0x20')](function(_0x1ed934){logger[_0x9585('0xe')](_0x9585('0xf'),_0x4ab2a8,_0x1cef36[_0x9585('0x21')]);if(_0x75b07a[_0x9585('0x2d')][_0x9585('0x2e')][_0x9585('0x2f')]){_0x399a4c[_0x9585('0x11')]();}else{_0x399a4c[_0x9585('0x25')]();}})[_0x9585('0x30')](function(_0x544e70){logger[_0x9585('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x4ab2a8,JSON[_0x9585('0x2b')](_0x544e70));_0x399a4c['next']();});})['catch'](function(_0x520a6d){logger[_0x9585('0x22')](_0x9585('0xf'),_0x4ab2a8,_0x520a6d['message']);_0x399a4c[_0x9585('0x11')]();});}}catch(_0x212e7a){logger[_0x9585('0x22')](_0x9585('0xf'),_0x4ab2a8,JSON[_0x9585('0x2b')](_0x212e7a));_0x399a4c[_0x9585('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 922864f..5f56771 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff71=['providerName','dialogflowV2','providerResponse','length','fulfillmentText','push','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','isNil','interaction','UserId','next','contact','format','out','channel','sms','whatsapp','phone','account','upperFirst','AccountId','isEmpty','getMustacheRender','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_SCORE'];(function(_0x529c58,_0x5040d0){var _0x5ad8d8=function(_0x571785){while(--_0x571785){_0x529c58['push'](_0x529c58['shift']());}};_0x5ad8d8(++_0x5040d0);}(_0xff71,0x1b0));var _0x1ff7=function(_0x5ea2f9,_0x320917){_0x5ea2f9=_0x5ea2f9-0x0;var _0x36e586=_0xff71[_0x5ea2f9];return _0x36e586;};'use strict';var _=require(_0x1ff7('0x0'));var dialogflow=require(_0x1ff7('0x1'));var md5=require(_0x1ff7('0x2'));var moment=require(_0x1ff7('0x3'));var Promise=require(_0x1ff7('0x4'));var logger=require(_0x1ff7('0x5'))(_0x1ff7('0x6'));var utils=require(_0x1ff7('0x7'));var rpc={'chatMessage':require(_0x1ff7('0x8')),'openchannelMessage':require(_0x1ff7('0x9')),'mailMessage':require(_0x1ff7('0xa')),'smsMessage':require(_0x1ff7('0xb')),'faxMessage':require(_0x1ff7('0xc')),'whatsappMessage':require(_0x1ff7('0xd'))};function createMessage(_0x1c37b9,_0x4caaf4,_0x270b7c,_0x26a6fc){return new Promise(function(_0x536412,_0x19d0d1){var _0x3b9d0b=_[_0x1ff7('0xe')](_0x270b7c);_0x3b9d0b[_0x1ff7('0xf')]=_0x26a6fc;return rpc[_0x4caaf4+_0x1ff7('0x10')][_0x1ff7('0x11')](_0x3b9d0b)[_0x1ff7('0x12')](function(){logger[_0x1ff7('0x13')](_0x1ff7('0x14'),_0x1c37b9,_0x3b9d0b['body']);_0x536412();})['catch'](function(_0x5baf2c){logger[_0x1ff7('0x15')](_0x1ff7('0x14'),_0x1c37b9,JSON[_0x1ff7('0x16')](_0x5baf2c));_0x19d0d1(_0x5baf2c);});});}exports[_0x1ff7('0x17')]=function(_0x5089cd,_0x1cd479){return function(_0x53cca9){try{if(!_[_0x1ff7('0x18')](this[_0x1ff7('0x19')][_0x1ff7('0x1a')])){logger['info'](_0x1ff7('0x14'),_0x5089cd,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x53cca9[_0x1ff7('0x1b')]();}var _0x19d917={'ContactId':this[_0x1ff7('0x1c')]['id'],'sentAt':moment()[_0x1ff7('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x1ff7('0x1e')};if(this[_0x1ff7('0x1f')]===_0x1ff7('0x20')||this[_0x1ff7('0x1f')]===_0x1ff7('0x21')){_0x19d917[_0x1ff7('0x22')]=this[_0x1ff7('0x19')][_0x1ff7('0x22')];}var _0x309074=this[_0x1ff7('0x1f')];if(_0x309074==='chat'){_0x19d917['ChatWebsiteId']=this[_0x1ff7('0x23')]['id'];}else{_0x19d917[_[_0x1ff7('0x24')](_0x309074)+_0x1ff7('0x25')]=this[_0x1ff7('0x23')]['id'];}_0x19d917[_[_0x1ff7('0x24')](_0x309074)+'InteractionId']=this['interaction']['id'];if(this[_0x1ff7('0x19')]['created']){var _0x224f09=_0x1cd479[0x4];if(!_[_0x1ff7('0x26')](_0x224f09)){_0x19d917[_0x1ff7('0xf')]=utils[_0x1ff7('0x27')](_0x224f09,this);return rpc[_0x309074+_0x1ff7('0x10')][_0x1ff7('0x11')](_0x19d917)[_0x1ff7('0x12')](function(_0x45df14){logger[_0x1ff7('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x5089cd,_0x19d917[_0x1ff7('0xf')]);})[_0x1ff7('0x28')](function(_0x2bfbed){logger[_0x1ff7('0x15')](_0x1ff7('0x14'),_0x5089cd,JSON[_0x1ff7('0x16')](_0x2bfbed));})[_0x1ff7('0x29')](function(){logger[_0x1ff7('0x13')](_0x1ff7('0x2a'),_0x5089cd);_0x53cca9['stop']();});}else{logger[_0x1ff7('0x13')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5089cd);_0x53cca9[_0x1ff7('0x2b')]();}}else{var _0x3f95f8=this;var _0x3cec39=_0x1cd479[0x2][_0x1ff7('0x2c')](/\\n/g,'\x0a');var _0x31844a={'credentials':{'private_key':_0x3cec39,'client_email':_0x1cd479[0x1]}};var _0x444787=new dialogflow[(_0x1ff7('0x2d'))](_0x31844a);var _0x27b73b=_0x444787[_0x1ff7('0x2e')](_0x1cd479[0x0],md5(_0x3f95f8['interaction']['id']));var _0x4ecc54={'session':_0x27b73b,'queryInput':{'text':{'text':_0x3f95f8[_0x1ff7('0x2f')][_0x1ff7('0xf')],'languageCode':_0x1cd479[0x3]||'en'}}};return _0x444787[_0x1ff7('0x30')](_0x4ecc54)[_0x1ff7('0x12')](function(_0x40bec1){if(_0x40bec1&&_0x40bec1['length']){_0x3f95f8[_0x1ff7('0xf')]['dialogflowV2']=_0x40bec1;var _0x4f431f=_0x40bec1[0x0];var _0x2ab3ba=_0x4f431f[_0x1ff7('0x31')][_0x1ff7('0x32')]&&_0x4f431f[_0x1ff7('0x31')][_0x1ff7('0x32')][_0x1ff7('0x33')]?_0x4f431f[_0x1ff7('0x31')][_0x1ff7('0x32')][_0x1ff7('0x33')][_0x1ff7('0x34')][_0x1ff7('0x35')]:![];_0x3f95f8[_0x1ff7('0xf')]['DIALOGFLOWV2_ACTION']=_0x4f431f[_0x1ff7('0x31')][_0x1ff7('0x36')];_0x3f95f8[_0x1ff7('0xf')][_0x1ff7('0x37')]=_0x4f431f['queryResult'][_0x1ff7('0x38')];_0x3f95f8['body'][_0x1ff7('0x39')]=_0x4f431f[_0x1ff7('0x31')][_0x1ff7('0x32')]&&_0x4f431f[_0x1ff7('0x31')]['diagnosticInfo'][_0x1ff7('0x33')]?_0x4f431f['queryResult']['diagnosticInfo']['fields'][_0x1ff7('0x34')]['boolValue']:![];_0x3f95f8[_0x1ff7('0xf')]['DIALOGFLOWV2_INTENTNAME']=_0x4f431f[_0x1ff7('0x31')][_0x1ff7('0x3a')][_0x1ff7('0x3b')];_0x3f95f8[_0x1ff7('0xf')][_0x1ff7('0x3c')]=_0x4f431f[_0x1ff7('0x31')]['intent'][_0x1ff7('0x3d')];_0x3f95f8[_0x1ff7('0xf')][_0x1ff7('0x3e')]=_0x4f431f[_0x1ff7('0x31')][_0x1ff7('0x3a')][_0x1ff7('0x3f')];_0x3f95f8[_0x1ff7('0xf')]['DIALOGFLOWV2_LANGUAGECODE']=_0x4f431f[_0x1ff7('0x31')]['languageCode'];_0x3f95f8[_0x1ff7('0xf')]['DIALOGFLOWV2_QUERYTEXT']=_0x4f431f[_0x1ff7('0x31')]['queryText'];_0x3f95f8[_0x1ff7('0xf')][_0x1ff7('0x40')]=_0x4f431f[_0x1ff7('0x31')]['intentDetectionConfidence'];_0x19d917[_0x1ff7('0x41')]=_0x1ff7('0x42');_0x19d917[_0x1ff7('0x43')]=JSON[_0x1ff7('0x16')](_0x40bec1);var _0x3cc064=[];for(var _0x8abfb1=0x0;_0x8abfb1<_0x40bec1[_0x1ff7('0x44')];_0x8abfb1++){var _0x5a7a47=_0x40bec1[_0x8abfb1];if(_0x5a7a47&&_0x5a7a47[_0x1ff7('0x31')]&&_0x5a7a47['queryResult'][_0x1ff7('0x45')]){_0x3cc064[_0x1ff7('0x46')](createMessage(_0x5089cd,_0x309074,_0x19d917,_0x5a7a47[_0x1ff7('0x31')][_0x1ff7('0x45')]));}}return Promise['all'](_0x3cc064)['then'](function(){if(_0x2ab3ba){_0x53cca9[_0x1ff7('0x1b')]();}else{_0x53cca9[_0x1ff7('0x2b')]();}})['catch'](function(_0x674718){logger[_0x1ff7('0x15')]('[%s][DIALOGFLOWV2]\x20%s',_0x5089cd,JSON[_0x1ff7('0x16')](_0x674718));_0x53cca9[_0x1ff7('0x1b')]();});}})[_0x1ff7('0x28')](function(_0x583bdc){logger['error'](_0x1ff7('0x14'),_0x5089cd,_0x583bdc[_0x1ff7('0x2f')]);_0x53cca9[_0x1ff7('0x1b')]();});}}catch(_0x2babe9){logger[_0x1ff7('0x15')](_0x1ff7('0x14'),_0x5089cd,JSON[_0x1ff7('0x16')](_0x2babe9));_0x53cca9[_0x1ff7('0x2b')]();}};}; \ No newline at end of file +var _0x5d7c=['./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','queryResult','fields','diagnosticInfo','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerResponse','fulfillmentText','all','lodash','md5','moment','bluebird','../../../../config/logger','routing'];(function(_0x334fea,_0x1f1e18){var _0x3c5829=function(_0x4fd6ac){while(--_0x4fd6ac){_0x334fea['push'](_0x334fea['shift']());}};_0x3c5829(++_0x1f1e18);}(_0x5d7c,0x116));var _0xc5d7=function(_0x152e53,_0xf6761e){_0x152e53=_0x152e53-0x0;var _0x37a703=_0x5d7c[_0x152e53];return _0x37a703;};'use strict';var _=require(_0xc5d7('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xc5d7('0x1'));var moment=require(_0xc5d7('0x2'));var Promise=require(_0xc5d7('0x3'));var logger=require(_0xc5d7('0x4'))(_0xc5d7('0x5'));var utils=require(_0xc5d7('0x6'));var rpc={'chatMessage':require(_0xc5d7('0x7')),'openchannelMessage':require(_0xc5d7('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc5d7('0x9')),'faxMessage':require(_0xc5d7('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x2aff1c,_0x210ea3,_0x53fc4b,_0x4423e0){return new Promise(function(_0x31b3c4,_0x2ffffb){var _0x51de47=_[_0xc5d7('0xb')](_0x53fc4b);_0x51de47['body']=_0x4423e0;return rpc[_0x210ea3+_0xc5d7('0xc')][_0xc5d7('0xd')](_0x51de47)[_0xc5d7('0xe')](function(){logger['info'](_0xc5d7('0xf'),_0x2aff1c,_0x51de47['body']);_0x31b3c4();})[_0xc5d7('0x10')](function(_0x91f85c){logger[_0xc5d7('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x2aff1c,JSON[_0xc5d7('0x12')](_0x91f85c));_0x2ffffb(_0x91f85c);});});}exports[_0xc5d7('0x13')]=function(_0x17a732,_0x538764){return function(_0x1c7c1d){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0xc5d7('0x14')](_0xc5d7('0xf'),_0x17a732,_0xc5d7('0x15'));return _0x1c7c1d[_0xc5d7('0x16')]();}var _0x486027={'ContactId':this[_0xc5d7('0x17')]['id'],'sentAt':moment()[_0xc5d7('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xc5d7('0x19')};if(this[_0xc5d7('0x1a')]===_0xc5d7('0x1b')||this[_0xc5d7('0x1a')]===_0xc5d7('0x1c')){_0x486027[_0xc5d7('0x1d')]=this[_0xc5d7('0x1e')][_0xc5d7('0x1d')];}var _0x4239d2=this[_0xc5d7('0x1a')];if(_0x4239d2===_0xc5d7('0x1f')){_0x486027[_0xc5d7('0x20')]=this[_0xc5d7('0x21')]['id'];}else{_0x486027[_[_0xc5d7('0x22')](_0x4239d2)+_0xc5d7('0x23')]=this['account']['id'];}_0x486027[_[_0xc5d7('0x22')](_0x4239d2)+_0xc5d7('0x24')]=this[_0xc5d7('0x1e')]['id'];if(this['interaction'][_0xc5d7('0x25')]){var _0x509828=_0x538764[0x4];if(!_[_0xc5d7('0x26')](_0x509828)){_0x486027[_0xc5d7('0x27')]=utils['getMustacheRender'](_0x509828,this);return rpc[_0x4239d2+_0xc5d7('0xc')][_0xc5d7('0xd')](_0x486027)[_0xc5d7('0xe')](function(_0x1ba170){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x17a732,_0x486027[_0xc5d7('0x27')]);})[_0xc5d7('0x10')](function(_0x4b36b4){logger[_0xc5d7('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x17a732,JSON[_0xc5d7('0x12')](_0x4b36b4));})[_0xc5d7('0x28')](function(){logger[_0xc5d7('0x14')](_0xc5d7('0x29'),_0x17a732);_0x1c7c1d[_0xc5d7('0x2a')]();});}else{logger[_0xc5d7('0x14')](_0xc5d7('0x2b'),_0x17a732);_0x1c7c1d[_0xc5d7('0x2a')]();}}else{var _0x3f3c82=this;var _0x248e89=_0x538764[0x2][_0xc5d7('0x2c')](/\\n/g,'\x0a');var _0xcaa2b5={'credentials':{'private_key':_0x248e89,'client_email':_0x538764[0x1]}};var _0xf0726c=new dialogflow[(_0xc5d7('0x2d'))](_0xcaa2b5);var _0x1967fb=_0xf0726c[_0xc5d7('0x2e')](_0x538764[0x0],md5(_0x3f3c82['interaction']['id']));var _0x3dbca0={'session':_0x1967fb,'queryInput':{'text':{'text':_0x3f3c82[_0xc5d7('0x2f')]['body'],'languageCode':_0x538764[0x3]||'en'}}};return _0xf0726c[_0xc5d7('0x30')](_0x3dbca0)['then'](function(_0x32da9a){if(_0x32da9a&&_0x32da9a[_0xc5d7('0x31')]){_0x3f3c82['body']['dialogflowV2']=_0x32da9a;var _0x207ed5=_0x32da9a[0x0];var _0x25c1c6=_0x207ed5[_0xc5d7('0x32')]['diagnosticInfo']&&_0x207ed5['queryResult']['diagnosticInfo'][_0xc5d7('0x33')]?_0x207ed5['queryResult'][_0xc5d7('0x34')][_0xc5d7('0x33')]['end_conversation']['boolValue']:![];_0x3f3c82['body'][_0xc5d7('0x35')]=_0x207ed5[_0xc5d7('0x32')]['action'];_0x3f3c82['body'][_0xc5d7('0x36')]=_0x207ed5[_0xc5d7('0x32')][_0xc5d7('0x37')];_0x3f3c82['body'][_0xc5d7('0x38')]=_0x207ed5[_0xc5d7('0x32')]['diagnosticInfo']&&_0x207ed5['queryResult'][_0xc5d7('0x34')][_0xc5d7('0x33')]?_0x207ed5['queryResult'][_0xc5d7('0x34')]['fields']['end_conversation'][_0xc5d7('0x39')]:![];_0x3f3c82[_0xc5d7('0x27')][_0xc5d7('0x3a')]=_0x207ed5[_0xc5d7('0x32')][_0xc5d7('0x3b')]['name'];_0x3f3c82[_0xc5d7('0x27')][_0xc5d7('0x3c')]=_0x207ed5[_0xc5d7('0x32')][_0xc5d7('0x3b')][_0xc5d7('0x3d')];_0x3f3c82[_0xc5d7('0x27')][_0xc5d7('0x3e')]=_0x207ed5[_0xc5d7('0x32')][_0xc5d7('0x3b')]['isFallback'];_0x3f3c82[_0xc5d7('0x27')][_0xc5d7('0x3f')]=_0x207ed5['queryResult'][_0xc5d7('0x40')];_0x3f3c82[_0xc5d7('0x27')][_0xc5d7('0x41')]=_0x207ed5['queryResult'][_0xc5d7('0x42')];_0x3f3c82['body']['DIALOGFLOWV2_SCORE']=_0x207ed5[_0xc5d7('0x32')][_0xc5d7('0x43')];_0x486027['providerName']='dialogflowV2';_0x486027[_0xc5d7('0x44')]=JSON[_0xc5d7('0x12')](_0x32da9a);var _0x5ef07a=[];for(var _0x4d7e61=0x0;_0x4d7e61<_0x32da9a[_0xc5d7('0x31')];_0x4d7e61++){var _0x48772c=_0x32da9a[_0x4d7e61];if(_0x48772c&&_0x48772c['queryResult']&&_0x48772c['queryResult'][_0xc5d7('0x45')]){_0x5ef07a['push'](createMessage(_0x17a732,_0x4239d2,_0x486027,_0x48772c[_0xc5d7('0x32')][_0xc5d7('0x45')]));}}return Promise[_0xc5d7('0x46')](_0x5ef07a)['then'](function(){if(_0x25c1c6){_0x1c7c1d[_0xc5d7('0x16')]();}else{_0x1c7c1d['stop']();}})[_0xc5d7('0x10')](function(_0x2588c9){logger[_0xc5d7('0x11')](_0xc5d7('0xf'),_0x17a732,JSON['stringify'](_0x2588c9));_0x1c7c1d[_0xc5d7('0x16')]();});}})[_0xc5d7('0x10')](function(_0x173d50){logger[_0xc5d7('0x11')](_0xc5d7('0xf'),_0x17a732,_0x173d50['message']);_0x1c7c1d['next']();});}}catch(_0x199ef6){logger[_0xc5d7('0x11')](_0xc5d7('0xf'),_0x17a732,JSON['stringify'](_0x199ef6));_0x1c7c1d[_0xc5d7('0x2a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 2b9c2f6..58d2df8 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b2f=['priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','error','stringify','validate','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0x0b2f,0x191));var _0xf0b2=function(_0x3b9be0,_0x47ccb1){_0x3b9be0=_0x3b9be0-0x0;var _0x12d30c=_0x0b2f[_0x3b9be0];return _0x12d30c;};'use strict';var schema=require(_0xf0b2('0x0'));var _=require('lodash');var htmlToText=require(_0xf0b2('0x1'));var utils=require(_0xf0b2('0x2'));var logger=require(_0xf0b2('0x3'))('routing');var gotoif=schema({'condition':{'type':_0xf0b2('0x4'),'required':!![],'message':_0xf0b2('0x5')},'priorityTrue':{'type':_0xf0b2('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xf0b2('0x6'),'message':_0xf0b2('0x7')}});exports[_0xf0b2('0x8')]=function(_0x435e0f,_0x213205){return function(_0x2a10fb){try{var _0x4a7454={'condition':htmlToText['fromString'](utils[_0xf0b2('0x9')](_0x213205[0x0],this),{'wordwrap':![]})[_0xf0b2('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x213205[0x1],'priorityFalse':_0x213205[0x2]};var _0x3afbd8=gotoif['validate'](_0x4a7454,{'typecast':!![]});if(_0x3afbd8[_0xf0b2('0xb')]){logger['error'](_0xf0b2('0xc'),_0x435e0f,_[_0xf0b2('0xd')](_0x3afbd8,_0xf0b2('0xe'))[_0xf0b2('0xf')](',\x20'));_0x2a10fb[_0xf0b2('0x10')]();}else{try{var _0x1c1220=eval('('+_0x4a7454[_0xf0b2('0x11')]+')');var _0x48c646=_0x1c1220?_0x4a7454[_0xf0b2('0x12')]:_0x4a7454[_0xf0b2('0x13')];logger[_0xf0b2('0x14')](_0xf0b2('0x15'),_0x435e0f,_0x4a7454[_0xf0b2('0x11')],_0x1c1220,_0x48c646||'next');if(_0x48c646){var _0x19c79c=_[_0xf0b2('0x16')](_0x2a10fb[_0xf0b2('0x17')](),{'p':_0x48c646});if(_0x19c79c>=0x0){logger['info'](_0xf0b2('0x18'),_0x435e0f,_0x48c646||_0xf0b2('0x19'),_0x19c79c);_0x2a10fb[_0xf0b2('0x19')](_0x19c79c);}else{logger['info'](_0xf0b2('0x1a'),_0x435e0f,_0x48c646||_0xf0b2('0x19'));_0x2a10fb[_0xf0b2('0x10')]();}}else{_0x2a10fb[_0xf0b2('0x19')]();}}catch(_0x2e53b3){logger['error'](_0xf0b2('0x1b'),_0x435e0f,_0x2e53b3[_0xf0b2('0xe')]);_0x2a10fb['stop']();}}}catch(_0x7fd920){logger[_0xf0b2('0x1c')](_0xf0b2('0xc'),_0x435e0f,JSON[_0xf0b2('0x1d')](_0x7fd920));_0x2a10fb[_0xf0b2('0x10')]();}};}; \ No newline at end of file +var _0x4185=['stringify','lodash','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','validate','length','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20%s'];(function(_0x20dc53,_0x376b8c){var _0x51fb55=function(_0x87c9ba){while(--_0x87c9ba){_0x20dc53['push'](_0x20dc53['shift']());}};_0x51fb55(++_0x376b8c);}(_0x4185,0x1b4));var _0x5418=function(_0x120898,_0x1a3014){_0x120898=_0x120898-0x0;var _0x2373be=_0x4185[_0x120898];return _0x2373be;};'use strict';var schema=require('validate');var _=require(_0x5418('0x0'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0x5418('0x1'))(_0x5418('0x2'));var gotoif=schema({'condition':{'type':_0x5418('0x3'),'required':!![],'message':_0x5418('0x4')},'priorityTrue':{'type':_0x5418('0x5'),'message':_0x5418('0x6')},'priorityFalse':{'type':_0x5418('0x5'),'message':_0x5418('0x7')}});exports[_0x5418('0x8')]=function(_0x1bff2e,_0x3c9c6e){return function(_0xf0fd6d){try{var _0x286839={'condition':htmlToText['fromString'](utils[_0x5418('0x9')](_0x3c9c6e[0x0],this),{'wordwrap':![]})[_0x5418('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3c9c6e[0x1],'priorityFalse':_0x3c9c6e[0x2]};var _0x2639c4=gotoif[_0x5418('0xb')](_0x286839,{'typecast':!![]});if(_0x2639c4[_0x5418('0xc')]){logger['error']('[%s][GOTOIF]\x20%s',_0x1bff2e,_[_0x5418('0xd')](_0x2639c4,_0x5418('0xe'))[_0x5418('0xf')](',\x20'));_0xf0fd6d[_0x5418('0x10')]();}else{try{var _0x1196b4=eval('('+_0x286839[_0x5418('0x11')]+')');var _0x29f80a=_0x1196b4?_0x286839[_0x5418('0x12')]:_0x286839[_0x5418('0x13')];logger[_0x5418('0x14')](_0x5418('0x15'),_0x1bff2e,_0x286839[_0x5418('0x11')],_0x1196b4,_0x29f80a||_0x5418('0x16'));if(_0x29f80a){var _0x2d3058=_['findIndex'](_0xf0fd6d[_0x5418('0x17')](),{'p':_0x29f80a});if(_0x2d3058>=0x0){logger[_0x5418('0x14')](_0x5418('0x18'),_0x1bff2e,_0x29f80a||_0x5418('0x16'),_0x2d3058);_0xf0fd6d[_0x5418('0x16')](_0x2d3058);}else{logger[_0x5418('0x14')](_0x5418('0x19'),_0x1bff2e,_0x29f80a||'next');_0xf0fd6d[_0x5418('0x10')]();}}else{_0xf0fd6d[_0x5418('0x16')]();}}catch(_0x17b0f9){logger[_0x5418('0x1a')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x1bff2e,_0x17b0f9[_0x5418('0xe')]);_0xf0fd6d['stop']();}}}catch(_0x22cf5f){logger[_0x5418('0x1a')](_0x5418('0x1b'),_0x1bff2e,JSON[_0x5418('0x1c')](_0x22cf5f));_0xf0fd6d['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 69cad05..957d133 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 _0x6b41=['info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','stop','../../../../config/logger','number','consequence','validate','length','error','[%s][GOTOP]\x20%s','message','priority','findIndex','rules','next'];(function(_0xd46033,_0xa8f11f){var _0x2c64d9=function(_0x54475c){while(--_0x54475c){_0xd46033['push'](_0xd46033['shift']());}};_0x2c64d9(++_0xa8f11f);}(_0x6b41,0x74));var _0x16b4=function(_0x5ceda4,_0x56bb73){_0x5ceda4=_0x5ceda4-0x0;var _0x2c3f77=_0x6b41[_0x5ceda4];return _0x2c3f77;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0x16b4('0x0'))('routing');var gotop=schema({'priority':{'type':_0x16b4('0x1'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x16b4('0x2')]=function(_0x553f87,_0xf2b03c){return function(_0x1bcc3f){try{var _0x5e38f4={'priority':_0xf2b03c[0x0]};var _0x15259e=gotop[_0x16b4('0x3')](_0x5e38f4,{'typecast':!![]});if(_0x15259e[_0x16b4('0x4')]){logger[_0x16b4('0x5')](_0x16b4('0x6'),_0x553f87,_['map'](_0x15259e,_0x16b4('0x7'))['join'](',\x20'));_0x1bcc3f['stop']();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x553f87,_0x5e38f4[_0x16b4('0x8')]);if(_0x5e38f4['priority']){var _0x36d0a1=_[_0x16b4('0x9')](_0x1bcc3f[_0x16b4('0xa')](),{'p':_0x5e38f4[_0x16b4('0x8')]});if(_0x36d0a1>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x553f87,_0x5e38f4[_0x16b4('0x8')]||_0x16b4('0xb'),_0x36d0a1);_0x1bcc3f[_0x16b4('0xb')](_0x36d0a1);}else{logger[_0x16b4('0xc')](_0x16b4('0xd'),_0x553f87,_0x5e38f4[_0x16b4('0x8')]||'next');_0x1bcc3f['stop']();}}else{_0x1bcc3f['next']();}}}catch(_0x4a0512){logger[_0x16b4('0x5')](_0x16b4('0x6'),_0x553f87,JSON[_0x16b4('0xe')](_0x4a0512));_0x1bcc3f[_0x16b4('0xf')]();}};}; \ No newline at end of file +var _0x23c4=['map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','stringify','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','length','error','[%s][GOTOP]\x20%s'];(function(_0x12e4fc,_0xf01a75){var _0x197c91=function(_0x3922bb){while(--_0x3922bb){_0x12e4fc['push'](_0x12e4fc['shift']());}};_0x197c91(++_0xf01a75);}(_0x23c4,0x1a8));var _0x423c=function(_0x2a7e1a,_0xd188fa){_0x2a7e1a=_0x2a7e1a-0x0;var _0x202852=_0x23c4[_0x2a7e1a];return _0x202852;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0x423c('0x0'))(_0x423c('0x1'));var gotop=schema({'priority':{'type':_0x423c('0x2'),'required':!![],'message':_0x423c('0x3')}});exports['consequence']=function(_0x302ae4,_0x10ec08){return function(_0x50a49f){try{var _0x2fd8c4={'priority':_0x10ec08[0x0]};var _0x3e115d=gotop[_0x423c('0x4')](_0x2fd8c4,{'typecast':!![]});if(_0x3e115d[_0x423c('0x5')]){logger[_0x423c('0x6')](_0x423c('0x7'),_0x302ae4,_[_0x423c('0x8')](_0x3e115d,_0x423c('0x9'))['join'](',\x20'));_0x50a49f[_0x423c('0xa')]();}else{logger[_0x423c('0xb')](_0x423c('0xc'),_0x302ae4,_0x2fd8c4[_0x423c('0xd')]);if(_0x2fd8c4[_0x423c('0xd')]){var _0x2bc880=_[_0x423c('0xe')](_0x50a49f[_0x423c('0xf')](),{'p':_0x2fd8c4[_0x423c('0xd')]});if(_0x2bc880>=0x0){logger[_0x423c('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x302ae4,_0x2fd8c4[_0x423c('0xd')]||_0x423c('0x10'),_0x2bc880);_0x50a49f[_0x423c('0x10')](_0x2bc880);}else{logger[_0x423c('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x302ae4,_0x2fd8c4[_0x423c('0xd')]||_0x423c('0x10'));_0x50a49f['stop']();}}else{_0x50a49f['next']();}}}catch(_0x5bc80b){logger['error'](_0x423c('0x7'),_0x302ae4,JSON[_0x423c('0x11')](_0x5bc80b));_0x50a49f[_0x423c('0xa')]();}};}; \ 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 d223bce..7e3d1f9 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 _0xf3cc=['then','[%s][MESSAGE]\x20%s','next','catch','error','stop','stringify','lodash','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','contact','chat','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','create'];(function(_0x37c46b,_0x211aee){var _0x1ae8f7=function(_0x2adc97){while(--_0x2adc97){_0x37c46b['push'](_0x37c46b['shift']());}};_0x1ae8f7(++_0x211aee);}(_0xf3cc,0x14c));var _0xcf3c=function(_0x457bc6,_0x431adc){_0x457bc6=_0x457bc6-0x0;var _0x337f06=_0xf3cc[_0x457bc6];return _0x337f06;};'use strict';var _=require(_0xcf3c('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xcf3c('0x1'));var rpc={'chatMessage':require(_0xcf3c('0x2')),'openchannelMessage':require(_0xcf3c('0x3')),'mailMessage':require(_0xcf3c('0x4')),'smsMessage':require(_0xcf3c('0x5')),'faxMessage':require(_0xcf3c('0x6')),'whatsappMessage':require(_0xcf3c('0x7'))};exports['consequence']=function(_0x3968e2,_0x5a51fe){return function(_0x1931f4){try{var _0x2d55b8={'body':utils['getMustacheRender'](_0x5a51fe[0x0],this),'ContactId':this[_0xcf3c('0x8')]['id']};if(this['channel']===_0xcf3c('0x9')){_0x2d55b8['ChatWebsiteId']=this[_0xcf3c('0xa')]['id'];}else{_0x2d55b8[_[_0xcf3c('0xb')](this[_0xcf3c('0xc')])+_0xcf3c('0xd')]=this['account']['id'];}_0x2d55b8[_[_0xcf3c('0xb')](this[_0xcf3c('0xc')])+_0xcf3c('0xe')]=this[_0xcf3c('0xf')]['id'];if(rpc[this['channel']+_0xcf3c('0x10')]){return rpc[this[_0xcf3c('0xc')]+_0xcf3c('0x10')][_0xcf3c('0x11')](_0x2d55b8)[_0xcf3c('0x12')](function(_0x31e1ab){logger['info'](_0xcf3c('0x13'),_0x3968e2,_0x2d55b8['body']);_0x1931f4[_0xcf3c('0x14')]();})[_0xcf3c('0x15')](function(_0x49811c){logger[_0xcf3c('0x16')](_0xcf3c('0x13'),_0x3968e2,JSON['stringify'](_0x49811c));_0x1931f4[_0xcf3c('0x17')]();});}}catch(_0x5a21e2){logger[_0xcf3c('0x16')](_0xcf3c('0x13'),_0x3968e2,JSON[_0xcf3c('0x18')](_0x5a21e2));_0x1931f4[_0xcf3c('0x17')]();}};}; \ No newline at end of file +var _0x2793=['../../rpc/smsMessage','../../rpc/faxMessage','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId','InteractionId','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x2a97b2,_0x3357c9){var _0x101707=function(_0x378ccb){while(--_0x378ccb){_0x2a97b2['push'](_0x2a97b2['shift']());}};_0x101707(++_0x3357c9);}(_0x2793,0x173));var _0x3279=function(_0x95ac8b,_0x3706f5){_0x95ac8b=_0x95ac8b-0x0;var _0x5b0792=_0x2793[_0x95ac8b];return _0x5b0792;};'use strict';var _=require(_0x3279('0x0'));var utils=require(_0x3279('0x1'));var logger=require(_0x3279('0x2'))(_0x3279('0x3'));var rpc={'chatMessage':require(_0x3279('0x4')),'openchannelMessage':require(_0x3279('0x5')),'mailMessage':require(_0x3279('0x6')),'smsMessage':require(_0x3279('0x7')),'faxMessage':require(_0x3279('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x475d11,_0x3982a8){return function(_0x3df409){try{var _0x3699c7={'body':utils[_0x3279('0x9')](_0x3982a8[0x0],this),'ContactId':this[_0x3279('0xa')]['id']};if(this[_0x3279('0xb')]===_0x3279('0xc')){_0x3699c7['ChatWebsiteId']=this[_0x3279('0xd')]['id'];}else{_0x3699c7[_[_0x3279('0xe')](this['channel'])+_0x3279('0xf')]=this['account']['id'];}_0x3699c7[_[_0x3279('0xe')](this[_0x3279('0xb')])+_0x3279('0x10')]=this['interaction']['id'];if(rpc[this['channel']+_0x3279('0x11')]){return rpc[this[_0x3279('0xb')]+_0x3279('0x11')][_0x3279('0x12')](_0x3699c7)[_0x3279('0x13')](function(_0x1de43f){logger['info'](_0x3279('0x14'),_0x475d11,_0x3699c7[_0x3279('0x15')]);_0x3df409[_0x3279('0x16')]();})[_0x3279('0x17')](function(_0x15284b){logger[_0x3279('0x18')]('[%s][MESSAGE]\x20%s',_0x475d11,JSON[_0x3279('0x19')](_0x15284b));_0x3df409['stop']();});}}catch(_0x34bf09){logger['error'](_0x3279('0x14'),_0x475d11,JSON[_0x3279('0x19')](_0x34bf09));_0x3df409[_0x3279('0x1a')]();}};}; \ 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 834d7e2..21c00b2 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 _0x776b=['stringify','../../../../config/logger','routing','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x16b1b8,_0x432d03){var _0x558b1e=function(_0xf47f2f){while(--_0xf47f2f){_0x16b1b8['push'](_0x16b1b8['shift']());}};_0x558b1e(++_0x432d03);}(_0x776b,0x1cf));var _0xb776=function(_0x58c4b5,_0x3e2e36){_0x58c4b5=_0x58c4b5-0x0;var _0x238715=_0x776b[_0x58c4b5];return _0x238715;};'use strict';var utils=require('./utils');var logger=require(_0xb776('0x0'))(_0xb776('0x1'));exports['consequence']=function(_0x534ade,_0x136062){return function(_0x320168){try{logger['info'](_0xb776('0x2'),_0x534ade,utils[_0xb776('0x3')](_0x136062[0x0],this));_0x320168[_0xb776('0x4')]();}catch(_0x4be704){logger[_0xb776('0x5')]('[%s][NOOP]\x20%s',_0x534ade,JSON[_0xb776('0x6')](_0x4be704));_0x320168['stop']();}};}; \ No newline at end of file +var _0xe0d5=['../../../../config/logger','routing','info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','stop','./utils'];(function(_0x24f010,_0x4bc43d){var _0x2a308b=function(_0x5726b4){while(--_0x5726b4){_0x24f010['push'](_0x24f010['shift']());}};_0x2a308b(++_0x4bc43d);}(_0xe0d5,0xf9));var _0x5e0d=function(_0xb8d0d8,_0xd8d317){_0xb8d0d8=_0xb8d0d8-0x0;var _0x19251e=_0xe0d5[_0xb8d0d8];return _0x19251e;};'use strict';var utils=require(_0x5e0d('0x0'));var logger=require(_0x5e0d('0x1'))(_0x5e0d('0x2'));exports['consequence']=function(_0x17ee3e,_0x158384){return function(_0x45d118){try{logger[_0x5e0d('0x3')]('[%s][NOOP]\x20%s',_0x17ee3e,utils[_0x5e0d('0x4')](_0x158384[0x0],this));_0x45d118[_0x5e0d('0x5')]();}catch(_0x491d37){logger[_0x5e0d('0x6')](_0x5e0d('0x7'),_0x17ee3e,JSON[_0x5e0d('0x8')](_0x491d37));_0x45d118[_0x5e0d('0x9')]();}};}; \ 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 69a6928..6935aa9 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 _0xedd9=['[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','close','rules','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','info','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted'];(function(_0xbbc830,_0x136c01){var _0x3e4d65=function(_0x103d11){while(--_0x103d11){_0xbbc830['push'](_0xbbc830['shift']());}};_0x3e4d65(++_0x136c01);}(_0xedd9,0xfc));var _0x9edd=function(_0x486284,_0x51016d){_0x486284=_0x486284-0x0;var _0xcbf963=_0xedd9[_0x486284];return _0xcbf963;};'use strict';var schema=require('validate');var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var seqqueue=require(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var config=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var strategy=require('./strategy');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));var attributes=['id','queue_id',_0x9edd('0xb'),_0x9edd('0xc'),_0x9edd('0xd'),_0x9edd('0xe')];function emit(_0x49d5e3,_0x494a24,_0x5d2f90){io['to'](_0x49d5e3)[_0x9edd('0xf')](_0x494a24,_0x5d2f90);}function emitChannelQueueInteraction(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00,_0x30c0d7,_0x1b73d1,_0x25e64c){var _0xfd544a=_[_0x9edd('0x10')](_0xbf9da6);_0xfd544a[_0x9edd('0x11')]=_0x25e64c;_0xfd544a[_0x9edd('0xc')]=_0x523026;_0xfd544a[_0x9edd('0xb')]=_0x13dc4f;_0xfd544a['id']=_0x5b6c00;if(_0x30c0d7){_0x1b73d1[util['format'](_0x9edd('0x12'),_0x138767)][_0x5b6c00]=_[_0x9edd('0x13')](_0xfd544a,attributes);}else{delete _0x1b73d1[util[_0x9edd('0x14')](_0x9edd('0x12'),_0x138767)][_0x5b6c00];}emit(util[_0x9edd('0x14')](_0x9edd('0x15'),_0x138767,_0x523026),util[_0x9edd('0x14')](_0x9edd('0x16'),_0x138767,_0x30c0d7?'save':_0x9edd('0x17')),_[_0x9edd('0x13')](_0xfd544a,attributes));}var rpc={'openchannelQueueReport':require(_0x9edd('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9edd('0x19')),'smsQueueReport':require(_0x9edd('0x1a')),'faxQueueReport':require(_0x9edd('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9edd('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9edd('0x1d'),'message':_0x9edd('0x1e')}});function startRouting(_0x4bdb88,_0x498977,_0x45c3ab,_0x50338f){if(_0x4bdb88&&_0x498977&&_0x45c3ab){_0x498977[_0x9edd('0x1f')]+=0x1;var _0x54a03f={'uniqueid':_0x4bdb88,'from':_0x45c3ab['body']?_0x45c3ab[_0x9edd('0x20')][_0x9edd('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45c3ab[_0x9edd('0x21')]?_0x45c3ab[_0x9edd('0x21')]['id']:null,'ListId':_0x45c3ab[_0x9edd('0x22')]?_0x45c3ab['list']['id']:null};_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x25')]=_0x498977['id']||null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+'InteractionId']=_0x45c3ab[_0x9edd('0x26')]?_0x45c3ab[_0x9edd('0x26')]['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x27')]=_0x45c3ab['message']?_0x45c3ab['message']['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+(_0x45c3ab[_0x9edd('0x24')]!==_0x9edd('0x28')?_0x9edd('0x29'):'WebsiteId')]=_0x45c3ab['account']?_0x45c3ab[_0x9edd('0xb')]['id']:null;logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4bdb88,_0x498977[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x45c3ab[_0x9edd('0x24')],_0x498977[_0x9edd('0x2b')],_0x54a03f,_0x45c3ab[_0x9edd('0xb')]['name'],_0x45c3ab[_0x9edd('0x2c')]['id'],!![],_0x50338f,_0x498977['id']);if(rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')][_0x9edd('0x2e')](_0x54a03f)[_0x9edd('0x2f')](function(_0x1fba7b){logger[_0x9edd('0x30')](_0x9edd('0x31'));});}}}function stopRouting(_0x4fd03f,_0x138002,_0x6907a5,_0xa55906){if(_0x4fd03f&&_0x138002){_0x138002[_0x9edd('0x1f')]-=0x1;var _0x5af178={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'acceptAt':moment()[_0x9edd('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9edd('0x33')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')](_0x9edd('0x34'),_0x4fd03f,_0x138002[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x6907a5[_0x9edd('0x24')],_0x138002[_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x20')],_0x6907a5[_0x9edd('0xb')][_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x2c')]['id'],![],_0xa55906,_0x138002['id']);if(rpc[_0x6907a5[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x6907a5[_0x9edd('0x24')]+'QueueReport'][_0x9edd('0x35')](_0x4fd03f,_0x5af178)['catch'](function(_0x968303){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function endRouting(_0x434d26,_0x16770e,_0x4fa5ab,_0x6de835){if(_0x434d26&&_0x16770e){_0x16770e[_0x9edd('0x1f')]-=0x1;var _0x2b3469={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'exitAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'reason':_0x9edd('0x37')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x434d26,_0x16770e[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x4fa5ab['channel'],_0x16770e[_0x9edd('0x2b')],_0x4fa5ab['body'],_0x4fa5ab[_0x9edd('0xb')][_0x9edd('0x2b')],_0x4fa5ab[_0x9edd('0x2c')]['id'],![],_0x6de835);if(rpc[_0x4fa5ab['channel']+_0x9edd('0x2d')]){return rpc[_0x4fa5ab[_0x9edd('0x24')]+_0x9edd('0x2d')]['update'](_0x434d26,_0x2b3469)[_0x9edd('0x2f')](function(_0x51ad91){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function handleFindQueue(_0x50be2c){return function(_0x315f52){return _0x315f52[_0x9edd('0x2b')][_0x9edd('0x38')]()===_0x50be2c[_0x9edd('0x38')]();};}exports['consequence']=function(_0x449f01,_0x5bbdf8,_0x2bdb3f,_0xc1e657){return function(_0x587d74){try{var _0x318757={'name':_0x5bbdf8[0x0],'timeout':_0x5bbdf8[0x1]};var _0x49a128=queue['validate'](_0x318757,{'typecast':!![]});if(_0x49a128[_0x9edd('0x39')]){logger[_0x9edd('0x30')](_0x9edd('0x3a'),_0x449f01,_[_0x9edd('0x3b')](_0x49a128,_0x9edd('0x2c'))[_0x9edd('0x3c')](',\x20'));_0x587d74[_0x9edd('0x3d')]();}else{var _0x75efbe=_[_0x9edd('0x3e')](_0x2bdb3f[_0xc1e657[_0x9edd('0x24')]+_0x9edd('0x3f')],handleFindQueue(_0x318757[_0x9edd('0x2b')]));if(_0x75efbe){startRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);var _0x3d5eba=(_0x75efbe[_0x9edd('0x37')]||0xa)*0x3e8;var _0x46e9f4=(_0x318757['timeout']||0x14)*0x3e8;var _0x13197d,_0x2570e3;if(_0x3d5eba>_0x46e9f4){_0x46e9f4=_0x3d5eba;}var _0x2231c1=seqqueue[_0x9edd('0x40')](_0x3d5eba);_0x2231c1['id']=_0x449f01;_0x2231c1[_0x9edd('0x41')]=_0x3d5eba;_0x2231c1[_0x9edd('0x42')]=_0x46e9f4;_0x2231c1[_0x9edd('0x24')]=_0xc1e657['channel'];_0x2bdb3f['rules'][_0x449f01]['on']('end',function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x449f01);stopRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x13197d=undefined;_0x2231c1[_0x9edd('0x43')](!![]);if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}_0x587d74[_0x9edd('0x3d')]();});_0x2bdb3f[_0x9edd('0x44')][_0x449f01]['on']('complete',function(){if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}});_0x13197d=setTimeout(function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x449f01);endRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x2231c1[_0x9edd('0x43')](!![]);_0x587d74[_0x9edd('0x45')]();},_0x46e9f4);switch(_0x75efbe[_0x9edd('0x46')]){case _0x9edd('0x47'):strategy[_0x9edd('0x47')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);break;default:strategy[_0x9edd('0x48')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);}}else{logger['error'](_0x9edd('0x49'),_0x449f01,_0x318757[_0x9edd('0x2b')]);_0x587d74['stop']();}}}catch(_0xb93816){console[_0x9edd('0x4a')](_0xb93816);logger['error'](_0x9edd('0x3a'),_0x449f01,_0xb93816[_0x9edd('0x4b')]);_0x587d74[_0x9edd('0x3d')]();}};}; \ 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(_0x4efe3a,_0xfa53be){var _0x57700d=function(_0x1497d5){while(--_0x1497d5){_0x4efe3a['push'](_0x4efe3a['shift']());}};_0x57700d(++_0xfa53be);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 a5e20ef..bf8c141 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 _0x51c7=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','push','handleRun','handleTimeout','timeout','bind','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','realtime','agents','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','info','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x2a0ffd,_0x5e35fc){var _0x3f72e4=function(_0x5c192f){while(--_0x5c192f){_0x2a0ffd['push'](_0x2a0ffd['shift']());}};_0x3f72e4(++_0x5e35fc);}(_0x51c7,0x96));var _0x751c=function(_0x42d41d,_0x17b8ea){_0x42d41d=_0x42d41d-0x0;var _0x2e6184=_0x51c7[_0x42d41d];return _0x2e6184;};'use strict';var _=require(_0x751c('0x0'));var uuid=require(_0x751c('0x1'));var util=require(_0x751c('0x2'));var logger=require('../../../../../config/logger')(_0x751c('0x3'));var Agent=function(_0x1b4014,_0x5976a8,_0x3f38fb,_0x36f6b2){this[_0x751c('0x4')]=uuid['v4']();this['squeue']=_0x1b4014;this['agent']=_0x5976a8;this['realtime']=_0x3f38fb;this[_0x751c('0x3')]=_0x36f6b2;this[_0x751c('0x5')][_0x751c('0x6')](this[_0x751c('0x7')]['bind'](this),this[_0x751c('0x8')]['bind'](this));this[_0x751c('0x5')]['on'](_0x751c('0x9'),this[_0x751c('0x8')][_0x751c('0xa')](this));this[_0x751c('0x5')]['on'](_0x751c('0xb'),this[_0x751c('0xc')]['bind'](this));};Agent[_0x751c('0xd')][_0x751c('0x6')]=function(){this['squeue'][_0x751c('0x6')](this['handleRun'][_0x751c('0xa')](this),this[_0x751c('0x8')][_0x751c('0xa')](this));};Agent['prototype']['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0x751c('0xd')][_0x751c('0x7')]=function(_0x278fb1){logger['info'](_0x751c('0xe'),this[_0x751c('0x5')]['id'],this[_0x751c('0xf')]['id']);if(_[_0x751c('0x10')](this[_0x751c('0x11')][_0x751c('0x12')][this[_0x751c('0xf')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x751c('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x751c('0x6')]['bind'](this),0x3e8);}else{if(this[_0x751c('0x3')][_0x751c('0x13')]||util[_0x751c('0x14')](this[_0x751c('0x5')]['id'],this[_0x751c('0x11')]['agents'][this['agent']['id']],this['squeue'][_0x751c('0x15')],![])){this['realtime']['agents'][this['agent']['id']][_0x751c('0x16')]=!![];this[_0x751c('0x11')][_0x751c('0x12')][this[_0x751c('0xf')]['id']][_0x751c('0x17')]=undefined;util[_0x751c('0x18')](this[_0x751c('0x4')],this[_0x751c('0x5')]['id'],this['realtime'][_0x751c('0x12')][this[_0x751c('0xf')]['id']],null,this[_0x751c('0x3')]);util[_0x751c('0x19')](this['squeue']['id'],this['realtime']['agents'][this[_0x751c('0xf')]['id']],_0x751c('0x1a')+(this[_0x751c('0x3')]['forcedOwnership']?_0x751c('0x1b'):''));}else{logger[_0x751c('0x1c')](_0x751c('0x1d'),this[_0x751c('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x751c('0x6')]['bind'](this),0x3e8);}}};Agent[_0x751c('0xd')][_0x751c('0x8')]=function(_0x4efbb1){if(_[_0x751c('0x10')](this[_0x751c('0x11')][_0x751c('0x12')][this[_0x751c('0xf')]['id']])){return logger[_0x751c('0x1c')](_0x751c('0x1e'),this[_0x751c('0x5')]['id'],this['agent']['id']);}else{logger[_0x751c('0x1c')](_0x751c('0x1f'),this[_0x751c('0x5')]['id'],this['agent']['id']);util[_0x751c('0x20')](this[_0x751c('0x4')],this[_0x751c('0x5')]['id'],this[_0x751c('0x11')][_0x751c('0x12')][this[_0x751c('0xf')]['id']],null,this[_0x751c('0x3')]);this[_0x751c('0x11')][_0x751c('0x12')][this['agent']['id']]['busy']=![];this[_0x751c('0x11')]['agents'][this['agent']['id']][_0x751c('0x17')]=undefined;util[_0x751c('0x19')](this[_0x751c('0x5')]['id'],this[_0x751c('0x11')][_0x751c('0x12')][this[_0x751c('0xf')]['id']],_0x4efbb1?_0x751c('0x21'):_0x751c('0x22'));}if(!_0x4efbb1){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x30f7d9,_0x3b81d3,_0x8dc3a0,_0x49c0d8){return new Agent(_0x30f7d9,_0x3b81d3,_0x8dc3a0,_0x49c0d8);}module[_0x751c('0x23')]=agent; \ No newline at end of file +var _0x11b7=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','STOP','exports','../../../../../config/logger','notificationId','squeue','realtime','routing','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','info','agent','isNil','agents'];(function(_0xbaff69,_0x5d126e){var _0x21276f=function(_0x420270){while(--_0x420270){_0xbaff69['push'](_0xbaff69['shift']());}};_0x21276f(++_0x5d126e);}(_0x11b7,0x12f));var _0x711b=function(_0x56a40d,_0x931121){_0x56a40d=_0x56a40d-0x0;var _0xc9b722=_0x11b7[_0x56a40d];return _0xc9b722;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require('./util');var logger=require(_0x711b('0x0'))('routing');var Agent=function(_0x52594b,_0x296559,_0x35249b,_0x4be832){this[_0x711b('0x1')]=uuid['v4']();this[_0x711b('0x2')]=_0x52594b;this['agent']=_0x296559;this[_0x711b('0x3')]=_0x35249b;this[_0x711b('0x4')]=_0x4be832;this['squeue']['push'](this['handleRun'][_0x711b('0x5')](this),this[_0x711b('0x6')][_0x711b('0x5')](this));this[_0x711b('0x2')]['on'](_0x711b('0x7'),this[_0x711b('0x6')][_0x711b('0x5')](this));this[_0x711b('0x2')]['on'](_0x711b('0x8'),this[_0x711b('0x9')][_0x711b('0x5')](this));};Agent[_0x711b('0xa')][_0x711b('0xb')]=function(){this[_0x711b('0x2')][_0x711b('0xb')](this['handleRun']['bind'](this),this[_0x711b('0x6')][_0x711b('0x5')](this));};Agent[_0x711b('0xa')]['handleDrained']=function(){this[_0x711b('0x6')](!![]);};Agent[_0x711b('0xa')]['handleRun']=function(_0x29b32d){logger[_0x711b('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x711b('0x2')]['id'],this[_0x711b('0xd')]['id']);if(_[_0x711b('0xe')](this[_0x711b('0x3')][_0x711b('0xf')][this[_0x711b('0xd')]['id']])){logger[_0x711b('0xc')](_0x711b('0x10'),this[_0x711b('0x2')]['id'],this['agent']['id']);setTimeout(this[_0x711b('0xb')][_0x711b('0x5')](this),0x3e8);}else{if(this[_0x711b('0x4')][_0x711b('0x11')]||util[_0x711b('0x12')](this[_0x711b('0x2')]['id'],this[_0x711b('0x3')]['agents'][this[_0x711b('0xd')]['id']],this[_0x711b('0x2')][_0x711b('0x13')],![])){this[_0x711b('0x3')][_0x711b('0xf')][this[_0x711b('0xd')]['id']]['busy']=!![];this[_0x711b('0x3')]['agents'][this[_0x711b('0xd')]['id']][_0x711b('0x14')]=undefined;util[_0x711b('0x15')](this['notificationId'],this[_0x711b('0x2')]['id'],this[_0x711b('0x3')]['agents'][this[_0x711b('0xd')]['id']],null,this[_0x711b('0x4')]);util['writeLog'](this[_0x711b('0x2')]['id'],this[_0x711b('0x3')][_0x711b('0xf')][this[_0x711b('0xd')]['id']],_0x711b('0x16')+(this[_0x711b('0x4')]['forcedOwnership']?_0x711b('0x17'):''));}else{logger[_0x711b('0xc')](_0x711b('0x18'),this[_0x711b('0x2')]['id'],this[_0x711b('0xd')]['id']);setTimeout(this[_0x711b('0xb')]['bind'](this),0x3e8);}}};Agent[_0x711b('0xa')][_0x711b('0x6')]=function(_0x27a414){if(_['isNil'](this[_0x711b('0x3')][_0x711b('0xf')][this[_0x711b('0xd')]['id']])){return logger['info'](_0x711b('0x10'),this['squeue']['id'],this[_0x711b('0xd')]['id']);}else{logger['info'](_0x711b('0x19'),this['squeue']['id'],this[_0x711b('0xd')]['id']);util['hideNotification'](this[_0x711b('0x1')],this[_0x711b('0x2')]['id'],this[_0x711b('0x3')][_0x711b('0xf')][this['agent']['id']],null,this[_0x711b('0x4')]);this['realtime']['agents'][this[_0x711b('0xd')]['id']]['busy']=![];this['realtime'][_0x711b('0xf')][this[_0x711b('0xd')]['id']][_0x711b('0x14')]=undefined;util[_0x711b('0x1a')](this[_0x711b('0x2')]['id'],this[_0x711b('0x3')][_0x711b('0xf')][this[_0x711b('0xd')]['id']],_0x27a414?_0x711b('0x1b'):'TIMEOUT');}if(!_0x27a414){setTimeout(this[_0x711b('0xb')][_0x711b('0x5')](this),0x3e8);}};function agent(_0x4e1f89,_0x88720e,_0x44a72,_0x51aaab){return new Agent(_0x4e1f89,_0x88720e,_0x44a72,_0x51aaab);}module[_0x711b('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 d6a075a..526202a 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 _0xaf20=['RINGING','busy','busyQueue','name','showNotification','notificationId','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','isNil','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','routing','STOP','exports','lodash','uuid','./util','../../../../../config/logger','squeue','queue','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','Agents','length','agents','channel','realtime'];(function(_0x2e846f,_0x57929a){var _0x42f147=function(_0x3fff97){while(--_0x3fff97){_0x2e846f['push'](_0x2e846f['shift']());}};_0x42f147(++_0x57929a);}(_0xaf20,0x11f));var _0x0af2=function(_0x4fbaa0,_0x1569eb){_0x4fbaa0=_0x4fbaa0-0x0;var _0x34072f=_0xaf20[_0x4fbaa0];return _0x34072f;};'use strict';var _=require(_0x0af2('0x0'));var uuid=require(_0x0af2('0x1'));var util=require(_0x0af2('0x2'));var logger=require(_0x0af2('0x3'))('routing');var Beepall=function(_0x2165ba,_0x1d1d0b,_0x110d59,_0x15a5e4){this['notificationId']=uuid['v4']();this[_0x0af2('0x4')]=_0x2165ba;this[_0x0af2('0x5')]=_0x1d1d0b;this['realtime']=_0x110d59;this['routing']=_0x15a5e4;this[_0x0af2('0x4')][_0x0af2('0x6')](this['handleRun'][_0x0af2('0x7')](this),this[_0x0af2('0x8')][_0x0af2('0x7')](this));this['squeue']['on'](_0x0af2('0x9'),this[_0x0af2('0x8')]['bind'](this));this['squeue']['on'](_0x0af2('0xa'),this[_0x0af2('0xb')][_0x0af2('0x7')](this));};Beepall[_0x0af2('0xc')][_0x0af2('0x6')]=function(){this[_0x0af2('0x4')][_0x0af2('0x6')](this[_0x0af2('0xd')][_0x0af2('0x7')](this),this[_0x0af2('0x8')][_0x0af2('0x7')](this));};Beepall[_0x0af2('0xc')][_0x0af2('0xb')]=function(_0xa13ed4){this[_0x0af2('0x8')](!![]);};Beepall[_0x0af2('0xc')][_0x0af2('0xd')]=function(_0x1a2ffc){var _0x57fd9e=!![];if(!_['isNil'](this['queue'])&&!_['isNil'](this['queue']['Agents'])&&this['queue'][_0x0af2('0xe')][_0x0af2('0xf')]>0x0){for(var _0xaff3da=0x0,_0x377a82;_0xaff3da0x0){for(var _0x5b3363=0x0,_0x20dee6;_0x5b33630x0&&_0x238461[_0x571f90+_0xcb59('0x25')]>=_0x238461[_0x571f90+'Capacity']){writeLog(_0x4a51e1,_0x238461,_0x571f90[_0xcb59('0x26')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x1fe9c2,_0x2f12f4,_0x1d47c2,_0x12f35a,_0xcfa8f7){return sendNotification(!![],_0x1fe9c2,_0x2f12f4,_0x1d47c2,_0x12f35a,_0xcfa8f7);};exports[_0xcb59('0x27')]=function(_0x220bd5,_0x35a28d,_0x517529,_0x27f230,_0x1ed923){return sendNotification(![],_0x220bd5,_0x35a28d,_0x517529,_0x27f230,_0x1ed923);};exports[_0xcb59('0x28')]=writeLog; \ No newline at end of file +var _0x20c6=['../utils','mustache','ioredis','../../../../../config/environment','redis','defaults','socket.io-emitter','user:%s','name','emit','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','format','[%s][QUEUE]\x20%s','message','save','isAgentAvailable','busy','BUSY','OFFLINE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','hideNotification','writeLog','lodash','util'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x20c6,0x1e8));var _0x620c=function(_0x3ddf26,_0x15c898){_0x3ddf26=_0x3ddf26-0x0;var _0x32a6c3=_0x20c6[_0x3ddf26];return _0x32a6c3;};'use strict';var _=require(_0x620c('0x0'));var util=require(_0x620c('0x1'));var utils=require(_0x620c('0x2'));var Mustache=require(_0x620c('0x3'));var Redis=require(_0x620c('0x4'));var config=require(_0x620c('0x5'));var logger=require('../../../../../config/logger')('routing');config[_0x620c('0x6')]=_[_0x620c('0x7')](config[_0x620c('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x620c('0x8'))(new Redis(config[_0x620c('0x6')]));function emit(_0x329af4,_0x3e1d09,_0x449e83){io['to'](_0x329af4)['emit'](_0x3e1d09,_0x449e83);}function sendNotification(_0x49fa3f,_0x4a08f1,_0x3c1fb3,_0x2b66b4,_0x544b93,_0x360657){io['to'](util['format'](_0x620c('0x9'),_0x2b66b4[_0x620c('0xa')]))[_0x620c('0xb')]('user:save',_0x2b66b4);var _0x3cceca=_0x360657||{};var _0x3ffa95=_0x3c1fb3[_0x620c('0xc')]('.');var _0x5a371e={'uniqueid':_0x4a08f1,'channel':_0x3ffa95[0x0],'id':_0x3ffa95[0x1],'title':_0x3ffa95[0x0]+_0x620c('0xd'),'interactionId':_0x3ffa95[0x2],'queue':_0x544b93?_0x544b93[_0x620c('0xa')]:null,'sound':_0x3cceca[_0x620c('0xe')][_0x620c('0xf')],'shake':_0x3cceca[_0x620c('0xe')][_0x620c('0x10')]};try{if(!_0x3cceca[_0x620c('0x11')]){_0x3cceca[_0x620c('0x11')]={};}if(_0x544b93){_0x3cceca[_0x620c('0x11')][_0x620c('0x12')]=_0x544b93;}else if(_0x3cceca[_0x620c('0x11')][_0x620c('0x12')]){delete _0x3cceca[_0x620c('0x11')][_0x620c('0x12')];}_0x5a371e[_0x620c('0x13')]=utils[_0x620c('0x14')](_0x3cceca[_0x620c('0xe')]['notificationTemplate'],_0x3cceca);}catch(_0x1a57f0){_0x5a371e['msg']='I\x20can\x27t\x20render\x20your\x20template';logger['error'](util[_0x620c('0x15')](_0x620c('0x16'),_0x4a08f1,_0x1a57f0[_0x620c('0x17')]));}io['to'](util[_0x620c('0x15')]('user:%s',_0x2b66b4[_0x620c('0xa')]))['emit'](util[_0x620c('0x15')]('notification:%s',_0x49fa3f?_0x620c('0x18'):'remove'),_0x5a371e);}function writeLog(_0x39de27,_0x38fa1c,_0x593787){return logger['info'](util[_0x620c('0x15')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x39de27,_0x38fa1c[_0x620c('0xa')],_0x593787));}exports[_0x620c('0x19')]=function(_0x1a0f9e,_0x1a8ca5,_0x15d9b3,_0x310980){if(_0x1a8ca5[_0x620c('0x1a')]){writeLog(_0x1a0f9e,_0x1a8ca5,_0x620c('0x1b'));return![];}if(!_0x1a8ca5['online']){writeLog(_0x1a0f9e,_0x1a8ca5,_0x620c('0x1c'));return![];}if(_0x1a8ca5[_0x15d9b3+'Pause']){writeLog(_0x1a0f9e,_0x1a8ca5,'PAUSE');return![];}if(_0x310980&&_0x1a8ca5[_0x620c('0x1d')](_0x15d9b3+_0x620c('0x1e'))&&_0x1a8ca5[_0x620c('0x1d')](_0x15d9b3+_0x620c('0x1f'))){if(_0x1a8ca5[_0x15d9b3+'Capacity']>0x0&&_0x1a8ca5[_0x15d9b3+'CurrentCapacity']>=_0x1a8ca5[_0x15d9b3+_0x620c('0x1e')]){writeLog(_0x1a0f9e,_0x1a8ca5,_0x15d9b3['toUpperCase']()+_0x620c('0x20'));return![];}}return!![];};exports['showNotification']=function(_0x5806d3,_0x12694f,_0x66d78,_0x9b0e53,_0x2b4558){return sendNotification(!![],_0x5806d3,_0x12694f,_0x66d78,_0x9b0e53,_0x2b4558);};exports[_0x620c('0x21')]=function(_0x5c7dad,_0x4eafc4,_0x25c6e3,_0x4f4df9,_0x4bc363){return sendNotification(![],_0x5c7dad,_0x4eafc4,_0x25c6e3,_0x4f4df9,_0x4bc363);};exports[_0x620c('0x22')]=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 3368c8c..cd3c8b4 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 _0xd19f=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','log','cris\x20in\x20function','error','[%s][SYSTEM]\x20%s','map','message','join','next','getMustacheRender','info','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify'];(function(_0x47001b,_0x4030b9){var _0xecf3b3=function(_0x21630b){while(--_0x21630b){_0x47001b['push'](_0x47001b['shift']());}};_0xecf3b3(++_0x4030b9);}(_0xd19f,0x79));var _0xfd19=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0xd19f[_0x119705];return _0x2affc2;};'use strict';var schema=require(_0xfd19('0x0'));var sh=require(_0xfd19('0x1'));var _=require(_0xfd19('0x2'));var utils=require(_0xfd19('0x3'));var logger=require(_0xfd19('0x4'))(_0xfd19('0x5'));var system=schema({'command':{'type':_0xfd19('0x6'),'required':!![],'message':_0xfd19('0x7')}});exports[_0xfd19('0x8')]=function(_0x44de11,_0x2113b0){console['log']('\x20cris\x20consequence',_0x2113b0);return function(_0x51756b){try{var _0x477b15={'command':_0x2113b0[0x0]};console[_0xfd19('0x9')](_0xfd19('0xa'),_0x477b15);var _0x25957b=system[_0xfd19('0x0')](_0x477b15,{'typecast':!![]});if(_0x25957b['length']){logger[_0xfd19('0xb')](_0xfd19('0xc'),_0x44de11,_[_0xfd19('0xd')](_0x25957b,_0xfd19('0xe'))[_0xfd19('0xf')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x44de11);_0x51756b[_0xfd19('0x10')]();}else{var _0x249934=this;var _0x31688a=utils[_0xfd19('0x11')](_0x2113b0[0x0],this);logger[_0xfd19('0x12')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x44de11,_0x31688a);sh[_0xfd19('0x13')](_[_0xfd19('0x14')](_0x31688a),function(_0x475c21,_0x5542c9){logger[_0xfd19('0x12')](_0xfd19('0x15'),_0x44de11,_0x475c21);if(_0x475c21==0x0){var _0x245d89=_0x5542c9['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xfd19('0x16')](_0x2113b0[0x1])||_[_0xfd19('0x17')](_0x2113b0[0x1])){logger[_0xfd19('0x12')](_0xfd19('0x18'),_0x44de11);_0x249934[_0xfd19('0x19')][_0x2113b0[0x1]]=_0x245d89;}else{logger['info'](_0xfd19('0x1a'),_0x44de11,_0x2113b0[0x1],_0x245d89);_0x249934[_0xfd19('0x19')][_0x2113b0[0x1]]=_0x245d89;}}_0x51756b[_0xfd19('0x10')]();});}}catch(_0x2f9788){logger[_0xfd19('0xb')](_0xfd19('0xc'),_0x44de11,_[_0xfd19('0x1b')](_0x2f9788)?JSON[_0xfd19('0x1c')](_0x2f9788):_0x2f9788);logger['info'](_0xfd19('0x1d'),_0x44de11);_0x51756b[_0xfd19('0x10')]();}};}; \ No newline at end of file +var _0x4b23=['join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','\x20cris\x20consequence','error','[%s][SYSTEM]\x20%s','message'];(function(_0x60c72a,_0x517c21){var _0x32b47d=function(_0x143d9b){while(--_0x143d9b){_0x60c72a['push'](_0x60c72a['shift']());}};_0x32b47d(++_0x517c21);}(_0x4b23,0xcd));var _0x34b2=function(_0x4e7cc3,_0x47ff4){_0x4e7cc3=_0x4e7cc3-0x0;var _0x42e46d=_0x4b23[_0x4e7cc3];return _0x42e46d;};'use strict';var schema=require(_0x34b2('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x34b2('0x1'));var logger=require(_0x34b2('0x2'))(_0x34b2('0x3'));var system=schema({'command':{'type':_0x34b2('0x4'),'required':!![],'message':_0x34b2('0x5')}});exports[_0x34b2('0x6')]=function(_0x1b57c1,_0x365df4){console['log'](_0x34b2('0x7'),_0x365df4);return function(_0x168ad4){try{var _0x143425={'command':_0x365df4[0x0]};console['log']('cris\x20in\x20function',_0x143425);var _0x2aac55=system['validate'](_0x143425,{'typecast':!![]});if(_0x2aac55['length']){logger[_0x34b2('0x8')](_0x34b2('0x9'),_0x1b57c1,_['map'](_0x2aac55,_0x34b2('0xa'))[_0x34b2('0xb')](',\x20'));logger['info'](_0x34b2('0xc'),_0x1b57c1);_0x168ad4[_0x34b2('0xd')]();}else{var _0x17a5dc=this;var _0x38fe1d=utils[_0x34b2('0xe')](_0x365df4[0x0],this);logger[_0x34b2('0xf')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x1b57c1,_0x38fe1d);sh[_0x34b2('0x10')](_['trim'](_0x38fe1d),function(_0x35370e,_0x494f97){logger['info'](_0x34b2('0x11'),_0x1b57c1,_0x35370e);if(_0x35370e==0x0){var _0x4c34e4=_0x494f97[_0x34b2('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x34b2('0x13')](_0x365df4[0x1])||_['isEmpty'](_0x365df4[0x1])){logger['info'](_0x34b2('0x14'),_0x1b57c1);_0x17a5dc[_0x34b2('0x15')][_0x365df4[0x1]]=_0x4c34e4;}else{logger[_0x34b2('0xf')](_0x34b2('0x16'),_0x1b57c1,_0x365df4[0x1],_0x4c34e4);_0x17a5dc[_0x34b2('0x15')][_0x365df4[0x1]]=_0x4c34e4;}}_0x168ad4[_0x34b2('0xd')]();});}}catch(_0x8d741e){logger[_0x34b2('0x8')](_0x34b2('0x9'),_0x1b57c1,_['isObject'](_0x8d741e)?JSON[_0x34b2('0x17')](_0x8d741e):_0x8d741e);logger[_0x34b2('0xf')](_0x34b2('0xc'),_0x1b57c1);_0x168ad4[_0x34b2('0xd')]();}};}; \ 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 37a75d5..9125375 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 _0x7c43=['message','next','channel','Interaction','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','[%s][TAG]\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7c43,0xf8));var _0x37c4=function(_0x6c295d,_0x4b83a9){_0x6c295d=_0x6c295d-0x0;var _0x1259e4=_0x7c43[_0x6c295d];return _0x1259e4;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x37c4('0x0')),'smsInteraction':require(_0x37c4('0x1')),'mailInteraction':require(_0x37c4('0x2')),'faxInteraction':require(_0x37c4('0x3')),'whatsappInteraction':require(_0x37c4('0x4'))};var logger=require(_0x37c4('0x5'))(_0x37c4('0x6'));var tag=schema({'tag':{'type':_0x37c4('0x7'),'required':!![],'message':_0x37c4('0x8')}});exports[_0x37c4('0x9')]=function(_0x2e84ac,_0x54e732,_0x1b4103,_0x32d2d7){return function(_0xdb71af){try{var _0x504621={'tag':_0x54e732[0x0]};var _0x1ac53c=tag['validate'](_0x504621,{'typecast':!![]});if(_0x1ac53c[_0x37c4('0xa')]){logger['error']('[%s][TAG]\x20%s',_0x2e84ac,_[_0x37c4('0xb')](_0x1ac53c,_0x37c4('0xc'))['join'](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2e84ac);_0xdb71af[_0x37c4('0xd')]();}else{var _0x118969={'ids':[_0x54e732[0x0]]};if(rpc[_0x32d2d7[_0x37c4('0xe')]+_0x37c4('0xf')]){rpc[_0x32d2d7[_0x37c4('0xe')]+'Interaction']['addTags'](_0x32d2d7[_0x37c4('0x10')]['id'],_0x118969)[_0x37c4('0x11')](function(_0x2eab2a){logger[_0x37c4('0x12')](_0x37c4('0x13'),_0x2e84ac,_0x54e732[0x1],_0x32d2d7['channel'],_0x32d2d7[_0x37c4('0x10')]['id']);})[_0x37c4('0x14')](function(_0x5d5c1b){logger[_0x37c4('0x15')](_0x37c4('0x16'),_0x2e84ac,JSON[_0x37c4('0x17')](_0x5d5c1b));logger[_0x37c4('0x12')](_0x37c4('0x18'),_0x2e84ac);})[_0x37c4('0x19')](function(){_0xdb71af[_0x37c4('0xd')]();});}}}catch(_0x2edf2b){logger[_0x37c4('0x15')](_0x37c4('0x16'),_0x2e84ac,_['isObject'](_0x2edf2b)?JSON[_0x37c4('0x17')](_0x2edf2b):_0x2edf2b);logger[_0x37c4('0x12')](_0x37c4('0x18'),_0x2e84ac);_0xdb71af[_0x37c4('0xd')]();}};}; \ No newline at end of file +var _0xec61=['../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','catch','stringify','finally','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0xec61,0x1c7));var _0x1ec6=function(_0x53f4cf,_0x48b028){_0x53f4cf=_0x53f4cf-0x0;var _0x4d896c=_0xec61[_0x53f4cf];return _0x4d896c;};'use strict';var schema=require(_0x1ec6('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x1ec6('0x1')),'openchannelInteraction':require(_0x1ec6('0x2')),'smsInteraction':require(_0x1ec6('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1ec6('0x4'))};var logger=require(_0x1ec6('0x5'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x1ec6('0x6')}});exports[_0x1ec6('0x7')]=function(_0x359b02,_0xc5021f,_0x425f58,_0x5de89f){return function(_0x4fae0e){try{var _0x26a3b0={'tag':_0xc5021f[0x0]};var _0x117fa7=tag[_0x1ec6('0x0')](_0x26a3b0,{'typecast':!![]});if(_0x117fa7[_0x1ec6('0x8')]){logger[_0x1ec6('0x9')](_0x1ec6('0xa'),_0x359b02,_[_0x1ec6('0xb')](_0x117fa7,'message')['join'](',\x20'));logger[_0x1ec6('0xc')](_0x1ec6('0xd'),_0x359b02);_0x4fae0e[_0x1ec6('0xe')]();}else{var _0x379e17={'ids':[_0xc5021f[0x0]]};if(rpc[_0x5de89f[_0x1ec6('0xf')]+'Interaction']){rpc[_0x5de89f[_0x1ec6('0xf')]+_0x1ec6('0x10')][_0x1ec6('0x11')](_0x5de89f[_0x1ec6('0x12')]['id'],_0x379e17)[_0x1ec6('0x13')](function(_0x17f20c){logger[_0x1ec6('0xc')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x359b02,_0xc5021f[0x1],_0x5de89f[_0x1ec6('0xf')],_0x5de89f[_0x1ec6('0x12')]['id']);})[_0x1ec6('0x14')](function(_0x3ce88e){logger['error'](_0x1ec6('0xa'),_0x359b02,JSON[_0x1ec6('0x15')](_0x3ce88e));logger[_0x1ec6('0xc')](_0x1ec6('0xd'),_0x359b02);})[_0x1ec6('0x16')](function(){_0x4fae0e['next']();});}}}catch(_0x5b06fa){logger[_0x1ec6('0x9')](_0x1ec6('0xa'),_0x359b02,_['isObject'](_0x5b06fa)?JSON[_0x1ec6('0x15')](_0x5b06fa):_0x5b06fa);logger[_0x1ec6('0xc')](_0x1ec6('0xd'),_0x359b02);_0x4fae0e['next']();}};}; \ 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 cb0718c..e9594fc 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 _0xecd5=['lodash','exports','render','merge','body','contact','account','list'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0xecd5,0x110));var _0x5ecd=function(_0x4c3056,_0x44b0e5){_0x4c3056=_0x4c3056-0x0;var _0x457b8f=_0xecd5[_0x4c3056];return _0x457b8f;};'use strict';var Mustache=require('mustache');var _=require(_0x5ecd('0x0'));module[_0x5ecd('0x1')]={'getMustacheRender':function(_0x1aa184,_0x4e96ee){return Mustache[_0x5ecd('0x2')](_0x1aa184,_[_0x5ecd('0x3')](_0x4e96ee[_0x5ecd('0x4')],{'contact':_0x4e96ee[_0x5ecd('0x5')],'message':_0x4e96ee['message'],'account':_0x4e96ee[_0x5ecd('0x6')],'interaction':_0x4e96ee['interaction'],'list':_0x4e96ee[_0x5ecd('0x7')]}))||'';}}; \ No newline at end of file +var _0x7764=['message','list','mustache','lodash','exports','render','merge','body','contact'];(function(_0x280a2e,_0x244c6f){var _0x286f67=function(_0xe4620b){while(--_0xe4620b){_0x280a2e['push'](_0x280a2e['shift']());}};_0x286f67(++_0x244c6f);}(_0x7764,0xa4));var _0x4776=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0x7764[_0x5ad07c];return _0x204bae;};'use strict';var Mustache=require(_0x4776('0x0'));var _=require(_0x4776('0x1'));module[_0x4776('0x2')]={'getMustacheRender':function(_0x2797c7,_0x90273){return Mustache[_0x4776('0x3')](_0x2797c7,_[_0x4776('0x4')](_0x90273[_0x4776('0x5')],{'contact':_0x90273[_0x4776('0x6')],'message':_0x90273[_0x4776('0x7')],'account':_0x90273['account'],'interaction':_0x90273['interaction'],'list':_0x90273[_0x4776('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 2a0d0ff..177dbc9 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 _0x4b84=['channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','format','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','RPC\x20listening\x20on\x20port:','lodash','util','bluebird','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules'];(function(_0xfe33d8,_0x34c571){var _0x5aaa75=function(_0x169472){while(--_0x169472){_0xfe33d8['push'](_0xfe33d8['shift']());}};_0x5aaa75(++_0x34c571);}(_0x4b84,0x1cc));var _0x44b8=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x4b84[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x44b8('0x2'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var rpc={'openchannelQueueReport':require(_0x44b8('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x44b8('0x6')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x44b8('0x7'));function getId(_0x5947f7,_0x3e87c5,_0x5a2353){return util['format'](_0x44b8('0x8'),_0x5947f7,_0x3e87c5||0x0,_0x5a2353||0x0);}function getIntervals(_0x42319d,_0x30ebc3){var _0x48a371=[];if(!_[_0x44b8('0x9')](_0x30ebc3[_0x44b8('0xa')])&&!_[_0x44b8('0x9')](_0x42319d[_0x30ebc3[_0x44b8('0xa')]])&&!_[_0x44b8('0x9')](_0x42319d[_0x30ebc3[_0x44b8('0xa')]][_0x44b8('0xb')])){_0x48a371=_['map'](_0x42319d[_0x30ebc3[_0x44b8('0xa')]][_0x44b8('0xb')],'interval');}else if(!_[_0x44b8('0x9')](_0x30ebc3['interval'])){_0x48a371=[_0x30ebc3[_0x44b8('0xc')]];}return _0x48a371;}exports[_0x44b8('0xd')]=function(_0x4df670){_0x4df670[_0x44b8('0xe')]={};return new BPromise(function(_0x4be54c,_0x54fa95){var _0x2a3e4c={'Start':function(_0x2af0ad){var _0x1722da=this;return new Promise(function(_0x41ab46,_0x5e52f2){if(_0x2af0ad){try{var _0x495c74=[];var _0x5d6349=getId(_0x2af0ad[_0x44b8('0xf')],_0x2af0ad['message']?_0x2af0ad[_0x44b8('0x10')]['id']:0x0,_0x2af0ad[_0x44b8('0x11')]?_0x2af0ad['interaction']['id']:0x0);if(_0x2af0ad[_0x44b8('0x12')]&&_[_0x44b8('0x13')](_0x2af0ad['applications'])&&_0x2af0ad[_0x44b8('0x12')][_0x44b8('0x14')]){for(var _0x4b600f=0x0;_0x4b600f<_0x2af0ad[_0x44b8('0x12')][_0x44b8('0x14')];_0x4b600f+=0x1){var _0xebfe79=_0x2af0ad[_0x44b8('0x12')][_0x4b600f];if(fs[_0x44b8('0x15')](path[_0x44b8('0x16')](__dirname,_0x44b8('0x12'),_0xebfe79[_0x44b8('0x17')]+_0x44b8('0x18')))){var _0x1e0f2d=[];switch(_0xebfe79[_0x44b8('0x17')][_0x44b8('0x19')]()){case'autoreply':var _0x56549a=_0xebfe79[_0x44b8('0x1a')][_0x44b8('0x1b')](',');if(_0x2af0ad[_0x44b8('0xf')]===_0x44b8('0x1c')){_0x1e0f2d['push'](_0x56549a[0x0]);_0x1e0f2d[_0x44b8('0x1d')](_0x56549a[0x1]);_0x1e0f2d['push'](_0x56549a[_0x44b8('0x1e')](0x2,_0x56549a[_0x44b8('0x14')])[_0x44b8('0x16')](','));}else{_0x1e0f2d[_0x44b8('0x1d')](_0x56549a[0x0]);_0x1e0f2d[_0x44b8('0x1d')](_0x56549a['slice'](0x1,_0x56549a[_0x44b8('0x14')])['join'](','));}break;case _0x44b8('0x1f'):var _0x350482=_0xebfe79['appdata'][_0x44b8('0x1b')](',');_0x1e0f2d[_0x44b8('0x1d')](_0x350482[0x0]);_0x1e0f2d[_0x44b8('0x1d')](_0x350482[0x1]);_0x1e0f2d['push'](_0x350482[_0x44b8('0x1e')](0x2,_0x350482[_0x44b8('0x14')])['join'](','));break;case _0x44b8('0x20'):var _0x4a182d=_0xebfe79[_0x44b8('0x1a')]['split'](',');_0x1e0f2d['push'](_0x4a182d[0x0]);_0x1e0f2d['push'](_0x4a182d[0x1]);_0x1e0f2d[_0x44b8('0x1d')](_0x4a182d[0x2]);_0x1e0f2d[_0x44b8('0x1d')](_0x4a182d[0x3]);_0x1e0f2d[_0x44b8('0x1d')](_0x4a182d[_0x44b8('0x1e')](0x4,_0x4a182d[_0x44b8('0x14')])[_0x44b8('0x16')](','));break;case _0x44b8('0x21'):var _0xc1c7a=_0xebfe79[_0x44b8('0x1a')][_0x44b8('0x1b')](',');_0x1e0f2d[_0x44b8('0x1d')](_0xc1c7a[0x0]);_0x1e0f2d[_0x44b8('0x1d')](_0xc1c7a[0x1]);_0x1e0f2d[_0x44b8('0x1d')](_0xc1c7a[0x2]);_0x1e0f2d['push'](_0xc1c7a[0x3]);_0x1e0f2d[_0x44b8('0x1d')](_0xc1c7a['slice'](0x4,_0xc1c7a[_0x44b8('0x14')])[_0x44b8('0x16')](','));break;case _0x44b8('0x10'):_0x1e0f2d[_0x44b8('0x1d')](_0xebfe79[_0x44b8('0x1a')]);break;case'tag':_0x1e0f2d[_0x44b8('0x1d')](_0xebfe79[_0x44b8('0x22')]);_0x1e0f2d[_0x44b8('0x1d')](_0xebfe79[_0x44b8('0x1a')]);break;default:_0x1e0f2d=_[_0x44b8('0x9')](_0xebfe79['appdata'])?[]:_0xebfe79[_0x44b8('0x1a')][_0x44b8('0x1b')](',');}var _0x1a30fc={'id':util[_0x44b8('0x23')](_0x44b8('0x24'),_0x5d6349,_0xebfe79['id'],_0xebfe79[_0x44b8('0x17')]),'condition':require(_0x44b8('0x25'))[_0x44b8('0x26')](_0x5d6349,getIntervals(_0x4df670[_0x44b8('0x27')],_0xebfe79),_0x4df670),'consequence':require(_0x44b8('0x28')+_0xebfe79[_0x44b8('0x17')])[_0x44b8('0x29')](_0x5d6349,_0x1e0f2d,_0x4df670,_0x2af0ad),'p':_0xebfe79[_0x44b8('0x2a')]||0x0};logger[_0x44b8('0x2b')](_0x44b8('0x2c'),_0x1a30fc['id'],_0x44b8('0x2d'),getIntervals(_0x4df670[_0x44b8('0x27')],_0xebfe79)[_0x44b8('0x16')](_0x44b8('0x2e')));_0x495c74[_0x44b8('0x1d')](_0x1a30fc);}else{logger[_0x44b8('0x2f')](_0x44b8('0x30'),path['join'](__dirname,_0x44b8('0x12'),_0xebfe79[_0x44b8('0x17')]+'.js'));}}_0x4df670[_0x44b8('0xe')][_0x5d6349]=new RuleEngine(_0x495c74);_0x4df670[_0x44b8('0xe')][_0x5d6349][_0x44b8('0x31')](_0x2af0ad,function(_0x332c2b){logger['info'](_0x44b8('0x32'),JSON[_0x44b8('0x33')](_0x332c2b[_0x44b8('0x34')]));if(_0x4df670[_0x44b8('0xe')][_0x5d6349]){_0x4df670[_0x44b8('0xe')][_0x5d6349][_0x44b8('0x35')](_0x44b8('0x36'));}});return _0x41ab46({'code':0xc8,'message':_0x2af0ad});}else{logger[_0x44b8('0x2b')](_0x44b8('0x37'));return _0x41ab46({'code':0xc8,'message':_0x2af0ad});}}catch(_0x3d1be1){logger[_0x44b8('0x2f')](_0x3d1be1[_0x44b8('0x38')]);return _0x5e52f2(_0x1722da[_0x44b8('0x2f')](0x1f4,_0x3d1be1));}}return _0x5e52f2(_0x44b8('0x39'));});},'AcceptMessage':function(_0x2f8b59){var _0x29b43f=this;return new Promise(function(_0x57d8c4,_0x12a0a4){if(_0x2f8b59[_0x44b8('0x3a')]&&_0x2f8b59[_0x44b8('0x3a')]['id']){if(_0x4df670['agents'][_0x2f8b59[_0x44b8('0x3a')]['id']]){_0x4df670[_0x44b8('0x3b')][_0x2f8b59[_0x44b8('0x3a')]['id']]['busy']=![];_0x4df670[_0x44b8('0x3b')][_0x2f8b59[_0x44b8('0x3a')]['id']][_0x44b8('0x3c')]=undefined;}}if(_0x2f8b59[_0x44b8('0x10')]&&_0x2f8b59[_0x44b8('0x10')]['id']){try{var _0x499a3e=getId(_0x2f8b59['channel'],_0x2f8b59[_0x44b8('0x10')]?_0x2f8b59[_0x44b8('0x10')]['id']:0x0,_0x2f8b59[_0x44b8('0x11')]?_0x2f8b59[_0x44b8('0x11')]['id']:0x0);if(_0x4df670[_0x44b8('0xe')][_0x499a3e]){_0x4df670[_0x44b8('0xe')][_0x499a3e][_0x44b8('0x35')](_0x44b8('0x3d'));if(rpc[_0x2f8b59[_0x44b8('0xf')]+_0x44b8('0x3e')]){rpc[_0x2f8b59[_0x44b8('0xf')]+_0x44b8('0x3e')][_0x44b8('0x3f')](_0x499a3e,{'UserId':_0x2f8b59[_0x44b8('0x10')][_0x44b8('0x40')]})[_0x44b8('0x41')](function(_0xce06dc){logger[_0x44b8('0x2f')](_0x44b8('0x42'));});}}return _0x57d8c4({'code':0xc8,'message':_0x2f8b59});}catch(_0x49c507){logger['error'](_0x49c507[_0x44b8('0x38')]);return _0x12a0a4(_0x29b43f[_0x44b8('0x2f')](0x1f4,_0x49c507));}}logger[_0x44b8('0x2f')](_0x44b8('0x43'));return _0x12a0a4(_0x29b43f[_0x44b8('0x2f')](0x1f4,_0x44b8('0x43')));});},'RejectMessage':function(_0x411ed6){var _0x4fe73f=this;return new Promise(function(_0x156070,_0x53edca){if(_0x411ed6[_0x44b8('0x3a')]&&_0x411ed6[_0x44b8('0x3a')]['id']){try{if(_0x4df670[_0x44b8('0x3b')][_0x411ed6[_0x44b8('0x3a')]['id']]){_0x4df670[_0x44b8('0x3b')][_0x411ed6[_0x44b8('0x3a')]['id']]['busy']=![];_0x4df670[_0x44b8('0x3b')][_0x411ed6[_0x44b8('0x3a')]['id']][_0x44b8('0x3c')]=undefined;}return _0x156070({'code':0xc8,'message':_0x411ed6});}catch(_0x25d266){logger['error'](_0x25d266[_0x44b8('0x38')]);return _0x53edca(_0x4fe73f[_0x44b8('0x2f')](0x1f4,_0x25d266));}}logger[_0x44b8('0x2f')](_0x44b8('0x43'));return _0x53edca(_0x4fe73f[_0x44b8('0x2f')](0x1f4,_0x44b8('0x43')));});},'AbandonInteraction':function(_0x500bad){var _0x19d95d=this;return new Promise(function(_0x450715,_0x2c5c27){if(_0x500bad[_0x44b8('0xf')]&&_0x500bad[_0x44b8('0x11')]&&_0x500bad['interaction']['id']){try{var _0x493840=getId(_0x500bad[_0x44b8('0xf')],_0x500bad['message']?_0x500bad[_0x44b8('0x10')]['id']:0x0,_0x500bad['interaction']?_0x500bad[_0x44b8('0x11')]['id']:0x0);if(_0x4df670[_0x44b8('0xe')][_0x493840]){_0x4df670[_0x44b8('0xe')][_0x493840][_0x44b8('0x35')](_0x44b8('0x3d'));}return _0x450715({'code':0xc8,'message':_0x500bad});}catch(_0x32f588){logger[_0x44b8('0x2f')](_0x32f588['stack']);return _0x2c5c27(_0x19d95d[_0x44b8('0x2f')](0x1f4,_0x32f588));}}logger[_0x44b8('0x2f')](_0x44b8('0x43'));return _0x2c5c27(_0x19d95d['error'](0x1f4,_0x44b8('0x43')));});},'AgentCapacity':function(_0x103249){var _0x45f9a0=this;return new Promise(function(_0x2b256b,_0x510921){if(_0x4df670[_0x44b8('0x3b')][_0x44b8('0x44')](_0x103249['id'])){for(var _0x4a6e55 in _0x103249[_0x44b8('0x45')]){if(_0x103249[_0x44b8('0x45')][_0x44b8('0x44')](_0x4a6e55)){if(_0x4df670[_0x44b8('0x3b')][_0x103249['id']][_0x44b8('0x44')](_0x4a6e55+'CurrentCapacity')){_0x4df670['agents'][_0x103249['id']][_0x4a6e55+_0x44b8('0x46')]=parseInt(_0x103249[_0x44b8('0x45')][_0x4a6e55],0xa);}}}_0x4df670[_0x44b8('0x3b')][_0x103249['id']][_0x44b8('0x47')]();return _0x2b256b({'code':0xc8,'message':_0x4df670[_0x44b8('0x3b')][_0x103249['id']]});}else{return _0x510921(_0x45f9a0[_0x44b8('0x2f')](0x1f4,_0x44b8('0x48')));}});},'Agents':function(_0xf0fb0d){return new Promise(function(_0x10bbd9,_0xdff81b){var _0x16c628=_[_0x44b8('0x49')](_0x4df670['agents']);_0x10bbd9({'count':_0x16c628[_0x44b8('0x14')],'rows':_0x16c628});});},'ChatQueues':function(_0x252eb3){return new Promise(function(_0x29c0f7,_0x1697e4){var _0x1a96a3=[];for(var _0x1df915 in _0x4df670[_0x44b8('0x4a')]){if(_0x4df670[_0x44b8('0x4a')][_0x44b8('0x44')](_0x1df915)){var _0x2d6a31=_0x4df670[_0x44b8('0x4a')][_0x1df915];var _0x15bcba={'id':_0x2d6a31['id'],'available':_0x2d6a31[_0x44b8('0x4b')],'loggedIn':_0x2d6a31[_0x44b8('0x4c')],'name':_0x2d6a31[_0x44b8('0x4d')],'paused':_0x2d6a31[_0x44b8('0x4e')],'waiting':_0x2d6a31[_0x44b8('0x4f')]};_0x1a96a3[_0x44b8('0x1d')](_0x15bcba);}}_0x29c0f7({'count':_0x1a96a3['length'],'rows':_0x1a96a3});});},'MailQueues':function(_0x1ec516){return new Promise(function(_0x3aac51,_0x10e519){var _0x2b37e=[];for(var _0x51f763 in _0x4df670[_0x44b8('0x50')]){if(_0x4df670[_0x44b8('0x50')]['hasOwnProperty'](_0x51f763)){var _0x2c529a=_0x4df670[_0x44b8('0x50')][_0x51f763];var _0x5df821={'id':_0x2c529a['id'],'available':_0x2c529a[_0x44b8('0x4b')],'loggedIn':_0x2c529a[_0x44b8('0x4c')],'name':_0x2c529a['name'],'paused':_0x2c529a[_0x44b8('0x4e')],'waiting':_0x2c529a[_0x44b8('0x4f')]};_0x2b37e[_0x44b8('0x1d')](_0x5df821);}}_0x3aac51({'count':_0x2b37e['length'],'rows':_0x2b37e});});},'OpenchannelQueues':function(_0x16e790){return new Promise(function(_0x5da64b,_0x36cdd8){var _0x5161ea=[];for(var _0x176536 in _0x4df670[_0x44b8('0x51')]){if(_0x4df670[_0x44b8('0x51')][_0x44b8('0x44')](_0x176536)){var _0x3c6aad=_0x4df670[_0x44b8('0x51')][_0x176536];var _0x4c7edd={'id':_0x3c6aad['id'],'available':_0x3c6aad[_0x44b8('0x4b')],'loggedIn':_0x3c6aad['loggedIn'],'name':_0x3c6aad[_0x44b8('0x4d')],'paused':_0x3c6aad[_0x44b8('0x4e')],'waiting':_0x3c6aad['waiting']};_0x5161ea[_0x44b8('0x1d')](_0x4c7edd);}}_0x5da64b({'count':_0x5161ea[_0x44b8('0x14')],'rows':_0x5161ea});});},'SmsQueues':function(_0x1cf31f){return new Promise(function(_0x30d60f,_0x198085){var _0x3774fe=[];for(var _0x266447 in _0x4df670[_0x44b8('0x52')]){if(_0x4df670[_0x44b8('0x52')][_0x44b8('0x44')](_0x266447)){var _0x41111f=_0x4df670[_0x44b8('0x52')][_0x266447];var _0x52381a={'id':_0x41111f['id'],'available':_0x41111f[_0x44b8('0x4b')],'loggedIn':_0x41111f[_0x44b8('0x4c')],'name':_0x41111f[_0x44b8('0x4d')],'paused':_0x41111f['paused'],'waiting':_0x41111f[_0x44b8('0x4f')]};_0x3774fe[_0x44b8('0x1d')](_0x52381a);}}_0x30d60f({'count':_0x3774fe['length'],'rows':_0x3774fe});});},'FaxQueues':function(_0x10f6cc){return new Promise(function(_0x1a8cff,_0xb89680){var _0x3d80c3=[];for(var _0x44bb6b in _0x4df670['faxQueues']){if(_0x4df670[_0x44b8('0x53')][_0x44b8('0x44')](_0x44bb6b)){var _0x279753=_0x4df670[_0x44b8('0x53')][_0x44bb6b];var _0x2e02d7={'id':_0x279753['id'],'available':_0x279753[_0x44b8('0x4b')],'loggedIn':_0x279753[_0x44b8('0x4c')],'name':_0x279753[_0x44b8('0x4d')],'paused':_0x279753['paused'],'waiting':_0x279753[_0x44b8('0x4f')]};_0x3d80c3[_0x44b8('0x1d')](_0x2e02d7);}}_0x1a8cff({'count':_0x3d80c3[_0x44b8('0x14')],'rows':_0x3d80c3});});},'WhatsappQueues':function(_0x3ce76e){return new Promise(function(_0x5b26e8,_0x480189){var _0x47b087=[];for(var _0x118f89 in _0x4df670[_0x44b8('0x54')]){if(_0x4df670[_0x44b8('0x54')][_0x44b8('0x44')](_0x118f89)){var _0x32e630=_0x4df670['whatsappQueues'][_0x118f89];var _0x26745c={'id':_0x32e630['id'],'available':_0x32e630['available'],'loggedIn':_0x32e630[_0x44b8('0x4c')],'name':_0x32e630[_0x44b8('0x4d')],'paused':_0x32e630[_0x44b8('0x4e')],'waiting':_0x32e630['waiting']};_0x47b087['push'](_0x26745c);}}_0x5b26e8({'count':_0x47b087[_0x44b8('0x14')],'rows':_0x47b087});});},'ChatQueuesWaitingInteractions':function(_0x1964b2){return new Promise(function(_0x248e6c,_0x536734){var _0x1f5277=_[_0x44b8('0x49')](_0x4df670[_0x44b8('0x55')]);_0x248e6c({'count':_0x1f5277[_0x44b8('0x14')],'rows':_0x1f5277});});},'MailQueuesWaitingInteractions':function(_0x57addf){return new Promise(function(_0x51fd30,_0xdaebf7){var _0x1888f8=_[_0x44b8('0x49')](_0x4df670[_0x44b8('0x56')]);_0x51fd30({'count':_0x1888f8[_0x44b8('0x14')],'rows':_0x1888f8});});},'OpenchannelQueuesWaitingInteractions':function(_0x4cc81e){return new Promise(function(_0x40571c,_0x4c7cdf){var _0x4e46c2=_[_0x44b8('0x49')](_0x4df670[_0x44b8('0x57')]);_0x40571c({'count':_0x4e46c2[_0x44b8('0x14')],'rows':_0x4e46c2});});},'SmsQueuesWaitingInteractions':function(_0x1c7ef2){return new Promise(function(_0x506f9c,_0x45a674){var _0x2212e8=_['values'](_0x4df670[_0x44b8('0x58')]);_0x506f9c({'count':_0x2212e8[_0x44b8('0x14')],'rows':_0x2212e8});});},'FaxQueuesWaitingInteractions':function(_0x5452dd){return new Promise(function(_0x2f8e4b,_0x5ddbc7){var _0x56dccf=_[_0x44b8('0x49')](_0x4df670[_0x44b8('0x59')]);_0x2f8e4b({'count':_0x56dccf[_0x44b8('0x14')],'rows':_0x56dccf});});},'WhatsappQueuesWaitingInteractions':function(_0x531af3){return new Promise(function(_0x510760,_0x5b82ec){var _0x36334a=_[_0x44b8('0x49')](_0x4df670[_0x44b8('0x5a')]);_0x510760({'count':_0x36334a[_0x44b8('0x14')],'rows':_0x36334a});});}};var _0x1a5621=jayson[_0x44b8('0x5b')](_0x2a3e4c)[_0x44b8('0x5c')]();_0x1a5621['on'](_0x44b8('0x2f'),function(_0x5d7447){logger[_0x44b8('0x2f')](JSON['stringify'](_0x5d7447));return _0x54fa95(_0x5d7447);});_0x1a5621['listen'](0x232c,'127.0.0.1',function(){console[_0x44b8('0x5d')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x4be54c(_0x44b8('0x5e')+0x232c);});});}; \ No newline at end of file +var _0xf8b2=['split','mail','push','slice','dialogflow','appdata','dialogflowv2','tag','TagId','format','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','server','http','stringify','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x4148e0,_0x1e9ceb){_0x4148e0=_0x4148e0-0x0;var _0x26af68=_0xf8b2[_0x4148e0];return _0x26af68;};'use strict';var _=require(_0x2f8b('0x0'));var util=require(_0x2f8b('0x1'));var path=require(_0x2f8b('0x2'));var fs=require('fs');var jayson=require(_0x2f8b('0x3'));var BPromise=require(_0x2f8b('0x4'));var uuid=require(_0x2f8b('0x5'));var config=require(_0x2f8b('0x6'));var logger=require(_0x2f8b('0x7'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x2f8b('0x8')),'chatQueueReport':require(_0x2f8b('0x9')),'smsQueueReport':require(_0x2f8b('0xa')),'faxQueueReport':require(_0x2f8b('0xb')),'whatsappQueueReport':require(_0x2f8b('0xc'))};var RuleEngine=require(_0x2f8b('0xd'));function getId(_0x449c86,_0x24bd39,_0x366bac){return util['format'](_0x2f8b('0xe'),_0x449c86,_0x24bd39||0x0,_0x366bac||0x0);}function getIntervals(_0xb352e8,_0x120486){var _0x53f5cf=[];if(!_[_0x2f8b('0xf')](_0x120486[_0x2f8b('0x10')])&&!_[_0x2f8b('0xf')](_0xb352e8[_0x120486['IntervalId']])&&!_['isNil'](_0xb352e8[_0x120486[_0x2f8b('0x10')]][_0x2f8b('0x11')])){_0x53f5cf=_[_0x2f8b('0x12')](_0xb352e8[_0x120486[_0x2f8b('0x10')]][_0x2f8b('0x11')],'interval');}else if(!_[_0x2f8b('0xf')](_0x120486['interval'])){_0x53f5cf=[_0x120486[_0x2f8b('0x13')]];}return _0x53f5cf;}exports[_0x2f8b('0x14')]=function(_0x1b6a17){_0x1b6a17[_0x2f8b('0x15')]={};return new BPromise(function(_0xf9cbe0,_0x19d5b3){var _0xd7dbcd={'Start':function(_0x2b6003){var _0x532fe4=this;return new Promise(function(_0x14a248,_0xdec711){if(_0x2b6003){try{var _0x2daba9=[];var _0xcc7e2c=getId(_0x2b6003[_0x2f8b('0x16')],_0x2b6003[_0x2f8b('0x17')]?_0x2b6003[_0x2f8b('0x17')]['id']:0x0,_0x2b6003[_0x2f8b('0x18')]?_0x2b6003[_0x2f8b('0x18')]['id']:0x0);if(_0x2b6003['applications']&&_[_0x2f8b('0x19')](_0x2b6003[_0x2f8b('0x1a')])&&_0x2b6003[_0x2f8b('0x1a')]['length']){for(var _0xdc8171=0x0;_0xdc8171<_0x2b6003['applications'][_0x2f8b('0x1b')];_0xdc8171+=0x1){var _0x1a9b7f=_0x2b6003[_0x2f8b('0x1a')][_0xdc8171];if(fs[_0x2f8b('0x1c')](path[_0x2f8b('0x1d')](__dirname,'applications',_0x1a9b7f[_0x2f8b('0x1e')]+_0x2f8b('0x1f')))){var _0x124881=[];switch(_0x1a9b7f[_0x2f8b('0x1e')][_0x2f8b('0x20')]()){case _0x2f8b('0x21'):var _0x68e81f=_0x1a9b7f['appdata'][_0x2f8b('0x22')](',');if(_0x2b6003[_0x2f8b('0x16')]===_0x2f8b('0x23')){_0x124881[_0x2f8b('0x24')](_0x68e81f[0x0]);_0x124881[_0x2f8b('0x24')](_0x68e81f[0x1]);_0x124881['push'](_0x68e81f[_0x2f8b('0x25')](0x2,_0x68e81f[_0x2f8b('0x1b')])[_0x2f8b('0x1d')](','));}else{_0x124881[_0x2f8b('0x24')](_0x68e81f[0x0]);_0x124881[_0x2f8b('0x24')](_0x68e81f[_0x2f8b('0x25')](0x1,_0x68e81f[_0x2f8b('0x1b')])[_0x2f8b('0x1d')](','));}break;case _0x2f8b('0x26'):var _0x5642a2=_0x1a9b7f[_0x2f8b('0x27')]['split'](',');_0x124881[_0x2f8b('0x24')](_0x5642a2[0x0]);_0x124881[_0x2f8b('0x24')](_0x5642a2[0x1]);_0x124881[_0x2f8b('0x24')](_0x5642a2[_0x2f8b('0x25')](0x2,_0x5642a2[_0x2f8b('0x1b')])['join'](','));break;case _0x2f8b('0x28'):var _0x5cc78c=_0x1a9b7f['appdata'][_0x2f8b('0x22')](',');_0x124881[_0x2f8b('0x24')](_0x5cc78c[0x0]);_0x124881['push'](_0x5cc78c[0x1]);_0x124881[_0x2f8b('0x24')](_0x5cc78c[0x2]);_0x124881[_0x2f8b('0x24')](_0x5cc78c[0x3]);_0x124881[_0x2f8b('0x24')](_0x5cc78c[_0x2f8b('0x25')](0x4,_0x5cc78c[_0x2f8b('0x1b')])[_0x2f8b('0x1d')](','));break;case'amazonlex':var _0x3ed342=_0x1a9b7f[_0x2f8b('0x27')][_0x2f8b('0x22')](',');_0x124881[_0x2f8b('0x24')](_0x3ed342[0x0]);_0x124881[_0x2f8b('0x24')](_0x3ed342[0x1]);_0x124881[_0x2f8b('0x24')](_0x3ed342[0x2]);_0x124881[_0x2f8b('0x24')](_0x3ed342[0x3]);_0x124881['push'](_0x3ed342[_0x2f8b('0x25')](0x4,_0x3ed342['length'])[_0x2f8b('0x1d')](','));break;case _0x2f8b('0x17'):_0x124881[_0x2f8b('0x24')](_0x1a9b7f[_0x2f8b('0x27')]);break;case _0x2f8b('0x29'):_0x124881[_0x2f8b('0x24')](_0x1a9b7f[_0x2f8b('0x2a')]);_0x124881[_0x2f8b('0x24')](_0x1a9b7f[_0x2f8b('0x27')]);break;default:_0x124881=_['isNil'](_0x1a9b7f['appdata'])?[]:_0x1a9b7f[_0x2f8b('0x27')][_0x2f8b('0x22')](',');}var _0x339648={'id':util[_0x2f8b('0x2b')]('%s:%s:%s',_0xcc7e2c,_0x1a9b7f['id'],_0x1a9b7f[_0x2f8b('0x1e')]),'condition':require(_0x2f8b('0x2c'))[_0x2f8b('0x2d')](_0xcc7e2c,getIntervals(_0x1b6a17[_0x2f8b('0x2e')],_0x1a9b7f),_0x1b6a17),'consequence':require(_0x2f8b('0x2f')+_0x1a9b7f['app'])['consequence'](_0xcc7e2c,_0x124881,_0x1b6a17,_0x2b6003),'p':_0x1a9b7f[_0x2f8b('0x30')]||0x0};logger[_0x2f8b('0x31')](_0x2f8b('0x32'),_0x339648['id'],_0x2f8b('0x33'),getIntervals(_0x1b6a17[_0x2f8b('0x2e')],_0x1a9b7f)[_0x2f8b('0x1d')](_0x2f8b('0x34')));_0x2daba9['push'](_0x339648);}else{logger[_0x2f8b('0x35')](_0x2f8b('0x36'),path['join'](__dirname,_0x2f8b('0x1a'),_0x1a9b7f[_0x2f8b('0x1e')]+_0x2f8b('0x1f')));}}_0x1b6a17['rules'][_0xcc7e2c]=new RuleEngine(_0x2daba9);_0x1b6a17[_0x2f8b('0x15')][_0xcc7e2c][_0x2f8b('0x37')](_0x2b6003,function(_0x56c4d5){logger[_0x2f8b('0x31')](_0x2f8b('0x38'),JSON['stringify'](_0x56c4d5[_0x2f8b('0x39')]));if(_0x1b6a17['rules'][_0xcc7e2c]){_0x1b6a17[_0x2f8b('0x15')][_0xcc7e2c][_0x2f8b('0x3a')]('complete');}});return _0x14a248({'code':0xc8,'message':_0x2b6003});}else{logger[_0x2f8b('0x31')](_0x2f8b('0x3b'));return _0x14a248({'code':0xc8,'message':_0x2b6003});}}catch(_0x20c642){logger['error'](_0x20c642[_0x2f8b('0x3c')]);return _0xdec711(_0x532fe4['error'](0x1f4,_0x20c642));}}return _0xdec711(_0x2f8b('0x3d'));});},'AcceptMessage':function(_0x169170){var _0x1ff6e7=this;return new Promise(function(_0x2018e0,_0x2ceda8){if(_0x169170[_0x2f8b('0x3e')]&&_0x169170[_0x2f8b('0x3e')]['id']){if(_0x1b6a17[_0x2f8b('0x3f')][_0x169170[_0x2f8b('0x3e')]['id']]){_0x1b6a17[_0x2f8b('0x3f')][_0x169170[_0x2f8b('0x3e')]['id']][_0x2f8b('0x40')]=![];_0x1b6a17[_0x2f8b('0x3f')][_0x169170[_0x2f8b('0x3e')]['id']][_0x2f8b('0x41')]=undefined;}}if(_0x169170[_0x2f8b('0x17')]&&_0x169170[_0x2f8b('0x17')]['id']){try{var _0x2eeb42=getId(_0x169170[_0x2f8b('0x16')],_0x169170[_0x2f8b('0x17')]?_0x169170[_0x2f8b('0x17')]['id']:0x0,_0x169170[_0x2f8b('0x18')]?_0x169170[_0x2f8b('0x18')]['id']:0x0);if(_0x1b6a17[_0x2f8b('0x15')][_0x2eeb42]){_0x1b6a17[_0x2f8b('0x15')][_0x2eeb42]['emit']('end');if(rpc[_0x169170['channel']+_0x2f8b('0x42')]){rpc[_0x169170['channel']+_0x2f8b('0x42')][_0x2f8b('0x43')](_0x2eeb42,{'UserId':_0x169170[_0x2f8b('0x17')]['UserId']})[_0x2f8b('0x44')](function(_0x587c22){logger[_0x2f8b('0x35')]('error\x20update\x20queue\x20report');});}}return _0x2018e0({'code':0xc8,'message':_0x169170});}catch(_0x376f60){logger[_0x2f8b('0x35')](_0x376f60['stack']);return _0x2ceda8(_0x1ff6e7[_0x2f8b('0x35')](0x1f4,_0x376f60));}}logger[_0x2f8b('0x35')](_0x2f8b('0x45'));return _0x2ceda8(_0x1ff6e7[_0x2f8b('0x35')](0x1f4,_0x2f8b('0x45')));});},'RejectMessage':function(_0x465d59){var _0xd9b1d1=this;return new Promise(function(_0xfc882c,_0x186319){if(_0x465d59['agent']&&_0x465d59[_0x2f8b('0x3e')]['id']){try{if(_0x1b6a17[_0x2f8b('0x3f')][_0x465d59[_0x2f8b('0x3e')]['id']]){_0x1b6a17[_0x2f8b('0x3f')][_0x465d59[_0x2f8b('0x3e')]['id']]['busy']=![];_0x1b6a17[_0x2f8b('0x3f')][_0x465d59[_0x2f8b('0x3e')]['id']][_0x2f8b('0x41')]=undefined;}return _0xfc882c({'code':0xc8,'message':_0x465d59});}catch(_0x53cde8){logger[_0x2f8b('0x35')](_0x53cde8['stack']);return _0x186319(_0xd9b1d1[_0x2f8b('0x35')](0x1f4,_0x53cde8));}}logger[_0x2f8b('0x35')](_0x2f8b('0x45'));return _0x186319(_0xd9b1d1[_0x2f8b('0x35')](0x1f4,_0x2f8b('0x45')));});},'AbandonInteraction':function(_0x5b181f){var _0x4c89c7=this;return new Promise(function(_0x52b3a1,_0x33a416){if(_0x5b181f[_0x2f8b('0x16')]&&_0x5b181f[_0x2f8b('0x18')]&&_0x5b181f[_0x2f8b('0x18')]['id']){try{var _0x49e047=getId(_0x5b181f['channel'],_0x5b181f[_0x2f8b('0x17')]?_0x5b181f[_0x2f8b('0x17')]['id']:0x0,_0x5b181f[_0x2f8b('0x18')]?_0x5b181f[_0x2f8b('0x18')]['id']:0x0);if(_0x1b6a17['rules'][_0x49e047]){_0x1b6a17[_0x2f8b('0x15')][_0x49e047][_0x2f8b('0x3a')]('end');}return _0x52b3a1({'code':0xc8,'message':_0x5b181f});}catch(_0x14b8fe){logger['error'](_0x14b8fe[_0x2f8b('0x3c')]);return _0x33a416(_0x4c89c7['error'](0x1f4,_0x14b8fe));}}logger[_0x2f8b('0x35')](_0x2f8b('0x45'));return _0x33a416(_0x4c89c7[_0x2f8b('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x2ff0ec){var _0x5e0659=this;return new Promise(function(_0x37af70,_0x54b723){if(_0x1b6a17[_0x2f8b('0x3f')][_0x2f8b('0x46')](_0x2ff0ec['id'])){for(var _0x21fcfe in _0x2ff0ec[_0x2f8b('0x47')]){if(_0x2ff0ec[_0x2f8b('0x47')][_0x2f8b('0x46')](_0x21fcfe)){if(_0x1b6a17[_0x2f8b('0x3f')][_0x2ff0ec['id']][_0x2f8b('0x46')](_0x21fcfe+'CurrentCapacity')){_0x1b6a17[_0x2f8b('0x3f')][_0x2ff0ec['id']][_0x21fcfe+_0x2f8b('0x48')]=parseInt(_0x2ff0ec[_0x2f8b('0x47')][_0x21fcfe],0xa);}}}_0x1b6a17[_0x2f8b('0x3f')][_0x2ff0ec['id']][_0x2f8b('0x49')]();return _0x37af70({'code':0xc8,'message':_0x1b6a17[_0x2f8b('0x3f')][_0x2ff0ec['id']]});}else{return _0x54b723(_0x5e0659[_0x2f8b('0x35')](0x1f4,_0x2f8b('0x4a')));}});},'Agents':function(_0x2da9ba){return new Promise(function(_0x244381,_0xf8ed36){var _0x337e53=_['values'](_0x1b6a17[_0x2f8b('0x3f')]);_0x244381({'count':_0x337e53['length'],'rows':_0x337e53});});},'ChatQueues':function(_0x2873fc){return new Promise(function(_0x390793,_0x3673ea){var _0x28d34a=[];for(var _0x15774b in _0x1b6a17['chatQueues']){if(_0x1b6a17[_0x2f8b('0x4b')][_0x2f8b('0x46')](_0x15774b)){var _0x1facad=_0x1b6a17[_0x2f8b('0x4b')][_0x15774b];var _0x55e015={'id':_0x1facad['id'],'available':_0x1facad['available'],'loggedIn':_0x1facad[_0x2f8b('0x4c')],'name':_0x1facad[_0x2f8b('0x4d')],'paused':_0x1facad[_0x2f8b('0x4e')],'waiting':_0x1facad[_0x2f8b('0x4f')]};_0x28d34a['push'](_0x55e015);}}_0x390793({'count':_0x28d34a[_0x2f8b('0x1b')],'rows':_0x28d34a});});},'MailQueues':function(_0x430180){return new Promise(function(_0x5520bb,_0x4c502d){var _0x50246b=[];for(var _0x3ff35d in _0x1b6a17['mailQueues']){if(_0x1b6a17[_0x2f8b('0x50')][_0x2f8b('0x46')](_0x3ff35d)){var _0x7d1604=_0x1b6a17[_0x2f8b('0x50')][_0x3ff35d];var _0x3dbd82={'id':_0x7d1604['id'],'available':_0x7d1604[_0x2f8b('0x51')],'loggedIn':_0x7d1604[_0x2f8b('0x4c')],'name':_0x7d1604[_0x2f8b('0x4d')],'paused':_0x7d1604['paused'],'waiting':_0x7d1604['waiting']};_0x50246b[_0x2f8b('0x24')](_0x3dbd82);}}_0x5520bb({'count':_0x50246b[_0x2f8b('0x1b')],'rows':_0x50246b});});},'OpenchannelQueues':function(_0x185e16){return new Promise(function(_0xef5f15,_0x3eac94){var _0x23ac08=[];for(var _0x189025 in _0x1b6a17[_0x2f8b('0x52')]){if(_0x1b6a17[_0x2f8b('0x52')][_0x2f8b('0x46')](_0x189025)){var _0x5f24cd=_0x1b6a17[_0x2f8b('0x52')][_0x189025];var _0x1e3434={'id':_0x5f24cd['id'],'available':_0x5f24cd[_0x2f8b('0x51')],'loggedIn':_0x5f24cd[_0x2f8b('0x4c')],'name':_0x5f24cd[_0x2f8b('0x4d')],'paused':_0x5f24cd['paused'],'waiting':_0x5f24cd[_0x2f8b('0x4f')]};_0x23ac08[_0x2f8b('0x24')](_0x1e3434);}}_0xef5f15({'count':_0x23ac08['length'],'rows':_0x23ac08});});},'SmsQueues':function(_0x296aad){return new Promise(function(_0x4a5e54,_0x51c1d0){var _0x448cdf=[];for(var _0x37ffde in _0x1b6a17[_0x2f8b('0x53')]){if(_0x1b6a17['smsQueues'][_0x2f8b('0x46')](_0x37ffde)){var _0x513a90=_0x1b6a17[_0x2f8b('0x53')][_0x37ffde];var _0x1a1a9d={'id':_0x513a90['id'],'available':_0x513a90[_0x2f8b('0x51')],'loggedIn':_0x513a90['loggedIn'],'name':_0x513a90[_0x2f8b('0x4d')],'paused':_0x513a90['paused'],'waiting':_0x513a90[_0x2f8b('0x4f')]};_0x448cdf[_0x2f8b('0x24')](_0x1a1a9d);}}_0x4a5e54({'count':_0x448cdf['length'],'rows':_0x448cdf});});},'FaxQueues':function(_0x21d86b){return new Promise(function(_0x2292d8,_0x796d75){var _0x5e3f87=[];for(var _0x55e699 in _0x1b6a17[_0x2f8b('0x54')]){if(_0x1b6a17[_0x2f8b('0x54')][_0x2f8b('0x46')](_0x55e699)){var _0x53f254=_0x1b6a17[_0x2f8b('0x54')][_0x55e699];var _0x385e90={'id':_0x53f254['id'],'available':_0x53f254['available'],'loggedIn':_0x53f254[_0x2f8b('0x4c')],'name':_0x53f254['name'],'paused':_0x53f254[_0x2f8b('0x4e')],'waiting':_0x53f254[_0x2f8b('0x4f')]};_0x5e3f87['push'](_0x385e90);}}_0x2292d8({'count':_0x5e3f87['length'],'rows':_0x5e3f87});});},'WhatsappQueues':function(_0x522c23){return new Promise(function(_0x2e4589,_0x3f9716){var _0x5d373c=[];for(var _0x52f8dd in _0x1b6a17['whatsappQueues']){if(_0x1b6a17['whatsappQueues']['hasOwnProperty'](_0x52f8dd)){var _0x5268db=_0x1b6a17[_0x2f8b('0x55')][_0x52f8dd];var _0xd34319={'id':_0x5268db['id'],'available':_0x5268db[_0x2f8b('0x51')],'loggedIn':_0x5268db[_0x2f8b('0x4c')],'name':_0x5268db[_0x2f8b('0x4d')],'paused':_0x5268db['paused'],'waiting':_0x5268db['waiting']};_0x5d373c[_0x2f8b('0x24')](_0xd34319);}}_0x2e4589({'count':_0x5d373c[_0x2f8b('0x1b')],'rows':_0x5d373c});});},'ChatQueuesWaitingInteractions':function(_0x34a7b6){return new Promise(function(_0x585196,_0x5ae32e){var _0x55254b=_[_0x2f8b('0x56')](_0x1b6a17[_0x2f8b('0x57')]);_0x585196({'count':_0x55254b[_0x2f8b('0x1b')],'rows':_0x55254b});});},'MailQueuesWaitingInteractions':function(_0x4c4fbc){return new Promise(function(_0xa9c6a9,_0x31fd95){var _0x18ebfe=_[_0x2f8b('0x56')](_0x1b6a17[_0x2f8b('0x58')]);_0xa9c6a9({'count':_0x18ebfe[_0x2f8b('0x1b')],'rows':_0x18ebfe});});},'OpenchannelQueuesWaitingInteractions':function(_0x4dcc90){return new Promise(function(_0x38b1fe,_0x31d6cc){var _0x4e8b43=_[_0x2f8b('0x56')](_0x1b6a17[_0x2f8b('0x59')]);_0x38b1fe({'count':_0x4e8b43[_0x2f8b('0x1b')],'rows':_0x4e8b43});});},'SmsQueuesWaitingInteractions':function(_0x1567f9){return new Promise(function(_0x3c615a,_0x4617cf){var _0x220759=_[_0x2f8b('0x56')](_0x1b6a17['smsQueuesWaitingInteractions']);_0x3c615a({'count':_0x220759[_0x2f8b('0x1b')],'rows':_0x220759});});},'FaxQueuesWaitingInteractions':function(_0x5cf060){return new Promise(function(_0x100960,_0x4766f){var _0x5dc95e=_[_0x2f8b('0x56')](_0x1b6a17['faxQueuesWaitingInteractions']);_0x100960({'count':_0x5dc95e[_0x2f8b('0x1b')],'rows':_0x5dc95e});});},'WhatsappQueuesWaitingInteractions':function(_0x2432cd){return new Promise(function(_0x1ebbc8,_0xd9047a){var _0x5b5daf=_[_0x2f8b('0x56')](_0x1b6a17['whatsappQueuesWaitingInteractions']);_0x1ebbc8({'count':_0x5b5daf['length'],'rows':_0x5b5daf});});}};var _0x7ded8e=jayson[_0x2f8b('0x5a')](_0xd7dbcd)[_0x2f8b('0x5b')]();_0x7ded8e['on'](_0x2f8b('0x35'),function(_0xa60bec){logger[_0x2f8b('0x35')](JSON[_0x2f8b('0x5c')](_0xa60bec));return _0x19d5b3(_0xa60bec);});_0x7ded8e[_0x2f8b('0x14')](0x232c,'127.0.0.1',function(){console[_0x2f8b('0x5d')](_0x2f8b('0x5e'),0x232c);return _0xf9cbe0(_0x2f8b('0x5f')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 7ee576e..27648ff 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 _0xcf6f=['result','catch','condition','rules','stop','length','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','http','request','then','error','message'];(function(_0x38ef1d,_0x4c08f9){var _0x1b0464=function(_0x460cfb){while(--_0x460cfb){_0x38ef1d['push'](_0x38ef1d['shift']());}};_0x1b0464(++_0x4c08f9);}(_0xcf6f,0x86));var _0xfcf6=function(_0x6b3755,_0xf171fe){_0x6b3755=_0x6b3755-0x0;var _0x42f233=_0xcf6f[_0x6b3755];return _0x42f233;};'use strict';var util=require(_0xfcf6('0x0'));var BPromise=require(_0xfcf6('0x1'));var jayson=require(_0xfcf6('0x2'));var _=require(_0xfcf6('0x3'));var logger=require(_0xfcf6('0x4'))(_0xfcf6('0x5'));var client=jayson['client'][_0xfcf6('0x6')]({'port':0x232a});function request(_0x11404c,_0x57e892){return new BPromise(function(_0x2c74e4,_0x58781d){return client[_0xfcf6('0x7')](_0x11404c,_0x57e892)[_0xfcf6('0x8')](function(_0x1e3391){if(_0x1e3391[_0xfcf6('0x9')]){return _0x58781d(_0x1e3391[_0xfcf6('0x9')][_0xfcf6('0xa')]);}else{return _0x2c74e4(_0x1e3391[_0xfcf6('0xb')]);}})[_0xfcf6('0xc')](function(_0x1bdb06){return _0x58781d(_0x1bdb06);});});}exports[_0xfcf6('0xd')]=function(_0x5e9f7c,_0x5e0fc2,_0x59aea5){return function(_0x1e817b){if(_0x59aea5[_0xfcf6('0xe')]&&!_0x59aea5[_0xfcf6('0xe')][_0x5e9f7c]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5e9f7c);return _0x1e817b[_0xfcf6('0xf')]();}var _0x24af22=[];for(var _0x4ce1f7=0x0;_0x4ce1f7<_0x5e0fc2[_0xfcf6('0x10')];_0x4ce1f7+=0x1){_0x24af22['push'](request(_0xfcf6('0x11'),{'command':util['format'](_0xfcf6('0x12'),_0x5e0fc2[_0x4ce1f7])})['then'](function(_0x1a4863){return _0x1a4863&&_0x1a4863[_0xfcf6('0xa')]&&_0x1a4863['message'][_0xfcf6('0x13')](_0xfcf6('0x14'))>=0x0?!![]:![];})[_0xfcf6('0xc')](function(_0x21426b){logger[_0xfcf6('0x9')](_0xfcf6('0x15'),_0x5e9f7c,_0x5e0fc2[_0x4ce1f7]);}));}BPromise[_0xfcf6('0x16')](_0x24af22)[_0xfcf6('0x8')](function(_0x5a4329){var _0xc34bb6=_[_0xfcf6('0x17')](_0x5a4329);logger[_0xfcf6('0x18')](_0xfcf6('0x19'),_0x5e9f7c,_0x5e0fc2[_0xfcf6('0x1a')]('\x20|\x20'),_0xc34bb6);_0x1e817b['when'](_0xc34bb6);})[_0xfcf6('0xc')](function(_0x5d401f){console[_0xfcf6('0x1b')](_0x5d401f);logger[_0xfcf6('0x9')](_0xfcf6('0x19'),_0x5e9f7c,_0x5e0fc2[_0xfcf6('0x1a')]('\x20|\x20'),_0x5d401f[_0xfcf6('0x1c')]);_0x1e817b[_0xfcf6('0xf')]();});};}; \ No newline at end of file +var _0xadf2=['push','Command','iftime\x20%s','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','lodash','../../../config/logger','routing','http','request','then','error','message','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop'];(function(_0x8ddf88,_0x919582){var _0x392898=function(_0x2688f0){while(--_0x2688f0){_0x8ddf88['push'](_0x8ddf88['shift']());}};_0x392898(++_0x919582);}(_0xadf2,0x7e));var _0x2adf=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xadf2[_0x26462c];return _0x509a42;};'use strict';var util=require(_0x2adf('0x0'));var BPromise=require(_0x2adf('0x1'));var jayson=require('jayson/promise');var _=require(_0x2adf('0x2'));var logger=require(_0x2adf('0x3'))(_0x2adf('0x4'));var client=jayson['client'][_0x2adf('0x5')]({'port':0x232a});function request(_0x389b36,_0x59725a){return new BPromise(function(_0x3c8595,_0x2cbb06){return client[_0x2adf('0x6')](_0x389b36,_0x59725a)[_0x2adf('0x7')](function(_0x4eeed0){if(_0x4eeed0['error']){return _0x2cbb06(_0x4eeed0[_0x2adf('0x8')][_0x2adf('0x9')]);}else{return _0x3c8595(_0x4eeed0['result']);}})['catch'](function(_0x5863f8){return _0x2cbb06(_0x5863f8);});});}exports[_0x2adf('0xa')]=function(_0x4c696f,_0x3042f2,_0x2916c2){return function(_0x39eee6){if(_0x2916c2[_0x2adf('0xb')]&&!_0x2916c2[_0x2adf('0xb')][_0x4c696f]){logger['info'](_0x2adf('0xc'),_0x4c696f);return _0x39eee6[_0x2adf('0xd')]();}var _0x2a68af=[];for(var _0x15d370=0x0;_0x15d370<_0x3042f2['length'];_0x15d370+=0x1){_0x2a68af[_0x2adf('0xe')](request(_0x2adf('0xf'),{'command':util['format'](_0x2adf('0x10'),_0x3042f2[_0x15d370])})[_0x2adf('0x7')](function(_0x47c36d){return _0x47c36d&&_0x47c36d[_0x2adf('0x9')]&&_0x47c36d[_0x2adf('0x9')][_0x2adf('0x11')](_0x2adf('0x12'))>=0x0?!![]:![];})[_0x2adf('0x13')](function(_0x2a43ac){logger[_0x2adf('0x8')](_0x2adf('0x14'),_0x4c696f,_0x3042f2[_0x15d370]);}));}BPromise[_0x2adf('0x15')](_0x2a68af)[_0x2adf('0x7')](function(_0x3f92a8){var _0x231db0=_['some'](_0x3f92a8);logger[_0x2adf('0x16')](_0x2adf('0x17'),_0x4c696f,_0x3042f2[_0x2adf('0x18')](_0x2adf('0x19')),_0x231db0);_0x39eee6[_0x2adf('0x1a')](_0x231db0);})[_0x2adf('0x13')](function(_0x5a823a){console['log'](_0x5a823a);logger[_0x2adf('0x8')](_0x2adf('0x17'),_0x4c696f,_0x3042f2[_0x2adf('0x18')]('\x20|\x20'),_0x5a823a[_0x2adf('0x1b')]);_0x39eee6[_0x2adf('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 6446b0c..78476ac 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 _0xbc91=['connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','[%s][agents][agentringnoanswer]','agentringnoanswerAt','lastevent','timeout','reason','ringtime','talktime','push','error','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called'];(function(_0x4abd58,_0x523c62){var _0x3608a8=function(_0xa5878){while(--_0xa5878){_0x4abd58['push'](_0x4abd58['shift']());}};_0x3608a8(++_0x523c62);}(_0xbc91,0x1da));var _0x1bc9=function(_0x5dc9ec,_0x407af4){_0x5dc9ec=_0x5dc9ec-0x0;var _0x5b4cdb=_0xbc91[_0x5dc9ec];return _0x5b4cdb;};'use strict';var _=require('lodash');var util=require(_0x1bc9('0x0'));var utils=require(_0x1bc9('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x313b97,_0x5c758a){utils['info'](util[_0x1bc9('0x2')](_0x1bc9('0x3'),_0x313b97[_0x1bc9('0x4')],_0x313b97['channel'],_0x313b97[_0x1bc9('0x5')],_0x313b97[_0x1bc9('0x6')],_0x313b97['interface'],_0x313b97[_0x1bc9('0x7')],_0x313b97[_0x1bc9('0x8')],_0x313b97['lastevent']));if(_0x313b97[_0x1bc9('0x5')]){utils[_0x1bc9('0x9')](_0x313b97[_0x1bc9('0x5')])[_0x1bc9('0xa')](function(_0xdd77ad){if(_0xdd77ad){_0x313b97[_0x1bc9('0xb')]=_0xdd77ad[_0x1bc9('0xb')];_0x313b97[_0x1bc9('0xc')]=_0x313b97[_0x1bc9('0xd')]?_0xdd77ad['acw']:![];_0x313b97[_0x1bc9('0xe')]=_0x313b97[_0x1bc9('0xc')]?_0xdd77ad['acwTimeout']:0x0;}utils['request'](_0x1bc9('0xf'),_0x313b97);});}else{utils[_0x1bc9('0x10')]('CreateVoiceAgentReport',_0x313b97);}if(_0x5c758a){delete transfers[_0x313b97[_0x1bc9('0x4')]];}else{delete agents[_0x313b97[_0x1bc9('0x11')]];}}exports[_0x1bc9('0x12')]=function(_0x223686){try{utils[_0x1bc9('0x13')](util['format'](_0x1bc9('0x14'),_0x223686[_0x1bc9('0x4')]),_0x223686);agents[_0x223686[_0x1bc9('0x11')]]=_0x223686;agents[_0x223686[_0x1bc9('0x11')]][_0x1bc9('0x15')]=utils[_0x1bc9('0x16')]();agents[_0x223686[_0x1bc9('0x11')]]['lastevent']=_0x1bc9('0x17');agents[_0x223686[_0x1bc9('0x11')]][_0x1bc9('0x8')]=null;agents[_0x223686['destuniqueid']][_0x1bc9('0x18')]=null;utils[_0x1bc9('0x19')](util[_0x1bc9('0x2')](_0x1bc9('0x1a'),_0x223686[_0x1bc9('0x4')],agents[_0x223686[_0x1bc9('0x11')]]['membername'],_0x223686['destuniqueid']));}catch(_0x5c8b4e){utils['error'](util[_0x1bc9('0x2')](_0x1bc9('0x14'),_0x223686[_0x1bc9('0x4')]),_0x5c8b4e);}};exports[_0x1bc9('0x1b')]=function(_0x4de3cb){try{if(!_['isNil'](agents[_0x4de3cb[_0x1bc9('0x11')]])){utils[_0x1bc9('0x13')](util[_0x1bc9('0x2')](_0x1bc9('0x1c'),_0x4de3cb['uniqueid']),_0x4de3cb);utils[_0x1bc9('0x19')](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x4de3cb[_0x1bc9('0x4')],agents[_0x4de3cb[_0x1bc9('0x11')]][_0x1bc9('0x6')],_0x4de3cb[_0x1bc9('0x11')]));agents[_0x4de3cb[_0x1bc9('0x11')]][_0x1bc9('0x1b')]=!![];agents[_0x4de3cb[_0x1bc9('0x11')]][_0x1bc9('0x1d')]=utils[_0x1bc9('0x16')]();agents[_0x4de3cb['destuniqueid']][_0x1bc9('0x1e')]=_0x1bc9('0x1f');agents[_0x4de3cb['destuniqueid']][_0x1bc9('0x20')]=_0x1bc9('0x1f');agents[_0x4de3cb[_0x1bc9('0x11')]]['holdtime']=_0x4de3cb[_0x1bc9('0x21')]?parseInt(_0x4de3cb[_0x1bc9('0x21')])/0x3e8:0x0;agents[_0x4de3cb[_0x1bc9('0x11')]][_0x1bc9('0x22')]=0x0;unanswered[_0x1bc9('0x23')](_0x4de3cb[_0x1bc9('0x11')]);}}catch(_0x71f631){utils[_0x1bc9('0x24')](util[_0x1bc9('0x2')](_0x1bc9('0x1c'),_0x4de3cb[_0x1bc9('0x4')]),_0x71f631);}};exports['queuecallerabandon']=function(_0x59ba7d){try{_[_0x1bc9('0x25')](agents,function(_0x91663d,_0x3fd354){if(_0x91663d[_0x1bc9('0x4')]==_0x59ba7d[_0x1bc9('0x4')]&&!_[_0x1bc9('0x26')](unanswered,_0x91663d[_0x1bc9('0x11')])){utils[_0x1bc9('0x13')](util['format']('[%s][agents][queuecallerabandon]',_0x59ba7d[_0x1bc9('0x4')]),_0x59ba7d);utils[_0x1bc9('0x19')](util[_0x1bc9('0x2')](_0x1bc9('0x27'),_0x59ba7d[_0x1bc9('0x4')],_0x91663d[_0x1bc9('0x6')],_0x91663d[_0x1bc9('0x11')]));_0x91663d['agentringnoanswer']=!![];_0x91663d['agentringnoanswerAt']=utils[_0x1bc9('0x16')]();_0x91663d['lastevent']=_0x1bc9('0x28');_0x91663d[_0x1bc9('0x20')]=_0x1bc9('0x28');_0x91663d['holdtime']=_0x59ba7d[_0x1bc9('0x29')];_0x91663d[_0x1bc9('0x22')]=0x0;writeDB(_0x91663d);}});}catch(_0x985ff1){utils[_0x1bc9('0x24')](util[_0x1bc9('0x2')](_0x1bc9('0x2a'),_0x59ba7d[_0x1bc9('0x4')]),_0x985ff1);}};exports['agentconnect']=function(_0x2475a8){try{if(agents[_0x2475a8[_0x1bc9('0x11')]]){utils[_0x1bc9('0x13')](util['format'](_0x1bc9('0x2b'),_0x2475a8[_0x1bc9('0x4')]),_0x2475a8);utils[_0x1bc9('0x19')](util[_0x1bc9('0x2')](_0x1bc9('0x2c'),_0x2475a8[_0x1bc9('0x4')],agents[_0x2475a8[_0x1bc9('0x11')]]['membername'],_0x2475a8[_0x1bc9('0x11')]));agents[_0x2475a8[_0x1bc9('0x11')]][_0x1bc9('0x2d')]=utils[_0x1bc9('0x16')]();agents[_0x2475a8['destuniqueid']][_0x1bc9('0x8')]=_0x2475a8['connectedlinenum'];agents[_0x2475a8['destuniqueid']][_0x1bc9('0x18')]=_0x2475a8['connectedlinename'];agents[_0x2475a8['destuniqueid']][_0x1bc9('0x29')]=_0x2475a8[_0x1bc9('0x21')];agents[_0x2475a8[_0x1bc9('0x11')]][_0x1bc9('0x1e')]=_0x1bc9('0x2e');_['forIn'](agents,function(_0x24e0dc,_0x4dd229){if(_0x24e0dc[_0x1bc9('0x11')]!=_0x2475a8[_0x1bc9('0x11')]&&_0x24e0dc[_0x1bc9('0x4')]==_0x2475a8[_0x1bc9('0x4')]){_0x24e0dc[_0x1bc9('0x22')]=0x0;_0x24e0dc[_0x1bc9('0x29')]=_0x2475a8[_0x1bc9('0x21')];_0x24e0dc[_0x1bc9('0x1b')]=!![];_0x24e0dc['agentringnoanswerAt']=utils[_0x1bc9('0x16')]();_0x24e0dc[_0x1bc9('0x1e')]=_0x1bc9('0x2f');_0x24e0dc['reason']=_0x1bc9('0x2f');_0x24e0dc[_0x1bc9('0x30')]=_0x2475a8['destuniqueid'];_0x24e0dc[_0x1bc9('0x31')]=_0x2475a8['membername'];writeDB(_0x24e0dc);}});}}catch(_0x5c5ac2){utils['error'](util[_0x1bc9('0x2')](_0x1bc9('0x2b'),_0x2475a8[_0x1bc9('0x4')]),_0x5c5ac2);}};exports['agentcomplete']=function(_0x37c751){try{if(!_[_0x1bc9('0x32')](agents[_0x37c751[_0x1bc9('0x11')]])){utils[_0x1bc9('0x13')](util[_0x1bc9('0x2')](_0x1bc9('0x33'),_0x37c751[_0x1bc9('0x4')]),_0x37c751);utils[_0x1bc9('0x19')](util[_0x1bc9('0x2')](_0x1bc9('0x34'),_0x37c751[_0x1bc9('0x4')],agents[_0x37c751[_0x1bc9('0x11')]][_0x1bc9('0x6')],_0x37c751[_0x1bc9('0x11')]));agents[_0x37c751['destuniqueid']][_0x1bc9('0xd')]=!![];agents[_0x37c751[_0x1bc9('0x11')]][_0x1bc9('0x35')]=utils[_0x1bc9('0x16')]();agents[_0x37c751[_0x1bc9('0x11')]][_0x1bc9('0x22')]=utils[_0x1bc9('0x36')](agents[_0x37c751['destuniqueid']][_0x1bc9('0x35')],agents[_0x37c751[_0x1bc9('0x11')]][_0x1bc9('0x2d')]);agents[_0x37c751[_0x1bc9('0x11')]][_0x1bc9('0x20')]=_0x37c751[_0x1bc9('0x20')];agents[_0x37c751[_0x1bc9('0x11')]][_0x1bc9('0x1e')]=_0x1bc9('0x37');writeDB(agents[_0x37c751[_0x1bc9('0x11')]]);}}catch(_0x49303c){utils[_0x1bc9('0x24')](util[_0x1bc9('0x2')](_0x1bc9('0x33'),_0x37c751['uniqueid']),_0x49303c);}};exports['blindtransfer']=function(_0x22d2f9){try{if(!_['isNil'](agents[_0x22d2f9[_0x1bc9('0x38')]])){utils[_0x1bc9('0x13')](util[_0x1bc9('0x2')]('[%s][agents][blindtransfer]',_0x22d2f9[_0x1bc9('0x4')]),_0x22d2f9);utils[_0x1bc9('0x19')](util[_0x1bc9('0x2')](_0x1bc9('0x39'),_0x22d2f9[_0x1bc9('0x4')],agents[_0x22d2f9[_0x1bc9('0x38')]]['membername'],agents[_0x22d2f9[_0x1bc9('0x38')]][_0x1bc9('0x4')]));agents[_0x22d2f9['transfereruniqueid']]['transfer']=!![];agents[_0x22d2f9[_0x1bc9('0x38')]][_0x1bc9('0x3a')]='blind';agents[_0x22d2f9[_0x1bc9('0x38')]][_0x1bc9('0x3b')]=_0x22d2f9[_0x1bc9('0x3c')];agents[_0x22d2f9['transfereruniqueid']]['transferuniqueid']=agents[_0x22d2f9[_0x1bc9('0x38')]][_0x1bc9('0x4')];}}catch(_0x29d77d){utils[_0x1bc9('0x24')](util[_0x1bc9('0x2')]('[%s][agents][blindtransfer]',_0x22d2f9[_0x1bc9('0x4')]),_0x29d77d);}};exports[_0x1bc9('0x3d')]=function(_0x190d8e){try{utils['debug'](util['format'](_0x1bc9('0x3e'),_0x190d8e[_0x1bc9('0x3f')]),_0x190d8e);if(_0x190d8e[_0x1bc9('0x3f')]==_0x190d8e[_0x1bc9('0x40')]){if(!_['isNil'](agents[_0x190d8e['secondtransfereruniqueid']])){utils[_0x1bc9('0x19')](util[_0x1bc9('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x190d8e[_0x1bc9('0x3f')],agents[_0x190d8e[_0x1bc9('0x41')]]['membername']));agents[_0x190d8e[_0x1bc9('0x41')]][_0x1bc9('0x42')]=!![];agents[_0x190d8e['secondtransfereruniqueid']][_0x1bc9('0x3a')]=_0x1bc9('0x43');agents[_0x190d8e[_0x1bc9('0x41')]][_0x1bc9('0x3b')]=_0x190d8e['origtransfererexten'];agents[_0x190d8e[_0x1bc9('0x41')]][_0x1bc9('0x44')]=_0x190d8e[_0x1bc9('0x3f')];}if(_0x190d8e[_0x1bc9('0x45')]&&agents[_0x190d8e[_0x1bc9('0x45')]]){agents[_0x190d8e['transfereeuniqueid']][_0x1bc9('0x46')]=0x1;transfers[_0x190d8e[_0x1bc9('0x45')]]=_[_0x1bc9('0x47')](agents[_0x190d8e[_0x1bc9('0x45')]]);transfers[_0x190d8e[_0x1bc9('0x45')]][_0x1bc9('0x7')]=agents[_0x190d8e[_0x1bc9('0x41')]][_0x1bc9('0x7')];transfers[_0x190d8e['transfereeuniqueid']][_0x1bc9('0x48')]=agents[_0x190d8e[_0x1bc9('0x41')]][_0x1bc9('0x48')];transfers[_0x190d8e[_0x1bc9('0x45')]]['agentcalledAt']=utils[_0x1bc9('0x16')]();transfers[_0x190d8e[_0x1bc9('0x45')]][_0x1bc9('0x2d')]=utils[_0x1bc9('0x16')]();transfers[_0x190d8e['transfereeuniqueid']][_0x1bc9('0x29')]=0x0;transfers[_0x190d8e[_0x1bc9('0x45')]][_0x1bc9('0x46')]=0x2;}}else if(_0x190d8e[_0x1bc9('0x41')]==_0x190d8e[_0x1bc9('0x49')]){if(!_[_0x1bc9('0x32')](agents[_0x190d8e['origtransfereruniqueid']])){utils[_0x1bc9('0x19')](util[_0x1bc9('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x190d8e['origtransfereruniqueid'],agents[_0x190d8e[_0x1bc9('0x3f')]][_0x1bc9('0x6')]));agents[_0x190d8e[_0x1bc9('0x3f')]][_0x1bc9('0x42')]=!![];agents[_0x190d8e[_0x1bc9('0x3f')]][_0x1bc9('0x3a')]='ATTENDED';agents[_0x190d8e[_0x1bc9('0x3f')]][_0x1bc9('0x3b')]=_0x190d8e[_0x1bc9('0x4a')];agents[_0x190d8e[_0x1bc9('0x3f')]]['transferuniqueid']=_0x190d8e['secondtransfereruniqueid'];}if(_0x190d8e['transfertargetuniqueid']&&agents[_0x190d8e['transfertargetuniqueid']]){agents[_0x190d8e['transfertargetuniqueid']][_0x1bc9('0x46')]=0x1;transfers[_0x190d8e[_0x1bc9('0x4b')]]=_[_0x1bc9('0x47')](agents[_0x190d8e[_0x1bc9('0x4b')]]);transfers[_0x190d8e[_0x1bc9('0x4b')]]['calleridnum']=agents[_0x190d8e[_0x1bc9('0x3f')]][_0x1bc9('0x7')];transfers[_0x190d8e['transfertargetuniqueid']]['calleridname']=agents[_0x190d8e[_0x1bc9('0x3f')]]['calleridname'];transfers[_0x190d8e[_0x1bc9('0x4b')]][_0x1bc9('0x15')]=utils[_0x1bc9('0x16')]();transfers[_0x190d8e[_0x1bc9('0x4b')]][_0x1bc9('0x2d')]=utils['now']();transfers[_0x190d8e['transfertargetuniqueid']][_0x1bc9('0x29')]=0x0;transfers[_0x190d8e['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x4debf0){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x190d8e['origtransfereruniqueid']),_0x4debf0);}};exports[_0x1bc9('0x4c')]=function(_0x1a686f){try{utils[_0x1bc9('0x13')](util['format'](_0x1bc9('0x4d'),_0x1a686f[_0x1bc9('0x4')]),_0x1a686f);if(agents[_0x1a686f[_0x1bc9('0x4')]]&&agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x20')]==='timeout'){if(_0x1a686f[_0x1bc9('0x4e')]==='21'){agents[_0x1a686f['uniqueid']]['reason']=_0x1bc9('0x4f');agents[_0x1a686f['uniqueid']][_0x1bc9('0x1e')]='rejected';}utils[_0x1bc9('0x19')](util[_0x1bc9('0x2')](_0x1bc9('0x50'),_0x1a686f[_0x1bc9('0x4')],agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x6')],agents[_0x1a686f['uniqueid']][_0x1bc9('0x20')],agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x1e')]));writeDB(agents[_0x1a686f[_0x1bc9('0x4')]]);var _0xafb49c=unanswered[_0x1bc9('0x51')](_0x1a686f[_0x1bc9('0x4')]);if(_0xafb49c>-0x1){unanswered['splice'](_0xafb49c,0x1);}}if(transfers[_0x1a686f[_0x1bc9('0x4')]]){transfers[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0xd')]=!![];transfers[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x35')]=utils[_0x1bc9('0x16')]();transfers[_0x1a686f[_0x1bc9('0x4')]]['talktime']=utils[_0x1bc9('0x36')](transfers[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x35')],transfers[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x2d')]);transfers[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x20')]=_0x1bc9('0x52');transfers[_0x1a686f[_0x1bc9('0x4')]]['lastevent']=_0x1bc9('0x37');utils[_0x1bc9('0x19')](util[_0x1bc9('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1a686f['uniqueid'],transfers[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x6')],transfers[_0x1a686f[_0x1bc9('0x4')]]['reason'],transfers[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x1e')]));writeDB(transfers[_0x1a686f[_0x1bc9('0x4')]],!![]);}if(agents[_0x1a686f[_0x1bc9('0x4')]]&&agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x2d')]){agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0xd')]=!![];agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x35')]=utils['now']();agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x22')]=utils[_0x1bc9('0x36')](agents[_0x1a686f[_0x1bc9('0x4')]]['agentcompleteAt'],agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x2d')]);agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x20')]=agents[_0x1a686f['uniqueid']][_0x1bc9('0x42')]?_0x1bc9('0x42'):_0x1bc9('0x52');agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x1e')]=_0x1bc9('0x37');utils[_0x1bc9('0x19')](util[_0x1bc9('0x2')](_0x1bc9('0x50'),_0x1a686f['uniqueid'],agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x6')],agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x20')],agents[_0x1a686f[_0x1bc9('0x4')]][_0x1bc9('0x1e')]));writeDB(agents[_0x1a686f['uniqueid']]);}}catch(_0x4a87b8){utils[_0x1bc9('0x24')](util[_0x1bc9('0x2')](_0x1bc9('0x4d'),_0x1a686f[_0x1bc9('0x4')]),_0x4a87b8);}}; \ No newline at end of file +var _0x9c03=['./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','agentcalledAt','now','lastevent','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util'];(function(_0x4a4167,_0x9e69a6){var _0x35b769=function(_0x1f5c9b){while(--_0x1f5c9b){_0x4a4167['push'](_0x4a4167['shift']());}};_0x35b769(++_0x9e69a6);}(_0x9c03,0x10c));var _0x39c0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9c03[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x39c0('0x0'));var util=require(_0x39c0('0x1'));var utils=require(_0x39c0('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e83b1,_0x1022cc){utils[_0x39c0('0x3')](util[_0x39c0('0x4')](_0x39c0('0x5'),_0x5e83b1['uniqueid'],_0x5e83b1['channel'],_0x5e83b1[_0x39c0('0x6')],_0x5e83b1[_0x39c0('0x7')],_0x5e83b1[_0x39c0('0x8')],_0x5e83b1[_0x39c0('0x9')],_0x5e83b1['connectedlinenum'],_0x5e83b1['lastevent']));if(_0x5e83b1[_0x39c0('0x6')]){utils[_0x39c0('0xa')](_0x5e83b1['queue'])[_0x39c0('0xb')](function(_0x58b149){if(_0x58b149){_0x5e83b1[_0x39c0('0xc')]=_0x58b149[_0x39c0('0xc')];_0x5e83b1[_0x39c0('0xd')]=_0x5e83b1[_0x39c0('0xe')]?_0x58b149[_0x39c0('0xf')]:![];_0x5e83b1['acwtime']=_0x5e83b1[_0x39c0('0xd')]?_0x58b149['acwTimeout']:0x0;}utils[_0x39c0('0x10')]('CreateVoiceAgentReport',_0x5e83b1);});}else{utils[_0x39c0('0x10')](_0x39c0('0x11'),_0x5e83b1);}if(_0x1022cc){delete transfers[_0x5e83b1[_0x39c0('0x12')]];}else{delete agents[_0x5e83b1[_0x39c0('0x13')]];}}exports[_0x39c0('0x14')]=function(_0x1c6958){try{utils['debug'](util[_0x39c0('0x4')]('[%s][agents][agentcalled]',_0x1c6958[_0x39c0('0x12')]),_0x1c6958);agents[_0x1c6958['destuniqueid']]=_0x1c6958;agents[_0x1c6958['destuniqueid']][_0x39c0('0x15')]=utils[_0x39c0('0x16')]();agents[_0x1c6958['destuniqueid']][_0x39c0('0x17')]=_0x39c0('0x18');agents[_0x1c6958['destuniqueid']][_0x39c0('0x19')]=null;agents[_0x1c6958['destuniqueid']][_0x39c0('0x1a')]=null;utils['info'](util[_0x39c0('0x4')](_0x39c0('0x1b'),_0x1c6958[_0x39c0('0x12')],agents[_0x1c6958[_0x39c0('0x13')]][_0x39c0('0x7')],_0x1c6958[_0x39c0('0x13')]));}catch(_0x3f0bee){utils[_0x39c0('0x1c')](util[_0x39c0('0x4')](_0x39c0('0x1d'),_0x1c6958[_0x39c0('0x12')]),_0x3f0bee);}};exports['agentringnoanswer']=function(_0x1b99a4){try{if(!_[_0x39c0('0x1e')](agents[_0x1b99a4[_0x39c0('0x13')]])){utils[_0x39c0('0x1f')](util['format'](_0x39c0('0x20'),_0x1b99a4[_0x39c0('0x12')]),_0x1b99a4);utils['info'](util[_0x39c0('0x4')](_0x39c0('0x21'),_0x1b99a4[_0x39c0('0x12')],agents[_0x1b99a4[_0x39c0('0x13')]][_0x39c0('0x7')],_0x1b99a4[_0x39c0('0x13')]));agents[_0x1b99a4[_0x39c0('0x13')]]['agentringnoanswer']=!![];agents[_0x1b99a4[_0x39c0('0x13')]][_0x39c0('0x22')]=utils[_0x39c0('0x16')]();agents[_0x1b99a4[_0x39c0('0x13')]]['lastevent']=_0x39c0('0x23');agents[_0x1b99a4['destuniqueid']][_0x39c0('0x24')]='timeout';agents[_0x1b99a4[_0x39c0('0x13')]][_0x39c0('0x25')]=_0x1b99a4[_0x39c0('0x26')]?parseInt(_0x1b99a4[_0x39c0('0x26')])/0x3e8:0x0;agents[_0x1b99a4[_0x39c0('0x13')]][_0x39c0('0x27')]=0x0;unanswered[_0x39c0('0x28')](_0x1b99a4[_0x39c0('0x13')]);}}catch(_0x48309b){utils[_0x39c0('0x1c')](util[_0x39c0('0x4')]('[%s][agents][agentringnoanswer]',_0x1b99a4[_0x39c0('0x12')]),_0x48309b);}};exports[_0x39c0('0x29')]=function(_0x77b894){try{_[_0x39c0('0x2a')](agents,function(_0x55ceb1,_0x460e24){if(_0x55ceb1[_0x39c0('0x12')]==_0x77b894[_0x39c0('0x12')]&&!_[_0x39c0('0x2b')](unanswered,_0x55ceb1[_0x39c0('0x13')])){utils[_0x39c0('0x1f')](util[_0x39c0('0x4')](_0x39c0('0x2c'),_0x77b894['uniqueid']),_0x77b894);utils[_0x39c0('0x3')](util[_0x39c0('0x4')](_0x39c0('0x2d'),_0x77b894[_0x39c0('0x12')],_0x55ceb1['membername'],_0x55ceb1['destuniqueid']));_0x55ceb1[_0x39c0('0x2e')]=!![];_0x55ceb1[_0x39c0('0x22')]=utils['now']();_0x55ceb1[_0x39c0('0x17')]='abandoned';_0x55ceb1[_0x39c0('0x24')]=_0x39c0('0x2f');_0x55ceb1[_0x39c0('0x25')]=_0x77b894[_0x39c0('0x25')];_0x55ceb1[_0x39c0('0x27')]=0x0;writeDB(_0x55ceb1);}});}catch(_0x3f11db){utils['error'](util[_0x39c0('0x4')](_0x39c0('0x2c'),_0x77b894[_0x39c0('0x12')]),_0x3f11db);}};exports[_0x39c0('0x30')]=function(_0x1e1d11){try{if(agents[_0x1e1d11['destuniqueid']]){utils[_0x39c0('0x1f')](util[_0x39c0('0x4')](_0x39c0('0x31'),_0x1e1d11['uniqueid']),_0x1e1d11);utils['info'](util[_0x39c0('0x4')](_0x39c0('0x32'),_0x1e1d11['uniqueid'],agents[_0x1e1d11['destuniqueid']][_0x39c0('0x7')],_0x1e1d11['destuniqueid']));agents[_0x1e1d11[_0x39c0('0x13')]][_0x39c0('0x33')]=utils['now']();agents[_0x1e1d11[_0x39c0('0x13')]]['connectedlinenum']=_0x1e1d11[_0x39c0('0x19')];agents[_0x1e1d11[_0x39c0('0x13')]][_0x39c0('0x1a')]=_0x1e1d11['connectedlinename'];agents[_0x1e1d11[_0x39c0('0x13')]][_0x39c0('0x25')]=_0x1e1d11['ringtime'];agents[_0x1e1d11[_0x39c0('0x13')]]['lastevent']='connect';_[_0x39c0('0x2a')](agents,function(_0x526bde,_0x1c3cc2){if(_0x526bde['destuniqueid']!=_0x1e1d11['destuniqueid']&&_0x526bde['uniqueid']==_0x1e1d11[_0x39c0('0x12')]){_0x526bde['talktime']=0x0;_0x526bde[_0x39c0('0x25')]=_0x1e1d11[_0x39c0('0x26')];_0x526bde[_0x39c0('0x2e')]=!![];_0x526bde[_0x39c0('0x22')]=utils[_0x39c0('0x16')]();_0x526bde[_0x39c0('0x17')]=_0x39c0('0x34');_0x526bde[_0x39c0('0x24')]=_0x39c0('0x34');_0x526bde[_0x39c0('0x35')]=_0x1e1d11[_0x39c0('0x13')];_0x526bde[_0x39c0('0x36')]=_0x1e1d11['membername'];writeDB(_0x526bde);}});}}catch(_0xe9be18){utils[_0x39c0('0x1c')](util['format']('[%s][agents][agentconnect]',_0x1e1d11[_0x39c0('0x12')]),_0xe9be18);}};exports['agentcomplete']=function(_0x3e5fa2){try{if(!_[_0x39c0('0x1e')](agents[_0x3e5fa2[_0x39c0('0x13')]])){utils[_0x39c0('0x1f')](util['format']('[%s][agents][agentcomplete]',_0x3e5fa2[_0x39c0('0x12')]),_0x3e5fa2);utils['info'](util[_0x39c0('0x4')](_0x39c0('0x37'),_0x3e5fa2['uniqueid'],agents[_0x3e5fa2[_0x39c0('0x13')]][_0x39c0('0x7')],_0x3e5fa2['destuniqueid']));agents[_0x3e5fa2['destuniqueid']][_0x39c0('0xe')]=!![];agents[_0x3e5fa2[_0x39c0('0x13')]][_0x39c0('0x38')]=utils[_0x39c0('0x16')]();agents[_0x3e5fa2[_0x39c0('0x13')]]['talktime']=utils[_0x39c0('0x39')](agents[_0x3e5fa2[_0x39c0('0x13')]][_0x39c0('0x38')],agents[_0x3e5fa2[_0x39c0('0x13')]]['agentconnectAt']);agents[_0x3e5fa2[_0x39c0('0x13')]][_0x39c0('0x24')]=_0x3e5fa2[_0x39c0('0x24')];agents[_0x3e5fa2[_0x39c0('0x13')]][_0x39c0('0x17')]=_0x39c0('0x3a');writeDB(agents[_0x3e5fa2[_0x39c0('0x13')]]);}}catch(_0x1e4b5a){utils['error'](util[_0x39c0('0x4')](_0x39c0('0x3b'),_0x3e5fa2[_0x39c0('0x12')]),_0x1e4b5a);}};exports[_0x39c0('0x3c')]=function(_0x23ed7b){try{if(!_[_0x39c0('0x1e')](agents[_0x23ed7b[_0x39c0('0x3d')]])){utils[_0x39c0('0x1f')](util[_0x39c0('0x4')](_0x39c0('0x3e'),_0x23ed7b['uniqueid']),_0x23ed7b);utils[_0x39c0('0x3')](util['format'](_0x39c0('0x3f'),_0x23ed7b[_0x39c0('0x12')],agents[_0x23ed7b[_0x39c0('0x3d')]]['membername'],agents[_0x23ed7b[_0x39c0('0x3d')]][_0x39c0('0x12')]));agents[_0x23ed7b[_0x39c0('0x3d')]][_0x39c0('0x40')]=!![];agents[_0x23ed7b[_0x39c0('0x3d')]]['transfertype']=_0x39c0('0x41');agents[_0x23ed7b['transfereruniqueid']][_0x39c0('0x42')]=_0x23ed7b[_0x39c0('0x43')];agents[_0x23ed7b[_0x39c0('0x3d')]][_0x39c0('0x44')]=agents[_0x23ed7b[_0x39c0('0x3d')]]['uniqueid'];}}catch(_0xe183af){utils['error'](util[_0x39c0('0x4')](_0x39c0('0x3e'),_0x23ed7b[_0x39c0('0x12')]),_0xe183af);}};exports['attendedtransfer']=function(_0x363aa1){try{utils['debug'](util[_0x39c0('0x4')](_0x39c0('0x45'),_0x363aa1[_0x39c0('0x46')]),_0x363aa1);if(_0x363aa1['origtransfereruniqueid']==_0x363aa1[_0x39c0('0x47')]){if(!_['isNil'](agents[_0x363aa1[_0x39c0('0x48')]])){utils[_0x39c0('0x3')](util[_0x39c0('0x4')](_0x39c0('0x49'),_0x363aa1[_0x39c0('0x46')],agents[_0x363aa1['secondtransfereruniqueid']][_0x39c0('0x7')]));agents[_0x363aa1[_0x39c0('0x48')]][_0x39c0('0x40')]=!![];agents[_0x363aa1[_0x39c0('0x48')]][_0x39c0('0x4a')]=_0x39c0('0x4b');agents[_0x363aa1[_0x39c0('0x48')]]['transferexten']=_0x363aa1['origtransfererexten'];agents[_0x363aa1['secondtransfereruniqueid']][_0x39c0('0x44')]=_0x363aa1[_0x39c0('0x46')];}if(_0x363aa1[_0x39c0('0x4c')]&&agents[_0x363aa1[_0x39c0('0x4c')]]){agents[_0x363aa1[_0x39c0('0x4c')]][_0x39c0('0x4d')]=0x1;transfers[_0x363aa1[_0x39c0('0x4c')]]=_[_0x39c0('0x4e')](agents[_0x363aa1[_0x39c0('0x4c')]]);transfers[_0x363aa1[_0x39c0('0x4c')]][_0x39c0('0x9')]=agents[_0x363aa1['secondtransfereruniqueid']][_0x39c0('0x9')];transfers[_0x363aa1[_0x39c0('0x4c')]][_0x39c0('0x4f')]=agents[_0x363aa1[_0x39c0('0x48')]][_0x39c0('0x4f')];transfers[_0x363aa1['transfereeuniqueid']]['agentcalledAt']=utils[_0x39c0('0x16')]();transfers[_0x363aa1[_0x39c0('0x4c')]][_0x39c0('0x33')]=utils[_0x39c0('0x16')]();transfers[_0x363aa1[_0x39c0('0x4c')]]['holdtime']=0x0;transfers[_0x363aa1[_0x39c0('0x4c')]][_0x39c0('0x4d')]=0x2;}}else if(_0x363aa1['secondtransfereruniqueid']==_0x363aa1[_0x39c0('0x50')]){if(!_[_0x39c0('0x1e')](agents[_0x363aa1['origtransfereruniqueid']])){utils['info'](util[_0x39c0('0x4')](_0x39c0('0x49'),_0x363aa1['origtransfereruniqueid'],agents[_0x363aa1[_0x39c0('0x46')]][_0x39c0('0x7')]));agents[_0x363aa1[_0x39c0('0x46')]][_0x39c0('0x40')]=!![];agents[_0x363aa1[_0x39c0('0x46')]][_0x39c0('0x4a')]=_0x39c0('0x4b');agents[_0x363aa1[_0x39c0('0x46')]]['transferexten']=_0x363aa1[_0x39c0('0x51')];agents[_0x363aa1[_0x39c0('0x46')]][_0x39c0('0x44')]=_0x363aa1[_0x39c0('0x48')];}if(_0x363aa1['transfertargetuniqueid']&&agents[_0x363aa1[_0x39c0('0x52')]]){agents[_0x363aa1['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x363aa1[_0x39c0('0x52')]]=_[_0x39c0('0x4e')](agents[_0x363aa1[_0x39c0('0x52')]]);transfers[_0x363aa1[_0x39c0('0x52')]][_0x39c0('0x9')]=agents[_0x363aa1['origtransfereruniqueid']][_0x39c0('0x9')];transfers[_0x363aa1[_0x39c0('0x52')]][_0x39c0('0x4f')]=agents[_0x363aa1['origtransfereruniqueid']][_0x39c0('0x4f')];transfers[_0x363aa1[_0x39c0('0x52')]][_0x39c0('0x15')]=utils[_0x39c0('0x16')]();transfers[_0x363aa1[_0x39c0('0x52')]][_0x39c0('0x33')]=utils[_0x39c0('0x16')]();transfers[_0x363aa1[_0x39c0('0x52')]][_0x39c0('0x25')]=0x0;transfers[_0x363aa1['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x3cfc01){utils[_0x39c0('0x1c')](util[_0x39c0('0x4')](_0x39c0('0x45'),_0x363aa1[_0x39c0('0x46')]),_0x3cfc01);}};exports[_0x39c0('0x53')]=function(_0x294d74){try{utils[_0x39c0('0x1f')](util[_0x39c0('0x4')]('[%s][agents][hangup]',_0x294d74[_0x39c0('0x12')]),_0x294d74);if(agents[_0x294d74['uniqueid']]&&agents[_0x294d74['uniqueid']]['reason']===_0x39c0('0x23')){if(_0x294d74['cause']==='21'){agents[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x24')]=_0x39c0('0x54');agents[_0x294d74['uniqueid']][_0x39c0('0x17')]='rejected';}utils[_0x39c0('0x3')](util[_0x39c0('0x4')](_0x39c0('0x55'),_0x294d74[_0x39c0('0x12')],agents[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x7')],agents[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x24')],agents[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x17')]));writeDB(agents[_0x294d74['uniqueid']]);var _0x3ad429=unanswered[_0x39c0('0x56')](_0x294d74[_0x39c0('0x12')]);if(_0x3ad429>-0x1){unanswered[_0x39c0('0x57')](_0x3ad429,0x1);}}if(transfers[_0x294d74[_0x39c0('0x12')]]){transfers[_0x294d74[_0x39c0('0x12')]]['agentcomplete']=!![];transfers[_0x294d74['uniqueid']][_0x39c0('0x38')]=utils['now']();transfers[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x27')]=utils[_0x39c0('0x39')](transfers[_0x294d74[_0x39c0('0x12')]]['agentcompleteAt'],transfers[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x33')]);transfers[_0x294d74[_0x39c0('0x12')]]['reason']=_0x39c0('0x58');transfers[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x17')]=_0x39c0('0x3a');utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x294d74[_0x39c0('0x12')],transfers[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x7')],transfers[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x24')],transfers[_0x294d74['uniqueid']][_0x39c0('0x17')]));writeDB(transfers[_0x294d74[_0x39c0('0x12')]],!![]);}if(agents[_0x294d74[_0x39c0('0x12')]]&&agents[_0x294d74['uniqueid']][_0x39c0('0x33')]){agents[_0x294d74[_0x39c0('0x12')]][_0x39c0('0xe')]=!![];agents[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x38')]=utils[_0x39c0('0x16')]();agents[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x27')]=utils[_0x39c0('0x39')](agents[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x38')],agents[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x33')]);agents[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x24')]=agents[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x40')]?_0x39c0('0x40'):_0x39c0('0x58');agents[_0x294d74[_0x39c0('0x12')]][_0x39c0('0x17')]=_0x39c0('0x3a');utils[_0x39c0('0x3')](util[_0x39c0('0x4')](_0x39c0('0x55'),_0x294d74['uniqueid'],agents[_0x294d74[_0x39c0('0x12')]]['membername'],agents[_0x294d74['uniqueid']][_0x39c0('0x24')],agents[_0x294d74['uniqueid']][_0x39c0('0x17')]));writeDB(agents[_0x294d74[_0x39c0('0x12')]]);}}catch(_0x3fc5e0){utils[_0x39c0('0x1c')](util['format'](_0x39c0('0x59'),_0x294d74[_0x39c0('0x12')]),_0x3fc5e0);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 97a65d9..0d645ea 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 _0xa356=['OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','debug','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','cdr','appdata','split','substring','lastIndexOf','includes','noop','execif','set','gotoif','toLowerCase','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','getUserByInternal','accountcode','UserId','CreateVoiceCallReport','request','newchannel','linkedid'];(function(_0x1ca4c3,_0x554126){var _0x4426a6=function(_0x11e9b0){while(--_0x11e9b0){_0x1ca4c3['push'](_0x1ca4c3['shift']());}};_0x4426a6(++_0x554126);}(_0xa356,0x12f));var _0x6a35=function(_0xe9459,_0x3cb4a9){_0xe9459=_0xe9459-0x0;var _0x1c11b0=_0xa356[_0xe9459];return _0x1c11b0;};'use strict';var _=require('lodash');var util=require(_0x6a35('0x0'));var utils=require(_0x6a35('0x1'));var dispositions=[_0x6a35('0x2'),_0x6a35('0x3'),_0x6a35('0x3'),'NO\x20ANSWER',_0x6a35('0x2'),'NO\x20ANSWER','ANSWERED',_0x6a35('0x4'),_0x6a35('0x3'),'FAILED',_0x6a35('0x3')];var channels={};function writeDB(_0x283e11){utils[_0x6a35('0x5')](util[_0x6a35('0x6')](_0x6a35('0x7'),_0x283e11[_0x6a35('0x8')],_0x283e11[_0x6a35('0x9')],_0x283e11[_0x6a35('0xa')],_0x283e11[_0x6a35('0xb')],_0x283e11[_0x6a35('0xc')],_0x283e11[_0x6a35('0xd')],_0x283e11['connectedlinenum'],_0x283e11['lastevent']));if(_0x283e11['accountcode']){utils[_0x6a35('0xe')](_0x283e11[_0x6a35('0xf')])['then'](function(_0x2cd0af){if(_0x2cd0af){_0x283e11[_0x6a35('0x10')]=_0x2cd0af['id'];}utils['request'](_0x6a35('0x11'),_0x283e11);});}else{utils[_0x6a35('0x12')](_0x6a35('0x11'),_0x283e11);}if(channels[_0x283e11['uniqueid']]){delete channels[_0x283e11[_0x6a35('0x8')]];}}exports[_0x6a35('0x13')]=function(_0x5526fc){try{utils['debug'](util[_0x6a35('0x6')]('[%s][calls][newchannel]',_0x5526fc['uniqueid']),_0x5526fc);if(_0x5526fc['uniqueid']==_0x5526fc[_0x6a35('0x14')]&&_0x5526fc[_0x6a35('0x9')]!=_0x6a35('0x15')){utils[_0x6a35('0x5')](util[_0x6a35('0x6')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x5526fc[_0x6a35('0x8')],_0x5526fc[_0x6a35('0x16')],_0x5526fc[_0x6a35('0x17')]));channels[_0x5526fc[_0x6a35('0x8')]]={'uniqueid':_0x5526fc['uniqueid'],'accountcode':_0x5526fc[_0x6a35('0xf')],'source':_0x5526fc['calleridnum'],'destination':_0x5526fc[_0x6a35('0x17')],'destinationcontext':_0x5526fc[_0x6a35('0x16')],'channel':_0x5526fc[_0x6a35('0x9')],'starttime':utils[_0x6a35('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x6a35('0x2'),'amaflags':_0x6a35('0x19')};}}catch(_0x12300a){utils[_0x6a35('0x1a')](util['format'](_0x6a35('0x1b'),_0x5526fc[_0x6a35('0x8')]),_0x12300a);}};exports[_0x6a35('0x1c')]=function(_0x2581e8){try{utils['debug'](util[_0x6a35('0x6')](_0x6a35('0x1d'),_0x2581e8[_0x6a35('0x8')]),_0x2581e8);if(!_['isNil'](channels[_0x2581e8[_0x6a35('0x8')]])&&_0x2581e8[_0x6a35('0x1e')]==0x6){utils[_0x6a35('0x5')](util[_0x6a35('0x6')](_0x6a35('0x1f'),_0x2581e8[_0x6a35('0x8')],_0x2581e8['context'],_0x2581e8[_0x6a35('0x9')]));if(_[_0x6a35('0x20')](channels[_0x2581e8['uniqueid']][_0x6a35('0x21')])){channels[_0x2581e8[_0x6a35('0x8')]][_0x6a35('0x21')]=utils[_0x6a35('0x18')]();}}else if(!_['isNil'](channels[_0x2581e8[_0x6a35('0x14')]])&&_0x2581e8[_0x6a35('0x1e')]==0x6&&_0x2581e8[_0x6a35('0x16')]!=_0x6a35('0x22')){utils[_0x6a35('0x5')](util[_0x6a35('0x6')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2581e8[_0x6a35('0x8')],_0x2581e8[_0x6a35('0x14')],_0x2581e8[_0x6a35('0x16')],_0x2581e8[_0x6a35('0x9')]));channels[_0x2581e8[_0x6a35('0x14')]][_0x6a35('0xf')]=_0x2581e8['accountcode'];channels[_0x2581e8[_0x6a35('0x14')]][_0x6a35('0x23')]=_0x2581e8[_0x6a35('0x9')];if(_[_0x6a35('0x20')](channels[_0x2581e8[_0x6a35('0x14')]]['answertime'])){channels[_0x2581e8[_0x6a35('0x14')]][_0x6a35('0x24')]=utils[_0x6a35('0x18')]();}channels[_0x2581e8['linkedid']][_0x6a35('0x25')]=dispositions[_[_0x6a35('0x26')](_0x2581e8[_0x6a35('0x1e')])]||_0x6a35('0x27');}}catch(_0x2da467){utils[_0x6a35('0x1a')](util[_0x6a35('0x6')](_0x6a35('0x1d'),_0x2581e8[_0x6a35('0x8')]),_0x2da467);}};exports[_0x6a35('0x28')]=function(_0x23238f){try{if(!_[_0x6a35('0x20')](channels[_0x23238f[_0x6a35('0x8')]])){utils[_0x6a35('0x29')](util[_0x6a35('0x6')](_0x6a35('0x2a'),_0x23238f[_0x6a35('0x8')]),_0x23238f);if(_['isNil'](channels[_0x23238f['uniqueid']][_0x6a35('0x2b')])){channels[_0x23238f[_0x6a35('0x8')]][_0x6a35('0x2b')]=_0x23238f[_0x6a35('0x2c')]+'\x20<'+_0x23238f[_0x6a35('0xd')]+'>';}utils[_0x6a35('0x5')](util[_0x6a35('0x6')](_0x6a35('0x2d'),_0x23238f[_0x6a35('0x8')],channels[_0x23238f[_0x6a35('0x8')]][_0x6a35('0x2b')],_0x23238f['cause-txt']));channels[_0x23238f[_0x6a35('0x8')]][_0x6a35('0x2e')]=utils[_0x6a35('0x18')]();channels[_0x23238f[_0x6a35('0x8')]][_0x6a35('0x2f')]=utils[_0x6a35('0x30')](channels[_0x23238f['uniqueid']][_0x6a35('0x2e')],channels[_0x23238f['uniqueid']][_0x6a35('0x31')]);channels[_0x23238f[_0x6a35('0x8')]]['billableseconds']=channels[_0x23238f['uniqueid']][_0x6a35('0x24')]?utils['diffTime'](channels[_0x23238f[_0x6a35('0x8')]][_0x6a35('0x2e')],channels[_0x23238f[_0x6a35('0x8')]][_0x6a35('0x24')]):0x0;writeDB(channels[_0x23238f[_0x6a35('0x8')]]);}}catch(_0x440a3e){utils[_0x6a35('0x1a')](util[_0x6a35('0x6')](_0x6a35('0x2a'),_0x23238f['uniqueid']),_0x440a3e);}};exports['attendedtransfer']=function(_0x28a09d){try{if(!_[_0x6a35('0x20')](channels[_0x28a09d[_0x6a35('0x32')]])){utils[_0x6a35('0x29')](util[_0x6a35('0x6')](_0x6a35('0x33'),_0x28a09d[_0x6a35('0x34')]),_0x28a09d);if(channels[_0x28a09d[_0x6a35('0x32')]]['channel']==_0x28a09d[_0x6a35('0x35')]){utils[_0x6a35('0x5')](util[_0x6a35('0x6')](_0x6a35('0x36'),_0x28a09d[_0x6a35('0x34')],_0x28a09d[_0x6a35('0x32')],_0x28a09d[_0x6a35('0x37')]));channels[_0x28a09d[_0x6a35('0x32')]][_0x6a35('0x23')]=_0x28a09d[_0x6a35('0x37')];channels[_0x28a09d[_0x6a35('0x32')]][_0x6a35('0x38')]=_0x6a35('0x39');}else if(channels[_0x28a09d['localtwolinkedid']][_0x6a35('0x9')]=_0x28a09d[_0x6a35('0x3a')]){utils[_0x6a35('0x5')](util[_0x6a35('0x6')](_0x6a35('0x36'),_0x28a09d[_0x6a35('0x34')],_0x28a09d[_0x6a35('0x32')],_0x28a09d['origtransfererchannel']));channels[_0x28a09d[_0x6a35('0x32')]][_0x6a35('0x23')]=_0x28a09d[_0x6a35('0x3b')];channels[_0x28a09d[_0x6a35('0x32')]][_0x6a35('0x38')]=_0x6a35('0x39');}}}catch(_0x5bd686){utils['error'](util[_0x6a35('0x6')](_0x6a35('0x33'),_0x28a09d[_0x6a35('0x34')]),_0x5bd686);}};exports[_0x6a35('0x3c')]=function(_0x39b991){try{if(!_[_0x6a35('0x20')](channels[_0x39b991[_0x6a35('0x8')]])){utils[_0x6a35('0x29')](util[_0x6a35('0x6')](_0x6a35('0x3d'),_0x39b991[_0x6a35('0x8')]),_0x39b991);channels[_0x39b991[_0x6a35('0x8')]][_0x6a35('0x3e')]=utils[_0x6a35('0x18')]();utils[_0x6a35('0x5')](util[_0x6a35('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x39b991['uniqueid'],channels[_0x39b991[_0x6a35('0x8')]][_0x6a35('0x3e')]));}}catch(_0x35f3c9){utils[_0x6a35('0x1a')](util[_0x6a35('0x6')](_0x6a35('0x3d'),_0x39b991[_0x6a35('0x8')]),_0x35f3c9);}};exports[_0x6a35('0x3f')]=function(_0x154e74){try{if(!_[_0x6a35('0x20')](channels[_0x154e74[_0x6a35('0x8')]])){utils[_0x6a35('0x29')](util[_0x6a35('0x6')](_0x6a35('0x40'),_0x154e74['uniqueid']),_0x154e74);if(!_[_0x6a35('0x20')](channels[_0x154e74[_0x6a35('0x8')]][_0x6a35('0x3e')])){channels[_0x154e74[_0x6a35('0x8')]][_0x6a35('0x41')]+=utils[_0x6a35('0x30')](utils[_0x6a35('0x18')](),channels[_0x154e74[_0x6a35('0x8')]][_0x6a35('0x3e')]);utils[_0x6a35('0x5')](util['format'](_0x6a35('0x42'),_0x154e74[_0x6a35('0x8')],channels[_0x154e74[_0x6a35('0x8')]][_0x6a35('0x41')]));delete channels[_0x154e74[_0x6a35('0x8')]][_0x6a35('0x3e')];}}}catch(_0xa8dd18){utils[_0x6a35('0x1a')](util['format'](_0x6a35('0x40'),_0x154e74['uniqueid']),_0xa8dd18);}};exports[_0x6a35('0x43')]=function(_0x562556){try{if(!_[_0x6a35('0x20')](channels[_0x562556[_0x6a35('0x8')]])){utils[_0x6a35('0x29')](util[_0x6a35('0x6')](_0x6a35('0x44'),_0x562556[_0x6a35('0x8')]),_0x562556);if(!_[_0x6a35('0x20')](_0x562556[_0x6a35('0x45')]['xmd-originatecalleridnum'])){utils[_0x6a35('0x5')](util[_0x6a35('0x6')](_0x6a35('0x46'),_0x562556[_0x6a35('0x8')],_0x562556['value']));channels[_0x562556[_0x6a35('0x8')]][_0x6a35('0x47')]=_0x562556[_0x6a35('0x48')];}if(!_[_0x6a35('0x20')](_0x562556[_0x6a35('0x45')][_0x6a35('0x49')])){utils[_0x6a35('0x5')](util['format'](_0x6a35('0x4a'),_0x562556[_0x6a35('0x8')],_0x562556[_0x6a35('0x48')]));channels[_0x562556[_0x6a35('0x8')]][_0x6a35('0x4b')]=_0x562556[_0x6a35('0x48')];channels[_0x562556['uniqueid']][_0x6a35('0x2b')]='\x22'+_0x562556[_0x6a35('0x48')]+'\x22\x20<'+_0x562556[_0x6a35('0x48')]+'>';}if(!_[_0x6a35('0x20')](_0x562556[_0x6a35('0x45')][_0x6a35('0x4c')])||!_[_0x6a35('0x20')](_0x562556[_0x6a35('0x45')][_0x6a35('0x4d')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x562556['uniqueid'],!_['isNil'](_0x562556[_0x6a35('0x45')][_0x6a35('0x4c')])?_0x6a35('0x4c'):_0x6a35('0x4d'),_0x562556[_0x6a35('0x48')]));channels[_0x562556[_0x6a35('0x8')]][_0x6a35('0x2b')]=_0x562556[_0x6a35('0x48')];}if(!_[_0x6a35('0x20')](_0x562556[_0x6a35('0x45')][_0x6a35('0x4e')])||!_['isNil'](_0x562556[_0x6a35('0x45')][_0x6a35('0x4f')])){utils[_0x6a35('0x5')](util[_0x6a35('0x6')](_0x6a35('0x50'),_0x562556[_0x6a35('0x8')],!_[_0x6a35('0x20')](_0x562556[_0x6a35('0x45')][_0x6a35('0x4e')])?_0x6a35('0x4e'):_0x6a35('0x4f'),_0x562556[_0x6a35('0x48')]));channels[_0x562556[_0x6a35('0x8')]][_0x6a35('0x51')]=_0x6a35('0x52');channels[_0x562556[_0x6a35('0x8')]][_0x6a35('0x53')]=_0x562556[_0x6a35('0x48')];channels[_0x562556[_0x6a35('0x8')]][_0x6a35('0xa')]=!![];}if(!_[_0x6a35('0x20')](_0x562556[_0x6a35('0x45')][_0x6a35('0x54')])){utils['info'](util[_0x6a35('0x6')](_0x6a35('0x55'),_0x562556[_0x6a35('0x8')],_0x562556[_0x6a35('0x48')]));channels[_0x562556[_0x6a35('0x8')]][_0x6a35('0x56')]=_0x562556[_0x6a35('0x48')];}if(!_[_0x6a35('0x20')](_0x562556[_0x6a35('0x45')][_0x6a35('0x57')])){utils['info'](util[_0x6a35('0x6')](_0x6a35('0x58'),_0x562556[_0x6a35('0x8')],_0x562556[_0x6a35('0x48')]));channels[_0x562556[_0x6a35('0x8')]][_0x6a35('0x59')]=_0x562556[_0x6a35('0x48')];}if(!_[_0x6a35('0x20')](_0x562556[_0x6a35('0x45')]['outboundrouteid'])){utils[_0x6a35('0x5')](util[_0x6a35('0x6')](_0x6a35('0x5a'),_0x562556[_0x6a35('0x8')],_0x562556[_0x6a35('0x48')]));channels[_0x562556[_0x6a35('0x8')]]['routeid']=_0x562556[_0x6a35('0x48')];}if(!_[_0x6a35('0x20')](_0x562556['variable'][_0x6a35('0x5b')])){utils[_0x6a35('0x5')](util[_0x6a35('0x6')](_0x6a35('0x5c'),_0x562556[_0x6a35('0x8')],_0x562556['value']));channels[_0x562556[_0x6a35('0x8')]][_0x6a35('0x5b')]=_0x562556[_0x6a35('0x48')];}}}catch(_0x20269a){utils[_0x6a35('0x1a')](util[_0x6a35('0x6')](_0x6a35('0x44'),_0x562556[_0x6a35('0x8')]),_0x20269a);}};exports[_0x6a35('0x5d')]=function(_0x182ed7){try{if(!_[_0x6a35('0x20')](channels[_0x182ed7[_0x6a35('0x8')]])){utils[_0x6a35('0x29')](util[_0x6a35('0x6')](_0x6a35('0x5e'),_0x182ed7[_0x6a35('0x8')]),_0x182ed7);utils[_0x6a35('0x5')](util[_0x6a35('0x6')](_0x6a35('0x5f'),_0x182ed7['uniqueid'],_0x182ed7['application'],_0x182ed7['appdata']));if(_0x182ed7[_0x6a35('0x60')]['toLowerCase']()=='set'&&_['startsWith'](_0x182ed7['appdata']['toLowerCase'](),_0x6a35('0x61'))){var _0x2f1c54=_0x182ed7[_0x6a35('0x62')][_0x6a35('0x63')]('=');var _0x5b3788=_0x2f1c54[0x0][_0x6a35('0x64')](_0x2f1c54[0x0][_0x6a35('0x65')]('(')+0x1,_0x2f1c54[0x0][_0x6a35('0x65')](')'));var _0x33eef9=_0x2f1c54[0x1];channels[_0x182ed7[_0x6a35('0x8')]][_0x5b3788]=_0x33eef9;}if(!_[_0x6a35('0x66')](['hangup',_0x6a35('0x67'),_0x6a35('0x68'),_0x6a35('0x69'),_0x6a35('0x6a')],_0x182ed7[_0x6a35('0x60')][_0x6a35('0x6b')]())){channels[_0x182ed7[_0x6a35('0x8')]][_0x6a35('0x51')]=_0x182ed7[_0x6a35('0x60')];channels[_0x182ed7[_0x6a35('0x8')]]['lastdata']=_0x182ed7[_0x6a35('0x62')];}}}catch(_0x5e6f32){utils['error'](util[_0x6a35('0x6')](_0x6a35('0x5e'),_0x182ed7[_0x6a35('0x8')]),_0x5e6f32);}}; \ No newline at end of file +var _0x8d62=['toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','noop','execif','set','gotoif','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','debug','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','accountcode','destinationchannel','answertime','disposition'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x8d62,0x192));var _0x28d6=function(_0x7d8959,_0x2bbc3c){_0x7d8959=_0x7d8959-0x0;var _0x2c228a=_0x8d62[_0x7d8959];return _0x2c228a;};'use strict';var _=require(_0x28d6('0x0'));var util=require(_0x28d6('0x1'));var utils=require(_0x28d6('0x2'));var dispositions=[_0x28d6('0x3'),_0x28d6('0x4'),_0x28d6('0x4'),'NO\x20ANSWER',_0x28d6('0x3'),_0x28d6('0x3'),'ANSWERED',_0x28d6('0x5'),_0x28d6('0x4'),'FAILED',_0x28d6('0x4')];var channels={};function writeDB(_0x2661c7){utils[_0x28d6('0x6')](util[_0x28d6('0x7')](_0x28d6('0x8'),_0x2661c7['uniqueid'],_0x2661c7[_0x28d6('0x9')],_0x2661c7[_0x28d6('0xa')],_0x2661c7[_0x28d6('0xb')],_0x2661c7[_0x28d6('0xc')],_0x2661c7[_0x28d6('0xd')],_0x2661c7[_0x28d6('0xe')],_0x2661c7[_0x28d6('0xf')]));if(_0x2661c7['accountcode']){utils['getUserByInternal'](_0x2661c7['accountcode'])['then'](function(_0x6a8534){if(_0x6a8534){_0x2661c7[_0x28d6('0x10')]=_0x6a8534['id'];}utils[_0x28d6('0x11')]('CreateVoiceCallReport',_0x2661c7);});}else{utils[_0x28d6('0x11')](_0x28d6('0x12'),_0x2661c7);}if(channels[_0x2661c7[_0x28d6('0x13')]]){delete channels[_0x2661c7['uniqueid']];}}exports[_0x28d6('0x14')]=function(_0x5928da){try{utils[_0x28d6('0x15')](util[_0x28d6('0x7')]('[%s][calls][newchannel]',_0x5928da[_0x28d6('0x13')]),_0x5928da);if(_0x5928da['uniqueid']==_0x5928da['linkedid']&&_0x5928da[_0x28d6('0x9')]!=_0x28d6('0x16')){utils[_0x28d6('0x6')](util[_0x28d6('0x7')](_0x28d6('0x17'),_0x5928da['uniqueid'],_0x5928da[_0x28d6('0x18')],_0x5928da['exten']));channels[_0x5928da[_0x28d6('0x13')]]={'uniqueid':_0x5928da[_0x28d6('0x13')],'accountcode':_0x5928da['accountcode'],'source':_0x5928da[_0x28d6('0xd')],'destination':_0x5928da[_0x28d6('0x19')],'destinationcontext':_0x5928da['context'],'channel':_0x5928da[_0x28d6('0x9')],'starttime':utils[_0x28d6('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x28d6('0x1b')};}}catch(_0x4be34e){utils[_0x28d6('0x1c')](util[_0x28d6('0x7')]('[%s][calls][newchannel]',_0x5928da[_0x28d6('0x13')]),_0x4be34e);}};exports[_0x28d6('0x1d')]=function(_0x105a9b){try{utils[_0x28d6('0x15')](util[_0x28d6('0x7')](_0x28d6('0x1e'),_0x105a9b[_0x28d6('0x13')]),_0x105a9b);if(!_['isNil'](channels[_0x105a9b[_0x28d6('0x13')]])&&_0x105a9b[_0x28d6('0x1f')]==0x6){utils[_0x28d6('0x6')](util['format'](_0x28d6('0x20'),_0x105a9b['uniqueid'],_0x105a9b[_0x28d6('0x18')],_0x105a9b[_0x28d6('0x9')]));if(_[_0x28d6('0x21')](channels[_0x105a9b[_0x28d6('0x13')]][_0x28d6('0x22')])){channels[_0x105a9b[_0x28d6('0x13')]][_0x28d6('0x22')]=utils[_0x28d6('0x1a')]();}}else if(!_['isNil'](channels[_0x105a9b[_0x28d6('0x23')]])&&_0x105a9b['channelstate']==0x6&&_0x105a9b[_0x28d6('0x18')]!=_0x28d6('0x24')){utils[_0x28d6('0x6')](util['format'](_0x28d6('0x25'),_0x105a9b[_0x28d6('0x13')],_0x105a9b[_0x28d6('0x23')],_0x105a9b['context'],_0x105a9b['channel']));channels[_0x105a9b['linkedid']][_0x28d6('0x26')]=_0x105a9b[_0x28d6('0x26')];channels[_0x105a9b[_0x28d6('0x23')]][_0x28d6('0x27')]=_0x105a9b[_0x28d6('0x9')];if(_[_0x28d6('0x21')](channels[_0x105a9b[_0x28d6('0x23')]][_0x28d6('0x28')])){channels[_0x105a9b['linkedid']][_0x28d6('0x28')]=utils[_0x28d6('0x1a')]();}channels[_0x105a9b['linkedid']][_0x28d6('0x29')]=dispositions[_[_0x28d6('0x2a')](_0x105a9b[_0x28d6('0x1f')])]||'ANSWERED';}}catch(_0x30e5f5){utils['error'](util[_0x28d6('0x7')](_0x28d6('0x1e'),_0x105a9b['uniqueid']),_0x30e5f5);}};exports[_0x28d6('0x2b')]=function(_0x310492){try{if(!_[_0x28d6('0x21')](channels[_0x310492['uniqueid']])){utils[_0x28d6('0x15')](util['format'](_0x28d6('0x2c'),_0x310492['uniqueid']),_0x310492);if(_[_0x28d6('0x21')](channels[_0x310492[_0x28d6('0x13')]][_0x28d6('0x2d')])){channels[_0x310492[_0x28d6('0x13')]][_0x28d6('0x2d')]=_0x310492[_0x28d6('0x2e')]+'\x20<'+_0x310492[_0x28d6('0xd')]+'>';}utils[_0x28d6('0x6')](util['format'](_0x28d6('0x2f'),_0x310492[_0x28d6('0x13')],channels[_0x310492['uniqueid']][_0x28d6('0x2d')],_0x310492[_0x28d6('0x30')]));channels[_0x310492['uniqueid']][_0x28d6('0x31')]=utils[_0x28d6('0x1a')]();channels[_0x310492['uniqueid']][_0x28d6('0x32')]=utils['diffTime'](channels[_0x310492[_0x28d6('0x13')]][_0x28d6('0x31')],channels[_0x310492[_0x28d6('0x13')]][_0x28d6('0x33')]);channels[_0x310492['uniqueid']][_0x28d6('0x34')]=channels[_0x310492[_0x28d6('0x13')]][_0x28d6('0x28')]?utils[_0x28d6('0x35')](channels[_0x310492[_0x28d6('0x13')]][_0x28d6('0x31')],channels[_0x310492[_0x28d6('0x13')]][_0x28d6('0x28')]):0x0;writeDB(channels[_0x310492['uniqueid']]);}}catch(_0x1f82ac){utils[_0x28d6('0x1c')](util[_0x28d6('0x7')](_0x28d6('0x2c'),_0x310492[_0x28d6('0x13')]),_0x1f82ac);}};exports[_0x28d6('0x36')]=function(_0x5670c1){try{if(!_[_0x28d6('0x21')](channels[_0x5670c1['localtwolinkedid']])){utils[_0x28d6('0x15')](util[_0x28d6('0x7')](_0x28d6('0x37'),_0x5670c1[_0x28d6('0x38')]),_0x5670c1);if(channels[_0x5670c1[_0x28d6('0x39')]][_0x28d6('0x9')]==_0x5670c1[_0x28d6('0x3a')]){utils[_0x28d6('0x6')](util['format'](_0x28d6('0x3b'),_0x5670c1[_0x28d6('0x38')],_0x5670c1['localtwolinkedid'],_0x5670c1[_0x28d6('0x3c')]));channels[_0x5670c1[_0x28d6('0x39')]]['destinationchannel']=_0x5670c1[_0x28d6('0x3c')];channels[_0x5670c1[_0x28d6('0x39')]][_0x28d6('0x3d')]=_0x28d6('0x3e');}else if(channels[_0x5670c1[_0x28d6('0x39')]][_0x28d6('0x9')]=_0x5670c1[_0x28d6('0x3f')]){utils['info'](util[_0x28d6('0x7')](_0x28d6('0x3b'),_0x5670c1[_0x28d6('0x38')],_0x5670c1[_0x28d6('0x39')],_0x5670c1[_0x28d6('0x40')]));channels[_0x5670c1['localtwolinkedid']]['destinationchannel']=_0x5670c1['origtransfererchannel'];channels[_0x5670c1[_0x28d6('0x39')]][_0x28d6('0x3d')]=_0x28d6('0x3e');}}}catch(_0x21ff8e){utils[_0x28d6('0x1c')](util[_0x28d6('0x7')]('[%s][calls][attendedtransfer]',_0x5670c1['origtransfereruniqueid']),_0x21ff8e);}};exports[_0x28d6('0x41')]=function(_0xc6477e){try{if(!_['isNil'](channels[_0xc6477e[_0x28d6('0x13')]])){utils[_0x28d6('0x15')](util[_0x28d6('0x7')](_0x28d6('0x42'),_0xc6477e[_0x28d6('0x13')]),_0xc6477e);channels[_0xc6477e['uniqueid']]['musiconholdstartAt']=utils[_0x28d6('0x1a')]();utils[_0x28d6('0x6')](util['format'](_0x28d6('0x43'),_0xc6477e[_0x28d6('0x13')],channels[_0xc6477e[_0x28d6('0x13')]][_0x28d6('0x44')]));}}catch(_0x31b593){utils[_0x28d6('0x1c')](util[_0x28d6('0x7')]('[%s][calls][musiconholdstart]',_0xc6477e['uniqueid']),_0x31b593);}};exports['musiconholdstop']=function(_0x4693e0){try{if(!_['isNil'](channels[_0x4693e0[_0x28d6('0x13')]])){utils[_0x28d6('0x15')](util[_0x28d6('0x7')](_0x28d6('0x45'),_0x4693e0[_0x28d6('0x13')]),_0x4693e0);if(!_[_0x28d6('0x21')](channels[_0x4693e0[_0x28d6('0x13')]][_0x28d6('0x44')])){channels[_0x4693e0['uniqueid']][_0x28d6('0x46')]+=utils[_0x28d6('0x35')](utils[_0x28d6('0x1a')](),channels[_0x4693e0[_0x28d6('0x13')]][_0x28d6('0x44')]);utils['info'](util[_0x28d6('0x7')](_0x28d6('0x47'),_0x4693e0[_0x28d6('0x13')],channels[_0x4693e0[_0x28d6('0x13')]]['mohtime']));delete channels[_0x4693e0[_0x28d6('0x13')]][_0x28d6('0x44')];}}}catch(_0x1a63cc){utils[_0x28d6('0x1c')](util[_0x28d6('0x7')](_0x28d6('0x45'),_0x4693e0[_0x28d6('0x13')]),_0x1a63cc);}};exports['varset']=function(_0x46d436){try{if(!_['isNil'](channels[_0x46d436[_0x28d6('0x13')]])){utils['debug'](util[_0x28d6('0x7')]('[%s][calls][varset]',_0x46d436[_0x28d6('0x13')]),_0x46d436);if(!_[_0x28d6('0x21')](_0x46d436[_0x28d6('0x48')][_0x28d6('0x49')])){utils['info'](util[_0x28d6('0x7')](_0x28d6('0x4a'),_0x46d436[_0x28d6('0x13')],_0x46d436['value']));channels[_0x46d436[_0x28d6('0x13')]]['source']=_0x46d436['value'];}if(!_['isNil'](_0x46d436[_0x28d6('0x48')][_0x28d6('0x4b')])){utils[_0x28d6('0x6')](util[_0x28d6('0x7')](_0x28d6('0x4c'),_0x46d436[_0x28d6('0x13')],_0x46d436[_0x28d6('0x4d')]));channels[_0x46d436[_0x28d6('0x13')]]['destination']=_0x46d436[_0x28d6('0x4d')];channels[_0x46d436[_0x28d6('0x13')]]['callerid']='\x22'+_0x46d436['value']+_0x28d6('0x4e')+_0x46d436['value']+'>';}if(!_[_0x28d6('0x21')](_0x46d436['variable']['xmd-callerid-preview'])||!_[_0x28d6('0x21')](_0x46d436['variable']['xmd-callerid'])){utils['info'](util[_0x28d6('0x7')](_0x28d6('0x4f'),_0x46d436['uniqueid'],!_['isNil'](_0x46d436[_0x28d6('0x48')][_0x28d6('0x50')])?_0x28d6('0x50'):'xmd-callerid',_0x46d436[_0x28d6('0x4d')]));channels[_0x46d436['uniqueid']][_0x28d6('0x2d')]=_0x46d436[_0x28d6('0x4d')];}if(!_[_0x28d6('0x21')](_0x46d436[_0x28d6('0x48')][_0x28d6('0x51')])||!_[_0x28d6('0x21')](_0x46d436[_0x28d6('0x48')][_0x28d6('0x52')])){utils[_0x28d6('0x6')](util[_0x28d6('0x7')](_0x28d6('0x4f'),_0x46d436[_0x28d6('0x13')],!_['isNil'](_0x46d436[_0x28d6('0x48')][_0x28d6('0x51')])?'xmd-queue':_0x28d6('0x52'),_0x46d436['value']));channels[_0x46d436[_0x28d6('0x13')]][_0x28d6('0x53')]=_0x28d6('0x54');channels[_0x46d436[_0x28d6('0x13')]][_0x28d6('0x55')]=_0x46d436['value'];channels[_0x46d436[_0x28d6('0x13')]][_0x28d6('0xa')]=!![];}if(!_[_0x28d6('0x21')](_0x46d436[_0x28d6('0x48')]['xmd-contactid'])){utils['info'](util[_0x28d6('0x7')](_0x28d6('0x56'),_0x46d436[_0x28d6('0x13')],_0x46d436['value']));channels[_0x46d436[_0x28d6('0x13')]][_0x28d6('0x57')]=_0x46d436[_0x28d6('0x4d')];}if(!_[_0x28d6('0x21')](_0x46d436['variable'][_0x28d6('0x58')])){utils['info'](util[_0x28d6('0x7')](_0x28d6('0x59'),_0x46d436[_0x28d6('0x13')],_0x46d436[_0x28d6('0x4d')]));channels[_0x46d436[_0x28d6('0x13')]][_0x28d6('0x5a')]=_0x46d436['value'];}if(!_[_0x28d6('0x21')](_0x46d436[_0x28d6('0x48')]['outboundrouteid'])){utils['info'](util[_0x28d6('0x7')](_0x28d6('0x5b'),_0x46d436[_0x28d6('0x13')],_0x46d436[_0x28d6('0x4d')]));channels[_0x46d436[_0x28d6('0x13')]][_0x28d6('0x5c')]=_0x46d436[_0x28d6('0x4d')];}if(!_['isNil'](_0x46d436['variable'][_0x28d6('0x5d')])){utils['info'](util['format'](_0x28d6('0x5e'),_0x46d436[_0x28d6('0x13')],_0x46d436[_0x28d6('0x4d')]));channels[_0x46d436[_0x28d6('0x13')]][_0x28d6('0x5d')]=_0x46d436['value'];}}}catch(_0x298265){utils[_0x28d6('0x1c')](util[_0x28d6('0x7')](_0x28d6('0x5f'),_0x46d436[_0x28d6('0x13')]),_0x298265);}};exports[_0x28d6('0x60')]=function(_0x426e1a){try{if(!_[_0x28d6('0x21')](channels[_0x426e1a[_0x28d6('0x13')]])){utils[_0x28d6('0x15')](util[_0x28d6('0x7')]('[%s][calls][newexten]',_0x426e1a[_0x28d6('0x13')]),_0x426e1a);utils[_0x28d6('0x6')](util[_0x28d6('0x7')](_0x28d6('0x61'),_0x426e1a['uniqueid'],_0x426e1a[_0x28d6('0x62')],_0x426e1a[_0x28d6('0x63')]));if(_0x426e1a[_0x28d6('0x62')][_0x28d6('0x64')]()=='set'&&_[_0x28d6('0x65')](_0x426e1a[_0x28d6('0x63')][_0x28d6('0x64')](),_0x28d6('0x66'))){var _0x13ccef=_0x426e1a['appdata'][_0x28d6('0x67')]('=');var _0x4f8f50=_0x13ccef[0x0][_0x28d6('0x68')](_0x13ccef[0x0][_0x28d6('0x69')]('(')+0x1,_0x13ccef[0x0][_0x28d6('0x69')](')'));var _0x231ef1=_0x13ccef[0x1];channels[_0x426e1a[_0x28d6('0x13')]][_0x4f8f50]=_0x231ef1;}if(!_['includes']([_0x28d6('0x2b'),_0x28d6('0x6a'),_0x28d6('0x6b'),_0x28d6('0x6c'),_0x28d6('0x6d')],_0x426e1a[_0x28d6('0x62')][_0x28d6('0x64')]())){channels[_0x426e1a['uniqueid']][_0x28d6('0x53')]=_0x426e1a[_0x28d6('0x62')];channels[_0x426e1a[_0x28d6('0x13')]][_0x28d6('0x55')]=_0x426e1a[_0x28d6('0x63')];}}}catch(_0x258001){utils[_0x28d6('0x1c')](util[_0x28d6('0x7')](_0x28d6('0x6e'),_0x426e1a[_0x28d6('0x13')]),_0x258001);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 13e7edb..1d31c78 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 _0x2da2=['fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2da2,0x1aa));var _0x22da=function(_0x1e50fc,_0x285d4c){_0x1e50fc=_0x1e50fc-0x0;var _0x4a1e9d=_0x2da2[_0x1e50fc];return _0x4a1e9d;};'use strict';var utils=require(_0x22da('0x0'));exports[_0x22da('0x1')]=function(){utils[_0x22da('0x2')](_0x22da('0x3'));};exports[_0x22da('0x4')]=function(){utils[_0x22da('0x2')](_0x22da('0x5'));};exports[_0x22da('0x6')]=function(){utils['info']('[core]\x20fullybooted');};exports['error']=function(_0x71b310){utils[_0x22da('0x7')](_0x22da('0x8'),_0x71b310);};exports[_0x22da('0x9')]=function(){utils[_0x22da('0x2')](_0x22da('0xa'));};exports[_0x22da('0xb')]=function(_0xd797b4){}; \ No newline at end of file +var _0x9e51=['info','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','connect','[core]\x20connected','shutdown'];(function(_0x3a1b23,_0x4e0ef9){var _0x228d49=function(_0x125c0d){while(--_0x125c0d){_0x3a1b23['push'](_0x3a1b23['shift']());}};_0x228d49(++_0x4e0ef9);}(_0x9e51,0x133));var _0x19e5=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x9e51[_0x2ec461];return _0x28603d;};'use strict';var utils=require('./utils');exports[_0x19e5('0x0')]=function(){utils['info'](_0x19e5('0x1'));};exports[_0x19e5('0x2')]=function(){utils[_0x19e5('0x3')](_0x19e5('0x4'));};exports[_0x19e5('0x5')]=function(){utils[_0x19e5('0x3')]('[core]\x20fullybooted');};exports['error']=function(_0x2647f6){utils[_0x19e5('0x6')](_0x19e5('0x7'),_0x2647f6);};exports[_0x19e5('0x8')]=function(){utils['info'](_0x19e5('0x9'));};exports['managerevent']=function(_0x491be4){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 090d559..54e2631 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 _0x1402=['diffTime','endtime','billableseconds','lodash','util','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','application','set','startsWith','cdr(routeid)','varset','debug','[%s][dials][varset]','isNil','variable','outboundrouteid','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration'];(function(_0x22aacc,_0x307cb7){var _0xdc8e8b=function(_0x1fcf63){while(--_0x1fcf63){_0x22aacc['push'](_0x22aacc['shift']());}};_0xdc8e8b(++_0x307cb7);}(_0x1402,0x1c5));var _0x2140=function(_0x44799b,_0x269c0d){_0x44799b=_0x44799b-0x0;var _0x4b16e7=_0x1402[_0x44799b];return _0x4b16e7;};'use strict';var _=require(_0x2140('0x0'));var util=require(_0x2140('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x3b8906){utils['info'](util[_0x2140('0x2')](_0x2140('0x3'),_0x3b8906[_0x2140('0x4')],_0x3b8906[_0x2140('0x5')],_0x3b8906[_0x2140('0x6')],_0x3b8906[_0x2140('0x7')],_0x3b8906[_0x2140('0x8')],_0x3b8906[_0x2140('0x9')]));utils[_0x2140('0xa')](_0x2140('0xb'),_0x3b8906);delete dials[_0x3b8906[_0x2140('0x4')]];}exports[_0x2140('0xc')]=function(_0x3af325){try{utils['debug'](util[_0x2140('0x2')](_0x2140('0xd'),_0x3af325[_0x2140('0x4')]),_0x3af325);utils['info'](util[_0x2140('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x3af325[_0x2140('0x4')],_0x3af325[_0x2140('0xe')],_0x3af325['appdata']));if(_0x3af325['application']['toLowerCase']()==_0x2140('0xf')&&_[_0x2140('0x10')](_0x3af325['appdata']['toLowerCase'](),_0x2140('0x11'))){var _0x1186d6=_0x3af325['appdata']['split']('=');dials[_0x3af325['uniqueid']]={'routeId':_0x1186d6[0x1]};}}catch(_0x4b9572){utils['error'](util[_0x2140('0x2')]('[%s][dials][newexten]',_0x3af325[_0x2140('0x4')]),_0x4b9572);}};exports[_0x2140('0x12')]=function(_0x4cedf0){try{utils[_0x2140('0x13')](util[_0x2140('0x2')](_0x2140('0x14'),_0x4cedf0['uniqueid']),_0x4cedf0);if(!_[_0x2140('0x15')](_0x4cedf0[_0x2140('0x16')][_0x2140('0x17')])){utils[_0x2140('0x18')](util[_0x2140('0x2')](_0x2140('0x19'),_0x4cedf0['uniqueid'],_0x4cedf0[_0x2140('0x1a')]));dials[_0x4cedf0[_0x2140('0x4')]]={'routeId':_0x4cedf0['value']};}}catch(_0x3ad253){utils[_0x2140('0x1b')](util[_0x2140('0x2')](_0x2140('0x14'),_0x4cedf0['uniqueid']),_0x3ad253);}};exports[_0x2140('0x1c')]=function(_0x55a522){try{if(!_[_0x2140('0x15')](dials[_0x55a522[_0x2140('0x4')]])){utils[_0x2140('0x13')](util[_0x2140('0x2')]('[%s][dials][dialbegin]',_0x55a522['uniqueid']),_0x55a522);dials[_0x55a522['uniqueid']]=_[_0x2140('0x1d')](dials[_0x55a522['uniqueid']],_0x55a522);dials[_0x55a522[_0x2140('0x4')]][_0x2140('0x1e')]=utils['now']();dials[_0x55a522['uniqueid']][_0x2140('0x1f')]=_0x2140('0x20');utils[_0x2140('0x18')](util['format'](_0x2140('0x21'),_0x55a522['uniqueid'],dials[_0x55a522[_0x2140('0x4')]][_0x2140('0x1e')]));}}catch(_0x3dbb5c){utils[_0x2140('0x1b')](util[_0x2140('0x2')]('[%s][dials][dialbegin]',_0x55a522['uniqueid']),_0x3dbb5c);}};exports[_0x2140('0x22')]=function(_0xdc3a12){try{if(!_[_0x2140('0x15')](dials[_0xdc3a12['uniqueid']])){utils[_0x2140('0x13')](util['format'](_0x2140('0x23'),_0xdc3a12[_0x2140('0x4')]),_0xdc3a12);dials[_0xdc3a12[_0x2140('0x4')]][_0x2140('0x9')]=_0xdc3a12[_0x2140('0x9')];if(_0xdc3a12[_0x2140('0x9')]=='ANSWER'){dials[_0xdc3a12['uniqueid']]=_[_0x2140('0x1d')](dials[_0xdc3a12[_0x2140('0x4')]],_0xdc3a12);dials[_0xdc3a12['uniqueid']][_0x2140('0x24')]=utils[_0x2140('0x25')]();dials[_0xdc3a12['uniqueid']][_0x2140('0x1f')]=_0x2140('0x26');utils[_0x2140('0x18')](util[_0x2140('0x2')](_0x2140('0x27'),_0xdc3a12['uniqueid'],_0xdc3a12[_0x2140('0x9')],dials[_0xdc3a12[_0x2140('0x4')]]['answertime']));}else{utils[_0x2140('0x18')](util['format'](_0x2140('0x28'),_0xdc3a12['uniqueid'],_0xdc3a12[_0x2140('0x9')]));}}}catch(_0x79da50){utils[_0x2140('0x1b')](util[_0x2140('0x2')](_0x2140('0x23'),_0xdc3a12[_0x2140('0x4')]),_0x79da50);}};exports[_0x2140('0x29')]=function(_0x13ec55){try{if(!_['isNil'](dials[_0x13ec55['uniqueid']])){utils[_0x2140('0x13')](util[_0x2140('0x2')](_0x2140('0x2a'),_0x13ec55[_0x2140('0x4')]),_0x13ec55);utils[_0x2140('0x18')](util['format'](_0x2140('0x2b'),_0x13ec55[_0x2140('0x4')],_0x13ec55[_0x2140('0x7')],_0x13ec55['calleridname'],_0x13ec55[_0x2140('0x2c')]));dials[_0x13ec55['uniqueid']]=_[_0x2140('0x1d')](dials[_0x13ec55[_0x2140('0x4')]],{'endtime':utils[_0x2140('0x25')](),'lastevent':_0x2140('0x2d')});dials[_0x13ec55[_0x2140('0x4')]][_0x2140('0x2e')]=utils[_0x2140('0x2f')](dials[_0x13ec55[_0x2140('0x4')]][_0x2140('0x30')],dials[_0x13ec55[_0x2140('0x4')]]['starttime']);dials[_0x13ec55['uniqueid']]['holdtime']=utils[_0x2140('0x2f')](dials[_0x13ec55[_0x2140('0x4')]][_0x2140('0x24')]||dials[_0x13ec55['uniqueid']][_0x2140('0x30')],dials[_0x13ec55['uniqueid']][_0x2140('0x1e')]);dials[_0x13ec55[_0x2140('0x4')]][_0x2140('0x31')]=dials[_0x13ec55[_0x2140('0x4')]][_0x2140('0x24')]?utils[_0x2140('0x2f')](dials[_0x13ec55['uniqueid']]['endtime'],dials[_0x13ec55[_0x2140('0x4')]][_0x2140('0x24')]):0x0;writeDB(dials[_0x13ec55['uniqueid']]);}}catch(_0x41b1d2){utils['error'](util['format'](_0x2140('0x2a'),_0x13ec55[_0x2140('0x4')]),_0x41b1d2);}}; \ No newline at end of file +var _0x8bf5=['cdr(routeid)','split','error','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','isNil','assign','starttime','now','lastevent','called','info','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','endtime','holdtime','answertime','lodash','util','./utils','format','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','set','appdata'];(function(_0x483f55,_0x35b628){var _0x3f9563=function(_0x2089f1){while(--_0x2089f1){_0x483f55['push'](_0x483f55['shift']());}};_0x3f9563(++_0x35b628);}(_0x8bf5,0xe4));var _0x58bf=function(_0x3b95d9,_0x3991fa){_0x3b95d9=_0x3b95d9-0x0;var _0x1e51b0=_0x8bf5[_0x3b95d9];return _0x1e51b0;};'use strict';var _=require(_0x58bf('0x0'));var util=require(_0x58bf('0x1'));var utils=require(_0x58bf('0x2'));var dials={};function writeDB(_0x346366){utils['info'](util[_0x58bf('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x346366[_0x58bf('0x4')],_0x346366['channel'],_0x346366[_0x58bf('0x5')],_0x346366[_0x58bf('0x6')],_0x346366[_0x58bf('0x7')],_0x346366[_0x58bf('0x8')]));utils[_0x58bf('0x9')](_0x58bf('0xa'),_0x346366);delete dials[_0x346366[_0x58bf('0x4')]];}exports['newexten']=function(_0x55da14){try{utils[_0x58bf('0xb')](util['format'](_0x58bf('0xc'),_0x55da14['uniqueid']),_0x55da14);utils['info'](util[_0x58bf('0x3')](_0x58bf('0xd'),_0x55da14['uniqueid'],_0x55da14[_0x58bf('0xe')],_0x55da14['appdata']));if(_0x55da14['application']['toLowerCase']()==_0x58bf('0xf')&&_['startsWith'](_0x55da14[_0x58bf('0x10')]['toLowerCase'](),_0x58bf('0x11'))){var _0x306198=_0x55da14[_0x58bf('0x10')][_0x58bf('0x12')]('=');dials[_0x55da14['uniqueid']]={'routeId':_0x306198[0x1]};}}catch(_0x27d112){utils[_0x58bf('0x13')](util[_0x58bf('0x3')]('[%s][dials][newexten]',_0x55da14['uniqueid']),_0x27d112);}};exports['varset']=function(_0x48a30c){try{utils[_0x58bf('0xb')](util[_0x58bf('0x3')]('[%s][dials][varset]',_0x48a30c[_0x58bf('0x4')]),_0x48a30c);if(!_['isNil'](_0x48a30c[_0x58bf('0x14')][_0x58bf('0x15')])){utils['info'](util[_0x58bf('0x3')](_0x58bf('0x16'),_0x48a30c[_0x58bf('0x4')],_0x48a30c[_0x58bf('0x17')]));dials[_0x48a30c['uniqueid']]={'routeId':_0x48a30c['value']};}}catch(_0x1a5264){utils[_0x58bf('0x13')](util[_0x58bf('0x3')](_0x58bf('0x18'),_0x48a30c[_0x58bf('0x4')]),_0x1a5264);}};exports['dialbegin']=function(_0x2d1660){try{if(!_[_0x58bf('0x19')](dials[_0x2d1660['uniqueid']])){utils[_0x58bf('0xb')](util['format']('[%s][dials][dialbegin]',_0x2d1660[_0x58bf('0x4')]),_0x2d1660);dials[_0x2d1660[_0x58bf('0x4')]]=_[_0x58bf('0x1a')](dials[_0x2d1660['uniqueid']],_0x2d1660);dials[_0x2d1660[_0x58bf('0x4')]][_0x58bf('0x1b')]=utils[_0x58bf('0x1c')]();dials[_0x2d1660[_0x58bf('0x4')]][_0x58bf('0x1d')]=_0x58bf('0x1e');utils[_0x58bf('0x1f')](util[_0x58bf('0x3')](_0x58bf('0x20'),_0x2d1660[_0x58bf('0x4')],dials[_0x2d1660[_0x58bf('0x4')]]['starttime']));}}catch(_0x183c5b){utils['error'](util[_0x58bf('0x3')](_0x58bf('0x21'),_0x2d1660[_0x58bf('0x4')]),_0x183c5b);}};exports[_0x58bf('0x22')]=function(_0x2e8849){try{if(!_[_0x58bf('0x19')](dials[_0x2e8849[_0x58bf('0x4')]])){utils[_0x58bf('0xb')](util[_0x58bf('0x3')](_0x58bf('0x23'),_0x2e8849[_0x58bf('0x4')]),_0x2e8849);dials[_0x2e8849[_0x58bf('0x4')]][_0x58bf('0x8')]=_0x2e8849[_0x58bf('0x8')];if(_0x2e8849[_0x58bf('0x8')]==_0x58bf('0x24')){dials[_0x2e8849[_0x58bf('0x4')]]=_['assign'](dials[_0x2e8849[_0x58bf('0x4')]],_0x2e8849);dials[_0x2e8849['uniqueid']]['answertime']=utils[_0x58bf('0x1c')]();dials[_0x2e8849[_0x58bf('0x4')]][_0x58bf('0x1d')]=_0x58bf('0x25');utils[_0x58bf('0x1f')](util[_0x58bf('0x3')](_0x58bf('0x26'),_0x2e8849[_0x58bf('0x4')],_0x2e8849[_0x58bf('0x8')],dials[_0x2e8849[_0x58bf('0x4')]]['answertime']));}else{utils[_0x58bf('0x1f')](util[_0x58bf('0x3')](_0x58bf('0x27'),_0x2e8849[_0x58bf('0x4')],_0x2e8849[_0x58bf('0x8')]));}}}catch(_0x2e0ca7){utils[_0x58bf('0x13')](util[_0x58bf('0x3')]('[%s][dials][dialend]',_0x2e8849[_0x58bf('0x4')]),_0x2e0ca7);}};exports['hangup']=function(_0x357469){try{if(!_[_0x58bf('0x19')](dials[_0x357469['uniqueid']])){utils[_0x58bf('0xb')](util[_0x58bf('0x3')](_0x58bf('0x28'),_0x357469[_0x58bf('0x4')]),_0x357469);utils[_0x58bf('0x1f')](util[_0x58bf('0x3')](_0x58bf('0x29'),_0x357469[_0x58bf('0x4')],_0x357469[_0x58bf('0x6')],_0x357469['calleridname'],_0x357469[_0x58bf('0x2a')]));dials[_0x357469[_0x58bf('0x4')]]=_[_0x58bf('0x1a')](dials[_0x357469[_0x58bf('0x4')]],{'endtime':utils[_0x58bf('0x1c')](),'lastevent':_0x58bf('0x2b')});dials[_0x357469[_0x58bf('0x4')]][_0x58bf('0x2c')]=utils[_0x58bf('0x2d')](dials[_0x357469[_0x58bf('0x4')]][_0x58bf('0x2e')],dials[_0x357469[_0x58bf('0x4')]][_0x58bf('0x1b')]);dials[_0x357469['uniqueid']][_0x58bf('0x2f')]=utils['diffTime'](dials[_0x357469[_0x58bf('0x4')]][_0x58bf('0x30')]||dials[_0x357469[_0x58bf('0x4')]][_0x58bf('0x2e')],dials[_0x357469[_0x58bf('0x4')]]['starttime']);dials[_0x357469[_0x58bf('0x4')]]['billableseconds']=dials[_0x357469[_0x58bf('0x4')]]['answertime']?utils[_0x58bf('0x2d')](dials[_0x357469['uniqueid']][_0x58bf('0x2e')],dials[_0x357469[_0x58bf('0x4')]][_0x58bf('0x30')]):0x0;writeDB(dials[_0x357469['uniqueid']]);}}catch(_0xa78766){utils[_0x58bf('0x13')](util[_0x58bf('0x3')](_0x58bf('0x28'),_0x357469['uniqueid']),_0xa78766);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 425eeaf..9bc4f3e 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 _0x9b14=['port','password','keepConnected','xdr','disabled','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk'];(function(_0xb27cf7,_0x49480e){var _0x411d9e=function(_0x5bc326){while(--_0x5bc326){_0xb27cf7['push'](_0xb27cf7['shift']());}};_0x411d9e(++_0x49480e);}(_0x9b14,0x7b));var _0x49b1=function(_0x221abd,_0x621d76){_0x221abd=_0x221abd-0x0;var _0x47e399=_0x9b14[_0x221abd];return _0x47e399;};var AsteriskManager=require(_0x49b1('0x0'));var config=require(_0x49b1('0x1'));var utils=require(_0x49b1('0x2'));var util=require(_0x49b1('0x3'));var ami=new AsteriskManager(config[_0x49b1('0x4')][_0x49b1('0x5')],config[_0x49b1('0x4')]['ip'],config['asterisk']['username'],config[_0x49b1('0x4')][_0x49b1('0x6')],!![]);ami[_0x49b1('0x7')]();if(config[_0x49b1('0x8')]&&config[_0x49b1('0x8')][_0x49b1('0x9')]){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0x49b1('0xa'));var calls=require('./calls.controller');var queues=require(_0x49b1('0xb'));var recordings=require(_0x49b1('0xc'));var members=require(_0x49b1('0xd'));var dials=require('./dials.controller');var transfers=require(_0x49b1('0xe'));var core=require(_0x49b1('0xf'));ami['on']('connect',core[_0x49b1('0x10')]);ami['on'](_0x49b1('0x11'),core[_0x49b1('0x11')]);ami['on'](_0x49b1('0x12'),core[_0x49b1('0x12')]);ami['on'](_0x49b1('0x13'),core['error']);ami['on'](_0x49b1('0x14'),core[_0x49b1('0x14')]);ami['on'](_0x49b1('0x15'),core[_0x49b1('0x15')]);ami['on'](_0x49b1('0x16'),function(_0x584ad0){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')](_0x49b1('0x19'),_0x584ad0[_0x49b1('0x1a')]),_0x584ad0);members[_0x49b1('0x16')](_0x584ad0);}catch(_0x38fbd6){utils[_0x49b1('0x13')](util['format']('[%s][index][devicestatechange]',_0x584ad0[_0x49b1('0x1a')]),_0x38fbd6);}});ami['on']('agentcalled',function(_0x1192fc){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')](_0x49b1('0x1b'),_0x1192fc[_0x49b1('0x1c')]),_0x1192fc);agents[_0x49b1('0x1d')](_0x1192fc);}catch(_0x113d90){utils[_0x49b1('0x13')](util[_0x49b1('0x18')](_0x49b1('0x1b'),_0x1192fc['uniqueid']),_0x113d90);}});ami['on']('agentringnoanswer',function(_0x3ca2d7){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')](_0x49b1('0x1e'),_0x3ca2d7[_0x49b1('0x1c')]),_0x3ca2d7);agents[_0x49b1('0x1f')](_0x3ca2d7);}catch(_0x530543){utils['error'](util[_0x49b1('0x18')](_0x49b1('0x1e'),_0x3ca2d7[_0x49b1('0x1c')]),_0x530543);}});ami['on']('agentconnect',function(_0x57d468){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')](_0x49b1('0x20'),_0x57d468[_0x49b1('0x1c')]),_0x57d468);agents[_0x49b1('0x21')](_0x57d468);queues[_0x49b1('0x21')](_0x57d468);}catch(_0x2bd663){utils['error'](util[_0x49b1('0x18')](_0x49b1('0x20'),_0x57d468['uniqueid']),_0x2bd663);}});ami['on']('agentcomplete',function(_0x361485){try{utils[_0x49b1('0x17')](util['format'](_0x49b1('0x22'),_0x361485[_0x49b1('0x1c')]),_0x361485);agents[_0x49b1('0x23')](_0x361485);queues[_0x49b1('0x23')](_0x361485);members[_0x49b1('0x23')](_0x361485);}catch(_0x38557d){utils[_0x49b1('0x13')](util[_0x49b1('0x18')](_0x49b1('0x22'),_0x361485[_0x49b1('0x1c')]),_0x38557d);}});ami['on'](_0x49b1('0x24'),function(_0x4af2b1){try{utils['debug'](util[_0x49b1('0x18')](_0x49b1('0x25'),_0x4af2b1['uniqueid']),_0x4af2b1);agents[_0x49b1('0x24')](_0x4af2b1);queues[_0x49b1('0x24')](_0x4af2b1);}catch(_0xcd21e1){utils[_0x49b1('0x13')](util['format']('[%s][index][queuecallerabandon]',_0x4af2b1[_0x49b1('0x1c')]),_0xcd21e1);}});ami['on']('queuecallerjoin',function(_0x277d3a){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')](_0x49b1('0x26'),_0x277d3a[_0x49b1('0x1c')]),_0x277d3a);queues[_0x49b1('0x27')](_0x277d3a);recordings['queuecallerjoin'](_0x277d3a);}catch(_0x4283c0){utils[_0x49b1('0x13')](util['format'](_0x49b1('0x26'),_0x277d3a['uniqueid']),_0x4283c0);}});ami['on'](_0x49b1('0x28'),function(_0x30aae0){try{utils['debug'](util['format'](_0x49b1('0x29'),_0x30aae0[_0x49b1('0x1c')]),_0x30aae0);queues[_0x49b1('0x28')](_0x30aae0);}catch(_0xfeaac9){utils[_0x49b1('0x13')](util['format'](_0x49b1('0x29'),_0x30aae0[_0x49b1('0x1c')]),_0xfeaac9);}});ami['on'](_0x49b1('0x2a'),function(_0x21e864){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')](_0x49b1('0x2b'),_0x21e864[_0x49b1('0x1c')]),_0x21e864);queues[_0x49b1('0x2a')](_0x21e864);calls[_0x49b1('0x2a')](_0x21e864);}catch(_0xf3d698){utils[_0x49b1('0x13')](util[_0x49b1('0x18')](_0x49b1('0x2b'),_0x21e864[_0x49b1('0x1c')]),_0xf3d698);}});ami['on'](_0x49b1('0x2c'),function(_0x1d38d4){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')](_0x49b1('0x2d'),_0x1d38d4[_0x49b1('0x1c')]),_0x1d38d4);queues[_0x49b1('0x2c')](_0x1d38d4);calls['musiconholdstop'](_0x1d38d4);}catch(_0x1f460c){utils[_0x49b1('0x13')](util['format']('[%s][index][musiconholdstop]',_0x1d38d4['uniqueid']),_0x1f460c);}});ami['on'](_0x49b1('0x2e'),function(_0x5f4abd){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')]('[%s][index][newstate]',_0x5f4abd[_0x49b1('0x1c')]),_0x5f4abd);calls['newstate'](_0x5f4abd);recordings[_0x49b1('0x2e')](_0x5f4abd);}catch(_0x50baba){utils[_0x49b1('0x13')](util[_0x49b1('0x18')]('[%s][index][newstate]',_0x5f4abd['uniqueid']),_0x50baba);}});ami['on'](_0x49b1('0x2f'),function(_0x14a0b3){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')](_0x49b1('0x30'),_0x14a0b3[_0x49b1('0x1c')]),_0x14a0b3);calls[_0x49b1('0x2f')](_0x14a0b3);recordings[_0x49b1('0x2f')](_0x14a0b3);dials['hangup'](_0x14a0b3);agents['hangup'](_0x14a0b3);queues[_0x49b1('0x2f')](_0x14a0b3);}catch(_0x3d6714){utils[_0x49b1('0x13')](util[_0x49b1('0x18')](_0x49b1('0x30'),_0x14a0b3[_0x49b1('0x1c')]),_0x3d6714);}});ami['on'](_0x49b1('0x31'),function(_0x5accf3){try{utils[_0x49b1('0x17')](util['format'](_0x49b1('0x32'),_0x5accf3[_0x49b1('0x1c')]),_0x5accf3);members[_0x49b1('0x31')](_0x5accf3);}catch(_0x45ac1f){utils[_0x49b1('0x13')](util[_0x49b1('0x18')]('[%s][index][cdr]',_0x5accf3[_0x49b1('0x1c')]),_0x45ac1f);}});ami['on']('blindtransfer',function(_0x3d1f16){try{utils[_0x49b1('0x17')](util['format'](_0x49b1('0x33'),_0x3d1f16['uniqueid']),_0x3d1f16);queues['blindtransfer'](_0x3d1f16);agents[_0x49b1('0x34')](_0x3d1f16);transfers[_0x49b1('0x34')](_0x3d1f16);}catch(_0x3470b8){utils[_0x49b1('0x13')](util[_0x49b1('0x18')](_0x49b1('0x33'),_0x3d1f16['uniqueid']),_0x3470b8);}});ami['on'](_0x49b1('0x35'),function(_0x44d1f0){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')]('[%s][index][attendedtransfer]',_0x44d1f0['origtransfereruniqueid']),_0x44d1f0);queues[_0x49b1('0x35')](_0x44d1f0);transfers[_0x49b1('0x35')](_0x44d1f0);agents['attendedtransfer'](_0x44d1f0);calls[_0x49b1('0x35')](_0x44d1f0);}catch(_0x1f116a){utils[_0x49b1('0x13')](util[_0x49b1('0x18')]('[%s][index][attendedtransfer]',_0x44d1f0[_0x49b1('0x36')]),_0x1f116a);}});ami['on']('varset',function(_0x489781){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')](_0x49b1('0x37'),_0x489781['uniqueid']),_0x489781);queues[_0x49b1('0x38')](_0x489781);recordings[_0x49b1('0x38')](_0x489781);calls['varset'](_0x489781);dials[_0x49b1('0x38')](_0x489781);}catch(_0x17ecc6){utils[_0x49b1('0x13')](util[_0x49b1('0x18')]('[%s][index][varset]',_0x489781[_0x49b1('0x1c')]),_0x17ecc6);}});ami['on'](_0x49b1('0x39'),function(_0x28ec04){try{utils['debug'](util[_0x49b1('0x18')](_0x49b1('0x3a'),_0x28ec04[_0x49b1('0x1c')]),_0x28ec04);calls[_0x49b1('0x39')](_0x28ec04);recordings[_0x49b1('0x39')](_0x28ec04);dials[_0x49b1('0x39')](_0x28ec04);}catch(_0x44df15){utils[_0x49b1('0x13')](util['format'](_0x49b1('0x3a'),_0x28ec04['uniqueid']),_0x44df15);}});ami['on'](_0x49b1('0x3b'),function(_0x148f91){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')](_0x49b1('0x3c'),_0x148f91[_0x49b1('0x1c')]),_0x148f91);calls[_0x49b1('0x3b')](_0x148f91);recordings[_0x49b1('0x3b')](_0x148f91);}catch(_0x5d1d30){utils[_0x49b1('0x13')](util['format']('[%s][index][newchannel]',_0x148f91[_0x49b1('0x1c')]),_0x5d1d30);}});ami['on'](_0x49b1('0x3d'),function(_0x5ccafe){try{utils[_0x49b1('0x17')](util[_0x49b1('0x18')]('[%s][index][dialbegin]',_0x5ccafe[_0x49b1('0x1c')]),_0x5ccafe);dials[_0x49b1('0x3d')](_0x5ccafe);}catch(_0x261713){utils['error'](util[_0x49b1('0x18')]('[%s]dialbegin',_0x5ccafe[_0x49b1('0x1c')]),_0x261713);}});ami['on'](_0x49b1('0x3e'),function(_0x3ddfb8){try{utils['debug'](util['format'](_0x49b1('0x3f'),_0x3ddfb8[_0x49b1('0x1c')]),_0x3ddfb8);dials[_0x49b1('0x3e')](_0x3ddfb8);}catch(_0x2ca138){utils[_0x49b1('0x13')](util[_0x49b1('0x18')]('[%s][index][dialend]',_0x3ddfb8[_0x49b1('0x1c')]),_0x2ca138);}});} \ No newline at end of file +var _0x62b2=['[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','password','keepConnected','xdr','XDR\x20DISABLED','./agents.controller','./queues.controller','./members.controller','./transfers.controller','connect','shutdown','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','debug','[%s][index][agentcalled]','agentcalled','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer'];(function(_0x2dcb99,_0x1bb9e8){var _0x2a739a=function(_0x12d861){while(--_0x12d861){_0x2dcb99['push'](_0x2dcb99['shift']());}};_0x2a739a(++_0x1bb9e8);}(_0x62b2,0x1b8));var _0x262b=function(_0x14fc0a,_0x431a19){_0x14fc0a=_0x14fc0a-0x0;var _0x11df2f=_0x62b2[_0x14fc0a];return _0x11df2f;};var AsteriskManager=require(_0x262b('0x0'));var config=require(_0x262b('0x1'));var utils=require('./utils');var util=require(_0x262b('0x2'));var ami=new AsteriskManager(config[_0x262b('0x3')]['port'],config[_0x262b('0x3')]['ip'],config['asterisk']['username'],config[_0x262b('0x3')][_0x262b('0x4')],!![]);ami[_0x262b('0x5')]();if(config[_0x262b('0x6')]&&config[_0x262b('0x6')]['disabled']){utils['info'](_0x262b('0x7'));}else{var agents=require(_0x262b('0x8'));var calls=require('./calls.controller');var queues=require(_0x262b('0x9'));var recordings=require('./recordings.controller');var members=require(_0x262b('0xa'));var dials=require('./dials.controller');var transfers=require(_0x262b('0xb'));var core=require('./core.controller');ami['on'](_0x262b('0xc'),core[_0x262b('0xc')]);ami['on'](_0x262b('0xd'),core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on']('error',core[_0x262b('0xe')]);ami['on'](_0x262b('0xf'),core[_0x262b('0xf')]);ami['on'](_0x262b('0x10'),core[_0x262b('0x10')]);ami['on'](_0x262b('0x11'),function(_0x5260ca){try{utils['debug'](util[_0x262b('0x12')](_0x262b('0x13'),_0x5260ca[_0x262b('0x14')]),_0x5260ca);members[_0x262b('0x11')](_0x5260ca);}catch(_0x3c815f){utils['error'](util[_0x262b('0x12')](_0x262b('0x13'),_0x5260ca[_0x262b('0x14')]),_0x3c815f);}});ami['on']('agentcalled',function(_0x132e11){try{utils[_0x262b('0x15')](util[_0x262b('0x12')](_0x262b('0x16'),_0x132e11['uniqueid']),_0x132e11);agents[_0x262b('0x17')](_0x132e11);}catch(_0x2ddeca){utils[_0x262b('0xe')](util[_0x262b('0x12')](_0x262b('0x16'),_0x132e11[_0x262b('0x18')]),_0x2ddeca);}});ami['on']('agentringnoanswer',function(_0x4b17d9){try{utils[_0x262b('0x15')](util[_0x262b('0x12')](_0x262b('0x19'),_0x4b17d9[_0x262b('0x18')]),_0x4b17d9);agents[_0x262b('0x1a')](_0x4b17d9);}catch(_0x53b34b){utils['error'](util[_0x262b('0x12')](_0x262b('0x19'),_0x4b17d9[_0x262b('0x18')]),_0x53b34b);}});ami['on'](_0x262b('0x1b'),function(_0x1f4ade){try{utils[_0x262b('0x15')](util[_0x262b('0x12')]('[%s][index][agentconnect]',_0x1f4ade['uniqueid']),_0x1f4ade);agents[_0x262b('0x1b')](_0x1f4ade);queues[_0x262b('0x1b')](_0x1f4ade);}catch(_0x3f8db5){utils['error'](util[_0x262b('0x12')](_0x262b('0x1c'),_0x1f4ade['uniqueid']),_0x3f8db5);}});ami['on'](_0x262b('0x1d'),function(_0x1055e2){try{utils[_0x262b('0x15')](util[_0x262b('0x12')](_0x262b('0x1e'),_0x1055e2[_0x262b('0x18')]),_0x1055e2);agents[_0x262b('0x1d')](_0x1055e2);queues[_0x262b('0x1d')](_0x1055e2);members['agentcomplete'](_0x1055e2);}catch(_0x338637){utils['error'](util[_0x262b('0x12')](_0x262b('0x1e'),_0x1055e2['uniqueid']),_0x338637);}});ami['on'](_0x262b('0x1f'),function(_0x9bb59c){try{utils[_0x262b('0x15')](util[_0x262b('0x12')](_0x262b('0x20'),_0x9bb59c['uniqueid']),_0x9bb59c);agents[_0x262b('0x1f')](_0x9bb59c);queues[_0x262b('0x1f')](_0x9bb59c);}catch(_0x2d5b57){utils['error'](util[_0x262b('0x12')](_0x262b('0x20'),_0x9bb59c[_0x262b('0x18')]),_0x2d5b57);}});ami['on']('queuecallerjoin',function(_0x1eb235){try{utils['debug'](util[_0x262b('0x12')](_0x262b('0x21'),_0x1eb235[_0x262b('0x18')]),_0x1eb235);queues[_0x262b('0x22')](_0x1eb235);recordings['queuecallerjoin'](_0x1eb235);}catch(_0x17b34d){utils[_0x262b('0xe')](util[_0x262b('0x12')]('[%s][index][queuecallerjoin]',_0x1eb235['uniqueid']),_0x17b34d);}});ami['on']('queuecallerleave',function(_0x2ccf41){try{utils[_0x262b('0x15')](util[_0x262b('0x12')]('[%s][index][queuecallerleave]',_0x2ccf41[_0x262b('0x18')]),_0x2ccf41);queues[_0x262b('0x23')](_0x2ccf41);}catch(_0x477018){utils['error'](util[_0x262b('0x12')](_0x262b('0x24'),_0x2ccf41['uniqueid']),_0x477018);}});ami['on']('musiconholdstart',function(_0x165f2a){try{utils[_0x262b('0x15')](util[_0x262b('0x12')](_0x262b('0x25'),_0x165f2a[_0x262b('0x18')]),_0x165f2a);queues[_0x262b('0x26')](_0x165f2a);calls[_0x262b('0x26')](_0x165f2a);}catch(_0x385280){utils[_0x262b('0xe')](util['format'](_0x262b('0x25'),_0x165f2a[_0x262b('0x18')]),_0x385280);}});ami['on'](_0x262b('0x27'),function(_0x215a99){try{utils[_0x262b('0x15')](util[_0x262b('0x12')](_0x262b('0x28'),_0x215a99[_0x262b('0x18')]),_0x215a99);queues[_0x262b('0x27')](_0x215a99);calls[_0x262b('0x27')](_0x215a99);}catch(_0x5dae2b){utils['error'](util[_0x262b('0x12')](_0x262b('0x28'),_0x215a99[_0x262b('0x18')]),_0x5dae2b);}});ami['on'](_0x262b('0x29'),function(_0x5abb67){try{utils['debug'](util['format'](_0x262b('0x2a'),_0x5abb67['uniqueid']),_0x5abb67);calls['newstate'](_0x5abb67);recordings[_0x262b('0x29')](_0x5abb67);}catch(_0x15c66a){utils[_0x262b('0xe')](util[_0x262b('0x12')]('[%s][index][newstate]',_0x5abb67[_0x262b('0x18')]),_0x15c66a);}});ami['on'](_0x262b('0x2b'),function(_0x583014){try{utils[_0x262b('0x15')](util[_0x262b('0x12')](_0x262b('0x2c'),_0x583014['uniqueid']),_0x583014);calls[_0x262b('0x2b')](_0x583014);recordings['hangup'](_0x583014);dials[_0x262b('0x2b')](_0x583014);agents[_0x262b('0x2b')](_0x583014);queues[_0x262b('0x2b')](_0x583014);}catch(_0x87198a){utils[_0x262b('0xe')](util[_0x262b('0x12')](_0x262b('0x2c'),_0x583014[_0x262b('0x18')]),_0x87198a);}});ami['on'](_0x262b('0x2d'),function(_0x29b113){try{utils['debug'](util[_0x262b('0x12')](_0x262b('0x2e'),_0x29b113[_0x262b('0x18')]),_0x29b113);members[_0x262b('0x2d')](_0x29b113);}catch(_0x4191aa){utils[_0x262b('0xe')](util[_0x262b('0x12')](_0x262b('0x2e'),_0x29b113[_0x262b('0x18')]),_0x4191aa);}});ami['on']('blindtransfer',function(_0x4e787c){try{utils[_0x262b('0x15')](util[_0x262b('0x12')]('[%s][index][blindtransfer]',_0x4e787c['uniqueid']),_0x4e787c);queues[_0x262b('0x2f')](_0x4e787c);agents[_0x262b('0x2f')](_0x4e787c);transfers[_0x262b('0x2f')](_0x4e787c);}catch(_0x12565c){utils[_0x262b('0xe')](util[_0x262b('0x12')](_0x262b('0x30'),_0x4e787c[_0x262b('0x18')]),_0x12565c);}});ami['on'](_0x262b('0x31'),function(_0x4dddb1){try{utils[_0x262b('0x15')](util[_0x262b('0x12')](_0x262b('0x32'),_0x4dddb1[_0x262b('0x33')]),_0x4dddb1);queues['attendedtransfer'](_0x4dddb1);transfers['attendedtransfer'](_0x4dddb1);agents[_0x262b('0x31')](_0x4dddb1);calls[_0x262b('0x31')](_0x4dddb1);}catch(_0x2e4bb8){utils[_0x262b('0xe')](util[_0x262b('0x12')]('[%s][index][attendedtransfer]',_0x4dddb1['origtransfereruniqueid']),_0x2e4bb8);}});ami['on'](_0x262b('0x34'),function(_0x8d5c6c){try{utils['debug'](util['format'](_0x262b('0x35'),_0x8d5c6c['uniqueid']),_0x8d5c6c);queues[_0x262b('0x34')](_0x8d5c6c);recordings[_0x262b('0x34')](_0x8d5c6c);calls[_0x262b('0x34')](_0x8d5c6c);dials[_0x262b('0x34')](_0x8d5c6c);}catch(_0x4e2051){utils[_0x262b('0xe')](util[_0x262b('0x12')]('[%s][index][varset]',_0x8d5c6c['uniqueid']),_0x4e2051);}});ami['on'](_0x262b('0x36'),function(_0x41f57b){try{utils['debug'](util[_0x262b('0x12')](_0x262b('0x37'),_0x41f57b['uniqueid']),_0x41f57b);calls[_0x262b('0x36')](_0x41f57b);recordings[_0x262b('0x36')](_0x41f57b);dials[_0x262b('0x36')](_0x41f57b);}catch(_0x215daf){utils[_0x262b('0xe')](util[_0x262b('0x12')](_0x262b('0x37'),_0x41f57b[_0x262b('0x18')]),_0x215daf);}});ami['on'](_0x262b('0x38'),function(_0x17e263){try{utils[_0x262b('0x15')](util['format']('[%s][index][newchannel]',_0x17e263[_0x262b('0x18')]),_0x17e263);calls[_0x262b('0x38')](_0x17e263);recordings[_0x262b('0x38')](_0x17e263);}catch(_0x26fc2e){utils[_0x262b('0xe')](util[_0x262b('0x12')]('[%s][index][newchannel]',_0x17e263['uniqueid']),_0x26fc2e);}});ami['on'](_0x262b('0x39'),function(_0x48a7fd){try{utils[_0x262b('0x15')](util[_0x262b('0x12')]('[%s][index][dialbegin]',_0x48a7fd['uniqueid']),_0x48a7fd);dials[_0x262b('0x39')](_0x48a7fd);}catch(_0x2ed36a){utils[_0x262b('0xe')](util['format'](_0x262b('0x3a'),_0x48a7fd[_0x262b('0x18')]),_0x2ed36a);}});ami['on'](_0x262b('0x3b'),function(_0xbeacd6){try{utils['debug'](util[_0x262b('0x12')]('[%s][index][dialend]',_0xbeacd6[_0x262b('0x18')]),_0xbeacd6);dials['dialend'](_0xbeacd6);}catch(_0x77671e){utils['error'](util[_0x262b('0x12')](_0x262b('0x3c'),_0xbeacd6[_0x262b('0x18')]),_0x77671e);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b6d8fff..3adf7b8 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 _0xd77b=['uniqueid','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','split','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','now','NOT_INUSE','isNil','exitAt','diffTime','agentcomplete','[%s][members][agentcomplete]','queue','cdr','debug','assign','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','[%s][members][cdr]','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xd77b,0xe1));var _0xbd77=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd77b[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var members={};var exclude=[_0xbd77('0x0'),_0xbd77('0x1')];function writeDB(_0x36814d){utils[_0xbd77('0x2')](util[_0xbd77('0x3')](_0xbd77('0x4'),_0x36814d[_0xbd77('0x5')],_0x36814d['interface'],_0x36814d[_0xbd77('0x6')],_0x36814d[_0xbd77('0x7')],_0x36814d[_0xbd77('0x8')],_0x36814d[_0xbd77('0x9')]));if(_0x36814d[_0xbd77('0xa')]){utils[_0xbd77('0xb')](_0x36814d[_0xbd77('0xa')])[_0xbd77('0xc')](function(_0x479433){if(_0x479433){_0x36814d[_0xbd77('0x8')]=_0x479433[_0xbd77('0xd')];_0x36814d['internal']=_0x479433[_0xbd77('0xe')];utils[_0xbd77('0xf')](_0xbd77('0x10'),_0x36814d);}else{utils['getUserByName'](_0x36814d[_0xbd77('0xa')][_0xbd77('0x11')]('/')[0x1])['then'](function(_0x115af5){if(_0x115af5){_0x36814d[_0xbd77('0x8')]=_0x115af5[_0xbd77('0xd')];_0x36814d[_0xbd77('0xe')]=_0x115af5[_0xbd77('0xe')];utils[_0xbd77('0xf')](_0xbd77('0x10'),_0x36814d);}});}})[_0xbd77('0x12')](function(_0x1a8652){utils[_0xbd77('0x13')](util['format'](_0xbd77('0x14'),_0x36814d['uniqueid']),_0x1a8652);});}delete members[_0x36814d['interface']];}function startsWith(_0x169dac,_0x631a5b){return _['some'](_0x169dac,function(_0x126196){return _[_0xbd77('0x15')](_0x631a5b,_0x126196);});}exports[_0xbd77('0x16')]=function(_0x1fabdc){try{utils['debug'](util[_0xbd77('0x3')](_0xbd77('0x17'),members[_0x1fabdc['device']]?members[_0x1fabdc[_0xbd77('0x18')]][_0xbd77('0x5')]:_0x1fabdc[_0xbd77('0x18')]),_0x1fabdc);utils['info'](util[_0xbd77('0x3')](_0xbd77('0x19'),members[_0x1fabdc[_0xbd77('0x18')]]?members[_0x1fabdc[_0xbd77('0x18')]][_0xbd77('0x5')]:_0x1fabdc[_0xbd77('0x18')],_0x1fabdc[_0xbd77('0x1a')],_0x1fabdc[_0xbd77('0x18')]));switch(_0x1fabdc[_0xbd77('0x1a')]){case _0xbd77('0x1b'):case'BUSY':if(!startsWith(exclude,_0x1fabdc[_0xbd77('0x18')])){members[_0x1fabdc['device']]={'channel':'voice','interface':_0x1fabdc['device'],'type':'TALKING','enterAt':utils[_0xbd77('0x1c')](),'role':'agent'};}break;case _0xbd77('0x1d'):if(!_[_0xbd77('0x1e')](members[_0x1fabdc[_0xbd77('0x18')]])){members[_0x1fabdc[_0xbd77('0x18')]][_0xbd77('0x1f')]=utils[_0xbd77('0x1c')]();members[_0x1fabdc[_0xbd77('0x18')]]['duration']=utils[_0xbd77('0x20')](members[_0x1fabdc[_0xbd77('0x18')]][_0xbd77('0x1f')],members[_0x1fabdc[_0xbd77('0x18')]]['enterAt']);if(members[_0x1fabdc[_0xbd77('0x18')]][_0xbd77('0x5')]){writeDB(members[_0x1fabdc[_0xbd77('0x18')]]);}}break;default:break;}}catch(_0x3af073){utils['error'](util['format'](_0xbd77('0x17'),members[_0x1fabdc[_0xbd77('0x18')]]?members[_0x1fabdc[_0xbd77('0x18')]][_0xbd77('0x5')]:_0x1fabdc[_0xbd77('0x18')]),_0x3af073);}};exports[_0xbd77('0x21')]=function(_0x399a96){try{if(!_[_0xbd77('0x1e')](members[_0x399a96[_0xbd77('0xa')]])){utils['debug'](util[_0xbd77('0x3')](_0xbd77('0x22'),_0x399a96[_0xbd77('0x5')]),_0x399a96);utils[_0xbd77('0x2')](util[_0xbd77('0x3')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x399a96[_0xbd77('0x5')],_0x399a96['interface'],_0x399a96[_0xbd77('0x23')]));members[_0x399a96[_0xbd77('0xa')]]=_['assign'](members[_0x399a96[_0xbd77('0xa')]],{'data4':_0x399a96['queue'],'uniqueid':_0x399a96[_0xbd77('0x5')]});}}catch(_0x5364ca){utils[_0xbd77('0x13')](util['format'](_0xbd77('0x22'),_0x399a96['uniqueid']),_0x5364ca);}};exports[_0xbd77('0x24')]=function(_0x380380){try{utils[_0xbd77('0x25')](util[_0xbd77('0x3')]('[%s][members][cdr]',_0x380380[_0xbd77('0x5')]),_0x380380);if(_0x380380[_0xbd77('0x6')]){var _0x219ba6=_0x380380[_0xbd77('0x6')][_0xbd77('0x11')]('-')[0x0];if(!_['isNil'](members[_0x219ba6])){members[_0x219ba6]=_[_0xbd77('0x26')](members[_0x219ba6],{'data1':members[_0x219ba6][_0xbd77('0x27')]||_0x380380[_0xbd77('0x9')],'data2':members[_0x219ba6][_0xbd77('0x7')]||_0x380380[_0xbd77('0x28')],'data3':members[_0x219ba6]['data3']||_0x380380[_0xbd77('0x29')],'uniqueid':members[_0x219ba6][_0xbd77('0x5')]||_0x380380[_0xbd77('0x5')]});utils[_0xbd77('0x2')](util[_0xbd77('0x3')](_0xbd77('0x2a'),_0x380380['uniqueid'],members[_0x219ba6][_0xbd77('0x27')],members[_0x219ba6]['data2'],members[_0x219ba6][_0xbd77('0x2b')]));if(members[_0x219ba6][_0xbd77('0x1f')]){writeDB(members[_0x219ba6]);}}}if(_0x380380['destinationchannel']){var _0x1f161c=_0x380380[_0xbd77('0x2c')]['split']('-')[0x0];if(!_['isNil'](members[_0x1f161c])){members[_0x1f161c]=_[_0xbd77('0x26')](members[_0x1f161c],{'data1':members[_0x1f161c]['data1']||_0x380380[_0xbd77('0x9')],'data2':members[_0x1f161c][_0xbd77('0x7')]||_0x380380[_0xbd77('0x28')],'data3':members[_0x1f161c]['data3']||_0x380380[_0xbd77('0x29')],'uniqueid':members[_0x1f161c]['uniqueid']||_0x380380[_0xbd77('0x5')]});utils[_0xbd77('0x2')](util[_0xbd77('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x380380[_0xbd77('0x5')],members[_0x1f161c]['data1'],members[_0x1f161c]['data2'],members[_0x1f161c][_0xbd77('0x2b')]));if(members[_0x1f161c]['exitAt']){writeDB(members[_0x1f161c]);}}}}catch(_0x4be4de){utils[_0xbd77('0x13')](util['format'](_0xbd77('0x2d'),_0x380380[_0xbd77('0x5')]),_0x4be4de);}}; \ No newline at end of file +var _0x2f47=['destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','state','INUSE','BUSY','voice','TALKING','NOT_INUSE','isNil','now','duration','diffTime','exitAt','enterAt','[%s][members][agentcomplete]','assign','queue','cdr','data1','source','data3'];(function(_0x5c4dfc,_0x1762bc){var _0x2a4096=function(_0x2cfada){while(--_0x2cfada){_0x5c4dfc['push'](_0x5c4dfc['shift']());}};_0x2a4096(++_0x1762bc);}(_0x2f47,0x107));var _0x72f4=function(_0xb6e90b,_0x598cdd){_0xb6e90b=_0xb6e90b-0x0;var _0x2a5b7d=_0x2f47[_0xb6e90b];return _0x2a5b7d;};'use strict';var _=require(_0x72f4('0x0'));var util=require(_0x72f4('0x1'));var utils=require(_0x72f4('0x2'));var members={};var exclude=[_0x72f4('0x3'),_0x72f4('0x4')];function writeDB(_0x3af4fb){utils[_0x72f4('0x5')](util[_0x72f4('0x6')](_0x72f4('0x7'),_0x3af4fb['uniqueid'],_0x3af4fb['interface'],_0x3af4fb[_0x72f4('0x8')],_0x3af4fb[_0x72f4('0x9')],_0x3af4fb[_0x72f4('0xa')],_0x3af4fb[_0x72f4('0xb')]));if(_0x3af4fb[_0x72f4('0xc')]){utils[_0x72f4('0xd')](_0x3af4fb[_0x72f4('0xc')])[_0x72f4('0xe')](function(_0xfef841){if(_0xfef841){_0x3af4fb[_0x72f4('0xa')]=_0xfef841[_0x72f4('0xf')];_0x3af4fb[_0x72f4('0x10')]=_0xfef841[_0x72f4('0x10')];utils[_0x72f4('0x11')](_0x72f4('0x12'),_0x3af4fb);}else{utils[_0x72f4('0x13')](_0x3af4fb['interface'][_0x72f4('0x14')]('/')[0x1])[_0x72f4('0xe')](function(_0x31633c){if(_0x31633c){_0x3af4fb[_0x72f4('0xa')]=_0x31633c['name'];_0x3af4fb[_0x72f4('0x10')]=_0x31633c[_0x72f4('0x10')];utils[_0x72f4('0x11')]('CreateMemberReport',_0x3af4fb);}});}})['catch'](function(_0x3961f7){utils[_0x72f4('0x15')](util[_0x72f4('0x6')](_0x72f4('0x16'),_0x3af4fb['uniqueid']),_0x3961f7);});}delete members[_0x3af4fb['interface']];}function startsWith(_0xd405b3,_0xbd5e0e){return _[_0x72f4('0x17')](_0xd405b3,function(_0x32e4fe){return _[_0x72f4('0x18')](_0xbd5e0e,_0x32e4fe);});}exports[_0x72f4('0x19')]=function(_0xf6686c){try{utils[_0x72f4('0x1a')](util[_0x72f4('0x6')](_0x72f4('0x1b'),members[_0xf6686c[_0x72f4('0x1c')]]?members[_0xf6686c[_0x72f4('0x1c')]]['uniqueid']:_0xf6686c[_0x72f4('0x1c')]),_0xf6686c);utils[_0x72f4('0x5')](util[_0x72f4('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0xf6686c[_0x72f4('0x1c')]]?members[_0xf6686c[_0x72f4('0x1c')]][_0x72f4('0x1d')]:_0xf6686c[_0x72f4('0x1c')],_0xf6686c[_0x72f4('0x1e')],_0xf6686c[_0x72f4('0x1c')]));switch(_0xf6686c[_0x72f4('0x1e')]){case _0x72f4('0x1f'):case _0x72f4('0x20'):if(!startsWith(exclude,_0xf6686c[_0x72f4('0x1c')])){members[_0xf6686c[_0x72f4('0x1c')]]={'channel':_0x72f4('0x21'),'interface':_0xf6686c[_0x72f4('0x1c')],'type':_0x72f4('0x22'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x72f4('0x23'):if(!_[_0x72f4('0x24')](members[_0xf6686c[_0x72f4('0x1c')]])){members[_0xf6686c['device']]['exitAt']=utils[_0x72f4('0x25')]();members[_0xf6686c[_0x72f4('0x1c')]][_0x72f4('0x26')]=utils[_0x72f4('0x27')](members[_0xf6686c[_0x72f4('0x1c')]][_0x72f4('0x28')],members[_0xf6686c['device']][_0x72f4('0x29')]);if(members[_0xf6686c[_0x72f4('0x1c')]]['uniqueid']){writeDB(members[_0xf6686c[_0x72f4('0x1c')]]);}}break;default:break;}}catch(_0x5759e1){utils['error'](util[_0x72f4('0x6')](_0x72f4('0x1b'),members[_0xf6686c[_0x72f4('0x1c')]]?members[_0xf6686c[_0x72f4('0x1c')]][_0x72f4('0x1d')]:_0xf6686c['device']),_0x5759e1);}};exports['agentcomplete']=function(_0x506257){try{if(!_['isNil'](members[_0x506257[_0x72f4('0xc')]])){utils['debug'](util['format'](_0x72f4('0x2a'),_0x506257[_0x72f4('0x1d')]),_0x506257);utils[_0x72f4('0x5')](util[_0x72f4('0x6')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x506257[_0x72f4('0x1d')],_0x506257[_0x72f4('0xc')],_0x506257['queue']));members[_0x506257[_0x72f4('0xc')]]=_[_0x72f4('0x2b')](members[_0x506257[_0x72f4('0xc')]],{'data4':_0x506257[_0x72f4('0x2c')],'uniqueid':_0x506257['uniqueid']});}}catch(_0x5f0b68){utils[_0x72f4('0x15')](util[_0x72f4('0x6')](_0x72f4('0x2a'),_0x506257[_0x72f4('0x1d')]),_0x5f0b68);}};exports[_0x72f4('0x2d')]=function(_0x2d0e55){try{utils[_0x72f4('0x1a')](util[_0x72f4('0x6')]('[%s][members][cdr]',_0x2d0e55[_0x72f4('0x1d')]),_0x2d0e55);if(_0x2d0e55['channel']){var _0x525726=_0x2d0e55['channel'][_0x72f4('0x14')]('-')[0x0];if(!_[_0x72f4('0x24')](members[_0x525726])){members[_0x525726]=_[_0x72f4('0x2b')](members[_0x525726],{'data1':members[_0x525726][_0x72f4('0x2e')]||_0x2d0e55['type'],'data2':members[_0x525726][_0x72f4('0x9')]||_0x2d0e55[_0x72f4('0x2f')],'data3':members[_0x525726][_0x72f4('0x30')]||_0x2d0e55[_0x72f4('0x31')],'uniqueid':members[_0x525726][_0x72f4('0x1d')]||_0x2d0e55['uniqueid']});utils[_0x72f4('0x5')](util[_0x72f4('0x6')](_0x72f4('0x32'),_0x2d0e55[_0x72f4('0x1d')],members[_0x525726][_0x72f4('0x2e')],members[_0x525726][_0x72f4('0x9')],members[_0x525726]['data3']));if(members[_0x525726][_0x72f4('0x28')]){writeDB(members[_0x525726]);}}}if(_0x2d0e55['destinationchannel']){var _0x11ef68=_0x2d0e55['destinationchannel']['split']('-')[0x0];if(!_[_0x72f4('0x24')](members[_0x11ef68])){members[_0x11ef68]=_[_0x72f4('0x2b')](members[_0x11ef68],{'data1':members[_0x11ef68]['data1']||_0x2d0e55['type'],'data2':members[_0x11ef68][_0x72f4('0x9')]||_0x2d0e55[_0x72f4('0x2f')],'data3':members[_0x11ef68][_0x72f4('0x30')]||_0x2d0e55[_0x72f4('0x31')],'uniqueid':members[_0x11ef68][_0x72f4('0x1d')]||_0x2d0e55['uniqueid']});utils[_0x72f4('0x5')](util[_0x72f4('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2d0e55[_0x72f4('0x1d')],members[_0x11ef68][_0x72f4('0x2e')],members[_0x11ef68][_0x72f4('0x9')],members[_0x11ef68][_0x72f4('0x30')]));if(members[_0x11ef68]['exitAt']){writeDB(members[_0x11ef68]);}}}}catch(_0x59711a){utils['error'](util[_0x72f4('0x6')](_0x72f4('0x33'),_0x2d0e55[_0x72f4('0x1d')]),_0x59711a);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 4a799f9..74073ce 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 _0x761c=['calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','error','ABANDONED','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleave','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%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','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferuniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue'];(function(_0x1a59a1,_0x3fa340){var _0x3789bc=function(_0x318d8a){while(--_0x318d8a){_0x1a59a1['push'](_0x1a59a1['shift']());}};_0x3789bc(++_0x3fa340);}(_0x761c,0x18a));var _0xc761=function(_0x48ab84,_0x5b4429){_0x48ab84=_0x48ab84-0x0;var _0x21737d=_0x761c[_0x48ab84];return _0x21737d;};'use strict';var _=require(_0xc761('0x0'));var util=require('util');var utils=require(_0xc761('0x1'));var queues={};function writeDB(_0x351648){utils['info'](util[_0xc761('0x2')](_0xc761('0x3'),_0x351648[_0xc761('0x4')],_0x351648['channel'],_0x351648[_0xc761('0x5')],_0x351648['lastAssignedTo'],_0x351648[_0xc761('0x6')],_0x351648[_0xc761('0x7')],_0x351648[_0xc761('0x8')]));if(_0x351648[_0xc761('0x5')]){utils[_0xc761('0x9')](_0x351648[_0xc761('0x5')])[_0xc761('0xa')](function(_0x507772){if(_0x507772){_0x351648[_0xc761('0xb')]=_0x507772[_0xc761('0xb')];}utils[_0xc761('0xc')](_0xc761('0xd'),_0x351648);});}else{utils[_0xc761('0xc')](_0xc761('0xd'),_0x351648);}if(_0x351648[_0xc761('0xe')]){delete queues[_0x351648['transfereduniqueid']];}else{delete queues[_0x351648['uniqueid']];}}exports[_0xc761('0xf')]=function(_0x4405a2){try{utils['debug'](util['format'](_0xc761('0x10'),_0x4405a2['uniqueid']),_0x4405a2);utils[_0xc761('0x11')](util['format'](_0xc761('0x12'),_0x4405a2['uniqueid'],_0x4405a2[_0xc761('0x5')],_0x4405a2[_0xc761('0x13')]));queues[_0x4405a2[_0xc761('0x4')]]=_[_0xc761('0x14')](_0x4405a2,{'originalposition':_0x4405a2[_0xc761('0x13')],'queuecallerjoinAt':utils[_0xc761('0x15')](),'mohtime':0x0});}catch(_0x21384f){utils['error'](util['format'](_0xc761('0x10'),_0x4405a2[_0xc761('0x4')]),_0x21384f);}};exports[_0xc761('0x16')]=function(_0x597085){try{if(!_[_0xc761('0x17')](queues[_0x597085[_0xc761('0x4')]])){utils[_0xc761('0x18')](util[_0xc761('0x2')](_0xc761('0x19'),_0x597085['uniqueid']),_0x597085);if(queues[_0x597085['uniqueid']][_0xc761('0x1a')]){if(!queues[_0x597085[_0xc761('0x4')]]['queuecallerabandon']&&!queues[_0x597085['uniqueid']][_0xc761('0x1b')]){queues[_0x597085[_0xc761('0x4')]][_0xc761('0x1c')]=!![];queues[_0x597085[_0xc761('0x4')]][_0xc761('0x1d')]=utils['now']();queues[_0x597085[_0xc761('0x4')]][_0xc761('0x8')]=_0xc761('0x1e');}utils[_0xc761('0x11')](util[_0xc761('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x597085[_0xc761('0x4')],queues[_0x597085[_0xc761('0x4')]][_0xc761('0x1f')],queues[_0x597085[_0xc761('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x597085['uniqueid']]);}else if(queues[_0x597085[_0xc761('0x4')]][_0xc761('0xe')]){utils[_0xc761('0x11')](util[_0xc761('0x2')](_0xc761('0x20'),_0x597085[_0xc761('0x4')],queues[_0x597085[_0xc761('0x4')]][_0xc761('0x1f')],queues[_0x597085['uniqueid']][_0xc761('0xe')]));queues[queues[_0x597085[_0xc761('0x4')]][_0xc761('0xe')]]=queues[_0x597085['uniqueid']];queues[queues[_0x597085['uniqueid']][_0xc761('0xe')]][_0xc761('0x21')]=0x2;delete queues[_0x597085['uniqueid']];}}}catch(_0x4687ec){utils['error'](util[_0xc761('0x2')]('[%s][queues][hangup]',_0x597085['uniqueid']),_0x4687ec);}};exports['varset']=function(_0x1e713e){try{utils[_0xc761('0x18')](util[_0xc761('0x2')](_0xc761('0x22'),_0x1e713e['uniqueid']),_0x1e713e);if(!_[_0xc761('0x17')](_0x1e713e[_0xc761('0x23')][_0xc761('0x24')])&&_0x1e713e[_0xc761('0x25')][_0xc761('0x26')]()!=='CONTINUE'){if(!_[_0xc761('0x17')](queues[_0x1e713e[_0xc761('0x4')]])){queues[_0x1e713e[_0xc761('0x4')]][_0xc761('0x27')]=![];queues[_0x1e713e[_0xc761('0x4')]][_0xc761('0x28')]=null;queues[_0x1e713e[_0xc761('0x4')]][_0xc761('0x1b')]=!![];queues[_0x1e713e[_0xc761('0x4')]][_0xc761('0x29')]=utils['now']();queues[_0x1e713e[_0xc761('0x4')]][_0xc761('0x8')]=_0x1e713e['value']['toUpperCase']();utils[_0xc761('0x11')](util[_0xc761('0x2')](_0xc761('0x2a'),_0x1e713e['uniqueid'],queues[_0x1e713e['uniqueid']]['name'],_0x1e713e[_0xc761('0x25')],queues[_0x1e713e[_0xc761('0x4')]][_0xc761('0x8')]));writeDB(queues[_0x1e713e[_0xc761('0x4')]]);}}else if(!_['isNil'](_0x1e713e[_0xc761('0x23')]['queueposition'])){if(!_['isNil'](queues[_0x1e713e[_0xc761('0x4')]])&&!queues[_0x1e713e[_0xc761('0x4')]][_0xc761('0x27')]){queues[_0x1e713e['uniqueid']][_0xc761('0x27')]=![];queues[_0x1e713e[_0xc761('0x4')]][_0xc761('0x28')]=null;queues[_0x1e713e['uniqueid']][_0xc761('0x1b')]=!![];queues[_0x1e713e[_0xc761('0x4')]][_0xc761('0x29')]=utils['now']();queues[_0x1e713e[_0xc761('0x4')]][_0xc761('0x8')]='EXITWITHKEY';utils[_0xc761('0x11')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x1e713e[_0xc761('0x4')],queues[_0x1e713e[_0xc761('0x4')]][_0xc761('0x1f')],_0x1e713e[_0xc761('0x25')],queues[_0x1e713e['uniqueid']]['queuecallerexitreason']));}}}catch(_0x3ac3cc){utils[_0xc761('0x2b')](util[_0xc761('0x2')](_0xc761('0x22'),_0x1e713e[_0xc761('0x4')]),_0x3ac3cc);}};exports[_0xc761('0x27')]=function(_0x5783c7){try{if(!_[_0xc761('0x17')](queues[_0x5783c7[_0xc761('0x4')]])){utils[_0xc761('0x18')](util[_0xc761('0x2')]('[%s][queues][queuecallerabandon]',_0x5783c7['uniqueid']),_0x5783c7);queues[_0x5783c7[_0xc761('0x4')]][_0xc761('0x1b')]=![];queues[_0x5783c7['uniqueid']][_0xc761('0x29')]=null;queues[_0x5783c7[_0xc761('0x4')]][_0xc761('0x27')]=!![];queues[_0x5783c7[_0xc761('0x4')]][_0xc761('0x28')]=utils['now']();queues[_0x5783c7[_0xc761('0x4')]][_0xc761('0x8')]=_0xc761('0x2c');utils['info'](util[_0xc761('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5783c7['uniqueid'],queues[_0x5783c7['uniqueid']][_0xc761('0x1f')],queues[_0x5783c7[_0xc761('0x4')]]['queuecallerexitreason']));}}catch(_0x22d58d){utils[_0xc761('0x2b')](util[_0xc761('0x2')](_0xc761('0x2d'),_0x5783c7[_0xc761('0x4')]),_0x22d58d);}};exports['queuecallerleave']=function(_0xe14a5d){try{if(!_[_0xc761('0x17')](queues[_0xe14a5d[_0xc761('0x4')]])){utils[_0xc761('0x18')](util[_0xc761('0x2')](_0xc761('0x2e'),_0xe14a5d[_0xc761('0x4')]),_0xe14a5d);utils[_0xc761('0x11')](util[_0xc761('0x2')](_0xc761('0x2f'),_0xe14a5d[_0xc761('0x4')],queues[_0xe14a5d[_0xc761('0x4')]]['name'],_0xe14a5d[_0xc761('0x30')],_0xe14a5d['connectedlinename']));queues[_0xe14a5d['uniqueid']][_0xc761('0x31')]=!![];queues[_0xe14a5d[_0xc761('0x4')]][_0xc761('0x1a')]=utils['now']();queues[_0xe14a5d['uniqueid']][_0xc761('0x32')]=utils[_0xc761('0x33')](queues[_0xe14a5d['uniqueid']][_0xc761('0x1a')],queues[_0xe14a5d['uniqueid']]['queuecallerjoinAt']);queues[_0xe14a5d['uniqueid']]['position']=_0xe14a5d[_0xc761('0x13')];queues[_0xe14a5d[_0xc761('0x4')]][_0xc761('0x34')]=_0xe14a5d[_0xc761('0x34')];queues[_0xe14a5d[_0xc761('0x4')]][_0xc761('0x30')]=_0xe14a5d[_0xc761('0x30')];queues[_0xe14a5d['uniqueid']]['connectedlinename']=_0xe14a5d['connectedlinename'];}}catch(_0x5f229d){utils[_0xc761('0x2b')](util[_0xc761('0x2')](_0xc761('0x2e'),_0xe14a5d[_0xc761('0x4')]),_0x5f229d);}};exports[_0xc761('0x35')]=function(_0x516c76){try{if(!_[_0xc761('0x17')](queues[_0x516c76[_0xc761('0x4')]])){utils[_0xc761('0x18')](util[_0xc761('0x2')](_0xc761('0x36'),_0x516c76[_0xc761('0x4')]),_0x516c76);utils[_0xc761('0x11')](util['format'](_0xc761('0x37'),_0x516c76[_0xc761('0x4')],queues[_0x516c76['uniqueid']]['name'],_0x516c76[_0xc761('0x38')],_0x516c76[_0xc761('0x39')]));queues[_0x516c76[_0xc761('0x4')]]['queuecallerabandon']=![];queues[_0x516c76[_0xc761('0x4')]][_0xc761('0x27')]=![];queues[_0x516c76['uniqueid']][_0xc761('0x28')]=null;queues[_0x516c76[_0xc761('0x4')]]['queuecallerexit']=![];queues[_0x516c76['uniqueid']][_0xc761('0x8')]=null;queues[_0x516c76['uniqueid']]['queuecallerexitAt']=null;queues[_0x516c76[_0xc761('0x4')]][_0xc761('0x3a')]=!![];queues[_0x516c76[_0xc761('0x4')]][_0xc761('0x7')]=_0x516c76['destaccountcode'];queues[_0x516c76['uniqueid']][_0xc761('0x3b')]=_0x516c76[_0xc761('0x38')];}}catch(_0x1f1fe6){utils[_0xc761('0x2b')](util[_0xc761('0x2')](_0xc761('0x36'),_0x516c76[_0xc761('0x4')]),_0x1f1fe6);}};exports['agentcomplete']=function(_0x3db4cc){try{if(!_['isNil'](queues[_0x3db4cc[_0xc761('0x4')]])){if(queues[_0x3db4cc['uniqueid']][_0xc761('0x1a')]){utils[_0xc761('0x18')](util[_0xc761('0x2')](_0xc761('0x3c'),_0x3db4cc[_0xc761('0x4')]),_0x3db4cc);queues[_0x3db4cc[_0xc761('0x4')]]['queuecallerabandon']=![];queues[_0x3db4cc[_0xc761('0x4')]][_0xc761('0x27')]=![];queues[_0x3db4cc[_0xc761('0x4')]][_0xc761('0x28')]=null;queues[_0x3db4cc[_0xc761('0x4')]][_0xc761('0x1b')]=![];queues[_0x3db4cc[_0xc761('0x4')]][_0xc761('0x29')]=null;queues[_0x3db4cc[_0xc761('0x4')]][_0xc761('0x3a')]=!![];queues[_0x3db4cc[_0xc761('0x4')]][_0xc761('0x3b')]=_0x3db4cc[_0xc761('0x38')];queues[_0x3db4cc[_0xc761('0x4')]][_0xc761('0x1c')]=!![];queues[_0x3db4cc['uniqueid']][_0xc761('0x1d')]=utils['now']();if(_0x3db4cc[_0xc761('0x3d')]==_0xc761('0x3e')){if(!queues[_0x3db4cc[_0xc761('0x4')]]['transfer']){queues[_0x3db4cc['uniqueid']]['queuecallerexitreason']=_0xc761('0x3f');}}else{queues[_0x3db4cc[_0xc761('0x4')]]['queuecallerexitreason']=_0xc761('0x40')+_0x3db4cc['reason']['toUpperCase']();}utils['info'](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x3db4cc[_0xc761('0x4')],queues[_0x3db4cc['uniqueid']][_0xc761('0x1f')],_0x3db4cc[_0xc761('0x38')],queues[_0x3db4cc[_0xc761('0x4')]][_0xc761('0x8')]));writeDB(queues[_0x3db4cc['uniqueid']]);}}}catch(_0x2917fd){utils['error'](util[_0xc761('0x2')](_0xc761('0x3c'),_0x3db4cc['uniqueid']),_0x2917fd);}};exports[_0xc761('0x41')]=function(_0x1e2475){try{if(!_[_0xc761('0x17')](queues[_0x1e2475['transfereeuniqueid']])){utils[_0xc761('0x18')](util[_0xc761('0x2')]('[%s][queues][blindtransfer]',_0x1e2475['uniqueid']),_0x1e2475);queues[_0x1e2475[_0xc761('0x42')]]['transfer']=!![];queues[_0x1e2475[_0xc761('0x42')]][_0xc761('0x43')]=_0xc761('0x44');queues[_0x1e2475[_0xc761('0x42')]][_0xc761('0x45')]=_0x1e2475[_0xc761('0x46')];queues[_0x1e2475['transfereeuniqueid']]['transferuniqueid']=_0x1e2475[_0xc761('0x42')];queues[_0x1e2475[_0xc761('0x42')]][_0xc761('0x8')]=_0xc761('0x47');utils[_0xc761('0x11')](util[_0xc761('0x2')](_0xc761('0x48'),_0x1e2475[_0xc761('0x4')],queues[_0x1e2475['transfereeuniqueid']]['name'],_0x1e2475[_0xc761('0x42')],_0x1e2475[_0xc761('0x46')]));}}catch(_0x61d341){utils[_0xc761('0x2b')](util[_0xc761('0x2')]('[%s][queues][blindtransfer]',_0x1e2475[_0xc761('0x4')]),_0x61d341);}};exports[_0xc761('0x49')]=function(_0x44a13f){try{utils[_0xc761('0x18')](util[_0xc761('0x2')](_0xc761('0x4a'),_0x44a13f[_0xc761('0x4b')]),_0x44a13f);if(_0x44a13f[_0xc761('0x4b')]==_0x44a13f[_0xc761('0x4c')]){if(!_[_0xc761('0x17')](queues[_0x44a13f[_0xc761('0x4d')]])){utils[_0xc761('0x11')](util[_0xc761('0x2')](_0xc761('0x4e'),_0x44a13f[_0xc761('0x4b')],queues[_0x44a13f[_0xc761('0x4d')]][_0xc761('0x1f')],_0x44a13f[_0xc761('0x4f')]));queues[_0x44a13f[_0xc761('0x4d')]]['transfer']=!![];queues[_0x44a13f[_0xc761('0x4d')]][_0xc761('0x43')]=_0xc761('0x50');queues[_0x44a13f[_0xc761('0x4d')]][_0xc761('0x45')]=_0x44a13f[_0xc761('0x4f')];queues[_0x44a13f[_0xc761('0x4d')]]['transferuniqueid']=_0x44a13f['origtransfereruniqueid'];queues[_0x44a13f[_0xc761('0x4d')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xc761('0x17')](queues[_0x44a13f[_0xc761('0x4c')]])){if(_0x44a13f[_0xc761('0x51')]&&queues[_0x44a13f[_0xc761('0x51')]]){queues[_0x44a13f[_0xc761('0x51')]][_0xc761('0x21')]=0x1;queues[_0x44a13f[_0xc761('0x42')]]=_[_0xc761('0x52')](queues[_0x44a13f[_0xc761('0x51')]]);queues[_0x44a13f['transfereeuniqueid']][_0xc761('0xe')]=_0x44a13f[_0xc761('0x53')];queues[_0x44a13f[_0xc761('0x42')]][_0xc761('0x21')]=0x2;queues[_0x44a13f[_0xc761('0x42')]][_0xc761('0x6')]=queues[_0x44a13f['secondtransfererlinkedid']][_0xc761('0x6')];queues[_0x44a13f[_0xc761('0x42')]][_0xc761('0x54')]=queues[_0x44a13f[_0xc761('0x4d')]][_0xc761('0x54')];queues[_0x44a13f[_0xc761('0x42')]][_0xc761('0x55')]=utils['now']();queues[_0x44a13f[_0xc761('0x42')]][_0xc761('0x1a')]=utils[_0xc761('0x15')]();queues[_0x44a13f[_0xc761('0x42')]]['holdtime']=0x0;queues[_0x44a13f[_0xc761('0x42')]][_0xc761('0x56')]=0x0;utils[_0xc761('0x11')](util[_0xc761('0x2')](_0xc761('0x57'),_0x44a13f[_0xc761('0x4b')],queues[_0x44a13f[_0xc761('0x42')]][_0xc761('0x1f')],queues[_0x44a13f['transfereeuniqueid']]['calleridnum'],queues[_0x44a13f[_0xc761('0x42')]][_0xc761('0x54')]));}else{utils[_0xc761('0x11')](util[_0xc761('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x44a13f['origtransfereruniqueid'],queues[_0x44a13f[_0xc761('0x4c')]]['name'],_0x44a13f[_0xc761('0x4d')]));queues[_0x44a13f[_0xc761('0x4c')]]['transfereduniqueid']=_0x44a13f[_0xc761('0x4d')];}}}else if(_0x44a13f[_0xc761('0x58')]==_0x44a13f['secondtransfererlinkedid']){if(!_[_0xc761('0x17')](queues[_0x44a13f['origtransfererlinkedid']])){utils[_0xc761('0x11')](util[_0xc761('0x2')](_0xc761('0x59'),_0x44a13f['origtransfereruniqueid'],queues[_0x44a13f[_0xc761('0x4c')]][_0xc761('0x1f')],_0x44a13f[_0xc761('0x58')],_0x44a13f[_0xc761('0x5a')]));queues[_0x44a13f[_0xc761('0x4c')]][_0xc761('0x3e')]=!![];queues[_0x44a13f[_0xc761('0x4c')]][_0xc761('0x43')]=_0xc761('0x50');queues[_0x44a13f[_0xc761('0x4c')]][_0xc761('0x45')]=_0x44a13f[_0xc761('0x5a')];queues[_0x44a13f['origtransfererlinkedid']][_0xc761('0x5b')]=_0x44a13f[_0xc761('0x58')];queues[_0x44a13f[_0xc761('0x4c')]][_0xc761('0x8')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x44a13f[_0xc761('0x4d')]])){if(_0x44a13f['transfertargetlinkedid']&&queues[_0x44a13f[_0xc761('0x5c')]]){queues[_0x44a13f[_0xc761('0x5c')]][_0xc761('0x21')]=0x1;queues[_0x44a13f[_0xc761('0x53')]]=_['clone'](queues[_0x44a13f['transfertargetlinkedid']]);queues[_0x44a13f['transfertargetuniqueid']]['transfereduniqueid']=_0x44a13f[_0xc761('0x53')];queues[_0x44a13f[_0xc761('0x53')]][_0xc761('0x21')]=0x2;queues[_0x44a13f[_0xc761('0x53')]][_0xc761('0x6')]=queues[_0x44a13f[_0xc761('0x4c')]][_0xc761('0x6')];queues[_0x44a13f[_0xc761('0x53')]][_0xc761('0x54')]=queues[_0x44a13f[_0xc761('0x4c')]]['calleridname'];queues[_0x44a13f['transfertargetuniqueid']][_0xc761('0x55')]=utils[_0xc761('0x15')]();queues[_0x44a13f[_0xc761('0x53')]][_0xc761('0x1a')]=utils[_0xc761('0x15')]();queues[_0x44a13f[_0xc761('0x53')]]['holdtime']=0x0;queues[_0x44a13f[_0xc761('0x53')]]['mohtime']=0x0;utils[_0xc761('0x11')](util['format'](_0xc761('0x5d'),_0x44a13f[_0xc761('0x4b')],queues[_0x44a13f['transfertargetuniqueid']][_0xc761('0x1f')],queues[_0x44a13f[_0xc761('0x53')]][_0xc761('0xe')],queues[_0x44a13f['transfertargetuniqueid']]['calleridnum'],queues[_0x44a13f[_0xc761('0x53')]][_0xc761('0x54')]));}else{utils[_0xc761('0x11')](util[_0xc761('0x2')](_0xc761('0x5e'),_0x44a13f['origtransfereruniqueid'],queues[_0x44a13f[_0xc761('0x4d')]][_0xc761('0x1f')],_0x44a13f[_0xc761('0x4c')]));queues[_0x44a13f[_0xc761('0x4d')]][_0xc761('0xe')]=_0x44a13f['origtransfererlinkedid'];}}}}catch(_0x5a73ea){utils[_0xc761('0x2b')](util[_0xc761('0x2')]('[%s][queues][attendedtransfer]',_0x44a13f[_0xc761('0x4b')]),_0x5a73ea);}};exports['musiconholdstart']=function(_0x47f60b){try{if(!_[_0xc761('0x17')](queues[_0x47f60b[_0xc761('0x4')]])){utils[_0xc761('0x18')](util['format']('[%s][queues][musiconholdstart]',_0x47f60b[_0xc761('0x4')]),_0x47f60b);queues[_0x47f60b[_0xc761('0x4')]][_0xc761('0x5f')]=utils[_0xc761('0x15')]();utils[_0xc761('0x11')](util[_0xc761('0x2')](_0xc761('0x60'),_0x47f60b[_0xc761('0x4')],queues[_0x47f60b[_0xc761('0x4')]][_0xc761('0x1f')],queues[_0x47f60b[_0xc761('0x4')]][_0xc761('0x5f')]));}}catch(_0x3a0180){utils[_0xc761('0x2b')](util[_0xc761('0x2')](_0xc761('0x61'),_0x47f60b[_0xc761('0x4')]),_0x3a0180);}};exports['musiconholdstop']=function(_0x56dc32){try{if(!_[_0xc761('0x17')](queues[_0x56dc32[_0xc761('0x4')]])){if(!_[_0xc761('0x17')](queues[_0x56dc32['uniqueid']][_0xc761('0x5f')])){utils[_0xc761('0x18')](util[_0xc761('0x2')](_0xc761('0x62'),_0x56dc32['uniqueid']),_0x56dc32);queues[_0x56dc32[_0xc761('0x4')]][_0xc761('0x56')]+=utils[_0xc761('0x33')](utils[_0xc761('0x15')](),queues[_0x56dc32[_0xc761('0x4')]][_0xc761('0x5f')]);utils[_0xc761('0x11')](util[_0xc761('0x2')](_0xc761('0x63'),_0x56dc32[_0xc761('0x4')],queues[_0x56dc32['uniqueid']][_0xc761('0x1f')],queues[_0x56dc32[_0xc761('0x4')]]['mohtime']));delete queues[_0x56dc32[_0xc761('0x4')]]['musiconholdstartAt'];}}}catch(_0x3bd96a){utils[_0xc761('0x2b')](util[_0xc761('0x2')](_0xc761('0x62'),_0x56dc32[_0xc761('0x4')]),_0x3bd96a);}}; \ No newline at end of file +var _0x3cae=['queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandon','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','accountcode','lastAssignedTo','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','BLINDTRANSFER','[%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','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE'];(function(_0x21a672,_0x16c837){var _0x56eea9=function(_0x53ef05){while(--_0x53ef05){_0x21a672['push'](_0x21a672['shift']());}};_0x56eea9(++_0x16c837);}(_0x3cae,0x117));var _0xe3ca=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x3cae[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0xe3ca('0x0'));var util=require(_0xe3ca('0x1'));var utils=require(_0xe3ca('0x2'));var queues={};function writeDB(_0x15f7fb){utils[_0xe3ca('0x3')](util[_0xe3ca('0x4')](_0xe3ca('0x5'),_0x15f7fb['uniqueid'],_0x15f7fb[_0xe3ca('0x6')],_0x15f7fb[_0xe3ca('0x7')],_0x15f7fb['lastAssignedTo'],_0x15f7fb[_0xe3ca('0x8')],_0x15f7fb['accountcode'],_0x15f7fb[_0xe3ca('0x9')]));if(_0x15f7fb[_0xe3ca('0x7')]){utils[_0xe3ca('0xa')](_0x15f7fb['queue'])[_0xe3ca('0xb')](function(_0x100c20){if(_0x100c20){_0x15f7fb[_0xe3ca('0xc')]=_0x100c20[_0xe3ca('0xc')];}utils[_0xe3ca('0xd')](_0xe3ca('0xe'),_0x15f7fb);});}else{utils[_0xe3ca('0xd')]('CreateVoiceQueueReport',_0x15f7fb);}if(_0x15f7fb[_0xe3ca('0xf')]){delete queues[_0x15f7fb['transfereduniqueid']];}else{delete queues[_0x15f7fb[_0xe3ca('0x10')]];}}exports[_0xe3ca('0x11')]=function(_0x219866){try{utils[_0xe3ca('0x12')](util[_0xe3ca('0x4')]('[%s][queues][queuecallerjoin]',_0x219866['uniqueid']),_0x219866);utils[_0xe3ca('0x3')](util['format'](_0xe3ca('0x13'),_0x219866[_0xe3ca('0x10')],_0x219866['queue'],_0x219866[_0xe3ca('0x14')]));queues[_0x219866[_0xe3ca('0x10')]]=_[_0xe3ca('0x15')](_0x219866,{'originalposition':_0x219866[_0xe3ca('0x14')],'queuecallerjoinAt':utils[_0xe3ca('0x16')](),'mohtime':0x0});}catch(_0x292251){utils[_0xe3ca('0x17')](util[_0xe3ca('0x4')]('[%s][queues][queuecallerjoin]',_0x219866['uniqueid']),_0x292251);}};exports[_0xe3ca('0x18')]=function(_0x4296ae){try{if(!_[_0xe3ca('0x19')](queues[_0x4296ae[_0xe3ca('0x10')]])){utils[_0xe3ca('0x12')](util[_0xe3ca('0x4')]('[%s][queues][hangup]',_0x4296ae[_0xe3ca('0x10')]),_0x4296ae);if(queues[_0x4296ae[_0xe3ca('0x10')]][_0xe3ca('0x1a')]){if(!queues[_0x4296ae['uniqueid']]['queuecallerabandon']&&!queues[_0x4296ae['uniqueid']][_0xe3ca('0x1b')]){queues[_0x4296ae['uniqueid']]['queuecallercomplete']=!![];queues[_0x4296ae[_0xe3ca('0x10')]][_0xe3ca('0x1c')]=utils[_0xe3ca('0x16')]();queues[_0x4296ae[_0xe3ca('0x10')]][_0xe3ca('0x9')]='COMPLETEDBYAGENT';}utils[_0xe3ca('0x3')](util[_0xe3ca('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x4296ae[_0xe3ca('0x10')],queues[_0x4296ae[_0xe3ca('0x10')]][_0xe3ca('0x1d')],queues[_0x4296ae[_0xe3ca('0x10')]][_0xe3ca('0x9')]));writeDB(queues[_0x4296ae[_0xe3ca('0x10')]]);}else if(queues[_0x4296ae[_0xe3ca('0x10')]][_0xe3ca('0xf')]){utils[_0xe3ca('0x3')](util[_0xe3ca('0x4')](_0xe3ca('0x1e'),_0x4296ae['uniqueid'],queues[_0x4296ae[_0xe3ca('0x10')]]['name'],queues[_0x4296ae[_0xe3ca('0x10')]][_0xe3ca('0xf')]));queues[queues[_0x4296ae[_0xe3ca('0x10')]][_0xe3ca('0xf')]]=queues[_0x4296ae['uniqueid']];queues[queues[_0x4296ae['uniqueid']][_0xe3ca('0xf')]][_0xe3ca('0x1f')]=0x2;delete queues[_0x4296ae[_0xe3ca('0x10')]];}}}catch(_0x4ef90f){utils[_0xe3ca('0x17')](util[_0xe3ca('0x4')](_0xe3ca('0x20'),_0x4296ae[_0xe3ca('0x10')]),_0x4ef90f);}};exports['varset']=function(_0x4dd07f){try{utils[_0xe3ca('0x12')](util['format'](_0xe3ca('0x21'),_0x4dd07f['uniqueid']),_0x4dd07f);if(!_['isNil'](_0x4dd07f[_0xe3ca('0x22')][_0xe3ca('0x23')])&&_0x4dd07f[_0xe3ca('0x24')][_0xe3ca('0x25')]()!==_0xe3ca('0x26')){if(!_['isNil'](queues[_0x4dd07f[_0xe3ca('0x10')]])){queues[_0x4dd07f['uniqueid']]['queuecallerabandon']=![];queues[_0x4dd07f[_0xe3ca('0x10')]][_0xe3ca('0x27')]=null;queues[_0x4dd07f[_0xe3ca('0x10')]][_0xe3ca('0x1b')]=!![];queues[_0x4dd07f[_0xe3ca('0x10')]][_0xe3ca('0x28')]=utils[_0xe3ca('0x16')]();queues[_0x4dd07f[_0xe3ca('0x10')]][_0xe3ca('0x9')]=_0x4dd07f[_0xe3ca('0x24')][_0xe3ca('0x25')]();utils[_0xe3ca('0x3')](util['format'](_0xe3ca('0x29'),_0x4dd07f[_0xe3ca('0x10')],queues[_0x4dd07f[_0xe3ca('0x10')]][_0xe3ca('0x1d')],_0x4dd07f[_0xe3ca('0x24')],queues[_0x4dd07f[_0xe3ca('0x10')]]['queuecallerexitreason']));writeDB(queues[_0x4dd07f[_0xe3ca('0x10')]]);}}else if(!_[_0xe3ca('0x19')](_0x4dd07f[_0xe3ca('0x22')][_0xe3ca('0x2a')])){if(!_[_0xe3ca('0x19')](queues[_0x4dd07f[_0xe3ca('0x10')]])&&!queues[_0x4dd07f[_0xe3ca('0x10')]][_0xe3ca('0x2b')]){queues[_0x4dd07f[_0xe3ca('0x10')]]['queuecallerabandon']=![];queues[_0x4dd07f[_0xe3ca('0x10')]][_0xe3ca('0x27')]=null;queues[_0x4dd07f['uniqueid']][_0xe3ca('0x1b')]=!![];queues[_0x4dd07f[_0xe3ca('0x10')]][_0xe3ca('0x28')]=utils['now']();queues[_0x4dd07f[_0xe3ca('0x10')]][_0xe3ca('0x9')]='EXITWITHKEY';utils[_0xe3ca('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4dd07f[_0xe3ca('0x10')],queues[_0x4dd07f[_0xe3ca('0x10')]]['name'],_0x4dd07f[_0xe3ca('0x24')],queues[_0x4dd07f[_0xe3ca('0x10')]][_0xe3ca('0x9')]));}}}catch(_0x399142){utils[_0xe3ca('0x17')](util[_0xe3ca('0x4')](_0xe3ca('0x21'),_0x4dd07f[_0xe3ca('0x10')]),_0x399142);}};exports[_0xe3ca('0x2b')]=function(_0x4cc84a){try{if(!_[_0xe3ca('0x19')](queues[_0x4cc84a[_0xe3ca('0x10')]])){utils[_0xe3ca('0x12')](util[_0xe3ca('0x4')](_0xe3ca('0x2c'),_0x4cc84a[_0xe3ca('0x10')]),_0x4cc84a);queues[_0x4cc84a[_0xe3ca('0x10')]][_0xe3ca('0x1b')]=![];queues[_0x4cc84a[_0xe3ca('0x10')]][_0xe3ca('0x28')]=null;queues[_0x4cc84a[_0xe3ca('0x10')]][_0xe3ca('0x2b')]=!![];queues[_0x4cc84a[_0xe3ca('0x10')]]['queuecallerabandonAt']=utils[_0xe3ca('0x16')]();queues[_0x4cc84a[_0xe3ca('0x10')]]['queuecallerexitreason']=_0xe3ca('0x2d');utils[_0xe3ca('0x3')](util[_0xe3ca('0x4')](_0xe3ca('0x2e'),_0x4cc84a[_0xe3ca('0x10')],queues[_0x4cc84a[_0xe3ca('0x10')]][_0xe3ca('0x1d')],queues[_0x4cc84a[_0xe3ca('0x10')]][_0xe3ca('0x9')]));}}catch(_0x321468){utils[_0xe3ca('0x17')](util['format'](_0xe3ca('0x2c'),_0x4cc84a[_0xe3ca('0x10')]),_0x321468);}};exports['queuecallerleave']=function(_0x5c1344){try{if(!_[_0xe3ca('0x19')](queues[_0x5c1344[_0xe3ca('0x10')]])){utils['debug'](util[_0xe3ca('0x4')](_0xe3ca('0x2f'),_0x5c1344['uniqueid']),_0x5c1344);utils['info'](util[_0xe3ca('0x4')](_0xe3ca('0x30'),_0x5c1344[_0xe3ca('0x10')],queues[_0x5c1344[_0xe3ca('0x10')]][_0xe3ca('0x1d')],_0x5c1344['connectedlinenum'],_0x5c1344[_0xe3ca('0x31')]));queues[_0x5c1344[_0xe3ca('0x10')]][_0xe3ca('0x32')]=!![];queues[_0x5c1344[_0xe3ca('0x10')]][_0xe3ca('0x1a')]=utils[_0xe3ca('0x16')]();queues[_0x5c1344[_0xe3ca('0x10')]][_0xe3ca('0x33')]=utils[_0xe3ca('0x34')](queues[_0x5c1344['uniqueid']]['queuecallerleaveAt'],queues[_0x5c1344['uniqueid']][_0xe3ca('0x35')]);queues[_0x5c1344[_0xe3ca('0x10')]][_0xe3ca('0x14')]=_0x5c1344['position'];queues[_0x5c1344['uniqueid']][_0xe3ca('0x36')]=_0x5c1344[_0xe3ca('0x36')];queues[_0x5c1344[_0xe3ca('0x10')]]['connectedlinenum']=_0x5c1344['connectedlinenum'];queues[_0x5c1344[_0xe3ca('0x10')]]['connectedlinename']=_0x5c1344[_0xe3ca('0x31')];}}catch(_0x23d780){utils[_0xe3ca('0x17')](util[_0xe3ca('0x4')](_0xe3ca('0x2f'),_0x5c1344[_0xe3ca('0x10')]),_0x23d780);}};exports[_0xe3ca('0x37')]=function(_0x1f5d44){try{if(!_[_0xe3ca('0x19')](queues[_0x1f5d44[_0xe3ca('0x10')]])){utils[_0xe3ca('0x12')](util['format'](_0xe3ca('0x38'),_0x1f5d44[_0xe3ca('0x10')]),_0x1f5d44);utils['info'](util[_0xe3ca('0x4')](_0xe3ca('0x39'),_0x1f5d44[_0xe3ca('0x10')],queues[_0x1f5d44[_0xe3ca('0x10')]]['name'],_0x1f5d44['membername'],_0x1f5d44[_0xe3ca('0x3a')]));queues[_0x1f5d44[_0xe3ca('0x10')]][_0xe3ca('0x2b')]=![];queues[_0x1f5d44['uniqueid']][_0xe3ca('0x2b')]=![];queues[_0x1f5d44[_0xe3ca('0x10')]][_0xe3ca('0x27')]=null;queues[_0x1f5d44['uniqueid']][_0xe3ca('0x1b')]=![];queues[_0x1f5d44[_0xe3ca('0x10')]][_0xe3ca('0x9')]=null;queues[_0x1f5d44[_0xe3ca('0x10')]][_0xe3ca('0x28')]=null;queues[_0x1f5d44[_0xe3ca('0x10')]][_0xe3ca('0x3b')]=!![];queues[_0x1f5d44[_0xe3ca('0x10')]][_0xe3ca('0x3c')]=_0x1f5d44['destaccountcode'];queues[_0x1f5d44[_0xe3ca('0x10')]][_0xe3ca('0x3d')]=_0x1f5d44[_0xe3ca('0x3e')];}}catch(_0x3d3186){utils[_0xe3ca('0x17')](util[_0xe3ca('0x4')](_0xe3ca('0x38'),_0x1f5d44['uniqueid']),_0x3d3186);}};exports[_0xe3ca('0x3f')]=function(_0x3bf8c3){try{if(!_['isNil'](queues[_0x3bf8c3[_0xe3ca('0x10')]])){if(queues[_0x3bf8c3[_0xe3ca('0x10')]]['queuecallerleaveAt']){utils['debug'](util[_0xe3ca('0x4')](_0xe3ca('0x40'),_0x3bf8c3[_0xe3ca('0x10')]),_0x3bf8c3);queues[_0x3bf8c3['uniqueid']]['queuecallerabandon']=![];queues[_0x3bf8c3[_0xe3ca('0x10')]]['queuecallerabandon']=![];queues[_0x3bf8c3[_0xe3ca('0x10')]][_0xe3ca('0x27')]=null;queues[_0x3bf8c3[_0xe3ca('0x10')]][_0xe3ca('0x1b')]=![];queues[_0x3bf8c3[_0xe3ca('0x10')]][_0xe3ca('0x28')]=null;queues[_0x3bf8c3[_0xe3ca('0x10')]][_0xe3ca('0x3b')]=!![];queues[_0x3bf8c3[_0xe3ca('0x10')]][_0xe3ca('0x3d')]=_0x3bf8c3['membername'];queues[_0x3bf8c3[_0xe3ca('0x10')]][_0xe3ca('0x41')]=!![];queues[_0x3bf8c3[_0xe3ca('0x10')]][_0xe3ca('0x1c')]=utils[_0xe3ca('0x16')]();if(_0x3bf8c3['reason']==_0xe3ca('0x42')){if(!queues[_0x3bf8c3[_0xe3ca('0x10')]][_0xe3ca('0x42')]){queues[_0x3bf8c3[_0xe3ca('0x10')]][_0xe3ca('0x9')]=_0xe3ca('0x43');}}else{queues[_0x3bf8c3[_0xe3ca('0x10')]][_0xe3ca('0x9')]=_0xe3ca('0x44')+_0x3bf8c3[_0xe3ca('0x45')][_0xe3ca('0x25')]();}utils['info'](util['format'](_0xe3ca('0x46'),_0x3bf8c3['uniqueid'],queues[_0x3bf8c3[_0xe3ca('0x10')]][_0xe3ca('0x1d')],_0x3bf8c3[_0xe3ca('0x3e')],queues[_0x3bf8c3[_0xe3ca('0x10')]]['queuecallerexitreason']));writeDB(queues[_0x3bf8c3[_0xe3ca('0x10')]]);}}}catch(_0x20f68a){utils['error'](util['format'](_0xe3ca('0x40'),_0x3bf8c3[_0xe3ca('0x10')]),_0x20f68a);}};exports[_0xe3ca('0x47')]=function(_0x473de7){try{if(!_[_0xe3ca('0x19')](queues[_0x473de7[_0xe3ca('0x48')]])){utils[_0xe3ca('0x12')](util['format'](_0xe3ca('0x49'),_0x473de7[_0xe3ca('0x10')]),_0x473de7);queues[_0x473de7[_0xe3ca('0x48')]][_0xe3ca('0x42')]=!![];queues[_0x473de7['transfereeuniqueid']]['transfertype']=_0xe3ca('0x4a');queues[_0x473de7[_0xe3ca('0x48')]][_0xe3ca('0x4b')]=_0x473de7[_0xe3ca('0x4c')];queues[_0x473de7[_0xe3ca('0x48')]]['transferuniqueid']=_0x473de7[_0xe3ca('0x48')];queues[_0x473de7[_0xe3ca('0x48')]][_0xe3ca('0x9')]=_0xe3ca('0x4d');utils[_0xe3ca('0x3')](util[_0xe3ca('0x4')](_0xe3ca('0x4e'),_0x473de7[_0xe3ca('0x10')],queues[_0x473de7['transfereeuniqueid']][_0xe3ca('0x1d')],_0x473de7[_0xe3ca('0x48')],_0x473de7[_0xe3ca('0x4c')]));}}catch(_0x330216){utils[_0xe3ca('0x17')](util[_0xe3ca('0x4')]('[%s][queues][blindtransfer]',_0x473de7[_0xe3ca('0x10')]),_0x330216);}};exports[_0xe3ca('0x4f')]=function(_0x3cb361){try{utils['debug'](util[_0xe3ca('0x4')](_0xe3ca('0x50'),_0x3cb361['origtransfereruniqueid']),_0x3cb361);if(_0x3cb361[_0xe3ca('0x51')]==_0x3cb361[_0xe3ca('0x52')]){if(!_[_0xe3ca('0x19')](queues[_0x3cb361[_0xe3ca('0x53')]])){utils[_0xe3ca('0x3')](util['format'](_0xe3ca('0x54'),_0x3cb361[_0xe3ca('0x51')],queues[_0x3cb361['secondtransfererlinkedid']][_0xe3ca('0x1d')],_0x3cb361[_0xe3ca('0x55')]));queues[_0x3cb361['secondtransfererlinkedid']][_0xe3ca('0x42')]=!![];queues[_0x3cb361[_0xe3ca('0x53')]]['transfertype']=_0xe3ca('0x56');queues[_0x3cb361[_0xe3ca('0x53')]][_0xe3ca('0x4b')]=_0x3cb361[_0xe3ca('0x55')];queues[_0x3cb361[_0xe3ca('0x53')]][_0xe3ca('0x57')]=_0x3cb361[_0xe3ca('0x51')];queues[_0x3cb361['secondtransfererlinkedid']]['queuecallerexitreason']=_0xe3ca('0x58');}if(!_[_0xe3ca('0x19')](queues[_0x3cb361[_0xe3ca('0x52')]])){if(_0x3cb361[_0xe3ca('0x59')]&&queues[_0x3cb361['transfereelinkedid']]){queues[_0x3cb361[_0xe3ca('0x59')]]['queuecallerenterreason']=0x1;queues[_0x3cb361[_0xe3ca('0x48')]]=_[_0xe3ca('0x5a')](queues[_0x3cb361[_0xe3ca('0x59')]]);queues[_0x3cb361[_0xe3ca('0x48')]][_0xe3ca('0xf')]=_0x3cb361[_0xe3ca('0x5b')];queues[_0x3cb361[_0xe3ca('0x48')]][_0xe3ca('0x1f')]=0x2;queues[_0x3cb361[_0xe3ca('0x48')]]['calleridnum']=queues[_0x3cb361['secondtransfererlinkedid']]['calleridnum'];queues[_0x3cb361[_0xe3ca('0x48')]]['calleridname']=queues[_0x3cb361[_0xe3ca('0x53')]]['calleridname'];queues[_0x3cb361[_0xe3ca('0x48')]]['queuecallerjoinAt']=utils[_0xe3ca('0x16')]();queues[_0x3cb361[_0xe3ca('0x48')]][_0xe3ca('0x1a')]=utils[_0xe3ca('0x16')]();queues[_0x3cb361['transfereeuniqueid']]['holdtime']=0x0;queues[_0x3cb361[_0xe3ca('0x48')]][_0xe3ca('0x5c')]=0x0;utils[_0xe3ca('0x3')](util[_0xe3ca('0x4')](_0xe3ca('0x5d'),_0x3cb361[_0xe3ca('0x51')],queues[_0x3cb361[_0xe3ca('0x48')]][_0xe3ca('0x1d')],queues[_0x3cb361[_0xe3ca('0x48')]][_0xe3ca('0x8')],queues[_0x3cb361['transfereeuniqueid']][_0xe3ca('0x5e')]));}else{utils[_0xe3ca('0x3')](util[_0xe3ca('0x4')](_0xe3ca('0x5f'),_0x3cb361[_0xe3ca('0x51')],queues[_0x3cb361['origtransfererlinkedid']][_0xe3ca('0x1d')],_0x3cb361[_0xe3ca('0x53')]));queues[_0x3cb361[_0xe3ca('0x52')]][_0xe3ca('0xf')]=_0x3cb361[_0xe3ca('0x53')];}}}else if(_0x3cb361['secondtransfereruniqueid']==_0x3cb361['secondtransfererlinkedid']){if(!_[_0xe3ca('0x19')](queues[_0x3cb361[_0xe3ca('0x52')]])){utils[_0xe3ca('0x3')](util[_0xe3ca('0x4')](_0xe3ca('0x60'),_0x3cb361['origtransfereruniqueid'],queues[_0x3cb361[_0xe3ca('0x52')]][_0xe3ca('0x1d')],_0x3cb361[_0xe3ca('0x61')],_0x3cb361[_0xe3ca('0x62')]));queues[_0x3cb361['origtransfererlinkedid']][_0xe3ca('0x42')]=!![];queues[_0x3cb361[_0xe3ca('0x52')]]['transfertype']=_0xe3ca('0x56');queues[_0x3cb361[_0xe3ca('0x52')]][_0xe3ca('0x4b')]=_0x3cb361[_0xe3ca('0x62')];queues[_0x3cb361['origtransfererlinkedid']][_0xe3ca('0x57')]=_0x3cb361['secondtransfereruniqueid'];queues[_0x3cb361['origtransfererlinkedid']]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x3cb361['secondtransfererlinkedid']])){if(_0x3cb361[_0xe3ca('0x63')]&&queues[_0x3cb361['transfertargetlinkedid']]){queues[_0x3cb361[_0xe3ca('0x63')]][_0xe3ca('0x1f')]=0x1;queues[_0x3cb361[_0xe3ca('0x5b')]]=_[_0xe3ca('0x5a')](queues[_0x3cb361[_0xe3ca('0x63')]]);queues[_0x3cb361[_0xe3ca('0x5b')]][_0xe3ca('0xf')]=_0x3cb361[_0xe3ca('0x5b')];queues[_0x3cb361[_0xe3ca('0x5b')]]['queuecallerenterreason']=0x2;queues[_0x3cb361['transfertargetuniqueid']][_0xe3ca('0x8')]=queues[_0x3cb361[_0xe3ca('0x52')]][_0xe3ca('0x8')];queues[_0x3cb361[_0xe3ca('0x5b')]][_0xe3ca('0x5e')]=queues[_0x3cb361[_0xe3ca('0x52')]][_0xe3ca('0x5e')];queues[_0x3cb361[_0xe3ca('0x5b')]][_0xe3ca('0x35')]=utils[_0xe3ca('0x16')]();queues[_0x3cb361['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0xe3ca('0x16')]();queues[_0x3cb361[_0xe3ca('0x5b')]][_0xe3ca('0x33')]=0x0;queues[_0x3cb361[_0xe3ca('0x5b')]][_0xe3ca('0x5c')]=0x0;utils[_0xe3ca('0x3')](util[_0xe3ca('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x3cb361[_0xe3ca('0x51')],queues[_0x3cb361[_0xe3ca('0x5b')]]['name'],queues[_0x3cb361[_0xe3ca('0x5b')]][_0xe3ca('0xf')],queues[_0x3cb361[_0xe3ca('0x5b')]][_0xe3ca('0x8')],queues[_0x3cb361[_0xe3ca('0x5b')]]['calleridname']));}else{utils[_0xe3ca('0x3')](util[_0xe3ca('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x3cb361[_0xe3ca('0x51')],queues[_0x3cb361[_0xe3ca('0x53')]][_0xe3ca('0x1d')],_0x3cb361['origtransfererlinkedid']));queues[_0x3cb361[_0xe3ca('0x53')]][_0xe3ca('0xf')]=_0x3cb361[_0xe3ca('0x52')];}}}}catch(_0x16e4ce){utils[_0xe3ca('0x17')](util['format']('[%s][queues][attendedtransfer]',_0x3cb361[_0xe3ca('0x51')]),_0x16e4ce);}};exports[_0xe3ca('0x64')]=function(_0x234438){try{if(!_[_0xe3ca('0x19')](queues[_0x234438[_0xe3ca('0x10')]])){utils[_0xe3ca('0x12')](util[_0xe3ca('0x4')]('[%s][queues][musiconholdstart]',_0x234438['uniqueid']),_0x234438);queues[_0x234438['uniqueid']][_0xe3ca('0x65')]=utils[_0xe3ca('0x16')]();utils['info'](util[_0xe3ca('0x4')](_0xe3ca('0x66'),_0x234438[_0xe3ca('0x10')],queues[_0x234438[_0xe3ca('0x10')]][_0xe3ca('0x1d')],queues[_0x234438['uniqueid']][_0xe3ca('0x65')]));}}catch(_0x5764db){utils[_0xe3ca('0x17')](util[_0xe3ca('0x4')](_0xe3ca('0x67'),_0x234438[_0xe3ca('0x10')]),_0x5764db);}};exports['musiconholdstop']=function(_0x345a9d){try{if(!_[_0xe3ca('0x19')](queues[_0x345a9d['uniqueid']])){if(!_['isNil'](queues[_0x345a9d['uniqueid']]['musiconholdstartAt'])){utils[_0xe3ca('0x12')](util[_0xe3ca('0x4')](_0xe3ca('0x68'),_0x345a9d[_0xe3ca('0x10')]),_0x345a9d);queues[_0x345a9d[_0xe3ca('0x10')]][_0xe3ca('0x5c')]+=utils[_0xe3ca('0x34')](utils['now'](),queues[_0x345a9d[_0xe3ca('0x10')]][_0xe3ca('0x65')]);utils[_0xe3ca('0x3')](util[_0xe3ca('0x4')](_0xe3ca('0x69'),_0x345a9d[_0xe3ca('0x10')],queues[_0x345a9d[_0xe3ca('0x10')]][_0xe3ca('0x1d')],queues[_0x345a9d[_0xe3ca('0x10')]][_0xe3ca('0x5c')]));delete queues[_0x345a9d[_0xe3ca('0x10')]][_0xe3ca('0x65')];}}}catch(_0xa18275){utils[_0xe3ca('0x17')](util['format'](_0xe3ca('0x68'),_0x345a9d[_0xe3ca('0x10')]),_0xa18275);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index bd691d9..40322de 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 _0x161b=['[%s][recordings][varset]','endsWith','.wav49','value','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','getUserByInternal','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename'];(function(_0x6ff984,_0x52fbd1){var _0x1b8400=function(_0x15ce8c){while(--_0x15ce8c){_0x6ff984['push'](_0x6ff984['shift']());}};_0x1b8400(++_0x52fbd1);}(_0x161b,0x18e));var _0xb161=function(_0x2f8ec7,_0x35b26a){_0x2f8ec7=_0x2f8ec7-0x0;var _0x209395=_0x161b[_0x2f8ec7];return _0x209395;};'use strict';var _=require(_0xb161('0x0'));var util=require(_0xb161('0x1'));var utils=require(_0xb161('0x2'));var recordings={};function writeDB(_0x24a32a){utils[_0xb161('0x3')](util[_0xb161('0x4')]('[%s][recordings][writeDB]',_0x24a32a[_0xb161('0x5')]));if(_0x24a32a['accountcode']){utils[_0xb161('0x6')](_0x24a32a['accountcode'])['then'](function(_0x45df3d){if(_0x45df3d){_0x24a32a['membername']=_0x45df3d[_0xb161('0x7')];_0x24a32a['UserId']=_0x45df3d['id'];}utils[_0xb161('0x8')](_0xb161('0x9'),_0x24a32a);});}else{utils[_0xb161('0x8')](_0xb161('0x9'),_0x24a32a);}}exports[_0xb161('0xa')]=function(_0x51ebf6){try{utils[_0xb161('0xb')](util[_0xb161('0x4')](_0xb161('0xc'),_0x51ebf6[_0xb161('0x5')]),_0x51ebf6);if(_0x51ebf6[_0xb161('0x5')]==_0x51ebf6['linkedid']){utils[_0xb161('0x3')](util[_0xb161('0x4')](_0xb161('0xd'),_0x51ebf6[_0xb161('0x5')],_0x51ebf6[_0xb161('0xe')],_0x51ebf6[_0xb161('0xf')]));recordings[_0x51ebf6[_0xb161('0x5')]]={'uniqueid':_0x51ebf6[_0xb161('0x5')],'accountcode':_0x51ebf6[_0xb161('0x10')],'exten':_0x51ebf6['exten'],'context':_0x51ebf6[_0xb161('0xe')],'channel':_0x51ebf6[_0xb161('0x11')],'monitors':[]};}}catch(_0x1f4777){utils[_0xb161('0x12')](util[_0xb161('0x4')](_0xb161('0xc'),_0x51ebf6['uniqueid']),_0x1f4777);}};exports[_0xb161('0x13')]=function(_0x191cac){try{utils[_0xb161('0xb')](util[_0xb161('0x4')](_0xb161('0x14'),_0x191cac['uniqueid']),_0x191cac);if(!_[_0xb161('0x15')](recordings[_0x191cac['uniqueid']])&&_0x191cac[_0xb161('0x16')]==0x6){utils[_0xb161('0x3')](util[_0xb161('0x4')](_0xb161('0x17'),_0x191cac[_0xb161('0x5')],_0x191cac[_0xb161('0xe')],_0x191cac['channel']));}else if(!_[_0xb161('0x15')](recordings[_0x191cac[_0xb161('0x18')]])&&_0x191cac[_0xb161('0x16')]==0x6&&_0x191cac[_0xb161('0xe')]!=_0xb161('0x19')){utils[_0xb161('0x3')](util[_0xb161('0x4')](_0xb161('0x1a'),_0x191cac['uniqueid'],_0x191cac['linkedid'],_0x191cac[_0xb161('0xe')],_0x191cac[_0xb161('0x11')]));recordings[_0x191cac[_0xb161('0x18')]][_0xb161('0x10')]=_0x191cac[_0xb161('0x10')];}}catch(_0x3202aa){utils[_0xb161('0x12')](util['format'](_0xb161('0x14'),_0x191cac[_0xb161('0x5')]),_0x3202aa);}};exports['varset']=function(_0x40b8f9){try{if(!_['isNil'](_0x40b8f9['variable'])&&!_[_0xb161('0x15')](_0x40b8f9[_0xb161('0x1b')][_0xb161('0x1c')])){utils[_0xb161('0xb')](util[_0xb161('0x4')](_0xb161('0x1d'),_0x40b8f9[_0xb161('0x5')]),_0x40b8f9);utils[_0xb161('0x3')](util[_0xb161('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x40b8f9[_0xb161('0x5')],_0x40b8f9['variable'],_0x40b8f9['value']));if(_[_0xb161('0x1e')](_0x40b8f9['value'],_0xb161('0x1f'))){_0x40b8f9[_0xb161('0x20')]=_0x40b8f9[_0xb161('0x20')]['replace']('.wav49','.WAV');}if(recordings[_0x40b8f9['linkedid']]){var _0x337477=_[_0xb161('0x21')](recordings[_0x40b8f9[_0xb161('0x18')]][_0xb161('0x22')],{'value':_0x40b8f9[_0xb161('0x20')]});if(_[_0xb161('0x15')](_0x337477)){recordings[_0x40b8f9['linkedid']][_0xb161('0x22')][_0xb161('0x23')]({'value':_0x40b8f9[_0xb161('0x20')]});}}}}catch(_0x2fddb5){utils[_0xb161('0x12')](util[_0xb161('0x4')]('[%s][recordings][varset]',_0x40b8f9['uniqueid']),_0x2fddb5);}};exports[_0xb161('0x24')]=function(_0x4c8810){try{if(!_[_0xb161('0x15')](recordings[_0x4c8810['uniqueid']])){utils['debug'](util[_0xb161('0x4')](_0xb161('0x25'),_0x4c8810['uniqueid']),_0x4c8810);utils['info'](util[_0xb161('0x4')](_0xb161('0x26'),_0x4c8810[_0xb161('0x5')],_0x4c8810[_0xb161('0x27')],_0x4c8810[_0xb161('0x28')],_0x4c8810[_0xb161('0x29')]));recordings[_0x4c8810[_0xb161('0x5')]][_0xb161('0x27')]=_0x4c8810[_0xb161('0x27')];recordings[_0x4c8810[_0xb161('0x5')]][_0xb161('0x28')]=_0x4c8810[_0xb161('0x28')];recordings[_0x4c8810[_0xb161('0x5')]][_0xb161('0x2a')]=_0x4c8810[_0xb161('0x2a')];recordings[_0x4c8810[_0xb161('0x5')]][_0xb161('0x2b')]=_0x4c8810['connectedlinename'];if(recordings[_0x4c8810['uniqueid']][_0xb161('0x2c')]==_0xb161('0x2d')&&recordings[_0x4c8810[_0xb161('0x5')]][_0xb161('0x10')]){recordings[_0x4c8810['uniqueid']][_0xb161('0x2a')]=recordings[_0x4c8810[_0xb161('0x5')]][_0xb161('0x10')];recordings[_0x4c8810[_0xb161('0x5')]]['connectedlinename']='';}recordings[_0x4c8810[_0xb161('0x5')]][_0xb161('0x22')][_0xb161('0x2e')](function(_0x9de8cb){var _0x433c80=_[_0xb161('0x2f')](recordings[_0x4c8810[_0xb161('0x5')]]);_0x433c80[_0xb161('0x20')]=_0x9de8cb[_0xb161('0x20')];writeDB(_0x433c80);});delete recordings[_0x4c8810[_0xb161('0x5')]];}}catch(_0x1341e2){utils[_0xb161('0x12')](util[_0xb161('0x4')](_0xb161('0x25'),_0x4c8810[_0xb161('0x5')]),_0x1341e2);}};exports[_0xb161('0x30')]=function(_0x8ec72a){try{if(!_[_0xb161('0x15')](recordings[_0x8ec72a[_0xb161('0x5')]])){utils[_0xb161('0xb')](util['format'](_0xb161('0x31'),_0x8ec72a[_0xb161('0x5')]),_0x8ec72a);utils[_0xb161('0x3')](util[_0xb161('0x4')](_0xb161('0x32'),_0x8ec72a[_0xb161('0x5')],_0x8ec72a[_0xb161('0x33')],_0x8ec72a[_0xb161('0x34')]));if(_0x8ec72a[_0xb161('0x33')][_0xb161('0x35')]()=='set'&&_[_0xb161('0x36')](_0x8ec72a[_0xb161('0x34')][_0xb161('0x35')](),_0xb161('0x37'))){var _0x22377b=_0x8ec72a[_0xb161('0x34')][_0xb161('0x38')]('=');var _0x2c1d7a=_0x22377b[0x0][_0xb161('0x39')](_0x22377b[0x0][_0xb161('0x3a')]('(')+0x1,_0x22377b[0x0][_0xb161('0x3a')](')'));var _0x5887ae=_0x22377b[0x1];recordings[_0x8ec72a[_0xb161('0x5')]][_0x2c1d7a]=_0x5887ae;}}}catch(_0x2b8ff4){utils[_0xb161('0x12')](util['format'](_0xb161('0x31'),_0x8ec72a['uniqueid']),_0x2b8ff4);}};exports['queuecallerjoin']=function(_0x235567){try{if(!_['isNil'](recordings[_0x235567[_0xb161('0x5')]])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0x235567[_0xb161('0x5')]),_0x235567);utils[_0xb161('0x3')](util['format'](_0xb161('0x3b'),_0x235567['uniqueid'],_0x235567[_0xb161('0x3c')]));recordings[_0x235567[_0xb161('0x5')]][_0xb161('0x3c')]=_0x235567[_0xb161('0x3c')];}}catch(_0x481c85){utils[_0xb161('0x12')](util['format']('[%s][recordings][queuecallerjoin]',_0x235567['uniqueid']),_0x481c85);}}; \ No newline at end of file +var _0x09dd=['application','appdata','startsWith','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','debug','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','monitors','push','hangup','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s'];(function(_0x422aec,_0x163a10){var _0x598e8a=function(_0x592aeb){while(--_0x592aeb){_0x422aec['push'](_0x422aec['shift']());}};_0x598e8a(++_0x163a10);}(_0x09dd,0x81));var _0xd09d=function(_0x37dee5,_0x894eb5){_0x37dee5=_0x37dee5-0x0;var _0x42544b=_0x09dd[_0x37dee5];return _0x42544b;};'use strict';var _=require(_0xd09d('0x0'));var util=require(_0xd09d('0x1'));var utils=require(_0xd09d('0x2'));var recordings={};function writeDB(_0x5ec680){utils[_0xd09d('0x3')](util[_0xd09d('0x4')](_0xd09d('0x5'),_0x5ec680[_0xd09d('0x6')]));if(_0x5ec680[_0xd09d('0x7')]){utils[_0xd09d('0x8')](_0x5ec680[_0xd09d('0x7')])[_0xd09d('0x9')](function(_0x3410c4){if(_0x3410c4){_0x5ec680[_0xd09d('0xa')]=_0x3410c4['name'];_0x5ec680[_0xd09d('0xb')]=_0x3410c4['id'];}utils[_0xd09d('0xc')](_0xd09d('0xd'),_0x5ec680);});}else{utils[_0xd09d('0xc')](_0xd09d('0xd'),_0x5ec680);}}exports[_0xd09d('0xe')]=function(_0x2a26f7){try{utils['debug'](util[_0xd09d('0x4')](_0xd09d('0xf'),_0x2a26f7[_0xd09d('0x6')]),_0x2a26f7);if(_0x2a26f7[_0xd09d('0x6')]==_0x2a26f7[_0xd09d('0x10')]){utils['info'](util[_0xd09d('0x4')](_0xd09d('0x11'),_0x2a26f7[_0xd09d('0x6')],_0x2a26f7[_0xd09d('0x12')],_0x2a26f7[_0xd09d('0x13')]));recordings[_0x2a26f7[_0xd09d('0x6')]]={'uniqueid':_0x2a26f7[_0xd09d('0x6')],'accountcode':_0x2a26f7['accountcode'],'exten':_0x2a26f7[_0xd09d('0x13')],'context':_0x2a26f7['context'],'channel':_0x2a26f7['channel'],'monitors':[]};}}catch(_0x532b76){utils[_0xd09d('0x14')](util[_0xd09d('0x4')](_0xd09d('0xf'),_0x2a26f7[_0xd09d('0x6')]),_0x532b76);}};exports[_0xd09d('0x15')]=function(_0x48e9db){try{utils[_0xd09d('0x16')](util[_0xd09d('0x4')]('[%s][recordings][newstate]',_0x48e9db[_0xd09d('0x6')]),_0x48e9db);if(!_['isNil'](recordings[_0x48e9db[_0xd09d('0x6')]])&&_0x48e9db[_0xd09d('0x17')]==0x6){utils['info'](util[_0xd09d('0x4')](_0xd09d('0x18'),_0x48e9db[_0xd09d('0x6')],_0x48e9db[_0xd09d('0x12')],_0x48e9db['channel']));}else if(!_[_0xd09d('0x19')](recordings[_0x48e9db[_0xd09d('0x10')]])&&_0x48e9db[_0xd09d('0x17')]==0x6&&_0x48e9db[_0xd09d('0x12')]!='transfer'){utils['info'](util['format'](_0xd09d('0x1a'),_0x48e9db[_0xd09d('0x6')],_0x48e9db['linkedid'],_0x48e9db[_0xd09d('0x12')],_0x48e9db['channel']));recordings[_0x48e9db['linkedid']]['accountcode']=_0x48e9db[_0xd09d('0x7')];}}catch(_0x3281b1){utils['error'](util['format'](_0xd09d('0x1b'),_0x48e9db[_0xd09d('0x6')]),_0x3281b1);}};exports[_0xd09d('0x1c')]=function(_0x1f4cb8){try{if(!_[_0xd09d('0x19')](_0x1f4cb8[_0xd09d('0x1d')])&&!_['isNil'](_0x1f4cb8[_0xd09d('0x1d')]['mixmonitor_filename'])){utils[_0xd09d('0x16')](util[_0xd09d('0x4')](_0xd09d('0x1e'),_0x1f4cb8[_0xd09d('0x6')]),_0x1f4cb8);utils[_0xd09d('0x3')](util[_0xd09d('0x4')](_0xd09d('0x1f'),_0x1f4cb8[_0xd09d('0x6')],_0x1f4cb8[_0xd09d('0x1d')],_0x1f4cb8[_0xd09d('0x20')]));if(_[_0xd09d('0x21')](_0x1f4cb8[_0xd09d('0x20')],'.wav49')){_0x1f4cb8[_0xd09d('0x20')]=_0x1f4cb8[_0xd09d('0x20')][_0xd09d('0x22')](_0xd09d('0x23'),_0xd09d('0x24'));}if(recordings[_0x1f4cb8[_0xd09d('0x10')]]){var _0x211eea=_['find'](recordings[_0x1f4cb8[_0xd09d('0x10')]][_0xd09d('0x25')],{'value':_0x1f4cb8['value']});if(_['isNil'](_0x211eea)){recordings[_0x1f4cb8[_0xd09d('0x10')]][_0xd09d('0x25')][_0xd09d('0x26')]({'value':_0x1f4cb8[_0xd09d('0x20')]});}}}}catch(_0x3ce1e){utils[_0xd09d('0x14')](util[_0xd09d('0x4')]('[%s][recordings][varset]',_0x1f4cb8['uniqueid']),_0x3ce1e);}};exports[_0xd09d('0x27')]=function(_0x1b7674){try{if(!_[_0xd09d('0x19')](recordings[_0x1b7674[_0xd09d('0x6')]])){utils[_0xd09d('0x16')](util['format']('[%s][recordings][hangup]',_0x1b7674['uniqueid']),_0x1b7674);utils[_0xd09d('0x3')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x1b7674[_0xd09d('0x6')],_0x1b7674[_0xd09d('0x28')],_0x1b7674[_0xd09d('0x29')],_0x1b7674[_0xd09d('0x2a')]));recordings[_0x1b7674[_0xd09d('0x6')]][_0xd09d('0x28')]=_0x1b7674['calleridnum'];recordings[_0x1b7674[_0xd09d('0x6')]][_0xd09d('0x29')]=_0x1b7674[_0xd09d('0x29')];recordings[_0x1b7674[_0xd09d('0x6')]]['connectedlinenum']=_0x1b7674[_0xd09d('0x2b')];recordings[_0x1b7674[_0xd09d('0x6')]][_0xd09d('0x2c')]=_0x1b7674[_0xd09d('0x2c')];if(recordings[_0x1b7674[_0xd09d('0x6')]][_0xd09d('0x2d')]==_0xd09d('0x2e')&&recordings[_0x1b7674['uniqueid']][_0xd09d('0x7')]){recordings[_0x1b7674[_0xd09d('0x6')]][_0xd09d('0x2b')]=recordings[_0x1b7674[_0xd09d('0x6')]][_0xd09d('0x7')];recordings[_0x1b7674['uniqueid']]['connectedlinename']='';}recordings[_0x1b7674[_0xd09d('0x6')]][_0xd09d('0x25')][_0xd09d('0x2f')](function(_0x1757f6){var _0x1f7aca=_['clone'](recordings[_0x1b7674['uniqueid']]);_0x1f7aca[_0xd09d('0x20')]=_0x1757f6['value'];writeDB(_0x1f7aca);});delete recordings[_0x1b7674[_0xd09d('0x6')]];}}catch(_0x5d2f90){utils[_0xd09d('0x14')](util['format']('[%s][recordings][hangup]',_0x1b7674[_0xd09d('0x6')]),_0x5d2f90);}};exports[_0xd09d('0x30')]=function(_0x146cd7){try{if(!_[_0xd09d('0x19')](recordings[_0x146cd7['uniqueid']])){utils[_0xd09d('0x16')](util[_0xd09d('0x4')](_0xd09d('0x31'),_0x146cd7[_0xd09d('0x6')]),_0x146cd7);utils[_0xd09d('0x3')](util[_0xd09d('0x4')](_0xd09d('0x32'),_0x146cd7[_0xd09d('0x6')],_0x146cd7[_0xd09d('0x33')],_0x146cd7[_0xd09d('0x34')]));if(_0x146cd7[_0xd09d('0x33')]['toLowerCase']()=='set'&&_[_0xd09d('0x35')](_0x146cd7[_0xd09d('0x34')]['toLowerCase'](),_0xd09d('0x36'))){var _0x4d946e=_0x146cd7[_0xd09d('0x34')][_0xd09d('0x37')]('=');var _0x300683=_0x4d946e[0x0]['substring'](_0x4d946e[0x0][_0xd09d('0x38')]('(')+0x1,_0x4d946e[0x0][_0xd09d('0x38')](')'));var _0x41f6f3=_0x4d946e[0x1];recordings[_0x146cd7[_0xd09d('0x6')]][_0x300683]=_0x41f6f3;}}}catch(_0x1492fe){utils['error'](util[_0xd09d('0x4')](_0xd09d('0x31'),_0x146cd7[_0xd09d('0x6')]),_0x1492fe);}};exports['queuecallerjoin']=function(_0x44978b){try{if(!_[_0xd09d('0x19')](recordings[_0x44978b[_0xd09d('0x6')]])){utils[_0xd09d('0x16')](util[_0xd09d('0x4')](_0xd09d('0x39'),_0x44978b[_0xd09d('0x6')]),_0x44978b);utils[_0xd09d('0x3')](util[_0xd09d('0x4')](_0xd09d('0x3a'),_0x44978b['uniqueid'],_0x44978b[_0xd09d('0x3b')]));recordings[_0x44978b[_0xd09d('0x6')]][_0xd09d('0x3b')]=_0x44978b['queue'];}}catch(_0x574aba){utils[_0xd09d('0x14')](util['format'](_0xd09d('0x39'),_0x44978b[_0xd09d('0x6')]),_0x574aba);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b738df5..cdc0dda 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 _0x62f6=['assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','isNil','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','uniqueid','attendedtransfer','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x1965f9,_0x5df931){var _0x4aab6e=function(_0x59b40b){while(--_0x59b40b){_0x1965f9['push'](_0x1965f9['shift']());}};_0x4aab6e(++_0x5df931);}(_0x62f6,0x1aa));var _0x662f=function(_0x38fb1b,_0x105827){_0x38fb1b=_0x38fb1b-0x0;var _0x24dd7c=_0x62f6[_0x38fb1b];return _0x24dd7c;};'use strict';var _=require(_0x662f('0x0'));var util=require(_0x662f('0x1'));var utils=require(_0x662f('0x2'));function writeDB(_0x169293){utils[_0x662f('0x3')](util['format'](_0x662f('0x4'),_0x169293[_0x662f('0x5')]===_0x662f('0x6')?_0x169293[_0x662f('0x7')]:_0x169293['uniqueid'],_0x169293[_0x662f('0x5')]));utils[_0x662f('0x8')]('CreateVoiceTransferReport',_0x169293);}exports[_0x662f('0x9')]=function(_0x3f0100){try{utils[_0x662f('0xa')](util[_0x662f('0xb')](_0x662f('0xc'),_0x3f0100['uniqueid']),_0x3f0100);utils[_0x662f('0x3')](util[_0x662f('0xb')](_0x662f('0xd'),_0x3f0100['uniqueid'],_0x3f0100[_0x662f('0xe')],_0x3f0100[_0x662f('0xf')],_0x3f0100[_0x662f('0x10')],_0x3f0100[_0x662f('0x11')]));_0x3f0100['type']=_0x662f('0x12');writeDB(_0x3f0100);}catch(_0x7fe50){utils[_0x662f('0x13')](util[_0x662f('0xb')](_0x662f('0xc'),_0x3f0100[_0x662f('0x14')]),_0x7fe50);}};exports[_0x662f('0x15')]=function(_0x26603f){try{utils[_0x662f('0xa')](util[_0x662f('0xb')]('[%s][transfers][attendedtransfer]',_0x26603f['origtransfereruniqueid']),_0x26603f);utils['info'](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x26603f['origtransfereruniqueid'],_0x26603f['origtransferercalleridnum'],_0x26603f[_0x662f('0x16')],_0x26603f[_0x662f('0x17')],_0x26603f[_0x662f('0x18')]));_0x26603f=_[_0x662f('0x19')](_0x26603f,{'transfererchannel':_0x26603f[_0x662f('0x1a')],'transferercalleridnum':_0x26603f[_0x662f('0x1b')],'transferercalleridname':_0x26603f['origtransferercalleridname'],'transfererconnectedlinenum':_0x26603f[_0x662f('0x1c')],'transfererconnectedlinename':_0x26603f[_0x662f('0x1d')],'transfereraccountcode':_0x26603f[_0x662f('0x1e')],'transferercontext':_0x26603f[_0x662f('0x1f')],'transfererexten':_0x26603f['secondtransfererexten'],'transfererlinkedid':_0x26603f[_0x662f('0x20')],'context':_0x26603f[_0x662f('0x21')],'extension':_0x26603f['origtransfererexten'],'type':_0x662f('0x6')});if(_[_0x662f('0x22')](_0x26603f['transfereechannel'])){_0x26603f=_['assign'](_0x26603f,{'transfereechannel':_0x26603f[_0x662f('0x23')],'transfereecalleridnum':_0x26603f[_0x662f('0x17')],'transfereecalleridname':_0x26603f[_0x662f('0x18')],'transfereeconnectedlinenum':_0x26603f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x26603f[_0x662f('0x24')],'transfereeaccountcode':_0x26603f[_0x662f('0x25')],'transfereecontext':_0x26603f[_0x662f('0x26')],'transfereeexten':_0x26603f['transfertargetexten'],'transfereelinkedid':_0x26603f[_0x662f('0x27')]});}writeDB(_0x26603f);}catch(_0x4266e9){utils[_0x662f('0x13')](util['format'](_0x662f('0x28'),_0x26603f[_0x662f('0x7')]),_0x4266e9);}}; \ No newline at end of file +var _0x79f5=['origtransfereruniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','transferercalleridname','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransferercontext','origtransfererexten','assign','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended'];(function(_0x8b6a89,_0x225d76){var _0x4dc533=function(_0x1b32bc){while(--_0x1b32bc){_0x8b6a89['push'](_0x8b6a89['shift']());}};_0x4dc533(++_0x225d76);}(_0x79f5,0xed));var _0x579f=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x79f5[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x579f('0x0'));var util=require(_0x579f('0x1'));var utils=require(_0x579f('0x2'));function writeDB(_0x17a4ba){utils[_0x579f('0x3')](util[_0x579f('0x4')](_0x579f('0x5'),_0x17a4ba[_0x579f('0x6')]===_0x579f('0x7')?_0x17a4ba[_0x579f('0x8')]:_0x17a4ba['uniqueid'],_0x17a4ba[_0x579f('0x6')]));utils['request'](_0x579f('0x9'),_0x17a4ba);}exports[_0x579f('0xa')]=function(_0x7e8f14){try{utils[_0x579f('0xb')](util[_0x579f('0x4')](_0x579f('0xc'),_0x7e8f14[_0x579f('0xd')]),_0x7e8f14);utils[_0x579f('0x3')](util[_0x579f('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x7e8f14[_0x579f('0xd')],_0x7e8f14['transferercalleridnum'],_0x7e8f14[_0x579f('0xe')],_0x7e8f14['transfereecalleridnum'],_0x7e8f14['transfereecalleridname']));_0x7e8f14['type']=_0x579f('0xf');writeDB(_0x7e8f14);}catch(_0x97b1e1){utils[_0x579f('0x10')](util[_0x579f('0x4')](_0x579f('0xc'),_0x7e8f14[_0x579f('0xd')]),_0x97b1e1);}};exports['attendedtransfer']=function(_0x40d3cc){try{utils['debug'](util[_0x579f('0x4')](_0x579f('0x11'),_0x40d3cc[_0x579f('0x8')]),_0x40d3cc);utils[_0x579f('0x3')](util[_0x579f('0x4')](_0x579f('0x12'),_0x40d3cc[_0x579f('0x8')],_0x40d3cc[_0x579f('0x13')],_0x40d3cc[_0x579f('0x14')],_0x40d3cc[_0x579f('0x15')],_0x40d3cc['transfertargetcalleridname']));_0x40d3cc=_['assign'](_0x40d3cc,{'transfererchannel':_0x40d3cc[_0x579f('0x16')],'transferercalleridnum':_0x40d3cc['origtransferercalleridnum'],'transferercalleridname':_0x40d3cc[_0x579f('0x14')],'transfererconnectedlinenum':_0x40d3cc[_0x579f('0x17')],'transfererconnectedlinename':_0x40d3cc[_0x579f('0x18')],'transfereraccountcode':_0x40d3cc[_0x579f('0x19')],'transferercontext':_0x40d3cc['secondtransferercontext'],'transfererexten':_0x40d3cc['secondtransfererexten'],'transfererlinkedid':_0x40d3cc['origtransfererlinkedid'],'context':_0x40d3cc[_0x579f('0x1a')],'extension':_0x40d3cc[_0x579f('0x1b')],'type':_0x579f('0x7')});if(_['isNil'](_0x40d3cc['transfereechannel'])){_0x40d3cc=_[_0x579f('0x1c')](_0x40d3cc,{'transfereechannel':_0x40d3cc[_0x579f('0x1d')],'transfereecalleridnum':_0x40d3cc[_0x579f('0x15')],'transfereecalleridname':_0x40d3cc[_0x579f('0x1e')],'transfereeconnectedlinenum':_0x40d3cc[_0x579f('0x1f')],'transfereeconnectedlinename':_0x40d3cc['transfertargetconnectedlinename'],'transfereeaccountcode':_0x40d3cc[_0x579f('0x20')],'transfereecontext':_0x40d3cc['transfertargetcontext'],'transfereeexten':_0x40d3cc[_0x579f('0x21')],'transfereelinkedid':_0x40d3cc[_0x579f('0x22')]});}writeDB(_0x40d3cc);}catch(_0x179e61){utils[_0x579f('0x10')](util[_0x579f('0x4')](_0x579f('0x11'),_0x40d3cc[_0x579f('0x8')]),_0x179e61);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 78a9e74..afc458d 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(_0x5771a1,_0x3939ef){var _0x5a3ffe=function(_0x59bc39){while(--_0x59bc39){_0x5771a1['push'](_0x5771a1['shift']());}};_0x5a3ffe(++_0x3939ef);}(_0x7a54,0x106));var _0x47a5=function(_0xb2f2f7,_0x153483){_0xb2f2f7=_0xb2f2f7-0x0;var _0x37fc1b=_0x7a54[_0xb2f2f7];return _0x37fc1b;};'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 _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(_0x2500a0,_0x397225){var _0x54a7ca=function(_0x3f3c0a){while(--_0x3f3c0a){_0x2500a0['push'](_0x2500a0['shift']());}};_0x54a7ca(++_0x397225);}(_0x7a54,0x106));var _0x47a5=function(_0xe069f4,_0x3af17a){_0xe069f4=_0xe069f4-0x0;var _0x5c6f5b=_0x7a54[_0xe069f4];return _0x5c6f5b;};'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